From 3d52a387bacb3b15c9a34fb4e02d25318f4d68cd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 23 Mar 2020 15:04:50 -0600 Subject: [PATCH 01/21] Fix #921 --- src/utils/clmfates_paraminterfaceMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/clmfates_paraminterfaceMod.F90 b/src/utils/clmfates_paraminterfaceMod.F90 index 9a3ce58ff7..2f63389ad4 100644 --- a/src/utils/clmfates_paraminterfaceMod.F90 +++ b/src/utils/clmfates_paraminterfaceMod.F90 @@ -2,6 +2,7 @@ module CLMFatesParamInterfaceMod ! NOTE(bja, 2017-01) this code can not go into the main clm-fates ! interface module because of circular dependancies with pftvarcon. + use shr_kind_mod, only : r8 => shr_kind_r8 use FatesGlobals, only : fates_log implicit none @@ -172,7 +173,6 @@ end subroutine GetUsedDimensionSizes !----------------------------------------------------------------------- subroutine ParametersFromNetCDF(filename, is_host_file, fates_params) - use shr_kind_mod, only: r8 => shr_kind_r8 use abortutils, only : endrun use fileutils , only : getfil use ncdio_pio , only : file_desc_t, ncd_pio_closefile, ncd_pio_openfile From 60efa371be6e3993dda50cd60eeccb0aa035a6d3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 23 Mar 2020 15:17:05 -0600 Subject: [PATCH 02/21] Squashed 'manage_externals/' changes from fc5acdab..fde04e4d fde04e4d Merge pull request #138 from billsacks/add_python38_tests 37e4c4a5 Do not update dictionary in-place in loop 7e8474bb Remove testing on mac os 7f41c563 Fix pylint issue 3065b0d6 Add travis-ci tests with python3.7 and python3.8 34fbf556 Add support for git sparse checkout 6c6ef9fe Fix pylint errors 6a659ad3 Added test for sparse checkout and updated documentation 14432439 Support for git sparsecheckout via read-tree. a48558d8 Merge pull request #119 from gold2718/submodules f72ffe7f Do not try git submodule update if no .gitmodules file (git bug) 804e0afb Fix a pylint error 45aef95e Addressed review concerns 7da50314 New capability to use git submodule information to checkout externals 1926530f Merge pull request #118 from mnlevy1981/svn_switch b1b028d9 Updates after testing 9ea73e66 Add --svn-ignore-ancestry argument git-subtree-dir: manage_externals git-subtree-split: fde04e4d9a758b3aa277aa5fa44a59f5153f2958 --- .CTSMTrunkChecklist | 58 - .config_files.xml | 31 - .../.dir_locals.el => .dir_locals.el | 0 .../.github => .github}/ISSUE_TEMPLATE.md | 0 .github/ISSUE_TEMPLATE/01_bug_report.md | 29 - .github/ISSUE_TEMPLATE/02_support_needed.md | 36 - .../ISSUE_TEMPLATE/03_science_discussion.md | 7 - .github/ISSUE_TEMPLATE/04_other.md | 7 - .github/PULL_REQUEST_TEMPLATE.md | 27 +- .gitignore | 99 +- .travis.yml | 19 + CODE_OF_CONDUCT.md | 49 - CONTRIBUTING.md | 48 - Copyright | 75 - Externals.cfg | 38 - Externals_CLM.cfg | 17 - LICENSE | 34 - manage_externals/LICENSE.txt => LICENSE.txt | 0 README | 162 - manage_externals/README.md => README.md | 17 +- README.rst | 31 - README_EXTERNALS.rst | 124 - manage_externals/README_FIRST => README_FIRST | 0 bld/CLMBuildNamelist.pm | 4505 -- bld/README | 73 - bld/build-namelist | 23 - bld/config_files/clm_phys_vers.pm | 198 - bld/config_files/config_defaults.xml | 7 - .../config_defaults_1x1_mexicocityMEX.xml | 9 - .../config_defaults_1x1_numaIA.xml | 10 - .../config_defaults_1x1_smallvilleIA.xml | 10 - .../config_defaults_1x1_vancouverCAN.xml | 9 - bld/config_files/config_definition.xsl | 72 - bld/config_files/config_definition_clm4_0.xml | 115 - bld/config_files/config_definition_clm4_5.xml | 45 - bld/configure | 755 - bld/env_run.xml | 13 - bld/listDefaultNamelist.pl | 358 - bld/namelist_files/LogMessages.pm | 244 - bld/namelist_files/checkmapfiles.ncl | 236 - bld/namelist_files/createMapEntry.pl | 67 - bld/namelist_files/history_fields.xsl | 46 - bld/namelist_files/namelist_defaults.xsl | 177 - .../namelist_defaults_clm4_0.xml | 1069 - .../namelist_defaults_clm4_0_tools.xml | 9 - .../namelist_defaults_clm4_5.xml | 2453 - .../namelist_defaults_clm4_5_tools.xml | 633 - bld/namelist_files/namelist_defaults_drv.xml | 9 - .../namelist_defaults_drydep.xml | 30 - .../namelist_defaults_fire_emis.xml | 22 - .../namelist_defaults_overall.xml | 103 - .../namelist_defaults_usr_files.xml | 36 - bld/namelist_files/namelist_definition.xsl | 363 - .../namelist_definition_clm4_0.xml | 820 - .../namelist_definition_clm4_5.xml | 2456 - .../namelist_definition_drv.xml | 17 - .../namelist_definition_drv_flds.xml | 131 - .../use_cases/1850-2100_rcp2.6_transient.xml | 60 - .../use_cases/1850-2100_rcp4.5_transient.xml | 59 - .../use_cases/1850-2100_rcp6_transient.xml | 61 - .../use_cases/1850-2100_rcp8.5_transient.xml | 59 - bld/namelist_files/use_cases/1850_control.xml | 43 - .../use_cases/2000-2100_rcp8.5_transient.xml | 58 - bld/namelist_files/use_cases/2000_control.xml | 36 - .../use_cases/20thC_transient.xml | 52 - bld/namelist_files/use_cases/README | 39 - bld/namelist_files/use_cases/stdurbpt_pd.xml | 25 - bld/queryDefaultNamelist.pl | 319 - bld/queryDefaultXML.pm | 161 - bld/unit_testers/NMLTest/CompFiles.pm | 218 - bld/unit_testers/build-namelist_test.pl | 1420 - bld/unit_testers/myuser_nl_clm | 3 - .../xFail/expectedClmTestFails.xml | 58 - bld/unit_testers/xFail/expectedFail.pm | 668 - bld/unit_testers/xFail/wrapClmTests.pl | 128 - .../checkout_externals => checkout_externals | 0 cime_config/SystemTests/lii.py | 56 - cime_config/SystemTests/lii2finidatareas.py | 76 - cime_config/SystemTests/lvg.py | 37 - cime_config/SystemTests/ssp.py | 100 - cime_config/buildcpp | 52 - cime_config/buildlib | 117 - cime_config/buildnml | 272 - cime_config/config_component.xml | 235 - cime_config/config_compsets.xml | 408 - cime_config/config_pes.xml | 690 - cime_config/config_tests.xml | 68 - cime_config/testdefs/ExpectedTestFails.xml | 24 - cime_config/testdefs/testlist_clm.xml | 1921 - .../clm/40crop/include_user_mods | 1 - .../testmods_dirs/clm/40crop/user_nl_clm | 3 - .../clm/40default/shell_commands | 3 - .../testmods_dirs/clm/40default/user_nl_clm | 25 - .../testdefs/testmods_dirs/clm/40pts/README | 5 - .../testmods_dirs/clm/40pts/include_user_mods | 1 - .../testmods_dirs/clm/40pts/shell_commands | 24 - .../clm/40ptsRLA/include_user_mods | 1 - .../testmods_dirs/clm/40ptsRLA/shell_commands | 2 - .../clm/40ptsRLB/include_user_mods | 1 - .../testmods_dirs/clm/40ptsRLB/shell_commands | 2 - .../clm/40ptsROA/include_user_mods | 1 - .../testmods_dirs/clm/40ptsROA/shell_commands | 2 - .../clm/40reduceOutput/shell_commands | 4 - .../clm/40reduceOutput/user_nl_clm | 12 - .../clm/DA_multidrv/include_user_mods | 1 - .../clm/DA_multidrv/shell_commands | 6 - .../clm/DA_multidrv/user_nl_clm_0001 | 13 - .../clm/DA_multidrv/user_nl_clm_0002 | 13 - .../testmods_dirs/clm/Fates/shell_commands | 2 - .../testmods_dirs/clm/Fates/user_nl_clm | 11 - .../clm/FatesAllVars/include_user_mods | 1 - .../clm/FatesAllVars/shell_commands | 1 - .../clm/FatesAllVars/user_nl_clm | 31 - .../clm/FatesColdDef/include_user_mods | 1 - .../clm/FatesColdDef/shell_commands | 1 - .../clm/FatesColdDef/user_nl_clm | 6 - .../clm/FatesLogging/include_user_mods | 1 - .../clm/FatesLogging/user_nl_clm | 1 - .../clm/FatesNoFire/include_user_mods | 1 - .../testmods_dirs/clm/FatesNoFire/user_nl_clm | 1 - .../clm/FatesPPhys/include_user_mods | 1 - .../testmods_dirs/clm/FatesPPhys/user_nl_clm | 1 - .../clm/FatesST3/include_user_mods | 1 - .../testmods_dirs/clm/FatesST3/user_nl_clm | 1 - .../clm/FatesShortList/include_user_mods | 1 - .../clm/FatesShortList/user_nl_clm | 5 - .../clm/NoVSNoNI/include_user_mods | 1 - .../testmods_dirs/clm/NoVSNoNI/user_nl_clm | 4 - .../clm/SNICARFRC/include_user_mods | 1 - .../testmods_dirs/clm/SNICARFRC/user_nl_clm | 1 - .../testmods_dirs/clm/USUMB/shell_commands | 19 - .../testmods_dirs/clm/USUMB/user_nl_clm | 5 - .../clm/af_bias_v7/shell_commands | 3 - .../testmods_dirs/clm/af_bias_v7/user_nl_clm | 1 - .../testmods_dirs/clm/af_bias_v7/user_nl_datm | 1 - .../clm/allActive/include_user_mods | 1 - .../clm/allActive/shell_commands | 12 - .../testmods_dirs/clm/allActive/user_nl_clm | 15 - .../testmods_dirs/clm/ciso/include_user_mods | 1 - .../testmods_dirs/clm/ciso/user_nl_clm | 2 - .../clm/ciso_bombspike1963/include_user_mods | 1 - .../clm/ciso_bombspike1963/shell_commands | 1 - .../clm/ciso_bombspike1963/user_nl_clm | 6 - .../clm/ciso_decStart/include_user_mods | 2 - .../clm/ciso_flexCN_FUN/include_user_mods | 1 - .../clm/ciso_flexCN_FUN/user_nl_clm | 4 - .../clm/ciso_monthly/include_user_mods | 1 - .../clm/ciso_monthly/user_nl_clm | 2 - .../clm/ciso_rtmColdSSP/include_user_mods | 2 - .../clm/clm50CMIP6frc/include_user_mods | 1 - .../clm/clm50CMIP6frc/user_nl_clm | 3 - .../clm/clm50KSinkMOut/include_user_mods | 1 - .../clm/clm50KSinkMOut/user_nl_clm | 2 - .../clm/clm50KitchenSink/include_user_mods | 1 - .../clm/clm50KitchenSink/user_nl_clm | 6 - .../clm/clm50cropIrrigMonth_interp/README | 1 - .../include_user_mods | 1 - .../clm50cropIrrigMonth_interp/user_nl_clm | 6 - .../clm/clm50dynroots/include_user_mods | 1 - .../clm/clm50dynroots/user_nl_clm | 2 - .../testdefs/testmods_dirs/clm/cmip6/README | 6 - .../testmods_dirs/clm/cmip6/include_user_mods | 1 - .../testmods_dirs/clm/cmip6/shell_commands | 4 - .../clm/cn_conly/include_user_mods | 1 - .../testmods_dirs/clm/cn_conly/user_nl_clm | 1 - .../clm/compatible_finidat_f09/README | 23 - .../compatible_finidat_f09/include_user_mods | 1 - .../clm/compatible_finidat_f09/user_nl_clm | 1 - .../clm/cplhist/include_user_mods | 1 - .../testmods_dirs/clm/cplhist/shell_commands | 5 - .../testmods_dirs/clm/crop/include_user_mods | 1 - .../testmods_dirs/clm/crop/user_nl_clm | 8 - .../clm/cropColdStart/include_user_mods | 1 - .../clm/cropColdStart/shell_commands | 1 - .../clm/cropMonthOutput/include_user_mods | 1 - .../clm/cropMonthOutput/user_nl_clm | 2 - .../clm/decStart/include_user_mods | 1 - .../testmods_dirs/clm/decStart/shell_commands | 2 - .../testmods_dirs/clm/decStart/user_nl_cism | 9 - .../clm/decStart1851_noinitial/README | 8 - .../decStart1851_noinitial/include_user_mods | 1 - .../clm/decStart1851_noinitial/shell_commands | 2 - .../clm/deepsoil_bedrock/include_user_mods | 1 - .../clm/deepsoil_bedrock/user_nl_clm | 3 - .../testmods_dirs/clm/default/shell_commands | 5 - .../testmods_dirs/clm/default/user_nl_clm | 27 - .../clm/drydepnomegan/include_user_mods | 1 - .../clm/drydepnomegan/shell_commands | 1 - .../clm/fatesFire/include_user_mods | 1 - .../clm/fatesFire/shell_commands | 1 - .../testmods_dirs/clm/fatesFire/user_nl_clm | 2 - .../clm/fire_emis/include_user_mods | 1 - .../testmods_dirs/clm/fire_emis/user_nl_clm | 33 - .../clm/flexCN_FUN/include_user_mods | 1 - .../testmods_dirs/clm/flexCN_FUN/user_nl_clm | 4 - .../clm/glcMEC/include_user_mods | 1 - .../testmods_dirs/clm/glcMEC/user_nl_clm | 4 - .../clm/glcMEC_changeFlags/README | 4 - .../clm/glcMEC_changeFlags/include_user_mods | 1 - .../clm/glcMEC_changeFlags/shell_commands | 1 - .../clm/glcMEC_changeFlags/user_nl_clm | 1 - .../testmods_dirs/clm/glcMEC_decrease/README | 2 - .../clm/glcMEC_decrease/include_user_mods | 1 - .../clm/glcMEC_decrease/user_nl_cism | 6 - .../clm/glcMEC_decrease/user_nl_clm | 1 - .../testmods_dirs/clm/glcMEC_increase/README | 2 - .../clm/glcMEC_increase/include_user_mods | 1 - .../clm/glcMEC_increase/user_nl_cism | 4 - .../clm/glcMEC_increase/user_nl_clm | 1 - .../testmods_dirs/clm/glcMEC_long/README | 2 - .../clm/glcMEC_long/include_user_mods | 1 - .../testmods_dirs/clm/glcMEC_long/user_nl_clm | 2 - .../clm/glcMEC_spunup_1way/README | 34 - .../clm/glcMEC_spunup_1way/include_user_mods | 1 - .../clm/glcMEC_spunup_1way/shell_commands | 1 - .../clm/glcMEC_spunup_1way/user_nl_clm | 5 - .../clm/glcMEC_spunup_inc_dec_bgc/README | 12 - .../include_user_mods | 1 - .../glcMEC_spunup_inc_dec_bgc/user_nl_cism | 4 - .../clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm | 26 - .../irrigOn_reduceOutput/include_user_mods | 1 - .../clm/irrigOn_reduceOutput/shell_commands | 4 - .../clm/irrigOn_reduceOutput/user_nl_clm | 11 - .../clm/irrig_o3_reduceOutput/README | 3 - .../irrig_o3_reduceOutput/include_user_mods | 1 - .../clm/irrig_o3_reduceOutput/user_nl_clm | 6 - .../testmods_dirs/clm/irrig_spunup/README | 4 - .../clm/irrig_spunup/include_user_mods | 1 - .../clm/irrig_spunup/user_nl_clm | 6 - .../testmods_dirs/clm/luna/include_user_mods | 1 - .../testmods_dirs/clm/luna/user_nl_clm | 3 - .../clm/monthly/include_user_mods | 1 - .../testmods_dirs/clm/monthly/user_nl_clm | 5 - .../testmods_dirs/clm/monthly/user_nl_cpl | 1 - .../clm/monthly_noinitial/include_user_mods | 1 - .../clm/monthly_noinitial/shell_commands | 4 - .../clm/noFUN_flexCN/include_user_mods | 1 - .../clm/noFUN_flexCN/user_nl_clm | 3 - .../testmods_dirs/clm/no_vector_output/README | 2 - .../clm/no_vector_output/include_user_mods | 1 - .../clm/no_vector_output/user_nl_clm | 1 - .../testmods_dirs/clm/nofire/shell_commands | 5 - .../testmods_dirs/clm/nofire/user_nl_clm | 26 - .../testmods_dirs/clm/o3/include_user_mods | 1 - .../testdefs/testmods_dirs/clm/o3/user_nl_clm | 2 - .../testmods_dirs/clm/oldhyd/shell_commands | 2 - .../testmods_dirs/clm/oldhyd/user_nl_clm | 5 - .../clm/pauseResume/include_user_mods | 1 - .../clm/pauseResume/shell_commands | 4 - .../testdefs/testmods_dirs/clm/pts/README | 5 - .../testmods_dirs/clm/pts/include_user_mods | 1 - .../testmods_dirs/clm/pts/shell_commands | 24 - .../clm/ptsRLA/include_user_mods | 1 - .../testmods_dirs/clm/ptsRLA/shell_commands | 2 - .../clm/ptsRLB/include_user_mods | 1 - .../testmods_dirs/clm/ptsRLB/shell_commands | 2 - .../clm/ptsROA/include_user_mods | 1 - .../testmods_dirs/clm/ptsROA/shell_commands | 2 - .../rad_hrly_light_res_half/shell_commands | 2 - .../clm/rad_hrly_light_res_half/user_nl_datm | 1 - .../clm/reduceOutput/shell_commands | 8 - .../clm/reduceOutput/user_nl_clm | 12 - .../clm/reseedresetsnow/include_user_mods | 1 - .../clm/reseedresetsnow/user_nl_clm | 8 - .../clm/rootlit/include_user_mods | 1 - .../testmods_dirs/clm/rootlit/user_nl_clm | 3 - .../clm/rtmColdSSP/include_user_mods | 1 - .../testmods_dirs/clm/rtmColdSSP/user_nl_rtm | 4 - .../snowlayers_3_monthly/include_user_mods | 1 - .../clm/snowlayers_3_monthly/user_nl_clm | 4 - .../clm/vrtlay/include_user_mods | 1 - .../testmods_dirs/clm/vrtlay/user_nl_clm | 1 - cime_config/user_nl_clm | 22 - .../usermods_dirs/cmip6/include_user_mods | 2 - .../cmip6_evolving_icesheet/include_user_mods | 1 - .../cmip6_evolving_icesheet/user_nl_clm | 1 - .../usermods_dirs/cmip6_glaciers/user_nl_clm | 5 - cime_config/usermods_dirs/cmip6_output/README | 5 - .../usermods_dirs/cmip6_output/shell_commands | 4 - .../usermods_dirs/cmip6_output/user_nl_clm | 77 - .../usermods_dirs/cmip6_output/user_nl_cpl | 1 - doc/.ChangeLog_template | 136 - doc/.release-ChangeLog_template | 98 - doc/ChangeLog | 841 - doc/ChangeSum | 539 - doc/IMPORTANT_NOTES | 69 - doc/Quickstart.GUIDE | 60 - doc/UpdateChangelog.pl | 207 - doc/UsersGuide/Makefile | 193 - doc/UsersGuide/addco2_datm.buildnml.diff | 59 - doc/UsersGuide/adding_files.xml | 357 - doc/UsersGuide/addxhtmlhead.pl | 78 - doc/UsersGuide/appendix.xml | 305 - doc/UsersGuide/badpergro.jpg | Bin 40077 -> 0 bytes doc/UsersGuide/clm_stylesheet.dsl | 154 - doc/UsersGuide/clm_ug.xml | 191 - doc/UsersGuide/co2_streams.txt | 50 - doc/UsersGuide/custom.xml | 1615 - doc/UsersGuide/get_Icaselist.pl | 136 - doc/UsersGuide/limitLineLen.pl | 104 - doc/UsersGuide/modelnl/Makefile | 85 - doc/UsersGuide/modelnl/index.cpp | 45 - doc/UsersGuide/modelnl/showinfo.js | 193 - doc/UsersGuide/modelnl/xmldef2html_compsets | 162 - doc/UsersGuide/pergro.jpg | Bin 35642 -> 0 bytes doc/UsersGuide/preface.xml | 1419 - doc/UsersGuide/ptclm.xml | 992 - doc/UsersGuide/single_point.xml | 930 - doc/UsersGuide/special_cases.xml | 916 - doc/UsersGuide/stylesheethtml2docbook.xsl | 579 - doc/UsersGuide/tools.xml | 1396 - doc/UsersGuide/trouble_shooting.xml | 545 - doc/clm3_0_ChangeLog | 13104 ----- doc/clm4_0_ChangeLog | 16442 ------ doc/clm4_5_ChangeLog | 41442 ---------------- doc/clm5_0_ChangeLog | 1742 - doc/design/oo_design.rst | 17 - doc/release-clm5.0.ChangeLog | 767 - .../.github/PULL_REQUEST_TEMPLATE.md | 17 - manage_externals/.gitignore | 14 - manage_externals/.travis.yml | 32 - .../repos/simple-ext.git/refs/heads/master | 1 - {manage_externals/manic => manic}/__init__.py | 0 {manage_externals/manic => manic}/checkout.py | 24 +- .../manic => manic}/externals_description.py | 359 +- .../manic => manic}/externals_status.py | 0 .../manic => manic}/global_constants.py | 0 .../manic => manic}/repository.py | 20 +- .../manic => manic}/repository_factory.py | 4 +- .../manic => manic}/repository_git.py | 124 +- .../manic => manic}/repository_svn.py | 25 +- .../manic => manic}/sourcetree.py | 86 +- {manage_externals/manic => manic}/utils.py | 0 parse_cime.cs.status | 416 - src/CMakeLists.txt | 108 - src/README.unit_testing | 13 - src/biogeochem/CMakeLists.txt | 13 - src/biogeochem/CNAnnualUpdateMod.F90 | 113 - src/biogeochem/CNBalanceCheckMod.F90 | 358 - src/biogeochem/CNC14DecayMod.F90 | 159 - src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90 | 319 - src/biogeochem/CNCIsoFluxMod.F90 | 1606 - src/biogeochem/CNCStateUpdate1Mod.F90 | 497 - src/biogeochem/CNCStateUpdate2Mod.F90 | 247 - src/biogeochem/CNCStateUpdate3Mod.F90 | 187 - src/biogeochem/CNDVDriverMod.F90 | 467 - src/biogeochem/CNDVEstablishmentMod.F90 | 451 - src/biogeochem/CNDVLightMod.F90 | 231 - src/biogeochem/CNDVType.F90 | 519 - src/biogeochem/CNDriverMod.F90 | 1057 - src/biogeochem/CNFUNMod.F90 | 1801 - src/biogeochem/CNFireBaseMod.F90 | 1260 - src/biogeochem/CNFireEmissionsMod.F90 | 377 - src/biogeochem/CNFireFactoryMod.F90 | 125 - src/biogeochem/CNFireLi2014Mod.F90 | 1268 - src/biogeochem/CNFireLi2016Mod.F90 | 657 - src/biogeochem/CNFireMethodMod.F90 | 191 - src/biogeochem/CNFireNoFireMod.F90 | 130 - src/biogeochem/CNGRespMod.F90 | 214 - src/biogeochem/CNGapMortalityMod.F90 | 493 - src/biogeochem/CNMRespMod.F90 | 298 - src/biogeochem/CNNDynamicsMod.F90 | 441 - src/biogeochem/CNNStateUpdate1Mod.F90 | 287 - src/biogeochem/CNNStateUpdate2Mod.F90 | 238 - src/biogeochem/CNNStateUpdate3Mod.F90 | 210 - src/biogeochem/CNPhenologyMod.F90 | 3014 -- src/biogeochem/CNPrecisionControlMod.F90 | 615 - src/biogeochem/CNProductsMod.F90 | 741 - src/biogeochem/CNRootDynMod.F90 | 277 - src/biogeochem/CNSharedParamsMod.F90 | 192 - src/biogeochem/CNSpeciesMod.F90 | 68 - src/biogeochem/CNVegCarbonFluxType.F90 | 4597 -- src/biogeochem/CNVegCarbonStateType.F90 | 2743 - src/biogeochem/CNVegComputeSeedMod.F90 | 259 - src/biogeochem/CNVegNitrogenFluxType.F90 | 1881 - src/biogeochem/CNVegNitrogenStateType.F90 | 1286 - src/biogeochem/CNVegStateType.F90 | 948 - src/biogeochem/CNVegStructUpdateMod.F90 | 307 - src/biogeochem/CNVegetationFacade.F90 | 1437 - src/biogeochem/CropType.F90 | 723 - src/biogeochem/DUSTMod.F90 | 925 - src/biogeochem/DryDepVelocity.F90 | 678 - src/biogeochem/EDBGCDynMod.F90 | 362 - src/biogeochem/FireEmisFactorsMod.F90 | 262 - src/biogeochem/MEGANFactorsMod.F90 | 307 - .../NutrientCompetitionCLM45defaultMod.F90 | 992 - .../NutrientCompetitionFactoryMod.F90 | 87 - .../NutrientCompetitionFlexibleCNMod.F90 | 1773 - .../NutrientCompetitionMethodMod.F90 | 202 - src/biogeochem/SatellitePhenologyMod.F90 | 684 - src/biogeochem/SpeciesBaseType.F90 | 67 - src/biogeochem/SpeciesIsotopeType.F90 | 136 - src/biogeochem/SpeciesNonIsotopeType.F90 | 125 - src/biogeochem/VOCEmissionMod.F90 | 1102 - src/biogeochem/ch4FInundatedStreamType.F90 | 393 - src/biogeochem/ch4Mod.F90 | 4197 -- src/biogeochem/ch4varcon.F90 | 192 - src/biogeochem/dynCNDVMod.F90 | 110 - src/biogeochem/dynConsBiogeochemMod.F90 | 886 - src/biogeochem/dynHarvestMod.F90 | 648 - src/biogeochem/test/CMakeLists.txt | 2 - .../test/CNVegComputeSeed_test/CMakeLists.txt | 7 - .../test_ComputeSeedAmounts.pf | 361 - .../test/Species_test/CMakeLists.txt | 8 - .../test/Species_test/test_SpeciesIsotope.pf | 95 - .../Species_test/test_SpeciesNonIsotope.pf | 83 - src/biogeophys/ActiveLayerMod.F90 | 155 - src/biogeophys/AerosolMod.F90 | 797 - src/biogeophys/BalanceCheckMod.F90 | 637 - src/biogeophys/BandDiagonalMod.F90 | 224 - src/biogeophys/BareGroundFluxesMod.F90 | 431 - src/biogeophys/CMakeLists.txt | 25 - src/biogeophys/CanopyFluxesMod.F90 | 1372 - src/biogeophys/CanopyHydrologyMod.F90 | 923 - src/biogeophys/CanopyStateType.F90 | 640 - src/biogeophys/CanopyTemperatureMod.F90 | 502 - src/biogeophys/DaylengthMod.F90 | 215 - src/biogeophys/EnergyFluxType.F90 | 1036 - src/biogeophys/FrictionVelocityMod.F90 | 834 - .../GlacierSurfaceMassBalanceMod.F90 | 452 - src/biogeophys/HumanIndexMod.F90 | 1354 - src/biogeophys/HydrologyDrainageMod.F90 | 225 - src/biogeophys/HydrologyNoDrainageMod.F90 | 574 - src/biogeophys/IrrigationMod.F90 | 1206 - src/biogeophys/LakeCon.F90 | 178 - src/biogeophys/LakeFluxesMod.F90 | 668 - src/biogeophys/LakeHydrologyMod.F90 | 684 - src/biogeophys/LakeStateType.F90 | 296 - src/biogeophys/LakeTemperatureMod.F90 | 1466 - src/biogeophys/LunaMod.F90 | 1358 - src/biogeophys/OzoneBaseMod.F90 | 146 - src/biogeophys/OzoneFactoryMod.F90 | 53 - src/biogeophys/OzoneMod.F90 | 543 - src/biogeophys/OzoneOffMod.F90 | 118 - src/biogeophys/PhotosynthesisMod.F90 | 4948 -- src/biogeophys/QSatMod.F90 | 167 - src/biogeophys/RootBiophysMod.F90 | 332 - src/biogeophys/SnowHydrologyMod.F90 | 2143 - src/biogeophys/SnowSnicarMod.F90 | 1480 - src/biogeophys/SoilFluxesMod.F90 | 461 - .../SoilHydrologyInitTimeConstMod.F90 | 568 - src/biogeophys/SoilHydrologyMod.F90 | 2337 - src/biogeophys/SoilHydrologyType.F90 | 338 - src/biogeophys/SoilMoistStressMod.F90 | 520 - src/biogeophys/SoilStateInitTimeConstMod.F90 | 630 - src/biogeophys/SoilStateType.F90 | 417 - src/biogeophys/SoilTemperatureMod.F90 | 4763 -- src/biogeophys/SoilWaterMovementMod.F90 | 2233 - src/biogeophys/SoilWaterPlantSinkMod.F90 | 444 - ...aterRetentionCurveClappHornberg1978Mod.F90 | 162 - .../SoilWaterRetentionCurveFactoryMod.F90 | 71 - src/biogeophys/SoilWaterRetentionCurveMod.F90 | 111 - ...WaterRetentionCurveVanGenuchten1980Mod.F90 | 162 - src/biogeophys/SolarAbsorbedType.F90 | 423 - src/biogeophys/SurfaceAlbedoMod.F90 | 1602 - src/biogeophys/SurfaceAlbedoType.F90 | 636 - src/biogeophys/SurfaceRadiationMod.F90 | 953 - src/biogeophys/SurfaceResistanceMod.F90 | 416 - src/biogeophys/TemperatureType.F90 | 1502 - src/biogeophys/TotalWaterAndHeatMod.F90 | 909 - src/biogeophys/TridiagonalMod.F90 | 118 - src/biogeophys/UrbBuildTempOleson2015Mod.F90 | 938 - src/biogeophys/UrbanAlbedoMod.F90 | 1286 - src/biogeophys/UrbanFluxesMod.F90 | 1115 - src/biogeophys/UrbanParamsType.F90 | 961 - src/biogeophys/UrbanRadiationMod.F90 | 720 - src/biogeophys/UrbanTimeVarType.F90 | 310 - src/biogeophys/WaterStateType.F90 | 1137 - src/biogeophys/WaterfluxType.F90 | 736 - src/biogeophys/test/CMakeLists.txt | 5 - .../test/Daylength_test/CMakeLists.txt | 8 - .../test_compute_max_daylength.pf | 100 - .../test/Daylength_test/test_daylength.pf | 76 - .../test/HumanStress_test/CMakeLists.txt | 4 - .../test/HumanStress_test/test_humanstress.pf | 139 - .../test/Irrigation_test/CMakeLists.txt | 12 - src/biogeophys/test/Irrigation_test/README | 68 - .../test/Irrigation_test/test_irrigation.pf | 976 - .../test/SnowHydrology_test/CMakeLists.txt | 9 - src/biogeophys/test/SnowHydrology_test/README | 4 - .../test_SnowHydrology_SnowCappingExcess.pf | 230 - .../test_SnowHydrology_initSnowLayers.pf | 73 - .../test_SnowHydrology_newSnowBulkDensity.pf | 260 - .../TotalWaterAndHeat_test/CMakeLists.txt | 12 - .../test_total_water_and_heat.pf | 187 - src/cpl/clm_cpl_indices.F90 | 330 - src/cpl/lnd_comp_mct.F90 | 697 - src/cpl/lnd_import_export.F90 | 429 - src/dyn_subgrid/CMakeLists.txt | 26 - src/dyn_subgrid/dynColumnStateUpdaterMod.F90 | 951 - src/dyn_subgrid/dynColumnTemplateMod.F90 | 168 - src/dyn_subgrid/dynConsBiogeophysMod.F90 | 337 - src/dyn_subgrid/dynEDMod.F90 | 43 - src/dyn_subgrid/dynFileMod.F90 | 91 - src/dyn_subgrid/dynInitColumnsMod.F90 | 263 - src/dyn_subgrid/dynLandunitAreaMod.F90 | 166 - src/dyn_subgrid/dynPatchStateUpdaterMod.F90 | 455 - src/dyn_subgrid/dynPriorWeightsMod.F90 | 95 - src/dyn_subgrid/dynSubgridControlMod.F90 | 348 - src/dyn_subgrid/dynSubgridDriverMod.F90 | 347 - src/dyn_subgrid/dynTimeInfoMod.F90 | 375 - src/dyn_subgrid/dynVarMod.F90.in | 375 - src/dyn_subgrid/dynVarTimeInterpMod.F90.in | 219 - src/dyn_subgrid/dynVarTimeUninterpMod.F90.in | 181 - src/dyn_subgrid/dyncropFileMod.F90 | 201 - src/dyn_subgrid/dynpftFileMod.F90 | 295 - src/dyn_subgrid/test/CMakeLists.txt | 7 - .../dynColumnStateUpdater_test/CMakeLists.txt | 4 - .../test_column_state_updater.pf | 1213 - .../dynColumnTemplate_test/CMakeLists.txt | 4 - .../test_column_template.pf | 179 - .../test/dynInitColumns_test/CMakeLists.txt | 4 - .../dynInitColumns_test/test_init_columns.pf | 219 - .../test/dynLandunitArea_test/CMakeLists.txt | 9 - .../test_update_landunit_weights.pf | 147 - .../test_update_landunit_weights_one_gcell.pf | 135 - .../dynPatchStateUpdater_test/CMakeLists.txt | 4 - .../test_patch_state_updater.pf | 510 - .../test/dynTimeInfo_test/CMakeLists.txt | 4 - .../test/dynTimeInfo_test/test_dynTimeInfo.pf | 559 - .../test/dynVar_test/CMakeLists.txt | 12 - .../test/dynVar_test/test_dynVarShared.F90 | 49 - .../test/dynVar_test/test_dynVarTimeInterp.pf | 356 - .../dynVar_test/test_dynVarTimeUninterp.pf | 198 - src/init_interp/CMakeLists.txt | 14 - src/init_interp/initInterp.F90 | 1261 - src/init_interp/initInterp1dData.F90 | 126 - src/init_interp/initInterp2dvar.F90.in | 383 - src/init_interp/initInterpBounds.F90 | 198 - src/init_interp/initInterpMindist.F90 | 699 - src/init_interp/initInterpMultilevelBase.F90 | 91 - .../initInterpMultilevelContainer.F90 | 494 - src/init_interp/initInterpMultilevelCopy.F90 | 139 - .../initInterpMultilevelInterp.F90 | 599 - src/init_interp/initInterpMultilevelSnow.F90 | 227 - src/init_interp/initInterpMultilevelSplit.F90 | 209 - src/init_interp/initInterpUtils.F90 | 112 - src/init_interp/test/CMakeLists.txt | 3 - .../initInterpMindist_test/CMakeLists.txt | 9 - .../initInterpMindistTestUtils.pf | 136 - .../test_set_mindist.pf | 849 - .../test_set_single_match.pf | 359 - .../initInterpMultilevel_test/CMakeLists.txt | 14 - .../initInterpMultilevelMock.pf | 112 - .../multilevel_interp_factory.F90 | 179 - .../test_init_interp_multilevel_interp.pf | 352 - .../test_init_interp_multilevel_snow.pf | 172 - .../test_init_interp_multilevel_split.pf | 140 - .../test/initInterpUtils_test/CMakeLists.txt | 7 - .../test_glc_elevclasses_are_same.pf | 103 - src/main/CMakeLists.txt | 35 - src/main/ColumnType.F90 | 208 - src/main/FuncPedotransferMod.F90 | 141 - src/main/GetGlobalValuesMod.F90 | 153 - src/main/GridcellType.F90 | 106 - src/main/LandunitType.F90 | 140 - src/main/PatchType.F90 | 207 - src/main/TopoMod.F90 | 321 - src/main/abortutils.F90 | 95 - src/main/accumulMod.F90 | 827 - src/main/atm2lndMod.F90 | 682 - src/main/atm2lndType.F90 | 1304 - src/main/clm_driver.F90 | 1446 - src/main/clm_initializeMod.F90 | 691 - src/main/clm_instMod.F90 | 553 - src/main/clm_varcon.F90 | 304 - src/main/clm_varctl.F90 | 394 - src/main/clm_varpar.F90 | 215 - src/main/clm_varsur.F90 | 45 - src/main/column_varcon.F90 | 171 - src/main/controlMod.F90 | 1019 - src/main/decompInitMod.F90 | 888 - src/main/decompMod.F90 | 483 - src/main/dtypes.h | 6 - src/main/filterColMod.F90 | 444 - src/main/filterMod.F90 | 584 - src/main/findHistFields.pl | 546 - src/main/glc2lndMod.F90 | 674 - src/main/glcBehaviorMod.F90 | 1077 - src/main/histFileMod.F90 | 5201 -- src/main/initGridCellsMod.F90 | 600 - src/main/initSubgridMod.F90 | 475 - src/main/initVerticalMod.F90 | 795 - src/main/init_hydrology.F90 | 39 - src/main/landunit_varcon.F90 | 133 - src/main/lnd2atmMod.F90 | 491 - src/main/lnd2atmType.F90 | 329 - src/main/lnd2glcMod.F90 | 304 - src/main/ncdio_pio.F90.in | 2419 - src/main/ncdio_utils.F90 | 70 - src/main/ndepStreamMod.F90 | 353 - src/main/organicFileMod.F90 | 113 - src/main/paramUtilMod.F90 | 291 - src/main/pftconMod.F90 | 1381 - src/main/readParamsMod.F90 | 107 - src/main/restFileMod.F90 | 933 - src/main/reweightMod.F90 | 61 - src/main/subgridAveMod.F90 | 1347 - src/main/subgridMod.F90 | 564 - src/main/subgridRestMod.F90 | 733 - src/main/subgridWeightsMod.F90 | 872 - src/main/surfrdMod.F90 | 819 - src/main/surfrdUtilsMod.F90 | 243 - src/main/test/CMakeLists.txt | 9 - src/main/test/accumul_test/CMakeLists.txt | 7 - src/main/test/accumul_test/test_accumul.pf | 720 - src/main/test/atm2lnd_test/CMakeLists.txt | 9 - .../atm2lnd_test/test_downscale_forcings.pf | 460 - .../atm2lnd_test/test_partition_precip.pf | 271 - .../test_sens_heat_from_precip_conversion.pf | 43 - src/main/test/clm_glclnd_test/CMakeLists.txt | 4 - .../test/clm_glclnd_test/test_clm_glclnd.pf | 76 - src/main/test/filter_test/CMakeLists.txt | 4 - src/main/test/filter_test/test_filter_col.pf | 474 - src/main/test/glcBehavior_test/CMakeLists.txt | 4 - .../test/glcBehavior_test/test_glcBehavior.pf | 318 - src/main/test/ncdio_utils_test/CMakeLists.txt | 4 - .../test/ncdio_utils_test/test_ncdio_utils.pf | 131 - .../test/subgridWeights_test/CMakeLists.txt | 4 - .../test_subgridWeights.pf | 86 - src/main/test/surfrdUtils_test/CMakeLists.txt | 4 - .../test/surfrdUtils_test/test_surfrdUtils.pf | 217 - src/main/test/topo_test/CMakeLists.txt | 4 - src/main/test/topo_test/test_topo.pf | 389 - src/soilbiogeochem/CMakeLists.txt | 8 - .../SoilBiogeochemCarbonFluxType.F90 | 828 - .../SoilBiogeochemCarbonStateType.F90 | 1004 - .../SoilBiogeochemCompetitionMod.F90 | 948 - .../SoilBiogeochemDecompCascadeBGCMod.F90 | 1120 - .../SoilBiogeochemDecompCascadeCNMod.F90 | 952 - .../SoilBiogeochemDecompCascadeConType.F90 | 104 - .../SoilBiogeochemDecompMod.F90 | 277 - .../SoilBiogeochemLittVertTranspMod.F90 | 516 - .../SoilBiogeochemNLeachingMod.F90 | 289 - .../SoilBiogeochemNStateUpdate1Mod.F90 | 267 - .../SoilBiogeochemNitrifDenitrifMod.F90 | 469 - .../SoilBiogeochemNitrogenFluxType.F90 | 1279 - .../SoilBiogeochemNitrogenStateType.F90 | 1023 - .../SoilBiogeochemNitrogenUptakeMod.F90 | 81 - .../SoilBiogeochemPotentialMod.F90 | 266 - .../SoilBiogeochemPrecisionControlMod.F90 | 196 - .../SoilBiogeochemStateType.F90 | 336 - .../SoilBiogeochemVerticalProfileMod.F90 | 277 - .../test/ACSpinup_test/CMakeLists.txt | 4 - .../test/ACSpinup_test/test_acspinup.pf | 46 - src/soilbiogeochem/test/CMakeLists.txt | 1 - src/unit_test_shr/CMakeLists.txt | 20 - src/unit_test_shr/test/CMakeLists.txt | 3 - .../test/unittestArray_test/CMakeLists.txt | 4 - .../unittestArray_test/test_unittestArray.pf | 86 - .../unittestFilterBuilder_test/CMakeLists.txt | 4 - .../test_filterBuilder.pf | 46 - .../test/unittestSubgrid_test/CMakeLists.txt | 4 - .../test_unittestSubgrid.pf | 39 - src/unit_test_shr/unittestArrayMod.F90.in | 220 - .../unittestFilterBuilderMod.F90 | 71 - src/unit_test_shr/unittestGlcMec.F90 | 68 - .../unittestSimpleSubgridSetupsMod.F90 | 313 - src/unit_test_shr/unittestSubgridMod.F90 | 483 - src/unit_test_shr/unittestTimeManagerMod.F90 | 222 - src/unit_test_shr/unittestUtils.F90 | 33 - src/unit_test_stubs/CMakeLists.txt | 8 - src/unit_test_stubs/csm_share/CMakeLists.txt | 7 - .../csm_share/mct_mod_stub.F90 | 30 - .../csm_share/seq_comm_mct.F90 | 10 - .../csm_share/shr_mpi_mod_stub.F90 | 469 - .../dyn_subgrid/CMakeLists.txt | 5 - .../dyn_subgrid/dynFileMod_stub.F90 | 47 - src/unit_test_stubs/main/CMakeLists.txt | 20 - .../main/GetGlobalValuesMod_stub.F90 | 19 - src/unit_test_stubs/main/histFileMod_stub.F90 | 111 - src/unit_test_stubs/main/ncdio_dim.F90 | 58 - .../main/ncdio_pio_fake.F90.in | 822 - src/unit_test_stubs/main/ncdio_var.F90.in | 141 - src/unit_test_stubs/utils/CMakeLists.txt | 17 - .../utils/clmfates_paraminterfaceMod_stub.F90 | 11 - .../utils/restUtilMod_stub.F90.in | 150 - src/unit_test_stubs/utils/spmdMod_stub.F90 | 15 - src/utils/AnnualFluxDribbler.F90 | 615 - src/utils/CMakeLists.txt | 23 - src/utils/SimpleMathMod.F90 | 230 - src/utils/array_utils.F90.in | 99 - src/utils/clm_nlUtilsMod.F90 | 116 - src/utils/clm_time_manager.F90 | 1956 - src/utils/clm_varorb.F90 | 17 - src/utils/clmfates_interfaceMod.F90 | 2379 - src/utils/clmfates_paraminterfaceMod.F90 | 240 - src/utils/domainMod.F90 | 233 - src/utils/dtypes.h | 6 - src/utils/fileutils.F90 | 179 - src/utils/getdatetime.F90 | 53 - src/utils/quadraticMod.F90 | 76 - src/utils/restUtilMod.F90.in | 701 - src/utils/spmdGathScatMod.F90 | 540 - src/utils/spmdMod.F90 | 142 - src/utils/test/CMakeLists.txt | 3 - .../annual_flux_dribbler_test/CMakeLists.txt | 4 - .../test_annual_flux_dribbler.pf | 300 - .../test/clm_time_manager_test/CMakeLists.txt | 4 - .../test_clm_time_manager.pf | 223 - src/utils/test/quadratic_test/CMakeLists.txt | 4 - .../test/quadratic_test/test_quadratic.pf | 187 - src_clm40/biogeochem/C13SummaryMod.F90 | 820 - src_clm40/biogeochem/CNAllocationMod.F90 | 902 - src_clm40/biogeochem/CNAnnualUpdateMod.F90 | 195 - src_clm40/biogeochem/CNBalanceCheckMod.F90 | 396 - src_clm40/biogeochem/CNC13FluxMod.F90 | 1448 - src_clm40/biogeochem/CNC13StateUpdate1Mod.F90 | 591 - src_clm40/biogeochem/CNC13StateUpdate2Mod.F90 | 576 - src_clm40/biogeochem/CNC13StateUpdate3Mod.F90 | 244 - src_clm40/biogeochem/CNCStateUpdate1Mod.F90 | 688 - src_clm40/biogeochem/CNCStateUpdate2Mod.F90 | 569 - src_clm40/biogeochem/CNCStateUpdate3Mod.F90 | 238 - .../biogeochem/CNDVEcosystemDynIniMod.F90 | 93 - src_clm40/biogeochem/CNDVEstablishmentMod.F90 | 518 - src_clm40/biogeochem/CNDVLightMod.F90 | 273 - src_clm40/biogeochem/CNDVMod.F90 | 558 - src_clm40/biogeochem/CNDecompMod.F90 | 674 - src_clm40/biogeochem/CNEcosystemDynMod.F90 | 259 - src_clm40/biogeochem/CNFireMod.F90 | 668 - src_clm40/biogeochem/CNGRespMod.F90 | 221 - src_clm40/biogeochem/CNGapMortalityMod.F90 | 717 - src_clm40/biogeochem/CNMRespMod.F90 | 180 - src_clm40/biogeochem/CNNDynamicsMod.F90 | 268 - src_clm40/biogeochem/CNNStateUpdate1Mod.F90 | 537 - src_clm40/biogeochem/CNNStateUpdate2Mod.F90 | 550 - src_clm40/biogeochem/CNNStateUpdate3Mod.F90 | 243 - src_clm40/biogeochem/CNPhenologyMod.F90 | 2750 - .../biogeochem/CNPrecisionControlMod.F90 | 737 - src_clm40/biogeochem/CNSetValueMod.F90 | 1280 - src_clm40/biogeochem/CNSummaryMod.F90 | 1402 - src_clm40/biogeochem/CNVegStructUpdateMod.F90 | 317 - src_clm40/biogeochem/CNWoodProductsMod.F90 | 138 - src_clm40/biogeochem/CNrestMod.F90 | 2339 - src_clm40/biogeochem/CropRestMod.F90 | 744 - src_clm40/biogeochem/DUSTMod.F90 | 900 - src_clm40/biogeochem/DryDepVelocity.F90 | 608 - src_clm40/biogeochem/MEGANFactorsMod.F90 | 319 - src_clm40/biogeochem/STATICEcosysDynMod.F90 | 549 - src_clm40/biogeochem/VOCEmissionMod.F90 | 1023 - src_clm40/biogeophys/BalanceCheckMod.F90 | 735 - src_clm40/biogeophys/BareGroundFluxesMod.F90 | 441 - src_clm40/biogeophys/BiogeophysRestMod.F90 | 2137 - src_clm40/biogeophys/Biogeophysics1Mod.F90 | 544 - src_clm40/biogeophys/Biogeophysics2Mod.F90 | 509 - src_clm40/biogeophys/BiogeophysicsLakeMod.F90 | 764 - src_clm40/biogeophys/CanopyFluxesMod.F90 | 1434 - src_clm40/biogeophys/FracWetMod.F90 | 115 - src_clm40/biogeophys/FrictionVelocityMod.F90 | 572 - src_clm40/biogeophys/Hydrology1Mod.F90 | 499 - src_clm40/biogeophys/Hydrology2Mod.F90 | 757 - src_clm40/biogeophys/HydrologyLakeMod.F90 | 322 - src_clm40/biogeophys/QSatMod.F90 | 149 - src_clm40/biogeophys/SNICARMod.F90 | 1494 - src_clm40/biogeophys/SnowHydrologyMod.F90 | 1650 - src_clm40/biogeophys/SoilHydrologyMod.F90 | 1243 - src_clm40/biogeophys/SoilTemperatureMod.F90 | 1225 - src_clm40/biogeophys/SurfaceAlbedoMod.F90 | 1045 - src_clm40/biogeophys/SurfaceRadiationMod.F90 | 801 - src_clm40/biogeophys/TridiagonalMod.F90 | 106 - src_clm40/biogeophys/UrbanInitMod.F90 | 477 - src_clm40/biogeophys/UrbanInputMod.F90 | 355 - src_clm40/biogeophys/UrbanMod.F90 | 3464 -- src_clm40/biogeophys/clm_driverInitMod.F90 | 247 - src_clm40/main/CMakeLists.txt | 6 - src_clm40/main/CNiniSpecial.F90 | 223 - src_clm40/main/CNiniTimeVar.F90 | 875 - src_clm40/main/GetGlobalValuesMod.F90 | 145 - src_clm40/main/SimpleMathMod.F90 | 226 - src_clm40/main/abortutils.F90 | 82 - src_clm40/main/accFldsMod.F90 | 1044 - src_clm40/main/accumulMod.F90 | 656 - src_clm40/main/clm_atmlnd.F90 | 551 - src_clm40/main/clm_cpl_indices.F90 | 311 - src_clm40/main/clm_driver.F90 | 903 - src_clm40/main/clm_glclnd.F90 | 242 - src_clm40/main/clm_initializeMod.F90 | 684 - src_clm40/main/clm_nlUtilsMod.F90 | 116 - src_clm40/main/clm_time_manager.F90 | 1625 - src_clm40/main/clm_varcon.F90 | 167 - src_clm40/main/clm_varctl.F90 | 318 - src_clm40/main/clm_varorb.F90 | 17 - src_clm40/main/clm_varpar.F90 | 118 - src_clm40/main/clm_varsur.F90 | 37 - src_clm40/main/clmtype.F90 | 1991 - src_clm40/main/clmtypeInitMod.F90 | 4116 -- src_clm40/main/controlMod.F90 | 556 - src_clm40/main/decompInitMod.F90 | 762 - src_clm40/main/decompMod.F90 | 359 - src_clm40/main/domainMod.F90 | 241 - src_clm40/main/dtypes.h | 6 - src_clm40/main/dynlandMod.F90 | 255 - src_clm40/main/fileutils.F90 | 179 - src_clm40/main/filterMod.F90 | 390 - src_clm40/main/findHistFields.pl | 265 - src_clm40/main/getdatetime.F90 | 53 - src_clm40/main/histFileMod.F90 | 4497 -- src_clm40/main/histFldsMod.F90 | 4599 -- src_clm40/main/iniTimeConst.F90 | 828 - src_clm40/main/initGridCellsMod.F90 | 1187 - src_clm40/main/initSurfAlbMod.F90 | 344 - src_clm40/main/lnd_comp_mct.F90 | 649 - src_clm40/main/lnd_import_export.F90 | 334 - src_clm40/main/mkarbinitMod.F90 | 762 - src_clm40/main/ncdio_pio.F90.in | 2285 - src_clm40/main/ndepStreamMod.F90 | 284 - src_clm40/main/organicFileMod.F90 | 113 - src_clm40/main/pft2colMod.F90 | 143 - src_clm40/main/pftdynMod.F90 | 3224 -- src_clm40/main/pftvarcon.F90 | 489 - src_clm40/main/quadraticMod.F90 | 57 - src_clm40/main/restFileMod.F90 | 729 - src_clm40/main/restUtilMod.F90 | 1319 - src_clm40/main/restUtilMod.F90.in | 426 - src_clm40/main/spmdGathScatMod.F90 | 537 - src_clm40/main/spmdMod.F90 | 142 - src_clm40/main/subgridAveMod.F90 | 1695 - src_clm40/main/subgridMod.F90 | 282 - src_clm40/main/subgridRestMod.F90 | 286 - src_clm40/main/surfrdMod.F90 | 1121 - {manage_externals/test => test}/.coveragerc | 0 {manage_externals/test => test}/.gitignore | 0 {manage_externals/test => test}/.pylint.rc | 0 {manage_externals/test => test}/Makefile | 0 {manage_externals/test => test}/README.md | 0 .../test => test}/doc/.gitignore | 0 {manage_externals/test => test}/doc/Makefile | 0 {manage_externals/test => test}/doc/conf.py | 0 .../test => test}/doc/develop.rst | 0 {manage_externals/test => test}/doc/index.rst | 0 .../test => test}/doc/testing.rst | 0 .../test => test}/repos/container.git/HEAD | 0 .../test => test}/repos/container.git/config | 0 .../repos/container.git/description | 0 .../repos/container.git/info/exclude | 0 .../41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 | Bin .../71/5b8f3e4afe1802a178e1d603af404ba45d59de | Bin .../b0/f87705e2b9601cb831878f3d51efa78b910d7b | Bin .../f9/e08370a737e941de6f6492e3f427c2ef4c1a03 | Bin .../repos/container.git/refs/heads/master | 0 .../test => test}/repos/error/readme.txt | 0 .../repos/mixed-cont-ext.git/HEAD | 0 .../repos/mixed-cont-ext.git/config | 0 .../repos/mixed-cont-ext.git/description | 0 .../repos/mixed-cont-ext.git/info/exclude | 0 .../00/437ac2000d5f06fb8a572a01a5bbdae98b17cb | Bin .../01/97458f2dbe5fcd6bc44fa46983be0a30282379 | Bin .../06/ea30b03ffa2f8574705f8b9583f7ca7e2dccf7 | Bin .../14/368b701616a8c53820b610414a4b9a07540cf6 | 0 .../15/2b57e1cf23721cd17ff681cb9276e3fb9fc091 | 0 .../1f/01fa46c17b1f38b37e6259f6e9d041bda3144f | Bin .../37/f0e70b609adc90f4c09ee21d82ed1d79c81d69 | Bin .../38/9a2b876b8965d3c91a3db8d28a483eaf019d5c | Bin .../41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 | Bin .../6e/9f4baa6e94a0af4e094836c2eb55ccedef5fc4 | Bin .../6f/c379457ecb4e576a13c7610ae1fa73f845ee6a | 0 .../93/a159deb9175bfeb2820a0006ddd92d78131332 | Bin .../95/80ecc12f16334ce44e42287d5d46f927bb7b75 | 0 .../a9/288dcd8a719a1f4ed3cba43a2a387ae7cd60fd | Bin .../e8/ea32a11d30ee703f6f661ae7c2376f4ab84d38 | Bin .../fd/15a5ad5204356229c60a831d2a8120a43ac901 | 0 .../mixed-cont-ext.git/refs/heads/master | 0 .../mixed-cont-ext.git/refs/heads/new-feature | 0 .../repos/simple-ext-fork.git/HEAD | 0 .../repos/simple-ext-fork.git/config | 0 .../repos/simple-ext-fork.git/description | 0 .../repos/simple-ext-fork.git/info/exclude | 0 .../00/fd13e76189f9134b0506b4b8ed3172723b467f | Bin .../0b/15e8af3d4615b42314216efeae3fff184046a8 | Bin .../0b/67df4e7e8e6e1c6e401542738b352d18744677 | Bin .../11/a76e3d9a67313dec7ce1230852ab5c86352c5c | 0 .../16/5506a7408a482f50493434e13fffeb44af893f | Bin .../24/4386e788c9bc608613e127a329c742450a60e4 | Bin .../32/7e97d86e941047d809dba58f2804740c6c30cf | Bin .../36/418b4e5665956a90725c9a1b5a8e551c5f3d48 | Bin .../3d/7099c35404ae6c8640ce263b38bef06e98cc26 | 0 .../3d/ec1fdf8e2f5edba28148c5db2fe8d7a842360b | 0 .../41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 | Bin .../4d/837135915ed93eed6fff6b439f284ce317296f | Bin .../56/175e017ad38bf3d33d74b6bd7c74624b28466a | Bin .../5f/1d4786d12e52d7ab28d2f2f1118c1059a9f1ae | Bin .../67/136e5ab4d5c1c65d10c8048763b96b0e53c1d6 | Bin .../7b/0bd630ac13865735a1dff3437a137d8ab50663 | Bin .../88/cf20868e0cc445f5642a480ed034c71e0d7e9f | 0 .../8d/2b3b35126224c975d23f109aa1e3cbac452989 | 0 .../9b/75494003deca69527bb64bcaa352e801611dd2 | Bin .../a2/2a5da9119328ea6d693f88861457c07e14ac04 | 0 .../a4/2fe9144f5707bc1e9515ce1b44681f7aba6f95 | 0 .../b9/3737be3ea6b19f6255983748a0a0f4d622f936 | Bin .../c5/32bc8fde96fa63103a52057f0baffcc9f00c6b | 0 .../c5/b315915742133dbdfbeed0753e481b55c1d364 | 0 .../f2/68d4e56d067da9bd1d85e55bdc40a8bd2b0bca | 0 .../repos/simple-ext-fork.git/packed-refs | 0 .../simple-ext-fork.git/refs/heads/feature2 | 0 .../refs/tags/abandoned-feature | 0 .../refs/tags/forked-feature-v1 | 0 .../test => test}/repos/simple-ext.git/HEAD | 0 .../test => test}/repos/simple-ext.git/config | 0 .../repos/simple-ext.git/description | 0 .../repos/simple-ext.git/info/exclude | 0 .../00/fd13e76189f9134b0506b4b8ed3172723b467f | Bin .../09/0e1034746b2c865f7b0280813dbf4061a700e8 | Bin .../0b/15e8af3d4615b42314216efeae3fff184046a8 | Bin .../11/a76e3d9a67313dec7ce1230852ab5c86352c5c | 0 .../14/2711fdbbcb8034d7cad6bae6801887b12fe61d | Bin 0 -> 83 bytes .../31/dbcd6de441e671a467ef317146539b7ffabb11 | Bin .../36/418b4e5665956a90725c9a1b5a8e551c5f3d48 | Bin .../41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 | Bin .../60/7ec299c17dd285c029edc41a0109e49d441380 | Bin 0 -> 168 bytes .../60/b1cc1a38d63a4bcaa1e767262bbe23dbf9f5f5 | 0 .../63/a99393d1baff97ccef967af30380659867b139 | 0 .../95/3256da5612fcd9263590a353bc18c6f224e74f | 0 .../9b/75494003deca69527bb64bcaa352e801611dd2 | Bin .../a2/2a5da9119328ea6d693f88861457c07e14ac04 | 0 .../b7/692b6d391899680da7b9b6fd8af4c413f06fe7 | Bin 0 -> 137 bytes .../c5/b315915742133dbdfbeed0753e481b55c1d364 | 0 .../d1/163870d19c3dee34fada3a76b785cfa2a8424b | Bin 0 -> 130 bytes .../d8/ed2f33179d751937f8fde2e33921e4827babf4 | Bin 0 -> 60 bytes .../df/312890f93ba4d2c694208599b665c4a08afeff | Bin .../repos/simple-ext.git/refs/heads/feature2 | 0 .../repos/simple-ext.git/refs/heads/feature3 | 0 test/repos/simple-ext.git/refs/heads/master | 1 + .../repos/simple-ext.git/refs/tags/tag1 | 0 test/repos/simple-ext.git/refs/tags/tag2 | 1 + .../test => test}/requirements.txt | 0 .../test => test}/test_sys_checkout.py | 393 +- .../test => test}/test_sys_repository_git.py | 0 .../test_unit_externals_description.py | 12 +- .../test_unit_externals_status.py | 0 .../test => test}/test_unit_repository.py | 25 +- .../test => test}/test_unit_repository_git.py | 3 +- .../test => test}/test_unit_repository_svn.py | 0 .../test => test}/test_unit_utils.py | 0 test/tools/CLM_compare.sh | 39 - test/tools/Makefile | 12 - test/tools/README | 55 - test/tools/README.testnames | 55 - test/tools/TBLCFGtools.sh | 120 - test/tools/TBLscript_tools.sh | 148 - test/tools/TBLtools.sh | 119 - test/tools/TCBCFGtools.sh | 135 - test/tools/TCBscripttools.sh | 80 - test/tools/TCBtools.sh | 130 - test/tools/TOPtools.sh | 120 - test/tools/TSMCFGtools.sh | 113 - test/tools/TSMncl_tools.sh | 74 - test/tools/TSMscript_tools.sh | 114 - test/tools/TSMtools.sh | 117 - test/tools/config_files/CFGtools__ds | 0 test/tools/config_files/PTCLM__s | 1 - test/tools/config_files/README | 9 - test/tools/config_files/gen_domain | 0 test/tools/config_files/tools__do | 1 - test/tools/config_files/tools__ds | 1 - test/tools/config_files/tools__o | 1 - test/tools/config_files/tools__s | 1 - test/tools/gen_test_table.sh | 80 - test/tools/get_cprnc_diffs.sh | 56 - test/tools/input_tests_master | 54 - test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 | 1 - test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 | 1 - test/tools/nl_files/PTCLM_USUMB_clm4_5 | 1 - test/tools/nl_files/gen_domain.T31.runoptions | 1 - .../tools/nl_files/gen_domain.ne30.runoptions | 1 - test/tools/nl_files/getregional | 1 - test/tools/nl_files/getregional_05popd | 1 - test/tools/nl_files/getregional_T62 | 1 - test/tools/nl_files/getregional_ndep | 1 - test/tools/nl_files/mkmapdata_if10 | 1 - test/tools/nl_files/mkmapdata_ne30np4 | 1 - .../nl_files/mkprocdata_ne30_to_f19_I2000 | 1 - test/tools/nl_files/mksrfdt_10x15_1850 | 1 - .../nl_files/mksrfdt_10x15_crp_1850-2000 | 1 - test/tools/nl_files/mksrfdt_1x1_brazil_1850 | 1 - .../nl_files/mksrfdt_1x1_brazil_1850-2000 | 1 - .../nl_files/mksrfdt_1x1_numaIA_mp24_2000 | 1 - .../nl_files/mksrfdt_1x1_vancouverCAN_2000 | 1 - test/tools/nl_files/mksrfdt_T31_crpglc_2000 | 1 - test/tools/show_var_diffs.sh | 79 - test/tools/test_driver.sh | 572 - test/tools/tests_posttag_dav_mpi | 2 - test/tools/tests_posttag_hobart_nompi | 6 - test/tools/tests_posttag_nompi_regression | 20 - test/tools/tests_pretag_cheyenne_nompi | 15 - tools/README | 280 - tools/README.filecopies | 38 - tools/README.testing | 58 - tools/mkmapdata/README | 87 - tools/mkmapdata/createXMLEntries.pl | 116 - tools/mkmapdata/mkmapdata.sh | 539 - tools/mkmapdata/mknoocnmap.pl | 297 - tools/mkmapdata/mkunitymap.ncl | 160 - tools/mkmapdata/mvNimport.sh | 75 - tools/mkmapdata/regridbatch.sh | 80 - tools/mkmapdata/regridgeyser.sh | 87 - tools/mkmapdata/rmdups.ncl | 131 - tools/mkmapgrids/README | 22 - tools/mkmapgrids/mkscripgrid.ncl | 167 - tools/mkprocdata_map/README | 152 - tools/mkprocdata_map/README.filedescriptions | 25 - tools/mkprocdata_map/mkprocdata_map_all | 202 - .../mkprocdata_map_functions.bash | 57 - tools/mkprocdata_map/mkprocdata_map_wrap | 250 - tools/mkprocdata_map/src/Filepath | 1 - tools/mkprocdata_map/src/Makefile | 10 - tools/mkprocdata_map/src/Makefile.common | 360 - tools/mkprocdata_map/src/Mkdepends | 327 - tools/mkprocdata_map/src/Srcfiles | 8 - tools/mkprocdata_map/src/constMod.F90 | 11 - tools/mkprocdata_map/src/fileutils.F90 | 282 - tools/mkprocdata_map/src/fmain.F90 | 78 - tools/mkprocdata_map/src/gridmapMod.F90 | 289 - tools/mkprocdata_map/src/mkprocdata_map.F90 | 525 - tools/mkprocdata_map/src/nanMod.F90 | 41 - tools/mkprocdata_map/src/shr_file_mod.F90 | 164 - tools/mkprocdata_map/src/shr_kind_mod.F90 | 19 - tools/mksurfdata_map/Makefile.data | 267 - tools/mksurfdata_map/README | 70 - tools/mksurfdata_map/README.developers | 178 - ..._timeseries_hist_78pfts_simyr1850-2015.txt | 332 - tools/mksurfdata_map/mksurfdata.pl | 818 - tools/mksurfdata_map/mksurfdata_map.namelist | 54 - .../single_point_dynpft_files/README | 4 - ...imeseries_smallvilleIA_hist_simyr1850-1855 | 23 - ...eries_smallvilleIA_hist_simyr1850-1855.txt | 6 - tools/mksurfdata_map/src/CMakeLists.txt | 31 - tools/mksurfdata_map/src/Filepath | 1 - tools/mksurfdata_map/src/Makefile | 10 - tools/mksurfdata_map/src/Makefile.common | 360 - tools/mksurfdata_map/src/Mkdepends | 327 - tools/mksurfdata_map/src/README.unit_testing | 9 - tools/mksurfdata_map/src/Srcfiles | 40 - tools/mksurfdata_map/src/fileutils.F90 | 254 - .../mksurfdata_map/src/mkCH4inversionMod.F90 | 172 - tools/mksurfdata_map/src/mkVICparamsMod.F90 | 187 - .../mksurfdata_map/src/mkagfirepkmonthMod.F90 | 263 - tools/mksurfdata_map/src/mkchecksMod.F90 | 233 - tools/mksurfdata_map/src/mkdiagnosticsMod.F90 | 410 - tools/mksurfdata_map/src/mkdomainMod.F90 | 922 - tools/mksurfdata_map/src/mkfileMod.F90 | 555 - tools/mksurfdata_map/src/mkgdpMod.F90 | 134 - .../mksurfdata_map/src/mkglacierregionMod.F90 | 124 - tools/mksurfdata_map/src/mkglcmecMod.F90 | 778 - tools/mksurfdata_map/src/mkgridmapMod.F90 | 935 - tools/mksurfdata_map/src/mkharvestMod.F90 | 1098 - tools/mksurfdata_map/src/mkindexmapMod.F90 | 762 - tools/mksurfdata_map/src/mklaiMod.F90 | 444 - tools/mksurfdata_map/src/mklanwatMod.F90 | 509 - tools/mksurfdata_map/src/mkncdio.F90 | 558 - tools/mksurfdata_map/src/mkpctPftTypeMod.F90 | 626 - tools/mksurfdata_map/src/mkpeatMod.F90 | 136 - .../mksurfdata_map/src/mkpftConstantsMod.F90 | 43 - tools/mksurfdata_map/src/mkpftMod.F90 | 1086 - tools/mksurfdata_map/src/mkpftUtilsMod.F90 | 257 - tools/mksurfdata_map/src/mksoilMod.F90 | 1409 - tools/mksurfdata_map/src/mksoildepthMod.F90 | 159 - tools/mksurfdata_map/src/mksurfdat.F90 | 1586 - tools/mksurfdata_map/src/mktopostatsMod.F90 | 155 - .../src/mkurbanparCommonMod.F90 | 354 - tools/mksurfdata_map/src/mkurbanparMod.F90 | 749 - tools/mksurfdata_map/src/mkutilsMod.F90 | 197 - tools/mksurfdata_map/src/mkvarctl.F90 | 89 - tools/mksurfdata_map/src/mkvarpar.F90 | 33 - tools/mksurfdata_map/src/mkvocefMod.F90 | 218 - tools/mksurfdata_map/src/nanMod.F90 | 41 - tools/mksurfdata_map/src/shr_const_mod.F90 | 58 - tools/mksurfdata_map/src/shr_file_mod.F90 | 1023 - tools/mksurfdata_map/src/shr_kind_mod.F90 | 19 - tools/mksurfdata_map/src/shr_log_mod.F90 | 13 - tools/mksurfdata_map/src/shr_string_mod.F90 | 1753 - tools/mksurfdata_map/src/shr_sys_mod.F90 | 352 - tools/mksurfdata_map/src/shr_timer_mod.F90 | 425 - tools/mksurfdata_map/src/test/CMakeLists.txt | 4 - .../src/test/mkgridmap_test/CMakeLists.txt | 4 - .../src/test/mkgridmap_test/test_mkgridmap.pf | 114 - .../src/test/mkindexmap_test/CMakeLists.txt | 4 - .../test/mkindexmap_test/test_mkindexmap.pf | 251 - .../src/test/mkpctPftType_test/CMakeLists.txt | 4 - .../mkpctPftType_test/test_mkpctPftType.pf | 253 - .../src/test/mkpftUtils_test/CMakeLists.txt | 8 - .../test_adjust_total_veg_area.pf | 59 - .../mkpftUtils_test/test_convert_from_p2g.pf | 151 - .../src/unit_test_stubs/mkncdio.F90 | 167 - tools/mksurfdata_map/unit_testers/Filepath | 2 - tools/mksurfdata_map/unit_testers/Makefile | 10 - tools/mksurfdata_map/unit_testers/README | 6 - tools/mksurfdata_map/unit_testers/Srcfiles | 32 - .../unit_testers/test_mkchecksMod.F90 | 101 - .../unit_testers/test_mkdomainMod.F90 | 95 - .../unit_testers/test_mkgridmapMod.F90 | 664 - .../unit_testers/test_mkharvest.F90 | 316 - .../unit_testers/test_mkindexmapMod.F90 | 676 - .../unit_testers/test_mkncdio.F90 | 82 - .../unit_testers/test_mksurfdata_map.F90 | 54 - .../unit_testers/test_mkurbanparMod.F90 | 75 - .../unit_testers/test_mkutilsMod.F90 | 112 - .../mksurfdata_map/unit_testers/test_mod.F90 | 339 - tools/ncl_scripts/README | 23 - tools/ncl_scripts/README.getregional | 35 - tools/ncl_scripts/getco2_historical.ncl | 139 - tools/ncl_scripts/getregional_datasets.ncl | 268 - tools/ncl_scripts/getregional_datasets.pl | 375 - tools/ncl_scripts/sample_inlist | 18 - tools/ncl_scripts/sample_inlist_0.5popd | 22 - tools/ncl_scripts/sample_inlist_T62 | 23 - tools/ncl_scripts/sample_inlist_ndep | 22 - tools/ncl_scripts/sample_outlist | 14 - tools/ncl_scripts/sample_outlist_0.5popd | 14 - tools/ncl_scripts/sample_outlist_T62 | 16 - tools/ncl_scripts/sample_outlist_ndep | 15 - 1110 files changed, 1009 insertions(+), 413203 deletions(-) delete mode 100644 .CTSMTrunkChecklist delete mode 100644 .config_files.xml rename manage_externals/.dir_locals.el => .dir_locals.el (100%) rename {manage_externals/.github => .github}/ISSUE_TEMPLATE.md (100%) delete mode 100644 .github/ISSUE_TEMPLATE/01_bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/02_support_needed.md delete mode 100644 .github/ISSUE_TEMPLATE/03_science_discussion.md delete mode 100644 .github/ISSUE_TEMPLATE/04_other.md create mode 100644 .travis.yml delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Copyright delete mode 100644 Externals.cfg delete mode 100644 Externals_CLM.cfg delete mode 100644 LICENSE rename manage_externals/LICENSE.txt => LICENSE.txt (100%) delete mode 100644 README rename manage_externals/README.md => README.md (91%) delete mode 100644 README.rst delete mode 100644 README_EXTERNALS.rst rename manage_externals/README_FIRST => README_FIRST (100%) delete mode 100755 bld/CLMBuildNamelist.pm delete mode 100644 bld/README delete mode 100755 bld/build-namelist delete mode 100755 bld/config_files/clm_phys_vers.pm delete mode 100644 bld/config_files/config_defaults.xml delete mode 100644 bld/config_files/config_defaults_1x1_mexicocityMEX.xml delete mode 100644 bld/config_files/config_defaults_1x1_numaIA.xml delete mode 100644 bld/config_files/config_defaults_1x1_smallvilleIA.xml delete mode 100644 bld/config_files/config_defaults_1x1_vancouverCAN.xml delete mode 100644 bld/config_files/config_definition.xsl delete mode 100644 bld/config_files/config_definition_clm4_0.xml delete mode 100644 bld/config_files/config_definition_clm4_5.xml delete mode 100755 bld/configure delete mode 100644 bld/env_run.xml delete mode 100755 bld/listDefaultNamelist.pl delete mode 100755 bld/namelist_files/LogMessages.pm delete mode 100644 bld/namelist_files/checkmapfiles.ncl delete mode 100755 bld/namelist_files/createMapEntry.pl delete mode 100644 bld/namelist_files/history_fields.xsl delete mode 100644 bld/namelist_files/namelist_defaults.xsl delete mode 100644 bld/namelist_files/namelist_defaults_clm4_0.xml delete mode 100644 bld/namelist_files/namelist_defaults_clm4_0_tools.xml delete mode 100644 bld/namelist_files/namelist_defaults_clm4_5.xml delete mode 100644 bld/namelist_files/namelist_defaults_clm4_5_tools.xml delete mode 100644 bld/namelist_files/namelist_defaults_drv.xml delete mode 100644 bld/namelist_files/namelist_defaults_drydep.xml delete mode 100644 bld/namelist_files/namelist_defaults_fire_emis.xml delete mode 100644 bld/namelist_files/namelist_defaults_overall.xml delete mode 100644 bld/namelist_files/namelist_defaults_usr_files.xml delete mode 100644 bld/namelist_files/namelist_definition.xsl delete mode 100644 bld/namelist_files/namelist_definition_clm4_0.xml delete mode 100644 bld/namelist_files/namelist_definition_clm4_5.xml delete mode 100644 bld/namelist_files/namelist_definition_drv.xml delete mode 100644 bld/namelist_files/namelist_definition_drv_flds.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml delete mode 100644 bld/namelist_files/use_cases/1850_control.xml delete mode 100644 bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml delete mode 100644 bld/namelist_files/use_cases/2000_control.xml delete mode 100644 bld/namelist_files/use_cases/20thC_transient.xml delete mode 100644 bld/namelist_files/use_cases/README delete mode 100644 bld/namelist_files/use_cases/stdurbpt_pd.xml delete mode 100755 bld/queryDefaultNamelist.pl delete mode 100644 bld/queryDefaultXML.pm delete mode 100644 bld/unit_testers/NMLTest/CompFiles.pm delete mode 100755 bld/unit_testers/build-namelist_test.pl delete mode 100644 bld/unit_testers/myuser_nl_clm delete mode 100644 bld/unit_testers/xFail/expectedClmTestFails.xml delete mode 100755 bld/unit_testers/xFail/expectedFail.pm delete mode 100755 bld/unit_testers/xFail/wrapClmTests.pl rename manage_externals/checkout_externals => checkout_externals (100%) delete mode 100644 cime_config/SystemTests/lii.py delete mode 100644 cime_config/SystemTests/lii2finidatareas.py delete mode 100644 cime_config/SystemTests/lvg.py delete mode 100644 cime_config/SystemTests/ssp.py delete mode 100644 cime_config/buildcpp delete mode 100755 cime_config/buildlib delete mode 100755 cime_config/buildnml delete mode 100644 cime_config/config_component.xml delete mode 100644 cime_config/config_compsets.xml delete mode 100644 cime_config/config_pes.xml delete mode 100644 cime_config/config_tests.xml delete mode 100644 cime_config/testdefs/ExpectedTestFails.xml delete mode 100644 cime_config/testdefs/testlist_clm.xml delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40crop/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40crop/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40default/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40default/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40pts/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40pts/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40pts/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40ptsRLA/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40ptsRLA/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40ptsRLB/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40ptsRLB/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40ptsROA/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40ptsROA/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40reduceOutput/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/40reduceOutput/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/DA_multidrv/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/DA_multidrv/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0001 delete mode 100644 cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0002 delete mode 100644 cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesAllVars/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesColdDef/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesColdDef/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesLogging/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesPPhys/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesST3/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesShortList/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/SNICARFRC/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/SNICARFRC/user_nl_clm delete mode 100755 cime_config/testdefs/testmods_dirs/clm/USUMB/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/af_bias_v7/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_datm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/allActive/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/allActive/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/allActive/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_decStart/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_monthly/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_monthly/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ciso_rtmColdSSP/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50dynroots/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/clm50dynroots/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cmip6/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cmip6/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cmip6/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cn_conly/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cn_conly/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cplhist/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/cplhist/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/decStart/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/decStart/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism delete mode 100644 cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/default/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/drydepnomegan/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/drydepnomegan/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/fatesFire/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/fatesFire/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/fire_emis/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_cism delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_cism delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_long/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_long/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_long/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_cism delete mode 100644 cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrig_spunup/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrig_spunup/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/luna/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/luna/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/monthly/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_cpl delete mode 100644 cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/include_user_mods delete mode 100755 cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/no_vector_output/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/no_vector_output/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/no_vector_output/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/nofire/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/nofire/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/o3/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/o3/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/oldhyd/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/oldhyd/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/pauseResume/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/pauseResume/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/pts/README delete mode 100644 cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/pts/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ptsRLA/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ptsRLA/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ptsRLB/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ptsRLB/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ptsROA/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/ptsROA/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/user_nl_datm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands delete mode 100644 cime_config/testdefs/testmods_dirs/clm/reduceOutput/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/rootlit/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/rootlit/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/user_nl_rtm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm delete mode 100644 cime_config/testdefs/testmods_dirs/clm/vrtlay/include_user_mods delete mode 100644 cime_config/testdefs/testmods_dirs/clm/vrtlay/user_nl_clm delete mode 100644 cime_config/user_nl_clm delete mode 100644 cime_config/usermods_dirs/cmip6/include_user_mods delete mode 100644 cime_config/usermods_dirs/cmip6_evolving_icesheet/include_user_mods delete mode 100644 cime_config/usermods_dirs/cmip6_evolving_icesheet/user_nl_clm delete mode 100644 cime_config/usermods_dirs/cmip6_glaciers/user_nl_clm delete mode 100644 cime_config/usermods_dirs/cmip6_output/README delete mode 100644 cime_config/usermods_dirs/cmip6_output/shell_commands delete mode 100644 cime_config/usermods_dirs/cmip6_output/user_nl_clm delete mode 100644 cime_config/usermods_dirs/cmip6_output/user_nl_cpl delete mode 100644 doc/.ChangeLog_template delete mode 100644 doc/.release-ChangeLog_template delete mode 100644 doc/ChangeLog delete mode 100644 doc/ChangeSum delete mode 100644 doc/IMPORTANT_NOTES delete mode 100644 doc/Quickstart.GUIDE delete mode 100755 doc/UpdateChangelog.pl delete mode 100644 doc/UsersGuide/Makefile delete mode 100644 doc/UsersGuide/addco2_datm.buildnml.diff delete mode 100644 doc/UsersGuide/adding_files.xml delete mode 100755 doc/UsersGuide/addxhtmlhead.pl delete mode 100644 doc/UsersGuide/appendix.xml delete mode 100644 doc/UsersGuide/badpergro.jpg delete mode 100644 doc/UsersGuide/clm_stylesheet.dsl delete mode 100644 doc/UsersGuide/clm_ug.xml delete mode 100644 doc/UsersGuide/co2_streams.txt delete mode 100644 doc/UsersGuide/custom.xml delete mode 100755 doc/UsersGuide/get_Icaselist.pl delete mode 100755 doc/UsersGuide/limitLineLen.pl delete mode 100644 doc/UsersGuide/modelnl/Makefile delete mode 100644 doc/UsersGuide/modelnl/index.cpp delete mode 100644 doc/UsersGuide/modelnl/showinfo.js delete mode 100755 doc/UsersGuide/modelnl/xmldef2html_compsets delete mode 100644 doc/UsersGuide/pergro.jpg delete mode 100644 doc/UsersGuide/preface.xml delete mode 100644 doc/UsersGuide/ptclm.xml delete mode 100644 doc/UsersGuide/single_point.xml delete mode 100644 doc/UsersGuide/special_cases.xml delete mode 100644 doc/UsersGuide/stylesheethtml2docbook.xsl delete mode 100644 doc/UsersGuide/tools.xml delete mode 100644 doc/UsersGuide/trouble_shooting.xml delete mode 100644 doc/clm3_0_ChangeLog delete mode 100644 doc/clm4_0_ChangeLog delete mode 100644 doc/clm4_5_ChangeLog delete mode 100644 doc/clm5_0_ChangeLog delete mode 100644 doc/design/oo_design.rst delete mode 100644 doc/release-clm5.0.ChangeLog delete mode 100644 manage_externals/.github/PULL_REQUEST_TEMPLATE.md delete mode 100644 manage_externals/.gitignore delete mode 100644 manage_externals/.travis.yml delete mode 100644 manage_externals/test/repos/simple-ext.git/refs/heads/master rename {manage_externals/manic => manic}/__init__.py (100%) rename {manage_externals/manic => manic}/checkout.py (91%) rename {manage_externals/manic => manic}/externals_description.py (56%) rename {manage_externals/manic => manic}/externals_status.py (100%) rename {manage_externals/manic => manic}/global_constants.py (100%) rename {manage_externals/manic => manic}/repository.py (78%) rename {manage_externals/manic => manic}/repository_factory.py (83%) rename {manage_externals/manic => manic}/repository_git.py (85%) rename {manage_externals/manic => manic}/repository_svn.py (92%) rename {manage_externals/manic => manic}/sourcetree.py (80%) rename {manage_externals/manic => manic}/utils.py (100%) delete mode 100755 parse_cime.cs.status delete mode 100644 src/CMakeLists.txt delete mode 100644 src/README.unit_testing delete mode 100644 src/biogeochem/CMakeLists.txt delete mode 100644 src/biogeochem/CNAnnualUpdateMod.F90 delete mode 100644 src/biogeochem/CNBalanceCheckMod.F90 delete mode 100644 src/biogeochem/CNC14DecayMod.F90 delete mode 100644 src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90 delete mode 100644 src/biogeochem/CNCIsoFluxMod.F90 delete mode 100644 src/biogeochem/CNCStateUpdate1Mod.F90 delete mode 100644 src/biogeochem/CNCStateUpdate2Mod.F90 delete mode 100644 src/biogeochem/CNCStateUpdate3Mod.F90 delete mode 100644 src/biogeochem/CNDVDriverMod.F90 delete mode 100644 src/biogeochem/CNDVEstablishmentMod.F90 delete mode 100644 src/biogeochem/CNDVLightMod.F90 delete mode 100644 src/biogeochem/CNDVType.F90 delete mode 100644 src/biogeochem/CNDriverMod.F90 delete mode 100644 src/biogeochem/CNFUNMod.F90 delete mode 100644 src/biogeochem/CNFireBaseMod.F90 delete mode 100644 src/biogeochem/CNFireEmissionsMod.F90 delete mode 100644 src/biogeochem/CNFireFactoryMod.F90 delete mode 100644 src/biogeochem/CNFireLi2014Mod.F90 delete mode 100644 src/biogeochem/CNFireLi2016Mod.F90 delete mode 100644 src/biogeochem/CNFireMethodMod.F90 delete mode 100644 src/biogeochem/CNFireNoFireMod.F90 delete mode 100644 src/biogeochem/CNGRespMod.F90 delete mode 100644 src/biogeochem/CNGapMortalityMod.F90 delete mode 100644 src/biogeochem/CNMRespMod.F90 delete mode 100644 src/biogeochem/CNNDynamicsMod.F90 delete mode 100644 src/biogeochem/CNNStateUpdate1Mod.F90 delete mode 100644 src/biogeochem/CNNStateUpdate2Mod.F90 delete mode 100644 src/biogeochem/CNNStateUpdate3Mod.F90 delete mode 100644 src/biogeochem/CNPhenologyMod.F90 delete mode 100644 src/biogeochem/CNPrecisionControlMod.F90 delete mode 100644 src/biogeochem/CNProductsMod.F90 delete mode 100644 src/biogeochem/CNRootDynMod.F90 delete mode 100644 src/biogeochem/CNSharedParamsMod.F90 delete mode 100644 src/biogeochem/CNSpeciesMod.F90 delete mode 100644 src/biogeochem/CNVegCarbonFluxType.F90 delete mode 100644 src/biogeochem/CNVegCarbonStateType.F90 delete mode 100644 src/biogeochem/CNVegComputeSeedMod.F90 delete mode 100644 src/biogeochem/CNVegNitrogenFluxType.F90 delete mode 100644 src/biogeochem/CNVegNitrogenStateType.F90 delete mode 100644 src/biogeochem/CNVegStateType.F90 delete mode 100644 src/biogeochem/CNVegStructUpdateMod.F90 delete mode 100644 src/biogeochem/CNVegetationFacade.F90 delete mode 100644 src/biogeochem/CropType.F90 delete mode 100644 src/biogeochem/DUSTMod.F90 delete mode 100644 src/biogeochem/DryDepVelocity.F90 delete mode 100644 src/biogeochem/EDBGCDynMod.F90 delete mode 100644 src/biogeochem/FireEmisFactorsMod.F90 delete mode 100644 src/biogeochem/MEGANFactorsMod.F90 delete mode 100644 src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 delete mode 100644 src/biogeochem/NutrientCompetitionFactoryMod.F90 delete mode 100644 src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 delete mode 100644 src/biogeochem/NutrientCompetitionMethodMod.F90 delete mode 100644 src/biogeochem/SatellitePhenologyMod.F90 delete mode 100644 src/biogeochem/SpeciesBaseType.F90 delete mode 100644 src/biogeochem/SpeciesIsotopeType.F90 delete mode 100644 src/biogeochem/SpeciesNonIsotopeType.F90 delete mode 100644 src/biogeochem/VOCEmissionMod.F90 delete mode 100644 src/biogeochem/ch4FInundatedStreamType.F90 delete mode 100644 src/biogeochem/ch4Mod.F90 delete mode 100644 src/biogeochem/ch4varcon.F90 delete mode 100644 src/biogeochem/dynCNDVMod.F90 delete mode 100644 src/biogeochem/dynConsBiogeochemMod.F90 delete mode 100644 src/biogeochem/dynHarvestMod.F90 delete mode 100644 src/biogeochem/test/CMakeLists.txt delete mode 100644 src/biogeochem/test/CNVegComputeSeed_test/CMakeLists.txt delete mode 100644 src/biogeochem/test/CNVegComputeSeed_test/test_ComputeSeedAmounts.pf delete mode 100644 src/biogeochem/test/Species_test/CMakeLists.txt delete mode 100644 src/biogeochem/test/Species_test/test_SpeciesIsotope.pf delete mode 100644 src/biogeochem/test/Species_test/test_SpeciesNonIsotope.pf delete mode 100644 src/biogeophys/ActiveLayerMod.F90 delete mode 100644 src/biogeophys/AerosolMod.F90 delete mode 100644 src/biogeophys/BalanceCheckMod.F90 delete mode 100644 src/biogeophys/BandDiagonalMod.F90 delete mode 100644 src/biogeophys/BareGroundFluxesMod.F90 delete mode 100644 src/biogeophys/CMakeLists.txt delete mode 100644 src/biogeophys/CanopyFluxesMod.F90 delete mode 100644 src/biogeophys/CanopyHydrologyMod.F90 delete mode 100644 src/biogeophys/CanopyStateType.F90 delete mode 100644 src/biogeophys/CanopyTemperatureMod.F90 delete mode 100644 src/biogeophys/DaylengthMod.F90 delete mode 100644 src/biogeophys/EnergyFluxType.F90 delete mode 100644 src/biogeophys/FrictionVelocityMod.F90 delete mode 100644 src/biogeophys/GlacierSurfaceMassBalanceMod.F90 delete mode 100644 src/biogeophys/HumanIndexMod.F90 delete mode 100644 src/biogeophys/HydrologyDrainageMod.F90 delete mode 100644 src/biogeophys/HydrologyNoDrainageMod.F90 delete mode 100644 src/biogeophys/IrrigationMod.F90 delete mode 100644 src/biogeophys/LakeCon.F90 delete mode 100644 src/biogeophys/LakeFluxesMod.F90 delete mode 100644 src/biogeophys/LakeHydrologyMod.F90 delete mode 100644 src/biogeophys/LakeStateType.F90 delete mode 100644 src/biogeophys/LakeTemperatureMod.F90 delete mode 100644 src/biogeophys/LunaMod.F90 delete mode 100644 src/biogeophys/OzoneBaseMod.F90 delete mode 100644 src/biogeophys/OzoneFactoryMod.F90 delete mode 100644 src/biogeophys/OzoneMod.F90 delete mode 100644 src/biogeophys/OzoneOffMod.F90 delete mode 100644 src/biogeophys/PhotosynthesisMod.F90 delete mode 100644 src/biogeophys/QSatMod.F90 delete mode 100644 src/biogeophys/RootBiophysMod.F90 delete mode 100644 src/biogeophys/SnowHydrologyMod.F90 delete mode 100644 src/biogeophys/SnowSnicarMod.F90 delete mode 100644 src/biogeophys/SoilFluxesMod.F90 delete mode 100644 src/biogeophys/SoilHydrologyInitTimeConstMod.F90 delete mode 100644 src/biogeophys/SoilHydrologyMod.F90 delete mode 100644 src/biogeophys/SoilHydrologyType.F90 delete mode 100644 src/biogeophys/SoilMoistStressMod.F90 delete mode 100644 src/biogeophys/SoilStateInitTimeConstMod.F90 delete mode 100644 src/biogeophys/SoilStateType.F90 delete mode 100644 src/biogeophys/SoilTemperatureMod.F90 delete mode 100644 src/biogeophys/SoilWaterMovementMod.F90 delete mode 100644 src/biogeophys/SoilWaterPlantSinkMod.F90 delete mode 100644 src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 delete mode 100644 src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 delete mode 100644 src/biogeophys/SoilWaterRetentionCurveMod.F90 delete mode 100644 src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 delete mode 100644 src/biogeophys/SolarAbsorbedType.F90 delete mode 100644 src/biogeophys/SurfaceAlbedoMod.F90 delete mode 100644 src/biogeophys/SurfaceAlbedoType.F90 delete mode 100644 src/biogeophys/SurfaceRadiationMod.F90 delete mode 100644 src/biogeophys/SurfaceResistanceMod.F90 delete mode 100644 src/biogeophys/TemperatureType.F90 delete mode 100644 src/biogeophys/TotalWaterAndHeatMod.F90 delete mode 100644 src/biogeophys/TridiagonalMod.F90 delete mode 100644 src/biogeophys/UrbBuildTempOleson2015Mod.F90 delete mode 100644 src/biogeophys/UrbanAlbedoMod.F90 delete mode 100644 src/biogeophys/UrbanFluxesMod.F90 delete mode 100644 src/biogeophys/UrbanParamsType.F90 delete mode 100644 src/biogeophys/UrbanRadiationMod.F90 delete mode 100644 src/biogeophys/UrbanTimeVarType.F90 delete mode 100644 src/biogeophys/WaterStateType.F90 delete mode 100644 src/biogeophys/WaterfluxType.F90 delete mode 100644 src/biogeophys/test/CMakeLists.txt delete mode 100644 src/biogeophys/test/Daylength_test/CMakeLists.txt delete mode 100644 src/biogeophys/test/Daylength_test/test_compute_max_daylength.pf delete mode 100644 src/biogeophys/test/Daylength_test/test_daylength.pf delete mode 100644 src/biogeophys/test/HumanStress_test/CMakeLists.txt delete mode 100644 src/biogeophys/test/HumanStress_test/test_humanstress.pf delete mode 100644 src/biogeophys/test/Irrigation_test/CMakeLists.txt delete mode 100644 src/biogeophys/test/Irrigation_test/README delete mode 100644 src/biogeophys/test/Irrigation_test/test_irrigation.pf delete mode 100644 src/biogeophys/test/SnowHydrology_test/CMakeLists.txt delete mode 100644 src/biogeophys/test/SnowHydrology_test/README delete mode 100644 src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_SnowCappingExcess.pf delete mode 100644 src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_initSnowLayers.pf delete mode 100644 src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf delete mode 100644 src/biogeophys/test/TotalWaterAndHeat_test/CMakeLists.txt delete mode 100644 src/biogeophys/test/TotalWaterAndHeat_test/test_total_water_and_heat.pf delete mode 100644 src/cpl/clm_cpl_indices.F90 delete mode 100644 src/cpl/lnd_comp_mct.F90 delete mode 100644 src/cpl/lnd_import_export.F90 delete mode 100644 src/dyn_subgrid/CMakeLists.txt delete mode 100644 src/dyn_subgrid/dynColumnStateUpdaterMod.F90 delete mode 100644 src/dyn_subgrid/dynColumnTemplateMod.F90 delete mode 100644 src/dyn_subgrid/dynConsBiogeophysMod.F90 delete mode 100644 src/dyn_subgrid/dynEDMod.F90 delete mode 100644 src/dyn_subgrid/dynFileMod.F90 delete mode 100644 src/dyn_subgrid/dynInitColumnsMod.F90 delete mode 100644 src/dyn_subgrid/dynLandunitAreaMod.F90 delete mode 100644 src/dyn_subgrid/dynPatchStateUpdaterMod.F90 delete mode 100644 src/dyn_subgrid/dynPriorWeightsMod.F90 delete mode 100644 src/dyn_subgrid/dynSubgridControlMod.F90 delete mode 100644 src/dyn_subgrid/dynSubgridDriverMod.F90 delete mode 100644 src/dyn_subgrid/dynTimeInfoMod.F90 delete mode 100644 src/dyn_subgrid/dynVarMod.F90.in delete mode 100644 src/dyn_subgrid/dynVarTimeInterpMod.F90.in delete mode 100644 src/dyn_subgrid/dynVarTimeUninterpMod.F90.in delete mode 100644 src/dyn_subgrid/dyncropFileMod.F90 delete mode 100644 src/dyn_subgrid/dynpftFileMod.F90 delete mode 100644 src/dyn_subgrid/test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynColumnStateUpdater_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf delete mode 100644 src/dyn_subgrid/test/dynColumnTemplate_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynColumnTemplate_test/test_column_template.pf delete mode 100644 src/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf delete mode 100644 src/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf delete mode 100644 src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf delete mode 100644 src/dyn_subgrid/test/dynPatchStateUpdater_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf delete mode 100644 src/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf delete mode 100644 src/dyn_subgrid/test/dynVar_test/CMakeLists.txt delete mode 100644 src/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 delete mode 100644 src/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf delete mode 100644 src/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf delete mode 100644 src/init_interp/CMakeLists.txt delete mode 100644 src/init_interp/initInterp.F90 delete mode 100644 src/init_interp/initInterp1dData.F90 delete mode 100644 src/init_interp/initInterp2dvar.F90.in delete mode 100644 src/init_interp/initInterpBounds.F90 delete mode 100644 src/init_interp/initInterpMindist.F90 delete mode 100644 src/init_interp/initInterpMultilevelBase.F90 delete mode 100644 src/init_interp/initInterpMultilevelContainer.F90 delete mode 100644 src/init_interp/initInterpMultilevelCopy.F90 delete mode 100644 src/init_interp/initInterpMultilevelInterp.F90 delete mode 100644 src/init_interp/initInterpMultilevelSnow.F90 delete mode 100644 src/init_interp/initInterpMultilevelSplit.F90 delete mode 100644 src/init_interp/initInterpUtils.F90 delete mode 100644 src/init_interp/test/CMakeLists.txt delete mode 100644 src/init_interp/test/initInterpMindist_test/CMakeLists.txt delete mode 100644 src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf delete mode 100644 src/init_interp/test/initInterpMindist_test/test_set_mindist.pf delete mode 100644 src/init_interp/test/initInterpMindist_test/test_set_single_match.pf delete mode 100644 src/init_interp/test/initInterpMultilevel_test/CMakeLists.txt delete mode 100644 src/init_interp/test/initInterpMultilevel_test/initInterpMultilevelMock.pf delete mode 100644 src/init_interp/test/initInterpMultilevel_test/multilevel_interp_factory.F90 delete mode 100644 src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf delete mode 100644 src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_snow.pf delete mode 100644 src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_split.pf delete mode 100644 src/init_interp/test/initInterpUtils_test/CMakeLists.txt delete mode 100644 src/init_interp/test/initInterpUtils_test/test_glc_elevclasses_are_same.pf delete mode 100644 src/main/CMakeLists.txt delete mode 100644 src/main/ColumnType.F90 delete mode 100644 src/main/FuncPedotransferMod.F90 delete mode 100644 src/main/GetGlobalValuesMod.F90 delete mode 100644 src/main/GridcellType.F90 delete mode 100644 src/main/LandunitType.F90 delete mode 100644 src/main/PatchType.F90 delete mode 100644 src/main/TopoMod.F90 delete mode 100644 src/main/abortutils.F90 delete mode 100644 src/main/accumulMod.F90 delete mode 100644 src/main/atm2lndMod.F90 delete mode 100644 src/main/atm2lndType.F90 delete mode 100644 src/main/clm_driver.F90 delete mode 100644 src/main/clm_initializeMod.F90 delete mode 100644 src/main/clm_instMod.F90 delete mode 100644 src/main/clm_varcon.F90 delete mode 100644 src/main/clm_varctl.F90 delete mode 100644 src/main/clm_varpar.F90 delete mode 100644 src/main/clm_varsur.F90 delete mode 100644 src/main/column_varcon.F90 delete mode 100644 src/main/controlMod.F90 delete mode 100644 src/main/decompInitMod.F90 delete mode 100644 src/main/decompMod.F90 delete mode 100644 src/main/dtypes.h delete mode 100644 src/main/filterColMod.F90 delete mode 100644 src/main/filterMod.F90 delete mode 100755 src/main/findHistFields.pl delete mode 100644 src/main/glc2lndMod.F90 delete mode 100644 src/main/glcBehaviorMod.F90 delete mode 100644 src/main/histFileMod.F90 delete mode 100644 src/main/initGridCellsMod.F90 delete mode 100644 src/main/initSubgridMod.F90 delete mode 100644 src/main/initVerticalMod.F90 delete mode 100644 src/main/init_hydrology.F90 delete mode 100644 src/main/landunit_varcon.F90 delete mode 100644 src/main/lnd2atmMod.F90 delete mode 100644 src/main/lnd2atmType.F90 delete mode 100644 src/main/lnd2glcMod.F90 delete mode 100644 src/main/ncdio_pio.F90.in delete mode 100644 src/main/ncdio_utils.F90 delete mode 100644 src/main/ndepStreamMod.F90 delete mode 100644 src/main/organicFileMod.F90 delete mode 100644 src/main/paramUtilMod.F90 delete mode 100644 src/main/pftconMod.F90 delete mode 100644 src/main/readParamsMod.F90 delete mode 100644 src/main/restFileMod.F90 delete mode 100644 src/main/reweightMod.F90 delete mode 100644 src/main/subgridAveMod.F90 delete mode 100644 src/main/subgridMod.F90 delete mode 100644 src/main/subgridRestMod.F90 delete mode 100644 src/main/subgridWeightsMod.F90 delete mode 100644 src/main/surfrdMod.F90 delete mode 100644 src/main/surfrdUtilsMod.F90 delete mode 100644 src/main/test/CMakeLists.txt delete mode 100644 src/main/test/accumul_test/CMakeLists.txt delete mode 100644 src/main/test/accumul_test/test_accumul.pf delete mode 100644 src/main/test/atm2lnd_test/CMakeLists.txt delete mode 100644 src/main/test/atm2lnd_test/test_downscale_forcings.pf delete mode 100644 src/main/test/atm2lnd_test/test_partition_precip.pf delete mode 100644 src/main/test/atm2lnd_test/test_sens_heat_from_precip_conversion.pf delete mode 100644 src/main/test/clm_glclnd_test/CMakeLists.txt delete mode 100644 src/main/test/clm_glclnd_test/test_clm_glclnd.pf delete mode 100644 src/main/test/filter_test/CMakeLists.txt delete mode 100644 src/main/test/filter_test/test_filter_col.pf delete mode 100644 src/main/test/glcBehavior_test/CMakeLists.txt delete mode 100644 src/main/test/glcBehavior_test/test_glcBehavior.pf delete mode 100644 src/main/test/ncdio_utils_test/CMakeLists.txt delete mode 100644 src/main/test/ncdio_utils_test/test_ncdio_utils.pf delete mode 100644 src/main/test/subgridWeights_test/CMakeLists.txt delete mode 100644 src/main/test/subgridWeights_test/test_subgridWeights.pf delete mode 100644 src/main/test/surfrdUtils_test/CMakeLists.txt delete mode 100644 src/main/test/surfrdUtils_test/test_surfrdUtils.pf delete mode 100644 src/main/test/topo_test/CMakeLists.txt delete mode 100644 src/main/test/topo_test/test_topo.pf delete mode 100644 src/soilbiogeochem/CMakeLists.txt delete mode 100644 src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemDecompMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemNitrogenUptakeMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemStateType.F90 delete mode 100644 src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 delete mode 100644 src/soilbiogeochem/test/ACSpinup_test/CMakeLists.txt delete mode 100644 src/soilbiogeochem/test/ACSpinup_test/test_acspinup.pf delete mode 100644 src/soilbiogeochem/test/CMakeLists.txt delete mode 100644 src/unit_test_shr/CMakeLists.txt delete mode 100644 src/unit_test_shr/test/CMakeLists.txt delete mode 100644 src/unit_test_shr/test/unittestArray_test/CMakeLists.txt delete mode 100644 src/unit_test_shr/test/unittestArray_test/test_unittestArray.pf delete mode 100644 src/unit_test_shr/test/unittestFilterBuilder_test/CMakeLists.txt delete mode 100644 src/unit_test_shr/test/unittestFilterBuilder_test/test_filterBuilder.pf delete mode 100644 src/unit_test_shr/test/unittestSubgrid_test/CMakeLists.txt delete mode 100644 src/unit_test_shr/test/unittestSubgrid_test/test_unittestSubgrid.pf delete mode 100644 src/unit_test_shr/unittestArrayMod.F90.in delete mode 100644 src/unit_test_shr/unittestFilterBuilderMod.F90 delete mode 100644 src/unit_test_shr/unittestGlcMec.F90 delete mode 100644 src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 delete mode 100644 src/unit_test_shr/unittestSubgridMod.F90 delete mode 100644 src/unit_test_shr/unittestTimeManagerMod.F90 delete mode 100644 src/unit_test_shr/unittestUtils.F90 delete mode 100644 src/unit_test_stubs/CMakeLists.txt delete mode 100644 src/unit_test_stubs/csm_share/CMakeLists.txt delete mode 100644 src/unit_test_stubs/csm_share/mct_mod_stub.F90 delete mode 100644 src/unit_test_stubs/csm_share/seq_comm_mct.F90 delete mode 100644 src/unit_test_stubs/csm_share/shr_mpi_mod_stub.F90 delete mode 100644 src/unit_test_stubs/dyn_subgrid/CMakeLists.txt delete mode 100644 src/unit_test_stubs/dyn_subgrid/dynFileMod_stub.F90 delete mode 100644 src/unit_test_stubs/main/CMakeLists.txt delete mode 100644 src/unit_test_stubs/main/GetGlobalValuesMod_stub.F90 delete mode 100644 src/unit_test_stubs/main/histFileMod_stub.F90 delete mode 100644 src/unit_test_stubs/main/ncdio_dim.F90 delete mode 100644 src/unit_test_stubs/main/ncdio_pio_fake.F90.in delete mode 100644 src/unit_test_stubs/main/ncdio_var.F90.in delete mode 100644 src/unit_test_stubs/utils/CMakeLists.txt delete mode 100644 src/unit_test_stubs/utils/clmfates_paraminterfaceMod_stub.F90 delete mode 100644 src/unit_test_stubs/utils/restUtilMod_stub.F90.in delete mode 100644 src/unit_test_stubs/utils/spmdMod_stub.F90 delete mode 100644 src/utils/AnnualFluxDribbler.F90 delete mode 100644 src/utils/CMakeLists.txt delete mode 100644 src/utils/SimpleMathMod.F90 delete mode 100644 src/utils/array_utils.F90.in delete mode 100644 src/utils/clm_nlUtilsMod.F90 delete mode 100644 src/utils/clm_time_manager.F90 delete mode 100644 src/utils/clm_varorb.F90 delete mode 100644 src/utils/clmfates_interfaceMod.F90 delete mode 100644 src/utils/clmfates_paraminterfaceMod.F90 delete mode 100644 src/utils/domainMod.F90 delete mode 100644 src/utils/dtypes.h delete mode 100644 src/utils/fileutils.F90 delete mode 100644 src/utils/getdatetime.F90 delete mode 100644 src/utils/quadraticMod.F90 delete mode 100644 src/utils/restUtilMod.F90.in delete mode 100644 src/utils/spmdGathScatMod.F90 delete mode 100644 src/utils/spmdMod.F90 delete mode 100644 src/utils/test/CMakeLists.txt delete mode 100644 src/utils/test/annual_flux_dribbler_test/CMakeLists.txt delete mode 100644 src/utils/test/annual_flux_dribbler_test/test_annual_flux_dribbler.pf delete mode 100644 src/utils/test/clm_time_manager_test/CMakeLists.txt delete mode 100644 src/utils/test/clm_time_manager_test/test_clm_time_manager.pf delete mode 100644 src/utils/test/quadratic_test/CMakeLists.txt delete mode 100644 src/utils/test/quadratic_test/test_quadratic.pf delete mode 100644 src_clm40/biogeochem/C13SummaryMod.F90 delete mode 100644 src_clm40/biogeochem/CNAllocationMod.F90 delete mode 100644 src_clm40/biogeochem/CNAnnualUpdateMod.F90 delete mode 100644 src_clm40/biogeochem/CNBalanceCheckMod.F90 delete mode 100644 src_clm40/biogeochem/CNC13FluxMod.F90 delete mode 100644 src_clm40/biogeochem/CNC13StateUpdate1Mod.F90 delete mode 100644 src_clm40/biogeochem/CNC13StateUpdate2Mod.F90 delete mode 100644 src_clm40/biogeochem/CNC13StateUpdate3Mod.F90 delete mode 100644 src_clm40/biogeochem/CNCStateUpdate1Mod.F90 delete mode 100644 src_clm40/biogeochem/CNCStateUpdate2Mod.F90 delete mode 100644 src_clm40/biogeochem/CNCStateUpdate3Mod.F90 delete mode 100644 src_clm40/biogeochem/CNDVEcosystemDynIniMod.F90 delete mode 100644 src_clm40/biogeochem/CNDVEstablishmentMod.F90 delete mode 100644 src_clm40/biogeochem/CNDVLightMod.F90 delete mode 100644 src_clm40/biogeochem/CNDVMod.F90 delete mode 100644 src_clm40/biogeochem/CNDecompMod.F90 delete mode 100644 src_clm40/biogeochem/CNEcosystemDynMod.F90 delete mode 100644 src_clm40/biogeochem/CNFireMod.F90 delete mode 100644 src_clm40/biogeochem/CNGRespMod.F90 delete mode 100644 src_clm40/biogeochem/CNGapMortalityMod.F90 delete mode 100644 src_clm40/biogeochem/CNMRespMod.F90 delete mode 100644 src_clm40/biogeochem/CNNDynamicsMod.F90 delete mode 100644 src_clm40/biogeochem/CNNStateUpdate1Mod.F90 delete mode 100644 src_clm40/biogeochem/CNNStateUpdate2Mod.F90 delete mode 100644 src_clm40/biogeochem/CNNStateUpdate3Mod.F90 delete mode 100644 src_clm40/biogeochem/CNPhenologyMod.F90 delete mode 100644 src_clm40/biogeochem/CNPrecisionControlMod.F90 delete mode 100644 src_clm40/biogeochem/CNSetValueMod.F90 delete mode 100644 src_clm40/biogeochem/CNSummaryMod.F90 delete mode 100644 src_clm40/biogeochem/CNVegStructUpdateMod.F90 delete mode 100644 src_clm40/biogeochem/CNWoodProductsMod.F90 delete mode 100644 src_clm40/biogeochem/CNrestMod.F90 delete mode 100644 src_clm40/biogeochem/CropRestMod.F90 delete mode 100644 src_clm40/biogeochem/DUSTMod.F90 delete mode 100644 src_clm40/biogeochem/DryDepVelocity.F90 delete mode 100644 src_clm40/biogeochem/MEGANFactorsMod.F90 delete mode 100644 src_clm40/biogeochem/STATICEcosysDynMod.F90 delete mode 100644 src_clm40/biogeochem/VOCEmissionMod.F90 delete mode 100644 src_clm40/biogeophys/BalanceCheckMod.F90 delete mode 100644 src_clm40/biogeophys/BareGroundFluxesMod.F90 delete mode 100644 src_clm40/biogeophys/BiogeophysRestMod.F90 delete mode 100644 src_clm40/biogeophys/Biogeophysics1Mod.F90 delete mode 100644 src_clm40/biogeophys/Biogeophysics2Mod.F90 delete mode 100644 src_clm40/biogeophys/BiogeophysicsLakeMod.F90 delete mode 100644 src_clm40/biogeophys/CanopyFluxesMod.F90 delete mode 100644 src_clm40/biogeophys/FracWetMod.F90 delete mode 100644 src_clm40/biogeophys/FrictionVelocityMod.F90 delete mode 100644 src_clm40/biogeophys/Hydrology1Mod.F90 delete mode 100644 src_clm40/biogeophys/Hydrology2Mod.F90 delete mode 100644 src_clm40/biogeophys/HydrologyLakeMod.F90 delete mode 100644 src_clm40/biogeophys/QSatMod.F90 delete mode 100644 src_clm40/biogeophys/SNICARMod.F90 delete mode 100644 src_clm40/biogeophys/SnowHydrologyMod.F90 delete mode 100644 src_clm40/biogeophys/SoilHydrologyMod.F90 delete mode 100644 src_clm40/biogeophys/SoilTemperatureMod.F90 delete mode 100644 src_clm40/biogeophys/SurfaceAlbedoMod.F90 delete mode 100644 src_clm40/biogeophys/SurfaceRadiationMod.F90 delete mode 100644 src_clm40/biogeophys/TridiagonalMod.F90 delete mode 100644 src_clm40/biogeophys/UrbanInitMod.F90 delete mode 100644 src_clm40/biogeophys/UrbanInputMod.F90 delete mode 100644 src_clm40/biogeophys/UrbanMod.F90 delete mode 100644 src_clm40/biogeophys/clm_driverInitMod.F90 delete mode 100644 src_clm40/main/CMakeLists.txt delete mode 100644 src_clm40/main/CNiniSpecial.F90 delete mode 100644 src_clm40/main/CNiniTimeVar.F90 delete mode 100644 src_clm40/main/GetGlobalValuesMod.F90 delete mode 100644 src_clm40/main/SimpleMathMod.F90 delete mode 100644 src_clm40/main/abortutils.F90 delete mode 100644 src_clm40/main/accFldsMod.F90 delete mode 100644 src_clm40/main/accumulMod.F90 delete mode 100644 src_clm40/main/clm_atmlnd.F90 delete mode 100644 src_clm40/main/clm_cpl_indices.F90 delete mode 100644 src_clm40/main/clm_driver.F90 delete mode 100644 src_clm40/main/clm_glclnd.F90 delete mode 100644 src_clm40/main/clm_initializeMod.F90 delete mode 100644 src_clm40/main/clm_nlUtilsMod.F90 delete mode 100644 src_clm40/main/clm_time_manager.F90 delete mode 100644 src_clm40/main/clm_varcon.F90 delete mode 100644 src_clm40/main/clm_varctl.F90 delete mode 100644 src_clm40/main/clm_varorb.F90 delete mode 100644 src_clm40/main/clm_varpar.F90 delete mode 100644 src_clm40/main/clm_varsur.F90 delete mode 100644 src_clm40/main/clmtype.F90 delete mode 100644 src_clm40/main/clmtypeInitMod.F90 delete mode 100644 src_clm40/main/controlMod.F90 delete mode 100644 src_clm40/main/decompInitMod.F90 delete mode 100644 src_clm40/main/decompMod.F90 delete mode 100644 src_clm40/main/domainMod.F90 delete mode 100644 src_clm40/main/dtypes.h delete mode 100644 src_clm40/main/dynlandMod.F90 delete mode 100644 src_clm40/main/fileutils.F90 delete mode 100644 src_clm40/main/filterMod.F90 delete mode 100755 src_clm40/main/findHistFields.pl delete mode 100644 src_clm40/main/getdatetime.F90 delete mode 100644 src_clm40/main/histFileMod.F90 delete mode 100644 src_clm40/main/histFldsMod.F90 delete mode 100644 src_clm40/main/iniTimeConst.F90 delete mode 100644 src_clm40/main/initGridCellsMod.F90 delete mode 100644 src_clm40/main/initSurfAlbMod.F90 delete mode 100644 src_clm40/main/lnd_comp_mct.F90 delete mode 100644 src_clm40/main/lnd_import_export.F90 delete mode 100644 src_clm40/main/mkarbinitMod.F90 delete mode 100644 src_clm40/main/ncdio_pio.F90.in delete mode 100644 src_clm40/main/ndepStreamMod.F90 delete mode 100644 src_clm40/main/organicFileMod.F90 delete mode 100644 src_clm40/main/pft2colMod.F90 delete mode 100644 src_clm40/main/pftdynMod.F90 delete mode 100644 src_clm40/main/pftvarcon.F90 delete mode 100644 src_clm40/main/quadraticMod.F90 delete mode 100644 src_clm40/main/restFileMod.F90 delete mode 100644 src_clm40/main/restUtilMod.F90 delete mode 100644 src_clm40/main/restUtilMod.F90.in delete mode 100644 src_clm40/main/spmdGathScatMod.F90 delete mode 100644 src_clm40/main/spmdMod.F90 delete mode 100644 src_clm40/main/subgridAveMod.F90 delete mode 100644 src_clm40/main/subgridMod.F90 delete mode 100644 src_clm40/main/subgridRestMod.F90 delete mode 100644 src_clm40/main/surfrdMod.F90 rename {manage_externals/test => test}/.coveragerc (100%) rename {manage_externals/test => test}/.gitignore (100%) rename {manage_externals/test => test}/.pylint.rc (100%) rename {manage_externals/test => test}/Makefile (100%) rename {manage_externals/test => test}/README.md (100%) rename {manage_externals/test => test}/doc/.gitignore (100%) rename {manage_externals/test => test}/doc/Makefile (100%) rename {manage_externals/test => test}/doc/conf.py (100%) rename {manage_externals/test => test}/doc/develop.rst (100%) rename {manage_externals/test => test}/doc/index.rst (100%) rename {manage_externals/test => test}/doc/testing.rst (100%) rename {manage_externals/test => test}/repos/container.git/HEAD (100%) rename {manage_externals/test => test}/repos/container.git/config (100%) rename {manage_externals/test => test}/repos/container.git/description (100%) rename {manage_externals/test => test}/repos/container.git/info/exclude (100%) rename {manage_externals/test => test}/repos/container.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 (100%) rename {manage_externals/test => test}/repos/container.git/objects/71/5b8f3e4afe1802a178e1d603af404ba45d59de (100%) rename {manage_externals/test => test}/repos/container.git/objects/b0/f87705e2b9601cb831878f3d51efa78b910d7b (100%) rename {manage_externals/test => test}/repos/container.git/objects/f9/e08370a737e941de6f6492e3f427c2ef4c1a03 (100%) rename {manage_externals/test => test}/repos/container.git/refs/heads/master (100%) rename {manage_externals/test => test}/repos/error/readme.txt (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/HEAD (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/config (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/description (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/info/exclude (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/00/437ac2000d5f06fb8a572a01a5bbdae98b17cb (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/01/97458f2dbe5fcd6bc44fa46983be0a30282379 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/06/ea30b03ffa2f8574705f8b9583f7ca7e2dccf7 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/14/368b701616a8c53820b610414a4b9a07540cf6 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/15/2b57e1cf23721cd17ff681cb9276e3fb9fc091 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/1f/01fa46c17b1f38b37e6259f6e9d041bda3144f (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/37/f0e70b609adc90f4c09ee21d82ed1d79c81d69 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/38/9a2b876b8965d3c91a3db8d28a483eaf019d5c (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/6e/9f4baa6e94a0af4e094836c2eb55ccedef5fc4 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/6f/c379457ecb4e576a13c7610ae1fa73f845ee6a (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/93/a159deb9175bfeb2820a0006ddd92d78131332 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/95/80ecc12f16334ce44e42287d5d46f927bb7b75 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/a9/288dcd8a719a1f4ed3cba43a2a387ae7cd60fd (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/e8/ea32a11d30ee703f6f661ae7c2376f4ab84d38 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/objects/fd/15a5ad5204356229c60a831d2a8120a43ac901 (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/refs/heads/master (100%) rename {manage_externals/test => test}/repos/mixed-cont-ext.git/refs/heads/new-feature (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/HEAD (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/config (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/description (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/info/exclude (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/0b/67df4e7e8e6e1c6e401542738b352d18744677 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/16/5506a7408a482f50493434e13fffeb44af893f (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/24/4386e788c9bc608613e127a329c742450a60e4 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/32/7e97d86e941047d809dba58f2804740c6c30cf (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/3d/7099c35404ae6c8640ce263b38bef06e98cc26 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/3d/ec1fdf8e2f5edba28148c5db2fe8d7a842360b (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/4d/837135915ed93eed6fff6b439f284ce317296f (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/56/175e017ad38bf3d33d74b6bd7c74624b28466a (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/5f/1d4786d12e52d7ab28d2f2f1118c1059a9f1ae (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/67/136e5ab4d5c1c65d10c8048763b96b0e53c1d6 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/7b/0bd630ac13865735a1dff3437a137d8ab50663 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/88/cf20868e0cc445f5642a480ed034c71e0d7e9f (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/8d/2b3b35126224c975d23f109aa1e3cbac452989 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/9b/75494003deca69527bb64bcaa352e801611dd2 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/a2/2a5da9119328ea6d693f88861457c07e14ac04 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/a4/2fe9144f5707bc1e9515ce1b44681f7aba6f95 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/b9/3737be3ea6b19f6255983748a0a0f4d622f936 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/c5/32bc8fde96fa63103a52057f0baffcc9f00c6b (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/c5/b315915742133dbdfbeed0753e481b55c1d364 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/objects/f2/68d4e56d067da9bd1d85e55bdc40a8bd2b0bca (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/packed-refs (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/refs/heads/feature2 (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/refs/tags/abandoned-feature (100%) rename {manage_externals/test => test}/repos/simple-ext-fork.git/refs/tags/forked-feature-v1 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/HEAD (100%) rename {manage_externals/test => test}/repos/simple-ext.git/config (100%) rename {manage_externals/test => test}/repos/simple-ext.git/description (100%) rename {manage_externals/test => test}/repos/simple-ext.git/info/exclude (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/09/0e1034746b2c865f7b0280813dbf4061a700e8 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c (100%) create mode 100644 test/repos/simple-ext.git/objects/14/2711fdbbcb8034d7cad6bae6801887b12fe61d rename {manage_externals/test => test}/repos/simple-ext.git/objects/31/dbcd6de441e671a467ef317146539b7ffabb11 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 (100%) create mode 100644 test/repos/simple-ext.git/objects/60/7ec299c17dd285c029edc41a0109e49d441380 rename {manage_externals/test => test}/repos/simple-ext.git/objects/60/b1cc1a38d63a4bcaa1e767262bbe23dbf9f5f5 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/63/a99393d1baff97ccef967af30380659867b139 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/95/3256da5612fcd9263590a353bc18c6f224e74f (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/9b/75494003deca69527bb64bcaa352e801611dd2 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/objects/a2/2a5da9119328ea6d693f88861457c07e14ac04 (100%) create mode 100644 test/repos/simple-ext.git/objects/b7/692b6d391899680da7b9b6fd8af4c413f06fe7 rename {manage_externals/test => test}/repos/simple-ext.git/objects/c5/b315915742133dbdfbeed0753e481b55c1d364 (100%) create mode 100644 test/repos/simple-ext.git/objects/d1/163870d19c3dee34fada3a76b785cfa2a8424b create mode 100644 test/repos/simple-ext.git/objects/d8/ed2f33179d751937f8fde2e33921e4827babf4 rename {manage_externals/test => test}/repos/simple-ext.git/objects/df/312890f93ba4d2c694208599b665c4a08afeff (100%) rename {manage_externals/test => test}/repos/simple-ext.git/refs/heads/feature2 (100%) rename {manage_externals/test => test}/repos/simple-ext.git/refs/heads/feature3 (100%) create mode 100644 test/repos/simple-ext.git/refs/heads/master rename {manage_externals/test => test}/repos/simple-ext.git/refs/tags/tag1 (100%) create mode 100644 test/repos/simple-ext.git/refs/tags/tag2 rename {manage_externals/test => test}/requirements.txt (100%) rename {manage_externals/test => test}/test_sys_checkout.py (78%) rename {manage_externals/test => test}/test_sys_repository_git.py (100%) rename {manage_externals/test => test}/test_unit_externals_description.py (96%) rename {manage_externals/test => test}/test_unit_externals_status.py (100%) rename {manage_externals/test => test}/test_unit_repository.py (87%) rename {manage_externals/test => test}/test_unit_repository_git.py (99%) rename {manage_externals/test => test}/test_unit_repository_svn.py (100%) rename {manage_externals/test => test}/test_unit_utils.py (100%) delete mode 100755 test/tools/CLM_compare.sh delete mode 100644 test/tools/Makefile delete mode 100644 test/tools/README delete mode 100644 test/tools/README.testnames delete mode 100755 test/tools/TBLCFGtools.sh delete mode 100755 test/tools/TBLscript_tools.sh delete mode 100755 test/tools/TBLtools.sh delete mode 100755 test/tools/TCBCFGtools.sh delete mode 100755 test/tools/TCBscripttools.sh delete mode 100755 test/tools/TCBtools.sh delete mode 100755 test/tools/TOPtools.sh delete mode 100755 test/tools/TSMCFGtools.sh delete mode 100755 test/tools/TSMncl_tools.sh delete mode 100755 test/tools/TSMscript_tools.sh delete mode 100755 test/tools/TSMtools.sh delete mode 100644 test/tools/config_files/CFGtools__ds delete mode 100644 test/tools/config_files/PTCLM__s delete mode 100644 test/tools/config_files/README delete mode 100644 test/tools/config_files/gen_domain delete mode 100644 test/tools/config_files/tools__do delete mode 100644 test/tools/config_files/tools__ds delete mode 100644 test/tools/config_files/tools__o delete mode 100644 test/tools/config_files/tools__s delete mode 100755 test/tools/gen_test_table.sh delete mode 100755 test/tools/get_cprnc_diffs.sh delete mode 100644 test/tools/input_tests_master delete mode 100644 test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 delete mode 100644 test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 delete mode 100644 test/tools/nl_files/PTCLM_USUMB_clm4_5 delete mode 100644 test/tools/nl_files/gen_domain.T31.runoptions delete mode 100644 test/tools/nl_files/gen_domain.ne30.runoptions delete mode 100644 test/tools/nl_files/getregional delete mode 100644 test/tools/nl_files/getregional_05popd delete mode 100644 test/tools/nl_files/getregional_T62 delete mode 100644 test/tools/nl_files/getregional_ndep delete mode 100644 test/tools/nl_files/mkmapdata_if10 delete mode 100644 test/tools/nl_files/mkmapdata_ne30np4 delete mode 100644 test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 delete mode 100644 test/tools/nl_files/mksrfdt_10x15_1850 delete mode 100644 test/tools/nl_files/mksrfdt_10x15_crp_1850-2000 delete mode 100644 test/tools/nl_files/mksrfdt_1x1_brazil_1850 delete mode 100644 test/tools/nl_files/mksrfdt_1x1_brazil_1850-2000 delete mode 100644 test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 delete mode 100644 test/tools/nl_files/mksrfdt_1x1_vancouverCAN_2000 delete mode 100644 test/tools/nl_files/mksrfdt_T31_crpglc_2000 delete mode 100755 test/tools/show_var_diffs.sh delete mode 100755 test/tools/test_driver.sh delete mode 100644 test/tools/tests_posttag_dav_mpi delete mode 100644 test/tools/tests_posttag_hobart_nompi delete mode 100644 test/tools/tests_posttag_nompi_regression delete mode 100644 test/tools/tests_pretag_cheyenne_nompi delete mode 100644 tools/README delete mode 100644 tools/README.filecopies delete mode 100644 tools/README.testing delete mode 100644 tools/mkmapdata/README delete mode 100755 tools/mkmapdata/createXMLEntries.pl delete mode 100755 tools/mkmapdata/mkmapdata.sh delete mode 100755 tools/mkmapdata/mknoocnmap.pl delete mode 100644 tools/mkmapdata/mkunitymap.ncl delete mode 100755 tools/mkmapdata/mvNimport.sh delete mode 100755 tools/mkmapdata/regridbatch.sh delete mode 100755 tools/mkmapdata/regridgeyser.sh delete mode 100644 tools/mkmapdata/rmdups.ncl delete mode 100644 tools/mkmapgrids/README delete mode 100644 tools/mkmapgrids/mkscripgrid.ncl delete mode 100644 tools/mkprocdata_map/README delete mode 100644 tools/mkprocdata_map/README.filedescriptions delete mode 100755 tools/mkprocdata_map/mkprocdata_map_all delete mode 100644 tools/mkprocdata_map/mkprocdata_map_functions.bash delete mode 100755 tools/mkprocdata_map/mkprocdata_map_wrap delete mode 100644 tools/mkprocdata_map/src/Filepath delete mode 100644 tools/mkprocdata_map/src/Makefile delete mode 100644 tools/mkprocdata_map/src/Makefile.common delete mode 100755 tools/mkprocdata_map/src/Mkdepends delete mode 100644 tools/mkprocdata_map/src/Srcfiles delete mode 100644 tools/mkprocdata_map/src/constMod.F90 delete mode 100644 tools/mkprocdata_map/src/fileutils.F90 delete mode 100644 tools/mkprocdata_map/src/fmain.F90 delete mode 100644 tools/mkprocdata_map/src/gridmapMod.F90 delete mode 100644 tools/mkprocdata_map/src/mkprocdata_map.F90 delete mode 100644 tools/mkprocdata_map/src/nanMod.F90 delete mode 100644 tools/mkprocdata_map/src/shr_file_mod.F90 delete mode 100644 tools/mkprocdata_map/src/shr_kind_mod.F90 delete mode 100644 tools/mksurfdata_map/Makefile.data delete mode 100644 tools/mksurfdata_map/README delete mode 100644 tools/mksurfdata_map/README.developers delete mode 100644 tools/mksurfdata_map/landuse_timeseries_hist_78pfts_simyr1850-2015.txt delete mode 100755 tools/mksurfdata_map/mksurfdata.pl delete mode 100644 tools/mksurfdata_map/mksurfdata_map.namelist delete mode 100644 tools/mksurfdata_map/single_point_dynpft_files/README delete mode 100644 tools/mksurfdata_map/single_point_dynpft_files/README.landuse_timeseries_smallvilleIA_hist_simyr1850-1855 delete mode 100644 tools/mksurfdata_map/single_point_dynpft_files/landuse_timeseries_smallvilleIA_hist_simyr1850-1855.txt delete mode 100644 tools/mksurfdata_map/src/CMakeLists.txt delete mode 100644 tools/mksurfdata_map/src/Filepath delete mode 100644 tools/mksurfdata_map/src/Makefile delete mode 100644 tools/mksurfdata_map/src/Makefile.common delete mode 100755 tools/mksurfdata_map/src/Mkdepends delete mode 100644 tools/mksurfdata_map/src/README.unit_testing delete mode 100644 tools/mksurfdata_map/src/Srcfiles delete mode 100644 tools/mksurfdata_map/src/fileutils.F90 delete mode 100644 tools/mksurfdata_map/src/mkCH4inversionMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkVICparamsMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkagfirepkmonthMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkchecksMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkdiagnosticsMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkdomainMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkfileMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkgdpMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkglacierregionMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkglcmecMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkgridmapMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkharvestMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkindexmapMod.F90 delete mode 100644 tools/mksurfdata_map/src/mklaiMod.F90 delete mode 100644 tools/mksurfdata_map/src/mklanwatMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkncdio.F90 delete mode 100644 tools/mksurfdata_map/src/mkpctPftTypeMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkpeatMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkpftConstantsMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkpftMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkpftUtilsMod.F90 delete mode 100644 tools/mksurfdata_map/src/mksoilMod.F90 delete mode 100644 tools/mksurfdata_map/src/mksoildepthMod.F90 delete mode 100644 tools/mksurfdata_map/src/mksurfdat.F90 delete mode 100644 tools/mksurfdata_map/src/mktopostatsMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkurbanparCommonMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkurbanparMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkutilsMod.F90 delete mode 100644 tools/mksurfdata_map/src/mkvarctl.F90 delete mode 100644 tools/mksurfdata_map/src/mkvarpar.F90 delete mode 100644 tools/mksurfdata_map/src/mkvocefMod.F90 delete mode 100644 tools/mksurfdata_map/src/nanMod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_const_mod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_file_mod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_kind_mod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_log_mod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_string_mod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_sys_mod.F90 delete mode 100644 tools/mksurfdata_map/src/shr_timer_mod.F90 delete mode 100644 tools/mksurfdata_map/src/test/CMakeLists.txt delete mode 100644 tools/mksurfdata_map/src/test/mkgridmap_test/CMakeLists.txt delete mode 100644 tools/mksurfdata_map/src/test/mkgridmap_test/test_mkgridmap.pf delete mode 100644 tools/mksurfdata_map/src/test/mkindexmap_test/CMakeLists.txt delete mode 100644 tools/mksurfdata_map/src/test/mkindexmap_test/test_mkindexmap.pf delete mode 100644 tools/mksurfdata_map/src/test/mkpctPftType_test/CMakeLists.txt delete mode 100644 tools/mksurfdata_map/src/test/mkpctPftType_test/test_mkpctPftType.pf delete mode 100644 tools/mksurfdata_map/src/test/mkpftUtils_test/CMakeLists.txt delete mode 100644 tools/mksurfdata_map/src/test/mkpftUtils_test/test_adjust_total_veg_area.pf delete mode 100644 tools/mksurfdata_map/src/test/mkpftUtils_test/test_convert_from_p2g.pf delete mode 100644 tools/mksurfdata_map/src/unit_test_stubs/mkncdio.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/Filepath delete mode 100644 tools/mksurfdata_map/unit_testers/Makefile delete mode 100644 tools/mksurfdata_map/unit_testers/README delete mode 100644 tools/mksurfdata_map/unit_testers/Srcfiles delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkchecksMod.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkdomainMod.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkgridmapMod.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkharvest.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkindexmapMod.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkncdio.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkurbanparMod.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mkutilsMod.F90 delete mode 100644 tools/mksurfdata_map/unit_testers/test_mod.F90 delete mode 100644 tools/ncl_scripts/README delete mode 100644 tools/ncl_scripts/README.getregional delete mode 100644 tools/ncl_scripts/getco2_historical.ncl delete mode 100644 tools/ncl_scripts/getregional_datasets.ncl delete mode 100755 tools/ncl_scripts/getregional_datasets.pl delete mode 100644 tools/ncl_scripts/sample_inlist delete mode 100644 tools/ncl_scripts/sample_inlist_0.5popd delete mode 100644 tools/ncl_scripts/sample_inlist_T62 delete mode 100644 tools/ncl_scripts/sample_inlist_ndep delete mode 100644 tools/ncl_scripts/sample_outlist delete mode 100644 tools/ncl_scripts/sample_outlist_0.5popd delete mode 100644 tools/ncl_scripts/sample_outlist_T62 delete mode 100644 tools/ncl_scripts/sample_outlist_ndep diff --git a/.CTSMTrunkChecklist b/.CTSMTrunkChecklist deleted file mode 100644 index 116233a969..0000000000 --- a/.CTSMTrunkChecklist +++ /dev/null @@ -1,58 +0,0 @@ -Checklist of steps to do to make a CTSM Trunk Tag Mar/7th/2017 - -CTSM Software Management team. - -See the wiki page for this on: - -https://github.com/ESCOMP/ctsm/wiki/CTSM-development-workflow - -(1) Do all testing on your fork/feature-branch - - 1a -- make sure any new failing tests are either fixed or approved as a new expected - fail - 1b -- update the ExpectedFails list if expected fails changes in 1a - $EDITOR cime_config/testdefs/ExpectedTestFails.xml - 1c -- make sure you understand any changes to the baselines -- to document in ChangeLog - -(2) Use diff and status to make sure any new files are in the repo and only the correct -changes are on the branch - - 2a -- 'git status' to check that you've added any new files and haven't - added any non source files that aren't needed in the repository - 2b -- 'git diff' to check that your changes are correct and you didn't accidentally - add something unintentionally - 2c -- you could also update the content of the changelog here on the branch - -(3) Submit a pull request (PR) for the changes - Have someone review it if you are able. At minimum review it youself. The PR mechanism - on git is an excellent way to code review code for both yourself and others. Also make - sure all your changes are correct, changes that shouldn't have gone in don't, and all new - files are added in. - -(4) Merge the PR to master when review is approved - -(5) Compare master to branch show that they are identical - -git diff master remote/feature-branch - -This should show no diffs - -(6) Update ChangeLog - 6a -- if you didn't update the content in 2c do it now - (Increment the science minor number if answers change in an important way) - 6b -- update date stamp on ChangeLog - ./UpDateChangeLog.pl -update - 6c -- commit new change files - -(7) Make the trunk tag - -(8) Send an email to clm-dev with the contents of the latest ChangeLog -entry (until we have automated this for the git repo) - -NOTES: - -(1) -- Always test on your fork with a feature-branch so that we can change tag order if needed. Put -baselines in the next tag name, as we can easily change afterwards if needed. -(6) or 2c -- Updating the ChangeLog needs to happen on the trunk shortly before the new -trunk tag is made. There is a cronjob that emails errors when the ChangeLog was updated -but the new trunk tag wasn't made. diff --git a/.config_files.xml b/.config_files.xml deleted file mode 100644 index 8e4868b94f..0000000000 --- a/.config_files.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - char - unset - - $SRCROOT - $CIMEROOT/src/components/data_comps/dlnd - $CIMEROOT/src/components/stub_comps/slnd - $CIMEROOT/src/components/xcpl_comps/xlnd - - case_comps - env_case.xml - Root directory of the case land model component - $CIMEROOT/config/xml_schemas/config_compsets.xsd - - - diff --git a/manage_externals/.dir_locals.el b/.dir_locals.el similarity index 100% rename from manage_externals/.dir_locals.el rename to .dir_locals.el diff --git a/manage_externals/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from manage_externals/.github/ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md deleted file mode 100644 index 427217bdfb..0000000000 --- a/.github/ISSUE_TEMPLATE/01_bug_report.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -name: Bug report -about: Report a problem with the code - ---- - -### Brief summary of bug - -[Give a one or two sentence summary. This could be the same as the issue title if you feel that is a sufficient summary.] - -### General bug information - -**CTSM version you are using:** [output of `git describe`] - -**Does this bug cause significantly incorrect results in the model's science?** [Yes / No] - -**Configurations affected:** [Fill this in if known.] - -### Details of bug - -[Fill in details here.] - -### Important details of your setup / configuration so we can reproduce the bug - -[Specify anything relevant: the compset, resolution, machine, compiler, any xml or namelist changes, etc. You don't have to repeat anything that you have already noted above.] - -### Important output or errors that show the problem - -[Fill this in with anything relevant that you haven't already noted; if there is nothing to add, delete this section.] diff --git a/.github/ISSUE_TEMPLATE/02_support_needed.md b/.github/ISSUE_TEMPLATE/02_support_needed.md deleted file mode 100644 index d3c69aaf6a..0000000000 --- a/.github/ISSUE_TEMPLATE/02_support_needed.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -name: Support needed for model use -about: Ask for help with using CTSM - ---- - -### NOTE: Be sure to read the relevant documentation and user forums - -We have limited staff and ability to provide support. Here are some resources that might provide help: -- User's Guide: https://escomp.github.io/ctsm-docs/doc/build/html/users_guide/index.html -- CLM Forum: https://bb.cgd.ucar.edu/forums/land-modeling-clm -- README files amongst the source code -- GitHub CTSM issues: https://github.com/escomp/ctsm/issues/ -- Also make sure this issue is unique to CTSM and not really an issue with CESM or CIME - -### Details of support request - -[Fill in details here.] - -### Important details of your setup / configuration so we can better assist you - -**CTSM version you are using:** [output of `git describe`] - -**Have you made any modifications to code, xml files, etc.?** [Yes / No] - -[If Yes: Please point us to your modifications. However: In general we can NOT support problems with modified code. Try to show the problem without modifications.] - -**If you are having problems with a specific case: Is your case on a machine accessible to most CTSM developers (e.g., an NCAR machine)?** [Yes / No] - -If Yes: - -- Location of case directory: [Fill this in] - -- Location of run directory: [Fill this in] - -[If No: Please make sure you have included all important input and output needed to understand your issue, either by pasting it into the issue text, or by attaching relevant files. However: We are less likely to be able to reproduce your problem if the issue is NOT on an NCAR machine.] diff --git a/.github/ISSUE_TEMPLATE/03_science_discussion.md b/.github/ISSUE_TEMPLATE/03_science_discussion.md deleted file mode 100644 index 25f47ff601..0000000000 --- a/.github/ISSUE_TEMPLATE/03_science_discussion.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Science discussion -about: We encourage the use of issues to discuss CTSM science developments - ---- - - diff --git a/.github/ISSUE_TEMPLATE/04_other.md b/.github/ISSUE_TEMPLATE/04_other.md deleted file mode 100644 index 61898d3a75..0000000000 --- a/.github/ISSUE_TEMPLATE/04_other.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: Other -about: Other issues (enhancement, cleanup, documentation, etc.) - ---- - - diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 36a87f49f1..b68b1fb5e2 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,20 +1,17 @@ -### Description of changes +[ 50 character, one line summary ] -### Specific notes +[ Description of the changes in this commit. It should be enough + information for someone not following this development to understand. + Lines should be wrapped at about 72 characters. ] -Contributors other than yourself, if any: +User interface changes?: [ No/Yes ] +[ If yes, describe what changed, and steps taken to ensure backward compatibilty ] -CTSM Issues Fixed (include github issue #): +Fixes: [Github issue #s] And brief description of each issue. -Are answers expected to change (and if so in what way)? +Testing: + test removed: + unit tests: + system tests: + manual testing: -Any User Interface Changes (namelist or namelist defaults changes)? - -Testing performed, if any: -(List what testing you did to show your changes worked as expected) -(This can be manual testing or running of the different test suites) -(Documentation on system testing is here: https://github.com/ESCOMP/ctsm/wiki/System-Testing-Guide) -(aux_clm on cheyenne for gnu/pgi and hobart for gnu/pgi/nag is the standard for tags on master) - -**NOTE: Be sure to check your Coding style against the standard:** -https://github.com/ESCOMP/ctsm/wiki/CTSM-coding-guidelines diff --git a/.gitignore b/.gitignore index d8000a5537..411de5d96e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,97 +1,14 @@ -# directories checked out by manage_externals, and other files created -# by manage_externals -manage_externals.log -/src/fates/ -/tools/PTCLM/ -/cime/ -/components/ +# directories that are checked out by the tool +cime/ +cime_config/ +components/ -# ignore svn directories -**/.svn/** -.svn/ - -# binary files -*.nc +# generated local files +*.log # editor files -*.swp *~ +*.bak -# mac files -.DS_Store - -# cmake generated files -build/ -CMakeFiles/ - - -# unit testing directories -/src/unit_tests.* - -# files generated by the unit test build -/src/dyn_subgrid/dynVarMod.F90 -/src/dyn_subgrid/dynVarTimeInterpMod.F90 -/src/dyn_subgrid/dynVarTimeUninterpMod.F90 -/src/utils/array_utils.F90 -/src/unit_test_stubs/utils/restUtilMod_stub.F90 -/src/unit_test_stubs/main/ncdio_pio_fake.F90 -/src/unit_test_stubs/main/ncdio_var.F90 -/src/unit_test_shr/unittestArrayMod.F90 - -# cime_config -buildnmlc -buildcppc - -# configure / build files -/bld/**/CESM_cppdefs -/bld/**/Filepath -/bld/**/config_cache.xml -/bld/**/lnd_in -/bld/**/drv_flds_in - -# build-naemlist testing -/bld/unit_testers/lnd_in* -/bld/unit_testers/drv_flds_in* -/bld/unit_testers/temp_file.txt* -/bld/unit_testers/user_nl_clm_real_parameters* -/bld/unit_testers/env_run.xml - -# tools testing output -td.*.status -td.*.log -td.*.status.xFail -test_driver_*.sh - -# mksurfdata output -surfdata_*.log -surfdata_*.namelist -landuse.timeseries_*.namelist -landuse.timeseries_*.log -landuse_timeseries_*.txt -clm.input_data_list -clm.input_data_list.previous -*.stdout.txt.o* - -# Tools executables -/tools/mksurfdata_map/mksurfdata_map -/tools/mkprocdata_map/mkprocdata_map - -# mksurfdata output files -/tools/mksurfdata_map/surfdata_*.nc -/tools/mksurfdata_map/landuse.timeseries_*.nc - -# mkmapdata output files -/tools/mkmapdata/PET*.RegridWeightGen.Log -/tools/mkmapdata/regrid.*.out -/tools/mkmapdata/regrid.*.err -/tools/mkmapdata/regrid.o* -/tools/mkmapdata/map*.nc - -# build output -*.o -*.mod -core.* -*.gz -*.log !run.log +# generated python files *.pyc -Depends diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..1990cb9604 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +language: python +os: linux +python: + - "2.7" + - "3.4" + - "3.5" + - "3.6" + - "3.7" + - "3.8" +install: + - pip install -r test/requirements.txt +before_script: + - git --version +script: + - cd test; make test + - cd test; make lint +after_success: + - cd test; make coverage + - cd test; coveralls diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 7ed198ec02..0000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,49 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, politcal affiliation, veteran status, pregnancy, genetic information, personal appearance, choice of text editor or operating system, race, religion, or sexual identity and orientation, or any other characteristic protected under applicable US federal or state law. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting -* Refusing to use the pronouns that someone requests -* Intimidating, threatening, or hostile conduct; physical or verbal abuse; vandalism; arson; and sabotage -* Alarming or threatening comments that might refer to, suggest, or promote a violent, intimidating, or threatening action - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ctsm-core@ucar.edu. Alternatively, this behavior can be reported to individuals on the CTSM team, who will then have the responsibility to talk about the behavior to the core team. Another alternative for NCAR employees (when all individuals involved are NCAR employees) is to use the reporting methods of NCAR for this behavior (these options include anonymous reporting methods). The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Retaliation against a person who initiates a complaint or an inquiry about such behaviors is equally prohibited. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 70bf041ba7..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,48 +0,0 @@ -## How to contribute: - -We recommend that you first open an issue (https://github.com/escomp/ctsm/issues/) to -discuss the changes or additions that you propose. Through the issue discussion, you can -work with other CTSM developers to think about the design and implementation of the changes -as well as the planning and scheduling for the change to come into CTSM. An alternative is -to contact the key software and science developers via ctsm-software@ucar.edu. Making -contact early in your project will increase the likelihood that your developments can come -into CTSM. - -We also recommend that you join the ctsm-dev@ucar.edu google groups in order -to be informed about the science that is happening in CTSM as well as the latest developments and tags. -The ctsm-dev group is here: - -https://groups.google.com/a/ucar.edu/forum/#!forum/ctsm-dev - -Use the help from the wiki below to setup a fork and personal branch in GitHub to put your developments -on and keep up to date with the master branch of CTSM. Once the changes are sufficiently advanced you -can form a Pull Request on GitHub. Either from your fork on GitHub, or from the main ESCOMP GitHub page -for CTSM (be sure to hit the "compare across forks" link at the top of the page when you first create -the pull request). - -https://github.com/ESCOMP/ctsm/pulls - -This allows you to show your proposed changes and start getting feedback on them (even if they aren't finished). -This also allows your changes to be planned for and slated for a time to come into CTSM master. In most -cases you won't merge the Pull Request yourself, but a software engineer responsible for CTSM will do -additional testing and bring the changes to CTSM master. - -### CTSM Developers Guide: - - https://wiki.ucar.edu/display/ccsm/Community+Land+Model+Developers+Guide - -## Getting Started: - -The following resources give you information on the project and how to get started. - -#### CTSM Wiki: - -https://github.com/ESCOMP/ctsm/wiki - -#### Coding Practices and Style: - -Code conventions: https://github.com/ESCOMP/ctsm/wiki/CTSM-coding-guidelines - -#### Code of Conduct: - -See the `CODE_OF_CONDUCT.md` file for expectations of how to work in the community. diff --git a/Copyright b/Copyright deleted file mode 100644 index 21b9688874..0000000000 --- a/Copyright +++ /dev/null @@ -1,75 +0,0 @@ -CESM1.5: Copyright Notice and Disclaimer - -The Community Earth System Model (CESM was developed in cooperation with -the National Science Foundation, the Department of Energy, -the National Aeronautics and Space Administration, and -the University Corporation for Atmospheric Research National Center for Atmospheric Research. - -Except for the segregable components listed below, CESM is public domain software. -There may be other third party tools and libraries that are embedded, and -they may have their own copyright notices and terms. - -The following components are copyrighted and may only be used, modified, -or redistributed under the terms indicated below. - -Code Institution Copyright Terms of Use/Disclaimer ----- ----------- --------- ----------------------- -ESMF University of Copyright University of Illinois/NCSA Open Source License - Illinois/NCSA 2002-2009, - University of - Illinois/NCSA - Open Source - License - -POP,SCRIP,CICE Los Alamos National Copyright 2008 Los Alamos National Security, LLC - Laboratory Los Alamos - National - Security, LLC - -CISM NCAR/LANL/ORNL/SNL/ Copyright GNU Lesser General Public License v. 3 - LBNL/NYU/U. Bristol/ 2004-2018, CISM is free software: you can redistribute it - U. Edinburgh/ GNU Lesser and/or modify it under the terms of the GNU - U. Montana/U. Swansea General Public Lesser General Public License as published by the - License v. 3 Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - -AER RRTMG Atmospheric Copyright AER RRTMG Copyright - and 2002-2010, - Environmental Atmospheric - Research, Inc. and - Environmental - Research, Inc. - -MCT Argonne Copyright 2000, MCT Copyright - National 2010, - Laboratory University of - Chicago. - -ICSSP N/A Copyright 2003, ISCCP Simulator Software - 2010, Steve - Klein and Mark - Webb - -XML/Lite Wadsack-Allen Copyright 2001, The documentation for the Perl XML-Lite - Digital Group 2010 module is no longer available on-line. - Wadsack-Allen - Digital Group - -Inf_NaN Lahey Copyright(c) Copies of this source code, or standalone compiled -_Detection Computer 2003, Lahey files derived from this source may not be sold -module Systems, Inc. Computer without permission from Lahey Computers Systems. - Systems, Inc. All or part of this module may be freely incorporated - into executable programs which are offered for sale. - Otherwise, distribution of all or part of this file is - permitted, provided this copyright notice and header - are included. - - -THIS SOFTWARE IS PROVIDED BY UCAR AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL UCAR OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/Externals.cfg b/Externals.cfg deleted file mode 100644 index ca5522dc58..0000000000 --- a/Externals.cfg +++ /dev/null @@ -1,38 +0,0 @@ -[clm] -local_path = . -protocol = externals_only -externals = Externals_CLM.cfg -required = True - -[cism] -local_path = components/cism -protocol = git -repo_url = https://github.com/ESCOMP/cism-wrapper -tag = release-cesm2.0.04 -externals = Externals_CISM.cfg -required = True - -[rtm] -local_path = components/rtm -protocol = git -repo_url = https://github.com/ESCOMP/rtm -tag = release-cesm2.0.00 -required = True - -[mosart] -local_path = components/mosart -protocol = git -repo_url = https://github.com/ESCOMP/mosart -tag = release-cesm2.0.00 -required = True - -[cime] -local_path = cime -protocol = git -repo_url = https://github.com/ESMCI/cime -tag = cime_cesm2_0_rel_05 -required = True - -[externals_description] -schema_version = 1.0.0 - diff --git a/Externals_CLM.cfg b/Externals_CLM.cfg deleted file mode 100644 index d6e68c79f0..0000000000 --- a/Externals_CLM.cfg +++ /dev/null @@ -1,17 +0,0 @@ -[fates] -local_path = src/fates -protocol = git -repo_url = https://github.com/NCAR/fates-release -tag = fates_s1.8.1_a3.0.0 -required = True - -[PTCLM] -local_path = tools/PTCLM -protocol = git -repo_url = https://github.com/ESCOMP/ptclm -tag = PTCLM2_180611 -required = True - -[externals_description] -schema_version = 1.0.0 - diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 2ba2f9c2d8..0000000000 --- a/LICENSE +++ /dev/null @@ -1,34 +0,0 @@ -Copyright (c) 2005-2018, University Corporation for Atmospheric Research (UCAR) -All rights reserved. - -Developed by: - University Corporation for Atmospheric Research - National Center for Atmospheric Research - https://www2.cesm.ucar.edu/working-groups/sewg - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the "Software"), -to deal with the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimers. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimers in the documentation - and/or other materials provided with the distribution. - - Neither the names of [Name of Development Group, UCAR], - nor the names of its contributors may be used to endorse or promote - products derived from this Software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/manage_externals/LICENSE.txt b/LICENSE.txt similarity index 100% rename from manage_externals/LICENSE.txt rename to LICENSE.txt diff --git a/README b/README deleted file mode 100644 index e3d7c0930b..0000000000 --- a/README +++ /dev/null @@ -1,162 +0,0 @@ -$CTSMROOT/README 06/08/2018 - -Community Land Surface Model (CLM) science version 5.0.0 series -- source code, tools, -offline-build and test scripts. This gives you everything you need -to run CLM with CESM with datm8 to provide CRU NCEP or GSWP3 forcing data in -place of a modeled atmosphere. - -For lists of current bugs (issues) and current development see the CTSM GitHub page: - -https://github.com/ESCOMP/ctsm - -IMPORTANT NOTE ON CESM CHECKOUT VERSUS A CTSM CHECKOUT: - -If this is the top level directory from making a clone of CTSM the -directory structure is a little bit different than if CTSM is from -a clone of the entire CESM. If this is part of CESM this directory -will be under components/clm alongside other CESM component models. -For a CTSM checkout this will be the top level directory. - -Other documentation will refer to $CTSMROOT and it means the directory -that this file is at. CIMEROOT is the directory where "cime" is for -this checkout. For a CESM checkout $CIMEROOT will be the "cime" directory -beneath the top level directory. For a CTSM checkout $CIMEROOT will -be $CTSMROOT/cime. - -General directory structure ($CTSMROOT): - -doc --------------- Documentation of CLM. -bld --------------- Template, configure and build-namelist scripts for clm. -src --------------- CLM Source code. -test -------------- CLM Testing scripts for CLM offline tools. -tools ------------- CLM Offline tools to prepare input datasets and process output. -cime_config ------- Configuration files of cime for compsets and CLM settings -manage_externals -- Script to manage the external source directories - -Directory structure only for a CTSM checkout: - -components -------- Other active sub-components needed for CLM to run (river routing and land-ice models) - -cime/scripts --------------- cesm/cime driver scripts - -cime/src/drivers/mct/main ----------- CESM top level driver source code. -cime/src/drivers/mct/shr ------------ CESM top level driver shared code. -cime/src/components/data_comps/datm - CESM Data model version 8 source code. -cime/src/components/stub_comps/sice - CESM stub sea-ice model source code. -cime/src/components/stub_comps/socn - CESM stub ocean model source code. -cime/src/components/stub_comps/sglc - CESM stub glacier model source code. -cime/src/externals ------------------ CESM external utility codes - (Model Coupling Toolkit (MCT) - (Earth System Model Framework) - (timing -- code timing utility) - (pio -- Parallel Input/Output) -components/cism --------------------- CESM Community land Ice Sheet Model. -components/mosart ------------------- Model for Scale Adaptive River Transport -components/rtm ---------------------- CESM River Transport Model. - -Top level documentation ($CTSMROOT): - -README ------------------- This file -README.rst --------------- File that displays under the project in github -README_EXTERNALS.rst ----- Information on how to work with subversion externals for clm -CODE_OF_CONDUCT.md ------- Code of Conduct for how to work with each other on the CTSM project -Copyright ---------------- CESM Copyright file -doc/UpdateChangeLog.pl ------- Script to add documentation on a tag to the - ChangeLog/ChangeSum files -doc/ChangeLog ---------------- Documents different CLM versions -doc/ChangeSum ---------------- Summary documentation of different CLM versions - -Documentation of Namelist Items: (view the following in a web browser) - -bld/namelist_files/namelist_definition.xml --- Definition of all namelist items -bld/namelist_files/namelist_defaults_clm4_5.xml - Default values for CLM4.5/CLM5.0 - -============================================================================================= -Important files in main directories (under $CTSMROOT): -============================================================================================= - -Externals.cfg --------------- File for management of the main high level externals -Externals_CLM.cfg ----------- File for management of the CLM specific externals (i.e. FATES) -parse_cime.cs.status -------- Script to parse test status files cs.status.* created by create_test -doc/Quickstart.GUIDE -------- Quick guide to using cpl7 scripts. -doc/IMPORTANT_NOTES --------- Some important notes about this version of - clm, configuration modes and namelist items - that are not validated or functional. -doc/ChangeLog --------------- Detailed list of changes for each model version. -doc/ChangeSum --------------- Summary one-line list of changes for each - model version. -doc/README ------------------ Documentation similar to this file -doc/UsersGuide -------------- CLM Users Guide -doc/CodeReference ----------- CLM Code Reference Guide - -bld/README ------------------ Description of how to use the configure and - build-namelist scripts. -bld/configure --------------- Script to prepare CLM to be built. -bld/build-namelist ---------- Script to build CLM namelists. - -cime_config/buildnml ------------- Build the CLM namelist for CIME -cime_config/buildlib ------------- Build the CLM library -cime_config/config_compsets.xml -- Define CLM compsets -cime_config/config_component.xml - Define CLM XML settings -cime_config/config_tests.xml ----- Define CLM specific tests -cime_config/config_pes.xml ------- Define Processor layouts for various CLM grids and compsets -cime_config/testdefs ------------- Directory for specification of CLM testing -cime_config/testdefs/ExpectedTestFails.xml -- List of tests that are expected to fail -cime_config/usermods_dirs -------- Directories of sets of user-modification subdirs - (These are directories that add specific user modifications to - simulations created using "cime/scripts/create_newcase --user-mods-dir". - Current sub directories are for various CMIP6 configurations) - -test/tools/test_driver.sh -- Script for general software testing of - CLM's offline tools. - -tools/mksurfdata_map ---------- Directory to build program to create surface dataset - at any resolution. -tools/mkdatadomain ------------ Directory to build program to create datm7 or docn7 - domain files from clm files. -tools/mkprocdata_map ---------- Process history data from unstructed grids to a gridded - format. -tools/mkmapgrids -------------- NCL script to create a SCRIP grid file for a regular lat/lon grid -tools/ncl_scripts ------------ Directory of NCL and perl scripts to do various - tasks. Most notably to plot perturbation error growth - testing and to extract regional information from - global datasets for single-point/regional simulations. - - -============================================================================================= -Source code directory structure: -============================================================================================= - -src/biogeochem ---- Biogeochemisty -src/main ---------- Main control and high level code -src/cpl ----------- Land model high level MCT and ESMF drivers -src/biogeophys ---- Biogeophysics (Hydrology) -src/dyn_subgrid --- Dynamic land unit change -src/init_interp --- Online interpolation -scr/fates --------- FATES model and sub-directories - Functionally Assembled Terrestrial Ecosystem Simulator (FATES) - Experimental Ecosystem Demography model -src/utils --------- Utility codes -src/unit_test_shr - Unit test shared modules for unit testing -src/unit_test_stubs Unit test stubs that replicate CTSM code simpler - -src_clm40 --------- CLM4.0 source code directory - -============================================================================================= - QUICKSTART: using the CPL7 scripts -============================================================================================= - - cd $CIMEROOT/scripts - ./create_newcase # get help on how to run create_newcase - ./create_newcase --case testI --res f19_g17_gl4 --compset I2000Clm50BgcCrop - # create new "I" case for default machine at 1.9x2.5_gx1v7 - # with 4km greenland ice sheetres resolution - # "I2000Clm50BgcCrop" case is clm5_0 active, datm8, and inactive ice/ocn - # With no-evolve ice-sheet, and MOSART for river-routing - cd testI - ./case.setup # create the $CASE.run file - ./case.build # build model and create namelists - ./case.submit # submit script - # (NOTE: ./xmlchange RESUBMIT=10 to set RESUBMIT to number - # # of times to automatically resubmit -- 10 in this example) - diff --git a/manage_externals/README.md b/README.md similarity index 91% rename from manage_externals/README.md rename to README.md index 15e45ffb71..c931c8e213 100644 --- a/manage_externals/README.md +++ b/README.md @@ -85,7 +85,7 @@ The root of the source tree will be referred to as `${SRC_ROOT}` below. description file: $ cd ${SRC_ROOT} - $ ./manage_externals/checkout_externals --excernals my-externals.cfg + $ ./manage_externals/checkout_externals --externals my-externals.cfg * Status summary of the repositories managed by checkout_externals: @@ -202,6 +202,21 @@ The root of the source tree will be referred to as `${SRC_ROOT}` below. Then the main 'externals' field in the top level repo should point to 'sub-externals.cfg'. + * from_submodule (True / False) : used to pull the repo_url, local_path, + and hash properties for this external from the .gitmodules file in + this repository. Note that the section name (the entry in square + brackets) must match the name in the .gitmodules file. + If from_submodule is True, the protocol must be git and no repo_url, + local_path, hash, branch, or tag entries are allowed. + Default: False + + * sparse (string) : used to control a sparse checkout. This optional + entry should point to a filename (path relative to local_path) that + contains instructions on which repository paths to include (or + exclude) from the working tree. + See the "SPARSE CHECKOUT" section of https://git-scm.com/docs/git-read-tree + Default: sparse checkout is disabled + * Lines begining with '#' or ';' are comments and will be ignored. # Obtaining this tool, reporting issues, etc. diff --git a/README.rst b/README.rst deleted file mode 100644 index 6569f5f809..0000000000 --- a/README.rst +++ /dev/null @@ -1,31 +0,0 @@ -==== -CTSM -==== - -The Community Terrestrial Systems Model. - -This includes the Community Land Model (CLM5.0 and CLM4.5) of the Community Earth System Model. - -For documentation, quick start, diagnostics, model output and -references, see - -http://www.cesm.ucar.edu/models/cesm2.0/land/ - -and - -https://escomp.github.io/ctsm-docs/ - -For help with how to work with CTSM in git, see - -https://github.com/ESCOMP/ctsm/wiki/Getting-started-with-CTSM-in-git - -and - -https://github.com/ESCOMP/ctsm/wiki/Recommended-git-setup - -To get updates on CTSM tags and important notes on CTSM developments -join our low traffic email list: - -https://groups.google.com/a/ucar.edu/forum/#!forum/ctsm-dev - -(Send email to ctsm-software@ucar.edu if you have problems with any of this) diff --git a/README_EXTERNALS.rst b/README_EXTERNALS.rst deleted file mode 100644 index 82496dca62..0000000000 --- a/README_EXTERNALS.rst +++ /dev/null @@ -1,124 +0,0 @@ -Obtaining the full model code and associated scripting infrastructure -===================================================================== - -CTSM is released via GitHub. You will need some familiarity with git in order -to modify the code and commit these changes. However, to simply checkout and run the -code, no git knowledge is required other than what is documented in the following steps. - -To obtain the CTSM code you need to do the following: - -#. Clone the repository. :: - - git clone https://github.com/escomp/ctsm.git my_ctsm_sandbox - - This will create a directory ``my_ctsm_sandbox/`` in your current working directory. - -#. Run the script **manage_externals/checkout_externals**. :: - - ./manage_externals/checkout_externals - - The **checkout_externals** script is a package manager that will - populate the ctsm directory with the relevant versions of each of the - components along with the CIME infrastructure code. - -At this point you have a working version of CTSM. - -To see full details of how to set up a case, compile and run, see the CIME documentation at http://esmci.github.io/cime/ . - -More details on checkout_externals ----------------------------------- - -The file **Externals.cfg** in your top-level CTSM directory tells -**checkout_externals** which tag/branch of each component should be -brought in to generate your sandbox. (This file serves the same purpose -as SVN_EXTERNAL_DIRECTORIES when CLM was in a subversion repository.) - -NOTE: Just like svn externals, checkout_externals will always attempt -to make the working copy exactly match the externals description. If -you manually modify an external without updating Externals.cfg, e.g. switch -to a different tag, then rerunning checkout_externals will switch you -back to the external described in Externals.cfg. See below -documentation `Customizing your CTSM sandbox`_ for more details. - -**You need to rerun checkout_externals whenever Externals.cfg has -changed** (unless you have already manually updated the relevant -external(s) to have the correct branch/tag checked out). Common times -when this is needed are: - -* After checking out a new CTSM branch/tag - -* After merging some other CTSM branch/tag into your currently - checked-out branch - -**checkout_externals** must be run from the root of the source -tree. For example, if you cloned CTSM with:: - - git clone https://github.com/escomp/ctsm.git my_ctsm_sandbox - -then you must run **checkout_externals** from -``/path/to/my_ctsm_sandbox``. - -To see more details of **checkout_externals**, issue :: - - ./manage_externals/checkout_externals --help - -Customizing your CTSM sandbox -============================= - -There are several use cases to consider when you want to customize or modify your CTSM sandbox. - -Switching to a different CTSM branch or tag -------------------------------------------- - -If you have already checked out a branch or tag and **HAVE NOT MADE ANY -MODIFICATIONS** it is simple to change your sandbox. Say that you -checked out ctsm1.0.0 but really wanted to have ctsm1.1.0; -you would simply do the following:: - - git checkout ctsm1.1.0 - ./manage_externals/checkout_externals - -You should **not** use this method if you have made any source code -changes, or if you have any ongoing CTSM cases that were created from -this sandbox. In these cases, it is often easiest to do a second **git -clone**. - -Pointing to a different version of a component ----------------------------------------------- - -Each entry in **Externals.cfg** has the following form (we use CIME as an -example below):: - - [cime] - local_path = cime - protocol = git - repo_url = https://github.com/CESM-Development/cime - tag = cime5.4.0-alpha.20 - required = True - -Each entry specifies either a tag or a branch. To point to a new tag: - -#. Modify the relevant entry/entries in **Externals.cfg** (e.g., changing - ``cime5.4.0-alpha.20`` to ``cime5.4.0-alpha.21`` above) - -#. Checkout the new component(s):: - - ./manage_externals/checkout_externals - -Keep in mind that changing individual components from a tag may result -in an invalid model (won't compile, won't run, not scientifically -meaningful) and is unsupported. - -Committing your change to Externals.cfg -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -After making this change, it's a good idea to commit the change in your -local CTSM git repository. First create a branch in your local -repository, then commit it. (Unlike with subversion, branches are stored -locally unless you explicitly push them up to GitHub. Feel free to -create whatever local branches you'd like.) For example:: - - git checkout -b my_ctsm_branch - git add Externals.cfg - git commit -m "Update CIME to cime5.4.0-alpha.20" - diff --git a/manage_externals/README_FIRST b/README_FIRST similarity index 100% rename from manage_externals/README_FIRST rename to README_FIRST diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm deleted file mode 100755 index 89295242cf..0000000000 --- a/bld/CLMBuildNamelist.pm +++ /dev/null @@ -1,4505 +0,0 @@ -# build-namelist -# -# This script builds the namelists for CLM -# -# The simplest use of build-namelist is to execute it from the build directory where configure -# was run. By default it will use the config_cache.xml file that was written by configure to -# determine the build time properties of the executable, and will write the files that contain -# the output namelists in that same directory. But if multiple runs are to made using the -# same executable, successive invocations of build-namelist will overwrite previously generated -# namelist files. So generally the best strategy is to invoke build-namelist from the run -# directory and use the -config option to provide the filepath of the config_cache.xml file. -# -# -# Date Contributor Modification -# ------------------------------------------------------------------------------------------- -# 2009-01-20 Vertenstein Original version -# 2010-04-27 Kluzek Add ndep streams capability -# 2011-07-25 Kluzek Add multiple ensemble's of namelists -# 2012-03-23 Kluzek Add megan namelist and do checking on it -# 2012-07-01 Kluzek Add some common CESM namelist options -# 2013-12 Andre Refactor everything into subroutines -# 2013-12 Muszala Add Ecosystem Demography functionality -#-------------------------------------------------------------------------------------------- - -package CLMBuildNamelist; - -require 5; - -use strict; -#use warnings; -#use diagnostics; - -use Cwd qw(getcwd abs_path); -use File::Basename qw(dirname); -use English; -use Getopt::Long; -use IO::File; -use File::Glob ':glob'; - -#------------------------------------------------------------------------------- -# -# Define a small number of global variables -# -#------------------------------------------------------------------------------- - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; -$ProgName = "CLM " . "$ProgName"; - -my $cwd = abs_path(getcwd()); # absolute path of the current working directory -my $log; # Log messages object -- will be set in main, declaring it global here means it can be used everywhere - -#------------------------------------------------------------------------------- - -sub usage { - die < Glacier number of elevation classes [0 | 3 | 5 | 10 | 36] - (default is 0) (standard option with land-ice model is 10) - -help [or -h] Print usage to STDOUT. - -light_res Resolution of lightning dataset to use for CN fire (hcru or T62) - -ignore_ic_date Ignore the date on the initial condition files - when determining what input initial condition file to use. - -ignore_ic_year Ignore just the year part of the date on the initial condition files - when determining what input initial condition file to use. - -ignore_warnings Allow build-namelist to continue, rather than stopping on - warnings - -infile "filepath" Specify a file (or list of files) containing namelists to - read values from. - - If used with a CLM build with multiple ensembles (ninst_lnd>1) - and the filename entered is a directory to files of the - form filepath/filepath and filepath/filepath_\$n where \$n - is the ensemble member number. the "filepath/filepath" - input namelist file is the master input namelist file - that is applied to ALL ensemble members. - - (by default for CESM this is setup for files of the - form \$CASEDIR/user_nl_clm/user_nl_clm_????) - -inputdata "filepath" Writes out a list containing pathnames for required input datasets in - file specified. - -irrig "value" If .true. week surface datasets with irrigation turned on. (only allowed for CLM4.0 physics) - Default: .false. - (for CLM4.5/CLM5.0 physics set the namelist flag irrigate=.true.) - -l_ncpl "LND_NCPL" Number of CLM coupling time-steps in a day. - -lnd_tuning_mode "value" Use the parameters tuned for the given configuration (CLM version and atmospheric forcing) - -mask "landmask" Type of land-mask (default, navy, gx3v5, gx1v5 etc.) - "-mask list" to list valid land masks. - -namelist "namelist" Specify namelist settings directly on the commandline by supplying - a string containing FORTRAN namelist syntax, e.g., - -namelist "&clm_inparm dt=1800 /" - -no-megan DO NOT PRODUCE a megan_emis_nl namelist that will go into the - "drv_flds_in" file for the driver to pass VOCs to the atm. - MEGAN (Model of Emissions of Gases and Aerosols from Nature) - (Note: buildnml copies the file for use by the driver) - -[no-]note Add note to output namelist [do NOT add note] about the - arguments to build-namelist. - -output_reals Output real parameters to the given output file. - -rcp "value" Representative concentration pathway (rcp) to use for - future scenarios. - "-rcp list" to list valid rcp settings. - -s Turns on silent mode - only fatal messages issued. - -test Enable checking that input datasets exist on local filesystem. - -use_case "case" Specify a use case which will provide default values. - "-use_case list" to list valid use-cases. - -verbose [or -v] Turn on verbose echoing of informational messages. - -version Echo the SVN tag name used to check out this CLM distribution. - -vichydro Toggle to turn on VIC hydrologic parameterizations (default is off) - This turns on the namelist variable: use_vichydro - - -Note: The precedence for setting the values of namelist variables is (highest to lowest): - 0. namelist values set by specific command-line options, like, -d, -sim_year - (i.e. compset choice and CLM_BLDNML_OPTS, CLM_ACCELERATED_SPINUP, LND_TUNING_MODE env_run variables) - (NOTE: If you try to contradict these settings by methods below, an error will be triggered) - 1. values set on the command-line using the -namelist option, - (i.e. CLM_NAMELIST_OPTS env_run variable) - 2. values read from the file(s) specified by -infile, - (i.e. user_nl_clm files) - 3. datasets from the -clm_usr_name option, - (i.e. CLM_USRDAT_NAME env_run variable) - 4. values set from a use-case scenario, e.g., -use_case - (i.e. CLM_NML_USE_CASE env_run variable) - 5. values from the namelist defaults file. -EOF -} - -#------------------------------------------------------------------------------- - -sub process_commandline { - # Process command-line options and return the hash - my ($nl_flags) = @_; - - # Save the command line arguments to the script. NOTE: this must be - # before GetOptions() is called because items are removed from from - # the array! - $nl_flags->{'cmdline'} = "@ARGV"; - - my %opts = ( cimeroot => undef, - config => "config_cache.xml", - csmdata => undef, - clm_usr_name => undef, - co2_type => undef, - co2_ppmv => undef, - clm_demand => "null", - help => 0, - glc_nec => "default", - light_res => "default", - l_ncpl => undef, - lnd_tuning_mode => "default", - lnd_frac => undef, - dir => "$cwd", - rcp => "default", - sim_year => "default", - clm_accelerated_spinup=> "default", - chk_res => undef, - note => undef, - drydep => 0, - output_reals_filename => undef, - fire_emis => 0, - megan => "default", - irrig => "default", - res => "default", - silent => 0, - ignore_warnings => 0, - mask => "default", - test => 0, - bgc => "default", - crop => 0, - dynamic_vegetation => 0, - envxml_dir => ".", - vichydro => 0, - maxpft => "default", - ); - - GetOptions( - "cimeroot=s" => \$opts{'cimeroot'}, - "clm_demand=s" => \$opts{'clm_demand'}, - "co2_ppmv=f" => \$opts{'co2_ppmv'}, - "co2_type=s" => \$opts{'co2_type'}, - "config=s" => \$opts{'config'}, - "csmdata=s" => \$opts{'csmdata'}, - "clm_usr_name=s" => \$opts{'clm_usr_name'}, - "envxml_dir=s" => \$opts{'envxml_dir'}, - "drydep!" => \$opts{'drydep'}, - "fire_emis!" => \$opts{'fire_emis'}, - "ignore_warnings!" => \$opts{'ignore_warnings'}, - "chk_res!" => \$opts{'chk_res'}, - "note!" => \$opts{'note'}, - "megan!" => \$opts{'megan'}, - "glc_nec=i" => \$opts{'glc_nec'}, - "light_res=s" => \$opts{'light_res'}, - "irrig=s" => \$opts{'irrig'}, - "d:s" => \$opts{'dir'}, - "h|help" => \$opts{'help'}, - "ignore_ic_date" => \$opts{'ignore_ic_date'}, - "ignore_ic_year" => \$opts{'ignore_ic_year'}, - "infile=s" => \$opts{'infile'}, - "lnd_frac=s" => \$opts{'lnd_frac'}, - "lnd_tuning_mode=s" => \$opts{'lnd_tuning_mode'}, - "l_ncpl=i" => \$opts{'l_ncpl'}, - "inputdata=s" => \$opts{'inputdata'}, - "mask=s" => \$opts{'mask'}, - "namelist=s" => \$opts{'namelist'}, - "res=s" => \$opts{'res'}, - "rcp=s" => \$opts{'rcp'}, - "s|silent" => \$opts{'silent'}, - "sim_year=s" => \$opts{'sim_year'}, - "output_reals=s" => \$opts{'output_reals_filename'}, - "clm_accelerated_spinup=s" => \$opts{'clm_accelerated_spinup'}, - "clm_start_type=s" => \$opts{'clm_start_type'}, - "test" => \$opts{'test'}, - "use_case=s" => \$opts{'use_case'}, - "bgc=s" => \$opts{'bgc'}, - "crop!" => \$opts{'crop'}, - "dynamic_vegetation" => \$opts{'dynamic_vegetation'}, - "vichydro" => \$opts{'vichydro'}, - "maxpft=i" => \$opts{'maxpft'}, - "v|verbose" => \$opts{'verbose'}, - "version" => \$opts{'version'}, - ) or usage(); - - # Give usage message. - usage() if $opts{'help'}; - - # Check for unparsed arguments - if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); - } - return %opts; -} - -#------------------------------------------------------------------------------- - -sub check_for_perl_utils { - - my $cfgdir = shift; - my $opts_ref = shift; - - # Determine CIME root directory and perl5lib root directory - my $cimeroot = $opts_ref->{'cimeroot'}; - if ( ! defined($cimeroot) ) { - $cimeroot = "$cfgdir/../cime"; - if ( -d $cimeroot ) { - } elsif ( -d "$cfgdir/../../../cime" ) { - $cimeroot = "$cfgdir/../../../cime"; - } else { - die <<"EOF"; -** Cannot find the root of the cime directory enter it using the -cimeroot option - Did you run the checkout_externals scripts? -EOF - } - } - - my $perl5lib_dir = "$cimeroot/utils/perl5lib"; - - #----------------------------------------------------------------------------- - # Add $perl5lib_dir to the list of paths that Perl searches for modules - my @dirs = ( $ProgDir, $cfgdir, "$perl5lib_dir"); - unshift @INC, @dirs; - - require config_files::clm_phys_vers; - require namelist_files::LogMessages; - - my $locallog = namelist_files::LogMessages->new( $ProgName, $opts_ref ); - # The XML::Lite module is required to parse the XML files. - (-f "$perl5lib_dir/XML/Lite.pm") or - $locallog->fatal_error("Cannot find perl module \"XML/Lite.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::Config module provides utilities to access the configuration information - # in the config_cache.xml file - (-f "$perl5lib_dir/Build/Config.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/Config.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::NamelistDefinition module provides utilities to validate that the output - # namelists are consistent with the namelist definition file - (-f "$perl5lib_dir/Build/NamelistDefinition.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/NamelistDefinition.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::NamelistDefaults module provides a utility to obtain default values of namelist - # variables based on finding a best fit with the attributes specified in the defaults file. - (-f "$perl5lib_dir/Build/NamelistDefaults.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/NamelistDefaults.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::Namelist module provides utilities to parse input namelists, to query and modify - # namelists, and to write output namelists. - (-f "$perl5lib_dir/Build/Namelist.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/Namelist.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - - # required cesm perl modules - require XML::Lite; - require Build::Config; - require Build::NamelistDefinition; - require Build::NamelistDefaults; - require Build::Namelist; - require Config::SetupTools; -} - -#------------------------------------------------------------------------------- - -sub read_configure_definition { - # Read the configure definition and specific config_cache file for this case - # configure are the build-time settings for CLM - my ($cfgdir, $opts) = @_; - - $log->verbose_message("Setting CLM configuration script directory to $cfgdir"); - - # Create a configuration object from the default config_definition file - my $configfile; - if ( -f $opts->{'config'} ) { - $configfile = $opts->{'config'}; - } else { - $configfile = "$cfgdir/config_files/config_definition.xml"; - } - - # Check that configuration cache file exists. - $log->verbose_message("Using CLM configuration cache file $opts->{'config'}"); - if ( $configfile ne $opts->{'config'} ) { - $log->fatal_error("Cannot find configuration cache file: \"$opts->{'config'}\""); - } - - my $cfg = Build::Config->new("$configfile"); - - return $cfg; -} - -#----------------------------------------------------------------------------------------------- - -sub read_namelist_definition { - my ($cfgdir, $opts, $nl_flags, $physv) = @_; - - # The namelist definition file contains entries for all namelist - # variables that can be output by build-namelist. - my $phys = $physv->as_filename( ); - my @nl_definition_files = ( "$cfgdir/namelist_files/namelist_definition_drv.xml", - "$cfgdir/namelist_files/namelist_definition_drv_flds.xml", - "$cfgdir/namelist_files/namelist_definition_$phys.xml" ); - foreach my $nl_defin_file ( @nl_definition_files ) { - (-f "$nl_defin_file") or $log->fatal_error("Cannot find namelist definition file \"$nl_defin_file\""); - - $log->verbose_message("Using namelist definition file $nl_defin_file"); - } - - # Create a namelist definition object. This object provides a - # method for verifying that the output namelist variables are in the - # definition file, and are output in the correct namelist groups. - my $definition = Build::NamelistDefinition->new( shift(@nl_definition_files) ); - foreach my $nl_defin_file ( @nl_definition_files ) { - $definition->add( "$nl_defin_file" ); - } - - return $definition; -} - -#----------------------------------------------------------------------------------------------- - -sub read_envxml_case_files { - # read the contents of the env*.xml files in the case directory - my ($opts) = @_; - - my %envxml = (); - if ( defined($opts->{'envxml_dir'}) ) { - (-d $opts->{'envxml_dir'}) or $log->fatal_error( "envxml_dir is not a directory" ); - my @files = glob( $opts->{'envxml_dir'}."/env_*xml" ); - ($#files >= 0) or $log->fatal_error( "there are no env_*xml files in the envxml_dir" ); - foreach my $file (@files) { - $log->verbose_message( "Open env.xml file: $file" ); - my $xml = XML::Lite->new( "$file" ); - my @e = $xml->elements_by_name('entry'); - while ( my $e = shift @e ) { - my %a = $e->get_attributes(); - $envxml{$a{'id'}} = $a{'value'}; - } - } - foreach my $attr (keys %envxml) { - if ( $envxml{$attr} =~ m/\$/ ) { - $envxml{$attr} = SetupTools::expand_xml_var( $envxml{$attr}, \%envxml ); - } - } - } else { - $log->fatal_error( "The -envxml_dir option was NOT given and it is a REQUIRED option" ); - } - return( %envxml ); -} - -#----------------------------------------------------------------------------------------------- - -sub read_namelist_defaults { - my ($cfgdir, $opts, $nl_flags, $cfg, $physv) = @_; - - my $phys = $physv->as_filename( ); - # The namelist defaults file contains default values for all required namelist variables. - my @nl_defaults_files = ( "$cfgdir/namelist_files/namelist_defaults_overall.xml", - "$cfgdir/namelist_files/namelist_defaults_$phys.xml", - "$cfgdir/namelist_files/namelist_defaults_drv.xml", - "$cfgdir/namelist_files/namelist_defaults_fire_emis.xml", - "$cfgdir/namelist_files/namelist_defaults_drydep.xml" ); - - # Add the location of the use case defaults files to the options hash - $opts->{'use_case_dir'} = "$cfgdir/namelist_files/use_cases"; - - if (defined $opts->{'use_case'}) { - if ( $opts->{'use_case'} ne "list" ) { - unshift( @nl_defaults_files, "$opts->{'use_case_dir'}/$opts->{'use_case'}.xml" ); - } - } - - foreach my $nl_defaults_file ( @nl_defaults_files ) { - (-f "$nl_defaults_file") or $log->fatal_error("Cannot find namelist defaults file \"$nl_defaults_file\""); - - $log->verbose_message("Using namelist defaults file $nl_defaults_file"); - } - - # Create a namelist defaults object. This object provides default - # values for variables contained in the input defaults file. The - # configuration object provides attribute values that are relevent - # for the CLM executable for which the namelist is being produced. - my $defaults = Build::NamelistDefaults->new( shift( @nl_defaults_files ), $cfg); - foreach my $nl_defaults_file ( @nl_defaults_files ) { - $defaults->add( "$nl_defaults_file" ); - } - return $defaults; -} - -#------------------------------------------------------------------------------- - -sub check_cesm_inputdata { - # Check that the CESM inputdata root directory has been specified. This must be - # a local or nfs mounted directory. - - my ($opts, $nl_flags) = @_; - - $nl_flags->{'inputdata_rootdir'} = undef; - if (defined($opts->{'csmdata'})) { - $nl_flags->{'inputdata_rootdir'} = $opts->{'csmdata'}; - } - elsif (defined $ENV{'CSMDATA'}) { - $nl_flags->{'inputdata_rootdir'} = $ENV{'CSMDATA'}; - } - else { - $log->fatal_error("CESM inputdata root directory must be specified by either -csmdata\n" . - "argument or by the CSMDATA environment variable."); - } - if ( ! defined($ENV{'DIN_LOC_ROOT'}) ) { - $ENV{'DIN_LOC_ROOT'} = $nl_flags->{'inputdata_rootdir'}; - } - - if ($opts->{'test'}) { - (-d $nl_flags->{'inputdata_rootdir'}) or $log->fatal_error("CESM inputdata root is not a directory: \"$nl_flags->{'inputdata_rootdir'}\""); - } - - $log->verbose_message("CESM inputdata root directory: $nl_flags->{'inputdata_rootdir'}"); -} - -#------------------------------------------------------------------------------- - -sub process_namelist_user_input { - # Process the user input in general by order of precedence. At each point - # we'll only add new values to the namelist and not overwrite - # previously specified specified values which have higher - # precedence. The one exception to this rule are the specifc command-line - # options which are done last as if the user contradicts these settings - # CLM build-namelist will abort with an error. - # - # 1. values set on the command-line using the -namelist option, - # (i.e. CLM_NAMELIST_OPTS env_run variable) - # 2. values read from the file(s) specified by -infile, - # (i.e. user_nl_clm files) - # After the above are done the command line options are processed and they - # are made sure the user hasn't contradicted any of their settings with - # anything above. Because of this they are condsidered to have the highest - # precedence. - # 0. namelist values set by specific command-line options, like, -d, -sim_year - # (i.e. CLM_BLDNML_OPTS env_run variable) - # The results of these are needed for the final two user input - # 3. datasets from the -clm_usr_name option, - # (i.e. CLM_USRDAT_NAME env_run variable) - # 4. values set from a use-case scenario, e.g., -use_case - # (i.e. CLM_NML_USE_CASE env_run variable) - # - # Finally after all the above is done, the defaults are found from the - # namelist defaults file (outside of this routine). - # - - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv) = @_; - - # Get the inputs that will be coming from the user... - process_namelist_commandline_namelist($opts, $definition, $nl, $envxml_ref); - process_namelist_commandline_infile($opts, $definition, $nl, $envxml_ref); - - # Apply the commandline options and make sure the user didn't change it above - process_namelist_commandline_options($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - - # The last two process command line arguments for usr_name and use_case - # They require that process_namelist_commandline_options was called before this - process_namelist_commandline_clm_usr_name($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref); - process_namelist_commandline_use_case($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv); - - # Set the start_type by the command line setting for clm_start_type - process_namelist_commandline_clm_start_type($opts, $nl_flags, $definition, $defaults, $nl); - -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_options { - # First process the commandline args that provide specific namelist values. - # - # First get the command-line specified overall values or their defaults - # Obtain default values for the following build-namelist input arguments - # : res, mask, rcp, sim_year, sim_year_range, and clm_accelerated_spinup. - # - # NOTE: cfg only needs to be passed to functions that work with - # clm4_0 compile time functionality! - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - setup_cmdl_chk_res($opts, $defaults); - setup_cmdl_resolution($opts, $nl_flags, $definition, $defaults); - setup_cmdl_mask($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_bgc($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_fire_light_res($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_spinup($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_crop($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_maxpft($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_glc_nec($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_irrigation($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_cmdl_rcp($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_simulation_year($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_dynamic_vegetation($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_cmdl_fates_mode($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_cmdl_vichydro($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_cmdl_run_type($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_output_reals($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_lnd_tuning($opts, $nl_flags, $definition, $defaults, $nl, $physv); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_chk_res { - my ($opts, $defaults) = @_; - - my $var = "chk_res"; - if ( ! defined($opts->{$var}) ) { - $opts->{$var} = $defaults->get_value($var); - } -} - -sub setup_cmdl_resolution { - my ($opts, $nl_flags, $definition, $defaults) = @_; - - my $var = "res"; - my $val; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val= $defaults->get_value($var); - } - - $nl_flags->{'res'} = $val; - $log->verbose_message("CLM atm resolution is $nl_flags->{'res'}"); - $opts->{$var} = $val; - if ( $opts->{'chk_res'} ) { - $val = "e_string( $nl_flags->{'res'} ); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - if ( ! defined($opts->{'clm_usr_name'}) || $nl_flags->{'res'} ne $opts->{'clm_usr_name'} ) { - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_mask { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $var = "mask"; - my $val; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - my %tmp = ( 'hgrid'=>$nl_flags->{'res'} ); - $val = $defaults->get_value($var, \%tmp ); - } - - $nl_flags->{'mask'} = $val; - $opts->{'mask'} = $nl_flags->{'mask'}; - if ( $opts->{'chk_res'} ) { - $val = "e_string( $val ); - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - $log->verbose_message("CLM land mask is $nl_flags->{'mask'}"); -} - -#------------------------------------------------------------------------------- -sub setup_cmdl_fates_mode { - # - # call this at least after crop check is called - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $val; - my $var = "bgc_mode"; - - if ( $physv->as_long() == $physv->as_long("clm4_0") || $nl_flags->{'crop'} eq "on" ) { - if ( $nl_flags->{$var} eq "fates" ) { - # ED is not a clm4_0 option and should not be used with crop and not with clm4_0 - $log->fatal_error("** Cannot turn fates mode on with crop or with clm4_0 physics." ); - } - } elsif ($nl_flags->{"bgc_mode"} eq "fates" && ! &value_is_true($nl_flags->{"use_fates"}) ) { - $log->fatal_error("DEV_ERROR: internal logic error: bgc_mode = fates and use_fates = false."); - - } else { - - $var = "use_fates"; - if ( &value_is_true($nl_flags->{$var}) ) { - # This section is a place-holder to test for modules that are not allowed with ED - # the defaults which are set in the logic section of the namelist builder will - # automatically set these correctly (well that is the assumption), but here we - # want to set a catch to fail and warn users if they explicitly set incompatible user namelist - # options - -# my $var = "use_somevar"; -# $val = $nl_flags->{$var}; -# if ( defined($nl->get_value($var)) ) { -# if ( &value_is_true($nl->get_value($var)) ) { -# $log->fatal_error("$var was set to .true., which is incompatible when -bgc fates option is used."); -# } -# } - - - # The following variables may be set by the user and are compatible with use_fates - # no need to set defaults, covered in a different routine - my @list = ( "use_vertsoilc", "use_century_decomp", "use_lch4" ); - foreach my $var ( @list ) { - if ( defined($nl->get_value($var)) ) { - $nl_flags->{$var} = $nl->get_value($var); - $val = $nl_flags->{$var}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - } - } else { - # dis-allow fates specific namelist items with non-fates runs - my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", - "use_fates_inventory_init", "fates_inventory_ctrl_filename","use_fates_logging" ); - foreach my $var ( @list ) { - if ( defined($nl->get_value($var)) ) { - $log->fatal_error("$var is being set, but can ONLY be set when -bgc fates option is used.\n"); - } - } - } - } -} - -#------------------------------------------------------------------------------- -sub setup_cmdl_bgc { - # BGC - alias for group of biogeochemistry related use_XXX namelists - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $val; - my $var = "bgc"; - - $val = $opts->{$var}; - $nl_flags->{'bgc_mode'} = $val; - - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - if ( $nl_flags->{'bgc_mode'} ne "default" ) { - $log->fatal_error("-bgc option used with clm4_0 physics. -bgc can ONLY be used with clm4_5/clm5_0 physics"); - } - $nl_flags->{'bgc_mode'} = $cfg->get($var); - } else { - my $var = "bgc_mode"; - if ( $nl_flags->{$var} eq "default" ) { - $nl_flags->{$var} = $defaults->get_value($var); - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string( $nl_flags->{$var} ) ); - if ( ! $definition->is_valid_value( $var, quote_string( $nl_flags->{$var}) ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for bgc."); - - # now set the actual name list variables based on the bgc alias - if ($nl_flags->{$var} eq "cn" ) { - $nl_flags->{'use_cn'} = ".true."; - $nl_flags->{'use_fates'} = ".false."; - } elsif ($nl_flags->{$var} eq "bgc" ) { - $nl_flags->{'use_cn'} = ".true."; - $nl_flags->{'use_fates'} = ".false."; - } elsif ($nl_flags->{$var} eq "fates" ) { - $nl_flags->{'use_cn'} = ".false."; - $nl_flags->{'use_fates'} = ".true."; - } else { - $nl_flags->{'use_cn'} = ".false."; - $nl_flags->{'use_fates'} = ".false."; - } - if ( defined($nl->get_value("use_cn")) && ($nl_flags->{'use_cn'} ne $nl->get_value("use_cn")) ) { - $log->fatal_error("The namelist variable use_cn is inconsistent with the -bgc option"); - } - if ( defined($nl->get_value("use_fates")) && ($nl_flags->{'use_fates'} ne $nl->get_value("use_fates")) ) { - $log->fatal_error("The namelist variable use_fates is inconsistent with the -bgc option"); - } - - { - # If the variable has already been set use it, if not set to the value defined by the bgc_mode - my @list = ( "use_lch4", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp" ); - my $ndiff = 0; - my %settings = ( 'bgc_mode'=>$nl_flags->{'bgc_mode'} ); - foreach my $var ( @list ) { - my $default_setting = $defaults->get_value($var, \%settings ); - if ( ! defined($nl->get_value($var)) ) { - $nl_flags->{$var} = $default_setting; - } else { - if ( $nl->get_value($var) ne $default_setting ) { - $ndiff += 1; - } - $nl_flags->{$var} = $nl->get_value($var); - } - $val = $nl_flags->{$var}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - # If all the variables are different report it as an error - if ( $ndiff == ($#list + 1) ) { - $log->fatal_error("You are contradicting the -bgc setting with the namelist variables: @list" ); - } - } - - # Now set use_cn and use_fates - foreach $var ( "use_cn", "use_fates" ) { - $val = $nl_flags->{$var}; - $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - } - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - my $var = "use_fun"; - if ( ! defined($nl->get_value($var)) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, - 'use_nitrif_denitrif'=>$nl_flags->{'use_nitrif_denitrif'} ); - } - if ( (! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) && &value_is_true($nl->get_value('use_fun')) ) { - $log->fatal_error("When FUN is on, use_nitrif_denitrif MUST also be on!"); - } - } -} # end bgc - - -#------------------------------------------------------------------------------- -sub setup_cmdl_fire_light_res { - # light_res - alias for lightning resolution - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $var = "light_res"; - my $val = $opts->{$var}; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - if ( $val !~ /default|none/ ) { - $log->fatal_error("-$var option used with clm4_0 physics. -$var can ONLY be used with clm4_5/clm5_0 physics"); - } - } else { - if ( $val eq "default" ) { - $nl_flags->{$var} = remove_leading_and_trailing_quotes($defaults->get_value($var)); - } else { - my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); - if ( defined($fire_method) && $val ne "none" ) { - if ( $fire_method eq "nofire" ) { - $log->fatal_error("-$var option used with fire_method='nofire'. -$var can ONLY be used without the nofire option"); - } - } - my $stream_fldfilename_lightng = remove_leading_and_trailing_quotes( $nl->get_value('stream_fldfilename_lightng') ); - if ( defined($stream_fldfilename_lightng) && $val ne "none" ) { - $log->fatal_error("-$var option used while also explicitly setting stream_fldfilename_lightng filename which is a contradiction. Use one or the other not both."); - } - if ( ! &value_is_true($nl->get_value('use_cn')) ) { - $log->fatal_error("-$var option used CN is NOT on. -$var can only be used when CN is on (with bgc: cn or bgc)"); - } - if ( &value_is_true($nl->get_value('use_cn')) && $val eq "none" ) { - $log->fatal_error("-$var option is set to none, but CN is on (with bgc: cn or bgc) which is a contradiction"); - } - $nl_flags->{$var} = $val; - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string($nl_flags->{$var}) ); - if ( ! $definition->is_valid_value( $var, $nl_flags->{$var}, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for $var."); - # - # Set flag if cn-fires are on or not - # - $var = "cnfireson"; - if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_method'); - } - my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); - if ( defined($fire_method) && ! &value_is_true($nl_flags->{'use_cn'}) ) { - $log->fatal_error("fire_method is being set even though bgc is NOT cn or bgc."); - } - if ( defined($fire_method) && $fire_method eq "nofire" ) { - $nl_flags->{$var} = ".false."; - } elsif ( &value_is_true($nl->get_value('use_cn')) ) { - $nl_flags->{$var} = ".true."; - } else { - $nl_flags->{$var} = ".false."; - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_crop { - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - $nl_flags->{'use_crop'} = ".false."; - my $val; - my $var = "crop"; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - $nl_flags->{'crop'} = $cfg->get($var); - if ( $nl_flags->{'crop'} eq "on" ) { - $nl_flags->{'use_crop'} = ".true."; - } - } else { - $val = $opts->{$var}; - $nl_flags->{'crop'} = $val; - if ( $nl_flags->{'crop'} eq 1 ) { - $nl_flags->{'use_crop'} = ".true."; - } - if ( defined($nl->get_value("use_crop")) && ($nl_flags->{'use_crop'} ne $nl->get_value("use_crop")) ) { - $log->fatal_error("Namelist item use_crop contradicts the command-line option -crop, use the command line option"); - } - if ( ($nl_flags->{'crop'} eq 1 ) && ($nl_flags->{'bgc_mode'} eq "sp") ) { - $log->fatal_error("** Cannot turn crop mode on mode bgc=sp\n" . - "**\n" . - "** Set the bgc mode to 'cn' or 'bgc' by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -bgc cn\n" . - "** * by a default configuration file, specified by -defaults"); - } - - $var = "use_crop"; - $val = ".false."; - if ($nl_flags->{'crop'} eq 1) { - $val = ".true."; - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_maxpft { - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $val; - my $var = "maxpft"; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - $nl_flags->{'maxpft'} = $cfg->get($var); - # NOTE: maxpatchpft sizes already checked for clm4_0 by configure. - } else { - my %maxpatchpft; - $maxpatchpft{'.true.'} = 79; - $maxpatchpft{'.false.'} = 17; - if ( $opts->{$var} ne "default") { - $val = $opts->{$var}; - } else { - $val = $maxpatchpft{$nl_flags->{'use_crop'}}; - } - $nl_flags->{'maxpft'} = $val; - - if ( ($nl_flags->{'bgc_mode'} ne "sp") && ($nl_flags->{'maxpft'} != $maxpatchpft{$nl_flags->{'use_crop'}}) ) { - $log->fatal_error("** For CN or BGC mode you MUST set max patch PFT's to $maxpatchpft{$nl_flags->{'use_crop'}}\n" . - "**\n" . - "** When the crop model is on then it must be set to $maxpatchpft{'crop'} otherwise to $maxpatchpft{'nocrop'}\n" . - "** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -bgc, -crop and -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } - if ( $nl_flags->{'maxpft'} > $maxpatchpft{$nl_flags->{'use_crop'}} ) { - $log->fatal_error("** Max patch PFT's can NOT exceed $maxpatchpft{$nl_flags->{'use_crop'}}\n" . - "**\n" . - "** Set maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } - if ( $nl_flags->{'maxpft'} != $maxpatchpft{$nl_flags->{'use_crop'}} ) { - $log->warning("running with maxpft NOT equal to $maxpatchpft{$nl_flags->{'use_crop'}} is " . - "NOT validated / scientifically supported." ); - } - $log->verbose_message("Using $nl_flags->{'maxpft'} for maxpft."); - - $var = "maxpatch_pft"; - $val = $nl_flags->{'maxpft'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_glc_nec { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "glc_nec"; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - - $nl_flags->{'glc_nec'} = $val; - $opts->{'glc_nec'} = $val; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Glacier number of elevation classes is $val"); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_irrigation { - # Must be after setup_cmdl_crop - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = "irrig"; - - if ( $opts->{$var} eq "default" ) { - my %settings; - $settings{'use_crop'} = $nl_flags->{'use_crop'}; - $nl_flags->{$var} = $defaults->get_value($var, \%settings); - } else { - $nl_flags->{$var} = $opts->{$var}; - } - my $val = $nl_flags->{$var}; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Irrigation $val"); - if ( &value_is_true($nl_flags->{'irrig'}) && &value_is_true($nl_flags->{'use_crop'}) ) { - $log->fatal_error("You've turned on both irrigation and crop.\n" . - "Irrigation is only applied to generic crop currently,\n" . - "which negates it's practical usage.\n." . - "We also have a known problem when both are on " . - "(see bug 1326 in the components/clm/doc/KnownBugs file)\n" . - "both irrigation and crop can NOT be on."); - } - } elsif ( $opts->{$var} ne "default" ) { - $log->fatal_error("The -irrig option can ONLY be used with clm4_0 physics"); - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_rcp { - # representative concentration pathway - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "rcp"; - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - $nl_flags->{'rcp'} = $val; - $opts->{'rcp'} = $nl_flags->{'rcp'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("CLM future scenario representative concentration is $nl_flags->{'rcp'}"); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_spinup { - # CLM 4.0 --> BGC spinup mode controlled from "spinup" in configure - # CLM 4.5/5.0 --> BGC spinup mode controlled from "clm_accelerated_spinup" in build-namelist - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $val; - my $var; - $nl_flags->{'spinup'} = undef; - $var = "clm_accelerated_spinup"; - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - $nl_flags->{$var} = $val; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string($val) ); - if ( ! $definition->is_valid_value( $var, $val , 'noquotes' => 1) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has an invalid value ($val). Valid values are: @valid_values"); - } - $log->verbose_message("CLM accelerated spinup mode is $val"); - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - $nl_flags->{'spinup'} = $cfg->get('spinup'); - } elsif ( $physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, - $defaults, $nl, "spinup_state", clm_accelerated_spinup=>$nl_flags->{$var}, - use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'} ); - if ( $nl->get_value("spinup_state") ne 0 ) { - $nl_flags->{'bgc_spinup'} = "on"; - if ( $nl_flags->{'bgc_mode'} eq "sp" ) { - $log->fatal_error("spinup_state is accelerated (=1 or 2) which is for a BGC mode of CN or BGC," . - " but the BGC mode is Satellite Phenology, change one or the other"); - } - if ( $nl_flags->{'clm_accelerated_spinup'} eq "off" ) { - $log->fatal_error("spinup_state is accelerated, but clm_accelerated_spinup is off, change one or the other"); - } - } else { - $nl_flags->{'bgc_spinup'} = "off"; - $val = $defaults->get_value($var); - } - $nl_flags->{$var} = $val; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string($val) ); - if ( ! $definition->is_valid_value( $var, $val , 'noquotes' => 1) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has an invalid value ($val). Valid values are: @valid_values"); - } - if ( $nl_flags->{'bgc_spinup'} eq "on" && (not &value_is_true( $nl_flags->{'use_cn'} )) && (not &value_is_true($nl_flags->{'use_fates'})) ) { - $log->fatal_error("$var can not be '$nl_flags->{'bgc_spinup'}' if neither CN nor ED is turned on (use_cn=$nl_flags->{'use_cn'}, use_fates=$nl_flags->{'use_fates'})."); - } - if ( $nl->get_value("spinup_state") eq 0 && $nl_flags->{'bgc_spinup'} eq "on" ) { - $log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" ); - } - if ( $nl->get_value("spinup_state") eq 1 && $nl_flags->{'bgc_spinup'} eq "off" ) { - $log->fatal_error("Namelist spinup_state contradicts the command line option bgc_spinup" ); - } - } - - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - $val = $nl_flags->{'spinup'}; - } else { - $val = $nl_flags->{'bgc_spinup'}; - } - $log->verbose_message("CLM CN bgc_spinup mode is $val"); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_simulation_year { - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg) = @_; - - my $val; - my $var = "sim_year"; - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - - $nl_flags->{'sim_year_range'} = $defaults->get_value("sim_year_range"); - $nl_flags->{'sim_year'} = $val; - if ( $val =~ /([0-9]+)-([0-9]+)/ ) { - $nl_flags->{'sim_year'} = $1; - $nl_flags->{'sim_year_range'} = $val; - } - $val = $nl_flags->{'sim_year'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val ); - if ( ! $definition->is_valid_value( $var, $val, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var of $val is NOT valid. Valid values are: @valid_values"); - } - $nl->set_variable_value($group, $var, $val ); - $log->verbose_message("CLM sim_year is $nl_flags->{'sim_year'}"); - - $var = "sim_year_range"; - $val = $nl_flags->{'sim_year_range'}; - if ( $val ne "constant" ) { - $opts->{$var} = $val; - $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val ); - if ( ! $definition->is_valid_value( $var, $val, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var of $val is NOT valid. Valid values are: @valid_values"); - } - $val = "'".$defaults->get_value($var)."'"; - $nl->set_variable_value($group, $var, $val ); - $log->verbose_message("CLM sim_year_range is $nl_flags->{'sim_year_range'}"); - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_run_type { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "clm_start_type"; - if (defined $opts->{$var}) { - if ($opts->{$var} eq "default" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'} ); - } else { - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'use_fates'=>$nl_flags->{'use_fates'} ); - } - $nl_flags->{'clm_start_type'} = $nl->get_value($var); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_dynamic_vegetation { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $val; - my $var = "dynamic_vegetation"; - $val = $opts->{$var}; - $nl_flags->{'dynamic_vegetation'} = $val; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - # not applicable - if ( $nl_flags->{'dynamic_vegetation'}eq 1) { - $log->fatal_error("** Turn dynamic_vegetation mode on with CLM_CONFIG_OPTS (-bgc cndv) for clm4_0 physics." ); - } - } else { - if ( ($nl_flags->{'dynamic_vegetation'} eq 1 ) && ($nl_flags->{'bgc_mode'} eq "sp") ) { - $log->fatal_error("** Cannot turn dynamic_vegetation mode on with bgc=sp.\n" . - "**\n" . - "** Set the bgc mode to 'cn' or 'bgc' by the following means from highest to lowest precedence:" . - "** * by the command-line options -bgc cn\n"); - } - - $var = "use_cndv"; - $nl_flags->{$var} = ".false."; - if ($nl_flags->{'dynamic_vegetation'} eq 1) { - $val = ".true."; - $nl_flags->{$var} = $val; - } - if ( defined($nl->get_value($var)) && $nl->get_value($var) ne $val ) { - $log->fatal_error("$var is inconsistent with the commandline setting of -dynamic_vegetation"); - } - if ( &value_is_true($nl_flags->{$var}) ) { - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - } -} -#------------------------------------------------------------------------------- - -sub setup_cmdl_output_reals { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = "output_reals_filename"; - my $file = $opts->{$var}; - if ( defined($file) ) { - # Make sure can open file and if not die with an error - my $fh = IO::File->new($file, '>') or $log->fatal_error("can't create real parameter filename: $file"); - $fh->close(); - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_vichydro { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $val; - my $var = "vichydro"; - $val = $opts->{$var}; - $nl_flags->{'vichydro'} = $val; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - # not relevant in clm4_0 - if ( $nl_flags->{'vichydro'}eq 1) { - $log->fatal_error("** Cannot turn vichydro on with clm4_0 physics." ); - } - } else { - if ($nl_flags->{'vichydro'} eq 1) { - $log->verbose_message("Using VIC hydrology for runoff calculations."); - } - - $var = "use_vichydro"; - $val = $nl->get_value($var); - if ($nl_flags->{'vichydro'} eq 1) { - my $group = $definition->get_group_name($var); - my $set = ".true."; - if ( defined($val) && $set ne $val ) { - $log->fatal_error("$var contradicts the command-line -vichydro option" ); - } - $nl->set_variable_value($group, $var, $set); - if ( ! $definition->is_valid_value($var, $val) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - } -} - - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_namelist { - # Process the commandline '-namelist' arg. - my ($opts, $definition, $nl, $envxml_ref) = @_; - - if (defined $opts->{'namelist'}) { - # Parse commandline namelist - my $nl_arg = Build::Namelist->new($opts->{'namelist'}); - - # Validate input namelist -- trap exceptions - my $nl_arg_valid; - eval { $nl_arg_valid = $definition->validate($nl_arg); }; - if ($@) { - $log->fatal_error("Invalid namelist variable in commandline arg '-namelist'.\n $@"); - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_arg_valid, $envxml_ref ); - - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_arg_valid); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_infile { - # Process the commandline '-infile' arg. - my ($opts, $definition, $nl, $envxml_ref) = @_; - - if (defined $opts->{'infile'}) { - my @infiles = split( /,/, $opts->{'infile'} ); - foreach my $infile ( @infiles ) { - # Make sure a valid file was found - if ( -f "$infile" ) { - # Otherwise abort as a valid file doesn't exist - } else { - $log->fatal_error("input namelist file does NOT exist $infile.\n $@"); - } - # Parse namelist input from the next file - my $nl_infile = Build::Namelist->new($infile); - - # Validate input namelist -- trap exceptions - my $nl_infile_valid; - eval { $nl_infile_valid = $definition->validate($nl_infile); }; - if ($@) { - $log->fatal_error("Invalid namelist variable in '-infile' $infile.\n $@"); - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_infile_valid, $envxml_ref ); - - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_infile_valid); - } - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_clm_usr_name { - # Process the -clm_usr_name argument - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref) = @_; - - if (defined $opts->{'clm_usr_name'}) { - # The user files definition is contained in an xml file with the same format as the defaults file. - - # The one difference is that variables are expanded. - # Create a new NamelistDefaults object. - my $nl_defaults_file = "$nl_flags->{'cfgdir'}/namelist_files/namelist_defaults_usr_files.xml"; - my $uf_defaults = Build::NamelistDefaults->new("$nl_defaults_file", $cfg ); - # Loop over the variables specified in the user files - # Add each one to the namelist. - my @vars = $uf_defaults->get_variable_names(); - my %settings; - $settings{'mask'} = $nl_flags->{'mask'}; - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; - $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; - $settings{'clm_accelerated_spinup'} = $nl_flags->{'clm_accelerated_spinup'}; - $settings{'clm_usr_name'} = $opts->{'clm_usr_name'}; - - if ( $nl_flags->{'inputdata_rootdir'} eq "\$DIN_LOC_ROOT" ) { - $settings{'csmdata'} = $ENV{'DIN_LOC_ROOT'}; - } else { - $settings{'csmdata'} = $nl_flags->{'inputdata_rootdir'}; - } - - my $nvars = 0; - my $nl_usrfile = Build::Namelist->new(); - foreach my $var (@vars) { - my $val = $uf_defaults->get_usr_file($var, $definition, \%settings); - - if ($val) { - $log->message("adding clm user file defaults for var $var with val $val"); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl_usrfile, $var, 'val'=>$val); - $nvars++; - } - } - if ( $nvars == 0 ) { - $log->message("setting clm_usr_name -- but did NOT find any user datasets: $opts->{'clm_usr_name'}", $opts); - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_usrfile, $envxml_ref ); - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_usrfile); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_use_case { - # Now process the -use_case arg. - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv) = @_; - - if (defined $opts->{'use_case'}) { - - # The use case definition is contained in an xml file with the same format as the defaults file. - # Create a new NamelistDefaults object. - my $uc_defaults = Build::NamelistDefaults->new("$opts->{'use_case_dir'}/$opts->{'use_case'}.xml", $cfg); - - my %settings; - $settings{'res'} = $nl_flags->{'res'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; - $settings{'mask'} = $nl_flags->{'mask'}; - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; - $settings{'phys'} = $nl_flags->{'phys'}; - $settings{'lnd_tuning_mode'}= $nl_flags->{'lnd_tuning_mode'}; - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - $settings{'use_cn'} = $nl_flags->{'use_cn'}; - $settings{'use_cndv'} = $nl_flags->{'use_cndv'}; - $settings{'use_crop'} = $nl_flags->{'use_crop'}; - $settings{'cnfireson'} = $nl_flags->{'cnfireson'}; - } else { - $settings{'bgc'} = $nl_flags->{'bgc_mode'}; - } - # Loop over the variables specified in the use case. - # Add each one to the namelist. - my @vars = $uc_defaults->get_variable_names(); - my $nl_usecase = Build::Namelist->new(); - foreach my $var (@vars) { - my $val = $uc_defaults->get_value($var, \%settings ); - - if ( defined($val) ) { - $log->message("CLM adding use_case $opts->{'use_case'} defaults for var '$var' with val '$val'"); - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl_usecase, $var, 'val'=>$val); - } - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_usecase, $envxml_ref ); - - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_usecase); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_clm_start_type { - # Set the start_type according to the command line clm_start_type option - - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - # Run type for driver namelist - note that arb_ic implies that the run is startup - my $var = "start_type"; - if ($nl_flags->{'clm_start_type'} eq "'cold'" || $nl_flags->{'clm_start_type'} eq "'arb_ic'") { - # Add default is used here, but the value is explicitly set - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>'startup' ); - } else { - # Add default is used here, but the value is explicitly set - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$nl_flags->{'clm_start_type'} ); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_inline_logic { - # Use the namelist default object to add default values for required - # namelist variables that have not been previously set. - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv) = @_; - - - ############################## - # namelist group: clm_inparm # - ############################## - setup_logic_site_specific($nl_flags, $definition, $nl, $physv); - setup_logic_lnd_frac($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref); - setup_logic_co2_type($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_irrigate($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_start_type($opts, $nl_flags, $nl); - setup_logic_delta_time($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_decomp_performance($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_snow($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_glacier($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref, $physv); - setup_logic_dynamic_plant_nitrogen_alloc($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_luna($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_hydrstress($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_dynamic_roots($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_params_file($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_create_crop_landunit($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_subgrid($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_fertilizer($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_grainproduct($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_soilstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_demand($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_surface_dataset($opts, $nl_flags, $definition, $defaults, $nl, $physv); - if ( remove_leading_and_trailing_quotes($nl_flags->{'clm_start_type'}) ne "branch" ) { - setup_logic_initial_conditions($opts, $nl_flags, $definition, $defaults, $nl, $physv); - } - setup_logic_dynamic_subgrid($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_spinup($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_supplemental_nitrogen($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_fates($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################### - # namelist group: atm2lnd_inparm - ######################################### - setup_logic_atm_forcing($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################### - # namelist group: lnd2atm_inparm - ######################################### - setup_logic_lnd2atm($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################### - # namelist group: clm_humanindex_inparm # - ######################################### - setup_logic_humanindex($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################# - # namelist group: cnfire_inparm # - ################################# - setup_logic_cnfire($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ###################################### - # namelist group: cnprecision_inparm # - ###################################### - setup_logic_cnprec($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################### - # namelist group: clmu_inparm # - ############################### - setup_logic_urban($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################### - # namelist group: crop # - ############################### - setup_logic_crop($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################### - # namelist group: ch4par_in # - ############################### - setup_logic_methane($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_c_isotope($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################### - # namelist group: ndepdyn_nml # - ############################### - setup_logic_nitrogen_deposition($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################## - # namelist group: cnmresp_inparm # - ################################## - setup_logic_cnmresp($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################# - # namelist group: nitrif_inparm # - ################################# - setup_logic_nitrif_params( $nl_flags, $definition, $defaults, $nl ); - - #################################### - # namelist group: photosyns_inparm # - #################################### - setup_logic_photosyns($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################# - # namelist group: popd_streams # - ################################# - setup_logic_popd_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - #################################### - # namelist group: urbantv_streams # - #################################### - setup_logic_urbantv_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################## - # namelist group: light_streams # - ################################## - setup_logic_lightning_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################# - # namelist group: drydep_inparm # - ################################# - setup_logic_dry_deposition($opts, $nl_flags, $definition, $defaults, $nl); - - ################################# - # namelist group: fire_emis_nl # - ################################# - setup_logic_fire_emis($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################# - # namelist group: megan_emis_nl # - ################################# - setup_logic_megan($opts, $nl_flags, $definition, $defaults, $nl); - - ################################## - # namelist group: lai_streams # - ################################## - setup_logic_lai_streams($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################## - # namelist group: bgc_shared - ################################## - setup_logic_bgc_shared($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: soilwater_movement_inparm # - ############################################# - setup_logic_soilwater_movement($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: rooting_profile_inparm # - ############################################# - setup_logic_rooting_profile($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: friction_velocity # - ############################################# - setup_logic_friction_vel($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################################ - # namelist group: century_soilbgcdecompcascade # - ################################################ - setup_logic_century_soilbgcdecompcascade($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - #################################### - # namelist group: cnvegcarbonstate # - #################################### - setup_logic_cnvegcarbonstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: soil_resis_inparm # - ############################################# - setup_logic_soil_resis($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: canopyfluxes_inparm # - ############################################# - setup_logic_canopyfluxes($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: canopyhydrology_inparm # - ############################################# - setup_logic_canopyhydrology($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ##################################### - # namelist group: clm_canopy_inparm # - ##################################### - setup_logic_canopy($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################## - # namelist group: soilhydrology_inparm # - ######################################## - setup_logic_hydrology_params($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ##################################### - # namelist group: irrigation_inparm # - ##################################### - setup_logic_irrigation_parameters($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ####################################################################### - # namelist groups: clm_hydrology1_inparm and clm_soilhydrology_inparm # - ####################################################################### - setup_logic_hydrology_switches($nl, $physv); - - ######################################### - # namelist group: clm_initinterp_inparm # - ######################################### - setup_logic_initinterp($opts, $nl_flags, $definition, $defaults, $nl, $physv); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_site_specific { - # site specific requirements - my ($nl_flags, $definition, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - # res check prevents polluting the namelist with an unnecessary - # false variable for every run - if ($nl_flags->{'res'} eq "1x1_vancouverCAN") { - my $var = "use_vancouver"; - my $val = ".true."; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - } - } - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - # res check prevents polluting the namelist with an unnecessary - # false variable for every run - if ($nl_flags->{'res'} eq "1x1_mexicocityMEX") { - my $var = "use_mexicocity"; - my $val = ".true."; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - } - } - - if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'res'} eq "1x1_smallvilleIA") { - if (! &value_is_true($nl_flags->{'use_cn'}) || ! &value_is_true($nl_flags->{'use_crop'})) { - $log->fatal_error("1x1_smallvilleIA grids must use a compset with CN and CROP turned on."); - } - } - - if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'res'} eq "1x1_numaIA") { - if (! &value_is_true($nl_flags->{'use_cn'}) || ! &value_is_true($nl_flags->{'use_crop'})) { - $log->fatal_error("1x1_numaIA grids must use a compset with CN and CROP turned on."); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lnd_tuning { - - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = "lnd_tuning_mode"; - if ( $opts->{$var} eq "default" ) { - my %settings; - $settings{'phys'} = $nl_flags->{'phys'}; - $nl_flags->{$var} = $defaults->get_value($var, \%settings ); - } else { - $nl_flags->{$var} = $opts->{$var}; - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string( $nl_flags->{$var} ) ); - if ( ! $definition->is_valid_value( $var, quote_string( $nl_flags->{$var}) ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for lnd_tuning_mode"); - my $phys = $physv->as_string(); - if ( $nl_flags->{$var} !~ /^${phys}_/ ) { - $log->fatal_error("First part of lnd_tuning_mode MUST match the CLM version you are using."); - } -} - - -#------------------------------------------------------------------------------- - -sub setup_logic_lnd_frac { - - my ($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref) = @_; - - my $var = "lnd_frac"; - if ( defined($opts->{$var}) ) { - if ( defined($nl->get_value('fatmlndfrc')) ) { - $log->fatal_error("Can NOT set both -lnd_frac option (set via LND_DOMAIN_PATH/LND_DOMAIN_FILE " . - "env variables) AND fatmlndfrac on namelist"); - } - my $lnd_frac = SetupTools::expand_xml_var( $opts->{$var}, $envxml_ref); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fatmlndfrc','val'=>$lnd_frac ); - } - - # Get the fraction file - if (defined $nl->get_value('fatmlndfrc')) { - # do nothing - use value provided by config_grid.xml and clm.cpl7.template - } else { - $log->fatal_error("fatmlndfrc was NOT sent into CLM build-namelist."); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_co2_type { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $var = "co2_type"; - if ( defined($opts->{$var}) ) { - if ( ! defined($nl->get_value($var)) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'co2_type','val'=>"$opts->{'co2_type'}"); - } else { - $log->fatal_error("co2_type set on namelist as well as -co2_type option."); - } - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'co2_type'); - if ( $nl->get_value('co2_type') =~ /constant/ ) { - my $var = 'co2_ppmv'; - if ( defined($opts->{$var}) ) { - if ( $opts->{$var} <= 0.0 ) { - $log->fatal_error("co2_ppmv can NOT be less than or equal to zero."); - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $opts->{$var}); - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'sim_year'=>$nl_flags->{'sim_year'} ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_irrigate { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'irrigate', - 'use_crop'=>$nl_flags->{'use_crop'}, 'use_cndv'=>$nl_flags->{'use_cndv'} ); - $nl_flags->{'irrigate'} = lc($nl->get_value('irrigate')); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_start_type { - my ($opts, $nl_flags, $nl) = @_; - - my $var = "start_type"; - my $drv_start_type = $nl->get_value($var); - my $my_start_type = $nl_flags->{'clm_start_type'}; - my $nsrest = $nl->get_value('override_nsrest'); - - if ( defined($nsrest) ) { - if ( $nsrest == 0 ) { $my_start_type = "startup"; } - if ( $nsrest == 1 ) { $my_start_type = "continue"; } - if ( $nsrest == 3 ) { $my_start_type = "branch"; } - if ( "$my_start_type" eq "$drv_start_type" ) { - $log->fatal_error("no need to set override_nsrest to same as start_type."); - } - if ( "$drv_start_type" !~ /startup/ ) { - $log->fatal_error("can NOT set override_nsrest if driver is NOT a startup type."); - } - } - - if ( $my_start_type =~ /branch/ ) { - if (not defined $nl->get_value('nrevsn')) { - $log->fatal_error("nrevsn is required for a branch type."); - } - } else { - if (defined $nl->get_value('nrevsn')) { - $log->fatal_error("nrevsn should ONLY be set for a branch type."); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_delta_time { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - if ( defined($opts->{'l_ncpl'}) ) { - my $l_ncpl = $opts->{'l_ncpl'}; - if ( $l_ncpl <= 0 ) { - $log->fatal_error("bad value for -l_ncpl option."); - } - my $val = ( 3600 * 24 ) / $l_ncpl; - my $dtime = $nl->get_value('dtime'); - if ( ! defined($dtime) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtime', 'val'=>$val); - } elsif ( $dtime ne $val ) { - $log->fatal_error("can NOT set both -l_ncpl option (via LND_NCPL env variable) AND dtime namelist variable."); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtime', 'hgrid'=>$nl_flags->{'res'}); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_decomp_performance { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - # Set the number of segments per clump - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nsegspc', 'hgrid'=>$nl_flags->{'res'}); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_snow { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'snowveg_flag', 'phys'=>$nl_flags->{'phys'} ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsnowoptics' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsnowaging' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_glacier { - # - # Glacier multiple elevation class options - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref, $physv) = @_; - - my $clm_upvar = "GLC_TWO_WAY_COUPLING"; - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - # glc_do_dynglacier is set via GLC_TWO_WAY_COUPLING; it cannot be set via - # user_nl_clm (this is because we might eventually want the coupler and glc - # to also respond to GLC_TWO_WAY_COUPLING, by not bothering to send / map - # these fields - so we want to ensure that CLM is truly listening to this - # shared xml variable and not overriding it) - my $var = "glc_do_dynglacier"; - my $val = logical_to_fortran($envxml_ref->{$clm_upvar}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$val); - if (lc($nl->get_value($var)) ne lc($val)) { - $log->fatal_error("glc_do_dynglacier can only be set via the env variable $clm_upvar: it can NOT be set in user_nl_clm"); - } - - } else { - # Otherwise if CLM4.0 physics and GLC_TWO_WAY_COUPLING is TRUE -- trigger an error - if ( &value_is_true(logical_to_fortran($envxml_ref->{$clm_upvar})) ) { - $log->fatal_error( "clm4_0 physics are being used, but $clm_upvar variable is set to true. $clm_upvar can ONLY be set for physics after clm4_5" ); - } - } - - my $var = "maxpatch_glcmec"; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$nl_flags->{'glc_nec'} ); - - my $val = $nl->get_value($var); - if ( $val != $nl_flags->{'glc_nec'} ) { - $log->fatal_error("$var set to $val does NOT agree with -glc_nec argument of $nl_flags->{'glc_nec'} (set with GLC_NEC env variable)"); - } - - if ( $physv->as_long >= $physv->as_long("clm4_5") ) { - if ( $nl_flags->{'glc_nec'} < 1 ) { - $log->fatal_error("For clm4_5 and later, GLC_NEC must be at least 1."); - } - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glc_snow_persistence_max_days'); - - } else { - # clm4_0 - if ( $nl_flags->{'glc_nec'} > 0 ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'flndtopo' , 'hgrid'=>$nl_flags->{'res'}, 'mask'=>$nl_flags->{'mask'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fglcmask' , 'hgrid'=>$nl_flags->{'res'}); - - } else { - # glc_nec == 0 - - # Error checking for glacier multiple elevation class options when glc_mec off - # Make sure various glc_mec-specific logicals are not true, and fglcmask is not set - my $glc_dyntopo= $nl->get_value('glc_dyntopo'); - if ( defined($glc_dyntopo) ) { - if ( &value_is_true($glc_dyntopo) ) { - $log->fatal_error("glc_dyntopo is true, but glc_nec is equal to zero"); - } - } - my $fglcmask = $nl->get_value('fglcmask'); - if ( defined($fglcmask) ) { - $log->fatal_error("fglcmask is set, but glc_nec is equal to zero"); - } - } - } - - # Dependence of albice on glc_nec has gone away starting in CLM4_5. Thus, we - # can remove glc_nec from the following call once we ditch CLM4_0. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'albice', 'glc_nec'=>$nl_flags->{'glc_nec'}); - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_melt_behavior'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_ice_runoff_behavior'); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_params_file { - # get param data. For 4_0, pft-physiology, for 4_5 old - # pft-physiology was used but now now includes CN and BGC century - # parameters. - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'paramfile', - 'phys'=>$nl_flags->{'phys'}, - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fpftcon'); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_create_crop_landunit { - # Create crop land unit - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'create_crop_landunit'; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - if ( $nl_flags->{'crop'} eq "on" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'irrig'=>$nl_flags->{'irrig'} ); - } else { - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_fates'=>$nl_flags->{'use_fates'} ); - if ( &value_is_true($nl_flags->{'use_fates'}) && &value_is_true($nl->get_value($var)) ) { - $log->fatal_error( "$var is true and yet use_fates is being set, which contradicts that (use_fates requires $var to be .false." ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_subgrid { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'run_zero_weight_urban'; - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_cnfire { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my @fire_consts = ( "rh_low", "rh_hgh", "bt_min", "bt_max", "cli_scale", "boreal_peatfire_c", "non_boreal_peatfire_c", - "pot_hmn_ign_counts_alpha", "cropfire_a1", "occur_hi_gdp_tree", "lfuel", "ufuel", "cmb_cmplt_fact" ); - if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { - foreach my $item ( @fire_consts ) { - if ( ! &value_is_true($nl_flags->{'cnfireson'} ) ) { - if ( defined($nl->get_value($item)) ) { - $log->fatal_error( "fire_method is no_fire and yet $item is being set, which contradicts that" ); - } - } else { - my $fire_method = remove_leading_and_trailing_quotes( $nl->get_value('fire_method') ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $item, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, - 'fire_method'=>$fire_method ); - } - } - } elsif ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - foreach my $item ( @fire_consts ) { - if ( defined($nl->get_value($item)) ) { - $log->fatal_error( "CN is off which implies that cnfire is off and yet a fire constant ($item) is being set, which contradicts that" ); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_cnprec { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl_flags->{'use_cn'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'ncrit', 'use_cn'=>$nl_flags->{'use_cn'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'cnegcrit', 'use_cn'=>$nl_flags->{'use_cn'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'nnegcrit', 'use_cn'=>$nl_flags->{'use_cn'}); - } -} -#------------------------------------------------------------------------------- - -sub setup_logic_humanindex { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'calc_human_stress_indices'); - } else { - if ( defined($nl->get_value('calc_human_stress_indices')) ) { - $log->fatal_error( "calc_human_stress_indices can NOT be set, for physics versions less than clm4_5" ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_urban { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'building_temp_method'); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urban_hac'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urban_traffic'); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_crop { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - if ( &value_is_true($nl->get_value('use_crop')) ) { - my $maptype = 'baset_mapping'; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $maptype, - 'use_crop'=>$nl->get_value('use_crop') ); - my $baset_mapping = remove_leading_and_trailing_quotes( $nl->get_value($maptype) ); - if ( $baset_mapping eq "varytropicsbylat" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "baset_latvary_slope", - 'use_crop'=>$nl->get_value('use_crop'), $maptype=>$baset_mapping ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "baset_latvary_intercept", - 'use_crop'=>$nl->get_value('use_crop'), $maptype=>$baset_mapping ); - } else { - error_if_set( $nl, "Can only be set if $maptype == varytropicsbylat", "baset_latvary_slope", "baset_latvary_intercept" ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "initial_seed_at_planting", - 'use_crop'=>$nl->get_value('use_crop') ); - } else { - error_if_set( $nl, "Can NOT be set without crop on", "baset_mapping", "baset_latvary_slope", "baset_latvary_intercept" ); - } - } -} - -#------------------------------------------------------------------------------- -sub error_if_set { - # do a fatal_error and exit if any of the input variable names are set - my ($nl, $error, @list) = @_; - foreach my $var ( @list ) { - if ( defined($nl->get_value($var)) ) { - $log->fatal_error( "$var $error" ); - } - } -} - - -#------------------------------------------------------------------------------- - -sub setup_logic_soilstate { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'organic_frac_squared' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soil_layerstruct' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_bedrock', - 'use_fates'=>$nl_flags->{'use_fates'}, 'vichydro'=>$nl_flags->{'vichydro'} ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_demand { - # - # Deal with options that the user has said are required... - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my %settings; - $settings{'hgrid'} = $nl_flags->{'res'}; - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; - $settings{'mask'} = $nl_flags->{'mask'}; - $settings{'crop'} = $nl_flags->{'crop'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; - $settings{'glc_nec'} = $nl_flags->{'glc_nec'}; - if ( $physv->as_long() >= $physv->as_long("clm4_5")) { - # necessary for demand to be set correctly (flanduse_timeseries requires - # use_crop, maybe other options require other flags?)! - $settings{'irrigate'} = $nl_flags->{'irrigate'}; - $settings{'use_cn'} = $nl_flags->{'use_cn'}; - $settings{'use_cndv'} = $nl_flags->{'use_cndv'}; - $settings{'use_lch4'} = $nl_flags->{'use_lch4'}; - $settings{'use_nitrif_denitrif'} = $nl_flags->{'use_nitrif_denitrif'}; - $settings{'use_vertsoilc'} = $nl_flags->{'use_vertsoilc'}; - $settings{'use_century_decomp'} = $nl_flags->{'use_century_decomp'}; - $settings{'use_crop'} = $nl_flags->{'use_crop'}; - } elsif ( $physv->as_long() == $physv->as_long("clm4_0")) { - $settings{'irrig'} = $nl_flags->{'irrig'}; - } - - my $demand = $nl->get_value('clm_demand'); - if (defined($demand)) { - $demand =~ s/\'//g; # Remove quotes - if ( $demand =~ /.+/ ) { - $opts->{'clm_demand'} .= ",$demand"; - } - } - - $demand = $defaults->get_value('clm_demand', \%settings); - if (defined($demand)) { - $demand =~ s/\'//g; # Remove quotes - if ( $demand =~ /.+/ ) { - $opts->{'clm_demand'} .= ",$demand"; - } - } - - my @demandlist = split( ",", $opts->{'clm_demand'} ); - foreach my $item ( @demandlist ) { - if ( $item eq "null" ) { - next; - } - if ( $item eq "finidat" ) { - $log->fatal_error( "Do NOT put findat in the clm_demand list, set the clm_start_type=startup so initial conditions are required"); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $item, %settings ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_surface_dataset { - # - # Get surface dataset after flanduse_timeseries so that we can get surface data - # consistent with it - # MUST BE AFTER: setup_logic_demand which is where flanduse_timeseries is set - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - $nl_flags->{'flanduse_timeseries'} = "null"; - my $flanduse_timeseries = $nl->get_value('flanduse_timeseries'); - if (defined($flanduse_timeseries)) { - $flanduse_timeseries =~ s!(.*)/!!; - $flanduse_timeseries =~ s/\'//; - $flanduse_timeseries =~ s/\"//; - if ( $flanduse_timeseries ne "" ) { - $nl_flags->{'flanduse_timeseries'} = $flanduse_timeseries; - } - } - $flanduse_timeseries = $nl_flags->{'flanduse_timeseries'}; - - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - if ($flanduse_timeseries ne "null" && $nl_flags->{'bgc_mode'} eq "cndv" ) { - $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with dynamic vegetation ('-bgc cndv' in CLM_CONFIG_OPTS)." ); - } - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat', - 'hgrid'=>$nl_flags->{'res'}, - 'sim_year'=>$nl_flags->{'sim_year'}, 'irrig'=>$nl_flags->{'irrig'}, - 'crop'=>$nl_flags->{'crop'}, 'glc_nec'=>$nl_flags->{'glc_nec'}); - } else{ - if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_cndv'}) ) { - $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with dynamic vegetation (use_cndv=.true)." ); - } - if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_fates'}) ) { - $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with ecosystem dynamics (use_fates=.true)." ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat', - 'hgrid'=>$nl_flags->{'res'}, - 'sim_year'=>$nl_flags->{'sim_year'}, 'irrigate'=>$nl_flags->{'irrigate'}, - 'use_crop'=>$nl_flags->{'use_crop'}, 'glc_nec'=>$nl_flags->{'glc_nec'}); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_initial_conditions { - # Initial conditions - # The initial date is an attribute in the defaults file which should be matched unless - # the user explicitly requests to ignore the initial date via the -ignore_ic_date option, - # or just ignore the year of the initial date via the -ignore_ic_year option. - # - # MUST BE AFTER: setup_logic_demand which is where flanduse_timeseries is set - # AFTER: setup_logic_irrigate which is where irrig (or irrigate) is set - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = "finidat"; - my $finidat = $nl->get_value($var); - if ( $nl_flags->{'clm_start_type'} =~ /cold/ ) { - if (defined $finidat ) { - $log->warning("setting $var (either explicitly in your user_nl_clm or by doing a hybrid or branch RUN_TYPE)\n is incomptable with using a cold start" . - " (by setting CLM_FORCE_COLDSTART=on)." ); - $log->warning("Overridding input $var file with one specifying that this is a cold start from arbitrary initial conditions." ); - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, "' '" ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - $var, 'val'=>"' '", 'no_abspath'=>1); - $finidat = $nl->get_value($var); - } elsif ( defined $finidat ) { - if ( string_is_undef_or_empty($finidat) ) { - print "You are setting $var to blank which signals arbitrary initial conditions.\n"; - print "But, CLM_FORCE_COLDSTART is off which is a contradiction. For arbitrary initial conditions just use the CLM_FORCE_COLDSTART option\n"; - $log->fatal_error("To do a cold-start set ./xmlchange CLM_FORCE_COLDSTART=on, and remove the setting of $var in the user_nl_clm file"); - } - } - my $useinitvar = "use_init_interp"; - - if (not defined $finidat ) { - my $ic_date = $nl->get_value('start_ymd'); - my $st_year = int( $ic_date / 10000); - my $nofail = 1; - my %settings; - $settings{'hgrid'} = $nl_flags->{'res'}; - $settings{'phys'} = $physv->as_string(); - $settings{'nofail'} = $nofail; - my $fsurdat = $nl->get_value('fsurdat'); - $fsurdat =~ s!(.*)/!!; - $settings{'fsurdat'} = $fsurdat; - # - # If not transient use sim_year, otherwise use date - # - if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $opts->{'ignore_ic_year'} = 1; - } else { - delete( $settings{'sim_year'} ); - } - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - $settings{'bgc'} = $nl_flags->{'bgc_mode'}; - foreach my $item ( "mask", "maxpft", "irrig", "glc_nec", "crop", "lnd_tuning_mode" ) { - $settings{$item} = $nl_flags->{$item}; - } - } else { - foreach my $item ( "mask", "maxpft", "irrigate", "glc_nec", "use_crop", "use_cn", "use_cndv", - "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp", "use_fates", - "lnd_tuning_mode" - ) { - $settings{$item} = $nl_flags->{$item}; - } - } - if ($opts->{'ignore_ic_date'}) { - if ( &value_is_true($nl_flags->{'use_crop'}) ) { - $log->warning("using ignore_ic_date is incompatable with crop! If you choose to ignore this error, " . - "the counters since planting for crops will be messed up. \nSo you should ignore at " . - "least the first season for crops. And since it will impact the 20 year means, ideally the " . - "first 20 years should be ignored."); - } - } elsif ($opts->{'ignore_ic_year'}) { - $settings{'ic_md'} = $ic_date; - } else { - $settings{'ic_ymd'} = $ic_date; - } - my $try = 0; - my $done = 2; - my $use_init_interp_default = $nl->get_value($useinitvar); - if ( string_is_undef_or_empty( $use_init_interp_default ) ) { - $use_init_interp_default = ".false."; - } - $settings{$useinitvar} = $use_init_interp_default; - do { - $try++; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, %settings ); - # If couldn't find a matching finidat file, check if can turn on interpolation and try to find one again - $finidat = $nl->get_value($var); - if ( (not defined $finidat ) && ($physv->as_long() >= $physv->as_long("clm4_5")) ) { - # Delete any date settings, except for crop - delete( $settings{'ic_ymd'} ); - delete( $settings{'ic_md'} ); - #if ( &value_is_true($nl_flags->{'use_crop'}) ) { - #$settings{'ic_md'} = $ic_date; - #} - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_sim_years" ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_how_close" ); - foreach my $sim_yr ( split( /,/, $nl->get_value("init_interp_sim_years") )) { - if ( abs($st_year - $sim_yr) < $nl->get_value("init_interp_how_close") ) { - $settings{'sim_year'} = $sim_yr; - } - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $useinitvar, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), - 'sim_year'=>$settings{'sim_year'}, 'nofail'=>1, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, - 'use_fates'=>$nl_flags->{'use_fates'} ); - $settings{$useinitvar} = $nl->get_value($useinitvar); - if ( $try > 1 ) { - my $group = $definition->get_group_name($useinitvar); - $nl->set_variable_value($group, $useinitvar, $use_init_interp_default ); - } - if ( &value_is_true($nl->get_value($useinitvar) ) ) { - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_attributes", - 'sim_year'=>$settings{'sim_year'}, 'use_cndv'=>$nl_flags->{'use_cndv'}, - 'glc_nec'=>$nl_flags->{'glc_nec'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'},'nofail'=>1 ); - my $attributes_string = remove_leading_and_trailing_quotes($nl->get_value("init_interp_attributes")); - foreach my $pair ( split( /\s/, $attributes_string) ) { - if ( $pair =~ /^([a-z_]+)=([a-z._0-9]+)$/ ) { - $settings{$1} = $2; - } else { - $log->fatal_error("Problem interpreting init_interp_attributes"); - } - } - } else { - if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) { - $log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true"); - } - $try = $done; - } - } else { - $try = $done - } - } while( ($try < $done) && (not defined $finidat ) ); - if ( not defined $finidat ) { - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, "' '" ); - } - } - $finidat = $nl->get_value($var); - if ( &value_is_true($nl->get_value($useinitvar) ) && string_is_undef_or_empty($finidat) ) { - $log->fatal_error("$useinitvar is set BUT $var is NOT, need to set both" ); - } -} # end initial conditions - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_subgrid { - # - # Options controlling which parts of flanduse_timeseries to use - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - setup_logic_do_transient_pfts($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_do_transient_crops($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_do_harvest($opts, $nl_flags, $definition, $defaults, $nl, $physv); - -} - -sub setup_logic_do_transient_pfts { - # - # Set do_transient_pfts default value, and perform error checking on do_transient_pfts - # - # Assumes the following are already set in the namelist (although it's okay - # for them to be unset if that will be their final state): - # - flanduse_timeseries - # - use_cndv - # - use_fates - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'do_transient_pfts'; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - # Start by assuming a default value of '.true.'. Then check a number of - # conditions under which do_transient_pfts cannot be true. Under these - # conditions: (1) set default value to '.false.'; (2) make sure that the - # value is indeed false (e.g., that the user didn't try to set it to true). - - my $default_val = ".true."; - - # cannot_be_true will be set to a non-empty string in any case where - # do_transient_pfts should not be true; if it turns out that - # do_transient_pfts IS true in any of these cases, a fatal error will be - # generated - my $cannot_be_true = ""; - - if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { - $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; - } - elsif (&value_is_true($nl->get_value('use_cndv'))) { - $cannot_be_true = "$var cannot be combined with use_cndv"; - } - elsif (&value_is_true($nl->get_value('use_fates'))) { - $cannot_be_true = "$var cannot be combined with use_fates"; - } - - if ($cannot_be_true) { - $default_val = ".false."; - } - - if (!$cannot_be_true) { - # Note that, if the variable cannot be true, we don't call add_default - # - so that we don't clutter up the namelist with variables that don't - # matter for this case - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, val=>$default_val); - } - - # Make sure the value is false when it needs to be false - i.e., that the - # user hasn't tried to set a true value at an inappropriate time. - - if (&value_is_true($nl->get_value($var)) && $cannot_be_true) { - $log->fatal_error($cannot_be_true); - } - - } -} - -sub setup_logic_do_transient_crops { - # - # Set do_transient_crops default value, and perform error checking on do_transient_crops - # - # Assumes the following are already set in the namelist (although it's okay - # for them to be unset if that will be their final state): - # - flanduse_timeseries - # - use_crop - # - use_fates - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'do_transient_crops'; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - # Start by assuming a default value of '.true.'. Then check a number of - # conditions under which do_transient_crops cannot be true. Under these - # conditions: (1) set default value to '.false.'; (2) make sure that the - # value is indeed false (e.g., that the user didn't try to set it to true). - - my $default_val = ".true."; - - # cannot_be_true will be set to a non-empty string in any case where - # do_transient_crops should not be true; if it turns out that - # do_transient_crops IS true in any of these cases, a fatal error will be - # generated - my $cannot_be_true = ""; - - if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { - $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; - } - elsif (!&value_is_true($nl->get_value('use_crop'))) { - $cannot_be_true = "$var can only be set to true when running with use_crop = true"; - } - elsif (&value_is_true($nl->get_value('use_fates'))) { - # In principle, use_fates should be compatible with - # do_transient_crops. However, this hasn't been tested, so to be safe, - # we are not allowing this combination for now. - $cannot_be_true = "$var has not been tested with ED, so for now these two options cannot be combined"; - } - - if ($cannot_be_true) { - $default_val = ".false."; - } - - if (!$cannot_be_true) { - # Note that, if the variable cannot be true, we don't call add_default - # - so that we don't clutter up the namelist with variables that don't - # matter for this case - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, val=>$default_val); - } - - # Make sure the value is false when it needs to be false - i.e., that the - # user hasn't tried to set a true value at an inappropriate time. - - if (&value_is_true($nl->get_value($var)) && $cannot_be_true) { - $log->fatal_error($cannot_be_true); - } - - } -} - -sub setup_logic_do_harvest { - # - # Set do_harvest default value, and perform error checking on do_harvest - # - # Assumes the following are already set in the namelist (although it's okay - # for them to be unset if that will be their final state): - # - flanduse_timeseries - # - use_cn - # - use_fates - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'do_harvest'; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - # Start by assuming a default value of '.true.'. Then check a number of - # conditions under which do_harvest cannot be true. Under these - # conditions: (1) set default value to '.false.'; (2) make sure that the - # value is indeed false (e.g., that the user didn't try to set it to true). - - my $default_val = ".true."; - - # cannot_be_true will be set to a non-empty string in any case where - # do_harvest should not be true; if it turns out that do_harvest IS true - # in any of these cases, a fatal error will be generated - my $cannot_be_true = ""; - - if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { - $cannot_be_true = "$var can only be set to true when running a transient case (flanduse_timeseries non-blank)"; - } - elsif (!&value_is_true($nl->get_value('use_cn'))) { - $cannot_be_true = "$var can only be set to true when running with CN (use_cn = true)"; - } - elsif (&value_is_true($nl->get_value('use_fates'))) { - $cannot_be_true = "$var currently doesn't work with ED"; - } - - if ($cannot_be_true) { - $default_val = ".false."; - } - - if (!$cannot_be_true) { - # Note that, if the variable cannot be true, we don't call add_default - # - so that we don't clutter up the namelist with variables that don't - # matter for this case - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, val=>$default_val); - } - - # Make sure the value is false when it needs to be false - i.e., that the - # user hasn't tried to set a true value at an inappropriate time. - - if (&value_is_true($nl->get_value($var)) && $cannot_be_true) { - $log->fatal_error($cannot_be_true); - } - - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_spinup { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5")) { - if ( $nl_flags->{'bgc_mode'} eq "sp" && defined($nl->get_value('override_bgc_restart_mismatch_dump'))) { - $log->fatal_error("CN must be on if override_bgc_restart_mismatch_dump is set."); - } - } - if ( $nl_flags->{'clm_accelerated_spinup'} eq "on" ) { - foreach my $var ( "hist_nhtfrq", "hist_fincl1", "hist_empty_htapes", "hist_mfilt" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - $var, use_cn=>$nl_flags->{'use_cn'}, use_fates=>$nl_flags->{'use_fates'}, - use_cndv=>$nl_flags->{'use_cndv'} ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_bgc_shared { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5")) { - if ( $nl_flags->{'bgc_mode'} ne "sp" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'constrain_stress_deciduous_onset', 'phys'=>$physv->as_string() ); - } - # FIXME(bja, 201606) the logic around fates / bgc_mode / - # use_century_decomp is confusing and messed up. This is a hack - # workaround. - if ( &value_is_true($nl_flags->{'use_century_decomp'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'decomp_depth_efolding', 'phys'=>$physv->as_string() ); - } - - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_supplemental_nitrogen { - # - # Supplemental Nitrogen for prognostic crop cases - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $nl_flags->{'bgc_mode'} ne "sp" && $nl_flags->{'bgc_mode'} ne "fates" && &value_is_true($nl_flags->{'use_crop'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'suplnitro', 'use_cn'=>$nl_flags->{'use_cn'}, 'use_crop'=>$nl_flags->{'use_crop'}); - } - - # - # Error checking for suplnitro - # - my $suplnitro = $nl->get_value('suplnitro'); - if ( defined($suplnitro) ) { - if ( $nl_flags->{'bgc_mode'} eq "sp" ) { - $log->fatal_error("supplemental Nitrogen (suplnitro) is set, but neither CN nor CNDV is active!"); - } - if ( ! &value_is_true($nl_flags->{'use_crop'}) && $suplnitro =~ /PROG_CROP_ONLY/i ) { - $log->fatal_error("supplemental Nitrogen is set to run over prognostic crops, but prognostic crop is NOT active!"); - } - - if ( $suplnitro =~ /ALL/i ) { - if ( $physv->as_long() == $physv->as_long("clm4_0") && $nl_flags->{'spinup'} ne "normal" ) { - $log->fatal_error("There is no need to use a spinup mode when supplemental Nitrogen is on for all PFT's, as these modes spinup Nitrogen\n" . - "when spinup != normal you can NOT set supplemental Nitrogen (suplnitro) to ALL"); - } - if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_spinup'} ne "off" ) { - $log->warning("There is no need to use a bgc_spinup mode when supplemental Nitrogen is on for all PFT's, as these modes spinup Nitrogen" ); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrology_params { - # - # Logic for hydrology parameters - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5")) { - my $lower = $nl->get_value( 'lower_boundary_condition' ); - my $var = "baseflow_scalar"; - if ( $lower == 1 || $lower == 2 ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - $var, 'lower_boundary_condition' => $lower ); - } - my $val = $nl->get_value( $var ); - if ( defined($val) ) { - if ( $lower != 1 && $lower != 2 ) { - $log->fatal_error("baseflow_scalar is only used for lower_boundary_condition of flux or zero-flux"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_irrigation_parameters { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5")) { - my $var; - foreach $var ("irrig_min_lai", "irrig_start_time", "irrig_length", - "irrig_target_smp", "irrig_depth", "irrig_threshold_fraction", - "limit_irrigation_if_rof_enabled") { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } - - $var = "irrig_river_volume_threshold"; - if ( &value_is_true($nl->get_value("limit_irrigation_if_rof_enabled")) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if limit_irrigation_if_rof_enabled is true"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_nitrif_params { - # - # Logic for nitrification parameters - # - my ($nl_flags, $definition, $defaults, $nl) = @_; - - if ( ! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) { - my @vars = ( "k_nitr_max", "denitrif_respiration_coefficient", "denitrif_respiration_exponent", - "denitrif_nitrateconc_coefficient", "denitrif_nitrateconc_exponent" ); - foreach my $var ( @vars ) { - if ( defined($nl->get_value( $var ) ) ) { - $log->fatal_error("$var is only used when use_nitrif_denitrif is turned on"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrology_switches { - # - # Check on Switches for hydrology - # - my ($nl, $physv) = @_; - - my $subgrid = $nl->get_value('subgridflag' ); - my $origflag = $nl->get_value('origflag' ); - my $h2osfcflag = $nl->get_value('h2osfcflag' ); - if ( $origflag == 1 && $subgrid == 1 ) { - $log->fatal_error("if origflag is ON, subgridflag can NOT also be on!"); - } - if ( $h2osfcflag == 1 && $subgrid != 1 ) { - $log->fatal_error("if h2osfcflag is ON, subgridflag can NOT be off!"); - } - # These should NOT be set for CLM5.0 and beyond - if ( $physv->as_long() > $physv->as_long("clm4_5") ) { - foreach my $var ( "origflag", "h2osfcflag", "oldfflag" ) { - my $val = $nl->get_value($var); - if ( defined($val) ) { - $log->fatal_error( "ERROR:: $var=$val is deprecated and can only be used with CLM4.5" ); - } - } - } - # Test bad configurations - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - my $lower = $nl->get_value( 'lower_boundary_condition' ); - my $use_vic = $nl->get_value( 'use_vichydro' ); - my $use_bed = $nl->get_value( 'use_bedrock' ); - my $soilmtd = $nl->get_value( 'soilwater_movement_method' ); - if ( defined($soilmtd) && defined($lower) && $soilmtd == 0 && $lower != 4 ) { - $log->fatal_error( "If soil water movement method is zeng-decker -- lower_boundary_condition can only be aquifer" ); - } - if ( defined($soilmtd) && defined($lower) && $soilmtd == 1 && $lower == 4 ) { - $log->fatal_error( "If soil water movement method is adaptive -- lower_boundary_condition can NOT be aquifer" ); - } - if ( defined($use_bed) && defined($lower) && (&value_is_true($use_bed)) && $lower != 2 ) { - $log->fatal_error( "If use_bedrock is on -- lower_boundary_condition can only be flux" ); - } - if ( defined($use_vic) && defined($lower) && (&value_is_true($use_vic)) && $lower != 3 && $lower != 4) { - $log->fatal_error( "If use_vichydro is on -- lower_boundary_condition can only be table or aquifer" ); - } - if ( defined($origflag) && defined($use_vic) && (&value_is_true($use_vic)) && $origflag == 1 ) { - $log->fatal_error( "If use_vichydro is on -- origflag can NOT be equal to 1" ); - } - if ( defined($h2osfcflag) && defined($lower) && $h2osfcflag == 0 && $lower != 4 ) { - $log->fatal_error( "If h2osfcflag is 0 lower_boundary_condition can only be aquifer" ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_methane { - # - # CH4 model if bgc=CN or CNDV - # - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - if ( &value_is_true($nl_flags->{'use_lch4'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'finundation_method', - 'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'} ); - # - # Get resolution to read streams file for - # - my $finundation_method = remove_leading_and_trailing_quotes($nl->get_value('finundation_method' )); - if ( $finundation_method eq "TWS_inversion" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'finundation_res', - 'finundation_method'=>$finundation_method ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ch4finundated', - 'finundation_method'=>$finundation_method, - 'finundation_res'=>$nl->get_value('finundation_res') ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_aereoxid_prog', - 'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'} ); - # - # Check if use_aereoxid_prog is set. If no, then read value of aereoxid from - # parameters file - # - my $use_aereoxid_prog = $nl->get_value('use_aereoxid_prog'); - if ( defined($use_aereoxid_prog) && ! &value_is_true($use_aereoxid_prog) ) { - $log->warning("Using aereoxid value from parameters file." ); - } - } else { - my @vars = $nl->get_variable_names('ch4par_in'); - if ( $#vars >= 0 ) { - $log->fatal_error("ch4par_in namelist variables were set, but Methane model NOT defined in the configuration (use_lch4)"); - } - } - - # - # Ch4 namelist checking - # - if ( &value_is_true($nl_flags->{'use_lch4'}) ) { - my $allowlakeprod = $nl->get_value('allowlakeprod'); - if ( ! defined($allowlakeprod) || - (defined($allowlakeprod) && ! &value_is_true($allowlakeprod)) ) { - if ( defined($nl->get_value('lake_decomp_fact')) ) { - $log->fatal_error("lake_decomp_fact set without allowlakeprod=.true."); - } - } - my $anoxia = $nl->get_value('anoxia'); - if ( ! defined($anoxia) || - (defined($anoxia) && ! &value_is_true($anoxia)) ) { - if ( defined($nl->get_value('anoxia_wtsat')) ) { - $log->fatal_error("anoxia_wtsat set without anoxia=.true."); - } - } - my $pftspec_rootprof = $nl->get_value('pftspecific_rootingprofile'); - if ( ! defined($pftspec_rootprof) || - (defined($pftspec_rootprof) && &value_is_true($pftspec_rootprof) ) ) { - if ( defined($nl->get_value('rootprof_exp')) ) { - $log->fatal_error("rootprof_exp set without pftspecific_rootingprofile=.false."); - } - } - } else { - my @vars = ( "allowlakeprod", "anoxia", "anoxia_wtsat", "pftspecific_rootingprofile" ); - foreach my $var ( @vars ) { - if ( defined($nl->get_value($var)) ) { - $log->fatal_error("$var set without methane model configuration on (use_lch4)"); - } - } - } -} # end methane - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_plant_nitrogen_alloc { - # - # dynamic plant nitrogen allocation model, bgc=bgc - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") && - &value_is_true($nl_flags->{'use_cn'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_flexibleCN', - 'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'} ); - $nl_flags->{'use_flexibleCN'} = $nl->get_value('use_flexibleCN'); - - if ( &value_is_true($nl_flags->{'use_flexibleCN'}) ) { - # TODO(bja, 2015-04) make this depend on > clm 5.0 and bgc mode at some point. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'MM_Nuptake_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'downreg_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'plant_ndemand_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'substrate_term_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nscalar_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'temp_scalar_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CNratio_floating', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reduce_dayl_factor', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'vcmax_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_residual_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_partition_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_evergreen_phenology_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'carbon_resp_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'}, 'use_fun'=>$nl->get_value('use_fun') ); - if ( $nl->get_value('carbon_resp_opt') == 1 && &value_is_true($nl->get_value('use_fun')) ) { - $log->fatal_error("carbon_resp_opt should NOT be set to 1 when FUN is also on"); - } - } - } elsif ( $physv->as_long() >= $physv->as_long("clm4_5") && ! &value_is_true($nl_flags->{'use_cn'}) ) { - if ( &value_is_true($nl->get_value('use_flexibleCN')) ) { - $log->fatal_error("use_flexibleCN can ONLY be set if CN is on"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_luna { - # - # LUNA model to calculate photosynthetic capacities based on environmental conditions - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_luna', - 'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'}, 'use_fates'=>$nl_flags->{'use_fates'}, - 'use_nitrif_denitrif'=>$nl_flags->{'use_nitrif_denitrif'} ); - - if ( &value_is_true( $nl_flags->{'use_cn'} ) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_nguardrail', - 'use_cn'=>$nl_flags->{'use_cn'} ); - } - $nl_flags->{'use_luna'} = $nl->get_value('use_luna'); - my $vcmax_opt= $nl->get_value('vcmax_opt'); - # lnc_opt only applies if luna is on or for vcmax_opt=3/4 - if ( &value_is_true( $nl_flags->{'use_luna'} ) || $vcmax_opt == 3 || $vcmax_opt == 4 ) { - # lnc_opt can be set for both CN on and off - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lnc_opt', - 'use_cn'=>$nl_flags->{'use_cn'} ); - } - if ( &value_is_true($nl->get_value('lnc_opt') ) && not &value_is_true( $nl_flags->{'use_cn'}) ) { - $log->fatal_error("Cannot turn lnc_opt to true when bgc=sp" ); - } - my $var = "jmaxb1"; - if ( $physv->as_long() >= $physv->as_long("clm5_0") && &value_is_true( $nl_flags->{'use_luna'} ) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_luna'=>$nl_flags->{'use_luna'} ); - } - my $val = $nl->get_value($var); - if ( $physv->as_long() >= $physv->as_long("clm4_5") && ! &value_is_true( $nl_flags->{'use_luna'} ) ) { - if ( defined($val) ) { - $log->fatal_error("Cannot set $var when use_luna is NOT on" ); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrstress { - # - # Plant hydraulic stress model - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - # TODO(kwo, 2015-09) make this depend on > clm 5.0 at some point. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_hydrstress', - 'use_fates'=>$nl_flags->{'use_fates'} ); - $nl_flags->{'use_hydrstress'} = $nl->get_value('use_hydrstress'); - if ( &value_is_true( $nl_flags->{'use_fates'} ) && &value_is_true( $nl_flags->{'use_hydrstress'} ) ) { - $log->fatal_error("Cannot turn use_hydrstress on when use_fates is on" ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_fertilizer { - # - # Flags to control fertilizer application - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - $nl_flags->{'use_crop'} = $nl->get_value('use_crop'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_fertilizer', - 'use_crop'=>$nl_flags->{'use_crop'} ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_grainproduct { - # - # Flags to control 1-year grain product pool - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - $nl_flags->{'use_crop'} = $nl->get_value('use_crop'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_grainproduct', - 'use_crop'=>$nl_flags->{'use_crop'}, 'phys'=>$physv->as_string() ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_roots { - # - # dynamic root model - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_dynroot', 'phys'=>$physv->as_string(), 'bgc_mode'=>$nl_flags->{'bgc_mode'}); - my $use_dynroot = $nl->get_value('use_dynroot'); - if ( &value_is_true($use_dynroot) && ($nl_flags->{'bgc_mode'} eq "sp") ) { - $log->fatal_error("Cannot turn dynroot mode on mode bgc=sp\n" . - "Set the bgc mode to 'cn' or 'bgc'."); - } - if ( &value_is_true( $use_dynroot ) && &value_is_true( $nl_flags->{'use_hydrstress'} ) ) { - $log->fatal_error("Cannot turn use_dynroot on when use_hydrstress is on" ); - } - } # else - not relevant in clm4_0, not part of namelist definition, will not run. -} - -#------------------------------------------------------------------------------- - -sub setup_logic_c_isotope { - # - # Error checking for C-isotope options - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $use_c13 = $nl->get_value('use_c13'); - my $use_c14 = $nl->get_value('use_c14'); - if ( $nl_flags->{'bgc_mode'} ne "sp" && $nl_flags->{'bgc_mode'} ne "fates" ) { - if ( $nl_flags->{'bgc_mode'} ne "bgc" ) { - if ( defined($use_c13) && &value_is_true($use_c13) ) { - $log->warning("use_c13 is ONLY scientifically validated with the bgc=BGC configuration" ); - } - if ( defined($use_c14) && &value_is_true($use_c14) ) { - $log->warning("use_c14 is ONLY scientifically validated with the bgc=BGC configuration" ); - } - } - if ( defined($use_c14) ) { - if ( &value_is_true($use_c14) ) { - my $use_c14_bombspike = $nl->get_value('use_c14_bombspike'); - if ( defined($use_c14_bombspike) && &value_is_true($use_c14_bombspike) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'atm_c14_filename', - 'use_c14'=>$use_c14, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_c14_bombspike'=>$nl->get_value('use_c14_bombspike') ); - } - } else { - if ( defined($nl->get_value('use_c14_bombspike')) || - defined($nl->get_value('atm_c14_filename')) ) { - $log->fatal_error("use_c14 is FALSE and use_c14_bombspike or atm_c14_filename set"); - } - } - } else { - if ( defined($nl->get_value('use_c14_bombspike')) || - defined($nl->get_value('atm_c14_filename')) ) { - $log->fatal_error("use_c14 NOT set to .true., but use_c14_bompspike/atm_c14_filename defined."); - } - } - if ( defined($use_c13) ) { - if ( &value_is_true($use_c13) ) { - my $use_c13_timeseries = $nl->get_value('use_c13_timeseries'); - if ( defined($use_c13_timeseries) && &value_is_true($use_c13_timeseries) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'atm_c13_filename', - 'use_c13'=>$use_c13, 'use_cn'=>$nl_flags->{'use_cn'}, 'use_c13_timeseries'=>$nl->get_value('use_c13_timeseries') ); - } - } else { - if ( defined($nl->get_value('use_c13_timeseries')) || - defined($nl->get_value('atm_c13_filename')) ) { - $log->fatal_error("use_c13 is FALSE and use_c13_timeseries or atm_c13_filename set"); - } - } - } else { - if ( defined($nl->get_value('use_c13_timeseries')) || - defined($nl->get_value('atm_c13_filename')) ) { - $log->fatal_error("use_c13 NOT set to .true., but use_c13_bompspike/atm_c13_filename defined."); - } - } - } else { - if ( defined($use_c13) || - defined($use_c14) || - defined($nl->get_value('use_c14_bombspike')) || - defined($nl->get_value('atm_c14_filename')) || - defined($nl->get_value('use_c13_timeseries')) || - defined($nl->get_value('atm_c13_filename')) ) { - $log->fatal_error("bgc=sp and C isotope namelist variables were set, both can't be used at the same time"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_nitrogen_deposition { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # - # Nitrogen deposition for bgc=CN - # - - if ( $physv->as_long() == $physv->as_long("clm4_0") && $nl_flags->{'bgc_mode'} ne "none" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndepmapalgo', 'phys'=>$nl_flags->{'phys'}, - 'bgc'=>$nl_flags->{'bgc_mode'}, 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_ndep', 'phys'=>$nl_flags->{'phys'}, - 'bgc'=>$nl_flags->{'bgc_mode'}, 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_ndep', 'phys'=>$nl_flags->{'phys'}, - 'bgc'=>$nl_flags->{'bgc_mode'}, 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_ndep') != $nl->get_value('stream_year_last_ndep') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_ndep', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - } - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ndep', 'phys'=>$nl_flags->{'phys'}, - 'bgc'=>$nl_flags->{'bgc_mode'}, 'rcp'=>$nl_flags->{'rcp'}, - 'hgrid'=>"1.9x2.5" ); - - } elsif ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} =~/cn|bgc/ ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndepmapalgo', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_taxmode', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'ndep_varlist', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_ndep', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_ndep', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_ndep') != $nl->get_value('stream_year_last_ndep') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_ndep', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_ndep', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}, - 'lnd_tuning_mode'=>$nl_flags->{'lnd_tuning_mode'}, - 'hgrid'=>"0.9x1.25" ); - } else { - # If bgc is NOT CN/CNDV then make sure none of the ndep settings are set! - if ( defined($nl->get_value('stream_year_first_ndep')) || - defined($nl->get_value('stream_year_last_ndep')) || - defined($nl->get_value('model_year_align_ndep')) || - defined($nl->get_value('ndep_taxmode' )) || - defined($nl->get_value('ndep_varlist' )) || - defined($nl->get_value('stream_fldfilename_ndep')) - ) { - $log->fatal_error("When bgc is NOT CN or CNDV none of: stream_year_first_ndep," . - "stream_year_last_ndep, model_year_align_ndep, ndep_taxmod, " . - "ndep_varlist, nor stream_fldfilename_ndep" . - " can be set!"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_cnmresp { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # - # CN Maintence respiration for bgc=CN - # - if ( $physv->as_long() >= $physv->as_long("clm4_5") && $nl_flags->{'bgc_mode'} ne "sp" ) { - # When FUN is on and it's clm5_0 get a default value - if ( &value_is_true( $nl->get_value('use_fun') ) && $physv->as_long() >= $physv->as_long("clm5_0")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'br_root', 'phys'=>$nl_flags->{'phys'}, - 'use_fun'=>$nl->get_value('use_fun'), - 'use_cn'=>$nl_flags->{'use_cn'} ); - } - } else { - # If bgc is NOT CN/CNDV then make sure not set - if ( defined($nl->get_value('br_root'))) { - $log->fatal_error("br_root can NOT be set when phys==clm4_0 or bgc_mode==sp!"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_photosyns { - # MUST be after use_hydrstress is set - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # - # Photo synthesis - # - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'rootstem_acc', 'phys'=>$nl_flags->{'phys'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'light_inhibit', 'phys'=>$nl_flags->{'phys'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'leafresp_method', 'phys'=>$nl_flags->{'phys'}, - 'use_cn'=>$nl_flags->{'use_cn'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'modifyphoto_and_lmr_forcrop', 'phys'=>$nl_flags->{'phys'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'stomatalcond_method', 'phys'=>$nl_flags->{'phys'}, - 'use_hydrstress'=>$nl_flags->{'use_hydrstress'} ); - # When CN on, must NOT be scaled by vcmax25top - if ( &value_is_true( $nl_flags->{'use_cn'} ) ) { - if ( $nl->get_value('leafresp_method') == 0 ) { - $log->fatal_error("leafresp_method can NOT be set to scaled to vcmax (0) when CN is on!"); - } - # And when CN off, must NOT be anything besides scaled by vxmac25top - } else { - if ( $nl->get_value('leafresp_method') != 0 ) { - $log->fatal_error("leafresp_method can NOT be set to anything besides scaled to vcmax (0) when bgc_mode==sp!"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_canopy { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - # - # Canopy state - # - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'leaf_mr_vcm', 'phys'=>$nl_flags->{'phys'} ) - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_popd_streams { - # population density streams require clm4_5/clm5_0 and CN/BGC - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - if ( &value_is_true($nl_flags->{'cnfireson'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'popdensmapalgo', 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'}, 'cnfireson'=>$nl_flags->{'cnfireson'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_popdens', 'phys'=>$nl_flags->{'phys'}, - 'cnfireson'=>$nl_flags->{'cnfireson'}, 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_popdens', 'phys'=>$nl_flags->{'phys'}, - 'cnfireson'=>$nl_flags->{'cnfireson'}, 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_popdens') != - $nl->get_value('stream_year_last_popdens') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_popdens', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}, 'cnfireson'=>$nl_flags->{'cnfireson'}); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_popdens', 'phys'=>$nl_flags->{'phys'}, - 'cnfireson'=>$nl_flags->{'cnfireson'}, 'hgrid'=>"0.5x0.5" ); - } else { - # If bgc is NOT CN/CNDV or fire_method==nofire then make sure none of the popdens settings are set - if ( defined($nl->get_value('stream_year_first_popdens')) || - defined($nl->get_value('stream_year_last_popdens')) || - defined($nl->get_value('model_year_align_popdens')) || - defined($nl->get_value('stream_fldfilename_popdens')) ) { - $log->fatal_error("When bgc is SP (NOT CN or BGC) or fire_method==nofire none of: stream_year_first_popdens,\n" . - "stream_year_last_popdens, model_year_align_popdens, nor\n" . - "stream_fldfilename_popdens can be set!"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_urbantv_streams { - # urban time varying streams require clm4_5/clm5_0 - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urbantvmapalgo', - 'hgrid'=>$nl_flags->{'res'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_urbantv', 'phys'=>$nl_flags->{'phys'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_urbantv', 'phys'=>$nl_flags->{'phys'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_urbantv') != - $nl->get_value('stream_year_last_urbantv') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'model_year_align_urbantv', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_urbantv', 'phys'=>$nl_flags->{'phys'}, - 'hgrid'=>"0.9x1.25" ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lightning_streams { - # lightning streams require clm4_5/clm5_0 and CN/BGC - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - if ( &value_is_true($nl_flags->{'cnfireson'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lightngmapalgo', 'use_cn'=>$nl_flags->{'use_cn'}, - 'hgrid'=>$nl_flags->{'res'}, - 'clm_accelerated_spinup'=>$nl_flags->{'clm_accelerated_spinup'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_lightng') != - $nl->get_value('stream_year_last_lightng') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'model_year_align_lightng', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lightng', 'use_cn'=>$nl_flags->{'use_cn'}, - 'hgrid'=>$nl_flags->{'light_res'} ); - } else { - # If bgc is NOT CN/CNDV then make sure none of the Lightng settings are set - if ( defined($nl->get_value('stream_year_first_lightng')) || - defined($nl->get_value('stream_year_last_lightng')) || - defined($nl->get_value('model_year_align_lightng')) || - defined($nl->get_value('stream_fldfilename_lightng')) ) { - $log->fatal_error("When bgc is SP (NOT CN or BGC) or fire_method==nofire none of: stream_year_first_lightng,\n" . - "stream_year_last_lightng, model_year_align_lightng, nor\n" . - "stream_fldfilename_lightng can be set!"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_dry_deposition { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - if ($opts->{'drydep'} ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'drydep_list'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'drydep_method'); - } else { - if ( defined($nl->get_value('drydep_list')) || - defined($nl->get_value('drydep_method')) ) { - $log->fatal_error("drydep_list or drydep_method defined, but drydep option NOT set"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_fire_emis { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($opts->{'fire_emis'} ) { - if ( $physv->as_long() < $physv->as_long("clm4_5") ) { - $log->fatal_error("fire_emis option can NOT be set for CLM versions before clm4_5"); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_emis_factors_file'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fire_emis_specifier'); - } else { - if ( defined($nl->get_value('fire_emis_elevated')) || - defined($nl->get_value('fire_emis_factors_file')) || - defined($nl->get_value('fire_emis_specifier')) ) { - $log->fatal_error("fire_emission setting defined: fire_emis_elevated, fire_emis_factors_file, or fire_emis_specifier, but fire_emis option NOT set"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_megan { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $var = "megan"; - - if ( $opts->{$var} eq "default" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, -'megan', clm_accelerated_spinup=>$nl_flags->{'clm_accelerated_spinup'} ); - $nl_flags->{$var} = $nl->get_value($var); - } else { - $nl_flags->{$var} = $opts->{$var}; - } - - if ($nl_flags->{'megan'} ) { - if ( &value_is_true( $nl_flags->{'use_fates'} ) ) { - $log->fatal_error("MEGAN can NOT be on when ED is also on.\n" . - " Use the '-no-megan' option when '-bgc fates' is activated"); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_specifier'); - check_megan_spec( $opts, $nl, $definition ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'megan_factors_file'); - } else { - if ( defined($nl->get_value('megan_specifier')) || - defined($nl->get_value('megan_factors_file')) ) { - $log->fatal_error("megan_specifier or megan_factors_file defined, but megan option NOT set"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lai_streams { - # lai streams require clm4_5/clm5_0 - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - if ( &value_is_true($nl_flags->{'use_crop'}) && &value_is_true($nl_flags->{'use_lai_streams'}) ) { - $log->fatal_error("turning use_lai_streams on is incompatable with use_crop set to true."); - } - if ( $nl_flags->{'bgc_mode'} eq "sp" ) { - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_lai_streams'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lai_mapalgo', - 'hgrid'=>$nl_flags->{'res'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_first_lai', - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_year_last_lai', - 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - # Set align year, if first and last years are different - if ( $nl->get_value('stream_year_first_lai') != - $nl->get_value('stream_year_last_lai') ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'model_year_align_lai', 'sim_year'=>$nl_flags->{'sim_year'}, - 'sim_year_range'=>$nl_flags->{'sim_year_range'}); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'stream_fldfilename_lai', - 'hgrid'=>"360x720cru" ); - } else { - # If bgc is CN/CNDV then make sure none of the LAI settings are set - if ( defined($nl->get_value('stream_year_first_lai')) || - defined($nl->get_value('stream_year_last_lai')) || - defined($nl->get_value('model_year_align_lai')) || - defined($nl->get_value('stream_fldfilename_lai')) ) { - $log->fatal_error("When bgc is NOT SP none of the following can be set: stream_year_first_lai,\n" . - "stream_year_last_lai, model_year_align_lai, nor\n" . - "stream_fldfilename_lai (eg. don't use this option with BGC,CN,CNDV nor BGDCV)."); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soilwater_movement { - # soilwater_movement require clm4_5/clm5_0 - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilwater_movement_method' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upper_boundary_condition' ); - - my $soilmtd = $nl->get_value("soilwater_movement_method"); - my $use_bed = $nl->get_value('use_bedrock' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'lower_boundary_condition', 'vichydro'=>$nl_flags->{'vichydro'}, - 'soilwater_movement_method'=>$soilmtd, 'use_bedrock'=>$use_bed - ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtmin' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'verySmall' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'xTolerUpper' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'xTolerLower' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'expensive' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'inexpensive' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'flux_calculation' ); - } -} -#------------------------------------------------------------------------------- - -sub setup_logic_century_soilbgcdecompcascade { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") && - (&value_is_true($nl->get_value('use_cn')) || &value_is_true($nl->get_value('use_fates'))) && - &value_is_true($nl->get_value('use_century_decomp')) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'initial_Cstocks', - 'use_cn' => $nl->get_value('use_cn'), 'use_fates' => $nl->get_value('use_fates'), - 'use_century_decomp' => $nl->get_value('use_century_decomp') ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'initial_Cstocks_depth', - 'use_cn' => $nl->get_value('use_cn'), 'use_fates' => $nl->get_value('use_fates'), - 'use_century_decomp' => $nl->get_value('use_century_decomp') ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_cnvegcarbonstate { - # MUST be AFTER: setup_logic_dynamic_plant_nitrogen_alloc as depends on mm_nuptake_opt which is set there - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true($nl->get_value('use_cn')) ) { - my $mmnuptake = $nl->get_value('mm_nuptake_opt'); - if ( ! defined($mmnuptake) ) { $mmnuptake = ".false."; } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'initial_vegC', - 'use_cn' => $nl->get_value('use_cn'), 'mm_nuptake_opt' => $mmnuptake ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_rooting_profile { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'rooting_profile_method_water' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'rooting_profile_method_carbon' ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_friction_vel { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'zetamaxstable' ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soil_resis { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soil_resis_method' ); - } -} -#------------------------------------------------------------------------------- - -sub setup_logic_canopyfluxes { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_undercanopy_stability' ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_canopyhydrology { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'interception_fraction' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'maximum_leaf_wetted_fraction' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_clm5_fpi' ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_snowpack { - # - # Snowpack related options - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nlevsno'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'h2osno_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'int_snow_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'n_melt_glcmec'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'wind_dependent_snow_density'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'snow_overburden_compaction_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lotmp_snowdensity_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upplim_destruct_metamorph'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fresh_snw_rds_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc_ela'); - - if (remove_leading_and_trailing_quotes($nl->get_value('snow_overburden_compaction_method')) eq 'Vionnet2012') { - # overburden_compress_tfactor isn't used if we're using the Vionnet2012 - # snow overburden compaction method, so make sure the user hasn't tried - # to set it - if (defined($nl->get_value('overburden_compress_tfactor'))) { - $log->fatal_error('overburden_compress_tfactor is set, but does not apply when using snow_overburden_compaction_method=Vionnet2012'); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'overburden_compress_tfactor'); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_atm_forcing { - # - # Options related to atmospheric forcings - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glcmec_downscale_longwave'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'repartition_rain_snow'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lapse_rate'); - - my $var; - - foreach $var ("lapse_rate_longwave", - "longwave_downscaling_limit") { - if ( &value_is_true($nl->get_value("glcmec_downscale_longwave")) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if glcmec_downscale_longwave is true"); - } - } - } - - foreach $var ("precip_repartition_glc_all_snow_t", - "precip_repartition_glc_all_rain_t", - "precip_repartition_nonglc_all_snow_t", - "precip_repartition_nonglc_all_rain_t") { - if ( &value_is_true($nl->get_value("repartition_rain_snow")) ){ - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if repartition_rain_snow is true"); - } - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lnd2atm { - # - # Options related to fields sent to atmosphere - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'melt_non_icesheet_ice_runoff'); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_initinterp { - # - # Options related to init_interp - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - my $var = 'init_interp_method'; - if ( &value_is_true($nl->get_value("use_init_interp"))) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if use_init_interp is true"); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_fates { - # - # Set some default options related to Ecosystem Demography - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5") && &value_is_true( $nl_flags->{'use_fates'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'}); - my @list = ( "use_fates_spitfire", "use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys", - "use_fates_inventory_init", "use_fates_logging" ); - foreach my $var ( @list ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'use_fates'=>$nl_flags->{'use_fates'} ); - } - my $var = "use_fates_inventory_init"; - if ( defined($nl->get_value($var)) ) { - if ( &value_is_true($nl->get_value($var)) ) { - $var = "fates_inventory_ctrl_filename"; - if ( ! defined($nl->get_value($var)) ) { - $log->fatal_error("$var is required when use_fates_inventory_init is set" ); - } elsif ( ! -f "$nl->get_value($var)" ) { - $log->fatal_error("$var does NOT point to a valid filename" ); - } - } - } - } -} - -#------------------------------------------------------------------------------- - -sub write_output_files { - my ($opts, $nl_flags, $defaults, $nl, $physv) = @_; - - my $note = ""; - my $var = "note"; - if ( ! defined($opts->{$var}) ) { - $opts->{$var} = $defaults->get_value($var); - } - if ( $opts->{$var} ) { - $note = "Comment:\n" . - "This namelist was created using the following command-line:\n" . - " $nl_flags->{'cfgdir'}/$ProgName $nl_flags->{'cmdline'}\n" . - "For help on options use: $nl_flags->{'cfgdir'}/$ProgName -help"; - } - - # CLM component - my @groups; - if ( $physv->as_long() == $physv->as_long("clm4_0") ) { - @groups = qw(clm_inparm); - # Eventually only list namelists that are actually used when CN on - #if ( $nl_flags->{'bgc_mode'} eq "cn" ) { - push @groups, "ndepdyn_nml"; - #} - } else { - - @groups = qw(clm_inparm ndepdyn_nml popd_streams urbantv_streams light_streams - lai_streams atm2lnd_inparm lnd2atm_inparm clm_canopyhydrology_inparm cnphenology - clm_soilhydrology_inparm dynamic_subgrid cnvegcarbonstate - finidat_consistency_checks dynpft_consistency_checks - clm_initinterp_inparm century_soilbgcdecompcascade - soilhydrology_inparm luna friction_velocity mineral_nitrogen_dynamics - soilwater_movement_inparm rooting_profile_inparm - soil_resis_inparm bgc_shared canopyfluxes_inparm aerosol - clmu_inparm clm_soilstate_inparm clm_nitrogen clm_snowhydrology_inparm - cnprecision_inparm clm_glacier_behavior crop irrigation_inparm); - - #@groups = qw(clm_inparm clm_canopyhydrology_inparm clm_soilhydrology_inparm - # finidat_consistency_checks dynpft_consistency_checks); - # Eventually only list namelists that are actually used when CN on - #if ( $nl_flags->{'bgc_mode'} eq "cn" ) { - # push @groups, qw(ndepdyn_nml popd_streams light_streams); - #} - if ( &value_is_true($nl_flags->{'use_lch4'}) ) { - push @groups, "ch4par_in"; - } - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - push @groups, "clm_humanindex_inparm"; - push @groups, "cnmresp_inparm"; - push @groups, "photosyns_inparm"; - push @groups, "cnfire_inparm"; - push @groups, "cn_general"; - push @groups, "nitrif_inparm"; - push @groups, "lifire_inparm"; - push @groups, "ch4finundated"; - push @groups, "clm_canopy_inparm"; - } - } - - my $outfile; - $outfile = "$opts->{'dir'}/lnd_in"; - $nl->write($outfile, 'groups'=>\@groups, 'note'=>"$note" ); - $log->verbose_message("Writing clm namelist to $outfile"); - - # Drydep, fire-emission or MEGAN namelist for driver - @groups = qw(drydep_inparm megan_emis_nl fire_emis_nl carma_inparm); - $outfile = "$opts->{'dir'}/drv_flds_in"; - $nl->write($outfile, 'groups'=>\@groups, 'note'=>"$note" ); - $log->verbose_message("Writing @groups namelists to $outfile"); -} - -sub write_output_real_parameter_file { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # Output real parameters - if ( defined($opts->{'output_reals_filename'}) ) { - my $file = $opts->{'output_reals_filename'}; - my $fh = IO::File->new($file, '>>') or $log->fatal_error("can't create real parameter filename: $file"); - foreach my $var ( $definition->get_var_names() ) { - my $type = $definition->get_var_type($var); - my $doc = $definition->get_var_doc($var); - $doc =~ s/\n//g; - if ( $type =~ /real/ ) { - my $val = $nl->get_value($var); - if ( ! defined($val) ) { $val = "?.??"; } - print $fh "\! $doc\n$var = $val\n"; - } - } - $fh->close(); - } -} - -#------------------------------------------------------------------------------- - -sub add_default { - -# Add a value for the specified variable to the specified namelist object. The variables -# already in the object have the higher precedence, so if the specified variable is already -# defined in the object then don't overwrite it, just return. -# -# This method checks the definition file and adds the variable to the correct -# namelist group. -# -# The value can be provided by using the optional argument key 'val' in the -# calling list. Otherwise a default value is obtained from the namelist -# defaults object. If no default value is found this method throws an exception -# unless the 'nofail' option is set true. -# -# Example 1: Specify the default value $val for the namelist variable $var in namelist -# object $nl: -# -# add_default($inputdata_rootdir, $definition, $defaults, $nl, $var, 'val'=>$val) -# -# Example 2: Add a default for variable $var if an appropriate value is found. Otherwise -# don't add the variable -# -# add_default($inputdata_rootdir, $definition, $defaults, $nl, $var, 'nofail'=>1) -# -# -# ***** N.B. ***** This routine assumes the following variables are in package main:: -# $definition -- the namelist definition object -# $defaults -- the namelist defaults object -# $inputdata_rootdir -- CESM inputdata root directory - - my $opts = shift; - my $inputdata_rootdir = shift; - my $definition = shift; - my $defaults = shift; - my $nl = shift; - my $var = shift; - my %settings = @_; - - my $test_files = $opts->{'test'}; - #my $nl = shift; # namelist object - #my $var = shift; # name of namelist variable - #my %settings = @_; # options - - # If variable has quotes around it - if ( $var =~ /'(.+)'/ ) { - $var = $1; - } - # Query the definition to find which group the variable belongs to. Exit if not found. - - my $group = $definition->get_group_name($var); - unless ($group) { - my $fname = $definition->get_file_name(); - $log->fatal_error("variable \"$var\" not found in namelist definition file $fname."); - } - - # check whether the variable has a value in the namelist object -- if so then skip to end - my $val = $nl->get_variable_value($group, $var); - if (! defined $val) { - - # Look for a specified value in the options hash - - if (defined $settings{'val'}) { - $val = $settings{'val'}; - } - # or else get a value from namelist defaults object. - # Note that if the 'val' key isn't in the hash, then just pass anything else - # in %settings to the get_value method to be used as attributes that are matched - # when looking for default values. - else { - - $val = $defaults->get_value($var, \%settings); - - # Truncate model_version appropriately - - if ( $var eq "model_version" ) { - $val =~ /(URL: https:\/\/[a-zA-Z0-9._-]+\/)([a-zA-Z0-9\/._-]+)(\/bld\/.+)/; - $val = $2; - } - } - - # if no value is found then exit w/ error (unless 'nofail' option set) - unless ( defined($val) ) { - unless ($settings{'nofail'}) { - if ($var eq 'finidat') { - $log->message("No default value found for $var.\n" . - " Are defaults provided for this resolution and land mask?" ); - } else { - $log->fatal_error("No default value found for $var.\n" . - " Are defaults provided for this resolution and land mask?"); - } - } - else { - return; - } - } - - # query the definition to find out if the variable is an input pathname - my $is_input_pathname = $definition->is_input_pathname($var); - - # The default values for input pathnames are relative. If the namelist - # variable is defined to be an absolute pathname, then prepend - # the CESM inputdata root directory. - if (not defined $settings{'no_abspath'}) { - if (defined $settings{'set_abspath'}) { - $val = set_abs_filepath($val, $settings{'set_abspath'}); - } else { - if ($is_input_pathname eq 'abs') { - $val = set_abs_filepath($val, $inputdata_rootdir); - if ( $test_files and ($val !~ /null/) and (! -f "$val") ) { - $log->fatal_error("file not found: $var = $val"); - } - } - } - } - - # query the definition to find out if the variable takes a string value. - # The returned string length will be >0 if $var is a string, and 0 if not. - my $str_len = $definition->get_str_len($var); - - # If the variable is a string, then add quotes if they're missing - if ($str_len > 0) { - $val = quote_string($val); - } - - # set the value in the namelist - $nl->set_variable_value($group, $var, $val); - } - -} - -#------------------------------------------------------------------------------- - -sub expand_xml_variables_in_namelist { - # Go through all variables in the namelist and expand any XML env settings in them - my ($nl, $xmlvar_ref) = @_; - - foreach my $group ( $nl->get_group_names() ) { - foreach my $var ( $nl->get_variable_names($group) ) { - my $val = $nl->get_variable_value($group, $var); - my $newval = SetupTools::expand_xml_var( $val, $xmlvar_ref ); - if ( $newval ne $val ) { - $nl->set_variable_value($group, $var, $newval); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub check_input_files { - -# For each variable in the namelist which is an input dataset, check to see if it -# exists locally. -# -# ***** N.B. ***** This routine assumes the following variables are in package main:: -# $definition -- the namelist definition object -# $nl -- namelist object -# $inputdata_rootdir -- if false prints test, else creates inputdata file - - my ($nl, $inputdata_rootdir, $outfile, $definition) = @_; - - open(OUTFILE, ">>$outfile") if defined $inputdata_rootdir; - - # Look through all namelist groups - my @groups = $nl->get_group_names(); - foreach my $group (@groups) { - - # Look through all variables in each group - my @vars = $nl->get_variable_names($group); - foreach my $var (@vars) { - - # Is the variable an input dataset? - my $input_pathname_type = $definition->is_input_pathname($var); - - # If it is, check whether it exists locally and print status - if ($input_pathname_type) { - - # Get pathname of input dataset - my $pathname = $nl->get_variable_value($group, $var); - # Need to strip the quotes - $pathname =~ s/['"]//g; - - if ($input_pathname_type eq 'abs') { - if ($inputdata_rootdir) { - #MV $pathname =~ s:$inputdata_rootdir::; - print OUTFILE "$var = $pathname\n"; - } - else { - if (-e $pathname) { # use -e rather than -f since the absolute pathname - # might be a directory - print "OK -- found $var = $pathname\n"; - } - else { - print "NOT FOUND: $var = $pathname\n"; - } - } - } - elsif ($input_pathname_type =~ m/rel:(.+)/o) { - # The match provides the namelist variable that contains the - # root directory for a relative filename - my $rootdir_var = $1; - my $rootdir = $nl->get_variable_value($group, $rootdir_var); - $rootdir =~ s/['"]//g; - if ($inputdata_rootdir) { - $pathname = "$rootdir/$pathname"; - #MV $pathname =~ s:$inputdata_rootdir::; - print OUTFILE "$var = $pathname\n"; - } - else { - if (-f "$rootdir/$pathname") { - print "OK -- found $var = $rootdir/$pathname\n"; - } - else { - print "NOT FOUND: $var = $rootdir/$pathname\n"; - } - } - } - } - } - } - close OUTFILE if defined $inputdata_rootdir; - return 0 if defined $inputdata_rootdir; -} - -#------------------------------------------------------------------------------- - -sub set_abs_filepath { - -# check whether the input filepath is an absolute path, and if it isn't then -# prepend a root directory - - my ($filepath, $rootdir) = @_; - - # strip any leading/trailing whitespace and quotes - $filepath = trim($filepath); - $filepath = remove_leading_and_trailing_quotes($filepath); - $rootdir = trim($rootdir); - $rootdir = remove_leading_and_trailing_quotes($rootdir); - - my $out = $filepath; - unless ( $filepath =~ /^\// ) { # unless $filepath starts with a / - $out = "$rootdir/$filepath"; # prepend the root directory - } - return $out; -} - -#------------------------------------------------------------------------------- - -sub valid_option { - - my ($val, @expect) = @_; - - my $expect; - - $val = trim($val); - - foreach $expect (@expect) { - if ($val =~ /^$expect$/i) { return $expect; } - } - return undef; -} - -#------------------------------------------------------------------------------- - -sub check_use_case_name { -# -# Check the use-case name and ensure it follows the naming convention. -# - my ($use_case) = @_; - - my $diestring = "bad use_case name $use_case, follow the conventions " . - "in namelist_files/use_cases/README\n"; - my $desc = "[a-zA-Z0-9]*"; - my $rcp = "rcp[0-9\.]+"; - if ( $use_case =~ /^[0-9]+-[0-9]+([a-zA-Z0-9_\.]*)_transient$/ ) { - my $string = $1; - if ( $string =~ /^_($rcp)_*($desc)$/ ) { - # valid name - } elsif ( $string =~ /^_*($desc)$/ ) { - # valid name - } else { - $log->fatal_error($diestring); - } - } elsif ( $use_case =~ /^20thC([a-zA-Z0-9_\.]*)_transient$/ ) { - my $string = $1; - if ( $string =~ /^_($rcp)_*($desc)$/ ) { - # valid name - } elsif ( $string =~ /^_*($desc)$/ ) { - # valid name - } else { - $log->fatal_error($diestring); - } - } elsif ( $use_case =~ /^([0-9]+)_*($desc)_control$/ ) { - # valid name - } elsif ( $use_case =~ /^($desc)_pd$/ ) { - # valid name - } else { - $log->fatal_error($diestring); - } -} - -#------------------------------------------------------------------------------- - -sub validate_options { - -# $source -- text string declaring the source of the options being validated -# $cfg -- configure object -# $opts -- reference to hash that contains the options - - my ($source, $cfg, $opts) = @_; - - my ($opt, $old, @expect); - - # use_case - $opt = 'use_case'; - if (defined $opts->{$opt}) { - - if ( $opts->{$opt} ne "list" ) { - # create the @expect array by listing the files in $use_case_dir - # and strip off the ".xml" part of the filename - @expect = (); - my @files = glob("$opts->{'use_case_dir'}/*.xml"); - foreach my $file (@files) { - $file =~ m{.*/(.*)\.xml}; - &check_use_case_name( $1 ); - push @expect, $1; - } - - $old = $opts->{$opt}; - $opts->{$opt} = valid_option($old, @expect) - or $log->fatal_error("invalid value of $opt ($old) specified in $source\n" . - "expected one of: @expect"); - } else { - print "Use cases are:...\n\n"; - my @ucases; - foreach my $file( sort( glob($opts->{'use_case_dir'}."/*.xml") ) ) { - my $use_case; - if ( $file =~ /\/([^\/]+)\.xml$/ ) { - &check_use_case_name( $1 ); - $use_case = $1; - } else { - $log->fatal_error("Bad name for use case file = $file"); - } - my $uc_defaults = Build::NamelistDefaults->new("$file", $cfg); - printf "%15s = %s\n", $use_case, $uc_defaults->get_value("use_case_desc"); - push @ucases, $use_case; - } - $log->exit_message("use cases : @ucases"); - } - } -} - -#------------------------------------------------------------------------------- - -sub list_options { -# -# List the options for different command line values if asked for -# - my ($opts_cmdl, $definition, $defaults) = @_; - - # options to list values that are in the defaults files - my @opts_list = ( "res", "mask", "sim_year", "rcp" ); - my %opts_local; - foreach my $var ( "res", "mask", "sim_year", "rcp" ) { - my $val; - if ( $opts_cmdl->{$var} eq "list" ) { - $val = "default"; - } elsif ( $opts_cmdl->{$var} eq "default" ) { - $val = $defaults->get_value($var, \%opts_local ); - } else { - $val = $opts_cmdl->{$var}; - } - my $vname = $var; - if ( $vname eq "res" ) { $vname = "hgrid"; } - $opts_local{$vname} = $val; - } - foreach my $var ( @opts_list ) { - if (defined $opts_cmdl->{$var}) { - - if ( $opts_cmdl->{$var} eq "list" ) { - my @valid_values = $definition->get_valid_values( $var ); - if ( $var eq "sim_year" ) { - unshift( @valid_values, - $definition->get_valid_values( "sim_year_range" ) ); - } - unshift( @valid_values, "default" ); - # Strip out quotes and the constant value - for( my $i = 0; $i <= $#valid_values; $i++ ) { - $valid_values[$i] =~ s/('|')//g; - if ( $valid_values[$i] eq "constant" ) { $valid_values[$i] = undef; } - } - my $val= $defaults->get_value($var, \%opts_local); - my $doc = $definition->get_var_doc( $var ); - $doc =~ s/\n//; - chomp( $doc ); - $log->exit_message("valid values for $var ($doc) :\n" . - " Values: @valid_values\n" . - " Default = $val\n" . - " (NOTE: resolution and mask and other settings may influence what the default is)"); - } - } - } - # clm_demand - my $var = 'clm_demand'; - if (defined $opts_cmdl->{$var}) { - - if ( $opts_cmdl->{$var} eq "list" ) { - my @vars = $definition->get_var_names( ); - my @demands = ( "null" ); - foreach my $var ( @vars ) { - if ( $definition->get_group_name( $var ) ne "clm_inparm" ) { next; } - if ( defined($defaults->get_value($var, $opts_cmdl ) ) ) { - push( @demands, $var ); - } - } - my $doc = $definition->get_var_doc( 'clm_demand' ); - $doc =~ s/\n//; - chomp( $doc ); - $log->exit_message("valid values for $var ($doc) :\n" . - "Namelist options to require: @demands\n" . - "any valid namelist item for clm_inparm can be set. However, not all are\n" . - "available in the clm defaults file. The defaults are also dependent on\n" . - "resolution and landmask, as well as other settings. Hence, the list above\n" . - "will vary depending on what you set for resolution and landmask."); - } - } -} - -#------------------------------------------------------------------------------- - -sub check_megan_spec { -# -# Check the megan specifier setting -# - my ($opts, $nl, $definition) = @_; - - my $megan_spec = $nl->get_value('megan_specifier'); - my @megan_spec_list = split( /\s*,\s*/, $megan_spec ); - foreach $megan_spec ( @megan_spec_list ) { - if ( $megan_spec =~ /^['"]+[A-Za-z0-9]+\s*\=\s*([\sA-Za-z0-9+_-]+)["']+$/ ) { - my $megan_list = $1; - my @megan_cmpds = split( /\s*\+\s*/, $megan_list ); - my $var = "megan_cmpds"; - my $warn = 0; - foreach my $megan_cmpd ( @megan_cmpds ) { - if ( ! $definition->is_valid_value( $var, $megan_cmpd, 'noquotes'=>1 ) ) { - $log->warning("megan_compound $megan_cmpd NOT found in list" ); - $warn++; - } - } - if ( $warn > 0 ) { - my @valid_values = $definition->get_valid_values( $var, 'noquotes'=>1 ); - $log->warning("list of megan compounds includes:\n" . - "@valid_values\n" . - "Does your megan_factors_file include more compounds?\n" . - "If NOT your simulation will fail." ); - } - } else { - $log->fatal_error("Bad format for megan_specifier = $megan_spec"); - } - } -} - -#------------------------------------------------------------------------------- - -sub trim { - # remove leading and trailing whitespace from a string. - my ($str) = @_; - $str =~ s/^\s+//; - $str =~ s/\s+$//; - return $str; -} - -#------------------------------------------------------------------------------- - -sub quote_string { - # Add quotes around a string, unless they are already there - my ($str) = @_; - $str = trim($str); - unless ($str =~ /^['"]/) { #"' - $str = "\'$str\'"; - } - return $str; - } - -#------------------------------------------------------------------------------- - -sub remove_leading_and_trailing_quotes { - # Remove leading and trailing single and double quotes from a string. Also - # removes leading spaces before the leading quotes, and trailing spaces after - # the trailing quotes. - - my ($str) = @_; - - $str = trim($str); - - # strip any leading/trailing quotes - $str =~ s/^['"]+//; - $str =~ s/["']+$//; - - return $str; -} - -#------------------------------------------------------------------------------- - -sub logical_to_fortran { - # Given a logical variable ('true' / 'false'), convert it to a fortran-style logical ('.true.' / '.false.') - # The result will be lowercase, regardless of the case of the input. - my ($var) = @_; - my $result; - - if (lc($var) eq 'true') { - $result = ".true."; - } - elsif (lc($var) eq 'false') { - $result = ".false."; - } - else { - $log->fatal_error("Unexpected value in logical_to_fortran: $var"); - } - - return $result; -} - -#------------------------------------------------------------------------------- - -sub string_is_undef_or_empty { - # Return true if the given string is undefined or only spaces, false otherwise. - # A quoted empty string (' ' or " ") is treated as being empty. - my ($str) = @_; - if (!defined($str)) { - return 1; - } - else { - $str = remove_leading_and_trailing_quotes($str); - if ($str =~ /^\s*$/) { - return 1; - } - else { - return 0; - } - } -} - -#------------------------------------------------------------------------------- - -sub value_is_true { - # Return true if the given namelist value is .true. - # An undefined value is treated as false (with the assumption that false is the default in the code) - my ($val) = @_; - - # Some regular expressions... - ###my $TRUE = qr/\.true\./i; - ###my $FALSE = qr/\.false\./i; - # **N.B.** the use of qr// for precompiling regexps isn't supported until perl 5.005. - my $TRUE = '\.?true\.?|[t]'; - my $FALSE = '\.?false\.?|[f]'; - my $is_true = 0; - if (defined($val)) { - if ($val =~ /$TRUE/i) { - $is_true = 1; - } - } - - return $is_true; -} - -#------------------------------------------------------------------------------- - -sub version { -# The version is found in CLM ChangeLog file. -# $cfgdir is set by the configure script to the name of its directory. - - my ($cfgdir) = @_; - - my $logfile = "$cfgdir/../doc/ChangeLog"; - - my $fh = IO::File->new($logfile, '<') or $log->fatal_error("can't open ChangeLog file: $logfile"); - - while (my $line = <$fh>) { - - if ($line =~ /^Tag name:\s*([a-zA-Z0-9_. -]*[clmcesm0-9_.-]+)$/ ) { - $log->exit_message("$1"); - } - } -} - -#------------------------------------------------------------------------------- - -sub main { - my %nl_flags; - $nl_flags{'cfgdir'} = dirname(abs_path($0)); - - my %opts = process_commandline(\%nl_flags); - my $cfgdir = $nl_flags{'cfgdir'}; - check_for_perl_utils($cfgdir, \%opts); - - $log = namelist_files::LogMessages->new( $ProgName, \%opts ); # global - version($cfgdir) if $opts{'version'}; - my $cfg = read_configure_definition($cfgdir, \%opts); - - my $physv = config_files::clm_phys_vers->new( $cfg->get('phys') ); - my $definition = read_namelist_definition($cfgdir, \%opts, \%nl_flags, $physv); - my $defaults = read_namelist_defaults($cfgdir, \%opts, \%nl_flags, $cfg, $physv); - - # List valid values if asked for - list_options(\%opts, $definition, $defaults); - - # Validate some of the commandline option values. - validate_options("commandline", $cfg, \%opts); - - # Create an empty namelist object. - my $nl = Build::Namelist->new(); - - check_cesm_inputdata(\%opts, \%nl_flags); - - # Read in the env_*.xml files - my %env_xml = read_envxml_case_files( \%opts ); - - # Process the user inputs - process_namelist_user_input(\%opts, \%nl_flags, $definition, $defaults, $nl, $cfg, \%env_xml, $physv ); - # Get any other defaults needed from the namelist defaults file - process_namelist_inline_logic(\%opts, \%nl_flags, $definition, $defaults, $nl, $cfg, \%env_xml, $physv); - - # Validate that the entire resultant namelist is valid - $definition->validate($nl); - write_output_files(\%opts, \%nl_flags, $defaults, $nl, $physv); - write_output_real_parameter_file(\%opts, \%nl_flags, $definition, $defaults, $nl, $physv); - - if ($opts{'inputdata'}) { - check_input_files($nl, $nl_flags{'inputdata_rootdir'}, $opts{'inputdata'}, $definition); - } - $log->final_exit("Successfully made CLM namelist file"); -} - -#------------------------------------------------------------------------------- - -1; diff --git a/bld/README b/bld/README deleted file mode 100644 index 9f31d22bd9..0000000000 --- a/bld/README +++ /dev/null @@ -1,73 +0,0 @@ -$CTSMROOT/bld/README Jun/08/2018 - -CLM build and configure directory and scripts. Scripts to help -you prepare to build CLM as a component within CESM, and setup -a namelist for it. - -Important files/directories: - ---------- Configure and build scripts ---------- (These scripts are also used by the cesm/cime scripts) - -configure ---------------- Configure script -- sets up the CPP Macro's needed to be - defined to build CLM (only actively used for clm4_0) - ----- configure --help - Configure help mode -- sends information on all configure options -config_files/clm_phys_vers.pm ------------- Perl module to handle different CLM versions -config_files/config_defaults.xml ---------- XML file of defaults for CLM -config_files/config_defaults_*.xml -------- XML file of defaults for CLM for a specific site -config_files/config_definition_clm4_0.xml - XML file definining all CLM4.0 configuration items -config_files/config_definition_clm4_5.xml - XML file definining all CLM5.5/CLM5.0 configuration items - ---------- Scripts to build the namelists ---------- (These scripts are also used by the cesm/cime scripts) -build-namelist --- Build the namelists needed - - -env_run.xml --- Sample case runtime environment variables, so build-namelist can run outside of a case directory. - ---------- Scripts to query namelist defaults -listDefaultNamelist.pl -- List the files needed, for a list of resolutions, - to run CLM that are currently NOT on your machine. - This file can then be used by - cime/scripts/Tools/check_input_data - to retreive them from the inputdata repository. - Setting up cases with create_newcase also does - this -- but only for the exact configuration - given. This tries to get all the files need - for several different resolutions and configurations - at once. -queryDefaultNamelist.pl - Query default namelist for settings of variables -queryDefaultXML.pm ------ Subroutines needed by queryDefaultNamelist.pl script - - ---------- Test scripts directory -unit_testers --- Directory of scripts to test scipts in this directory - (most notably build-namelist and possibly configure) - ----------- XML Files describing namelists in namelist_files -namelist_files/namelist_defaults_clm4_0.xml ------- List of default values for the clm4_0 namelist -namelist_files/namelist_defaults_clm4_5.xml ------- List of default values for the clm4_5 namelist -namelist_files/namelist_defaults_clm4_5_tools.xml - List of default values for the clm4_5 tools. -namelist_files/namelist_defaults_overall.xml ------ List of default values for overall settings -namelist_files/namelist_defaults_usr_files.xml ---- List of default values for the user-files -namelist_files/namelist_definition_clm4_0.xml ----- Definition of all namelist items for clm4_0 -namelist_files/namelist_definition_clm4_5.xml ----- Definition of all namelist items for clm4_5 -namelist_files/namelist_definition.xsl ------------ Describes how to view the xml file as html -namelist_files/namelist_defaults_drydep.xml ------- List of default values for the dry deposition module. -namelist_files/use_cases -------------------------- Specific configurations that build-namelist uses -namelist_files/use_cases/README ------------------- File explaining the naming convention for use_cases - ----------- Driver namelist files, duplicated information from cime/driver/cime_config -namelist_files/namelist_defaults_drv.xml ---------- List of default values for driver namelist defaults -namelist_files/namelist_defaults_drydep.xml ------- List of default values for dry deposition fields -namelist_files/namelist_defaults_fire_emis.xml ---- List of default values for fire emission fields -namelist_files/namelist_definition_drv.xml -------- Definition of all driver namelist items -namelist_files/namelist_definition_drv_flds.xml --- Definition of add driver fieldsnamelist items - - ----------- XML helper files -namelist_files/LogMessages.pm ---- Perl module to handle log output -namelist_files/checkmapfiles.ncl -- NCL script to check that all of the mapping files are valid -namelist_files/createMapEntry.pl -- Perl script to create a map entry for the -namelist_files/history_fields.xsl - Style sheet for history fields as created by script that lists all of the - history fields from the source files (../src/main/findHistFields.pl) diff --git a/bld/build-namelist b/bld/build-namelist deleted file mode 100755 index 46e485d17c..0000000000 --- a/bld/build-namelist +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env perl -#----------------------------------------------------------------------------------------------- -# -# clm build-namelist driver -# -# Placing all of build-namelist into CLMBuildNamelist.pm means we can unit test the module. -# -require 5; - -use strict; - -BEGIN { - # ensure that the cesm create_X scripts can find CLMBuildNamelist.pm - use File::Basename qw(dirname); - use Cwd qw(abs_path); - my $dirname = dirname(abs_path($0)); - my @dirs = ($dirname, ); - unshift @INC, @dirs; -} - -use CLMBuildNamelist qw(main); - -CLMBuildNamelist::main(); diff --git a/bld/config_files/clm_phys_vers.pm b/bld/config_files/clm_phys_vers.pm deleted file mode 100755 index af6d63a887..0000000000 --- a/bld/config_files/clm_phys_vers.pm +++ /dev/null @@ -1,198 +0,0 @@ -package config_files::clm_phys_vers; -my $pkg_nm = 'config_files::clm_phys_vers'; -#----------------------------------------------------------------------------------------------- -# -# SYNOPSIS -# -# require config_files::clm_phys_vers; -# -# my $phys = config_files::clm_phys_vers->new("clm4_0"); -# print $phys->as_float(); -# print $phys->as_long(); -# print $phys->as_string(); -# print $phys->as_filename(); -# -# DESCRIPTION -# -# Enter the physics version as a string, with a list of valid versions, and have the ability to convert it to -# different formats. -# -# COLLABORATORS: None -# -#----------------------------------------------------------------------------------------------- -# -# Date Author Modification -# 03/06/2014 Erik Kluzek creation -# -#-------------------------------------------------------------------------------------------- - -use strict; -use bigint; -#use warnings; -#use diagnostics; - -my $major_mask = 1000000; -my $minor_mask = 1000; -my @version_strings = ( "clm4_0", "clm4_5", "clm5_0" ); -my @version_long = ( 4*$major_mask, 4*$major_mask+5*$minor_mask, 5*$major_mask ); - -#------------------------------------------------------------------------------- - -sub new { - # Constructor, enter version string as argument - my $class = shift; - my $vers_string = shift; - - my $nm = "$class\:\:new"; - my $self = {}; - bless($self, $class); - $self->__validate_vers__( $vers_string ); - $self->{'vers_string'} = $vers_string; - return( $self ); -} - -#------------------------------------------------------------------------------- - -sub __validate_vers__ { - # Make sure the version string is a valid one - my $class = shift; - my $vers_string = shift; - - my $found = undef; - foreach my $i (0..$#version_strings) { - if ( $vers_string eq $version_strings[$i] ) { - $found = 1; - last; - } - } - if ( ! defined($found) ) { - die "NOT a valid CLM version: $vers_string\n"; - } -} - -#------------------------------------------------------------------------------- - -sub as_long { -# Return the physics version as a long - my $self = shift; - my $vers = shift; - - if ( ! defined($vers) ) { - $vers = $self->{'vers_string'}; - } else { - $self->__validate_vers__( $vers ); - } - my $phys = undef; - for( my $i = 0; $i <= $#version_strings; $i++ ) { - if ( $vers eq $version_strings[$i] ) { - $phys = $version_long[$i]; - last; - } - } - return( $phys ); -} - -#------------------------------------------------------------------------------- - -sub as_float { -# Return the physics version as a float - my $self = shift; - - my $long = $self->as_long(); - my $major = int($long / $major_mask); - my $minor = int(($long - $major*$major_mask)/ $minor_mask); - my $rev = $long - $major*$major_mask - $minor*$minor_mask; - { - no bigint; - use bignum; - - my $phys = $major*1.0 + $minor/10.0 + $rev / 10000.0; - return( $phys ); - } -} - -#------------------------------------------------------------------------------- - -sub as_string { -# Return the physics version as a string - my $self = shift; - - my $phys = $self->{'vers_string'}; - return( $phys ); -} - -#------------------------------------------------------------------------------- - -sub as_filename { -# Return the physics version string with clm4_5 and clm5_0 pointing to the same name - my $self = shift; - - my $phys = undef; - if ( $self->as_long() < 5*$major_mask ) { - $phys = $self->as_string(); - } else { - $phys = "clm4_5"; - } - return( $phys ); -} - -#----------------------------------------------------------------------------------------------- -# Unit testing of above -#----------------------------------------------------------------------------------------------- -if ( ! defined(caller) && $#ARGV == -1 ) { - package phys_vers_unit_tester; - - require Test::More; - Test::More->import( ); - - plan( tests=>13 ); - - sub testit { - print "unit tester\n"; - my %lastv; - my @vers_list = ( "clm4_0", "clm4_5", "clm5_0" ); - foreach my $vers ( @vers_list ) { - my $phys = config_files::clm_phys_vers->new($vers); - isa_ok($phys, "config_files::clm_phys_vers", "created clm_phys_vers object"); - print "$vers: long: ".$phys->as_long()." float: ".$phys->as_float()." string: ".$phys->as_string()." file: ".$phys->as_filename()."\n"; - if ( exists($lastv{"long"}) ) { - is( $phys->as_long() > $lastv{'long'}, 1, "Definition of long is not increasing\n" ); - } - if ( exists($lastv{"float"}) ) { - is( $phys->as_float() > $lastv{'float'}, 1, "Definition of float is not increasing\n" ); - } - # Check that also can get results of any valid value for long - foreach my $chvers ( @vers_list ) { - my $lvalue = $phys->as_long($chvers); - print "Long value of $chvers = $lvalue\n"; - } - # Check that a bad value gives an error - eval { $phys->as_long('xxx'); }; - like( $@, qr/NOT a valid CLM version:/, "check that a bad version fails" ); - # Save last values to make sure increasing - $lastv{'long'} = $phys->as_long(); - $lastv{'float'} = $phys->as_float(); - } - my $phys = config_files::clm_phys_vers->new("clm4_0"); - is( 4.0, $phys->as_float(), "Make sure clm4_0 correct float value" ); - $phys = config_files::clm_phys_vers->new("clm4_5"); - no bigint; - use bignum; - is( 4.5, $phys->as_float(), "Make sure clm4_5 correct float value" ); - no bignum; - use bigint; - $phys = config_files::clm_phys_vers->new("clm5_0"); - is( 5.0, $phys->as_float(), "Make sure clm5_0 correct float value" ); - print "\nSuccessfully ran all tests\n"; - } -} - -#----------------------------------------------------------------------------------------------- -# Determine if you should run the unit test or if this is being called from a require statement -#----------------------------------------------------------------------------------------------- - -if ( defined(caller) ) { - 1 # to make use or require happy -} elsif ( $#ARGV == -1 ) { - &phys_vers_unit_tester::testit(); -} diff --git a/bld/config_files/config_defaults.xml b/bld/config_files/config_defaults.xml deleted file mode 100644 index 09d5634bb7..0000000000 --- a/bld/config_files/config_defaults.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/bld/config_files/config_defaults_1x1_mexicocityMEX.xml b/bld/config_files/config_defaults_1x1_mexicocityMEX.xml deleted file mode 100644 index 660c16715b..0000000000 --- a/bld/config_files/config_defaults_1x1_mexicocityMEX.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/bld/config_files/config_defaults_1x1_numaIA.xml b/bld/config_files/config_defaults_1x1_numaIA.xml deleted file mode 100644 index b4813d0211..0000000000 --- a/bld/config_files/config_defaults_1x1_numaIA.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/bld/config_files/config_defaults_1x1_smallvilleIA.xml b/bld/config_files/config_defaults_1x1_smallvilleIA.xml deleted file mode 100644 index b4813d0211..0000000000 --- a/bld/config_files/config_defaults_1x1_smallvilleIA.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/bld/config_files/config_defaults_1x1_vancouverCAN.xml b/bld/config_files/config_defaults_1x1_vancouverCAN.xml deleted file mode 100644 index 49d9a54afb..0000000000 --- a/bld/config_files/config_defaults_1x1_vancouverCAN.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/bld/config_files/config_definition.xsl b/bld/config_files/config_definition.xsl deleted file mode 100644 index f2f88609ef..0000000000 --- a/bld/config_files/config_definition.xsl +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - CLM Configuration Definition - - -

CLM Configuration Definition

- - - - - - - - - - - - -
CLM Physics Configurations
NameValueDescription
Valid Values
- - - - - - - - - - - - -
CLM Biogeochemistry Configurations
NameValueDescription
Valid Value
- - - - - - - - - - - - -
Configuration Directories
NameValueDescription
Valid Value
- - -
- - - - - - - - - Valid values: - - - - -
diff --git a/bld/config_files/config_definition_clm4_0.xml b/bld/config_files/config_definition_clm4_0.xml deleted file mode 100644 index aeb78d387a..0000000000 --- a/bld/config_files/config_definition_clm4_0.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - -Specifies either clm4_0, clm4_5, or clm5_0 physics - - - -CLM 4.0 Only. For CLM 4.5/5.0, spinup is controlled from build-namelist. -Spinup mode for the CN Carbon Nitrogen BGC model - AD turn on accelerated decomposition spinup for CN biogeochemistry model - exit jump from AD spinup mode to normal mode - normal no acceleration of decompositon (i.e. "final spinup") - - - -Toggle to turn on calculation of SNow and Ice Aerosol Radiation model (SNICAR) radiative forcing -(SNICAR_FRC .true.is EXPERIMENTAL NOT SUPPORTED!) - - - -Flag to turn on site specific special configuration flags for supported single -point resolutions. See the specific config_defaults_*.xml file for the special -settings that are set for a particular site. - - - -CLM Biogeochemistry mode - none = Satellite Phenology (SP) - cn = Carbon Nitrogen model (CN) - (or CLM45BGC if phys=clm4_5/clm5_0, vsoilc_centbgc='on', and clm4me='on') - cndv = Carbon Nitrogen with Dynamic Global Vegetation Model (CNDV) - (or CLM45BGCDV if phys=clm4_5/clm5_0, vsoilc_centbgc='on', and clm4me='on') - - -Toggle to turn on the prognostic crop model - - - -Root directory of CLM source distribution (directory above CLM configure). - - - -Component framework interface to use -(Model Coupling Toolkit, or Earth System Modeling Framework) - - - -User source directories to prepend to the filepath. Multiple directories -are specified as a comma separated list with no embedded white space. -Normally this is SourceMods/src.clm in your case. - - - -User specified CPP defines to append to Makefile defaults. -Note: It's recommended to use configure options to set standard CPP values rather -than defining them here. - - - -Maximum number of plant function types (PFT) per gridcell -(Setting maxpft to anything other than 17 (or 25 for clm4_5/clm5_0 CROP or 21 for clm4_0 CROP) -is EXPERIMENTAL AND NOT SUPPORTED!) -(Either 17 for a standard vegetated case or -21 for prognostic clm4_0 CROP or 25 -for prognostic clm4_5/clm5_0 CROP) - - - -Toggle to make wild-fires inactive for biogeochemistry=CN mode - - - -Toggle to turn all history output completely OFF (possibly used for testing) - - - diff --git a/bld/config_files/config_definition_clm4_5.xml b/bld/config_files/config_definition_clm4_5.xml deleted file mode 100644 index 8f57fd1844..0000000000 --- a/bld/config_files/config_definition_clm4_5.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - -Specifies either clm4_0, clm4_5, or clm5_0 physics - - - -Root directory of CLM source distribution (directory above CLM configure). - - - -Component framework interface to use -(Model Coupling Toolkit, or Earth System Modeling Framework) - - - -User source directories to prepend to the filepath. Multiple directories -are specified as a comma separated list with no embedded white space. -Normally this is SourceMods/src.clm in your case. - - - -User specified CPP defines to append to Makefile defaults. -Note: It's recommended to use configure options to set standard CPP values rather -than defining them here. - - - diff --git a/bld/configure b/bld/configure deleted file mode 100755 index fb5fe9bf7f..0000000000 --- a/bld/configure +++ /dev/null @@ -1,755 +0,0 @@ -#!/usr/bin/env perl -#----------------------------------------------------------------------------------------------- -# -# configure -# -# -# This utility allows the CLM user to specify compile-time configuration -# options via a commandline interface. The output from configure is a -# Makefile and a cache file that contains all configuration parameters -# required to produce the Makefile. A subsequent invocation of configure -# can use the cache file as input (via the -defaults argument) to reproduce -# the CLM configuration contained in it. Note that when a cache file is -# used to set default values only the model parameters are used. The -# parameters that are platform dependent (e.g., compiler options, library -# locations, etc) are ignored. -# -# As the build time configurable options of CLM are changed, this script -# must also be changed. Thus configure is maintained under revision -# control in the CLM source tree and it is assumed that only the version of -# configure in the source tree will be used to build CLM. Thus we assume -# that the root of the source tree can be derived from the location of this -# script. -# -#----------------------------------------------------------------------------------------------- - -use strict; -#use warnings; -#use diagnostics; -use Cwd qw(getcwd abs_path); -use English; -use Getopt::Long; -use IO::File; -use IO::Handle; -use File::Copy; - -#----------------------------------------------------------------------------------------------- - -sub usage { - die <). Any value that contains - white-space must be quoted. Long option names may be supplied with either single - or double leading dashes. A consequence of this is that single letter options may - NOT be bundled. - - -bgc Build CLM with BGC package [ none | cn | cndv ] - (default is none). - -cache Name of output cache file (default: config_cache.xml). - -cachedir Name of directory where output cache file is written - (default: CLM build directory). - -cimeroot REQUIRED: Path to cime directory - -clm_root Root directory of clm source code - (default: directory above location of this script) - -cppdefs A string of user specified CPP defines. Appended to - Makefile defaults. e.g. -cppdefs '-DVAR1 -DVAR2' - -crop Toggle for prognostic crop model. [on | off] (default is off) - (can ONLY be turned on when BGC type is CN or CNDV) - -comp_intf Component interface to use (ESMF or MCT) (default MCT) - -defaults Specify full path to a configuration file which will be used - to supply defaults instead of the defaults in bld/config_files. - This file is used to specify model configuration parameters only. - Parameters relating to the build which are system dependent will - be ignored. - -help [or -h] Print usage to STDOUT. - -nofire Turn off wildfires for BGC setting of CN - (default includes fire for CN) - -noio Turn history output completely off (typically for testing). - -phys Value of clm4_0, clm4_5, or clm5_0 (default is clm4_0) - -silent [or -s] Turns on silent mode - only fatal messages issued. - -sitespf_pt Setup for the given site specific single-point resolution. - -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] - (default is off) - -spinup CLM 4.0 Only. For CLM 4.5, spinup is controlled from build-namelist. - Turn on given spinup mode for BGC setting of CN (level) - AD Turn on Accelerated Decomposition from (2) - bare-soil - exit Jump directly from AD spinup to normal mode (1) - normal Normal decomposition ("final spinup mode") (0) - (default) - The recommended sequence is 2-1-0 - -usr_src [,[,[...]]] - Directories containing user source code. - -verbose [or -v] Turn on verbose echoing of settings made by configure. - -version Echo the SVN tag name used to check out this CLM distribution. -EOF -} - -#----------------------------------------------------------------------------------------------- -# Setting autoflush (an IO::Handle method) on STDOUT helps in debugging. It forces the test -# descriptions to be printed to STDOUT before the error messages start. - -*STDOUT->autoflush(); - -#----------------------------------------------------------------------------------------------- -# Set the directory that contains the CLM configuration scripts. If the configure command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script is in - # the user's PATH -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -if ($ProgDir) { - $cfgdir = abs_path($ProgDir); -} else { - $cfgdir = $cwd; -} - -#----------------------------------------------------------------------------------------------- -# Save commandline -my $commandline = "$cfgdir/configure @ARGV"; - -#----------------------------------------------------------------------------------------------- -# Parse command-line options. -my %opts = ( - cache => "config_cache.xml", - phys => "clm4_0", - nofire => undef, - noio => undef, - cimeroot => undef, - clm_root => undef, - spinup => "normal", - ); -GetOptions( - "spinup=s" => \$opts{'spinup'}, - "bgc=s" => \$opts{'bgc'}, - "cache=s" => \$opts{'cache'}, - "cachedir=s" => \$opts{'cachedir'}, - "snicar_frc=s" => \$opts{'snicar_frc'}, - "cimeroot=s" => \$opts{'cimeroot'}, - "clm_root=s" => \$opts{'clm_root'}, - "cppdefs=s" => \$opts{'cppdefs'}, - "comp_intf=s" => \$opts{'comp_intf'}, - "defaults=s" => \$opts{'defaults'}, - "clm4me=s" => \$opts{'clm4me'}, - "h|help" => \$opts{'help'}, - "nofire" => \$opts{'nofire'}, - "noio" => \$opts{'noio'}, - "phys=s" => \$opts{'phys'}, - "snicar_frc=s" => \$opts{'snicar_frc'}, - "s|silent" => \$opts{'silent'}, - "sitespf_pt=s" => \$opts{'sitespf_pt'}, - "usr_src=s" => \$opts{'usr_src'}, - "v|verbose" => \$opts{'verbose'}, - "version" => \$opts{'version'}, - "crop=s" => \$opts{'crop'}, -) or usage(); - -# Give usage message. -usage() if $opts{'help'}; - -# Echo version info. -version($cfgdir) if $opts{'version'}; - -# Check for unparsed arguments -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} - -# Define 3 print levels: -# 0 - only issue fatal error messages -# 1 - only informs what files are created (default) -# 2 - verbose -my $print = 1; -if ($opts{'silent'}) { $print = 0; } -if ($opts{'verbose'}) { $print = 2; } -my $eol = "\n"; - -my %cfg = (); # build configuration - -#----------------------------------------------------------------------------------------------- -# Make sure we can find required perl modules and configuration files. -# Look for them in the directory that contains the configure script. - -my $cimeroot = $opts{'cimeroot'}; -if ( ! defined($cimeroot) ) { - $cimeroot = "$cfgdir/../cime"; - if ( -d $cimeroot ) { - } elsif ( -d "$cfgdir/../../../cime" ) { - $cimeroot = "$cfgdir/../../../cime"; - } else { - die <<"EOF"; -** Cannot find the root of the cime directory enter it using the -cimeroot option - Did you run the checkout_externals scripts? -EOF - } -} -my $casecfgdir = "$cimeroot/scripts/Tools"; -my $perl5lib = "$cimeroot/utils/perl5lib/"; - -# The Build::Config module provides utilities to store and manipulate the configuration. -my $file = "$perl5lib/Build/Config.pm"; -(-f "$file") or die <<"EOF"; -** Cannot find perl module \"Build/Config.pm\" in path - \"$file\" ** -EOF -#----------------------------------------------------------------------------------------------- -# Add $cfgdir/perl5lib to the list of paths that Perl searches for modules -my @dirs = ( $cfgdir, "$perl5lib", $casecfgdir); -unshift @INC, @dirs; -require Build::Config; -require config_files::clm_phys_vers; - -# Get the physics version -my $phys = config_files::clm_phys_vers->new($opts{'phys'}); - -# Check for the physics specific configuration definition file. -my $phys_string = $phys->as_filename(); - -my $config_def_file = "config_definition_$phys_string.xml"; -(-f "$cfgdir/config_files/$config_def_file") or die <<"EOF"; -** Cannot find configuration definition file \"$config_def_file\" in directory - \"$cfgdir/config_files\" ** -EOF - -# The configuration defaults file modifies the generic defaults in the configuration -# definition file. Note that the -defaults option has precedence over all other options. -my $config_defaults_file; -my $std_config_defaults_file = "$cfgdir/config_files/config_defaults.xml"; -if ($opts{'defaults'}) { - $config_defaults_file = $opts{'defaults'}; -} elsif (defined($opts{'sitespf_pt'}) and $phys->as_long() == $phys->as_long( "clm4_0" ) ) { - $config_defaults_file = "$cfgdir/config_files/config_defaults_$opts{'sitespf_pt'}.xml"; - if ( ! -f $config_defaults_file ) { - $config_defaults_file = "$std_config_defaults_file"; - } -} else { - $config_defaults_file = "$std_config_defaults_file"; -} -(-f "$config_defaults_file") or die <<"EOF"; -** Cannot find configuration defaults file \"$config_defaults_file\" ** -EOF - -if ($print>=2) { print "Setting CLM configuration script directory to $cfgdir$eol"; } -if ($print>=2) { print "Using configuration defaults file $config_defaults_file$eol"; } - -# Initialize the configuration. The $config_def_file provides the definition of a CLM -# configuration, and the $config_defaults_file provides default values for a specific CLM -# configuration. $cfg_ref is a reference to the new configuration object. -my $cfg_ref = Build::Config->new("$cfgdir/config_files/$config_def_file", - "$config_defaults_file"); - -#----------------------------------------------------------------------------------------------- -# CLM root directory. -my $clm_root; - -if ( ! defined($opts{'clm_root'} ) ) { - $clm_root = abs_path("$cfgdir/.."); -} else { - $clm_root = $opts{'clm_root'}; -} - -if ( &is_valid_directory( "$clm_root/src", allowEnv=>0 ) ) { - $cfg_ref->set('clm_root', $clm_root); -} else { - die <<"EOF"; -** Invalid CLM root directory: $clm_root -** -** The CLM root directory must contain the subdirectory /src/. -** clm_root can be entered on the command line or it will be derived -** from the location of this script. -EOF -} - -if ($print>=2) { print "Setting CLM root directory to $clm_root$eol"; } - -#----------------------------------------------------------------------------------------------- -# CLM build directory is current directory -my $clm_bld = `pwd`; -chomp( $clm_bld ); - -# Make sure directory is valid -if ( ! &is_valid_directory( $clm_bld ) and ! mkdirp($clm_bld)) { - die <<"EOF"; -** Could not create the specified CLM build directory: $clm_bld -EOF -} - -if ($print>=2) { print "Setting CLM build directory to $clm_bld$eol"; } - -#----------------------------------------------------------------------------------------------- -# User source directories. -my $usr_src = ''; -if (defined $opts{'usr_src'}) { - my @dirs = split ',', $opts{'usr_src'}; - my @adirs; - while ( my $dir = shift @dirs ) { - if (&is_valid_directory( "$dir", allowEnv=>0 ) ) { - push @adirs, $dir; - } else { - die "** User source directory does not exist: $dir\n"; - } - } - $usr_src = join ',', @adirs; - $cfg_ref->set('usr_src', $usr_src); -} - -if ($print>=2) { print "Setting user source directories to $usr_src$eol"; } - -#----------------------------------------------------------------------------------------------- -# configuration cache directory and file. -my $config_cache_dir; -my $config_cache_file; -if (defined $opts{'cachedir'}) { - $config_cache_dir = abs_path($opts{'cachedir'}); -} -else { - $config_cache_dir = $clm_bld; -} - -if (&is_valid_directory( $config_cache_dir, allowEnv=>0 ) or mkdirp($config_cache_dir)) { - $config_cache_file = "$config_cache_dir/$opts{'cache'}"; -} else { - die <<"EOF"; -** Could not create the specified directory for configuration cache file: $config_cache_dir -EOF -} - -if ($print>=2) { print "The configuration cache file will be created in $config_cache_file$eol"; } - - -#----------------------------------------------------------------------------------------------- -# physics - -$cfg_ref->set('phys', $opts{'phys'}); -my $phys_string = $phys->as_string(); -if ($print>=2) { - if( defined($opts{'phys'}) ) { - print "Using version $phys_string physics.$eol"; - } -} - -#----------------------------------------------------------------------------------------------- -# supported single point configurations -my $sitespf_pt = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if( defined($opts{'sitespf_pt'}) ) { - $cfg_ref->set('sitespf_pt', $opts{'sitespf_pt'}); - } - $sitespf_pt = $cfg_ref->get('sitespf_pt'); - if ($print>=2) { - if( defined($opts{'sitespf_pt'}) ) { - print "Using $sitespf_pt for supported single point configuration.$eol"; - } - } -} - -#----------------------------------------------------------------------------------------------- -# NOIO option -my $noio = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if (defined $opts{'noio'}) { - $cfg_ref->set('noio', "on" ); - } - $noio = $cfg_ref->get('noio'); - if ($print>=2) { - if ( $noio eq "on") { print "ALL history output is turned OFF.$eol"; } - } -} -#----------------------------------------------------------------------------------------------- -# BGC option -my $bgc_mode = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if (defined $opts{'bgc'}) { - $cfg_ref->set('bgc', $opts{'bgc'}); - } - $bgc_mode = $cfg_ref->get('bgc'); - if ($print>=2) { print "Using $bgc_mode for bgc.$eol"; } - if ( $bgc_mode eq "casa" ) { - print "Warning:: bgc=casa is NOT validated / scientifically supported.$eol"; - } -} - -# NOFIRE option -- currently only in bgc=CN -my $nofire = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if (defined $opts{'nofire'}) { - $cfg_ref->set('nofire', "on" ); - } - $nofire = $cfg_ref->get('nofire'); - if ( ($nofire eq "on") && ($bgc_mode ne "cn") ) { - die <<"EOF"; -** Cannot turn nofire mode on -- without cn for bgc mode** -EOF - } - if ($print>=2 && $bgc_mode =~ /^cn/ ) { - if ( $nofire eq "off") { print "Wildfires are active as normal.$eol"; } - else { print "Wildfires are turned off.$eol"; } - } -} - -#----------------------------------------------------------------------------------------------- -# SPINUP option for BGC/CN mode only -my $spinup = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if (defined $opts{'spinup'}) { - $cfg_ref->set('spinup', $opts{'spinup'}); - } - $spinup = $cfg_ref->get('spinup'); - if ( ($spinup ne "normal" ) && ($bgc_mode ne "cn") ) { - die <<"EOF"; -** Cannot turn spinup mode on -- without cn for bgc mode** -** -** Set the bgc mode by the following means from highest to lowest precedence: -** * by the command-line option -bgc cn -** * by a default configuration file, specified by -defaults -EOF - } - if ($print>=2) { print "Using $spinup for spinup for cn mode.$eol"; } -} else { - if ($opts{'spinup'} ne "normal") { - die <<"EOF"; -** Spinup mode can only be controlled with configure for CLM 4.0. -** For CLM 4.5 use the bgc_spinup option to build-namelist -EOF - } -} - -#----------------------------------------------------------------------------------------------- -# comp_intf option -if (defined $opts{'comp_intf'}) { - $cfg_ref->set('comp_intf', $opts{'comp_intf'}); -} -my $comp_intf = $cfg_ref->get('comp_intf'); -if ($print>=2) { print "Using $comp_intf for comp_intf.$eol"; } - - -#----------------------------------------------------------------------------------------------- -# CROP option -my $crpmode = undef; -my $crop = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if (defined $opts{'crop'}) { - $cfg_ref->set('crop', $opts{'crop'}); - } - $crpmode = "nocrop"; - $crop = $cfg_ref->get('crop'); - if ( $crop eq "on" ) { - $crpmode = "crop"; - } - if ( ($crop eq "on" ) && ($bgc_mode ne "cn") && ($bgc_mode ne "cndv") ) { - die <<"EOF"; -** Cannot turn crop mode on -- without some form of cn for bgc mode** -** -** Set the bgc mode by the following means from highest to lowest precedence: -** * by the command-line options -bgc cn -** * by a default configuration file, specified by -defaults -EOF - } -} - -#----------------------------------------------------------------------------------------------- -# MAXPFT option - -my %maxpatchpft; -my $maxpft = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - $maxpatchpft{'crop'} = 21; - $maxpatchpft{'nocrop'} = 17; - - $cfg_ref->set('maxpft', $maxpatchpft{$crpmode} ); - $maxpft = $cfg_ref->get('maxpft'); - if ( (($bgc_mode eq "cn") || ($bgc_mode eq "cndv")) && ($maxpft != $maxpatchpft{$crpmode}) ) { - die <<"EOF"; -** For CN or CNDV BGC mode you MUST set max patch PFT's to $maxpatchpft{$crpmode} -** -** When the crop model is on then it must be set to $maxpatchpft{'crop'} otherwise to $maxpatchpft{'nocrop'} -** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence: -** * by the command-line options -bgc, -crop and -maxpft -** * by a default configuration file, specified by -defaults -** -EOF - } - if ( $maxpft > $maxpatchpft{$crpmode} ) { - die <<"EOF"; -** Max patch PFT's can NOT exceed $maxpatchpft{$crpmode} -** -** Set maxpft by the following means from highest to lowest precedence: -** * by the command-line options -maxpft -** * by a default configuration file, specified by -defaults -** -EOF - } - if ( $maxpft != $maxpatchpft{$crpmode} ) { - print "Warning:: running with maxpft NOT equal to $maxpatchpft{$crpmode} is " . - "NOT validated / scientifically supported.$eol"; - } - if ($print>=2) { print "Using $maxpft for maxpft.$eol"; } -} -#----------------------------------------------------------------------------------------------- -# SNICAR_FRC option -my $snicar_frc = undef; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - if (defined $opts{'snicar_frc'}) { - $cfg_ref->set('snicar_frc', $opts{'snicar_frc'}); - } - $snicar_frc = $cfg_ref->get('snicar_frc'); - if ($print>=2) { print "Using $snicar_frc for snicar_frc.$eol"; } -} - -#----------------------------------------------------------------------------------------------- -# Makefile configuration ####################################################################### -#----------------------------------------------------------------------------------------------- - -#----------------------------------------------------------------------------------------------- -# Name of CLM executable. -my $clm_exe = "clm"; - -if ($print>=2) { print "Name of CLM executable: $clm_exe.$eol"; } - -#----------------------------------------------------------------------------------------------- -# For the CPP tokens, start with the defaults (from defaults file) and append the specifications -# from the commandline. That way the user can override defaults since the commandline versions -# occur last. -my $usr_cppdefs = $cfg_ref->get('cppdefs'); -if (defined $opts{'cppdefs'}) { - $usr_cppdefs .= " $opts{'cppdefs'}"; - print "Warning:: running with user defined cppdefs is NOT validated / " . - "scientifically supported.$eol"; -} -$cfg_ref->set('cppdefs', $usr_cppdefs); - -if ($usr_cppdefs and $print>=2) { print "Default and user CPP definitions: \'$usr_cppdefs\'$eol";} - -# The following CPP macro definitions are used to implement the compile-time options. They are -# determined by the configuration parameters that have been set above. They will be appended to -# the CPP definitions that were explicitly set in the defaults file or by the user on the commandline. -my $cfg_cppdefs = ''; -if ($phys->as_long() == $phys->as_long("clm4_0") ) { - $cfg_cppdefs .= " -DMAXPATCH_PFT=$maxpft"; - - if ($bgc_mode eq 'cn') { - $cfg_cppdefs .= " -DCN"; - } - if ($crop eq 'on') { - $cfg_cppdefs .= " -DCROP"; - } - if ($bgc_mode eq 'cndv') { - $cfg_cppdefs .= " -DCNDV -DCN"; - } - if ($nofire eq 'on') { - $cfg_cppdefs .= " -DNOFIRE"; - } - if ($noio eq 'on') { - $cfg_cppdefs .= " -D_NOIO"; - } - if ($spinup eq 'AD') { - $cfg_cppdefs .= " -DAD_SPINUP"; - } elsif ($spinup eq 'exit') { - $cfg_cppdefs .= " -DEXIT_SPINUP"; - } - if ( $snicar_frc eq 'on' ) { - $cfg_cppdefs .= " -DSNICAR_FRC"; - } -} elsif ($phys->as_long() >= $phys->as_long("clm4_5") ) { - # clm4_5 cppdefs -- SHOULD NOT BE ANY! - if ( $cfg_cppdefs ne '' ) { - die <<"EOF"; -** CPP definitions should be empty for clm5_0 and is NOT ** -EOF - } -} elsif ($phys->as_long() == $phys->as_long("clm5_0") ) { - # clm5_0 cppdefs -- SHOULD NOT BE ANY! - if ( $cfg_cppdefs ne '' ) { - die <<"EOF"; -** CPP definitions should be empty for clm5_0 and is NOT ** -EOF - } -} else { - # this should NOT happen - die <<"EOF"; -** Bad CLM physics version ** -EOF -} -# CPP defines to put on Makefile -my $make_cppdefs = "$usr_cppdefs $cfg_cppdefs"; - -if ($print>=2) { print "CPP definitions set by configure: \'$cfg_cppdefs\'$eol"; } - -#----------------------------------------------------------------------------------------------- -# Write configuration files #################################################################### -#----------------------------------------------------------------------------------------------- - -my $fp_filename = 'Filepath'; # name of output filepath file -my $cpp_filename = 'CESM_cppdefs'; # name of output file for clm's cppdefs in cesm - -# Write the filepath file for cesm. -write_filepath_cesmbld("$clm_bld/$fp_filename", $cfg_ref, $phys, allowEnv=>0 ); -if ($print>=2) { print "creating $clm_bld/$fp_filename\n"; } - -# Write the file for clm's cppdefs needed in cesm. -write_cppdefs("$clm_bld/$cpp_filename", $make_cppdefs); -if ($print>=2) { print "creating $clm_bld/$cpp_filename\n"; } - -# Write the configuration file. -$cfg_ref->write_file($config_cache_file, $commandline); -if ($print>=2) { print "creating $config_cache_file\n"; } - -#----------------------------------------------------------------------------------------------- -# Done -chdir( $cwd ) || die <<"EOF"; -** Trouble changing directory back to $cwd -** -EOF -if ($print) { print "CLM configure done.\n"; } -exit; - -#----------------------------------------------------------------------------------------------- -# FINISHED #################################################################################### -#----------------------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- - -sub write_filepath_cesmbld -{ - my ($file, $cfg_ref, $phys, %opts) = @_; - my $fh = new IO::File; - - $fh->open(">$file") or die "** can't open filepath file: $file\n"; - - # configuration parameters used to determine paths - my $usr_src = $cfg_ref->get('usr_src'); - my $clm_root = $cfg_ref->get('clm_root'); - - # User specified source directories. - if ($usr_src =~ /\S+/) { - my @dirs = split ',', $usr_src; - while ( my $dir = shift @dirs ) { - print $fh "$dir\n"; - } - } else { - print $fh "../SourceMods/src.clm\n"; - } - - if ($phys->as_long() == $phys->as_long("clm4_0") ) { - # source root - my $srcdir = "$clm_root/src_clm40"; - if ( ! &is_valid_directory( "$srcdir", %opts ) ) { die "** source directory does not exist: $srcdir\n"; } - - # source directories under root - my @dirs = ( "main", "biogeophys", "biogeochem" ); - foreach my $dir ( @dirs ) { - if ( &is_valid_directory( "$srcdir/$dir", %opts ) ) { - print $fh "$srcdir/$dir\n"; - } else { - die "** source directory does not exist: $srcdir/$dir\n"; - } - } - } else { - # source root - my $srcdir = "$clm_root/src"; - if ( ! &is_valid_directory( "$srcdir", %opts ) ) { die "** source directory does not exist: $srcdir\n"; } - - # source directories under root - my @dirs = ( "main", - "biogeophys", - "biogeochem", - "soilbiogeochem", - "dyn_subgrid", - "init_interp", - "fates", - "fates/main", - "fates/biogeophys", - "fates/biogeochem", - "fates/fire", - "utils", - "cpl" ); - - foreach my $dir ( @dirs ) { - if ( &is_valid_directory( "$srcdir/$dir", %opts ) ) { - print $fh "$srcdir/$dir\n"; - } else { - die "** source directory does not exist: $srcdir/$dir\n"; - } - } - } - - - $fh->close; -} -#------------------------------------------------------------------------------- - -sub write_cppdefs -{ - my ($file, $make_cppdefs) = @_; - my $fh = new IO::File; - - $fh->open(">$file") or die "** can't open cpp defs file: $file\n"; - - print $fh "$make_cppdefs\n"; - $fh->close; -} - -#------------------------------------------------------------------------------- - -sub mkdirp { - my ($dir) = @_; - my (@dirs) = split /\//, $dir; - my (@subdirs, $path); - - # if $dir is absolute pathname then @dirs will start with "" - if ($dirs[0] eq "") { push @subdirs, shift @dirs; } - - while ( @dirs ) { # check that each subdir exists and mkdir if it doesn't - push @subdirs, shift @dirs; - $path = join '/', @subdirs; - unless (-d $path or mkdir($path, 0777)) { return 0; } - } - return 1; -} - -#------------------------------------------------------------------------------- - -sub version { -# The version is found in CLM's ChangeLog file. -# $cfgdir is set by the configure script to the name of its directory. - - my ($cfgdir) = @_; - - my $logfile = "$cfgdir/../doc/ChangeLog"; - - my $fh = IO::File->new($logfile, '<') or die "** can't open ChangeLog file: $logfile\n"; - - while (my $line = <$fh>) { - - if ($line =~ /^Tag name:\s*[clm0-9_.-]*\s*[toin]*\s*([cesmclm0-9_.-]+)$/ ) { - print "$1\n"; - exit; - } - } - -} - -#------------------------------------------------------------------------------- - -sub is_valid_directory { -# -# Validate that the input is a valid existing directory. -# - my ($dir, %opts) = @_; - my $nm = "is_valid_directory"; - - my $valid = 0; - if ( -d $dir ) { $valid = 1; } - return( $valid ); - -} - diff --git a/bld/env_run.xml b/bld/env_run.xml deleted file mode 100644 index 8bf59d0911..0000000000 --- a/bld/env_run.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/bld/listDefaultNamelist.pl b/bld/listDefaultNamelist.pl deleted file mode 100755 index 063b1e6af0..0000000000 --- a/bld/listDefaultNamelist.pl +++ /dev/null @@ -1,358 +0,0 @@ -#!/usr/bin/env perl -#======================================================================= -# -# This is a script to list the missing files in your CESM inputdata area -# for a list of resolutions and model configurations. The list goes -# out to the file: clm.input_data_list. The check_input_data script -# can then be used to get this list of files from the SVN inputdata -# repository. -# -# Usage: -# -# listDefaultNamelist.pl [options] -# -# To get help on options and usage: -# -# listDefaultNamelist.pl -help -# -# To then get the files from the CESM SVN repository: -# -# ../../cime/scripts/Tools/check_input_data -datalistdir . -export -# -#======================================================================= - -use strict; -use Cwd qw(getcwd abs_path); -use Getopt::Long; -use English; -#use diagnostics; - -#----------------------------------------------------------------------------------------------- - -my $ProgName; -($ProgName = $PROGRAM_NAME) =~ s!(.*)/!!; # name of program -my $ProgDir = $1; # name of directory where program lives - -my $cwd = getcwd(); # current working directory -my $cfgdir; - -my $printTimes = 0; - -if ($ProgDir) { $cfgdir = $ProgDir; } -else { $cfgdir = $cwd; } - -#----------------------------------------------------------------------------------------------- -# Add $cfgdir to the list of paths that Perl searches for modules - -my @dirs = ( "$cfgdir", "../../../cime/utils/perl5lib" ); -unshift @INC, @dirs; - -require queryDefaultXML; - -# Defaults -my $cesmroot = abs_path( "$cfgdir/../../../"); - -# The namelist defaults file contains default values for all required namelist variables. -my @nl_defaults_files = ( "$cfgdir/namelist_files/namelist_defaults_overall.xml", - "$cfgdir/namelist_files/namelist_defaults_drv.xml", - ); -my $list = "clm.input_data_list"; -my %list_of_all_files; - -sub usage { - die < undef, - silent => undef, - csmdata => "default", - list => $list, - usrdat => undef, - help => undef, - phys => "clm4_5", - ); - - my $cmdline = "@ARGV"; - GetOptions( - "d|csmdata=s" => \$opts{'csmdata'}, - "r|res=s" => \$opts{'res'}, - "s|silent" => \$opts{'silent'}, - "u|usrdat=s" => \$opts{'usrdat'}, - "h|elp" => \$opts{'help'}, - ) or usage(); - - # Check for unparsed arguments - if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); - } - if ( $opts{'help'} ) { - usage(); - } - # Set if should do extra printing or not (if silent mode is not set) - my $printing = 1; - if ( defined($opts{'silent'}) ) { - $printing = 0; - } - # - # Check for required arguments - # - foreach my $req ( "res", "list" ) { - if ( ! defined($opts{$req}) ) { - print "ERROR: $req NOT set and it is a required argument\n"; - usage(); - } - } - my %inputopts; - my @nl_definition_files = ( - "$cfgdir/namelist_files/namelist_definition_$opts{'phys'}.xml" - ); - $inputopts{'nldef_files'} = \@nl_definition_files; - $inputopts{'empty_cfg_file'} = "$cfgdir/config_files/config_definition_$opts{'phys'}.xml"; - - my $definition = Build::NamelistDefinition->new( $nl_definition_files[0] ); - foreach my $nl_defin_file ( @nl_definition_files ) { - $definition->add( "$nl_defin_file" ); - } - my $cfg = Build::Config->new( $inputopts{'empty_cfg_file'} ); - - # Resolutions... - my @resolutions; - if ( $opts{'res'} eq "all" ) { - @resolutions = $definition->get_valid_values( "res", 'noquotes'=>1 ); - } else { - @resolutions = split( /,/, $opts{'res'} ); - } - - # Input options - push @nl_defaults_files, "$cfgdir/namelist_files/namelist_defaults_$opts{'phys'}.xml"; - if ( defined($opts{'usrdat'}) ) { - push @nl_defaults_files, "$cfgdir/namelist_files/namelist_defaults_usr_files.xml"; - } - $inputopts{'files'} = \@nl_defaults_files; - $inputopts{'printing'} = $printing; - $inputopts{'ProgName'} = $ProgName; - $inputopts{'cmdline'} = $cmdline; - $inputopts{'cfgdir'} = $cfgdir; - if ( $opts{'csmdata'} eq "default" && $ENV{'CSMDATA'} ne "" ) { - $opts{'csmdata'} = $ENV{'CSMDATA'}; - } - $inputopts{'csmdata'} = $opts{'csmdata'}; - $inputopts{'config'} = "noconfig"; - my %files; - # - # Loop over all resolutions asked for: 1.9x2.5, 10x15, 64x128 etc. - # - foreach my $res ( @resolutions ) { - if ( ! $definition->is_valid_value( "res", "'$res'" ) && $res ne $opts{'usrdat'} ) { - die "ERROR: Input resolution: $res is NOT a valid resolution\n"; - } - $inputopts{'hgrid'} = $res; - print "Resolution = $res\n" if $printing; - my %settings; - if ( $res eq $opts{'usrdat'} ) { - $settings{'clm_usr_name'} = $opts{'usrdat'}; - $settings{'csmdata'} = $opts{'csmdata'}; - $settings{'notest'} = 1; - } - # - # Loop for all possible land masks: USGS, gx1v6, gx3v5 etc. - # - foreach my $mask ( $definition->get_valid_values( "mask", 'noquotes'=>1 ) ) { - print "Mask = $mask \n" if $printing; - $settings{'mask'} = $mask; - # - # Loop over all possible simulation year: 1890, 2000, 2100 etc. - # - $settings{'sim_year_range'} = "constant"; - my @rcps = $definition->get_valid_values( "rcp", 'noquotes'=>1 ); - $settings{'rcp'} = $rcps[0]; -YEAR: foreach my $sim_year ( $definition->get_valid_values( "sim_year", 'noquotes'=>1 ) ) { - print "sim_year = $sim_year\n" if $printing; - $settings{'sim_year'} = $sim_year; - if ( $sim_year ne 1850 && $sim_year ne 2000 && $sim_year > 1800 ) { next YEAR; } - - my @bgcsettings = $cfg->get_valid_values( "bgc" ); - #my @glc_meclasses = $cfg->get_valid_values( "glc_nec" ); - my @glc_meclasses = ( 0, 10 ); - print "glc_nec = @glc_meclasses bgc=@bgcsettings\n" if $printing; - # - # Loop over all possible BGC settings - # - my $phys = $opts{'phys'}; - foreach my $bgc ( @bgcsettings ) { - $settings{'bgc'} = $bgc; - my @crop_vals; - if ( $bgc =~ /^cn/ ) { - @crop_vals = ( "on", "off" ); - } else { - @crop_vals = ( "off" ); - } - # - # Loop over all possible glc_nec settings - # - foreach my $glc_nec ( @glc_meclasses ) { - $settings{'glc_nec'} = $glc_nec; - # - # Loop over all possible crop settings - # - foreach my $crop ( @crop_vals ) { - $settings{'crop'} = $crop; - if ( $crop eq "on" ) { - $settings{'maxpft'} = 78; - } else { - $settings{'maxpft'} = 17; - } - my @irrigset; - if ( $glc_nec == 0 && $sim_year == 2000 ) { - @irrigset= ( ".true.", ".false." ); - } else { - @irrigset= ( ".false." ); - } - # - # Loop over irrigation settings - # - foreach my $irrig ( @irrigset ) { - $settings{'irrig'} = $irrig; - $inputopts{'namelist'} = "clm_inparm"; - &GetListofNeededFiles( \%inputopts, \%settings, \%files ); - if ( $printTimes >= 1 ) { - $inputopts{'printing'} = 0; - } - } - } - } - } - } - # - # Now do sim-year ranges - # - $settings{'bgc'} = "cn"; - $settings{'irrig'} = ".false."; - $inputopts{'namelist'} = "clm_inparm"; - foreach my $sim_year_range ( $definition->get_valid_values( "sim_year_range", 'noquotes'=>1 ) ) { - $settings{'sim_year_range'} = $sim_year_range; - if ( $sim_year_range =~ /([0-9]+)-([0-9]+)/ ) { - $settings{'sim_year'} = $1; - } - # - # Loop over all possible rcp's - # - print "sim_year_range=$sim_year_range rcp=@rcps\n" if $printing; - foreach my $rcp ( @rcps ) { - $settings{'rcp'} = $rcp; - &GetListofNeededFiles( \%inputopts, \%settings, \%files ); - if ( $printTimes >= 1 ) { - $inputopts{'printing'} = 0; - } - } - } - } - } - # - # Loop over directories that need to have files copied into - # - my $hostname; - my $csmdata = $inputopts{'csmdata'}; - open( OUT, ">$list" ) || die "ERROR: trouble opening output file: $list"; - foreach my $dir ( sort(keys(%files)) ) { - if ( $dir eq "." ) { next; } - if ( $dir eq "/" ) { next; } - if ( $dir eq "\n" ) { next; } - if ( $dir eq "" ) { next; } - if ( ! defined($dir) ) { next; } - my $files_ref = $files{$dir}; - my @files = @$files_ref; - foreach my $file ( @files ) { - if ( $file !~ /\n$/ ) { $file = "$file\n"; } - print OUT "file = \$DIN_LOC_ROOT/$file"; - } - } - close( OUT ); - if ( $printing ) { - print "\n\nSuccessful\n\n" - } diff --git a/bld/namelist_files/LogMessages.pm b/bld/namelist_files/LogMessages.pm deleted file mode 100755 index 77f0569bcc..0000000000 --- a/bld/namelist_files/LogMessages.pm +++ /dev/null @@ -1,244 +0,0 @@ -package namelist_files::LogMessages; -my $pkg_nm = 'namelist_files::LogMessages'; -#----------------------------------------------------------------------------------------------- -# -# SYNOPSIS -# -# require namelist_files::LogMessages; -# -# my %opts; -# my $log = namelist_files::LogMessages->new("ProgName", \%opts); -# $log->message("message to print"); -# $log->verbose_message("message to print only if verbose mode is on"); -# $log->warning("Warning message"); -# $log->exit_message("clean exit"); -# $log->fatal_error("die with fatal error"); -# $log->final_exit("Final message to send (and exit"); -# -# -# DESCRIPTION -# -# Handles log messages for perl. Sets up log messages according to verbose -# or silent setting. It also handles warnings printing them, but on finalization -# aborting unless ignore_warnings was set. -# -# COLLABORATORS: None -# -#----------------------------------------------------------------------------------------------- -# -# Date Author Modification -# 10/06/2017 Erik Kluzek creation -# -#-------------------------------------------------------------------------------------------- - -use strict; -#use warnings; -#use diagnostics; - -#------------------------------------------------------------------------------- - -sub new { - my $class = shift; - my $ProgName = shift; - my %opts = %{shift()}; - - my $nm = "$class\:\:new"; - my $self = {}; - bless($self, $class); - $self->{'nwarns'} = 0; - $self->{'verbosity'} = 1; - $self->{'NO_EXIT'} = $opts{'NO_EXIT'}; - $self->{'ProgName'} = $ProgName; - $self->{'ignore_warnings'} = $opts{'ignore_warnings'}; - $self->__set_print_level( \%opts ); - return( $self ); -} - - -#------------------------------------------------------------------------------- - -sub __set_print_level { - my $self = shift; - # Define print levels: - # 0 - only issue fatal error messages - # 1 - only informs what files are created (default) - # 2 - verbose - my %opts = %{shift()}; - - if ( $opts{'silent'} && $opts{'verbose'} ) { - $self->fatal_error( "Can not set both the -silent and the -verbose options -- set one or the other" ); - } - my $verbosity = 1; - if ($opts{'silent'}) { $verbosity = 0; } - if ($opts{'verbose'}) { $verbosity = 2; } - $self->{'verbosity'} = $verbosity; - $self->{'print_verbose'} = 2; -} - -#------------------------------------------------------------------------------- - -sub message { - my $self = shift; - my ($message) = @_; - if ($self->{'verbosity'} > 0) { - print "$message\n"; - } -} - -#------------------------------------------------------------------------------- - -sub verbose_message { - my $self = shift; - - my ($message) = @_; - if ($self->{'verbosity'} >= $self->{'print_verbose'}) { - print "$message\n"; - } -} -#------------------------------------------------------------------------------- - -sub nwarns { - my $self = shift; - - return( $self->{'nwarns'} ); -} - -#------------------------------------------------------------------------------- - -sub final_exit { - my $self = shift; - my ($message) = @_; - if ( $self->{'nwarns'} > 0 ) { - $self->message( "\n\nYou ran with the -ignore_warnings options and allowed $self->{'nwarns'} to go past\n" ); - } - $self->verbose_message( $message ); - if ( $self->{'NO_EXIT'} ) { - die - } else { - exit; - } -} - -#------------------------------------------------------------------------------- -# Some simple subroutines to do a clean exit, print warning, or a fatal error - -sub exit_message { - my $self = shift; - my ($message) = @_; - print "$self->{ProgName} : $message\n"; - if ( $self->{'NO_EXIT'} ) { - die - } else { - exit; - } -} - -#------------------------------------------------------------------------------- - -sub warning { - my $self = shift; - my $message = shift; - - $self->{'nwarns'} = $self->{'nwarns'} + 1; - my $func_name = (caller(1))[3]; - if ( $self->{'ignore_warnings'} ) { - print "Warning : $self->{ProgName}::${func_name}() : $message\n\n"; - } else { - die "Warning : $self->{ProgName}::${func_name}() : $message\n" . - " -- Add -ignore_warnings option to CLM_BLDNML_OPTS to ignore this warning\n\n"; - } -} - -#------------------------------------------------------------------------------- - -sub fatal_error { - my $self = shift; - my ($message) = @_; - my $func_name = (caller(1))[3]; - die "ERROR : $self->{ProgName}::${func_name}() : $message\n"; -} - -#------------------------------------------------------------------------------- - -#----------------------------------------------------------------------------------------------- -# Unit testing of above -#----------------------------------------------------------------------------------------------- -if ( ! defined(caller) && $#ARGV == -1 ) { - package LogMessage_unit_tester; - - require Test::More; - Test::More->import( ); - - plan( tests=>11 ); - - sub testit { - print "unit tester\n"; - my %opts; - my $message; - - # Standard verbose level, test all methods - $opts{'NO_EXIT'} = 1; - my $log = namelist_files::LogMessages->new("ProgName", \%opts); - isa_ok($log, "namelist_files::LogMessages", "Created LogMessages object"); - $log->message("message to print"); - $log->verbose_message("YOU SHOULD NOT SEE THIS MESSAGE BECAUSE IT IS VERBOSE AND VERBOSE NOT ON"); - $message = "Warning message"; - is ( $log->nwarns(), 0, "Make sure have zero warnings" ); - eval{ $log->warning($message); }; - like( $@, qr/$message/, "check that a warning dies without ignore_warnings option" ); - is ( $log->nwarns(), 1, "Make sure have one warning" ); - $message = "die with fatal error"; - eval{ $log->fatal_error($message); }; - like( $@, qr/$message/, "check that a fatal_error dies" ); - $message = "exit with exit message"; - eval{ $log->exit_message($message); }; - like( $@, qr/Died/, "check that a exit_message exits" ); - $message = "Final message to send"; - eval{ $log->final_exit($message); }; - like( $@, qr/Died/, "check that a final exits" ); - - # Test ignore_warnings option and verbose mode - $opts{'ignore_warnings'} = 1; - $opts{'verbose'} = 1; - $opts{'NO_EXIT'} = 1; - $log = namelist_files::LogMessages->new("ProgName", \%opts); - isa_ok($log, "namelist_files::LogMessages", "Created LogMessages object"); - $log->verbose_message("message to print only if verbose mode is on"); - $log->warning("Warning message"); - $log->warning("Warning message2"); - $log->warning("Warning message3"); - $log->warning("Warning message4"); - $log->warning("Warning message5"); - is ( $log->nwarns(), 5, "Make sure have five warnings" ); - eval{ $log->final_exit($message); }; - print "content: $@\n"; - like( $@, qr/Died/, "check that a final_exit with warning exits" ); - # silent mode - $opts{'ignore_warnings'} = 0; - $opts{'verbose'} = 0; - $opts{'silent'} = 1; - $opts{'NO_EXIT'} = 1; - $log = namelist_files::LogMessages->new("ProgName", \%opts); - $log->message("YOU SHOULD NOT SEE THIS MESSAGE BECAUSE SILENT MODE IS ON"); - $log->verbose_message("YOU SHOULD NOT SEE THIS VERBOSE MESSAGE BECAUSE SILENT MODE IS ON"); - # Should die with error if both silent and verbose mode is on - $opts{'ignore_warnings'} = 0; - $opts{'verbose'} = 1; - $opts{'silent'} = 1; - $opts{'NO_EXIT'} = 1; - eval{ $log = namelist_files::LogMessages->new("ProgName", \%opts); }; - print "content: $@\n"; - like( $@, qr/ERROR : /, "check that died if both verbose and silent mode is on" ); - print "\nSuccessfully ran all tests\n"; - } -} - -#----------------------------------------------------------------------------------------------- -# Determine if you should run the unit test or if this is being called from a require statement -#----------------------------------------------------------------------------------------------- - -if ( defined(caller) ) { - 1 # to make use or require happy -} elsif ( $#ARGV == -1 ) { - &LogMessage_unit_tester::testit(); -} diff --git a/bld/namelist_files/checkmapfiles.ncl b/bld/namelist_files/checkmapfiles.ncl deleted file mode 100644 index 6302615d1c..0000000000 --- a/bld/namelist_files/checkmapfiles.ncl +++ /dev/null @@ -1,236 +0,0 @@ -; -; Check that the *_b values are the same between the mapping files -; at the same output resolution. -; -; Erik Kluzek -; Nov/18/2011 -; $Id$ -; $HeadURL; -; - - print( "Check that datm mapping files are consistent" ); - resolutions = (/ "128x256", "64x128", "48x96", "32x64", "8x16", "94x192", "0.23x0.31", "0.47x0.63", "0.9x1.25", "1.9x2.5", "2.5x3.33", "4x5", "10x15", "5x5_amazon", "1x1_camdenNJ", "1x1_vancouverCAN", "1x1_mexicocityMEX", "1x1_asphaltjungleNJ", "1x1_brazil", "1x1_urbanc_alpha", "1x1_numaIA", "1x1_smallvilleIA", "ne4np4", "ne16np4", "ne30np4", "ne60np4", "ne120np4", "ne240np4" /); - - space = " "; - badres = 0 - badresolutions = new( (/ 1000 /), string ) - chkres = 0 - chkresolutions = new( (/ 1000 /), string ) - -procedure checkit( desc:string, maxdiff:numeric, res:string, lmask:string, eps:numeric ) -; -; check that difference is within reasonable tolerance... -; -begin - reso = res+"_"+lmask; - if ( maxdiff .gt. eps )then - print( space+space+space+desc+" are off by more than tolerance for "+reso+" resolution" ); - print( space+space+space+"maximum difference = "+maxdiff ); - if ( .not. any(badresolutions .eq. reso ) )then - badresolutions(badres) = reso; - badres = badres + 1 - end if - else - print( space+space+space+"File OK for "+desc+"!" ); - end if - if ( .not. any(chkresolutions .eq. reso ) )then - chkresolutions(chkres) = reso; - chkres = chkres + 1 - end if -end - - -function checkdims( desc:string, dsizefile1 [*]:integer, dsizefile2 [*]:integer, res:string, lmask:string ) -; -; check that dimensions are the same between the file variables -; -begin - reso = res+"_"+lmask; - if ( any( dsizefile1 .ne. dsizefile2) )then - print( space+space+space+desc+" dimensions are different for "+reso+" resolution" ); - print( space+space+space+"dim first file "+dsizefile1 ); - print( space+space+space+"dim second file "+dsizefile2 ); - if ( .not. any(badresolutions .eq. reso ) )then - badresolutions(badres) = reso; - badres = badres + 1 - end if - return( False ); - else - print( space+space+space+"File dims OK for "+desc+"!" ); - return( True ); - end if - if ( .not. any(chkresolutions .eq. reso ) )then - chkresolutions(chkres) = reso; - chkres = chkres + 1 - end if -end - -begin - - csmdata = getenv("CSMDATA"); - clmroot = getenv("CLM_ROOT"); - querynml = "bld/queryDefaultNamelist.pl -silent -justvalue -namelist clmexp"; - if ( .not. ismissing(csmdata) )then - querynml = querynml+" -csmdata "+csmdata; - end if - if ( ismissing(clmroot) )then - querynml = "../../"+querynml; - else - querynml = clmroot+"/components/clm/"+querynml; - end if - - print( "query string="+querynml ) - - - mapgrids = (/"0.5x0.5_MODIS", "0.5x0.5_AVHRR", "0.5x0.5_MODIS", "5x5min_nomask", "5x5min_IGBP-GSDP", "5x5min_ISRIC-WISE", "10x10min_nomask", "3x3min_MODIS", "3x3min_LandScan2004", "3x3min_GLOBE-Gardner", "3x3min_GLOBE-Gardner-mergeGIS", "0.9x1.25_GRDC", "360x720cru_cruncep", "1km-merge-10min_HYDRO1K-merge-nomask"/); - do i = 0, dimsizes(resolutions)-1 - res = resolutions(i); - print( "Go through maps for Resolution: "+res ); - do j = 0, dimsizes(mapgrids)-1 - grid = str_get_field( mapgrids(j), 1, "_" ); - lmask = str_get_field( mapgrids(j), 2, "_" ); - print( space+"Look for maps from Grid: "+grid+"_"+lmask); - - querynmlres = querynml+" -options frm_lmask="+lmask+",frm_hgrid="+grid+",to_hgrid="+res+",to_lmask=nomask"; - ; - ; Get map filename and open it - ; - mapfile = systemfunc( querynmlres+" -var map" ); - if ( systemfunc("test -f "+mapfile+"; echo $?" ) .ne. 0 )then - delete( mapfile ); - continue; - end if - print( space+"Use mapfile: "+mapfile ); - ncm = addfile( mapfile, "r" ); - - if ( .not. isvar("ncm0") )then - ncm0 = ncm; - else - vars = (/"yc_b", "xc_b", "area_b", "xv_b", "yv_b" /); - k = 0; - if ( checkdims( vars(k), dimsizes(ncm->$vars(k)$), dimsizes(ncm0->$vars(k)$), res, "nomask" ) )then - do k = 0, dimsizes(vars)-1 - maxdiff = max( abs(ncm->$vars(k)$ - ncm0->$vars(k)$) ); - checkit( vars(k), maxdiff, res, "nomask", 1.e-12 ); - delete( maxdiff ); - end do - var = "mask_b" - imaxdiff = max( abs(ncm->$var$ - ncm0->$var$) ); - checkit( var, imaxdiff, res, "nomask", 1.e-12 ); - delete( imaxdiff ); - end if - delete( ncm ); - end if - delete( mapfile ); - - end do - - delete( grid ); - delete( lmask ); - delete( res ); - if ( isvar("ncm0") )then - delete( ncm0 ); - end if - - end do - ; - ; go the other direction now check the _a variables - ; - mksrf_files = (/"mksrf_fvegtyp", "mksrf_fglacier", "mksrf_furbtopo", "mksrf_flai", "mksrf_fsoitex", "mksrf_fsoicol", "mksrf_ffrac", "mksrf_fmax", "mksrf_ftopo", "mksrf_firrig", "mksrf_forganic", "mksrf_flakwat", "mksrf_fwetlnd", "mksrf_furban", "mksrf_fvocef"/) - do i = 0, dimsizes(mapgrids)-1 - grid = str_get_field( mapgrids(i), 1, "_" ); - lmask = str_get_field( mapgrids(i), 2, "_" ); - print( "Grid: "+grid); - print( "Mask: "+lmask); - do j = 0, dimsizes(resolutions)-1 - res = resolutions(j); - print( "res: "+res ); - - querynmlres = querynml+" -options frm_lmask="+lmask+",frm_hgrid="+grid+",to_hgrid="+res+",to_lmask=nomask"; - ; - ; Get map filename and open it - ; - mapfile = systemfunc( querynmlres+" -var map" ); - if ( systemfunc("test -f "+mapfile+"; echo $?" ) .ne. 0 )then - delete( mapfile ); - continue; - end if - print( space+"Use mapfile: "+mapfile ); - ncm = addfile( mapfile, "r" ); - - if ( .not. isvar("ncm0") )then - ncm0 = ncm; - else - vars = (/"yc_a", "xc_a", "area_a", "xv_a", "yv_a" /); - vars2 = (/"LATIXY", "LONGXY", "AREA" /); - k = 0; - if ( checkdims( vars(k), dimsizes(ncm->$vars(k)$), dimsizes(ncm0->$vars(k)$), res, "nomask" ) )then - do k = 0, dimsizes(vars)-1 - maxdiff = max( abs(ncm->$vars(k)$ - ncm0->$vars(k)$) ); - checkit( vars(k), maxdiff, res, "nomask", 1.e-12 ); - delete( maxdiff ); - end do - end if - var = "mask_a" - imaxdiff = max( abs(ncm->$var$ - ncm0->$var$) ); - checkit( var, imaxdiff, res, "nomask", 1.e-12 ); - delete( imaxdiff ); - ; - ; Get mksurfdata input datasets - ; - do k = 0, dimsizes(mksrf_files)-1 - srffile = systemfunc( querynmlres+" -var "+mksrf_files(k) ); - if ( systemfunc("test -f "+srffile+"; echo $?" ) .ne. 0 )then - delete( srffile ); - continue; - end if - print( space+"Use srffile: "+srffile ); - ncs = addfile( srffile, "r" ); - n = 0; - if ( checkdims( vars(n), dimsizes(ncm->$vars(n)$), ndtooned(dimsizes(ncs->$vars2(n)$)), res, "nomask" ) )then - do n = 0, dimsizes(vars2)-1 - maxdiff = max( abs(ncm->$vars(n)$ - ndtooned(ncs->$vars2(n)$)) ); - checkit( vars(n), maxdiff, res, "nomask", 1.e-12 ); - delete( maxdiff ); - end do - var = "mask_a" - var2 = "LANDMASK" - imaxdiff = max( abs(ncm->$var$ - ndtooned(ncs->$var2$)) ); - checkit( var, imaxdiff, res, "nomask", 1.e-12 ); - end if - delete( ncs ); - end do - delete( ncm ); - end if - delete( mapfile ); - - end do - - if ( isvar("vars") )then - delete( vars ) - end if - if ( isvar("vars2") )then - delete( vars2 ) - end if - delete( grid ); - delete( lmask ); - delete( res ); - if ( isvar("ncm0") )then - delete( ncm0 ); - end if - - end do - if ( chkres .gt. 0 )then - print( "resolutions checked = " ); - print( chkresolutions(0:chkres-1) ); - end if - if ( badres .gt. 0 )then - print( "badresolutions = " ); - print( badresolutions(0:badres-1) ); - end if - - print( "===============================" ); - print( "Successfully went through files" ); - -end - diff --git a/bld/namelist_files/createMapEntry.pl b/bld/namelist_files/createMapEntry.pl deleted file mode 100755 index d767eff939..0000000000 --- a/bld/namelist_files/createMapEntry.pl +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env perl -# -# July 18 2012 Muszala -# -# createMapEntry.pl - A simple script to dump a list of mappings for a specified resolution to then -# cut and paste into namelist_defaults_clm.xml. A better way is to write the output of this script -# to a file and then directly insert that file into namelist_defaults_clm.xml (using :r foo in vim for -# example). -# -# Example usage:>> ./createMapEntry.pl 1x1_brazil -# will create XML entries for maps in ../lnd/clm2/mappingdata/maps/1x1_brazil such as: -# -# lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_AVHRR_to_1x1_brazil_nomask_aave_da_c120717.nc -# -use Cwd; -use strict; -use English; -use IO::File; -use Getopt::Long; - - my $date = scalar localtime() ; - my $scriptName; - ($scriptName = $0) =~ s!(.*)/!!; # get name of script - my $cwd = getcwd(); - my $CSMDATA = "/glade/p/cesm/cseg/inputdata"; - - if ($#ARGV != 0 ) { - usage(); - exit; - } - my $grid=$ARGV[0]; - - sub usage { - die < - is the resolution to use to dump text to paste into namelist_defaults_clm.xml -EOF - } - - #~# set up directory paths - my $pathStub="lnd/clm2/mappingdata/maps"; - my $partialPath="$pathStub/$grid"; - my $fullPath = "$CSMDATA/$partialPath"; - - #~# open and read directory - opendir DIR, $fullPath or die "Cannot read dir! $fullPath"; - my @list = readdir DIR; - - #~# print a unique start string in the XML comments - print "\n"; - print "\n \n\n"; - - foreach my $foo ( @list ) { - next if ($foo =~ m/^\./); #~# skip anything in the directory with a leading or stand alone 'dot' - my @tokens = split(/_/, $foo); #~# split foo name by the underscore - #~# write out lines for namelist_defaults_clm.xml - print "$partialPath/$foo\n"; - } - - #~# print a unique end string in the XML comments - print "\n \n"; - closedir(DIR); - exit 0; diff --git a/bld/namelist_files/history_fields.xsl b/bld/namelist_files/history_fields.xsl deleted file mode 100644 index 25c2332e9d..0000000000 --- a/bld/namelist_files/history_fields.xsl +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - CLM History Fields - - -
-

Definition of CLM history variables

-

Included in the table are the following pieces of information:

-
    -
  • Variable name.
  • -
  • Long name description.
  • -
  • units
  • -
- - - - - - - - - - - - - - - - -
CLM History Fields
NameLong-nameUnits
-
- - -
- -
diff --git a/bld/namelist_files/namelist_defaults.xsl b/bld/namelist_files/namelist_defaults.xsl deleted file mode 100644 index bfebd0db89..0000000000 --- a/bld/namelist_files/namelist_defaults.xsl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - CLM Namelist Defaults - - -

Default Values for Namelist Variables

-

Included in the table are the following pieces of information:

-

Table headers include:

-
    -
  • Name of variable
  • -
  • Horizontal grid resolution
  • -
  • Land ocean mask type
  • -
  • Simulation year
  • -
  • Simulation year range (for transient datasets)
  • -
-

Miscellaneous items include:

-
    -
  1. Biogeochemistry (BGC) type (none, CN, CNDV)
  2. -
  3. Initial condition date (ymd - year month day)
  4. -
  5. Initial condition time of day (tod) (sec)
  6. -
  7. Maximum number of Plant Function Types (maxpft)
  8. -
  9. Number of glacier multiple elevation classes (glc_nec)
  10. -
  11. Site specific point name (sitespf_pt)
  12. -
  13. Crop model (crop)
  14. -
  15. Irrigation model (irrig) (clm4_0 only)
  16. -
  17. Data model forcing source (forcing)
  18. -
  19. Representative concentration pathway for future scenarios (rcp)
  20. -
  21. New good wood harvest (newwoodharv)
  22. -
  23. CN Spin-up mode (spinup)
  24. -
  25. Type of file (type)
  26. -
  27. Grid mapping to (to_hgrid)
  28. -
  29. Land-mask mapping to (to_lmask)
  30. -
  31. High resolution file? (hires)
  32. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Namelist Defaults
NameHorz. GridMaskSim yearSim year rangeMiscellaneous
Default Value for this Configuration
- - - - - - - - - - - All res - - - - - - - - - - - - - - - MODIS - - - All masks - - - - - - - - - All yrs - - - - - - - - - All sim-yr-rng - - - - - bgc= - - - ymd= - - - tod= - - - maxpft= - - - glc_nec= - - - sitespf_pt= - - - datm_presaero= - - - crop= - - - irrig= - - - spinup= - - - forcing= - - - rcp= - - - newwoodharv= - - - type= - - - to_hgrid= - - - to_lmask= - - - hires= - -
Value:
- - - - -
- -
diff --git a/bld/namelist_files/namelist_defaults_clm4_0.xml b/bld/namelist_files/namelist_defaults_clm4_0.xml deleted file mode 100644 index 3dc98acb75..0000000000 --- a/bld/namelist_files/namelist_defaults_clm4_0.xml +++ /dev/null @@ -1,1069 +0,0 @@ - - - - - - - - -1800 - - -379.0 -379.0 -284.7 - - -constant - - -PROG_CROP_ONLY -PROG_CROP_ONLY -NONE -NONE - - -clm4_0_CRUv7 - - -off - - -.true. -'TOTECOSYSC','TOTECOSYSN','TOTSOMC','TOTSOMN','TOTVEGC','TOTVEGN','TLAI','GPP','NPP','TWS','TSAI','HTOP','HBOT' -'TOTECOSYSC','TOTECOSYSN','TOTSOMC','TOTSOMN','TOTVEGC','TOTVEGN','TLAI','GPP','NPP','TWS' -'TLAI','TWS' --8760 - - -.false. - - -0 -1 - - -0.80,0.55 -0.60,0.40 -0.60,0.40 -0.60,0.40 -0.60,0.40 -0.60,0.40 - - -ON_WASTEHEAT - - -.false. - - - - - -lnd/clm2/pftdata/pft-physiology.clm40.c130424.nc - - -lnd/clm2/initdata/clmi.BCN.0182-01-01_0.47x0.63_g1v6_simyr1850_c120324.nc - - -lnd/clm2/initdata/clmi.BCN.0182-01-01_0.47x0.63_g1v6_simyr1850_c120324.nc - - -lnd/clm2/initdata/clmi.BCN.0182-01-01_0.47x0.63_g1v6_simyr1850_c120324.nc - - - - - -lnd/clm2/initdata_map/clmi.I1850Clm40CnGswGs.1441-01-01.0.9x1.25_gx1v6_simyr1850_c170823.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm40CnGswGs.1441-01-01.0.9x1.25_gx1v6_simyr1850_c170823.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm40CnCruGs.3362-01-01.0.9x1.25_gx1v6_simyr1850_c171222.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm40CnCruGs.3362-01-01.0.9x1.25_gx1v6_simyr1850_c171222.nc - - - - -lnd/clm2/initdata/clmi.IQirrcr_2000-01-01_1.9x2.5_gx1v6_c101115.nc - - -ccsm4_init/b40.1850.track1.2deg.003/year_401/b40.1850.track1.2deg.003.clm2.r.0401-01-01-00000.nc - - -ccsm4_init/b40.1850.track1.2deg.003/year_401/b40.1850.track1.2deg.003.clm2.r.0401-01-01-00000.nc - - -ccsm4_init/b40.1850.track1.2deg.003/year_401/b40.1850.track1.2deg.003.clm2.r.0401-01-01-00000.nc - - -lnd/clm2/initdata/clmi.IQCNDV.0201-01-01_1.9x2.5_gx1v6_simyr2000_c100316.nc - - -ccsm4_init/b40.1850.track1.1deg.006/0863-01-01/b40.1850.track1.1deg.006.clm2.r.0863-01-01-00000.nc - - -ccsm4_init/b40.1850.track1.1deg.006/0863-01-01/b40.1850.track1.1deg.006.clm2.r.0863-01-01-00000.nc - - -ccsm4_init/b40.1850.track1.1deg.006/0863-01-01/b40.1850.track1.1deg.006.clm2.r.0863-01-01-00000.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_0.9x1.25_gx1v6_simyr2000_c100303.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_0.9x1.25_gx1v6_simyr2000_c100303.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_0.9x1.25_gx1v6_simyr2000_c100303.nc - - - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_1.9x2.5_gx1v6_simyr2000_c100309.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_1.9x2.5_gx1v6_simyr2000_c100309.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_1.9x2.5_gx1v6_simyr2000_c100309.nc - - -lnd/clm2/initdata/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c100322.nc - - -lnd/clm2/initdata/clmi.IQCNCROPmp20_1992-01-01_1.9x2.5_gx1v6_simyr2000_c110427.nc - - - - -lnd/clm2/initdata/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c100322.nc - - -lnd/clm2/initdata/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c100322.nc - - -lnd/clm2/initdata/clmi.BCN.1949-01-01_4x5_gx3v7_simyr1850_c100322.nc - - -lnd/clm2/initdata/clmi.BCN.1949-01-01_4x5_gx3v7_simyr1850_c100322.nc - - -lnd/clm2/initdata/clmi.BCN.1949-01-01_4x5_gx3v7_simyr1850_c100322.nc - - -lnd/clm2/initdata/clmi.BCN.0507-01-01_48x96_gx3v7_simyr1850_c120929.nc - - -lnd/clm2/initdata/clmi.BCN.0507-01-01_48x96_gx3v7_simyr1850_c120929.nc - - -lnd/clm2/initdata/clmi.BCN.0507-01-01_48x96_gx3v7_simyr1850_c120929.nc - - -lnd/clm2/initdata/clmi.BCN_0051-01-01_48x96_gx3v7_simyr2000_c120930.nc - - -lnd/clm2/initdata/clmi.BCN_0051-01-01_48x96_gx3v7_simyr2000_c120930.nc - - -lnd/clm2/initdata/clmi.BCN_0051-01-01_48x96_gx3v7_simyr2000_c120930.nc - - -lnd/clm2/initdata_map/clmi.BCN.0170-01-01_ne30np4_gx1v6_simyr1850_c121001.nc - - -lnd/clm2/initdata_map/clmi.BCN.0170-01-01_ne30np4_gx1v6_simyr1850_c121001.nc - - -lnd/clm2/initdata_map/clmi.BCN.0170-01-01_ne30np4_gx1v6_simyr1850_c121001.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_ne30np4_gx1v6_simyr2000_c110328.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_ne30np4_gx1v6_simyr2000_c110328.nc - - -lnd/clm2/initdata/clmi.BCN.2000-01-01_ne30np4_gx1v6_simyr2000_c110328.nc - - - -lnd/clm2/surfdata/surfdata_10x15_USGS_070307.nc - - - - - - -lnd/clm2/surfdata_map/surfdata_48x96_simyr2000_glcmec10_c120927.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr2000_glcmec10_c120927.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_simyr2000_glcmec10_c120927.nc - - -lnd/clm2/surfdata_map/surfdata_48x96_simyr1850_glcmec10_c120927.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_simyr1850_glcmec10_c120927.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_simyr1850_glcmec10_c120927.nc - - - -lnd/clm2/surfdata/surfdata_360x720_nourb_simyr2000_c120620.nc - -lnd/clm2/surfdata/surfdata_128x256_simyr2000_c100406.nc - -lnd/clm2/surfdata/surfdata_64x128_simyr2000_c090928.nc - -lnd/clm2/surfdata_map/surfdata_48x96_simyr2000_c120126.nc - -lnd/clm2/surfdata/surfdata_32x64_simyr2000_c090928.nc - -lnd/clm2/surfdata/surfdata_8x16_simyr2000_c090928.nc - -lnd/clm2/surfdata/surfdata_94x192_urb3den_simyr2000_c091016.nc - - -lnd/clm2/surfdata/surfdata_0.23x0.31_simyr2000_c100406.nc - -lnd/clm2/surfdata/surfdata_0.47x0.63_simyr2000_c091023.nc - -lnd/clm2/surfdata/surfdata_0.9x1.25_simyr2000_c110921.nc - -lnd/clm2/surfdata/surfdata_1.9x2.5_simyr2000_c091005.nc - -lnd/clm2/surfdata/surfdata_2.5x3.33_simyr2000_c091023.nc - -lnd/clm2/surfdata/surfdata_4x5_simyr2000_c090928.nc - -lnd/clm2/surfdata/surfdata_10x15_simyr2000_c090928.nc - - -lnd/clm2/surfdata_map/surfdata_ne4np4_simyr2000_c120126.nc - -lnd/clm2/surfdata_map/surfdata_ne16np4_simyr2000_c120126.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_simyr2000_c110801.nc - -lnd/clm2/surfdata_map/surfdata_ne60np4_simyr2000_c120416.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4_simyr2000_c130313.nc - -lnd/clm2/surfdata_map/surfdata_ne240np4_simyr2000_c130313.nc - - - - -lnd/clm2/surfdata/surfdata_1.9x2.5_mp20_simyr2000_irrcr_c110427.nc - -lnd/clm2/surfdata/surfdata_10x15_mp20_simyr2000_irrcr_c110427.nc - -lnd/clm2/surfdata/surfdata_1x1_numaIA_mp20_simyr2000_irrcr_c110427.nc - - - -lnd/clm2/surfdata/surfdata_1.9x2.5_mp20_simyr2000_c110427.nc - -lnd/clm2/surfdata/surfdata_10x15_mp20_simyr2000_c110427.nc - -lnd/clm2/surfdata/surfdata_1x1_numaIA_mp20_simyr2000_c110427.nc - -lnd/clm2/surfdata/surfdata_1x1_smallvilleIA_mp20_simyr2000_c110427.nc - - -lnd/clm2/surfdata/surfdata_5x5_amazon_simyr2000_c091026.nc - -lnd/clm2/surfdata/surfdata_1x1_brazil_simyr2000_c090928.nc - - - -lnd/clm2/surfdata/surfdata_1x1_camdenNJ_simyr2000_c100407.nc - -lnd/clm2/surfdata/surfdata_1x1_vancouverCAN_simyr2000_c100409.nc - -lnd/clm2/surfdata/surfdata_1x1_mexicocityMEX_simyr2000_c100409.nc - -lnd/clm2/surfdata/surfdata_1x1_urbanc_alpha_simyr2000_c110209.nc - -lnd/clm2/surfdata/surfdata_1x1_asphaltjungleNJ_simyr2000_c100409.nc - - - -lnd/clm2/surfdata/surfdata_0.9x1.25_simyr2000_irrcr_c100916.nc - -lnd/clm2/surfdata/surfdata_1.9x2.5_simyr2000_irrcr_c100916.nc - -lnd/clm2/surfdata/surfdata_10x15_simyr2000_irrcr_c100916.nc - - - -lnd/clm2/surfdata/surfdata_512x1024_simyr1850_c100315.nc - -lnd/clm2/surfdata/surfdata_360x720_nourb_simyr1850_c120717.nc - -lnd/clm2/surfdata/surfdata_128x256_simyr1850_c100406.nc - -lnd/clm2/surfdata/surfdata_64x128_simyr1850_c090928.nc - -lnd/clm2/surfdata_map/surfdata_48x96_simyr1850_c120126.nc - -lnd/clm2/surfdata/surfdata_32x64_simyr1850_c090928.nc - -lnd/clm2/surfdata/surfdata_8x16_simyr1850_c090928.nc - - -lnd/clm2/surfdata/surfdata_0.23x0.31_simyr1850_c100404.nc - -lnd/clm2/surfdata/surfdata_0.47x0.63_simyr1850_c100826.nc - -lnd/clm2/surfdata/surfdata_0.9x1.25_simyr1850_c110921.nc - -lnd/clm2/surfdata/surfdata_1.9x2.5_simyr1850_c091108.nc - -lnd/clm2/surfdata/surfdata_2.5x3.33_simyr1850_c091109.nc - -lnd/clm2/surfdata/surfdata_4x5_simyr1850_c090928.nc - -lnd/clm2/surfdata/surfdata_10x15_simyr1850_c100202.nc - - -lnd/clm2/surfdata_map/surfdata_ne4np4_simyr1850_c120126.nc - -lnd/clm2/surfdata_map/surfdata_ne16np4_simyr1850_c120126.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_simyr1850_c110727.nc - -lnd/clm2/surfdata_map/surfdata_ne60np4_simyr1850_c120416.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4_simyr1850_c130311.nc - -lnd/clm2/surfdata_map/surfdata_ne240np4_simyr1850_c130313.nc - - - - - -lnd/clm2/surfdata_map/surfdata.pftdyn_0.9x1.25_hist_simyr1850-2005_glcmec10_c120927.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_1.9x2.5_hist_simyr1850-2005_glcmec10_c120927.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_hist_simyr1850-2005_glcmec10_c120927.nc - - -lnd/clm2/surfdata/surfdata.pftdyn_10x15_USGS_070307.nc -lnd/clm2/surfdata/surfdata.pftdyn_0.47x0.63_hist_simyr1850-2005_c100826.nc -lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_simyr1850-2005_c091008.nc -lnd/clm2/surfdata/surfdata.pftdyn_1.9x2.5_simyr1850-2005_c091108.nc -lnd/clm2/surfdata/surfdata.pftdyn_2.5x3.33_simyr1850-2005_c091109.nc -lnd/clm2/surfdata/surfdata.pftdyn_10x15_simyr1850-2005_c100205.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_hist_simyr1850-2005_c120127.nc - -lnd/clm2/surfdata_map/surfdata.pftdyn_ne30np4_hist_simyr1850-2005_c120907.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne60np4_hist_simyr1850-2005_c120907.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne120np4_hist_simyr1850-2005_c130313.nc - - - - -lnd/clm2/surfdata_map/surfdata.pftdyn_0.9x1.25_rcp2.6_simyr1850-2100_glcmec10_c120927.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_1.9x2.5_rcp2.6_simyr1850-2100_glcmec10_c120928.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp2.6_simyr1850-2100_glcmec10_c120928.nc - -lnd/clm2/surfdata_map/surfdata.pftdyn_0.9x1.25_rcp4.5_simyr1850-2100_glcmec10_c120927.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_1.9x2.5_rcp4.5_simyr1850-2100_glcmec10_c120928.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp4.5_simyr1850-2100_glcmec10_c120928.nc - -lnd/clm2/surfdata_map/surfdata.pftdyn_0.9x1.25_rcp6.0_simyr1850-2100_glcmec10_c120927.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_1.9x2.5_rcp6.0_simyr1850-2100_glcmec10_c120928.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp6.0_simyr1850-2100_glcmec10_c120928.nc - -lnd/clm2/surfdata_map/surfdata.pftdyn_0.9x1.25_rcp8.5_simyr1850-2100_glcmec10_c120928.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_1.9x2.5_rcp8.5_simyr1850-2100_glcmec10_c120928.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp8.5_simyr1850-2100_glcmec10_c120928.nc - - -lnd/clm2/surfdata/surfdata.pftdyn_0.47x0.63_rcp8.5_simyr1850-2100_c120224.nc -lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp8.5_simyr1850-2100_c130702.nc -lnd/clm2/surfdata/surfdata.pftdyn_1.9x2.5_rcp8.5_simyr1850-2100_c130709.nc -lnd/clm2/surfdata/surfdata.pftdyn_10x15_rcp8.5_simyr1850-2100_c140520.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp8.5_simyr1850-2100_c140520.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne30np4_rcp8.5_simyr1850-2100_c140520.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne120np4_rcp8.5_simyr1850-2100_c130311.nc - -lnd/clm2/surfdata/surfdata.pftdyn_0.47x0.63_rcp6.0_simyr1850-2100_c120223.nc -lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp6.0_simyr1850-2100_c130709.nc -lnd/clm2/surfdata/surfdata.pftdyn_1.9x2.5_rcp6.0_simyr1850-2100_c130709.nc -lnd/clm2/surfdata/surfdata.pftdyn_10x15_rcp6.0_simyr1850-2100_c140520.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp6.0_simyr1850-2100_c140520.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne30np4_rcp6.0_simyr1850-2100_c121001.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne120np4_rcp6.0_simyr1850-2100_c130313.nc - -lnd/clm2/surfdata/surfdata.pftdyn_0.47x0.63_rcp4.5_simyr1850-2100_c120217.nc -lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp4.5_simyr1850-2100_c100406.nc -lnd/clm2/surfdata/surfdata.pftdyn_1.9x2.5_rcp4.5_simyr1850-2100_c100322.nc -lnd/clm2/surfdata/surfdata.pftdyn_10x15_rcp4.5_simyr1850-2100_c100322.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp4.5_simyr1850-2100_c120123.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne30np4_rcp4.5_simyr1850-2100_c121001.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne120np4_rcp4.5_simyr1850-2100_c130313.nc - -lnd/clm2/surfdata/surfdata.pftdyn_0.47x0.63_rcp2.6_simyr1850-2100_c120215.nc -lnd/clm2/surfdata/surfdata.pftdyn_0.9x1.25_rcp2.6_simyr1850-2100_c100323.nc -lnd/clm2/surfdata/surfdata.pftdyn_1.9x2.5_rcp2.6_simyr1850-2100_c100322.nc -lnd/clm2/surfdata/surfdata.pftdyn_10x15_rcp2.6_simyr1850-2100_c100322.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_48x96_rcp2.6_simyr1850-2100_c120123.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne30np4_rcp2.6_simyr1850-2100_c121001.nc -lnd/clm2/surfdata_map/surfdata.pftdyn_ne120np4_rcp2.6_simyr1850-2100_c130313.nc - - -glc/cism/griddata/glcmaskdata_48x96_gland_c141105.nc - -glc/cism/griddata/glcmaskdata_0.9x1.25_Gland5km.nc -glc/cism/griddata/glcmaskdata_1.9x2.5_gland_c141105.nc - - -lnd/clm2/griddata/topodata_0.9x1.25_USGS_070110.nc -lnd/clm2/griddata/topodata_1.9x2.5_USGS_061130.nc -lnd/clm2/griddata/topodata_48x96_USGS_070110.nc - - - -lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc -lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc - - -2000 -2000 -2000 -2000 - -1850 -1850 -1850 -1850 - -2000 -2000 -2000 -2000 - -2000 -2000 -2000 -2000 - -2000 -2000 -2000 -2000 - -1850 -2000 -1850 -2000 - -1850 -2100 -1850 -2100 - -2000 -2100 -2000 -2100 - -lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc -lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc -lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc - -bilinear -bilinear - -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn - - -.true. -.true. -.false. - -bilinear -bilinear - -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn - - - - - -20 - - - - - - - -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.1x0.1_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_AVHRR_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_USGS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_10x10min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_IGBP-GSDP_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ISRIC-WISE_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne120np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_4x5_nomask_to_0.1x0.1_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1.9x2.5_nomask_to_0.1x0.1_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne240np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_AVHRR_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_USGS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_10x10min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_USGS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_IGBP-GSDP_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ISRIC-WISE_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_AVHRR_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_USGS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_10x10min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_USGS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_IGBP-GSDP_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ISRIC-WISE_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_brazil_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_AVHRR_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_USGS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_10x10min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_USGS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_IGBP-GSDP_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ISRIC-WISE_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_AVHRR_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_USGS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_10x10min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_USGS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_IGBP-GSDP_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ISRIC-WISE_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_AVHRR_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_USGS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_10x10min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_USGS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_IGBP-GSDP_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ISRIC-WISE_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_numaIA_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_AVHRR_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_USGS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_10x10min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_USGS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_IGBP-GSDP_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ISRIC-WISE_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_AVHRR_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_USGS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_10x10min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_USGS_to_1x1_urbanc_alpha_nomask_aave_da_c120928.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_IGBP-GSDP_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ISRIC-WISE_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_AVHRR_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_USGS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_10x10min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_USGS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_IGBP-GSDP_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ISRIC-WISE_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc - - - -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_landuse_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_lanwat_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_fmax_to_0.9x1.25_aave_da_110725.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_10minx10min_topo_to_0.9x1.25_aave_da_110630.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_soitex_to_0.9x1.25_aave_da_110722.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_irrig_to_0.9x1.25_aave_da_110529.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ISRIC-WISE_to_0.9x1.25_nomask_aave_da_c120525.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS_to_0.9x1.25_nomask_aave_da_c120523.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_USGS_to_0.9x1.25_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_LandScan2004_to_0.9x1.25_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.9x1.25_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_landuse_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_lanwat_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_fmax_to_1.9x2.5_aave_da_110725.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_10minx10min_topo_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5minx5min_soitex_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_nomask_to_1.9x2.5_nomask_aave_da_c120606.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ISRIC-WISE_to_1.9x2.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS_to_1.9x2.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_USGS_to_1.9x2.5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_LandScan2004_to_1.9x2.5_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_1.9x2.5_nomask_aave_da_c120923.nc - - -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_landuse_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_lanwat_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_fmax_to_10x15_aave_da_110725.nc -lnd/clm2/mappingdata/maps/10x15/map_10minx10min_topo_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5minx5min_soitex_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_nomask_to_10x15_nomask_aave_da_c120327.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ISRIC-WISE_to_10x15_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS_to_10x15_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_USGS_to_10x15_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_LandScan2004_to_10x15_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner-mergeGIS_to_10x15_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_AVHRR_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_USGS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_10x10min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_IGBP-GSDP_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ISRIC-WISE_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_USGS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_LandScan2004_to_360x720_nomask_aave_da_c121017.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner-mergeGIS_to_360x720_nomask_aave_da_c121128.nc - - -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_MODIS_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_AVHRR_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_USGS_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_10x10min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_IGBP-GSDP_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ISRIC-WISE_to_512x1024_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS_to_512x1024_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_USGS_to_512x1024_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_LandScan2004_to_512x1024_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner-mergeGIS_to_512x1024_nomask_aave_da_c120923.nc - - -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_MODIS_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_AVHRR_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_USGS_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_10x10min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_IGBP-GSDP_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ISRIC-WISE_to_128x256_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS_to_128x256_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_USGS_to_128x256_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_LandScan2004_to_128x256_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner-mergeGIS_to_128x256_nomask_aave_da_c120923.nc - - -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_MODIS_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_AVHRR_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_USGS_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_10x10min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_IGBP-GSDP_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ISRIC-WISE_to_64x128_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS_to_64x128_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_USGS_to_64x128_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_LandScan2004_to_64x128_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner-mergeGIS_to_64x128_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_MODIS_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_AVHRR_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_USGS_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_10x10min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_IGBP-GSDP_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ISRIC-WISE_to_48x96_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS_to_48x96_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_USGS_to_48x96_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_LandScan2004_to_48x96_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner-mergeGIS_to_48x96_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_MODIS_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_AVHRR_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_USGS_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_10x10min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_IGBP-GSDP_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ISRIC-WISE_to_32x64_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS_to_32x64_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_USGS_to_32x64_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_LandScan2004_to_32x64_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner-mergeGIS_to_32x64_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_MODIS_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_AVHRR_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_USGS_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_10x10min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_IGBP-GSDP_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ISRIC-WISE_to_8x16_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS_to_8x16_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_USGS_to_8x16_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_LandScan2004_to_8x16_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner-mergeGIS_to_8x16_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_MODIS_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_AVHRR_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_USGS_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_10x10min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_IGBP-GSDP_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ISRIC-WISE_to_4x5_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS_to_4x5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_USGS_to_4x5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_LandScan2004_to_4x5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner-mergeGIS_to_4x5_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_MODIS_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_AVHRR_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_USGS_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_10x10min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_IGBP-GSDP_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ISRIC-WISE_to_0.23x0.31_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS_to_0.23x0.31_nomask_aave_da_c110930.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_USGS_to_0.23x0.31_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.23x0.31_nomask_aave_da_c120923.nc - - - - - -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.1x0.1_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_AVHRR_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_MODIS_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_USGS_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_1.9x2.5_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_IGBPmergeICESatGIS_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_LandScan2004_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_MODIS_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_USGS_to_0.47x0.63_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_IGBP-GSDP_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ISRIC-WISE_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_ne120np4_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_ne240np4_nomask_to_0.47x0.63_nomask_aave_da_c120914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner_to_0.47x0.63_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.47x0.63_nomask_aave_da_c120926.nc - - - -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_MODIS_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_AVHRR_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_USGS_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_10x10min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_IGBP-GSDP_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ISRIC-WISE_to_2.5x3.33_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS_to_2.5x3.33_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_USGS_to_2.5x3.33_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_LandScan2004_to_2.5x3.33_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner-mergeGIS_to_2.5x3.33_nomask_aave_da_c120923.nc - - - - -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_AVHRR_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_MODIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_USGS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_IGBPmergeICESatGIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_IGBP-GSDP_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS_to_0.5x0.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ISRIC-WISE_to_0.5x0.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_LandScan2004_to_0.5x0.5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.1x0.1_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_4x5_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1.9x2.5_nomask_to_0.5x0.5_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne120np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3_USGS_nomask_to_0.5x0.5_nomask_aave_da_c120912.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.47x0.63_nomask_to_0.5x0.5_nomask_aave_da_c120914.nc - - - -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_MODIS_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_AVHRR_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_USGS_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_10x10min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_IGBP-GSDP_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ISRIC-WISE_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_USGS_to_ne4np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner_to_ne4np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne4np4_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_ne4np4_nomask_to_0.5x0.5_nomask_aave_da_c110923.nc - - -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_MODIS_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_AVHRR_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_USGS_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_10x10min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_IGBP-GSDP_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ISRIC-WISE_to_ne16np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS_to_ne16np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_USGS_to_ne16np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_LandScan2004_to_ne16np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_ne16np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_landuse_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_lanwat_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_fmax_to_ne30np4_aave_da_110725.nc -lnd/clm2/mappingdata/maps/ne30np4/map_10minx10min_topo_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_soitex_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_irrig_to_ne30np4_aave_da_110720.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ISRIC-WISE_to_ne30np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS_to_ne30np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_USGS_to_ne30np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_LandScan2004_to_ne30np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne30np4_nomask_aave_da_c120924.nc - -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_MODIS_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_AVHRR_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_USGS_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_10x10min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_IGBP-GSDP_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ISRIC-WISE_to_ne60np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS_to_ne60np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_USGS_to_ne60np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_LandScan2004_to_ne60np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_ne60np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_landuse_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_lanwat_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_fmax_to_ne120np4_aave_da_110725.nc -lnd/clm2/mappingdata/maps/ne120np4/map_10minx10min_topo_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_soitex_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ISRIC-WISE_to_ne120np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_irrig_to_ne120np4_aave_da_110817.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS_to_ne120np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_LandScan2004_to_ne120np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS_to_ne120np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ISRIC-WISE_to_ne120np4_nomask_aave_da_c111115.nc - - - - -lnd/clm2/mappingdata/maps/ne120np4/map_0.1x0.1_nomask_to_ne120np4_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc - - - -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_MODIS_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_AVHRR_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_USGS_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_10x10min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_IGBP-GSDP_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ISRIC-WISE_to_5x5_amazon_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS_to_5x5_amazon_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_USGS_to_5x5_amazon_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_LandScan2004_to_5x5_amazon_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner-mergeGIS_to_5x5_amazon_nomask_aave_da_c120923.nc - -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_MODIS_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_AVHRR_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_USGS_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_10x10min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_IGBP-GSDP_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ISRIC-WISE_to_ne240np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS_to_ne240np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_USGS_to_ne240np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_LandScan2004_to_ne240np4_nomask_aave_da_c120521.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - - - - -. -. - - diff --git a/bld/namelist_files/namelist_defaults_clm4_0_tools.xml b/bld/namelist_files/namelist_defaults_clm4_0_tools.xml deleted file mode 100644 index 23fb007430..0000000000 --- a/bld/namelist_files/namelist_defaults_clm4_0_tools.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml deleted file mode 100644 index 8177668942..0000000000 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ /dev/null @@ -1,2453 +0,0 @@ - - - - - - - - - - -0.9x1.25 - -2000 - - -1800 - - -379.0 -379.0 -284.7 - - -constant - - -sp - -clm4_0_cam6.0 -clm4_5_CRUv7 -clm5_0_cam6.0 - - -off - - -2 -1 -2 -1 -0 - - -.true. -'TOTECOSYSC','TOTECOSYSN','TOTSOMC','TOTSOMN','TOTVEGC','TOTVEGN','TLAI','GPP','NPP','TWS','TSAI','HTOP','HBOT' -'TOTECOSYSC','TOTECOSYSN','TOTSOMC','TOTSOMN','TOTVEGC','TOTVEGN','TLAI','GPP','CPOOL','NPP','TWS' -'TOTSOMC','TOTSOMN','TLAI','GPP','NPP','TWS' -'TLAI','TWS' --8760 -20 - - -.false. -.false. - - -.true. -.false. - - -.true. - - -2 -1 -0 - - -.true. -.false. - - -Medlyn2011 -Ball-Berry1987 -Ball-Berry1987 - - -lnd/clm2/isotopes/atm_delta_C13_CMIP6_1850-2015_yearly_v2.0_c171012.nc -lnd/clm2/isotopes/atm_delta_C14_CMIP6_3x1_global_1850-2015_yearly_v2.0_c171012.nc - - -.false. -.true. - - -0 -1 - - -NONE -NONE - - -0.50,0.30 -0.60,0.40 - - -ON_WASTEHEAT -ON - -1 -0 - -.true. -.false. - - -.false. - - -.true. -.false. - -20SL_8.5m -10SL_3.5m - -.false. -.false. -.true. -.false. - - - -1 -0 - -1 -1 - - -1 -0 - - -1.d-2 -0.001d00 -1.d-2 -1.d-2 - - -2.0d00 -0.5d00 - - -.true. -.false. - -.true. - - -0.006 - - -0.032 - -0.5 - -0. -2. - -0. -2. - --2. -0. - - -.false. -.true. - - -li2016crufrc -li2014qianfrc - -30.0d00 -80.0d00 -0.3d00 -0.7d00 -0.035d00 -4.2d-5 -0.0035d00 -0.001d00 -0.3d00 -0.39d00 -75.d00 -1050.d00 -0.5d00, 0.25d00 - -30.0d00 -30.0d00 -20.0d00 -80.0d00 -0.85d00 -0.98d00 -0.033d00 -0.09d-4 -0.010d00 -0.010d00 -0.008d00 -0.17d-3 -1.6d-4 -0.33d00 -105.d00 -1050.d00 -0.5d00, 0.28d00 - - -.false. -.true. - - -.true. -1.0 -0.05 - -.false. -0.25 -1.0 - - -0 -1 - -1 -1 - -4 -2 -2 -3 - -60. -1.e-8 -1.e-1 -1.e-2 -42 -1 -1 - - -0.0 -21600 -14400 --3400. -0.6 -1.0 -0.5 -0.1 - - -.false. -.false. - - -OFF -ON_RAD - - -12 -5 -10000.0 -1000.0 - -2000. - -1.e30 - -10.0d00 -10.0 - -.true. -.false. - -'Vionnet2012' -'Anderson1976' - -'Slater2017' -'TruncatedAnderson1976' - -100.d00 -175.d00 - -54.526d00 -204.526d00 - -0.08d00 - -.false. -.false. - -1.e9 - - -'single_at_atm_topo','virtual','virtual','multiple' - - -'remains_in_place','replaced_by_ice','replaced_by_ice','replaced_by_ice' - - -'melted','melted','remains_ice','remains_ice' - - -0 -7300 - - - - -lnd/clm2/paramdata/clm5_params.c171117.nc -lnd/clm2/paramdata/clm_params.c170913.nc - - - - - -lnd/clm2/paramdata/fates_params_2troppftclones.c171018.nc - - - - -.true. -.false. -.false. - - -.true. -.false. -.false. - - -.true. -.false. -3 -.true. -.true. -.true. -.true. -.false. -3 -1 -1 -1 -1 -0 - - - - - - -.true. -.false. - -.false. -.true. -.true. - -0.093563 - -.false. -.false. -.true. - - -constant -varytropicsbylat -12.0d00 -0.4d00 - -3.d00 -1.d00 - - - -0.5 -10.0 - - -.false. -.true. - - -.false. -.false. -.false. -.false. -.false. - - -.false. -.false. -.true. - -1.d-9 -1.d-8 --6.d+1 --6.d+0 --6.d+2 --6.d+1 - - -.false. -.false. -.true. - - - -75 - - -1850,2000 - - -.true. -.true. -.false. - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.false. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.false. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - -hgrid=1.9x2.5 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - - - -lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v6_simyr1850_c180204.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v6_simyr1850_c180204.nc - - -lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c180130.nc - - - -lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v6_simyr1850_c171214.nc - - - -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop.1366-01-01.0.9x1.25_gx1v6_simyr1850_c171213.nc - - - -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru.1526-01-01.0.9x1.25_gx1v6_simyr1850_c180109b.nc - - - -lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c180130.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v6_simyr1850_c180110.nc - - - - - - -lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc - - - -lnd/clm2/initdata_map/clmi.I2000Clm45Fates.0021-01-01.4x5_mgx3v7_simyr2000_c180306.nc - - - - - -lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr2000_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne16np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_5x5_amazon_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - - -lnd/clm2/surfdata_map/surfdata_64x128_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_0.125x0.125_mp24_simyr2000_c150114.nc - -lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr2000_c171214.nc - - -lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne16np4_78pfts_CMIP6_simyr2000_c170824.nc - - - -lnd/clm2/surfdata_map/surfdata_1x1_camdenNJ_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_vancouverCAN_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_mexicocityMEX_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_urbanc_alpha_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c180508.nc - -lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr1850_c171214.nc - - - -lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - - - -lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_48x96_78pfts_CMIP6_simyr1850_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr1850_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr1850_c170917.nc - - -lnd/clm2/surfdata_map/surfdata_1x1_brazil_78pfts_CMIP6_simyr1850_c171214.nc - - -lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc - - - - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc - -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc - - - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_78pfts_CMIP6_simyr1850-2015_c180508.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - - -.true. -.false. - -0.83d-06 - - -0.015d00 -0.015d00 - - -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 - -1.50d00 -0.3 -1.50d00 -0.3 - -100.d00 -20.d00 -1.d00 -1.d00 - - - -lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc -lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc - - -2000 -2000 - -1850 -1850 - -2000 -2000 - -2000 -2000 - -2000 -2000 - -1850 -2015 - -1850 -2100 - -2000 -2100 - -lnd/clm2/ndepdata/fndep_clm_hist_b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.ensmean_1849-2015_monthly_0.9x1.25_c180926.nc - - -extend -NDEP_year -lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp8.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp6.0_simyr1849-2106_1.9x2.5_c100810.nc -lnd/clm2/ndepdata/fndep_clm_rcp4.5_simyr1849-2106_1.9x2.5_c100428.nc -lnd/clm2/ndepdata/fndep_clm_rcp2.6_simyr1849-2106_1.9x2.5_c100428.nc - -cycle -NDEP_month - -bilinear - -nn -nn -nn -nn -nn -nn -nn - - -.false. -2001 -2013 -2001 - -lnd/clm2/lai_streams/MODISPFTLAI_0.5x0.5_c140711.nc - -bilinear - -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn - - - -none -none -94x192 -94x192 - -0001 -0001 - -atm/datm7/NASA_LIS/clmforc.Li_2012_climo1995-2011.T62.lnfm_Total_c140423.nc -atm/datm7/NASA_LIS/clmforc.Li_2016_climo1995-2013.360x720.lnfm_Total_c160825.nc - -bilinear - -nn -nn -nn -nn -nn -nn -nn - - -2000 -2000 - -1850 -1850 - -2000 -2000 - -2000 -2000 - -2000 -2000 - -1850 -2016 - -1850 -2016 - -1850 -2016 - -lnd/clm2/firedata/clmforc.Li_2017_HYDEv3.2_CMIP6_hdm_0.5x0.5_AVHRR_simyr1850-2016_c180202.nc - -bilinear - -nn -nn -nn -nn -nn -nn -nn - - -2000 -2000 - -2000 -2000 - -1850 -1850 - -2000 -2000 - -2000 -2000 - -2000 -2000 - -1850 -2106 - -1850 -2106 - -1850 -2106 - -lnd/clm2/urbandata/CLM50_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc - -lnd/clm2/urbandata/CLM45_tbuildmax_Oleson_2016_0.9x1.25_simyr1849-2106_c160923.nc - -nn - -nn -nn -nn -nn -nn -nn -nn - - -.true. -.false. - -.false. - - - - - -35 - - - - - - - - -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.1x0.1_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_AVHRR_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.25x0.25_MODIS_to_0.1x0.1_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_10x10min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS-wCsp_to_0.1x0.1_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_IGBP-GSDP_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ISRIC-WISE_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ORNL-Soil_to_0.1x0.1_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne120np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_4x5_nomask_to_0.1x0.1_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1.9x2.5_nomask_to_0.1x0.1_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne240np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.9x1.25_GRDC_to_0.1x0.1_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_360x720_cruncep_to_0.1x0.1_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.1x0.1_nomask_aave_da_c130405.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_AVHRR_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.25x0.25_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_10x10min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS-wCsp_to_1x1_asphaltjungleNJ_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_USGS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_LandScan2004_to_1x1_asphaltjungleNJ_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_IGBP-GSDP_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ISRIC-WISE_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ORNL-Soil_to_1x1_asphaltjungleNJ_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.9x1.25_GRDC_to_1x1_asphaltjungleNJ_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_360x720_cruncep_to_1x1_asphaltjungleNJ_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_AVHRR_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.25x0.25_MODIS_to_1x1_brazil_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_10x10min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS-wCsp_to_1x1_brazil_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_USGS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_LandScan2004_to_1x1_brazil_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_IGBP-GSDP_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ISRIC-WISE_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ORNL-Soil_to_1x1_brazil_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.9x1.25_GRDC_to_1x1_brazil_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_360x720_cruncep_to_1x1_brazil_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_brazil_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_AVHRR_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.25x0.25_MODIS_to_1x1_camdenNJ_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_10x10min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS-wCsp_to_1x1_camdenNJ_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_USGS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_LandScan2004_to_1x1_camdenNJ_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_IGBP-GSDP_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ISRIC-WISE_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ORNL-Soil_to_1x1_camdenNJ_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.9x1.25_GRDC_to_1x1_camdenNJ_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_360x720_cruncep_to_1x1_camdenNJ_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_camdenNJ_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_AVHRR_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.25x0.25_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_10x10min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS-wCsp_to_1x1_mexicocityMEX_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_USGS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_LandScan2004_to_1x1_mexicocityMEX_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_IGBP-GSDP_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ISRIC-WISE_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ORNL-Soil_to_1x1_mexicocityMEX_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.9x1.25_GRDC_to_1x1_mexicocityMEX_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_360x720_cruncep_to_1x1_mexicocityMEX_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_mexicocityMEX_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_AVHRR_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.25x0.25_MODIS_to_1x1_numaIA_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_10x10min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS-wCsp_to_1x1_numaIA_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_USGS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_LandScan2004_to_1x1_numaIA_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_IGBP-GSDP_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ISRIC-WISE_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ORNL-Soil_to_1x1_numaIA_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.9x1.25_GRDC_to_1x1_numaIA_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_360x720_cruncep_to_1x1_numaIA_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_numaIA_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_AVHRR_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.25x0.25_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_10x10min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS-wCsp_to_1x1_smallvilleIA_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_USGS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_LandScan2004_to_1x1_smallvilleIA_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_IGBP-GSDP_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ISRIC-WISE_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ORNL-Soil_to_1x1_smallvilleIA_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.9x1.25_GRDC_to_1x1_smallvilleIA_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_360x720_cruncep_to_1x1_smallvilleIA_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_smallvilleIA_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_AVHRR_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.25x0.25_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_10x10min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS-wCsp_to_1x1_urbanc_alpha_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_USGS_to_1x1_urbanc_alpha_nomask_aave_da_c120928.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_LandScan2004_to_1x1_urbanc_alpha_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_IGBP-GSDP_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ISRIC-WISE_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ORNL-Soil_to_1x1_urbanc_alpha_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.9x1.25_GRDC_to_1x1_urbanc_alpha_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_360x720_cruncep_to_1x1_urbanc_alpha_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_urbanc_alpha_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_AVHRR_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.25x0.25_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_10x10min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS-wCsp_to_1x1_vancouverCAN_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_USGS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_LandScan2004_to_1x1_vancouverCAN_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_IGBP-GSDP_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ISRIC-WISE_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ORNL-Soil_to_1x1_vancouverCAN_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.9x1.25_GRDC_to_1x1_vancouverCAN_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_360x720_cruncep_to_1x1_vancouverCAN_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_vancouverCAN_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.25x0.25_MODIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_AVHRR_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_MODIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.9x1.25_GRDC_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_IGBPmergeICESatGIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_360x720cru_cruncep_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_LandScan2004_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_MODIS-wCsp_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_USGS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_IGBP-GSDP_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ISRIC-WISE_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ORNL-Soil_to_0.47x0.63_nomask_aave_da_c170914.nc - - - - -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_landuse_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.25x0.25_MODIS_to_0.9x1.25_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_lanwat_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_10minx10min_topo_to_0.9x1.25_aave_da_110630.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_soitex_to_0.9x1.25_aave_da_110722.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_irrig_to_0.9x1.25_aave_da_110529.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ISRIC-WISE_to_0.9x1.25_nomask_aave_da_c120525.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ORNL-Soil_to_0.9x1.25_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS_to_0.9x1.25_nomask_aave_da_c120523.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS-wCsp_to_0.9x1.25_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_USGS_to_0.9x1.25_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_LandScan2004_to_0.9x1.25_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.9x1.25_GRDC_to_0.9x1.25_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_360x720_cruncep_to_0.9x1.25_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.9x1.25_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_landuse_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.25x0.25_MODIS_to_1.9x2.5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_lanwat_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_10minx10min_topo_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5minx5min_soitex_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_nomask_to_1.9x2.5_nomask_aave_da_c120606.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ISRIC-WISE_to_1.9x2.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ORNL-Soil_to_1.9x2.5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS_to_1.9x2.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS-wCsp_to_1.9x2.5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_USGS_to_1.9x2.5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_LandScan2004_to_1.9x2.5_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.9x1.25_GRDC_to_1.9x2.5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_360x720_cruncep_to_1.9x2.5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1.9x2.5_nomask_aave_da_c130405.nc - - -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_landuse_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_0.25x0.25_MODIS_to_10x15_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_lanwat_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_10minx10min_topo_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5minx5min_soitex_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_nomask_to_10x15_nomask_aave_da_c120327.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ISRIC-WISE_to_10x15_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ORNL-Soil_to_10x15_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS_to_10x15_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS-wCsp_to_10x15_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_USGS_to_10x15_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_LandScan2004_to_10x15_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner-mergeGIS_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_0.9x1.25_GRDC_to_10x15_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/10x15/map_360x720_cruncep_to_10x15_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/10x15/map_1km-merge-10min_HYDRO1K-merge-nomask_to_10x15_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_0.25x0.25_MODIS_to_360x720cru_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_AVHRR_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_10x10min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_IGBP-GSDP_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ISRIC-WISE_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ORNL-Soil_to_360x720cru_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS-wCsp_to_360x720cru_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_USGS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_LandScan2004_to_360x720_nomask_aave_da_c121017.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner-mergeGIS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_0.9x1.25_GRDC_to_360x720_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/360x720/map_360x720_cruncep_to_360x720_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/360x720/map_1km-merge-10min_HYDRO1K-merge-nomask_to_360x720_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_MODIS_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.25x0.25_MODIS_to_512x1024_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_AVHRR_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_10x10min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_IGBP-GSDP_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ISRIC-WISE_to_512x1024_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ORNL-Soil_to_512x1024_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS_to_512x1024_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS-wCsp_to_512x1024_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_USGS_to_512x1024_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_LandScan2004_to_512x1024_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner-mergeGIS_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.9x1.25_GRDC_to_512x1024_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/512x1024/map_360x720_cruncep_to_512x1024_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/512x1024/map_1km-merge-10min_HYDRO1K-merge-nomask_to_512x1024_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_MODIS_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_0.25x0.25_MODIS_to_128x256_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_AVHRR_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_10x10min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_IGBP-GSDP_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ISRIC-WISE_to_128x256_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ORNL-Soil_to_128x256_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS_to_128x256_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS-wCsp_to_128x256_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_USGS_to_128x256_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_LandScan2004_to_128x256_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner-mergeGIS_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_0.9x1.25_GRDC_to_128x256_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/128x256/map_360x720_cruncep_to_128x256_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/128x256/map_1km-merge-10min_HYDRO1K-merge-nomask_to_128x256_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_MODIS_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_0.25x0.25_MODIS_to_64x128_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_AVHRR_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_10x10min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_IGBP-GSDP_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ISRIC-WISE_to_64x128_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ORNL-Soil_to_64x128_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS_to_64x128_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS-wCsp_to_64x128_nomask_aave_da_c160428.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_USGS_to_64x128_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_LandScan2004_to_64x128_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner-mergeGIS_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_0.9x1.25_GRDC_to_64x128_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/64x128/map_360x720_cruncep_to_64x128_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/64x128/map_1km-merge-10min_HYDRO1K-merge-nomask_to_64x128_nomask_aave_da_c130403.nc - -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_MODIS_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_0.25x0.25_MODIS_to_48x96_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_AVHRR_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_10x10min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_IGBP-GSDP_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ISRIC-WISE_to_48x96_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ORNL-Soil_to_48x96_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS_to_48x96_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS-wCsp_to_48x96_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_USGS_to_48x96_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_LandScan2004_to_48x96_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner-mergeGIS_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_0.9x1.25_GRDC_to_48x96_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/48x96/map_360x720_cruncep_to_48x96_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/48x96/map_1km-merge-10min_HYDRO1K-merge-nomask_to_48x96_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_MODIS_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_0.25x0.25_MODIS_to_32x64_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_AVHRR_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_10x10min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_IGBP-GSDP_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ISRIC-WISE_to_32x64_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ORNL-Soil_to_32x64_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS_to_32x64_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS-wCsp_to_32x64_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_USGS_to_32x64_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_LandScan2004_to_32x64_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner-mergeGIS_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_0.9x1.25_GRDC_to_32x64_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/32x64/map_360x720_cruncep_to_32x64_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/32x64/map_1km-merge-10min_HYDRO1K-merge-nomask_to_32x64_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_MODIS_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_0.25x0.25_MODIS_to_8x16_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_AVHRR_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_10x10min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_IGBP-GSDP_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ISRIC-WISE_to_8x16_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ORNL-Soil_to_8x16_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS_to_8x16_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS-wCsp_to_8x16_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_USGS_to_8x16_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_LandScan2004_to_8x16_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner-mergeGIS_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_0.9x1.25_GRDC_to_8x16_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/8x16/map_360x720_cruncep_to_8x16_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/8x16/map_1km-merge-10min_HYDRO1K-merge-nomask_to_8x16_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_MODIS_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_0.25x0.25_MODIS_to_4x5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_AVHRR_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_10x10min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_IGBP-GSDP_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ISRIC-WISE_to_4x5_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ORNL-Soil_to_4x5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS_to_4x5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS-wCsp_to_4x5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_USGS_to_4x5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_LandScan2004_to_4x5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner-mergeGIS_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_0.9x1.25_GRDC_to_4x5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/4x5/map_360x720_cruncep_to_4x5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/4x5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_4x5_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_MODIS_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.25x0.25_MODIS_to_0.23x0.31_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_AVHRR_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_10x10min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_IGBP-GSDP_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ISRIC-WISE_to_0.23x0.31_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ORNL-Soil_to_0.23x0.31_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS_to_0.23x0.31_nomask_aave_da_c110930.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS-wCsp_to_0.23x0.31_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_USGS_to_0.23x0.31_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.9x1.25_GRDC_to_0.23x0.31_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_360x720_cruncep_to_0.23x0.31_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.23x0.31_nomask_aave_da_c130405.nc - - -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_MODIS_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.25x0.25_MODIS_to_2.5x3.33_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_AVHRR_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_10x10min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_IGBP-GSDP_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ISRIC-WISE_to_2.5x3.33_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ORNL-Soil_to_2.5x3.33_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS_to_2.5x3.33_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS-wCsp_to_2.5x3.33_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_USGS_to_2.5x3.33_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_LandScan2004_to_2.5x3.33_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner-mergeGIS_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.9x1.25_GRDC_to_2.5x3.33_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_360x720_cruncep_to_2.5x3.33_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_1km-merge-10min_HYDRO1K-merge-nomask_to_2.5x3.33_nomask_aave_da_c130405.nc - - - - -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_AVHRR_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.25x0.25_MODIS_to_0.5x0.5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_MODIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_IGBPmergeICESatGIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_IGBP-GSDP_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS_to_0.5x0.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS-wCsp_to_0.5x0.5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ISRIC-WISE_to_0.5x0.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ORNL-Soil_to_0.5x0.5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_LandScan2004_to_0.5x0.5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.1x0.1_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_4x5_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1.9x2.5_nomask_to_0.5x0.5_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne120np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3_USGS_nomask_to_0.5x0.5_nomask_aave_da_c120912.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.9x1.25_GRDC_to_0.5x0.5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_360x720_cruncep_to_0.5x0.5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.5x0.5_nomask_aave_da_c130405.nc - - - -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_MODIS_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.25x0.25_MODIS_to_ne4np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_AVHRR_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_10x10min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_IGBP-GSDP_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ISRIC-WISE_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ORNL-Soil_to_ne4np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS-wCsp_to_ne4np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_USGS_to_ne4np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner_to_ne4np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne4np4_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.9x1.25_GRDC_to_ne4np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne4np4/map_360x720_cruncep_to_ne4np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne4np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne4np4_nomask_aave_da_c130411.nc -lnd/clm2/mappingdata/maps/ne4np4/map_ne4np4_nomask_to_0.5x0.5_nomask_aave_da_c110923.nc - - -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_MODIS_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.25x0.25_MODIS_to_ne16np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_AVHRR_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_10x10min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_IGBP-GSDP_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ISRIC-WISE_to_ne16np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ORNL-Soil_to_ne16np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS_to_ne16np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS-wCsp_to_ne16np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_USGS_to_ne16np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_LandScan2004_to_ne16np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.9x1.25_GRDC_to_ne16np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne16np4/map_360x720_cruncep_to_ne16np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne16np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne16np4_nomask_aave_da_c130408.nc -lnd/clm2/mappingdata/maps/ne16np4/map_ne16np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_landuse_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.25x0.25_MODIS_to_ne30np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_lanwat_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_10minx10min_topo_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_soitex_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_irrig_to_ne30np4_aave_da_110720.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ISRIC-WISE_to_ne30np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ORNL-Soil_to_ne30np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS_to_ne30np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS-wCsp_to_ne30np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_USGS_to_ne30np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_LandScan2004_to_ne30np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.9x1.25_GRDC_to_ne30np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne30np4/map_360x720_cruncep_to_ne30np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne30np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne30np4_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/ne30np4/map_ne30np4_to_0.5x0.5rtm_aave_da_110320.nc - -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_MODIS_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.25x0.25_MODIS_to_ne60np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_AVHRR_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_10x10min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_IGBP-GSDP_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ISRIC-WISE_to_ne60np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ORNL-Soil_to_ne60np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS_to_ne60np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS-wCsp_to_ne60np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_USGS_to_ne60np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_LandScan2004_to_ne60np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.9x1.25_GRDC_to_ne60np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne60np4/map_360x720_cruncep_to_ne60np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne60np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne60np4_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/ne60np4/map_ne60np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_landuse_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.25x0.25_MODIS_to_ne120np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_lanwat_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_10minx10min_topo_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_soitex_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ISRIC-WISE_to_ne120np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ORNL-Soil_to_ne120np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_irrig_to_ne120np4_aave_da_110817.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS_to_ne120np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS-wCsp_to_ne120np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_LandScan2004_to_ne120np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.9x1.25_GRDC_to_ne120np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne120np4/map_360x720_cruncep_to_ne120np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne120np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne120np4_nomask_aave_da_c130405.nc - - - - -lnd/clm2/mappingdata/maps/ne120np4/map_0.1x0.1_nomask_to_ne120np4_nomask_aave_da_c120706.nc - - - -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_MODIS_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.25x0.25_MODIS_to_5x5_amazon_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_AVHRR_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_10x10min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_IGBP-GSDP_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ISRIC-WISE_to_5x5_amazon_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ORNL-Soil_to_5x5_amazon_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS_to_5x5_amazon_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS-wCsp_to_5x5_amazon_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_USGS_to_5x5_amazon_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_LandScan2004_to_5x5_amazon_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner-mergeGIS_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.9x1.25_GRDC_to_5x5_amazon_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_360x720_cruncep_to_5x5_amazon_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_1km-merge-10min_HYDRO1K-merge-nomask_to_5x5_amazon_nomask_aave_da_c130403.nc - -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_MODIS_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.25x0.25_MODIS_to_ne240np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_AVHRR_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_10x10min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_IGBP-GSDP_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ISRIC-WISE_to_ne240np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ORNL-Soil_to_ne240np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS_to_ne240np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS-wCsp_to_ne240np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_USGS_to_ne240np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_LandScan2004_to_ne240np4_nomask_aave_da_c120521.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.9x1.25_GRDC_to_ne240np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne240np4/map_360x720_cruncep_to_ne240np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne240np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne240np4_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/ne240np4/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - - - -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.5x0.5_AVHRR_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.5x0.5_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.25x0.25_MODIS_to_0.125x0.125_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.9x1.25_GRDC_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_10x10min_IGBPmergeICESatGIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_10x10min_nomask_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_360x720cru_cruncep_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_GLOBE-Gardner_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_LandScan2004_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS-wCsp_to_0.125x0.125_nomask_aave_da_c160427.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_USGS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_IGBP-GSDP_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_ISRIC-WISE_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_ORNL-Soil_to_0.125x0.125_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_nomask_to_0.125x0.125_nomask_aave_da_c140702.nc - - - - - - - -. -. - - - - - -TWS_inversion -ZWT_inversion -.true. -.true. - -1.9x2.5 - -lnd/clm2/paramdata/finundated_inversiondata_0.9x1.25_c170706.nc - - - - - -.false. -.false. -.false. -.false. - -.false. -.false. -.false. -.false. - -.true. -.true. -.true. -.true. - -.true. -.true. -.false. -.false. - - -.false. -.false. -.false. -.false. -.false. -.false. - - - - - -general - - diff --git a/bld/namelist_files/namelist_defaults_clm4_5_tools.xml b/bld/namelist_files/namelist_defaults_clm4_5_tools.xml deleted file mode 100644 index d6cece9e92..0000000000 --- a/bld/namelist_files/namelist_defaults_clm4_5_tools.xml +++ /dev/null @@ -1,633 +0,0 @@ - - - - - - - - - - - - -none -SCRIP - - -lnd/clm2/mappingdata/grids/SCRIPgrid_0.23x0.31_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.47x0.63_nomask_c170914.nc -lnd/clm2/mappingdata/grids/0.9x1.25_c110307.nc -lnd/clm2/mappingdata/grids/1.9x2.5_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_2.5x3.33_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_4x5_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_10x15_nomask_c110308.nc - - -lnd/clm2/mappingdata/grids/SCRIPgrid_512x1024_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_128x256_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_94x192_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_64x128_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_48x96_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_32x64_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_8x16_nomask_c110308.nc - - -lnd/clm2/mappingdata/grids/SCRIPgrid_ne240np4_nomask_c091227.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne120np4_nomask_c101123.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne60np4_nomask_c100408.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne30np4_nomask_c101123.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne16np4_nomask_c110512.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_ne4np4_nomask_c110808.nc - - -lnd/clm2/mappingdata/grids/SCRIPgrid_0.125x0.125_nomask_c140702.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.33x0.33_navy_c111207.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.1x0.1_nomask_c110712.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.5x0.5_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.5x0.5_AVHRR_c110228.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.5x0.5_MODIS_c110228.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.25x0.25_MODIS_c170321.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_5x5min_nomask_c110530.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_5x5min_IGBP-GSDP_c110228.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_5x5min_ISRIC-WISE_c111114.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_5x5min_ORNL-Soil_c170630.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_10x10min_nomask_c110228.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_10x10min_IGBPmergeICESatGIS_c110818.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_MODIS_c110915.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_MODISwcspsea_c151020.nc -64bit_offset -64bit_offset -lnd/clm2/mappingdata/grids/SCRIPgrid_3x3_USGS_c120912.nc -64bit_offset -lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_LandScan2004_c120517.nc -64bit_offset -lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_GLOBE-Gardner_c120922.nc -64bit_offset -lnd/clm2/mappingdata/grids/SCRIPgrid_3minx3min_GLOBE-Gardner-mergeGIS_c120922.nc -64bit_offset -lnd/clm2/mappingdata/grids/SCRIPgrid_360x720_cruncep_c120830.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_360x720_nomask_c120830.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_0.9x1.25_GRDC_c130307.nc - - - -lnd/clm2/mappingdata/grids/UGRID_1km-merge-10min_HYDRO1K-merge-nomask_c130402.nc -netcdf4 -UGRID -landmesh - - -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_camdenNJ_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_brazil_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_camdenNJ_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_mexicocityMEX_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_numaIA_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_smallvilleIA_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_urbanc_alpha_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_1x1pt_vancouverCAN_nomask_c110308.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_5x5pt_amazon_nomask_c110308.nc - - -lnd/clm2/mappingdata/grids/SCRIPgrid_0.33x0.33_navy_c111207.nc -lnd/clm2/mappingdata/grids/SCRIPgrid_5x5_amazon_navy_c111207.nc -/glade/proj3/cseg/mapping/grids/gx1v6_090205.nc -/glade/proj3/cseg/mapping/grids/gx3v7_090903.nc -/glade/proj3/cseg/mapping/grids/tx1v1_090122.nc -/glade/proj3/cseg/mapping/grids/tx0.1v2_090127.nc - - -MODIS-wCsp -AVHRR -AVHRR -MODIS -MODIS -MODIS -MODIS -LandScan2004 -MODIS -ISRIC-WISE -GLOBE-Gardner -GLOBE-Gardner-mergeGIS -nomask -USGS -nomask -nomask -IGBP-GSDP -AVHRR -AVHRR -ORNL-Soil -AVHRR -HYDRO1K-merge-nomask -GRDC -cruncep - - -3x3min -0.5x0.5 -0.5x0.5 -0.25x0.25 -0.25x0.25 -3x3min -0.25x0.25 -3x3min -0.25x0.25 -5x5min -3x3min -10x10min -3x3min -5x5min -10x10min -5x5min -0.5x0.5 -0.5x0.5 -5x5min -0.5x0.5 -1km-merge-10min -0.9x1.25 -360x720cru - - -mksrf_flakwat -mksrf_fwetlnd -mksrf_fvocef -mksrf_flai -mksrf_fvegtyp -mksrf_fvegtyp -mksrf_furban -mksrf_fsoicol -mksrf_forganic -mksrf_fglacier -mksrf_fglacierregion -mksrf_fmax -mksrf_furbtopo -mksrf_fsoitex -mksrf_fgdp -mksrf_fpeat -mksrf_fsoildepth -mksrf_fabm -mksrf_ftopostats -mksrf_fvic -mksrf_fch4 - - -lnd/clm2/rawdata/mksrf_navyoro_20min.c010129.nc - - - -lnd/clm2/rawdata/pftcftlandusedynharv.0.25x0.25.MODIS.simyr1850-2015.c170412/mksrf_lai_78pfts_simyr2005.c170413.nc - - - -lnd/clm2/rawdata/mksrf_irrig_2160x4320_simyr2000.c110527.nc - -lnd/clm2/rawdata/mksrf_soitex.10level.c010119.nc - -lnd/clm2/rawdata/pftcftlandusedynharv.0.25x0.25.MODIS.simyr1850-2015.c170412/mksrf_soilcolor_CMIP6_simyr2005.c170623.nc - -lnd/clm2/rawdata/mksrf_organic_10level_5x5min_ISRIC-WISE-NCSCD_nlev7_c120830.nc - -lnd/clm2/rawdata/mksrf_fmax_3x3min_USGS_c120911.nc - - -lnd/clm2/rawdata/mksrf_LakePnDepth_3x3min_simyr2004_csplk_c151015.nc - -lnd/clm2/rawdata/mksrf_lanwat.050425.nc - - -lnd/clm2/rawdata/mksrf_vocef_0.5x0.5_simyr2000.c110531.nc - - -lnd/clm2/rawdata/mksrf_urban_0.05x0.05_simyr2000.c120621.nc - - - -lnd/clm2/rawdata/mksrf_glacier_3x3min_simyr2000.c120926.nc -lnd/clm2/rawdata/mksrf_glacier_3x3min_simyr2000_mergeGreenland.c120921.nc - - -lnd/clm2/rawdata/mksrf_GlacierRegion_10x10min_nomask_c170616.nc - - -lnd/clm2/rawdata/mksrf_topo.10min.c080912.nc - - -lnd/clm2/rawdata/mksrf_gdp_0.5x0.5_AVHRR_simyr2000.c130228.nc - -lnd/clm2/rawdata/mksrf_peatf_0.5x0.5_AVHRR_simyr2000.c130228.nc - -lnd/clm2/rawdata/mksf_soilthk_5x5min_ORNL-Soil_simyr1900-2015_c170630.nc - -lnd/clm2/rawdata/mksrf_abm_0.5x0.5_AVHRR_simyr2000.c130201.nc - -lnd/clm2/rawdata/mksrf_topostats_1km-merge-10min_HYDRO1K-merge-nomask_simyr2000.c130402.nc - -lnd/clm2/rawdata/mksrf_vic_0.9x1.25_GRDC_simyr2000.c130307.nc - -lnd/clm2/rawdata/mksrf_ch4inversion_360x720_cruncep_simyr2000.c130322.nc - - - - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1850.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1851.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1852.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1853.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1854.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1855.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1856.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1857.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1858.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1859.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1860.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1861.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1862.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1863.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1864.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1865.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1866.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1867.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1868.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1869.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1870.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1871.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1872.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1873.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1874.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1875.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1876.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1877.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1878.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1879.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1880.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1881.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1882.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1883.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1884.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1885.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1886.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1887.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1888.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1889.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1890.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1891.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1892.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1893.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1894.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1895.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1896.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1897.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1898.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1899.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1900.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1901.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1902.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1903.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1904.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1905.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1906.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1907.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1908.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1909.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1910.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1911.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1912.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1913.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1914.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1915.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1916.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1917.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1918.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1919.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1920.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1921.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1922.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1923.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1924.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1925.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1926.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1927.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1928.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1929.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1930.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1931.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1932.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1933.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1934.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1935.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1936.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1937.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1938.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1939.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1940.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1941.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1942.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1943.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1944.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1945.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1946.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1947.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1948.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1949.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1950.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1951.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1952.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1953.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1954.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1955.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1956.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1957.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1958.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1959.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1960.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1961.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1962.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1963.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1964.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1965.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1966.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1967.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1968.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1969.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1970.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1971.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1972.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1973.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1974.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1975.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1976.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1977.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1978.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1979.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1980.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1981.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1982.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1983.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1984.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1985.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1986.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1987.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1988.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1989.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1990.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1991.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1992.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1993.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1994.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1995.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1996.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1997.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1998.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_1999.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2000.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2001.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2002.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2003.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2004.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2005.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2006.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2007.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2008.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2009.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2010.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2011.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2012.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2013.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2014.c170629.nc - -lnd/clm2/rawdata/pftcftdynharv.0.25x0.25.LUH2.histsimyr1850-2015.c170629/mksrf_landuse_histclm50_LUH2_2015.c170629.nc - - - -atm/cam/ggas/ghg_hist_1765-2005_c091218.nc -atm/cam/ggas/ghg_rcp26_1765-2500_c100405.nc -atm/cam/ggas/ghg_rcp45_1765-2500_c100405.nc -atm/cam/ggas/ghg_rcp60_1765-2500_c100901.nc -atm/cam/ggas/ghg_rcp85_1765-2500_c100203.nc - - diff --git a/bld/namelist_files/namelist_defaults_drv.xml b/bld/namelist_files/namelist_defaults_drv.xml deleted file mode 100644 index 2ad5c26013..0000000000 --- a/bld/namelist_files/namelist_defaults_drv.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - -Buildconf/camconf/drv_flds_in,Buildconf/clmconf/drv_flds_in - - diff --git a/bld/namelist_files/namelist_defaults_drydep.xml b/bld/namelist_files/namelist_defaults_drydep.xml deleted file mode 100644 index 056f598d2b..0000000000 --- a/bld/namelist_files/namelist_defaults_drydep.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - -'O3','NO2','HNO3','NO','HO2NO2','CH3OOH','CH2O','CO','H2O2','CH3COOOH','PAN','MPAN','C2H5OOH','ONIT','POOH','C3H7OOH','ROOH','CH3COCHO','CH3COCH3','Pb','ONITR','MACROOH','XOOH','ISOPOOH','CH3OH','C2H5OH','CH3CHO','GLYALD','HYAC','HYDRALD','ALKOOH','MEKOOH','TOLOOH','TERPOOH','CH3COOH','CB1','CB2','OC1','OC2','SOA','SO2','SO4','NH3','NH4NO3' - -xactive_lnd - - - -'ISOP = isoprene', 'C10H16 = pinene_a + carene_3 + thujene_a', 'CH3OH = methanol', 'C2H5OH = ethanol', 'CH2O = formaldehyde', 'CH3CHO = acetaldehyde', 'CH3COOH = acetic_acid', 'CH3COCH3 = acetone' - -atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc -atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc -atm/cam/chem/trop_mozart/emis/megan21_emis_factors_c20120313.nc - - diff --git a/bld/namelist_files/namelist_defaults_fire_emis.xml b/bld/namelist_files/namelist_defaults_fire_emis.xml deleted file mode 100644 index b7536ba66b..0000000000 --- a/bld/namelist_files/namelist_defaults_fire_emis.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - -'bc_a1 = BC','pom_a1 = 1.4*OC','SO2 = SO2' - -lnd/clm2/firedata/fire_emis_factors_c140116.nc - - diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml deleted file mode 100644 index 20158c7dd4..0000000000 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - -startup -startup -arb_ic -arb_ic -arb_ic -arb_ic -arb_ic -cold - - -/fs/cgd/csm/inputdata - - -1.9x2.5 -1x1_brazil -5x5_amazon -1x1_camdenNJ -1x1_vancouverCAN -1x1_mexicocityMEX -1x1_asphaltjungleNJ -1x1_urbanc_alpha -1x1_numaIA -1x1_smallvilleIA - - -2000 - - -constant - - -1 -0 - - -1 -0 - - --999.9 - - -.false. - - -gx1v6 -gx1v6 -gx1v6 -gx1v6 -gx3v7 -gx3v7 -USGS - -cruncep -USGS -USGS -gx3v7 -USGS -USGS - -T62 - -gx1v6 -gx1v6 -gx1v6 - -navy -navy -navy -navy -navy -navy -test -navy -test -gx1v6 - - - -.false. -0 -1 -3 -5 -10 -36 - - diff --git a/bld/namelist_files/namelist_defaults_usr_files.xml b/bld/namelist_files/namelist_defaults_usr_files.xml deleted file mode 100644 index 14ba49de23..0000000000 --- a/bld/namelist_files/namelist_defaults_usr_files.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - -lnd/clm2/initdata/clmi.${clm_usr_name}_${mask}_simyr${sim_year}.nc - - -lnd/clm2/surfdata/surfdata_${clm_usr_name}_simyr${sim_year}.nc -lnd/clm2/surfdata_map/surfdata_${clm_usr_name}_simyr${sim_year}.nc - - -null -lnd/clm2/surfdata/landuse.timeseries_${clm_usr_name}_simyr${sim_year_range}.nc -lnd/clm2/surfdata/landuse.timeseries_${clm_usr_name}_simyr1849-2006.nc -lnd/clm2/surfdata/landuse.timeseries_rcp${rcp}_${clm_usr_name}_simyr${sim_year_range}.nc -lnd/clm2/surfdata/landuse.timeseries_rcp${rcp}_${clm_usr_name}_simyr1849-2006.nc - - diff --git a/bld/namelist_files/namelist_definition.xsl b/bld/namelist_files/namelist_definition.xsl deleted file mode 100644 index 545d810e52..0000000000 --- a/bld/namelist_files/namelist_definition.xsl +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - CLM Namelist Definition - - -

-

-
-

-

-

Definition of CLM namelist variables

-

We list all of the relevant namelist variables for CLM I cases. This includes - CLM Namelist items as well as CLM build-namelist settings and namelist settings - for CLM offline tools.

-
-

Definition of CLM namelist variables

-

Note, these all would go into the user_nl_clm file - before configure):

-

Included in the table are the following pieces of information:

-
    -
  • Variable name.
  • -
  • Variable type (char, integer, - real, or logical). The type - char has the length appended - following an asterisk, e.g., char*256. Variables that are - arrays have their dimension specifier appended inside parentheses. For - example char*1(6) denotes a array of six - char*1 values. -
  • -
  • Variable description (includes information on defaults).
  • -
  • Valid values (if restricted).
  • -
- - - - - - - - - - - - -
CLM Namelist Physics Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Lake Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Biogeochemistry (BGC) Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Biogeochemistry Namelist Nitrogen Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Methane Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Vertical CN Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Carbon Isotope Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Datasets
NameTypeDescription -
Valid values
- - - - - - - - - - - - -
CLM Namelist History output settings
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Restart settings
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Performance Tuning
NameTypeDescription
Valid values
- -

-

-
-

-

-

Command Line Options to CLM Build-namelist

-

Variables that are entered as options to build-namelist (but NOT used by - namelists in code). Most of these are options that could be added to - CLM_BLDNML_OPTS. Included in the table are the following pieces - of information:

-
    -
  • Variable name.
  • -
  • Type.
  • -
  • Valid values.
  • -
  • Variable description.
  • -
- - - - - - - - - - - - -
CLM Namelist Default Settings
NameTypeDescription
Valid values, if restricted at all
-

-

-
-

-

-

Command Line Options to CLM Build-namelist

-

Variables that are entered as options to build-namelist (but NOT used by - namelists in code). Most of these are options that could be added to - CLM_BLDNML_OPTS. Included in the table are the following pieces - of information:

-
    -
  • Variable name.
  • -
  • Type.
  • -
  • Valid values.
  • -
  • Variable description.
  • -
- - - - - - - - - - - - -
CLM Namelist Default Settings
NameTypeDescription
Valid values, if restricted at all
-

-

-
-

-

-

Namelist items for CLM Tools

-

These are namelist items that appear in the CLM Tools under components/clm/tools. -

- - - - - - - - - - - -
CLM mksurfdata
NameTypeDescription
Valid values
- - - - - - - - - - - -
CLM mkgriddata
NameTypeDescription
Valid values
- - - - - - - - - - - -
CLM mkmapdata
NameTypeDescription
Valid values
- - - - - - - - - - - -
CLM mkgriddata
NameTypeDescription
Valid values
- - - - - - - - - - - -
Miscellaneous CLM tools
NameTypeDescription
Valid values
- -
- -

Namelist items for Driver MEGAN Physics

- - - - - - - - - - - -
Driver Physics
NameTypeDescription
Valid values
- - -

Namelist items for Driver Dry Deposition

- - - - - - - - - - - -
Driver Dry-Deposition Namelist Options
NameTypeDescription
Valid values, if restricted at all
- -
- - -
- - - - - - - - - Valid Values: - - - - -
diff --git a/bld/namelist_files/namelist_definition_clm4_0.xml b/bld/namelist_files/namelist_definition_clm4_0.xml deleted file mode 100644 index 220a033e4e..0000000000 --- a/bld/namelist_files/namelist_definition_clm4_0.xml +++ /dev/null @@ -1,820 +0,0 @@ - - - - - - - - - - - -Full pathname of initial conditions file. If blank CLM will startup from -arbitrary initial conditions. - - - -Full pathname of master restart file for a branch run. (only used if RUN_TYPE=branch) -(Set with RUN_REFCASE and RUN_REFDATE) - - - -Full pathname of land fraction data file. - - - -Clumps per processor. - - - -Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) -(Set by CCSM_CO2_PPMV) - - - -Type of CO2 feedback. - constant = use the input co2_ppmv value - prognostic = use the prognostic value sent from the atmosphere - diagnostic = use the diagnostic value sent from the atmosphere - - - - -Supplemental Nitrogen mode and for what type of vegetation it's turned on for. -In this mode Nitrogen is unlimited rather than prognosed and in general vegetation is -over-productive. It does act as a proxy for fertilization for crops however. - NONE = No vegetation types get supplemental Nitrogen - PROG_CROP_ONLY = Supplemental Nitrogen is only active for prognostic Crops - ALL = Supplemental Nitrogen is active for all vegetation types - - - -If TRUE, separate the vegetated landunit into a crop landunit and a natural vegetation landunit - - - -Number of multiple elevation classes over glacier points. -Normally this is ONLY used when running CESM with the active glacier model. - - - -If TRUE, dynamically change topographic height over glacier points. -Only works when glc_nec is greater than zero. -(EXPERIMENTAL AND NOT FUNCTIONAL!) - - - -Visible and Near-infrared albedo's for glacier ice - - - -Time step (seconds) - - - -Override the start type from the driver: it can only be -set to 3 meaning branch. - - - -Full pathname of land-ice mask data file (on lnd grid). - - - -Full pathname of topography data file. Only required when -land-ice model is active. - - - -Full pathname datafile with plant function type (PFT) constants - - - -Full pathname of time varying PFT data file. This causes the land-use types of -the initial surface dataset to vary over time. - - - -Full pathname of surface data file. - - - -SNICAR (SNow, ICe, and Aerosol Radiative model) optical data file name - - - -SNICAR (SNow, ICe, and Aerosol Radiative model) snow aging data file name - - - -Per file averaging flag. - 'A' (average over history period) - 'I' (instantaneous) - 'X' (maximum over history period) - 'M' (minimum over history period) - - - -Averaging type of output for 1D vector output (when hist_dov2xy is false). - GRID means average all land-units up to the grid-point level - LAND means average all columns up to the land-unit level - COLS means average all PFT's up to the column level - PFTS means report everything on native PFT level - - - -If TRUE, implies output data on a 2D latitude/longitude grid. False means -output in 1D vector format. One setting per history tape series. - - - -If TRUE, indicates do NOT output any default history fields (requires you to use -hist_fincl* to set the exact output fields to use).. - - - -Fields to exclude from history tape series 1. - - - -Fields to exclude from history tape series 2. - - - -Fields to exclude from history tape series 3. - - - -Fields to exclude from history tape series 4. - - - -Fields to exclude from history tape series 5. - - - -Fields to exclude from history tape series 6. - - - -Fields to add to history tape series 1. - - - -Fields to add to history tape series 2. - - - -Fields to add to history tape series 3. - - - -Fields to add to history tape series 4. - - - -Fields to add to history tape series 5. - - - -Fields to add to history tape series 6. - - - -Per tape series maximum number of time samples. - - - -Per tape series history file density (i.e. output precision) - 1=double precision - 2=single precision -Default: 2,2,2,2,2,2 - - - -Per tape series history write frequency. - positive means in time steps - 0=monthly - negative means hours -(i.e. 5 means every 24 time-steps and -24 means every day -Default: 0,-24,-24,-24,-24,-24 - - - -number of segments per clump for decomposition -Default: 20 - - - -Perturbation limit when doing error growth test - - - -If FALSE, don't write any restart files. - - - -Turn urban air conditioning/heating ON or OFF and add wasteheat: - OFF = Air conditioning/heating is OFF in buildings, internal temperature allowed to float freely - ON = Air conditioning/heating is ON in buildings, internal temperature constrained - ON_WASTEHEAT = Air conditioning/heating is ON and waste-heat sent to urban canyon - - - -If TRUE, urban traffic flux will be activated (Currently NOT implemented). - - - -If TRUE, write diagnostic of global radiative temperature written to CLM log file. - - - - - - -SCRIP format grid data file - - - -Flag to pass to the ESMF mapping utility, telling it what kind of large -file support is needed for an output file generated with this grid as -either the source or destination ('none', '64bit_offset' or 'netcdf4'). - - - -Flag to pass to the ESMF mapping utility, telling it what kind of grid -file this is (SCRIP or UGRID). - - - -For UGRID files, flag to pass to the ESMF mapping utility, telling it the -name of the dummy variable that has all of the topology information stored -in its attributes. (Only used if scripgriddata_src_type = UGRID.) - - - - - - -Filename for mksurfdata_map to remap raw data into the output surface dataset - - - -Plant Function Type dataset for mksurfdata - - - -Dataset for percent glacier land-unit for mksurfdata - - - -Dataset for topography used to define urban threshold - - - -Dataset for land topography - - - -Leaf Area Index dataset for mksurfdata - - - -Soil texture dataset for mksurfdata - - - -Soil color dataset for mksurfdata - - - -Soil max fraction dataset for mksurfdata - - - -High resolution land mask/fraction dataset for mksurfdata -(used for glacier_mec land-units) - - - -Type of grid to create for mksurfdata - - - -Grid file at the output resolution for mksurfdata - - - -Text file with filepaths (or list of XML elements) for vegetation fractions -and harvesting for each year to run over for mksurfdata to be able to model -transient land-use change - - - -High resolution topography dataset for mksurfdata -(used for glacier_mec land-units) - - - -Irrigation dataset for mksurfdata - - - -Organic soil dataset for mksurfdata - - - -Lake water dataset for mksurfdata - - - -Wetland dataset for mksurfdata - - - -Urban dataset for mksurfdata - - - -Biogenic Volatile Organic Compounds (VOC) emissions dataset for mksurfdata - - - -If TRUE, output variables in double precision for mksurfdata - - - -If TRUE, ignore other files, and set the output percentage to 100% urban and -zero for other land-use types. - - - -Number of Plant Functional Types (excluding bare-soil) - - - -Plant Function Type index to override global file with for mksurfdata - - - -Plant Function Type fraction to override global file with for mksurfdata - - - -Soil color index to override global file with for mksurfdata - - - -Soil maximum fraction to override global file with for mksurfdata - - - -Soil percent sand to override global file with for mksurfdata - - - -Soil percent clay to override global file with for mksurfdata - - - - - - - -Orography file with surface heights and land area fraction - - - -CLM grid file - - - -CESM domain file - - - -CAM file - - - -Raw topography file - - - -CAM topography file - - - -Number of longitudes to use for a regional grid (for single-point set to 1) - - - -Number of latitudes to use for a regional grid (for single-point set to 1) - - - -Northern edge of the regional grid - - - -Southern edge of the regional grid - - - -Eastern edge of the regional grid - - - -Western edge of the regional grid - - - - - - - -Historical greenhouse gas concentrations from CAM, only used -by getco2_historical.ncl - - - - - - -Aerosol deposition file name (only used for aerdepregrid.ncl) - - - -Full pathname of CLM fraction dataset (only used for mkdatadomain). - - - -Full pathname of CLM grid dataset (only used for mkdatadomain). - - - -Full pathname of output domain dataset (only used for mkdatadomain). - - - -Type of domain file to create (ocean or atmosphere) (only used for mkdatadomain) - - - - - - - -First year to loop over for Nitrogen Deposition data - - - -Last year to loop over for Nitrogen Deposition data - - - -Simulation year that aligns with stream_year_first_ndep value - - - -Filename of input stream data for Nitrogen Deposition - - - -Mapping method from Nitrogen deposition input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - -datm input directory - - -datm output directory - - -Datm logfile name - - - - - - - -Mapping file to go from one resolution/land-mask to another resolution/land-mask - - - -Land mask description for mksurfdata input files - - - -Horizontal grid resolutions for mksurfdata input files - - - - - - - -Check that the resolution and land-mask is valid before continuing. - - - -Add a note to the output namelist about the options given to build-namelist - - - -CLM run type. - 'default' use the default type of clm_start type for this configuration - 'cold' is a run from arbitrary initial conditions - 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found - 'startup' is an initial run with initial conditions provided. - 'continue' is a restart run. - 'branch' is a restart run in which properties of the output history files may be changed. - - - -Horizontal resolutions -Note: 0.1x0.1, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools - - - -Representative concentration pathway for future scenarios [radiative forcing at peak or 2100 in W/m^2] --999.9 means do NOT use a future scenario, just use historical data. - - - -Land mask description - - - -Command line argument for setting up your simulation in a mode for faster -throughput. By default turns off some options, and sets up for a lower level -of output. When bgc_mode is some level of prognostic BGC (so NOT Satellite Phenology) -it also sets up for accelerated decomposition. -NOTE: THIS CORRESPONDS DIRECTLY TO THE env_run.xml VARIABLE OF THE SAME NAME. - Set the env_run variable, rather than setting this directly. - - - -General configuration of model version and atmospheric forcing to tune the model to run under. -This sets the model to run with constants that were set to run well under the configuration -of model version and atmospheric forcing. To run well constants would need to be changed -to run with a different type of atmospheric forcing. - - - -If TRUE, irrigation will be active (find surface datasets with active irrigation). - - - -If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) - - - -Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) -A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year greater than 2005 corresponds to rcp scenario data -Most years are only used for clm_tools and there aren't CLM datasets that correspond to them. -CLM datasets exist for years: 1000 (for testing), 1850, and 2000 - - - -Range of years to simulate transitory datasets for (such as dynamic: land-use datasets, aerosol-deposition, Nitrogen deposition rates etc.) -Constant means simulation will be held at a constant year given in sim_year. -A sim_year_range of 1000-1002 or 1000-1004 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year_range that goes beyond 2005 corresponds to historical data until 2005 and then scenario data beyond that point. - - - -Namelist entries to demand be provided on the namelist. - - - -Description of the use case selected. - - - - - - - -Where dry deposition is calculated (from land, atmosphere, or from a table) - - - - -List of chemical constituents that dry deposition will be calculated for - - - - - - - -File containing MEGAN emissions factors. Includes the list of MEGAN compounds that can be -used in the Comp_Name variable on the file. - - - -MEGAN specifier. This is in the form of: Chem-compound = megan_compound(s) -where megan_compound(s) can be the sum of megan compounds with a "+" between them. -In each equation, the item to the left of the equal sign is a CAM chemistry compound, the -items to the right are compounds known to the MEGAN model (single or combinations). -For example, -megan_specifier = 'ISOP = isoprene', - 'C10H16 = pinene_a + carene_3 + thujene_a' - - - -MEGAN mapped isoprene emissions factors switch -If TRUE then use mapped MEGAN emissions factors for isoprene. - - - -List of possible MEGAN compounds to use - (the list used by the simulation is on the megan_factors_file as the Comp_Name) - - - - - -Enable C13 model - - - -Enable C14 model - - - diff --git a/bld/namelist_files/namelist_definition_clm4_5.xml b/bld/namelist_files/namelist_definition_clm4_5.xml deleted file mode 100644 index 0a4bbd9a28..0000000000 --- a/bld/namelist_files/namelist_definition_clm4_5.xml +++ /dev/null @@ -1,2456 +0,0 @@ - - - - - - - - - - - -If use_init_interp is set to .true., interpinic will be called to interpolate -the file given by finidat, creating the output file specified by finidat_interp_dest. - - - -Full pathname of initial conditions file. If blank CLM will startup from -arbitrary initial conditions. - - - -If set to .true., interpinic will be called to interpolate the file given by finidat, -creating the output file specified by finidat_interp_dest. - -This requires that finidat be non-blank. - - - -Full pathname of master restart file for a branch run. (only used if RUN_TYPE=branch) -(Set with RUN_REFCASE and RUN_REFDATE) - - - -Full pathname of land fraction data file. - - - -Clumps per processor. - - - -Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) -(Set by CCSM_CO2_PPMV) - - - -Type of CO2 feedback. - constant = use the input co2_ppmv value - prognostic = use the prognostic value sent from the atmosphere - diagnostic = use the diagnostic value sent from the atmosphere - - - - -Supplemental Nitrogen mode and for what type of vegetation it's turned on for. -In this mode Nitrogen is unlimited rather than prognosed and in general vegetation is -over-productive. - NONE = No vegetation types get supplemental Nitrogen - ALL = Supplemental Nitrogen is active for all vegetation types - - - -If TRUE, separate the vegetated landunit into a crop landunit and a natural vegetation landunit - - - -If TRUE, run all urban landunits everywhere where we have valid urban data. -This forces memory to be allocated and calculations to be run even for 0-weight urban points. -This has a substantial impact on memory use and performance, and should only be used -if you're interested in potential urban behavior globally. - - - -If TRUE, make ALL pfts, columns and landunits active, even those with 0 weight. -This means that computations will be run even over these 0-weight points. - -THIS IS ONLY FOR TESTING PURPOSES - IT HAS NOT BEEN CHECKED FOR SCIENTIFIC VALIDITY. - - - -If TRUE, square the organic fraction when it's used (as was done in CLM4.5) -Otherwise use the fraction straight up (the default for CLM5.0) - - - -10SL_3.5m = standard CLM4 and CLM4.5 version -23SL_3.5m = more vertical layers for permafrost simulations -49SL_10m = 49 layer soil column, 10m of soil, 5 bedrock layers -20SL_8.5m = 20 layer soil column, 8m of soil, 5 bedrock layers - - - -If TRUE, use variable soil depth. - -If present on surface dataset, use depth to bedrock information to -specify spatially variable soil thickness. If not present, use bottom -of soil column (nlevsoi). - - - -Index of rooting profile for water - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of rooting profile for carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of rooting profile for soil carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Variant index of rooting profile for water -(Currently only used for Jackson 1996 method) - - - -Variant index of rooting profile for carbon and soil carbon -(Currently only used for Jackson 1996 method) - - - -Index of rooting profile for carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of evaporative resistance method. - -Changes soil evaporative resistance method from Sakaguchi and Zeng -2009 Beta function (0) to Swenson and Lawrence 2014 dry surface layer -formulation (1). - - - -The method type to use for CNFire - -nofire: Turn fire effects off -li2014qianfrc: Reference paper Li, et. al.(2014) tuned with QIAN atmospheric forcing -li2016crufrc: Reference paper Li, et. al.(2016) tuned with CRU-NCEP atmospheric forcing - - - -Potential human ignition counts (/person/month) - - - -boreal peat fires (/hr) - - - -non-boreal peat fires (/hr) - - - -Scalar for cropfire (/hr) - - - -Critical RH for ignition (0-100) - - - -Saturation RH for ignition (0-100) - - - -Lower threshold for fuel mass needed for ignition - - - -Upper threshold for fuel mass needed for ignition - - - -Saturation BTRAN for ignition (0-1) - - - -Critical BTRAN for ignition (0-1) - - - -Global constant for deforestation fires (/day) - - - -Fire occurance for high GDP areas that are tree dominated (fraction) - - - -Combustion completeness factor (for litter and CWD[Course Woody Debris]) (unitless) - - - -Critical threshold for truncation of Nitrogen (truncate Nitrogen states to zero below this value) - - - -Critical threshold for truncation of Carbon (truncate Carbon states to zero below this value) - - - -Critical threshold of negative Nitrogen to die (abort when Nitrogen states are below this value) - - - -Critical threshold of negative Carbon to die (abort when Carbon states are below this value) - - - -Initial stocks of Carbon to use in soil organic matter pools for CENTURY decomposition - - - -Soil depth to place initial stocks of Carbon in soil organic matter pools for CENTURY decomposition - - - -Slope of free living Nitrogen fixation with annual ET - - - -Intercept of free living Nitrogen fixation with zero annual ET - - - -If TRUE use the undercanopy stability term used with CLM4.5 (Sakaguchi&Zeng, 2008) - - - -Fraction of intercepted precipitation - - - -If TRUE use clm5 equation for fraction of intercepted precipitation - - - -Maximum fraction of leaf that may be wet prior to drip occuring - - - -Scalar multiplier for base flow rate -(ONLY used if lower_boundary_condition is not aquifer or table) - - - -Index of solution method of Richards equation. - -Change method for richards equation solution and boundary -conditions. - -CLM 4.5 - soilwater_movement_method = 0 (Zeng and Decker, 2009, method). -CLM 5.0 - soilwater_movement_method = 1 (adaptive time stepping moisture form from Martyn Clark). - -1 (adaptive time stepping moisture form - - - -Index of upper boundary condition for Richards equation. - - - -Index of lower boundary condition for Richards equation. - -lower_boundary_condition = 1 : flux lower boundary condition (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 2 : zero-flux lower boundary condition (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 3 : water table head-based lower boundary condition w/ aquifer layer. (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 4 : 11-layer solution w/ aquifer layer (only used with soilwater_movement_method=Zeng&Decker 2009) - -TODO(bja, 2015-09) these should be strings so they have meaningful names instead of ints. - - - -minimum time step length (seconds) for adaptive time stepping in richards equation - - -a very small number: used to check for sub step completion for adaptive time stepping in richards equation - - -tolerance to halve length of substep for adaptive time stepping in richards equation - - -tolerance to double length of substep for adaptive time stepping in richards equation - - - - - - - - - - - - -Minimum leaf area index for irrigation to occur - - - -Time of day to check whether we need irrigation, seconds (0 = midnight). -We start applying the irrigation in the time step FOLLOWING this time. - - - -Desired amount of time to irrigate per day (sec). -Actual time may differ if this is not a multiple of dtime. - - - -Target soil matric potential for irrigation (mm). -When we irrigate, we aim to bring the total soil moisture in the top (irrig_depth) m of soil up to this level. - - - -Soil depth to which we measure for irrigation (m) - - - -Determines soil moisture threshold at which we irrigate. -If h2osoi_liq_wilting_point is the soil moisture level at wilting point and -h2osoi_liq_target is the soil moisture level at the target irrigation level -(given by irrig_target_smp), then the threshold at which we irrigate is - h2osoi_liq_wilting_point + - irrig_threshold_fraction*(h2osoi_liq_target - h2osoi_liq_wilting_point) -A value of 1 means that we irrigate whenever soil moisture falls below the target. -A value of 0 means that we only irrigate when soil moisture falls below the wilting point. - - - -Threshold for river water volume below which irrigation is shut off (as a fraction of available river water), if limit_irrigation_if_rof_enabled is .true. -A threshold of 0 means allow all river water to be used; -a threshold of 0.1 means allow 90% of the river volume to be used; etc. - - - -If TRUE, limit irrigation when river storage drops below a threshold. -Only applies if using an active runoff (ROF) model; otherwise, river storage-based limitation -is turned off regardless of the setting of this namelist variable. - - - -If TRUE, irrigation will be active. - - - -Number of multiple elevation classes over glacier points. - - - -If TRUE, dynamically change areas and topographic heights over glacier points. -Only works when running with a non-stub glacier model. - - - -Behavior of each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'multiple': grid cells can potentially have multiple glacier elevation classes, - but no virtual columns -'virtual': grid cells have virtual columns: values are computed for every glacier - elevation class, even those with 0 area (in order to provide surface mass - balance for every glacier elevation class). -'single_at_atm_topo': glacier landunits in these grid cells have a single column, - whose elevation matches the atmosphere's topographic height (so that there is no - adjustment due to downscaling) -Behavior of 'virtual' is required in the region where we have an ice sheet model - - - -Treatment of ice melt for each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'replaced_by_ice': any melted ice runs off and is immediately replaced by solid ice; - this results in positive liquid runoff and negative ice runoff -'remains_in_place': any melted ice remains in place as liquid until it refreezes; - thus, ice melt does not result in any runoff -IMPORTANT NOTE: Regions with the 'remains_in_place' behavior also do not -compute SMB (because negative SMB would be pretty much meaningless in -those regions). Thus, you cannot use this behavior where GLC is -operating. -Regions with the 'replaced_by_ice' behavior also compute SMB for the -vegetated column. - - - -Treatment of ice runoff for each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'remains_ice': ice runoff is sent to the river model as ice; this is a crude parameterization - of iceberg calving, and so is appropriate in regions where there is substantial iceberg calving - in reality -'melted': ice runoff generated by the CLM physics (primarily due to snow capping) is melted - (generating a negative sensible heat flux) and runs off as liquid; this is appropriate in - regions that have little iceberg calving in reality. This can be important to avoid unrealistic - cooling of the ocean and consequent runaway sea ice growth. -Only applies when melt_non_icesheet_ice_runoff is .true. - - - -Number of days before one considers the perennially snow-covered point 'land ice' -(and thus capable of generating a positive surface mass balance for the glacier model). -This is meant to compensate for the fact that, with small values of h2osno_max, -the onset of a snow-capped state (and thus conversion to land ice) can occur in an -unrealistically short amount of time. -Thus, in general, large values of h2osno_max should have glc_snow_persistence_max_days = 0; -small values of h2osno_max should have glc_snow_persistence_max_days > 0. - - - -Visible and Near-infrared albedo's for glacier ice - - - -CN Maintenence Respiration base rate for roots -(if NOT set, use the value for br_mr on the params file) - - - -Switch to turn on root and stem respiratory acclimation -Atkin, Fisher et al. (2008) and Lombardozzi et al. (2015) - - - -Switch to inihibit photosynthesis in daytime -Lloyd et al. 2010, & Metcalfe et al. 2012 - - - -Modify photosynthesis and leaf maintence respiration for crop - - - -Leaf maintencence respiration for canopy top at 25C method to use - - 0 Scaled by vcmax25top - 1 Ryan 1991 - 2 Atkin 2015 - - - -Stomatal conductance model method to use - - Ball-Berry1987 --- Ball Berry 1987 methodology - Medlyn2011 ------- Medlyn 2011 methodology - - - - -Scalar of leaf respiration to vcmax - - - -The maximum value to use for zeta under stable conditions - - - -baseline proportion of nitrogen allocated for electron transport (J) - - - -Time step (seconds) - - - -Override the start type from the driver: it can only be -set to 3 meaning branch. - - - -Toggle to turn on the FATES model -(use_fates= '.true.' is EXPERIMENTAL NOT SUPPORTED!) - - - -Toggle to turn on spitfire module for modeling fire (only relevant if FATES is being used). - - - -Toggle to turn on the logging module (only relevant if FATES is being used). - - - -Toggle to turn on plant hydraulics (only relevant if FATES is on). -(use_fates_planthydro=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) - - - -Toggle to turn on Static Stand Structure Mode (only relevant if FATES is being used). -(use_fates_ed_st3=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) - - - -Toggle to turn on prescribed physiology (only relevant if FATES is being used). - - - -Toggle to turn on inventory initialization to startup FATES (only relevant if FATES is being used). -(use_fates_inventory_init=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) - - - -Full pathname to the inventory initialization control file. -(Required, if use_fates_inventory_init=T) - - - -Toggle to turn on the LUNA model, to effect Photosynthesis by leaf Nitrogen -LUNA operates on C3 and non-crop vegetation (see vcmax_opt for how other veg is handled) -LUNA: Leaf Utilization of Nitrogen for Assimilation - - - -Toggle to turn on the plant hydraulic stress model - - - -How LUNA and Photosynthesis (if needed) will get Leaf nitrogen content - lnc_opt = true get from leaf N from CN model - lnc_opt = false get based on LAI and fixed CN ratio from parameter file - - - -Full pathname datafile with plant function type (PFT) constants combined with -constants for biogeochem modules - - - -Full pathname datafile with fates parameters - - - -Full pathname of surface data file. - - - -SNICAR (SNow, ICe, and Aerosol Radiative model) optical data file name - - - -SNICAR (SNow, ICe, and Aerosol Radiative model) snow aging data file name - - - -Per file averaging flag. - 'A' (average over history period) - 'I' (instantaneous) - 'X' (maximum over history period) - 'M' (minimum over history period) - - - -Averaging type of output for 1D vector output (when hist_dov2xy is false). - GRID means average all land-units up to the grid-point level - LAND means average all columns up to the land-unit level - COLS means average all PFT's up to the column level - PFTS means report everything on native PFT level - - - -If TRUE, implies output data on a 2D latitude/longitude grid. False means -output in 1D vector format. One setting per history tape series. - - - -If TRUE, indicates do NOT output any default history fields (requires you to use -hist_fincl* to set the exact output fields to use).. - - - -Fields to exclude from history tape series 1. - - - -Fields to exclude from history tape series 2. - - - -Fields to exclude from history tape series 3. - - - -Fields to exclude from history tape series 4. - - - -Fields to exclude from history tape series 5. - - - -Fields to exclude from history tape series 6. - - - -Fields to exclude from history tape series 7. - - - -Fields to exclude from history tape series 8. - - - -Fields to exclude from history tape series 9. - - - -Fields to exclude from history tape series 10. - - - -Fields to add to history tape series 1. - - - -Fields to add to history tape series 2. - - - -Fields to add to history tape series 3. - - - -Fields to add to history tape series 4. - - - -Fields to add to history tape series 5. - - - -Fields to add to history tape series 6. - - - -Fields to add to history tape series 7. - - - -Fields to add to history tape series 8. - - - -Fields to add to history tape series 9. - - - -Fields to add to history tape series 10. - - - -Per tape series maximum number of time samples. - - - -Per tape series history file density (i.e. output precision) - 1=double precision - 2=single precision -Default: 2,2,2,2,2,2,2,2,2,2 - - - -Per tape series history write frequency. - positive means in time steps - 0=monthly - negative means hours -(i.e. 5 means every 24 time-steps and -24 means every day -Default: 0,-24,-24,-24,-24,-24,-24,-24,-24,-24 - - - -number of segments per clump for decomposition -Default: 20 - - - -Perturbation limit when doing error growth test - - - -If FALSE, don't write any restart files. - - - -Turn urban air conditioning/heating ON or OFF and add wasteheat: - OFF = Air conditioning/heating is OFF in buildings, internal temperature allowed to float freely - ON = Air conditioning/heating is ON in buildings, internal temperature constrained - ON_WASTEHEAT = Air conditioning/heating is ON and waste-heat sent to urban canyon - - - -If TRUE, urban traffic flux will be activated (Currently NOT implemented). - - - -0 = simpler method (clm4_5) -1 = prognostic calculation of interior building temp (clm5_0) - - - -If TRUE, human stress indices will be calculated - - - -If TRUE, write diagnostic of global radiative temperature written to CLM log file. - - - -Subgrid fluxes for snow - - - -Turn vegetation snow canopy ON, OFF, or ON with albedo influence (ON_RAD) - - - - - - -Turn on methane model. Standard part of CLM45BGC model. - - - -CLM Biogeochemistry mode : Carbon Nitrogen model (CN) -(or CLM45BGC if phys=clm4_5, vsoilc_centbgc='on', and clm4me='on') - - - -CLM Biogeochemistry mode : Carbon Nitrogen with Dynamic Global Vegetation Model (CNDV) -(or CLM45BGCDV if phys=clm4_5, vsoilc_centbgc='on', and clm4me='on') - - - -Turn the Fixation and Uptate of Nitrogen model version 2 (FUN2.0) -Requires the CN model to work (either CN or CNDV). - - - -Nitrification/denitrification splits the prognostic mineral N pool into two - mineral N pools: NO3 and NH4, and includes the transformations between them. -Requires the CN model to work (either CN or CNDV). - - - -Multiplier for heterotrophic respiration for max denitrification rates -(ONLY used if use_nitrif_denitrif is enabled) - - - -Exponent power for heterotrophic respiration for max denitrification rates -(ONLY used if use_nitrif_denitrif is enabled) - - - -Multiplier for nitrate concentration for max denitrification rates -(ONLY used if use_nitrif_denitrif is enabled) - - - -Exponent power for nitrate concentrationfor max denitrification rates -(ONLY used if use_nitrif_denitrif is enabled) - - - -Maximum nitrification rate constant (1/s) -(ONLY used if use_nitrif_denitrif is enabled) - - - -Turn on vertical soil carbon. -Requires the CN or FATES model to work (either CN or CNDV). - - - -Use parameters for decomposition from the CENTURY Carbon model -Requires the CN or FATES model to work (either CN or CNDV). - - - -Toggle to use 25 lake layers instead of 10 -(extralaklayers=".true." is EXPERIMENTAL NOT SUPPORTED! Nor is it Tested!) - - - -Toggle to turn on the VIC hydrologic parameterizations -(vichydro=".true." is EXPERIMENTAL NOT SUPPORTED!) - - - -Toggle to turn on the prognostic crop model - - - -Toggle to turn on the prognostic fertilizer for crop model - - - -Toggle to turn on the 1-year grain product pool in the crop model - - - -Type of mapping to use for base temperature for prognostic crop model -constant = Just use baset from the PFT parameter file -varytropicsbylat = Vary the tropics by latitude - - - -Only used when baset_mapping == varytropicsbylat -Slope with latitude in degrees to vary tropical baset by - - - -Only used when baset_mapping == varytropicsbylat -Intercept at zero latitude to add to baset from the PFT parameter file - - - -Initial seed Carbon to use at planting -(only used when CN is on as well as crop) - - - -Toggle to turn on ozone stress - - - -Toggle to turn on calculation of SNow and Ice Aerosol Radiation model (SNICAR) radiative forcing -(snicar_frc=".true." is EXPERIMENTAL NOT SUPPORTED!) - - - -Toggle to turn all history output completely OFF (possibly used for testing) - - - -Toggle for vancouver specific logic. - - - -Toggle for mexico city specific logic. - - - -Max number of plant functional types in naturally vegetated landunit. - - - -Toggle to turn on the dynamic root model - - - - - - -SCRIP format grid data file - - - -Flag to pass to the ESMF mapping utility, telling it what kind of large -file support is needed for an output file generated with this grid as -either the source or destination ('none', '64bit_offset' or 'netcdf4'). - - - -Flag to pass to the ESMF mapping utility, telling it what kind of grid -file this is (SCRIP or UGRID). - - - -For UGRID files, flag to pass to the ESMF mapping utility, telling it the -name of the dummy variable that has all of the topology information stored -in its attributes. (Only used if scripgriddata_src_type = UGRID.) - - - - - - -Output of "git describe" to give the tag/commit the version being used corresponds to - - - -Filename for mksurfdata_map to remap raw data into the output surface dataset - - - -Plant Function Type dataset for mksurfdata - - - -Harvest dataset for mksurfdata - - - -Dataset for percent glacier land-unit for mksurfdata - - - -Dataset for glacier region ID for mksurfdata - - - -Dataset for topography used to define urban threshold - - - -Leaf Area Index dataset for mksurfdata - - - -Soil texture dataset for mksurfdata - - - -Soil color dataset for mksurfdata - - - -Soil max fraction dataset for mksurfdata - - - -High resolution land mask/fraction dataset for mksurfdata -(used for glacier_mec land-units) - - - -Type of grid to create for mksurfdata - - - -Grid file at the output resolution for mksurfdata - - - -Text file with filepaths (or list of XML elements) for vegetation fractions -and harvesting for each year to run over for mksurfdata to be able to model -transient land-use change - - - -High resolution topography dataset for mksurfdata -(used for glacier_mec land-units) - - - -Irrigation dataset for mksurfdata - - - -Organic soil dataset for mksurfdata - - - -Lake water dataset for mksurfdata - - - -Wetland dataset for mksurfdata - - - -Urban dataset for mksurfdata - - - -Biogenic Volatile Organic Compounds (VOC) emissions dataset for mksurfdata - - - -GDP dataset for mksurfdata - - - -Peat dataset for mksurfdata - - - -Soil depth dataset for mksurfdata - - - -Agricultural burning dominant month dataset for mksurfdata - - - -Topography statistics dataset for mksurfdata - - - -VIC parameters dataset for mksurfdata - - - -Inversion-derived CH4 parameters dataset for mksurfdata - - - -If TRUE, output variables in double precision for mksurfdata - - - -If TRUE, ignore other files, and set the output percentage to 100% urban and -zero for other land-use types. - - - -If TRUE, set wetland to 0% over land (renormalizing other landcover types as needed); -wetland will only be used for ocean points. - - - -Number of Plant Functional Types (excluding bare-soil) - - - -Plant Function Type index to override global file with for mksurfdata - - - -Plant Function Type fraction to override global file with for mksurfdata - - - -Soil color index to override global file with for mksurfdata - - - -Soil maximum fraction to override global file with for mksurfdata - - - -Soil percent sand to override global file with for mksurfdata - - - -Soil percent clay to override global file with for mksurfdata - - - - - - - -Orography file with surface heights and land area fraction - - - -CLM grid file - - - -CESM domain file - - - -CAM file - - - -Raw topography file - - - -CAM topography file - - - -Number of longitudes to use for a regional grid (for single-point set to 1) - - - -Number of latitudes to use for a regional grid (for single-point set to 1) - - - -Northern edge of the regional grid - - - -Southern edge of the regional grid - - - -Eastern edge of the regional grid - - - -Western edge of the regional grid - - - - - - - -Historical greenhouse gas concentrations from CAM, only used -by getco2_historical.ncl - - - - - - -Aerosol deposition file name (only used for aerdepregrid.ncl) - - - -Full pathname of CLM fraction dataset (only used for mkdatadomain). - - - -Full pathname of CLM grid dataset (only used for mkdatadomain). - - - -Full pathname of output domain dataset (only used for mkdatadomain). - - - -Type of domain file to create (ocean or atmosphere) (only used for mkdatadomain) - - - - - - - -If TRUE, repartition rain/snow from atmosphere based on temperature. - - - -If TRUE, downscale longwave radiation over glc_mec landunits. -This downscaling is conservative. -Default: .true. - - - -Surface temperature lapse rate (K m-1) -A positive value means a decrease in temperature with increasing height - - - -Longwave radiation lapse rate (W m-2 m-1) -A positive value means a decrease in LW radiation with increasing height -Only relevant if glcmec_downscale_longwave is .true. - - - -Relative limit for how much longwave downscaling can be done (unitless) -The pre-normalized, downscaled longwave is restricted to be in the range -[lwrad*(1-longwave_downscaling_limit), lwrad*(1+longwave_downscaling_limit)] -This parameter must be in the range [0,1] -Only relevant if glcmec_downscale_longwave is .true. - - - -Temperature below which all precipitation falls as snow, for glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature above which all precipitation falls as rain, for glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature below which all precipitation falls as snow, for non-glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature above which all precipitation falls as rain, for non-glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - - - - - -If TRUE, ice runoff generated from non-glacier columns and glacier columns outside icesheet regions -is converted to liquid, with an appropriate sensible heat flux. -That is, the atmosphere (rather than the ocean) melts the ice. -(Exception: ice runoff generated to ensure conservation with dynamic landunits remains as ice.) - - - - - - - -First year to loop over for Nitrogen Deposition data - - - -Last year to loop over for Nitrogen Deposition data - - - -Simulation year that aligns with stream_year_first_ndep value - - - -Filename of input stream data for Nitrogen Deposition - - - -Time interpolation mode to determine how to handle data before and after the times in the file - cycle = Always cycle over the data - extend = Use the first time before the available data, and use the last time after the available data - limit = Only use the data within the times available -- abort if the model tries to go outside it - - - -Colon delimited list of variables to read from the streams file for nitrogen deposition -(Normally just read the single variable NDEP_year or NDEP_month) - - - -Mapping method from Nitrogen deposition input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - - - - - -Filename of input stream data for finundated inversion of observed (from Prigent dataset) -to hydrologic variables (either TWS or ZWT) - - - - - - - - -Toggle to turn on use of LAI streams in place of the LAI on the surface dataset when using Satellite Phenology mode. -(EXPERIMENTAL and NOT tested) - - - -First year to loop over for LAI data - - - -Last year to loop over for LAI data - - - -Simulation year that aligns with stream_year_first_lai value - - - -Filename of input stream data for LAI - - - -Mapping method from LAI input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - - - - - - -First year to loop over for Lightning data - - - -Last year to loop over for Lightning data - - - -Simulation year that aligns with stream_year_first_lightng value - - - -Filename of input stream data for Lightning - - - -Mapping method from Lightning input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - - - - - - - -First year to loop over for human population density data - - - -Last year to loop over for human population density data - - - -Simulation year that aligns with stream_year_first_popdens value - - - -Filename of input stream data for human population density - - - -Mapping method from human population density input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - - - - - - - -First year to loop over for urban time varying data - - - -Last year to loop over for urban time varying data - - - -Simulation year that aligns with stream_year_first_urbantv value - - - -Filename of input stream data for urban time varying - - - -Mapping method from urban time varying input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - -datm input directory - - -datm output directory - - -Datm logfile name - - - - - - - -Mapping file to go from one resolution/land-mask to another resolution/land-mask - - - -Land mask description for mksurfdata input files - - - -Horizontal grid resolutions for mksurfdata input files - - - - - - - - -Resolution of finundated inversion streams dataset (stream_fldfilename_ch4finundated) -to use for methane model -(only applies when CN and methane model are turned on) - - - -Resolution of Lightning dataset to use for CN fire model -(only applies when CN and the CN fire model are turned on) - - - -Check that the resolution and land-mask is valid before continuing. - - - -Add a note to the output namelist about the options given to build-namelist - - - -CLM run type. - 'default' use the default type of clm_start type for this configuration - 'cold' is a run from arbitrary initial conditions - 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found - 'startup' is an initial run with initial conditions provided. - 'continue' is a restart run. - 'branch' is a restart run in which properties of the output history files may be changed. - - - -Horizontal resolutions -Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools - - - -Representative concentration pathway for future scenarios [radiative forcing at peak or 2100 in W/m^2] --999.9 means do NOT use a future scenario, just use historical data. - - - -Land mask description - - - -General configuration of model version and atmospheric forcing to tune the model to run under. -This sets the model to run with constants and initial conditions that were set to run well under -the configuration of model version and atmospheric forcing. To run well constants would need to be changed -to run with a different type of atmospheric forcing. - - - -If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) - - - -Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) -A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year greater than 2005 corresponds to rcp scenario data -Most years are only used for clm_tools and there aren't CLM datasets that correspond to them. -CLM datasets exist for years: 1000 (for testing), 1850, and 2000 - - - -Range of years to simulate transitory datasets for (such as dynamic: land-use datasets, aerosol-deposition, Nitrogen deposition rates etc.) -Constant means simulation will be held at a constant year given in sim_year. -A sim_year_range of 1000-1002 or 1000-1004 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year_range that goes beyond 2005 corresponds to historical data until 2005 and then scenario data beyond that point. - - - -Namelist entries to demand be provided on the namelist. - - - -Description of the use case selected. - - - -Attributes to use when looking for an initial condition file (finidat) if interpolation is turned on (use_init_interp is .true.) - - - -How close in years to use when looking for an initial condition file (finidat) if interpolation is turned on (use_init_interp is .true.) - - - -Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) - - - -Command line argument for setting up your simulation in a mode for faster -throughput. By default turns off some options, and sets up for a lower level -of output. When bgc_mode is some level of prognostic BGC (so NOT Satellite Phenology) -it also sets up for accelerated decomposition. -NOTE: THIS CORRESPONDS DIRECTLY TO THE env_run.xml VARIABLE OF THE SAME NAME. - Set the env_run variable, rather than setting this directly. - - - -Command line arguement for biogeochemistry mode for CLM4.5 - sp = Satellitte Phenology - cn = Carbon Nitrogen model - bgc = CLM4.5 BGC model with: - CENTURY model pools - Nitrification/De-nitrification - Methane model - Vertically resolved Carbon - fates = FATES/ED ecosystem demography model with below ground BGC: - - - - - - - -Flag for overriding the crash that should occur if user tries to start the model from a restart file made with a different version of the soil decomposition structure than is currently being used. - - - -Flag for setting the state of the Accelerated decomposition spinup state for the BGC model. - 0 = normal model behavior; - 1 = AD spinup (standard) - 2 = AD spinup (accelerated spinup from Ricciuto, doesn't work for CNDV and not implemented for CN soil decomposition) -Entering and exiting spinup mode occurs automatically by comparing the namelist and restart file values for this variable. -NOTE: THIS CAN ONLY BE SET TO NON-ZERO WHEN BGC_MODE IS NOT SATELITE PHENOLOGY! - - - - -Base advective flux (downwards) for SOM. - - - -Maximum depth to mix soils to by croturbation, in permafrost soils. - - - - -E-folding depth over which decomposition is slowed with depth in all soils. - - - -If TRUE, reduce heterotrophic respiration according to available oxygen predicted by CH4 submodel. - - - -If TRUE, weight calculation of oxygen limitation by the inundated fraction and diagnostic saturated column gas -concentration profile calculated in the CH4 submodel. Only applies if anoxia = TRUE. -(EXPERIMENTAL AND NOT FUNCTIONAL!) -(deprecated -- will be removed) - - - -separate q10 for frozen soil respiration rates. default to same as above zero rates - - - - - -If TRUE, add extra diagnostics for methane model to the history files - - - -Profile over which to distribute C and N coming from surface pools (leaves, stem, grain). - - - - -If true, no denitrification or nitrification in frozen soil layers. -(EXPERIMENTAL and NOT tested) - - - -Number of days over which to use exponential relaxation of NPP in N fixation calculation - - - - -Flag to reseed any dead plants on startup from reading the initial conditions file - - - - -Enable C13 model - - - -Enable C14 model - - - -Flag to use the atmospheric time series of C14 concentrations from bomb fallout and Seuss effect, rather than natural abundance C14 (nominally set as 10^-12 mol C14 / mol C) - - - -Filename with time series of atmospheric Delta C14 data. variables in file are "time" and "Delta14co2_in_air". time variable is in format: years since 1850-01-01 0:0:0.0 units are permil. - - - -Flag to use the atmospheric time series of C13 concentrations from natural abundance and the Seuss Effect, rather than static values. - - - -Filename with time series of atmospheric Delta C13 data, which use CMIP6 format. variables in file are "time" and "delta13co2_in_air". time variable is in format: years since 1850-01-01 0:0:0.0. units are permil. - - - - - - -If TRUE, weight btran (vegetation soil moisture availability) by unfrozen layers only, assuming that vegetation -will allocate roots preferentially to the active layer. -(EXPERIMENTAL and NOT tested) - - - -If TRUE, weight btran (vegetation soil moisture availability) by the active layer, as defined by the greatest thaw depth over the current and prior years. -(EXPERIMENTAL and NOT tested) - - - - -If TRUE use additional stress deciduous onset trigger - - - -Apply the guardrail for leaf-Nitrogen that ensures it doesn't go negative or too small - - - - - - - -Allow the CN ratio to flexibly change with the simulation, rather than being fixed - - - - Michaelis Menten nitrogen uptake kinetics - - - -How much Carbon to initialize vegetation pools (leafc/frootc and storage) to when -- Michaelis Menten nitrogen uptake kinetics is on - - - - GPP downregulation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Plant nitrogen demand for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten substrate limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten nitrogen limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten temperature limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Flexible CN ratio used for Phenology -(EXPERIMENTAL and NOT tested) - - - - Reduce day length factor -(NOT implemented) - - - -Vcmax calculation for Photosynthesis - vcmax_opt = 4 As for vcmax_opt=0, but using leafN, and exponential if tree (EXPERIMENTAL NOT TESTED!) - vcmax_opt = 3 Based on leafN and VCAD (used with Luna for crop and C4 vegetation) - vcmax_opt = 0 Based on canopy top and foilage Nitrogen limitation factor from params file (clm4.5) - - - -Residual option for flexible-CN -(EXPERIMENTAL and NOT tested) - - - -Partition option for flexible-CN - CN_partition_opt = 1 -(EXPERIMENTAL and NOT tested) - - - -Evergreen phenology option for CNPhenology -(EXPERIMENTAL and NOT tested) - - - -Carbon respiration option to burn off carbon when CN ratio is too high (do NOT use when FUN is on) -(EXPERIMENTAL and NOT tested) - - - - - - - - -Minimum lake depth to increase non-molecular thermal diffusivities by the factor deepmixing_mixfact. - - - -Factor to increase non-molecular thermal diffusivities for lakes deeper than deepmixing_depthcrit -to account for unresolved 3D processes. -Set to 1 to - - - -Visible and Near-infrared albedo values for melting lakes. Albedo will relax to these values as temperature -reaches melting when ice is present with no snow layers. Represents puddling, ice disintegration, and white ice. -Set to alblak values (0.6, 0.4) to keep albedo constant for ice-covered lakes without snow layers. - - - - - - - -Use old snow cover fraction from Niu et al. 2007 -(deprecated -- will be removed) - - - -If surface water is active or not -(deprecated -- will be removed) - - - -Use original CLM4 soil hydraulic properties -(deprecated -- will be removed) - - - - - - - -Allows user to tune the value of aereoxid. If set to FALSE, then use the value of aereoxid from -the parameter file (set to 0.0, but may be tuned with values in the range {0.0,1.0}. If set to TRUE, -then don't fix aere (see ch4Mod.F90). -Default: .true. - - - -If TRUE, turn on methane biogeochemistry model for lake columns, using a simplified version of the CH4 submodel. -(EXPERIMENTAL) - - - -If TRUE, apply a limitation to methane production based on the soil pH dataset. - - - -Michaelis-Mentin maximum methane oxidation rate (mol/m^3-water/s), in the unsaturated zone. - - - -If TRUE, maintain constant soil carbon under lakes, and use the methane submodel simply to predict the net conversion of -CO2 (via biological assimilation, decomposition, and methanogenesis) to CH4. If FALSE, transiently decompose initial -soil carbon stock based on soil carbon dataset. NOTE: if FALSE, a new transient source of C is added to the climate system, -so the coupled system will NOT conserve carbon in this mode if the methane model is coupled to the atmosphere. -(EXPERIMENTAL and NOT tested) - - - -Inundated fraction method type to use for the CH4 submodel (possibly affecting soil -heterotrophic respiration and denitrification depending on the configuration), - -h2osfc ----------- Use prognostic saturated fraction h2osfc value calculated in Soil Hydrology -ZWT_inversion ---- Use inversion of Prigent Satellite data to model ZWT -TWS_inversion ---- Use inversion of Prigent Satellite data to model TWS - -Inversion options require additional data on fsurdat or use of stream_fldfilename_ch4finundated files. -(h2osfc option is EXPERIMENTAL and NOT tested) - - - -If TRUE, use the fine root carbon predicted by CN when calculating the aerenchyma area, rather than the parametrization -based on annual NPP, aboveground NPP fraction, and LAI. -(EXPERIMENTAL and NOT tested) - - - -If TRUE, run the methane submodel decoupled from the atmosphere. The atmospheric methane concentration is prescribed by -atmch4, the methane flux is not passed to the atmosphere, and the CO2 flux to the atmosphere is not adjusted for -net methane production. NOTE: Currently this must be TRUE. -(EXPERIMENTAL and NOT functional) - - - - - - - -Full pathname of time varying landuse data file. This causes the land-use types of -the initial surface dataset to vary over time. - - - -If TRUE, apply transient natural PFTs from flanduse_timeseries file. -(Only valid for transient runs, where there is a flanduse_timeseries file.) - - - -If TRUE, apply transient crops from flanduse_timeseries file. -(Only valid for transient runs, where there is a flanduse_timeseries file.) -(Also, only valid for use_crop = true.) - - - -If TRUE, apply harvest from flanduse_timeseries file. -(Only valid for transient runs, where there is a flanduse_timeseries file.) -(Also, only valid for use_cn = true.) - - - -If TRUE, allow area changes at times other than the year boundary. This should -only arise in some test configurations where we artifically create changes more -frequently so that we can run short tests. This flag is only used for -error-checking, not controlling any model behavior. Do not set this in a -production (non-test) run unless you know what you're doing! - - - -If TRUE, set the dynbal water and energy fluxes to zero. This should typically -only be done for testing: This is needed in some tests where we have daily -rather than annual glacier dynamics: if we allow the true dynbal adjustment -fluxes in those tests, we end up with sensible heat fluxes of thousands of W m-2 -or more, which causes CAM to blow up. However, note that setting it to true will -break water and energy conservation! - - - - - - - -If TRUE (which is the default), check consistency between year on the finidat file -and the current model year. This check is only done for a transient run. - - - -If TRUE (which is the default), check consistency between pct_pft on the finidat file -and pct_pft read from the surface dataset. This check is only done for a NON-transient run. - - - - - - - -If TRUE (which is the default), check consistency between pct_nat_pft on the flanduse_timeseries file -and pct_nat_pft read from the surface dataset. - - - - - - - -Number of snow layers. -Values less than 5 are mainly useful for testing, and should not be used for science. - - - -Maximum snow depth in mm H2O equivalent. Additional mass gains will be capped when this depth -is exceeded. -Changes in this value should possibly be accompanied by changes in: -- nlevsno: larger values of h2osno_max should be accompanied by increases in nlevsno -- glc_snow_persistence_max_days: large values of h2osno_max should generally have - glc_snow_persistence_max_days = 0; small values of h2osno_max should generally have - glc_snow_persistence_max_days > 0. - - - -Limit applied to integrated snowfall when determining changes in snow-covered fraction during melt -(mm H2O) - - - -SCA shape parameter for glc_mec (glacier multiple elevation class) columns -For most columns, n_melt is based on the standard deviation of 1km topography in the grid cell; -but glc_mec columns already account for subgrid topographic variability through their use of -multiple elevation classes; thus, to avoid double-accounting for topographic variability -in these columns, we use a fixed value of n_melt. - - - -If TRUE, the density of new snow depends on wind speed, and there is also -wind-dependent snow compaction. - - - -Method used to compute snow overburden compaction -Anderson1976 -- older method, default in CLM45 -Vionnet2012 --- newer method, default in CLM50 - - - -Snow density method to use for low temperatures (below -15C) -TruncatedAnderson1976 -- Truncate the Anderson-1976 equation at the value for -15C -Slater2017 ------------- Use equation from Slater that increases snow density for very cold temperatures (Arctic, Antarctic) - - - -Upper Limit on Destructive Metamorphism Compaction [kg/m3] - - - -Snow compaction overburden exponential factor (1/K) -Not used for snow_overburden_compaction_method=Vionnet2012 - - - -Minimum wind speed tht results in compaction (m/s) - - - -maximum warm (at freezing) fresh snow effective radius [microns] - - - -If set to .true., then reset the snow pack over non-glacier columns to a small value. -This is useful when transitioning from a spinup under one set of atmospheric forcings -to a run under a different set of atmospheric forcings: By resetting too-large snow packs, -we make it more likely that points will remain only seasonally snow-covered under the new -atmospheric forcings. (This is particularly true in a coupled run, where starting with a -too-large snow pack can cool the atmosphere, thus maintaining the too-large snow pack.) - -WARNING: Setting this to .true. will break water conservation for approximately the first -day of the new run. This is by design: The excess snow is completely removed from the system. - - - -If set to .true., then reset the snow pack over glacier columns to a small value. -This is useful when transitioning from a spinup under one set of atmospheric forcings -to a run under a different set of atmospheric forcings: By resetting too-large snow packs, -we make it more likely that points will remain only seasonally snow-covered under the new -atmospheric forcings. (This is particularly true in a coupled run, where starting with a -too-large snow pack can cool the atmosphere, thus maintaining the too-large snow pack.) - -See also reset_snow_glc_ela, which controls the elevation below which -glacier columns are reset. - -WARNING: Setting this to .true. will break water conservation for approximately the first -day of the new run. This is by design: The excess snow is completely removed from the system. - -WARNING: This variable is intended for short test runs, and generally -should not be used for scientific production runs. By resetting snow -below a given elevation, you risk forcing the system to evolve -differently in areas below and above reset_snow_glc_ela. - - - -Only relevant if reset_snow_glc is .true. - -When resetting snow pack over glacier columns, one can choose to do this over all glacier -columns, or only those below a certain elevation. A typical use case is to reset only those -columns that have a seasonal snow pack in the real world, i.e. SMB less than 0, also known as -the equilibrium line altitude (ELA). This parameter sets a single global ELA value. By -setting this parameter to a large value (i.e. 10000 m), all glacier columns will be reset. - -WARNING: This variable is intended for short test runs, and generally -should not be used for scientific production runs. By resetting snow -below a given elevation, you risk forcing the system to evolve -differently in areas below and above reset_snow_glc_ela. - - - - - - - - -If FALSE (which is the default): If an output type cannot be found in the input for initInterp, -code aborts -If TRUE: If an output type cannot be found in the input, fill with closest natural veg column -(using bare soil for patch-level variables) - -NOTE: Natural vegetation and crop landunits always behave as if this were true. e.g., if -we can't find a column with the same type as a given crop column in the output, then we -always fill with the closest natural veg patch / column, regardless of the value of this -flag. So interpolation from non-crop to crop cases can be done without setting this flag. - - - -Method to use for init_interp. Only applies when use_init_interp = .true. - -'general': The general-purpose method that can be used when changing -grids, configurations, etc. This starts off with subgrid areas taken -from the surface dataset. - -'use_finidat_areas': This starts off with subgrid areas taken from the -input finidat file. This is needed to achieve bit-for-bit results in a -coupled case (where areas in initialization impact initial fields sent -to the atmosphere) (but using the 'general' method will typically have -only a very minor impact on results in this case). For this method to -work, the input finidat file needs to be at the same resolution as the -current configuration. So this is a less general form of -init_interp. However, it can be used in cases where the only difference -is in internal memory allocation. In order to catch possible problems, -this uses a different algorithm for finding the input point for each -output point, which ensures that each active output point is associated -with exactly one input point with the same latitude, longitude and -type. This method requires (a) the same grid for input and output, -within roundoff; (b) any non-zero-weight point in the input must have -memory allocated for it in this grid cell in the output (this will be -satisfied if the point is non-zero-weight on the surface dataset or if -it's a point for which we allocate memory even for zero-weight points); -(c) any active point in the output (based on the surface dataset and -rules for determining active points) must have a matching point in this -grid cell in the input. (Note that this generally can NOT be used when -transitioning from a spinup run to a transient run, because spinup runs -typically have irrigation off and transient runs have irrigation on, and -the presence/absence of irrigation affects the subgrid structure; if it -weren't for that difference, then this option would be useful for this -use case.) - - - - diff --git a/bld/namelist_files/namelist_definition_drv.xml b/bld/namelist_files/namelist_definition_drv.xml deleted file mode 100644 index 493f2f2a01..0000000000 --- a/bld/namelist_files/namelist_definition_drv.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - 1.0 - - - - - - - - - diff --git a/bld/namelist_files/namelist_definition_drv_flds.xml b/bld/namelist_files/namelist_definition_drv_flds.xml deleted file mode 100644 index b54082981a..0000000000 --- a/bld/namelist_files/namelist_definition_drv_flds.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - List of files to merge together that contains drv_flds_in namelists - The paths are relative to the case directory. drv_flds_in include the namelists that - the driver reads and gives information on additional fields to be passed to different - components that need to look at the same data. - - - - - - - - File containing MEGAN emissions factors. Includes the list of MEGAN compounds that can be - used in the Comp_Name variable on the file. - - - - MEGAN specifier. This is in the form of: Chem-compound = megan_compound(s) - where megan_compound(s) can be the sum of megan compounds with a "+" between them. - In each equation, the item to the left of the equal sign is a CAM chemistry compound, the - items to the right are compounds known to the MEGAN model (single or combinations). - For example: megan_specifier = 'ISOP = isoprene', 'C10H16 = pinene_a + carene_3 + thujene_a' - - - - MEGAN mapped isoprene emissions factors switch - If TRUE then use mapped MEGAN emissions factors for isoprene. - - - - List of possible MEGAN compounds to use - (the list used by the simulation is on the megan_factors_file as the Comp_Name) - - - - - - - - Where dry deposition is calculated (from land, atmosphere, or from a table) - This specifies the method used to calculate dry - deposition velocities of gas-phase chemical species. The available methods - are: - 'table' - prescribed method in CAM - 'xactive_atm' - interactive method in CAM - 'xactive_lnd' - interactive method in CLM - - - - List of species that undergo dry deposition. - - - - - - - - - File containing fire emissions factors. - Default: none - - - - Fire emissions specifier. - Default: none - - - - If ture fire emissions are input into atmosphere as elevated forcings. - Otherwise they are treated as surface emissions. - Default: TRUE - - - - - - - - List of fluxes needed by the CARMA model, from CLM to CAM. - - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml deleted file mode 100644 index ce2a23e26d..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE - - -1850 - -1850-2100 - -2.6 - -flanduse_timeseries - -.true. -.false. -.false. - -arb_ic - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2100 -1850 -extend - -1850 -2015 -1850 -extend - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml deleted file mode 100644 index 6bc4d67d1d..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - - -1850 - -1850-2100 - -4.5 - -flanduse_timeseries - -arb_ic - -.true. -.false. -.false. - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2100 -1850 -extend - -1850 -2015 -1850 -extend - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml deleted file mode 100644 index 73d5f5334f..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM - - -1850 - -1850-2100 - -6 - -.true. -.false. -.false. - -flanduse_timeseries - -arb_ic - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2100 -1850 -extend - -1850 -2015 -1850 -extend - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - diff --git a/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml b/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml deleted file mode 100644 index 4d854cad2c..0000000000 --- a/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - - -1850 - -1850-2100 - -8.5 - -.true. -.false. -.false. - -flanduse_timeseries - -arb_ic - -1850 -2100 -1850 - -1850 -2100 -1850 - -1850 -2100 -1850 -extend - -1850 -2015 -1850 -extend - -1850 -2010 -1850 - -1850 -2010 -1850 - -1850 -2100 -1850 - - diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml deleted file mode 100644 index 18c5959c78..0000000000 --- a/bld/namelist_files/use_cases/1850_control.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - -Conditions to simulate 1850 land-use - -1850 - -constant - -.false. -.false. - -1850 -1850 - -1850 -1850 - -1850 -1850 - -1850 -1850 - -1850 -1850 - -1850 -1850 - -1850 -1850 - - -lnd/clm2/ndepdata/fndep_clm_WACCM6_CMIP6piControl001_y21-50avg_1850monthly_0.95x1.25_c180802.nc - -cycle - -NDEP_month - - diff --git a/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml b/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml deleted file mode 100644 index e2bd97460c..0000000000 --- a/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE - -Simulate transient land-use, aerosol and Nitrogen deposition changes with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE - - -20050101 - -1850 - -2000-2100 - -8.5 - -.true. -.false. -.false. - -flanduse_timeseries - -arb_ic - -2000 -2100 -2000 - -2000 -2015 -2000 - -2000 -2100 -2000 -extend - -2000 -2015 -2000 -extend - -2000 -2010 -2000 - -2000 -2010 -2000 - -2000 -2100 -2000 - - diff --git a/bld/namelist_files/use_cases/2000_control.xml b/bld/namelist_files/use_cases/2000_control.xml deleted file mode 100644 index ca7c1ac5cd..0000000000 --- a/bld/namelist_files/use_cases/2000_control.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - -Conditions to simulate 2000 land-use - -2000 - -constant - -.true. -.false. -.false. - -2000 -2000 - -2000 -2000 - -2000 -2000 - -2000 -2000 - -2000 -2000 - -2000 -2000 - -2000 -2000 - - diff --git a/bld/namelist_files/use_cases/20thC_transient.xml b/bld/namelist_files/use_cases/20thC_transient.xml deleted file mode 100644 index e8970b59bf..0000000000 --- a/bld/namelist_files/use_cases/20thC_transient.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - -Simulate transient land-use, and aerosol deposition changes from 1850 to 2015 -Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to 2015 -Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to 2015 -Simulate transient land-use, aerosol deposition, and Nitrogen deposition changes from 1850 to 2015 - -1850 - -1850-2000 - -arb_ic - -flanduse_timeseries - -.true. -.false. -.false. - -1850 -2005 -1850 - -1850 -2005 -1850 - -1850 -2005 -1850 -extend - -1850 -2015 -1850 -extend - -1850 -2016 -1850 - -1850 -2016 -1850 - -1850 -2106 -1850 - - diff --git a/bld/namelist_files/use_cases/README b/bld/namelist_files/use_cases/README deleted file mode 100644 index 40b992332b..0000000000 --- a/bld/namelist_files/use_cases/README +++ /dev/null @@ -1,39 +0,0 @@ -$CTSMROOT/namelist_files/use_cases/README Jun/08/2018 - -Naming Convention for CLM use-cases - -It's important that this naming convention be followed so that the PTCLMmkdata.py -utility can parse the use-cases appropriately. The build-namelist script also -checks for conformance with these conventions and won't work for names that -don't follow the convention. - -Ending suffix requires one of these endings: _transient, _control or _pd - -Transient cases: - - yyyy-yyyy_$rcp$desc_transient (for example 1850-2100_rcp8.5_transient) - - or - - 20thC$desc_transient (means nominal 1850-2000 although some datasets are 1850-2005) - -Control cases: - - yyyy$desc_control - - -Present day options (uses default present-day simulation year -- which right now is 2000): - - $desc_pd - -Where - -yyyy = Simulation year (such as 1850 or 2000). -yyyy-yyyy = Range of simulation years to run over (i.e.. 1850-2000). -$rcp = Representative concentration pathway (rcp) description string - for future scenarios: - rcp#.# (for example: rcp8.5, rcp6, rcp4.5, rcp2.6) - [can be blank for historical cases]. -$desc = Description of anything else -- alpha-numeric. - Should start with an underscore ("_") if not by itself - (for _transient and _control). diff --git a/bld/namelist_files/use_cases/stdurbpt_pd.xml b/bld/namelist_files/use_cases/stdurbpt_pd.xml deleted file mode 100644 index 9114742e66..0000000000 --- a/bld/namelist_files/use_cases/stdurbpt_pd.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Standard Urban Point Namelist Settings - -.true. - -.true., .false., .true. - -'TBUILD','BUILDHEAT','TRAFFICFLUX','WASTEHEAT','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','COSZEN' - -'TG','TBOT','FIRE','FIRA','FLDS','FSDS','FSR','FSA','FGEV','FSH','FGR','TSOI','ERRSOI','BUILDHEAT','SABV','SABG','FSDSVD','FSDSND','FSDSVI','FSDSNI','FSRVD','FSRND','FSRVI','FSRNI','TSA','FCTR','FCEV','QBOT','Q2M','H2OSOI','H2OSNO','SOILLIQ','SOILICE','SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','SoilAlpha_U','ZWT','WA' - - -'SWup','LWup','Rnet','Qh','Qle','Qstor','Qtau','Qanth','Wind','Qair','Tair','PSurf','Rainf','SWdown','LWdown','FSA','FIRA','TG','COSZEN','SoilAlpha_U','TBUILD','BUILDHEAT' - - -'OFF' - -.true. -.false. -.false. - - diff --git a/bld/queryDefaultNamelist.pl b/bld/queryDefaultNamelist.pl deleted file mode 100755 index 8c555d1f6d..0000000000 --- a/bld/queryDefaultNamelist.pl +++ /dev/null @@ -1,319 +0,0 @@ -#!/usr/bin/env perl -#======================================================================= -# -# This is a script to read the CLM namelist XML file -# -# Usage: -# -# queryDefaultNamelist.pl [options] -# -# To get help on options and usage: -# -# queryDefaultNamelist.pl -help -# -#======================================================================= - -use Cwd; -use strict; -#use diagnostics; -use Getopt::Long; -use English; - -#----------------------------------------------------------------------------------------------- - -#Figure out where configure directory is and where can use the XML/Lite module from -my $ProgName; -($ProgName = $PROGRAM_NAME) =~ s!(.*)/!!; # name of program -my $ProgDir = $1; # name of directory where program lives - -my $cwd = getcwd(); # current working directory -my $cfgdir; - -if ($ProgDir) { $cfgdir = $ProgDir; } -else { $cfgdir = $cwd; } - -#----------------------------------------------------------------------------------------------- -# Add $cfgdir to the list of paths that Perl searches for modules -my @dirs = ( "$cfgdir", - "$cfgdir/../cime/utils/perl5lib", - "$cfgdir/../../../cime/utils/perl5lib" ); -unshift @INC, @dirs; -my $result = eval "require XML::Lite"; -if ( ! defined($result) ) { - die <<"EOF"; -** Cannot find perl module \"XML/Lite.pm\" from directories: @dirs ** -EOF -} -require Build::Config; -require Build::NamelistDefinition; -require queryDefaultXML; - -# Defaults -my $namelist = "clm_inparm"; -my $config = "config_cache.xml"; - - -sub usage { - die < $namelist, - model => "clm4_5", - var => undef, - hgrid => undef, - config => undef, - cesm => undef, - csmdata => undef, - demand => undef, - test => undef, - onlyfiles => undef, - fileonly => undef, - silent => undef, - usrname => undef, - help => undef, - options => undef, - ); - - my $cmdline = "@ARGV"; - GetOptions( - "f|file=s" => \$opts{'file'}, - "n|namelist=s" => \$opts{'namelist'}, - "v|var=s" => \$opts{'var'}, - "p|phys=s" => \$opts{'model'}, - "r|res=s" => \$opts{'hgrid'}, - "config=s" => \$opts{'config'}, - "cesm" => \$opts{'cesm'}, - "csmdata=s" => \$opts{'csmdata'}, - "demand" => \$opts{'demand'}, - "options=s" => \$opts{'options'}, - "t|test" => \$opts{'test'}, - "onlyfiles" => \$opts{'onlyfiles'}, - "filenameonly" => \$opts{'fileonly'}, - "justvalues" => \$opts{'justvalues'}, - "usrname=s" => \$opts{'usrname'}, - "s|silent" => \$opts{'silent'}, - "h|elp" => \$opts{'help'}, - ) or usage(); - - # Check for unparsed arguments - if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); - } - if ( $opts{'help'} ) { - usage(); - } - # Set if should do extra printing or not (if silent mode is not set) - my $printing = 1; - if ( defined($opts{'silent'}) ) { - $printing = 0; - } - # Get list of options from command-line into the settings hash - my %settings; - if ( defined($opts{'options'}) ) { - $opts{'options'} =~ s/\s//g; # Remove all white-space in options - my @optionlist = split( ",", $opts{'options'} ); - foreach my $item ( @optionlist ) { - my ($key,$value) = split( "=", $item ); - $settings{$key} = $value; - } - } - my $csmdata = ""; - if ( defined($opts{'fileonly'}) ) { - if ( ! defined($opts{'justvalues'}) ) { print "When -filenameonly option used, -justvalues is set as well\n" if $printing; } - if ( ! defined($opts{'onlyfiles'}) ) { print "When -filenameonly option used, -onlyfiles is set as well\n" if $printing; } - $opts{'justvalues'} = 1; - $opts{'onlyfiles'} = 1; - } - # List of input options - my %inputopts; - # This namelist files under the cime directories are in version 2 format and can't be read by perl code EBK 11/15/2016 - my $model = $opts{'model'}; - my @nl_definition_files = ("$cfgdir/namelist_files/namelist_definition_drv.xml", - "$cfgdir/namelist_files/namelist_definition_$model.xml" - ); - $inputopts{empty_cfg_file} = "$cfgdir/config_files/config_definition_$model.xml"; - $inputopts{nldef_files} = \@nl_definition_files; - $inputopts{namelist} = $opts{namelist}; - $inputopts{printing} = $printing; - $inputopts{cfgdir} = $cfgdir; - $inputopts{ProgName} = $ProgName; - $inputopts{cmdline} = $cmdline; - - my $exitearly = 0; - my $definition = Build::NamelistDefinition->new( $nl_definition_files[0] ); - foreach my $nl_defin_file ( @nl_definition_files ) { - if ( ! -f "$nl_defin_file" ) { - die "($ProgName $cmdline) ERROR:: bad namelist definition filename: $nl_defin_file.\n"; - } - $definition->add( "$nl_defin_file" ); - } - - if ( ! defined($opts{csmdata}) ) { - $inputopts{csmdata} = "default"; - } else { - $inputopts{csmdata} = $opts{csmdata}; - } - if ( defined($opts{cesm}) ) { - $inputopts{csmdata} = '$DIN_LOC_ROOT'; - } - if ( ! defined($opts{config}) ) { - $inputopts{config} = "noconfig"; - } else { - $inputopts{config} = $opts{config}; - } - if ( ! defined($opts{var}) ) { - $settings{'var'} = undef; - } elsif ( $opts{var} eq "list" ) { - print "Valid variables: " if $printing; - my @vars = $definition->get_var_names( ); - print "@vars\n"; - $exitearly = 1; - } else { - $settings{'var'} = $opts{'var'}; - } - if ( ! defined($opts{hgrid}) ) { - $inputopts{hgrid} = "any"; - } elsif ( $opts{hgrid} eq "list" ) { - print "Valid resolutions: " if $printing; - my @hgrids = $definition->get_valid_values( "res", 'noquotes'=>1 ); - print "@hgrids\n"; - $exitearly = 1; - } else { - if ( ! $definition->is_valid_value( "res", $opts{hgrid}, 'noquotes'=>1 ) ) { - if ( $opts{'hgrid'} ne $opts{'usrname'} ) { - die "($ProgName $cmdline) ERROR:: invalid resolution entered.\n"; - } - } - $inputopts{hgrid} = $opts{hgrid}; - } - # The namelist defaults file contains default values for all required namelist variables. - my @nl_defaults_files = ( "$cfgdir/namelist_files/namelist_defaults_overall.xml" ); - if ( defined($opts{'usrname'}) ) { - my $nl_defaults_file = "$cfgdir/namelist_files/namelist_defaults_usr_files.xml"; - push( @nl_defaults_files, $nl_defaults_file ); - $settings{'clm_usr_name'} = $opts{'usrname'}; - $settings{'notest'} = ! $opts{'test'}; - $settings{'csmdata'} = $inputopts{csmdata}; - } else { - my @files = ( "$cfgdir/namelist_files/namelist_defaults_${model}.xml", - "$cfgdir/namelist_files/namelist_defaults_${model}_tools.xml", - "$cfgdir/namelist_files/namelist_defaults_drv.xml", - "$cfgdir/namelist_files/namelist_defaults_drydep.xml", - ); - push( @nl_defaults_files, @files ); - } - if ( ! $exitearly ) { - $inputopts{files} = \@nl_defaults_files; - - my $defaults_ref = &queryDefaultXML::ReadDefaultXMLFile( \%inputopts, \%settings ); - my %defaults = %$defaults_ref; - my @keys = keys(%defaults); - if ( defined($opts{'demand'}) && ($#keys == -1) ) { - die "($ProgName $cmdline) ERROR:: demand option is set and nothing was found.\n"; - } - my $print; - foreach my $var ( @keys ) { - $print = 1; - my $value = $defaults{$var}{value}; - my $isadir = $defaults{$var}{isdir}; - my $isafile = $defaults{$var}{isfile}; - my $isastr = $defaults{$var}{isstr}; - # If onlyfiles option set do NOT print if is NOT a file - if ( defined($opts{'onlyfiles'}) && (! $isafile) ) { - $print = undef; - } - # If is a directory - if ( $isadir ) { - # Test that this directory exists - if ( defined($opts{'test'}) && defined($print) ) { - print "Test that directory $value exists\n" if $printing; - if ( ! -d "$value" ) { - die "($ProgName) ERROR:: directory $value does NOT exist!\n"; - } - } - } - # If is a file - if ( $isafile ) { - # Test that this file exists - if ( defined($opts{'test'}) && defined($print) ) { - chomp( $value ); - print "Test that file $value exists\n" if $printing; - if ( ! -f "$value" ) { - die "($ProgName) ERROR:: file $value does NOT exist!\n"; - } - } - } - # If a string - if ( (! defined($opts{'justvalues'}) ) && ($isastr) ) { - $value = "\'$value\'"; - } - # if you just want the filename -- not the full path with the directory - if ( defined($opts{'fileonly'}) ) { - $value =~ s!(.*)/!!; - } - if ( defined($print) ) { - if ( ! defined($opts{'justvalues'}) ) { - print "$var = "; - } - print "$value\n"; - } - } - } - if ( $printing && defined($opts{'test'}) ) { - print "\n\nTesting was successful\n\n" - } - diff --git a/bld/queryDefaultXML.pm b/bld/queryDefaultXML.pm deleted file mode 100644 index 85a81d8f9a..0000000000 --- a/bld/queryDefaultXML.pm +++ /dev/null @@ -1,161 +0,0 @@ -#======================================================================= -# -# This is a perl module to read in a list of namelist_default files. -# -#======================================================================= -use strict; -use Build::Config; -use Build::NamelistDefinition; -use Build::NamelistDefaults; -use Build::Namelist; - -package queryDefaultXML; - -#------------------------------------------------------------------------------- - -sub read_cfg_file -# -# Read in the configuration cache XML file on the build-time configuration -# -{ - my ($file, $empty_cfg_file, $printing, $settings_ref) = @_; - - my $cfg; - my %config; - if ( $file eq "noconfig" ) { - print "No configuration cache file to read in.\n" if $printing; - $cfg = Build::Config->new( $empty_cfg_file ); - } elsif ( -f "$file" ) { - $cfg = Build::Config->new($file); - } else { - die "Bad filename entered: $file does NOT exist or can not open it.\n"; - } - # - # Make sure variables are set to valid values - # - foreach my $key ( keys( %config ) ) { - if ( $cfg->is_valid_name( $key ) ) { - $cfg->set( $key, $config{$key} ); - } - } - foreach my $key ( $cfg->get_names( ) ) { - if ( defined($$settings_ref{$key}) ) { - if ( $cfg->is_valid_name( $key ) ) { - $cfg->set( $key, $$settings_ref{$key} ); - } - } - } - return( $cfg ); -} - -#------------------------------------------------------------------------------- - -sub ReadDefaultXMLFile { -# -# Read in the default XML file for the default namelist settings -# - my $opts_ref = shift; - my $settings_ref = shift; - - # Error check that input and opts hash has the expected variables - my $ProgName = $$opts_ref{'ProgName'}; - my $nm = "${ProgName}::ReadDefaultXMLFile"; - my @required_list = ( "files", "nldef_files", "empty_cfg_file", "config", "namelist", - "csmdata", "hgrid", "printing", "ProgName", "cmdline", - "cfgdir" ); - foreach my $var ( @required_list ) { - if ( ! defined($$opts_ref{$var}) ) { - die "ERROR($nm): Required input variable $var was not found\n"; - } - } - my $printing = $$opts_ref{'printing'}; - my $cmdline = $$opts_ref{'cmdline'}; - # Initialize some local variables - my $files_ref = $$opts_ref{'files'}; - my @files = @$files_ref; - my $nldef_ref = $$opts_ref{'nldef_files'}; - my @nl_definition_files= @$nldef_ref; - my $empty_config_file = $$opts_ref{'empty_cfg_file'}; - my $namelist = $$opts_ref{'namelist'}; - - my $cfg = read_cfg_file( $$opts_ref{'config'}, $$opts_ref{'empty_cfg_file'}, - $printing, $settings_ref ); - - # - # Set up options to send to namelist defaults object - # - my %nlopts; - foreach my $var ( keys( %$settings_ref) ) { - if ( $var ne "csmdata" ) { - $nlopts{$var} = $$settings_ref{$var}; - } - } - if ( $$opts_ref{'hgrid'} ne "any" ) { - $nlopts{'hgrid'} = $$opts_ref{'hgrid'}; - } - # - # Loop through all variables in files - # - print "($nm) Read: $files[0]\n" if $printing; - my %defaults; - my $nldefaults = Build::NamelistDefaults->new($files[0], $cfg); - for ( my $i = 1; $i <= $#files; $i++ ) { - print "($nm) Read: $files[$i]\n" if $printing; - $nldefaults->add( $files[$i] ); - } - my $definition = Build::NamelistDefinition->new( $nl_definition_files[0] ); - for ( my $i = 1; $i <= $#nl_definition_files; $i++ ) { - print "($nm) Read: $nl_definition_files[$i]\n" if $printing; - $definition->add( $nl_definition_files[$i] ); - } - if ( $$opts_ref{'csmdata'} eq "default" ) { - $$opts_ref{'csmdata'} = $nldefaults->get_value( "csmdata", \%nlopts ); - } - $nlopts{'csmdata'} = $$opts_ref{'csmdata'}; - foreach my $name ( $nldefaults->get_variable_names() ) { - my $value = $nldefaults->get_value( $name, \%nlopts ); - if ( $value eq "null" ) { next; } - if ( defined($$settings_ref{'var'}) ) { - if ( $name ne $$settings_ref{'var'} ) { next; } - } - $value =~ s/\n//g; - my $isafile = 0; - if ( $definition->is_input_pathname($name) ) { - - if ( defined($$settings_ref{'clm_usr_name'}) ) { - $value = $nldefaults->get_usr_file( $name, $definition, \%nlopts ); - } - if ( $value && ($value !~ /^\/.+$/) ) { - $value = $$opts_ref{'csmdata'} . "/" . $value; - } - $isafile = 1; - } - my $isadir = 0; - my $isastr = 0; - if ( $definition->get_str_len($name) > 0 ) { - $isastr = 1; - } - # - # If is a directory (is a file and csmdata or a var with dir in name) - # - if ( $isafile && (($name eq "csmdata") || ($name =~ /dir/)) ) { - if ( $name eq "csmdata" ) { - $value = $$opts_ref{'csmdata'}; - $isadir = 1; - } else { - $isadir = 1; - } - } - # Return hash with the results - my $group = $definition->get_group_name( $name ); - if ( $group eq $namelist && $value && (! exists($defaults{$name}{'value'})) ) { - $defaults{$name}{'value'} = $value; - $defaults{$name}{'isfile'} = $isafile; - $defaults{$name}{'isdir'} = $isadir; - $defaults{$name}{'isstr'} = $isastr; - } - } - return( \%defaults ); -} - -1 # To make use or require happy diff --git a/bld/unit_testers/NMLTest/CompFiles.pm b/bld/unit_testers/NMLTest/CompFiles.pm deleted file mode 100644 index c29d1b24a9..0000000000 --- a/bld/unit_testers/NMLTest/CompFiles.pm +++ /dev/null @@ -1,218 +0,0 @@ -############################################################################### -# -# Module: NMLTest::CompFiles -# -# Created by Erik Kluzek NCAR -# -# This is a tester built on top of Test::More to compare namelist files -# (or really any ASCII text files). There is a mechanism for telling the -# test object that you should (or should NOT) expect the comparison to be -# exact or not. -# -############################################################################### - -package NMLTest::CompFiles; -use strict; -use Test::More; -use IO::File; - -=head1 NAME - -NMLTest::CompFiles - A comparision tester for namelist (or ASCII text) files - -=head1 SYNOPSIS - -=head1 DESCRIPTION - -=cut - -sub new { - my $self = {}; - my $class = shift; - my $dir = shift; - my @files = @_; - - my $nm = ref($self)."\:\:new"; - - my %diffref = { }; - $self->{'diffref'} = \%diffref; - if ( ! -d "$dir" ) { - die "ERROR::($nm) Input directory ($dir) does NOT exist!\n"; - } - $self->{'dir'} = $dir; - $self->{'files'} = \@_; - bless( $self, $class ); -} - -sub checkfilesexist { -# -# Check that files exist -# - my $self = shift; - my $type = shift; - my $mode = shift; - my $nm = ref($self)."\:\:checkfilesexist"; - - my $filesref = $self->{'files'}; - my $confdir = $self->{'dir'}; - foreach my $file ( @$filesref ) { - my $exists = ( -f "$confdir/$file" ); - ok( $exists, "$type $mode: $file file exists" ); - if ( $exists ) { - $self->dodiffonfile( $file, $type, $mode ); - } else { - $self->doNOTdodiffonfile( $file, $type, $mode ); - } - } -} - -sub comparefiles { -# -# Compare the resultant files to the default versions -# - my $self = shift; - my $type = shift; - my $comp_mode = shift; - my $compdir = shift; - my $nm = ref($self)."\:\:comparefiles"; - - $type =~ s#[ '"&/]#+#g; - $comp_mode =~ s#[ '"&/]#+#g; - my $confdir = $self->{'dir'}; - my $diffref = $self->{'diffref'}; - if ( ! defined($type) ) { - $type = "default"; - } - my $compare = "compare to previous tag"; - if ( ! defined($compdir) ) { - $compdir = "."; - $compare = undef; - } - if ( ! -d "$compdir" ) { - die "ERROR($nm):: Compare directory $compdir does NOT exist!\n"; - } - print "Compare files for $type type MODE=$comp_mode $compare\n"; - my $diffstat; - my %diffhas = %$diffref; - my $same = "file the same as expected"; - my $diff = "file different as expected"; - my $filesref = $self->{'files'}; - foreach my $file ( @$filesref ) { - if ( ! -f "$compdir/${file}.$comp_mode.${type}" ) { - print "WARNING($nm):: File $compdir/${file}.$comp_mode.${type} does NOT exist!\n"; - fail( "compare file $file DNE for $comp_mode and $type" ); - } else { - if ( ! exists($diffhas{$comp_mode}{$type}{$file}) ) { - die "ERROR($nm):: difference is NOT setup for $comp_mode ${type} $file!\n"; - } - system( "diff $confdir/${file} $compdir/${file}.$comp_mode.${type} > /dev/null" ); - $diffstat = $?; - if ( $diffhas{$comp_mode}{$type}{$file} ) { - ok( ! $diffstat, "$file $same for $comp_mode" ); - } else { - ok( $diffstat, "$file different as expected for $comp_mode" ); - } - } - } - -} - -sub copyfiles { -# -# Copy the namelist files to default names for comparisions -# - my $self = shift; - my $type = shift; - my $mode = shift; - my $nm = ref($self)."\:\:copyfiles"; - - $type =~ s#[ '"&/]#+#g; - $mode =~ s#[ '"&/]#+#g; - my $diffref = $self->{'diffref'}; - my $filesref = $self->{'files'}; - my $confdir = $self->{'dir'}; - foreach my $file ( @$filesref ) { - system( "/bin/cp $confdir/$file ${file}.${mode}.${type}" ); - $$diffref{${mode}}{${type}}{$file} = 1; - } - print "$type namelists for $mode\n"; - foreach my $file ( @$filesref ) { - system( "/bin/cat $file.${mode}.${type}" ); - } -} - - -sub shownmldiff { -# -# Show the differences in the namelists -# - my $self = shift; - my $type = shift; - my $comp_mode = shift; - my $nm = ref($self)."\:\:shownmldiff"; - - $type =~ s#[ '"&/]#+#g; - $comp_mode =~ s#[ '"&/]#+#g; - my $filesref = $self->{'files'}; - my $confdir = $self->{'dir'}; - foreach my $file ( @$filesref ) { - my $file1 = "$confdir/$file"; - if ( ! -f "$file1" ) { - print "$file1 does NOT exist\n"; - return; - } - my $file2 = "${file}.${comp_mode}.${type}"; - if ( ! -f "$file2" ) { - print "$file2 does NOT exist\n"; - return; - } - print "Diff in in $file to $type $comp_mode version"; - system( "diff $file1 $file2" ); - } - -} - - - -sub dodiffonfile { -# -# Set it so that it does do a difference on the given input file -# - my $self = shift; - my $file = shift; - my $type = shift; - my $mode = shift; - my $nm = ref($self)."\:\:dodiffonfile"; - - $type =~ s#[ '"&/]#+#g; - $mode =~ s#[ '"&/]#+#g; - my $diffref = $self->{'diffref'}; - if ( ! defined($type) ) { - $type = "default"; - } - $$diffref{$mode}{$type}{$file} = 1; -} - - -sub doNOTdodiffonfile { -# -# Set it so that it does NOT do a difference on the given input file -# - my $self = shift; - my $file = shift; - my $type = shift; - my $mode = shift; - my $nm = ref($self)."\:\:doNOTdodiffonfile"; - - $type =~ s#[ '"&/]#+#g; - $mode =~ s#[ '"&/]#+#g; - my $diffref = $self->{'diffref'}; - if ( ! defined($type) ) { - $type = "default"; - } - $$diffref{$mode}{$type}{$file} = 0; -} - -#----------------------------------------------------------------------------------------------- - -1 # to make use or require happy diff --git a/bld/unit_testers/build-namelist_test.pl b/bld/unit_testers/build-namelist_test.pl deleted file mode 100755 index 6358a9a6f4..0000000000 --- a/bld/unit_testers/build-namelist_test.pl +++ /dev/null @@ -1,1420 +0,0 @@ -#!/usr/bin/env perl - -# Test command line options of the build-namelist script. -# Try to test that all the different options at least work. -# Test that inconsistentcies are appropriately caught. - -######################### - -use Test::More; -use xFail::expectedFail; -use IO::File; - -######################### - -use strict; -use Getopt::Long; -use NMLTest::CompFiles; -use English; - -sub usage { - die < Compare namelists for this version to namelists - created by another version. - -generate Leave the namelists in place to do a later compare. - -test Use the -test option to make sure datasets exist. - -csmdata "dir" Root directory of CESM input data. - -EOF -} - -sub make_env_run { -# -# Create a env_run.xml file to read in -# - my %settings = @_; - - # Set default settings - my %env_vars = ( DIN_LOC_ROOT=>"MYDINLOCROOT", GLC_TWO_WAY_COUPLING=>"FALSE" ); - # Set any settings that came in from function call - foreach my $item ( keys(%settings) ) { - $env_vars{$item} = $settings{$item}; - } - - # Now write the file out - my $envfile = "env_run.xml"; - my $fh = IO::File->new($envfile, '>') or die "can't open file: $envfile"; - print $fh < - - - -EOF - foreach my $item ( keys(%env_vars) ) { - print $fh < -EOF - } - print $fh < -EOF - $fh->close(); -} - - -# -# Process command-line options. -# -my %opts = ( help => 0, - generate => 0, - test => 0, - compare => undef, - csmdata => undef, - ); - -GetOptions( - "h|help" => \$opts{'help'}, - "compare=s" => \$opts{'compare'}, - "generate" => \$opts{'generate'}, - "test" => \$opts{'test'}, - "csmdata=s" => \$opts{'csmdata'}, -) or usage(); - -# Give usage message. -usage() if $opts{'help'}; - -# Check that the CESM inputdata root directory has been specified. This must be -# a local or nfs mounted directory. -my $inputdata_rootdir = undef; -if (defined($opts{'csmdata'})) { - $inputdata_rootdir = $opts{'csmdata'}; -} elsif (defined $ENV{'CSMDATA'} ) { - $inputdata_rootdir = $ENV{'CSMDATA'}; -} else { - # use yellowstone location as default - $inputdata_rootdir="/glade/p/cesm/cseg/inputdata"; - print("WARNING: -csmdata nor CSMDATA are set, using default yellowstone location: $inputdata_rootdir\n"); -} - -################################### -#_# read in expected fail test list -################################### -my $compGen; -if ( $opts{'generate'} eq 1 && !(defined($opts{'compare'}) )) { - $compGen='generate'; -} elsif ( defined($opts{'compare'}) ) { - $compGen='compare'; -} elsif ( defined($opts{'compare'} && ($opts{'generate'} eq 1 ))) { - #_# if compare and generate are both given, use compare - $compGen='compare'; -} - -my $ProgName; -($ProgName = $PROGRAM_NAME) =~ s!(.*)/!!; -my $testType="namelistTest"; - -# -# Figure out number of tests that will run -# -my $ntests = 939; -if ( defined($opts{'compare'}) ) { - $ntests += 597; -} -plan( tests=>$ntests ); - -#_# ============================================================ -#_# setup for xFail module -#_# ============================================================ -my $xFail = xFail::expectedFail->new($ProgName,$compGen,$ntests); -my $captOut=""; #_# variable to capture Test::More output -Test::More->builder->output(\$captOut); -#_# ============================================================ -#_# -#_# ============================================================ - -# Check for unparsed arguments -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} -my $mode = "-phys clm5_0"; -system( "../configure -s $mode" ); - -my $DOMFILE = "$inputdata_rootdir/atm/datm7/domain.lnd.T31_gx3v7.090928.nc"; -my $real_par_file = "user_nl_clm_real_parameters"; -my $bldnml = "../build-namelist -verbose -csmdata $inputdata_rootdir -lnd_frac $DOMFILE -glc_nec 10 -no-note -output_reals $real_par_file"; -if ( $opts{'test'} ) { - $bldnml .= " -test"; -} - -my $tempfile = "temp_file.txt"; -if ( -f $tempfile ) { - system( "/bin/rm $tempfile" ); -} - -my @files = ( "lnd_in", $tempfile, $real_par_file ); -my $cwd = `pwd`; -chomp( $cwd ); -my $cfiles = NMLTest::CompFiles->new( $cwd, @files ); - -print "\n==================================================\n"; -print "Run simple tests \n"; -print "==================================================\n"; - -# Simple test -- just run build-namelist with -help option -eval{ system( "$bldnml -help > $tempfile 2>&1 " ); }; - is( $@, '', "help" ); - &cleanup(); -# Simple test -- just run build-namelist with -version option -eval{ system( "$bldnml -version > $tempfile 2>&1 " ); }; - is( $@, '', "version" ); - system( "/bin/cat $tempfile" ); - &cleanup(); -# Simple test -- just run build-namelist -&make_env_run(); -eval{ system( "$bldnml > $tempfile 2>&1 " ); }; - is( $@, '', "plain build-namelist" ); - $cfiles->checkfilesexist( "default", $mode ); - # Compare to baseline - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "default", $mode ); - $cfiles->comparefiles( "default", $mode, $opts{'compare'} ); - } - -print "\n==================================================\n"; -print "Run simple tests with all list options \n"; -print "==================================================\n"; - -$cfiles->copyfiles( "default", $mode ); -&cleanup(); -# Simple test -- run all the list options -foreach my $options ( "clm_demand", "rcp", "res", - "sim_year", "use_case" ) { - &make_env_run(); - eval{ system( "$bldnml -${options} list > $tempfile 2>&1 " ); }; - my $result = `cat $tempfile`; - my $expect; - if ( $options =~ /use_case/ ) { - $expect = "use cases :"; - } else { - $expect = "valid values for $options"; - } - $expect = "/CLM build-namelist : $expect/"; - like( $result, $expect, "$options list" ); - is( (-f "lnd_in"), undef, "Check that lnd_in file does NOT exist" ); - &cleanup(); -} - -print "\n==================================================\n"; -print "Run simple tests with additional options \n"; -print "==================================================\n"; - -# Exercise a bunch of options -my $options = "-co2_ppmv 250 "; - $options .= " -res 0.9x1.25 -rcp 2.6 -envxml_dir ."; - - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $cfiles->checkfilesexist( "default", $mode ); - $cfiles->copyfiles( "most_options", $mode ); - # Compare to default - $cfiles->doNOTdodiffonfile( "lnd_in", "default", $mode ); - $cfiles->doNOTdodiffonfile( "$real_par_file", "default", $mode ); - $cfiles->doNOTdodiffonfile( "$tempfile", "default", $mode ); - $cfiles->comparefiles( "default", $mode ); - # Compare to baseline - if ( defined($opts{'compare'}) ) { - $cfiles->dodiffonfile( "lnd_in", "most_options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "most_options", $mode ); - $cfiles->doNOTdodiffonfile( "$tempfile", "most_options", $mode ); - $cfiles->comparefiles( "most_options", $mode, $opts{'compare'} ); - } - &cleanup(); - -print "\n==================================================\n"; -print "Test drydep, fire_emis and megan namelists \n"; -print "==================================================\n"; - -# drydep and megan namelists -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); -my @mfiles = ( "lnd_in", "drv_flds_in", $tempfile ); -my $mfiles = NMLTest::CompFiles->new( $cwd, @mfiles ); -foreach my $options ( "-drydep", "-megan", "-drydep -megan", "-fire_emis", "-drydep -megan -fire_emis" ) { - &make_env_run(); - eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $mfiles->checkfilesexist( "$options", $mode); - if ( $options ne "-drydep" ) { - $mfiles->shownmldiff( "-drydep", $mode ); - } - if ( defined($opts{'compare'}) ) { - $mfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $mfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $mfiles->copyfiles( "$options", $mode ); - } - &cleanup(); -} -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); - -print "\n===============================================================================\n"; -print "Test irrig, verbose, clm_demand, rcp, test, sim_year, use_case, l_ncpl\n"; -print "=================================================================================\n"; - -# irrig, verbose, clm_demand, rcp, test, sim_year, use_case, l_ncpl -my $startfile = "clmrun.clm2.r.1964-05-27-00000.nc"; -foreach my $options ( "-namelist '&a irrigate=.true./'", "-verbose", "-rcp 2.6", "-test", "-sim_year 1850", - "-use_case 1850_control", "-l_ncpl 1", - "-clm_start_type startup", "-namelist '&a irrigate=.false./' -crop -bgc bgc", - "-envxml_dir . -infile myuser_nl_clm", - "-ignore_ic_date -clm_start_type branch -namelist '&a nrevsn=\"thing.nc\"/' -bgc bgc -crop", - "-ignore_ic_date -clm_start_type startup -namelist '&a finidat=\"thing.nc\"/' -bgc bgc -crop", - ) { - my $file = $startfile; - &make_env_run(); - eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", $mode ); - my $finidat = `grep finidat lnd_in`; - if ( $options eq "-l_ncpl 1" ) { - my $dtime = `grep dtime lnd_in`; - like( $dtime, "/ 86400\$/", "$options" ); - } elsif ( $options =~ /myuser_nl_clm/ ) { - my $fsurdat = `grep fsurdat lnd_in`; - like( $fsurdat, "/MYDINLOCROOT/lnd/clm2/PTCLMmydatafiles/1x1pt_US-UMB/surfdata_1x1pt_US-UMB_simyr2000_clm4_5_c131122.nc/", "$options" ); - } - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); -} -print "\n==============================================================\n"; -print "Test several use_cases and specific configurations for clm5_0\n"; -print "==============================================================\n"; -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); -foreach my $options ( - "-bgc bgc -use_case 1850-2100_rcp2.6_transient -namelist '&a start_ymd=20100101/'", - "-bgc sp -use_case 1850-2100_rcp4.5_transient -namelist '&a start_ymd=18501223/'", - "-bgc bgc -use_case 1850-2100_rcp6_transient -namelist '&a start_ymd=20701029/'", - "-bgc fates -use_case 2000_control -no-megan", - "-bgc cn -use_case 1850-2100_rcp8.5_transient -namelist '&a start_ymd=19201023/'", - "-bgc bgc -use_case 2000_control -namelist \"&a fire_method='nofire'/\" -crop", - ) { - my $file = $startfile; - &make_env_run(); - eval{ system( "$bldnml -envxml_dir . $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", $mode ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "lnd_in", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); -} - - - -print "\n==================================================\n"; -print "Start Failure testing. These should fail \n"; -print "==================================================\n"; - -# Failure testing, do things that SHOULD fail -my $finidat = "thing.nc"; -system( "touch $finidat" ); - -my %failtest = ( - "coldstart but with IC file"=>{ options=>"-clm_start_type cold -envxml_dir .", - namelst=>"finidat='$finidat'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "clm_demand on finidat" =>{ options=>"-clm_demand finidat -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "blank IC file, not cold" =>{ options=>"-clm_start_type startup -envxml_dir .", - namelst=>"finidat=' '", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "startup without interp" =>{ options=>"-clm_start_type startup -envxml_dir . -bgc sp -sim_year 1850", - namelst=>"use_init_interp=.false., start_ymd=19200901", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "l_ncpl is zero" =>{ options=>"-l_ncpl 0 -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "l_ncpl not integer" =>{ options=>"-l_ncpl 1.0 -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "both l_ncpl and dtime" =>{ options=>"-l_ncpl 24 -envxml_dir .", - namelst=>"dtime=1800", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "use_crop without -crop" =>{ options=>" -envxml_dir .", - namelst=>"use_crop=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "CNDV with flanduse_timeseries" =>{ options=>" -envxml_dir .", - namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-bgc cndv", - }, - "clm50CNDVwtransient" =>{ options=>" -envxml_dir . -use_case 20thC_transient -dynamic_vegetation -res 10x15", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "CNDV with flanduse_timeseries - clm4_5"=>{ options=>"-bgc bgc -dynamic_vegetation -envxml_dir .", - namelst=>"flanduse_timeseries='my_flanduse_timeseries_file.nc'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "use_cndv=T without bldnml op"=>{ options=>"-bgc cn -envxml_dir .", - namelst=>"use_cndv=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "use_cndv=F with dyn_veg op"=>{ options=>"-bgc cn -dynamic_vegetation -envxml_dir .", - namelst=>"use_cndv=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "crop with use_crop false" =>{ options=>"-crop -bgc bgc -envxml_dir .", - namelst=>"use_crop=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "crop without CN" =>{ options=>"-crop -bgc sp -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "baset_map without crop" =>{ options=>"-bgc bgc -envxml_dir .", - namelst=>"baset_mapping='constant'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "mapvary var w/o varymap" =>{ options=>"-crop -bgc bgc -envxml_dir .", - namelst=>"baset_mapping='constant', baset_latvary_slope=1.0, baset_latvary_intercept=10.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "-irrig with clm5_0" =>{ options=>"-bgc bgc -crop -irrig .true. -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "-irrig with -crop" =>{ options=>"-irrig .true. -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0 -bgc cn -crop on", - }, - "-irrigate=T without -crop" =>{ options=>"-bgc cn -irrig .true. -envxml_dir .", - namelst=>"irrigate=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "interp without finidat" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"use_init_interp=.true. finidat=' '", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "sp and c13" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"use_c13=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "sp and c14" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"use_c14=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "bombspike no c14" =>{ options=>"-bgc bgc -envxml_dir .", - namelst=>"use_c14=.false. use_c14_bombspike=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "use c13 timeseries no cn" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"use_c13_timeseries=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "use c13 timeseries no c13"=>{ options=>"-bgc bgc -envxml_dir .", - namelst=>"use_c13=.false. use_c13_timeseries=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "bombspike no cn" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"use_c14_bombspike=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lightres no cn" =>{ options=>"-bgc sp -envxml_dir . -light_res 360x720", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "spno-fire" =>{ options=>"-bgc sp -envxml_dir . -use_case 2000_control", - namelst=>"fire_method='nofire'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lightres no fire" =>{ options=>"-bgc cn -envxml_dir . -light_res 360x720", - namelst=>"fire_method='nofire'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lightres none bgc" =>{ options=>"-bgc bgc -envxml_dir . -light_res none", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lightresnotnone-nofire" =>{ options=>"-bgc bgc -envxml_dir . -light_res 94x192", - namelst=>"fire_method='nofire'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lightresnonenofirelightfil"=>{ options=>"-bgc bgc -envxml_dir . -light_res none", - namelst=>"fire_method='nofire',stream_fldfilename_lightng='build-namelist_test.pl'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lightrescontradictlightfil"=>{ options=>"-bgc bgc -envxml_dir . -light_res 360x720", - namelst=>"stream_fldfilename_lightng='build-namelist_test.pl'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bgc=cn and bgc settings" =>{ options=>"-bgc cn -envxml_dir .", - namelst=>"use_lch4=.true.,use_nitrif_denitrif=.true.,use_vertsoilc=.true.,use_century_decomp=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "finundated and not methane"=>{ options=>"-bgc cn -envxml_dir .", - namelst=>"use_lch4=.false.,finundation_method='h2osfc'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bgc=bgc and cn-only set" =>{ options=>"-bgc bgc -envxml_dir .", - namelst=>"use_lch4=.false.,use_nitrif_denitrif=.false.,use_vertsoilc=.false.,use_century_decomp=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "use_cn=true bgc=sp" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"use_cn=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "use_cn=false bgc=cn" =>{ options=>"-bgc cn -envxml_dir .", - namelst=>"use_cn=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "lower=aqu-45 with/o Zeng" =>{ options=>"-envxml_dir .", - namelst=>"lower_boundary_condition=4,soilwater_movement_method=1,use_bedrock=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "Zeng w lower=flux" =>{ options=>"-envxml_dir .", - namelst=>"lower_boundary_condition=1,soilwater_movement_method=0,use_bedrock=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "Zeng w lower=zeroflux" =>{ options=>"-envxml_dir .", - namelst=>"lower_boundary_condition=2,soilwater_movement_method=0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "Zeng w lower=table" =>{ options=>"-envxml_dir .", - namelst=>"lower_boundary_condition=3,soilwater_movement_method=0,use_bedrock=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "vichydro without clm4_5" =>{ options=>"-vichydro -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "use_vic=F with -vic op" =>{ options=>"-vichydro -envxml_dir .", - namelst=>"use_vichydro=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "-vic with l_bnd=flux" =>{ options=>"-vichydro -envxml_dir .", - namelst=>"lower_boundary_condition=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "-vic with l_bnd=zeroflux" =>{ options=>"-vichydro -envxml_dir .", - namelst=>"lower_boundary_condition=2", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "-vic with origflag=1" =>{ options=>"-vichydro -envxml_dir .", - namelst=>"origflag=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "l_bnd=flux with origflag=0"=>{ options=>"-envxml_dir .", - namelst=>"origflag=0, lower_boundary_condition=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "l_bnd=zflux with origflag=0"=>{ options=>"-envxml_dir .", - namelst=>"origflag=0, lower_boundary_condition=2", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "bedrock with l_bnc=flux" =>{ options=>"-envxml_dir .", - namelst=>"use_bedrock=.true., lower_boundary_condition=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bedrock with l_bnc=tabl" =>{ options=>"-envxml_dir .", - namelst=>"use_bedrock=.true., lower_boundary_condition=3", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bedrock with l_bnc=aqui" =>{ options=>"-envxml_dir .", - namelst=>"use_bedrock=.true., lower_boundary_condition=4", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "zengdeck with l_bnc=flux" =>{ options=>"-envxml_dir .", - namelst=>"soilwater_movement_method=0, lower_boundary_condition=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "zengdeck with l_bnc=z-flux"=>{ options=>"-envxml_dir .", - namelst=>"soilwater_movement_method=0, lower_boundary_condition=2", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "zengdeck with l_bnc=tabl" =>{ options=>"-envxml_dir .", - namelst=>"soilwater_movement_method=0, lower_boundary_condition=3", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "l_bnd=tabl with h2osfcfl=0"=>{ options=>"-envxml_dir .", - namelst=>"h2osfcflag=0, lower_boundary_condition=3", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "l_bnd=flux with h2osfcfl=0"=>{ options=>"-envxml_dir .", - namelst=>"h2osfcflag=0, lower_boundary_condition=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "l_bnd=zflux with h2osfcfl=0"=>{ options=>"-envxml_dir .", - namelst=>"h2osfcflag=0, lower_boundary_condition=2", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "h2osfcfl=0 with clm5.0" =>{ options=>"-envxml_dir .", - namelst=>"h2osfcflag=0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "origflag=0 with clm5.0" =>{ options=>"-envxml_dir .", - namelst=>"origflag=0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "oldfflag=0 with clm5.0" =>{ options=>"-envxml_dir .", - namelst=>"oldfflag=0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bgc without clm4_5" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "spinup_state without clm4_5" =>{ options=>"-clm_accelerated_spinup on -envxml_dir .", - namelst=>"spinup_state=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "40bad lnd_tuning_mode value" =>{ options=>"-lnd_tuning_mode clm4_5_CRUNCEP -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "45bad lnd_tuning_mode value" =>{ options=>"-lnd_tuning_mode clm5_0_GSWP3 -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "50bad lnd_tuning_mode value" =>{ options=>"-lnd_tuning_mode clm4_5_CRUNCEP -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "DV without clm4_5" =>{ options=>"-dynamic_vegetation -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "bgc_spinup without cn" =>{ options=>"-clm_accelerated_spinup on -bgc sp -envxml_dir .", - namelst=>"spinup_state=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "spinup=1 without bldnml op"=>{ options=>"-clm_accelerated_spinup off -bgc bgc -envxml_dir .", - namelst=>"spinup_state=1",, - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "DV without clm4_5" =>{ options=>"-dynamic_vegetation -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "bgc_spinup without cn" =>{ options=>"-clm_accelerated_spinup on -bgc sp -envxml_dir .", - namelst=>"spinup_state=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "baseflow w aquifer" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"baseflow_scalar=1.0, lower_boundary_condition=4,use_bedrock=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "baseflow w table" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"baseflow_scalar=1.0, lower_boundary_condition=3,use_bedrock=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "br_root and bgc=sp" =>{ options=>"-bgc sp -envxml_dir .", - namelst=>"br_root=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "both co2_type and on nml" =>{ options=>"-co2_type constant -envxml_dir .", - namelst=>"co2_type='prognostic'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "both lnd_frac and on nml" =>{ options=>"-lnd_frac domain.nc -envxml_dir .", - namelst=>"fatmlndfrc='frac.nc'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "branch but NO nrevsn" =>{ options=>"-clm_start_type branch -envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "glc_nec inconsistent" =>{ options=>"-envxml_dir .", - namelst=>"maxpatch_glcmec=5", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "NoGLCMec" =>{ options=>"-envxml_dir . -glc_nec 0", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "UpdateGlcContradict" =>{ options=>"-envxml_dir .", - namelst=>"glc_do_dynglacier=.false.", - GLC_TWO_WAY_COUPLING=>"TRUE", - conopts=>"-phys clm4_5", - }, - "clm40andUpdateGlc" =>{ options=>"-envxml_dir .", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"TRUE", - conopts=>"-phys clm4_0", - }, - "useFATESContradict" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"use_fates=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "useFATESContradict2" =>{ options=>"-envxml_dir . -no-megan", - namelst=>"use_fates=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "useFATESWCN" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"use_cn=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "useFATESWcreatecrop" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"create_crop_landunit=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "useFATESWTransient" =>{ options=>"-bgc fates -use_case 20thC_transient -envxml_dir . -no-megan -res 10x15", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "useFATESclm40" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "usespitfireButNOTFATES" =>{ options=>"-envxml_dir . -no-megan", - namelst=>"use_fates_spitfire=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "useloggingButNOTFATES" =>{ options=>"-envxml_dir . -no-megan", - namelst=>"use_fates_logging=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "useinventorybutnotfile" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"use_fates_inventory_init=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "inventoryfileDNE" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"use_fates_inventory_init=.true., fates_inventory_ctrl_filename='zztop'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "useMEGANwithFATES" =>{ options=>"-bgc fates -envxml_dir . -megan", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - "useHYDSTwithFATES" =>{ options=>"-bgc fates -envxml_dir . -no-megan", - namelst=>"use_hydrstress=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "useHYDSTwithdynroot" =>{ options=>"-bgc bgc -envxml_dir . -megan", - namelst=>"use_hydrstress=.true., use_dynroot=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "fireemiswith40" =>{ options=>"-envxml_dir . -fire_emis", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_0", - }, - "specWOfireemis" =>{ options=>"-envxml_dir . -no-fire_emis", - namelst=>"fire_emis_specifier='bc_a1 = BC'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "elevWOfireemis" =>{ options=>"-envxml_dir . -no-fire_emis", - namelst=>"fire_emis_elevated=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lmr1WOcn" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"leafresp_method=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lmr2WOcn" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"leafresp_method=2", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lmr0Wcn" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"leafresp_method=0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "nofireButSetcli_scale" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"fire_method='nofire', cli_scale=5.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "nocnButSetrh_low" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"rh_low=5.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "funWOcn" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"use_fun=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "flexCNWOcn" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"use_flexibleCN=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "flexCNFUNwcarbonresp" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_flexibleCN=.true.,use_FUN=.true.,carbon_resp_opt=1", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "funWOnitrif" =>{ options=>"-envxml_dir .", - namelst=>"use_fun=.true., use_nitrif_denitrif=.false.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "knitrmaxWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., k_nitr_max=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "respcoefWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., denitrif_respiration_coefficient=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "respexpWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., denitrif_respiration_exponent=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "nitrcoefWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., denitrif_nitrateconc_coefficient=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "nitrexpWOnitrif" =>{ options=>"-envxml_dir . -bgc bgc", - namelst=>"use_nitrif_denitrif=.false., denitrif_nitrateconc_exponent=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "lunaWSPandlnctrue" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"use_luna=.true., lnc_opt=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "NOlunabutsetJmaxb1" =>{ options=>"-envxml_dir . -bgc sp", - namelst=>"use_luna=.false., jmaxb1=1.0", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "envxml_not_dir" =>{ options=>"-envxml_dir myuser_nl_clm", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - "envxml_emptydir" =>{ options=>"-envxml_dir xFail", - namelst=>"", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"", - }, - ); -foreach my $key ( keys(%failtest) ) { - print( "$key\n" ); - system( "../configure -s ".$failtest{$key}{"conopts"}); - my $options = $failtest{$key}{"options"}; - my $namelist = $failtest{$key}{"namelst"}; - &make_env_run( GLC_TWO_WAY_COUPLING=>$failtest{$key}{"GLC_TWO_WAY_COUPLING"} ); - eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); }; - isnt( $?, 0, $key ); - system( "cat $tempfile" ); -} - - -print "\n===============================================================================\n"; -print "Start Warning testing. These should fail unless -ignore_warnings option is used \n"; -print "=================================================================================\n"; - -# Warning testing, do things that give warnings, unless -ignore_warnings option is used - -my %warntest = ( - # Warnings without the -ignore_warnings option given - "coldwfinidat" =>{ options=>"-envxml_dir . -clm_start_type cold", - namelst=>"finidat = 'testfile.nc'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bgcspin_w_suplnitro" =>{ options=>"-envxml_dir . -bgc bgc -clm_accelerated_spinup on", - namelst=>"suplnitro='ALL'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "use_c13_wo_bgc" =>{ options=>"-envxml_dir . -bgc cn", - namelst=>"use_c13=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "use_c14_wo_bgc" =>{ options=>"-envxml_dir . -bgc cndv", - namelst=>"use_c14=.true.", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "maxpft_wrong" =>{ options=>"-envxml_dir . -bgc cndv", - namelst=>"maxpatch_pft=19", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm5_0", - }, - "bad_megan_spec" =>{ options=>"-envxml_dir . -bgc bgc -megan", - namelst=>"megan_specifier='ZZTOP=zztop'", - GLC_TWO_WAY_COUPLING=>"FALSE", - conopts=>"-phys clm4_5", - }, - ); -foreach my $key ( keys(%warntest) ) { - print( "$key\n" ); - system( "../configure -s ".$warntest{$key}{"conopts"}); - my $options = $warntest{$key}{"options"}; - my $namelist = $warntest{$key}{"namelst"}; - &make_env_run( GLC_TWO_WAY_COUPLING=>$warntest{$key}{"GLC_TWO_WAY_COUPLING"} ); - eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); }; - isnt( $?, 0, $key ); - system( "cat $tempfile" ); - # Now run with -ignore_warnings and make sure it works - $options .= " -ignore_warnings"; - eval{ system( "$bldnml $options -namelist \"&clmexp $namelist /\" > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - system( "cat $tempfile" ); -} - - -print "\n==================================================\n"; -print "Test ALL resolutions with CLM5.0 and SP \n"; -print "==================================================\n"; - -# Check for ALL resolutions with CLM50SP -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); -my $reslist = `../queryDefaultNamelist.pl -res list -s`; -my @resolutions = split( / /, $reslist ); -my @regional; -foreach my $res ( @resolutions ) { - chomp($res); - print "=== Test $res === \n"; - my $options = "-res $res -bgc sp -envxml_dir ."; - - # Regional single point resolutions - if ( $res =~ /^([0-9]+x[0-9]+_[a-zA-Z]+)$/ ) { - push( @regional, $res ); - next; - # Resolutions for mksurfdata mapping - } elsif ( $res eq "0.5x0.5" || - $res eq "0.25x0.25" || - $res eq "0.1x0.1" || - $res eq "3x3min" || - $res eq "5x5min" || - $res eq "10x10min" || - $res eq "0.125x0.125" || - $res eq "0.33x0.33" || - $res eq "1km-merge-10min" ) { - next; - # Resolutions supported in clm40 but NOT clm45/clm50 - } elsif ( $res eq "ne240np4" || - $res eq "ne60np4" || - $res eq "ne4np4" || - $res eq "2.5x3.33" || - $res eq "0.23x0.31" || - $res eq "94x192" || - $res eq "8x16" || - $res eq "32x64" || - $res eq "128x256" || - $res eq "512x1024" ) { - next; - } - - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - - $cfiles->checkfilesexist( "$options", $mode ); - - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); print "\n"; -} - -print "\n==================================================\n"; -print " Test important resolutions for CLM4.5 and BGC\n"; -print "==================================================\n"; - -$mode = "-phys clm4_5"; -system( "../configure -s $mode" ); -my @resolutions = ( "4x5", "10x15", "ne30np4", "ne120np4", "ne16np4", "1.9x2.5", "0.9x1.25" ); -my @regional; -my $nlbgcmode = "bgc"; -my $mode = "clm45-$nlbgcmode"; -foreach my $res ( @resolutions ) { - chomp($res); - print "=== Test $res === \n"; - my $options = "-res $res -envxml_dir . -bgc $nlbgcmode"; - - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - - $cfiles->checkfilesexist( "$options", $mode ); - - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); print "\n"; -} - -print "\n==================================================\n"; -print " Test all use-cases \n"; -print "==================================================\n"; - -# Run over all use-cases... -my $list = `$bldnml -use_case list 2>&1 | grep "use case"`; -my @usecases; -if ( $list =~ /build-namelist : use cases : (.+)$/ ) { - my @usecases = split( / /, $list ); -} else { - die "ERROR:: Trouble getting list of use-cases\n"; -} -foreach my $usecase ( @usecases ) { - $options = "-use_case $usecase -envxml_dir ."; - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "options: $options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); -} - -print "\n==================================================\n"; -print "Test single-point regional cases \n"; -print "==================================================\n"; - -# Run over single-point regional cases -foreach my $res ( @regional ) { - $mode = "-sitespf_pt $res -phys clm4_0"; - system( "../configure -s $mode" ); - &make_env_run(); - eval{ system( "$bldnml -envxml_dir . > $tempfile 2>&1 " ); }; - is( $@, '', "$res" ); - $cfiles->checkfilesexist( "$res", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$res", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$res", $mode ); - $cfiles->comparefiles( "$res", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$res", $mode ); - } - &cleanup(); -} - -print "\n==================================================\n"; -print "Test crop resolutions \n"; -print "==================================================\n"; - -# Check for crop resolutions -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); -my @crop_res = ( "1x1_numaIA", "1x1_smallvilleIA", "4x5", "10x15", "0.9x1.25", "1.9x2.5", "ne30np4", "ne120np4" ); -foreach my $res ( @crop_res ) { - $options = "-bgc bgc -crop -res $res -envxml_dir ."; - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); -} -print "\n==================================================\n"; -print " Test glc_mec resolutions \n"; -print "==================================================\n"; - -# Check for glc_mec resolutions -# -# NOTE(wjs, 2017-12-17) I'm not sure if these glc_mec-specific tests are -# still needed: are they covered with other tests now that we always run -# with glc_mec? Some historical notes: (1) The three resolutions listed -# here used to be the only three with which you could run glc_mec; now -# you can run glc_mec with all resolutions. (2) This used to point to -# all of the glacierMEC use cases; now we don't have glacierMEC-specific -# use cases, but I've kept these pointing to the equivalent normal use -# cases; I'm not sure if it's actually important to test this with all -# of the different use cases. -$mode = "-phys clm4_5"; -system( "../configure -s $mode" ); -my @glc_res = ( "48x96", "0.9x1.25", "1.9x2.5" ); -my @use_cases = ( "1850-2100_rcp2.6_transient", - "1850-2100_rcp4.5_transient", - "1850-2100_rcp6_transient", - "1850-2100_rcp8.5_transient", - "1850_control", - "2000_control", - "20thC_transient", - ); -foreach my $res ( @glc_res ) { - foreach my $usecase ( @usecases ) { - $options = "-bgc bgc -res $res -use_case $usecase -envxml_dir . "; - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); - } -} -# Transient 20th Century simulations -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); -my @tran_res = ( "48x96", "0.9x1.25", "1.9x2.5", "ne30np4", "ne120np4", "10x15" ); -my $usecase = "20thC_transient"; -my $GLC_NEC = 10; -foreach my $res ( @tran_res ) { - $options = "-res $res -use_case $usecase -envxml_dir . "; - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); -} -# Transient rcp scenarios -$mode = "-phys clm5_0"; -system( "../configure -s $mode" ); -my @tran_res = ( "48x96", "0.9x1.25", "1.9x2.5", "ne30np4", "10x15" ); -foreach my $usecase ( "1850_control", "1850-2100_rcp2.6_transient", "1850-2100_rcp4.5_transient", "1850-2100_rcp6_transient", "1850-2100_rcp8.5_transient" ) { - foreach my $res ( @tran_res ) { - $options = "-res $res -bgc bgc -crop -use_case $usecase -envxml_dir . "; - &make_env_run(); - eval{ system( "$bldnml $options > $tempfile 2>&1 " ); }; - is( $@, '', "$options" ); - $cfiles->checkfilesexist( "$options", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options", $mode ); - $cfiles->dodiffonfile( "$real_par_file", "$options", $mode ); - $cfiles->comparefiles( "$options", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options", $mode ); - } - &cleanup(); - } -} - -print "\n==================================================\n"; -print "Test clm4.5/clm5.0 resolutions \n"; -print "==================================================\n"; - -foreach my $phys ( "clm4_5", 'clm5_0' ) { - my $mode = "-phys $phys"; - system( "../configure -s $mode" ); - my @clmoptions = ( "-bgc bgc -envxml_dir .", "-bgc bgc -envxml_dir . -clm_accelerated_spinup=on", "-bgc bgc -envxml_dir . -light_res 360x720", - "-bgc sp -envxml_dir . -vichydro", "-bgc bgc -dynamic_vegetation", "-bgc bgc -clm_demand flanduse_timeseries -sim_year 1850-2000", - "-bgc bgc -envxml_dir . -namelist '&a use_c13=.true.,use_c14=.true.,use_c14_bombspike=.true./'" ); - foreach my $clmopts ( @clmoptions ) { - my @clmres = ( "ne120np4", "10x15", "0.9x1.25", "1.9x2.5" ); - foreach my $res ( @clmres ) { - $options = "-res $res -envxml_dir . "; - &make_env_run( ); - eval{ system( "$bldnml $options $clmopts > $tempfile 2>&1 " ); }; - is( $@, '', "$options $clmopts" ); - $cfiles->checkfilesexist( "$options $clmopts", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options $clmopts", $mode ); - $cfiles->comparefiles( "$options $clmopts", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options $clmopts", $mode ); - } - &cleanup(); - } - } - my @clmoptions = ( "-bgc bgc -envxml_dir .", - "-bgc sp -envxml_dir .", ); - foreach my $clmopts ( @clmoptions ) { - my @clmres = ( "ne16np4", "360x720cru" ); - foreach my $res ( @clmres ) { - $options = "-res $res -envxml_dir . "; - &make_env_run( ); - eval{ system( "$bldnml $options $clmopts > $tempfile 2>&1 " ); }; - is( $@, '', "$options $clmopts" ); - $cfiles->checkfilesexist( "$options $clmopts", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options $clmopts", $mode ); - $cfiles->comparefiles( "$options $clmopts", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options $clmopts", $mode ); - } - &cleanup(); - } - } - system( "../configure -s $mode" ); - my $clmopts = "-bgc cn -crop"; - my $res = "1.9x2.5"; - $options = "-res $res -namelist '&a irrigate=.true./' -crop -bgc cn -envxml_dir ."; - &make_env_run(); - eval{ system( "$bldnml $options $clmopts > $tempfile 2>&1 " ); }; - is( $@, '', "$options $clmopts" ); - $cfiles->checkfilesexist( "$options $clmopts", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options $clmopts", $mode ); - $cfiles->comparefiles( "$options $clmopts", "$mode", $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options $clmopts", $mode ); - } - &cleanup(); - # Run FATES mode for several resolutions and configurations - system( "../configure -s $mode" ); - my $clmoptions = "-bgc fates -envxml_dir . -no-megan"; - my @clmres = ( "1x1_brazil", "5x5_amazon", "10x15", "1.9x2.5" ); - foreach my $res ( @clmres ) { - $options = "-res $res"; - my @edoptions = ( "-use_case 2000_control", "", "-namelist \"&a use_lch4=.true.,use_nitrif_denitrif=.true./\"", "-clm_accelerated_spinup on" ); - foreach my $edop (@edoptions ) { - &make_env_run( ); - eval{ system( "$bldnml $options $clmoptions $edop > $tempfile 2>&1 " ); }; - is( $@, '', "$options $edop" ); - $cfiles->checkfilesexist( "$options $edop", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$options $edop", $mode ); - $cfiles->comparefiles( "$options $edop", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$options $edop", $mode ); - } - &cleanup(); - } - } -} -# -# Run over the differen lnd_tuning modes -# -my $res = "0.9x1.25"; -my $mask = "gx1v6"; -my $simyr = "1850"; -foreach my $phys ( "clm4_0", "clm4_5", 'clm5_0' ) { - my $mode = "-phys $phys"; - system( "../configure -s $mode" ); - foreach my $forc ( "CRUv7", "GSWP3v1", "cam6.0" ) { - foreach my $bgc ( "sp", "bgc" ) { - my $lndtuningmode = "${phys}_${forc}"; - my $clmoptions = "-res $res -mask $mask -sim_year $simyr -envxml_dir . -lnd_tuning_mod $lndtuningmode"; - if ( $phys eq "clm4_0" ) { - $clmoptions .= " -glc_nec 0"; - } else { - $clmoptions .= " -bgc $bgc"; - } - &make_env_run( ); - eval{ system( "$bldnml $clmoptions > $tempfile 2>&1 " ); }; - is( $@, '', "$clmoptions" ); - $cfiles->checkfilesexist( "$clmoptions", $mode ); - $cfiles->shownmldiff( "default", "standard" ); - if ( defined($opts{'compare'}) ) { - $cfiles->doNOTdodiffonfile( "$tempfile", "$clmoptions", $mode ); - $cfiles->comparefiles( "$clmoptions", $mode, $opts{'compare'} ); - } - if ( defined($opts{'generate'}) ) { - $cfiles->copyfiles( "$clmoptions", $mode ); - } - &cleanup(); - } - } -} -&cleanup(); - -system( "/bin/rm $finidat" ); - -print "\n==================================================\n"; -print " Dumping output \n"; -print "==================================================\n"; - -$xFail->parseOutput($captOut); - -print "Successfully ran all testing for build-namelist\n\n"; - -&cleanup( "config" ); -system( "/bin/rm $tempfile" ); - -sub cleanup { -# -# Cleanup files created -# - my $type = shift; - - print "Cleanup files created\n"; - system( "/bin/rm env_run.xml $real_par_file" ); - if ( defined($type) ) { - if ( $type eq "config" ) { - system( "/bin/rm Filepath config_cache.xml CESM_cppdefs" ); - } - } else { - system( "/bin/rm $tempfile *_in" ); - } -} - diff --git a/bld/unit_testers/myuser_nl_clm b/bld/unit_testers/myuser_nl_clm deleted file mode 100644 index e34958ca60..0000000000 --- a/bld/unit_testers/myuser_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ -&clm_inparm -fsurdat = "$DIN_LOC_ROOT/lnd/clm2/PTCLMmydatafiles/1x1pt_US-UMB/surfdata_1x1pt_US-UMB_simyr2000_clm4_5_c131122.nc" -/ diff --git a/bld/unit_testers/xFail/expectedClmTestFails.xml b/bld/unit_testers/xFail/expectedClmTestFails.xml deleted file mode 100644 index 12c954d38b..0000000000 --- a/bld/unit_testers/xFail/expectedClmTestFails.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - goldbach not recognized - goldbach not recognized - goldbach not recognized - - - - - - - - Doesn't check for valid values - - - - - - - - - - - - Internal compiler error - - - - - diff --git a/bld/unit_testers/xFail/expectedFail.pm b/bld/unit_testers/xFail/expectedFail.pm deleted file mode 100755 index 877d4a71ae..0000000000 --- a/bld/unit_testers/xFail/expectedFail.pm +++ /dev/null @@ -1,668 +0,0 @@ -=head1 expectedFail.pm - -Documentation for expectedFail.pm - -=head1 Overview - -The module expectedFail.pm supplies the capability of checking if a failed test is expected to fail. -It is called directly from either test_driver.sh (for batch and interactive tests) or build-namelist_test.pl. -Future plans involve integrating this module into cesm tests. - -=head1 Use Case - -This is a new feature being added to the existing CLM test infrastructure. The use case would roughly be -along the lines of: - - 1) Run the test suite (CLM batch,interactive or namelist) - 2) Search for test failures - a) Fix failed tests - b) -or- Add new xFail entries to XML file if a test is supposed to fail (eg. due to some missing resolution). - 3) Check for new tests that now pass. This is for modifying the ChangeLog. - 4) Update XML file by either adding new entries or removing old ones. - 5) update the ChangeLog to reflect important changes in test behavior (Tests that now pass that failed before, tests that - are now xFail, etc... - -=head2 Public methods - -There are two public methods needed. The "new" ctor and one of the parseOutput* methods. -Everything else is private. - - xFail::expectedFail->new - parseOutput - parseOutputCLM - -=head2 Private methods - - sub _searchExpectedFail - sub _readXml - sub _testNowPassing - sub _printOutput - sub _getTestType - sub _getMachInfo - -=cut - -package xFail::expectedFail; - -our $VERSION = '1.00'; - -use Cwd; -use strict; -use Getopt::Long; -use English; -use Scalar::Util qw(looks_like_number); - -my @testList={}; -my $DEBUG=0; - -my $pass=" PASS"; -my $fail=" FAIL"; -my $xfail="xFAIL"; - -############################################################################## -# -############################################################################## - -=head1 CTOR - -Constructor for the class. Reads in three arguments: - _callingName -> name of the script creating the new object - _compareGenerate -> compare or generate option - _totTests -> total number of tests to run - -Calls _readXml which reads the file expectedClmTestFails.xml and stores it memory -for later searches. - -returns: new object ($self) - -=cut - -############################################################################## -# -############################################################################## -sub new { - my ($class_name) = @_; - my $self = { - _className => shift, - _callingName => shift, - _compareGenerate => shift, - _totTests => shift, - _foundList => undef, - _numericalTestId => undef - }; - - if ($DEBUG) { - print "$self->{_callingName}\n"; - print "$self->{_compareGenerate}\n"; - } - - bless ($self, $class_name); - - $self->{_numericalTestId}=0; - $self->{_created} = 1; - - $self->_readXml(); - - return $self; -} - -############################################################################## -# -############################################################################## - -=head1 parseOutput - -parseOutput parsese the output from the build-namelist_test.pl script. It is similar -to, but not interchangable with parseOutputCLM. - -The only argument is that of the reference variable that contains the information dumped -by Test::More. - -returns: nothing - -=cut - -############################################################################## -# -############################################################################## -sub parseOutput -{ - - - my $report; - my $testId; - my @testName={}; - my $testReason; - - my ($self, $output) = @_ ; - - #_#=========================================== - #_# keep this in for logging - #_#=========================================== - print ("captured output is :: \n $output \n"); - - #_# split the output from Test::More output on newline - my @refList = split('\n', $output); - - #_# process any buffered output which happens when a subroutine from build-namelist_test.pl - #_# itself calls some testing routines - foreach my $refSplit (@refList) { - - #_# always look at the last element of refSplit since that will have the info. from the - #_# last test run - - my @outArr=split(/ /,$refSplit); - - if ($DEBUG) { - print ("\nxFail::expectedFail::parseOutput @outArr[0] \n"); - print ("xFail::expectedFail::parseOutput @outArr[1] \n"); - print ("xFail::expectedFail::parseOutput @outArr[2] \n"); - print ("xFail::expectedFail::parseOutput @outArr[3] \n"); - print ("xFail::expectedFail::parseOutput @outArr[4] \n"); - } - - my $size = @outArr-1; - - #_# first case, we have a passed (ok) test - if (@outArr[0] eq "ok") { - $self->{_numericalTestId}++; - - $report=$pass; - $testId=@outArr[1]; - @testName=@outArr[3..$size]; - $testReason=""; - - my ($retVal,$xFailText)=$self->_searchExpectedFail($testId); - - my $testReason=$self->_testNowPassing($testId,$retVal,$xFailText); - - if($DEBUG){ - print("$testReason \n"); - } - - $self->_printOutput($report,$testId,$testReason,@testName); - - - #_# deal with the case of a failed (not ok) test - } elsif (@outArr[0] eq "not") { - $self->{_numericalTestId}++; - - $testId=@outArr[2]; - my ($retVal,$xFailText)=$self->_searchExpectedFail($testId); - - if ($DEBUG) { - print ("xFail::expectedFail::parseOutput Id $retVal,$xFailText \n"); - } - - @testName=@outArr[4..$size]; - - if ($retVal eq "TRUE"){ - #_# found an expected FAIL (xFAIL) - $report=$xfail; - $testReason= ""; - } else { - #_# print a regular FAIL - $report=$fail; - $testReason=""; - } - - $self->_printOutput($report,$testId,$testReason,@testName); - - } else { - #_# skipping line. Trying to parse error code from Test::More - } - - } - - #_# this resets the reference that points to $output (\$captOut) on the caller side - @_[1]=""; - -} - -############################################################################## -# -############################################################################## - -=head1 parseOutputCLM - -parseOutputCLM parsese the output from the test_driver.sh script. It is similar -to, but not interchangable with parseOutput. - -parseOutputCLM takes one arguments: - $statFoo-> the name of the td..status file - -returns: nothing - -=cut - -############################################################################## -# -############################################################################## -sub parseOutputCLM -{ - - my $report; - my $testId; - my @testName={}; - my $testReason; - - my ($self, $statFoo) = @_ ; - - open(FOO, "< $statFoo"); # open for input - open(FOO_OUT, "> $statFoo.xFail"); # open for input - - my(@reportLines); - - while () { - - my($line) = $_; - - my @outArr=split(/ /,$line); - if (looks_like_number(@outArr[0])) { - - $self->{_numericalTestId}++; - - my $num=sprintf("%03d", $self->{_numericalTestId}); - my $totNum=sprintf("%03d", $self->{_totTests}); - - #_# last element has the pass/fail info. - chomp(@outArr[-1]); - my $repPass=substr(@outArr[-1], -4, 4); - - if ($DEBUG) { - print ("xFail::expectedFail::parseOutput @outArr[0] \n"); - print ("xFail::expectedFail::parseOutput @outArr[1] \n"); - print ("xFail::expectedFail::parseOutput @outArr[2] \n"); - print ("xFail::expectedFail::parseOutput @outArr[3] \n"); - print ("xFail::expectedFail::parseOutput @outArr[4] \n"); - print ("xFail::expectedFail::parseOutput @outArr[5] \n"); - print ("xFail::expectedFail::parseOutput @outArr[6] \n"); - print ("xFail::expectedFail::parseOutput @outArr[-1] \n"); - print ("xFail::expectedFail::parseOutput $repPass \n"); - } - - my $size = @outArr-1; - if ($DEBUG) { - print ("size of line $size \n"); - } - my $endOfDesc=$size-1; - - if ($repPass eq "PASS") { - $report=$pass; - $testId=@outArr[1]; - @testName=@outArr[2..$endOfDesc]; - - my ($retVal,$xFailText)=$self->_searchExpectedFail($testId); - - my $testReason=$self->_testNowPassing($testId,$retVal,$xFailText); - - #_# print out the test results - print FOO_OUT ("$num/$totNum <$report> $testReason \n"); - - } else { - $testId=@outArr[1]; - my ($retVal,$xFailText)=$self->_searchExpectedFail($testId); - - if ($DEBUG) { - print ("xFail::expectedFail::parseOutput Id $retVal,$xFailText \n"); - } - - @testName=@outArr[2..$endOfDesc]; - - if ($retVal eq "TRUE"){ - #_# found an expected FAIL (xFAIL) - $report=$xfail; - $testReason= ""; - } else { - #_# print a regular FAIL - $report=$fail; - $testReason=""; - } - - #_# print out the test results - print FOO_OUT ("$num/$totNum <$report> $testReason \n"); - - } - - } else { - print FOO_OUT $line; - } - } - close(FOO); - close(FOO_OUT); -} - -############################################################################## -# -############################################################################## - -=head1 _searchExpectedFail - -searches the list of expected fails for a match with testId. - -_searchExpectedFail takes one arguments: - $testId-> the test id (numerical or string) that we want to search for - -returns: $retVal (TRUE or FALSE) if id was found - $text text from XML file - -=cut - -############################################################################## -# -############################################################################## -sub _searchExpectedFail -{ - my ( $self,$testId) = @_; - - #search through list for test ID - my $retVal="FALSE"; - - if ($DEBUG) { - print ("here 2 Id $self->{_foundList} \n"); - } - if ($self->{_foundList} eq "FALSE"){ - if ($DEBUG) { - print ("returning early Id \n"); - } - return $retVal; - } - - my $failType; - my $text; - foreach my $tL (@testList) { - my %tAtts = $tL->get_attributes(); - my $tid=$tAtts{'testId'}; - if ($DEBUG) { - print ("_seachExpectedFail Id $tid $testId \n"); - } - if ($tid eq $testId) { - if ($DEBUG) { - print ("here Id \n"); - } - #~# found the test we're looking for - $text=$tL->get_text(); - $failType=$tAtts{'failType'}; - if ($failType eq "xFail"){ - $retVal="TRUE"; - } - } - } - return ($retVal,$text); -} - -############################################################################## -# -############################################################################## - -=head1 _readXml - -reads the xml file for a particular machine, compiler, test type and (compare -| generate) setup and saves it in memory for searching by _searchExpectedFail. - -_readXml takes no arguments - -returns: nothing - -=cut - -############################################################################## -# -############################################################################## -sub _readXml -{ - my ( $self ) = @_; - - #Figure out where configure directory is and where can use the XML/Lite module from - my $ProgName; - ($ProgName = $PROGRAM_NAME) =~ s!(.*)/!!; # name of program - my $ProgDir = $1; # name of directory where program lives - - my $cwd = getcwd(); # current working directory - my $cfgdir; - - if ($ProgDir) { $cfgdir = $ProgDir; } - else { $cfgdir = $cwd; } - - #----------------------------------------------------------------------------------------------- - # Add $cfgdir to the list of paths that Perl searches for modules - my @dirs = ( $cfgdir, "$cfgdir/perl5lib", - "$cfgdir/../../cime/utils/perl5lib", - "$cfgdir/../../../cime/utils/perl5lib" - ); - unshift @INC, @dirs; - my $result = eval "require XML::Lite"; - if ( ! defined($result) ) { - die <<"EOF"; - ** Cannot find perl module \"XML/Lite.pm\" from directories: @dirs ** -EOF - } - - #----------------------------------------------------------------------------------------------- - - my ($machine,$compiler)=_getMachInfo(); - - my $testType=$self->_getTestType($self->{_callingName}); - - - my $xmlFile=undef; - if ($testType eq "clmInteractive" || $testType eq "clmBatch") { - $xmlFile = "$cfgdir/expectedClmTestFails.xml"; - } elsif ($testType eq "namelistTest") { - $xmlFile = "xFail/expectedClmTestFails.xml"; - } else { - $xmlFile = "xFail/expectedClmTestFails.xml"; - } - my $xml = XML::Lite->new($xmlFile); - - my $root = $xml->root_element(); - - if ($DEBUG) { - print "_readXml $self->{_callingName}\n"; - print "_readXml $self->{_compareGenerate}\n"; - print "_readXml $xmlFile \n"; - print ("_readXml Debug testType $testType \n"); - print ("_readXml Debug machine $machine \n"); - print ("_readXml Debug compiler $compiler \n"); - } - - # Check for valid root node - my $name = $root->get_name(); - $name eq "expectedFails" or die - "readExpectedFail.pm::_readXml :: $xmlFile is not a file that contains expected test failures\n"; - - my @e = $xml->elements_by_name($testType); - - $self->{_foundList}="FALSE"; - - ### populate list of tests for a specfic test type, machine and compiler - ### there's got to be a better way to write this - while ( my $e = shift @e ) { - my @mChildren = $e->get_children(); - foreach my $mChild (@mChildren) { - my $mName=$mChild->get_name(); - if ($mName eq $machine){ - my @cChildren = $mChild->get_children(); - foreach my $cChild (@cChildren) { - my $cName=$cChild->get_name(); - if ($cName eq $compiler) { - my @cgChildren=$cChild->get_children(); - foreach my $cgChild (@cgChildren) { - my $cgName=$cgChild->get_name(); - if($cgName eq $self->{_compareGenerate}){ - @testList=$cgChild->get_children(); - $self->{_foundList}="TRUE"; - last; - } - } - } - } - } - } - } - if ($DEBUG) { - print ("here 1 $self->{_foundList} \n"); - } -} - -############################################################################## -# -############################################################################## - -=head1 _testNowPassing - -reads the xml file for a particular machine, compiler, test type and (compare -| generate) setup and saves it in memory for searching by _searchExpectedFail. - -_testNowPassing takes three arguments: - $id - test id to print out - $retVal - TRUE or FALSE. Was the id found in the expected fail list - $xmlText - text from the XML notes section of the file. (Currently not used, - may be used in future). - - returns: a text string - -=cut - -############################################################################## -# -############################################################################## -sub _testNowPassing -{ - - my ($self, $id, $retVal, $xmlText) = @_ ; - my $text=undef; - - if ($retVal eq "TRUE") { - #_# found a test that passes now, but is listed as an xFail - $text = "\n"; - - } else { - #_# this test passes and was not previously listed as an xFail - #_# noOp - } - - return $text; -} - -############################################################################## -# -############################################################################## - -=head1 _printOutput - -method that prints output for status files. - -_printOutput takes four arguments: - $report - PASS,FAIL,xFAIL - $testId - test id to print out - $testReason - for xFAIL and new PASSES, additional reporting - @testName - test description from original test - - returns: a text string - -=cut - -############################################################################## -# -############################################################################## -sub _printOutput -{ - - my ($self, $report, $testId, $testReason, @testName) = @_ ; - - #_# print out the test results - my $num=sprintf("%03d", $self->{_numericalTestId}); - my $totNum=sprintf("%03d", $self->{_totTests}); - print ("$num/$totNum <$report> $testReason \n"); - -} - -############################################################################## -# -############################################################################## - -=head1 _getTestType - -method that takes the name of the calling script and returns the type of -test. Used for searching the expected fail list. - -_getTestType takes four arguments: - $name - name of calling script - - returns: $type, the type of test - -=cut - -############################################################################## -# -############################################################################## -sub _getTestType -{ - - my ($self, $name) = @_ ; - - if($DEBUG){ - print ("_getTestType $name"); - } - - my %testTypes = ( - "build-namelist_test.pl" => "namelistTest", - "test_driver.sh-i" => "clmInteractive", - "test_driver.sh" => "clmBatch", - "clm-cesm.sh" => "cesm" - ); - - my $type = $testTypes {lc $name} || "unknown"; - return $type; - -} - -############################################################################## -# -############################################################################## - -=head1 _getMachInfo - -method that figures out on what platform this is running and returns a 2 digit -machine identifier and the compiler. This will eventually contain multiple -compiler for various machines. - -_getMachInfo takes no arguments - - returns: $mach - the machine I'm running on - $comp - the compiler being used - -=cut - -############################################################################## -# -############################################################################## -sub _getMachInfo -{ - - my $name=`uname -n`; - $name = substr($name, 0, 2); - - my %machNames = ( - "ys" => "yellowstone", - "fr" => "frankfurt" - ); - - my %compNames = ( - "ys" => "INTEL", - "fr" => "INTEL" - ); - - my $mach = $machNames {lc $name} || "unknown"; - my $comp = $compNames {lc $name} || "unknown"; - - return ($mach,$comp); - -} - -# A Perl module must end with a true value or else it is considered not to -# have loaded. By convention this value is usually 1 though it can be -# any true value. A module can end with false to indicate failure but -# this is rarely used and it would instead die() (exit with an error). -1; diff --git a/bld/unit_testers/xFail/wrapClmTests.pl b/bld/unit_testers/xFail/wrapClmTests.pl deleted file mode 100755 index 28238b9d5d..0000000000 --- a/bld/unit_testers/xFail/wrapClmTests.pl +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env perl - -#-# ========================================================================================= - -=head1 wrapClmTest.pl - -=head1 Overview - -This is a wrapper script that is called from test_driver.sh for either interactive or batch -tests. It calls the CTOR for the xFail::expectedFail.pm module and also parses the td*.status -file to create a new file with xFails listed. - -It takes the following arguments: - - numberOfTests -> number of tests from test_driver.sh - statusFile -> name of the td..status file - callingScript -> name of script calling this. For test_driver.sh it may be one of: - 1) test_driver.sh-i for interactive tests - 2) test_driver.sh for batch tests - -=head1 Notes - -This script may be run standalone which is useful for testing purposes. - -=cut - -#-# ========================================================================================= - -use strict; -use Getopt::Long; -use English; -use Cwd; -use Scalar::Util qw(looks_like_number); - -my $DEBUG=0; - -sub usage { - die < 0, - numberOfTests => undef, - statusFile => undef, - callingScript => undef, - ); - -GetOptions( - "h|help" => \$opts{'help'}, - "numberOfTests=s" => \$opts{'numberOfTests'}, - "statusFile=s" => \$opts{'statusFile'}, - "callingScript=s" => \$opts{'callingScript'}, -) or usage(); - -# Give usage message. -usage() if $opts{'help'}; - -my $statFoo = undef; -my $nTests = undef; -my $script= undef; - -if (defined($opts{'statusFile'})) { - $statFoo = $opts{'statusFile'}; -} -if (defined($opts{'numberOfTests'})) { - $nTests = $opts{'numberOfTests'}; -} -if (defined($opts{'callingScript'})) { - $script = $opts{'callingScript'}; -} - -my ( $self ) = @_; - -#Figure out where configure directory is and where can use the XML/Lite module from -my $ProgName; -($ProgName = $PROGRAM_NAME) =~ s!(.*)/!!; # name of program -my $ProgDir = $1; # name of directory where program lives - -my $cwd = getcwd(); # current working directory -my $cfgdir; - -if ($ProgDir) { $cfgdir = $ProgDir; } -else { $cfgdir = $cwd; } - -#----------------------------------------------------------------------------------------------- -# Add $cfgdir to the list of paths that Perl searches for modules -#----------------------------------------------------------------------------------------------- -my @dirs = ( $cfgdir, - "$cfgdir/../", - "$cfgdir/../../../../../cime/utils/perl5lib"); -unshift @INC, @dirs; -my $result = eval "require expectedFail"; -if ( ! defined($result) ) { - die <<"EOF"; -** Cannot find perl module \"xFail/expectedFail.pm\" from directories: @dirs ** -EOF -} - -#_# ==================================== -#_# setup work complete. Now parse file -#_# ==================================== - -if ($DEBUG) { - print (" wrapClmTests.pl:: calling script $script \n"); - print (" wrapClmTests.pl:: number of tests $nTests \n"); - print (" wrapClmTests.pl:: processing $statFoo \n"); -} - -#_# compGen not used for CLM batch or interactive tests, but we use "compare" as the default in this case -my $compGen="compare"; -my $xFail = xFail::expectedFail->new($script,$compGen,$nTests); - -$xFail->parseOutputCLM($statFoo); - -exit(0); diff --git a/manage_externals/checkout_externals b/checkout_externals similarity index 100% rename from manage_externals/checkout_externals rename to checkout_externals diff --git a/cime_config/SystemTests/lii.py b/cime_config/SystemTests/lii.py deleted file mode 100644 index 0bf371ee9a..0000000000 --- a/cime_config/SystemTests/lii.py +++ /dev/null @@ -1,56 +0,0 @@ -""" -Implementation of the CIME LII test. - -This is a CLM specific test: -Verifies that interpolation of initial conditions onto an identical -configuration gives identical results: -(1) do a run with use_init_interp true (suffix base) -(2) do a run with use_init_interp false (suffix no_interp) - -It is more intuitive to think of the no_interp test as the "base". However, we -do the use_init_interp=true test first to facilitate updating initial conditions -whenever this is necessary, as documented below. - -The LII test needs to point to an initial conditions file that is compatible -with the given model configuration. Thus, the pointed-to initial conditions file -needs to be updated whenever surface datasets are changed, or the land-mask is -changed, or an imporant change is made to model physics (for example where new -fields are added to the restart file). The procedure for updating the initial -conditions files used by the LII test is as follows: - -(1) Run the LII test; the 'base' case should run to completion even if the -no_interp test fails. - -(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata -space. Rename this to be similar to the name of the file pointed to in this -test's user_nl_clm file, but with a new creation date. - -(3) Update this test's user_nl_clm file (in the appropriate testmods directory) -to point to the new finidat file. -""" - -from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo -from CIME.XML.standard_module_setup import * -from CIME.SystemTests.test_utils.user_nl_utils import append_to_user_nl_files - -logger = logging.getLogger(__name__) - -class LII(SystemTestsCompareTwo): - - def __init__(self, case): - SystemTestsCompareTwo.__init__(self, case, - separate_builds = False, - run_two_suffix = 'no_interp', - run_one_description = 'use_init_interp set to true', - run_two_description = 'use_init_interp set to false') - - def _case_one_setup(self): - append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", - contents = "use_init_interp = .true.") - - def _case_two_setup(self): - append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", - contents = "use_init_interp = .false.") - diff --git a/cime_config/SystemTests/lii2finidatareas.py b/cime_config/SystemTests/lii2finidatareas.py deleted file mode 100644 index 21ba082fff..0000000000 --- a/cime_config/SystemTests/lii2finidatareas.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -Implementation of the LII2FINIDATAREAS test. - -This is similar to the LII test, but tests init_interp with mode -'use_finidat_areas'. - -As with the standard LII test, this must be used in a configuration for -which we have a compatible out-of-the-box finidat file (so that the run -with use_init_interp = .false. runs successfully). In constrast to our -standard LII test (which uses glcMEC_spunup_1way), this one can use a -standard CISM2%NOEVOLVE configuration: we do *not* need to set -GLC_TWO_WAY_COUPLING=FALSE; in fact, it's a better test if we have -GLC_TWO_WAY_COUPLING=TRUE: with this mode of operation, areas should -match between the two runs. - -It may not be totally necessary to have a system test covering this -init_interp_method: between unit tests and inline checks, we have quite -a bit of testing of this code. It's important to have at least one LII -test to make sure we're interpolating all the fields we're supposed to -interpolate, but we don't necessarily need a LII test with this mode of -operation as long as we have one with the general mode of operation. - -However, this test is a good check that every point has a unique type -(because this mode of operation will fail if that's not the case); this -is something needed even for the 'general' init_interp method to work -correctly, but the 'general' mode won't catch problems in this regard. - -One other reason why this test is useful is to cover the threading -directives in the set_single_match routine, since those aren't covered -by unit tests. So this test mod should be used in a test with threading. - -To update the initial conditions (finidat) file for this test: - -(1) Run the test; the 'base' case should run to completion even if the -no_interp test fails. (If the 'base' case fails, you may need to retry -with init_interp_method='general'.) - -(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata -space. Rename this to be similar to the out-of-the-box finidat file -currently used by this test, but with a new creation date. - -(3) Update namelist defaults to point to the new finidat file. If -updating the out-of-the-box file is not desired, then you could instead -point to this new finidat file with a user_nl_clm file in this testmod. -""" - -from CIME.XML.standard_module_setup import * -from CIME.SystemTests.test_utils.user_nl_utils import append_to_user_nl_files - -# We can import lii directly because the SystemTests directory has been -# added to sys.path. -# -# A cleaner and more general way to accomplish this would be: In cime: -# Rather than adding the SystemTests directory to sys.path and then -# importing an individual module from there: instead, allow each -# component to have a COMPNAME_pylib directory within its cime_config, -# and then have cime add each component's cime_config directory to -# sys.path and then do something like: -# import_module("COMPNAME_pylib.SystemTests.TESTNAME"). Then, for -# example, ctsm could access its own modules via "import -# ctsm_pylib.foo", or (in this case) "from ctsm_pylib.SystemTests.lii -# import LII". -from lii import LII - -logger = logging.getLogger(__name__) - -class LII2FINIDATAREAS(LII): - - def __init__(self, case): - super(LII2FINIDATAREAS, self).__init__(case) - - def _case_one_setup(self): - super(LII2FINIDATAREAS, self)._case_one_setup() - append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", - contents = "init_interp_method = 'use_finidat_areas'") diff --git a/cime_config/SystemTests/lvg.py b/cime_config/SystemTests/lvg.py deleted file mode 100644 index 36fae196b2..0000000000 --- a/cime_config/SystemTests/lvg.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Implementation of the CIME LVG (Land Virtual Glacier) test. - -This is a CLM specific test: -Verifies that adding virtual glacier columns doesn't change answers -(1) do a run with the standard set of virtual columns (suffix base) -(2) add virtual columns over Antarctica (suffix more_virtual) - -This will only pass if there are no column or patch-level outputs in CLM's -history files. -""" - -from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo -from CIME.XML.standard_module_setup import * -from CIME.SystemTests.test_utils.user_nl_utils import append_to_user_nl_files - -logger = logging.getLogger(__name__) - -class LVG(SystemTestsCompareTwo): - - def __init__(self, case): - SystemTestsCompareTwo.__init__(self, case, - separate_builds = False, - run_two_suffix = 'more_virtual', - run_one_description = 'standard set of virtual columns', - run_two_description = 'add virtual columns over Antarctica') - - def _case_one_setup(self): - append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", - contents = "glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'multiple'") - - def _case_two_setup(self): - append_to_user_nl_files(caseroot = self._get_caseroot(), - component = "clm", - contents = "glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'virtual'") - diff --git a/cime_config/SystemTests/ssp.py b/cime_config/SystemTests/ssp.py deleted file mode 100644 index a2aacc9e43..0000000000 --- a/cime_config/SystemTests/ssp.py +++ /dev/null @@ -1,100 +0,0 @@ -""" -Implementation of the CIME SSP test. This class inherits from SystemTestsCommon - -This is a CLM specific test: -Verifies that spinup works correctly -this test is only valid for CLM compsets with CLM45 or CLM50 -(1) do an initial spin test - - set CLM_ACCELERATED_SPINUP to on - - write restarts at the end of the run, turn on short term archiving - - turn MOSART off -(2) do a hybrid non-spinup simulation run - - start from the restart files generated in (1) - - turn MOSART off -""" -from CIME.XML.standard_module_setup import * -from CIME.SystemTests.system_tests_common import SystemTestsCommon -import shutil, glob, os - -logger = logging.getLogger(__name__) - -class SSP(SystemTestsCommon): - - def __init__(self, case): - """ - initialize an object interface to the SSP system test - """ - SystemTestsCommon.__init__(self, case) - rof = self._case.get_value("COMP_ROF") - expect(rof == "mosart", "ERROR: SSP test requires that ROF component be mosart") - - def run_phase(self): - caseroot = self._case.get_value("CASEROOT") - orig_case = self._case - orig_casevar = self._case.get_value("CASE") - - # clone the main case to create ref1 - clone_path = "{}.ref1".format(caseroot) - if os.path.exists(clone_path): - shutil.rmtree(clone_path) - clone = self._case.create_clone(clone_path, keepexe=True) - - # determine run lengths needed below - stop_nf = self._case.get_value("STOP_N") - stop_n1 = stop_nf / 2 - stop_n2 = stop_nf - stop_n1 - - #------------------------------------------------------------------- - # (1) do a spinup run in the main case in the cloned ref case - # (short term archiving is on) - #------------------------------------------------------------------- - os.chdir(clone_path) - self._set_active_case(clone) - - logger.info("startup: doing a {} {} 00000 seconds startup run".format(stop_n1, stop_nf)) - logger.info(" writing restarts at end of run") - logger.info(" short term archiving is on ") - - clone.set_value("CLM_ACCELERATED_SPINUP", "on") - clone.set_value("MOSART_MODE", "NULL") - clone.set_value("STOP_N",stop_n1) - clone.flush() - - dout_sr = clone.get_value("DOUT_S_ROOT") - # No history files expected, set suffix=None to avoid compare error - self._skip_pnl = False - self.run_indv(suffix=None, st_archive=True) - - #------------------------------------------------------------------- - # (2) do a hybrid, non-spinup run in orig_case - #------------------------------------------------------------------- - os.chdir(caseroot) - self._set_active_case(orig_case) - - refdate = run_cmd_no_fail(r'ls -1dt {}/rest/*-00000* | head -1 | sed "s/-00000.*//" | sed "s/^.*rest\///"'.format(dout_sr)) - refsec = "00000" - - # obtain rpointer files and necessary restart files from short term archiving directory - rundir = self._case.get_value("RUNDIR") - - rest_path = os.path.join(dout_sr, "rest", "{}-{}".format(refdate, refsec)) - - for item in glob.glob("{}/*{}*".format(rest_path, refdate)): - os.symlink(item, os.path.join(rundir, os.path.basename(item))) - - for item in glob.glob("{}/*rpointer*".format(rest_path)): - shutil.copy(item, rundir) - - self._case.set_value("CLM_ACCELERATED_SPINUP", "off") - self._case.set_value("RUN_TYPE", "hybrid") - self._case.set_value("GET_REFCASE", False) - self._case.set_value("RUN_REFCASE", "{}.ref1".format(orig_casevar)) - self._case.set_value("MOSART_MODE", "NULL") - - self._case.set_value("RUN_REFDATE", refdate) - self._case.set_value("STOP_N", stop_n2) - self._case.set_value("DOUT_S", False) - self._case.flush() - - # do the restart run (short term archiving is off) - self.run_indv() diff --git a/cime_config/buildcpp b/cime_config/buildcpp deleted file mode 100644 index 7a3bf0083e..0000000000 --- a/cime_config/buildcpp +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python - -""" -API for clm's configure -""" - -from CIME.XML.standard_module_setup import * -from CIME.utils import run_cmd_no_fail, expect - -import glob, shutil -logger = logging.getLogger(__name__) - -def buildcpp(case): - """ - Invoke clm configure ONLY for clm4_0 - output goes in `caseroot`/Buildconf/camconf - """ - - caseroot = case.get_value("CASEROOT") - cimeroot = case.get_value("CIMEROOT") - lnd_root = case.get_value("COMP_ROOT_DIR_LND") - lnd_grid = case.get_value("LND_GRID") - mask_grid = case.get_value("MASK_GRID") - clm_usrdat_name = case.get_value("CLM_USRDAT_NAME") - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - compset = case.get_value("COMPSET") - - if mask_grid == "reg" and lnd_grid != "CLM_USRDAT": - config_opts = "-sitespf_pt $lnd_grid" - else: - config_opts = "" - - if "1PT" in compset: - config_opts = " -sitespf_pt reg" - - clmconf = os.path.join(caseroot, "Buildconf", "clmconf") - if not os.path.isdir(clmconf): - os.makedirs(clmconf) - - cmd = os.path.join(lnd_root,"bld","configure") - command = "%s -cimeroot %s %s %s -usr_src %s -comp_intf mct " \ - %(cmd, cimeroot, config_opts, clm_config_opts, os.path.join(caseroot,"SourceMods","src.clm")) - - run_cmd_no_fail(command, from_dir=clmconf) - - # determine cppdefs - caseroot/clmconf/CESM_cppdefs is created by the call to configure - with open(os.path.join(clmconf, "CESM_cppdefs"), 'r') as f: - user_cppdefs = f.readline().rstrip() - if user_cppdefs: - case.set_value("CLM_CPPDEFS", user_cppdefs) - case.flush() - - return user_cppdefs diff --git a/cime_config/buildlib b/cime_config/buildlib deleted file mode 100755 index 6b86bb0b65..0000000000 --- a/cime_config/buildlib +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env python - -""" -build clm library -""" -import sys, os, time, filecmp, shutil, imp - -_CIMEROOT = os.environ.get("CIMEROOT") -if _CIMEROOT is None: - raise SystemExit("ERROR: must set CIMEROOT environment variable") - -_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") -sys.path.append(_LIBDIR) - -from standard_script_setup import * -from CIME.buildlib import parse_input -from CIME.case import Case -from CIME.utils import run_cmd, expect - -logger = logging.getLogger(__name__) - -############################################################################### -def _main_func(): -############################################################################### - - caseroot, libroot, bldroot = parse_input(sys.argv) - - with Case(caseroot) as case: - - casetools = case.get_value("CASETOOLS") - lnd_root = case.get_value("COMP_ROOT_DIR_LND") - gmake_j = case.get_value("GMAKE_J") - gmake = case.get_value("GMAKE") - mach = case.get_value("MACH") - - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if "clm4_5" in clm_config_opts: - clm_phys = "clm4_5" - elif "clm5_0" in clm_config_opts: - clm_phys = "clm5_0" - elif "clm4_0" in clm_config_opts: - clm_phys = "clm4_0" - else: - expect(False, "CLM_CONFIG_OPTS must support either clm4_5, clm5_0, or clm4_0 physics") - - if clm_phys == "clm4_0": - #------------------------------------------------------- - # create Filepath file and clm_cppdefs for clm4_0 - #------------------------------------------------------- - # the call to configure here creates BOTH the Filepath file and the clm_cppdefs - cmd = os.path.join(os.path.join(lnd_root,"cime_config","buildcpp")) - logger.info(" ...calling clm buildcpp to set build time options") - try: - mod = imp.load_source("buildcpp", cmd) - clm_cppdefs = mod.buildcpp(case) - except: - raise - - # the above call to buildcpp generates the Filepath file - if not os.path.isfile(os.path.join(bldroot, "Filepath")): - filesrc = os.path.join(caseroot, "Buildconf", "clmconf", "Filepath") - filedst = os.path.join(bldroot, "Filepath") - shutil.copy(filesrc,filedst) - - else: - #------------------------------------------------------- - # create Filepath file for clm4_5 or clm5_0 - #------------------------------------------------------- - filepath_file = os.path.join(bldroot,"Filepath") - if not os.path.isfile(filepath_file): - caseroot = case.get_value("CASEROOT") - paths = [os.path.join(caseroot,"SourceMods","src.clm"), - os.path.join(lnd_root,"src","main"), - os.path.join(lnd_root,"src","biogeophys"), - os.path.join(lnd_root,"src","biogeochem"), - os.path.join(lnd_root,"src","soilbiogeochem"), - os.path.join(lnd_root,"src","dyn_subgrid"), - os.path.join(lnd_root,"src","init_interp"), - os.path.join(lnd_root,"src","fates"), - os.path.join(lnd_root,"src","fates","main"), - os.path.join(lnd_root,"src","fates","biogeophys"), - os.path.join(lnd_root,"src","fates","biogeochem"), - os.path.join(lnd_root,"src","fates","fire"), - os.path.join(lnd_root,"src","utils"), - os.path.join(lnd_root,"src","cpl")] - with open(filepath_file, "w") as filepath: - filepath.write("\n".join(paths)) - filepath.write("\n") - - #------------------------------------------------------- - # create the library in libroot - #------------------------------------------------------- - - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if clm_phys == "clm4_0": - complib = os.path.join(libroot,"liblnd.a") - else: - complib = os.path.join(libroot,"libclm.a") - makefile = os.path.join(casetools, "Makefile") - macfile = os.path.join(caseroot, "Macros.%s" % mach) - - if clm_phys == "clm4_0": - cmd = "%s complib -j %d MODEL=clm COMPLIB=%s -f %s MACFILE=%s USER_CPPDEFS='%s'" \ - % (gmake, gmake_j, complib, makefile, macfile, clm_cppdefs ) - else: - cmd = "%s complib -j %d MODEL=clm COMPLIB=%s -f %s MACFILE=%s " \ - % (gmake, gmake_j, complib, makefile, macfile ) - - rc, out, err = run_cmd(cmd) - logger.info("%s: \n\n output:\n %s \n\n err:\n\n%s\n"%(cmd,out,err)) - expect(rc == 0, "Command %s failed with rc=%s" % (cmd, rc)) - -############################################################################### - -if __name__ == "__main__": - _main_func() - diff --git a/cime_config/buildnml b/cime_config/buildnml deleted file mode 100755 index 73855da4dd..0000000000 --- a/cime_config/buildnml +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/bin/env python - -""" -CLM namelist creator -""" -import sys, os, time, shutil, re, imp, filecmp - -_CIMEROOT = os.environ.get("CIMEROOT") -if _CIMEROOT is None: - raise SystemExit("ERROR: must set CIMEROOT environment variable") - -_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") -sys.path.append(_LIBDIR) - -from standard_script_setup import * -from CIME.buildnml import create_namelist_infile, parse_input -from CIME.case import Case -from CIME.utils import expect, run_cmd - -logger = logging.getLogger(__name__) - -_config_cache_template = """ - - - -Specifies clm physics - -""" - -############################################################################### -def buildnml(case, caseroot, compname): -############################################################################### - """Build the clm namelist """ - - # Build the component namelist - if compname != "clm": - raise AttributeError - - lnd_root = case.get_value("COMP_ROOT_DIR_LND") - din_loc_root = case.get_value("DIN_LOC_ROOT") - ccsm_co2_ppmv = case.get_value("CCSM_CO2_PPMV") - clm_co2_type = case.get_value("CLM_CO2_TYPE") - clm_namelist_opts = case.get_value("CLM_NAMELIST_OPTS") - clm_bldnml_opts = case.get_value("CLM_BLDNML_OPTS") - clm_nml_use_case = case.get_value("CLM_NML_USE_CASE") - clm_force_coldstart = case.get_value("CLM_FORCE_COLDSTART") - lnd_tuning_mode = case.get_value("LND_TUNING_MODE") - clm_accelerated_spinup = case.get_value("CLM_ACCELERATED_SPINUP") - comp_glc = case.get_value("COMP_GLC") - comp_atm = case.get_value("COMP_ATM") - lnd_grid = case.get_value("LND_GRID") - lnd_ncpl = case.get_value("LND_NCPL") - lnd_domain_path = case.get_value("LND_DOMAIN_PATH") - lnd_domain_file = case.get_value("LND_DOMAIN_FILE") - ninst_lnd = case.get_value("NINST_LND") - rundir = case.get_value("RUNDIR") - run_type = case.get_value("RUN_TYPE") - run_startdate = case.get_value("RUN_STARTDATE") - run_refcase = case.get_value("RUN_REFCASE") - run_refdate = case.get_value("RUN_REFDATE") - run_reftod = case.get_value("RUN_REFTOD") - glc_nec = case.get_value("GLC_NEC") - mask = case.get_value("MASK_GRID") - - # ----------------------------------------------------- - # Clear out old data - # ----------------------------------------------------- - - input_data_list = os.path.join(caseroot,"Buildconf","clm.input_data_list") - if os.path.exists(input_data_list): - os.remove(input_data_list) - - # ----------------------------------------------------- - # Set clmconf - # ----------------------------------------------------- - - clmconf = os.path.join(caseroot, "Buildconf", "clmconf") - if not os.path.isdir(clmconf): - os.makedirs(clmconf) - - # ----------------------------------------------------- - # Create config_cache.xml file - # ----------------------------------------------------- - - # Note that build-namelist utilizes the contents of the config_cache.xml file in - # the namelist_defaults.xml file to obtain namelist variables - - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if "clm4_5" in clm_config_opts: - clm_phys = "clm4_5" - elif "clm5_0" in clm_config_opts: - clm_phys = "clm5_0" - elif "clm4_0" in clm_config_opts: - clm_phys = "clm4_0" - else: - expect(False, "CLM_CONFIG_OPTS must support either clm4_5, clm5_0, or clm4_0 physics") - - if clm_phys == "clm4_0": - # call buildcpp to obtain clm_cppdefs if it is not set in env_build.xml - call_buildcpp = False - if not os.path.exists(os.path.join(caseroot,"LockedFiles","env_build.xml")): - call_buildcpp = True - else: - file1 = os.path.join(caseroot,"env_build.xml") - file2 = os.path.join(caseroot,"LockedFiles","env_build.xml") - if not filecmp.cmp(file1, file2): - call_buildcpp = True - if call_buildcpp: - cmd = os.path.join(os.path.join(lnd_root,"cime_config","buildcpp")) - logger.info(" ...calling clm buildcpp to set build time options") - try: - mod = imp.load_source("buildcpp", cmd) - mod.buildcpp(case) - except: - raise - else: - config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", "clmconf", "config_cache.xml") - with open(config_cache_path, 'w') as config_cache_file: - config_cache_file.write(config_cache_text) - - # ----------------------------------------------------- - # Determine input arguments into build-namelist - # ----------------------------------------------------- - - startfile_type = "finidat" - start_type = "default" - if run_type == "hybrid": - start_type = "startup" - elif run_type != "startup": - start_type = run_type - - if run_type == "branch": - startfile_type = "nrevsn" - if clm_force_coldstart == "on": - clm_force_coldstart = "off" - logger.warning( "WARNING: You've turned on CLM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + - " turn off CLM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" - ) - - if (clm_force_coldstart == "on"): - logger.warning( "WARNING: CLM is starting up from a cold state" ) - start_type = "cold" - - if lnd_grid == 'T31': - lnd_grid = '48x96' - if lnd_grid == 'T42': - lnd_grid = '64x128' - if lnd_grid == 'T85': - lnd_grid = '128x256' - if lnd_grid == 'T341': - lnd_grid = '512x1024' - - clmusr = "" - if lnd_grid == "CLM_USRDAT": - clm_usrdat_name = case.get_value("CLM_USRDAT_NAME") - lnd_grid = clm_usrdat_name - clmusr = " -clm_usr_name %s "%clm_usrdat_name - - if comp_atm != "datm": - nomeg = "-no-megan" - else: - nomeg = "" - - if clm_nml_use_case != "UNSET": - usecase = "-use_case %s" %clm_nml_use_case - else: - usecase = "" - - if ( (mask != "null") and (mask != "UNSET") ): - gridmask = "-mask %s" %mask - else: - gridmask = "" - - start_ymd = run_startdate.replace('-','') - - if ('-01-01' in run_startdate) or ('-09-01' in run_startdate): - ignore = "-ignore_ic_year" - else: - ignore = "-ignore_ic_date" - - tuning = "-lnd_tuning_mode %s "%lnd_tuning_mode - - spinup = "-clm_accelerated_spinup %s "%clm_accelerated_spinup - - infile = os.path.join(clmconf, "namelist") - - inputdata_file = os.path.join(caseroot,"Buildconf","clm.input_data_list") - - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - - config_cache_file = os.path.join(caseroot,"Buildconf","clmconf","config_cache.xml") - - # ----------------------------------------------------- - # loop over instances - # ----------------------------------------------------- - - ninst = int(ninst_lnd) - for inst_counter in range(1, ninst+1): - - # determine instance string - inst_string = "" - if ninst > 1: - inst_string = '_' + '%04d' % inst_counter - - # If multi-instance case does not have restart file, use - # single-case restart for each instance - rpointer = "rpointer.lnd" - if (os.path.isfile(os.path.join(rundir,rpointer)) and - (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): - shutil.copy(os.path.join(rundir, rpointer), - os.path.join(rundir, rpointer + inst_string)) - - # ----------------------------------------------------- - # call build-namelist - # ----------------------------------------------------- - - if run_type == "hybrid" or run_type == "branch": - clm_startfile = "%s.clm2%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) - if not os.path.exists(os.path.join(rundir, clm_startfile)): - clm_startfile = "%s.clm2.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - clm_icfile = "%s = \'%s\'"%(startfile_type, clm_startfile) - else: - clm_icfile = "" - - infile_lines = [] - infile_lines.append(clm_icfile) - - user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) - namelist_infile = os.path.join(clmconf, "namelist") - - create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) - - cmd = os.path.join(lnd_root,"bld","build-namelist") - - command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s %s/ \" " - "%s %s -res %s %s -clm_start_type %s -envxml_dir %s -l_ncpl %s " - "-lnd_frac %s -glc_nec %s -co2_ppmv %s -co2_type %s -config %s " - "%s %s %s %s" - %(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts, - nomeg, usecase, lnd_grid, clmusr, start_type, caseroot, lnd_ncpl, - lndfrac_file, glc_nec, ccsm_co2_ppmv, clm_co2_type, config_cache_file, - clm_bldnml_opts, spinup, tuning, gridmask)) - - rc, out, err = run_cmd(command, from_dir=clmconf) - expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - if out is not None: - logger.debug(" %s"%out) - if err is not None: - logger.debug(" %s"%err) - - # ----------------------------------------------------- - # copy resolved namelist to rundir - # ----------------------------------------------------- - - if os.path.isdir(rundir): - file1 = os.path.join(clmconf, "lnd_in") - file2 = os.path.join(rundir, "lnd_in") - if ninst > 1: - file2 += inst_string - logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy(file1,file2) - -############################################################################### -def _main_func(): - - caseroot = parse_input(sys.argv) - with Case(caseroot) as case: - buildnml(case, caseroot, "clm") - -if __name__ == "__main__": - _main_func() diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml deleted file mode 100644 index bd95959f94..0000000000 --- a/cime_config/config_component.xml +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - - clm4.0: - clm4.5: - clm5.0: - Satellite phenology: - CN: Carbon Nitrogen model - CNDV: CN with Dynamic Vegetation - CN with prognostic crop: - CNDV with prognostic crop: - - Satellite phenology with VIC hydrology: - BGC (vert. resol. CN and methane): - BGC (vert. resol. CN and methane) with prognostic crop: - FATES (Functionally Assembled Terrestrial Ecosystem Simulator) Ecosystem Demography model: (experimental) - BGC (vert. resol. CN and methane) with dynamic vegetation: - BGC (vert. resol. CN and methane) with dynamic vegetation and prognostic crop: - - - - char - clm - clm - case_comp - env_case.xml - Name of land component - - - - char - - UNSET - build_component_cam - env_build.xml - CLM cpp definitions (if-any) (setup automatically - DO NOT EDIT) - - - - char - run_component_clm - env_run.xml - Tuning parameters and initial conditions should be optimized for what CLM model version and what meteorlogical forcing combination? - - UNSET - clm4_0_CRUv7,clm4_0_GSWP3v1,clm5_0_cam6.0,clm5_0_GSWP3v1,clm5_0_CRUv7,clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0 - - clm4_0_CRUv7 - clm4_0_CRUv7 - clm4_0_CRUv7 - clm4_0_GSWP3v1 - clm4_5_CRUv7 - clm4_5_CRUv7 - clm4_5_GSWP3v1 - clm4_5_cam6.0 - clm5_0_CRUv7 - clm5_0_CRUv7 - clm5_0_GSWP3v1 - clm5_0_cam6.0 - - - - - char - - - -phys clm4_0 - -bgc cn - -bgc cndv - -crop on - -phys clm4_5 - -phys clm5_0 - - build_component_clm - env_build.xml - Provides option(s) for the CLM configure utility. - CLM_CONFIG_OPTS are normally set as compset variables (e.g., -bgc cn) - and in general should not be modified for supported compsets. - It is recommended that if you want to modify this value for your experiment, - you should use your own user-defined component sets via using create_newcase - with a compset_file argument. - This is an advanced flag and should only be used by expert users. - - - - char - UNSET - - - 2000_control - 1850_control - 20thC_transient - 1850-2100_rcp6_transient - 1850-2100_rcp4.5_transient - 1850-2100_rcp2.6_transient - 1850-2100_rcp8.5_transient - 20thC_transient - 1850-2100_rcp4.5_transient - - run_component_clm - env_run.xml - CLM namelist use_case. - Determines the use-case that will be sent to the CLM build-namelist utility. - This is normally set by the component set. This is an advanced flag and should only be - used by expert users. - - - - - - char - - - -bgc sp - -bgc cn - -bgc bgc - -bgc cn -crop - -bgc bgc -crop - -bgc cn -dynamic_vegetation - -bgc bgc -dynamic_vegetation - -bgc cn -dynamic_vegetation -crop - -bgc bgc -dynamic_vegetation -crop - -bgc sp -vichydro - -bgc fates -no-megan - - -bgc sp - -bgc bgc - -bgc bgc -dynamic_vegetation - -bgc bgc -crop - -bgc cn - -bgc cn -crop - -bgc cn -dynamic_vegetation - -bgc cn -dynamic_vegetation -crop - -bgc bgc -dynamic_vegetation -crop - -bgc sp -vichydro - -bgc fates -no-megan - - run_component_clm - env_run.xml - CLM build-namelist options - - - - char - constant,diagnostic,prognostic - constant - - diagnostic - diagnostic - prognostic - diagnostic - diagnostic - - run_component_clm - env_run.xml - Determines how CLM will determine where CO2 is set. - If value is constant, it will be set to CCSM_CO2_PPMV, - if value is either diagnostic or prognostic, the atmosphere model - MUST send it to CLM. CLM_CO2_TYPE is normally set by the specific - compset, since it HAS to be coordinated with settings for the - atmospheric model. Do not modify this variable. If you want to modify for - your experiment, use your own user-defined component set - This is an advanced flag and should only be used by expert users. - - - - char - - run_component_clm - env_run.xml - CLM-specific namelist settings for -namelist option in the CLM - build-namelist. CLM_NAMELIST_OPTS is normally set as a compset variable - and in general should not be modified for supported compsets. - It is recommended that if you want to modify this value for your experiment, - you should use your own user-defined component sets via using create_newcase - with a compset_file argument. - This is an advanced flag and should only be used by expert users. - - - - char - on,off - off - run_component_clm - env_run.xml - Turn on any settings for accellerating the model spinup. - - - - - char - UNSET - run_component_clm - env_run.xml - Dataset name for user-created datasets. This is used as the argument - in Buildconf/clm.buildnml to build-namelist -clm_usr_name. An example of - such a dataset would be 1x1pt_boulderCO_c090722. The default value is UNSET. - This is an advanced flag and should only be used by expert users. - - - - char - on,off - off - run_component_clm - env_run.xml - Flag to the CLM build-namelist command to force CLM to do a - cold start (finidat will be set to blanks). - A value of on forces the model to spin up from a cold-start - (arbitrary initial conditions). Setting this value in the xml file will take - precedence over any settings for finidat in the $CASEROOT/user_clm_clm file. - - - - ========================================= - CLM naming conventions - ========================================= - note: [^_]* means match zero or more of any character BUT an underbar. - (in other words make sure there is NOT a underbar before the string afterwards) - - - diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml deleted file mode 100644 index c628110a9c..0000000000 --- a/cime_config/config_compsets.xml +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - ========================================= - compset naming convention - ========================================= - The compset longname below has the specified order - atm, lnd, ice, ocn, river, glc wave cesm-options - - The notation for the compset longname is - TIME_ATM[%phys]_LND[%phys]_ICE[%phys]_OCN[%phys]_ROF[%phys]_GLC[%phys]_WAV[%phys][_BGC%phys] - Where for the CAM specific compsets below the following is supported - TIME = Time period (e.g. 2000, HIST, RCP8...) - ATM = [CAM40, CAM50, CAM55] - LND = [CLM40, CLM45, CLM50, SLND] - ICE = [CICE, DICE, SICE] - OCN = [DOCN, ,AQUAP, SOCN] - ROF = [RTM, SROF] - GLC = [CISM1, CISM2] - WAV = [SWAV] - BGC = optional BGC scenario - - The OPTIONAL %phys attributes specify submodes of the given system - For example DOCN%DOM is the data ocean model for DOCN - ALL the possible %phys choices for each component are listed - with the -list command for create_newcase - ALL data models must have a %phys option that corresponds to the data model mode - - Each compset node is associated with the following elements - - lname - - alias - - science_support (if this compset is supported scientifically with control simulations) - - - - - - I1PtClm50SpGs - 2000_DATM%1PT_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV - - - - I1PtClm45SpGs - 2000_DATM%1PT_CLM45%SP_SICE_SOCN_RTM_SGLC_SWAV - - - - - - I2000Clm50Sp - 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - I2000Clm50BgcCru - 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm50BgcCropRtm - 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I2000Clm50BgcCrop - 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm50Cn - 2000_DATM%GSWP3v1_CLM50%CN_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - I1850Clm50Sp - 1850_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - I1850Clm50SpCru - 1850_DATM%CRUv7_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - I1850Clm50BgcCrop - 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - I1850Clm50BgcCropCru - 1850_DATM%CRUv7_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - I2000Clm50SpGs - 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_SGLC_SWAV - - - - - I2000Clm50BgcCropGs - 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - - - I2000Clm50BgcCruGs - 2000_DATM%CRUv7_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV - - - - - I2000Clm50SpRtmFl - 2000_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_RTM%FLOOD_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm50Fates - 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - I2000Clm50FatesCruGs - 2000_DATM%CRUv7_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV - - - - - I2000Clm50FatesGs - 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV - - - - I1850Clm50Bgc - 1850_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - IHistClm50BgcCrop - HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - IHistClm50Sp - HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - IHistClm50Bgc - HIST_DATM%GSWP3v1_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - IHistClm50BgcQianGs - HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_MOSART_SGLC_SWAV - - - - - IHistClm50BgcCropGs - HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - - - - I2000Clm50BgcDvCrop - 2000_DATM%GSWP3v1_CLM50%BGCDV-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm50BgcDvCropQianGs - 2000_DATM%QIA_CLM50%BGCDV-CROP_SICE_SOCN_MOSART_SGLC_SWAV - - - - - - I1850Clm50BgcSpinup - 1850_DATM%CPLHIST_CLM50%BGC_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV - - - - - - - I1850Clm45BgcCrop - 1850_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I1850Clm45BgcCruGs - 1850_DATM%CRUv7_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - - - - - - IHistClm45BgcCrop - HIST_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - - IHistClm45BgcCropQianGs - HIST_DATM%QIA_CLM45%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV - - - - I2000Clm45Sp - 2000_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I2000Clm45BgcCrop - 2000_DATM%GSWP3v1_CLM45%BGC-CROP_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I2000Clm45Fates - 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - - I2000Clm45FatesGs - 2000_DATM%GSWP3v1_CLM45%FATES_SICE_SOCN_RTM_SGLC_SWAV - - - - I1850Clm45Cn - 1850_DATM%GSWP3v1_CLM45%CN_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I1850Clm45Bgc - 1850_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - I1850Clm45BgcGs - 1850_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - - - - - I1850Clm45BgcCru - 1850_DATM%CRUv7_CLM45%BGC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - IHistClm45Bgc - HIST_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - IHistClm45BgcGs - HIST_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - - - - - IHistClm45BgcCruGs - HIST_DATM%CRUv7_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - - - - - - I2000Clm50Vic - 2000_DATM%GSWP3v1_CLM50%SP-VIC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - I2000Clm45VicCru - 2000_DATM%CRUv7_CLM45%SP-VIC_SICE_SOCN_RTM_CISM2%NOEVOLVE_SWAV - - - - - - I1850Clm50SpG - 1850_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV - - - - IHistClm50SpG - HIST_DATM%GSWP3v1_CLM50%SP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV - - - - I1850Clm50BgcCropG - 1850_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV - - - - IHistClm50BgcCropG - HIST_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%EVOLVE_SWAV - - - - - I2000Clm40SpCruGs - 2000_DATM%CRUv7_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV - - - - I1850Clm40SpCruGs - 1850_DATM%CRUv7_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV - - - - - - I1850Clm40SpGswGs - 1850_DATM%GSWP3v1_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV - - - - - - I1850Clm40CnGswGs - 1850_DATM%GSWP3v1_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV - - - - - - IHistClm40SpCruGs - HIST_DATM%CRUv7_CLM40%SP_SICE_SOCN_RTM_SGLC_SWAV - - - - IHistClm40CnGswGs - HIST_DATM%GSWP3v1_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV - - - - - - IHistClm40CnCruGs - HIST_DATM%CRUv7_CLM40%CN_SICE_SOCN_RTM_SGLC_SWAV - - - - - - - - - - - - - 1850-01-01 - 1980-01-15 - 1997-12-31 - 1993-12-01 - 1992-08-12 - 0001-08-12 - - - - - - nsteps - nsteps - nsteps - - - - - - 158 - 331 - 22772 - - - - - - diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml deleted file mode 100644 index 4362bed475..0000000000 --- a/cime_config/config_pes.xml +++ /dev/null @@ -1,690 +0,0 @@ - - - - - - - - none - - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -1 - -9 - -9 - -9 - -9 - -9 - -9 - -9 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - - - - - - - - none - - -1 - -4 - -4 - -4 - -4 - -4 - -4 - -4 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - - - - - - - - none - - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - 180 - 180 - 180 - 180 - 180 - 180 - 180 - 180 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -1 - -40 - -40 - -40 - -40 - -40 - -40 - -40 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - - - - - - - - none - - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -1 - -50 - -50 - -50 - -50 - -50 - -50 - -50 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - - - - - - - - none - - -8 - -8 - -8 - -8 - -8 - -8 - -8 - -8 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -16 - -16 - -16 - -16 - -16 - -16 - -16 - -16 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -16 - -16 - -16 - -16 - -16 - -16 - -16 - -16 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -32 - -32 - -32 - -32 - -32 - -32 - -32 - -32 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - 5 - 5 - 5 - 5 - 5 - 5 - 5 - 5 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 - -4 - - - 1> - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 - -2 - - - 1> - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - none - - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - -1 - - - 1> - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - - - 1 - - - 1 - - - - - - - diff --git a/cime_config/config_tests.xml b/cime_config/config_tests.xml deleted file mode 100644 index 33f8b4a692..0000000000 --- a/cime_config/config_tests.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - CLM initial condition interpolation test (requires configuration with non-blank finidat) - 1 - FALSE - FALSE - never - $STOP_OPTION - $STOP_N - - - - CLM initial condition interpolation test using finidat_areas (requires configuration with non-blank finidat) - 1 - FALSE - FALSE - never - $STOP_OPTION - $STOP_N - - - - CLM test: Verify that adding virtual glacier columns doesn't change answers - 1 - FALSE - FALSE - never - - never - - - - smoke CLM spinup test (only valid for CLM45 or CLM50 compsets) - 1 - ndays - startup - 4 - FALSE - - - diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml deleted file mode 100644 index da8d8e1080..0000000000 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - FAIL ERP_D_Ld10_P36x2.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-ciso_decStart RUN - FAIL ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-monthly RUN - FAIL ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropGs.cheyenne_intel.clm-monthly RUN - FAIL ERS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-default COMPARE_base_rest - FAIL ERP_D_Ld5.f09_g17.I2000Clm50Vic.cheyenne_intel.clm-vrtlay RUN - FAIL SMS.f10_f10_musgs.I2000Clm50BgcCrop.hobart_pgi.clm-crop RUN - FAIL SMS_D.f10_f10_musgs.I2000Clm50BgcCrop.hobart_pgi.clm-crop RUN - - - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.hobart_nag.clm-Fates COMPARE_base_rest - FAIL ERP_Ld9.f45_f45_mg37.I2000Clm45Fates.hobart_nag.clm-FatesAllVars COMPARE_base_rest - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-FatesLogging COMPARE_base_rest - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-Fates COMPARE_base_rest - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-FatesNoFire COMPARE_base_rest - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-FatesPPhys COMPARE_base_rest - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-FatesST3 COMPARE_base_rest - FAIL ERP_Ld9.f45_f45_mg37.I2000Clm45Fates.cheyenne_intel.clm-FatesAllVars COMPARE_base_rest - FAIL ERS_Ld60.f45_f45_mg37.I2000Clm45Fates.cheyenne_gnu.clm-Fates COMPARE_base_rest - - diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml deleted file mode 100644 index 60eb71464d..0000000000 --- a/cime_config/testdefs/testlist_clm.xml +++ /dev/null @@ -1,1921 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cime_config/testdefs/testmods_dirs/clm/40crop/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/40crop/include_user_mods deleted file mode 100644 index e009e9a25a..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40crop/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../40default diff --git a/cime_config/testdefs/testmods_dirs/clm/40crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/40crop/user_nl_clm deleted file mode 100644 index 7ba5b8685b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40crop/user_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ - hist_fincl1 += 'GDD0', 'GDD8', 'GDD10', - 'GDD020', 'GDD820', 'GDD1020', - 'GDDPLANT', 'GDDTSOI', 'A5TMIN', 'A10TMIN' diff --git a/cime_config/testdefs/testmods_dirs/clm/40default/shell_commands b/cime_config/testdefs/testmods_dirs/clm/40default/shell_commands deleted file mode 100644 index c931cba688..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40default/shell_commands +++ /dev/null @@ -1,3 +0,0 @@ -# Turn fire emission driver namelist off in case clm4_0 is being used -./xmlchange CLM_BLDNML_OPTS="-no-fire_emis" --append - diff --git a/cime_config/testdefs/testmods_dirs/clm/40default/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/40default/user_nl_clm deleted file mode 100644 index 4018165f31..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40default/user_nl_clm +++ /dev/null @@ -1,25 +0,0 @@ - wrtdia = .true. - hist_dov2xy = .true.,.false. -! Even though only 2 history tapes are defined here, set ndens to 1 for up to 6 history -! tapes, for the sake of mods that extend these default mods and may add other history tapes - hist_ndens = 1,1,1,1,1,1 - hist_nhtfrq =-24,-8 - hist_mfilt = 1,1 - hist_fincl1 = 'TRAFFICFLUX', 'SNOWLIQ:A','SNOWICE:A' - hist_fincl2 = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TSA_U', 'TSA_R', - 'TREFMNAV_U', 'TREFMNAV_R', - 'TREFMXAV_U', 'TREFMXAV_R', - 'TG_U', 'TG_R', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF_U', 'QRUNOFF_R', - 'SoilAlpha_U', - 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT' - - diff --git a/cime_config/testdefs/testmods_dirs/clm/40pts/README b/cime_config/testdefs/testmods_dirs/clm/40pts/README deleted file mode 100644 index 30d71a7c8b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40pts/README +++ /dev/null @@ -1,5 +0,0 @@ -This testmods directory should not be used directly. Instead, it should be -extended (i.e., included) by a mods directory that defines the point to run -over - something like: - -./xmlchange PTS_LAT=42,PTS_LON=260 diff --git a/cime_config/testdefs/testmods_dirs/clm/40pts/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/40pts/include_user_mods deleted file mode 100644 index e009e9a25a..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40pts/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../40default diff --git a/cime_config/testdefs/testmods_dirs/clm/40pts/shell_commands b/cime_config/testdefs/testmods_dirs/clm/40pts/shell_commands deleted file mode 100644 index ad140e45e1..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40pts/shell_commands +++ /dev/null @@ -1,24 +0,0 @@ -./xmlchange PTS_MODE=TRUE -./xmlchange ATM_NX=0 -./xmlchange ATM_NY=0 -./xmlchange LND_NX=0 -./xmlchange LND_NY=0 -./xmlchange ICE_NX=0 -./xmlchange ICE_NY=0 -./xmlchange OCN_NX=0 -./xmlchange OCN_NY=0 -./xmlchange ROF_NX=0 -./xmlchange ROF_NY=0 -./xmlchange GLC_NX=0 -./xmlchange GLC_NY=0 -./xmlchange WAV_NX=0 -./xmlchange WAV_NY=0 -./xmlchange NTASKS_ATM=1 -./xmlchange NTASKS_LND=1 -./xmlchange NTASKS_ICE=1 -./xmlchange NTASKS_OCN=1 -./xmlchange NTASKS_CPL=1 -./xmlchange NTASKS_GLC=1 -./xmlchange NTASKS_ROF=1 -./xmlchange NTASKS_WAV=1 -./xmlchange NTASKS_ESP=1 diff --git a/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/include_user_mods deleted file mode 100644 index 85ea433e18..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../40pts diff --git a/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/shell_commands b/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/shell_commands deleted file mode 100644 index 48287a2998..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange PTS_LAT=42,PTS_LON=260 -./xmlchange --force CLM_FORCE_COLDSTART=on diff --git a/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/include_user_mods deleted file mode 100644 index 85ea433e18..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../40pts diff --git a/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/shell_commands b/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/shell_commands deleted file mode 100644 index 15fd1cced4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange PTS_LAT=-5,PTS_LON=290 -./xmlchange --force CLM_FORCE_COLDSTART=on diff --git a/cime_config/testdefs/testmods_dirs/clm/40ptsROA/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/40ptsROA/include_user_mods deleted file mode 100644 index 85ea433e18..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40ptsROA/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../40pts diff --git a/cime_config/testdefs/testmods_dirs/clm/40ptsROA/shell_commands b/cime_config/testdefs/testmods_dirs/clm/40ptsROA/shell_commands deleted file mode 100644 index d5be09e860..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40ptsROA/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange PTS_LAT=30,PTS_LON=315 -./xmlchange --force CLM_FORCE_COLDSTART=on diff --git a/cime_config/testdefs/testmods_dirs/clm/40reduceOutput/shell_commands b/cime_config/testdefs/testmods_dirs/clm/40reduceOutput/shell_commands deleted file mode 100644 index e075bf29fd..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40reduceOutput/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -# Turn fire emission driver namelist off in case clm4_0 is being used -./xmlchange CLM_BLDNML_OPTS="-no-fire_emis" --append - diff --git a/cime_config/testdefs/testmods_dirs/clm/40reduceOutput/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/40reduceOutput/user_nl_clm deleted file mode 100644 index 3d94564c47..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/40reduceOutput/user_nl_clm +++ /dev/null @@ -1,12 +0,0 @@ -hist_empty_htapes = .true. -hist_fincl1 = 'SNOWLIQ','SNOWICE' , - 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TG', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF' diff --git a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/shell_commands b/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/shell_commands deleted file mode 100644 index 3a08fbc8e7..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/shell_commands +++ /dev/null @@ -1,6 +0,0 @@ -# Test Data Assimilation with multi-driver on -./xmlchange LND_DATA_ASSIMILATION=TRUE -./xmlchange MULTI_DRIVER=TRUE - -# Set calendar, just because Gregorian is ussually used for DA -./xmlchange CALENDAR=GREGORIAN diff --git a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0001 b/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0001 deleted file mode 100644 index 62299f7ee4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0001 +++ /dev/null @@ -1,13 +0,0 @@ - ! Settings being used for DART cases - hist_empty_htapes = .true. - hist_fincl1 = 'NEP','TOTECOSYSC','TOTVEGC','TLAI' - hist_fincl2 = 'NEP','FSH','EFLX_LH_TOT_R' - hist_fincl3 = 'TV','TLAI','PBOT','TBOT','TSA','RH2M_R','SNOWDP' - hist_nhtfrq = -24,1,-24 - hist_mfilt = 1,48,1 - hist_avgflag_pertape = 'A','A','I' - hist_dov2xy = .true.,.true.,.false. - hist_type1d_pertape = ' ',' ',' ' - - use_init_interp = .true. - finidat = '/glade/p_old/image/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0001.r.2001-01-01-00000.nc' diff --git a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0002 b/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0002 deleted file mode 100644 index 0df6e5a2a2..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/DA_multidrv/user_nl_clm_0002 +++ /dev/null @@ -1,13 +0,0 @@ - ! Settings being used for DART cases - hist_empty_htapes = .true. - hist_fincl1 = 'NEP','TOTECOSYSC','TOTVEGC','TLAI' - hist_fincl2 = 'NEP','FSH','EFLX_LH_TOT_R' - hist_fincl3 = 'TV','TLAI','PBOT','TBOT','TSA','RH2M_R','SNOWDP' - hist_nhtfrq = -24,1,-24 - hist_mfilt = 1,48,1 - hist_avgflag_pertape = 'A','A','I' - hist_dov2xy = .true.,.true.,.false. - hist_type1d_pertape = ' ',' ',' ' - - use_init_interp = .true. - finidat = '/glade/p_old/image/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2001-01-01-00000/clm5_f09_spinup80.clm2_0002.r.2001-01-01-00000.nc' diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands b/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands deleted file mode 100644 index 41a2342a51..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange CLM_BLDNML_OPTS="-no-megan" --append -./xmlchange BFBFLAG="TRUE" diff --git a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm deleted file mode 100644 index 487ad09863..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm +++ /dev/null @@ -1,11 +0,0 @@ -!!finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/iclm45fates-finit-s1.4.0-a3.0.0-1x1br.clm2.r.0111-01-01-00000.nc' -hist_mfilt = 365 -hist_nhtfrq = -24 -hist_empty_htapes = .true. -use_fates_spitfire= .true. -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', - 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', - 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC','NPLANT_SCAG','NPLANT_SCPF', - 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/shell_commands b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/shell_commands deleted file mode 100644 index 2a9f09bd75..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm deleted file mode 100644 index a869310636..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm +++ /dev/null @@ -1,31 +0,0 @@ -!finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/iclm45fates-finit-s1.4.0-a3.0.0-f45.clm2.r.0111-01-01-00000.nc' -hist_mfilt = 365 -hist_nhtfrq = -24 -hist_empty_htapes = .false. -use_fates_spitfire= .true. -hist_fincl1 = 'NCL_BY_AGE','NPATCH_BY_AGE','BIOMASS_BY_AGE','NPP_BY_AGE','GPP_BY_AGE','PARSUN_Z_CNLF','PARSHA_Z_CNLF','PARSUN_Z_CNLFPFT', - 'PARSHA_Z_CNLFPFT','PARSUN_Z_CAN','PARSHA_Z_CAN','LAISUN_Z_CNLF','LAISHA_Z_CNLF','LAISUN_Z_CNLFPFT','LAISHA_Z_CNLFPFT', - 'LAISUN_TOP_CAN','LAISHA_TOP_CAN','FABD_SUN_CNLFPFT','FABD_SHA_CNLFPFT','FABI_SUN_CNLFPFT','FABI_SHA_CNLFPFT', - 'FABD_SUN_CNLF','FABD_SHA_CNLF','FABI_SUN_CNLF','FABI_SHA_CNLF','FABD_SUN_TOPLF_BYCANLAYER','FABD_SHA_TOPLF_BYCANLAYER', - 'FABI_SUN_TOPLF_BYCANLAYER','FABI_SHA_TOPLF_BYCANLAYER','TS_NET_UPTAKE_CNLF','YEAR_NET_UPTAKE_CNLF','CROWNAREA_CNLF', - 'MORTALITY_CARBONFLUX_CANOPY','MORTALITY_CARBONFLUX_UNDERSTORY','NPLANT_SCAG','NPLANT_CANOPY_SCAG','NPLANT_UNDERSTORY_SCAG', - 'DDBH_CANOPY_SCAG','DDBH_UNDERSTORY_SCAG','MORTALITY_CANOPY_SCAG','MORTALITY_UNDERSTORY_SCAG','GPP_SCPF','GPP_CANOPY_SCPF', - 'AR_CANOPY_SCPF','GPP_UNDERSTORY_SCPF','AR_UNDERSTORY_SCPF','NPP_SCPF','NPP_LEAF_SCPF','NPP_SEED_SCPF','NPP_FNRT_SCPF', - 'NPP_BGSW_SCPF','NPP_BGDW_SCPF','NPP_AGSW_SCPF','NPP_AGDW_SCPF','NPP_STOR_SCPF','DDBH_SCPF','DDBH_CANOPY_SCPF', - 'DDBH_UNDERSTORY_SCPF','BA_SCPF','NPLANT_SCPF','M1_SCPF','M2_SCPF','M3_SCPF','M4_SCPF','M5_SCPF','M6_SCPF','M7_SCPF', - 'MORTALITY_CANOPY_SCPF','BSTOR_CANOPY_SCPF','BLEAF_CANOPY_SCPF','NPLANT_CANOPY_SCPF','MORTALITY_UNDERSTORY_SCPF', - 'BSTOR_UNDERSTORY_SCPF','BLEAF_UNDERSTORY_SCPF','NPLANT_UNDERSTORY_SCPF','CWD_AG_CWDSC','CWD_BG_CWDSC','CWD_AG_IN_CWDSC', - 'CWD_BG_IN_CWDSC','CWD_AG_OUT_CWDSC','CWD_BG_OUT_CWDSC','AR_SCPF','AR_GROW_SCPF','AR_MAINT_SCPF','AR_DARKM_SCPF','AR_AGSAPM_SCPF', - 'AR_CROOTM_SCPF','AR_FROOTM_SCPF','DDBH_CANOPY_SCLS','DDBH_UNDERSTORY_SCLS','YESTERDAYCANLEV_CANOPY_SCLS', - 'YESTERDAYCANLEV_UNDERSTORY_SCLS','BA_SCLS','DEMOTION_RATE_SCLS','PROMOTION_RATE_SCLS','NPLANT_CANOPY_SCLS', - 'MORTALITY_CANOPY_SCLS','NPLANT_UNDERSTORY_SCLS','MORTALITY_UNDERSTORY_SCLS','TRIMMING_CANOPY_SCLS','TRIMMING_UNDERSTORY_SCLS', - 'CROWN_AREA_CANOPY_SCLS','CROWN_AREA_UNDERSTORY_SCLS','LEAF_MD_CANOPY_SCLS','ROOT_MD_CANOPY_SCLS','CARBON_BALANCE_CANOPY_SCLS', - 'SEED_PROD_CANOPY_SCLS','DBALIVEDT_CANOPY_SCLS','DBDEADDT_CANOPY_SCLS','DBSTOREDT_CANOPY_SCLS','STORAGE_FLUX_CANOPY_SCLS', - 'NPP_LEAF_CANOPY_SCLS','NPP_FROOT_CANOPY_SCLS','NPP_BSW_CANOPY_SCLS','NPP_BDEAD_CANOPY_SCLS','NPP_BSEED_CANOPY_SCLS', - 'NPP_STORE_CANOPY_SCLS','RDARK_CANOPY_SCLS','LIVESTEM_MR_CANOPY_SCLS','LIVECROOT_MR_CANOPY_SCLS','FROOT_MR_CANOPY_SCLS', - 'RESP_G_CANOPY_SCLS','RESP_M_CANOPY_SCLS','LEAF_MD_UNDERSTORY_SCLS','ROOT_MD_UNDERSTORY_SCLS','CARBON_BALANCE_UNDERSTORY_SCLS', - 'SEED_PROD_UNDERSTORY_SCLS','DBALIVEDT_UNDERSTORY_SCLS','DBDEADDT_UNDERSTORY_SCLS','DBSTOREDT_UNDERSTORY_SCLS', - 'STORAGE_FLUX_UNDERSTORY_SCLS','NPP_LEAF_UNDERSTORY_SCLS','NPP_FROOT_UNDERSTORY_SCLS','NPP_BSW_UNDERSTORY_SCLS', - 'NPP_BDEAD_UNDERSTORY_SCLS','NPP_BSEED_UNDERSTORY_SCLS','NPP_STORE_UNDERSTORY_SCLS','RDARK_UNDERSTORY_SCLS', - 'LIVESTEM_MR_UNDERSTORY_SCLS','LIVECROOT_MR_UNDERSTORY_SCLS','FROOT_MR_UNDERSTORY_SCLS','RESP_G_UNDERSTORY_SCLS', - 'RESP_M_UNDERSTORY_SCLS' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/shell_commands b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/shell_commands deleted file mode 100644 index 2a9f09bd75..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm deleted file mode 100644 index 144569c412..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm +++ /dev/null @@ -1,6 +0,0 @@ -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', - 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', - 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC','NPLANT_SCAG','NPLANT_SCPF', - 'BA_SCLS','NPP_BY_AGE','CWD_AG_CWDSC','PARSUN_Z_CNLF','PARSUN_Z_CNLFPFT','PARSHA_Z_CAN' diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesLogging/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesLogging/user_nl_clm deleted file mode 100644 index 3b74a4fd37..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesLogging/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -use_fates_logging= .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm deleted file mode 100644 index dfdb775ec5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -use_fates_spitfire= .false. diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/user_nl_clm deleted file mode 100644 index 9da01bc3fe..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -use_fates_ed_prescribed_phys= .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesST3/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesST3/user_nl_clm deleted file mode 100644 index eca76c4b9c..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesST3/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -use_fates_ed_st3= .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/include_user_mods deleted file mode 100644 index 4c7aa0f2b4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../Fates diff --git a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm deleted file mode 100644 index f9d31eecbb..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ -hist_fincl1 = 'NPP','GPP','BTRAN','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', - 'FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', - 'fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', - 'PFTleafbiomass','FIRE_ROS','WIND','AREA_TREES','AREA_PLANT', - 'TOTSOMC','TOTLITC','T_SCALAR','NEP','NBP','HR','TOTECOSYSC' diff --git a/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/user_nl_clm deleted file mode 100644 index f225dede82..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/user_nl_clm +++ /dev/null @@ -1,4 +0,0 @@ - anoxia = .true. - use_vertsoilc = .false. - use_nitrif_denitrif = .false. - hist_wrtch4diag = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/user_nl_clm deleted file mode 100644 index d03efa953b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ - use_snicar_frc = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/USUMB/shell_commands b/cime_config/testdefs/testmods_dirs/clm/USUMB/shell_commands deleted file mode 100755 index 446125abf9..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/USUMB/shell_commands +++ /dev/null @@ -1,19 +0,0 @@ -# shell commands to execute xmlchange commands written by PTCLMmkdata: -# ./PTCLMmkdata --cesm_root ../../../.. -s US-UMB -d /glade/p/cesm/cseg/inputdata --mydatadir=/glade/p/cesm/cseg/inputdata/lnd/clm2/PTCLMmydatafiles.c171024 -./xmlchange CLM_USRDAT_NAME=1x1pt_US-UMB -./xmlchange DATM_CLMNCEP_YR_START=1999 -./xmlchange DATM_CLMNCEP_YR_END=2006 -# Comment this out if NINST_LND is greater than 1 (see: http://bugs.cgd.ucar.edu/show_bug.cgi?id=2521) -./xmlchange MPILIB=mpi-serial -./xmlchange ATM_DOMAIN_PATH=/glade/p/cesm/cseg/inputdata/lnd/clm2/PTCLMmydatafiles.c171024/1x1pt_US-UMB -./xmlchange LND_DOMAIN_PATH=/glade/p/cesm/cseg/inputdata/lnd/clm2/PTCLMmydatafiles.c171024/1x1pt_US-UMB -./xmlchange ATM_DOMAIN_FILE=domain.lnd.1x1pt_US-UMB_navy.171024.nc -./xmlchange LND_DOMAIN_FILE=domain.lnd.1x1pt_US-UMB_navy.171024.nc -./xmlchange --append CLM_BLDNML_OPTS='-mask navy -no-crop' -./xmlchange CALENDAR=GREGORIAN -./xmlchange DOUT_S=FALSE -./xmlchange ATM_NCPL=24 -./xmlchange RUN_STARTDATE=1999-01-01 -./xmlchange DATM_CLMNCEP_YR_ALIGN=1999 -./xmlchange DIN_LOC_ROOT=/glade/p/cesm/cseg/inputdata -./xmlchange DIN_LOC_ROOT_CLMFORC=/glade/p/cesm/cseg/inputdata/lnd/clm2/PTCLMmydatafiles.c171024 diff --git a/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm deleted file mode 100644 index 38ce400297..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ -! user_nl_clm namelist options written by PTCLMmkdata: -! ./PTCLMmkdata --cesm_root ../../../.. -s US-UMB -d /glade/p/cesm/cseg/inputdata --mydatadir=/glade/p/cesm/cseg/inputdata/lnd/clm2/PTCLMmydatafiles.c171024 - fsurdat = '/glade/p/cesm/cseg/inputdata/lnd/clm2/PTCLMmydatafiles.c171024/1x1pt_US-UMB/surfdata_1x1pt_US-UMB_16pfts_Irrig_CMIP6_simyr2000_c171024.nc' - hist_nhtfrq = 0 - hist_mfilt = 1200 diff --git a/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/shell_commands b/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/shell_commands deleted file mode 100644 index bfff1b36cd..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/shell_commands +++ /dev/null @@ -1,3 +0,0 @@ -./xmlchange DATM_MODE=CLMCRUNCEPv7 -./xmlchange BFBFLAG="TRUE" - diff --git a/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_clm deleted file mode 100644 index c7cfe279ee..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -use_lai_streams = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_datm b/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_datm deleted file mode 100644 index 6fb5f55ac4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_datm +++ /dev/null @@ -1 +0,0 @@ -bias_correct = 'BC.CRUNCEP.GPCP.Precip' diff --git a/cime_config/testdefs/testmods_dirs/clm/allActive/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/allActive/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/allActive/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/allActive/shell_commands b/cime_config/testdefs/testmods_dirs/clm/allActive/shell_commands deleted file mode 100644 index 9dc96f428b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/allActive/shell_commands +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# This namelist tests turning all points to 'active'; the point of -# this is to make sure that all points in memory could conceivably -# become active in a dynamic landunit run without causing any -# trouble. This should be tested with a _D test. - -# Note that we don't necessarily expect this to work with an initial -# conditions file that wasn't itself generated with all_active = -# .true., so we set CLM_FORCE_COLDSTART=on for this - -./xmlchange CLM_FORCE_COLDSTART="on" - diff --git a/cime_config/testdefs/testmods_dirs/clm/allActive/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/allActive/user_nl_clm deleted file mode 100644 index 0aec21699b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/allActive/user_nl_clm +++ /dev/null @@ -1,15 +0,0 @@ -! This namelist tests turning all points to 'active'; the point of -! this is to make sure that all points in memory could conceivably -! become active in a dynamic landunit run without causing any -! trouble. This should be tested with a _D test. - -! Note that we don't necessarily expect this to work with an initial -! conditions file that wasn't itself generated with all_active = -! .true., so we set CLM_FORCE_COLDSTART=on for this (in shell_commands) - -all_active = .true. - -! Also run urban landunits everywhere possible; while a bit different -! from all_active, this is a related idea, so we test it as part of the -! same test mod. -run_zero_weight_urban = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso/user_nl_clm deleted file mode 100644 index 0a40cd33a8..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ - use_c13 = .true. - use_c14 = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/include_user_mods deleted file mode 100644 index ce640345c5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../ciso diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/shell_commands b/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/shell_commands deleted file mode 100755 index fdc79af2de..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange RUN_STARTDATE=1963-01-01 diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm deleted file mode 100644 index 37b7c1ac3d..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm +++ /dev/null @@ -1,6 +0,0 @@ -use_c14_bombspike=.true. -use_c13_timeseries = .true. - -! This testmod is used in a long test, so change output frequency -hist_nhtfrq = 0,-240 -hist_mfilt = 1,1 diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_decStart/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso_decStart/include_user_mods deleted file mode 100644 index c9053f7b07..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_decStart/include_user_mods +++ /dev/null @@ -1,2 +0,0 @@ -../ciso -../decStart diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/user_nl_clm deleted file mode 100644 index 9db1957c1c..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/user_nl_clm +++ /dev/null @@ -1,4 +0,0 @@ - use_c13 = .true. - use_c14 = .true. - use_fun = .true. - use_flexibleCN = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/include_user_mods deleted file mode 100644 index ce640345c5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../ciso diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/user_nl_clm deleted file mode 100644 index b2a51bd5d5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ - hist_nhtfrq = 0,-240 - hist_mfilt = 1,1 diff --git a/cime_config/testdefs/testmods_dirs/clm/ciso_rtmColdSSP/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ciso_rtmColdSSP/include_user_mods deleted file mode 100644 index 7cded6662d..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ciso_rtmColdSSP/include_user_mods +++ /dev/null @@ -1,2 +0,0 @@ -../ciso -../rtmColdSSP diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/user_nl_clm deleted file mode 100644 index 588fa7d7a9..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc/user_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ -ndep_varlist = 'NDEP_month' -ndep_taxmode = 'cycle' -stream_fldfilename_ndep = '$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_simyr1850_0.9x1.25_CMIP6alpha01_c170330.nc' diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/include_user_mods deleted file mode 100644 index 0a64f1e6cc..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../clm50KitchenSink diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm deleted file mode 100644 index b2a51bd5d5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ - hist_nhtfrq = 0,-240 - hist_mfilt = 1,1 diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm deleted file mode 100644 index b99b882838..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm +++ /dev/null @@ -1,6 +0,0 @@ -limit_irrigation_if_rof_enabled = .false. -leaf_mr_vcm = 0.015d00 -use_bedrock = .true. -use_luna = .true. -use_flexibleCN = .true. -use_fun = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/README b/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/README deleted file mode 100644 index b570a324d1..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/README +++ /dev/null @@ -1 +0,0 @@ -Setting use_init_interp = .true. is currently needed for clm50 tests with crop. diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/include_user_mods deleted file mode 100644 index 02ec13743f..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../cropMonthOutput diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm deleted file mode 100644 index 44bf6a9457..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm +++ /dev/null @@ -1,6 +0,0 @@ -use_init_interp = .true. - -hist_fincl1 += 'QIRRIG_DEMAND' - -! Turn irrigation on -irrigate = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/user_nl_clm deleted file mode 100644 index e493c3e8e7..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ -use_dynroot = .true. -use_hydrstress = .false. diff --git a/cime_config/testdefs/testmods_dirs/clm/cmip6/README b/cime_config/testdefs/testmods_dirs/clm/cmip6/README deleted file mode 100644 index 40b90f9ce0..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cmip6/README +++ /dev/null @@ -1,6 +0,0 @@ -Note that this testmod directory includes cmip6_evolving_icesheet rather -than simply cmip6: cmip6_evolving_icesheet includes cmip6 and adds to -it. So, rather than having tests of the cmip6 usermods and separate -tests of cmip6_evolving_icesheet, it's more efficient to just have tests -of the cmip6_evolving_icesheet usermods directory, which then also cover -the cmip6 usermods directory. diff --git a/cime_config/testdefs/testmods_dirs/clm/cmip6/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/cmip6/include_user_mods deleted file mode 100644 index 7e8fa5ec83..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cmip6/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../../../../usermods_dirs/cmip6_evolving_icesheet diff --git a/cime_config/testdefs/testmods_dirs/clm/cmip6/shell_commands b/cime_config/testdefs/testmods_dirs/clm/cmip6/shell_commands deleted file mode 100644 index 33792ffaee..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cmip6/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -./xmlchange BFBFLAG="TRUE" - diff --git a/cime_config/testdefs/testmods_dirs/clm/cn_conly/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/cn_conly/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cn_conly/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/cn_conly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/cn_conly/user_nl_clm deleted file mode 100644 index 926e36cf39..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cn_conly/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ - suplnitro = 'ALL' diff --git a/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/README b/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/README deleted file mode 100644 index 566826ac8e..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/README +++ /dev/null @@ -1,23 +0,0 @@ -This testmod provides an finidat file compatible with the current model -configuration, at f09 resolution. - -This testmods directory is for running LII tests which compare the answers for a case where -initial condition interpolation is on (use_init_interp=T) to a case with it's off and ensures -they are exact. For the interpolated result to match uninterpolation, it needs to be a case that -essentially needs no interpolation so it's at the same resolution as the initial condition -file (finidat file). When surface datasets are changed, or the land-mask is changed, or an -important change is made to model physics (for example where new fields are added to the restart -file) -- you'll need to update the initial conditions file in this test (finidat file in -the user_nl_clm file). - -To update the initial conditions (finidat) file for this test: - -(1) Run the LII test; the 'base' case should run to completion even if the -no_interp test fails. - -(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata -space. Rename this to be similar to the name of the file pointed to in this -test's user_nl_clm file, but with a new creation date. - -(3) Update this the user_nl_clm file in this directory to point to the new -finidat file. diff --git a/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/user_nl_clm deleted file mode 100644 index dc3dedf6c4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/compatible_finidat_f09/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop.1366-01-01.0.9x1.25_gx1v6_simyr1850_c180424.nc' diff --git a/cime_config/testdefs/testmods_dirs/clm/cplhist/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/cplhist/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cplhist/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/cplhist/shell_commands b/cime_config/testdefs/testmods_dirs/clm/cplhist/shell_commands deleted file mode 100755 index f33e602348..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cplhist/shell_commands +++ /dev/null @@ -1,5 +0,0 @@ -./xmlchange DATM_CPLHIST_CASE=b.e20.B1850.f09_g17.pi_control.all.221.cplhist -./xmlchange DATM_CPLHIST_DIR=/glade/p/cesm/bgcwg_dev/forcing/b.e20.B1850.f09_g17.pi_control.all.221.cplhist/cpl/hist.mon -./xmlchange DATM_CPLHIST_YR_ALIGN=1 -./xmlchange DATM_CPLHIST_YR_END=84 -./xmlchange DATM_CPLHIST_YR_START=82 diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm deleted file mode 100644 index c70d3dba9e..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm +++ /dev/null @@ -1,8 +0,0 @@ - hist_fincl1 += 'GDD0', 'GDD8', 'GDD10', - 'GDD020', 'GDD820', 'GDD1020', - 'GDDPLANT', 'GDDTSOI', 'A5TMIN', 'A10TMIN' - -! The main point of including this field is to test the SUM history field infrastructure -! This is in the crop testmods because this field is mainly useful in transient crop runs -! This is on history tape 2 because this field is not meaningful at the gridcell level -hist_fincl2 += 'DYN_COL_SOIL_ADJUSTMENTS_C' diff --git a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands b/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands deleted file mode 100755 index 2a9f09bd75..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/include_user_mods deleted file mode 100644 index 23ea3745e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../crop diff --git a/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm deleted file mode 100644 index b2a51bd5d5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ - hist_nhtfrq = 0,-240 - hist_mfilt = 1,1 diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/decStart/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart/shell_commands b/cime_config/testdefs/testmods_dirs/clm/decStart/shell_commands deleted file mode 100755 index f3e89bb4fa..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange RUN_STARTDATE=2001-12-30 -./xmlchange CLM_BLDNML_OPTS=-ignore_warnings --append diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism b/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism deleted file mode 100644 index 85f5789000..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism +++ /dev/null @@ -1,9 +0,0 @@ -! The need for this is subtle. The problem is that this decStart testmod is used in short -! (multi-day) ERP tests, whose length is such that the end of the year occurs in the -! initial run but not in the restart run. Without setting history_option = 'coupler', this -! would mean that CISM outputs a history file in the initial run but not in the restart -! run, which causes the test to fail because the test system requires any component's -! final history file in one case to have a counterpart in the other case. Setting -! history_option = 'coupler' forces CISM to output a history file only at the end of the -! run. -history_option = 'coupler' diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/README b/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/README deleted file mode 100644 index 102dd97840..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/README +++ /dev/null @@ -1,8 +0,0 @@ -This testmods directory was created for the sake of the smallville transient -test case. We need to use a cold-start to avoid this error message: - -ERROR : CLM build-namelist::CLMBuildNamelist::setup_logic_initial_conditions() : -using ignore_ic_date is incompatable with crop! - -Once the above problem is fixed, we should stop doing a coldstart in this -testmods diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/shell_commands b/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/shell_commands deleted file mode 100755 index 006ef22a12..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange RUN_STARTDATE=1851-12-30 -./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm deleted file mode 100644 index 0c98d81ff0..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ -lower_boundary_condition = 2 -soil_layerstruct = '49SL_10m' -use_bedrock = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/default/shell_commands b/cime_config/testdefs/testmods_dirs/clm/default/shell_commands deleted file mode 100644 index adebdc5743..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/default/shell_commands +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -./xmlchange CLM_BLDNML_OPTS="-fire_emis" --append -./xmlchange BFBFLAG="TRUE" - diff --git a/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm deleted file mode 100644 index 6b0ba531b7..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm +++ /dev/null @@ -1,27 +0,0 @@ - wrtdia = .true. - hist_dov2xy = .true.,.false. -! Even though only 2 history tapes are defined here, set ndens to 1 for up to 6 history -! tapes, for the sake of mods that extend these default mods and may add other history tapes - hist_ndens = 1,1,1,1,1,1 - hist_nhtfrq =-24,-8 - hist_mfilt = 1,1 - hist_fincl1 = 'TRAFFICFLUX', 'SNOWLIQ:A','SNOWICE:A' -! Add FCO2 because few (if any) tests send this flux to the coupler, so it isn't checked via cpl hist files - hist_fincl1 += 'FCO2' - hist_fincl2 = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TSA_U', 'TSA_R', - 'TREFMNAV_U', 'TREFMNAV_R', - 'TREFMXAV_U', 'TREFMXAV_R', - 'TG_U', 'TG_R', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF_U', 'QRUNOFF_R', - 'SoilAlpha_U', - 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT' - - diff --git a/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/shell_commands b/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/shell_commands deleted file mode 100755 index ecd6d46239..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange CLM_BLDNML_OPTS='-drydep -no-megan' -append diff --git a/cime_config/testdefs/testmods_dirs/clm/fatesFire/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/fatesFire/include_user_mods deleted file mode 100644 index fb35ec8c90..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/fatesFire/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../fates diff --git a/cime_config/testdefs/testmods_dirs/clm/fatesFire/shell_commands b/cime_config/testdefs/testmods_dirs/clm/fatesFire/shell_commands deleted file mode 100644 index d81ed7dbc5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/fatesFire/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange CLM_BLDNML_OPTS="-no-megan" --append diff --git a/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm deleted file mode 100644 index e3a3b76d71..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/fatesFire/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ -use_fates_spitfire = .true. - diff --git a/cime_config/testdefs/testmods_dirs/clm/fire_emis/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/fire_emis/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/fire_emis/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm deleted file mode 100644 index 3f5749e61f..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm +++ /dev/null @@ -1,33 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! Include namelist variables for drv_flds_in ONLY if -megan and/or -drydep options -! are set in the CLM_NAMELIST_OPTS env variable. -! -! EXCEPTIONS: -! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set glc_grid with CISM_GRID option -! Set maxpatch_glcmec with GLC_NEC option -!---------------------------------------------------------------------------------- - - hist_mfilt = 1,30 - hist_nhtfrq = 0,-24 - hist_avgflag_pertape = 'A','A' - hist_fincl1 = 'M_LEAFC_TO_FIRE','M_LEAFC_STORAGE_TO_FIRE','M_LEAFC_XFER_TO_FIRE','M_LIVESTEMC_TO_FIRE', - 'M_LIVESTEMC_STORAGE_TO_FIRE','M_LIVESTEMC_XFER_TO_FIRE','M_DEADSTEMC_TO_FIRE','M_DEADSTEMC_STORAGE_TO_FIRE', - 'M_DEADSTEMC_XFER_TO_FIRE','M_FROOTC_TO_FIRE','M_FROOTC_STORAGE_TO_FIRE','M_FROOTC_XFER_TO_FIRE', - 'M_LIVEROOTC_TO_FIRE','M_LIVEROOTC_STORAGE_TO_FIRE','M_LIVEROOTC_XFER_TO_FIRE','M_DEADROOTC_TO_FIRE', - 'M_DEADROOTC_STORAGE_TO_FIRE','M_DEADROOTC_XFER_TO_FIRE','M_GRESP_STORAGE_TO_FIRE','M_GRESP_XFER_TO_FIRE', - 'FireEmis_ZTOP','FireEmis_TOT','FireComp_BC','FireComp_OC','FireComp_SO2','FireMech_bc_a1','FireMech_pom_a1','FireMech_SO2', - hist_fincl2 = 'M_LEAFC_TO_FIRE','M_LEAFC_STORAGE_TO_FIRE','M_LEAFC_XFER_TO_FIRE','M_LIVESTEMC_TO_FIRE', - 'M_LIVESTEMC_STORAGE_TO_FIRE','M_LIVESTEMC_XFER_TO_FIRE','M_DEADSTEMC_TO_FIRE','M_DEADSTEMC_STORAGE_TO_FIRE', - 'M_DEADSTEMC_XFER_TO_FIRE','M_FROOTC_TO_FIRE','M_FROOTC_STORAGE_TO_FIRE','M_FROOTC_XFER_TO_FIRE', - 'M_LIVEROOTC_TO_FIRE','M_LIVEROOTC_STORAGE_TO_FIRE','M_LIVEROOTC_XFER_TO_FIRE','M_DEADROOTC_TO_FIRE', - 'M_DEADROOTC_STORAGE_TO_FIRE','M_DEADROOTC_XFER_TO_FIRE','M_GRESP_STORAGE_TO_FIRE','M_GRESP_XFER_TO_FIRE', - 'FireEmis_ZTOP','FireEmis_TOT','FireComp_BC','FireComp_OC','FireComp_SO2','FireMech_bc_a1','FireMech_pom_a1','FireMech_SO2' - fire_emis_elevated=.false. diff --git a/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/user_nl_clm deleted file mode 100644 index 8d82dc726b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/user_nl_clm +++ /dev/null @@ -1,4 +0,0 @@ - use_flexibleCN = .true. - use_luna = .false. - use_fun = .true. - diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_clm deleted file mode 100644 index 0ba5e4892b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_clm +++ /dev/null @@ -1,4 +0,0 @@ -! add some special history fields: multi-layer snow fields, and a per-column forcing field - hist_fincl1 += 'SNO_EXISTENCE', 'SNO_ABS', 'SNO_T:M', 'SNO_GS:X', 'QICE_FORC' -! similarly, add a glc-specific field to the second history tape - hist_fincl2 += 'QICE' diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README deleted file mode 100644 index 2e8fcfc52e..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README +++ /dev/null @@ -1,4 +0,0 @@ -This testmods directory switches some glc_mec-related flags in CLM, in order to -test different branches than are tested with the default options. - -It also turns off the feedback from CISM to CLM, to test that option. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/shell_commands b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/shell_commands deleted file mode 100644 index 404b22b006..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange GLC_TWO_WAY_COUPLING=FALSE diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm deleted file mode 100644 index cbb67daeef..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ - glcmec_downscale_longwave = .false. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/README deleted file mode 100644 index 9d54f93b87..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/README +++ /dev/null @@ -1,2 +0,0 @@ -This testmods directory is like the standard glcMEC testmods directory, except -it forces a quick decrease in glacier area, along with rearranging the columns. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_cism b/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_cism deleted file mode 100644 index 9564455a56..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_cism +++ /dev/null @@ -1,6 +0,0 @@ -! For this test, we do a decrease in glacier area, along with rearranging the columns; -enable_frac_overrides = .true. -decrease_override_delay = 1 -rearrange_override_delay = 1 -decrease_frac = 0.04 -rearrange_freq = 3 diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_clm deleted file mode 100644 index c2bebaabd5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -for_testing_allow_non_annual_changes = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/README deleted file mode 100644 index 1833bf6a8c..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/README +++ /dev/null @@ -1,2 +0,0 @@ -This testmods directory is like the standard glcMEC testmods directory, except -it forces a quick increas in glacier area. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_cism b/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_cism deleted file mode 100644 index de96a8545a..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_cism +++ /dev/null @@ -1,4 +0,0 @@ -! For this test, we do an increase in glacier area; -enable_frac_overrides = .true. -increase_override_delay = 1 -increase_frac = 0.5 diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_clm deleted file mode 100644 index c2bebaabd5..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -for_testing_allow_non_annual_changes = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/README deleted file mode 100644 index 9934bd02d9..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory is similar to the glcMEC testmods directory, but is intended for -long (e.g., multi-year) runs. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/user_nl_clm deleted file mode 100644 index dd99ceba50..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ - hist_nhtfrq =0,0 - hist_mfilt = 1,12 diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README deleted file mode 100644 index ec74e38b4c..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README +++ /dev/null @@ -1,34 +0,0 @@ -This testmods directory is for running LII tests which compare the answers for a case where -initial condition interpolation is on (use_init_interp=T) to a case with it's off and ensures -they are exact. For the interpolated result to match uninterpolation, it needs to be a case that -essentially needs no interpolation so it's at the same resolution as the initial condition -file (finidat file). When surface datasets are changed, or the land-mask is changed, or an -important change is made to model physics (for example where new fields are added to the restart -file) -- you'll need to update the initial conditions file in this test (finidat file in -the user_nl_clm file). - -This testmods also turns off the glc two-way coupling. This is done so that -glacier areas are taken from the restart file rather than from -CISM. This is partly so that changes in CISM don't affect the test -results, but more importantly so that LII tests can pass even if CISM -changes. (GLC two-way coupling was off in the generation of the -initial conditions file used here, too.) (4-24-18: I *think* we'll be -able to turn two-way coupling on once -https://github.com/ESCOMP/ctsm/issues/340 is resolved, though I'm not -positive about that. However, if -https://github.com/ESMCI/cime/issues/2484 is done, then we'd need this -testmods to turn off comparison of cpl initial hist files if we have -two-way coupling on, since areas will differ in initialization between -the two cases.) - -To update the initial conditions (finidat) file for this test: - -(1) Run the LII test; the 'base' case should run to completion even if the -no_interp test fails. - -(2) Copy the finidat_interp_dest.nc file from the 'base' case to the inputdata -space. Rename this to be similar to the name of the file pointed to in this -test's user_nl_clm file, but with a new creation date. - -(3) Update this the user_nl_clm file in this directory to point to the new -finidat file. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands deleted file mode 100755 index 404b22b006..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands +++ /dev/null @@ -1 +0,0 @@ -./xmlchange GLC_TWO_WAY_COUPLING=FALSE diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm deleted file mode 100644 index c269a24911..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ -! See more notes in the README file in this directory and in the comments in the test list. -! -! Initial condition file at the desired configuration to run, so can verify that interpolating from it gives the same result -! Note that this was generated with GLC_TWO_WAY_COUPLING=FALSE -finidat = '$DIN_LOC_ROOT/lnd/clm2/initdata_map/clmi.I2000Clm50BgcCrop.2000-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180306.nc' diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/README b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/README deleted file mode 100644 index f6c97e00e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/README +++ /dev/null @@ -1,12 +0,0 @@ -In this test, glaciers: -- increase to 100% over 4 days -- then stay constant for 4 days -- then decrease to 0% over 4 days - -This also includes some extra bgc fields on the history file, because this test -is meant to be used to test bgc evolution as glaciers grow and shrink. - -This also ensures that spun-up initial conditions are used, in order to provide a more -reasonable test of BGC state variable evolution with dynamic landunits. With a -cold start run, the state variables are evolving so fast that it's hard to see -the effects of dynamic landunits. diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/include_user_mods deleted file mode 100644 index 1730b6b7cf..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../glcMEC diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_cism b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_cism deleted file mode 100644 index 130c2d9d94..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_cism +++ /dev/null @@ -1,4 +0,0 @@ -enable_frac_overrides = .true. -increase_frac = 0.25 -decrease_override_delay = 8 -decrease_frac = 0.25 diff --git a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm deleted file mode 100644 index 9ebe31d8e9..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm +++ /dev/null @@ -1,26 +0,0 @@ -for_testing_allow_non_annual_changes = .true. - -! Add 1-d output for all variables that are conserved with dynamic landunits -! -! Most of these are already on the primary history tape; for those that aren't, we add -! them to the primary history tape, too -! -! Variables in CNVegCarbonStateType -hist_fincl2 += 'SEEDC' -! Variables in CNVegNitrogenStateType -hist_fincl2 += 'SEEDN' -! Variables in SoilBiogeochemCarbonStateType (note that TOTSOMC is taken to be a -! representative sample of the conserved variable decomp_cpools_vr_col) -hist_fincl2 += 'TOTSOMC', 'COL_CTRUNC' -! Variables in SoilBiogeochemNitrogenStateType (note that TOTSOMN is taken to be -! a representative sample of the conserved variable decomp_npools_vr_col) -hist_fincl2 += 'TOTSOMN', 'COL_NTRUNC', 'SMINN', 'SMIN_NO3', 'SMIN_NH4' -! Variables in ch4Mod -hist_wrtch4diag = .true. -hist_fincl1 += 'CONC_CH4_SAT', 'CONC_CH4_UNSAT' -hist_fincl2 += 'FINUNDATED', 'FINUNDATED_LAG', 'LAYER_SAT_LAG', - 'CONC_CH4_SAT', 'CONC_CH4_UNSAT', - 'CONC_O2_SAT', 'CONC_O2_UNSAT', - 'TOTCOLCH4' - - diff --git a/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/include_user_mods deleted file mode 100644 index 2596fa3cb3..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../reduceOutput diff --git a/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/shell_commands b/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/shell_commands deleted file mode 100644 index 33792ffaee..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -./xmlchange BFBFLAG="TRUE" - diff --git a/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm deleted file mode 100644 index ee85bb983a..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm +++ /dev/null @@ -1,11 +0,0 @@ -hist_fincl1 += 'QIRRIG','QIRRIG_DEMAND' -hist_fincl2 += 'QIRRIG' -hist_dov2xy = .true.,.false. -hist_nhtfrq = 0, -8760 -hist_mfilt = 1,1 - -! In contrast to the standard reduceOutput, use double-precision -hist_ndens = 1,1 - -! Turn irrigation on -irrigate = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/README b/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/README deleted file mode 100644 index 2e7fcbeba6..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/README +++ /dev/null @@ -1,3 +0,0 @@ -This testmods directory turns on both irrigation and ozone. These two options -are unrelated, but are simply combined for convenience (so we can turn on a -number of things with a single test). diff --git a/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/include_user_mods deleted file mode 100644 index af6f0ed80d..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../irrigOn_reduceOutput diff --git a/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/user_nl_clm deleted file mode 100644 index 937cd64717..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/user_nl_clm +++ /dev/null @@ -1,6 +0,0 @@ -! explicitly include stuff needed for o3 here rather than including the o3 directory, -! since the o3 directory includes default, and we don't want that for this -! reducedOutput testmod -use_ozone = .true. -hist_fincl1 += 'O3UPTAKESUN', 'O3UPTAKESHA' -hist_fincl2 += 'O3UPTAKESUN', 'O3UPTAKESHA' diff --git a/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/README b/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/README deleted file mode 100644 index 316aabe6df..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/README +++ /dev/null @@ -1,4 +0,0 @@ -This tests irrigation using spun-up initial conditions. - -We currently don't have out-of-the-box initial conditions with irrigation on, so -we explicitly point to an initial conditions file for this test. diff --git a/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/include_user_mods deleted file mode 100644 index 23ea3745e6..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../crop diff --git a/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm deleted file mode 100644 index 44bf6a9457..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm +++ /dev/null @@ -1,6 +0,0 @@ -use_init_interp = .true. - -hist_fincl1 += 'QIRRIG_DEMAND' - -! Turn irrigation on -irrigate = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/luna/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/luna/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/luna/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/luna/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/luna/user_nl_clm deleted file mode 100644 index cbfbb9f525..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/luna/user_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ - use_luna = .true. - use_flexibleCN = .false. - diff --git a/cime_config/testdefs/testmods_dirs/clm/monthly/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/monthly/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/monthly/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_clm deleted file mode 100644 index a6ac15b7f0..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ -! Change hist frequency to something more appropriate for long tests, and add some snow -! fields in order to test those history fields - hist_nhtfrq = 0,-240 - hist_mfilt = 1,1 - hist_fincl1 += 'SNO_EXISTENCE', 'SNO_ABS', 'SNO_T:M', 'SNO_GS:X' diff --git a/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_cpl b/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_cpl deleted file mode 100644 index 3771552f9a..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_cpl +++ /dev/null @@ -1 +0,0 @@ -budget_inst = 1 diff --git a/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/include_user_mods deleted file mode 100644 index 399579f425..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../monthly diff --git a/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/shell_commands b/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/shell_commands deleted file mode 100755 index 30c088bf92..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -# This is useful for testing cases that are not set up with -# out-of-the-box initial conditions files, and would fail if -# a Cold start wasn't being done -./xmlchange CLM_FORCE_COLDSTART="on" diff --git a/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/user_nl_clm deleted file mode 100644 index b646c244ea..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/user_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ -use_flexibleCN = .true. -use_luna = .false. -use_fun = .false. diff --git a/cime_config/testdefs/testmods_dirs/clm/no_vector_output/README b/cime_config/testdefs/testmods_dirs/clm/no_vector_output/README deleted file mode 100644 index 055ad0b8b1..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/no_vector_output/README +++ /dev/null @@ -1,2 +0,0 @@ -This testmod is similar to the default test mod, but it empties out the 2nd -history tape, which is the vector-output tape. diff --git a/cime_config/testdefs/testmods_dirs/clm/no_vector_output/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/no_vector_output/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/no_vector_output/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/no_vector_output/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/no_vector_output/user_nl_clm deleted file mode 100644 index 773d3738d9..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/no_vector_output/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -hist_fincl2 = ' ' diff --git a/cime_config/testdefs/testmods_dirs/clm/nofire/shell_commands b/cime_config/testdefs/testmods_dirs/clm/nofire/shell_commands deleted file mode 100644 index fe06fd1042..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/nofire/shell_commands +++ /dev/null @@ -1,5 +0,0 @@ - -./xmlchange CLM_BLDNML_OPTS="-no-fire_emis" --append -./xmlchange BFBFLAG="TRUE" - - diff --git a/cime_config/testdefs/testmods_dirs/clm/nofire/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/nofire/user_nl_clm deleted file mode 100644 index e6e4f8f843..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/nofire/user_nl_clm +++ /dev/null @@ -1,26 +0,0 @@ - wrtdia = .true. - hist_dov2xy = .true.,.false. -! Even though only 2 history tapes are defined here, set ndens to 1 for up to 6 history -! tapes, for the sake of mods that extend these default mods and may add other history tapes - hist_ndens = 1,1,1,1,1,1 - fire_method = 'nofire' - hist_nhtfrq =-24,-8 - hist_mfilt = 1,1 - hist_fincl1 = 'TRAFFICFLUX', 'SNOWLIQ:A','SNOWICE:A' - hist_fincl2 = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TSA_U', 'TSA_R', - 'TREFMNAV_U', 'TREFMNAV_R', - 'TREFMXAV_U', 'TREFMXAV_R', - 'TG_U', 'TG_R', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF_U', 'QRUNOFF_R', - 'SoilAlpha_U', - 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT' - - diff --git a/cime_config/testdefs/testmods_dirs/clm/o3/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/o3/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/o3/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/o3/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/o3/user_nl_clm deleted file mode 100644 index a80360aaa0..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/o3/user_nl_clm +++ /dev/null @@ -1,2 +0,0 @@ - use_ozone = .true. - hist_fincl2 += 'O3UPTAKESUN', 'O3UPTAKESHA' diff --git a/cime_config/testdefs/testmods_dirs/clm/oldhyd/shell_commands b/cime_config/testdefs/testmods_dirs/clm/oldhyd/shell_commands deleted file mode 100644 index e2a2ce67e3..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/oldhyd/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange BFBFLAG="TRUE" - diff --git a/cime_config/testdefs/testmods_dirs/clm/oldhyd/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/oldhyd/user_nl_clm deleted file mode 100644 index 8e8f3b73fc..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/oldhyd/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ - hist_ndens = 1,1 - oldfflag = 1 - h2osfcflag = 0 - origflag = 1 - subgridflag = 0 diff --git a/cime_config/testdefs/testmods_dirs/clm/pauseResume/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/pauseResume/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/pauseResume/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/pauseResume/shell_commands b/cime_config/testdefs/testmods_dirs/clm/pauseResume/shell_commands deleted file mode 100644 index 4b6f8faeea..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/pauseResume/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -# Test PAUSE/RESUME functionality which is used for Data Assimulation (DA) -./xmlchange LND_PAUSE_ACTIVE=TRUE -# Set calendar, just because Gregorian is ussually used for DA -./xmlchange CALENDAR=GREGORIAN diff --git a/cime_config/testdefs/testmods_dirs/clm/pts/README b/cime_config/testdefs/testmods_dirs/clm/pts/README deleted file mode 100644 index 30d71a7c8b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/pts/README +++ /dev/null @@ -1,5 +0,0 @@ -This testmods directory should not be used directly. Instead, it should be -extended (i.e., included) by a mods directory that defines the point to run -over - something like: - -./xmlchange PTS_LAT=42,PTS_LON=260 diff --git a/cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands b/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands deleted file mode 100644 index ad140e45e1..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands +++ /dev/null @@ -1,24 +0,0 @@ -./xmlchange PTS_MODE=TRUE -./xmlchange ATM_NX=0 -./xmlchange ATM_NY=0 -./xmlchange LND_NX=0 -./xmlchange LND_NY=0 -./xmlchange ICE_NX=0 -./xmlchange ICE_NY=0 -./xmlchange OCN_NX=0 -./xmlchange OCN_NY=0 -./xmlchange ROF_NX=0 -./xmlchange ROF_NY=0 -./xmlchange GLC_NX=0 -./xmlchange GLC_NY=0 -./xmlchange WAV_NX=0 -./xmlchange WAV_NY=0 -./xmlchange NTASKS_ATM=1 -./xmlchange NTASKS_LND=1 -./xmlchange NTASKS_ICE=1 -./xmlchange NTASKS_OCN=1 -./xmlchange NTASKS_CPL=1 -./xmlchange NTASKS_GLC=1 -./xmlchange NTASKS_ROF=1 -./xmlchange NTASKS_WAV=1 -./xmlchange NTASKS_ESP=1 diff --git a/cime_config/testdefs/testmods_dirs/clm/ptsRLA/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ptsRLA/include_user_mods deleted file mode 100644 index cdb9d9f000..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ptsRLA/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../pts diff --git a/cime_config/testdefs/testmods_dirs/clm/ptsRLA/shell_commands b/cime_config/testdefs/testmods_dirs/clm/ptsRLA/shell_commands deleted file mode 100644 index 48287a2998..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ptsRLA/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange PTS_LAT=42,PTS_LON=260 -./xmlchange --force CLM_FORCE_COLDSTART=on diff --git a/cime_config/testdefs/testmods_dirs/clm/ptsRLB/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ptsRLB/include_user_mods deleted file mode 100644 index cdb9d9f000..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ptsRLB/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../pts diff --git a/cime_config/testdefs/testmods_dirs/clm/ptsRLB/shell_commands b/cime_config/testdefs/testmods_dirs/clm/ptsRLB/shell_commands deleted file mode 100644 index 15fd1cced4..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ptsRLB/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange PTS_LAT=-5,PTS_LON=290 -./xmlchange --force CLM_FORCE_COLDSTART=on diff --git a/cime_config/testdefs/testmods_dirs/clm/ptsROA/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/ptsROA/include_user_mods deleted file mode 100644 index cdb9d9f000..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ptsROA/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../pts diff --git a/cime_config/testdefs/testmods_dirs/clm/ptsROA/shell_commands b/cime_config/testdefs/testmods_dirs/clm/ptsROA/shell_commands deleted file mode 100644 index d5be09e860..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/ptsROA/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange PTS_LAT=30,PTS_LON=315 -./xmlchange --force CLM_FORCE_COLDSTART=on diff --git a/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/shell_commands b/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/shell_commands deleted file mode 100644 index f7e0817ca2..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -./xmlchange CLM_BLDNML_OPTS="-light_res 360x720" --append -./xmlchange BFBFLAG="TRUE" diff --git a/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/user_nl_datm b/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/user_nl_datm deleted file mode 100644 index c88c84629e..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/user_nl_datm +++ /dev/null @@ -1 +0,0 @@ -iradsw = -1 diff --git a/cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands b/cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands deleted file mode 100644 index 350466ae70..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# -# # Use SUBSET rearranger on hobart -if [ `hostname` == "hobart" ]; then - ./xmlchange LND_PIO_REARRANGER=2 -fi -./xmlchange BFBFLAG="TRUE" diff --git a/cime_config/testdefs/testmods_dirs/clm/reduceOutput/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/reduceOutput/user_nl_clm deleted file mode 100644 index 3d94564c47..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/reduceOutput/user_nl_clm +++ /dev/null @@ -1,12 +0,0 @@ -hist_empty_htapes = .true. -hist_fincl1 = 'SNOWLIQ','SNOWICE' , - 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TG', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF' diff --git a/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/user_nl_clm deleted file mode 100644 index c1c5ffe8d0..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/user_nl_clm +++ /dev/null @@ -1,8 +0,0 @@ - reseed_dead_plants = .true. - reset_snow = .true. - reset_snow_glc = .true. - - ! 1774 m was chosen by Leo van Kampenhout, based on the SMB field from the RACMO 2.3 - ! regional climate model, period 1960-1989. The elevation corresponds to the highest point - ! on the contiguous Greenland ice sheet (GrIS) where SMB <= 1 mmWE/yr - reset_snow_glc_ela = 1774. diff --git a/cime_config/testdefs/testmods_dirs/clm/rootlit/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/rootlit/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/rootlit/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/rootlit/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/rootlit/user_nl_clm deleted file mode 100644 index 53d20a3a97..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/rootlit/user_nl_clm +++ /dev/null @@ -1,3 +0,0 @@ - use_vertsoilc = .false. - anoxia = .true. - hist_wrtch4diag = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/user_nl_rtm b/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/user_nl_rtm deleted file mode 100644 index d1a0254a0b..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/user_nl_rtm +++ /dev/null @@ -1,4 +0,0 @@ -finidat_rtm = " " -rtmhist_mfilt = 1 -rtmhist_ndens = 2 -rtmhist_nhtfrq = 0 diff --git a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods deleted file mode 100644 index 399579f425..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../monthly diff --git a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm deleted file mode 100644 index e7500fff58..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm +++ /dev/null @@ -1,4 +0,0 @@ -nlevsno = 3 - -! Need to set use_init_interp because initial conditions file has 5 snow layers -use_init_interp = .true. diff --git a/cime_config/testdefs/testmods_dirs/clm/vrtlay/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/vrtlay/include_user_mods deleted file mode 100644 index fe0e18cf88..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/vrtlay/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../default diff --git a/cime_config/testdefs/testmods_dirs/clm/vrtlay/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/vrtlay/user_nl_clm deleted file mode 100644 index cccaf2abf2..0000000000 --- a/cime_config/testdefs/testmods_dirs/clm/vrtlay/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -soil_layerstruct = '23SL_3.5m' diff --git a/cime_config/user_nl_clm b/cime_config/user_nl_clm deleted file mode 100644 index a4cfe51182..0000000000 --- a/cime_config/user_nl_clm +++ /dev/null @@ -1,22 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig .true. setting -! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! or with CLM_FORCE_COLDSTART to do a cold start -! or set it with an explicit filename here. -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- - diff --git a/cime_config/usermods_dirs/cmip6/include_user_mods b/cime_config/usermods_dirs/cmip6/include_user_mods deleted file mode 100644 index 012ab60771..0000000000 --- a/cime_config/usermods_dirs/cmip6/include_user_mods +++ /dev/null @@ -1,2 +0,0 @@ -../cmip6_glaciers -../cmip6_output diff --git a/cime_config/usermods_dirs/cmip6_evolving_icesheet/include_user_mods b/cime_config/usermods_dirs/cmip6_evolving_icesheet/include_user_mods deleted file mode 100644 index d8d7dacfae..0000000000 --- a/cime_config/usermods_dirs/cmip6_evolving_icesheet/include_user_mods +++ /dev/null @@ -1 +0,0 @@ -../cmip6 diff --git a/cime_config/usermods_dirs/cmip6_evolving_icesheet/user_nl_clm b/cime_config/usermods_dirs/cmip6_evolving_icesheet/user_nl_clm deleted file mode 100644 index 193f0624e7..0000000000 --- a/cime_config/usermods_dirs/cmip6_evolving_icesheet/user_nl_clm +++ /dev/null @@ -1 +0,0 @@ -hist_fincl4 += 'ICE_MODEL_FRACTION' diff --git a/cime_config/usermods_dirs/cmip6_glaciers/user_nl_clm b/cime_config/usermods_dirs/cmip6_glaciers/user_nl_clm deleted file mode 100644 index 4963c4945a..0000000000 --- a/cime_config/usermods_dirs/cmip6_glaciers/user_nl_clm +++ /dev/null @@ -1,5 +0,0 @@ - -! This differs from the default in that it turns on virtual columns over Antarctica -! This is desired so that we have the output needed to drive a later offline CISM Antarctica simulation -! However, this increases the cost of CLM by about 10% -glacier_region_behavior = 'single_at_atm_topo', 'virtual', 'virtual', 'virtual' diff --git a/cime_config/usermods_dirs/cmip6_output/README b/cime_config/usermods_dirs/cmip6_output/README deleted file mode 100644 index f073548a51..0000000000 --- a/cime_config/usermods_dirs/cmip6_output/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory turns on a variety of extra output fields that are desired for -cmip6 runs. - -To use these mods, you must be using a configuration with CLM50%BGC-CROP using -glc_mec (which is the standard cmip6 configuration). diff --git a/cime_config/usermods_dirs/cmip6_output/shell_commands b/cime_config/usermods_dirs/cmip6_output/shell_commands deleted file mode 100644 index d742a80f83..0000000000 --- a/cime_config/usermods_dirs/cmip6_output/shell_commands +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -./xmlchange CCSM_BGC=CO2A - diff --git a/cime_config/usermods_dirs/cmip6_output/user_nl_clm b/cime_config/usermods_dirs/cmip6_output/user_nl_clm deleted file mode 100644 index 5c9890a64f..0000000000 --- a/cime_config/usermods_dirs/cmip6_output/user_nl_clm +++ /dev/null @@ -1,77 +0,0 @@ -!---------------------------------------------------------------------------------- -! Users should add all user specific namelist changes below in the form of -! namelist_var = new_namelist_value -! -! EXCEPTIONS: -! Set use_cndv by the compset you use and the CLM_BLDNML_OPTS -dynamic_vegetation setting -! Set use_vichydro by the compset you use and the CLM_BLDNML_OPTS -vichydro setting -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting -! Set use_crop by the compset you use and CLM_BLDNML_OPTS -crop setting -! Set spinup_state by the CLM_BLDNML_OPTS -bgc_spinup setting -! Set irrigate by the CLM_BLDNML_OPTS -irrig setting -! Set co2_ppmv with CCSM_CO2_PPMV option -! Set dtime with L_NCPL option -! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options -! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases -! (includes $inst_string for multi-ensemble cases) -! Set maxpatch_glcmec with GLC_NEC option -! Set glc_do_dynglacier with GLC_TWO_WAY_COUPLING env variable -!---------------------------------------------------------------------------------- - -! h0 stream (monthly average, gridcell-level) -! Emon, Lmon, LIMon -hist_fexcl1 = 'PCT_CFT', 'PCT_GLC_MEC', 'SOIL1C_vr', 'SOIL1N_vr', 'SOIL2C_vr', 'SOIL2N_vr', 'SOIL3C_vr', 'SOIL3N_vr', 'CWDC_vr', -'LITR1C_vr', 'LITR2C_vr', 'LITR3C_vr', 'LITR1N_vr', 'LITR2N_vr', 'LITR3N_vr','CWDN_vr', -'PCT_NAT_PFT','SMIN_NO3_vr','CONC_O2_UNSAT', 'CONC_O2_SAT','SMIN_NH4_vr','SMINN_vr' - -! h0 stream ICE variables and other variables inactive by default (monthly average, gridcell-level) -! Emon, Lmon, LIMon -hist_fincl1 = 'EFLX_LH_TOT_ICE', 'FIRE_ICE', 'FLDS_ICE', 'FSH_ICE', 'FSNO_ICE', 'FSR_ICE', -'QFLX_SUB_SNOW_ICE', 'QRUNOFF_ICE', 'QSNOFRZ_ICE', 'QSNOMELT_ICE', 'RAIN_ICE', 'SNOW_ICE', -'SNOWICE_ICE', 'SNOWLIQ_ICE', 'SNOTXMASS_ICE', 'TG_ICE', 'TOPO_COL_ICE', 'TSA_ICE', 'TSOI_ICE', -'LEAFC_TO_LITTER', 'FROOTC_TO_LITTER','LITR1C_TO_SOIL1C','LITR1N_TO_SOIL1N','LITR2C_TO_SOIL1C', -'LITR2N_TO_SOIL1N','LITR3C_TO_SOIL2C','LITR3N_TO_SOIL2N','DWT_WOOD_PRODUCTC_GAIN_PATCH' - -! h1 stream (monthly average, finest sub-grid) -! Emon, Lmon -hist_fincl2 = 'GPP', 'NPP', 'AGNPP', 'TLAI', 'TOTVEGC', 'TSA','TREFMNAV','TREFMXAV', 'BTRANMN', 'NPP_NUPTAKE', 'GRAINC_TO_FOOD', -'Vcmx25Z', 'FSH', 'NFERTILIZATION', 'AR', 'VEGWP', 'FCTR', 'FCEV', 'FGEV', 'FIRE', 'FSR', 'HTOP', -'FIRA', 'FSA', 'HR', 'GSSUNLN', 'GSSHALN', 'TSKIN' - -! h2 stream (monthly average, landunit-level) -! Emon -! TOT_WOODPRODC:I, CROPPROD1C:I, and NEE are not available at the landunit level -hist_fincl3 = 'FSR', 'H2OSNO', 'Q2M', 'SNOWDP', 'TSA', 'TREFMNAV', 'TREFMXAV', 'TG', 'QRUNOFF', 'FSH', 'FIRE', 'FIRA', 'FGR', -'EFLX_LH_TOT', 'RH2M', 'TLAI', 'GPP', 'NPP', 'SOILWATER_10CM', 'TOTSOILLIQ', 'TOTSOILICE', 'AR', 'HR', 'DWT_CONV_CFLUX_PATCH', -'WOOD_HARVESTC', 'U10', 'DWT_WOOD_PRODUCTC_GAIN_PATCH', 'GRAINC_TO_FOOD', 'SLASH_HARVESTC', 'TSOI_10CM', 'COL_FIRE_CLOSS', -'DWT_SLASH_CFLUX', 'QIRRIG', 'URBAN_HEAT', 'WASTEHEAT', 'HTOP', 'TSKIN', 'FROOTC:I' - -! h3 stream (yearly average, gridcell-level) -! Eyr -hist_fincl4 = 'PCT_CFT', 'PCT_GLC_MEC', 'SOIL1C_vr', 'SOIL1N_vr', 'SOIL2C_vr', 'SOIL2N_vr', 'SOIL3C_vr', 'SOIL3N_vr', 'CWDC_vr', -'LITR1C_vr', 'LITR2C_vr', 'LITR3C_vr', 'LITR1N_vr', 'LITR2N_vr', 'LITR3N_vr','CWDN_vr', 'QICE_FORC', 'TSRF_FORC', 'TOPO_FORC' -'PCT_NAT_PFT','PCT_LANDUNIT','TOTLITC:I','TOT_WOODPRODC:I','CROPPROD1C:I','TOTSOMC:I','TOTVEGC:I','FSNO_ICE' - -! h4 stream (yearly average, landunit-level) -! Eyr landuse tiles -hist_fincl5 = 'TOTSOMC:I', 'TOTSOMC_1m:I', 'TOTECOSYSC:I', 'TOTVEGC:I', 'WOODC:I', 'TOTLITC:I', 'LIVECROOTC:I', 'DEADCROOTC:I', 'FROOTC:I' - -! h5 stream (daily average, gridcell-level) -! day, Eday -hist_fincl6 = 'SOILWATER_10CM', 'TOTSOILLIQ', 'TOTSOILICE', 'GPP', 'NPP', 'AR', 'HR', 'EFLX_LH_TOT', 'FSH', 'FGR12', 'FSM', 'QSNOEVAP', 'TLAI', 'QDRAI', 'QDRAI_PERCH', 'QOVER', 'QFLX_SUB_SNOW', 'FSA', 'FIRA', 'H2OSNO', 'SNOCAN', 'QSNOFRZ', 'QFLX_SNOW_DRAIN', 'SNOWDP', 'H2OSFC', 'TV', 'TG', 'TAUX', 'TAUY', 'QVEGT', 'TWS', 'H2OCAN', 'ALT', 'QVEGE', 'QSOIL', 'TSKIN', 'FSDS','FSNO','SNOFSRVD','SNOFSRVI','SNOFSRND','SNOFSRNI','FSDSVD','FSDSVI','FSDSND','FSDSNI','SNOWLIQ','SOILICE','SOILLIQ','QINTR','SNOBCMSL','TSOI','SNOTXMASS','SNOWICE','SNOWLIQ','QRUNOFF','RAIN','SNOW' - -! h6 stream (daily average, landunit-level) -! Eday -hist_fincl7 = 'TREFMXAV','TREFMNAV' - -! h7 stream (3-hourly average, gridcell-level) -! 3hr, E3hr, CF3hr -! 3hr requires QRUNOFF for time mean, and SOILWATER_10CM, TSKIN for time point (I) -! E3hr requires GPP, AR, HR for time mean -! CF3hr requires QFLX_SUB_SNOW for time point (I) -hist_fincl8 = 'GPP','AR','HR','TSA','RH2M','SOILWATER_10CM:I','FSH','EFLX_LH_TOT','FSDS','QRUNOFF','QFLX_SUB_SNOW:I','TSKIN:I' - -hist_mfilt = 1,1,1,1,1,365,365,2920 -hist_dov2xy = .true.,.false.,.false.,.true.,.false.,.true.,.false.,.true. -hist_nhtfrq = 0,0,0,-8760,-8760,-24,-24,-3 -hist_type1d_pertape = ' ',' ','LAND',' ','LAND',' ','LAND',' ' diff --git a/cime_config/usermods_dirs/cmip6_output/user_nl_cpl b/cime_config/usermods_dirs/cmip6_output/user_nl_cpl deleted file mode 100644 index ba776735ff..0000000000 --- a/cime_config/usermods_dirs/cmip6_output/user_nl_cpl +++ /dev/null @@ -1 +0,0 @@ -histaux_l2x1yrg = .true. diff --git a/doc/.ChangeLog_template b/doc/.ChangeLog_template deleted file mode 100644 index b86cbbae0f..0000000000 --- a/doc/.ChangeLog_template +++ /dev/null @@ -1,136 +0,0 @@ -=============================================================== -Tag name: -Originator(s): -Date: -One-line Summary: - -Purpose of changes ------------------- - -[Fill this in with details] - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] -CIME Issues fixed (include issue #): [If none, remove this line] - -Known bugs introduced in this tag (include github issue ID): [If none, remove this line] - -Known bugs found since the previous tag (include github issue ID): [If none, remove this line] - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): - -Substantial timing or memory changes: - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - -Code reviewed by: - - -CTSM testing: - -[... Remove before making trunk_tag. Available test levels: - - a) regular (must be run before handing off a tag to SEs and must be run - before committing a tag) - b) build_namelist (if namelists and/or build_system changed)) - c) tools (only if tools are modified and no CTSM source is modified) - d) short (for use during development and in rare cases where only a small - change with known behavior is added ... eg. a minor bug fix) - e) doc (no source testing required) - -... ] - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - unit-tests (components/clm/src): - - cheyenne - - - tools-tests (components/clm/test/tools): - - cheyenne - - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - - - regular tests (aux_clm): - - cheyenne_intel ---- - cheyenne_gnu ------ - hobart_nag -------- - hobart_pgi -------- - hobart_intel ------ - -CTSM tag used for the baseline comparisons: - - -Answer changes --------------- - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - URL for LMWG diagnostics output used to validate new climate: - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - -=============================================================== diff --git a/doc/.release-ChangeLog_template b/doc/.release-ChangeLog_template deleted file mode 100644 index 7d3bad891f..0000000000 --- a/doc/.release-ChangeLog_template +++ /dev/null @@ -1,98 +0,0 @@ -=============================================================== -Tag name: -Originator(s): -Date: -One-line Summary: - -Purpose of this version: ------------------------- - -[Fill this in with details] - - -CTSM Master Tag This Corresponds To: - -Summary of changes: -------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] -CIME Issues fixed (include issue #): [If none, remove this line] - -Science changes since: - -Software changes since: - -Changes to User Interface since: - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - - - unit-tests (components/clm/src): - - cheyenne - - hobart --- - - tools-tests (components/clm/test/tools): - - cheyenne - - hobart --- - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - - hobart --- - - regular tests (aux_clm): - - cheyenne_intel ---- - cheyenne_gnu ------ - hobart_nag -------- - hobart_pgi -------- - hobart_intel ------ - - regular tests (prealpha): - - cheyenne_intel - - cheyenne_gnu --- - hobart_nag ----- - - regular tests (prebeta): - - cheyenne_intel - - cheyenne_gnu --- - hobart_nag ----- - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - URL for LMWG diagnostics output for new climate: - -Detailed list of changes: ------------------------- - -Externals being used: - -CTSM Tag versions pulled over from master development branch: - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - -=============================================================== diff --git a/doc/ChangeLog b/doc/ChangeLog deleted file mode 100644 index 71f0db46c6..0000000000 --- a/doc/ChangeLog +++ /dev/null @@ -1,841 +0,0 @@ -=============================================================== -Tag name: ctsm1.0.dev009 -Originator(s): sacks (Bill Sacks) -Date: Wed Aug 22 20:32:36 MDT 2018 -One-line Summary: Fix initialization of AnnET in InitAccVars - -Purpose of changes ------------------- - -InitAccVars was mistakenly setting qflx_evap_tot_col rather than -AnnET. This fix allows us to remove now-redundant cold start and restart -code for AnnET. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #480 -- Partially addresses #285 - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: basic proposed changes reviewed by Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - -CTSM tag used for the baseline comparisons: ctsm1.0.dev008 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): none - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev008 -Originator(s): erik (Erik Kluzek) -Date: Tue Aug 14 10:25:12 MDT 2018 -One-line Summary: Update 1850 ndep file and last year for streams for Historical transient cases - -Purpose of changes ------------------- - -Bring in changes from release-clm5.0.05. Update to latest Nitrogen Deposition file from simulations with WACCM for 1850. -Also fix an issue with the last year for historical transient cases. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): 461 - #461 -- increase last year in streams for transient - -Known bugs found since the previous tag (include github issue ID): [If none, remove this line] - #478 -- Bare soil g1 should be missing value or zero - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): Last year extended for transient datasets - -Changes to the datasets (e.g., parameter, surface or initial files): New ndep dataset for 1850 - -Substantial timing or memory changes: - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: Lengthen some tests - -Code reviewed by: self - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (11 show differences for 1850_control and 20thC_transient) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CTSM tag used for the baseline comparisons: ctsm1.0.dev007 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: 1850_control or 20thC_transient for Clm50 - - what platforms/compilers: all - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #477 -- Move changes from release-clm5.0.05 onto master - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev007 -Originator(s): sacks (Bill Sacks) -Date: Sun Aug 5 21:03:28 MDT 2018 -One-line Summary: Avoid glacier dynamic landunit adjustments in first time step - -Purpose of changes ------------------- - -Always avoid generating dynamic landunit adjustments for glacier area -changes in the first timestep of a startup or hybrid run - not just for -cold start or interpolated start. See the detailed discussion in -https://github.com/ESCOMP/ctsm/issues/340 for rationale. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #340 (Avoid generating dynamic landunit adjustment fluxes for - glacier changes in the first timestep) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - not run - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- ok - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - - ok means tests pass; baseline failures as expected in these two - tests that do not use init_interp: - - FAIL ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default BASELINE ctsm1.0.dev006 - FAIL SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput BASELINE ctsm1.0.dev006 - - (The glacier area on the finidat file used in these tests - - clmi.I2000Clm50BgcCrop.2011-01-01.1.9x2.5_gx1v7_gl4_simyr2000_c180715.nc - - seems to have come from an finidat_interp_dest file, and thus does - not match the glacier area from CISM.) - -CTSM tag used for the baseline comparisons: ctsm1.0.dev006 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Startup / Hybrid runs that include CISM - (even NOEVOLVE) and do not use init_interp, due to: - - different PE layout in new case vs. the one that generated the - finidat (roundoff-level diffs) - - different glacier area on finidat file vs. what's in CISM - (greater than roundoff-level diffs) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Roundoff-level for different PE layout, larger than roundoff but - should be same climate when there is different glacier area on the - finidat file vs. what's in CISM - - The differences arise from dynamic landunit adjustments of the - below-ground C and N states in the old code, as CTSM adjusts its - areas to match CISM's. In the new code, there are no C and N - adjustments in the first time step from this adjustment. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- #470 (Avoid glacier dynamic landunit adjustments in first time step) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev006 -Originator(s): sacks (Bill Sacks) -Date: Sat Aug 4 07:48:09 MDT 2018 -One-line Summary: Minor bug fixes, cleanup, documentation and enhancements - -Purpose of changes ------------------- - -A collection of minor bug fixes, code cleanup, documentation and -enhancements, all bit-for-bit. See list of issues fixed below for -details. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #24 (ncd_io_1d_log_glob is broken) -- Fixes #120 (Incorrect comments in Biogeophysics1Mod.F90 -- Fixes #217 (Change some cheyenne_gnu tests to cheyenne_intel) -- Fixes #245 (Put all .gitignore entries in top-level file) -- Fixes #272 (Code should error on missing mxsoil_color when SOIL_COLOR - is used) -- Fixes #283 (Add more helpful message about need to do init_interp with - wrong number of vertical layers) -- Fixes #367 (For cmip6 runs: Turn on cpl hist output needed to drive a - TG compset) -- Fixes #412 (Fix documentation of init_interp_method) -- Fixes #419 (Do not allow SOYFIXN diagnostic field with FUN) -- Fixes #464 (Some lines longer than 132 characters) -- Fixes #465 (Remove backwards compatibility check for snw_rds) -- Fixes #467 (Increase wallclock limit for test) - - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changed a single-point test from gnu to intel to get better debugging - information - (SMS_D_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm45BgcCropQianGs.cheyenne_intel.clm-cropMonthOutput) -- For some single-point tests on both gnu and intel: removed one - compiler, keeping the tests on just one - -Code reviewed by: self - - -CTSM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - - NLCOMP failures as expected for tests with the cmip6 test mod - - Some long single-point gnu tests failed due to running out of - wallclock time; I have removed these, just keeping them on intel - (along with removing a few other tests after I ran the testing - see - commit 5c226bdf): - - FAIL ERS_Lm54_Mmpi-serial.1x1_numaIA.I2000Clm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=4803 - FAIL ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHistClm50BgcCropGs.cheyenne_gnu.clm-cropMonthOutput RUN time=6024 - - -CTSM tag used for the baseline comparisons: ctsm1.0.dev005 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -- #392 (Remove old code for snw_rds restart that looks no longer needed) -- (Other changes not documented in PRs) - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev004 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Jul 18 02:10:23 MDT 2018 -One-line Summary: Add some new diagnostic fields, fix a few issues, update cmip6 output - -Purpose of changes ------------------- - -Add some new diagnostic fields. Some needed for CMIP6. Update the CMIP6 user-mods output. -Fix a couple issues. Get full list of history tapes working correctly. Check for valid range -of CO2. New IC file interpolated from the previous one for f19_g17_gl4 for 2000 Clm50BgcCrop. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): $210, #427, #429 - #210 -- increase number of history tapes - $427 -- Check for zero CO2 - #429 -- New IC for present day - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CTSM's user interface (e.g., new/renamed XML or namelist variables): New history fields - TSKIN --- skin temperature - TSL ----- temperature of near-surface soil layer - GSSUNLN - sunlit leaf stomatal conductance at local noon - GSSHALN - shaded leaf stomatal conductance at local noon - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New finidat file f19_g17_gl4 2000 Clm50BgcCrop - New file is just interpolate from the previous file to a f19_g17_gl4 gridfor Clm50BgcCrop and 2000 simulation year - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: None - -Code reviewed by: self, oleson, abtawfik - - -CTSM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - OK (95 are different because of finidat file change) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- PASS - hobart_pgi -------- FAIL - hobart_intel ------ PASS - -CTSM tag used for the baseline comparisons: ctsm1.0.dev003 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes -- only 2000 cases because of new IC - - Summarize any changes to answers, i.e., - - what code configurations: Just 2000 cases - - what platforms/compilers: All - - nature of change: same climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - - #338 -- Radtemp and other new diagnostic fields - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev003 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Sun Jul 15 00:26:46 MDT 2018 -One-line Summary: Update cime/cism to work on upgraded hobart and with glade changes on cheyenne - -Purpose of changes ------------------- - -Update cime and cism so can work on upgraded hobart. Also fix an issue that the Nag6.2 compiler found -in CTSM. Also get working with glade changes that happened on cheyenne, DIN_LOC_ROOT_CLMFORC was -changed to a new directory. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] - #441 -- Changes in glade invalidate previous softlinks and data locations - #438 -- Illegal argument aliasing caught by nag6.2 - #433 -- with hobart upgrade CTSM not working - -Known bugs introduced in this tag (include github issue ID): - #444 -- PGI fails on cheyenne and hobart - -Known bugs found since the previous tag (include github issue ID): - #443 -- Wood C:N ratios - #440 -- leafcn_max < target leafcn? - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? No -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[ ] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): DIN_LOC_ROOT_CLMFORC on cheyenne - DIN_LOC_ROOT_CLMFORC was change on cheyenne - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CTSMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: path for cheyenne specific test had to be changed - Add some gnu tests on hobart - Lengthen wallclock on a test - Fix path for DA test_mod - -Code reviewed by: self - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- FAIL - hobart_gnu -------- PASS - hobart_intel ------ PASS - -CLM tag used for the baseline comparisons: ctsm1.0.dev002 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): cime, cism - cism-wrapper to release-cesm2.0.04 - cime to cime5.6.10 - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - #444 -- Get working on upgraded hobart and with glade changes on cheyenne - -=============================================================== -=============================================================== -Tag name: ctsm1.0.dev002 -Originator(s): erik (Erik Kluzek) -Date: Fri Jul 6 16:33:03 MDT 2018 -One-line Summary: Fix NFIX flux variables so special land-units are zeroed out, tools update, add some *_MAX fields on mksurfdata_map for transient cases - -Purpose of changes ------------------- - -Nitrogen Fixation flux arrays were being set to missing value over non-vegetated landunits. This sets them to zero everywhere -and averages in the zero's at the gridcell level for history output. It also reads in restarts with missing values and converts -them to zero's. - -There are also some tools updates, getting the tools working on the new upgraded hobart.cgd.ucar.edu. - -And mksurfdata_map is updated to add some *_MAX files on the landuse.timeseries files that will allow us to conserve memory -for transient cases. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #435, #436, #433 (for tools) - #435 -- intel build for tools - #426 -- Nitrogen Fixation flux variables - #433 -- hobart broken, got it working for tools - -Known bugs found since the previous tag (include github issue ID): #433, #431 - - #433 -- with hobart upgrade, hobart build isn't working - #431 -- When set_* options are used to hist_addfld be careful of ordering - -Significant changes to scientifically-supported configurations --------------------------------------------------------------- - -Does this tag change answers significantly for any of the following physics configurations? -(Details of any changes will be given in the "Answer changes" section below.) - - [Put an [X] in the box for any configuration with significant answer changes.] - -[X] clm5_0 - -[ ] clm4_5 - -[ ] clm4_0 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): ndep file updated for clm5_0 for 1850 - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- -NOTE: Be sure to review the steps in .CLMTrunkChecklist as well as the coding style in the Developers Guide - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): NFIX flux variables - NFIX flux variables when read from restart have special-values (missing on non veg landunits) converted to zero's - They are now initialized to zero everywhere. - -Changes to tests or testing: None - -Code reviewed by: self, wwieder, and lawrence, sacks (mksurfdata_map code) - -CLM testing: regular (although none on hobart!) - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (5 tests differ from previous version) - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - hobart --- PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - -CLM tag used for the baseline comparisons: ctsm1.0.dev001 - - -Answer changes --------------- - -Changes answers relative to baseline: clm5_0 BGC configurations with FUN and clm5_0 with BGC for new 1850 ndep file - - Summarize any changes to answers, i.e., - - what code configurations: All clm5_0 BGC due to NFIX fields, and clm5_0 1850 BGC due to new ndep file - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #437 -- ChangeLog template - #432 -- nfix - #331 -- _MAX fields on mksurfdata_map - -=============================================================== -=============================================================== diff --git a/doc/ChangeSum b/doc/ChangeSum deleted file mode 100644 index 478d39706a..0000000000 --- a/doc/ChangeSum +++ /dev/null @@ -1,539 +0,0 @@ -Tag Who Date Summary -============================================================================================================================ -<<<<<<< HEAD -release-clm5.0.08 erik 09/28/2018 Updated CMIP6 ndep file for historical transient Bgc cases, 1850_control same as before - ctsm1.0.dev009 sacks 08/22/2018 Fix initialization of AnnET in InitAccVars -release-clm5.0.07 erik 08/08/2018 Bring in some simple fixes from ctsm1.0.dev006 and avoid glacier adjustment at startup from ctsm1.0.dev007 -release-clm5.0.06 erik 08/07/2018 Bring in some simple fixes from ctsm1.0.dev006 and avoid glacier adjustment at startup from ctsm1.0.dev007 - ctsm1.0.dev008 erik 08/14/2018 Update 1850 ndep file and last year for streams for Historical transient cases (same as release-clm5.0.05) -release-clm5.0.05 erik 08/05/2018 Update 1850 ndep file, and last year for transient streams -||||||| parent of 3f7152f8... Update changelog - ctsm1.0.dev008 erik 08/14/2018 Update 1850 ndep file and last year for streams for Historical transient cases -======= - ctsm1.0.dev009 sacks 08/22/2018 Fix initialization of AnnET in InitAccVars - ctsm1.0.dev008 erik 08/14/2018 Update 1850 ndep file and last year for streams for Historical transient cases ->>>>>>> 3f7152f8... Update changelog - ctsm1.0.dev007 sacks 08/05/2018 Avoid glacier dynamic landunit adjustments in first time step - ctsm1.0.dev006 sacks 08/04/2018 Minor bug fixes, cleanup, documentation and enhancements -release-clm5.0.04 erik 07/18/2018 Fix some NFIX variables, update cime/cism for upgraded hobart new glade, new diagnostic fields, update cmip6 output - ctsm1.0.dev004 erik 07/18/2018 Add some new diagnostic fields, fix a few issues, update cmip6 output - ctsm1.0.dev003 erik 07/15/2018 Update cime/cism to work on upgraded hobart and with glade changes on cheyenne - ctsm1.0.dev002 erik 07/06/2018 Fix NFIX flux variables so special land-units are zeroed out, tools update, add some *_MAX fields on mksurfdata_map for transient cases -release-clm5.0.03 erik 06/12/2018 Second release branch tag for CESM2.0 release, fixing DA and tools and README files, identical to clm5.0.dev013 -release-clm5.0.02 erik 06/12/2018 Mistake tag identical to previous version - clm5.0.dev013 erik 06/12/2018 cleanup and update cime and cism -release-clm5.0.01 erik 05/22/2018 First release branch tag for CESM2.0 release, identical to clm5.0.dev012 - clm5.0.dev012 sacks 05/17/2018 Fixes for variable_year orbital mode - clm5.0.dev011 erik 05/16/2018 1850 ndep update, cism update, PE layouts, turn BFBFLAG for testing - clm5.0.dev010 erik 05/15/2018 Update cime version to version in cesm2.0.beta10, changes answers for 1850 compsets because of orbit - clm5.0.dev009 sacks 05/10/2018 New init_interp method - clm5.0.dev008 erik 04/27/2018 With FUN subtract out soil nitrification flux of plant uptake of soil NH3 and NO3 - clm5.0.dev007 erik 04/24/2018 Bring in a few answer changing things: FATES, cism updates, IC file fix, - testing 1850 compset use 1850 orbit - clm5.0.dev006 sacks 04/12/2018 Don't allocate memory for zero-weight natveg patches and urban - clm5.0.dev005 sacks 04/10/2018 Two fixes for init_interp - clm5.0.dev004 erik 04/09/2018 List of important bug fixes - clm5.0.dev003 erik 03/09/2018 Bug fixes for energy imbalance associated with surface water and lakes - clm5.0.dev002 sacks 02/25/2018 Add some land ice diagnostic vars needed for CMIP6 - clm5.0.dev001 erik 02/14/2018 Fix LND_TUNING_MODE for fully coupled case, update some README files/PTCLM - clm5.0.dev000 erik 02/05/2018 Double tag of clm5.0.000 with new naming convention, some updated documentation - clm5.0.000 erik 02/05/2018 Double tag of clm4_5_18_r275 for clm5.0 release - clm4_5_18_r275 erik 02/05/2018 Update initial condition files, update fates, new CMIP6 pop-dens, more lnd_tuning_mod options, updated ndep for fully coupled - clm4_5_18_r274 sacks 01/30/2018 Fix auto-detection of CIME_MODEL in a standalone checkout - clm4_5_18_r273 sacks 01/26/2018 Support a standalone checkout from git - clm4_5_18_r272 erik 01/25/2018 Bring in latest FATES release version to CLM trunk: fates_s1.4.1_a3.0.0_rev2 - clm4_5_18_r271 erik 01/20/2018 Update testlist to v2 and remove yellowstone - clm4_5_18_r270 sacks 12/20/2017 Always use multiple elevation classes for glacier, even with stub glc - clm4_5_18_r269 erik 12/16/2017 Move externals to version in github - clm4_5_18_r268 erik 12/11/2017 Fix calculation of stomatal resistence used in dry-deposition, increase threshold of totvegc for soil decomposition to 0.1 - clm4_5_18_r267 sacks 12/07/2017 Fixes to accumulator fields - clm4_5_17_r266 sacks 11/27/2017 Avoid negative snow densities - clm4_5_17_r265 erik 11/18/2017 Update the clm50 parameter file for better behavior with prognostic crop, and fix a bug in clm50 urban model - clm4_5_17_r264 erik 11/16/2017 Changes from Dave Lawrenece on resetting soil carbon for spinup - clm4_5_17_r263 erik 11/08/2017 Drydep vel. for SO2 doubled, influence of organic mater in soil calmed, max daylength not hardwired to present day - clm4_5_16_r262 sacks 10/27/2017 Rename atm2lnd history fields for downscaled fields, properly turn on vic for clm45, and other minor fixes - clm4_5_16_r261 sacks 10/25/2017 Add option to reset snow over glacier columns - clm4_5_16_r260 erik 10/24/2017 Update paramater file for CLM50 as well as fates, fix a few issues - clm4_5_16_r259 erik 10/17/2017 Update to latest cime from cesm2_0_beta07 and config_components version 3 - clm4_5_16_r258 erik 10/06/2017 Revert change to fire, set n_melt_glcmec=10, update mosart to version that doesn't accumulate water in short rivers - clm4_5_16_r257 erik 09/29/2017 Fix two bugs found by Hui Tang, one for Carbon isotopes and one in the fire model - clm4_5_16_r256 erik 09/20/2017 Fresh snow grain radius is temperature dependent - clm4_5_16_r255 erik 09/18/2017 Changes to crop and enabling Carbon isotopes for crop and some miscellaneous small changes - clm4_5_16_r254 erik 09/01/2017 Update surface datasets, and point to new CMIP6 population density dataset - clm4_5_16_r253 erik 08/04/2017 Check on reasonable import/export from CLM, check ndep units from input file - clm4_5_16_r252 erik 07/24/2017 Update parameter file for some crop albedo issues, and fix a bug in urban albedo for nightime - clm4_5_16_r251 erik 07/14/2017 Update mksurfdata_map for soil depth/color, add new mapping files - clm4_5_16_r250 erik 07/13/2017 Update finundation dataset, new fsurdat files with updated soil color and soil depth, - update mosart areas, fix cheyenne_gnu - clm4_5_16_r249 sacks 07/06/2017 All new compsets, reworked test lists, and related fixes - clm4_5_16_r248 sacks 06/28/2017 Melt most ice runoff - clm4_5_16_r247 sacks 06/26/2017 New GLACIER_REGION field with CISM domain split in two - clm4_5_16_r246 sacks 06/14/2017 Update to latest cime - clm4_5_16_r245 sacks 06/14/2017 Only adjust glc_mec topographic heights if glc_do_dynglacier is true - clm4_5_16_r244 erik 06/09/2017 Update cime and cism externals, changes answers for IG compsets, test g17 grids, fix a few - issues, update mksurfdata_map - clm4_5_16_r243 andre 05/23/2017 History output cleanup from Dave Lawrence - clm4_5_16_r242 erik 05/21/2017 Use finundated streams for CLM50, and use ndep if it comes from cpl - clm4_5_16_r241 sacks 05/16/2017 Fix ch4 subtle dependence on processor count - clm4_5_16_r240 sacks 05/15/2017 Make glc_dyn_runoff_routing real-valued - clm4_5_16_r239 sacks 05/13/2017 Avoid division by zero in snow WindDriftCompaction - clm4_5_16_r238 andre 05/13/2017 ED is now an external library 'fates' - clm4_5_16_r237 erik 05/09/2017 Latest parameter file and some changes for CLM50, CLM45-transient changes answers also - clm4_5_15_r236 erik 05/01/2017 New surface datasets, and landuse.timeseries files, as well as interpolating initial conditions for - almost all cases - clm4_5_15_r235 sacks 04/27/2017 Zero dynbal fluxes if namelist variable is set - clm4_5_15_r234 andre 04/14/2017 Update rtm and mosart externals - clm4_5_15_r233 erik 04/11/2017 Pull out some constants and options to namelist - clm4_5_15_r232 erik 04/05/2017 Some small changes that affect both clm4_5 and clm5_0 answers (can be considered bug fixes to clm4_5) - clm4_5_14_r231 sacks 04/02/2017 Add option to reset snow pack over non-glacier columns - clm4_5_14_r230 sacks 03/31/2017 Fix dynamic landunits water and energy conservation - clm4_5_14_r229 erik 03/10/2017 Update cime and make some changes to drv_flds_in namelist, fix some minor bugs - clm4_5_14_r228 erik 03/07/2017 Bring in changes that were accidentally dropped as part of the clm4_5_14_r226 tag - clm4_5_14_r227 sacks 03/06/2017 Improve performance of dynamic landunits code - clm4_5_14_r226 erik 03/02/2017 Update cime, mosart and ccism to a version that is cesm2_0_beta05 or part of beta06 - clm4_5_14_r225 sacks 02/19/2017 Fix GDD accumulation in new crop columns - clm4_5_14_r224 sacks 02/10/2017 Tweaks for glaciers and snow - clm4_5_14_r223 sacks 02/03/2017 Handle patch-level C&N variables correctly with dynamic landunits - clm4_5_14_r222 sacks 01/27/2017 Fix energy budget bug with fractional snow on glacier and wetland columns - clm4_5_14_r221 sacks 01/24/2017 Change rain-snow partitioning and ice albedo for glacier columns - clm4_5_14_r220 sacks 01/22/2017 Fix crop seeding - clm4_5_14_r219 erik 01/21/2017 Answer changes for CLM50 for several issues that lead to dead crops - clm4_5_14_r218 sacks 01/13/2017 For newly initiating columns: do not copy snow state - clm4_5_14_r217 sacks 01/13/2017 Bug fix for snow radiation absorption - clm4_5_14_r216 erik 01/12/2017 Fix previous broken tag - clm4_5_14_r215 erik 01/12/2017 Update mksurfdata_map to work with new updated datasets from Peter, and use hand-edited - surfdata/landuse.timeseries datasets for f09/f19 - clm4_5_14_r214 sacks 01/03/2017 Update column states based on dwt terms between dyn_cnbal_patch and dyn_cnbal_col, and minor fixes - clm4_5_14_r213 sacks 12/30/2016 Convert buildnml to python - clm4_5_14_r212 sacks 12/22/2016 Bump science version number due to changes in clm4_5_13_r211 - clm4_5_13_r211 sacks 12/22/2016 Apply transient land cover and harvest all at once in first time step of year - clm4_5_13_r210 sacks 12/17/2016 Update cime to cesm2_0_beta04 version - clm4_5_13_r209 sacks 12/11/2016 Change definition of NBP; bring back some r205 changes that were lost in r207 - clm4_5_13_r208 sacks 12/10/2016 Rework irrigation; remove glc_smb logical - clm4_5_13_r207 andre 12/08/2016 PHS - Calculate separate root water uptake resistances for soil and root pathways - clm4_5_13_r206 andre 11/29/2016 Bugfix for Luna causing arctic to die - clm4_5_13_r205 sacks 11/16/2016 Add diagnostics for snow and glacier; fix crash in Megan - clm4_5_13_r204 erik 11/15/2016 A few answer changing bug fixes - clm4_5_12_r203 sacks 11/10/2016 Bug fixes for snow-on-lake - clm4_5_12_r202 sacks 11/09/2016 Update to cime version used in cesm2_0_beta03 - clm4_5_12_r201 sacks 11/09/2016 Rework initialization of transient weights - important with use_init_interp - clm4_5_12_r200 erik 11/08/2016 Latest parameter updates from simulations, ignore surface soil layer for plant hydraulic stress - for greater variability in surface soil moisture - clm4_5_12_r199 sacks 10/29/2016 Use CISM2 by default - clm4_5_12_r198 sacks 10/20/2016 Rework mapping of irrigation from CLM to ROF - clm4_5_12_r197 erik 10/14/2016 Some cleanup for plant hydraulic stress and adding more namelist parameters - clm4_5_12_r196 erik 09/27/2016 Bring new cime5 to clm trunk - clm4_5_12_r195 sacks 09/18/2016 Remove dependence on column weights in fire code - clm4_5_12_r194 sacks 09/01/2016 Dribble annual dyn landunit adjustment fluxes; initialize water state for new crop columns - clm4_5_12_r193 andre 08/30/2016 Bugfix in BalanceCheckMod: revert tolerance change and removal of endrun call introduced in r192 - clm4_5_12_r192 andre 08/27/2016 ED bugfixes and initial refactoring for a standalone library - clm4_5_12_r191 sacks 08/21/2016 New parameterizations for snow overburden compaction and wind drift compaction - clm4_5_12_r190 sacks 08/20/2016 Fix snow capping bug - clm4_5_11_r189 erik 08/18/2016 Bring in time varying streams for urban data (currently triggers AC use) - clm4_5_11_r188 erik 08/05/2016 A set of small answer changing issues for both clm45 and clm50 - clm4_5_10_r187 erik 07/26/2016 CLM45/50 changes: seperate carbon and water root profile, turn off undercanopystability, - really turn PHS on, LUNA predict sunlit fraction N fractionation - clm4_5_9_r186 sacks 07/13/2016 Initialize biogeochem balance checks AFTER column area updates - clm4_5_9_r185 sacks 07/07/2016 Revert glacial melt behavior to the old treatment for mountain glaciers - clm4_5_9_r184 erik 07/06/2016 CLM50 changes: Atkin form of lmr changed, new parameters and files, turn PHS on by default, - new cold snow density, reseed at exit AD spinup, fix fire bug, fix npool and cpool errors - clm4_5_9_r183 erik 07/02/2016 Decomposition is not water limited after reaching a field capacity parameter (maxpsi_hr) - rather than only at soil saturation - clm4_5_8_r182 erik 06/24/2016 Bring in option for plant hydraulic stress for clm50 - clm4_5_8_r181 erik 06/17/2016 Update cime version which fixes several issues and changes answers - clm4_5_8_r180 sacks 06/06/2016 Refactor dyn_cnbal_patch - clm4_5_8_r179 sacks 05/27/2016 Update column-level BGC state variables with dynamic landunits - clm4_5_8_r178 sacks 04/17/2016 Remove some consistency checks, and merge crop_prog with use_crop in code - clm4_5_8_r177 sacks 04/14/2016 Move CN product pools to gridcell level - clm4_5_8_r176 sacks 04/13/2016 Calculate active flags and filters earlier in initialization - clm4_5_8_r175 sacks 04/09/2016 For glc_mec, change downscaling and where SMB is computed - clm4_5_8_r174 erik 03/25/2016 Bring Rosie's respiration changes to the trunk - clm4_5_8_r173 sacks 03/17/2016 Major refactor of CN Products - clm4_5_8_r172 sacks 03/08/2016 Exclude land use and product pools / fluxes from CN summary diagnostics - clm4_5_8_r171 erik 03/02/2016 Backout COMP_RUN_BARRIERS setting, and remove all ED tests from testlist (as they all fail) - clm4_5_8_r170 sacks 02/28/2016 Add a wrapper for CN Vegetation - clm4_5_8_r169 erik 02/23/2016 Add fire several fire constants to namelist, add some new clm45/50 surface datasets - clm4_5_8_r168 sacks 02/20/2016 Fix zero methane production - clm4_5_7_r167 sacks 02/20/2016 Fix carbon isotopes in transient runs - clm4_5_7_r166 sacks 02/02/2016 Infrastructure for carbon and nitrogen conservation with dynamic landunits - clm4_5_7_r165 sacks 01/29/2016 Remove fglcmask, recreate all surface datasets - clm4_5_7_r164 erik 01/12/2016 Update CIME and MOSART - clm4_5_7_r163 sacks 12/23/2015 Improve crop performance by allocating less memory - clm4_5_7_r162 andre 12/18/2015 negative runoff updates. - clm4_5_6_r161 sacks 12/17/2015 Collapse mountain glaciers to a single elevation class - clm4_5_6_r160 sacks 12/11/2015 For glc_mec, get gridcell topographic height from atm - clm4_5_6_r159 erik 12/10/2015 Update CIME version - clm4_5_6_r158 andre 12/04/2015 misc clm 5.0 bugfixes - clm4_5_6_r157 sacks 11/27/2015 Reduce memory use for init_interp - clm4_5_6_r156 sacks 11/24/2015 Fix QSNWCPICE and glacial inception - clm4_5_6_r155 erik 11/23/2015 Bring FUN (Fixation and Uptake of Nitrogen) code option to trunk - from Mingjie, as well as latitude varying spinup from Charlie, - and a fix for crop with dynamic roots from Beth - clm4_5_6_r154 andre 11/18/2015 one year grain product pool - clm4_5_6_r153 sacks 11/17/2015 Fix snow cover fraction bug - clm4_5_5_r152 sacks 11/17/2015 Fix glc_mec energy conservation bug - clm4_5_4_r151 erik 11/13/2015 Fix broken r150 tag, with bgc_spinup issue in it - clm4_5_4_r150 erik 11/13/2015 Some needed answer changing fixes for: fire, disallow - negative photosynthis, and reduce LAI of DBT in evergreen state - clm4_5_3_r149 sacks 11/08/2015 Change cold start initialization of snow pack - clm4_5_3_r148 sacks 11/07/2015 For CLM5, increase max snow depth to 20 m - clm4_5_3_r147 andre 11/05/2015 swenson bedrock and coupler runoff bugfixes - clm4_5_3_r146 sacks 11/04/2015 Implement vertical interpolation in init_interp - clm4_5_3_r145 andre 11/03/2015 update clm50 defaults, enable clm50 crop compsets - clm4_5_3_r144 sacks 10/27/2015 Better fix for bug that leads to infinite growth in snow depth - clm4_5_3_r143 andre 10/22/2015 flexibleCN and luna bugfixes. - clm4_5_3_r142 sacks 10/19/2015 Fix bug in initialization of 12-layer snow pack - clm4_5_3_r141 sacks 10/19/2015 Fix bug that leads to infinite growth in snow depth - clm4_5_3_r140 andre 10/15/2015 mosart direct to ocean runoff - clm4_5_3_r139 andre 10/13/2015 dynamic roots from Beth Drewniak - clm4_5_3_r138 andre 10/11/2015 new accelerated spinup and soil vertical structure - clm4_5_3_r137 erik 10/09/2015 Bring in changes for fire-emissions as well tuning changes to the fire model to be used with clm5_0 - clm4_5_3_r136 andre 10/08/2015 coupler field prep for mosart and externals update - clm4_5_3_r135 sacks 10/06/2015 Substantial reduction in memory allocation for prognostic crops - clm4_5_3_r134 sacks 10/04/2015 Fixes for transient and preindustrial crop cases - clm4_5_3_r133 andre 10/02/2015 Bugfix for mksurfdata_map - add file missed by clm4_5_2_r125. - clm4_5_3_r132 andre 10/02/2015 Modify soil BGC diffusion and cryoturbation code to allow for spatially variable soil thickness. - clm4_5_3_r131 sacks 09/30/2015 Bring in cime3 - clm4_5_3_r130 andre 09/28/2015 add namelist option to reduce lake evaporation and irrigation when river water storage falls below a threshold value, and add an additional constraint on stress deciduous leaf onset. - clm4_5_3_r129 andre 09/25/2015 bump tag revision number because clm4_5_2_r128 was climate changing. - clm4_5_2_r128 andre 09/24/2015 science bugfixes (not bfb) for root fraction and bedrock thermal properties - clm4_5_2_r127 sacks 09/18/2015 Fix interpolation of initial conditions for glc_mec and crop <-> non-crop - clm4_5_2_r126 andre 09/17/2015 New decomp_depth_efolding value for clm5.0, set as a namelist parameter instead of netcdf params file. - clm4_5_2_r125 andre 09/15/2015 clm 50 hydrology updates. - clm4_5_2_r124 sacks 09/13/2015 Wind-dependent snow density - clm4_5_2_r123 sacks 09/10/2015 Fix some problems with pgi and nag compilers - clm4_5_2_r122 sacks 09/09/2015 Update to latest cime - clm4_5_2_r121 sacks 09/04/2015 Rework snow capping - clm4_5_1_r120 andre 08/29/2015 CLM 5 nitrogen models Flexible CN and LUNA - clm4_5_1_r119 erik 08/26/2015 Bring hobart/nag bug fixes to trunk, and fix a few bugs - clm4_5_1_r118 sacks 08/05/2015 Minor rework of glc coupling fields - clm4_5_1_r117 sacks 07/28/2015 Repartition rain vs. snow from atmosphere - clm4_5_1_r116 sacks 07/22/2015 Rename some history fields - clm4_5_1_r115 sacks 07/15/2015 Remove redundant code, rename a variable - clm4_5_1_r114 sacks 07/10/2015 Update cime external, remove genf90-generated files - clm4_5_1_r113 sacks 07/09/2015 Support backwards compatibility of restart variable names - clm4_5_1_r112 oleson 07/01/2015 Justin Perket snow on vegetation - clm4_5_1_r111 sacks 06/12/2015 Remove temporary hack to get bfb results in InitSnowLayers - clm4_5_1_r110 sacks 06/12/2015 Add flexibility to have more snow layers - clm4_5_1_r109 sacks 06/06/2015 Fix bug in DivideSnowLayers - clm4_5_1_r108 andre 05/29/2015 Crop changes from Sam Levis - clm4_5_1_r107 andre 05/19/2015 Update externals to use github version of cime1.0.7. - clm4_5_1_r106 erik 05/14/2015 Fix CO2 forcing for MEGAN - clm4_5_1_r105 erik 04/16/2015 Move test lists to beneath active components, change build scripts from cshell to perl, move to new cime directory structure - clm4_5_1_r104 erik 01/27/2015 Update externals to latest cesm beta tag + bring in shared build for clm4_5/clm5_0 for testing - clm4_5_1_r103 sacks 01/01/2015 enable transient crops - clm4_5_1_r102 sacks 12/27/2014 make new input datasets to support transient crops - clm4_5_1_r101 sacks 12/09/2014 rework cold start initialization for transient runs - clm4_5_1_r100 sacks 12/03/2014 update pio calls to pio2 API - clm4_5_1_r099 sacks 12/02/2014 add ozone stress code from Danica Lombardozzi - clm4_5_1_r098 sacks 11/29/2014 update externals to cesm1_3_beta14 or beyond - clm4_5_1_r097 mvertens 11/24/2014 major refactorization to introduce new soilbiogeochem data types and routines that are independent of either ED or CN datatypes - clm4_5_1_r096 erik 11/19/2014 Several answer changing bug-fixes: snow grain size, lake hydrology, default settings, organic soil - clm4_5_1_r095 andre 11/10/2014 N comp refactoring by Jinyun Tang (LBL) and transpiration sink isolation by Gautam Bisht (LBL) - clm4_5_1_r094 sacks 11/07/2014 misc. glacier-related updates - clm4_5_1_r093 sacks 11/07/2014 change cold-start snow initialization, update cism external - clm4_5_1_r092 muszala 11/04/2014 bug fixes from santos that address valgrind problems. update rtm external - clm4_5_1_r091 muszala 10/27/2014 update externals. fix bug so CLM runs with Intel 14x. - clm4_5_1_r090 sacks 10/16/2014 modularize irrigation; do some unit test rework - clm4_5_1_r089 erik 10/13/2014 Bring new urban building temperature to trunk as a clm5.0 feature as well as human-stress index calculations - clm4_5_1_r088 muszala 10/01/2014 pull out ED deps. in TemperatureTypeMod, can now compile with pgi 14.7 - clm4_5_1_r087 erik 09/30/2014 Fix two balance check errors, and turn abort for balance check back on to appropriate levels - clm4_5_1_r086 muszala 09/25/2014 critical ED modifications from r fisher, fix bug 2043 - clm4_5_1_r085 sacks 09/19/2014 replace conditionals with polymorphism for soil water retention curve - clm4_5_1_r084 sacks 09/18/2014 make glc_dyn_runoff_routing spatially-varying, based on input from glc - clm4_5_1_r083 muszala 09/17/2014 only update scripts and run new baselines. this due to an error in yellowstone pgi test naming (clm_aux45 changed to aux_clm45) - clm4_5_1_r082 muszala 09/11/2014 Merge in a number of ED changes to address science bugs and infrastructure (partiulararly restarts) - clm4_5_1_r081 mvertens 08/24/2014 major infrastructure changes and directory reorganization under src - clm4_5_1_r080 erik 08/16/2014 Update externals to trunk version, allow eighth degree as a valid resolution - clm4_5_1_r079 andre 07/31/2014 G. Bisht (LBL) soil temperature refactor; machines update for goldbach-intel - clm4_5_1_r078 muszala 07/23/2014 add lai stream capability and the ability to run with V5 cruncep data - clm4_5_1_r077 andre 07/10/2014 Refactor from Jinyun Tang (LBL) to make hydrology more modular. - clm4_5_1_r076 erik 07/07/2014 Answer changes for fire code from Fang Li - clm4_5_75 muszala 05/30/2014 update externals to rtm1_0_38 and esmf_wrf_timemgr_140523 - clm4_5_74 sacks 05/28/2014 misc. bfb changes - see detailed summary below - clm4_5_73 erik 05/28/2014 Add the stub ability for clm5_0 physics to CLM build system - clm4_5_72 muszala 05/05/2014 Introduce code for Ecosystem Demography (CLM(ED)) Model - clm4_5_71 sacks 05/02/2014 2-way feedbacks for glacier, veg columns compute glacier SMB, and related changes - clm4_5_70 muszala 04/18/2014 bring in SHR_ASSERT macros - clm4_5_69 andre 03/18/2014 start unit testing build-namelist - clm4_5_68 erik 03/07/2014 Update scripts to version that turns on transient CO2 streams for transient compsets, and update CISM (changes answers) - clm4_5_67 mvertens 03/06/2014 removed initSurfAlb as part of the initialization - clm4_5_66 mvertens 03/03/2014 refactoring of initialization and introduction of run-time finidat interpolation - clm4_5_65 mvertens 02/25/2014 Turn off MEGAN vocs when crops is running - clm4_5_64 muszala 02/19/2014 fix and clean ncdio_pio.F90.in. clean clm_time_manager. update externals. - clm4_5_63 sacks 02/14/2014 add some code needed for dynamic landunits; activate 0-weight veg landunit sometimes - clm4_5_62 erik 02/10/2014 Get PTCLM working robustly, US-UMB test working, add CO2 streams to datm, add more consistency testing between compsets and user settings - clm4_5_61 sacks 02/04/2014 add 3-d snow history fields; continue harvest past end of pftdyn timeseries - clm4_5_60 andre 01/30/2014 refactor build-namelist - clm4_5_59 sacks 01/22/2014 use new get_curr_yearfrac function in clm_time_manager - clm4_5_58 sacks 01/22/2014 major refactor of transient pft code, in prep for dynamic landunits - clm4_5_57 sacks 01/07/2014 change CNDV water conservation to use the pftdyn method - clm4_5_56 sacks 01/02/2014 update scripts external to fix I20TRCLM45BGC compset - clm4_5_55 sacks 12/27/2013 add hooks to Sean Santos's unit test frameworks, and begin to add CLM unit tests - clm4_5_54 sacks 12/27/2013 update externals to cesm1_3_beta06 - clm4_5_53 muszala 12/19/2013 refactor restart interfaces - clm4_5_52 sacks 11/26/2013 turn on longwave radiation downscaling for glc_mec by default - clm4_5_51 sacks 11/26/2013 rework downscaling of atm fields for glc_mec - clm4_5_50 erik 11/24/2013 Bring in a bunch of b4b bugfixes, fix getregional script, start move of PTCLM to PTCLMmkdata tool - clm4_5_49 muszala 11/16/2013 swenson anomaly forcing - part 1 - clm4_5_48 muszala 11/14/2013 bug fixes for CLM dry deposition and MEGAN VOC emissions - clm4_5_47 muszala 11/12/2013 fix Bug 1858 - AGDD now reset annually - clm4_5_46 sacks 11/08/2013 remove zeroing out of slope for special landunits - clm4_5_45 sacks 11/08/2013 refactor daylength calculation, and other minor changes - clm4_5_44 sacks 11/08/2013 temporary hack to daylength initialization to provide baselines for the next tag - clm4_5_43 sacks 11/06/2013 allocate memory for most landunits in every grid cell (needed for dynamic landunits) - clm4_5_42 sacks 11/04/2013 fix bug 1857 for CLM4.5 - CNDV running temperature means are incorrect - clm4_5_41 andre 10/30/2013 update scripts to convert clm4_5 CPP flags to namelist variables. - clm4_5_40 muszala 10/24/2013 fix Bug 1752 - urban conductances depend on weights in an undesirable way - clm4_5_39 muszala 10/23/2013 bug fix from santos - h2osoi_vol not passed to atmosphere model on restart - clm4_5_38 sacks 10/18/2013 change irrigation variables to be pft-level - clm4_5_37 muszala 10/10/2013 Modifications to bring clm up to date with major driver refactoring in drvseq5_0_01 - clm4_5_36 sacks 10/04/2013 new surface datasets, and other minor fixes - clm4_5_35 sacks 10/01/2013 get CLM running on edison - clm4_5_34 erik 09/30/2013 Get PTCLM working, fix a few small bugs - clm4_5_33 muszala 09/26/2013 clean up from mistakes in previous tag - clm4_5_32 muszala 09/26/2013 bug fix tag - 1798, 1810 - clm4_5_31 sacks 09/25/2013 fix bug 1820: incomplete conditional in CNSoyfix leads to buggy results and decomposition dependence - clm4_5_30 sacks 09/24/2013 fix performance bug in decomposition initialization - clm4_5_29 sacks 09/24/2013 fix threading in CLM4.5, and other misc fixes - clm4_5_28 sacks 09/20/2013 fix FracH2oSfc bug - clm4_5_27 sacks 09/20/2013 fix crop nyrs bug - clm4_5_26 muszala 09/19/2013 water balance and SMS_Ly1.f19_g16.ICLM45BGCCROP fix - clm4_5_25 erik 09/13/2013 Bring in Tony's changes to kick sno all the way up to the coupler layer, makes all - CESM components more similar to each other - clm4_5_24 sacks 09/03/2013 update externals to cesm1_3_beta02 or later - clm4_5_23 muszala 08/22/2013 refactor to allow CH4 params. to be read from netcdf file and clean up clm4_5_20 - clm4_5_22 muszala 07/30/2013 aux_clm testlist reorganization - clm4_5_21 muszala 07/24/2013 ifdef and bounds refactor - clm4_5_20 muszala 07/20/2013 refactor to allow CN and BGC params. to be read from netcdf file - clm4_5_19 sacks 07/17/2013 fix setting of bd in iniTimeConst - clm4_5_18 sacks 07/09/2013 rework urban indexing - clm4_5_17 sacks 07/03/2013 misc cleanup and bug fixes - clm4_5_16 sacks 07/02/2013 only run filters over 'active' points - clm4_5_15 muszala 07/01/2013 complete associate refactor for pointers in clm4_5 source - clm4_5_14 muszala 06/20/2013 preparation for associate refactor in clm4_5_15 - clm4_5_13 andre 06/14/2013 hydrology reordering from Jinyun Tang - clm4_5_12 muszala 06/13/2013 NoVS test, NAG mods and remove TWS from restart file - clm4_5_11 sacks 06/11/2013 Change pct_pft and related surface dataset variables to be % of landunit - clm4_5_10 muszala 06/10/2013 refactor clmtype - clm4_5_09 muszala 06/04/2013 volr and vic fix, update mct and rtm - clm4_5_08 muszala 06/03/2013 port for NAG compiler - clm4_5_07 erik 05/31/2013 New spinup files for CLM45 AND RTM, work on PTCLM, turn drydep off by default, update externals - clm4_5_06 erik 05/15/2013 A few small bug fixes, more updates to README files - clm4_5_05 muszala 05/14/2013 hcru bug fixes - clm4_5_04 erik 05/13/2013 Fix the previous broken tag - clm4_5_03 erik 05/10/2013 Several bug fixes for release, urban and test single point surface datasets - clm4_5_02 sacks 05/07/2013 make 'shared' tools directory, and other minor tools fixes - clm4_5_01 muszala 05/06/2013 update externals - clm4_5_00 erik 05/02/2013 Official end to CLM4.5 development for CLM offline - clm4_0_81 bandre 04/29/2013 Charlie Koven's variable consolidation, cryoturbation and BSW CPP changes - clm4_0_80 erik 04/26/2013 Bring Fang Li. Fire model into CLM4.5 science, update ALL CLM4.5 surface datasets, - provide a working initial condition file for CLM45BGC@f19_g16-1850 - clm4_0_79 muszala 04/24/2013 pftdyn, pft-phys*.nc and datm8 update - clm4_0_78 muszala 04/23/2013 MEGAN fixes - clm4_0_77 sacks 04/23/2013 fix carbon balance bug in transient runs with VERTSOI, and fix Soil Hydrology bug - clm4_0_76 muszala 04/22/2013 spinup changes from Charlie Koven (part 1) - clm4_0_75 muszala 04/19/2013 run propset - clm4_0_74 muszala 04/17/2013 snow_depth changes, major scripts overhaul, bug fix for tools - clm4_0_73 sacks 04/15/2013 update mksurfdata_map for CLM4.5, and other misc. updates, mainly to tools - clm4_0_72 muszala 04/11/2013 maoyi bug fix for vic hydro - clm4_0_71 muszala 04/10/2013 compsets refactoring by mvertens - clm4_0_70 muszala 04/01/2013 bring in vic hydrology - clm4_0_69 muszala 03/26/2013 remove hydro reorder, volr and esmf mods - clm4_0_68 erik 03/16/2013 Fix some issues in mksurfdata_map for generation of ne120np surface data file. - Put error back in CLM if weights don't sum to 100. Add in Keith's photosynthesis change for CLM45. - clm4_0_67 muszala 03/12/2013 Jinyun photosynthesis and hydrology reorder - clm4_0_66 sacks 03/07/2013 turn off subgrid topography snow parameterization for glc_mec landunits - clm4_0_65 sacks 03/07/2013 back out Machines external to get more tests to pass, especially IG - clm4_0_64 muszala 03/06/2013 update externals. fixes 40/45 intial condition problem - clm4_0_63 muszala 03/04/2013 bug 1635 fix - 4_0 CN bug - clm4_0_62 sacks 02/24/2013 add active flags, change subgrid weighting convention, other misc fixes - clm4_0_61 muszala 02/20/2013 rtm, drv and clm mods: tws, olr, r01 rdric file and SoilHydroMod - clm4_0_60 erik 02/11/2013 Bring CLM4.5 code from clm45sci branch to trunk as an option set at configure time - clm4_0_59 mvertens 12/20/2012 restructure clmtype and all pointer references, new directory structure - clm4_0_58 erik 12/14/2012 Uncomment us20 and wus12 datasets, more testing to: bluefire, yellowstone, frankfurt - clm4_0_57 muszala 11/30/2012 update trunk with release mods, some rtm fixes - clm4_0_56 sacks 11/27/2012 fix s2x tsrf, add s2x diagnostics - clm4_0_55 muszala 11/14/2012 bring in flooding capability - clm4_0_54 erik 10/09/2012 Fix esmf for carma field, fix some CLM_USRDAT issues - clm4_0_53 erik 10/03/2012 Update to fsurdat, fpftdyn, finidat datasets, new high resolution organic/fmax/glacier raw datasets - clm4_0_52 sacks 09/27/2012 new pct_glacier raw data file - clm4_0_51 muszala 09/26/2012 bug fixes, pio performance and SCRIP files - clm4_0_50 muszala 09/21/2012 testing of clm and new rof component - clm4_0_49 erik 09/16/2012 Move clm testing to use CESM test framework - clm4_0_48 muszala 09/11/2012 bug fixes, xFail to tests and normalize test output for CLM - clm4_0_47 muszala 08/23/2012 bug fixes - clm4_0_46 muszala 08/08/2012 R01 support and update externals - clm4_0_45 sacks 07/20/2012 fix virtual columns; new urban mksurfdata_map - clm4_0_44 erik 07/09/2012 Add wrf resolutions, update externals to cesm1_1_beta15, all components use build-namelist now - clm4_0_43 sacks 04/06/2012 Add diagnostic fields, modify some existing history fields - clm4_0_42 erik 03/27/2012 Bring in Francis Vitt's MEGAN changes. - clm4_0_41 erik 03/13/2012 Bring rmfmesh/rtmmap branches to trunk - clm4_0_40 erik 02/16/2012 Back out update to new T31 surface datasets - clm4_0_39 erik 02/01/2012 Bring newgrid branch to trunk - clm4_0_38 erik 01/23/2012 Fix f09 surface datasets - clm4_0_37 erik 09/26/2011 Fix unstructured grids history files - clm4_0_36 erik 09/22/2011 Comment out RTM mapping files for f09 and f19 - clm4_0_35 erik 09/13/2011 Bring in Mariana's non2D grid branch to trunk, enabling HOMME grids: ne30np4/ne120np4 - clm4_0_34 erik 08/18/2011 Bring tcens branch to trunk, fix a few issues - clm4_0_33 erik 07/25/2011 Move changes on release branch over to trunk - clm4_0_32 erik 05/19/2011 Make I1850SPINUPCN compset use MOAR data, various bug fixes, work on test lists - clm4_0_31 erik 05/13/2011 Fix answers for transient_CN, fix interpinic - clm4_0_30 erik 05/11/2011 New finidat/fsurdat files for T31 - clm4_0_29 erik 05/05/2011 Backout interpinic changes to one that works - clm4_0_28 erik 05/03/2011 Remove DUST/PROGSSLT in land coupler layer, update driver and scripts - clm4_0_27 erik 05/02/2011 Move crop branch over to trunk - clm4_0_26 erik 03/23/2011 Update externals, driver update changes answers, drydep changes from fvitt, fix bugs - clm4_0_25 erik 03/22/2011 Always output restart-history files add more meta-data to them, fix urbanc_alpha and 2.5x3.33 datasets, Changes from Keith O on SNOWLIQ/SNOWICE - clm4_0_24 erik 02/09/2011 Fix mksurfdata and add ability to override soil_fmax - clm4_0_23 erik 02/03/2011 Add in new glacier-MEC use-cases - clm4_0_22 erik 01/20/2011 Move coupler field indicies to clm, move cpl_* directories up a level, add the cpl_share directory - clm4_0_21 jedwards 01/12/2011 Remove includes, finish PIO transition - clm4_0_20 erik 01/11/2011 Update for ESMF metadata, update doc. from release branch, bug fixes (doc of qflx_evap_tot, threading CNDV, aer/ndepregrid) - clm4_0_19 erik 12/08/2010 Bring irrigation branch to the trunk - clm4_0_18 erik 11/21/2010 Fix a problem with the clm template, update scripts version to fix bug with linking with ESMF - clm4_0_17 erik 11/20/2010 Update to externals that change answers to roundoff, use drv pio namelist, add in T341 datasets - clm4_0_16 erik/mverten 10/27/2010 Fix downscaling roundoff difference for same-grids by copying scale factor when needed - clm4_0_15 erik/mverten 10/24/2010 Move pio branch to trunk - clm4_0_14 erik 10/19/2010 Fix finidat file for T31 sim_year=2000 cases - clm4_0_13 erik 10/16/2010 Bring in PTCLM branch, add in T31 finidat file and turn off ice_runoff for T31 - clm4_0_12 erik 09/10/2010 Add U10 to history, cesm1_0_rel06 updates, PTCLM02 updates (except mksurfdata), remove ndepdat/dyn/faerdep - clm4_0_11 erik 08/27/2010 New files for rcp6, fix MPI bug, update externals - clm4_0_10 erik 08/04/2010 Update doc to cesm_rel05, bug-fixes, fix issues for single-point, mksurfdata/getregional scripts - clm4_0_09 erik 06/14/2010 Fix some small issues, update documentation, and externals - clm4_0_08 erik 06/04/2010 Snow hydrology bug fix from Keith and Dave - clm4_0_07 erik 06/03/2010 Some cleanup/fix bugs, add RTM var, add albice to namelist, allow last-millenium in mksurfdata, allow setting of datm_presaero in clm test-suite - clm4_0_06 erik 05/26/2010 Update gglc to cism - clm4_0_05 erik 05/25/2010 Move Nitrogen deposition stream branch to trunk - clm4_0_04 erik 05/20/2010 New namelist items: ice_runoff, scaled_harvest, carbon_only, - new RTM hist vars, new finidat files, update esmf interface, turn off aerosol read quicker - clm4_0_03 erik 05/17/2010 Changes from Francis for VOC and drydep - clm4_0_02 erik 05/13/2010 Make sure dtime is initialized, so that answers are consistently the same as clm4_0_00 - clm4_0_01 erik 05/11/2010 Move glacier multiple elevation class branch to the trunk so that we can work with the active glacier model - clm4_0_00 erik 05/04/2010 Update to datm8, redirect aquifer overflow - to drainage, add gx3v7 masks, script to extract regional - datasets, add harvesting for CN, modify shrubs, include urban - model, ice stream for snowcapping, new build-namelist system, - scale solar by solar zenith angle in datm, deep soil with - bedrock at bottom, organic matter in soils, SNICAR for snow - radiation, sparce dense aero, snow cover changes - clm3_8_00 erik 05/04/2010 Get future scenarios working, finalize - documentation, bring in MEGAN VOC and CNDV, simplify, - mksurfdata optimization, fix bugs: snow enthalpy, BMOZ, pergro, - use pft weights from fsurdat NOT finidat - clm3_7_15 erik 04/27/2010 Finish User's Guide, surfdata files for urban-1pt, fix mksurfdata ifort bugs, work with testing - clm3_7_14 erik 04/08/2010 Fix rcp=2.6/4.5 1-degree fndepdyn filenames - clm3_7_13 erik 04/08/2010 Add in missing rcp=2.6/6 use-cases, and fix syntax errors in the namelist_defaults file - clm3_7_12 erik 04/08/2010 rcp=2.6/4.5 datasets for fndepdyn and aerdepdat, fix some minor issues, new 1pt urban surfdata files - clm3_7_11 erik 04/07/2010 qtr-degree and T85 surfdata, rcp=2.6/4.5 datasets, doc updates - clm3_7_10 erik 03/22/2010 Fix drydep so that BMOZ case will work - clm3_7_09 erik 03/21/2010 Fix snow enthalpy bug, cndv datasets, various fixes - clm3_7_08 mvertens 03/12/2010 Removal of check for weights if dynamic land use is - used - clm3_7_07 erik 03/10/2010 New finidat datasets for 1-deg, 2-deg, and abort if weights from finidat/fsurdat files are too different, and use fsurdat files as truth - clm3_7_06 erik 03/10/2010 Bring cndv branch to trunk - clm3_7_05 erik 02/24/2010 Bring VOC branch source code to trunk - clm3_7_04 erik 02/17/2010 Bring VOC branch (vocemis-drydep18_clm3_7_03) tools, testing, and build to trunk (everything other than VOC code changes) - clm3_7_03 erik 02/10/2010 Add in more future scenario datasets, new history fields from Keith - clm3_7_02 erik 02/06/2010 Start adding in new rcp=8.5 datasets, remove some junk, change some env_conf variables, add user_nl_clm - clm3_7_01 erik 01/29/2010 OpenMP fix for pftdyn, start adding in rcp's, update ndeplintInterp.ncl script - clm3_7_00 erik 01/22/2010 Update to datm8, redirect aquifer overflow to drainage, add gx3v7 masks, script to extract regional datasets, add harvesting for CN, modify shrubs, include urban model, ice stream for snowcapping, new build-namelist system, scale solar by solar zenith angle in datm, deep soil with bedrock at bottom, organic matter in soils, SNICAR for snow radiation, sparce dense aero, snow cover changes - clm3_6_64 erik 01/22/2010 Update documentation and README/Quickstart files, set NetCDF large-file format on by default in template, update pio, update some fsurdat files to vocemis-drydep versions, add 2.5x3.33_gx3v7 frac file, make gx3v7 default for 4x5 res - clm3_6_63 erik 01/09/2010 Get answers to be identical with ccsm4_0_beta38 for 1 and 2 degree transient cases - clm3_6_62 erik 01/08/2010 Fix startup of PFT transient cases so properly use data from pftdyn file rather than finidat file - clm3_6_61 erik 01/07/2010 Comment out endrun on finidat and fsurdat weights being incomptable, and go back to using finidat weights - clm3_6_60 erik 01/05/2010 Fix clm template - clm3_6_59 erik 01/05/2010 Update to datm8, fix so wts used are from fsurdat file NOT finidat file - clm3_6_58 erik 12/08/2009 Fix rpointer, correct units for export of nee, start adding testing for intrepid - clm3_6_57 erik 11/20/2009 Redirect aquifer overflow to drainage, so doesn't end up in ocean - clm3_6_56 erik 11/10/2009 New ndepdat and ndepdyn datasets - clm3_6_55 erik 11/05/2009 Fix tool to create Nitrogen deposition datasets, and change configure to use CCSM Makefile as source for TopLevel Makefile - clm3_6_54 erik 10/28/2009 Allow comp_intf to change on ccsm build, reduce default hist fields, start adding 2.5x3.33, start adding VOC fsurdat datasets, new finidat files for f09 and f19 - clm3_6_53 erik 09/22/2009 Fix so that T31_gx3v7 file is actually included - clm3_6_52 erik 09/17/2009 Add T31_gx3v7 support, remove forganic, read from fsurdat, add script to extract regional datasets, work with CN output, add more urban/rural fields - clm3_6_51 erik 09/01/2009 Update fndepdyn and aerdep datasets (f02,f05,f09,f10) (1850,2000) and f09, f10 transient (1850-2000) - clm3_6_50 erik 08/28/2009 Fix ncl regridding scripts so that NO missing values are allowed for aerosol and nitrogen deposition - clm3_6_49 erik 08/25/2009 Fix ncl interpolation scripts, update externals, turn on CLM_CCSM_BLD for bluefire,jaguar, ESMF3 compliance - clm3_6_48 erik 08/12/2009 New aerosol/nitrogen deposition datasets, mksurfdata work, scm work, clm_usr_name option to build-namelist - clm3_6_47 erik 08/03/2009 Fix hybrid bug for dynpft case, update externals - clm3_6_46 erik 07/22/2009 Get more tests to work/document them, add use cases for 1850_control, 2000_control, and - 20thC_transient, straighten out single-point grids, Listen to LND_CDF64 env variable from - template, remove CLM_ARB_IC. - clm3_6_45 erik 07/10/2009 Remove inconsistent finidat file in clm3_6_44 - clm3_6_44 erik 07/09/2009 Fix C13 bug, update scripts, drv, datm. Add domain files for idmap atm-ocn grids for datm. Remove SEQ_MCT, add new ESMF env vars to template. Work with ndeplintInterp - clm3_6_43 erik 06/10/2009 Fix pftdyn bug, enable 1D primary hist files, fix time-const3D output, fix template bug, enable cpl_esmf/cpl_mct - clm3_6_42 erik 06/02/2009 Bring CN Harvest branch to trunk - clm3_6_41 kauff 05/29/2009 shrub mods, abort if nthreads > 1 (temporary, wrt bugz #965) - clm3_6_40 erik 05/28/2009 Fix openMP bug, add fndepdyn ncl script, fix interpinic for urban, add mkharvest to mksurfdata, new spinups, turn CLAMP on for CASA or CN - clm3_6_39 erik 05/07/2009 Bug fix for script version and maxpatchpft back to numpft+1 - clm3_6_38 erik 05/06/2009 New fsurdat for other resolutions, bug-fixes, deep wetlands to bedrock, new spinups for 1.9x2.5 1850, 2000 - clm3_6_37 erik 04/27/2009 Update faerdep dataset for 1.9x2.5 to point to version cice is using for 1850 and 2000 - clm3_6_36 erik 04/27/2009 Handle transient aersol, make maxpatchpft=numpft+1 default, new datasets for 1.9x2.5 and 0.9x1.25, change doalb - clm3_6_35 erik 04/20/2009 Fix major logic bug in mksurfdata - clm3_6_34 oleson 04/19/2009 Fix bangkok urban bug - clm3_6_33 erik 04/16/2009 Bring in dynpft changes from cbgc branch - clm3_6_32 erik 04/15/2009 Add irrigation area to mksrfdata, fix high-res and pftdyn problems - clm3_6_31 erik 04/01/2009 New surface datasets for 1850,2000, support for 0.9x1.25_gx1v6, urban always on. New pft-physiology file. Update scripts so remove some CLM_ env_conf vars. Fix CN for urban/pftdyn. - clm3_6_30 oleson 03/19/2009 Fix urban roof/wall layers - clm3_6_29 oleson 03/19/2009 CN SAI, CN testing fix, rad step size fix - clm3_6_28 oleson 03/17/2009 Fix permission denied error when reading surface dataset - clm3_6_27 oleson 03/16/2009 Urban model changes and FGR12 fix - clm3_6_25 dlawren 03/13/2009 Daylength control on Vcmax, 1%Lake,wetland,glacier in mksrfdat, remove ELEVATION in surface data file - clm3_6_24 oleson 03/09/2009 Fix urban testing and some history field changes - clm3_6_23 oleson 03/08/2009 Prune history fields and change to snowdp threshold for solar radiation penetration into snow - clm3_6_21 oleson 03/04/2009 History file changes and finish testing on tags clm3_6_19 and clm3_6_20 - clm3_6_19 oleson 02/27/2009 Changes to urban model and urban surface data - clm3_6_17 oleson 02/26/2009 Urban model changes and mksurfdata changes to incorporate urban data - clm3_6_16 erik 02/12/2009 Multiple elevation classes on surface dataset, urban fixes, mpi-serial and testing fixes - clm3_6_15 erik 01/19/2009 Bring clm36sci branch to the trunk - clm3_6_14 erik 10/10/2008 Fix some global urban issues, fix pftdyn, really get compile-only option - working in testing - clm3_6_13 erik 10/01/2008 Update to new version of cpl7 scripts and build, update externals for versions - needed for clm36sci branch, add new CASA tests - clm3_6_12 erik 09/21/2008 Fix restarts for urban, add capability to do global urban experiments, - add in new forcing height changes - clm3_6_11 dlawren 08/26/2008 Ice stream for snow capped regions - clm3_6_10 tcraig 08/15/2008 extend rtm tracer, ascale for tri-grids, AIX O3 to O2 - clm3_6_09 erik 08/11/2008 Fix clm.cpl7.template to run hybrid and branch cases - clm3_6_08 erik 08/06/2008 Fix bugs, and build changes for inputdata repo - clm3_6_07 erik 07/08/2008 Implement new build namelist system from Vertenstein/Eaton, bluefire, and BGP updates - clm3_6_06 erik 05/30/2008 Small fix needed for ccsm4_alpha30 - (use gx1v5 for some resolutions when OCN_GRID==ATM_GRID) - clm3_6_05 erik 05/27/2008 Fix to compile with PGI-6, update scripts, fix cpl7.template for new scripts LND_GRID, - fix 2.65x3.33 frac dataset. - clm3_6_04 erik 05/20/2008 Remove all MCT permutes, fix cpl7 script issues, remove offline mode, - add ability to run over a range of years - clm3_6_03 erik 05/08/2008 Fix so listen to next_swcday to calculate albedo rather than using irad - clm3_6_02 erik 03/25/2008 Minor fix in configure remove perl5lib version under models/lnd/clm/bld - clm3_6_01 erik 03/20/2008 40 m forcing height changes for clm - clm3_6_00 erik 03/20/2008 Fully implement sequential-ccsm mode, upgrade configure, build-namelist and testing, - upgrade interpolation tool, add mkdatadomain, write to iulog rather than 6 explicitly, - SCAM update, Update datasets, add archiving, and build-streams, add in point version - of Urban model, change directory structure to mimic CCSM - clm3_5_20 erik 03/17/2008 Bug fixes before spinning off clm3_6_00, put in changes from ccsm4a01_clm3_5_18 - to ccsm4a04_clm3_5_18 - clm3_5_19 erik 03/06/2008 Change directory structure to mimic CCSM, fix so no NaNS on BGC interpinic output, - new half degree CN clmi dataset - clm3_5_18 erik 02/21/2008 Update to latest seq-ccsm4.alpha tag - clm3_5_17 erik 02/06/2008 Merge Tony Craig's FMI branch fmi12_clm3_5_16 to the clm trunk - clm3_5_16 erik 01/28/2008 Get point version of Urban code onto trunk (urban code can not restart) - clm3_5_15 erik 12/10/2007 Fix interpinic for half degree grid, add in large-file support, - allow configure to work with ccsm directory structure - clm3_5_14 erik 11/27/2007 Use build-streams, and archiving, multiple bug-fixes - clm3_5_13 erik 11/16/2007 Update xml file with file needed for ccsm3_5_beta18 - clm3_5_12 erik 11/08/2007 Tag with new files needed for ccsm3_5_beta17 - clm3_5_11 erik 09/28/2007 Update datasets in the DefaultCLM file for 0.23x0.31, 0.47x0.63, 0.9x1.25 and - add fndepdyn file for 1.9x2.5 - clm3_5_10 jet 09/18/2007 SCAM update - clm3_5_09 erik 08/31/2007 Change configure to NOT have csm_share code for ccsm_con option, and add in 1x1.25 file, - and update datm7 and csm_share - clm3_5_08 tcraig 08/20/2007 convert 6 to iulog in logfile, updates for I/O - clm3_5_07 erik 08/17/2007 Add mkdatadomain tool, add cprnc and perl5lib as externals - clm3_5_06 erik 08/10/2007 Update: interpolation, testing, script namelist build, and scripts. Fix bugs, - and fix possible - clm3_5_05 tcraig 07/11/2007 seq clm mods and first hist refactor mods - clm3_5_04 mvertens 06/05/2007 lnd_comp_mct.F90 change to work with sequential diagnostics - clm3_5_03 tcraig 05/23/2007 reduce memory, partial I/O refactor, downscaling implementation - clm3_5_02 mvertens 05/22/2007 put in hourly coupling with sequential driver - clm3_5_01 erik 05/16/2007 Move newcn06 branch to trunk - clm3_5_00 erik 05/03/2007 New surface datasets, improved canopy integration, and various improvements to Hydrology diff --git a/doc/IMPORTANT_NOTES b/doc/IMPORTANT_NOTES deleted file mode 100644 index 1ff8949139..0000000000 --- a/doc/IMPORTANT_NOTES +++ /dev/null @@ -1,69 +0,0 @@ -$CTSMROOT/doc/IMPORTANT_NOTES Jun/08/2018 - Erik Kluzek - -I.) For clm4_0: - -Configure Modes NOT scientifically validated, documented, supported or even advised to be used: -(options to CLM_CONFIG_OPTS) - - SNICAR_FRC (-snicar_frc) - This mode is tested and functional, but is NOT constantly scientifcally validated, and should be - considered experimental. - -Namelist items that should NOT be exercised: - - glc_dyntopo Change topographic height over glacier MEC (Not functional) - suplnitro='ALL' (suplnitro='ALL' with -bgc cn) - The suplemental Nitrogen mode of the CN model is known - to be too productive. - urban_traffic: Not currently functional - -II.) For clm4_5/clm5_0: - -Namelist items that are not regularly tested or used. Some aren't even implemented. - - See - - ../bld/namelist_files/namelist_definition_clm4_5.xml -- for definitions - - CN_evergreen_phenology_opt - CN_partition_opt - CN_residual_opt - CNratio_floating - all_active - allowlakeprod - anoxia_wtsat - carbon_resp_opt - ch4offline - downreg_opt - fin_use_fsat - lake_decomp_fact - no_frozen_nitrif_denitrif - nscalar_opt - perchroot - perchroot_alt - plant_ndemand_opt - reduce_dayl_factor - replenishlakec - substrate_term_opt - temp_scalar_opt - urban_traffic - use_extralakelayers - use_lai_streams - use_snicar_frc - use_vichydro - usefrootc - vcmax_opt = 4 - - FATES namelist options: FATES is a new experiemental subcomponent where all of it's options are - under current development. As such FATES and all of it's options should - be considered experimental. - - use_fates - use_fates_spitfire - use_fates_logging - use_fates_planthydro - use_fates_ed_st3 - use_fates_ed_prescribed_phys - use_fates_inventory_init - fates_inventory_ctrl_filename diff --git a/doc/Quickstart.GUIDE b/doc/Quickstart.GUIDE deleted file mode 100644 index 86550653fd..0000000000 --- a/doc/Quickstart.GUIDE +++ /dev/null @@ -1,60 +0,0 @@ -$CTSMROOT/doc/Quickstart.GUIDE Jun/08/2018 - - Quick-Start to Using cpl7 Scripts for clm5_0 - ============================================ - -Assumptions: You want to use cheyenne with clm5_0 BGC - to do a clm simulation with data atmosphere and the - latest GSWP3v1 atm forcing files and settings. You also want to cycle - the GSWP3v1 atm data between 1950 to 2010 and you want to run at - 0.9x1.25 degree resolution. - -Process: - - # Create the case - - cd cime/scripts - - ./create_newcase --case --mach cheyenne --res f09_g16_gl4 -compset I2000Clm50BgcCrop - (./create_newcase -help -- to get help on the script) - - # Setup the case - - cd - ./xmlchange id1=val1,id2=val2 # to make changes to any settings in the env_*.xml files - ./case.setup - (./case.setup -help -- to get help on the script) - - # Add any namelist changes to the user_nl_* files - - $EDITOR user_nl_* - - # Compile the code - - ./case.build - - # Submit the run - - ./case.submit - -Information on Compsets: - - "I" compsets are the ones with clm and datm7 without ice and ocean. - Most of the "I" compsets for CLM5.0 use the GSWP3v1 data with solar following - the cosine of solar zenith angle, precipitation constant, and other - variables linear interpolated in time (and with appropriate time-stamps on - the date). - - To get a list of the "I" compsets use the "query_config" utility in cime/scripts - - ./query_config --compsets clm - -Automatically resubmitting jobs: - - After doing a short simulation that you believe is correct - - ./xmlchange CONTINUE_RUN=TRUE - - # Change RESUBMIT to number greater than 0, and CONTINUE_RUN to TRUE... - - ./case.submit diff --git a/doc/UpdateChangelog.pl b/doc/UpdateChangelog.pl deleted file mode 100755 index 78a3afe42d..0000000000 --- a/doc/UpdateChangelog.pl +++ /dev/null @@ -1,207 +0,0 @@ -#!/usr/bin/env perl -#======================================================================= -# -# This is a script to update the ChangeLog -# -# Usage: -# -# perl ChangeLog tag-name One-line summary -# -# -#======================================================================= - -use strict; -use Getopt::Long; -use IO::File; -#use warnings; -#use diagnostics; - -use English; - -my $ProgName; -($ProgName = $PROGRAM_NAME) =~ s!(.*)/!!; # name of program -my $ProgDir = $1; # name of directory where program lives - -sub usage { - die < - -OPTIONS - -help [or -h] Help on this script. - -update [or -u] Just update the date/time for the latest tag - In this case no other arguments should be given. -ARGUMENTS - Tag name of tag to document - Short summary description of this tag -EXAMPLES: - To just update the date/time for the latest tag - - $ProgName -update - - To document a new tag - - $ProgName release-elm5.0.09 "Description of this tag" -EOF -} - -my %opts = { - help => 0, - update => 0, - }; -GetOptions( - "h|help" => \$opts{'help'}, - "u|update" => \$opts{'update'}, - ); -if ( $opts{'help'} ) { - usage(); -} -my $tag; my $sum; - -if ( ! $opts{'update'} ) { - if ( $#ARGV != 1 ) { - print "ERROR: wrong number of arguments: $ARGV\n"; - usage(); - } - - $tag = $ARGV[0]; - $sum = $ARGV[1]; - - if ( $tag !~ /release-clm[0-9]\.[0-9]\.([0-9][0-9])/ ) { - print "ERROR: bad tagname: $tag\n"; - usage(); - } -} else { - if ( $#ARGV != -1 ) { - print "ERROR: wrong number of arguments when update option picked: $ARGV\n"; - usage(); - } -} -my $EDITOR = $ENV{EDITOR}; -if ( $EDITOR !~ /.+/ ) { - print "ERROR: editor NOT set -- set the env variable EDITOR to the text editor you would like to use\n"; - usage(); -} - - -my $template = ".release-ChangeLog_template"; -my $changelog = "release-clm5.0.ChangeLog"; -my $changesum = "ChangeSum"; -my $changelog_tmp = "ChangeLog.tmp"; -my $changesum_tmp = "ChangeSum.tmp"; - -my $user = $ENV{USER}; -if ( $user !~ /.+/ ) { - die "ERROR: Could not get user name: $user"; -} -my @list = getpwnam( $user ); -my $fullname = $list[6]; -my $date = `date`; -chomp( $date ); - -if ( $date !~ /.+/ ) { - die "ERROR: Could not get date: $date\n"; -} - -# -# Deal with ChangeLog file -# -my $fh = IO::File->new($changelog_tmp, '>') or die "** $ProgName - can't open file: $changelog_tmp\n"; - -# -# If adding a new tag -- read in template and add information in -# -if ( ! $opts{'update'} ) { - open( TL, "<$template" ) || die "ERROR:: trouble opening file: $template"; - while( $_ = ) { - if ( $_ =~ /Tag name:/ ) { - chomp( $_ ); - print $fh "$_ $tag\n"; - } elsif ( $_ =~ /Originator/ ) { - chomp( $_ ); - print $fh "$_ $user ($fullname)\n"; - } elsif ( $_ =~ /Date:/ ) { - chomp( $_ ); - print $fh "$_ $date\n"; - } elsif ( $_ =~ /One-line Summary:/ ) { - chomp( $_ ); - print $fh "$_ $sum\n"; - } else { - print $fh $_; - } - } - close( TL ); -} -open( CL, "<$changelog" ) || die "ERROR:: trouble opening file: $changelog"; -my $update = $opts{'update'}; -my $oldTag = ""; -while( $_ = ) { - # If adding a new tag check that new tag name does NOT match any old tag - if ( $_ =~ /Tag name:[ ]*(release-clm.+)/ ) { - $oldTag = $1; - if ( (! $opts{'update'}) && ($tag eq $oldTag) ) { - close( CL ); - close( $fh ); - system( "/bin/rm -f $changelog_tmp" ); - print "ERROR:: New tag $tag matches a old tag name\n"; - usage(); - } - # If updating the date -- find first occurance of data and change it - # Then turn the update option to off - } elsif ( ($update) && ($_ =~ /(Date:)/) ) { - print $fh "Date: $date\n"; - print "Update $oldTag with new date: $date\n"; - $update = undef; - $_ = ; - } - print $fh $_; -} -# Close files and move to final name -close( CL ); -$fh->close( ); -system( "/bin/mv $changelog_tmp $changelog" ); -# -# Deal with ChangeSum file -# - -open( FH, ">$changesum_tmp" ) || die "ERROR:: trouble opening file: $changesum_tmp"; - -open( CS, "<$changesum" ) || die "ERROR:: trouble opening file: $changesum"; - -my $update = $opts{'update'}; - -$date = `date "+%m/%d/%Y"`; -chomp( $date ); - -while( $_ = ) { - # Find header line - if ( $_ =~ /=====================/ ) { - print FH $_; - my $format = "%17.17s %8.8s %10.10s %s\n"; - if ( $update ) { - $_ = ; - if ( /^(.{17}) (.{8}) (.{10}) (.+)$/ ) { - $tag = $1; - $user = $2; - $sum = $4; - } else { - die "ERROR: bad format for ChangeSum file\n"; - } - } - printf FH $format, $tag, $user, $date, $sum; - $_ = ; - } - print FH $_; -} -# Close files and move to final name -close( CS ); -close( FH ); -system( "/bin/mv $changesum_tmp $changesum" ); - -# -# Edit the files -# -if ( ! $opts{'update'} ) { - system( "$EDITOR $changelog" ); - system( "$EDITOR $changesum" ); -} diff --git a/doc/UsersGuide/Makefile b/doc/UsersGuide/Makefile deleted file mode 100644 index 1c76bc75bd..0000000000 --- a/doc/UsersGuide/Makefile +++ /dev/null @@ -1,193 +0,0 @@ -# -# Makefile to convert DocBook CLM Users-Guide into html and/or pdf -# (rtf, txt, ps, tex, man, dvi, and texi are also valid docbook formats) -# -VPATH := ../../tools/cprnc . .. ../../bld ../../tools/ncl_scripts \ - ../../tools/mksurfdata ../../test/system ../../bld/namelist_files \ - ../../bld/config_files ../../tools ../../../../../scripts/ccsm_utils/Tools \ - ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM/ ../../src/main - -PDFUG := clm_ug.pdf -HTMLUG := book1.html -DOCBKUG := clm_ug.xml -CFGLOG := config_help -CPRLOG := cprnc_readme -BNMLOG := buildnml_help -BSTLOG := build_streams_help -RESLOG := buildnml_resolutions -USCLOG := buildnml_usecases -QCKLOG := quickstart_guide -COPLOG := filecopies -MKSLOG := mksurfdata.pl -USRLOG := quickstart_usrdat -PTCLOG := ptclm_help -PTCLST := ptclm_list -TDRLOG := test_driver.sh -GETREG := getregional_datasets -CO2DIF := addco2_datm.buildnml -DATLOG := build_date -NMLDFTBL := namelist_definition_table -NMLDLTBL := namelist_defaults_clm_table -HSFLDTBL := history_fields_table -CFGDFTBL := config_definition_table -COMPLIST := compsets_list_ofIcases.xml -SOURCES := $(DOCBKUG) $(COMPLIST) $(CFGLOG).xml $(PTCLOG).xml $(BNMLOG).xml \ - $(RESLOG).xml $(USCLOG).xml $(QCKLOG).xml $(COPLOG).xml $(PTCLST).xml \ - $(USRLOG).xml $(GETREG).xml preface.xml custom.xml special_cases.xml \ - tools.xml adding_files.xml single_point.xml addco2_datm.buildnml.xml \ - appendix.xml trouble_shooting.xml ptclm.xml $(BSTLOG).xml \ - $(MKSLOG).xml $(TDRLOG).xml $(DATLOG).xml $(CPRLOG).xml \ - $(NMLDFTBL).xml $(NMLDLTBL).xml $(CFGDFTBL).xml $(HSFLDTBL).xml - -CONVAMP := sed 's/\&/\&/g' -CONVSIGNS := sed 's/>/\>/g' | sed 's/ tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -$(NMLDLTBL).xhtml: namelist_defaults_clm.xml namelist_defaults.xsl - xsltproc ../../bld/namelist_files/namelist_defaults.xsl $< > tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -$(CFGDFTBL).xhtml: config_definition.xml config_definition.xsl - xsltproc ../../bld/config_files/config_definition.xsl $< > tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -history_fields.xml: findHistFields.pl - cd ../../src/main; ./findHistFields.pl >& tmpFile.txt - $(RM) tmpFile.txt - -$(HSFLDTBL).xhtml: history_fields.xml history_fields.xsl - xsltproc ../../bld/namelist_files/history_fields.xsl $< > tmpFile.txt - addxhtmlhead.pl tmpFile.txt > $@ - $(RM) tmpFile.txt - -.xhtml.xml: - xsltproc stylesheethtml2docbook.xsl $< > $@ - -.tlog.xml: - $(CONVAMP) $< | $(CONVSIGNS) > tempFile.txt - limitLineLen.pl tempFile.txt > $@ - $(RM) tempFile.txt - -.diff.xml: - $(CONVAMP) $< | $(CONVSIGNS) > $@ - -debug: - @echo "SOURCES: $(SOURCES)" - @echo "CONVAMP: $(CONVAMP)" - @echo "CONVSIGNS: $(CONVSIGNS)" - -$(COMPLIST): - ./get_Icaselist.pl > $@ - -$(HTMLUG): $(SOURCES) - docbook2html --dsl clm_stylesheet.dsl#html $< - -$(PDFUG): $(SOURCES) - docbook2pdf --dsl clm_stylesheet.dsl#print $< - -$(BNMLOG).tlog: build-namelist - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/build-namelist -help >& $@ - -$(BSTLOG).tlog: build_streams - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../../../../scripts/ccsm_utils/Tools/build_streams --help >& $@ - -$(DATLOG).tlog: - @echo "Get current build date" - date +%b-%d-%Y >& $@ - -$(RESLOG).tlog: build-namelist - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/build-namelist -res list >& $@ - -$(USCLOG).tlog: build-namelist - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/build-namelist -use_case list >& $@ - -$(CFGLOG).tlog: configure - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../bld/configure -help >& $@ - -$(PTCLOG).tlog: PTCLM.py - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM/PTCLM.py --help >& $@ - -$(PTCLST).tlog: PTCLM.py - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - cd ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM; \ - PTCLM.py --list >& $(CURDIR)/$@ - -$(MKSLOG).tlog: mksurfdata.pl - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../tools/mksurfdata/mksurfdata.pl -help >& $@ - -$(TDRLOG).tlog: test_driver.sh - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $@ is good and redo your make" - ../../test/system/test_driver.sh -help >& $@ - -$(QCKLOG).tlog: Quickstart.GUIDE - cp $< $@ - -$(COPLOG).tlog: README.filecopies - cp $< $@ - -$(CPRLOG).tlog: README - cp $< $@ - -$(USRLOG).tlog: Quickstart.userdatasets - cp $< $@ - -$(GETREG).tlog: getregional_datasets.pl - @echo "The following line will fail in the make as it calls die -- but that is expected" - @echo "Check that the output $(GETREG) is good and redo your make" - ../../tools/ncl_scripts/getregional_datasets.pl -help >& $@ - -clean: - $(RM) -f $(HTMLUG) $(PDFUG) *.tlog $(DATLOG).xml *.xhtml *.tex - -realclean: clean - $(RM) -f f*.html c*.html x*.html a*.html i*.html $(COMPLIST) $(CFGLOG).xml \ - $(BNMLOG).xml $(BSTLOG).xml $(PTCLOG).xml $(PTCLST).xml \ - $(RESLOG).xml $(USCLOG).xml $(USRLOG).xml $(GETREG).xml $(QCKLOG).xml \ - $(CO2DIF).xml *.tlog $(MKSLOG).xml $(TDRLOG).xml $(DATLOG).xml \ - $(NMLDFTBL).xml $(NMLDLTBL).xml $(CFGDFTBL).xml $(CPRLOG).xml \ - $(COPLOG).xml diff --git a/doc/UsersGuide/addco2_datm.buildnml.diff b/doc/UsersGuide/addco2_datm.buildnml.diff deleted file mode 100644 index b8fbf34e36..0000000000 --- a/doc/UsersGuide/addco2_datm.buildnml.diff +++ /dev/null @@ -1,59 +0,0 @@ -*** datm.buildnml.csh.orig 2010-06-11 10:59:29.246523532 -0600 ---- datm.buildnml.csh 2010-06-11 11:06:30.710784206 -0600 -*************** -*** 34,48 **** - streams = 'clm_qian.T62.stream.Solar.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.Precip.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.TPQW.txt 1895 1948 1972 ', -! 'presaero.stream.txt 1849 1849 2006' - vectors = 'null' - mapmask = 'nomask', - 'nomask', - 'nomask', - 'nomask' - tintalgo = 'coszen', - 'nearest', - 'linear', - 'linear' - / - EOF1 ---- 34,56 ---- - streams = 'clm_qian.T62.stream.Solar.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.Precip.txt 1895 1948 1972 ', - 'clm_qian.T62.stream.TPQW.txt 1895 1948 1972 ', -! 'presaero.stream.txt 1849 1849 2006', -! 'datm.global1val.stream.CO2.txt 1766 1766 2005 ' - vectors = 'null' - mapmask = 'nomask', - 'nomask', - 'nomask', -+ 'nomask', - 'nomask' -+ mapalgo = 'bilinear', -+ 'bilinear', -+ 'bilinear', -+ 'bilinear', -+ 'nn' - tintalgo = 'coszen', - 'nearest', - 'linear', -+ 'linear', - 'linear' - / - EOF1 -*************** -*** 1112,1121 **** ---- 1120,1132 ---- - - EOF1 - -+ cp $CASEBUILD/co2_streams.txt datm.global1val.stream.CO2.txt -+ - - $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.Solar.txt >> $CASEBUILD/datm.input_data_list - $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.Precip.txt >> $CASEBUILD/datm.input_data_list - $CASETOOLS/listfilesin_streams -input_data_list -t clm_qian.T62.stream.TPQW.txt >> $CASEBUILD/datm.input_data_list -+ $CASETOOLS/listfilesin_streams -input_data_list -t datm.global1val.stream.CO2.txt >> $CASEBUILD/datm.input_data_list - - cat >! presaero.stream.txt << EOF1 - diff --git a/doc/UsersGuide/adding_files.xml b/doc/UsersGuide/adding_files.xml deleted file mode 100644 index 18c034cbbb..0000000000 --- a/doc/UsersGuide/adding_files.xml +++ /dev/null @@ -1,357 +0,0 @@ - - -Adding New Resolutions or New Files to the build-namelist Database - -In the last chapter we gave the details on how to create new files for input into -CLM. These files could be either global resolutions, regional-grids or even a single -grid point. If you want to easily have these files available for continued use in your -development you will then want to include them in the build-namelist database so -that build-namelist can easily find them for you. You can deal with them, just by -editing your namelist by hand (or using a &usernlclm; namelist file), or by using -&CLMUSRDAT;. Another way to deal with them is to enter them into -the database for build-namelist, so that build-namelist can find them for you. -This keeps one central database for all your files, rather than having multiple locations -to keep track of files. If you have a LOT of files to keep track of it also might -be easier than keeping track by hand, especially if you have to periodically update -your files. If you just have a few quick experiments to try, for a short time period -you might be best off using the other methods mentioned above. - - -There are two parts to adding files to the build-namelist database. The first part -is adding new resolution names which is done in the -models/lnd/clm/bld/namelist_files/namelist_definition.xml file -(and in the -models/lnd/clm/bld/config_files/config_definition.xml file -when adding supported single-point datasets). -The second part is actually adding the new filenames which is done in the -models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml file -(models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -file for CLM tools). -If you aren't adding any new resolutions, and you are just changing the files for existing -resolutions, you don't need to edit the namelist_definition file. - - - -Managing Your Own Data-files - -If you are running on a supported machine (such as bluefire or jaguar) the standard -input datasets will already be available and you won't have to check them out of the -subversion inputdata server. However, you also will NOT be able to add your own datafiles -to these standard inputdata directories -- because most likely you won't have permissions -to do so. In order to add files to the XML database or to use &CLMUSRDAT; you need -to put data in the standard locations so that they can be found. The recommended -way to do this is to use the link_dirtree tool in the &cesm; scripts. -Some information on link_dirtree is available in the -&cesmrel; Scripts User's Guide. We also have -some examples of it's use here and in other sections of this User's Guide. - - -Using link_dirtree is quite simple, you give the directory where -data exists and then the directory that you want to create where datasets will point -to the original source files. In the example below we use "$HOME/inputdata", but -MYCSMDATA could be any directory you have access to where you want to -put your data. - -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -# (except to bring in any updated files in the original $CSMDATA location). -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA - -Then when you create a case you will change DIN_LOC_ROOT_CSMDATA to -point to the location you linked to rather than the default location. - -> ./xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA - - - -In order to list the files that you have created you merely need to use the UNIX -command find to find the files that are NOT softlinks. So for -example executing the following command: - -> find $MYCSMDATA -type f -print - -for me gives the following list of &CLMUSRDAT; files that I have created. - -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_monthly_1849-2006_1x1pt_US-Ha1.nc -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_monthly_1849-2006_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp8.5_monthly_1850-2100_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/atm/cam/chem/trop_mozart_aero/aero/aerosoldep_rcp4.5_monthly_1850-2100_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/atm/datm7/domain.clm/domain.lnd.1x1pt_US-Ha1_USGS.nc -/blhome/erik/inputdata/atm/datm7/domain.clm/domain.lnd.13x12pt_f19_alaskaUSA_gx1v6.nc -/blhome/erik/inputdata/lnd/clm2/griddata/fracdata_13x12pt_f19_alaskaUSA_gx1v6.nc -/blhome/erik/inputdata/lnd/clm2/griddata/fracdata_1x1pt_US-Ha1_USGS.nc -/blhome/erik/inputdata/lnd/clm2/griddata/topodata_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/lnd/clm2/griddata/griddata_1x1pt_US-Ha1.nc -/blhome/erik/inputdata/lnd/clm2/griddata/griddata_13x12pt_f19_alaskaUSA.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_13x12pt_f19_alaskaUSA_simyr1850.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_1x1pt_US-Ha1_simyr2000.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_rcp4.5_13x12pt_f19_alaskaUSA_simyr1850-2100.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_1x1pt_US-Ha1_simyr1850.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata_13x12pt_f19_alaskaUSA_simyr2000.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_1x1pt_US-Ha1_simyr1849-2006.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_13x12pt_f19_alaskaUSA_simyr1850-2100.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_rcp8.5_13x12pt_f19_alaskaUSA_simyr1850-2100.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_13x12pt_f19_alaskaUSA_simyr1849-2006.nc -/blhome/erik/inputdata/lnd/clm2/surfdata/surfdata.pftdyn_1x1pt_US-Ha1_simyr1850-2100.nc - -You can also use find to list files that have a particular pattern -in the name as well (using the -name option with wildcards). Also you can always rerun the -link_dirtree command if any new files are added that you need to be -linked into your directory tree. Since, the files are soft-links -- it doesn't take up -much space other than the files that you add there. This way all of the files are kept -in one place, they are organized by usage according to &cesm; standards, and you can -easily find your own files, and &clm; can find them as well. - - - - -Adding Resolution Names - -If you are adding files for new resolutions which aren't covered in the -namelist_definition file -- you'll need to add them in. The list of valid resolutions -is in the id="res" entry in the -models/lnd/clm/bld/namelist_files/namelist_definition.xml file. -You need to choose a name for your new resolution and simply add it to the comma -delimited -list of valid_values for the id="res" entry. The convention for global Gaussian grids -is number_of_latitudes x number_of_longitudes. The convention for global finite -volume grids is latitude_grid_size x longitude_grid_size where latitude and longitude -is measured in degrees. For regional or single-point datasets the names have a grid size -number_of_latitudes x number_of_longitudes followed by an underscore and then a -descriptive name such as a City name followed by an abbreviation for the Country in caps. -The only hard requirement is that names be unique for different grid files. -Here's what the entry for resolutions looks like in the file: - -<entry id="res" type="char*30" category="default_settings" - group="default_settings" - valid_values= -"128x256,64x128,48x96,32x64,8x16,94x192,0.23x0.31,0.47x0.63, -0.9x1.25,1.9x2.5,2.65x3.33,4x5,10x15,5x5_amazon, -1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ, -1x1_brazil,1x1_urbanc_alpha,0.5x0.5"> -Horizontal resolutions -</entry> - -As you can see you just add your new resolution names to the end of the valid_values -list. - - -When using &ptclm; and adding supported single-point resolutions, you'll also want to -add these resolutions to the -models/lnd/clm/bld/config_files/config_definition.xml under -the sitespf_pt name. The entry in that file looks like: - -<entry id="sitespf_pt" -valid_values="none,1x1_brazil,5x5_amazon, -1x1_camdenNJ,1x1_vancouverCAN,1x1_mexicocityMEX,1x1_asphaltjungleNJ, -1x1_urbanc_alpha,1x1_numaIA,1x1_smallvilleIA" -value="none" category="physics"> -Flag to turn on site specific special configuration flags for supported single -point resolutions. -Currently the only special settings are for MEXICOCITY and VANCOUVER, which make -changes to urban parameters. -</entry> - -&ptclm; assumes that any supported single-point resolutions are valid settings for -sitespf_pt. - - - - -Adding or Changing Default Filenames - -To add or change the default filenames you edit the -models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -and either change an existing filename or add a new one. Most entries in the -default namelist files, include different attributes that describe the different -properties that describe the differences in the datasets. Attributes include -the: resolution, year to simulation, range of years to simulate for transient -datafiles, the land-mask, the representative concentration pathway (rcp) for future -scenarios, and the type of biogeochemistry (bgc) model used. For example the -fatmgrid for the 1.9x2.5 resolution is as follows: - -<fatmgrid hgrid="1.9x2.5" >lnd/clm2/griddata/griddata_1.9x2.5_060404.nc -</fatmgrid> - -Other fatmgrid files are distinguished from this one by -their resolution (hgrid) attribute. - - -To add or change the default filenames for &clm; tools edit the -models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -and either change an existing filename or add a new one. Editing this file is -similar to the namelist_defaults_clm.xml talked about above. - - -What are the required files? - -Different types of simulations and different types of configurations for &clm; require -different lists of files. The Carbon Nitrogen (cn) Biogeochemistry model for example -requires stream_fldfilename_ndep files, which are NOT required by -other bgc modes. Transient simulations also require transient datasets, and the names -of these datasets are sometimes different from the static versions (sometimes both are -required as in the dynamic PFT cases). - - -In the following table we list the different files used by CLM, they are listed -in order of importance, dependencies, and customizing. So the required files -are all near the top, and the files used only under different conditions are listed -later, and files with the fewest dependencies are near the top, as are the files -that are least likely to be customized. - - -Required Files for Different Configurations and Simulation Types - - - - - - - Filename - Config. type - Simulation type - Resol. Dependent? - Other Dependencies? - - - Notes - - - - - - fpftcon - ALL - ALL - No - No - - - Not usually customized, as describes plant function -type properties. &ptclm; copies the file for you so that you can customize it if you -like, see . - - - fsnowoptics - ALL - ALL - No - No - - - Not usually customized as describes global snow optical properties. - - - fsnowaging - ALL - ALL - No - No - - - Not usually customized as describes global snow aging properties. - - - fatmgrid - ALL - ALL - Yes - No - - - Creating, using mkgriddata -usually gives you the amount of customization -you need, as it just describes the grid and grid extents. - - - fatmlndfrc - ALL - ALL - Yes - land-mask - - - Describes the land-mask for points with active land, as well as the fraction -of each grid-cell covered by land. You might customize it to make sure the land-fraction -of your grid-cell matches the expected values for your site. But, usually you will just -use what mkgriddata gives you. - - - fsurdat - ALL - ALL - Yes - simulation-year - - - Describes percentages of different land-units, columns and -vegetation types within each grid-cell. To customize for a specific point -or region you may want to use custom input datasets to mksurfdata when -creating the file. mksurfdata also allows you to customize the PFT, -and soil types to it see . &ptclm; takes -advantage of this to create customized datasets as well, see the chapter on &ptclm; -at . - - - flanduse_timeseries - ALL - transient land-use land-cover change - Yes - Simulation year range, and representative concentration pathway (rcp) - - - See notes on fsurdat files. - - - frivinp_rtm - RTM only - ALL - No - No - - - We only provide a half-degree global river routing file. If you want -to model river flow for a smaller scale, or a basin regional scale, you would -need to create your own custom file to do that. Normally, we turn river-routing -OFF for regional or single point simulations. - - - finidat - ALL - RUN_TYPE="startup", CLM_FORCE_COLDSTART="off" - Yes - mask, maxpft, bgc, simulation-year, start-date - - - Used for starting the model from a spun-up state. -Create these files by running the model -for multiple years and saving the restart file from the end of a spin-up -simulation. - - - - stream_fldfilename_ndep - bgc=cn/cndv - Yes - No - simulation-year - - - -You may customize this file to get the Nitrogen deposition characteristics -of your site if available. This file will be interpolated while the model is -running from it's resolution to the resolution that &clm; is running at. - - - - - -
-
- -
- -
- diff --git a/doc/UsersGuide/addxhtmlhead.pl b/doc/UsersGuide/addxhtmlhead.pl deleted file mode 100755 index d5f9615c58..0000000000 --- a/doc/UsersGuide/addxhtmlhead.pl +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env perl -# -use strict; -use Cwd; -use English; -use IO::File; -use Getopt::Long; -use IO::Handle; -#----------------------------------------------------------------------------------------------- - -# Get the directory name and filename of this script. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume -# the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $nm = "$ProgName::"; # name to use if script dies -my $scrdir; -if ($ProgDir) { - $scrdir = $ProgDir; -} else { - $scrdir = getcwd() -} - -sub usage { - my $msg = shift; - - print "ERROR:: $msg\n"; - die < -OPTIONS - NONE -EOF -} - -my %opts = ( ); - -GetOptions( -) or usage(); - -if ( $#ARGV != 0 ) { - &usage( "Wrong number of command line arguments" ); -} - -my $inputFile = $ARGV[0]; - -if ( ! -f $inputFile ) { - &usage( "Input file does NOT exist : $inputFile" ); -} - -my $fh = IO::File->new($inputFile, '<') or die "** $nm - can't open input file: -$inputFile\n"; - -# -# Add in XML XHTML headers -# -print <<"EOF"; - - - -EOF -while (my $line = <$fh>) { - if ( $line =~ /^$/ ) { - print "
\n"; - } elsif ( $line =~ /^'."\n"; - } else { - print $line; - } -} -$fh->close(); diff --git a/doc/UsersGuide/appendix.xml b/doc/UsersGuide/appendix.xml deleted file mode 100644 index 058e67d577..0000000000 --- a/doc/UsersGuide/appendix.xml +++ /dev/null @@ -1,305 +0,0 @@ - -Editing Template Files Before Configure - -The last kind of customization that you can do for a case, before configure is run -is to edit the templates. The &clm; template is in -models/lnd/clm/bld/clm.cpl7.template, the &datm; template is -in models/atm/datm/bld/datm.cpl7.template, and the driver templates -are in the models/drv/bld directory and are named: -ccsm.template and cpl.template. When a case is -created they are also copied to the Tools/Templates directory -underneath your case. If you want to make changes that will impact all your cases, you -should edit the template files under the models directory, but -if you want to make a change ONLY for a particular case you should edit the template -under that specific case. - - - -Editing the template files is NOT for the faint of heart! We recommend this ONLY for -experts! It's difficult to do because the template is a script that actually creates -another script. So part of the script is echoing the script to be created and part of -it is a script that is run when "configure -case" is run. As a result any variables -in the part of the script that is being echoed have to be escaped like this: - -\$VARIABLE - -But, in other parts of the script that is run, you can NOT escape variables. So you -need to understand if you are in a part of the script that is echoing the script to -be created, or in the part of the script that is actually run. - - - -If you can customize your case using: compsets, env_*.xml variables, -or a user namelist, as outlined in you should do so. -The main reason to actually edit the template files, is if you are in a situation where -the template aborts when you try it run it when "configure -case" is run. The other -reason to edit the template is if you are &clm; developer and need to make adjustments -to the template because of code or script updates. An example of modifying the &datm; -template is in where sed is used to modify the path -for &CPLHIST; data. - - -Outline of the &clm; template - -The outline of the &clm; template is as follows: - -# set up options for clm configure and then run clm configure -$CODEROOT/lnd/clm*/bld/configure <options> -# set up options for clm build-namelist and then run clm build-namelist -$CODEROOT/lnd/clm*/bld/build-namelist <options> -# echo the $CASEBUILD/clm.buildnml.csh script out -cat >! $CASEBUILD/clm.buildnml.csh << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -# Remove temporary namelist files - -# echo the $CASEBUILD/clm.buildexe.csh script out -cat > $CASEBUILD/clm.buildexe.csh <<EOF2 -# NOTE: variables in this section must be escaped -EOF2 -# Remove temporary configure files - - - - - -Outline of the &datm; template - -The outline of the &datm; template is as follows: - -# Check $GRID to set the $DOMAINFILE and $DOMAINPATH - -# Check DATM_PRESAERO to set the prescribed aerosol option -# If &CLMUSRDAT; is set and $DOMAINFILE is NOT -- set it by &CLMUSRDAT; -# Ensure $DOMAINFILE is set or else abort - -#============================================================================== -# Create resolved prestage data script -#============================================================================== -cat >! $CASEBUILD/datm.buildnml.csh << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -# Major if blocks look at DATM_MODE: -# the if blocks setup streams and run Tools/build_streams to create stream files -#----- CLM_QIAN mode ---------------------------------------------------------- -else if ($DATM_MODE == "&CLMQIAN;" ) then -. - # Customize &CLMQIAN; options here - - # A.) Setup datm_atm_in namelist -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_atm_in << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -EOF - - # B.) Setup options to build_streams -. -. -. -#----- CLM1PT mode ---------------------------------------------------------- -else if ($DATM_MODE == "CLM1PT" ) then -. - # Customize CLM1PT options here - - # A.) Setup datm_atm_in namelist -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_atm_in << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -EOF - - # B.) Setup options to build_streams -. -. -. -. -#----- CPLHIST 3-hourly time-averaging mode ----------------------------------------------------------- -else if ($DATM_MODE == "&CPLHIST;" ) then -. - # Customize &CPLHIST; options here - - # A.) Setup datm_atm_in namelist -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_atm_in << EOF1 -# NOTE: variables in this section must be escaped -EOF1 -EOF - - # B.) Setup options to build_streams -. -. -. -. - -#----- INVALID mode -----------------------------------------------------------else - echo "ERROR: unrecognized DATM_MODE = \$DATM_MODE " - exit -1 -endif - -#============================================================================== -# Create prescribed aero streams if appropriate -#============================================================================== -. -. -. -#============================================================================== -# Create remaining resolved namelist -#============================================================================== - -cat >! $CASEBUILD/datm.buildnml.csh << EOF -cat >! datm_in << EOF1 -# NOTE: variables in this section must be escaped -. -. -. -EOF1 - -EOF - -#============================================================================== -# Create script to build executable -#============================================================================== - -cat > $CASEBUILD/datm.buildexe.csh <<EOF -#! /bin/csh -f -# NOTE: variables in this section must be escaped -EOF - -#============================================================================== -# end of script -#============================================================================== - - - - - -Adding a new DATM_MODE to the &datm; template - - The steps to adding a new DATM_MODE - -Add a new "if" block to the &datm; template - -As you can see from above -there are major "if" blocks for the different DATM_MODE's. So adding a new -DATM_MODE means adding a new "if" block. The two major parts of each DATM_MODE -block are: - -Setup datm_atm_in namelist -Setup options to build_streams - - - - -In the "if" block create the <filename>datm_atm_in</filename> namelist - -See for some notes about the -&datm; namelist and streams files. That and the - -&datm; User's Guide should give you guidance on how to -setup the namelist for your case. - - - -In the "if" block create options to and call <command>build_streams</command> - -The next part of the "if" block in the &datm; template file to work with is the -call to build_streams. You may need to add additional options -to it. You may also need to call it multiple times for multiple streams. You will -also likely need to add a new source option to it with the "-s" option. For more -information on build_streams do the following. - -Getting help with <command>build_streams</command> for &datm; - -> scripts/ccsm_utils/Tools/build_streams -help - - -The output of the above command is: - - -&build_streams_help; - - - - - -Add new streams templates to the &datm; -<filename>datm.template.streams.xml</filename> file - -As part of modifying the behavior of build_streams you will also -have to edit the models/atm/datm7/bld/datm.template.streams.xml -file as well (or the local version in your -$CASENAME/Tools/Templates directory for a particular case). -The template is an XML file much like the output streams file, but there are attributes -to distinguish which fields will be used based on things like: RESOLUTION or datasource. -And there are filename indicators (starting with a "%") that get translated into various -things such as: - -%c = Case (from above -case command line option) -%do = Use domain file -%y = Year (through range given from begyear to endyear) -%ym = Year-Month (all 12 months through year range) -%6ym = Like %ym but 6 digit year (ie. %YYYYYY-MM). (can replace the 6 with any digit 1-9) - - - - -Add a new valid_value to the <filename>config_definition.xml</filename> file in -scripts. - -Adding a new DATM_MODE also requires adding a new valid_value to -scripts/ccsm_utils/Case.template/config_definition.xml. This -enables the scripts to recognize the new value as a valid option to DATM_MODE -in the &envconf; file. - - - - - - - -Building the Users-Guide Documentation for &clm; - -All of the documentation for &clm; can be built using GNU Makefiles that are -available in the appropriate directories. The Makefiles require the following -utilities: docbook2html, docbook2pdf, -protex, and latex2html. - - -To build the Users Guide for &clm; (requires docbook). - -> cd models/lnd/clm/doc/UsersGuide -> gmake - -Note, that when the Users-Guide is built it will get output from other &clm; -utilities that by nature abort, and hence stop the make from continuing. However, -this is expected so you should simply run gmake again until -it either completes or comes upon a legitimate issue. Here is what a sample -warning looks like when gmake is run. - -The following line will fail in the make as it calls die -- but that is expected -Check that the output config_help.tlog is good and redo your make -../../bld/configure -help >&` config_help.tlog -make: *** [config_help.tlog] Error 255 - -To build the Code Reference Guide for &clm; (requires protex and -latex2html). The make here uses a Filepath -file that points to the list of directories that you want protex -to run over. You should examine this file and make sure it is appropriate for what -you need to do, before running the make. - -> cd models/lnd/clm/doc/CodeReference -> gmake - -To build the table of tests for the &clm; test suite. The make here runs a UNIX -shell script to create a html table of the list of tests run on the different machines -from the &clm; test suite. - -> cd models/lnd/clm/test/system -> gmake - - - - - diff --git a/doc/UsersGuide/badpergro.jpg b/doc/UsersGuide/badpergro.jpg deleted file mode 100644 index 4a378cf52d71870efb21201d0bd38a9d364ebc2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40077 zcmce;cUV*1*ESfc0)l`Pk=~?(pmaovQW9yQ6N-SKlmtSr3J542LhlNM-b)g?(u;u7 zNkVVZr8mKk=eypSd44nRT-Q7Q%sRPp_Q}cFYoE2V_E~$~_s-wxzY73rpqi!{fPjDi zpmDPS{^9_t03yPF-H@|3NiozArUcvg!C2- z?d^M3ex6HhlXzW@!7` z-6P~fQr=Cq4{o&mqxJt#d9x=XCLtgsy*Z~q10eiIC*h5ah;EVm^OYN&G@Qh=;v~v? zT-Nt)>gSgDQbS6w0=7vUrQ><58uIP8zT3~m{l8ei9U_98nmL4J5=~#jt<1QXjz@zQPBd=dE1;K0uHUeA9s|cvD!; z(;a(8%R78u?;cZFdp`8k&qe~|1jRM~pka;Q%+?P#iT(W9fI6wkC=Yw0-RVZM2P}2B z%-erS{udBoDmLAw%RH0@_wtSDa7NCMIbpa2!en@m$FR`Q6t9&fWo|pVOJTF)h@rYQ z=@!&a{|@d2$G?Ei$i6g(0*U$8@_0}=W?7prn2ol!O5p4r&jH~85*%YL4BRW2o6HMo)D9cLg&=goNi)FbtpGbeQM#bu0x7xdM)gO^U+ zUfKrVk){R8v0dTo8rE%2kvIqMHjC*ZD0Xq(?Q>Fb0fk&L`506$qIm6)@lcA^68krmC}$UO?JQfFSj{ZElF-cP%oo8avdYnU zsxV-Jz@%;OdUpWz@)xHipMoC@7J|)Po|Qv6uf`6xK@5F`_zJ2ENRH^Tuv*Kv6q)26 z-=Z8t=j3z<&t!Q2GJJ{Ldm?98Xmo1-gtQ+F`_nZ zf>R+$W@^3AIhW(R$1^(2s+7};1I&!;Bd-PW(IuJ^t0@*%e^|__L$;M(&b5JEsKa>I9=zE3@*}P(gLa^Kqa;1q=E=c3gIVvAz&Iu(CJaBU9{PX z78j@PZu$#gYWCL`t$gx8WudkK3BV}O7Z=AhsPBA!vMMBgRNqVmY&HJ6uaM(qTfk6O zz;A-=(3-$SnHy7*r&B#SmMP*Jo{%1ZICv!&Kbax6tTJ8q~tG{y;%Qi_JUTwMqYnr9Rl7|~!Hmpzq?dKJl^~}P6-7K9BP3O z8m!M_tO>VGa(sYc8IVZCi2)ja%w0(JtB0w;FT$>El{W38XY#vhjfNM!O!i=gqbidF zRS5>#(WGymicYPZbGQny9jdchZ;@TgOizAc*2kh!<=CDn8fZAB)7*Jv9$1+4V^;aq zZdFhKa7jw?{pdf2e;gibUe!cIy8p$rk|G6EJF^aYPun)VeJH9|$2Q4iR z*nuEUVy?<$DxSpMW0}EY!tN|A{ykUDRnv@rw&;$OWHu*7>?o6JRhWoE zmdC7c=K$^BH^Nk+iOT`o;jm$t84rP198fzISCa< z7@w;GpR0cL`US2s%xUhk-MJKJ(p(J`B-Q9zIenF4w}bOYbG?#J;8FWD7FYk1@=MQT zk^sxB2Y*4vkE750R|M6o=%-5Kvrc{ckQ|}A@`+Ay4z>8CB+yF}n(?W!_yO_{qAf-A zzmw^`u&?=fVoE<_ezE1Lc6$a#1%7e#r@~~0XFLg~Gw}I-VW;^Te%9E8%HPetewZY^ zLWNUIBBmhi6g8S{cW&3aAX`d!@G=T^}*Q$mkU%CSEm zv<|i;x7Zp4=ieI+e?Q{iw~T6r)GwXFbbU1`T*fNKf6FIdy7-R;HyB)H zYM4fhcO3|gp}iW`-x1(aeY-}7`((6%r-HD?E>)51l8?x#+xOJALMD8DA7-1Izv$U} zV23iiq)BBhN_(zmX6mrFp|^={31sfJwYF`A zw!E;E#vXk~0ToQDt|m}f(hnT8vV?AIq>qXE{>Lvc!OdXtxxgRd&?gL^v3Q{7Z6PJ# z*}Z;FB_TV)TW0^W0m(pZDy!9XA}duZ8K&}}dU+Cpwfjh>Uz+=HWgt@k_ljDipJUg1 zmz~H(B3!85a+pndt*uk&wr&14MQ z*x@XQwc8oS2bdi?3UWZi*)0Xo_UxcBy3(RaPo1l*(W-f4_KvZCm47fa2;Kxef#5~V z^8E`DIf$^tQEGEp3m&ZFd&-J)0Uhi@uj%o}+4_G0Z=RH$PW1k+C#eADyF2k2G^WVy z1bbzRd}2+Yzupv+rl*;S$KjwG?*d!fdzy3VO5bmW?r>7}jB}!fw!eTt@277J{sLx(1h0((cbiwV{LZ`Y6SI^y@SGRR|zY0@A5_n|`pC8Bc8Z2r?r|d|RU44~Oh4L|T!^+|sknZ_xeI4<=hl=j2C40=iH`#<&jq!V za+k^uVtr#&+iPIYCxCr5mrM>YI^x1*uLuHd7{Ng>fBD^XCFYpZ;`V>_M=`3vCL8R? zAWz$|S_WLYjlN_(#E3D{yGd;om@YE=S#70#VgA$TqGWaSA3xlw5HTiV>+w%tBKR2&0l^oW!dMz-65twJoDj^Z&Q5_xNo#{-2s}(bajXNAxy6KC(>iW0Y@c z&e>|g>wg2Y3hl(LwRz23pZs7%K5y`s@qbyLD>bhK({A z091*Tnzuz=PcZ!3pBm^VqTiHKs*i5BYZu@=3g_lbZL+N;+A=UXBW2dkBtbUk92hC~ z$JL*KXD_a)7T8hk4F(a}`oX=2?!bV%*SH%8`%h;pF&#bioEjX?v#mDdQ=e|N-Rq0b zbQznXa-*m*S5{AJGe{D{fTeY{yMk^@ax&%WZS|RVr`K$_qZzm^dVfp|Z`MDWTi}sd z`1p;&=n_dBR!l;DTa&xD>tn7QkBjck0*y6R-?z#VO3xiUTiWi&Y<~#!^h)0h9 z@K?X3uKTCW5h<4<)T!i52D+^seagg?DJt5%-S9_FyUqC8a>QOt|EN&iY3BpmpXsf5 z!(XFg{I7W-FV5&H<@b#SPWKn4=uM;$PJE4TJ$0jt1l@oNi_55hH%z;^AJj)nqAU%^ zht@0xgzvb3QbgPWxreVF!zoL4Ie{uV$TQ3Vffa{0+d}Zq|FH6oB(H~YiM9t4* zSW3!F;;S}Q!*=2tUa-9qM0|dkBx!f-W5+j~t2*Y;IN9U(e?O@vARUps$KUzJ3u-2w zvZ|}kINs{kFjA);-J9&Da^>-B7Zx9%r$R2JdlrEw?^QnL&DPsw)EC>ft=;aA`)EUb zNeeTYDb;(4yJ!rx1P|V)J4}UV<%ryO}DRepRUw~<1sa-CF(EWIN*T_trszC-~1BpJ<+QtcK?qs z+Cb&BEW;(vF1}hGWev6EZmcijz%g9t9_7*ZqC)a$%>{o`8_?-gSLsC~14~avejt(s zlaZ(l=q2ri;hPI}2XZ%ae+F;<9nFFJo?EtCu?vw~F(MjXayhsUE}y?BYZZs_L1Vju zoa;*j=Ocrsx4jg5ng!iLw1HCtr|P9xN9-HNAMo=s_{WQdrIl3w0)P71KPn2$$TjTT zM(B1(P!XZZB}jmr9~`f&y?oJs&bl@Krm3S1Yi+qxd1|8*i%(&^Mli$|Dt_dfJ~HDP`gcc9IcV!?7WX(AoAY~}Tqcf4=8qwdnSDgN=^Z%17V?V0p! zd_g?AWRrItZNB;oAnC8)h$?tHBiVCn^maQWmGc{~Xg-W}RnwzsP!!rHLl_~>j-6GbYqpHiKji%_ zi$#ndPlg{fUxinFX_XX7MiPjbpeje+H^EZLz~IC?$~dH1a#(qIwhz%4VmC zoLmb6|1g`iH$H4NOrWpGR$93udf{i;j~J9*gKcZ3$E#X@(n}+AnCyKT1k6-jsrouQ zTEz`rH^QkKYA-Ue?taTP6-6^QU?s=sWBfz7?tAU&7O}+e*M1nmj6gY@>9WUVKh&^2 zn_0hw%8zu31ACi$LB(X9SS-IE7yl9s#cB=@wPGkE7eQE1as4 z!#z)J!#JUMGx#%;!GpP3=UtV6&oc1^NOMhkT&)9J`}DqW1SVTWTu7iDpN}_d8tGb! z(-?gKa*8#B4pYnuD3PDAXm>6>OdPv72{5UAyy@e;hnlju!Zde8%CU;($Zr~j<}w_c zg51^y#r1|JDt}km>*UpxGWcj=Lvim^#i#JT#+oHB)iU0^j{oV9&}ht6@Hu#qjKmTA zv3Dyq?HbxZHIq=s6?g&xd15A`oVHZI3iT<=7r;q4UpQ$TkS)=X7@s{Po8T=ILXV7i zuCuq9n3zTP(d^qVH}mom6MrN;RT~hHkGX1%30&TY)77zIEaSzMfXlvbl()i~JG*Qo zUa4y;Oz+UsHIBgd@Ab?3@cAwORLiV)s+`APzaI;5&qba+9Z$(A*s(Ogu5N>4aP4Og zG~Jfz>0uJu2NYVDVhy;RjRe6?TD`j#@)CpYnM%{haQxeNgyEtS@DFi(j(H>BDLYwo z=)8HdXV&)M0c~d;#L8Y(_)8n*mxg>8FHgm*xGl_0Ks#-GUopaoK{gq(cdl+AD+(gz z4s*fI)^){x{|r{ArwdWSe^?%gBle#veWrshf(z{m_-|6^uQ88L+M(UzJRNza1)LMH z);-uW-PRKmoDE=_Z}=)DP8;cMsQB0+pc&aQGIi^t1vu_ok)`0X#pvdK=>Z*vsKEhH zN<>AY?1{WRqPZ*lpb<)%-vQ&M?1cXyBUvAB2qh7U7g_)i5Pu=gkvw`?J~#L(*R!eH z=G@&BxP%k=M2T$R4-NlNS?s2S7tj`pxN;-K>k55mM`p6oBts4s%Pwl(B|=>>c>hU* zm9$}6M0S=lC#UU5&A$0`6K5XO?b~NqT&x?t?kj}ELp{go5+EExA*Jf)J-qvePOpJu&vEQIoZhAlxu{@>rJ#*}-)zo_CVd?{df+2eP zLV>*UQb9&-LgX{N&#B|ROOGWjxG3KVBbkMZ(aefFB{E3o!ud7^py#s)IVjm~kwrcJ zP1BS7x3hDXODmr%>{~S@2S7aGQzdeGfgl;-E5BYBw0}Vm-hKyt!ZqX?6A4j@{N?^W z^pd7+#ownAFfo@dA``9?-#0!f#=vYF4cQaZX!_p#sT2+bX$2u=YWg*ex{3O=FaL16 zOmgO@sTwm>`2`|<6h-b$2zRtYD)hRCP|UoOsR(htc!TZ48#V0e5KZ{q?(or*m+BxOcR_-#gU{^t!zNPA2&>T;gM z^N)UE@~WETHHE{RIF4b@zxbQ9Jpzu1#htd14}zK!HZr*ext1Tmk6KEmRxgYyDQZSU z+N%XA)9-S}D*?9YRP;}cM@PypR0&7k5B)CmWOyzNw$&{%<1{Oh;c3}S3MI{N%l?FC zJ)IMa=b18#S3^}5@pS0jWPxI%hT{qkm7)e2b|r2F9*|mJ67^k;O{TFNY;5$ z+73A%AuA{ax*G+kyclRh3G+ZDiU7sqT?=)j;AYaRQQi5#LC2Vby#}|o?0&vK#`%8f z;8}TKM)9g(ME5s&3p8C08~f3rTiICKXY2Xe+tbXTkmgo}!xP1}BE^HFL;W~QpEAcVsEhOrB$-*D%kFNPV;d+QqQR7Kb=va znLm^ct*EuDg#V0ldKn%J7XUYk^aj9p&r}G!pM7fZbP~|}fptLo0wMZwXK0|7WT&1JO(b^jZO?~k&yH?3k3ev6(9Dh| zz-;G!9r&(YM?=MWw&&QsKsSH!84p5JKC!jIyqP!sQqUsisH?w5Q>O@K_95yO<*AN4 z48(?W=T&uaKiD)x8W|$8K7alTXfPX??rwh9=KR|%rxMksqi4zdM$}mL(7$;;v!!`< zW|m0^Df(GV;t7!!+}TN0VmtChCPi(puh-zUM5QtY%H4>ym=Kdfs0VGmHJP{L<#UxZ zEPS0AQ^|6kQexCdYXV(=HJ}gl6C95RX)~mt1`s;5x($4;UV6+AhO;TO>iT}NkSee$ z!47%L*#_8Ah1gC~vZD$@#1b}i=&89t``zVc?~b$PgFs#KrIK-QtAix*eF{#)P!^$skd z-XalhO%oq4>Sx61=M~6Un5k|y*6>kG_Aymm#z4qK|H^cBbt?}&cBsy+ANt6GQ*{5B zbsQNubfPh7`j9(mu2Ri2-_VVM*bS@yYf%L)_k(-Zyg&`^pL>ehUmz!H^yw3p+0x7H z6LS@b8A|DHlUUPK6?msVc-th@hs7ol1OyMXvq_rg} zM3dV1wP(^ep8TwHilzl*2@}vMC0BvAUsnyHc%y$;!r~>nf z>M9yDm)o7w{7q(dkZi$wwf8VE&|6dO0d{H@O=1^}yq0@5uxZhot~09Oyb#3FL(3>P zoJJ~dX+Tc*8t9;`#OMBdr}ks6t56`_NX9rUuR-)=SkkK|{Lyz6v7$y<8dz}z`q-UR zXpcK$9i2=9OI)CgAX54-C_vTogMqN$%3LV zOS)PKK}hkn$17Zqe?duv$XACnnOV`&Pcl4>96g_Ly{nuatUax@yCO|C$|x~>$6|)x zbGEB*#cEGJQOsRu(9-PKKA)4_e9?4FFOl{#1*H9%okU3UM3>_OYPmN=t*3xKdsl8I z%ws)!?c~aNvd7BtO1ydZsRKM+tp5WIG)W+#n?yhvjwI%xChf|OjPd>ba!dCj5#-%M zA>Cq~)>_AN9A$vx*2wj)Pr*WNzea$=4K{iB(lx;ez3=Tv1UGn@1hC`twBBgOhMiO# zMegm|ix;M9eqkF0<)=?4>rnS_DVb=N43+$Jwt`pp1BWMWfI@l6(!~H@@tqppAt)M& zK@tP7WV2SZ2x%f{AG=&x?ObB{`JASEtDWD^vU?(ESy2tcU?y?<=}{x^9o_;C>goB{ zv5??H#p7q)M^?b_SC2+jsc8KI~E7d)G5lI@a+7G>l0m3}zaYzICRnwV*<$c)z9tFP3I{tIyS zq4LsizboM6Ce0DUvi!YX$#a~eY+69cMUO&cM^+IQm0f85(RqK{T9a2)3OnZqM5x4n zR;*!5Rtk~jOSlEy8q)sq`=nDFC11(hjQ08qxGElsy;*}IrU8dIaEga@gWcS?R(M6iUMLxJ-dNlTa;6flz2I6KS$AxAeR z?~#cty3?~a$t0%Z+|{DgXICGp?BV9#lq}~Tbpz872RAiJ76X6gMgIf0sXOVq1v6KR$Ys`h@81rlVXbelA5K@(-$PGsRfo+Y6h$LrG5;w+CX%+Qvo2@T6U& zpJtCh`Hp{9W385&=*TaVP(mqgSEozEa-uR5%EDEylP%L`nobo8xZX_KXT#coYg($# z;Z8)v`PAH4xrjyL)6fMbXWz*)UBI#&Y@>MqaMVZ%*kfvKB=owch(onoM20pm@r0gNn zEk;yWLB&?nI65UhAZU6zrnj%?F90uu^ZjXG8&$s1sOFh49L9SrH`Lhpw0OG!p(1lm z4Dh;nRZ&z-PJA0Fawt+beAW@QF64%v8hAS5QlK|Fq;6FlE#CE>rs_?@j?Q&uSKE2U zlFVqc_aDS8!N@z@C~fNPzX0!dR==x=%<_vWaaxN^p3Ogz`}bRle1bM~IC2#OgP$#0 zee@{O;W5{mg9(toZjizO-E_s=fYj94qqSfiy5KfkcFWWYAI1Bt7%Y8+=@prKi|uU@ z(#uTf$R}+)YQMd0g8SNAFwtp|f8FsIz2m)M^(1xtcY9(Fjm}b|t@{yj&n_1^|08Uv z=`?2LTu>N@?nkSourQn-BvFqya0d7kZS$?J&-b?BW{w~9*Kbh`3dc-~PHHR(yFQ0? zr~+e7QTi9{Vr;!G9OKe_wVT=`F<)asRuc-8L#88Zyp_E`l})D%m|~s}HDj_{^S(%5QdoI|DjSM!c#mn2hw171-bp&e7*jc4ZmK8W!@7LF!G3(8_YkI+0oU%Zqp%5PYknHVKKmdGaQ^?eAH6 zdD!yy3u^`!XMFJTJ=TEt;?OTmt;gwNIX)^ghmie_&yK|fY{Ek~t{(?On1XFl)gKX~ zkawoe-UaN;C61>DYL_n6=j4%jo7pz4(jp2DV9n-nM=*YS`K=Jo(v+`n@14Gi(F+T8 zvSa3nEaoG%d8$plI(LLtvrw5T<6u)=6FNiQs zJG^-Ay339KBY(z5z&sIV#pJrAW3Bh*g*`~<%6?YK%%v3et$Sfsu=`qmN zbUS56j6J8{>mjo0=kOzB>6p4R+~+A`X?`iLef1)Fi-{`M+s=Ob^-p6q=90j*F-}M8 z5>Xh@Z1DCbiaV9{&%M3I;?{gQl$C_$udaK1oG2`7V!ZeR1?dNn+7v>6^VEf)A`4d- z!8|mWtHK9k$xaeM^Th@g&XfW!!oluof{=V32L$r05j-wC7WO9gk2US(`5o#3w4pq_ z9Cu#NXKr~5we1?ASD`WkJ3fyEkLDLAyg@orW-Y+2R!c)z-p~~4JhA0KYVpv($=u(LH;UYOO7rn0?sHEscUe;~z$( zwCfOIE(MuG5BOX-*pEK(5LNFtlmY9+7W*6>^ z{RP|w0fjolj|UvuKdpOZbP6?J=Q@gX=u2#0v`XD_d@Nj&@1pW!`I8d4>-J{?J(B0n zUh^){vfne4Svu^9qh!cqf&Qdbs@8s|9DF&AIB0-|TDw4crVP^4} zZHAf+IhXdUcf5|WEnxLu9vGI4Wf@j4((U6s4D52wxnvYS3q4AZm=~jOnc;(sA};mQ zW{9(UzqW7r-dd4ndjTo|j{h93P>T%DE9ydAm+{Z{Fv#qWguZbs)vGWZ4wX{x#-X!X zuC7;^e^%N$w|T50Q8Fo)%VIcJ5G|{l9pbggmO#jWj>9Pgq(j-WfI<=~#PnvglnER) zRDrP@>o3JGEhFEYrb2xzQsm7hbD8Z0}#dSdN*=hDt#Egs?A0tGDZfo8td%E^So|9oxSN&8DL!kUhJ*hOV~AfG zphoU22q@8#Uc!{*13zL*XNkW_5)p@`D35U37QZ-s*tnvX?AZ8B%vwriR$ug%Z37wr zCJg`6a;7~8b<|}7@@Z!)zk98=G4M_&v=JHavfUQ7Cm`6~*Na6&Xf#yvy;TF@M@=L? zbn|A%+1?Cl4*#3#b3=e298wraW_zrdKDRtdo&03fhjqNZ?3)IghN9Fhzmcc1Wh_Q* zoA92;cbs^l&htMVroIYe6ZVkZ62qYis*yb9R6Gdp8O?J7GdY8lFFk&?e=eP+iWt8& zh?s+=<#{_Wy6y2*cy;vCFuy^MPoOov*TmZqw^csPs4fw? zz}ptKNoIitV&G$@at6A$s52`~tIAkX5!BIMa}*y8i0jk9zxUlgNzk{b_%c?1FurN` zRz3HUrxDu1Q#(iVMm@ixs)|)H+YSvO_`&WPnWWavHlU(`LIQtAXzAqA~ad} zDgvksZvSdPu)SK1sDQqenxJy~aoN@xTBMLRz&o{v*qh34x{zY@C)>L!DE7 zL7lg(OtXb)agVgQtm56`qP)=~tX}Z~Qh;}}wEeEEzk$VUOLNhTuob$jv9Ne$vbjjR zx}qlcyUTP-W2%7BB#W?W(7^;NIWPsBv(#1%pMP&7IPf#-g!lDWfcHHIs_8_V=%KLU zDc!W;rWLRF#4i3nug~~gZgLXd^>u*vT5wYF^z`h%0KueG^Mr>R{z+Exhm~v~-1~90 zzkt%TKrBjgMmSTNS+rSsmT#@!u%(;(=SR7IrVESPG?*$ zLDNsrY*>@G*)R5N_9524_UwgVD@eIGa?}usBG=jr+uaM;POLNMsm!pzDf+fa+V;T* zTl^89JIx1Qe|n~=I6!C1*(IRRDC9yWxQgab+&9l%6=M95rrO1AzO&cBHHWOWX=1hV zZ6KK8WDWvK3*2%M;NC7C8dQRpy~y!{+gD0F{0_xr7p(`7S?h2&R?FYLO|GbUvcK+# zs0rOD%mvk(i=1_e^9Y)JcmT2nnz8uM#X5q~x;${=y&7E{bTgx3vJ5C{urX>f>pS4n zPX05pwQ8_OmN!f>^#MDjVK!tBM}NO(#BuOg6MKS|u0yx@nw1pKs0^C*M>N-9QI?3ClO`cs^TnT-MUL z2dw{Xx)+?xByu1NWY>kp>#~y*CNI#lBBaj~%x}wmVDQ`>yZ7r@@@=2U(D(XTx(gqm zPe_CM;%*q}fDzdHW3Qzc|mQ>rK`9n#|;^0S7JI3 z90k@7L7{W@b6{f#*a7B57JmgA4Ir1Ik=T(E?swbAG5-oh+hfd49E8jWn78wXApQYg zPq3|0tc;D;DNgmyLQ?52=}(0jDEg=xST&~0;fi-9-Of;WB2@42^_0lDwkbmF;YU{8 zpRb$MqsS$PkdIQooSY3?g(kCEjOtw(iV8uflikbMT2;^7k>jOXJt3hLcKjE1PBODV zsQ_#HtvjiPlTG1?T9iUnZF?Sx^@w-r{Fr{pkEt_g{@>YKQQDv~BmPsVLj}pqTIjxN z4RQugqHo+Uu<+m+BNus+1^|#)Eg!jWnowqXd?JFq{@PX37fW(=|F+xn#Y5HRxZB*W z%0%C;!0$L6!L9GPvhbY7hG2u`>5oCrT4HCKU3`p;}!=@{q4!H#PEh#73)n63SG$qLh1oRBBcyn)a@01>@ zAKJSQ=QjxM_Q(g;@n#9#jW%g{PLrc|ua?9esFK`tS0s2I&t6+Oh`sMN_>?v$d`vL% z7rejXBli~ts?~8sd;!75*96Rb-)Z^In1`?%Y3ruDO!pyCQ@2bC7qT@Riw!0d^&33d zfI!=Ri*C~b8wtU>Qp_-=pNEA#sE!19#xIzHQPN@Avk4WomA`=a(!74(4rAKI@f7>z z6ODw$ira?$M|8(j-wfXmuf7hjLpN z4#;1u%OCTt-F%p7F3GT3NbP(}R}@iMn1A?UhcVCgbD|^>!6{FWL^ze6;zkgsftCmZg zkv_1$MF?#-V{v9ehxFZ*zHO973riK?kE3N43OqIP0znICk?a_Nmdb2xpDm+QKE2m~ zw{QZYxm2Ug4B7uuX3EJ+;ukak94Z2TC{tA*#^*JHuT{i0NJNplf#fRMio4-ry(xo> zEX^*D4%na&m^4eK_A(rU*Jr@YR-VY5f`%|k31XRjk;)Vf$^0odSopB(a-Tm5Own+% zbiBAs6Ya_U#%jE%Ek>qW%|P7qjaNmE@Ilq=n?0sME-}#_8)<9bh=esA)WDw9rU7<| z3nGdsC}vHfcx#07-xWf>?Q!vkVrveKndt^|A*mel8v0<}6efyrLY--ImI1fM!UN3KQVj*_R2aO4D9TQ`pKX z-UCS#WbkRkUME;Zr|zzBnxG;=L{4Lx}d&l!_VolePf4 zoSec^IWyR<-mE7S)rx5MIv6$Xve=30bL#YKeom1oWg6>`v zya->8J)^Am z`YW#ljOvd#3kyqB!%p8p4(3Hp?S@1%au7*x#})%|yYne?klh0Tph0)=f5V}dn13m^ z-Q8RyB3vhpd=U54^-&p*=QHvyR=YWBQ=KP5jr$xs7?tsV2FB6Fq}zB$zT^r~WEZi=QW{UsN$yK1XWm z-z=IaK-`x1;Z*W^OCoT?`P4o)%3DE53Nj#HKdP)NXUadpgxuljiKFHJKsjDLeb5kE zv3^&Y4q1$NM^j5n@(tKawd!}C@HX6T!ZY7wSC_59ywW?9;o)rQqq=Js>}u1@M_wUo zaF!Q{W)|*7yJVCs7dr}0f?Fmx)?}>;*ZA4&jqm8;kF6< zMP}Ylv-JF(K?8C1pd)-#ZGnTbf7<_Su0%_?AMRXM@>CPEB$4rs*+-jgU>ryO_7?GW zP(m#tal7CgTjX0=KK&a~W)zk3I0J9t8QMoR1DB5(3PK?HBD13helY$y{03p zj#4GjZvr(OwdQdDgo%&CtoH|vn}y44S5>@}Dm5K})D7Hr0ESz%D&dzOs%hTk-GH;8 zCx?2H5AD7+`oh5a(KbWf;E);GNhYYsF6nS6y;v{WIeUcLcrtUz@!OM2<_>(?3R>8! zxSHi=9y@-3a}WUcD+a{toQiEBbDr~mH%b*C`wb=T|is=6gnvT&i4{mQ#XEm>}jwuR_3(09E#A3hGP4rT_gg# zg}%LO#nqJYc5*ehn0;`H-0l|wl1G|Bd4ZhV{qjT$zRv`Ydjm^eO7n(=NgWV<(mgMT z`Bu2G2Bj zg+@u3iobwMG_5*Mf`#yzrM=A*v!XO>Z>2ZsOQ~_(&=)=M$uEh!l6S)Z$v(5{v0v{k zwWr=8?NmIpYolxV9>qsj&urCk_!ijt)|K5gS-6A`&-!Ou0iKdqK+!1 z2)`hQG`%tfsqll1$pVRTyoX;&V>9 zWhibk*>8OBt-WhH#?jL{8GB^% z4mp#n6)lN&AcDkyi0OT58S(h7n7Vv%EERIER+ddCVVA_e@R%k)0V?}+?cv*@#b_y8 zuS=YlNfmznqX3LybTlJ6th_8ufP-hJW*!=2->D2KF-$7ehtc>OIB#S9Ax`b3`n-=||&F95xM?$S?f*C}R zeQibJ8NPD7K{oPrX%l~#ncFR_qn_d&(=1vXjQxa#3|e=>&%Kh54p%J26|Q=fn^7^R zw~3x4%{^$!Bo43GMimHX+O6ZsC>2%S=joD@Xp#dmVs$1N_vGHqo~Y|!v&9+ZBkJXC z+-7JRcRuI82QM)S@PpVztpm`w-r*M2&qf7Bf;!{tZPK-M4rR}Nw;TQukhlLH{*+ZW z##A@AVrV?(EXr|M?7PM4dvfg=%|xf7!>rv-M!Z^>oMYQ6;h^SUz@yE-fWC1=sl0zv z1$4-5I{uNs)a}VkF4LYp#MbO}|e#kKC_YWg_*=XCi(pCHu=}PWZ00 zf1=l?BJw~WcP&xHz7BmwE#fm7E~TeHPf|zQ-f~#aj@7YJ+Y>aTn_=J4)2 zqsQ|SYh^*`LoRco2<`-V;=cfs$n(MREbROBuy(4S&4;JLQ0QZr#Q}(6FmPu=IPAjv zo99<7tt@>>Jk}PV&ZjPLegMnhzHhMJ~$Bt)}ZYbR%R=%IlKm#k^)U>RaC=I_NX_v*6#u zsg|hYBd7+TD;1NGqqT*Yg6-Cju`ZV(YYTPpntw?8HPJRubrrzv35`XKBit*ReYY^WF;kJM>`Vy)0N6hixA$C8n zDS&Gl(POsW21W(|T@|2SH+NiO{_QHm7YD|HRZDaDgIsIxg{&#IjkF~xaaZZAys=xq z(qQIqBJM$)yCQ@8U7E`ctsks5#ipHhwn?53`#0^a`;UFuLPu) zDNd-pxBRsdvyn=hc)`0gJKsLYGSAZA7gs4KDH3gO5NOcN^5%(e-`Q5kZZC6PvFj7m zGMkn8=Osi)(ylLcu6qMe#Fr%eWV=Tgjk!0AZYdt4VF0okcn5Q!7Bm&;ZgUiD2Ryi9 zW=+ZyvLB&{rgx9b)s9Is#>TOeUG_}Sw*T@Do8GZ%q`m>UFM5XN7frtvtAImOzq} zEVTt6U{U6Ftw$tNe&TsBiporsjxv|8_u`cppJa{?NA|eM{{oKE(JpHPP?OTrNF{#O zZ-B^yyZ@EiHnN~HoK?iFu`#J~-t>#X-#rw)DZ*L#rKeA-ot5 z-qD490p!SMs+Gmaf5$g%Y8NcnpY6=FSO(leG}NKLJm$Xjl50T&6h`v&hqNG&2SvXe zd-4=e`axyCRjKDdL^U!MOc`j*AjF!CB1{%gTOIeNgso+eBe~JhVqJ4J5PEY`WK?m0U z{#WB}hs~Xjl|Tn^W(UW33tW&hp@Ct0%*|?@YeThPSIatkf$EM16*8&z2~ai0Pg0u| z%GG@V+I{4~i_59BaqZCJyNv30Drh{D*B^lCuB%>0&1y~;!}|UL7MxTKJ@cy8_Pz}! zXW6CrAATCF{Di8+9%?`QU$nhtRGZN8JnLC&&bj7dZV`_E zq3Z*EW#q7m4@9Xi;E>q#lo@Q_s>mY#0>1bWw8|ItOsSgiyq)uTJ-cEx0UNW640o-2 z>l){tPCmIVgk0IN5KBqzCziqkCg%$tlPJVoRJC!t1$*{X%z(HAzES=z;Zkr7DXD(c zQE#XC@LA2VUuo@+Gr984HIJ^k(jN|9g|tozIFCkc3f7x?!%E9n zM8X|2HXSlrVOmA>a**?8U_p3#AfSJanI81{Qp!O3i_;XR1x`reMe)+pzDCiBPMU|1Tz8fC{w{7JQB9?>6(A!t0UlF% z;<*x2n`|})*Kc?va(A%E$rQu09|wt<{$+)75Zs(Jp?ddwZvE(C37uV>Xw*jU)L(!J z=QI07#MR9a-}L0~jOI77iv`%IlT(RR>JK@NqBcxgZI6Uv=MP*C-G>O9n0t2$IDC5< z@}3TXNr;1X1DqWZ?07h`djPWWDyrXdX58%_`@eiPEW(+s4w~o9&F3D;ajFWi7nsjH zvv;QJwtB~56V(uIRyVI@@^NcHEkOLdGH)`v?n_Cz!B`=s`F^X_wZ2d!?|h`a^kgC= zYIQ-+?KO!YSVkdi4X(;=U$zS!=N+P*xif5l1e9Gholt^+ZgGk>Htnz5EQ{n=s+9u!Np z>E=K<2nj_xH042HyT|Qptj5oVmO({*;6@4=Jael_ze*r-MqUIqb#L`~? z~f;x>c70MXSo^18g6q~i*UPCE_; z65{XszVCJ0KhTE5?smRI!}Rc<@P&0w>f|N|HbpKZp?>6K`Bt1?>J-DiqvY+y+)*p@ zj|NoNlTepQ#!)}Vz-2Nj_}YjjCGVV%tmy(LNp@4)O*R=S%pw9AE}+R7A~inSxd9|Q zP&@Gt#%PAKi=oFnRd``zF1Phfb#b9g!p|ZfjytQXXYJT0sy8n$z)hKk*gYR>^__No z+`ssb;m_e@-8kj-$#65eG|u4y2uBx<=fN?JqSfp`-T#YqjTKJ_?~r(v+#g5*g(Hqq zW{AGlWevJnh)!82+0Q&{RL$oBoIrr(5UoZ7stL-*#aQCm+(IkX9d zE3~6tLm1z7@odQ7=dgXG4(C6AW%T8?`L_K=4hHTmdqOMbJRP>=-Iv;I+0<@NWWVhB zW>pK>IT%DJWH;48J9QjQQ_V3n6G<%uw{`C*Tt~)?dRc!bQpn!`~;=L zBT}qba5Zr#d8ZK$YeqIuvhLb1Gfy2h^MyjXpgZZ&7?YvBGvfeXt88PblZ{*7B!YWJ z3nCU3yYdig1;AZe%KuSh{C10Za05E>j$x_c2RcbYb9!sVJFDxiF3d<8_gC#bouJtH z!qJiK&wmj$(k@0Hx~d7vbbP~D^!CEjltW6V!WR$9|8RgMU(0;nHH8!$1m)%mGTBK9 z+$U}cQcLd0fE|QSgbKfY!=Nw8Jji#*qQ=O%2a$xz&?3^T6p1&9i5`H1M4TD-4}YfERpNFm31x}yr4p;3R#4SE2=`T(P|DJ=wa3s@ z=|RN)yj}k*#_kQOs2}i(??E~EK$0y1d%?2fQER06d72It(<4(zMGZQV6+8di)Zy3|xb z3dsdc3Il3fS}8Rp8}{{8e*rl)!{$yIh-T*?&?_&fS6$|)zYhi{r&s?skCR)88{Twh z*>Lp<6{dL4$M_HzQ8feJzV_PTFe)yavuqn+-e`I4g4sey$e|$mNl_Gw zQQ~!ekpsa#6TA5*lqL4P+l%nT1xDr@z zm3QG8Ae{b=T=E~b4aKk=oKc2OTa&8^L+j*dJf-(^8$MjKKYW{szf3FGr{fH@_8N{5 zT$k{wxhX;=uU4z)HO}LhydIAb8tGJFI>&OZEw&!RDdjmW@|Uz1GOzjfFd7Fx`{rUB zf11?}{n=B>M+OB^tutA&$_Ofn0udOWtw z0|LXkNpJ-aFd^ZYGDFdBCM9LBA41Fp15tY)gUI7^$tOxcF=b{#(&KQZ1Kfwt^k?#X zwRQZ6zdJmV;16`{*ek_HwbMIK4Kf0+PaA4Oa!?Vp6sV~2x_|PP9BBO|Dm& zE8q!^BfEjav~1PAupf{lMUa_{TJI)O{f6snlC5xqLxzYjeN5w2pc7ha9ZHqg2rFLJkg{Xqs6+>K>BUd!C2?H%2+9jh`W$ed*!vpP*s zH#^UyFt0_(iI|7mGdN%L3W@amw!t&BK@p2n@>PjcF%E`-9ykc6;9pR~pJM z(<*(Bzlp}^Fu+>qek^8Y30zjc+n*%*Gay(spS|vjv4^QLPcD`~eto!1^kNZ<5T>l~ ztiT)2DLsO!7EysVE4{seBl8oTv<-LUR@Jklc!<^Fk_?9|ZcU>0sVj;Y9c>Rz1_nJ4 zZtTw8tDp$=K>j|!v+t){_+`YfCW!nf-=s{kSwqhYA!3kO0i2Ym)7#spSM~}AQR*jJ9PK}9$o9SRTwxrcdBW4r)(y*M>ku)u%e^U5h>n@ z+3|y6$Y5RbUk6V6hwWJn7=1FM;Ixs*1p2GHa?=S56Do~F9qr!e42E!krPhalYE9ZJ zS+_o3WF}B@m&l#R8rN{IuEIu^=fXO)ls%Qt$0A%+`$-ij)I(_r)ZztC4p)A@q6sY* zym6<RQAsqZ=*Ih&<8fCxrhT$PjfxQOv zSy-m=vYA%(*9)ek)vrx24&2X~os9ELDkyBjCoUwr&g*NDNu)}8(0cL!HU5~+z{|it zRngu_JbwY)w^J=v*vge+dXHcOQxCM}oP5oZS+U>Cf(Jzpt0ggXf_KdnM^pVKddR)k zucq(Ou#!lYyxVyRTkEh1xl!eezwi*$L)5N*&JyWW;a3-OtiK4H^+`GrxIu6<#$xJN z1iMVoe_8E4Yn5WYb#k{z8a$(qw(8o%G)^|(t9U%U)Uu`WEu-uEGsmd`|IFb11$ePB zZ$}?7LVb5tcPVTs=FV?^_X@RHeg< z{jyV^4Be6Ez4ncs2h7$zU$UElM$)V;G~DbydGXJyVKsMJ*o}DSuOg@j1NOo2Z_=US z{A3)w8c}-Yl1nb~2gn z4p4QJo1JEYSJMYv#=ebChP74GY~Gxl4Efzohm|)^P-utku**hfK13aXN z4;6~+Y%;bwWu+2VCD#QNYL+ebEZh{>D2o~=pVU&=MP({w9DislMe+aJe$aOnzn|5+apI1iwK|gibcBaC47-NT9@3kD;Gp9#Q7nQ=mp(qC~a(fY|g|5;J9jQJYy@ z`uve7x`hJ|PPrtmYt^SeSG%0!*G9w{-uZ%vswY$RHSsK^dIa%xdwi41D^f1cGwncH zvPWjm3Hz-5BBZ4iZUI%=|L|PH9&(LcZ?lU4S224BDuMCC z&|(QS7gE+NhAE?r_8oJ@HmM`TQdXBXjflZk%Y6)cb%^e)aRq>IOdyR?+4;)C;}1$U zJ7E-fb`^Y@bPvX?3r+|&)?(3z?J=m**YXt^wl+I&!C$v6UfFY(=o!zs3Vh=3 zlB8OcmtIG>%b!Fa-Xe3wvYs%@$lI&3Gg0vEuC~Pe1(4_c1$0*au<@(i*_dB*K(UDQ z^vpWb%wqmH6~C6^1)!k7;XX#Lj{3*d0v>2Gv%YZ6L&!E|6iqsqzK5s!Xrh^pFvQevuC>$CYSG^JIT-cetdm&g*9K3X<#(kVCNrUIQe*x3n-Q2Nd=5k(odoFM` z#Rx9U|9U&3WQwA)Y+1eKH2V0u2901>r~Egq(7lhBz+LHu&Rd^shP2M-;{BCUUv8J! z7p<|lkpr}U0dI%n4wm;yjTB5kg-}Fk)s?yJoq>s^PdonJ$WE(jxWc#^q@=BX{`>-J zvR>tW!}%=}@vW9%NwNgBx;qeK$M;Loc&m}dr^JiVrH${J!g+)K&Ey!P6Ztn z(OZq)Wi#UEn1|F_|5R~IO$rgik?5St-R74%rfAGQqF$)xh4x3wE;CdS39= z->9;O9XKKQ-}@&2T`K(F?mSuhxyk5RYi*ppRHVNmALG=q7j1gZhj;SIm4lH3$7xy7 zGNxnMDiUzZ*kipjn)TekHJdzOyJdlAG3srCVn?~v@qSGM29*CH2)vVWSYvH$6#EOP zXuG$S`e%uQ)jQA`tcxB(T4c5P1PuZuX&bZDE4`fW*#dO$Q%gw%SF2`u%RB+C5N zlpa`b`=fRsts1##x=@ii>rgv!ezom_98WZso>$j%v#THgCL)&%)OPI|^e)s4;MPe# zenzqzTm)GInwr~dGR)ugp|2Je;~xyz9in1_e3M$SM8=J{TvS$#ww8_u8g(=hho2v& z4%i8HB7~D4&BKt8OG-=RcrtxW+maFoIP&dI75|Vb-)CC7e*1KCzxNz+ixJ#?-p&x2 zVRE0_4v;m_GkeEfLM^yGCRES$U+at5cT2x6Rjrb}?__Uv%sQP#*jFxXa}dJ8p{RqV zeTa~`CDeV%nF5_QpVUDtoDOc;WZBw2>3-ogWJ8h?yb8N5CI(zKl+doo8KdNllk8Gy zL@n)`x+0`y;eG4*iGYJ#GSt@f_QRqDFEVLs?XauZGs2Sis`HJ`_!c2zH|{FVtay@O z!F#N;=j!3l)@jSIBhc}p#e0w6=Qmuii@yipmbGOTPTiw?<-ClZ|z#ENU+h@rHqAM@RMO zyCiioY4J^v+Usbzk$^Wm|cA+!#3 z1v4&U{VN80x;~C62`)w%77cq|>vefz9*@yyDS_u#H!(g=Ex@tQ9FXbhDC(R!KCxS7 z75xw|Ng5*NLkg6YcV+4h{MCpe5fU9 z?%bBwx5T8j-98xs%aQ%x+YJ3DXz}kBzm%GYR=@2b((N^6x}njUXxNejg++{`;@s26 z33$1yhV-I|q(nEjyXpq^$ld))>Vq-f5=Z+dLLB^IvA^9A1?&V$H@I|v0Wlv(!g*W5 zrt-Xf+#2V<#NpdNwb1$qPhYSP{AtFQE6YxZh{zT@f&%gGr2fS0D*S^Az$`&5i0x*C z-q|kR$LGz43mB!sf?kV3Q6Uvcw|;pjg22!V7xFqcuaCHJK?#Rb)XrVKir4Sqj{E?_ z?cugA!|QPmUDgNF^e~Usfx?6Zb?{@D0t)r;0H7#(pgL2jWRdC@N0_ENheY(`yfmAk zgm|D~A1Xp`2g$QKX5&O@=}5m^z&pl$Msk-^6Wr=OY793Q;?d+(@_yvlj#AJ928@?! z{wpTuBNW4msJ#cB{1CE=V%V8RB>g0N%1{Zr;Hv%oCTse_8QR1hpggSUs49JraoRfI zAw1u}D~*`@)RGlWAsT8J)@5nWhUYtNrWDE`cABS=1-16%+Dn{!$mwzpYXxIe?VUAC z1p+MOcrUSuDMC#T8q(}fq&!FZv6v2gkMRBiLe*Sat;e|Ef8niAp0ZDzM#q~hew!RLDOjjF7Cp`AS}PQ`N+@yumf`J~CYwq- zoEaDk6#YVA5xixVlQQ|xCqJ|0=96lZInm4U1n>ST<^J`o0ZX0*BTSv8scwN=a66Mn0Ktt<=hr9zi9j|&#xs|{qg+q)1%tdG=cJzSmYo@7I&0W?b0kyZ`LWzV{(WbeiE*^s^fXInR$2}Z?wza>JR~k4pBn@2DpIvl;_e3sClhPERa3su za~tZGR+Zdl+P~LAIOM;%W{Hgv1{vY(RPB6X*5-5_7HZ+Np%oVePO zsvkc%P8v>SpalF`5HB4_7lfND?)twRe;?%S=oh2xbZNR?Q`*k%hja9QojBoASDPPz@SP}~RU!3;hkJ&>&4lty;&TR`; zqiB*2k6V$j4x$T%e%sL=1uvC;jp%zgD;He7Bc@ztT{m=;X3Zy{u`##ui&cP={w z`{M1Cppu&lS-(C~r5ASY&cidms4UkX$6#JbwEfES$Uso%hOHc{aoM`ybB_2=YS0up zgEbQ4#p9y?WJ7PV#ji>SJ;V4?Oo^Bo&gRYR0!<~UCmMjNa>j#6;ZOs0vOd*}PoCq8 z&${2(#V86zyS4CaQu(%o413vlogzM-B~m+mpvC?m2=FYUNzQ%GAx#d}2`Mf(R$cRp zn}0vju7$wbXc9b`9)KxeM4WcQDdXrKI2mbHfZm-@eGCDajA+4d=l=$vM+Y6+1b)LYle;UqNq^dVQ`AY|ol%D$0|;a&EMUBD|F9vfxw8 zJO9|YlK?X>$9nzlrtWC~75tv}(9pm4~lxt`r#L)Oi4k)!$ia=WdBF8)Yj z0Ng*7G3+|*nlUdp9Di}XPUO}=yd+%%;t#SjA7gasoO5*l6+`}&1OAH#_;0DhN1AZ1 zt5?(n6LT{VzqvF%M<4pAz492BbjKGl&(NR251ml)SfWqEHw;9I+hX1bJStgOY@Hr@96^USUi2TM>W&vl4=l`tl^ikf%f|6S?_E;M2h6v4rO7w8h;NJB3 z*;J1ga#gzw%h&(fm$T|1`h|yY_7a@7XQb?}NgPsSQE;SXS&ntbFs;^&0agE%YdzF_ zJqhFNrO^@3-tt5s<`M?skB(eFcV?UVCMvaDEusGW%nVW-!5 zNkL{925~q?W!q1;tpA0iKOmv9Had+vWAY-q+l7)2U5E7dGU#H0`cW2+tWncYj~ z{w}S$)ggf;nvus()8)}8Fr!W1XxWG^d`-~3Xqj2ppGcl>x!kEe$cBr{1gp7hp-mv0 z8kjwfqm{B#Q~hijThaL7MQ<{3E!jLzX8CIFQxsjc= z8Pf8~`{A52g!p@GcnbWSv6Ct zTG-~C0X+Bg(6QMSZhL`X*Lbn|AMh84Q2bwj@Su~m@m(Wd(X$H%KJ;He=Gr|OBRDY` z&K3YzNIE9dg$}RY#cxC=eF7$%8!TlKj%NkskGd5Z&@ROfCfxPk?9!InbestKNUt1i+Bi!5p?U!94QU1R-3lZi%huhf+Qbvj!9+gkshK0GqmrWM+b z!~01nkWTS>{N|AiD}F7?!>u{AjcbOMc%Fwv3ZH=Uz+Q`DE9K^@Le!x_vRN|DwO%!j zkF+=b){A!$6eBhsz-~aED4i(vkl3AW+WdFiL#eSRkA8jXI(WoY&N8_6)QC2a<84cR zofjV(dVp#Wjs3Ok@OapUT;E1iF^;-`e*%gtO&p($ptA#D&te_tzW?WWhn%U9?W|iP zjDD|i)ORr3GrbZG`%#FUI3F>e;WpWJOdJZBg|I0wJ1J^LTn5g*yrG`<&*Gl7D~FJF z^08f>Z9FXnIr4f%%C=oAy7dT$I2%kqO?^j3i>#!UpCXhPS9Y~DNP>T_o}a#E;6FuV zE&EByan*$cp$zFc>2YynnH6Ax<&8d5U!IFJ4Z!ofU8lvJ-Flc83fB_qBj4zvI(KHJ zqbD?v=Xw>7E(pIjia2K$XuuQAyx#>V^;GCwFsj9)e=bKZ`>S~*2EPUw= z(IuBOv!>U9YaYUB1RBqr;Qoz@QDumZ&GGBpZbH85>}Qj6eB@f$yMb-A_>=KG^V(jq zJ6WS*6Q4~qPEVc~Z3-&kH5R^|AJui)YJ#&$^FD`UVrlYNP zNveK@ondy|ja#}%xL~y$9HwUn zxB`;1ygtTM72Z7#-};+H#!r`D#A`b@4>dHATUy9;)qZh;st(ZNsw;}d3o&Kp&<|9X zeQ+L5UU#>ahdkur->%>{ghC2#In|k2EeY?}v?|jfj?JpgJIya;Xgc+TY1rz79GvR= zv_^H~1IX3g7Xp@Ua$seXPE6jxbx9IN_@gNC+_bF5GEdn{XQH&&^&? z>eHOtU+66Zp3;$=3RFV_tj)@1v5Cg;ET2F(+O6SD+890oB6nVIv6?g$?@~#1tuLx> zM@4xNc*e4y4*Fd6<0iw%#<8rbMA&ifs?9+6+d);=>NFCALWK(s;s#yiQ#%liQ5&=_V%`Wg)0;L)n2-n2xCbFM~0@dJA;fo%4LDL*6`6*><+~WR7&m zH#)X!*yactjDv<}X)4Ez2F!y2e*|ebj?2+wx2?~*y?rJ`3kcd6ZCX`3xq{YLzH~V> z9Ohesi0mt_To&T}-M*SD#R$IDr0<8F(@Gmcr&CD7iRFJOF?Kwp?jU_U{U7IpuE;)o zWmb@yif8x;6bmeK8_3D4AfE-M^TCEExl__j<0TCyQw?b;@c<>VF(~36GWw@TgV%4| zFxc6)_|EqqP?rxI>;Yl$m(tT=G*%Fh=2K=6%zBP<9UjX}m(c#HSahvnU}EUj*I+xo zo!|{{9yLD?8&G9Kvlh8`MN4~N$>v0OE-%kcrW;FsMjPO5P`x?+;LKHUjsR`~OAUa-Oq(dDQ1 zmD~+=Aw)m1`z7whQMK0iZ>ih6e9CwG zNH{WK)7quoc48MP!O_oQrpfMBPwep!AsJj#WyD5g_r-xa)0!MFg}~*!4uMOY6*d1g zBsVAl%^3SVKq2m-E-*Ql;VLEPmzO4qJ;e`}DbI#{hB?y<*qBLj{DUa)d;wD~jcju0 zEme+$PBeu?L_FdKo+!(uh*ln)-8!??f1N0yee}K9LkNH2XbnQ7 zQyhOH4#dn$Os$H+hE;e>@TGv>t!;_*e!G4v(fI|7Z?`pF^u9FyVu3_YZ^Uf0t|pDu;%p_Lj)=&<-VSHTyH&5eNt(MC#DW3aR=mJ&%R9fNlBHT#oTNEk~_%Ix%F)- zbEKY8`ld;{fzy_m2tv;KB-ZTfR943V<@;w!mu=#^`kkRfi-ggBZH&BTy)droF76P) z2`CjayW*dC003(Rzu;P++jLF@(~Uks;j^A!n&;*K|XR0gUCK99KkPdvj`4qjbWA8!RbEJG@LjP+x594%^ ziM{)a-Qmu`gX!V1L9#+fQSV>CNm-7%Yc$BEgW)0#8um89C_SY3Xk(;CCW{+a5u6w{ zMUPKIiXbh>7A-zJuzmmA{?)cj&MbCOZDEHP$ zx&8(}^a5R2-q$dT+pT{^p7)Iz-FaPOq*at@|5J7F&r+JBVkhx+cL=yXlK1#ElL=JinKFbx#rf7ckP0 zv0owrDVTLFn~Ia%zbGq(phRDCPLu0db`SccT*Ch_akIO|XG`eB2Wd7k%J@64W$s^f zz?T04rcju#x1<}pg{@4Z4&Q~T*w;zN%o8ebM9} z+2q?CSRdV0!E!|UMvtq*jSUnP6>lt2vd*40__J`V+OeGO+%33@lPKLN4cWE*TJ0dV zM&g3RM`JS-5TRUMkle6N-XQWM0Hx0co`+GDMd;GkrB024`oGEdlT}^PjvY@U=R8f! zvq6&96{0xyqyaZTJw{h%Q{b$a*=5{1z`q1=*h zNKp^KT6IV%6$iw+;G@+-pVT35bIv%5&&dyI3_bTM&QBKPmmT=;@*7b%BiRf4&-do! zW~ftb)0pPBda`eb6g(eIn#Asq1GUe5ukvKhyzB*+0y+fmTTe^Zd@`;@zL#x|C17hkQsHWTPhXCPNnRXEjy1#9m6hlG$FP8xZ-k?LAiLNrd?R^Tjx$)r1ap z#HlEl7S&;8%WLA9M_{nznyOQ%2V=H>M1xuJ^=zim+p-sgeji+1IvoH674dLiXcN#cCrk(D$GkG3fXp7fac7G?*=%f|;z(1qj` z(bsuBChJ#pa10U@T`i?HY=l$^wGubav-V~^aCeZEvwF(_#hi!3iPf8>;34d^o9?}Kj+Z>UY}gFy8In`uk46GCIS>w%+3Ko zNFLzc$eF7~pHhHcU%v}pI3c7!F8E>mh2xn_9MKe}TNIS}hR{t2A2r89wi=Br_0-XG z2+5osat_n4ac=8tO-xrCF=o~a<>u>B#E3nmNgjZc1O73h6hQj8@V{g`|G>@Q#vfjO z@AWHgT*9HHXhLg-a4f|^-m%*mK1puLM`kW(sArFKfbh23nSv5YKTxKE=R+TCXM-mE zaD8}s>IOlM#{`Lo`yHv=>viZ8Dx@q|IZ(@r8VFx>7B=Y2v@4JKO^5>w6E9)05;q;J zUZ7*AGendGtD1thZ@iN zQ*>}Q#DPrf)u4!?70o?AGgA4L;t;O=9v{*`xAAY`V2tr3e0u~MZZ^9>uukC9NF7Ph zT*}+%@-p?M)+Dk)d1+ANb16=z@%7IG2^+U zNf#Iy%}?3^W$)rq`9qOWuX>>csG&|w??R%#tWU6hG+lKW$hhn%2{8x5hvmXMg~vCdZ|{GV8I)$135g5YNc5RsHDfO11S;M2v%M{oWK!oGXFO1pQvl6PdT`ec^;ItM7UaRj6UfwGXa@Iuxz> ztAbNuKtON}wd=~uoj0>cZMR2*Rr^MMkc;+V+}!sBu}eu47s9Nom(97yS1?0yyD^x- z6qTS+99kfYd{^!gB3HS5`c|cM63HUxwdJSCp}ApgxAYN*$%%Co5v3N18 zF}zrO1Mcd4!CZu3SE*5i|__w*o51$k_n7&J=_E$edYYv_v@s&XuF>Iy;3 z9O@t_mYAo-u=w7hQ}>@8s0TRZ*!V8RTPg-Ofg)m-t;W8H#QlcF`@7^0p-tLm(>e+ zb?obsjwWzBw`Us~Nq2vwcEY{)Ldyik?hXfGi?5=iykOD61^di9F3PV4EZiu{-G5x& zteQ4c&o16;P+M|ZAVW&npxh~#_lhtMNVIF!pjXr5c8*TiHOyiAP;FnAD&$h{z~trJ zOO=l9cg(#RHAciitMSPNSpj!i1sDs;Bi&YQkwr{E^A`9ED97|mA3!P$CUL07kX&|m z@1U@?lf*00nUxe~Z~erZgtbFVVmvM!OXu^HwJ)mWAETU})arR-GU)wQ4^57(AiY#N zrRJf;{(qnxuv8;W7~#KAj{hig{?t!%bIYuc`wvU_B2hysIyR&M&MiSI9Y_`T z*d}2k&6qiBz9)&lw*ocfZ3My$7~`Y07LJ$J?vae?-7>$Ju}OZ6e-vcug@Z&}wXLR< zg;2fyfia{_dPXGlY+8PpyDp)YH1HRb7cIxZc=AJRuq#BVo=|O_5}C1faZ_i_5l3S< zB=eSuzU~;T9#C^+hhPgitYNyVPpSE=Iu)by!Zflr7(3er0*!GTilhU@c zg^p;eaSe4Q2fI?PRQ~uC#XP&?R!{$0pfA%Rrja$C(dj_wp{`mbL@VHJ3uwijG& znT`H&24*_>h*uILN~|uMRNCfR9;#F=^+jpT`qUZJ`Fqh^Ort0n7H9SH#2%tj7)yr=^{UOo`uTQ+vaykh7(+5eF#`)7Snnq7*SytiD8iO-_1|09zB zw+p!}A6fdb=%7=7;!snPw{ntaeYyg)YOaIZDZl1H9*st;?{SL943)j4mQH*1^$2;H zxD|q<82c6J$V%Ao)vL#{Oo>3sk4~swu2*~?)K}?9{Ng-u<2EoQpoYx`0CfV(W;_qV*g|j|y>R-heMH9y>=Hb5uWBeqolXTa{a_por zYPrGPg5468cT**w=XxnYIag5hkc#gQUf0`vYJJ`?$bowsW-d(AQ2kq{gJ|sy$LvD_ zvv?{4gVj*hDG(9!3~|Vjb$GJ0`t8!_mHY{(-|An0{Ul9RttYSJ6-H#b^b7wq6=AaX`n?(#fw=@GD<$;7#rgiG*8pHrWnv>u|d5$+i!+b@(}luu=z10HI+4T>VR* z{8XBo{6vUXwJI%yn0wx{;oP6O_H$Dlzy%nFScXFC)8CBRPKgRjeA|8jBmDZQLdx3Z zSp9eW_)h{HVESr%GA)9ubcNv)dyU-~buhW1PsN5rESh;ny>l^a0g*k9P*5&LoO?Oj zwg}xR_&BGxTDpFO$c)lmo@22Q#^JCtPOayL9jUnNtxfg3k|*(_ z2~XOoieI-;DilH}tbu7dm0psb4(WCEC5as_CLS;zWRsc$0o6?Cce;w~H1wjJxpiwX z%{dYsZrF1R#7RDqGXD!&R(2@f$P2*bJLmHwLP}s z7Pa5w9xXeVHqxkX=>C_y69I@x+qNpQz=mqE}X`q!sL6Q zOjm!T9{NNL%qPWmcW$|{^xDOH?f)=XfOQE7<=?5W7E2LarbB z?5M^<+q{d8UsX}q{Bn-QQRbx!UjP$l0~HDR>rw^5k*i`^=a1*Vxu=+u9Q}wh;r0|{ zr`dP<9tlzucr0^%Ai$huj zZZdSG@JB+o2i$B7Mp&)a5!3?`F%<&>qLnoG(V3p|Vv7f3|HmYj4C2OW*Y@3dW1aMkQuE>YA-Yn~ zr8vX3L=f*quWkOzJZI#PvuG8cBRX2n#&lh5X&1(>)6x4A=rJcrT1=Wqcm&)?*d9?! zG1JVwqbO0~He$EQNclku!44aWhnF%KSmqAG7Z%|X{$e-(5qAu2*SMXKhm9^fC>Xa3rj%#*b{K z0H)zpxkEdvf6PSl2jc+j0s4MHo?O(>dL>douS!&? z=JDmfw45PD%eYkI0wrl4$B}vIu>2m9ah-WRcFUrw9aZ|tg{V%Ede3>wPR&UpgIOtM zZKFiuejh=1Uk#ux`)B}jpmOH2u3E6<_N) z<+RvGuF1V55VzpaY=ha+3pk%^8gqo2$1A6{C)^g?t8o5Y1Olh^LQx;Alic%7B7eDN zQ(urW7)qm`-QP*qla<(N<@_Ah#fN3UP{-6ZUjW)8x`JZcF|;c75|=ZphT7S4FCt>-?H`NSY`A!qNp# zAIaq1z-ir@9TIKbKr;%cFR_)BG&l#UuNf<~pQ6~`jij5stF7d%d`wr3J}5NQi7A+uRHsyUAFIWeSQZr;FccWp*Q-+r^@%>OGP{^I!|m`3ArN32AV9A`?ymyT7TAS z;i_z~cqzt7es2+T8f*yNtoInc0g-%$CQY8Yzmu|r@X!4T5Sqo>6Vu+nbOZiVi~JAC zj>hGIl9=e+O{qa2ZP6(@5x&zpL)LKm7_OvABAcOWS7 zcurE=k9O8UZ&~@;&#s^D|0wOcquKuZeXJraRa>npYE&pcqh^bmAqcfqjnGtLRurYE zQMJ$*_$JiZo~gk&Qqrd?pt zav|WrnbkryANsCCJYCa<_8&>ITDghvd$%r~yF|HF>!Ey%!D1vN*@{>Jf49XFY*7H< z=h3Lx)mHTw8ryiq2xNFCFvm?X-OV$EpY0P68o$*O(ZJQ3)@9xIRdDkJsrt%THMX6U z8tUbY$Q|u|Q)>dE%f7*o-|Ov)Zl`dzlp_XIO%qKm&Zh%0kiu%ud%pdA5>K;?nu_?s z^Q5usfiao=Q}3~d$*P8jfH-ivF2nsw&BrxUz`f7zqYBf3Z>ixQme#*3!ud8^ym#97 zc7lDNQ6)7USpSFF8**O20ZAAAQE+Ng?p!l=a07IjGwRcOM0j}G({|J^fFbDoQI_0K zwT?*ns@s;_DER2e83mExWNn9QPDL3!=B=xKVM}LE6K{yX&a4zJh-kkZoNK#Z!kZB} zh`ld3e}&JsQ5snG8zHn8?Q0kEduUuIyRw7i%}ZC}m%j*Dz0_8aP(QD{A&z*S^=$ca zu}yT%Igt)hj8}lAh^-U$)j@;zIycZcQ(7r({I_|dCow3~I719aO zF?w3x^aq>pyOCMSyM}70w3ITLG!*LOS`=+Be4ck1OFC;cXC=tAqoezidL!2x{M~t$ zC?3Ka*d&RMAN}6r7d{PPOucqr^Dv|$62oNu`+slTj*Nk?JXRYOgjEf-Je)oOyD%Gw z@XC5j6E72aVPeXvln8li=oVh)@d??{^`O)z2i3Eg)qmiVKQWicS-U>i;v@vcoPx_H ze}-LF)#P+Qe^=E^$&*69I`{8oUX?Gm$hMNzV#fnxcMv)5V@^(<+wU*q6y8716llyZ z%~mx@Ol{CD!(NQ}KxAFJQBl@X)@h&wXJzi%sYkc1Mi+mC*zyXQND-%vNkNygue9a2se8WDPke(9#u?N>fJumMa1jE=Ir!vIsP?@=NEn4qWYu-V26F;r%elm*QJE)%jjcwyqru2m0 zS+L~L>hR`lUmf2zZ9uqD=X204xO)4>V^BP&FmT55xK2sO(oC!`(5=MNrg(k z0A~3b>&TC#Te2@G;+{P=KVhJ-_i)QprEN^0>(zO80kB-NZd4fUJ z!Ucf4hB2K1IUjYX+x~ib*8ROeY<-O&;ad42+B|e8&$mCp1664x&{WJ;+|Qa6+#$=2 zmwY%>s7k(Bj@E->Qu?KOAG>J$y^r=!3wrF)pT@LUEp&$=n)DGyNJwk_CPu>7;wzm4 zS&$Y4^`?IHB`nXVun(6xbgx(3F%gA;Hilcd@u;mae3x0|JMcDd3o)VJO`*v2;?jco z$E>Ll^TfH@njO#Cs?nPX%&nSLGD01Zl%~pHQR)10Z8i9FGsR1%iZ6r!KO|GtC2I#Y zrVOIn^xu09Dj~I2{6t3)drXjXPYg*joOZXyCEw9j;%?8GcUp`jTo{i_*-| zgbQu+aHlHc39?I-Uq40ZW1uN!$pUWhvI1xiZN`iT+@e*}@_9%0HnSjH-zKA$>uQ=R zRm1DNdRyl#sURaWxE6i-;E0KLu*Rru-^JAjok5pLAieL*svajt6xlB`t-h9-+~q90 zfp~jbHJYv`7lD2A#BoB%G0IBFdim^#>OEd(B=g{XwAT6UpGvYcO9hNp3-4ojk?&G#S+*C zL~@C>&AMe0_e?|alFl{>P7dNRXe-+zuQpq_H;sXCk4t)t9I4-;2GN4nQ&jb4xkhJo;r^F<# zJ1Y-f4ar^)Z3qcRK3}x!Vz~F^`8jwY$?Sgl4{Nn4xt)W%b$CrCJa&!8spc-lhHRYFxIaCZtXZW#{HvSn*-@i`n+x{-8~0N99&ub7?9#wJ7XoL zcoZ>U+FUo9Zz+cJ1!6z&`0Mdj%aT1ryH)&@63S~ED(o*Ex}bN0>a-&oDTqnQVd9{# z#*=GA;4D1LDHN|W6D2L<wL-`dybXoDd9*jGtDEcJ#5q|q77UZJ_AAweTR?F6?HzA8hh2; zm$3c-j{LwqsjAAWiAn=WdhQbELQr=u5F1%E6*c~H)srFyosyj;aV_%J-P=@lLaOx)jQDP}EuH*f*b~(A z%Gm!j=|+{r72IB3bXmM@Ftb{a`G_KL*(LShYK~ZXECeLM@`EMRg148EDNgDM@U~A` z82$-_bTS@&n<(R5@A)3d=2~Q2N6F7UL1luV@}S_#1}a4PBex8Y*}p+rR8pq&xk)b{ zZb}DU@?G~{?P8ckc|djL)$5t7IOi>~ERVq!qlZq%ZR2}S@9-2UXgD~Itlyv&+?~~%bf~#fS$e^)KF*6MXe>V`D%jh&je?bz<1A@AJ-~ z@KcV)rQPi;%wRfxIb;kT+jVOlDQk6Cc~RDSRJ>5i4_5w-oS3w)fOZ6_N2Xl}+QyOh zysFWM0r__nIj-it4~DU7NpTQ(t=NGCfBU&Rqf&!lO+~W&G<&+Hx0b&RXG$N;r_NeQc`szqW&(UTA$He!sQ=j z8bWxNNEn9Rhq5B5J?9r!?Drkni#=LHs=j-B^okC*UE{M$J7;J%Mv)UghhxlJ#cPsVrg$m`3{ zn`SEBwwBQv#aPXV&Tqpm+#(^5?+37>-wYZNvAg zjiG~;m)DoDOEKz_nhLMxgPe!OL+o5UO!iM4`#-yl1{MF|jdKZ=!UrDxZkO+c|pV&Uh`T$rV6KB0~%w1hnl>Sy=Gvf7oInz z3--RVs}&+XeAmJzUnj}>c%RP-bN~s7<)P4H-3>l`@4zn

@F*Eyla3FNGkD>-QC0 z8*VerCdm!!H`IO3DV`b|^nds)`+Aq*z9uTX+m*%dsnR{Vc9VLcG0rhcpqFdjGU|{A z3ov=C5xx$?ev=jh5R3*e_~T%47cUK9J!dKW%*KhG^n*($<2)}YT}{^0&=LJZ%>kv1 zo%T;BUo+k*!2AOE1QskF z@4z+DwLB*s#mdOgT<%5Kh*x3O`%Bw&?8N}vYugIXT3|%W`5+|3%$@3{%jy^+lwQoO zDwt}+)MT0jPrca_^uS^F!t&+4w_V=jpa5*|Ug``uR}yZKdTsM6_26vUOHzDXPY0!T zvQc#?#};mW+|3|lm3YEB2~@1P8?~vtZqK?^<>riuGTeYHI4GAFcs!d4FPjt$ey-Y2 zbtq^HVN?O@y&H@p<^{vIcee1lL}xqBLSx;jvp*KYn##_`1vF0w2-OK~;0wiqww|4I zN7yLr^Dc+zxtQ`CUB~R$^*y0?F^zL=%r&b`!c`dj0?4JYPRW{H(4a!T-+E*Tr29sv zT^h+FY4l{Q#!~90fvH?mF2n$y5LrX=u-_ zM9b`W%^X9t`gHec&G`M2z?x%#?s3>XEBT>ph&$iv3em-9ji-E~*E# z;2Exq@8}$;8(PWyv zQ0#2Wpm4j@St}<5e;=sGD54KSW?24qI2<;e#H)3uGfkj0Tkr1iW@SmbD>oT>=7Z@> z-FVH^&P{+LVS-M+0^6zscJCqwdt4(C& zM0S6iPg75Vu;?=q3O&Ph)Nc&1D~%d*OuNFILo(Qv7p~fCcnRIQdxW>+88Nd%Op-$b z-Ak0Irz@yVrZy?0IOQe%2ky9!O(UK1JGpmCDtrxl6$y4557g;Jv*KSgAwz{eg1fE7 zzM!U>aj`O5m~@(u5GllJjBAUyQF2~;gb|KpVv3)K%S&7&M_^dyk877T4wVM2X7o=f z$Il?eSpHs^m9Bb>{{RYQ@-;{l3+QJQIe8rt0F3zQ1x&P@kE+`hlj{Y82$LK@0e>wN zTV))YoGWoK*?Z;Ij|hd_QF54CM({}mKE>L7j}|Zf@n`SGM@~(%fjCPZo|j#gnG{ms zX2jq2&mS9_SW5JZW@uY;Qxxr344oT;8wGT3;}KfrM`gp2=G9Za^xMeyW(!lErkiDL zWXAM@a6cl=F6Cf1a)v&dCNLDjl~T0rDxuY8kgF8s{McVF&yj<~_qF3E)gKDYBzUrG znWk}|jgl_*`ENmJZQxA2ofB+#Csrjm13L=>--dz?2$v?}#Y{pOV`aWEH3|9!7Vr{xKR8Mv$AqNs4eA1`Osc}WEd0PGqffa76^41GX z$UBsUcJ5I70~9oz;l3*UzMNC`0kx$KE?t_q?C=zKlkU+9IXyW-aIdwmFz!gtb_v=j zDf*1nSOS3Jk - -]> - - - - - - - - - -;;Default extension for filenames -(define %html-ext% ".html") -;;What font would you like for the body? -(define %body-font-family% - "Arial") - -(element emphasis -(if (equal? (normalize "bold") (attribute-string (normalize "role"))) - ($bold-seq$) - ($italic-seq$))) - -(element tgroup - (let* ((wrapper (parent (current-node))) - (frameattr (attribute-string (normalize "frame") wrapper)) - (pgwide (attribute-string (normalize "pgwide") wrapper)) - (footnotes (select-elements (descendants (current-node)) - (normalize "footnote"))) - (border (if (equal? frameattr (normalize "none")) - '(("BORDER" "0")) - '(("BORDER" "1")))) - (bgcolor '(("BGCOLOR" "#E0E0E0"))) - (width (if (equal? pgwide "1") - (list (list "WIDTH" ($table-width$))) - '())) - (head (select-elements (children (current-node)) (normalize "thead"))) - (body (select-elements (children (current-node)) (normalize "tbody"))) - (feet (select-elements (children (current-node)) (normalize "tfoot")))) - (make element gi: "TABLE" - attributes: (append - border - width - bgcolor - '(("CELLSPACING" "0")) - '(("CELLPADDING" "4")) - (if %cals-table-class% - (list (list "CLASS" %cals-table-class%)) - '())) - (process-node-list head) - (process-node-list body) - (process-node-list feet) - (make-table-endnotes)))) - - -;;Should verbatim items be 'shaded' with a table? -(define %shade-verbatim% - #t) - -;;Define shade-verbatim attributes -(define ($shade-verbatim-attr$) - (list - (list "BORDER" "0") - (list "BGCOLOR" "#E0E0E0") - (list "WIDTH" ($table-width$)))) - -;;Index -(define (generate-index) - ("1")) - -;;======================== -;;Title Pages for Books -;;======================= - -(define (book-titlepage-recto-elements) - (list (normalize "title") - (normalize "subtitle") - (normalize "authorgroup") - (normalize "author") - (normalize "date") - (normalize "releaseinfo") - (normalize "orgname") - (normalize "graphic") - (normalize "copyright") - (normalize "legalnotice"))) - - - - - - - - - -;;Index -(define ($insert.xref.page.number$) - ("yes")) - -;;Index -(define ($generate-index$) - ("1")) - -;;Tex Backend off -(define tex-backend - #f) - -;;What elements should have a LOT? -(define ($generate-book-lot-list$) - (list (normalize "example") - (normalize "table") - (normalize "figure") - (normalize "equation"))) - -;;======================== -;;Title Pages for Books -;;======================= - -(define (book-titlepage-recto-elements) - (list (normalize "title") - (normalize "subtitle") - (normalize "authorgroup") - (normalize "author") - (normalize "date") - (normalize "orgname") - (normalize "graphic") - (normalize "copyright") - (normalize "legalnotice") - (normalize "releaseinfo"))) - -(define %show-ulinks% - ;; Display URLs after ULinks? - #t) - -(define %indent-screen-lines% - ;; Indent lines in a 'Screen'? - " ") - - - - - - - - diff --git a/doc/UsersGuide/clm_ug.xml b/doc/UsersGuide/clm_ug.xml deleted file mode 100644 index 68aa69b1d6..0000000000 --- a/doc/UsersGuide/clm_ug.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - build-namelist"> - configure"> - NCAR"> - CCSM"> - CCSM4.0"> - CESM"> - CESM1.0"> - CESM1.0.1"> - CESM1.0.2"> - CESM1.0.3"> - - PTCLM"> - PTCLM1"> - PTCLM1.110504"> - CLM"> - CLMCN"> - CLMSP"> - CLMU"> - CLM3.0"> - CLM3.5"> - CLM4"> - CLM4.0.00"> - - - - - - - - DATM"> - models/lnd/clm/doc/KnownBugs"> - NetCDF"> - FORTRAN"> - FORTRAN-90"> - MPI"> - PIO"> - OpenMP"> - NCL"> - Perl"> - XML"> - xmlchange"> - 2"> - - - - env_run.xml"> - env_build.xml"> - env_conf.xml"> - user_nl_clm"> - - - PTS_MODE"> - CSMDATA"> - CLM_FORCE_COLDSTART"> - CLM_CONFIG_OPTS"> - CLM_BLDNML_OPTS"> - CLM_NML_USE_CASE"> - CLM_NAMELIST_OPTS"> - CLM_PT1_NAME"> - CLM_QIAN"> - CPLHIST3HrWx"> - CLM_USRDAT_NAME"> - CLM_CO2_TYPE"> - DIN_LOC_ROOT"> - - - CLM_QIAN"> - - - - %ISOamsa; - ]]> - - - - %ISOgrk1; - ]]> - -]> - - - - -&cesm; Research Tools: &clmrel; User's Guide Documentation - - - CESM - CLM - community earth system model - climate - climate model - earth system model - land surface model - hydrology - biogeochemistry - urban model - documentation - - - - - - Erik - Kluzek - - NCAR - - - - - - - -The user's guide to &clmrel; which is the active land surface model component of &cesmrel;. -The purpose of this guide is to instruct both the novice and experienced user, as well as -&clm; developers in the use of &clm4; for land-surface climate modeling. - - - -$URL$ - -&build_date; - - - - - -Dedicated to the Land Model Working Group, winners of the 2008 &ccsm; Distinguished Achievement Award. -May you continue to collaborate together well, and continue to drive -the science of land surface modeling forward with your diligent and persistent efforts. - - - - -&preface; -&custom; -&tools; -&adding_files; -&special_cases; -&single_point; -&ptclmdoc; -&trouble; -&testing; -&appendix; - - diff --git a/doc/UsersGuide/co2_streams.txt b/doc/UsersGuide/co2_streams.txt deleted file mode 100644 index 4d38c6d06e..0000000000 --- a/doc/UsersGuide/co2_streams.txt +++ /dev/null @@ -1,50 +0,0 @@ - - - This is a streams file to pass historical CO2 from datm8 to the other - surface models. It reads in a historical dataset derived from data used - by CAM. The getco2_historical.ncl script in components/clm/tools/ncl_scripts - was used to convert the CAM file to a streams compatible format (adding domain - information and making CO2 have latitude/longitude even if only for a single - point. - - - - Input stream description file for historical CO2 reconstruction data - - 04 March 2010: Converted to form that can be used by datm8 by Erik Kluzek - 18 December 2009: Prepared by B. Eaton using data provided by - Jean-Francois Lamarque. All variables except f11 are directly from - PRE2005_MIDYR_CONC.DAT. Data from 1765 to 2007 with 2006/2007 just - a repeat of 2005. - - - CLMNCEP - - - - time time - lonc lon - latc lat - area area - mask mask - - - /fis/cgd/cseg/csm/inputdata/atm/datm7/CO2 - - - fco2_datm_1765-2007_c100614.nc - - - - - CO2 co2diag - - - /fis/cgd/cseg/csm/inputdata/atm/datm7/CO2 - - - fco2_datm_1765-2007_c100614.nc - - - - diff --git a/doc/UsersGuide/custom.xml b/doc/UsersGuide/custom.xml deleted file mode 100644 index d6a60a28f7..0000000000 --- a/doc/UsersGuide/custom.xml +++ /dev/null @@ -1,1615 +0,0 @@ - - - - - - - component set - compset - "I" compsets - "B" compsets - "E" compsets - "F" compsets - &CLMCONFIG; - &CLMNAMELIST; - &CLMFORCECOLD; - &CLMUSECASE; - &CLM1PT; - &CLMUSRDAT; - &CLMCO2; - - -How to customize the configuration for a case with &clm; - - -The -&cesm; User's Guide gives you the details on how to setup, &configure;, build, and run -a case. That is the document to give you the details on using the &cesm; scripts. The purpose -of this document is to give you the details when using &cesm; with &clm; on how to customize -and use advanced features in &clm;. You should be familiar with the &cesm; User's Guide and -how to setup cases with &cesmrel; before referring to this document. - - -In this chapter we deal with three different ways of customizing a case: Choosing a compset, -Customizing Configuration options, and customizing the &clm; Namelist. There are many different -compsets that use &clm; and many are setup to enable special features of &clm; from the start. So -the first thing you want to be familiar with are the different options in the compsets. The -next section shows the different options for customizing the configuration options for -&clm;. -Here we introduce the &clm; &configure; and &buildnml; scripts and how using the options in -&envconf; you can customize the configuration and the initial -namelist. The final section tells you about the &clm; namelist and how you can customize the -namelist once you have run "&configure; -case" and have an initial namelist in -BuildConf/clm.buildnml.csh. You can also -use &envconf; options to change your namelist as well, before "&configure; -case" is -run. - - - -Choosing a compset using &clm; - - -When setting up a new case one of the first choices to make is which "component -set" (or compset) to use. The -compset refers to which component models are used as well as specific settings for them. We label the different -types of compsets with a different letter of the alphabet from "A" (for all data model) to "X" (for all dead model). -The compsets of interest when working with &clm; are the "I" compsets (which contain -&clm; with a data atmosphere model -and a stub ocean, and stub sea-ice models), "E" and "F" compsets (which contain &clm; -with the active atmosphere model (CAM), -prescribed sea-ice model, and a data ocean model), and "B" compsets which have all active components. Below we -go into details on the "I" compsets which emphasize &clm; as the only active model, and just mention the two other categories. - - -When working with &clm; you usually want to start with a relevant "I" compset before moving to the more -complex cases that involve other active model components. The "I" compsets can exercise -&clm; in a way that -is similar to the coupled modes, but with much lower computational cost and faster turnaround times. - - -Compsets coupled to data atmosphere and stub ocean/sea-ice ("I" compsets) -&compsets_list; - - - - Compsets coupled to active atmosphere with data ocean - - CAM compsets are compsets that start with "E" or "F" in the name. They are - described more fully in the scripts documentation or the CAM documentation. "E" compsets have -a slab ocean model while "F" compsets have a data ocean model. - - - - -Fully coupled compsets with fully active ocean, sea-ice, and atmosphere - - Fully coupled compsets are compsets that start with "B" in the name. They are - described more fully in the scripts documentation. - - - - -Conclusion to choosing a compset - -We've introduced the basic type of compsets that use &clm; and given some further details -for the "standalone &clm;" (or "I" compsets). The - -config_compsets.xml lists all of the compsets and gives a full description -of each of them. In the next section we look into customizing the &configure; time options -for compsets using &clm;. - - - - - - - -Customizing the &clm; configuration - -The "Creating a Case" section of the -&cesm1; Scripts -User's-Guide -gives instructions on creating a case. What is of interest here is how to customize your -use of &clm; -for the case that you created. In this section we discuss how to customize your case before the first -step -- the "&configure; -case" step is done. In the next section we will discuss how to customize your -&clm; namelist after "&configure; -case" has already been done. - - -For &clm; when "&configure; -case" is called there are two steps that take place: - - -The &clm; "&configure;" script is called to setup the build-time -configuration for &clm; (more information on &configure; is given in -). -The &clm; "&buildnml;" script is called to generate the initial -run-time namelist for &clm; (more information on &buildnml; is given below in -. - - -When customizing your case at the &configure; step you are able to modify the process by effecting either one -or both of these steps. The &clm; "&configure;" and "&buildnml;" scripts are both available in the "models/lnd/clm/bld" -directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what -types of options you can give either of them. - - -There are five different types of customization for the configuration that we will -discuss: &cesm1; &clm; configuration items, Configure time User Namelist, -other noteworthy &cesm; configuration items, the &clm; &configure; script options, and -the &clm; &buildnml; script options. - - -Information on all of the script, configuration, build and run items is found under -scripts/ccsm_utils/Case.template -in the -config_definition.xml - file. - - - -&clm; Script configuration items - -Below we list each of the &cesm; configuration items that are specific to &clm;. All -of these are available in your: &envconf; file. - - - - &CLMCONFIG; - &CLMBLDNML; - &CLMNAMELIST; - &CLMFORCECOLD; - &CLMUSECASE; - &CLM1PT; - &CLMUSRDAT; - &CLMCO2; - -For the precedence of the different options to &buildnml; see the section on -precedence below. - - -The first item &CLMCONFIG; has to do with customizing the &clm; configuration options for your case, the rest -all have to do with generating the initial namelist. - - - -&CLMCONFIG; - - -The option &CLMCONFIG; is all about passing command line arguments to the &clm; &configure; script. It is important -to note that some compsets, may already put a value into the &CLMCONFIG; variable. You can still add more -options to your &CLMCONFIG; but make sure you add to what is already there rather than replacing it. Hence, -we recommend using the "-append" option to the xmlchange script. In - -below we will go into more details on options that can be customized in the &clm; "&configure;" script. It's -also important to note that the &clm; template may already invoke certain &clm; &configure; options and as such those -command line options are NOT going to be available to change at this step (nor would you want to change them). -The options to &configure; are given with the "-help" option which is given in -. - - - - - -&CLMUSECASE; - - -&CLMUSECASE; is used to set a particular set of conditions that set multiple namelist items, all centering around -a particular usage of the model. -To list the valid options do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -use_case list - - -The output of the above command is: - - -&usecases_list; - - - -See the section for the precedence of this -option relative to the others. - - - - - - -&CLMBLDNML; - - -The option &CLMBLDNML; is for passing options to the &clm; "&buildnml;" script. As with the "&configure;" -script the &clm; template may already invoke certain options and as such those options will NOT be available to be -set here. The best way to see what options can be sent to the "&buildnml;" script is to do - - -> cd models/lnd/clm/bld -> ./&buildnml; -help - - -Here is the output from the above. - - -./&buildnml_help; - - -The &clm; template already sets the resolution and mask as well as the &configure; file, -the start-type, the co2_ppmv, rtm_tstep, and rtm_res, and defines an input -namelist and namelist input file, and it normally sets either "-ignore_ic_year" or -"-ignore_ic_date". Also many -of the options are designed solely for &clm; stand-alone testing and hence should NOT -be used (any of the options starting -with a "datm_" or "drv_" prefix. Hence there are then only five different options that could be set: - - - --lnd_res --sim_year --rcp --clm_demand --verbose - - - -"-lnd_res" is used to run &clm; in fine-mesh mode at a higher resolution than the atmospheric model. This can -be useful to get higher resolution from the land model, but saving computer time -by running the more expensive atmospheric model at a lower resolution. -To get a list of valid resolutions to run at do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -lnd_res list - - - -The fine-mesh mode is considered experimental, and you may run into problems when you use -it. Another option is to use the CESM level "tri-grid" capability to run the land model -on a different grid than the atmospheric model. Read the CESM User's-Guide to learn how -to do this. - - - - - -See the section for the precedence of this -option relative to the others. - - - - -"-clm_demand" asks the &buildnml; step to require that the list of variables -entered be set. Typically, this is used to require that optional filenames be used and ensure -they are set before continuing. For example, you may want to require that -flanduse_timeseries be set to get dynamically changing vegetation types. To do this -you would do the following. - -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val "-clm_demand flanduse_timeseries" - -To see a list of valid variables that you could set do this: - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -clm_demand list - - - - -Using a 20th-Century transient compset or the 20thC_transient use-case -using &CLMUSECASE; would set this as well, but would also use -dynamic nitrogen and aerosol deposition files, so using -clm_demand would be a way -to get just dynamic vegetation types and NOT the other files as well. - - - -"-sim_year" is used to set the simulation year you want the data-sets to simulate conditions for in the input -datasets. The simulation "year" can also be a range of years in order to do simulations -with changes in the dataset values as the simulation progresses. To list the valid -options do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -sim_year list - - -"-rcp" is used to set the representative concentration pathway for the future scenarios -you want the data-sets to simulate conditions for, in the input -datasets. To list the valid options do the following: - - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -rcp list - - - - - -&CLMNAMELIST; - - -The option &CLMNAMELIST; is for passing namelist items into the "clm_inparm" namelist. -Any items that are set in &CLMNAMELIST; will be set in your namelist after "&configure; --case" is done. - - - -For character namelist items you need to use "&apos;" as quotes for strings so that the -scripts don't get confused with other quotes they use. - - - -Example, you want to set hist_dov2xy to .false. -so that you get vector output to your history files. To do so edit -&envconf; and add a setting for hist_dov2xy. -So do the following: - -> ./xmlchange -file env_conf.xml -id &CLMNAMELIST; -val hist_dov2xy=.false. - - - -Example, you want to set hist_fincl1 to add the variable 'HK' -to your history files. To do so edit -&envconf; and add a setting for hist_fincl1. -So do the following: - -> ./xmlchange -file env_conf.xml -id &CLMNAMELIST; -val "hist_fincl1=&apos;HK&apos;" - -For a list of the history fields available see -&clm; History Fields. - - - -See the section for the precedence of this -option relative to the others. - - - - - - -&CLMCO2; - - -&CLMCO2; sets the type of input &CO2; for either "constant", "diagnostic" or prognostic". -If "constant" the value from CCSM_CO2_PPMV will be used. If "diagnostic" -or "prognostic" the values MUST be sent from the atmosphere model. For more information on how -to send &CO2; from the data atmosphere model see . - - - - - -&CLMFORCECOLD; - - -&CLMFORCECOLD; when set to on, requires that -your simulation do a cold start from arbitrary initial conditions. If this is NOT set, it -will use an initial condition file if it can find an appropriate one, and otherwise do a cold -start. &CLMFORCECOLD; is a good way to ensure that you are doing a cold -start if that is what you want to do. - - - - - -&CLM1PT; - - -&CLM1PT; is used ONLY for a pt1_pt1 -resolution simulation to set the name of the single-point files to use. -To see a list of the valid resolutions do this: - -> cd models/lnd/clm/doc -> ../bld/&buildnml; -res list - - - -The output of the above command is: - - -&res_list; - - -the valid resolutions that can be used with &CLM1PT; are the ones that -have city or nation names such as: 5x5_amazon, 1x1_vancouverCAN 1x1_mexicocityMEX, or -1x1_brazil. The "1x1_" prefix means the file is for a single-point, while "5x5_" prefix means -it's for a region of five points in latitude by five points in longitude. Both regional -and single point datasets can be used for &CLM1PT;. If you create your own datasets -you can also use &CLM1PT; along with &CLMUSRDAT; (documented below), setting &CLM1PT; to -the value in &CLMUSRDAT; so that your datasets are used rather than the standard ones.o - - - - - -&CLMUSRDAT; - - -&CLMUSRDAT; provides a way to enter your own datasets into the initial -namelist setup at "&configure; -case". The files you create must be named with -specific naming conventions outlined in: . -To see what the expected names of the files are, use the -queryDefaultNamelist.pl to see -what the names will need to be. For example if your &CLMUSRDAT; will -be "1x1_boulderCO", with a "navy" land-mask, constant simulation year range, for 1850, -the following will list what your filenames should be: - -> cd models/lnd/clm/bld -> queryDefaultNamelist.pl -usrname "1x1_boulderCO" -options \ -mask=navy,sim_year=1850,sim_year_range="constant" -csmdata $CSMDATA - -An example of using &CLMUSRDAT; for a simulation is given in -. - - - -See the section for the precedence of this -option relative to the others. - - - - - - - - - -Configure time User Namelist - -&CLMNAMELIST; as described above allows you to set any -extra namelist items you would like to appear in your namelist after first &configure;d. -However, it only allows you a single line to enter namelist items, and strings must -be quoted with &apos; which is a bit awkward. If you have a long list of namelist -items you want to set (such as a long list of history fields) a convenient way to do it -is to create a &usernlclm; that contains just the list of namelist -variables you want to add to your initial namelist. The &usernlclm; -will only be used when &configure; is run, so if you change it after &configure; -- it won't -change anything. The file needs to be in valid FORTRAN namelist format, and the &configure; -step will abort if there are syntax errors. It merely needs to be named correctly -&usernlclm; and placed in your case directory (where your other -env_*.xml files are). The namelist name actually doesn't have to be -valid, but all the variable names must be. Here's an example &usernlclm; -namelist that sets a bunch of history file related items, to create output history files -monthly, daily, every six and 1 hours. - -Example &usernlclm; namelist file - -&clmexp - hist_fincl2 = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS', - 'FSR','FSA','FGEV','FSH','FGR','TSOI', - 'ERRSOI','BUILDHEAT','SABV','SABG', - 'FSDSVD','FSDSND','FSDSVI','FSDSNI', - 'FSRVD','FSRND','FSRVI','FSRNI', - 'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI', - 'H2OSNO','SOILLIQ','SOILICE', - 'TSA_U', 'TSA_R', - 'TREFMNAV_U', 'TREFMNAV_R', - 'TREFMXAV_U', 'TREFMXAV_R', - 'TG_U', 'TG_R', - 'RH2M_U', 'RH2M_R', - 'QRUNOFF_U', 'QRUNOFF_R', - 'SoilAlpha_U', - 'Qanth', 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT' - hist_fincl3 = 'TG:I', 'FSA:I', 'SWup:I', 'URBAN_AC:I', 'URBAN_HEAT:I', - 'TG_U:I', 'TG_R:I', - hist_fincl4 = 'TG', 'FSA', 'SWup', 'URBAN_AC', 'URBAN_HEAT' - hist_mfilt = 1, 30, 28, 24 - hist_nhtfrq = 0, -24, -6, -1 -/ - - - - -See the section for the precedence of this -option relative to the others. - - - - -In the above example we use an invalid namelist name &clmexp -- but it works anyway -because the &clm; &buildnml; knows the namelist that specific variable names belong to, and -it puts them there. - - -Obviously, all of this would be difficult to put in the &CLMNAMELIST; -variable, especially having to put &apos; around all the character strings. For -more information on the namelist variables being set here and what they mean, see -the section on &clm; namelists below, as well as the namelist definition that gives -details on each variable. - - - - -Precedence of Options - -Note: The precedence for setting the values of namelist variables with the -different env_conf options is (highest to lowest): - -Namelist values set by specific command-line options, like, -d, -sim_year -(i.e. &CLMBLDNML; env_conf variable) -Values set on the command-line using the -namelist option, -(i.e. &CLMNAMELIST; env_conf variable) -Values read from the file specified by -infile, -(i.e. &usernlclm; file) -Datasets from the -clm_usr_name option, -(i.e. &CLMUSRDAT; env_conf variable) -Values set from a use-case scenario, e.g., -use_case -(i.e. &CLMUSECASE;env_conf variable) -Values from the namelist defaults file. - -Thus a setting in &CLMBLDNML; will override a setting for the same thing given in -a use case with &CLMUSECASE;. Likewise, a setting in &CLMNAMELIST; will override a -setting in &usernlclm;. - - - - -Setting Your Initial Conditions File - -Especially with &clmcn; starting from initial conditions is very important. Even -with &clmsp; it takes many simulation years to get the model fully spunup. There -are a couple different ways to provide an initial condition file. - - - - - - - - -Your initial condition file MUST agree with the surface dataset you are using -to run the simulation. If the two files do NOT agree you will get a -run-time about a mis-match in PFT weights, or in the number of PFT's or -columns. To get around this you'll need to use -to interpolate your initial condition dataset. - - - - - -Doing a hybrid simulation to provide initial conditions - -The first option is to setup a hybrid simulation and give a -RUN_REFCASE and RUN_REFDATE to specify the -reference case simulation name to use. -When you setup most cases, at the standard resolutions of "f09" or "f19" it -will already do this for you. For example, if you run an "I2000CN" compset -at "f09_g16" resolution the following settings will already be done for you. - -./xmlchange -file env_conf.xml -id RUN_TYPE -val hybrid -./xmlchange -file env_conf.xml -id RUN_REFCASE -val I2000CN_f09_g16_c100503 -./xmlchange -file env_conf.xml -id RUN_REFDATE -val 0001-01-01 -./xmlchange -file env_conf.xml -id GET_REFCASE -val TRUE - -Setting the GET_REFCASE option to TRUE means it -will copy the files from the: -$DIN_LOC_ROOT/ccsm4_init/I2000CN_f09_g16_c100503/0001-01-01 -directory. Note, that the RUN_REFCASE and -RUN_REFDATE variables are expanded to get the directory name -above. If you do NOT set GET_REFCASE to TRUE then -you will need to have placed the file in your run directory yourself. In either -case, the file is expected to be named: -$RUN_REFCASE.clm2.r.$RUN_REFDATE-00000.nc with the variables -expanded of course. - - - - -Doing a branch simulation to provide initial conditions - -The setup for running a branch simulation is essentially the same as for a hybrid. -With the exception of setting RUN_TYPE to branch -rather than hybrid. A branch simulation runs the case essentially -as restarting from it's place before to exactly reproduce it. While a hybrid simulation -allows you to change namelist items, and use a different code base that may have -fewer fields on it than a full restart file. The GET_REFCASE works -similarily for a branch case as for a hybrid. - - - - -Providing a finidat file in your &usernlclm; file - -Setting up a branch or hybrid simulation requires the initial condition file -to follow a standard naming convention, and a standard input directory if you -use the GET_REFCASE option. If you want to name your file willy -nilly and place it anywhere, you can set it in your &usernlclm; file as in this -example. - -&clm_inparm - finidat = '/glade/home/$USER/myinitdata/clmi_I1850CN_f09_g16_0182-01-01.c120329.nc' -/ - -Note, if you provide an initial condition file -- you can NOT set &CLMFORCECOLD; to -TRUE. - - - - -Adding a finidat file to the XML database - -Like other datasets, if you want to use a given initial condition file to -be used for all (or most of) your cases you'll want to put it in the XML -database so it will be used by default. The initial condition files, are -resolution dependent, and dependent on the number of PFT's and other variables -such as GLC_NEC or if irrigation is on or off. -See for more information on this. - - - - - -Other noteworthy configuration items - -For running "I" cases there are several other noteworthy configuration items that -you may want to work with. Most of these involve settings for the &datm;, but one -CCSM_CO2_PPMV applies to all models. If you are running an B, E, -or F case that doesn't use the &datm; obviously the DATM_* settings will not be used. -All of the settings below are in your &envconf; file - - CCSM_CO2_PPMV - CCSM_VOC - DATM_MODE - DATM_PRESAERO - DATM_CLMNCEP_YR_ALIGN - DATM_CLMNCEP_YR_START - DATM_CLMNCEP_YR_END - DATM_CPL_CASE - DATM_CPL_YR_ALIGN - DATM_CPL_YR_START - DATM_CPL_YR_END - - - - - -CCSM_CO2_PPMV - -CCSM_CO2_PPMV sets the mixing ratio of &CO2; in -parts per million by volume for ALL &cesm; components to use. Note that most compsets -already set this value to something reasonable. Also note that some compsets may -tell the atmosphere model to override this value with either historic or ramped -values. If the CCSM_BGC variable is set to something other than "none" -the atmosphere model will determine &CO2;, and &clm; will listen -and use what the atmosphere sends it. On the &clm; side the namelist item -co2_type tells &clm; to use the value sent from the atmosphere rather than -a value set on it's own namelist. - - - - -CCSM_VOC - -CCSM_VOC enables passing of the Volatile Organic Compounds (VOC) from -&clm; to the atmospheric model. This of course is only important if the atmosphere -model is a fully active model that can use these fields in it's chemistry calculations. - - - - -DATM_MODE - -DATM_MODE sets the mode that the &datm; model should run in this determines -how data is handled as well as what the source of the data will be. Many of the modes -are setup specifically to be used for ocean and/or sea-ice modeling. The modes -that are designed for use by &clm; are: - -&CLMQIAN; -CLM1PT -&CPLHIST; - - - -&CLMQIAN; is for the standard mode of using global atmospheric data -that was developed by Qian et. al. for &clm; using NCEP data from 1948 to 2004. -See for more information on -the &datm; settings for &CLMQIAN; mode. -CLM1PT is for the special cases where we have single-point tower -data for particular sites. Right now we only have data for three urban locations: -MexicoCity Mexico, Vancouver Canada, and the urban-c alpha site. -See for more information on -the &datm; settings for CLM1PT mode. -&CPLHIST; is for running with atmospheric forcing from a previous &cesm; simulation. -See for more information on -the &datm; settings for &CPLHIST; mode. - - -There is a problem with running simulations for the CLM1PT mode -that are greater than one data cycle, where the atm forcing will be held constant. -This will result in useless -results as all atmosphere forcing fields will be held constant at the last value. -See bug 1377 in the &KnownBugs; file on how to fix this problem. - - - - - - - -DATM_PRESAERO - -DATM_PRESAERO sets the prescribed aerosol mode for the data atmosphere -model. The list of valid options include: - -clim_1850 = constant year 1850 conditions -clim_2000 = constant year 2000 conditions -trans_1850-2000 = transient 1850 to year 2000 conditions -rcp2.6 = transient conditions for the rcp=2.6 -W/m2 future -scenario -rcp4.5 = transient conditions for the rcp=4.5 -W/m2 future -scenario -rcp6.0 = transient conditions for the rcp=6.0 -W/m2 future -scenario -rcp8.5 = transient conditions for the rcp=8.5 -W/m2 future -scenario -pt1_pt1 = read in single-point or regional datasets - - - - - -DATM_CLMNCEP_YR_START - -DATM_CLMNCEP_YR_START sets the beginning year to cycle the atmospheric -data over for the &CLMQIAN; mode. - - - - -DATM_CLMNCEP_YR_END - -DATM_CLMNCEP_YR_END sets the ending year to cycle the atmospheric -data over for the &CLMQIAN; mode. - - - - -DATM_CLMNCEP_YR_ALIGN - -DATM_CLMNCEP_YR_START and DATM_CLMNCEP_YR_END determine -the range of years to cycle the atmospheric data over, and DATM_CLMNCEP_YR_ALIGN -determines which year in that range of years the simulation will start with. - - - - -DATM_CPL_CASE - -DATM_CPL_CASE sets the casename to use for the &CPLHIST; mode. - - - - -DATM_CPL_YR_START - -DATM_CPL_YR_START sets the beginning year to cycle the atmospheric -data over for the &CPLHIST; mode. - - - - -DATM_CPL_YR_END - -DATM_CPL_YR_END sets the ending year to cycle the atmospheric -data over for the &CPLHIST; mode. - - - - -DATM_CPL_YR_ALIGN - -DATM_CPL_YR_START and DATM_CPL_YR_END determine -the range of years to cycle the atmospheric data over, and DATM_CPL_YR_ALIGN -determines which year in that range of years the simulation will start with. - - - - - - - - -Downloading DATM Forcing Data - -In Chapter One of the -&cesm; User's Guide -there is a section on "Downloading input data". The normal process of setting up -cases will use the "scripts/ccsm_utils/Tools/check_input_data" script to retrieve -data from the &cesm; subversion inputdata repository. However, the DATM forcing data -is unique -- because it is large compared to the rest of the input data (56 Gbytes). Most of the -data is stored in the directory set by the &envrun; variable -DIN_LOC_ROOT_CSMDATA. The &CLMQIAN; forcing data is in a (possibly) -separate directory using the &envrun; variable DIN_LOC_ROOT_CLMQIAN. -In most cases this directory will be in the directory: -atm/datm7/atm_forcing.datm7.Qian.T62.c080727 under -DIN_LOC_ROOT_CSMDATA. On bluefire there is a separate path for -the &CLMQIAN; forcing data. We have the full set of data available on a few of -the machines we use: bluefire, jaguarpf, and edinburgh. As of October, 18th, 2011 -we've uploaded the entire set of forcing data into the input data repository so -now it can be treated like other input datasets and the check_input_data script -can retreive it for you. Previously only two years of data was available. -You can also download the data from the -Earth System Grid for other machines. See the -Model Forcing Data -link under the -&clm; Documentation Page - - - - -Customizing via the template files - -The final thing that the user may wish to do before &configure; is run is to edit -the template files which determine the configuration and initial namelist. The -variables in &envconf; typically mean you will NOT have -to edit the template. But, there are rare instances where it is useful to do so. - gives the details on how to do this. -The template files are copied to your case directory and are available under -Tools/Templates. -The list of template files you might wish to edit are: - - clm.cpl7.template - datm.cpl7.template - cpl.template - - - - - - -More information on the &clm; &configure; script - -The &configure; script defines the details of a clm configuration and summarizes it into a -config_cache.xml file. The config_cache.xml -will be placed in your case directory under Buildconf/clmconf. -The config_definition.xml -in models/lnd/clm/bld/config_files -gives a definition of each &clm; configuration item, it is viewable in a web-browser. -Many of these items are things that you would NOT change, but looking through the -list gives you the valid options, and a good description of each. Below we repeat -the config_definition.xml files contents: - - - - - -Help on &clm; &configure; - -Coupling this with looking at the options to &configure; with -"-help" as below will enable you to understand how to set the different options. - -> cd models/lnd/clm/bld -> &configure; -help - - - -The output to the above command is as follows: - - -&config_help; - - -We've given details on how to use the options in &envconf; to -interact with the &clm; "&configure;" and "&buildnml;" scripts, as well as giving a good -understanding of how these scripts work and the options to them. In the next section we -give further details on the &clm; namelist. You could customize the namelist for these -options after "&configure; -case" is run. - - - - - - - - - - Customizing the &clm; namelist - -Once a case is &configure;d, we can then customize the case further, by editing the -run-time namelist for &clm;. First let's list the definition of each namelist -item and their valid values, and then we'll list the default values for them. -Next for some of the most used or tricky namelist items we'll give examples of their -use, and give you example namelists that highlight these features. - - - - -Definition of Namelist items and their default values - -Here we point to you where you can find the definition of each namelist item and -separately the default values for them. The default values may change depending on -the resolution, land-mask, simulation-year and other attributes. Both of these -files are viewable in your web browser. Below we provide the link for them, and -then expand each in turn. - - - -Definition of each Namelist Item - - -Default values of each -&clm; Namelist Item - - - -One set of the namelist items allows you to add fields to the output history files: -hist_fincl1, hist_fincl2, -hist_fincl3, hist_fincl4, -hist_fincl5, and hist_fincl6. The link -&clm; History Fields -documents all of the history fields available and gives the long-name and units -for each. - - - - - -&hisfldtbl; - - - - - - - -Examples of using different namelist features - -Below we will give examples of user namelists that activate different commonly used -namelist features. We will discuss the namelist features in different examples and then -show a user namelist that includes an example of the use of these features. First we -will show the default namelist that doesn't activate any user options. - - - -The default namelist - -Here we give the default namelist as it would be created for a I1850CN compset at 0.9x1.25 -resolution with a gx1v6 land-mask. To edit the namelist you would edit the -BuildConf/clm.buildnml.csh under your case (or before &configure; -include a user namelist with just the items you want to change). For simplicity we will -just show the namelist and NOT the entire file. In the sections below, for simplicity - we will just show the user namelist (&usernlclm;) that will add (or modify existing) -namelist items to the namelist. Again, just adding the &usernlclm; file to your case -directory, before "&configure; -case" is invoked will cause the given namelist items to -appear in your &clm; namelist. - -Default &clm; Namelist - -&clm_inparm - co2_ppmv = 284.7 - co2_type = 'constant' - create_crop_landunit = .false. - dtime = 1800 - fatmgrid = '$DIN_LOC_ROOT/lnd/clm2/griddata/griddata_0.9x1.25_070212.nc' - fatmlndfrc = -'$DIN_LOC_ROOT/lnd/clm2/griddata/fracdata_0.9x1.25_gx1v6_c090317.nc' - finidat = 'I1850CN_f09_g16_c100503.clm2.r.0001-01-01-00000.nc' - fpftcon = '$DIN_LOC_ROOT/lnd/clm2/pftdata/pft-physiology.c110425.nc' - frivinp_rtm = '$DIN_LOC_ROOT/lnd/clm2/rtmdata/rdirc_0.5x0.5_simyr2000_slpmxvl_c120717.nc' - fsnowaging = -'$DIN_LOC_ROOT/lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc' - fsnowoptics = -'$DIN_LOC_ROOT/lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc' - fsurdat = -'$DIN_LOC_ROOT/lnd/clm2/surfdata/surfdata_0.9x1.25_simyr1850_c091006.nc' - ice_runoff = .true. - outnc_large_files = .true. - rtm_nsteps = 6 - urban_hac = 'ON_WASTEHEAT' - urban_traffic = .false. -/ -&ndepdyn_nml - stream_fldfilename_ndep = -'$DIN_LOC_ROOT/lnd/clm2/ndepdata/fndep_clm_hist_simyr1849-2006_1.9x2.5_c100428.nc' - stream_year_first_ndep = 1850 - stream_year_last_ndep = 1850 -/ - - -Note that the namelist introduces some of the history namelist options that will be -talked about in further detail below (hist_mfilt and -hist_nhtfrq). - - - - -Adding/removing fields on your primary history file - -The primary history files are output monthly, and contain an extensive list of -fieldnames, but the list of fieldnames can be added to using hist_fincl1 -or removed from by adding fieldnames to hist_fexcl1. -A sample user namelist &usernlclm; adding few new fields -(cosine of solar zenith angle, and solar declination) and excluding a few -standard fields is (ground temperature, vegetation temperature, soil temperature and soil water).: - -Example &usernlclm; namelist adding and removing fields on primary history file - -&clm_inparm - hist_fincl1 = 'COSZEN', 'DECL' - hist_fexcl1 = 'TG', 'TV', 'TSOI', 'H2OSOI' -/ - - - - - - -Adding auxiliary history files and changing output -frequency - -The hist_fincl2 through hist_fincl6 set of -namelist variables add given history fieldnames to auxiliary history file "streams", and -hist_fexcl2 through hist_fexcl6 set of -namelist variables remove given history fieldnames from history file auxiliary "streams". -A history "stream" is a set of history files that are produced at a given frequency. -By default there is only one stream of monthly data files. To add more streams you -add history fieldnames to hist_fincl2 through -hist_fincl6. The output frequency and the way averaging is done -can be different for each history file stream. By default the primary history files -are monthly and any others are daily. You can have up to six active history streams, but you need -to activate them in order. So if you activate stream "6" by setting -hist_fincl6, but if any of hist_fincl2 through -hist_fincl5 are unset, only the history streams up to the first blank one -will be activated. - - -The frequency of the history file streams is given by the namelist variable -hist_nhtfrq which is an array of rank six for each history stream. -The values of the array hist_nhtfrq must be integers, where the -following values have the given meaning: - -Positive value means the output frequency is the number of -model steps between output. - -Negative value means the output frequency is the absolute -value in hours given (i.e -1 would mean an hour and -24 would mean a full day). Daily -(-24) is the default value for all auxiliary files. - -Zero means the output frequency is monthly. This is the -default for the primary history files. - - - - -The number of samples on each history file stream is given by the namelist variable -hist_mfilt which is an array of rank six for each history stream. -The values of the array hist_mfilt must be positive integers. By -default the primary history file stream has one time sample on it (i.e. output is -to separate monthly files), and all other streams have thirty time samples on them. - - -A sample user namelist &usernlclm; turning on four extra file -streams for output: daily, six-hourly, hourly, and every time-step, -leaving the primary history files as monthly, and changing the number -of samples on the streams to: yearly (12), thirty, weekly (28), daily (24), and daily -(48) is: - -Example &usernlclm; namelist adding auxiliary history files and changing output frequency - -&clm_inparm - hist_fincl2 = 'TG', 'TV' - hist_fincl3 = 'TG', 'TV' - hist_fincl4 = 'TG', 'TV' - hist_fincl5 = 'TG', 'TV' - hist_nhtfrq = 0, -24, -6, -1, 1 - hist_mfilt = 12, 30, 28, 24, 48 -/ - - - - - - -Removing all history fields - -Sometimes for various reasons you want to remove all the history fields either -because you want to do testing without any output, or you only want a very small -custom list of output fields rather than the default extensive list of fields. -By default only the primary history files are active, so technically using -hist_fexcl1 explained in the first example, you could list -ALL of the history fields that are output in -hist_fexcl1 and then you wouldn't get any output. However, as -the list is very extensive this would be a cumbersome thing to do. So to facilitate -this hist_empty_htapes allows you to turn off all default output. -You can still use hist_fincl1 to turn your own list of fields -on, but you then start from a clean slate. -A sample user namelist &usernlclm; turning off all history -fields and then activating just a few selected fields (ground and vegetation temperatures -and absorbed solar radiation) is: - -Example &usernlclm; namelist removing all history fields - -&clm_inparm - hist_empty_htapes = .true. - hist_fincl1 = 'TG', 'TV', 'FSA' -/ - - -Note, you could also build adding the "-noio" option to &CLMCONFIG;. But, this would -build the model without history output and you wouldn't be able to add that in later. - - - - -Various ways to change history output averaging flags - -There are two ways to change the averaging of output history fields. The first is using -hist_avgflag_pertape which gives a default value for each history -stream, the second is when you add fields using hist_fincl*, you add -an averaging flag to the end of the field name after a colon (for example 'TSOI:X', would -output the maximum of TSOI). -The types of averaging that can be done are: - -A Average, over the output interval. -I Instantaneous, output the value at the output interval. -X Maximum, over the output interval. -M Minimum, over the output interval. - - -The default averaging depends on the specific fields, but for most fields is an average. -A sample user namelist &usernlclm; making the monthly output -fields all averages (except TSOI for the first two streams and FIRE for the 5th stream), -and adding auxiliary file streams for instantaneous (6-hourly), -maximum (daily), minimum (daily), and average (daily). For some of the fields we -diverge from the per-tape value given and customize to some different type of -optimization. - -Example &usernlclm; namelist with various ways to average history fields - -&clm_inparm - hist_empty_htapes = .true. - hist_fincl1 = 'TSOI:X', 'TG', 'TV', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl2 = 'TSOI:X', 'TG', 'TV', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl3 = 'TSOI', 'TG:I', 'TV', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl4 = 'TSOI', 'TG', 'TV:I', 'FIRE', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_fincl5 = 'TSOI', 'TG', 'TV', 'FIRE:I', 'FSR', 'FSH', - 'EFLX_LH_TOT', 'WT' - hist_avgflag_pertape = 'A', 'I', 'X', 'M', 'A' - hist_nhtfrq = 0, -6, -24, -24, -24 -/ - - - - - -In the example we put the same list of fields on each of the tapes: soil-temperature, -ground temperature, vegetation temperature, emitted longwave radiation, reflected -solar radiation, sensible heat, total latent-heat, and total water storage. We also -modify the soil-temperature for the primary and secondary auxiliary tapes by outputting -them for a maximum instead of the prescribed per-tape of average and instantaneous -respectively. For the tertiary auxiliary tape we output ground temperature instantaneous -instead of as a maximum, and for the fourth auxiliary tape we output vegetation -temperature instantaneous instead of as a minimum. Finally, for the fifth auxiliary -tapes we output FIRE instantaneously instead of as an average. - - - - -We also use hist_empty_htapes as in the previous example, -so we can list ONLY the fields that we want on the primary history tapes. - - - - - -Outputting history files as a vector in order to analyze -the plant function types within gridcells - -By default the output to history files are the grid-cell average of all land-units, and -vegetation types within that grid-cell, and output is on the -full 2D latitude/longitude grid with ocean masked out. Sometimes it's important to -understand how different land-units or vegetation types are acting within a grid-cell. -The way to do this is to output history files as a 1D-vector of all land-units and vegetation -types. In order to display this, you'll need to do extensive post-processing to make sense -of the output. Often you may only be interested in a few points, so once you figure out the -1D indices for the grid-cells of interest, you can easily view that data. 1D vector output -can also be useful for single point datasets, since it's then obvious that all data is for the -same grid cell. - - -To do this you use hist_dov2xy which is an array of rank six for -each history stream. Set it to -.false. if you want one of the history streams to be a 1D vector. -You can also use hist_type1d_pertape if you want to average over all the: -Plant-Function-Types, columns, land-units, or grid-cells. -A sample user namelist &usernlclm; leaving the primary monthly -files as 2D, and then doing grid-cell (GRID), column (COLS), -and no averaging over auxiliary tapes output daily for a single field -(ground temperature) is: - -Example &usernlclm; namelist outputting some files in 1D Vector format - -&clm_inparm - hist_fincl2 = 'TG' - hist_fincl3 = 'TG' - hist_fincl4 = 'TG' - hist_fincl5 = 'TG' - hist_fincl6 = 'TG' - hist_dov2xy = .true., .false., .false., .false. - hist_type2d_pertape = ' ', 'GRID', 'COLS', ' ' - hist_nhtfrq = 0, -24, -24, -24 -/ - - - - -LAND and COLS are also options to the pertape averaging, but currently there is a bug -with them and they fail to work. - - - - - -Technically the default for hist_nhtfrq is for primary files -output monthly and the other auxiliary tapes for daily, so we don't actually have -to include hist_nhtfrq, we could use the default for it. Here -we specify it for clarity. - - - - -Visualizing global 1D vector files will take effort. You'll probably want -to do some post-processing and possibly just extract out single points of interest -to see what is going on. Since, the output is a 1D vector, of only land-points -traditional plots won't be helpful. The number of points per grid-cell will also -vary for anything, but grid-cell averaging. You'll need to use the output fields -pfts1d_ixy, and pfts1d_jxy, to get the mapping -of the fields to the global 2D array. pfts1d_itype_veg gives you -the PFT number for each PFT. Most likely you'll want to do this analysis in a -data processing tool (such as NCL, Matlab, Mathmatica, IDL, etcetera that is able -to read and process &netcdf; data files). - - - - - -Outputting multi-layer snow history fields - -A number of history fields provide information about individual snow layers: -SNO_ABS, SNO_T, SNO_GS, -SNO_Z, SNO_LIQH2O, -SNO_ICE, SNO_TK, and -SNO_BW; there is also an auxiliary field to aid -interpretation: SNO_EXISTENCE (described below). These fields -are inactive by default, but can be enabled like other history fields. If the -maximum number of snow layers is 5 (for example), then the layers of these -fields are arranged on the history file so that layer 1 is at the top of the -snow pack, and layer 5 only exists if the snow is deep enough to support all -layers. - - -Because snow layers can come into and out of existence, these fields can be -challenging to interpret. It is easiest to analyze these fields if you do output -every time step, and do not average to the grid cell (i.e., dov2xy = -.false.). Otherwise, a few principles should be kept in mind when -working with these fields: - -Temporal averages are taken only over times when a given snow layer exists -Grid cell averages are taken only over columns in which a given snow layer exists -SNO_EXISTENCE gives the fraction of the averaging -period in which a given snow layer existed. For grid cell averages, this gives -the weighted spatial fraction of the columns in which a snow layer existed for -this averaging period. This is most useful for subsetting grid cells for -analysis. For example, grid cells that have SNO_EXISTENCE = 1 -for all snow layers can be analyzed most easily. - - - -Here is a simple example illustrating this averaging; this considers a given -snow layer, L: - - -Assume a grid cell with 2 columns, with averaging done over 4 time steps. Column -#1 has subgrid weight 0.2, and no snow in layer L in any time -step. Column #2 has subgrid weight 0.8, and has snow in layer -L in time steps 3 and 4; the snow field of interest has -values 1.0 and 2.0 in these two time steps, for this layer. - - -SNO_EXISTENCE is then 0.8*(2/4) = 0.4. The snow field's value -would be 1.5 (note that times and columns with no snow in this layer are simply -ignored). - - -Finally, note that the SNOABS field is not computed for urban -columns, so it will have a missing value if snow only exists over urban columns -for a given snow layer. - - - - -Conclusion to namelist examples - -We've given various examples of namelists that feature the use of different namelist options -to customize a case for particular uses. Most the examples revolve around how to customize the -output history fields. This should give you a good basis for setting up your own &clm; namelist. - - - - - - - - - -Customizing the &datm; Namelist and Streams files - -When running "I" compsets with &clm; you use the &datm; model to give atmospheric -forcing data to &clm;. There are four ways to customize &datm;: - - -&datm; Main Namelist (datm_in) - - -&datm; Stream Namelist (datm_atm_in) - - -&datm; stream files - - -&datm; template file -(Tools/Templates.datm.cpl7.template) - - -The -Data Model Documentation gives the details of all the options for the data -models and for &datm; specifically. It goes into detail on all namelist items both for -&datm; -and for &datm; streams. It shows examples of stream files and talks about their use. In - we talk about editing the CLM and &datm; -template files. So here we won't talk about the &datm; template file, and we won't list -ALL of the &datm; namelist options, nor go into great details about stream files. But, -we will talk about a few of the different options that are relevant for running with -&clm;. All of the options for changing the namelists or stream files is done by editing -the Buildconf/datm.buildnml.csh file. - - -Because, they aren't useful for work with &clm; we will NOT discuss any of the options -for the main &datm; namelist. Use the &datm; Users Guide at the link above to find -details of that. For the streams namelist we will discuss three items: - - -mapalgo - - -taxmode - - -tintalgo - - -And for the streams file itself we will discuss: - - offset - -Again everything else (and including the above items) are discussed in the Data Model -User's Guide. Of the above the last three: offset, taxmode and tintalgo are all closely -related and have to do with the time interpolation of the &datm; data. - - - - -mapalgo - -mapalgo sets the spatial interpolation method to go from the -&datm; input data to the output &datm; model grid. The default is -bilinear. For CLM1PT we set it to nn to just -select the nearest neighbor. This saves time and we also had problems running the -interpolation for single-point mode. - - - - -taxmode - -taxmode is the time axis mode. For &clm; we usually have it -set to cycle which means that once the end of the data is reached -it will start over at the beginning. The extend modes is used -have it use the last time-step of the forcing data once it reaches the end of forcing -data (or use the first time-step before it reaches where the forcing data starts). -See the warning below about the extend mode. - - -THE extend OPTION NEEDS TO BE USED WITH CAUTION! -It is only invoked by default for the CLM1PT mode and is only intended for the -supported urban datasets to extend the data for a single time-step. If you have the -model run extensively through periods in this mode you will effectively -be repeating that last time-step over that entire period. This means the -output of your simulation will be worthless. See bug 1377 in the &KnownBugs; file for -more information on this issue. - - - - - - -offset (in the stream file) - -offset is the time offset in seconds to give to each stream -of data. Normally it is NOT used because the time-stamps for data is set correctly -for each stream of data. Note, the offset may NEED to be -adjusted depending on the taxmode described above, or it may -need to be adjusted to account for data that is time-stamped at the END of an -interval rather than the middle or beginning of interval. The -offset can is set in the stream file rather than on the -stream namelist. For data with a taxmode method of -coszen the time-stamp needs to be for the beginning of the interval, -while for other data it should be the midpoint. The offset can be -used to adjust the time-stamps to get the data to line up correctly. - - - - -tintalgo - -tintalgo is the time interpolation algorithm. For &clm; we usually -use one of three modes: coszen, nearest, or -linear. We use coszen for solar data, -nearest for precipitation data, and linear -for everything else. If your data is half-hourly or hourly, nearest -will work fine for everything. The coszen scaling is useful for -longer periods (three hours or more) to try to get the solar to match the cosine of -the solar zenith angle over that longer period of time. If you use -linear for longer intervals, the solar will cut out at night-time -anyway, and the straight line will be a poor approximation of the cosine of the -solar zenith angle of actual solar data. nearest likewise would -be bad for longer periods where it would be much higher than the actual values. - - -For coszen the time-stamps of the data should correspond to the -beginning of the interval the data is measured for. Either make sure the time-stamps -on the datafiles is set this way, or use the offset described above -to set it. - - - - -For nearest and linear the time-stamps of the -data should correspond to the middle of the interval the data is measured for. Either -make sure the time-stamps on the datafiles is set this way, or use the -offset described above to set it. - - - - - - -In the sections below we go over each of the relevant DATM_MODE -options and what the above &datm; settings are for each. This gives you examples -of actual usage for the settings. We also describe in what ways you might want -to customize them for your own case. - - - -&CLMQIAN; mode and it's &datm; settings - -In &CLMQIAN; mode the Qian dataset is used which has 6-hourly -solar and precipitation data, and 3-hourly for everything else. -The dataset is divided into those three data streams: solar, precipitation, -and everything else (temperature, pressure, humidity and wind). The time-stamps -of the data were also adjusted so that they are the beginning of the interval -for solar, and the middle for the other two. Because, of this the -offset is set to zero, and the tintalgo -is: coszen, nearest, and -linear for the solar, precipitation and other data -respectively. taxmode is set to cycle -and mapalgo is set to bilinear so that -the data is spatially interpolated from the input T62 grid to the grid the atmosphere -model is being run at. - - -Normally you wouldn't customize the &CLMQIAN; settings, but you might replicate -it's use for your own global data that had similar temporal characteristics. - - - - -CLM1PT mode and it's &datm; settings - -In CLM1PT mode the model is assumed to have half-hourly or hourly data -for a single-point. For the supported datasets that is exactly what it has. -But, if you add your own data you may need to make adjustments accordingly. -Using the &CLMUSRDAT; option you can easily extend this mode for your own -datasets that may be regional or even global and could be at different temporal -frequencies. If you do so you'll need to make adjustments to your &datm; settings. -The dataset has all data in a single stream file. The time-stamps -of the data were also adjusted so that they are at the middle of the interval. -Because, of this the offset is set to zero, and the -tintalgo is set to nearest. -taxmode is set to extend -and mapalgo is set to nn so that -simply the nearest point is used. - - -If you are using your own data for this mode and it's not at least hourly -you'll want to adjust the &datm; settings for it. If the data is three or -six hourly, you'll need to divide it up into separate streams like in -&CLMQIAN; mode which will require fairly extensive changes to the &datm; -namelist and streams files. For an example of doing this see -. - - - - -&CPLHIST; mode and it's &datm; settings - -In &CPLHIST; mode the model is assumed to have 3-hourly for a global grid from -a previous &cesm; simulation. Like &CLMQIAN; mode the data is divided into -three streams: one for precipitation, one for solar, and one for everything else. -The time-stamps for Coupler history files for &cesm; is at the end of the interval, -so the offset needs to be set in order to adjust the time-stamps to what it needs -to be for the tintalgo settings. For precipitation -taxmode is set to nearest so the -offset is set to -5400 seconds so that -the ending time-step is adjusted by an hour and half to the middle of the interval. -For solar taxmode is set to coszen so the -offset is set to -10800 seconds so that -the ending time-step is adjust by three hours to the beginning of the interval. -For everything else taxmode is set to -linear so the offset is set to --5400 seconds so that the ending time-step is adjusted by an -hour and half to the middle of the interval. - - -Normally you wouldn't modify the &datm; settings for this mode. However, if you -had data at a different frequency than 3-hours you would need to modify the -offset and possibly the taxmode. The other -two things that you might modify would be the path to the data (which you can -change in the &datm; template see ) or -the domain file for the resolution (which is currently hardwired to f09). For -data at a different input resolution you would need to change the domain file -in the streams file to use a domain file to the resolution that the data comes in -on. - - - - - - - -Conclusion to customizing chapter - -We've given extensive details on customizing cases with &clm;, by choosing compsets, by changing -&configure; options and interacting with the &clm; "&configure;" and "&buildnml;" scripts, -we've given details on all of the &clm; namelist items, and finally given some -instruction in customizing the &datm; namelist and streams files. In the next chapter we talk -about further ways to customize cases with &clm; by creating your own datasets using the tools -provided in &clm;. - - - - diff --git a/doc/UsersGuide/get_Icaselist.pl b/doc/UsersGuide/get_Icaselist.pl deleted file mode 100755 index 6aefc26159..0000000000 --- a/doc/UsersGuide/get_Icaselist.pl +++ /dev/null @@ -1,136 +0,0 @@ -#!/usr/bin/env perl -#----------------------------------------------------------------------------------------------- -# -# get_Icaselist.pl -# -# This utility gets a list of the I cases from the CCSM compset database. -# -#----------------------------------------------------------------------------------------------- - -use strict; -use Cwd; -use English; -use Getopt::Long; -use IO::File; -use IO::Handle; -#----------------------------------------------------------------------------------------------- - -sub usage { - die <autoflush(); - -#----------------------------------------------------------------------------------------------- -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -$cfgdir = $cwd; - -#----------------------------------------------------------------------------------------------- -# Parse command-line options. -my %opts = ( - ); -GetOptions( - "h|help" => \$opts{'help'}, -) or usage(); - -# Give usage message. -usage() if $opts{'help'}; - -# Check for unparsed argumentss -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} - -# Check for manditory case input if not just listing valid values - -my %cfg = (); # build configuration - -#----------------------------------------------------------------------------------------------- - -# Check for the configuration definition file. -my $config_def_file = "config_definition.xml"; -my $case_def_dir = "$cfgdir/../../../../../scripts/ccsm_utils/Case.template"; -(-f "$case_def_dir/$config_def_file") or die <<"EOF"; -** Cannot find configuration definition file \"$config_def_file\" in directory - \"$case_def_dir\" ** -EOF - -# Compset definition file. -my $compset_file = 'config_compsets.xml'; -(-f "$case_def_dir/$compset_file") or die <<"EOF"; -** Cannot find compset parameters file \"$compset_file\" in directory - \"$case_def_dir\" ** -EOF - -my $xml_dir = "$cfgdir/../../../../../scripts/ccsm_utils/Tools/perl5lib"; -# The XML::Lite module is required to parse the XML configuration files. -(-f "$xml_dir/XML/Lite.pm") or die <<"EOF"; -** Cannot find perl module \"XML/Lite.pm\" in directory - \"$xml_dir\" ** -EOF - - -#----------------------------------------------------------------------------------------------- -my @dirs = ( $cfgdir, $xml_dir, $case_def_dir ); -unshift @INC, @dirs; -require XML::Lite; -require ConfigCase; - -#----------------------------------------------------------------------------------------------- -my $cfg_ref = ConfigCase->new("$case_def_dir/$config_def_file"); -print_compsets( "$case_def_dir/$compset_file" ); - -#----------------------------------------------------------------------------------------------- -# FINNISHED #################################################################################### -#----------------------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- - -sub print_compsets -{ - # Print all currently supported valid compsets - - my ($compset_file) = @_; - my $xml = XML::Lite->new( $compset_file ); - my $root = $xml->root_element(); - - # Check for valid root node - my $name = $root->get_name(); - $name eq "config_compset" or die - "file $compset_file is not a compset parameters file\n"; - - # Read the compset parameters from $compset_file. - my @e = $xml->elements_by_name( "compset" ); - my %a = (); - my %data; - while ( my $e = shift @e ) { - %a = $e->get_attributes(); - my $sname = $a{'SHORTNAME'}; - if ($a{GRID_MATCH} && exists($data{$sname}) && defined($data{$sname}{'DESC'} && defined($a{'DESC'}) ) ) { - if ( $data{$sname}{'DESC'} =~ /^INVALID:/ ) { - $data{$sname}{'DESC'} = $a{'DESC'}; - } - } elsif ( $a{'SHORTNAME'} =~ /^I/ ) { - $data{$sname}{'NAME'} = $a{'NAME'}; - $data{$sname}{'DESC'} = $a{'DESC'}; - } - } - print "\n"; - foreach my $sname ( sort(keys(%data)) ) { - print "$data{$sname}{'NAME'}" . - "($sname)\n"; - print "$data{$sname}{'DESC'}\n"; - } - print "\n"; -} - diff --git a/doc/UsersGuide/limitLineLen.pl b/doc/UsersGuide/limitLineLen.pl deleted file mode 100755 index 25f1216d06..0000000000 --- a/doc/UsersGuide/limitLineLen.pl +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env perl -# -# Limit the line length for output designed to go into the document. -# -use strict; -use Cwd; -use English; -use IO::File; -use Getopt::Long; -use IO::Handle; -#----------------------------------------------------------------------------------------------- - -# Get the directory name and filename of this script. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $nm = "$ProgName::"; # name to use if script dies -my $scrdir; -if ($ProgDir) { - $scrdir = $ProgDir; -} else { - $scrdir = getcwd() -} -my $limitLen = 99; - -sub usage { - my $msg = shift; - - print "ERROR:: $msg\n"; - die < -OPTIONS - -l = Limit line length to this value (default $limitLen) -EOF -} - -sub LengthofwhiteSpaceNearLength { - my $line = shift; - my $leng = shift; - - my $l = $leng; - while( substr( $line, $l, 1 ) !~ /\s|:|,|\// ) { - # First search for white-space before desired length -- and then after - if ( $l <= $leng ) { - $l--; - } else { - $l++; - } - # Once reach beginning of line, go to the desired length+1 and increment - if ( $l < 0 ) { $l = $leng+1; } - # Once reach the very end of the line die as couldn't break it - if ( $l >= length($line) ) { - die "ERROR : went through entire line and did NOT find a place to break it\n"; - } - } - return( $l ); -} - -my %opts = ( limitLen => $limitLen ); - -GetOptions( - "l=s" => \$opts{'limitLen'}, -) or usage(); - -if ( $#ARGV != 0 ) { - &usage( "Wrong number of command line arguments" ); -} - -$limitLen = $opts{'limitLen'}; - -my $inputFile = $ARGV[0]; - -if ( ! -f $inputFile ) { - &usage( "Input file does NOT exist : $inputFile" ); -} - -my $fh = IO::File->new($inputFile, '<') or die "** $nm - can't open input file: $inputFile\n"; - -while (my $line = <$fh>) { - - while( length($line) > $limitLen ) { - print STDERR "Line length over $limitLen\n"; - my $lenlim = &LengthofwhiteSpaceNearLength( $line, $limitLen ); - if ( ($lenlim == length($line)) || $lenlim < 0 ) { - print "Can NOT truncate long line: $line\n"; - die "ERROR : Having trouble breaking a long line\n"; - } - my $substring = substr( $line, 0, $lenlim+1 ); - print "$substring \\ \n"; - my $newline = " " . substr( $line, $lenlim+1, length($line) ); - $line = $newline; - } - print $line; - -} -$fh->close; - - diff --git a/doc/UsersGuide/modelnl/Makefile b/doc/UsersGuide/modelnl/Makefile deleted file mode 100644 index 595a1b3a3e..0000000000 --- a/doc/UsersGuide/modelnl/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -# -# Makefile to create HTML documentation of namelists -# -SCRNLDIR := ../../../../../../scripts/doc/modelnl -VPATH := . $(SCRNLDIR) ../../../../../drv/bld/namelist_files ../../../../../glc/cism/bld/namelist_files \ - ../../../../../atm/datm/bld/namelist_files ../../../../../../scripts/ccsm_utils/Case.template \ - ../../../../../../scripts/ccsm_utils/Machines ../../../../../rof/rtm/bld/namelist_files \ - ../../../bld/namelist_files ../.. -SOURCES := namelist_definition_drv.xml namelist_definition_cism.xml namelist_definition.xml \ - namelist_definition_rtm.xm namelist_definition_datm.xml config_definition.xml \ - config_grid.xml config_machines.xml config_compsets.xml ChangeSum -TAGFILE := clmtag.txt - -CWD := $(shell pwd ) -ALLOUT := $(CWD)/clm_nl_drv.html $(CWD)/clm_nl_cism.html $(CWD)/clm_nl_clm.html $(CWD)/clm_nl_rtm.html \ - $(CWD)/clm_nl_datm.html $(CWD)/clm_env_case.html $(CWD)/clm_env_build.html $(CWD)/clm_env_pesetup.html \ - $(CWD)/clm_env_run.html $(CWD)/clm_grid.html $(CWD)/clm_machines.html $(CWD)/clm_compsets.html \ - $(TAGFILE) $(CWD)/index.html - -all: $(ALLOUT) - -debug: - @echo "SOURCES = $(SOURCES)" - @echo "VPATH = $(VPATH)" - @echo "ALLOUT = $(ALLOUT)" - @echo "SCRNLDIR = $(SCRNLDIR)" - @echo "CWD = $(CWD)" - @echo "TAGFILE = $(TAGFILE)" - -.SUFFIXES: -.SUFFIXES: .xml .html .txt - -RM := /bin/rm - -CTAGNAME = $(shell cat $(TAGFILE) ) - - -$(TAGFILE): ChangeSum - head -3 $< | tail -1 | awk '{print $$1}' > $@ - -$(CWD)/index.html: $(TAGFILE) index.cpp - sed 's/CLMTAGNAME/$(CTAGNAME)/' index.cpp > $@ - -$(CWD)/clm_nl_drv.html: namelist_definition_drv.xml - cd $(SCRNLDIR) ; ./nldef2html_drv > $@ - -$(CWD)/clm_nl_cism.html: namelist_definition_cism.xml - cd $(SCRNLDIR) ; ./nldef2html_cism > $@ - -$(CWD)/clm_nl_clm.html: namelist_definition.xml - cd $(SCRNLDIR) ; ./nldef2html_clm > $@ - -$(CWD)/clm_nl_rtm.html: namelist_definition_rtm.xml - cd $(SCRNLDIR) ; ./nldef2html_rtm > $@ - -$(CWD)/clm_nl_datm.html: namelist_definition_datm.xml - cd $(SCRNLDIR) ; ./nldef2html_datm > $@ - -$(CWD)/clm_env_case.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_case > $@ - -$(CWD)/clm_env_build.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_build > $@ - -$(CWD)/clm_env_pesetup.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_pesetup > $@ - -$(CWD)/clm_env_run.html: config_definition.xml - cd $(SCRNLDIR) ; ./xmldef2html_env_run > $@ - -$(CWD)/clm_grid.html: config_grid.xml - cd $(SCRNLDIR) ; ./xmldef2html_grid > $@ - -$(CWD)/clm_machines.html: config_machines.xml - cd $(SCRNLDIR) ; ./xmldef2html_machines > $@ - -$(CWD)/clm_compsets.html: config_compsets.xml - cd $(SCRNLDIR) ; ./xmldef2html_compsets > $@ - -clean: - $(RM) -f $(ALLOUT) - -realclean: clean - $(RM) -f $(TAGFILE) - diff --git a/doc/UsersGuide/modelnl/index.cpp b/doc/UsersGuide/modelnl/index.cpp deleted file mode 100644 index c55aa64159..0000000000 --- a/doc/UsersGuide/modelnl/index.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - - - - -CLM Namelist Definitions (CLMTAGNAME) - - - - - - -


- - -

CLM Tag: CLMTAGNAME

- -

Component Namelist Definitions

-
- -

create_newcase files (supported machines, grids, compsets)

- - -

$CASEROOT xml files

- - - - - - diff --git a/doc/UsersGuide/modelnl/showinfo.js b/doc/UsersGuide/modelnl/showinfo.js deleted file mode 100644 index fd8a608472..0000000000 --- a/doc/UsersGuide/modelnl/showinfo.js +++ /dev/null @@ -1,193 +0,0 @@ - function applyFilter(filter_text) { - - // applying a filter hides all standard names not matching filter_text - // if filter_text contains no spaces, it is treated as a regexp - // otherwise, all substrings must occur somewhere - - var is_match = false; - var search_type = 'regexp'; - var search_help_text = false; - var num_matches = 0; - var is_boolean_and = true; - - search_help_text = (document.getElementById('search_help_text').checked); - is_boolean_and = (document.getElementById('logical_operator_and').checked); - - if (filter_text.indexOf(' ') == -1) { - search_type = 'regexp'; - var re = new RegExp(filter_text, 'i') - } - else { - search_type = 'string'; - var string_parts = filter_text.split(' '); - } - - allTRs = document.getElementsByTagName('tr'); - - for (var i = 0; i < allTRs.length; i++) { - curTR = allTRs[i]; - - if (curTR.id != '') { - - if (search_type == 'regexp') { - - is_match = curTR.id.substring(0, curTR.id.length - 3).match(re); - - if (search_help_text) { - - var helpText = document.getElementById(curTR.id.substring(0,curTR.id.length - 3) + '_help').innerHTML; - is_match = is_match || helpText.match(re); - } - } - else { - - if (is_boolean_and) { - var is_name_match = true; - for (var j = 0; j < string_parts.length && is_name_match; j++) { - - if (!curTR.id.match(new RegExp(string_parts[j], 'i'))) { - is_name_match = false; - } - } - } - else { - - var is_name_match = false; - for (var j = 0; j < string_parts.length && !is_name_match; j++) { - - if (curTR.id.substring(0, curTR.id.length - 3).match(new RegExp(string_parts[j], 'i'))) { - is_name_match = true; - } - } - } - - is_match = is_name_match; - - if (search_help_text) { - var helpText = document.getElementById(curTR.id.substring(0,curTR.id.length - 3) + '_help').innerHTML; - - if (is_boolean_and) { - var is_help_match = true; - - for (var j = 0; j < string_parts.length && is_help_match; j++) { - - if (!helpText.match(new RegExp(string_parts[j], 'i'))) { - is_help_match = false; - } - } - } - else { - - var is_help_match = false; - - for (var j = 0; j < string_parts.length && !is_help_match; j++) { - - if (helpText.match(new RegExp(string_parts[j], 'i'))) { - is_help_match = true; - } - } - } - - is_match = is_match || is_help_match; - - } - } - - if (!is_match) { - curTR.style.display = 'none'; - } - else { - num_matches++; - curTR.style.display = ''; - if (search_help_text) { - showHelp(curTR.id.substring(0,curTR.id.length - 3)); - } - else { - hideHelp(curTR.id.substring(0,curTR.id.length - 3)); - } - } - } - } - - var filter_matches = document.getElementById('filter_matches'); - var filter_matches_num = document.getElementById('filter_matches_num'); - var filter_matches_query = document.getElementById('filter_matches_query'); - - if (filter_text != '') { - filter_matches.style.visibility = 'visible'; - filter_matches_num.innerHTML = num_matches; - filter_matches_query.innerHTML = filter_text; - } - else { - filter_matches.style.visibility = 'hidden'; - } - - } // end function applyFilter() - - function clearFilter() { - - allTRs = document.getElementsByTagName('tr'); - - for (var i = 0; i < allTRs.length; i++) { - curTR = allTRs[i]; - if (curTR.id != '') { - curTR.style.display = ''; - hideHelp(curTR.id.substring(0,curTR.id.length - 3)); - - } - } - - var filter_matches = document.getElementById('filter_matches'); - filter_matches.style.visibility = 'hidden'; - - document.getElementById('filter_text').value = ''; - } - - function toggleHelp(standard_name) { - - // check for the existence of the help "tr" object for this standard_name - - var helpDiv = document.getElementById(standard_name + '_help'); - - if (helpDiv) { - - if (helpDiv.style.display != 'none') { - - helpDiv.style.display = 'none'; - - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_right.gif"; - } - else { - helpDiv.style.display = ''; - - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_down.gif"; - } - } - } - - - function showHelp(standard_name) { - - var helpDiv = document.getElementById(standard_name + '_help'); - - if (helpDiv) { - - helpDiv.style.display = ''; - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_down.gif"; - } - } - - function hideHelp(standard_name) { - - var helpDiv = document.getElementById(standard_name + '_help'); - - if (helpDiv) { - helpDiv.style.display = 'none'; - curArrow = document.getElementById(standard_name + '_arrow'); - curArrow.src = "./images/arrow_right.gif"; - } - } - diff --git a/doc/UsersGuide/modelnl/xmldef2html_compsets b/doc/UsersGuide/modelnl/xmldef2html_compsets deleted file mode 100755 index 2659beed17..0000000000 --- a/doc/UsersGuide/modelnl/xmldef2html_compsets +++ /dev/null @@ -1,162 +0,0 @@ -#!/usr/bin/env perl - -use strict; - -if ( $#ARGV != 0 ) { - die "Wrong number of input arguments -- should just enter one filename\n"; -} -my $infilename = $ARGV[0]; -if ( ! -f $infilename ) { - die "Input file: $infilename does NOT exist\n"; -} - -my @dirs = ('../../../../../../scripts/ccsm_utils/Tools/per5lib', '../../../../../../scripts//ccsm_utils/Tools/perl5lib/Build'); -unshift @INC, @dirs; -require XML::Lite; -use lib "../../../../../../scripts/ccsm_utils/Tools/perl5lib"; - -my $image_dir = "./images"; - -print <<"END_of_Start"; - - - - - - - CESM Component Models Namelist Definitions - - - - - - -

Search or Browse supported component sets

-

-This page contains the complete list of config_grid.xml variables available. They are grouped -by categories designed to aid browsing. Clicking on the name of a variable will display descriptive -information. If search terms are entered in the text box below, the list will be condensed to contain -only matched variables. -

- -
- - - - - - -
- - - -
- - - (separate search terms with spaces) -
- -
-
- - - -END_of_Start - -my $xml = XML::Lite->new( $infilename ); -my $root = $xml->root_element(); - -# Check for valid root node -my $name = $root->get_name(); -$name eq "config_compset" or die - "file $infilename is not a compset definition file\n"; - -# Print table -print_start_table("config_compsets.xml variables"); -my @e = $xml->elements_by_name( "compset" ); -my %a = (); -while ( my $e = shift @e ) { - %a = $e->get_attributes(); - - if ($a{'NAME'} =~ /I_/ ) { - my $var = $a{'NAME'}; - my $doc = "Description: $a{DESC} \n"; - my $grp = "$a{SHORTNAME}"; - print_row($var, $doc, $grp); - } -} -print_end_table(); - -# Finish -print <<"END_of_html"; - - -END_of_html - -#-------------------------------------------------------------------------------------------- - -sub print_start_table { - my $hdr = shift; - -print <<"START_table"; -

$hdr

- - - -START_table -} - -#-------------------------------------------------------------------------------------------- - -sub print_row { - - my $name = shift; - my $doc = shift; - my $grp = shift; - -print <<"END_of_row"; - - - - -END_of_row -} - -#-------------------------------------------------------------------------------------------- - -sub print_end_table { - -print <<"END_table"; -
Compset NameShort Name
- - - $name - - - $grp
-END_table -} - -#-------------------------------------------------------------------------------------------- - diff --git a/doc/UsersGuide/pergro.jpg b/doc/UsersGuide/pergro.jpg deleted file mode 100644 index a0cb81e046e802b41c5bfde3073bfb5e1903ccf3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35642 zcmc$_cUY6bx-S}<3P_PEARq!lsDkufg#@L9CJ9C9Eg-!kB1Jlc03sm8gd)8qp)0*h z@4ZSFq}R*Z_nv#!T6^Df_WA2ho+tUfB;U+C&%ABk-*0XvZWaKP;1{4506aWAfcotV za5D{11`y!?qy6KZ;IGzLlLUnKZXcv1B__T7_W!Wm`~W<-hc}M5On~yhO%CoC+us-ZNo(FC+@EF4x=0hnj_S{nm9MwR>XXP=Sr0SRufDwx0PyP- ztkWFa0VU5qk9H8mPMOdADcmv$r-ui$Rh=_`pfi62e24#WOq+2E1CVAK$aZvwF`aJ) zT@N*df&hr@?1i(^9RNB|yGkM+GnRz9BGLR=x&cv`)CMp+zxO4$02@$?^_I^`x9s_> z!DN&wmIqjCv=Rn2_{+LU#*`o=NcTik5J(C@WqW^?hs=3(Puul$!Hub&-^#xKP}C%? zouxsl?}}~@uF2`J-BHGg^mzItQV9eU^kn?r!Lr(CgS+!QLzEfUx8mt-Xek`t(&eab zMIM6gBVX_uFbF$pAR%~*evd~Oe{bSE@|rfA2TW5H${V04r*)A}G0J@a0z$eFewEV&|BO@ydSbHa8z_Sn#!~?Fo(@PEJg%D%2P$s>ZJ+Kk{{gv^)^YOGi7>`Q%=jNNqm4c zZ(g6Nt%iEU)2+>*QKMx)P%iE1I$7$r5xPJ1ffiTU2?G`WBQPC=jxs0s>#QF@JWJp( zU-V=IwSFbDJeOToZx{Ll*W|2np+D(ht^7n~ExUHeAV|$~7TRG>qW7SD;iKUfJn$vj z4yqKNl@%Dm963}rr@`R-c>R=Xp;>T6rt?7{?^3|8=+n>euASlhhN?v^|uk^Xw}u;I*fGKC}Hp>}zzy0x-nqoJUneMjg@iTk$%BEr{^DCYvvwHrnaW~_=CP4`fr{Np=zn9Xc{Z;bgC1xmI3ZY z68!2;Ntch87*E>g+UYgE0dOvW!rz%Y>ft(5PW{{%fh2_7D4Fiy>VqQhgD;uqzK4H5 znn=74bxZ#cZfWHSdzE`Buv7FDlCED>^||r7p|wqkb(2w1NsmeEjpA#40}7)3wz`L% z<@d_=GQ(FZdZ)W*x}2Oek~iR(*i`|=03d(G6qsrOgs1Rv5;jqm&da*oYfa7?St%6t zsvK4RAk~nVnx+Q?;H;`)b1+j0!q=S!-FloX$qvfJA};%BdW9 zFN}JY#tV7RFa5)MLZe*3f{oNJfb>604{e1EUZY9PaQ|T=HkmvadIQ2i2b3 zvv2;)QU3UA2Dv=4>vH)mEQHaN+4kdM0<&E@9G}n}wpAcQ_;(8Jpmj9)1$LV`poTZb zf*p?>+;L|64jhTTbz;-hrSux8y5eq)SJ&ShQiR6MAk4PJPGQ3a~eORuClx2jT+z7O5yM$Pfg;35 zQw?j92eHf-o)oHblacbR-g*13x8M9n8pdpA+lV$^^(2o+n(8e&(;HbEHZ#coal~U# ziZCue()SxqW965!m;ct|wjxIpYiQP7G5l_H`y&6k5kJ2`F{(ho&k322mXqejSDehx z8|olPrReO0~Xbtr`l^5DbHZ}?4 ze$5Hfx#wZwz%yykKl)8UZ=8Ged+hWMdM&7xDUcdRHUqD)2tH38YB9{>nDorc z0&;FshA+t$G`I+}!wB^&?E$#~tTkec3>cNO%T5r4wYv)Rwf544$-)?WI;THjCmtODCI z=g`y_zbX1oZU6}a@>e>0H-HZ%ZVTHK$b(YN*X~Rd;@~#6-s%^`CYUzbE|*DCqSmUd zt06j6D2o48VQIjJGTxlMF?C7KulkW|1rbrAO?Jan4udRPO`G-I155IANd(1l*+r&! z9TV7x7B9^oTG|a33xW8Ac-DDbEN#j2jZ+>$b(Wj)HijWJ{bpT#8e>0sLMk zi(K)O4YQV};xT!LTMBAW=5c9b9fOYORrBtmsZUDH@@+Tze6XKz&ipu8Cc-XVU))S~ zHSi_r%IPa%Tp2TjCMh}CIQ~3s-cU9q6#f`BF3B48r{Adj8&iMw%u|^5h3kE9tX(_= z%LFwDu4EYNJ})NLCgC9BpcE4~OK*xSdwD@_LD*Z=Z?Yq#%=z)Dd#Hw0dsvze)y1Wf z8NvHp^1EW7oeB{Ca|)U^oYtr&Tg1DgT+XoJPO+%b9$-f?`o5ylQjW02Od<_=F%C`H zj2uufdt*2e0ZB-tkyPn3cJ+YbHRaXjIB8vE^IxG^Bx7*DsXUe20&y0L_Wf% zcb4kw1QXKd_pz2HT*}t-@4y1WUm{$iyOFuD)CX8XA3H^tfPl5}tem?azZ1L%BT%6n z!S^QEf2+Q?`#(t|48wl;S6K=@%Cx|BWH1y!-tv#p(I7ix&nE&Z)Q;k}G})B5Q4fww zJ>0bJx!nNnFTO6mc-VbLHRxE|{L9VxQ{+Vmf8&{Gm)*qpEDz`g;F2W;O#)tS21wrk z{0vz4^{@3m_6L~$sZOM-nRN+N>(~{4-Fp&63wBW)-S!?*;A+1P3#x&jSj_10BR?kLyMr$h^>wc3CIGbkl%JhQFSsQH1JvFJ*$Mt&B*llB^t)2T})$MpL8dz4m1!~0Pe zu07rN{dvPpC)ICn0JLVSx`DtWwx7wpTd7ZHB!zoh=pE-oItBRK@Yp`Y8l?(wb;L7U zjW{1?>)qA*SE1|2wG18+(M<}xWYH^=<;;Bq<4>XSE8;-rDFpO~;+dgU%i|1Y7~I;6 z#hKQ*UbD@h72lpEG>^siY{EHP0gCKk4qJr3f!5!G!@aAW*YDd5&$Man^~AZ3{F=um z>7H);$HnzJd5q$)M6?p6;gL`eu)714&Cbzr+kYP1ALt>MaRX>5q&WS41K`0gHl=e; zj-apco~D1eRjU}q;{G|}wLm5FQGJ*(Bruy-&#PH$rmAW3-zM*Hw}AY<#Ymt>ylhvp zCCqwJ0wr;v5qUflkb1IOJ0W!dNxh$Vk*>9qB^CIutE~6WORh%*O(JXl$EvS0TQ4TM z%E>$9_|Mdh-3wYnvZ)>^gNHuIKetnAY#O`z$}4#`a_)6~TqM6#c$rU9&BK)D+py>$ zCUw-pu;L%M_)d90{?n#zB#F{IoSYW~xGXNPKfeJOUel)k+mQ8wX8aHKT!gT@LWAxZ zbSl3GY08*=rAe(QB#>8N?SlJ6tmPi8nA{t{Kj~NQ_zeK^=-~|@|C0W(O(I_prn%V_ z=gJXIyMwtH-sZKd@K`7inqxl^E1gtuzv9vTCus}*>H0q;kN$_`=}~{Z`qerXv3Ist zV7|fWTCJ*NBB)wV@-ApP6C-F0qJOK2W^dHX|-E0X$Ll?U;yOZx&*0(sxOt>h23w>N5#U4oBhWDnFtoh8gst2P` zV{Fl$;DgK;J5GNMMyqR(H^LOID?YxIxm9<#+RneNc%Z?px~Ir&g{@7W3HM&mrO&St?v!2B`R)QFt7Bgn)D<$PQ$^6%>YZ*$1T{JOPKE`dg<^?{sRUoMTerUH^?K@hiI zx5t4H@jZ0@eW%W6_TOz34SxU6M*HTE^KCDFt;H$E-xBsOJjOI+S5?93>UMr|BE<>I zX1WT-g)QEVP@&(SGW~HK9~mZfvf0MRsFKv<&mX=m(>hAtD$Zu#MSnOcXj<3Zn7^1R zy8%R&9u(XF#Q)wpuQgn8_`^0yszJBfzF+S$!y{Wliu+SVtL+EICxJRQfOogf>wi~x zP^$3@!R?ARIvI4^8Bv3X`T;X#&BfIf}_siIs=IA?m~Np~l8&i)!i*Puku# zFFURp`Pmv-9fJ|V(x2{5$D?K9E=meCDRLqV`V0;<0?t?Ar;cuHuaa$WN&b-RT=h-4 zg5NoJGg-Wj3$SQUtB$3Jgk5Ttu2BDt$2pyB0>euf( zu`|W5FU7AJ#&Vv8Exqzi;*+XaLMR#zR$&j%nr)Vc)OP>=LYRC5zTi!jt#6b*Kq5|a zwiE}~3xkoUp%wQOeut{NX*r_h&+h zm56l}X+*KH!R1;aT(Hy^5ESCx)e^2$+}KIs2izvTvTn_Or~mqBY%qEX-lrDDOorKl zi^{4Gx=IfuFHPW;{g$h-C#!?Ta^)EP5*!W?^e~wW#dH9$|N(~j@A*P`r{0NS3 z^lqz-Z|Zy_I*nU*k8Ndi+xN5EyV{0?f3@R&yL8NbT80<2NezHu8;uzV#Yxd$MT>O2 z7G5&r$T?@SkM7j`Zq&$nH0IK_w1`$I8aAB~qP_V=&1zeul+A9`P^ua32{hyj>>pEn z`+-CRX41bO-*zf3JE7r%NmCX?Wx6@|V0u(pN9Pgb$9BFQy1rJ)jAVOou{yEMK}dJ6>~&s_6Q z@`Ln3+f#SS=|nu0nwj_rJKk4>AxZQ!e++r?d5t!|5eiJ`er?<%!pot4Fq!#)$H$QJ zU>H?N37_Q@U{m#b98~R1U~}Ysh{P^W%vK$c^`Vx>=-|IAJnRbHH)68zFAB*D+OJ0O zWn*RO22iB^9j!R?>H@_ENXaB zxf<3^8JzkXWi8C1&Zvdg)@pd1G@Qd*`VMe!x%UqC4)s8InXjxT| zI;V-O?w;4{glNhxY8j$S-j$7Y5@E z`s$<1TA(eeWAAT#uEF`aOAR@uK6!QfP9Qm8;kMBYKu+#KtvR+n@1E}oQrwnU`Q;Cc zR8qh97F^^J@#DNV`S~0Ge@}LO(RCKR)$Ld(U?67p1#bjQpMaABcGba(I5+XC2Sq7e zm31@e0zE3P-Yps=jKj3<|4BJls5IVV7&8+)VpzRof*^l5IaEMl_IfJ~6Ne`NZe0_w z`o(WN*fIUaIDM4=)t&X^b5p*PpDBzEmdqet z;B_j@8aPf?Rwu&nj7@C07rg@51bdC^s<(Ii@fvQ+B( z7hXot-l6{jLby}c`6x7O-aFDpjGy zfpG3uOh{1Xnj}iBjl0%9~fG$L! z-H>eqUoL_D%jqGZ-{X0svR$ks$uYHHMK7$07yr@u)k*2RuBk@7LcMR^LXUvFOWf0C zayqpD99wwsNR;p*XGpOEksX#(lKy*yx{l@Vujr>I3d%z7b;bP0M}(G&JmCp5E@}K- zgKomXUo+gJgrAdI%O#CZtJNOpm!bJ>r8bf9o(wyZ#d^vEe^X=C%IPL$tSsCSLzOIx zHPI;H%i`(@wN>0}xNO>++fy*F(2#9EgP$^)8oGC6o=`PKW3aT&w$8RA$)?U~dk4-P z!930z=FbOkIhK;*#ME;Z;(cFSjYBXgmOx3_UV1tvur^JOm=YCoI|CrX`=Dpy$$p`K z?+>>?Rh!eA>Ek`g&Po`=2@Tp0UiYW}Xnc@+)1RU=^4wR*$m_!soD9|YtET6-Xjb%S^XtO#rucXK#s60IU3X7g^6#Ztvrma1*+{kUpf%!9lskwJ z5u6;@WHtn3k<0rn^JOyXQKe<9#0i}9=y}Ioggxmm!bv0A4)&uTQ6`zsoJ=aITB)fP zt>I2bQBPs9Qh6!GVg}l+mcJ1SP|fi9(S(T|hOxKtE0T?`3nbQf-@Wwy!>AR2ta{`_ zBsHYFXa~Vo?i5-QeuNrQxLAdgFHFDs-koGrnO=^Is97;IbE%<^a5YGo12dl`FDc$5 z)&Wo|%v%Y3ml>YOSwpPk0JWdVp}IvPyw0SA0Fu4i#CvHw3}gOTzb5&VzD!^j@Jy z1O6J3(UBxe;84@Wzmj0Ouh9K!{`yA4_7zJT+E*i(RgW0I?;9ZJ&PHh%ss^=JDU|F4 zY%boN6=?5~)ihbDg6p86vv0+IpaGP$lZxP}h;4NM=VP*9tqQN)9s%9NwSMbns{Qm} z6|Ukk$HF8>WT%oe_+|KKAGsw{zjdIx=4Fy6S6fNa^W4L9St-|a3nuqbRUW&p-QBA_ zpF(|&(4YMcPIXW1*7{Prx_RWjZhD#A#;S1x2L|Vd``5lZ5i`H2u%?=#BF1pL&*QjH zLrOG33yNoY3OeI&6tuzNy~qS))3U^|KBI^XqKAB~RWjQ6p_8s+Yc*$RIHSkoE1FOg zWnim;W|G^EO*6K`$agr?m*(;nT)Zn4eJP7XtmL~z^ydcT}NkRj}`Jd}DVmh}w%u3cO} zY3EKf(CA@gf^S~*;T(53xoES>-ORo}$!RIf`~?%623n4It#_$Vv>X{hRRz)nZ(<@# zM&!p_dyI*JKi%x7bdtDV=iOVZKe1Jbg!vXoS_@gqd(-Ocyw zX45a&qh7l#Mi}j1_-k;(+nXqyq*PqPiFrZJChCS(jt*+p6^B_O+jqkyG9za**<-xt zncA6a{mdBRBfX=qaxO4*w)V*+O~CPT5fv-+z9H1Ez1lC4^Y>Wm0^B# zI{3)BTI+-=@QFu_8+7AD3lsiDT2AI<|AOpQ120y#g!}X8kgl-xH}Sqiwqqkc%+@!q znqvrzM@I=XNz9`I*s|GDFf90QfYl|BTA3TqV`@PwyO6#-(`Q>^E-t3bAEThq7?)!c z-)wJ@zW2c2pMNd6_(v zLb=pX?e{pjc?ADt;Hv%+TX4hAz?9;L-wg5gF@-V_@(-Tfn?{_cdwYQ+$iD7=7|CRP zwVNxew!QP{Z!U6bIbCko%UE)JD z`6wYuqUYHx)*`_S@hL_Ev5!Deb`t<)kE$MjEcx~wqpDLh)(YL(|3-t>66=O}%=$pX z5umG09{GJy@x@rtMvDp#YoE}*Gi+4)i!Z}_^u~59#3V*@zd|Sq2DJ9}4N5d}-gJG@ z-IQEd?pG?4J0FjEMt zKEBV=r{IzNjW2HgT#L~m`Blu9c^LOyDn;NNHisPhy;LuJRM~BI=@T5f`kc}JuRo{I zybt0pT*}qYMju#)N+|9B#z#5^*L8o5 zpluc|uC|^7{YJjnS*{Zu;m6Y{#3h+;cZ%0FJ2GW2uYVdr|JQ(S?D|BW*z~pVNwgc; zxvq1Mj`=WEpEW3U2&t~_35L*6iin{-<(vBaWgiCuuR{_~r+-PiT$c7W@^`c-w#lAp zxbEsPaAxHc?@h~!pEru?v8Yz$Ud4VU{o&{nbTZJ?;w-@SpdWkwsyI*W?eSUQdS@}| z&`X`WVJY{FmY^#BJ0Dy7=KzrVO2pDuN~vT2!0XtM-EAp{J*Y)@ZRO+w&m2o zbi53U&k6DflWn-B)`?J0MPQnMqma%NVu zO$g&uAK`B;woSl8kqICOGMZhXK=8gko|pQ|+UE}DrSV7O&+D*`6;sfYH4PV%*Kj6c zRvtV^1P6eMm?H>J^x+Y4SH+j|i5&y!pirr$@%CCIn!Fh0nAh<}w+w~LKxWo3Y7^Rj z%{r@OSuv$)6-tNFB5nZki4_`7Vn?}a=-`g?=9XRlDj@H$vnmAt=SKMiEkK<9n+IQj zMgGc=`Kx9U^6?~2=O)tFd8UdU<>4d7QmcIAd$)uU=o=OrM*^x_XF=fHIq1B z!yRxG((Xsw#0s^xwdd9mx0`Etg59xoeB^Dm@f!+SqxY0z>j}Ub)MwYrywhDJ&s<() z@HaRs-($Y2km8m+*)1+qVQIK`71rP*Gl^lsHAhEaw^lc$mZ#In{dskgDJvUe;;BMV z6(VvCdRk-H5}uZnk8h5*?k9gy89{6I@Mj!*fH}@CepB9-fG5BAXBTBo!5!TrncPoH zo*T^KhIHT@4O_1ED_;Vc=_rg+SZE77bnNmi0_HkvfFPiNfJ3-p&v)yw;a6ot40d?j za5kX&Ip9uE=`7IXiGDM8UF3g3$jQeR-T>O<2M|q!K5HfNNvF=u5VjIq~p2nUx|D^4!z?n{3r?@8EIiY3>G&UNf*;}FzHhCw0 zAIDMO>z;gd5+BUCi{^H>8_hX0o^?G$Behm+ocazNxp8jkaiobVbVZ=c*P2#A;cWhP z?pZHf+NX^mQ1V0F=p>r_@3k+2+AL$O_+ftLlsgb7mZd-qWXeOEyo|4X+4l3p%B7d~ z@C_5)(Kc#Y4<~6iP3JTQ?$~O6)IY-VE+rbEm$9c3q(1iJ+;CkgZBw3EuctcmakJI* z{pu$iFP_y!Z{%BnWo3UkEyU+gXQ2sE&i!FWrtj5-OA@_bzHA5~jXDdn+%Ef67@g^3 z#NS!^vKS0gE|-6T%*o8=h#8>!uk`qTR8AWOdLw&wR6P#a#t~?-V0S(0lGgWi7S|rp zc@KFLOHUTx>vnL`!V~2zSJfrVi;o3ca%WH`R@Fqf1QEpFeoD&lM;v#)FeCD4G!IcI ze0}W>Z|78>#_$ z@L%<;WNO(3bx=?3I9QD(V*~`nvKSBUnpq{G_}?U8Nx3J_5=|uEw!)9?NNPJhrjr&| z+yhs+k3AGJkXZqY&b~vG`2G|HfAwSqA65U_JO3>DbXFCEh+K4vOEKK7i;*3z*&ld2 zIk4}f_qXrGE8KLlsoKdxT@g>(TZAijiHE{_|Pd?-H`&-Zf`PeIJ?edKx`X zER?`zuMGA&_&Pbj4BMLK(4icEsRSIbvVs|k zsR-qCiv8gq0RcA#1$!yz?PG<*;n_z18paOc9`IYdQSO)4=GT5UlKF9qVk>*a;Jzc~ z`0un+f8*Z@!Goc?!tAG3?e|A3lE@dEToB`u*x(7?ybJIEG-tM5lYg zExgD0w?xdEk)!$Dxx(lM`IW$oVv44(FS{1nd{097`&BX%`i`AQ>&w}yG*r9D<8w3N z_RxSVWC#(5SbXr89r}6e=K`SkO-4IZ60SOf6G&j0cnr{EqHV?1rE&dQV_HW~i+6}1 zHQP(+(=6GAkC@v%hgbOgqWM8!k(3}P1ask`4bi@H@xw4GS+NCIyt#3jYTRkM?J+Y{ z)$7RyZDi9HcqHqo#%HG+Y^@++tG(MnVW>y5x(7BM3uq zq4-H;89)xlG3%g~)ro_OUi-zEsM+QL0ls8=tNOLt;d5Xy}YtwH27jgbS{No=Jr~TqFBPcQtac}a^HAugJXWsO9(ka?Y!o!$zfg*fpy!-$1Zl@WcNRasD&OIe)w`EbV=mb`Rz(abV3Vj8liLmNDV+qvUDKv=J2FpfpE+ zmXU*{>pY5IJwQ*MN1R3_@eXk+XVE+{Oz2~TV|{tzG>OinDRpIb<$_bttoPib*AItY zM?}t-uU(x`{4~vbY8>zHKeuElCzV-tBIEFz*RIGw+@)cbKj*f1^2h{X1Vxya=(^rh zKj*D`FPJ&`Z#x)*WibxF5b*^KMHm%SR{+J0LUL2SX#eylFl)DFsKxOpyj`Nm>1k_u zJw0E9ZFC(x>RJ6fO3eiqBR=*duSJ6dw#Px3-6r;XZ+K>I4DvMsCwKXp%IZa=Wql8? z3r2C!Ly;q7PYos~7rte@(Q-;Jc0kW)Q6GWu{az2wOomM~N~Ce-5*SPrAf}98dS_t_ za?`-U_%k}t^CVtX69qa=j^)L+bT^Bi^nn@v365`HnDpCse@){br`Zl4t?)hZ=%Aq_ zN8D5YLj*rU|Ji-++H!g@8#^a#X-WM={#l(XxcT~ViEbfbJYX9?SPw9u{WyTv{h!FW zaqBWEw@R98Y_@cXXYgXR;8P`s&GR&$weC0!x?(hA9u8I~L;>G&S(Kk=%AFoatLoQuwKi_sd8}$(oxAm-6dD(_ct)QkYrYMXgjJe)py&e_pt>Ki| zlb8_d(ChrPioLQ^_0@g5ilfSr-`qi-jZd8Yu`kW{aAcNaS{p8SA(+`xbMjs@kSpHk zxg;N{TW}38IH$(>cTLIO&-(H&Fhh?{_%E4Gx;q1Z(E|7-U*|oxo!grN8>{>HTs^wi ze;Copzwdl#p!j5g#Kc;#DrmSuqk$?I?fgm%m2|t!%ODvE=UXmbxy!8vZR4c>$j?H}nE&v_ zK3_j2pLX?z@Rcann(8|87eLHw^8&Jzx|@EFrE;oJYT+Jj`fjjiZ;RRDj*@9(nPPFh zbdYXi_u!>NnF196NyLFWU{a3A{fafGLy-&E&@cY5kzX<2MbHCw63D|l`>N!n@3_v- zI1T2f5r0;9_@S%aUh5$l@Kg4AFr=0}_J7SfSG_Ww<(N3tp37E?d7|3%ti?)XBxS5e zfS-ZCT9Ma<42R-~$AiF(2rN0(epcz(j5dE!yN`BmdS_L&Ch-=AIZob2aUCR2R||)5 zYUqC4M51{(p#bWopo@k2q`tH7*~ZZ2`$S^mR_F*f_VwrKKFQ7DIF#^CMyU%3#KBRF zr>0yHn9~HsGBpri+6gGsSUvx8GQ+Y9x}yS0+h4$3yb>(kmKE{;{bkDbU(zp%kTK>& z5*2HX@6shzRctFU$s>w*3V{RuRJCgV zf;?1n&?nH~2sW^61eZ--Ny4fIMkC^mVGGD7oXKj3dWR1cQmF88A>RMN;rTe#{&@a1 z=i>Bg%7gy>3ye^*#b;@Zbl9`LSlzz@h6b#TwQTWoc^9iZ9u%A^e1f$j6y|`f62WE* zmoW<%VP;4EmX*D&hG zuuARjnX0mVAG&sfrLk6lbLOb~1sD(jA11Z`Jx80wps?F1Ut%kgPmd?^u|~TQT4^Dl zdaGtq49=@ITS`I^i)>1lh*)Qpv_@bXzVh?-EfBYxt$G?liVSoTg@H zYxOE{>Kb!7@NgqA%iEXYv1r>trFY+omZoYk-vtF7;ZcRDiYWNrF*WBa{Hn4%f)Lw~ zjF^GKFu}kSNqd_DJ4wHX^^2yggeETyn-q zJe79IdX|t8=h^F3>^{w;09JRGvnd=?#^Tq1?SzUWFxA|=1)hv>E-GDXe4lb}ccrr1 z>S}7xoy3`6s(ChGra`7ZilwT6MepBV1#@Vb$30BX^-I`qD;zaa)ZC& zBkv*w>wjB)yiGxm^22pXSQ##obq23~UUO~rVzC+(-L=GWy7O8&*jYN8q(KKfstS}< zK3MSC+wabgTEfXH`UXUetwcR)G{G8J@rSOfgK)k!Xp&<%Bej(i72T&Bz#-?GQ%Jlg zq%?oq|E$y+XyL}xk!@u5In`NB@dU+LYAdsZ)T<8hG&Ctt*(x8q&aD_7v2~X?{4BJD z-fb7EH3a!MG>L6hz{g#~zk8%lb>Z5zoHnX^a#5#?2L*x$i_*@22bo(k?!FPBEtR@T zI!E*Py!bCb<$pb~hB7T!O?ywH{PjsE(!%;wW3JWR%VVxaw(L;JQ|wzYUK7VHeq%G* zHe+!qoVFjfQV#EZ*JUm3EIgEPd;qhrC91Cy3HB)I=fB4^g-oabLWJn zIqlV2WWvMS>f1lqjfMXn`?vxmgqs!Fx|v4|ppR$I(1?`*wNKUe8RrLR3P4ybvXImqAs)sZt*l}Ah8k4TZ{%v}z7 z7dEwvnH~|D;eQTIVbE|X+X8PRa>r17&c~sgAo+U6qcL>r=~uQ8mz}gnKdf>zrCKz6 zCpK9$@^vXB@)8H_{-7w_K=MZl2Z7a?fror+vwrpF^bRj>1MVlyXj~sdA(R2{Jx_Ne z6&jyX@5P6|#is>FaiIcU@~^lLZvdV2+#rYx%Hl-;3iw8B#=UAL1ii8~L!xd5A@Kwp zi0f}^Q>JT0)byXFF8T;cy513#dkRP`45enq$aE|}&j5e6c5gl(-=TQ{X;K*Ls9zf2 zr3uM0DfkaM_V5`*KZk|Kv|$ai4Ha({laurJWO2Y|uoo_TvpK%<_bz4~qE5(IRM?jO zCeFRp`ud>H$>irpiVGG6AeCJb4JqV}J1UY4!dje>*v6Lr2(QlBc{@ z0z_L>7_G>JJfl=sdlxk--x{j3>O z>$xRsqOqGN4qb(-zB8e0uY(sb16IG?(^TlaUxZb=h8OTnb9ZyioUT9kGEDWk{>Ou! z?UaGv_lpI@C`r_HJX-Nq&eZ>Seb2s7D+w`!^C5LzxCZP>X>gJJ_qYb$}+i08i+3@LIccNKW$%6I|W{}hhA>{y_6 zHB}V>PB;U{<}?&B0sY;89k8AK__XijPI(G;{2&i)vVO{wyupdT<;@&_2QwPwnm))d%Two&#tmhA7e(T(ok)ZDAiZx{{s7Q9 zz?Q5oiWBHTLts-|MGMSz&NrukoAW_W31R>u4>Qv%20mXZ&P zUj<)^e-kV_zl`JL8P6=K{`ZYrpUWqk=~YFIEz2$|_}vHRo!ba$iaGJxHZmI^GG${K`+J>t73VS>tEl^$x4S5f7dKxEN(nGBKm-#bLiYK9-I z`a5&By7)CJ20yn-k0>wt)drr#ZJ4}lU*YE*qd`oi=}PH3#8%}W`gLs4t@nd#Ea;-5 z=QStOQ>n7l0@gnptB5U)Oo5RhDV|gy4uTZ|1?PI+7|YLb^so7he9gsu?LwO*KiTud zF^p%xa-~(SU=B0KL+>}U4ECUTbgSbpx9)`|&J}f6^&&4ZGa(J0mZF?v2wF6^=jH^L zN=)LnVuSJjd4d>Eq|R+j-nRB-wd{uj<8U^)6%SeJyETn1p(H>ac&jj^irEp!5iFt> z+2#wuReLW<(py_-#Lmo&i^hjpb-*Yv^ohnJRLdH8uZo;ic>o{FUbMk43*JN_mU5^0 zqxILW*|1V82`@kSFNyBb!%u|EpP zLO$-XVdzLi0^792b7YP+3!iV8kHgd23@&4Y&5a)jZwUKyO=!d5TP~iV_=>VHZLZ@2 z{Z0+89nb_JdmhCrtaX3uk)*(QN7YBQ;~X}y7w&Jb~k|V zxR^+?MxyeMbkig+HDt|w?+Qq*IXoIKJ}`)utMXR`=`HnFQN`aLiFOQ$_{bw?Q#mL|Aw_W9eA27-~V z+z8!wo>Dzgw?fwdK%ZQ{hrbayeRxUhR;7x}zplT3qShs7Ycf6pd(*)if>+y=wg z6tcycjkIq8gF=G{@sq@85P0X5_bxstKycrr-XqGSJ?)-$Jndio*#&%N86(qC&DI`l zOz=kV)#VQ=JPyY#53E6EYw8_+#r(da=c2m z74~Gd8ss`3H}h1u7o?86Sdj)MXTaCBFbwbb?G)7Xa9L7ANd=bRRTsC{tzTM4oi@LQ zEv>|#!2PF>e`;b63$PL(Y{x1&d4m5}Om17}yvJB7;xt-%8dW{}ieONA779t?=Rg$! z6b<7AMoLH;jNpScQ!86I^pYB1LqEo6Kmb$??E2IuMUB#rzN#2h>lrSoJ=!mJXtNSD{f1*4c1<;Jbmh+|c*h|i@_9EDF`cgiMg&5{ z?ma30nz-xPGfvs$UD4&F+UV)v316A^G8Ka`V=F)KRY5J9Rxc{qm|E6YiZN#p+ z5*3SH3M5o&NPQdK=7Glv+?1_89^@{G|87?K<e-ekLiZp{;p(cB~x)O_483)Dw4;PXyWbW2?|7G6N6aI=`P0)A_aR)EwnepoA(yV8 z`wN8q)ACb{U+7R%N}kE_&N6I1vRuz^G_-%xYKcyezJR|2`}5Wj3D3QQlT}22nLrnq z;W(&lNyr~?;U!s+@7JAPj5&L};c3s+XPVug?vdwm&b>Y=)9dcq6#r0i!tKdK|73D5 zRZfZhMeM+9f!b<9H2W%nWjs&X{|sRNa4hO)x`L}|VQ~18=|l5TCtMT2)Y*uCNeb0g zttgP32LJpUsxg!SHU3SLH3b>!#vY)y{(8@k=JM0h*Bg$&o1SNqp=l?D9ifjTyl6fC zBs`&1E=Q{WDV9j6tjZ*`uG|${b65v9rMNV4!=6o$FaO#3^<7gg>ibIlNUEkSrOhe&=3f&L4tIn4Z#`-t_?IA zT!I953r=v?#v#F-;L=ENhu}_bzjyC*&VKhjweR=+Tvbn1cdh4{bIm#C7-OL&h(`TE zn@IFY%K}iEr!vP>g83}3c$$Ul1@70OdC~fTbgV3HfiWu}SXUWl)YJ0b&(LT6I3a}B z^5JLxgI4z3eUE#wD0ZXe9?Nd?$$p(^FedJQlOcdu)AqbNtsutVd}w-L#tP{#?A+iio|X)t$J`8N-75<*s#Fj7iK+$YZ> zBWATfu#+{IE0Ft^Jke~Ttk^LQM2b4@aTJ2z!B??n8Y+p~r^V!pgXF_ztM}|y$e+=K zebEKCEjJ+^49|omo*sIi^PN?oGnRxh>HOk7kO@xR9O91b)`Q9@JA!2T8MYs-r~mx7 zK~0c*PJ3Z*=hZH|n{`ZrUcAN{NDh{~&wyU=h`!-6GaOxFY1D4_!${*OJ?w68nvzWz zB2{TW_>5eMu9pW1(e=921xehS;}Bv?qd7&#I#)G_LI{|`*oj?jLA;~K{ZgIE5i`p_ zU}Nf}Rc5Jqm>cJzb@vwAY^F`X93;`i<91sfCW^=b@!f1}Y`H&Z(ImThtTvF)yxHRT zwAA?KDiEYqg|J{v{ygG-IDlCyJ2-pC&mWL{PzQW$71!&ZnAbt`t@Zg5WDz$c@ z=XzJ3Jl3{CmC~5t3Sz0cQR~HsxBMMiZd9Qjd@UKX33w+@0>CdI?rW02oE) zeQbEVKbUmw7=0SBq796D+3~w1w5rcm)SMriKkShy_(|2qI#ls$k$5KFlAHwKb^@dYJ)g? z4OyyvW3fJaa4O;QJ#W(y2Sq<@ok+|qo#Aorz8eL#wbohkR6-<`a~iBcah_u6RQkL0 zb3byf9z_SdAb&BH$X54%95-&t;m008Az{RtRFMI zFm55;`bdjYHipFR*TpYZ_QHHVz2sW0#N-{XoV3_=Apv@CUv_J0-W$=+6B|>Htp8Tv zmVZ3k;^S}|p$zLg#&Tf@3!h$VBAErUH+)enrJ2oNi4}*F=xyCa?uEng!JIVlUuIHN z()?`PloIcYIMD+Hh@<6L<{W!7WAm4Ss+ixj(ea_>gH>|#1uw?R$1yCSgL4#gV8@R% z1(|v3d*`og8h>xQKAgIz8Vr&RpY9yNDq?&lj@Kv77Gw6vEx;E~yQyA+ zAZ4NdnX~sduNHO3sZ`c&eI~8oEViQ|52KnniU_-FI|y=)1u6EY<&bd*A2^ zU&cuX`vW@^J==JDX!Ju$Goo{_W z#40H~6Y0)N90bT(G$a_P9V{d4ts} zWtA0JPoqO6i< z;iYtexiq|6yx|gPGPNEXNNwD%j~^6Z{oYQDxw_;9Y9Bh-WFqnLhrv5CjfHu z-u%V+k~p6RL+xGKeTV11O{7?0Cr0n<)=odaQo6yf|s{SM^jia$f2q$c7x#Rw4$mp@_9z!Hfl*I>SMuXshNsa*%l1^Q5mg>=_qbtLSD^#&2c1}+Hl zI_VcJX1&#GmS<>dk2Srx9Bgrn8c-mglm5`J*4A&vw+>)k`l4b(-L$;?A-MIVM~d{A zdo=P`Ny=HBKfWUu_&A7EV#cJR*iZiE^P2H6453Ry(3|e?K8eDQaEp=yFv%@^ae8mO z?xpPO#IHRNdUg*MF{mBN9{nw|=(%P25HGKNMrMLAa$LL0)4ltq=$)@@Vv^R$F>IS) zv9{-=Jx=A!J(p^aqu}y`isU3dZkEK0Po^!ydbQS zjX=3`s99ATGexUxQuZ7SV`};j+7a!J)cwuOe(AZD!&T>V2dC!Y>Uki)rD}S_@lRrH zc)Ptt87(!6lXYP2(^h%G!7~I*VyRfTHam9o?NATwf=9=m$kBrw8^z&UduuWn7*FpH7Gv`=Ga*sSWPlzKwdKw&rBU~3;J+;yfX1a-*8k<^;3}x z#HK#I6*qbskhze9XM8l*&Y1e`VnHfw1{hC=YvnmtWLl3Ni+zpX5)o65oIMenx;FP-2 z%$RM$+|WZIcX+~WJJ~NmDK5IS%{}UcA*{&T3dVEde5qpQUc|hv9H!m-v?hg#Q9dsY zwTmR_U)1#Yu$8F+?F}b<9V4~<~ zzIP*!t8;$aY~fY%Z?%)O+vpcgkqGaXl)-5g0zrh-vy&fmvWBJkOor6TZ_DNEG0Wa% zD=@NLx*uSkWA0y9DJx$*kX3;ij9Q|elGRIv7HlfZpyXvi6w0OoXMy~4@*uV9yuxjQ zGVjKxp#rDLZaWRS^~Qm*+HeIUcI1bQog1h-(_kF1AXkt|cHV8&O4w3DM_I8nih(fa zxShb<^`*m-Xvj#tCpes|)E`#fYf=@@v~3Jz@7ryT+vue*trJ;OW{p1l%n~d8=4f#W|w@^0)ekP|V)A8pykc5aL%qtbl zh~00h*PJhgTA5e%lgr|k{-A+a+&EDdtZHB)#wjw{Vfac4$jH9oJf*HFS+e$L>hPfv??QLlje8Nw^gczjf3zlbbGRAMMThHU%-ra|8tY4h6BSE@M)4c1OuMpI z#HGLeoAph8N|1u}>mq}(x(7w#sK9}^oBC9v;QJCslq@(Im2Gx2rZvQ`@AC{E2!H%R zyTvmtQf*s_aEbqehN6x&n`Jh2b|&p6-6Ur;YN7PLI?8|0oPPa5yNlpWh!QPhzO)?s zgI50s?ONMP?U1cU{vls%zrB}psLPt&Ao3!y{lM9I*r(HS`EF<5REavQ0ZEQ=vmIKO z;Pbr{6D1d$){nmpH&{(ueo*vD@R7JQxg9V_eVDX#lTizVHyzY_zaJ(KEorIM&Jq+a zrhp!K{>Wtn{5&|gW?kOB=H)yOOlj}d68RVQEWQ?C{&1Vo~w9B)S)A?DO z3&>BCfJA4X`c?2!Jj6OLoq)^nLX26ssd^4B(^j{CNkLus;6$o=Qs3s~K$USD^KcLSR)sj_lw=sQ$zcuE;+%PzTza?m9`oZLA= z3dTC0v`RVK#Of6&|;7da!UMAf8fJ^;Ib-p3e~y8*svKQWHhzn**2Ne03~Cn=m{jCxE( zbxadGo(DX1<$l7rpSmpWUr*E)i95VD!BhH>%2WLw0;@au9S8t*{ro>fg#LOg_+}*V z)yDVOveQ=_Rcx$Xo!uIqlKP8uD#m_876K=lsmjt4id9rbwp>*BBqJ5mL zsVl%bKrNlMp*b@GZ52`p0VzilV+oyLWpRl}eHRf~Y{OS67q2fqLU(O{Wjs5X`gT}g z-ak5<>YOAp7oFrx+%8WKHR_o!pZ2f_cJI$y&J8S*(ak3_HD%t;D9y(D`3KEq@82@5 z;%U3Gh1Ff>aE5GNaAQUY7acZ?Zx`CF92vxLM? z2GkO8y_u=J$btKU%@a=o@ut$+EZ!yYAMBKtArc*MvoxzITTainV1U@XuCr}CeinWa z8!g@^G%w|^v;P=z{-ZN`rXg?aLx*^vp`mM_Epa zF+!Onbo*bB(4Zu~+ziA?`T$fN*);I(u`CpY+h?LzQMPtpP%yUH>SxFgmMIUVFZxjR zX*SqXZ~#CouxBDt#t+3r(a}$Wd`Sj%!MjF~s=1{&c#pyRUi$Q8WZ8Ax%X+;lkJ9F; zMO8>Wm8C6Ok%meGMR zM~23*iz;ZYZIS6cml+eNiOv#?>Q~~HrOt|!emw1srdt~?J1+Gg7%0Uti zFq>`Z8*o^al6YK@?4^kMPO@3v!QZoKN*C$1gwD=%%u(av%fM~hOd*b8J-{o`K^7NE zx5J{Y7AkP{fu$zm=I881bpG@T7L}apcz8?f&RCrf{`k4>GHda5{`H**sZY(Dfq3rx zWs>8&TX%SK50ZT=>FWE^LGmDZcm9XfQ)~Vb=QeiVyA*p#Tz@GTe;oh^BrlJ#Iks1$ zRbpP~{j$+`Iy`&i9b!Jqz?@?aZ3$EsDa`d09Cgr-S1LddnQLc)vW*eZSl;Cr?7OIQ zFyJ)S#3jZ8xdn5Tx|Xfc!X}H@t8XRh7!&7Jb$X@B?p-(Jx=u7POs`*3X~8+P&aqR3 zZM=V<%m@zJIEfTSW>+pYffW)wDp=^gBUj!_^t#_#?Z=0EWhw_C)(1+$EbBFW`cF{F z0NLl{(N6}l&X~+SY8{_1D?T_bzoRJE-kt7$@p!1_nVD!JgN@bUR3hF4eM@aOV*eV_ z+VLa!n4pjm8#0b70hWJEulHrTQFe-|r#FEfBLa|GGo!1O&DZjXt=Yt)MPy!GPg3`t z72C6H33;{QBI`?{3L8w85BgKRB2qmX$;mxjo$OfH@YFE5Koi(+Q@+>$p*prcFTfwP z9`?_tG^qn6tXtH`Ls!}A+xHoK^zLnZK}U{jQc+i>iK;8lQn2^quQ05rB7Ly|v@Dw0^kKUwtGaIKPcbSKmbqR;F@Ml%Gv}3K zJ-?o-+cdSz9eJ$G;MP->Z2X!i+|{m@nw6O5?dAX)WEhBR&N*}gK#`jNxm3+d8}=O0 z>bp9{`*D(gJj2~Q)DXv<>fuNlq+Jh+C5jh3@z)r5B(7&$?EG@8O zk0bF^4Ie3u6nM%l4F%~bAE0Nz!hZ#~iL;V<_P z(()Z&jyCA|Rhf^Jh{Ori#n!0jW~vpl`(h0}OyA&Y8PPZN66oRDa~O1J`f{jn#mCM! zzJvN!KH*(ke4b;YVU5L!mBS3VZ@%I9)Ycn?JWg{=e4DCHVG}rFig<-!YpEwB7TODh z6YJurOA8R?NU9Ug6vAG&k<*;%{z}?+x&LULQX^o|-f%nqdTssX6!2AbI&U*}1CV4%CQ46+fzqE`SZ1ksk zpI5?0G=aZ(^d($2a>z{Aapk`E)w|F+HLvl6OMB1OphB{zIVDOI1f0D_8=APHIR}P; zp-_XGmf6hT*a3qt7@F$I09I-b6N<1(cYb`K*sSVGv^n5so)#qY63n|2R{c>YBfe`6 zI19`xJd`=51wzNYs&dM%(EL4L4S)Y}ow)ZzbYyPVVlbF1SDadkthE)^GX5Q+kwAbW zkNI5IAI~wIV7stuWdVL&?%1Y_V2=QsYHXGzUj5bxkq0|qz*8-FmYX_q`Klq+?eJ=) zR2Bn6xGnzHEBLf<@1Y41r!jSXjjgTYu~v8ig{7zphU(8CR4>bj4N_YHC=EnTz8k;V z-07RnFzgpt<{cS}?+l61sem)EP7X1XJ4hD|HGDq!1aT&*=3ghWzTVAwy>%=tz>@O% zRW6E7CMoR@y~l{^*jy!4Xj$xxKSucdn#q~?gBB?E;SXBs?bC|W_DifogYS}2+e!?z0){urntJVh31;P1P^pfwud$X>sllp z%8`;UvM-LcbpnqGUe4O_T?zU(GIKPwRvT#0G@|+ zhq`AdXzxGvP`*_v%PV^P&PCZ}5%E=&gRdpsgfK_C#W_a#MdmQpBVTh*EqYp?{)xbQmK-GzevFXGVYtH zyNX0*^&Z=tqX&W#<^<=LV^2%%0GvZbnq8%5nXcIr)K6R3jetJ6JK9-k0zo{vhCp@MnAc`yPwRASx}CWE;4cJwu5FwsnEAn&e5aLWt{FNHmR25^v8(=8cUTv8snq z=TqpL3FZwN^)pqB(J1kz#;_Zauc*>F$w9LM+$h(0QZ9qr>P{!8kdsxL^-0!LX!Xle zgEwWf2Wx#TJaPB(f6(k0?n&hhBXwg|3X6TH#vV}4h|C(&A*7fZAAf{Tei};!vsaI! ztIQMe#OKj}M;UIDT;#DS8{xv5jpFkN{zkz54+}|AP+g{I5}ZxfkhPbBNka;L_0kU3 z)F3bZdFWEKt5$M!`_`{w&v`jwYAO36`^3pGrJc}ZuyUzF{&Tc${KvU$R^8ra?fe48 z+DtZj#OOX+W}SKHWm)m!1$O|VA5`9|+(U1BUOcUA<0#N~6}X3PlC=OubTnXtjD6l% zlm-OuZGTwv(Yt3G^9kJTJfV+{U0g%JL@Gz7^kNn zM)>Kh9dg+ngUeQH;>V;wB4`5GBRT#Jk6CX4N7*;K>b&UGtzfh!^k9zD;7F0Epg4YU zKlEUp4Ta%t{ellCF5fdImTG;^v>x7CG!r@V_#Azx@erLOG*z~_5Lpx(nnX(swlrbM z#*LxnudNN8wQn>S=MQL((Vg$*E{$*m`@e7l)b-(sHr#&+9sYqO@%wTlL~PIx3j4B% zqxS>(2Q61KGcE!*{gU$g%3xz*jU70#k>!dzAI1%hVXRelB7NpI9*UzU@0478|I(E9 z_CS2xxbGrW1Dv+m;uWcTjPz*hE-S%Fd*`-Fjb+(iA>!5kntS0gr`IcJ5m_}chdCWR zjM(Ti7zf)_2^3OVk~&|ko)^_H-kR_r%c`JBydfM|2fCyuna;15PGVzMiN-VNv$5qy zPJ-U=nISup_N||E9&w+NyHV`~E|E!VrkgDTZokwQqrYUVOdMbRnA@-#-*CKyd$9l^ znbGeO&ohX6t6QW|Vv9vPdvMV#+HvmExIAb4dt*4=?n`AZV;!H4p(d@yiZcV*VV;HE z2J5Akcy13ec|kK` z>Zr3!LSbHV``xmt~Ay$Xfe@AKYpvbW7{NBIDIisr3dDQwN0GFgJC3?@sUfb z{632Mm1X)lj)I9~(}gY?n&Dk-&}=~<=dhb)!@|c=6*UvYy31nFcd3w>;OGwjqun!lW|9C0)(L%{L@`E1_!3yghT4jZLf6cG(Mol(q?@ds*aXr5aC{&o}NJvK@

vM359>@vt8j)}t0wqdGq z4zNe3lB_eRGWf0IK7fDW1=54(u~@B5MX1q+XH>`u_!@TctW=cy1rDa_ixsM?fODV4 zOEPFd6FS7bAsy2{qrl{dCyVjMso#^ z_UGzPcQAbSj19Q!HBlg21>;Ifl9`d2yy-bfT4l%!Y^!-6Cc5tM`AIn#fqb1nPJ9F- zoi(J7T3xAs<{sOaV=WEn3LQb59BMCVGBhQ;$rDg@jiW3w6NXjGbB!iOC!UuV$&J4+ z5vX4{bb0$~B5dvQ@_wD|*HNr`7Yy$}FSfI{@)keS@vp%UJK)Wy#MOm9E;^CYJ)R>{ zia_{Up@}Ods_6q^!x$MD&XjthRL?4CKASMDk-rz)yDhj6Qv`s{rvEPhnD~>X*bL~( z2NvHaQqFVY_rXHNQ%oCu`=AZ)mr;PAB}+HFNdP_rfR)By>E`pVnb;-|j||~*;RJ&( ze-Ttr@LMTc@27U1eT|Tr!SIYK;8=R%H4Mku5HYTv6HiORvQ5QE8+V5G_3lB@ICJjS z4%I!_-IdTp8#V;?bUM^804oi<6Yw?-Vv#^T1Qdb=8Lv)f$R&~xds445Syw+~e3SW* z>kO1l?mhL{mIvxL-g7UOIUEt5rVPJ*4p7Rwb6-V<()Gc714#K+G*{omM@L*p{gAQ* z4ZyY9i!0u@l=Ta2tj@*FZJ4rLrOF65_Nlu=0T1OE%C8`We@5VwBk@jUeI`2-h zoS)f^@#m6F^YrvM)(;mW0mu@c$38*i;k!m1A#`g8^)sU#Jared_$}YEYcU@fQT>p4 zp6BiALCstCjGG%ff3LOtcOA=L^CyYd<%?li1)xL^0hF!s47SP>8GlK$STHqx(v40d z*e4Z!JRnZLO4kgm!GO_d=GsQec6HywbXBB) zkYt!xEEiENWrb;J;w=1%w|ur$!JY#gp*+OCP+%BiRxj)b>(6{KRUg>e?qVEsS@8vi zcyL(L8=L84s@?LUw-*^|=jtQ6s}=5d*;>&B9&c1m*h;}0h83lqv#aQUEl9$jyHa`B zzoB?V(kWhXH=LsU-QKfE?Jc^6T%!{|h+bO{B(64Fzca*ENQzFOqzLcHWUlCJY}WkG z#|2pJbJgvtFFgw=8|uU++}1?QR?wl$u)fIsy<#Ms`2xTyPt!2dISu%l@yuCc@N*^8 zvwD244W2c;vS4uluvHh7DLE%EKlZo_hyjJD^AUUwu55OtJe6)C8uM&g`Z(LrN%5K5 zYg#LgL&~B-&tHAbmw{zZs^cB1nnS}Gx~Vk1rhM1+sgiEQZD9ge3T{@KBfKlfTlr*B zMY2yaDv&z#C-a85iLY9J{1=Vw-xwDE z1uDv=@j_}2dx-!emNPKqQ-G`=o6tB&}c;ntg?S<3N}q(Im3m!2C1xooQNx5)T}euNsaD2 zM%LUh(X^*8ETBXf!{WHVmkR`eeT_FX@MXKr<^Ds#nVm(Q{dcwh%isJDWv{$oV6e$a zCZ4RB@ff883bX|on9!D0+c-X$1m?-l-tW*~ez2{xxeT|@Pz*z7vb1opf;lMkfz6DM z^$b_%Q(3{`KwJu`FnNkG9N_}T$(_0AIxXA8Ya{8F@l!{;BIPPTp{1Sq5h7UqWZ_T2AO=VC+v@=m=)He*fO zd?a+EO{((XbS?Ld7zOefAf+#QfS;zmv*?oCqDaDbTw|4FA~W?Vo==rsd$+6IrsZ{| z{md=t?VYB}gINuIw6JE@gK|J(8Bwdm;D?+Qrs?L}n1yB(H-m^WWgc}yjQ!>F{$K&F zsZl5Nabh%V>@uZ;ZRN=!>%~OIipeEqXNCRHHRmRSjV1G%D=1@^Kxc%6Er{F&6m{v)aRI!%DnGaz7U#o%^#{#p*(daHdFbc!L&h`hp*zRHM0|yo)8Tf; zJM_tB8+GMiCodbGhW?MerUbgA^^u(XpDne za`9qUlEe6Ti(J|Xu|6ftyCGCB4WX3jcySyRaDWZA+Bq8j9MnErzr5O9f68+=D`0&e z=JkM5<-dKWa1Vs*-3Bz08jvg>T_8KEMue+6LRc}GztO3xIW^zvMW2qcwHvTr-}t-d zTGD=HF7~q*QGKrSf$FUf@ONeqH+q=F@_>iA(uxqH@bvi>bPD!~nE<}^YJuaWr`W)q z<&2DW1cyRud{Jb>1PHG9tu~kx5??ff9~3lc4LbKcn2UVDIg4Ko+a$AEp$WXooCr^x zhu#x3%ru@_uU}FeoE@g4{63CrH?R?YNsZQeolOW>A)Ni}p&}UjAJ%EnAFI4%mq>7q zW45j)Sy&QdIOf>UT-fVVK*9FGgsyIQ3CxCUbUI=nrCRGV^#4_KbMpGY%3-}(*i|4j z1L?iH8XT(+67lS&*nb+crE|hUpa;;&*X-9iq>4BCdPZ!n%B%2T3#t>Ew=@FQ+6dLtJ3?3o9n`aXlf95 z_jnfGF|*S8DS}G-}IK-}T$R<55olumbM&0-rno$}CfNkZ+{KwQCQX z%~{;M4WYqfa{CgQ>FnWGFA_y9bbVikN_G1)S2@NrED_y_n|7(JQh2S0*#-E@j{5-> z@`sORad!F3w!Qurc^9h0{y)!GB;@Dz9gOw^M$MLbV+3Xb##a7;c{uU-VA$iVJODsm zb9cWGrC{{38b-P8;SU>!(zU|AEEK^uuRz}_*Otbq>`g943L$6ZzUk=Y1<<9a@xQDn z=3Y%iFfr&-%P`G)b$e6ZC1z?d8;F~w!Nq*cVOKXee-SZ<`U;Rz*Y87t`L50wuXs*@ zk7!Ii0ugtab2GgMrDcDkvi-GS8?_I)3c!BzEQRoaF`?#2)<71D5;oBpOsOpWxP8tx zWMF8f@f+*F2da7l z_+^HgW9Arq1}DwgYF8L&1(}p*Wr($UUC!5OKPp3}EUs1h{14i=t~{yDoEv8+L3iF_ zx!SklU%|OgT4%)QxTzv*iMMm}M2Vh9XOynu15>+Qn(K0uOxb9Sb{vyj7Lsi$wY|ZI zBEP9;Ddg3B(Y*aIcIBDeEYEzb5lo#Sq63X4BfLGFnen7)fXQwJvrK8f*X-sD+1Yfn z@QnF+L$J_(v%|w#M>fPsE_R&Uickwy^Ogox#F0q5(CU-Yh>@$_1Fo#9z&iwyfE# z&!E@g`DHiI+KnzuwYB5dP8<{!q=LVwjH4{yWRITsCVDgOX5PN+Ht4#fSqEGt75nTP zkode<@QE(2W5EjS6+Y*M4Y1FCn`I_rRon@&t6p`m4whyTuU}xhm-P_ab6dDGY^#19^(v@(MzjZNHCw8wUyLS~QP$YjN;jXPSNJlaqAG#%11o$7D+ z;#lEZj9m?5uUqLLli4K+p3DBATn#cSUa+csY5gV1nsM>OV!JLTYt4Zk4un4V3RQavMm$J&`)ttc&l(N)P+ z#@bz=`t*cSd=dp{fMiiL=%(Z%YS#1X{ZFF5KV%&(NIyCBAkzl#{PdD6-!yd4s^gr&8oa;64EbhVC7BO8kN|v_0fd9960Q?QMOqQXzaMC4A1GGON=EykaKf z?i`i-NVos>7bz}hSpv;-xiK}9C~--)w}0E5R7IWvQ3MohftgYCih|j^_jd2{oiz8| z(c}`jp(|~}$Fz^9&swScgB+~=v^m9sAf7)kB$UuS?;rj9S7lo}(Fbgq*Oj0>SDBp^ zrWRi|XhK)}*B>i$@L_OI@#~uw6L3UdBT;CZv#m$ylk;}YOQ{(64u+^+QC+AuAY}Yr zNg`x@?RfL`>_bkkqh7ANZ1gIyk-qh=7U^jAC>Iv`P_#Ln`D!=D)``vBLx+bT{ZaXU zjFTY2^qa5!2CcHe{_xMBs)ZSA&&D`io_ZprEeW%V@?Zf(WP6{6B;{YX_k$uH&zLr> zHmjk0cb9k0KrwUP6X*UXVOkXMTs*>fMj_G+uY07*D(G%TWl7QgFqg-_`b7hpO+dQM zOb#;I{aYh4XCbBIQx$N~kRY42|4{gmJPz9K)0tsS(g2}AzEz@HcH$yd3QU^9*X>0h z2xi_b8F^(JZ z8+$+ZYPt^jIkaa5?)pH7$`m1SPf9QwvT{7WWd!wcH-&acrmT154HO!^G! z@?@)40}k2SxP{@S46H=5l1B(q*V?Q?-yC#h6^)cZ0qF;cZo^q%^;(ZRpM2y}eEqF6 z5PI}{OUN%v*_5B$QW;qt)JMVdgnGjMoT0gt#{f>vYc^kid_fr!qYOWLJL{@up-!9! z#-2kfqD@Daoi1|v|G5tM)8VCulDJihce~zeC@gXN5R}4aykq)hh>j5q?nj={JeVaUb9*bA>n=v)?9F=5LDG|44j~$OC@vhEQ4SpPSdIZL3tQ=XQD*5E zILDn`xN&`h4XF3X(=QZxRN5z}#v!3M7TE`9g-Ax{1&vGW6W9SXcQecN2l~YceC}O;uL7Yn@pkcU&&=G7A8xoO& zB+)~{B--5w)0|l$&mkGR*bqo7JAOvzsfcVeeAdkcHx9~;%kVo-rU7dDTH4jUFi(O_ zf;PSgg;}WNMmtH6q!fxjdLLo2MWCVqCN|TmW@bU?y1$7|oN!FAj9g!SB<-qtk*2*H ztG>fr#W1z{&x#e#oM(MRY%Tt~;F7s{73=PC)T74npA&JEul5sFl+Cd)iHPun5O35xtX|iDkjaY72y7>>MmW9@$@w;?+fj%yLWiJ}|B^ zJ&FtioaNz2U2`h?`^mb7x-yV3Dq^$7;W+D@TlTHTJefDnfkrH|Ios5%Us$*Ci??lX7u$b^G>t#F=O>8-f zK3C}Wy!`%ZUA3eHExNL=q8U5+<6yQLslH>61>ElZUq8JWwuw|Xdzh3w#rFCg98yx**{X1yEsU_Bezeh>&Cjc!4DTd- znZDMoH?2iupFWgrrQQh z&bS$|G7H-(#FH!b=)?zzx(muwxC*e{#TX8OVw{1Nx|x$?DXx!-uL`kvmD=$SHCXgXs9So z7(@KzKLZiPWJN!{(7;Gr*LLxWhK~xaO{cEa%k4^=*~FClFCnxHYkQM5vVP%8NypRH z=HBk1EWPB=s}dYY@je@E@eWlZKg4zs&D}|Q=Dz8_)=A4NuzWiO0l4X_ITW~{}x65FWN~AgHd~S*|=khMC|lA@@B2WgC{7B zG)Va)G3xSK3pzO+jrcM)c^pt|0)zjfGP@`NX6&`nAQ^K~#gqGZ`P!Z;LGM1>$OZEU z8p(bj6DAA+z+3obci7xE z&Xp#={bB_Cb$!Ud|9kDjV^$LWDPdKkx6bBY9JUS|t7qN}I*l>S#}79!8LgrRr09*$ zr(1pm7z$x*V&7;CT5mCo)|sC$9QUY^9`%MwGHXM=oR|)=eObtVpqO>GurI>L^qZyr z9-%_xdFlJR^pe?{@53NtFZZM8$UNQSlF2aR(-q=UtP@<;N0Ye?d3-sdJqf3LxkRp4 z={udl8^^$kKzgI)pfys)s@Ef_P6ftb#E@yno|;yC;L{iuA@voHdS@V*mG!V}oW99K z7Irci@$&i0g9e^j8#`%&hTEBO-=7VGf%fIBnK1@71|hnf*G{zxZTg3&njD_ze6c|) z^&ieGbEzW`(eZS`Kj#>ZYX4agO*>M*tNL|{D&#hbtQ}cf_>BX!V5}e$U;(APqlx7! zODSV>lTXuq7@g_IN}?GHSqAG16)x6O)eMD%wu#oEtMby8VsmaeGUK@k+~dI}u?e)q zF*WUPJxRI&t2=kx53jpgWOgTpb?HEEGf7;^Y|W7^HF^S>^r-je%=DTR@&bIN3Oqx zdDn=pwrKQbPIRt0e%d`+t==_D9%1O;*VPSKf&+`4C}5fJ_>0M zdVeR@{q|J@2gc78C&_23GnUZDK!j*r-aBH32o?+|Kh5z4u!pRZERqg;`!~7s4z79# zhkVRysS!YLrrVZ!0TtXDbvtB{bga)uG@Ji21;u#(xr>jCGMg=NzRd);RpCoA0nhqD zx4L>!H{WR8jGjt;8pLz|#ktVbr&BSU?zjAhk>$6ES~1@60!}VQ!RR@T&<6a*NYS;kxP?mN)%te`ki=d;Zm>p4+%`(7Yrh;2idd zmJvYGIR1Zu2mVj~@x6(ynma~5eF!4& zAu3czgV;U!`x_JAGJObrSQ6&jw{__acf*$t#_Q-vtbM3dmX4so#G@gJ-o$6{Nqp6t zqGT!75$=8JftfD`Hc>??5 zUbBHYQP-MGK0mqmyf!-D(z0y09?6^D%dbn5THU4C??~Yd^te-1-IPth(V@n5M&KGY zoKOI8VK7F(el(?2h)~%dH11!nr}{MY_Gb?gja4|Wau|2QJED%{t=RgUgZcmfIeE)U zkW&tki;H}PIm7RbiCDu`cExq;_@~EgY1ZR3QRv*^jr-^n&Xy1?IjTg^i!2ZCT@0n> zw@JrQh5DRTI)e1Cn`YkzRj6{h3?loI6Ix%9MRz5VLP)3#iR*$#3K5B3?p@INNrqz`$%;x@Yl^*&7!MQ7``4%onpw zk>Fs5=c62?TfghX)&;^lBN2;g2Y{r3f$<7bUdQfbMI=Oruv&Wxc*p297@zJY1MbM6bUS( zBC8VM-V2CS1I-62YfzYNQO|g_@^3d zi|{p@p{Z{W81PBX#^0+uSZzga^wfo)>6~I>Z>F@z^LoT&x-Yhzv?La31P!h4V~d}u z&%J;kP}VL^o)(|VraO1W_r4e>J>w+UdN#6X*f^BVJ56o02-x0DqU&9jcGV4+l4G30 z%+1sD{x&jfLw@wsSUaCE(hzZ*-b<-Z!G||U(FnaSFhQDh$xDHhyXd+~NhcB037_Y1 zwPu&L@f@d^>CALLblK0Z#W89#Nx0RmCiV}6ri@6tK>Mv%)sf|V!KCpQv}J~(1E6LG z;&e?4zoFzFsDFKE*G5V1OWShUA*x~K`Q?b$7^N*WEFMY;Z%&nO^$4l3BqS&O{n2rq zZribE9hStKe+i!7T*l;I0{O{bVsp1P5^iKGmIWI<`7W(8FlVWlSL;ihF>sg%1Q}6k z#?8?nnv)!rjFXr~*22Cl{2(IITmBdby5iHhN?^p<%XfkZW zXcg$#<$$}-^ZB7|DAP!^t9Lsoj8pbHK7bBnDbH*rT*}zG+=gi6<}waj0AFD~PhepUgq_WO=~-*JeB5H - - -$Id$ - -Acknowledgments - -I want to acknowledge all of the people that helped review or edit the model -documentation: David Lawrence, Samuel Levis, Keith Oleson, and Sean Swenson. -Thank you for your help in catching errors, and making the document more -understandable and readable. Our readers thank you as well, as now it is much -easier for them to digest. Any mistakes, or errors are all mine. If you run -across one of those errors, please let us know, by following -. -I also want to thank Sheri -Mickelson, for her work in doing perturbation analysis on bluefire and intrepid, -which was used in our initial versions of this User's Guide. We also want to -thank the original authors of &ptclm;: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, -Wilfred M. Post, and R. Quinn Thomas for providing a nice addition to the &cesm; -effort. We also want to thank the folks at University of Michigan Biological Stations -(US-UMB) who allowed us to use their Fluxnet station data and import it into our -inputdata repository, especially Gil Bohrer the PI on record for this site -(see for permission information on using this -data). - - - - -Introduction - - -The Community Land Model (&clmrel;) is the latest in a series of -global land models developed by the &cesm; Land Model Working Group -(LMWG) and maintained at the National Center for -Atmospheric Research (&ncar;). This guide is intended to instruct both -the novice and experienced user on running &clm;. This guide pertains to the -latest version &clmrel; available for download from the public release -subversion repository as a part of &cesmrel;. Documentation may be different if you are using an -older version, you should either update to the latest version, or use the -documentation inside your own source tree. There is information in the -ChangeLog file and in the -regarding the changes from previous versions of &cesm;. - - - -The novice user should read - in detail before beginning work, while the -expert user should read and - chapters, and then use the more detailed -chapters as reference. Before novice users go onto more technical problems covered -in , , , or they -should know the material covered in and be able -to replicate some of the examples given there. - - -All users should read the - -and sections to understand the document conventions -and the various ways of getting help on using &clm4;. Users should also read -the section to see if their planned use of the -model is something that has been scientifically validated and well tested. Users -that are NOT using &ncar; machines or our list of well tested machines should also -read the section to make sure they have -all the required UNIX utilities on the system they want to do their work. - - - - - -Introduction to the &clm4; User's Guide -What is in here anyway? - - -Here in the introduction we first give a simple guide to understand the document -conventions in . The next section -describes the differences between &clmrel; and &clm40; (for each &cesm; release version -up to &cesmrel;) as well as between -&clm40; and &clm35;, both from a scientific -as well as a software engineering point of view. It also talks about differences in the -configuration, namelist, and history fields. The next section -is for users that are already experts in using &clm; and gives a quickstart guide to the -bare details on how to use &clm4;. The next tells -you about what has been extensively tested and scientifically validated (and maybe more -importantly) what has NOT. lists the UNIX utilities -required to use &clm4; and is important if you are running on non-&ncar; machines, generic -local machines, or machines NOT as well tested by us at &ncar;. Next we -have to detail some of the best practices for using -&clm4; for science. The last introductory section is which lists -different resources for getting help with &cesm1; and &clm4;. - - - - goes into detail on how to setup and run simulations with -&clm4; and especially how to customize cases. Details of &configure; -modes and &buildnml; options as well as namelist options are given in this chapter. - - - - gives instructions on the &clm4; tools for creating input datasets -for use by &clm;, for the expert user. There's an overview of what each tool does, and some general notes on how to build -the FORTRAN tools. Then each tool is described in detail along with different ways in -which the tool might be used. -A final section -on how to customize datasets for observational sites for very savvy expert users is given as the last section of this chapter. - - - -As a followup to the tools chapter, tells how to add files to the -XML database for &buildnml; to use. This is important if you want to use the XML database to automatically select -user-created input files that you have created when you setup new cases with &clm;. - - - -In , again for the expert user, we give details on how to do some particularly -difficult special cases. For example, we give the protocol for spinning up both the &clmcn; model and &clm; with dynamic -vegetation active (CNDV). We give instructions to do a spinup case -from a previous case with Coupler history output for atmospheric forcing. We also give -instructions on running the prognostic crop model and its irrigation option. We also review -how to validate a port to a new machine using the Perturbation error -growth technique. Lastly we tell the user how to use the DATM model to send historical &CO2; data to &clm;. - - - - outlines how to do single-point or -regional simulations using &clm4;. -This is useful to either compare &clm; simulations with point observational stations, -such as tower sites (which might include your own atmospheric forcing), or -to do quick simulations with &clm; for example to test a new parameterization. There are -several different ways given on how to perform -single-point simulations which range from simple &PTSMODE; to more complex where you create all your own datasets, tying into - and also to add the -files into the &buildnml; XML database. After this chapter - chapter outlines how to use the &ptclm; python script to -help you run single-point simulations. - - - -Finally, gives some guidance on trouble-shooting -problems when using &clm4;. It doesn't cover all possible problems with &clm;, but gives -you some guidelines for things that can be done for some common problems. - - - -In the appendices we talk about some issues that are useful for advanced users and -developers of &clm;. -In we give some basic background to the &clm; -developer on how to edit the models/lnd/clm/bld/clm.cpl7.template. -This is a very difficult exercise and we don't recommend it for any, but the most -advanced users of &clm; who are also experts in UNIX and UNIX scripting. - - -In we go over how to run the script -runinit_ibm.csh" that will interpolate standard resolution -initial condition dataset to several other resolutions at once. It also runs &clm; -to create template files as well as doing the interpolation using -interpinic. In general this is only something that a developer -would want to do. Most users will only want to interpolate for a few specific -resolutions. - - -In we go over the automated testing scripts for -validating that the &clm; is working correctly. The test scripts run many different -configurations and options with &clm; making sure that they work, as well as doing -automated testing to verify restarts are working correctly, and testing at many -different resolutions. In general this is an activity important only for a developer -of &clm;, but could also be used by users who are doing extensive code modifications -and want to ensure that the model continues to work correctly. - - -Finally in we give instructions on how to build -the documentation associated with &clm; (i.e. how to build this document). This -document is included in every &clm; distribution and can be built so that you can -view a local copy rather than having to go to the &cesm; website. This also could -be useful for developers who need to update the documentation due to changes they -have made. - - - - - - - - - -Important Notes and Best Practices for Usage of &clm4; - - - -When running with CN, it is critical to begin with initial conditions -hat are provided with the release or to spin the model up following the CN spinup -procedure before conducting scientific runs (see . -Simulations without a proper spinup will effectively be starting from an unvegetated -world. See for information on how to -provide initial conditions for your simulation. - - -Initial condition files are provided for fully coupled BCN and offline -ICN cases for 1850 and 2000 at 1deg, 2deg, and T31 resolutions. There's also an -initial condition file for ICN with the prognostic crop model for 2000 at 2deg -resolution, and one with &clmsp; for 2000 at 2deg resolution. We also have initial -conditions for offline CNDV for 1850. And there are interpolated datasets for 4x5 and -10x15 resolution for 1850. The 1850 initial condition -files are in 'reasonable' equilibrium. The 2000 initial condition files represent -the model state for the year 2000, and have been taken from transient simulations. -Therefore, by design the year 2000 initial condition files do not represent an -equilibrium state. Note also that spinning the 2000 initial conditions out to -equilibrium will not reflect the best estimate of the real carbon/nitrogen state -for the year 2000. - - -Users can generate initial condition files at different resolutions by -using the &clm; tool interpinic to interpolate from one of the -provided resolutions to the resolution of interest. Interpolated initial condition -files may no longer be in 'reasonable' equilibrium. - - -Aerosol deposition is a required field to &clm4; sent from the -atmosphere model. Simulations without aerosol deposition will exhibit unreasonably -high snow albedos. The model sends aerosol deposition from the atmospheric model (either -CAM or &datm;). When running with prescribed aerosol the atmosphere -model will interpolate the aerosols from 2-degree resolution to the resolution the -atmosphere model is running at. - - - - - - - - - - - - - $EDITOR - - - -How to Use This Document -Conventions used in the document for code and commands - - -This section provides the details in using &clm; with the &cesm; modeling -system. Links to descriptions and definitions have been provided in the code below. -We use the same conventions used in the &cesm; documentation as outlined below. - - - -Throughout the document this style is used to indicate shell -commands and options, fragments of code, namelist variables, etc. -Where examples from an interactive shell session are presented, lines -starting with > indicate the shell prompt. A backslash "\" at the end -of a line means the line continues onto the next one (as it does in -standard UNIX shell). Note that $EDITOR" is used to refer to the -text editor of your choice. $EDITOR is a standard UNIX environment -variable and should be set on most UNIX systems. Comment lines are -signaled with a "#" sign, which is the standard UNIX comment sign as well. -$CSMDATA is used to denote the path to the inputdata directory for -your &cesm; data. - -> This is a shell prompt with commands \ -that continues to the following line. -> $EDITOR filename # means you are using a text editor to edit "filename" -# This is a comment line - - - - - - - - - - - &clmcn; - &clmsp; - - -What is new with &clmrel; since previous public releases? - -In this section we list the updates that have occurred to &clm4; since previous -public releases. In the first sections we describe changes in &clmrel; since the &ccsm4; release, -and in the last one we describe changes from &clm35; to &clm40; release. Note, that -the changes in the last section do NOT include the more recent changes given in the -first section, but only list the changes from &clm35; to the &clm40; release that -was part of the &ccsm4; public release. We will describe both the -changes in the science in the model as the software engineering changes. Software -engineering changes includes the configure and namelist changes, as well as the new -history fields. - - -What is new with &clmrel; since the December 8th, 2010 &cesm102; release? - - - -What is new with &clmrel; Science since &clmcesm102;? - -A prognostic crop model option was added in (based on Agro-IBIS) from work by -Samuel Levis. The crop model adds in four new vegetation types for: soybean, -winter and spring temperate cereals, and corn on their own separate columns. Winter -cereal was added as a PFT type, but doesn't exist in the input datasets, only -spring cereal is used. Winter cereal also has NOT been scientifically validated -or tested. The model manages these by modeling both planting and harvesting. See for an example of running with it. - - -An irrigation model was added from work by Samuel Levis and Bill Sacks. This -model takes water from runoff and adds it to the crop pfts for areas equipped -for irrigation. See for an example of running with it. -Please note that the irrigation model only works with the crop model active. - - - - -What is new with &clmrel; Software since &clmcesm102;? - -Since &clmcesm102; all Input/Output uses &pio; (Parallel Input/Output package). -Restart history files are now &netcdf;. Input and output files can be read/written -in parallel using PIO. We removed a list of old CPP defines and removed the -old misc/preproc.h files. Also a new tool for working with single-point sites was -added into the &cesm; scripts the Python tool &ptclm;. We have a complete chapter on it's use. - - -New configuration options: - --crop --noio - - - -Configuration options removed: - --dust --progsslt - - - -New build-namelist options: - --co2_ppmv --rtm_res --rtm_tstep - - - -New precedence for build-namelist options is... - -Values set on the command-line using the -namelist option -(&CLMNAMELIST;). -Values read from the file specified by -infile (&usernlclm; file). -Datasets from the -clm_usr_name option (&CLMUSRDAT;). -Values set from a use-case scenario, e.g., -use_case (&CLMUSECASE;). -Values from the namelist defaults file. - - - -Namelist options renamed: - -carbon_only => suplnitro (can be set to NONE or ALL) - - - -namelist options removed: - -carbon_only => suplnitro -scaled_harvest -hist_crtinic -hist_pioflag -ncd_lowmem2d -ncd_pio_def -ncd_pio_UseRearranger -ncd_pio_UseBoxRearr -ncd_pio_SerialCDF -ncd_pio_IODOF_rootonly -ncd_pio_DebugLevel -ncd_pio_num_iotasks - - - -New history fields: - -A5TMIN 5-day running mean of min 2-m temperature -(K) -A10TMIN 10-day running mean of min 2-m temperature -(K) -GDD0 Growing degree days base 0C from planting -(ddays) -GDD8 Growing degree days base 8C from planting -(ddays) -GDD10 Growing degree days base 10C from planting -(ddays) -GDD020 Twenty year average of growing degree days base 0C from planting -(ddays) -GDD820 Twenty year average of growing degree days base 8C from planting -(ddays) -GDD1020 Twenty year average of growing degree days base 10C from planting -(ddays) -GDDPLANT Accumulated growing degree days past planting date for crop -(ddays) -GDDHARV Growing degree days (gdd) needed to harvest -(ddays) -GDDTSOI Growing degree-days from planting (top two soil layers) -(ddays) -QIRRIG water added through irrigation -(mm/s) - - - -SNOWLIQ and SNOWICE changed from average to instantaneous output. - - - - -What was new with &clm4014; (in &cesm102;) since the September 17th, 2010 &cesm101; release? - -Since, &clm4010; in the &cesm101; release there were several developments made -to &clmrel;. Several new namelist items were added -a few new history fields. There were also some updates for -running the model with single-point mode. - - -Configuration options that were renamed: - -prog_seasalt => progsslt - - - -Namelist items removed: - -prog_seasalt => progsslt - - - -What was new with &clm4014; Science since &clm4010;? - -A long simulation at the course resolution of T31 (typically used for Paleo-climate -studies) was done and an spun-up initial condition file was provided for this -resolution (also by default the namelist variable ice_runoff was -turned off for T31). Also a new surface dataset and transient land-cover dataset was -provided for half-degree resolution. - - - -What was new with &clm4014; Software since &clm4010;? - -New configuration options - -sitespf_pt - - - -sitespf_pt is used for single-point/regional mode and is set to the site-name -that will be used (see the config_definition.xml for the -list of valid options). - - -Configuration options that were renamed: - -prog_seasalt => progsslt - - - -Namelist items removed: - -faerdep -fndepdat -fndepdyn -use_ndepstream - - - -Nitrogen deposition datasets are now only entered through the -ndepdyn_nml namelist (removing fndepdat, fndepdyn, and -use_ndepstream). Aerosol deposition is now a required input from -the atmosphere model, hence faerdep is removed. - - -New history fields: - -U10 10-m wind (m/s) -U10_DUST 10-m wind for dust model (m/s) -VA atmospheric wind speed plus convective velocity (m/s) -VOLR RTM storage: LIQ (m3) -VOLR_ICE RTM storage: ICE (m3) - - - - - - -What was new with &clm4010; (in &cesm101;) since the April 1st, 2010 &ccsm4; release? - -From, &clm40; in the &ccsm4; release to &clm4010; there were several developments made -to &clm;. A glacier multiple elevation class option was added that allows the -use of &clm4; with a glacier land ice model the Community Ice Sheet Model (CISM). -A bug-fix for the snow hydrology was added. Several new namelist items were added -a few new history fields. Also the capability of reading aerosol and nitrogen -deposition from stream files at one resolution and regridded on the fly rather than -with datasets at the model resolution was added in. This was important for higher -resolutions so that large datasets do not have to be created before running the model, -nor are datasets for every resolution required. - - -What was new with &clm4010; Science since &ccsm4;? - -In general, snow layers should not be thinner than - -dzmin = wice/rhoice + wliq/rholiq - -If dz < dzmin, then the value of "void" computed in subroutine -SnowCompaction is negative, which is unphysical. This doesn't cause -problems with the compaction itself, but results in unrealistic values -of vol_ice, vol_liq, and eff_porosity in subroutine SnowWater. We can -have vol_ice = 1 and vol_liq = 0 even when liquid is present, which cuts -off the runoff (qout) from the lowest snow layer. Liquid water then -accumulates in the snow column without draining, which leads to further -problems and eventually a code crash. - - -The solution to this problem was to adjust layer thickness dz for any water+ice content -changes in excess of previous layer thickness, e.g., - -dz(c,j) = max(dz(c,j),h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice) - -at appropriate steps in the snow hydrology subroutines. - - - -Snow hydrology bug fix. -Add multiple elevation class option for glaciers so can interact with -the land ice sheet model. - - - - -What was new with &clm4010; Software since &ccsm4;? - -New configuration options - -glc_nec - - - -glc_nec can be 1,3,5, or 10 and MUST match the number on the input surface dataset -the elevation classes themselves are read from the surface dataset - - -New namelist items: - -carbon_only -create_glacier_mec_landunit -glc_dyntopo -ice_runoff -ndepmapalgo -scaled_harvest - - - -carbon_only = If true, and CLMCN carbon-nitrogen model is on, Nitrogen is unlimited - rather than prognosed and vegetation will be over-productive (replaces the supplemental Nitrogen #ifdef) - - - create_glacier_mec_landunit (= T when these landunits are created; F by default) - - - glc_dyntopo (= T if &clm; topography changes dynamically; currently F) - (NOT fully implemented yet) - - -ice_runoff = If true, river runoff will be split up into liquid and ice streams, - otherwise ice runoff will be zero and all runoff directed to liquid stream - - - ndepmapalgo = Mapping method from Nitrogen deposition input file to the model - resolution (can be bilinear,nn,nnoni,nnonj,spval,copy, bilinear by default) - - -scaled_harvest = If true, harvesting will be scaled according to coefficients - determined by Johann Feddema, 2009 - - -New history fields: - -aais_area Antarctic ice area (km^2) -aais_mask Antarctic mask (unitless) -gris_area Greenland ice area (km^2) -gris_mask Greenland mask (unitless) -QICE ice growth/melt (mm/s) -QICEYR ice growth/melt (mm/s) -QTOPSOIL water input to surface (mm/s) -VOLR RTM storage: LIQ (m3) -VOLR_ICE RTM storage: ICE (m3) - - - - - - - -What was new with &clm40; since &clm35;? - - -From &clm35; to &clm40; there were advances in both the science and the software infrastructure. -There were also new configure and namelist options as well as new history fields. In this -section we will describe each of these changes in turn. - - - -What was new with &clm40; Science? - -The following aspects are changes to the science in &clm40; since &clm35;. - - -Biogeophysics and Hydrology - -Changes to &clm40; beyond &clm35; (Oleson et al., 2008a; Stockli et al., 2008) include -updates throughout the model. The hydrology scheme has been modified with a revised -numerical solution of the Richards equation (Zeng and Decker, 2009; Decker and Zeng, -2009); a revised soil evaporation parameterization that removes the soil resistance term -introduced in &clm35; and replaces it with a so-called &Bgr; formulation, as well as accounts for the role of litter and within- -canopy stability (Sakaguchi and Zeng, 2009). -&clm4; also includes a representation of the thermal and hydraulic properties of organic -soil that operates in conjunction with the mineral soil properties (Lawrence and Slater, -2008). The ground column has been extended to ~50-m depth by adding five additional -hydrologically inactive ground layers (making a total of 15 ground layers, 10 soil -layers and 5 bedrock layers; Lawrence et al., 2008). An urban landunit and associated -urban canyon model (&clmu;) has been added which permits the study of urban climate -and urban heat island effects (Oleson et al., 2008b). - - - - -Snow Model - -The snow model is significantly modified via incorporation of SNICAR (SNow and Ice Aerosol Radiation) which represents the effect of aerosol deposition (e.g. black and organic carbon and dust) on albedo, introduces a grain-size dependent snow aging parameterization, and permits vertically resolved snowpack heating (Flanner and Zender, 2005; Flanner and Zender, 2006; Flanner et al., 2007). The new snow model also includes a new density-dependent snow cover fraction parameterization (Niu and Yang, 2007), a revised snow burial fraction over short vegetation (Wang and Zeng, 2009) and corrections to snow compaction (Lawrence and Slater, 2009). - - - - -Surface Datasets - -The PFT distribution is as in Lawrence and -Chase (2007) except that a new cropping dataset is used (Ramankutty et al., 2008) and -a grass PFT restriction has been put in place to reduce a high grass PFT bias in -forested regions by replacing the herbaceous fraction with low trees rather than grass. -Grass and crop PFT optical properties have been adjusted according to values presented -in Asner et al. (1998), resulting in significantly reduced albedo biases. Soil colors -have been re-derived according to the new PFT distribution. - - - - -Biogeochemistry - -The model is extended with a carbon-nitrogen biogeochemical model (Thornton et al., 2007; -Thornton et al., 2009; Randerson et al., 2009) which is referred to as &clmcn;. CN is -based on the terrestrial biogeochemistry Biome-BGC model with prognostic carbon and -nitrogen cycle (Thornton et al., 2002; Thornton and Rosenbloom, 2005). &clmcn; is -prognostic with respect to carbon and nitrogen state variables in the vegetation, litter, -and soil organic matter. Vegetation phenology and canopy heights are also prognostic. A -detailed description of the biogeochemical component can be found in Thornton et al. -(2007). Note that &clm40; can be run with either prescribed satellite phenology -(&clmsp;) or with prognostic phenology provided by the carbon- nitrogen cycle model -(&clmcn;). Additionally, a transient land cover and land use change, including wood harvest, -capability has been introduced that enables the evaluation of the impact of historic and -future land cover and land use change on energy, water, and momentum fluxes as well as -carbon and nitrogen fluxes. The dynamic global vegetation model in &clm3; has been -revised such that the carbon dynamics (e.g. productivity, decomposition, phenology, -allocation, etc.) are controlled by CN and only the dynamic vegetation biogeography -(competition) aspect of the &clm3; DGVM is retained. -The biogenic volatile organic compounds model (BVOC) that was available in &clm3; has -been replaced with the MEGAN BVOC model (Heald et al. 2008). - - - - -Miscellaneous Changes - -Several other minor changes have been incorporated including a change to the atmospheric reference height so that it is the height above zo+d for all surface types. The convergence of -canopy roughness length zo and displacement height d to bare soil values as the -above-ground biomass, or the sum of leaf and stem area indices, goes to zero is ensured -(Zeng and Wang, 2007). Several corrections have been made to the way the offline forcing -data is interpreted. The main change is a vastly improved and smooth diurnal cycle of -incoming solar radiation that conserves the total incoming solar radiation from the -forcing dataset. Additionally, in offline mode rather than partitioning incoming solar -radiation into a constant 70%/30% direct vs diffuse split, it is partitioned according to -empirical equations that are a function of total solar radiation. Finally, to improve -global energy conservation in fully coupled simulations, runoff is split into separate -liquid and ice water streams that are passed separately to the ocean. Input to the ice -water comes from excess snowfall in snow-capped regions. - - - - -Summary of Science Changes - -Taken together, these augmentations to &clm35; in &clm40; result in improved soil moisture dynamics -that lead to higher soil moisture variability and drier soils. Excessively wet and -unvarying soil moisture was recognized as a deficiency in &clm35; (Oleson et al. 2008a, -Decker and Zeng, 2009). The revised model also simulates, on average, higher snow cover, -cooler soil temperatures in organic-rich soils, greater global river discharge, lower -albedos over forests and grasslands, and higher transition-season albedos in snow covered -regions, all of which are improvements compared to &clm35;. - - - - - -What is new with &clm40; Software Infrastructure? - -The following aspects are changes to the software infrastructure in &clm40; since &clm35;. - - - - Update to cpl7 and scripts. - Remove offline and cpl6 modes. - Remove support for CASA model. - Update to datm8 atmospheric data model. - Add gx3v7 land mask for T31 and fv-4x5 horizontal resolutions. - Add gx1v6 land mask for f05, f09, and f19 horizontal resolutions. - Add tx1v1 land mask and 1.9x2.5_tx1v1 horizontal resolution. - Add in 2.5x3.33 horizontal resolution. - Add in T62 horizontal resolution so can run at same resolution as input &datm; -data. - Allow first history tape to be 1D. - Add ability to use own version of input datasets with &CLMUSRDAT; -variable. - Add a script to extract out regional datasets. - New &buildnml; system with XML file describing all namelist -items. - Add glacier_mec use-case and stub glacier model. - Make default of maxpatch_pft=numpft+1 instead of 4. - Only output static 3D fields on first h0 history file to save space. - Add new fields for VOC (Volatile Organic Compounds) on surface datasets, - needed for the new MEGAN VOC model. - Add multiple elevation class option for glaciers in mksurfdata tool (NOT used -in &clm; yet). - Add ascale field to land model in support of model running on it's own -grid. - - - - - -What are The New Configuration Options in &clm40;? - -Describe any changes made to build system: - - - -Change directory structure to match &ccsm;. -Add BGP target. -Add choice between ESMF and MCT frameworks. -Start removing #ifdef and directives that supported Cray-X1 Phoenix as now -decommissioned. -Make default of maxpatch_pft=numpft+1 instead of 4 for all -configurations. -By default turn on CLAMP when either CN or CASA is enabled -New SNICAR_FRC, CARBON_AERO, and C13 CPP ifdef tokens. - - - - -New options added to &configure;: -More information on options to &clm; &configure; are given in . - - - - -OptionDescription --comp_intf <name>Component interface to use (ESMF or MCT) (default -MCT) --nofireTurn off wildfires for bgc setting of CN (default includes -fire for CN) --pio <name>Switch enables building with Parallel I/O library. [on -| off] (default is on) --snicar_frc <name>Turn on SNICAR radiative forcing calculation. [on | -off] (default is off) - -More information on options to &clm; &configure; are given in . - - - - -What are The New Namelist Options in &clm40;? - -&buildnml; now checks the validity of your namelist you generate by looking at data in -the namelist_definition.xml file. In order to add new namelist items you need to -change the code and also edit this file (e.g. a namelist option required for your -research project that is not currently an option in &clm40;). To view information -on the namelist view the -file: models/lnd/clm/bld/namelist_files/namelist_definition.xml -in a browser and you'll see the names, type, description and valid_values for all -namelist variables. - - -Changes to &buildnml;: - -Allow simulation year entered to include ranges of years (i.e. 1850-2000) -Remove cam_hist_case option. -Make sure options ONLY used for stand-alone testing have a "drv_" or "datm_" - prefix in them and list these options all together and last when asking for - help from &buildnml;. - - - - New option to &buildnml;: - - -clm_usr_name "name" Dataset resolution/descriptor for personal datasets. - Default: not used - Example: 1x1pt_boulderCO_c090722 to describe location, - number of pts, and date files created - - - - New list options to &buildnml; - - cd models/lnd/clm/bld - ./&buildnml; -res list # List valid resolutions - ./&buildnml; -mask list # List valid land-masks - ./&buildnml; -sim_year list # List valid simulation years and simulation year ranges - ./&buildnml; -clm_demand list # List namelist variables including those you could - # demand to be set. - ./&buildnml; -use_case list # List valid use-cases - - - - -New use-cases for &buildnml;: - - 1850_control = Conditions to simulate 1850 land-use - 2000_control = Conditions to simulate 2000 land-use -20thC_transient = Simulate transient land-use, aerosol and Nitrogen deposition - from 1850 to 2005 - - - - - New namelist items: - - urban_hac = OFF, ON or ON_WASTEHEAT (default OFF) Flag for urban Heating - and Air-Conditioning - OFF = Building internal temperature is un-regulated. - ON = Building internal temperature is bounded to reasonable range. - ON_WASTEHEAT = Building internal temperature is bounded and resultant waste - heat is given off. - urban_traffic = .true. or .false. Flag to include additional multiplicative - factor of urban traffic to sensible heat flux. - (default .false.) - fsnowoptics = filename file for snow/aerosol optical properties (required) - fsnowaging = filename file for snow aging parameters (required) - -More information on the &buildnml; options are given in -. -and in -&CLMBLDNML;. - - -More information on the &buildnml; options are given in in . - - - - -What are The New History Fields? - -New history variables: (note watt vs. W in units, 26 vs. 76) - - - - -NameLong-nameUnitsActive/Inactive -BCDEPtotal BC deposition (dry+wet) from -atmospherekg/m^2/s -BIOGENCObiogenic CO -fluxuGC/M2/H -C13_PRODUCT_CLOSSC13 total carbon loss from wood product -poolsgC13/m^2/s -DSTDEPtotal dust deposition (dry+wet) from -atmospherekg/m^2/s -EFLX_DYNBALdynamic land cover change conversion energy -fluxW/m^2 -FGR12heat flux between soil layers 1 and -2watt/m^2 -FSATfractional area with water table at -surfaceunitless -FSH_NODYNLNDUSEsensible heat flux not including correction for land use change - watt/m^2 -GC_HEAT1initial gridcell total heat -contentJ/m^2 -GC_HEAT2post land cover change total heat -contentJ/m^2inactive -GC_ICE1initial gridcell total ice -contentmm/s -GC_ICE2post land cover change total ice -contentmm/sinactive -GC_LIQ1initial gridcell total liq -contentmm -GC_LIQ2initial gridcell total liq content -mminactive -H2OSNO_TOPmass of snow in top snow -layerkg - HEAT_FROM_ACsensible heat flux put into canyon due to heat -removed from air conditioningwatt/m^2 -HKhydraulic -conductivitymm/sinactive -ISOPRENEisoprene fluxuGC/M2/H -LAND_USE_FLUXtotal C emitted from land cover conversion and -wood product poolsgC/m^2/s -LAND_UPTAKENEE minus LAND_USE_FLUX, negative for -updategC/m^2/s -LWupupwelling longwave -radiationwatt/m^2inactive -MONOTERPmonoterpene -fluxuGC/M2/H -NBPnet biome production, includes fire, landuse, and harvest -flux, positive for sinkgC/m^2/s -OCDEPtotal OC deposition (dry+wet) from -atmospherekg/m^2/s -OVOCother VOC fluxuGC/M2/H -ORVOCother reactive VOC -fluxuGC/M2/H -PBOTatmospheric pressurePa -PCO2atmospheric partial pressure of -&CO2;Pa -PRODUCT_CLOSStotal carbon loss from wood product -poolsgC/m^2/s -PRODUCT_NLOSStotal N loss from wood product -poolsgN/m^2/s -Qairatmospheric specific -humiditykg/kginactive -Qanthanthropogenic heat -fluxwatt/m^2inactive -Qtaumomentum fluxkg/m/s^2 -QFLX_LIQ_DYNBALliq dynamic land cover change conversion -runoff fluxmm/s -QFLX_ICE_DYNBALice dynamic land cover change conversion -runoff fluxmm/s -QRUNOFF_NODYNLNDUSEtotal liquid runoff not including correction for land use change (does not include QSNWCPICE) -mm/s -QSNWCPICEexcess snowfall due to snow -cappingmm/s -QSNWCPICE_NODYNLNDUSEexcess snowfall due to snow capping not including correction for land use change -mm/s -QSNWCPLIQexcess rainfall due to snow -cappingmm/sinactive -SMPsoil matric -potentialmminactive -SNOAERFRC2Lsurface forcing of all aerosols in snow, averaged only when snow is present (land) -watt/m^2 -SNOAERFRCLsurface forcing of all aerosols in snow -(land)watt/m^2 -SNOBCFRCLsurface forcing of BC in snow -(land)watt/m^2 -SNOBCMCLmass of BC in snow -columnkg/m2 -SNOBCMSLmass of BC in top snow -layerkg/m2 -SNOdTdzLtop snow layer temperature gradient -(land)K/m -SNODSTFRC2Lsurface forcing of dust in snow, averaged only when snow is present (land) -watt/m^2 -SNODSTFRCLsurface forcing of dust in snow -(land)watt/m^2 -SNODSTMCLmass of dust in snow -columnkg/m2 -SNODSTMSLmass of dust in top snow -layerkg/m2 -SNOFSRNDdirect nir reflected solar radiation from -snowwatt/m^2inactive -SNOFSRNIdiffuse nir reflected solar radiation from -snowwatt/m^2inactive -SNOFSRVDdirect vis reflected solar radiation from -snowwatt/m^2inactive -SNOFSRVIdiffuse vis reflected solar radiation from -snowwatt/m^2inactive -SNOFSDSNDdirect nir incident solar radiation on -snowwatt/m^2inactive -SNOFSDSNIdiffuse nir incident solar radiation on -snowwatt/m^2inactive -SNOFSDSVDdirect vis incident solar radiation on -snowwatt/m^2inactive -SNOFSDSVIdiffuse vis incident solar radiation on -snowwatt/m^2inactive -SNOLIQFLtop snow layer liquid water fraction -(land)fractioninactive -SNOOCMCLmass of OC in snow -columnkg/m2 -SNOOCMSLmass of OC in top snow -layerKg/m2 -SNOOCFRC2Lsurface forcing of OC in snow, averaged only when snow is present (land) -watt/m^2 -SNOOCFRCLsurface forcing of OC in snow -(land)watt/m^2 -SNORDSLtop snow layer effective grain -radiusm^-6inactive -SNOTTOPLsnow temperature (top -layer)K/minactive -SWupupwelling shortwave -radiationwatt/m^2inactive -TSOI_10CMsoil temperature in top 10cm of -soilK -URBAN_ACurban air conditioning -fluxwatt/m^2 -URBAN_HEATurban heating -fluxwatt/m^2 -VOCFLXTtotal VOC flux into -atmosphereuGC/M2/H -Windatmospheric wind velocity -magnitudem/sinactive -WOOD_HARVESTCwood harvest (to product -pools)gC/m^2/s -WOOD_HARVESTwood harvest (to product -pools)gN/m^2/s - - - - - History field name changes: - - -OldNew -ANNSUM_PLANT_NDEMAND= -ANNSUM_POTENTIAL_GPP -ANNSUM_RETRANSN= ANNMAX_RETRANSN -C13_DWT_PROD10C_LOSS= C13_PROD10C_LOSS -C13_DWT_PROD100C_LOSS= C13_PROD100C_LOSS -C13_DWT_PROD10N_LOSS= C13_PROD10N_LOSS -C13_DWT_PROD100C_LOSS= C13_PROD100C_LOSS -DWT_PROD100N_LOSS= PROD10N_LOSS -DWT_PROD100N_LOSS= PROD100N_LOSS -DWT_PROD100C_LOSS= PROD10C_LOSS -DWT_PROD100C_LOSS= PROD100C_LOSS -HCSOISNO= HC -TEMPSUM_PLANT_NDEMAND= -TEMPSUM_POTENTIAL_GPP -TEMPSUM_RETRANSN= TEMPMAX_RETRANSN - - - -History field names deleted include: SNOWAGE, TSNOW, FMICR, FCO2, DMI, QFLX_SNOWCAP - - - -Add new urban oriented _U, and _R (Urban and Rural) for the following history variables: -EFLX_LH_TOT, FGR, FIRA, FSH, FSM, Q2M, QRUNOFF, RH2M, SoilAlpha, TG, TREFMNAV, -TREFMXAV, and TSA (missing _R for SoilAlpha as the regular SoilAlpha is only defined -for rural areas anyway) - - - -We are missing the Rural soil-alpha variable: SoilAlpha_R on purpose. -SoilAlpha_U is only defined over pervious road, and missing everywhere else. -SoilAlpha is defined only for rural areas. - - - - - - - - - - - -Quickstart to using &clm4; - -Before working with &clm4; read the QuickStart Guide in the -&cesmrel; -Scripts User's Guide. Once you are familiar with how to setup cases for -any type of simulation with &cesm; you will want to direct your attention to the specifics -of using &clm;. - - -For some of the details of setting up cases for &clm4; read the README and text files available -from the "models/lnd/clm/doc" directory (see the "&clm; Web pages" section for a link to the list -of these files). Here are the important ones that you should be familiar with. - -README file describing the directory structure. -Quickstart.userdatasets file describing how to -use your own datasets in the model (also see ). -&KnownBugs; file describing known -problems in &clm4; (that we expect to eventually fix). -KnownLimitations file -describing known limitations in &clm4; and workarounds that we do NOT expect to -fix. - - -The IMPORTANT_NOTES file is given in the next chapter on what -is functional/validated in &clm4;? - -The ChangeLog/ChangeSum files are largely explained in the previous chapter on "What is new with -&clm4;?" - -Note other directories have README files that explain different components and tools used -when running &clm; and are useful in -understanding how those parts of the model work and should be consulted when using tools in those directories. -For more details on configuring and customizing a case with &clm; see . - -The Quickstart.GUIDE (which can be found in -models/lnd/clm/doc) is repeated here. - -&quickstart_guide; - - - - -What is scientifically validated and functional in &clm4;? - -In this section we go over what has been extensively tested and scientifically validated -with &clm4;, and maybe more importantly what has NOT been tested and may NOT be -scientifically validated. You can use all features of &clm;, but need to realize that -some things haven't been tested extensively or validated scientifically. When you use -these features you may run into trouble doing so, and will need to do your own work to -make sure the science is reasonable. - - - -Standard Configuration and Namelist Options that are Validated - -The standard version of the model is &clmcn; at 1-degree horizontal resolution (0.9x1.25). This version has been scientifically -validated with long simulations for: fully coupled simulations ("B" cases), coupled to -atmosphere model CAM ("F" cases), and stand-alone &clm; -cases ("I" cases). We've also done both long simulations for 1850 conditions, and transient 20th century simulations from 1850 to 2005 (with -transient land-use, Nitrogen and Aerosol deposition). There have also been transient -future scenario simulations done for fully coupled cases for different "representative -concentration pathway" (RCP) scenarios (RCP2.6, RCP4.5, RCP6.0, and RCP8.5). -To a lesser extent there have also -been simulations done at T31 and 2-degree horizontal -resolution (1.9x2.5), and with &clmsp; for these resolutions. As such we have provided -appropriate 1-degree, 2-degree, and T31 initial condition -datasets for these configurations. The irrigation and prognostic crop models were both -validated at 2-degree resolution. The irrigation model for &clmsp; for present day -conditions for an "I" compset, and the prognostic crop model for present day conditions -for a case coupled to the active land model, but using a data ocean model (an "F" -compset). Other resolutions, configurations, and namelist options are less well tested or scientifically validated. -The further you get away from the standard configurations and resolutions, the more likely you are to run into trouble, and/or need to -scientifically validate your work. - - -In the sections below we go through configuration and/or namelist options or modes that the user should be especially wary of using. You -are of course free to use these options, and you may find that they work functionally. Although in some cases you will find issues even -with functionality of using them. If so you will need to test, debug and find solutions for these issues on your own. But in every case -you will need to go through more extensive work to validate these options from a scientific standpoint. - - - - -Configure Modes NOT scientifically validated, documented, supported or, in some -cases, even advised to be used: - - - - - C13(-c13) -The C13 mode for bgc=cn is NOT scientifically validated or documented and is NOT -recommended for use. - - - - - - CASA(-bgc casa) -The bgc=casa mode is NOT scientifically validated or documented and is NOT -recommended for use. - - - - - - SNICAR_FRC(-snicar_frc) - This mode is tested and functional, but is NOT constantly scientifically validated, and should be - considered experimental. - - - - - - - -Namelist options that should NOT be exercised: - -Build-Namelist options that should NOT be exercised: - - --irrig with -bgc cn -We have only run the irrigation model with &clmsp; (i.e. without the CN model). We -recommend that if you want to run the irrigation model with CN, that you do a spinup. -But, more than that you may need to make adjustments to -irrig_factor in -models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90. See the -notes on this in the description of the irrigation model in the - -Technical Descriptions of the Interactive Crop Management and Interactive -Irrigation Models. - - --irrig with -crop on -Irrigation doesn't work with the prognostic crop model. Irrigation is only applied to -generic crop currently, which negates it's practical usage. We also have a known -problem when both are on (see bug 1326 in the &KnownBugs; file). -If you try to run in this mode, the &clm; &buildnml; will return with an error. - - --lnd_res: Fine-mesh mode, functional, but experimental - --rcp: Representative Concentration Pathway (RCP) -for future scenarios, functional for limited resolutions, but experimental - --datm_*: All options that start with "datm_" they are -only used for &clm; stand-alone testing. - --drv_*: All options that start with "drv_" they are -only used for &clm; stand-alone testing. - - - - - - -Namelist items that should NOT be exercised: - - -casa namelist options: lnpp, lalloc, q10, spunup, and fcpool - - CASA has NOT been scientifically validated in &clm4;. - - - - suplnitro='ALL' - The suplnitro namelist option to the CN Biogeochemistry model supplies -unlimited nitrogen and therefore vegetation is over-productive in this mode. - - - -urban_traffic: Not currently functional - - - - - - - - - -What are the UNIX utilities required to use &clm;? - -Running the &clm; requires a suite of UNIX utilities and programs and you should -make sure you have all of these available before trying to go forward with using -it. If you are missing one of these you should contact the systems administrator -for the machine you wish to run on and make sure they are installed. - -&FORTRAN90; compiler -"C" compiler -GNU make -UNIX csh and tcsh shells -UNIX sh shell -UNIX bash shell -UNIX awk -UNIX sed -&netcdf; library -MPI Library -"C" pre-processor -&perl; -Autoconf -m4 macro processor -Parallel &netcdf; (optional) -&ncl; (for some of the offline tools for creating/modifying &clm; input -datasets see for more information on &ncl;) -Python (optional, needed for &ptclm;) -xsltproc, docbook and docbook utilities (optional, needed to build the Users-Guide) -protex and latex2html (optional, needed to build the Code-Reference Guide) - - - - - - - - - &cesm; Online Bulletin Board - &cesmrel; Scripts User's Guide - - -Other resources to get help from - - -In addition to this users-guide there are several other resources that are available -to help you use &clm4;. The first one is the &cesm; User's-Guide, which documents the entire -process of creating cases with &cesm;. The next is the &cesm; bulletin board which is -a web-site for exchanging information between users of &cesm;. There are also &clm; -web-pages specific for &clm;, and finally there is an email address to report bugs that -you find in &cesm1;. - - - -The &cesm; User's-Guide - -&clmrel; is always run from within the standard &cesmrel; build and run scripts. Therefore, the -user of &clm4; -should familiarize themselves with the &cesmrel; scripts and understand how to work with them. -User's-Guide documentation on the &cesmrel; scripts are available from the following web-page. The purpose -of this &clmrel; User's Guide is to give the &clm4; user more complete details on how to work -with &clm; and the set of tools that support &clm;, as well as to give examples that are unique to the use -of &clm;. However, the &cesmrel; Scripts User's-Guide remains the primary source to get detailed -information on how to build and run the &cesm; system. - -&cesm1; Scripts -User's-Guide - - - - - -The &cesm; Bulletin Board - -There is a rich and diverse set of people that use the &cesm;, and often it is useful to be in contact with -others to get help in solving problems or trying something new. To facilitate this we have an online -Bulletin Board for questions on the &cesm;. There are also different sections in the Bulletin Board for -the different component models or for different topics. - -&cesm; Online Bulletin Board - - - - - -The &clm; web pages - -The main &clm; web page contains information on the &clm;, it's history, developers, as well as -downloads for previous model versions. There are also documentation text files in the -models/lnd/clm/doc directory that give some quick information on using &clm;. - -&clm; web page -&clm; Documentation Text Files - -Also note that several of the XML database files can be viewed in a web browser to get -a nice table of namelist options, namelist defaults, or compsets. Simply view them -as a local file and bring up one of the following files: - -models/lnd/clm/bld/namelist_files/namelist_definition.xml --- definition of &clm; namelist items. -models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- default values for &clm; namelist items. -scripts/ccsm_utils/Case.template/config_definition.xml --- definition of all env_*.xml items. -scripts/ccsm_utils/Case.template/config_compsets.xml --- definition of all the compsets. -models/lnd/clm/bld/namelist_files/history_fields.xml --- definition of &clm; history fields. - - - - - -Reporting bugs in &clm4; - -If you have any problems, additional questions, bug reports, or any other feedback, please send an email to -cesmhelp@cgd.ucar.edu. If you find bad, wrong, or misleading information - in this users guide send an email to erik@ucar.edu. The current list of -known issues for &clmrel; is in the &KnownBugs; file, and the list of issues for -&cesmrel; is at... - -&cesmwebmodelrel;/tags/cesm1_0_3/#PROBLEMS -. - - - - - - - - diff --git a/doc/UsersGuide/ptclm.xml b/doc/UsersGuide/ptclm.xml deleted file mode 100644 index 6c0ef2aec8..0000000000 --- a/doc/UsersGuide/ptclm.xml +++ /dev/null @@ -1,992 +0,0 @@ - - -How to run &ptclm; - -&ptclm; (pronounced point clime) is a Python script to help you set up PoinT CLM -simulations. It runs the &clm; tools for you to get datasets set up, and copies them -to a location you can use them according to the &CLMUSRDAT; naming convention. Then -it runs create_newcase for you and modifies the env settings and -namelist appropriately. &ptclm; has a simple ASCII text file for storing basic -information for your sites. We also have complete lists for AmeriFlux and Fluxnet-Canada -sites, although we only have the meteorology data for one site. For other sites you -will need to obtain the meteorology data and translate it to a format that the &cesm; -datm model can use. But, even without meteorology data &ptclm; is useful to setup -datasets to run with standard &CLMQIAN; data. - - - -The original authors of &ptclm; are: Daniel M. Ricciuto, Dali Wang, Peter E. Thornton, -Wilfred M. Post all at Environmental Sciences Division, Oak Ridge National Laboratory -(ORNL) and R. Quinn Thomas at Cornell University. It was then modified -fairly extensively by Erik Kluzek at &ncar;. We want to thank all of these individuals -for this contribution to the &cesm; effort. We also want to thank the folks at -University of Michigan Biological Stations (US-UMB) who allowed us to use their Fluxnet -station data and import it into our inputdata repository, especially Gil Bohrer the -PI on record for this site. - - - -Introduction to PTCLM - -To get help on &ptclm; use the "--help" option as follows. - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py --help - - - -The output to the above command is as follows: - - - -&ptclm_help; - - - - -Here we give a simple example of using &ptclm; for a straightforward case of running -at the US-UMB Fluxnet site on bluefire where we already have the meteorology data on -the machine. Note, see for permission information -to use this data. - -Example of running &ptclm; for US-UMB on bluefire - -setenv CSMDATA /fis/cgd/cseg/csm/inputdata -setenv MYCSMDATA $HOME/inputdata -setenv SITE US-UMB -setenv MYMACH bluefire -setenv MYCASE testPTCLM - -# First link the standard input files to a location you have write access -cd scripts -./link_dirtree $CSMDATA $MYCSMDATA - -# Next build all of the clm tools you will need -cd ../models/lnd/clm/tools/mksurfdata -gmake -gmake clean -cd ../mkdatadomain -gmake -gmake clean -cd ../mkgriddata -gmake -gmake clean -# next run PTCLM (NOTE -- MAKE SURE python IS IN YOUR PATH) -cd ../../../../../scripts/ccsm_utils/Tools/lnd/clm/PTCLM -./PTCLM.py -m $MYMACH --case=$MYCASE --site=$SITE --csmdata=$MYCSMDATA \ - --aerdepgrid --ndepgrid -# NOTE: we use --aerdepgrid --ndepgrid so that you use the global -# aerosol and Nitrogen deposition files rather than site-specific ones. -cd ../../../../../$MYCASE -# Finally configure, build, and run the case as normal - - - - - - -Guide to the options of &ptclm; - -There are three types of options to &ptclm;: required, configure/run-time, and -dataset generation options. The three required options are the three settings that -MUST be specified for &ptclm; to work at all. The other settings have default -values that will default to something useful. The configure/run-time options control -how the simulation will be setup and run. The dataset generation options control -the generation of datasets needed when &ptclm; is run. Most options use a double -dash "--" "longname" such as "--list", but the most common options also have a short-name -with a single dash (such as -m instead of --machine). - - -The required options to &ptclm; are: inputdata directory (-d), machine (-m) and -site-name (-s). Inputdata directory is the directory where you have the &cesm; -inputdata files, you need to have write access to this directory, so if you are -running on a machine that you do NOT have write access to the standard inputdata -location (such as &ncar; bluefire or ORNL jaguar) you need -to link the standard files to a location you do have control over. We recommend -using the scripts/link_dirtree tool to do that. "machine" is -the scripts name for the machine/compiler you will be using for your case. And -finally site-name is the name of the site that you want to run for. Site-name -can either be a valid &CLM1PT; supported dataset name or a Fluxnet site name -from the list of sites you are running on (see the --sitegroupname for more information -about the site lists). - - -After &ptclm; is run a case directory where you can then configure, build and run -your &cesm; case as normal. It also creates a README.PTCLM -in that directory that documents the commandline options to &ptclm; that were used -to create it. - - -After "help" the "list" option is one of the most useful options for getting -help on using &ptclm;. This option gives you information about some of the other -options to &ptclm;. To get a list of the machine, sites, and compsets that can be -used for &ptclm; use the "--list" option as follows. - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py --list - - - -The output to the above command is as follows: - - - -&ptclm_list; - - - - -Overview on using &ptclm; - -Steps in running &ptclm; - -Setup Inputdata directory with write access (use -<command>link_dirtree</command> script) - -You need to setup an inputdata directory where you have write access to it. -Normally, for &ncar; machines the data is on an inputdata where the user -does NOT have write access to it. A way that you can get around this is -to use the link_dirtree script to create softlinks from -the normal location to a location you have write access to. So for example -on bluefire: - -> setenv CSMDATA /fs/cgd/csm/inputdata -> setenv MYCSMDATA $HOME/inputdata -> mkdir $MYCSMDATA -> cd scripts -> ./link_dirtree $CSMDATA $MYCSMDATA - -See for more information on this. - - - -Build the &clm; tools - -Next you need to make sure all the &clm; &FORTRAN; tools are built. - -> cd models/lnd/clm/tools/mkgriddata -> gmake -> gmake clean -> cd ../mkdatadomain -> gmake -> gmake clean -> cd ../mksurfdata -> gmake -> gmake clean - - - - -Run &ptclm; - -Next you actually run &ptclm; which does the different things listed below: - - - -&ptclm; names your case based on your input - -&ptclm; names you case based on the input you give to it. - -[Prefix_]SiteCode_Compset[_QIAN][_spinuptype] -Where: - Prefix is from the caseidprefix option (or blank if not used). - SiteCode is the site name you entered with the -s option. - Compset is the compset name you entered with the -c option. - _QIAN is part of the name only if the useQIAN is used. - _spinuptype is part of the name if one of: ad_spinup, exit_spinup, or - final_spinup is used, and the exact spinup name chosen is used. - -For example, the casename for the following will be: - -> cd scripts -> ./PTCLM.py -m bluefire -s US-UMB -d $MYCSMDATA -c I_2000_CN --ad_spinup --useQIAN - -"US-UMB_I_2000_CN_QIAN_ad_spinup". - - - -&ptclm; creates datasets for you - -It will populate $MYCSMDATA with new datasets it creates using the -&clm; tools. - - - -If a transient compset and &ptclm; finds a <filename>_dynpftdata.txt</filename> -file - -If you are running a transient compset (such as the "I_1850-2000_CN" compset) -AND you there is a file in the PTCLM_sitedata directory under -the &ptclm; directory called $SITE_dynpftdata.txt it will use -this file for the land-use changes. Otherwise it will leave land-use constant, unless -you use the pftgrid option so it uses the global dataset for landuse changes. -See for more information on this. There -is a sample transient dataset called US-Ha1_dynpftdata.txt. -Transient compsets, are compsets that create transient land-use change and -forcing conditions such as: -'I_1850-2000', 'I_1850-2000_CN', 'I_RCP8.5_CN', 'I_RCP6.0_CN', 'I_RCP4.5_CN', -or 'I_RCP2.6_CN'. - - - -&ptclm; creates a <filename>pft-physiology</filename> for you - -&ptclm; will create a local copy of the pft-physiology -specific for your site that you could then customize with changes specific -for that site. - - - -&ptclm; creates a <filename>README.PTCLM</filename> for you - -&ptclm; will create a simple text file with the command line for it in a file -called README.PTCLM in the case directory it creates for you. - - - - - - -Customize, configure, build and run case as normal - -You then customize your case as you would normally. See the chapter for more information on doing this. - - - - - - - -Details on the options of &ptclm; - -Next we discuss the configure and run-time options, dividing them up into -configure, spinup, and run-time options. - - -Configure options include: - --c MYCOMPSET, --compset=MYCOMPSET ---caseidprefix=MYCASEID ---cesm_root=BASE_CESM ---namelist=NAMELIST ---rmold ---scratchroot=SCRATCHROOT ---sitegroupname=SITEGROUP ---QIAN_tower_yrs ---useQIAN - - - - - ---compset - -The "-c" option is the most commonly used option after the required options, as it -specifies the &cesm; scripts component set to use with &ptclm;. The default compset -is the "ICN" compset with CN on for present day conditions. - - - - - ---caseidprefix - -This option gives a prefix to include in the casename when the case is created, in -case you want to customize your casenames a bit. By default, casenames are figured -out based on the other options. The argument to this option can either be a name to -prefix casenames with and/or a pathname to include. Hence, if you want cases to -appear in a specific directory you can give the pathname to that directory with this -option. - - - - - ---cesm_root - -This option is for running &ptclm; with a different root directory to &cesm; than the -version &ptclm; exists in. Normally you do NOT need to use this option. - - - - - ---namelist - -This option adds any items given into the &clm; &usernlclm; namelist. This allows you to -add customizations to the namelist before the clm.buildnml.csh file -is created for the case. - - - - - ---rmold - -This option will remove an old case directory of the same name if one exists. Otherwise, -if an old case directory already exists and you try to run &ptclm; it will return with -an error. - - - - - ---scratchroot - -This option is ONLY valid when using one of the generic machines (the -m option). -This passed onto create_newcase and gives the location where cases -will be built and run. - - - - - ---sitegroupname - -In the &ptclm; directory there is a subdirectory "PTCLM_sitedata" that contains -files with the site, PFT and soil data information for groups of sites. These site groups -are all separate ASCII files with the same prefix followed by a "_*data.txt" name. -See for more information on these files. -By default we have provided three different valid group names: - -EXAMPLE -AmeriFlux -Fluxnet-Canada - -The EXAMPLE is the group used by default and ONLY includes the US-UMB site as that -is the only site we have data provided for. The other two site groups include the -site information for all of both the AmeriFlux and Fluxnet-Canada sites. You can use -the "sitegroupname" option to use one of the other lists, or you can create your own -lists using the EXAMPLE file as an example. Your list of sites could be real world -locations or could be theoretical "virtual" sites given to exercise &clm; on -differing biomes for example. Note, see with -permission information to use the US-UMB data. - - - - - ---useQIAN - -This option says to use the standard &clm; global Qian T62 atmospheric forcing rather -than any tower site forcing data available. Otherwise, &ptclm; will try to find tower -forcing data for the specific site entered. - - - - - ---QIAN_tower_yrs - -This option is used with the "useQIAN" option to set the years to cycle over for -the Qian data. In this case Qian atmospheric forcing will be used, but the -simulation will run over the same years that tower site is available for this site. - - - - - - -Spinup options include: - ---coldstart ---ad_spinup ---exit_spinup ---final_spinup ---finidat=FINIDAT - - - - -The spinup options enable the different CN spinup modes, but also set the run -length. The coldstart option says to startup with OUT an initial condition file, while -the finidat option explicitly gives the initial condition file to use. Obviously, -the different spinup options can NOT be used together, nor can the coldstart and -finidat options be either. - - ---coldstart - -This option ensures that a cold-start will be done with arbitrary initial conditions. - - - - - ---ad_spinup - -This option enables the accelerated decomposition mode when a CN compset is used. It -also sets the run-length as given in the example for running exit spinup in -. - - - - - ---exit_spinup - -This option enables the exit spinup mode when a CN compset is used. It also sets the -run-length to a year just as given in the example for running exit spinup in -. - - - - - ---final_spinup - -This option sets the run length as given in the example for a final spinup in -. This option can be used for any compset. - - -There is a bug in the final_spinup mode for setting the run length. Because of the -bug, final_spinup mode only runs for a very short time, you'll need to edit -the run length by hand to be 50 years. See bug 1367 in the &KnownBugs; file. - - - - - - - ---finidat - -This option sets the initial condition file to startup the simulation from. - - - - - - - - - -Run-time options include: - ---debug ---run_n=MYRUN_N ---run_units=MYRUN_UNITS ---stdurbpt - - - - - - - ---debug - -This option tells &ptclm; to echo what it would do if it were run, but NOT actually -run anything. So it will show you the dataset creation commands it would use. -It does however, run create_newcase, but then it only displays -the xmlchange commands and changes that it would do. Also note -that if you give the "--rmold" option it won't delete the case directory beforehand. -Primarily this is intended for debugging the operation of &ptclm;. - - - - - ---run_n - -This option along with run_units is used to set the length for the simulation. "run_n" -is the number of units to use. -The default run length depends on the site, compset, -and configuration and for example if a "spinup" option is selected. - - - - - ---run_units - -This option is the units of time to use for the length of the simulation. It is used -along with "run_n" to set the length of the simulation. -The default run length depends on the site, compset, -and configuration and for example if a "spinup" option is selected. - - - - - ---stdurbpt - -This option turns on the "stdurbpt_pd" use-case for &CLMUSECASE;. This option -can NOT be used for compsets that set the use-case to something besides present-day. - - - - - - - - -Lastly we discuss the dataset generation options. The dataset generation options are: - ---aerdepgrid ---ndepgrid ---pftgrid ---soilgrid ---nopointdata ---owritesrfaer - - - - -The options that with a "grid" suffix all mean to create datasets using the global -gridded information rather than using the site specific point data. By default the -site specific point data is used. The "nopointdata" and "owritesrfaer" options have to -do with file creation. - - -Because supported single-point datasets already have the data created for them, you -MUST use the "nopointdata" and "ndepgrid" options when you are using a supported -single-point site. You must use "ndepgrid" even for a compset without CN. You also -can NOT use the options: "soilgrid", "pftgrid", "aerdepgrid", or "owritesrfaer". - - - - - ---aerdepgrid - -This option says to use the aerosol deposition files from the global dataset rather -than creating an interpolated version. - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - ---ndepgrid - -This option says to use the Nitrogen deposition files from the global dataset rather -than creating an interpolated version. This is only needed for compsets with CN. - - - -This option is required when you you are using a site that -is a supported single point dataset. This is true even when you are NOT using a -compset with CN. - - - - - - ---pftgrid - -This option says to use the PFT values provided on the global dataset rather than -using the specific site based values from the -PTCLM_sitedata/*_pftdata.txt file when creating the surface dataset. - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - ---soilgrid - -This option says to use the soil values provided on the global dataset rather than -using the specific site based values from the -PTCLM_sitedata/*_soildata.txt file when creating the surface dataset. - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - ---nopointdata - -This option says to NOT create any input datasets -- assume this step has already been -done. If datasets weren't already created, your case will fail when you try to run it. -In general the first time you run &ptclm; for a new site you want it to generate new -datasets, but the next time and future times you want to use this option so that it -doesn't waste a lot of time rebuilding datasets over again. - - - -This option is required when you you are using a site that -is a supported single point dataset. - - - - - - ---owritesrfaer - -This option says to overwrite any surface and/or aerosol deposition datasets that -were already created. Otherwise, the creation of these files will be skipped if a file -is already found (but it WILL create files if they don't exist). - - -This option must NOT be used when you you are using a site that -is a supported single point dataset. - - - - - - - - -Note on the aerosol and Nitrogen deposition files. When the "aerdepgrid" and "ndepgrid" -options are NOT used -- aerosol and Nitrogen deposition files will be created by -interpolating from the global datasets. However, after these interpolated files -are created you could customize them for your site with data that you provide. You -could then write protect the files and use the "nopointdata" option so that &ptclm; -doesn't try to overwrite them in the future. - - - - - - -Examples using &ptclm; - -Now let's give a few more complex examples using some of the options we have -discussed above. - - -In this first example, we'll demonstrate using a supported single point dataset, -which then requires using the "nopointdata" and "ndepgrid" options. We'll also -demonstrate the compset option, "stdurbpt" and "caseidprefix" options. - -Example of running &ptclm; for the Mexicocity supported single point -dataset - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py -m bluefire -s 1x1_mexicocityMEX -d $CSMDATA --nopointdata --ndepgrid \ ---stdurbpt -c I --caseidprefix `pwd`/myPTCLMcases/site -> cd myPTCLMcases/site_1x1_mexicocityMEX_I -> ./configure -case -# Now build and run normally -> ./site_1x1_mexicocityMEX_I.bluefire.build -# Here we show running interactively -> ./site_1x1_mexicocityMEX_I.bluefire.run - - - - - -Now, let's demonstrate using a different group list, doing a spinup, running with Qian -global forcing data, but using tower years to set the years to run over. This uses -the options: sitegroupname, ad_spinup, useQIAN, and QIANtower_years. - -Example of running &ptclm; for a spinup simulation with Qian data for tower years. - - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -> ./PTCLM.py -m bluefire -s US-Ha1 -d $CSMDATA --sitegroupname AmeriFlux \ ---ad_spinup --useQIAN --QIAN_tower_yrs -> cd ../../../../../US-Ha1_ICN_QIAN_ad_spinup -> ./configure -case -# Now build and run normally -> ./US-Ha1_ICN_QIAN_ad_spinup.bluefire.build -# Here we show running interactively -> ./US-Ha1_ICN_QIAN_ad_spinup.bluefire.run - - - - - -Finally, let's demonstrate using a generic machine (which then requires the scratchroot -option), using the global grid for PFT and soil types, and setting the run length -to two months. - -Example of running &ptclm; on a generic machine with global PFT and soil types -dataset - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -# Note, see the with permission information -# to use the US-UMB data. -> ./PTCLM.py -m generic_darwin_intel -s US-UMB -d $CSMDATA --pftgrid --soilgrid \ ---scratchroot $HOME --run_n 2 --run_units nmonths -> cd ../../../../../US-UMB_ICN -> ./configure -case -# Now build -> ./US-UMB_ICN.generic_darwin_intel.build -# To get the files from the svn server... -# First list the files from the streams text file -> ../ccsm_utils/Tools/listfilesin_streams \ --t $HOME/US-UMB_ICN/run/clm1PT.1x1pt_US-UMB.stream.txt -l \ -> Buildconf/datm.input_data_list -# And now run the script to export data to your machine -> ../ccsm_utils/Tools/check_input_data -export -# Here we show running interactively -> ./US-UMB_ICN.generic_darwin_intel.run - - - - -Because of Bug 1364, when running this case as above we get a floating point -error after reaching time-step 124 for the example exactly as above. Other -machines or compilers probably won't have this problem. See the &KnownBugs; file -for more information on this problem. - - - - -As documented in Bug 1368, spinning up the US-UMB site for a I2000CN compset gives -zero Gross Primary Production (GPP). If the user wishes to use this site for &clmcn;, -they'll need to address this issue. -See the &KnownBugs; file for more information on this problem. - - - - - - -Adding data for use by &ptclm; - -&ptclm; Group Site Lists - -The "sitegroupname" option to &ptclm; looks for groups of sites in the -files in the PTCLM_sitedata directory under the &ptclm; directory. -You can add new names available for this option including your own lists of sites, by -adding more files in this directory. There are three files for each "sitegroupname": -$SITEGROUP_sitedata.txt, -$SITEGROUP_soildata.txt -and $SITEGROUP_pftdata.txt (where $SITEGROUP is the name that would -be entered as "sitegroupname" to &ptclm;). Each file needs to have the same list of sites, -but gives different information: site data, PFT data, and soil data respectively. -Although the site codes need to be the same between the three files, the files do NOT -have to be in the same order. Each file has a one-line header that lists the contents -of each column which are separated by commas. The first column for each of the files -is the "site_code" which must be consistent between the three files. The site code -can be any unique character string, but in general we use the AmeriFlux site code. - - -Site data file: $SITEGROUP_sitedata.txt): The header for -this file is: - -site_code,name,state,lon,lat,elev,startyear,endyear,alignyear - -The columns: name, state, and elevation are informational only. Name is a longer -descriptive name of the site, and state is the state for U.S. sites or country -for non U.S. sites. The columns: lon and lat are the longitude and latitude of -the location in decimal degrees. The last three columns are the start and ending -year for the data and the align year for an 1850 case for the data. The align year -is currently unused. - - -Soil data file: $SITEGROUP_soildata.txt): The header for this -file is: - -site_code,soil_depth,n_layers,layer_depth,layer_sand%,layer_clay% - -The first three fields after "site_code" are currently unused. The only two that -are used are the percent sand and clay columns to set the soil texture. - - -PFT data file: $SITEGROUP_pftdata.txt): The header for this -file is: - -site_code,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5 - -This file gives the vegetation coverage for the different vegetation types for the site. -The file only supports up to five PFT's at the same time. The columns with "pft_f" are -the fractions for each PFT, and the columns with "pft_c" is the integer index of the -given PFT. Look at the pft-physiology file to see what the PFT index for each PFT type -is. - - - - -Dynamic Land-Use Change Files for use by &ptclm; - -There is a mechanism for giving site-specific land-use change in &ptclm;. Adding -site specific files to the PTCLM_sitedata directory under -&ptclm; allows you to specify the change in vegetation and change in harvesting -(for the CN model) for that site. Files are named: -$SITE_dynpftdata.txt. There is a sample file for the US-Ha1 -site called: US-Ha1_dynpftdata.txt. The file has a one-line -header with the information that the file has, and then one-line for each year -with a transition. The header line is as follows: - -trans_year,pft_f1,pft_c1,pft_f2,pft_c2,pft_f3,pft_c3,pft_f4,pft_c4,pft_f5,pft_c5,har_vh1,har_vh2,har_sh1,har_sh2,har_sh3,graze,hold_harv,hold_graze - -This file only requires a line for each year where a transition or harvest happens. As -in the "pftdata" file above "pft_f" refers to the fraction and "pft_c" refers to the -PFT index, and only up to five vegetation types are allowed to co-exist. The last -eight columns have to do with harvesting and grazing. The last two columns are whether -to hold harvesting and/or grazing constant until the next transition year and will -just be either 1 or 0. This file will be converted by the -PTCLM_sitedata/cnvrt_trnsyrs2_landuse_timeseries_txtfile.pl script in the &ptclm; -directory to a format that mksurfdata can read that has an entry -for each year for the range of years valid for the compset in question. - - - - -Converting AmeriFlux Data for use by &ptclm; - -AmeriFlux data comes in comma separated format and is available from: - -http://public.ornl.gov/ameriflux/dataproducts.shtml. Before you -download the data you need to agree to the usage terms. - - -Here is a copy of the usage terms from the web-site on June/13/2011. - - -"The AmeriFlux data provided on this site are freely available and were furnished by -individual AmeriFlux scientists who encourage their use. Please kindly inform the -appropriate AmeriFlux scientist(s) of how you are using the data and of any publication -plans. Please acknowledge the data source as a citation or in the acknowledgments if the -data are not yet published. If the AmeriFlux Principal Investigators (PIs) feel that they -should be acknowledged or offered participation as authors, they will let you know and we -assume that an agreement on such matters will be reached before publishing and/or use of -the data for publication. If your work directly competes with the PI's analysis they may -ask that they have the opportunity to submit a manuscript before you submit one that uses -unpublished data. In addition, when publishing, please acknowledge the agency that -supported the research. Lastly, we kindly request that those publishing papers using -AmeriFlux data provide preprints to the PIs providing the data and to the data archive at -the Carbon Dioxide Information Analysis Center (CDIAC)." - - -The above agreement applies to the "US-UMB" dataset imported into our repository as -well, and Gil Bohrer is the PI on record for that dataset. - - -The &cesm; can NOT handle missing data, so we recommend using the "Level 4" Gap filled -datasets. -The fields will also need to be renamed. The "WS" column becomes "WIND", "PREC" becomes -"PRECmms", "RH" stays as "RH", "TA" becomes "TBOT", "Rg" becomes "FSDS", "Rgl" becomes -"FLDS", "PRESS" becomes "PSRF". "ZBOT" can just be set to the constant of "30" (m). -The units of Temperature need to be converted from "Celsius" to "Kelvin" (use the -value in SHR_CONST_TKFRZ in the file -models/csm_share/shr/shr_const.F90 of 273.15. -The units of Pressure also need to be converted from "kPa" to "Pa". LATIXY, and -LONGXY should also be set to the latitude and longitude of the site. - - - -&ptclm; transient example over a shorter time period - - -Example of running &ptclm; for transient land-use 1991-2006 for US-Ha1 on bluefire - -This is an example of using &ptclm; for Harvard Forest (AmeriFlux site code US-Ha1). In -order to do this we would've needed to have converted the AmeriFlux data into &netcdf; -format as show in the section above. Also note -that this site has a site-specific dynamic land-use change file for it -PTCLM_sitedata/US-Ha1_dynpftdata.txt in the &ptclm; directory -and this file will be used for land-use change and harvesting rather than the -global dataset. - - -> cd scripts/ccsm_utils/Tools/lnd/clm/PTCLM -# We are going to use forcing data over 1991 to 2006, but we need to start with -# a transient compset to do so, so we use the 20th Century transient: 1850-2000 -# Note: When creating the flanduse_timeseries dataset for this site it will use the -# PTCLM_sitedata/US-Ha1_dynpftdata.txt -# file for land-use change and harvesting -> ./PTCLM.py -m bluefire -s US-Ha1 -d $MYCSMDATA --sitegroupname AmeriFlux \ --c I_1850-2000_CN -> mkdir $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 -> cd $MYCSMDATA/atm/datm7/CLM1PT_data/1x1pt_US-Ha1 -# Copy data in &netcdf; format to this directory, filenames should be YYYY-MM.nc -# The fieldnames on the file should be: -# FLDS,FSDS,LATIXY, LONGXY, PRECTmms,PSRF,RH,TBOT,WIND,ZBOT -# With units -# W/m2,W/m2,degrees_N,degrees_E,mm/s, Pa, %, K, m/s, m -# The time coordinate units should be: days since YYYY-MM-DD 00:00:00 -> cd ../../../../../US-Ha1_I_1850-2000_CN -# We need to turn cold-start on, so it doesn't expect an initial condition file -# preferably, you would generate your own initial condition file and then use -# the --finidat option to &ptclm; to enter it -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -# Now we need to set the start date to 1991, and have it cycle forcing data -# over 1991 to 2006 -> ./xmlchange -file env_conf.xml -id RUN_STARTDATE -val 1991-01-01 -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_ALIGN -val 1991 -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_END -val 2006 -> ./xmlchange -file env_conf.xml -id CLM_NAMELIST_OPTS -val \ -# Similarly for Nitrogen deposition data we cycle over: 1991 to 2006 -"model_year_align_ndep=1991,stream_year_first_ndep=1991,stream_year_last_ndep=2006" -# Now configure the case, and we'll edit the datm namelist for prescribed aerosols -> ./configure -case -# We also need to change the datm to run with aerosols over the 1991-2006 period -cat << EOF > patch.diff -*** datm.buildnml.csh.orig 2011-06-14 09:28:20.000000000 -0600 ---- datm.buildnml.csh 2011-06-14 09:28:57.000000000 -0600 -*************** -*** 32,38 **** - dataMode = 'CLMNCEP' - domainFile = '$DOMAINFILE' - streams = 'clm1PT.1x1pt_US-Ha1.stream.txt 1991 1991 2006 ', -! 'presaero.stream.txt 1849 1849 2006' - vectors = 'null','null' - mapmask = 'nomask','nomask' - mapalgo = 'nn','nn' ---- 32,38 ---- - dataMode = 'CLMNCEP' - domainFile = '$DOMAINFILE' - streams = 'clm1PT.1x1pt_US-Ha1.stream.txt 1991 1991 2006 ', -! 'presaero.stream.txt 1991 1991 2006' - vectors = 'null','null' - mapmask = 'nomask','nomask' - mapalgo = 'nn','nn' -EOF -# Apply the above patch to the datm build namelist file -> patch Buildconf/datm.buildnml.csh patch.diff - - - - - - -Because of bug 1361, this won't work out of the box. You'll need to add the change -to PTCLM.py given in the KnownBugs file on this issue. - - - - - - - - -A bit about the structure of &ptclm;, what it does, and how it works - -A large part of &ptclm; just sets up the different options and does error checking -on the options given. &ptclm; then uses the options provided to use -create_newcase to create a new case. It then queries both the -case directory and/or the XML database (using -queryDefaultNamelist.pl in models/lnd/clm/bld -and does other settings for the case. It then runs the different &clm; tools in turn to -create the necessary datasets and points to them in the case with the &CLMUSRDAT; option. -It runs mkgriddata, mksurfdata.pl, and -mkdatadomain as well as the aerdepregrid.ncl and -ndepregrid.ncl &ncl; scripts. mkgriddata and -mkdatadomain have template namelist files in the -scripts/ccsm_utils/Tools/lnd/clm/PTCLM/usr_files directory. -When running mksurfdata.pl if it finds a -$SITE_dynpftdata.txt in the -scripts/ccsm_utils/Tools/lnd/clm/PTCLM/PTCLM_sitedata directory -it will use that file for transient landuse changes (there's a sample file for -"US-Ha1" called US-Ha1_dynpftdata.txt). -It modifies the different env*.xml using -xmlchange and creates an initial &usernlclm; filename. After -&ptclm; is run you can then make changes to the case by hand, and configure, build -and run as normal. - - -There is a simple test script to test &ptclm;. See -for more information on using it. - - - - - diff --git a/doc/UsersGuide/single_point.xml b/doc/UsersGuide/single_point.xml deleted file mode 100644 index b07f76ecb6..0000000000 --- a/doc/UsersGuide/single_point.xml +++ /dev/null @@ -1,930 +0,0 @@ - - - -How to run Single-Point/Regional cases - -The &clm; also allows you to set up and run cases with a single-point or a local region as well -as global resolutions. This is often useful for running quick cases for testing, evaluating -specific vegetation types, or land-units, or running with observed data for a specific site. -There are four different ways to do this: &PTSMODE;, -&CLM1PT;, &CLMUSRDAT;, and with &ptclm;. - -&PTSMODE; -- to run for a single point -using global datasets. -&CLM1PT; -- to run for a supported single-point -or regional dataset. -&CLMUSRDAT; -- to run using your own datasets (single-point -or regional). -&ptclm; -- to easily setup simulations to run for -tower sites.. - - - - -&PTSMODE; and &ptclm; only work for a single point, while the other two options can -also work for regional datasets as well. - - - -Which Single Point Option Should I choose? - -In general is the quick and dirty method -that gets you started without having to create datasets -- but has limitations. It's -good for an initial attempt at seeing results for a point of interest, but since you -can NOT restart with it, it's usage is limited. It is the quickest method as you can -create a case for it directly from create_newcase. Although you -can't restart, running a single point is very fast, and you can run for long -simulation times even without restarts. If you need restarts a good solution is to use -getregional_datasets.pl and &CLMUSRDAT; -which can get you running almost as quickly as well as -&PTSMODE;. Like -&PTSMODE; - only runs for points that exist within -a global dataset. - - -Running &CLM1PT; is a great solution, if one of the supported -single-point/regional datasets, is your region of interest (see -). All the datasets are -created for you, and you can easily select one and run, pretty much, out of the box -with it. The problem is that there is a very limited set of supported datasets. You -can also use this method for your own datasets, but you have to create the datasets, -and add them to the XML database and to the &datm;. This is worthwhile if you want to -repeat many multiple cases for a given point or region. - - -Next, &CLMUSRDAT; is the best way to setup cases quickly -where you have to create your own datasets (see -). With this method you don't have to -change &datm; or add files to the XML database -- but you have to follow a strict -naming convention for files. However, once the files are named and in the proper -location, you can easily setup new cases that use these datasets. This is good -for treating all the required datasets as a "group" and for a particular -model version. For advanced &clm; developers who need to track dataset changes with -different model versions you would be best off adding these datasets as supported -datasets with the &CLM1PT; method. - - -Lastly &ptclm; is a great way to easily create datasets, -setup simulations and run simulations for tower sites. It takes advantage of both -&CLM1PT; and &CLMUSRDAT; internally. A big advantage to it, is that it's one-stop -shopping, it runs tools to create datasets, and runs create_newcase -and sets the appropriate env variables for you. So you only have to learn how to run -one tool, rather than work with many different ones. &ptclm; is described in the next -chapter . - - -Finally, if you also have meteorology data that you want to force your &clm; simulations -with you'll need to setup cases as described in . -You'll need to create &clm; datasets either according to &CLM1PT; -or &CLMUSRDAT;, but you'll also need to modify &datm; to use -your forcing data. And you'll need to change your forcing data to be in a format that -&datm; can use. In the &ptclm; chapter the -section tells you how to use AmeriFlux data for atmospheric forcing. - - - - -Running &PTSMODE; configurations - -&PTSMODE; enables you to run the model using global datasets, but just picking a -single point from those datasets and operating on it. It can be a very quick way to do fast -simulations and get a quick turnaround. - - -To setup a &PTSMODE; simulation you use the "-pts_lat" and "-pts_lon" -arguments to create_newcase to give the latitude and longitude of the point you want to -simulate for (the code will pick the point on the global grid nearest to the point you -give. Here's an example to setup a simulation for the nearest point at 2-degree resolution -to Boulder Colorado. - -> cd scripts -> ./create_newcase -case testPTS_MODE -res f19_g16 -compset I -mach bluefire \ --pts_lat 40.0 -pts_lon -105 -> cd testPTS_MODE -# We make sure the model will start up cold rather than using initial conditions -> ./xmlchange -file env_conf.xml -id &CLMFORCECOLD; -val on -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup - -Then configure, build and run as normal. We make sure initial conditions are NOT used -since &PTSMODE; currently CAN NOT run with initial conditions. - - - -By default it sets up to run with -USE_MPISERIAL (in the env_build.xml file) turned on, -which allows you to run the model interactively. On some machines this mode is NOT -supported and you may need to change it to FALSE before you are able to build. - - - - -&PTSMODE; currently does NOT restart nor -is it able to startup from global initial condition files. See bugs "1017 and 1025" -in the KnownLimitations file. - - - - -You can change the point you are simulating for at run-time by changing the values of -PTS_LAT and PTS_LON in the env_run.xml file. - - - - -Note, that when running with &PTSMODE; the number of processors -is automatically set to one. When running a single grid point you can only use a single -processor. You might also want to set the "env_conf" variable: USE_MPISERIAL to -TRUE so that you can also run interactively without having to use -&mpi; to start up your job. - - - - -Warning about Running with a Single-Processor on a Batch Machine - -This problem always comes up when running for a single point, because you can only use -a single-processor, but may come up in other instances when you are running with -one processor. This applies to all the different ways of running in single-point mode. - - - -A warning for submitting single-point simulations to the batch que when only using -one processor. On many machines this will mean using up at least an entire node, and -being charged for all the CPU's on that node even if you aren't using them. For example, -on the &ncar; machine bluefire, there are 32 processors for each node -and the batch scripts are setup to have exclusive use of that node (and hence be charged -for all 32 processors). There are similar issues on other machines, below we show you -what to do when running on bluefire. - - -To change this on bluefire -- change the following: - -#BSUB -q regular -#BSUB -N -#BSUB -x - -to... - -#BSUB -q share -#BSUB -N - -so remove the "#BSUB -x" which gives you the entire node exclusively, and change to the -share que. One other machines you may have to do something similar, but the particulars -depend on the given machine, hence you will need to consult with the system -administrators for the given machine you are running on. - - - - -Another similar problem on many machines is that some batch ques have a minimum number -of nodes or processors that can be used. On these machine you may have to change the -queue (in some way similar to the above for bluefire) and possibly the time-limits of -the job, to get it to run in the batch que. - - - -Another way to get around this problem is to run the job interactively using -USE_MPISERIAL so that you don't submit the job to the batch que. -For single point mode you also may want to consider using a smaller workstation or -cluster, rather than a super-computer, because you can't take advantage of the -multi-processing power of the super-computer anyway. - - - - -Running Supported Single-point/Regional Datasets - -In addition to &PTSMODE; the &clm; supports running using single-point or -regional datasets that are customized to a particular region. In the section below we -tell the user how to create their own dataset, but we also support a small number of -single-point and regional datasets that are ready to setup and run in the CESM modeling -system. - - -To get the list of supported dataset resolutions see the method given in the -section on use of &CLM1PT;, which results in the following: - -&res_list; - -The resolution names that have an underscore in them ("_") are all single-point or -regional resolutions. -To run with the supported single-point and regional datasets, you setup a simulation for the -"pt1_pt1" resolution and give the short-name for the file to use in the -env_conf.xml file. - - -To run for the Brazil test site -do the following: - -Example of running &clm; over a single-point test site in Brazil -with the default Qian atmosphere data forcing. - - -> cd scripts -> ./create_newcase -case testSPDATASET -res pt1_pt1 -compset I \ --mach bluefire -> cd testSPDATASET -# Configure to run for the test site -> set SITE=1x1_brazil -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-sitespf_pt $SITE" -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $SITE - - - - -Then configure, build and run normally. - - -Then to run for the urban Mexico City Mexico test site that also has atmosphere -forcing data, but to run it with the Qian forcing data, but over the period for -which it's own forcing data is provided do the following: - -Example of running &clm; over the single-point of Mexicocity Mexico -with the default Qian atmosphere data forcing. - - -> cd scripts -> ./create_newcase -case testSPDATASET -res pt1_pt1 -compset I \ --mach bluefire -> cd testSPDATASET -# Set a variable to the site you want to use (as it's used several times below) -> set SITE=1x1_mexicocityMEX -# Configure to run for the urban test site -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-sitespf_pt $SITE" -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $SITE -# Set &datm; prescribed aerosols to single-point dataset -# Will then use the dataset with just the point for this $SITE -> ./xmlchange -file env_conf.xml -id DATM_PRESAERO -val pt1_pt1 -# -# Set some of the settings that are particular to this site, by values contained -# in the XML database. For some sites, or for new sites this information won't be -# stored. And the queryDefaultNamelist.pl command will abort. -# -# Set &datm; start and end range (optional just to run over the same years that -# atmospheric forcing data is available for this site) -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_START -val \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_beg_year -justvalue` -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_END -val \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_end_year -justvalue` - - - - -Then configure, build and run normally. - - - -Just like &PTSMODE; above, By default it sets up to run with -USE_MPISERIAL (in the env_build.xml file) turned on, -which allows you to run the model interactively. On some machines this mode is NOT -supported and you may need to change it to FALSE before you are able to build. - - - - -See for a warning about running single-point jobs -on batch machines. - - - - -Note, that when running a pt1_pt1 resolution the number of processors -is automatically set to one. When running a single grid point you can only use a single -processor. You might also want to set the "env_conf" variable: USE_MPISERIAL to -TRUE so that you can also run interactively without having to use -mpi to start up your job. - - - -Running Supported Single-point Datasets that have their own Atmospheric Forcing - -Of the supported single-point datasets we have three that also have atmospheric forcing data -that go with them: Mexico City (Mexico), Vancouver, (Canada, British Columbia), and -urbanc_alpha (test data for an Urban inter-comparison project). Mexico city and Vancouver -also have "#ifdef" in the source code for them to work with modified urban data -parameters that are particular to these locations. They can be turned on by using -the &CLMCONFIG; &envconf; variable to set the "-sitespf_pt" option in the &clm; -&configure;. To turn on the atmospheric forcing for these datasets, you set the -&envconf; DATM_MODE variable to "CLM1PT", and then the atmospheric -forcing datasets will be used for the point picked. - - -When running with datasets that have their own atmospheric forcing you need to be careful -to run over the period that data is available. If you have at least one year of forcing -it will cycle over the available data over and over again no matter how long of a simulation -you run. However, if you have less than a years worth of data (or if the start date doesn't -start at the beginning of the year, or the end date doesn't end at the end of the year) then -you won't be able to run over anything but the data extent. In this case you will need to -carefully set the RUN_STARTDATE, START_TOD and -STOP_N/STOP_OPTION variables for your case to run over the entire time extent -of your data. For the supported data points, these values are in the XML database -and you can use the queryDefaultNamelist.pl script to query the values -and set them for your case (they are set for the three urban test cases: Mexicocity, Vancouver, and -urbanc_alpha). - - -In the example below we will show how to do this for the Vancouver, Canada point. - - -Example of running &clm; over the single-point of Vancouver Canada with -supplied atmospheric forcing data for Vancouver. - - -> cd scripts -# Create a case at the single-point resolutions -> ./create_newcase -case testSPDATASETnAtmForcing -res pt1_pt1 -compset I \ --mach bluefire -> cd testSPDATASETnAtmForcing -# Set a variable to the site you want to use (as it's used several times below) -> set SITE=1x1_vancouverCAN -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-sitespf_pt $SITE" -# Now set the CLM single-point variable to the site name -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $SITE -# Set the aerosols to use the single-point dataset for 2000 conditions -# You could also use the default global dataset, but running would be a bit slower -> ./xmlchange -file env_conf.xml -id DATM_MODE -val CLM1PT -# Set the coupling frequency to once an hour -> ./xmlchange -file env_conf.xml -id ATM_NCPL -val 24 -# Set the standard namelist options for an urban test site -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val stdurbpt -# Set many of the settings that are particular to this site, by values contained -# in the XML database. For some sites, or for new sites this information won't be -# stored. And the queryDefaultNamelist.pl command will abort. -# -# Set the start date -> setenv RUN_STARTDATE \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var run_startdate -justvalue` -> setenv STARTDATE `echo $RUN_STARTDATE | sed s/-//g` -> @ START_YEAR = $STARTDATE / 10000 -> ./xmlchange -file env_conf.xml -id RUN_STARTDATE -val $RUN_STARTDATE -# Set the run length and start time of day -> ./xmlchange -file env_run.xml -id STOP_OPTION \ --val `../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist seq_timemgr_inparm -silent -var stop_option -justvalue` -> setenv STOP_N \ -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist seq_timemgr_inparm -silent -var stop_n -justvalue` -> ./xmlchange -file env_run.xml -id STOP_N -val $STOP_N -> ./xmlchange -file env_run.xml -id START_TOD \ --val `../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist seq_timemgr_inparm -silent -var start_tod -justvalue` -# Set &datm; start and end range... -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_START -val -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_beg_year -justvalue` -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_END -val -`../../models/lnd/clm/bld/queryDefaultNamelist.pl -res $SITE \ --namelist default_settings -silent -var datm_cycle_end_year -justvalue` -# Set the User namelist to set the output frequencies of the history files -# Setting the stdurbpt use-case option create three history file streams -# The frequencies and number of time-samples needs to be set -> cat << EOF > &usernlclm; -&clm_inparm - hist_mfilt = $STOP_N,$STOP_N,$STOP_N - hist_nhtfrq = -1,-1,-1 -/ -EOF -# Set align year to start year as defined above -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_ALIGN -val $START_YEAR -# Set &datm; prescribed aerosols to single-point dataset -# Will then use the dataset with just the point for this site -> ./xmlchange -file env_conf.xml -id DATM_PRESAERO -val pt1_pt1 -> ./configure -case - - - - -If you don't set the start-year and run-length carefully as shown above the -model will abort with a "dtlimit error" in the atmosphere model (see bug 1110 in -the KnownLimitations file for documentation on this). Since, the forcing data for -this site (and the MexicoCity site) is less than a year, the model won't be able to -run for a full year. The 1x1_urbanc_alpha site has data for more -than a full year, but neither year is complete hence, it has the same problem (see the -problem for this site above). - - - - -Just like &PTSMODE; above, By default it sets up to run with -USE_MPISERIAL (in the env_build.xml file) turned on, -which allows you to run the model interactively. On some machines this mode is NOT -supported and you may need to change it to FALSE before you are able to build. - - - - -See for a warning about running single-point jobs -on batch machines. - - - - -Note, that when running a pt1_pt1 resolution the number of processors -is automatically set to one. When running a single grid point you can only use a single -processor. You might also want to set the "env_conf" variable: USE_MPISERIAL to -TRUE so that you can also run interactively without having to use -mpi to start up your job. - - - - - - -Creating your own single-point/regional surface datasets - -The file: -Quickstart.userdatasets in the -models/lnd/clm/doc directory gives guidelines on how to create and run -with your own single-point or regional datasets. Below we reprint the above guide. - -&quickstart_userdata; - - - - -Using getregional_datasets.pl to get a complete suite of single-point/regional -surface datasets from global ones - -Use the regional extraction script to get regional datasets from the global ones -The getregional_datasets.pl script to extract out regional datasets of interest. -Note, the script works on all files other than the "finidat" file as it's a 1D vector file. -The script will extract out a block of gridpoints from all the input global datasets, -and create the full suite of input datasets to run over that block. The input datasets -will be named according to the input "id" you give them and the id can then be used -as input to &CLMUSRDAT; to create a case that uses it. See -the section on &clm; Script Configuration Items for -more information on setting &CLMUSRDAT; (in ). The list of files extracted by -their name used in the namelists are: -fatmgrid, fatmlndfrc, -fsurdat, flanduse_timeseries, -stream_fldfilename_ndep, and the &datm; files -domainfile, and faerdep. -For more information on these files see the Table on required files. - - -The alternatives to using this script are to use &PTSMODE;, -discussed earlier, to use &ptclm; discussed in the next chapter, or creating the files -individually using the different file creation tools (given in the -Tools Chapter). Creating -all the files individually takes quite a bit of effort and time. &PTSMODE; -has some limitations as discussed earlier, but also as it uses global files, is -a bit slower when running simulations than using files that just have the set -of points you want to run over. Another advantage is that once you've created the -files using this script you can customize them if you have data on this specific -location that you can replace with what's already in these files. - - -The script requires the use of both "Perl" and "NCL". See the NCL Script section in the Tools Chapter -on getting and using NCL and NCL scripts. The main script to use is a &perl; script -which will then in turn call the NCL script that actually creates the output files. -The ncl script gets it's settings from environment variables set by the perl script. -To get help with the script use "-help" as follows: - -> cd models/lnd/clm/tools/ncl_scripts -> ./getregional_datasets.pl -help - -The output of the above is: - -&getreg_datasets; - - - -The required options are: -id, --ne, and -se, for the output identifier -name to use in the filenames, latitude and longitude of the Northeast corner, and -latitude and longitude of the SouthEast corner (in degrees). Options that specify -which files will be used are: -mask, -res, --rcp, -sim_year, and -sim_yr_rng -for the land-mask to use, global resolution name, representative concentration pathway -for future scenarios, simulation year, and simulation year range. The location of the -input and output files will be determined by the option -mycsmdata -(can also be set by using the environment variable $CSMDATA). If -you are running on a machine like at &ncar; where you do NOT have write permission -to the CESM inputdata files, you should use the scripts/link_dirtree -script to create soft-links of the original files to a location that you can write -to. This way you can use both your new files you created as well as the original -files and use them from the same location. - - -The remaining options to the script are -debug, -and -verbose. -debug is used to show what -would happen if the script was run, without creating the actual files. --verbose adds extra log output while creating the files so you -can more easily see what the script is doing. - - -For example, Run the extraction for data from 52-73 North latitude, 190-220 longitude -that creates 13x12 gridcell region from the f19 (1.9x2.5) global resolution over Alaska. - -Example of running <command>getregional_datasets.pl</command> to get -datasets for a specific region over Alaska - -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA -> cd ../models/lnd/clm/tools/ncl_scripts -> ./getregional_datasets.pl -sw 52,190 -ne 73,220 -id 13x12pt_f19_alaskaUSA -mycsmdata $MYCSMDATA - - -Repeat this process if you need files for multiple sim_year, resolutions, land-masks, -and sim_year_range values. - - - -See for a warning about running single-point jobs -on batch machines. - - - - -See for notes about managing your data -when using link_dirtree. - - - -Now to run a simulation with the datasets created above, you create a single-point -case, and set &CLMUSRDAT; to the identifier used above. Note that in the example below -we set the number of processors to use to one (-pecount 1). For a single point, you -should only use a single processor, but for a regional grid, such as the example below -you could use up to the number of grid points (12x13=156 processors. - - -Example of using &CLMUSRDAT; to run a simulation using user datasets for a -specific region over Alaska - -> cd scripts -# Create the case and set it to only use one processor -> ./create_newcase -case my_userdataset_test -res pt1_pt1 -compset I1850 \ --mach bluefire -> cd my_userdataset_test/ -> ./xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA -> ./xmlchange -file env_conf.xml -id &CLMUSRDAT; -val 13x12pt_f19_alaskaUSA -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val '-mask gx1v6' -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val 13x12pt_f19_alaskaUSA -> ./configure -case - - - - - - - -Running with your own atmosphere forcing - -Here we want to run with our own customized datasets for &clm; as well as -running with our own supplied atmosphere forcing datasets. Thus we effectively -combine the information from with -. First we need to follow -the procedures in to come up with &clm; -datasets that are customized for our point or region in question. This includes -running link_dirtree to create a directory location where you -can add your own files to it. Next, set -DATM_MODE to "CLM1PT" and &CLM1PT; and &CLMUSRDAT; to the -id of the data you created. To see a list of what the filenames need to be -see the section on setting &CLMUSRDAT;. - - -Next we need to setup the atmosphere forcing data in &netcdf; format that can be -read by &datm;. There is a list of eight variables that are expected to be on the input -files with the names and units on the following table (in the table TDEW and SHUM -are optional fields that can be used in place of RH). In the table we also list -which of the fields are required and if not required what the code will do to -replace them. If the names of the fields are different or the list is changed -from the standard list of eight fields: FLDS, FSDS, PRECTmms, -PSRF, RH, TBOT, WIND, and ZBOT, the resulting streams file will need to be modified -to take this into account (see an example streams file for this in below). - -Atmosphere Forcing Fields - - - - Short-name - Description - Units - Required? - If NOT required how replaced - - - - - FLDSincident longwave -(FLDS)W/m2No -calculates based on Temperature, Pressure and Humidity - - - FSDSincident solar -(FSDS)W/m2Yes- - - - FSDSdifincident solar (FSDS) -diffuseW/m2Nobased on FSDS - - - FSDSdirincident solar (FSDS) -directW/m2Nobased on FSDS - - - PRECTmmsprecipitation -(PRECTmms)mm/sYes- - - - PSRFpressure at the lowest atm level -(PSRF)PaNoassumes standard-pressure - - - RHrelative humidity at the lowest atm level -(RH)%Nocan be replaced with SHUM or TDEW - - - SHUMspecific humidity at the lowest atm level -kg/kgOptional in place of RHcan be replaced with RH or TDEW - - - TBOTtemperature at the lowest atm level -(TBOT)K (or can be C)Yes- - - - TDEWdew point temperature -K (or can be C)Optional in place of RHcan be replaced with RH or SHUM - - - WINDwind at the lowest atm level -(WIND)m/sYes- - - - ZBOTobservational heightmNo -assumes 30 meters - - - -
-All of the variables should be dimensioned: time, lat, lon, with time being the unlimited -dimension. The coordinate variable "time" is also required with CF-compliant units in -days, hours, minutes, or seconds. It can also have a calendar attribute that can -be "noleap" or "gregorian". Normally the files will be placed in the: -$MYCSMDATA/atm/datm7/CLM1PT_data/$MYUSRDAT directory with separate files per -month called YYYY-MM.nc where YYYY-MM corresponds to the four -digit year and two digit month with a dash in-between. You also need a domain file that -gives the coordinate information for the data that should be placed in: -$MYCSMDATA/atm/datm7/domain.lnd.$MYUSRDAT_USGS.nc. - -Example of setting up a case with your own atmosphere forcing - -> cd scripts -# First make sure you have a inputdata location that you can write to -# You only need to do this step once, so you won't need to do this in the future -> setenv MYCSMDATA $HOME/inputdata # Set env var for the directory for input data -> ./link_dirtree $CSMDATA $MYCSMDATA -# Next create and move all your datasets into $MYCSMDATA with id $MYUSRDAT -# See above for naming conventions - -# Now create a single-point case -> ./create_newcase -case my_atmforc_test -res pt1_pt1 -compset I1850 \ --mach bluefire -> cd my_atmforc_test -# Set the data root to your inputdata directory, and set &CLM1PT; and &CLMUSRDAT; -# to the user id you created for your datasets above -> ./xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA -> ./xmlchange -file env_conf.xml -id &CLM1PT; -val $MYUSRDAT -> ./xmlchange -file env_conf.xml -id &CLMUSRDAT; -val $MYUSRDAT -# Set the land-mask to USGS, so both clm and &datm; can find files -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val '-mask USGS' -# Then set DATM_MODE to single-point mode so &datm; will use your forcing datasets -# Put your forcing datasets into $MYCSMDATA/atm/datm7/CLM1PT_data/$MYUSRDAT -> ./xmlchange -file env_conf.xml -id DATM_MODE -val CLM1PT -> ./configure -case -# If the list of fields, or filenames, filepaths, or fieldnames are different -# you'll need to edit the &datm; namelist streams file to make it consistent -> $EDITOR Buildconf/datm.buildnml.csh - - -
- - -See for a warning about running single-point jobs -on batch machines. - - - - -See for notes about managing your data -when using link_dirtree. - - - - -Now, we'll show an example of what the &datm; streams file might look like for a case -with your own forcing data with 3-hourly forcing. In this example, we'll leave off the -fields: ZBOT, and FLDS so they'll be calculated as given in the - table above. We'll also include: -FSDSdif and FSDSdir which aren't required, and we'll use TDEW in place of RH. In this -example the datafiles are in &netcdf; format and contain the fields: TA, Tdew, WS, -PREC, Rg, Rgdir, Rgdif, and PRESS which are translated into the &datm; internal names -in this streams file. There is also a domain file that has the position information -for this location. The normal assumption for CLM1PT mode in the &datm; is that data is -hourly or half-hourly and as such is often enough that using the data on the nearest -time-stamp is reasonable and as such the data is in a single streams file (see - for more information on -the default settings for &datm; and how to change them. If the data is less often three to six hours -- see -below, where you will need to modify the time-interpolation method as well as the -time stamp offsets. In the example below we also have to divide the single -stream file into three files to manage the time-stamps and time interpolation -algorithm for the different types of data differently. - -Example of &datm; streams files with your own forcing for 3-hourly data - -Precipitation streams file -(clm1PT.1x1pt_lapazMEX.precip.stream.txt file) . - - -<streamstemplate> -<stream> - <dataSource> - CLMNCEP - </dataSource> - <domainInfo> - <variableNames> - time time - xc lon - yc lat - area area - mask mask - </variableNames> - <filePath> - $DIN_LOC_ROOT/atm/datm7/domain.clm - </filePath> - <fileNames> - domain.lnd.1x1pt_lapazMEX_navy.nc - </fileNames> - </domainInfo> - <fieldInfo> - <variableNames> - PRECTmms PREC - </variableNames> - <offset> - -5400 - </offset> - <filePath> - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/1x1pt_lapazMEX - </filePath> - <fileNames> - 2004-01.nc - 2004-02.nc - 2004-03.nc -. -. -. - 2009-12.nc - </fileNames> - </fieldInfo> -</stream> -</streamstemplate> - - -Solar streams file (clm1PT.1x1pt_lapazMEX.solar.stream.txt file). - - -<streamstemplate> -<stream> - <dataSource> - CLMNCEP - </dataSource> - <domainInfo> - <variableNames> - time time - xc lon - yc lat - area area - mask mask - </variableNames> - <filePath> - $DIN_LOC_ROOT/atm/datm7/domain.clm - </filePath> - <fileNames> - domain.lnd.1x1pt_lapazMEX_navy.nc - </fileNames> - </domainInfo> - <fieldInfo> - <variableNames> - FSDS Rg - FSDSdir Rgdir - FSDSdif Rgdif - </variableNames> - <offset> - -10800 - </offset> - <filePath> - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/1x1pt_lapazMEX - </filePath> - <fileNames> - 2004-01.nc - 2004-02.nc - 2004-03.nc -. -. -. - 2009-12.nc - </fileNames> - </fieldInfo> -</stream> -</streamstemplate> - - -Other fields streams file. -(clm1PT.1x1pt_lapazMEX.other.stream.txt file) . - - -<streamstemplate> -<stream> - <dataSource> - CLMNCEP - </dataSource> - <domainInfo> - <variableNames> - time time - xc lon - yc lat - area area - mask mask - </variableNames> - <filePath> - $DIN_LOC_ROOT/atm/datm7/domain.clm - </filePath> - <fileNames> - domain.lnd.1x1pt_lapazMEX_navy.nc - </fileNames> - </domainInfo> - <fieldInfo> - <variableNames> - TBOT TA - TDEW Tdew - WIND WS - PSRF PRESS - </variableNames> - <offset> - -5400 - </offset> - <filePath> - $DIN_LOC_ROOT/atm/datm7/CLM1PT_data/1x1pt_lapazMEX - </filePath> - <fileNames> - 2004-01.nc - 2004-02.nc - 2004-03.nc -. -. -. - 2009-12.nc - </fileNames> - </fieldInfo> -</stream> -</streamstemplate> - - -Example streams namelist for the above streams files: - - - &shr_strdata_nml - dataMode = 'CLMNCEP' - domainFile = '$DOMAINFILE' - streams = 'clm1PT.1x1pt_lapazMEX.solar.stream.txt 1 2004 2009 ', - 'clm1PT.1x1pt_lapazMEX.precip.stream.txt 1 2004 2009 ', - 'clm1PT.1x1pt_lapazMEX.other.stream.txt 1 2004 2009 ', - 'presaero.stream.txt 1 2000 2000' - vectors = 'null','null','null','null' - mapmask = 'nomask','nomask','nomask','nomask' - mapalgo = 'nn','nn','nn','nn' - tintalgo = 'coszen','nearest','linear','linear' - taxmode = 'cycle','cycle','cycle','cycle' - / - - - - - -The example above shows the resolved namelist and streams file after &configure; -has been run. In order to save this configuration for future use, you would need -to edit the &datm; template adding new DATM_MODE see - for more information on how to do this. - - - - -We've outlined and given a few examples of using your own atmosphere -forcing. In the next chapter we go into the details of using &ptclm;. - - -
- -
- diff --git a/doc/UsersGuide/special_cases.xml b/doc/UsersGuide/special_cases.xml deleted file mode 100644 index ac5c7fef3b..0000000000 --- a/doc/UsersGuide/special_cases.xml +++ /dev/null @@ -1,916 +0,0 @@ - - -How to run some special cases - -In this chapter we describe how to run some special cases that take more than one step -to do. The straightforward cases have compsets and/or build-namelist use-cases setup for -them or require simple editing of a single-case. All of the cases here require you -to do at least two simulations with different configurations, or require more complex -editing of the case (changing the streams files). - - -The nine cases we will describe are: - - - -Running with the prognostic crop model on - - - - -Running with the irrigation model on - - - - -Spinning up the Satellite Phenology Model (&clmsp; spinup) - - - - -Spinning up the biogeochemistry Carbon-Nitrogen Model (CN spinup) - - - - -Spinning up the Carbon-Nitrogen Dynamic Global Vegetation Model (CNDV spinup) - - - - -Running with MOAR data as atmospheric forcing to spinup the model - - - - -Running with your own previous simulation as atmospheric forcing to spinup the model - - - - -Doing perturbation error growth tests - - - - -Running stand-alone &clm; with transient historical &CO2; -concentration - - - - - - -The cases in this chapter are more sophisticated and require more technical knowledge -and skill than cases in previous chapters. The user should be very familiar with doing -simple cases before moving onto the cases described here. - - - -Running with the prognostic crop model on - - -In &clmcesm103; a prognostic crop model was added to &clm4;. The prognostic crop -model is setup to work with CN for present day conditions and we have surface -and initial condition datasets at f19 resolution. In order to use the initial condition -file, we need to set the RUN_TYPE to startup rather -than hybrid since the compset for f19 sets up to use an initial -condition file without crop active. To activate the crop model we simply add "-crop on" -to &CLMCONFIG;. - -Example Crop Simulation - -> cd scripts -> ./create_newcase -case CROP -res f19_g16 -compset ICN -mach bluefire -> cd CROP -# Append "-crop on" to &CLMCONFIG; in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-crop on" -append -# Change to startup type so uses spunup initial conditions file for crop if it exists -# By default the model will do a hybrid startup with an initial condition file -# incompatible with the crop surface dataset. -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -> ./configure -case -# Now build and run normally -> ./CROP.bluefire.build -> ./CROP.bluefire.submit - - - - - - -Running with the irrigation model on - - -In &clmcesm103; an irrigation model for generic crop was added to &clm4;. Currently, -irrigation and crop can NOT be used together see bug number 1326 in the -&KnownBugs; file. -The irrigation model is tuned to work only with &clmsp; see the caution below for -for more information on this. To turn on -irrigation we simply add "-irrig on" to &CLMBLDNML;. Just as in the crop example we -also change RUN_TYPE to startup so that we don't use -an initial condition file that is incompatible with irrigation. - -Example Irrigation Simulation - -> cd scripts -# Note here we do a &clmsp; simulation as that is what has been validated -> ./create_newcase -case IRRIG -res f19_g16 -compset I -mach bluefire -> cd IRRIG -# Append "-irrig on" to &CLMBLDNML; in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMBLDNML; -val "-irrig" -append -# Change to startup type so uses spunup initial conditions file for irrigation if it exists -# By default the model will do a hybrid startup with an initial condition file -# incompatible with the irrigation surface dataset. -> xmlchange -file env_conf.xml -id RUN_TYPE -val startup -> ./configure -case -# Now build and run normally -> ./IRRIG.bluefire.build -> ./IRRIG.bluefire.submit - - - - -We have only run the irrigation model with &clmsp; (i.e. without the CN model). We -recommend that if you want to run the irrigation model with CN, that you do a spinup -as outlined in the examples below. But, more than that you may need to make -the adjustments we discuss in . - - - - - - -Spinning up the Satellite Phenology Model (&clmsp; spinup) - - -To spin-up the &clmsp; model you merely need to run &clmsp; for 50 simulation -years starting from arbitrary initial conditions. You then use the final -restart file for initial conditions in other simulations. -Because, this is a straight forward operation we will NOT give -the details on how to do that here, but leave it as an exercise for the reader. -See the as an example of doing this -as the last step for &clmcn;. - - - - -Spinning up the biogeochemistry Carbon-Nitrogen Model (CN spinup) - -To get the &clmcn; model to a steady state, you first run it from arbitrary initial conditions -using the "accelerated decomposition spinup" (-ad_spinup in configure) mode for 600 simulation years. After -this you branch from this mode in the "exit spinup" (-exit_spinup in configure), run -for a simulation year, and then save a restart from that and use it as initial conditions -for further spinup of CN (at least 50 simulation years). - - -Spinup of &clmcn; - -AD_SPINUP - -For the first step of running 600 years in "-ad_spinup" mode, you will setup -a case, and then edit the values in env_conf.xml and -env_run.xml so that the right configuration is turned on and -the simulation is setup to run for the required length of simulation time. -So do the following: - -Example AD_SPINUP Simulation - -> cd scripts -> ./create_newcase -case CN_spinup -res f19_g16 -compset ICN -mach bluefire -> cd CN_spinup -# Append "-ad_spinup on" to &CLMCONFIG; in env_conf.xml -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-ad_spinup on" -append -# The following sets &CLMFORCECOLD; to "on" in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMFORCECOLD; -val on -# Make the output history files only annual, by adding the following to the &usernlclm; namelist -> echo '&clm_inparm hist_nhtfrq = -8760 /' > &usernlclm; -# Now configure -> ./configure -case -> ./xmlchange -file env_run.xml -id STOP_DATE -val 6010101 -# Now build -> ./CN_spinup.bluefire.build -# The following sets RESUBMIT to 30 times in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 30 -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -# The following sets STOP_N to 20 years in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_N -val 20 -# The following sets STOP_DATE to Jan/1 of year 601 in env_run.xml (you could also use an editor) -# Now run normally -> ./CN_spinup.bluefire.submit - - -Afterwards save the last restart file from this simulation to use in the next step. - - - - -EXIT_SPINIP - - -Example EXIT_SPINUP Simulation - -> cd scripts -> ./create_newcase -case CN_exitspinup -res f19_g16 -compset ICN -mach bluefire -> cd CN_exitspinup -# Append "-exit_spinup on" to &CLMCONFIG; in env_conf.xml -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-exit_spinup on" -append -# Change run type to branch and branch from the last year of the last simulation -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val branch -> ./xmlchange -file env_conf.xml -id RUN_REFCASE -val CN_spinup -> ./xmlchange -file env_conf.xml -id RUN_REFDATE -val 0601-01-01 -> ./xmlchange -file env_conf.xml -id GET_REFCASE -val FALSE -> ./configure -case -# Go ahead and build, so that the run directory is created -> ./CN_exitspinup.bluefire.build -# Now, Copy the last restart files from the earlier case into your run directory -> cp /ptmp/$LOGIN/archive/CN_spinup/rest/CN_spinup.*.r*.0601-01-01-00000* /ptmp/$LOGIN/CN_exitspinup -# And copy the rpointer files for datm and drv from the earlier case -> cp /ptmp/$LOGIN/archive/CN_spinup/rest/rpointer.atm /ptmp/$LOGIN/CN_exitspinup -> cp /ptmp/$LOGIN/archive/CN_spinup/rest/rpointer.drv /ptmp/$LOGIN/CN_exitspinup -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -> ./xmlchange -file env_run.xml -id STOP_N -val 1 -# Now run normally -> ./CN_exitspinup.bluefire.submit - - - - - - -Final spinup - -Next save the last restart file from this step and use it as the "finidat" file to -use for one more spinup for at least 50 years in normal mode. -So do the following: - -Example Final CN Spinup Simulation - -> cd scripts -> ./create_newcase -case CN_finalspinup -res f19_g16 -compset ICN -mach bluefire -> cd CN_finalspinup -# The following sets &CLMFORCECOLD; to "on" in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id &CLMFORCECOLD; -val on -# Now, Copy the last &clm; restart file from the earlier case into your run directory -> cp /ptmp/$LOGIN/archive/CN_exitspinup/rest/CN_exitspinup.clm*.r*.0602-01-01-00000.nc \ -/ptmp/$LOGIN/CN_finalspinup -# And copy the rpointer files for datm and drv from the earlier case -> cp /ptmp/$LOGIN/archive/CN_exitspinup/rest/rpointer.atm /ptmp/$LOGIN/CN_finalspinup -> cp /ptmp/$LOGIN/archive/CN_exitspinup/rest/rpointer.drv /ptmp/$LOGIN/CN_finalspinup -# Set the finidat file to the last restart file saved in previous step -> echo '&clm_inparm finidat = "CN_exitspinup.clm2.r.0602-01-01-00000.nc" /' > &usernlclm; -# Now configure -> ./configure -case -> $EDITOR Buildconf/clm.buildnml.csh -> Now build -> .CN_finalspinup.bluefire.build -# The following sets RESUBMIT to 5 times in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 5 -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -# The following sets STOP_N to 10 years in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_N -val 10 -> Now run as normal -> .CN_finalspinup.bluefire.submit - - - - -To assess if the model is spunup plot trends of CN variables of interest. If you see -a trend, you may need to run the simulation longer. -Finally save the restart file from the end of this simulation to use as an "finidat" file for future -simulations. - - - - - - -Spinning up the Carbon-Nitrogen Dynamic Global Vegetation Model (CNDV spinup) - -To spinup the &clm; CNDV model -- you first follow the procedures above to spinup the CN model. -Then you take the CN initial state file you created for the spinup with just CN, and -run CNDV for 200 more years. -We've provided such spunup files for two resolutions (f09 and f19) and two time-periods -(1850 and 2000), so in this example we will use the files provided to start from. -We've also provided a spinup file at f19 resolution for CNDV, hence the following is -NOT required when running at f19. -If you were to start from your own &clmcn; spunup files -- the procedure would require -some modification. -There are no compsets using CNDV, so in -env_conf.xml change CLM_CONFIG_OPTS to --bgc cndv. - -Example CNDV Spinup Simulation - -> cd scripts -> ./create_newcase -case CNDV_spinup -res f09_g16 -compset ICN -mach bluefire -> cd CNDV_spinup -# Set run type to startup and do a cold start -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -# The following sets CLM_CONFIG_OPTS to "-bgc cndv" in env_conf.xml (you could also use an editor) -> ./xmlchange -file env_conf.xml -id CLM_CONFIG_OPTS -val "-bgc cndv" -# Make the default primary history file annual and add an annual 1D vector auxiliary file -# By putting the following in a &usernlclm; file. -> cat << EOF > &usernlclm; -&clm_inparm - hist_nhtfrq = -8760, -8760 - hist_mfilt = 1, 1 - hist_fincl2 = 'TLAI', 'TSAI', 'HTOP', 'HBOT', 'NPP' - hist_dov2xy = .true., .false. -/ -> ./configure -case -# NOTE: If you were using your own CN spinup files you would edit the namelist to use it -# $EDITOR Buildconf/clm.buildnml.csh -# -# Now build and run as normal -> ./CNDV_spinup.bluefire.build -# The following sets RESUBMIT to 10 times in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 10 -# The following sets STOP_OPTION to "nyears" in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -# The following sets STOP_N to 20 years in env_run.xml (you could also use an editor) -> ./xmlchange -file env_run.xml -id STOP_N -val 20 -# Make sure you turn archiving on, so you save your files to long term archival -> ./xmlchange -file env_run.xml -id DOUT_L_MS -val TRUE -> ./CNDV_spinup.bluefire.submit - - - - - -There is a build bug with &clmcesm103; see bug 1370 in the &KnownBugs; on -how to address this. - - - - - -In a data analysis tool you should examine the auxiliary file and examine the -pfts1d_wtgcell to see where and what types of vegetation have -been established. See the caution in for more -information on visualizing and analyzing 1D vector fields. - - - -CNDV also writes out two vector fields to "hv" auxiliary files, on an annual basis by -default. - - - - -We've provided a spinup file for CNDV at f19 resolution, you could also use -interpinic to interpolate this file to other resolutions. - - - - - -Running with MOAR data as atmospheric forcing to spinup the model - -Because it takes so long to spinup the CN model (as we just saw previously), if you -are doing fully coupled simulations with active atmosphere and ocean, you will want -to do the spinup portion of this "offline". So instead of doing expensive fully -coupled simulations for the spinup duration, you run &clm; in a very cheap "I" -compset using atmospheric forcing from a shorter fully coupled simulation -(or a simulation run previously by someone else). - - -In this example we will use the I1850SPINUPCN compset to setup -&clm; to run with atmospheric forcing from a previous fully coupled simulation with -data that is already stored on disk on bluefire. There are several simulations that -have high frequency data for which we can do this. You can also do this on a machine -other than bluefire, but would need to download the data from the Earth System Grid and -change the datapath similar to . -This compset is designed for constant -1850 conditions, but unfortunately (because of bug 1354 see the &KnownBugs; file) by -default it points to a transient simulation instead of an 1850 simulation. Here we -point to an 1850 simulation and setup the forcing years to run over. - -Example Simulation with MOAR Data on bluefire - -> cd scripts -> ./create_newcase -case MOARforce1850 -res f19_g16 -compset I1850SPINUPCN -mach bluefire -> cd MOARforce1850 -# The following sets the casename to point to for atm forcing (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_CASE -val b40.1850.track1.1deg.006a -# The following sets the align year and years to run over for atm forcing -# (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_ALIGN -val 1 -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_START -val 960 -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_END -val 1030 -> ./configure -case -# Now build and run as normal -> ./MOARforce1850.bluefire.build -> ./MOARforce1850.bluefire.submit - - - - -Because of bug 1339 (see the &KnownBugs; file on this) -you can't run with 83 or more years of forcing. If you do need to run with more years of -forcing, you'll need to address the issue as outlined in the &KnownBugs; file. - - - - - - -Running with your own previous simulation as atmospheric forcing to spinup the model - -Another way that you might want to spinup the model is to run your own simulation -for a relatively short period (either a B, E, or F compset) and then use it as forcing -for your "I" case later. By only running 20 to 50 years for the fully coupled case, -you'll save a substantial amount of computer time rather than running the entire spinup -period with a fully coupled model. - - -The first thing we need to do is to run a fully coupled case and save the atmospheric -coupling fields on a three hourly basis. In this example, we will run on bluefire -and archive the data to a local disk that we can then use in the next simulation. - -Example Fully Coupled Simulation to Create Data to Force Next Example Simulation - -> cd scripts -> ./create_newcase -case myBCN1850 -res f09_g16 -compset B1850CN -mach bluefire -> cd myBCN1850 -> ./configure -case -# Set histaux_a2x3hr to .true. in cpl.buildnml.csh so output from the atmosphere model -# will be saved 3 hourly -$EDITOR BuildConf/cpl.buildnml.csh -# Now build -> ./myBCN1850.bluefire.build -# The following sets the archival disk space (you could also use an editor) -> ./xmlchange -file env_run.xml -id DOUT_S_ROOT -val '/glade/home/$USER/$CASE' -# Make sure files are archived to disk, but NOT to long term storage -# (you could also use an editor) -> ./xmlchange -file env_run.xml -id DOUT_S -val TRUE -> ./xmlchange -file env_run.xml -id DOUT_L_MS -val FALSE -# Set the run length to run a total of 20 years (you could also use an editor) -> ./xmlchange -file env_run.xml -id RESUBMIT -val 9 -> ./xmlchange -file env_run.xml -id STOP_OPTION -val nyears -> ./xmlchange -file env_run.xml -id STOP_N -val 2 -# Now run as normal -> ./myBCN1850.bluefire.submit - - - - -Now we run an I compset forced with the data from the previous simulation using -the &CPLHIST; option to DATM_MODE. See - for more information on the -&datm; settings for &CPLHIST; mode. - -Example Simulation Forced with Data from the Previous Simulation - -> cd scripts -> ./create_newcase -case frcwmyBCN1850 -res f09_g16 -compset I1850SPINUPCN -mach bluefire -> cd frcWmyBCN1850 -# The following sets the casename to point to for atm forcing (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_CASE -val "myBCN1850" -# The following sets the align year and years to run over for atm forcing -# (you could also use an editor) -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_ALIGN -val "1" -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_START -val "1" -> ./xmlchange -file env_conf.xml -id DATM_CPL_YR_END -val "20" -# Set the datapath in the template to the archival path from the case above -> sed -E 's#set datapath = ".+"#set datapath = "/glade/home/$USER/%c/cpl/hist"#' \ - Tools/Templates/datm.cpl7.template > new.datm.cpl7.template -> mv -f new.datm.cpl7.template Tools/Templates/datm.cpl7.template -> chmod +x Tools/Templates/datm.cpl7.template -> ./configure -case -# Now build and run as normal -> ./frcwmyBCN1850.bluefire.build -> ./frcwmyBCN1850.bluefire.submit - - - - -In order to accomplish this we needed to edit the &datm; template file. See - for more information on doing this. -If your input case was at a resolution besides f09 you would have to edit -the &datm; template file even further to use a domain file at the input resolution. - - - - - - -Doing perturbation error growth tests - -Doing perturbation error growth tests is a way to validate a port of -the model to a new machine or to verify that changes are only roundoff. -The steps are the same in either case, but in the discussion below I will -assume you are doing a port validation to a new machine (but in parentheses -I will put a reminder that it could also be for code-mods). -The basic idea is to run a case on the trusted machine (trusted code) and -another with initial conditions perturbed by roundoff and compare the results of -the two. The difference between these two simulations (the error) will grow over time -and describe a curve that we compare with the error growth on the new machine (code -changes). The error growth on the new machine is the difference between the non-perturbed -state on the trusted machine and the non-perturbed state on the new machine (code -changes). If the new machine (code changes) are well-behaved -the plot of this error growth compared to the error growth curve on the trusted machine -should be similar. If the -changes are NOT well-behaved the changes from the new machine (code changes) will be -larger than the perturbation changes. In summary the simulations and steps that need to be performed are: - - -Run a simulation with the trusted code on the trusted machine. -(optionally you can use a dataset from inputdata repository). - - - -Run a simulation with the trusted code on the trusted machine with initial conditions -perturbed by roundoff (using a namelist item to do so). -(this is optional is you are using inputdata repository datasets) - - - -Run a simulation with the new code on the non-trusted machine (code changes). - - -Do a plot of the RMS difference of history variables between simulation 1 and simulation 2. - - -Do a plot of the RMS difference of history variables between simulation 1 and simulation 3. - - -Compare the two plots in steps 4 and 5. - - -If the plots compare well the new machine (code changes) is running as well as the trusted machine. - - -If the plots do NOTcompare well the new machine is -NOTrunning as well as the trusted machine. Typically the -recommendation here is to lower the optimization level on the new machine and try -again (or in the case of code changes, modify or simplify the code changes to get -something that should be closer). - -The history variables we have used to do this is either 'TSOI', and/or 'TSA'. 'TSOI' are -the 3D snow and soil temperatures for vegetated land-units. If there is a change in -soil physics it should show up in this field (and it should show up even for something -that is at a pretty deep soil depth). However, as 'TSOI' is only for vegetated -land-units, changes in lake or urban land-units -- will NOT show up. 'TSA' by contrast is -the 2m surface temperature across all land-units, so changes in urban or lake land-units -will show up. However, changes in deep soil physics will only show up as it propagates -to the surface. So one field may show something that the other doesn't. In the examples, -we use 'TSOI', but 'TSA' can be used as well. And in most cases you should check both. - - - -Now we will give a detailed description of the procedure with examples and the -exact steps to perform. - - -Using Perturbation Error Growth Analysis to Verify a Port to a New Machine - -Running non-perturbed on trusted machine - -The first step is to run a non-perturbed case on the trusted machine. You need to run -all of the steps with the same compset and same resolution. For these examples we will -use 2-degree resolution with the ICN compset for 2000 conditions. You need to run for -three days with a cold-start. - - - -As we describe below, This is optional if you will be using datasets from the -inputdata repository to take place of this step. - - - - -Example non-perturbed error growth simulation - -> cd scripts -> ./create_newcase -case trustedMachinePergro0 -compset ICN -res f19_g16 \ --mach bluefire -> cd trustedMachinePergro0 -# Set the non-perturbed PERGRO use-case -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val pergro0_pd -# Set coldstart on so arbitrary initial conditions will be used -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -# Set PERGRO on in the configure -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-pergro on" -append -# Now configure and build -> ./configure -case -> ./trustedMachinePergro0.bluefire.build -# Set it to run for three days and turn archiving off -> ./xmlchange -file env_run.xml -id STOP_N -val 3 -> ./xmlchange -file env_run.xml -id DOUT_S -val FALSE -# Run the case and then you will save the history file output for later use -> ./trustedMachinePergro0.bluefire.submit - - - - - -If you aren't able to do this step, as you don't have access to a trusted machine, you -can use datasets that are available from the svn inputdata repository to take place of -running it yourself. The disadvantage is that this is only done for certain model -versions and for exactly the configuration/namelist given here. You won't be able to -test it for your own custom code or configurations. - - - - -Running perturbed on the trusted machine - -The next step is to run a perturbed case on the trusted machine. - -Example perturbed error growth simulation - -> cd scripts -> ./create_newcase -case trustedMachinePergroRnd -compset ICN -res f19_g16 \ --mach bluefire -> cd trustedMachinePergroRnd -# Set the perturbed PERGRO use-case -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val pergro_pd -# Set coldstart on so arbitrary initial conditions will be used -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -# Set PERGRO on in the configure -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-pergro on" -append -# Now configure and build -> ./configure -case -> ./trustedMachinePergroRnd.bluefire.build -# Set it to run for three days and turn archiving off -> ./xmlchange -file env_run.xml -id STOP_N -val 3 -> ./xmlchange -file env_run.xml -id DOUT_S -val FALSE -# Run the case and then you will save the history file output for later use -> ./trustedMachinePergroRnd.bluefire.submit - - - - - -If you aren't able to do this step, as you don't have access to a trusted machine, you -can use datasets that are available from the svn inputdata repository to take place of -running it yourself. The disadvantage is that this is only done for certain model -versions and for exactly the configuration/namelist given here. You won't be able to -test it for your own custom code or configurations. - - - - -Running non-perturbed on the new machine - -The next step is to run a non-perturbed case on the new machine. Here -we will demonstrate using the machine intrepid. For the previous two steps -you have the option of using datasets provided in the subversion inputdata -repository to take their place -- however this step is required. - -> cd scripts -> ./create_newcase -case newMachinePergro0 -compset ICN -res f19_g16 \ --mach intrepid -> cd newMachinePergro0 -# Set the non-perturbed PERGRO use-case -> ./xmlchange -file env_conf.xml -id CLM_NML_USE_CASE -val pergro0_pd -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -> ./xmlchange -file env_conf.xml -id RUN_TYPE -val startup -# Set PERGRO on in the configure -> ./xmlchange -file env_conf.xml -id &CLMCONFIG; -val "-pergro on" -append -# Now configure and build -> ./configure -case -> ./newMachinePergro0.intrepid.build -# Set it to run for three days and turn archiving off -> ./xmlchange -file env_run.xml -id STOP_N -val 3 -> ./xmlchange -file env_run.xml -id DOUT_S -val FALSE -# Run the case and then you will save the history file output for later use -> ./newMachinePergro0.intrepid.submit - - - - - -Plotting the differences - -You can use the cprnc program to compute root mean square differences -between the relevant history files. See for more information -on it and how to build it. On many platforms you will need to set some environment -variables in order to complete the build (see for -more information on building the tools). - -# Build the cprnc program -> cd models/lnd/clm/tools/cprnc -> gmake -# Now go to your case directory and run cprnc on the trusted-machine with and without -# perturbation -> cd ../../../../../scripts/trustedMachinePergro0 -> ../../models/lnd/clm/tools/cprnc/cprnc trustedMachinePergro0.clm2.h0.001-01-01.00000.nc \ -../trustedMachinePergroRnd/trustedMachinePergroRnd.clm2.h0.001-01-01.00000.nc > trustedPergro.log -# Copy the history file from the new machine to here -# -# And now run cprnc on the trusted-machine and the new machine both without perturbation -> ../../models/lnd/clm/tools/cprnc/cprnc trustedMachinePergro0.clm2.h0.001-01-01.00000.nc \ -../newMachinePergro0/newMachinePergro0.clm2.h0.001-01-01.00000.nc > newPergro.log -# Now extract out the RMS differences of TSOI for both -# You may want to extract out the RMS differences for TSA as well -# Changes in urban or lake land-units won't be detected with TSOI -> grep "RMS TSOI" trustedPergro.log | awk '{print $3}' > RMStrusted.dat -> grep "RMS TSOI" newPergro.log | awk '{print $3}' > RMSnewmachine.dat -# And plot the two curves up to your screen -> env TYPE=x11 RMSDAT=RMSnewmachine.dat RMSDAT2=RMStrusted.dat ncl \ -../../models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl - -Here is a sample plot for several trusted machines: bluefire, intrepid, jaguar, -and edinburgh (with both the lahey and intel compilers). -The green line is the error growth for bluefire, the red is the error growth -for intrepid, the dashed navy is for jaguar, the dashed maroon is for the intel -compiler on edinburgh, and the thick dashed goldenrod line is for edinburgh with the -lahey compiler. Note, the data for this plot is in -models/lnd/clm/tools/ncl_scripts the files are named: -according to the legend. Note, that the lines tend to cluster together and follow -quite closely to the bluefire line which is our main trusted machine. -

-Sample Good Perturbation Error Growth Curves (within roundoff) - - - -
- - - -When you do NOT have access to a trusted machine you can use the trusted file from -bluefire that is available on the inputdata repository. - -# Build the cprnc program -> cd models/lnd/clm/tools/cprnc -> gmake -# Get the unperturbed file from the subversion repository -> cd ../../../../../scripts/newMachinePergro0 -> set dir = "lnd/clm2/pergrodata" -> set file = bluefirePergro0.ICN.0001-01-01_1.9x2.5_gx1v6_simyr2000_clm4-cesm1_0_3.c110617.nc -> echo "trustedfile = DIN_LOC_ROOT/$dir/$file" > clm.input_data_list -> ../ccsm_utils/Tools/check_input_data -datalistdir . -export -inputdata $DIN_LOC_ROOT -# And now run cprnc on the bluefire file and the new machine both without perturbation -> ../../models/lnd/clm/tools/cprnc/cprnc $file \ -../newMachinePergro0/newMachinePergro0.clm2.h0.001-01-01.00000.nc > newPergro.log -# Now extract out the RMS difference -# You may want to extract out the RMS differences for TSA as well -# Changes in urban or lake land-units won't be detected with TSOI -> grep "RMS TSOI" newPergro.log | awk '{print $3}' > RMSnewmachine.dat -# And plot the new curve versus the trusted curve up to your screen -> env TYPE=x11 RMSDAT=RMSnewmachine.dat \ -RMSDAT2=../../models/lnd/clm/tools/ncl_scripts/RMSbluefire.dat \ -../../models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl - - - -In the figure below we now show example of curves for changes that are larger than -roundoff. Once again the green curve is the trusted error growth from bluefire. The -other curves are for changes that may be fairly small, but are larger than roundoff. The -goldenrod curve is for using the 1850, and the navy is for using the 1999 Nitrogen -deposition files rather than for year 2000. The red is for using the 1850 aerosol -dataset rather than 2000, and the maroon is for adding the snow combination bug in. The -differences in changes that are greater than roundoff is that the curves climb very -steeply to the 10-6 value and then level off, while the -curve for bluefire climbs much more slowly and gradually. The curves also don't mimic -each other in any way, like the trusted machine plots do. -
-Sample Bad Perturbation Error Growth Curves (changes greater than roundoff) - - - -
- -
- - - - - -Running stand-alone &clm; with transient historical &CO2; -concentration - -In this case you want to run a simulation with stand-alone &clm; responding -to changes in &CO2; for a historical period. -For this example, we will start with the "I_1850-2000_CN" compset that -has transient: land-use, Nitrogen and Aerosol deposition already. You could -also use another compset if you didn't want these other features to be transient. -In order to get &CO2; to be transient we need to edit the -&datm; template so that we add an extra streams file to describe how -&CO2; varies over the historical period. You also need -a &netcdf; datafile that datm can read that gives the variation. You could -supply your own file, but we have a standard file that is used by CAM for this -and our example will make use of this file. - - - -Most everything here has to do with changing datm rather than &clm; -to allow this to happen. As such the user that wishes to do this should -first become more familiar with datm and read the -&cesm; Data -Model User's Guide especially as it pertains to the datm. Note, also -that in this example we show how to edit the datm "buildnml" file for your -case, but you could do something similar by editing the datm template. - - - - -This section documents the process for doing something that is non-standard. -There may be errors with the documentation and process, and you may have to do -some work before all of this works for you. If that is the case, we recommend -that you do further research into understanding the process and the files, as -well as understanding the datm and how it works. You may have to read documentation -found in the code for datm as well as "csm_share". - - - -The datm has "streams" files that have rough XML-like syntax and specify the -location and file to get data from, as well as information on the variable names -and the data locations of the grid points. The datm expects specific variable names -and the datm "maps" the expected variable names from the file to the names expected -by datm. The file we are working with here is a file with a single-point, that covers -the entire globe (so the vertices go from -90 to 90 degrees in latitude and 0 to 360 -degrees in longitude). Since it's a single point it's a little easier to work with -than datasets that may be at a given horizontal resolution. The datm also expects -that variables will be in certain units, and only expects a limited number of -variables so arbitrary fields can NOT be exchanged this way. However, the process -would be similar for datasets that do contain more than one point. - - -The three things that are needed: a domain file, a data file, and a streams text file. -The domain file is a CF-compliant &netcdf; file that has information -on the grid points (latitudes and longitudes for cell-centers and vertices, mask -, fraction, and areas). The datafile is a CF-compliant &netcdf; file with the data that -will be mapped. The streams text file is the XML-like file that tells datm how to find -the files and how to map the variables datm knows about to the variable names on the -&netcdf; files. Note, that in our case the domain file and the data file are the same -file. In other cases, the domain file may be separate from the data file. - - -First we are going to create a case, and we will edit -the Buildconf/datm.buildnml.csh so that we add a -&CO2; data stream in. There is a streams text file -available in models/lnd/clm/doc/UsersGuide/co2_streams.txt, -that includes file with a &CO2; time-series from 1765 to 2007. - -Example Transient Simulation with Historical &CO2; - -> cd scripts -> ./create_newcase -case DATM_CO2_TSERIES -res f19_g16 -compset I_1850-2000_CN \ --mach bluefire -> cd DATM_CO2_TSERIES -# Set CCSM_BGC to CO2A so that CO2 will be passed from atmosphere to land -> ./xmlchange -file env_conf.xml -id CCSM_BGC -val CO2A -# Set CLM_CO2_TYPE to diagnostic so that the land will use the value sent from the atmosphere -> ./xmlchange -file env_conf.xml -id CLM_CO2_TYPE -val diagnostic -> ./configure -case -> cd Buildconf -# Copy the sample streams file over -> cp ../../../models/lnd/clm/doc/UsersGuide/co2_streams.txt . - - -The first thing we will do is to edit the datm buildnml script to add -a CO2 file stream in. To do this we will apply a patch with the differences -needed. The patch file addco2_datm.buildnml.diff is -in models/lnd/clm/doc/UsersGuide and looks like this... - -&co2streams_diff; - -So to apply the patch you do this... - -> cd scripts/DATM_CO2_TSERIES/Buildconf -> patch < ../../../models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - -Once, you've done that you can build and run your case normally. - - - -The patch assumes you are using a I_1850-2000_CN compset out of the box, with -DATM_PRESAERO equal to trans_1850-2000. So it assumes standard -Qian atmosphere forcing, and transient prescribed aerosols from streams files. If your case changes -anything here the patch will fail, and you will need to put the changes in by hand. - - - - - -If the patch fails, you will have to add the changes to the -datm.buildnml.csh found in the above -patch file by hand. Basically, it adds an extra streams file for &CO2; to the end of the streams variable, -and other arrays associated with streams (adding mapalgo as a new array with bilinear for everything, but -the &CO2; file which should be "nn" for nearest neighbor). - - - - - -The streams file above is hard-coded for the path of the file on &ncar; computers. To use it on an outside -machine you'll need to edit the filepath in the streams file to point to the location where you have the file. - - - - -After going through these steps, you will have a case where you have datm reading -in an extra streams text file that points to a data file with &CO2; -data on it that will send that data to the &clm;. - - - - diff --git a/doc/UsersGuide/stylesheethtml2docbook.xsl b/doc/UsersGuide/stylesheethtml2docbook.xsl deleted file mode 100644 index 13c30ff71d..0000000000 --- a/doc/UsersGuide/stylesheethtml2docbook.xsl +++ /dev/null @@ -1,579 +0,0 @@ - - - - - -wb -file:///epicuser/AISolutions/graphics/AIWorkbench/ - - - - - - - - - - <xsl:value-of select=".//html:h1[1] - |.//html:h2[1] - |.//html:h3[1]"/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - _ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - inlinemediaobject - - mediaobject - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Matched -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No template for - - - - - - No template for - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
-
- - - - - - - _ - - - - - - - - - - - - - - _ - - - - - - - - - - - - - - - - - - - - - - - - - <xsl:value-of select=".//html:caption"/> - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Attempting to count columns on a non-table element - - - Row parameter is not a valid row - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/doc/UsersGuide/tools.xml b/doc/UsersGuide/tools.xml deleted file mode 100644 index f5fd8beac4..0000000000 --- a/doc/UsersGuide/tools.xml +++ /dev/null @@ -1,1396 +0,0 @@ - - -Using the &clm; tools to create your own input datasets - -There are several tools provided with &clm; that allow you to create your own input -datasets at resolutions you choose, or to interpolate initial conditions to a different -resolution, or used to compare &clm; history files between different cases. The tools are -all available in the models/lnd/clm/tools directory. Most of the tools -are &FORTRAN; stand-alone programs in their own directory, but there is also a suite of -&ncl; -scripts in the ncl_scripts directory. Some of the &ncl; scripts are -very specialized and not meant for general use, and we won't document them here. They -still contain documentation in the script itself and the README file in the tools -directory. But, the list of generally important scripts and programs are: - - - cprnc to compare &netcdf; files with a time axis. - - - interpinic to interpolate initial condition files. - - - mkgriddata to create grid datasets. - - - mkdatadomain to create domain files from grid datasets -used by &datm; or docn. - - - mksurfdata to create surface datasets from grid datasets. - - - ncl_scripts/getregional_datasets.pl script to extract a -region or a single-point from global input datasets. See the single-point chapter -for more information on this. - - - ncl_scripts/npdepregrid.ncl interpolate the Nitrogen -deposition datasets to a new resolution. - - - ncl_scripts/aerdepregrid.ncl interpolate the Aerosol -deposition datasets to a new resolution. - - - - - -In the sections to come we will go into detailed description of how to use each of -these tools in turn. First, however we will discuss the common environment variables -and options that are used by all of the &FORTRAN; tools. Second, we go over the outline -of the entire file creation process for all input files needed by &clm; for a new -resolution, then we turn to each tool. In the last section we will -discuss how to customize files for particular observational sites. - - - -Common environment variables and options used in building the &FORTRAN; -tools - -The &FORTRAN; tools all have similar makefiles, and similar options for building. -All of the Makefiles use GNU Make extensions and thus require that you use GNU make -to use them. They also auto detect the type of platform you are on, using "uname -s" -and set the compiler, compiler flags and such accordingly. There are also environment -variables that can be set to set things that must be customized. All the tools use -&netcdf; and hence require the path to the &netcdf; libraries and include files. -On some platforms (such as Linux) multiple compilers can be used, and hence there -are env variables that can be set to change the &FORTRAN; and/or "C" compilers used. -The tools other than cprnc also allow finer control, by also -allowing the user to add compiler flags they choose, for both &FORTRAN; and "C", as -well as picking the compiler, linker and and add linker options. Finally the tools -other than cprnc allow you to turn -optimization on (which is off by default but on for the mksurfdata and -interpinic -programs) with the OPT flag so that the -tool will run faster. To get even faster performance, the interpinic, -mksurfdata, and -mkgriddata programs allow you to also use the SMP to -turn on multiple shared memory processors. -When SMP=TRUE you set the number of threads used by the program with -the OMP_NUM_THREADS environment variable. - - -Options used by all: cprnc, interpinic, -mkdatadomain, mkgriddata, and -mksurfdata - -LIB_NETCDF -- sets the location of the &netcdf; library. -INC_NETCDF -- sets the location of the &netcdf; include files. -USER_FC -- sets the name of the &FORTRAN; compiler. - -Options used by: interpinic, mkdatadomain, -mkgriddata, and mksurfdata - -MOD_NETCDF -- sets the location of the &netcdf; &FORTRAN; module. -USER_LINKER -- sets the name of the linker to use. -USER_CPPDEFS -- adds any CPP defines to use. -USER_CFLAGS -- add any "C" compiler flags to use. -USER_FFLAGS -- add any &FORTRAN; compiler flags to use. -USER_LDFLAGS -- add any linker flags to use. -USER_CC -- sets the name of the "C" compiler to use. -OPT -- set to TRUE to compile the code optimized (TRUE or FALSE) - -Options used by: interpinic, mkgriddata, and mksurfdata: - -SMP -- set to TRUE to turn on shared memory parallelism (i.e. -&omp;) (TRUE or FALSE) -Filepath -- list of directories to build source code from. -Srcfiles -- list of source code filenames to build executable from. - -Options used only by cprnc: - -EXEDIR -- sets the location where the executable will be built. -VPATH -- colon delimited path list to find the source files. - -More details on each environment variable. - - -LIB_NETCDF - -This variable sets the path to the &netcdf; library file -(libnetcdf.a). If not -set it defaults to /usr/local/lib. In order to use the tools -you need to build the &netcdf; library and be able to link to it. In order to build -the model with a particular compiler you may have to compile the &netcdf; library with -the same compiler (or at least a compatible one). - - - - - -INC_NETCDF - -This variable sets the path to the &netcdf; include directory (in order to find -the include file netcdf.inc). -if not set it defaults to /usr/local/include. - - - - - -MOD_NETCDF - -This variable sets the path to the &netcdf; module directory (in order to find -the &netcdf; &FORTRAN90; module file when &netcdf; is used with a &FORTRAN90; -use statement. When not set it defaults to the -LIB_NETCDF value. - - - - - -USER_FC - -This variable sets the command name to the &FORTRAN90; compiler to use when -compiling the tool. The default compiler to use depends on the platform. And -for example, on the AIX platform this variable is NOT used - - - - - -USER_LINKER - -This variable sets the command name to the linker to use when linking the object -files from the compiler together to build the executable. By default this is set to -the value of the &FORTRAN90; compiler used to compile the source code. - - - - - -USER_CPPDEFS - -This variable adds additional optional values to define for the C preprocessor. -Normally, there is no reason to do this as there are very few CPP tokens in the CLM -tools. However, if you modify the tools there may be a reason to define new CPP -tokens. - - - - - -USER_CC - -This variable sets the command name to the "C" compiler to use when -compiling the tool. The default compiler to use depends on the platform. And -for example, on the AIX platform this variable is NOT used - - - - - -USER_CFLAGS - -This variable adds additional compiler options for the "C" compiler to use -when compiling the tool. By default the compiler options are picked according -to the platform and compiler that will be used. - - - - - -USER_FFLAGS - -This variable adds additional compiler options for the &FORTRAN90; compiler to use -when compiling the tool. By default the compiler options are picked according -to the platform and compiler that will be used. - - - - - -USER_LDFLAGS - -This variable adds additional options to the linker that will be used when linking -the object files into the executable. By default the linker options are picked according -to the platform and compiler that is used. - - - - - -SMP - -This variable flags if shared memory parallelism (using i&omp;) should be used when -compiling the tool. It can be set to either TRUE or -FALSE, by default it is set to FALSE, so -shared memory parallelism is NOT used. When set to TRUE you can -set the number of threads by using the OMP_NUM_THREADS environment -variable. Normally, the most you would set this to would be to the number of on-node -CPU processors. Turning this on should make the tool run much faster. - - - -Note, that depending on the compiler answers may be different when SMP -is activated. - - - - - - -OPT - -This variable flags if compiler optimization should be used when -compiling the tool. It can be set to either TRUE or -FALSE, by default it is set to FALSE for -mkdatadomain and TRUE for -mksurfdata and interpinic. -Turning this on should make the tool run much faster. - - - -Note, you should expect that answers will be different when OPT -is activated. - - - - - - -Filepath - -All of the tools are stand-alone and don't need any outside code to operate. The -Filepath is the list of directories needed to compile -and hence is always simply "." the current directory. Several tools use -copies of code outside their directory that is in the &cesm; -distribution (either csm_share code or &clm; source code). - - - - - -Srcfiles - -The Srcfiles lists the filenames of the source code to use -when building the tool. - - - - - -EXEDIR - -The cprnc tool uses this variable to set the location of where the executable -will be built. The default is the current directory. - - - - - -VPATH - -The cprnc tool uses this variable to set the colon delimited pathnames of where -the source code exists. The default is the current directory. - - - - - - - - - -There are several files that are copies of the original files from either -models/lnd/clm/src/main, -models/csm_share/shr, or copies from other tool -directories. By having copies the tools can all be made stand-alone, but -any changes to the originals will have to be put into the tool directories -as well. - - - -The README.filecopies (which can be found in -models/lnd/clm/tools) is repeated here. - -&filecopies; - - - - - -General information on running the &FORTRAN; tools - -The tools run either one of two ways, with a namelist to provide options, or -with command line arguments (and NOT both). interpinic and -cprnc run with command line arguments, and the other tools -run with namelists. - - -Running &FORTRAN; tools with namelists - -mkgridata, mksurfdata and -mkdatadomain run with namelists that are read from -standard input. Hence, you create a namelist and then run them by -redirecting the namelist file into standard input as follows: - -./program < namelist - -For programs with namelists there is at least one sample namelist with the -name "program".namelist (i.e. mksurfdata.namelist -for the mksurfdata program). There may also be other sample -namelists that end in a different name besides "namelist". Namelists that you create -should be similar to the example namelist. The namelist values are also documented -along with the other namelists in the: - -models/lnd/clm/bld/namelist_files/namelist_definition.xml -file and default values in the: - -models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -file. - - - -Running &FORTRAN; tools with command line options - -interpinic and cprnc run with command line -arguments. The detailed sections below will give you more information on the command -line arguments specific to each tool. Also running the tool without any arguments -will give you a general synopsis on how to run the tool. For example to get help -on running interpinic do the following. - -cd models/lnd/clm/tools/interpinic -gmake -./interpinic - - - - -Running &FORTRAN; tools built with SMP=TRUE - -When you enable SMP=TRUE on your build of one of the tools that -make use of it, you are using &omp; for shared memory parallelism (SMP). In -SMP loops are run in parallel with different threads run on different processors -all of which access the same memory (called on-node). Thus you can only usefully -run up to the number of processors that are available on a single-node of the machine -you are running on. For example, on the &ncar; machine bluefire there are 32 processors -per node, but the SMT hardware on the machine allows you to submit twice as many -threads or 64 threads. So to run the mksurfdata on bluefire -optimized, with 64 threads you would do the following: - -cd models/lnd/clm/tools/mksurfdata -gmake OPT=TRUE SMP=TRUE -setenv OMP_NUM_THREADS 64 -./mksurfdata < mksurfdata.namelist - - - - - - -The File Creation Process - - -When just creating a replacement file for an existing one, the relevant tool should -be used directly to create the file. When you are creating a set of files for a new -resolution there are some dependencies between the tools that you need to keep in mind -when creating them. The main dependency is that the mkgriddata MUST -be done first as the grid dataset is then input into the other tools. Also look at -. - - - -Creating a complete set of files for input to &clm; - -Create grid and fraction datasets - -First use mkgriddata to create grid and fraction datasets. -See for more information on this. - - - - -Create domain dataset (if NOT already done) - -Next use mkdatadomain to create a domain file for use by -&datm; from the grid and fraction datasets just created. This is required, unless -a domain file already created was input into mkgriddata on -the previous step. -See for more information on this. - - - - -Create surface datasets - -Next use mksurfdata to create a surface dataset, using the grid -dataset as input. -See for more information on this. - - - - -Interpolate aerosol deposition datasets (optional) - -By default the atmosphere model will interpolate -these datasets on the fly, so you don't normally need to do this step. -A reason you might want to do this is to make the read and interpolation faster, -by reducing the amount of data read in and removing the need for the interpolation. -So, if you do, you can use aerdepregrid.ncl to regrid aerosol -deposition datasets to your new resolution using the grid dataset as input. -See for more information on this. - - - - -Interpolate Nitrogen deposition datasets (optional, but only needed if running &clmcn;) - -By default Nitrogen deposition is read in from stream -files at 2-degree resolution and interpolated to the resolution you are running at, -so you don't need to do this step. As with aerosol deposition datasets a reason -you might want to do this is to make the read and interpolation faster, -by reducing the amount of data read in and removing the need for the interpolation. -So, if you do you can use ndepregrid.ncl -to regrid Nitrogen deposition datasets to your new resolution using the grid dataset -as input. -See for more information on this. - - - - -Create some sort of initial condition dataset - - -You then need to do one of the following three options to have an initial dataset -to start from. - - - - - -Use spinup-procedures to create initial condition datasets - -The first option is to do the spinup procedures from arbitrary initial conditions -to get good initial datasets. This is the most robust method to use. -See , , or - for more information on this. - - - - -Use <command>interpinic</command> to interpolate existing initial -condition datasets - -The next option is to interpolate from spunup datasets at a different resolution, using -interpinic. -See for more information on this. - - - - -Start up from arbitrary initial conditions - -The last alternative is to run from arbitrary initial conditions without using any -spun-up datasets. This is inappropriate when using &clmcn; (bgc=cn or cndv) as it -takes a long time to spinup Carbon pools. - - -This is NOT recommended as many fields in &clm; take a long time to equilibrate. - - - - - - - - - - -Enter the new datasets into the &buildnml; XML database - -The last optional thing to do is to enter the new datasets into the &buildnml; -XML database. See for more information on -doing this. This is optional because the user may enter these files into their -namelists manually. The advantage of entering them into the database is so that -they automatically come up when you create new cases. - - - - - - - - -Using the <command>cprnc</command> tool to compare two history files - -cprnc is a tool shared by both CAM and &clm; to compare two -&netcdf; history files. -It differences every field that has a time-axis that is also shared on both files, -and reports a summary of the difference. The summary includes the three largest -differences, as well as the root mean square (RMS) difference. It also gives some -summary information on the field as well. You have to enter at least one file, and up to -two files. With one file it gives you summary information on the file, and with two it -gives you information on the differences between the two. At the end it will give you a -summary of the fields compared and how many fields were different and how many were -identical. - - -Options: - --m = do NOT align time-stamps before comparing --v = verbose output --ipr --jpr --kpr - -See the cprnc -README file for more details which is -repeated here: - -&cprnc_readme; - - - -To compare files with OUT a time axis you can use the cprnc.ncl -&ncl; script in models/lnd/clm/tools/ncl_scripts. It won't give -you the details on the differences but will report if the files are identical or -different. - - - - - - -Using <command>interpinic</command> to interpolate initial conditions to different -resolutions - -"interpinic" is used to interpolate initial conditions from one resolution to another. -In order to do the interpolation you must first run &clm; to create a restart file to -use as the "template" to interpolate into. Running from arbitrary initial conditions -(i.e. finidat = ' ') for a single time-step is sufficient to do this. Make sure the -model produces a restart file. You also need to make sure that you setup the same -configuration that you want to run the model with, when you create the template file. - - -Command line options to interpinic: - --i = Input filename to interpolate from --o = Output interpolated file, and starting template file - - - -There is a sample template file in the models/lnd/clm/tools/interpinic -directory and can be used to run interpolate to. -However, this file was created with an older version of &clm; and hence -we actually recommend that you would do a short run with &clm; to create a template file -to use. - - - - -Example of running &clm; to create a template file for -<command>interpinic</command> to interpolate to - -> cd scripts -> ./create_newcase -case cr_f10_TmpltI1850CN -res f10_f10 -compset I1850CN \ --mach bluefire -> cd cr_f10_TmpltI1850CN -# Set starting date to end of year -> ./xmlchange -file env_conf.xml -id RUN_STARTDATE -val 1948-12-31 -# Set year align to starting year -> ./xmlchange -file env_conf.xml -id DATM_CLMNCEP_YR_ALIGN -val 1948 -# Set to run a cold start -> ./xmlchange -file env_conf.xml -id CLM_FORCE_COLDSTART -val on -# Set to run only a single day, so a restart file will be created on Jan/1/1949 -> ./xmlchange -file env_run.xml -id STOP_N -val 1 -# Then configure, build and run as normal -> ./configure -case -> ./cr_f10_TmpltI1850CN.bluefire.build -> ./cr_f10_TmpltI1850CN.bluefire.submit -# And copy the resulting restart file to your interpinic directory -> cd ../models/lnd/clm/tools/interpinic -> cp /ptmp/$LOGIN/cr_f10_TmpltI1850CN/run/cr_f10_TmpltI1850CN.clm2.r.1949-01-01-00000.nc . - - - - -In the next example we build interpinic optimized with shared -memory on for 64 threads so that it runs as fast as possible, to interpolate one of -the standard 1-degree datasets to the above 10x15 template file that we created. - - -Example of building and running <command>interpinic</command> to -interpolate a 1-degree <filename>finidat</filename> dataset to 10x15 - -> cd models/lnd/clm/tools/interpinic -> gmake OPT=TRUE SMP=TRUE -> env OMP_NUM_THREADS=64 ./interpinic -o cr_f10_TmpltI1850CN.clm2.r.1949-01-01-00000.nc / --i /fs/cgd/csm/inputdata/ccsm4_init/b40.1850.track1.1deg.006/0863-01-01/b40.1850.track1.1deg.006.clm2.r.0863-01-01-00000.nc - - - - -Running interpinic at high resolution can take a long time, so we -recommend that you always build it optimized and with shared memory processing on, to -cut down the run time as much as possible. - - - - -interpinic does NOT work for CNDV (bgc=cndv). - - - - - - -In we give a simpler way to run -interpinic for several standard resolutions at once, with a script -to loop over several resolutions. This is useful for &clm; developers who need to -create many finidat files at once. - - - - - -Using <command>mkgriddata</command> to create grid datasets - -mkgriddata is used to create grid, fraction, and topography -datasets to run &clm; at a new resolution. It is typically the first step in creating -datasets needed to run &clm; at a new resolution (followed by -mksurfdata, and -then the interpolation programs, aerdepregrid.ncl, and -ndepregrid.ncl when running with CN). - - - -mkgriddata namelist - -mkgriddata is controlled by a namelist. There are ten different -namelist items, and you need to use enough of them so that files will be output. -The different types of input datasets contain different input data types, that -correspond to the three different types of output files: grid, fraction, and topography. -Output files for each of these will only be output if there is input data that -correspond to these. If you only have input data for grid locations -- you will only -get an output grid file. If you have both grid and fraction data you will get grid and -fraction data files. If you also have topography data you will also get topo files. - - -Namelist options to mkgriddata include: - -mksrf_fnavyoro -- Navy orography file to use for land fraction -and surface heights. -mksrf_frawtopo -- Raw topography file with just surface -heights. -mksrf_fcamfile -- CAM initial conditions file with -land-fractions and topography -mksrf_fclmgrid -- &clm; grid file -mksrf_fccsmdom -- &cesm; domain file -mksrf_fcamtopo -- CAM topography file -mksrf_lsmlon -- number of longitude for regional grid -mksrf_lsmlatnumber of latitudes for regional grid -mksrf_edgen -- Northern edge for regional grid -mksrf_edgee -- Southern edge for regional grid -mksrf_edges -- Eastern edge for regional grid -mksrf_edgew -- Western edge for regional grid - - - -You need to enter one of the following four options: - - mksrf_fnavyoro - high resolution topo dataset (topo data) - mksrf_lsmlon - number of longitudes - mksrf_lsmlat - number of latitudes - mksrf_edgen - northern edge of grid (degrees) - mksrf_edgee - eastern edge of grid (degrees) - mksrf_edges - southern edge of grid (degrees) - mksrf_edgew - western edge of grid (degrees) - -or - - mksrf_fcamfile - CAM topo file (grid and possibly fraction data) - -or - - mksrf_fccsmdom - &cesm; domain file (both grid, and fraction data) - -or - - mksrf_fclmgrid - &clm; grid or surface dataset file (grid data) - -Note, you can provide more than one of the needed datasets, and the output -data will be determined by the datasets according to an order of precedence. -The order of precedence for data is as follows: - -mksrf_fcamfile -mksrf_fclmgrid -mksrf_fnavyoro -mksrf_fccsmdom - -Grid data then will be established by the file with the highest precedence. -&cesm; domain files sometimes have latitudes and longitudes that are "off" from -the standard by a small amount. By establishing an order of precedence you can ensure -that grid locations exactly match a given standard file, even if the values in the domain -file are off from that. - - - -There are three different major modes for using "mkgriddata" to create grid files -for &clm;: - -mksrf_fnavyoro -- Navy orography file to use for land fraction -and surface heights. -mksrf_frawtopo -- Raw topography file with just surface -heights. -mksrf_fcamfile -- CAM initial conditions file with -land-fractions and topography -mksrf_fclmgrid -- &clm; grid file -mksrf_fccsmdom -- &cesm; domain file -mksrf_fcamtopo -- CAM topography file -mksrf_lsmlon -- number of longitude for regional grid -mksrf_lsmlat -- number of latitudes for regional grid -mksrf_edgen -- Northern edge for regional grid -mksrf_edgee -- Southern edge for regional grid -mksrf_edges -- Eastern edge for regional grid -mksrf_edgew -- Western edge for regional grid - - - -You need to enter one of the following four options: - - mksrf_fnavyoro - high resolution topo dataset (topo data) - mksrf_lsmlon - number of longitudes - mksrf_lsmlat - number of latitudes - mksrf_edgen - northern edge of grid (degrees) - mksrf_edgee - eastern edge of grid (degrees) - mksrf_edges - southern edge of grid (degrees) - mksrf_edgew - western edge of grid (degrees) - -or - - mksrf_fcamfile - CAM topo file (grid and possibly fraction data) - -or - - mksrf_fccsmdom - &cesm; domain file (both grid, and fraction data) - -or - - mksrf_fclmgrid - &clm; grid or surface dataset file (grid data) - -Note, you can provide more than one of the needed datasets, and the output -data will be determined by the datasets according to an order of precedence. -The order of precedence for data is as follows: - -mksrf_fcamfile -mksrf_fclmgrid -mksrf_fnavyoro -mksrf_fccsmdom - -Grid data then will be established by the file with the highest precedence. -&cesm; domain files sometimes have latitudes and longitudes that are "off" from -the standard by a small amount. By establishing an order of precedence you can ensure -that grid locations exactly match a given standard file, even if the values in the domain -file are off from that. - - - -There are three different major modes for using mkgriddata to -create grid files for &clm;: - -Convert &cesm; domain files to &clm; grid files -Create single point or regional area grid files -Convert CAM files to &clm; grid files - - - - - -Convert &cesm; domain files to &clm; grid files - -&cesm; domain files such as used for &datm;, include all the information -needed to create &clm; grid and fraction files. - -Example <command>mkgriddata</command> namelist to convert &cesm; 4x5 domain files to &clm; grid files - -&clmexp - mksrf_fccsmdom= -'/fs/cgd/csm/inputdata/lnd/dlnd7/domain.lnd.4x5_gx3v5.060404.nc' - mksrf_fclmgrid= -'/fs/cgd/csm/inputdata/lnd/clm2/griddata/griddata_4x5_060404.nc' -/ - - - - -Notice that in the above example, a &clm; grid file is included as well, even though -it's not required. The reason for this is to ensure that the latitude and longitudes -on the output files exactly match a standard grid file. - - - - - - -Create single point or regional area grid files - -The process to create single-point or regional area &clm; grid files is the same. -You enter the number of latitudes and longitudes you want on your output file and -the extent of the grid: North, East, South and West. You also tell -mkgriddata that -you are entering a "regional" grid and you also enter the standard Navy orography -dataset (or your own orography file if desired). For a single point you simply -enter "1" for the number of latitudes and longitudes, but you still enter the -grid extent (of the single grid cell). Here is a sample regional namelist to create -a 5x5 regional grid over the Amazon: - -Example <command>mkgriddata</command> namelist to create regional grid over Amazon - -&clmexp - mksrf_fnavyoro= -"/fs/cgd/csm/inputdata/lnd/clm2/rawdata/mksrf_navyoro_20min.c010129.nc" - mksrf_lsmlon = 5 - mksrf_lsmlat = 5 - mksrf_edgee = 303.75 - mksrf_edgew = 286.25 - mksrf_edges = -15. - mksrf_edgen = -4. -/ - - - - - -Currently you can NOT have regional grids that straddle both -sides of the Greenwich (longitude = zero) line. - - - - -You should enter longitudes with values from 0 to 360 East. - - - - - -Convert <acronym>CAM</acronym> files to &clm; grid files (deprecated) - -Older CAM initial files included all the information needed to create &clm; -grid files. Newer CAM files no longer include land fraction data. Hence you -can use CAM files to give you the grid coordinates, but you need other data -to give you the land-mask and topography. Since, CAM files no longer -contain the needed information, this option is now deprecated. In most cases you should -use one of the other two options. - - - - - - - -Using <command>mkdatadomain</command> to create domain datasets for &datm; or docn from &clm; grid datasets - -"mkdatadomain" is used to convert &clm; grid and fraction datasets into domain datasets -that can be used by either the "datm" or "docn" models. Most often &clm; users will want -to convert the grid datasets they just created using mkgriddata into -domain datasets to be used by &datm; for an "I" case. mkdatadomain is -controlled by a namelist, and has a very straight forward operation with only four -namelist items all of which are required. You specify which output mode you want "datm" -or "docn", and then set the input &clm; grid and frac datasets, and the output domain file. - - -Example <command>mkdatadomain</command> namelist to create a domain file from -&clm; frac and grid data files - -&domain_nl - dtype = "datm" - f_fracdata = -'/fs/cgd/csm/inputdata/lnd/clm2/griddata/fracdata_4x5_USGS_070110.nc' - f_griddata = -'/fs/cgd/csm/inputdata/lnd/clm2/griddata/griddata_4x5_060404.nc' - f_domain = -'domain.lnd.fv4x5_USGS.090117.nc' -/ - - - - - -Using mksurfdata to create surface datasets from grid datasets - -mksurfdata is used to create surface-datasets from grid datasets and raw datafiles -at half-degree resolution to produce files that describe the surface characteristics -needed by &clm; (fraction of grid cell covered by different land-unit types, and fraction -for different vegetation types, as well as things like soil color, and soil texture, -etc.). To run mksurfdata you can either use the -mksurfdata.pl script which will create namelists for you using the &buildnml; -XML database, or you can run it by hand using a namelist that you provide (possibly -modeled after an example provided in the -models/lnd/clm/tools/mksurfdata directory). The namelist for -mksurfdata is sufficiently complex that we recommend using the -mksurfdata.pl tool to build them. In the next section -we describe how to use the mksurfdata.pl script and the following -section gives more details on running mksurfdata by hand and the -various namelist input variables to it. - - -Running <command>mksurfdata.pl</command> - -The script mksurfdata.pl can be used to run the -mksurfdata program for several configurations, resolutions, -simulation-years and simulation year ranges. It will create the needed namelists for -you and move the files -over to your inputdata directory location (and create a list of the files created, and -for developers this file is also a script to import the files into the svn inputdata -repository). It will also use the &buildnml; XML database -to determine the correct input files to use, and for transient cases it will create -the appropriate mksrf_fdynuse file with the list of files for each -year needed for this case. And in the case of urban single-point -datasets (where surface datasets are actually input into mksurfdata) -it will do the additional processing required so that the output dataset -can be used once again by mksurfdata. Because, it figures out -namelist and input files for you, it is recommended that you use this script for creation -of standard surface datasets. If you need to create surface datasets for customized -cases, you might need to run mksurfdata on it's own. But you -could use mksurfdata.pl with the "-debug" option to give you -a namelist to start from. -For help on mksurfdata.pl you can use the "-help" option as below: - -> cd models/lnd/clm/tools/mksurfdata -> mksurdata.pl -help - -The output of the above command is: - -&mksurfdatapl; - - - -To run the script with optimized mksurfdata for a 4x5 degree grid -for 1850 conditions, on bluefire you would do the following: - -Example of running <command>mksurfdata.pl</command> to create a 4x5 resolution -<filename>fsurdat</filename> for a 1850 simulation year - -> cd models/lnd/clm/tools/mksurfdata -> gmake -> mksurfdata.pl -y 1850 -r 4x5 - - - - - - -Running <command>mksurfdata</command> by Hand - -In the above section we show how to run mksurfdata through -the mksurfdata.pl using input datasets that are in the &buildnml; -XML database. When you are running with input datasets that are NOT available in -the XML database you either need to add them as outlined in -, or you need to run mksurfdata -by hand, as we will outline here. - - - -Preparing your <command>mksurfdata</command> namelist - -When running mksurfdata by hand you will need to prepare your -own input namelist. There are sample namelists that are setup for running on the -&ncar; machine bluefire. You will need to change the filepaths to -run on a different machine. The list of sample namelists include - -mksurfdata.namelist -- standard sample namelist. -mksurfdata.regional -- sample namelist to -build for a regional grid dataset (5x5_amazon) -mksurfdata.singlept -- sample namelist to -build for a single point grid dataset (1x1_brazil) - -Note, that one of the inputs mksrf_fdynuse is a filename that -includes the filepaths to other files. The filepaths in this file will have to -be changed as well. You also need to make sure that the line lengths remain the same -as the read is a formatted read, so the placement of the year in the file, must remain -the same, even with the new filenames. One advantage of the mksurfdata.pl -script is that it will create the mksrf_fdynuse file for you. - - -We list the namelist items below. Most of the namelist items are filepaths to give to -the input half degree resolution datasets that you will use to scale from to the -resolution of your grid dataset. -You must first specify the input grid dataset for the resolution to output for: - -mksrf_fgrid Grid dataset - -Then you must specify settings for input high resolution datafiles - -mksrf_ffrac land fraction and land mask dataset -mksrf_fglacier Glacier dataset -mksrf_fglacierregion Glacier region ID dataset -mksrf_flai Leaf Area Index dataset -mksrf_flanwat Land water dataset -mksrf_forganic Organic soil carbon dataset -mksrf_fmax Max fractional saturated area dataset -mksrf_fsoicol Soil color dataset -mksrf_fsoitex Soil texture dataset -mksrf_ftopo Topography dataset (this is used to limit -the extent of urban regions and is used for glacier multiple elevation classes) - -mksrf_furban Urban dataset -mksrf_fvegtyp PFT vegetation type dataset -mksrf_fvocef Volatile Organic Compound Emission Factor -dataset -mksrf_fgdp GDP dataset -mksrf_fpeat Peatland dataset -mksrf_fabm Agricultural fire peak month dataset -mksrf_ftopostats Topography statistics dataset -mksrf_fvic VIC parameters dataset -mksrf_fch4 Inversion-derived CH4 parameters dataset - -You specify the ASCII text file with the land-use files. - -mksrf_fdynuse "dynamic land use" for transient -land-use/land-cover changes. This is an ASCII text file that lists the filepaths -to files for each year and then the year it represents (note: you MUST change the -filepaths inside the file when running on a machine NOT at &ncar;). -We always use this file, even for creating datasets of a fixed year. Also note -that when using the "pft_" settings this file will be an XML-like file with settings -for PFT's rather than filepaths (see below). - - - -And optionally you can specify settings for: - -all_urban If entire area is urban (typically used for -single-point urban datasets, that you want to be exclusively urban) -no_inlandwet If TRUE, set wetland to 0% over land -(renormalizing other landcover types as needed); wetland will only be used for ocean -points. (Only applies to CLM4.5 version of mksurfdata_map, for which the default is -TRUE.) -mksrf_firrig Irrigation dataset, if you want -activate the irrigation model over generic cropland -(experimental mode, normally NOT used) -mksrf_gridnm Name of output grid resolution (if not -set the files will be named according to the number of longitudes by latitudes) -mksrf_gridtype Type of grid (default is 'global') -nglcec number of glacier multiple elevation classes. -Can be 0, 1, 3, 5, or 10. When using the resulting dataset with &clm; you can then run -with glc_nec of either 0 or this value. - (experimental normally use the default of 0, when running with the land-ice -model in practice only 10 has been used) -numpft number of Plant Function Types (PFT) -in the input vegetation mksrf_fvegtyp dataset. You change -this to 20, if you want to create a dataset with prognostic crop activated. The -vegetation dataset also needs to have prognostic crop types on it as well. - (experimental normally not changed from the default of 16) -outnc_large_files If output should be in &netcdf; large file -format -outnc_double If output should be in double -precision (normally we turn this on) -pft_frc array of fractions to override PFT -data with for all gridpoints (experimental mode, normally NOT used). -pft_idx array of PFT indices to override PFT -data with for all gridpoints (experimental mode, normally NOT used). -soil_clay percent clay soil to override -all gridpoints with (experimental mode, normally NOT used). -soil_color Soil color to override -all gridpoints with (experimental mode, normally NOT used). -soil_fmax Soil maximum fraction to override -all gridpoints with (experimental mode, normally NOT used). -soil_sand percent sandy soil to -override all gridpoints with (experimental mode, normally NOT used). - - - -After creating your namelist, -when running on a non &ncar; machine you will need to get the files -from the inputdata repository. -In order to retrieve the files needed for mksurfdata you can do the following on your -namelist to get the files from the inputdata repository, using the -check_input_data script which also allows you to export data to -your local disk. - -Getting the raw datasets for <command>mksurfdata</command> to your local -machine using the <command>check_input_data</command> script - -> cd models/lnd/clm/tools/mksurfdata -# First remove any quotes and copy into a filename that can be read by the -# check_input_data script -> sed "s/'//g" namelist > clm.input_data_list -# Run the script with -export and give the location of your inputdata with $CSMDATA -> ../../../../../scripts/ccsm_utils/Tools/check_input_data -datalistdir . \ --inputdata $CSMDATA -check -export -# You must then do the same with the flanduse_timeseries file referred to in the namelist -# in this case we add a file = to the beginning of each line -> awk '{print "file = "$1}' landuse_timeseries_hist_simyr2000-2000.txt > clm.input_data_list -# Run the script with -export and give the location of your inputdata with $CSMDATA -> ../../../../../scripts/ccsm_utils/Tools/check_input_data -datalistdir . \ --inputdata $CSMDATA -check -export - - - - -Experimental options to <command>mksurfdata</command> - -The options: pft_frc, pft_idx, soil_clay, soil_color, soil_fmax, and soil_sand are also -new and considered experimental. They provide a way to override the PFT and soil -values for all grid points to the given values that you set. This is useful for -running with single-point tower sites where the soil type and vegetation is known. -Note that when you use pft_frc, all other landunits will be zeroed out, and the -sum of your pft_frc array MUST equal 100.0. Also note that when using the "pft_" -options the mksrf_fdynuse file instead of having filepath's -will be an XML-like file with PFT settings. Unlike the file of file-paths, you will -have to create this file by hand, mksurfdata.pl will NOT be able -to create it for you (other than the first year which will be set to the values -entered on the command line). Note, that when &ptclm; is run, it CAN create these -files for you from a simpler format (see ). -Instead of a filepath you have a list of XML elements that give information on the PFT's -and harvesting for example: - -<pft_f>100</pft_f><pft_i>1</pft_i><harv>0,0,0,0,0</harv><graz>0</graz> - -So the <pft_f> tags give the PFT fractions and the <pft_i> tags give the -index for that fraction. Harvest is an array of five elements, and grazing is a single -value. Like the usual file each list of XML elements goes with a year, and there is -limit on the number of characters that can be used. - - - - - -Standard Practices when using <command>mksurfdata</command> - -In this section we give the recommendations for how to use mksurfdata -to give similar results to the files that we created when using it. - - -If you look at the standard surface datasets that we have created and provided for use, -there are three practices that we have consistently done in each (you also see these in -the sample namelists and in the mksurfdata.pl script). The first is -that we always output data in double precision (hence outnc_double -is set to .true.). The next is that we always use the procedure -for creating transient datasets (using mksrf_fdynuse) even when -creating datasets for a fixed simulation year. This is to ensure that the fixed year -datasets will be consistent with the transient datasets. When this is done a -"landuse_timeseries" dataset will be created -- but will NOT be used in &clm;. If you look -at the sample namelist mksurfdata.namelist you note that it -sets mksrf_fdynuse to the file -landuse_timeseries_hist_simyr2000.txt, where the single file entered is -the same PFT file used in the rest of the namelist (as mksrf_fvegtyp). -The last practice that we always do is to always set mksrf_ftopo, -even if glacier elevation classes are NOT active. This is -important in limiting urban areas based on topographic height, and hence is important -to use all the time. The glacier multiple elevation classes will be used as well if -you are running a compset with the active glacier model. - - -There are two other important practices for creating urban single point datasets. The -first is that you often will want to set all_urban to -.true. so that the dataset will have 100% of the gridcell output -as urban rather than some mix of: urban, vegetation types, and other landunits. The -next practice is that most of our specialized urban datasets have custom values for -the urban parameters, hence we do NOT want to use the global urban dataset to get -urban parameters -- we use a previous version of the surface dataset for the urban -parameters. However, in order to do this, we need to append onto the previous surface -dataset the grid and land mask/land fraction information from the grid and fraction -datasets. This is done in mksurfdata.pl using the NCO -program ncks. An example of doing this for the Mexico City, Mexico -urban surface dataset is as follows: - -> ncks -A $CSMDATA/lnd/clm2/griddata/griddata_1x1pt_mexicocityMEX_c090715.nc \ -$CSMDATA/lnd/clm2/surfdata/surfdata_1x1_mexicocityMEX_simyr2000_c100407.nc -> ncks -A $CSMDATA/lnd/clm2/griddata/fracdata_1x1pt_mexicocityMEX_navy_c090715.nc \ -$CSMDATA/lnd/clm2/surfdata/surfdata_1x1_mexicocityMEX_simyr2000_c100407.nc - -Note, if you look at the current single point urban surface datasets you will note -that the above has already been done. - - -The final issue is how to build mksurfdata. When NOT optimized -mksurfdata is very slow, and can take many hours to days to -even run for medium resolutions such as one or two degree. So usually you will want -to run it optimized. Possibly you also want to use shared memory parallelism using -&omp; with the SMP option. The problem with running optimized is that -answers will be different when running optimized versus non-optimized for most -compilers. So if you want answers to be the same as a previous surface dataset, you -will need to run it on the same platform and optimization level. Likewise, running -with or without &omp; may also change answers (for most compilers it will NOT, however -it does for the IBM compiler). However, answers should be the same regardless of the -number of threads used when &omp; is enabled. Note, that the output surface datasets -will have attributes that describe whether the file was written out optimized or not, -with threading or not and the number of threads used, to enable the user to more -easily try to match datasets created previously. For more information on the different -compiler options for the &clm4; tools see . - - - - - - - -Using &ncl; scripts <command>ndepregrid.ncl</command> and -<command>aerdepregrid.ncl</command> to interpolate aerosol deposition datasets - -Unlike the other tools, these are &ncar; Command Language (&ncl;) scripts -and you will need to get a copy of &ncl; in order to use them. You also won't have to -build an executable in order to use them, hence no Makefile is provided. &ncl; is provided -for free download as either binaries or source code from: -http://www.ncl.ucar.edu/. The &ncl; -web-site also contains documentation on &ncl; and it's use. - - -By default at this point neither of these scripts HAS to be used, -as the model is now constructed to read aerosol and Nitrogen deposition from 2-degree -datasets and interpolate to the model resolution on the fly. The main reason you might -want to do this now, is for better performance for single-point simulations. - - -Both the ndepregrid.ncl and aerdepregrid.ncl -scripts have similar interfaces and you customize the output resolution and -characteristics based on the settings of environment variables that you set (if you -don't set any of the variables, the script has defaults that it will use). -The list of environment variables that can be set are: - -RES -- output resolution name -RCP -- representative concentration pathway for future scenarios -(example 2.6, 4.5, 6, or 8.5) -SIM_YR -- simulation year (example 1850 or 2000) -SIM_YR_RNG -- simulation year range (example 1850-2000 or -1850-2100) -GRDFIL -- full pathname of grid file to use -(in place of getting the default grid file based on the RES value) -CSMDATA -- &cesm; inputdata directory -CLM_ROOT -- root directory for &clm; (models/lnd/clm directory) - - - - -You MUST provide either RES or both -GRDFIL AND RES. If you -just give RES the default namelist database in -models/lnd/clm/bld will be used to find the default grid -file based on the resolution name RES. If you provide -GRDFIL the input pathname of the gridfile provided will be used, -and the output filename will include RES as part of it's name -to designate it as an output file at that resolution. - - - -Both scripts assume that you will be interpolating from a native resolution of 1.9x2.5 -and using the default files found in the namelist database to interpolate from. If you -want to interpolate from another resolution or use other files, you would need to edit -the scripts to do so. Both scripts also use a bilinear interpolation to do the -regridding. The environment variables: RCP, SIM_YR, -and SIM_YR_RNG will be used to query the namelist database to -determine which native dataset to interpolate from. If you don't provide valid -values for these variables, it won't be able to find a dataset to interpolate from. -You can use the build-namelist script to query what the valid values for these can -be. Likewise, when you use RES to determine the grid file to interpolate -to, it needs to be a valid value from the namelist database. - - -The scripts can be used to interpolate from (and create output) constant or -transient datasets. -Constant datasets specify the SIM_YR and set SIM_YR_RNG -to constant (which is also the default). Transient datasets need -to specify both SIM_YR and SIM_YR_RNG, where -SIM_YR is set to the first year in the interval (typically 1850). - - -The default for CSMDATA works for &ncar; computers, but will need to -be set to the top level directory location of your &cesm; input data on other computers. -If you set this as a default for your shell when you login (for example with your -$HOME/.cshrc if you use csh) you won't have to set it each time -you run the script. CLM_ROOT will default to the proper location -when you run it in the models/lnd/clm/tools/ncl_script -directory. It is only useful if you want to run the script out of a different -directory. - - -Using <command>ndepregrid.ncl</command> to interpolate Nitrogen deposition datasets - -ndepregrid.ncl interpolates the Nitrogen deposition datasets from one resolution -to another. - - - -Interpolating Nitrogen deposition files is no longer needed, because the model can -read Nitrogen deposition files at one resolution and interpolate to the resolution the -model is running at on the fly. Interpolating to another -resolution is only useful for very course resolutions, if you want to save some computing -resources in reading larger datasets. For example, this may be useful in obtaining -single-point datasets. - - - -For example, to interpolate to an output resolution of 0.9x1.25, for a constant -simulation-year of 1850, you would do the following: - -> env RES=0.9x1.25 SIM_YR=1850 ncl ndepregrid.ncl - - - - - -Using <command>aerdepregrid.ncl</command> to interpolate Aerosol deposition datasets - -aerdepregrid.ncl interpolates the Aerosol deposition datasets from one resolution. -It can be used to interpolate either constant datasets (for example: -aerosoldep_monthly_2000_0.9x1.25_c090828.nc) or transient datasets (for example: -aerosoldep_monthly_1849-2006_0.9x1.25_c090830.nc). - - - -Interpolating aerosol deposition files is no longer needed, because the &datm; model can -read aerosol deposition files at one resolution and interpolate to the resolution the -model is running at on the fly. Interpolating to another -resolution is only useful for very course resolutions, if you want to save some computing -resources in reading larger datasets. For example, this may be useful in obtaining -single-point datasets. - - - -For example, to interpolate to an output resolution of 4x5, for a transient -simulation-year range of 1850 to 2100 and the rcp of 8.5, you would do the following: - -> env RES=4x5 SIM_YR=1850 SIM_YR_RNG=1850-2100 RCP=8.5 ncl ndepregrid.ncl - - - - - - -How to Customize Datasets for particular Observational Sites - -There are two ways to customize datasets for a particular observational site. The first -is to customize the input to the tools that create the dataset, and the second is to -over-write the default data after you've created a given dataset. Depending on the tool -it might be easier to do it one way or the other. In we list the files that are most likely to be -customized and the way they might be customized. Of those files, the ones you are most -likely to customize are: fatmlndfrc, fsurdat, faerdep (for &datm;), and -stream_fldfilename_ndep. Note mksurfdata as documented previously -has options to overwrite the vegetation and soil types. For more information on this also see - and &ptclm; uses these methods to -customize datasets see . - - -Another aspect of customizing your input datasets is customizing the input atmospheric -forcing datasets. See the for more -information on this. Also the chapter on &ptclm; in -has information on using the AmeriFlux tower site data as atmospheric forcing. - - - - -Conclusion of tools description - -We've given a description of how to use the different tools with &clm; to create -customized datasets. In the next chapter we will talk about how to make these -files available for build-namelist so that you can easily create simulations -that include them. In the chapter on single-point and regional datasets we also -give an alternative way to enter new datasets without having to edit files. - - - - - diff --git a/doc/UsersGuide/trouble_shooting.xml b/doc/UsersGuide/trouble_shooting.xml deleted file mode 100644 index 418cfabaae..0000000000 --- a/doc/UsersGuide/trouble_shooting.xml +++ /dev/null @@ -1,545 +0,0 @@ - - -Trouble Shooting Problems - -In this chapter we give some guidance on what to do when you encounter some of the -most common problems. We can't cover all the problems that a user could potentially -have, but we will try to help you recognize some of the most common situations. -And we'll give you some suggestions on how to approach the problem to come up with -a solution. - - -In general you will run into one of three type of problems: - -configure-time -build-time -run-time - -You may also run into problems with create_newcase itself, or -with the archiving scripts -- for those problems you should consult the -&cesmrel; Scripts User's Guide. - - - -Trouble with Configuration - -The first type of problem happens when you invoke the configure -case -command. This indicates there is something wrong with your template files, or input -datasets, or the details of what you are trying to configure the model to do. -There's also a trouble-shooting chapter in the &cesmrel; -Scripts User's Guide. Many of the problems with configuration can be resolved -with the guidelines given there. Here we will restrict ourselves to problems from the -&clm; or &datm; templates or input files. - -Example of configure problem with missing datasets - -> ./create_newcase -case T31rcp6 -res T31_g37 -compset IRCP60CN \ --mach bluefire -> ./configure -case - -The following is what is displayed to the screen. - -Generating resolved namelist, prestage, and build scripts -configure done. -adding use_case 1850-2100_rcp6_transient defaults for var clm_demand with val flanduse_timeseries -adding use_case 1850-2100_rcp6_transient defaults for var clm_start_type with val startup -adding use_case 1850-2100_rcp6_transient defaults for var model_year_align_ndep with val -1850 -adding use_case 1850-2100_rcp6_transient defaults for var rcp with val 6 -adding use_case 1850-2100_rcp6_transient defaults for var sim_year with val 1850 -adding use_case 1850-2100_rcp6_transient defaults for var sim_year_range with val -1850-2100 -adding use_case 1850-2100_rcp6_transient defaults for var stream_year_first_ndep with val -1850 -adding use_case 1850-2100_rcp6_transient defaults for var stream_year_last_ndep with val -2100 -adding use_case 1850-2100_rcp6_transient defaults for var use_case_desc with val Simulate -transient land-use, aerosol and Nitrogen deposition changes with historical data from -1850 to 2005 and then with the RCP6 scenario from AIM - -build-namelist - No default value found for flanduse_timeseries. - Are defaults provided for this resolution and land mask? -ERROR: generate_resolved.csh error for lnd template -configure error: configure generated error in attempting to created resolved scripts - - -The important thing to note here is the line: - -ERROR: generate_resolved.csh error for lnd template - -which tells us that the problem is in the land template. It may also indicate problems -in one of the other templates (atm, ccsm, cpl, glc, ice, or ocn), in which case you -should consult the appropriate model user's guide, and examine the given template file -in Tools/Templates. For more information on working with template -files see . - - -In the example above, it's obvious that the problem is coming from the &clm; &buildnml;, -in other situations it might not be so obvious where the problem is occurring. In such -cases it might be useful to add a "set echo" command to the top of the template file so -that each command in the template will be echoed to the screen and you can see what -is happening and where the error is occurring. - -set echo - - - -In the example, the error is that the &clm; XML database does NOT have a -flanduse_timeseries for the given resolution, rcp scenario and ocean mask. -That means you will need to create the file and then supply the file into your case. See - for more information on creating files, and see - for more information on adding files to the -XML database. Alternatively, you can provide the file to your case by creating -a user namelist as shown in . - - - -The two most common problems from your &clm; template will be errors from the &clm; -&configure; or &buildnml;. For more information on these scripts see: - and -the section on &CLMBLDNML;. - - - - - -Trouble with Building - -Here's an example of running the build for a case and having it fail in the land model -build. As you can see it lists which model component is being built and the build log -for that component. - - CCSM BUILDEXE SCRIPT STARTING - - Build Libraries: mct pio csm_share -Sat Jun 19 21:21:19 MDT 2010 /ptmp/erik/test_build/mct/mct.bldlog.100619-212107 -Sat Jun 19 21:22:18 MDT 2010 /ptmp/erik/test_build/pio/pio.bldlog.100619-212107 -Sat Jun 19 21:23:18 MDT 2010 -/ptmp/erik/test_build/csm_share/csm_share.bldlog.100619-212107 -Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/cpl.bldlog.100619-212107 -Sat Jun 19 21:24:00 MDT 2010 /ptmp/erik/test_build/run/atm.bldlog.100619-212107 -Sat Jun 19 21:24:06 MDT 2010 /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 -ERROR: clm.buildexe.csh failed, see /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 -ERROR: cat /ptmp/erik/test_build/run/lnd.bldlog.100619-212107 - -You can then examine the build log that failed and see what went wrong. Most compilers -will give the full filepath and line number for the file that filed to compile. - - - - -Trouble with Running - -Tracking down problems while the model is running is much more difficult to do -than configure or build problems. In this section we will give some suggestions -on how to find run time problems. Below we show the log file results of a job -that aborted while running. - - CCSM PRESTAGE SCRIPT HAS FINISHED SUCCESSFULLY -Sun Jun 20 18:24:06 MDT 2010 -- CSM EXECUTION BEGINS HERE -Sun Jun 20 18:24:35 MDT 2010 -- CSM EXECUTION HAS FINISHED -Model did not complete - see /ptmp/erik/test_run/run/cpl.log.100620-182358 - -In the next section we will talk about using the different log files to track -down problems, and find out where the problem is coming from. In the section -after that we give some general advice on debugging problems and some suggestions -on ideas that may be helpful to track the problem down. Some of the examples -below are from the &KnownBugs; file. - - -Tracking Problems by Querying Log Files - -The first thing to do when tracking down problems is to query the different log -files to see if you can discover where the problem occurs, and any error messages about -it. It's important to figure out if the problem comes in at initialization or in the -run phase of the model, and in which model component the problem happens. There -are different log files for the different major components, and they all end -with the date and time in YYMMDD-HHMMSS format (2-digit: year, month, day, hour -minute and second). When the model runs to completion the log files will be copied -to the logs directory in the script directory, but when the -model fails they will remain in the run directory. Here's an example list of -log files from an "I" case where the model dies in the land model initialization. -For "I" cases the sea-ice and ocean components are just stubs and don't create -log files (and unless running with the active land-ice model "glc" log files won't -be created either). - -atm.log.100620-182358 -ccsm.log.100620-182358 -cpl.log.100620-182358 -lnd.log.100620-182358 - - - - -The coupler log file - -The first log file to check is the coupler log file so that you can see where -the model dies and which model component it fails in. When the model dies at -initialization the last model component listed is the component that failed. - - -Example of a case that fails in the &clm; land model initialization. - -(seq_timemgr_clockPrint) Prev Time = 00001201 00000 -(seq_timemgr_clockPrint) Next Time = 99991201 00000 -(seq_timemgr_clockPrint) Intervl yms = 9999 0 0 - -(seq_mct_drv) : Initialize each component: atm, lnd, ocn, and ice -(seq_mct_drv) : Initialize atm component -(seq_mct_drv) : Initialize lnd component - - - - - -The ccsm log file - -The ccsm log files are to some extent the "garbage collection" of log output. The -&clm; sends it's output from it's master processor, but sends other output and possibly -errors to the ccsm log file. Because, of this, often error messages are somewhere in the -ccsm log file. However, since there is so much other output it may be difficult to find. -For example, here is some output from an older version of &cesm; (&cesm102;) where the -RTM river routing file (before it was converted to &netcdf;) was not provided and -the error on the open statement for the file was embedded near the end of the ccsm log -file. - -NODE# NAME -( 0) be1105en.ucar.edu -"/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line -239: 1525-155 The file name provided in the OPEN statement for unit 1 has zero length or -contains all blanks. The program will recover by ignoring the OPEN statement. -"/gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/lnd/clm/src/riverroute/RtmMod.F90", line -241: 1525-001 The READ statement on the file fort.1 cannot be completed because the end -of the file was reached. The program will stop. - -Running: ./ccsm.exe -Please wait... - -Memory usage for ./ccsm.exe (task # 0) is: 51696 KB. Exit status: 1. Signal: 0 - -Although the example is from an earlier version of the model it still serves to -illustrate finding problems from the ccsm log file. - - -When working with the ccsm log file, for a run-time problem, you will need to be able -to separate it's output into three categories: pre-crash, crash, and post-crash. The -pre-crash section is everything that is normal output for good operation of the model. -The crash section is the section where the model dies and reports on the actual problem. -the post-crash section is the cleanup and finalization after the model dies. The most -important part of this of course is the crash section. The tricky part is distinguishing -it from the other sections. Also because the ccsm log file most likely has duplicated -output from multiple processors it is even more difficult to distinguish the different -sections and to some extent the sections may be intertwined, as different processors -reach the different sections at different times. Because, of this reducing the number of -processors for your simulation may help you sort out the output in the file (see -). Also much of the output from the ccsm log file are -system level information having to do with &mpi; multiprocessing. Usually you can ignore -this information, but it makes it more difficult to trudge through. - - -Sometimes the ccsm log file is the ONLY file available, because the model terminates -early in initialization. In this case understanding the output in the ccsm log file -becomes even more important. This also indicates the model did NOT advance far enough -to reach the initialization of the individual model components. This may mean that the -initialization of the multiprocessing for &mpi; and/or &omp; failed, or that the -reading of the driver namelist file "drv_in" failed. - - -Here we show those three sections for a ccsm log file where a two task job failed on -reading the namelist file. For a typical job with many tasks similar sections of this -will be repeated not just twice but for each task and hence make it harder to read. - - -Pre-crash section of the ccsm log file - -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. -ATTENTION: 0031-378 MP_EUIDEVICE setting ignored when LoadLeveler is not being used. -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. - 0:INFO: 0031-724 Executing program: </usr/local/lsf/7.0/aix5-64/bin/lsnrt_run> - 1:INFO: 0031-724 Executing program: </usr/local/lsf/7.0/aix5-64/bin/lsnrt_run> - 0:/contrib/bin/ccsm_launch: process 401894 bound to logical CPU 0 on host be0310en.ucar.edu ... - 1:/contrib/bin/ccsm_launch: process 439264 bound to logical CPU 1 on host be0310en.ucar.edu ... - 0:INFO: 0031-619 64bit(us, Packet striping on) ppe_rmas MPCI_MSG: MPI/MPCI library was compiled on Wed Aug 5 13:36:06 2009 - 0: - 1:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 - 1:. - 1:LAPI is using lightweight lock. - 0:LAPI version #14.26 2008/11/23 11:02:30 1.296 src/rsct/lapi/lapi.c, lapi, rsct_rpt53, rpt53s004a 09/04/29 64bit(us) library compiled on Wed Apr 29 15:30:42 2009 - 0:. - 0:LAPI is using lightweight lock. - 0:Use health ping for failover/recovery - 1:Use health ping for failover/recovery - 0:Initial communication over instance 2. - 1:Initial communication over instance 0. - 1:IB RDMA initialization completed successfully - 1:The MPI shared memory protocol is used for the job - 0:IB RDMA initialization completed successfully - 0:LAPI job ID for this job is: 1684890719 - 0:The MPI shared memory protocol is used for the job - 0:(seq_comm_setcomm) initialize ID ( 7 GLOBAL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 2 ATM ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 1 LND ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 4 ICE ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 5 GLC ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 3 OCN ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_setcomm) initialize ID ( 6 CPL ) pelist = 0 1 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 8 CPLATM ) join IDs = 6 2 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 9 CPLLND ) join IDs = 6 1 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 10 CPLICE ) join IDs = 6 4 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 11 CPLOCN ) join IDs = 6 3 ( npes = 2) ( nthreads = 1) - 0:(seq_comm_joincomm) initialize ID ( 12 CPLGLC ) join IDs = 6 5 ( npes = 2) ( nthreads = 1) - 0: - 0: (seq_comm_printcomms) ID layout : global pes vs local pe for each ID - 0: gpe LND ATM OCN ICE GLC CPL GLOBAL CPLATM CPLLND CPLICE CPLOCN CPLGLC nthrds - 0: --- ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ ------ - 0: 0 : 0 0 0 0 0 0 0 0 0 0 0 0 1 - 1: 1 : 1 1 1 1 1 1 1 1 1 1 1 1 1 - 1: - 0: (t_initf) Read in prof_inparm namelist from: drv_in - 1: (seq_io_init) cpl_io_stride, iotasks or root out of bounds - resetting to defaults 4 0 1 - 0: piolib_mod.f90 1353 1 2 1 2 - 1: piolib_mod.f90 1353 1 2 1 2 - 0: pio_support::pio_die:: myrank= 0 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride - 1: pio_support::pio_die:: myrank= 1 : ERROR: piolib_mod.f90: 1354 : not enough procs for the stride - - - -Crash section of the ccsm log file - - 0: - 0: Traceback: - 1: - 1: Traceback: - 0: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in - 1: Offset 0x00000c4c in procedure __pio_support_NMOD_piodie, near line 88 in file pio_support.F90.in - 0: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 - 1: Offset 0x00000fd0 in procedure __piolib_mod_NMOD_init, near line 1354 in file piolib_mod.F90 - 1: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 - 0: Offset 0x00000398 in procedure __seq_io_mod_NMOD_seq_io_init, near line 247 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/shr/seq_io_mod.F90 - 0: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 - 0: --- End of call chain --- - 1: Offset 0x0001aa88 in procedure ccsm_driver, near line 465 in file /gpfs/proj2/fis/cgd/home/erik/clm_trunk/models/drv/driver/ccsm_driver.F90 - 1: --- End of call chain --- - - - -Post-crash section of the ccsm log file - - 1:Communication statistics of task 1 is associated with task key: 1684890719_1 - 0:Communication statistics of task 0 is associated with task key: 1684890719_0 - 0: - 0:Running: ./ccsm.exe - 0:Please wait... - 0: - 0:Memory usage for ./ccsm.exe (task # 0) is: 198892 KB. Exit status: 134. Signal: 0 - 1: - 1:Running: ./ccsm.exe - 1:Please wait... - 1: - 1:Memory usage for ./ccsm.exe (task # 0) is: 198572 KB. Exit status: 134. Signal: 0 -INFO: 0031-656 I/O file STDOUT closed by task 0 -INFO: 0031-656 I/O file STDERR closed by task 0 -ERROR: 0031-250 task 0: IOT/Abort trap -INFO: 0031-656 I/O file STDOUT closed by task 1 -INFO: 0031-656 I/O file STDERR closed by task 1 -ERROR: 0031-250 task 1: IOT/Abort trap -INFO: 0031-639 Exit status from pm_respond = 0 -ATTENTION: 0031-386 MP_INSTANCES setting ignored when LoadLeveler is not being used. -Job /usr/local/lsf/7.0/aix5-64/bin/poejob /contrib/bin/ccsm_launch /contrib/bin/job_memusage.exe ./ccsm.exe - -TID HOST_NAME COMMAND_LINE STATUS TERMINATION_TIME -===== ========== ================ ======================= =================== -00000 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 -00001 be0310en /contrib/bin/ccs Exit (134) 08/31/2010 12:32:57 - - - - - -The &clm; log file - -Of course when you are working with and making changes to &clm;, most of your focus -will be on the &clm; log file and the errors it shows. As already pointed out -if you don't see errors in the lnd.log.* file you should look -in the ccsm.log.* to see if any errors showed up there. - - -Here's an example of the lnd.log.* file when running -&PTSMODE; with initial conditions (this is bug 1025 in the &KnownBugs; file). - - Successfully initialized variables for accumulation - - reading restart file I2000CN_f09_g16_c100503.clm2.r.0001-01-01-00000.nc - Reading restart dataset - ERROR - setlatlon.F:Cant get variable dim for lat or lsmlat - ENDRUN: called without a message string - - - - - -The &datm; log file - -When working with "I cases" the second most common problems after &clm; problems are -problems with the data atmosphere model. So examining the atm.log.* -is important. - - -Here's an example of a problem that occurs when the wrong prescribed aerosol file -is given to a pt1_pt1 simulation. - -(datm_comp_init) atm mode = CLMNCEP -(shr_strdata_init) calling shr_dmodel_mapSet for fill -(shr_strdata_init) calling shr_dmodel_mapSet for remap - ('shr_map_getWts') ERROR: yd outside bounds 19.5000000000000000 -(shr_sys_abort) ERROR: ('shr_map_getWts') ERROR yd outside 90 degree bounds -(shr_sys_abort) WARNING: calling shr_mpi_abort() and stopping - - - - - -The batch log files - -The names of the batch log files will depend on the batch system of the machine -that is being used. They will normally be in the script directory. Usually, they -don't contain important information, but they are a last resort place to look for -error messages. On the &ncar; IBM system "bluefire" the batch files are called -with names that start with "poe" and then either "stderr" or "stdout", with the -job number at the end. - - - - - - -General Advice on Debugging Run time Problems - -Here are some suggestions on how to track down a problem while running. In general -if the problem still occurs for a simpler case, it will be easier to track down. - -Run in DEBUG mode -Run with a smaller set of processors -Run in serial mode with a single processor -Run at a lower resolution -Run a simpler case -Run with a debugger - - - - -Run in DEBUG mode - -The first thing to try is to run in DEBUG mode so that float point trapping will be -triggered as well as array bounds checking and other things the compiler can turn -on to help you find problems. To do this edit the &envbuild; file and set DEBUG - to TRUE as follows: - -> ./xmlchange -file env_build.xml -id DEBUG -val TRUE - - - - - -Run with a smaller set of processors - -Another way to simplify the system is to run with a smaller set of processors. You -will need to clean the configure and edit the env_mach_pes.xml. -For example, to run with four processors: - -> ./configure -cleanall -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_OCN -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_CPL -val 4 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_GLC -val 4 -> ./configure -case - -Another recommended simplification is to run without threading, so set the -NTHRDS for each component to "1" if it isn't already. Sometimes, -multiprocessing problems require a certain number of processors before they occur -so you may not be able to debug the problem without enough processors. But, it's always -good to reduce it to as low a number as possible to make it simpler. For threading -problems you may have to have threading enabled to find the problem, but you can run -with 1, 2, or 3 threads to see what happens. - - - - -Run in serial mode with a single processor - -Simplifying to one processor removes all multi-processing problems and makes -the case as simple as possible. If you can enable USE_MPI_SERIAL -you will also be able to run interactively rather than having to submit to a job -queue, which sometimes makes it easier to run and debug. If you can use -USE_MPI_SERIAL you can also use threading, but still run interactively -in order to use more processors to make it faster if needed. - -> ./configure -cleanall -# Set tasks and threads for each component to 1 -# You could also set threads to something > 1 for speed, but still -# run interactively if threading isn't an issue. -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ATM -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_ATM -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_LND -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_LND -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_ICE -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_ICE -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_OCN -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_OCN -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_CPL -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_CPL -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTASKS_GLC -val 1 -> ./xmlchange -file env_mach_pes.xml -id NTHRDS_GLC -val 1 -# If mpi-serial capability is available on the machine you are using -# set USE_MPI_SERIAL to true so that you can run interactively -> ./xmlchange -file env_conf.xml -id USE_MPI_SERIAL -val TRUE -> ./configure -case -# Then build your case -# And finally run, by running the *.run script interactively -# (If you were able to set USE_MPI_SERIAL to true) - - - - - -Run at a lower resolution - -If you can create a new case running at a lower resolution and replicate the problem -it may be easier to solve. This of course requires creating a whole new case, and trying -out different lower resolutions. - - - - -Run a simpler case - -Along the same lines, you might try running a simpler case, trying another compset -with a simpler setup and see if you can replicate the problem and then debug from that -simpler case. Again, of course you will need to create new cases to do this. - - - - -Run with a debugger - -Another suggestion is to run the model with a debugger such as: dbx, -gdb, or totalview. Often to run with a debugger -you will need to reduce the number of processors as outlined above. Some debuggers such -as dbx will only work with one processor, while more advanced -debuggers such as totalview can work with both &mpi; tasks and OMP -threads. Even simple debuggers though can be used to query core files, to see where -the code was at when it died (for example using the where in -dbx for a core file can be very helpful. For help in running -with a debugger you will need to contact your system administrators for the machine -you are running on. - - - - - - - - diff --git a/doc/clm3_0_ChangeLog b/doc/clm3_0_ChangeLog deleted file mode 100644 index 60b925b8f4..0000000000 --- a/doc/clm3_0_ChangeLog +++ /dev/null @@ -1,13104 +0,0 @@ -=============================================================== -Tag name: clm3_8_00 -Originator(s): erik (erik) -Date: Tue May 4 22:39:18 MDT 2010 -One-line Summary: Get future scenarios working, finalize documentation, bring in MEGAN VOC and CNDV, simplify, mksurfdata optimization, fix bugs: snow enthalpy, BMOZ, pergro, use pft weights from fsurdat NOT finidat - -Purpose of changes: - -Get all of the future scenarios working (other than rcp=6.0) and get all of the datasets -for these scenarios (pftdyn, fndepdyn, and aerdep files, for rcp=2.6,4.5, and 8.5). -Finalize the User's Guide for now, with reviews from: Sam, Keith, Dave, and Sean, as -well as more work on tools chapter, and adding testing chapter in appendix. We brought -in the MEGAN version of the Volatile Organic Compounds (VOC) module which also reads -in VOC emission factors from the surface dataset, and hence all fsurdat files needed -to be replaced. Along with this the mksurfdata tool was changed in order to handle VOC's -and effort was made to optimize it, add shared memory paralelism, and do memory -optimization. We also removed the old Dynamic Global Vegetation Model (DGVM) and replaced -it with the Carbon Nitrogen Dynamic Vegetation model (CNDV). Make some simplifications -in the configure system to always use the CCSM version of build files, remove some -unused options, put standalone test options last in configure. Improve documenation in -XML files for configure and build-namelist options. - -Fix many different bugs. Enthalpy in snow combination was sometimes NOT conserved and now -is. There was a problem running DryDeposition for the BMOZ compset that is now fixed. -There were multiple issues running PERGRO testing that is now fixed. Previously, if -both the finidat file and the fsurdat file had PFT weights on them, the values from -the finidat file was used, now it will use the values from the fsurdat file. There are -also several cases where if the weights are different it will abort with an error, or -at least send a message to the log file about the differences. - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Type of tag: doc - -Describe any changes made to build system: - Switch cndv for dgvm, Have configure disallow bad cases - Change configure to NOT allow supln with spinup cases - Do NOT allow exit_spinup and ad_spinup at the same time. - Only allow voc to be set for seq_ccsm NOT ext_ccsm_seq - Remove carbon_aero and pio from configure (always build with pio) - emove unused configure options: clm_exe, -clm_exedir, and -clm_bld. - Move standalone testing options to the end of help. Use CCSM version - of mkSrcfiles/mkDepends, separate config vars into categories, work - on documentation with comments from Keith/Sam. - -Describe any changes made to the namelist: - Add 2000-2100 simulation year range as allowed option - - Two new history fields: - - TSOI_10CM = soil temperature in top 10cm of soil (K) - SOILWATER_10CM = soil liquid water + ice in top 10cm of soil (kg/m2) - - Check for some files based on rcp (fpftdyn, ndepdyn, and aerdep) - - Add in ability to add a user namelist in your case directory to input - namelist items at configure time. Simply add a file called "user_nl_clm" - as a valid namelist and the items in that namelist will show up in the initial - BuildConf/clm.buildnml.csh file. - -List any changes to the defaults for the boundary datasets: - get urbanc_alpha grid and frac files in - get in new single-point datasets - new qtr-degree, T62 and T85 fsurdat - new f10, f05, f09, 1850 fsurdat - new rcp=8.5, f19 pftdyn, - new rcp=4.5 f09, f19, f10 pftdyn - new rcp=2.6 f09, f19, f10 pftdyn - new rcp=8.5/4.5/2.6 f19 aerdep 1850-2100 datasets - new rcp=8.5/4.5 f19 fndepdyn 1850-2100 datasets - new rcp=2.6/4.5 f10, f45, f25, f09 aerdep/ndepdyn datasets - new rcp=2.6/4.5,8.5 f19 decadal averages for ndepdat - (Note: harvest was updated in PFTDYN files and raw PFT input files for 2006). - New 10x15 and 4x5 finidat files so that transient cases will work at those resolutions - New finidat files for 1-deg and 2-deg (from fully coupled simulations) - New datasets for I cases that are set in scripts - Duplicate cn datasets for cndv - New pft-physiology files with extra fields for CNDV - Remove 360x720 files, gx3v5, gx1v5 files - Remove 1x1.25, 2x2.5, and 2.5x3.33 grid resolutions - Remove gx1v3, gx1v4, gx1v5 land masks, add drydep defaults. - add mksrf_fvegtyp@1000-1004 - -Describe any substantial timing or memory changes: None - -Code reviewed by: - snow changes came from dlawren and also reviewed by oleson - PFT weight change also reviewed by: dlawren, slevis, oleson - CNDV came from slevis - VOC changes came from Francis Vitt and Jean-Francois Lamarque - history changes came from Keith Oleson, reviewed by Dave Lawrenece - OpenMP bug fix came from Mariana-Vertenstein, reviewed by Pat Worley - -List any svn externals directories updated (csm_share, mct, etc.): all - scripts to scripts4_100406a - drv to drvseq3_1_23 - datm to datm8_100406 - csm_share to share3_100407 - pio to pio1_0_18 - timing to timing_091021 - -Summary of testing: - - bluefire: All PASS except... -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -029 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -043 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -044 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -045 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -046 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -048 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 12+84 arb_ic ............FAIL! rc= 12 - bluefire interactive testing: All PASS except... -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 5 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - bluefire/CCSM testing: All PASS except -FAIL PST.f45_g37.I1850.bluefire.compare.clm3_7_10 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm3_7_10 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_15 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_10 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_7_10 -BFAIL PST.f10_f10.I8520CN.bluefire.compare.clm3_7_10 -BFAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm3_7_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm3_7_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm3_7_10 - jaguar: All PASS except.. -005 smB51 TSM.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 144 arb_ic ..............FAIL! rc= 10 -006 erB51 TER.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -007 brB51 TBR.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -026 smLI2 TSM.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -027 erLI2 TER.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -028 brLI2 TBR.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -030 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 -031 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 12+84 arb_ic ............FAIL! rc= 5 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/ifort interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -014 erOC4 TER.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_FAIL! rc= 5 -015 brOC4 TBR.sh _nrvansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arbFAIL! rc= 5 -016 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 4 -018 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -019 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -020 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 - edinburgh/ifort: All PASS except... -002 erA92 TER.sh _sc_dm clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic ................FAIL! rc= 7 -003 brA92 TBR.sh _sc_dm clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic .............FAIL! rc= 6 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 72+72 cold ...............FAIL! rc= 7 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 5 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -011 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG53 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_00 - -Changes answers relative to baseline: Yes! - snow change has a small effect on climate (see below) - Bringing in MEGAN VOC changes answers for VOC fluxes in a diagnostic way - Changing to use weights from fsurdat file rather than finidat file, changes - answers for cases with finidat startup files, if the weights are different. - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change: same climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - ccsm4_0_beta35 - bluefire - -compset B_1850_TRACK1_CN -res f19_g16 - - MSS location of control simulations used to validate new climate: - -/DLAWREN/csm/b40.1850.track1.2deg.003.snow - - URL for LMWG diagnostics output used to validate new climate: - -http://www.cgd.ucar.edu/ccr/paleo/b40.snow/b40.1850.track1.2deg.003.snow-b40.1850.track1.2deg.003.control/ -http://www.cgd.ucar.edu/ccr/dlawren/research/clm4.0_dev/b40.1850.track1.2deg.003.snowa-b40.1850.track1.2deg.003.controla/setsIndex.html - -=============================================================== -=============================================================== -Tag name: clm3_7_15 -Originator(s): erik (erik) -Date: Tue Apr 27 10:13:57 MDT 2010 -One-line Summary: Finish User's Guide, surfdata files for urban-1pt, fix mksurfdata ifort bugs, work with testing - -Purpose of changes: - -Fix all urban single-point datasets (mexicocity, urbanc_alpha), fix get_regional script -to work. Add more documentation on mksurfdata to users-guide, add pergro procedure -examples, more to testing section. Remove "moving the sun" warning. Fix -ndeplintInterp.ncl and getregional_datasets.ncl scripts. - -Bugs fixed (include bugzilla ID): - 1125 (T85, qtr-degree and urban pt surface datasets) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1150 (Bug in indices in getregional_datasets.ncl script) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Type of tag: std-test - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: New fsurdat files for urban-1p datasets - 1x1_vancouverCAN, 1x1_mexicocityMEX, 1x1_urbanc_alpha, 1x1_asphaltjungleNJ - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): datm - - datm to datm8_100406 - -List all files eliminated: - ->>>>>>>>>>> Remove test lists no longer used - D models/lnd/clm/test/system/tests_pretag_bangkok - D models/lnd/clm/test/system/tests_pretag_calgary - D models/lnd/clm/test/system/tests_posttag_lightning_nompi - -List all files added and what they do: - ->>>>>>>>>>> Add plot of pergro testing - A models/lnd/clm/doc/UsersGuide/pergro.jpg ->>>>>>>>>>> Add in plotting for pergro testing - A models/lnd/clm/tools/ncl_scripts/RMSbluefire.dat - A models/lnd/clm/tools/ncl_scripts/RMSintrepid.dat - A models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>> Remove tests no longer used, work on documentation - M models/lnd/clm/test/system/test_driver.sh ---- Remove calgary, work on doc - M models/lnd/clm/test/system/gen_test_table.sh - Remove note for calgary - M models/lnd/clm/test/system/README ------------ Clarify documentation - M models/lnd/clm/test/system/CLM_runcmnd.sh ---- Remove calgary ->>>>>>>>>>> Fix ifort compiler problems, point to $CSMDATA locations of 1850 ->>>>>>>>>>> and 2000 PFT datasets - M models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig ---- Change path - M models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr2000.txt - Change path - M models/lnd/clm/tools/mksurfdata/mksurfdata.regional ------- Change path - M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn --------- Change path - M models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr1850.txt - Change path - M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept ------- Change path - M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist ------- Change path - M models/lnd/clm/tools/mksurfdata/README -------------------- Update documentation - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 -------------- outnc_double to - .true., fix implicit none statements, add documentation - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl ------------- Add ability to set - inputdata directory - M models/lnd/clm/tools/mksurfdata/creategridMod.F90 --------- Change where to loops ->>>>>>>>>>> Fix bug in time axis and getregional indices - M models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl - Fix time axis and check it - M models/lnd/clm/tools/ncl_scripts/README ------------- Add note about pergroPlot - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl ->>>>>>>>>>> Fix CLM_USRDAT_NAME and add urban 1pt datasets - M models/lnd/clm/bld/clm.cpl7.template ------------------------ Set resolution for CLM_USRDAT_NAME - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New urban pt1 - datasets: 1x1_vancouverCAN, 1x1_mexicocityMEX, 1x1_urbanc_alpha, 1x1_asphaltjungleNJ ->>>>>>>>>>> Remove SNICAR message about moving the sun - M models/lnd/clm/src/biogeophys/SNICARMod.F90 ->>>>>>>>>>> Finish off current User's Guide ->>>>>>>>>>> Bring rel03->rel04 updates in, run ispell on everything ->>>>>>>>>>> Work on mksurfdata and testing sections, give instructions for pergro ->>>>>>>>>>> Add help from mksurfdata.pl and test_driver.sh scripts - M models/lnd/clm/doc/KnownBugs -- Add note that mkgriddata can not straddle Greenwich - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/clm_ug.xml - M models/lnd/clm/doc/UsersGuide/adding_files.xml - M models/lnd/clm/doc/UsersGuide/appendix.xml - M models/lnd/clm/doc/UsersGuide/config_cache.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/Makefile - M models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - M models/lnd/clm/doc/UsersGuide/special_cases.xml - -Summary of testing: - - bluefire: All PASS except... -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -029 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -043 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -044 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -045 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -046 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -048 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 12+84 arb_ic ............FAIL! rc= 12 - bluefire interactive testing: All PASS except... -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 5 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - bluefire/CCSM testing: All PASS except -FAIL PST.f45_g37.I1850.bluefire.compare.clm3_7_10 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm3_7_10 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_15 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_10 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_7_10 -BFAIL PST.f10_f10.I8520CN.bluefire.compare.clm3_7_10 -BFAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm3_7_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm3_7_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm3_7_10 - jaguar: All PASS except.. -005 smB51 TSM.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 144 arb_ic ..............FAIL! rc= 10 -006 erB51 TER.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -007 brB51 TBR.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -026 smLI2 TSM.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -027 erLI2 TER.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -028 brLI2 TBR.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -030 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 -031 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 12+84 arb_ic ............FAIL! rc= 5 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/ifort interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -014 erOC4 TER.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_FAIL! rc= 5 -015 brOC4 TBR.sh _nrvansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arbFAIL! rc= 5 -016 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 4 -018 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -019 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -020 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 - edinburgh/ifort: All PASS except... -002 erA92 TER.sh _sc_dm clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic ................FAIL! rc= 7 -003 brA92 TBR.sh _sc_dm clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic .............FAIL! rc= 6 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 72+72 cold ...............FAIL! rc= 7 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 5 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -011 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG53 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_14 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_7_14 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Thu Apr 8 16:15:35 MDT 2010 -One-line Summary: Fix rcp=2.6/4.5 1-degree fndepdyn filenames - -Purpose of changes: - -Fix the names of the rcp=2.6/4.5 1-degree fndepdyn filenames (had a 100208 file creation -date but should be 100407). - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1125 (T85, qtr-degree and urban pt surface datasets) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Fix fndepdyn filenames - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Fix fndepdyn filenames - -Summary of testing: None - -=============================================================== -=============================================================== -Tag name: clm3_7_13 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Thu Apr 8 10:53:06 MDT 2010 -One-line Summary: Add in missing rcp=2.6/6 use-cases, and fix syntax errors in the namelist_defaults file - -Purpose of changes: - -Add in missing use cases for rcp=4.5 and rcp=6 transient future scenarios. Fix syntax errors in the namelist_defaults_clm -file. - -Bugs fixed (include bugzilla ID): Above two problems - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1125 (T85, qtr-degree and urban pt surface datasets) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Nonae - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - -A models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml -A models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Fix syntax errors - -Summary of testing: None, other than script creation testing - -=============================================================== -=============================================================== -Tag name: clm3_7_12 -Originator(s): erik (erik) -Date: Thu Apr 8 00:30:30 MDT 2010 -One-line Summary: rcp=2.6/4.5 datasets for fndepdyn and aerdepdat, fix some minor issues, new 1pt urban surfdata files - -Purpose of changes: - -Add in urban single-point surfdata files. Add in regridded ndepdyn/aerdep files: f09, -f45, f10, f25. Fix name of f05, 1850 fsurdat file, add in new urban single point -datasets, add back urbanc_alpha grid/frac files. Put rcp in filenames for aerdep/ndep -regrid scripts. chomp frac filename in mksurfdata.pl, for urban single-point files. Make -OPT=TRUE default for mksurfdata. Lengthen allowed gridname for mksurfdata. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1125 (T85, qtr-degree and urban pt surface datasets) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - aerdep/ndepdyn for rcp=2.6/4.5 f10, f45, f25, f09 - fix name of f05 fsurdata file for 1850 - get urbanc_alpha grid and frac files in - get in new urban single-point datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - csm_share to share3_100407 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/tools/mksurfdata/Makefile ------ make OPT=TRUE the default -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 -- lengthen gridname to 32 -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl - make sure to chomp fracdata file - -M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl - Add rcp to filename -M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl --- Add rcp to filename - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New datasets - aerdep/ndepdyn for rcp=2.6/4.5 f10, f45, f25, f09 - fix name of f05 fsurdata file for 1850 - get urbanc_alpha grid and frac files in - get in new urban single-point datasets - -Summary of testing: - - bluefire interactive testing: All PASS except up to 014 smJ74 -010 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -011 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -012 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -010 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 - -=============================================================== -=============================================================== -Tag name: clm3_7_11 -Originator(s): erik (erik) -Date: Wed Apr 7 11:59:22 MDT 2010 -One-line Summary: qtr-degree and T85 surfdata, rcp=2.6/4.5 datasets, doc updates - -Purpose of changes: - -Documentation updates, for users guide and namelist and configure xml files (rel04 to -rel05 update). Fix missing deallocate (bug 1133), and line length for NEE. Changes in -mksurfdata so that will run for qtr-degree. New rcp datasets for 4.5 and 2.6, aerdep -(only f19)/ndepdyn/pftdyn datasets. Fix CN spinup test, fix test name for bluefire tests. -Add in qtr-degree and T85 surfdata files. - -Bugs fixed (include bugzilla ID): - 1141 (CN spinup test) - 1137 (qtr-deg fsurdat) - 1136 (line length for NEE in histFlds) - 1135 (miss smG45 test) - 1133 (missing deallocate) - 1125 (T85, qtr-degree and urban pt surface datasets) - (partial T85 and qtr-degree) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1125 (T85, qtr-degree and urban pt surface datasets) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - new qtr-degree and T85 fsurdat - new rcp=8.5, f19 pftdyn, rcp=4.5 f09, f19, f10 pftdyn - new rcp=2.6 f09, f19, f10 pftdyn - new rcp=4.5/2.6 f19 aerdep 1850-2100 datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv - scripts to scripts4_100406a - drv to drvseq3_1_23 - -List all files eliminated: - - D models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850.txt -- Rename with _hist_ - D models/lnd/clm/tools/mksurfdata/pftdyn_simyr2000.txt -- Rename with _hist_ - -List all files added and what they do: - - A models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr2000.txt - Renamed from above - A models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr1850.txt - Renamed from above - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>> Turn supln off for spinup modes - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do - M models/lnd/clm/test/system/tests_pretag_bluefire --------------- Change name of missing test smG45->smG55 - ->>>>>>>>>>>>> Change names of pftdyn text files to include _hist_ ->>>>>>>>>>>>> Memory updates so uses less memory (allocate just before needed ->>>>>>>>>>>>> deallocate after done). This is from the ccsm4_0_rel05 update ->>>>>>>>>>>>> Mariana started the changes and Erik added some more. - M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist - M models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig - M models/lnd/clm/tools/mksurfdata/mksurfdata.regional - M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept - M models/lnd/clm/tools/mksurfdata/README - M models/lnd/clm/tools/mksurfdata/mkurbanparMod.F90 ----- Memory updates - - M models/lnd/clm/bld/clm.cpl7.template - Use $CASETOOLS for Makefile - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - - new qtr-degree and T85 fsurdat - new rcp=8.5, f19 pftdyn, rcp=4.5 f09, f19, f10 pftdyn - new rcp=2.6 f09, f19, f10 pftdyn - new rcp=4.5/2.6 f19 aerdep 1850-2100 datasets - ->>>>>>>>>>>>> Documentation udpates updating from rel04 to ccsm4_0_rel05 - M models/lnd/clm/bld/configure -------------------------- change CVS to SVN - M models/lnd/clm/bld/config_files/config_definition.xsl - Correct name - M models/lnd/clm/bld/config_files/config_definition.xml - Add category for maxpft - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - Work with categories - and improve descriptions, remove rpntpath - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl - Seperate out - stand-alone testing categories, improve documentation, work - on categories. - ->>>>>>>>>>>>> Documentation udpates updating from rel04 to ccsm4_0_rel05 ->>>>>>>>>>>>> Updates from Sam, Keith, and Sean, more doc on tools and appendix - M models/lnd/clm/doc/UsersGuide/co2_streams.txt - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/clm_stylesheet.dsl - M models/lnd/clm/doc/UsersGuide/clm_ug.xml - M models/lnd/clm/doc/UsersGuide/adding_files.xml - M models/lnd/clm/doc/UsersGuide/appendix.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/Makefile - M models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - M models/lnd/clm/doc/UsersGuide/special_cases.xml - M models/lnd/clm/doc/KnownBugs --------------------------- Add notes on: - bugzilla bugs: 669, 1024, 1124, 1125, 1127 - - M models/lnd/clm/src/main/accFldsMod.F90 -- Deallocate outside #ifdef - M models/lnd/clm/src/main/histFldsMod.F90 - Shorten long line for NEE - -Summary of testing: - - bluefire: All PASS up to 024, blHN1 test except... -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - bluefire interactive testing: All PASS except (up to 26 brAK8 test) -006 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -007 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -008 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -010 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -011 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -012 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 -018 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 4 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - jaguar interactive testing: All PASS up to smAK4 test except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -008 blAK4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............SKIPPED* -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -008 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_10 - -Changes answers relative to baseline: no (b4b) - -=============================================================== -=============================================================== -Tag name: clm3_7_10 -Originator(s): erik (erik) -Date: Mon Mar 22 23:54:48 MDT 2010 -One-line Summary: Fix drydep so that BMOZ case will work - -Purpose of changes: - -Update externals, fix drydep bug (so that BMOZ case will run bug 1132). Add 10x15 and 4x5 -finidat files, so that bluefire.clm.auxtest PET and PST cases will work. Fix -documentation on transient CO2. - -Bugs fixed (include bugzilla ID): - 1132 (clm failure for BMOZ compset) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1125 (T85, qtr-degree and urban pt surface datasets) - 1133 (missing deallocate) - 1135 (miss smG45 test) - 1136 (line length for NEE in histFlds) - 1137 (qtr-deg fsurdat) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1141 (CN spinup test) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - New 10x15 and 4x5 finidat files so that transient cases will work at those resolutions - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, pio - Update to ccsm4_0_beta47 versions - scripts to scripts4_100322b - drv to drvseq3_1_20 - datm to datm8_100225 - pio to pio1_0_18 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/doc/UsersGuide/Makefile ---------- Fix conversion to xml -M models/lnd/clm/doc/UsersGuide/special_cases.xml - Fix transient CO2 doc -M models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - Fix CO2 file - -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl --- Fix historical rcp value -M models/lnd/clm/tools/interpinic/runinit_ibm.csh - Fix so will run - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Add 10x15, 4x5 - finidat files - -M models/lnd/clm/src/main/clm_comp.F90 ------- check drydep_method -M models/lnd/clm/src/main/clmtypeInitMod.F90 - check drydep_method -M models/lnd/clm/src/main/clm_atmlnd.F90 ----- check drydep_method, don't pass - drydep stuff unless drydep_method is DD_XLND - -Summary of testing: - - bluefire/CCSM testing: All PASS except... -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_10 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_07 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_09 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_7_09 -Originator(s): erik (erik) -Date: Sun Mar 21 21:08:54 MDT 2010 -One-line Summary: Fix snow enthalpy bug, cndv datasets, various fixes - -Purpose of changes: - -Fix snow enthalpy bug from Dave Lawrence. Add rcp to mksurfdata.pl. Add new 2006 datasets -for pftdyn files for mksurfdata. Fix history bug. New rcp 8.5 1-degree pftdyn dataset. -Duplicate all cn datasets for cndv. pergro use cases output in double precision. Some -work on documentation. - -Bugs fixed (include bugzilla ID): - 1128 (cndv needs the same input files as cn) - 1130 (History problem on restarts) - 1131 (pergro use cases need double output files) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1125 (T85, qtr-degree and urban pt surface datasets) - 1132 (clm failure for BMOZ compset) - 1133 (missing deallocate) - 1135 (miss smG45 test) - 1136 (line length for NEE in histFlds) - 1137 (qtr-deg fsurdat) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1141 (CN spinup test) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - - New 1-degree rcp=8.5 pftdyn dataset with harvest for 2006 - Duplicate cn datasets for cndv - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - snow changes come from dlawren and also reviewed by oleson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>> Add AIM rcp datasets -A models/lnd/clm/tools/mksurfdata/pftdyn_rcp6.0_simyr1850-2100.txt - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>> New 2006 file -M models/lnd/clm/tools/mksurfdata/pftdyn_rcp2.6_simyr1850-2100.txt - New 2006 file -M models/lnd/clm/tools/mksurfdata/pftdyn_rcp4.5_simyr1850-2100.txt - New 2006 file -M models/lnd/clm/tools/mksurfdata/pftdyn_rcp8.5_simyr1850-2100.txt - New 2006 file -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl - Add rcp as argument -M models/lnd/clm/tools/mksurfdata/README -------- Document mksurfdata.pl and rcp files - -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl - Get rid of old masks - -M models/lnd/clm/tools/interpinic/runinit_ibm.csh - Get rid of old masks/grids, and sim_year -M models/lnd/clm/tools/interpinic/README ---------- Update documentation - -M models/lnd/clm/tools/mkgriddata/mkgriddata.ccsm_dom - Add clm grid file -M models/lnd/clm/tools/mkgriddata/README ------------- More documentation - -M models/lnd/clm/bld/namelist_files/use_cases/pergro.xml ------ Output history in double -M models/lnd/clm/bld/namelist_files/use_cases/pergro0.xml ----- Output history in double -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Duplicate cn files for cndv - New 1-degree rcp=8.5 pftdyn file - -M models/lnd/clm/src/main/histFileMod.F90 - Make sure 3D fields defined before output - -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 - conserve enthalpy on snow combination - -M models/lnd/clm/doc/IMPORTANT_NOTES ----- Add notes about fine-mesh -M models/lnd/clm/doc/UsersGuide/Makefile - Remove file for realclean - -Summary of testing: - - bluefire: -003 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic .............FAIL! rc= 11 -004 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v7 -6 arb_ic ...................FAIL! rc= 7 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 7 -010 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v7 72+72 arb_ic ......FAIL! rc= 11 -011 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 arb_ic ............FAIL! rc= 7 -015 brF92 TBR.sh 17p_vodsrsc_dm clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v7 72+72 cold .......FAIL! rc= 11 -016 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 cold .............FAIL! rc= 7 -019 brEH1 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 24+24 arbFAIL! rc= 13 -020 blEH1 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 7 -023 brHN1 TBR.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -5+-5 cFAIL! rc= 13 -024 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 7 -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - bluefire interactive testing: -003 brA74 TBR.sh _nrsc_ds clm_std^nl_urb_br 20030101:NONE:1800 1x1_brazil navy -5+-5 arb_ic .....FAIL! rc= 13 -006 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -007 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -008 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -010 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -011 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -012 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 -016 brJ74 TBR.sh 4p_nrcasasc_ds clm_std^nl_urb_br 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_icFAIL! rc= 11 -018 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 4 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -031 brF93 TBR.sh 17p_vodsrsc_do clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v7 72+72 cold .......FAIL! rc= 11 -032 blF93 TBL.sh 17p_vodsrsc_do clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 cold .............FAIL! rc= 7 -035 brL83 TBR.sh _nrsc_do clm_std^nl_urb_br 20020115:NONE:3600 5x5_amazon navy -10+-10 arb_ic ...FAIL! rc= 13 -040 blK74 TBL.sh 17p_cndvsc_s clm_std 19971231:NONE:1800 1x1_brazil navy -670 arb_ic ............FAIL! rc= 7 -045 bl754 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 7 -047 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 7 -049 bl754 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 2 - jaguar interactive testing: -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/ifort: interactive testing: -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -009 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -010 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -011 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -013 smOC4 TSM.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 10 -014 erOC4 TER.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_FAIL! rc= 5 -015 brOC4 TBR.sh _nrvansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arbFAIL! rc= 5 -017 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -018 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -019 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 - edinburgh/ifort -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_08 - -Changes answers relative to baseline: YES - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change: same climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - ccsm4_0_beta35 - bluefire - -compset B_1850_TRACK1_CN -res f19_g16 - - MSS location of control simulations used to validate new climate: - -/DLAWREN/csm/b40.1850.track1.2deg.003.snow - - URL for LMWG diagnostics output used to validate new climate: - -http://www.cgd.ucar.edu/ccr/paleo/b40.snow/b40.1850.track1.2deg.003.snow-b40.1850.track1.2deg.003.control/ -http://www.cgd.ucar.edu/ccr/dlawren/research/clm4.0_dev/b40.1850.track1.2deg.003.snowa-b40.1850.track1.2deg.003.controla/setsIndex.html - -=============================================================== -=============================================================== -Tag name: clm3_7_08 -Originator(s): Mariana Vertenstein (mvertens) -Date: Fri Mar 12 13:26:09 MST 2010 -One-line Summary: Removal of check for weights if dynamic land use is used - -Purpose of changes: -This one line change enabled the vast majority of the CCSM tests to pass. - -Verified that ERI 20th century tests in CCSM test suite for ccsm4_0_beta46 now passed with this changed - -This was reviewed by Dave Lawrence and Sam Levis - -Everything from clm3_7_07 applies except for the following: - -M biogeophys/BiogeophysRestMod.F90 - - if ( nsrest == 1 .or. (nsrest == 3 .and. fpftdyn /= ' ') )then - - ! Do NOT do any testing for restart or a pftdyn branch case - + if ( nsrest == 1 .or. fpftdyn /= ' ' )then - + ! Do NOT do any testing for restart or a pftdyn case - also added in a #if CNDV - -M biogeochem/CNDVEstablishmentMod.F90 -M main/clmtypeInitMod.F90 - - fix for case when leaf area index is pathologically large - the original fix for this was not longer working - and the above changes address this - -M bld/build-namelist -M bld/namelist_files/namelist_defaults_clm.xml - - fixed issues related to getting fndepdat for -bgc cndv - -=============================================================== -Tag name: clm3_7_07 -Originator(s): erik (erik) -Date: Wed Mar 10 23:35:37 MST 2010 -One-line Summary: New finidat datasets for 1-deg, 2-deg, and abort if weights from finidat/fsurdat files are too different, and use fsurdat files as truth - -Purpose of changes: - -Use surfdata weights and stop if finidat file weights are too different. Use ccsm4init -datasets for finidat files for 1-deg and 2-deg. In I compsets, setup for special I case -finidat files. Update scripts. Drydep changes from Francis. Change cell_method to -cell_methods. Allow clm_start_type to be overridden if on use_case. Only set orb_iyearad -for standalone clm testing. Allow vars on use_cases to not be set for some configs. Make -sure all BGC modes are set for variables on use_cases. Set cold-start for pergro cases. -Update documentation. - -Bugs fixed (include bugzilla ID): - 1098 (use weights from surdat file rather than finidat file) - 1121 (history variable attribute cell_methods misnamed) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1132 (clm failure for BMOZ compset) - 1133 (missing deallocate) - 1135 (miss smG45 test) - 1136 (line length for NEE in histFlds) - 1137 (qtr-deg fsurdat) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1141 (CN spinup test) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - - New finidat files for 1-deg and 2-deg (from fully coupled simulations) - New datasets for I cases that are set in scripts - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, dlawren, slevis, oleson - -List any svn externals directories updated (csm_share, mct, etc.): scripts - - scripts to scripts4_100310c - - This version of scripts sets up special finidat files that will be used - for all I cases (other cases use the fully coupled datasets that are stored - in the namelist_defaults_clm.xml database). - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New finidat files -M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 ------------ Changes from Francis -M models/lnd/clm/src/main/ncdio.F90 --------------------------- Change cell_method to cell_methods -M models/lnd/clm/src/main/clm_initializeMod.F90 --------------- Remove second call to pftdyn_interp -M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 --------- Compare weights only - if NOT restart and NOT branch with pftdyn. If weights are too different - abort, if close enough write a warning and continue using the surfdata - weights - ->>>>>>>>>>>>>>>> Some work on documentation -M models/lnd/clm/doc/KnownBugs -M models/lnd/clm/doc/UsersGuide/preface.xml -M models/lnd/clm/doc/IMPORTANT_NOTES -M models/lnd/clm/doc/Quickstart.GUIDE - ->>>>>>>>>>>>>>>> Allow clm_start_type to be overridden if on use_case ->>>>>>>>>>>>>>>> Allow vars in use_cases to not be set for some configs -M models/lnd/clm/bld/build-namelist - ->>>>>>>>>>>>>>>> Change start_type to clm_start_type for all use-cases ->>>>>>>>>>>>>>>> Only set orb_iyearad for standalone clm testing -M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/pergro.xml --------- Set start to cold -M models/lnd/clm/bld/namelist_files/use_cases/pergro0.xml -------- Set start to cold -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - -Summary of testing: - - bluefire: All PASS except... -024 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 7 -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - bluefire interactive testing: All PASS except... -006 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -007 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -008 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -010 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -011 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -012 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 -018 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 4 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - bluefire/CCSM testing: All PASS except... -FAIL ERS.f19_g16.I1850.bluefire.compare_hist.clm3_7_06 -FAIL ERS.f19_g16.I1850.bluefire.compare.clm3_7_06 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm3_7_06 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_07 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_06 -SFAIL PST.f10_f10.I8520CN.bluefire.GC.201955 -SFAIL PET_PT.f10_f10.I8520CN.bluefire.GC.201955 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm3_7_06 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm3_7_06 - jaguar interactive testing: All PASS up to... -005 smAK4 TSM.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold - -CLM tag used for the baseline comparison tests if applicable: clm3_7_06 - -Changes answers relative to baseline: Different initial condition datasets, - also now using weights from surfdata files rather than finidat files - -=============================================================== -=============================================================== -Tag name: clm3_7_06 -Originator(s): erik (erik) -Date: Wed Mar 10 16:35:57 MST 2010 -One-line Summary: Bring cndv branch to trunk - -Purpose of changes: - -Bring CNDV branch to trunk cndv16_clm3_7_05 (erik/slevis). Fix bug 978 for Sam (nl -option for branch). Put CROP part of CNDV branch on it's own branch. Add a couple more -history fields (LAND_USE_FLUX, and LAND_UPTAKE). Add HTOP to default output. SNICAR_FRC -fix, test SNICAR_FRC. Fix VOC by making sure fsun240 is between 0 and 1. Fix CO2 PPMV for -I cases. Add in script to create CO2 streams file that can be used by datm8. Update VOC -documentation. Get in updates from ccsm4_0_rel branch. Remove 360x720 grid, files with -gx3v5/gx1v5 masks. Fix bug 1120, by initializing displavegc+ for CN, Change start_type to -clm_start_type, don't allow both fndepdat and fndepdyn. Don't allow spinup modes with -supln, and don't allow both ad_spinup and exit_spinup. Move testing from gx3v5 to gx3v7 -mask - -Bugs fixed (include bugzilla ID): - 1104 (Restart problem with pftdyn mode) - 1118 (Restarts with SNICAR_FRC fail) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1121 (history variable attribute cell_methods misnamed) - 1132 (clm failure for BMOZ compset) - 1133 (missing deallocate) - 1135 (miss smG45 test) - 1136 (line length for NEE in histFlds) - 1137 (qtr-deg fsurdat) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1141 (CN spinup test) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Switch cndv for dgvm, Have configure disallow -bad cases - Change configure to NOT allow supln with spinup cases - Do NOT allow exit_spinup and ad_spinup at the same time. - Only allow voc to be set for seq_ccsm NOT ext_ccsm_seq - -Describe any changes made to the namelist: Add override_nsrest namelist option - -List any changes to the defaults for the boundary datasets: - New pft-physiology files with extra fields for CNDV - Add new f05 1850 surfdata file - Remove 360x720 files, gx3v5, gx1v5 files - -Describe any substantial timing or memory changes: None - -Code reviewed by: slevis, self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, csm_share, mct, and pio - - scripts to scripts4_100306 - drv to drvseq3_1_19 - csm_share to share3_100228 - mct to MCT2_7_0_100228 - pio to pio1_0_15 - -List all files eliminated: Remove DGVM files - - D models/lnd/clm/src/biogeochem/DGVMLightMod.F90 - D models/lnd/clm/src/biogeochem/DGVMReproductionMod.F90 - D models/lnd/clm/src/biogeochem/DGVMAllocationMod.F90 - D models/lnd/clm/src/biogeochem/DGVMEcosystemDynMod.F90 - D models/lnd/clm/src/biogeochem/DGVMKillMod.F90 - D models/lnd/clm/src/biogeochem/DGVMEstablishmentMod.F90 - D models/lnd/clm/src/biogeochem/DGVMRestMod.F90 - D models/lnd/clm/src/biogeochem/DGVMMod.F90 - D models/lnd/clm/src/biogeochem/DGVMMortalityMod.F90 - D models/lnd/clm/src/biogeochem/DGVMTurnoverMod.F90 - D models/lnd/clm/src/biogeochem/DGVMFireMod.F90 - -List all files added and what they do: - ->>>>>>>>>>>>> Add CNDV files - A models/lnd/clm/src/biogeochem/CNDVEstablishmentMod.F90 - A models/lnd/clm/src/biogeochem/CNDVLightMod.F90 - A models/lnd/clm/src/biogeochem/CNDVMod.F90 - A models/lnd/clm/src/biogeochem/CNDVEcosystemDynIniMod.F90 ->>>>>>>>>>>>> Add script to convert CAM historical greenhouse gas file to CO2 history ->>>>>>>>>>>>> file that can be used in datm streams - A models/lnd/clm/tools/ncl_scripts/getco2_historical.ncl ->>>>>>>>>>>>> Add SNICAR_FRC and CNDV config files to test - A models/lnd/clm/test/system/config_files/_scsnf_dh - A models/lnd/clm/test/system/config_files/_scsnf_dm - A models/lnd/clm/test/system/config_files/_scsnf_do - A models/lnd/clm/test/system/config_files/17p_cndvsc_dh - A models/lnd/clm/test/system/config_files/17p_cndvsc_dm - A models/lnd/clm/test/system/config_files/17p_cndvsc_do - A models/lnd/clm/test/system/config_files/17p_cndvsc_h - ->>>>>>>>>>>>> Add files to describe how to add streams for CO2 - A models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - A models/lnd/clm/doc/UsersGuide/co2_streams.txt - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>> Document new getco2 script, use correct namelist in getregional script - M models/lnd/clm/tools/ncl_scripts/README - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - ->>>>>>>>>>>>>>> Add K configure tests for CNDV, B configure tests for SNICAR_FRC, ->>>>>>>>>>>>>>> and create_croplunit tests Change maxpft 17 tests to numpft+1 - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do - M models/lnd/clm/test/system/config_files/17p_cnnsc_h - M models/lnd/clm/test/system/config_files/17p_cnnsc_m - M models/lnd/clm/test/system/config_files/17p_cnnsc_o - M models/lnd/clm/test/system/config_files/17p_cnsc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_do - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_do - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do - M models/lnd/clm/test/system/config_files/17p_cnnsc_dh - M models/lnd/clm/test/system/config_files/17p_cnnsc_dm - M models/lnd/clm/test/system/config_files/17p_cnnsc_do - M models/lnd/clm/test/system/config_files/17p_cnnsc_ds - - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_jaguar - M models/lnd/clm/test/system/tests_posttag_kraken - M models/lnd/clm/test/system/tests_posttag_breeze - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/tests_pretag_bangkok - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/tests_pretag_calgary - - M models/lnd/clm/test/system/input_tests_master - Add B and K tests - M models/lnd/clm/test/system/test_driver.sh ----- Update for bluefire changes - to scripts - M models/lnd/clm/test/system/mknamelist --------- Change start_type to - clm_start_type add in nrevsnfile - M models/lnd/clm/test/system/README.testnames --- Change K configure -tests to mean CNDV - ->>>>>>>>>>>>> - M models/lnd/clm/bld/configure ---- Swap out cndv for dgvm. -bgc cndv turns on - both CN AND CNDV cpp tokens. - voc part of standalone_test arguments - supln and spinup options can't be on at the same -time - exit_spinup and ad_spinup can't be on at the -same time - M models/lnd/clm/bld/queryDefaultXML.pm ---------------- Swap cndv for DGVM - M models/lnd/clm/bld/config_files/config_definition.xml - Swap cndv for dgvm - voc in standalone_test, maxpft lists valid numbers -category - M models/lnd/clm/bld/build-namelist ----- Change start_type to clm_start_type - Don't allow both fndepdyn and fndepdat to e set - Work with nrevsn, so not always given - M models/lnd/clm/bld/clm.cpl7.template -- Rename start_type to clm_start_type, and - let default be "default" - M models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl ------ Update mask list - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - Add override_nsrest, - mkghg_bndtvghg, rename start_type to clm_startype - - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Add -clm_start_type - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ---- Remove domain -files - with gx3v5 and gx1v5 masks - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- new pft-physiology files for CNDV - Use same fndepdat datasets for cndv - Remove 360x720 files, - files with gx3v5 and gx1v5 masks - New 1850 f05 fsurdat file - Add mkghg_bndtvghg dataset to point to CAM - historical greenhouse dataset - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ----- Remove -start_type - - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/clm_ug.xml - M models/lnd/clm/doc/UsersGuide/adding_files.xml - M models/lnd/clm/doc/UsersGuide/appendix.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/Makefile - M models/lnd/clm/doc/UsersGuide/special_cases.xml - ->>>>>>>>>>>>> Add in landuseflux/landuptake, always use hardwire_sla for VOC ->>>>>>>>>>>>> Set displavegc for CN not just CNDV, new fields for SNICAR_FRC restarts - M models/lnd/clm/src/biogeochem/CNSummaryMod.F90 --------- Calculate landuseflux/landuptake - M models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 ------- Calculate pftmayexist for CNDV - Remove concurrent directives - M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ------- Always use hardwire_sla - Remove DGVM CPP ifdefs, fix for transient problem from Dave - loop over soil filter rather than non-lake - M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 -------- Set displavegc etc. for CN as well as CNDV - Add some CNDV fields - M models/lnd/clm/src/main/clmtypeInitMod.F90 ------------- Remove agdd0/agdd5,fnpsn10, - initialize landuseflux/landuptake - M models/lnd/clm/src/main/CNiniSpecial.F90 --------------- initialize landuseflux/landuptake - M models/lnd/clm/src/main/clmtype.F90 -------------------- Swap DGVM vars for CNDV - add pftmayexist, landuseflux/landuptake - M models/lnd/clm/src/main/histFldsMod.F90 ---------------- Add LAND_USE_FLUX, LAND_UPTAKE, make HTOP active - Swap DGVM fields for CNDV - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 ---- Add fields needed for SNICAR_FRC - - M models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 --- Remove uneeded use statement - M models/lnd/clm/src/biogeochem/CNGapMortalityMod.F90 ---- CNDV changes - M models/lnd/clm/src/biogeochem/CNC13StateUpdate2Mod.F90 - Remove junk - M models/lnd/clm/src/biogeochem/CNGRespMod.F90 ----------- Remove junk - M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 --- Remove junk - M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 ---- - M models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90 --- - M models/lnd/clm/src/biogeochem/CNFireMod.F90 ------------ CNDV section - M models/lnd/clm/src/biogeochem/CNMRespMod.F90 ----------- Remove junk - M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 Remove junk - M models/lnd/clm/src/biogeochem/CNDecompMod.F90 ---------- Pass lbp, ubp to CNAllocate - M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 --- Formatting changes - M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 --- Swap CNDV for DGVM - M models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90 --- Remove junk - M models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 - Remove junk - M models/lnd/clm/src/biogeochem/CNC13StateUpdate3Mod.F90 - Remove junk - M models/lnd/clm/src/biogeochem/CNrestMod.F90 ------------ Add CNDV section - M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 ---- Add CNDV section - M models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 --- Remove junk - M models/lnd/clm/src/biogeochem/C13SummaryMod.F90 -------- Remove junk - M models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 ------- Remove junk - M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 ------ Pass pft loop indices in, - formatting changes remove junk - M models/lnd/clm/src/biogeochem/CNC13FluxMod.F90 --------- Remove junk - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 ------- Swap CNDV for DGVM - M models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 ---- Pass lbp, ubp to CNDecompAlloc - M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 - Use dwood from pft-physiology file - Add CNDV section - - M models/lnd/clm/src/main/clm_varpar.F90 --------- Change some of the names around - M models/lnd/clm/src/main/CNiniTimeVar.F90 ------- CNDV section for litter fall - M models/lnd/clm/src/main/clm_comp.F90 ----------- Swap CNDV for DGVM - M models/lnd/clm/src/main/clm_initializeMod.F90 -- Swap CNDV for DGVM - M models/lnd/clm/src/main/accFldsMod.F90 --------- Swap CNDV for DGVM - M models/lnd/clm/src/main/subgridMod.F90 --------- Handle create_croplandunit correctly - M models/lnd/clm/src/main/pftdynMod.F90 ---------- Add CNDV subroutine: pftwt_init - For CNDV make pftwt_interp public -and - M models/lnd/clm/src/main/iniTimeConst.F90 ------- Change dgvm vars init - M models/lnd/clm/src/main/restFileMod.F90 -------- Remove DGVM - M models/lnd/clm/src/main/controlMod.F90 --------- Add override_nsrest, swap CNDV for DGVM - M models/lnd/clm/src/main/initSurfAlbMod.F90 ----- Swap CNDV for DGVM - M models/lnd/clm/src/main/filterMod.F90 ---------- Swap CNDV for DGVM remove concurrent directives - M models/lnd/clm/src/main/clm_driver.F90 --------- Swap CNDV for DGVM - M models/lnd/clm/src/main/clm_varctl.F90 --------- Swap CNDV for DGVM, fix check for create_croplandunit - M models/lnd/clm/src/main/ndepFileMod.F90 -------- Remove junk - M models/lnd/clm/src/main/initGridCellsMod.F90 --- Fix create_croplandunit - M models/lnd/clm/src/main/pftvarcon.F90 ---------- New CNDV parameters, formatting changes, - Always read all parameters to make read easier to understand - M models/lnd/clm/src/main/surfrdMod.F90 ---------- Swap CNDV for DGVMA, fix create_croplandunit, change some names - - M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ----- Remove junk - M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 - Remove junk add comments - M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 --- Remove junk - M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 - Change comments remove DGVM - M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 ---- Change formatting add comments - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 ------- Remove DGVM - M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 - Remove junk - M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 ----- Remove DGVM add in CNDV - -Summary of testing: - - bluefire: -FAIL! rc= 7 -025 smK51 TSM.sh 17p_cndvsc_dh clm_std 19981231:NONE:1800 10x15 USGS 48 arb_ic ..................PASS -026 erK51 TER.sh 17p_cndvsc_dh clm_std 19981231:NONE:1800 10x15 USGS 10+38 arb_ic ...............PASS -027 brK51 TBR.sh 17p_cndvsc_dh clm_std 19981231:NONE:1800 10x15 USGS 24+24 arb_ic ...............PASS -028 blK51 TBL.sh 17p_cndvsc_dh clm_std 19981231:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 5 -029 smHN1 TSM.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colPASS -030 erHN1 TER.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -3+-7 cFAIL! rc= 13 -031 brHN1 TBR.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -5+-5 cFAIL! rc= 11 -032 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 7 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - bluefire interactive testing: All PASS except... -006 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -007 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -008 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -010 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -011 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -012 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 -018 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 4 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -032 blF93 TBL.sh 17p_vodsrsc_do clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 cold .............FAIL! rc= 5 -036 blL83 TBL.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ..........FAIL! rc= 7 -040 blK74 TBL.sh 17p_cndvsc_s clm_std 19971231:NONE:1800 1x1_brazil navy -670 arb_ic ............FAIL! rc= 5 - bluefire/CCSM testing: All PASS except.. (compare tests fail because CO2 level was changed for 2000 compsets) -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm3_7_05 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm3_7_05 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm3_7_05 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm3_7_05 -BFAIL ERS_D.f45_g37.I.bluefire.compare.clm3_7_05 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm3_7_05 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_06 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_05 -BFAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_7_05 -FAIL PST.f10_f10.I8520CN.bluefire.compare.clm3_7_05 -BFAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm3_7_05 -BFAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm3_7_05 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_05 - -Changes answers relative to baseline: I2000 cases are different because of new CCSM_CO2_PPMV - -=============================================================== -=============================================================== -Tag name: clm3_7_05 -Originator(s): erik (erik) -Date: Wed Feb 24 00:33:08 MST 2010 -One-line Summary: Bring VOC branch source code to trunk - -Purpose of changes: - -Move VOC branch over to trunk (vocemis-drydep19_clm3_7_04), this includes source code -changes for VOC and drydep. Ensure answers for f09, f19, f10 are identical to clm3_7_02 -(other than VOC fields). Split users guide into separate files by chapter. Remove dublin. -Add rcp option to getregional dataset script. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1104 (Restart problem with pftdyn mode) - 1118 (Restarts with SNICAR_FRC fail) - 1121 (history variable attribute cell_methods misnamed) - 1132 (clm failure for BMOZ compset) - 1133 (missing deallocate) - 1135 (miss smG45 test) - 1136 (line length for NEE in histFlds) - 1137 (qtr-deg fsurdat) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1141 (CN spinup test) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Fix date of 1x1_tropicAtl surfdata - New T62 fsurdat file with VOC - Fix syntax error in default_datm file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts and drv - - scripts to scripts4_100222 (uses new bluefire compiler with bug-fix for - reproducibility bug) - drv to drvseq3_1_17 - -List all files eliminated: - ->>>>>>>>>>>>> Rename to edinburgh - D models/lnd/clm/test/system/tests_pretag_dublin - D models/lnd/clm/test/system/tests_pretag_dublin_nompi - ->>>>>>>>>>>>> Split into separate files - D models/lnd/clm/doc/UsersGuide/index.xml - -List all files added and what they do: - - A models/lnd/clm/test/system/tests_pretag_edinburgh ------- Rename dublin files - A models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - Rename dublin files - ->>>>>>>>>>>>> Split Users Guide into separate files by chapter - A models/lnd/clm/doc/UsersGuide/tools.xml - A models/lnd/clm/doc/UsersGuide/preface.xml - A models/lnd/clm/doc/UsersGuide/clm_ug.xml - A models/lnd/clm/doc/UsersGuide/adding_files.xml - A models/lnd/clm/doc/UsersGuide/config_cache.xml - A models/lnd/clm/doc/UsersGuide/custom.xml - A models/lnd/clm/doc/UsersGuide/get_Icaselist.pl --- Script to list I cases - A models/lnd/clm/doc/UsersGuide/single_point.xml - A models/lnd/clm/doc/UsersGuide/special_cases.xml - ->>>>>>>>>>>>> Add module to handle dry-deposition velocity - A models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>> Remove dublin - M models/lnd/clm/test/system/test_driver.sh - M models/lnd/clm/test/system/input_tests_master - Decrease mexicoCity run length to 157 - M models/lnd/clm/test/system/CLM_runcmnd.sh - ->>>>>>>>>>>>> Fix bug in dynamic PFT file generation example, let intel allow lines of ->>>>>>>>>>>>> any length - M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn - Use 1850 veg file to start from - M models/lnd/clm/tools/mksurfdata/Makefile ---------- Remove intel -132 so can be any -length - M models/lnd/clm/tools/mkgriddata/Makefile ---------- Remove intel -132 so can be any - length, add SMP option - M models/lnd/clm/tools/mkdatadomain/Makefile -------- Remove intel -132 so can be any -length - - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -- Add absolute_path and - ability to use rcp - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - Add rcp - correct namelist for domainfile - ->>>>>>>>>>>>> - M models/lnd/clm/bld/clm.cpl7.template ---- Turn rtm off for PTS_MODE, remove lnd_in -and Filepath files from clmconf - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Fix syntax error in -2.5x3.33 domain file - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- Fix date of -surfdata_1x1_tropicAtl file - ->>>>>>>>>>>>> Split into separate files by Chapter - M models/lnd/clm/doc/UsersGuide/Makefile - ->>>>>>>>>>>>> Source code changes to use MEGAN VOC and dry-deposition - - M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 -- Add readAnnualVegetation - subroutine for dry-deposition, use some F90 NetCDF, - get mlai difference between months for dry-deposition - M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ------ New MEGAN VOC module - remove concurrent directives - M models/lnd/clm/src/main/clm_varpar.F90 ---------------- Change comment on nvoc - M models/lnd/clm/src/main/clm_comp.F90 ------------------ Interp monthly veg for - drydep on clm_init2 - M models/lnd/clm/src/main/clm_initializeMod.F90 --------- add readAnnualVegetation - M models/lnd/clm/src/main/accFldsMod.F90 ---------------- 24hr and 10day accumulators for - t_veg, fsd, fsi, fsun, laip, remove concurrent directives - M models/lnd/clm/src/main/clmtypeInitMod.F90 ------------ Add new VOC and drydep variables - M models/lnd/clm/src/main/iniTimeConst.F90 -------------- Read in VOC emission - factors, remove concurrent directives - M models/lnd/clm/src/main/clm_atmlnd.F90 ---------------- Add VOC and drydep fluxes - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 ------ Pass VOC and drydep fluxes - M models/lnd/clm/src/main/clm_driver.F90 ---------------- Always call VOC emission - and call depvel_compute - M models/lnd/clm/src/main/clmtype.F90 ------------------- Add some VOC and drydep - variables, move sandfrac/clayfrac for all not just CASA - add accumulation variables - M models/lnd/clm/src/main/histFldsMod.F90 --------------- Bunch of new inactive - variables for VOC fluxes - M models/lnd/clm/src/main/inicFileMod.F90 --------------- Li Xu: correct ncd_iolocal and snow_fraction - M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 - Deal with drydep velocity - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 --- Add mlaidiff to restart - file, if fsun set to NaN on restart set it to spval - M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 ----- Keep track of boundary - layer resistance - -Summary of testing: - - Baseline tests are identical other than VOC flux fields.. -> grep RMS -> /ptmp/erik/test-driver.612049/TBL.4p_vodsrsc_dh.clm_std^nl_urb.20021231:NONE:3600.1.9x2.5^0.9x1.25.gx1v6.48.arb_ic/cprnc.clmrun.clm2.h0.2002-12-31-00000.nc.out -> | grep -v 0.0000E+00 - RMS BIOGENCO 1.0058E-01 - RMS ISOPRENE 2.9500E+02 - RMS MONOTERP 2.9129E+00 - RMS ORVOC 3.3526E-01 - RMS OVOC 3.3526E-01 - RMS VOCFLXT 2.9641E+02 - - bluefire: -004 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 7 -011 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 arb_ic ............FAIL! rc= 7 -016 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 7 -020 blEH1 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 7 -024 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 7 -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -029 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -033 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 7 -041 blH52 TBL.sh 17p_cnnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 48 cold .........FAIL! rc= 7 -043 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 8 -044 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -045 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -046 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -050 blJ61 TBL.sh 4p_casasc_dh clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 48 cold ...........FAIL! rc= 7 - bluefire interactive testing: -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........FAIL! rc= 7 -006 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -007 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -008 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -010 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -011 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -012 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 -017 blJ74 TBL.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic FAIL! rc= 7 -018 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 4 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -023 blAK4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............FAIL! rc= 7 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -028 blL78 TBL.sh _nrsc_s clm_std^nl_urb 20021231:NONE:1800 1x1_brazil navy -10 arb_ic ...........FAIL! rc= 7 -032 blF93 TBL.sh 17p_vodsrsc_do clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 7 -036 blL83 TBL.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ..........FAIL! rc= 7 -041 bl744 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 7 -043 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 7 -045 bl754 TBLtools.sh mksurfdata tools__s globalirrig ...........................................FAIL! rc= 6 - bluefire/CCSM testing: -PASS SMS_RLA.f45_f45.I.bluefire -PASS SMS_RLB.f45_f45.I.bluefire -PASS SMS_ROA.f45_f45.I.bluefire -RUN ERS_D.f45_g37.I.bluefire.GC.092123 -PASS PST.f45_g37.I1850.bluefire.cpl -PASS PST.f45_g37.I1850.bluefire.atm -PASS PST.f45_g37.I1850.bluefire.lnd -PASS PST.f45_g37.I1850.bluefire.ice -PASS PST.f45_g37.I1850.bluefire.ocn -PASS PST.f45_g37.I1850.bluefire.glc -PASS PET_PT.f45_g37.I1850.bluefire -PASS ERS.f19_g16.I1850.bluefire -PASS ERB.f09_g16.I_1948-2004.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -PEND ERH_D.f10_f10.I1850CN.bluefire.GC.092123 -PASS PST.f10_f10.I8520CN.bluefire.cpl -PASS PST.f10_f10.I8520CN.bluefire.atm -PASS PST.f10_f10.I8520CN.bluefire.lnd -PASS PST.f10_f10.I8520CN.bluefire.ice -PASS PST.f10_f10.I8520CN.bluefire.ocn -PASS PST.f10_f10.I8520CN.bluefire.glc - jaguar/CCSM testing: -PASS ERS_D.f09_g16.I1850.jaguar -PASS PST.f10_f10.I8520CN.jaguar.cpl -PASS PST.f10_f10.I8520CN.jaguar.atm -PASS PST.f10_f10.I8520CN.jaguar.lnd -PASS PST.f10_f10.I8520CN.jaguar.ice -PASS PST.f10_f10.I8520CN.jaguar.ocn -PASS PST.f10_f10.I8520CN.jaguar.glc -PASS PET_PT.f10_f10.I8520CN.jaguar - jaguar interactive testing: -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........FAIL! rc= 7 -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -008 blAK4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............FAIL! rc= 7 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -013 smJ74 TSM.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -1100 arb_ic FAIL! rc= 8 -014 erJ74 TER.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -10+-10 arb_ic FAIL! rc= 5 -015 brJ74 TBR.sh 4p_nrcasasc_ds clm_std^nl_urb_br 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_icFAIL! rc= 5 -016 blJ74 TBL.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic FAIL! rc= 4 - edinburgh/ifort interactive testing: -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -009 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -010 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ....FAIL! rc= 5 -011 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic .FAIL! rc= 5 -012 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -013 smOC4 TSM.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 10 -014 erOC4 TER.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_FAIL! rc= 5 -015 brOC4 TBR.sh _nrvansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arbFAIL! rc= 5 -016 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 4 -017 smNB4 TSM.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 10 -018 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -019 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -020 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 - edinburgh/ifort: -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -016 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 arb_ic ............FAIL! rc= 7 - breeze,gale,hail,gust/ifort interactive testing: -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........FAIL! rc= 7 -008 smCA4 TSM.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 10 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 4 -010 smCA8 TSM.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 10 -011 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 4 -015 blL54 TBL.sh _sc_ds clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 7 -019 blR53 TBL.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 48 cold .......FAIL! rc= 7 -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_04 - -Changes answers relative to baseline: No bit-for-bit (except voc flux fields) - -=============================================================== -=============================================================== -Tag name: clm3_7_04 -Originator(s): erik (erik) -Date: Wed Feb 17 23:22:23 MST 2010 -One-line Summary: Bring VOC branch (vocemis-drydep18_clm3_7_03) tools, testing, and build to trunk (everything other than VOC code changes) - -Purpose of changes: - -Move VOC branch (vocemis-drydep18_clm3_7_03) to trunk for support functionality, tools, -testing, everything but the code changes. This includes optimization of mksurfdata, -adding new tests, adding drydep to build, listen to cpl flag if aerosols are sent, update -documentation about configure variables, remove pio and carbon_aero config options -(always build with pio), remove local Macro's files for Darwin (yong_g95, and -breeze_intel), and remove gx1v3, gx1v4 masks, and 1x1.25 and 2x2.5 grids. All NCL regrid -scripts to be able to use GRDFIL env variable to set location of a grid file just -created. turn rtm off if PTS_MODE is TRUE. mksurfdata optimization includes: create -subroutines for landuse normalization, add OpenMP parallelism, optimize memory so -deallocate when done, and put OMP threads, veg filenames and optimization level on -mksurfdata files. Move shr_drydepInputMod.F90 to drv/shr/seq_drydepMod.F90 (from -csm_share to drv). Update externals. Work on documentation using output logs from scripts -and moving documentation into separate chapters. - -Bugs fixed (include bugzilla ID): - 926 (pftdyn code needs to be shared in mksurfdata) - 1105 (Turn RTM mode off for PTS_MODE) - 1110 (dt limit error, for mexicocity) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1104 (Restart problem with pftdyn mode) - 1121 (history variable attribute cell_methods misnamed) - 1118 (Restarts with SNICAR_FRC fail) - 1133 (missing deallocate) - 1135 (miss smG45 test) - 1136 (line length for NEE in histFlds) - 1137 (qtr-deg fsurdat) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1141 (CN spinup test) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: - Remove carbon_aero and pio from configure (always build with pio) - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Remove 1x1.25, 2x2.5, and 2.5x3.33 grid resolutions - Remove gx1v3, gx1v4, gx1v5 land masks, add drydep defaults. - Update 2.65x3.33@2000, 1x1_tropicAtl@2000, f09@1850 and 1x1_tropicAtl@1000-1004 pftdyn - add mksrf_fvegtyp@1000-1004 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, csm_share, drv, datm, and timing - - csm_share to share3_100215 - scripts to scripts4_100216 - drv to drvseq3_1_16 - datm to datm8_100215 - timing to timing_091021 - -List all files eliminated: - ->>>>>>>>>>>> Remove local Macros files, and remove maxpft=4 vodsrcsc tests - D models/lnd/clm/bld/config_files/Macros.yong_g95 - D models/lnd/clm/bld/config_files/Macros.breeze_intel - D models/lnd/clm/test/system/config_files/4p_vodsrsc_m - D models/lnd/clm/test/system/config_files/4p_vodsrsc_h - - D models/lnd/clm/doc/UsersGuide/index.xml -- Rename to clm_ug.xml - Divide most of the content into separate chapters. - -List all files added and what they do: - - A models/lnd/clm/test/system/config_files/_scnv_dh ---- No-VOC debug-hybrid mode - A models/lnd/clm/test/system/config_files/_scnv_do ---- No-VOC debug-pure SMP hybrid mode - A models/lnd/clm/test/system/config_files/17p_scnv_dh - 17pft no-VOC debug-hybrid mode - A models/lnd/clm/test/system/config_files/17p_scnv_do - 17pft no-VOC debug-pure SMP mode - A models/lnd/clm/test/system/nl_files/clm_drydep ------ Turn on drydep in namelist - A models/lnd/clm/tools/mksurfdata/mkvocef.F90 --------- VOC emissions - A models/lnd/clm/bld/namelist_files/namelist_defaults_drydep.xml - Drydep namelist defaults - A models/lnd/clm/doc/UsersGuide/tools.xml --------- Tools chapter - A models/lnd/clm/doc/UsersGuide/preface.xml ------- Preface and introduction chapter - A models/lnd/clm/doc/UsersGuide/clm_ug.xml -------- Change name of index.xml - Move most of the contents into separate chapters - A models/lnd/clm/doc/UsersGuide/adding_files.xml -- Adding files chapter - A models/lnd/clm/doc/UsersGuide/config_cache.xml -- Sample config cache file so can - run build-namelist for documentation - A models/lnd/clm/doc/UsersGuide/custom.xml -------- Customizing chapter - A models/lnd/clm/doc/UsersGuide/get_Icaselist.pl -- Script to get list of I cases - A models/lnd/clm/doc/UsersGuide/single_point.xml -- Single point chapter - A models/lnd/clm/doc/UsersGuide/special_cases.xml - Special cases chapter - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/config_files/README - Add nv no-VOC config case - M models/lnd/clm/test/system/README.testnames ---- Add drydep testnames - M models/lnd/clm/test/system/test_driver.sh ------ Use generic_linux_intel mach for breeze - also changes to get jaguar to work - M models/lnd/clm/test/system/input_tests_master -- Add drydep and no-VOC tests, cut - back Mexicocity test to 158 steps - - M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 -------- Add mksrf_gridnm and mksrf_fvocef - M models/lnd/clm/tools/mksurfdata/ncdio.F90 ----------- Write out error codes on a problem. - M models/lnd/clm/tools/mksurfdata/mksurfdata.regional - Add voc file. - M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn --- Add voc file, use 1850 veg file. - M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept - Add voc file. - M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist - Add voc file. - M models/lnd/clm/tools/mksurfdata/mkharvestMod.F90 ---- Move file definition for harvest to init sub - M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 ------- Write out OpenMP threads - and OPT TRUE or FALSE, VOC fields, and veg filenames - M models/lnd/clm/tools/mksurfdata/mkorganic.F90 ------- Remove test and use 3D areaave - M models/lnd/clm/tools/mksurfdata/Makefile ------------ Add in SMP option to turn on OpenMP - M models/lnd/clm/tools/mksurfdata/mkurbanparMod.F90 --- Remove single level fields - and use 4D areaave - M models/lnd/clm/tools/mksurfdata/areaMod.F90 --------- Add 3D and 4D areaave interfaces - and add OpenMP directives - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 -------- Create subroutines shared - by dynpft loop and surfdata: change_landuse and normalizencheck_landuse. - Allocate memory as late as possible and deallocate as soon as possible. - Add: mksrf_gridnm and mksrf_fvocef to namelist - Add mkvocef and add to output file - M models/lnd/clm/tools/mksurfdata/Srcfiles ------------ Add mkvocef.F90 - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl ------- Allow command line arguments - to pick resolutions and simulation-years. Read in namelist database information - for checking and using defaults. Add in mksrf_fvocef, and use mksrf_gridnm to - give output file same name as the input grid resolution name. - M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 -------- Remove testing, add 3D areaave - - M models/lnd/clm/tools/ncl_scripts/README ----------- Remove script no longer available. - M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl - Allow env var GRDFIL to give - grid file to use - M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl --- Allow env var GRDFIL to give - grid file to use - - M models/lnd/clm/tools/mkgriddata/README -- Fix typo - - M models/lnd/clm/bld/configure --------------------------------- Remove carbon_aero - and pio (always build with pio), and make voc default on - M models/lnd/clm/bld/queryDefaultNamelist.pl ------------------- Add drydep file. - M models/lnd/clm/bld/config_files/config_sys_defaults.xml ------ Change mach - defaults, remove darwin make linux edinburgh_pgi - M models/lnd/clm/bld/config_files/config_definition.xml -------- Remove carbon_aero - and pio, make default for mode ext_ccsm_seq, make voc on, - work on documentation - M models/lnd/clm/bld/build-namelist ---------------------------- Add drydep, remove - carbon_aero and pio - M models/lnd/clm/bld/clm.cpl7.template ------------------------- Turn rtm off for PTS_MODE - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ---- Add mksrf_fvegtyp, - remove 1x1.25, 2x2.5, and 2.5x3.33 grid resolutions - remove gx1v3, gx1v4, gx1v5 land masks, add drydep_method, and drydep_list - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Remove 1x1.25, - 2x2.5, and gx1v3, gx1v4, gx1v5 domain files - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- Remove 1x1.25, - and gx1v3, gx1v4, gx1v5 files - update 2.65x3.33@2000, 1x1_tropicAtl@2000, f09@1850 - and 1x1_tropicAtl@1000-1004 pftdyn - add mksrf_fvegtyp@1000-1004 - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml -- Remove gx1v4, gx1v5 start dates - - M models/lnd/clm/doc/UsersGuide/Makefile --- Get makefile to use scripts to make - log info to put into document, and separate out document - into chapters - - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 --- Use atm_aero in infodata - to determine: caerdep_filled, and dustdep_filled - some changes to get ready for VOC and drydep branch to come to trunk - -Summary of testing: - - bluefire: All PASS up to 019 brEH1 - bluefire interactive testing: All PASS except... -004 blJ74 TBL.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 -arb_ic FAIL! rc= 5 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - bluefire/CCSM testing: -PASS SMS_RLB.f45_f45.I.bluefire -PASS ERH_D.f10_f10.I1850CN.bluefire - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/ifort: All PASS except... -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_03 - -Changes answers relative to baseline: 1x1_tropicAtl changes due to new surfdata file - -=============================================================== -=============================================================== -Tag name: clm3_7_03 -Originator(s): erik (erik) -Date: Wed Feb 10 11:29:56 MST 2010 -One-line Summary: Add in more future scenario datasets, new history fields from Keith - -Purpose of changes: - -Add in pftdyn dataset for 1-degree rcp-8.5. Add in interpolated aerdep/ndepdyn scenario -files for f10, f09. Add in code change from Keith O. for average of top soil layers. Add -in rcp for ndep and aerdep regrid scripts. Allow 2000-2100 sim_year_range for 1-degree -resolution, and have a aerdep dataset for 1-degree for 2000-2100 (copy other 1850-2100 -datasets). There is also a 1-degree 1850-2100 aerosol dataset, but the file is large (~9GB). - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1104 (Restart problem with pftdyn mode) - 1118 (Restarts with SNICAR_FRC fail) - 1121 (history variable attribute cell_methods misnamed) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - Add 2000-2100 simulation year range as allowed option - - Two new history fields: - - TSOI_10CM = soil temperature in top 10cm of soil (K) - SOILWATER_10CM = soil liquid water + ice in top 10cm of soil (kg/m2) - -List any changes to the defaults for the boundary datasets: New datasets for rcp=8.5 - f09, rcp=8.5 pftdyn for 1850-200 (use same file for 2000-2100) - faerdep, for 1850-2100 rcp=8.5, f10, f45, f25, f09 (and 2000-2100) and f19 for 2000-2100 - fndepdyn, for 1850-2000 rcp=8.5 f09 (use same file for 2000-2100), f25, f45, f10 - fndepdyn for 1850-2100 rcp=2.6 for native f19 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, history changes from Keith Oleson, reviewed by Dave Lawrenece - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: use-case for 2000-2100 for high resolution (1 degree and up) - ->>>>>>>>>> Add a use-case for a future scenario that only includes 2000-2100 ->>>>>>>>>> this is for 1-degree and higher resolution where we can't include the ->>>>>>>>>> historical period and have resonable sized files. - A models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>> Get regridding scripts working for rcp's - M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl - Allow rcp to be set, more printing - M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl --- Allow rcp to be set, allow more sim_year_ranges - ->>>>>>>>>> New rcp=8.5 datasets, and 2000-2100 support for 1-degree - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New rcp=8.5 datasets - f09, rcp=8.5 pftdyn for 1850-200 (use same file for 2000-2100) - faerdep, for 1850-2100 rcp=8.5, f10, f45, f25, f09 (and 2000-2100) and f19 for 2000-2100 - fndepdyn, for 1850-2000 rcp=8.5 f09 (use same file for 2000-2100), f25, f45, f10 - fndepdyn for 1850-2100 rcp=2.6 for native f19 - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Allow 2000-2100 sim-year range - - M models/lnd/clm/doc/UsersGuide/index.xml --- Update documentation with namelist examples - ->>>>>>>>>> Code changes from Keith Oleson to add 10cm soil temperature and soil water history variables. - M models/lnd/clm/src/main/clmtypeInitMod.F90 ------ Add h2osoi_liqice_10cm and t_soi_10cm - M models/lnd/clm/src/main/clmtype.F90 ------------- Add h2osoi_liqice_10cm and t_soi_10cm - M models/lnd/clm/src/main/histFldsMod.F90 --------- Add TSOI_10CM and SOILWATER_10CM, - on by default and output as average by default. - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 - Calculate 10cm soil averages for non-urban points - -Summary of testing: - - bluefire: All PASS except... -022 erHN1 TER.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -3+-7 cFAIL! rc= 7 -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -029 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - bluefire interactive testing: All PASS except... -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -034 erL83 TER.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -5+-5 arb_ic ........FAIL! rc= 6 -035 brL83 TBR.sh _nrsc_do clm_std^nl_urb_br 20020115:NONE:3600 5x5_amazon navy -10+-10 arb_ic ...FAIL! rc= 3 -036 blL83 TBL.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ..........FAIL! rc= 3 - bluefire/CCSM testing: -PASS SMS_RLA.f45_f45.I.bluefire -PASS SMS_RLA.f45_f45.I.bluefire.compare_hist.clm3_7_02 -PASS SMS_RLA.f45_f45.I.bluefire.compare.clm3_7_02 -PEND SMS_RLB.f45_f45.I.bluefire.GC.140232 -PEND SMS_ROA.f45_f45.I.bluefire.GC.140232 -PASS ERS_D.f45_g37.I.bluefire -PASS ERS_D.f45_g37.I.bluefire.compare_hist.clm3_7_02 -PASS ERS_D.f45_g37.I.bluefire.compare.clm3_7_02 -PEND PET.f45_g37.I1850.bluefire.GC.140232 -PEND ERS.f19_g16.I1850.bluefire.GC.140232 -RUN ERB.f09_g16.I_1948-2004.bluefire.GC.140232 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_02 -PASS ERH_D.f10_f10.I1850CN.bluefire -PASS ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_7_02 -PEND PET.f10_f10.I8520CN.bluefire.GC.140232 -FAIL ERS_D.f19_g16.I8521CNR85.bluefire -BFAIL ERS_D.f19_g16.I8521CNR85.bluefire.compare.clm3_7_02 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/lf95: All PASS up to smL58 (test 29) except... -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_02 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_7_02 -Originator(s): erik (erik) -Date: Sat Feb 6 00:43:49 MST 2010 -One-line Summary: Start adding in new rcp=8.5 datasets, remove some junk, change some env_conf variables, add user_nl_clm - -Purpose of changes: - -New pftdyn, ndep and aerdep files for rcp=8.5 future scenario 2005+ . Need to have the -ability to handle four future scenarios: minicam (rcp4.5), aim (rcp 6), image (rcp2.6), -and message (rcp8.5). Add in ndepdat datasets for rcp2.6 for future decades. Add in -ndepdyn, pftdyn, aerdep datasets for rcp8.5, and ndepdyn for rcp4.5 (f19) and pftdyn for -f10 as well. Some changes to scripts, remove CLM_DEMAND, add CLM_NML_USE_CASE, -CLM_CO2_TYPE and user namelist. Add user_nl to clm.cpl7.template, remove CLM_DEMAND add -CLM_CO2_TYPE and CLM_NML_USE_CASE (in favor of use_case's,). Make sure driver/scripts -updated with this change. Update documentation Users-Guide with comments from Keith and -Sam. Remove clm copy of mkSrcfiles/mkDepends. Remove run-ibm. Remove following options -from configure and config_definition: clm_exe, clm_exedir, and clm_bld. Remove -CASE/CCSM/CAM tests from test_driver.sh. Add some tests for new rcp=8.5. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1104 (Restart problem with pftdyn mode) - 1118 (Restarts with SNICAR_FRC fail) - 1121 (history variable attribute cell_methods misnamed) - 1143 (Problems with mksurfdata and ifort) - 1144 (Bug in ndeplintInterp.ncl in calculation of time axis) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Some changes to configure - Remove unused configure options: clm_exe, -clm_exedir, and -clm_bld. - Move standalone testing options to the end of help. Use CCSM version - of mkSrcfiles/mkDepends, separate config vars into categories, work - on documentation with comments from Keith/Sam. - -Describe any changes made to the namelist: Check for some files based on rcp - - Add in ability to add a user namelist in your case directory to input - namelist items at configure time. Simply add a file called "user_nl_clm" - as a valid namelist and the items in that namelist will show up in the initial - BuildConf/clm.buildnml.csh file. - -List any changes to the defaults for the boundary datasets: - fsurdat: f10, 1850 - fpftdyn: f10, 1850-2000, 1850-2100 (rcp=8.5) - fpftdyn: f19, 1850-2100 (rcp=8.5) - faerdep: f19, 1850-2100 (rcp=8.5) - fndepdat: f19, decadal averages (rcp=2.6) - fndepdyn: f19, 1850-2100 (rcp=8.5 and rcp=4.5) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, pio - - scripts to scripts4_100204 - drv to drvseq3_1_15 - pio to pio1_0_8 - -List all files eliminated: - ->>>>>>>>>>>>>>> Remove CCSM, scam, cam, and run-ibm script testing from test-system ->>>>>>>>>>>>>>> Use .clm.auxtest lists in CCSM scripts for CCSM testing - D models/lnd/clm/test/system/TSM_ccsmseq.sh - D models/lnd/clm/test/system/TSMext_ccsmseq_cam.sh - D models/lnd/clm/test/system/TCT_ccsmseq.sh - D models/lnd/clm/test/system/TCSruncase.sh - D models/lnd/clm/test/system/TSMruncase.sh - D models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh - D models/lnd/clm/test/system/TSCext_ccsmseq_scam.sh - D models/lnd/clm/test/system/tests_posttag_lightning - D models/lnd/clm/test/system/config_files/scam_ds - D models/lnd/clm/test/system/config_files/ext_ccsm_seq_10x15_dh - D models/lnd/clm/test/system/config_files/ext_ccsm_seq_4x5_dh - D models/lnd/clm/test/system/config_files/ext_ccsm_seq_1.9x2.5_dh - D models/lnd/clm/test/system/config_files/ext_ccsm_seq_64x128_s - D models/lnd/clm/test/system/config_files/ext_ccsm_seq_0.9x1.25_dh - D models/lnd/clm/bld/run-ibm.csh - D models/lnd/clm/bld/create_newcase ->>>>>>>>>>>>>>> Remove mkSrcfiles/mkDepends duplicated from ccsm scripts - D models/lnd/clm/bld/mkSrcfiles - D models/lnd/clm/bld/mkDepends - -List all files added and what they do: - ->>>>>>>>>>>>> no-RTM mode configurations for hybrid and mpi-only testing - A models/lnd/clm/test/system/config_files/_nrsc_dh - A models/lnd/clm/test/system/config_files/_nrsc_dm ->>>>>>>>>>>>> Add transient_rcp8.5 use-case option - A models/lnd/clm/test/system/nl_files/clm_transient_rcp8.5 - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/README.testnames --- Update test names - M models/lnd/clm/test/system/test_driver.sh ----- Remove CLM_SEQCCSMROOT - M models/lnd/clm/test/system/input_tests_master - Remove CCSM/cam tests, add rcp8.5 test - M models/lnd/clm/test/system/README ------------- Remove doc on CLM_SEQCCSMROOT ->>>>>>>>>>>>> Remove CCSM, cam, scam, and run-ibm tests from test lists - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_jaguar - M models/lnd/clm/test/system/tests_posttag_kraken - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_pretag_bangkok - M models/lnd/clm/test/system/tests_posttag_intrepid - M models/lnd/clm/test/system/tests_pretag_dublin - M models/lnd/clm/test/system/tests_pretag_dublin_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/tests_pretag_calgary - ->>>>>>>>>>>>> New location for mkDepends, correct documentation - M models/lnd/clm/tools/mkgriddata/README ----- Correct mention of download - M models/lnd/clm/tools/mksurfdata/Makefile --- Change location of mkDepends - M models/lnd/clm/tools/interpinic/Makefile --- Change location of mkDepends - M models/lnd/clm/tools/mkgriddata/Makefile --- Change location of mkDepends - M models/lnd/clm/tools/mkdatadomain/Makefile - Change location of mkDepends - ->>>>>>>>>>>>> Remove unused configure options: clm_exe, -clm_exedir, and -clm_bld ->>>>>>>>>>>>> Move standalone testing options to the end of help ->>>>>>>>>>>>> Use CCSM version of mkSrcfiles/mkDepends, separate config vars into ->>>>>>>>>>>>> categories, work on documentation - M models/lnd/clm/bld/configure -------------------------- Move clm standalone testing - options to the end of the help, remove: -clm_exe, - -clm_exedir, and -clm_bld options - M models/lnd/clm/bld/config_files/Makefile.in ----------- Use CCSM version of mkSrcfiles/mkDepends - M models/lnd/clm/bld/config_files/config_definition.xsl - Separate variables into categories. - M models/lnd/clm/bld/config_files/config_definition.xml - Add categories, add - description changes from Keith/Sam, remove clm_exe, clm_exedir, and clm_bld - - M models/lnd/clm/bld/listDefaultNamelist.pl -- Also loop over rcp values - - M models/lnd/clm/bld/build-namelist ----- have rcp value impact filenames retrieved - M models/lnd/clm/bld/clm.cpl7.template -- Add CLM_NML_USE_CASE and CLM_CO2_TYPE, - remove CLM_DEMAND add user_nl_clm namelist, remove -clm_bld. - M models/lnd/clm/bld/README ------------- Update documentation after removing the - clm stand-alone build/run scripts. - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ------- Remove defaults - as in namelist_defaults files, apply suggestions from Keith/Sam - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Change rcp default to -999.9 - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl ------- Put description above valid values - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- New datasets: - fsurdat: f10, 1850 - fpftdyn: f10, 1850-2000, 1850-2100 (rcp=8.5) - fpftdyn: f19, 1850-2100 (rcp=8.5) - faerdep: f19, 1850-2100 (rcp=8.5) - fndepdat: f19, decadal averages (rcp=2.6) - fndepdyn: f19, 1850-2100 (rcp=8.5 and rcp=4.5) ->>>>>>>>>>>>> Update documentation, add in documentation on changes added in here - M models/lnd/clm/doc/UsersGuide/index.xml -- Spellcheck, more work on doc, update - for changes that came in on this tag. - M models/lnd/clm/doc/index.shtml ----------- Correct test table. - -Summary of testing: - - bluefire: All PASS except... -009 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic -........FAIL! rc= 10 -010 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 -arb_ic ......FAIL! rc= 5 -011 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 -arb_ic ......FAIL! rc= 5 -012 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic -........FAIL! rc= 4 -013 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic -.........FAIL! rc= 10 -017 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic -.........FAIL! rc= 7 - bluefire interactive testing: All PASS - bluefire/CCSM testing: All PASS, except.. -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_02 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_01 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_7_01 -FAIL PET.f10_f10.I8520CN.bluefire.compare.clm3_7_01 -FAIL ERS_D.f19_g16.I8521CNR85.bluefire -BFAIL ERS_D.f19_g16.I8521CNR85.bluefire.generate.clm3_7_02 -BFAIL ERS_D.f19_g16.I8521CNR85.bluefire.compare.clm3_7_01 - Special testing: -PASS ERS.f19_g16.I8521CNR85.bluefire - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_01 - -Changes answers relative to baseline: f10 because of new surface dataset - Other resolutions will be bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_7_01 -Originator(s): erik (Erik Kluzek) -Date: Fri Jan 29 12:58:12 MST 2010 -One-line Summary: OpenMP fix for pftdyn, start adding in rcp's, update ndeplintInterp.ncl script - -Purpose of changes: - -Changes to ndeplintInterp script to add the ability to generate ndepdyn datasets for future scenarios -2005+. Add rcp as input to build-namelist and add use-cases with different rcp's. Small bug-fixes to -mksurfdata. Add lists for 1850-2100 for the rcp's. Update drv and scripts to latest. Update documentation. -Fix from Mariana on OpenMP problem in pftdyn. Remove lightning from tests, start adding in -edinburgh. - -Bugs fixed (include bugzilla ID): - 1102 (OpenMP problem with pftdyn mode) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1104 (Restart problem with pftdyn mode) - 1118 (Restarts with SNICAR_FRC fail) - 1121 (history variable attribute cell_methods misnamed) - 1153 (Problem with ndeplintInterp for historical case) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, code-changes came from Mariana-Vertenstein, reviewed by Pat Worley - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, and datm - - scripts to scripts4_100125 - drv to drvseq3_1_13 - datm to datm8_100122 - -List all files eliminated: - - D models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850-2005.txt --> rename to pftdyn_hist_simyr1850-2005.txt - -List all files added and what they do: - ->>>>>>>>>>>>>>> List of surface datasets to create pftdyn files - A models/lnd/clm/tools/mksurfdata/pftdyn_rcp2.6_simyr1850-2100.txt - A models/lnd/clm/tools/mksurfdata/pftdyn_rcp4.5_simyr1850-2100.txt - A models/lnd/clm/tools/mksurfdata/pftdyn_rcp8.5_simyr1850-2100.txt ->>>>>>>>>>>>>>> Add use-cases for future scenarios - A models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - A models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - - A models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr1850-2005.txt --> renamed - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Add edinburgh, remove lightning - M models/lnd/clm/test/system/test_driver.sh --------- Remove lightning, add edinburgh - M models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh -- Delete csm_share/dshr directory no longer exists - M models/lnd/clm/test/system/CLM_runcmnd.sh --------- Remove lightning, add edinburgh - - M models/lnd/clm/tools/mksurfdata/mkharvestMod.F90 -- Fix small compiler bug for jaguar - M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn - Point to new name for historical pftdyn file - ->>>>>>>>>>>>>> Handle future scenarios for dynamic Nitrogen-Deposition file creation - M models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl -- Add ability to handle future scenario data, and also leave - previous historical data the same as before, or - ->>>>>>>>>>>>>> Start adding ability to handle future scenarios for different RCP's - M models/lnd/clm/bld/build-namelist ------------------------------- Add rcp, - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ------- Add rcp, new sim_year, sim_year_range values, allow blank - for hist_type1d_pertape - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Add default for rcp as -999. - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- Add new Nitrogen deposition decadal datasets for RCP4.5/RCP8.5 - - M models/lnd/clm/doc/UsersGuide/index.xml -- Add more in, add notes on namelist, tools, and special cases - ->>>>>>>>>>>> Changes from Mariana V. to fix bug 1102, OpenMP bug with pftdyn cases - M models/lnd/clm/src/main/clm_initializeMod.F90 - Don't pass decomp bounds down - M models/lnd/clm/src/main/pftdynMod.F90 --------- Get decomp bounds here - M models/lnd/clm/src/main/clm_driver.F90 -------- Call pftdyn_interp on own OMP loop - -Summary of testing: - - bluefire: -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -049 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -050 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 4 -051 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 4 -052 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - bluefire interactive testing: -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7022 -brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -050 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - bluefire special testing: - Run I8520 from Dec/1/1850 @f09_g16 for 14 months with 64 tasks and 4 threads and make sure identical - to same with 128 tasks and 1 thread (require openMP build) comparing clm history files. clm3_7_00 4-thread case for this fails. But, answers are identical with clm3_7_00 for 128 tasks and 1 thread. - jaguar: -020 blJ62 TBL.sh 4p_casasc_dm clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 48 cold ...........FAIL! rc= 5 -026 erP65 TSM_ccsmseq.sh ERS f19_g15 I ..........................................................FAIL! rc= 4 -027 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - jaguar interactive testing: -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - jaguar/special testing: - Run I8520 from Dec/1/1850 @f09_g16 for 5 months with 416 tasks and 4 threads and make sure identical - to same with 1 thread (require openMP build) comparing clm history files. clm3_7_00 4-thread case for this fails. - jaguar/CCSM testing: -PASS ERS_D.f09_g16.I1850.jaguar -PASS PET.f10_f10.I8520CN.jaguar.cpl -PASS PET.f10_f10.I8520CN.jaguar.atm -PASS PET.f10_f10.I8520CN.jaguar.lnd -PASS PET.f10_f10.I8520CN.jaguar.ice -PASS PET.f10_f10.I8520CN.jaguar.ocn -PASS PET.f10_f10.I8520CN.jaguar.glc - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - dublin/ifort interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -030 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - edinburgh/pgi interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -030 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_00 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_7_00 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Fri Jan 22 22:48:09 MST 2010 -One-line Summary: Update to datm8, redirect aquifer overflow to drainage, add gx3v7 - masks, script to extract regional datasets, add harvesting for CN, - modify shrubs, include urban model, ice stream for snowcapping, - new build-namelist system, scale solar by solar zenith angle in - datm, deep soil with bedrock at bottom, organic matter in soils, - SNICAR for snow radiation, sparce dense aero, snow cover changes - -Software engineering changes: - - Update to cpl7 and scripts. - Remove offline and cpl6 modes. - Remove support for CASA model. - Update to datm8 atmospheric data model. - Add gx3v7 land mask for T31 and fv-4x5 horizontal resolutions. - Add gx1v6 land mask for f05, f09, and f19 horigonzl resolutions. - Add tx1v1 land mask and 1.9x2.5_tx1v1 horizontal resolution. - Add in 2.5x3.33 horizontal resolution. - Add in T62 horizontal resolution so can run at same resolution as input datm data. - Allow first history tape to be 1D. - Add ability to use own version of input datasets with CLM_USRDAT_NAME variable. - Add a script to extract out regional datasets. - New build-namelist system with XML file describing all namelist items. - Add glacier_mec use-case and stub glacier model. - Add ncl script to time-interpolate between 1850 and 2000 for fndepdat dataset, for fndepdyn version. - Make default of maxpatch_pft=numpft+1 instead of 4. - Only output static 3D fields on first h0 history file to save space. - Add new fields for VOC (Volatile Organic Compounds) on some surface datasets, that will be - needed for the new MEGAN VOC model (NOT incorporated yet). - Add irrigation area to mksurfdata tool (NOT used in CLM yet). - Add multiple elevation class option for glaciers in mksurfdata tool (NOT used in CLM yet). - Add ascale field to land model in support of model running on it's own grid. - -Science changes: - - Change to freezing temperature constant - Forcing height at atm plus z0+d on each tile - Effective porosity divide by zero fix - Sparse/dense canopy aerodynamic parameters - Ground/snow emissivity smooth transition - Thermal and hydraulic properties of organic soil - Init h2osoi=0.3 - Snow compaction fix - Snow T profile during layer splitting fix - Snow burial fraction - Snow cover fraction - SNICAR (snow aging, black carbon and dust deposition, vertical distribution of solar energy) - Remove SNOWAGE, no longer used - Deep soil (15 layers, ~50m), 5 new layers are hydrologically inactive bed rock - Ground evap (beta), stability, and litter resistance - Organic/mineral soil hydraulic conductivity percolation theory - Richards equation modifications - Normalization of frozen fraction of soil formulation - One-step solution for soil moisture and qcharge - Changes to rsub_max for drainage and decay factor for surface runoff - Fixed diurnal cycle of solar radiation in offline forcing data - Back to CLM3 lakes and wetlands datasets, but 1% rather than 5% threshold (same for glacier) - Changes to pft physiology file from CN - New grass optical properties - New surface dataset assuming no herbaceous understory - Direct versus diffuse radiation offline - New VOC model (MEGAN) - Snow-capped runoff goes to new ice stream and routed to ocean as ice - Dust model always on, LAI threshold parameter change from 0.1 to 0.3 - Daylength control on vcmax - SAI and get_rad_dtime fix - Always run with MAXPATCH_PFT=npfts + 1 instead of 4 - Transient land cover/use mode - datasets, energy and water balance - RTM sub-cycling - Twostream bug fix - Update soil colors - 2m relative humidity - Fix for aquifer leak (SoilHydrologyMod, BalanceCheckMod) - New nitrogen deposition file (units and sum of NOx, NHy) - -Quickstart to new cpl7 scripts... - - cd scripts - ./create_newcase -help # get help on how to run create_newcase - ./create_newcase -case testI -mach bluefire -res f19_g16 -compset I # create new "I" case for bluefire at 1.9x2.5_gx1v6 res - # "I" case is clm active, datm7, and inactive ice/ocn - cd testI - ./xmlchange -help # Get help on editor for XML files - ./xmlchange env_conf.xml env_mach_pes # Edit configure files if needed - configure -case # create scripts - ./xmlchange env_build.xml # Edit build files if needed - testI.build # build model and create namelists - ./xmlchange env_run.xml # Edit run files if needed - bsub < testI.run # submit script - # (NOTE: edit env_run.xml to set RESUBMIT to number of times to automatically resubmit) -Quickstart to use of regional extraction scripts and PERSONAL datasets: - - # Run the script to create an area to put your files (assume CSMDATA set to standard inputdata) - cd scripts - setenv MYCSMDATA $HOME/myinputdata - link_dirtree $CSMDATA $MYCSMDATA - - # Run the extraction for data from 52-73 North latitude, 190-220 longitude - # that creates 13x12 gridcell region from the f19 (1.9x2.5) global resolution over - # Alaska - cd ../models/lnd/clm/tools/ncl_scripts - setenv MYID 13x12pt_f19_alaskaUSA - getregional_datasets.pl -sw 52,190 -ne 73,220 -id $MYID -mycsmdata $MYCSMDATA - - # Now create a case that uses these datasets - cd ../../../../../scripts - create_newcase -case testregional -compset I -mach bluefire -res pt1_pt1 -skip_rundb - cd testregional - $EDITOR env_conf.xml # change CLM_BLDNML_OPTS to include "-clm_usr_name $MYID" (expand $MYID) - $EDITOR env_mach_pes.xml # Change tasks/threads as appropriate (defaults to serial) - xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA - - # Do other changes to xml files as appropriate - # configure as normal, then edit the datm namelist - - configure -case - - # Then build and run the case as normal - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1102 (OpenMP problem with pftdyn mode) - 1121 (history variable attribute cell_methods misnamed) - 1118 (Restarts with SNICAR_FRC fail) - -Describe any changes made to build system: - - Change directory structure to match CCSM. - Add BGP target. - Add choice between ESMF and MCT frameworks. - Start removing #ifdef and directives that supported Cray-X1 Phoenix as now decommisioned. - Make default of maxpatch_pft=numpft+1 instead of 4 for all configurations. - By default turn on CLAMP when either CN or CASA is enabled - New SNICAR_FRC, CARBON_AERO, and C13 CPP ifdef tokens. - - New options added to configure: - - -comp_intf Component interface to use (ESMF or MCT) (default MCT) - -nofire Turn off wildfires for bgc setting of CN (default includes fire for CN) - -pio Switch enables building with Parallel I/O library. [on | off] (default is on) - -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] (default is off) - -Describe any changes made to the namelist: - - NOTE: build-namelist now checks the validity of your namelist you generate by looking at data in the namelist_definition.xml - file. In order to add new namelist items you need to change the code and also edit this file. To view information - on the namelist view the file: - models/lnd/clm/bld/namelist_files/namelist_definition.xml - in your browser and you'll see the names, type, description and valid_values for all namelist variables. - - Changes to build-namelist: - Transient sim_year ranges (i.e. 1850-2000) - Remove cam_hist_case option. - Make sure options ONLY used for stand-alone testing have a "drv_" or "datm_" prefix in them and list these - options all together and last when asking for help from build-namelist. - New options to build-namelist: - -clm_usr_name "name" Dataset resolution/descriptor for personal datasets. Default: not used - Example: 1x1pt_boulderCO_c090722 to describe location, - number of pts, and date files created - New list options to build-namelist: - build-namelist -res list # List valid resolutions - build-namelist -mask list # List valid land-masks - build-namelist -sim_year list # List valid simulation years and simulation year ranges - build-namelist -clm_demand list # List namelist variables including those you could demand to be included. - build-namelist -use_case list # List valid use-cases - - New use-cases for: - - 1850_control = Conditions to simulate 1850 land-use - 2000_control = Conditions to simulate 2000 land-use -20thC_transient = Simulate transient land-use, and aerosol deposition changes from 1850 to 2005 - glacier_mec = Placeholder for running IG cases with the ice sheet model glimmer - - New namelist items: - - urban_hac = OFF, ON or ON_WASTEHEAT (default OFF) Flag for urban Heating and Air-Conditioning - OFF = Building internal temperature is un-regulated. - ON = Building internal temperature is bounded to reasonable range. - ON_WASTEHEAT = Building internal temperature is bounded and resultant waste - heat is given off. - urban_traffic = .true. or .false. (default .false.) Flag to include additional multiplicative factor of urban traffic - to sensible heat flux. - fsnowoptions = filename file for snow/aerosol optical properties (required) - fsnowaging = filename file for snow aging parameters (required) - faerdep = filename file of aerosol deposition (required) - - New history variables: (note watt vs. W in units, 26 vs. 76) - BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s - C13_PRODUCT_CLOSS C13 total carbon loss from wood product pools gC13/m^2/s - DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s - EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 - FGR12 heat flux between soil layers 1 and 2 watt/m^2 - FSAT fractional area with water table at surface unitless - FSH_NODYNLNDUSE sensible heat flux not including correction for land use change - watt/m^2 - GC_HEAT1 initial gridcell total heat content J/m^2 - GC_HEAT2 post land cover change total heat content J/m^2 inactive - GC_ICE1 initial gridcell total ice content mm/s - GC_ICE2 post land cover change total ice content mm/s inactive - GC_LIQ1 initial gridcell total liq content mm - GC_LIQ2 initial gridcell total liq content mm inactive <<<< name?? - H2OSNO_TOP mass of snow in top snow layer kg - HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning - watt/m^2 - HK hydraulic conductivity mm/s inactive - LWup upwelling longwave radiation watt/m^2 inactive - NBP net biome production, includes fire, landuse, and harvest flux, positive for sink - gC/m^2/s - OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s - PBOT atmospheric pressure Pa - PCO2 atmospheric partial pressure of CO2 Pa - PRODUCT_CLOSS total carbon loss from wood product pools gC/m^2/s - PRODUCT_NLOSS total N loss from wood product pools gN/m^2/s - Qair atmospheric specific humidity kg/kg inactive - Qanth anthropogenic heat flux watt/m^2 inactive - Qtau momentum flux kg/m/s^2 - QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s - QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s - QRUNOFF_NODYNLNDUSE total liquid runoff not including correction for land use change (does not include QSNWCPICE) - mm/s - QSNWCPICE excess snowfall due to snow capping mm/s - QSNWCPICE_NODYNLNDUSE excess snowfall due to snow capping not including correction for land use change - mm/s - QSNWCPLIQ excess rainfall due to snow capping mm/s inactive - SMP soil matric potential mm inactive - SNOAERFRC2L surface forcing of all aerosols in snow, averaged only when snow is present (land) - watt/m^2 - SNOAERFRCL surface forcing of all aerosols in snow (land) watt/m^2 - SNOBCFRCL surface forcing of BC in snow (land) watt/m^2 - SNOBCMCL mass of BC in snow column kg/m2 - SNOBCMSL mass of BC in top snow layer kg/m2 - SNOdTdzL top snow layer temperature gradient (land) K/m - SNODSTFRC2L surface forcing of dust in snow, averaged only when snow is present (land) - watt/m^2 - SNODSTFRCL surface forcing of dust in snow (land) watt/m^2 - SNODSTMCL mass of dust in snow column kg/m2 - SNODSTMSL mass of dust in top snow layer kg/m2 - SNOFSRND direct nir reflected solar radiation from snow watt/m^2 inactive - SNOFSRNI diffuse nir reflected solar radiation from snow watt/m^2 inactive - SNOFSRVD direct vis reflected solar radiation from snow watt/m^2 inactive - SNOFSRVI diffuse vis reflected solar radiation from snow watt/m^2 inactive - SNOFSDSND direct nir incident solar radiation on snow watt/m^2 inactive - SNOFSDSNI diffuse nir incident solar radiation on snow watt/m^2 inactive - SNOFSDSVD direct vis incident solar radiation on snow watt/m^2 inactive - SNOFSDSVI diffuse vis incident solar radiation on snow watt/m^2 inactive - SNOLIQFL top snow layer liquid water fraction (land) fraction inactive - SNOOCMCL mass of OC in snow column kg/m2 - SNOOCMSL mass of OC in top snow layer Kg/m2 - SNOOCFRC2L surface forcing of OC in snow, averaged only when snow is present (land) - SNOOCFRCL surface forcing of OC in snow (land) watt/m^2 - watt/m^2 - SNORDSL top snow layer effective grain radius m^-6 inactive - SNOTTOPL snow temperature (top layer) K/m inactive <<< units? - SWup upwelling shortwave radiation watt/m^2 inactive - URBAN_AC urban air conditioning flux watt/m^2 - URBAN_HEAT urban heating flux watt/m^2 - Wind atmospheric wind velocity magnitude m/s inactive - WOOD_HARVESTC wood harvest (to product pools) gC/m^2/s - WOOD_HARVESTN wood harvest (to product pools) gN/m^2/s - - History field name changes: - - ANNSUM_PLANT_NDEMAND => ANNSUM_POTENTIAL_GPP - ANNSUM_RETRANSN => ANNMAX_RETRANSN - C13_DWT_PROD10C_LOSS => C13_PROD10C_LOSS - C13_DWT_PROD100C_LOSS => C13_PROD100C_LOSS - C13_DWT_PROD10N_LOSS => C13_PROD10N_LOSS - C13_DWT_PROD100C_LOSS => C13_PROD100C_LOSS - DWT_PROD100N_LOSS => PROD10N_LOSS - DWT_PROD100N_LOSS => PROD100N_LOSS - DWT_PROD100C_LOSS => PROD10C_LOSS - DWT_PROD100C_LOSS => PROD100C_LOSS - HCSOISNO => HC - TEMPSUM_PLANT_NDEMAND => TEMPSUM_POTENTIAL_GPP - TEMPSUM_RETRANSN => TEMPMAX_RETRANSN - - History field names deleted: - SNOWAGE, TSNOW, FMICR, FCO2, DMI, QFLX_SNOWCAP - - Add new urban oriented _U, and _R (Urban and Rural) for: - EFLX_LH_TOT, FGR, FIRA, FSH, FSM, Q2M, QRUNOFF, RH2M, SoilAlpha, TG, TREFMNAV, TREFMXAV, and TSA - (missing _R for SoilAlpha) - -Describe timing and memory performance: - -Versions of any externally defined libraries: - - scripts scripts4_100108b - drv vocemis-drydep12_drvseq3_1_11 - datm datm8_091218 - socn stubs1_2_02/socn - sice stubs1_2_02/sice - sglc stubs1_2_02/sglc - csm_share vocemis-drydep13_share3_091217 - esmf_wrf_timemgr esmf_wrf_timemgr_090402 - timing timing_090929 - mct MCT2_7_0_100106 - pio pio60_prod - cprnc cprnc_081022 - -Summary of testing: - bluefire: All PASS up to...017 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............PASS - bluefire interactive testing: All PASS up to.. -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - bluefire/CCSM testing: -PASS ERH.f09_g16.B20TRCN.bluefire -BFAIL ERH.f09_g16.B20TRCN.bluefire.compare.ccsm4_0_beta38 --- compset names changed -- but cpl.log files compare exactly -! -> ../Tools/check_exactrestart.pl cpl.log.100109-171753 $FISHOME/ccsm4_0_beta38/scripts/ERH.f09_g16.B20TRTR1CN.bluefire.G -.172652/logs/cpl.log.100108-181015 -log files match! -PASS -PASS SMS_RLA.f45_f45.I.bluefire -PASS SMS_RLB.f45_f45.I.bluefire -PASS SMS_ROA.f45_f45.I.bluefire -PASS ERS_D.f45_g37.I.bluefire -PASS ERS_D.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS_D.f45_g37.I.bluefire.compare.clm3_6_58+datm8 -PASS PET.f45_g37.I1850.bluefire.cpl -PASS PET.f45_g37.I1850.bluefire.atm -PASS PET.f45_g37.I1850.bluefire.lnd -PASS PET.f45_g37.I1850.bluefire.ice -PASS PET.f45_g37.I1850.bluefire.ocn -PASS PET.f45_g37.I1850.bluefire.glc -PASS PET.f45_g37.I1850.bluefire.compare.clm3_6_58+datm8 -PASS ERS.f19_g16.I1850.bluefire -PASS ERS.f19_g16.I1850.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS.f19_g16.I1850.bluefire.compare.clm3_6_58+datm8 -PASS ERB.f09_g16.I_1948-2004.bluefire -PASS ERB.f09_g16.I_1948-2004.bluefire.compare.clm3_6_58+datm8 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire <<<<<<<<<<<<<<<<<<<<<<<<< Failed before bug 1063 -PASS ERH_D.f10_f10.I1850CN.bluefire -PASS PET.f10_f10.I8520CN.bluefire.cpl -PASS PET.f10_f10.I8520CN.bluefire.atm -PASS PET.f10_f10.I8520CN.bluefire.lnd -PASS PET.f10_f10.I8520CN.bluefire.ice -PASS PET.f10_f10.I8520CN.bluefire.ocn -PASS PET.f10_f10.I8520CN.bluefire.glc - jaguar interactive testing: All PASS up to... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - dublin/lf95 interactive testing: None PASS because of bug 1092 - dublin/lf95: None PASS because of bug 1092 - dublin/INTEL interactive testing: ALL PASS except (and didn't compare to baseline) -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -028 smM94 TSMncl_tools.sh ndepregrid ............................................................FAIL! rc= 6 -030 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - dublin/INTEL: All PASS up to 021 smJ92 TSM.sh (and didn't compare to baseline) -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - -=============================================================== -=============================================================== -Tag name: clm3_6_64 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Fri Jan 22 22:19:24 MST 2010 -One-line Summary: Update documentation and README/Quickstart files, set NetCDF large-file format on by default in template, update pio, update some fsurdat files to vocemis-drydep versions, add 2.5x3.33_gx3v7 frac file, make gx3v7 default for 4x5 res - -Purpose of changes: - -Setup makefiles for docbook UsersGuide to output both pdf and html formats. Work on documentation of new _esmf driver files. Work on documentation. Make sure documentation of clm xml variables is good. Add note about CASA NOT being supported. Work on README/Quickstart files, and move the files from the top level to clm doc directory, but leave a file at top level pointing to these files. Make large file support default, remove LND_CDF64. Add in VOC surfdata files from voc branch: T42, T31, T21, T5, 4x5, 10x15-pftdyn. Add in new 2x5x3.33_gx3v7 frac file. Make default mask for 4x5 gx3v7. - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Turn NetCDF large-file support on by default - -List any changes to the defaults for the boundary datasets: - - New fsurdat files for: T42, T31, T21, T5, 4x5 - New fpftdyn file for 10x15 for 1850-2000, new frac file for 2.5x3.33_gx3v7 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): pio - - pio updated to google version: http://parallelio.googlecode.com/svn/trunk_tags/pio1_0_7/pio - -List all files eliminated: - - D Quickstart.userdatasets --- Move to models/lnd/clm/doc - D Quickstart.GUIDE ---------- Move to models/lnd/clm/doc - D README.DGVM --------------- Move to models/lnd/clm/doc - D KnownBugs ----------------- Move to models/lnd/clm/doc - D models/lnd/clm/doc/docs.html ----------------- Remove in favor of DocBook documentation - D models/lnd/clm/doc/UsersGuide/clm_head.shtml - Remove in favor of DocBook documentation - D models/lnd/clm/doc/UsersGuide/tree.html ------ Remove in favor of DocBook documentation - D models/lnd/clm/doc/UsersGuide/clm_foot.shtml - Remove in favor of DocBook documentation - D models/lnd/clm/doc/UsersGuide/index.shtml ---- Remove in favor of DocBook documentation - -List all files added and what they do: - - A models/lnd/clm/doc/Quickstart.userdatasets - Move from top level - A models/lnd/clm/doc/IMPORTANT_NOTES --------- Add important notes about what's scientifically valided/expected to work - A models/lnd/clm/doc/Quickstart.GUIDE -------- Move from top level - A models/lnd/clm/doc/KnownBugs --------------- Move from top level - A models/lnd/clm/doc/UsersGuide/Makefile ----- Makefile to build Users-Guide - A models/lnd/clm/doc/index.shtml ------------- Add HTML guide to documentation - A models/lnd/clm/doc/CodeReference/Filepath -- Filepath to source-code to build Code Reference Guide - A models/lnd/clm/doc/CodeReference/Makefile -- Makefile to build Code Reference Guide using Protex - - A models/lnd/clm/test/system/Makefile -------- Makefile to build HTML test table - - A models/lnd/clm/test/system/config_files/_nrsc_do --- Add smp only option for no-RTM seq-ccsm default mode - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/clm.cpl7.template -------------------------- Set large_file_format to true by default - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- Add in vocemis-drydep branch fsurdat files for: T42, T31, T21, T5, - and 4x5 resolution (as well as 10x15 1850-2005 pftdyn file) - Add in 2.5x3.33_gx3v7 frac file, and make gx3v7 mask the default - for 4x5 resolution. - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml -- 2.5x3.33_gx3v7 domain file ->>>>>>>>>>>>> Update documentation and README text files - M models/lnd/clm/test/system/README - M models/lnd/clm/tools/mksurfdata/README - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ------------------ Make namelist documentation a little more clea - M models/lnd/clm/tools/ncl_scripts/convertUrbanOffline2Seq.ncl -- Document datm as datm8 - M models/lnd/clm/tools/ncl_scripts/README - M models/lnd/clm/tools/interpinic/README - M models/lnd/clm/tools/mkdatadomain/README - M models/lnd/clm/tools/README - M models/lnd/clm/bld/README - M models/lnd/clm/doc/UsersGuide/index.xml ---- Update docbook UsersGuide - M models/lnd/clm/doc/README - M README - - M models/lnd/clm/test/system/tests_pretag_bluefire ----------- Remove LD1 (2.65x3.33 res) tests - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - Remove LD1 tests - M models/lnd/clm/test/system/input_tests_master -------------- Remove LD1 tests - -Summary of testing: - - bluefire: All PASS except... -004 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 7 << 4x5 fsurdat -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 7 << 4x5 fsurdat -012 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 arb_ic ............FAIL! rc= 7 << 4x5 fsurdat -017 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 7 << 4x5 fsurdat -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -030 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 7 << 10x15 fpftdyn different -042 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 6 -043 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 5 - bluefire interactive testing: All PASS except... -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -032 blF93 TBL.sh 17p_vodsrsc_do clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 7 << 4x5 fsurdat -040 blL83 TBL.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ..........FAIL! rc= 5 << no _nrsc_do in previous -041 bl744 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 7 << script error -043 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 7 << script error -045 bl754 TBLtools.sh mksurfdata tools__s globalirrig ...........................................FAIL! rc= 3 << script error -050 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 3 - bluefire/CCSM testing: All PASS except... -BFAIL SMS_RLA.f45_f45.I.bluefire.compare.clm3_6_58+datm8 <<<<<<<<<<< 4x5 surfdata file different than previous version -BFAIL SMS_RLB.f45_f45.I.bluefire.compare.clm3_6_58+datm8 <<<<<<<<<<< 4x5 surfdata file different -BFAIL SMS_ROA.f45_f45.I.bluefire.compare.clm3_6_58+datm8 <<<<<<<<<<< 4x5 surfdata file different -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 <<<<<<<< 4x5 surfdata file different -FAIL ERS_D.f45_g37.I.bluefire.compare.clm3_6_58+datm8 <<<<<<<<<<<<< 4x5 surfdata file different -FAIL PET.f45_g37.I1850.bluefire.compare.clm3_6_58+datm8 <<<<<<<<<<< 4x5 surfdata file different -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire <<<<<<<<<<<<<<<<<<<<<<<<<<< Previous failure -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_6_64 <<<<<<<< Previous failure -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_6_58+datm8 <<< Previous failure -BFAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_6_58+datm8 <<<<<<< 10x15 pftdyn file different -BFAIL PET.f10_f10.I8520CN.bluefire.compare.clm3_6_58+datm8 <<<<<<<<< 10x15 pftdyn file different - -CLM tag used for the baseline comparison tests if applicable: clm3_6_63 - -Changes answers relative to baseline: Only for the following resolutions because of new fsurdat files: T42, T31, T5, 4x5 - and for dynamic PFT at 10x15 resolution because of a new pftdyn file - -=============================================================== -=============================================================== -Tag name: clm3_6_63 -Originator(s): erik (erik) -Date: Sat Jan 9 20:37:53 MST 2010 -One-line Summary: Get answers to be identical with ccsm4_0_beta38 for 1 and 2 degree transient cases - -Purpose of changes: - -Get answers to be identical to ccsm4_0_beta38 for both 1 and 2 degree transient cases. Update scripts to -very latest. Tweak test_suite for CN so that can run with finidat file, and can run interactive on dublin -by turning CCSM_BLD to off. - -Bugs fixed (include bugzilla ID): - 1098 (Use finidat weights instead of weights from fpftdyn file) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1102 (OpenMP problem with pftdyn mode) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts - -List all files eliminated: None - -List all files added and what they do: - ->>>>>> Add configuration files for CN with default of numpft+1 maxpft -A models/lnd/clm/test/system/config_files/_cnnsc_h -A models/lnd/clm/test/system/config_files/_cnnsc_m -A models/lnd/clm/test/system/config_files/_cnnsc_o -A models/lnd/clm/test/system/config_files/_cnnsc_dh -A models/lnd/clm/test/system/config_files/_cnnsc_dm -A models/lnd/clm/test/system/config_files/_cnnsc_do -A models/lnd/clm/test/system/config_files/_cnnsc_ds - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>> Tweak test suite so can test for a CN transient case with a startup file, needed to find bug -M models/lnd/clm/test/system/test_driver.sh ------------ Turn CCSM_BLD to off for interactive use -M models/lnd/clm/test/system/input_tests_master -------- Tweak CN tests so can use finidat file ->>>>>>>>>>>>>>> Get answers to be identical with ccsm4_0_beta38 -M models/lnd/clm/src/main/clm_initializeMod.F90 -------- add extra call to pftdyn_interp after restart -M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 -- Read weights directly into clm_type rather than - a temporary array. - -Summary of testing: - - bluefire: All PASS up to... -017 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............PASS - bluefire interactive testing: All PASS up to.. -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - bluefire/CCSM testing: -PASS ERH.f09_g16.B20TRCN.bluefire -BFAIL ERH.f09_g16.B20TRCN.bluefire.compare.ccsm4_0_beta38 --- compset names changed -- but cpl.log files compare exactly! -> ../Tools/check_exactrestart.pl cpl.log.100109-171753 $FISHOME/ccsm4_0_beta38/scripts/ERH.f09_g16.B20TRTR1CN.bluefire.G.172652/logs/cpl.log.100108-181015 -log files match! -PASS -PASS SMS_RLA.f45_f45.I.bluefire -BFAIL SMS_RLA.f45_f45.I.bluefire.compare.clm3_6_58+datm8 <<< f45_f45 NOT allowed in baseline -PASS SMS_RLB.f45_f45.I.bluefire -BFAIL SMS_RLB.f45_f45.I.bluefire.compare.clm3_6_58+datm8 <<< f45_f45 NOT allowed in baseline -PASS SMS_ROA.f45_f45.I.bluefire -BFAIL SMS_ROA.f45_f45.I.bluefire.compare.clm3_6_58+datm8 <<< f45_f45 NOT allowed in baseline -PASS ERS_D.f45_g37.I.bluefire -PASS ERS_D.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS_D.f45_g37.I.bluefire.compare.clm3_6_58+datm8 -PASS PET.f45_g37.I1850.bluefire.cpl -PASS PET.f45_g37.I1850.bluefire.atm -PASS PET.f45_g37.I1850.bluefire.lnd -PASS PET.f45_g37.I1850.bluefire.ice -PASS PET.f45_g37.I1850.bluefire.ocn -PASS PET.f45_g37.I1850.bluefire.glc -PASS PET.f45_g37.I1850.bluefire.compare.clm3_6_58+datm8 -PASS ERS.f19_g16.I1850.bluefire -PASS ERS.f19_g16.I1850.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS.f19_g16.I1850.bluefire.compare.clm3_6_58+datm8 -PASS ERB.f09_g16.I_1948-2004.bluefire -PASS ERB.f09_g16.I_1948-2004.bluefire.compare.clm3_6_58+datm8 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire <<<<<<<<<<<<<<<<<<<<<<<<< Failed before bug 1063 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_6_58+datm8 -PASS ERH_D.f10_f10.I1850CN.bluefire -BFAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_6_58+datm8 <<< f10_f10 NOT allowed in baseline -PASS PET.f10_f10.I8520CN.bluefire.cpl -PASS PET.f10_f10.I8520CN.bluefire.atm -PASS PET.f10_f10.I8520CN.bluefire.lnd -PASS PET.f10_f10.I8520CN.bluefire.ice -PASS PET.f10_f10.I8520CN.bluefire.ocn -PASS PET.f10_f10.I8520CN.bluefire.glc -BFAIL PET.f10_f10.I8520CN.bluefire.compare.clm3_6_58+datm8 <<< f10_f10 NOT allowed in baseline - jaguar interactive testing: All PASS up to... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - dublin/lf95 interactive testing: None PASS because of bug 1092 - dublin/lf95: None PASS because of bug 1092 - dublin/INTEL interactive testing: ALL PASS except (and didn't compare to baseline) -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -028 smM94 TSMncl_tools.sh ndepregrid ............................................................FAIL! rc= 6 -030 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - dublin/INTEL: All PASS up to 021 smJ92 TSM.sh (and didn't compare to baseline) -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_58+datm8 - -Changes answers relative to baseline: No bit-for-bit -- really now! - -=============================================================== -=============================================================== -Tag name: clm3_6_62 -Originator(s): erik (erik) -Date: Fri Jan 8 04:50:59 MST 2010 -One-line Summary: Fix startup of PFT transient cases so properly use data from pftdyn file rather than finidat file - -Purpose of changes: - -Attempt to fix bug 1098 so that properly use the PFT weights interpolated from the fpftdyn file rather than using the -weights from the input finidat file. - -Bugs fixed (include bugzilla ID): Attempt to fix -- but only a partial fix, answers were still different - 1098 (Use finidat weights instead of weights from fpftdyn file) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1102 (OpenMP problem with pftdyn mode) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts and mct - - scripts to scripts4_100107b - mct to MCT2_7_0_100106 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 --- Fix bug with fpftdyn weights - M models/lnd/clm/test/system/test_driver.sh ------------- Fix name of ifort Macros file - -Summary of testing: - - bluefire: All PASS except, up to 045 erLD1 -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - bluefire interactive testing: All PASS up to.. -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - bluefire/CCSM testing: All PASS except CN spinup as below -PASS ERS.f09_g16.I8520CN.bluefire -PASS ERS.f09_g16.I8520CN.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS.f09_g16.I8520CN.bluefire.compare.clm3_6_58+datm8 -PASS SMS_RLA.f45_g37.I.bluefire -PASS SMS_RLA.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 -PASS SMS_RLA.f45_g37.I.bluefire.compare.clm3_6_58+datm8 -PASS SMS_RLB.f45_g37.I.bluefire -PASS SMS_RLB.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 -PASS SMS_RLB.f45_g37.I.bluefire.compare.clm3_6_58+datm8 -PASS SMS_ROA.f45_g37.I.bluefire -PASS SMS_ROA.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 -PASS SMS_ROA.f45_g37.I.bluefire.compare.clm3_6_58+datm8 -PASS ERS_D.f45_g37.I.bluefire -PASS ERS_D.f45_g37.I.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS_D.f45_g37.I.bluefire.compare.clm3_6_58+datm8 -PASS PET.f45_g37.I1850.bluefire.cpl -PASS PET.f45_g37.I1850.bluefire.atm -PASS PET.f45_g37.I1850.bluefire.lnd -PASS PET.f45_g37.I1850.bluefire.ice -PASS PET.f45_g37.I1850.bluefire.ocn -PASS PET.f45_g37.I1850.bluefire.glc -PASS PET.f45_g37.I1850.bluefire.compare.clm3_6_58+datm8 -PASS ERS.f19_g16.I1850.bluefire -PASS ERS.f19_g16.I1850.bluefire.compare_hist.clm3_6_58+datm8 -PASS ERS.f19_g16.I1850.bluefire.compare.clm3_6_58+datm8 -PASS ERB.f09_g16.I_1948-2004.bluefire -PASS ERB.f09_g16.I_1948-2004.bluefire.compare.clm3_6_58+datm8 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_6_58+datm8 -PASS ERH_D.f09_g16.I1850CN.bluefire -PASS ERH_D.f09_g16.I1850CN.bluefire.compare.clm3_6_58+datm8 -PASS PET.f19_g16.I8520CN.bluefire.cpl -PASS PET.f19_g16.I8520CN.bluefire.atm - jaguar: All PASS up to 021 smJ05 - jaguar interactive testing: All FAIL except... -001 smA74 TSM.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........PASS -002 erA74 TER.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -5+-5 arb_ic ........PASS -003 brA74 TBR.sh _nrsc_ds clm_std^nl_urb_br 20030101:NONE:1800 1x1_brazil navy -5+-5 arb_ic .....PASS -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........PASS -005 smAK4 TSM.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............PASS -008 blAK4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............PASS - dublin/lf95: None pass because of bug 1092 - dublin/pgi: All PASS except... -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -030 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 4 - dublin/ifort interactive: All PASS up to... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_58+datm8 (ccsm4_0_beta38) - -Changes answers relative to baseline: Identical without fpftdyn files - with and without finidat files. But, can be - different to roundoff or more for transient cases. - -=============================================================== -=============================================================== -Tag name: clm3_6_61 -Originator(s): erik (erik) -Date: Thu Jan 7 00:55:20 MST 2010 -One-line Summary: Comment out endrun on finidat and fsurdat weights being incomptable, and go back to using finidat weights - -Purpose of changes: - -Most of our finidat files have weights incompatible with our new fsurdat files. Hence, we went back to allowing -the weights to be different and to using the finidat weights so that answers would be the same as before. -Also hardwire the logfile for datm and clm so that can run testsuite on jaguar. Also add in cppdef required -for breeze. - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1098 (Use finidat weights instead of weights from fpftdyn file) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts - scripts to scripts4_100107 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/test_driver.sh -------------------- Add -cppdefs '-DFORTRANUNDERSCORE' for breeze. - M models/lnd/clm/bld/build-namelist ---------------------------- For standalone testing hardwire clm and - datm output log files - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Add comment remove logfile - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 ---------- Put implicit none in right place, comment - out abort if weights too different, and use finidat weights instead of fsurdat weights. Hence - this version is identical to clm3_6_58, other than the use of datm8 (which is roundoff different). - -Summary of testing: - - bluefire: -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -051 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 4 -052 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 4 -053 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 4 -054 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - bluefire/CCSM testing: -PEND SMS_RLA.f45_f45.I.bluefire.200614 -PEND SMS_RLB.f45_f45.I.bluefire.200614 -PASS SMS_ROA.f45_f45.I.bluefire -PASS ERS_D.f45_g37.I.bluefire -PASS PET.f45_g37.I1850.bluefire.cpl -PASS PET.f45_g37.I1850.bluefire.atm -PASS PET.f45_g37.I1850.bluefire.lnd -PASS PET.f45_g37.I1850.bluefire.ice -PASS PET.f45_g37.I1850.bluefire.ocn -PASS PET.f45_g37.I1850.bluefire.glc -PASS ERS.f19_g16.I1850.bluefire -PASS ERB.f09_g16.I_1948-2004.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -PASS ERH_D.f10_f10.I1850CN.bluefire -PASS PET.f10_f10.I8520CN.bluefire.cpl -PASS PET.f10_f10.I8520CN.bluefire.atm -PASS PET.f10_f10.I8520CN.bluefire.lnd -PASS PET.f10_f10.I8520CN.bluefire.ice -PASS PET.f10_f10.I8520CN.bluefire.ocn -PASS PET.f10_f10.I8520CN.bluefire.glc - jaguar interactive testing: -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........FAIL! rc= 5 -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -008 blAK4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............FAIL! rc= 5 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -013 smJ74 TSM.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -1100 arb_ic FAIL! rc= 8 -014 erJ74 TER.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -10+-10 arb_ic FAIL! rc= 5 -015 brJ74 TBR.sh 4p_nrcasasc_ds clm_std^nl_urb_br 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_icFAIL! rc= 5 -016 blJ74 TBL.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic FAIL! rc= 4 - dublin/lf95: All Fail due to bug 1092 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_58 (but with datm8 rather than datm7) - -Changes answers relative to baseline: No bit-for-bit except for transient cases which are different - -=============================================================== -=============================================================== -Tag name: clm3_6_60 -Originator(s): erik (erik) -Date: Tue Jan 5 23:59:43 MST 2010 -One-line Summary: Fix clm template - -Purpose of changes: - -Fix the broken clm template. Update externals for very latest scripts tag. - -Bugs fixed (include bugzilla ID): Fix clm template which was broken - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): Update scripts - - scripts to scripts4_100105b - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/system/test_driver.sh -- update bl to ccsm4_0_beta38 -M models/lnd/clm/bld/clm.cpl7.template ------- fix so can work - -Summary of testing: - - bluefire/CCSM testing: -PASS SMS_RLA.f45_f45.I.bluefire -PASS SMS_RLB.f45_f45.I.bluefire -PASS SMS_ROA.f45_f45.I.bluefire -FAIL ERS.f19_g16.I_1850.bluefire -FAIL ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948-2004.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -PASS ERH_D.f10_f10.I_1850_CN.bluefire -PASS PET.f10_f10.I8520CN.bluefire.cpl -PASS PET.f10_f10.I8520CN.bluefire.atm -PASS PET.f10_f10.I8520CN.bluefire.lnd - -CLM tag used for the baseline comparison tests if applicable: clm3_6_59 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_6_59 -Originator(s): erik (erik) -Date: Tue Jan 5 17:44:48 MST 2010 -One-line Summary: Update to datm8, fix so wts used are from fsurdat file NOT finidat file - -Purpose of changes: - -Changes needed for beta34 ESMF upgrade. Use new datm8 model which is more flexible and -has new options as well as parallel IO. Add in 4x5_gx3v7 frac file. Remove use for -ESMF_mod. Abort if finidat weights are significantly different from surfdata file -weights. Change name of driver and initializeMod to have a clm_ prefix. Convert UG -outline from html to DocBook. Make changes to code documentation for high level -subroutines. Remove documentation of namelist items in controlMod and have it point -to the documentation in the xml namelist file. Fix "called from" in code documentation -and remove a lot of the concurrent directives. New files from Tony for esmf interface. -Alpha release testing will start with this version. - -Bugs fixed (include bugzilla ID): - 1084 (don't use only for ESMF_Mod) - 1087 (let weights come from fsurdat file NOT finidat) - 1088 (change name of driver module) - 1093 (namelist tweaks) -- partial - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: - Let CCSM build determine FORTRAN mangle definitions - Directory structure changes slightly with new ESMF interfaces and new datm8 - -Describe any changes made to the namelist: - Make default for hist_crtinic NONE so clm.i files are NOT made by default. - Change names of options to build-namelist that only are for clm stand-alone testing. - Add a drv_ or datm_ prefix, and separate how these options are displayed in the help - Also add an option to several commands for "list" so that you can list the variables - for clm_demand, for resolution, and for use-cases. - Also update build-namelist to work with the new datm8 - -List any changes to the defaults for the boundary datasets: Add in 4x5_gx3v7 dataset - -Describe any substantial timing or memory changes: datm8 is approx. 30% faster - datm8 also allows you to enable parallel I/O - -Code reviewed by: self, oleson, slevis, dlawren review of weights change - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm, csm_share, drv, pio - -+scripts to scripts4_100103b -+drv to vocemis-drydep12_drvseq3_1_11 -+datm to datm8_091218 -+csm_share to vocemis-drydep13_share3_091217 -+pio to pio60_prod - -List all files eliminated: - - D models/lnd/clm/test/system/config_files/_mexsc_ds --- Rename with nr in name - D models/lnd/clm/test/system/config_files/_vansc_ds --- Rename with nr in name - D models/lnd/clm/src/main/driver.F90 ------------------ Rename with clm_ prefix - D models/lnd/clm/src/main/initializeMod.F90 ----------- Rename with clm_ prefix - D models/lnd/clm/src/biogeophys/DriverInitMod.F90 ----- Rename to clm_driverInitMod - -List all files added and what they do: - - A models/lnd/clm/doc/UsersGuide/index.xml ---------------- Users Guide Outline in docbook format ->>>>>>>>>>> Version with "nr" so that RTM is turned off for non-global tests - A models/lnd/clm/test/system/config_files/_nrsc_s - A models/lnd/clm/test/system/config_files/17p_nrsc_ds - A models/lnd/clm/test/system/config_files/4p_nrcasasc_ds - A models/lnd/clm/test/system/config_files/_nrsc_ds - A models/lnd/clm/test/system/config_files/_nrmexsc_ds - A models/lnd/clm/test/system/config_files/_nrvansc_ds - A models/lnd/clm/test/system/config_files/17p_nrcnnsc_ds ->>>>>>>>>>> New files from Tony for ESMF interfaces - A models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - A models/lnd/clm/src/main/cpl_esmf/lnd_comp_mct.F90 - - A models/lnd/clm/src/main/clm_initializeMod.F90 ---------- Rename with clm_ prefix - Also change so that dyn pft is always called before reading in the restart - file. - A models/lnd/clm/src/main/clm_driver.F90 ----------------- Rename with clm_ prefix - A models/lnd/clm/src/biogeophys/clm_driverInitMod.F90 ---- Rename from driverInitMod - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/config_files/README -- Note about nr means no-RTM - M models/lnd/clm/test/system/test_driver.sh ------- Some tweaks for dublin/intrepid - M models/lnd/clm/test/system/mknamelist ----------- Changes for datm namelists, and - change for new options names for - build-namelist - M models/lnd/clm/test/system/nl_files/clm_per ----- Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/nl_files/clm_std ----- Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/nl_files/clm_ndepdyn - Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/nl_files/clm_pftdyn -- Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/nl_files/clm_per0 ---- Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/nl_files/clm_spin ---- Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/nl_files/clm_urb1pt -- Change case and source to - drv_case and datm_source - M models/lnd/clm/test/system/input_tests_master --- Use nr in test names - M models/lnd/clm/test/system/CLM_runcmnd.sh ------- Change name for laptop - M models/lnd/clm/test/system/TSM.sh --------------- Change datm restart files - - M models/lnd/clm/bld/clm.cpl7.template ------------ Change template to not put RTM - time-step in when rtm is off - M models/lnd/clm/bld/configure -------------------- Change to new datm dir structure - M models/lnd/clm/bld/listDefaultNamelist.pl ------- Change name of datm namelist - M models/lnd/clm/bld/build-namelist --------------- New list options, update for - new datm8 namelist. - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ---- Document pio options - new datm8 namelist items, CASA nameist items, and fget_archdev - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- New 4x5_gx3v7 frac file - set default of hist_crtinic to NONE - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - New datm8 defaults - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl ---- Add section for - CASA nl items, and a commented out section for the pio items - - M models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 ---- Fix called from, rm concurrnt directives - M models/lnd/clm/src/biogeochem/CASAPhenologyMod.F90 ------ Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNGapMortalityMod.F90 ----- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNC13StateUpdate2Mod.F90 -- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/DGVMEcosystemDynMod.F90 --- Fix called from - M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 ----- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CASAMod.F90 --------------- Doc routine as private, fix called from, rm con dirct. - M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 - Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNSummaryMod.F90 ---------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 -- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/DGVMMod.F90 --------------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNC13StateUpdate3Mod.F90 -- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 ----- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/C13SummaryMod.F90 --------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 -------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNC13FluxMod.F90 ---------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 --------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 -- Fix called from, rm con dirt. - - M models/lnd/clm/src/main/clm_comp.F90 ------------- Add clm_ prefix to calls - M models/lnd/clm/src/main/pftdynMod.F90 ------------ Fix called from, rm con dirt. - M models/lnd/clm/src/main/histFileMod.F90 ---------- Add more documentation, rm con direct. - M models/lnd/clm/src/main/clm_atmlnd.F90 ----------- Change documentation of units for nee - M models/lnd/clm/src/main/restFileMod.F90 ---------- Change called from documentation - M models/lnd/clm/src/main/controlMod.F90 ----------- Remove namelist items documentation - point to xml files for documenation - Work with code documentation - Get rid of notes about aerdep - files going away - M models/lnd/clm/src/main/clm_time_manager.F90 ----- Fix called from doc - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 - Add documentation - M models/lnd/clm/src/main/domainMod.F90 ------------ Clarify which driver in doc - M models/lnd/clm/src/main/clmtype.F90 -------------- Work on code documentation - M models/lnd/clm/src/main/histFldsMod.F90 ---------- Work on code documentation and formatting - - M models/lnd/clm/src/riverroute/RtmMod.F90 - Fix called from - - M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ------ Remove KO and fix called from in code doc, rm con dirct. - M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 ---- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 ----- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/Hydrology1Mod.F90 -------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 -------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/BiogeophysicsLakeMod.F90 - Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/UrbanMod.F90 ------------- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 ----- Fix called from, rm con dirt. - M models/lnd/clm/src/biogeophys/SNICARMod.F90 ------------ Fix called from. - - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 - Check that weights when read - in agree reasonably closely with fsurdat weights - -Summary of testing: - - bluefire: -004 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 7 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 7 -012 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 arb_ic ............FAIL! rc= 7 -017 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 7 -021 blEH1 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 7 -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -028 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -3+-7 arb_ic .......FAIL! rc= 13 -029 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -5+-5 arb_ic .......FAIL! rc= 11 -030 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 7 -034 blC61 TBL.sh _sc_dh clm_std^nl_urb 20021001:NONE:1800 1.9x2.5 gx1v6 48 cold .................FAIL! rc= 7 -038 blH52 TBL.sh 17p_cnnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 48 cold .........FAIL! rc= 7 -043 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 7 -049 blJ61 TBL.sh 4p_casasc_dh clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 48 cold ...........FAIL! rc= 7 -050 smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v6 48 arb_ic .....FAIL! rc= 10 -051 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 4 -052 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 3 -053 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 3 -054 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 3 - bluefire interactive testing: -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........FAIL! rc= 5 -009 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 5 -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -017 blJ74 TBL.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic FAIL! rc= 5 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -023 blAK4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............FAIL! rc= 7 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -028 blL78 TBL.sh _nrsc_s clm_std^nl_urb 20021231:NONE:1800 1x1_brazil navy -10 arb_ic ...........FAIL! rc= 5 -032 blF93 TBL.sh 17p_vodsrsc_do clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 7 -033 smL83 TSM.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ..........FAIL! rc= 4 -034 erL83 TER.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -5+-5 arb_ic ........FAIL! rc= 5 -035 brL83 TBR.sh _nrsc_do clm_std^nl_urb_br 20020115:NONE:3600 5x5_amazon navy -10+-10 arb_ic ...FAIL! rc= 5 -036 blL83 TBL.sh _nrsc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ..........FAIL! rc= 4 -041 bl744 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 7 -043 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 7 -045 bl754 TBLtools.sh mksurfdata tools__s globalirrig ...........................................FAIL! rc= 6 -050 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - dublin/lf95: No testing as all tests fail due to bug 1092 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_58 - -Changes answers relative to baseline: datm8 causes answers to be roundoff different - Change to use of fsurdat instead of finidat weights means answers may change - for non-coldstart cases. - -=============================================================== -=============================================================== -Tag name: clm3_6_58 -Originator(s): erik (erik) -Date: Tue Dec 8 12:56:47 MST 2009 -One-line Summary: Fix rpointer, correct units for export of nee, start adding testing for intrepid - -Purpose of changes: - Only update the rpointer file when restart files are written NOT when clm.i initial - files are written. This was causing problems to restart the model when it was - aborting before it completed it's period to run for. - Correct the units for the export of NEE from kg C to kg CO2 (kgCO2/m2/s) - Remove some concurent directives in the code and the unicosmp target_os in - configure as we no longer have Phoenix. - Add bgp target_os to configure, only set Fortran mangling if NOT using the - CCSM build in configure. - Add CN atm spinup data source as option to configure and to test_driver.sh. - Update version of external to test with to ccsm4_0_beta35 - Add ability to test on intrepid to test_driver.sh. - -Bugs fixed (include bugzilla ID): - 1079 (rpointer file updated with clm.i files) - 1082 (Add bgp, don't do Fortran mangling for CCSM build) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - -Known bugs (include bugzilla ID): 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1070 (pftdyn datasets bad for f19, 2.5x3.33) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Have configure write out unresolved filepaths - when called from cpl7.template - -Describe any changes made to the namelist: drv namelist updated - -List any changes to the defaults for the boundary datasets: - Add 2.5x3.33 resolution - Remove 2x2.5 res files - New f09, f19 finidat files - New f09, f19, f10, 1x1_tropicAtl fsurdat/fpftdyn files (only f19 change answers) - New f05, 5x5_amazon, 1x1_brazil 2000 fsurdat file (b4b) - New f03, f09, f19, f03, f10 ndepdyn files (changes 1851-1924, 1996-2004) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): to ccsm4_0_beta33 versions - - scripts to scripts4_091027b - drv to vocemis-drydep12_drvseq3_0_37 - datm7 to datm7_090928 - socn/sice/sglc to stubs1_2_02 - csm_share to share3_091013 - timing to timing_090929 - mct to MCT2_6_0_090926 - pio to pio57_prod - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M Quickstart.userdatasets --- Update notes about setting user-defined datasets ->>>>>>>>>>>>>>> Update jaguar, kraken, and bluefire env vars to latest scripts ->>>>>>>>>>>>>>> Remove blAK8 test as ocean-only and no clm files to compare - M models/lnd/clm/test/system/README.testnames ---------------- Add 2.5x3.33 test resolution - M models/lnd/clm/test/system/tests_driver.sh ----------------- Update env vars - to whats in scripts4_091015 for jaguar, kraken and bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi ----- Rm blAK8 - M models/lnd/clm/test/system/input_tests_master -------------- Rm blAK8, add 1x1_tropicAtl@1850,1850-2000, and 2.5x3.33 tests - M models/lnd/clm/test/system/tests_posttag_nompi_regression -- Rm blAK8 - ->>>>>>>>>>>>>>> Allow configure to write out unresolved Filepath, make TopCCSMBld ->>>>>>>>>>>>>>> Makefile closer to CPL7 version - M models/lnd/clm/bld/configure -------------------------- Add clm_root option - add ability to set comp_intf to cpl_$COMP, allow ability to check for - directories existance resolving env vars that are set. Create a subroutine - is_valid_directory to check for directories instead of "-d". - M models/lnd/clm/bld/config_files/config_definition.xml - Allow cpl_$COMP rm lapacklibdir - M models/lnd/clm/bld/clm.cpl7.template -- Set COMP based on COMP_INTERFACE, - add clm_root to configure, don't resolve CODEROOT and CASEROOT on output - M models/lnd/clm/bld/config_files/TopCCSMBldMakefile.in - Changes to make closer to scripts4_091015 version. ->>>>>>>>>>>>>>> Change drv namelist names, - M models/lnd/clm/bld/build-namelist ----- Change drv namelist names: cpl_io_numtasks/cpl_io_typename ->>>>>>>>>>>>>>> Change drv namelist names, add 2.5x3.33 resolution ->>>>>>>>>>>>>>> Remove 2x2.5 res files ->>>>>>>>>>>>>>> New f09, f19 finidat files ->>>>>>>>>>>>>>> New f09, f19, f10, 1x1_tropicAtl fsurdat/fpftdyn files (only f19 change answers) ->>>>>>>>>>>>>>> New f05, 5x5_amazon, 1x1_brazil 2000 fsurdat file (b4b) ->>>>>>>>>>>>>>> New f03, f09, f19, f03, f10 ndepdyn files (changes 1851-1924, 1996-2004) - M models/lnd/clm/bld/namelist_files/namelist_definition.xml -----Change drv namelist - names: cpl_io_numtasks/cpl_io_typename, add 2.5x3.33 resolution - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml -- Add 2.5x3.33 res domainfile - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- New f19, f09 finidat files - new f09, f19, f10 fsurdat/fpftdyn files - new 2.5x3.33: fatmgrid, flndtopo, fatmtopo, fatmlndfrc, faerdep, fndepdat files - new f05, 5x5_amazon, 1x1_brazil 2000 fsurdat files - new f03, f09, f19, f03, f10 ndepdyn files - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml --- Change drv namelist - names: cpl_io_numtasks/cpl_io_typename - - M models/lnd/clm/src/main/histFldsMod.F90 -- GC_HEAT2, GC_LIQ2, GC_ICE2 NOT on by default ->>>>>>>>>>>>>>> Remove dips in 20th Century transient Nitrogen deposition ->>>>>>>>>>>>>>> for 1855 and 2000. - M models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl --- Remove 1855-1915 and 2000 - from list of input files. The 1850 dataset had too high of CO2 and hence - to high Nitrogen deposition, which gives a unrealistic dip near the - beginning. - ->>>>>>>>>>>>>>> Documentation changes of ProTex comments to fit the ProTex standard -M tools/mksurfdata/mkglcmec.F90 -M tools/mksurfdata/mkfmax.F90 -M tools/mksurfdata/ncdio.F90 -M tools/mksurfdata/mklaiMod.F90 -M tools/mksurfdata/mkglacier.F90 -M tools/mksurfdata/mkharvestMod.F90 -M tools/mksurfdata/creategridMod.F90 -M tools/mksurfdata/mkorganic.F90 -M tools/mksurfdata/mklanwat.F90 -M tools/mksurfdata/mksoicol.F90 -M tools/mksurfdata/mkrank.F90 -M tools/mksurfdata/mkelev.F90 -M tools/mksurfdata/mkurban.F90 -M tools/mksurfdata/mkurbanparMod.F90 -M tools/mksurfdata/mksoitex.F90 -M tools/mksurfdata/mkirrig.F90 -M tools/mksurfdata/domainMod.F90 -M tools/mksurfdata/areaMod.F90 -M tools/mksurfdata/mksrfdat.F90 -M tools/mksurfdata/mkpftMod.F90 -M tools/mkgriddata/mkgriddata.F90 -M tools/mkgriddata/creategridMod.F90 -M tools/mkdatadomain/create_domain.F90 -M src/biogeochem/DGVMLightMod.F90 -M src/biogeochem/DGVMReproductionMod.F90 -M src/biogeochem/DGVMAllocationMod.F90 -M src/biogeochem/DGVMEcosystemDynMod.F90 -M src/biogeochem/CASAMod.F90 -M src/biogeochem/DGVMKillMod.F90 -M src/biogeochem/DUSTMod.F90 -M src/biogeochem/DGVMEstablishmentMod.F90 -M src/biogeochem/STATICEcosysDynMod.F90 -M src/biogeochem/DGVMRestMod.F90 -M src/biogeochem/DGVMMod.F90 -M src/biogeochem/CNrestMod.F90 -M src/biogeochem/VOCEmissionMod.F90 -M src/biogeochem/DGVMMortalityMod.F90 -M src/biogeochem/DGVMTurnoverMod.F90 -M src/biogeochem/DGVMFireMod.F90 -M src/biogeochem/CNEcosystemDynMod.F90 -M src/main/inicFileMod.F90 -M src/main/organicFileMod.F90 -M src/main/spmdGathScatMod.F90 -M src/main/clm_varpar.F90 -M src/main/CNiniTimeVar.F90 -M src/main/dynlandMod.F90 -M src/main/accumulMod.F90 -M src/main/clm_comp.F90 -M src/main/driver.F90 -M src/main/decompInitMod.F90 -M src/main/ncdio.F90 -M src/main/getdatetime.F90 -M src/main/subgridRestMod.F90 -M src/main/accFldsMod.F90 -M src/main/subgridMod.F90 -M src/main/fileutils.F90 -M src/main/aerdepMod.F90 -M src/main/initializeMod.F90 -M src/main/pftdynMod.F90 -M src/main/iniTimeConst.F90 -M src/main/histFileMod.F90 -M src/main/pft2colMod.F90 -M src/main/clm_atmlnd.F90 -M src/main/restFileMod.F90 -M src/main/controlMod.F90 -M src/main/initSurfAlbMod.F90 -M src/main/clm_time_manager.F90 -M src/main/cpl_mct/lnd_comp_mct.F90 -M src/main/ndepFileMod.F90 -M src/main/subgridAveMod.F90 -M src/main/initGridCellsMod.F90 -M src/main/CASAiniTimeVarMod.F90 -M src/main/CNiniSpecial.F90 -M src/main/pftvarcon.F90 -M src/main/snowdp2lev.F90 -M src/main/spmdMod.F90 -M src/main/surfrdMod.F90 -M src/main/domainMod.F90 -M src/main/decompMod.F90 -M src/main/areaMod.F90 -M src/main/iobinary.F90 -M src/main/do_close_dispose.F90 -M src/main/mkarbinitMod.F90 -M src/riverroute/RtmMod.F90 -M src/riverroute/RunoffMod.F90 -M src/biogeophys/BalanceCheckMod.F90 -M src/biogeophys/SurfaceRadiationMod.F90 -M src/biogeophys/SoilTemperatureMod.F90 -M src/biogeophys/SnowHydrologyMod.F90 -M src/biogeophys/UrbanInputMod.F90 -M src/biogeophys/Biogeophysics1Mod.F90 -M src/biogeophys/Biogeophysics2Mod.F90 -M src/biogeophys/FracWetMod.F90 -M src/biogeophys/UrbanInitMod.F90 -M src/biogeophys/FrictionVelocityMod.F90 -M src/biogeophys/TridiagonalMod.F90 -M src/biogeophys/SurfaceAlbedoMod.F90 -M src/biogeophys/Hydrology1Mod.F90 -M src/biogeophys/Hydrology2Mod.F90 -M src/biogeophys/BiogeophysicsLakeMod.F90 -M src/biogeophys/BiogeophysRestMod.F90 -M src/biogeophys/SoilHydrologyMod.F90 -M src/biogeophys/UrbanMod.F90 -M src/biogeophys/QSatMod.F90 -M src/biogeophys/HydrologyLakeMod.F90 -M src/biogeophys/SNICARMod.F90 -M src/biogeophys/DriverInitMod.F90 -M src/biogeophys/BareGroundFluxesMod.F90 -M src/biogeophys/CanopyFluxesMod.F90 - -Summary of testing: - - bluefire: -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic -........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 -arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 -arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic -........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic -.........FAIL! rc= 10 -031 smC61 TSM.sh _sc_dh clm_std^nl_urb 20021001:NONE:1800 1.9x2.5 gx1v6 -6 cold -.................FAIL! rc= 10 -032 erC61 TER.sh _sc_dh clm_std^nl_urb 20021001:NONE:1800 1.9x2.5 gx1v6 10+38 cold -..............FAIL! rc= 5 -033 brC61 TBR.sh _sc_dh clm_std^nl_urb_br 20021001:NONE:1800 1.9x2.5 gx1v6 -3+-3 cold -...........FAIL! rc= 5 -034 blC61 TBL.sh _sc_dh clm_std^nl_urb 20021001:NONE:1800 1.9x2.5 gx1v6 48 cold -.................FAIL! rc= 4 -035 smH52 TSM.sh 17p_cnnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 96 cold -.........FAIL! rc= 8 -036 erH52 TER.sh 17p_cnnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 10+38 -cold ......FAIL! rc= 5 -037 brH52 TBR.sh 17p_cnnsc_dm clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@2000 72+72 -cold ...FAIL! rc= 5 -038 blH52 TBL.sh 17p_cnnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 48 cold -.........FAIL! rc= 4 -039 smI59 TSMcnspinup.sh 17p_cnadspinupsc_dm 17p_cnexitspinupsc_dm 17p_cnsc_dm clm_std -20020115:NONEFAIL! rc= 5 -040 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic -........................FAIL! rc= 10 -041 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic -......................FAIL! rc= 5 - bluefire interactive testing: All PASS up to... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic........FAIL! rc= 10 - bluefire/CCSM testing: -PASS SMS_RLA.f45_f45.I.bluefire -PASS SMS_RLB.f45_f45.I.bluefire -PASS SMS_ROA.f45_f45.I.bluefire -PASS ERS_D.f45_g35.I_2000.bluefire -PASS PET.f45_g35.I_1850.bluefire.cpl -PASS PET.f45_g35.I_1850.bluefire.atm -PASS PET.f45_g35.I_1850.bluefire.lnd -PASS PET.f45_g35.I_1850.bluefire.ice -PASS PET.f45_g35.I_1850.bluefire.ocn -PASS PET.f45_g35.I_1850.bluefire.glc -PASS ERS.f19_g16.I_1850.bluefire -FAIL ERS.f19_g16.I_1850-2000.bluefire <-- script fails, but cpl log same -PASS ERB.f09_g16.I_1948_2004.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire <-- recv lnd Sl_t different -PASS ERH_D.f10_f10.I_1850_CN.bluefire -PASS PET.f10_f10.ICN8520.bluefire.cpl -PASS PET.f10_f10.ICN8520.bluefire.atm -PASS PET.f10_f10.ICN8520.bluefire.lnd -PASS PET.f10_f10.ICN8520.bluefire.ice -PASS PET.f10_f10.ICN8520.bluefire.ocn -PASS PET.f10_f10.ICN8520.bluefire.glc - jaguar: All PASS - jaguar interactive testing: All PASS except -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -013 smJ74 TSM.sh 4p_casasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -1100 arb_ic .FAIL! rc= 8 -014 erJ74 TER.sh 4p_casasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -10+-10 arb_ic FAIL! rc= 5 -015 brJ74 TBR.sh 4p_casasc_ds clm_std^nl_urb_br 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_ic FAIL! rc= 5 - dublin/lf95 interactive testing: -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -026 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -027 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -030 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - dublin/lf95: -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -030 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 8 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to.. -019 blR53 TBL.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 48 cold ......FAIL! rc= 7 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_53 - -Changes answers relative to baseline: Only f19 due to new fsurdat file (off by roundoff) - and startup for f09 and f19 with CN change due - to new finidat files. 20th Century simulations - with CN change because the ndep data set is different - from 1851-1924, and 2001-2004. - -=============================================================== -=============================================================== -Tag name: clm3_6_53 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Tue Sep 22 16:15:39 MDT 2009 -One-line Summary: Fix so that T31_gx3v7 file is actually included - -Purpose of changes: - -Add new optics file from Mark Flanner. Fix so T31_gx3v7 file included. Change testing -for 48x96 to gx3v7. Update datm so that pt1_pt1 res works. Fix clm template so -that RTM is turned off for pt1_pt1 resolution. - -Bugs fixed (include bugzilla ID): - 1042 (Bug with domain directory name in datm for pt1_pt1 resolution) - 789 -- change so that RTM is off should make single-point mode faster - -Known bugs (include bugzilla ID): 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: In template turn off RTM if grid=pt1 - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Add in T31_gx3v7 frac file, update snicar optics file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): datm7 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M Quickstart.userdatasets -M models/lnd/clm/test/system/input_tests_master -M models/lnd/clm/bld/clm.cpl7.template -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - -Summary of testing: Limited - - bluefire: - bluefire interactive testing: - bluefire/CCSM testing: - -CLM tag used for the baseline comparison tests if applicable: clm3_6_53 - -Changes answers relative to baseline: None -- bit for bit - -=============================================================== -=============================================================== -Tag name: clm3_6_52 -Originator(s): erik (erik) -Date: Thu Sep 17 11:07:19 MDT 2009 -One-line Summary: Add T31_gx3v7 support, remove forganic, read from fsurdat, add script to extract regional datasets, work with CN output, add more urban/rural fields - -Purpose of changes: - - Add T31_gx3v7 files needed. Read organic fields from fsurdat file, remove forganic file. - Add in script to extract regional datasets. Change CN output fields list, add NBP (Net - Biome Production field). New Urban/Rural fields from Keith. Update bluefire compiler - to XLF12 (causes some restart issues listed below). - - This tag includes new scripts to extract regional datasets from the global datasets - in order to run for a specific region of interest. The scripts are available in the - models/lnd/clm/tools/ncl_scripts directory, the main script is the - getregional_datasets.pl perl script and it has a command line interface and help with - the "-help" option. There's also a README file in the directory containing the scripts, - and more information in the Quickstart.userdatasets file at the top level. - - Quickstart to use of regional extraction scripts: - - # Run the script to create an area to put your files (assume CSMDATA set to standard inputdata) - cd scripts - setenv MYCSMDATA $HOME/myinputdata - link_dirtree $CSMDATA $MYCSMDATA - - # Run the extraction for data from 52-73 North latitude, 190-220 longitude - # that creates 13x12 gridcell region from the f19 (1.9x2.5) global resolution over - # Alaska - cd ../models/lnd/clm/tools/ncl_scripts - setenv MYID 13x12pt_f19_alaskaUSA - getregional_datasets.pl -sw 52,190 -ne 73,220 -id $MYID -mycsmdata $MYCSMDATA - - # Now create a case that uses these datasets - cd ../../../../../scripts - create_newcase -case testregional -compset I -mach bluefire -res pt1_pt1 -skip_rundb - cd testregional - $EDITOR env_conf.xml # change CLM_BLDNML_OPTS to include "-clm_usr_name $MYID" (expand $MYID) - $EDITOR env_mach_pes.xml # Change tasks/threads as appropriate (defaults to serial) - xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA - $EDITOR Tool/Templates/datm.cpl7.template.csh # Add the following line before the check on DOMAINFILE (expand $MYID) - -if ( $DOMAINFILE == "unset" ) set DOMAINFILE = "domain.lnd.$MYID.nc" - - # Do other changes to xml files as appropriate - # configure as normal, then edit the datm namelist - - configure -case - - # Then build and run the case as normal - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1042 (Bug with domain directory name in datm for pt1_pt1 resolution) - 1063 (Problem in restarts for CCSM spinup data) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Filepath, bluefire compiler to XLF12 - - Filepath for stub-components changes - In scripts and in test_driver.sh update compiler for bluefire to XLF12 - (this causes the restart issue for certain cases below). - -Describe any changes made to the namelist: Remove forganic (read organic from fsurdat file) - -List any changes to the defaults for the boundary datasets: Add 48x96_gx3v7 fracdata - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, oleson(urban/rural), slevis (CN fields, new NBP field) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm7, stub-comps, csm_share - - scripts to scripts4_090916 - drv to vocemis-drydep12_drvseq3_0_29 - datm7 to datm7_090915 - socn/sice/sglc to stubs1_2_01 - csm_share to share3_090902 - -List all files eliminated: Remove noOrganicSoilDataset use case - - Remove the use case that removed the requirement for the forganic dataset. - - D models/lnd/clm/bld/namelist_files/use_cases/noOrganicSoilDataset.xml - -List all files added and what they do: - - Add stylesheet for namelist defaults files. - - A models/lnd/clm/bld/namelist_files/namelist_defaults.xsl - - Scripts to extract regions of interest from global grids and put them into the place - expected by build-namelist with the clm_usr_name option. - - A models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl --- Main script to extract regional datasets. - This one has a command line interface. - A models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl -- Support script to do the actual work. - This one works based on settings of a bunch of environment variables. - -List all existing files that have been modified, and describe the changes: - - M Quickstart.userdatasets - Add notes about using getregional_datasets.pl - M Quickstart.GUIDE -------- Fix typo - - M models/lnd/clm/test/system/test_driver.sh ---- Update seqccsm version to beta26 - Also update bluefire to XLF12. - - M models/lnd/clm/tools/ncl_scripts/README ----- Add note about new getregional_datasets scripts - ->>>>>>>>>>>>>>> Get configure working with new scripts/stub-components - M models/lnd/clm/bld/configure ------- Change Filepath for stub components, remove - write_filepath_ccsm use ccsmbld version - ->>>>>>>>>>>>>>> Remove forganic, add T31_gx3v7, have query NOT return user filenames ->>>>>>>>>>>>>>> for transient files when sim_year_range=constant. ->>>>>>>>>>>>>>> Add style sheets for namelist_defaults files. - M models/lnd/clm/bld/queryDefaultXML.pm -- Skip filenames set to "null" - M models/lnd/clm/bld/build-namelist ------ Remove forganic - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ------------ Remove forganic, - add gx3v7 - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml ------ Remove forganic, - add stylesheet. - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml --------- Add T31_gx3v7 - domainfile, add stylesheet. - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ---------- Add stylesheet. - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ---------- Make - gx3v7 default for T31, remove reference to forganic, add stylesheet. - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml ---- Set transient - files to null for sim_year_range=constant, add stylesheet. - ->>>>>>>>>>>>>>> Add NBP, change which CN fields active/inactive, add new Urban/Rural ->>>>>>>>>>>>>>> fields, remove forganic read organic soil from fsurdat - M models/lnd/clm/src/biogeochem/CNSummaryMod.F90 --------- Add nbp, update doc for nee, nep, - work with formatting - M models/lnd/clm/src/biogeochem/C13SummaryMod.F90 -------- Add nbp, update doc for nee, nep, - work with formatting - M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 -------- Set nbp and work with formatting - M models/lnd/clm/src/main/organicFileMod.F90 ------------- Remove forganic use fsurdat - M models/lnd/clm/src/main/clmtypeInitMod.F90 ------------- New urban/rural fields and nbp, - work with formatting - M models/lnd/clm/src/main/controlMod.F90 ----------------- Remove forganic - M models/lnd/clm/src/main/clm_varctl.F90 ----------------- Remove forganic - M models/lnd/clm/src/main/clmtype.F90 -------------------- Add urban/rural (oleson) and nbp, - and update doc on nep, nee - M models/lnd/clm/src/main/histFldsMod.F90 ---------------- Add urban/rural fields (oleson), - Change which CN fields on/off, add NBP - M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 -- Add urban/rural (oleson) - M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 --- Add urban/rural (oleson) - M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 ---- Add urban/rural (oleson) - M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 ---- Add urban/rural (oleson) - M models/lnd/clm/src/biogeophys/UrbanInitMod.F90 --------- Add urban/rural (oleson) - M models/lnd/clm/src/biogeophys/UrbanMod.F90 ------------- Add urban/rural (oleson) - -Summary of testing: - - bluefire: All PASS except... -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -051 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -052 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -054 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - bluefire interactive testing: All PASS up to... -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - bluefire/CCSM testing: All PASS except for branch tests that fail due to XLF12 -PASS ERS_D.f45_g35.I_2000.bluefire -PASS PET.f45_g35.I_1850.bluefire.cpl -PASS PET.f45_g35.I_1850.bluefire.atm -PASS PET.f45_g35.I_1850.bluefire.lnd -PASS PET.f45_g35.I_1850.bluefire.ice -PASS PET.f45_g35.I_1850.bluefire.ocn -PASS PET.f45_g35.I_1850.bluefire.glc -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -FAIL ERB.f09_g16.I_1948_2004.bluefire <<<< FAIL's due to compiler upgrade to XLF12 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire <<<< FAIL's due to compiler upgrade to XLF12 ->>>>>>>>>>>>> NOTE This same problem exists in clm3_6_51 if you update the compiler to ->>>>>>>>>>>>> XLF12. -PASS ERH_D.f10_f10.I_1850_CN.bluefire -PASS PET.f10_f10.ICN8520.bluefire.cpl -PASS PET.f10_f10.ICN8520.bluefire.atm -PASS PET.f10_f10.ICN8520.bluefire.lnd -PASS PET.f10_f10.ICN8520.bluefire.ice -PASS PET.f10_f10.ICN8520.bluefire.ocn -PASS PET.f10_f10.ICN8520.bluefire.glc - jaguar: All PASS - jaguar interactive testing: All PASS up to... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - dublin/lf95 interactive testing: All PASS up to... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 - dublin/lf95: All PASS except (up to...) -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... - change path for cprnc on jaguar -M models/lnd/clm/test/system/input_tests_master -------------- single-column tests are cold-starts -M models/lnd/clm/test/system/tests_pretag_dublin_nompi ------- Add single-column tests -M models/lnd/clm/test/system/tests_posttag_nompi_regression -- Add single-column tests -M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl ---------- Remove assumption about order of dimensions -M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl ------------ Remove assumption about order of dimensions -M models/lnd/clm/tools/ncl_scripts/pftdyntest2raw.ncl -------- Remove assumption about order of dimensions -M models/lnd/clm/bld/config_files/Makefile.in ---------------- For ifort only add -132 to FIXEDFLAGS -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml Go back to old fndepdyn files from clm3_6_47 -M models/lnd/clm/src/main/clm_time_manager.F90 --------------- Label sub as "clm::" and change data to - intent(inout) to comply with ESMF3 - (From Dani Bundy-Coleman) - -Summary of testing: - - bluefire: All PASS except -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -051 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -052 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -054 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - bluefire interactive testing: All PASS except -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 arb_ic ........FAIL! rc= 5 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 arb_ic ........FAIL! rc= 5 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 arb_ic ....FAIL! rc= 6 -027 blAK8 TBL.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -10 arb_ic ......FAIL! rc= 6 -051 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - bluefire/CCSM testing: All PASS -PASS ERS_D.f45_g35.I_2000.bluefire -PASS PET.f45_g35.I_1850.bluefire.cpl -PASS PET.f45_g35.I_1850.bluefire.atm -PASS PET.f45_g35.I_1850.bluefire.lnd -PASS PET.f45_g35.I_1850.bluefire.ice -PASS PET.f45_g35.I_1850.bluefire.ocn -PASS PET.f45_g35.I_1850.bluefire.glc -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948_2004.bluefire -PASS ERB.f09_g16.I1850SPINUPCN.bluefire -PASS ERH_D.f10_f10.I_1850_CN.bluefire -PASS PET.f10_f10.ICN8520.bluefire.cpl -PASS PET.f10_f10.ICN8520.bluefire.atm -PASS PET.f10_f10.ICN8520.bluefire.lnd -PASS PET.f10_f10.ICN8520.bluefire.ice -PASS PET.f10_f10.ICN8520.bluefire.ocn -PASS PET.f10_f10.ICN8520.bluefire.glc - jaguar interactive testing: All PASS up to... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - lightning/ifort interactive testing: All PASS - dublin/lf95 interactive testing: All PASS up to... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_48 - -Changes answers relative to baseline: No (bit-for-bit) - -=============================================================== -=============================================================== -Tag name: clm3_6_48 -Originator(s): erik (erik) -Date: Wed Aug 12 19:22:59 MDT 2009 -One-line Summary: New aerosol/nitrogen deposition datasets, mksurfdata work, scm work, clm_usr_name option to build-namelist - -Purpose of changes: - -Add in 0.47x0.63, 0.9x1.25 finidat file for CN and 1850, and 0.47x0.63 surface dataset. -Add in datasets at f09, f10, f05, f02 for aerosol (excepting f02 and f05) and nitrogen -deposition from J-F. Work with mksurfdata so that 0.23x0.31 dataset will work (Forrest). -Update csm_share, and get scam working. Add scam tests in. Add clm_usr_name option for -personal datasets to build-namelist. Add a noOrganicSoilDataset use-case so it won't add -in forganic file. Work on using ccsm build files for stand-alone testing. Get testing -going on dublin. - -Bugs fixed (include bugzilla ID): - 813 (use CCSM build files in testing -- partial) - 1010 (error in mksurfdata for qtr degree) - 1014 (shr_scam checkSurface can NOT run an I case) - 1023 (SCM mode check for lnd_present) - -Known bugs (include bugzilla ID): 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1007 (interpinic error with Linux/lahey) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1029 (ifort compilation error in pio) - 1031 (Can't run SMS_D.f09_g16.ICN8520) - 1032 (Problem running SCM mode on Lahey) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Get ccsm_bld option working - -Describe any changes made to the namelist: Add -clm_usr_name option for user-datasets, - add noOrganicSoilDataset use case (leaves forganic file off) - - Add the clm_usr_name option to build-namelist, document how this is done in the - Quickstart.userdataset README file. In short... - - if -clm_usr_name is set to ${MYDATAID} then do the following... - - surfdata: copy files into: - $MYCSMDATA/lnd/clm2/surfdata/surfdata_${MYDATAID}_simyr${SIM_YEAR}.nc - fatmgrid: copy files into: - $MYCSMDATA/lnd/clm2/griddata/griddata_${MYDATAID}.nc - fatmlndfrc: copy files into: - $MYCSMDATA/lnd/clm2/griddata/fracdata_${MYDATAID}_${MASK}.nc - faerdep: copy files into: - $MYCSMDATA/lnd/clm2/snicardata/aerosoldep_monthly_${SIM_YEAR}_${MYDATAID}.nc - - Then set CLM_BLDNML_OPTS="-clm_usr_name $MYDATAID" in your env_conf.xml. You - may have to set DIN_LOC_ROOT_CSMDATA in env_run.xml to $MYCSMDATA is this isn't - the standard location as well (use scripts/link_dirtree $CSMDATA $MYCSMDATA to - link standard datasets to your location. - -List any changes to the defaults for the boundary datasets: New datasets - New aerosol and nitrogen deposition datasets from Jean-Francois Lamarque - New interpolated finidat: for 0.9x1.25, and 0.47x0.63 - New fsurdat: for 0.47x0.63 - New faerdep, 1849-2006: for 0.9x1.25 strung together by David Bailey - New faerdep, 1849-2006: for 1.9x2.5, 10x15 (interpolated) - New fndepdat, decadal avgs: for 1.9x2.5 (raw data from J-F) - New fndepdyn, 1850-2006: for 1.9x.25 strung together - New fndepdyn, 1849-2006: for 0.9x1.25, 0.47x0.63, 10x15 (interpolated) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, csm_share, datm7 - - scripts to scripts4_090806 - csm_share to share3_090811 - datm7 to datm7_090812 - -List all files eliminated: None - -List all files added and what they do: - - A Quickstart.userdatasets ---------------------------- Documentation on using own datasets - A models/lnd/clm/test/system/nl_files/nl_ptsmode_ocn - Test SCM mode - A models/lnd/clm/test/system/nl_files/nl_ptsmode ----- Test SCM mode over ocean - A models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml --- Template for - user defined input datasets - A models/lnd/clm/bld/namelist_files/use_cases/noOrganicSoilDataset.xml- Use case to - turn off organic soil dataset - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>> Add scm tests, new variable to turn on use of CCSM build ->>>>>>>>>>>>>>>> Turn off -test in nl_files, already in mknamelist ->>>>>>>>>>>>>>>> Update dublin build/run to what used by cam. - M models/lnd/clm/test/system/TCB.sh --------------- Test for CLM_CCSMBLD - M models/lnd/clm/test/system/README.testnames ----- Add K and L single point mode cases - M models/lnd/clm/test/system/test_driver.sh ------- Update dublin, add INTEL for dublin - reconcile jaguar module with CCSM build - also set PNETCDF dirs. - M models/lnd/clm/test/system/nl_files/clm_per ----- Remove -test - M models/lnd/clm/test/system/nl_files/clm_std ----- Remove -test - M models/lnd/clm/test/system/nl_files/clm_ndepdyn - Remove -test - M models/lnd/clm/test/system/nl_files/clm_pftdyn -- Remove -test - M models/lnd/clm/test/system/nl_files/clm_per0 ---- Remove -test - M models/lnd/clm/test/system/nl_files/clm_urb1pt -- Remove -test - M models/lnd/clm/test/system/input_tests_master --- Add single point tests AK4/AK8,AL4 - M models/lnd/clm/test/system/README --------------- Add note about CLM_CCSMBLD env var - M models/lnd/clm/test/system/CLM_runcmnd.sh ------- Update dublin ->>>>>>>>>>>>>>>> Changes from Forrest Hoffman so that 0.23x0.31 case will work ->>>>>>>>>>>>>>>> I had started this work, but didn't complete it. Forrest checked ->>>>>>>>>>>>>>>> the following changes in. ->>>> 1. Changed the FFLAGS for debug mode on AIX ->>>> 2. Added calls to areaave(), gridmap_clean(), and areaini() in mksoicol.F90 and mksoitex.F90 ->>>> 3. Changed "stop" to "call abort()" in mksrfdat.F90 ->>>> 4. Added roundoff error fixes for gridcells containing only special landunits not ->>>> totalling 100% twice in mksrfdat.F90 ->>>> 5. Added error checking for after landunit adjustment to detect gridcells whose ->>>> components do not total 100% twice in mksrfdat.F90 - M models/lnd/clm/tools/mksurfdata/mksoicol.F90 ---- Add regrid for mask - M models/lnd/clm/tools/mksurfdata/Makefile -------- On IBM optimized remove -C, non-opt remove -O0 - M models/lnd/clm/tools/mksurfdata/mksoitex.F90 ---- Regrid mask - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ---- Roundoff error fix and test ->>>>>>>>>>>>>>>> Handle sim_year_range for datasets, loosen the tolerance for area sum ->>>>>>>>>>>>>>>> Allow time variable to be one ndep files. - M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl - Handle sim_year_range - M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl --- Handle sim_year_range, loosen - tolerance, and allow time variable ->>>>>>>>>>>>>>>> Get ccsm_bld option working, change ifort a bit, add clm_usr_name ->>>>>>>>>>>>>>>> option and noOrganicSoilDataset use case to build-namelist ->>>>>>>>>>>>>>>> New datasets - Fix hybrid bug for dynpft case, update externals. Require get_clump_bounds to be called - in threaded regions and get_proc_bounds to be called in non-threaded regions. Remove uneeded get_proc_bounds - calls, and pass down begg stuff as needed. Make loop in initSurfAlb Open-MP. Begin adding - testing for dublin, and add lightning_pgi testing. Add new pftdyn test datasets for 1x1_tropicAtl. - Update testing to beta20, default for lightning is ifort, add lighting_pgi testing. Change hist varnames - of 3D_Time_constants_vars* to Time_constant_3Dvars*. Remove use of LSMLAT/LSMLON cpp tokens, by default - set lsmlat/lsmlon to 1. - -Bugs fixed (include bugzilla ID): 1011 (PGI build problem in driver) - 1016 (Problem with PTS_MODE build) - 1019 (hybrid/OpenMP reproducibility bug for pftdyn mode) - -Known bugs (include bugzilla ID): 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1007 (interpinic error with Linux/lahey) - 1010 (error in mksurfdata for qtr degree) - 1014 (shr_scam checkSurface can NOT run an I case) - 1023 (SCM mode check for lnd_present) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - 1102 (OpenMP problem with pftdyn mode) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: pftdyn test datasets for 1x1_tropicAtl - -Describe any substantial timing or memory changes: None - -Code reviewed by: self,mvertens - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm7, csm_share - -scripts to scripts4_090801 ---------------- Begin adding PTS_MODE settings, update clm testlists -drv to vocemis-drydep12_drvseq3_0_27 -- Add PTS_MODE settings to template -datm7 to datm7_090729 ------------------- Add single_column support -csm_share to share3_090729 ------------------ Add dshr support for scmlat/scmlon in domain - -List all files eliminated: None - -List all files added and what they do: - - A models/lnd/clm/test/system/tests_pretag_dublin ------- Add test list for dublin - A models/lnd/clm/test/system/tests_pretag_dublin_nompi - Add interactive test list for dublin - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/test_driver.sh ------- Seq testing to beta20, begin adding dublin, default - for lightning is ifort, add lightning_pgi, - M models/lnd/clm/test/system/input_tests_master -- Add openMP 4x5 test - M models/lnd/clm/test/system/CLM_runcmnd.sh ------ Add dublin remove bangkok - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Update pftdyn surfdata for 1000-1004 - tests for 1x1_tropicAtl - - M models/lnd/clm/src/biogeochem/CNWoodProductsMod.F90 - Remove call to get_proc_bounds -- NOT needed - M models/lnd/clm/src/main/clm_varpar.F90 -------------- By default set lsmlat/lsmlon to 1 - M models/lnd/clm/src/main/dynlandMod.F90 -------------- Remove get_proc_bounds pass begg stuff in - M models/lnd/clm/src/main/driver.F90 ------------------ Pass begg stuff down to pft_interp - M models/lnd/clm/src/main/initializeMod.F90 ----------- Pass begg stuff down to pft_interp - M models/lnd/clm/src/main/pftdynMod.F90 --------------- Pass begg stuff down, remove get_proc_bounds calls - M models/lnd/clm/src/main/histFileMod.F90 ------------- Change var names of 3D_Time_constants_vars* to - Time_constant_3Dvars* - M models/lnd/clm/src/main/initSurfAlbMod.F90 ---------- Make loop OpenMP parallel - M models/lnd/clm/src/main/decompMod.F90 --------------- Make sure get_clumpbounds is called from threaded - regions and get_proc_bounds is NOT. - -Summary of testing: - - bluefire: All PASS except -002 erA91 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 7 -003 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 6 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v5 72+72 cold ...............FAIL! rc= 7 -010 erE91 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 10+38 arb_ic .........FAIL! rc= 7 -011 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v5 72+72 arb_ic ......FAIL! rc= 6 -019 erEH1 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 10+38 arb_icFAIL! rc= 7 -020 brEH1 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 24+24 arbFAIL! rc= 6 -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -041 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 7 -042 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 6 -048 brJ61 TBR.sh 4p_casasc_dh clm_std^nl_urb_br 20021230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 6 -051 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -052 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -054 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - bluefire interactive testing: All PASS! - bluefire/CCSM testing: All PASS! -PASS ERS_D.f45_g35.I_2000.bluefire -PASS PET.f45_g35.I_1850.bluefire.cpl -PASS PET.f45_g35.I_1850.bluefire.atm -PASS PET.f45_g35.I_1850.bluefire.lnd -PASS PET.f45_g35.I_1850.bluefire.ice -PASS PET.f45_g35.I_1850.bluefire.ocn -PASS PET.f45_g35.I_1850.bluefire.glc -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948_2004.bluefire -PASS ERB.f09_g16.I1850SPINUPCN.bluefire -PASS ERH_D.f10_f10.I_1850_CN.bluefire -PASS PET.f10_f10.ICN8520.bluefire.cpl -PASS PET.f10_f10.ICN8520.bluefire.atm -PASS PET.f10_f10.ICN8520.bluefire.lnd -PASS PET.f10_f10.ICN8520.bluefire.ice -PASS PET.f10_f10.ICN8520.bluefire.ocn -PASS PET.f10_f10.ICN8520.bluefire.glc - jaguar: All PASS! - lightning/ifort interactive testing: All PASS! - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_46 - -Changes answers relative to baseline: No bit-for-bit (except dynpft which was irreproducible before) - -=============================================================== -=============================================================== -Tag name: clm3_6_46 -Originator(s): erik (erik) -Date: Wed Jul 22 15:50:43 MDT 2009 -One-line Summary: Get more tests to work/document them, add use cases for 1850_control, - 2000_control, and 20thC_transient, straighten out single-point grids, Listen to - LND_CDF64 env variable from template, remove CLM_ARB_IC. - -Purpose of changes: - -Work with build-namelist to make 20th-Century a use-case so that ndepdyn files will be -included if found, but can still work without them (20thC_transient, 2000_control, and -1850_control use cases). Fix more bugs and tests, report on testing status for each -machine. Add files needed for 1.9x2.5_tx1v1 grid and new 10x15 surface dataset. Reconcile -grids for single-point datasets so consistent (lon within 0-360 rather than -180-180). -Get new single-point datasets for aerosol and nitrogen-deposition. Work with -pftdyntest2raw.ncl so will work. Work with mksurfdata.pl script so will append needed -grid data on urban point datasets. Add in CLM1PT mode for datm7 and use datm7 streams -template for testing. Listen to LND_CDF64 env variable from template, remove CLM_ARB_IC. - -Bugs fixed (include bugzilla ID): 1002 (remove CLM_ARB_IC) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1007 (interpinic error with Linux/lahey) - 1019 (hybrid/OpenMP reproducibility bug for pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: - - Add CLM1PT option to DATM_MODE in env_conf.xml - -Describe any changes made to the namelist: - - New use-cases for: - 2000_control - 1850_control - 20thC_transient - -List any changes to the defaults for the boundary datasets: - 1.9x2.5_tx1v1 datasets, new single-point/regional datasets, new 10x15 surface dataset - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm7, pio - -scripts to scripts4_090720 -datm7 to datm7_090721 -pio to pio51_prod - -List all files eliminated: - -D models/lnd/clm/bld/namelist_files/streams.txt.readme ------- Use datm7 version -D models/lnd/clm/bld/namelist_files/datm.streams.template.xml- Use datm7 version -D models/lnd/clm/test/system/nl_files/clm_organic ------------ organic files included anyway - -List all files added and what they do: - ->>>>>>>>>>>> Add new use cases -A models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml ---- 2000 control -A models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml - 20th Century transient -A models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml ---- 1850 control -A models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml ---- 2000 control - ->>>>>>>>>>>> Add regression tests list for without MPI -A models/lnd/clm/test/system/tests_posttag_nompi_regression ------- no mpi tests - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>>>> Get more tests working, or at least closer to working ->>>>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>>>> models/lnd/clm/test/system directory changes -M TCB.sh -------------------------------- Put -mach arg here -M tests_pretag_bluefire ----------------- Change some hybrid tests to MPI -M config_files/ext_ccsm_seq_10x15_dh ---- Set cice decomp / remove silent mode -M config_files/ext_ccsm_seq_4x5_dh ------ Set cice decomp / remove silent mode -M config_files/ext_ccsm_seq_1.9x2.5_dh -- Set cice decomp / remove silent mode -M config_files/ext_ccsm_seq_64x128_s ---- Set cice decomp / remove silent mode -M config_files/ext_ccsm_seq_0.9x1.25_dh - Set cice decomp / remove silent mode -M test_driver.sh ------------------------ Set threads/tasks, move -mach to TCB, - set DIN_LOC_ROOT, change needed for latest jaguar build -M tests_posttag_hybrid_regression ------- Remove bad tests, move pure-mpi, serial/open-mp out -M tests_posttag_purempi_regression ------ Remove bad tests, move pure-mpi, serial/open-mp out -M nl_files/nl_urb ----------------------- Remove urban fields already included -M nl_files/nl_urb_br -------------------- Remove urban fields already included -M input_tests_master -------------------- Changes so tests will work -M TCBext_ccsmseq_cam.sh ----------------- Add main/cpl_mct to clm list of dirs - ->>>>>>>>>>>>>>>>>> Update filenames, append grid/frac files to urban single-pt in script -M models/lnd/clm/tools/mksurfdata/mksurfdata.regional ---- New griddata, fix filepath -M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept ---- New griddata, fix filepath -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl ---------- Fix, append grid/frac data - to urban single-point datasets - ->>>>>>>>>>>>>>>>>> Get the pftdyntest2raw script working (will update datasets later) -M models/lnd/clm/tools/ncl_scripts/pftdyntest2raw.ncl - Fix so will work, add grazing on -M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl ----- Add sim_yr to out filenames - ->>>>>>>>>>>>>>>>>> Validate grid -M models/lnd/clm/tools/mkgriddata/creategridMod.F90 - Check for valid grid values - -M models/lnd/clm/srm/main/pftdynMod.F90 - Shorten some long lines - ->>>>>>>>>>>>>>>>>> Change to build: add use-cases, remove CLM_ARB_IC, listen to LND_CDF64 ->>>>>>>>>>>>>>>>>> Add new 1.9x2.5_tx1v1 frac dataset, new datasets for single-point, ->>>>>>>>>>>>>>>>>> new 10x15 datasets, separate out sim_yr and sim_year_range ->>>>>>>>>>>>>>>>>> ->>>>>>>>>>>>>>>>>> models/lnd/clm/bld directory changes -M listDefaultNamelist.pl ----------------------- Add csmdata arg -M build-namelist ------------------------------- Add -list_use_cases option - load uses cases before other defaults, add $ccsm_tools var, - separate sim_yr and sim_year_range, put case_desc for use-cases -M clm.cpl7.template ---------------------------- Remove CLM_ARB_IC, use LND_CDF64 -M namelist_files/checkdatmfiles.ncl ------------ Add tx1v1 mask -M namelist_files/namelist_definition.xml ------- Add tx1v1 mask, make sim_year integer - add sim_year_range, use_case_desc, and clm_demand -M namelist_files/namelist_defaults_overall.xml - default sim_year_range is constant - and default clm_demand is null -M namelist_files/namelist_defaults_datm.xml ---- Use datm7 streams template, - and update domain files -M namelist_files/use_cases/pergro.xml ---------- Add use_case_desc -M namelist_files/use_cases/pergro0.xml --------- Add use_case_desc -M namelist_files/namelist_defaults_clm.xml ----- Move co2_ppmv defaults to use_cases - new surf/frac/aer/ndep/grid data: 5x5_amazon, 1x1_brazil, 1x1_urbanc_alpha, - 1x1_mexicocityMEX, 1x1_vancouverCAN - new frac data: 1.9x2.5_tx1v1 - new aerdep/ndep data: 1x1_camdenNJ, 1x1_tropicAtl, 1x1_asphaltjungleNJ - new surfdata/pftdyn: 10x15 - (new finidat file for f09 CN, 1850 -- commented out -- so answers same as last tag) - -Summary of testing: - - bluefire: All PASS except -019 erEH1 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 10+38 arb_icFAIL! rc= 7 -020 brEH1 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 24+24 arbFAIL! rc= 6 -022 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -023 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -024 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -026 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -027 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 8 -028 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -3+-7 arb_ic .......FAIL! rc= 5 -029 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -5+-5 arb_ic .......FAIL! rc= 5 -030 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 4 -033 brC61 TBR.sh _sc_dh clm_std^nl_urb_br 20021001:NONE:1800 1.9x2.5 gx1v6 -3+-3 cold ...........FAIL! rc= 6 -041 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 7 -042 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 6 -051 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 4 -052 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -054 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - bluefire interactive testing: All PASS except -004 blA74 TBL.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............FAIL! rc= 7 -009 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 7 -013 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 7 -017 blJ74 TBL.sh 4p_casasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic ..FAIL! rc= 7 -019 blCA8 TBL.sh _sc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 7 -021 blL78 TBL.sh _sc_s clm_std^nl_urb 20021231:NONE:1800 1x1_brazil navy -10 arb_ic .............FAIL! rc= 7 -027 erL83 TER.sh _sc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -5+-5 arb_ic ..........FAIL! rc= 7 -028 brL83 TBR.sh _sc_do clm_std^nl_urb_br 20020115:NONE:3600 5x5_amazon navy -10+-10 arb_ic .....FAIL! rc= 6 -029 blL83 TBL.sh _sc_do clm_std^nl_urb 20020115:NONE:3600 5x5_amazon navy -10 arb_ic ............FAIL! rc= 5 -034 bl744 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 4 -036 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 4 -043 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - bluefire/CCSM testing: All PASS -PASS ERS_D.f45_g35.I_2000.bluefire -PASS PET.f45_g35.I_1850.bluefire.cpl -PASS PET.f45_g35.I_1850.bluefire.atm -PASS PET.f45_g35.I_1850.bluefire.lnd -PASS PET.f45_g35.I_1850.bluefire.ice -PASS PET.f45_g35.I_1850.bluefire.ocn -PASS PET.f45_g35.I_1850.bluefire.glc -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948_2004.bluefire -PASS ERB.f09_g16.I1850SPINUPCN.bluefire -PASS ERH_D.f10_f10.I_1850_CN.bluefire - lightning/ifort: All PASS except -- up to test 18 -002 erA91 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 7 -003 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 6 -005 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -006 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -007 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -008 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -009 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -011 erJ42 TER.sh 4p_casasc_dm clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 10+38 cold ...........FAIL! rc= 7 -012 brJ42 TBR.sh 4p_casasc_dm clm_std^nl_urb_br 20021230:NONE:1800 10x15 USGS 72+72 cold ........FAIL! rc= 6 -015 erL51 TER.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 7 -016 brL51 TBR.sh _sc_dh clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 6 - lightning/ifort interactive testing: up to test 004 -004 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 7 - calgary/lf95: All PASS except... -004 blA74 TBL.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............FAIL! rc= 7 -015 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 7 -019 blOC4 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 7 -023 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 7 -024 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -025 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -026 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -028 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -049 blL74 TBL.sh _sc_s clm_std^nl_urb 20020101:NONE:1800 1x1_brazil navy -10 arb_ic .............FAIL! rc= 7 -052 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -053 smM94 TSMncl_tools.sh ndepregrid ............................................................FAIL! rc= 6 -055 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 8 -056 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - breeze,gale,hail,gust/ifort: All PASS except... -004 blA74 TBL.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............FAIL! rc= 7 -009 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 7 -011 blCA8 TBL.sh _sc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 7 -019 blR53 TBL.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 48 cold .......FAIL! rc= 7 -020 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_45 - -Changes answers relative to baseline: Bit-for-bit EXCEPT for (as datasets change) - 5x5_amazon, 1x1_brazil, 1x1_urbanc_alpha, 1x1_mexicocityMEX, 1x1_vancouverCAN - 1x1_camdenNJ, 1x1_tropicAtl, 1x1_asphaltjungleNJ, 10x15 - -=============================================================== -=============================================================== -Tag name: clm3_6_45 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Fri Jul 10 14:00:27 MDT 2009 -One-line Summary: Remove inconsistent finidat file in clm3_6_44 - -Purpose of changes: A few simple bug fixes from clm3_6_44, with minimul testing - - Remove finidat inconsistent with the surface datasets for f19_g16, bgc=cn, sim_yr=1850 - Fix typo in test list, and fix thread settings for bluefire tests - Remove -ftz from CFLAGS for ifort for mkdatadomain - Change csh run scripts so: use CCSM env_machopts settings, set defaults, fix so can run serial - Update datm7 so that CPLHIST3HrWxHfHrSol mode has iradsw=-1 so mimics running with CAM - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1019 (hybrid/OpenMP reproducibility bug for pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Remove inconsistent - finidat file for 0.9x1.25, gx1v6, BGC=cn, sim_yr=1850 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): datm7 - - datm7 to datm7_090709 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/system/test_driver.sh ------------------- Fix threads settings for bluefire -M models/lnd/clm/test/system/input_tests_master --------------- Fix typo -M models/lnd/clm/tools/interpinic/runinit_ibm.csh ------------- Use CCSM env_machopts settings -M models/lnd/clm/tools/mkdatadomain/Makefile ------------------ Remove -ftz from CFLAGS for ifort -M models/lnd/clm/bld/run-ibm.csh ------------------------------ Use CCSM env_machopts settings, set defaults, - fix so can run serial -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Remove 0.9x1.25, BGC=cn, sim_year=1850, mask=gx1v6 - finidat file as was inconsistent with new surface dataset - -Summary of testing: Limited - -CLM tag used for the baseline comparison tests if applicable: clm3_6_44 - -Changes answers relative to baseline: bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_6_44 -Originator(s): erik (erik) -Date: Thu Jul 9 11:47:40 MDT 2009 -One-line Summary: Fix C13 bug, update scripts, drv, datm. Add domain files for idmap -atm-ocn grids for datm. Remove SEQ_MCT, add new ESMF env vars to template. Work with -ndeplintInterp, fix SCAM - -Purpose of changes: - -Fix C13 nflds bug, update scripts, drv, datm. Add domain files for idmap atm-ocn grids -for datm. Remove SEQ_MCT, add new ESMF env vars to template. Work with ndeplintInterp to -enable using J-F's new Nitrogen deposition files for transient 20th Century simulations. -SCAM fixes from John Truesdale. Add indices for PFT types. - -Bugs fixed (include bugzilla ID): 981 (ccsm domain files for atm=ocn grid) - 987 (remove SEQ_MCT) - 991 (C13 nfields cause model to blowup on jaguar) - 997 (interpolated finidat files cause fully coupled cases to fail) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1019 (hybrid/OpenMP reproducibility bug for pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Remove SEQ_MCT - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - New surface datasets for 0.9x1.25 and 1.9x2.5, and new finidat for 1850 for 0.9x1.25 - 10x15 2000 10x15 dataset set to the 1850 version so that testing will work. - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, oleson (pftvarcon changes) - SCAM changes from John Truesdale - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm7, - csm_share and pio - - scripts to scripts4_090707b - drv to vocemis-drydep11_drvseq3_0_23 - datm7 to datm7_090708 - csm_share to share3_090706b - pio to pio50_prod - -List all files eliminated: - - D models/lnd/clm/test/system/tests_pretag_bangkok -- Rename to calgary - -List all files added and what they do: - - A models/lnd/clm/test/system/tests_pretag_calgary ----------- Rename from bangkok - A models/lnd/clm/test/system/tests_pretag_bluefire_nompi ---- serial/open-MP tests - A models/lnd/clm/test/system/tests_pretag_jaguar_nompi ------ serial/open-MP tests - A models/lnd/clm/test/system/tests_posttag_lightning_nompi -- serial/open-MP tests - -List all existing files that have been modified, and describe the changes: - - M Quickstart.GUIDE --- fix minor error in name of directory as scripts changed. - - >>>>>>>>>>>> Separate out non-mpi tests for bluefire, jaguar, and lightning - Test list is different if run interactive or submitted to batch que. - Serial, open-mp only tests are run interactive, MPI and hybrid tests - are run when submitted to the batch que. This prevents waste of resources - for serial and open-mp only tests. - Remove bangkok, replace with calgary only. Default threads depends - on if interative or not. - M models/lnd/clm/test/system/test_driver.sh ----------- - M models/lnd/clm/test/system/tests_pretag_bluefire ---- - M models/lnd/clm/test/system/tests_pretag_jaguar ------ - M models/lnd/clm/test/system/tests_posttag_lightning -- - M models/lnd/clm/test/system/README ------------------- Add note about CLM_SOFF - - >>>>>>>>>>>> - M models/lnd/clm/tools/mksurfdata/Makefile ------------------- For ifort remove -ftz option to CFLAGS - M models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig ----- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/mksurfdata.regional -------- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn ---------- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept -------- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist -------- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850-2005.txt -- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/pftdyn_simyr2000.txt ------- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850.txt ------- New input PFT datasets from Peter L. - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl -------------- New input PFT datasets from Peter L. - - >>>>>>>>>>>> Work on linear interpolation of Nitrogen deposition so that add in mid-decades - M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl ------- Check if interpolation should be cyclic - M models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl ----- Also loop over mid decades as well - M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl --------- Check if interpolation should be cyclic - - >>>>>>>>>>>> Fix from Sam so that don't have negative ice flow - M models/lnd/clm/tools/interpinic/interpinic.F90 --- Change from Sam so that fully coupled cases don't trap negative ice flow - M models/lnd/clm/tools/interpinic/Srcfiles --------- Don't repeat filenames so can build with lahey - - >>>>>>>>>>>> Change so that document that files should have longs between 0 and 360 rather than -180 to 180 - M models/lnd/clm/tools/mkgriddata/mkgriddata.regional --- Use longs 0-360 - M models/lnd/clm/tools/mkgriddata/mkgriddata.singlept --- Use longs 0-360 - M models/lnd/clm/tools/mkgriddata/Makefile -------------- For ifort remove -ftz option to CFLAGS - M models/lnd/clm/tools/mkgriddata/README ---------------- Make note that regional/single-pt grid files should have longs: 0 <= longs <= 360 - - >>>>>>>>>>>> Remove SEQ_MCT and handle COMP_INTERFACE from ccsm cpl7 scripts, new surface datasets - M models/lnd/clm/bld/configure ----------- Remove SEQ_MCT, handle cpl_esmf - M models/lnd/clm/bld/clm.cpl7.template --- Handle $COMP_INTERFACE - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Allow mid-decadal - sim_years so can process ndepdyn files - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- New 0.9 finidat, - 0.9x1.25, and 1.9x2.5 surfdata, fndepdat files for mid-decadal sim_years. - - >>>>>>>>>>>> Add indices for PFTs. Fixes for SCAM. Break up long lines > 132chars - M models/lnd/clm/src/biogeochem/CASAMod.F90 -------------- noveg, nc3_nonarctic_grass - M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 --- noveg, ncorn, nbrdlf_dcd_brl_shrub - M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ------- Add PFT indices - M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 - Add PFT indices - M models/lnd/clm/src/main/organicFileMod.F90 ------------- SCAM fix (from jet) - M models/lnd/clm/src/main/ncdio.F90 ---------------------- Break up long lines - M models/lnd/clm/src/main/pftdynMod.F90 ------------------ Break up long lines, add - noveg, nbrdlf_evr_shrub - M models/lnd/clm/src/main/clm_atmlnd.F90 ----------------- C13 bug fix for number of fields - (found by Jon Wolfe) - M models/lnd/clm/src/main/pftvarcon.F90 ------------------ Add PFT indices, make sure - pftnames from pftcon file is - as expected. - M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 -------- SCAM fix (from jet) - -Summary of testing: - - bluefire: All FAIL except... -008 smB91 TSMruncase.sh .........................................................................PASS -053 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................PASS - bluefire/CCSM testing: All PASS -PASS ERS_D.f45_g35.I_2000.bluefire -PASS PET.f45_g35.I_1850.bluefire.cpl -PASS PET.f45_g35.I_1850.bluefire.atm -PASS PET.f45_g35.I_1850.bluefire.lnd -PASS PET.f45_g35.I_1850.bluefire.ice -PASS PET.f45_g35.I_1850.bluefire.ocn -PASS PET.f45_g35.I_1850.bluefire.glc -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948_2004.bluefire -PASS ERB.f09_g16.I1850SPINUPCN.bluefire.001802 -PASS ERH_D.f10_f10.I_1850_CN.bluefire - -CLM tag used for the baseline comparison tests if applicable: clm3_6_43 - -Changes answers relative to baseline: No -- bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_6_43 -Originator(s): erik (erik) -Date: Wed Jun 10 11:41:57 MDT 2009 -One-line Summary: Fix pftdyn bug, enable 1D primary hist files, fix time-const3D output, fix template bug, enable cpl_esmf/cpl_mct - -Purpose of changes: - -Add src/main/cpl_esmf,src/main/cpl_mct directories, change configure to build either way, -add -comp_intf option. Remove SEQ_ #ifdef's, simplify some of the logic associated with -the old options (cpl6 and program_off). Brian K -- fix nans, enable openMP again. Allow -first history tape to be 1D (Sean Swenson). Fix template co2_ppmv error. Remove SPMD -#ifdef from RTM. Fix driver pftdyn bug. Fix bug on writing out 3D time-constant fields. - -Bugs fixed (include bugzilla ID): - 929 (bug in co2ppmv value in template) - 969 (allow primary tapes to be 1D) - 974 (bug in pftdyn mode) - 977 (bug writing out 3D time-const data) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 991 (C13 nfields cause model to blowup on jaguar) - 1019 (hybrid/OpenMP reproducibility bug for pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Add choice between ESMF/MCT compilation - NOTE: ESMF option does NOT work as files do NOT exist yet! - Add -comp_intf option to configure - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, swensosc (1D and history changes), - kauff (reenable OpenMP, some vars spval instead of nan) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, pio - - scripts to scripts4_090605b - drv to vocemis-drydep08_drvseq3_0_18 - pio back to pio45_prod (to eliminate compilation problem with pathscale) - -List all files eliminated: - -D models/lnd/clm/src/main/lnd_comp_mct.F90 --- Move to cpl_mct - -List all files added and what they do: - -A models/lnd/clm/src/main/cpl_mct ---- Directory for MCT interface -A models/lnd/clm/src/main/cpl_esmf --- Directory for ESMF interface -A models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 - Moved from main directory - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Add -comp_intf option, fix template bug, closing input namelist -M models/lnd/clm/bld/configure ----------- Add -comp_intf option -M models/lnd/clm/bld/config_files/config_definition.xml -- Add comp_interface -M models/lnd/clm/bld/clm.cpl7.template --- Close input namelist with ending "/" - ->>>>>>>>>>>>>> Remove SEQ_ CPP #if's, require some arguments - (needed to be optional for cpl6/offline), allow primary hist files 1D - Fix so that 3D time-constant data does get written out. -M models/lnd/clm/src/main/clm_comp.F90 --------- Make rstwr, nlend, rdate required -M models/lnd/clm/src/main/driver.F90 ----------- Remove doalb if's, PFTDYNWBAL CPP - (for pftdyn bug). Require rstwr, - nlend, and rdate -M models/lnd/clm/src/main/clmtypeInitMod.F90 --- Some vars init to spval (kauff) - certain cell & pft level variables are initialized to spval - instead of nan so eliminate the appearance of nans on restart files. - (not all cell & pfts were used and given non-nan values) -M models/lnd/clm/src/main/histFileMod.F90 ------ Write out 3D time-constant vars, - fix so can write primary 1D files - (Sean Swenson) -M models/lnd/clm/src/main/restFileMod.F90 ------ nlend required -M models/lnd/clm/src/main/controlMod.F90 ------- Remove SEQ_ CPP #if's, allow 1D primary - ability to run threaded is re-enabled (kauff) -M models/lnd/clm/src/main/do_close_dispose.F90 - Require rstwr, nlend -M models/lnd/clm/src/riverroute/RtmMod.F90 ----- Remove SPMD #ifdef - ->>>>>>>>>>>>>> Move testing to calgary from bangkok -M models/lnd/clm/test/system/test_driver.sh ---- Add LD_LIBRARY_PATH for calgary/lf95 - -Summary of testing: - - bluefire: All PASS except (up to test 35) -007 erA91 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 7 -008 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 6 -009 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 5 -012 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 5 -013 smH74 TSM.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test@1000-1004 -1100 cold FAIL! rc= 8 -014 blH74 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test@1000-1004 -100 cold FAIL! rc= 4 -019 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 arb_ic ............FAIL! rc= 5 -028 blF93 TBL.sh 17p_vodsrsc_do clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 5 -034 erEH1 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 10+38 arb_icFAIL! rc= 7 - - bluefire/CCSM testing: -PASS ERS.f45_g35.I_2000.bluefire -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948_2004.bluefire -SFAIL ERH.f10_f10.I_1850_CN.bluefire.235943 <<< f10_f10 doesn't work for datm7 right now - -TBL hybrid/openMP tests fail since previous version had OpenMP disabled. - - breeze/gale/hail/gust/ifort: All PASS up to test 12 (10x15, smL51 test) - -CLM tag used for the baseline comparison tests if applicable: clm3_6_43 - -Changes answers relative to baseline: Only pftdyn mode - -=============================================================== -=============================================================== -Tag name: clm3_6_42 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Tue Jun 2 11:58:25 MDT 2009 -One-line Summary: Bring CN Harvest branch (cnhrv02_clm3_6_41) to trunk - -Purpose of changes: - - Add in Peter Thornton's code to read in harvesting variables on surface datasets - and apply harvesting to carbon and nitrogen pools. - Add in surface datasets from clm3_6_40 that have harvesting fields on them for - 0.9x1.25, 1.9x2.5, and 10x15 (as well as aerdep, ndepdat, and ndepdyn datasets). - Remove urban test list as urban on by default, and remove top level doc directory. - Add C13 CPP token for C13 extension of CN add -c13 option to configure. - Add C13/10x15@1850-2000 testing. - Let sum of percent types match to 100 within small value rather than an exact match. - Increase wasteheat limit from 40 to 100 W/m2. - Change default masks to USGS for 4x5,T31,T42, and T85 resolutions so same as cice - Update drv to latest version (drvseq3_0_17 -- on voc branch). - Update ccsm comparision version used in test suite. - -Bugs fixed (include bugzilla ID): - 977 (bug writing out 3D time-const data) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 971 (abort on lahey with MPI) - 972 (abort on intel with MPI) - 974 (bug in pftdyn mode) - 977 (bug writing out 3D time-const data) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: - Add C13 #ifdef for CN - Add -c13 option to configure - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Make USGS mask default for 4x5,T31,T42, and T85 - surface datasets with harvesting for: 0.9x1.25, 1.9x2.5, 10x15 (1850,2000) - pftdyn datasets with harvesting for: 0.9x1.25, 10x15 (1850-2005) - faerdep datasets for: 0.9x1.25, 10x15 (1850, 2000, 1850-2000) - fndepdat datasets for: 0.9x1.25, 10x15 (1850,2000) - fndepdyn datasets for: 0.9x1.25, 1.9x2.5, 10x15 (1850-2000) - -Describe any substantial timing or memory changes: Minor for CN - -Code reviewed by: thornton, erik - -List any svn externals directories updated (csm_share, mct, etc.): - Remove top level doc directory as out of date and won't be updated. Howto is in - the scripts directory - -List all files eliminated: - -D models/lnd/clm/test/system/tests_posttag_urban - Urban on by default so doesn't - need it's own tests ->>>>>>>>>>>>>>>>>> Remove as can NOT easily recreate source from them and code - has changed since the creation of the scripts. Would take work - to get the two in sync and be able to use these scripts as source. -D models/lnd/clm/src/main/gen_ncdio_global_subs.csh -D models/lnd/clm/src/main/gen_ncdio_local_subs.csh -D models/lnd/clm/src/main/gen_spmdgs_subs.csh - -List all files added and what they do: - ->>>>>>>>>>>>>>>>>> Add new configurations to test C13 config -A + models/lnd/clm/test/system/config_files/17p_cnc13sc_dh -A + models/lnd/clm/test/system/config_files/17p_cnc13sc_dm -A + models/lnd/clm/test/system/config_files/17p_cnc13sc_do ->>>>>>>>>>>>>>>>>> New module to handle wood harvesting -A + models/lnd/clm/src/biogeochem/CNWoodProductsMod.F90 Calculate loss fluxes from wood - products pools, and update - product pool state variables - -List all existing files that have been modified, and describe the changes: - -M Quickstart.GUIDE --- Update documentation -M README ------------- Update documentation ->>>>>>>>>>>>>>>>>> Add C13 and 10x15@1850-2000 tests -M models/lnd/clm/test/system/tests_pretag_bluefire --- Add 10x15@1850-2000 tests -M models/lnd/clm/test/system/config_files/README ----- Add note on new C13 config -M models/lnd/clm/test/system/tests_posttag_breeze ---- Add openmp C13 test -M models/lnd/clm/test/system/README.testnames -------- Add R configuration for C13 config -M models/lnd/clm/test/system/tests_posttag_hybrid_regression -- Add C45 and R51 tests -M models/lnd/clm/test/system/tests_posttag_purempi_regression - Add C45 and R52 tests -M models/lnd/clm/test/system/input_tests_master ------ Add C45 (10x15@1850-2000, pure-mpi) and - R51-R53 (C13) tests -M models/lnd/clm/test/system/test_driver.sh ---------- Update ccsm4 comparision version - to beta17 ->>>>>>>>>>>>>>>>>> Add C13 configuration option, and new datasets -M models/lnd/clm/bld/configure -------------------------------- Add -c13 option -M models/lnd/clm/bld/config_files/config_definition.xml ------- Add c13 entry -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - - Change default masks for 4x5,T31,T42,T85 to USGS so agree with cice defaults - surface datasets with harvesting for: 0.9x1.25, 1.9x2.5, 10x15 (1850,2000) - pftdyn datasets with harvesting for: 0.9x1.25, 10x15 (1850-2005) - faerdep datasets for: 0.9x1.25, 10x15 (1850, 2000, 1850-2000) - fndepdat datasets for: 0.9x1.25, 10x15 (1850,2000) - fndepdyn datasets for: 0.9x1.25, 1.9x2.5, 10x15 (1850-2000) ->>>>>>>>>>>>>>>>>> C13/DGVM #ifdefs, add harvest vars and calculations -M models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 ---- Add CStateUpdate2h method for - harvest mortality fluxes -M models/lnd/clm/src/biogeochem/CNC13StateUpdate2Mod.F90 -- Add C13 cpp and add C13StateUpdate2h - method for harvesting -M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 ---- Remove 10n and 100n variables -M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 ----- Add in harvesting terms -M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 - Add C13 #ifdef's -M models/lnd/clm/src/biogeochem/CNSummaryMod.F90 ---------- Add harvesting fields -M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 ---- Remove 10c, 100c variables, - formatting changes -M models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 -- Add C13 #ifdef, remove 10c, 100c vars -M models/lnd/clm/src/biogeochem/CNrestMod.F90 ------------- Add C13 #ifdef -M models/lnd/clm/src/biogeochem/CNC13StateUpdate3Mod.F90 -- Add C13 #ifdef -M models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 ---- Add NStateUpdate2h Nitrogen - harvesting method -M models/lnd/clm/src/biogeochem/C13SummaryMod.F90 --------- Add C13 #ifdef -M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 ------- Add C13 #ifdef and harvesting variables -M models/lnd/clm/src/biogeochem/CNC13FluxMod.F90 ---------- Add C13 #ifdef and C13Flux2h harvest - method, and CNC13HarvestPftToColumn - private method -M models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 ----- Add harvesting method calls - filters by lbc,ubc - Add C13 #ifdef, add CNHarvest call if - fpftdyn file is set. -M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 --------- Add C13 #ifdef, remove 10c, 100c loss - vars, add harvest vars -M models/lnd/clm/src/main/clm_varcon.F90 ------------------ Add C13 #ifdef - Increase wasteheat limit to 100 W/m2 -M models/lnd/clm/src/main/CNiniTimeVar.F90 ---------------- Add C13 #ifdef - begc, endc to methods -M models/lnd/clm/src/main/accFldsMod.F90 ------------------ Put frmf and other vars (t10, t_mo, - ... agdd) in DGVM #ifdef -M models/lnd/clm/src/main/clmtypeInitMod.F90 -------------- Add C13 and DGVM #ifdef and new - harvesting vars -M models/lnd/clm/src/main/pftdynMod.F90 ------------------- Add CNHarvest and CNHarvestPftToColumn - as public methods, - add pftdyn_getharvest private methods, - check that land fractions sum to 100 - within 1e-15 rather than exactly 100, - change pftdyn_get_data to pftdyn_getdata - Add C13 #ifdef, remove 10c, 100c loss - calculation -M models/lnd/clm/src/main/iniTimeConst.F90 ---------------- Add DGVM #ifdef -M models/lnd/clm/src/main/clm_atmlnd.F90 ------------------ Add C13 #ifdef -M models/lnd/clm/src/main/lnd_comp_mct.F90 ---------------- Add C13 #ifdef -M models/lnd/clm/src/main/CNiniSpecial.F90 ---------------- Add C13 #ifdef -M models/lnd/clm/src/main/clmtype.F90 --------------------- Add DGVM, C13 #ifdef, - harvest vars -M models/lnd/clm/src/main/histFldsMod.F90 ----------------- Add C13 #ifdef, correct SEEDN, - Add: WOOD_HARVESTC, PRODUCT_CLOSS, C13_PRODUCT_CLOSS, WOOD_HARVESTN, PRODUCT_NLOSS - Change long_name: DWT_PROD10C_GAIN, DWT_PROD100C_GAIN, DWT_CLOSS, DWT_NLOSS -M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 --- Add C13 #ifdef -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 ------- Add C13 #ifdef - -Summary of testing: - - bluefire: hybrid and open-mp tests FAIL, pftdyn 1000 tests fail, most TBL tests FAIL as answers change -001 smA74 TSM.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............PASS -002 erA74 TER.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -5+-5 arb_ic ..........PASS -003 brA74 TBR.sh _sc_ds clm_std^nl_urb_br 20030101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .......PASS -004 blA74 TBL.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............PASS -005 smL74 TSM.sh _sc_s clm_std^nl_urb 20020101:NONE:1800 1x1_brazil navy -10 arb_ic .............PASS -015 smB91 TSMruncase.sh .........................................................................PASS -021 smF92 TSM.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 96 cold .............PASS -022 erF92 TER.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 10+38 cold ..........PASS -023 brF92 TBR.sh 17p_vodsrsc_dm clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v5 72+72 cold .......PASS -029 smCA4 TSM.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........PASS -030 erCA4 TER.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ......PASS -031 brCA4 TBR.sh _sc_ds clm_std^nl_urb_br 20021001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic ...PASS -032 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........PASS -046 smCA8 TSM.sh _sc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...PASS -047 blCA8 TBL.sh _sc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...PASS -048 smNB4 TSM.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic PASS -049 erNB4 TER.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 59+100 arb_icPASS -050 brNB4 TBR.sh _mexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arb_PASS -051 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic PASS -065 smL78 TSM.sh _sc_s clm_std^nl_urb 20021231:NONE:1800 1x1_brazil navy -366 arb_ic ............PASS -066 blL78 TBL.sh _sc_s clm_std^nl_urb 20021231:NONE:1800 1x1_brazil navy -10 arb_ic .............PASS -PASS ERS.f45_g35.I_2000.bluefire -PASS ERS.f19_g16.I_1850.bluefire -PASS ERS.f19_g16.I_1850-2000.bluefire -PASS ERB.f09_g16.I_1948_2004.bluefire -SFAIL ERH.f10_f10.I_1850_CN.bluefire.014926 <<< f10_f10 doesn't work for datm7 right now -PASS ERP.f19_g16.I_CN_1850-2000.bluefire - bangkok/lf95: Up to test 6 as follows -001 smA74 TSM.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............PASS -002 erA74 TER.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -5+-5 arb_ic ..........PASS -003 brA74 TBR.sh _sc_ds clm_std^nl_urb_br 20030101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .......PASS -004 blA74 TBL.sh _sc_ds clm_std^nl_urb 20030101:NONE:3600 1x1_brazil navy -10 arb_ic ............PASS -005 smA92 TSM.sh _sc_dm clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 -006 erA92 TER.sh _sc_dm clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 - breeze/gale/hail/gust/ifort: -001 smA74 TSM.sh _sc_ds clm_std^nl_urb 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ............PASS -002 erA74 TER.sh _sc_ds clm_std^nl_urb 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic ..........PASS -003 brA74 TBR.sh _sc_ds clm_std^nl_urb_br 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .......PASS -004 blA74 TBL.sh _sc_ds clm_std^nl_urb 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ............SKIPPED* -005 smD94 TSM.sh _persc_ds clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 144 cold .................PASS -006 erD94 TER.sh _persc_ds clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 72+72 cold ...............PASS -007 blD94 TBL.sh _persc_ds clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 144 cold .................SKIPPED* -008 smCA4 TSM.sh _sc_ds clm_std^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........PASS -009 blCA4 TBL.sh _sc_ds clm_std^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........SKIPPED* -010 smCA8 TSM.sh _sc_ds clm_std^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...PASS -011 blCA8 TBL.sh _sc_ds clm_std^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...SKIPPED* -012 smL54 TSM.sh _sc_ds clm_std^nl_urb 19980115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_41 - -Changes answers relative to baseline: Yes, urban wasteheat limit increased to 100 W/m2 - and CN changes due to harvesting - -=============================================================== -Tag name: clm3_6_41 -Originator(s): kauff,erik -Date: Fri May 29 14:15:38 MDT 2009 -One-line Summary: shrub mods, abort if nthreads > 1 (temporary, wrt bugz #965) - -Purpose of changes: fix shrub height, disable threading (due to inexact restart) - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: - -List any svn externals directories updated (csm_share, mct, etc.): - - update externals for scripts and pio. - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - - - abort if num threads > 1 - main/controlMod.F90 - - - Change CNVegStructUpdateMod.F90 according to Keith Oleson for shrubs. - * First change tsai_min to be multiplied by 0.5 instead of 0.65, and - * second to lower the tapering for shrubs (types 9 and 11) to 10 with 200 for other woody plants. - - main/aerdepMod.F90 ./aerdepMod.F90 - main/clmtype.F90 ./clmtype.F90 - main/clmtypeInitMod.F90 ./clmtypeInitMod.F90 - main/decompInitMod.F90 ./decompInitMod.F90 - main/driver.F90 ./driver.F90 - main/filterMod.F90 ./filterMod.F90 - main/histFileMod.F90 ./histFileMod.F90 - main/histFldsMod.F90 ./histFldsMod.F90 - main/initializeMod.F90 ./initializeMod.F90 - main/pftdynMod.F90 ./pftdynMod.F90 - main/subgridRestMod.F90 - - biogeochem/CNAnnualUpdateMod.F90 ./CNAnnualUpdateMod.F90 - biogeochem/CNBalanceCheckMod.F90 ./CNBalanceCheckMod.F90 - biogeochem/CNEcosystemDynMod.F90 ./CNEcosystemDynMod.F90 - biogeochem/CNVegStructUpdateMod.F90 ./CNVegStructUpdateMod.F90 - - biogeophys//BalanceCheckMod.F90 ./BalanceCheckMod.F90 - biogeophys//SurfaceAlbedoMod.F90 ./SurfaceAlbedoMod.F90 - biogeophys//UrbanInputMod.F90 - -Summary of testing: - - bluefire: - PASS ERS.f45_g35.I_2000.bluefire - PASS ERS.f19_g16.I_1850.bluefire - PASS ERS.f19_g16.I_1850-2000.bluefire - PASS ERB.f09_g16.I_1948_2004.bluefire - SFAIL ERH.f10_f10.I_1850_CN.bluefire.b16+pretag - * code exact restarts when threaded but using only 1 thread - jaguar: - kraken: - lightning/pathscale: - bangkok/lf95: - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: - -Changes answers relative to baseline: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -Tag name: clm3_6_40 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Thu May 28 15:17:11 MDT 2009 -One-line Summary: Fix openMP bug, add fndepdyn ncl script, fix interpinic for urban, add mkharvest to mksurfdata, new spinups, turn CLAMP on for CASA or CN - -Purpose of changes: - -Fix hybrid/open-MP mode bug, and testing for hybrid/open-MP. Add ncl script to -time-interpolate between 1850 and 2000 for fndepdat dataset, for fndepdyn version. Fix -interpinic for urban and cndv (jet/oleson/slevis). Update aerdepregrid.ncl and -ndepregrid.ncl scripts. Add mkharvest fields to mksurfdata. Remove furbinp and just use -fsurdat (leave forganic, so can remove to turn off). Begin to add an option to build -with ccsm makefiles, for test-suite. Remove archiving, branching and resub from last run -script in models/lnd/clm/bld. New spin-up files for 1850 and 2000 for 1.9x2.5 and 1850 -for CN. Make sure CLAMP is turned on for either CASA or CN. Change testing years to -2002-2003 so same as for ccsm tests. - -Bugs fixed (include bugzilla ID): 954 (hybrid problem) - 959 (test suite NOT testing hybrid) - 965 (hybrid problem for high-proc count) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 966 (Hybrid restart problem on bluefire) - 967 (PIO bounds problem on jaguar) - 974 (bug in pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Start adding option to build with ccsm Makefiles - - By default turn on CLAMP when either CN or CASA is enabled - -Describe any changes made to the namelist: Remove furbinp (use fsurdat) - -List any changes to the defaults for the boundary datasets: New spinup files - - clmi.IQmp17_1950-01-01_1.9x2.5_gx1v6_simyr1850_c090509.nc - clmi.IQmp17_2000-01-01_1.9x2.5_gx1v6_simyr2000_c090509.nc - clmi.BCN_0093-01-01_1.9x2.5_gx1v6_simyr1850_c090527.nc - -Describe any substantial timing or memory changes: Faster because of a fix to a I/O - write bug in datm7 - -Code reviewed by: self, forrest, mvertens, oleson, jet (relevant portions from them) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm7, csm_share - - scripts to scripts4_090527 - datm7 to datm7_090518 - csm_share to share3_090512 - -List all files eliminated: - -D models/lnd/clm/bld/build-streams -- Remove phasing out old run scripts, another - version exists in scripts/ccsm_utils/Tools/build_streams - -List all files added and what they do: - ->>>>>>>>>>>>>>>>>>>> Add harvest fields to surface datasets -A models/lnd/clm/tools/mksurfdata/mkharvestMod.F90 ------------- New module to handle harvest fields - ->>>>>>>>>>>>>>>>>>>> New files for ccsm_bld option -A models/lnd/clm/bld/config_files/Macros.yong_g95 -------------- Macro's file for my Darwin Mac-OSX laptop -A models/lnd/clm/bld/config_files/Macros.breeze_intel ---------- Macro's file for intel on breeze. -A models/lnd/clm/bld/config_files/TopCCSMBldMakefile.in -------- Top level makefile for a ccsm_bld - ->>>>>>>>>>>>>>>>>>>> New scripts to regrid all aerosol/nitrogen deposition resolutions and create - transient Nitrogen-Deposition -A models/lnd/clm/tools/ncl_scripts/runDepositionRegrid.pl ------ Run regrid for many resolutions for - aerosol and nitrogen deposition -A models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl ---------- Linearly interpolate nitrogen-deposition - between 1850 and 2000 to get - transient nitrogen deposition. - ->>>>>>>>>>>>>>>>>>>> New serial and open-MP tests -A models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do -A models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do -A models/lnd/clm/test/system/config_files/17p_vodsrsc_ds - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>>>>>> Fix hybrid bug (959), some tweaks, change dates to 2002/2003 to correspond with - data checked in -M models/lnd/clm/test/system/tests-driver.sh -------------------- Add -mach option to configure, - able to set CLM_THREADS as input -M models/lnd/clm/test/system/tests_pretag_bluefire -------------- Move f19_g16 test closer to - beginning of list -M models/lnd/clm/test/system/config_files/17p_cnsc_dh ----------- Turn supln off -M models/lnd/clm/test/system/config_files/17p_cnsc_dm ----------- Turn supln off -M models/lnd/clm/test/system/config_files/17p_cnsc_do ----------- Turn supln off -M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh --- Turn supln on -M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm --- Turn supln on -M models/lnd/clm/test/system/mknamelist ------------------------- Set number of threads by input CLM_THREADS -M models/lnd/clm/test/system/input_tests_master ----------------- Change all start dates to 2002/2003 to - correspond with data checked in -M models/lnd/clm/test/system/README ----------------------------- Document that can set CLM_THREADS -M models/lnd/clm/test/system/TSM.sh ----------------------------- Set number of threads by input - CLM_THREADS / handle cold start - ->>>>>>>>>>>>>>>>>>>> Add harvest fields -M models/lnd/clm/tools/mksurfdata/ncdio.F90 --------------------- Add nf_get_att_text -M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 ----------------- Write out harvest fields -M models/lnd/clm/tools/mksurfdata/mkvarpar.F90 ------------------ Formatting change -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ------------------ Call mkharvest_init, mkharvest, - and add harvest fields to file -M models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850.txt ---------- Point to new landuse files -M models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850-2005.txt ----- Point to new landuse files -M models/lnd/clm/tools/mksurfdata/pftdyn_simyr2000.txt ---------- Point to new landuse files -M models/lnd/clm/tools/mksurfdata/Srcfiles ---------------------- Add mkharvestMod.F90 file to list - ->>>>>>>>>>>>>>>>>>>> Fix interpinic for urban -M models/lnd/clm/tools/interpinic/interpinic.F90 ---- Changes from Keith Oleson/John Truesdale to - handle urban -M models/lnd/clm/tools/interpinic/runinit_ibm.csh --- Tweak sim_years, maxpft, and start times - ->>>>>>>>>>>>>>>>>>>> Fix regrid scripts for new sim_yr -M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl --- Add sim_yr, document better, add time coord. - variable -M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl ----- Add sim_yr, figure out file-type from it, - document better, transient files use - lowercase lat, lon instead of LAT, LON. - ->>>>>>>>>>>>>>>>>>>> Fix hybrid bug (959), deprecate old scripts -M models/lnd/clm/bld/configure ----------------- By default turn on CLAMP when either CN or CASA is enabled, - start adding ccsm_bld option, and -mach option. -M models/lnd/clm/bld/mkSrcfiles ---------------- Get it to match scripts version of same thing -M models/lnd/clm/bld/mkDepends ----------------- Get it to match scripts version of same thing, - remove Darwin kludge for assert.h (as has been renamed) -M models/lnd/clm/bld/queryDefaultXML.pm -------- Handle return characters in values -M models/lnd/clm/bld/config_files/Makefile.in -- Get rid of SGI, Nec-SX6, ES, Cray-X1 build options, - tweak Linux build -M models/lnd/clm/bld/listDefaultNamelist.pl ---- Add option to do all resolutions, correct prints -M models/lnd/clm/bld/build-namelist ------------ Add drv_in namelist "ccsm_pes" setting threads to - OMP_NUM_THREADS value, remove furbinp file -M models/lnd/clm/bld/create_newcase ------------ Document that this script is deprecated -M models/lnd/clm/bld/run-ibm.csh --------------- Remove archiving, change defaults, - add notes that script is deprecated -M models/lnd/clm/bld/README -------------------- Remove files taken out -M models/lnd/clm/bld/config_files/config_sys_defaults.xml ----- Add default mach settings -M models/lnd/clm/bld/config_files/config_definition.xml ------- Add mach and ccsm_bld settings -M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Remove furbinp, add task thread layouts - for ccsm_pe namelist -M models/lnd/clm/bld/namelist_files/datm.streams.template.xml - Make same as datm7 version - (except using %p instead of DIN_LOC_ROOT) -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New finidat spinup files for 1.9x2.5, - 1850, 2000 and 1850-CN - ->>>>>>>>>>>>>>>>>>>> Changes from Forrest Hoffman to fix hybrid issues on jaguar (bug 954 and more) -M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 -- Add lbc,ubc -M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 -- Add lbc, ubc, lbp, ubp -M models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 -- Explicitly dimension filters to "ubp-lbp+1" - rather than ":" - ->>>>>>>>>>>>>>>>>>>> Fix hybrid issues (bug 954), add #ifdefs to clmtype so can use CLAMP with CASA, - remove CSD and USE_OMP junk -M models/lnd/clm/src/main/driver.F90 ------------------- Remove CSD directives and USE_OMP. - Add more variables to private for OMP loops - (forrest) (bug 954) - Pass array bounds to dynland_hwcontent - (mvertens) (bug 954). - Pass array bounds needed by Forrest's - biogeochem changes above. -M models/lnd/clm/src/main/decompInitMod.F90 ------------ Make a line shorter (with continue lines) -M models/lnd/clm/src/main/subgridRestMod.F90 ----------- Make a line shorter (with continue lines) -M models/lnd/clm/src/main/aerdepMod.F90 ---------------- Remove generic save statement, add save for - each data instantiation -M models/lnd/clm/src/main/clmtypeInitMod.F90 ----------- Add #ifdefs from casafire branch to limit - clmtype size -M models/lnd/clm/src/main/initializeMod.F90 ------------ Remove USE_OMP and CSD directives -M models/lnd/clm/src/main/pftdynMod.F90 ---------------- #ifdef pftdyn_cnbal -M models/lnd/clm/src/main/histFileMod.F90 -------------- Remove CSD directives -M models/lnd/clm/src/main/controlMod.F90 --------------- Remove furbinp, remove UNICOSMP and SSP complexity -M models/lnd/clm/src/main/filterMod.F90 ---------------- Remove CSD directives -M models/lnd/clm/src/main/clmtype.F90 ------------------ Add #ifdefs from casafire branch to limit - clmtype size -M models/lnd/clm/src/main/histFldsMod.F90 -------------- Remove KO comments - ->>>>>>>>>>>>>>>>>>>> Fix hybrid issues (bug 954 and 965), use fsurdat instead of furbinp file for urban input -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ---- Pass in array bounds (mvertens) (bug 954) -M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 ------ Use fsurdat instead of separate furbinp file -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 --- Remove num_solar logic that caused an early exit - (bug 965) - -Summary of testing: - - bluefire: All PASS except -007 erA91 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 7 -008 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 6 -011 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v5 72+72 cold ...............FAIL! rc= 7 -013 smH74 TSM.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test@1000-1004 -1100 cold FAIL! rc= 8 -014 blH74 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test@1000-1004 -100 cold FAIL! rc= 4 -017 erE91 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 10+38 arb_ic .........FAIL! rc= 7 -018 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v5 72+72 arb_ic ......FAIL! rc= 6 -022 erF92 TER.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 10+38 cold ..........FAIL! rc= 7 -023 brF92 TBR.sh 17p_vodsrsc_dm clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v5 72+72 cold .......FAIL! rc= 6 -009 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -013 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -021 erC61 TER.sh _sc_dh clm_std^nl_urb 20021001:NONE:1800 1.9x2.5 gx1v6 10+38 cold ..............FAIL! rc= 7 -022 brC61 TBR.sh _sc_dh clm_std^nl_urb_br 20021001:NONE:1800 1.9x2.5 gx1v6 -3+-3 cold ...........FAIL! rc= 6 -025 erH51 TER.sh 17p_cnnsc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 10+38 cold ......FAIL! rc= 7 -027 blH51 TBL.sh 17p_cnnsc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 48 cold .........FAIL! rc= 5 -029 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -030 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -031 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -032 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -036 erLD1 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:1800 2.65x3.33 USGS -5+-5 arb_ic ...........FAIL! rc= 7 -007 brJ61 TBR.sh 4p_casasc_dh clm_std^nl_urb_br 20021230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 6 - jaguar: All PASS except -005 smA91 TSM.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 <<< bug 967 -006 erA91 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 -007 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -009 smE92 TSM.sh 4p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 96 arb_ic ............FAIL! rc= 10 <<< bug 967 -010 erE92 TER.sh 4p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v5 10+38 arb_ic .........FAIL! rc= 5 -011 brE92 TBR.sh 4p_vodsrsc_dm clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v5 72+72 arb_ic ......FAIL! rc= 5 -013 smEH2 TSM.sh 4p_vodsrsc_dm clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 10 <<< bug 967 -014 erEH2 TER.sh 4p_vodsrsc_dm clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 10+38 arb_icFAIL! rc= 5 -015 brEH2 TBR.sh 4p_vodsrsc_dm clm_std^nl_urb_br 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 24+24 arbFAIL! rc= 5 -017 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -018 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -019 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -021 smH92 TSM.sh 17p_cnnsc_dm clm_ndepdyn 20020101:NONE:1800 4x5 gx3v5@2000 96 cold .............FAIL! rc= 8 -022 erH92 TER.sh 17p_cnnsc_dm clm_ndepdyn 20020101:NONE:1800 4x5 gx3v5@2000 10+38 cold ..........FAIL! rc= 5 -023 brH92 TBR.sh 17p_cnnsc_dm clm_ndepdyn 20020101:NONE:1800 4x5 gx3v5@2000 72+72 cold ..........FAIL! rc= 5 -025 smJ62 TSM.sh 4p_casasc_dm clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 <<< bug 967 -026 erJ62 TER.sh 4p_casasc_dm clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -027 brJ62 TBR.sh 4p_casasc_dm clm_std^nl_urb_br 20021230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -034 smLI2 TSM.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -035 erLI2 TER.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -036 brLI2 TBR.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 - lightning/pathscale: All PASS except -009 smA91 TSM.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 -010 erA91 TER.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 -011 brA91 TBR.sh _sc_dh clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -012 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 4 -017 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -018 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -019 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -020 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -021 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -023 erJ42 TER.sh 4p_casasc_dm clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 10+38 cold ...........FAIL! rc= 7 -024 brJ42 TBR.sh 4p_casasc_dm clm_std^nl_urb_br 20021230:NONE:1800 10x15 USGS 72+72 cold ........FAIL! rc= 6 -026 smL51 TSM.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -027 erL51 TER.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -028 brL51 TBR.sh _sc_dh clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -029 blL51 TBL.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 4 -032 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 6 -035 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -036 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -037 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 5 - bangkok/lf95: -024 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -025 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -026 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -051 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -052 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -055 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 4 -056 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - breeze/gale/hail/gust/ifort: All PASS up to the pftdyn test -016 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_39 - -Changes answers relative to baseline: No bit-for-bit (unless compare cases using the new vs old spin-up files) - -=============================================================== -=============================================================== -Tag name: clm3_6_39 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Thu May 7 14:18:08 MDT 2009 -One-line Summary: Bug fix for script version and maxpatchpft back to numpft+1 - -Purpose of changes: Bug fixes for two issues, script version to set CLM_DEMAND="null" instead of none - And reset default maxpatch_pft=numpft+1 instead of 4 which crept in on clm3_6_38 - -Bugs fixed (include bugzilla ID): 943 (CLM_DEMAND="null") - 946 (default maxpatchpft) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 974 (bug in pftdyn mode) - 977 (bug writing out 3D time-const data) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Change default for maxpatch_pft back to numpft+1 - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts - - scripts to scripts4_090506 (default CLM_DEMAND is null rather than none) - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/config_files/config_definition.xml ----- maxpft=numpft+1 -M models/lnd/clm/bld/namelist_files/namelist_definition.xml - Allow sim_year=1000 for test datasets -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml Add co2_ppmv for test_yr=1000 -M models/lnd/clm/src/main/driver.F90 ------------------------ Don't write out message about dynamic pft every time-step -M models/lnd/clm/src/main/lnd_comp_mct.F90 ------------------ Set iulog for non-masterproc processors -M models/lnd/clm/test/system/input_tests_master ------------- Put year-range for pftdyn 10x15 tests - -Summary of testing: Limited - -CLM tag used for the baseline comparison tests if applicable: clm3_6_38 - -Changes answers relative to baseline: Default number of PFT's is numpft+1 instead of 4. - -=============================================================== -=============================================================== -Tag name: clm3_6_38 -Originator(s): erik (erik) -Date: Wed May 6 00:20:37 MDT 2009 -One-line Summary: New fsurdat for other resolutions, bug-fixes, deep wetlands to bedrock, new spinups for 1.9x2.5 1850, 2000 - -Purpose of changes: - -New surfdata for all resolutions, and new pftdyn test datasets (1x1 and 10x15). Make sure -furbinp/forganic/fsurdata consistent. New 1850 and 2000 spin-up for 1.9x2.5. Add in field -to restart files needed for urban interpinic. Change deep wetlands to bedrock. Remove -some output for urban and aerdep. fcov changes from Sean. Bring in history change from -Dave (so only output static 3D fields on first h0 file). Bug fix for RTM bug from Keith -O. - -Bugs fixed (include bugzilla ID): 941 (RTM output 6X too low) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 943 (CLM_DEMAND="null") - 946 (default maxpatchpft) - 974 (bug in pftdyn mode) - 977 (bug writing out 3D time-const data) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: - -Describe any changes made to the namelist: Remove step2init, add irad from datm - factorfn now null instead of unused. - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: None - -Code reviewed by: swensosc, oleson, dlawren - -List any svn externals directories updated (csm_share, mct, etc.): scripts, csm_share, -drv, datm7, mct, pio - - scripts to scripts4_090505c - drv to vocemis-drydep08_drvseq3_0_16 - datm7 to datm7_090505b - csm_share to share3_090429 - pio to pio40_prod - -List all files eliminated: Remove old run scripts, pt-urban input data - -D models/lnd/clm/test/system/nl_files/clm_urb -- remove since urban is default -D models/lnd/clm/tools/ncl_scripts/addgrid2spointurban.ncl -- only needed to create - urban pt surface datasets -D models/lnd/clm/tools/ncl_scripts/clmi_increasesoillayer.ncl - only needed to go - from 10 layer to 15 layer finidat files. -D models/lnd/clm/bld/urban_input -D models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.nc -D models/lnd/clm/bld/urban_input/metropolis_fluxes.nc -D models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.nc -D models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.nc -D models/lnd/clm/bld/urban_input/surfdata_1x1_tropicAtl_urb3den_simyr2000_c090320.nc -D models/lnd/clm/bld/urban_input/surfdata_1x1_brazil_urb3den_simyr2000_c090320.nc -D models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.nc -D models/lnd/clm/bld/urban_input/surfdata_1x1_brazil_urb3den_simyr1850_c090317.nc -D models/lnd/clm/bld/run-pc.csh -D models/lnd/clm/bld/run-lightning.csh - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>> configure defaults for everything on, update for new datm7 - new sim_year for pftdyn test datasets. New fsurdat for all - resolutions, furbinp and forganic=fsurdat. -M models/lnd/clm/bld/configure -------------------------------- document defaults -correctly -M models/lnd/clm/bld/config_files/config_definition.xml ------- defaults for: - dust: on, maxpft:numpft+1, progsslt:on, rtm:on -M models/lnd/clm/bld/listDefaultNamelist.pl ------------------- all -res all option -M models/lnd/clm/bld/clm.cpl7.template ------------------------ use defaults for - dust, progsslt, and rtm. Don't demand furbinp, or forganic -M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Remove step2init, -change defaults for factorfn, and sim_year (for test ranges 1000-1002, and 1000-1004) -M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml Factorfn=null, rm step2init -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New 1.9x2.5 finidat, - new fsurdat for all resolutions, -M models/lnd/clm/bld/build-namelist --------------------------- furbinp,forganic now -longer clm_demand - furbinp = fsurdat, forganic = fsurdat, fsurdat no longer need - furbinp and fpftdyn, finidat doesn't need furbinp, remove step2init ->>>>>>>>>>>>>>>> -M models/lnd/clm/src/main/aerdepMod.F90 ---------------- log output only to masterproc -M models/lnd/clm/src/main/iniTimeConst.F90 ------------- remove urban log output -M models/lnd/clm/src/main/subgridRestMod.F90 ----------- add cols1d_ityp -M models/lnd/clm/src/main/clmtypeInitMod.F90 ----------- add fsat -M models/lnd/clm/src/main/iniTimeConst.F90 ------------- make deep wetlands bedrock -M models/lnd/clm/src/main/histFileMod.F90 -------------- only write out static fields - to h0 tapes on nstep=0 -M models/lnd/clm/src/main/clmtype.F90 ------------------ add fcov and fsat -M models/lnd/clm/src/main/histFldsMod.F90 -------------- add fsat to history files -M models/lnd/clm/src/main/mkarbinitMod.F90 ------------- make wetlands bedrock -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 - make wetlands bedrock -M models/lnd/clm/src/biogeophys/UrbanInitMod.F90 ------- add fcov/fsat -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 ------ add fcov/fsat -M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 --- add fcov/fsat -M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 --- add fcov/fsat -M models/lnd/clm/src/riverroute/RtmMod.F90 ------------- Fix RTM bug so accumulate - during RTM intervals ->>>>>>>>>>>>>>>> Remove run-pc/run-lighning tests, remove CLMNCEP, update to beta15 - lightning no parallel gmake, no clm_demand for furbinp, change clm_urb - to clm_std, add sim_year for pftdyn tests, add serial vodsrsc tests -M models/lnd/clm/test/system/tests_pretag_bangkok -M models/lnd/clm/test/system/tests_posttag_lightning -M models/lnd/clm/test/system/test_driver.sh --------- update to beta15, lightning gmake no parallel -M models/lnd/clm/test/system/mknamelist ------------- remove CLMNCEP option -M models/lnd/clm/test/system/TCSruncase.sh ---------- remove lightning, pc option -M models/lnd/clm/test/system/nl_files/clm_per ------- no clm_demand on furbinp -M models/lnd/clm/test/system/nl_files/clm_per0 ------ no clm_demand on furbinp -M models/lnd/clm/test/system/nl_files/clm_urb1pt ---- no clm_demand on furbinp -M models/lnd/clm/test/system/input_tests_master ----- change clm_urb to clm_std - add sim_year for pftdyn tests, add serial vodsrsc - tests ->>>>>>>>>>>>>>>> Change urban pt datasets from 1850 to 2000 sim_year. -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl - -Summary of testing: limited testing on breeze, lightning, and bangkok - - bluefire: All PASS except TBL up to test 27 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_37 - -Changes answers relative to baseline: Yes, RTM 6X higher, surface datasets different - deep wetlands now bedrock - -=============================================================== -=============================================================== -Tag name: clm3_6_37 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Mon Apr 27 23:27:26 MDT 2009 -One-line Summary: Update faerdep dataset for 1.9x2.5 to point to version cice is using for 1850 and 2000 - -Purpose of changes: Point to same version of faerdep datasets used by cice for 1.9x2.5 1850/2000 - This was needed for the ccsm4_0_beta15 tag. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 941 (RTM output 6X too low) - 974 (bug in pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - New faerdep datasets for 1.9x2.5 used by cice (only difference is time coord) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts - scripts to scripts4_090427b - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - -Summary of testing: None, other than build-namelist for 1.9x2.5 sim_year=1850/2000 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_36 - -Changes answers relative to baseline: Should be identical - -=============================================================== -=============================================================== -Tag name: clm3_6_36 -Originator(s): erik (erik) -Date: Mon Apr 27 14:10:13 MDT 2009 -One-line Summary: Handle transient aersol, make maxpatchpft=numpft+1 default, new datasets for 1.9x2.5 and 0.9x1.25, change doalb - -Purpose of changes: - -Changes so can do aerosol transient time-series (1850-2000) (kauff). New surfdata -datasets for 1.9x2.5 and 0.9x1.25 (1850 and 2000). New 1850-2000 pftdyn dataset for -1.9x2.5. New aerosol and ndep for 1.9x2.5 (1850 and 2000). Change to doalb from Mariana. -Make maxpatchpft=numpft+1 the default and remove all finidat files - -Bugs fixed (include bugzilla ID): 936 (create_test bug) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 935 (RTM warning NOT an error) - 937 (undef value on bangkok for maxpatchpft=numpft+1 case) - 941 (RTM output 6X too low) - 974 (bug in pftdyn mode) - 1068 (Problems interpolated deposition datasets to high res) - 1069 (Nitrogen Deposition datasets have wrong units) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: maxpatchpft default is now numpft+1 - -Describe any changes made to the namelist: build-namelist now allows 1850-2000 for sim_year for transient datasets - aerdep now chooses a transient dataset for this case as well - -List any changes to the defaults for the boundary datasets: - New aerosol deposition and nitrogen deposition datasets for 1.9x2.5 and transient - New pftdyn dataset for 1.9x2.5 for 1850-2000 - New surfdata for 1.9x2.5 and 0.9x1.25 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, kauff (aer transient), mvertens (doalb changes) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm7, and pio - scripts to scripts4_090424 - drv to vocemis-drydep08_drvseq3_0_14 - datm7 to datm7_090406 - pio to pio38_prod - -List all files eliminated: None - -List all files added and what they do: Add file for generic settings NOT used by a specific model component - -A models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>>>>>>>>>> Add cice decomp info, use xml input file for PE change -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_10x15_dh -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_4x5_dh -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_1.9x2.5_dh -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_64x128_s -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_0.9x1.25_dh -M models/lnd/clm/test/system/TCT_ccsmseq.sh --- use xml file format for PE change ->>>>>>>>>>>>>>>>>>>>>>>> Base LANDMASK on SUM(PCT_PFT) rather than LANDFRAC_PFT -M models/lnd/clm/tools/ncl_scripts/pftdyntest2raw.ncl ->>>>>>>>>>>>>>>>>>>>>>>> Add 1850-2000 simyr option -M models/lnd/clm/bld/config_files/config_definition.xml ------ maxpatchpft default -is numpft+1 -M models/lnd/clm/bld/namelist_files/namelist_definition.xml -- Add 1850-2000 to valid sim_year values -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Remove finidat files, - remove data in namelist_defaults_overall, - new fsurdat,forganic,furbinp for 1.9x2.5 and 0.9x1.25 - 1850-2000 PFT dataset for 1.9x2.5 - new aerdep and ndep datasets for 1.9x2.5 and 0.9x1.25, - and transient 1850-2000 aerdep datasets -M models/lnd/clm/bld/build-namelist ----------- Be careful if datasets are picked -based on full sim_year (which could be 1850-2000) or the first year (1850 finidat, -fsurdat files) -M models/lnd/clm/bld/listDefaultNamelist.pl --- Use list of defaults files -M models/lnd/clm/bld/queryDefaultNamelist.pl -- Use list of defaults files, remove scpto option -M models/lnd/clm/bld/queryDefaultXML.pm ------- Use list of defaults files ->>>>>>>>>>>>>>>>>>>>>>>> doalb changes from Mariana Vertenstein (branches/new_doalb) ->>>>>>>>>>>>>>>>>>>>>>>> remove caldayp1 use next_swcday sent from atm -M models/lnd/clm/src/biogeochem/DGVMMod.F90 ---------- remove caldayp1, send nextsw_cday -M models/lnd/clm/src/main/clm_comp.F90 --------------- don't calcualte caldayp1, calc declinp1 based on nextsw_cday -M models/lnd/clm/src/main/driver.F90 ----------------- Pass nextsw_cday instead of caldayp1 -M models/lnd/clm/src/main/initSurfAlbMod.F90 --------- Don't pass calday and declin -M models/lnd/clm/src/main/lnd_comp_mct.F90 ----------- Remove never_doAlb logic, pass nextsw_cday down -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 - cosz based on nextsw_cday NOT caldayp1 -M models/lnd/clm/src/biogeophys/UrbanMod.F90 --------- Do NOT pass calday, declin ->>>>>>>>>>>>>>>>>>>>>>>> aerdep changes from Brian Kauffman (cbgcdev05_clm3_6_35) -M models/lnd/clm/src/main/aerdepMod.F90 -- Time-interpolation done each time-step (rather than just each day) method slightly different. - Also allows transient file where uses first year - until reaches middle years, then after last year continues to use last year. - -Summary of testing: - - bluefire: All PASS except TBL and... up to test 62 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -038 smCA4 TSM.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 10 -039 erCA4 TER.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ......FAIL! rc= 5 -040 brCA4 TBR.sh _sc_ds clm_urb^nl_urb_br 19981001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic ...FAIL! rc= 5 -042 smCA8 TSM.sh _sc_ds clm_urb^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 10 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_35 - -Changes answers relative to baseline: Yes -- default for maxpatchpft is numpft+1 - rather than 4 - And aersol time-interpolation is different - method is different and also does interpolation - for every time-step NOT held constant each day. - -=============================================================== -=============================================================== -Tag name: clm3_6_35 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Mon Apr 20 15:19:17 MDT 2009 -One-line Summary: Fix major logic bug in mksurfdata - -Purpose of changes: Fix major logic bug in mksurfdata (bug 934) which requires us to recreate any surface datasets - created with clm3_6_32. The bug zero'd out LAI for some PFT's and biased the LAI values - (LAI, SAI, veg-bot, veg-top). - - This is a note from dlawren - "I have taken a look at the new surface files and they look correct to me. LAI - is defined everywhere. I did a quick test using this surface dataset with a - spunup file from Keith's prior 1850 simulation and it worked fine (no errors). - I also confirmed that indeed the gridbox mean LAI is different by up to about - +-0.5. In most places the difference is below +-0.1." - - -Bugs fixed (include bugzilla ID): 934 (pftdyn logic bug) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 941 (RTM output 6X too low) - 974 (bug in pftdyn mode) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Self (but new 1.9x2.5 surface dataset checked by dlawren and lawrence) - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - -A models/lnd/clm/tools/ncl_scripts/pftdyntest2raw.ncl --- Create raw pftdyn test datasets, so can create new ones. - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/tools/mksurfdata/mklaiMod.F90 ---------------- Fix pftdyn logic error. -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ---------------- Move soil-text calc higher up, allow more space for filenames -M models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig ------ Make output in double precision -M models/lnd/clm/tools/mksurfdata/mksurfdata.regional --------- Make output in double precision -M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn ----------- Make output in double precision -M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept --------- Make output in double precision -M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist --------- Make output in double precision -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl --------------- Get T62, 2x2.5 and qtr deg res's, only do 2000 for urban single-point -M models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850-2005.txt --- Allow larger size for filenames -M models/lnd/clm/tools/mksurfdata/pftdyn_simyr2000.txt -------- Allow larger size for filenames -M models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850.txt -------- Allow larger size for filenames - -MM models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl ----------- Add svn keywords -MM models/lnd/clm/tools/ncl_scripts/clmi_increasesoillayer.ncl - Add svn keywords -M models/lnd/clm/tools/ncl_scripts/README --------------------- Update doc on files - -Summary of testing: No testing except for mksurfdata on bluefire - -001 sm774 TSMtools.sh mksurfdata tools__ds singlept .............................................PASS -002 sm754 TSMtools.sh mksurfdata tools__s globalirrig ...........................................PASS -003 sm756 TSMtools.sh mksurfdata tools__s pftdyn ................................................PASS - -CLM tag used for the baseline comparison tests if applicable: clm3_6_34 - -Changes answers relative to baseline: no bit-for-bit (other than mksurfdata) - -=============================================================== -=============================================================== -Tag name: clm3_6_34 -Originator(s): oleson (Oleson Keith 1332 CGD) -Date: Sun Apr 19 09:34:43 MDT 2009 -One-line Summary: Fix bangkok urban bug - -Purpose of changes: Fix urban bug found from bangkok testing (#927) and eliminate potential water balance error - -Bugs fixed (include bugzilla ID): 927 - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 934 (pftdyn logic bug) - 941 (RTM output 6X too low) - 974 (bug in pftdyn mode) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: myself, Erik Kluzek, Sean Swenson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 .... Change loop over all columns to filter_nourbanc -M models/lnd/clm/src/biogeophys/UrbanMod.F90 .... Change some net_solar fields from intent(out) to intent(inout). - add soilalpha_u restriction on soil evaporation/transpiration selection for pervious road (this second - change is bit for bit for all bluefire/bangkok testing, but will prevent small water balance errors in - special situations (e.g., perpetual January simulations) - -Summary of testing: - - bluefire: All PASS except: -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -060 blLI1 TBL.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -069 smJ61 TSM.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 -070 erJ61 TER.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -071 brJ61 TBR.sh 4p_casasc_dh clm_urb^nl_urb_br 19981230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -072 blJ61 TBL.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 48 cold ...........FAIL! rc= 4 -082 bl744 TBLtools.sh mksurfdata tools__s namelist ..............................................FAIL! rc= 7 -084 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 6 -086 bl754 TBLtools.sh mksurfdata tools__s globalirrig ...........................................FAIL! rc= 6 -088 bl756 TBLtools.sh mksurfdata tools__s pftdyn ................................................FAIL! rc= 7 -093 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -094 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -095 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 4 -096 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 4 -097 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - jaguar: - kraken: - lightning/pathscale: - bangkok/lf95: All PASS except: -008 blA92 TBL.sh _sc_dm clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 5 -011 blD91 TBL.sh _persc_dh clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 5 -033 blH52 TBL.sh 17p_cnnsc_dm clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS@2000 48 cold .........FAIL! rc= 5 -034 smJ92 TSM.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 96 cold ...............FAIL! rc= 10 -035 erJ92 TER.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 10+38 cold ............FAIL! rc= 5 -036 brJ92 TBR.sh 4p_casasc_dm clm_urb^nl_urb_br 19981230:NONE:1800 4x5 gx3v5 72+72 cold .........FAIL! rc= 5 -037 blJ92 TBL.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 48 cold ...............FAIL! rc= 4 -041 blL51 TBL.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 5 -048 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -049 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -052 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 8 -053 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: clm3_6_33 - -Changes answers relative to baseline: No, bit for bit - -=============================================================== -=============================================================== -Tag name: clm3_6_33 -Originator(s): erik (erik) -Date: Thu Apr 16 14:45:23 MDT 2009 -One-line Summary: Bring in dynpft changes from cbgc branch - -Purpose of changes: New method for dealing with dynamic land-use changes - - morph routine casa() in casa_ecosystemDyn(), so casa is more similar to CN & DGVM, - and prepares casa code for adding additional carbon flux functionality. - Larger plan is to duplicate these and other mods from casafire branch on this branch. - Add new method for conserving heat & water wrt dynamic land use. - Conserves heat & water for any change in the land-unit, column, or pft arrangment. - when pftdyn is activated, "normalize" sum of new pft weights in a column - to be the same as the sum of the old pft weights - otherwise BalanceCheck will generate water/heat balance errors. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 927 (problem with urban on bangkok/lahey) - 934 (pftdyn logic bug) - 941 (RTM output 6X too low) - 974 (bug in pftdyn mode) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: - B. Kauffman, D. Lawrence, G. Bonan, K. Oleson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: - - D biogeochem/CASASummary.F90 ................ code relocated inside CASAMod.F90 - -List all files added and what they do: - - A main/dynlandMod.F90 ............... new routine is here - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>> models/lnd/clm/src - M biogeochem/CASAMod.F90 .......... Add in CASASummary.F90, add casa_recosystemDyn subroutine - M main/pftdynMod.F90 .............. when pftdyn is active, "normalize" pft weights in a column - M biogeophys/BalanceCheckMod.F90 .. improved imbalance write statement - M main/driver.F90 ................. CASAsummary, CASAPhenology now called in - casa_ecocsystemDyn() - M main/initSurfAlbMod.F90 ......... casa() renamed casa_ecocsystemDyn() - M main/driver.F90 ......... call new routine here - M main/clmtype.F90 ......... define new fields - M main/clmtypeInitMod.F90 ......... init new fields - M main/histFldsMod.F90 ......... put new fields on hist file - M main/clm_atmlnd.F90 ......... heat imbalance is applied here - (to latent heat flux) - M riverroute/RtmMod.F90 ......... water imbalance is applied here (to runoff) - -Summary of testing: - - bluefire: All PASS except pftdyn TBL tests and ... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -069 smJ61 TSM.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 -070 erJ61 TER.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -071 brJ61 TBR.sh 4p_casasc_dh clm_urb^nl_urb_br 19981230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -093 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -094 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -095 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 4 -096 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 4 -097 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - jaguar: All PASS except -005 smA91 TSM.sh _sc_dh clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 -006 erA91 TER.sh _sc_dh clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 -007 brA91 TBR.sh _sc_dh clm_urb^nl_urb_br 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -009 smE92 TSM.sh 4p_vodsrsc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 96 arb_ic ............FAIL! rc= 10 -010 erE92 TER.sh 4p_vodsrsc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 10+38 arb_ic .........FAIL! rc= 5 -011 brE92 TBR.sh 4p_vodsrsc_dm clm_urb^nl_urb_br 19981230:NONE:1800 4x5 gx3v5 72+72 arb_ic ......FAIL! rc= 5 -013 smEH2 TSM.sh 4p_vodsrsc_dm clm_urb^nl_urb 19981231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 10 -014 erEH2 TER.sh 4p_vodsrsc_dm clm_urb^nl_urb 19981231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 10+38 arb_icFAIL! rc= 5 -015 brEH2 TBR.sh 4p_vodsrsc_dm clm_urb^nl_urb_br 19981231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 24+24 arbFAIL! rc= 5 -021 smH92 TSM.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 96 cold .............FAIL! rc= 10 -022 erH92 TER.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 10+38 cold ..........FAIL! rc= 5 -023 brH92 TBR.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 72+72 cold ..........FAIL! rc= 5 -025 smJ62 TSM.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 -026 erJ62 TER.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -027 brJ62 TBR.sh 4p_casasc_dm clm_urb^nl_urb_br 19981230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -034 smLI2 TSM.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -035 erLI2 TER.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -036 brLI2 TBR.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -038 erP65 TSM_ccsmseq.sh ERS f19_g15 I ..........................................................FAIL! rc= 4 -039 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - lightning/pathscale: All PASS except pftdyn TBL tests and ... -011 erA91 TER.sh _sc_dh clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 7 -012 brA91 TBR.sh _sc_dh clm_urb^nl_urb_br 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -018 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -019 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -020 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -022 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 -023 smJ42 TSM.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 10x15 USGS 96 cold ..............FAIL! rc= 10 -024 erJ42 TER.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 10x15 USGS 10+38 cold ...........FAIL! rc= 5 -025 brJ42 TBR.sh 4p_casasc_dm clm_urb^nl_urb_br 19981230:NONE:1800 10x15 USGS 72+72 cold ........FAIL! rc= 5 -027 smL51 TSM.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -028 erL51 TER.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -029 brL51 TBR.sh _sc_dh clm_urb^nl_urb_br 19980115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -036 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -037 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -038 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 4 - bangkok/lf95: All PASS except pftdyn TBL tests and ... -005 smA92 TSM.sh _sc_dm clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 -006 erA92 TER.sh _sc_dm clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 -007 brA92 TBR.sh _sc_dm clm_urb^nl_urb_br 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -009 smD91 TSM.sh _persc_dh clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 10 -010 erD91 TER.sh _persc_dh clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 72+72 cold ...............FAIL! rc= 5 -030 smH52 TSM.sh 17p_cnnsc_dm clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS@2000 96 cold .........FAIL! rc= 10 -031 erH52 TER.sh 17p_cnnsc_dm clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS@2000 10+38 cold ......FAIL! rc= 5 -032 brH52 TBR.sh 17p_cnnsc_dm clm_urb^nl_urb_br 19980115:NONE:1800 10x15 USGS@2000 72+72 cold ...FAIL! rc= 5 -034 smJ92 TSM.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 96 cold ...............FAIL! rc= 10 -035 erJ92 TER.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 10+38 cold ............FAIL! rc= 5 -036 brJ92 TBR.sh 4p_casasc_dm clm_urb^nl_urb_br 19981230:NONE:1800 4x5 gx3v5 72+72 cold .........FAIL! rc= 5 -038 smL51 TSM.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -039 erL51 TER.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -040 brL51 TBR.sh _sc_dh clm_urb^nl_urb_br 19980115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -048 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -049 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -052 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 8 -053 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - breeze/gale/hail/gust/ifort: All PASS - -CLM tag used for the baseline comparison tests if applicable: clm3_6_33 - -Changes answers relative to baseline: Only for pftdyn mode - -=============================================================== -================================================================================ -Tag name: clm3_6_32 -Originator(s): dlawren, erik, jet -Date: Fri Apr 10 14:38:52 MDT 2009 -One-line Summary: Add irrigation area to mksrfdata, fix high-res and pftdyn problems - -Purpose of changes: Add irrigation area to mksrfdat tool, for irrigated area copy PFT=15 LAI and heights - into PFT=16, PFT=15 is unirrigated crop, PFT=16 is irrigated crop - fix pftdyn mode for mksurfdata (erik), bug fixes to mksurfdata from John Truesdale - script changes to make gx1v6 default. - -Bugs fixed (include bugzilla ID): 919 (pftdyn mode in mksurfdata) - 821 (problems running mksurfdata at high-res) - 357 (codes replicated in tools) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 920 (glacier_mec problems in mksurfdata) - 926 (pftdyn code needs to be shared in mksurfdata) - 927 (problem with urban on bangkok/lahey) - 934 (pftdyn logic bug) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Building with PIO is on by default - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: gx1v6 for and 0.47 res - fix 5x5_amazon surface dataset. - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, jet, dlawren - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm7, -csm_share, esmf_wrf_timemgr - - scripts to scripts4_090406 - drv to vocemis-drydep08_drvseq3_0_13 - datm7 to datm7_090403 - csm_share to share3_090407 - timemgr to esmf_wrf_timemgr_090402 - -List all files eliminated: Remove text urban input files, globalurban mksurf namelist -- -as urban is default. - -D models/lnd/clm/bld/urban_input/metropolis_fluxes.txt -D models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.txt -D models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.txt -D models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.txt -D models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.txt -D models/lnd/clm/tools/mksurfdata/mksurfdata.globalurban - -List all files added and what they do: - -A models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850-2005.txt . List of dynamic PFT files from 1850 to 2005 -A models/lnd/clm/tools/mksurfdata/pftdyn_simyr1850.txt ...... Dynamic PFT file for 1850 -A models/lnd/clm/tools/mksurfdata/pftdyn_simyr2000.txt ...... Dynamic PFT file for 2000 -A models/lnd/clm/tools/mksurfdata/mkirrig.F90 ............... calculates irrigated area from irrigated area on input dataset -A models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig .... namelist file pointing to irrigated area source file -A models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml datm namelist info -A models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml drv namelist info - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>> Add firrig option, fix bugs, fix pftdyn mode -M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 .............. Add mksrf_firrig -M models/lnd/clm/tools/mksurfdata/mklaiMod.F90 .............. Copy LAI in PFT=15 into PFT=16 if mksrf_irrig /= '' - use standard averaging for pftdyn -M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 ............. Add mksrf_firrig -M models/lnd/clm/tools/mksurfdata/README -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 .............. Add pct_irr to surface dataset if mksrf_irrig /= '' -M models/lnd/clm/tools/mksurfdata/Srcfiles -M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 .............. Adjust PCT_PFT for non-irrigated (PFT=15) and irrigted (PFT=16) crops -M models/lnd/clm/tools/mksurfdata/mkglcmec.F90 .............. Check for divide by zero (JT) -M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 .............. Initialize files to blank -M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 ............. Only output data needed for pftdyn files -M models/lnd/clm/tools/mksurfdata/mkorganic.F90 ............. Allocate bug-fix (JT) -M models/lnd/clm/tools/mksurfdata/mkurban.F90 ............... bug-fix (JT) -M models/lnd/clm/tools/mksurfdata/areaMod.F90 ............... bug-fix (JT) -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 .............. add mkirrig, changes for pftdyn -M models/lnd/clm/tools/mksurfdata/Srcfiles .................. add mkirrig.F90 -M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 .............. if firrig => irrig/non-irrig crops ->>>>>>>>>>>>>>> Always create files using the transient input raw datasets -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl -M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist -M models/lnd/clm/tools/mksurfdata/mksurfdata.regional -M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept -M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist ->>>>>>>>>>>>>>> Add needed fields (mask, LANDMASK) to urban datasets -M models/lnd/clm/tools/ncl_scripts/addgrid2spointurban.ncl ->>>>>>>>>>>>>>> Turn pio on, work with defaults -M models/lnd/clm/bld/configure -M models/lnd/clm/bld/config_files/config_definition.xml -M models/lnd/clm/bld/run-ibm.csh -M models/lnd/clm/bld/clm.cpl7.template -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ->>>>>>>>>>>>>>> Add mask,PCT_URBAN and LANDMASK to urban point input files -M models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.nc ..... Add mask -M models/lnd/clm/bld/urban_input/metropolis_fluxes.nc ....... Add mask -M models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.nc ..... Add mask -M models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.nc .... Add mask -M models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.nc .... Changes from Keith, add mask ->>>>>>>>>>>>>>> -M models/lnd/clm/test/system/tests_pretag_bluefire - add pftdyn test -M models/lnd/clm/test/system/test_driver.sh -------- use beta14 -M models/lnd/clm/test/system/input_tests_master ---- fix TBR tests, -M models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh - remove eshr -M models/lnd/clm/test/system/TSM.sh ---------------- fix -M models/lnd/clm/test/system/tests_pretag_bangkok -- put some serial tests first -M models/lnd/clm/test/system/CLM_runcmnd.sh -------- remove bluesky ->>>>>>>>>>>>>>> Always use T_REF2M NOT t_ref2m -M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 - -Summary of testing: - - bluefire: All PASS except -004 blA74 TBL.sh _sc_ds clm_urb^nl_urb 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ............FAIL! rc= 5 -009 blA91 TBL.sh _sc_dh clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 5 -012 blD91 TBL.sh _persc_dh clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 7 -014 blH74 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 cold ........FAIL! rc= 5 -019 blE91 TBL.sh 4p_vodsrsc_dh clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 48 arb_ic ............FAIL! rc= 5 -024 blF92 TBL.sh 17p_vodsrsc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 5 -028 blF93 TBL.sh 17p_vodsrsc_do clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 48 cold .............FAIL! rc= 5 -032 blEH1 TBL.sh 4p_vodsrsc_dh clm_urb^nl_urb 19981231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 5 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -041 blCA4 TBL.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 7 -043 blCA8 TBL.sh _sc_ds clm_urb^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 7 -047 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 7 -051 blC61 TBL.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v6 48 cold .................FAIL! rc= 7 -055 blH51 TBL.sh 17p_cnnsc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS@2000 48 cold .........FAIL! rc= 5 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -060 blLI1 TBL.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -062 blL78 TBL.sh _sc_s clm_urb^nl_urb 19971231:NONE:1800 1x1_brazil navy -10 arb_ic .............FAIL! rc= 5 -065 smL83 TSM.sh _sc_do clm_urb^nl_urb 19980115:NONE:3600 5x5_amazon navy -10 arb_ic ............FAIL! rc= 10 -066 erL83 TER.sh _sc_do clm_urb^nl_urb 19980115:NONE:3600 5x5_amazon navy -5+-5 arb_ic ..........FAIL! rc= 5 -067 brL83 TBR.sh _sc_do clm_urb^nl_urb_br 19980115:NONE:3600 5x5_amazon navy -10+-10 arb_ic .....FAIL! rc= 5 -068 blL83 TBL.sh _sc_do clm_urb^nl_urb 19980115:NONE:3600 5x5_amazon navy -10 arb_ic ............FAIL! rc= 4 -069 smJ61 TSM.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 -070 erJ61 TER.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -071 brJ61 TBR.sh 4p_casasc_dh clm_urb^nl_urb_br 19981230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -072 blJ61 TBL.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 48 cold ...........FAIL! rc= 4 -073 smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v6 48 arb_ic .....FAIL! rc= 10 -077 blJ74 TBL.sh 4p_casasc_ds clm_urb^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic ..FAIL! rc= 5 -084 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 6 -086 bl754 TBLtools.sh mksurfdata tools__s globalirrig ...........................................FAIL! rc= 6 -088 bl756 TBLtools.sh mksurfdata tools__s pftdyn ................................................FAIL! rc= 7 -093 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -094 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -095 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 4 -096 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 4 -097 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 4 - jaguar: ALL FAIL except -029 smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v6 48 arb_ic .....PASS - breeze/pathscale: All PASS - bangkok/lahey: All PASS except -005 smA92 TSM.sh _sc_dm clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 -006 erA92 TER.sh _sc_dm clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 -007 brA92 TBR.sh _sc_dm clm_urb^nl_urb_br 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -009 smD91 TSM.sh _persc_dh clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 144 cold .................FAIL! rc= 10 -010 erD91 TER.sh _persc_dh clm_per^nl_urb 19981231:NONE:1200 4x5 gx3v5 72+72 cold ...............FAIL! rc= 5 -014 erCA4 TER.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ......FAIL! rc= 7 -030 smH52 TSM.sh 17p_cnnsc_dm clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS@2000 96 cold .........FAIL! rc= 10 -031 erH52 TER.sh 17p_cnnsc_dm clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS@2000 10+38 cold ......FAIL! rc= 5 -032 brH52 TBR.sh 17p_cnnsc_dm clm_urb^nl_urb_br 19980115:NONE:1800 10x15 USGS@2000 72+72 cold ...FAIL! rc= 5 -034 smJ92 TSM.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 96 cold ...............FAIL! rc= 10 -035 erJ92 TER.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 10+38 cold ............FAIL! rc= 5 -036 brJ92 TBR.sh 4p_casasc_dm clm_urb^nl_urb_br 19981230:NONE:1800 4x5 gx3v5 72+72 cold .........FAIL! rc= 5 -038 smL51 TSM.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -039 erL51 TER.sh _sc_dh clm_urb^nl_urb 19980115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -040 brL51 TBR.sh _sc_dh clm_urb^nl_urb_br 19980115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -052 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 8 -053 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_30 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_6_31 -Originator(s): erik (erik) -Date: Wed Apr 1 00:58:15 MDT 2009 -One-line Summary: New surface datasets for 1850,2000, support for 0.9x1.25_gx1v6, urban always on. New pft-physiology file. Update scripts so remove some CLM_ env_conf vars. Fix CN for urban/pftdyn. - -Purpose of changes: - -New surface datasets for 1850,2000. sim_year can be 1850 or 2000 -(1870 no longer supported), support for 0.9x1.25_gx1v6. Demand furbinp (urban always on), -wasteheat='ON_WASTEHEAT' by default. Change cpl7 template so can either do a cold start -or require a finidat file (cold or startup). New pft-physiology file for CN used by -everything. Update scripts so remove some CLM_ env_conf vars: CLM_BGC, CLM_DYNNDEP, -CLM_DYNPFT, CLM_CO2_TYPE, remove CLMNCEP from scripts/datm (keeping CLM_QIAN mode). -Change final CN loop to go over soil filter -- so CN,CASA,DGVM can work with urban. -Remove traffic_flux array as it's subscript was out of bounds on breeze. lnd_comp_mct -changed so that check for spval allows for rounding of spval. - -Bugs fixed (include bugzilla ID): 904 (I cases start in 2003 rather than 1948) - 897 (string comparision in scripts) - 357 (remove duplicated files in tools) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 919 (problems in mksurfdata for pftdyn mode) - 920 (glacier_mec problems in mksurfdata) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Add -pio option to configure - Will set the BUILDPIO CPP token as well as adding pio source to Filepath. - -Describe any changes made to the namelist: Add pio_inparm namelist when -pio - was set in configure - -List any changes to the defaults for the boundary datasets: - New 1850 and 2000 surface datasets with urban enabled for most resolutions - Also new 1850 and 2000 finidat files for 1.9x2.5 resolution (other finidat files removed) - -Describe any substantial timing or memory changes: None - -Code reviewed by: Peter Thornton, Keith Oleson, Forrest Hoffman - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm, csm_share, mct, pio - - scripts4_090325 - datm7_090325 - vocemis-drydep11_share3_090112 - CT2_6_0_090308 - pio28_prod - -List all files eliminated: - ->>>>>>>>>>>>>> Remove DGVM namelist tests. -D models/lnd/clm/test/system/config_files/10p_dgvmsc_h -D models/lnd/clm/test/system/config_files/10p_dgvmsc_m -D models/lnd/clm/test/system/config_files/10p_dgvmsc_o -D models/lnd/clm/test/system/config_files/10p_dgvmsc_s -D models/lnd/clm/test/system/config_files/10p_dgvmsc_dh -D models/lnd/clm/test/system/config_files/10p_dgvmsc_dm -D models/lnd/clm/test/system/config_files/10p_dgvmsc_do - ->>>>>>>>>>>>>> Remove script that creates ASCII global data for urban. -D models/lnd/clm/tools/ncl_scripts/generate_ascii_avg_urbanparam_file_p7.ncl - ->>>>>>>>>>>>>> Remove modules replicated in mkgriddata by mksurfdata modules ->>>>>>>>>>>>>> use the versions in mksurfdata. -D models/lnd/clm/tools/mkgriddata/ncdio.F90 -D models/lnd/clm/tools/mkgriddata/domainMod.F90 -D models/lnd/clm/tools/mkgriddata/areaMod.F90 - -List all files added and what they do: - ->>>>>>>>>>>>>> Add point datasets that now have urban information in them. -A models/lnd/clm/bld/urban_input/surfdata_1x1_tropicAtl_urb3den_simyr2000_c090320.nc -A models/lnd/clm/bld/urban_input/surfdata_1x1_brazil_urb3den_simyr2000_c090320.nc -A models/lnd/clm/bld/urban_input/surfdata_1x1_brazil_urb3den_simyr1850_c090317.nc - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Make most tests with urban, remove dgvm tests -M models/lnd/clm/test/system/tests_pretag_bluefire -M models/lnd/clm/test/system/config_files/README -M models/lnd/clm/test/system/tests_pretag_jaguar -M models/lnd/clm/test/system/tests_pretag_bangkok -M models/lnd/clm/test/system/test_driver.sh -M models/lnd/clm/test/system/tests_posttag_hybrid_regression -M models/lnd/clm/test/system/tests_posttag_purempi_regression -M models/lnd/clm/test/system/nl_files/clm_per -M models/lnd/clm/test/system/nl_files/clm_per0 -M models/lnd/clm/test/system/input_tests_master -M models/lnd/clm/test/system/tests_posttag_lightning - ->>>>>>>>>>>>>> Add all_urban mode for single-point mode -M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 -M models/lnd/clm/tools/mksurfdata/ncdio.F90 -M models/lnd/clm/tools/mksurfdata/mkglacier.F90 -M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 -M models/lnd/clm/tools/mksurfdata/mklanwat.F90 -M models/lnd/clm/tools/mksurfdata/mkurban.F90 -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 -M models/lnd/clm/tools/mksurfdata/mksurfdata.pl -M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 - ->>>>>>>>>>>>>> Add pio option to configure, and if set add pio_inparm namelist ->>>>>>>>>>>>>> Datasets to 1850/2000 and most with urban. -M models/lnd/clm/bld/configure ------------- Add pio option -M models/lnd/clm/bld/config_files/config_definition.xml - Add pio to config_cache.xml -M models/lnd/clm/bld/clm.cpl7.template ----- require furbinp, remove CLM_ env vars -M models/lnd/clm/bld/build-namelist -------- make sure sim_year sent in, change - some names etc. -M models/lnd/clm/bld/namelist_files/namelist_definition.xml ---- Add pio_inparm -M models/lnd/clm/bld/namelist_files/datm.streams.template.xml -- Remove CLM_NCEP -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- urban datasets - for most resolutions, datasets for 1850 and 2000, remove most finidat - ->>>>>>>>>>>>>> Add data from grid files as well as LANDMASK and PCT_URBAN. -M models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.nc -M models/lnd/clm/bld/urban_input/metropolis_fluxes.nc -M models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.nc -M models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.nc -M models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.nc - ->>>>>>>>>>>>>> Changes from Forrest H./Peter T. to fix some CN problems (single-point, pftdyn) -M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/main/driver.F90 -M models/lnd/clm/src/main/pftdynMod.F90 -M models/lnd/clm/src/main/lnd_comp_mct.F90 --------- Change from Mark Flanner - to fix roundoff issues for aerosols. -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/biogeophys/UrbanMod.F90 ------- Remove traffic_flux as subscript - bounds was being exceeded on breeze. - -Summary of testing: - - bluefire: All PASS except TBL and... -023 brF92 TBR.sh 17p_vodsrsc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 72+72 cold ..........FAIL! rc= 13 -027 brF93 TBR.sh 17p_vodsrsc_do clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 72+72 cold ..........FAIL! rc= 13 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -065 smL83 TSM.sh _sc_do clm_urb^nl_urb 19980115:NONE:3600 5x5_amazon navy -10 arb_ic ............FAIL! rc= 10 -066 erL83 TER.sh _sc_do clm_urb^nl_urb 19980115:NONE:3600 5x5_amazon navy -5+-5 arb_ic ..........FAIL! rc= 5 -067 brL83 TBR.sh _sc_do clm_urb^nl_urb_br 19980115:NONE:3600 5x5_amazon navy -10+-10 arb_ic .....FAIL! rc= 5 -069 smJ61 TSM.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 -070 erJ61 TER.sh 4p_casasc_dh clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -071 brJ61 TBR.sh 4p_casasc_dh clm_urb^nl_urb_br 19981230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -076 brJ74 TBR.sh 4p_casasc_ds clm_urb^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_ic .FAIL! rc= 13 - jaguar: All PASS except TBL and... -005 smA91 TSM.sh _sc_dh clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ...................FAIL! rc= 10 -006 erA91 TER.sh _sc_dh clm_urb^nl_urb 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic ................FAIL! rc= 5 -007 brA91 TBR.sh _sc_dh clm_urb^nl_urb_br 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .............FAIL! rc= 5 -009 smE92 TSM.sh 4p_vodsrsc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 96 arb_ic ............FAIL! rc= 10 -010 erE92 TER.sh 4p_vodsrsc_dm clm_urb^nl_urb 19981230:NONE:1800 4x5 gx3v5 10+38 arb_ic .........FAIL! rc= 5 -011 brE92 TBR.sh 4p_vodsrsc_dm clm_urb^nl_urb_br 19981230:NONE:1800 4x5 gx3v5 72+72 arb_ic ......FAIL! rc= 5 -017 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -018 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 10+38 arb_ic ................FAIL! rc= 5 -019 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -025 smJ62 TSM.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 10 -026 erJ62 TER.sh 4p_casasc_dm clm_urb^nl_urb 19981230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 5 -027 brJ62 TBR.sh 4p_casasc_dm clm_urb^nl_urb_br 19981230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 5 -029 smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v5 48 startup ....FAIL! rc= 10 -030 smJ74 TSM.sh 4p_casasc_ds clm_urb^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -1100 arb_ic .FAIL! rc= 10 -031 erJ74 TER.sh 4p_casasc_ds clm_urb^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -10+-10 arb_ic FAIL! rc= 5 -032 brJ74 TBR.sh 4p_casasc_ds clm_urb^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_ic .FAIL! rc= 5 -034 smLI2 TSM.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -035 erLI2 TER.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -036 brLI2 TBR.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -039 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 7 - bangkok/lf95: All PASS except TBL - breeze/gale/hail/gust/ifort: All PASS - -TBL tests are different since most tests are now with urban. - -Most of the fails are due to missing files. - -CLM tag used for the baseline comparison tests if applicable: clm3_6_30 - -Changes answers relative to baseline: Yes for CN -- new pft-physiology file - -=============================================================== -=============================================================== -Tag name: clm3_6_30 -Originator(s): oleson (Oleson Keith 1332 CGD) -Date: Thu Mar 19 20:44:33 MDT 2009 -One-line Summary: Fix urban roof/wall layers - -Purpose of changes: Fix urban roof/wall layers - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Me - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/main/iniTimeConst.F90 ---- divide roof/wall thickness by nlevurb instead of nlevsoi - -Summary of testing: - - bluefire: All urban testing passed except TBL - jaguar: - kraken: - lightning/pathscale: - bangkok/lf95: - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: clm3_6_29 - -Changes answers relative to baseline: Urban only - -=============================================================== -=============================================================== -Tag name: clm3_6_29 -Originator(s): oleson (Oleson Keith 1332 CGD) -Date: Thu Mar 19 07:16:05 MDT 2009 -One-line Summary: CN SAI, CN testing fix, rad step size fix - -Purpose of changes: Add SAI decay for CN mode. - Fix CN for tests SmI58, smH51, erH51, brH51 - Add new get_rad_step_size function used by SAI decay function. This is the "simple fix" - and yields correct radiation time step size for all time steps except one for the I and F - cases. The "complete fix" involves changes to other component models and will be available soon. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: K. Oleson, G. Bonan, F. Hoffman, M. Vertenstein, J. Truesdale - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/biogeochem/CNrestMod.F90 --- add seven CN fields deleted previously for restart -M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 ---- add SAI decay function (calls get_rad_step_size) -M models/lnd/clm/src/main/clm_time_manager.F90 ---- changes to fix get_rad_step_size function -M models/lnd/clm/src/main/lnd_comp_mct.F90 ---- changes to fix get_rad_step_size function - -Summary of testing: - - bluefire: All PASS except: -013 smH74 TSM.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -1100 cold .......FAIL! rc= 10 -014 blH74 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 cold ........FAIL! rc= 4 -020 smE95 TSM.sh 4p_vodsrsc_h clm_std 19981231:NONE:1800 4x5 gx3v5 48 arb_ic ....................FAIL! rc= 10 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -055 blH51 TBL.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@2000 48 cold ................FAIL! rc= 7 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -060 blLI1 TBL.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -096 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -097 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -098 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -099 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 6 -100 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - -smH74 and blH74 failures are being investigated. -blH51 fails because it fails in clm3_6_28 (fixed in this commit). -Other failures are known. - - jaguar: - kraken: - lightning/pathscale: - bangkok/lf95: - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: clm3_6_28 - -Changes answers relative to baseline: CN mode only due to SAI decay factor - -=============================================================== -=============================================================== -Tag name: clm3_6_28 -Originator(s): oleson (Oleson Keith 1332 CGD) -Date: Tue Mar 17 07:03:12 MDT 2009 -One-line Summary: Fix permission denied error when reading surface dataset - -Purpose of changes: Change nf_open statement in UrbanInputMod.F90 - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Erik K. - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 ---- don't use getavu for nf_open - -Summary of testing: - - bluefire: All PASS except for: -013 smH74 TSM.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -1100 cold .......FAIL! rc= 10 -014 blH74 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 cold ........FAIL! rc= 4 -020 smE95 TSM.sh 4p_vodsrsc_h clm_std 19981231:NONE:1800 4x5 gx3v5 48 arb_ic ....................FAIL! rc= 10 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -051 blC61 TBL.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 48 cold .................FAIL! rc= 5 -053 erH51 TER.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@2000 10+38 cold .............FAIL! rc= 7 -054 brH51 TBR.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@2000 72+72 cold .............FAIL! rc= 6 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -060 blLI1 TBL.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -096 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -097 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -098 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -099 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 6 -100 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - -sm74, blH74, smI58 are known failures related to CN and are being investigated. -blC61 fails because clm3_6_27 fails (fixed in this tag). -Other failures are known. - - jaguar: - kraken: - lightning/pathscale: - bangkok/lf95: - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: clm3_6_27 - -Changes answers relative to baseline: bfb - -=============================================================== -=============================================================== -Tag name: clm3_6_27 -Originator(s): oleson (Oleson Keith 1332 CGD) -Date: Mon Mar 16 10:52:05 MDT 2009 -One-line Summary: Urban model changes and FGR12 fix - -Purpose of changes: Fix large urban saturation excess runoff. - Limit urban dew formation. - Change FGR12 diagnostic. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: Not tested - -Code reviewed by: K. Oleson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 ---- change eflx_fgr12 diagnostic -M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 ---- limit urban dew formation and calculate - pervious road qred over nlevsoi, not nlevurb -M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 ---- prevent large saturation excess due to - ponded ice - -Summary of testing: - - bluefire: All PASS tests_pretag_bluefire except TBL and : -013 smH74 TSM.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -1100 cold .......FAIL! rc= 10 -020 smE95 TSM.sh 4p_vodsrsc_h clm_std 19981231:NONE:1800 4x5 gx3v5 48 arb_ic ....................FAIL! rc= 10 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -048 smC61 TSM.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 -6 cold .................FAIL! rc= 10 -049 erC61 TER.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 10+38 cold ..............FAIL! rc= 5 -050 brC61 TBR.sh _sc_dh clm_urb^nl_urb_br 19981001:NONE:1800 1.9x2.5 gx1v5 -3+-3 cold ...........FAIL! rc= 5 -053 erH51 TER.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@2000 10+38 cold .............FAIL! rc= 7 -054 brH51 TBR.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@2000 72+72 cold .............FAIL! rc= 6 -056 smI58 TSMcnspinup.sh 17p_cnadspinupsc_dh 17p_cnexitspinupsc_dh 17p_cnsc_dh clm_std 19980115:NONEFAIL! rc=5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -096 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -097 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -098 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -099 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 6 -100 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - -smH74 and smI58 are CN-related tests that did not fail in clm3_6_25, but fail in clm3_6_26 and in this tag and -thus should be investigated further. -smC61, erC61, brC61 fail because of permission denied when reading surface dataset. This appears to be a test -suite problem only. - - jaguar: - kraken: - lightning/pathscale: - bangkok/lf95: - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: clm3_6_26 - -Changes answers relative to baseline: Urban answers change because of runoff fix. - Standard mode answers only change in FGR12 diagnostic. - -=============================================================== -=============================================================== -Tag name: clm3_6_26 -Originator(s): Peter Thornton -Date: 3/14/09 -One-line Summary: CN time step and restart file changes - -Purpose of changes: shorten CN restart file. Requires moving CLM to physical model timestep. - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: nonee - -Describe any substantial timing or memory changes: CLM restart file reduced in size by ~factor of 3. - -Code reviewed by: Forrest Hoffman - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNC13StateUpdate2Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNFireMod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNMRespMod.F90 - change q10 -M models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 - remove reference to retransn -M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNDecompMod.F90 - change q10 -M models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNrestMod.F90 - eliminate many CN variables -M models/lnd/clm/src/biogeochem/CNC13StateUpdate3Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 - change time step, and cleanup some variable names -M models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 - change time step -M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 - cleanup variable names -M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 - change time step -M models/lnd/clm/src/main/CNiniTimeVar.F90 - cleanup variable names -M models/lnd/clm/src/main/driver.F90 - change time step -M models/lnd/clm/src/main/clmtypeInitMod.F90 - cleanup variable names -M models/lnd/clm/src/main/pftdynMod.F90 - change time step -M models/lnd/clm/src/main/clm_time_manager.F90 - change time step -M models/lnd/clm/src/main/clmtype.F90 - cleanup variable names -M models/lnd/clm/src/main/histFldsMod.F90 - cleanup variable names - -Summary of testing: - - bluefire: - jaguar: - Ran the CLM test suite, with the following results: -smA74 TSM.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................PASS -erA74 TER.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .................PASS -brA74 TBR.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .................PASS -blA74 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................SKIPPED* -smA91 TSM.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ..........................PASS -erA91 TER.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .......................FAIL! rc= 7 (passes with 512 tasks) -brA91 TBR.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .......................FAIL! rc= 6 (passes with 512 tasks) -blA91 TBL.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ..........................SKIPPED* -smE92 TSM.sh 4p_vodsrsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 96 arb_ic ...................PASS -erE92 TER.sh 4p_vodsrsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 10+38 arb_ic ................PASS -brE92 TBR.sh 4p_vodsrsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 72+72 arb_ic ................PASS -blE92 TBL.sh 4p_vodsrsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 48 arb_ic ...................SKIPPED* -smEH2 TSM.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 1.9x2.5^0.9x1.25 USGS 48 arb_ic .......PASS -erEH2 TER.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 1.9x2.5^0.9x1.25 USGS 10+38 arb_ic ....PASS -brEH2 TBR.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 1.9x2.5^0.9x1.25 USGS 24+24 arb_ic ....PASS -blEH2 TBL.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 1.9x2.5^0.9x1.25 USGS 48 arb_ic .......SKIPPED* -smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 10+38 arb_ic ................FAIL! rc= 5 -brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................SKIPPED* -smH92 TSM.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 96 cold .............PASS -erH92 TER.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 10+38 cold ..........PASS -brH92 TBR.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 72+72 cold ..........PASS -blH92 TBL.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@2000 48 cold .............SKIPPED* -smJ62 TSM.sh 4p_casasc_dm clm_std 19981230:NONE:1800 1.9x2.5 gx1v5 96 startup ...............PASS -erJ62 TER.sh 4p_casasc_dm clm_std 19981230:NONE:1800 1.9x2.5 gx1v5 10+38 startup ............PASS -brJ62 TBR.sh 4p_casasc_dm clm_std 19981230:NONE:1800 1.9x2.5 gx1v5 72+72 startup ............PASS -blJ62 TBL.sh 4p_casasc_dm clm_std 19981230:NONE:1800 1.9x2.5 gx1v5 48 startup ...............SKIPPED* -smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v5 48 startup ....FAIL! rc= 10 -smJ74 TSM.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -1100 arb_ic ........PASS -erJ74 TER.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -10+-10 arb_ic ......PASS -brJ74 TBR.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_ic ........PASS -blJ74 TBL.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic .........SKIPPED* -smK92 TSM.sh 10p_dgvmsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 96 arb_ic ...................PASS -erK92 TER.sh 10p_dgvmsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 10+38 arb_ic ................PASS -brK92 TBR.sh 10p_dgvmsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 72+72 arb_ic ................PASS -blK92 TBL.sh 10p_dgvmsc_dm clm_std 19981230:NONE:1800 4x5 gx3v5 48 arb_ic ...................SKIPPED* -smLI2 TSM.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -erLI2 TER.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -brLI2 TBR.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -blLI2 TBL.sh _sc_dm clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................SKIPPED* -erP65 TSM_ccsmseq.sh ERS f19_g15 I ..........................................................PASS -erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................PASS kraken: - -Note: the tests that FAIL here are the same that FAIL on jaguar with clm3_6_25. - - lightning/pathscale: - bangkok/lf95: - breeze/gale/hail/gust/ifort: - -CLM tag used for the baseline comparison tests if applicable: - -Changes answers relative to baseline: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - q10 changes are climate changing. Time step changes are larger than roundoff, similar climate. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm3_6_25 -Originator(s): dlawren (Lawrence David 1384 CGD), erik (Kluzek Erik), tcraig (Craig Tony) -Date: Fri Mar 13 15:11:01 MDT 2009 -One-line Summary: Daylength control on Vcmax, 1%Lake,wetland,glacier in mksrfdat, remove ELEVATION in surface data file - -Purpose of changes: Include changes from Peter Thornton to include daylength control -on vcmax in photosynthesis scheme; Set minimum lake, wetland, and glacier area to 1% -to be more consistent with urban and to represent more lakes and wetlands; remove -temporary unused ELEVATION field from surface dataset - -Bugs fixed (include bugzilla ID): 877 (CN restart problem) - 911 (high PE count problem) - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: New global urban datasets 10x15 and 1.9x2.5 resolutions - -Describe any substantial timing or memory changes: None - -Code reviewed by: David Lawrence (code), Erik Kluzek (testing and build), Tony Craig (DecompInitMod.F90) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, mct, datm - - scripts to scripts4_090310 - datm7 to datm7_090229 - mct to MCT2_6_0_090308 - -List all files eliminated: None - -List all files added and what they do: - -A models/lnd/clm/test/system/config_files/tools__s ..... Optimized serial mode for tools - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/tools/mksurfdata/mkglcmec.F90 ..... correct bug in error check -M models/lnd/clm/tools/mksurfdata/mkglacier.F90 .... reduce min glacier frac from 5 to 1% -M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 .... remove ELEVATION field -M models/lnd/clm/tools/mksurfdata/mklanwat.F90 ..... reduce min lake,wetland frac from 5 to 1% -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ..... remove ELEVATION field -M models/lnd/clm/tools/mksurfdata/README ........... add documentation about being slow unless use OPT=TRUE in gmake -M models/lnd/clm/src/main/decompInitMod.F90 ........ Changes from Tony Craig to fix for high PE counts -M models/lnd/clm/src/main/clm_comp.F90 ............. daylength control on vcmax changes -M models/lnd/clm/src/main/driver.F90 ............... daylength control on vcmax changes -M models/lnd/clm/src/main/clmtypeInitMod.F90 ....... daylength control on vcmax changes -M models/lnd/clm/src/main/iniTimeConst.F90 ......... daylength control on vcmax changes -M models/lnd/clm/src/main/clmtype.F90 .............. daylength control on vcmax changes -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 daylength control on vcmax changes - -M models/lnd/clm/test/system/test_driver.sh ........ update to beta10, fix some issues on jaguar -M models/lnd/clm/test/system/input_tests_master .... do most mksurfdata testing optimized - change CN tests to cold-starts, change 1890 to 1870 - -M models/lnd/clm/bld/build-namelist ................ pass sim_year and maxpft in when determining default for finidat -M models/lnd/clm/bld/clm.cpl7.template ............. add in ignore logic like cam -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml . update input files - -Summary of testing: - - bluefire: All PASS except TBL and... -020 smE95 TSM.sh 4p_vodsrsc_h clm_std 19981231:NONE:1800 4x5 gx3v5 48 arb_ic ....................FAIL! rc= 10 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -052 smH51 TSM.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@1890 96 cold ................FAIL! rc= 8 -053 erH51 TER.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@1890 10+38 cold .............FAIL! rc= 5 -054 brH51 TBR.sh 17p_cnnsc_dh clm_std 19980115:NONE:1800 10x15 USGS@1890 72+72 cold .............FAIL! rc= 5 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -096 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -097 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -098 erP61 TSM_ccsmseq.sh ERS f19_g15 I4804 ......................................................FAIL! rc= 6 -099 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 6 -100 erP68 TSM_ccsmseq.sh ERS f19_g15 ICASA ......................................................FAIL! rc= 6 - jaguar: Limited testing... - lightning/pathscale: All PASS except TBL and... -002 smCA4 TSM.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 10 -003 erCA4 TER.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ......FAIL! rc= 5 -004 brCA4 TBR.sh _sc_ds clm_urb^nl_urb_br 19981001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic ...FAIL! rc= 5 -006 smOC4 TSM.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 10 -007 erOC4 TER.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_icFAIL! rc= 5 -008 brOC4 TBR.sh _vansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arb_iFAIL! rc= 5 -011 erA91 TER.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .......................FAIL! rc= 7 -012 brA91 TBR.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .......................FAIL! rc= 6 -019 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 7 -020 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 6 -024 erJ42 TER.sh 4p_casasc_dm clm_std 19981230:NONE:1800 10x15 USGS 10+38 startup ...............FAIL! rc= 7 -025 brJ42 TBR.sh 4p_casasc_dm clm_std 19981230:NONE:1800 10x15 USGS 72+72 startup ...............FAIL! rc= 6 -027 smK51 TSM.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -028 erK51 TER.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -029 brK51 TBR.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 72+72 arb_ic ...............FAIL! rc= 5 -032 erL51 TER.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 10+38 arb_ic ......................FAIL! rc= 7 -033 brL51 TBR.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 72+72 arb_ic ......................FAIL! rc= 6 -040 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -041 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -042 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804 ....................................................FAIL! rc= 5 - breeze/gale/hail/gust/ifort: All PASS except TBL - -CLM tag used for the baseline comparison tests if applicable: clm3_6_24 - -Changes answers relative to baseline: Yes - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change: similar climate - - Dave Lawrence ran a short simulation to show that answers do NOT change significantly - -=============================================================== -=============================================================== -Tag name: clm3_6_24 -Originator(s): oleson (Oleson Keith 1332 CGD) -Date: Mon Mar 9 21:01:47 MDT 2009 -One-line Summary: Fix urban testing and some history field changes - -Purpose of changes: Convert urban ascii files to netcdf to get urban testing to work. - Add rh_ref2m calculation for urban and change urban/rural humidity from specific to relative in - history files. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 672 (3.5.4-3.5.14 diffs) - 698 (cprnc bug gives false difference) - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 821 (mksurfdata for qtr deg) - 851 (abort when files non-exist on jaguar) - 877 (CN restart problem) - 883 (aerosol deposition not from atm) - 903 (problems in driver with open-MP on PGI) - 990 (illegal instruction) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - 1087 (let weights come from fsurdat file NOT finidat) - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: None - -Describe any changes made to the namelist: In namelist_defaults_clm.xml: - Change *.txt urban files to *.nc - Change aerosoldep_monthly_1990s_mean_1x1_urbanc_alpha_c090119.nc to - aerosoldep_monthly_1990s_mean_1x1_urbanc_alpha_c090114.nc - Change path for surfdata_0096x0144_090223_v2.nc from - lnd/clm2/surfdata/ to lnd/clm2/urbdata - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: Not tested - -Code reviewed by: K. Oleson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: A models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.nc - A models/lnd/clm/bld/urban_input/metropolis_fluxes.nc - A models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.nc - A models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.nc - A models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.nc - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/test/system/nl_files/nl_urb ---- Remove TSNOW from hist_fincl1, remove Q2M, Q2M_R, Q2M_U and - add RH2M, RH2M_R, RH2M_U to hist_fincl2 -M models/lnd/clm/test/system/nl_files/nl_urb_br --- Remove TSNOW from hist_fincl1 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ---- Change *.txt urban files to *.nc - Change aerosoldep_monthly_1990s_mean_1x1_urbanc_alpha_c090119.nc to - aerosoldep_monthly_1990s_mean_1x1_urbanc_alpha_c090114.nc - Change path for surfdata_0096x0144_090223_v2.nc from - lnd/clm2/surfdata/ to lnd/clm2/urbdata -M models/lnd/clm/src/main/clmtypeInitMod.F90 ---- delete q_ref2m_r, q_ref2m_u, and add rh_ref2m_r, rh_ref2m_u -M models/lnd/clm/src/main/clmtype.F90 ---- delete q_ref2m_r, q_ref2m_u, and add rh_ref2m_r, rh_ref2m_u -M models/lnd/clm/src/main/histFldsMod.F90 ---- delete Q2M_U, Q2M_R, and add RH2M_U, RH2M_R -M models/lnd/clm/src/biogeophys/UrbanInitMod.F90 ---- delete q_ref2m_u and add rh_ref2m_u -M models/lnd/clm/src/biogeophys/UrbanMod.F90 ---- delete q_ref2m_u and add calculation for rh_ref2m_u -M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 ---- delete q_ref2m_r and add rh_ref2m_r -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 ---- delete q_ref2m_r and add rh_ref2m_r - -Summary of testing: - - bluefire: All PASS except: -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -037 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 -041 blCA4 TBL.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -043 blCA8 TBL.sh _sc_ds clm_urb^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 5 -047 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -051 blC61 TBL.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 48 cold .................FAIL! rc= 5 -052 smH51 TSM.sh 17p_cnnsc_dh clm_std std 19980115:NONE:1800 10x15 USGS@1890 96 arb_ic ..........FAIL! rc= 1 -053 erH51 TER.sh 17p_cnnsc_dh clm_std std 19980115:NONE:1800 10x15 USGS@1890 10+38 arb_ic .......FAIL! rc= 1 -054 brH51 TBR.sh 17p_cnnsc_dh clm_std std 19980115:NONE:1800 10x15 USGS@1890 72+72 arb_ic .......FAIL! rc= 1 -055 blH51 TBL.sh 17p_cnnsc_dh clm_std std 19980115:NONE:1800 10x15 USGS@1890 48 arb_ic ..........FAIL! rc= 1 -057 smLI1 TSM.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -058 erLI1 TER.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -059 brLI1 TBR.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -060 blLI1 TBL.sh _sc_dh clm_std 19980101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -090 sm9J2 TSMext_ccsmseq_cam.sh ext_ccsm_seq_0.9x1.25_dh ext_ccsm_seq_cam 48 ....................FAIL! rc= 8 -091 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -092 erP61 TSM_ccsmseq.sh ERS f19_g1 701 (svn keyword) - 698 (cprnc bug gives false difference) - 717 (archiving bug -- only archive 1000 files at a time) - 1077 (Slow leak of land aquifer to Ocean runoff) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - - Known bugs that will NOT be resolved: 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Hydrology changes (Guo-Yue Niu water table below soil column, fff=7, -Qing micropore eqs (hksat and sucsat) and Qing microporosity --Simulation clm3_5niu5). - -Snow cover fraction (Niu and Yang); snow burial fraction for short vegetation -(Wang and Zeng); thermal and hydraulic organic soil (Lawrence); -snow compaction fix (Lawrence); snow T profile during layer splitting -fix (Lawrence); new FGR12 diagnostic. - -Ground emissivity now weighted combination (using fsno) of snow and soil -emissivity, sparse dense aerodynamic parameters from X. Zeng parameterization, -Liu (2004) saturated hydraulic conductivity and matric potential, -change saturation excess mechanism to only go to next to lowest layer, change -forcing height to min. of 40m. - -Lower volumetric soil water content to remove drainage spikes from some points -with high sand content. Change volumetric soil water content from 0.4 to 0.3. - -Incorporate hydrologically inactive deep soil (15 layers, 11-15 -hyrdologically inactive) and add mksoilcarb capability. -Change deep soil (layers 11-15) to dry rock type rather than wet sand -to reduce spinup time and for greater realism. - -Improved representation of snow-radiation interaction, including snow aging, -darkening from black carbon and dust, and vertically-resolved solar heating. - -Remove code pertaining to 40m minimum forcing height. Forcing height is now -whatever the atmospheric model provides plus z0+d of each pft. For offline -simulations this will be 30m+z0+d. - -saturation excess back to CLM3.5 parameterization. Sakaguchi litter resistance -Remove Qing Liu soil micropore functions and return to CLM3.5 formulations, -change decay factor for drainage to 2.5. remove Niu water table below soil -column formulation, frozen fraction of soil expression normalized per Zeng, -rsubmax=9.9 for drainage calculation, decay factor=0.5 for surface runoff -calculation, Zeng/Decker Richards equation mods, modified one-step solution -for soil moisture and qcharge for compatibility with Zeng/Decker Richards -mods per Swenson. - -Change input datm7 forcing so that Precip is over 6 hour interval, -times are corrected for Temp, Pres, Humid, and Wind data and linear -interpolation is used, and solar data is scaled by the cos(sol-zen angle). - -Set litter LAI = 0.5 and incorporate Swenson organic/mineral soil hk -percolation theory - -CASA changes from Forrest Hoffman: - - These changes add SOILPSI to the CASA' - configuration, correct units on C-LAMP carbon pool type fluxes, and reclassify - microbial pools as soil type pools. I believe this includes all modifications - between bgcmip04_clm3_expa_60 and bgcmip08_clm3_expa_72. - -Summary of CN and Btran changes from Sam Levis: - -- CanopyFluxes modification in the calculation of btran so that it equals 0 in soil layers with temperature <=-2 C. -- CN mods recommended by Peter Thornton and the BGCWG during the bgc development phase of the last few months. - -Grassland AND CROP optical properties changes from Keith Oleson: - -New pft physiology file was created: - -pft-physiology.c081002 - -Description of changes to physiology file: - -New leaf and stem optical properties (VIS and NIR reflectance and transmittance) -were derived for grasslands and crops (pfts 12-16) from full optical range -spectra of measured optical properties (Asner et al. (RSE 1998). - -New properties are: - - Leaf Stem - VIS NIR VIS NIR -Reflectance 0.11 0.35 0.31 0.53 -Transmittance 0.05 0.34 0.12 0.25 - - -Describe any changes made to build system: - - Add SNICAR_FRC and CARBON_AERO ifdef tokens - - DEFINE option SNICAR_FRC: enables second radiative transfer calculation of pure snow for radiative forcing estimation - - in configure use options -carbon_aero and -snicar_frc - -Describe any changes made to the namelist: Add fsnowoptics, fsnowaging, faerdep - -Added namelist variables fsnowoptics, fsnowaging, and faerdep, which point to files containing, respectively, snow/aerosol optical properties, snow aging parameters, and global aerosol deposition file. THESE FILES ARE REQUIRED. - -List any changes to the defaults for the boundary datasets: - - finidat files developed, all new fsurdat files, new pft-physiology, - files for T62, new organic files, new files for SNICAR (fsnowoptics, - fsnowaging, faerdep), fix some inconsistencies with fraction files, - get topo files setup correctly, get all files for 4x5 and 2x2.5 resolution - -Describe any substantial timing or memory changes: Yes - 20% slower because of SNICAR and slower because of deep soil - -Code reviewed by: Keith Oleson, Mark Flanner, Dave Lawrence, - Peter Thornton, Sam Levis, Sean Swenson - -List any svn externals directories updated (csm_share, mct, etc.): scripts, - drv, datm7, socn, sice, sglc, csm_share, timing, pio, cprnc - -+scripts scripts4_090112 -+models/drv/seq_mct drvseq3_0_04 -+models/atm/datm7 datm7_090107 -+models/ocn/socn stubs1_1_01/socn -+models/ice/sice stubs1_1_01/sice -+models/glc/sglc stubs1_1_01/sglc -+models/csm_share share3_090112 -+models/utils/timing timing_081028 -+models/utils/pio pio28_prod/pio -+models/lnd/clm/tools/cprnc cprnc_081022 - -List all files eliminated: - -D models/lnd/clm/test/system/tests_pretag_bluevista - remove -D models/lnd/clm/bld/scpDefaultNamelist.pl ---------- replace with listDefaultNamelist.pl -D models/lnd/clm/bld/run-frost.csh ------------------ remove as can use cpl7 -D models/lnd/clm/tools/interpinic/clmi_1999-01-02_10x15_c070330.nc -- new file - -List all files added and what they do: - -A + models/lnd/clm/test/system/nl_files/clm_organic ------------ test organic -A + models/lnd/clm/tools/mksurfdata/mkorganic.F90 -------------- add organic to surfdat -A + models/lnd/clm/tools/mksurfdata/mksurfdata.pl -------------- create all fsurdat files -A + models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl ---------- interpolate aerosol deposition -A + models/lnd/clm/tools/ncl_scripts/clmi_increasesoillayer.ncl interpolate old clmi files to 15 soil levels -A + models/lnd/clm/tools/interpinic/clmi.IQ.1953-01-01_10x15_USGS_simyr2000_c081202.nc - ---------------- new 15 layer file to test interpolation -A + models/lnd/clm/tools/interpinic/runinit_ibm.csh ------------ create all finidat files -A + models/lnd/clm/bld/listDefaultNamelist.pl ------------------ list inputdata files needed -A + models/lnd/clm/src/main/organicFileMod.F90 ----------------- organic soil -A + models/lnd/clm/src/main/aerdepMod.F90 ---------------------- read in aerosol deposition -A + models/lnd/clm/src/biogeophys/SNICARMod.F90 ---------------- SNICAR model -A + Quickstart.GUIDE ------------------------------------------- Quickstart to cpl7 scripts - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>>>>>>>>>>>> Add compile_only option, fix smp/spmd, change most ->>>>>>>>>>>>>>>>>>>>>>>>> tests to 4x5 resolution, update ccsm version, ->>>>>>>>>>>>>>>>>>>>>>>>> remove bluevista, change to clm_qian inputdata ->>>>>>>>>>>>>>>>>>>>>>>>> add cold start type - -M models/lnd/clm/test/system/TCB.sh -M models/lnd/clm/test/system/config_files/4p_vodsrsc_dm -M models/lnd/clm/test/system/config_files/4p_vodsrsc_do -M models/lnd/clm/test/system/config_files/scam_ds ----- fix defaults for scam -M models/lnd/clm/test/system/config_files/17p_cnnsc_o -M models/lnd/clm/test/system/config_files/4p_casasc_dm -M models/lnd/clm/test/system/config_files/10p_dgvmsc_o -M models/lnd/clm/test/system/config_files/4p_casasc_do -M models/lnd/clm/test/system/config_files/4p_casasc_o -M models/lnd/clm/test/system/config_files/17p_vodsrsc_o -M models/lnd/clm/test/system/config_files/17p_cnnsc_dm -M models/lnd/clm/test/system/config_files/17p_cnnsc_do -M models/lnd/clm/test/system/config_files/10p_dgvmsc_dm -M models/lnd/clm/test/system/config_files/10p_dgvmsc_do -M models/lnd/clm/test/system/config_files/17p_vodsrsc_dm -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_64x128_s -M models/lnd/clm/test/system/config_files/17p_vodsrsc_do -M models/lnd/clm/test/system/config_files/4p_vodsrsc_o -M models/lnd/clm/test/system/TSMncl_tools.sh -M models/lnd/clm/test/system/CLM_compare.sh -M models/lnd/clm/test/system/TBL.sh -M models/lnd/clm/test/system/TSM_ccsmseq.sh -M models/lnd/clm/test/system/TSMext_ccsmseq_cam.sh -M models/lnd/clm/test/system/tests_pretag_jaguar -M models/lnd/clm/test/system/tests_posttag_kraken -M models/lnd/clm/test/system/tests_pretag_bluefire -M models/lnd/clm/test/system/README.testnames -M models/lnd/clm/test/system/tests_posttag_breeze -M models/lnd/clm/test/system/tests_pretag_bangkok -M models/lnd/clm/test/system/TBR.sh -M models/lnd/clm/test/system/TCBtools.sh -M models/lnd/clm/test/system/TER.sh -M models/lnd/clm/test/system/test_driver.sh -M models/lnd/clm/test/system/tests_posttag_purempi_regression -M models/lnd/clm/test/system/mknamelist -M models/lnd/clm/test/system/tests_posttag_hybrid_regression -M models/lnd/clm/test/system/TCT_ccsmseq.sh -M models/lnd/clm/test/system/TCSruncase.sh -M models/lnd/clm/test/system/TSMpergro.sh -M models/lnd/clm/test/system/nl_files/clm_per -M models/lnd/clm/test/system/nl_files/clm_urb -M models/lnd/clm/test/system/nl_files/clm_std -M models/lnd/clm/test/system/nl_files/clm_ndepdyn -M models/lnd/clm/test/system/nl_files/clm_pftdyn -M models/lnd/clm/test/system/nl_files/clm_per0 -M models/lnd/clm/test/system/TSMcnspinup.sh -M models/lnd/clm/test/system/input_tests_master -M models/lnd/clm/test/system/TSMtools.sh -M models/lnd/clm/test/system/TSMruncase.sh -M models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh -M models/lnd/clm/test/system/TSCext_ccsmseq_scam.sh -M models/lnd/clm/test/system/tests_posttag_lightning -M models/lnd/clm/test/system/CLM_runcmnd.sh -M models/lnd/clm/test/system/TBLtools.sh -M models/lnd/clm/test/system/TSM.sh - ->>>>>>>>>>>>>>>>>>>>>>>>> Add organic add option to output as double precision ->>>>>>>>>>>>>>>>>>>>>>>>> be more careful with averging add error checking -M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 -M models/lnd/clm/tools/mksurfdata/mksurfdata.globalurban -M models/lnd/clm/tools/mksurfdata/mksurfdata.regional -M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 -M models/lnd/clm/tools/mksurfdata/Makefile ----------- -Kieee for pgi -M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 -M models/lnd/clm/tools/mksurfdata/Srcfiles -M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist - ->>>>>>>>>>>>>>>>>>>>>>>>> 15 levels for urban -MM models/lnd/clm/tools/ncl_scripts/generate_ascii_avg_urbanparam_file_p7.ncl -M models/lnd/clm/tools/ncl_scripts/README - ->>>>>>>>>>>>>>>>>>>>>>>>> Change for 15 levels and new variables/dims on dataset -M models/lnd/clm/tools/interpinic/interpinic.F90 -M models/lnd/clm/tools/interpinic/interpinic.runoptions -M models/lnd/clm/tools/interpinic/Srcfiles -M models/lnd/clm/tools/interpinic/Filepath -M models/lnd/clm/tools/interpinic/Makefile - ->>>>>>>>>>>>>>>>>>>>>>>>> 10x15 resolution, start to resolve domain checking bug -M models/lnd/clm/tools/mkgriddata/mkgriddata.namelist -M models/lnd/clm/tools/mkgriddata/mkgriddata.F90 -M models/lnd/clm/tools/mkgriddata/domainMod.F90 -M models/lnd/clm/tools/mkgriddata/creategridMod.F90 -M models/lnd/clm/tools/mkgriddata/Makefile - ->>>>>>>>>>>>>>>>>>>>>>>>> Get grid data from grid files rather than frac files -M models/lnd/clm/tools/mkdatadomain/mkdatadomain.namelist -M models/lnd/clm/tools/mkdatadomain/addglobal.F90 -M models/lnd/clm/tools/mkdatadomain/create_domain.F90 -M models/lnd/clm/tools/mkdatadomain/Makefile - ->>>>>>>>>>>>>>>>>>>>>>>>> minor changes to build, new datasets for build-namelist -M models/lnd/clm/bld/configure --- add -snicar_frc and -carbon_aero, add sglc, remove timing for cpl7 -M models/lnd/clm/bld/queryDefaultNamelist.pl --- minor change -M models/lnd/clm/bld/config_files/Makefile.in -- add HAVE_GETTIMEOFDAY for new timing, more consistent with cpl7 build -M models/lnd/clm/bld/config_files/config_definition.xml -- add snicar_frc and carbon_aero -M models/lnd/clm/bld/clm.cpl7.template -- simplify update for new scripts -M models/lnd/clm/bld/README ------------- update info. -M models/lnd/clm/bld/namelist_files/namelist_definition.xml ----- add new namelist items remove irad -M models/lnd/clm/bld/namelist_files/datm.streams.template.xml --- new Qian datasets -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- new defaults -M models/lnd/clm/bld/build-namelist - ->>>>>>>>>>>>>>>>>>>>>>>>> change default resolution to 4x5 remove irad -M models/lnd/clm/bld/run-pc.csh -M models/lnd/clm/bld/run-ibm.csh -M models/lnd/clm/bld/run-lightning.csh - ->>>>>>>>>>>>>>>>>>>>>>>>> New 15 layer urban single point datasets -M models/lnd/clm/bld/urban_input/metropolis_fluxes.txt -M models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.txt -M models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.txt -M models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.txt - ->>>>>>>>>>>>>>>>>>>>>>>>> Code changes documented above -M models/lnd/clm/src/biogeochem/CASASummaryMod.F90 -M models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 -M models/lnd/clm/src/biogeochem/CNC13StateUpdate2Mod.F90 -M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 -M models/lnd/clm/src/biogeochem/DGVMEcosystemDynMod.F90 -M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90 -M models/lnd/clm/src/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/biogeochem/CASAMod.F90 -M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90 -M models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 -M models/lnd/clm/src/biogeochem/DGVMMod.F90 -M models/lnd/clm/src/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/biogeochem/CNC13StateUpdate3Mod.F90 -M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 -M models/lnd/clm/src/biogeochem/C13SummaryMod.F90 -M models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/biogeochem/CNC13FluxMod.F90 -M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 -M models/lnd/clm/src/main/inicFileMod.F90 -M models/lnd/clm/src/main/clm_varcon.F90 -M models/lnd/clm/src/main/clm_varpar.F90 -M models/lnd/clm/src/main/CNiniTimeVar.F90 -M models/lnd/clm/src/main/clm_comp.F90 -M models/lnd/clm/src/main/driver.F90 -M models/lnd/clm/src/main/ncdio.F90 -M models/lnd/clm/src/main/fileutils.F90 -M models/lnd/clm/src/main/clmtypeInitMod.F90 -M models/lnd/clm/src/main/pftdynMod.F90 -M models/lnd/clm/src/main/iniTimeConst.F90 -M models/lnd/clm/src/main/histFileMod.F90 -M models/lnd/clm/src/main/clm_atmlnd.F90 -M models/lnd/clm/src/main/restFileMod.F90 -M models/lnd/clm/src/main/controlMod.F90 -M models/lnd/clm/src/main/initSurfAlbMod.F90 -M models/lnd/clm/src/main/clm_time_manager.F90 -M models/lnd/clm/src/main/filterMod.F90 -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/main/lnd_comp_mct.F90 -M models/lnd/clm/src/main/CASAiniTimeVarMod.F90 -M models/lnd/clm/src/main/areaMod.F90 -M models/lnd/clm/src/main/clmtype.F90 -M models/lnd/clm/src/main/histFldsMod.F90 -M models/lnd/clm/src/main/mkarbinitMod.F90 -M models/lnd/clm/src/riverroute/RtmMod.F90 -M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/biogeophys/BiogeophysicsLakeMod.F90 -M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/biogeophys/DriverInitMod.F90 -M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 - ->>>>>>>>>>>>>>>>>>>>>>>>> update documentation -M README -------------- update information -M KnownBugs ----------- add info on new known bugs - -Summary of testing: - - bluefire: All PASS except TBL and ... - -031 smF96 TSM.sh 17p_vodsrsc_m clm_std 19981231:NONE:1800 4x5 gx3v5 48 arb_ic ...................FAIL! rc= 10 -036 smF96 TSM.sh 17p_vodsrsc_m clm_std 19981231:NONE:1800 4x5 gx3v5 48 arb_ic ...................FAIL! rc= 2 -013 blCA4 TBL.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -015 blCA8 TBL.sh _sc_ds clm_urb^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 5 -019 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -020 smC61 TSM.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 -6 arb_ic ...............FAIL! rc= 10 -021 erC61 TER.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 10+38 arb_ic ............FAIL! rc= 5 -022 brC61 TBR.sh _sc_dh clm_urb^nl_urb_br 19981001:NONE:1800 1.9x2.5 gx1v5 -3+-3 arb_ic .........FAIL! rc= 5 -023 blC61 TBL.sh _sc_dh clm_urb^nl_urb 19981001:NONE:1800 1.9x2.5 gx1v5 48 arb_ic ...............FAIL! rc= 4 -024 smH91 TSM.sh 17p_cnnsc_dh clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 96 startup ..........FAIL! rc= 10 -025 erH91 TER.sh 17p_cnnsc_dh clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 10+38 startup .......FAIL! rc= 5 -026 brH91 TBR.sh 17p_cnnsc_dh clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 72+72 startup .......FAIL! rc= 5 -027 blH91 TBL.sh 17p_cnnsc_dh clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 48 startup ..........FAIL! rc= 4 -029 erH52 TER.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 10+38 arb_ic ...........FAIL! rc= 13 -030 brH52 TBR.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 72+72 arb_ic ...........FAIL! rc= 11 -031 blH52 TBL.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 48 arb_ic ..............FAIL! rc= 7 - - lightning/pathscale: all PASS except TBL and ... - -009 blCA4 TBL.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -013 blCA8 TBL.sh _sc_ds clm_urb^nl_urb 19971230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 5 -017 blOC4 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 5 -019 erA91 TER.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .......................FAIL! rc= 7 -020 brA91 TBR.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -3+-3 arb_ic .......................FAIL! rc= 6 -021 blA91 TBL.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -6 arb_ic ..........................FAIL! rc= 5 -027 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 7 -028 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 6 -029 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 5 -031 smH52 TSM.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 96 arb_ic ..............FAIL! rc= 10 -032 erH52 TER.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 10+38 arb_ic ...........FAIL! rc= 5 -033 brH52 TBR.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 72+72 arb_ic ...........FAIL! rc= 5 -034 blH52 TBL.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 48 arb_ic ..............FAIL! rc= 4 -036 erK51 TER.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 7 -037 brK51 TBR.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 72+72 arb_ic ...............FAIL! rc= 6 -001 smL51 TSM.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 96 arb_ic .........................FAIL! rc= 10 -002 erL51 TER.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 10+38 arb_ic ......................FAIL! rc= 5 -003 brL51 TBR.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 72+72 arb_ic ......................FAIL! rc= 5 -004 blL51 TBL.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 48 arb_ic .........................FAIL! rc= 4 -005 sm674 TSMtools.sh mkgriddata tools__ds singlept .............................................FAIL! rc= 6 -006 sm774 TSMtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 6 -007 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 4 -010 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -011 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -012 erP91 TSM_ccsmseq.sh ERS f45_g35 ICN4804Q ...................................................FAIL! rc= 4 - - jaguar: ALL PASS except TBL and .... - -001 smA74 TSM.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 10 -002 erA74 TER.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .................FAIL! rc= 5 -003 brA74 TBR.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .................FAIL! rc= 5 -013 smE32 TSM.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 64x128^360x720 USGS 48 arb_ic .........FAIL! rc= 10 -014 erE32 TER.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 64x128^360x720 USGS 10+38 arb_ic ......FAIL! rc= 5 -015 brE32 TBR.sh 4p_vodsrsc_dm clm_std 19981231:NONE:3600 64x128^360x720 USGS 24+24 arb_ic ......FAIL! rc= 5 -017 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -018 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 10+38 arb_ic ................FAIL! rc= 5 -019 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -021 smH92 TSM.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 96 startup ..........FAIL! rc= 10 -022 erH92 TER.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 10+38 startup .......FAIL! rc= 5 -023 brH92 TBR.sh 17p_cnnsc_dm clm_ndepdyn 19980101:NONE:1800 4x5 gx3v5@1890 72+72 startup .......FAIL! rc= 5 -029 smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v5 48 startup ....FAIL! rc= 10 -030 smJ74 TSM.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -1100 arb_ic ........FAIL! rc= 10 -031 erJ74 TER.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -10+-10 arb_ic ......FAIL! rc= 5 -032 brJ74 TBR.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_ic ........FAIL! rc= 5 -038 smL62 TSM.sh _sc_m clm_std 19980101:NONE:1800 1.9x2.5 gx1v5 -10 startup .....................FAIL! rc= 10 -039 erL62 TER.sh _sc_m clm_std 19980101:NONE:1800 1.9x2.5 gx1v5 -5+-5 startup ...................FAIL! rc= 5 -040 brL62 TBR.sh _sc_m clm_std 19980101:NONE:1800 1.9x2.5 gx1v5 -10+-10 startup .................FAIL! rc= 5 - - breeze/gale/hail/gust/ifort: All PASS except TBL and... - - bangkok: All PASS except TBL and.. - -005 smA74 TSM.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 10 -006 erA74 TER.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .................FAIL! rc= 5 -007 brA74 TBR.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -5+-5 arb_ic .................FAIL! rc= 5 -009 smD91 TSM.sh _persc_dh clm_per 19981231:NONE:1200 4x5 gx3v5 144 startup .....................FAIL! rc= 10 -010 erD91 TER.sh _persc_dh clm_per 19981231:NONE:1200 4x5 gx3v5 72+72 startup ...................FAIL! rc= 5 -013 smCA4 TSM.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 10 -014 erCA4 TER.sh _sc_ds clm_urb^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -45+-45 arb_ic ......FAIL! rc= 5 -015 brCA4 TBR.sh _sc_ds clm_urb^nl_urb_br 19981001:NONE:3600 1x1_camdenNJ navy -10+-10 arb_ic ...FAIL! rc= 5 -017 smOC4 TSM.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 10 -018 erOC4 TER.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_icFAIL! rc= 5 -019 brOC4 TBR.sh _vansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arb_iFAIL! rc= 5 -021 smNB4 TSM.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 10 -022 erNB4 TER.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 59+100 arb_icFAIL! rc= 5 -023 brNB4 TBR.sh _mexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arb_FAIL! rc= 5 -025 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -026 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -027 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -029 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 -030 smH52 TSM.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 96 arb_ic ..............FAIL! rc= 10 -031 erH52 TER.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 10+38 arb_ic ...........FAIL! rc= 5 -032 brH52 TBR.sh 17p_cnnsc_dm clm_std 19980115:NONE:1800 10x15 USGS@1890 72+72 arb_ic ...........FAIL! rc= 5 -038 smK51 TSM.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -039 erK51 TER.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -040 brK51 TBR.sh 10p_dgvmsc_dh clm_std 19981230:NONE:1800 10x15 USGS 72+72 arb_ic ...............FAIL! rc= 5 -042 smL51 TSM.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 96 arb_ic .........................FAIL! rc= 10 -043 erL51 TER.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 10+38 arb_ic ......................FAIL! rc= 5 -044 brL51 TBR.sh _sc_dh clm_std 19980115:NONE:1800 10x15 USGS 72+72 arb_ic ......................FAIL! rc= 5 -046 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 19980115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 -047 smL74 TSM.sh _sc_s clm_std 19980101:NONE:1800 1x1_brazil navy -10 arb_ic ....................FAIL! rc= 10 -048 erL74 TER.sh _sc_s clm_std 19980101:NONE:1800 1x1_brazil navy -5+-5 arb_ic ..................FAIL! rc= 5 -049 brL74 TBR.sh _sc_s clm_std 19980101:NONE:1800 1x1_brazil navy -10+-10 arb_ic ................FAIL! rc= 5 -051 sm654 TSMtools.sh mkgriddata tools__ds namelist .............................................FAIL! rc= 6 -052 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -053 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -057 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 -Changes answers relative to baseline: Yes! Changes climate - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change (new climate) - - configuration (CPP ifdefs): All - - build-namelist command (or complete namelist): - - MSS location of control simulations used to validate new climate: - - Grass optical properties: /OLESON/csm/clm36sci16_clm3_6_11shklit0_5sfc_goa - - ccsm4_0_beta05: /CCSM/csm/b40.018 - - URL for LMWG diagnostics output used to validate new climate: - -ccsm4_0_beta05 (with clm36sci27_clm3_6_14) - -http://www.cgd.ucar.edu/cdp/mai/ccsmweb/b40.018-b40.017/setsIndex.html - -http://www.cgd.ucar.edu/tss/clm/diagnostics/clm4.0_dev/clm36sci16_clm3_6_11shklit0_5sfc_goa-clm36sci16_clm3_6_11shklit0_5sfca/setsIndex.html - -=============================================================== -=============================================================== -Tag name: clm3_6_14 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Fri Oct 10 11:32:57 MDT 2008 -One-line Summary: Fix some global urban issues, fix pftdyn, really get compile-only option working in testing - -Purpose of changes: Fix column and pft averaging for urban (crtical for coupling to cam) (from Keith) - Fix Qanth (was wasteheat previously) (from Keith) - Fix so that pftdyn works (fix from Sam) - Really get the compile-only option working in test-suite - (so that doesn't re-compile, but does re-run, when sent again) - -Bugs fixed (include bugzilla ID): 826 (pftdyn) - -Known bugs (include bugzilla ID): 251 (TwoStream), 672 (3.5.4-3.5.14 diffs), 830 (missing C-LAMP mods) - 680 (t0 precip diff for seq-ccsm), 789 (pt sims slower than offline) - 698 (cprnc bug gives false difference), 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 833 (bug with cam in ccsm4_0_alpha37), 722 (threading slow) - 832 (problem with cice bn in ccsm4_0_alpha37) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - -Known bugs that will NOT be resolved: 512 (mksurf on PGI), 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, oleson, slevis (Sam provided pftdyn fix, and Keith provided urban fixes) - -List any svn externals directories updated (csm_share, mct, etc.): scripts and drv - - scripts to scripts4_081009 - drv to drvseq2_0_33 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>> Change so that pftdyn will work, do urban averaging, and fix Qanth - M models/lnd/clm/src/main/clm_atmlnd.F90 -------------- Make averaging take into account urban (critical for global urban modeling) - M models/lnd/clm/src/main/histFldsMod.F90 ------------- Add urban scaling, fix Qanth - M models/lnd/clm/src/main/filterMod.F90 --------------- Change urban filter to include pftwgt>0 - M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 -- Change filter_vegsol to include pftwgt>0 ->>>>>>>>>>> Fix so that compile-only option leaves compiled program there, doesn't recompile, but does rerun - M models/lnd/clm/test/system/TCB.sh - M models/lnd/clm/test/system/TSMncl_tools.sh - M models/lnd/clm/test/system/TBL.sh - M models/lnd/clm/test/system/TSM_ccsmseq.sh - M models/lnd/clm/test/system/TSMext_ccsmseq_cam.sh - M models/lnd/clm/test/system/TBR.sh - M models/lnd/clm/test/system/TCBtools.sh - M models/lnd/clm/test/system/test_driver.sh - M models/lnd/clm/test/system/TER.sh - M models/lnd/clm/test/system/TCT_ccsmseq.sh - M models/lnd/clm/test/system/TSMpergro.sh - M models/lnd/clm/test/system/TSMcnspinup.sh - M models/lnd/clm/test/system/TSMtools.sh - M models/lnd/clm/test/system/TSMruncase.sh - M models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh - M models/lnd/clm/test/system/CLM_runcmnd.sh - M models/lnd/clm/test/system/TSM.sh - -Summary of testing: - - bluefire: All PASS except -071 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - jaguar: All PASS - bangkok/lf95: All PASS except -028 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 5 -054 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 6 -055 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - breeze/gale/hail/gust/ifort: All PASS - -pftdyn TBL test fails, because pftdyn did not work in previous tag. -cam and scam tests fail because of bugs 832 and 833 in ccsm4_0_alpha37 - -CLM tag used for the baseline comparison tests if applicable: clm3_6_13 - -Changes answers relative to baseline: No -- bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_6_13 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Wed Oct 1 13:33:36 MDT 2008 -One-line Summary: Update to new version of cpl7 scripts and build, update externals for versions needed for clm36sci branch, add new CASA tests - -Purpose of changes: Update to new version of cpl7 scripts and build. - Update externals for versions needed on clm36sci branch. - Add new CASA tests. - Add $CLM_ACCOUNT as option to test_driver.sh - Add single point capability to cpl7 scripts. - Add CLM_DEMAND, CLM_BLD_NL_OPTIONS as options to cpl7 scripts. - Some code changes from Keith Oleson to fix a CASA startup problem. - -Code changes from Keith Oleson - -1. Volumetric soil water check in BiogeophysRestMod changed so that it accounts for ponded ice/water -that may be present in surface layer. If volumetric soil water is above saturation, h2osoi_liq -and h2osoi_ice are reduced according to their proportion of total water/ice. Both h2osoi_liq -and h2osoi_ice are limited to be no lower than watmin (currently 0.01_r8 mm). All this done for -soil points only. - -2. In SoilHydrologyMod, variable su changed to: - - su = max(0._r8,(s1-fcov(c)) / max(0.01_r8,1._r8-fcov(c)) - -to account for the fact that fcov could be one and hence divide by zero could have occurred. -Also, the factor "1._r8" multiplying fcov in the numerator was removed. - -3. watmin made a global parameter available from clm_varcon - -Bugs fixed (include bugzilla ID): 805 (too much output in build-streams), 801 (G95 in csm_Share), - 786 (dshr_map bug), 834 (CASA startup bug), - -Known bugs (include bugzilla ID): 251 (TwoStream), 672 (3.5.4-3.5.14 diffs), - 680 (t0 precip diff for seq-ccsm), - 698 (cprnc bug gives false difference), 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 826 (pftdyn), 833 (bug with cam in ccsm4_0_alpha37) - 832 (problem with cice bn in ccsm4_0_alpha37) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - -Known bugs that will NOT be resolved: 512 (mksurf on PGI), 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Describe any changes made to build system: Update to new ccsm4_0_alpha37 scripts - - New options in cpl7 scripts: CLM_DEMAND, CLM_BLD_NL_OPTIONS - - CLM_DEMAND: List of output variables to require be set in namelist - For example, set to "furbinp" to use urban grid. - CLM_BLD_NL_OPTIONS: List of options to pass to clm build-namelist. - - New grid in cpl7 scripts: pt1_pt1 (also set CLM_PT1_NAME) for single point sims - - Add ability to set "none" in clm build-namelist -clm_dmand option. - -Quickstart to new cpl7 scripts... - - New cpl7 namelists now do two things for you. - - Add a ton of error checking at each step -- so it won't let you do something you aren't allowed to - - Only show you the variables that you could actually set in your case. - - To accomplish this we use XML files rather than cshell env files. But, the - operation sequence is similar with options only changed slightly. - - cd scripts - ./create_newcase -help # get help on how to run create_newcase - ./create_newcase -case testI -mach bluefire -res f19_g15 -compset I # create new "I" case for bluefire at 1.9x2.5_gx1v5 res - # "I" case is clm active, datm7, and inactive ice/ocn - cd testI - ./xmlchange -help # Get help on editor for XML files - ./xmlchange env_conf.xml env_mach_pes # Edit configure files if needed - configure -case # create scripts - ./xmlchange env_build.xml # Edit build files if needed - testI.build # build model and create namelists - ./xmlchange env_run.xml # Edit run files if needed - bsub < testI.run # submit script - # (NOTE: edit env_run.xml to set RESUBMIT to number of times to automatically resubmit) - - Note that the -skip_rundb option to create_newcase no longer needs the argument of "NONE". - Syntax of create_tests changed to only one form. - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: erik, oleson and dlawren (source code changes) - -List any svn externals directories updated (csm_share, mct, etc.): drv, csm_share, datm7, and scripts - - csm_share, datm7 and scripts include changes required for the clm36sci branch. - - scripts to scripts4_080930 - drv to drvseq2_0_32 - datm7 to datm7_080926 - csm_share to share3_080929 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>> Add $CLM_ACCOUNT env var, change tests around, update to ccsm4_0_alpha37 - add some more CASA tests. -M models/lnd/clm/test/system/README -M models/lnd/clm/test/system/tests_pretag_bluefire -M models/lnd/clm/test/system/tests_pretag_jaguar -M models/lnd/clm/test/system/tests_posttag_kraken -M models/lnd/clm/test/system/tests_posttag_hybrid_regression -M models/lnd/clm/test/system/tests_posttag_purempi_regression -M models/lnd/clm/test/system/test_driver.sh ------------------ Add $CLM_ACCOUNT env var - update to ccsm4_0_alpha37 -M models/lnd/clm/test/system/input_tests_master -------------- Add CASA 1.9x2.5 tests -M models/lnd/clm/test/system/TSMext_ccsmseq_cam.sh ----------- Separate call to cice bn -M models/lnd/clm/test/system/TCT_ccsmseq.sh -M models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh ----------- Need to set threads/tasks -M models/lnd/clm/test/system/TSM.sh -------------------------- Remove old namelist name - ->>>>>>>>>>>>>> Update for new scripts -M models/lnd/clm/bld/clm.cpl7.template ----------------------- Straighten out clm_demand - Add new env vars. Remove prestaging. -M models/lnd/clm/bld/namelist_files/namelist_definition.xml -- Update to alpha37 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml- Add file for clm36sci branch -M models/lnd/clm/bld/build-namelist -------------------------- Allow clm_demand to include none. - ->>>>>>>>>>>>>> These are Keith's changes to fix bug 834. They do make it possible for - answers to change, but in most cases they don't. It allows code to - startup correctly for situations it might fail in, and sets a mininum - value in SoilHydrologyMod to guard against divide by zero. This would - change answers when amount of ice -- fcov > 0.99 -- which would be rare. -M models/lnd/clm/src/main/clm_varcon.F90 -M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 - -Summary of testing: - - bluefire: All PASS except -042 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -043 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -044 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -045 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -P -046 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 -079 blL61 TBL.sh _sc_h clm_std 19980101:NONE:1800 1.9x2.5 gx1v5 -10 startup .....................FAIL! rc= 7 -083 blL62 TBL.sh _sc_m clm_std 19980101:NONE:1800 1.9x2.5 gx1v5 -10 startup .....................FAIL! rc= 7 -107 brJ74 TBR.sh 4p_casasc_ds clm_std 10001230:NONE:3600 1x1_tropicAtl test -3+-3 arb_ic ........FAIL! rc= 11 -127 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - kraken: All PASS except all TER and TBR tests fail, because of a script problem and ends early - lightning/pathscale: All PASS except -022 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -023 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -024 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -025 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -026 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 -050 erP11 TSM_ccsmseq.sh ERS T31_g35 ICN4804 ....................................................FAIL! rc= 5 - bangkok/lf95: All PASS except -025 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -026 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -027 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -028 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 4 -029 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 -054 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 .......................FAIL! rc= 6 -055 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - breeze/gale/hail/gust/ifort: All PASS - -pftdyn tests fail because of previous problem (bug 826). ext_ccsmseq_ tests fail -because of problem with ccsm4_0_alpha37 (bug 833). - -CLM tag used for the baseline comparison tests if applicable: clm3_6_12 - -Changes answers relative to baseline: Only for some cases, see tests 079 and 083 on -bluefire above - -=============================================================== -=============================================================== -Tag name: clm3_6_12 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Sun Sep 21 10:04:22 MDT 2008 -One-line Summary: Fix restarts for urban, add capability to do global urban experiments, add new forcing height changes, remove cpl6 - -Purpose of changes: Fix restarts for urban model as well as adding capability to do global urban experiments. - It also adds the new forcing height changes into the trunk. - And we remove all the cpl6 #ifdef's, source codes, and associated scripts and script options. - Also fix some memory leaks found in MCT. - Add testing for kraken. - Fix branch tests so they change the start_ymd. - Add some more tests for CASA. - Set minimum urban percentage to use from 5% to 1%. - Completely remove COUP_CAM #ifdef as NOT needed anymore. - -Bugs fixed (include bugzilla ID): Fix urban model restarts, remove cpl6 (755), MCT memory leak (825) - -Known bugs (include bugzilla ID): 251 (TwoStream), 672 (3.5.4-3.5.14 diffs), - 680 (t0 precip diff for seq-ccsm), - 698 (cprnc bug gives false difference), 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 805 (too much output in build-streams), 826 (pftdyn) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - -Known bugs that will NOT be resolved: 512 (mksurf on PGI), 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Describe any changes made to build system: Add nofire option to configure, remove cpl6 option - -Describe any changes made to the namelist: Add new urban oriented output history variables: - - _U, and _R (Urban and Rural) for: - QRUNOFF, TREFMXAV, TREFMNAV, TSA, SoilAlpha, TG, Q2M, TREFAV - URBAN_AC, and URBAN_HEAT, Qanth, SWup, LWup, QTau, HWR, Wind, Qair - and ZBOT_PFT for forcing height - - Change build-namelist so that to use a dataset with urban points on it you - need to use "-clm_demand furbinp". This way it will not only select the appropriate - furbinp dataset -- but it will select the correct surface dataset that includes - urban data on it. Such as for 10x15 and 1.9x2.5 surface datasets where there is - now an urban version as well as the standard version. - - -List any changes to the defaults for the boundary datasets: Add urbanc point dataset, - and 1.9x2.5 and 10x15 urban datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self (some changes by Keith Oleson) - -List any svn externals directories updated (csm_share, mct, etc.): drv, datm7, mct - - drv to drvseq3_0_26 - datm7 to datm7_080907 - mct to MCT2_5_1_080522 - -List all files eliminated: Remove cpl6 files - -R models/lnd/clm/test/system/TCText_ccsmcon.sh -R models/lnd/clm/test/system/TSMext_ccsmcon.sh -R models/lnd/clm/bld/clm.cpl6.template -R models/lnd/clm/src/main/program_csm.F90 -R models/lnd/clm/src/main/clm_csmMod.F90 - -List all files added and what they do: - -A models/lnd/clm/test/system/config_files/4p_casasc_ds ----- Add serial test for CASA -A models/lnd/clm/test/system/nl_files/clm_urb -------------- For standard urban tests. -A models/lnd/clm/test/system/nl_files/nl_urb_br ------------ Urban namelist for branch tests. -A models/lnd/clm/test/system/tests_posttag_kraken ---------- Add tests for kraken -A models/lnd/clm/tools/ncl_scripts/generate_ascii_avg_fv1_9x2_5_urbanparam_file_p7.ncl -- script to create furbinp dataset -A models/lnd/clm/tools/mksurfdata/mksurfdata.globalurban --- Example namelist to make a global urban surface dataset -A models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.txt --- Add urban intercomparison test case - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>> Remove cpl6 option, add nofire, make urban point datasets consistent with global Feddema datasets -M models/lnd/clm/bld/configure -------------------------------- Remove cpl6 option, add nofire option -M models/lnd/clm/bld/queryDefaultNamelist.pl ------------------ Add -filenameonly option -M models/lnd/clm/bld/urban_input/metropolis_fluxes.txt -M models/lnd/clm/bld/urban_input/urbanc_alpha_fluxes.txt -M models/lnd/clm/bld/urban_input/asphaltjungle_fluxes.txt -M models/lnd/clm/bld/urban_input/mexicocityMEX_fluxes.txt -M models/lnd/clm/bld/urban_input/vancouverCAN_fluxes.txt -M models/lnd/clm/bld/config_files/config_definition.xml -M models/lnd/clm/bld/namelist_files/namelist_definition.xml -M models/lnd/clm/bld/namelist_files/datm.streams.template.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -M models/lnd/clm/bld/build-namelist --------------------------- Have urban surface datasets dependent on furbinp - -M models/lnd/clm/test/system/README.testnames -M models/lnd/clm/test/system/tests_posttag_urban -M models/lnd/clm/test/system/tests_pretag_jaguar -M models/lnd/clm/test/system/tests_pretag_bluefire -M models/lnd/clm/test/system/tests_posttag_purempi_regression -M models/lnd/clm/test/system/tests_posttag_hybrid_regression -M models/lnd/clm/test/system/tests_pretag_bluevista -M models/lnd/clm/test/system/tests_posttag_lightning -M models/lnd/clm/test/system/nl_files/clm_urb1pt -M models/lnd/clm/test/system/input_tests_master -M models/lnd/clm/test/system/README -M models/lnd/clm/test/system/CLM_runcmnd.sh -M models/lnd/clm/test/system/TBR.sh ---------------------- Change so start_ymd of branch runs is initial-length after original start-date -M models/lnd/clm/test/system/test_driver.sh -------------- Reduce from premium to regular, add kraken -M models/lnd/clm/test/system/mknamelist ------------------ Set hist_* values for second file -M models/lnd/clm/test/system/nl_files/nl_crcrop ---------- Set hist_dens for second file -M models/lnd/clm/test/system/nl_files/nl_urb ------------- Set hist_dens for second file, add more fields to list -M models/lnd/clm/test/system/nl_files/nl_std ------------- Set hist_dens for second file -M models/lnd/clm/test/system/nl_files/nl_lfiles ---------- Set hist_dens for second file -M models/lnd/clm/test/system/input_tests_master ---------- Change TBR tests, add more CASA tests - -M models/lnd/clm/tools/mksurfdata/mkurban.F90 ------------ Change threshold to ignore urban from 5% to 1% - -M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 -- For DUST fix forcing height appropriately -M models/lnd/clm/src/biogeophys/UrbanMod.F90 ------------- Don't set pointers if no urban points - ->>>>>>>>>>>>>>>> Remove COUP_CSM #ifdefs - -M models/lnd/clm/src/main/driver.F90 --------- Also make sure urban calls have urban points -M models/lnd/clm/src/main/accFldsMod.F90 -M models/lnd/clm/src/main/clmtypeInitMod.F90 -M models/lnd/clm/src/main/initializeMod.F90 -M models/lnd/clm/src/main/iniTimeConst.F90 -M models/lnd/clm/src/main/histFileMod.F90 -M models/lnd/clm/src/main/restFileMod.F90 -M models/lnd/clm/src/main/controlMod.F90 -M models/lnd/clm/src/main/initSurfAlbMod.F90 -M models/lnd/clm/src/main/clm_time_manager.F90 -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/main/subgridAveMod.F90 -M models/lnd/clm/src/main/initGridCellsMod.F90 -M models/lnd/clm/src/main/spmdMod.F90 -M models/lnd/clm/src/main/surfrdMod.F90 ------------- Also remove COUP_CAM #ifdef -M models/lnd/clm/src/main/do_close_dispose.F90 -M models/lnd/clm/src/main/clmtype.F90 --------------- Also forcing height changes -M models/lnd/clm/src/main/histFldsMod.F90 -M models/lnd/clm/src/main/mkarbinitMod.F90 -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 ------ Also forcing height changes -M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/biogeophys/BiogeophysicsLakeMod.F90 ------ Also forcing height changes -M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 --------- Fix restarts for urban -M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 -M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 - -Summary of testing: - - bluefire: All PASS except TBL and -042 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -043 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -044 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -046 smG45 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 - jaguar: All PASS except TBL and -019 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 - kraken: All PASS except TBL and TER and TBR (this may be a setup problem) and -017 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 - lightning/pathscale: All PASS except TBL and - bangkok/lf95: All PASS except TBL and -025 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ..................FAIL! rc= 10 -026 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -027 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ................FAIL! rc= 5 -029 smG46 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ...................FAIL! rc= 10 - kraken: All PASS except TBL and -017 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 144 arb_ic ........... -.......FAIL! rc= 10 -018 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 10+38 arb_ic ......... -.......FAIL! rc= 13 -019 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS 72+72 arb_ic ......... -.......FAIL! rc= 5 - breeze/gale/hail/gust/ifort: All PASS - - pftdyn tests fail on all platforms -- due to a previous problem that was not -detected because of a bug in the test. - TER and TBR tests fail on kraken -- this may be a setup problem. Possibily a problem -with newcprnc? I'm not sure but since it passes elsewhere, I don't think it's a problem -in the code. - -CLM tag used for the baseline comparison tests if applicable: clm3_6_11 - -Changes answers relative to baseline: Forcing height changes cause answers to change - -=============================================================== -=============================================================== -Tag name: clm3_6_11 -Originator(s): dlawren (Lawrence David 1384 CGD) -Date: Tue Aug 26 21:53:22 MDT 2008 -One-line Summary: Ice stream for snow capped regions - -Purpose of changes: Split liquid and ice runoff streams in snow capped situations - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): 251 (TwoStream), 672 (3.5.4-3.5.14 diffs), - 680 (t0 precip diff for seq-ccsm), - 698 (cprnc bug gives false difference), 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 805 (too much output in build-streams) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - -Known bugs that will NOT be resolved: 512 (mksurf on PGI), 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Update version of pft-physiology file used - -Describe any substantial timing or memory changes: None - -Code reviewed by: erik - -List any svn externals directories updated (csm_share, mct, etc.): scripts and csm_share - - scripts to scripts4_080731 - csm_share to share3_080801 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- Use the same pft-phisiology file for every option -M models/lnd/clm/src/main/clmtypeInitMod.F90 -M models/lnd/clm/src/main/pft2colMod.F90 -M models/lnd/clm/src/main/clmtype.F90 -M models/lnd/clm/src/main/histFldsMod.F90 -M models/lnd/clm/src/main/models/lnd/clm/src/main/clm_time_manager.F90 -- Hack for fake Gregorian calendar -M models/lnd/clm/src/riverroute/RtmMod.F90 --------------- two runoff sreams, liq and ice (qflx_snwcp_ice) -M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 ---- dew snwcp -M models/lnd/clm/src/biogeophys/Hydrology1Mod.F90 -------- snow and rain split for snwcp -M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 ----- liq snwcp -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 -------- qrgwl minus snwcp_ice -M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 ----- lake snwcp -M models/lnd/clm/src/biogeophys/BiogeophysicsLakeMod.F90 - initialize snwcp fields to zero for lakes -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ------ revised balance check - >>>>>>>>>> Get scam test working -M models/lnd/clm/test/system/TSMext_ccsmseq_cam.sh -M models/lnd/clm/test/system/nl_files/scam -M models/lnd/clm/test/system/TSCext_ccsmseq_scam.sh -M models/lnd/clm/test/system/config_files/scam_ds -M models/lnd/clm/test/system/config_files/ext_ccsm_seq_64x128_s -M models/lnd/clm/test/system/nl_files/scam -M models/lnd/clm/test/system/nl_files/scam_prep - -Summary of testing: - - bluefire: All PASS except TBL tests - lightning/pathscale: All PASS except TBL tests - bangkok/lf95: All PASS except TBL tests - breeze/gale/hail/gust/ifort: All PASS - - Didn't test on jaguar -- since it was down. - -CLM tag used for the baseline comparison tests if applicable: clm3_6_10 - -Changes answers relative to baseline: Yes -- pft-physiology file, RTM changes - -=============================================================== -=============================================================== -Tag name: clm3_6_10 -Originator(s): tcraig -Date: Fri Aug 15 09:05:50 MDT 2008 -One-line Summary: extend rtm tracer, ascale for tri-grids, AIX O3 to O2 - -Purpose of changes: extend rtm to handle multiple tracers. added - second tracer to rtm associated with frozen water. first tracer - is now liquid water. both are passed to cpl7 now via the roff and - ioff fields. - - add ascale field to land model in support of model running on it's - own grid. ascale is a field provided by the coupler to the land model - via the driver "domain" datatype. it is needed to correct fluxes - in the land model for conservation. it is being applied to the - land to rtm fluxes and will need to be fully validated in a ccsm4 - tri-grid configuration which is still under development. - - change AIX optimization from -O3 to -O2 at request of LMWG. not - needed for these changes in particular. see bug #812. - -Bugs fixed (include bugzilla ID): 812 - -Known bugs (include bugzilla ID): 251 (TwoStream), 672 (3.5.4-3.5.14 diffs), - 680 (t0 precip diff for seq-ccsm), - 698 (cprnc bug gives false difference), 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 805 (too much output in build-streams) - 1079 (rpointer file updated with clm.i files) - 1083 (Units of NEE exported should be kg CO2 NOT kg C) - http://bugs.cgd.ucar.edu/ - -Known bugs that will NOT be resolved: 512 (mksurf on PGI), 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Describe any changes made to build system: - change AIX -O3 to -O2 at request of LMWG, incorporated - into tag for convenience. - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: - added extra rtm tracer, should have no noticable impact on timing - or memory. - -Code reviewed by: tcraig - -List any svn externals directories updated (csm_share, mct, etc.): - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M bld/config_files/Makefile.in -M src/main/clmtypeInitMod.F90 -M src/main/pft2colMod.F90 -M src/main/clm_atmlnd.F90 -M src/main/clm_csmMod.F90 -M src/main/lnd_comp_mct.F90 -M src/main/domainMod.F90 -M src/main/clmtype.F90 -M src/main/histFldsMod.F90 -M src/riverroute/RtmMod.F90 -M src/riverroute/RunoffMod.F90 -M src/biogeophys/Biogeophysics2Mod.F90 -M src/biogeophys/Hydrology1Mod.F90 -M src/biogeophys/SoilHydrologyMod.F90 - -- change AIX -O3 to -O2 -- add ascale implementation. add asca field to domain datatype, set - for atm and lnd domains. default is 1.0. received from coupler - in first run call. reset in lnd only if atm and lnd domain are same. -- split qflx_snowcap term into qflx_snowcap_rain and qflx_snowcap_snow. - snowcap_rain term is same implementation as old snowcap term. - snowcap_snow is set to zero now. potential future mods are noted - and commented out, search for tcx_snowcap_new in src code. -- implement multiple tracers extensibility in rtm. add frozen - runoff tracer in addition to liquid runoff tracer. -- set roff and ioff runoff terms in lnd_comp_mct to send back to coupler -- update rtm restart file, support backward compatability by setting - runoff tracers to zero if the new fields are not on the restart file. -- update history file for new rtm tracers. requires individual fields - to be copied from tracer arrays to single field arrays for history - interface. - -Summary of testing: - - bluefire: all PASS except - 073 blL61 TBL.sh _sc_h clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup - 077 blL62 TBL.sh _sc_m clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup - 085 blL74 TBL.sh _sc_s clm_std 19980101:6-HOURLY:1800 1x1_brazil navy -10 arb_ic - 087 blL78 TBL.sh _sc_s clm_std 19971231:NONE:1800 1x1_brazil navy -10 arb_ic - the above 4 bl cases FAIL due to -O3 to -O2 optimzation change - 113 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 - sm984 fails due to inconsistent driver in test - jaguar: all PASS except - 038 erP65 TSM_ccsmseq.sh ERS f19_g13 I - 039 erP15 TSM_ccsmseq.sh ERS T31_g35 ICN - 040 erP66 TSM_ccsmseq.sh ERH f19_g13 I - 041 erP16 TSM_ccsmseq.sh ERH T31_g35 ICN - 042 erP67 TSM_ccsmseq.sh ERB f19_g13 I - 043 erP17 TSM_ccsmseq.sh ERB T31_g35 ICN - erP* tests fail due to script error - bangkok/lf95: all PASS except - 046 sm952 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dh ext_ccsm_seq_cam 48 - 047 sm984 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 - sm952 and sm984 fail due to inconsistent driver in test - breeze/gale/hail/gust/ifort: all PASS - - bluefire cam pretag: all PASS except previously documented failures - bluefire ccsm4 pretag: all PASS except previously documented failures - compare with alpha33 FAILS since rtm not bit-for-bit in some tests. - -CLM tag used for the baseline comparison tests if applicable: clm3_6_09 - -Changes answers relative to baseline: - change of AIX -O3 to -O2 changes some results by what ap.........FAIL! rc= 7 -061 smK17 TSM.sh 10p_dgvmsc_h clm_std 19981231:NONE:1800 48x96 gx3v5 -213 arb_ic ................FAIL! rc= 10 -065 blK71 TBL.sh 10p_dgvmsc_s clm_std 19971231:NONE:1800 1x1_brazil navy -670 arb_ic ............FAIL! rc= 5 -088 smL83 TSM.sh _sc_dh clm_std 19980115:DAILY:3600 5x5_amazon navy -10 arb_ic ..................FAIL! rc= 10 -089 erL83 TER.sh _sc_dh clm_std 19980115:DAILY:3600 5x5_amazon navy -5+-5 arb_ic ................FAIL! rc= 5 -090 brL83 TBR.sh _sc_dh clm_std 19980115:DAILY:3600 5x5_amazon navy -10+-10 arb_ic ..............FAIL! rc= 6 -091 blL83 TBL.sh _sc_dh clm_std 19980115:DAILY:3600 5x5_amazon navy -10 arb_ic ..................FAIL! rc= 4 -095 bl711 TBLtools.sh mksurfdata tools__ds namelist .............................................FAIL! rc= 7 -097 bl771 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 7 - lightning/pathscale: ------->>>>>>> Bug 694 -011 er111 TER.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 -012 br111 TBR.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 24+24 arb_ic ..............FAIL! rc= 11 -025 smE13 TSM.sh 4p_vodsrsc_do clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 10 -026 erE13 TER.sh 4p_vodsrsc_do clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ............FAIL! rc= 5 -027 brE13 TBR.sh 4p_vodsrsc_do clm_std 19981231:YEARLY:1800 48x96 gx3v5 24+24 arb_ic ............FAIL! rc= 5 -029 smE16 TSM.sh 4p_vodsrsc_o clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ................FAIL! rc= 10 - lightning/ifort: -004 blA91 TBL.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 5 -008 blA71 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 5 ------->>>>>>> Bug 694 -010 sm111 TSM.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 10 -011 er111 TER.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 5 -012 br111 TBR.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 24+24 arb_ic ..............FAIL! rc= 5 -013 bl111 TBL.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 4 -014 sm114 TSM.sh 4p_vodsr_h clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 10 -016 erE11 TER.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ............FAIL! rc= 13 -017 brE11 TBR.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 24+24 arb_ic ............FAIL! rc= 11 -018 blE11 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 5 - tempest: -009 smB11 TSMruncase.sh .........................................................................FAIL! rc= 4 ------->>>>>>> Bug 694 -011 er111 TER.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 -012 br111 TBR.sh 4p_vodsr_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 24+24 arb_ic ..............FAIL! rc= 11 -036 erE31 TER.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 10+38 arb_ic ....FAIL! rc= 7 -037 brE31 TBR.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 24+24 arb_ic ....FAIL! rc= 6 -045 smH01 TSM.sh 17p_cnnsc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v5@2000 48 startup FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_5_19 - -Changes answers relative to baseline: Bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_5_19 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Thu Mar 6 14:52:17 MST 2008 -One-line Summary: Change directory structure to mimic CCSM, fix so no NaNS on BGC interpinic output, new half degree CN clmi dataset - -Purpose of changes: move cdir1_clm3_5_18 to trunk. Get directory structure to look like CCSM. - - models ------------------------------ Model source code for each component - models/lnd - models/lnd/clm ---------------------- CLM source code, build-scripts, tools, and testing - models/lnd/clm/test/system ---------- CLM test scripts - models/lnd/clm/tools ---------------- CLM tools - models/lnd/clm/tools/mksurfdata - models/lnd/clm/tools/ncl_scripts - models/lnd/clm/tools/interpinic - models/lnd/clm/tools/mkgriddata - models/lnd/clm/tools/mkdatadomain - models/lnd/clm/tools/cprnc - models/lnd/clm/bld ------------------ CLM build scripts - models/lnd/clm/bld/run-ibm.csh ------ sample CLM run script for the IBM - models/lnd/clm/bld/urban_input - models/lnd/clm/bld/usr.src - models/lnd/clm/bld/perl5lib - models/lnd/clm/doc ------------------ CLM documentation - models/lnd/clm/doc/UsersGuide - models/lnd/clm/doc/CodeReference - models/lnd/clm/doc/Dev - models/lnd/clm/src ------------------ CLM specific source code directories - models/lnd/clm/src/biogeochem - models/lnd/clm/src/main - models/lnd/clm/src/riverroute - models/lnd/clm/src/biogeophys - models/ocn/socn --------------------- stub ocean model - models/ice - models/ice/sice --------------------- stub sea-ice model - models/atm - models/atm/datm7 -------------------- data atmosphere model - models/atm/datm7/bld - models/utils ------------------------ Utiltiies - models/utils/esmf_wrf_timemgr ------- ESMF WRF time-manager API - models/utils/timing ----------------- timing utiltities - models/utils/mct -------------------- Model Coupling Toolkit - models/utils/pio -------------------- Parallel I/O - models/drv -------------------------- Sequential CCSM source code - models/drv/seq_mct - models/drv/seq_mct/driver - models/csm_share -------------------- CCSM share code (shared between CCSM component models) - scripts ----------------------------- CCSM build, run and testing scripts - scripts/README ---------------------- ReadMe file on CCSM scripts - doc --------------------------------- CCSM documentation (currently out of date) - - Changes so that interpinic doesn't output NaNS on AIX compiler for CN configuration. - - QUICKSTART: using the new CPL7 scripts: - - cd scripts - ./create_newcase # get help on how to run create_newcase - ./create_newcase -case testI -mach blueice -res f19_g15 -compset I # create new "I" case for blueice at 1.9x2.5_gx1v5 res - # "I" case is clm active, datm7, and inactive ice/ocn - cd testI - configure -mach blueice # create scripts - testI.build # build model and create namelists - bsub < testI.run # submit script - # (NOTE: edit env_run to set RESUBMIT to number of times to automatically resubmit) - -Bugs fixed (include bugzilla ID): 681 (archiving/resub), 696 (save datm7 files) , 707 (xlf90 bug with CAM) - -Known bugs (include bugzilla ID): 251 (TwoStream), 672 (3.5.4-3.5.14 diffs), 680 (t0 precip diff for seq-ccsm), - 694 (restarts for offline) , 697 (version etc.), 698 (cprnc bug), 701 (svn keyword), - 708, (xlf bug on bluevista) - http://bugs.cgd.ucar.edu/ - - New bugs found: 708 -- bug with new xlf90 compiler on bluevista for CASA - 710 -- Some variables are NaNS on clm.i output from CN configuration - - Known bugs that will NOT be resolved: 512 (mksurf on PGI), 546(interpinic for DGVM), - 652 (threads different answers with older PGI versions) - -Describe any changes made to build system: Changed to work with new directory structure - (also works with any wildcard in clm "models/lnd/clm*" directory name) - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Update half degree CN clmi file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): drv (also add in CCSM doc and scripts directories as externals) - doc_060127, seqmct45_scripts_080108, drvseq2_0_10 - -List all files eliminated: Files moved around extensively - -List all files added and what they do: Files moved around extensively - -List all existing files that have been modified, and describe the changes: Files moved around extensively - - models/lnd/clm/bld/DefaultCLM_INPARM_Namelist.xml --- change CN half degree clmi file - models/lnd/clm/bld/clm.cpl6.template ---------------- change assumed paths (use wildcard for models/lnd/clm*) - models/lnd/clm/bld/clm.cpl7.template ---------------- change assumed paths (use wildcard for models/lnd/clm*) - models/lnd/clm/bld/configure ------------------------ get to work in new directory structure - models/lnd/clm/bld/run-ibm.csh ---------------------- fix archiving, and resubmit - models/lnd/clm/bld/run-lightning.csh ---------------- fix archiving, and resubmit - models/lnd/clm/bld/run-pc.csh ----------------------- fix archiving, and resubmit - models/lnd/clm/src/main/clm_time_manager.F90 -------- make save statements explicit - models/lnd/clm/tools/*/Makefile --------------------- change so CLM_ROOT is top of directory structure with - models/lnd/clm* assumed below - models/lnd/clm/tools/interpinic/interpinic.F90 ------ get numrad dimsize, on AIX check for NaNS and convert to spval, - if weights == 0 set values to spval - models/lnd/clm/test/system/test_driver.sh ----------- new directory structure, update to ccsm3_9_beta03 and ccsm4_0_alpha25 - models/lnd/clm/test/system/TBL.sh ------------------- new directory structure - models/lnd/clm/test/system/TBLtools.sh -------------- new directory structure - models/lnd/clm/test/system/TSMncl_tools.sh ---------- new directory structure - models/lnd/clm/test/system/TBR.sh ------------------- new directory structure - models/lnd/clm/test/system/TER.sh ------------------- new directory structure - models/lnd/clm/test/system/TSM.sh ------------------- new directory structure - models/lnd/clm/test/system/TSMpergro.sh ------------- new directory structure - models/lnd/clm/test/system/TSMtools.sh -------------- new directory structure - models/lnd/clm/test/system/TSMcnspinup.sh ----------- new directory structure - models/lnd/clm/test/system/TCBext_ccsmseq_cam.sh ---- new directory structure - models/lnd/clm/test/system/TCBtools.sh -------------- new directory structure - models/lnd/clm/test/system/TCText_ccsmcon.sh -------- new directory structure, add blueice - -Summary of testing: - - bluevista: All PASS except -052 smJ11 TSM.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 4 -053 erJ11 TER.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 10+38 arb_ic ...............FAIL! rc= 5 -054 brJ11 TBR.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 24+24 arb_ic ...............FAIL! rc= 5 -102 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - CAM tests: All PASS except: -060 sm711 TSM.sh h5x8adm adia 9s ..................................FAIL! rc= 6 - blueice: - CPL7 test_scripts: ERS.f19_g15.I.blueice, ERB.f19_g15.I.blueice, ERS.f45_g35.I.blueice -FAIL ERB.f19_g15.I.blueice - CPL6 test_scripts: PASS ERT_OS.f19_g15.I.blueice PASS ERH_OS.T31_g35.ICN.blueice - jaguarcnl: All PASS - lightning: All PASS except -019 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 - bangkok/lf95: All PASS except -18 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 -052 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - tempest: All PASS - -CLM tag used for the baseline comparison tests if applicable: ccsm4_alpha25 with clm3_5_18 in place of default clm - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_5_18 -Originator(s): erik (Erik Kluzek) -Date: Thu Feb 21 22:57:39 MST 2008 -One-line Summary: Update to latest seq-ccsm4.alpha tag - -Purpose of changes: Get clm trunk to work with latest ccsm4.alpha24 tag - -Bugs fixed (include bugzilla ID): 678 (get clm to work with latest cpl7) - -Known bugs (include bugzilla ID): 251, 512, 546, 652, 672, 675, 676, 680, - 681, 694, 696, 697, 698, 701, 702, 707, 708 - http://bugs.cgd.ucar.edu/ - - New bugs: 697-- username,version,hostname NOT in seq-driver namelists - 707-- bug on new xlf90 compiler on bluevista for running with CAM - 708-- bug on new xlf90 compiler on bluevista for running with CASA - -Describe any changes made to build system: minor change in configure script - name of mode ext_cam changed to ext_ccsm_seq in configure script - -Describe any changes made to the namelist: Sequential driver namelists change - -ccsm_inparm namelist changes to seq_infodata_inparm - (remove restart_override, username, version, hostname) -timemgr_inparm namelist changes to seq_timemgr_inparm - (remove restart_overrideTMG, stop_final_ymd [use stop_ymd instead] ) - -List any changes to the defaults for the boundary datasets: - Add 2.65x3.33 datasets, newer 1x1_brazil domain file - -Describe any substantial timing or memory changes: None - -Code reviewed by: mvertens (original version on seq branch) - -List any svn externals directories updated (csm_share, mct, etc.): - -drv, datm7, sice, socn, csm_share_, and mct - -src/drv drvseq2_0_07 -src/datm7 drva_datm7_070824_tags/drva07_datm7_071129 -src/sice stubs1_0_7 -src/socn stubs1_0_7 -src/csm_share drva_share3_070903_tags/loga25_share3_071107 -src/utils/mct seqa_MCT2 _3_0_070524_tags/seqa07_MCT2_4_2_071026 - -List all files eliminated: None - -List all files added and what they do: - -A + bld/ExtSeqCCSMDrvInNamelistsDescriptions.xml -- for moving drv_in namelist items -A + bld/clm.cpl7.template ------------------------- for running with cpl7 - -List all existing files that have been modified, and describe the changes: - -------------- Get external CAM tests working, and with changes to seq-ccsm -M test/system/TSMext_ccsmseq_cam.sh -M test/system/test_driver.sh -M test/system/tests_posttag_hybrid_regression -M test/system/tests_posttag_purempi_regression -M test/system/nl_files/scam -M test/system/nl_files/scam_prep -M test/system/nl_files/ext_ccsm_seq_cam -M test/system/TSM.sh - -------------- Now need clm_varpar.F90 in tools -M tools/mksurfdata/Srcfiles -M tools/mkgriddata/Srcfiles - -------------- Add ext_ccsm_seq, add 2.65x3.33 datasets, change for new seq-ccsm namelists - switch 1x1_brazil domain file -M bld/configure -M bld/DefaultCLM_INPARM_Namelist.xml -M bld/run-ibm.csh -M bld/clm_inparm.pm -M bld/DefaultTIMEMGR_INPARM_Namelist.xml -M bld/sample.seqccsm.namelists -M bld/run-pc.csh -M bld/timemgr_inparm.pm -M bld/DefaultCCSM_INPARM_Namelist.xml -M bld/drv_in.pm -M bld/run-lightning.csh -M bld/mkSrcfiles -M bld/SeqCCSM_namelist.pm -M bld/ccsm_inparm.pm -M bld/SeqCCSMDrvInNamelistsDescriptions.xml -M bld/DefaultDATM_DSHR_NML_Namelist.xml - -------------- Don't allow seq_ccsm datatypes to go below lnd_comp_mct, fix scam -M src/main/clm_comp.F90 ------------- Remove SyncClock, CCSMInit -M src/main/driver.F90 --------------- Remove SyncClock, CCSMInit -M src/main/decompInitMod.F90 -------- Use endrun rather than shr_sys_abort -M src/main/ncdio.F90 ---------------- fixes for scam -M src/main/atmdrvMod.F90 ------------ remove unneeded printing -M src/main/clmtypeInitMod.F90 ------- explicit use only's -M src/main/initializeMod.F90 -------- remove CCSMInit and EClock -M src/main/controlMod.F90 ----------- move initialization to timemgr/clm_varctl - set methods -M src/main/clm_time_manager.F90 ----- Make namelist input private, add set method -M src/main/clm_varctl.F90 ----------- Add set and initialization methods -M src/main/clm_varorb.F90 ----------- Remove values not needed -M src/main/lnd_comp_mct.F90 --------- Update to new structures/logic - On time-step 0 also advance to time-step 1 -M src/main/program_off.F90 ---------- Move orbital info/dtime to this level -M src/main/spmdMod.F90 -------------- Change print format -M src/biogeophys/UrbanInputMod.F90 -- Initialize filename - -Summary of testing: - - bluevista: -004 blA71 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 5 -008 blA91 TBL.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 5 -011 blD91 TBL.sh _persc_ds clm_per 19981231:YEARLY:1200 4x5 gx3v5 144 arb_ic ....................FAIL! rc= 5 -014 blG71 TBL.sh 17p_sc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic .........FAIL! rc= 5 -016 blH71 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic ......FAIL! rc= 5 -021 blE11 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 5 -026 blF27 TBL.sh 17p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ..............FAIL! rc= 5 -031 blE31 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 48 arb_ic -.......FAIL! rc= 5 -034 blCA1 TBL.sh _sc_ds clm_std^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -036 blNB1 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -040 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:MONTHLY:1800 10x15 USGS 48 arb_ic ................FAIL! rc= 5 -046 blH11 TBL.sh 17p_cnnsc_dh clm_std 19980101:MONTHLY:1800 48x96 gx3v5@1890 48 arb_ic ..........FAIL! rc= 5 -050 blH52 TBL.sh 17p_cnnsc_dm clm_std 19980115:MONTHLY:1800 10x15 USGS@1890 48 arb_ic ...........FAIL! rc= 5 -052 smJ11 TSM.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 4 <<<< bug 708 -053 erJ11 TER.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 10+38 arb_ic ...............FAIL! rc= 5 <<<< bug 708 -054 brJ11 TBR.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 24+24 arb_ic ...............FAIL! rc= 5 <<<< bug 708 -055 blJ11 TBL.sh 4p_casasc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 4 -059 blK11 TBL.sh 10p_dgvmsc_dh clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 5 -064 blK71 TBL.sh 10p_dgvmsc_s clm_std 19971231:NONE:1800 1x1_brazil navy -670 arb_ic ............FAIL! rc= 5 -068 blL53 TBL.sh _sc_dh clm_std^nl_crcrop 19980115:MONTHLY:1800 10x15 USGS 24 arb_ic ............FAIL! rc= 5 -072 blL63 TBL.sh _sc_h clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup ..................FAIL! rc= 5 -076 bl563 TBL.sh _h clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup .....................FAIL! rc= 5 -080 blL52 TBL.sh _sc_ds clm_std 19980115:MONTHLY:1800 10x15 USGS 24 arb_ic ......................FAIL! rc= 5 -084 blL73 TBL.sh _sc_s clm_std 19980101:6_HOURLY:1800 1x1_brazil navy -10 arb_ic ................FAIL! rc= 5 -089 blL83 TBL.sh _sc_dh clm_std 19980115:DAILY:3600 5x5_amazon navy -10 arb_ic ..................FAIL! rc= 5 -101 sm921 TSMext_ccsmseq_cam.sh ext_ccsm_seq_4x5_dh ext_ccsm_seq_cam 48 .........................FAIL! rc= 4 <<<<< bug 707 -102 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 <<<<<< bug 707 - CAM tests all PASS except -060 sm711 TSM.sh h5x8adm adia 9s ..................................FAIL! rc= 6 -062 sc001 TSC.sh e64bfbiop scm_prep scm64bfbiop scm_b4b_o1 7s .....FAIL! rc= 5 - -First was a Build-namelist error, next was core-dump. - - tempest: -004 blA71 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 5 -007 blD91 TBL.sh _persc_ds clm_per 19981231:YEARLY:1200 4x5 gx3v5 144 arb_ic ....................FAIL! rc= 5 -010 blE11 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 5 -014 blA92 TBL.sh _sc_dm clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 5 -016 blG71 TBL.sh 17p_sc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic .........FAIL! rc= 5 -018 blH71 TBL.sh 17p_cnnsc_ds clm_pftdyn 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic ......FAIL! rc= 5 - lightning/pathscale: -004 blA91 TBL.sh _sc_dh clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 5 -008 blA71 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 5 -011 blCA1 TBL.sh _sc_ds clm_std^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -013 blCA2 TBL.sh _sc_ds clm_std^nl_urb 19971231:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 5 -015 blNB1 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -017 blOC1 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 5 -019 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 <<<< bug 694 -026 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:MONTHLY:1800 10x15 USGS 48 arb_ic ................FAIL! rc= 5 -031 blH52 TBL.sh 17p_cnnsc_dm clm_std 19980115:MONTHLY:1800 10x15 USGS@1890 48 arb_ic ...........FAIL! rc= 5 -035 blK51 TBL.sh 10p_dgvmsc_dm clm_std 19981231:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 5 -039 blL51 TBL.sh _sc_dh clm_std 19980115:MONTHLY:1800 10x15 USGS 48 arb_ic ......................FAIL! rc= 5 -043 blL53 TBL.sh _sc_dh clm_std^nl_crcrop 19980115:MONTHLY:1800 10x15 USGS 24 arb_ic ............FAIL! rc= 5 -047 blL73 TBL.sh _sc_s clm_std 19980101:6_HOURLY:1800 1x1_brazil navy -10 arb_ic ................FAIL! rc= 5 - jaguarcnl: -008 blA92 TBL.sh _sc_dm clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 7 -012 blE12 TBL.sh 4p_vodsrsc_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 7 -016 blE32 TBL.sh 4p_vodsrsc_dm clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 48 arb_ic .......FAIL! rc= 7 -020 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:MONTHLY:1800 10x15 USGS 48 arb_ic ................FAIL! rc= 7 -024 blH12 TBL.sh 17p_cnnsc_dm clm_std 19980101:MONTHLY:1800 48x96 gx3v5@1890 48 arb_ic ..........FAIL! rc= 7 -028 blJ12 TBL.sh 4p_casasc_dm clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 7 - bangkok/lf95: -004 blA92 TBL.sh _sc_dm clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 7 -008 blA71 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 7 -011 blD91 TBL.sh _persc_ds clm_per 19981231:YEARLY:1200 4x5 gx3v5 144 arb_ic ....................FAIL! rc= 7 -014 blCA2 TBL.sh _sc_ds clm_std^nl_urb 19971231:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 7 -016 blOC1 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 7 -018 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 <<<<<< 694 -025 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:MONTHLY:1800 10x15 USGS 48 arb_ic ................FAIL! rc= 7 -030 blH52 TBL.sh 17p_cnnsc_dm clm_std 19980115:MONTHLY:1800 10x15 USGS@1890 48 arb_ic ...........FAIL! rc= 7 -034 blJ12 TBL.sh 4p_casasc_dm clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 7 -038 blK51 TBL.sh 10p_dgvmsc_dm clm_std 19981231:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 7 -042 blL51 TBL.sh _sc_dh clm_std 19980115:MONTHLY:1800 10x15 USGS 48 arb_ic ......................FAIL! rc= 7 -047 blL73 TBL.sh _sc_s clm_std 19980101:6_HOURLY:1800 1x1_brazil navy -10 arb_ic ................FAIL! rc= 7 -052 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - -TBL _sc tests fail because of addition of area-corrected fluxes and addition of running - time-step 1 when time-step 0 is done on initialization. -er111/112 tests fail due to previous bug 694 -sm921/982 test fail on bluevista due to new bug 707 on (compiler bug on bluevista) - -CLM tag used for the baseline comparison tests if applicable: clm3_5_17 - -Changes answers relative to baseline: Yes -- greater than roundoff - - Summarize any changes to answers, i.e., - - what code configurations: Any mode with sequential-CCSM - - what platforms/compilers: ALL - - nature of change: larger than roundoff - -Fluxes in driver are corrected by ratio's of area's from different components. -Also at time-step 0 you also run time-step 1 -- rather than just time-step 0. - -=============================================================== -=============================================================== -Tag name: clm3_5_17 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Wed Feb 6 10:10:17 MST 2008 -One-line Summary: Merge Tony Craig's FMI branch fmi12_clm3_5_16 to the clm trunk - -Purpose of changes: Reducing the debug level in some initialization routines, fixing a few diagnostics, - updating timers, improve the write_diagnostic performance, update of rtm init to improve scaling and performance. - -Bugs fixed (include bugzilla ID): 597 - -Known bugs (include bugzilla ID): 251, 512, 546, 652, 672, 675, 676, 680, 681, 694, 696, 698, 701, 702 - http://bugs.cgd.ucar.edu/ - - New bugs found: datm7 restart files NOT being archived (696), cprnc found to have problems (698), - version autoinsertion in tools (701), test_driver times out on jaguar (702) - -Describe any changes made to build system: Add BUILDPIO CPP variable - -Describe any changes made to the namelist: Add new namelist variables dealing with PIO (see below) - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: erik,tcraig - -List any svn externals directories updated (csm_share, mct, etc.): pio to pio11_prod - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M doc/UpDateChangeLog.pl ----------------- Tweak update of date to work correctly for both files -M bld/run-frost.csh ---------------------- Tony gets working, add PIO build as commented out, turn querys off, put files - in explicitly, tests new ncd_ options -M src/biogeochem/STATICEcosysDynMod.F90 -- Add timers -M src/main/clm_comp.F90 ------------------ Add timers -M src/main/driver.F90 -------------------- Add timers, add barrier for diagnostics write, change send/recv into reduce (leave option for old code) -M src/main/decompInitMod.F90 ------------- Reduce debug level for initialization -M src/main/initializeMod.F90 ------------- Add timers -M src/main/histFileMod.F90 --------------- PIO option -M src/main/ncdio.F90 --------------------- Work for PIO, new options -M src/main/gen_ncdio_global_subs.csh ----- Work for PIO, new options -M src/main/gen_ncdio_local_subs.csh ------ Work for PIO, new options -M src/main/controlMod.F90 ---------------- Add new namelist items - -History experimental options (mostly for PIO which isn't fully implemented yet) - - o hist_pioflag = logical true if want to turn on hist with pio [.FALSE., .TRUE.] - o ncd_lowmem2d = logical true if want to turn on low memory 2d writes in clm hist [.TRUE., .FALSE.] - o ncd_pio_def = logical true if want default pio use setting [.FALSE., .TRUE.] - o ncd_pio_UseRearranger = logical true if want to use MCT as Rearranger [.TRUE., .FALSE.] - o ncd_pio_UseBoxRearr = logical true if want to use box as Rearranger [.FALSE., .TRUE.] - o ncd_pio_SerialCDF = logical true if want to write with pio serial netcdf mode [.FALSE., .TRUE.] - o ncd_pio_IODOF_rootonly = logical true if want to write history in pio from root only [.FALSE., .TRUE.] - o ncd_pio_DebugLevel = integer pio debug level ( default 2) - o ncd_pio_num_iotasks = integer number of iotasks to use for PIO (default all PEs) - -M src/main/clm_varctl.F90 ----------------- New ncd and PIO history options -M src/main/program_off.F90 ---------------- Add mpi barrier -M src/main/areaMod.F90 -------------------- Improve performance/robustness -M src/main/clm_mct_mod.F90 ---------------- Use pelocs -M src/riverroute/RtmMod.F90 --------------- Add timers, update of rtm init to improve scaling and performance -M test/system/test_driver.sh -------------- Fix for new account names on jaguar/phoenix - -Summary of testing: - - bluevista: All PASS except -021 blE11 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 7 -026 blF27 TBL.sh 17p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ..............FAIL! rc= 7 -031 blE31 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 48 arb_ic .......FAIL! rc= 7 -101 sm921 TSMext_ccsmseq_cam.sh ext_ccsm_seq_4x5_dh ext_ccsm_seq_cam 48 .........................FAIL! rc= 4 -102 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - jaguarcnl: All PASS except -012 blE12 TBL.sh 4p_vodsrsc_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 7 -016 blE32 TBL.sh 4p_vodsrsc_dm clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 48 arb_ic .......FAIL! rc= 7 - bangkok/lf95: All PASS except -018 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 -020 bl112 TBL.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 7 -051 sm951 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dm ext_ccsm_seq_cam 48 .......................FAIL! rc= 4 -052 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - lightning/pathscale: All PASS except -019 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 -021 bl112 TBL.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 7 - tempest: All PASS except -010 blE11 TBL.sh 4p_vodsrsc_dh clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 7 - -er112, bl112, sm921, sm951, sm982 tests failed previously -other bl tests fail because of the changes in RTM - -CLM tag used for the baseline comparison tests if applicable: clm3_5_16 - -Changes answers relative to baseline: Only RTM - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: RTM - - what platforms/compilers: All - - nature of change: Roundoff change - - If bitwise differences were observed, how did you show they were no worse - than roundoff? Only fields with RTM show differences and only to roundoff level - - RMS DVOLRDT_ 8.8031E-22 - RMS DVOLRDT_ 3.4573E-23 - RMS QCHANR 3.6282E-16 - RMS QCHOCNR 5.4893E-17 - -The above is on bluevista after running for a day (other fields show RMS difference of zero) - -=============================================================== -=============================================================== -Tag name: clm3_5_16 -Originator(s): erik (Erik Kluzek) -Date: Mon Jan 28 15:00:53 MST 2008 -One-line Summary: Get point version of Urban code onto trunk (urban code can not restart) - -Purpose of changes: Move urban branch onto trunk. Fix bug so hv files are saved. Add - high resolution datasets from Art Mirin. - - Urban code was started by Gordon Bonan, and taken up by Mariana Vertenstein and Keith Oleson. - This represents work that has been ongoing for several years. Revision dates go back to - before 2003. - - Some papers on the work are available from: - - Oleson et.-al. Journal of Applied Meteorology and Climatology, in-Press as of Jan/2008 - - http://www.cgd.ucar.edu/tss/staff/oleson/publications/JAMC1597_rev_jul27_2007.pdf - http://www.cgd.ucar.edu/tss/staff/oleson/publications/JAMC1598_rev_jul27_2007.pdf - -Bugs fixed (include bugzilla ID): 644 (save hv files) - -Known bugs (include bugzilla ID): 251, 512, 546, 652, 672, 675, 676, 680, 681, 694 - http://bugs.cgd.ucar.edu/ - - New bug found from clm3_5_15 (694) -- restarts are NOT bit-for-bit on lightning and bangkok/lf95 for offline - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Added furbinp -- for urban datasets - -List any changes to the defaults for the boundary datasets: Added more urban datasets. - Add 0.23x0.31 datasets from Art Mirin. - -Describe any substantial timing or memory changes: Approx 1% slower, memory should be very close - -Code reviewed by: oleson - -List any svn externals directories updated (csm_share, mct, etc.): bld/archiving - bld/archiving to scripts_080108 - -List all files eliminated: None - -List all files added and what they do: - ------- Urban point input datasets (ASCII) -A bld/urban_input/asphaltjungle_fluxes.txt -A bld/urban_input/metropolis_fluxes.txt -A bld/urban_input/mexicocityMEX_fluxes.txt -A bld/urban_input/vancouverCAN_fluxes.txt ------ Main urban source codes -A src/biogeophys/UrbanInitMod.F90 -A src/biogeophys/UrbanInputMod.F90 -A src/biogeophys/UrbanMod.F90 ------ Add testing for urban code -A test/system/tests_posttag_urban ------ List of urban point tests -A test/system/nl_files/clm_urb1pt ------ Namelist options for CLM1PT datasets -A test/system/nl_files/nl_urb ---------- Urban namelist -A test/system/config_files/_mexsc_ds --- Mexicocity, MEX -A test/system/config_files/_vansc_ds --- Vancouver, CAN ------ Add tool to convert Urban point datasets to sequential-CCSM mode for datm7 -A tools/ncl_scripts/convertUrbanOffline2Seq.ncl - -List all existing files that have been modified, and describe the changes: - --------- Add in urban datasets to build-namelist -M bld/configure ---------------------------- Move subroutine definition to before first reference -M bld/datm_dshr_in.pm -M bld/clm_inparm.pm -M bld/datm.streams.template.xml ------------ Add in CLM1PT datasets for Urban -M bld/DefaultTIMEMGR_INPARM_Namelist.xml -M bld/DefaultSettings.xml -M bld/DefaultDATM_DSHR_NML_Namelist.xml -M bld/DefaultCLM_INPARM_Namelist.xml -M bld/timemgr_inparm.pm -M bld/run-pc.pm ---------------------------- Remove extra line, set mode in configure, add note about step=coupling step -M bld/run-ibm.pm --------------------------- Add note about step=coupling step -M bld/run-lightning.pm --------------------- Add note about step=coupling step --------- source code changes to add in urban code --------- mostly adding urban and non-urban filters -M src/biogeochem/DGVMMod.F90 --------------- Add urban filters -M src/main/atmdrvMod.F90 ------------------- Add RH and rainf, zero out solar if coszen<0, Urban pt CPPs -M src/main/clm_varcon.F90 ------------------ Add PI, RGAS, SECSPDAY, urban PFT types, urban ponding depth -M src/main/clm_varpar.F90 ------------------ Add maxpatch_urb for 5 PFT's -M src/main/clm_atmlnd.F90 ------------------ Fill RH and rainf -M src/main/clmtype.F90 --------------------- Add urban state data -M src/main/clmtypeInitMod.F90 -------------- Initialize urban state data -M src/main/controlMod.F90 ------------------ Add furbinp namelist item for urban input data -M src/main/driver.F90 ---------------------- Pass urban filters, call urban modules -M src/main/filterMod.F90 ------------------- Add urban filters -M src/main/histFileMod.F90 ----------------- Add scale types needed for urban which needs to calculate area-averages based on urban input -M src/main/histFldsMod.F90 ----------------- Add new output fields: - - BUILDHEAT heat flux from urban building interior to walls and roof W/m^2 active - LWdown atmospheric longwave radiation W/m^2 - PSurf surface pressure Pa - Qh sensible heat W/m^2 - Qle total evaporation W/m^2 - Qstor storage heat flux (includes snowmelt) W/m^2 - RH atmospheric relative humidity % - Rainf atmospheric rain mm/s - Rnet net radiation W/m^2 - SWdown atmospheric incident solar radiation W/m^2 - TBUILD internal urban building temperature K active - TRAFFICFLUX sensible heat flux from urban traffic W/m^2 active - Tair atmospheric air temperature K - WASTEHEAT sensible heat flux from heating/cooling sources of urban waste heat W/m^2 active - -(Fields not mentioned above as active are set to inactive unless asked for. They are "ALMA" variables needed for - an urban model intercomparision project.) - -M src/main/iniTimeConst.F90 ---------------- Initialize urban data -M src/main/initGridCellsMod.F90 ------------ Add initialization of urban landunits -M src/main/initSurfAlbMod.F90 -------------- Call urban albedo calc -M src/main/initializeMod.F90 --------------- Urban initialization -M src/main/lnd_comp_mct.F90 ---------------- Add saturation vapor calc to compute RH -M src/main/mkarbinitMod.F90 ---------------- Initialize urban state -M src/main/pftvarcon.F90 ------------------- Fix typo -M src/main/program_off.F90 ----------------- Pass declination angle from orbit to atmdrv (so solar can be nullified for coszen<0) -M src/main/subgridAveMod.F90 --------------- Setup grid info for urban -M src/main/subgridMod.F90 ------------------ Set urban landunit -M src/main/surfrdMod.F90 ------------------- Initialize urban weights -- remove old code that aborted if urban fraction>0 -M src/biogeophys/BalanceCheckMod.F90 ------- Incoming rain does NOT include sun or shade wall, some checks only non-urban -M src/biogeophys/Biogeophysics1Mod.F90 ----- Take into account type of urban column -M src/biogeophys/Biogeophysics2Mod.F90 ----- Take into account type of urban column -M src/biogeophys/FrictionVelocityMod.F90 --- Change index and filters -M src/biogeophys/Hydrology1Mod.F90 --------- Take into account no water flow through urban buildings and impervious road -M src/biogeophys/Hydrology2Mod.F90 --------- Send urban filters down, and no water flow in certain urban column types -M src/biogeophys/SnowHydrologyMod.F90 ------ Urban similar to bare-soil landunit -M src/biogeophys/SoilHydrologyMod.F90 ------ Determine ponding limits for urban roof and impervious road, no runoff for sun/shade wall -M src/biogeophys/SoilTemperatureMod.F90 ---- Take into account that urban columns interact -M src/biogeophys/SurfaceAlbedoMod.F90 ------ Filter urban columns appropriately -M src/biogeophys/SurfaceRadiationMod.F90 --- Filter urban columns out ----------- Make MPI and OpenMP settings explicit in configuration files -M test/system/config_files/17p_vodsr_dm -M test/system/config_files/17p_vodsr_do -M test/system/config_files/4p_casa_m -M test/system/config_files/4p_casa_o -M test/system/config_files/17p_vodsr_m -M test/system/config_files/17p_vodsr_o -M test/system/config_files/4p_vodsr_dm -M test/system/config_files/17p_cnn_m -M test/system/config_files/4p_vodsr_do -M test/system/config_files/17p_cnn_o -M test/system/config_files/17p_cnn_dm -M test/system/config_files/17p_cnn_do -M test/system/config_files/10p_dgvm_m -M test/system/config_files/4p_casa_dm -M test/system/config_files/10p_dgvm_o -M test/system/config_files/4p_casa_do -M test/system/config_files/10p_dgvm_dm -M test/system/config_files/README -M test/system/config_files/10p_dgvm_do -M test/system/config_files/4p_vodsr_m -M test/system/config_files/4p_vodsr_o ----------- Add urban tests to testing system -M test/system/input_tests_master -M test/system/README.testnames -M test/system/mknamelist -M test/system/test_driver.sh -M test/system/tests_posttag_bangkok -M test/system/tests_posttag_blueice -M test/system/tests_posttag_lightning -M test/system/tests_posttag_hybrid_regression -M test/system/tests_posttag_purempi_regression -M test/system/tests_pretag_bangkok -M test/system/tests_pretag_bluevista ----------- Put options on separate lines, explicitly set source -M test/system/nl_files/clm_pftdyn -M test/system/nl_files/clm_per -M test/system/nl_files/clm_per0 -M test/system/nl_files/clm_std ----------- Add note about need of other directories to build -M tools/ncl_scripts/README ---------------------- Also add note about new script -M tools/mksurfdata/README -M tools/ncl_scripts/README -M tools/interpinic/README -M tools/mkgriddata/README -M tools/mkdatadomain/README - - -Summary of testing: - - bluevista: All PASS except -034 blCA1 TBL.sh _sc_ds clm_std^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -036 blNB1 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -076 bl563 TBL.sh _h clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup .....................FAIL! rc= 7 -101 sm921 TSMext_ccsmseq_cam.sh ext_ccsm_seq_4x5_dh ext_ccsm_seq_cam 48 .........................FAIL! rc= 4 -102 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - tempest: ALL PASS - jaguarcnl: All PASS except TBL tests which fail because of a problem with the previous version on jaguar. -004 blA71 TBL.sh _sc_ds clm_std 19990101:NONE:3600 1x1_brazil navy -10 arb_ic ...................FAIL! rc= 4 -008 blA92 TBL.sh _sc_dm clm_std 19990101:NONE:3600 4x5 gx3v5 -10 arb_ic .........................FAIL! rc= 5 -012 blE12 TBL.sh 4p_vodsrsc_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic ...............FAIL! rc= 5 -016 blE32 TBL.sh 4p_vodsrsc_dm clm_std 19981231:YEARLY:1800 64x128^360x720 USGS 48 arb_ic .......FAIL! rc= 5 -020 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:MONTHLY:1800 10x15 USGS 48 arb_ic ................FAIL! rc= 5 -024 blH12 TBL.sh 17p_cnnsc_dm clm_std 19980101:MONTHLY:1800 48x96 gx3v5@1890 48 arb_ic ..........FAIL! rc= 5 -028 blJ12 TBL.sh 4p_casasc_dm clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic ..................FAIL! rc= 5 -032 blK12 TBL.sh 10p_dgvmsc_dm clm_std 19981231:NONE:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 5 - bangkok/lf95: All PASS except -014 blCA2 TBL.sh _sc_ds clm_std^nl_urb 19971231:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 5 -016 blOC1 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 5 -018 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 <<<< -020 bl112 TBL.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 7 -051 sm951 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dm ext_ccsm_seq_cam 48 .......................FAIL! rc= 4 -052 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - - lightning/pathf90: All PASS except -011 blCA1 TBL.sh _sc_ds clm_std^nl_urb 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ..........FAIL! rc= 5 -013 blCA2 TBL.sh _sc_ds clm_std^nl_urb 19971231:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic ...FAIL! rc= 5 -015 blNB1 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 159 arb_ic FAIL! rc= 5 -017 blOC1 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 5 -019 er112 TER.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 10+38 arb_ic ..............FAIL! rc= 13 <<<< -021 bl112 TBL.sh 4p_vodsr_dm clm_std 19981231:YEARLY:1800 48x96 gx3v5 48 arb_ic .................FAIL! rc= 7 - - -Urban TBL point tests do NOT pass because previous model version didn't have urban enabled. -cam standalone tests require the ccsm4_alpha series version of clm. -<<<<< Tests are the 694 bug found in clm3_5_15. - - -CLM tag used for the baseline comparison tests if applicable: clm3_5_15 - -Changes answers relative to baseline: None bit-for-bit - (except albedo's will be different when running in offline mode see below) - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: All mode=offline - - what platforms/compilers: All - - nature of change: Solar now set to zero when coszen<0, which influences - some non-common instances near twilight when the dataset shows solar>0 - but coszen<0. It doesn't change the model results -- because everything is - reflected anyway, but it will change how albedo is averaged over those periods. - -=============================================================== -=============================================================== -Tag name: clm3_5_15 -Originator(s): erik (Erik Kluzek) -Date: Fri Dec 21 20:33:01 MST 2007 -One-line Summary: Fix interpinic for half degree grid, add in large-file support, allow configure to work with ccsm directory structure - -Purpose of changes: - -Change configure so it will work with the ccsm4_alpha directory structure (especially for -the test suite). Add in large-file support for main code as well as tools (mksurfdata). -Add in tests for create_croplandunit and large-file support. Get interpinic to work for -half degree, and optimize and verify it's use of Open-MP. Add tool to interpolate -Nitrogen deposition files (ndepregrid.ncl). Update run scripts with suggestions from Sam -(and fix a couple of minor bugs). - -interpinic problem: Previous version may have incorrectly found nearest points for PFT data. - Data would have been valid -- but possibly NOT from the nearest point. - There was also a potential Open-MP problem where answers could change depending on the - number of threads used. The new version corrects both of these problems. The new version - should be used to interpolate critical datasets. - -Bugs fixed (include bugzilla ID): 656 (interpinic), 660 (large-file), 674 (diff -q in run script), 679 (testing task/thread change) - -Known bugs (include bugzilla ID): 251, 512, 546, 652, 664, 672, 675, 676 - http://bugs.cgd.ucar.edu/ - -Describe any changes made to build system: Remove mpi include/lib for jaguarcnl - (as already included with the ftn command) - - Make ccsm_seq -- the default way to run. - -Describe any changes made to the namelist: Add outnc_large_files option - - outnc_large_files --- TRUE => use NetCDF 64-bit large file format for output files - (history and restart files) - - The NetCDF 64-bit large file format became available in NetCDF3.6.0 and allows larger dimensions as well as allowing - output files > 2 GBytes. For more info. on Large File Support (LFS) for NetCDF see... - - http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#lfs - - Since, file offsets are stored with 64-bit words rather than 32-bit words -- file sizes may change slightly with LFS. - -List any changes to the defaults for the boundary datasets: - - Added in new clmi files: - -+lnd/clm2/initdata/clmi.BCN.1980-01-01-00000.071207.nc -+lnd/clm2/initdata/clmi.F_0000-01-01_1.9x2.5_gx1v5_c071203.nc -+lnd/clm2/initdata/clmi.F_0000-09-01_1.9x2.5_gx1v5_c071203.nc - - Added in ndep files at half degree - -+lnd/clm2/ndepdata/ndep_clm_2100_0.47x0.63_c071213.nc -+lnd/clm2/ndepdata/ndep_clm_2000_0.47x0.63_c071213.nc -+lnd/clm2/ndepdata/ndep_clm_1890_0.47x0.63_c071213.nc -+lnd/clm2/ndepdata/fndep_clm_1890-2100_0.47x0.63_c071213.nc - - Add documentation and delete extra variables from T42 base ndep datasets - -+lnd/clm2/ndepdata/ndep_clm_2100_64x128_c071221.nc -+lnd/clm2/ndepdata/ndep_clm_2000_64x128_c071221.nc -+lnd/clm2/ndepdata/ndep_clm_1890_64x128_c071221.nc - - Added in urban testing dataset - -+lnd/clm2/surfdata/surfdata_1x1pt_camdenNJ_navy_070824.nc -+lnd/clm2/griddata/griddata_1x1pt_camdenNJ_navy_070824.nc -+lnd/clm2/griddata/fracdata_1x1pt_camdenNJ_navy_070824.nc - - -Describe any substantial timing or memory changes: None - -Code reviewed by: slevis (interpinic, run-ibm.csh), - thornton (ndepregrid.ncl, outnc_large_files option) - -List any svn externals directories updated (csm_share, mct, etc.): - perl5lib to perl5lib_071204 which includes new Decomp module. - -List all files eliminated: None - -List all files added and what they do: - -Add files for testing different tool configurations and ncl scripts, and for testing of -create_crop_landunit, large_file support, and an urbin test. Also change offline configuration -files so they have offline explicitly set as the mode. - -A + test/system/config_files/tools__ds -A + test/system/config_files/tools__o -A + test/system/TSMncl_tools.sh -A + test/system/nl_files/nl_crcrop -A + test/system/nl_files/nl_std -A + test/system/nl_files/nl_lfiles - -Add ncl script to regrid Nitrogen deposition files - -A + tools/ncl_scripts -A + tools/ncl_scripts/README -A + tools/ncl_scripts/ndepregrid.ncl -A + tools/mkgriddata/mkgriddata.ccsm_dom ------ add sample script for using CCSM domain files - -List all existing files that have been modified, and describe the changes: - - - Testing system updates... - -M test/system/config_files/* <-- offline configure files -- explicitly set offline mode -M test/system/config_files/README -M test/system/tests_posttag_spot1 -M test/system/tests_pretag_jaguar -M test/system/README.testnames -M test/system/tests_pretag_bangkok -M test/system/TCBtools.sh -M test/system/test_driver.sh -M test/system/mknamelist -M test/system/tests_posttag_hybrid_regression -M test/system/tests_posttag_purempi_regression -M test/system/tests_pretag_tempest -M test/system/tests_pretag_bluevista -M test/system/tests_posttag_blueice -M test/system/input_tests_master -M test/system/README -M test/system/TSMtools.sh -M test/system/TCBext_ccsmseq_cam.sh -M test/system/tests_posttag_lightning -M test/system/TBLtools.sh -M test/system/TSM.sh - - Update tools makefile and change svn keyword strings - -M tools/mksurfdata/mkvarctl.F90 -M tools/mksurfdata/README -M tools/mksurfdata/mkfileMod.F90 -M tools/mksurfdata/mksrfdat.F90 -M tools/mksurfdata/Makefile -M tools/interpinic/interpinic.F90 -M tools/interpinic/Srcfiles -M tools/interpinic/Makefile -M tools/mkgriddata/creategridMod.F90 -M tools/mkgriddata/Makefile -M tools/mkdatadomain/Makefile -M tools/README - -M bld/configure ---------------------- changes to work with ccsm4.alpha directory structure, and jaguarcnl -M bld/DefaultCLM_INPARM_Namelist.xml - Add new datasets -M bld/Makefile.in -------------------- changes needed for jaguarcnl and Darwin -M bld/scpDefaultNamelist.pl ---------- extend to work with ndep files - Make changes to run scripts -- move section of things to change to top - Remove stuff not used. Add more documentation. Add suggestions from Sam Levis. -M bld/run-ibm.csh -------------------- remove -q option to diff -M bld/run-lightning.csh -------------- add bit about comparing rpointer files to see if advancing from run-ibm.csh -M bld/run-pc.csh --------------------- add bit about comparing rpointer files to see if advancing from run-ibm.csh - - Add large-file support - -M src/biogeochem/CASAMod.F90 -M src/biogeochem/DGVMMod.F90 -M src/main/ncdio.F90 -M src/main/restFileMod.F90 -M src/main/controlMod.F90 -M src/main/clm_varctl.F90 - -Summary of testing: - - tempest: All PASS - bluevista: All PASS, except -033 smEA1 TSM.sh _sc_ds clm_std 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic .................FAIL! rc= 10 --> Urban not active yet -034 blEA1 TBL.sh _sc_ds clm_std 19981001:NONE:3600 1x1_camdenNJ navy -90 arb_ic .................FAIL! rc= 4 ---> Urban not active yet -066 blL53 TBL.sh _sc_dh clm_std^nl_crcrop 19980115:MONTHLY:1800 10x15 USGS 24 arb_ic ............FAIL! rc= 5 ---> New test -070 blL63 TBL.sh _sc_h clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup ..................FAIL! rc= 7 ---> New clmi file -074 bl563 TBL.sh _h clm_std 19980101:MONTHLY:1800 1.9x2.5 gx1v5 -10 startup .....................FAIL! rc= 7 ---> New clmi file -092 bl711 TBLtools.sh mksurfdata tools__ds namelist .............................................FAIL! rc= 4 ---> Test changed -094 bl771 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 4 ---> Test changed -099 sm921 TSMext_ccsmseq_cam.sh ext_ccsm_seq_4x5_dh ext_ccsm_seq_cam 48 .........................FAIL! rc= 4 -100 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - jaguarcnl: ALL PASS, except TBL tests because previous code didn't run on jaguar with recent changes - lightning: ALL PASS, except -035 blL53 TBL.sh _sc_dh clm_std^nl_crcrop 19980115:MONTHLY:1800 10x15 USGS 24 arb_ic ............FAIL! rc= 5 ---> New test -042 bl771 TBLtools.sh mksurfdata tools__ds singlept .............................................FAIL! rc= 5 ---> New test - bangkok/lf95: All PASS, except -047 sm951 TSMext_ccsmseq_cam.sh ext_ccsm_seq_10x15_dm ext_ccsm_seq_cam 48 .......................FAIL! rc= 4 -048 sm982 TSCext_ccsmseq_scam.sh ext_ccsm_seq_64x128_s scam_prep scam_ds scam 3 .................FAIL! rc= 4 - - CAM tests fail because of incomptabilities of csm_share code. - -CLM tag used for the baseline comparison tests if applicable: clm3_5_14 - -Changes answers relative to baseline: None -- bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_5_14 -Originator(s): erik (Erik Kluzek) -Date: Thu Nov 29 12:18:47 MST 2007 -One-line Summary: Use build-streams, and archiving, multiple bug-fixes - -Purpose of changes: Move bstrms5_clm3_5_13 to trunk - -Remove long-term archiving from clm code. Use Mat's long-term and short-term archiving -scripts like cam. Short term script runs at the end of your run script -- then the -long-term archiving script is submitted to the batch que at the end. Update to newer -version of csm_share that doesn't have any mss_ options. Tune usage of build-namelist. -Make streams file on the fly. Remove references to get_env and $HEADUrl$. Fix interpinic -for CASA and RTM (from Sam). Change testing from being done in offline mode to -seq_ccsm mode. Make default in run scripts to run seq_ccsm mode. Add option to run scripts -to resubmit itself until reaches a given model date. - -Add in HCSOI and HCSOISNO from Dave Lawrence. Add PERGRO test to test suite. Simple PERGRO -fix from Jerry Olson. Use branch of driver code for seq-ccsm and removing archiving. Add -in lnd_comp_mct changes from ccsm4.alpha series. - -Bugs fixed (include bugzilla ID): 449 (create_crop), 548 (rm getenv), 579 (cam config), -Changes answers relative to baseline: None - - To verify bit-for-bit ran standard offline test case (bl111) on: tempest, bluevista, bangkok - (pass on bangkok, and bluevista -- but failed on tempest) - -=============================================================== -=============================================================== -Tag name: clm3_5_13 -Originator(s): erik (Erik Kluzek) -Date: Fri Nov 16 10:17:38 MST 2007 -One-line Summary: Update xml file with file needed for ccsm3_5_beta18 - -Describe any changes made to build system: Add models/utils/perl5lib to path for perl tools - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: New 0.47x0.63 fraction - dataset compatible with CCSM datasets - -Describe any substantial timing or memory changes: None - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all subroutines eliminated: None - -List all subroutines added and what they do: - -A bld/scpDefaultNamelist.pl -- Script to help copy files in xml database. - -List all existing files that have been modified, and describe the changes: - -M bld/configure --- add models/util to path -M bld/DefaultCLM_INPARM_Namelist.xml -- add new file -M bld/queryDefaultNamelist.pl --- add models/util to path -M bld/build-namelist --- add models/util to path - -Summary of testing: None - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm3_5_12 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Thu Nov 8 13:49:25 MST 2007 -One-line Summary: Tag with new files needed for ccsm3_5_beta17 - -Purpose of changes: Add new files needed for new resolutions being adding in ccsm3_5_beta17 - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: Small changes to configure from bstrms branch - -Describe any changes made to the namelist: Add new files to Default*.xml files - -List any changes to the defaults for the boundary datasets: New resolutions added - -Describe any substantial timing or memory changes: None - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all existing files that have been modified, and describe the changes: - -Move files over from the bstrms3_clm3_5_11 branch with the new resolutions needed. - -M bld/configure -M bld/DefaultCLM_INPARM_Namelist.xml -M bld/DefaultDATM_NML_Namelist.xml -M bld/DefaultSettings.xml -M bld/DefaultTIMEMGR_INPARM_Namelist.xml -M bld/DefaultPROF_INPARM_Namelist.xml -M bld/queryDefaultNamelist.pl -M bld/DefaultCCSM_INPARM_Namelist.xml -M bld/build-namelist -M bld/DefaultDATM_DSHR_NML_Namelist.xml - -Summary of testing: None - -Changes answers relative to baseline: None - -=============================================================== -=============================================================== -Tag name: clm3_5_11 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Fri Sep 28 12:03:30 MDT 2007 -Date:One-line Summary: Update datasets in the DefaultCLM file for 0.23x0.31, 0.47x0.63, 0.9x1.25 and add fndepdyn file for 1.9x2.5 - -Purpose of changes: Needed for CCSM 20th Century simulation needed for ccsm3_5_beta13 - -Bugs fixed (include bugzilla ID): 585, 589, 593, 611 - - Add T42_gx1v5, 0.9x1.25_gx1v5 support. - also look in scripts/ccsm_utils/Tools for perl5lib. - abort if set -cycle_begyr or cycle_nyrs on namelist rather than on build-namelist command-line. - -Known bugs (include bugzilla ID): 251, 449, 512, 546, 608, 618, 622, 624 - - New nasty bugs found: - -618 You can't add new fields using: hist_fincl*. -622 CLM blindly continues even if needed fields are missing from surface dataset. - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Just add more files to XML database - -List any changes to the defaults for the boundary datasets: Add new files for: - 0.23x0.31, 0.47x0.63, 0.9x1.25, (64x128 with mask=gx1v5) and add fndepdyn file for 1.9x2.5 - -Describe any substantial timing or memory changes: None - -Code reviewed by: None - -List any svn externals directories updated (csm_share, mct, etc.): csm_share updated to trunk_tags/share3_070927 - - This is the version needed in ccsm3_5_beta13 tag (previous version causes problems building on tempest) - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M bld/DefaultCLM_INPARM_Namelist.xml ---- Add new datasets. -M bld/clm_inparm.pm --------------------- Abort if try to define cycle_nyr and cycle_begyr on namelist - rather than with command line options. -M bld/queryDefaultNamelist.pl ----------- Add ability to use perl5lib from under ccsm_utils/scripts/Tools. -M bld/build-namelist -------------------- Add ability to use perl5lib from under ccsm_utils/scripts/Tools. - - ------------------------- Remove test blZ11 (can't do the comparision), and update cam tag comparing to. -M test/system/tests_pretag_bangkok -M test/system/test_driver.sh -M test/system/tests_posttag_purempi_regression -M test/system/tests_posttag_hybrid_regression -M test/system/tests_pretag_bluevista -M test/system/tests_posttag_lightning - -Summary of testing: None - -Changes answers relative to baseline: No clm source code changed - -=============================================================== -=============================================================== -Tag name: clm3_5_10 -Originator(s): jet -Date: Tue Sep 18 12:00:23 MDT 2007 -Date:One-line Summary: Fixed scam bugs when reading initial land dataset - and moved scam_setlatlon functionality to shr_scam_mod in - csm_shr repos. Merged in Mariana's changes to add new boundary - dataset file to help scam determine land/ocn/ice fractions. - -Purpose of changes: Fix scam bugs and refactor code to allow scam to easily - determine land/ocean/ice fractions. - -Bugs fixed (include bugzilla ID): 612, 480 - -Known bugs (include bugzilla ID): 251, 449, 512, 546, 608, 618, 622 - -Describe any changes made to build system: Change configure to include new focndomain file. - -Describe any changes made to the namelist: focndomain file added to ocn_in - -List any changes to the defaults for the boundary datasets: Mariana created - a new focndomain boundary dataset (at the standard resolutions) which - describe the grid fraction of land/ocn/ice - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, mariana - -List any svn externals directories updated (csm_share, mct, etc.): - - clm3_5_10 - branches/scm_drvseq1_0_43 - branches/csm_share3_070824_scm - -List all subroutines eliminated: scam_setlatlonidx.F90 - -List all subroutines added and what they do: moved scm functionality - from scam_setlatlonidx.F90 into a csm_share module that can - now be used by all surface models. - -List all existing files that have been modified, and describe the changes: -M test/system/test_driver.sh - use latest cam in testing -M test/system/nl_files/scam - fixed scam bug -M test/system/nl_files/scam_prep - fixed scam bug -M test/system/nl_files/ext_ccsm_seq_cam - use latest cam in testing -M SVN_EXTERNAL_DIRECTORIES - point to needed external dirs -M src/biogeochem/STATICEcosysDynMod.F90 - use new shr code instead of scam_setlatlonidx.F90 -M src/main/ncdio.F90 - use new shr code instead of scam_setlatlonidx.F90 -M src/main/initializeMod.F90 - use new shr code instead of scam_setlatlonidx.F90 -M src/main/iniTimeConst.F90 - use new shr code instead of scam_setlatlonidx.F90 -M src/main/restFileMod.F90 - use new shr code instead of scam_setlatlonidx.F90 -D src/main/scam_setlatlonidx.F90 - use new shr code instead of scam_setlatlonidx.F90 -M src/main/clm_varctl.F90 - use new shr code instead of scam_setlatlonidx.F90 -M src/main/surfrdMod.F90 - use new shr code instead of scam_setlatlonidx.F90 -Summary of testing: - - bluevista: Everything but ccsm tests pass ( due to requirment on external - directories) - - bangkok/lf95: all passed except ccsm - expected due to requirment on external - directories - tempest all passed except 034 br531 (failed previous to this commit) - - CLM tag used for the baseline comparison tests if applicable: clm3_5_09 - -Changes answers relative to baseline: None - -=============================================================== -=============================================================== -Tag name: clm3_5_09 -Originator(s): erik (Kluzek Erik 1326 CGD) -Date: Fri Aug 31 13:58:46 MDT 2007 -Date:One-line Summary: Change configure to NOT have csm_share code for ccsm_con option, and add in 1x1.25 file, and update datm7 and csm_share - -Purpose of changes: Fix for ccsm3_5_beta12 tag - -Bugs fixed (include bugzilla ID): 581, 583 - -Known bugs (include bugzilla ID): 251, 449, 512, 546, 608,found with a suggested fix by Inez Fung - -Bugs fixed (include bugzilla ID): 389 (partial), 442, 443, 445, 450 - -Describe any changes made to build system: Fix build for jaguar and phoenix - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: nanr, slevis, dlawren, oleson, and bonan reviewed the mklai changes - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all subroutines eliminated: None - -List all subroutines added and what they do: Documentation files - -A + doc/README.DGVM -A + doc/KnownBugs - -List all existing files that have been modified, and describe the changes: - ----------------------> Improve testing -M test/system/nl_files/t31_cnall -M test/system/nl_files/singlept_dgvm_long -M test/system/nl_files/1.9x2.5 -M test/system/nl_files/t31_dgvm -M test/system/nl_files/singlept -M test/system/nl_files/10x15_cnall -M test/system/nl_files/10x15_dgvm -M test/system/nl_files/t31_casa -M test/system/nl_files/regional -M test/system/nl_files/10x15_pftdyn -M test/system/nl_files/t31_dgvm_long -M test/system/nl_files/t42half -M test/system/nl_files/t31 -M test/system/nl_files/10x15 -M test/system/tests_posttag_robin -M test/system/input_tests_master -M test/system/tests_pretag_jaguar -M test/system/tests_posttag_phoenix -M test/system/test_driver.sh -M test/system/TSCscam.sh - ----------------------> Change calculation of LAI,SAI,Canopy-top/bottom so weighted by %-PFT -M tools/mksurfdata/mkfmax.F90 -M tools/mksurfdata/mklaiMod.F90 -M tools/mksurfdata/mkglacier.F90 -M tools/mksurfdata/mkurban.F90 -M tools/mksurfdata/mksoitex.F90 -M tools/mksurfdata/areaMod.F90 -M tools/mksurfdata/mksrfdat.F90 -M tools/mksurfdata/Srcfiles -M tools/mksurfdata/mksoicol.F90 -M tools/mksurfdata/mkpftMod.F90 - ----------------------> Use new default files at T42, add and correct documentation -M bld/run-pc.csh -M bld/run-lightning.csh -M bld/Makefile.in -M bld/run-ibm.csh -M bld/config_clm_defaults.xml -M bld/system_defaults.xml -M bld/run-frost.csh - ----------------------> Remove uneeded shr_sys_flush, put #ifndef UNICOSMP around shr_sys_flush(6), correct MCT vector calls - needed for phoenix/robin build. - -M src/biogeochem/CNCStateUpdate2Mod.F90 -M src/biogeochem/CNGapMortalityMod.F90 -M src/biogeochem/CNC13StateUpdate2Mod.F90 -M src/biogeochem/CNFireMod.F90 -M src/biogeochem/CASAMod.F90 -------------------> Fix CASA by uncommenting lines according to Inez Fung -M src/biogeochem/CNPrecisionControlMod.F90 -M src/biogeochem/DUSTMod.F90 -------------------> Changes from Natalie M. and Francis Vitt for CAM/CLM3.5 Aerosols -M src/biogeochem/CNPhenologyMod.F90 -M src/biogeochem/CNCStateUpdate1Mod.F90 -M src/biogeochem/CNDecompMod.F90 -M src/biogeochem/CNCStateUpdate3Mod.F90 -M src/biogeochem/CNC13StateUpdate1Mod.F90 -M src/biogeochem/CNC13StateUpdate3Mod.F90 -M src/biogeochem/CNAllocationMod.F90 -M src/biogeochem/CNC13FluxMod.F90 -M src/biogeochem/CNEcosystemDynMod.F90 -M src/biogeochem/CNVegStructUpdateMod.F90 -M src/main/inicFileMod.F90 -M src/main/abortutils.F90 -M src/main/driver.F90 -M src/main/ncdio.F90 -M src/main/atmdrvMod.F90 -----------------------> Changes from Keith O. to fix TKFRZ change -M src/main/initializeMod.F90 -M src/main/clmtypeInitMod.F90 -M src/main/histFileMod.F90 -M src/main/clm_csmMod.F90 -M src/main/controlMod.F90 ----------------------> Fix #ifdef's so extra namelist items only on for COUP_CSM or OFFLINE -M src/main/initSurfAlbMod.F90 -M src/main/clm_time_manager.F90 -M src/main/initGridCellsMod.F90 -M src/main/program_off.F90 -M src/main/surfrdMod.F90 -M src/main/decompMod.F90 -M src/main/areaMod.F90 -M src/main/clm_mct_mod.F90 -M src/riverroute/RtmMod.F90 -M src/biogeophys/SurfaceRadiationMod.F90 -M src/biogeophys/SurfaceAlbedoMod.F90 -M src/biogeophys/Hydrology2Mod.F90 -M src/biogeophys/CanopyFluxesMod.F90 - -Summary of testing: - - bluevista: All PASS except -004 bl111 TBL.sh 4p_vodsr_dh t31 48 ...............................FAIL! rc= -009 bl127 TBL.sh 17p_vodsr_dh t31 48 ..............................FAIL! rc= -014 bl131 TBL.sh 4p_vodsr_dh t42half 48 ...........................FAIL! rc= -019 bl141 TBL.sh 17p__dh 10x15_pftdyn 48 ..........................FAIL! rc= -024 bl211 TBL.sh 17p_cnn_dh t31_cnall 48 ..........................FAIL! rc= -028 bl311 TBL.sh 4p_casa_dh t31_casa 48 ...........................FAIL! rc= -032 bl411 TBL.sh 10p_dgvm_dh t31_dgvm 48 ..........................FAIL! rc= -037 bl471 TBL.sh 10p_dgvm_s singlept_dgvm_long -730 ...............FAIL! rc= -041 bl563 TBL.sh _h 1.9x2.5 -10 ...................................FAIL! rc= -045 bl552 TBL.sh _ds 10x15 24 .....................................FAIL! rc= -049 bl573 TBL.sh _s singlept -10 ..................................FAIL! rc= -053 bl583 TBL.sh _dh regional -10 .................................FAIL! rc= -057 bl711 TBLtools.sh mksurfdata namelist .........................FAIL! rc= -059 bl771 TBLtools.sh mksurfdata singlept .........................FAIL! rc= -062 sm061 TSMconccsm.sh ERS f19_g13 ...............................FAIL! rc= 7 - lightning: All PASS except -004 bl112 TBL.sh 4p_vodsr_dm t31 48 ...............................FAIL! rc= -009 bl142 TBL.sh 17p__dm 10x15_pftdyn 48 ..........................FAIL! rc= -014 bl252 TBL.sh 17p_cnn_dm 10x15_cnall 48 ........................FAIL! rc= -018 bl451 TBL.sh 10p_dgvm_dm 10x15_dgvm 48 ........................FAIL! rc= -019 sm551 TSM.sh _dh 10x15 48 .....................................FAIL! rc= 8 -020 er551 TER.sh _dh 10x15 10+38 ..................................FAIL! rc= 5 -021 br551 TBR.sh _dh 10x15 24+24 ..................................FAIL! rc= 5 -022 bl551 TBL.sh _dh 10x15 48 .....................................FAIL! rc= -026 bl573 TBL.sh _s singlept -10 ..................................FAIL! rc= -029 bl771 TBLtools.sh mksurfdata singlept .........................FAIL! rc= - bangkok/lf95: -004 bl112 TBL.sh 4p_vodsr_dm t31 48 ...............................FAIL! rc= -009 bl142 TBL.sh 17p__dm 10x15_pftdyn 48 ..........................FAIL! rc= -014 bl252 TBL.sh 17p_cnn_dm 10x15_cnall 48 ........................FAIL! rc= -018 bl312 TBL.sh 4p_casa_dm t31_casa 48 ...........................FAIL! rc= -022 bl451 TBL.sh 10p_dgvm_dm 10x15_dgvm 48 ........................FAIL! rc= -026 bl551 TBL.sh _dh 10x15 48 .....................................FAIL! rc= -030 bl573 TBL.sh _s singlept -10 ..................................FAIL! rc= -033 sm982 TSCscam.sh seqccsm_64x128_s scam_prep scam_ds scam 7 ....FAIL! rc= 4 - robin: All compile tests pass - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_98 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change: new LAI, TKFRZ change is roundoff different, Dust and CASA changes are significant - -=============================================================== -=============================================================== -Tag name: clm3_expa_98 -Originator(s): erik (KLUZEK ERIK 1326 CGD) -Date: Wed Apr 18 09:51:53 MDT 2007 -One-line Summary: Move externals to top, make SOM4 the default, rename setidx file, use new datafiles, - remove NUMLONS read, tweak testing, remove shell_cmd, remove read of old surfdata file - -Purpose of changes: Some simple cleanup preparing for CLM3.5 release - -Bugs fixed (include bugzilla ID): 440, 441 - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Use new datasets - -List any changes to the defaults for the boundary datasets: Use new NCEP forcing datasets, - and new Nitrogen deposition datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - Directories are the same -- but SVN externals themselves moved to top level - -List all subroutines eliminated: - -D test/system/tests_pretag_blueice > Rename to posttag filename -D bld/empty -----------------------> Rename to usr.src -D src/main/setlatlonidx.F90 -------> Rename to scam_setlatlonidx.F90 filename -D src/main/system_cmd.c -D src/main/cfort.h -D src/SVN_EXTERNAL_DIRECTORIES ----> Move to top layer - -List all subroutines added and what they do: - - -------------------> Files renamed from above -A + test/system/tests_posttag_blueice -A + bld/usr.src -A + SVN_EXTERNAL_DIRECTORIES -A + src/main/scam_setlatlonidx.F90 - - -------------------> New files -A test/system/config_files/10p_dgvm_s -------> New DGVM test -A + test/system/tests_posttag_blueice ---------> Rename -A test/system/tests_posttag_robin -----------> Add tests for robin/phoenix -A test/system/tests_posttag_phoenix -A test/system/nl_files/singlept_dgvm_long ---> Add new singlept DGVM test - -------------------> Add new documentation README files -A tools/README -A bld/README -A Copyright ----> CCSM Copyright file -A README - -List all existing files that have been modified, and describe the changes: - - -------------------> Tweak testing -- use new datasets, increase diversity of testing -M test/system/tests_pretag_bluevista -M test/system/nl_files/t31_cnall -M test/system/nl_files/1.9x2.5 -M test/system/nl_files/t31_dgvm -M test/system/nl_files/singlept -M test/system/nl_files/10x15_cnall -M test/system/nl_files/10x15_dgvm -M test/system/nl_files/t31_casa -M test/system/nl_files/regional -M test/system/nl_files/10x15_pftdyn -M test/system/nl_files/t31_dgvm_long -M test/system/nl_files/t42half -M test/system/nl_files/t31 -M test/system/nl_files/10x15 -M test/system/input_tests_master -M test/system/test_driver.sh - ---------------------> Remove system_cmd.c from list of source files needed to compile -M tools/mksurfdata/Srcfiles -M tools/interpinic/interpinic.F90 <--- fix interpinic compile on bluevista -M tools/mkgriddata/Srcfiles - ---------------------> Use new datasets, make sure works -M bld/run-pc.csh -M bld/configure ---- Remove SOM4 CPP declaration -M bld/run-lightning.csh -M bld/run-ibm.csh -M bld/run-frost.csh - ---------------------> Make SOM4 the default remove other option, remove read of NUMLON - ---------------------> Remove read of old surfdata sets, remove shell_cmd -M src/biogeochem/CNDecompMod.F90 -M src/biogeochem/STATICEcosysDynMod.F90 -M src/main/ncdio.F90 -M src/main/fileutils.F90 -----> Remove shell_cmd as unused now. -M src/main/iniTimeConst.F90 -M src/main/clm_varsur.F90 -M src/main/surfrdMod.F90 - -Summary of testing: - - bluevista: All PASS, except -062 sm061 TSMconccsm.sh ERS f19_g13 ...............................FAIL! rc= 7 - bangkok/lf95: All PASS - tempest: All PASS, except -033 sm982 TSCscam.sh seqccsm_64x128_s scam_prep scam_ds scam 7 ....FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_97 - -=============================================================== -=============================================================== -Tag name: clm3_expa_97 -Originator(s): erik (KLUZEK ERIK 1326 CGD) -Date: Wed Apr 11 12:18:32 MDT 2007 -One-line Summary: Remove SPMD, update to clm proc tag, update timing, improve testing - -Purpose of changes: - Remove SPMD #ifdefs -- use mpi-serial code - Remove COUP_CAM #ifdefs for SEQ_MCT || SEQ_ESMF - Remove LOCAL_DEBUG CPP #ifdefs - Update to prof05_clm3_expa_92 tag (timing changes, SCAM fixes) - Update timing library to latest - Fix bugs - Improve test suite - Change scripts so will rebuild each time (only configure first time if config file DNE) - Change tool Makefile to be consistent and have USER_ overload options. - Add script to update ChangeLog - -Bugs fixed (include bugzilla ID): 337, 361, 389(partial), 407, 408, 417, 428 - 337 -- SPMD - 361 -- IRIX - 389 -- Testing - 407 -- Single gridcell - 408 -- mksurfdata,mkgriddata compiling - 417 -- write last file to mss correctly - 428 -- pdt-dyn mode now restarts correctly - -Describe any changes made to build system: Remove HIDE_MPI, remove - stuff left over from CAM Makefile, put FORTRAN name definition in configure - remove LOCAL_DEBUG CPP #ifdefs - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: mvertens, oleson, thornton (all just briefly) - -List any svn externals directories updated (csm_share, mct, etc.): - Update csm_share to share3_070321 - Update timing to timing_070328 - -List all subroutines eliminated: - -D bld/run-sgi.csh --------------------> Remove SGI run script -D test/system/tests_pretag_bluesky ---> Remove since bluesky is gone -D tools/mksurfdata/mksrfdat.namelist -> Change name to mksurfdata.namelist - - -------> Rename interpinic files to *.F90 - -D tools/interpinic/fmain.f90 -D tools/interpinic/wrap_nf.f90 -D tools/interpinic/shr_kind_mod.f90 -D tools/interpinic/interpinic.f90 -D tools/interpinic/addglobal.f90 - - --------> Remove file no longer needed by SCAM or for SPMD mode -D src/main/getnetcdfdata.F90 -D src/main/mpiinc.F90 - - -List all subroutines added and what they do: - -------- Add concurrent and sequential CCSM tests, add more resolutions, improve tools tests -A test/system/TSMconccsm.sh ----------- Concurrent CCSM test ---------------------> New configurations to test -A test/system/config_files/scam_ds -A test/system/config_files/_h -A test/system/config_files/_dh -A test/system/config_files/_m -A test/system/config_files/_o -A test/system/config_files/_dm -A test/system/config_files/_do -A test/system/config_files/_s -A test/system/config_files/_ds -A test/system/config_files/seqccsm_4x5_dh -A test/system/config_files/seqccsm_64x128_s -A test/system/config_files/seqccsm_10x15_dm -A test/system/config_files/17p__m -A test/system/config_files/17p__o -A test/system/config_files/17p__dh -A test/system/config_files/17p__dm -A test/system/config_files/17p__do -A test/system/config_files/17p__h -A test/system/TSMseqccsm.sh ------------- Sequential CCSM test ---------------------> New namelists and resolutions to test -A test/system/nl_files/scam -A test/system/nl_files/1.9x2.5 -A test/system/nl_files/singlept -A test/system/nl_files/10x15_cnall -A test/system/nl_files/10x15_dgvm -A test/system/nl_files/seqccsm -A test/system/nl_files/regional -A test/system/nl_files/scam_prep -A test/system/nl_files/10x15 -A test/system/README -A test/system/TCBseqccsm.sh --------> Sequential CCSM configure/build -A test/system/TSCscam.sh -----------> Sequential CCSM SCAM mode configure/build -A test/system/TCTconccsm.sh --------> CCSM create-test -A test/system/TBLtools.sh ----------> Compare tools to baseline version - ------------ add singlept and regional tests -A tools/mksurfdata/mksurfdata.singlept -A tools/mksurfdata/mksurfdata.regional -A + tools/mksurfdata/mksurfdata.namelist - ------------ Get improved code from Sam Levis (change names to *.F90) - -A tools/interpinic/interpinic.runoptions -A + tools/interpinic/fmain.F90 -A tools/interpinic/clmi_1999-01-02_10x15_c070330.nc <---- Test file -A + tools/interpinic/wrap_nf.F90 -A tools/interpinic/Filepath -A + tools/interpinic/interpinic.F90 -A + tools/interpinic/addglobal.F90 -A tools/interpinic/Srcfiles ------------ add singlept and regional tests -A tools/mkgriddata/mkgriddata.singlept -A tools/mkgriddata/mkgriddata.regional - ------------ Help to update ChangeLog -A doc/UpDateChangeLog.pl - ------------ New code needed for SCAM mode -A + src/main/setlatlonidx.F90 - - -List all existing files that have been modified, and describe the changes: - ------------ Improve test system (tweak tests, add new tests to various machines) -M test/system/tests_pretag_bluevista -M test/system/nl_files/t31_cnall -M test/system/nl_files/t31_dgvm -M test/system/nl_files/t31_casa -M test/system/nl_files/10x15_pftdyn -M test/system/nl_files/t31_dgvm_long -M test/system/nl_files/t42half -M test/system/nl_files/t31 -M test/system/CLM_runcmnd.sh ------- Use mpirun instead of mpiexec on bangkok/calgary -M test/system/tests_pretag_blueice -M test/system/input_tests_master -M test/system/tests_pretag_jaguar -M test/system/TSMtools.sh -M test/system/tests_pretag_bangkok -M test/system/TCBtools.sh -M test/system/test_driver.sh -M test/system/tests_pretag_tempest -M test/system/tests_posttag_lightning - ------------ Get tools to build -M tools/mksurfdata/mklaiMod.F90 -M tools/mksurfdata/mkfileMod.F90 -M tools/mksurfdata/creategridMod.F90 -M tools/mksurfdata/Srcfiles -M tools/mksurfdata/Makefile ------ Make makefile consistent and add USER_ options -M tools/interpinic/Makefile ------ Make makefile consistent and add USER_ options -M tools/mkgriddata/mkgriddata.F90 -M tools/mkgriddata/creategridMod.F90 -M tools/mkgriddata/Srcfiles -M tools/mkgriddata/Makefile ------ Make makefile consistent and add USER_ options - ------------ Improvements to run scripts and build system - Change scripts so will rebuild each time (only configure first time if config file DNE), remove left over - features from CAM Makefile. -M bld/run-pc.csh -M bld/configure -M bld/run-lightning.csh -M bld/Makefile.in -M bld/run-ibm.csh -M bld/run-frost.csh - ------------ Source code changes, removing SPMD #ifdef, LOCAL_DEBUG, get SCAM mode working with new CAM, change - to work with new timing library, fix code bugs above. Remove COUP_CAM #ifdefs for SEQ_MCT || SEQ_ESMF -M src/biogeochem/CASAMod.F90 -M src/biogeochem/CNPhenologyMod.F90 -M src/biogeochem/STATICEcosysDynMod.F90 -M src/biogeochem/DGVMMod.F90 -M src/biogeochem/CNAllocationMod.F90 -M src/biogeochem/CNVegStructUpdateMod.F90 -M src/main/spmdGathScatMod.F90 -M src/main/abortutils.F90 -M src/main/clm_comp.F90 -M src/main/driver.F90 -M src/main/ncdio.F90 -M src/main/atmdrvMod.F90 -M src/main/fileutils.F90 -M src/main/pftdynMod.F90 -M src/main/iniTimeConst.F90 -M src/main/histFileMod.F90 -M src/main/program_csm.F90 -M src/main/restFileMod.F90 -M src/main/clm_csmMod.F90 -M src/main/controlMod.F90 -M src/main/ndepFileMod.F90 -M src/main/initGridCellsMod.F90 -M src/main/lnd_comp_mct.F90 -M src/main/program_off.F90 -M src/main/pftvarcon.F90 -M src/main/spmdMod.F90 -M src/main/surfrdMod.F90 -M src/main/decompMod.F90 -M src/main/areaMod.F90 -M src/main/iobinary.F90 -M src/main/do_close_dispose.F90 -M src/riverroute/RtmMod.F90 -M src/biogeophys/Hydrology2Mod.F90 -M src/biogeophys/BiogeophysRestMod.F90 - -Summary of testing: - - tempest: ALL PASS - bluevista: -019 bl141 TBL.sh 17p_vodsr_dh 10x15_pftdyn 48 .....................FAIL! rc= 7 -022 er211 TER.sh 17p_cnn_dh t31_cnall 10+38 .......................FAIL! rc= 6 -059 sm061 TSMconccsm.sh ERS f19_g13 ...............................FAIL! rc= 5 - bangkok/lf95: -033 sm982 TSCscam.sh seqccsm_64x128_s scam_prep scam_ds scam 7 ....FAIL! rc= 4 - -TBL test fails because of restart trouble with pftdyn. -Concurrent CCSM test fails because of a problem with ccsm3_5_beta01 for datm7. -bangkok scam test fails as is says that scm_crm_mode is not initialized in -CAM code. - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_96 - (had to add in new tests, and set SOM4) - -Changes Answers: No - -=============================================================== - -=============================================================== -Tag name: clm3_expa_96 -Originator(s): tcraig -Date: Mon Mar 12 16:41:58 MDT 2007 -One-line Summary: fixed finemesh, pftdyn modes, add new tests - -Purpose of changes: restore finemesh and pftdyn modes, improve - test coverage - -Bugs fixed (include bugzilla ID): 389 (partial) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: reduced memory use in pftdyn - -Code reviewed by: - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - - M test/system/tests_pretag_bluevista - A + test/system/nl_files/10x15_pftdyn - A + test/system/nl_files/t31_dgvm_long - A + test/system/nl_files/t42half - M test/system/input_tests_master - M test/system/tests_pretag_blueice - M test/system/tests_pretag_jaguar - M test/system/tests_pretag_bangkok - M test/system/test_driver.sh - M test/system/tests_posttag_lightning - M src/main/subgridMod.F90 - M src/main/initializeMod.F90 - M src/main/pftdynMod.F90 - M src/main/clm_varsur.F90 - M src/main/ndepFileMod.F90 - M src/main/subgridAveMod.F90 - M src/main/initGridCellsMod.F90 - M src/main/lnd_comp_mct.F90 - M src/main/program_off.F90 - M src/main/surfrdMod.F90 - M src/main/domainMod.F90 - M src/main/decompMod.F90 - M src/main/areaMod.F90 - -- rename lvegxy,lwtxy to vegxy, wtxy -- implement general setgatm, get finemesh working again -- refactor pftdynMod for low memory implementation, validate pfydyn mode -- modify ndep and pftdyn from x = x1*wt1 + x2*wt2 to x = x2 + wt1*(x1-x2) - as suggested by k.lindsay, improves roundoff performance -- clean up some old code -- add new tests configurations (10x15_pftdyn, t31_dgvm_long, t42half), -- update pretag lists, add new tests - -Summary of testing: - - bluevista: - all clm tests pass except bl for new cases including new tests - all cam tests pass except bl (due to clm changes in expa_94/95) - ccsm passes ERS.f45_g35.B.bluevista16 (answers change due to expa_94/95) - bangkok/lf95: - all clm tests pass including new tests in list - all cam tests pass except bl (due to clm changes in expa_94/95) - tempest: - all cam tests pass except bl (due to clm changes in expa_94/95) - lightning: - ccsm passes ERS.f45_g35.B2.lightning (answers change due to expa_94/95) - -CLM tag used for the baseline comparison tests if applicable: - clm3_expa_95, cam3_4_03, ccsm3_1_beta45 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - answers are bfb with clm3_expa_95 in clm. cam and ccsm could not - be tested for bfb due to lagging clm version in latest cam and ccsm tags - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -Tag name: clm3_expa_95 -Originator(s): nanr, Keith Oleson, Peter Thornton -Date: Thu Mar 8 17:06:06 MST 2007 -One-line Summary: Adding N limitation for CLM standalone w/o CN. - -Purpose of changes: Improve estimation of photosynthesis in CLM when it -is run without CN active. These changes impose a N limitation as a fcn of -PFT [0-1]. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: testing suites: fpftcon = pft-physiology.c070207 - -List any changes to the defaults for the boundary datasets: - fptfcon = pft-physiology.c070207 - pft-physiology.c070207.readme - -Describe any substantial timing or memory changes: none expected - -Code reviewed by: Keith Oleson, Peter Thornton, Dave Lawrence - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -bv1103en.ucar.edu-/fis/cgd/tss/nanr/clm/clm3_trunk % !svn -svn status | grep 'M ' -M test/system/nl_files/t31_cnall ! change pft-physiology.c070207 -M test/system/nl_files/t31_dgvm ! change pft-physiology.c070207 -M test/system/nl_files/t31 ! change pft-physiology.c070207 -M test/system/nl_files/t31_casa ! change pft-physiology.c070207 -M bld/run-pc.csh ! change pft-physiology.c070207 -M bld/run-sgi.csh ! change pft-physiology.c070207 -M bld/run-lightning.csh ! change pft-physiology.c070207 -M bld/run-ibm.csh ! change pft-physiology.c070207 -M bld/run-frost.csh ! change pft-physiology.c070207 -M src/main/clmtypeInitMod.F90 ! initialize new N limitation factor (fnitr) -M src/main/iniTimeConst.F90 ! initialize new N limitation factor (fnitr) -M src/main/pftvarcon.F90 ! read in new var (fnitr) -M src/main/clmtype.F90 ! initialize new N limitation factor (fnitr) -M src/biogeophys/CanopyFluxesMod.F90 ! apply new N limitation factor (fnitr) - -Summary of testing: - - bluevista: - 001 sm111 TSM.sh 4p_vodsr_dh t31 48 ...............................PASS - 002 er111 TER.sh 4p_vodsr_dh t31 10+38 ............................PASS - 003 br111 TBR.sh 4p_vodsr_dh t31 24+24 ............................PASS - 004 bl111 TBL.sh 4p_vodsr_dh t31 48 ...............................SKIPPED* - 005 sm114 TSM.sh 4p_vodsr_h t31 48 ................................PASS - 006 sm121 TSM.sh 17p_vodsr_dh t31 48 ..............................PASS - 007 er121 TER.sh 17p_vodsr_dh t31 10+38 ...........................PASS - 008 br121 TBR.sh 17p_vodsr_dh t31 24+24 ...........................PASS - 009 bl121 TBL.sh 17p_vodsr_dh t31 48 ..............................SKIPPED* - 010 sm124 TSM.sh 17p_vodsr_h t31 48 ...............................PASS - 011 sm211 TSM.sh 17p_cnn_dh t31_cnall 48 ..........................PASS - 012 er211 TER.sh 17p_cnn_dh t31_cnall 10+38 .......................PASS - 013 br211 TBR.sh 17p_cnn_dh t31_cnall 24+24 .......................PASS - 014 bl211 TBL.sh 17p_cnn_dh t31_cnall 48 ..........................SKIPPED* - 015 sm311 TSM.sh 4p_casa_dh t31_casa 48 ...........................PASS - 016 er311 TER.sh 4p_casa_dh t31_casa 10+38 ........................PASS - 017 br311 TBR.sh 4p_casa_dh t31_casa 24+24 ........................PASS - 018 bl311 TBL.sh 4p_casa_dh t31_casa 48 ...........................SKIPPED* - 019 sm411 TSM.sh 10p_dgvm_dh t31_dgvm 48 ..........................PASS - 020 er411 TER.sh 10p_dgvm_dh t31_dgvm 10+38 .......................PASS - 021 br411 TBR.sh 10p_dgvm_dh t31_dgvm 24+24 .......................PASS - 022 bl411 TBL.sh 10p_dgvm_dh t31_dgvm 48 ..........................SKIPPED* - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: CN inactive - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - new climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - /OLESON/csm/hydp2_off_communn_hk39 - - URL for LMWG diagnostics output used to validate new climate: - -http://www.cgd.ucar.edu/tss/clm/diagnostics/lmwg_hydro/hydp2_off_communn_hk39aa-hydp2_off_communn_hk38aa/setsIndex.html - - - -=============================================================== -=============================================================== -Tag name: clm3_expa_94 -Originator(s): nanr, Keith Oleson, Peter Thornton -Date: Thu Mar 8 14:22:36 MST 2007 -One-line Summary: BTRAN modification - -Purpose of changes: Change BTRAN calculation to improve prognostic - LAI estimation in high latitudes. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Keith Oleson, Peter Thornton, Dave Lawrence - -List any svn externals directories updated (csm_share, mct, etc.): nanr - -List all subroutines eliminated: nanr - -List all subroutines added and what they do: nanr - -List all existing files that have been modified, and describe the changes: -M src/biogeophys/CanopyFluxesMod.F90 - -Changing calculation of rootr to allow non-zero rootr (and btran) in partially frozen layers. - -Summary of testing: - - bluevista: - - 001 sm111 TSM.sh 4p_vodsr_dh t31 48 ...............................PASS - 002 er111 TER.sh 4p_vodsr_dh t31 10+38 ............................PASS - 003 br111 TBR.sh 4p_vodsr_dh t31 24+24 ............................PASS - 004 bl111 TBL.sh 4p_vodsr_dh t31 48 ...............................SKIPPED* - 005 sm114 TSM.sh 4p_vodsr_h t31 48 ................................PASS - 006 sm121 TSM.sh 17p_vodsr_dh t31 48 ..............................PASS - 007 er121 TER.sh 17p_vodsr_dh t31 10+38 ...........................PASS - 008 br121 TBR.sh 17p_vodsr_dh t31 24+24 ...........................PASS - 009 bl121 TBL.sh 17p_vodsr_dh t31 48 ..............................SKIPPED* - 010 sm124 TSM.sh 17p_vodsr_h t31 48 ...............................PASS - 011 sm211 TSM.sh 17p_cnn_dh t31_cnall 48 ..........................PASS - 012 er211 TER.sh 17p_cnn_dh t31_cnall 10+38 .......................PASS - 013 br211 TBR.sh 17p_cnn_dh t31_cnall 24+24 .......................PASS - 014 bl211 TBL.sh 17p_cnn_dh t31_cnall 48 ..........................SKIPPED* - 015 sm311 TSM.sh 4p_casa_dh t31_casa 48 ...........................PASS - 016 er311 TER.sh 4p_casa_dh t31_casa 10+38 ........................PASS - 017 br311 TBR.sh 4p_casa_dh t31_casa 24+24 ........................PASS - 018 bl311 TBL.sh 4p_casa_dh t31_casa 48 ...........................SKIPPED* - 019 sm411 TSM.sh 10p_dgvm_dh t31_dgvm 48 ..........................PASS - 020 er411 TER.sh 10p_dgvm_dh t31_dgvm 10+38 .......................PASS - 021 br411 TBR.sh 10p_dgvm_dh t31_dgvm 24+24 .......................PASS - 022 bl411 TBL.sh 10p_dgvm_dh t31_dgvm 48 ..........................SKIPPED* - - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: none - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - -larger than roundoff. Climate changes unknown. - -Improves prognostic LAI estimation in high latitudes. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): clm3_expa_89 - - platform/compilers: bluevista - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - /OLESON/csm/hydp2_off_communn_hk38 - - URL for LMWG diagnostics output used to validate new climate: - -http://www.cgd.ucar.edu/tss/clm/diagnostics/lmwg_hydro/hydp2_off_communn_hk38aa-hydp2_off_communn_expa89aa/setsIndex.html - - -=============================================================== - -=============================================================== -Tag name: clm3_expa_93 ! NOTE: Tag incremented to correct mistaken tag number in documentation. (nanr) -Originator(s): tcraig -Date: Tue Feb 27 16:53:41 MST 2007 -One-line Summary: merge fmf branch to trunk (low memory mods) - -Purpose of changes: reduce memory and improve memory scaling - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: began adding support - for frost in Makefile and added a run-frost.csh (not yet - fully validated) - -Describe any changes made to the namelist: added new optional namelist - input, nsegspc (number of segments per clump for new decomp. default - is 20, 1 will produce poor loadbalance, infinity yields too many - segments per pe but good load balance. performance asymptotes for - several configurations at about 5-10 segments/pe, use 20 as default.) - -List any changes to the defaults for the boundary datasets: NONE - -Describe any substantial timing or memory changes: significant reduction - in memory use and improved memory scaling. - -Code reviewed by: - -List any svn externals directories updated (csm_share, mct, etc.): update - to mct external, MCT2_3_0_070206 - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - -- implement new 1d decomp based on ngsegspc rather than balancing pfts, - ngsegspc is the number of segments per clump. the 1d gridcells will - be divided into clumps and segments per clump so there will be - a total number of segments, clumps*nsegspc, each of about equal number - of gridcells, that will be distributed round-robin to pes. pfts are - derived later and will hopefully end up being nearly as well load - balanced as the previous method without having to precompute pfts - and requiring much less memory. see above for more info on the namelist - input and default. -- reorganize initialization, split decomp_init into three phases, - atm (coarse), lnd (finemesh), and glcp (subgrid). -- add new datatype, latlon to hold some global grid info -- now all domain info is local (although initialization still needs - to be modified) -- remove some dead code -- add new timers (bug #302) -- split gatm out of domain type -- create simple setgatm_UNITY routine, finemesh capability now disabled, - must fix setgatm in future version -- move wtxy, vegxy, and pctspec to clm_varsur, allocate as local arrays - now (begg:endg) and modify surfrd to handle local data only both for - I/O and initialization. -- implement gather/scatter routines in spmdGathScatMod that use gsmaps. -- update MCT and share -- port to frost -- get rid of some of the global decomps use in code, still more to do -- memory cleanup in STATICEcosysDynMod -- implement new ncdio methods for reading to local gridcell data using gsmaps -- clean up atmdrv, use newer low mem datatypes, reduce memory -- clean up rtm, use newer low mem datatypes, reduce memory -- remove history "lat/lon" fields - -M test/system/test_driver.sh -M tools/mkgriddata/mkgriddata.F90 -M bld/configure -M bld/Makefile.in -A + bld/run-frost.csh -M src/biogeochem/CASAMod.F90 -M src/biogeochem/STATICEcosysDynMod.F90 -M src/biogeochem/DGVMMod.F90 -M src/main/spmdGathScatMod.F90 -M src/main/abortutils.F90 -M src/main/clm_comp.F90 -M src/main/driver.F90 -M src/main/ncdio.F90 -M src/main/atmdrvMod.F90 -M src/main/subgridMod.F90 -M src/main/initializeMod.F90 -M src/main/pftdynMod.F90 -M src/main/iniTimeConst.F90 -M src/main/histFileMod.F90 -M src/main/program_csm.F90 -M src/main/clm_atmlnd.F90 -M src/main/clm_varsur.F90 -M src/main/clm_csmMod.F90 -M src/main/restFileMod.F90 -M src/main/controlMod.F90 -M src/main/clm_varctl.F90 -M src/main/ndepFileMod.F90 -M src/main/initGridCellsMod.F90 -M src/main/lnd_comp_mct.F90 -M src/main/program_off.F90 -M src/main/surfrdMod.F90 -M src/main/domainMod.F90 -M src/main/decompMod.F90 -M src/main/areaMod.F90 -M src/main/clm_mct_mod.F90 -M src/SVN_EXTERNAL_DIRECTORIES -M src/riverroute/RtmMod.F90 - -Summary of testing: - - bluevista: all pass except - 004 bl111 TBL.sh 4p_vodsr_dh t31 48 ...............................FAIL! rc= 7 - 009 bl121 TBL.sh 17p_vodsr_dh t31 48 ..............................FAIL! rc= 7 - bangkok/lf95: all pass except - 004 bl112 TBL.sh 4p_vodsr_dm t31 48 ...............................FAIL! rc= 7 - 009 bl122 TBL.sh 17p_vodsr_dm t31 48 ..............................FAIL! rc= 7 - Due to roundoff change in rtm, only rtm fields affected, otherwise bfb - - Also tested version in CCSM vs ccsm3_1_beta45 - ERS.f45_g35.B.bluevista16 - ERS.f45_g35.B2.lightning - Both PASS and bfb versus beta45 except for rtm roundoff difference and - associated error growth through ocean coupling - - Also tested mods merged to clm3_expa_91 with cam3_4_00, all - CAM tests pass on bangkok, bluevista, and tempest including scam. - Tested on bangkok with cam3_4_01 and updated to clm3_expa_92, all - CAM tests pass on bangkok. bluevista and tempest not tested - due to time constraints and earlier adequate testing with - clm3_expa_91 and cam3_4_00. - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_89 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: anything with RTM on - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff change in RTM due to roundoff change in cell area calculation - - If bitwise differences were observed, how did you show they were no worse - than roundoff? tested in multiple systems, review growth of diffs in - stand-alone clm, only rtm fields affected, diffs remain roundoff for - 48 timesteps, no coupling to other fields or error growth in system. - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - - -=============================================================== -Tag name: clm3_expa_92 -Originator(s): erik,mvertens,mvr -Date: Mon Feb 26 15:59:16 MST 2007 -One-line Summary: When running with Sequential CCSM -- use date for albedo calculation - -Purpose of changes: To work with cam3_4_01 - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: erik,mvr,mvertens - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M src/main/clm_comp.F90 -M src/main/lnd_comp_mct.F90 - -Have sequential CCSM give CLM the date of the next radiation calculation so that -it can calculate albedo's for that specific time-step. This is needed to work with -cam3_4_01. - -Summary of testing: - - bluevista: Pass - bangkok/lf95: Pass - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_91 - -=============================================================== -=============================================================== -Tag name: clm3_expa_91 -Originator(s): erik -Date: Wed Feb 21 13:19:51 MST 2007 -One-line Summary: Fix SCAM mode, add more machines for test_driver, have tools use csm_share, - make clmtype private (except for data exporting), fix several bugs - -Purpose of changes: Fix SCAM mode so can make a new CAM tag. - -Bugs fixed (include bugzilla ID): 252, 310, 370, 377, 385 (partial -- 302, 357, 389) - -Describe any changes made to build system: Remove -DNO_R16 from Makefile - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: MSS writes are now synchronous instead of - asynchronous - -Code reviewed by: slevis - -List any externals updated: Update to csm_share3_070220 - -List all subroutines eliminated: - -Remove makdep -- as MkDepends replaces it -Remove cprlndnc -- as newcprnc replaces it - -D tools/makdep -D tools/makdep/main.c -D tools/makdep/Makefile -D tools/makdep/README -D tools/cprlndnc -D tools/cprlndnc/cprtps.F -D tools/cprlndnc/lenchr.F -D tools/cprlndnc/precision.F -D tools/cprlndnc/printstats.F -D tools/cprlndnc/wrap_nf.F -D tools/cprlndnc/stats.F -D tools/cprlndnc/ismax.F -D tools/cprlndnc/initstats.F -D tools/cprlndnc/nldat.F -D tools/cprlndnc/cpr.F -D tools/cprlndnc/prhddiff.F -D tools/cprlndnc/header.F -D tools/cprlndnc/Makefile -D doc/BranchLog -D doc/ChangeSum - -Delete files that tools use that are copied from main src directories (so we don't have -to maintain separate copies of code) - -D Deleting tools/mkgriddata/fileutils.F90 -D Deleting tools/mkgriddata/nanMod.F90 -D Deleting tools/mkgriddata/shr_const_mod.F90 -D Deleting tools/mkgriddata/shr_kind_mod.F90 -D Deleting tools/mkgriddata/shr_sys_mod.F90 -D Deleting tools/mksurfdata/fileutils.F90 -D Deleting tools/mksurfdata/nanMod.F90 -D Deleting tools/mksurfdata/shr_const_mod.F90 -D Deleting tools/mksurfdata/shr_kind_mod.F90 -D Deleting tools/mksurfdata/shr_sys_mod.F90 -D Deleting tools/mksurfdata/shr_timer_mod.F90 - -List all subroutines added and what they do: - -A test/system/TSMtools.sh -- for testing of the tools (not tested yet) -A test/system/TCBtools.sh -- for build testing of the tools (not tested yet) -A test/system/tests_pretag_blueice -- for running on blueice (does work) -A test/system/tests_pretag_jaguar -- for running on jaguar (doesn't work yet) -A test/system/tests_posttag_lightning -- for running on lightning (doesn't work yet) - -Files added so that tools build uses copies of files in main directories rather than separate copies - -A tools/mkgriddata/Filepath -A tools/mkgriddata/Srcfiles -A tools/mkgriddata/misc.h -A tools/mkgriddata/preproc.h -A tools/mksurfdata/Filepath -A tools/mksurfdata/Srcfiles -A tools/mksurfdata/misc.h -A tools/mksurfdata/preproc.h - -List all existing files that have been modified, and describe the changes: - -Add check for soil energy balance: - -M src/biogeophys/BalanceCheckMod.F90 - -Bigint bug fix (don't copy over static fields with bigint values when copying a domain) - -M src/main/domainMod.F90 - -SCAM fixes (read datasets differently for SCAM) - -M src/main/surfrdMod.F90 -M src/main/ndepFileMod.F90 -M src/main/iniTimeConst.F90 - -Change so that tools use main copies of code rather than own particular copy: - -M tools/mkgriddata/Makefile -M tools/mkgriddata/mkgriddata.namelist -M tools/mksurfdata/Makefile -M tools/mksurfdata/domainMod.F90 - -Make MSS write's synchronous instead of asynchronous: Required for LSF queing systems - -M src/main/fileutils.F90 - -Landmask bug fix: (landmask now output globally with no missing or fill values) - -M src/main/histFileMod.F90 -M src/main/initializeMod.F90 -M src/main/ncdio.F90 - -Timers - -M src/main/program_csm.F90 -M src/main/driver.F90 - -Make clmtype private -- so only exports it's data not data it uses. - -M src/biogeochem/CNGapMortalityMod.F90 -M src/biogeochem/VOCEmissionMod.F90 -M src/biogeochem/CNrestMod.F90 -M src/biogeochem/CNC13FluxMod.F90 -M src/biogeochem/CNSetValueMod.F90 -M src/main/atmdrvMod.F90 -M src/main/clmtypeInitMod.F90 -M src/main/pftdynMod.F90 -M src/main/restFileMod.F90 -M src/main/clmtype.F90 -M src/biogeophys/SnowHydrologyMod.F90 -M src/biogeophys/SurfaceAlbedoMod.F90 -M src/biogeophys/BiogeophysRestMod.F90 -M src/biogeophys/DriverInitMod.F90 - -Miscellaneous: - -M bld/Makefile.in --- Remove NO_R16 CPP token, some changes to start work on jaguar -M test/system/test_driver.sh -- add more machines -M test/system/CLM_runcmnd.sh -- add more machines - -Summary of testing: - - bluevista: All PASS -- except TBL tests because of csm_share shr_const_mod TKFRZ change - bangkok/lf95: All PASS -- except TBL tests because of csm_share shr_const_mod TKFRZ change - blueice: All PASS -- except TBL tests because of csm_share shr_const_mod TKFRZ change - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_90 - - Summarize any changes to answers: larger than roundoff (all config/all machines) - - (No simulations were performed as CCSM scientists deemed the change to be - insignificant) - -=============================================================== -=============================================================== -Tag name: clm3_expa_90 -Originator(s): nanr -Date: Tue Feb 6 13:17:55 MST 2007 -One-line Summary: Changed creategridMod.F90 to read variables from 10min USGS file. - -Purpose of changes: -Added htopo and landfract to retrieve landfrac and topography for processing USGS-gtopo30_10min_c050419.nc - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: nanr - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M creategridMod.F90 - - Added lines to creategridMod.F90 to read variables from USGS-gtopo30-10min_c050419.nc - - ier = nf_inq_varid (ncid, 'landfract', varid) - if (ier == NF_NOERR) then - if (landfracset) write(6,*) trim(subname),' WARNING, overwriting frac' - landfracset = .true. - write(6,*) trim(subname),' read landfract' - call check_ret(nf_inq_varid (ncid, 'landfract', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, domain%frac), subname) - endif - - ier = nf_inq_varid (ncid, 'htopo', varid) - if (ier == NF_NOERR) then - if (toposet) write(6,*) trim(subname),' WARNING, overwriting topo' - toposet = .true. - write(6,*) trim(subname),' read htopo' - call check_ret(nf_inq_varid (ncid, 'htopo', varid), subname) - call check_ret(nf_get_var_double (ncid, varid, domain%topo), subname) - endif - - -Summary of testing: none. Affects tools/mkgriddata only. - - bluesky: - tempest: - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm3_expa_89 -Originator(s): erik,oleson -Date: Feb/02/2007 -One-line Summary: - -Purpose of changes: Use new water table rise calculation in SoilHydrology - -Bugs fixed (include bugzilla ID): 345, 353 - -Describe any changes made to build system: None (although added Darwin to mksrfdat build Makefile) - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Keith Oleson - -List all subroutines eliminated: None - -Remove bld/offline directory tree - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M bld/Makefile.in ---- Add -DFORTRANUNDERSCORE so can compile mpi-serial on IRIX - -Change run scripts so that spmd and smp settings work for both on AND off - -M bld/run-pc.csh ----------------------- Also add LD_LIBRARY_PATH setting -M bld/run-sgi.csh -M bld/run-lightning.csh - -M src/main/spmdMod.F90 ------------------ Remove #ifdef around #include so will - run serial (this is a partial fix to bug 337. The longer term fix is to remove all - #ifdef SPMD as we can use the mpi-serial code to make the serial and SPMD code the same. - -M src/biogeophys/SoilHydrologyMod.F90 --- New drainage formulation from Keith Oleson - -Summary of testing: - - bluesky: -- All but comparision to previous version - tempest: -- All but comparison to previous version and the following restart tests - (These tests fail on previous versions as well -- documented as bug 361) -002 er111 TER.sh 4p_vodsr_dh t31 10+38 ............................FAIL! rc= 11 -003 br111 TBR.sh 4p_vodsr_dh t31 24+24 ............................FAIL! rc= 11 -005 sm116 TSM.sh 4p_vodsr_o t31 48 ................................FAIL! rc= 4 -007 er121 TER.sh 17p_vodsr_dh t31 10+38 ...........................FAIL! rc= 11 -008 br121 TBR.sh 17p_vodsr_dh t31 24+24 ...........................FAIL! rc= 11 -012 er211 TER.sh 17p_cnn_dh t31_cnall 10+38 .......................FAIL! rc= 11 -013 br211 TBR.sh 17p_cnn_dh t31_cnall 24+24 .......................FAIL! rc= 11 -016 er311 TER.sh 4p_casa_dh t31_casa 10+38 ........................FAIL! rc= 11 -017 br311 TBR.sh 4p_casa_dh t31_casa 24+24 ........................FAIL! rc= 11 -020 er411 TER.sh 10p_dgvm_dh t31_dgvm 10+38 .......................FAIL! rc= 11 -021 br411 TBR.sh 10p_dgvm_dh t31_dgvm 24+24 .......................FAIL! rc= 11 - (We are going to remove tempest as a standard test for CLM) - - bangkok/lf95: -- All but comparision to previous version - -CLM tag used for the baseline comparison tests if applicable: none - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change (similar climate) - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: Cray-XT3/jaguar - - configuration (CPP ifdefs): default - - build-namelist command (or complete namelist): - - MSS location of output: /CCSM/csm/b31.020ws/lnd/hist - - URL for LMWG diagnostics output used to validate new climate: Not yet prepared - -=============================================================== -=============================================================== -Tag name: clm3_expa_88 -Originator(s): nanr -Date: Thu Jan 11 12:31:51 MST 2007 -One-line Summary: Minor formatting change in tools. - Correctons to ChangLog - - -Purpose of changes: -1. Update formatted write in tools/ mkgriddata.F90 and tools/mksrfdat.F90 - to accomodate 4 digit lat/lons. -2. Add note to ChangeLog to explain commit by nanr (10/27) that was not tagged. -3. correct Changelog for tag clm3_expa_80. The changes listed below never happened. - surfFileMod.F90 was actually removed from the trunk in a previous tag (clm3_expa_66) - and renamed surfrdMod.F90. So this modification probably reflects the status of the branch - Keith Oleson was working on. - M src/main/surfFileMod.F90 - - Removed statements contained within CN ifdef (OK'd by P. Thornton) that: - - ! the following test prevents the assignment of temperate deciduous - ! vegetation types in the tropics - ! 1. broadleaf deciduous temperate tree -> broadleaf deciduous tropical tree - ! 2. broadleaf deciduous temperate shrub -> broadleaf deciduous tropical tree - ! this reassignment from shrub to tree is necessary because there is currently no - ! tropical deciduous broadleaf shrub type defined. - - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: nanr - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M tools/mksurfdata/mksrfdat.F90 -M tools/mkgriddata/mkgriddata.F90 - - Changed formatting strings to accomodate 4 char lat/lons. - OLD: write (resol,'(i3.3,"x",i3.3)') lsmlat,lsmlon - NEW: write (resol,'(i4.4,"x",i4.4)') lsmlat,lsmlon - -Summary of testing: none. Changes only to tools and ChangeLog - - bluesky: - tempest: - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: none - -IF tag changes answers relative to baseline comparison the -following should be filled in: none - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: NA - - URL for LMWG diagnostics output used to validate new climate: NA - -=============================================================== -=============================================================== -Tag name: clm3_expa_87 -Originator(s): tcraig, jet -Date: Wed Dec 27 05:03:01 GMT 2006 -One-line Summary: merge fme branch, merge refactor_scam branch - -Purpose of changes: bug fixes, reduce memory usage, improve memory scaling, - add mct package, update scam - -Bugs fixed (include bugzilla ID): - #133 adomain,ldomain compare - #290 time bounds problem in history file - #291 fix rtm history bug on bangkok - #301 modify decomp info in i/o - #321 merge refactor_scam branch - -Describe any changes made to build system: none - - consisting of src, dst, S (COL, ROW, S). update the internal clm - atm/lnd mappings to use new datatype. lnd/rtm and driver/atm - mapping still using gridmap_type. this will be updated in future - versions. -- convert domain from 2d global to 1d global arrays. add glo - decomp which is global 1d indexing like ij to 1d or gsn - uncompressed. -- convert wtxy, vegxy, pctspec from 2d to 1d arrays. migrate many other arrays - from 2d global (i,j) to 1d global. this is for nesting and to eventually - cut down on number of index mappings in decomp_type -- reorganize order of initialization calls to start thinking about nesting -- add gatm array to domain datatype -- clean up dead code. -- rename initSubgridMod to subgridMod -- move map_indexes to subgridMod, rename get_subgrid_indexees -- rearrange a few subroutines to improve filename hierarchy and use logic -- delete get_sn routines, no longer needed -- update indexing in clm_atmlnd, remove hardwire indexes -- rewrite i/o as needed for 1d global arrays, not 2d -- delete gatherWeightsDGVM from DGVMMod.F90, no longer needed -- rename surfFileMod to surfrdMod.F90 -- reduce size of subgrid_type and redefine gcelldc and gcellsn - - -Summary of testing: - - bluesky: clm test passes, cam pretag passes except ccsm - tempest: cam pretag passes - bangkok/lf95: cam pretag passes except bl153, bl353, bl553 due to code - changes and resulting binary produced by compiler optimizations. - also scam fails. - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_65, cam3_3_16 - - Summarize any changes to answers: NONE bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_expa_65 -Originator(s): Erik Kluzek -Date: Mon Jul 10 13:52:20 MDT 2006 -One-line Summary: Use share clocks and inputinfo object at driver level - -Purpose of changes: Use new version of esmf_wrf and csm_share as next step - in sequential CCSM development. - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: Add ability to use Darwin, add eshr to -Filepath - -Describe any changes made to the namelist: Instead of directing namelist from stdin - explicitly open namelist filename. Change namelist name from clmexp to clm_inparm. - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Mariana Vertenstein, Tony Craig, Forrest Hoffman - -Externals changed: csm_share to share3_060710 - esmf_wrf_timemgr to esmf_wrf_timemgr_060616 - -List all subroutines eliminated: None - -List all subroutines added and what they do: control_setNL (controlMod.F90) sets the - namelist filename. - -List all existing files that have been modified, and describe the changes: - -tools/newcprnc/Makefile -bld/offline/tests/CLM_namelist.pm -bld/offline/tests/CLM_lab.pm -bld/offline/tests/CLM.pm -bld/offline/tests/model_specs.csh -bld/offline/tests/configure.csh -bld/offline/tests/config_machine_specs.csh -bld/offline/tests/CLM_run.pm -bld/offline/tests/test_batch.csh -bld/offline/tests/Makefile -bld/offline/jobscript.csh - - Add eshr to Filepath, add Darwin as a valid platform, don't redirect unit 5 for -namelist. Set MODEL_DATDIR explicitly. Use lnd.stdin as default namelist name. -Add "-g" to Makefile. Change clm namelist from clmexp to clm_inparm. Get test_batch.csh -to work both on bangkok for Linux/Lahey and tempest for SGI. Write out Rootdir file -when configuring build directory. - -src/main/time_manager.F90 -- Use dayOfYear_r8 for calc_calday. -src/main/clm_comp.F90 ------ Pass CCSMInit in. -src/main/fileutils.F90 ----- Small changes to how using shr_file_mod. -src/main/initializeMod.F90 - Pass clock in. -src/main/program_csm.F90 --- Change where ESMF_Initialize is done. -src/main/controlMod.F90 ---- Add method to set namelist name, pass clock in and use it. -src/main/clm_varctl.F90 ---- Get rid of cam_ variables. -src/main/lnd_comp_mct.F90 -- Pass in clock and CCSMInit object. - -Summary of testing: - - bluesky: test-batch.csh -- PASS and CAM and CAM CCSM tests pass. - tempest: test-batch.csh -- PASS and CAM tests pass. - bangkok/lf95: test-batch.csh -- PASS and CAM tests pass. - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_64 - - Summarize any changes to answers: NONE bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm3_expa_64 -Originator(s): Dani Bundy Coleman -Date: Thu Jun 29 14:44:07 MDT 2006 -One-line Summary: dust modifications from Natalie Mahowald - -Purpose of changes: update dust code - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Mariana Vertenstein - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M src/biogeochem/DUSTMod.F90 - OLD dmt_vma = 2.524e-6_r8 ! [m] Mass median diameter analytic She84 p.75 Table1 - NEW dmt_vma = 3.500e-6_r8 ! [m] Mass median diameter analytic - -M src/main/clm_atmlnd.F90 - add land-to-atmosphere communication of fv,ram1 & dust fluxes - (only active if defined DUST or PROGSEASALT ) -M src/main/lnd_comp_mct.F90 - add land-to-atmosphere communication of fv,ram1 & dust fluxes - (only active if defined DUST or PROGSEASALT ) - -Summary of testing: - - bluesky: tested with cam, bfb when DUST and PROGSEASALT not defined - tempest: - bangkok/lf95: tested with cam, bfb when DUST and PROGSEASALT not defined - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_63 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm3_expa_63 -Originator(s): Mariana Vertenstein -Date: Fri May 12 16:08:03 MDT 2006 -One-line Summary: introduced mct domains in COUP_CAM mode - -Purpose of changes: To introduce generalized mct domains -in COUP_CAM mode for the purposes of generating a sequential -ccsm - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Tony Craig - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: - lnd_comp_mct.f90 - removed lnd_CheckGrid_mct routine and replaced it with lnd_domain_mct - each processor sends it local domain information stored in an MCT - GeneralGrid data structure back to the top level application driver. - A global gather is done for the GeneralGrid and domain comparison is - performed on the master processor. - -Summary of testing: - - bluesky: only cam test suite was run successfully - tempest: only cam test suite was run successfully - bangkok/lf95: only cam test suite was run successfully - -CLM tag used for the baseline comparison tests if applicable: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm3_expa_62 -Originator(s): erik, tcraig -Date: Wed May 10 00:06:39 MDT 2006 -One-line Summary: merge shrgetput08_clm3_expa_61, fix finemesh bugs - -Purpose of changes: changes required for sequential ccsm. validate - finemesh is running properly. - -Bugs fixed (include bugzilla ID): - a couple finemesh bugs, not documented. - -Describe any changes made to build system: modified makefile slightly - to set HIDE_MPI when SPMD is FALSE, remove HIDE_SHR_MSG - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: erik, tcraig - -List all subroutines eliminated: none - -List all subroutines added and what they do: none - -List all existing files that have been modified, and describe the changes: -Makefile: - - remove HIDE_SHR_MSG, not needed anymore - - add HIDE_MPI if SPMD is FALSE -SVN_EXTERNALS: - - change csm_share version from share3_051205 to share3_060428 - - change emsf_wrf_timemgr version from esmf_wrf_timemgr_051212 to esmf_wrf_timemgr_060501 -fileutils.F90: - - uses shr_file_mod.F90 routines - - use shr_file_mod syntax for archive_dir (using mss: prefix) -initializeMod.F90: - - add pnamer_bin get -program_csm.F90: - - add ESMF_Initialize call -clm_atmlnd.F90: - - fix bug in call to grid_maparray for finemesh mapping, only affects finemesh runs. -controlMod.F90: - - use shr_file_mod syntax for archive_dir (using mss: prefix) -lnd_comp_mct.F90: - - change call to get_proc_bounds to get_proc_bounds_atm (bug for finemesh runs). -program_off.F90: - - add calls to ESMF_Initialize and ESMF_Finalize - - -Summary of testing: - bluesky: cam full suite bfb - clm full suite not bfb (TS is bfb for 2 days, history file not bfb - after ~1.5 days probably due to new esmf time manager, likely roundoff) - tempest: cam full suite bfb, ccsm build test - bangkok/lf95: cam full suite bfb - bluevista : ccsm TER.01a.1.9x2.5_gx1v3.B.bluevista bfb - cam finemesh T42half.clim0 test, bfb for 42 timesteps vs cam3_2_49 - lightning : ccsm TER.01a.4x5_gx3v5.B.bluevista bfb - -CLM tag used for the baseline comparison tests if applicable: - clm3_expa_61, cam3_3_4, ccsm3_1_beta27 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: clm standalone only - - what platforms/compilers: only bluesky tested - - nature of change (roundoff; larger than roundoff/same climate; new climate): - assume roundoff. it's bfb for at least a day. in cam and ccsm mode they - are bfb. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? guess - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - -=============================================================== -Tag name: clm3_expa_61 -Originator(s): T Craig -Date: Thu Apr 27 01:10:40 MDT 2006 -One-line Summary: merge cammct05_clm3_expa_58 onto main trunk, - modify surface dataset input - -Purpose of changes: merge branch - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: myself, developed my MV - -List all subroutines eliminated: - clm_camMod.F90 - interface to cam - MCT_atmlnd_cpl.F90 - mct migrated to sequential driver - MCT_lnd_comp.F90 - mct migrated to sequential driver - -List all subroutines added and what they do: - lnd_comp_mct.F90 - interface to sequential driver using mct coupling - -List all existing files that have been modified, and describe the changes: - clm_comp.F90 - separate init method into init1, init2 - initializeMod.F90 - separate initialize into initialize1 and 2 - program_csm.F90 - add call to clm_init0 - clm_atmlnd.F90 - PWorley's changes to improve phoenix performance, - packed arrays in clm_mapa2l and clm_mapl2a interpolation. - program_off.F90 - add call to clm_init0 - areaMod.F90 - PWorley's changes to improve phoenix performance, - interpolate packed arrays in gridmap_maparray - Hydrology2Mod.F90 - remove use of iam - - mksurfdata, several files changed to convert - mksrf_fgrid_global/regional to mksrf_fgrid and mksrf_gridtype - -Summary of testing: - - bluesky: clm full suite bfb, cam full suite bfb - bluevista: ccsm bfb TER.01a.T31_gx3v5.B.bluevista, TER.01a.4x5_gx3v5.B.bluevista - tempest: cam full suite bfb - bangkok/lf95: cam full suite bfb - - mksrf tested on bluevista, 7 cases, bfb - -CLM tag used for the baseline comparison tests if applicable: - clm3_expa_60, cam3_3_2, ccsm3_1_beta25 - -changes are bit-for-bit - -=============================================================== - - -=============================================================== -Tag name: clm3_expa_60 -Originator(s): Forrest Hoffman -Date: Fri Apr 14 11:03:34 EDT 2006 -One-line Summary: Rearranged physiology fields, changed CO2 constants, fixed Bug #43 - -Purpose of changes: Make radiation-related physiology fields standard, prepare code for C-LAMP experiments, and make test-model run on Cray X1E (phoenix) - -Bugs fixed (include bugzilla ID): Bug #43 - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Myself - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - -nfwrappers.f90: -Changed intent for ncid from intent(in) to intent(out) since it must be -returned to the calling routines. This fixed Bug #43 which was discovered -on the Cray X1E (phoenix). - -ChangeLog: -Added this log entry. - -clm_varcon.F90: -Changed co2_ppmv_const to 283.1878_r8 for both CASA' and CN in preparation -for Experiment 1 of the C-LAMP. - -histFldsMod.F90 -Moved LAISUN, LAISHA, TLAI, TSAI, SLASUN, and SLASHA out of the CN-only -section of the code so that they appear on the regular CLM output files -since the two-leaf radiation code is now standard. In addition, TLAI and -TSAI were removed from the DGVM-only section of the code since these -output fields are now standard. - -Summary of testing: - - cheetah: -Ran test-model for T31, T31cn, T31cnall, T31casa, and T31dgvm with -baseline clm3_expa_59. T31 and T31dgvm passed all tests. The others -passed tests 01-05, but not the 06_control test because of the change -in co2_ppmv_const. - - phoenix: -Ran test-model for T31, T31cn, T31cnall, T31casa, and T31dgvm with -baseline clm3_expa_59. T31 and T31dgvm passed all tests. The others -passed tests 01-05, but not the 06_control test because of the change -in co2_ppmv_const. - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_59 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: co2_ppmv_const modification changes answers - - what platforms/compilers: IBM (cheetah) and Cray X1E (phoenix) - - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff because of changes in carbon pools - - If bitwise differences were observed, how did you show they were no worse - than roundoff? cprnc - - * There is no validated climate in these model configurations. * - -=============================================================== -=============================================================== -Tag name: clm3_expa_59 -Originator(s): Tony Craig -Date: Wed Apr 5 18:03:23 MDT 2006 -One-line Summary: add fatmlndfrc capability - -Purpose of changes: Support new datasets, other minor improvements, - update mkgrid and mksurf tools for new dataset generation. - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: jobscript.csh modified for - new surface datasets, change baseline resolution to T31. - -Describe any changes made to the namelist: added optional fatmlndfrc - namelist input for landfrac file on atm grid. - -List any changes to the defaults for the boundary datasets: all new - grid, frac, and surf datasets generated, located in - /fs/cgd/csm/inputdata/lnd/clm2/[griddata,surfdata] - -Describe any substantial timing or memory changes: None - -Code reviewed by: myself - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - -tools/mksurfdata/mkrfdat.F90 - change default output filenames -tools/mksurfdata/mklaiMod.F90 - removed masking since there is no mask anymore -tools/mksurfdata/mkfileMod.F90 - removed read of LANDMASK and LANDFRAC -tools/mksurfdata/creategridMod.F90 - removed write of LANDMASK and LANDFRAC -tools/mksurfdata/Makefile - fix clean bug -tools/mkgriddata/mkgriddata.F90 - add generation of ffracdat file - force area calculation for ccsm domain files due to noise in scrip areas - change default output filenames -tools/mkgriddata/mkvarctl.F90 - add support for area recomputation -tools/mkgriddata/mkfileMod.F90 - removed, merged into creategridMod.F90 -tools/mkgriddata/areaMod.F90 - add flush(6) -tools/mkgriddata/creategridMod.F90 - add mkfile subroutine - fix bug in setting of corner points - handle wrap-around points better with corner points - add ability to adjust units of area (not automatic) - add checks for area - add ability write eigher grid or frac file in write_domain -bld/offline/tests/test_batch.csh - change default version from 53 to 58 - turn on dgvm testing by default -bld/offline/jobscript.csh - change to share queue on bluesky - run mixed mpi/openmp by default, 2x2 - change default resolution to T31 (was T42) - update to use new surface datasets - change default, turn on DUST, RTM, VOC, turn off CN, SUPLN, SUNSHA, STOMATA2 - add unlimit unlimited for AIX - fix redirection to compile_log.clm output file -src/main/initializeMod.F90 - add fatmlndfrc stuff - add computation of ldomain%frac and ldomain%mask -src/main/controlMod.F90 - add fatmlndfrc stuff -src/main/clm_varctl.F90 - add fatmlndfrc stuff -src/main/driver.F90 - remove redundant definition of caldayp1 -src/main/clmtypeInitMod.F90 - remove landfrac variable for clm3 gridcell_type -src/main/histFileMod.F90 - add indxupsc, jndxupsc indices for upscaling -src/main/program_csm.F90 - move shr_msg_stdio to after MPI_INIT, change - call so it only redirects log file for masterproc. this will clean - up the log file significantly but may lead to error messages ending - up in stdout. -src/main/surfFileMod.F90 - add fatmlndfrc stuff -src/main/initGridCellsMod.F90 - remove landfrac variable for clm3 gridcell_type -src/main/domainMod.F90 - reorder domain data slightly (nothing changed) -src/main/areaMod.F90 - change default of i_ovr and j_ovr from bigint to -1, - allows for cleaner writing of indxupsc and jndxupsc in history file. - change gridmap_setmapsFM to use _a and _l notation instead of _i and _o -src/main/clmtype.F90 - remove landfrac from clm3 gridcell_type - - -Summary of testing: - - Baseline versions, clm3_expa_58, cam3_2_56, ccsm3_1_beta24 - - bluesky: clm full suite passes, cam full suite passes - tempest: cam full suite passes - bangkok/lf95: cam full suite passes - bluevista: ccsm TER.01a B passes for several resolutions, new datasets - in scripts - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_58 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Code changes are bfb, but answers may change when using new surface datasets - - Summarize any changes to answers, i.e., - - what code configurations: CCSM answers will change with new datasets as - default datasets are changing. clm default test is bfb at T31 with new datasets, - cam will be bfb as current default datasets are not being updated. - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - - -=============================================================== -Tag name: clm3_expa_58 -Originator(s): Forrest Hoffman -Date: Thu Mar 9 17:04:27 EST 2006 -One-line Summary: Updates for the Cray X1E and a forcing height error check. - -Purpose of changes: Improvements on the Cray X1E and avoiding arithmetic exceptions when the forcing height is below the canopy height. - -Bugs fixed (include bugzilla ID): Bug #36 - -Describe any changes made to build system: jobscript.csh modified for Cray X1E - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: myself and (for forcing height check code) Mariana Vertenstein - -List all subroutines eliminated: None - -List all subroutines added and what they do: None - -List all existing files that have been modified, and describe the changes: - - jobscript.csh - Modified for Cray X1E and cross-compiler - inicFileMod.F90 - Added compiler directives for vectorization - driver.F90 - Commented out CSDs to avoid model hangs caused by write - statements in science routines within the associated loops - controlMod.F90 - Changed default clump_pproc to 1 for the Cray (since CSDs - are not used in driver.F90 - histFldsMod.F90 - Changed type2d='levlak' for the TLAKE field - CanopyFluxesMod.F90 - Inserted code to check if the forcing height - is below the canopy height for any pft. Model will now abort when this - occurs instead of taking the log() of a negative number. See Bug #36 - -Summary of testing: - - bluesky: test-model ran as follows -01_debug_run_SPMD: T31 ran -02_debug_run_nonSPMD: T31 ran -03_start: T31 ran -04_restart: T31 ran -05_norestart_compare_to_restart: T31 ran -06_control: T31 ran -01_debug_run_SPMD: T31cn ran -02_debug_run_nonSPMD: T31cn ran -03_start: T31cn ran -04_restart: T31cn ran -05_norestart_compare_to_restart: T31cn ran -06_control: T31cn ran -01_debug_run_SPMD: T31cnall ran -02_debug_run_nonSPMD: T31cnall ran -03_start: T31cnall ran -04_restart: T31cnall ran -05_norestart_compare_to_restart: T31cnall ran -06_control: T31cnall ran -01_debug_run_SPMD: T31casa ran -02_debug_run_nonSPMD: T31casa ran -03_start: T31casa ran -04_restart: T31casa ran -05_norestart_compare_to_restart: T31casa ran -06_control: T31casa ran - cheetah: -01_debug_run_SPMD: T31cnall ran -02_debug_run_nonSPMD: T31cnall ran -03_start: T31cnall ran -04_restart: T31cnall ran -05_norestart_compare_to_restart: T31cnall ran -06_control: T31cnall ran -01_debug_run_SPMD: T31 ran -02_debug_run_nonSPMD: T31 ran -03_start: T31 ran -04_restart: T31 ran -05_norestart_compare_to_restart: T31 ran -06_control: T31 ran -01_debug_run_SPMD: T31cn ran -02_debug_run_nonSPMD: T31cn ran -03_start: T31cn ran -04_restart: T31cn ran -05_norestart_compare_to_restart: T31cn ran -06_control: T31cn ran -01_debug_run_SPMD: T31casa ran -02_debug_run_nonSPMD: T31casa ran -03_start: T31casa ran -04_restart: T31casa ran -05_norestart_compare_to_restart: T31casa ran -06_control: T31casa ran - tempest: - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_57 - -=============================================================== -Tag name: clm3_expa_57 -Originator(s): Peter Thornton -Date: 31 Jan 2006 -One-line Summary: Mods to allow switching between 3 and 4 soil - organic matter pools - -Purpose of changes: New science. - -Bugs fixed (include bugzilla ID): bugs in pftdynMod.F90 and ndepfileMod.F90 - -Describe any changes made to build system: - -Describe any changes made to the namelist: Added SOM4 as new CPP directive - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: none - -Code reviewed by: myself - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: -main/clmtype.F90: added soil4c (and 13C equiv.), soil4n states and associated - flux variables. Also added long name commenting for many previously defined - variables. -main/clmtypeInitMod.F90: added initialization for new variables -main/CNiniTimeVar.F90: initialize new state variables. -main/histFldsMod.F90: added new variables, and also added long names for - many previously defined variables. -main/pftdynMod.F90: bug fix in mpi_bcast, change MPI_REAL8 to MPI_INTEGER. -main/ndepFileMod.F90: bug fix for mpi_bcast, change MPI_REAL8 to MPI_INTEGER. -biogeochem/CNSetValueMod.F90: add code for new state and flux variables. -biogeochem/CNDecompMod.F90: add code to allow either 3 or 4 SOM pools. Default - behavior is 3 pools, 4-pool behavior triggered by SOM4 CPP directive. -biogeochem/CNCStateUpdate1Mod.F90: handling for new variables. -biogeochem/CNNStateUpdate1Mod.F90: handling for new variables. -biogeochem/CNSummaryMod.F90: handling for new variables. -biogeochem/CNBalanceCheckMod.F90: handling for new variables -biogeochem/CNPrecisionControlMod.F90: handling for new variables -biogeochem/CNC13FluxMod.F90: handling for isotope version of new variables -biogeochem/C13StateUpdate1Mod.F90: handling for new variables -biogeochem/C13SummaryMod.F90: handling for new variables -biogeochem/CNrestMod.F90: handling for new variables, and modify EXIT_SPINUP - controls - -Summary of testing: - - bluesky: - tempest: - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: in 3-pool mode -(SOM4 not set), results are bfb with clm3_expa_55. in 4-pool mode, changes -answers, as expected. - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: -bfb under 3-pools is demonstrated at: -http:/www.cgd.ucar.edu/tss/clm/diagnostics/clm3cn/c13/ccsm3_bgc31_I_5a-ccsm3_bgc31_I_2b/setsIndex.html - -=============================================================== -Tag name: clm3_expa_56 -Originator(s): Tony Craig -Date: 31 Jan 2006 -One-line Summary: Final changes for finemesh implementation. - -Purpose of changes: Integrate final changes for finemesh implementation. These -changes are 100% backward compatable and bfb, but also support use of a finemesh grid. finemesh implementation has been test in clm and cam. - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: Update Makefile so Depends are regenerated if any code is changed. - -Describe any changes made to the namelist: Added one new optional namelist, fatmgrid. This is a dataset for the coarse grid in clm. The format is the same as the surface dataset but only needs to include grid variables. - -List any changes to the defaults for the boundary datasets: Generated some new datasets with filled wetland and higher resolution. Not required and not yet added to default suite of datasets. - -Describe any substantial timing or memory changes: - -Code reviewed by: - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - -tools/mksurfdata: - mksrfdat.F90,areaMod.F90,creategridMod.F90 -bld/offline/Makefile -doc/ChangeLog - src/main: -clm_comp.F90,driver.F90,clm_camMod.F90,atmdrvMod.F90,clmtypeInitMod.F90,initializeMod.F90,histFileMod.F90,program_csm.F90,clm_atmlnd.F90,clm_csmMod.F90,surfFileMod.F90,controlMod.F90,clm_varctl.F90,initGridCellsMod.F90,MCT_lnd_comp.F90,program_off.F90,domainMod.F90,decompMod.F90,areaMod.F90,clmtype.F90 -src/biogeophys/SurfaceAlbedoMod.F90 - -Code changes: -add pftm to domain datatype and history file -modify program_off and program_cs to use clm_init[1,2], clm_run[1,2] -modify coupling to handle coarse <-> finemesh for standlaone, cam, and - ccsm. -modify Makefile so depends file is reset whenever there is a code change -add normalized area to history files -add lat_a, lon_a, latdeg_a, londeg_a to clm3 datatype for atm lats/lons. - required in SurfaceAlbedo computation where the the zenith angle has - to be based on the atm (coarse) grid, not the fine clm grid. -merge with clm3_expa_53_brnchT_cam01 tag - -Summary of testing: - - bluesky: clm full suite bfb, cam full suite bfb, ccsm bfb - tempest: cam full suite bfb - bangkok/lf95: cam full suite bfb - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_55 - -IF tag changes answers relative to baseline comparison the -following should be filled in: bfb - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? bfb - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -Tag name: clm3_expa_55 -Originator(s): Peter Thornton -Date: 24 Jan 2006 -One-line Summary: Fixes for 13C isotope code, migration from cvs - -Purpose of changes: - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: myself - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: -Files modified: -1. CNFireMod.F90 -Added initialization of variable mep. - -2. CNrestMod.F90 -Added EXIT_SPINUP controls on column-level 13C pools - -3. C13SummaryMod.F90 -Added current and excess maintenance respiration terms to summary MR variable. - -4. CNC13FluxMod.F90 -Added new routines to calculate 13C fluxes. Litter to column, non-mortality fluxes -at the column level, pft-level gap mortality fluxes, pft and column level fire mortality fluxes, - -5. CNEcosystemDynMod.F90 -Added calls for C13Flux2, C13Flux3, C13StateUpdate2, and C13StateUpdate3. - -6. clm_varcon.F90 -Added parameters to define a fixed pre_industrial del13C (set to -6 permil) - -Summary of testing: - - bluesky: - tempest: - bangkok/lf95: - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_40 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - -Changes answers for CN only, and then only for the isotope prognostics. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: -http://www.cgd.ucar.edu/tss/clm/diagnostics/clm3cn/c13/ccsm3_bgc31_I_2a-ccsm3_bgc26_I_1d/setsIndex.html -=============================================================== -Tag name: clm3_expa_54 -Originator(s): Tony Craig -Date: 17 Jan 2006 -One-line Summary: Update infrastructure in support of finemesh, migration from cvs - -Purpose of changes: bfb infrastructure changes committed, partial step towards finemesh implementation - -Bugs fixed (include bugzilla ID): None - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: Some memory added for extra coarse grid, atmosphere domain, as well as changes to interpolation datatypes and code. Redundant memory deleted from some datasets. - -Code reviewed by: Mariana Vertenstein - -List all subroutines eliminated: - -List all subroutines added and what they do: - -List all existing files that have been modified, and describe the changes: - -src/main: -initGridIndexMod.F90,lnd2atmMod.F90,CNiniTimeVar.F90,abortutils.F90,clm_comp.F90,driver.F90,clm_camMod.F90,atmdrvMod.F90,subgridRestMod.F90,accFldsMod.F90,clmtypeInitMod.F90,initializeMod.F90,pftdynMod.F90,iniTimeConst.F90,histFileMod.F90,program_csm.F90,clm_atmlnd.F90,clm_varsur.F90,clm_csmMod.F90,restFileMod.F90,surfFileMod.F90,controlMod.F90,initSurfAlbMod.F90,initSubgridMod.F90,clm_varctl.F90,ndepFileMod.F90,initGridCellsMod.F90,MCT_lnd_comp.F90,program_off.F90,domainMod.F90,decompMod.F90,areaMod.F90,clmtype.F90,histFldsMod.F90 - -src/riverroute: -RtmMod.F90 - -src/biogeochem: -CASAMod.F90,DUSTMod.F90,CNPhenologyMod.F90,STATICEcosysDynMod.F90,DGVMMod.F90,CNrestMod.F90,VOCEmissionMod.F90,CNNDynamicsMod.F90,CNVegStructUpdateMod.F90 - -src/biogeophys: -BalanceCheckMod.F90,SurfaceRadiationMod.F90,SoilTemperatureMod.F90,Biogeophysics1Mod.F90,Biogeophysics2Mod.F90,FrictionVelocityMod.F90,Hydrology1Mod.F90,Hydrology2Mod.F90,BiogeophysicsLakeMod.F90,HydrologyLakeMod.F90,BareGroundFluxesMod.F90,CanopyFluxesMod.F90 - -bld/offline/tests: -CLM_lab.pm,test_batch.csh - -tools/mksurfdata: -mkdynpftMod.F90,mkgridMod.F90,shr_timer_mod.F90,mklaiMod.F90,mkglacier.F90,mkurban.F90,fileutils.F90,mksoitex.F90,mkfileMod.F90,domainMod.F90,areaMod.F90,creategridMod.F90,mkvarsur.F90,mksrfdat.F90,nanMod.F90,mklanwat.F90,mksoicol.F90,Makefile,mkpftMod.F90 - -tools/mkgriddata: -mkvarctl.F90,fileutils.F90,mkgriddata.F90,mkfileMod.F90,domainMod.F90,areaMod.F90,creategridMod.F90,mkvarsur.F90,nanMod.F90,Makefile - -Code changes: -Merge atm2lnd_state_type, atm2lnd_flux_type. Same for lnd2atm state/flux. - Related changes in clm3 and elsewhere in code. -Add domainMod.F90 and domain_type. Migrate grid data into domain type. - Instantiate adomain(atm/coarse), ldomain(lnd/finemesh), rdomain(rtm), - ddomain(atmdrv external data) in model. -Add lats, latn, lonw, lone 2d arrays and associated code changes. -Cleanup areaMod.F90; merging subroutines, removing redundant code, eliminate - *_point routines. -Remove numlon -Add decomp_type for gcelldc and gcellsn. Remove redundant data in other - arrays related to addressing physical space and logical space. -Clean up interface in set_landunit subroutines. Remove redundant code. -Clean up procs and clumps datatypes, removing redundant data. -Migrate clm3 topology data to pointers from copies -Add gridmap_type for interpolation and associated code and routines to - support the type. -Add clm_atmlnd.F90 file for upscale/downscale code. Add clm_mapa2l - and clm_mapl2a to carry out mapping associated with upscale/downscale. -Add gridmap_setmapsFM for generation of weights for downscale/upscale - routines. -forc_ndep should not be in atm2lnd_type. -Reuse code as much as possible throughout. -Update mksurfdata, mkgriddata. Speed code up, bfb, new fields added, - new input options for files. Fill with wetland, add PFTDATA_MASK - field for real/fake land. -Update code to clm3_expa_53 -Rename latixy and longxy to latc and lonc. -Remove fullgrid attribute. - -Summary of testing: - - bluesky: full clm test, full cam test - tempest: full cam test - bangkok/lf95: full cam test - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_53 - -IF tag changes answers relative to baseline comparison the -following should be filled in: bfb - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? bfb - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: clm3_expa_53 -Originator(s): Mariana Vertenstein -Date: Fri Dec.16 2005 -One-line Summary: Put in MCT communication for cam-clm coupling - -Purpose of changes: removed lp_coupling communication and put in -MCT communication interfaces - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the input datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Mariana Vertenstein, Rob Jacob - -List all subroutines eliminated: none - -List all subroutines added and what they do: - main/MCT_atmlnd_cpl.F90 - clm/cam MCT coupling interface - will be moved out of clm code in - near future - main/MCT_lnd_comp.F90 - clm MCT wrapper layer - main/clm_comp.F90 - module containing wrapper routines that separate clm into chunks of - code that contain no communication (e.g. clm_run1, clm_run2 has no - communicaiton). This is needed to satisfy requirement for implementing - multiple coupling interfaces (e.g. concurrent/MCT, sequential/MCT, - sequential/ESMF) within ccsm. - main/clm_varorb.F90 - module for orbital parameters - (this will be added to program_off.F90 and program_csm.F90) - -List all existing files that have been modified, and describe the changes: - clm_camMod.F90 - all coupling still exists here - -Summary of testing: - - bluesky: - test-model.pl -res T31 - test-model.pl -res T31cn - test-model.pl -res T31cnall - test-model.pl -res T31casa - test-model.pl -res T31dgvm - - tempest: No testing - - bangkok/lf95: No testing - -CLM tag used for the baseline comparison tests if applicable: clm3_expa_48 - results were bfb with clm3_expa48 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - - MSS location of control simulations used to validate new climate: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: clm3_expa_52 -Originator(s): Mariana Vertenstein -Date: Tues Dec.12 2005 -One-line Summary: Put in scam fix needed in CAM mode - -Purpose of changes: clean up svn clm structure - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: -None - -Describe any changes made to the namelist: -None - -List any changes to the defaults for the input datasets: -None - -Describe any substantial timing or memory changes: -None - -Code reviewed by: -Mariana Vertenstein - -List all subroutines eliminated: -None - -List all subroutines added and what they do: -None - -List all existing files that have been modified, and describe the changes: -clm_camMod.F90 (this change was put into cam3_2_41) - -Summary of testing: -No testing done - -CLM tag used for the baseline comparison tests if applicable: -NA - -IF tag changes answers relative to baseline comparison the -following should be filled in: - -Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: clm3_expa_51 -Originator(s): mvr -Date: Tues Dec.12 2005 -One-line Summary: removed src/utils dir - -Purpose of changes: should've been done with external setup in prev tag - -Bugs fixed (include bugzilla ID): none - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the input datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: mvr, mvertens - -List all subroutines eliminated: -D src/utils - -List all subroutines added and what they do: -none - -List all existing files that have been modified, and describe the changes: -none - -Summary of testing: - -bluesky: none -tempest: none -bangkok/lf95: none - -CLM tag used for the baseline comparison tests if applicable: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - -Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? b4b - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -Tag name: clm3_expa_50 -Originator(s): Mariana Vertenstein -Date: Tues Dec.12 2005 -One-line Summary: Updated external definitions for utils - -Purpose of changes: clean up svn clm structure - -Bugs fixed (include bugzilla ID): - -Describe any changes made to build system: -None - -Describe any changes made to the namelist: -None - -List any changes to the defaults for the input datasets: -None - -Describe any substantial timing or memory changes: -None - -Code reviewed by: -NA - -List all subroutines eliminated: -None - -List all subroutines added and what they do: -None - -List all existing files that have been modified, and describe the changes: -None - -Summary of testing: -No testing done - -CLM tag used for the baseline comparison tests if applicable: -NA - -IF tag changes answers relative to baseline comparison the -following should be filled in: - -Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - -If bitwise differences were observed, how did you show they were no worse -than roundoff? - -If this tag changes climate describe the run(s) done to evaluate the new -climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - configuration (CPP ifdefs): - - build-namelist command (or complete namelist): - - MSS location of output: - -MSS location of control simulations used to validate new climate: - -URL for LMWG diagnostics output used to validate new climate: - -=============================================================== - -Tag name: clm3_expa_49 -Originator(s): Mariana Vertenstein -Date: Mon Dec 12 2005 -One-line Summary: Updated clm with changes put into cam3_2_38 - -Purpose of changes: -Cray-X1E OpenMP/CSD compatibility modifications. - -Bugs fixed (include bugzilla ID): -None - -Describe any changes made to build system: -None - -Tested that restarts are bit-for-bit: yes -Tested that different domain decompositions match bit-for-bit: yes -Code reviewed by: myself -Changes answers: no (bit-for-bit) -Changes made: - -This is the start of the clm_exp experimental development -branch. This version is the same as clm3_deva_10 which was checked -into clm_dev by Mariana Vertenstein on April 27th, 2004. -=============================================================== -=============================================================== -=============================================================== diff --git a/doc/clm4_0_ChangeLog b/doc/clm4_0_ChangeLog deleted file mode 100644 index 24ab7a6911..0000000000 --- a/doc/clm4_0_ChangeLog +++ /dev/null @@ -1,16442 +0,0 @@ -=============================================================== -Tag name: clm4_0_81 -Originator(s): bandre (Benjamin Andre) -Date: Mon Apr 29 12:12:42 MDT 2013 -One-line Summary: Charlie Koven's variable consolidation, cryoturbation and BSW CPP changes - -Purpose of changes: - 1) variable consolidation -- these are all things like adding up - the leafc_to_litr1c, stemc_tolitr1c, frootc_to_litr1c, etc. into a - single set of fluxes, e.g. phenology_c_to_litr_met_c. this - introduces roundoff-level differences in every calculation of C - and N from plants to litter, so it will propagate quickly to - everywhere in the CN and CN4Me code. - - 2) cryoturbation - the changes to the active layer profiles. This - should have a real but minor effect everywhere where there is - permafrost, because it will change the mixing rates of all soil - material into and out of the permafrost. However, this is so slow - that it should only really matter during spinup. - - 3) BSW bugfix - Remove the STNDRD_BSW_FOR_SOILPSI_CALC CPP - token. This had already been set in the CN4Me code, but will cause - real changes to both the drought phenology and frozen temperature - sensitivity of the CN code. - - -Requirements for tag: - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - remove the CPP flag for STNDRD_BSW_FOR_SOILPSI_CALC - -Describe any changes made to the namelist: - remove: shape_fluxprof, max_altmultiplier_cryoturb, max_altdepth_cryoturbation - add: max_altdepth_cryoturbation, max_depth_cryoturb - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: variable consolidation should decrease runtime - -Code reviewed by: Charlie Koven - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - - remove configure option for BSW - M models/lnd/clm/bld/configure - M models/lnd/clm/bld/config_files/config_definition.xml - - remove of BSW ifdef - M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_BGC.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_CENTURY.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 - M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 - M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 - M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 - - - add/remove nl options for cryoturbation - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - - - cryoturbation - M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 - M models/lnd/clm/src/clm4_5/main/controlMod.F90 - - - variable consolidation - M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate2Mod.F90 - M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 - M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 - M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 - M models/lnd/clm/src/clm4_5/main/clmtype.F90 - M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes, two unexpected fails on comparison, should pass next time. - - CESM test lists: - - yellowstone/aux_clm intel yes - New expected failures: - all compare_hist tests with CLM45CN test should fail, but be ok next time (answer changes) - ERS_D.f10_f10.ICLM45CN4Me.nldir_ch4_set2_ciso - CFAIL - test needs to be updated to remove shape_fluxprof from namelist - ERS_D.f10_f10.ICLM45CN4Me.nldir_ch4_set3_pftroot - CFAIL - test needs to be updated to remove shape_fluxprof from namelist - PET_D_P1x30.ne30_g16.ICN - FAIL - runtime mpi abort from pio. fixed in pio-1.6.8? - SMS_RLA.f45_f45.I - FAIL - runtime mpi abort from pio. fixed in pio-1.6.8? - SMS_RLA.f45_f45.ICLM45 - FAIL - runtime mpi abort from pio. fixed in pio-1.6.8? - SMS_ROA.f45_f45.I - FAIL - runtime mpi abort from pio. fixed in pio-1.6.8? - SMS_ROA.f45_f45.ICLM45 - FAIL - runtime mpi abort from pio. fixed in pio-1.6.8? - - yellowstone/aux_clm pgi yes - New expected failures: - all compare_hist tests with CLM45CN test should fail, but be ok next time (answer changes) - SMS_RLB.f45_f45.I - FAIL- runtime mpi abort from pio. fixed in pio-1.6.8? - SMS_RLB.f45_f45.ICLM45 - FAIL - runtime mpi abort from pio. fixed in pio-1.6.8? - - frankfurt/aux_clm_int intel no - frankfurt/aux_clm intel no - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_80 - -Changes answers relative to baseline: yes - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: CLM45, all CN and CN4Me compsets - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - variable consolidation - roundoff - cryoturbation - larger than roundoff/same climate - BSW - climate changing - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database): - - This will change climate only in CN (not CN4Me mode), because of - the changed BSW (removal of incorrect second BSW formulation) - leading to slight differences in phenology. This has been fixed - in CN4Me for some time, and has not been observed to detrimentally - effect the climate in that configuration. - - I (Charlie Koven) ran trunk tag 80 and the branch synced to tag 80 for - 30 years at f19 resolution in I1850CLM45CN4Me compset, with AD spinup - turned on. I did not find sytematic differences in GPP or NEE. The - difference is that there was somewhat less passive pool carbon - mixed to the ~3m soil layer, and somewhat more accumulatin gin the - ~2m layer; this is consistent with the changes to the - crypoturbation code, which sets a fixed depth of cryoturbation - throughout the permafrost region, instead of making it - proportional to active layer thickness. - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_0_80 -Originator(s): erik (Erik Kluzek) -Date: Fri Apr 26 02:28:39 MDT 2013 -One-line Summary: Bring Fang Li. Fire model into CLM4.5 science, update ALL CLM4.5 surface datasets, - provide a working initial condition file for CLM45BGC@f19_g16-1850 - -Purpose of changes: Bring the F. Li and S. Levis Fire model for CLMCN and CLMBGC based on -Li et al. (2012a,b; 2013). New data streams are added to bring in lightning frequency -(NASA-LIS climatology of 1995-2011 interpolated to T62) and human population density at half-degree -(currently from 1850 to 2010, no rcp data is available yet). Annual 1850–2010 population -density that is obtained by temporal linear interpolation of the data from HYDEv3.1 -(prior to 1990) and GPWv3 (since 1990) at 0.5 degree resolution. GDP (Gross Domestic Product), -peat fraction, and maximum month for agricultural fires are also included on the -surface datasets. Fang Li tuned the fire model based on a branch version -(newfire05_clm45sci15_clm4_0_58) at f19_g16 resolution with CLMBGC for transient 1850-2000 -with Qian atmosphere forcing. New fire fields are read in from the pft-physiology file. - -ALL CLM4.5 surface datasets and pftdyn datasets were updated. ALL standard datasets -now have glc_nec=10 data on them and CAN be used for IG simulations with CISM for -10 glacier elevation classes. The standard way of running is still -with glc_nec=0. Surface datasets include data used by previous parameterizations added in CLM4.5: - - ZWT0, F0, and P3 for the CLM4Me methane model - (PH can be read in on the surface dataset, but is NOT included on the current datasets) - LAKEDEPTH for the Subin variable depth lake model - (ETALAKE and LAKEFETCH can be read in, but are NOT included on the current datasets) - SLOPE, STD_ELEV for the Swenson dynamic wetlands parameterization - binfl, Ds, Dsmax, Ws for the optional VIC hydrology scheme (only read in when VIC active) - gdp, peatf, and abm for the new fire model above - (always read in although it wouldn't HAVE to be for CLMSP) - -Also provide one working initial condition file for CLM45BGC at 1.9x2.5_gx1v6 resolution for 1850. This -will work for CLM45BGC (-vsoil_centbgc on) as long as the vertical carbon profiles are active. No other -initial condition files are provided at this time. This was from year 51 of a CLMBGC spinup simulation -by Fang Li with Qian forcing for 1850 (case qian_1850). - -Bug fix, from Sam Levis so that non-irrigated prognostic crop for CLM4.5 works correctly. Previously -irrigated and non-irrigated crop for CLM4_5 gave the same results (with irrigation active even when -you told it NOT to be). - -Also transient simulations are now allowed to be done with a cold start -- YOU SHOULD NEVER DO THIS FOR SCIENCE! -It does help facilitate testing however. - -Requirements for tag: - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - 1670 (irrigated crop and non-irrigated crop for CLM45 give same answers) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: New light_streams and popd_streams namelists for CLM - By default the light_stremas namelist runs over the NASA_LIS climatology data (3-hourly). - The population density namelist runs over the applicable years for the use_case given for the compset. - This can be customized with: - stream_year_first_popdens, stream_year_last_popdens, model_year_align_popdens - (and the filename and map-algorithm can be changed as well) - -List any changes to the defaults for the boundary datasets: All surfdata, finidat, and pftdyn - datasets for clm4_5 were updated - -Code reviewed by: self, slevis, fangli - -List any svn externals directories updated (csm_share, mct, etc.): pio - pio to pio_1_6_7 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/listDefaultNamelist.pl -- Get working for clm4_5. - M models/lnd/clm/bld/build-namelist ---------- check vsoilc_centbgc for finidat files, new light_streams and - popd_streams namelists for clm4_5 - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- all new fsurdat, fpftdyn datasets, settings - for new popd_streams and light_streams namelists - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add new light_streams and popd_streams namelists - ->>>>>>>>>>>> Set first and last pop-dens year, and do "arb_ic" rather than "startup" ->>>>>>>>>>>> type for all transient cases (allow transient cases to do a cold-start) ->>>>>>>>>>>> ALTHOUGH YOU SHOULD NEVER DO A COLD START FOR A TRANSIENT CASE! - M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - ->>>>>>>>>>>> Some small changes to documentation about irrigation. - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - - M models/lnd/clm/src/util_share/ndepStreamMod.F90 -- make default private, namelist data private, and clm_domain_mct public - - M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 --- add number of individuals - M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 -- handle more impacts of fire - M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 ----------- Fire module -- almost entirely replaced. Two new public - methods added: -+ public :: CNFireInit ! Initialization of CNFire -+ public :: CNFireInterp ! Interpolate fire data - M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -------- Handle more impacts of fire - M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -- Handle more impacts of fire - M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 ----------- burndate, lfc, wf, btran2, col_ctrunc, totsomc added to restart - old fire fields removed, _vr fields required if expected., - M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 --- Add CNFireInit, and update CNFireArea call. - M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 ------- Set fire variables. - M models/lnd/clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 farea_burned impacts SAI for stubble after harvest - M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -------------- Initialize new fire variables - M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 --------- Update CNEcosystemDynInit call - M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 ---------------- Add prec10 and prec60 (10 and 60 day total precipitation) - M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 ------------ Initialize new fire variables. - M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 ----------------- Update lf_conv_cflux, make PFT weight check same as for surfrdMod.F90 - M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -------------- Read in new fire data, abort if data needed NOT found on the - surface dataset. - M models/lnd/clm/src/clm4_5/main/findHistFields.pl ------------- Also read in CNFireMod for history fields. - M models/lnd/clm/src/clm4_5/main/clm_driver.F90 ---------------- Add CNFireInterp call. - M models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -------------- Initialize lf_conv_cflux to zero. - M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 ----------------- Read in new fire parameters - (no longer need "resist" on the pft-physiology file) - M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 ----------------- Fix tolerances to match mksurdata_map - bug fix for non-irrigated crop. - M models/lnd/clm/src/clm4_5/main/clmtype.F90 ------------------- New fire fields - M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -------------- Initialize some new fire fields: tsoi17, fsat - M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 --------------- New fire history fields - M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 ----- Save btran2, smp_node_lf for fire - M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 ------- Save wf2, tsoi17, h2osoi_liqice_10cm - - M models/lnd/clm/src/clm4_0/main/surfrdMod.F90 ----------------- Fix tolerances to match mksurdata_map - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - - CESM test lists: - - yellowstone/aux_clm intel yes - yellowstone/aux_clm pgi yes - frankfurt/aux_clm_int intel yes - frankfurt/aux_clm intel yes - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_79 - -Changes answers relative to baseline: YES! - - Summarize any changes to answers: - - what code configurations: All with CLM45 - - what platforms/compilers: All - - nature of change: new climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - /glade/p/cesm/lmwg/cases/cesm1/C20new -- on yellowstone - /glade/scratch/erik/archive/clm4079_NewFire10f19_CRU_20TR_CN4Me - /glade/scratch/erik/archive/clm4077_I1850CLM45CN4Me - /glade/scratch/erik/archive/clm4077_NewFire10f19_QIAN_20TR_CN4Me - hsi:/home/fangli/qian20 - -=============================================================== -=============================================================== -Tag name: clm4_0_79 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Wed Apr 24 20:27:01 MDT 2013 -One-line Summary: pftdyn, pft-phys*.nc and datm8 update - -Purpose of changes: From Erik:: - update Don't re-weight pftdyn if weights are essentially identical (Both CLM40 AND CLM45). - - Turn wasteheat to "ON" in CLM45. (namelist change) (done) - - Change from Sam Levis for CROP to pft-physiology file so that CROP parameter is in Kelvin rather than Celsius (both CLM40 and CLM45). - - Change datm so that LWDN is NOT read from files for CRUNCEP (datm8_130424). - -Requirements for tag: fix bug 1621 - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): fixed 1621 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: turn waste heat on in clm4_5 - -List any changes to the defaults for the boundary datasets: change pft-phys files for 4_0 and 4_5 - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, Erik, Dave Lawrence - -List any svn externals directories updated (csm_share, mct, etc.): - -< models/atm/datm https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_130424 ---- -> models/atm/datm https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_130325 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M SVN_EXTERNAL_DIRECTORIES - update to datm8_130424 - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml - - $CSMDATA/lnd/clm2/pftdata/pft-physiology.clm40.c130424.nc -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - - change ON_WASTEHEAT to ON - - use $CSMDATA/lnd/clm2/pftdata/pft-physiology.c130424.nc - -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_0/main/pftdynMod.F90 - - change wtpfttot2 check - -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - syntax clean up - caught by Ben Andre - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK. many expected failures due to new pft-physiology files. Should pass next time. - - CESM test lists: - Many nlcomp failures: - clm4_5: - NEW: fpftcon = '/fs/cgd/csm/inputdata/lnd/clm2/pftdata/pft-physiology.c130424.nc' - BASELINE: fpftcon = '/fs/cgd/csm/inputdata/lnd/clm2/pftdata/pft-physiology.c121025.nc' - NEW: urban_hac = 'ON' - BASELINE: urban_hac = 'ON_WASTEHEAT' - clm4_0: - NEW: fpftcon = '/fs/cgd/csm/inputdata/lnd/clm2/pftdata/pft-physiology.clm40.c130424.nc' - BASELINE: fpftcon = '/fs/cgd/csm/inputdata/lnd/clm2/pftdata/pft-physiology.c110425.nc' - - component_gen_comp: all PASS or BFAIL1 - summarize_cprnc_diffs: differences in CLM files - - yellowstone/CESM: - intel: OK. Expected failures for compare_hist (should pass next time) - FAIL ERS_D.f19_g16.IGRCP26CN.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - FAIL ERS_D.f19_g16.IRCP85CN.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - FAIL ERS_E.f19_g16.I1850CRUCLM45CN.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - FAIL NCK.f10_f10.ICRUCLM45.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - FAIL PET_PT.f10_f10.I20TRCN.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - FAIL SMS.f19_g16.IRCP45CN.yellowstone_intel.GC.222079.compare_hist.clm4_0_78 - pgi : OK. Expected failures for compare_hist (should pass next time) - FAIL ERS_D.hcru_hcru.I_2000_CRUFRC_CLM45_CN.yellowstone_pgi.GC.111079.compare_hist.clm4_0_78 - FAIL ERS_D.hcru_hcru.I_2000_CRUFRC_CN.yellowstone_pgi.GC.111079.compare_hist.clm4_0_78 - FAIL PET_PT.f10_f10.I20TRCN.yellowstone_pgi.GC.111079.compare_hist.clm4_0_78 - - frankfurt/CESM: - intel: OK. Expected failures for compare_hist (should pass next time) - FAIL SMS.f10_f10.IRCP26CN.frankfurt_intel.GC.pft79.compare_hist.clm4_0_78 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_78 - -Changes answers relative to baseline: yes - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): same climate - -in coupler history files: l2x_Sl_*, l2x_Fall, x2l_Slrr* and some r2x_* fields change - -in clm history files: for these tests only differences seen in IGRCP60CN - -=============================================================== -=============================================================== -Tag name: clm4_0_78 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Tue Apr 23 19:25:18 MDT 2013 -One-line Summary: MEGAN fixes - -Purpose of changes: - - - Bug fixes in MEGAN VOC emission fluxes and dry deposition velocities - - Remove the land fraction weighting from MEGAN history fields - - Added XPAN capability to dry deposition parametrization - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, starting branch from Erik. - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - - maximum string length of megan_specifier increased to 1024 characters - - M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 - M models/lnd/clm/src/clm4_0/biogeochem/VOCEmissionMod.F90 - - land fraction weighting has been removed from the MEGAN diagnostics - - added initialization of the vocflx_meg array to zero to prevent - erroneous values from contributing to the MEGAN emissions - - M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 - M models/lnd/clm/src/clm4_0/biogeochem/DryDepVelocity.F90 - - corrected surface pressure - - added XPAN specification - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK - - yellowstone/CESM: - -intel: OK - -component_gen_comp fails on a number of tests, but it is all expected. summarize_cprnc_diffs verifies that all fails in the - CLM history files is consistent. - -compare_hist failures are expected due to new dry deposition values going through coupler. - -pgi : OK - -compare_hist failures are expected - - frankfurt/CESM: - -intel: OK. - -compare_hist failures are expected - -CLM tag used for the baseline comparison tests if applicable: clm4_0_77 - -Changes answers relative to baseline: Yes. Changes in l2x_Sl_dd{001-035},l2x_Sl_dd{040,041,043} in coupler hist file. - Possible changes in *_voc fields in coupler hist files for certain configurations. Changes in 10 MEG_* fields and VOCFLXT in CLM history files. - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): same climate. changes in CLM fields range from 1.e-9 - (VOCFLXT) to 1.e-17 (MEG_thujene_a) - -=============================================================== -=============================================================== -Tag name: clm4_0_77 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Tue Apr 23 11:38:45 MDT 2013 -One-line Summary: fix carbon balance bug in transient runs with VERTSOI, and fix Soil Hydrology bug - -Purpose of changes: - -Fix two bugs: - -(1) In transient CLM45 runs with VERTSOI, a carbon balance error - occurred due to two routines being called with updated filters - when they should have been called with filters set at their values - from the previous time step. This bug has existed since clm4_0_62. - -(2) A potential for an array out-of-bounds error (which could show up - as garbage results if array bounds checking was off) which showed - up in rare circumstances (e.g., a single grid cell in Greenland in - a 1-year test run) - -Requirements for tag: Fix bugs 1663, 1664 - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - - 1663 (array bounds error in SoilHydrologyMod) - 1664 (carbon balance errors) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Fix for bug 1664 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - -========= Fix for bug 1663 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - - build-namelist unit tester: no - - CESM test lists: - - yellowstone/CESM: yes - - All PASS or xFAIL; all component_gen_comp comparisons pass or BFAIL1 - - yellowstone/CESM/allIcompsets: no - - frankfurt/CESM: yes - - All PASS or xFAIL - - test_system testing: - - yellowstone batch: no - frankfurt interactive: no - yellowstone interactive: no - lynx batch: no - lynx interactive: no - frankfurt batch: no - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_76 - -Changes answers relative to baseline: YES, potentially (though none -observed in standard testing) - - Answer changes are possible in any CLM45 case due to the SoilHydrology - bug fix (1663). This changes answers only in rare situations where the - water table comes near the surface (e.g., in a 1-year test run, this only - happened in one grid cell in Greenland) - - In addition, the following answer changes are expected due to the fix for - bug 1664: - - (1) CLM45 transient with VERTSOI (i.e., BGC). Implementing this change in - clm4_0_62 (the first tag that exhibited bug 1664), clm4_0_62-withFix - was identical to clm4_0_61 for this configuration. But clm4_0_77 will - differ from clm4_0_76 for this configuration. - - (2) Answers are changed for CLM45 CNDV with VERTSOI (i.e., BGCDV). It - appears that this configuration was buggy before this tag (e.g., - restarts weren't exact), so this tag changes answers in a way that - seems to fix this configuration. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? NOT DONE - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_0_76 -Originator(s): muszala (Stefan Muszala) -Date: Mon Apr 22 13:36:26 MDT 2013 -One-line Summary: spinup changes from Charlie Koven (part 1) - -Purpose of changes: - -Remove SPINUP CPP tokens, in favor of a run-time namelist item that can be set to -change the spinup mode on the fly. The state is stored on the restart file, and -if the user changes the mode on the namelist -- the model will automatically do -the "ENTER-SPINUP" or "EXIT-SPINUP" step as needed on the first time-step. The -spinup options were thus removed from the CLM configure for CLM45 and moved to -the build-namelist as option "-spinup" with values either "on" or "off". - - -Add new history fields: TOTLITC_1m, TOTSOMC_1m, TOTLITN_1m, and TOTSOMN_1m. -Remove the namelist item: reset_permafrost_c_n_pools. Removed default history -output for decomposing C pool changes due to vertical transport, and for vertical - profiles for N Deposition and fixation. - - -Answer Changes for C13: C13 and C13 Carbon isotopes are handled a bit differently - when they are NOT on the restart file. For C13 prior timestep's downregulation -is used in calculating ci used for photosynthetic discrimination. This changes - answers when use_c13 is turned on. - -Requirements for tag: N/A - -Test level of tag: std-tag - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: Change the way spin up is handled - -Describe any changes made to the namelist: spinup now controlled in build-namelist - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Dave L. checked spinup test comparing old and new method. Erik, Charlie Koven - -List any svn externals directories updated (csm_share, mct, etc.): - --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_130416a -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_130419a - -List all files eliminated: N/A - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/bld/configure -M models/lnd/clm/bld/config_files/config_definition.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_BGC.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_CENTURY.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M SVN_EXTERNAL_DIRECTORIES - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK. - some new failures that should be gone when compared to the next tag. This is due to the new namelist variable - - < spinup_state = 0 - - 418/444 < FAIL> - 423/444 < FAIL> - 428/444 < FAIL> - 433/444 < FAIL> - 438/444 < FAIL> - 443/444 < FAIL> - - CESM test lists: - - yellowstone/CESM: SPM - tracking tputcomp failures - cesm intel: OK - FAIL ERS.f09_g16.ICLM45VIC.nldir_vic_vrtlay.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_D.f10_f10.I.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_D.f10_f10.ICLM45.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_D.f10_f10.ICLM45CN4Me.nldir_ch4_set2_ciso.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_D.f10_f10.ICLM45CN4Me.nldir_ch4_set3_pftroot.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_D.f10_f10.ICLM45CN4MeNoVS.nldir_rootlit.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_E.f19_g16.I1850.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.222075.tputcomp.clm4_0_74 - cesm pgi : OK - FAIL SMS.1x1_numaIA.ICNCROP.yellowstone_pgi.GC.111075.tputcomp.clm4_0_74 - - frankfurt/CESM: - cesm intel: OK - FAIL ERS.f45_g37.I1850CN.frankfurt_intel.GC.00075.tputcomp.clm4_0_74 - FAIL SMS.f10_f10.IRCP26CN.frankfurt_intel.GC.00075.tputcomp.clm4_0_74 - FAIL SMS_D.1x1_mexicocityMEX.I.frankfurt_intel.GC.00075.tputcomp.clm4_0_74 - - -CLM tag used for the baseline comparison tests if applicable: clm4_0_75 - -Changes answers relative to baseline: some changes - -IF tag changes answers relative to baseline comparison the -following should be filled in: - -Answer Changes for C13: C13 and C13 Carbon isotopes are handled a bit differently - when they are NOT on the restart file. For C13 prior timestep's downregulation -is used in calculating ci used for photosynthetic discrimination. This changes - answers when use_c13 is turned on. - -=============================================================== -=============================================================== -Tag name: clm4_0_75 -Originator(s): muszala (Stefan Muszala) -Date: Fri Apr 19 16:13:42 MDT 2013 -One-line Summary: run propset - -Purpose of changes: run propset so externals are updated - -Requirements for tag:N/A - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system:N/A - -Describe any changes made to the namelist:N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes:N/A - -Machines testing ran on: no testing run -=============================================================== -=============================================================== -Tag name: clm4_0_74 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Wed Apr 17 15:58:50 MDT 2013 -One-line Summary: snow_depth changes, major scripts overhaul, small fix for tools - -Purpose of changes: bring in snow_depth changes (bfb except for one field in clm hist files, SNOWDP) - update external to alpha06e and bring in scripts refactoring by mvertens. Bug fix for mksurfdata_map - by sacks. Some minor code cleanup by muszala. - -Requirements for tag: N/A - -Test level of tag: doc, std-test + tools - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): Bug in pio1_6_6 which kills mpi-serial runs, jedwards is working on fix. - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, mvertens, swensoc - -List any svn externals directories updated (csm_share, mct, etc.): - -< scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_130416a -> scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/newcompsets2_tags/newcompsets2_02_scripts4_130405a -< scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130412 -> scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130403 -< models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq4_2_29 -> models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq4_2_26 -< models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_6_6/pio -> models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_6_5/pio -< tools/cprnc https://svn-ccsm-models.cgd.ucar.edu/tools/cprnc/trunk_tags/cprnc_130411 -< tools/mapping https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130403 -> mapping https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130308 -< models/lnd/clm/tools/clm4_5/gen_domain https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130403/gen_domain_files -> models/lnd/clm/tools/clm4_5/gen_domain https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130308/gen_domain_files - -List all files eliminated: models/lnd/clm/tools/SVN_EXTERNAL_DIRECTORIES (moved cprnc to common location). - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -SVN_EXTERNAL_DIRECTORIES - ---small fix from sacks. -models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkglcmecMod.F90 -models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkglcmecMod.F90 - ---update xFail list since we now run test_system tests out of cesm and scripts ---test_system now uses create_test -models/lnd/clm/test/system/test_system -models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - ---minor clean up -models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -models/lnd/clm/src/util_share/organicFileMod.F90 -models/lnd/clm/src/util_share/decompInitMod.F90 - ---snow depth changes -models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -models/lnd/clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 -models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -models/lnd/clm/src/clm4_5/main/clm_driver.F90 -models/lnd/clm/src/clm4_5/main/inicPerpMod.F90 -models/lnd/clm/src/clm4_5/main/clmtype.F90 -models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/initSLakeMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK. - - CESM test lists: (this now includes tests from test_system batch from yellowstone). - -yellowstone:: - CESM intel: OK - CESM pgi: OK -frankfurt: - CESM intel: OK. just ran generate. run these instead of test_system interactive tests from now on. - -Tool testing: OK. This was to double check my merge since the branch I started with was in clm4_0_68. - -CLM tag used for the baseline comparison tests if applicable: clm4_0_73 - -Changes answers relative to baseline: Only change is in the clm history field, SNOWDP. Everything else is bfb. - - -=============================================================== -=============================================================== -Tag name: clm4_0_73 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Mon Apr 15 09:48:03 MDT 2013 -One-line Summary: update mksurfdata_map for CLM4.5, and other misc. updates, mainly to tools - -Purpose of changes: - -Main purpose is to add a bunch of new fields to the CLM4.5 mksurfdata_map: -- SLOPE, STD_ELEV -- LAKEDEPTH -- peatf, abm, gdp (for fire) -- binfl, Ws, Dsmax, Ds (for VIC) -- F0, P3, ZWT0 (for methane) - -Also, other miscellaneous changes: - -- some refactoring of mksurfdata_map, and get more routines under unit test - -- for CLM4.5 mksurfdata_map, always use hires datasets, except for pft - -- add support for 36 glc_mec elevation classes (though there are currently - no surface datasets for this option) - -- add support for 1-d domain files in mksurfdata_map - -- add createXMLEntries.pl for creating xml entries for new mapping files - -- change default behavior of new_woodharv for clm4.0 (default is true now), - and only support new_woodharv=true for clm4.5 - -- allow global & regional map generation in a single submission of - mkmapdata/regridbatch.sh - -- handle clm4_0 vs clm4_5 distinction in mkmapdata.sh - -- handle large file support more robustly in mkmapdata.sh - -- refactored mkscripgrid.ncl to use built-in ESMF utility - -- remove 0.47x0.63 support for CLM4.5, since we don't have a good scrip - grid file for that resolution - -- in some files in bld/namelist_files, fix some resolutions listed as - 360x720 to be 360x720cru - -- a few other minor changes, as noted below - - -Requirements for tag: Requirements: tools tests, and build-namelist -test (to catch any accidental changes to CLM's namelist), fix bug: -1641. Also ran standard tests to cover all bases. - -Test level of tag: standard + tools - -Bugs fixed (include bugzilla ID): - - 1641 (RCP6 and RCP8.5 used old bad wood harvest for 2006 and 2007) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None to CLM namelist, but many -changes to mksurfdata_map namelist. - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: - -========= Move to new inputs directory -D models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_lookup_2d_netcdf.nc - -List all files added and what they do: - -========= Create xml entries and commands to move files to inputdata for - a bunch of mapping files -A models/lnd/clm/tools/clm4_5/mkmapdata/createXMLEntries.pl - -========= Guide for how to add new fields to mksurfdata_map -A models/lnd/clm/tools/clm4_5/mksurfdata_map/README.developers - -========= Pull out shared mksurfdata_map code into new, shared modules -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkdiagnosticsMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkchecksMod.F90 - -========= Regrid new fields for mksurfdata_map -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mktopostatsMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkgdpMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkagfirepkmonthMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpeatMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkVICparamsMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkCH4inversionMod.F90 - -========= Get more of mksurfdata_map code under unit tests -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkchecksMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkgridmapMod.F90 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkdomainMod.F90 - -========= Add inputs for new mksurfdata_map unit tests -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/test_domain_read_dims__lsmlon.nc -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/test_domain_read_dims__lon.nc -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/test_domain_read_dims__lon_and_num_pixels.nc -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/test_domain_read_dims__lon_and_ni.nc -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/test_domain_read_dims__num_pixels.nc - -========= Move to inputs directory -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/test_lookup_2d_netcdf.nc - - -List all existing files that have been modified, and describe the changes: - -========= Add new mksurfdata_map variables and mapping files -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkvarctl.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 - - also add no_inlandwet option - - also handle the case where special landunits sum to a - tiny bit more than 100% and thus give negative pct_pft -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mklanwatMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 - - also add some other global attributes -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Srcfiles -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - - also add merge_gis and inlandwet options, remove ngwh - option, remove hires option (instead use hirespft) -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata_map.namelist -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - - also add support for 36 glc_mec columns, and remove 0.47x0.63 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - - also remove 0.47x0.63, remove coarse-res lake, change logic for - determining glacier dataset, remove ngwh=off rcp6 and rcp8.5 datasets - - also add xml file support for more scrip grid file info -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - - also add support for 36 glc_mec columns, no_inlandwet option, - remove a duplicate section, remove 0.47x0.63 - - also add xml file support for more scrip grid file info -M models/lnd/clm/bld/namelist_files/checkmapfiles.ncl -M models/lnd/clm/doc/UsersGuide/tools.xml - -========= Add nodata argument to gridmap_areaave -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkgridmapMod.F90 - - also add gridmap_areastddev and gridmap_check routines -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mklaiMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksoilMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkharvestMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkurbanparCommonMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkvocefMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpftMod.F90 - -========= Add support for 36 glc_mec elevation classes -M models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkglcmecMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkglcmecMod.F90 -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0_tools.xml - - also fix ngwh default for rcp6 for 2006 and 2007 - - also add xml file support for more scrip grid file info -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml - - also add xml file support for more scrip grid file info -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - -========= Change default behavior of new_woodharv for clm4.0 -M models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata.pl - -========= Add new test routines -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/Srcfiles - -========= Change location of input files for unit testing -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkncdio.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkindexmapMod.F90 - -========= Add support for 1-d domain files; allow larger diffs in - domain_checksame -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkdomainMod.F90 - -========= Allow global & regional map generation in a single submission -M models/lnd/clm/tools/clm4_5/mkmapdata/regridbatch.sh - -========= Fix yellowstone ESMF path, add new grids, remove bluefire, - no longer make atm-ocn and RTM mapping files, handle large - file support and other grid-specific flags in a more robust - way, add option to differentiate between clm4_0 vs 4_5 -M models/lnd/clm/tools/clm4_5/mkmapdata/mkmapdata.sh - -========= Refactored to use built-in ESMF utility -M models/lnd/clm/tools/clm4_5/mkmapgrids/mkscripgrid.ncl - -========= Remove 0.47x0.63 for CLM4.5, since we don't have a good scrip grid - file for that resolution -M models/lnd/clm/tools/clm4_5/mkmapgrids/mkmapgrids.csh - -========= Renumber build-namelist unit tests due to removing a - resolution. Also cleaned up expectedFails list, mostly removing - tests that now pass, changing failure types, and adding - ERB.ne30_g16.I_1948-2004, which failed in clm4_0_72, too -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -========= Fix some paths in tools test scripts -M models/lnd/clm/test/tools/TBLCFGtools.sh -M models/lnd/clm/test/tools/TBLscript_tools.sh -M models/lnd/clm/test/tools/test_driver.sh -M models/lnd/clm/test/tools/TBLtools.sh -M models/lnd/clm/test/tools/TOPtools.sh - - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - All PASS or xFAIL - - CESM test lists: - - yellowstone/CESM: yes - All PASS or xFAIL except: - - ***** Not listed in xFAIL list, but failed in clm4_0_72, so I'm - adding it to the xFAIL list - FAIL ERB.ne30_g16.I_1948-2004.yellowstone_intel - - yellowstone/CESM/allIcompsets: no - - test_system testing: - - yellowstone batch: yes - All PASS or xFAIL except: - - ***** No baselines - BFAIL ERS_D.f10_f10.I_2000_CLM45_CN4MeNoVSoil.yellowstone_intel_rootlit.GC.142502.compare_hist.clm4_0_72 - - From component_gen_comp, all PASS or BFAIL1 except: - - ****** No baselines - BFAIL2 ERS_D.f10_f10.I_2000_CLM45_CN4MeNoVSoil.yellowstone_intel_rootlit.compare_hist.clm4_0_72.clm2.h0 (baseline history file does not exist) - BFAIL2 ERS_D.f10_f10.I_2000_CLM45_CN4MeNoVSoil.yellowstone_intel_rootlit.compare_hist.clm4_0_72.clm2.h1 (baseline history file does not exist) - - - frankfurt interactive: yes - All PASS or xFAIL (including component_gen_comp) - - - yellowstone interactive: no - lynx batch: no - lynx interactive: no - frankfurt batch: no - - test_driver.sh tools testing: - - frankfurt interactive: no - Couldn't get tools to build on frankfurt, from either my branch or - the clm4_0_72 trunk tag - - yellowstone interactive: yes - All PASS except: - - ********* These seem to be expected failures, based on the fact that they fail in clm4_0_72. Note that the - ********* gen_domain tests themselves pass, but the baseline comparisons fail, even if I compare clm4_0_72 - ********* against itself - 006 ble14 TBLCFGtools.sh clm4_5 gen_domain CFGtools__ds T31.runoptions ..........................rc=4 FAIL - 008 ble@4 TBLCFGtools.sh clm4_5 gen_domain CFGtools__ds ne30.runoptions .........................rc=4 FAIL - 027 smiS4 TSMscript_tools.sh clm4_5 ncl_scripts getregional_datasets.pl getregional .............rc=6 FAIL - 028 bliS4 TBLscript_tools.sh clm4_5 ncl_scripts getregional_datasets.pl getregional .............rc=4 FAIL - - ********* Expected baseline failures due to changes in default behavior of CLM4_5 mksurfdata_map - ********* (see notes on answer changes, below, for what changed; I have rerun these tests with some - ********* changes on my branch and in the trunk tag to confirm that baseline comparisons pass when I - ********* revert the differences noted there) - 012 blg54 TBLtools.sh clm4_5 mksurfdata_map tools__s namelist ...................................rc=7 FAIL - 020 bli24 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds rc=7 FAIL - 022 bli53 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o ....rc=7 FAIL - 024 bli54 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ds ...rc=7 FAIL - 026 bli57 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__do ...rc=7 FAIL - 030 bli74 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools_ rc=7 FAIL - 032 bliT4 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools_ rc=7 FAIL - - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_72 - -Changes answers relative to baseline: NO. However, changes behavior of -these offline tools: - -mksurfdata_map for clm4.5: changes the following defaults: -- use hires raw datasets (where available) for everything except pctpft -- zeroes out inland wetland areas -- changes default glacier dataset for glc_mec surface datasets -- uses correct ngwh dataset for rcp6.0 2006 & 2007 - -mksurfdata_map for clm4.0: changes the following defaults: -- uses correct ngwh dataset for rcp6.0 2006 & 2007 - -mkmapdata.sh: -- no longer generates ocean-atmosphere and RTM mapping files - -mkscripgrid.ncl: -- roundoff-level changes in coordinates -- grid_dims is fixed (now correctly nx by ny, rather than ntot by ntot) - -=============================================================== -=============================================================== -Tag name: clm4_0_72 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Thu Apr 11 15:13:40 MDT 2013 -One-line Summary: maoyi bug fix for vic hydro - -Purpose of changes: Bring in changes from Maoyi that fix a few bugs in the VIC hydrology code. Make a small change in - scripts that fixes NoVS runs. - -Requirements for tag: N/A - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): 1648 - -Known bugs (include bugzilla ID): 1658 - ERB problem with clm4_0. - 1659 - RTM restart problem when under a day boundary - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: changed NoVSBGC to NoVS in scripts branch_tag - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): changed scripts branch tag to - --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/newcompsets2_tags/newcompsets2_01_scripts4_130405a -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/newcompsets2_tags/newcompsets2_02_scripts4_130405a - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -from Maoyi Huang: - -The variable cps%ws in my original codes overlaps with another variable in the SLAKE option. So I renamed it to cps$Wsvic. -wtsub in SoilHydrologyMod.F90 when VICHYDRO was on was not initialized. To avoid any potential conflicts, I renamed it to wtsub_vic and initialized it to 0._r8. -cleaned up the codes a little bit by taking out all variables that were not used. - -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -Machines testing ran on: (Tests in priority order) - -- updated xFail list and slightly modified test_system yellowstone.batch to reflect ERS_D and ERS_Ln48_D changes. -- tracking tputcomp and memcomp changes in advance of refactoring modifications. - - build-namelist unit tester: All OK. All Failures in clm4_0_71 now pass. - - CESM test lists: - - cesm intel: PID: 163148: OK. a number of tputcomp failures: - FAIL ERS_D.f10_f10.I.yellowstone_intel.GC.163148.tputcomp.clm4_0_71 - FAIL ERS_Lm3.1x1_vancouverCAN.I1PT.yellowstone_intel.GC.163148.tputcomp.clm4_0_71 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.163148.tputcomp.clm4_0_71 - FAIL SMS_RLA.f45_f45.ICLM45.yellowstone_intel.GC.163148.tputcomp.clm4_0_71 - FAIL SMS.1x1_mexicocityMEX.I1PTCLM45.yellowstone_intel.GC.163148.tputcomp.clm4_0_71 - - cesm pgi: PID: 163101 OK. one memcomp failure - FAIL ERS.f19_g16.ICNCROP.yellowstone_pgi.GC.163101 - - test_system testing: - - yellowstone batch: OK. Fixed a problem with NoVS, found bug in - FAIL ERS.f19_g16.I_1850_CLM45_CN4Me.yellowstone_intel_user_nl_dirs.GC.162650.tputcomp.clm4_0_71 - FAIL ERS_D.f10_f10.I_2000_CLM45_CN4Me.yellowstone_intel_ch4_set2_ciso.GC.162650.memcomp.clm4_0_71 - FAIL ERS_D.f10_f10.I_2000_CLM45_CN4Me.yellowstone_intel_ch4_set2_ciso.GC.162650.tputcomp.clm4_0_71 - FAIL ERS_D.f10_f10.I_2000_CLM45_CN4Me.yellowstone_intel_ch4_set3_pftroot.GC.162650.tputcomp.clm4_0_71 - - frankfurt interactive: OK. generate and tputcomp sub-tests failed. - FAIL SMS_D_Mmpi-serial.1x1_vancouverCAN.I1PTCLM45.frankfurt_intel_user_nl_dirs.GC.165025.generate.clm4_0_72 - FAIL SMS_D_Mmpi-serial.1x1_vancouverCAN.I1PTCLM45.frankfurt_intel_user_nl_dirs.GC.165025.tputcomp.clm4_0_71 - FAIL ERS_Mmpi-serial.1x1_mexicocityMEX.I1PTCLM45.frankfurt_intel_user_nl_dirs.GC.165025.generate.clm4_0_72 - FAIL ERS_Mmpi-serial.1x1_mexicocityMEX.I1PTCLM45.frankfurt_intel_user_nl_dirs.GC.165025.tputcomp.clm4_0_71 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_72 - -Changes answers relative to baseline: only for VIC. Original implementation broken. Consider this tag the new baseline against which to test for VIC. - -IF tag changes answers relative to baseline comparison the -following should be filled in: N/A - -=============================================================== -=============================================================== -Tag name: clm4_0_71 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Wed Apr 10 08:43:00 MDT 2013 -One-line Summary: compsets refactoring by mvertens - -Purpose of changes: Bring in externals that refactor the compset handling. Update CLM to - work with the new compsets. Compsets are now extensible and easier to - modify and work with. - -Requirements for tag: N/A - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: modify CLM to work with new compset refactor - -Describe any changes made to the namelist: modify CLM to work with new compset refactor - -List any changes to the defaults for the boundary datasets: N/A Levy's new files will come in later. - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: mvertens, erik - -List any svn externals directories updated (csm_share, mct, etc.): - -https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/newcompsets2_tags/newcompsets2_01_scripts4_130405a -https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130403 -https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq4_2_26 -https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_130325 -https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_02/socn -https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_02/sice -https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_02/sglc -https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_02/swav -https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_130405 -http://parallelio.googlecode.com/svn/trunk_tags/pio1_6_5/pio -https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130308 -https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130308/gen_domain_files - -List all files eliminated: - -D models/lnd/clm/test/system/tests_posttag_lynx_nompi -D models/lnd/clm/test/system/mirage.interactive -D models/lnd/clm/test/system/TCBCFGtools.sh -D models/lnd/clm/test/system/tests_pretag_bluefire_nompi -D models/lnd/clm/test/system/config_files -D models/lnd/clm/test/system/config_files/gen_domain -D models/lnd/clm/test/system/config_files/tools__do -D models/lnd/clm/test/system/config_files/tools__s -D models/lnd/clm/test/system/config_files/CFGtools__ds -D models/lnd/clm/test/system/config_files/tools__ds -D models/lnd/clm/test/system/config_files/README -D models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml -D models/lnd/clm/test/system/config_files/tools__o -D models/lnd/clm/test/system/get_cprnc_diffs.sh -D models/lnd/clm/test/system/TSMncl_tools.sh -D models/lnd/clm/test/system/CLM_compare.sh -D models/lnd/clm/test/system/TBLCFGtools.sh -D models/lnd/clm/test/system/README.testnames -D models/lnd/clm/test/system/tests_posttag_yong -D models/lnd/clm/test/system/TCBtools.sh -D models/lnd/clm/test/system/test_driver.sh -D models/lnd/clm/test/system/lynx.interactive -D models/lnd/clm/test/system/tests_pretag_yellowstone_nompi -D models/lnd/clm/test/system/bluefire.batch -D models/lnd/clm/test/system/Makefile -D models/lnd/clm/test/system/TSMscript_tools.sh -D models/lnd/clm/test/system/tests_posttag_mirage -D models/lnd/clm/test/system/tests_posttag_frankfurt_nompi -D models/lnd/clm/test/system/gen_test_table.sh -D models/lnd/clm/test/system/TOPtools.sh -D models/lnd/clm/test/system/input_tests_master -D models/lnd/clm/test/system/TSMtools.sh -D models/lnd/clm/test/system/TBLscript_tools.sh -D models/lnd/clm/test/system/tests_posttag_nompi_regression -D models/lnd/clm/test/system/TBLtools.sh -D models/lnd/clm/test/system/show_var_diffs.sh -D models/lnd/clm/test/system/TSMCFGtools.sh - -List all files added and what they do: - -A + models/lnd/clm/test/tools -A + models/lnd/clm/test/tools/TSMscript_tools.sh -A + models/lnd/clm/test/tools/TCBCFGtools.sh -A + models/lnd/clm/test/tools/tests_posttag_frankfurt_nompi -A + models/lnd/clm/test/tools/config_files -A + models/lnd/clm/test/tools/config_files/gen_domain -A + models/lnd/clm/test/tools/config_files/tools__do -A + models/lnd/clm/test/tools/config_files/tools__s -A + models/lnd/clm/test/tools/config_files/CFGtools__ds -A + models/lnd/clm/test/tools/config_files/tools__ds -A + models/lnd/clm/test/tools/config_files/README -A + models/lnd/clm/test/tools/config_files/tools__o -A + models/lnd/clm/test/tools/get_cprnc_diffs.sh -A + models/lnd/clm/test/tools/gen_test_table.sh -A + models/lnd/clm/test/tools/TSMncl_tools.sh -A + models/lnd/clm/test/tools/CLM_compare.sh -A + models/lnd/clm/test/tools/nl_files -A + models/lnd/clm/test/tools/nl_files/nl_ch4_set2_ciso -A + models/lnd/clm/test/tools/nl_files/nl_ch4_set3_pftroot -A + models/lnd/clm/test/tools/nl_files/gen_domain.ne30.runoptions -A + models/lnd/clm/test/tools/nl_files/mksrfdt_1x1_brazil_1850 -A + models/lnd/clm/test/tools/nl_files/nl_rootlit -A + models/lnd/clm/test/tools/nl_files/gen_domain.T31.runoptions -A + models/lnd/clm/test/tools/nl_files/mksrfdt_10x15_1850 -A + models/lnd/clm/test/tools/nl_files/nl_ciso -A + models/lnd/clm/test/tools/nl_files/nl_anoxia_wtsat -A + models/lnd/clm/test/tools/nl_files/clm4_0_mksrfdt_1x1_numaIA_mp20irrcr_2000 -A + models/lnd/clm/test/tools/nl_files/mksrfdt_T31_crpglc_2000 -A + models/lnd/clm/test/tools/nl_files/clm4_0_mksrfdt_10x15_irr_1850 -A + models/lnd/clm/test/tools/nl_files/getregional -A + models/lnd/clm/test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 -A + models/lnd/clm/test/tools/nl_files/mksrfdt_1x1_brazil_1850-2000 -A + models/lnd/clm/test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 -A + models/lnd/clm/test/tools/nl_files/mkmapdata_ne30np4 -A + models/lnd/clm/test/tools/nl_files/nl_vrtlay -A + models/lnd/clm/test/tools/nl_files/nl_oldhyd -A + models/lnd/clm/test/tools/nl_files/mksrfdt_1x1_vancouverCAN_2000 -A + models/lnd/clm/test/tools/nl_files/mkmapdata_if10 -A + models/lnd/clm/test/tools/TBLCFGtools.sh -A + models/lnd/clm/test/tools/input_tests_master -A + models/lnd/clm/test/tools/TOPtools.sh -A + models/lnd/clm/test/tools/README -A + models/lnd/clm/test/tools/TSMtools.sh -A + models/lnd/clm/test/tools/README.testnames -A + models/lnd/clm/test/tools/TBLscript_tools.sh -A + models/lnd/clm/test/tools/tests_posttag_yong -A + models/lnd/clm/test/tools/TCBtools.sh -A + models/lnd/clm/test/tools/test_driver.sh -A + models/lnd/clm/test/tools/tests_posttag_nompi_regression -A + models/lnd/clm/test/tools/tests_pretag_yellowstone_nompi -A + models/lnd/clm/test/tools/TBLtools.sh -A + models/lnd/clm/test/tools/show_var_diffs.sh -A + models/lnd/clm/test/tools/TSMCFGtools.sh -A + models/lnd/clm/test/tools/Makefile -A + models/lnd/clm/test/system/yellowstone.namelist - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/system/test_system -M models/lnd/clm/test/system/yellowstone.interactive -M models/lnd/clm/test/system/frankfurt.interactive -M models/lnd/clm/test/system/README -M models/lnd/clm/test/system/yellowstone.batch -M models/lnd/clm/bld/user_nl_clm -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/clm.buildnml.csh -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml -MM models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -MM models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -MM models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 -M SVN_EXTERNAL_DIRECTORIES - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: - -These should pass next time around: --these two are due to megan now being on by default: - 030/449 < FAIL> - 037/449 < FAIL> --these four should pass next time...no baselines in clm4_0_70 - 108/449 < FAIL> - 109/449 < FAIL> - 443/449 < FAIL> - 444/449 < FAIL> - - CESM test lists: - - yellowstone/CESM: -intel: other than our expected fail list, current failures should pass during the next round of testing -pgi : see intel - -note for intel and pgi: nlcomp fails should not be considered truth or otherwise. There is a bug compare_namelist. -lots of BFAILS when comparing to clm4_0_70 and some differences in coupler hist. vars. -These are expected due to a new CISM and DATM. - - test_system testing: - - yellowstone batch: OK. See explanation for yellowstone/CESM tests above. - frankfurt interactive: OK. After modifying the frankfurt compset for 1PT. - -CLM tag used for the baseline comparison tests if applicable: clm4_0_70 - -Changes answers relative to baseline: yes, due to CISM, but not due to any science changes in CLM itself. There will be -changes in some coupler history files. - -=============================================================== -=============================================================== -Tag name: clm4_0_70 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Mon Apr 1 15:58:23 MDT 2013 -One-line Summary: bring in vic hydrology - -Purpose of changes: Merge in VIC hydrology. This is an isolated option that stands on it's -own and does not effect existing code. Added tests with and without vrtlay = .true.. - -Requirements for tag: Add vic tests for CLM45 and CLM45-vrtlay, normal testing protocol - -Test level of tag: standard + I_compsets + yellowstone_rtm batch - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID):VIC crashes when run in debug mode-1648 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: Add namelist option for vichydro - -Describe any changes made to the namelist: Add namelist option for vichydro - -List any changes to the defaults for the boundary datasets: Using temporary surface data sets. New datasets - will come in at a later tag. The temporary data sets do not effect normal CLM runs. - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Erik,Maoyi Huang - -List any svn externals directories updated (csm_share, mct, etc.):N/A - -List all files eliminated:N/A - -List all files added and what they do: - -- For new VIC tests: -A models/lnd/clm/test/system/user_nl_dirs/vic/vic_f09/user_nl_clm -A models/lnd/clm/test/system/user_nl_dirs/vic/vic_f09 -A models/lnd/clm/test/system/user_nl_dirs/vic/vic_f19/user_nl_clm -A models/lnd/clm/test/system/user_nl_dirs/vic/vic_f19 -A models/lnd/clm/test/system/user_nl_dirs/vic/vic_vrtlay/user_nl_clm -A models/lnd/clm/test/system/user_nl_dirs/vic/vic_vrtlay -A models/lnd/clm/test/system/user_nl_dirs/vic -- For VIC implementation: -A models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -A models/lnd/clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 - -List all existing files that have been modified, and describe the changes: - -- For VIC namelist fucntionality -M models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml -M models/lnd/clm/bld/configure -M models/lnd/clm/bld/config_files/config_definition.xml -- For new VIC tests -M models/lnd/clm/test/system/yellowstone.batch -- VIC implementation -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK - - CESM test lists: - - yellowstone/CESM: - cesm intel: OK. some tputcomp FAILs, but main tests pass - cesm pgi: OK. one tputcomp FAIL, main tests pass - yellowstone/CESM/allIcompsets: OK. - - test_system testing: - yellowstone rtm batch: OK. - yellowstone batch: OK. - - new VIC tests: - ERS.f09_g16.I_2000_CLM45_VIC -user_nl_dir ../models/lnd/clm/test/system/user_nl_dirs/vic/vic_f09 - SMS.f19_g16.I_2000_CLM45_VIC -user_nl_dir ../models/lnd/clm/test/system/user_nl_dirs/vic/vic_f19 - ERS.f09_g16.I_2000_CLM45_VIC -user_nl_dir ../models/lnd/clm/test/system/user_nl_dirs/vic/vic_vrtlay - ERS_D.f09_g16.I_2000_CLM45_VIC -user_nl_dir ../models/lnd/clm/test/system/user_nl_dirs/vic/vic_vrtlay - this last one expected to Fail. - - frankfurt interactive: OK. - -CLM tag used for the baseline comparison tests if applicable: clm4_0_69 - -Changes answers relative to baseline: No. The VIC hydro option, if turned on - does change answers, but the use of this code is isolated from the rest of CLM. - -=============================================================== -=============================================================== -Tag name: clm4_0_69 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Tue Mar 26 16:24:54 MDT 2013 -One-line Summary: remove hydro reorder, volr and esmf mods - -Purpose of changes: fix volrlnd init. from SPVAL to 0.0 so TWS in CLM looks correct. - modify esmf interfaces for volr. remove hydrology reordering due to nasty bug in - restart. - -Requirements for tag: fix bug 1644 - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): 1644 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist:N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Dave L. and Jinyn Tang. Minor review by Erik and Bill. - -List any svn externals directories updated (csm_share, mct, etc.): update RTM to 1_0_22 - -List all files eliminated: N/A - -List all files added and what they do:N/A - -List all existing files that have been modified, and describe the changes: -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 -M SVN_EXTERNAL_DIRECTORIES - -Machines testing ran on: (Tests in priority order) - - only run CESM tests: - -=== CESM Yellowstone PGI tests: OK. All BFAILS occur in cmopare_hist which is expected due to the removal of the hydro. reordering. -Status with expected failures removed: -./cs.status.114300.yellowstone | grep -v PET_PT.f19_g16.I1850 | grep -v SMS.1x1_numaIA.ICN_CROP | grep -v PET_PT.f10_f10.I20TRCN | grep -v PET_PT.f19_g16.ICLM451850 | grep -v SMS.T31_g37.IG4804CLM45 | grep -v SMS.1x1_numaIA.ICLM45CNCROP | grep -v PET_PT.f10_f10.I20TRCLM45CN | grep -v PASS -Possible test result outcomes: -... -BFAIL SMS_RLB.f45_f45.I.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL ERS_D.hcru_hcru.I_2000_CRUFRC_CN.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL ERS.f19_g16.ICNCROP.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL ERI.f19_g16.IG1850.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL SMS.T31_g37.IG4804.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL SMS.1x1_numaIA.ICNCROP.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL SMS_RLB.f45_f45.ICLM45.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL ERS_D.hcru_hcru.I_2000_CRUFRC_CLM45_CN.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL ERS.f19_g16.ICLM45CNCROP.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 -BFAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.114300.compare_hist.clm4_0_68 - -=== CESM Yellowstone INTEL tests: OK. All BFAILS occur in cmopare_hist which is expected due to the removal of the hydro. reordering. -Status with expected failures removed: ->>./cs.status.114247.yellowstone | grep -v ERH_D.f19_g16.I1850CLM45CN | grep -v ERB.ne30_g16.I_1948-2004_CLM45 | grep -v ERS_E.f19_g16.I1850CRUCLM45CN | grep -v CME.f10_f10.ICN | grep -v ERS_D.f10_f10.ICLM45 | grep -v PET_PT.f19_g16.I1850CN | grep -v ERB.ne30_g16.I_1948-2004 | grep -v PET_PT.f10_f10.I20TRCN | grep -v PET_PT.f19_g16.I1850CLM45CN | grep -v ERS_E.f19_g16.ICLM451850 | grep -v ERS_D.f19_g16.IGRCP26CLM45CN | grep -v ERS_Lm3.f19_g16.IGRCP60CLM45CN | grep -v PET_PT.f10_f10.I20TRCLM45CN | grep -v SMS.f19_g16.IRCP45CLM45CN | grep -v ERS_D.f19_g16.IRCP85CLM45CN | grep -v PASS | grep -v COMMENT -... -FAIL ERS_D.f10_f10.I.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_D.f10_f10.I.yellowstone_intel.GC.114247.tputcomp.clm4_0_68 -FAIL NCK.f10_f10.I.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_E.f19_g16.I1850.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERH_D.f19_g16.I1850CN.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_D.f19_g16.IGRCP26CN.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.114247.tputcomp.clm4_0_68 -FAIL SMS.f19_g16.IRCP45CN.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_D.f19_g16.IRCP85CN.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 -FAIL ERS_D.f19_g16.IRCP85CN.yellowstone_intel.GC.114247.memcomp.clm4_0_68 -FAIL SMS_ROA.f45_f45.ICLM45.yellowstone_intel.GC.114247.tputcomp.clm4_0_68 -FAIL NCK.f10_f10.ICRUCLM45.yellowstone_intel.GC.114247.compare_hist.clm4_0_68 - -=== test_system yellowstone.rtm.batch: OK. All compare_hist failures are expected due changes in photosynthesis - -CLM tag used for the baseline comparison tests if applicable: For Cesm intel and pgi tests- clme_0_68 - for rtm tests, against clm4_0_66. - for science validation, clm4_0_66 - -Changes answers relative to baseline: yes - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - obvious changes in GPP,FPSN and FCTR. Other fields changed as well. - ran the following and had Dave L. and Jinyun Tang look at output. - f19_g16_I_1850_CLM45_CN_yellowstone_intel_photo_clm4_0_66/ - f19_g16_I_1850_CLM45_CN_yellowstone_intel_photo_clm4_0_68/ - f19_g16_I_1850_CLM45_CN_yellowstone_intel_photo_clm4_0_69/ - f19_g16_ICLM45_yellowstone_intel_photo_clm4_0_66/ - f19_g16_ICLM45_yellowstone_intel_photo_clm4_0_68/ - f19_g16_ICLM45_yellowstone_intel_photo_clm4_0_69/ - -=============================================================== -=============================================================== -Tag name: clm4_0_68 -Originator(s): erik (Erik Kluzek) -Date: Sat Mar 16 16:03:14 MDT 2013 -One-line Summary: Fix mksurfdata_map for ne120np. Error out if SUM(weights)/=100. Photosynthesis change for CLM45. - -Purpose of changes: - -Bring in ne120fix branch to trunk. This fixes some issues in mksurfdata_map for generation -of ne120np surface data file. Put error back in CLM if weights don't sum to 100. Add in -Keith Oleson's photosynthesis change. This changes canopy top: triose phosphate utilization rate at 25C to -be dependent on vcmax25top ( maximum rate of carboxylation) rather than jmax25top (maximum electron -transport rate). Update getco2_historical.ncl script to be able to handle rcp files as well. - -Update scripts so that I1PT settings for urban single-point files will be used, and IRCP -will properly do a hybrid startup. And seperate out intel/pgi test lists. - -Update datasets for ne120np4 and ne240np4 (CLM40), with updated mksurfdata_map. - -Requirements for tag: - Tools test, yellowstone batch, fix bug 1632/1643 - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): 1632 (ne120np4 mksurfdata problem) - 1643 (Fix RES_COMPSET_MATCH for I1PT, IRCP*) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - New surfdata and pftdyn files for ne120np4 (CLM40) - New surfdata files for ne240np4 (CLM40) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, sacks (mksrfdata changes) - -List any svn externals directories updated (csm_share, mct, etc.): scripts - scripts updated to scripts4_130315c - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/yellowstone.batch --- Fix some compset names - - M models/lnd/clm/tools/clm4_5/ncl_scripts/getco2_historical.ncl - Handle rcp CO2 files - M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 -- Clean out small PFT values - M models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mksurfdat.F90 -- Clean out small PFT values - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml ------- Update ne120/ne240 surfdata/pftdyn datasets - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ------- Delete ALL finidat files as none compatible - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Add rcp CO2 datasets: rcp2.6/4.5/6/8.5 - - M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 - Add back abort if surfdata weights don't sum to 100% - M models/lnd/clm/src/clm4_0/main/surfrdMod.F90 - Add back abort if surfdata weights don't sum to 100% - M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 - change in photosynthesis - -Changes in expected fails for testing: - - build-namelist unit-test: Following fail because of new datasets will pass next tag - 203 ne120 - 208 ne240 - 306 ne120 20th Century - 428 48x96 for CLM45 (remove finidat) - failType="FAIL">answers change on restart - - - Changes to expected fail: - - - - -+ answers change on restart -+ answers change on restart -+ answers change on restart -+ answers change on restart -+ answers change on restart -+ answers change on restart -+ answers change on restart -+ answers change on restart - - - - - +Restart difference - +Restart difference - +Restart difference - +Restart difference - +Restart difference - -Machines testing ran on: (Tests in priority order) - build-namelist unit tester: yes - - CESM test lists: - - yellowstone/CESM: yes - yellowstone/CESM/allIcompsets: yes - - test_system testing: - - yellowstone batch: yes - frankfurt interactive: yes - - test_driver.sh tools testing: - - yellowstone interactive: yes - frankfurt interactive: yes - -CLM tag used for the baseline comparison tests if applicable: clm4_0_68 - -Changes answers relative to baseline: Yes! - - - what code configurations: - All CLM45 change because of change in photosynthisis - I1PT compsets change because of scripts bug - IRCP compsets now startup with new initial conditions - - what platforms/compilers: All - - nature of change: similar climate - -=============================================================== -=============================================================== -Tag name: clm4_0_67 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Tue Mar 12 11:14:59 MDT 2013 -One-line Summary: Jinyun photosynthesis and hydrology reorder - -Purpose of changes: Bring in mods that reorder hydrology code and modes that - address photosynthesis CN code. This tag is F90 code only. - -Requirements for tag: N/A - -Test level of tag: std-test + ICompset tests + yellowstone interactive - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist:N/A - -List any changes to the defaults for the boundary datasets:N/A - -Describe any substantial timing or memory changes:N/A - -Code reviewed by: Dave L, S. Swenson, self - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated:N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -Major changes in CNEcosystemDynMod, SoilHydrologyMod and Hydrology2Mod. Also did some deadCode removal (unused pointer -assignments, unused modules and local variables. - - M biogeochem/CNEcosystemDynMod.F90 - effects CN. Split out CNEcosystemDynA and CNEcosystemDynB - - M main/CNiniTimeVar.F90 - removed some commented out code - M main/clmtypeInitMod.F90 - removed commented out init_gridcell_pstate_type - M main/pftdynMod.F90 - M main/initSurfAlbMod.F90 - effects CN. For photosynthesis. - M main/clm_driver.F90 - M main/CNiniSpecial.F90 - M ain/clmtype.F90 - M main/histFldsMod.F90 - - M biogeophys/Hydrology2Mod.F90 - split out 2A and 2B subroutines - M biogeophys/SoilHydrologyMod.F90 - split out new WaterTable routine from existing Drainage routine - M biogeophys/BareGroundFluxesMod.F90 - M biogeophys/CanopyFluxesMod.F90 - For photosynthesis. - - -Machines testing ran on: (Tests in priority order) - -Dave Lawrence looked at 1 year runs to make sure behavior looked OK before and after mods. -S. Swenson looked at short simulations to make sure reordering worked correctly in the hydrology code. -Expect changes in the following fields (depending on compset and test type) - -roff Flrl_rofliq -roff Flrl_rofliq -lnd Flrl_rofliq -lnd Flrl_rofliq -roff Forr_roff -roff Forr_roff -roff Flrl_rofliq -roff Flrl_rofliq -lnd Fall_lat -lnd Fall_lat -lnd Fall_sen -lnd Fall_sen -lnd Fall_evap -lnd Fall_evap -lnd Flrl_rofliq -lnd Flrl_rofliq -roff Forr_roff -roff Forr_roff -roff Flrl_rofliq -roff Flrl_rofliq -lnd Sl_fv -lnd Sl_f - -l2x_Sl_avsdr -l2x_Sl_anidr -l2x_Sl_avsdf -l2x_Sl_anidf -l2x_Sl_tref -l2x_Sl_qref -l2x_Sl_t -l2x_Sl_fv -l2x_Sl_ram1 -l2x_Sl_snowh -l2x_Sl_u10 -l2x_Fall_swnet -l2x_Fall_taux -l2x_Fall_tauy -l2x_Fall_lat -l2x_Fall_sen -l2x_Fall_lwup -l2x_Fall_evap -l2x_Fall_flxdst1 -l2x_Fall_flxdst2 -l2x_Fall_flxdst3 -l2x_Fall_flxdst4 -l2x_Flrl_rofliq -x2l_Slrr_volr -r2x_Slrr_volr -r2x_Forr_roff -r2x_Forr_ioff -x2r_Flrl_rofliq - - build-namelist unit tester: yes - OK - - CESM test lists: - - yellowstone/CESM: yes - OK. Fails are due to new code. These should pass next tag. - - FAIL ERS.f19_g16.I_1850_CLM45_CN4Me.yellowstone_intel_user_nl_dirGC.113407 - oAIL ERS_D.fol_g16.I_1850_CLM45_CNCENTNoMe.yellowstone_intel_user_nl_dirs.GC.113407 - FAIL ERS.f19_g16.I_2000_CLM45_CN4Me_CROP.yellowstone_intel_user_nl_dirs.GC.113407 - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.yellowstone_intel_monthly.GC.113407 - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.yellowstone_intel_monthly.GC.113407.compare_hist.clm4_0_66 - FAIL ERS_Ln48_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel_user_nl_dirs.GC.113407.compare_hist.clm4_0_66 - FAIL ERS_Ld211_D_P224x1.f10_f10.ICLM45CNCROP.yellowstone_intel_crop.GC.113407 - FAIL ERS_Ld211_P384x1.f19_g16.ICLM45CNDVCROP.yellowstone_intel_crop.GC.113407 - FAIL ERS_Ld211.f10_f10.I_2000_CLM45_VOC_CN.yellowstone_intel_voc.GC.113407 - FAIL ERS_Ln48_D.f10_f10.I_2000_CLM45_CN.yellowstone_intel_ciso.GC.113407.compare_hist.clm4_0_66 - FAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel_glcMEC.GC.113407 - - yellowstone/CESM/allIcompsets: yes - OK - - test_system testing: - - yellowstone batch: yes - OK. Fails are due to new code. These should pass next tag. - - FAIL ERS.f19_g16.I_1850_CLM45_CN4Me.yellowstone_intel_user_nl_dirs.GC.113407 - FAIL ERS_D.f19_g16.I_1850_CLM45_CNCENTNoMe.yellowstone_intel_user_nl_dirs.GC.113407 - FAIL ERS.f19_g16.I_2000_CLM45_CN4Me_CROP.yellowstone_intel_user_nl_dirs.GC.113407 - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.yellowstone_intel_monthly.GC.113407 - FAIL ERS_Ln48_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel_user_nl_dirs.GC.113407.compare_hist.clm4_0_66 - FAIL ERS_Ld211_D_P224x1.f10_f10.ICLM45CNCROP.yellowstone_intel_crop.GC.113407 - FAIL ERS_Ld211_P384x1.f19_g16.ICLM45CNDVCROP.yellowstone_intel_crop.GC.113407 - FAIL ERS_Ld211.f10_f10.I_2000_CLM45_VOC_CN.yellowstone_intel_voc.GC.113407 - FAIL ERS_Ln48_D.f10_f10.I_2000_CLM45_CN.yellowstone_intel_ciso.GC.113407.compare_hist.clm4_0_66 - FAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel_glcMEC.GC.113407 - - frankfurt interactive: yes - OK - yellowstone interactive: yes - reasonably OK. Added a few tests to xFail list that need new - surface data sets. - The following fail due to new code and should pass next round: - - FAIL ERS_D_Mmpi-serial.CLM_USRDAT.ICLM45USUMB.yellowstone_intel_user_nl_dirs.GC.075359.compare_hist.clm4_0_66b - FAIL ERS_D_P1x1_Mmpi-serial.f19_g16.I20TR_CLM45VSCN.yellowstone_intel_voc.GC.075359 - FAIL ERS_D_P1x1_Mmpi-serial.f19_g16.I20TR_CLM45VSCN.yellowstone_intel_voc.GC.075359.compare_hist.clm4_0_66b - FAIL ERS_Ly3_Mmpi-serial.1x1_brazil.I_2000_CLM45.yellowstone_intel_monthly.GC.075359.compare_hist.clm4_0_66b - FAIL ERS_Ld211_Mmpi-serial.1x1_brazil.I_2000_CLM45_CN.yellowstone_intel_monthly.GC.075359.compare_hist.clm4_0_66b - FAIL ERS_Ly3_Mmpi-serial.1x1_brazil.I_2000_CLM45_CNDV.yellowstone_intel_monthly.GC.075359.compare_hist.clm4_0_66b - -CLM tag used for the baseline comparison tests if applicable: clm4_0_66 - -Changes answers relative to baseline: Photosynthesis mods and reordering will change answers - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): hydrology reordering will introducce very small changes due to the process of moving around, but not changing code. - photosysthesis mods are major changes that effect science - - -=============================================================== -=============================================================== -Tag name: clm4_0_66 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Thu Mar 7 11:54:05 MST 2013 -One-line Summary: turn off subgrid topography snow parameterization for glc_mec landunits - -Purpose of changes: - -Change from Sean Swenson to turn off subgrid topography snow -parameterization over glc_mec landunits: ice_mec columns already account -for subgrid topographic variability through their use of multiple elevation -classes; thus, to avoid double-accounting for topographic variability in -these columns, we ignore topo_std and use a value of n_melt that assumes -little topographic variability within the column. - -Requirements for tag: yellowstone cesm tests, make sure GLC test goes - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, Sean Swenson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: no - - CESM test lists: - - yellowstone/CESM: yes - All PASS or xFail (ignoring tput failures); only baseline failure is, - the following, which is an expected failure: - FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.C.113330.compare_hist.clm4_0_65 - - yellowstone/CESM/allIcompsets: no - - test_system testing: - - yellowstone batch: no - frankfurt interactive: no - yellowstone interactive: no - lynx batch: no - lynx interactive: no - frankfurt batch: no - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_65 - -Changes answers relative to baseline: Yes, just for CLM4.5 with glc_mec - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: CLM4.5 with glc_mec - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): new climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_0_65 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Thu Mar 7 09:53:31 MST 2013 -One-line Summary: back out Machines external to get more tests to pass, especially IG - -Purpose of changes: - -Some tests - particularly IG - became broken in clm4_0_64. This tag rolls -back the Machines external so that GLC compiles properly. - -Requirements for tag: - -Test level of tag: only yellowstone CESM tests - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): --scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130304b -+scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130301 - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -Difference in expected fails: this brings the xfail list back to what it -was in clm4_0_63, with the exception of some SBN IcompsetTests that were -added to xFail in clm4_0_64: -@@ -154,12 +154,6 @@ - scripts issue component not threaded - missing finidat file - missing finidat file -- -- No rule to make target `glc_constants.o/glade/scratch/muszala/ERI.f19_g16.IG1850.yellowstone_pgi.GC.161430/bld/glc/lib/libglimmercismfortran.a', needed by `glc_constants.mod' -- No rule to make target `glc_constants.o/glade/scratch/muszala/ERI.f19_g16.IG1850.yellowstone_pgi.GC.161430/bld/glc/lib/libglimmercismfortran.a', needed by `glc_constants.mod' -- -- ERROR: lnd_prognostic but num_inst_lnd not num_inst_max -- ERROR: lnd_prognostic but num_inst_lnd not num_inst_max - - - scripts issue with ocean not threaded -@@ -170,10 +164,6 @@ - checkWeights error, probably due to old-format urban on surface dataset - Bad compset name: ICNCROP - scripts issue with ocean not threaded -- -- No rule to make target `glc_constants.o/glade/scratch/muszala/ERI.f19_g16.IG1850.yellowstone_pgi.GC.161430/bld/glc/lib/libglimmercismfortran.a', needed by `glc_constants.mod' -- No rule to make target `glc_constants.o/glade/scratch/muszala/ERI.f19_g16.IG1850.yellowstone_pgi.GC.161430/bld/glc/lib/libglimmercismfortran.a', needed by `glc_constants.mod' -- No rule to make target `glc_constants.o/glade/scratch/muszala/ERI.f19_g16.IG1850.yellowstone_pgi.GC.161430/bld/glc/lib/libglimmercismfortran.a', needed by `glc_constants.mod' - - - - - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - - build-namelist unit tester: no - - CESM test lists: - - yellowstone/CESM: yes - All PASS or xFail (ignoring tput failures) - (note that baselines didn't exist in clm4_0_64 for some tests, - particularly IG) - - yellowstone/CESM/allIcompsets: no - - test_system testing: - - yellowstone batch: no - frankfurt interactive: no - yellowstone interactive: no - lynx batch: no - lynx interactive: no - frankfurt batch: no - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_64 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_0_64 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Wed Mar 6 12:41:26 MST 2013 -One-line Summary: update externals. fixes 40/45 intial condition problem - -Purpose of changes: Main purpose is to bring in scripts4_130227b so that - CLM45 compsets do not use CLM40 initial conditions. Put in - PTCLM fix. Secondary purpose is to update other externals. - NOTE: This tag only changes externals. No clm - code, scripts or xml files were touched. - -Requirements for tag: N/A - -Test level of tag: critical (only yellowstone, Icompset and aux 40/45 aux tests) - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: Changes in processor count for certain resolutions. - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: the 40/45 fix in scripts4_130227b will fix initial condition problems. - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: muszala, Erik - -List any svn externals directories updated (csm_share, mct, etc.): - - cprnc_120828 -> cprnc_130301 - scripts4_130207 -> scripts4_130304 - Machines_130214 -> Machines_130304b - rtm1_0_19 -> rtm1_0_20 - share3_130220 -> share3_130226 - esmf_wrf_timemgr_120427 -> esmf_wrf_timemgr_130213 - timing_120731 -> timing_130214 - mapping_121113b -> mapping_130222 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: N/A - - M models/lnd/clm/tools/SVN_EXTERNAL_DIRECTORIES - M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - M SVN_EXTERNAL_DIRECTORIES - -Machines testing ran on: (Tests in priority order) - yellowstone/CESM: yes - looks decent, but not great. There are no new test failures and new tests that do fail are - most likely due to new testlists that weren't tested in a clm tag. - A few nl comp failures since number of pes changed (expected). - Many comparisons failed due to baselines not existing. - 5 IG compsets fail due to a linking error. - 2 NCK.F10_f10 tests die with "ERROR: lnd_prognostic but num_inst_lnd not num_inst_max" - - yellowstone/CESM/allIcompsets: yes - looks OK. Transient runs added to xFail list as well as SBN.1x1_smallvilleIA.ICLM45CNCROP - and SBN.f09_g16.IGCLM45IS2 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_63 - -Changes answers relative to baseline: Yes. PE counts change plus the initial condition fixes will change answers compared - to existing baselines - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - The 40/45 fix should bring this back to being correct (ie. the state before clm4_0_60). - -=============================================================== -=============================================================== -Tag name: clm4_0_63 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Mon Mar 4 13:50:15 MST 2013 -One-line Summary: bug 1635 fix - 4_0 CN bug - -Purpose of changes: Put back some removed code. This allows CN to run with 4_0 - beyond one year - -Requirements for tag: - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): 1635 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Dave Lawrence, Sam Levis - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_0/biogeochem/CNAnnualUpdateMod.F90 ---- models/lnd/clm/src/clm4_0/biogeochem/CNAnnualUpdateMod.F90 (revision 44311) -+++ models/lnd/clm/src/clm4_0/biogeochem/CNAnnualUpdateMod.F90 (working copy) -@@ -183,6 +183,12 @@ - call p2c(num_soilc, filter_soilc, annavg_t2m, cannavg_t2m) - end if - - + ! column loop - + do fc = 1,num_soilc - + c = filter_soilc(fc) - + if (annsum_counter(c) >= get_days_per_year() * secspday) annsum_counter(c) = 0._r8 - + end do - + - end subroutine CNAnnualUpdate - !----------------------------------------------------------------------- - - -Machines testing ran on: (Tests in priority order) - yellowstone/CESM: yes only 40 list - OK. Matches xFail list - yellowstone/CESM/allIcompsets: yes - OK. Matches xFail list - - Also had D. Lawrence look at one 45 run and a 40 run from this tag compared to one from - clm4_0_58 (the tag just before this bug was introduced). All three runs were 2 years long. - -CLM tag used for the baseline comparison tests if applicable: clm4_0_62 - -Changes answers relative to baseline: No - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm4_0_62 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Sun Feb 24 15:27:09 MST 2013 -One-line Summary: add active flags, change subgrid weighting convention, other misc fixes - -Purpose of changes: - -Main set of changes involves adding 'active' flags at the pft, column & landunit -levels, saying whether computations should be run over a given point. This -change involved many changes throughout the code, changing conditionals like 'if -(pwtgcell(p) > 0)' to 'if (pactive(p))'. The purpose of this change was -two-fold: (1) make these conditionals less error-prone and more robust to future -changes in the code: currently, the 'active' condition is: weight > 0 OR type = -glc_mec -- but sometimes people forgot to include the latter condition, and it -could get worse moving forwards; (2) make it easy to change the 'active' -condition in the future -- this now just has to be done in one place, in -reweightMod. - -In changing these conditionals to use the new 'active' flags, I also added or -removed conditionals in a few places -- see notes below on the individual file -modifications. - -Also, changed subgrid weighting convention, so that the sum of weights always -adds to 1 at all levels. Previously, there was no fixed convention for the -weights of, e.g., pfts on a 0-weight column. Now, even on a 0-weight column, the -sum of pft weights on the column will still add to 1. - -Also a number of other miscellaneous fixes: -- bug-fix in handling of unstructured grids in determining new vs old urban format -- add some new surface datasets with new urban format -- other misc. fixes noted below - -Requirements for tag: - Testing: build-namelist unit tests, yellowstone cesm, yellowstone - test_system batch, frankfurt test_system interactive; include - component_gen_comp for test_system tests - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: A few new surface datasets (see below) - -Describe any substantial timing or memory changes: None - -Code reviewed by: erik - -List any svn externals directories updated (csm_share, mct, etc.): -Main purpose is to update cism (along with necessary scripts & machines -updates), but also updated other externals to their cesm1_2_beta02 versions: -- scripts -- machines -- cism -- mct -- pio -- csm_share (includes scam update from Erik) - -List all files eliminated: - -List all files added and what they do: - -======= Handles modifications and error-checks related to changing subgrid weights -======= (note that direct calls to setFilters should no longer be made -- -======= instead, call reweightWrapup in this new module). This adds a routine that confirms -======= that all subgrid weights add to 1 (from Zack Subin). -A models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -List all existing files that have been modified, and describe the changes: - -======= add 'active' flags; replace use of things like 'if (pwtgcell(p) > 0)' -======= with 'if (pactive(p))' -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 ---------- also removed unnecessary conditional -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 ------------ also added a pactive check -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/main/dynlandMod.F90 --------------- also added a new conditional -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 ------------ also added a new conditional in p2c_2d_filter - (similar to existing conditional in p2c_1d_filter) -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 --- also remove ^M line endings accidentally added in clm4_0_61 -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 - -======= replace calls to setFilters with calls to reweightWrapup; in driver, -======= moved these calls based on an analysis of where they are needed -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - -======= change subgrid weighting convention; remove duplicated code in setting -======= up urban landunits. Note that, in a few places (marked by "TODO WJS") I -======= assumed an arbitrary weighting for, e.g., pft weights in a 0-weight -======= landunit. This can be changed in the future once we change how weights -======= are defined on the surface dataset (using weights on the landunit rather -======= than on the grid cell). -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 - -======= declare some parameters as 'parameter' (needed in order to use them in -======= select case statements) -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 - -======= make check for new vs old format more robust; in particular, fix -======= handling of unstructured grids (before, these were deemed to be -======= old-format urban files by accident) -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 - -======= use nlevurb=5 even for more_vertlayers (based on suggestion from Keith -======= and Erik) -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 - -======= use new surface datasets for glcmec 1.9x2.5 1850&2000, and f10 1850, in -======= order to have valid urban data for some tests to pass -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -======= use cism rather than sglc for test_system tests, because sglc means no -======= sno fields are sent to the coupler, which leads to ERS test failures and -======= generally weaker tests -M models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml - -======= add cism1 distinction in compset name -M models/lnd/clm/test/system/yellowstone.interactive -M models/lnd/clm/test/system/bluefire.interactive -M models/lnd/clm/test/system/lynx.batch - -======= add call to component_gen_comp -M models/lnd/clm/test/system/test_system - -======= Removed some now-passing tests, including some that were passing earlier -======= but still remained in this file -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -xFAIL differences: -Index: models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -=================================================================== ---- models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml (revision 44092) -+++ models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml (working copy) -@@ -113,8 +113,7 @@ - - - -- -- -+ - - - -@@ -137,7 +136,6 @@ - - scripts issue with ocean not threaded - Restart difference -- Soil balance error on restart - scripts issue with ocean not threaded - - scripts issue with ocean not threaded -@@ -149,20 +147,12 @@ - missing finidat file - - -- problem building with mpi-serial with pgi compiler -- missing LAPACK symbol dgbsv - scripts issue with ocean not threaded -- Need LAPACK for PGI (dgbsv) -- Need LAPACK for PGI (dgbsv) - Bad compset name: ICNCROP - scripts issue with ocean not threaded - -- problem building with mpi-serial with pgi compiler -- missing LAPACK symbol dgbsv -- missing LAPACK symbol dgbsv - scripts issue with ocean not threaded -- Need LAPACK for PGI (dgbsv) -- Need LAPACK for PGI (dgbsv) -+ checkWeights error, probably due to old-format urban on surface dataset - Bad compset name: ICNCROP - scripts issue with ocean not threaded - - - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - -NOTE: Ignoring throughput fails - - - build-namelist unit tester: yes - All PASS or xFAIL - - CESM test lists: - - Note: the following change was made after running the CESM test list (just - reran the one affected case: ERI.f19_g16.IG1850CLM45.yellowstone_pgi): - In bld/namelist_files/namelist_defaults_clm4_5.xml: - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_simyr1850_glcmec10_c120927.nc - +lnd/clm2/surfdata_map/surfdata_1.9x2.5_simyr1850_glcmec10_c130221.nc - - yellowstone/CESM: yes - All PASS or xFAIL except: - - ***** Expected failure due to urban bug-fix for unstructured grids - FAIL ERB.ne30_g16.I_1948-2004_CLM45.yellowstone_intel.GC.051632.compare_hist.clm4_0_61 - - ***** memcomp failures probably due to using cism2 code - FAIL ERS_D.f19_g16.IGRCP26CN.yellowstone_intel.GC.051626.memcomp.clm4_0_61 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.051626.memcomp.clm4_0_61 - - ***** memcomp failures with unknown cause - FAIL ERS_D.f19_g16.IRCP85CN.yellowstone_intel.GC.051626.memcomp.clm4_0_61 - COMMENT pesmaxmem_incr = 28.2 - - yellowstone/CESM/allIcompsets: no - - test_system testing: - - yellowstone batch: yes, including component_gen_comp - All PASS or xFAIL except: - - ***** Expected failure due to new surface dataset - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.yellowstone_intel_monthly.GC.051756.compare_hist.clm4_0_61_test_system - - ***** Expected failure due to urban bug-fix for unstructured grids - FAIL ERS_Ln48_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel_user_nl_dirs.GC.051756.compare_hist.clm4_0_61_test_system - - ***** memcomp failures with unknown cause - FAIL ERS_Ld211.f10_f10.I_2000_CLM45_VOC_CN.yellowstone_intel_voc.GC.051756.memcomp.clm4_0_61_test_system - FAIL ERS_Ln48_D_P64x16.ne30_g16.ICN.yellowstone_intel_user_nl_dirs.GC.051756.memcomp.clm4_0_61_test_system - - - ----- COMPONENT_GEN_COMP RESULTS --- - All comparisons PASS except: - - ****** Expected failures due to new surface dataset and fix in urban for - ****** ne30 These failures all go away when I compare against one-offs - ****** from clm4_0_61 with fixes in surface datasets and the urban ne30 - ****** bug. However, there is then a diff in the h1 file for the GLCMEC - ****** test: diffs just in cols1d_wtlunit & pfts1d_wtlunit, and this is - ****** just over glc_mec columns -- this is expected due to changes in - ****** subgrid weighting convention - FAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel_glcMEC.compare_hist.clm4_0_61.clm2.h0 - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.yellowstone_intel_monthly.compare_hist.clm4_0_61.clm2.h0 - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.yellowstone_intel_monthly.compare_hist.clm4_0_61.clm2.h1 - FAIL ERS_Ln48_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel_user_nl_dirs.compare_hist.clm4_0_61.clm2.h0 - FAIL ERS_Ln48_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel_user_nl_dirs.compare_hist.clm4_0_61.clm2.h1 - - ****** Differences just over crop landunits: RMS diffs in pft weights on - ****** col and landunit, and col weights on landunit; and FILLDIFFs in 12 - ****** column-level variables (now _FillValue in 0-weight places). These - ****** differences aren't surprising given the changes in subgrid weight - ****** convention and the fact that inactive points are now given spval in - ****** 1-d output - FAIL ERS.f19_g16.I_2000_CLM45_CN4Me_CROP.yellowstone_intel_user_nl_dirs.compare_hist.clm4_0_61.clm2.h1 - - - frankfurt interactive: yes, including component_gen_comp - All PASS or xFAIL - - yellowstone interactive: no - lynx batch: no - lynx interactive: no - frankfurt batch: no - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_61 - -Changes answers relative to baseline: yes, in limited cases - see below - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: CLM4.5 with the following: - - unstructured grids, due to urban bug fix - - glcmec @ 1.9x2.5, due to new surface datasets with new urban - - 1850 @ f10, due to new surface dataset - - what platforms/compilers: ALL - - nature of change: larger than roundoff/same climate OR new climate (not - investigated carefully) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: NOT DONE - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_0_61 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Wed Feb 20 15:53:38 MST 2013 -One-line Summary: rtm, drv and clm mods: tws, Volr, r01 rdric file and SoilHydroMod - -Purpose of changes: Bring Volr from RTM to CLM. - New ne120 files. - New SoidHydrologyMod file for 45 (not bit-for-bit) - Bring tws in. - Sacks test list change and test_system change. - Add yellowstone to xFail options. - Added RTM test list for test_system tests (yellowstone.rtm.batch) - DEPRECATE WT in 4_5 code. WT and the variable wt are left in since they are used in other - portions of the code, but they are marked as deprecated since we now have TWS. - -Requirements for tag: - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: muszala, swenseon, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): - drv: update from drvseq4_2_20 to drvseq4_2_22 - rtm: update from rtm1_0_18 to rtm1_0_19 - csm_share: update from share3_130213 to share3_130131 - -List all files eliminated: -D https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOn -D https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmR01 - -List all files added and what they do: - Added RTM rtm test_system tests -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnFloodOnEffvelOff/user_nl_rtm -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnFloodOnEffvelOff -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnFloodOnEffvelOn/user_nl_rtm -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnFloodOnEffvelOn -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnIceOff/user_nl_rtm -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnIceOff -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnIceOn/user_nl_rtm -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOnIceOn -A https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/yellowstone.rtm.batch - -List all existing files that have been modified, and describe the changes: -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/test_system -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/yellowstone.interactive -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOff/user_nl_rtm -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/README -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/test/system/yellowstone.batch -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/bld/unit_testers/xFail/expectedFail.pm -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/doc/ChangeLog -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/doc/ChangeSum -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 -MM https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -MM https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/main/clmtype.F90 -MM https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/models/lnd/clm/src/clm4_0/main/clm_atmlnd.F90 -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/SVN_EXTERNAL_DIRECTORIES -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/ChangeLog -M https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_60/ChangeSum - - -Machines testing ran on: (Tests in priority order) - NOTE: Lots of throughput, NLComp and memcomp fails. Also ran rtm test_system tests - - build-namelist unit tester: OK (yellowstone) - added two tests that were missing from xFail list - - CESM test lists: - - yellowstone/CESM: - -> 4_0 testing: OK. Removed tests in xFail file and ignoring NLComp tests. Remaining Fails (tputcomp and memcomp) will be ignored since test tolerences are too narrow. - - -> 4_5 testing: OK. There will be B4B differences due to a new SoilHydrologyMod which are listed below - - FAILs due to new SoilHydroMod and r2x_Slrr_volr in coupler - - FAIL SMS_RLA.f45_f45.ICLM45.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - FAIL ERS_D.f10_f10.ICLM45.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - FAIL NCK.f10_f10.ICLM45.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - FAIL ERB.ne30_g16.I_1948-2004_CLM45.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - FAIL ERH_D.f19_g16.I1850CLM45CN.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - FAIL SMS.1x1_mexicocityMEX.I1PTCLM45.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - FAIL ERS_Lm3.1x1_vancouverCAN.I1PTCLM45.yellowstone_intel.GC.161028.compare_hist.clm4_0_60 - - yellowstone/CESM/allIcompsets: OK - - test_system testing: - - yellowstone batch: - OK. FAILs due to new SoilHydroMod and r2x_Slrr_volr in coupler - - FAIL ERS.f19_g16.I_1850_CLM45_CN4Me.user_nl_dirs.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_D.f19_g16.I_1850_CLM45_CNCENTNoMe.user_nl_dirs.GC.114029.compare_hist.clm4_0_60 - FAIL ERS.f19_g16.I_2000_CLM45_CN4Me_CROP.user_nl_dirs.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_Ld211.f10_f10.ICLM45CNADSPIN.monthly.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_Ln48_D_P64x1.ne30_g16.ICLM45CN.user_nl_dirs.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_Ld211_D_P224x1.f10_f10.ICLM45CNCROP.crop.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_Ld211_P384x1.f19_g16.ICLM45CNDVCROP.crop.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_Ld211.f10_f10.I_2000_CLM45_VOC_CN.voc.GC.114029.compare_hist.clm4_0_60 - FAIL ERS_Ln48_D.f10_f10.I_2000_CLM45_CN.ciso.GC.114029.compare_hist.clm4_0_60 - - frankfurt interactive: - OK. FAILs due to new SoilHydroMod and r2x_Slrr_volr in coupler - - FAIL SMS_D_Mmpi-serial.1x1_vancouverCAN.ICLM451PT.frankfurt_intel_user_nl_dirs.GC.104908.compare_hist.clm4_0_60 - FAIL ERS_Mmpi-serial.1x1_mexicocityMEX.ICLM451PT.frankfurt_intel_user_nl_dirs.GC.104908.compare_hist.clm4_0_60 - - yellowstone interactive: - OK. FAILs due to new SoilHydroMod and r2x_Slrr_volr in coupler - - FAIL ERS_D_Mmpi-serial.CLM_USRDAT.ICLM45alaskaCN.yellowstone_intel_user_nl_dirs.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_D_Mmpi-serial.CLM_USRDAT.ICLM45USUMB.yellowstone_intel_user_nl_dirs.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_D_P1x1_Mmpi-serial.f19_g16.I20TR_CLM45VSCN.yellowstone_intel_voc.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_D_P1x1_Mmpi-serial.5x5_amazon.I_2000_CLM45.yellowstone_intel_user_nl_dirs.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_Ln48_D_P1x1_Mmpi-serial.f45_g37.ICLM45VOC.yellowstone_intel_voc.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_Ly3_Mmpi-serial.1x1_brazil.I_2000_CLM45.yellowstone_intel_monthly.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_Ld211_Mmpi-serial.1x1_brazil.I_2000_CLM45_CN.yellowstone_intel_monthly.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_Ly3_Mmpi-serial.1x1_brazil.I_2000_CLM45_CNDV.yellowstone_intel_monthly.GC.114053.compare_hist.clm4_0_60 - FAIL ERS_Ld211_Mmpi-serial.1x1_brazil.IVSCN.yellowstone_intel_voc.GC.114053.compare_hist.clm4_0_60 - - frankfurt batch: - OK. FAILs due to new SoilHydroMod and r2x_Slrr_volr in coupler - - FAIL ERS_D_P16x1.f19_g16.I_1850_CLM45_CN4Me.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - FAIL ERI_P16x1.f19_g16.I_1850_CLM45_CNCENTNoMe.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - FAIL ERS_Ld211_P16x1.f10_f10.ICLM45CNADSPIN.frankfurt_intel_monthly.GC.104516.compare_hist.clm4_0_60 - FAIL ERS_P16x1.f19_g16.I_1850_CLM45_CN4Me_LessSPIN.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - FAIL SMS_D_P16x1.f19_g16.I_1850_CLM45_CN4Me_EXLessSPIN.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - FAIL SMS_D_P16x1.f10_f10.I_2000_CLM45_CN4Me.frankfurt_intel_vrtlay.GC.104516.compare_hist.clm4_0_60 - FAIL ERS_D_P16x1.f19_g16.I_2000_CLM45_CN.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - FAIL ERI_P16x1.f19_g16.I_2000_CLM45_CN.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - FAIL SMS_D_P16x1.f19_g16.ICLM45CNEXSPIN.frankfurt_intel_user_nl_dirs.GC.104516.compare_hist.clm4_0_60 - -CLM tag used for the baseline comparison tests if applicable: CLM4_0_60 - -Changes answers relative to baseline: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: 4_5 code - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - 1) SoilHydrologyMod.F90 mods from Swenson effect soil moisture which are effecting certain l2x coupler fields - 2) bringing VOLR from RTM through the coupler adds one more field to coupler history files. - -=============================================================== -=============================================================== -Tag name: clm4_0_60 -Originator(s): erik (Erik Kluzek) -Date: Mon Feb 11 03:55:56 MST 2013 -One-line Summary: Bring CLM4.5 code from clm45sci branch to trunk as an option set at configure time - -Purpose of changes: - -Bring in CLM4.5 branch as additional directories. Change directory structure, so there are shared files -and utilities for both CLM4.0 and CLM4.5 and files that are different for each. Update compsets in -scripts in order to work in this paradigm. Move clm45sci15_clm4_0_58 code to trunk under clm4_5 phys. - -clm4.5 includes the following: - -* Bring LBNL-merge branch on with: vertical soil, Methane, CENTURY, split nitrification, new-lake model. -* Modifications to GPP, on gppdev branch, multilayer canopy and then single-layer version that reproduces it. -* Crop model updates. Irrigation included with crop model as an option. Fix CNDV-CROP. -* Urban model updates, multi-density, urban depth seperate from soil depth, wasteheat to zero -* Bring in permafrostsims09 branch with Sean Swensons's flooding changes. -* Update pft-physiology file, change some CN defaults, change min flow slightly in RTM -* Set ponding to zero, acclimation mods from Keith Oleson, a hydrology change from Sean Swenson. - -Requirements for tag: clm40/clm45 code/tools work/tested, answers same, complete move from bluefire to yellowstone - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - 1621 (normalization issue in mksurfdata_map and clm -- partial) - 1604 (The -co2_type flag in the CLM namelist is not set correct.) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - - Compsets to run CLM4.5 added. - -I_2000_CLM45 (ICLM45) -I_2000_1PTFRC_CLM45 (I1PTCLM45) -I_2000_GLC_CLM45_CISM1 (IGCLM45) -I_2000_GLC_CLM45_CISM2P (IGCLM45IS2) -I_2000_CLM45_CN (ICLM45CN) -I_2000_CLM45_CN_CROP (ICLM45CNCROP) -I_2000_CLM45_CN_4Me (ICLM45CN4Me) -I_2000_CRUFRC_CLM45 (ICRUCLM45) -I_2000_CRUFRC_CLM45_CN (ICRUCLM45CN) -I_2000_CRUFRC_CLM45_CN_4Me (ICRUCLM45CN4Me) -I_2000_CLM45_CN_GLC_CISM1 (IGCLM45CN) -I_1850_CLM45 (I1850CLM45) -I_1850_CLM45_CN_4Me (I1850CLM45CN4Me) -I_1850_CRUFRC_CLM45 (I1850CRUCLM45) -I_1850_CRUFRC_CLM45_CN (I1850CRUCLM45CN) -I_1850_CRUFRC_CLM45_CN_4Me (I1850CRUCLM45CN4Me) -I_1850_CLM45_GLC_CISM1 (IG1850CLM45) -I_1850_CLM45_CN (I1850CLM45CN) -I_1850-2000_CLM45 (I20TRCLM45) -I_1850-2000_CLM45_CN (I20TRCLM45CN) -I_1850-2000_CRUFRCCLM45 (I20TRCRUCLM45) -I_1850-2000_CRUFRC_CLM45_CN (I20TRCRUCLM45CN) -I_1850-2000_CRUFRC_CLM45_CN_4Me (I20TRCRU4MeCLM45) -I_1850-2000_CLM45_GLC_CISM1 (IG20TRCLM45) -I_1850-2000_CLM45_CN_GLC_CISM1 (IG20TRCLM45CN) -I_1948-2004_CLM45 (I4804CLM45) -I_1948-2004_CLM45_GLC_CISM1 (IG4804CLM45) -I_1948-2004_CLM45_CN_GLC_CISM1 (IG4804CLM45CN) -I_RCP8.5_CLM45_CN_GLC_CISM1 (IGRCP85CLM45CN) -I_RCP6.0_CLM45_CN (IRCP60CLM45CN) -I_RCP6.0_CLM45_CN_GLC_CISM1 (IGRCP60CLM45CN) -I_RCP4.5_CLM45_CN (IRCP45CLM45CN) -I_RCP4.5_CLM45_CN_GLC_CISM1 (IGRCP45CNCLM45) -I_RCP2.6_CLM45_CN (IRCP26CLM45CN) -I_RCP2.6_CLM45_CN_GLC_CISM1 (IGRCP26CLM45CN) -I_RCP8.5_CLM45_CN (IRCP85CLM45CN) -I_1850_SPINUP_3HrWx_CLM45_CN_4Me - - CLM configure changes: - - Add physics option to determine if CLM4.0 or CLM4.5 physics is used: -+ -phys Value of clm4_0 or clm4_5 (default is clm4_0) - - Options removed - - -pergro - -c13 - - Options added for CLM4.5 physics: - -+ -clm4me Turn Methane model: [on | off] -+ Requires bgc=cn/cndv (Carbon Nitrogen model) -+ (ONLY valid for CLM4.5!) -+ -exlaklayers Turn on extra lake layers (25 layers instead of 10) [on | off] -+ (ONLY valid for CLM4.5!) -+ -vsoilc_centbgc Turn on vertical soil Carbon profile, CENTURY model decomposition, -+ split Nitrification/de-Nitrification into two mineral -+ pools for NO3 and NH4 (requires clm4me Methane model), and -+ eliminate inconsistent duplicate soil hydraulic -+ parameters used in soil biogeochem. -+ (requires either CN or CNDV) -+ (ONLY valid for CLM4.5!) -+ [on,off or colen delimited list of no options] (default off) -+ no-vert Turn vertical soil Carbon profile off -+ no-cent Turn CENTURY off -+ no-nitrif Turn the Nitrification/denitrification off -+ no-stnd-bsw Turn the standard BSW for soil psi off -+ [no-vert,no-cent,no-nitrif,no-stnd-bsw, -+ no-vert:no-cent,no-nitrif:no-stnd-bsw, -+ no-vert:no-cent:no-stnd-bsw] - - New spinup options added for CLM4.5 physics (but are now deprecated and NOT recommended for use) - -+ Enter-AD Turn on Accelerated Decomposition from (6) -+ existing initial conditions (optional) (deprecated) -+ (ONLY valid for CLM4.5!) -+ AD2Lesser Jump from full AD to lesser AD spinup (optional) (4) -+ (deprecated) (ONLY valid for CLM4.5!) -+ LesserAD Lesser Accelerated Decomposition mode (3) -+ (deprecated) (ONLY valid for CLM4.5!) -+ LesserAD-exit Jump from lesser AD to normal mode (1) -+ (deprecated) (ONLY valid for CLM4.5!) -+ Two sequences are valid: 6-5-4-3-1-0 or 6-5-2-0 (where 6 and 4 are optional) -+ The recommended sequence is 5-2-0 - - - -Describe any changes made to the namelist: - Extensive list of new namelist options for CLM4.5 physics - -List any changes to the defaults for the boundary datasets: - Extensive list of new datasets for CLM4.5 - Add 360x720 grid (hcru_hcru) for CLM4.0 physics - -Describe any substantial timing or memory changes: CLM4.0 -- identical to clm4_0_59 - CLM4.5 -- identical to clm45sci15_clm4_0_58 - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): to cesm1_2_alpha02a versions - - scripts to scripts4_130204 - Machines to Machines_130204 - drv to drvseq4_2_18 - datm to datm8_130130 - rtm to rtm1_0_18 - cism to 45merge_02_cism1_121114 - csm_share to share3_130131 - pio to pio1_6_1 - mapping/gen_domain to mapping_121113b - -List all files eliminated: - -============== Eliminate PERGRO option, remove duplicated tools from clm4_0, change names to include clm4_0 -D models/lnd/clm/test/system/nl_files/mksrfdt_1x1_numaIA_mp20irrcr_2000 -D models/lnd/clm/test/system/nl_files/mksrfdt_10x15_irr_1850 -D models/lnd/clm/tools/mkmapdata/* ---------> remove -D models/lnd/clm/tools/mkprocdata_map/* ----> remove -D models/lnd/clm/tools/ncl_scripts/* -------> remove -D models/lnd/clm/tools/interpinic/* --------> move to under clm4_0 -D models/lnd/clm/tools/mkmapgrids/* --------> remove -D models/lnd/clm/tools/mksurfdata_map/* ----> move to under clm4_0 -D models/lnd/clm/bld/namelist_files/namelist_definition.xml ---> use clm4_5 version -D models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -> move to name with clm4_0 -D models/lnd/clm/bld/namelist_files/use_cases/pergro_pd.xml ---> Remove PERGRO option -D models/lnd/clm/bld/namelist_files/use_cases/pergro0_pd.xml --> Remove PERGRO option -D models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml -> move to name with clm4_0 - -List all files added and what they do: - -============== testing for clm4_5 and change name of some tests to include clm4_0 -A + models/lnd/clm/test/system/config_files/gen_domain -A + models/lnd/clm/test/system/tests_posttag_frankfurt_nompi -A + models/lnd/clm/test/system/user_nl_dirs/anoxia_wtsat -A + models/lnd/clm/test/system/user_nl_dirs/anoxia_wtsat/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/vrtlay -A + models/lnd/clm/test/system/user_nl_dirs/vrtlay/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/oldhyd -A + models/lnd/clm/test/system/user_nl_dirs/oldhyd/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/ch4_set2_ciso -A + models/lnd/clm/test/system/user_nl_dirs/ch4_set2_ciso/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/ch4_set3_pftroot -A + models/lnd/clm/test/system/user_nl_dirs/ch4_set3_pftroot/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/rootlit -A + models/lnd/clm/test/system/user_nl_dirs/rootlit/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/ciso -A + models/lnd/clm/test/system/user_nl_dirs/ciso/user_nl_clm -A + models/lnd/clm/test/system/nl_files/nl_ch4_set2_ciso -A + models/lnd/clm/test/system/nl_files/nl_ch4_set3_pftroot -A + models/lnd/clm/test/system/nl_files/mksrfdt_10x15_1850 -A + models/lnd/clm/test/system/nl_files/nl_rootlit -A + models/lnd/clm/test/system/nl_files/nl_ciso -A + models/lnd/clm/test/system/nl_files/nl_anoxia_wtsat -A + models/lnd/clm/test/system/nl_files/clm4_0_mksrfdt_1x1_numaIA_mp20irrcr_2000 -A + models/lnd/clm/test/system/nl_files/clm4_0_mksrfdt_10x15_irr_1850 -A + models/lnd/clm/test/system/nl_files/mksrfdt_1x1_numaIA_mp24_2000 -A + models/lnd/clm/test/system/nl_files/nl_vrtlay -A + models/lnd/clm/test/system/nl_files/nl_oldhyd -============== clm4_5 version of tools (from clm45sci15_clm4_0_58) -A + models/lnd/clm/tools/clm4_5 -A + models/lnd/clm/tools/clm4_5/mkmapdata -A + models/lnd/clm/tools/clm4_5/mkmapdata/mvNimport.sh -A + models/lnd/clm/tools/clm4_5/mkmapdata/rmdups.ncl -A + models/lnd/clm/tools/clm4_5/mkmapdata/regridbatch.sh -A + models/lnd/clm/tools/clm4_5/mkmapdata/mkmapdata.sh -A + models/lnd/clm/tools/clm4_5/mkmapdata/mkunitymap.ncl -A + models/lnd/clm/tools/clm4_5/mkmapdata/mknoocnmap.pl -A + models/lnd/clm/tools/clm4_5/mkmapdata/README -A + models/lnd/clm/tools/clm4_5/mkprocdata_map -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c121107.nc -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/map_ne30np4_nomask_to_fv1.9x2.5_nomask_aave_da_c121107.nc -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/mkprocdata_map_functions.bash -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/mkprocdata_map.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/gridmapMod.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/constMod.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/Makefile.common -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/fmain.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/shr_file_mod.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/nanMod.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/Mkdepends -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/Srcfiles -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/Filepath -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/Makefile -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/fileutils.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/src/shr_kind_mod.F90 -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/mkprocdata_map_in -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/mkprocdata_map_all -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/clm -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/mkprocdata_map_wrap -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c121107.nc -A + models/lnd/clm/tools/clm4_5/mkprocdata_map/README -A + models/lnd/clm/tools/clm4_5/ncl_scripts -A + models/lnd/clm/tools/clm4_5/ncl_scripts/cprnc.pl -A + models/lnd/clm/tools/clm4_5/ncl_scripts/getco2_historical.ncl -A + models/lnd/clm/tools/clm4_5/ncl_scripts/cprnc.ncl -A + models/lnd/clm/tools/clm4_5/ncl_scripts/getregional_datasets.pl -A + models/lnd/clm/tools/clm4_5/ncl_scripts/getregional_datasets.ncl -A + models/lnd/clm/tools/clm4_5/ncl_scripts/README -A + models/lnd/clm/tools/clm4_5/interpinic -A + models/lnd/clm/tools/clm4_5/interpinic/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c121113.nc -A + models/lnd/clm/tools/clm4_5/interpinic/interpinic.runoptions -A + models/lnd/clm/tools/clm4_5/interpinic/src -A + models/lnd/clm/tools/clm4_5/interpinic/src/interpinic.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_infnan_mod.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/src/Makefile.common -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_isnan.c -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_sys_mod.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/src/fmain.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_log_mod.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/src/Mkdepends -A + models/lnd/clm/tools/clm4_5/interpinic/src/Srcfiles -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_isnan.h -A + models/lnd/clm/tools/clm4_5/interpinic/src/Filepath -A + models/lnd/clm/tools/clm4_5/interpinic/src/Makefile -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_kind_mod.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/src/shr_const_mod.F90 -A + models/lnd/clm/tools/clm4_5/interpinic/README -A + models/lnd/clm/tools/clm4_5/mkmapgrids -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/Makefile.common -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/domainMod.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/shr_sys_mod.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/shr_file_mod.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/nanMod.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/shr_log_mod.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/Mkdepends -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/Srcfiles -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/mkmapgrids.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/Filepath -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/Makefile -A + models/lnd/clm/tools/clm4_5/mkmapgrids/src/shr_kind_mod.F90 -A + models/lnd/clm/tools/clm4_5/mkmapgrids/mkmapgrids.namelist -A + models/lnd/clm/tools/clm4_5/mkmapgrids/mkscripgrid.ncl -A + models/lnd/clm/tools/clm4_5/mkmapgrids/mkmapgrids.csh -A + models/lnd/clm/tools/clm4_5/mkmapgrids/README -A + models/lnd/clm/tools/clm4_5/mksurfdata_map -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkvarctl.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkncdio.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/clm_varpar.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkutilsMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_file_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_timer_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_log_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkindexmapMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mklaiMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksoilMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/fileutils.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_const_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkharvestMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkurbanparCommonMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Makefile -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_string_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkglcmecMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkvarpar.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/clm_varctl.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_sys_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkvocefMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkdomainMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Filepath -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/shr_kind_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkurbanparMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Makefile.common -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkgridmapMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/nanMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Srcfiles -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Mkdepends -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mklanwatMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpftMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_lookup_2d_netcdf.nc -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkncdio.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkutilsMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkindexmapMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/Srcfiles -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/Filepath -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/Makefile -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/README -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkurbanparMod.F90 -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata_map.namelist -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/README -A + models/lnd/clm/tools/clm4_5/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt -============== clm4_0 version of tools -A + models/lnd/clm/tools/clm4_0 -A + models/lnd/clm/tools/clm4_0/interpinic -A + models/lnd/clm/tools/clm4_0/interpinic/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c100322.nc -A + models/lnd/clm/tools/clm4_0/interpinic/interpinic.runoptions -A + models/lnd/clm/tools/clm4_0/interpinic/src -A + models/lnd/clm/tools/clm4_0/interpinic/src/interpinic.F90 -A + models/lnd/clm/tools/clm4_0/interpinic/src/Makefile.common -A + models/lnd/clm/tools/clm4_0/interpinic/src/shr_sys_mod.F90 -A + models/lnd/clm/tools/clm4_0/interpinic/src/fmain.F90 -A + models/lnd/clm/tools/clm4_0/interpinic/src/shr_log_mod.F90 -A + models/lnd/clm/tools/clm4_0/interpinic/src/Mkdepends -A + models/lnd/clm/tools/clm4_0/interpinic/src/Srcfiles -A + models/lnd/clm/tools/clm4_0/interpinic/src/Filepath -A + models/lnd/clm/tools/clm4_0/interpinic/src/Makefile -A + models/lnd/clm/tools/clm4_0/interpinic/src/shr_kind_mod.F90 -A + models/lnd/clm/tools/clm4_0/interpinic/src/shr_const_mod.F90 -A + models/lnd/clm/tools/clm4_0/interpinic/README -A + models/lnd/clm/tools/clm4_0/mksurfdata_map -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkvarctl.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkncdio.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/clm_varpar.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkutilsMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_file_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_timer_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_log_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkindexmapMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mklaiMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mksoilMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/fileutils.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_const_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkurbanparDomMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkharvestMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkfileMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkurbanparCommonMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/Makefile -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_string_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkglcmecMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkvarpar.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/clm_varctl.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_sys_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkvocefMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkdomainMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/Filepath -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mksurfdat.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkurbanparAvgMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/shr_kind_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/Makefile.common -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkgridmapMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/nanMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/Mkdepends -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/Srcfiles -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mklanwatMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkpftMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_lookup_2d_netcdf.nc -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_mkncdio.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_mkutilsMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_mkindexmapMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/Srcfiles -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_mod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/Filepath -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/Makefile -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/README -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/unit_testers/test_mkurbanparDomMod.F90 -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata_map.namelist -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata.pl -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/README -A + models/lnd/clm/tools/clm4_0/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt -A + models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0_tools.xml -A + models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml -A + models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml -A + models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -A + models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -A + models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -============== clm4_5 version of source (from clm45sci15_clm4_0_58) -A + models/lnd/clm/src/clm4_5 -A + models/lnd/clm/src/clm4_5/biogeochem -A + models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNGRespMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/initch4Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_BGC.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/MEGANFactorsMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/ch4RestMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNWoodProductsMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDVLightMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/ch4varcon.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDVEcosystemDynIniMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate2Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_CENTURY.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -A + models/lnd/clm/src/clm4_5/main -A + models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -A + models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -A + models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -A + models/lnd/clm/src/clm4_5/main/dynlandMod.F90 -A + models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -A + models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -A + models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -A + models/lnd/clm/src/clm4_5/main/subgridMod.F90 -A + models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -A + models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -A + models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -A + models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -A + models/lnd/clm/src/clm4_5/main/histFileMod.F90 -A + models/lnd/clm/src/clm4_5/main/pft2colMod.F90 -A + models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -A + models/lnd/clm/src/clm4_5/main/findHistFields.pl -A + models/lnd/clm/src/clm4_5/main/restFileMod.F90 -A + models/lnd/clm/src/clm4_5/main/controlMod.F90 -A + models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -A + models/lnd/clm/src/clm4_5/main/filterMod.F90 -A + models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -A + models/lnd/clm/src/clm4_5/main/clm_driver.F90 -A + models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -A + models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -A + models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -A + models/lnd/clm/src/clm4_5/main/pftvarcon.F90 -A + models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -A + models/lnd/clm/src/clm4_5/main/inicPerpMod.F90 -A + models/lnd/clm/src/clm4_5/main/clmtype.F90 -A + models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -A + models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys -A + models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/QSatMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/initSLakeMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/FracWetMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SLakeRestMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SLakeCon.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/BandDiagonalMod.F90 -A + models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/system/tests_posttag_lynx_nompi -M models/lnd/clm/test/system/TCBCFGtools.sh -M models/lnd/clm/test/system/frankfurt.batch -M models/lnd/clm/test/system/tests_pretag_bluefire_nompi -M models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml -M models/lnd/clm/test/system/TSMncl_tools.sh -M models/lnd/clm/test/system/TBLCFGtools.sh -M models/lnd/clm/test/system/README.testnames -M models/lnd/clm/test/system/tests_posttag_yong -M models/lnd/clm/test/system/yellowstone.interactive -M models/lnd/clm/test/system/TCBtools.sh -M models/lnd/clm/test/system/test_driver.sh -M models/lnd/clm/test/system/shortlist.interactive -M models/lnd/clm/test/system/tests_pretag_yellowstone_nompi -M models/lnd/clm/test/system/bluefire.batch -M models/lnd/clm/test/system/frankfurt.interactive -M models/lnd/clm/test/system/TSMscript_tools.sh -M models/lnd/clm/test/system/tests_posttag_mirage -M models/lnd/clm/test/system/gen_test_table.sh -M models/lnd/clm/test/system/nl_files/gen_domain.ne30.runoptions -M models/lnd/clm/test/system/nl_files/gen_domain.T31.runoptions -M models/lnd/clm/test/system/TOPtools.sh -M models/lnd/clm/test/system/input_tests_master -M models/lnd/clm/test/system/TSMtools.sh -M models/lnd/clm/test/system/TBLscript_tools.sh -M models/lnd/clm/test/system/yellowstone.batch -M models/lnd/clm/test/system/tests_posttag_nompi_regression -M models/lnd/clm/test/system/lynx.batch -M models/lnd/clm/test/system/TBLtools.sh -M models/lnd/clm/test/system/shortlist.batch -M models/lnd/clm/test/system/TSMCFGtools.sh - -M models/lnd/clm/bld/configure -M models/lnd/clm/bld/queryDefaultNamelist.pl -M models/lnd/clm/bld/config_files/config_definition.xml -M models/lnd/clm/bld/listDefaultNamelist.pl -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/clm.buildnml.csh -M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl - -MM models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -MM models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - -Difference in expected Fails: - - - -- -- -- -- -- -- missing datasets for us20 -- ne16 missing finidat file for 1850 -- ne60 missing finidat file for 1850 -- 1x1_tropicAtl missing finidat file for 1850 -- -- -- - - - -@@ -25,10 +13,17 @@ - - - -+ - -+ missing datasets for us20 -+ ne16 missing finidat file for 1850 -+ ne16 missing finidat file for 1850 -+ ne60 missing finidat file for 1850 -+ ne60 missing finidat file for 1850 -+ 1x1_tropicAtl missing finidat file for 1850 -+ 1x1_tropicAtl missing finidat file for 1850 - - -- missing datasets for wus12 - missing datasets for us20 - ne16 missing finidat file for 1850 - ne60 missing finidat file for 1850 -@@ -38,17 +33,6 @@ - - - -- -- -- -- cprnc showing diffs are not b4b -- problem configuring -- problem configuring -- clm stand-alone can no longer work -- clm stand-alone can no longer work -- -- -- - - - -@@ -62,24 +46,6 @@ - - - -- -- -- -- Ignore. Will be moved to CESM tests. -- Ignore. Will be moved to CESM tests. -- Ignore. Will be moved to CESM tests. -- Ignore. Will be moved to CESM tests. -- Failing for long time. endrun initiated from CNBalanceCheckMod.F90. -- Failing for long time. __cnbalancecheckmod_NMOD_cbalancecheck. -- Failing for long time. Fail because erU61 fails. -- Failing for long time. Fail because erU61 fails. -- Have been failing for a long time . -- Have been failing for a long time. -- Have been failing for a long time. -- Have been failing for a long time. -- -- -- - - - -@@ -93,91 +59,108 @@ - - - -- -- -- Initial simulation fails -- Initial simulation fails -- History files are different -- Initial simulation fails -- Initial simulation fails -- History files are different on restart (known problem - restarting mid-day with _GLC: bug 1557) -- Initial simulation fails -- build error? -- -- - - -- ???? - - - - - - -- ???? - - - - -- Initial simulation fails -- Initial simulation fails case name too - long -- History files are different on restart (known - problem restarting mid-day with _GLC: bug 1557) -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - - - -- -- -- T62 not working -- Dies early with a floating point trap -- -- Baseline comp. test will always fail -- build error? -- -- - - - History files are different on restart (known problem -restarting mid-day with _GLC: bug 1557) - - -+ -+ -+ -+ - - - History files are different on restart (known problem restarting -mid-day with _GLC: bug 1557) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - -- -+ - - -- -- -+ -+ -+ - missing datasets - missing datasets -- missing datasets -- -- -+ missing datasets -+ missing 0.1 mapping dataset (for RTM at R01) -+ -+ -+ -+ -+ -+ - -+ -+ scripts issue with ocean not threaded -+ Restart difference -+ Soil balance error on restart -+ scripts issue with ocean not threaded -+ -+ scripts issue with ocean not threaded -+ bad compset name -+ surfdata and pftdyn file mismatched -+ Soil balance error on restart -+ scripts issue component not threaded -+ missing finidat file -+ missing finidat file -+ - -- ???? -- ???? -+ problem building with mpi-serial with pgi compiler -+ missing LAPACK symbol dgbsv -+ scripts issue with ocean not threaded -+ Need LAPACK for PGI (dgbsv) -+ Need LAPACK for PGI (dgbsv) -+ Bad compset name: ICNCROP -+ scripts issue with ocean not threaded -+ -+ problem building with mpi-serial with pgi compiler -+ missing LAPACK symbol dgbsv -+ missing LAPACK symbol dgbsv -+ scripts issue with ocean not threaded -+ Need LAPACK for PGI (dgbsv) -+ Need LAPACK for PGI (dgbsv) -+ Bad compset name: ICNCROP -+ scripts issue with ocean not threaded - - - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - - CESM test lists: - - yellowstone/CESM: yes - yellowstone/CESM/allIcompsets: yes - - test_system testing: - - yellowstone batch: yes - frankfurt interactive: yes - yellowstone interactive: yes - frankfurt batch: yes - - test_driver.sh tools testing: - - yellowstone interactive: yes - frankfurt interactive: yes - - yellowstone/PTCLM: no (PTCLM still doesn't quite work) - -CLM tag used for the baseline comparison tests if applicable: clm4_0 to clm4_0_59 clm4_5 to clm45sci15_clm4_0_58 - -Changes answers relative to baseline: Yes, for some resolutions for clm4_0 -- because of new default initial condition files in compsets - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - For clm4_0... - New initial conditions for: f09/f19-I_2000, f09/f19-I_1850, f09/f19-I_1850-2000 - f09/f19-I_1948-2004, f09/f19-I_1850_SPINUP_3HrWx - f09/f19-I_RCP - -=============================================================== -=============================================================== -Tag name: clm4_0_59 -Originator(s): mvertens (Mariana Vertenstein) / erik -Date: Thu Dec 20 09:24:16 MST 2012 -One-line Summary: restructure clmtype and all pointer references, new directory structure - -Purpose of changes: - Reststucture trunk directory tree to prepare for incorporation of clm4_5 - Move all cpp-ifdefs to clm_varctl and introduce new logical variables in their place - Restructure clmtype to remove nesting - and also redo all the pointer references - All together the code can then move to having no cpp-ifdefs - -Test level of tag: - std-test - -Bugs fixed (include bugzilla ID): - None - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 147 (mkgriddata can't straddle over Greenwich) - 025 (SCM mode can NOT use a global finidat file) - 017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - 1598 (non-repeatable results when running with CNDV and/or CROP) - - Threading seems to work for all cases where CROP and/or CNDV - is not on - -Describe any changes made to build system: - New directory structure - -Describe any changes made to the namelist: - variables use_c13 and use_c14 added to namelist_definition.xml file - -List any changes to the defaults for the boundary datasets: - No - -Describe any substantial timing or memory changes: - Currently more memory for compsets without CN, etc - less memory - when CN, CNDV, etc are activated. This will be fixed in clm4_0_59. - -Code reviewed by: - self (proposed changes reviewed by Erik, Bill and Stefan) - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: - src/biogeochem -> src/clm4_0/biogeochem - src/biogeophys -> src/clm4_0/biogeophys - src/main -> src/clm4_0/main - - -List all files added and what they do: - None - -List all existing files that have been modified, and describe the changes: - - All files in src/clm4_0 have been modified relative to their - original versions to remove the cpp-ifdefs and to adjust pointer - references to new names - - M src/cpl_share/clm_cpl_indices.F90 - M src/cpl_mct/lnd_comp_mct.F90 - M src/cpl_esmf/lnd_comp_esmf.F90 - - M bld/configure - M bld/namelist_files/namelist_definition.xml - M test/system/yellowstone.interactive - M test/system/yellowstone.batch - - Add in 360x720_cruncep datasets (from Erik). - - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl --- correct number of tests - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - -Machines testing ran on: - - build-namelist unit tester: yes - - CESM test lists: - - yellowstone/CESM: yes - yellowstone/CESM/allIcompsets: no - - PTCLM - yellowstone: no - - test_system testing: - - yellowstone batch: yes - yellowstone interactive: no - frankfurt batch: no - frankfurt interactive: yes - - test_driver.sh tools testing: - - yellowstone interactive: no - frankfurt interactive: no - -Difference in expected fails from testing: - -+ Numbers change for build-namelist unit tests - - -- ???? - - - - -- ???? -- ???? -- ???? - -- -- ???? -- - - -CLM tag used for the baseline comparison tests if applicable: - clm4_0_58 - -Changes answers relative to baseline: - no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_58 -Originator(s): erik (Erik Kluzek) -Date: Fri Dec 14 05:13:33 MST 2012 -One-line Summary: Uncomment us20 and wus12 datasets, more testing to: bluefire, yellowstone, frankfurt - -Purpose of changes: - -Uncomment WRF grids in namelist xml files. Fix mkprocdata bug on lynx. - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - 1601 (mkprocdata seg faults on lynx) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: No - -Describe any changes made to the namelist: No - -List any changes to the defaults for the boundary datasets: Yes - uncomment out wus12 and us20 WRF datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, Machines, csm_share - - scripts to: scripts4_121207b - Machines to: Machines_121207 - csm_share to: share3_121204a - -List all files eliminated: None - -List all files added and what they do: Add frankfurt test lists - ->>>>>>>>>>>>>>>> Tests for frankfurt - A models/lnd/clm/test/system/frankfurt.interactive - A models/lnd/clm/test/system/frankfurt.batch - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/test_system - M models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml - - M models/lnd/clm/test/system/bluefire.batch - M models/lnd/clm/test/system/yellowstone.batch - M models/lnd/clm/test/system/nl_files/mkprocdata_ne30_to_f19_I2000 - ->>>>>>>>>>>>>>>> Fix mkprocdata and allow it to run from a different exe directory for testing - M models/lnd/clm/tools/mkprocdata_map/src/mkprocdata_map.F90 - M models/lnd/clm/tools/mkprocdata_map/src/gridmapMod.F90 - M models/lnd/clm/tools/mkprocdata_map/src/fmain.F90 - M models/lnd/clm/tools/mkprocdata_map/src/shr_file_mod.F90 - M models/lnd/clm/tools/mkprocdata_map/src/fileutils.F90 - M models/lnd/clm/tools/mkprocdata_map/mkprocdata_map_all - M models/lnd/clm/tools/mkprocdata_map/mkprocdata_map_wrap - ->>>>>>>>>>>>>>>> Fix bug in unit-tester - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl - ->>>>>>>>>>>>>>>> Uncomment WRF files - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - -Machines testing ran on: - - build-namelist unit tester: yes - - CESM test lists: - - bluefire/CESM: yes - bluefire/CESM/allIcompsets: yes - lynx/CESM: no - - bluefire/PTCLM: no - - test_system testing: - - bluefire batch: yes - bluefire interactive: yes - yellowstone batch: yes - yellowstone interactive: yes - frankfurt batch: yes - frankfurt interactive: yes - - test_driver.sh tools testing: - - bluefire interactive: yes - lynx interactive: yes - yellowstone interactive: yes - frankfurt interactive: yes - -Difference in expected fails from testing: - -Index: expectedClmTestFails.xml -=================================================================== ---- expectedClmTestFails.xml (revision 42691) -+++ expectedClmTestFails.xml (working copy) -@@ -5,12 +5,12 @@ - - - -- - - -- ne16 missing finidat file for 1850 -- ne60 missing finidat file for 1850 -- 1x1_tropicAtl missing finidat file for 1850 -+ missing datasets for us20 -+ ne16 missing finidat file for 1850 -+ ne60 missing finidat file for 1850 -+ 1x1_tropicAtl missing finidat file for 1850 - - - -@@ -24,6 +24,17 @@ - - - -+ -+ -+ -+ -+ missing datasets for wus12 -+ missing datasets for us20 -+ ne16 missing finidat file for 1850 -+ ne60 missing finidat file for 1850 -+ 1x1_tropicAtl missing finidat file for 1850 -+ -+ - - - -@@ -101,6 +112,19 @@ - - - -+ -+ -+ ???? -+ ???? -+ -+ -+ -+ -+ Initial simulation fails -+ Initial simulation fails case name too -long -+ History files are different on restart (known -problem restarting mid-day with _GLC: bug 1557) -+ -+ - - - -@@ -118,6 +142,11 @@ - History files are different on restart (known problem -restarting mid-day with _GLC: bug 1557) - - -+ -+ -+ History files are different on restart (known problem restarting -mid-day with _GLC: bug 1557) -+ -+ - - - -@@ -128,6 +157,18 @@ - missing datasets - - -+ -+ -+ ???? -+ ???? -+ ???? -+ ???? -+ ???? -+ -+ -+ ???? -+ -+ - - - - -CLM tag used for the baseline comparison tests if applicable: clm4_0_58 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -=============================================================== -Tag name: clm4_0_57 -Originator(s): muszala (Muszala Stefan 303-497-1320 CGD) -Date: Fri Nov 30 14:20:13 MST 2012 -One-line Summary: update trunk with release mods, some rtm fixes - -Purpose of changes: - -CLM: Merge the changes Erik made in the release branch tags to trunk. -RTM: Add effective velocity as a namelist variable. - Change rdirc file. - Add RTM tests to test_system batch CLM tests. - Clean up logic in RtmFloodInit so R01 works without SLOPE and MAX_VOLR. - Change rdirc file to rdirc_0.5x0.5_simyr2000_slpmxvl_c120717.nc which is - correct and contains FLOOD and MAX_VOLR. This fixes an error in choice - of rdirc file from clm4_0_55 / rtm1_0_10 - -Requirements for tag: - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: Changed RTM rdirc file. - -Describe any substantial timing or memory changes: None Known - -Code reviewed by: Erik, Tony, Mariana (in progress) - -List any svn externals directories updated (csm_share, mct, etc.): - - rtm1_0_13 - - scripts4_121127 - - Machines_121126 - - drvseq4_2_13 - - datm8_121123 - - cism1_121114 - -List all files eliminated: - - - Deleted during release tag cleanup -D models/lnd/clm/test/system/TCB.sh -D models/lnd/clm/test/system/tests_pretag_bluefire -D models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dh -D models/lnd/clm/test/system/config_files/17p_cndvsc_m -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_m -D models/lnd/clm/test/system/config_files/17p_cndvsc_o -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_o -D models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dm -D models/lnd/clm/test/system/config_files/_persc_dh -D models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do -D models/lnd/clm/test/system/config_files/17p_cndvsc_s -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_s -D models/lnd/clm/test/system/config_files/_persc_dm -D models/lnd/clm/test/system/config_files/_persc_do -D models/lnd/clm/test/system/config_files/_scnv_ds -D models/lnd/clm/test/system/config_files/_persc_ds -D models/lnd/clm/test/system/config_files/17p_sc_dh -D models/lnd/clm/test/system/config_files/17p_sc_dm -D models/lnd/clm/test/system/config_files/17p_sc_do -D models/lnd/clm/test/system/config_files/_sc_dh -D models/lnd/clm/test/system/config_files/17p_sc_ds -D models/lnd/clm/test/system/config_files/_sc_dm -D models/lnd/clm/test/system/config_files/21p_cncrpsc_h -D models/lnd/clm/test/system/config_files/17p_cnsc_h -D models/lnd/clm/test/system/config_files/_sc_do -D models/lnd/clm/test/system/config_files/21p_cncrpsc_dh -D models/lnd/clm/test/system/config_files/17p_cnsc_dh -D models/lnd/clm/test/system/config_files/21p_cncrpsc_m -D models/lnd/clm/test/system/config_files/17p_cnsc_m -D models/lnd/clm/test/system/config_files/_sc_ds -D models/lnd/clm/test/system/config_files/21p_cncrpsc_o -D models/lnd/clm/test/system/config_files/17p_cnsc_o -D models/lnd/clm/test/system/config_files/17p_cnsc_dm -D models/lnd/clm/test/system/config_files/21p_cncrpsc_dm -D models/lnd/clm/test/system/config_files/17p_cnsc_do -D models/lnd/clm/test/system/config_files/17p_cnc13sc_dh -D models/lnd/clm/test/system/config_files/21p_cncrpsc_do -D models/lnd/clm/test/system/config_files/21p_cncrpsc_s -D models/lnd/clm/test/system/config_files/17p_sc_h -D models/lnd/clm/test/system/config_files/17p_cnsc_ds -D models/lnd/clm/test/system/config_files/21p_cncrpsc_ds -D models/lnd/clm/test/system/config_files/17p_cnc13sc_dm -D models/lnd/clm/test/system/config_files/_mexsc_ds -D models/lnd/clm/test/system/config_files/17p_cnc13sc_do -D models/lnd/clm/test/system/config_files/17p_sc_m -D models/lnd/clm/test/system/config_files/17p_sc_o -D models/lnd/clm/test/system/config_files/_sc_h -D models/lnd/clm/test/system/config_files/17p_cnnfsc_dh -D models/lnd/clm/test/system/config_files/_sc_m -D models/lnd/clm/test/system/config_files/17p_cnnfsc_dm -D models/lnd/clm/test/system/config_files/_sc_o -D models/lnd/clm/test/system/config_files/17p_cndvsc_dh -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_dh -D models/lnd/clm/test/system/config_files/17p_cnnfsc_do -D models/lnd/clm/test/system/config_files/_sc_s -D models/lnd/clm/test/system/config_files/17p_cndvsc_dm -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_dm -D models/lnd/clm/test/system/config_files/17p_cndvsc_do -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_do -D models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_ds -D models/lnd/clm/test/system/config_files/_vansc_ds -D models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm -D models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do -D models/lnd/clm/test/system/config_files/_nil3sc_dh -D models/lnd/clm/test/system/config_files/_nil3sc_dm -D models/lnd/clm/test/system/config_files/_scsnf_dh -D models/lnd/clm/test/system/config_files/_scsnf_dm -D models/lnd/clm/test/system/config_files/_scsnf_do -D models/lnd/clm/test/system/config_files/21p_cndvcrpsc_h -D models/lnd/clm/test/system/config_files/17p_cndvsc_h -D models/lnd/clm/test/system/TBL.sh -D models/lnd/clm/test/system/tests_pretag_edinburgh -D models/lnd/clm/test/system/tests_pretag_edinburgh_nompi -D models/lnd/clm/test/system/TBR.sh -D models/lnd/clm/test/system/TER.sh -D models/lnd/clm/test/system/mknamelist -D models/lnd/clm/test/system/tests_posttag_hybrid_regression -D models/lnd/clm/test/system/tests_posttag_purempi_regression -D models/lnd/clm/test/system/TRP.sh -D models/lnd/clm/test/system/tests_pretag_jaguarpf -D models/lnd/clm/test/system/TSMrst_tools.sh -D models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi -D models/lnd/clm/test/system/nl_files/nl_per -D models/lnd/clm/test/system/nl_files/nl_voc -D models/lnd/clm/test/system/nl_files/clm_std -D models/lnd/clm/test/system/nl_files/multi_inst -D models/lnd/clm/test/system/nl_files/multi_inst/multi_inst -D models/lnd/clm/test/system/nl_files/multi_inst/multi_inst_1 -D models/lnd/clm/test/system/nl_files/multi_inst/multi_inst_2 -D models/lnd/clm/test/system/nl_files/multi_inst/multi_inst_3 -D models/lnd/clm/test/system/nl_files/clm_nortm -D models/lnd/clm/test/system/nl_files/clm_transient_rcp2.6 -D models/lnd/clm/test/system/nl_files/clm_ndepdyn -D models/lnd/clm/test/system/nl_files/clm_transient_rcp4.5 -D models/lnd/clm/test/system/nl_files/clm_pftdyn -D models/lnd/clm/test/system/nl_files/clm_transient_rcp8.5 -D models/lnd/clm/test/system/nl_files/clm_per0 -D models/lnd/clm/test/system/nl_files/nl_ptsmode_ocn -D models/lnd/clm/test/system/nl_files/nl_urb_br -D models/lnd/clm/test/system/nl_files/clm_spin -D models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp6 -D models/lnd/clm/test/system/nl_files/clm_urb1pt -D models/lnd/clm/test/system/nl_files/nl_urb -D models/lnd/clm/test/system/nl_files/nl_crcrop -D models/lnd/clm/test/system/nl_files/clm_per -D models/lnd/clm/test/system/nl_files/clm_drydep -D models/lnd/clm/test/system/nl_files/nl_std -D models/lnd/clm/test/system/nl_files/clm_glcmec -D models/lnd/clm/test/system/nl_files/clm_transient_rcp6 -D models/lnd/clm/test/system/nl_files/nl_crop -D models/lnd/clm/test/system/nl_files/clm_usrdat -D models/lnd/clm/test/system/nl_files/nl_cn_conly -D models/lnd/clm/test/system/nl_files/clm_stdIgnYr -D models/lnd/clm/test/system/nl_files/clm_transient_20thC -D models/lnd/clm/test/system/nl_files/nl_ptsmode -D models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp2.6 -D models/lnd/clm/test/system/nl_files/clm_irrig -D models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp4.5 -D models/lnd/clm/test/system/nl_files/nl_lfiles -D models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp8.5 -D models/lnd/clm/test/system/TSMpergro.sh -D models/lnd/clm/test/system/TSMcnspinup.sh -D models/lnd/clm/test/system/TBLrst_tools.sh -D models/lnd/clm/test/system/CLM_runcmnd.sh -D models/lnd/clm/test/system/TSM.sh -D models/lnd/clm/test/system/tests_posttag_lynx -D models/lnd/clm/tools/mkprocdata_map/camhomme -D models/lnd/clm/tools/mkprocdata_map/camhomme/src -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/mkprocdata_map.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/gridmapMod.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/Depends -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/domainMod.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/shr_file_mod.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/nanMod.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/Srcfiles -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/Filepath -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/Makefile -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/fileutils.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/src/shr_kind_mod.F90 -D models/lnd/clm/tools/mkprocdata_map/camhomme/mkprocdata_map_in -D models/lnd/clm/tools/mkprocdata_map/clm/src -D models/lnd/clm/tools/mkprocdata_map/clm/src/mkprocdata_map.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/gridmapMod.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/constMod.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/fmain.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/shr_file_mod.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/nanMod.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/Mkdepends -D models/lnd/clm/tools/mkprocdata_map/clm/src/Srcfiles -D models/lnd/clm/tools/mkprocdata_map/clm/src/Filepath -D models/lnd/clm/tools/mkprocdata_map/clm/src/Makefile -D models/lnd/clm/tools/mkprocdata_map/clm/src/fileutils.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/src/shr_kind_mod.F90 -D models/lnd/clm/tools/mkprocdata_map/clm/mkprocdata_map_in -D models/lnd/clm/tools/mkprocdata_map/clm/mkprocdata_map_all -D models/lnd/clm/tools/mkprocdata_map/clm/mkprocdata_map_wrap -D models/lnd/clm/tools/mkprocdata_map/clm/README -D models/lnd/clm/tools/ncl_scripts/RMSbluefire.dat -D models/lnd/clm/tools/ncl_scripts/RMSlahey.dat -D models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl -D models/lnd/clm/tools/ncl_scripts/RMSjaguar.dat -D models/lnd/clm/tools/ncl_scripts/RMSintel.dat -D models/lnd/clm/tools/ncl_scripts/RMSintrepid.dat -D models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl -D models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl -D models/lnd/clm/tools/ncl_scripts/runDepositionRegrid.pl -D models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl -D models/lnd/clm/tools/ncl_scripts/pftdyntest2raw.ncl -D models/lnd/clm/bld/config_files/config_sys_defaults.xml -D models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl -D models/lnd/clm/bld/namelist_files/datm-build-namelist -D models/lnd/clm/bld/namelist_files/checklatsfiles.ncl -D models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml -D models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml - -List all files added and what they do: - - - Added for RTM testing -A models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOn/user_nl_rtm -A models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOn -A models/lnd/clm/test/system/user_nl_dirs/rtm/rtmR01/user_nl_rtm -A models/lnd/clm/test/system/user_nl_dirs/rtm/rtmR01 -A models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOff/user_nl_rtm -A models/lnd/clm/test/system/user_nl_dirs/rtm/rtmOff -A models/lnd/clm/test/system/user_nl_dirs/rtm - - Added from release tags -A models/lnd/clm/test/system/yellowstone.interactive -A models/lnd/clm/test/system/tests_pretag_yellowstone_nompi -A models/lnd/clm/test/system/nl_files/mkprocdata_ne30_to_f19_I2000 -A models/lnd/clm/test/system/yellowstone.batch -A models/lnd/clm/tools/mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c121107.nc -A models/lnd/clm/tools/mkprocdata_map/map_ne30np4_nomask_to_fv1.9x2.5_nomask_aave_da_c121107.nc -A models/lnd/clm/tools/mkprocdata_map/mkprocdata_map_functions.bash -A models/lnd/clm/tools/mkprocdata_map/src/mkprocdata_map.F90 -A models/lnd/clm/tools/mkprocdata_map/src/gridmapMod.F90 -A models/lnd/clm/tools/mkprocdata_map/src/constMod.F90 -A models/lnd/clm/tools/mkprocdata_map/src/Makefile.common -A models/lnd/clm/tools/mkprocdata_map/src/fmain.F90 -A models/lnd/clm/tools/mkprocdata_map/src/shr_file_mod.F90 -A models/lnd/clm/tools/mkprocdata_map/src/nanMod.F90 -A models/lnd/clm/tools/mkprocdata_map/src/Mkdepends -A models/lnd/clm/tools/mkprocdata_map/src/Srcfiles -A models/lnd/clm/tools/mkprocdata_map/src/Filepath -A models/lnd/clm/tools/mkprocdata_map/src/Makefile -A models/lnd/clm/tools/mkprocdata_map/src/fileutils.F90 -A models/lnd/clm/tools/mkprocdata_map/src/shr_kind_mod.F90 -A models/lnd/clm/tools/mkprocdata_map/src -A models/lnd/clm/tools/mkprocdata_map/mkprocdata_map_in -A models/lnd/clm/tools/mkprocdata_map/mkprocdata_map_all -A models/lnd/clm/tools/mkprocdata_map/mkprocdata_map_wrap -A models/lnd/clm/tools/mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c121107.nc -A models/lnd/clm/tools/mkprocdata_map/README -A models/lnd/clm/bld/config_query -A models/lnd/clm/doc/UsersGuide/modelnl/xmldef2html_compsets -A models/lnd/clm/doc/UsersGuide/modelnl/showinfo.js -A models/lnd/clm/doc/UsersGuide/modelnl/index.cpp -A models/lnd/clm/doc/UsersGuide/modelnl/Makefile -A models/lnd/clm/doc/UsersGuide/modelnl - -List all existing files that have been modified, and describe the changes: - - - put back qflx_snomelt for consistency with older models. clm4_0_55 mods to the snow - balance check otherwise only effect the diagnostic fields errh2osno, snow_source and snow_sinks -M models/lnd/clm/src/main/histFldsMod.F90 - - modified for RTM testing -M config_files/config_CLMtestCompsets.xml -M bluefire.batch - - modified during release tag modification -M models/lnd/clm/test/system/tests_posttag_lynx_nompi -M models/lnd/clm/test/system/mirage.interactive -M models/lnd/clm/test/system/test_system -M models/lnd/clm/test/system/tests_pretag_bluefire_nompi -M models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml -M models/lnd/clm/test/system/config_files/README -M models/lnd/clm/test/system/README.testnames -M models/lnd/clm/test/system/tests_posttag_yong -M models/lnd/clm/test/system/TCBtools.sh -M models/lnd/clm/test/system/test_driver.sh -M models/lnd/clm/test/system/lynx.interactive -M models/lnd/clm/test/system/shortlist.interactive -M models/lnd/clm/test/system/TSMscript_tools.sh -M models/lnd/clm/test/system/tests_posttag_mirage -M models/lnd/clm/test/system/gen_test_table.sh -M models/lnd/clm/test/system/input_tests_master -M models/lnd/clm/test/system/README -M models/lnd/clm/test/system/tests_posttag_nompi_regression -M models/lnd/clm/test/system/bluefire.interactive -M models/lnd/clm/tools/mkmapdata/mkmapdata.sh -M models/lnd/clm/tools/ncl_scripts -M models/lnd/clm/tools/ncl_scripts/README -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl -M models/lnd/clm/tools/interpinic -M models/lnd/clm/tools/mksurfdata_map/src -M models/lnd/clm/tools/mksurfdata_map/src/mkncdio.F90 -M models/lnd/clm/tools/mksurfdata_map/src/mkutilsMod.F90 -M models/lnd/clm/tools/mksurfdata_map/src/mkdomainMod.F90 -M models/lnd/clm/tools/mksurfdata_map/src/mksurfdat.F90 -M models/lnd/clm/tools/mksurfdata_map/src/mkgridmapMod.F90 -M models/lnd/clm/tools/mksurfdata_map/mksurfdata_map.namelist -M models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl -M models/lnd/clm/tools/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt -M models/lnd/clm/bld -M models/lnd/clm/bld/configure -M models/lnd/clm/bld/queryDefaultNamelist.pl -M models/lnd/clm/bld/user_nl_clm -M models/lnd/clm/bld/config_files/config_definition.xsl -M models/lnd/clm/bld/config_files/config_definition.xml -M models/lnd/clm/bld/listDefaultNamelist.pl -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/clm.cpl7.template -M models/lnd/clm/bld/clm.buildnml.csh -M models/lnd/clm/bld/README -M models/lnd/clm/bld/namelist_files/namelist_definition.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl -M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/glacierMEC_pd.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml -M models/lnd/clm/doc/UsersGuide/clm_ug.xml -M models/lnd/clm/doc/UsersGuide/appendix.xml -M models/lnd/clm/doc/UsersGuide/ptclm.xml -M models/lnd/clm/doc/Quickstart.userdatasets -M models/lnd/clm/doc/IMPORTANT_NOTES -M models/lnd/clm/doc/Quickstart.GUIDE -M models/lnd/clm/doc/ChangeLog -M models/lnd/clm/doc/CodeReference/Filepath -M models/lnd/clm/doc/KnownLimitations -M models/lnd/clm/doc/ChangeSum -M models/lnd/clm/doc/KnownBugs -M models/lnd/clm/doc/README -M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 -M ChangeLog -M ChangeSum -M READM - -Machines testing ran on: (in progress) - - build-namelist unit tester: yes - - - OK. All FAILs (~78 of them) should pass during the next round. - - CESM test lists: - - bluefire/CESM: yes - - -Fail due to throuput comparison problems: - - FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.GC.164220.tputcomp.clm4_0_56 - FAIL ERS_Lm3.1x1_vancouverCAN.I1PT.bluefire_ibm.GC.164220.tputcomp.clm4_0_56 - - -Fail due to new and correct rdirc file. diffs in r2x_Forr_roff & r2x_Forr_ioff - These should pass next time around: - - FAIL ERS_D.f45_g37.I.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL NCK.T31_g37.I.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL PET_PT.f45_g37.I1850.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERI.T31_g37.IG1850.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL SMS.T31_g37.IG4804.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL SMS.1x1_mexicocityMEX.I1PT.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERS_Lm3.1x1_vancouverCAN.I1PT.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL PET_PT.f10_f10.I20TRCN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.GC.164220.compare_hist.clm4_0_56 - - bluefire/CESM/allIcompsets: yes - - Error in SBN script handling in generate of namelist files so all compare tests are BFAILs. - - lynx/CESM: no - - bluefire/PTCLM: no - - test_system testing: - - bluefire batch: yes - - 4 xFAIL. The rest that fail now, but should pass the next time around. - - - Fail due to new and correct rdirc file. diffs in r2x_Forr_roff & r2x_Forr_ioff - These should pass next time around: - - FAIL ERS_Ld211.f10_f10.ICNADSPIN.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - FAIL ERS_Ln48_D_P64x16.ne30_g16.ICN.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - FAIL PET_D_P1x64.ne30_g16.ICN.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - FAIL ERS_Ld211.f10_f10.I_2000_VOC_CN.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - - - Fail due to throughput comparison - - FAIL ERS_Ld211.f10_f10.ICNADSPIN.bluefire_ibm.GC.164759.tputcomp.clm4_0_56 - FAIL ERS_Ld211_P192x2.f19_g16.I_2000_CNDV_CROP.bluefire_ibm.GC.164759.tputcomp.clm4_0_56 - - - Will pass next time, these tests just introduced - - BFAIL ERS.f19_g16.I_2000_CN_rtmR01.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - BFAIL ERS.f19_g16.I_2000_CN_rtmOff.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - BFAIL ERS.f19_g16.I_2000_CN_rtmOn.bluefire_ibm.GC.164759.compare_hist.clm4_0_56 - - bluefire interactive: yes - - - xFAIL or new tests that will pass next time (missing baselines): - - BFAIL ERS_D_Mmpi-serial.CLM_USRDAT.IalaskaCN.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_D_Mmpi-serial.CLM_USRDAT.I_2000_1PTFRC_US-UMB.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_P1x64_Mmpi-serial.f45_g37.I_1850_SPINUP_3HrWx_CN.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_Ld211_Mmpi-serial.1x1_camdenNJ.I_2000_VOC.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_Ly3_Mmpi-serial.1x1_brazil.I_2000.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_D_P1x25_Mmpi-serial.5x5_amazon.I_2000.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_D_Mmpi-serial.1x1_asphaltjungleNJ.I_2000_VOC.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_Ld211_Mmpi-serial.1x1_brazil.I_2000_CN.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_Ln48_D_P1x64_Mmpi-serial.f19_g16.I_2000_GLCMECPD.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_Ly3_Mmpi-serial.1x1_brazil.I_2000_CNDV.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - BFAIL ERS_Ld211_Mmpi-serial.1x1_brazil.I_2000_VOC_SNCRFRC_CN.bluefire_ibm.GC.164744.compare_hist.clm4_0_56 - - lynx/pgi batch: yes - - - xFAIL or will pass next time (new rdirc file effecting r2x_Forr_roff & r2x_Forr_ioff) - - FAIL ERS_Ln48_D.f45_g37.I_2000_VOC.lynx_pgi.GC.170117.compare_hist.clm4_0_56 - FAIL ERS_Ln48_D.f10_f10.I_2000_CN.lynx_pgi.GC.170117.compare_hist.clm4_0_56 - - lynx/pgi interactive: yes - - - OK except for new test that will pass next time (missing baselines): - - BFAIL SMS_RLA_Mmpi-serial.f45_f45.I.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - BFAIL SMS_Mmpi-serial.CLM_USRDAT.I_2000_1PTFRC_US-UMB.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - BFAIL ERS_Ld211_Mmpi-serial.1x1_brazil.I_2000.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - BFAIL ERS_Ln48_D_P1x12_Mmpi-serial.f10_f10.ICNCROP.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - BFAIL ERS_Ld211_Mmpi-serial.1x1_camdenNJ.I_2000_VOC.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - BFAIL SMS_D_Mmpi-serial.1x1_vancouverCAN.I1PT.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - BFAIL ERS_Mmpi-serial.1x1_mexicocityMEX.I1PT.lynx_pgi.GC.170039.compare_hist.clm4_0_56 - - lyn/intel mirage testlist: yes - - - OK except for new tests will pass next time (missing baselines): - - BFAIL ERS_Mmpi-serial.1x1_brazil.I_2000.lynx_intel.GC.095009.compare_hist.clm4_0_56 - BFAIL ERI_D_Mmpi-serial.1x1_camdenNJ.I_2000_VOC.lynx_intel.GC.095009.compare_hist.clm4_0_56 - BFAIL ERS_D_Mmpi-serial.1x1_asphaltjungleNJ.I_2000_VOC.lynx_intel.GC.095009.compare_hist.clm4_0_56 - BFAIL ERS_Ln48_D_P1x12_Mmpi-serial.f10_f10.I_2000_CN.lynx_intel.GC.095009.compare_hist.clm4_0_56 - - test_driver.sh tools testing: - - bluefire interactive: yes - - test 001 fails due to a bug in mkprocdata_map_wrap - test 002 fails due to 001 - test 008 will pass next time - - lynx interactive: no - -CLM tag used for the baseline comparison tests if applicable: - -Changes answers relative to baseline: - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: modification to default value for effvel in RtmMod.F90 - changes the values of r2x_Forr_roff & r2x_Forr_ioff. This causes cprnc to fail. - This should pass in the next round and matches the value found in CLM4.5. - - - real(r8),parameter :: effvel(nt_rtm) = 0.7_r8 ! downstream velocity (m/s) - + real(r8),parameter :: effvel(nt_rtm) = 1.0_r8 ! downstream velocity (m/s) - - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - with flooding on and new rdirc file, climate may be different. - with flooding off we have b4b - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm4_0_56 -Originator(s): sacks (Sacks Bill 303-497-1762 CGD) -Date: Tue Nov 27 14:12:42 MST 2012 -One-line Summary: fix s2x tsrf, add s2x diagnostics - -Purpose of changes: - -The s2x tsrf field was not being time-averaged; this is fixed now. - -Also, add history fields giving per-column diagnostics of the fields sent -from CLM to GLC. - -Requirements for tag: - fix bug 1590 - test on bluefire (CESM, int, bat), lynx/pgi (int,bat), mirage-test for lynx_intel - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): 1590 (surface temperature sent from CLM to GLC not averaged properly) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: erik - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>>> Do time-averaging of tsrf field; remove calls to create_clm_s2x -M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - ->>>>>>> Call to create_clm_s2x now done here instead of lnd_comp_mct / ->>>>>>> lnd_comp_esmf, so that clm_s2x can be used for hist file writes ->>>>>>> (this is needed so that the fields are updated before the history ->>>>>>> updates happen in the driver) -M models/lnd/clm/src/main/clm_initializeMod.F90 -M models/lnd/clm/src/main/clm_driver.F90 - ->>>>>>> Clean up interface to create_clm_s2x -M models/lnd/clm/src/main/clm_glclnd.F90 - ->>>>>>> Add capability to output fields sent from CLM to GLC -M models/lnd/clm/src/main/histFileMod.F90 -M models/lnd/clm/src/main/histFldsMod.F90 - ->>>>>>> Remove non-existent PMT test -M models/lnd/clm/test/system/lynx.batch - ->>>>>>> Add ERS_Ln48_P96x2.f19_g16.I_2000_VOC_SNCRFRC_CN_GLCMECPD to xFail ->>>>>>> list; add comment -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -Machines testing ran on: - - build-namelist unit tester: no - - CESM test lists: - - bluefire/CESM: yes - All PASS except: - FAIL ERI.T31_g37.IG1850.bluefire_ibm.GC.101712.compare_hist.clm4_0_55 - FAIL SMS.T31_g37.IG4804.bluefire_ibm.GC.101712.compare_hist.clm4_0_55 - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.GC.101712.compare_hist.clm4_0_55 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.bluefire_ibm.GC.101712.compare_hist.clm4_0_55 - - These are expected failures: diffs in topo and tsrf fields - sent to coupler, and topo diffs are small (RMS ~ 1e-13) - - bluefire/CESM/allIcompsets: no - lynx/CESM: no - - bluefire/PTCLM: no - - test_system testing: - - bluefire batch: yes - All PASS or xFAIL except: - FAIL ERS_Ld211_P192x2.f19_g16.I_2000_CNDV_CROP.bluefire_ibm.GC.101753.compare_hist.clm4_0_55 - - I believe this is an old problem, not due to the changes here: see bug 1598 - - bluefire interactive: yes - All PASS or xFAIL - - lynx/pgi batch: yes - All PASS or xFAIL - - lynx/pgi interactive: yes - All PASS - - lyn/intel mirage testlist: yes - All PASS - - test_driver.sh tools testing: - - bluefire interactive: no - lynx interactive: no - -CLM tag used for the baseline comparison tests if applicable: clm4_0_55 - -Difference in expected fails from testing: - - Note: the additional expected fail is NOT a new failure, it is just newly - documented - - --- models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml (.../trunk_tags/clm4_0_55) (revision 42229) - +++ models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml (.../branches/fix_glc_tsrf) (revision 42229) - @@ -90,7 +90,7 @@ - - - Initial simulation fails - - History files are different on restart - + History files are different on restart (known problem restarting mid-day with _GLC: bug 1557) - Initial simulation fails - build error? - - @@ -113,6 +113,9 @@ - - - - + - + History files are different on restart (known problem restarting mid-day with _GLC: bug 1557) - + - - - - -Changes answers relative to baseline: YES: changes tsrf and topo fields -sent to GLC (everything else bfb) - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: glc_mec - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - new climate for tsrf; roundoff-level for topo field sent to GLC. Note that these - fields are limited to GLC, and don't feed back to the atmosphere at all. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? For topo: examined differences in cprnc output - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: None done - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_0_55 -Originator(s): muszala (Muszala Stefan 303-497-1320 CGD) -Date: Thu Nov 15 10:17:23 MST 2012 -One-line Summary: bring in flooding capability - -Purpose of changes: - - Test driver mods from Tony that allows flooding from rof to lnd. Also - brought in code from the rtmflood branch to handle the new flooding values. - Fthresh calculed by reading SLOPE and MAX_VOLR from the rdirc file. Merged - in qflx_snow_melt from Swensons perfmafrost sims branch to fix snow - balance problems in BalanceCheckMod.F90. - -Requirements for tag: - - Test flooding code in CLM by varying fthresh. Test coupler mods by - plotting coupler fields. Look at differences in overall energy balance - with and without flooding. - -Test level of tag: doc, critical, standard, std-test, reg-test - - Critical. Bluefire CESM/CLM tests and namelist tests only - -Bugs fixed (include bugzilla ID): - - N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - - N/A - -Describe any changes made to the namelist: - - N/A - -List any changes to the defaults for the boundary datasets: - - N/A - -Describe any substantial timing or memory changes: - - N/A - -Code reviewed by: - - Tony Craig, Sean Swenson - -List any svn externals directories updated (csm_share, mct, etc.): - - Updated all of the following (in relation to clm4_0_54) - scripts4_121105 - Machines_121106 - drvseq4_2_11 - rtm1_0_10 - cism1_121012 - share3_121025 - pio1_5_7 - mapping_121106 - -List all files eliminated: - - N/A - -List all files added and what they do: - - N/A - -List all existing files that have been modified, and describe the changes: - - -the following all for bringing in qflx_snow_melt for new - -balance check calculation with flooding - M models/lnd/clm/src/main/clmtypeInitMod.F90 - M models/lnd/clm/src/main/histFldsMod.F90 - M models/lnd/clm/src/main/mkarbinitMod.F90 - M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 - M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 - M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 - M models/lnd/clm/src/biogeophys/Hydrology1Mod.F90 - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 - M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 - - - mods to bring in flooding from rtmflood - M main/clm_driver.F90 - M main/cmlmtype.F90 - M main/clmtypeInitMod.F90 - M main/histFldsMod.F90 - M main/mkarbinitMod.F90 - M main/clm_varcon.F90 - - - fixes for some test problems - M build-namelist_test.pl - M clm/bld/configure - -Machines testing ran on: - - build-namelist unit tester: yes - - 6 xFails - all OK. - - CESM test lists: - - bluefire/CESM: yes - - Fail due to new coupler fields: - - new field r2x_Forr_roff - - NCK.T31_g37.I.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERS_E.T31_g37.I1850.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERI.T31_g37.IG1850.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERH_D.T31_g37.I1850CN.bluefire_ibm.GC.165350.compare_hist.clm4_0_54 - SMS.T31_g37.IG4804.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.GC.165350.compare_hist.clm4_0_54 - - new fields r2x_Forr_roff & r2x_Forr_ioff - - ERS_D.f45_g37.I.bluefire_ibm.GC.165350.compare_hist.clm4_0_54 - PET_PT.f45_g37.I1850.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERB.ne30_g16.I_1948-2004.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERS_Lm3.f19_g16.IGRCP60CN.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - PET_PT.f10_f10.I20TRCN.bluefire_ibm.GC.165350.compare_hist.clm4_0_54 - SMS.f10_f10.IRCP45CN.bluefire_ibm.C.092829.compare_hist.clm4_0_54 - ERS_D.f19_g16.IRCP85CN.bluefire_ibm.GC.165350.compare_hist.clm4_0_54 - - Fail due to throughput differences: - - FAIL ERS_D.f45_g37.I.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERI.T31_g37.IG1850.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL SMS.T31_g37.IG4804.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL SMS.1x1_numaIA.ICN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERS_Lm3.1x1_vancouverCAN.I1PT.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERS_Lm3.f19_g16.IGRCP60CN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.GC.165350.tputcomp.clm4_0_54 - - bluefire/CESM/allIcompsets: no - lynx/CESM: no - - bluefire/PTCLM: no - - test_system testing: - - bluefire batch: no - bluefire interactive: no - lynx/pgi batch: no - lynx/pgi interactive: no - lyn/intel mirage testlist: no - - test_driver.sh tools testing: - - bluefire interactive: no - lynx interactive: no - -CLM tag used for the baseline comparison tests if applicable: - - us20/wus12 tests were removed so removed from expected fail - ne16/ne60/1x1_tropicAtl 20thC transient tests fails -- need finidat files - New bug: ERS_Ln48_D_P1x64.f19_g16.I_2000_GLCMECPD (bugzilla 1557) - New testname: ERS_Ln48_D_P1x64.f45_g37.I_2000_VOC (was ERS48s_...) - New fail: ERS_Ld211.1x1_camdenNJ.I_2000_VOC, ERS_Ld211_D_P112x2.f10_f10.ICNCROP - Some ERS_L tests now pass that failed previously - I1PT tests pass now - Most SBN tests pass now - Intel single point tests pass now -@@ -5,14 +5,11 @@ - - - -- us20 not fully implmented -- us20 not fully implmented -- wus12 not fully implmented -- wus12 not fully implmented - - -- us20 not fully implemented -- wus12 not fully implemented -+ ne16 missing finidat file for 1850 -+ ne60 missing finidat file for 1850 -+ 1x1_tropicAtl missing finidat file for 1850 - - - -@@ -89,19 +86,17 @@ - CESM script issue - Restart length different - Restart length different -- Initial simulation fails -+ Initial simulation fails -+ History files are different on restart - Initial simulation fails - build error? - - - - -- datm namelist problem for single-point forcing -- datm namelist problem for single-point forcing -+ ???? - - -- CESM script issue -- CESM script issue - - - -@@ -110,10 +105,8 @@ - - - T62 not working -- ignore_ic_date is incompatable with crop! -- CESM script problem didn't see both files -- CESM script problem didn't see both files -- build error? -+ Dies early with a floating point trap -+ build error? - - - -@@ -123,22 +116,9 @@ - - - -- datm namelist issue -- datm namelist issue -- datm namelist issue - 277/277 < PASS> - Successully ran all testing for build-namelist - - Cleanup files created - rm: lnd_in.default: A file or directory in the path name does not exist. - rm: temp_file.txt: A file or directory in the path name does not exist. - # Looks like you failed 4 tests of 277. - -%%cesm/clm tests - - mostly OK - - generate : ./cs.status.164019.bluefire - - nohup create_test_suite -input_list bluefire.clm.auxtest -compare clm4_0_50 -baselineroot /glade/proj2/cgd/tss/clm_cesm_baselines -generate clm4_0_51 -testroot /glade/scratch/muszala/tests > & ! bf_out_`date +"%m%d%y"`.lg & - ID: 203212 - - ## Reason: throughput measure off - FAIL SMS_RLA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_50 - FAIL ERS_D.f45_g37.I.bluefire_ibm.tputcomp.clm4_0_50 - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.tputcomp.clm4_0_50 - FAIL SMS.T31_g37.IG4804.bluefire_ibm.tputcomp.clm4_0_50 - ## baseline diretory already existed, error copying over nc files - FAIL SMS_RLA.f45_f45.I.bluefire_ibm.generate.clm4_0_51 - FAIL SMS_RLB.f45_f45.I.bluefire_ibm.generate.clm4_0_51 - FAIL SMS_ROA.f45_f45.I.bluefire_ibm.generate.clm4_0_51 - FAIL ERS_D.f45_g37.I.bluefire_ibm.generate.clm4_0_51 - FAIL NCK.T31_g37.I.bluefire_ibm.generate.clm4_0_51 - FAIL PST.f45_g37.I1850CN.bluefire_ibm.generate.clm4_0_51 - FAIL PET_PT.f45_g37.I1850.bluefire_ibm.generate.clm4_0_51 - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.generate.clm4_0_51 - FAIL ERI.T31_g37.IG1850.bluefire_ibm.generate.clm4_0_51 - FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.generate.clm4_0_51 - FAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.generate.clm4_0_51 - FAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.generate.clm4_0_51 - FAIL SMS.T31_g37.IG4804.bluefire_ibm.generate.clm4_0_51 - FAIL SMS.1x1_numaIA.ICN.bluefire_ibm.generate.clm4_0_51 - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.generate.clm4_0_51 - ## fails due to cprnc time check. new runs are 11 ts. in 50 these were 10, I expect these to pass next time around - FAIL ERS_D.f45_g37.I.bluefire_ibm.compare_hist.clm4_0_50 - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.compare_hist.clm4_0_50 - FAIL ERI.T31_g37.IG1850.bluefire_ibm.compare_hist.clm4_0_50 - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.compare_hist.clm4_0_50 - FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.compare_hist.clm4_0_50 - ## No Lm3 directories created during clm4_0_50 generate...new case, should pass next time around - SFAIL ERS_Lm3.1x1_vancouverCAN.I1PT.bluefire_ibm.GC.203212 - ERROR: datm.buildnml.csh failed - BFAIL ERS_Lm3.f19_g16.IGRCP60CN.bluefire_ibm.compare_hist.clm4_0_50 - No dir to compare to in tag 50 - ## problems in generate due to scripts for single point - SFAIL SMS.1x1_mexicocityMEX.I1PT.bluefire_ibm.GC.203212 - ERROR: datm.buildnml.csh failed also failed during generate - BFAIL SMS.1x1_numaIA.ICN.bluefire_ibm.compare_hist.clm4_0_50 - No dir to compare to in tag 50 - failed during generate - - ## these were failing but passed when rerun - keep an eye on these - BFAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.compare_hist.clm4_0_50 - BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.compare_hist.clm4_0_50 - BFAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_50 - - went to generated ref case - ./setup -clean - ./setup - then build and rerun - - went to generate case - ./setup -clean - ./setup - clean-build, then build then reurn - - did the same in the CG case for ref and normal case - - After hand running - ./cs.status.203212.bluefire | grep ERB.f09_g16.I1850SPINUPCN - PASS ERB.f09_g16.I1850SPINUPCN.bluefire_ibm - PASS ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.memleak - PASS ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.generate.clm4_0_51 - FAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.compare_hist.clm4_0_50 - see cprnc ts error above - PASS ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.memcomp.clm4_0_50 - PASS ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.tputcomp.clm4_0_50 - - This test was rerun with a new testlist - ./cs.status.203212.bluefire | grep ERB.ne30_g16.I_1948-2004 - PASS ERB.ne30_g16.I_1948-2004.bluefire_ibm - PASS ERB.ne30_g16.I_1948-2004.bluefire_ibm.memleak - PASS ERB.ne30_g16.I_1948-2004.bluefire_ibm.generate.clm4_0_51 - FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.compare_hist.clm4_0_50 - see cprnc ts error above - PASS ERB.ne30_g16.I_1948-2004.bluefire_ibm.memcomp.clm4_0_50 - FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.tputcomp.clm4_0_50 - throughput tol. error - - ./cs.status.141307.bluefire - PASS ERH_D.T31_g37.I1850CN.bluefire_ibm - PASS ERH_D.T31_g37.I1850CN.bluefire_ibm.memleak - PASS ERH_D.T31_g37.I1850CN.bluefire_ibm.generate.clm4_0_51 - FAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_50 - see cprnc ts error above - PASS ERH_D.T31_g37.I1850CN.bluefire_ibm.memcomp.clm4_0_50 - PASS ERH_D.T31_g37.I1850CN.bluefire_ibm.tputcomp.clm4_0_50 - -%%cesm/clm rof tests - nohup create_test_suite -input_list bluefire.clmRof.auxtest -compare clm4_0_50 -baselineroot /glade/proj2/cgd/tss/clm_cesm_baselines -generate clm4_0_51 -testroot /glade/scratch/muszala/tests > & ! bf_out_`date +"%m%d%y"`.lg & - - These don't exist anymore, but will be replaced once Tony works out default grid resolutions for r01 and r05 - - ID: 091144 - - BFAIL SMR.f19_g16.I_2000_CN.bluefire_ibm.compare_hist.clm4_0_50 - nothing to compare to in clm4_0_50 - BFAIL SMR.f09_g16.I_2000_CN.bluefire_ibm.compare_hist.clm4_0_50 - nothing to compare to in clm4_0_50 - FAIL SMR.f05_g16.I_2000_CN.bluefire_ibm - larger scipt errors in rof - kills the following two tests outright - BFAIL SMR.f05_g16.I_2000_CN.bluefire_ibm.generate.clm4_0_51 - BFAIL SMR.f05_g16.I_2000_CN.bluefire_ibm.compare_hist.clm4_0_50 - FAIL SMR.ne120_g16.I_2000_CN.bluefire_ibm.generate.clm4_0_51 - can't copy in, clm4_0_51 baseline already exists - BFAIL SMR.ne120_g16.I_2000_CN.bluefire_ibm.compare_hist.clm4_0_50 - nothing to compare to in clm4_0_50 - RUN SMR.ne240_g16.I_2000_CN.bluefire_ibm.GC.091144 - - -%%%%%% testing reporting end - -CLM tag used for the baseline comparison tests if applicable: - - clm4_0_50 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_50 -Originator(s): muszala (Muszala Stefan 303-497-1320 CGD) -Date: Fri Sep 21 15:13:52 MDT 2012 -One-line Summary: testing of clm and new rof component - -Purpose of changes: - -Run tests on clm for new ROF component. CLM mods by tcraig to support ROF. - -Requirements for tag: - -Test level of tag: doc, critical, standard, std-test, reg-test - -std-test - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: - -List any svn externals directories updated (csm_share, mct, etc.): - -List all files eliminated: - - Not needed since ROF is now a CLM external - D models/lnd/clm/src/main/clm_mct_mod.F90 - D models/lnd/clm/src/riverroute - D models/lnd/clm/src/riverroute/RtmMod.F90 - D models/lnd/clm/src/riverroute/RunoffMod.F90 - -List all files added and what they do: - - Fix for some of Erik's new tests - A models/lnd/clm/test/system/user_nl_dirs/monthly - A models/lnd/clm/test/system/user_nl_dirs/monthly/user_nl_clm - A models/lnd/clm/test/system/user_nl_dirs/monthly/user_nl_cpl - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/tests_pretag_jaguarpf - M models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi - M models/lnd/clm/tools/ncl_scripts - M models/lnd/clm/tools/interpinic - M models/lnd/clm/tools/mksurfdata_map/src - M models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl - M models/lnd/clm/bld - M models/lnd/clm/bld/configure - M models/lnd/clm/bld/user_nl_clm - M models/lnd/clm/bld/listDefaultNamelist.pl - M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - M models/lnd/clm/bld/build-namelist - M models/lnd/clm/bld/clm.buildnml.csh - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl - M models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 - M models/lnd/clm/src/biogeochem/CNDVMod.F90 - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 - M models/lnd/clm/src/main/spmdGathScatMod.F90 - M models/lnd/clm/src/main/clm_varpar.F90 - M models/lnd/clm/src/main/decompInitMod.F90 - M models/lnd/clm/src/main/clm_initializeMod.F90 - M models/lnd/clm/src/main/clmtypeInitMod.F90 - M models/lnd/clm/src/main/histFileMod.F90 - M models/lnd/clm/src/main/clm_atmlnd.F90 - M models/lnd/clm/src/main/findHistFields.pl - M models/lnd/clm/src/main/restFileMod.F90 - M models/lnd/clm/src/main/controlMod.F90 - M models/lnd/clm/src/main/clm_varctl.F90 - M models/lnd/clm/src/main/clm_driver.F90 - M models/lnd/clm/src/main/ncdio_pio.F90 - M models/lnd/clm/src/main/domainMod.F90 - M models/lnd/clm/src/main/decompMod.F90 - M models/lnd/clm/src/main/clmtype.F90 - M models/lnd/clm/src/main/histFldsMod.F90 - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - M models/lnd/clm/src/cpl_esmf/lnd_comp_mct.F90 - M SVN_EXTERNAL_DIRECTORIES - M ChangeLog - M ChangeSum - M scripts/ccsm_utils/Case.template/config_definition.xml - - -Machines testing ran on: - -%%%%%%%% Test reporting START %%%%%%%% - - Test system is currently in flux so I will simply list all tests that have - failed and the 8 tests that we need to keep an eye on. I've included bluefire - and lynx and pointers to where tests live. - -* tests that will pass in next tag due to new features -** denotes an expected fail. -*** any tputcomp tests that fail I'm inclined to ignore also. These change from test to test. -? or cd a test that will need fixing - -BLUEFIRE: - -OK ############ run build-namelist tests ->>cd models/lnd/clm/bld/unit_testers ->>./build-namelist_test.pl -compare /glade/scratch/muszala/svn/clm4_0_49/models/lnd/clm/bld/unit_testers -generate -test -csmdata /glade/proj3/cseg/inputdata >&! out_unit_`date +"%m%d%y"`.lg - - OK...failed tests will pass in next tag - -OK ############# run new I case tests -[be1105en /glade/scratch/muszala/svn/clm_trunk/scripts ]$ -create_test_suite -mach bluefire_ibm -input_list allIcompsetsRes.clm.auxtest -nobatch on -nobuild on -compare clm4_0_49 -baselineroot /glade/proj2/cgd/tss/clm_cesm_baselines -generate clm4_0_50 -testroot /glade/scratch/muszala/tests > & ! bf_out_allI_`date +"%m%d%y"`.lg - - 165507 - /glade/scratch/muszala/tests - >>./cs.status.165507.bluefire | grep FAIL -... -** SFAIL SBN.1x1_mexicocityMEX.I1PT.bluefire_ibm.GC.165507 -** SFAIL SBN.1x1_vancouverCAN.I1PT.bluefire_ibm.GC.165507 -** SFAIL SBN.1x1_urbanc_alpha.I1PT.bluefire_ibm.GC.165507 -** TFAIL SBN.1x1_asphalt_jungle.ICNTEST.bluefire_ibm.GC.165507 -** TFAIL SBN.T42_g16.I1850.bluefire_ibm.GC.165507 -** TFAIL SBN.T31_g16.I1850.bluefire_ibm.GC.165507 -** SFAIL SBN.f05_g16.I20TR.bluefire_ibm.GC.165507 -** SFAIL SBN.1x1_tropicAtl.I20TR.bluefire_ibm.GC.165507 -** SFAIL SBN.ne30_g16.I20TR.bluefire_ibm.GC.165507 -** SFAIL SBN.ne120_g16.I20TRCN.bluefire_ibm.GC.165507 -** SFAIL SBN.f05_g16.IRCP26CN.bluefire_ibm.GC.165507 -** SFAIL SBN.f05_g16.IRCP45CN.bluefire_ibm.GC.165507 -** SFAIL SBN.f05_g16.IRCP60CN.bluefire_ibm.GC.165507 -** SFAIL SBN.f05_g16.IRCP85CN.bluefire_ibm.GC.165507 - - -OK ############ run clm interactive tools tests -[be1105en /glade/scratch/muszala/svn/clm_trunk/models/lnd/clm/test/system ]$ ->>nohup env CLM_SOFF=FALSE ./test_driver.sh -i >&! bluefire_i_`date +"%m%d%y"`.lg & - - OK: looking at /glade/scratch/muszala/svn/clm_trunk/models/lnd/clm/test/system/td.951030.status.xFail - rerun - clmTests/test-driver.533240 - /glade/scratch/muszala/svn/clm_trunk/models/lnd/clm/test/system/td.533240.status.xFail - -############# run old cesm/clm tests out of scripts - - -[be1105en /glade/scratch/muszala/svn/clm_trunk/scripts ]$ ->>create_test_suite -input_list bluefire.clm.auxtest -compare clm4_0_49 \ --baselineroot /glade/proj2/cgd/tss/clm_cesm_baselines \ --generate clm4_0_50 \ --testroot /glade/scratch/muszala/tests >&! bf_out_`date +"%m%d%y"`.lg & - - 143258 ->>cs.status.143258.bluefire | grep -v PASS -... - -*** FAIL SMS.T31_g37.IG4804.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL SMS.1x1_numaIA.ICN.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL ERI.T31_g37.IG1850.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL ERS_E.T31_g37.I1850.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL ERS_D.f45_g37.I.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL SMS_RLA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL SMS_RLB.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_49 -*** FAIL ERS_D.f45_g37.I.bluefire_ibm.compare_hist.clm4_0_49 - -* FAIL NCK.T31_g37.I.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL PST.f45_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL PET_PT.f45_g37.I1850.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL ERS_E.T31_g37.I1850.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL ERI.T31_g37.IG1850.bluefire_ibm.compare_hist.clm4_0_49 -? FAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm - - Failing in Generate: - "/glade/scratch/muszala/svn/clm4_0_49/models/drv/shr/seq_infodata_mod.F90", line 620: 1525-006 The STATUS= specifier in the OPEN - statement for - unit 98 cannot be set to OLD because the file rpointer.drv does not exist. The program will stop. - - BFAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.generate.clm4_0_50 - BFAIL ERB.ne30_g16.I_1948-2004.bluefire_ibm.compare_hist.clm4_0_49 -? FAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm - - Failing in Generate: - 0:"/glade/scratch/muszala/svn/clm4_0_49/models/drv/shr/seq_infodata_mod.F90", line 620: 1525-006 The STATUS= specifier in the OPEN - statemen t for unit 98 cannot be set to OLD because the file rpointer.drv does not exist. The program will stop. - - BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.generate.clm4_0_50 - BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.compare_hist.clm4_0_49 -? FAIL ERH_D.T31_g37.I1850CN.bluefire_ibm - - Failing in Generate: - "/glade/scratch/muszala/svn/clm4_0_49/models/drv/shr/seq_infodata_mod.F90", line 620: 1525-006 The STATUS= specifier in the OPEN - statement for - unit 98 cannot be set to OLD because the file rpointer.drv does not exist. The program will stop. - - BFAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.generate.clm4_0_50 - BFAIL ERH_D.T31_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_49 - -* FAIL SMS.T31_g37.IG4804.bluefire_ibm.compare_hist.clm4_0_49 -** SFAIL SMS.1x1_mexicocityMEX.I1PT.bluefire_ibm.GC.143258 - should be xFAIL : ERROR(build-namelist::new): Required input variable yearfirst was not found -** SFAIL ERP.1x1_vancouverCAN.I1PT.bluefire_ibm.GC.143258 - should be xFAIL : ERROR(build-namelist::new): Required input variable yearfirst was not found -* FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL ERP.f19_g16.IGRCP60CN.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL PST.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL PET_PT.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.compare_hist.clm4_0_49 -* FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.compare_hist.clm4_0_49 - - - - -############# run new test_system tests - -## interactive ->> test_system -i -c clm4_0_49 -g clm4_0_50 >&! bluefire_tsi_`date +"%m%d%y"`.lg & - - 161038 ->>cs.status.161038.bluefire | grep -v PASS -... -SFAIL ERS_D.CLM_USRDAT.IalaskaCN.bluefire_ibm.GC.161038 -* FAIL ERS_P1x64.f45_g37.I_1850_SPINUP_3HrWx_CN.bluefire_ibm.compare_hist.clm4_0_49 - new fields in cpl history files -* FAIL ERS_P1x64.f45_g37.I_1850_SPINUP_3HrWx_CN.bluefire_ibm.memcomp.clm4_0_49 - max memory values differ -*** FAIL ERS_P1x64.f45_g37.I_1850_SPINUP_3HrWx_CN.bluefire_ibm.tputcomp.clm4_0_49 -** FAIL ERS_D_P1x64.f19_g16.I_1850-2000_VOC_SNCRFRC_CN.bluefire_ibm -** BFAIL ERS_D_P1x64.f19_g16.I_1850-2000_VOC_SNCRFRC_CN.bluefire_ibm.generate.clm4_0_50 -** BFAIL ERS_D_P1x64.f19_g16.I_1850-2000_VOC_SNCRFRC_CN.bluefire_ibm.compare_hist.clm4_0_49 -cd RUN ERS_D_P1x25.5x5_amazon.I_2000.bluefire_ibm.GC.161038 -** RUN ERS_D.1x1_asphaltjungleNJ.I_2000_VOC.bluefire_ibm.GC.161038 -** RUN ERS48s_D_P1x64.f45_g37.I_2000_VOC.bluefire_ibm.GC.161038 -* FAIL ERS48s_D_P1x64.f19_g16.I_2000_GLCMECPD.bluefire_ibm.compare_hist.clm4_0_49 - new fields in cpl history files -*** FAIL ERS48s_D_P1x64.f19_g16.I_2000_GLCMECPD.bluefire_ibm.tputcomp.clm4_0_49 -** FAIL PET_D_P1x64.f45_g37.I_2000_VOC.bluefire_ibm - - - -## batch ->>test_system -c clm4_0_49 -g clm4_0_50 > & ! bluefire_ts_`date +"%m%d%y"`.lg & - - 143420 -- cs.status.143420.bluefire -cs.status.143420.bluefire | grep -v PASS -... -* FAIL ERS211d.f10_f10.ICNADSPIN.bluefire_ibm.compare_hist.clm4_0_49 - new fields in cpl history files -*** FAIL ERS211d.f10_f10.ICNADSPIN.bluefire_ibm.tputcomp.clm4_0_49 -** CFAIL ERS48s_D.f09_g16.ICNEXSPIN.bluefire_ibm.GC.143420 - this is xFAIL for interactive, should also be listed here -* FAIL ERS48s_D_P64x16.ne30_g16.ICN.bluefire_ibm.compare_hist.clm4_0_49 - new fields in cpl history files -*** FAIL ERS48s_D_P64x16.ne30_g16.ICN.bluefire_ibm.tputcomp.clm4_0_49 -* FAIL PET_D_P1x64.ne30_g16.ICN.bluefire_ibm.compare_hist.clm4_0_49 - new fields in cpl history files -? RUN ERS211d_D_P112x2.f10_f10.ICNCROP.bluefire_ibm.GC.143420 - run failed -** FAIL ERS211d.f10_f10.I_2000_VOC_CN.bluefire_ibm.compare_hist.clm4_0_49 -*** FAIL ERS211d.f10_f10.I_2000_VOC_CN.bluefire_ibm.tputcomp.clm4_0_49 -** RUN ERS211d_P192x2.f19_g16.I_2000_CNDV_CROP.bluefire_ibm.GC.143420 -** SFAIL ERS_D_P96x32.T62_g37.I_2000.bluefire_ibm.GC.143420 - - - -############# - -LYNX: - -############# run new test_system tests - -## interactive ->> test_system -i -c clm4_0_49_lynx_pgi -g clm4_0_50_lynx_pgi >&! lynx_i_`date +"%m%d%y"`.lg & - - 144558 - -cs.status.144558.lynx | grep -v PASS -... -*** FAIL ERS211d.1x1_brazil.I_2000.lynx_pgi.tputcomp.clm4_0_49_lynx_pgi -* FAIL ERS48s_D_P1x12.f10_f10.ICNCROP.lynx_pgi.compare_hist.clm4_0_49_lynx_pgi - new fields in cpl history files -** SFAIL SMS_D.1x1_vancouverCAN.I1PT.lynx_pgi.GC.144558 -** SFAIL ERS.1x1_mexicocityMEX.I1PT.lynx_pgi.GC.144558 - - -## batch ->> test_system -c clm4_0_49_lynx_pgi -g clm4_0_50_lynx_pgi >&! lynx_`date +"%m%d%y"`.lg & - - 160925 -./cs.status.160925.lynx | grep -v PASS -... -? BFAIL PMT_D.f45_g37.I_2000.lynx_pgi.compare_hist.clm4_0_49_lynx_pgi - - problem in generate case not copying over file - PASS - Initial Test log is /glade/scratch/muszala/PMT_D.f45_g37.I_2000.lynx_pgi.G.114232/run/cpl.log.120920-152048 - /var/spool/torque/mom_priv/jobs/102008.nid00003.SC: Storing new baseline in /glade/proj2/cgd/tss/clm_cesm_baselines/clm4_0_49_ly - nx_pgi/PMT_D.f45_g37.I_2000.lynx_pgi - ERROR in /var/spool/torque/mom_priv/jobs/102008.nid00003.SC: could not copy /glade/scratch/muszala/archive/PMT_D.f45_g37.I_2000. - lynx_pgi.G.114232/cpl/hist/ to /glade/proj2/cgd/tss/clm_cesm_baselines/clm4_0_49_lynx_pgi/PMT_D.f45_g37.I_2000.lynx_pgi/cpl.hi.nc - -? RUN ERS48s_D.f45_g37.I_2000_VOC.lynx_pgi.GC.160925 - run didn't finish? -? RUN ERS48s_D.f10_f10.I_2000_CN.lynx_pgi.GC.160925 - PBS: job killed: walltime 9021 exceeded limit 9000 -? RUN ERS48s_P96x2.f19_g16.I_2000_VOC_SNCRFRC_CN_GLCMECPD.lynx_pgi.GC.160925 - PBS: job killed: walltime 9041 exceeded limit 9000 - -## interactive, with mirage test list and intel compiler ->>test_system -i -p intel -l mirage.interactive -o "-mach lynx" -c clm4_0_49_lynx_intel -g clm4_0_50_lynx_intel > & ! lynx_mi_intel_`date +"%m%d%y"`.lg & - - 143620 cs.status.143620.lynx ->>cs.status.143620.lynx | grep -v PASS -... -** FAIL ERS.1x1_brazil.I_2000.lynx_intel -** BFAIL ERS.1x1_brazil.I_2000.lynx_intel.generate.clm4_0_50_lynx_intel -** BFAIL ERS.1x1_brazil.I_2000.lynx_intel.compare_hist.clm4_0_49_lynx_intel -? FAIL ERI_D.1x1_camdenNJ.I_2000_VOC.lynx_intel - forrtl: error (73): floating divide by zero - rtmmod_mp_rtmini_ 303 RtmMod.F90 -** RUN ERS_D.1x1_asphaltjungleNJ.I_2000_VOC.lynx_intel.GC.143620 - forrtl: error (73): floating divide by zero - rtmmod_mp_rtmini_ 303 RtmMod.F90 -* FAIL ERS48s_D_P1x12.f10_f10.I_2000_CN.lynx_intel.compare_hist.clm4_0_49_lynx_intel - new fields in cpl history files -*** FAIL ERS48s_D_P1x12.f10_f10.I_2000_CN.lynx_intel.tputcomp.clm4_0_49_lynx_intel - -%%%%%%%% Test reporting END %%%%%%%% - - - build-namelist unit tester: - - CESM test lists: - - bluefire/CESM - lynx/CESM - - bluefire/PTCLM - - test_system testing: - - bluefire batch: - bluefire interactive: - lynx/pgi batch: - lynx/pgi interactive: - mirage,storm/ifort interactive: - -CLM tag used for the baseline comparison tests if applicable: - - clm4_0_49 - -Changes answers relative to baseline: Yes, runoff is different (similar climate) - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: all with RTM - - what platforms/compilers: all - - nature of change (similar climate) I compsets only have runoff change - - MSS location of control simulations used to validate new climate: - - https://wiki.ucar.edu/display/ccsm/CCSM4+-+Track5+experiments - - /CCSM/csm/b.e11.B1850CN.f19_g16.004 - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm4_0_49 -Originator(s): erik (Kluzek Erik 303-497-1326 CGD) -Date: Sun Sep 16 01:05:04 MDT 2012 -One-line Summary: Move clm testing to use CESM test framework - -Purpose of changes: - -Move testing for CLM from CLM stand-alone test_driver.sh to one based on -the CESM testing framework. Create CLM specific tests-lists, user_nl_dir, -and compset files to handle most CLM testing. - -Requirements for tag: - - Move major testing from test_driver.sh to one based on CESM framework. Try - to get most of it to work. - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - Update to cesm1_1_beta18b - - scripts updated to: scripts4_120915 - scripts updated to: Machines_120915 - mapping updated to: mapping_120816 - stubs updated to: stubs1_3_05 - drv updated to: drvseq1_4_26 - -List all files eliminated: None - -List all files added and what they do: - -A + models/lnd/clm/test/system/test_system ---- New main testing script for CLM. - wrapper script to CESM scripts/create_test_suite with behavior - similar to test_driver.sh - - -b directory [or --baseline] baseline directory - -c version [or --compare] version to compare to - (generate must already have been run to create these) - -d debug usage -- display tests that will run -- but - do NOT actually execute them - -g version [or --generate] name of this version to generate version as - -h [or --help] displays help - -i interactive usage - -l list [or --list] input test list to use instead of default - (path relative to this directory) - -o options [or --options] options to pass to create_test_suite - -p compiler [or --compiler] compiler to use instead of default - -s [or --shortlist] use the short test list - - Typical use: - - cd models/lnd/clm/test/system - test_system -i -c clm4_0_48 -g clm4_0_49 - test_system -c clm4_0_48 -g clm4_0_49 - - ->>>>>>>>>>>>> Test lists -A + models/lnd/clm/test/system/mirage.interactive -A + models/lnd/clm/test/system/lynx.interactive -A + models/lnd/clm/test/system/shortlist.interactive -A + models/lnd/clm/test/system/bluefire.batch -A + models/lnd/clm/test/system/bluefire.interactive -A + models/lnd/clm/test/system/lynx.batch -A + models/lnd/clm/test/system/shortlist.batch - ->>>>>>>>>>>>> compset file and user_nl_* files for testing -A + models/lnd/clm/test/system/config_files/config_CLMtestCompsets.xml -A + models/lnd/clm/test/system/user_nl_dirs -A + models/lnd/clm/test/system/user_nl_dirs/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/crop -A + models/lnd/clm/test/system/user_nl_dirs/crop/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/cn_conly -A + models/lnd/clm/test/system/user_nl_dirs/cn_conly/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/voc -A + models/lnd/clm/test/system/user_nl_dirs/voc/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/voc/user_nl_cpl -A + models/lnd/clm/test/system/user_nl_dirs/glcMEC -A + models/lnd/clm/test/system/user_nl_dirs/glcMEC/user_nl_clm -A + models/lnd/clm/test/system/user_nl_dirs/glcMEC/user_nl_cpl - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/system/tests_posttag_lynx_nompi -M models/lnd/clm/test/system/tests_pretag_bluefire_nompi -M models/lnd/clm/bld/listDefaultNamelist.pl -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - New failed - tests from new test framework -M models/lnd/clm/bld/clm.buildnml.csh - Copy drv_flds_in if clm creates it - and if it doesn't already exist. -M UpDateChangeLog.pl -- Add some support for xFail. Not fully working. - -Machines testing ran on: - - build-namelist unit tester: yes - - test_system testing: - - bluefire batch: yes - bluefire interactive: yes - bluefire/CESM: yes - lynx/pgi batch: yes - lynx/pgi interactive: yes - -CLM tag used for the baseline comparison tests if applicable: clm4_0_48 - -Difference in expected fails from testing: - -Index: expectedClmTestFails.xml -=================================================================== ---- expectedClmTestFails.xml (.../trunk_tags/clm4_0_48/models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml) (revision 40288) -+++ expectedClmTestFails.xml (.../trunk/models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml) (revision 40288) -@@ -34,6 +34,10 @@ - - - cprnc showing diffs are not b4b -+ problem configuring -+ problem configuring -+ clm stand-alone can no longer work -+ clm stand-alone can no longer work - - - -@@ -71,14 +75,70 @@ - - - -+ -+ CESM script issue -+ CESM script issue -+ - - - - - -+ -+ -+ -+ CESM script issue -+ Restart length different -+ Restart length different -+ Initial simulation fails -+ Initial simulation fails -+ -+ -+ -+ -+ datm namelist problem for single-point forcing -+ datm namelist problem for single-point forcing -+ -+ -+ -+ -+ -+ -+ -+ T62 not working -+ ignore_ic_date is incompatable with crop! -+ CESM script problem didn't see both files -+ CESM script problem didn't see both files -+ -+ -+ -+ -+ -+ - - - -+ datm namelist issue -+ datm namelist issue -+ datm namelist issue -+ datm namelist issue -+ missing wus12 datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ missing datasets -+ -+ -+ -+ -+ -+ - - - - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_48 -Originator(s): muszala (Muszala Stefan 303-497-1320 CGD) -Date: Tue Sep 11 09:14:40 MDT 2012 -One-line Summary: bug fixes, xFail to tests and normalize test output for CLM - -Purpose of changes: Bug Fixes. Add xFail capability to CLM batch, -interactive and namelist tests. Make test output the same for CLM -tests. - -Requirements for tag: Test on bluefire (CESM, int, bat), lynx/pgi (int,bat) -Fix bugs: 1436,1500,1521,1537 - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - - 1436,1500,1521,1537 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - - 1545 - on lynx clm-batch doesn't call our new xFAIL module. - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: xFail module Bill, Erik. Rest of code Erik. - -List any svn externals directories updated (csm_share, mct, etc.): - -List all files eliminated: - -List a files added and what they do: - -A models/lnd/clm/bld/unit_testers/xFail -A models/lnd/clm/bld/unit_testers/xFail/expectedFail.pm -A models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -A models/lnd/clm/bld/unit_testers/xFail/wrapClmTests.pl - - - xFAIL module that implements expected fail reporting. wrapClmTests.pl is used -as a wrapper and called by test_driver.sh. The XML file holds test cases. -Documentation is in POD in expectedFail.pm - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/system/TBL.sh - - fix so that mct and pio are built out of the baseline directory -M models/lnd/clm/bld/configure - - fix path to mct/.../mpi-serial -M models/lnd/clm/src/main/getdatetime.F90 - - fix to broadcast correct time stamp -M models/lnd/clm/test/system/test_driver.sh -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl - - both of these files modified to support xFAIL functionality -M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - - remove wrf mapping entry that isn't in inputdata. fix entries per bug - 1521 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - - remove wrf mapping entry that isn't in inputdata. fix entry per bug 1521 - -Summary of testing: - -Note that tests that used to fail are now being reported as xFAIL. The file -to look at is models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml. - -There are no tests that used to FAIL that now PASS. - - build-namelist unit testing: all pass - bluefire: all pass - bluefire interactive testing: all pass - bluefire/CESM testing: a few throughput failures - - FAIL SMS_RLA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_47 - COMMENT tput_decr = 2.945 tput_percent_decr = 21.3 - - FAIL SMS.1x1_numaIA.ICN.bluefire_ibm.tputcomp.clm4_0_47 - COMMENT tput_decr = 65.6 tput_percent_decr = 41.9 - - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.tputcomp.clm4_0_47 - COMMENT tput_decr = 1.8039999 tput_percent_decr = 2.07 - - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.tputcomp.clm4_0_47 - COMMENT tput_decr = 2.325 tput_percent_decr = 9.80 - - FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.tputcomp.clm4_0_47 - COMMENT tput_decr = 7.0280000 tput_percent_decr = 3.69 - - bluefire/PTCLM testing: N/A - lynx/pgi testing: all pass - lynx/pgi interactive testing: all pass - lynx/CESM testing: - mirage,storm/ifort interactive testing: all pass - -CLM tag used for the baseline comparison tests if applicable: clm4_0_47 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_47 -Originator(s): muszala (Muszala Stefan 303-497-1320 CGD) -Date: Thu Aug 23 11:09:27 MDT 2012 -One-line Summary: bug fixes - -Purpose of changes: - - Fix some bugs and tag early since CAM needs fix of bug 1538 asap. - -Requirements for tag: - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - - 1534,1533,1507,1444,1538 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: - -List any svn externals directories updated (csm_share, mct, etc.): - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/configure --- Passes FLAGS down to cesm_lib build and for pio (only for CLM testing) - -M models/lnd/clm/tools/mkmapdata/regridbatch.sh -M models/lnd/clm/tools/mkmapdata/mkmapdata.sh --- Fixes as per bug 1507. Logic clean up for interactive and using mpi - -M models/lnd/clm/bld/build-namelist --- Fix as per bug 1538 - -M models/lnd/clm/src/main/controlMod.F90 --- Fix as per bug 1444. remove call to "mpi_bcast (glc_topomax," and logic - controlling it. - -M models/lnd/clm/src/main/ncdio_pio.F90 --- Fix as per bug 1533 and 1534 - -M SVN_EXTERNAL_DIRECTORIES --- Mistake from last tag. Replaced two repos with correct trunk-tag urls. - - -Summary of testing: - - build-namelist unit testing: - All PASS except: - fails involve us20 and wus12 - not ok 141 - lnd_in file the same as expected for CN - 94x192 - fixed. Should pass in next tag. - not ok 214 - lnd_in file exists - us20 - no tests in place - not ok 219 - lnd_in file exists - wus12 - no tests in place - not ok 221 - compare file lnd_in DNE for CN and -res+wus12 - wus12 - no tests in place - not ok 222 - compare file temp_file.txt DNE for CN and -res+wus12 - wus12 - no tests in place - bluefire: - - 016-019 will be removed and put in CESM/CLM tests - 016 smW51 TSM.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -5 cold .................FAIL! rc= 10 - 017 erW51 TER.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -3+-2 cold ..............FAIL! rc= 5 - 018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 5 - 019 blW51 TBL.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -5 cold .................FAIL! rc= 4 - - 036-039 Failed in the past, see prior versions - 036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 - 037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 - 038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 - 039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 - - 049-052 Failed in the past, see prior versions - 049 smCI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 - 050 erCI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 - 051 brCI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 - 052 blCI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - - bluefire interactive testing: - All PASS execpt: - 004 blC74 TBL.sh _sc_s clm_std^nl_urb 20020101:1800 1x1_brazil navy -10 arb_ic ..................FAIL! rc= 5 - 008 blC97 TBL.sh _sc_do clm_spin^nl_urb 20030101:1800 4x5 gx3v7@1850 -6 arb_ic ..................FAIL! rc= 5 - 012 blHS3 TBL.sh 17p_cnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .....FAIL! rc= 5 - 016 blCA4 TBL.sh _sc_ds clm_drydep^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic ............FAIL! rc= 5 - 020 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:3600 1x1_mexicocityMEX navy 158 arb_ic ....FAIL! rc= 5 - 024 blCA8 TBL.sh _sc_ds clm_drydep^nl_urb 20021230:3600 1x1_asphaltjungleNJ navy -90 arb_ic .....FAIL! rc= 5 - 026 blCK4 TBL.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -10 cold ...............FAIL! rc= 5 - 028 blCK8 TBL.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -10 cold ...........FAIL! rc= 5 - 030 blC78 TBL.sh _sc_s clm_std^nl_urb 20021231:1800 1x1_brazil navy -10 arb_ic ..................FAIL! rc= 5 - 034 blF93 TBL.sh 17p_sc_do clm_drydep^nl_voc 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 5 - 038 blC83 TBL.sh _sc_do clm_std^nl_urb 20020115:3600 5x5_amazon navy -10 arb_ic .................FAIL! rc= 5 - 042 blK74 TBL.sh 17p_cndvsc_s clm_std 19971231:1800 1x1_brazil navy -670 arb_ic .................FAIL! rc= 5 - 046 blC63 TBL.sh _sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ........................FAIL! rc= 5 - 050 blHQ4 TBL.sh 17p_cnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -150 cold ............FAIL! rc= 5 - 054 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 5 - 067 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 5 - Reason: changed configure, but configure in previous tag not updated. - These will pass when a new tag is compared to clm4_0_47 - bluefire/CESM testing: - All PASS except: - FAIL SMS_RLB.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_46 - FAIL SMS_ROA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_46 - FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.tputcomp.clm4_0_46 - Reason: the throughput tolerance is likely still not large enough. - bluefire/PTCLM testing: N/A - lynx/pgi testing: - lynx/pgi interactive testing: - 004 blC74 TBL.sh _sc_s clm_std^nl_urb 20020101:1800 1x1_brazil navy -10 arb_ic ..................FAIL! rc= 5 - 008 blTZ3 TBL.sh 21p_cncrpsc_do clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 5 - 010 blCL4 TBL.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 5 - 014 blCA4 TBL.sh _sc_ds clm_drydep^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic ............FAIL! rc= 5 - Reason: changed configure, but configure in previous tag not updated. - These will pass when a new tag is compared to clm4_0_47 - lynx/CESM testing: - N/A - mirage,storm/ifort interactive testing: - All PASS except: - 70 004 blC74 TBL.sh _sc_s clm_std^nl_urb 20020101:1800 1x1_brazil navy -10 arb_ic ..................FAIL! rc= 5 - 71 007 blD94 TBL.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 5 - 72 011 blCA4 TBL.sh _sc_ds clm_drydep^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic ............FAIL! rc= 5 - 73 015 blCA8 TBL.sh _sc_ds clm_drydep^nl_urb 20021230:3600 1x1_asphaltjungleNJ navy -90 arb_ic .....FAIL! rc= 5 - 74 019 blL54 TBL.sh _sc_ds clm_std^nl_urb 20020115:1800 10x15 USGS 48 arb_ic .......................FAIL! rc= 5 - 75 023 blR53 TBL.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:1800 10x15 USGS@1850 48 cold ............FAIL! rc= 5 - Reason: changed configure, but configure in previous tag not updated. - These will pass when a new tag is compared to clm4_0_47 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_46 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_46 -Originator(s): muszala (Muszala Stefan 303-497-1320 CGD) -Date: Wed Aug 8 11:53:44 MDT 2012 -One-line Summary: R01 support and update externals - -Purpose of changes: - - Add support for r01 rtm. Add mapping files for ne120 and ne240. Update all svn - externals to what is in cesm_alpha16e and modify and update our test system as - necessary. - -Requirements for tag: test on bluefire (CESM, int, bat, build-namelist), lynx/pgi (int,bat), mirage. - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID):N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system:N/A - -Describe any changes made to the namelist:N/A - -List any changes to the defaults for the boundary datasets:N/A - -Describe any substantial timing or memory changes:N/A - -Code reviewed by: self, Erik - -List any svn externals directories updated (csm_share, mct, etc.): - Created the following tags: - https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_120808 - https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq4_1_23 - https://svn-ccsm-models.cgd.ucar.edu/tools/cprnc/trunk_tags/cprnc_120807 - -List all files eliminated:N/A - -List all files added and what they do:N/A - -List all existing files that have been modified, and describe the changes: - -== modifications to update externals == - M models/lnd/clm/tools/SVN_EXTERNAL_DIRECTORIES - M SVN_EXTERNAL_DIRECTORIES - -== modifications to get cesm/clm, interactive tests to pass == - - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl - -- added more output for easier test reading - M models/lnd/clm/test/system/TCB.sh - -- fix some indentation - M models/lnd/clm/test/system/TCBtools.sh - -- add support for gen_domain configure on bluefire - M models/lnd/clm/test/system/test_driver.sh - -- move tests to clmTest directory on /glade/scratch - M models/lnd/clm/test/system/CLM_runcmnd.sh - -- just indent diffs - M models/lnd/clm/tools/mksurfdata_map/src/mkfileMod.F90 - -- handle all files as large files (from ne240 runs) - M models/lnd/clm/bld/configure - -- add dependency for pio piovdf.o: pio_kinds.o - -- remove -lgptl from cesm Makefile - -== added r01 maps to namelist_defaults_clm.xml == - - M clm.buildnml.csh - M namelist_files/namelist_defaults_overall.xml - -- modified namelist_defaults_overall.xml to take wus12 and us20 with rmt off - -- also added ne240 and default gx1v6 ocean mask - -- modes to bld/clm.buildnml.csh so that rtm is off for wus12 - -- added path and script name to xml generated by createMapEntry.pl - -- checked wus12_wus12 run. Configures and runs. Error message to look for is: - - "Do not run the River Transport Model (RTM)" which is correct since wus12_wus12 is - a regional grid - -== modify scripts and drv to get new r01 to gx1v6 mapping files == - M scripts/ccsm_utils/Case.template/config_grid.xml - M scripts/ccsm_utils/Case.template/config_definition.xml - M models/drv/bld/namelist_files/namelist_defaults_drv.xml - -- namelist_defaults_drv.xml - added rof_grid for r01 and gx1v6 - -== modify xml so that 1/10 degree runs work == - M models/lnd/clm/tools/mkmapdata/mkmapdata.sh - M models/lnd/clm/tools/mkmapgrids/mkmapgrids.namelist - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - M models/lnd/clm/src/riverroute/RtmMod.F90 - -Summary of testing: - - build-namelist unit testing: - All PASS except: - fails involve us20 and wus12 - not ok 141 - lnd_in file the same as expected for CN - 94x192 - fixed. Should pass in next tag. - not ok 214 - lnd_in file exists - us20 - no tests in place - not ok 219 - lnd_in file exists - wus12 - no tests in place - not ok 221 - compare file lnd_in DNE for CN and -res+wus12 - wus12 - no tests in place - not ok 222 - compare file temp_file.txt DNE for CN and -res+wus12 - wus12 - no tests in place - bluefire: - All PASS except: - 018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 - modified to -3+-3 -- still FAIL - 036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 - 037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 - 038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 - 039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 - 036-039 needs major work - - and why they fail... - - 018 - cprnc differences in comparison - 036 - endrun initiated from CNBalanceCheckMod.F90 - 037 - __cnbalancecheckmod_NMOD_cbalancecheck - 038, 039 - fail since 037 didn't run - - bluefire interactive testing: - All PASS except: - bl514 - will fail because tag 45 has a broken gen_domain build - bl954 - no ne240 in tag 45 - bl9C4 - 8 bit difference in file size due to using large file write in mkfileMod.F90 - These should pass in next tag - bluefire/CESM testing: - All PASS except: - FAIL SMS_RLA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_45 - FAIL SMS_RLB.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_45 - FAIL SMS_ROA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_45 - FAIL ERS_D.f45_g37.I.bluefire_ibm.tputcomp.clm4_0_45 - FAIL SMS.1x1_numaIA.ICN.bluefire_ibm.tputcomp.clm4_0_45 - FAIL ERS_E.T31_g37.I1850.bluefire_ibm.tputcomp.clm4_0_45 - FAIL ERI.T31_g37.IG1850.bluefire_ibm.tputcomp.clm4_0_45 - FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.tputcomp.clm4_0_45 - FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.tputcomp.clm4_0_45 - FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.tputcomp.clm4_0_45 - - There is tolerance check built into the tests that may be too tight. Jay will look at this in the future. - Throughputs are reported and a sampling looks reasonable: - - CHECK SMS_RLA.f45_f45.I.bluefire_ibm.perf npes=1 tput=16.026 memh=259.677 memr=-0.001 tag=clm4_0_45 baseline - CHECK SMS_RLA.f45_f45.I.bluefire_ibm.perf npes=1 tput=9.392 memh=259.856 memr=-0.001 tag= - - CHECK SMS.f10_f10.IRCP45CN.bluefire_ibm.perf npes=16 tput=200.866 memh=265.074 memr=-0.001 tag=clm4_0_45 baseline - CHECK SMS.f10_f10.IRCP45CN.bluefire_ibm.perf npes=16 tput=187.881 memh=267.630 memr=-0.001 tag= - - CHECK ERS_D.f19_g16.IRCP85CN.bluefire_ibm.perf npes=64 tput=29.741 memh=292.035 memr=-0.001 tag=clm4_0_45 baseline - CHECK ERS_D.f19_g16.IRCP85CN.bluefire_ibm.perf npes=64 tput=28.368 memh=294.879 memr=-0.001 tag= - - bluefire/PTCLM testing: - lynx/pgi testing: - lynx/pgi interactive testing:All PASS - lynx/CESM testing:All PASS - mirage,storm/ifort interactive testing:All PASS - -CLM tag used for the baseline comparison tests if applicable: CLM4_0_45 - -Changes answers relative to baseline:No - -=============================================================== -=============================================================== -Tag name: clm4_0_45 -Originator(s): sacks (Sacks Bill 303-497-1762 CGD) -Date: Fri Jul 20 11:41:14 MDT 2012 -One-line Summary: fix virtual columns; new urban mksurfdata_map - -Purpose of changes: - -GLC-related: Fix places where glc virtual columns were not being treated -correctly (major bug!). Change albice default to 0.6,0.4 for glc_mec -cases, based on suggestion from Bill Lipscomb. Fix dust calculation for -glc_mec. - -Other CLM changes: Add an instance of istcrop. Fix landunit-level output -for dov2xy=false. - -Tools changes: Update mksurfdata_map to handle new urban raw data format -(use dominant density class, together with lookup tables; currently used -for mksurfdata_map with hires). Minor fixes to mksurfdata_map. Add unit -tests to mksurfdata_map. Change tools build to support addition of unit -tests. Minor fixes to mkscripgrid.ncl, mkunitymap.ncl and mknoocnmap.pl. - -Namelist-related: Refer to correct scrip grid files for f09, f19; and -a few fixed mapping files for those resolutions, including clm->rtm mapping -files for those resolutions (changes answers for RTM). (The old scrip grid -files had a displaced pole, which is not what we want for CLM. Note that I -did NOT replace the f05 scrip grid file, because the only alternative I can -find has bad values in the corner arrays -- see bug 1518.) - -SPM--Mostly changes to get more tests to pass. Added 1x1_* mapping files to -inputdata. Created script that auto-generates XML for new mapping files for -easier inclusion into existing XML files. Modify build-namelist_test.pl to -pass CSMDATA to build-namelist. Tests were failing if a user didn't have -CSMDATA env set. Touched CFGtools__ds to get a CLM interactive test to pass. -Added openMP and debug openMP tests for bluefire interactive tests for 10x15. ---SPM - -Requirements for tag: test on bluefire (CESM, int, bat), lynx/pgi (int,bat), mirage. -Fix bug 1492 - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - 1492 (missing istcrop) - 1515 (nedd mapping files for - single-point)-SPM - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - - Makefiles reorganized for tools (mksurfdata_map, interpinic, mkmapgrids) - -Describe any changes made to the namelist: - - albice changed to 0.6,0.4 for glc_mec cases - -List any changes to the defaults for the boundary datasets: - - Use corrected mapping files for CLM->RTM for f09,f19, and for some - mapping files used to create surface datasets. Use correct scrip grids - for f09,f19. Add new urban raw data file for hires mksurfdata_map, and - associated scrip grid file & mapping files. - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - -List all files eliminated: - ->>>>>>> Split into mkurbanparCommonMod, mkurbanparAvgMod and mkurbanparDomMod -D models/lnd/clm/tools/mksurfdata_map/src/mkurbanparMod.F90 - ->>>>>>> Modify build system to make it easier to add unit testers -D models/lnd/clm/tools/mksurfdata_map/src/Macros.custom -D models/lnd/clm/tools/interpinic/src/Macros.custom -D models/lnd/clm/tools/mkmapgrids/src/Macros.custom - - -List all files added and what they do: - ->>>>>>> SPM-- Dump XML of mappings for a specified resolution -A namelist_files/createMapEntry.pl ->>>>>>> --SPM - - ->>>>>>> Pull out routines from mkurbanparMod that are common to different ->>>>>>> ways of creating urban parameter data -A models/lnd/clm/tools/mksurfdata_map/src/mkurbanparCommonMod.F90 - ->>>>>>> Modules to handle old (area-average) and new (dominant-type) urban ->>>>>>> input files -A models/lnd/clm/tools/mksurfdata_map/src/mkurbanparAvgMod.F90 - mostly from mkurbanparMod -A models/lnd/clm/tools/mksurfdata_map/src/mkurbanparDomMod.F90 - new code, to handle new format - ->>>>>>> New modules with general-purpose utilities for mksurfdata_map -A models/lnd/clm/tools/mksurfdata_map/src/mkutilsMod.F90 -A models/lnd/clm/tools/mksurfdata_map/src/mkindexmapMod.F90 - ->>>>>>> New unit testers for mksurfdata_map -A models/lnd/clm/tools/mksurfdata_map/unit_testers -A models/lnd/clm/tools/mksurfdata_map/unit_testers/test_lookup_2d_netcdf.nc -A models/lnd/clm/tools/mksurfdata_map/unit_testers/test_mkutilsMod.F90 -A models/lnd/clm/tools/mksurfdata_map/unit_testers/test_mkindexmapMod.F90 -A models/lnd/clm/tools/mksurfdata_map/unit_testers/Srcfiles -A models/lnd/clm/tools/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 -A models/lnd/clm/tools/mksurfdata_map/unit_testers/test_mod.F90 -A models/lnd/clm/tools/mksurfdata_map/unit_testers/Filepath -A models/lnd/clm/tools/mksurfdata_map/unit_testers/Makefile -A models/lnd/clm/tools/mksurfdata_map/unit_testers/README -A models/lnd/clm/tools/mksurfdata_map/unit_testers/test_mkurbanparDomMod.F90 - ->>>>>>> Modify build system to make it easier to add unit testers -A models/lnd/clm/tools/mksurfdata_map/src/Makefile.common -A models/lnd/clm/tools/mkmapgrids/src/Makefile.common -A models/lnd/clm/tools/interpinic/src/Makefile.common - - -List all existing files that have been modified, and describe the changes: - ->>>>>>> SPM-- ->>>>>>> Pass csmdata down to build-namelist and add logic so CSMDATA is set ->>>>>>> even if user does not -M unit_testers/build-namelist_test.pl ->>>>>>> Add support for 1x1_* single point mapping files -M namelist_files/namelist_defaults_clm.xml -M namelist_files/namelist_defaults_clm_tools.xml ->>>>>>> Add support for a few openMP 10x15 tests, modify test list ->>>>>>> and remove some old single point tests -M test/system/tests_pretag_bluefire_nompi -M test/system/input_tests_master -M test/system/tests_posttag_nompi_regression - ->>>>>>> --SPM - ->>>>>>> Fix glc virtual column bugs: change checks of (wt > 0) ->>>>>>> to (wt > 0 .or. ityplun(l)==istice_mec) -M models/lnd/clm/src/main/histFileMod.F90 ---------- also fix landunit-level fields - with dov2xy=.false. -M models/lnd/clm/src/main/subgridAveMod.F90 -M models/lnd/clm/src/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - also change - 'if (itypelun==istice)' to 'if (itypelun==istice .or. itypelun==istice_mec)' - in setting parameters -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 - ->>>>>>> Add istcrop (fix bug 1492) -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 - ->>>>>>> Remove unnecessary 'use' -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 - ->>>>>>> Change albice to 0.6,0.4 for glc_mec cases; add mapping files for ->>>>>>> 3x3min_LandScan2004; use corrected mapping files for 5x5min_ISRIC-WISE_to_0.9x1.25, ->>>>>>> 3x3min_MODIS_to_0.9x1.25 and 5x5min_nomask_to_1.9x2.5, as well as for CLM->RTM ->>>>>>> for f09 and f19 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - ->>>>>>> Point to correct files for f09,f19 scrip grids; add new urban raw data file ->>>>>>> for hires mksurfdata_map -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - ->>>>>>> Add support for new 3x3min_LandScan2004 grid -M models/lnd/clm/tools/mkmapdata/mkmapdata.sh -M models/lnd/clm/bld/namelist_files/checkmapfiles.ncl -M models/lnd/clm/bld/namelist_files/namelist_definition.xml - ->>>>>>> Changes to mksurfdata_map to support new input urban format -M models/lnd/clm/tools/mksurfdata_map/src/Srcfiles ------ add new source files -M models/lnd/clm/tools/mksurfdata_map/src/mksurfdat.F90 - use new urban interfaces; - also, substantially increase tolerance for roundoff error fix in - normalizencheck_landuse (the latter change is unrelated to the new urban - format; this change makes it so more points have 100% special rather than - nearly-100% special, which was required to avoid CLM termination due to - rounding errors in some cases) -M models/lnd/clm/tools/mksurfdata_map/src/mkfileMod.F90 - add URBAN_DENSITY_CLASS - and URBAN_REGION_ID fields -M models/lnd/clm/tools/mksurfdata_map/src/mkncdio.F90 --- public declarations of - routines that are now needed - ->>>>>>> Other, incidental changes to mksurfdata_map -M models/lnd/clm/tools/mksurfdata_map/src/mkpftMod.F90 ---- fix zero_out -M models/lnd/clm/tools/mksurfdata_map/src/mkglcmecMod.F90 - correct rounding errors - in topoglcmec_o; change a warning to a fatal error -M models/lnd/clm/tools/mksurfdata_map/src/mkdomainMod.F90 - add tolerance in - checking for lat/lon equality - ->>>>>>> Add src_grid_dims & dst_grid_dims -M models/lnd/clm/tools/mkmapdata/mkunitymap.ncl - ->>>>>>> Fix direction of ocn->atm mapping file -M models/lnd/clm/tools/mkmapdata/mknoocnmap.pl -M models/lnd/clm/tools/README ------------------ also fix typos - ->>>>>>> Fix ordering of corners -M models/lnd/clm/tools/mkmapgrids/mkscripgrid.ncl - ->>>>>>> Modify build system to make it easier to add unit testers -M models/lnd/clm/tools/mksurfdata_map/src/Makefile -M models/lnd/clm/tools/interpinic/src/Makefile -M models/lnd/clm/tools/mkmapgrids/src/Makefile -M models/lnd/clm/test/system/TCBtools.sh ----------- copy correct file - ->>>>>>> Document copy of test_mod -M models/lnd/clm/tools/README.filecopies - - -Summary of testing: - ---SPM. New tests run after update to clm4_0_44 and after tests modifications. - -==== bluefire build-namelist tests: ==== - - * expected fail due to new mapping file - < fmapinp_rtm = '/glade/proj3/CESM/cseg/inputdata//lnd/clm2/mappingdata/maps/1.9x2.5/map_1.9x2.5_nomask_to_0.5x0.5_nomask_aave_da_c120522.nc' - --- - > fmapinp_rtm = '/glade/proj3/CESM/cseg/inputdata//lnd/clm2/mappingdata/maps/1.9x2.5/map_1.9x2.5_nomask_to_0.5x0.5_nomask_aave_da_c120221.nc' - - * not ok 6 - lnd_in file the same as expected for standard - not ok 23 - lnd_in file the same as expected for standard - -This is expected. Bill states this mod in ChangeLog - - < albice = 0.60,0.40 - --- - > albice = 0.50,0.50 - - * not ok 29 - lnd_in file the same as expected for standard - * not ok 36 - lnd_in file the same as expected for standard - * not ok 43 - lnd_in file the same as expected for standard - * not ok 49 - lnd_in file the same as expected for standard - * not ok 54 - lnd_in file the same as expected for standard - * not ok 59 - lnd_in file the same as expected for standard - * not ok 64 - lnd_in file the same as expected for standard - * not ok 69 - lnd_in file the same as expected for standard - * not ok 74 - lnd_in file the same as expected for standard - * not ok 80 - lnd_in file the same as expected for standard - * not ok 85 - lnd_in file the same as expected for standard - * not ok 91 - lnd_in file the same as expected for standard - * not ok 156 - lnd_in file the same as expected for CN - * not ok 161 - lnd_in file the same as expected for CN - - 221 and 222 are for new WRF tests, ignoring for now since tests not complete - not ok 221 - compare file lnd_in DNE for CN and -res+wus12 - # in NMLTest/CompFiles.pm at line 103. - WARNING(NMLTest::CompFiles::comparefiles):: File /glade/scratch/muszala/svn/clm4_0_44/models/lnd/clm/bld/unit_testers/temp_file.txt.CN.-res+wus12 - does NOT exist! - - not ok 222 - compare file temp_file.txt DNE for CN and -res+wus12 - -WARNING(NMLTest::CompFiles::comparefiles):: File /glade/scratch/muszala/svn/clm4_0_44/models/lnd/clm/bld/unit_testers/temp_file.txt.CN.-res+wus12 - 2349 does NOT exist! - - # Failed test 'compare file temp_file.txt DNE for CN and -res+wus12 - # ' - # in NMLTest/CompFiles.pm at line 103. - - * not ok 276 - lnd_in file the same as expected for crop - -==== bluefire interactive ==== - now pass due to new mapping files (ignore numbering, use test descriptor) -001 sm514 TSMCFGtools.sh gen_domain CFGtools__ds T31.runoptions .................................PASS -002 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds PASS -003 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dPASS -004 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds PASS - - new tests and test descriptors for 10x15 openMP tests -001 sm953 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__o .......PASS -002 bl953 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__o .......SKIPPED* -003 sm954 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......PASS -004 bl954 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......SKIPPED* -005 sm957 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__do ......PASS -006 bl957 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__do ......SKIPPED* -007 sm959 TSMscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 ..............................PASS -008 bl959 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 ..............................SKIPPED* - ---SPM - -NOTE: UNLESS OTHERWISE NOTED, THE BELOW TESTS WERE RUN FROM TAG -virtual_column_fix_03_clm4_0_43. This means that they were run before -reverting the scrip grid file & rtm mapping file for f05. However, that -shouldn't change any test results, since as far as I can tell, nothing in -the CLM test suite tests f05 resolution. THESE TESTS SHOULD BE RERUN ON THE -FINAL VERSION OF THE TAG BEFORE MERGING IT TO THE TRUNK. - - bluefire build-namelist unit testing (run with -test): ALL PASS EXCEPT: -not ok 42 - rtm tstep inconsistent - bluefire mksurfdata_map unit testing: ALL PASS - bluefire: All PASS except: -015 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:1800 1.9x2.5 gx1v6@1850-2100 -10 cold FAIL! rc= 7 -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 -039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 -043 blCn1 TBL.sh _sc_dh clm_transient_glcMEC_rcp8.5 20331231:1800 1.9x2.5 gx1v6@1850-2100 48 arb_ic FAIL! rc= 7 -049 smCI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -050 erCI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -051 brCI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -052 blCI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except: -028 blCK8 TBL.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 -046 blC63 TBL.sh _sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ........................FAIL! rc= 7 -054 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 7 -061 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -062 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -069 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 5 -076 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -077 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 4 -078 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -079 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 4 -080 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 -081 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 4 - bluefire/CESM testing: All PASS except: -BFAIL PST.f45_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_43 -BFAIL PET_PT.f45_g37.I1850.bluefire_ibm.compare_hist.clm4_0_43 -FAIL ERI.T31_g37.IG1850.bluefire_ibm.compare_hist.clm4_0_43 -FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.compare_hist.clm4_0_43 -FAIL ERP.f19_g16.IGRCP60CN.bluefire_ibm.compare_hist.clm4_0_43 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire_ibm.compare_hist.clm4_0_43 -BFAIL PST.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_43 -BFAIL PET_PT.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_43 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.compare_hist.clm4_0_43 - bluefire/PTCLM testing: NOT DONE! - lynx/pgi testing: All PASS - lynx/pgi interactive testing: All PASS except: -023 sm978 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds .....FAIL! rc= 6 -024 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -025 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 - lynx/CESM testing: All PASS except: -CFAIL ERI.f10_f10.IRCP60CN.lynx_pathscale.C.123047 -BFAIL PST.f19_g16.I.lynx_pgi.compare_hist.clm4_0_43 -FAIL ERS.f19_g16.IRCP26CN.lynx_gnu.compare_hist.clm4_0_43 -FAIL ERS.f19_g16.IG1850.lynx_pgi.compare_hist.clm4_0_43 - mirage,storm/ifort interactive testing: All PASS - - Additional testing: Additional CESM B compset tests to test new RTM - mapping files. Ran these from cesm1_1_alpha13e; for most tests, switched - clm to virtual_column_fix_03_clm4_0_43; for the lynx f05 test, switched - clm to virtual_column_fix_04_clm4_0_43. Note that the baseline - comparisons are expected to fail, except for the f05 test. -PASS ERI.f19_g16.BRCP45WCN.bluefire_ibm -FAIL ERI.f19_g16.BRCP45WCN.bluefire_ibm.compare_hist.cesm1_1_alpha13e -PASS ERS.f19_g16.B2000CNCHM.bluefire_ibm -FAIL ERS.f19_g16.B2000CNCHM.bluefire_ibm.compare_hist.cesm1_1_alpha13e -PASS SMS_D.f19_g16.B20TRC5.bluefire_ibm -FAIL SMS_D.f19_g16.B20TRC5.bluefire_ibm.compare_hist.cesm1_1_alpha13e -PASS ERS.f09_g16.B1850BPRP.bluefire_ibm -FAIL ERS.f09_g16.B1850BPRP.bluefire_ibm.compare_hist.cesm1_1_alpha13e -PASS SMS_D.f19_g16.B20TRC5.lynx_pgi -FAIL SMS_D.f19_g16.B20TRC5.lynx_pgi.compare_hist.cesm1_1_alpha13e -PASS SMS.f05_g16.B.lynx_pgi -PASS SMS.f05_g16.B.lynx_pgi.compare_hist.cesm1_1_alpha13e - - -CLM tag used for the baseline comparison tests if applicable: clm4_0_43; -for my additional CESM tests, compared against cesm1_1_alpha13e - -Changes answers relative to baseline: YES, for GLC configurations and all -f09 & f19 configurations with RTM - - Baseline failures that are not because of GLC or RTM mapping file changes - are: - ->>> also failed in clm4_0_43; fails with "build-namelist ERROR:: bad input to drv_runlength option" -028 blCK8 TBL.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 ->>> I think the problem here is that the baseline test is trying to build interpinic from the current directory, ->>> rather than from BL_ROOT. This is a problem because of changes in the tools' build. -069 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 5 - - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: - all GLC configurations (albice change & virtual column bug fix) - - all f09 & f19 configurations with RTM (due to change in RTM mapping file) - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - For GLC: climate-changing - - For f09/f19 due to RTM mapping file change: Larger than roundoff, but - expected to have same climate. The new scrip grid files have - roundoff-level differences globally, plus differ substantially at the - poles because the old (incorrect) files had poles displaced from - -90/90. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - platform/compilers: - - compset (and additional configure options): - - build-namelist options (or complete namelist): - - MSS location of output: - - EVALUATION OF NEW CLIMATE NOT PERFORMED - -=============================================================== -=============================================================== -Tag name: clm4_0_44 -Originator(s): erik (Erik Kluzek) -Date: Mon Jul 9 11:14:11 MDT 2012 -One-line Summary: Add wrf resolutions, update externals to cesm1_1_beta15, all components use build-namelist now - -Purpose of changes: - -set nsegspc=1 for all ne grids. Update to latest externals and new datm. Latest externals -have ALL components using a build-namelist, and user_nl.$COMP files are created for you. -Env files changed most fields in env_conf moved to env_run and secondly env_build. -env_mach_pes moved to env_configure. env_conf removed. Add ne4, ne16, ne60 datasets. Add -in ne16, ne30, ne120 20th Century datasets. Change of templates to have -clm.buildnml.csh and clm.buildexe.csh copied to Buildconf. Have -chk_res option to -build-namelist to check for resolution/mask, -note option to include (or not) note on the -bottom of the namelist. Expand build-namelist unit test. - -Requirements for tag: - Requirements: test on bluefire (CESM, int, bat) - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - 1513 (mksurfdata.pl doesn't work with -crop flag) - 1514 (inconsistancy in char variable fexcl) - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (PTS_MODE can NOT use a global finidat file) - 1017 (PTS_MODE can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1454 (lack of 1D history files in CLM testing) - 1455 (bad time-stamp in CLM testing) - 1457 (bug in soil color in mksurfdata_map) - 1474 (Missing eulerian domain files) - 1479 (fails on jaguarpf) - 1485 (Performance issue with esmf_wrf_timemgr) - 1488 (Problem reading restarts@ne30_g16 for some layouts) - 1517 (Performance of datm in clm4_0_44 is even worse) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: Yes! - env*.xml files changed as follows: - - env_conf.xml ------> removed! - Most variables moved to env_run.xml. Some variables moved to env_build.xml - env_mach_pes.xml --> Renamed to env_configure.xml - - Buildconf directory ---> think of it as readonly! -Describe any changes made to the namelist: Yes! - - user_nl_* files for ALL components created for you. Put, your changes to namelists - files here. - - New options to clm build-namelist: - (all but -chk_res and -note are already exercised when running CESM) - -chk_res ------- Check resolution and land mask first. - -clm_startfile - Input file to use to startup for branch or startup cases. - -co2_type ------ CO2 type - -inst_string --- Instance string to use for clm_startfile for multi-instance cases. - -l_ncpl -------- Number of coupling time-steps to take per day. - -lnd_frac ------ Land fraction file to use (domain file) - -note ---------- Write out note about build-namelist usage to end of file. - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: Yes! - Most of the throughput tests fail, and single-point performance looks horrible. - Although this may be a sporatic problem due to file systems. See bug 1517. - -Code reviewed by: self, mvertens, tcraig - -List any svn externals directories updated (csm_share, mct, etc.): - Update to cesm1_1_beta15 external versions (other than timing) - scripts to scripts4_120604 - Machines to Machines_120529 - drv to drvseq4_1_15 - datm to datm8_120528 - csm_share to share3_120509 - mct to MCT2_8_0_120503 - pio to pio_1_4_5 - stubs to cism1_120529 - esmf_wrf_timemgr to esmf_wrf_timemgr_120427 - mapping to mapping_120525 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>>> Add tools testers for directories that use CESM configure - A models/lnd/clm/test/system/TCBCFGtools.sh - A models/lnd/clm/test/system/TSMCFGtools.sh - A models/lnd/clm/test/system/TBLCFGtools.sh - - A models/lnd/clm/bld/unit_testers/NMLTest/CompFiles.pm - New test module - - A models/lnd/clm/test/system/nl_files/mksrfdt_T31_crpglc_2000 - mksurfdata crop test - ->>>>>>>>>>>> Split out buildexe/buildnml from template so that editing templates ->>>>>>>>>>>> isn't a nightmare - A models/lnd/clm/bld/clm.buildexe.csh - A models/lnd/clm/bld/clm.buildnml.csh - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Change tests a bit add a global crop test, get working on mirage - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/CLM_runcmnd.sh --- Allow hostname==vpn* for yong - M models/lnd/clm/test/system/test_driver.sh ---- Add TOOLSLIBS TOOLS_CONF_STRING - if hostname=vpn* use setup for yong - M models/lnd/clm/test/system/input_tests_master Fix test blCK8, add global - crop test case for mksurfdata, add cfg-tool tests - M models/lnd/clm/test/system/TSM.sh ------------ Add cpl.log file - M models/lnd/clm/test/system/TCBtools.sh ------- Set SLIBS needed on generic machines - - M models/lnd/clm/tools/mkmapdata/mkmapdata.sh ------- Use different version of ESMF - for regional, don't do RTM maps for regional - M models/lnd/clm/tools/interpinic/src/Makefile ------ Use NETCDF4 link - M models/lnd/clm/tools/mkmapgrids/src/Makefile ------ Use NETCDF4 link - M models/lnd/clm/tools/mksurfdata_map/src/Makefile -- Use NETCDF4 link - M models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl - Send crop setting for - determining LAI file - ->>>>>>>>>>>> Add CESM options to build-namelist, add handling of SLIBS for generic ->>>>>>>>>>>> machines. Add new grids: wrf, ne4, ne16, ne60. Set nsegspv=1 for hi-res/ne ->>>>>>>>>>>> grids. Use drv/datm namelist definition/defaults files. Extend ->>>>>>>>>>>> build-namelist unit tester test ALL resolutions/use-cases. - M models/lnd/clm/bld/configure ---- Add ability to handle slibs - M models/lnd/clm/bld/user_nl_clm -- Format change - M models/lnd/clm/bld/config_files/config_definition.xml - slibs, wrf grids - M models/lnd/clm/bld/build-namelist ---------- Add a bunch of options needed for CESM - (all but -chk_res and -note are already exercised when running CESM) - -chk_res ------- Check resolution and land mask first. - -clm_startfile - Input file to use to startup for branch or startup cases. - -co2_type ------ CO2 type - -inst_string --- Instance string to use for clm_startfile for multi-instance cases. - -l_ncpl -------- Number of coupling time-steps to take per day. - -lnd_frac ------ Land fraction file to use (domain file) - -note ---------- Write out note about build-namelist usage to end of file. - namelist definition/defaults files also come from drv/bld and datm/bld, get working - with latest externals - M models/lnd/clm/bld/clm.cpl7.template ------- Use new - clm.buildnml.csh/clm.buildexe.csh scripts which save us from the "\" nightmare - M models/lnd/clm/bld/queryDefaultNamelist.pl - namelist_defaults/definition files - are now split out in datm/drv directories - M models/lnd/clm/bld/queryDefaultXML.pm ------ definition files are an array now - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl - Test a ton more - things. Add -compare, -test, -generate options. Test all use_cases and all - resolutions - M models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl ------ Add some more resolutions - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - Get rid of drv/datm - namelist items - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl - Get rid of drv/datm - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Add chk_res, note - and default masks for WRF grids - M models/lnd/clm/bld/namelist_files/datm-build-namelist ----- Use datm namelist - defaults/definition files. - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Set do_rtm for - regional grids to .false. Add wrf grids: us20, wus12. Add ne4, ne16, ne60 - files. Add 20th transient PFT for: ne16, ne30, ne60, ne120. Set nsegspc to 1 - for hi-res and ne grids. - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Domain files - for 512x1024, ne4, ne16, ne60, ne240, and us20, wus12. - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Set crop - for LAI and vegtyp files - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml - Remove settings - already in drv/bld file - ->>>>>>>>>>>> Remove write(6 for write to iulog, remove unneeded writes ->>>>>>>>>>>> use shr_pio over seq_pio. Allow -180-180 form. - M models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 - remove write - M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 - write to iulog - M models/lnd/clm/src/biogeochem/CNrestMod.F90 ------ use endrun not write(6 - M models/lnd/clm/src/main/ndepStreamMod.F90 -------- use shr_pio_getiotype - M models/lnd/clm/src/main/pftdynMod.F90 ------------ use endrun not write(6 - M models/lnd/clm/src/main/histFileMod.F90 ---------- use shr_pio_getiotype - dimension hist_excl* as max_namlen+2 - M models/lnd/clm/src/main/ncdio_pio.F90 ------------ use - shr_pio_getiotype/shr_pio_getiosys - M models/lnd/clm/src/main/surfrdMod.F90 ------------ remove write(6 statements - put write in "if ( masterproc )", if longitudes off by more than 300 - see if -180-180 form works - -Summary of testing: - - build-namelist unit testing: All PASS except... - us20 - bluefire: All PASS except... -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 -039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 -049 smCI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -050 erCI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -051 brCI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -052 blCI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except... -058 bl514 TBLCFGtools.sh gen_domain CFGtools__ds T31.runoptions .................................FAIL! rc= 4 -060 bl754 TBLtools.sh mksurfdata_map tools__s namelist ..........................................FAIL! rc= 5 -061 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -062 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -071 bl924 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds .....FAIL! rc= 5 -073 bl953 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 ..............................FAIL! rc= 7 -075 bl954 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......FAIL! rc= 5 -078 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -079 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 4 -080 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -081 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 4 -082 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 -083 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 4 - bluefire/CESM testing: All PASS except.. -FAIL ERI.T31_g37.IG1850.bluefire_ibm.tputcomp.clm4_0_43 -FAIL SMS_RLA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_43 -FAIL SMS_RLB.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_43 -FAIL SMS_ROA.f45_f45.I.bluefire_ibm.tputcomp.clm4_0_43 -FAIL ERS_D.f45_g37.I.bluefire_ibm.tputcomp.clm4_0_43 -FAIL SMS.1x1_numaIA.ICN.bluefire_ibm.tputcomp.clm4_0_43 -FAIL ERS_E.T31_g37.I1850.bluefire_ibm.tputcomp.clm4_0_43 -FAIL ERS_D.f19_g16.IGRCP26CN.bluefire_ibm.tputcomp.clm4_0_43 -FAIL SMS.f10_f10.IRCP45CN.bluefire_ibm.tputcomp.clm4_0_43 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire_ibm.tputcomp.clm4_0_43 -BFAIL PST.f45_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_43 -BFAIL PET_PT.f45_g37.I1850.bluefire_ibm.compare_hist.clm4_0_43 -BFAIL ERI.T31_g37.IG1850.bluefire_ibm.generate.clm4_0_44 -BFAIL PST.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_43 -BFAIL PET_PT.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_43 - lynx/pgi testing: All PASS - lynx/pgi interactive testing: All PASS except... -024 sm978 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds .....FAIL! rc= 6 -025 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -026 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 - mirage,storm/ifort interactive testing: All PASS - -CLM tag used for the baseline comparison tests if applicable: clm4_0_43 - -Changes answers relative to baseline: No, bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_43 -Originator(s): sacks (Bill Sacks); erik (Erik Kluzek) -Date: Fri Apr 6 11:36:21 MDT 2012 -One-line Summary: Add diagnostic fields, modify some existing history fields - -Purpose of changes: - -Add new diagnostic fields to track snow and ice fluxes. Modify some soil-related fields to -only be averaged over vegetated landunits (from Dave Lawrence). Fix some diagnostic fields -that were incorrect, especially over lakes and urban areas. Change QICE to spval rather -than 0 over non-ice_mec landunits. Rename QMELT to QSNOMELT. Delete redundant QICEYR. Add -snow balance check from Keith Oleson. Add flexible handling of l2g_scale_type in -subgridAveMod, replacing 'urbanh' c2l_scale_type and adding new functionality. Modify -create_clm_s2x to only reference qflx_glcice in the run loop, not in initialization, -because it is now NaN in initialization. Update scripts and esmf_wrf_timemgr. Changes in -clm.cpl7.template from Tony. Add in unit_testers for build-namelist. Update to nsegspc -branch. New qtr-degree RTM file, updates to mkmapdata.sh so requires -r if -f set, -build-namelist changes to ensure rtm and glc options consistent, and updates of -documentation to the latest cesm1_0_4 release tag. Sets nsegspc in the namelist and for -ne30_g16 sets it to 5. Enhancements to baseline tests. - -Requirements for tag: test on bluefire (CESM, int, bat), lynx/pgi (int,bat), mirage. -Fix perf bug 1485, Fix ne30 issue 1488, Fix history dimension issue 1489 - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): - 1485 (Performance issue with esmf_wrf_timemgr) - 1488 (partial -- now works with nsegspc=5) - 1489 (history dimension issue) - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (PTS_MODE can NOT use a global finidat file) - 1017 (PTS_MODE can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1454 (lack of 1D history files in CLM testing) - 1455 (bad time-stamp in CLM testing) - 1457 (bug in soil color in mksurfdata_map) - 1474 (Missing eulerian domain files) - 1479 (fails on jaguarpf) - 1485 (Performance issue with esmf_wrf_timemgr) - 1488 (Problem reading restarts@ne30_g16 for some layouts) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - - Modified clm.cpl7.template to no longer copy lnd_in to the case directory - -Describe any changes made to the namelist: - - For glacierMEC, use QICE rather than QICEYR for annual history files - Set nsegspc to 5 for ne30np4 and the default of 20 otherwise - -List any changes to the defaults for the boundary datasets: - - Fix qtr-degree RTM mapping file name - -Describe any substantial timing or memory changes: - - Fixes bug 1485 (performance issue with esmf_wrf_timemgr) - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, Machines, - esmf_wrf_timemgr, cprnc - - scripts to scripts4_120329d - Machines to Machines_120406 - esmf_wrf_timemgr to esmf_wrf_timemgr_120327 - cprnc to cprnc_120405 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>> Enhancements to baseline tests, and post-processor for test results -A models/lnd/clm/test/system/get_cprnc_diffs.sh - Script used by TBL.sh and - TBLrst_tools.sh -A models/lnd/clm/test/system/show_var_diffs.sh -- Post-processor for baseline test - results - ->>>>>>> Add build-namelist unit_tester -A models/lnd/clm/bld/unit_testers -A models/lnd/clm/bld/unit_testers/build-namelist_test.pl - -List all existing files that have been modified, and describe the changes: - ->>>>>>> Use CSMDATA rather than HOME -M models/lnd/clm/test/system/nl_files/getregional - ->>>>>>> Require -res to be set if -f option used -M models/lnd/clm/tools/mkmapdata/mkmapdata.sh - ->>>>>>> Fix qtr-degree RTM map, set nsegspc, work on usability -M models/lnd/clm/bld/user_nl_clm ---- Add notes about setting some things - with build-namelist options -M models/lnd/clm/bld/build-namelist - Set nsegspc, make sure glc_grid, glc_smb - do_rtm, and maxpatch_glcmec aren't set inconsistently between user_nl_clm - and build-namelist options -M models/lnd/clm/bld/README --------- Add notes about new unit_testers -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- qtr-degree RTM - mapping file, and set nsegspc - ->>>>>>> Bring in documentation updates from cesm1_0_4_n05_clm4_0_32, notes on setting ->>>>>>> finidat, adding history fields list -M models/lnd/clm/doc/UsersGuide/special_cases.xml -M models/lnd/clm/doc/UsersGuide/preface.xml -M models/lnd/clm/doc/UsersGuide/clm_ug.xml -M models/lnd/clm/doc/UsersGuide/custom.xml -M models/lnd/clm/doc/UsersGuide/Makefile - ->>>>>>> Remove duplicate line -M models/lnd/clm/test/system/tests_pretag_bluefire - ->>>>>>> Use get_cprnc_diffs.sh; truly print diffs from last file with a failed comparison ->>>>>>> rather than just printing diffs if last comparison failed -M models/lnd/clm/test/system/TBL.sh -M models/lnd/clm/test/system/TBLrst_tools.sh - ->>>>>>> Use QICE rather than QICEYR for annual history files -M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/glacierMEC_pd.xml - ->>>>>>> no longer copy lnd_in to the case directory -M models/lnd/clm/bld/clm.cpl7.template - ->>>>>>> Add new variables for tracking snow and ice fluxes -M models/lnd/clm/src/main/clmtype.F90 -M models/lnd/clm/src/main/clmtypeInitMod.F90 ----------- Also changed init of btran - and fpsn to spval -M models/lnd/clm/src/main/histFldsMod.F90 -------------- Add some fields, add - c2l_scale_type or l2g_scale_type for others; rename QMELT to QSNOMELT; delete - QICEYR -M models/lnd/clm/src/main/histFileMod.F90 -------------- Time-constant fields just - averaged over certain land units; add handling of set_noglcmec for pft-level - variables. Also, use lon & lat rather than lonatm & latatm -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 ------ Compute qflx_glcice_frz -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 - Compute qflx_glcice_melt - and qflx_snofrz_col -M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 --- To get proper grid cell - averages, turn some locals into globals, and add calculation of additional - fields - ->>>>>>> Change QICE to spval rather than 0 over non-ice_mec landunits -M models/lnd/clm/src/biogeophys/clm_driverInitMod.F90 - ->>>>>>> Add snow balance check, fix water balance check for glc_dyntopo -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 - Add calculation of - qflx_sl_top_soil, needed for snow balance check -M models/lnd/clm/src/main/pft2colMod.F90 ------------- Column-level averages of some - variables needed for snow balance check; also fixed average of qflx_evap_tot - for lakes - ->>>>>>> Only reference qflx_glcice in the run loop, not in initialization -M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 - pass init argument -M models/lnd/clm/src/main/clm_glclnd.F90 ------ in init, qice remains 0 - ->>>>>>> Flexible handling of l2g_scale_type -M models/lnd/clm/src/main/clm_varcon.F90 ---- max_lunit parameter -M models/lnd/clm/src/main/subgridAveMod.F90 - new subroutines for concise handling - of l2g_scale_type; add checks for l2g_scale_type==spval; remove urbanh - c2l_scale_type - - - -Summary of testing: - - bluefire: All PASS except: -004 blC91 TBL.sh _sc_dh clm_std^nl_urb 20030101:3600 4x5 gx3v7 -6 arb_ic ........................FAIL! rc= 7 -008 blTZ1 TBL.sh 21p_cncrpsc_dh clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 7 -011 blD91 TBL.sh _persc_dh clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 7 -015 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:1800 1.9x2.5 gx1v6@1850-2100 -10 cold FAIL! rc= 7 -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -019 blW51 TBL.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -5 cold .................FAIL! rc= 7 -023 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 7 -027 blHo1 TBL.sh 17p_cnsc_dh clm_drydep 20000101:1800 10x15 USGS@2000 -10 cold ..................FAIL! rc= 7 -031 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 7 -035 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 7 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 -039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 -043 blCn1 TBL.sh _sc_dh clm_transient_glcMEC_rcp8.5 20331231:1800 1.9x2.5 gx1v6@1850-2100 48 arb_ic FAIL! rc= 7 -044 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 2 -045 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 2 -046 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 2 -047 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 2 -051 blH#2 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 ne30np4 gx1v6@2000 48 startup .........FAIL! rc= 7 -053 smCI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -054 erCI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -055 brCI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -056 blCI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except: -008 blC97 TBL.sh _sc_do clm_spin^nl_urb 20030101:1800 4x5 gx3v7@1850 -6 arb_ic ..................FAIL! rc= 7 -012 blHS3 TBL.sh 17p_cnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .....FAIL! rc= 7 -028 blCK8 TBL.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 -034 blF93 TBL.sh 17p_sc_do clm_drydep^nl_voc 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 7 -038 blC83 TBL.sh _sc_do clm_std^nl_urb 20020115:3600 5x5_amazon navy -10 arb_ic .................FAIL! rc= 7 -046 blC63 TBL.sh _sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ........................FAIL! rc= 7 -054 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 7 -061 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -062 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -069 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 7 -075 bl9S4 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................FAIL! rc= 5 -076 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -077 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 4 -078 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -079 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 4 -080 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 -081 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 4 - bluefire/CESM testing: All PASS except: -BFAIL PST.f45_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_42 -BFAIL PET_PT.f45_g37.I1850.bluefire_ibm.compare_hist.clm4_0_42 -BFAIL PST.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_42 -BFAIL PET_PT.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_42 - bluefire/PTCLM testing: Not done - lynx/pgi testing: All PASS except: -004 blC92 TBL.sh _sc_dm clm_std^nl_urb 20030101:3600 4x5 gx3v7 -6 arb_ic ........................FAIL! rc= 7 -007 blD92 TBL.sh _persc_dm clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 7 -011 blF92 TBL.sh 17p_sc_dm clm_drydep^nl_voc 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 7 -015 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 7 -019 blL52 TBL.sh _sc_dm clm_std^nl_urb 20020115:1800 10x15 USGS 48 arb_ic .......................FAIL! rc= 7 - lynx/pgi interactive testing: All PASS except: -008 blTZ3 TBL.sh 21p_cncrpsc_do clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 7 -023 sm978 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds .....FAIL! rc= 6 -024 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -025 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 - lynx/CESM testing: All PASS except: -FAIL ERS_D.T31_g37.I1850.lynx_pgi.compare_hist.clm4_0_42 -FAIL ERS_D.T31_g37.I1850.lynx_pgi.compare_hist.clm4_0_42 -CFAIL ERI.f10_f10.IRCP60CN.lynx_pathscale.C.124327 -BFAIL PST.f19_g16.I.lynx_pgi.compare_hist.clm4_0_42 - mirage,storm/ifort interactive testing: All PASS except: -007 blD94 TBL.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 7 -019 blL54 TBL.sh _sc_ds clm_std^nl_urb 20020115:1800 10x15 USGS 48 arb_ic .......................FAIL! rc= 7 -023 blR53 TBL.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:1800 10x15 USGS@1850 48 cold ............FAIL! rc= 7 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_42 - -Changes answers relative to baseline: Just changes some diagnostic fields - - Changes the following default history fields: TSOI, HCSOI, ZWT, WA, WT, H2OSOI, - SOILLIQ, SOILICE, SOILWATER_10CM, QICE, QSNWCPICE_NODYNLNDUSE, QSNWCPLIQ - - Renames QMELT to QSNOMELT - - Also changes some fields not output by default - - Also changes cpl avghist files due to changes in qflx_glcice in initialization, but - this doesn't affect the simulation - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change: diagnostic fields only - -=============================================================== -=============================================================== -Tag name: clm4_0_42 -Originator(s): erik (Erik Kluzek) -Date: Tue Mar 27 21:14:59 MDT 2012 -One-line Summary: Bring in Francis Vitt's MEGAN changes. - -Purpose of changes: - -Bring Francis Vitt's MEGAN branch to the trunk. Replace the five VOC -compounds with the MEGAN model that allows up to 150 compounds to be -generated and passed to the driver. The mechanism allows the fields to -be choosen by a driver namelist which CLM responds to. - -Requirements for tag: test on bluefire (CESM, int, bat), lynx/pgi (int,bat), mirage - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - 1459 (PTSMODE fails) - 1480 (Darwin_intel build) - 1482 (Problems running 1x1 resolutions for CLM) - 1484 (re-configure removes the user_nl_clm) - 1486 (bad irrigation maps) - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (PTS_MODE can NOT use a global finidat file) - 1017 (PTS_MODE can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1454 (lack of 1D history files in CLM testing) - 1455 (bad time-stamp in CLM testing) - 1457 (bug in soil color in mksurfdata_map) - 1474 (Missing eulerian domain files) - 1479 (fails on jaguarpf) - 1485 (Performance issue with esmf_wrf_timemgr) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - - Add new -megan option to CLM build-namelist to add a megan namelist to - the drv_flds_in file. - Rename -drv_drydep option to -drydep. - - New namelist items for MEGAN: megan_factors_file, megan_specifier, and - megan_mapped_emisfctrs go into the megan_emis_nl namelist in drv_flds_in - - History fields removed: BIOGENCO, ISOPRENE (replaced by MEG_isoprene), - MONOTERP, ORVOC, ORVOC, OVOC - - Units of VOCFLXT changed from uGC/M2/H to moles/m2/sec - - New history fields: - -+ GAMMAC = gamma C for VOC calc (0-1) -+ MEG_2met_2s = MEGAN flux (kg/m2/sec) -+ MEG_2met_nonatriene = MEGAN flux (kg/m2/sec) -+ MEG_2met_s = MEGAN flux (kg/m2/sec) -+ MEG_2met_styrene = MEGAN flux (kg/m2/sec) -+ MEG_3met_3DCTT = MEGAN flux (kg/m2/sec) -+ MEG_Ehsalate = MEGAN flux (kg/m2/sec) -+ MEG_MBO_2m3e2ol = MEGAN flux (kg/m2/sec) -+ MEG_MBO_3m2e1ol = MEGAN flux (kg/m2/sec) -+ MEG_MBO_3m3e1ol = MEGAN flux (kg/m2/sec) -+ MEG_Napthalene = MEGAN flux (kg/m2/sec) -+ MEG_PPPP_2s = MEGAN flux (kg/m2/sec) -+ MEG_acetaldehyde = MEGAN flux (kg/m2/sec) -+ MEG_acetic_acid = MEGAN flux (kg/m2/sec) -+ MEG_acetone = MEGAN flux (kg/m2/sec) -+ MEG_acoradiene = MEGAN flux (kg/m2/sec) -+ MEG_ammonia = MEGAN flux (kg/m2/sec) -+ MEG_anisole = MEGAN flux (kg/m2/sec) -+ MEG_aromadendrene = MEGAN flux (kg/m2/sec) -+ MEG_benzaldehyde = MEGAN flux (kg/m2/sec) -+ MEG_benzyl-acetate = MEGAN flux (kg/m2/sec) -+ MEG_benzyl-alcohol = MEGAN flux (kg/m2/sec) -+ MEG_bergamotene_a = MEGAN flux (kg/m2/sec) -+ MEG_bergamotene_b = MEGAN flux (kg/m2/sec) -+ MEG_bisabolene_a = MEGAN flux (kg/m2/sec) -+ MEG_bisabolene_b = MEGAN flux (kg/m2/sec) -+ MEG_bornene = MEGAN flux (kg/m2/sec) -+ MEG_borneol = MEGAN flux (kg/m2/sec) -+ MEG_bornyl_ACT = MEGAN flux (kg/m2/sec) -+ MEG_bourbonene_b = MEGAN flux (kg/m2/sec) -+ MEG_butanone_2 = MEGAN flux (kg/m2/sec) -+ MEG_butene = MEGAN flux (kg/m2/sec) -+ MEG_cadinene_d = MEGAN flux (kg/m2/sec) -+ MEG_cadinene_g = MEGAN flux (kg/m2/sec) -+ MEG_camphene = MEGAN flux (kg/m2/sec) -+ MEG_camphor = MEGAN flux (kg/m2/sec) -+ MEG_carbon_2s = MEGAN flux (kg/m2/sec) -+ MEG_carbon_monoxide = MEGAN flux (kg/m2/sec) -+ MEG_carbonyl_s = MEGAN flux (kg/m2/sec) -+ MEG_carene_3 = MEGAN flux (kg/m2/sec) -+ MEG_caryophyllene_b = MEGAN flux (kg/m2/sec) -+ MEG_cedrene_a = MEGAN flux (kg/m2/sec) -+ MEG_cedrol = MEGAN flux (kg/m2/sec) -+ MEG_cineole_1_8 = MEGAN flux (kg/m2/sec) -+ MEG_copaene_a = MEGAN flux (kg/m2/sec) -+ MEG_cubebene_a = MEGAN flux (kg/m2/sec) -+ MEG_cubebene_b = MEGAN flux (kg/m2/sec) -+ MEG_cymene_o = MEGAN flux (kg/m2/sec) -+ MEG_cymene_p = MEGAN flux (kg/m2/sec) -+ MEG_decanal = MEGAN flux (kg/m2/sec) -+ MEG_diallyl_2s = MEGAN flux (kg/m2/sec) -+ MEG_dodecene_1 = MEGAN flux (kg/m2/sec) -+ MEG_elemene_b = MEGAN flux (kg/m2/sec) -+ MEG_estragole = MEGAN flux (kg/m2/sec) -+ MEG_ethane = MEGAN flux (kg/m2/sec) -+ MEG_ethanol = MEGAN flux (kg/m2/sec) -+ MEG_ethene = MEGAN flux (kg/m2/sec) -+ MEG_farnescene_a = MEGAN flux (kg/m2/sec) -+ MEG_farnescene_b = MEGAN flux (kg/m2/sec) -+ MEG_fenchene_a = MEGAN flux (kg/m2/sec) -+ MEG_fenchone = MEGAN flux (kg/m2/sec) -+ MEG_formaldehyde = MEGAN flux (kg/m2/sec) -+ MEG_formic_acid = MEGAN flux (kg/m2/sec) -+ MEG_geranyl_acetone = MEGAN flux (kg/m2/sec) -+ MEG_germacrene_B = MEGAN flux (kg/m2/sec) -+ MEG_germacrene_D = MEGAN flux (kg/m2/sec) -+ MEG_gurjunene_b = MEGAN flux (kg/m2/sec) -+ MEG_heptanal = MEGAN flux (kg/m2/sec) -+ MEG_heptane = MEGAN flux (kg/m2/sec) -+ MEG_heptanone = MEGAN flux (kg/m2/sec) -+ MEG_hexanal = MEGAN flux (kg/m2/sec) -+ MEG_hexane = MEGAN flux (kg/m2/sec) -+ MEG_hexanol_1 = MEGAN flux (kg/m2/sec) -+ MEG_hexenal_c3 = MEGAN flux (kg/m2/sec) -+ MEG_hexenal_t2 = MEGAN flux (kg/m2/sec) -+ MEG_hexenol_c3 = MEGAN flux (kg/m2/sec) -+ MEG_hexenyl_ACT_c3 = MEGAN flux (kg/m2/sec) -+ MEG_homosalate = MEGAN flux (kg/m2/sec) -+ MEG_humulene_a = MEGAN flux (kg/m2/sec) -+ MEG_humulene_g = MEGAN flux (kg/m2/sec) -+ MEG_hydrogen_cyanide = MEGAN flux (kg/m2/sec) -+ MEG_hydrogen_s = MEGAN flux (kg/m2/sec) -+ MEG_indole = MEGAN flux (kg/m2/sec) -+ MEG_ionone_b = MEGAN flux (kg/m2/sec) -+ MEG_ipsenol = MEGAN flux (kg/m2/sec) -+ MEG_isolongifolene = MEGAN flux (kg/m2/sec) -+ MEG_isoprene = MEGAN flux (kg/m2/sec) -+ MEG_jasmone = MEGAN flux (kg/m2/sec) -+ MEG_limonene = MEGAN flux (kg/m2/sec) -+ MEG_linalool = MEGAN flux (kg/m2/sec) -+ MEG_linalool_OXD_c = MEGAN flux (kg/m2/sec) -+ MEG_linalool_OXD_t = MEGAN flux (kg/m2/sec) -+ MEG_longifolene = MEGAN flux (kg/m2/sec) -+ MEG_longipinene = MEGAN flux (kg/m2/sec) -+ MEG_met_benzoate = MEGAN flux (kg/m2/sec) -+ MEG_met_bromide = MEGAN flux (kg/m2/sec) -+ MEG_met_chloride = MEGAN flux (kg/m2/sec) -+ MEG_met_heptenone = MEGAN flux (kg/m2/sec) -+ MEG_met_iodide = MEGAN flux (kg/m2/sec) -+ MEG_met_jasmonate = MEGAN flux (kg/m2/sec) -+ MEG_met_mercaptan = MEGAN flux (kg/m2/sec) -+ MEG_met_propenyl_2s = MEGAN flux (kg/m2/sec) -+ MEG_met_salicylate = MEGAN flux (kg/m2/sec) -+ MEG_meta-cymenene = MEGAN flux (kg/m2/sec) -+ MEG_methane = MEGAN flux (kg/m2/sec) -+ MEG_methanol = MEGAN flux (kg/m2/sec) -+ MEG_muurolene_a = MEGAN flux (kg/m2/sec) -+ MEG_muurolene_g = MEGAN flux (kg/m2/sec) -+ MEG_myrcene = MEGAN flux (kg/m2/sec) -+ MEG_myrtenal = MEGAN flux (kg/m2/sec) -+ MEG_nerolidol_c = MEGAN flux (kg/m2/sec) -+ MEG_nerolidol_t = MEGAN flux (kg/m2/sec) -+ MEG_neryl_acetone = MEGAN flux (kg/m2/sec) -+ MEG_nitric_OXD = MEGAN flux (kg/m2/sec) -+ MEG_nitrous_OXD = MEGAN flux (kg/m2/sec) -+ MEG_nonanal = MEGAN flux (kg/m2/sec) -+ MEG_nonenal = MEGAN flux (kg/m2/sec) -+ MEG_ocimene_al = MEGAN flux (kg/m2/sec) -+ MEG_ocimene_c_b = MEGAN flux (kg/m2/sec) -+ MEG_ocimene_t_b = MEGAN flux (kg/m2/sec) -+ MEG_octanal = MEGAN flux (kg/m2/sec) -+ MEG_octanol = MEGAN flux (kg/m2/sec) -+ MEG_octenol_1e3ol = MEGAN flux (kg/m2/sec) -+ MEG_oxopentanal = MEGAN flux (kg/m2/sec) -+ MEG_pentanal = MEGAN flux (kg/m2/sec) -+ MEG_pentane = MEGAN flux (kg/m2/sec) -+ MEG_phellandrene_a = MEGAN flux (kg/m2/sec) -+ MEG_phellandrene_b = MEGAN flux (kg/m2/sec) -+ MEG_phenyl_CCO = MEGAN flux (kg/m2/sec) -+ MEG_pinene_a = MEGAN flux (kg/m2/sec) -+ MEG_pinene_b = MEGAN flux (kg/m2/sec) -+ MEG_piperitone = MEGAN flux (kg/m2/sec) -+ MEG_propane = MEGAN flux (kg/m2/sec) -+ MEG_propene = MEGAN flux (kg/m2/sec) -+ MEG_pyruvic_acid = MEGAN flux (kg/m2/sec) -+ MEG_sabinene = MEGAN flux (kg/m2/sec) -+ MEG_selinene_b = MEGAN flux (kg/m2/sec) -+ MEG_selinene_d = MEGAN flux (kg/m2/sec) -+ MEG_terpinene_a = MEGAN flux (kg/m2/sec) -+ MEG_terpinene_g = MEGAN flux (kg/m2/sec) -+ MEG_terpineol_4 = MEGAN flux (kg/m2/sec) -+ MEG_terpineol_a = MEGAN flux (kg/m2/sec) -+ MEG_terpinolene = MEGAN flux (kg/m2/sec) -+ MEG_terpinyl_ACT_a = MEGAN flux (kg/m2/sec) -+ MEG_tetradecene_1 = MEGAN flux (kg/m2/sec) -+ MEG_thujene_a = MEGAN flux (kg/m2/sec) -+ MEG_thujone_a = MEGAN flux (kg/m2/sec) -+ MEG_thujone_b = MEGAN flux (kg/m2/sec) -+ MEG_toluene = MEGAN flux (kg/m2/sec) -+ MEG_tricyclene = MEGAN flux (kg/m2/sec) -+ MEG_verbenene = MEGAN flux (kg/m2/sec) - -List any changes to the defaults for the boundary datasets: - Correct fpftdyn historical f05 dataset, and add rcp datasets - Fix irrig map for f19 and f10 - -Describe any substantial timing or memory changes: None - Although bug 1485 is NOT fixed! (4X performance hit due to updated esmf_wrf_timemgr!) - -Code reviewed by: self,fvitt - -List any svn externals directories updated (csm_share, mct, etc.): scripts, Machines, - drv, pio, cprnc, and cism - - scripts to scripts4_120323 - Machines to Machines_120323a - drv to drvseq4_1_04 - pio to pio_1_4_2 - cprnc to cprnc_120322 - cism to cism1_120322 - -List all files eliminated: None - -List all files added and what they do: - -A models/lnd/clm/bld/namelist_files/history_fields.xsl - Style sheet to view history_fields XML file -A + models/lnd/clm/src/biogeochem/MEGANFactorsMod.F90 ---- MEGAN factors file - -List all existing files that have been modified, and describe the changes: - ->>>>>>>> Remove PTS-MODE restart tests -M models/lnd/clm/test/system/tests_posttag_lynx_nompi -M models/lnd/clm/test/system/tests_pretag_bluefire_nompi -M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi -M models/lnd/clm/test/system/tests_posttag_yong -MM models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi -M models/lnd/clm/test/system/tests_posttag_nompi_regression -M models/lnd/clm/test/system/test_driver.sh ----- Correct machine name for lynx -M models/lnd/clm/test/system/nl_files/nl_voc ---- Add megan namelist -M models/lnd/clm/test/system/nl_files/clm_drydep Add -megan option rename drydep -to drydep -M models/lnd/clm/test/system/input_tests_master - Tests with VOC must use - clm_drydep, make CA8 tests use drydep - -M models/lnd/clm/tools/SVN_EXTERNAL_DIRECTORIES - update cprnc - -M models/lnd/clm/bld/configure --------- Change top level model from cesm to driver -M models/lnd/clm/bld/build-namelist ---- Add -megan option/namelist, rename - -drv_drydep to drydep, add checking for megan namelist items -M models/lnd/clm/bld/clm.cpl7.template - Fix multi-instance issues, and - don't overwrite user_nl_clm file if it already exists - -M models/lnd/clm/bld/namelist_files/namelist_definition.xml ----- Update driver - namelist items, add megan namelist, more fields to drydep_list, list - megan compounds -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml --- Add commented - out finidat file for f05, update f05 fpftdyn and add fpftdyn for f05 rcp's - update irrig 10x15 mapping file -M models/lnd/clm/bld/namelist_files/namelist_defaults_drydep.xml - Add defaults - for megan namelist - -M models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 - Change VOC fields to megan - fields -M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 ------ Change VOC fields to megan - fields -M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 ---- Change VOC fiels to megan -M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 - Use Megan_factors_mod, - add VOCEmission_init, megan namelist determines the fields that will be - output rather than the 5 VOC fields -MM models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - More fields that can be - "mapped": 'SOAM', 'SOAI', 'SOAT', 'SOAB', 'SOAX' -M models/lnd/clm/src/main/clm_varpar.F90 ----------- Remove nvoc -M models/lnd/clm/src/main/clm_initializeMod.F90 ---- Add call to VOCEmission_init -M models/lnd/clm/src/main/clmtypeInitMod.F90 ------- Remove averaged voc fields -M models/lnd/clm/src/main/clm_atmlnd.F90 ----------- Remove voc add megan fields -M models/lnd/clm/src/main/findHistFields.pl -------- Add ability to handle new - megan fields -M models/lnd/clm/src/main/clm_driver.F90 ----------- Initialize cisun/cisha - to -999. each time-step for VOCEmission -M models/lnd/clm/src/main/ncdio_pio.F90 ------------ Changes from John Truesdale - so that PTS_MODE will work -M models/lnd/clm/src/main/clmtype.F90 -------------- VOC fields have extra - dimension remove averaged field -M models/lnd/clm/src/main/histFldsMod.F90 ---------- Remove specific VOC fields - add MEG_ fields - -Summary of testing: - - bluefire: All PASS except... -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -023 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 7 -027 blHo1 TBL.sh 17p_cnsc_dh clm_drydep 20000101:1800 10x15 USGS@2000 -10 cold ..................FAIL! rc= 7 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 -039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 -044 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 2 -045 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 2 -046 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 2 -047 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 2 - bluefire interactive testing: All PASS except -028 blCK8 TBL.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 -034 blF93 TBL.sh 17p_sc_do clm_drydep^nl_voc 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 7 -050 blHQ4 TBL.sh 17p_cnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -150 cold ............FAIL! rc= 7 -061 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -062 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -073 bl954 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......FAIL! rc= 6 -076 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -077 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 4 -078 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -079 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 4 -080 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 -081 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 4 - bluefire/CESM testing: All PASS except.. -BFAIL PST.f45_g37.I1850CN.bluefire_ibm.compare_hist.clm4_0_41 -BFAIL PET_PT.f45_g37.I1850.bluefire_ibm.compare_hist.clm4_0_41 -BFAIL SMS.1x1_numaIA.ICN.bluefire_ibm.compare_hist.clm4_0_41 -BFAIL ERP.1x1_mexicocityMEX.I.bluefire_ibm.compare_hist.clm4_0_41 -BFAIL PST.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_41 -BFAIL PET_PT.f10_f10.I20TRCN.bluefire_ibm.compare_hist.clm4_0_41 - bluefire/PTCLM testing: All FAIL - lynx interactive testing: ALL PASS up to... -023 sm978 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds .....FAIL! rc= 6 - lynx/CESM testing: All PASS except.. -FAIL ERS_D.T31_g37.I1850.lynx_pgi.generate.clm4_0_42 -CFAIL ERI.f10_f10.IRCP60CN.lynx_pathscale.GC.121827 -BFAIL PST.f19_g16.I.lynx_pgi.compare_hist.clm4_0_41 -BFAIL ERS.1x1_vancouverCAN.I.lynx_pgi.compare_hist.clm4_0_41 - mirage,storm/ifort interactive testing: All PASS! - yong/darwin/ifort interactive testing: All PASS up to... -005 smCL4 TSM.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_41 - -Changes answers relative to baseline: bit-for-bit (except cases with MEGAN or VOC) - -=============================================================== -=============================================================== -Tag name: clm4_0_41 -Originator(s): erik (Erik Kluzek) -Date: Tue Mar 13 23:43:45 MDT 2012 -One-line Summary: Bring rmfmesh/rtmmap branches to trunk - -Purpose of changes: - -Get working with latest scripts and have clm template call build-namelist directly. Move -rmfmesh/rtmmap branch to trunk. Remove CASA completely. Start using RTM mapping files. -Allow bigger tolerance for mksurfdata_map frac up to 1.e-5 so can work for f4x5. New -half-degree mapping files. Remove code to calculate RTM mapping. Remove ability to set -maxpatch_pft to something different than numpft in CLM configure. Remove --ad_spinup/-exit_spinup options in configure make generic -spinup option with a few -allowed values (similar to the clm45sci version of configure). New 1850 fsurdat dataset -for ne240np4. Update externals to the latest, get test_driver working. - -Requirements for tag: test on bluefire (CESM,int,bat), lynx/pgi (CESM), mirage, -template calls build-namelist. Fix 1477, 1476, 1468, 1467 - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - 1477 (Bad f05 datasets) - 1476 (Problem with stand-alone build on bluefire) - 1468 (Bad f09, f19 SCRIP Grid files) - 1467 (Remove runinit_ibm.csh script) - 1449 (Remove fine-mesh) - 1448 (Remove CASA) - 1432 (Several resolutions fail for new mksurfdata_map) - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1454 (lack of 1D history files in CLM testing) - 1455 (bad time-stamp in CLM testing) - 1457 (bug in soil color in mksurfdata_map) - 1459 (PTSMODE fails) - 1474 (Missing eulerian domain files) - 1479 (fails on jaguarpf) - 1480 (Darwin_intel build) - 1482 (Problems running 1x1 resolutions for CLM) - 1485 (Performance issue with esmf_wrf_timemgr) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - Remove CASA option, don't allow maxpft to be set. - CESM scripts/Machines updated. - -Describe any changes made to the namelist: - - BuildConf/clm.buildnml.csh now becomes a script that simply calls the clm - build-namelist script to build your namelist. This means you effectively treat it - as a READ-only script that you don't put changes into! Instead you use - the "user_nl_clm" file to put your custom changes to the namelist into. - The use of user_nl_clm is documented in the CLM User's Guide at... - - http://www.cesm.ucar.edu/models/cesm1.0/clm/models/lnd/clm/doc/UsersGuide/x1423.html#config_time_nml - - Use preview_namelists to see full namelists that will be created. - -List any changes to the defaults for the boundary datasets: Activate RTM mapping files - New 1840 ne240 fsurdat file, replace all f05 mapping files, replace all f05 mapping - files, and f05, f09, and f19 SCRIP grid files - -Describe any substantial timing or memory changes: Yes! - Much less global memory needed now! Only one temporary global integer array - used. - - 4X performance hit due to updated esmf_wrf_timemgr! (see bug 1485) - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): scripts, Machines, - drv, csm_share, esmf_wrf_timemgr, datm - - scripts to datm8_120219 - Machines to Machines_120309 - drv to drvseq4_1_02 - csm_share to share3_120308 - esmf_wrf_timemgr to esmf_wrf_timemgr_120218 - datm to datm8_120219 - -List all files eliminated: - ->>>>>>> Eliminate stand-alone intrepid/kraken testing files, CASA, fine-mesh, ->>>>>>> and RTM mapping calc. Elimanate interpinic run script, too hard to support. -D models/lnd/clm/test/system/tests_posttag_intrepid -D models/lnd/clm/test/system/tests_posttag_intrepid_nompi -D models/lnd/clm/test/system/tests_posttag_kraken -D models/lnd/clm/tools/interpinic/runinit_ibm.csh -D models/lnd/clm/src/biogeochem/CASAPhenologyMod.F90 -D models/lnd/clm/src/biogeochem/CASAMod.F90 -D models/lnd/clm/src/main/CASAiniTimeVarMod.F90 -D models/lnd/clm/src/main/downscaleMod.F90 -D models/lnd/clm/src/riverroute/RtmMapMod.F90 - -List all files added and what they do: Add config defaults files for supported - single point datasets, add empty user_nl_clm file - -A + models/lnd/clm/bld/user_nl_clm -A + models/lnd/clm/bld/config_files/config_defaults_1x1_smallvilleIA.xml -A + models/lnd/clm/bld/config_files/config_defaults_1x1_mexicocityMEX.xml -A + models/lnd/clm/bld/config_files/config_defaults_1x1_numaIA.xml -A + models/lnd/clm/bld/config_files/config_defaults_1x1_vancouverCAN.xml - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>> Changes to config_file for changes to configure ->>>>>>>>>>>>> eliminate use of maxpft, ad_spinup and exit_spinup use spinup option -M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dh -M models/lnd/clm/test/system/config_files/17p_cndvsc_m -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_m -M models/lnd/clm/test/system/config_files/17p_cndvsc_o -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_o -M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dm -M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_s -M models/lnd/clm/test/system/config_files/17p_cndvsc_s -M models/lnd/clm/test/system/config_files/17p_sc_dh -M models/lnd/clm/test/system/config_files/17p_sc_dm -M models/lnd/clm/test/system/config_files/17p_sc_do -M models/lnd/clm/test/system/config_files/17p_sc_ds -M models/lnd/clm/test/system/config_files/17p_cnsc_h -M models/lnd/clm/test/system/config_files/21p_cncrpsc_h -M models/lnd/clm/test/system/config_files/17p_cnsc_dh -M models/lnd/clm/test/system/config_files/21p_cncrpsc_dh -M models/lnd/clm/test/system/config_files/21p_cncrpsc_m -M models/lnd/clm/test/system/config_files/17p_cnsc_m -M models/lnd/clm/test/system/config_files/17p_cnsc_o -M models/lnd/clm/test/system/config_files/21p_cncrpsc_o -M models/lnd/clm/test/system/config_files/17p_cnsc_dm -M models/lnd/clm/test/system/config_files/21p_cncrpsc_dm -M models/lnd/clm/test/system/config_files/17p_cnsc_do -M models/lnd/clm/test/system/config_files/17p_cnc13sc_dh -M models/lnd/clm/test/system/config_files/21p_cncrpsc_do -M models/lnd/clm/test/system/config_files/21p_cncrpsc_s -M models/lnd/clm/test/system/config_files/17p_sc_h -M models/lnd/clm/test/system/config_files/21p_cncrpsc_ds -M models/lnd/clm/test/system/config_files/17p_cnsc_ds -M models/lnd/clm/test/system/config_files/17p_cnc13sc_dm -M models/lnd/clm/test/system/config_files/17p_cnc13sc_do -M models/lnd/clm/test/system/config_files/17p_sc_m -M models/lnd/clm/test/system/config_files/17p_sc_o -M models/lnd/clm/test/system/config_files/17p_cnnfsc_dh -M models/lnd/clm/test/system/config_files/17p_cnnfsc_dm -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_dh -M models/lnd/clm/test/system/config_files/17p_cndvsc_dh -M models/lnd/clm/test/system/config_files/17p_cnnfsc_do -M models/lnd/clm/test/system/config_files/17p_cndvsc_dm -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_dm -M models/lnd/clm/test/system/config_files/17p_cndvsc_do -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_do -M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_ds -M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm -M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do -M models/lnd/clm/test/system/config_files/README -M models/lnd/clm/test/system/config_files/21p_cndvcrpsc_h -M models/lnd/clm/test/system/config_files/17p_cndvsc_h - ->>>>>>>>>>>>> Get working with latest scripts, eliminate intrepid. -M models/lnd/clm/test/system/TCB.sh --------- Send -comp to configure -M models/lnd/clm/test/system/test_driver.sh - Eliminate intrepid, get working - with latest CESM scripts/Machines, update env settings to Machines -M models/lnd/clm/test/system/CLM_runcmnd.sh - Eliminate intrepid -M models/lnd/clm/test/system/tests_pretag_bluefire - Correct test name - ->>>>>>>>>>>>> Eliminate CASA -M models/lnd/clm/tools/interpinic/src/interpinic.F90 -M models/lnd/clm/tools/mksurfdata_map/src/clm_varctl.F90 - ->>>>>>>>>>>>> Eliminate CASA, and maxpft. Read site specific config_defaults ->>>>>>>>>>>>> Change spinup option, get working with latest scripts. -M models/lnd/clm/bld/configure --------- Use clm45sci API (use -spinup in - place of ad_spinup/exit_spinup), read site specific config_defaults - file when sitespf_pt option is used. Eliminate CASA, and maxpft option. - Get configure working with latest CESM scripts. Add mct/pio subdirectory - for SMP=on/off so will build on bluefire. Add -comp option required - for new CESM scripts (for stand-alone test). -M models/lnd/clm/bld/build-namelist ---- Remove faerdep, use spinup from - configure rather than ad/exit_spinup, remove substition of CSMDATA - in filenames. -M models/lnd/clm/bld/clm.cpl7.template - Use sitespf_pt for regional case - when CLM_USRDAT NOT used and don't use clm_root in configure. -M models/lnd/clm/bld/config_files/config_sys_defaults.xml - Add comp settings - and change mach settings to NOT include compiler. Remove: dec_osf, - es, irix, solaris, super-ux, unicosmp as no longer tested on -M models/lnd/clm/bld/config_files/config_definition.xml --- Remove CASA option - mxpft can only be 17 or 21. Add comp, remove ad_spinup/exit_spinup - for spinup option. Change description of sitespf_pt option. - ->>>>>>>>>>>>> Eliminate CASA, move ad/exit_spinup to spinup, add 1850 ne240 fsurdat ->>>>>>>>>>>>> Activate all RTM maps, replace all f05 maps. -M models/lnd/clm/bld/namelist_files/namelist_definition.xml - Rm fget_archdev - only allow R05 for rtm_res -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - ad_spinup - to spinup -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - add 1840 ne240 fsurdat, remove null setting of findat for maxpft=4 - activate RTM maps, replace all 0.47x0.63 mapping files -M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Use - standard shared SCRIP-grid files for: f05, f09, f19 resolutions -M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ------- Change - ad/exit_spinup to spinup -M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Remove - fatmgrid, flndtopo, fatmtopo, and fatmlndfrc files -M models/lnd/clm/doc/IMPORTANT_NOTES - Remove CASA, fine-mesh, and fget_archdev - ->>>>>>>>>>>>> Eliminate CASA, fine-mesh and atm data, change llatlon for ldomain ->>>>>>>>>>>>> Require RTM map files to be read. Require fatmlndfrc files to be ->>>>>>>>>>>>> in CESM domain file format. Require maxpft=numpft+1. Fix a pnetcdf issue. -M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 - Remove CASA use ldomain - in place of llatlon -M models/lnd/clm/src/biogeochem/CNDVMod.F90 ------ ldomain replaces llatlon -M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 --- Get rid of fine-mesh - downscaling, use ldomain in place of llatlon remove atm, lnd versions - of everything (adomain, adecomp, get_proc_bounds_atm, begg_a/l, atm_sx for example. -M models/lnd/clm/src/main/organicFileMod.F90 ---- llatlon becomes ldomain -M models/lnd/clm/src/main/decompInitMod.F90 ----- Remove decompInit_atm, acid - remove atm grid stuff for: decompInit_lnd and decompInit_glcp -M models/lnd/clm/src/main/clm_initializeMod.F90 - Remove downscaling and atm/lnd - grid stuff as well as CASA. -M models/lnd/clm/src/main/clm_glclnd.F90 -------- Remove clm_maps2x and clm_mapx2s - and atm_s2x and atm_x2s -M models/lnd/clm/src/main/clmtypeInitMod.F90 ---- Remove CASA stuff -M models/lnd/clm/src/main/ndepStreamMod.F90 ----- Replace llatlon with ldomain -M models/lnd/clm/src/main/histFileMod.F90 ------- Remove atm grid stuff such - as gratm, namea grids, remove CASA -M models/lnd/clm/src/main/clm_atmlnd.F90 -------- Remove downscaling/upscaling - init_adiag_type, clm_downscale_a2l and data: atm_a2l, atm_l2a, adiag_arain -M models/lnd/clm/src/main/restFileMod.F90 ------- Remove CASA -M models/lnd/clm/src/main/controlMod.F90 -------- Remove fatmgrid, CASA, fatmtopo - add write about flndtopo (still needed for glc_nec) -M models/lnd/clm/src/main/initSurfAlbMod.F90 ---- Remove CASA -M models/lnd/clm/src/main/clm_varctl.F90 -------- Remove downscale and CASA -M models/lnd/clm/src/main/clm_driver.F90 -------- Remove CASA -M models/lnd/clm/src/main/initGridCellsMod.F90 -- Remove setting of _a domain - info, gindex_a, longdeg_a, latdeg_a, lon_a, lat_a -M models/lnd/clm/src/main/ncdio_pio.F90 --------- Remove use of gratm, set - data=' ' needed for pnetcdf -M models/lnd/clm/src/main/surfrdMod.F90 --------- Remove surfrd_get_latlon, - surfrd_get_frac, surfrd_wtxy_veg_rank, surfrd_mkrank, add - surfrd_get_globmask in place of surfrd_get_latlon, get rid of - ability to read in CLM frac datasets and only read in CESM domain file - format. Abort if allocate_all_vegpfts is NOT true. -M models/lnd/clm/src/main/domainMod.F90 --------- Remove latlon_type, - nara, and ntop add isgrid2d, adomain, alatlon, llatlon, gatm, amask, pftm - methods: domain_setptrs, latlon_init, latlon_check, latlon_clean, - latlon_setsame -M models/lnd/clm/src/main/decompMod.F90 --------- Remove get_proc_global_atm, - get_proc_bounds_atm, and atmosphere decomposition data -M models/lnd/clm/src/main/clmtype.F90 ----------- Remove CASA, gratm -M models/lnd/clm/src/main/histFldsMod.F90 ------- Remove use of atm_a2l, -- adiag_arain, adiag_asnow, adiag_aflux, adiag_lflux, downscale - remove CASA and downscale if's -M models/lnd/clm/src/main/mkarbinitMod.F90 ------ Remove CASA -M models/lnd/clm/src/riverroute/RtmMod.F90 ------ Remove some global RTM - data. Replace call's to endrun to shr_sys_abort as intial - step of the move to having RTM on it's own component. - Add rtm_celledge. -M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 ---- llatlon to ldomain -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 - formatting change -M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 ---- Remove CASA -M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 ------ Remove downscaling - -Summary of testing: - - bluefire: TBL tests fail because of use of RTM mapping files and NetCDF issue and -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 -044 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 2 -045 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 2 -046 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 2 - bluefire interactive testing: All PASS except, TBL tests fail because of NetCDF build issue and -026 erCK4 TER.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 7 -027 brCK4 TBR.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 6 -031 brCK8 TBR.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 6 - bluefire/CESM testing: All PASS except - (and ALL compare tests fail couldn't find base result) -FAIL SMS.1x1_numaIA.ICN.bluefire_ibm -FAIL ERP.1x1_mexicocityMEX.I.bluefire_ibm - bluefire/PTCLM testing: All FAIL - lynx/pgi testing: ALL FAIL - lynx/pgi interactive testing: ALL FAIL - lynx CESM testing: ALL PASS except... (don't compare as no baselines for clm4_0_40) -CFAIL ERI.f10_f10.IRCP60CN.lynx_pathscale.162157 -FAIL PST.f19_g16.I.lynx_pgi -RUN ERS.1x1_vancouverCAN.I.lynx_pgi.162157 - mirage,storm/ifort interactive testing: All PASS! - jaguarpf CESM testing: All FAIL -RUN ERS_D.f09_g16.I1850.titan_pgi.182111 -FAIL ERI.f10_f10.IRCP60CN.titan_pgi -FAIL PST.f09_g16.I.titan_pgi -FAIL PET_PT.f10_f10.I20TRCN.titan_pgi -FAIL ERP.f19_g16.I4804CN.titan_pgi -RUN ERS.1x1_mexicocityMEX.I.titan_pgi.182111 -FAIL ERI_D.ne30_g16.I1850CN.titan_pgi -TFAIL ERH.ne120_g16.I2000CN.titan_pgi.182111 -RUN ERS.f09_g16.IRCP26CN.titan_pgi.182111 -FAIL SMS.f10_f10.IRCP45CN.titan_pgi -RUN ERS.f19_g16.IRCP60CN.titan_pgi.182111 -FAIL SMS_D.f10_f10.IRCP85CN.titan_pgi -RUN ERS.f09_g16.IG1850.titan_pgi.182111 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_40 - -Changes answers relative to baseline: Yes (using RTM mapping files now) - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: RTM mapping for f05 - - what platforms/compilers: - - nature of change larger than roundoff/same climate - -=============================================================== -=============================================================== -Tag name: clm4_0_40 -Originator(s): erik (Erik Kluzek) -Date: Thu Feb 16 14:19:28 MST 2012 -One-line Summary: Back out update to new T31 surface datasets - -Purpose of changes: - -Back out the new T31 surface datasets so will have initial conditions to use -for T31. Bring in the new surface datasets with initial conditions in the next tag. - -Requirements for tag: Run on bluefire - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1454 (lack of 1D history files in CLM testing) - 1455 (bad time-stamp in CLM testing) - 1457 (bug in soil color in mksurfdata_map) - 1459 (PTSMODE fails) - 1468 (Bad f09, f19 SCRIP Grid files) - 1476 (Problem with stand-alone build on bluefire) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Bring back old T31 datasets - Comment out the new T31 surface datasets and put back the old T31 datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - - A models/lnd/clm/src/main/findHistFields.pl -- Add script to figure out list of - history field names, long_names, and units - Create's a XML file as well as giving you a neatly formatted sorted list. - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Move T31 files - back to previous version and comment out the new files. - -Summary of testing: - - bluefire: All PASS except... -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -020 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -021 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -3+-7 cold ................FAIL! rc= 5 -022 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -5+-5 cold ................FAIL! rc= 5 -028 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -029 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -3+-7 arb_ic ............FAIL! rc= 5 -030 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -5+-5 arb_ic ............FAIL! rc= 5 -032 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 96 cold ...............FAIL! rc= 4 -033 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 5 -034 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 5 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 - bluefire interactive testing: All PASS except... -026 erCK4 TER.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 7 -027 brCK4 TBR.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 6 -031 brCK8 TBR.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 6 -065 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -080 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -082 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -084 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= - bluefire/CESM testing: All PASS except... -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -020 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -021 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -3+-7 cold ................FAIL! rc= 5 -022 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -5+-5 cold ................FAIL! rc= 5 -028 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -029 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -3+-7 arb_ic ............FAIL! rc= 5 -030 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -5+-5 arb_ic ............FAIL! rc= 5 -032 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 96 cold ...............FAIL! rc= 4 -033 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 5 -034 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 5 -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_39 - -Changes answers relative to baseline: T31 - - Answers are identical to clm4_0_38, if fatmgrid=fsurdat in controlMod.F90 - except for ntop for some grids and TREFMXAV and TREFMNAV for others. - -=============================================================== -=============================================================== -Tag name: clm4_0_39 -Originator(s): erik (Erik Kluzek) -Date: Wed Feb 1 11:40:11 MST 2012 -One-line Summary: Bring newgrid branch to trunk - -Purpose of changes: - -Move newgrid branch from Mariana to trunk. Add ne4np4, ne16np4, ne240np4 surface -datasets. Replace all T31 surface datasets. Start removing CASA and fine-mesh testing -and support. Bring in Tony's updates to ESMF5.2.0. - -Requirements for tag: - -run on lynx-pgi/bluefire/mirage-intel, fix bugs: 1446, 1444, 1442, 1404, 1430, 1425, 1420 - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - 1458 (Problem using fsurdat for fatmgrid as no verticies) - 1444 (attempt to read unallocated variable) - 1442 (Make clm-template same as CAM template) - 1430 (Remove DIN_LOC_ROOT_CLMQIAN -- add ...CLM_FORC) - 1425 (Double quotes causes Namelist.pm to hang) - 1420 (Bad history output for TREFMNAV, TREFMXAV) - 1404 (Inconsistent domain and fatmlndfrc files) - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1454 (lack of 1D history files in CLM testing) - 1455 (bad time-stamp in CLM testing) - 1457 (bug in soil color in mksurfdata_map) - 1459 (PTSMODE fails) - 1468 (Bad f09, f19 SCRIP Grid files) - 1476 (Problem with stand-alone build on bluefire) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - Move rtm, voc, and glc_nec from configure-time to run-time namelist options - - Remove the -rtm -glc_nec and -voc options from "configure" - (NO longer available to CLM_CONFIG_OPTS) - - -Describe any changes made to the namelist: - - Add "-glc_nec, -glc_smb, -rtm options to build-namelist - (now available to CLM_BLDNML_OPTS) - - Remove fine-mesh option to build-namelist "-lnd_res" - (NO longer available to CLM_BLDNML_OPTS) - - Add following to clm_inparm namelist: - - do_rtm => If TRUE, turn on rtm river routing - maxpatch_glcmec => Number of multiple elevation classes over glacier points. - Normally this is ONLY used when running CESM with the active glacier model. - - Add following to the driver namelist to pass extra fields - - flds_voc - flds_co2a - flds_co2a - flds_co2c - flds_co2_dmsa - cplflds_custom - glc_nec - -List any changes to the defaults for the boundary datasets: - Replace T31 surface datasets, remove T31 finidat datasets - Add T31 fpftdyn datasets for all cases - Add ne240np4 datasets, ne4np4, ne16np4 surface datasets - - remove ALL fatmtopo datasets and all but T31, f09, f19 for glc_nec flndtopo - - Remove fatmlndfrc datasets -- use datm domainfiles in their place - -Describe any substantial timing or memory changes: None - -Code reviewed by: self,mvertens,tcraig (ESMF update) - -List any svn externals directories updated (csm_share, mct, etc.): almost all - scripts to scripts4_120123 - Machines to Machines_120123 - drv to drvseq4_1_01 - datm to datm8_120123 - socn/sice/sglc to stubs1_3_01 - cism to cism1_120123 - csm_share to share3_120123 - esmf_wrf_tmgr to esmf_wrf_timemgr_120123 - gen_domain to gen_domain_120117 - -List all files eliminated: - ->>>>>>>>>>>>>> Get rid of mkgriddata as no longer needed ->>>>>>>>>>>>>> Use gen_domain or models/lnd/clm/tools/mkmapdata/mknoocnmap.pl - D mkgriddata/mkgriddata.namelist - D mkgriddata/mkgriddata.regional - D mkgriddata/src/mkvarpar.F90 - D mkgriddata/src/mkvarctl.F90 - D mkgriddata/src/clm_varpar.F90 - D mkgriddata/src/clm_varctl.F90 - D mkgriddata/src/shr_sys_mod.F90 - D mkgriddata/src/shr_file_mod.F90 - D mkgriddata/src/ncdio.F90 - D mkgriddata/src/shr_log_mod.F90 - D mkgriddata/src/Filepath - D mkgriddata/src/Macros.custom - D mkgriddata/src/shr_kind_mod.F90 - D mkgriddata/src/shr_const_mod.F90 - D mkgriddata/src/mkgriddata.F90 - D mkgriddata/src/domainMod.F90 - D mkgriddata/src/areaMod.F90 - D mkgriddata/src/creategridMod.F90 - D mkgriddata/src/nanMod.F90 - D mkgriddata/src/Srcfiles - D mkgriddata/src/Mkdepends - D mkgriddata/src/Makefile - D mkgriddata/src - D mkgriddata/mkgriddata.singlept - D mkgriddata/mkgriddata.cesm_dom - D mkgriddata/README - D mkgriddata - ->>>>>>>>>>>>>> Remove config files for CASA or that turn off RTM, or ->>>>>>>>>>>>>> turn on VOC or glc_mec - D models/lnd/clm/test/system/config_files/_nrsc_dh - D models/lnd/clm/test/system/config_files/4p_casasc_dh - D models/lnd/clm/test/system/config_files/4p_casasc_dm - D models/lnd/clm/test/system/config_files/4p_casasc_do - D models/lnd/clm/test/system/config_files/4p_casasc_ds - D models/lnd/clm/test/system/config_files/4p_casasc_h - D models/lnd/clm/test/system/config_files/4p_casasc_m - D models/lnd/clm/test/system/config_files/4p_casasc_o - D models/lnd/clm/test/system/config_files/17p_nrsc_ds - D models/lnd/clm/test/system/config_files/_nrsc_dm - D models/lnd/clm/test/system/config_files/_nrsc_do - D models/lnd/clm/test/system/config_files/4p_nrcasasc_ds - D models/lnd/clm/test/system/config_files/17p_vorsc_h - D models/lnd/clm/test/system/config_files/_nrsc_ds - D models/lnd/clm/test/system/config_files/17p_vorsc_m - D models/lnd/clm/test/system/config_files/17p_nrcnsc_do - D models/lnd/clm/test/system/config_files/17p_vorsc_o - D models/lnd/clm/test/system/config_files/17p_nrcnsc_ds - D models/lnd/clm/test/system/config_files/_nrmexsc_ds - D models/lnd/clm/test/system/config_files/_mec10sc_dh - D models/lnd/clm/test/system/config_files/_nrcnsc_do - D models/lnd/clm/test/system/config_files/_mec10sc_dm - D models/lnd/clm/test/system/config_files/_nrcnsc_ds - D models/lnd/clm/test/system/config_files/_mec10sc_do - D models/lnd/clm/test/system/config_files/_mec10sc_ds - D models/lnd/clm/test/system/config_files/_nrsc_s - D models/lnd/clm/test/system/config_files/_nrvansc_ds - D models/lnd/clm/test/system/config_files/_nrnil3sc_dh - D models/lnd/clm/test/system/config_files/_nrnil3sc_dm - D models/lnd/clm/test/system/config_files/17p_vorsc_dh - D models/lnd/clm/test/system/config_files/21p_nrcncrpsc_s - D models/lnd/clm/test/system/config_files/21p_nrcncrpsc_ds - D models/lnd/clm/test/system/config_files/17p_vorsc_dm - D models/lnd/clm/test/system/config_files/17p_vorsc_do - D models/lnd/clm/test/system/config_files/17p_vorsc_ds - D models/lnd/clm/test/system/config_files/_mec10sc_h - D models/lnd/clm/test/system/config_files/_mec10sc_m - D models/lnd/clm/test/system/config_files/_mec10sc_o - ->>>>>>>>>>>>>> Remove mkdatadomain always use gen_domain - D models/lnd/clm/tools/mkdatadomain - D models/lnd/clm/tools/mkdatadomain/mkdatadomain.namelist - D models/lnd/clm/tools/mkdatadomain/src - D models/lnd/clm/tools/mkdatadomain/src/addglobal.F90 - D models/lnd/clm/tools/mkdatadomain/src/create_domain.F90 - D models/lnd/clm/tools/mkdatadomain/src/Mkdepends - D models/lnd/clm/tools/mkdatadomain/src/Srcfiles - D models/lnd/clm/tools/mkdatadomain/src/Filepath - D models/lnd/clm/tools/mkdatadomain/src/Macros.custom - D models/lnd/clm/tools/mkdatadomain/src/Makefile - D models/lnd/clm/tools/mkdatadomain/src/shr_kind_mod.F90 - D models/lnd/clm/tools/mkdatadomain/src/shr_const_mod.F90 - D models/lnd/clm/tools/mkdatadomain/README ->>>>>>>>>>>>>> fine-mesh no longer supported don't worry about topo files anymore - D models/lnd/clm/bld/namelist_files/checktopofiles.ncl - -List all files added and what they do: - ->>>>>>>>>>>>>> Rename without RTM off option - A + models/lnd/clm/test/system/config_files/17p_cnsc_ds - A + models/lnd/clm/test/system/config_files/_mexsc_ds - A + models/lnd/clm/test/system/config_files/_vansc_ds - ->>>>>>>>>>>>>> namelist to turn on VOC and RTM off, and gen_domain options - A + models/lnd/clm/test/system/nl_files/nl_voc - A + models/lnd/clm/test/system/nl_files/clm_nortm - A + models/lnd/clm/test/system/nl_files/gen_domain.ne30.runoptions - A + models/lnd/clm/test/system/nl_files/gen_domain.T31.runoptions - ->>>>>>>>>>>>>> Add scripts to create SCRIP grid/map files for region/single-point domains - A + models/lnd/clm/tools/mkmapdata/mkunitymap.ncl - A + models/lnd/clm/tools/mkmapdata/mknoocnmap.pl - A + models/lnd/clm/tools/mkmapgrids/mkscripgrid.ncl - - mknoocnmap.pl [options] Gets map and grid files for a single land-only point. - REQUIRED OPTIONS - -centerpoint [or -p] Center latitude,longitude of the grid to create. - -name [-or -n] Name to use to describe point - - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Remove rtm off from config files and update README file - M models/lnd/clm/test/system/config_files/_nil3sc_dh - M models/lnd/clm/test/system/config_files/_nil3sc_dm - M models/lnd/clm/test/system/config_files/README - ->>>>>>>>>>>>>> Change tests - M models/lnd/clm/test/system/README.testnames --- Update test names - 6, A, J, Q, S, V, X, and Z configurations are now unused - resolutions: 3, F, G and H are now unused - M models/lnd/clm/test/system/mknamelist --------- Remove fine-mesh option - M models/lnd/clm/test/system/test_driver.sh ----- Update paths for - edinburgh/jaguar - M models/lnd/clm/test/system/input_tests_master - Remove nr,vo,mec in configure - files for tests and move to namelist, remove compile-only test names - M models/lnd/clm/test/system/TSMtools.sh -------- Allow run files to - be in test directory - ->>>>>>>>>>>>>> Change testnames - 6, A, J, Q, S, V, X, and Z configurations are now unused - resolutions: 3, F, G and H are now unused - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_posttag_yong - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_posttag_kraken - MM models/lnd/clm/test/system/tests_pretag_jaguarpf - MM models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi - M models/lnd/clm/test/system/tests_posttag_mirage - M models/lnd/clm/test/system/tests_posttag_intrepid - M models/lnd/clm/test/system/tests_posttag_intrepid_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/tests_posttag_lynx - ->>>>>>>>>>>>>> Fix run-time options - M models/lnd/clm/test/system/nl_files/clm_usrdat ----- Add rtm off - M models/lnd/clm/test/system/nl_files/mkmapdata_if10 - Remove -i option - ->>>>>>>>>>>>>> Add option to create datasets NOT entered into XML database - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - Use domainfile - rather than fatmgrid file, which changes variable names as well - M models/lnd/clm/tools/README.testing --------------- Note that run files - can be in tool directory or test directory - M models/lnd/clm/tools/README ----------------------- Update information on - process - MM models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl - Add usrspc option - M models/lnd/clm/tools/mkmapdata/regridbatch.sh ----- Use -b instead of -i - M models/lnd/clm/tools/mkmapdata/mkmapdata.sh ------- Replace -i option with - -b for batch, add option to read input SCRIP grid file (-f) and (-t) - option for regional or global type, update usage - M models/lnd/clm/tools/mksurfdata_map/README -------- Update usage info - M models/lnd/clm/tools/mkmapdata/README ------------- Update usage info - - New options for unsupported resolutions to mksurfdata.pl - -+ For unsupported, user-specified resolutions: -+ $ProgName -res usrspec -usr_gname -usr_gdate [OPTIONS] -+ -usr_gname "user_gname" User resolution name to find grid file with -+ (only used if -res is set to 'usrspec') -+ -usr_gdate "user_gdate" User map date to find mapping files with -+ (only used if -res is set to 'usrspec') -+ NOTE: all mapping files are assumed to be in mkmapdata -+ - and the user needs to have invoked mkmapdata in -+ that directory first -+ - ->>>>>>>>>>>>>> Move rtm, glc_nec, voc from configure to build-namelist - M models/lnd/clm/bld/configure -------------- Remove -rtm, -glc_nec, -voc options - M models/lnd/clm/bld/listDefaultNamelist.pl - Get datm namelist files as well - M models/lnd/clm/bld/build-namelist --------- Add: glc_nec, glc_smb, rtm options - Remove: lnd_res fine-mesh option - M models/lnd/clm/bld/clm.cpl7.template ------ Move rtm, glc_nec settings from - configure to build-namelist, set fatmlndfrc from domain file set in scripts - add processing for LND_GRID=reg, set glc_smb, loop over namelists for DART, - M models/lnd/clm/bld/README - M models/lnd/clm/bld/config_files/config_definition.xml - Remove rtm, glc_nec, voc - ->>>>>>>>>>>>>> Add new namelist items, remove CASA, fine-mesh, update T31 ->>>>>>>>>>>>>> add ne4np4, ne16np4, ne240np4 datasets - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ------ - Add: rtm, maxpatch_glcmec, do_rtm, new cpl files, navy lmask - remove: fatmtopo, CASA namelist items, - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - rtm/glc_nec - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl ------- rm CASA - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- - Add: do_rtm, new T31 fsurdat/fpftdyn files, new ne4np4, ne16np4, - fsurdat and ne240np4 fsurdat/fatmlndfrc, missing map files (f19,T31) - Remove: T31 finidat, remove fatmtopo, and most flndtopo - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ---- Change - paths of domainfiles to share/domains - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml Add 10min - navy grid file - ->>>>>>>>>>>>>> Add glc_nec - M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/glacierMEC_pd.xml - - ->>>>>>>>>>>>>> Remove RTM, GLC_NEC, ESMF5.2.0 updates, don't require extents on fsurdat - M models/lnd/clm/src/main/clm_varpar.F90 -- Change for glc_nec - M models/lnd/clm/src/main/accumulMod.F90 -- Initialize val to zero if period=1 - M models/lnd/clm/src/main/clm_initializeMod.F90 - Change order of calls, rm RTM - M models/lnd/clm/src/main/clm_glclnd.F90 -- Use maxpatch_glcmec NOT glc_nec - M models/lnd/clm/src/main/subgridMod.F90 -- Use maxpatch_glcmec NOT glc_nec - M models/lnd/clm/src/main/histFileMod.F90 - Remove RTM add do_rtm - make sure ninst suffix is in restart history filename - M models/lnd/clm/src/main/restFileMod.F90 - Remove RTM add do_rtm - M models/lnd/clm/src/main/controlMod.F90 -- Remove RTM add do_rtm, - maxpatch_glcmec, glc_grid, use fatmlndfrc for fatmgrid if empty - broadcast glc_topomax if create_glacier_mec_landunit - M models/lnd/clm/src/main/clm_time_manager.F90 - Changes from Tony to update - to ESMF5.2.0 - M models/lnd/clm/src/main/clm_varctl.F90 ---- Remove RTM, use do_rtm, and remove - GLC_NEC use arrays for glc_nec variables - M models/lnd/clm/src/main/clm_driver.F90 ---- Remove RTM use do_rtm - M models/lnd/clm/src/main/initGridCellsMod.F90 - Write more info on error - M models/lnd/clm/src/main/pftvarcon.F90 ----- Remove unused MPI vars - M models/lnd/clm/src/main/surfrdMod.F90 ----- Don't require LATS/N,LONE/W on - files set to nan if not used, use maxpatch_glcmec NOT glc_nec - M models/lnd/clm/src/main/domainMod.F90 ----- Don't write LATS/N,LONE/W if - first lonw is nan - M models/lnd/clm/src/main/decompMod.F90 ----- Remove RTM use do_rtm - M models/lnd/clm/src/main/histFldsMod.F90 --- Remove RTM use do_rtm - M models/lnd/clm/src/riverroute/RtmMod.F90 -- Remove RTM use run_rtm NOT do_rtm - M models/lnd/clm/src/riverroute/RunoffMod.F90 Remove RTM - ->>>>>>>>>>>>>> ESMF5.2.0 updates, remove RTM, GLC_NEC - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - ESMF5.2.0 updates, remove RTM - use do_rtm, remove GLC_NEC use arrays of glc_nec - M models/lnd/clm/src/cpl_esmf/lnd_comp_mct.F90 -- ESMF5.2.0 updates - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 --- ESMF4.2.0 updates - M models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 - Updated for new coupler fields spec - Remove RTM, GLC_NEC CPP tokens, make glc_nec variables arrays - some updates to ESMF5.2.0 - -Summary of testing: - - bluefire: All PASS except... -004 blC91 TBL.sh _sc_dh clm_std^nl_urb 20030101:3600 4x5 gx3v7 -6 arb_ic ........................FAIL! rc= 7 -008 blTZ1 TBL.sh 21p_cncrpsc_dh clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 7 -011 blD91 TBL.sh _persc_dh clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 7 -015 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:1800 1.9x2.5 gx1v6@1850-2100 -10 cold FAIL! rc= 7 -018 brW51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -019 blW51 TBL.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -5 cold .................FAIL! rc= 7 -020 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 (bluefire compiler error) -021 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -3+-7 cold ................FAIL! rc= 5 (bluefire compiler error) -022 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -5+-5 cold ................FAIL! rc= 5 (bluefire compiler error) -023 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 (bluefire compiler error) -027 blHo1 TBL.sh 17p_cnsc_dh clm_drydep 20000101:1800 10x15 USGS@2000 -10 cold ..................FAIL! rc= 7 (bluefire compiler error) -028 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 (bluefire compiler error) -029 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -3+-7 arb_ic ............FAIL! rc= 5 (bluefire compiler error) -030 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -5+-5 arb_ic ............FAIL! rc= 5 (bluefire compiler error) -031 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 (bluefire compiler error) -032 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 96 cold ...............FAIL! rc= 4 (bluefire compiler error) -033 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 5 (bluefire compiler error) -034 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 5 (bluefire compiler error) -035 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 4 (bluefire compiler error) -036 smU61 TSM.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -6 cold ......FAIL! rc= 10 (bluefire compiler error) -037 erU61 TER.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 10+38 cold ...FAIL! rc= 5 (bluefire compiler error) -038 brU61 TBR.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 -3+-3 cold ...FAIL! rc= 5 (bluefire compiler error) -039 blU61 TBL.sh 21p_cndvcrpsc_dh clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6 48 cold ......FAIL! rc= 4 (bluefire compiler error) - bluefire interactive testing: -008 blC97 TBL.sh _sc_do clm_spin^nl_urb 20030101:1800 4x5 gx3v7@1850 -6 arb_ic ..................FAIL! rc= 7 -012 blHS3 TBL.sh 17p_cnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .....FAIL! rc= 7 -016 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic ...............FAIL! rc= 7 -020 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:3600 1x1_mexicocityMEX navy 158 arb_ic ....FAIL! rc= 5 -024 blJ74 TBL.sh 4p_casasc_ds clm_std^nl_urb 10001230:3600 1x1_tropicAtl test -100 arb_ic .......FAIL! rc= 7 -028 blCA8 TBL.sh _sc_ds clm_std^nl_urb 20021230:3600 1x1_asphaltjungleNJ navy -90 arb_ic ........FAIL! rc= 7 -029 smCK4 TSM.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -10 cold ...............FAIL! rc= 10 -030 erCK4 TER.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 5 -031 brCK4 TBR.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 5 -032 blCK4 TBL.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -10 cold ...............FAIL! rc= 4 -033 smCK8 TSM.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -10 cold ...........FAIL! rc= 10 -034 erCK8 TER.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 5 -035 brCK8 TBR.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 5 -036 blCK8 TBL.sh _sc_ds clm_nortm^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 -042 blF93 TBL.sh 17p_sc_do clm_std^nl_voc 20021230:1800 4x5 gx3v7 48 cold .......................FAIL! rc= 5 -046 blC83 TBL.sh _sc_do clm_std^nl_urb 20020115:3600 5x5_amazon navy -10 arb_ic .................FAIL! rc= 7 -054 blC63 TBL.sh _sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ........................FAIL! rc= 5 -058 blHQ4 TBL.sh 17p_cnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -150 cold ............FAIL! rc= 5 -062 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 7 -066 bl514 TBLtools.sh gen_domain tools__ds T31.runoptions .......................................FAIL! rc= 5 -075 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -076 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -083 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 7 -085 bl953 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 ..............................FAIL! rc= 7 -090 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -091 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 4 -092 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -093 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 4 -094 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 -095 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 4 - bluefire/CESM testing: All PASS except, compare_hist -FAIL SMS_RLA.f45_f45.I.bluefire - bug 1459 -FAIL SMS_RLB.f45_f45.I.bluefire - bug 1459 -FAIL SMS_ROA.f45_f45.I.bluefire - bug 1459 - bluefire/PTCLM testing: All FAIL - lynx/pgi: All PASS except... -004 blC92 TBL.sh _sc_dm clm_std^nl_urb 20030101:3600 4x5 gx3v7 -6 arb_ic ........................FAIL! rc= 7 -007 blD92 TBL.sh _persc_dm clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 7 -011 blF92 TBL.sh 17p_sc_dm clm_std^nl_voc 20021230:1800 4x5 gx3v7 48 cold .......................FAIL! rc= 5 -015 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 7 -019 blJ92 TBL.sh 4p_casasc_dm clm_std^nl_urb 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 7 -023 blL52 TBL.sh _sc_dm clm_std^nl_urb 20020115:1800 10x15 USGS 48 arb_ic .......................FAIL! rc= 7 - lynx/pgi interactive testing: All PASS except.. -008 blTZ3 TBL.sh 21p_cncrpsc_do clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 7 -009 smCL4 TSM.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 10 -010 erCL4 TER.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 5 -011 brCL4 TBR.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 5 -012 blCL4 TBL.sh _sc_ds clm_nortm^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 4 -016 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic ...............FAIL! rc= 7 -020 blOC4 TBL.sh _vansc_ds clm_urb1pt^nl_urb 19920812:3600 1x1_vancouverCAN navy 331 arb_ic .....FAIL! rc= 5 -024 blNB4 TBL.sh _mexsc_ds clm_urb1pt^nl_urb 19931201:3600 1x1_mexicocityMEX navy 158 arb_ic ....FAIL! rc= 5 -025 sm978 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds .....FAIL! rc= 6 -026 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -027 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 - mirage,storm/ifort interactive testing: -007 blD94 TBL.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 7 -011 blCA4 TBL.sh _sc_ds clm_std^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic ...............FAIL! rc= 7 -015 blCA8 TBL.sh _sc_ds clm_std^nl_urb 20021230:3600 1x1_asphaltjungleNJ navy -90 arb_ic ........FAIL! rc= 7 -019 blL54 TBL.sh _sc_ds clm_std^nl_urb 20020115:1800 10x15 USGS 48 arb_ic .......................FAIL! rc= 7 -023 blR53 TBL.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:1800 10x15 USGS@1850 48 cold ............FAIL! rc= 7 - jaguarpf: Currently NOT available: - edinburgh: Currently not supported - -CLM tag used for the baseline comparison tests if applicable: clm4_0_38 - -=============================================================== -=============================================================== -Tag name: clm4_0_38 -Originator(s): erik (Erik Kluzek) -Date: Mon Jan 23 13:56:45 MST 2012 -One-line Summary: Fix some minor issues with tools, add high resolution option and -datasets to mksurfdata, remove crap from clmtype so C13 will work on bluefire, convert -nans to FillValue for some cases, fix datasets, update doc - -Purpose of changes: - -Update externals to new version of scripts/Machines. Fix some bugs. Add in maps for: -ne4np4, ne16np4, ne60np4, and ne240np4 resolutions. Begin adding _FillValue/missing_value -to restart files. Start adding in new high-resolution datasets for mksurfdata. Add an -option to mksurfdata.pl to run at hi-res let default be standard half-degree datasets. -Add in 3x3min PFT dataset for 2000, and 5x5min organic. Add in maps for 3x3min and -5x5min_ISRIC_WISE to output grids. Separate out wetland and lake datasets, add in 3x3min -lake dataset. Get mksurfdata to work with T31, fix maps. Have both mksurfdata_map and clm -check files for consistencies. Add initial version of a script to check that maps in the -XML database are correct. Make sure keywords are set in tools, and OPT correctly added to -meta-data. Update gen_domain. Correct some typo's in filenames. Remove some unused data -in clmtype.F90. Update documentation to cesm1_0_4. - -Requirements for tag: - Testing on bluefire-only, Fix bugs: 1432 (part X), 1424X, 1423X, 1401 (part)X, 1309, - mksurfdata works at regular and hi-res and for f09, and at regular for: 128x256, - 512x1024, ne4np4, ne16np4, ne30np4, ne60np4, and ne240np4 resolutions, T31 and T31 - mksurfdata rcp's work - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): - 1432 (Several resolutions fail for new mksurfdata_map) - 1424 (variables written out as gdir) - 1423 (Problem building clmtype on bluefire) - 1398 (clm and mksurfdata_map needs to check map files -- partial) - -Known bugs (include bugzilla ID): - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1404 (Inconsistent domain and fatmlndfrc files) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1468 (Bad f09, f19 SCRIP Grid files) - 1476 (Problem with stand-alone build on bluefire) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Correct and add new mapping datasets and datasets for mksurfdata_map - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): most - - scripts to scripts4_111108 - Machines to Machines_111101 - drv to drvseq4_0_08 - cism to cism1_111004 - csm_share to share3_111027 - timing to timing_111101 - MCT to MCT2_7_0-111101 - pio to pio1_3_12 - -List all files eliminated: None - -List all files added and what they do: - - A models/lnd/clm/test/system/config_files/_scnv_ds - Add serial option - A models/lnd/clm/bld/namelist_files/checkmapfiles.ncl - check that map files - are consistent - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/input_tests_master - Add serial irrig test - - M models/lnd/clm/test/system/test_driver.sh ----- Fix issues on bluefire, - update some paths on edinburgh - ->>>>>>>>>>>>>> Update documentation - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/special_cases.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/KnownBugs - ->>>>>>>>>>>>>> Get svn keywords set on tools, and make sure OPT is set - M models/lnd/clm/tools/mkmapdata/mvNimport.sh -------- Fix syntax error - M models/lnd/clm/tools/mkmapdata/mkmapdata.sh -------- Add in 3x3 grid and ISRIC-WISE - mask, add option to build ocean-land mask, and large-file format option, - M models/lnd/clm/tools/interpinic/src/interpinic.F90 - Fix svn keywords - M models/lnd/clm/tools/interpinic/src/Makefile ------- Set OPT CPP if OPT=TRUE - M models/lnd/clm/tools/mkgriddata/src/Makefile ------- Set OPT CPP if OPT=TRUE - M models/lnd/clm/tools/mkdatadomain/src/Makefile ----- Set OPT CPP if OPT=TRUE - M models/lnd/clm/tools/mkmapgrids/src/mkmapgrids.F90 - Add more meta-data - M models/lnd/clm/tools/mkmapgrids/src/Makefile-------- Set OPT CPP if OPT=TRUE - ->>>>>>>>>>>>>> Add call to domain_checksame to check if domains are the same, ->>>>>>>>>>>>>> split lake and wetland processing, add write statment for each file ->>>>>>>>>>>>>> opened, add -hires and -allownofile options to mksurfdata.pl - M models/lnd/clm/tools/mksurfdata_map/src/mkglcmecMod.F90 ---- Use domain_checksame - M models/lnd/clm/tools/mksurfdata_map/src/mkvarctl.F90 ------- Split lake/wetland - M models/lnd/clm/tools/mksurfdata_map/src/mkvocefMod.F90 ----- Use domain_checksame - M models/lnd/clm/tools/mksurfdata_map/src/mklaiMod.F90 ------- Use domain_checksame - M models/lnd/clm/tools/mksurfdata_map/src/mksoilMod.F90 ------ Use domain_checksame - increase kmap_max_min from 50 to 90 (so T31 can be run) - M models/lnd/clm/tools/mksurfdata_map/src/mkdomainMod.F90 ---- Add domain_checksame, - make domain_init private, add metadata if frac/mask set, eliminate - lats/n,lone/w, use call abort in place of stop, - M models/lnd/clm/tools/mksurfdata_map/src/mksurfdat.F90 ------ Split lake/wetland - remove documentation on specific datasets, increase allowed sum of special - landunits from 120 to 250 - M models/lnd/clm/tools/mksurfdata_map/src/mkurbanparMod.F90 -- Use domain_checksame - M models/lnd/clm/tools/mksurfdata_map/src/mkharvestMod.F90 --- Use domain_checksame - M models/lnd/clm/tools/mksurfdata_map/src/mkfileMod.F90 ------ Fix meta-data, - remove lats/n,lone/w - M models/lnd/clm/tools/mksurfdata_map/src/mkgridmapMod.F90 --- Add headers, more - checking, add gridmap_setptrs method private gridmap_checkifset method, - - M models/lnd/clm/tools/mksurfdata_map/src/mklanwatMod.F90 ---- Split mklanwat - into mklakwat/mkwetlnd subroutines, use domain_checksame, - M models/lnd/clm/tools/mksurfdata_map/src/Makefile ----------- Set OPT CPP if OPT=TRUE - M models/lnd/clm/tools/mksurfdata_map/src/mkpftMod.F90 ------- Use domain_checksame - M models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl ---------- Add -hires and - -allownofile options, split lake and wetland - - -allownofile Allow the script to run even if one of the input files - does NOT exist. - -hires If you want to use high-resolution input datasets rather than the default - lower resolution datasets (low resolution is typically at half-degree) - - M models/lnd/clm/tools/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt Use $CSMDATA - directory path rather than /cgd/tss path - M models/lnd/clm/tools/mksurfdata_map/mksurfdata_map.namelist Split lake and wetland - ->>>>>>>>>>>>>> Minor changes - M models/lnd/clm/bld/build-namelist --------- Move groups earlier, start adding - code to handle lnd_inst_counter - M models/lnd/clm/bld/listDefaultNamelist.pl - Get rcp list sooner - ->>>>>>>>>>>>>> Fix some filename typos, add new mapping files, add hi-res ->>>>>>>>>>>>>> datasets - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ------ Add - ne4np4, ne16np4, ne60np4, ne240np4 mapping files - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Correct - some typo's in filenames (ne4np4 scripgrid, ngwh mksurfdata pftdyn file - for rcp 6 for year 2006 - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Add mksrf_filename, - correct mksrf_* filenames to mksrf_f*, add ISRIC-WISE lmask - M models/lnd/clm/bld/namelist_files/datm-build-namelist ------- Only require - datm_data_dir for CPLHIST3HrWx - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Add ISRIC-WISE, - 3x3min_MODIS mapping datasets, correct some map dataset names, - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl ----- Add more data - to output table - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml Correct and - add new scrip grid files, add hires option for some data, add - mksrf_filename for types of files, add in all mksurfdata raw - datasets, add new hires datasets, correct mksrf_fvegtyp filenames, - ->>>>>>>>>>>>>> Remove initialization of unused data types (allows C13 on bluefire) ->>>>>>>>>>>>>> Add option to convert nan to fillvalue on output files ->>>>>>>>>>>>>> (and vica-versa on input) - M models/lnd/clm/src/main/clmtypeInitMod.F90 - Remove initialization of unused - data types - M models/lnd/clm/src/main/clm_atmlnd.F90 ----- Remove unused pdf variable - M models/lnd/clm/src/main/initSurfAlbMod.F90 - Remove unused CNZeroFluxes - M models/lnd/clm/src/main/ncdio_pio.F90 ------ Add cnvrtnan2fill option - to convert from spval to nan on read and from nan to spval on write - M models/lnd/clm/src/main/clmtype.F90 -------- Remove unused variables - M models/lnd/clm/src/main/histFldsMod.F90 ---- Add some documentation, change - longname of QSOIL, correct: CISUN, CISHA, ALPHAPSNSUN, ALPHAPSNSHA - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 - - -Summary of testing: - - bluefire testing: -018 brX51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -020 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -021 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -3+-7 cold ................FAIL! rc= 5 -022 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -5+-5 cold ................FAIL! rc= 5 -023 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -028 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -029 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -3+-7 arb_ic ............FAIL! rc= 5 -030 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -5+-5 arb_ic ............FAIL! rc= 5 -031 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -032 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 96 cold ...............FAIL! rc= 4 -033 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 5 -034 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 5 -035 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 4 - bluefire interactive testing: All PASS except... -031 erAK4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 7 -032 brAK4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 6 -036 brAK8 TBR.sh _nrsc_ds clm_std^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 6 -037 blAK8 TBL.sh _nrsc_ds clm_std^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 -067 bl5@4 TBLtools.sh gen_domain tools__ds namelist .............................................FAIL! rc= 7 -003 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -004 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -008 bl954 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......FAIL! rc= 6 -011 sm974 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -012 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 4 -013 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -014 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 4 -015 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 -016 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 4 - bluefire/CESM testing: All PASS except... (compare tests fail because clm4_0_37 file did not exist) - -CLM tag used for the baseline comparison tests if applicable: clm4_0_37 - -=============================================================== -=============================================================== -Tag name: clm4_0_37 -Originator(s): erik (Erik Kluzek) -Date: Mon Sep 26 10:35:24 MDT 2011 -One-line Summary: Fix unstructured grids history files - -Purpose of changes: - -Comment out code for writing out fine-mesh lat/lon for unstructured grids. This caused -the code to blow up when running for HOMME grids such as ne30np4. - -Bugs fixed (include bugzilla ID): - 1415 (History files can't be written out for HOMME grids) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1398 (clm and mksurfdata_map needs to check map files for consistency) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1404 (Inconsistent domain and fatmlndfrc files) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1423 (Problem building clmtype on bluefire) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/src/main/histFileMod.F90 - Comment out code for fine-mesh - lat/lon for unstructured grids - -Summary of testing: None! - -CLM tag used for the baseline comparison tests if applicable: clm4_0_36 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_36 -Originator(s): erik (Erik Kluzek) -Date: Thu Sep 22 11:05:59 MDT 2011 -One-line Summary: Comment out RTM mapping files for f09 and f19 - -Purpose of changes: - -Comment out the RTM mapping files for f09/f19 so answers are the same as clm4_0_34 and as the f19 mapping -files cause the fully coupled model to blow up in POP. Add "mv" option to mksurfdata.pl and make -nomv the -default so it doesn't try to copy files by default. Increase length of filename strings for mksurfdata pftdyn -files. Add some metadata for some restart file variables. Add "new good wood harvest" datasets -and option (-new_woodharv) to mksurfdata.pl from Peter Lawrence so can make surface -datasets with either set of files. New good wood harvest applies to rcp6 and rcp8.5. -Also add in some new mapping files for: 512x1024,128x256,64x128,32x64,8x16,0.23x0.31,5x5_amazon. -Add SCRIP grid files for: ne4np4,ne16np4, ne60np4, ne240np4. Add 3x3min resolution -and 3x3min SCRIP grid file which will be used for high resolution surface dataset -creation in the future. Use new surface datasets with old fatmgrid values for f09_g16 -for 1850 and 2000 so that answers can be identical to clm4_0_34 without requiring the -fatmgrid file. - -Bugs fixed (include bugzilla ID): - 1414 (Answers change @ f09 resolution w/o fatmgrid file) - 1413 (re is in incorrect units in mksurfdata_map) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1398 (clm and mksurfdata_map needs to check map files for consistency) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1404 (Inconsistent domain and fatmlndfrc files) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1415 (History files can't be written out for HOMME grids) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Comment out RTM mapping files for f09/f19 - Also new mapping files for: 512x1024,128x256,64x128,32x64,8x16,0.23x0.31,5x5_amazon. - Add SCRIP grid files for: ne4np4,ne16np4, ne60np4, ne240np4. - Add 3x3min SCRIP grid file. - New surface datasets with old fatmgrid grid coordinate values for f09/1850/2000 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/tools/mksurfdata_map/src/mksurfdat.F90 -------------- Increase pftdyn file length to 135 - M models/lnd/clm/tools/mksurfdata_map/src/mkfileMod.F90 -------------- Increase nchar dim to 256 - M models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl ------------------ Add "mv" option with "nomv" the default - M models/lnd/clm/tools/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt - Increse length of strings for files - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Add 3x3min, - ne4np4,ne16np4, ne60np4, ne240np4 as valid resolutions - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Comment out f09/f19 RTM mapping files - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Add new - good wood harvest pftdyn input files from Peter Lawrence for mksurfdata_map - for rcp6 and rcp8.5 - - M models/lnd/clm/src/biogeochem/CNrestMod.F90 --------- Add some FillValue to some fields for restart files - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 - Add some FillValue to some fields for restart files - -Summary of testing: - - bluefire interactive testing: Following PASS -001 sm754 TSMtools.sh mksurfdata_map tools__s namelist ..........................................PASS -003 sm953 TSMscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 ..............................PASS -005 sm954 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......PASS -007 sm9S4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................PASS -008 bl9S4 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................PASS - bluefire/CESM testing: All PASS except (compare to clm4_0_34) -CFAIL ERS_E.T31_g37.I1850.bluefire.GC.125250 (ESMF doesn't work with NetCDF4) -BFAIL ERB.ne30_g16.I_1948-2004.bluefire.compare.clm4_0_34 (ne30 wasn't in clm4_0_34) (answers are identical to clm4_0_35) -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_34 (I1850SPINUPCN wasn't in clm4_0_34 or before) -FAIL NCK.f10_f10.I.bluefire -- scripts needs to cleannamelist after changing NINST_LND - bluefire extra CESM testing: Following PASS -PASS ERS.f09_g16.ICN.bluefire -PASS ERS.f09_g16.ICN.bluefire.generate.clm4_0_36 -PASS ERS.f09_g16.ICN.bluefire.compare_hist.clm4_0_33 -PASS ERS.f09_g16.ICN.bluefire.compare.clm4_0_33 -PASS ERS.f09_g16.I1850CN.bluefire -PASS ERS.f09_g16.I1850CN.bluefire.generate.clm4_0_36 -PASS ERS.f09_g16.I1850CN.bluefire.compare_hist.clm4_0_33 -PASS ERS.f09_g16.I1850CN.bluefire.compare.clm4_0_33 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_35 - -Changes answers relative to baseline: f09/f19 now same as clm4_0_34 - -=============================================================== -=============================================================== -Tag name: clm4_0_35 -Originator(s): erik (Erik Kluzek), mvertens -Date: Tue Sep 13 22:15:17 MDT 2011 -One-line Summary: Bring in Mariana's non2D grid branch to trunk, enabling HOMME grids: ne30np4/ne120np4 - -Purpose of changes: - -Move Mariana's new non-2D branch to trunk. Extensive changes to mksurfdata, allows 1D-vector surface -datasets. Mariana change mksurfdata to add unstructured grid format using SCRIP weights. Won't work -with PTCLM and mksurfdata won't be able to create single-pt/regional surface datasets. Fix reverse -coordinates on VOC/irrig mksurfdata input file. Update scripts and datm with HOMME grids. Add in -half-degree pftdyn historical dataset. Partial fix to PTSMODE restart problem. Fix the US-UMB data for PTCLM. - -NOTE: File creation process is changed substantially! mksurfdata now requires mapping files to be created first - in order to run the new mksurfdata_map. This means you need to do the following: - - 1.) run mkgriddata - 2.) run mkmapgrid (add files to XML database) (requires 1) - 3.) run mkmapdata (add files to XML database) (requires 2) - 4.) run mksurfdata_map (requires 3) - 5.) run gen_domain (requires 3 needed for datm) - - See the models/lnd/clm/tools/README file for more help on the process. - -WARNING: YOU CAN'T CREATE SINGLE-POINT DATASETS WITH THIS VERSION! You can create frac/grid files with this - version and then use an older verison of clm to use mksurfdata to create surface datasets. The mapping - for single-point datasets using ESMF does NOT work -- although it does work if you have at least 4 points - so you can create regional datasets. - - THIS MEANS PTCLM DOES NOT WORK FOR CREATING NEW DATASETS! It will work for datasets already created however. - -CAUTION: Mapping files to allow mksurfdata to work are only provided for: f09, f19, f10, T31, f45, f25, ne30 and ne120 - -Bugs fixed (include bugzilla ID): - 1392 (US-UMB site has some incorrect data) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1393 (error when running Gregorian calendar) - 1397 (c2l_scale_type not specified for many history fields) - 1398 (clm and mksurfdata_map needs to check map files for consistency) - 1401 (Restart files do NOT have _FillValue/missing_value attributes on fields) - 1404 (Inconsistent domain and fatmlndfrc files) - 1405 (Problem with irrigation on clm4_0_34 with intel compiler) - 1407 (Build problem on jaguar for test_driver.sh with -c option) - 1409 (ne120 is having restart trouble on jaguar with NetCDF3) - 1410 (Problem running PST.f09_g16.I.jaguarpf) - 1411 (ERI_D.ne30_g16.I1850CN.jaguarpf.G.235924 fails on jaguarpf) - 1413 (re is in incorrect units in mksurfdata_map) - 1414 (Answers change @ f09 resolution w/o fatmgrid file) - 1415 (History files can't be written out for HOMME grids) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - Can now read in domain files in place of fatmlndfrac - fatmgrid no longer required (use fsurdat to get grid) - fmapinp_rtm new namelist item to give mapping for RTM - -List any changes to the defaults for the boundary datasets: - - Add: ne30np4/ne120np4 datasets, add 1850-2000 0.47x0.63 fpftdyn file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, mvertens, sacks - -List any svn externals directories updated (csm_share, mct, etc.): scripts, csm_share, datm - - scripts to scripts4_110906 - csm_share to share3_110906 - datm to datm8_110908 - -List all files eliminated: - ->>>>>>>>>>>> Rename mksurfdata to mksurfdata_map - D models/lnd/clm/tools/mksurfdata/* - ->>>>>>>>>>>> Move source code to src subdirectory - D models/lnd/clm/tools/mkdatadomain/Mkdepends/Srcfiles/Filepath/Makefile/*.F90 - D models/lnd/clm/tools/mkgriddata/Mkdepends/Srcfiles/Filepath/Makefile/*.F90 - D models/lnd/clm/tools/interpinic/Mkdepends/Srcfiles/Filepath/Makefile/*.F90 - -List all files added and what they do: - ->>>>>>>>>>>> Rename mksurfdata to mksurfdata_map, create src sub-directory - A models/lnd/clm/tools/mksurfdata_map - A models/lnd/clm/tools/mksurfdata_map/mksurfdata.pl - A models/lnd/clm/tools/mksurfdata_map/mksurfdata_map.namelist - A models/lnd/clm/tools/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt - A models/lnd/clm/tools/mksurfdata_map/README - A models/lnd/clm/tools/mksurfdata_map/src - A models/lnd/clm/tools/mksurfdata_map/src/clm_varctl.F90 - A models/lnd/clm/tools/mksurfdata_map/src/clm_varpar.F90 - A models/lnd/clm/tools/mksurfdata_map/src/Filepath - A models/lnd/clm/tools/mksurfdata_map/src/fileutils.F90 - A models/lnd/clm/tools/mksurfdata_map/src/Macros.custom - A models/lnd/clm/tools/mksurfdata_map/src/Makefile - A models/lnd/clm/tools/mksurfdata_map/src/Mkdepends - A models/lnd/clm/tools/mksurfdata_map/src/mkdomainMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkfileMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkglcmecMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkgridmapMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkharvestMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mklaiMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mklanwatMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkncdio.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkpftMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mksoilMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mksurfdat.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkurbanparMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkvarctl.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkvarpar.F90 - A models/lnd/clm/tools/mksurfdata_map/src/mkvocefMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/nanMod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_const_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_file_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_kind_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_log_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_string_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_sys_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/shr_timer_mod.F90 - A models/lnd/clm/tools/mksurfdata_map/src/Srcfiles - ->>>>>>>>>>>> Scripts to use ESMF to create SCRIP mapping files from SCRIP grid files - A models/lnd/clm/tools/mkmapdata - A models/lnd/clm/tools/mkmapdata/mkmapdata.sh - A models/lnd/clm/tools/mkmapdata/mvNimport.sh - A models/lnd/clm/tools/mkmapdata/README - A models/lnd/clm/tools/mkmapdata/regridbatch.sh - A models/lnd/clm/tools/mkmapdata/rmdups.ncl ----- NCL script to remove duplicates - ->>>>>>>>>>>> Program to create SCRIP grid files from CLM grid/frac files - A models/lnd/clm/tools/mkmapgrids - A models/lnd/clm/tools/mkmapgrids/mkmapgrids.csh - A models/lnd/clm/tools/mkmapgrids/mkmapgrids.namelist - A models/lnd/clm/tools/mkmapgrids/README - A models/lnd/clm/tools/mkmapgrids/src - A models/lnd/clm/tools/mkmapgrids/src/domainMod.F90 - A models/lnd/clm/tools/mkmapgrids/src/Filepath - A models/lnd/clm/tools/mkmapgrids/src/Macros.custom - A models/lnd/clm/tools/mkmapgrids/src/Makefile - A models/lnd/clm/tools/mkmapgrids/src/Mkdepends - A models/lnd/clm/tools/mkmapgrids/src/mkmapgrids.F90 - A models/lnd/clm/tools/mkmapgrids/src/nanMod.F90 - A models/lnd/clm/tools/mkmapgrids/src/shr_file_mod.F90 - A models/lnd/clm/tools/mkmapgrids/src/shr_kind_mod.F90 - A models/lnd/clm/tools/mkmapgrids/src/shr_log_mod.F90 - A models/lnd/clm/tools/mkmapgrids/src/shr_sys_mod.F90 - A models/lnd/clm/tools/mkmapgrids/src/Srcfiles - ->>>>>>>>>>>> Programs to postprocess 1D vector unstructured grids - A models/lnd/clm/tools/mkprocdata_map - A models/lnd/clm/tools/mkprocdata_map/camhomme - A models/lnd/clm/tools/mkprocdata_map/camhomme/mkprocdata_map_in - A models/lnd/clm/tools/mkprocdata_map/camhomme/src - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/Depends - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/domainMod.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/Filepath - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/fileutils.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/gridmapMod.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/Makefile - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/mkprocdata_map.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/nanMod.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/shr_file_mod.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/shr_kind_mod.F90 - A models/lnd/clm/tools/mkprocdata_map/camhomme/src/Srcfiles - A models/lnd/clm/tools/mkprocdata_map/clm - A models/lnd/clm/tools/mkprocdata_map/clm/mkprocdata_map_all - A models/lnd/clm/tools/mkprocdata_map/clm/mkprocdata_map_in - A models/lnd/clm/tools/mkprocdata_map/clm/mkprocdata_map_wrap - A models/lnd/clm/tools/mkprocdata_map/clm/README - A models/lnd/clm/tools/mkprocdata_map/clm/src - A models/lnd/clm/tools/mkprocdata_map/clm/src/constMod.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/Filepath - A models/lnd/clm/tools/mkprocdata_map/clm/src/fileutils.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/fmain.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/gridmapMod.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/Makefile - A models/lnd/clm/tools/mkprocdata_map/clm/src/Mkdepends - A models/lnd/clm/tools/mkprocdata_map/clm/src/mkprocdata_map.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/nanMod.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/shr_file_mod.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/shr_kind_mod.F90 - A models/lnd/clm/tools/mkprocdata_map/clm/src/Srcfiles - ->>>>>>>>>>>> Make macros files to customize how tools operate (allows all tools to have an identical Makefile) - A models/lnd/clm/tools/interpinic/src/Macros.custom - A models/lnd/clm/tools/mkgridata/src/Macros.custom - A models/lnd/clm/tools/mkdomaindata/src/Macros.custom - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Add tests for new grids/tools - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_pretag_jaguarpf - M models/lnd/clm/test/system/tests_posttag_mirage - M models/lnd/clm/test/system/tests_posttag_intrepid - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/README.testnames --------------- 4/5=mkmapgrids/gen_domain config - I=CN spinup, @=ne120np4, #=ne30np4, *=ne16np4 run options - ->>>>>>>>>>>> Change build/run for tools, update netcdf on bluefire, update modules on jaguar, add new tests - M models/lnd/clm/test/system/TCB.sh ------------- Remove setting of MACFILE not needed - M models/lnd/clm/test/system/TCBtools.sh -------- Add src directory, Mkdepends, Macros.custom - M models/lnd/clm/test/system/TBLscript_tools.sh - Set CLM_ROOT - M models/lnd/clm/test/system/TBLtools.sh -------- Set CLM_ROOT - M models/lnd/clm/test/system/TBL.sh ------------- Allow compile-only mode to work - M models/lnd/clm/test/system/TSM.sh ------------- Handle multi-instance rpointer files - M models/lnd/clm/test/system/test_driver.sh -- Get netcdf4.1.3 working on bluefire, get mirage build working, - use glade paths, add ESMFBIN_PATH, update jaguar modules - M models/lnd/clm/test/system/input_tests_master - Fill out HM tests, add H#, H@, blJ07, 454, 5@4, 9#2, 953 - tests, mksurfdata=>mksurfdata_map - M models/lnd/clm/test/system/nl_files/clm_spin -- Change case to agree with 1850 MOAR case in CESM scripts - M models/lnd/clm/test/system/nl_files/mksrfdt_10x15_irr_1850 ------------ Remove -nomv option - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_vancouverCAN_2000 ----- Remove -nomv option - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_numaIA_mp20irrcr_2000 - Remove -nomv option - ->>>>>>>>>>>> Run interpinic and checkin the result - M models/lnd/clm/tools/interpinic/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c100322.nc - ->>>>>>>>>>>> Update to glade path, add notes on src subdirectory - M models/lnd/clm/tools/interpinic/README ------------------ Add notes about src subdirectory - M models/lnd/clm/tools/mkgriddata/mkgriddata.namelist ----- Use glade path - M models/lnd/clm/tools/mkgriddata/mkgriddata.regional ----- Use glade path - M models/lnd/clm/tools/mkgriddata/mkgriddata.singlept ----- Use glade path - M models/lnd/clm/tools/mkgriddata/mkgriddata.cesm_dom ----- Use glade path - M models/lnd/clm/tools/mkgriddata/README ------------------ Update with added src sub-directory - M models/lnd/clm/tools/mkdatadomain/mkdatadomain.namelist - Use glade path - M models/lnd/clm/tools/mkdatadomain/README ---------------- Add notes about src subdirectory - ->>>>>>>>>>>> Update tools README information - M models/lnd/clm/tools/README.testing ------ Note about src subdirectory required - M models/lnd/clm/tools/README -------------- Updated with notes on new process - M models/lnd/clm/tools/README.filecopies --- Notes on list of file copies has changed - ->>>>>>>>>>>> Changes to tools source codes moved to src subdirectories, Makefile was standardized ->>>>>>>>>>>> update shr_sys_mod.F90 file to latest csm_share - M models/lnd/clm/tools/interpinic/src/interpinic.F90 --- Add metadata on OPT and OMP - M models/lnd/clm/tools/interpinic/src/Makefile --------- Standardize - M models/lnd/clm/tools/interpinic/src/shr_sys_mod.F90 -- Update - M models/lnd/clm/tools/mkdatadomain/src/Makefile ------- Standardize - M models/lnd/clm/tools/mkdatadomain/src/Filepath ------- Only use local directory - M models/lnd/clm/tools/mkgriddata/src/Makefile --------- Standardize - M models/lnd/clm/tools/mkgriddata/src/shr_sys_mod.F90 -- Update - M models/lnd/clm/tools/mkgriddata/src/clm_varctl.F90 --- Update - ->>>>>>>>>>>> Add RTM mapping file, change some namelist file required logic - M models/lnd/clm/bld/listDefaultNamelist.pl - Also get RTM mapping file, and use $CSMDATA if set - M models/lnd/clm/bld/build-namelist --------- If can't find a frac file use the datm domain file, only - get fatmgrid file for fine-mesh, if RTM on get mapping file, if fine-mesh on and fatmgrid not found - use fsurdat file - M models/lnd/clm/bld/clm.cpl7.template ------ Clarify documentation for CLM_RTM_RES - ->>>>>>>>>>>> Add new files needed for ne30np4/ne120np4 and processing of them - M models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl --------- Add test for more resolutions - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ---- Add: fmapinp_rtm, scripgriddata, mksrf_fglctopo, - map, lmask, hgrid - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- Add: ne30np4/ne120np4 datasets, add - 1850-2000 0.47x0.63 fpftdyn file, remove some of the single-point fatmlndgrd files, add mapping files, - add lmask/hgrid for different map types - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Add ne30np4/ne120np4 domain files - ->>>>>>>>>>>> Use llatlon structure in place of lsmlat/lsmlon, required files a bit different, use fsurdat if ->>>>>>>>>>>> fatmgrid is not given, add RTM mapping file, if fatmlndfrc NOT set set mask/frac to 1. - M models/lnd/clm/src/biogeochem/CASAMod.F90 ------------ Use llatlon%ni/nj in place of lsmlon/lat - don't allow 1D grids for CASA - M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 - Use llatlon structure in place of lsmlon/lat - M models/lnd/clm/src/biogeochem/CNDVMod.F90 ------------ Use llatlon structure in place of lsmlon/lat - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 ---------- asca => ascale - M models/lnd/clm/src/main/organicFileMod.F90 ----------- Use llatlon structure in place of lsmlon/lat - M models/lnd/clm/src/main/clm_varpar.F90 --------------- Remove lsmlon/lsmlat parameters - M models/lnd/clm/src/main/clm_timemanager.F90 ---------- Add some meta-data to restart file, check restart values - M models/lnd/clm/src/main/clm_initializeMod.F90 -------- Remove cellarea, surfrd gets area - M models/lnd/clm/src/main/fileutils.F90 ---------------- Make iflag required argument - M models/lnd/clm/src/main/ndepStreamMod.F90 ------------ Use llatlon structure in place of lsmlon/lat - M models/lnd/clm/src/main/iniTimeConst.F90 ------------- Remove start/count lsmlon/lsmlat - M models/lnd/clm/src/main/histFileMod.F90 -------------- Add namea grid, replace lsmlon/lat with llatlon - handle unstructured grids - M models/lnd/clm/src/main/controlMod.F90 --------------- If fatmgrid NOT set, use fsurdat, add fmapinp_rtm - if fatmlndfrc NOT set, set mask/frac to 1. - M models/lnd/clm/src/main/clm_varctl.F90 --------------- Add fmapinp_rtm - M models/lnd/clm/src/main/ncdio_pio.F90 ---------------- Add ncd_inqfdims, io_type public, clmlevel set - earlier, remove switchdim from ncd_io_int_var2, handle switchdim in ncd_io_real_var2 read for - singlept - M models/lnd/clm/src/main/surfrdMod.F90 ---------------- Remove surfrd, add surfrd_get_data hande 1D grids - M models/lnd/clm/src/main/domainMod.F90 ---------------- asca=>ascale - M models/lnd/clm/src/main/decompMod.F90 ---------------- Add namea remove get_clmlevel_dsize - M models/lnd/clm/src/main/clmtype.F90 ------------------ Increase len=8 to len=16 - M models/lnd/clm/src/riverroute/RtmMod.F90 ------------- Add L2R_Decomp, remove lsmlat/lon for llatlon - remove river meta-data - M models/lnd/clm/src/riverroute/RtmMapMod.F90 ---------- Pass in fracout - M models/lnd/clm/src/biogeophys/UrbanInputMod.F90 ------ Use llatlon in place of lsmlat/lon - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 -------- asca=>ascale - -Summary of testing: - - bluefire: All PASS except... -015 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:1800 1.9x2.5 gx1v6@1850-2100 -10 cold FAIL! rc= 7 -018 brX51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 -020 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -021 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -3+-7 cold ................FAIL! rc= 5 -022 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -5+-5 cold ................FAIL! rc= 5 -023 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -028 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -029 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -3+-7 arb_ic ............FAIL! rc= 5 -030 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -5+-5 arb_ic ............FAIL! rc= 5 -031 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -032 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 96 cold ...............FAIL! rc= 4 -033 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 5 -034 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 5 -035 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 4 - bluefire interactive testing: All PASS except... -009 blC97 TBL.sh _sc_do clm_spin^nl_urb 20030101:1800 4x5 gx3v7@1850 -6 arb_ic ..................FAIL! rc= 5 -031 erAK4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 7 -032 brAK4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 6 -036 brAK8 TBR.sh _nrsc_ds clm_std^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 6 -037 blAK8 TBL.sh _nrsc_ds clm_std^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 4 -051 blK74 TBL.sh 17p_cndvsc_s clm_std 19971231:1800 1x1_brazil navy -670 arb_ic .................FAIL! rc= 5 -004 blS63 TBL.sh _mec10sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ...................FAIL! rc= 7 -005 smQQ4 TSM.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -150 cold .............FAIL! rc= 4 -006 erQQ4 TER.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -3+-7 cold ............FAIL! rc= 5 -007 brQQ4 TBR.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -5+-5 cold ............FAIL! rc= 5 -008 blQQ4 TBL.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -150 cold .............FAIL! rc= 4 -012 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 7 -014 bl454 TBLtools.sh mkmapgrids tools__ds namelist .............................................FAIL! rc= 5 -016 bl5@4 TBLtools.sh gen_domain tools__ds namelist .............................................FAIL! rc= 5 -024 bl754 TBLtools.sh mksurfdata_map tools__s namelist ..........................................FAIL! rc= 5 -025 sm774 TSMtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 5 -026 bl774 TBLtools.sh mksurfdata_map tools__ds singlept .........................................FAIL! rc= 4 -033 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 5 -037 bl953 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 ..............................FAIL! rc= 5 -039 bl954 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ......FAIL! rc= 6 -043 bl974 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds FAIL! rc= 6 -045 bl9T4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -047 bl9C4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 - bluefire/CESM testing: All PASS except... -FAIL ERS_D.f19_g16.IGRCP26CN.bluefire.compare_hist.clm4_0_34 -FAIL ERS_D.f19_g16.IGRCP26CN.bluefire.compare.clm4_0_34 -FAIL ERP.f19_g16.IGRCP60CN.bluefire.compare_hist.clm4_0_34 -FAIL ERP.f19_g16.IGRCP60CN.bluefire.compare.clm4_0_34 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_34 -BFAIL ERB.ne30_g16.I_1948-2004.bluefire.compare.clm4_0_34 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_34 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_34 - bluefire/PTCLM testing: All PASS - lynx/pgi testing: All FAIL (build issues) - lynx/pgi interactive testing: All PASS except... -010 erAL4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 7 -011 brAL4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 6 - lynx/CESM extra testing: ... -PASS ERS.ne30_g16.I1850CN.lynx_gnu -PASS ERS.ne30_g16.I1850CN.lynx_intel -PASS ERS.ne30_g16.I1850CN.lynx_pathscale - jaguarpf: All FAIL (system build issue) - jaguarpf interactive testing: All PASS up to... -14 PTCLM.16750_US-UMB_ICN_exit_spinup.PTCLM PASS - jaguarpf/CESM testing: All PASS except... -FAIL PST.f09_g16.I.jaguarpf -FAIL ERI_D.ne30_g16.I1850CN.jaguarpf -TFAIL ERH.ne120_g16.I2000CN.jaguarpf.G.235924 - jaguarpf/CESM additional testing: ... -FAIL ERH.ne120_g16.ICN.jaguarpf -PASS SMS.ne120_g16.I.jaguarpf -FAIL ERS.ne120_g16.I.jaguarpf - edinburgh/lf95 interactive testing: All PASS except... -006 erAL4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 7 -007 brAL4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 6 -008 blAL4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 5 -025 sm978 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds .....FAIL! rc= 6 -026 sm9T4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__dFAIL! rc= 6 -027 sm9C4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds FAIL! rc= 6 - edinburgh/CESM testing: ... -PASS ERS.ne30_g16.I1850CN.edinburgh_pgi -PASS ERS.ne30_g16.I1850CN.edinburgh_lahey - edinburgh/PTCLM testing: All PASS up to... -14 PTCLM.30770_US-UMB_ICN_exit_spinup.PTCLM PASS - mirage,storm/ifort interactive testing: All PASS - -CLM tag used for the baseline comparison tests if applicable: clm4_0_34 - -Changes answers relative to baseline: - - f09_gx1v6, f19_gx1v6 are similar climate but different because of new RTM mapping files - -=============================================================== -=============================================================== -Tag name: clm4_0_34 -Originator(s): erik (Erik Kluzek) -Date: Thu Aug 18 13:14:01 MDT 2011 -One-line Summary: Bring tcens branch to trunk, fix a few issues - -Purpose of changes: - -Remove -pftlc to mksurfdata.pl. Correct units of H2OSNOTOP, HC, and HCSOI history fields. -Remove fget_archdev. Fix single point restarts from Brenden Rogers (although now there -is a PIO issue). Fix pio error when clm is running at same grid as RTM from Mariana. -Move Tony's "tcens" DART ensemble branch to trunk. Add save statement to ncdio. Have -chkdatmfiles.ncl check both grid and frac files. -Update pio/MCT/scripts/datm/PTCLM/csm_share. - -Bugs fixed (include bugzilla ID): - 1383 (Remove no-VOC and MAXPFT=4 tests) - 1381 (Can't change monthly average files to NOT be one per month) - 1372 (pio problem writing out RTM hist fields at RTM res) - 1361 (Problem with transient compsets for PTCLM) - 1358 (incorrect units for a few history fields) - 1025 (SCM mode can NOT use a global finidat file) (partial) - 1017 (SCM mode can NOT restart) (partial) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1360 (Can't do a ncdump on US-UMB data) - 1392 (US-UMB site has some incorrect data) - 1393 (error when running Gregorian calendar) - 1396 (pio problem reading 2D data with 1st dim=1) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: - Add -ninst_lnd for multiple ensembles of CLM for data assimulation to configure. - Build pio and mct as seperate libraries (add -mct_dir/pio_dir to configure). - - Set multiple instances with NINST_LND env variable in env_mach_pes.xml - (make sure NTASKS_LND is >= NINST_LND) - -Describe any changes made to the namelist: - Remove fget_archdev option (don't try to get input files from archival device). - - Set multiple instances of namelists by creating a "user_nl_clm" directory - - Inside of the directory place - - user_nl_clm ---- namelist changes to make for ALL instances - user_nl_clm_1 -- namelist changes for first instance - user_nl_clm_2 -- namelist changes for first instance - user_nl_clm_3 -- namelist changes for third instance -. -. -. - - build-namelist will create a namelist for each instance of the model being run. - -List any changes to the defaults for the boundary datasets: domain files updated - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - scripts to scripts4_110812 - drv to drvseq4_0_04 - datm to datm8_110811 - csm_share to share3_110803 - mct to MCT2_7_0_110804a - pio to pio1_3_9 - -List all files eliminated: - ->>>>>>>>>> Delete some 4p and non-VOC tests to reduce testing - D models/lnd/clm/test/system/config_files/4p_vorsc_dm - D models/lnd/clm/test/system/config_files/17p_scnv_dm - D models/lnd/clm/test/system/config_files/4p_vorsc_do - D models/lnd/clm/test/system/config_files/17p_scnv_do - D models/lnd/clm/test/system/config_files/_scnv_dh - D models/lnd/clm/test/system/config_files/4p_vorsc_ds - D models/lnd/clm/test/system/config_files/17p_scnv_ds - D models/lnd/clm/test/system/config_files/_scnv_dm - D models/lnd/clm/test/system/config_files/_scnv_do - D models/lnd/clm/test/system/config_files/17p_scnv_m - D models/lnd/clm/test/system/config_files/17p_scnv_o - D models/lnd/clm/test/system/config_files/17p_scnv_s - D models/lnd/clm/test/system/config_files/4p_vorsc_h - D models/lnd/clm/test/system/config_files/4p_vorsc_o - D models/lnd/clm/test/system/config_files/17p_nrscnv_ds - D models/lnd/clm/test/system/config_files/4p_vonrsc_ds - D models/lnd/clm/test/system/config_files/4p_vorsc_dh - D models/lnd/clm/test/system/config_files/17p_scnv_dh - -List all files added and what they do: - ->>>>>>>>>> Add tests for multi-instance - A models/lnd/clm/test/system/config_files/_nrnil3sc_dh - A models/lnd/clm/test/system/config_files/_nrnil3sc_dm - A models/lnd/clm/test/system/config_files/_nil3sc_dh - A models/lnd/clm/test/system/config_files/_nil3sc_dm - A models/lnd/clm/test/system/nl_files/multi_inst/multi_inst - A models/lnd/clm/test/system/nl_files/multi_inst/multi_inst_1 - A models/lnd/clm/test/system/nl_files/multi_inst/multi_inst_2 - A models/lnd/clm/test/system/nl_files/multi_inst/multi_inst_3 - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>> Remove old tests add new multi-instance tests in - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_posttag_kraken - M models/lnd/clm/test/system/tests_posttag_yong - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_pretag_jaguarpf - M models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi - M models/lnd/clm/test/system/tests_posttag_mirage - M models/lnd/clm/test/system/tests_posttag_intrepid_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/tests_posttag_lynx - ->>>>>>>>>> Handle clm* for multi-instance files, remove PFTDATA - M models/lnd/clm/test/system/TCB.sh -- Set pio/mct_dir in configure, send MACFILE - to make, and create clm exec temp for debug mode - M models/lnd/clm/test/system/TBL.sh --- compare clm* for multi-instance history - M models/lnd/clm/test/system/TBR.sh --- compare clm* for multi-instance history - M models/lnd/clm/test/system/TER.sh --- compare clm* for multi-instance history - M models/lnd/clm/test/system/TSMrst_tools.sh - compare clm* for multi-instance history - M models/lnd/clm/test/system/TSMpergro.sh - compare clm* for multi-instance history - M models/lnd/clm/test/system/TSMscript_tools.sh -- Remove PFTDATA setting - M models/lnd/clm/test/system/TSM.sh - compare clm* for multi-instance, cat lnd_in_000? files - M models/lnd/clm/test/system/input_tests_master -- add new multi_inst tests remove old - M models/lnd/clm/test/system/mknamelist - add quotes - M models/lnd/clm/test/system/README - Remove storm - M models/lnd/clm/test/system/README.testnames -- Add nil tests remove some 4p no-voc - M models/lnd/clm/test/system/TBLrst_tools.sh - compare clm* for multi-instance history - M models/lnd/clm/test/system/CLM_runcmnd.sh - remove storm - M models/lnd/clm/test/system/test_driver.sh -- use glade paths, add mct/pio_dir - add gres setting on jaguarpf, remove PFTDATA, remove storm, update cprnc on lynx - M models/lnd/clm/test/system/config_files/README - add nil3 config - change x resolution from T31 to f19 (no datasets at T31 for glc) - ->>>>>>>>>> Remove PFTDATA - M models/lnd/clm/test/system/nl_files/mksrfdt_10x15_irr_1850 --------- Remove PFTDATA - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850-2000 --- Remove PFTDATA - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_vancouverCAN_2000 -- Remove PFTDATA - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850 -------- Remove PFTDATA - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_numaIA_mp20irrcr_2000 -- Remove PFTDATA - ->>>>>>>>>> Remove PFTDATA and -p option, add -nobreak to cprnc.pl, print out more info - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl - Remove PFTDATA - M models/lnd/clm/tools/ncl_scripts/cprnc.pl ----- Add -nobreak - M models/lnd/clm/tools/ncl_scripts/cprnc.ncl ----- Add BREAKONDIFF, print avg/max diffs - ->>>>>>>>>> Add NINST_LND and build with new MCT/PIO where need mct_pio_dir ->>>>>>>>>> Handle user_nl_clm directory for multi-instance - M models/lnd/clm/bld/configure - Add ninst_lnd/mct_dir/pio_dir options - change to work with new MCT/PIO - M models/lnd/clm/bld/config_files/config_definition.xml - add mct_dir/pio_dir/ninst_lnd/ninst_atm - M models/lnd/clm/bld/build-namelist - Add ability to write out multiple ensemble - namelist files, handle multiple infiles, and infile directories for multiple - ensembles - M models/lnd/clm/bld/clm.cpl7.template - handle NINST_LND add user_nl_clm directory - for multiple ensembles - ->>>>>>>>>> Compare grid/frac files, update domain files for datm, handle multiple infiles - M models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl - compare grid/frac files - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - Add glc_pio stuff - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - New f45, f10, f09, - f19, T31 domain files - M models/lnd/clm/bld/namelist_files/datm-build-namelist - Be able to handle multiple - infiles - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml - Add glc_pio settings - ->>>>>>>>>> Handle multi-instance SPMD and files, remove fget_archdev, fix problem ->>>>>>>>>> of running on RTM grid (mvertens), handle scam restart files (still fails ->>>>>>>>>> because of PIO problem) - M models/lnd/clm/src/biogeochem/CNDVMod.F90 - Add inst_suffix to hv files - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 - Handle multiple instances and - multiple instances lnd_in and lnd_modelio.nml namelist files - M models/lnd/clm/src/main/fileutils.F90 -- Remove set_filename and putfil, simplify - getfil to NOT do archival retreival - M models/lnd/clm/src/main/ndepStreamMod.F90 - Handle multi-instances - M models/lnd/clm/src/main/histFileMod.F90 --- Pass mfilt to set_hist_filename, don't - require mfilt to be one if nhtfrq=0, only use monthly form of filenames if - nhtfrq=0 AND mfilt=1 - M models/lnd/clm/src/main/restFileMod.F90 - Handle multi-instance files - M models/lnd/clm/src/main/controlMod.F90 -- Remove fget_archdev - M models/lnd/clm/src/main/clm_varctl.F90 -- Remove fget_archdev, add inst_* vars - M models/lnd/clm/src/main/ncdio_pio.F90 --- Fix problem of running on RTM grid, handle - multi-instance files, pass vardesc to scam_field_offsets, handle landunit - in scam_field_offsets, start/count set for all dims, check that dimension - sizes and names are equal in order to share iodesc - M models/lnd/clm/src/main/spmdMod.F90 ---- spmd_init has LNDID passed in - M models/lnd/clm/src/main/histFldsMod.F90 - Fix units/long_names - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - Handle multi-instances and - multiple instances lnd_in and lnd_modelio.nml namelist files - M models/lnd/clm/src/cpl_esmf/lnd_comp_mct.F90 -- Get LNDID - -Summary of testing: - - bluefire: All PASS except TBL tests and... ->>>>>>> rpointer.lnd_* files empty -017 erX51 TER.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -3+-2 cold ..............FAIL! rc= 7 -018 brX51 TBR.sh _nil3sc_dh clm_std^multi_inst 20020401:3600 10x15 USGS -2+-3 cold ..............FAIL! rc= 11 ->>>>>>> Build fails -020 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 4 -021 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -3+-7 cold ................FAIL! rc= 5 -022 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -5+-5 cold ................FAIL! rc= 5 ->>>>>>> Build fails -028 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 4 -029 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -3+-7 arb_ic ............FAIL! rc= 5 -030 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -5+-5 arb_ic ............FAIL! rc= 5 ->>>>>>> Build fails -032 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 96 cold ...............FAIL! rc= 4 -033 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 5 -034 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 5 - bluefire interactive testing: All PASS except... (pio bug 1396) -031 erAK4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 7 -032 brAK4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 6 -036 brAK8 TBR.sh _nrsc_ds clm_std^nl_ptsmode_ocn 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .........FAIL! rc= 6 - bluefire/CESM testing: All PASS except... -FAIL ERS_RLA.f45_f45.I.bluefire -- pio bug 1396 ->>>>>>> Compare fails because of new domain files/new pftdyn -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_33 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_33 -BFAIL ERS_RLA.f45_f45.I.bluefire.generate.clm4_0_34 -BFAIL ERS_RLA.f45_f45.I.bluefire.compare.clm4_0_33 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_33 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_33 -FAIL SMS_ROA.f45_f45.I.bluefire.compare_hist.clm4_0_33 -FAIL SMS_ROA.f45_f45.I.bluefire.compare.clm4_0_33 -FAIL ERS_D.f19_g16.IGRCP26CN.bluefire.compare_hist.clm4_0_33 -- only glc map area? -FAIL ERP.f19_g16.IGRCP60CN.bluefire.compare_hist.clm4_0_33 ---- only glc map area? -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_33 -FAIL PST.f10_f10.I20TRCN.bluefire.compare.clm4_0_33 -FAIL PET_PT.f10_f10.I20TRCN.bluefire.compare.clm4_0_33 -FAIL SMS.f10_f10.IRCP45CN.bluefire.compare_hist.clm4_0_33 -FAIL SMS.f10_f10.IRCP45CN.bluefire.compare.clm4_0_33 - bluefire/PTCLM testing: All PASS - jaguarpf interactive testing: All PASS except... -014 erAK4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 7 -015 brAK4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -5+-5 cold .............FAIL! rc= 6 - edinburgh/lf95 interactive testing: All PASS, except TBL and... (pio bug 1396) -006 erAL4 TER.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 5 -007 brAL4 TBR.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -5+-5 cold ................FAIL! rc= 5 - mirage,storm/ifort interactive testing: All fail -- problem with pio build - yong/ifort interactive testing: All fail -- problem with pio build - -CLM tag used for the baseline comparison tests if applicable: clm4_0_33 - -Changes answers relative to baseline: No bit-for-bit, except: - - f10_f10, f45_f45, f09_f09, f19_f19, T31_T31, with new domain files - -=============================================================== -=============================================================== -Tag name: clm4_0_33 -Originator(s): erik (Erik Kluzek) -Date: Mon Jul 25 14:34:18 MDT 2011 -One-line Summary: Move changes on release branch over to trunk - -Purpose of changes: - -Move changes from release branch over to trunk. Update README files and documentation. -Add new tools testing. Use if masterproc and iulog for output. Move pft mksurfdata into -inputdata. rh files are t-1. All clm tools namelist items in XML database. Fix tools -Makefiles. Survey testlists, move tests around. Remove clm* from path, add quotes in test -scripts, remove CLM_CESMBLD. Remove getfil in mksurfdata, make fdynuse optional. Add --nomv to getregional. Cleanup help and improve documentation in scripts and XML database. -Update datm8/scripts/drv/cism/csm_share. Update pergro data. Changes answers because of -drv update to cesm1_0_beta22 version (answers are identical to cesm1_0_beta22). - -Bugs fixed (include bugzilla ID): - 1301 (Add doc on OpenMP fortran tools) - 1329 (Add new tool tests) - 1338 (Move raw pftdata into inputdata in XML database) - 1341 (Error running with crop for a single-point) - 1346 (save history namelist to the rh0 files NOT rh1) - 1351 (Add all CLM tools namelist items to XML) - 1351 (Problem with interpinic on non bluefire machines) - 1353 (Huge "ccsm.log" file) - 1367 (final_spinup stop time isn't right) -data) -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1309 (Problem with building T31 rcp pftdyn files) - 1325 (GDDHARV on hist causes model to die in debug) - 1339 (Increase streams file limit from 1000 to 2000) - 1358 (incorrect units for a few history fields) - 1360 (Can't do a ncdump on US-UMB data) - 1361 (Problem with transient compsets for PTCLM) - 1372 (pio problem writing out RTM hist fields at RTM res) - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1355 (tlai is zero for first two time-steps in CLMSP) - 1326 (Crop and irrigation sims give balance check error) - 1310 (Restart files different over different tasks) - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts/drv/shr/cism/datm - scripts to scripts4_110711 - drv to drvseq3_1_54 - datm to datm8_110624 - csm_share to share3_110717 - cism to cism1_110418 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>> Add new tests for tools - A models/lnd/clm/test/system/TOPtools.sh ------- Ensure different number of threads - give the same answers for tools - A models/lnd/clm/test/system/TBLscript_tools.sh Comparison test for script tools - A models/lnd/clm/test/system/TBLrst_tools.sh --- Comparison test for rst_tools - A models/lnd/clm/test/system/config_files/tools__do ---- Add OpenMP debug config - A models/lnd/clm/test/system/config_files/17p_nrscnv_ds Add non-RTM debug serial CN - ->>>>>>>>>>> Make copies of existing files to inside of ->>>>>>>>>>> individual tools so that tools can be standalone - A models/lnd/clm/tools/mksurfdata/clm_varpar.F90 - A models/lnd/clm/tools/mksurfdata/shr_file_mod.F90 - A models/lnd/clm/tools/mksurfdata/shr_timer_mod.F90 - A models/lnd/clm/tools/mksurfdata/shr_log_mod.F90 - A models/lnd/clm/tools/mksurfdata/fileutils.F90 - A models/lnd/clm/tools/mksurfdata/shr_const_mod.F90 - A models/lnd/clm/tools/mksurfdata/shr_string_mod.F90 - A models/lnd/clm/tools/mksurfdata/clm_varctl.F90 - A models/lnd/clm/tools/mksurfdata/shr_sys_mod.F90 - A models/lnd/clm/tools/mksurfdata/shr_kind_mod.F90 - A models/lnd/clm/tools/mksurfdata/nanMod.F90 - A models/lnd/clm/tools/mksurfdata/Mkdepends - A models/lnd/clm/tools/mksurfdata/clm_varpar.F90 - A models/lnd/clm/tools/mkgriddata/mkvarpar.F90 - A models/lnd/clm/tools/mkgriddata/clm_varctl.F90 - A models/lnd/clm/tools/mkgriddata/clm_varpar.F90 - A models/lnd/clm/tools/mkgriddata/shr_sys_mod.F90 - A models/lnd/clm/tools/mkgriddata/shr_log_mod.F90 - A models/lnd/clm/tools/mkgriddata/ncdio.F90 - A models/lnd/clm/tools/mkgriddata/shr_kind_mod.F90 - A models/lnd/clm/tools/mkgriddata/shr_const_mod.F90 - A models/lnd/clm/tools/mkgriddata/domainMod.F90 - A models/lnd/clm/tools/mkgriddata/areaMod.F90 - A models/lnd/clm/tools/mkgriddata/nanMod.F90 - A models/lnd/clm/tools/mkgriddata/Mkdepends - A models/lnd/clm/tools/mkdatadomain/Mkdepends - A models/lnd/clm/tools/mkdatadomain/shr_kind_mod.F90 - A models/lnd/clm/tools/mkdatadomain/shr_const_mod.F90 - ->>>>>>>>>>> Add new README files to talk about testing and file copies - A models/lnd/clm/tools/README.testing - A models/lnd/clm/tools/README.filecopies - ->>>>>>>>>>> Add a new chapter for PTCLM - A models/lnd/clm/doc/UsersGuide/ptclm.xml - -List all existing files that have been modified, and describe the changes: - - ->>>>>>>>>>> Remove CLM_CESMBLD, remove clm* in pathname, add quotes in tests ->>>>>>>>>>> fix some spelling and unused vars, add new scripts tests -M models/lnd/clm/test/system/TCB.sh -------------- Remove CLM_CESMBLD -M models/lnd/clm/test/system/TSMncl_tools.sh ----- Remove clm* in pathname -M models/lnd/clm/test/system/TBL.sh -------------- Remove clm* in pathname -M models/lnd/clm/test/system/README.testnames ---- Update for new tests -M models/lnd/clm/test/system/TBR.sh -------------- Remove unused cfgdir -M models/lnd/clm/test/system/TCBtools.sh --------- Remove clm* in pathname, fix spelling -M models/lnd/clm/test/system/TER.sh -------------- Remove unused cfgdir -M models/lnd/clm/test/system/test_driver.sh ------ Remove CLM_CESMBLD, change temp on lynx -M models/lnd/clm/test/system/TSMrst_tools.sh ----- Remove unused cfgdir, add quotes - in comparison -M models/lnd/clm/test/system/nl_files/getregional - Add -nomv option in -M models/lnd/clm/test/system/nl_files/mksrfdt_10x15_irr_1850 - Put -exedir last -M models/lnd/clm/test/system/input_tests_master --- Add TBLtools, TOPtools, - TBLrst_tools, TBLscript_tools tests in -M models/lnd/clm/test/system/TSMtools.sh ---------- Add CLM_RERUN (needed for - TOPtools which runs the same test over for different threads) - Remove clm* from path add quotes to some if tests -M models/lnd/clm/test/system/TBLtools.sh ---------- Remove clm* from path - ->>>>>>>>>>> Move tests around a bit -M models/lnd/clm/test/system/tests_pretag_bluefire_nompi -M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - Add TOP test -M models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi -M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>> Make fdynuse file optional and remove use of getfil -M models/lnd/clm/tools/mksurfdata/mklaiMod.F90 ---- Remove fdynuse file, - remove use of getfil, all averaging is the same (no *_pft options) -M models/lnd/clm/tools/mksurfdata/mksoilMod.F90 --- Remove use of getfil -M models/lnd/clm/tools/mksurfdata/mkharvestMod.F90 Remove use of getfil -M models/lnd/clm/tools/mksurfdata/creategridMod.F90 Remove use of getfil -M models/lnd/clm/tools/mksurfdata/mkglcmecMod.F90 - Remove use of getfil -M models/lnd/clm/tools/mksurfdata/mkvocefMod.F90 -- Remove use of getfil -M models/lnd/clm/tools/mksurfdata/mkglacierMod.F90 Remove use of getfil -M models/lnd/clm/tools/mksurfdata/mkurbanparMod.F90 Remove use of getfil -M models/lnd/clm/tools/mksurfdata/areaMod.F90 ----- Remove _pft methods -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ---- Make mksrf_fdynuse optional - remove use of getfil -M models/lnd/clm/tools/mksurfdata/mklanwatMod.F90 - Remove use of getfil -M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 ---- Remove use of getfil -M models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr1850-2005.txt -- new paths - ->>>>>>>>>>> Updated RMS differences, and add -nomv option to getregional_datasets -M models/lnd/clm/tools/ncl_scripts/RMSbluefire.dat ---------- Updated RMS differences -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -- Add -nomv option -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - Add NOMV env var - ->>>>>>>>>>> Fix bug 1351 -M models/lnd/clm/tools/interpinic/interpinic.F90 -------- Make sure: htop_var, - fpcgrid_var, present_var, itypveg_var are set -M models/lnd/clm/tools/interpinic/interpinic.runoptions - Update the input file to use - ->>>>>>>>>>> Work on formatting, remove use of getfils -M models/lnd/clm/tools/mkgriddata/mkgriddata.F90 - Work on formatting a bit, - removed use of fileutils -M models/lnd/clm/tools/mkgriddata/areaMod.F90 ---- Remove use of getfil -M models/lnd/clm/tools/mkdatadomain/create_domain.F90 - Work on output write - ->>>>>>>>>>> Update documentation in README files -M models/lnd/clm/test/system/config_files/README -M models/lnd/clm/bld/namelist_files/use_cases/README -M models/lnd/clm/test/system/README -M models/lnd/clm/tools/mkgriddata/README -M models/lnd/clm/tools/mkdatadomain/README -M models/lnd/clm/tools/interpinic/README -M models/lnd/clm/tools/README.testing -M models/lnd/clm/tools/README -M models/lnd/clm/bld/README - ->>>>>>>>>>> Sync up tools Makefile, make Filepath standalone (only includes .) ->>>>>>>>>>> Work on formatting, set OPT default, add TOOLROOT default ->>>>>>>>>>> compare to null instead of strip -M models/lnd/clm/tools/mksurfdata/Makefile -M models/lnd/clm/tools/mksurfdata/Filepath -M models/lnd/clm/tools/mksurfdata/Srcfiles - Remove spmdMod,fileutils, - abortutils/shr_cal_mod, ESMF, mpi, shr_mpi_mod -M models/lnd/clm/tools/interpinic/Makefile -M models/lnd/clm/tools/mkgriddata/Filepath -M models/lnd/clm/tools/mkgriddata/Srcfiles - Remove fileutils,spmdMod, - abortutils,shr_timer_mod,shr_mpi_mod,shr_file_mod,MPI -M models/lnd/clm/tools/mkgriddata/Makefile -M models/lnd/clm/tools/mkdatadomain/Filepath -M models/lnd/clm/tools/mkdatadomain/Makefile - ->>>>>>>>>>> Cleanup help and documentation -M models/lnd/clm/bld/configure --------------- Cleanup help, remove cesm_bld -M models/lnd/clm/bld/queryDefaultNamelist.pl - Cleanup help -M models/lnd/clm/bld/listDefaultNamelist.pl -- Add more description, documentation - set maxpft for crop -M models/lnd/clm/bld/build-namelist ---------- Cleanup help, add papi_inparm - remove some list options for non-CLM vars -M models/lnd/clm/bld/clm.cpl7.template ------- Remove clm* in path - remove warning about CAM and CLM dtime, remove comment about *.h files - ->>>>>>>>>>> Make sure all 1x1 files are in supported single-point res -M models/lnd/clm/bld/config_files/config_definition.xsl - Add CLM in descriptions -M models/lnd/clm/bld/config_files/config_definition.xml - Add - 1x1_numaIA,1x1_smallvilleIA to supported single-point resolutions - cleanup spelling and a few descriptions - ->>>>>>>>>>> Work on documentation descriptions, document all tools namelist items -M models/lnd/clm/bld/namelist_files/checklatsfiles.ncl --------- Add doc, continue - if file NOT found rather than abort -M models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl --------- Add doc, continue - if file NOT found rather than abort -M models/lnd/clm/bld/namelist_files/namelist_definition.xml ---- Work on descriptions, - add in all mksurfdata/mkdatadomain/mkgriddata namelist vars, add in - new driver namelist vars (so documented in table in UG), - add HCN,CH3CN to drydep -M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Add datasource - small formatting change -M namelist_files/namelist_defaults_drv.xml --------------------- Fix final_spinup - (bug 1367) -M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl ------ Add attributes - to output for: crop, irrig, ad_spinup, and source -M models/lnd/clm/bld/namelist_files/namelist_definition.xsl ---- Work to improve - output formatting of table -M models/lnd/clm/bld/namelist_files/datm-build-namelist -------- Cleanup help / source -M models/lnd/clm/bld/namelist_files/checktopofiles.ncl --------- Change res list, - add documentation, continue rather than abort if file not found -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml Update paths - to landuse for mksurfdata as all in repo now, add default values for - other mksurfdata namelist items - ->>>>>>>>>>> Update documentation for latest release -M models/lnd/clm/doc/UsersGuide/trouble_shooting.xml -M models/lnd/clm/doc/UsersGuide/single_point.xml -M models/lnd/clm/doc/UsersGuide/special_cases.xml -M models/lnd/clm/doc/UsersGuide/tools.xml -M models/lnd/clm/doc/UsersGuide/limitLineLen.pl -M models/lnd/clm/doc/UsersGuide/preface.xml -M models/lnd/clm/doc/UsersGuide/clm_ug.xml -M models/lnd/clm/doc/UsersGuide/adding_files.xml -M models/lnd/clm/doc/UsersGuide/appendix.xml -M models/lnd/clm/doc/UsersGuide/custom.xml -M models/lnd/clm/doc/UsersGuide/Makefile - ->>>>>>>>>>> Update documentation for latest release -M models/lnd/clm/doc/Quickstart.userdatasets -M models/lnd/clm/doc/IMPORTANT_NOTES -M models/lnd/clm/doc/Quickstart.GUIDE -M models/lnd/clm/doc/CodeReference/Filepath -M models/lnd/clm/doc/KnownLimitations -M models/lnd/clm/doc/KnownBugs -M models/lnd/clm/doc/README -M README - ->>>>>>>>>>> Add if masterproc, work on documentation, use iulog NOT unit 6 -M models/lnd/clm/src/biogeochem/CropRestMod.F90 ---------- Add if masterproc -M models/lnd/clm/src/biogeochem/CASAMod.F90 -------------- Cleanup endrun statement -M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 --- Use iulog NOT unit 6 -M models/lnd/clm/src/biogeochem/CNDVMod.F90 -------------- Use iulog NOT unit 6 -M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ------- Use iulog NOT unit 6 -M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 ------ Ensure arepr is initialized - (bug 1341) -M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 - Comment out debug write -M models/lnd/clm/src/biogeochem/CNDVEstablishmentMod.F90 - Use iulog NOT unit 6 - ->>>>>>>>>>> Add if masterproc, work on documentation, rh files are t-1 -M models/lnd/clm/src/main/fileutils.F90 --- Add if masterproc -M models/lnd/clm/src/main/pftdynMod.F90 --- Add if masterproc (fix bug 1353) -M models/lnd/clm/src/main/histFileMod.F90 - Add if masterproc, rh files are t-1 - (bug 1346) -M models/lnd/clm/src/main/clmtype.F90 ----- Work on documentation - - -Summary of testing: - - bluefire: All PASS except... (up to 43) -004 blC91 TBL.sh _sc_dh clm_std^nl_urb 20030101:3600 4x5 gx3v7 -6 arb_ic ........................FAIL! rc= 5 -008 blTZ1 TBL.sh 21p_cncrpsc_dh clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 5 -011 blD91 TBL.sh _persc_dh clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 5 -015 blEH1 TBL.sh 4p_vorsc_dh clm_std^nl_urb 20021231:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic ......FAIL! rc= 5 -019 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:1800 1.9x2.5 gx1v6@1850-2100 -10 cold FAIL! rc= 5 -023 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:1800 10x15 USGS@2000 -90 cold ..................FAIL! rc= 5 -027 blHo1 TBL.sh 17p_cnsc_dh clm_drydep 20000101:1800 10x15 USGS@2000 -10 cold ..................FAIL! rc= 5 -028 smG41 TSM.sh 17p_scnv_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ...........FAIL! rc= 10 -029 erG41 TER.sh 17p_scnv_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic .........FAIL! rc= 5 -030 brG41 TBR.sh 17p_scnv_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic .........FAIL! rc= 5 -031 blG41 TBL.sh 17p_scnv_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ...........FAIL! rc= 4 -035 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 5 -039 blG61 TBL.sh _scnv_dh clm_std^nl_urb 20020101:1800 1.9x2.5 gx1v6 48 startup .................FAIL! rc= 5 -043 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 48 cold ...............FAIL! rc= 5 - bluefire interactive testing: All PASS except TBL tests - bluefire/CESM testing: All PASS except compare tests to clm4_0_32 - bluefire/CESM extra testing (show that answers are identical with cesm1_0_beta22): -PASS ERI.T31_g37.IGCN.bluefire -PASS ERI.T31_g37.IGCN.bluefire.compare.cesm1_0_alpha22a -PASS ERS.T31_g37.ITEST.bluefire -PASS ERS.T31_g37.ITEST.bluefire.compare_hist.cesm1_0_alpha22a -PASS ERS.T31_g37.ITEST.bluefire.compare.cesm1_0_alpha22a -PASS ERS.f19_g16.IGCN.bluefire -PASS ERS.f19_g16.IGCN.bluefire.compare_hist.cesm1_0_alpha22a -PASS ERS.f19_g16.IGCN.bluefire.compare.cesm1_0_alpha22a -PASS ERS.f45_g37.I4804.bluefire -PASS ERS.f45_g37.I4804.bluefire.compare_hist.cesm1_0_alpha22a -PASS ERS.f45_g37.I4804.bluefire.compare.cesm1_0_alpha22a -PASS SMS_RLA.f45_f45.I.bluefire -PASS SMS_RLA.f45_f45.I.bluefire.compare_hist.cesm1_0_alpha22a -PASS SMS_RLA.f45_f45.I.bluefire.compare.cesm1_0_alpha22a -PASS SMS_RLB.f45_f45.ITEST.bluefire -PASS SMS_RLB.f45_f45.ITEST.bluefire.compare_hist.cesm1_0_alpha22a -PASS SMS_RLB.f45_f45.ITEST.bluefire.compare.cesm1_0_alpha22a - jaguarpf interactive testing: All PASS except... -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:1800 1x1_brazil navy -10 arb_ic ...............FAIL! rc= 5 -008 blTZ3 TBL.sh 21p_cncrpsc_do clm_stdIgnYr^nl_crop 20020401:3600 10x15 USGS -10 cold ..........FAIL! rc= 5 -012 blVU4 TBL.sh 21p_cncrpsc_ds clm_stdIgnYr^nl_crop 20020101:3600 1x1_smallvilleIA test -1100 cold FAIL! rc= 5 -014 blAK4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -10 cold ...............FAIL! rc= 5 -015 smG43 TSM.sh 17p_scnv_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ...........FAIL! rc= 10 -016 erG43 TER.sh 17p_scnv_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic .........FAIL! rc= 5 -017 brG43 TBR.sh 17p_scnv_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic .........FAIL! rc= 5 -018 blG43 TBL.sh 17p_scnv_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ...........FAIL! rc= 4 -022 blK74 TBL.sh 17p_cndvsc_s clm_std 19971231:1800 1x1_brazil navy -670 arb_ic .................FAIL! rc= 5 -026 blSn3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp8.5 20331231:1800 1.9x2.5 gx1v6@1850-2100 48 arFAIL! rc= 5 -030 blQQ4 TBL.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -150 cold .............FAIL! rc= 5 -034 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 5 -038 blS63 TBL.sh _mec10sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ...................FAIL! rc= 5 -040 bl8Z3 TBLrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6FAIL! rc= 5 -042 bl954 TBLscript_tools.sh mksurfdata mksurfdata.pl mksrfdt_10x15_irr_1850^tools__ds ..........FAIL! rc= 6 -046 bl9T4 TBLscript_tools.sh mksurfdata mksurfdata.pl mksrfdt_1x1_numaIA_mp20irrcr_2000^tools__ds FAIL! rc= 6 -050 bl9C4 TBLscript_tools.sh mksurfdata mksurfdata.pl mksrfdt_1x1_vancouverCAN_2000^tools__ds ...FAIL! rc= 6 - edinburgh/lf95 interactive testing: All PASS except... -006 blAL4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 7 -014 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:3600 1x1_vancouverCAN navy 331 arb_ic ...FAIL! rc= 7 - edinburgh/lf95 testing: All PASS except TBL tests - lynx/intel testing: All PASS except TBL tests - -CLM tag used for the baseline comparison tests if applicable: clm4_0_32 - -Changes answers relative to baseline: Yes (Driver change) - - But, answers are identical to cesm1_0_beta22 where the driver change - was already in effect. - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change: larger than roundoff/same climate - -=============================================================== -=============================================================== -Tag name: clm4_0_32 -Originator(s): erik (Erik Kluzek) -Date: Thu May 19 15:18:49 MDT 2011 -One-line Summary: Make I1850SPINUPCN compset use MOAR data, various bug fixes, work on test lists - -Purpose of changes: - -Update datm and scripts so can run I1850SPINUPCN compset with MOAR data. Fix CN units. -Fix some documentation for crop. Add attribute that notes that flux variables are NOT -multiplied by landfrac. Change align year for I4804 and I4804CN compsets, add append/warn -option to xmlchange. Some clarifications to clm namelist. build-namelist can run list -options without a config_cache file. Add comment/title to output files. Remove the -2.65x3.33 grid, no longer supported. Work on test lists a bit. - -Bugs fixed (include bugzilla ID): - 1337 (have ISPINUPCN compset use MOAR data) - 1336 (evaluate CLM testing for release) - 1327 (correct documentation of CN variable units) - 1158 (make 4804 compsets consistent with 1850 etc.) - 1151 (remove co2_ppmv when co2_type is NOT constant) - 1140 (build-namelist -list options die with config file) - 1108 (have append/warn mode for xmlchange) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1325 (GDDHARV on hist causes model to die in debug) - 1367 (final_spinup stop time isn't right) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: - - I1850SPINUP compset changed to use MOAR data - - DATM_CPL_* variables added to env_conf.xml to set casename, years run over - I4804 compsets ALIGN year changed to agree with doc. and I1850 compsets - - New options to xmlchange -- allow you to append (-a) to the end of something already - there and another option (-w) warn you and abort if already set. - -Describe any changes made to the namelist: Add options to build-namelist - - Add -co2_ppmv and -rtm_tstep options to set co2_ppmv when co2_type is constant - and set rtm time-step when RTM is on. - - This way co2_ppmv and rtm_nsteps do NOT show up in the namelist if they aren't needed. - -List any changes to the defaults for the boundary datasets: Remove 2.65x3.33 datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, slevis (units change), sacks (crop doc) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, csm_share, datm - scripts to scripts4_110517 - csm_share to share3_110516 - datm to datm8_110517b - -List all files eliminated: - ->>>>>>>>>>>>> Remove as no longer needed to get lists for documentation - D models/lnd/clm/doc/UsersGuide/config_cache.xml - -List all files added and what they do: - ->>>>>>>>>>>>> Add new test configurations - A models/lnd/clm/test/system/config_files/_scnv_dm - A models/lnd/clm/test/system/config_files/17p_scnv_dm - A models/lnd/clm/test/system/config_files/17p_scnv_ds - A models/lnd/clm/test/system/config_files/17p_nrcnsc_do - A models/lnd/clm/test/system/config_files/17p_nrcnsc_ds - A models/lnd/clm/test/system/config_files/17p_scnv_m - A models/lnd/clm/test/system/config_files/17p_scnv_o - A models/lnd/clm/test/system/config_files/17p_scnv_s - A models/lnd/clm/test/system/config_files/17p_cnnfsc_dh -- turn on NOFIRE - A models/lnd/clm/test/system/config_files/17p_cnnfsc_dm -- turn on NOFIRE - A models/lnd/clm/test/system/config_files/17p_cnnfsc_do -- turn on NOFIRE - A models/lnd/clm/test/system/config_files/21p_nrcncrpsc_s - A models/lnd/clm/test/system/config_files/21p_nrcncrpsc_ds - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/config_files/README - ->>>>>>>>>>>>> Change tests a bit to make them more consistent with naming convention ->>>>>>>>>>>>> make sure tests are covered, and have no-RTM tests for single-point - M models/lnd/clm/test/system/README.testnames - M models/lnd/clm/test/system/nl_files/clm_spin --- Use MOAR data on bluefire - M models/lnd/clm/test/system/input_tests_master - ->>>>>>>>>>>>> Change test lists - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh - M models/lnd/clm/test/system/tests_posttag_kraken - M models/lnd/clm/test/system/tests_posttag_yong - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_pretag_jaguarpf - M models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi - M models/lnd/clm/test/system/tests_posttag_mirage - M models/lnd/clm/test/system/tests_posttag_intrepid - M models/lnd/clm/test/system/tests_posttag_intrepid_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/tests_posttag_lynx - ->>>>>>>>>>>>> Add -co2_ppmv, and -rtm_tstep options to build-namelist ->>>>>>>>>>>>> Don't require config file for build-namelist list options ->>>>>>>>>>>>> Remove 2.65x3.33 files, add capability to handle MOAR data - M models/lnd/clm/bld/build-namelist - M models/lnd/clm/bld/clm.cpl7.template - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - M models/lnd/clm/bld/namelist_files/datm-build-namelist - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - ->>>>>>>>>>>>> Correct documentation of units from kg to g - M models/lnd/clm/src/biogeochem/CNMRespMod.F90 - M models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 -- Also documentation changes - from Bill Sacks - M models/lnd/clm/src/biogeochem/CNDecompMod.F90 - M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 - M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 - ->>>>>>>>>>>>> Add title and comment attributes to output files - M models/lnd/clm/src/main/histFileMod.F90 - M models/lnd/clm/src/main/restFileMod.F90 - -Summary of testing: - - bluefire interactive testing: All PASS up to... -006 smC97 TSM.sh _sc_do clm_spin^nl_urb 20030101:1800 4x5 gx3v7@1850 -6 arb_ic ..................FAIL! rc= 10 - bluefire/CESM testing: All PASS except... -BFAIL PST.f45_g37.I1850CN.bluefire.compare.clm4_0_31 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_31 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_31 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_31 -Originator(s): erik (Erik Kluzek) -Date: Fri May 13 17:11:38 MDT 2011 -One-line Summary: Fix answers for transient_CN, fix interpinic - -Purpose of changes: - -Fix interpinic test with finidat files. Fix CNPrecisionControl so answers with transient -CN are same as clm4_0_26 without crop. - -Bugs fixed (include bugzilla ID): - 1335 (transient_CN sometimes different than clm4_0_26) - 1299 (interpinic does NOT work going from non glc_mec) - 1318 (interpinic has trouble with new restart files) - 1319 (interpinic doesn't interpolate *_PERIOD) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1325 (GDDHARV on hist causes model to die in debug) - 1367 (final_spinup stop time isn't right) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>>>>> Add transient 20th Century namelist config - A models/lnd/clm/test/system/nl_files/clm_transient_20thC - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Add f19 transient-CN tests that start in 1979 (which showed bug 1335) - M models/lnd/clm/test/system/input_tests_master - Add f19 transient CN tests - Also make glc_nec interpinic test run for f09@1850 - M models/lnd/clm/test/system/README.testnames --- Add run-4 for f19 transient CN - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi ------ Add f19 transient_CN -test - M models/lnd/clm/test/system/tests_posttag_purempi_regression - Add f19 transient_CN -test - M models/lnd/clm/test/system/tests_posttag_hybrid_regression -- Add f19 transient_CN -test - M models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi ------ Add f19 transient_CN -test - M models/lnd/clm/test/system/tests_posttag_nompi_regression --- Add f19 transient_CN -test - ->>>>>>>>>>>>>> Put changes from clm4_0_27 back in except those that cause runs to fail - M models/lnd/clm/tools/interpinic/interpinic.F90 - M models/lnd/clm/tools/interpinic/Srcfiles ------ Add shr_const_mod.F90 back in - ->>>>>>>>>>>>>> - M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 - Add if ( crop_prog ) to - a crop change that needed it - M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 ---- Remove pft_ctrunc not used - M models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 -- Remove pft_ctrunc not used - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 -------- Set wesveg for crop_prog - -Summary of testing: - - bluefire extra interactive testing: -001 bl853 TBLtools.sh interpinic tools__o runoptions ............................................PASS -001 sm893 TSMrst_tools.sh _sc_do interpinic clm_std^nl_urb 20000101:1800 1.9x2.5 gx1v6 4x5 gx3v7 -1 PASS -001 sm857 TSMrst_tools.sh 17p_cnsc_o interpinic clm_std^nl_urb 18500101:1800 1.9x2.5 gx1v6@1850 10x1PASS -002 sm8Z3 TSMrst_tools.sh 21p_cncrpsc_do interpinic clm_stdIgnYr^nl_crop 20000101:1800 1.9x2.5 gx1v6PASS -003 sm813 TSMrst_tools.sh 17p_cndvsc_do interpinic clm_std^nl_urb 18500101:1800 1.9x2.5 gx1v6@1850 4PASS ->>>>> This test compares to clm4_0_30 and rightly shows that answers change -001 blH43 TBL.sh 17p_cnsc_do clm_transient_20thC 19790101:1800 1.9x2.5 gx1v6@1850-2000 -10 startup FAIL! rc= 7 - bluefire/CESM testing: All PASS except... (why did these comparisons PASS in clm4_0_27) -BFAIL ERP.f19_g16.IGRCP60CN.bluefire.compare.clm4_0_30 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_30 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_30 - bluefire/CESM testing compared to cesm1_0_beta19: -PASS SMS_D.f09_g16.BRCP45CN.bluefire -PASS SMS_D.f09_g16.BRCP45CN.bluefire.compare_hist.cesm1_0_beta19 -PASS SMS_D.f09_g16.BRCP45CN.bluefire.compare.cesm1_0_beta19 -PASS ERS.f09_f09.FAMIPCN.bluefire -PASS ERS.f09_f09.FAMIPCN.bluefire.compare_hist.cesm1_0_beta19 -PASS ERS.f09_f09.FAMIPCN.bluefire.compare.cesm1_0_beta19 -PASS ERS.f19_f19.FAMIPC5.bluefire -PASS ERS.f19_f19.FAMIPC5.bluefire.compare_hist.cesm1_0_beta19 -PASS ERS.f19_f19.FAMIPC5.bluefire.compare.cesm1_0_beta19 -PASS ERS.f19_f19.FAMIPCN.bluefire -PASS ERS.f19_f19.FAMIPCN.bluefire.compare_hist.cesm1_0_beta19 -PASS ERS.f19_f19.FAMIPCN.bluefire.compare.cesm1_0_beta19 -PASS ERS.f09_g16.BRCP45CN.lynx_pgi -PASS ERS.f09_g16.BRCP45CN.lynx_pgi.compare_hist.cesm1_0_beta19 -PASS ERS.f09_g16.BRCP45CN.lynx_pgi.compare.cesm1_0_beta19 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_30 - -Changes answers relative to baseline: Some transient_CN tests are different - because of bug 1335 introduced in clm4_0_27 - - With these changes answers are the same as clm4_0_26 - -=============================================================== -=============================================================== -Tag name: clm4_0_30 -Originator(s): erik (Erik Kluzek) -Date: Wed May 11 14:32:19 MDT 2011 -One-line Summary: New finidat/fsurdat files for T31 - -Purpose of changes: - -Externals update, fix some PTCLM problems. New finidat/fsurdat files for T31, make sure -works. - -Bugs fixed (include bugzilla ID): - 1279 (Latest version of PTCLM requires python2.5) - 1248 (PTCLM can only go to 2005) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1299 (interpinic does NOT work going from non glc_mec) - 1318 (interpinic has trouble with new restart files) - 1319 (interpinic doesn't interpolate *_PERIOD) - 1325 (GDDHARV on hist causes model to die in debug) - 1335 (transient_CN sometimes different than clm4_0_26) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - New finidat files for T31 - New fsurdat file for T31@2000 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, mct, pio - - scripts to scripts4_110511 - mct to MCT2_7_0_110504a - pio to pio1_3_0 - -List all files eliminated: None - -List all files added and what they do: - - A models/lnd/clm/test/system/config_files/17p_cnsc_h - A models/lnd/clm/test/system/config_files/17p_cnsc_o - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/README.testnames --- Add R f19 rcp4.5 resol - M models/lnd/clm/test/system/input_tests_master - Make some tests startup, add - some rcp tests, change some tests from T31 to f19 - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Add new finidat - files for T31@1850/2000, add new surdata file for T31@2000, remove empty - half-degree pftdyn file - -Summary of testing: - - bluefire: All PASS except... -024 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -025 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -026 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -027 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -049 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -050 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -051 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -052 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 -054 erJ61 TER.sh 4p_casasc_dh clm_std^nl_urb 20021230:1800 1.9x2.5 gx1v6 10+38 cold .............FAIL! rc= 5 -055 brJ61 TBR.sh 4p_casasc_dh clm_std^nl_urb_br 20021230:1800 1.9x2.5 gx1v6 72+72 cold ..........FAIL! rc= 5 -056 blJ61 TBL.sh 4p_casasc_dh clm_std^nl_urb 20021230:1800 1.9x2.5 gx1v6 48 cold ................FAIL! rc= 4 - bluefire interactive testing: All PASS - bluefire extra interactive testing: -001 smE13 TSM.sh 17p_vorsc_do clm_std^nl_urb 20021230:1800 48x96 gx3v7 96 startup ...............PASS -001 smH13 TSM.sh 17p_cnsc_do clm_ndepdyn^nl_cn_conly 20020101:1800 48x96 gx3v7@1850-2000 96 startup PASS - bluefire/CESM testing: All PASS except... -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_29 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_29 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_29 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_29 -FAIL SMS_ROA.f45_f45.I.bluefire.compare_hist.clm4_0_29 -FAIL SMS_ROA.f45_f45.I.bluefire.compare.clm4_0_29 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_29 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_29 -BFAIL ERS_E.T31_g37.I1850.bluefire.compare.clm4_0_29 -BFAIL ERI.T31_g37.IG1850.bluefire.compare.clm4_0_29 -BFAIL ERS_D.f19_g16.IGRCP26CN.bluefire.compare.clm4_0_29 - - bluefire/CESM rcps extra testing: All PASS... -PASS SMS.f09_g16.IRCP26CN.bluefire -PASS SMS.f09_g16.IRCP45CN.bluefire -PASS SMS.f09_g16.IRCP60CN.bluefire -PASS SMS.f09_g16.IRCP85CN.bluefire -PASS SMS.f09_g16.IGRCP26CN.bluefire -PASS SMS.f09_g16.IGRCP45CN.bluefire -PASS SMS.f09_g16.IGRCP60CN.bluefire -PASS SMS.f09_g16.IGRCP85CN.bluefire -PASS SMS.f19_g16.IRCP26CN.bluefire -PASS SMS.f19_g16.IRCP45CN.bluefire -PASS SMS.f19_g16.IRCP60CN.bluefire -PASS SMS.f19_g16.IGRCP45CN.bluefire -PASS SMS.f19_g16.IGRCP85CN.bluefire - - bluefire/PTCLM testing: All PASS - -CLM tag used for the baseline comparison tests if applicable: clm4_0_29 - -Changes answers relative to baseline: no bit-for-bit (except T31 with new files) - -=============================================================== -=============================================================== -Tag name: clm4_0_29 -Originator(s): erik (Erik Kluzek) -Date: Thu May 5 14:19:04 MDT 2011 -One-line Summary: Backout interpinic changes to one that works - -Purpose of changes: - -Backout interpinic to Mariana's non2dgrid version. Won't work for new -files (have to remove fields to get it to work). Adds back in bugs 1318 and 1319. -Add more comparison tests for tools and add cprnc.pl/ncl scripts to compare files that -don't have a time-axis. - -Bugs fixed (include bugzilla ID): - 1328 (interpinic gives bad results that can NOT be used!) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1299 (interpinic does NOT work going from non glc_mec) - 1318 (interpinic has trouble with new restart files) - 1319 (interpinic doesn't interpolate *_PERIOD) - 1325 (GDDHARV on hist causes model to die in debug) - 1335 (transient_CN sometimes different than clm4_0_26) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>>>>> Add scripts to compare two NetCDF files and report if different ->>>>>>>>>>>>>> This mimic's the cprnc program, but also works on files without ->>>>>>>>>>>>>> a time coordinate. For big files it's considerably slower as well. - A models/lnd/clm/tools/ncl_scripts/cprnc.pl - A models/lnd/clm/tools/ncl_scripts/cprnc.ncl - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Add tool comparison tests, use cprnc.pl for tool comparison - M models/lnd/clm/test/system/input_tests_master - Add TBLtools test for: - mkgriddata, mksurfdata, mkdatadomain, and interpinic, remove pftdyn - mksurfdata test - M models/lnd/clm/test/system/CLM_compare.sh ----- Remove unused variable - M models/lnd/clm/test/system/TSMtools.sh -------- Copy .txt files over if exist - M models/lnd/clm/test/system/TBLtools.sh -------- Use cprnc.pl in place of cprnc binary - ->>>>>>>>>>>>>> Add tool comparison tests - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_posttag_yong - M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>>>>> Add notes on cprnc tools - M models/lnd/clm/tools/ncl_scripts/README - ->>>>>>>>>>>>>> Move back to Mariana's version of interpinic in non2dgrid08_clm4_0_26 ->>>>>>>>>>>>>> This means it won't work for new files, but will work for older files ->>>>>>>>>>>>>> and gives the same answers as the non2dgrid version. - M models/lnd/clm/tools/interpinic/interpinic.F90 - M models/lnd/clm/tools/interpinic/Srcfiles - - -Summary of testing: - - bluefire interactive testing: These PASS - -002 bl853 TBLtools.sh interpinic tools__o runoptions ............................................PASS (same as non2dgrid08_clm4_0_26) -001 bl754 TBLtools.sh mksurfdata tools__s namelist ..............................................PASS -002 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................PASS -001 bl654 TBLtools.sh mkgriddata tools__ds namelist .............................................PASS -001 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................PASS -002 blZ94 TBLtools.sh mkdatadomain tools__ds namelist ...........................................PASS - - yong/ifort interactive testing: These PASS - -001 bl853 TBLtools.sh interpinic tools__o runoptions ............................................PASS (same as non2dgrid08_clm4_0_26) - -CLM tag used for the baseline comparison tests if applicable: clm4_0_28 - -Changes answers relative to baseline: no bit-for-bit (except interpinic) - -=============================================================== -=============================================================== -Tag name: clm4_0_28 -Originator(s): erik (Erik Kluzek) -Date: Tue May 3 09:14:24 MDT 2011 -One-line Summary: Remove DUST/PROGSSLT in land coupler layer, update driver and scripts - -Purpose of changes: - -Update drv to branch version, fix ram1/fv issue (remove DUST/PROGSSLT #ifdef's in -lnd_comp_*). Answers will then be identical to clm4_0_26 (except air density sent to -cpl). Don't allow both -irrig and -crop to be on at same time in scripts. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1299 (interpinic does NOT work going from non glc_mec) - 1325 (GDDHARV on hist causes model to die in debug) - 1328 (interpinic gives bad results that can NOT be used!) - 1335 (transient_CN sometimes different than clm4_0_26) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): drv, scripts - scripts to scripts4_110428a - drv to branch version: t3148b_tags/t3148b02_drvseq3_1_48 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/build-namelist - Don't allow crop and irrig on at same time - - M models/lnd/clm/tools/interpinic/interpinic.F90 -------- Move input read up - M models/lnd/clm/tools/interpinic/interpinic.runoptions - Use latest input file - - M models/lnd/clm/test/system/tests_pretag_bluefire -- Remove some tests - M models/lnd/clm/test/system/README.testnames ------- Don't mix crop and irrig - M models/lnd/clm/test/system/input_tests_master ----- Change irrig+crop tests to - just crop - - ->>>>>>>>>> Remove DUST, PROGSSLT and VOC #ifdef's - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - -Summary of testing: - - bluefire: All PASS except... -024 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -025 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -026 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -027 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -049 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -050 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -051 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -052 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except... -058 sm8Z3 TSMrst_tools.sh 21p_cncrpsc_do interpinic clm_irrig^nl_crop 20000101:1800 1.9x2.5 gx1v6 10FAIL! rc= 4 - bluefire/CESM testing: All PASS except... (compare to clm4_0_26 with updated datm) -SFAIL ERS_D.T31_g37.IGRCP26CN.bluefire.GC.160557 -SFAIL ERP.T31_g37.IGRCP60CN.bluefire.GC.160557 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_26_datmdens -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_26_datmdens - -CLM tag used for the baseline comparison tests if applicable: clm4_0_27 - -Changes answers relative to baseline: No bit-for-bit - Although coupler log file will show changes in fv and ram1 to clm4_0_27, but - will be identical to clm4_0_26 (although then dens in atm changes) - -=============================================================== -=============================================================== -Tag name: clm4_0_27 -Originator(s): erik (Erik Kluzek) -Date: Mon May 2 09:37:57 MDT 2011 -One-line Summary: Move crop branch over to trunk - -Purpose of changes: - -Move crop branch to trunk. Add crop and noio options to configure. maxpft option to -configure can now only be a number (removing numpft+1 option to it). Add datasets for -crop. Add T31 historical and rcp2.6 transient dynpft datasets. Remove some of the CPP -tokens (DUST, PROGSSLT, etc.) Bring Marian Vertensteins version of interpinic over to the -trunk as well. This version is faster and is able to run for higher resolution cases. -Remove scaled_harvest and carbon_only namelist options and add suplnitro option -(supplemental Nitrogen which can be: NONE, PROG_CROP_ONLY, or ALL). Add number parameters -for the different nsrest settings, and have only one copy of is_restart in -clm_time_manager. Update to ESMF interface from Tony. - -Bugs fixed (include bugzilla ID): - 1323 (Remove some unused items) - 1319 (interpinic doesn't interpolate *_PERIOD) - 1318 (interpinic has trouble with new restart files) - 1303 (remove complexity of no-urban in interpinic) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 901 (remove some CPP tokens) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1299 (interpinic does NOT work going from non glc_mec) - 1325 (GDDHARV on hist causes model to die in debug) - 1328 (interpinic gives bad results that can NOT be used!) - 1335 (transient_CN sometimes different than clm4_0_26) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: Yes - - Add -crop and -noio options to configure, remove -dust and -progsslt options - Remove "numpft+1" option to -maxpft. maxpft can go up to 17 without crop and - needs to be 21 for crop. - - -crop adds the CROP #ifdef. Removes the DUST, PROGSSLT, CLAMP CPP tokens. - Also remove: DISTURB, COUP_WRF, NO_DAYLEN_VCMAX, TCX_REMOVE_SEE_NOTES_ABOVE, and - L2R_Decomp, and some testing/debug CPP defines - -Describe any changes made to the namelist: Yes - - Remove Carbon_only and scaled_harvest options - Add suplnitro option which can be set to: NONE, PROG_CROP_ONLY, or ALL - - Add new history output variables: - - A5TMIN 5-day running mean of min 2-m temperature (K) - A10TMIN 10-day running mean of min 2-m temperature (K) - GDD0 Growing degree days base 0C from planting (ddays) - GDD8 Growing degree days base 8C from planting (ddays) - GDD10 Growing degree days base 10C from planting (ddays) - GDD020 Twenty year average of growing degree days base 0C from planting (ddays) - GDD820 Twenty year average of growing degree days base 8C from planting (ddays) - GDD1020 Twenty year average of growing degree days base 10C from planting (ddays) - GDDPLANT Accumulated growing degree days past planting date for crop (ddays) - GDDHARV Growing degree days (gdd) needed to harvest (ddays) - GDDTSOI Growing degree-days from planting (top two soil layers) (ddays) - -List any changes to the defaults for the boundary datasets: - New point mode for crop: 1x1_numaIA and 1x1_smallvilleIA - pftcon: pft-physiology.c110425.nc - surface datasets for crop mode for: f19, f10, 1x1_numaIA, and 1x1_smallvilleIA - (also crop datasets with crop AND irrigation on) - finidat file for crop for f19 - New T31 pftdyn file for historical and rcp2.6 - Raw veg and lai datasets for mksurfdata for crop - -Describe any substantial timing or memory changes: Crop adds some additional variables - and if checks that may make small differences in run-time and/or memory - -Code reviewed by: self, slevis - -List any svn externals directories updated (csm_share, mct, etc.): Almost all - - scripts to scripts4_110421 - share to share3_110411 - drv to drvseq3_1_53 - datm to datm8_110419 - stubs to stubs1_2_04 - -List all files eliminated: - ->>>>>>>>>>>>>>> Remove test configs that explicitly have dust - D models/lnd/clm/test/system/config_files/4p_vodsrsc_dh - D models/lnd/clm/test/system/config_files/4p_vodsrsc_dm - D models/lnd/clm/test/system/config_files/4p_vodsrsc_do - D models/lnd/clm/test/system/config_files/4p_vodsrsc_ds - D models/lnd/clm/test/system/config_files/17p_vodsrsc_h - D models/lnd/clm/test/system/config_files/17p_vodsrsc_m - D models/lnd/clm/test/system/config_files/17p_vodsrsc_o - D models/lnd/clm/test/system/config_files/17p_vodsrsc_dh - D models/lnd/clm/test/system/config_files/4p_vodsnrsc_ds - D models/lnd/clm/test/system/config_files/17p_vodsrsc_dm - D models/lnd/clm/test/system/config_files/17p_vodsrsc_do - D models/lnd/clm/test/system/config_files/4p_vodsrsc_h - D models/lnd/clm/test/system/config_files/17p_vodsrsc_ds - D models/lnd/clm/test/system/config_files/4p_vodsrsc_o - ->>>>>>>>>>>>>>> Remove test for scaled_harvest namelist item - D models/lnd/clm/test/system/nl_files/nl_noicertm_sclharv - ->>>>>>>>>>>>>>> Remove sample namelists and always use mksurfdata.pl script - D models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig - D models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn - ->>>>>>>>>>>>>>> Remove these two from changes that mvertens applied - D models/lnd/clm/tools/interpinic/addglobal.F90 - D models/lnd/clm/tools/interpinic/wrap_nf.F90 - ->>>>>>>>>>>>>>> Update sample IC file - D models/lnd/clm/tools/interpinic/clmi.IQ.1953-01-01_10x15_USGS_simyr2000_c081202.nc - -List all files added and what they do: - ->>>>>>>>>>>>>>> Add crop test configs - A models/lnd/clm/test/system/config_files/21p_cncrpsc_do - A models/lnd/clm/test/system/config_files/21p_cncrpsc_s - A models/lnd/clm/test/system/config_files/21p_cncrpsc_ds - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_dh - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_dm - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_do - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_ds - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_h - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_m - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_o - A models/lnd/clm/test/system/config_files/21p_cndvcrpsc_s - A models/lnd/clm/test/system/config_files/21p_cncrpsc_h - A models/lnd/clm/test/system/config_files/21p_cncrpsc_dh - A models/lnd/clm/test/system/config_files/21p_cncrpsc_m - A models/lnd/clm/test/system/config_files/21p_cncrpsc_o - A models/lnd/clm/test/system/config_files/21p_cncrpsc_dm ->>>>>>>>>>>>>>> Add test configs without dust - A models/lnd/clm/test/system/config_files/4p_vorsc_dm - A models/lnd/clm/test/system/config_files/4p_vorsc_do - A models/lnd/clm/test/system/config_files/4p_vorsc_ds - A models/lnd/clm/test/system/config_files/17p_vorsc_h - A models/lnd/clm/test/system/config_files/17p_vorsc_m - A models/lnd/clm/test/system/config_files/17p_vorsc_o - A models/lnd/clm/test/system/config_files/4p_vorsc_h - A models/lnd/clm/test/system/config_files/4p_vorsc_o - A models/lnd/clm/test/system/config_files/17p_vorsc_dm - A models/lnd/clm/test/system/config_files/17p_vorsc_dh - A models/lnd/clm/test/system/config_files/17p_vorsc_do - A models/lnd/clm/test/system/config_files/17p_vorsc_ds - A models/lnd/clm/test/system/config_files/4p_vorsc_dh - ->>>>>>>>>>>>>>> Add crop restart variables - A models/lnd/clm/src/biogeochem/CropRestMod.F90 - ->>>>>>>>>>>>>>> Add namelist for crop, and mksurfdata to create crop single point - A models/lnd/clm/test/system/nl_files/nl_crop - A models/lnd/clm/test/system/nl_files/nl_cn_conly - A models/lnd/clm/test/system/nl_files/clm_stdIgnYr - A models/lnd/clm/test/system/nl_files/mksrfdt_1x1_numaIA_mp20irrcr_2000 - - A models/lnd/clm/test/system/TSMrst_tools.sh - Add test to use finidat files - run interpinic on it and then make sure you can startup from the result - ->>>>>>>>>>>>>>> Explicitly add csm_share files into interpinic build - A models/lnd/clm/tools/interpinic/Mkdepends - A models/lnd/clm/tools/interpinic/shr_sys_mod.F90 - A models/lnd/clm/tools/interpinic/shr_log_mod.F90 - A models/lnd/clm/tools/interpinic/shr_kind_mod.F90 - A models/lnd/clm/tools/interpinic/shr_const_mod.F90 - ->>>>>>>>>>>>>>> Add the latest 10x15 initial conditions file to test on - A models/lnd/clm/tools/interpinic/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c100322.nc - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>> Set maxpft to number - M models/lnd/clm/test/system/config_files/README - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cndvsc_m - M models/lnd/clm/test/system/config_files/17p_cndvsc_o - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do - M models/lnd/clm/test/system/config_files/17p_cndvsc_s - M models/lnd/clm/test/system/config_files/_nrmexsc_ds - M models/lnd/clm/test/system/config_files/17p_cnsc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_m - M models/lnd/clm/test/system/config_files/17p_cnsc_dm - M models/lnd/clm/test/system/config_files/_nrvansc_ds - M models/lnd/clm/test/system/config_files/17p_cnsc_do - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dh - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_do - M models/lnd/clm/test/system/config_files/17p_cndvsc_dh - M models/lnd/clm/test/system/config_files/17p_cndvsc_dm - M models/lnd/clm/test/system/config_files/17p_cndvsc_do - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do - M models/lnd/clm/test/system/config_files/4p_vonrsc_ds - M models/lnd/clm/test/system/config_files/17p_cndvsc_h - ->>>>>>>>>>>>>>> Remove some tests add new crop tests - M models/lnd/clm/test/system/README.testnames ---------------- - M models/lnd/clm/test/system/tests_posttag_lynx_nompi -------- - M models/lnd/clm/test/system/tests_pretag_bluefire ----------- - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi ----- - M models/lnd/clm/test/system/tests_pretag_edinburgh ---------- - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi ---- - M models/lnd/clm/test/system/tests_posttag_yong -------------- - M models/lnd/clm/test/system/tests_pretag_jaguarpf ----------- - M models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi ----- - M models/lnd/clm/test/system/tests_posttag_mirage ------------ - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - - M models/lnd/clm/test/system/tests_posttag_nompi_regression -- - - M models/lnd/clm/test/system/TCBtools.sh ------- Add TOOL_ROOT - M models/lnd/clm/test/system/test_driver.sh ---- Use path to glade, update path - M models/lnd/clm/test/system/mknamelist -------- Add ability to set finidat file on - startup - M models/lnd/clm/test/system/input_tests_master Change out vodsrsc for vorsc, - add crop tests, add interpinic restart tests - M models/lnd/clm/test/system/tests_posttag_lynx Add sm9T4 test - M models/lnd/clm/test/system/CLM_runcmnd.sh ---- Remove -d - - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850 Change from 1850-2000 - to just 1850 - M models/lnd/clm/test/system/nl_files/clm_irrig -------------- Use ignore_ic_year - instead of ignore_ic_date - ->>>>>>>>>>>>>>> Add ability to add crop in, add -crop to mksurfdata.pl which sets the ->>>>>>>>>>>>>>> numpft=20 namelist item - M models/lnd/clm/tools/mksurfdata/mkvarpar.F90 - Add numstdpft - M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 - Add numpft - M models/lnd/clm/tools/mksurfdata/ncdio.F90 ---- Add nf_get_att_double/nf_get_var_text - M models/lnd/clm/tools/mksurfdata/mklaiMod.F90 - Use numpft - M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 Add mksrf_flai/mksrf_firrig to file - M models/lnd/clm/tools/mksurfdata/areaMod.F90 -- Put numpft in mkvarctl - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 - Add numpft to namelist - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl Handle crop and irrig and change - names accordingly - M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 - Add numpft and add to namelist - if numpft = 20 add crop in - ->>>>>>>>>>>>>>> Bring in interpinic version from Mariana Vertenstein ->>>>>>>>>>>>>>> Make faster and use less memory, update NetCDF interface, make ->>>>>>>>>>>>>>> standalone so not dependant on other directories - M models/lnd/clm/tools/interpinic/interpinic.F90 - Make faster by saving indices, - use less memory, update to F90 NetCDF interface, make standalone - M models/lnd/clm/tools/interpinic/fmain.F90 ------ Add -a option to NOT override missing - M models/lnd/clm/tools/interpinic/Srcfiles ------- Remove mpi files - M models/lnd/clm/tools/interpinic/Filepath ------- Make standalone - M models/lnd/clm/tools/interpinic/Makefile ------- Use local MkDepends, compare - to null, change interface for testing a bit - M models/lnd/clm/tools/interpinic/README --------- Add note about SMP, update clmi file - M models/lnd/clm/tools/interpinic/interpinic.runoptions Use new file - ->>>>>>>>>>>>>>> Add numpft - M models/lnd/clm/tools/mkgriddata/mkvarctl.F90 - ->>>>>>>>>>>>>>> Add crop/noio remove dust and progsslt and CLAMP setting - M models/lnd/clm/bld/configure ------------- Add -crop/-noio remove -dust/-progsslt - turn RTM off for sitespf_pt, error check crop, maxpft, remove CLAMP setting - M models/lnd/clm/bld/listDefaultNamelist.pl Add loop for crop - M models/lnd/clm/bld/build-namelist -------- Sense crop=on/off, add suplnitro remove - Carbon_only - M models/lnd/clm/bld/clm.cpl7.template ----- Change order of $CLM_CONFIG_OPTS - so will be done last and override other settings - M models/lnd/clm/bld/config_files/config_definition.xml Add crop/noio, remove dust/progsslt - have maxpft only allow numbers up to 21 - ->>>>>>>>>>>>>>> New files for crop, remove old namelist items add new, add crop datasets - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --------- Remove - Carbon_only add suplnitro, remove scaled_harvest, correct spellings - 1x1_numaIA,1x1_smallvilleIA resolutions - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml --- Add - 1x1_numaIA,1x1_smallvilleIA - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ------ Add - 1x1_numaIA,1x1_smallvilleIA - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ------- Add - settings for suplnitro, new fpftcon, finidat for crop f19, add crop parameters - files for crop for f19,f10,1x1_numaIA,1x1_smallvilleIA, fix T31 files - turn create_crop_landunit on for crop - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Add - mksrf_flai/mksrf_fvegtyp for crop add crop=on/off for those files - ->>>>>>>>>>>>>>> Use nsrest parameters, use secspday/days_per_year, handle prognostic crop ->>>>>>>>>>>>>>> Remove CLAMP/is_restart/DUST/DISTURB/CLAMP ->>>>>>>>>>>>>>> if soil also check if crop, use vegetation indices, add initialization ->>>>>>>>>>>>>>> subroutines, pass crop filters down, suplementatal Nitrogen can be for ->>>>>>>>>>>>>>> nothing, just for crop, or for all. - M models/lnd/clm/src/biogeochem/CASAPhenologyMod.F90 ----- Use nsrest parameters, secspday - M models/lnd/clm/src/biogeochem/CNGapMortalityMod.F90 ---- Use secspday - M models/lnd/clm/src/biogeochem/CNGRespMod.F90 ----------- Handle crop - M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 --- Handle crop - M models/lnd/clm/src/biogeochem/CNFireMod.F90 ------------ Use secspday/days_per_year - M models/lnd/clm/src/biogeochem/CNMRespMod.F90 ----------- If crop add livestem - M models/lnd/clm/src/biogeochem/CASAMod.F90 -------------- Remove CLAMP is_restart - if soil or crop, nsrest parameters, use veg indices - M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 Handle crop - M models/lnd/clm/src/biogeochem/CNSummaryMod.F90 --------- Remove CLAMP, add crop - M models/lnd/clm/src/biogeochem/DUSTMod.F90 -------------- Remove DUST, if soil or crop - M models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 ------- Add init and crop-Phenology - M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 --- Add prog crop - M models/lnd/clm/src/biogeochem/CNDecompMod.F90 ---------- Pass crop filter down - use secspday - M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ------- Remove extra use - M models/lnd/clm/src/biogeochem/CNrestMod.F90 ------------ Remove is_restart - M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 ---- Add CROP #ifdef to CNDV - M models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 ------- Use dayspyr and secspday - M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 ------ Add init subroutine - section for prognostic crop, supplemental Nitrogen can be on for nothing, - crop only, or everything - M models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 ---- Add init subroutine, - add crop filters - M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 -------- Set crop vars remove CLAMP - M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 - Add if section for crop - M models/lnd/clm/src/biogeochem/CNDVEstablishmentMod.F90 - Remove DISTURB - ->>>>>>>>>>>>>>> Use nsrest parameters, update ESMF interface - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 --- Use nsrest parameters - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - Update interface from Tony Craig - Use nsrest parameters, use phase as a keyword. - M models/lnd/clm/src/cpl_esmf/lnd_comp_mct.F90 -- Update interface from Tony Craig - compare success to ESMF_SUCCESS rather than 0. - ->>>>>>>>>>>>>>> Add istcrop and if statements for istsoil also test for istcrop ->>>>>>>>>>>>>>> Remove CLAMP/DUST/PROGSSLT/debug ifdef/vcmx25/dw_fcel/dw_flig ->>>>>>>>>>>>>>> /scaled_harv/ bad hist indices. Set if prog_crop in surfrdMod ->>>>>>>>>>>>>>> Use secspday and days_per_year, more vars on pft-physiology file ->>>>>>>>>>>>>>> Add parameters for nsrest settings, new hist vars, error check CROP - M models/lnd/clm/src/main/clm_varcon.F90 -------- Add istcrop - M models/lnd/clm/src/main/clm_varpar.F90 -------- Add numveg and mxpft - M models/lnd/clm/src/main/CNiniTimeVar.F90 ------ Remove CLAMP, if soil or crop - also set some crop vars - M models/lnd/clm/src/main/dynlandMod.F90 -------- If soil or crop - M models/lnd/clm/src/main/accumulMod.F90 -------- Remove is_restart, add missing to _PERIOD - M models/lnd/clm/src/main/clm_initializeMod.F90 - Remove CLAMP/DUST, use nsrest parameters - add call to CNEcosystemDynInit - M models/lnd/clm/src/main/subgridRestMod.F90 ---- Remove incorrect grid indices (bug 1310) - M models/lnd/clm/src/main/accFldsMod.F90 -------- Add GDD0/8/10/PLANT/HARV/TSOI/TDM5/10 - M models/lnd/clm/src/main/clmtypeInitMod.F90 ---- Remove CLAMP - CROP & C13 is not valid, add crop vars, remove vcmx25/dw_fcel/dw_flig - M models/lnd/clm/src/main/ndepStreamMod.F90 ----- Use secspday in place of 86400 - M models/lnd/clm/src/main/pftdynMod.F90 --------- Use days_per_year in place of 365 - move pconv/pprod10/pprod100 to pft-physiology file, if soil or crop - use nsrest parameters, remove scaled_harvest - M models/lnd/clm/src/main/iniTimeConst.F90 ------ Add graincn, remove: vcmx25/dw_fcel/dw_flig - M models/lnd/clm/src/main/histFileMod.F90 ------- Use secspday in place of 86400 - fix Conventions, use nsrest parameters, comment out indices (bug 1310) - M models/lnd/clm/src/main/clm_atmlnd.F90 -------- Remove DUST/PROGSSLT/1==1 - M models/lnd/clm/src/main/restFileMod.F90 ------- Use nsrest parameters, add CropRest - fix Conventions - M models/lnd/clm/src/main/controlMod.F90 -------- Remove scaled_harvest/Carbon_only - use nsrest parameters, add suplnitro - M models/lnd/clm/src/main/initSurfAlbMod.F90 ---- if soil or crop, send crop filters - to CNEcosystemDyn - M models/lnd/clm/src/main/clm_time_manager.F90 -- Remove COUP_WRF, add get_driver_start_ymd - M models/lnd/clm/src/main/filterMod.F90 --------- Add filter for prognostic-crop - if soil or crop - M models/lnd/clm/src/main/clm_varctl.F90 -------- Add parameters for nsrest valid - values: nsrStartup, nsrContinue, nsrBranch, remove scaled_harvest - make sure crop allocates all PFT's - M models/lnd/clm/src/main/clm_driver.F90 -------- Remove DUST send crop filters - to CNEcosystemDyn - M models/lnd/clm/src/main/initGridCellsMod.F90 -- If crop send istcrop to set_landunit_crop_noncompete - M models/lnd/clm/src/main/CASAiniTimeVarMod.F90 - Remove CLAMP - M models/lnd/clm/src/main/pftvarcon.F90 --------- Add crop vars, corn, - temperate sping/winter cereal, and soybean, remove vcmx25/dw_flig/dw_fcel - add new variables for crop add npcropmin, npcropmax and error checking - M models/lnd/clm/src/main/ncdio_pio.F90 --------- Add logical field support - M models/lnd/clm/src/main/spmdMod.F90 ----------- Add MPI_LOR - M models/lnd/clm/src/main/surfrdMod.F90 --------- Add crop_prog as public module data - Remove TCX_REMOVE_SEE_NOTES_ABOVE, error checking if prognostic crops avail - and CROP not defined and vice versa - M models/lnd/clm/src/main/clmtype.F90 ----------- New variables for CROP, remove CLAMP - Remove dw_fcel, dw_flig, vcmx25 - M models/lnd/clm/src/main/histFldsMod.F90 ------- Remove CLAMP and DUST, T10 output - for CNDV or CROP, add A5TMIN, A10TMIN, GDD0, GDD8, GDD10, GDD020, GDD820, - GDD1020, GDDPLANT, GDDTSOI and GDDHARV for crop (as inactive) - - M models/lnd/clm/src/main/mkarbinitMod.F90 ------ If soil or crop - - M models/lnd/clm/src/riverroute/RtmMod.F90 - Remove L2R_Decomp #ifdef, and #if (1 == - Remove is_restart and use clm_time_manager version. -0) - ->>>>>>>>>>>>>>> Change if statements on "if soil" to "if soil or crop" ->>>>>>>>>>>>>>> Remove DUST, NO_DAYLEN_VCMAX #ifdefs, is_restart, vcmx25, avcmx, ->>>>>>>>>>>>>>> and SNICAR stats. vcmx calc is different for crop and btran for soybean - M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 - If soil or crop - M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 -- If soil or crop - M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 ---- If soil or crop - M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 --- If soil or crop - M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 --- If soil or crop - M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 - Remove DUST #ifdef - M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 ---- If soil or crop - M models/lnd/clm/src/biogeophys/Hydrology1Mod.F90 ------- If soil, urb, wet or crop - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 ------- If soil or crop - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 --- Remove is_restart use - clm_time_manger version, use nsrest parameters - M models/lnd/clm/src/biogeophys/SNICARMod.F90 ----------- Remove commented out SNICAR stats - M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 - If soil or crop - M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 ----- Remove NO_DAYLEN_VCMAX, - and vcmx25,avcmx, vcmx calc different for crop and btran for soybean. - -Summary of testing: - - bluefire: All PASS except... -008 blAZ1 TBL.sh 21p_cncrpsc_dh clm_irrig^nl_crop 20020401:3600 10x15 USGS -10 cold .............FAIL! rc= 5 -015 blE91 TBL.sh 4p_vorsc_dh clm_std^nl_urb 20021230:1800 4x5 gx3v7 48 arb_ic ...................FAIL! rc= 5 -020 blF92 TBL.sh 17p_vorsc_dm clm_std^nl_urb 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 5 -024 blEH1 TBL.sh 4p_vorsc_dh clm_std^nl_urb 20021231:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic ......FAIL! rc= 5 -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -041 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:3600 10x15 USGS@1850-2000 -10 arb_ic ..............FAIL! rc= 7 -059 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -060 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -061 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -062 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except... -032 blF93 TBL.sh 17p_vorsc_do clm_std^nl_urb 20021230:1800 4x5 gx3v7 48 cold ....................FAIL! rc= 5 -056 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 6 -057 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 6 -058 sm8Z3 TSMrst_tools.sh 21p_cncrpsc_do interpinic clm_irrig^nl_crop 20000101:1800 1.9x2.5 gx1v6 10FAIL! rc= 4 - bluefire/CESM testing: All PASS except... (dens, fv and ram1 change) -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_26 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_26 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_26 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_26 -FAIL SMS_ROA.f45_f45.I.bluefire.compare_hist.clm4_0_26 -FAIL SMS_ROA.f45_f45.I.bluefire.compare.clm4_0_26 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_26 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_26 -FAIL PST.f45_g37.I1850.bluefire.compare.clm4_0_26 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm4_0_26 -FAIL ERS_E.f19_g16.I1850.bluefire.compare_hist.clm4_0_26 -FAIL ERS_E.f19_g16.I1850.bluefire.compare.clm4_0_26 -FAIL ERI.f19_g16.IG1850.bluefire.compare.clm4_0_26 -SFAIL ERS_D.T31_g37.IGRCP26CN.bluefire.GC.231059 -SFAIL ERP.T31_g37.IGRCP60CN.bluefire.GC.231059 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_26 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_26 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_26 -FAIL PST.f10_f10.I20TRCN.bluefire.compare.clm4_0_26 -FAIL PET_PT.f10_f10.I20TRCN.bluefire.compare.clm4_0_26 -FAIL SMS.f10_f10.IRCP45CN.bluefire.compare_hist.clm4_0_26 -FAIL SMS.f10_f10.IRCP45CN.bluefire.compare.clm4_0_26 - bluefire/PTCLM testing: All PASS up to.. -US-Ha1_ICN_ad_spinup.PTCLM PASS - jaguarpf interactive testing: All PASS up to... -008 blAZ3 TBL.sh 21p_cncrpsc_do clm_irrig^nl_crop 20020401:3600 10x15 USGS -10 cold .............FAIL! rc= 5 -011 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -012 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -013 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -014 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -035 sm8Z3 TSMrst_tools.sh 21p_cncrpsc_do interpinic clm_irrig^nl_crop 20000101:1800 1.9x2.5 gx1v6 10FAIL! rc= 4 - edinburgh/lf95 interactive testing: All PASS except... -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:1800 1x1_brazil navy -10 arb_ic ...............FAIL! rc= 7 -010 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic .............FAIL! rc= 7 -014 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:3600 1x1_vancouverCAN navy 331 arb_ic ...FAIL! rc= 7 -018 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:3600 1x1_mexicocityMEX navy 158 arb_ic ..FAIL! rc= 7 -026 blL74 TBL.sh _nrsc_s clm_std^nl_urb 20020101:1800 1x1_brazil navy -10 arb_ic ................FAIL! rc= 7 - mirage,storm/ifort interactive testing: All PASS except... -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 10+38 arb_ic ...........FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_26 - -Changes answers relative to baseline: no bit-for-bit - with the exception that the new crop mode is NOT in previous tags - -=============================================================== -=============================================================== -Tag name: clm4_0_26 -Originator(s): erik (Erik Kluzek) -Date: Wed Mar 23 11:43:00 MDT 2011 -One-line Summary: Update externals, driver update changes answers, drydep changes from fvitt, fix bugs - -Purpose of changes: - -Update externals to latest pre-cesm1_0_beta17 version. driver to beyond cesm1_0_beta16 -version -- so answers change. Always update ndep_interp in clm_driver -- so restarts are -exact. Bring in Francis Vitt drydep changes. Remove bad T31 pftdyn datasets add in -a new T31 rcp2.6 T31 dataset. Fix interpinic _var bug. Remove HIRES from bld. Change -tools Makefile's so that you can set env variables. Change test_driver to use newer -version of cprnc. - -Bugs fixed (include bugzilla ID): - 1284 (Crop restart test fails) - 1304 (bug in interpinic *_var) - 1308 (tools Make doesn't allow setting env vars) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: more fields added for drydep namelist - -List any changes to the defaults for the boundary datasets: - Remove bad T31 pftdyn datasets - -Describe any substantial timing or memory changes: none - -Code reviewed by: self, drydep changes from fvitt and JFL - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, cprnc - - scripts to scripts4_110314 - drv to drvseq3_1_51 - cprnc to cprnc_110310 - -List all files eliminated: None - -List all files added and what they do: - - A README_EXTERNALS -- Describes how to work with externals (similar to cam file) - -List all existing files that have been modified, and describe the changes: - - M README - Update with new - - M models/lnd/clm/test/system/CLM_compare.sh - Update for latest cprnc which - doesn't have a "completed successfully line at the end" - M models/lnd/clm/test/system/test_driver.sh - Use newer cprnc on bluefire - ->>>>>>>>>>> Change tools build so that you can set env variables for SMP/USER_FC/CC - M models/lnd/clm/tools/mksurfdata/Makefile -------- Compare to ,null rather than strip - M models/lnd/clm/tools/interpinic/Makefile -------- Compare to ,null rather than strip - M models/lnd/clm/tools/mkgriddata/Makefile -------- Compare to ,null rather than strip - M models/lnd/clm/tools/mkdatadomain/Makefile ------ Compare to ,null rather than strip - - M models/lnd/clm/tools/interpinic/interpinic.F90 -- Make sure htop_var/fpcgrid_var - are initialized to false each time comes into routine (bug 1304) - - M models/lnd/clm/bld/configure -- Remove HIRES setting for stand-alone testing - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - New rcp2.6 T31 - pftdyn dataset remove rcp4.5,6,8.5 T31 pftdyn files as they only go to 2035 - - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - Pick wesveg and index_season - differently for special landunits, add max for rc, assume no surface - resistance for SO2 over water, use has_rain logical (from fvitt) - M models/lnd/clm/src/main/clm_driver.F90 ----------- Always call ndep_interp - even if (stream_year_first_ndep /= stream_year_last_ndep) as can change - answers if not - -Summary of testing: - - bluefire: All PASS except TBL tests and... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -063 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -064 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -065 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 - bluefire interactive testing: All PASS except TBL tests - bluefire/CESM testing: All PASS (even the comparision tests) - bluefire/PTCLM testing: All PASS up to... -US-Ha1_ICN_ad_spinup.PTCLM PASS - edinburgh/lf95 interactive testing: All PASS except... -021 brVx3 TBR.sh _mec10sc_do clm_transient_glcMEC_rcp4.5^nl_urb_br 20331231:1800 48x96 gx3v7@1850-21FAIL! rc= 10 - mirage,storm/ifort interactive testing: All PASS except TBL tests and... -016 smVx3 TSM.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 10 -017 erVx3 TER.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -4+-6 aFAIL! rc= 5 -018 brVx3 TBR.sh _mec10sc_do clm_transient_glcMEC_rcp4.5^nl_urb_br 20331231:1800 48x96 gx3v7@1850-21FAIL! rc= 5 -024 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -025 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 10+38 arb_ic ...........FAIL! rc= 5 -026 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 - yong/ifort interactive testing: All PASS except... -011 smD94 TSM.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_25 - -Changes answers relative to baseline: Yes! Greater than roundoff - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change:(larger than roundoff/same climate - - driver mapping changes, drydep code has changes, ndep_interp is always called - which changes answers on some platforms/compilers (such as intel compiler). - -=============================================================== -=============================================================== -Tag name: clm4_0_25 -Originator(s): erik (Erik Kluzek) -Date: Tue Mar 22 10:13:08 MDT 2011 -One-line Summary: Always output restart-history files add more meta-data to them, - fix urbanc_alpha and 2.5x3.33 datasets, Changes from Keith O on SNOWLIQ/SNOWICE - -Purpose of changes: - -Move history namelist information to restart history files and always output them. Add -attributes and meta-data to the restart history files. Fix urbanc_alpha test site surface -dataset. Fix datm namelist for urban cases. Use new crop pft-physiology file. Update -scripts and csm_share. Changes from Keith O on SNOWLIQ/SNOWICE so goes to zero rather -than missing value. Update 2.5x3.33 datasets. Fix dvolrdt units documentation, call -mksoifmaxInit. - -Bugs fixed (include bugzilla ID): - 1247 (Some changes to ncd_pio in clm) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - New pft-physiology file with fields for prognostic crop - New surface dataset for urbanc_alpha - New grid/topo/frac/domain files for 2.5x3.33 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, snowliq/snowice changes by oleson - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm, cism, csm_share - - scripts to scripts4_110204 - datm to datm8_110210 - cism to cism1_110220 - csm_share to share3_110201 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/input_tests_master - Change start dates of urban tests - ->>>>>>>>>>>> Move mksoil*Init subroutines private to mksoilMod, and call a mksoilInit ->>>>>>>>>>>> routine from mksrfdata, making sure mksoifmaxInit is called. - M models/lnd/clm/tools/mksurfdata/mksoilMod.F90 - Add mksoilInit to call - mksoitexInit/mksoicolInit and mksoifmaxInit (mksoifmaxInit was missing) - fix mksoifmaxInit, and make mksoitex/col/fmaxInit routines private - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 -- Call mksoilInit, - remove mksoicol/texInit - ->>>>>>>>>>>> Add notes about setting path to NetCDF, and other gmake options - M models/lnd/clm/tools/mksurfdata/README - M models/lnd/clm/tools/interpinic/README - M models/lnd/clm/tools/mkgriddata/README - M models/lnd/clm/tools/mkdatadomain/README - - M models/lnd/clm/bld/queryDefaultNamelist.pl - Remove white-space from input options - M models/lnd/clm/bld/listDefaultNamelist.pl -- Also list datm_internal files - M models/lnd/clm/bld/build-namelist ---------- Add drv_final_spinup from PTCLM - document precidence of the different env_conf.xml - ->>>>>>>>>>>> Fix 2.5x3.33 and urbanc_alpha files, change some settings for CLM1PT ->>>>>>>>>>>> or pt1_pt1 resolution, remove ndepsrc. - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --------- Add - taxmode and dtlimit, add 2.5x3.33 resolution - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml --- Add - sim_year="2000" sim_year_range="constant" for pft1_pt1 datm_presaero files - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ------ Add - 1x1_numaIA and 1x1_smallvilleIA domain/preseaero files, update 2.5x3.33 domain - make mapalgo nn for CLM1PT, set taxmode and tintalgo appropriately - if CLM1PT is set. Add transient presaero file for 1x1_tropicAtl. - M models/lnd/clm/bld/namelist_files/use_cases/stdurbpt_pd.xml ------- Set - dtime to 1800 for 1x1_urbanc_alpha - M models/lnd/clm/bld/namelist_files/datm-build-namelist ------------- Set - tintalgo, mapalgo by datm_source, and set taxmode as well. Remove - option for datm_presaero="none". Set mapalgo=nn for datm_presaero=pt1_pt1. - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ------- Update - urbanc_alpha surface dataset, 2.5x3.33 grid/topo/frac datasets - Remove ndepsrc="stream" in ndepmapalgo settings as doesn't exist anymore. - Use latest pft-physiology file from CROP branch (has extra data needed - for prognostic crop) - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ------- Set - atm_cpl_dt=1800 for urbanc_alpha, set stop_option/stop_n for - urban sites carefully (add 1 time-step to stop_n, double for urbanc_alpha). - Use "test" mask for urbanc_alpha - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Remove - ndepsrc="stream" - ->>>>>>>>>>>> Add meta-data to restart hist files, put history restart data on ->>>>>>>>>>>> restart hist files and off master restart files (so initial condition ->>>>>>>>>>>> files aren't cluttered with information only needed for continue runs). ->>>>>>>>>>>> Some changes to SNOWLIQ/SNOWICE, document dvolrdt units. - M models/lnd/clm/src/main/histFileMod.F90 - Use htape_create for restart_hist - files, modify hist_restart_ncd so that namelist vars on one restart - history files and they are always output, add more metadata to - restart hist files, remove some temp arrays. Restart history files - now always needed for continue runs, but not for other run types, - and restart history information does not clutter the master restart - files. The only history variables on master restart files are the - history and restart filenames. Comments on the files make this clear. - M models/lnd/clm/src/main/restFileMod.F90 - Change hist_restart_ncd calls - M models/lnd/clm/src/main/ncdio_pio.F90 --- Add ncd_io_log_var0_nf interface - add options for attributes: comment, flag_values, flag_meanings, and - nvalid_range for variables., fix an issue in ncd_io_int_var0_nf - M models/lnd/clm/src/main/histFldsMod.F90 - Change default for SNOWLIQ/SNOWICE - to "Average" rather than "Instant" (from oleson). - M models/lnd/clm/src/riverroute/RtmMod.F90 ---- Document dvolrdt conversion - M models/lnd/clm/src/riverroute/RunoffMod.F90 - Document dvolrdt units - correctly. - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 - Initialize snowice/snowliq - to zero over lake filter (from oleson). - -Summary of testing: - - bluefire: All PASS except TBL tests and... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -063 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -064 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -065 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 - bluefire interactive testing: All PASS except all TBL tests fail - bluefire/CESM testing: All PASS except... -FAIL SMS_RLA.f45_f45.I.bluefire.generate.clm4_0_25 -FAIL SMS_RLB.f45_f45.I.bluefire.generate.clm4_0_25 -FAIL SMS_ROA.f45_f45.I.bluefire.generate.clm4_0_25 -FAIL ERS_D.f45_g37.I.bluefire.generate.clm4_0_25 -BFAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_23 -FAIL PST.f45_g37.I1850.bluefire.generate.clm4_0_25 -FAIL PET_PT.f45_g37.I1850.bluefire.generate.clm4_0_25 -FAIL ERS_E.f19_g16.I1850.bluefire.generate.clm4_0_25 -FAIL ERI.f19_g16.IG1850.bluefire.generate.clm4_0_25 -FAIL ERS_D.T31_g37.IGRCP26CN.bluefire.generate.clm4_0_25 -FAIL ERP.T31_g37.IGRCP60CN.bluefire.generate.clm4_0_25 -BFAIL ERP.T31_g37.IGRCP60CN.bluefire.compare.clm4_0_23 -FAIL ERB.f09_g16.I_1948-2004.bluefire.generate.clm4_0_25 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_25 -FAIL ERH_D.f10_f10.I1850CN.bluefire.generate.clm4_0_25 -BFAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_23 -FAIL PST.f10_f10.I20TRCN.bluefire.generate.clm4_0_25 -FAIL PET_PT.f10_f10.I20TRCN.bluefire.generate.clm4_0_25 -FAIL SMS.f10_f10.IRCP45CN.bluefire.generate.clm4_0_25 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.generate.clm4_0_25 -BFAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_23 - jaguarpf interactive testing: -002 erA74 TER.sh _nrsc_ds clm_std^nl_urb 20030101:1800 1x1_brazil navy -5+-5 arb_ic .............FAIL! rc= 13 -003 brA74 TBR.sh _nrsc_ds clm_std^nl_urb_br 20030101:1800 1x1_brazil navy -5+-5 arb_ic ..........FAIL! rc= 11 -006 erAZ3 TER.sh _sc_do clm_irrig 20020401:3600 10x15 USGS -3+-7 cold ...........................FAIL! rc= 13 -007 brAZ3 TBR.sh _sc_do clm_irrig 20020401:3600 10x15 USGS -5+-5 cold ...........................FAIL! rc= 11 -011 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -012 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -013 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -016 erJ74 TER.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:3600 1x1_tropicAtl test -10+-10 arb_ic ..FAIL! rc= 13 -017 brJ74 TBR.sh 4p_nrcasasc_ds clm_std^nl_urb_br 10001230:3600 1x1_tropicAtl test -3+-3 arb_ic .FAIL! rc= 11 -020 erK74 TER.sh 17p_cndvsc_s clm_std 19971231:1800 1x1_brazil navy -334+-336 arb_ic ............FAIL! rc= 13 -021 brK74 TBR.sh 17p_cndvsc_s clm_std 19971231:1800 1x1_brazil navy -334+-336 arb_ic ............FAIL! rc= 11 -024 erVx3 TER.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -4+-6 aFAIL! rc= 13 -025 brVx3 TBR.sh _mec10sc_do clm_transient_glcMEC_rcp4.5^nl_urb_br 20331231:1800 48x96 gx3v7@1850-21FAIL! rc= 11 -028 erHQ4 TER.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -3+-7 cold ............FAIL! rc= 13 -029 brHQ4 TBR.sh _nrcnsc_ds clm_drydep 20000214:1800 1x1_brazil navy@2000 -5+-5 cold ............FAIL! rc= 11 -032 erV63 TER.sh _mec10sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 10+38 arb_ic ................FAIL! rc= 13 - jaguarpf/CESM testing: All PASS including comparision tests except... -FAIL PST.f10_f10.I20TRCN.jaguarpf - edinburgh/lf95 interactive testing: -002 erA74 TER.sh _nrsc_ds clm_std^nl_urb 20030101:1800 1x1_brazil navy -5+-5 arb_ic .............FAIL! rc= 13 -003 brA74 TBR.sh _nrsc_ds clm_std^nl_urb_br 20030101:1800 1x1_brazil navy -5+-5 arb_ic ..........FAIL! rc= 11 -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:1800 1x1_brazil navy -10 arb_ic ...............FAIL! rc= 7 -006 blAL4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 7 -008 erCA4 TER.sh _nrsc_ds clm_std^nl_urb 20021001:3600 1x1_camdenNJ navy -45+-45 arb_ic .........FAIL! rc= 13 -009 brCA4 TBR.sh _nrsc_ds clm_std^nl_urb_br 20021001:3600 1x1_camdenNJ navy -10+-10 arb_ic ......FAIL! rc= 11 -010 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:3600 1x1_camdenNJ navy -90 arb_ic .............FAIL! rc= 7 -012 erOC4 TER.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:3600 1x1_vancouverCAN navy 115+115 arb_ic FAIL! rc= 13 -013 brOC4 TBR.sh _nrvansc_ds clm_urb1pt^nl_urb_br 19920812:3600 1x1_vancouverCAN navy 72+72 arb_ic FAIL! rc= 11 -014 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:3600 1x1_vancouverCAN navy 331 arb_ic ...FAIL! rc= 5 -016 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:3600 1x1_mexicocityMEX navy 58+100 arb_ic FAIL! rc= 13 -017 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:3600 1x1_mexicocityMEX navy 72+72 arb_ic FAIL! rc= 11 -018 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:3600 1x1_mexicocityMEX navy 158 arb_ic ..FAIL! rc= 5 -020 erVx3 TER.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -4+-6 aFAIL! rc= 13 -021 brVx3 TBR.sh _mec10sc_do clm_transient_glcMEC_rcp4.5^nl_urb_br 20331231:1800 48x96 gx3v7@1850-21FAIL! rc= 11 -022 blVx3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 7 -024 erL74 TER.sh _nrsc_s clm_std^nl_urb 20020101:1800 1x1_brazil navy -5+-5 arb_ic ..............FAIL! rc= 13 -025 brL74 TBR.sh _nrsc_s clm_std^nl_urb_br 20020101:1800 1x1_brazil navy -10+-10 arb_ic .........FAIL! rc= 11 -026 blL74 TBL.sh _nrsc_s clm_std^nl_urb 20020101:1800 1x1_brazil navy -10 arb_ic ................FAIL! rc= 7 - edinburgh/CESM testing: All PASS including comparision tests - yong/intel testing: -011 smD94 TSM.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 2 -012 erD94 TER.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 72+72 cold ....................FAIL! rc= 5 -019 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 13 -020 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 11 -022 smV24 TSM.sh _mec10sc_ds clm_glcmec 19980115:1800 48x96 gx3v7 96 arb_ic .....................FAIL! rc= 10 -023 erV24 TER.sh _mec10sc_ds clm_glcmec 19980115:1800 48x96 gx3v7 10+38 arb_ic ..................FAIL! rc= 5 -024 brV24 TBR.sh _mec10sc_ds clm_glcmec^nl_urb_br 19980115:1800 48x96 gx3v7 72+72 arb_ic ........FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_24 - -Changes answers relative to baseline: answers bit-for-bit, but SNOWLIQ/SNOWICE on history - files change. - -=============================================================== -=============================================================== -Tag name: clm4_0_24 -Originator(s): erik (Erik Kluzek) -Date: Wed Feb 9 13:20:39 MST 2011 -One-line Summary: Fix mksurfdata and add ability to override soil_fmax - -Purpose of changes: - -Fix mksurfdata for urban. Add soil_fmx to mksurfdata. Add attributes to suface datasets -that tell you the special namelist settings (such as all_urban, soil_, pft_). Add -irrig -as option to mksurfdata.pl. Update datm with new datasets for urbanc_alpha. Add new frac -dataset for urbanc_alpha. Update documentation to cesm1_0_rel_09_clm4_0_14 tag. Change -test_driver from jaguar to jaguarpf. Fix bug in build-namelist creating namelist -with clm_usr_name option. - -Bugs fixed (include bugzilla ID): - 1281 (bug in mksurfdata for urban_only case) - 1280 (improve modularity of mksurfdata) [partial] - 1276 (urbanc_alpha site does not work) [partial] - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1283 (CLM with glacier-MEC fails running on intel) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Update frac and domain file for urbanc_alpha site - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts, drv and csm_share to cesm1_0_beta15 versions - - scripts to scripts4_110204 - drv to drvseq3_1_48 - csm_share to share3_110201 - datm to datm8_110204 - -List all files eliminated: - - D models/lnd/clm/tools/mksurfdata/mkfmaxMod.F90 --- Put inside of mksoilMod.F90 - - D models/lnd/clm/test/system/tests_pretag_jaguar ------- rename to jaguarpf - D models/lnd/clm/test/system/tests_pretag_jaguar_nompi - rename to jaguarpf - ->>>>>>>>>>>> Remove files that were no longer used ->>>>>>>>>>>> (they are already in mksoilMod or mkpftMod) - D models/lnd/clm/tools/mksurfdata/mkorganic.F90 - D models/lnd/clm/tools/mksurfdata/mkrank.F90 - D models/lnd/clm/tools/mksurfdata/mkirrig.F90 - D models/lnd/clm/tools/mksurfdata/mksoicolMod.F90 - -List all files added and what they do: - ->>>>>>>>>>>> Add an irrigation and urban test for mksurfdata - A models/lnd/clm/test/system/nl_files/mksrfdt_10x15_irr_1850 - A models/lnd/clm/test/system/nl_files/mksrfdt_1x1_vancouverCAN_2000 - - A models/lnd/clm/test/system/tests_pretag_jaguarpf ------- rename from jaguar - A models/lnd/clm/test/system/tests_pretag_jaguarpf_nompi - rename from jaguar - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Add all_urban and irrigation mksurfdata tests ->>>>>>>>>>>> Update jaguar to jaguarpf - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_posttag_yong - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/input_tests_master - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/TCBtools.sh ---- Remove copy of *.h files - M models/lnd/clm/test/system/test_driver.sh - change jaguar to jaguarpf, update - modules to agree with scripts - M models/lnd/clm/test/system/CLM_runcmnd.sh - change jaguar to jaguarpf - ->>>>>>>>>>>> Add soil_fmax option and soil_fmx, soil_col and irrig option to ->>>>>>>>>>>> mksurfdata.pl. Add attributes to file for override cases. ->>>>>>>>>>>> Put mkfmax inside of mksoilMod, add mksoilAtt and mkpftAtt methods. - M models/lnd/clm/tools/mksurfdata/Srcfiles -------- Remove unused files - M models/lnd/clm/tools/mksurfdata/mksoilMod.F90 --- Move mkfmax inside here - add mksoifmaxInit, mkfmax, and mksoilAtt interfaces, add soil_fmax as - an override setting - M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 ---- Fix bug in if statement - (needed to also ask if .not. zerod_out). Create mkpftAtt interface, move - settings from mkfileMod.F90 to there. - M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 --- Move soil and pft specific - declarations to either mksoilAtt or mkpftAt interfaces - if all_urban is set add all_urban=TRUE attribute to file - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ---- Add soil_fmax to namelist - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl --- Add ability to set soil_col, - soil_fmax and irrig on command line - bring irrigation, setting of numpft and query of lai file from crop branch - ->>>>>>>>>>>> Update urbanc_alpha domain/frac files - M models/lnd/clm/bld/namelist_files/namelist_definition.xml -------- Add mksrf_flai - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -- Set - urbanc_alpha default mask to test - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ----- urbanc_alpha - domain file - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ------ urbanc_alpha - frac file - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml Add in - mksrf_flai file - ->>>>>>>>>>>> Update to cesm1_0_rel_09_clm4_0_14 documentation (includes info on new bugs) - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/KnownBugs - -Summary of testing: - - bluefire interactive testing: -009 blHS3 TBL.sh _nrcnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic ......FAIL! rc= 5 - jaguarpf interactive testing: -011 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -012 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -013 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -014 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -026 blVx3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 5 -034 blV63 TBL.sh _mec10sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ...................FAIL! rc= 7 - edinburgh/lf95 interactive testing: -022 blVx3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 5 - mirage/intel interactive testing: All PASS except... -017 erVx3 TER.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -4+-6 aFAIL! rc= 5 -018 brVx3 TBR.sh _mec10sc_do clm_transient_glcMEC_rcp4.5^nl_urb_br 20331231:1800 48x96 gx3v7@1850-21FAIL! rc= 5 -019 blVx3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 4 -021 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:1800 10x15 USGS@1850 10+38 cold .........FAIL! rc= 13 -022 brR53 TBR.sh 17p_cnc13sc_do clm_std^nl_urb_br 20020115:1800 10x15 USGS@1850 72+72 cold ......FAIL! rc= 11 -024 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -025 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 10+38 arb_ic ...........FAIL! rc= 5 -026 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -027 blG53 TBL.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -029 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 13 -030 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 11 - yong/intel interactive testing: -011 smD94 TSM.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 10 -012 erD94 TER.sh _persc_ds clm_per^nl_per 20021231:1200 4x5 gx3v7 72+72 cold ....................FAIL! rc= 5 -019 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 13 -020 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 11 -022 smV24 TSM.sh _mec10sc_ds clm_glcmec 19980115:1800 48x96 gx3v7 96 arb_ic .....................FAIL! rc= 10 -023 erV24 TER.sh _mec10sc_ds clm_glcmec 19980115:1800 48x96 gx3v7 10+38 arb_ic ..................FAIL! rc= 5 -024 brV24 TBR.sh _mec10sc_ds clm_glcmec^nl_urb_br 19980115:1800 48x96 gx3v7 72+72 arb_ic ........FAIL! rc= 5 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_23 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_23 -Originator(s): erik (Erik Kluzek) -Date: Thu Feb 3 13:42:17 MST 2011 -One-line Summary: Add in new glacier-MEC use-cases - -Purpose of changes: - -Add in new datasets and use-cases for glc_mec to support glc_nec=10 for 1850, 2000, -1850-2000, and 1850-2100 for all 4 rcp's. Standardize naming convention for use-cases. -Use scripts branch that has new compsets in it that access the new use-cases. Make sure -ncdpio is used for all I/O. Work with PTCLM a bit, and PTCLM testing. Change precedence -for build-namelist so that use-case is lower after user_nl_clm. - -Bugs fixed (include bugzilla ID): - 1273 (fix pts_mode problem on jaguar) - 1256 (fix PTCLM testcases.csh on jaguar to use netcdf/3) - 1254 (PTCLM add .nc and date to pft-physiology file copy) - 1250 (add scratchroot in PTCLM for generic machines) - 1247 (some changes in ncdio_pio) [partial] - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1168 (Change precedence so user_nl_clm used over use-case) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1276 (urbanc_alpha site does not work) - 1279 (Latest version of PTCLM requires python2.5) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Change order of precedence so that - use_case is AFTER -namelist -infile and clm_usr_name options. - Thus values in your user_nl_clm file will be used instead of what's in - the use_case. - - New precedence is... - 1. values set on the command-line using the -namelist option, - 2. values read from the file specified by -infile, - 3. datasets from the -clm_usr_name option, - 4. values set from a use-case scenario, e.g., -use_case - 5. values from the namelist defaults file. -List any changes to the defaults for the boundary datasets: - New datasets for glc_nec="10" - surfdata for 1850@(f09,f19,T31) - pftdyn for 1850-2000@(f09,f19,T31) - pftdyn for 1850-2100@(f09,f19,T31) rcp (2.6,4.5,6,8.5) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm, cism - - scripts to glccsbr01_scripts4_110111 - datm to datm8_110124 - cism to cism1_110125 - -List all files eliminated: - - Rename use-cases to versions with an _pd ending or 2000_*_control form - - models/lnd/clm/bld/namelist_files/use_cases/... - D .../use_cases/stdurbpt.xml ----- rename to stdurbpt_pd - D .../use_cases/glacier_mec.xml -- rename to 2000_glacierMEC_control - D .../use_cases/pergro.xml ------- rename to pergro_pd - D .../use_cases/pergro0.xml ------ rename to pergro0_pd - -List all files added and what they do: - ->>>>>>>>>>>>>> Add tests for all new glacier-MEC use-cases - A models/lnd/clm/test/system/nl_files/clm_glcmec - A models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp2.6 - A models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp4.5 - A models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp8.5 - A models/lnd/clm/test/system/nl_files/clm_transient_glcMEC_rcp6 - - A models/lnd/clm/test/system/nl_files/nl_per - PERGRO testing namelist - ->>>>>>>>>>>>>> - models/lnd/clm/bld/namelist_files/use_cases/... - A .../use_cases/pergro_pd.xml -------------- Renamed from pergro - A .../use_cases/2000_glacierMEC_control.xml Copy of glacier_mec_pd - A .../use_cases/stdurbpt_pd.xml ------------ Renamed from stdurbpt - A .../use_cases/pergro0_pd.xml ------------- Renamed from pergro0 - A .../use_cases/README --------------------- Add README file to describe - naming convention for use_cases - ->>>>>>>>>>>>>> Add new glacier_MEC use_cases - models/lnd/clm/bld/namelist_files/use_cases/... - A .../use_cases/1850_glacierMEC_control.xml - A .../use_cases/20thC_glacierMEC_transient.xml - A .../use_cases/1850-2100_rcp6_glacierMEC_transient.xml - A .../use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - A .../use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - A .../use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - A .../use_cases/glacierMEC_pd.xml --- renamed from glacier_mec - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Add some new glacierMEC use-case tests - M models/lnd/clm/test/system/README.testnames ------------- Add n,w,x,y glcMEC resolutions - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_posttag_kraken - M models/lnd/clm/test/system/tests_posttag_yong - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/tests_posttag_mirage - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_posttag_intrepid_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>>>>> Get glcmec branch testing to work and pergro testing working with ->>>>>>>>>>>>>> build-namelist precedence change - M models/lnd/clm/test/system/TBR.sh ------------- Match history files - NOT restart-history files - M models/lnd/clm/test/system/nl_files/clm_per0 -- Change use-case name - M models/lnd/clm/test/system/nl_files/nl_urb_br - Add hist_fincl2 to remove - any secondardy history files from use-case - M models/lnd/clm/test/system/nl_files/clm_per --- Change use-case name - M models/lnd/clm/test/system/input_tests_master - Add new tests - M models/lnd/clm/test/system/TSM.sh ------------- Make restart file touched - with .nc extension, remove bit about deleting clm.i files - ->>>>>>>>>>>>>> Use mksrf_glacier files from XML database, add glc_nec to mksurfdata.pl, ->>>>>>>>>>>>>> allow glc_nec=0, and don't write out glcmec fields if glc_nec=0. - M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 --- Don't define glc_nec - fields if nglcec == 0. - M models/lnd/clm/tools/mksurfdata/mkglcmecMod.F90 - Set nglcec=0 by default, - add ability to handle nglcec=0 - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ---- Don't write out or call - glc-mec stuff if nglcec == 0. - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl --- Add ability to set glc_nec - get mksrf_glacier file from XML database - ->>>>>>>>>>>>>> Add in new glc_nec=10 datasets, change precedence order in ->>>>>>>>>>>>>> build-namelist so use_case is AFTER -namelist/-infile/-clm_usr_name. ->>>>>>>>>>>>>> Add mksrf_glacier files to XML database - M models/lnd/clm/bld/listDefaultNamelist.pl - Make faster and add settings - for glc_nec and glc_grid, also add loop over sim_year_range - M models/lnd/clm/bld/build-namelist --------- Change precedence order so - that use-cases are after namelist and infile (thus user_nl_clm files - are used in place of the use-case. Check that the use-cases follow - a strict naming convention (ensures will work with PTCLM.py). - This is the new order of precedence -+ 1. values set on the command-line using the -namelist option, -+ 2. values read from the file specified by -infile, -+ 3. datasets from the -clm_usr_name option, -+ 4. values set from a use-case scenario, e.g., -use_case -+ 5. values from the namelist defaults file. - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --------- Add - mksrf_glacier file for mksurfdata.pl to XML database - M models/lnd/clm/bld/namelist_files/datm-build-namelist ------------- Change - order of precedence so that use_case is after infile and namelist - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ------- New glc datasets - surfdata for 1850@(f09,f19,T31) - pftdyn for 1850-2000@(f09,f19,T31) - pftdyn for 1850-2100@(f09,f19,T31) rcp (2.6,4.5,6,8.5) - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Add - mksrf_glacier datasets for glc_nec=0 (previous version), glc_nec=3,5,10 - use older glacier dataset that Bill Lipscomb says has better glacier - representation over greenland ->>>>>>>>>>>>>> Remove direct calls to pio -- use ncdio_pio module for all NetCDF ->>>>>>>>>>>>>> read/write/define/query. Write out at initialization if there is no ->>>>>>>>>>>>>> land and won't be running CLM. - M models/lnd/clm/src/main/clm_initializeMod.F90 - Set subname and write out - if no land exists and clm will NOT be run - M models/lnd/clm/src/main/iniTimeConst.F90 ------ Use ncd_io to read in mxsoil_color - (remove direct calls to pio) - M models/lnd/clm/src/main/histFileMod.F90 ------- Use ncd_io to read/write - everything (remove direct calls to pio). Add max_nFields function. - M models/lnd/clm/src/main/restFileMod.F90 ------- Change use of PIO_GLOBAL - to NCD_GLOBAL - M models/lnd/clm/src/main/ncdio_pio.F90 --------- Remove making pio interfaces - public, add new interfaces to ncd_io global, add dimexist as optional - argument to ncd_inqdid, and name as optional argument to ncd_inqdlen - change ncd_io interfaces that could NOT need to call scam_field_offsets - so that they don't. Initialize data_offset and pfts to bigint NOT nan. - New interfaces: -+ module procedure ncd_io_char_var1_nf -+ module procedure ncd_io_char_var3_nf -+ module procedure ncd_io_char_varn_strt_nf - M models/lnd/clm/src/main/surfrdMod.F90 --------- Use ncd_inqdid and ncd_inqvid - instead of pio interfaces directly. - -Summary of testing: - - bluefire: All PASS except... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -057 blV61 TBL.sh _mec10sc_dh clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ...................FAIL! rc= 7 -061 blVn1 TBL.sh _mec10sc_dh clm_transient_glcMEC_rcp8.5 20331231:1800 1.9x2.5 gx1v6@1850-2100 48 arFAIL! rc= 5 -063 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -064 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -065 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -066 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - -glcmec TBL tests fail since they didn't exist in previous version - - bluefire interactive testing: -006 smHS3 TSM.sh _nrcnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic ......FAIL! rc= 8 -007 erHS3 TER.sh _nrcnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -3+-3 arb_ic ...FAIL! rc= 5 -008 brHS3 TBR.sh _nrcnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -3+-3 arb_ic ...FAIL! rc= 5 -009 blHS3 TBL.sh _nrcnsc_do clm_usrdat 20030101:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic ......FAIL! rc= 4 -044 blV63 TBL.sh _mec10sc_do clm_glcmec 19980115:1800 1.9x2.5 gx1v6 48 arb_ic ...................FAIL! rc= 7 -060 sm974 TSMscript_tools.sh mksurfdata mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds ....FAIL! rc= 6 - bluefire/CESM testing: All PASS except... (new compare tests fail since didn't exist before) -BFAIL ERI.f19_g16.IG1850.bluefire.compare.clm4_0_22 -BFAIL ERS_D.T31_g37.IGRCP26CN.bluefire.compare.clm4_0_22 -BFAIL PST.f10_f10.I20TRCN.bluefire.compare.clm4_0_22 -BFAIL PET_PT.f10_f10.I20TRCN.bluefire.compare.clm4_0_22 -BFAIL SMS.f10_f10.IRCP45CN.bluefire.compare.clm4_0_22 - -PEND ERS_D.f45_g37.I.bluefire.GC.003008 -PEND ERP.T31_g37.IGRCP60CN.bluefire.GC.003008 -PEND ERH_D.f10_f10.I1850CN.bluefire.GC.003008 -PEND ERS_D.f19_g16.IRCP85CN.bluefire.GC.003008 - - bluefire/CESM Extra testing: -PASS ERI.f19_g16.IG1850.bluefire -PASS ERI.f19_g16.IG1850CN.bluefire -PASS ERS.T31_g37.IGRCP45CN.bluefire -PASS ERS.T31_g37.IGRCP85CN.bluefire - -PASS ERS_D.T31_g37.IG.bluefire -PASS ERS_D.f19_g16.IGCN.bluefire - - bluefire/CESM Extra testing for coupled with CAM and CAM/POP: -PASS ERI.f19_g16.BGCN.bluefire -PASS SMS_D.f19_g16.BG1850CN.bluefire -PASS ERP.f09_g16.BG20TRCN.bluefire -PASS ERS.T31_g37.BGRCP26CN.bluefire -RUN ERS_D.T31_g37.BGRCP45CN.bluefire.111336 --- takes too long -PASS ERS.T31_g37.BGRCP60CN.bluefire -RUN ERS_D.T31_g37.BGRCP85CN.bluefire.111336 --- takes too long -FAIL SMS.f19_f19.EGCN.bluefire ----------------- seg-fault -FAIL SMS.T31_T31.EG1850CN.bluefire ------------- seg-fault -PASS ERI.f09_f09.FGCN.bluefire -PASS SMS.f19_f19.FG1850CN.bluefire -PASS SMS.T31_T31.FG20TRCN.bluefire -FAIL SMS.T31_g37.TG.bluefire - - bluefire/PTCLM testing: -PTCLM.631306_1x1_mexicocityMEX_ICN.PTCLM PASS -PTCLM.631306_1x1_mexicocityMEX_I.PTCLM PASS -PTCLM.631306_1x1_mexicocityMEX_I_QIAN.PTCLM PASS -PTCLM.631306_US-Ha1_I_1850.PTCLM PASS -PTCLM.631306_US-Ha1_I20TR.PTCLM PASS -PTCLM.631306_US-Ha1_I20TRCN.PTCLM PASS -PTCLM.631306_US-Ha1_ICN.PTCLM PASS -PTCLM.631306_US-Ha1_I1850CN.PTCLM PASS -PTCLM.631306_US-Ha1_IRCP85CN.PTCLM PASS -PTCLM.631306_US-Ha1_I.PTCLM PASS -PTCLM.631306_US-Ha1_I_QIAN.PTCLM PASS -PTCLM.631306_US-Ha1_I.PTCLM PASS -PTCLM.631306_US-UMB_I.PTCLM PASS -PTCLM.631306_US-UMB_I_QIAN.PTCLM PASS -PTCLM.631306_US-UMB_I.PTCLM PASS -US-Ha1_ICN_ad_spinup.PTCLM PASS - jaguar interactive testing: All PASS except... -011 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -012 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -013 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -014 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -026 blVx3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 5 - jaguar/PTCLM testing: -PTCLM.4224_1x1_mexicocityMEX_ICN.PTCLM PASS -PTCLM.4224_1x1_mexicocityMEX_I.PTCLM PASS -PTCLM.4224_1x1_mexicocityMEX_I_QIAN.PTCLM PASS -PTCLM.4224_US-Ha1_I_1850.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_I20TR.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_I20TRCN.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_ICN.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_I1850CN.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_IRCP85CN.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_I.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_I_QIAN.PTCLM FAIL 0 -PTCLM.4224_US-Ha1_I.PTCLM FAIL 0 -PTCLM.4224_US-UMB_I.PTCLM FAIL 0 -PTCLM.4224_US-UMB_I_QIAN.PTCLM FAIL 0 -PTCLM.4224_US-UMB_I.PTCLM FAIL 0 -US-Ha1_ICN_ad_spinup.PTCLM PASS - edinburgh/lf95 interactive testing: All PASS up to... -022 blVx3 TBL.sh _mec10sc_do clm_transient_glcMEC_rcp4.5 20331231:1800 48x96 gx3v7@1850-2100 -10 arbFAIL! rc= 5 - edinburgh/PTCLM testing: Fails because Python is too OLD (2.4 when needs 2.5) - yong/intel/PTCLM testing: Following PASS... -PTCLM.4900_1x1_mexicocityMEX_ICN.PTCLM PASS -PTCLM.4900_1x1_mexicocityMEX_I.PTCLM PASS -PTCLM.4900_1x1_mexicocityMEX_I_QIAN.PTCLM PASS -PTCLM.4900_US-Ha1_I_1850.PTCLM PASS -PTCLM.4900_US-Ha1_I20TR.PTCLM PASS -PTCLM.4900_US-Ha1_I20TRCN.PTCLM PASS -PTCLM.4900_US-Ha1_ICN.PTCLM PASS - -CLM tag used for the baseline comparison tests if applicable: clm4_0_22 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_22 -Originator(s): erik (Erik Kluzek) -Date: Thu Jan 20 13:17:56 MST 2011 -One-line Summary: Move coupler field indicies to clm, move cpl_* directories up a level, add the cpl_share directory - -Purpose of changes: - -Move cpl_* directories up a level, add cpl_shr directory. Update driver, move coupler -field indicies to clm, and allow fields to be passed in driver with just names added to -namelist. Make is_restart() public in clm_time_manager.F90. Fix PTS_MODE. Don't pass -Sl_landfrac to driver in run-phase. - -Bugs fixed (include bugzilla ID): - 1271 (Problem in PTS_MODE with clm) - 1270 (Make is_restart public in clm_time_manager.F90) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1273 (fix pts_mode problem on jaguar) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1110 (dtlimit error in datm8 with partial year forcing) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: Change Filepath - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, mvertens (most code changes originate from mvertens) - I made some tweaks after the review and added protex header documentation to the - new clm_cpl_indices file. - -List any svn externals directories updated (csm_share, mct, etc.): datm, cism - datm to datm8_110118 - cism to cism1_100913 - -List all files eliminated: - ->>>>>>>>> Move to directories up a level - D models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 - D models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - D models/lnd/clm/src/main/cpl_esmf/lnd_comp_mct.F90 - -List all files added and what they do: - ->>>>>>>>> Use this local version of indices rather than seq_indices_mod.F90 - A models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 - ->>>>>>>>> Move to directories up a level, use local version of indices rather ->>>>>>>>> than seq_* version and remove sending landfrac at run phase. - A models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 - A models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 - A models/lnd/clm/src/cpl_esmf/lnd_comp_mct.F90 - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/doc/README -- Update directory info. - ->>>>>>>>> Change pts_mode test so that RTM is not turned on. - M models/lnd/clm/test/system/input_tests_master - ->>>>>>>>> Change Filepath - M models/lnd/clm/bld/configure - ->>>>>>>>> Make is_restart() method public - M models/lnd/clm/src/main/clm_time_manager.F90 - ->>>>>>>>> Fix PTS_MODE. - M models/lnd/clm/src/main/pftvarcon.F90 ------- Pass posNOTonfile=.true. down - to ncd_io methods so won't check for lat/lon - M models/lnd/clm/src/main/ncdio_pio.F90 ------- Add posNOTonfile option to global - reads so that if set, won't try to find nearest lat/lon to PTS_MODE point - (for files that are global data NOT spatial). - M models/lnd/clm/src/biogeophys/SNICARMod.F90 - Pass posNOTonfile=.true. down - to ncd_io methods so won't check for lat/lon - -Summary of testing: - - bluefire: All PASS except... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -059 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -060 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -061 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -062 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except... ->>>>>>>> Test was changed to remove RTM -025 blAK4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 1.9x2.5 gx1v6 -10 cold ...............FAIL! rc= 5 - bluefire/CESM testing: All PASS except... -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_20 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_20 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_20 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_20 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_20 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_20 -FAIL PST.f45_g37.I1850.bluefire.compare.clm4_0_20 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm4_0_20 -FAIL ERS_E.f19_g16.I1850.bluefire.compare.clm4_0_20 -FAIL ERS_E.f19_g16.I1850.bluefire.compare_hist.clm4_0_20 -FAIL ERI.f19_g16.IG.bluefire.compare.clm4_0_20 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_20 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_20 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_20 -FAIL PST.f10_f10.I8520CN.bluefire.compare.clm4_0_20 -FAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm4_0_20 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_20 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_20 ->>>>>>>> Compare tests fail because Sl_landfrac is missing on new case ->>>>>>>> Everything else is identical - bluefire/PTCLM testing: All PASS - edinburgh/lf95 interactive testing: All PASS except... -006 blAL4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 5 - yong/intel interactive testing: -006 blAL4 TBL.sh _nrsc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ..................FAIL! rc= 5 -011 smD94 TSM.sh _persc_ds clm_per^nl_urb 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 10 -012 erD94 TER.sh _persc_ds clm_per^nl_urb 20021231:1200 4x5 gx3v7 72+72 cold ....................FAIL! rc= 5 -013 blD94 TBL.sh _persc_ds clm_per^nl_urb 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 4 -019 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 13 -020 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 11 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_21 - -Changes answers relative to baseline: bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_21 -Originator(s): jedwards (Jim Edwards) -Date: Wed Jan 12 14:50:45 MST 2011 -One-line Summary: Remove includes, finish PIO transition - -Purpose of changes: - -Code cleanup - -Remove misc.h/preproc.h, update SNICARMod to use ncdio_pio calls rather than NetCDF -directly. - -Bugs fixed (include bugzilla ID): - 394 (misc.h and preproc.h NOT used at all anymore) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1271 (Problem in PTS_MODE with clm) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1110 (dtlimit error when a full year isn't available) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: Removed generation of files misc.h and preproc.h - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, Erik K - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: misc.h, preproc.h - -D models/lnd/clm/tools/mksurfdata/misc.h -D models/lnd/clm/tools/mksurfdata/preproc.h -D models/lnd/clm/tools/mkdatadomain/preproc.h -D models/lnd/clm/tools/mkdatadomain/misc.h - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - models/lnd/clm/tools/mkgriddata/README - models/lnd/clm/tools/mksurfdata/README - models/lnd/clm/tools/mkdatadomain/README - models/lnd/clm/tools/README - models/lnd/clm/bld/configure - models/lnd/clm/bld/clm.cpl7.template - models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 - models/lnd/clm/src/biogeochem/CASAPhenologyMod.F90 - models/lnd/clm/src/biogeochem/CNGapMortalityMod.F90 - models/lnd/clm/src/biogeochem/CNC13StateUpdate2Mod.F90 - models/lnd/clm/src/biogeochem/CNGRespMod.F90 - models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 - models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 - models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90 - models/lnd/clm/src/biogeochem/CNFireMod.F90 - models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 - models/lnd/clm/src/biogeochem/CNSummaryMod.F90 - models/lnd/clm/src/biogeochem/CNDVLightMod.F90 - models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 - models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 - models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90 - models/lnd/clm/src/biogeochem/CNC13StateUpdate1Mod.F90 - models/lnd/clm/src/biogeochem/CNC13StateUpdate3Mod.F90 - models/lnd/clm/src/biogeochem/CNDVEcosystemDynIniMod.F90 - models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 - models/lnd/clm/src/biogeochem/C13SummaryMod.F90 - models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 - models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 - models/lnd/clm/src/biogeochem/CNAllocationMod.F90 - models/lnd/clm/src/biogeochem/CNC13FluxMod.F90 - models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 - models/lnd/clm/src/biogeochem/CNSetValueMod.F90 - models/lnd/clm/src/biogeochem/CNDVEstablishmentMod.F90 - models/lnd/clm/src/main/organicFileMod.F90 - models/lnd/clm/src/main/dynlandMod.F90 - models/lnd/clm/src/main/accFldsMod.F90 - models/lnd/clm/src/main/fileutils.F90 - models/lnd/clm/src/main/pftdynMod.F90 - models/lnd/clm/src/main/pft2colMod.F90 - models/lnd/clm/src/main/restFileMod.F90 - models/lnd/clm/src/main/clm_varsur.F90 - models/lnd/clm/src/main/controlMod.F90 - models/lnd/clm/src/main/initSurfAlbMod.F90 - models/lnd/clm/src/main/filterMod.F90 - models/lnd/clm/src/main/clm_varorb.F90 - models/lnd/clm/src/main/initGridCellsMod.F90 - models/lnd/clm/src/main/pftvarcon.F90 - models/lnd/clm/src/main/spmdMod.F90 - models/lnd/clm/src/main/domainMod.F90 - models/lnd/clm/src/riverroute/RunoffMod.F90 - models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 - models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 - models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 - models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 - models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 - models/lnd/clm/src/biogeophys/QSatMod.F90 - models/lnd/clm/src/biogeophys/clm_driverInitMod.F90 - models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 - - models/lnd/clm/src/biogeophys/SNICARMod.F90 - models/lnd/clm/src/main/ncdio_pio.F90 - - Removed reference to preproc.h and misc.h in all files. Converted snicarmod to use pio - and added support for a 3d non-decomposed real variable in ncdio. - -Summary of testing: - - bluefire: All PASS except... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -059 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -060 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -061 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -062 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS except... -NOTE: pts_mode tests failed... (bug 1271) - bluefire/CESM testing: All PASS - - jaguarpf: All pass except ... -007 brB91 TBR.sh _scsnf_dh clm_std^nl_urb 20021230:1800 4x5 gx3v7 72+72 arb_ic ..................FAIL! rc= 10 -022 erH92 TER.sh 17p_cnsc_dm clm_ndepdyn^nl_cn_conly 20020101:1800 4x5 gx3v7@1850-2000 10+38 cold FAIL! rc= 13 -023 brH92 TBR.sh 17p_cnsc_dm clm_ndepdyn^nl_cn_conly 20020101:1800 4x5 gx3v7@1850-2000 72+72 cold FAIL! rc= 11 -038 smLI2 TSM.sh _sc_dm clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -039 erLI2 TER.sh _sc_dm clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -040 brLI2 TBR.sh _sc_dm clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -041 blLI2 TBL.sh _sc_dm clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 -042 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 96 arb_ic ....................FAIL! rc= 10 -043 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 72+72 arb_ic .................FAIL! rc= 5 -044 brL58 TBR.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 72+72 arb_ic .................FAIL! rc= 5 -045 blL58 TBL.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 48 arb_ic ....................FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_19 - -Changes answers relative to baseline: bit-for-bit - -=============================================================== -Tag name: clm4_0_20 -Originator(s): erik (Erik Kluzek) -Date: Tue Jan 11 11:18:30 MST 2011 -One-line Summary: Update for ESMF metadata, update doc. from release branch, - bug fixes (doc of qflx_evap_tot, threading CNDV, aer/ndepregrid) - -Purpose of changes: - -Update externals, fix in datm speeds up single-point simulations, update for esmf -metadata capability. Update documentation from Release branch (cesm1_0_rel07_clm4_0_14). -Fix documentation of qflx_evap_tot. Fix ndepregrid/aerdepregrid scripts. Fix threading -problem with CNDV. - -Bugs fixed (include bugzilla ID): - 1266 (Threading problem with CNDV) - 1265 (Fix ndep/aerdepregrid.ncl) - 1264 (Incorrect doc of qflx_evap_tot in the code) - 1258 (runinit_ibm.csh needs to be updated) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1281 (bug in mksurfdata for urban_only case) - 1282 (Trouble running to last CLM1PT atm time-step) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1110 (dtlimit error when a full year isn't available) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: - Small section of clm_driver was moved to a OMP loop. This should - improve threading performance slightly. - -Code reviewed by: self, doc of qflx_evap_tot by Keith Oleson - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, - stubs, datm, csm_share, timing - - scripts to scripts4_110108 - drv to drvseq3_1_47 - sice to stubs1_2_03 - socn to stubs1_2_03 - sglc to stubs1_2_03 - datm to datm8_110106 - csm_share to share3_101231 - timing to timing_101215 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>> Fix deposition regrid scripts so they will work (from crop04) - M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl - Fix XML queries so will - work, using the datm_internal namelist now - M models/lnd/clm/tools/ncl_scripts/ndepregrid.ncl --- Fix XML queries so will - work, using stream_fldfilename_ndep in the ndepdyn_nml namelist. - ->>>>>>>>> Fix so will work (from rel07) - M models/lnd/clm/tools/interpinic/runinit_ibm.csh - Fix config options so will work - M models/lnd/clm/bld/config_files/config_definition.xsl ---- Remove extra empty rows - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl Fix missing ">" - ->>>>>>>>> Update documentation (from rel07) - M models/lnd/clm/doc/UsersGuide/single_point.xml - Change how supported single-point - cases are handled and add documentation on setting start/stop times - M models/lnd/clm/doc/UsersGuide/tools.xml -------- Add new options to mksurfdata.pl - add notes about bugs, add notes that aer/ndepregid is optional - M models/lnd/clm/doc/UsersGuide/preface.xml ------ Update what_is_new section - M models/lnd/clm/doc/UsersGuide/clm_ug.xml ------- Add more versions in quicklist - M models/lnd/clm/doc/UsersGuide/appendix.xml ----- Add note about runinit_ibm.csh - problem - M models/lnd/clm/doc/UsersGuide/custom.xml ------- Remove DATM_PRESAERO=none option, - remove hist_crtinic, and use_ndepstream namelist settings - ->>>>>>>>> Update documentation (from rel07) - M models/lnd/clm/doc/KnownLimitations - Add doc on dtlimit error - M models/lnd/clm/doc/KnownBugs -------- Add bug 1168, remove bug 498 - M models/lnd/clm/doc/README ----------- Rework what's new - M models/lnd/clm/doc/index.shtml ------ Add link to KnownLimitations - M README ------------------------------ Rework what's new - ->>>>>>>>> Fix threading problem with CNDV, by adding an OMP loop in a section ->>>>>>>>> in clm_driver that didn't have one, pass down beg/end c|g|p indices ->>>>>>>>> as needed - M models/lnd/clm/src/biogeochem/CNSetValueMod.F90 - Pass in begc/endc, begp/endp - M models/lnd/clm/src/main/clm_initializeMod.F90 --- Add OMP loop over setFilters - M models/lnd/clm/src/main/pftdynMod.F90 ----------- Pass down beg/end indices as needed - pftdyn_wbal_init, pftdyn_cnbal, pftwt_interp, - M models/lnd/clm/src/main/filterMod.F90 ----------- Pass clump index down to setFilters - remove OMP from inside - M models/lnd/clm/src/main/clm_driver.F90 ---------- Add OMP loop around section that - wasn't inside an OMP loop - ->>>>>>>>> Fix the documentation of the qflx_evap_tot field - M models/lnd/clm/src/main/clmtype.F90 -------------------- Fix qflx_evap_tot doc - M models/lnd/clm/src/main/clm_atmlnd.F90 ----------------- Fix qflx_evap_tot doc - M models/lnd/clm/src/main/histFldsMod.F90 ---------------- Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ------ Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 ---- Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/Biogeophysics2Mod.F90 ---- Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 -------- Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/BiogeophysicsLakeMod.F90 - Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/UrbanMod.F90 ------------- Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/HydrologyLakeMod.F90 ----- Fix qflx_evap_tot doc - M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 -- Fix qflx_evap_tot doc - ->>>>>>>>> Add component meta-data for ESMF - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - Add meta-data description - of CLM - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_mct.F90 -- Add more arguments to - lnd_register method - -Summary of testing: - - bluefire: All PASS except... -033 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -034 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -035 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -036 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 4 -037 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -059 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -060 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -061 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -062 blLI1 TBL.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 4 - bluefire interactive testing: All PASS - bluefire/CESM testing: All PASS - bluefire/PTCLM testing: All PASS - jaguar interactive testing: All PASS except (up to 017 brJ74)... -011 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic -.............FAIL! rc= 10 -012 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic -...........FAIL! rc= 5 -013 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 - up to.... - -017 brJ74 TBR.sh 4p_nrcasasc_ds clm_std^nl_urb_br 10001230:3600 1x1_tropicAtl test -3+-3 arb_ic .PASS - edinburgh/lf95 interactive testing: All PASS except... -005 smAL4 TSM.sh _sc_ds clm_std^nl_ptsmode 20030101:1800 10x15 USGS -10 cold ....................FAIL! rc= 10 - edinburgh/PTCLM testing: All PASS up to ... -myPTCLMtests_US-Ha1_I_1850.PTCLM FAIL 0 - mirage,storm/ifort interactive testing: All PASS except... -017 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:1800 10x15 USGS@1850 10+38 cold .........FAIL! rc= 13 -018 brR53 TBR.sh 17p_cnc13sc_do clm_std^nl_urb_br 20020115:1800 10x15 USGS@1850 72+72 cold ......FAIL! rc= 11 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 10+38 arb_ic ...........FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -025 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 13 -026 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 11 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_19 - -Changes answers relative to baseline: bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_19 -Originator(s): erik (Erik Kluzek) -Date: Wed Dec 8 22:20:30 MST 2010 -One-line Summary: Bring irrigation branch to the trunk - -Purpose of changes: - -Add option for simple code to redirect some riverflow to irrigate generic crops. -Irrigation is turned on at 6AM, runs for 4 hours and keeps soil moisture to 0.7. -Change corn and wheat indices to c3crop and irrigated generic c3 crop. -Add QIRRIG as a history file output. Change pft-physiology and RTM flow files from -ASCII to NetCDF. Single pft-physiology file can handle all cases (has extra FCUR value -for CNDV), also has for new fields for crops that will come in later: corn, spring-wheat, -winter-wheat and soybean. Add findat and fsurdat files for irrigation (f09, f19, f10, finidat -only for f19). Split RTM run method into three and move subroutines around to where makes -more sense. Fix a mksurfdata PFT override bug. Synchronize the Makefiles for the tools -and add build for Darwin intel and PGI and remove Darwin XLF. Remove concurrent -directives and UNICOSMP, CPP_VECTOR, NEC_SX CPP #ifdefs. Remove some #include -misc.h/preproc.h statements. Switch pio_close for ncd_close calls. Replace some constants -with parameters. Remove clm_comp layer and call clm_initialize and clm_driver directly. -Change mk*.F90 subroutines in mksurfdata into modules, so that argument checking will -happen at compile-time. - -Bugs fixed (include bugzilla ID): - 964 (Remove UNICOS #ifdef logic in clm) - 1238 (PST test fails) - 1249 (problem in mksurfdata for PFT override mode) - 1253 (mkglacier in mksurfdata has arguments in wrong order) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1248 (PTCLM can only go to 2005) - 1251 (PTCLM testcases aborts in I_QIAN case) - 1258 (runinit_ibm.csh needs to be updated) - 1264 (Incorrect doc of qflx_evap_tot in the code) - 1265 (Fix ndep/aerdepregrid.ncl) - 1266 (Threading problem with CNDV) - 1298 (Can NOT turn RTM off in CLM_CONFIG_OPTS) - 1299 (interpinic does NOT work going from non glc_mec) - 1304 (bug in interpinic *_var) - 1306 (mksoifmaxInit is NOT called) - 1305 (dvolrdt is documented with the wrong units) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: std-test - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - Add -irrig and -rtm_res options to build-namelist - -+ -irrig Seek surface datasets with irrigation turned on. -+ -rtm_res "resolution" Specify river transport model resolution. - (Still only have half-degree files in the XML database) - - Add new history field: - - QIRRIG water added through irrigation (mm/s) - -List any changes to the defaults for the boundary datasets: NetCDF pft-phys/RTM files - NetCDF PT-physiology file: pft-physiology.c101006.nc - finidat and surfdata files for irrigation (for 1.9x2.5@2000) - surfdata files for irrigation (for f09 and f10) - NetCDF River-direction file: clmi.IQirrcr_2000-01-01_1.9x2.5_gx1v6_c101115.nc - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, slevis, dlawren, wsacks, mvertens, swensosc - slevis/wsacks -- irrigation changes - dlawren -------- convert pft-physiology file to NetCDF - mvertens ------- high level restructuring - swensosc ------- convert RTM flow file to NetCDF - -List any svn externals directories updated (csm_share, mct, etc.): scripts and csm_share - - scripts to scripts4_101206 - csm_share to csm_share3_101122 - -List all files eliminated: - -D models/lnd/clm/src/main/inicFileMod.F90 --------- Move to inicPerpMod -D models/lnd/clm/src/main/clm_comp.F90 ------------ Move to clm_initialize and - clm_driver -D models/lnd/clm/src/main/scam_setlatlonidx.F90 --- Use shr_scam version -D models/lnd/clm/src/main/snowdp2lev.F90 ---------- Move to mkarbinitMod -D models/lnd/clm/src/main/areaMod.F90 ------------- Split out into relavent modules: - celledge -> RtmMapMod - map_setmapsAr -> RmtMapMod - cellarea -> clm_initialize - map_setgatm -> downscaleMod -D models/lnd/clm/test/system/tests_posttag_spot1 -- rename to yong - -D models/lnd/clm/tools/mksurfdata/mkfmax.F90 ---- rename to mkfmaxMod.F90 -D models/lnd/clm/tools/mksurfdata/mkvocef.F90 --- rename to mkvocefMod.F90 -D models/lnd/clm/tools/mksurfdata/mkglacier.F90 - put in mkglcmecMod.F90 -D models/lnd/clm/tools/mksurfdata/mklanwat.F90 -- rename to mklanwatMod.F90 -D models/lnd/clm/tools/mksurfdata/mkelev.F90 ---- put in mkurbanparMod.F90 -D models/lnd/clm/tools/mksurfdata/mkurban.F90 --- put in mkurbanparMod.F90 -D models/lnd/clm/tools/mksurfdata/mksoitexMod.F90 rename to mksoilMod.F90 - -List all files added and what they do: - -A + models/lnd/clm/test/system/nl_files/clm_irrig -- New irrigation test - ->>>>>>>>>>> Some high level restructuring/renames -A + models/lnd/clm/src/main/inicPerpMod.F90 -------- From inicFileMod -A + models/lnd/clm/src/riverroute/RtmMapMod.F90 ---- From areaMod.F90 -A models/lnd/clm/test/system/tests_posttag_yong -- rename add more tests - ->>>>>>>>>>> Rename mksurfdata subroutines into modules -A models/lnd/clm/tools/mksurfdata/mkfmaxMod.F90 -A models/lnd/clm/tools/mksurfdata/mksoilMod.F90 -A models/lnd/clm/tools/mksurfdata/mkvocefMod.F90 -A models/lnd/clm/tools/mksurfdata/mklanwatMod.F90 - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>> Add irrigation "AZ" tests at 10x15 with irrigation on -M models/lnd/clm/test/system/tests_posttag_lynx_nompi -M models/lnd/clm/test/system/tests_pretag_bluefire -M models/lnd/clm/test/system/tests_pretag_edinburgh -M models/lnd/clm/test/system/tests_pretag_jaguar_nompi -M models/lnd/clm/test/system/tests_posttag_hybrid_regression -M models/lnd/clm/test/system/tests_posttag_purempi_regression -M models/lnd/clm/test/system/tests_posttag_intrepid_nompi -M models/lnd/clm/test/system/tests_posttag_nompi_regression -M models/lnd/clm/test/system/tests_pretag_bluefire_nompi -- Remove repeated test - -M models/lnd/clm/test/system/README.testnames --- Add Z res (10x15 with irrig) -M models/lnd/clm/test/system/test_driver.sh ----- Changes for lynx and yong - ->>>>>>>>>>> Fix bug 1249 for PFT overrides, correct irrigation sample namelist ->>>>>>>>>>> Change subroutines into modules for mk*.F90 files (allows compiler to check args) ->>>>>>>>>>> Fix bug 1253 putting mksoitex call after mkglacier -M models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig - Correct name of irrigation dataset -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 nullify pctpft_i -M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 Set nlat_i/nlon_i to 1 if PFT override -M models/lnd/clm/tools/mksurfdata/mkglcmecMod.F90 -- Add mkglacier subroutine -M models/lnd/clm/tools/mksurfdata/mkurbanparMod.F90 Add mkurban and mkelev subroutines -M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ----- Change subroutines into modules - nullify pctpft_i, put mksoitex call after mkglacier -M models/lnd/clm/tools/mksurfdata/Srcfiles --------- Change names of files -M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 ----- Add mkirrig subroutine - - ->>>>>>>>>>> Sync up the tools Makefiles and add darwin intel and pgi build (remove darwin xlf) -M models/lnd/clm/tools/mksurfdata/Makefile ---- Sync up makefiles, add darwin build -M models/lnd/clm/tools/interpinic/Makefile ---- Sync up makefiles, add darwin build -M models/lnd/clm/tools/mkgriddata/Makefile ---- Sync up makefiles, add darwin build -M models/lnd/clm/tools/mkdatadomain/Makefile -- Sync up makefiles, add darwin build - ->>>>>>>>>>> Add -irrig and -rtm_res options, update files to new NetCDF versions, ->>>>>>>>>>> add in findat/fsurdat files for irrigation (f19,f10, f09) -M models/lnd/clm/bld/build-namelist ----- Add -irrig, -rtm_res options - set do_budgets, and budget_inst in drv_namelist, finidat/fsurdat depend on irrig - set create_crop_landunit by irrig -M models/lnd/clm/bld/clm.cpl7.template -- Set CLM_RTM_RES to half-degree and pass - to build-namelist -M models/lnd/clm/bld/namelist_files/namelist_definition.xml ------ add irrig and rtm_res -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml default for irrig and rtm_res -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ---- New NetCDF - pft-physiology file (for all configs), finidat and fsurdat files check - irrig, f19, f10, and f09 surfdata files for irrigation (and f19 finidat) - defaults for create_croplandunit, new NetCDF RTM direction file -M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ---- Set do_budgets - to .true. and budget_inst to 1. - ->>>>>>>>>>> Remove concurrent directives and misc.h/preproc.h #includes ->>>>>>>>>>> Remove scam_setlatlonidx and use shr_scam_. ->>>>>>>>>>> Switch ncorn for nc3crop and nwheat for nirrig change pio_close for ncd_close -M models/lnd/clm/src/biogeochem/CNMRespMod.F90 -------- Remove concurrent directives - remove misc.h/preproc.h #includes -M models/lnd/clm/src/biogeochem/CASAMod.F90 ----------- Change pio_closefile to - ncd_pioclosefile -M models/lnd/clm/src/biogeochem/CNWoodProductsMod.F90 - Remove directives -M models/lnd/clm/src/biogeochem/DUSTMod.F90 ----------- Remove directives -M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 ncorn->nc3crop, - use shr_scam_getCloseLatLon in place of scam_setlatlonidx, - Remove directives, switch pio_close with ncd_pio_closefile -M models/lnd/clm/src/biogeochem/CNDecompMod.F90 ------- Remove directives and #includes -M models/lnd/clm/src/biogeochem/CNDVMod.F90 ----------- Switch pio_plosefile with ncd_close -M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ---- ncorn->nc2crop -M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 ---- ncorn->nc3crop, nwheat->nirrig - and remove #includes -M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 ncorn->nc3crop, nwheat->nirrig - and remove #includes - ->>>>>>>>>>> Remove concurrent directives and misc.h/preproc.h #includes ->>>>>>>>>>> Remove scam_setlatlonidx and use shr_scam_. ->>>>>>>>>>> Switch ncorn for nc3crop and nwheat for nirrig change pio_close for ncd_close -M models/lnd/clm/src/main/clm_varcon.F90 ------- Add degpsec, isecspday, - and remove #includes -M models/lnd/clm/src/main/clm_varpar.F90 ------- Remove #includes, add ivis/inir - indices, and make rtmlat/rtmlon variables not parameters -M models/lnd/clm/src/main/CNiniTimeVar.F90 ----- Remove directives, and #includes, - add qflx_irrig -M models/lnd/clm/src/main/abortutils.F90 ------- Remove directives, and #includes - and NEC_SX, and UNICOSMP CPP defines -M models/lnd/clm/src/main/accumulMod.F90 ------- Remove directives -M models/lnd/clm/src/main/decompInitMod.F90 ---- Remove UNICOSMP CPP defines -M models/lnd/clm/src/main/clm_initializeMod.F90 Move cellarea from areaMod to here - work with downscale a bit, add stuff from clm_comp init to here -M models/lnd/clm/src/main/clmtypeInitMod.F90 --- Add irrig_rate and n_irrig_steps_left -M models/lnd/clm/src/main/iniTimeConst.F90 ----- Switch pio_close with ncd_close, - add single-column read for PCT_CLAY, switch 86400 for secspday -M models/lnd/clm/src/main/histFileMod.F90 ------ Remove UNICOSMP, switch pio_close - with ncd_close -M models/lnd/clm/src/main/restFileMod.F90 ------ Switch pio_close with ncd_close -There's also a new driver namelist setting that will update the orbit each year -(setting orb_mode and orb_iyear_align). - -Bugs fixed (include bugzilla ID): - 1225 (abort if both trigrid and finemesh on) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 935 (RTM warning NOT an error) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on mirage...) - 1165 (Restart trouble for scaled harvest test on mirage) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1238 (PST test fails) - 1239 (ESMF build fails) - 1240 (lynx_pgi build fails) - 1249 (problem in mksurfdata for PFT override mode) - 1258 (runinit_ibm.csh needs to be updated) - 1264 (Incorrect doc of qflx_evap_tot in the code) - 1265 (Fix ndep/aerdepregrid.ncl) - 1266 (Threading problem with CNDV) - 1318 (interpinic has trouble with new restart files) - 1372 (pio problem writing out CLM history files for CRU - 1381 (Can't change monthly average files to NOT be one per month) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: Add in darwin_intel build - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: Add in T341 datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, - csm_share, pio, mct, cprnc - - scripts to mpiserial07_scripts4_101117 - drv to drv3_1_45 - datm to datm8_101105 - csm_share to share3_101118 - pio to pio1_2_6 - mct to MCT2_7_0_100228-mpiserial101109_tag02 - cprnc to cprnc_101119 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/tests_pretag_jaguar - remove non-existant tests - ->>>>>>>>>> Remove clmi frequency setting, add darwin build/run - M models/lnd/clm/test/system/input_tests_master - M models/lnd/clm/test/system/TBR.sh - M models/lnd/clm/test/system/test_driver.sh - Add darwin builds - M models/lnd/clm/test/system/mknamelist - ->>>>>>>>>> Change orb_iyear for orb_iyear_ad - M models/lnd/clm/test/system/nl_files/nl_urb - M models/lnd/clm/test/system/nl_files/nl_noicertm_sclharv - M models/lnd/clm/test/system/nl_files/clm_ndepdyn -- remove ndepsrc stream setting - Can now replace usage of this file with clm_std - M models/lnd/clm/test/system/nl_files/nl_cn_conly - M models/lnd/clm/test/system/nl_files/nl_urb_br - ->>>>>>>>>> Get build working with darwin_intel - M models/lnd/clm/bld/configure ------ get it working with darwin_intel - M models/lnd/clm/bld/clm.cpl7.template - Use $GMAKE, set to gmake if not set - ->>>>>>>>>> Remove non-existant resolution: 2.5x3.33 - M models/lnd/clm/bld/namelist_files/checklatsfiles.ncl - M models/lnd/clm/bld/namelist_files/checkdatmfiles.ncl - ->>>>>>>>>> Add orb_mode, set orbit based on it, also add orb_iyear_align ->>>>>>>>>> Add run_barriers, pio_inparm namelist, add T341 resolution (512x1024) - M models/lnd/clm/bld/build-namelist - Set orbit based on orb_mode, set pio namelist - for stand-alone testing, - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ---- Remove pio namelist - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - M models/lnd/clm/bld/namelist_files/datm-build-namelist - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- Add T341: griddata, - fracdata, surfdata, topodata (fracdata for USGS and tx0.1 masks)` - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml - ->>>>>>>>>> Switch orb_iyear for orb_iyear_ad - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - ->>>>>>>>>> Switch ncd_x for pio_x/nf_x ->>>>>>>>>> Fix a couple memory leaks that Jim Edwards found ->>>>>>>>>> Make ncd_pio private, add documentation add attributes for restart history ->>>>>>>>>> files, add 2D character read (needed for NetCDF pft-physiology file read on ->>>>>>>>>> irrigation branch) - M models/lnd/clm/src/biogeochem/CASAMod.F90 ------------ Replcae pio_x - M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 - use masterproc at top of module - M models/lnd/clm/src/biogeochem/CNDVMod.F90 ------------ Replace pio_x - M models/lnd/clm/src/biogeochem/CNrestMod.F90 ---------- Replace pio_x - M models/lnd/clm/src/main/inicFileMod.F90 -------------- Add use MPI_LOGICAL - M models/lnd/clm/src/main/accumulMod.F90 --------------- Replace pio_x - M models/lnd/clm/src/main/clm_initializeMod.F90 -------- Remove samegrids use downscale, - don't pass namelist to ncd_pio initialization - M models/lnd/clm/src/main/subgridRestMod.F90 ----------- Add use endrun, switch ncd_x for nf_x - M models/lnd/clm/src/main/ndepStreamMod.F90 ------------ PIO initialization uses - driver settings, pass get_calendar to initialization - M models/lnd/clm/src/main/histFileMod.F90 -------------- Add attributes to history restart files - M models/lnd/clm/src/main/restFileMod.F90 -------------- Replace pio_x - M models/lnd/clm/src/main/clm_time_manager.F90 --------- Replace nf_x with ncd_x add - get_calendar - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 ----- Abort if trigrid and downscale - Update orbit params in run-phase - M models/lnd/clm/src/main/clm_varctl.F90 --------------- Remove samegrids - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 --- Abort if trigrid and downscale - Update orbit params in run-phase - M models/lnd/clm/src/main/ncdio_pio.F90 ---------------- Update documentation, make private - add ncd_pio_closefile wrapper, make some pio interfaces public from here, - add ncd_io_char_var2_nf for NetCDF pft-physiology file, remove pio namelist - remove a second allocation that Jim Edwards found - M models/lnd/clm/src/main/surfrdMod.F90 ---------------- Fix memory leak from Jim Edwards - M models/lnd/clm/src/riverroute/RtmMod.F90 ------------- Switch nf_x with ncd_x - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 -- Add use for spval and iulog, - change nf_x for ncd_x - -Summary of testing: - -All TBL tests fail... (although you can use clm4_0_16 with updated externals and show b4b) - - bluefire: All PASS except... -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -055 smLI1 TSM.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -056 erLI1 TER.sh _sc_dh clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -057 brLI1 TBR.sh _sc_dh clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 - bluefire interactive testing: All PASS - bluefire/CESM testing: -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_16 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_16 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_16 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_16 -FAIL SMS_ROA.f45_f45.I.bluefire.compare.clm4_0_16 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_16 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_16 -FAIL PST.f45_g37.I1850.bluefire <<<<< Didn't create scripts problem, bug 1238 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm4_0_16 -FAIL ERS_E.f19_g16.I1850.bluefire <<<< Scripts build issue, bug 1239 -BFAIL ERS_E.f19_g16.I1850.bluefire.generate.clm4_0_17 -FAIL ERS_E.f19_g16.I1850.bluefire.compare_hist.clm4_0_16 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_16 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_16 -FAIL PST.f10_f10.I8520CN.bluefire <<<<< Didn't create scripts problem, bug 1238 -FAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm4_0_16 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_16 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_16 - bluefire/PTCLM testing: All PASS - jaguar: All PASS except... -007 brB91 TBR.sh _scsnf_dh clm_std^nl_urb 20021230:1800 4x5 gx3v7 72+72 arb_ic ..................FAIL! rc= 13 -022 erH92 TER.sh 17p_cnsc_dm clm_ndepdyn^nl_cn_conly 20020101:1800 4x5 gx3v7@1850-2000 10+38 cold FAIL! rc= 13 -023 brH92 TBR.sh 17p_cnsc_dm clm_ndepdyn^nl_cn_conly 20020101:1800 4x5 gx3v7@1850-2000 72+72 cold FAIL! rc= 11 -038 smLI2 TSM.sh _sc_dm clm_std 20020101:1800 94x192 T62 -10 arb_ic .............................FAIL! rc= 10 -039 erLI2 TER.sh _sc_dm clm_std 20020101:1800 94x192 T62 -5+-5 arb_ic ...........................FAIL! rc= 5 -040 brLI2 TBR.sh _sc_dm clm_std 20020101:1800 94x192 T62 -10+-10 arb_ic .........................FAIL! rc= 5 -042 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 96 arb_ic ....................FAIL! rc= 10 -043 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 72+72 arb_ic .................FAIL! rc= 5 -044 brL58 TBR.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 72+72 arb_ic .................FAIL! rc= 5 - jaguar interactive testing: All PASS except... -007 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -008 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -009 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -027 sm974 TSMscript_tools.sh mksurfdata mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds ....FAIL! rc= 6 - edinburgh/lf95 interactive testing: All PASS - edinburgh/lf95 testing: All PASS except... -005 smD91 TSM.sh _persc_dh clm_per^nl_urb 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 10 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:1200 4x5 gx3v7 72+72 cold ....................FAIL! rc= 5 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -012 smG56 TSM.sh 17p_sc_m clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic ..............FAIL! rc= 10 -013 smE91 TSM.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:1800 4x5 gx3v7 96 arb_ic .................FAIL! rc= 10 -014 erE91 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:1800 4x5 gx3v7 10+38 arb_ic ..............FAIL! rc= 5 -015 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:1800 4x5 gx3v7 72+72 arb_ic ...........FAIL! rc= 5 -018 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:1800 10x15 USGS@2000 10+38 cold ............FAIL! rc= 13 -019 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:1800 10x15 USGS@2000 72+72 cold .........FAIL! rc= 11 -025 smL51 TSM.sh _sc_dh clm_std^nl_urb 20020115:1800 10x15 USGS 96 arb_ic .......................FAIL! rc= 10 -026 erL51 TER.sh _sc_dh clm_std^nl_urb 20020115:1800 10x15 USGS 10+38 arb_ic ....................FAIL! rc= 5 -027 brL51 TBR.sh _sc_dh clm_std^nl_urb_br 20020115:1800 10x15 USGS 72+72 arb_ic .................FAIL! rc= 5 -029 smH41 TSM.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 96 cold ..FAIL! rc= 10 -030 erH41 TER.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 5 -031 brH41 TBR.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 5 -033 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:1800 10x15 USGS 96 arb_ic ....................FAIL! rc= 10 - edinburgh/PTCLM testing: All PASS up to... -myPTCLMtests_US-Ha1_I_1850.PTCLM FAIL 0 - mirage,storm/ifort interactive testing: All PASS except... -017 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:1800 10x15 USGS@1850 10+38 cold .........FAIL! rc= 13 -018 brR53 TBR.sh 17p_cnc13sc_do clm_std^nl_urb_br 20020115:1800 10x15 USGS@1850 72+72 cold ......FAIL! rc= 11 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 144 arb_ic .............FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 10+38 arb_ic ...........FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:1800 10x15 USGS@1000-1002 72+72 arb_ic ...........FAIL! rc= 5 -025 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 10+38 cold FAIL! rc= 13 -026 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:1800 10x15 USGS@2000 72+72 cold FAIL! rc= 11 - lynx/pgi testing: All FAIL scripts build issue <<<< bug 1240 - yong/darwin_intel testing: All PASS up to ... -005 smD94 TSM.sh _persc_ds clm_per^nl_urb 20021231:1200 4x5 gx3v7 144 cold ......................FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_16 - - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: All with datm - - what platforms/compilers: All - - nature of change: roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - PERGRO test on bluefire - -=============================================================== -=============================================================== -Tag name: clm4_0_16 -Originator(s): erik/mvertens (Kluzek Erik 1326 CGD) (Vertenstein Mariana 1349 CGD) -Date: Wed Oct 27 13:33:21 MDT 2010 -One-line Summary: Fix downscaling roundoff difference for same-grids by copying scale factor when needed - -Purpose of changes: - -Fix bug 1230, that caused problems with runoff to the ocean when running fully coupled. The global integrals of runoff fields -was the same in the coupler -- but the values where roundoff different. This caused problems both in testing for bit-for-bit with -the previous version and with restarts. The problem was that in the downscaling changes made in clm4_0_15 the areal scaling factor -asca needed to be copied from adomain into ldomain is no downscaling is taking place. - -Bugs fixed (include bugzilla ID): -=============================================================== -Tag name: clm4_0_14 -Originator(s): erik (Erik Kluzek) -Date: Tue Oct 19 13:12:36 MDT 2010 -One-line Summary: Fix finidat file for T31 sim_year=2000 cases - -Purpose of changes: - -Remove the 1850 T31 finidat file for sim_year=2000 and use the previous sim_year=2000 -files (created using interpinic). Update scripts and datm. - -Bugs fixed (include bugzilla ID): Correct finidat file for T31 sim_year=2000 - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1249 (problem in mksurfdata for PFT override mode) - 1258 (runinit_ibm.csh needs to be updated) - 1264 (Incorrect doc of qflx_evap_tot in the code) - 1265 (Fix ndep/aerdepregrid.ncl) - 1266 (Threading problem with CNDV) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Go back to T31,sim_year=2000 -finidat file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts and datm - - scripts to mpiserial05_scripts4_101018 - datm to datm8_101008 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml -- Return to old - finidat file for T31 sim_year=2000 -M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - change - fearedep to datm_file_aero - -Summary of testing: - - bluefire/CESM testing: -PASS SMS_D.T31_g37.I1850CN.bluefire -PASS SMS_D.T31_g37.ICN.bluefire - -CLM tag used for the baseline comparison tests if applicable: clm4_0_13 - -Changes answers relative to baseline: T31 2000 cases - -=============================================================== -=============================================================== -Tag name: clm4_0_13 -Originator(s): erik (Erik Kluzek) -Date: Sat Oct 16 09:14:08 MDT 2010 -One-line Summary: Bring in PTCLM branch, add in T31 finidat file and turn off ice_runoff for T31 - -Purpose of changes: - -Bring in PTCLM work. Update externals for scripts, datm, drv. Get mksurfdata to have options to override soil/PFT with user input values. Fix some issues with getregional_datasets.pl. Remove old stand-alone CLM Makefile (always use CESM Macro's files and Makefile). More removal of ndepsrc in build-namelist. Turn off ice_runoff for T31. Add in T31 finidat file. - -Bugs fixed (include bugzilla ID): - 1189 (Create ability to change soil color/texture in mksurfdata) - 1188 (Add ability to handle control transient land-cover change) - 1206 (Problem looping over a single year of CPLHIST forcing) - 1211 (Small memory leak in CLM4 initialization) - 1223 (ESMF problem) -Known bugs (include bugzilla ID): - 701 (svn keyword) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1224 (Fix -aerdepgrid/ndepgrid options in PTCLM.py) - 1249 (problem in mksurfdata for PFT override mode) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart - 452 (Problem with support of soil-colors != 8 or 20) - -Type of tag: standard - -Describe any changes made to build system: - - Remove custom options to stand-alone build/test, require using cesm make files - -Describe any changes made to the namelist: None, although many new options to mksurfdata namelist - -List any changes to the defaults for the boundary datasets: New T31 finidat files - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, csm_share - - drv to drvseq3_1_37 - datm to datm8_100921 - csm_share to share3_101001 - scripts to PTCLM03_scripts4_101005 - -List all files eliminated: - - R models/lnd/clm/test/system/tests_posttag_breeze >>> rename to mirage ->>>>>>>>>>> Rename to module - R models/lnd/clm/tools/mksurfdata/mkglcmec.F90 - R models/lnd/clm/tools/mksurfdata/mksoicol.F90 - R models/lnd/clm/tools/mksurfdata/mksoitex.F90 - - R models/lnd/clm/bld/config_files/Makefile.in --- Remove always use CESM make - -List all files added and what they do: - ->>>>>>>>>>> Renames - A models/lnd/clm/test/system/tests_posttag_mirage - A models/lnd/clm/tools/mksurfdata/mkglcmecMod.F90 - A models/lnd/clm/tools/mksurfdata/mksoitexMod.F90 - A models/lnd/clm/tools/mksurfdata/mksoicolMod.F90 - ->>>>>>>>>>> Namelist settings for standard urban single-point - A models/lnd/clm/bld/namelist_files/use_cases/stdurbpt.xml - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>> Remove PTS_MODE restart/branch tests - M models/lnd/clm/test/system/tests_posttag_lynx_nompi - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_posttag_spot1 --------- remove hybrid test - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/tests_posttag_intrepid_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>> Change breeze+ for mirage changes for new build that requires CESM build files - M models/lnd/clm/test/system/TCB.sh -------------------- Set nc_path - M models/lnd/clm/test/system/config_files/_nrmexsc_ds -- Use -sitespf_pt - M models/lnd/clm/test/system/config_files/_nrvansc_ds -- Use -sitespf_pt - M models/lnd/clm/test/system/test_driver.sh ------------ Swap out mirage/storm for breeze+, add GEN machine options, remove CLM_CESMBLD - M models/lnd/clm/test/system/mknamelist ---------------- Use config_file variable - M models/lnd/clm/test/system/TSMscript_tools.sh -------- Add exedir - M models/lnd/clm/test/system/CLM_runcmnd.sh ------------ Add more options for yong, change breeze+ to mirage/storm - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850 ------ Add exedir - M models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850-2000 - Add exedir - ->>>>>>>>>>> Add new options to override dataset setttings with your own values for: soil color/texture, and PFT - M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 ----- Make private - M models/lnd/clm/tools/mksurfdata/mkglacier.F90 ---- Add option to zero out glacier - M models/lnd/clm/tools/mksurfdata/mkharvestMod.F90 - Add mkharvest_parse_oride to override harvesting - M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 ---- Move nglcec here - M models/lnd/clm/tools/mksurfdata/mklanwat.F90 ----- Add option to zero out lake - M models/lnd/clm/tools/mksurfdata/mkurban.F90 ------ Add option to zero out urban - M models/lnd/clm/tools/mksurfdata/mkvarsur.F90 ----- Make private - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 ----- Add new namelist options: soil_color, soil_sand, soil_clay, pft_idx, pft_frc - M models/lnd/clm/tools/mksurfdata/mkpftMod.F90 ----- Add init and override methods: mkpftInit, mkpft, and mkpft_parse_oride - M models/lnd/clm/tools/mksurfdata/Filepath --------- Add esmf_wrf_timemgr to directory list - M models/lnd/clm/tools/mksurfdata/Srcfiles --------- Change names, add shr_cal_mod, shr_string_mod, and ESMF files - - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl ---- Add new options to override your own values, and error check the input: -+ -dynpft "filename" Dynamic PFT/harvesting file to use -+ (rather than create it on the fly) -+ (must be consistent with first year) -+ -exedir "directory" Directory where mksurfdata program is -+ (by default assume it's in the current directory) -+OPTIONS to override the mapping of the input gridded data with hardcoded input -+ -+ -pft_frc "list of fractions" Comma delimited list of percentages for veg types -+ -pft_idx "list of veg index" Comma delimited veg index for each fraction -+ -soil_cly "% of clay" % of soil that is clay -+ -soil_snd "% of sand" % of soil that is sand - ->>>>>>>>>>> Start fixing some issues with getregional scripts -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - ->>>>>>>>>>> Add USER_FCTYP - M models/lnd/clm/tools/mksurfdata/Makefile - M models/lnd/clm/tools/interpinic/Makefile - M models/lnd/clm/tools/mkgriddata/Makefile - M models/lnd/clm/tools/mkdatadomain/Makefile - ->>>>>>>>>>> Remove stand-alone user options and require cesm_bld, add ice_runoff run_stopdate, and new finidat files for T31, more ndepmapalgo defaults ->>>>>>>>>>> Change stop_n values for urban single-point so will run to completion - M models/lnd/clm/bld/configure --------------- Remove options: test, cc, cflags, fc, fflags, fopt, gmake, ldflags, linker, mpi/nc_inc/_lib - add nc_path and mpi_path options, require cesm_bld, and remove logic for doing - clm-stand-alone build - M models/lnd/clm/bld/queryDefaultNamelist.pl - Check for valid values, add list options, - M models/lnd/clm/bld/queryDefaultXML.pm ------ Change a comment - M models/lnd/clm/bld/build-namelist ---------- Add setting of ice_runoff - M models/lnd/clm/bld/config_files/config_sys_defaults.xml --- Set more default machine names - M models/lnd/clm/bld/config_files/config_definition.xml ----- Remove compiler options above and add nc_path/mpi_path - - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Add run_stopdate and work on comments - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Add ice_runoff defaults, new finidat files for T31, add more ndepmapalgo defaults - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml - Change stop_n for urban single-point, add stop_date - - M models/lnd/clm/doc/UsersGuide/preface.xml - Change comment - ->>>>>>>>>>> Fix two code bugs (1211 and 1223) - M models/lnd/clm/src/main/iniTimeConst.F90 ------------ make sure to deallocate memory - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 -- add use statement needed for endrun - -Summary of testing: - - bluefire testing: All PASS except.. (up to 054 smI59) -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -032 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 - bluefire interactive testing: All PASS except.. -061 sm9S4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................FAIL! rc= 6 - bluefire/CESM testing: All PASS except -BFAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_11 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_11 - jaguar interactive testing: All PASS except... -005 smAK4 TSM.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -10 cold ............FAIL! rc= 10 -007 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -008 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -009 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/lf95 interactive testing: All PASS - mirage/storm.intel interactive testing: ALL PASS up to... -017 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 10+38 cold ....FAIL! rc= 13 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_12 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_12 -Originator(s): erik (Erik Kluzek) -Date: Fri Sep 10 13:07:03 MDT 2010 -One-line Summary: Add U10 to history, cesm1_0_rel06 updates, PTCLM02 updates (except - mksurfdata), remove ndepdat/dyn/faerdep - -Purpose of changes: - -Update to latest cesm1 release branch. Change SPMD from spmd to use_mpiserial in -configure. Remove old aerdep and ndepdat/dyn files from code and scripts. Change ccsm in -scripts to cesm. Add in new U10 field to history files, change old name to U10_DUST. Some -updates from PTCLM branch for XML database. Also perturb initial conditions read in from -initial file by pertlim. With with PERGRO CPP #ifdef a bit. Start adding in testing on -lynx. - -Bugs fixed (include bugzilla ID): - 1199 (Add trusted machine history file for PERGRO analysis) - 1196 (Add urban option to configure, delete GRANDVIEW ifdefs) - 1191 (UG documentation for single-point needs to change que to shared-que) - 1167 (Add note about reducing PE's for single-point mode) - 1115 (Make config_definition names the same as configure options) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1206 (Problem looping over a single year of CPLHIST forcing) - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1147 (mkgriddata can't straddle over Greenwich) - -Type of tag: std-test - -Describe any changes made to build system: - Names of configure modes changed: seq_ccsm to clm_stndln, and ext_ccsm_seq to ext_cesm - Add sitespf_pt option which will set either MEXICOCITY or VANCOUVER cpp ifdefs - Names of some configure options changed to make consistent with config_definition file. - -Describe any changes made to the namelist: Remove use_ndepstream/fndepdat/fndepdyn/faerdep - -List any changes to the defaults for the boundary datasets: - - New 10x15 rcp6 transient 1850-2100 pftdyn dataset - Add navy oro file to clm_tools XML file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, U10 code from Keith Oleson - -List any svn externals directories updated (csm_share, mct, etc.): scripts and datm - scripts to scripts4_100901a - datm to datm8_100830 - -List all files eliminated: - - D models/lnd/clm/src/main/aerdepMod.F90 - D models/lnd/clm/src/main/ndepFileMod.F90 - D models/lnd/clm/tools/ncl_scripts/convertUrbanOffline2Seq.ncl - D models/lnd/clm/tools/ncl_scripts/getndepdatFrom20thCentury.ncl - D models/lnd/clm/tools/mkgriddata/mkgriddata.ccsm_dom -- Rename to .cesm_dom - D models/lnd/clm/doc/UsersGuide/fixvan_datm.buildnml.diff - -List all files added and what they do: - ->>>>>>>>>> Transient test files for rcp2.6 and rcp4.5, start adding lynx testing - A models/lnd/clm/test/system/nl_files/clm_transient_rcp2.6 - A models/lnd/clm/test/system/nl_files/clm_transient_rcp4.5 - A models/lnd/clm/test/system/tests_posttag_lynx - A models/lnd/clm/test/system/tests_posttag_lynx_nompi - ->>>>>>>>>> Sample perturbation growth data for jaguar, intel and lahey - A models/lnd/clm/tools/ncl_scripts/RMSjaguar.dat - A models/lnd/clm/tools/ncl_scripts/RMSintel.dat - A models/lnd/clm/tools/ncl_scripts/RMSlahey.dat - - A models/lnd/clm/tools/mkgriddata/mkgriddata.cesm_dom - rename from .ccsm_dom - ->>>>>>>>>> Plot of sample bad perturbation error growth - A models/lnd/clm/doc/UsersGuide/badpergro.jpg - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>> Change ccsm_seq=>clm_stndln, spmd=>nouse_mpiserial - M models/lnd/clm/test/system/config_files/_nrsc_dh - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_nrsc_ds - M models/lnd/clm/test/system/config_files/17p_scnv_do - M models/lnd/clm/test/system/config_files/17p_cndvsc_m - M models/lnd/clm/test/system/config_files/_scnv_dh - M models/lnd/clm/test/system/config_files/_nrsc_dm - M models/lnd/clm/test/system/config_files/17p_cndvsc_o - M models/lnd/clm/test/system/config_files/4p_nrcasasc_ds - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_dm - M models/lnd/clm/test/system/config_files/_nrsc_do - M models/lnd/clm/test/system/config_files/_persc_dh - M models/lnd/clm/test/system/config_files/17p_cnexitspinupsc_do - M models/lnd/clm/test/system/config_files/17p_cndvsc_s - M models/lnd/clm/test/system/config_files/_nrsc_ds - M models/lnd/clm/test/system/config_files/_scnv_do - M models/lnd/clm/test/system/config_files/_persc_dm - M models/lnd/clm/test/system/config_files/_persc_do - M models/lnd/clm/test/system/config_files/4p_vodsrsc_dh - M models/lnd/clm/test/system/config_files/_persc_ds - M models/lnd/clm/test/system/config_files/_nrmexsc_ds - M models/lnd/clm/test/system/config_files/_mec10sc_dh - M models/lnd/clm/test/system/config_files/4p_vodsrsc_dm - M models/lnd/clm/test/system/config_files/_nrcnsc_do - M models/lnd/clm/test/system/config_files/17p_sc_dh - M models/lnd/clm/test/system/config_files/4p_vodsrsc_do - M models/lnd/clm/test/system/config_files/_mec10sc_dm - M models/lnd/clm/test/system/config_files/_nrcnsc_ds - M models/lnd/clm/test/system/config_files/4p_casasc_dh - M models/lnd/clm/test/system/config_files/4p_vodsrsc_ds - M models/lnd/clm/test/system/config_files/17p_sc_dm - M models/lnd/clm/test/system/config_files/_mec10sc_do - M models/lnd/clm/test/system/config_files/17p_sc_do - M models/lnd/clm/test/system/config_files/_sc_dh - M models/lnd/clm/test/system/config_files/_mec10sc_ds - M models/lnd/clm/test/system/config_files/4p_casasc_dm - M models/lnd/clm/test/system/config_files/4p_casasc_do - M models/lnd/clm/test/system/config_files/17p_sc_ds - M models/lnd/clm/test/system/config_files/_sc_dm - M models/lnd/clm/test/system/config_files/4p_casasc_ds - M models/lnd/clm/test/system/config_files/_nrsc_s - M models/lnd/clm/test/system/config_files/_sc_do - M models/lnd/clm/test/system/config_files/17p_cnsc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_m - M models/lnd/clm/test/system/config_files/_sc_ds - M models/lnd/clm/test/system/config_files/17p_cnsc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_do - M models/lnd/clm/test/system/config_files/_nrvansc_ds - M models/lnd/clm/test/system/config_files/17p_sc_h - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_do - M models/lnd/clm/test/system/config_files/4p_casasc_h - M models/lnd/clm/test/system/config_files/17p_sc_m - M models/lnd/clm/test/system/config_files/17p_sc_o - M models/lnd/clm/test/system/config_files/_sc_h - M models/lnd/clm/test/system/config_files/4p_casasc_m - M models/lnd/clm/test/system/config_files/4p_casasc_o - M models/lnd/clm/test/system/config_files/_sc_m - M models/lnd/clm/test/system/config_files/17p_vodsrsc_h - M models/lnd/clm/test/system/config_files/17p_cndvsc_dh - M models/lnd/clm/test/system/config_files/_sc_o - M models/lnd/clm/test/system/config_files/17p_vodsrsc_m - M models/lnd/clm/test/system/config_files/_sc_s - M models/lnd/clm/test/system/config_files/17p_cndvsc_dm - M models/lnd/clm/test/system/config_files/17p_vodsrsc_o - M models/lnd/clm/test/system/config_files/17p_cndvsc_do - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dh - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_dm - M models/lnd/clm/test/system/config_files/17p_cnadspinupsc_do - M models/lnd/clm/test/system/config_files/17p_vodsrsc_dh - M models/lnd/clm/test/system/config_files/_scsnf_dh - M models/lnd/clm/test/system/config_files/4p_vodsnrsc_ds - M models/lnd/clm/test/system/config_files/17p_vodsrsc_dm - M models/lnd/clm/test/system/config_files/_scsnf_dm - M models/lnd/clm/test/system/config_files/17p_vodsrsc_do - M models/lnd/clm/test/system/config_files/4p_vodsrsc_h - M models/lnd/clm/test/system/config_files/_scsnf_do - M models/lnd/clm/test/system/config_files/17p_vodsrsc_ds - M models/lnd/clm/test/system/config_files/_mec10sc_h - M models/lnd/clm/test/system/config_files/4p_vodsrsc_o - M models/lnd/clm/test/system/config_files/_mec10sc_m - M models/lnd/clm/test/system/config_files/_mec10sc_o - M models/lnd/clm/test/system/config_files/17p_scnv_dh - M models/lnd/clm/test/system/config_files/17p_cndvsc_h - M models/lnd/clm/test/system/config_files/README --- seq-ccsm=>standalone clm - ->>>>>>>>>> Change comments of CCSM to CESM, start adding in test support of lynx, convert ->>>>>>>>>> SPMD to NOUSE_MPISERIAL, change mode name of seq_ccsm to clm_stndln, add tests ->>>>>>>>>> for more rcp's. - M models/lnd/clm/test/system/TCB.sh ------------- CCSM_MACH=>CESM_MACH, ccsm_bld=>cesm_bld - M models/lnd/clm/test/system/README.testnames --- Change ccsm=>cesm, seq_ccsm=>clm_stndln - M models/lnd/clm/test/system/test_driver.sh ----- Change CLM_CCSMBLD=>CLM_CESMBLD, - Start adding lynx. - M models/lnd/clm/test/system/input_tests_master - Add HX and HY tests, ccsm=>cesm - M models/lnd/clm/test/system/README ------------- CLM_CCSMBLD=>CLM_CESMBLD - M models/lnd/clm/test/system/CLM_runcmnd.sh ----- NOSPMD=>NOUSE_MPISERIAL - ->>>>>>>>>> Change comments from ccsm to cesm, change namelist to get faerdep file from, ->>>>>>>>>> work on pergro plot so can plot more graphs. - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl --- ccsm=>cesm, - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl -- ccsm=>cesm, - get aerdep file from clmexp clm_tool namelist - M models/lnd/clm/tools/ncl_scripts/RMSintrepid.dat ---- New data - M models/lnd/clm/tools/ncl_scripts/RMSbluefire.dat ---- New data - M models/lnd/clm/tools/ncl_scripts/aerdepregrid.ncl --- Get from clmexp namelist - M models/lnd/clm/tools/ncl_scripts/pergroPlot.ncl ----- Add ability to plot up to - five files, make sure lines are different, add success line to end. - M models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl - Do some operations with - out meta-data to save time and remove warnings - M models/lnd/clm/tools/ncl_scripts/README --------- Change ccsm=>cesm and improve - M models/lnd/clm/tools/interpinic/runinit_ibm.csh - Change ccsm=>cesm - M models/lnd/clm/tools/mkgriddata/mkvarctl.F90 ---- Correct documentation, ccsm=>cesm - M models/lnd/clm/tools/mkgriddata/mkgriddata.F90 -- ccsm=>cesm - M models/lnd/clm/tools/mkgriddata/README ---------- ccsm=>cesm - M models/lnd/clm/tools/mkdatadomain/addglobal.F90 - ccsm=>cesm - ->>>>>>>>>> Changes comments of ccsm to cesm, add sitespf_pt config option, remove ->>>>>>>>>> -ndepsrc, add ndepmapalgo, switch prog_seasalt for progsslt, spmd for ->>>>>>>>>> nouse_mpiserial, change names of modes - M models/lnd/clm/bld/configure ---------------- ccsm=>cesm, +sitespf_pt, - prog_seasalt=>progsslt, spmd=>nouse_mpiserial, modes changed to - ext_cesm, and clm_stndln, remove setting of SPMD cppdef - M models/lnd/clm/bld/queryDefaultNamelist.pl -- ccsm=>cesm - M models/lnd/clm/bld/queryDefaultXML.pm ------- Remove ability to use cam config - file, spmd=>nouse_mpiserial - M models/lnd/clm/bld/build-namelist ----------- ccsm=>cesm, remove -ndepsrc, - add rcp to some settings, ccsm_seq=>clm_stndln, set start_ymd from - runstart_date, add settings of ndepmapalgo, remove fndepdat/dyn/faerdep - M models/lnd/clm/bld/clm.cpl7.template -------- Remove -spmd, mode now ext_cesm, - ccsm=>cesm - M models/lnd/clm/bld/README ------------------- CCSM=>CESM - M models/lnd/clm/bld/config_files/Makefile.in - SPMD=>NOUSE_MPISERIAL, ccsm=>cesm - M models/lnd/clm/bld/config_files/config_definition.xsl --- Titles to caption, - put valid_values under description - M models/lnd/clm/bld/config_files/config_sys_defaults.xml - spmd=>nouse_mpiserial - M models/lnd/clm/bld/config_files/config_definition.xml --- +sitespf_pt, - comp_interface=>comp_intf, ccsm=>cesm, spmd=>nouse_mpiserial, mode - valid values are: ext_cesm, clm_stndln - ->>>>>>>>>> Remove ndepsrc/usr_ndepstream/fndepdat/fndepdyn/faerdep add mksrf_navyoor ->>>>>>>>>> Change comments from ccsm to cesm, exchange run_startdate for start_ymd, add ->>>>>>>>>> ndepmapalo, add stop_option/stop_n settings for spinup modes - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --------- Remove - ndepsrc/use_ndepstream/fndepdat/dyn/faerdep, ccsm=>cesm, add mksrf_navyoro, - run_startdate, faerdep and fndepdat for aerdepregrid/ndepregrid tools, - add 0.33x0.33 resolution for navyoro file - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml --- Remove - ndepsrc add defaults when sitespf_pt is set - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ------ rcp6 datm_presaero - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl ----------- Add sitespf_pt - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl --------- Headers to captions - M models/lnd/clm/bld/namelist_files/datm-build-namelist ------------- ccsm=>cesm - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ------- ccsm=>cesm, - remove use_ndepstream, faerdep, fndepdat, fndepdyn - add ndepmapalgo - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - Add navy oro - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ------- Add - stop_option/stop_n for spinup modes, change start_ymd for run_startdate - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Add ndepmapalgo - ->>>>>>>>>> Change config mode names (from ccsm_seq to clm_stndln), remove ndepsrc, ->>>>>>>>>> remove start_ymd, clm_demand just sets fpftdyn (fndepdat/dyn removed) - M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml ---- mode - changes to clm_stndln - M models/lnd/clm/bld/namelist_files/use_cases/glacier_mec.xml ----- mode - changes to clm_stndln - M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml ---- mode - changes to clm_stndln - M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml - mode - changes to clm_stndln, remove start_ymd, clm_demand just sets fpftdyn - remove ndepsrc - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - mode - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - mode - changes to clm_stndln, remove start_ymd, clm_demand just sets fpftdyn - remove ndepsrc - M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - mode - changes to clm_stndln, clm_demand just sets fpftdyn remove ndepsrc - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml --- mode - changes to clm_stndln, remove start_ymd, clm_demand just sets fpftdyn - remove ndepsrc - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - mode - changes to clm_stndln, remove start_ymd, clm_demand just sets fpftdyn - remove ndepsrc - M models/lnd/clm/bld/namelist_files/use_cases/pergro.xml -- Also output TSA - M models/lnd/clm/bld/namelist_files/use_cases/pergro0.xml - Also output TSA - ->>>>>>>>>> Change so any scripts calls start with "./", ccsm=>cesm, remove ndepsrc ->>>>>>>>>> Use macro for PTS_MODE, use .submit rather than .run scripts. ->>>>>>>>>> Add bit about managing your data with link_dirtree, add more notes and ->>>>>>>>>> examples for PERGRO testing, add more notes about using batch for single-pt ->>>>>>>>>> mode - M models/lnd/clm/doc/UsersGuide/trouble_shooting.xml -- Add more about ccsm log file - M models/lnd/clm/doc/UsersGuide/config_cache.xml ------ Update from configure - M models/lnd/clm/doc/UsersGuide/single_point.xml ------ Add section on which mode - Add warning about single-point on batch machines, remove warning about - error that was fixed, remove notes about setting ndepsrc - M models/lnd/clm/doc/UsersGuide/special_cases.xml ----- Use .submit, add notes - about using provided history files from bluefire for PERGRO testing, and - add bit about TSA as well as TSOI, add more machines and examples of - bad pergro for PERGRO examples. - M models/lnd/clm/doc/UsersGuide/tools.xml ------------- Remove ndepsrc stuff - M models/lnd/clm/doc/UsersGuide/preface.xml ----------- Talk about very latest updates. - remove bit about PERGRO not validated - M models/lnd/clm/doc/UsersGuide/clm_ug.xml ------------ Update version, remove bug fix - M models/lnd/clm/doc/UsersGuide/appendix.xml ---------- - M models/lnd/clm/doc/UsersGuide/adding_files.xml ------ Add bit about managing your - data when you use link_dirtree, update table, remove ndepsrc - M models/lnd/clm/doc/UsersGuide/custom.xml ------------ Remove bit about rcp experimental - comment out tables that cause docbook to fail with a seg fault. - M models/lnd/clm/doc/UsersGuide/pergro.jpg ------------ New data - M models/lnd/clm/doc/UsersGuide/Makefile -------------- Remove vandif bug fix - M models/lnd/clm/doc/Quickstart.userdatasets ---------- Shorten lines remove faerdep - correct procedure - M models/lnd/clm/doc/Quickstart.GUIDE ----------------- Use .submit script - M models/lnd/clm/doc/UsersGuide/stylesheethtml2docbook.xsl - Change tables from - informal to formal, using captions for titles, add template for bold. - ->>>>>>>>>> Changes comments for CCSM to CESM, remove misc.h and preproc.h #includes ->>>>>>>>>> Remove use_ndepstream/fndepdat/fndepdyn/faerdep/set_*dep_from_file ->>>>>>>>>> Add u10_clm and va, add ability to perturb IC from startup finidat file - M models/lnd/clm/src/biogeochem/DUSTMod.F90 ----- CCSM=>CESM, remove misc/preproc.h - M models/lnd/clm/src/main/clm_comp.F90 ---------- CCSM=>CESM - M models/lnd/clm/src/main/clm_initializeMod.F90 - Remove use_ndepstream logic - hardwire it to on - M models/lnd/clm/src/main/clm_glclnd.F90 -------- CCSM=>CESM - M models/lnd/clm/src/main/clmtypeInitMod.F90 ---- Add u10 and va - M models/lnd/clm/src/main/clm_atmlnd.F90 -------- Rm set_caerdep_from_file/dustdep - M models/lnd/clm/src/main/controlMod.F90 -------- Rm fndepdat, fndepdyn, - use_ndepstream, faerdep, ccsm=>cesm - M models/lnd/clm/src/main/clm_time_manager.F90 -- ccsm=>cesm, remove misc/preproc.h - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 --- lnd_chkAerDep_mct just - aborts if aerosols NOT sent from atm. - M models/lnd/clm/src/main/clm_driver.F90 ------------- Rm aerdep and old ndep interpoaltion - M models/lnd/clm/src/main/clm_varctl.F90 ------------- Rm set_caerdep_from_file/dustdep, - faerdep, fndepdat, fndepdyn, use_ndepstream - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - lnd_chkAerDep_mct just - aborts if aerosols NOT sent from atm. - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_mct.F90 -- ccsm=>cesm - M models/lnd/clm/src/main/surfrdMod.F90 ---------- ccsm=>cesm, remove misc/preproc.h - M models/lnd/clm/src/main/domainMod.F90 ---------- Rm misc/preproc.h, ccsm=>cesm - M models/lnd/clm/src/main/clmtype.F90 ------------ Add u10_clm, and va - M models/lnd/clm/src/main/histFldsMod.F90 -------- Add U10, and VA, and mv old U10 to U10_DUST - M models/lnd/clm/src/main/mkarbinitMod.F90 ------- Make into module, remove - misc/preproc.h, add seperate subroutine to perturb initial conditions - M models/lnd/clm/src/biogeophys/UrbanInitMod.F90 - Remove misc/preproc.h, - remove GRANDVIEW #ifdefs - M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 - Add u10/va, - remove misc/preproc.h and concurrent loops - M models/lnd/clm/src/biogeophys/BiogeophysicsLakeMod.F90 Add some PERGRO #ifdef - remove misc/preproc.h - M models/lnd/clm/src/biogeophys/BiogeophysRestMod.F90 --- Add perturbIC call - remove misc/preproc.h and concurrent loops - M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 ---- Remove misc/preproc.h, - KO comments and concurrent loops - M models/lnd/clm/src/biogeophys/UrbanMod.F90 ------------ Remove misc/preproc.h, - and GRANDVIEW #ifdefs - - M README - Start with ./, and correct .build script name, and use .submit in exp - -Summary of testing: - - bluefire interactive testing: All PASS except... -025 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - jaguar: All PASS except... -007 brB91 TBR.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 72+72 arb_ic .............FAIL! rc= 13 - jaguar interactive testing: -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - edinburgh/lf95 interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 - edinburgh/lf95: All PASS except... -005 smD91 TSM.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 10 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 72+72 cold ...............FAIL! rc= 5 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 smG56 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -013 smE91 TSM.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 96 arb_ic ............FAIL! rc= 10 -014 erE91 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 10+38 arb_ic .........FAIL! rc= 5 -015 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v7 72+72 arb_ic ......FAIL! rc= 5 -018 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 10+38 cold .......FAIL! rc= 13 -019 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@2000 72+72 cold ....FAIL! rc= 11 -025 smL51 TSM.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -026 erL51 TER.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -027 brL51 TBR.sh _sc_dh clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -029 smH41 TSM.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 96 cold FAIL! rc= 10 -030 erH41 TER.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coFAIL! rc= 5 -031 brH41 TBR.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coFAIL! rc= 5 -033 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -017 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 10+38 cold ....FAIL! rc= 13 -018 brR53 TBR.sh 17p_cnc13sc_do clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@1850 72+72 cold .FAIL! rc= 11 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG53 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -025 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coFAIL! rc= 13 -026 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coFAIL! rc= 11 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_11 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_11 -Originator(s): erik (Erik Kluzek) -Date: Fri Aug 27 14:14:37 MDT 2010 -One-line Summary: New files for rcp6, fix MPI bug, update externals - -Purpose of changes: - -Add in new pftdyn and stream_ndep files for rcp=6.0. Fix MPI bug where send array was the same as receive array. -Fix problem with datm template on gust, and syntax errors for pt1_pt1 mode. Add start_tod to drv/scripts. - -Bugs fixed (include bugzilla ID): - 1197 (MPI problem sending and receiving data in same array) - 1207 (Problem with datm template on gust) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1206 (Problem looping over a single year of CPLHIST forcing) - http://bugs.cgd.ucar.edu/ - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - Add ndepmapalgo - Move datasets just for clm tools to clm_tools namelist_defaults XML file - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, -csm_share - scripts to scripts4_100730 - drv to drvseq3_1_33 - datm to datm8_100728 - csm_share to share3_100802 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>>> Add configure test file for serial - A models/lnd/clm/test/system/config_files/4p_vodsnrsc_ds - ->>>>>>>>>>>> Add some files to test mksurfdata.pl script - A models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850 - A models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850-2000 - ->>>>>>>>>>>> Put all files for clm-tools in seperate file - A models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - ->>>>>>>>>>>> Add new chapter on trouble shooting, add a script to limit ->>>>>>>>>>>> the line lengths, add style sheet to convert HTML XSL table ->>>>>>>>>>>> to docbook. Add file to fix vancouver problem. - A models/lnd/clm/doc/UsersGuide/trouble_shooting.xml - A models/lnd/clm/doc/UsersGuide/limitLineLen.pl - A models/lnd/clm/doc/UsersGuide/addxhtmlhead.pl - A models/lnd/clm/doc/UsersGuide/stylesheethtml2docbook.xsl - A models/lnd/clm/doc/UsersGuide/fixvan_datm.buildnml.diff - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Change some of the tests around - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_pretag_jaguar - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>>> Work with testing a bit, add mksurfdata.pl and drydep tests - M models/lnd/clm/test/system/README.testnames ---- Add "V" drydep test - M models/lnd/clm/test/system/test_driver.sh ------ Add pftdata, change -multi-processing a bit - M models/lnd/clm/test/system/TSMscript_tools.sh -- Fix some glitches - M models/lnd/clm/test/system/gen_test_table.sh --- Convert to xhtml - M models/lnd/clm/test/system/nl_files/clm_usrdat - Remove non-streams mode for ndep -and aerdep - M models/lnd/clm/test/system/input_tests_master -- Add mksurfdata.pl and drydep tests - make scsnf 4x5 rather than 10x15 - ->>>>>>>>>>>> Add -nomv, usrname, and pftdyn options, add ability to run in ->>>>>>>>>>>> a different directory, check for vegtyp files before running. - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl - ->>>>>>>>>>>> Handle rcp's correctly, and handle datm streams for presaero files ->>>>>>>>>>>> and ndep streams files - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -- default rcp=hist, set - RCP to ncl script - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - add ability to handle - usrname files, and handle ndep and aerdep streams files correctly - ->>>>>>>>>>>> Move tools files into clm_tools default file, add ndepmapalgo ->>>>>>>>>>>> Work on the formatting of the files, do better with clm_usrdat_name - M models/lnd/clm/bld/queryDefaultNamelist.pl - Add clm_tools default file. - Don't limit list to -var, as now done in .pm file below. - M models/lnd/clm/bld/queryDefaultXML.pm ------ If -var set, don't process variables - that don't match - M models/lnd/clm/bld/config_files/config_definition.xsl - Change to lowercase - for xhtml standard, remove glacier list - M models/lnd/clm/bld/config_files/config_definition.xml - Put glc_nec in physics list - M models/lnd/clm/bld/build-namelist --------------------- Fix minor doc issues - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Add ndepmapalgo, - change formatting for GPTL options - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl ----- Improve formatting, - put note in table if All: res, masks, yrs, or sim_yr_rng - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl --- Improve formatting - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Remove mksrf_fvegtyp - files and fndepdat files for single-years only used for processing -tools - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Add in handling - of rcp's, and stream_fldfilename_ndep, remove fndepdat/dyn - ->>>>>>>>>>>> Update to documentation from update to cesm1_0_rel_05 - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/get_Icaselist.pl - M models/lnd/clm/doc/UsersGuide/special_cases.xml - M models/lnd/clm/doc/UsersGuide/co2_streams.txt - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/clm_ug.xml - M models/lnd/clm/doc/UsersGuide/appendix.xml - M models/lnd/clm/doc/UsersGuide/adding_files.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - M models/lnd/clm/doc/UsersGuide/Makefile - M models/lnd/clm/doc/Quickstart.userdatasets - M models/lnd/clm/doc/KnownBugs - M models/lnd/clm/doc/README - M models/lnd/clm/src/main/ndepStreamMod.F90 - M models/lnd/clm/src/main/surfrdMod.F90 - ->>>>>>>>>>>> Update to documentation from update to cesm1_0_rel_05 - M Copyright - M README - -Summary of testing: - - bluefire: All PASS except... -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -032 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -038 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 10 -039 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -3+-7 arb_ic .......FAIL! rc= 5 -040 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -5+-5 arb_ic .......FAIL! rc= 5 -041 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 4 - bluefire interactive testing: All PASS except... -006 smHS3 TSM.sh _nrcnsc_do clm_usrdat 20030101:NONE:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .FAIL! rc= 8 -007 erHS3 TER.sh _nrcnsc_do clm_usrdat 20030101:NONE:1800 13x12pt_f19_alaskaUSA gx1v6 -3+-3 arb_ic FAIL! rc= 5 -008 brHS3 TBR.sh _nrcnsc_do clm_usrdat 20030101:NONE:1800 13x12pt_f19_alaskaUSA gx1v6 -3+-3 arb_ic FAIL! rc= 5 -009 blHS3 TBL.sh _nrcnsc_do clm_usrdat 20030101:NONE:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .FAIL! rc= 4 -025 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -026 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -030 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -065 sm9S4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................FAIL! rc= 6 -066 sm974 TSMscript_tools.sh mksurfdata mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds ....FAIL! rc= 6 - bluefire/CESM testing: -FAIL SMS_RLA.f45_f45.I.bluefire -BFAIL SMS_RLA.f45_f45.I.bluefire.generate.clm4_0_11 -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_10 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_10 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_10 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_10 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_10 -FAIL ERI.f19_g16.IG.bluefire.compare.clm4_0_10 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_10 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_11 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_10 -FAIL PST.f10_f10.I8520CN.bluefire.compare.clm4_0_10 -FAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm4_0_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_10 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_10 -Originator(s): erik (Erik Kluzek) -Date: Wed Aug 4 14:37:59 MDT 2010 -One-line Summary: Update doc to cesm_rel05, bug-fixes, fix issues for single-point, mksurfdata/getregional scripts - -Purpose of changes: - -Use nn instead of copy for CO2 patch file. Update documentation to latest cesm version -05. Update externals. Some changes to build-namelist for generic single-point -simulations. Move tools XML files to clm_tools namelist_default file. Add 4x5 drydep -test, work with testing a bit. Add tests for getregional.pl and mksurfdata.pl scripts. -Add: usrname, nomv and pftdata options to mksurfdata.pl. Get RCP's working in getregional -script. Update getregional to handle ndep and aerdep streams, also get it to run in a -different directory. XML query wont test variables that don't match when -var option is -specified. Convert test table to xhtml. Move glc_nec to physics. Add option for -ndepmapalgo. Get faerdep and fndep streams files working right in -namelist_defaults_usrdat.xml file. - -Bugs fixed (include bugzilla ID): - 1166 (get_regional script needs to be updated) - 1190 (add ndepmapalgo to ndep streams) - 1192 (Y1K problem for mksurfdata.pl) - 1193 (bug in reading GLCMASK) - 1207 (Problem with datm template on gust) - -Update of datm also fixes several issues with datm for single pt simulations: 1173, 1175, 1176, 1181 - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1197 (MPI problem sending and receiving data in same array) - 1206 (Problem looping over a single year of forcing) - http://bugs.cgd.ucar.edu/ - -Type of tag: standard - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - Add ndepmapalgo - Move datasets just for clm tools to clm_tools namelist_defaults XML file - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, csm_share - scripts to scripts4_100730 - drv to drvseq3_1_33 - datm to datm8_100728 - csm_share to share3_100802 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>>> Add configure test file for serial - A models/lnd/clm/test/system/config_files/4p_vodsnrsc_ds - ->>>>>>>>>>>> Add some files to test mksurfdata.pl script - A models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850 - A models/lnd/clm/test/system/nl_files/mksrfdt_1x1_brazil_1850-2000 - ->>>>>>>>>>>> Put all files for clm-tools in seperate file - A models/lnd/clm/bld/namelist_files/namelist_defaults_clm_tools.xml - ->>>>>>>>>>>> Add new chapter on trouble shooting, add a script to limit ->>>>>>>>>>>> the line lengths, add style sheet to convert HTML XSL table ->>>>>>>>>>>> to docbook. Add file to fix vancouver problem. - A models/lnd/clm/doc/UsersGuide/trouble_shooting.xml - A models/lnd/clm/doc/UsersGuide/limitLineLen.pl - A models/lnd/clm/doc/UsersGuide/addxhtmlhead.pl - A models/lnd/clm/doc/UsersGuide/stylesheethtml2docbook.xsl - A models/lnd/clm/doc/UsersGuide/fixvan_datm.buildnml.diff - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Change some of the tests around - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_pretag_jaguar - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>>> Work with testing a bit, add mksurfdata.pl and drydep tests - M models/lnd/clm/test/system/README.testnames ---- Add "V" drydep test - M models/lnd/clm/test/system/test_driver.sh ------ Add pftdata, change multi-processing a bit - M models/lnd/clm/test/system/TSMscript_tools.sh -- Fix some glitches - M models/lnd/clm/test/system/gen_test_table.sh --- Convert to xhtml - M models/lnd/clm/test/system/nl_files/clm_usrdat - Remove non-streams mode for ndep and aerdep - M models/lnd/clm/test/system/input_tests_master -- Add mksurfdata.pl and drydep tests - make scsnf 4x5 rather than 10x15 - ->>>>>>>>>>>> Add -nomv, usrname, and pftdyn options, add ability to run in ->>>>>>>>>>>> a different directory, check for vegtyp files before running. - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl - ->>>>>>>>>>>> Handle rcp's correctly, and handle datm streams for presaero files ->>>>>>>>>>>> and ndep streams files - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -- default rcp=hist, set - RCP to ncl script - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - add ability to handle - usrname files, and handle ndep and aerdep streams files correctly - ->>>>>>>>>>>> Move tools files into clm_tools default file, add ndepmapalgo ->>>>>>>>>>>> Work on the formatting of the files, do better with clm_usrdat_name - M models/lnd/clm/bld/queryDefaultNamelist.pl - Add clm_tools default file. - Don't limit list to -var, as now done in .pm file below. - M models/lnd/clm/bld/queryDefaultXML.pm ------ If -var set, don't process variables - that don't match - M models/lnd/clm/bld/config_files/config_definition.xsl - Change to lowercase - for xhtml standard, remove glacier list - M models/lnd/clm/bld/config_files/config_definition.xml - Put glc_nec in physics list - M models/lnd/clm/bld/build-namelist --------------------- Fix minor doc issues - M models/lnd/clm/bld/namelist_files/namelist_definition.xml --- Add ndepmapalgo, - change formatting for GPTL options - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl ----- Improve formatting, - put note in table if All: res, masks, yrs, or sim_yr_rng - M models/lnd/clm/bld/namelist_files/namelist_definition.xsl --- Improve formatting - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Remove mksrf_fvegtyp - files and fndepdat files for single-years only used for processing tools - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Add in handling - of rcp's, and stream_fldfilename_ndep, remove fndepdat/dyn - ->>>>>>>>>>>> Update to documentation from update to cesm1_0_rel_05 - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/get_Icaselist.pl - M models/lnd/clm/doc/UsersGuide/special_cases.xml - M models/lnd/clm/doc/UsersGuide/co2_streams.txt - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/clm_ug.xml - M models/lnd/clm/doc/UsersGuide/appendix.xml - M models/lnd/clm/doc/UsersGuide/adding_files.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - M models/lnd/clm/doc/UsersGuide/Makefile - M models/lnd/clm/doc/Quickstart.userdatasets - M models/lnd/clm/doc/KnownBugs - M models/lnd/clm/doc/README - M models/lnd/clm/src/main/ndepStreamMod.F90 - M models/lnd/clm/src/main/surfrdMod.F90 - ->>>>>>>>>>>> Update to documentation from update to cesm1_0_rel_05 - M Copyright - M README - -Summary of testing: - - bluefire: All PASS except... -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -032 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -055 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -056 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -057 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -058 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 - bluefire interactive testing: All PASS except... -009 blHS3 TBL.sh _nrcnsc_do clm_usrdat 20030101:NONE:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .FAIL! rc= 4 -025 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -026 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -030 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - bluefire/CESM testing: All PASS except... -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_10 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_09 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -012 blG43 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - edinburgh/lf95 interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 - edinburgh/lf95: All PASS except... -005 smD91 TSM.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 10 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 72+72 cold ...............FAIL! rc= 5 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 4 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG56 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -013 smE91 TSM.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 96 arb_ic ............FAIL! rc= 10 -014 erE91 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 10+38 arb_ic .........FAIL! rc= 5 -015 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v7 72+72 arb_ic ......FAIL! rc= 5 -016 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 arb_ic ............FAIL! rc= 4 -018 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 10+38 cold .......FAIL! rc= 13 -019 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@2000 72+72 cold ....FAIL! rc= 11 -025 smL51 TSM.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -026 erL51 TER.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -027 brL51 TBR.sh _sc_dh clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -028 blL51 TBL.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 4 -029 smH41 TSM.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 96 cold FAIL! rc= 10 -030 erH41 TER.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coFAIL! rc= 5 -031 brH41 TBR.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coFAIL! rc= 5 -032 blH41 TBL.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 48 cold FAIL! rc= 4 -033 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_09 - -Changes answers relative to baseline: bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_09 -Originator(s): erik (erik) -Date: Mon Jun 14 00:02:12 MDT 2010 -One-line Summary: Fix some small issues, update documentation, and externals - -Purpose of changes: - -Work on documentation for CESM1.0 release, with glcec changes, and namelist changes. Run -testing and fix bugs. Move documentation changes from release branch to trunk. Fix -getregional script for transient. Remove "At point 2" from lnd log files. Update -csm_share, and scripts version so can now run testing with lahey compiler. Get CO2 patch -file working. - -Bugs fixed (include bugzilla ID): - 1092 (Problems running on dublin with datm8 with debug) - 1159 (date in fco2 file is not used) - 1160 (Fix mksurfdata.pl script to work with 1000-1004) - 1167 (doc. about running single point reduce pes) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1166 (get_regional script needs to be updated) - 1192 (Y1K problem for mksurfdata.pl) - 1193 (bug in reading GLCMASK) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: std-test - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, -cism, csm_share - scripts to scripts4_100612 - drv to drvseq3_1_31 - datm to datm8_100612 - cism to cism1_100608 - csm_share to share3_100607 - -List all files eliminated: None - -List all files added and what they do: None - ->>>>>>>>>>>> Add testing configure file - A models/lnd/clm/test/system/config_files/_nrcnsc_do - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Add CLM_USRDAT_NAME and getregional.pl tests - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/tests_pretag_edinburgh_nompi - M models/lnd/clm/test/system/tests_posttag_nompi_regression - M models/lnd/clm/test/system/README.testnames - M models/lnd/clm/test/system/TSMscript_tools.sh - M models/lnd/clm/test/system/nl_files/clm_usrdat - M models/lnd/clm/test/system/nl_files/getregional - M models/lnd/clm/test/system/input_tests_master - M models/lnd/clm/test/system/README - ->>>>>>>>>>>> - M models/lnd/clm/tools/ncl_scripts/getco2_historical.ncl ---- Add comment that - date variable is NOT used - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.pl -- Add path to scripts - so can run from a different directory - M models/lnd/clm/tools/ncl_scripts/getregional_datasets.ncl - Fix warnings and - allow some files to not be converted if not needed - M models/lnd/clm/tools/ncl_scripts/pftdyntest2raw.ncl ------- Re-order longitudes - so from -180-180 rather than 0-360 - ->>>>>>>>>>>> - M models/lnd/clm/bld/queryDefaultXML.pm ----- Get working for usrdat better - M models/lnd/clm/bld/listDefaultNamelist.pl - Get working for usrdat files - M models/lnd/clm/bld/build-namelist --------- Allow lnd_res to be usrdat name - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - Set year first/last - for datm_presaero for clim_2000 - M models/lnd/clm/bld/namelist_files/datm-build-namelist -------- Don't allow - prognostic for datm_presaero - ->>>>>>>>>>>> Update documentation, add cprnc README to document - M models/lnd/clm/doc/UsersGuide/tools.xml - M models/lnd/clm/doc/UsersGuide/preface.xml - M models/lnd/clm/doc/UsersGuide/clm_ug.xml - M models/lnd/clm/doc/UsersGuide/adding_files.xml - M models/lnd/clm/doc/UsersGuide/appendix.xml - M models/lnd/clm/doc/UsersGuide/custom.xml - M models/lnd/clm/doc/UsersGuide/single_point.xml - M models/lnd/clm/doc/UsersGuide/Makefile - M models/lnd/clm/doc/UsersGuide/special_cases.xml - M models/lnd/clm/doc/UsersGuide/addco2_datm.buildnml.diff - Update patch to - work with the latest datm with DATM_PRESAERO - ->>>>>>>>>>>> Remove "at point 2" and fix esmf duplication from fix by Mariana - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - ->>>>>>>>>>>> Update README files and use CESM in place of CCSM - M models/lnd/clm/doc/Quickstart.userdatasets - M models/lnd/clm/doc/IMPORTANT_NOTES - M models/lnd/clm/doc/KnownBugs - M models/lnd/clm/doc/README - M models/lnd/clm/doc/index.shtml - M Copyright - M README - -Summary of testing: - - bluefire: All PASS except... -016 blF92 TBL.sh 17p_vodsrsc_dm clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 cold .............FAIL! rc= 5 -017 smEH1 TSM.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 10 -018 erEH1 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 10+38 arb_icFAIL! rc= 5 -019 brEH1 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 24+24 arbFAIL! rc= 5 -020 blEH1 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 4 -021 smHN1 TSM.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 8 -022 erHN1 TER.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -3+-7 cFAIL! rc= 3 -023 brHN1 TBR.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -5+-5 cFAIL! rc= 3 -024 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 3 -025 smHO2 TSM.sh 17p_cnsc_dm clm_drydep 20000704:NONE:1800 10x15 USGS@2000 -90 cold .............FAIL! rc= 3 -026 erHO2 TER.sh 17p_cnsc_dm clm_drydep 20000704:NONE:1800 10x15 USGS@2000 -3+-7 cold ...........FAIL! rc= 3 -027 brHO2 TBR.sh 17p_cnsc_dm clm_drydep 20000704:NONE:1800 10x15 USGS@2000 -5+-5 cold ...........FAIL! rc= 3 -028 blHO2 TBL.sh 17p_cnsc_dm clm_drydep 20000704:NONE:1800 10x15 USGS@2000 -90 cold .............FAIL! rc= 3 -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 3 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 3 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 3 -032 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 3 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 3 -034 smH41 TSM.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 96 cold FAIL! rc= 3 -035 erH41 TER.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coFAIL! rc= 3 -036 brH41 TBR.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coFAIL! rc= 3 -037 blH41 TBL.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 48 cold FAIL! rc= 3 -038 smC45 TSM.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 3 -039 erC45 TER.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -3+-7 arb_ic .......FAIL! rc= 3 -040 brC45 TBR.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -5+-5 arb_ic .......FAIL! rc= 3 -041 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........FAIL! rc= 3 -042 smC61 TSM.sh _scnv_dh clm_std^nl_urb 20020101:NONE:1800 1.9x2.5 gx1v6 -6 startup ............FAIL! rc= 3 -043 erC61 TER.sh _scnv_dh clm_std^nl_urb 20020101:NONE:1800 1.9x2.5 gx1v6 10+38 startup .........FAIL! rc= 3 -044 brC61 TBR.sh _scnv_dh clm_std^nl_urb_br 20020101:NONE:1800 1.9x2.5 gx1v6 -3+-3 startup ......FAIL! rc= 3 -045 blC61 TBL.sh _scnv_dh clm_std^nl_urb 20020101:NONE:1800 1.9x2.5 gx1v6 48 startup ............FAIL! rc= 3 -046 smH52 TSM.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 96 cold ..........FAIL! rc= 3 -047 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 10+38 cold .......FAIL! rc= 3 -048 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@2000 72+72 cold ....FAIL! rc= 3 -049 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 48 cold ..........FAIL! rc= 3 -050 smV61 TSM.sh _mec10sc_dh clm_glcmec 19980115:NONE:1800 1.9x2.5 gx1v6 96 arb_ic ..............FAIL! rc= 3 -051 erV61 TER.sh _mec10sc_dh clm_glcmec 19980115:NONE:1800 1.9x2.5 gx1v6 10+38 arb_ic ...........FAIL! rc= 3 -052 brV61 TBR.sh _mec10sc_dh clm_std 19980115:NONE:1800 1.9x2.5 gx1v6 72+72 arb_ic ..............FAIL! rc= 3 -053 blV61 TBL.sh _mec10sc_dh clm_glcmec 19980115:NONE:1800 1.9x2.5 gx1v6 48 arb_ic ..............FAIL! rc= 3 -054 smI59 TSMcnspinup.sh 17p_cnadspinupsc_dm 17p_cnexitspinupsc_dm 17p_cnsc_dm clm_std 20020115:NONEFAIL! rc= 3 -055 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 3 -056 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 3 -057 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 3 -058 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 3 -059 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 3 -060 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 3 -061 brL58 TBR.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 3 -062 blL58 TBL.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 48 arb_ic ...............FAIL! rc= 3 -063 smJ61 TSM.sh 4p_casasc_dh clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 96 cold ...........FAIL! rc= 3 -064 erJ61 TER.sh 4p_casasc_dh clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 10+38 cold ........FAIL! rc= 3 -065 brJ61 TBR.sh 4p_casasc_dh clm_std^nl_urb_br 20021230:NONE:1800 1.9x2.5 gx1v6 72+72 cold .....FAIL! rc= 3 -066 blJ61 TBL.sh 4p_casasc_dh clm_std^nl_urb 20021230:NONE:1800 1.9x2.5 gx1v6 48 cold ...........FAIL! rc= 3 -067 smJ05 TSM.sh 4p_casasc_h clm_std^nl_lfiles 19800101:NONE:1800 0.47x0.63 gx1v6 48 arb_ic .....FAIL! rc= 3 - bluefire interactive testing: All PASS except... -009 blHS3 TBL.sh _nrcnsc_do clm_usrdat 20030101:NONE:1800 13x12pt_f19_alaskaUSA gx1v6 -6 arb_ic .FAIL! rc= 5 -021 blJ74 TBL.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test -100 arb_ic FAIL! rc= 5 -025 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -026 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -030 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -062 sm854 TSMtools.sh interpinic tools__ds runoptions ...........................................FAIL! rc= 3 -063 sm853 TSMtools.sh interpinic tools__o runoptions ............................................FAIL! rc= 3 -064 smZ94 TSMtools.sh mkdatadomain tools__ds namelist ...........................................FAIL! rc= 3 -065 sm9S4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional ....................FAIL! rc= 3 - bluefire/CESM testing: All PASS except... -BFAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_08 -BFAIL ERI.f19_g16.IG.bluefire.compare.clm4_0_08 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_09 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_08 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -025 smV23 TSM.sh _mec10sc_do clm_glcmec 19980115:NONE:1800 48x96 gx3v7 96 arb_ic ................FAIL! rc= 8 -026 erV23 TER.sh _mec10sc_do clm_glcmec 19980115:NONE:1800 48x96 gx3v7 10+38 arb_ic .............FAIL! rc= 5 -027 brV23 TBR.sh _mec10sc_do clm_std 19980115:NONE:1800 48x96 gx3v7 72+72 arb_ic ................FAIL! rc= 5 - jaguar/CESM testing: All PASS - edinburgh/lf95 interactive testing: All PASS except... -004 blA74 TBL.sh _nrsc_ds clm_std^nl_urb 20030101:NONE:1800 1x1_brazil navy -10 arb_ic ..........FAIL! rc= 5 -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -008 blAL4 TBL.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -10 cold ...............FAIL! rc= 5 -012 blCA4 TBL.sh _nrsc_ds clm_std^nl_urb 20021001:NONE:3600 1x1_camdenNJ navy -90 arb_ic ........FAIL! rc= 5 - edinburgh/lf95: All PASS except... -005 smD91 TSM.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 10 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 72+72 cold ...............FAIL! rc= 5 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 4 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -012 smG56 TSM.sh 17p_sc_m clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -013 smE91 TSM.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 96 arb_ic ............FAIL! rc= 10 -014 erE91 TER.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 10+38 arb_ic .........FAIL! rc= 5 -015 brE91 TBR.sh 4p_vodsrsc_dh clm_std^nl_urb_br 20021230:NONE:1800 4x5 gx3v7 72+72 arb_ic ......FAIL! rc= 5 -016 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 arb_ic ............FAIL! rc= 4 -018 erH52 TER.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 10+38 cold .......FAIL! rc= 13 -019 brH52 TBR.sh 17p_cnsc_dm clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@2000 72+72 cold ....FAIL! rc= 11 -025 smL51 TSM.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 96 arb_ic ..................FAIL! rc= 10 -026 erL51 TER.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 10+38 arb_ic ...............FAIL! rc= 5 -027 brL51 TBR.sh _sc_dh clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -028 blL51 TBL.sh _sc_dh clm_std^nl_urb 20020115:NONE:1800 10x15 USGS 48 arb_ic ..................FAIL! rc= 4 -029 smH41 TSM.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 96 cold FAIL! rc= 10 -030 erH41 TER.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coFAIL! rc= 5 -031 brH41 TBR.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coFAIL! rc= 5 -032 blH41 TBL.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 48 cold FAIL! rc= 4 -033 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_08 - -Changes answers relative to baseline: bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_08 -Originator(s): erik (erik) -Date: Fri Jun 4 01:25:39 MDT 2010 -One-line Summary: Snow hydrology bug fix from Keith and Dave - -Purpose of changes: - -SnowHydrology bug fix from Keith Oleson. For test-suite, make default to send aerosol -data through datm. Update version of cism, scripts and datm. Remove some of the old aerdep -stuff from the XML database as we now are using presaero from datm (leave 1-deg and -2-deg). - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1166 (get_regional script needs to be updated) - 1192 (Y1K problem for mksurfdata.pl) - 1193 (bug in reading GLCMASK) - 1197 (MPI problem sending and receiving data in same array) - 1206 (Problem looping over a single year of forcing) - http://bugs.cgd.ucar.edu/ - -Type of tag: critical - -Describe any changes made to build system: none - -Describe any changes made to the namelist: Move datm_presaero to overall defaults - -List any changes to the defaults for the boundary datasets: - Remove all faerdep files except f09 and f19 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - code changes come from Keith Oleson and Dave Lawrence - -List any svn externals directories updated (csm_share, mct, etc.): scripts, cism and drv - scripts to scripts4_100603a - drv to drvseq3_1_29 - cism to cism1_100603 - -List all files eliminated: None - -List all files added and what they do: - - A models/lnd/clm/test/system/config_files/17p_cnsc_m - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/system/nl_files/clm_ndepdyn - Switch demand for ndepdyn for - ndepsrc stream - - M models/lnd/clm/bld/build-namelist ----- Get datm_presaero if not null - do NOT set faerdep - M models/lnd/clm/bld/clm.cpl7.template -- Set datm_presaero by DATM_PRESAERO - if datm or to prognostic if not (so aerosol dep require from atm) - - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Set - datm_presaero by resolution, sim_year, sim_year_range and rcp - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ---- Remove datm_presaero - M models/lnd/clm/bld/namelist_files/datm-build-namelist ----------- Set - datm_presaero by resolution, sim_year, sim_year_range and rcp - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- Remove - all faerdep files except for f09 and 19 - - M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 - Snow hydrology fix - -Summary of testing: - - bluefire interactive testing: All PASS up to... -014 smJ74 TSM.sh 4p_nrcasasc_ds clm_std^nl_urb 10001230:NONE:3600 1x1_tropicAtl test --1100 arb_ic FAIL! rc= 10 - bluefire/CCSM testing: All PASS except.. -FAIL SMS_RLB.f45_f45.I.bluefire -BFAIL SMS_RLB.f45_f45.I.bluefire.generate.clm4_0_08 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_06 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_06 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_06 -FAIL PST.f45_g37.I1850.bluefire.compare.clm4_0_06 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm4_0_06 -FAIL ERS_E.f19_g16.I1850.bluefire.compare_hist.clm4_0_06 -FAIL ERS_E.f19_g16.I1850.bluefire.compare.clm4_0_06 -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_06 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_08 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_06 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_06 -FAIL PST.f10_f10.I8520CN.bluefire.compare.clm4_0_06 -FAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm4_0_06 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_06 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_06 - Extra testing: -PASS ERI.f19_g16.IG.bluefire -Make sure answers agree with /OLESON/csm/ccsm4_0_beta52_ndepaer other than VOC fields -Test that F case will configure.. -create_newcase -compset F -case testF -res f19_g16 -mach bluefire -skip_rundb - -CLM tag used for the baseline comparison tests if applicable: clm4_0_07 - -Changes answers relative to baseline: YES - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: ALL - - what platforms/compilers: ALL - - nature of change: larger than roundoff/same climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - - - platform/compilers: IBM - - compset (and additional configure options): I1850CN - - build-namelist options (or complete namelist): -ndepsrc stream - - MSS location of control simulations used to validate new climate: - - /OLESON/csm/ccsm4_0_beta52_ndepaer - /OLESON/csm/ccsm4_0_beta52_ndepaertrans - - The above is identical to this tag (other than the two VOC fields that changed) - -=============================================================== -=============================================================== -Tag name: clm4_0_07 -Originator(s): erik (erik) -Date: Thu Jun 3 21:22:46 MDT 2010 -One-line Summary: Some cleanup/fix bugs, add RTM var, add albice to namelist, allow last-millenium in mksurfdata, allow setting of datm_presaero in clm test-suite - -Purpose of changes: - -Fix mksurfdata.pl, to correctly create 1000-1004 test datasets. Fix drydep for OpenMP. -Update 1x1_tropicAtl_1000-1004 test fsurdat file. Move glc_grid from configure to -build-namelist. Add in alb_ice to namelist. Start adding in the capability to handle -mksurfdata from 0850-1850AD, put all mksrf_fvegtyp files in XML database (remove some of -the sample pftdyn text files). New RTM field on history output from Sean (VOLR and -VOLR_ICE, only VOLR output by default). Allow use of aerosol data from datm for I cases -in the clm test suite. Split out datm-build-namelist from clm build-namelist (put in -bld/namelist_files). - -Bugs fixed (include bugzilla ID): - 1162 (OpenMP bug with dry-deposition code in clm) - 883 (aerosol deposition not from atm) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1163 (finidat file has a bunch of NaN's in it) - 1164 (Restart trouble for CN13 on gust...) - 1165 (Restart trouble for scaled harvest test on gust) - 1166 (get_regional script needs to be updated) - 1192 (Y1K problem for mksurfdata.pl) - 1193 (bug in reading GLCMASK) - 1197 (MPI problem sending and receiving data in same array) - 1206 (Problem looping over a single year of forcing) - http://bugs.cgd.ucar.edu/ - -Type of tag: standard - -Describe any changes made to build system: Move glc_grid to build-namelist - remove esmf_libdir, fix ccsm_bld so will build threaded properly - -Describe any changes made to the namelist: Add albice to namelist - Add new history fields VOLR and VOLR_ICE - - VOLR RTM storage: LIQ (m3) - VOLR_ICE RTM storage: ICE (m3) - -List any changes to the defaults for the boundary datasets: - New datasets for 1x1_tropicAtl 1000 tests - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, VOLR changes come from Sean Swenson - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, pio - scripts to scripts4_100601 - drv to drvseq3_1_28 - pio to pio1_1_1 - -List all files eliminated: - ->>>>>>>>>>>>>>> Remove mksurdata pftdyn text files, let XML database create them - D models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr2000.txt - D models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr1850.txt - D models/lnd/clm/tools/mksurfdata/pftdyn_rcp6.0_simyr1850-2100.txt - D models/lnd/clm/tools/mksurfdata/pftdyn_rcp2.6_simyr1850-2100.txt - D models/lnd/clm/tools/mksurfdata/pftdyn_rcp4.5_simyr1850-2100.txt - D models/lnd/clm/tools/mksurfdata/pftdyn_rcp8.5_simyr1850-2100.txt - -List all files added and what they do: - ->>>>>>>>>>>>>>> Split out datm part of build-namelist into it's own script - A models/lnd/clm/bld/namelist_files/datm-build-namelist - - A models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr2000-2000.txt -- Same as - old file with 2000.txt name rather than 2000-2000.txt name. - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>>> Move glc_grid to build-namelist, remove kraken - M models/lnd/clm/test/system/config_files/_mec10sc_dh - M models/lnd/clm/test/system/config_files/_mec10sc_dm - M models/lnd/clm/test/system/config_files/_mec10sc_do - M models/lnd/clm/test/system/config_files/_mec10sc_ds - M models/lnd/clm/test/system/config_files/_mec10sc_h - M models/lnd/clm/test/system/config_files/_mec10sc_m - M models/lnd/clm/test/system/config_files/_mec10sc_o - M models/lnd/clm/test/system/test_driver.sh --------- Remove kraken, update dataroot - for bluefire, and tempworkspacefor intrepid - M models/lnd/clm/test/system/CLM_runcmnd.sh --------- Remove kraken - M models/lnd/clm/test/system/nl_files/clm_drydep ---- Change drydep to drv_drydep - ->>>>>>>>>>>>>>> Use XML database for pftdyn files, have mksrfdata.pl write out pftdyn files - M models/lnd/clm/tools/mksurfdata/mksurfdata.globalirrig - change pftdyn file name - M models/lnd/clm/tools/mksurfdata/mksurfdata.regional ---- change pftdyn file name - M models/lnd/clm/tools/mksurfdata/mksurfdata.pftdyn ------ start at 1850 - M models/lnd/clm/tools/mksurfdata/mksurfdata.singlept ---- change pftdyn file name - M models/lnd/clm/tools/mksurfdata/mksurfdata.namelist ---- change pftdyn file name - M models/lnd/clm/tools/mksurfdata/mksurfdata.pl ---------- Get mksrf_vegtyp filenames - from XML database for all files, and write out pftdyn files with them - also get working for 1000-1004 test cases (specifically for 1x12_tropicAtl - test case) - M models/lnd/clm/tools/mksurfdata/pftdyn_hist_simyr1850-2005.txt - Use CSMDATA versions - of 1850 and 2000 files - ->>>>>>>>>>>>>>> Move glc_grid to namelist, fix ccsm_bld=on, add datm_presaero ->>>>>>>>>>>>>>> Only do COLD start for startup type - M models/lnd/clm/bld/configure --------------- Remove glc_grid and esmf_libdir - add in control of CCSM_VOC, set compile_threaded for ccsm_bld on, - M models/lnd/clm/bld/queryDefaultNamelist.pl - Remove double reading of namelist_defaults_overall.xml - M models/lnd/clm/bld/queryDefaultXML.pm ------ Add csmdata to beginning of file, only - if it's a relative pathname (to handle instances of /cgd/tss for mksrf_vegtyp files) - M models/lnd/clm/bld/config_files/config_definition.xml - Remove glc_grid/esmf_libdir - M models/lnd/clm/bld/listDefaultNamelist.pl --- Move glc_grid to namelist vars - M models/lnd/clm/bld/build-namelist ----------- Add in glc_grid, and datm_presaero - change -drydep to -drv_drydep option, set glc_nthreads, outnc_large_files - and albice if glc_nec>0, move datm settings to own datm-build-namelist. - M models/lnd/clm/bld/clm.cpl7.template -------- Move glc_grid to build-namelist, - remove outnc_large_files setting (now in build-namelist), only do - COLD start for startup type (NOT for hybrid or branch). - ->>>>>>>>>>>>>>> Add albice/glc_grid/datm_presaero/outnc_large_files ->>>>>>>>>>>>>>> New datasets for 1x1_tropicAtl 1000 tests ->>>>>>>>>>>>>>> Add in all mksrf_fvegtyp files and include last-millenium - M models/lnd/clm/bld/namelist_files/namelist_definition.xml ------ Add in albice, - and glc_* settings for drv (glc_nthreads, glc_ntasks etc.), add presaero - datam_presaero, datm_file_aero, datm_year_first_aero, datm_year_last_aero, - datm_year_align_aero, and glc_grid. Add 0.5x0.5 resolution (for mksurfdata) - and some premillenial years (850,1100,1350,1600) and sim-year ranges - (850-1100,1100-1350,1350-1600,1600-1850) - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Set default - masks here, and add in glc_grid default - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml ---- Add in some - new domain files that are in datm template, and add in datm_presaero - settings needed: datm_file_aero, datm_aero_streams, datm_year_first_aero -  datm_year_last_aero, and datm_year_align_aero - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl --------- Show - datm_presaero setting if set. - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- Add - outnc_large_files, albice, and move mask to overall, update - 1x1_tropicAtl files for 1000, 1000-1004, add in all mksrf_fvegtyp - files for all scenarios and last-millenium. Add in diri and diro. - M models/lnd/clm/bld/namelist_files/namelist_defaults_drv.xml ----- Get URL - svn keyword set properly. - ->>>>>>>>>>>>>>> Put datm/drv settings on bottom (only for mode=ccsm_seq) ->>>>>>>>>>>>>>> set datm_presaero and data_cycle_beg/end years - M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml -- default - datm_presaero is clim_2000 - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - default - datm_presaero is rcp8.5, beg/end year 1972-2004 - M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - default - datm_presaero is rcp8.5, beg/end year 1972-2004 - M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml ------------ default - datm_presaero is trans_1850-2000, beg/end year 1948-1972, co2=386.9 - M models/lnd/clm/bld/namelist_files/use_cases/glacier_mec.xml ---------------- default - datm_presaero is clim_2000 - M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml --------------- default - datm_presaero is clim_1850, beg/end year 1948/1972 - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - default - datm_presaero is rcp2.6, beg/end year 1972-2004 - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml --- default - datm_presaero is rcp6.0, beg/end year 1972-2004 - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - default - datm_presaero is rcp4.5, beg/end year 1972-2004 - ->>>>>>>>>>>>>>> Add in albice to namelist, add VOLR and VOLR_ICE to history files ->>>>>>>>>>>>>>> always call interpMonthlyVeg for drydep - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - Remove interpMonthlyVeg - call as coming from a threaded region - M models/lnd/clm/src/main/clm_comp.F90 ------------- Call interpMonthlyVeg - for drydep even if CN is on - M models/lnd/clm/src/main/controlMod.F90 ----------- Add albice - M models/lnd/clm/src/main/clm_varcon.F90 ----------- Remove albice - M models/lnd/clm/src/main/clm_driver.F90 ----------- Always call interpMonthlyVeg - if drydep is on (even when NOT doalb) - M models/lnd/clm/src/main/histFldsMod.F90 ---------- Add VOLR and VOLR_ICE - (VOLR_ICE is an optional field) - M models/lnd/clm/src/riverroute/RtmMod.F90 --------- Handle volr under runoff - type, rather than as local variable - M models/lnd/clm/src/riverroute/RunoffMod.F90 ------ Add volr, volrlnd, volr_nt1/2 - M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 Add albice as public var - that can be set in controlMod on namelist - -Summary of testing: - - bluefire: All PASS except (up to test 061 nl_crcrop) -061 brL58 TBR.sh _sc_dh clm_std^nl_crcrop -004 blA91 TBL.sh _sc_dh clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v7 -6 arb_ic ...................FAIL! rc= 7 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 7 -011 blE91 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021230:NONE:1800 4x5 gx3v7 48 arb_ic ............FAIL! rc= 7 -020 blEH1 TBL.sh 4p_vodsrsc_dh clm_std^nl_urb 20021231:NONE:3600 1.9x2.5^0.9x1.25 gx1v6 48 arb_ic FAIL! rc= 7 -024 blHN1 TBL.sh 17p_cnsc_dh clm_transient_rcp8.5 20051220:NONE:1800 1.9x2.5 gx1v6@1850-2100 -10 colFAIL! rc= 7 -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -032 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -037 blH41 TBL.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 48 cold FAIL! rc= 7 -045 blC61 TBL.sh _scnv_dh clm_std^nl_urb 20020101:NONE:1800 1.9x2.5 gx1v6 48 startup ............FAIL! rc= 7 - bluefire interactive testing: All PASS up to... -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - bluefire/CCSM testing: All PASS except.. -FAIL ERI.f19_g16.IG.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_06 - - - bluefire/extra CCSM testing: -Make sure answers agree with /OLESON/csm/ccsm4_0_beta52_ndepaer other than VOC fields - (when snowhydrology changes are put in) - - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -017 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 10+38 cold ....FAIL! rc= 13 -018 brR53 TBR.sh 17p_cnc13sc_do clm_std^nl_urb_br 20020115:NONE:1800 10x15 USGS@1850 72+72 cold .FAIL! rc= 11 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG53 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -025 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coFAIL! rc= 13 -026 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coFAIL! rc= 11 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_06 - -Changes answers relative to baseline: no bit-for-bit (except omp active stand-alone tests) - The standalone tests with OpenMP on are different because the previous tag - wasn't building with OpenMP - -=============================================================== -=============================================================== -Tag name: clm4_0_06 -Originator(s): erik (erik) -Date: Wed May 26 10:35:26 MDT 2010 -One-line Summary: Update gglc to cism - -Purpose of changes: - -Changes from jwolfe to lnd_comp* subroutines to exchange cism fields. Requires an update -to the driver for the index of the fieldnames passed. Change paths of gglc glc_grid files -from gglc to cism. Make stream the default for all resolutions for ndepsrc. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1162 (OpenMP bug with dry-deposition code in clm) - 1163 (finidat file has a bunch of NaN's in it) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: critical - -Describe any changes made to build system: - Change name of ice model from gglc to cism - Change list of fields exchanged with cism - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - Change pathnames for gglc fglcmask datasets to cism - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, jwolfe, lipscomb - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, cism - scripts to scripts4_100525 - drv to drvseq3_1_26 - cism to cism1_100525b - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - Change default - of ndepsrc for f19 and f09 to stream - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ----- Change pathnames - for fglcmask files to pathame with cism instead of gglc - - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 ---------------- Pass a different - set of fields for sno (needed for update to cism) - - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 -------------- Pass a different - set of fields for sno (needed for update to cism) - -Summary of testing: - - bluefire/CCSM testing: -FAIL ERI.f19_g16.IG.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_06 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_05 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_05 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_05 - bluefire/CCSM extra testing: -PASS SMS.f19_g16.IG.bluefire -PASS ERS.f19_g16.IG.bluefire - -CLM tag used for the baseline comparison tests if applicable: clm4_0_05 - -Changes answers relative to baseline: Only when glc is active - Or for f19 and f09 with CN as now ndepsrc streams is the default for all resolutions - (previously ndepsrc data was the default for f19 and f09) - -=============================================================== -=============================================================== -Tag name: clm4_0_05 -Originator(s): erik (erik) -Date: Tue May 25 15:13:30 MDT 2010 -One-line Summary: Move Nitrogen deposition stream branch to trunk - -Purpose of changes: - -Move branch that treats ndepdyn files as streams to trunk. Change csm_share to have a -simpler normalization for coszen scaling (from dlawren/kauff in datm/csm_share). Fix -fragile code in clm_atmlnd, from Mariana. Update to datm8 that can set streams for -aerosols. Fix template so that CLM_BLDNML_OPTS is active. Update scripts and get in -other new finidat files, change clm test list, include _E test and IG f19 test. - -Bugs fixed (include bugzilla ID): - 1161 (New history fields added that should NOT be) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1162 (OpenMP bug with dry-deposition code in clm) - 1163 (finidat file has a bunch of NaN's in it) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Add -ndepsrc option to build-namelist - -List any changes to the defaults for the boundary datasets: - Add new datasets for Nitrogen deposition streams files (same as fndepdyn files) - Remove fndepdat/fndepdyn files for resolutions other than f09 and f19 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): scripts, drv, datm, csm_share - scripts to scripts4_100524b - drv to drvseq3_1_23 - datm to datm8_100420 - csm_share to share3_100423 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>>>> Handle Nitrogen deposition streams -A models/lnd/clm/src/main/ndepStreamMod.F90 - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>> Add some CN drydep tests for hybrid/open-MP -M models/lnd/clm/test/system/tests_pretag_jaguar -M models/lnd/clm/test/system/input_tests_master - ->>>>>>>>>>>> Add ability to handle ndep streams namelists ->>>>>>>>>>>> Add ability to set CLM_BLDNML_OPTS -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/clm.cpl7.template -M models/lnd/clm/bld/namelist_files/namelist_definition.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml ->>>>>>>>>>>> Set ndepstreams variables if ndepsrc=stream, otherwise set fndep files -M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - ->>>>>>>>>>>> Handle new ndep streams namelist and namelist variables ->>>>>>>>>>>> Remove misc.h and preproc.h #includes -M models/lnd/clm/src/main/clm_comp.F90 ---------- Renumber starting at 1 not 0 -M models/lnd/clm/src/main/clm_initializeMod.F90 - Handle initialization both - for ndep streams and old ndep handling -M models/lnd/clm/src/main/aerdepMod.F90 --------- Check if allocated before allocate -M models/lnd/clm/src/main/iniTimeConst.F90 ------ Move setting of ndep out of here -M models/lnd/clm/src/main/clm_atmlnd.F90 -------- Remove fragile code -M models/lnd/clm/src/main/controlMod.F90 -------- Handle use_ndepstream -M models/lnd/clm/src/main/clm_varctl.F90 -------- Add use_ndepstream -M models/lnd/clm/src/main/clm_driver.F90 -------- Add ndep_interp if use_ndepstream - and first and last years are different -M models/lnd/clm/src/main/ndepFileMod.F90 ------- Make fndepdat optional input so - can do this way (old way) or ndep streams (new way). -M models/lnd/clm/src/main/clm_glclnd.F90 -------- Change order of vars from Bill Lipscomb - -M models/lnd/clm/src/main/areaMod.F90 - Add interfaces for MCT datatypes - -M models/lnd/clm/src/main/clmtypeInitMod.F90 - Remove unfilled history vars -M models/lnd/clm/src/main/clmtype.F90 -------- Remove unfilled history vars -M models/lnd/clm/src/main/histFldsMod.F90 ---- Remove unfilled history vars, add QTOPSOIL - as an optional history variable. -M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - Handle fragile code mapping with MCT -M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 --- Handle fragile code mapping with MCT - -Summary of testing: - - bluefire: All PASS except... -029 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -030 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -031 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -032 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -033 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -037 blH41 TBL.sh 17p_cnsc_dh clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 48 cold FAIL! rc= 7 -049 blH52 TBL.sh 17p_cnsc_dm clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@2000 48 cold ..........FAIL! rc= 7 -055 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -056 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -057 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -058 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 - bluefire interactive testing: All PASS except... -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 -040 blK74 TBL.sh 17p_cndvsc_s clm_std 19971231:NONE:1800 1x1_brazil navy -670 arb_ic ............FAIL! rc= 7 -048 blHQ4 TBL.sh _nrcnsc_ds clm_drydep 20000214:NONE:1800 1x1_brazil navy@2000 -150 cold ........FAIL! rc= 7 - bluefire/CCSM testing: All PASS except... -FAIL SMS_RLA.f45_f45.I.bluefire.compare_hist.clm4_0_04 -FAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_04 -FAIL SMS_RLB.f45_f45.I.bluefire.compare_hist.clm4_0_04 -FAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_04 -FAIL SMS_ROA.f45_f45.I.bluefire.compare_hist.clm4_0_04 -FAIL SMS_ROA.f45_f45.I.bluefire.compare.clm4_0_04 -FAIL ERS_D.f45_g37.I.bluefire.compare_hist.clm4_0_04 -FAIL ERS_D.f45_g37.I.bluefire.compare.clm4_0_04 -FAIL PST.f45_g37.I1850.bluefire.compare.clm4_0_04 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm4_0_04 -BFAIL ERS_E.f19_g16.I1850.bluefire.compare.clm4_0_04 -FAIL ERI.f19_g16.IG.bluefire -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_04 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_05 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_04 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm4_0_04 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm4_0_04 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm4_0_04 -FAIL PST.f10_f10.I8520CN.bluefire.compare.clm4_0_04 -FAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm4_0_04 - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -017 erR53 TER.sh 17p_cnc13sc_do clm_std^nl_urb 20020115:NONE:1800 10x15 USGS@1850 10+38 cold ....FAIL! rc= 13 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_04 - -Changes answers relative to baseline: Yes! - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change: same climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - - source tag (all code used must be in the repository): - ndepaer01_clm3_7_15 + SnowHydrology changes - - platform/compilers: IBM - - compset (and additional configure options): I1850CN - - build-namelist options (or complete namelist): -ndepsrc stream - - MSS location of control simulations used to validate new climate: - - /OLESON/csm/ccsm4_0_beta52_ndepaer - /OLESON/csm/ccsm4_0_beta52_ndepaertrans - -=============================================================== -=============================================================== -Tag name: clm4_0_04 -Originator(s): erik (erik) -Date: Thu May 20 10:57:54 MDT 2010 -One-line Summary: New namelist items: ice_runoff, scaled_harvest, carbon_only, new - RTM hist vars, new finidat files, update esmf interface, turn off aerosol read quicker - -Purpose of changes: - -Redo all fndepdyn datasets for f19. Add namelist option to turn off ice-flow and send it -to liquid runoff: ice_runoff (by default .true.). Add new coefficients for harvest from -Johann, and add ability to trigger it on and off for backwards compatibility -(scaled_harvest, by default .false.). Change SUPLN from CPP token to carbon_only namelist -item. Add in new RTM variable to history files from Sean. Add in T31 1850/2000 CN/non-CN -and 2-deg 2000 CNDV finidat files. Turn off reading of aerosol/dust at initialization -rather than run time, so files aren't even opened if CAM is passing data to clm. Update -lnd_comp_esmf to same as mct interface. - -New history fields are incorrect. This is bug 1161. Since, time-lines are critical -and testing was completed, these changes will go in, but will be removed next week. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1161 (New history fields added that should NOT be) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: critical - -Describe any changes made to build system: Remove SUPLN #ifdef change to namelist option - -Describe any changes made to the namelist: Add namelist items - - ice_runoff = If true, river runoff will be split up into liquid and ice streams, - otherwise ice runoff will be zero and all runoff directed to liquid stream - scaled_harvest = If true, harvesting will be scaled according to coeffecients - determined by Johann Feddema, 2009 - carbon_only = If true, and CLMCN carbon-nitrogen model is on, Nitrogen will be - prescribed rather than prognosed - -List any changes to the defaults for the boundary datasets: - New fndepdyn files with correct time coordinate - New finidat files for T31 1850/2000 and f19 2000 for CNDV - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: - ->>>>>>>>>>>>>> Remove SUPLN build tests - D models/lnd/clm/test/system/config_files/17p_cnnsc_h - D models/lnd/clm/test/system/config_files/17p_cnnsc_m - D models/lnd/clm/test/system/config_files/17p_cnnsc_o - D models/lnd/clm/test/system/config_files/_cnnsc_h - D models/lnd/clm/test/system/config_files/_cnnsc_m - D models/lnd/clm/test/system/config_files/_cnnsc_o - D models/lnd/clm/test/system/config_files/17p_nrcnnsc_ds - D models/lnd/clm/test/system/config_files/17p_cnnsc_dh - D models/lnd/clm/test/system/config_files/17p_cnnsc_dm - D models/lnd/clm/test/system/config_files/17p_cnnsc_do - D models/lnd/clm/test/system/config_files/_cnnsc_dh - D models/lnd/clm/test/system/config_files/17p_cnnsc_ds - D models/lnd/clm/test/system/config_files/_cnnsc_dm - D models/lnd/clm/test/system/config_files/_cnnsc_do - D models/lnd/clm/test/system/config_files/_cnnsc_ds - ->>>>>>>>>>>>>> Remove namelist files no longer used - D models/lnd/clm/test/system/nl_files/scam - D models/lnd/clm/test/system/nl_files/ext_ccsm_seq_cam - D models/lnd/clm/test/system/nl_files/nl_glcsmb - D models/lnd/clm/test/system/nl_files/scam_prep - -List all files added and what they do: - ->>>>>>>>>>>>>> Add ice_runoff=.false., scaled_harvest=.true., and carbon_only tests - A models/lnd/clm/test/system/nl_files/nl_noicertm_sclharv - A models/lnd/clm/test/system/nl_files/nl_cn_conly - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>>>>> Switch SUPLN tests for carbon_only ->>>>>>>>>>>>>> Add ice_runoff=.false., scaled_harvest=.true tests - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/config_files/README - M models/lnd/clm/test/system/tests_pretag_edinburgh - M models/lnd/clm/test/system/tests_pretag_jaguar - M models/lnd/clm/test/system/tests_posttag_breeze - M models/lnd/clm/test/system/README.testnames - M models/lnd/clm/test/system/tests_pretag_jaguar_nompi - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/input_tests_master - M models/lnd/clm/test/system/tests_posttag_nompi_regression - ->>>>>>>>>>>>>> Remove setting of supln to off - M models/lnd/clm/test/system/config_files/17p_cnsc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dh - M models/lnd/clm/test/system/config_files/17p_cnsc_do - M models/lnd/clm/test/system/config_files/17p_cnc13sc_dm - M models/lnd/clm/test/system/config_files/17p_cnc13sc_do - ->>>>>>>>>>>>>> Remove SUPLN from configure - M models/lnd/clm/bld/configure - M models/lnd/clm/bld/config_files/config_definition.xml - ->>>>>>>>>>>>>> Add carbon_only, scaled_harvest and ice_runoff options ->>>>>>>>>>>>>> T31 1850/2000 finidat files, f19 CNDV 2000 finidat file ->>>>>>>>>>>>>> Add error checking, change fndepdyn files for ones with ->>>>>>>>>>>>>> corrected time axis. - M models/lnd/clm/bld/build-namelist - M models/lnd/clm/bld/namelist_files/namelist_definition.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - ->>>>>>>>>>>>>> Remove SUPLN #ifdef for carbon_only namelist - M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 - Correct comment - M models/lnd/clm/src/biogeochem/CNAllocationMod.F90 ---- Switch SUPLN for carbon_only - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 ----- Remove ltype as duplicated - ->>>>>>>>>>>>>> Add carbon_only, scaled_harvest, and ice_runoff options ->>>>>>>>>>>>>> Add new RTM history variables - M models/lnd/clm/src/main/clmtypeInitMod.F90 ----------- Add res_sno, topo_ndx, - topo_slope, var_track, var_track2, frost_table, zwt_perched, - qflx_top_soil, qflx_snow_out, qflx_drain_perched - M models/lnd/clm/src/main/pftdynMod.F90 ---------------- Add CN ifdef's for harvest - add if for scaled_harvest or not - M models/lnd/clm/src/main/iniTimeConst.F90 ------------- Add CN ifdef's for ndep - M models/lnd/clm/src/main/histFileMod.F90 -------------- Add RTM ifdef's for frivinp_rtm - M models/lnd/clm/src/main/controlMod.F90 --------------- Put options in appropriate - RTM and CN #ifdef blocks. Add ice_runoff, scaled_harvest and carbon_only to namelist - M models/lnd/clm/src/main/clm_varctl.F90 --------------- Add CN/RTM #ifdefs, add - scaled_harvest and ice_runoff - M models/lnd/clm/src/main/clm_driver.F90 --------------- Add CN #ifdef for ndepdyn - M models/lnd/clm/src/main/ndepFileMod.F90 -------------- Add CN #ifdef - M models/lnd/clm/src/main/clmtype.F90 ------------------ Add res_sno, topo_ndx, - topo_slope, var_track, var_track2, frost_table, zwt_perched, - qflx_top_soil, qflx_snow_out, qflx_drain_perched - M models/lnd/clm/src/main/histFldsMod.F90 -------------- Add - FROST_TABLE, ZWT_PERCH, QDRAI_PERCH, QTOPSOIL - - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 ----- Move lnd_chkAerDep_mct to init - add ice_runoff option to output rtm streams - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 --- Move lnd_chkAerDep_mct to - add ice_runoff option to output rtm streams. And sync up with lnd_comp_mct -init - - -Summary of testing: - - bluefire interactive extra checking: -001 smH43 TSM.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 96 cold PASS -002 erH43 TER.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 10+38 coPASS -003 brH43 TBR.sh 17p_cnsc_do clm_std^nl_noicertm_sclharv 20021230:NONE:1800 10x15 USGS@2000 72+72 coPASS -005 smH93 TSM.sh 17p_cnsc_do clm_ndepdyn^nl_cn_conly 20020101:NONE:1800 4x5 gx3v7@1850-2000 96 cold PASS -006 erH93 TER.sh 17p_cnsc_do clm_ndepdyn^nl_cn_conly 20020101:NONE:1800 4x5 gx3v7@1850-2000 10+38 coPASS -007 brH93 TBR.sh 17p_cnsc_do clm_ndepdyn^nl_cn_conly 20020101:NONE:1800 4x5 gx3v7@1850-2000 72+72 coPASS - bluefire/CCSM testing: All PASS except... -FAIL ERI.T31_g37.IG.bluefire -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_04 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_03 - jaguar/CCSM testing: All FAIL -FAIL ERS_D.f09_g16.I1850.jaguar -FAIL PST.f10_f10.I8520CN.jaguar -FAIL PET_PT.f10_f10.I8520CN.jaguar - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm4_0_03 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_03 -Originator(s): erik (erik) -Date: Mon May 17 14:06:50 MDT 2010 -One-line Summary: Changes from Francis for VOC and drydep - -Purpose of changes: - -Changes from Francis Vitt and Jean-Francois Lamarque for VOC and drydep. Add a scaling -factor for VOC isoprene. Get annual LAI and differences from CLMSP even when CLMCN is -on when sending drydep to atm, as need LAI monthly differences to estimate season index. -Get these changes to work with CN on and off and also get it to work with DEBUG mode -on. Use clm veg indicies in pftvarcon and abort drydep if don't find a wesley veg type -index. Fix ndeplintInterp.ncl script for rcp=-999.9 historical (bug 1153). Add in quarter -degree gx1v6 fraction dataset. - -Bugs fixed (include bugzilla ID): - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1158 (I_1850-2000_CN (I4804CN) inconsistent with I_1850-2000 (I4804) compset) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: qtr-degree, gx1v6 frac/domain datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, dlawren, fvitt - -List any svn externals directories updated (csm_share, mct, etc.): scripts - - scripts to scripts4_100513 - -List all files eliminated: None - -List all files added and what they do: - - A models/lnd/clm/test/system/config_files/_nrcnsc_ds --- cn test without rtm or supln - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>>> Add in qtr-degree fraction and domain file datasets ->>>>>>>>>>> Make gx1v6 default mask for qtr-degree - M models/lnd/clm/bld/namelist_files/namelist_defaults_datm.xml - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - ->>>>>>>>>>> Separate out CN+SUPLN tests as H and CN only as P - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/README.testnames - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/nl_files/clm_drydep ---- correct build-nml options - M models/lnd/clm/test/system/input_tests_master ----- Remove 360x720 tests, add - drydep tests with CN and without, have start dates for drydep - tests span the year - ->>>>>>>>>>> A few small fixes to tools - M models/lnd/clm/tools/mksurfdata/mkvocef.F90 --------- Remove diagnostics as nonsensical - (also was incorrect, see bug 1157) - M models/lnd/clm/tools/ncl_scripts/ndeplintInterp.ncl - Fix so can work with historical case - ->>>>>>>>>>> Allow some CLMSP subroutines to be called even with CLMCN so that LAI can help set ->>>>>>>>>>> the season index when dry-deposition is active (and only when dry-dep is active) - M models/lnd/clm/src/biogeochem/STATICEcosysDynMod.F90 - Change #ifdefs so that - some can be called from drydep even when CN is on. Don't allow - EcosystemDyn to be called if CN on though. - M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 ----- Add a scaling factor - for isoprene - M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 ----- Make winter season on - anytime you have snow. Use pftvarcon indices to set wesveg type from - clmveg type. Add landuse type and set to desert winter if not veg type. - (so won't abort on DEBUG mode) - M models/lnd/clm/src/main/clm_initializeMod.F90 -------- Also call - EcosystemDynini and readAnnualVegetation even if CN is on when drydep is on. - -Summary of testing: - - bluefire: Ran 100 days of 1850CN, compared to Francis's mods and the two results were identical - bluefire interactive testing: -001 smCO3 TSM.sh _sc_do clm_drydep^nl_urb 20021001:NONE:3600 10x15 USGS -10 cold ................PASS -002 erCO3 TER.sh _sc_do clm_drydep^nl_urb 20021001:NONE:3600 10x15 USGS -3+-7 cold ..............PASS -003 brCO3 TBR.sh _sc_do clm_drydep^nl_urb_br 20021001:NONE:3600 10x15 USGS -5+-5 cold ...........PASS -004 blCO3 TBL.sh _sc_do clm_drydep^nl_urb 20021001:NONE:3600 10x15 USGS -30 cold ................PASS -005 smCP3 TSM.sh _sc_do clm_drydep^nl_urb 20020317:NONE:1800 1.9x2.5 gx1v6 -15 startup ..........PASS -006 erCP3 TER.sh _sc_do clm_drydep^nl_urb 20020317:NONE:1800 1.9x2.5 gx1v6 -3+-7 startup ........PASS -007 brCP3 TBR.sh _sc_do clm_drydep^nl_urb_br 20020317:NONE:1800 1.9x2.5 gx1v6 -5+-5 startup .....PASS -008 blCP3 TBL.sh _sc_do clm_drydep^nl_urb 20020317:NONE:1800 1.9x2.5 gx1v6 -15 startup ..........PASS -001 sm654 TSMtools.sh mkgriddata tools__ds namelist .............................................PASS -002 sm674 TSMtools.sh mkgriddata tools__ds singlept .............................................PASS -003 sm774 TSMtools.sh mksurfdata tools__ds singlept .............................................PASS -004 bl774 TBLtools.sh mksurfdata tools__ds singlept .............................................SKIPPED* -005 sm853 TSMtools.sh interpinic tools__o runoptions ............................................PASS - bluefire/CCSM testing: All PASS except... -BFAIL SMS_RLA.f45_f45.I.bluefire.compare.clm4_0_0+upext -BFAIL SMS_RLB.f45_f45.I.bluefire.compare.clm4_0_0+upext -BFAIL SMS_ROA.f45_f45.I.bluefire.compare.clm4_0_0+upext -FAIL ERI.T31_g37.IG.bluefire -BFAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm4_0_0+upext -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_03 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm4_0_0+upext - -CLM tag used for the baseline comparison tests if applicable: clm4_0_02 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_02 -Originator(s): erik (erik) -Date: Thu May 13 00:47:40 MDT 2010 -One-line Summary: Make sure dtime is initialized, so that answers are consistently the same as clm4_0_00 - -Purpose of changes: - -Make sure dtime is initialized before it is used in lnd_run_mct/lnd_run_esmf so -that results are consistent. This bug has been around since clm3_6_36 where doalb -logic was changed. However, until clm4_0_01 results seemed to have been consistent, -but with clm4_0_01 results were inconsistent, and usually incorrect for nstep=1 (in -calculating calday1 and hence doalb). - -Bugs fixed (include bugzilla ID): - 1156 (Reproducability problem with clm4_0_01) - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: critical - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>> Add a reproducability test - A models/lnd/clm/test/system/TRP.sh - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>> Add reproducability test - M models/lnd/clm/test/system/input_tests_master - ->>>>>>>>> Set glcmec by GLC_NEC_ $ifdefs - M models/lnd/clm/src/main/clm_varpar.F90 - ->>>>>>>>> Make sno fields NOT optional, and set dtime before use in _run - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 - -Summary of testing: - - bluefire interactive testing: -001 blC45 TBL.sh 17p_sc_m clm_pftdyn 18501230:NONE:3600 10x15 USGS@1850-2000 -10 arb_ic .........PASS - bluefire/CCSM testing: -PASS PST.f45_g37.I1850.bluefire.compare.clm4_0_0+upext -PASS PET_PT.f45_g37.I1850.bluefire.compare.clm4_0_0+upext -PASS ERS.f19_g16.I1850.bluefire.compare_hist.clm4_0_0+upext -PASS ERS.f19_g16.I1850.bluefire.compare.clm4_0_0+upext -PASS PST.f10_f10.I8520CN.bluefire.compare.clm4_0_0+upext -PASS PET_PT.f10_f10.I8520CN.bluefire.compare.clm4_0_0+upext - -CLM tag used for the baseline comparison tests if applicable: clm4_0_00 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_01 -Originator(s): erik (erik) -Date: Tue May 11 14:39:25 MDT 2010 -One-line Summary: Move glacier multiple elevation class branch to the trunk so that we can work with the active glacier model - -Purpose of changes: - -Add ability to handle glacier multiple elevation classes (glc_mec) in clm, so that we -can interact with the active glacier component (glc). Adds glacier elevation classes -to the surface datasets and requires they be read in when glacier multiple elevation -classes are active. New namelist options for glc_mec include glc_smb and glc_dyntopo. -At build-time the number of glc_mec classes is set (can be 0, 1, 3, 5, or 10). The -model also interacts with the mask of valid glacier points that the active glacier -model determined (input with the fglcmask file), and set by glc_grid (which can be -gland5,gland10, or gland20 for 5-20km resolution over Greenland). glc_grid is set at -build time, but should be moved to the build-namelist. - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1156 (Reproducability problem with clm4_0_01) - 1157 (Problem with VOC interpolation in mksurfdata) - 1197 (MPI problem sending and receiving data in same array) - http://bugs.cgd.ucar.edu/ - -Type of tag: standard - -Describe any changes made to build system: Add glc_nec and glc_grid options to configure - glc_nec can be 1,3,5, or 10 and MUST match the number on the input surface dataset - the elevation classes themselves are read from the surface dataset - glc_grid can be gland5, gland10, gland20 for greenland 5, 10, or 20km resolution - it is merely passed on to build-namelist to pick the glcmask file - -Describe any changes made to the namelist: - -- create_glacier_mec_landunit (= T when these landunits are created; F by default) -- glc_smb (= T if passing surface mass balance to GLC; else pass PDD info; T by default) -- glc_dyntopo (= T if CLM topography changes dynamically; currently F) - (NOT fully implemented yet) - - New history fields: - QICE ice growth/melt (mm/s) - QICEYR ice growth/melt (mm/s) - gris_mask Greenland mask (unitless) - gris_area Greenland ice area (km^2) - aais_mask Antarctic mask (unitless) - aais_area Antarctic ice area (km^2) - -Changes to build-namelist: - - finidat file and possibly the fsurdat files include glc_nec values - Currently only support glc_nec=0 or glc_nec=10 - -List any changes to the defaults for the boundary datasets: Update datm domain file for T31 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, jwolfe, lipscomb, dlawren - -List any svn externals directories updated (csm_share, mct, etc.): scripts, csm_share - Also add in active glacier model - scripts to scripts4_100510a - csm_share to share3_100423 - gglc to glc4_100507 - -List all files eliminated: None - -List all files added and what they do: - ->>>>>>>>>> Add mec tests - A models/lnd/clm/test/system/config_files/_mec10sc_dh - A models/lnd/clm/test/system/config_files/_mec10sc_dm - A models/lnd/clm/test/system/config_files/_mec10sc_do - A models/lnd/clm/test/system/config_files/_mec10sc_ds - A models/lnd/clm/test/system/config_files/_mec10sc_h - A models/lnd/clm/test/system/config_files/_mec10sc_m - A models/lnd/clm/test/system/config_files/_mec10sc_o - A models/lnd/clm/test/system/nl_files/clm_glcmec - A models/lnd/clm/test/system/nl_files/nl_glcsmb - ->>>>>>>>>> Handle passing of data from clm to the active glacier model - A models/lnd/clm/src/main/clm_glclnd.F90 -- handle passing data to glc model - -List all existing files that have been modified, and describe the changes: - ->>>>>>>>>> Add mec tests - M models/lnd/clm/test/system/tests_pretag_jaguar - M models/lnd/clm/test/system/input_tests_master - M models/lnd/clm/test/system/tests_posttag_purempi_regression - M models/lnd/clm/test/system/tests_posttag_hybrid_regression - M models/lnd/clm/test/system/tests_pretag_bluefire - M models/lnd/clm/test/system/tests_pretag_bluefire_nompi - M models/lnd/clm/test/system/config_files/README - M models/lnd/clm/test/system/README.testnames - ->>>>>>>>>>>> Add GLC_MEC to mksurfdata, add ability to set glc_nec on namelist - M models/lnd/clm/tools/mksurfdata/mkglcmec.F90 - M models/lnd/clm/tools/mksurfdata/mkvarctl.F90 - M models/lnd/clm/tools/mksurfdata/mkfileMod.F90 - M models/lnd/clm/tools/mksurfdata/Makefile ------ Add gfortran remove xlf90 for Darwin - M models/lnd/clm/tools/mksurfdata/mkvarpar.F90 - M models/lnd/clm/tools/mksurfdata/README - M models/lnd/clm/tools/mksurfdata/mksrfdat.F90 - ->>>>>>>>>>>> Add some more checking for glc settings - M models/lnd/clm/bld/listDefaultNamelist.pl - Try to make faster, add loop over - glc_nec and glc_grid - M models/lnd/clm/bld/build-namelist --------- Get default glc_smb when - create_glacier_mec_landunits is on - M models/lnd/clm/bld/clm.cpl7.template ------ Add glc_ settings - M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm.xml - Add glc_nec to - finidat files, add glc_nec="10" fsurdat files for T31, 1-deg, 2-deg - M models/lnd/clm/bld/configure - M models/lnd/clm/bld/config_files/Makefile.in - Add gfortran to Darwin and remove -xlf90 - M models/lnd/clm/bld/config_files/config_definition.xsl - Add glacier types - M models/lnd/clm/bld/config_files/config_definition.xml - ->>>>>>>>>>>> Read in glacier elevation classes from surfdata file as GLC_MEC ->>>>>>>>>>>> require it when create_glacier_mec_landunits is .true. and use it ->>>>>>>>>>>> to set value of glc_topomax. Add checking for glc options. ->>>>>>>>>>>> Also remove concurrent directives - M models/lnd/clm/src/main/clm_varcon.F90 -------- Add h2osno_max, lapse_glcmec - and istice_mec, change albice when GLC_NEC>0 - M models/lnd/clm/src/main/clm_varpar.F90 -------- Add npatch_glacier_mec - M models/lnd/clm/src/main/dynlandMod.F90 -------- Add checking for istice_mec - M models/lnd/clm/src/main/decompInitMod.F90 ----- Pass glcmask in - M models/lnd/clm/src/main/clm_initializeMod.F90 - Handle create_glacier_mec_landunit - M models/lnd/clm/src/main/ncdio.F90 ------------- Add 2D module procedures to ncd_iolocal interface - M models/lnd/clm/src/main/subgridMod.F90 -------- Handle create_glacier_mec_landunit if true - M models/lnd/clm/src/main/clmtypeInitMod.F90 ---- Add glcmecpoi and greenland and antarctic mask/area - add forc_pbot, forc_rho, glc_topo, forc_t, forc_th to ces, forc_q to cws, eflx_bot to cef - add qflx_glcice, glc_rofi, glc_rofl - M models/lnd/clm/src/main/pftdynMod.F90 --------- Change comments - M models/lnd/clm/src/main/iniTimeConst.F90 ------ Handle istice_mec - M models/lnd/clm/src/main/clm_atmlnd.F90 -------- Fix comment - M models/lnd/clm/src/main/clm_varsur.F90 -------- Add topoxy - M models/lnd/clm/src/main/controlMod.F90 -------- Add create_glacier_mec_landunit, glc_dyntopo, glc_smb, fglcmask to namelist - M models/lnd/clm/src/main/cpl_mct/lnd_comp_mct.F90 - Add sno_export/import - M models/lnd/clm/src/main/cpl_esmf/lnd_comp_esmf.F90 Add sno_export/import - M models/lnd/clm/src/main/filterMod.F90 --------- Add istice_mec - M models/lnd/clm/src/main/clm_varctl.F90 -------- Add fglcmask, create_glacier_mec_landunit, - glc_dyntopo, glc_smb, glc_nec, and glc_topomax add some error checking for them - M models/lnd/clm/src/main/initGridCellsMod.F90 -- Make ice sheet masks and deal with glcmask - M models/lnd/clm/src/main/surfrdMod.F90 --------- Read GLCMASK, GLC_MEC, PCT_GLC_MEC and TOPO_GLC_MEC when create_glacier_mec_landunit - M models/lnd/clm/src/main/domainMod.F90 --------- Add glcmask - M models/lnd/clm/src/main/clmtype.F90 ----------- Add forc_pbot, forc_rho, glc_frac, glc_topo add - forc_t, forc_q, eflx_bot, qflx_glcice, glc_rofi, glc_rofl, glcmecpoi, gris and assis mask/area - M models/lnd/clm/src/main/histFldsMod.F90 ------- Add new fields when create_glacier_mec_landunit - M models/lnd/clm/src/main/histFileMod.F90 ------- Add glacier_mec to notes, set_noglcmec to hist_addfld1d - M models/lnd/clm/src/main/mkarbinitMod.F90 ------ Set mask sno to h2osno_max, use istice_mec - M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ----- Assess if istice_mec and add qflx_glcice for glc_dyntopo -P - M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 - Assess if istice_mec - M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 -- Assess if istice_mec and add eflx_bot - M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 ---- Assess if istice_mec - M models/lnd/clm/src/biogeophys/Biogeophysics1Mod.F90 --- Move forc_pbot/forc_q/forc_t/forc_th from g to c, assess istice_mec - M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 ---- Assess if isice_mec - M models/lnd/clm/src/biogeophys/Hydrology1Mod.F90 ------- Assess if isice_mec move force_t from g to c - M models/lnd/clm/src/biogeophys/Hydrology2Mod.F90 ------- Assess if istice_mec and add qflx_glcice - M models/lnd/clm/src/biogeophys/clm_driverInitMod.F90 --- Downscale forc_t, forc_th, forc_q, forc_pbot from gridcell to columns - based on surface eleveation for glc_mec landunits - M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 - Change forcing from g to c - -Summary of testing: - - bluefire interactive testing: All PASS up to.. -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 - bluefire/CCSM testing: -FAIL PST.f45_g37.I1850.bluefire.compare.clm3_7_15 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm3_7_15 -FAIL ERS.f19_g16.I1850.bluefire.compare_hist.clm3_7_15 -FAIL ERS.f19_g16.I1850.bluefire.compare.clm3_7_15 -FAIL ERI.T31_g37.IG.bluefire -FAIL ERB.f09_g16.I_1948-2004.bluefire.compare.clm3_7_15 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm4_0_01 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_15 -FAIL PST.f10_f10.I8520CN.bluefire.compare.clm3_7_15 -FAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm3_7_15 - -PASS SMS_D.f19_g16.IG.bluefire -PASS ERS.f19_g16.IG.bluefire -FAIL SMS.T31_g37.IG.bluefire -FAIL SMS.f09_g16.IG.bluefire - - breeze,gale,hail,gust/ifort interactive testing: All PASS up to... -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 - -CLM tag used for the baseline comparison tests if applicable: clm3_7_15 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_0_00 -Originator(s): erik (erik) -Date: Tue May 4 23:02:18 MDT 2010 -One-line Summary: Update to datm8, redirect aquifer overflow to drainage, add - gx3v7 masks, script to extract regional datasets, add harvesting for CN, - modify shrubs, include urban model, ice stream for snowcapping, new - build-namelist system, scale solar by solar zenith angle in datm, deep - soil with bedrock at bottom, organic matter in soils, SNICAR for snow - radiation, sparce dense aero, snow cover changes - -Type of tag: doc - -Software engineering changes: - - Update to cpl7 and scripts. - Remove offline and cpl6 modes. - Remove support for CASA model. - Update to datm8 atmospheric data model. - Add gx3v7 land mask for T31 and fv-4x5 horizontal resolutions. - Add gx1v6 land mask for f05, f09, and f19 horizontal resolutions. - Add tx1v1 land mask and 1.9x2.5_tx1v1 horizontal resolution. - Add in 2.5x3.33 horizontal resolution. - Add in T62 horizontal resolution so can run at same resolution as input datm data. - Allow first history tape to be 1D. - Add ability to use own version of input datasets with CLM_USRDAT_NAME variable. - Add a script to extract out regional datasets. - New build-namelist system with XML file describing all namelist items. - Add glacier_mec use-case and stub glacier model. - Add ncl script to time-interpolate between 1850 and 2000 for fndepdat dataset, for fndepdyn version. - Make default of maxpatch_pft=numpft+1 instead of 4. - Only output static 3D fields on first h0 history file to save space. - Add new fields for VOC (Volatile Organic Compounds) on some surface datasets - Add irrigation area to mksurfdata tool (NOT used in CLM yet). - Add multiple elevation class option for glaciers in mksurfdata tool (NOT used in CLM yet). - Add ascale field to land model in support of model running on it's own grid. - -Science changes: - - Change to freezing temperature constant - Forcing height at atm plus z0+d on each tile - Effective porosity divide by zero fix - Sparse/dense canopy aerodynamic parameters - Ground/snow emissivity smooth transition - Thermal and hydraulic properties of organic soil - Init h2osoi=0.3 - Snow compaction fix - Snow T profile during layer splitting fix - Snow burial fraction - Snow cover fraction - SNICAR (snow aging, black carbon and dust deposition, vertical distribution of solar energy) - Remove SNOWAGE, no longer used - Deep soil (15 layers, ~50m), 5 new layers are hydrologically inactive bed rock - Ground evap (beta), stability, and litter resistance - Organic/mineral soil hydraulic conductivity percolation theory - Richards equation modifications - Normalization of frozen fraction of soil formulation - One-step solution for soil moisture and qcharge - Changes to rsub_max for drainage and decay factor for surface runoff - Fixed diurnal cycle of solar radiation in offline forcing data - Back to CLM3 lakes and wetlands datasets, but 1% rather than 5% threshold (same for glacier) - Changes to pft physiology file from CN - New grass optical properties - New surface dataset assuming no herbaceous understory - Direct versus diffuse radiation offline - New VOC model (MEGAN) - Snow-capped runoff goes to new ice stream and routed to ocean as ice - Dust model always on, LAI threshold parameter change from 0.1 to 0.3 - Daylength control on vcmax - SAI and get_rad_dtime fix - Always run with MAXPATCH_PFT=npfts + 1 instead of 4 - Transient land cover/use mode - datasets, energy and water balance - RTM sub-cycling - Twostream bug fix - Update soil colors - 2m relative humidity - Fix for aquifer leak (SoilHydrologyMod, BalanceCheckMod) - New nitrogen deposition file (units and sum of NOx, NHy) - -Quickstart to new cpl7 scripts... - - cd scripts - ./create_newcase -help # get help on how to run create_newcase - ./create_newcase -case testI -mach bluefire -res f19_g16 -compset I # create new "I" case for bluefire at 1.9x2.5_gx1v6 res - # "I" case is clm active, datm7, and inactive ice/ocn - cd testI - ./xmlchange -help # Get help on editor for XML files - ./xmlchange env_conf.xml env_mach_pes # Edit configure files if needed - configure -case # create scripts - ./xmlchange env_build.xml # Edit build files if needed - testI.build # build model and create namelists - ./xmlchange env_run.xml # Edit run files if needed - bsub < testI.run # submit script - # (NOTE: edit env_run.xml to set RESUBMIT to number of times to automatically resubmit) -Quickstart to use of regional extraction scripts and PERSONAL datasets: - - # Run the script to create an area to put your files (assume CSMDATA set to standard inputdata) - cd scripts - setenv MYCSMDATA $HOME/myinputdata - link_dirtree $CSMDATA $MYCSMDATA - - # Run the extraction for data from 52-73 North latitude, 190-220 longitude - # that creates 13x12 gridcell region from the f19 (1.9x2.5) global resolution over - # Alaska - cd ../models/lnd/clm/tools/ncl_scripts - setenv MYID 13x12pt_f19_alaskaUSA - getregional_datasets.pl -sw 52,190 -ne 73,220 -id $MYID -mycsmdata $MYCSMDATA - - # Now create a case that uses these datasets - cd ../../../../../scripts - create_newcase -case testregional -compset I -mach bluefire -res pt1_pt1 - cd testregional - $EDITOR env_conf.xml # change CLM_BLDNML_OPTS to include "-clm_usr_name $MYID" (expand $MYID) - $EDITOR env_mach_pes.xml # Change tasks/threads as appropriate (defaults to serial) - xmlchange -file env_run.xml -id DIN_LOC_ROOT_CSMDATA -val $MYCSMDATA - - # Do other changes to xml files as appropriate - # configure as normal, then edit the datm namelist - - configure -case - - # Then build and run the case as normal - -Known bugs (include bugzilla ID): - 701 (svn keyword) - 717 (archiving bug -- only archive 1000 files at a time) - 722 (threading slow) - 789 (1pt sims 2.5X slow) - 794 (hist avg strange) - 883 (aerosol deposition not from atm) - 896 (T62 mode does not work) - 920 (glacier_mec problems in mksurfdata) - 935 (RTM warning NOT an error) - 990 (CN transient blowup) - 994 (finidat files on jaguar for pftdyn fail) - 1017 (SCM mode can NOT restart) - 1025 (SCM mode can NOT use a global finidat file) - 1063 (Problem in restarts for CCSM spinup data) - 1092 (Problems running in debug mode on dublin with datm8) - 1124 (Reported energy for pftdyn grid-cell not right) - 1139 (LAND and PFTS 1D vector averaging doesn't work) - 1147 (mkgriddata can't straddle over Greenwich) - 1153 (Problem with ndeplintInterp for historical case) - 1157 (Problem with VOC interpolation in mksurfdata) - 1197 (MPI problem sending and receiving data in same array) -Describe any changes made to build system: - - Change directory structure to match CCSM. - Add BGP target. - Add choice between ESMF and MCT frameworks. - Start removing #ifdef and directives that supported Cray-X1 Phoenix as now decommissioned. - Make default of maxpatch_pft=numpft+1 instead of 4 for all configurations. - By default turn on CLAMP when either CN or CASA is enabled - New SNICAR_FRC, CARBON_AERO, and C13 CPP ifdef tokens. - - New options added to configure: - - -comp_intf Component interface to use (ESMF or MCT) (default MCT) - -nofire Turn off wildfires for bgc setting of CN (default includes fire for CN) - -pio Switch enables building with Parallel I/O library. [on | off] (default is on) - -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] (default is off) - -Describe any changes made to the namelist: - - NOTE: build-namelist now checks the validity of your namelist you generate by looking at data in the namelist_definition.xml - file. In order to add new namelist items you need to change the code and also edit this file. To view information - on the namelist view the file: - models/lnd/clm/bld/namelist_files/namelist_definition.xml - in your browser and you'll see the names, type, description and valid_values for all namelist variables. - - Changes to build-namelist: - Transient sim_year ranges (i.e. 1850-2000) - Remove cam_hist_case option. - Make sure options ONLY used for stand-alone testing have a "drv_" or "datm_" prefix in them and list these - options all together and last when asking for help from build-namelist. - New options to build-namelist: - -clm_usr_name "name" Dataset resolution/descriptor for personal datasets. Default: not used - Example: 1x1pt_boulderCO_c090722 to describe location, - number of pts, and date files created - New list options to build-namelist: - build-namelist -res list # List valid resolutions - build-namelist -mask list # List valid land-masks - build-namelist -sim_year list # List valid simulation years and simulation year ranges - build-namelist -clm_demand list # List namelist variables including those you could demand to be included. - build-namelist -use_case list # List valid use-cases - build-namelist -rcp list # List valid representative concentration pathways - # for future scenarios - - List of use-cases for build-namelist: - -1850-2100_rcp4.5_transient = Simulate transient land-use, and aerosol deposition changes -with historical data from 1850 to 2005 and then with the RCP4.5 scenario from MINICAM - -1850-2100_rcp8.5_transient = Simulate transient land-use, and aerosol deposition changes -with historical data from 1850 to 2005 and then with the RCP8.5 scenario from MESSAGE - - 1850_control = Conditions to simulate 1850 land-use -2000-2100_rcp8.5_transient = Simulate transient land-use, and aerosol deposition changes -with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE - - 2000_control = Conditions to simulate 2000 land-use -20thC_transient = Simulate transient land-use, and aerosol deposition changes from 1850 -to 2005 - pergro = Perturbation error growth test with initial conditions perturbed by -roundoff level - pergro0 = Perturbation error growth test with unperturbed initial conditions - - - New namelist items: - - urban_hac = OFF, ON or ON_WASTEHEAT (default OFF) Flag for urban Heating and Air-Conditioning - OFF = Building internal temperature is un-regulated. - ON = Building internal temperature is bounded to reasonable range. - ON_WASTEHEAT = Building internal temperature is bounded and resultant waste - heat is given off. - urban_traffic = .true. or .false. (default .false.) Flag to include additional multiplicative factor of urban traffic - to sensible heat flux. - fsnowoptions = filename file for snow/aerosol optical properties (required) - fsnowaging = filename file for snow aging parameters (required) - faerdep = filename file of aerosol deposition (required) - - New history variables: (note watt vs. W in units, 26 vs. 76) - BCDEP total BC deposition (dry+wet) from atmosphere kg/m^2/s - BIOGENCO biogenic CO flux uGC/M2/H - C13_PRODUCT_CLOSS C13 total carbon loss from wood product pools gC13/m^2/s - DSTDEP total dust deposition (dry+wet) from atmosphere kg/m^2/s - EFLX_DYNBAL dynamic land cover change conversion energy flux W/m^2 - FGR12 heat flux between soil layers 1 and 2 watt/m^2 - FSAT fractional area with water table at surface unitless - FSH_NODYNLNDUSE sensible heat flux not including correction for land use change - watt/m^2 - GC_HEAT1 initial gridcell total heat content J/m^2 - GC_HEAT2 post land cover change total heat content J/m^2 inactive - GC_ICE1 initial gridcell total ice content mm/s - GC_ICE2 post land cover change total ice content mm/s inactive - GC_LIQ1 initial gridcell total liq content mm - GC_LIQ2 initial gridcell total liq content mm inactive <<<< name?? - H2OSNO_TOP mass of snow in top snow layer kg - HEAT_FROM_AC sensible heat flux put into canyon due to heat removed from air conditioning - watt/m^2 - HK hydraulic conductivity mm/s inactive - ISOPRENE isoprene flux uGC/M2/H - LAND_USE_FLUX total C emitted from land cover conversion and wood produc t pools gC/m^2/s - LAND_UPTAKE NEE minus LAND_USE_FLUX, negative for update gC/m^2/s - LWup upwelling longwave radiation watt/m^2 inactive - MONOTERP monoterpene flux uGC/M2/H - NBP net biome production, includes fire, landuse, and harvest flux, positive for sink - gC/m^2/s - OCDEP total OC deposition (dry+wet) from atmosphere kg/m^2/s - OVOC other VOC flux uGC/M2/H - ORVOC other reactive VOC flux uGC/M2/H - PBOT atmospheric pressure Pa - PCO2 atmospheric partial pressure of CO2 Pa - PRODUCT_CLOSS total carbon loss from wood product pools gC/m^2/s - PRODUCT_NLOSS total N loss from wood product pools gN/m^2/s - Qair atmospheric specific humidity kg/kg inactive - Qanth anthropogenic heat flux watt/m^2 inactive - Qtau momentum flux kg/m/s^2 - QFLX_LIQ_DYNBAL liq dynamic land cover change conversion runoff flux mm/s - QFLX_ICE_DYNBAL ice dynamic land cover change conversion runoff flux mm/s - QRUNOFF_NODYNLNDUSE total liquid runoff not including correction for land use change (does not include QSNWCPICE) - mm/s - QSNWCPICE excess snowfall due to snow capping mm/s - QSNWCPICE_NODYNLNDUSE excess snowfall due to snow capping not including correction for land use change - mm/s - QSNWCPLIQ excess rainfall due to snow capping mm/s inactive - SMP soil matric potential mm inactive - SNOAERFRC2L surface forcing of all aerosols in snow, averaged only when snow is present (land) - watt/m^2 - SNOAERFRCL surface forcing of all aerosols in snow (land) watt/m^2 - SNOBCFRCL surface forcing of BC in snow (land) watt/m^2 - SNOBCMCL mass of BC in snow column kg/m2 - SNOBCMSL mass of BC in top snow layer kg/m2 - SNOdTdzL top snow layer temperature gradient (land) K/m - SNODSTFRC2L surface forcing of dust in snow, averaged only when snow is present (land) - watt/m^2 - SNODSTFRCL surface forcing of dust in snow (land) watt/m^2 - SNODSTMCL mass of dust in snow column kg/m2 - SNODSTMSL mass of dust in top snow layer kg/m2 - SNOFSRND direct nir reflected solar radiation from snow watt/m^2 inactive - SNOFSRNI diffuse nir reflected solar radiation from snow watt/m^2 inactive - SNOFSRVD direct vis reflected solar radiation from snow watt/m^2 inactive - SNOFSRVI diffuse vis reflected solar radiation from snow watt/m^2 inactive - SNOFSDSND direct nir incident solar radiation on snow watt/m^2 inactive - SNOFSDSNI diffuse nir incident solar radiation on snow watt/m^2 inactive - SNOFSDSVD direct vis incident solar radiation on snow watt/m^2 inactive - SNOFSDSVI diffuse vis incident solar radiation on snow watt/m^2 inactive - SNOLIQFL top snow layer liquid water fraction (land) fraction inactive - SNOOCMCL mass of OC in snow column kg/m2 - SNOOCMSL mass of OC in top snow layer Kg/m2 - SNOOCFRC2L surface forcing of OC in snow, averaged only when snow is present (land) - SNOOCFRCL surface forcing of OC in snow (land) watt/m^2 - watt/m^2 - SNORDSL top snow layer effective grain radius m^-6 inactive - SNOTTOPL snow temperature (top layer) K/m inactive <<< units? - SOILWATER_10CM soil liquid water + ice in top 10cm of soil kg/m2 - SWup upwelling shortwave radiation watt/m^2 inactive - TSOI_10CM soil temperature in top 10cm of soil K - URBAN_AC urban air conditioning flux watt/m^2 - URBAN_HEAT urban heating flux watt/m^2 - VOCFLXT total VOC flux into atmosphere uGC/M2/H - Wind atmospheric wind velocity magnitude m/s inactive - WOOD_HARVESTC wood harvest (to product pools) gC/m^2/s - WOOD_HARVESTN wood harvest (to product pools) gN/m^2/s - - History field name changes: - - ANNSUM_PLANT_NDEMAND => ANNSUM_POTENTIAL_GPP - ANNSUM_RETRANSN => ANNMAX_RETRANSN - C13_DWT_PROD10C_LOSS => C13_PROD10C_LOSS - C13_DWT_PROD100C_LOSS => C13_PROD100C_LOSS - C13_DWT_PROD10N_LOSS => C13_PROD10N_LOSS - C13_DWT_PROD100C_LOSS => C13_PROD100C_LOSS - DWT_PROD100N_LOSS => PROD10N_LOSS - DWT_PROD100N_LOSS => PROD100N_LOSS - DWT_PROD100C_LOSS => PROD10C_LOSS - DWT_PROD100C_LOSS => PROD100C_LOSS - HCSOISNO => HC - TEMPSUM_PLANT_NDEMAND => TEMPSUM_POTENTIAL_GPP - TEMPSUM_RETRANSN => TEMPMAX_RETRANSN - - History field names deleted: - SNOWAGE, TSNOW, FMICR, FCO2, DMI, QFLX_SNOWCAP - - Add new urban oriented _U, and _R (Urban and Rural) for: - EFLX_LH_TOT, FGR, FIRA, FSH, FSM, Q2M, QRUNOFF, RH2M, SoilAlpha, TG, TREFMNAV, TREFMXAV, and TSA - (missing _R for SoilAlpha) - -Describe timing and memory performance: - -Versions of any externally defined libraries: - - scripts scripts4_100108b - drv vocemis-drydep12_drvseq3_1_11 - datm datm8_091218 - socn stubs1_2_02/socn - sice stubs1_2_02/sice - sglc stubs1_2_02/sglc - csm_share vocemis-drydep13_share3_091217 - esmf_wrf_timemgr esmf_wrf_timemgr_090402 - timing timing_090929 - mct MCT2_7_0_100106 - pio pio60_prod - cprnc cprnc_081022 - -Summary of testing: - - bluefire: All PASS except... -025 smG41 TSM.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -026 erG41 TER.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -027 brG41 TBR.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -028 blG41 TBL.sh 17p_sc_dh clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 -029 smG55 TSM.sh 17p_sc_h clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic .........FAIL! rc= 10 -043 smLI1 TSM.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -044 erLI1 TER.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -045 brLI1 TBR.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -046 blLI1 TBL.sh _sc_dh clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 4 -048 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 12+84 arb_ic ............FAIL! rc= 12 - bluefire interactive testing: All PASS except... -013 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 5 -019 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -021 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -022 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -026 brAK8 TBR.sh _sc_ds clm_std^nl_ptsmode_ocn 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ......FAIL! rc= 6 - bluefire/CCSM testing: All PASS except -FAIL PST.f45_g37.I1850.bluefire.compare.clm3_7_10 -FAIL PET_PT.f45_g37.I1850.bluefire.compare.clm3_7_10 -FAIL ERB.f09_g16.I1850SPINUPCN.bluefire -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.generate.clm3_7_15 -BFAIL ERB.f09_g16.I1850SPINUPCN.bluefire.compare.clm3_7_10 -FAIL ERH_D.f10_f10.I1850CN.bluefire.compare.clm3_7_10 -BFAIL PST.f10_f10.I8520CN.bluefire.compare.clm3_7_10 -BFAIL PET_PT.f10_f10.I8520CN.bluefire.compare.clm3_7_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare_hist.clm3_7_10 -FAIL ERS_D.f19_g16.IRCP85CN.bluefire.compare.clm3_7_10 - jaguar: All PASS except.. -005 smB51 TSM.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 144 arb_ic ..............FAIL! rc= 10 -006 erB51 TER.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -007 brB51 TBR.sh _scsnf_dh clm_std^nl_urb 20021230:NONE:1800 10x15 USGS 72+72 arb_ic ............FAIL! rc= 5 -026 smLI2 TSM.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10 arb_ic ........................FAIL! rc= 10 -027 erLI2 TER.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -5+-5 arb_ic ......................FAIL! rc= 5 -028 brLI2 TBR.sh _sc_dm clm_std 20020101:NONE:1800 94x192 T62 -10+-10 arb_ic ....................FAIL! rc= 5 -030 smL58 TSM.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 96 arb_ic ...............FAIL! rc= 10 -031 erL58 TER.sh _sc_dh clm_std^nl_crcrop 20020115:NONE:1800 10x15 USGS 12+84 arb_ic ............FAIL! rc= 5 - jaguar interactive testing: All PASS except... -006 erAK4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 7 -007 brAK4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 1.9x2.5 gx1v6 -5+-5 cold ..........FAIL! rc= 6 -009 smG43 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -010 erG43 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 brG43 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 - edinburgh/ifort interactive testing: All PASS except... -006 erAL4 TER.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 7 -007 brAL4 TBR.sh _sc_ds clm_std^nl_ptsmode 20030101:NONE:1800 10x15 USGS -5+-5 cold .............FAIL! rc= 6 -014 erOC4 TER.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 115+115 arb_FAIL! rc= 5 -015 brOC4 TBR.sh _nrvansc_ds clm_urb1pt^nl_urb_br 19920812:NONE:3600 1x1_vancouverCAN navy 72+72 arbFAIL! rc= 5 -016 blOC4 TBL.sh _nrvansc_ds clm_urb1pt^nl_urb 19920812:NONE:3600 1x1_vancouverCAN navy 330 arb_ic FAIL! rc= 4 -018 erNB4 TER.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 57+100 arb_FAIL! rc= 5 -019 brNB4 TBR.sh _nrmexsc_ds clm_urb1pt^nl_urb_br 19931201:NONE:3600 1x1_mexicocityMEX navy 72+72 arFAIL! rc= 5 -020 blNB4 TBL.sh _nrmexsc_ds clm_urb1pt^nl_urb 19931201:NONE:3600 1x1_mexicocityMEX navy 157 arb_ic FAIL! rc= 4 - edinburgh/ifort: All PASS except... -002 erA92 TER.sh _sc_dm clm_std^nl_urb 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic ................FAIL! rc= 7 -003 brA92 TBR.sh _sc_dm clm_std^nl_urb_br 20030101:NONE:3600 4x5 gx3v7 -3+-3 arb_ic .............FAIL! rc= 6 -006 erD91 TER.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 72+72 cold ...............FAIL! rc= 7 -007 blD91 TBL.sh _persc_dh clm_per^nl_urb 20021231:NONE:1200 4x5 gx3v7 144 cold .................FAIL! rc= 5 -008 smG42 TSM.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -009 erG42 TER.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -010 brG42 TBR.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -011 blG42 TBL.sh 17p_sc_dm clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - breeze,gale,hail,gust/ifort interactive testing: All PASS except... -011 blCA8 TBL.sh _nrsc_ds clm_std^nl_urb 20021230:NONE:3600 1x1_asphaltjungleNJ navy -90 arb_ic .FAIL! rc= 5 -020 smG53 TSM.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 10 -021 erG53 TER.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 10+38 arb_ic ......FAIL! rc= 5 -022 brG53 TBR.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 72+72 arb_ic ......FAIL! rc= 5 -023 blG53 TBL.sh 17p_sc_do clm_pftdyn 10001230:NONE:1800 10x15 USGS@1000-1002 144 arb_ic ........FAIL! rc= 4 - -CLM tag used for the baseline comparison tests if applicable: clm3_5_00 - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers: - - what code configurations: All - - what platforms/compilers: All - - nature of change: new climate for clm4 - - If this tag changes climate describe the run(s) done to evaluate the new - climate in enough detail that it(they) could be reproduced, i.e., - ccsm4_0_beta35 - bluefire - -compset B_1850_TRACK1_CN -res f19_g16 - - MSS location of control simulations used to validate new climate: - -/DLAWREN/csm/b40.1850.track1.2deg.003.snow - - URL for LMWG diagnostics output used to validate new climate: - -http://www.cgd.ucar.edu/ccr/paleo/b40.snow/b40.1850.track1.2deg.003.snow-b40.1850.track1.2deg.003.control/ - -=============================================================== diff --git a/doc/clm4_5_ChangeLog b/doc/clm4_5_ChangeLog deleted file mode 100644 index cdd1dc80d7..0000000000 --- a/doc/clm4_5_ChangeLog +++ /dev/null @@ -1,41442 +0,0 @@ -=============================================================== -Tag name: clm4_5_18_r275 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Mon Feb 5 15:02:53 MST 2018 -One-line Summary: Update initial condition files, update fates, new CMIP6 pop-dens, more lnd_tuning_mod options, updated ndep for fully coupled - -Purpose of changes ------------------- - -Update the initial condition files for clm4_0, clm4_5, clm5_0 at f09_g16 for both CRUNCEpv7 -forcing and GSWP3v1 forcing. Update FATES with science change to science-1.4.1_api-3.0.0. -New CMIP6 population density file that has years beyond 1850 (the old one just had 1850, so -was incorrect for historical or present-day). clm4_0 compsets now use CRUNCEPv7 forcing rather than -the CRUNCEPv4 forcing. LND_TUNING_MODE is now used for initial conditions -for different forcing. For fully coupled 1850 cases the ndep file is updated to a preliminary CMIP6 -version. Fix the tools testing and build-namelist testing to work in the git checkout. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #: - #247 -- Clm40 1850 and HIST compsets are incorrect - #246 -- New CMIP6 population density file is incorrect as it's constant in time - #171 -- CLM is getting the mask from the clm namelist_defaults rather than from top level scripts - -Known bugs introduced in this tag (include github issue ID): - #253 -- Bad new IC file for clm4_0 - #254 -- Failing test ERS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_gnu.clm-default (sporadic glitch?) - #255 -- PTCLMmkdata doesn't work in the CLM git checkout - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - LND_TUNING_MODE is set by default according to the compset the case is created with. - If you change the CLM physics or DATM forcing, you'll want to update the LND_TUNING_MODE. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - LND_TUNING_MODE options changed to: - clm4_5_CRUv7,clm4_5_GSWP3v1,clm4_5_cam6.0,clm5_0_cam6.0,clm5_0_CRUv7,clm5_0_GSWP3v1 - - Several new compset aliases added: - - CLM50: I1850Clm50Sp, I1850Clm50SpCru, I1850Clm50BgcCropCru - CLM45: I1850Clm45BgcCruGs, I1850Clm45BgcGs - CLM40 I1850Clm40CnGswGs (fixed I2000Clm40SpCruGs, I1850Clm40SpCruGs, and IHistClm40SpCruGs) - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): New IC files for f09_g16 - CMIP6 ndep file for fully coupled, pop-density beyond 1850 - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Setting of ndep_taxmode/ndep_varlist should be simplified in CLMBuildNamelist.pm - Change name of setup_logic_lnd_tuning to setup_cmdl_lnd_tuning in CLMBuildNamelist.pm - -Changes to tests or testing: Change a few tests and add a few - Add I1850Clm50SpCru, I1850Clm50BgcCropCru, I1850Clm40CnGswGs and I1850Clm50Sp tests at f09_g16 - Change I1850Clm40SpCruGs f09_f09_mg16 to f09_g16 - Change I2000Clm50BgcCruGs f09_g17 test to I1850Clm50BgcCruGs f09_g16 - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (134 comparison tests are different than clm4_5_18_r275) - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - OK - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - FAIL - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_18_r275 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers: - - what code configurations: clm4_0 for f09_g16 - clm4_0 updated to CRUv7 Forcing - all clm4_5 and clm5_0 configurations, FATES-update - - what platforms/compilers: All - - nature of change: initialization, BGC for HIST/2000 compsets - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): FATES - fates to fates_s1.4.1_a3.0.0_rev3 - -Pull Requests that document changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #252 -- New IC files - #251 -- README update - #248 -- Documentation of SMB in namelist_definition - #228 -- Get tools and testing working - - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r274 -Originator(s): sacks (Bill Sacks) -Date: Tue Jan 30 05:55:53 MST 2018 -One-line Summary: Fix auto-detection of CIME_MODEL in a standalone checkout - -Purpose of changes ------------------- - -The auto-detection of whether CIME_MODEL is acme or cesm is broken in -standalone checkouts of clm4_5_18_r273. (This auto-detection relied on -whether there was an SVN_EXTERNAL_DIRECTORIES file present at the top -level.) - -This tag points to a new cime version that fixes this issue. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- #238 - clm4_5_18_r273 requires setting CIME_MODEL - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik Kluzek - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - - Note: I ran the cheyenne tests with CIME_MODEL=cesm defined in my - environment, and the hobart tests without this setting. - -CLM tag used for the baseline comparisons: clm4_5_18_r273 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - -- cime: clm4518/n03/cime5.4.0-alpha.03 -> clm4518/n04/cime5.4.0-alpha.03 - Fix to auto-detect that CIME_MODEL=cesm based on presence of - manage_externals rather than SVN_EXTERNAL_DIRECTORIES - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Fix the documentation of some expected fails -M cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r273 -Originator(s): sacks (Bill Sacks) -Date: Fri Jan 26 15:26:06 MST 2018 -One-line Summary: Support a standalone checkout from git - -Purpose of changes ------------------- - -This PR allows a standalone git-based checkout to work. Starting with -this tag, we'll be using git rather than svn for CLM/CTSM development. - -The biggest changes here are pulling in manage_externals, which serves -the role of svn externals. After cloning the repository, you can get all -of the necessary externals by running: - -./manage_externals/checkout_externals - -See the file README_EXTERNALS.rst at the top level of the repository for -more details on using this tool. - -Other than that, this PR mostly involves changes to allow you to run -from the new directory structure of a standalone checkout: Now all of -the CLM/CTSM directories appear at the top level of the checkout, rather -than nested under components/clm. - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include github issue ID): - -- https://github.com/ESCOMP/ctsm/issues/220 For new standalone - organization, need to generalize paths for tools and testing - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -- The svn trunk is now frozen. All future development will occur in the - master branch of https://github.com/ESCOMP/ctsm - -- A standalone git checkout will have all CLM directories (src, bld, - etc.) at the top level, rather than under components/clm. - -- To get all externals after cloning the git repository, run - ./manage_externals/checkout_externals - - See the file README_EXTERNALS.rst at the top level of the repository - for more details on using this tool. - -- More details on working with the git repository will be coming soon - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -- build-namelist unit tests currently do not run (#220) - -- tools tests, and the tools builds themselves, are expected not to work (#220) - -Changes to tests or testing: none - -Code reviewed by: Ben Andre, Erik Kluzek - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - FAIL (#220) - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - NOT RUN; EXPECTED TO FAIL (#220) - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - NOT RUN; MAY FAIL DUE TO #220 - - regular tests (aux_clm): - - cheyenne_intel ---- pass - cheyenne_gnu ------ pass - hobart_nag -------- pass - hobart_pgi -------- pass - hobart_intel ------ pass - -CLM tag used for the baseline comparisons: clm4_5_18_r272 -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): - -- cime: clm4518/n02/cime5.4.0-alpha.03 -> clm4518/n03/cime5.4.0-alpha.03 - Has some changes needed for new standalone directory structure to work - (these changes are now on cime master, though see #225 before updating - to cime master) - -- cism: cism2_1_40 -> cism2_1_46 - Points to cism in git - cism2_1_41, 42, 43 and 44 contained very minor changes - cism2_1_45 and 46 are the git migration - -List all files eliminated: - -========= Handle externals via manage_externals rather than svn externals -D README_EXTERNALS -D SVN_EXTERNAL_DIRECTORIES -D SVN_EXTERNAL_DIRECTORIES.standalone - -List all files added and what they do: - -========= Added this directory and everything below it. Pulled in via - git subtree from - https://github.com/NCAR/manage_externals/. This is the new - tool for pulling in and updating externals (replacing svn - externals). -A manage_externals/ - -========= Handle externals via manage_externals rather than svn externals -A Externals.cfg -A Externals_CLM.cfg -A README_EXTERNALS.rst - -========= Handle new directory structure of standalone checkouts -A .config_files.xml - -========= Add some .gitignore files -A src/dyn_subgrid/.gitignore -A src/unit_test_shr/.gitignore -A src/unit_test_stubs/main/.gitignore -A src/unit_test_stubs/utils/.gitignore -A src/utils/.gitignore -A cime_config/.gitignore - -List all existing files that have been modified, and describe the changes: - -========= Handle new directory structure of standalone checkouts -M bld/CLMBuildNamelist.pm -M bld/configure -M cime_config/buildcpp -M cime_config/buildlib -M cime_config/buildnml -M src/CMakeLists.txt - -========= Documentation updates for move to git -M .CLMTrunkChecklist -M .gitignore -M LICENSE -M README.rst -M src/README.unit_testing - -========= Separately document expected fails for aux_clm vs fates test - lists -M cime_config/testdefs/ExpectedTestFails.xml - -========= ChangeLog now only stored in doc directory, not in top-level - directory -R095 .ChangeLog_template doc/.ChangeLog_template -R070 UpDateChangeLog.pl doc/UpdateChangelog.pl - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r272 -Originator(s): erik (Erik Kluzek) -Date: Thu Jan 25 01:17:01 MST 2018 -One-line Summary: Bring in latest FATES release version to CLM trunk: fates_s1.4.1_a3.0.0_rev2 - -Purpose of changes ------------------- - -Bring in the latest version of FATES from NGEET/fates-release and the associated interface -changes in CLM from NGEET/fates-clm. The new version is 1.4.1 for science and version 3.0 of -the API updated from 1.3.0 for science and 1.0.0 for the API. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CCTSM Issue #): #219 - #219 -- Options listed incorrectly in testlist_clm.xml - -Known bugs introduced in this tag (include github issue ID): (or found) - #216 -- PE layout for hcru_hcru needs to be increased so that it can run - #213 -- CPLHIST case is matching the wrong CLM_NML_USE_CASE - #212 -- Can't use a non-fates restart file to interpolate to a simulation with fates - #211 -- Can't handle interpolating from a fates restart file because of the cohort dimension - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): Simple FATES initial-condition - files were added for present day at f45 and 1x1_brazil. FATES IC can't be interpolated from - so you either have to have an exact match or do a cold start. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): New FATES namelist items: - use_fates_planthydro, use_fates_ed_st3, use_fates_ed_prescribed_phys, - use_fates_inventory_init, fates_inventory_ctrl_filename,use_fates_logging - -Changes made to namelist defaults (e.g., changed parameter values): when FATES on, non-fates finidat - files won't be matched - -Changes to the datasets (e.g., parameter, surface or initial files): New fates param file - and finidat files for f45 and 1x1_brazil - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: ed test list removed and updated fates list added in - with new version=2.0 format, fates test list now sets machine/compiler rather than - using generic "fates" for both. - -Code reviewed by: self, rgknox, ckoven - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (33 fates namelist tests are different) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_18_r271 - - -Answer changes --------------- - -Changes answers relative to baseline: Only simulations with fates on - - Summarize any changes to answers, i.e., - - what code configurations: Only "-bgc fates" - - what platforms/compilers: All - - nature of change: new climate, fates science updated from 1.3.0 to 1.4.1 - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): rtm, mosart, fates - rtm to rtm1_0_65 - mosart to mosart1_0_30 - fates to fates_s1.4.1_a3.0.0_rev2 - -List all files eliminated: - - fates test directory changed to one capitolized to be similar to new tests added - D components/clm/cime_config/testdefs/testmods_dirs/clm/fates/user_nl_clm - D components/clm/cime_config/testdefs/testmods_dirs/clm/fates/shell_commands - -List all files added and what they do: - - New tests for exercising more Fates options, all are based on the Fates test-mod - and add a few changes on top of it - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesShortList/user_nl_clm ------- Short list of hist_fincl1 - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesShortList/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesST3/user_nl_clm ------------- use_fates_ed_st3=T - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesST3/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/user_nl_clm --------- Long list of FATES variables - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesAllVars/shell_commands ----- Cold-start - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesLogging/user_nl_clm -------- use_fates_logging=T - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesLogging/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/user_nl_clm -------- Longer list of hist_fincl1 - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesColdDef/shell_commands ----- Cold-start - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/user_nl_clm ---------- use_fates_ed_prescribed_phys=T - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesPPhys/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/Fates/user_nl_clm -------------- Moved from fates directory, longer - hist_fincl1 list - A components/clm/cime_config/testdefs/testmods_dirs/clm/Fates/shell_commands ----------- Moved from fates directory, no longer - a cold-start - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/user_nl_clm -------- use_fates_spitfire=F - A components/clm/cime_config/testdefs/testmods_dirs/clm/FatesNoFire/include_user_mods - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/CLMBuildNamelist.pm - Handle new FATES namelist items, send - use_fates down for setting of finidat, if use_fates_inventory_init=T, make - sure fates_inventory_ctrl_filename is set - - M components/clm/bld/unit_testers/build-namelist_test.pl - Change ED to FATES, test new FATES features - - M components/clm/bld/namelist_files/namelist_defaults_overall.xml -- clm_start_type is arb_ic when use_fates=T - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Update fates var descriptsion, and add - new namelist items: use_fates_logging, use_fates_planthydro, use_fates_ed_st3, use_fates_ed_prescribed_phys, - use_fates_inventory_init, fates_inventory_ctrl_filename, remove use of ED for FATES - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Update fates_paramfile, use_init_interp=T - only if use_fates=F, add use_fates=F to init_interp_attributes, add use_fates setting for finidat files, - and add new f45 and 1x1_brazil FATES finidat files, by default new use_fates_* options are False. - - M components/clm/cime_config/config_compsets.xml ------------- Add a stub-GLC FATES compset: I2000Clm50FatesCruGs - M components/clm/cime_config/testdefs/ExpectedTestFails.xml -- Many new expected fails for #221 and NGEET/fates#315 - M components/clm/cime_config/testdefs/testlist_clm.xml ------- Remove "ed" test-category, new "fates" test category - Move to after rather than nested inside (issue #219). - - M components/clm/src/utils/clmfates_paraminterfaceMod.F90 - Add write about dimension shape on abort - M components/clm/src/utils/clmfates_interfaceMod.F90 ------ New interface control variables, add call to - FatesReportParameters, use_fates_plant_hydro=>use_fates_planthydro, fix restart_map, zero_site=>init_site_vars - use numpft_ed - - M components/clm/src/main/decompInitMod.F90 --------- Set gi rather than ci for cohorts - M components/clm/src/main/subgridMod.F90 ------------ Add call subgrid_get_info_cohort, change subgrid_get_info_natveg call - M components/clm/src/main/histFileMod.F90 ----------- Change some of the parameter names, EDTypesMod interfaces get moved - to FatesInterfaceMod, nlevsclass_ed=>nlevsclass, maxpft=>numpft_ed, - M components/clm/src/main/controlMod.F90 ------------ Add new fates flags to namelist and broadcast/print them - M components/clm/src/main/clm_varctl.F90 ------------ New FATES flags, change ED=>FATES and some formatting - M components/clm/src/main/initGridCellsMod.F90 ------ ncohorts=>npatches - M components/clm/src/main/initVerticalMod.F90 ------- Remove call to ed_hist_scpfmaps - M components/clm/src/main/readParamsMod.F90 --------- Remove call to FatesReadParameters - M components/clm/src/biogeophys/CanopyFluxesMod.F90 - Add blank line - M components/clm/src/biogeophys/OzoneMod.F90 -------- Comment out setting of o3* variables to spval - - M components/clm/src/CMakeLists.txt -- Add fates/main to unit-test directories - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r271 -Originator(s): erik (Erik Kluzek) -Date: Sat Jan 20 20:27:00 MST 2018 -One-line Summary: Update testlist to v2 and remove yellowstone - -Purpose of changes ------------------- - -Redo the testlist in version 2 format and remove yellowstone from it. Also update mosart and rtm with updated -test lists. The new testlist format also allows wallclock times to be set (and they are) so that they can run -in the queue faster. Change some files that referenced bugzilla ID's to github issue #'s. Update tools testing -for gen_domain to use version under cime/tools rather than the copy under clm. - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include github issue ID): - #216 -- PE layout for hcru_hcru - #213 -- CPLHIST case is matching the wrong CLM_NML_USE_CASE - #212 -- Can't use a non-fates restart file to interpolate to a simulation with fates - #211 -- Can't handle interpolating from a fates restart file because of the cohort dimension - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - MEMLEAK, TPUTCOMP and MEMCOMP tests now seem to be robust and can be trusted. - -Changes to tests or testing: Test list completely redone - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - OK - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- PASS - hobart_intel ------ PASS - -CLM tag used for the baseline comparisons: clm4_5_18_r270 - - -Answer changes --------------- - -Changes answers relative to baseline: no bit-for-bit, no source code changed - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime, mosart, rtm - cime to clm4518/n02/cime5.4.0-alpha.03 which allows CLM grids in testlist - mosart to mosart1_0_29 with redone test list in v2 format - rtm to rtm1_0_64 with redone test list in v2 format - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M parse_cime.cs.status -- MEMLEAK, MEMCOMP, and TPUTCOMP don't need to be ignored anymore - - M .ChangeLog_template -- Remove bugzilla in place for github issue ids - - Update to test gen_domain under cime/tools rather than the copy under components/clm/tools/gen_domain - The copy won't be able to be done in the new github world. - M components/clm/test/tools/TBLCFGtools.sh ----- Set name of test directory by basename (so relative path can be passed in) - M components/clm/test/tools/input_tests_master - gen_domain path is relative to tools directory but under cime now - M components/clm/test/tools/test_driver.sh ----- Remove yellowstone set "--mpilib mpi-serial" for TOOLS CFG string - M components/clm/test/tools/TSMCFGtools.sh ----- Set name of test directory by basename - M components/clm/test/tools/TCBCFGtools.sh ----- Set name of test directory by basename - - M components/clm/bld/unit_testers/build-namelist_test.pl - Fix number of tests - - M components/clm/cime_config/testdefs/testlist_clm.xml ------- Completely redo in version 2 format - M components/clm/cime_config/testdefs/ExpectedTestFails.xml -- Update to github issues rather than bugzilla - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r270 -Originator(s): sacks (Bill Sacks) -Date: Wed Dec 20 12:04:25 MST 2017 -One-line Summary: Always use multiple elevation classes for glacier, even with stub glc - -Purpose of changes ------------------- - -Up until now, we have been using the glacier_mec (multiple elevation -class) scheme when running with CISM, but the old non-elevation class -scheme when running with a stub glacier model (SGLC). This is -problematic because it means that simply switching from CISM to SGLC -fundamentally changes CLM's glacier physics. (Note: with the current -configuration, the multiple elevation class scheme is enabled over -Greenland and Antarctica but not elsewhere.) - -There are a few use cases where this is important: - -- Single-point and regional runs over glacier regions: In this case, you - cannot use CISM. Members of the LIWG want to do runs like this so they - can do single-point testing with the multiple elevation class scheme. - -- Currently, CISM does not support a Gregorian calendar (i.e., with leap - years). So cases with a Gregorian calendar need to use SGLC. This - includes data assimilation and CAM specified dynamics runs. We want - the physics of these runs to match the standard CLM physics as closely - as is feasible. - -- There may be other cases where a user doesn't want to include CISM - because of the extra complexity this involves, such as when setting up - a new grid (which would require additional mapping files for - CISM). Again, we want the physics of these runs to match the standard - CLM physics as closely as is feasible. - -Note that runs with SGLC will still differ somewhat from runs with CISM, -even when CISM is running in the typical NOEVOLVE mode. This is because -there will be differences in % glacier and topographic heights over -Greenland: in a run with CISM, this information comes from CISM at the -start of the run so that CLM and CISM agree in this respect; in a run -with SGLC this information comes from CLM's surface dataset. - -However: Running with SGLC now gives the same answers as running with -CISM with GLC_TWO_WAY_COUPLING set to FALSE. (These both differ from the -standard configuration that uses CISM with GLC_TWO_WAY_COUPLING TRUE -just over Greenland.) - -Mostly-unrelated change: Remove tropicAtl grid - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): -- https://github.com/ESCOMP/ctsm/issues/158 now causes test failures for - ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropGs.yellowstone_pgi.clm-monthly, - since we're now using a new and buggy surface dataset for that case. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- If you use an finidat file from an old run that used SGLC, you'll need - to run init_interp and will need to set - init_interp_fill_missing_with_natveg = .true. in user_nl_clm. Note - that this will initialize glacier_mec landunits with information from - vegetated landunits, which is not a very good initialization, so - you'll want to spin up for a while to spin up the new glacier_mec - landunits. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): no - -Changes made to namelist defaults (e.g., changed parameter values): no - -Changes to the datasets (e.g., parameter, surface or initial files): -- New surface datasets for single-point and regional runs: These now - have the data necessary to run with the multiple elevation class - glacier scheme. None of our out-of-the-box single-point or regional - datasets have any glacier cover, so this doesn't lead to substantive - changes. Note, though, that the smallville datasets hadn't been - updated in a while, so there are bigger changes to the smallville - datasets. The new smallville datasets are buggy (due to - https://github.com/ESCOMP/ctsm/issues/158), but the old ones wouldn't - have worked with the new code due to missing glacier_mec - information. Note that I have NOT changed the landuse.timeseries - files, because those don't change in any substantive way with the - setting of -glc_nec in mksurfdata_map. - -- Runs with SGLC now point to different finidat files by default: they - now point to finidat files that were generated with glacier_mec, which - may differ substantially from the files that were generated without - glacier_mec (since I think these came from completely different - spinups). - -Substantial timing or memory changes: Expect some performance -degradation in SGLC runs, since now we're using multiple elevation -classes over Greenland and Antarctica, though I haven't investigated it -carefully. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: Delete tropicAtl_subset tests: these tests -didn't provide much value, and the code they cover is also covered by -unit tests - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok - - prove test_build_namelist fails as on trunk - - main build-namelist tests pass, clm4_5 and clm5_0 lnd_in files - differ from trunk as expected - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - ok - - Tests pass other than these known issues: - - smfg4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools - See https://github.com/ESCOMP/ctsm/issues/188 - - blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools - blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools - See https://github.com/ESCOMP/ctsm/issues/187 - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - ok - - 1 failure, as on the trunk - - compare tests: 40 PASS, 1 Fail; on the trunk, all 41 Failed. I'm - not sure why my branch improves things in this respect. - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi --- ok - yellowstone_gnu --- ok - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - Tests pass. Baseline comparisons fail for compsets with SGLC (both - global tests and single-point and regional tests). This is expected - and is described in detail below. - -CLM tag used for the baseline comparisons: clm4_5_18_r269 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All compsets with SGLC (as opposed to CISM) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Potentially new climate, though not investigated carefully - - Answers change in runs with SGLC due to the use of different - out-of-the-box finidat files: they now point to finidat files that - were generated with glacier_mec, which may differ substantially - from the files that were generated without glacier_mec (since I - think these came from completely different spinups). - - For global runs, even without finidat differences, answers change - over Greenland and Antarctica, since we're now using the - multiple-elevation-class scheme there. Answers are the same - outside of Greenland and Antarctica, where we still use a single - glacier elevation class. (Based on spot-checking FSH in a 3-year - cold start run.) - - (For single-point and regional runs, differences are mainly just - due to changes in finidat. One exception may be smallville tests, - since the smallville surface datasets have changed more - extensively; I did not investigate the smallville answer changes - carefully.) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): -- cime: cime5.4.0-alpha.03 -> billsacks/always_glcmec_n01 - The changes here are: - - always use GLC_NEC=10, except for CLM40 - - delete references to tropicAtl - -List all files eliminated: - -========= These glacierMEC use cases weren't accomplishing anything: - compared with the similar non-glacierMEC use cases, they just - set the glc_nec namelist variable, but this variable didn't - even exist! So I have switched cases to use the corresponding - non-glacierMEC use cases -D components/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml -D components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml -D components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml -D components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml -D components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml -D components/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml -D components/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - -========= This use case appeared to be unused -D components/clm/bld/namelist_files/use_cases/glacierMEC_pd.xml - -========= These tropicAtl_subset tests were hard to maintain and didn't - provide much value: the code they covered is also covered via - unit tests -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/shell_commands -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/shell_commands -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/shell_commands -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/shell_commands -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset - - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Always use -glc_nec 10, delete tropicAtl, and other minor fixes -M components/clm/tools/mksurfdata_map/Makefile.data - -========= Require glc_nec >= 1 when making surface datasets -M components/clm/tools/mksurfdata_map/src/mkfileMod.F90 -M components/clm/tools/mksurfdata_map/src/mkglcmecMod.F90 -M components/clm/tools/mksurfdata_map/src/mksurfdat.F90 -M components/clm/tools/mksurfdata_map/mksurfdata.pl - -========= Require glc_nec >= 1 for clm45/clm50 -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/unit_testers/build-namelist_test.pl -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/cime_config/buildnml - -========= Remove istice; always use glacier_mec type -M components/clm/src/biogeochem/DryDepVelocity.F90 -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/LandunitType.F90 -M components/clm/src/main/TopoMod.F90 -M components/clm/src/main/filterMod.F90 -M components/clm/src/main/lnd2glcMod.F90 -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/subgridAveMod.F90 -M components/clm/src/main/initGridCellsMod.F90 -M components/clm/src/main/initVerticalMod.F90 -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/surfrdMod.F90 -M components/clm/src/main/clm_instMod.F90 -M components/clm/src/main/landunit_varcon.F90 -M components/clm/src/main/subgridWeightsMod.F90 -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/subgridMod.F90 -M components/clm/src/main/ColumnType.F90 -M components/clm/src/main/histFileMod.F90 -M components/clm/src/main/restFileMod.F90 -M components/clm/src/biogeophys/WaterStateType.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/TemperatureType.F90 -M components/clm/src/biogeophys/SurfaceAlbedoMod.F90 -M components/clm/src/biogeophys/PhotosynthesisMod.F90 -M components/clm/src/biogeophys/CanopyTemperatureMod.F90 -M components/clm/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 -M components/clm/src/biogeophys/SurfaceResistanceMod.F90 -M components/clm/src/biogeophys/TotalWaterAndHeatMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 -M components/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/dyn_subgrid/dynInitColumnsMod.F90 -M components/clm/src/dyn_subgrid/dynLandunitAreaMod.F90 -M components/clm/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf -M components/clm/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/cpl/clm_cpl_indices.F90 -M components/clm/src/cpl/lnd_import_export.F90 -M components/clm/src/cpl/lnd_comp_mct.F90 - -========= In addition to supporting the main changes of this tag, also - do a fairly major refactor: set fields internally rather than - letting lnd_import set the fields -M components/clm/src/main/glc2lndMod.F90 - -========= Fixes to unit tests for changes in glc2lnd -M components/clm/src/main/test/topo_test/test_topo.pf - -========= Remove tropicAtl tests and references to tropicAtl grid (see - above for more notes on this) -M components/clm/cime_config/testdefs/testlist_clm.xml -M components/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml -M components/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_0.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml -M components/clm/bld/namelist_files/namelist_defaults_overall.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M components/clm/bld/namelist_files/checkmapfiles.ncl -M components/clm/doc/UsersGuide/adding_files.xml - -========= No longer use glacierMEC-specific use cases (see above for - more notes on this) -M components/clm/cime_config/config_component.xml - -========= Fix creation date of files pointed to by tests -M components/clm/test/tools/nl_files/PTCLM_USUMB_clm4_5 -M components/clm/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 -M components/clm/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 - -========= No longer need init_interp_fill_missing_with_natveg (I think - this could have been removed a while ago) -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm - -========= New expected failure: - ERS_Lm20_Mmpi-serial.1x1_smallvilleIA.I2000Clm50BgcCropGs.yellowstone_pgi.clm-monthly -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r269 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Sat Dec 16 19:49:41 MST 2017 -One-line Summary: Move externals to version in github - -Purpose of changes ------------------- - -Move the CLM externals to the version in github for MOSART, RTM and -PTCLM. For PTCLM this meant updating to a version that didn't take -advantage of subversion keywords. I also updated to a version that -can properly compare to the files it keeps even with differences -of user, machine, path, or date. - - -Bugs fixed or introduced None ------------------------- - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self,andre - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_18_r268 - - -Answer changes --------------- - -Changes answers relative to baseline: no bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): rtm, mosart, PTCLM - - mosart1_0_28 to github version - rtm1_0_63 to github version - PTCLM to PTCLM2_171216c and github version - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: None - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r268 -Originator(s): erik (Erik Kluzek) -Date: Mon Dec 11 16:47:24 MST 2017 -One-line Summary: Fix calculation of stomatal resistence used in dry-deposition, increase threshold of totvegc for soil decomposition to 0.1 - -Purpose of changes ------------------- - -Changes from Louisa Emmons to fix the calculation of stomatal resistence in the dry-deposition code so it's the inverse -of the previous calculation (and the arbitrary multiplicitive factor to reduce it was removed). Add new optional history -fields for dry-deposition. - -Increase the threshold of total vegetation carbon for when decomposition pools are reset from 1.e-8 to 0.1. This change comes from -Dave Lawrence and Keith Oleson. The code was also modified to use better names for this rather than ccrit and ncrit which came in -clm4_5_17_r264. Add some new checking for these settings at initialization. Add some changes to the default CMIP6 output from -Keith Oleson. - -Add in f05 fsurdat and one landuse.timeseries datasets. Add check in SSP test that makes sure the compset used includes MOSART as -expected. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2545, 2546 - 2526 -- Fix calculation of stomatal resistance for dry deposition - 2545 -- SSP test assumes that MOSART is being used, and dies inexplicably if not - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - Add new optional history fields when drydeposition is on: DRYDEPV_*, RS_DRYDEP_O3 - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files) Add f05 fsurdat and one landuse.timeseries file: - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - RS_DRYDEP_O3 history field is hardcoded for Ozone. In most cases the same value would apply to other species, but it is - hardcoded to give values for Ozone. - -Changes to tests or testing: Add ciso SSP test - -Code reviewed by: self,tilmes,emmons,fvitt - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_18_r267 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, but only for drydep and/or exit_spinup - - Summarize any changes to answers, i.e., - - what code configurations: with drydep on, or in exit_spinup mode for either clm4_5 or clm5_0 - - what platforms/compilers: All - - nature of change: modest - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: Add new ciso_rtmColdSSP testmod -- includes ciso and rtmColdSSP testmods - - A /clm/cime_config/testdefs/testmods_dirs/clm/ciso_rtmColdSSP/include_user_mods - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/unit_testers/build-namelist_test.pl -- Increase test numbers as now testing f05 datasets - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ---- Add f05 fsurdat files and one landuse.timeseries file - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -- Add f05 to list of supported resolutions - - M components/clm/cime_config/testdefs/testlist_clm.xml --------------- Add SSP ciso test - M components/clm/cime_config/usermods_dirs/cmip6_output/user_nl_clm -- Added FCTR, FCEV, FGEV, FIRE, FSR, and HTOP; - and removed QVEGT; all from the h1 file (fincl2) (from Keith Oleson) - M /clm/cime_config/SystemTests/ssp.py ---------------------- Update comments, add expect that compset uses mosart - - M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 --- Change ncrit to totvegcthresh and SetNCrit to SetTotVgCThresh - add abort if totvegcthresh is unset, and check that it's greater than zero - M components/clm/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 - Set totvegcthresh to 0.1 and pass down via setTotVgCThresh methods - M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 ----- Change ccrit to totvegcthresh and SetNCrit to SetTotVgCThresh - add abort if totvegcthresh is unset, and check that it's greater than zero - M components/clm/src/biogeochem/DryDepVelocity.F90 ------------------------ Modifications from Louisa Emmons, Corrected the equation - calculating stomatal resistance from rssun and rssha, add new array rs_drydep_patch, add new history - output possibilities: DRYDEPV_*, RS_DRYDEP_O3, use spval instead of hardcoded magic number 1.e36 - -=============================================================== -=============================================================== -Tag name: clm4_5_18_r267 -Originator(s): sacks (Bill Sacks) -Date: Thu Dec 7 19:26:48 MST 2017 -One-line Summary: Fixes to accumulator fields - -Purpose of changes ------------------- - -(1) Only accumulate accumulators over active (typically, - non-zero-weight) patches/columns. This changes answers for transient - runs. Previously, accumulator fields were being accumulated even - when a patch/column was inactive. In many cases this was relatively - harmless, but in some cases it was accumulating garbage like - spval. Then, once the point became active, it could take a while for - the garbage accumulated values to be worked out. - - This changes answers for transient runs. I have examined all - accumulator fields used in a typical BgcCrop run (this does NOT - include fields that are only used for CNDV or FATES). Most changes - only last for the first month or so that a point is active, but - there are larger changes for: - - - PREC10 and PREC60: The changes in these are probably the most - extreme. In the old code, these started as spval (rather than a - blank slate) over newly-active patches. PREC10 is garbage for the - first few years after a point becomes active. I didn't look at - PREC60, but its logic is the same as PREC10, so I would expect it - to be garbage for about the first 20 years after a point becomes - active. PREC10 is used in the fire code and for stress deciduous - phenology. PREC60 is used in the fire code. - - - AnnET: In the old code, this started as 0 (rather than a blank - slate) over newly-active points. This affects answers for the - first year or two. This is used in N fixation code. - - - FSUN24 and FSUN240: In the old code, these started out as spval; - it takes a few years for the FSUN240 accumulator to come back down - to reasonable values (even though it's a 10-day accumulator, its - "exponential running average" behavior means that it takes much - longer for memory of a huge value like spval to disappear). These - are just used in VOCEmissionsMod. - - I have not investigated how much these changes in accumulators - affect the science of the model. The biggest effects will probably - be in the fire code in transient runs, but I haven't looked at how - big of an effect these errors in PREC60 have. - - There are also potentially very large changes in CNDV, due to change - in behavior of some patch-level accumulators which are needed for - PFT establishment (and thus should be available over inactive - patches, but no longer are valid for inactive patches). However, - these fields were already buggy (see bug 2537). - -(2) For startup/hybrid runs with non-blank finidat (including runs with - use_init_interp): Continue accumulating continuously from where - things were in the finidat file. Previously, many of the - accumulators were being reset in startup/hybrid runs. This appeared - to be an accident of the implementation details, whose fix was easy - as a side-effect of the fix for (1). This shouldn't have a huge - effect: most accumulators are order 10 days, with the longest being - 365 days, so differences should work themselves out within the first - year or so. But this could be important if you expect a spinup run - to transition continuously into a transient run (for example). - - This changes answers for any startup or hybrid case with non-blank - finidat, where the restart file is from this tag or later. It does - NOT change answers for old restart files. (These old files are - missing the new _NSTEPS fields associated with each accumulator - field, and so nsteps values are set to 0 in a startup/hybrid run, - similarly to the old behavior.) - -Also, a somewhat-unrelated change: Abort if a field is missing from the -restart file in a branch run (just as we do for a continue run); tell -the user to do a startup or hybrid run in this case. My reason for -folding this change into this tag was so that I don't need to worry -about backwards compatibility of branch runs with old restart files. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2526: Some CLM accumulated fields (via accumulMod) are incorrect with dynamic landunits - -Known bugs introduced in this tag (include bugzilla ID): -- The following pre-existing bugs may be somewhat worse now: - - 2537: Climate accumulator fields incorrect for CNDV - - 2539: CNDV logic for agdd20 and tmomin20 needs to be revised to - account for when a given patch/column becomes active - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -- Can no longer do a branch run if some fields are missing from the - restart file, either due to code changes or configuration changes (need - to do hybrid or startup). - -- Cannot do a branch from restart files generated with prior tags, - because the _NSTEPS restart fields associated with accumulation fields - are missing. - -- Startup or hybrid runs using restart files that were generated from - prior tags will not take advantage of fix (2) above. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi --- ok - yellowstone_gnu --- ok - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests pass, answer changes as expected (see below) - -CLM tag used for the baseline comparisons: clm4_5_17_r266 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - Cases with transient vegetation (Hist, Dv) - - Startup / hybrid cases using restart files generated from this - code base. In the test suite, this just shows up as answer - changes in ERI and SSP tests, since other tests use old initial - conditions files. - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff. Not yet investigated as to whether this is - the same or different climate. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Cover accumulMod with unit tests -A components/clm/src/main/test/accumul_test/test_accumul.pf -A components/clm/src/main/test/accumul_test/CMakeLists.txt -A components/clm/src/main/test/accumul_test - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/src/main/accumulMod.F90 -M components/clm/src/biogeophys/TemperatureType.F90 - -========= Change PREC365 to col-level: with these changes, when it was - at patch-level, it would be invalid over not-yet-active - patches - yet it's needed there for the sake of PFT - establishment in CNDV. Also initialize pbot to spval now that - bug 2526 is resolved. -M components/clm/src/main/atm2lndType.F90 -M components/clm/src/biogeochem/CNDVEstablishmentMod.F90 - -========= Need 'active' flag in gridcell_type (always true), so that - gridcell_type has the same interface as other subgrid types in - this respect -M components/clm/src/main/GridcellType.F90 - -========= Abort if a field is missing from the restart file in a branch - run (see above for details) -M components/clm/src/utils/restUtilMod.F90.in - -========= Cover accumulMod with unit tests -M components/clm/src/main/test/CMakeLists.txt - -========= Changes needed so that code under test can call get_proc_bounds -M components/clm/src/unit_test_shr/unittestSubgridMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_17_r266 -Originator(s): sacks (Bill Sacks) -Date: Mon Nov 27 19:43:39 MST 2017 -One-line Summary: Avoid negative snow densities - -Purpose of changes ------------------- - -For very low temperatures, fresh snow densities were negative. This was -only happening at extremely low temperatures (below -100 deg C), but -caused snow balance errors when it occurred. - -In exploring the LoTmpDnsSlater2017 parameterization in -NewSnowBulkDensity, I came away with the following thoughts: - - It seems like there should be a limit on the temperature-dependent - bifall value. I extracted this function into python and played with - it for a few minutes: - - else if (new_snow_density == LoTmpDnsSlater2017) then - ! Andrew Slater: A temp of about -15C gives the nicest - ! "blower" powder, but as you get colder the flake size decreases so - ! density goes up. e.g. the smaller snow crystals from the Arctic and Antarctic - ! winters - bifall(c) = -(50._r8/15._r8 + 0.0333_r8*15_r8)*(forc_t(c)-tfrz) - 0.0333_r8*(forc_t(c)-tfrz)**2 - end if - - It looks like the intention is to have snow densities that increase - with decreasing temperature (below -15 C), but the effect of this - parabolic function is to have densities start coming back down as - temperature decreases too low (below about -58 C). My sense is that - we should do one of the following in the above block of code: - - (1) Limit bifall(c) to be no less than 50... my read of this code is - that temperature-dependent bifall is never meant to go below 50. - - (2) For this cold-temperature-based bifall, use an "effective" forc_t - that is never colder than about -58 C – or the point at which this - function begins to decrease with further-decreasing temperatures. (We - could determine the exact temperature at which this function turns - over... -58 C is just an approximation.) I'm not positive that this - is what's intended, but my read of the comment suggests that - densities were never intended to start decreasing with - further-cooling temperatures. - -See comments and figures in -http://bugs.cgd.ucar.edu/show_bug.cgi?id=2536 for more details. - -Leo van Kampenhout and Jan Lenaerts support limitation option 2, which -is my preference as well. Thus, this tag implements that limitation. - -This change changes answers for (downscaled) atmospheric forcing -temperatures below -57.55 deg C. These very low temperatures are rare, -but they do sometimes occur, both in coupled runs and in offline runs. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2536: Snow balance error - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Leo van Kampenhout - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi --- ok - yellowstone_gnu --- ok - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests pass, answers change as expected - -CLM tag used for the baseline comparisons: clm4_5_17_r265 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff/same climate - - Many (but not all) tests show answer changes. Answers should only - change for (downscaled) forcing temperatures below -57.55 deg C. I - spot-checked one test with answer changes - (SMS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default). I - checked H2OSNO and FSH in this test, in the last day's h0 file; - these fields differ (relative to the baseline) in only one - gridcell. TBOT was about -55 deg C in the daily average of the - last day, so it seems reasonable that this forcing temperature was - below -57.55 deg C at some point in the 3-day simulation. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf - -=============================================================== -=============================================================== -Tag name: clm4_5_17_r265 -Originator(s): erik (Erik Kluzek) -Date: Sat Nov 18 12:40:20 MST 2017 -One-line Summary: Update the clm50 parameter file for better behavior with prognostic crop, and fix a bug in clm50 urban model - -Purpose of changes ------------------- - -Update a few parameters to tweak prognostic crop harvest yields, adjusting FUN costs, and changing C4 crops and -wheat by Keith Oleson, Dave Lawrence, and Danica Lombardozzi. Danica had this to say: - Overall, the wheat parameters work well (give us correct Fertilized - Unfertilized behavior - and reasonable crop yields), but the C4 crop parameters are less satisfying. The 2A parameter - changes still have trouble with the fertilized - unfertilized behavior in some regions and - lower yields, but seems to be the best combined set of behaviors since there seems to be - a direct tradeoff between the fertilized behavior and crop yields - -Also a fix to urban initialization of rootfr for pervious road. It had used a magic number to assuming nlevsoi -was 10. Now we divide by the actual nlevsoi. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2434 - 2434 -- urban assumed to have 10 soil layers - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): clm50 params file - -Changes to the datasets (e.g., parameter, surface or initial files): clm50 parameter file - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self,oleson - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_17_r264 - - -Answer changes --------------- - -Changes answers relative to baseline: YES, for CLM50 - - Summarize any changes to answers, i.e., - - what code configurations: all clm50 (except non-urban and non-crop) - - what platforms/compilers: all - - nature of change: crop behavior changes, urban working better - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- new params file -M components/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 ----- Divide by nlevsoi - rather than assume nlevsoi is 10 with a magic number. - -=============================================================== -=============================================================== -Tag name: clm4_5_17_r264 -Originator(s): erik (Erik Kluzek) -Date: Thu Nov 16 13:35:59 MST 2017 -One-line Summary: Changes from Dave Lawrenece on resetting soil carbon for spinup - -Purpose of changes ------------------- - -Changes from Dave Lawrence so that total vegetation carbon (totvegc) is used for resetting soil carbon -stocks during the AD spinup exit (to determine if you should reset both carbon and nitrogen). Also read -in totvegc for C13, and C14. These are then passed down into soilbiogechemistry nitrogenstate and carbonstate -restart to determine if the decomposition pools should be reset. The resetting is only done over non-crop -vegetation (ignoring both prognostic and generic crop types) and is only done on the exit_spinup phase -going out of accellerated decomposition mode. - -Fix a couple small issues that in principle could change answers, but we didn't see answer changes in testing. -There was an error in how rootfr was initialized if it wasn't on the restart file. Made sure the crop patch -level restart variables are read after the enter_spinup code. - -Bugs fixed or introduced ------------------------- - 2406 -- Crop patch-level restart variables read after enter_spinup code - 2426 -- Error in rootfr for SoilStateType restart - 2447 -- dayl_factor not just exactly zero, but small - -Bugs fixed (include bugzilla ID): - -Known bugs introduced in this tag (include bugzilla ID): Following found - 2534 -- rootfr_road_perv calculation now incorrect for CLM50 - 2533 -- c13/c14 isotope time-series is awkward for 1850 control (convert to streams file) - 2531 -- FATES doesn't call SoilBiogeochemCompetitionInit - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - SetNCrit in SoilBiogeochemNitrogenStateType.F90, should be SetCCrit, because totvegc is - used rather than totvegn. - SoilBiogeochemPrecisionControlInit was added as a new method that could be extended to - set ncrit and ccrit from namelist, or to set them from the settings for CNPrecisionControl - that are read in by namelist - -Changes to tests or testing: None - -Code reviewed by: self,dlawren - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular (without testing on cheyenne when tag was made) - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- Ran on yellowstone OK - cheyenne_gnu ------ Ran on yellowstone OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_17_r263 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, but only for spinup! - - Summarize any changes to answers, i.e., - - what code configurations: Only during spinup (at exit_spinup stage) - - what platforms/compilers: All - - nature of change: minor for spinup - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - M components/clm/src/biogeochem/CNVegCarbonStateType.F90 --- Add totvegc_col (and cor c13/c14) to restart - M components/clm/src/biogeochem/CNVegetationFacade.F90 ----- Add get_totvegc_col to get the column level totvegc - M components/clm/src/main/clm_initializeMod.F90 ------------ Remove use of CNDriverInit, not needed - M components/clm/src/main/clm_instMod.F90 ------------------ Add call to SoilBiogeochemCompetitionInit - do vegetation restart before soil bgc restart, pass totvegc down to soilbiogeochem_carbonstate restart (and nitrogenstate) - M components/clm/src/biogeophys/PhotosynthesisMod.F90 ------ Fix bug 2447 checking for small dayl_factor and not just exactly zero - M components/clm/src/biogeophys/SoilStateType.F90 ---------- Fix bug 2446 initialize rootfr only if rootfr not read in - M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 ---- Add SetNCrit to set new module variable ncrit - pass totvegc_col into restart, if it is lower than ncrit (and not crop) reset decomposition pools to zero - M components/clm/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 -- Add SoilBiogeochemPrecisionControlInit, to set - ncrit and ccrit now module variables and pass them down to carbonstate and nitrogenstate - M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 ------ Add SetCCrit to set new module variable ccrit - pass totvegc_col into restart, if it is lower than ccrit (and not crop) reset decomposition pools to zero - save restart_file_spinup_state and read it in with C12 - -=============================================================== -=============================================================== -Tag name: clm4_5_17_r263 -Originator(s): erik (Erik Kluzek) -Date: Wed Nov 8 15:36:41 MST 2017 -One-line Summary: Drydep vel. for SO2 doubled, influence of organic mater in soil calmed, max daylength not hardwired to present day - -Purpose of changes ------------------- - -Keep the hydraulic conductivity for organic soil higher than it is for mineral soil. This was found to be an issue and fixed by -Sean Swenson, Dave Lawrence, and Keith Oleson. Double dry deposition velocity for SO2 (Jean-Francois Lamaruque) for both clm4_5 -and clm5_0. Fix bug for value of NACTIVE at first time-step. Partial fix so that max daylengh isn't hardwired to present day at least -at initialization (see caveat below). Move the sample files for the mkprocdata_map tool (for mapping between unstructured grids -and regular lat lon grids) out of CLM and into $CSMDATA. Update the c13/c14 timeseries files to the 2.0 version as per Keith Lindsay. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2530 -- organic soil influence varies wildly - 2304 -- NACTIVE at first time step - 1843 -- Max daylength now uses orbital parameters at initialization rather than hardwired to present day (partial) - -Known bugs introduced in this tag: - 2529 -- SSP case that runs on cheyenne fails on hobart - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): c13/c14 time-series files - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Max daylength will still be wrong in cases where variable_years is used, where the orbit - changes after initializaiton. It'll start out correct and begin to diverge each year. - Since, this feature is untested it's not worth going through the additional changes to - correct it during the run. - - At the time the tag was made, cheyenne was down, so there are six tests that weren't confirmed to pass: - ERS_D_Ld3.f19_f19_mg16.IHistClm40SpCruGs.cheyenne_intel.clm-40default - ERS_Ly5_P60x1.f10_f10_musgs.IHistClm50BgcCrop.cheyenne_intel.clm-cropMonthOutput - SMS_D_Ld5.f10_f10_musgs.I2000Clm50Fates.cheyenne_intel.clm-fates - SMS_D_Ly2.1x1_numaIA.IHistClm50BgcCropGs.cheyenne_intel.clm-ciso_bombspike1963 - SMS_Ld1.f19_f19_mg16.IHistClm40SpCruGs.cheyenne_intel.clm-40default - SMS_Ld1.f19_g17.I2000Clm50Vic.cheyenne_intel.clm-default - -Changes to tests or testing: tools testing modified to point to files in CSMDATA - -Code reviewed by: self,lamar,oleson,sacks,dlawren - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_16_r262 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5 and clm5_0 - - what platforms/compilers: all - - nature of change: changes answers with bug fixes in a significant way - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: oleson/csm/clm50_r243_1deg_GSWP3V2_cropopt_nsc_hksat_hist - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: - - Remove sample files, move to CSMDATA, remove sample namelist - D components/clm/tools/mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c170430.nc - D components/clm/tools/mkprocdata_map/map_ne30np4_nomask_to_fv1.9x2.5_nomask_aave_da_c121107.nc - D components/clm/tools/mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c170430.nc - D components/clm/tools/mkprocdata_map/mkprocdata_map_in - -List all files added and what they do: - - A components/clm/tools/mkprocdata_map/README.filedescriptions -- Describe the files in this directory - -List all existing files that have been modified, and describe the changes: - - M components/clm/test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 - Point to files in CSMDATA rather than mkprocdata_map dir. - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- Point to new v2.0 of the c13/c14 timeseries files - - M components/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 -- Fix bug 2530 for organic mater influence in soil - M components/clm/src/biogeochem/DryDepVelocity.F90 ------------- Double SO2 dry deposition rate - M components/clm/src/biogeochem/CNFUNMod.F90 ------------------- Bug, 2304 for NACTIVE on history for first time-step - M components/clm/src/biogeochem/ch4Mod.F90 --------------------- Bug, 2528, floating overflow for methane (doesn't change answers) - M components/clm/src/main/clm_initializeMod.F90 ---------------- Bug, 1843, max daylength no longer hardwired to present day at initialization - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r262 -Originator(s): sacks (Bill Sacks) -Date: Fri Oct 27 10:17:54 MDT 2017 -One-line Summary: Rename atm2lnd history fields for downscaled fields, properly turn on vic for clm45, and other minor fixes - -Purpose of changes ------------------- - -(1) Rename atm2lnd history fields for downscaled fields. The downscaled - version is now the default. Non-downscaled history fields are now - noted explicitly with a "_FROM_ATM" suffix. A detailed list of - changes is given below. - -(2) Properly turn on VIC for CLM45 compsets (fixes bug 2465) - -(3) Use correct PE layouts for CISM1 - -(4) Remove CWDC_HR diagnostic field, which was always 0 (fixes bug 2502) - -(5) Turn on U10_DUST diagnostic field by default (fixes bug 2246) - -(6) Fix documentation of some variables - -Detailed list of changes related to (1): - - Rain and snow: - - Old: - - RAIN: "atmospheric rain" - NOT downscaled - - Rainf: "atmospheric rain" - NOT downscaled - - SNOW: "atmospheric snow" - NOT downscaled - - RAIN_REPARTITIONED: "atmospheric rain, after rain/snow repartitioning based on temperature" - DOWNSCALED - - SNOW_REPARTITIONED: "atmospheric snow, after rain/snow repartitioning based on temperature" - DOWNSCALED - - New: - - RAIN: "atmospheric rain, after rain/snow repartitioning based on temperature" - DOWNSCALED - - Rainf: "atmospheric rain, after rain/snow repartitioning based on temperature" - DOWNSCALED - - SNOW: "atmospheric snow, after rain/snow repartitioning based on temperature" - DOWNSCALED - - RAIN_FROM_ATM: "atmospheric rain received from atmosphere (pre-repartitioning)" - NOT downscaled - - SNOW_FROM_ATM: "atmospheric snow received from atmosphere (pre-repartitioning)" - NOT downscaled - - Air temperature: - - Old: - - TBOT: "atmospheric air temperature" - NOT downscaled - - Tair: "atmospheric air temperature" - NOT downscaled - - Tair_downscaled: "atmospheric air temperature downscaled to columns" - DOWNSCALED - - New: - - TBOT: "atmospheric air temperature (downscaled to columns in glacier regions)" - DOWNSCALED - - Tair: "atmospheric air temperature (downscaled to columns in glacier regions)" - DOWNSCALED - - Tair_from_atm: "atmospheric air temperature received from atmosphere (pre-downscaling)" - NOT downscaled - - Atmospheric pressure: - - Old: - - PBOT: "atmospheric pressure" - NOT downscaled - - Psurf: "surface pressure" - NOT downscaled - - New: - - PBOT: "atmospheric pressure at surface (downscaled to columns in glacier regions)" - DOWNSCALED - - Psurf: "atmospheric pressure at surface (downscaled to columns in glacier regions)" - DOWNSCALED - - Atmospheric longwave radiation: - - Old: - - FLDS: "atmospheric longwave radiation" - NOT downscaled - - LWdown: "atmospheric longwave radiation" - NOT downscaled - - New: - - FLDS: "atmospheric longwave radiation (downscaled to columns in glacier regions)" - DOWNSCALED - - LWdown: "atmospheric longwave radiation (downscaled to columns in glacier regions)" - DOWNSCALED - - Potential temperature: - - Old: - - THBOT: "atmospheric air potential temperature" - NOT downscaled - - New - - THBOT: "atmospheric air potential temperature (downscaled to columns in glacier regions)" - DOWNSCALED - - Specific humidity: - - Old: - - QBOT: "atmospheric specific humidity" - NOT downscaled - - Qair: "atmospheric specific humidity" - NOT downscaled - - New: - - QBOT: "atmospheric specific humidity (downscaled to columns in glacier regions)" - DOWNSCALED - - Qair: "atmospheric specific humidity (downscaled to columns in glacier regions)" - DOWNSCALED - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2192: wrong units in comment for variables qflx_ev_snow, qflx_ev_soil, - qflx_ev_h2osfc -- 2246: Turn on U10_DUST history field variable by default -- 2363: inline documentation is wrong in SoilTemperatureMod.F90 -- 2401: Need to put in an "override" for PE layouts for CISM1 -- 2465: ICLM45VIC compset doesn't actually turn VIC on -- 2502: CWDC_HR is identically zero -- 2503: Wrong units for FAREA_BURNED - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Changed meaning of some atm2lnd history fields: see above - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self; Sean Swenson did a conceptual review of the -changes in atm2lnd diagnostic fields - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi --- ok - yellowstone_gnu --- ok - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests pass, answers change for some atm2lnd diagnostic - fields as noted below - -CLM tag used for the baseline comparisons: clm4_5_16_r261 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - For most configurations: Changes diagnostic fields only (see - below for list) - - Changes CLM45 compsets with VIC: actually turns on VIC (there - are no CLM45 tests with VIC in the test suite) - - Changes the following fields: FLDS, PBOT, QBOT, RAIN, SNOW, TBOT, - THBOT: These now give downscaled versions of these fields. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Rename atm2lnd history fields for downscaled fields -M components/clm/src/main/atm2lndType.F90 - -========= Properly turn on VIC for CLM45 compsets -M components/clm/cime_config/config_component.xml - -========= Use correct PE layouts for cism1 -M components/clm/cime_config/config_pes.xml - -========= Remove CWDC_HR diagnostic field -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 - -========= Turn on U10_DUST by default -M components/clm/src/biogeophys/FrictionVelocityMod.F90 - -========= Fix various documentation -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/src/biogeophys/BareGroundFluxesMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/biogeophys/SoilFluxesMod.F90 -M components/clm/src/biogeophys/CanopyFluxesMod.F90 -M components/clm/src/biogeophys/SoilHydrologyMod.F90 -M components/clm/src/biogeochem/CNVegStateType.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r261 -Originator(s): sacks (Bill Sacks) -Date: Wed Oct 25 07:37:24 MDT 2017 -One-line Summary: Add option to reset snow over glacier columns - -Purpose of changes ------------------- - -We have had an option to reset snow over non-glacier columns, using the -reset_snow namelist variable. This is useful when transitioning from a -spinup with one set of atmospheric forcings to a run with substantially -different atmospheric forcings. We originally did not provide an option -to reset snow over glacier columns, because we couldn't find a -satisfactory way to determine which glacier columns should and should -not be reset. However, members of the LIWG have found that it's hard to -analyze some test runs without this option. - -This tag, therefore, provides an option to reset snow over glacier -columns, using a new namelist flag reset_snow_glc. You can optionally -provide an elevation threshold for this resetting: By setting -reset_snow_glc_ela to some elevation (in meters), only glacier columns -below this elevation get their snow packs reset. Note that you run the -risk of baking in answers with this (how much of the resulting spatial -patterns are due to your choice of where to reset snow?), but this can -still be useful in some cases. In general, this is meant for testing, -and not for "real" scientific production runs. - -Original changes were from Leo van Kampenhout, with some refactoring by -Bill Sacks. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): -- 2525: test_build_namelist.pl fails in clm4_5_16_r260 - (this bug existed prior to this tag, but was first discovered here) - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variables: - - reset_snow_glc: logical; if set to .true., resets the snow pack over - glacier columns - - reset_snow_glc_ela: elevation threshold for resetting snow pack over - glacier columns - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- reseedresetsnow testmod turns on snow resetting over glacier points, - and so changes answers. It uses the reset_snow_glc_ela threshold that - Leo has been using. - -Code reviewed by: self, Leo van Kampenhout - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok (run on yellowstone) - Tests in build-namelist_test.pl pass but change answers as expected - due to new namelist options. - - NOTE: prove test_build_namelist.pl fails (see bug 2525) - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi --- ok - yellowstone_gnu --- ok - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests pass, NLCOMP failures as expected. Also, expected - baseline failure: - ERS_D.f19_g17.I1850Clm50BgcCrop.cheyenne_intel.clm-reseedresetsnow - - However, there were also baseline failures in these tests, due to - problems with r260: - - (1) - - SMS_Ld5.f19_g17.IHistClm50Bgc.cheyenne_intel.clm-decStart - SMS_Ld5.f19_g17.IHistClm50Bgc.yellowstone_pgi.clm-decStart - SMS_Ld5.f19_g17.IHistClm50Bgc.yellowstone_intel.clm-decStart - - These are due to problems with the baseline, in terms of which cism - history files are present. Baseline comparisons failed in the same - way when using out-of-the-box r260. The current code seems correct - in this respect, so this is just a problem with the baseline - directories. - - (2) - - SMS_D_Ly2.1x1_brazil.IHistClm50BgcQianGs.cheyenne_intel.clm-ciso_bombspike1963 - - Differences in C14 history fields. Baseline comparisons failed in - the same way when using out-of-the-box r260. I can't tell if the - baselines are correct or the trunk code is correct. I have asked - Erik to look into this. - -CLM tag used for the baseline comparisons: clm4_5_16_r260 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Only tests with reseedresetsnow testmod - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - new climate for tests with this testmod - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= Unit tests of new changes -M components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_SnowCappingExcess.pf - -========= Pass down new arguments -M components/clm/src/main/clm_driver.F90 -M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 - -========= New namelist variables -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm - -========= Changes to reseedresetsnow testmod to turn on the new option -M components/clm/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/user_nl_clm - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r260 -Originator(s): erik (Erik Kluzek) -Date: Tue Oct 24 15:59:41 MDT 2017 -One-line Summary: Update paramater file for CLM50 as well as fates, fix a few issues - -Purpose of changes ------------------- - -Update the parameter file for CLM5.0, changing: ekc_active,ekn_active,kn_nonmyc,psi50, and stem_leaf. Dave Lawrence, -Keith Oleson, Will Wieder, and Rosie Fischer were involved in changing these parameters to increase survivability of -BDT Tropical and NDT Boreal and to slightly decrease the over-productivity of BDS boreal. - -The version of FATES used was updated to one with the same API, but updated science (science_1.3.0 api_1.0.0). - -There were a couple issues fixed as well. PTCLM was updated to fix a few issues and also allow us to test running -with an updated PTCLM user-mods-directory. So the US-UMB testing was updated to point to a freshly created directory. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2524 -- Run with decStart tests - 2523 -- Run with cnonly - 2522 -- PTCLMmkdata doesn't handle crop on or off well in latest CLM45/CLM50 - 2521 -- Add warning for when PTCLMmkdata sets MPILIB to mpi-serial by default - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - -crop option becomes a toggle for CLM_BLDNML_OPTS (so -no-crop is valid as well) - Same setup for mksurfdata.pl was introduced as well (and for PTCLMmkdata) - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New parameter file for CLM5.0 - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: USUMB tests updated, tests for PTCLM updated - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (118 compare tests fail) - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK (one expected fail) - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_16_r259 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes for CLM50 and/or with fates - - Summarize any changes to answers, i.e., - - what code configurations: all configurations with CLM50 or CLM45 with Fates - - what platforms/compilers: All - - nature of change: Improvements in survivability of certain trees - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): PTCLM - - PTCLM to PTCLM2_171024b - -List all files eliminated: None - -List all files added and what they do: Missing file from previous tag - - A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart/user_nl_cism - -List all existing files that have been modified, and describe the changes: - - M components/clm/test/tools/TSMscript_tools.sh --------------------- Update PTCLM version of mapping data being pointed to - M components/clm/test/tools/nl_files/mksrfdt_10x15_1850 ------------ Change -no_crop option to -no-crop - M components/clm/test/tools/nl_files/mksrfdt_1x1_vancouverCAN_2000 - Change -no_crop option to -no-crop - M components/clm/tools/mksurfdata_map/mksurfdata.pl ---------------- Change -no_crop option to -no-crop toggle - M components/clm/bld/CLMBuildNamelist.pm --------------------------- Change -crop option to a toggle (so -no-crop is valid) - Fix bug 2523 by setting bgc_spinup - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Update parameter file for CLM50 - M components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm ---- Point to c171024 version of PTCLM data - M components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/shell_commands - Point to c171024 version of PTCLM data - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r259 -Originator(s): erik (Erik Kluzek) -Date: Tue Oct 17 10:39:36 MDT 2017 -One-line Summary: Update to latest cime from cesm2_0_beta07 and config_components version 3 - -Purpose of changes ------------------- - -Update CLM to use version 3 for config_components.xml which has additional error checking of compset names. Also -update it for mosart, cism and rtm. And cime is updated to the version used in cesm2_0_beta07. There are a few -new features brought in with the latest cime that are described below. CLM now requires one and only one modifier -for what type it is in the compset name (i.e. only one "%" as in CLM45%BGC or CLM50%SP). Will now abort when -CLM build-namelist encounters a warning (after printing information on all warnings). To ignore the warnings -and continue add the new "-ignore_warnings" to CLM_BLDNML_OPTS. "-irrig" is now an option to CLM_BLDNML_OPTS -only for clm4_0, set "irrigate" namelist item in your user_nl_clm file for clm4_5 or clm5_0. By default build-namelist -sets irrigate to true for transient or present-day configurations if crop is on and clm5_0 (unless DV on). Get PTCLMmkdata fully -converted over to cheyenne, and create a new set of files for testing it's ability to create cases. Checking for -.true. or .false. in CLM build-namelist is now more robust and allows for "F" or "T" as newer FORTRAN versions do. - - -Fix several bugs as described below. PTCLM and CLM tools were both verified to work and pass testing. -The PE layout for f10 on hobart was changed to a single-node so that it would compare exactly to previous versions. -Fix a bug for NCK tests in RTM and MOSART. Get mksurfdata_map working correctly for f05. Error message when -you set finidat=' ' is more clear on what to do. You can also now do a cold-start for a hybrid case prints a warning), -but not allowed on a branch case. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2519 -- Trouble setting use_aereoxid_prog=.false./ - 2515 -- Setting finidat=' ' gives cryptic error message - 2510 -- Mapping files from the 1km grid can only be created on geyser - 2509 -- Bad mapping files for f05 resolution - 2504 -- hybrid/branch cases don't allow CLM_FORCE_COLDSTART to be on - 2494 -- MOSART test NLCOMP fails due to duplicate mosart_inparam in user_nl_mosart - 2477 -- Multiinstance mosart with REFCASE does not initialize - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - This includes an update to cime, so some behavior is a little different than before (see section below) - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - CLM now allows one and only one modifier for the type of configuration in the compset name - (i.e. CLM50%BGC or CLM45%SP (only one "%" modifier is allowed) ). "-irrig" is now only allowed as an option - to CLM_BLDNML_OPTS for clm4_0, for clm4_5/clm5_0 the handling of irrigate is handled inside CLM build-namelist. - Remove some no longer needed forcing definitions for compsets (the year range at the beginning of the compset name). - Now abort on build-namelist warnings (but adding "-ignore_warnings" option to CLM_BLDNML_OPTS allow it to run without it). - Remove compset forcings that aren't being used: 5505, C2R6, C2R8, C2R4, C1, GEOS (start of long compset names) - -Changes to CIME user interface: -- Eleminate --user-compset. Clean up caseroot directory upon failed creation. -- Check coupler fields for nan. -- New xml variable, readmode, -- xmlquery --group has been changed go xmlquery --get-group -- New case.qstatus tool. -- Autodeletion of broken case dirs. -- Add --mail-user and --mail-type to case.submit. -- Remove --user-compset from create_newcase, allow compset longname in testname argument to create_test. -- New argument to create_clone (--user-mods-dir to also point to user-mods directory that will be used) - -Changes made to namelist defaults (e.g., changed parameter values): - Correct SCRIP grid file for f05 and add mapping files for them - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: - clm-decStarts cism history is a bit different (shown as changing answers) - Allow longname in tests -- Add --pesfile option to create_test. -- New --timeout flag for wait_for_tests -- CLM now needs to define its own LII and SSP tests (they already were put in place, now it's actually using them) - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - (216 compare tests fail comparing to clm4_5_16_r258 tag) - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_16_r258 - - -Answer changes --------------- - -Changes answers relative to baseline: No (bit for bit) - - clm/decStart tests were changed though - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime, cism, rtm, mosart - cime to cime5.4.0-alpha.03 - cism to cism2_1_40 - rtm to rtm1_0_63 - mosart to mosart1_0_28 - -List all files eliminated: Remove -irrig option for clm4_5/clm5_0 tests - - D components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/shell_commands - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/shell_commands - D components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/shell_commands - -List all files added and what they do: - - A components/clm/bld/namelist_files/LogMessages.pm - Log message, warning, exit and abort handling for perl - -List all existing files that have been modified, and describe the changes: - - Update to new PTCLM directory for testing PTCLM cases - M components/clm/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 -- Change map_gdate - M components/clm/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 - Change map_gdate - M components/clm/test/tools/nl_files/PTCLM_USUMB_clm4_5 --------- Change map_gdate - M components/clm/test/tools/TSMscript_tools.sh -- Change user_mods directory used for PTCLM case - - M components/clm/tools/mkmapdata/regridbatch.sh -- Get working on cheyenne - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Working f05 SCRIP grid file - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml ----- Remove irrig - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ------- Change irrig to irrigate - add mapping files for f05 - - Set irrigate for use-cases, .true. for use_crop=T, use_cndv=F and not 1850 - M components/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - M components/clm/bld/namelist_files/use_cases/stdurbpt_pd.xml - M components/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - M components/clm/bld/namelist_files/use_cases/1850_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - M components/clm/bld/namelist_files/use_cases/20thC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/glacierMEC_pd.xml - M components/clm/bld/namelist_files/use_cases/2000_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - - M components/clm/bld/CLMBuildNamelist.pm -- moving warnings, logging, exit, and fatal_error to LogMessages - Add -ignore_warnings, -irrig is now only for clm4_0, pass $opts to add_default, not just {test}, - use value_is_true for all logical evalutions (extend it to all T or F), warnings will all be - written out, and abort at the end (unless -ignore_warnings is used) - don't die if clm_usr_name is set and didn't find user datasets, add final_exit on completion - M components/clm/bld/unit_testers/build-namelist_test.pl - Add tests for -ignore_warnings option - handle -irrig for clm4_5 - - M components/clm/cime_config/config_compsets.xml -- Add I2000Clm50BgcCruGs compset - M components/clm/cime_config/config_pes.xml ------- Set PE count for f10 on hobart to single node - M components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm --------------- turn irrigate on - M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm - turn irrigate on - M components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm ------- turn irrigate on - M components/clm/cime_config/testdefs/testlist_clm.xml - 1x1_camdenNJ test with stub-GLC: I2000Clm50BgcCruGs - M components/clm/cime_config/config_component.xml --- Update to config_component version 3. CLM must have 1 and exactly - one modifier, move setting of -irrig for 2000 and transient compsets to inside of CLM build-namelist - remove some no longer needed forcing definitions for compsets - M components/clm/cime_config/buildnml - Print warning if branch and coldstart, allow colstart with hybrid - Add warning if doing a coldstart - - M components/clm/src/CMakeLists.txt - Add additional subdirectory for unit testing (from Bill Sacks) - - M components/clm/src/main/controlMod.F90 - Allow use_crop=F and irrigate - - M parse_cime.cs.status - Seperate out differences when baselines don't exist - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r258 -Originator(s): erik (Erik Kluzek) -Date: Fri Oct 6 22:25:29 MDT 2017 -One-line Summary: Revert change to fire, set n_melt_glcmec=10, update mosart to version that doesn't accumulate water in short rivers - -Purpose of changes ------------------- - -Revert the changes to fire that came in clm4_5_16_r257. Add some notes that clarify that the code as is, is correct. -Set n_melt_glcmec=10.0 for clm5.0 (This should have happened in the fresh snow grain size change in clm4_5_16_r256). -Update mosart to a version that doesn't accumulate water in short rivers. This is done by explicitly making sure river length -isn't smaller than a minimum value. - -Bugs fixed or introduced ------------------------- - - 2516 -- Mistaken bug for fire mortality calculations for some - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): - Changed n_melt_glcmec to 10.0d00 for clm5_0 (same as clm4_5, but double precision) - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): Some of the - fire mortality code is confusing, we added some notes to clarify that's it's correct - -Changes to tests or testing: None - -Code reviewed by: self, dlawren, oleson, swenson - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (231 compare tests fail) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_16_r257 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 and/or with mosart - - what platforms/compilers: all - - nature of change: small - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): mosart - mosart to rlen_min_n01_mosart1_0_26 (will bring trunk version of mosart in an upcoming tag) - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - set -M components/clm/src/biogeochem/CNFireBaseMod.F90 --- Revert fire changes (bug 2516) add comments - use fm_droot as it's used to represent fraction of transport from livestem/livecroot to litter - or to represent the fraction of plant-tissue mortality for deadstem/deadcroot -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 - Revert fire changes - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r257 -Originator(s): erik (Erik Kluzek) -Date: Fri Sep 29 10:17:36 MDT 2017 -One-line Summary: Fix two bugs found by Hui Tang, one for Carbon isotopes and one in the fire model - -Purpose of changes ------------------- - -This is a fix for two bugs found by Hui Tang. One is for Carbon isotopes where a fix that came in for -clm4_5_11_r188, used leafc for too many of the isotope flux calculation calls. This changes it so the -correct terms are used for the particular flux. - -The other fix is in the fire model where fire emissions were using the wrong fire related -mortality term for dead stem and should have been using a different type. Now it matches the -flux type, as well as the term used in combustion completness for the particular fire emission. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2517 -- Bug in CNFireFluxes for some fire fluxes - 2516 -- Leafc wrongly used in too many CIsoFluxCalc calls. - -Known bugs introduced in this tag (include bugzilla ID): (new one found) - 2518 -- --- warnings from CLM build-namelist don't get sent out of preview_namelist - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self,oleson,dlawren,Hui Tang - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm4_5_16_r256 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 with CN and fire on, and also for carbon isotopes - - what platforms/compilers: all - - nature of change: very small impact - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: /oleson/clm50_r255_fireiso_1deg_GSWP3V1_1850 - - URL for LMWG diagnostics output used to validate new climate: -http://webext.cgd.ucar.edu/I1850/clm50_r255_fireiso_1deg_GSWP3V1_1850/lnd/clm50_r255_fireiso_1deg_GSWP3V1_1850_21_50-clm50_r255_coniso_1deg_GSWP3V1_1850_21_50/setsIndex.html - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeochem/CNFireBaseMod.F90 --- Some fire emissions were using - fire related mortality for dead stem and should have been using a different type - it should match the one used in the combustion completeness factor and the main - type - M components/clm/src/biogeochem/CNFireLi2014Mod.F90 - Same change as above - - M components/clm/src/biogeochem/CNCIsoFluxMod.F90 -- In the fix for bug 2116 that came - in with clm4_5_11_r188, leafc was used in too many CNCIsoFluxCalc calls this corrects - it to use the correct term - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r256 -Originator(s): erik (Erik Kluzek) -Date: Wed Sep 20 15:42:17 MDT 2017 -One-line Summary: Fresh snow grain radius is temperature dependent - -Purpose of changes ------------------- - -Changes from Leo VanKampenhout to have fresh snow grain size a function of air temperature for CLM50. -Behavior is the same as before for CLM45 with fresh snow grain size a fixed parameter. For CLM50 -it's that same value (54.526) less than -30C and linear with T up to 204.526 at 0C, and 204.526 for -temperatures greater than 0C. - - -Bugs fixed or introduced ------------------------- - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - Added namelist item: fresh_snw_rds_max - -Changes made to namelist defaults (e.g., changed parameter values): - fresh_snw_rds_max is snw_rds_min for clm4_5 - fresh_snw_rds_max is 204.526 for clm5_0 - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self,L.vanKampenhout@uu.nl - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (343 compare tests fail since namelists change) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu - OK - cheyenne_intel - OK - cheyenne_gnu - OK - hobart_nag - OK - hobart_pgi - PASS - hobart_intel - PASS - -CLM tag used for the baseline comparisons: clm4_5_16_r255 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, for clm5_0 - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm5_0 - - what platforms/compilers: All - - nature of change: more snow melt at expense of ice melt - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: oleson clm50_r251_SNOWGRAIN_2000 - - URL for LMWG diagnostics output used to validate new climate: - -http://webext.cgd.ucar.edu/B1850/b.e20.B1850.f09_g17.pi_control.all.196/lnd/b.e20.B1850.f09_g17.pi_control.all.196.8_27-b.e20.B1850.f09_g17.pi_control.all.195.8_27/set1/set1.html - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeophys/SnowSnicarMod.F90 -- Pass atm2lnd_inst in, make sure snw_rds isn't less than the min parameter - create a function for setting FreshSnowRadius, dependent on atm2lnd_inst (for air temperature), the function sets to min - parameter if fresh_snw_rds_max is same as min (clm45), or to min at less than -30C linear between fresh_snw_rds_max and min parameter - up to 0C, and then at fresh_snw_rds_max value for clm50. - M components/clm/src/biogeophys/AerosolMod.F90 ----- Add InitReadNML and fresh_snw_rds_max - M components/clm/src/main/clm_driver.F90 ----------- Pass atm2lnd_inst down to SnowAgeGrain - M components/clm/src/main/clm_instMod.F90 ---------- Pass NLFilename to aerosol_inst%Init - - M components/clm/bld/CLMBuildNamelist.pm - Set fresh_snw_rds_max, and add aerosol namelist - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Set fresh_snw_rds_max for clm45 and clm50 - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Define fresh_snw_rds_max - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r255 -Originator(s): erik (Erik Kluzek) -Date: Mon Sep 18 21:21:29 MDT 2017 -One-line Summary: Changes to crop and enabling Carbon isotopes for crop and some miscellaneous small changes - -Purpose of changes ------------------- - -Changes for crop on as well as enabling carbon isotopes when crop is on. Fix some small answer changing issues. -Also bring in new timeseries datasets for C14 as well as now C13. The C14 dataset has hardwired latitude sectors -it uses (so previous file can NOT be used). Properly handle and update C13/C14 variables when crop is on. -Handle CIsoFluxCalc calls for a list of crop specific fields. Add cropseedc_deficit, to storvegc as well as totveg. -Send livestemc to litter for prognostic crop. Ignore downreg for carbon isotopes in Fractionation subroutine. -For dynamic roots, use rooting values on parameter dataset which is set to values from PFT=1. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2508 -- Incorrect landuse.timeseries datasets for f09 and hcru for rcp=8.5 in r254 - 2489 -- Set c/nnegcrit for clm45/clm50 (10X higher for clm45 than clm50) - 2412 -- Initialize rootfr to PFT==1 value for dynamic roots -- update params files - 2396 -- make subtraction the default behavior for clm4_5. - 2316 -- update carbon isotopes same as C12: CNVegCarbonStateType.F90 - 2211 -- Fix time used for Ciso time series - -Known bugs introduced in this tag (include bugzilla ID): - 2511 -- Overflow with Carbon isotopes - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - Change to restarts when c-isotopes on - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - New namelist items: use_c13_timeseries, atm_c13_filename - New history vars: C13_GRAINC, C13_CROPSEEDC_DEFICIT, C14_GRAINC, C14_CROPSEEDC_DEFICIT - -Changes made to namelist defaults (e.g., changed parameter values): - Set cnegcrit/nnegcrit for CLM45/CLM50 - -Changes to the datasets (e.g., parameter, surface or initial files): - New C13 and C14 timeseries files - New params files, but only answer changing part is for dynamic roots - (setup bare-soil on file to match what's used for PFT=1) - Bring in correct datasets for rcp8.5 for f09 and hcru - 1x1_numaIA 1850 and 1850-2000 transient files - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - The C13/C14 timeseries should be implemented with streams for greater flexibility, robustness, and code - reuse. The new C14 timeseries file is hardcoded for three specific latitude sectors, and thus can't use - the previous file, nor a file of a different configuration. Downreg is passed down from get_downreg_patch - in clm_driver, to CanopyFluxes to Fractionation, but no longer used (it should be removed). - - Note the following from Dave: While debugging crop isotope code, found that cpool_patch and frootc_patch - could occasionally be very small but nonzero numbers after crop harvest, which persists - through to next planting and for reasons that could not 100% isolate, caused C12/C13 ratios to occasionally - go out of bounds. Zeroing out these small pools and putting them into the flux to the atmosphere solved many - of the crop isotope problems - -Changes to tests or testing: Added some tests, two of the new tests fail due to bug 2511 - -Code reviewed by: self, koven, dlawren, dll, oleson - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS (234 comparison tests fail) - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu - OK - cheyenne_intel - OK - cheyenne_gnu - OK - hobart_nag - OK - hobart_pgi - OK - hobart_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_16_r254 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: Crop, Carbon-isotopes - - - what platforms/compilers: All - - nature of change: - small change to crop with missing updates, crop with carbon-isotopes are now enabled - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: - -D components/clm/src/biogeochem/C14BompbSpikeMod.F90 --- Change name to more general - -List all files added and what they do: - -A components/clm/src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90 -- Handle time series - for both C13 and C14 - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeochem/CNPhenologyMod.F90 -------- Remove subtract_cropseed always do when crop on, pass c13/c14 - instances down to CNPhenology and CropPhenology. After setting C12-leafc_xfer/totvegc set the c13/c14 - leafc_xfer/totvegc as well -M components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 ---- Change location of xsmrpool update. Dave added this note: - While debugging crop isotope code, found that cpool_patch and frootc_patch - could occasionally be very small but nonzero numbers after crop harvest, which persists - through to next planting and for reasons that could not 100% - isolate, caused C12/C13 ratios to occasionally go out of - bounds. Zeroing out these small pools and putting them into the flux to the - atmosphere solved many of the crop isotope problems -M components/clm/src/biogeochem/CNCIsoFluxMod.F90 --------- Add CIsoFluxCalc calls for: soilc_change, cpool_to_resp, - grainc_xfer_to_|grainc|food|seed, crop_seedc_to_leaf, grain_|curmr|xsmr, cpool_|grain|grain_storage|_gr, cpool_to_|grainc|grainc_storage, - transfer_grain_gr, grainc_storage_to_xfer, livestemc_to_litter, and if use_grainproduct for ciso-grainc_to_cropprodc/grain_mr - pass iso totvegc_path for hrv_xsmrpool_to_atm CIsoFluxCalc, section adding livestemc to litter for crop - add additional check for ciso_state(i) /= 0 for divide by check in CIsoFluxCalc -M components/clm/src/biogeochem/CNPrecisionControlMod.F90 - Handle c13/c14 TruncateCandNStates for grainc/storage/xfer, - cropseedc_deficit_patch and xsmrpool -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -- Add: C13_GRAINC, C13_CROPSEEDC_DEFICIT, C14_GRAINC, C14_CROPSEEDC_DEFICIT - restartvar calls explicit for c12, c13, c14: grainc, grainc_storage, grainc_xfer (with c13 and c14 for ciso) - add cropseedc_deficit, to storvegc as well as totvegc, fix bug 2316 make cisotopes the same as C12 -M components/clm/src/biogeochem/CNDriverMod.F90 ----------- Pass more c13/c14 instances down to CNPhenology calls -M components/clm/src/main/controlMod.F90 ------------------ Add namelist items: use_c13_timeseries, atm_c13_filename - remove abort when crop and use_c13/use_c14 is on -M components/clm/src/main/clm_initializeMod.F90 ----------- Add call to C13_init_TimeSeries -M components/clm/src/biogeophys/PhotosynthesisMod.F90 ----- Handle C13 timeseries (call C13TimeSeries), put C14 bombspike data in - hard-wired latitude sectors, ignore downreg for carbon isotopes in Fractionation subroutine -M components/clm/src/biogeophys/RootBiophysMod.F90 -------- Use parameters for roots from params file for bare-soil rather than - an explicit if statement for it - -M components/clm/bld/CLMBuildNamelist.pm ------------------- Add cnegcrit/nnegcrit, allow crop and C-isotopes to be - on at the same time, add c13 time-series -M components/clm/bld/unit_testers/build-namelist_test.pl --- Change testing for time-series - -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ----- New datasets for atm_c14_filename, and - atm_c13_filename, new paramdata files, set cnegcrit/nnegcrit, flanduse_timeseries for f09 and hcru @ rcp=8.5 -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml --- Add: use_c13_timeseries, atm_c13_filename - update similar documenation on c14 bombspike -M components/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -- Same as changes above - -M components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm - Set use_c13_timeseries=T -M components/clm/cime_config/testdefs/testlist_clm.xml - Change two ciso transient tests to include crop, add transient - crop ciso test - -M components/clm/cime_config/testdefs/ExpectedTestFails.xml -- Add expected fails for new ciso overflow bug 2511 - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r254 -Originator(s): erik (Erik Kluzek) -Date: Fri Sep 1 00:09:25 MDT 2017 -One-line Summary: Update surface datasets, and point to new CMIP6 population density dataset - -Purpose of changes ------------------- - -Update all surface datasets to new versions that have updated soil albedo, and use latest PFTCFT files. Also -get mksurdata_map fully working on cheyenne for batch mode. Point to latest CMIP6 population density dataset -for historical case, this is with HYDE3.2 data. New fsurdat files for 16pft are with irrigation on. If ask for -irrig=F and 16pft won't be able to find any files. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2479 --- Irrigation is occurring in non-prognostic-crop runs - -Known bugs introduced in this tag (include bugzilla ID): (found ...) - 2506 --- ntree used before it's set in pftconMod.F90 2017-08-25 - 2505 --- Set stream_year_first_urbantv/last for CLM4.5 just for consistency 2017-08-25 - 2504 --- hybrid/branch cases don't allow CLM_FORCE_COLDSTART to be on 2017-08-18 - 2503 --- Wrong units for FAREA_BURNED 2017-08-16 - 2502 --- CWDC_HR is identically zero 2017-08-16 - 2500 --- ne30 case fails on hobart_nag due to floating overflow - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -irrig .true. is needed without -crop - fsurdat files without crop are all just with irrigation on. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): Datasets - -Changes to the datasets (e.g., parameter, surface or initial files): new fsurdat, landuse.timeseries, popdens - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: none - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu - OK - cheyenne_intel - OK - cheyenne_gnu - OK - hobart_nag - OK - hobart_pgi - OK - hobart_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_16_r253 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - similar climate CLM4.5/CLM5.0 surface datasets change with latest soil albedo and small changes form raw PFTCFT files. - also an updated population-density dataset used for historical - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/tools/mksurfdata_map/mksurfdata.pl -- Add rundir option, if 16pfts add Irrig to filename - M components/clm/tools/mksurfdata_map/Makefile.data -- Get working on cheyenne or yellowstone - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ------- Default resolution and sim_year, - set irrig to .true. when crop off, update fsurdat, flanduse_timeseries, stream_fldfilename_popdens - M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Update soil-color and PFTCFT files - - M components/clm/bld/CLMBuildNamelist.pm --- check irrig for fsurdat files, fsurdat with 16pft is with irrig=T - make sure set only set irrigate when use_crop on - M components/clm/bld/unit_testers/build-namelist_test.pl -- More tests w clm5_0, irrigate=T set without crop - M components/clm/bld/unit_testers/NMLTest/CompFiles.pm ---- Add more documentation - - M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm - Update finidat with - updated fsurdat file - - M components/clm/src/biogeophys/PhotosynthesisMod.F90 -- FPSN_W? variables are default off, and instant averaged - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r253 -Originator(s): erik (Erik Kluzek) -Date: Fri Aug 4 20:23:25 MDT 2017 -One-line Summary: Check on reasonable import/export from CLM, check ndep units from input file - -Purpose of changes ------------------- - -Do some reasonable physical checks on the import/export state to/from CLM. Checking for NaN's and -that solar should be greater or equal to zero, LW down, specific humidity greater than zero. -Check the units on the input nitrogen deposition file and if per year divide by seconds per year, -leave alone if per seconds, and die if units aren't recognized. Increase the tolerence for warnings -for Nitrogen, Carbon, and soil energy balance. Add missing MPI broadcasts for two ndep namelist variables. -Fix an LII test that was failing. Change the PE layout for f4x5 grids for yellowstone and cheyenne. -Add -die_on_duplicate option to parse_cime.cs.status and have summary option add notes about expected fails. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): [If none, remove this line] - 2498 -- missing MPI bcast - 2499 -- Update finidat file so LII case will work - 2484 -- Check for units of ndep only divide by seconds in a year if units are per year - -Known bugs introduced in this tag (include bugzilla ID): [If none, remove this line] - NGEET/fates-clm/#16 -- FATES changes answers at a level of at least roundoff when the PE layout changes - NGEET/fates-clm/#15 -- CLM-FATES can't restart when PE layout is change - ESMCI/cime/#1793 ----- Run time error for mpi-serial case on cheyenne_intel when created with aux_clm create_testd - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - units for ndep input files can either be g(N)/m2/yr or g(N)/m2/s, will now abort for anything else - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: Added test with CMIP6 ndep file - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu - OK - cheyenne_intel - OK - cheyenne_gnu - OK - hobart_nag - OK - hobart_pgi - OK - hobart_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_16_r253 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit (although FATES tests change because of the PE layout change) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: Add test mods for case with CMIP6 ndep forcing that has different units/variable name - -A + components/clm/cime_config/testdefs/testmods_dirs/clm/clm50CMIP6frc - -List all existing files that have been modified, and describe the changes: - -M components/clm/cime_config/config_pes.xml ------------- Update f45 PE layout for yellowstone/cheyenne -M components/clm/cime_config/testdefs/testlist_clm.xml -- Add clm50CMIP6frc test -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm - Update finidat file so - LII test will pass - -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 - Lower amount of warnings written out for C and N by order of mag. -M components/clm/src/biogeochem/CropType.F90 ---------- Add if-masterproc to write statement -M components/clm/src/biogeophys/BalanceCheckMod.F90 --- Lower amount of warnings written out for soil energy balance -M components/clm/src/cpl/lnd_import_export.F90 -------- Add checking for physically bad import or export data - ensuring no NaN's are exchanged, solar >= 0, LW-dn > 0, q > 0 -M components/clm/src/main/ncdio_pio.F90.in ------------ Remove write to log file from all tasks -M components/clm/src/main/ndepStreamMod.F90 ----------- Do mpi_bast for ndep_varlist/ndep_taxmode, check units - of input ndep variable and divide by seconds in a year if g(N)/m2/yr, but leave alone for g(N)/m2/s otherwise die - -M parse_cime.cs.status - Add -die_on_duplicate option, and have summarize option make notes about expected fails - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r252 -Originator(s): erik (Erik Kluzek) -Date: Mon Jul 24 16:57:42 MDT 2017 -One-line Summary: Update parameter file for some crop albedo issues, and fix a bug in urban albedo for nightime - -Purpose of changes ------------------- - -Bring in a new CLM50 parameter file that updates a few fields for prognostic crop with affect on crop albedo -(rholnir,taulnir,taulvis,xl). Bring in changes to fix urban albedo for nighttime from Keith Oleson. Rather than set -albedo's for the urban canyon all to 1.0, set them to the viewfactors, as that will result in combined albedo of -one, whereas the previous way ended up with albedo's greater than one. - -Here's a description from Keith about the change in urban albedo. " For diffuse radiation, which is -independent of solar zenith angle, the road albedos appear to be exactly equal to the road-sky view -factor. And the wall albedos are equal to the wall-sky view factor. So the albedos are the albedo -of the surface (1.0) times the appropriate view factor. This makes sense. All incident radiation -entering the canyon should be reflected to the sky and the contribution of each surface is according -to the view factor of each surface to the sky as determined by the height to width ratio. The view -factors of the two walls and the road to the sky sums to 1.0. So setting the diffuse albedos to -these values when the sun is below the horizon results in a scaled diffuse albedo of 1.0. For direct -radiation, it's more complicated because the solar zenith angle is involved when running the -radiation model. However, it seems reasonable to assume the same albedos for direct as for diffuse." - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2492 -- Urban scalings can lead to albedo values greater than 1 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files):New params file for CLM50 - Updates rholnir,taulnir,taulvis,xl for prognostic crop fields - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self,oleson - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne ---- PASS (60 clm50 tests are different as expected) - - unit-tests (components/clm/src): - - cheyenne ---- PASS - - regular tests (aux_clm): (31 Clm45 tests are different than baseline in cpl hist files for: - l2x_Sl_avsdr ("dr" and "df" and "av" and "an") as expected) - - yellowstone_intel - OK - yellowstone_pgi --- OK - yellowstone_gnu --- OK - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - - Tests: ERS_Ld5_Mmpi-serial.1x1_vancouverCAN.I1PtClm45SpGs.cheyenne_intel.clm-default, - ERS_Ld5_Mmpi-serial.1x1_vancouverCAN.I1PtClm45SpGs.yellowstone_intel.clm-default - show: FSR, FSRND, and FSRVD different - -CLM tag used for the baseline comparisons: clm4_5_16_r251 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes for CLM50, and for CLM45 when coupled to CAM - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 (CLM45 when coupled to CAM and albedos passed to coupler for any case) - - what platforms/compilers: all - - nature of change: similar climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - oleson/b.e20.B1850.f09_g17.pi_control.all.186.alb - - URL for LMWG diagnostics output used to validate new climate: - -http://webext.cgd.ucar.edu/B1850/b.e20.B1850.f09_g17.pi_control.all.186.alb/lnd/b.e20.B1850.f09_g17.pi_control.all.186.alb.17_36-b.e20.B1850.f09_g17.pi_control.all.186.17_36/setsIndex.html - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - Updated params file for CLM50 - M components/clm/src/biogeophys/UrbanAlbedoMod.F90 --------------- Fix bug 2492. Set albedo's of - urban surfaces to view factors, by default and for solar zenith angles below horizon. - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r251 -Originator(s): erik (Erik Kluzek) -Date: Fri Jul 14 01:38:38 MDT 2017 -One-line Summary: Update mksurfdata_map for soil depth/color, add new mapping files - -Purpose of changes ------------------- - -Bring in new soil color (from Peter Lawrence) dataset for mksurfdata_map. Also bring -in a new soil depth dataset that uses a mask for when soil depth > 0. Bring in a version -of PTCLM that's working with this cime. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): - New mapping files for soil depth for mksurfdata_map - New soil color data for mksurfdata_map - New soil depth dataset on the map defined by when soil depth > 0 - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: None - -Changes to tests or testing: None - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - OK - -CLM tag used for the baseline comparisons: none - - -Answer changes --------------- - -Changes answers relative to baseline: No, bit-for-bit (CLM code wasn't changed) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): PTCLM - - PTCLM to PTCLM2_170706 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/tools/mkmapdata/regridbatch.sh -- go back to using 8 processors - M components/clm/tools/mkmapdata/mkmapdata.sh ---- add mapping for 5x5min_ORNL-Soil, - change check for $MPIEXEC, so ignores arguments - M components/clm/tools/mksurfdata_map/mksurfdata.pl -- Remove extra "_" in "__CMIP6_" - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- New - 5x5min-ORNL-Soil mapping files - M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - SCRIP - grid file for 5x5min-ORNL-Soil, change soildepth mask to ORNL-Soil - update soil color and soil depth datasets - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add - ORNL-Soil mask - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r250 -Originator(s): erik (Erik Kluzek) -Date: Thu Jul 13 13:54:13 MDT 2017 -One-line Summary: Update finundation dataset, new fsurdat files with updated soil color - and soil depth, update mosart areas, fix cheyenne_gnu - -Purpose of changes ------------------- - -Update all fsurdat datasets with updated soil color and soil depth. Soil color as modified by Peter Lawrence. -Soil depth was modified to use a mask for soil depth>0 which makes the minimum soil depth 3cm (model still has -a minimum of 40cm). Also updated area's for the mosart routing file (the previous areas were off by up to about 1%). -the update to the area's will influence fluxes. Also fix a problem so that cheyenne_gnu will work (remove pure -attribute from two functions). - -Also bring in the updated finundation inversion from Sean Swenson. This will change the methane output -significantly for CLM50BGC cases. The previous inversion file was incorrect and shouldn't be used! The new file is also -at a higher resolution 1-degree rather than 2-degree. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2493 (gnu6.3.0 compiler doesn't like "pure" functions that use outside modules, especially public ones) - -Known bugs introduced in this tag (include bugzilla ID): - 2491 (Error in Banddiagonal in latest CESM simulation) (found in Cecile's coupled simulation) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): Just datasets see below - -Changes to the datasets (e.g., parameter, surface or initial files): Update all fsurdat and the - stream_fldfilename_ch4finundated file - - fsurdat files have soil color and soil depth updated. The finundated file is now at f09 resolution - rather than f19, and the previous file was incorrect. - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu - OK - cheyenne_intel - OK - cheyenne_gnu - OK - hobart_nag - OK - hobart_pgi - OK - hobart_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_16_r249 - - -Answer changes --------------- - -Changes answers relative to baseline: - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 or with MOSART - - what platforms/compilers: all - - nature of change: similar climate, methane outputs are substantially changed - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): mosart - mosart update to mosart1_0_26 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeophys/SnowHydrologyMod.F90 -- Remove pure attribute from OverburdenCompactionVionnet2012 - M components/clm/src/biogeophys/IrrigationMod.F90 ----- Remove purse attribute from PointNeedsCheckForIrrig - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- Update all fsurdat files and stream_fldfilename_ch4finundated - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r249 -Originator(s): sacks (Bill Sacks) -Date: Thu Jul 6 14:32:40 MDT 2017 -One-line Summary: All new compsets, reworked test lists, and related fixes - -Purpose of changes ------------------- - -The changes here were a joint effort between Dave Lawrence, Ben Andre, Erik -Kluzek, Mariana Vertenstein and Bill Sacks - -(1) All new compset aliases, with the following changes: - - (a) Most compset aliases are now for CLM5, with fewer CLM45 compsets and - even fewer CLM40 compsets. - - (b) Compset aliases now use capitalization of only the first letter of each - piece, to avoid the alphabet soup problem. For example, - IHistClm50BgcCrop - - (c) Some other tweaks have been made to compset aliases, such as always - listing the time period and Sp (satellite phenology) explicitly - - (d) Compsets use GSWP3 forcing unless the alias specifies otherwise - - (e) Compsets use CISM2%NOEVOLVE - and so use glc_mec in CLM - unless the - alias has Gs (for GLC - stub) - - (f) An evolving ice sheet (CISM2%EVOLVE) is now denoted by having a final - 'G' in the compset alias - -(2) Completely reworked test lists: - - (a) Use new aliases - - (b) Changed most tests to CLM5 - - (c) Merged the aux_clm45 and aux_clm40 test categories into aux_clm - - (d) Removed the 'null' test category, which was used for SBN tests - - (e) Some minor additional tweaks to the aux_clm test list to ensure - appropriate coverage and remove some redundant tests - - (f) For a few testmods directories, removed some settings that had nothing - to do with those testmods (use_dynroot, use_hydrstress) - -(3) Fixed VIC: - - (a) Previously, VIC compsets were not actually turning VIC on; now they are - - (b) Fixed namelist defaults for VIC with CLM50 - -(4) Updated RTM and MOSART externals: changed their test lists and fixed a - MOSART bug - -(5) Updated CISM external; this changes answers for CISM when ice evolution is - turned off, due to changing the lnd -> glc mapping in this case - -(6) Point to a CIME branch that fixes some bugs - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2473: Change order of tests run with the LII test -- 2474: CLM50 CN compsets seem to be set up wrong -- 2480: vichydro option doesn't work with CLM50 as it needs bedrock off and - lower_boundary_condition=3 (with aquifer layer) - -CIME Issues fixed (include issue #): I think some issues are fixed here, but I'm -not sure which ones - -Known bugs introduced in this tag (include bugzilla ID): -- 2485: CLM's 'ed' testlist still has old-style compsets -- 2486: Failure in camdenNJ test in prebeta test list -- 2488: Floating overflow in SoilBiogeochemNitrifDenitrifMod.F90 - (newly-discovered, but presumably existed in previous tags) -- 2489: Clm45BgcCrop case dies due to negative leafn - (newly-discovered, but presumably existed in previous tags) - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- All new compset aliases - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- All new compset aliases - -Changes made to namelist defaults (e.g., changed parameter values): -- Changed some defaults when running with VIC - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- All new aliases means baseline comparisons all BFAIL - -Changes to tests or testing: -- Massive overhaul - see notes elsewhere in this ChangeLog entry - -Code reviewed by: This was a joint effort by Dave Lawrence, Ben Andre, Erik -Kluzek, Mariana Vertenstein and Bill Sacks. Various pieces were reviewed by -different people in this list. - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok - - pass except for 'compare file.*DNE', presumably due to new tests added - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu - ok - cheyenne_intel - ok - hobart_nag - ok - hobart_pgi - ok - hobart_intel - ok - - Most tests pass; baseline comparisons BFAIL. Bugs opened (and Expected Fails - list updated) for remaining failures. - - Ran most testing on r85975; just ran relevant tests on latest revision with - changed compset (changed IHistClm50BgcGs to IHistClm50BgcQianGs) - -CLM tag used for the baseline comparisons: N/A - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All tests BFAIL due to new compset - aliases. Because of this, I'm not completely sure of the answer changes, but I - think they are: - - Tests with CISM2%NOEVOLVE change answers in fields on the glc grid due - to new CISM external - - CLM50 tests with Vic change answers because now they're actually using VIC - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - New climate for tests that change answers - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): -- cime -- rtm -- mosart -- cism - -List all files eliminated: - -========= No longer need these testmods -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC -D components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC -D components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/shell_commands -D components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/user_nl_datm -D components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5 -D components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12 - -List all files added and what they do: - -========= Replaces af_bias_v5 -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v7/user_nl_datm -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v7 - -List all existing files that have been modified, and describe the changes: - -========= Reworked set of compsets and aliases -M components/clm/cime_config/config_compsets.xml - -========= Reworked test list as described above -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Stop setting glc_snow_persistence_max_days in glcMEC testmods. It made - sense to set this for testing when most of our tests used CLM45, - because the default snow persistence was 20 years. But for CLM50 the - default snow persistence is 0, so it no longer makes sense to set this - value specially for testing. -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/user_nl_clm - -========= Apply CN and VIC for CLM50 -M components/clm/cime_config/config_component.xml - -========= Use compatible settings for VIC -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/unit_testers/build-namelist_test.pl - -========= Fix for new glacier region -M components/clm/cime_config/usermods_dirs/cmip6_glaciers/user_nl_clm - -========= Make SSP work with mosart instead of rtm -M components/clm/cime_config/SystemTests/ssp.py - -========= Change order of LII test to support re-creating initial conditions - files (rather than requiring a separate SMS_Ln1 test) -M components/clm/cime_config/SystemTests/lii.py -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README - -========= New, compatible initial conditions -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm - -========= No longer set use_dynroot = .true., use_hydrstress = .false. -M components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm - -========= No longer set use_hydrstress = .false. -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - -========= Update ExpectedTestFails list for new tests; new failures are: - SMS_Ld5_D_P24x1.f10_f10_musgs.IHistClm50Bgc.hobart_nag.clm-decStart - ERP_D_P24x1.f10_f10_musgs.IHistClm50Bgc.hobart_nag.clm-decStart - ERP_D.f10_f10_musgs.IHistClm50Bgc.yellowstone_gnu.clm-decStart - ERS_Ly5_P72x1.f10_f10_musgs.IHistClm45BgcCrop.cheyenne_intel.clm-cropMonthOutput -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -========= Update documentation of system testing -M .ChangeLog_template - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r248 -Originator(s): sacks (Bill Sacks) -Date: Wed Jun 28 15:50:13 MDT 2017 -One-line Summary: Melt most ice runoff - -Purpose of changes ------------------- - -Up until now, excess snow in CLM (accumulated beyond the snow capping limit) has -been sent to the ocean as an ice runoff flux. However, this caused problems in -some regions, in that it cooled an already-cold ocean, leading to excessive sea -ice growth. Keith Lindsay, Marika Holland and others suggested changing CLM so -that it sends this flux as liquid rather than ice runoff - having the atmosphere -melt the ice rather than having the ocean do so. These changes are implemented -here. - -This has now been tested in many fully-coupled simulations, and it indeed solves -the problem of excessive sea ice growth, without having any noticeable -detrimental effects on other aspects of the simulation. - -Specifically, this affects ice runoff from (a) glacier_mec columns outside of -Greenland and Antarctica, and (b) all other column types (vegetated, etc.). We -still send ice runoff from Greenland and Antarctica to simulate the ice calving -flux that occurs in those regions. In addition, we still send an ice runoff flux -generated from dynamic landunit adjustments. - -This new behavior is used by default in CLM50, but not in CLM45. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variable: melt_non_icesheet_ice_runoff -- New namelist variable: glacier_region_ice_runoff_behavior - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok - - tests pass, namelists change as expected - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - cheyenne_intel - ok - hobart_nag --- ok - hobart_pgi --- ok - hobart_intel - ok - - ok means tests pass, answers change as expected - - Ran most testing on melt_ice_runoff_n05_clm4_5_16_r247; ran hobart on latest - (which included a commit to split long lines) - -CLM tag used for the baseline comparisons: clm4_5_16_r247 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM50 cases - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - new climate - - This changes runoff terms (liquid and ice) and the sensible heat flux sent - to the atmosphere. In addition, there are limited changes in some - methane-related terms; this is presumably due to the dependence of - finundated on TWS, and the fact that TWS changes due to the changes in - these runoff terms. - - There are also diffs in x2r_Flrl_irrig for this test (and the similar - yellowstone test): - ERS_D_Ld10.T31_g37_gl4.IGHISTCLM50.cheyenne_intel.clm-glcMEC_decrease. It - makes sense that there would be x2r irrig diffs due to diffs in volr, but - I was surprised that this test had any irrigation. It turns out this is - due to bug #2479. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: b.e20.B1850.f09_g17.pi_control.all.149 - - URL for LMWG diagnostics output used to validate new climate: ??? - - Note that the climate tests were done on an earlier, kludgey - implementation. I have verified that the latest implementation is bit-for-bit - with that earlier implementation via a 5-year run of compset - 1850_DATM%GSWP3_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV at - resolution f09_g16, producing annual-average cpl history files. (For the - original, used - https://svn-ccsm-models.cgd.ucar.edu/clm2/branch_tags/melt_ice_runoff_orig_tags/melt_ice_runoff_orig_n01_clm4_5_16_r246.) - There were differences in a few CLM diagnostic fields, as expected (because I - have tweaked some diagnostic fields in the latest version), but the cpl - avghist files were bit-for-bit. - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes as described above -M components/clm/src/main/lnd2atmMod.F90 -M components/clm/src/main/lnd2atmType.F90 - -========= Changed long name in some runoff terms: removed statements that they - do not include QSNWCPICE, because now they *do* include the *melted* - portion of QSNWCPICE -M components/clm/src/biogeophys/WaterfluxType.F90 - -========= New glacier region-specific behavior -M components/clm/src/main/glcBehaviorMod.F90 -M components/clm/src/main/test/glcBehavior_test/test_glcBehavior.pf -M components/clm/src/main/clm_driver.F90 - -========= New namelist flags controlling the behavior -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/src/main/clm_instMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r247 -Originator(s): sacks (Bill Sacks) -Date: Mon Jun 26 19:52:20 MDT 2017 -One-line Summary: New GLACIER_REGION field with CISM domain split in two - -Purpose of changes ------------------- - -In an upcoming tag, we'll need a separate GLACIER_REGION for the purpose of -determining where ice runoff should be melted: we do not want this melt to -happen over Greenland itself, but we do want it to happen in peripheral parts of -the CISM domain (and in particular, we want it to happen over the Canadian -archipelago, which is within the CISM domain, and thus was within the -"Greenland" GLACIER_REGION). (We still need a GLACIER_REGION that encompasses -areas outside Greenland itself in case ice extent grows a bit beyond the current -boundaries. So we truly need two separate GLACIER_REGIONs for (a) Greenland -itself, and (b) peripheral areas of the CISM domain.) This tag updates the -surface datasets and related fields to have this extra GLACIER_REGION. - -In addition to updating the GLACIER_REGION raw data file, this also introduces a -new regridding method that is applied to GLACIER_REGION: this takes the maximum -value from any source point (NOT the dominant value). This is important for the -new GLACIER_REGION, where we want a destination (CLM) cell to be considered in -region 2 (Greenland itself) if ANY overlapping source points are in region -2. This means that the ordering of regions in the GLACIER_REGION raw data file -is important: preference will be given to higher-numbered regions. - -Note that I just changed surface datasets that had time stamp 170428 or -later. This excluded some older single point datasets, for which the new glacier -region doesn't matter anyway: -- surfdata_0.125x0.125_simyr2000_c150114.nc -- surfdata_0.125x0.125_mp24_simyr2000_c150114.nc -- surfdata_1x1_smallvilleIA_78pfts_simyr2000_c160127.nc -- surfdata_1x1_smallvilleIA_78pfts_simyr1850_c160127.nc -- surfdata_1x1_tropicAtl_16pfts_simyr1850_c160127.nc (used in tropicAtl_subset testmod) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- There are some additional subtleties now for setting up a run with different - glacier domains (e.g., a paleoclimate run) - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- New surface datasets - just differ in GLACIER_REGION - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- There are some additional subtleties now for setting up a run with different - glacier domains (e.g., a paleoclimate run) - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - ok - - PASSed except expected failures: - - baseline comparisons failed for mksurfdata_map tests - - PTCLM tests failed as expected - - Also ran mksurfdata_map unit tests: - - new-style (cmake / pfunit-based): pass - - old-style: same failures as on trunk - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - cheyenne_intel - pass - hobart_nag --- pass - hobart_pgi --- pass - hobart_intel - pass - -Ran tests on glacier_region_canada_n03_clm4_5_16_r246 -- After that, modified the default mksurfdata_map namelist used for testing: - pointed to updated file - - - -CLM tag used for the baseline comparisons: clm4_5_16_r246 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: - -List all files added and what they do: - -========= Get mkindexmapMod under some pfunit-based unit tests - required - stubbing out a bunch of netcdf stuff -A components/clm/tools/mksurfdata_map/src/unit_test_stubs -A components/clm/tools/mksurfdata_map/src/unit_test_stubs/mkncdio.F90 -A components/clm/tools/mksurfdata_map/src/test/mkindexmap_test -A components/clm/tools/mksurfdata_map/src/test/mkindexmap_test/test_mkindexmap.pf -A components/clm/tools/mksurfdata_map/src/test/mkindexmap_test/CMakeLists.txt - -========= Add get_max_indices and associated unit tests -A components/clm/tools/mksurfdata_map/src/test/mkgridmap_test -A components/clm/tools/mksurfdata_map/src/test/mkgridmap_test/CMakeLists.txt -A components/clm/tools/mksurfdata_map/src/test/mkgridmap_test/test_mkgridmap.pf - -List all existing files that have been modified, and describe the changes: - -========= New raw dataset for glacier region -M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml -M components/clm/tools/mksurfdata_map/mksurfdata_map.namelist - -========= Get mksurfdata_map pfunit-based unit tests passing with new cime -M components/clm/tools/mksurfdata_map/src/README.unit_testing -M components/clm/tools/mksurfdata_map/src/CMakeLists.txt - -========= Add get_max_indices and associated unit tests; use get_max_indices to - regrid glacier region -M components/clm/tools/mksurfdata_map/src/mkgridmapMod.F90 -M components/clm/tools/mksurfdata_map/src/mkindexmapMod.F90 -M components/clm/tools/mksurfdata_map/src/mkglacierregionMod.F90 -M components/clm/tools/mksurfdata_map/src/test/CMakeLists.txt - -========= Allow building mkindexmapMod for unit tests - required stubbing out a - bunch of netcdf stuff -M components/clm/tools/mksurfdata_map/src/mkncdio.F90 - -========= Point to new surface datasets -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Extended namelist array for new region -M components/clm/cime_config/SystemTests/lvg.py - -========= Removed duplicate makefile rules -M components/clm/tools/mksurfdata_map/Makefile.data - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r246 -Originator(s): sacks (Bill Sacks) -Date: Wed Jun 14 12:40:31 MDT 2017 -One-line Summary: Update to latest cime - -Purpose of changes ------------------- - -Main change is to update to the latest version of cime. - -One of the changes in this cime version is that component-specific system tests -(e.g., LII, SSP) can now be defined in the component rather than in cime. So -this tag defines LII and SSP in CLM. In addition, this adds an LVG test (Land -Virtual Glaciers), which verifies that adding virtual glacier columns doesn't -change answers. - -Another significant change in this cime version is that the lnd -> glc -downscaling (i.e., remapping) method has been changed to be bilinear with a -later conservation correction, rather than area-conservative. This leads to -smooth fields on the CISM grid. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New drv_in namelist variable 'glc_renormalize_smb' - controls whether to apply - global corrections to the downscaled lnd -> glc smb for conservation - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Moves LII and SSP test definitions into CLM -- Adds new test type, LVG -- Adds an LVG test - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - cheyenne_intel - ok - hobart_nag --- pass - hobart_pgi --- ok - hobart_intel - pass - - ok means tests pass, some answers change as noted below - -CLM tag used for the baseline comparisons: clm4_5_16_r245 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: see below - - what platforms/compilers: see below - - nature of change (roundoff; larger than roundoff/same climate; new climate): see below - - (1) Changes answers for cases with CISM, due to new downscaling - method. These changes show up only for long tests with CISM, and are - potentially climate-changing: - - FAIL SMS_Lm37.T31_g37_gl4.IG1850CLM50.cheyenne_intel.clm-glcMEC_long BASELINE clm4_5_16_r245 - FAIL SMS_Lm37.T31_g37_gl4.IG1850CLM50.yellowstone_intel.clm-glcMEC_long BASELINE clm4_5_16_r245 - - (2) Changes answers for hobart-pgi tests, due to new version of the pgi - compiler on hobart. Magnitude of the change not investigated. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): -- cime: cime5.3.0-alpha.21 -> cime5.3.0-alpha.27 - -List all files eliminated: none - -List all files added and what they do: - -========= CLM-specific system tests are now defined here rather than in - cime. Also, added an LVG test type: Land Virtual Glacier. -A components/clm/cime_config/config_tests.xml -A components/clm/cime_config/SystemTests -A components/clm/cime_config/SystemTests/lii.py -A components/clm/cime_config/SystemTests/ssp.py -A components/clm/cime_config/SystemTests/lvg.py - -List all existing files that have been modified, and describe the changes: - -========= Ran through -cleanxml, and added an LVG test -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r245 -Originator(s): sacks (Bill Sacks) -Date: Wed Jun 14 12:13:54 MDT 2017 -One-line Summary: Only adjust glc_mec topographic heights if glc_do_dynglacier is true - -Purpose of changes ------------------- - -Two changes in this tag: - -(1) Only adjust glc_mec topographic heights if glc_do_dynglacier is true (this - namelist variable is controlled by the GLC_TWO_WAY_COUPLING xml - variable). Previously, CLM updated its glacier topographic heights even if - this variable was false (so we were not updating areas from CISM). Bill - Lipscomb and Jeremy Fyke agreed a while ago that we should change this. None - of us could remember why we initially set it up to always update topographic - heights, but we felt that it's more intuitive to avoid updating topographic - heights if we're not updating glacier areas. - - Note that setting GLC_TWO_WAY_COUPLING=FALSE is *not* a common thing to do, - so this change does not affect most cases. (The typical way of doing one-way - coupling with CISM is to use CISM2%NOEVOLVE, which turns off ice evolution - but keeps GLC_TWO_WAY_COUPLING=TRUE in order to update CLM's glacier areas - and topographic heights at initialization.) - -(2) Adds some user mods and testmods (currently unexercised) for cmip6 - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: New test mods directories, currently not exercised (I'll add tests soon) - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - cheyenne_intel - ok - hobart_nag --- ok - hobart_pgi --- ok - hobart_intel - ok - - ok means tests pass, a few expected baseline comparison failures - -CLM tag used for the baseline comparisons: clm4_5_16_r244 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Cases with GLC_TWO_WAY_COUPLING=FALSE - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - new climate - - This affects tests with glcMEC_changeFlags and glcMEC_spunup_1way testmods - - Also, NLCOMP failures for a few tests, I think explainable by the process Erik - used to update some testmods to get LII tests passing: - FAIL SMS_D_Ln1.f09_g17.ICLM45BGC.yellowstone_gnu.clm-defaultf09IC NLCOMP - FAIL ERP.f19_g17_gl4.IG1850CLM45.cheyenne_intel.clm-glcMEC_spunup_1way NLCOMP - FAIL SMS_D_Ln1.f19_g17_gl4.IG1850CLM45.cheyenne_intel.clm-glcMEC_spunup_1way NLCOMP - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: - -========= Renamed -D components/clm/cime_config/usermods_dirs/clm/clm5_OutputCrop/user_nl_clm -D components/clm/cime_config/usermods_dirs/clm/clm5_OutputCrop/shell_commands -D components/clm/cime_config/usermods_dirs/clm/clm5_OutputCrop -D components/clm/cime_config/usermods_dirs/clm - -List all files added and what they do: - -========= Top-level cmip6 usermods directory, which will include other usermods - directories needed for the cmip6 runs -A components/clm/cime_config/usermods_dirs/cmip6/include_user_mods -A components/clm/cime_config/usermods_dirs/cmip6 - -========= Renamed from clm5_OutputCrop; also added some glacier output fields - needed for cmip6 runs -A components/clm/cime_config/usermods_dirs/cmip6_output/user_nl_clm -A components/clm/cime_config/usermods_dirs/cmip6_output/shell_commands -A components/clm/cime_config/usermods_dirs/cmip6_output/README -A components/clm/cime_config/usermods_dirs/cmip6_output - -========= Turns on virtual glacier columns over Antarctica. This is desired by - the LIWG for cmip6 runs, so that we can have the Antarctica output - that would be needed to later run an ice sheet model over - Antarctica. However, it comes with a 10% performance cost. -A components/clm/cime_config/usermods_dirs/cmip6_glaciers/user_nl_clm -A components/clm/cime_config/usermods_dirs/cmip6_glaciers - -========= Test mod that allows testing the cmip6 usermods (currently not - exercised with any tests) -A components/clm/cime_config/testdefs/testmods_dirs/clm/cmip6/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/cmip6 - -========= Test mod that allows running the new LVG (virtual glaciers) test - (currently unexercised) -A components/clm/cime_config/testdefs/testmods_dirs/clm/no_vector_output/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/no_vector_output/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/no_vector_output/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/no_vector_output - -List all existing files that have been modified, and describe the changes: - -========= Only adjust topographic heights if glc_do_dynglacier is true -M components/clm/src/main/TopoMod.F90 -M components/clm/src/main/test/topo_test/test_topo.pf -M components/clm/src/main/glc2lndMod.F90 - -========= Add _musgs to f10_f10 grid -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r244 -Originator(s): erik (Erik Kluzek) -Date: Fri Jun 9 14:26:07 MDT 2017 -One-line Summary: Update cime and cism externals, changes answers for IG compsets, test g17 grids, fix a few issues, update mksurfdata_map - -Purpose of changes ------------------- - -Update the cime version which includes some important updates. Remove lt_archive, new script query_config -to query compsets and grids etcetera. Force user to always use case.submit rather than allow them to submit -to batch queue on their own. Some updates to handling of namelist items in user_nl_clm. All grids now contain -a mask variable. Also fixes a couple glitches from the previous version, see bugs fixed below. - -Update cism which changes answers (for cases running with CISM) as 4km grid was changed. - -Fix some small issues with CLM. Fix interpolation issue with GSSUN and GSSHA, use shr_mpi needed for unit-testing, and -fix an issue with a use of MCT routines for clm40. - -Several updates to mksurfdata_map, fixing problems, starting to get it working on cheyenne, and upgrading to latest -CMIP6 PFT datasets from Peter Lawrence. - --Update cime and cism. --Unit tests moved to cime/scripts/fortran_unit_testing/. --Include Jim Edward's configcompsetupdate changes here. --Convert mosart half-degree file from NetCDF-4 to NetCDF-3. --Change grids in test lists so that mask is added to grids that need it (i.e. f45_f45 becomes f45_f45_mg37). --Add note about supported compset IGM1850GSWCLM50BGCCROP for f09_g17, f19_g17. --Use grids back to g16 as g17 domain files aren't there. --Get LII tests working. --Rerun the list of tests that failed, see if works again because of a system issue. --use old g16 mask for CLM40 tests. --Add CMIP5/CMIP6 names to surfdata file creation. --Bring in mksrfunreplu branch. --New rawdata PFT datasets from Peter. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): [If none, remove this line] - 2468 GSSUN/GSSHA interp issue - 2440 change to orderedPoints for clm40 as well - 2425 mksurfdata_map changes from Sean didn't get incorporated - 2419 Irrigated areas are low in mksurfdata_map - 2399 Problem with urban points with latest mksurfdata_map -CIME Issues fixed (include issue #): [If none, remove this line] - #1215 -- (in this version of cime) TestStatus sometimes needs to have write permission added - #1155 -- manage_case doesn't work (renamed to query_config) - #848 -- ./xmlquery --list-all doesn't work (refactored) - -Known bugs introduced in this tag (include bugzilla ID): - 2471 PTCLM doesn't work - 2470 CLM is getting the mask from the clm namelist_defaults rather than from top level scripts - 2469 Cleanup restartvar_{DIMS}d_{TYPE} to ONLY be valid for a 1d interface - 2467 Case on non-year boundary dies with error about ignoring ic_date for a crop case, even though for a branch or hybrid case - 2465 ICLM45VIC compset doesn't actually turn VIC on - 2464 allowlakeprod are outputing standard variables instead of the "lake" specific versions... - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - - cime update brought in quite a few changes -- Add skip-preview-namelist to case.submit and case_run. - - Renamed manage_case to query_config. - - manage_case -> query_config - --compset -> --compsets - --machine -> --machines - added 'all' option for --compsets - added 'current' and to --machines - - Remove all references to lt_archive which will not be supported in - CESM2.0. - - Add Support for '+=' in Namelists. - - Add --component Option to preview_namelist. - - Add Support of true and false in Namelist. - - Force user to always go through case.submit. - - Adds support for namelist entries of the form foo(3) = 'a' - - esmf_logging (and therefore drv_in) are now optional - - New run time XML variable: ESMF_LOGFILE_KIND - - New --answer flag to create_newcase - -Update so that all relevent grids contain a mask variable. - - Add preview_run to case.run - -Changes made to namelist defaults (e.g., changed parameter values): Added mapping files for 0.25x0.25_MODIS - -Changes to the datasets (e.g., parameter, surface or initial files): Just to datasets to create surface datasets - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - - Use ESMF7 on yellowstone and cheyenne. - - Big cs.status upgrade. - - Add --input-dir argument to create_test - -Changes to tests or testing: - Change most gx1v6 masks to gx1v7 - Keep clm40 tests at gx1v6 - -Code reviewed by: self, jedwards (config), mvertens, sacks (unit-tests) - -Did you follow the steps in .CLMTrunkChecklist: Yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - OK - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - FAIL - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - cheyenne_intel - OK - hobart_nag --- OK - hobart_pgi --- PASS - hobart_intel - PASS - -CLM tag used for the baseline comparisons: clm4_5_16_r243 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes for IG compsets with active glacier model - - Summarize any changes to answers, i.e., - - what code configurations: Any with CISM2 - - what platforms/compilers: All - - nature of change: minor -Changes answers for cases with CISM2 at 4km (the default resolution for CISM2 cases) -- Even changes answers for standard one-way coupled cases (CISM2%NOEVOLVE) -- Fields on the CISM grid will have DIMSIZEDIFF -- Fields sent to CLM have roundoff-level differences -- time variable changes for all cases with CISM - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime, cism, mosart - cime to cime5.3.0-alpha.21 - cism to cism2_1_33 - mosart to mosart1_0_24 - -List all files eliminated: - - D components/clm/tools/SVN_EXTERNAL_DIRECTORIES - -List all files added and what they do: - - M components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/README --- Add description of this testmods - and how to update the finidat file for it - A components/clm/test/tools/tests_pretag_cheyenne_nompi ---- Add test list for cheyenne - -List all existing files that have been modified, and describe the changes: - - M components/clm/test/tools/TCBCFGtools.sh - Source $INITMODULES - M components/clm/test/tools/test_driver.sh - Add cheyenne, set INITMODULES - M components/clm/test/tools/TSMCFGtools.sh - Handle CSMDATA - M components/clm/test/tools/nl_files/gen_domain.ne30.runoptions - Use CSMDATA for path to mapping file - M components/clm/test/tools/nl_files/gen_domain.T31.runoptions -- Use CSMDATA for path to mapping file - - M components/clm/tools/mkmapdata/regridbatch.sh ---------------- Set PBS for cheyenne, increase regrid_num_proc to 36 - M components/clm/tools/mkmapdata/mkmapdata.sh ------------------ Increase REGRID_PROC to 36, show defaults in --help, - change so -b means run with mpi, also create 0.25x0.25_MODIS maps, add cheyenne, rm hopper - M components/clm/tools/mksurfdata_map/Makefile.data ------------ Add global-present-T42 - M components/clm/tools/mksurfdata_map/src/mkharvestMod.F90 ----- Change harvest_fieldnames and string_undef - M components/clm/tools/mksurfdata_map/src/mkgridmapMod.F90 ----- Add gridmap_areaave_scs interface which - multiplys weight by ratio of source over destination weight (set to zero if destination weight is zero) - M components/clm/tools/mksurfdata_map/src/mkpftMod.F90 --------- Use gridmap_areaave_scs interface rather than default - one, passing down source weight of pctnatveg_i and desitination weight of pctnatveg_o (both mulitipled by 0.01) - if zeroing out also set pctnatveg_o, pctcrop_o, pct_nat_pft_o, pct_cft_o to zero, and first entry of pct_nat_pft_o - and pct_cft_o to 100 - M components/clm/tools/mksurfdata_map/mksurfdata_map.namelist -- Update with new files - M components/clm/tools/mksurfdata_map/mksurfdata.pl ------------ Add cmip_series to output filenames, use vegtyp to get harvest files, - - M components/clm/tools/mksurfdata_map/landuse_timeseries_hist_78pfts_simyr1850-2015.txt - Update with new datafiles. Note, each - year is repeated once to point to same data (to be used for harvesting). This allows harvest files to be seperate. - - M components/clm/bld/unit_testers/build-namelist_test.pl --------------- Don't test 0.25x0.25 grid - M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Add 0.25x0.25 MODIS mapping file, harvest, PFT, LAI, and soil-color - are 0.25x0.25_MODIS, harvest files are: mksrf_fvegtyp, Update: LAI, soil-color, and PFT files, remove harvest files - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml ----- Add 0.25x0.25 to hgrid and res, add 2015 to sim_year, and - 1980-2015 to sim_year_range, - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ------- Add 0.x25x0.25_MODIS mapping files - - M components/clm/cime_config/config_compsets.xml ------- Changes from Jim Edwards to update to version 2.0 which will do xmllint checking - on the file, add for f09, f19 IGM1850GSWCLM50BGCCROP compsets - - M components/clm/cime_config/testdefs/testlist_clm.xml - Add SMS _Ln1 tests to correspond to each LII test (to make updating finidat files - for LII tests easier, update grids to include mask when needed, and update most g16 mask tests to g17 (except clm40 tests which - need to remain at g16) - M components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/user_nl_clm ------- Update finidat file, set use_init_interp to True - and add notes on how to update it - M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm - Update finidat file, set use_init_interp to True - and add notes on how to update it - M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README ------ Add notes on how to update the finidat file - - M components/clm/SVN_EXTERNAL_DIRECTORIES - Point to PTCLM here - - M components/clm/src_clm40/main/GetGlobalValuesMod.F90 - Change mct_gsmap_OP to mct_gsmap_orderedPoints (bug 2440) - M components/clm/src_clm40/main/ncdio_pio.F90.in ------- Change mct_gsmap_OP to mct_gsmap_orderedPoints (bug 2440) - M components/clm/src/biogeochem/CNSharedParamsMod.F90 -- Use shr_mpi_bcast rather than straight MPI (important for new unit tests) - M components/clm/src/README.unit_testing --------------- Updated notes on how to do it from Bill Sacks - M components/clm/src/biogeophys/PhotosynthesisMod.F90 -- Set switchdim=T for GSSUN/GSSHA (bug 2468) - M components/clm/src/CMakeLists.txt -------------------- Add include(CIME_initial_setup) - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r243 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue May 23 16:27:42 MDT 2017 -One-line Summary: History output cleanup from Dave Lawrence - -Purpose of changes ------------------- - -* Reduce default history output by setting numerous variables to - default=inactive, limiting some 3d vars to active soil layers only. - -* Update default history output for CLM5. - -* Added diagnostic new output for DWT_WOOD_PRODUCTC_GAIN_PATCH, - GS_MOL, lake_icefracsurf_col, h2osoi_liq_tot_col, h2osoi_ice_tot_col - -* Remove double accounting for CNSoy fixation when FUN is on. - -* Bug fixes to allow landunit-level and column-level averaging and - vector output using the hist_type1d_pertape namelist option (LAND - for land-unit, COL for column-level). Note that if a user asks for - a variable at a subgrid level that is not available at that subgrid - level, the model will crash ungracefully. An example would be - asking for TOT_WOODPRODC at the land-unit level when this variable - is only available at the grid cell level, or asking for H2OSOI at - the pft-level when H2OSOI is a column-level variable. Code may be - added in a future tag that will inform the user of the error. - -* Add usermods dir for recommended clm5 crop default output. To use - the usermod when creating a new case: - - ./create_newcase --compset HIST_DATM%GSWP3_CLM50%BGC-CROP_SICE_SOCN_MOSART_CISM2_SWAV \ - --user-mods-dir clm/clm5_OutputCrop \ - ... machine, compiler, grid, case name, etc... - - -Bugs fixed or introduced ------------------------- - -None, but see note below in testing about c14 bombspike test. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - - The default history output has been reduced. You may need to - explicitly request fields of interest from the namelist. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: unknown - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Dave Lawrence, Ben Andre - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - all tests pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - cheyenne_intel - ok, see note below - hobart_nag - ok - hobart_pgi - ok - hobart_intel - ok - -CLM tag used for the baseline comparisons: clm4_5_16_r242, no - yellowstone intel baselines were generated for clm4_5_16_r242 - - Baselines comparisons for clm45/clm5 tests show: - 1. changes in fields sizes (expected, restrict vertical fields to nlevsoi) - - 2. different fields on current and baseline files (expected, new default active/inactive) - - 3. no RMS differences, except the following tests: - - These tests failed baseline comparisons with RMS differences in - testing due to the soy nitrogen double accounting fix. - - ERP_P60x2_Lm36.f10_f10.ICRUCLM50BGCCROP.cheyenne_intel.clm-clm50cropIrrigMonth_interp - ERS_Ly3.f10_f10.I1850CRUCLM50BGCCROP.cheyenne_intel.clm-clm50KSinkMOut - ERS_Ly5_P60x1.f10_f10.IHISTCLM50BGCCROP.cheyenne_intel.clm-cropMonthOutput - - ERP_P60x2_Lm36.f10_f10.ICRUCLM50BGCCROP.yellowstone_intel.clm-clm50cropIrrigMonth_interp - ERS_Ly3.f10_f10.I1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KSinkMOut - ERS_Ly5_P60x1.f10_f10.IHISTCLM50BGCCROP.yellowstone_intel.clm-cropMonthOutput - - The ciso-c14 bombspike1963 test failed baseline test with RMS - differences in C14_* fields on cheyenne_intel. This did not have - differences when tested against r273 and yellowstone_intel. This - seems to be intermintent, there was at least one test run with - r242 cheyenne_intel where this passed without RMS differences. - - SMS_D_Ly2.1x1_brazil.IHISTCLM50BGC.cheyenne_intel.clm-ciso_bombspike1963 - - - -Answer changes --------------- - -Changes answers relative to baseline: some clm5 compsets - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - - what code configurations: removal of double accounting for soy - nitrogen fixation from clm5 crop runs with fun active. See tests - above. - - - what platforms/compilers: all - - - nature of change (roundoff; larger than roundoff/same climate; - new climate): unknown, presumed larger than roundoff same - climate. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? n/a - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: n/a - - URL for LMWG diagnostics output used to validate new climate: n/a - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -New usermods with default output for clm5 crop runs - A clm/cime_config/usermods_dirs/clm/clm5_OutputCrop - A clm/cime_config/usermods_dirs/clm/clm5_OutputCrop/user_nl_clm - A clm/cime_config/usermods_dirs/clm/clm5_OutputCrop/shell_commands - -List all existing files that have been modified, and describe the changes: - - M clm/cime_config/config_component.xml - update component description from Erik Kluzek - -Set history fields active/inactive: - M clm/src/biogeochem/CNVegCarbonStateType.F90 - M clm/src/biogeochem/CNVegNitrogenStateType.F90 - M clm/src/biogeochem/CNVegNitrogenFluxType.F90 - M clm/src/biogeochem/CropType.F90 - M clm/src/biogeophys/EnergyFluxType.F90 - don't output btran unless hydrstress active - M clm/src/biogeophys/TemperatureType.F90 - MM clm/src/biogeophys/HumanIndexMod.F90 - M clm/src/biogeophys/SoilHydrologyType.F90 - M clm/src/biogeophys/SolarAbsorbedType.F90 - M clm/src/biogeophys/CanopyStateType.F90 - M clm/src/biogeophys/SurfaceRadiationMod.F90 - M clm/src/biogeophys/WaterfluxType.F90 - variable renaming - M clm/src/biogeophys/SoilStateType.F90 - -New diag output, set default active/inactive fields: - M clm/src/biogeochem/CNVegCarbonFluxType.F90 - M clm/src/biogeochem/CNProductsMod.F90 - M clm/src/biogeophys/PhotosynthesisMod.F90 - M clm/src/biogeophys/LakeStateType.F90 - M clm/src/biogeophys/LakeTemperatureMod.F90 - M clm/src/biogeophys/HydrologyNoDrainageMod.F90 - vertically summed water state calc - M clm/src/biogeophys/WaterStateType.F90 - - -Default active/inactive history fields, restrict output to nlevsoi: - M clm/src/biogeochem/ch4Mod.F90 - M clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 - M clm/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 - M clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 - M clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 - M clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 - - -FUN Soy Nitrogen Fixation double accounting: - M clm/src/biogeochem/CNDriverMod.F90 - -Subgrid mapping: - M clm/src/main/histFileMod.F90 - M clm/src/main/subgridAveMod.F90 - - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r242 -Originator(s): erik (Erik Kluzek) -Date: Sun May 21 21:16:34 MDT 2017 -One-line Summary: Use finundated streams for CLM50, and use ndep if it comes from cpl - -Purpose of changes ------------------- - -For methane, read in inversion for TWS to Prigent Satellite dataset from a streams file for CLM50. For -CLM45 still read in ZWT inversion parameters from the surface dataset. You can read it from the streams -file if you provide it to the namelist. Answers change for CLM50BGC compsets because of this change to -methane. The change does affect results outside of methane after enough time. - -Add option to use nitrogen deposition sent from the coupler rather than from datasets (from mvertens). - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - bug 2462 -- TWS restart - bug 2457 -- remove FIND_HIST - bug 2454 -- species masterlist confusion - bug 2443 -- ndep - bug 2456 -- rm extra settings - bug 2463 -- T42 SP dataset - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): New namelist item - for finundated streams stream_fldfilename_ch4finundated. It can be used for both TWS_inversion - which is now the CLM50 default, or the ZWT_inversion (CLM45 default), but by default CLM45 - is reading ZWT inversion parameters from the surface dataset - -Changes made to namelist defaults (e.g., changed parameter values): ZWT_inversion for CLM45 and TWS_inversion for CLM50 - for inundated fraction - -Changes to the datasets (e.g., parameter, surface or initial files): Add 2000 T42 fsurdata file - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: Add two new tests - Add test for hourly radiation with lightning resolution at half-degree - And test with reseeding and reset of snow - -Code reviewed by: self,mvertens - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (94 compare tests FAIL) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - Didn't run - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - cheyenne_intel - OK - hobart_nag --- PASS - hobart_pgi --- PASS - hobart_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_16_r241 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, CLM50 - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 (with finundated streams for TWS_inversion) - - what platforms/compilers: All - - nature of change: similar climate, but methane changes (which does feedback into system) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: None - -List all files added and what they do: Add new tests - - A components/clm/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/shell_commands - A components/clm/cime_config/testdefs/testmods_dirs/clm/rad_hrly_light_res_half/user_nl_datm - A components/clm/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/user_nl_clm - A components/clm/cime_config/testdefs/testmods_dirs/clm/reseedresetsnow/include_user_mods - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/CLMBuildNamelist.pm -------------------- Remove fin_use_fsat, set finundation_method - and get finundated streams file if TWS_inversion, add ch4finundated namelist group - M components/clm/bld/unit_testers/build-namelist_test.pl ---- Add test for change to finundated if not methane - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Remove extra settings of use_init_interp, - add T42 present day fsurdat file, remove fin_use_fsat, set finundation_method to TWS_inversion for CLM50 - and ZWT_inversion for CLM45, set finundation_res=1.9x2.5 and set stream_fldfilename_ch4finundated file for it - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add: stream_fldfilename_ch4finundated, finundation_res - remove fin_use_fsat, correct finundation_method documentation - - M components/clm/cime_config/config_compsets.xml ------- Add IGMCRUCLM50SP, IGMCRUCLM50BGCROP compsets - M components/clm/cime_config/testdefs/testlist_clm.xml - Change prealpha/prebeta yellowstone_intel/gnu tests to cheyenne - add new tests for reseedresetsnow and rad_hrly_light_res_half - - M components/clm/src/main/clm_instMod.F90 -------- Pass NLFilename down to ch4 Init - M components/clm/src/main/clm_varctl.F90 --------- Add ndep_from_cpl variable - M components/clm/src/main/clm_driver.F90 --------- If ndep_from_cpl is true don't do ndep_interp - M components/clm/src/main/clm_initializeMod.F90 -- If ndep_from_cpl is true don't do ndep_init and ndep_interp - M components/clm/src/main/histFileMod.F90 -------- Add error check if field name is too long - M components/clm/src/biogeophys/WaterStateType.F90 - Add TWS to restart file - - M components/clm/src/cpl/clm_cpl_indices.F90 --- Set ndep_from_cpl based on existance of Faxa_nhx and Faxa_noy - M components/clm/src/cpl/lnd_import_export.F90 - Set forc_ndep_grc if ndep_from_cpl is set, convert units - - M components/clm/src/biogeochem/SpeciesNonIsotopeType.F90 --- Add trim's to strings to make sure blanks aren't added - M components/clm/src/biogeochem/ch4Mod.F90 ------------------ Pass NLFilename to Init, add ch4findstream data and Init to it - Remove fws_a/b/hist, remove fin_use_fsat use finundation_mtd Call ch4findstream%CalcFinundated is finundated streams are being - used (stream_fldfilename_ch4finundated is set), or if finundation_mtd_h2osfc, - M components/clm/src/biogeochem/ch4FInundatedStreamType.F90 - Add UseStreams method, get streams working properly and - M components/clm/src/biogeochem/SpeciesIsotopeType.F90 ------ Add trim for strings to make sure blanks don't happen - M components/clm/src/biogeochem/ch4varcon.F90 --------------- Remove fin_use_fsat - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r241 -Originator(s): sacks (Bill Sacks) -Date: Tue May 16 20:43:43 MDT 2017 -One-line Summary: Fix ch4 subtle dependence on processor count - -Purpose of changes ------------------- - -When we moved to using interpolated initial conditions in most cases, long tests -that change processor counts (ERP, PEM) began to fail (bug 2458). I tracked this -problem down to annsum_npp, annsum_counter, and specifically bug 1597. - -I found that, in both the original finidat and finidat_interp_dest, we have: - -- For coltype = 1, counter can be 0, 3600 or 5400 - -- For coltype = 200-something (crop), counter is always 5400 - -- For other coltypes, counter = 0 (but these shouldn't matter) - -My best guess is that there is some interaction between (1) the history of an -initial conditions file, and (2) dynamic landunits, which causes annsum_counter -to differ by column. Specifically, with (1): I think that problems arise when an -initial conditions file has (at some point in its history) arisen from a run -that didn't run for a complete year; e.g., this can happen in the course of -making an interp'ed initial conditions file - for which we typically run for one -or a few time steps. This can lead to a misalignment of the resetting of -annsum_counter relative to when dynamic landunits kick in, and thus the counter -can differ for different columns. - -This tag fixes the problem by making each column dependent on its own count, -rather than using the count from the first column on that MPI task. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 1597: awkward conditionals to determine end of year in CN AnnualUpdate -- 2458: ERP clm5 restart failure in clm4_5_16_r237 - -Known bugs introduced in this tag (include bugzilla ID): [If none, remove this line] -- https://github.com/NCAR/CLM/issues/7 : CN annsum_counter can trigger mid-year, - and at different times for different columns - - Decision in talking with Erik and Keith was that we would not try to resolve - this right now - it seems that it can cause a bit of confusion, but no - scientific problems as far as we can tell. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Erik; conceptually reviewed by Keith - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - cheyenne_intel - pending; I'll check them post-tag and open an issue if any fail - hobart_nag --- ok - hobart_pgi --- not run - hobart_intel - ok - - ok means tests pass, some baselines fail as expected - -CLM tag used for the baseline comparisons: clm4_5_16_r240 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Many configurations, when run for at least a year - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff; expected to be same climate, but not investigated carefully. - - Answer changes can appear whenever we have an initial conditions file - where different columns have different values of the annsum_counter - restart field. This is the case for present-day restart files, as well as - at least one year-1850 restart file - (clmi.I1850CRUCLM45BGC.0241-01-01.1.9x2.5_g1v6_simyr1850_c170308.nc). - - The impact of this problem is expected to be small, at least if the - differences in annsum_counter values are small (which they are for the two - initial conditions files I have checked, and I expect this is the case for - others, too): In this case, the impact is that some annually-accumulated - fields reach their end-of-year mark a few time steps too early or late. - - However, I have not investigated the impact of this bug fix carefully. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/biogeochem/CNAnnualUpdateMod.F90 - -========= New function to create a sub-filter based on an existing filter and a - column-level logical array -M components/clm/src/main/filterColMod.F90 -M components/clm/src/main/test/filter_test/test_filter_col.pf - -========= Remove no-longer-failing tests -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r240 -Originator(s): sacks (Bill Sacks) -Date: Mon May 15 14:48:22 MDT 2017 -One-line Summary: Make glc_dyn_runoff_routing real-valued - -Purpose of changes ------------------- - -The glc_dyn_runoff_routing variable tracks which CLM grid cells overlap -fully-coupled glc (CISM) grid cells, and which do not: In those that do not, CLM -needs to send the snow capping flux directly to runoff. Previously, this value -was a logical. However, we (Bill Lipscomb and Bill Sacks) realized that this -really needs to be real-valued - having a value between 0 and 1 where a CLM cell -partially overlaps the CISM domain. This is needed for complete conservation -when we are running with a fully-coupled (two-way-coupled) glc component. - -This changes answers for cases with two-way-coupled CISM, but does NOT change -answers for the typical one-way-coupled (%NOEVOLVE) case. - -Main changes are from Bill Lipscomb. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- There is some duplicate logic between CLM and the coupler in determining the - fraction of the CLM grid cell that overlaps with the active glc - domain. Ideally, we'd move all of the relevant logic into the coupler and - avoid needing it in CLM. See the TODO note in glc2lndMod.F90 - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - cheyenne_intel - ok - hobart_nag --- ok - hobart_pgi --- not run - hobart_intel - ok - - ok means tests pass, baselines fail as expected - -CLM tag used for the baseline comparisons: clm4_5_16_r239 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: cases with CISM two-way coupled (i.e., without %NOEVOLVE) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff, but only changes answers around the margin of - Greenland, so expected to be same climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/src/main/test/topo_test/test_topo.pf -M components/clm/src/main/glc2lndMod.F90 -M components/clm/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 - -========= Add a test to the xfail list which fails sporadically due to bug 2461 -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r239 -Originator(s): sacks (Bill Sacks) -Date: Sat May 13 20:35:52 MDT 2017 -One-line Summary: Avoid division by zero in snow WindDriftCompaction - -Purpose of changes ------------------- - -Tweak the equations in WindDriftCompaction to avoid division by 0, to fix bug -2460. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2460: Floating point trap in FWAMIP compset - -Known bugs introduced in this tag (include bugzilla ID): -- 2461: Multi-instance tests failing sporadically - This has actually been an issue for the last few tags, likely related to bug - 2289 - default finidat_interp_dest file name should have instance number - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Dave Lawrence - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - cheyenne_intel - ok - Did not do baseline comparisons for cheyenne tests - hobart_nag --- ok - hobart_pgi --- not run - hobart_intel - ok - - ok means tests pass, baseline comparisons fail for clm50 tests as expected - -CLM tag used for the baseline comparisons: clm4_5_16_r238 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - via analysis of the change: the new equation is algebraically identical to - the old; essentially we now have X*Y/Z rather than X/(Z/Y) - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main change, as described above -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= Note sporadic multi-instance failure; remove a test from the xfail - list that is now passing -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r238 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Sat May 13 11:45:15 MDT 2017 -One-line Summary: ED is now an external library 'fates' - -Purpose of changes ------------------- - -The ongoing evolution of the 'ED' library is being done by -NGEE-Tropics as 'FATES'. This change removes the 'ED' directory and -replace it with link an external release of fates. - -The primary changes are to finish creation of an interface layer to -separate fates from CLM. There are also numerous science improvements -in the linked fates library. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2459 - patch from Erik Kluzek - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -Changes made to namelist defaults (e.g., changed parameter values): - - * ED has been completely rebranded as fates. This includes: - * New/renamed compsets - ICLM45ED is now ICLM45FATES, ICLM50FATES. - * Renamed name list variables: - * use_ed --> use_fates - * use_ed_spitfire --> use_fates_spitfire - - * New namelist variable: fates_paramfile, this can point to either - the clm parameter file, or a standalone fates parameter file - depending on user preference. All fates dimensions and variables - are namespaced by 'fates_'. - - * Fates can not restart and interpolate from a CLM-{SP,CN,BGC} - initial conditions file. It must be run in cold start or restart - from a CLM-fates restart file. - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - - * Add tests to aux_clm45 using the fates compsets and renamed the ed - test mods to fates and fatesFire. - - * Added the cheyenne_intel test list to aux_clm45 - - * all namelist tests are expected to fail because of use_ed -> use_fates rename. - -Code reviewed by: - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - all tests pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - cheyenne_intel - [ experimental, see xfails list ] pass w/ xfails - hobart_nag - pass w/ xfails - hobart_pgi - not run per CLM-CMT discussion, see bugz 2447, 2455 - hobart_intel - pass - -CLM tag used for the baseline comparisons: clm4_5_16_r237 - - -Answer changes --------------- - -Changes answers relative to baseline: answer changing for ED/fates - compsets, but bit for bit for all other clm45 and clm50 compsets - - Verified not answer changing for CLM50 compsets via test suite, and - 20 year simulation by Dave Lawrence and Keith Olseson. - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ED/fates compsets only - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): unknown - - If bitwise differences were observed, how did you show they were no worse - than roundoff? n/a - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: n/a - - URL for LMWG diagnostics output used to validate new climate: n/a - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): - -A components/clm/SVN_EXTERNAL_DIRECTORIES - new SVN_EXTERNALS file for fates -A components/clm/src/fates - -List all files eliminated: - -D components/clm/src/ED - removed and replaced by fates external - -List all files reamed: - -rename testmod edTest --> fates - default now with fire off -A testmods_dirs/clm/fates -A testmods_dirs/clm/fates/user_nl_clm -A testmods_dirs/clm/fates/shell_commands -D testmods_dirs/clm/edTest -D testmods_dirs/clm/edTest/user_nl_clm -D testmods_dirs/clm/edTest/shell_commands - -rename testmod edNoFire --> fatesFire -A testmods_dirs/clm/fatesFire -A testmods_dirs/clm/fatesFire/user_nl_clm -A testmods_dirs/clm/fatesFire/include_user_mods -A testmods_dirs/clm/fatesFire/shell_commands -D testmods_dirs/clm/edNoFire -D testmods_dirs/clm/edNoFire/user_nl_clm -D testmods_dirs/clm/edNoFire/include_user_mods -D testmods_dirs/clm/edNoFire/shell_commands - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -M .ChangeLog_template - include cheyenne_intel -M parse_cime.cs.status - patch from Erik Kluzek bugz 2459 - -Point build to new src/fates directory instead of src/ED -M clm/cime_config/buildlib -M clm/bld/configure - -Update namelist with new fates paramfile, rename use_ed to use_fates -in namelist logic, rename functions to be fates instead of ed. Update tests. -M clm/bld/CLMBuildNamelist.pm -M clm/bld/unit_testers/build-namelist_test.pl -M clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml -M clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -M clm/bld/test_build_namelist/t/test_do_transient_pfts.pm -A clm/bld/test_build_namelist/t/test_fates_mode.pm -D clm/bld/test_build_namelist/t/test_ed_mode.pm -M clm/bld/test_build_namelist/t/test_do_harvest.pm -M clm/bld/test_build_namelist/t/test_do_transient_crops.pm -M clm/bld/namelist_files/namelist_definition_clm4_5.xml -M clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -Update test for fates, cheyenne_intel -M clm/cime_config/testdefs/ExpectedTestFails.xml -M clm/cime_config/testdefs/testlist_clm.xml - -Stub fates parameter interface for unit tests: -M components/clm/src/CMakeLists.txt -A + components/clm/src/unit_test_stubs/utils/clmfates_paraminterfaceMod_stub.F90 -M components/clm/src/unit_test_stubs/utils/CMakeLists.txt - -Rename ED compset FATES -M clm/cime_config/config_compsets.xml -M clm/cime_config/config_component.xml - -Fates interface -A clm/src/utils/clmfates_paraminterfaceMod.F90 -M clm/src/utils/clmfates_interfaceMod.F90 - -Rename use_ed to use_fates and other rebranding -M clm/src/biogeochem/CNCStateUpdate1Mod.F90 -M clm/src/biogeochem/CNMRespMod.F90 -M clm/src/biogeochem/CNVegetationFacade.F90 -M clm/src/biogeochem/CNDriverMod.F90 -M clm/src/main/clm_varpar.F90 -M clm/src/main/subgridRestMod.F90 -M clm/src/main/atm2lndType.F90 -M clm/src/main/restFileMod.F90 -M clm/src/main/initSubgridMod.F90 -M clm/src/main/initVerticalMod.F90 -M clm/src/main/surfrdMod.F90 -M clm/src/biogeophys/PhotosynthesisMod.F90 -M clm/src/biogeophys/HydrologyDrainageMod.F90 -M clm/src/biogeophys/SurfaceAlbedoMod.F90 -M clm/src/biogeophys/SurfaceRadiationMod.F90 -M clm/src/biogeophys/SoilMoistStressMod.F90 -M clm/src/biogeophys/CanopyStateType.F90 -M clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M clm/src/dyn_subgrid/dynEDMod.F90 -M clm/src/dyn_subgrid/dynSubgridControlMod.F90 -M clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 -M clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 -M clm/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 -M clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 -M clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 -M clm/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 -M clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 - - -Update logic for fates compatibility and to use clm_fates interface -M clm/src/biogeochem/EDBGCDynMod.F90 -M clm/src/main/subgridWeightsMod.F90 -M clm/src/main/decompInitMod.F90 -M clm/src/main/clm_initializeMod.F90 -M clm/src/main/subgridMod.F90 -M clm/src/main/histFileMod.F90 -M clm/src/main/controlMod.F90 -M clm/src/main/clm_varctl.F90 -M clm/src/main/clm_driver.F90 -M clm/src/main/pftconMod.F90 -M clm/src/main/initGridCellsMod.F90 -M clm/src/main/decompMod.F90 -M clm/src/main/clm_instMod.F90 -M clm/src/main/readParamsMod.F90 -M clm/src/biogeophys/CanopyTemperatureMod.F90 -M clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M clm/src/biogeophys/BalanceCheckMod.F90 -M clm/src/biogeophys/WaterStateType.F90 -M clm/src/biogeophys/TotalWaterAndHeatMod.F90 -M clm/src/biogeophys/CanopyFluxesMod.F90 -M clm/src/biogeophys/SoilStateInitTimeConstMod.F90 -M clm/src/biogeophys/RootBiophysMod.F90 -M clm/src/biogeophys/OzoneMod.F90 - -M clm/src/main/paramUtilMod.F90 - new generic routines used by fates interface -M clm/src/main/PatchType.F90 - new patch array to distinguish between fates patch and clm pft - -A clm/src/biogeophys/SoilWaterPlantSinkMod.F90 - from SoilWaterMovement -M clm/src/biogeophys/SoilWaterMovementMod.F90 - moved to SoilWaterPlantSink -M clm/src/biogeophys/WaterfluxType.F90 - new variable for fates -M clm/src/biogeophys/SoilStateType.F90 - remove tsink - -=============================================================== -=============================================================== -Tag name: clm4_5_16_r237 -Originator(s): erik (Erik Kluzek) -Date: Tue May 9 15:05:51 MDT 2017 -One-line Summary: Latest parameter file and some changes for CLM50, CLM45-transient changes answers also - -Purpose of changes ------------------- - -Adjustments to CLM50 climate from Keith Oleson, Peter Lawrence, Fang Li, Rosie Fisher, Danica Lombardozzi, Will Weider, -Yaqiong Lu, Ben Sanderson, and David Lawrence. Some tweaks to the code and to parameters and the parameter file for CLM50. -Use Medlyn 2011 stomotal conductance rather than Ball-Berry. Modify photosynthesis and leaf maintence respiration for crop. -Limit irrigation if river flow is on and the storage drops below a threshold. Modify a long list of parameter values including -41 items on the parameter file. Only harvest up to 98% to allow for regrowth and divide by several terms rather than just deadstem. -Add slash harvesting fields (debris left from harvesting). Add in a hack to read in FWS_TWS_A/B if they are on the surface -dataset and use them to calculate finundation based on TWS rather than exponential function based on ZWT. For fires change an -if statement from checking if atmosphere is non-freezing to a specific soil layer. If crops have hit peak LAI set leaf allocation -to a small value. Make sure some retranslocation terms are positive. Let lnc in Photosynthesis max out at 10. Only vary baset -for crops for spring wheat and sugarcane (irrigated and non) rather than all crops. - -Coupled crop cases will change since we now use the radiation time-step for fertilization rather than the model time-step. -CLM45 cases remain the same with the exception for transient cases which change answers due to the change in how -harvest is handled. Fix a few minor bugs that came in with clm4_5_15_r236 with specific datasets and finidat file handling in scripts -(bugs 2448-2451). - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - - 2452 --- Change to divisor for harvest and also allow for regrowth - 2451 --- Bad comment marker in cropf10IC testmods - 2450 --- Make sure finidat is reset after setting to coldstart - 2449 --- Add no fail to init_interp_attributes and use_init_interp, needed for DV cases where interpolated IC files aren't there - 2448 --- Misnamed dataset in CLM xml database - -Known bugs introduced in this tag (include bugzilla ID): - 2457 --- Remove FINUN_HIST from history - 2456 --- Remove extra settings of use_init_interp - 2455 --- PGI specific error at initialization - 2454 --- masterlist_addfld getting confused with names for species... - 2453 --- Memory error with restart variable vcmx25t - 2447 --- Floating overflow for CLM50CROP case on hobart_nag in Photosynthesis - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): New slash harvest fields - SLASH_HARVESTC, DWT_SLASH_CFLUX, C13_DWT_SLASH_CFLUX, C14_DWT_SLASH_CFLUX - -Changes made to namelist defaults (e.g., changed parameter values): Many adjustments for CLM50 - modifyphoto_and_lmr_forcrop TRUE for CLM50 - stomatalcond_method Medlyn2011 for CLM50 with PHS - limit_irrigation_if_rof_enabled TRUE for CLM50 - Following values modified for CLM50 cases - modify baseflow_scalar, rh_low, bt_min, bt_max, cli_scale, boreal_peatfire_c, pot_hmn_ign_counts_alpha - non_boreal_peatfire_c, cropfire_a1, lfuel, cmb_cmplt_fact, irrig_threshold_fraction, - n_melt_glcmec, br_root, initial_Cstocks_depth - -Changes to the datasets (e.g., parameter, surface or initial files): CLM50 parameter file clm5_params.c170413.nc - Update CLM50 paramsfile, fsurdat-f09-2000-crop, flanduse_timeseries-f45-hist/f10-hist - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): finundation changes are messy - -Changes to tests or testing: Fixed testmods for one tests - -Code reviewed by: self,dlawren,lawrence,oleson,rosiefisher,wweider,lifang - -Did you follow the steps in .CLMTrunkChecklist: Yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS (93 comparison tests fail to clm4_5_15_r236) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - PASS - yellowstone_pgi - PASS - yellowstone_gnu (clm45 only) - PASS - hobart_nag --- OK - hobart_pgi --- OK - hobart_intel - PASS - -CLM tag used for the baseline comparisons: clm4_5_15_r236 - - -Answer changes --------------- - -Changes answers relative to baseline: All CLM50 and CLM45-transient - - Summarize any changes to answers, i.e., - - what code configurations: All CLM50 compsets and any transient cases with CLM45 - Also coupled crop cases - - what platforms/compilers: All - - nature of change: - Adjusted climate for CLM50 and changes to harvesting for CLM45 - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - - modifyphoto_and_lmr_forcrop TRUE for CLM50 - stomatalcond_method Medlyn2011 for CLM50 with PHS - limit_irrigation_if_rof_enabled TRUE for CLM50 - Following values modified for CLM50 cases - modify baseflow_scalar, rh_low, bt_min, bt_max, cli_scale, boreal_peatfire_c, pot_hmn_ign_counts_alpha - non_boreal_peatfire_c, cropfire_a1, lfuel, cmb_cmplt_fact, irrig_threshold_fraction, - n_melt_glcmec, br_root, initial_Cstocks_depth - Update CLM50 paramsfile, fsurdat-f09-2000-crop, flanduse_timeseries-f45-hist/f10-hist - M components/clm/bld/CLMBuildNamelist.pm ------------------------- Make sure local finidat defined for cold start - allow nofail for use_init_interp and init_interp_attributes - - M components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC/user_nl_clm - Use \! for comment - - M components/clm/src/biogeochem/CNPhenologyMod.F90 ----------- Use radiation time-step rather than dt for Fertilization - M components/clm/src/biogeochem/CNFireBaseMod.F90 ------------ Change ufuel default - M components/clm/src/biogeochem/dynHarvestMod.F90 ------------ Only harvest up to 98% and divide by sum of several - terms rather than just deadstem (Peter Lawrence) - M components/clm/src/biogeochem/ch4FInundatedStreamType.F90 -- Modify endrun call - M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 ----- Slash flux to litter and CWD - M components/clm/src/biogeochem/CNFireLi2016Mod.F90 ---------- Change if statement from check on forcing temp non-freezing - to tsoi17 non-freezing (From Fang Li) - M components/clm/src/biogeochem/ch4Mod.F90 ------------------- Add ability to read in FWS_TWS_A/B terms from surface - dataset and use for calculation of finundated based on TWS rather than use exponential inversion on ZWT - M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 ------ Add slash harvest flux fields (Peter Lawrence) - M components/clm/src/biogeochem/CropType.F90 ----------------- Only do baset_map_latvary for spring wheat and sugarcane - both irrigated and non. - M components/clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 - If crops have hit peaklai, then set leaf allocation to small value - make sure leafn_to_retransn, frootn_to_retransn and livestemn_to_retransn is positive - M components/clm/src/biogeophys/PhotosynthesisMod.F90 -------- Let lnc max out at 10 - -=============================================================== -=============================================================== -Tag name: clm4_5_15_r236 -Originator(s): erik (Erik Kluzek) -Date: Mon May 1 01:42:23 MDT 2017 -One-line Summary: New surface datasets, and landuse.timeseries files, as well as interpolating initial conditions for almost all cases - -Purpose of changes ------------------- - -New fsurdat and landuse.timeseries datasets for almost all resolutions. -New initial conditions datasets pointed to as much as possible for all resolutions (have ability to turn off to COLDSTART for some tests). -Normally model will now die, if it can't find initial conditions to interpolate from. -Reasonable f09 and f19 PE layout for cheyenne. Fix another issue on Cheyenne. Add new pgi/intel tests for hobart. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2445 -- ED not working with new datasets - 2444 -- dimensional change in URBAN_AC/URBAN_HEAT for interpolation of restart files - 2441 -- fire emissions on cheyenne - 2291 -- fire emissions with gnu compiler sometimes NaN, sometimes change answers for trivial changes - 2239 -- need new initial conditions files with extra metadata on them - -Known bugs introduced in this tag (include bugzilla ID): - 2447 -- Floating overflow for CLM50CROP case on hobart_nag in Photosynthesis - #1215 -- (in this version of cime) TestStatus sometimes needs to have write permission added - #? -- manage_case doesn't work - #? -- ./xmlquery --list-all doesn't work - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - - All initial conditions have to be interpolated now, but there are ones that can be interpolated from for standard cases - NOTE NOW IF YOU WANT TO DO A COLD START USING ARBITRARY INITIAL CONDITIONS SET CLM_FORCE_COLDSTART=on - Also the model will normally fail if it can't find initial conditions close enough to interpolate from - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): A close finidat file will almost always be set - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): New fsurdat/finidat/landuse.timeseris - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: New pgi/intel tests for hobart - - Expected fails removed: bug 2239, 2291, and added SMS_Ld5_D_P24x1.f10_f10.IHISTCLM50BGC.hobart_nag.clm-monthl for bug 2447 - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - PASS - yellowstone_pgi - PASS - yellowstone_gnu (clm45 only) - PASS - hobart_nag --- OK - hobart_pgi --- OK - hobart_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_15_r235 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Almost all CLM45 and CLM50 configurations because of new datasets - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): similar climate - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: - ------- No longer need vrtlay_interp testmods, nor user_nl_clm for some -D components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropColdStart/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/user_nl_clm -------- Reduce size of files -D components/clm/tools/mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c121107.nc -D components/clm/tools/mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c121107.nc - -List all files added and what they do: - ------------- New test-mods with specific initial conditions -A components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/defaultf09IC -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropf10IC -A components/clm/tools/mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c170430.nc -A components/clm/tools/mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c170430.nc - -A components/clm/cime_config/testdefs/testmods_dirs/clm/allActive/shell_commands - CLM_FORCE_COLDSTART=on -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropColdStart/shell_commands - CLM_FORCE_COLDSTART=on -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/shell_commands - CLM_FORCE_COLDSTART=on - ------------- New unit test for surfrdUtilsMod subroutines -A components/clm/src/main/test/surfrdUtils_test/test_surfrdUtils.pf -A components/clm/src/main/test/surfrdUtils_test/CMakeLists.txt - -List all existing files that have been modified, and describe the changes: - -M components/clm/bld/CLMBuildNamelist.pm ---------------------------- Add better handling of finding finidat files - either with an exact match or interpolated from -M components/clm/bld/unit_testers/build-namelist_test.pl ------------ Add new failure tests, fix ed-test -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -- Add init_interp_how_close and init_interp_sim_years -M components/clm/bld/namelist_files/namelist_defaults_overall.xml --- Start type is startup (requires finidat) for CLM45/CLM50 - unless use_cndv is on -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ---- init_interp_how_close=75 and init_interp_sim_years=1850,2000 - new 2-deg IC files IGM1850GSWCLM50BGCCROP, I1850CRUCLM45BGC, IGM2000GSWP3CLM50BGCCROPIRR, ICRUCLM45SP - redone 2-deg ICLM45BGCCROP - create_crop_landunit on unless ED is on - updated: fsurdat, flanduse.timeseries for all but 1x1_smallville_IA and 0.125x0.125 - -M components/clm/cime_config/testdefs/ExpectedTestFails.xml -- ICLM45VIC.yellowstone now PASS - SMS_Lm25.f19_g16.ICLM45BGCCROP.yellowstone_gnu now PASS, new fail SMS_Ld5_D_P24x1.f10_f10.IHISTCLM50BGC.hobart_nag.clm-monthly - -M components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm - remove finidat and init_interp_fill_missing_with_natveg -M components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/user_nl_clm - set fsurdat, create_crop_landunit -M components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm ------ create_crop_landunit = .false. -M components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsROA/shell_commands - CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/edTest/user_nl_clm ------ remove finidat='' -M components/clm/cime_config/testdefs/testmods_dirs/clm/allActive/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/ptsROA/shell_commands - CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/shell_commands - CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/shell_commands - CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm - new finidat -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/README -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_clm - remove finidat -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/README -M components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLA/shell_commands - CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLB/shell_commands - CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm - remove finidat, - init_interp_fill_missing_with_natveg -M components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/shell_commands- CLM_FORCE_COLDSTART=on -M components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/README -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm - new finidat -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - remove finidat -M components/clm/cime_config/testdefs/testlist_clm.xml -- new pgi/intel hobart tests, vrtlay_interp->vrtlay, - use defaultf09IC cropf10IC for two LII tests -M components/clm/cime_config/user_nl_clm ----------- Fix documentation of irrigate, add note to use CLM_FORCE_COLDSTART - rather than finidat=' ' -M components/clm/cime_config/config_component.xml - HIST and 2000 compsets for BGCCROP turn irrigation on -M components/clm/cime_config/config_pes.xml -- Add f09 and f19 PE layouts for cheyenne - -M components/clm/src/biogeochem/FireEmisFactorsMod.F90 - Copy crop factors from generic crop CFT's - -M components/clm/src/main/test/CMakeLists.txt ---------- Add new unit test -M components/clm/src/main/surfrdUtilsMod.F90 ----------- Add renormalize and convert_cft_to_pft functions - lighten tolerence for sums to equal 1 from 1.e-14 to 1.e-13 -M components/clm/src/main/surfrdMod.F90 ---------------- Add surfrd_pftformat, surfrd_cftformat to read in old/new formats - for CFT or PFT, also handle conversion of new CFT format to PFT format for ED -M components/clm/src/biogeophys/EnergyFluxType.F90 ----- For CLM50 urban add _L to URBAN_AC/HEAT to restart files, - so CLM45 won't be confused with CLM50 - -=============================================================== -=============================================================== -Tag name: clm4_5_15_r235 -Originator(s): sacks (Bill Sacks) -Date: Thu Apr 27 07:47:50 MDT 2017 -One-line Summary: Zero dynbal fluxes if namelist variable is set - -Purpose of changes ------------------- - -Some fully-active system tests were dying due to too-large sensible heat fluxes -(thousands or 10s of thousands of W m-2) generated from the dynbal -adjustments. These large fluxes arose because these tests trigger daily dynamics -of CISM (via the test_coupling namelist option), rather than the typical annual -coupling. The annual dribblers see these mid-year adjustments and apply them all -in a single time step, rather than spreading them throughout the year. - -The changes in this tag allow you to set a namelist variable -(for_testing_zero_dynbal_fluxes) to force the dynbal fluxes to zero. Typically, -this namelist variable should only be used for testing: setting it to -.true. breaks water and energy conservation. We will set this to true in the -fully-active tests that use daily CISM dynamics. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- new namelist variable, for_testing_zero_dynbal_fluxes; should only be used for - testing - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_15_r234 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Changes as described above -M components/clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_15_r234 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri Apr 14 08:34:22 MDT 2017 -One-line Summary: Update rtm and mosart externals - -Purpose of changes ------------------- - -Update externals to rtm1_0_61 and mosart1_0_23. - -Includes change to python build-namelist (rtm, mosart), histfile -bugfix (rtm, mosart), and science bugfix / changes (mosart). - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2434 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - - python build namelist for rtm will no longer automatically point rtm - to a clm restart file. rtm should be configured to generate and read - it's own restart files. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) : none - - ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - -rtm was not outputing a restart file for the ref run in SSP tests, but -was attempting to read one during the second run because of -build-namelist changes in rtm1_0_60. All SSP tests in aux_clm45 and -prebeta were changed to use a new test mod, rtmColdSSP, that forces -rtm to do a cold start when coming out of spinup. - -Old RCP/clm40 tests that were not compatible with new rtm -build-namelist behavior were removed. - -Code reviewed by: self, discussion with Erik Kluzek. - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - n/a, not run - - unit-tests (components/clm/src): - - yellowstone - n/a, not run - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - All tests passed bit for bit except: - - * expected failures - - * Tests with mosart passed functionality, answer changing as expected. - - * SSP tests passed functionality, but don't have baselines - because of test-mod change. Manually ran cprc to compare with - clm4_5_15_r233, files were reported as identical. - - e.g. cprnc clm4_5_15_r233/SSP_D_Ld10.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default/clm2.h0.0001-01-06-00000.nc clm4_5_15_r234-prelim/SSP_D_Ld10.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-rtmColdSSP/clm2.h0.0001-01-06-00000.nc - - -CLM tag used for the baseline comparisons: clm4_5_15_r233 - - -Answer changes --------------- - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all runs with mosart - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): unknown, assumed same climate. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - mosart1_0_23 was reviewed by Sean Swenson and Dave Lawrence in - a long coupled run and approved. - - URL for LMWG diagnostics output used to validate new climate: none - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): - -rtm1_0_61, mosart1_0_23 - -List all files eliminated: none - -List all files added and what they do: - -New test mod so rtm will do a cold start during SSP tests. - -A clm/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP -A clm/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/include_user_mods -A clm/cime_config/testdefs/testmods_dirs/clm/rtmColdSSP/user_nl_rtm - -List all existing files that have been modified, and describe the changes: - -Remove old RCP/clm40 tests that were not compatible with new rtm -behavior. Update SSP tests in aux_clm45 and prebeta to use new -rtmColdSSP testmod. - -M clm/cime_config/testdefs/testlist_clm.xml - - -=============================================================== -=============================================================== -Tag name: clm4_5_15_r233 -Originator(s): erik (Erik Kluzek) -Date: Tue Apr 11 23:30:45 MDT 2017 -One-line Summary: Pull out some constants and options to namelist - -Purpose of changes ------------------- - -Pull out a list of constants and options to namelist control. Decrease a few error tolderances. -Add in reseed_dead_plants namelist option, so can reseed dead plants for BGC on a restart. -Reenable LND_TUNING_MODE, although currently set the same for all options. Add some new -compsets in. Fix a few bugs, including Jim Edward's fix for vector output. -Start adding in the stream option for finundated. Add option to turn Medlyn photosynthesis on. -Replace & with & in namelist_definition_clm4_5.xml - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2440 Remove use of mct_gsmap_op and replace with mct_gsMap_orderedPoints - 2430 Problem with units on new landuse.timeseries datasets - 2184 vector (1d) history output crashes for some fields - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): Added new parameters to namelist - New namelists: cnvegcarbonstate and cn_general - New namelist items: - modifyphoto_and_lmr_forcrop, stomatalcond_method, lfuel, ufuel, cmb_complt_fact, - initial_Cstocks_depth, ndep_taxmode, ndep_varlist, init_interp_attributes, reseed_dead_plants, - initial_vegC, finundation_method - New output history variables: Remove RSCANOPY unless use_ed add: VCMX25T, JMX25T, TPU25T - New compsets I1850GSWCLM50BGCCROP, IM1850GSWCLM50BGCCROP, IGM1850GSWCLM50BGCCROP, IGMHISTGSWCLM50BGCCROP - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): params files - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (183 test fail comparison to previous namelists) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_15_r232 - - -Answer changes --------------- - -Changes answers relative to baseline: None bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: - --------- Start adding ability to read finundated streams data (currently disabled) - A components/clm/src/biogeochem/ch4FInundatedStreamType.F90 - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/CLMBuildNamelist.pm --- Add setup_logic_cnvegcarbonstate, - new namelists: cnvegcarbonstate and cn_general, refactor how finidat files - were being found to a better more general methodology that allows a second - go to find finidat file to interpolate from (currently disabled) - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ---- New settings: - modifyphoto_and_lmr_forcrop, stomatalcond_method, use_init_interp, init_interp_attributes - initial_Cstocks_depth, initial_vegC, and new params file with medlynslope/intercept - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -- New namelist items: - modifyphoto_and_lmr_forcrop, stomatalcond_method, lfuel, ufuel, cmb_complt_fact, - initial_Cstocks_depth, ndep_taxmode, ndep_varlist, init_interp_attributes, reseed_dead_plants, - initial_vegC, finundation_method - M components/clm/bld/unit_testers/build-namelist_test.pl -- Test that use_init_interp=.true. with - finidat blank is fails - - M components/clm/cime_config/config_component.xml - Set LND_TUNING_MODE by compset - M components/clm/cime_config/config_compsets.xml -- Add: I1850GSWCLM50BGCCROP, IM1850GSWCLM50BGCCROP, - IGM1850GSWCLM50BGCCROP, IGMHISTGSWCLM50BGCCROP compsets - - M components/clm/src/biogeochem/CNBalanceCheckMod.F90 --- Decrease carbon error tolerance from 1xe-8 to 1xe-7 - and nitrogen error tolerance from 1xe-4 to 1xe-3 - M components/clm/src/biogeochem/CNFireBaseMod.F90 ---------- Add lfuel, ufuel, cmb_cmplt_fact to namelist - M components/clm/src/biogeochem/CNVegCarbonStateType.F90 --- Add InitReadNML and read in initial_vegC in - new cnvegcarbonstate namelist, handle reseeding with reseed_patch filter - M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 - Handle reseeding with reseed_patch filter for - restart read - M components/clm/src/biogeochem/CNVegStateType.F90 --------- Handle reseeding with reseed_patch filter for - M components/clm/src/biogeochem/CNVegetationFacade.F90 ----- Add namelist read CNReadNML for cn_general - and reseed_dead_plants option, pass it and/or reseed filter down as appropriate - M components/clm/src/biogeochem/CropType.F90 ------ Check validity of baset_mapping, set latbaset_patch to nan - if not used, switch logic of how activated - M components/clm/src/biogeochem/ch4varcon.F90 ----- Make default private, explicitly make items public as needed - add finundation_mtd and valid settings, read finundation_method in namelist and check it - M components/clm/src/biogeochem/dynHarvestMod.F90 - Validate units of harvest fields abort if not right - - M components/clm/src/biogeophys/CanopyStateType.F90 --- Only send RSCANOPY to history if use_ed is on - M components/clm/src/biogeophys/PhotosynthesisMod.F90 - Add: stomatalcond_mtd, modifyphoto_and_lmr_forcrop namelist - items, add extra history output: VCMX25T, JMX25T, TPU25T - - M components/clm/src/main/GetGlobalValuesMod.F90 - Replace mct_gsMap_orderedPoints for mct_gsMap_OP - M components/clm/src/main/histFileMod.F90 -------- Fix for bug 2184 from Jim Edwards - M components/clm/src/main/init_hydrology.F90 ----- Call init_root_moist_stress - M components/clm/src/main/ncdio_pio.F90.in ------- Replace mct_gsMap_orderedPoints for mct_gsMap_OP - M components/clm/src/main/ndepStreamMod.F90 ------ Add: ndep_taxmode, ndep_varlist to namelist - M components/clm/src/main/pftconMod.F90 ---------- Add: medlynslope/intercept to data/alloc/read/clean - - M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 ------ Use decomp_cascade_con%initial_stock_soildepth - in place of hardcoded 0.3 - M components/clm/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 ------- Increase error tolerence allowed - for endrun for too much NH4 uptake predicted by FUN - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 -- Add initial_Cstocks_depth to namelist - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 - Add initial_stock_soildepth set to 0.3 - - M components/clm/src/unit_test_stubs/csm_share/mct_mod_stub.F90 - Replace mct_gsMap_OP with mct_gsMap_orderedPoints - - M components/clm/src/utils/quadraticMod.F90 - Allow for situations where a sqrt of a slightly negative number - would crash the code. - -=============================================================== -=============================================================== -Tag name: clm4_5_15_r232 -Originator(s): erik (Erik Kluzek) -Date: Wed Apr 5 23:04:37 MDT 2017 -One-line Summary: Some small changes that affect both clm4_5 and clm5_0 answers (can be considered bug fixes to clm4_5) - -Purpose of changes ------------------- - -A set of some small changes that affect answers for both CLM45 and CLM50. A fix to a rare problem where soil albedo -could go negative from Keith Oleson and Sean Swenson, by making sure a calculated value could not go below a small value. -A change from Will Weider to lower leaf maintence respiration (LMR) for low LAI. Always calculate btran2 even for low -temperatures and/or low liquid water this lowers fires in boreal forests. For crop at peak LAI set hui to max of hui and -huigrain. Change the handling of GDDPLANT accumulator field from Keith Oleson. Get rid of the use_voc logic that just -prevented MEGAN from activating for crop, since now MEGAN handles the crop case (since clm4_5_13_r204). - -Bugs fixed or introduced ------------------------- - 2437 -- lower leaf maintence respiration for low LAI - 2436 -- some adjustments to crop - 2435 -- always calculate btran to lower fires in boreal forests - 2431 -- Rare condition under which soil albedo goes negative - 2368 -- Remove use_voc as MEGAN can now work with crop - -Bugs fixed (include bugzilla ID): - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self, oleson, dll, dlawren, wweider, fangli - -Did you follow the steps in .CLMTrunkChecklist: Yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_14_r231 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeophys/SurfaceAlbedoMod.F90 --- Fix bug 2431 where soil albedo can got negative - make sure a calculated value doesn't go too small - M components/clm/src/biogeophys/PhotosynthesisMod.F90 -- Add check for divide by zero fo lnc, reduce - lmr for low LAI - M components/clm/src/biogeophys/SoilMoistStressMod.F90 - Always calculate btran2 even for low temperature - and/or low liquid water this lowers fires in boreal forests - M components/clm/src/biogeochem/CNPhenologyMod.F90 ----- For crop at peak lai set hui to max of hui and huigrain - M components/clm/src/biogeochem/CropType.F90 ----------- Change handling of GDDPLANT - ------------ Remove use_voc logic - M components/clm/src/cpl/clm_cpl_indices.F90 ----------- Remove use_voc - M components/clm/src/main/clm_instMod.F90 -------------- Remove use_voc - M components/clm/src/main/controlMod.F90 --------------- Remove use_voc - M components/clm/src/main/clm_varctl.F90 --------------- Remove use_voc - M components/clm/src/main/clm_driver.F90 --------------- Remove use_voc - M components/clm/src/main/lnd2atmMod.F90 --------------- Remove use_voc - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r231 -Originator(s): sacks (Bill Sacks) -Date: Sun Apr 2 19:36:02 MDT 2017 -One-line Summary: Add option to reset snow pack over non-glacier columns - -Purpose of changes ------------------- - -When going from a CLM spinup under one set of atmospheric forcings to a -different set of atmospheric forcings, there is the possibility that columns -that reached large snow depths in the spinup should really have only seasonal -snow cover under the new atmosphere. This is a particular concern for the LIWG -in some areas of Greenland that have only seasonal snow cover: there is a -concern that the offline spinup can bake in too-high snow cover in some -regions. This can especially be a problem because of feedbacks: starting out -with a too-high snow cover can cool the overlying atmosphere, leading to -persistence of the snow pack. This is also a problem because, once the snow pack -becomes very deep, it seems that its refreezing can make it less likely that the -snow pack will ever melt. - -To deal with these issues, this tag introduces a new namelist item, -reset_snow. This is typically .false. If you set it to .true., then all snow in -non-glacier columns is reset to 35 mm SWE over the first few time steps of the -run. - -This resetting is accomplished via the snow capping mechanism. This -implementation was chosen because it is challenging to reset the snow pack -directly, since there are so many snow-related variables that must be kept in -sync. The snow capping mechanism already handles this properly, so it's easiest -to reuse this mechanism. However, unlike standard snow capping, the flux of snow -lost through this resetting is sent into a new flux that simply disappears into -nothingness - rather than being sent to glc and/or rof. Thus, note that - by -design! - the flux from this snow resetting breaks conservation: We do not want -this lost snow to affect ocean circulation, since this is essentially just a -mechanism for adjusting an initial conditions file. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Specifying reset_snow = .true. will lead to a loss of conservation for the - first few time steps of the run - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variable: reset_snow - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Leo van Kampenhout reviewed an initial prototype - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok - tests pass; namelists differ from baseline, as expected - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, NLCOMP failures as expected - -CLM tag used for the baseline comparisons: clm4_5_14_r230 - - -Answer changes --------------- - -Changes answers relative to baseline: no - bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: - -List all files added and what they do: - -========= Unit test of new logic -A components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_SnowCappingExcess.pf - -List all existing files that have been modified, and describe the changes: - -========= Changes as described above -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/src/biogeophys/LakeHydrologyMod.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 -M components/clm/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r230 -Originator(s): sacks (Bill Sacks) -Date: Fri Mar 31 16:25:49 MDT 2017 -One-line Summary: Fix dynamic landunits water and energy conservation - -Purpose of changes ------------------- - -Fixes water and energy conservation with dynamic landunits. This conservation -works by summing the water and energy contents of each grid cell before and -after the dynamic landunits transitions, then dealing with the difference -through runoff and sensible heat fluxes. However, the code for counting the -water and energy contents was wrong - slightly wrong for water, and -substantially wrong for energy. The energy counts were 6 orders of magnitude too -small, and also were missing some terms. - -This tag fixes these counts, and reconciles the dynamic landunits water and -energy accounting with the accounting done for the balance checks. It also -refactors some of the code used in the balance checks to facilitate code sharing -between various places. - -Also: adds wa_col (water in the unconfined aquifer) to the list of fields copied -to newly-initializing columns, to avoid spurious dynlu adjustment fluxes due to -changes in wa_col. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): [If none, remove this line] -- https://github.com/NCAR/CLM/issues/2 - Count energy of water in lakes in total - gridcell heat content -- https://github.com/NCAR/CLM/issues/3 - Perform gridcell-level water balance - checks bracketing the entire run loop - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- Some renamed history variables: see below - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: not investigated, but no major changes expected - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Dave Lawrence and Keith Oleson reviewed the new code -conceptually for scientifc correctness; Ryan Knox reviewed a slightly older -version of the new code for counting water and energy contents - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, answers change as expected - -CLM tag used for the baseline comparisons: clm4_5_14_r229 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - (1) Roundoff-level changes for all cases - - (2) Large changes in diagnostics of total gridcell water and total gridcell - heat, due to various fixes - - (3) Dynamic landunit water adjustments change substantially for glacier - transitions, and somewhat for transient crops - - (4) Dynamic landunit heat adjustments change substantially for all runs with - dynamic landunits (transient glacier, transient crop): change by about - 6 orders of magnitude - - (5) Changes in transient crop cases due to copying wa_col to - newly-initiating columns (though answer changes may be minor for clm5 - cases?) - - (6) Possibly other changes that I'm forgetting? - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Moved code that sums water and energy contents to here, to facilitate - code sharing; added unit tests for *some* of it -A components/clm/src/biogeophys/TotalWaterAndHeatMod.F90 -A components/clm/src/biogeophys/test/TotalWaterAndHeat_test/test_total_water_and_heat.pf -A components/clm/src/biogeophys/test/TotalWaterAndHeat_test/CMakeLists.txt -A components/clm/src/biogeophys/test/TotalWaterAndHeat_test - -List all existing files that have been modified, and describe the changes: - -========= Major rework: Use new shared routines for calculating heat and water - contents; adjust dynlu adjustment heat flux based on heat content of - dynlu adjustment runoff flux -M components/clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 - -========= Copy wa_col (water in the unconfined aquifer), to avoid large adjustments -M components/clm/src/dyn_subgrid/dynInitColumnsMod.F90 -M components/clm/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf - -========= Use new routines for water content -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 - -========= New constant for baseline wa_col (water in the unconfined aquifer), - replacing hard-coded constants -M components/clm/src/main/clm_varcon.F90 -M components/clm/src/biogeophys/SoilHydrologyMod.F90 -M components/clm/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 - -========= For performance: introduce col%hydrologically_active, used in place of - is_hydrologically_active function call -M components/clm/src/main/ColumnType.F90 -M components/clm/src/main/filterMod.F90 -M components/clm/src/main/initSubgridMod.F90 -M components/clm/src/main/glcBehaviorMod.F90 - -========= Changes to diagnostic fields: Remove incorrect HCSOI, HC; rename - GC_HEAT1 and GC_HEAT2 to HEAT_CONTENT1 and HEAT_CONTENT2; add - HEAT_CONTENT1_VEG; add LIQUID_WATER_TEMP1 -M components/clm/src/biogeophys/TemperatureType.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/biogeophys/LakeTemperatureMod.F90 - -========= Changes to diagnostic fields: Rename GC_LIQ1/2 to LIQUID_CONTENT1/2, - and similar for ICE; also remove some now-unused fields -M components/clm/src/biogeophys/WaterStateType.F90 - -========= Minor changes to some calls -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/main/clm_driver.F90 - -========= New stub routines -M components/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90.in - -========= New unit tests -M components/clm/src/biogeophys/CMakeLists.txt -M components/clm/src/biogeophys/test/CMakeLists.txt - -========= Add some comments -M components/clm/src/main/subgridAveMod.F90 -M components/clm/src/main/column_varcon.F90 - -========= Remove unneeded use statements and associates -M components/clm/src/biogeophys/UrbanParamsType.F90 -M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M components/clm/src/main/initVerticalMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r229 -Originator(s): erik (Erik Kluzek) -Date: Fri Mar 10 11:32:20 MST 2017 -One-line Summary: Update cime and make some changes to drv_flds_in namelist, fix some minor bugs - -Purpose of changes ------------------- - -Update cime to a version with an updated top level directory structure. It also fixes a problem -with a CLM test. - -The new cime version has a new directory structure, and updates the XML schema for namelist files -from verison 1 to version 2. Currently the perl namelist code can NOT read version 2. Hence, a local -copy of the version 1 files for the drv_flds_in fields was added to CLM. Also the use of the datm -namelist files for some tools was dropped -- I think that's OK though. - -Fix two minor bugs. - -The new cime has a few improvements. It now adjusts the PIO namelist when the PE layout changes. -There's a new option to case.setup "--no-adjust-pio" to not do that. --mpilib option was added -to create_test. You can remove your bld directory area without having to rerun case.setup. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2433 -- format error in HumanIndexMod.F90 - 2432 -- intent mixing in dynVarMod.F90 -CIME Issues fixed (include issue #): - 1074 -- ERP_D_Ld5.hcru_hcru.ICRUCLM45BGC.yellowstone_pgi fails with PIO error - -Known bugs introduced in this tag (include bugzilla ID): (recently found, but predate this tag) - 1217 -- Driver allows a contradiction in drv_flds_in between CAM and CLM - 1220 -- missing mpi-serial mpirun case on hobart - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - - case.setup has a new option --no-adjust-pio - - The user now can rm -rf their build area and rebuild without having - to re-run case.setup. - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - - CIME now normally adjusts PIO layout if you change the PE layout. - - Also puts a copy of namelist definition and defaults for drv_flds_in in CLM. - This copy needs to be doubly maintained with the versions in the driver and in CAM. - The advantage of having a copy is because each copy is using a different version of - the xml schema, and potentially the driver might have additional fields that interact - with other components besides CLM. Currently the only drv_flds_in fields are all shared - between only CAM and CLM. But, the fact that there are duplicated copies does mean - changes in any one of those components will need to go into the other two. - - Also removes the datm namelist files read in tools such as queryDefaultNamelist.pl. - I think this is OK, as this connection may no longer be needed. It does make the - listDefaultNamelist.pl less useful, but I think that's OK as well. - -Changes to tests or testing: - - add --mpilib option to create_test - -Code reviewed by: self,mvertens - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular, tools - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - OK - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - OK - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_14_r226 - - -Answer changes No bit-for-bit --------------- - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime, cime_config - Update cime to cime5.3.0-alpha.02 - Add new cime_config at cime_config0.0.1.alpha.03 - -List all files eliminated: None - -List all files added and what they do: These are version 1 of the files, the ones in the driver - are now version 2. - -A components/clm/bld/namelist_files/namelist_definition_drv.xml ------- Copy from driver -A components/clm/bld/namelist_files/namelist_definition_drv_flds.xml -- Copy from driver -A components/clm/bld/namelist_files/namelist_defaults_drv.xml --------- Copy from driver - -List all existing files that have been modified, and describe the changes: - ------------- Point to new local copy of drv_flds namelist files, and bunch of whitespace changes ------------- Remove pointing to datm namelist files as they are now version 2, and the perl code ------------- currently can't read them -M components/clm/bld/queryDefaultNamelist.pl ------ Point to local location of namelist drv files - and remove pointing to datm namelist files -M components/clm/bld/CLMBuildNamelist.pm ---------- Point to local location of namelist drv files -M components/clm/bld/listDefaultNamelist.pl ------- Point to local location of namelist drv files - and remove pointing to datm namelist files - -M components/clm/cime_config/testdefs/ExpectedTestFails.xml Remove hcr_hcru test that is now passing - ------------- Get unit tests working with the new cime directory structure -M components/clm/src/CMakeLists.txt ----------------------------- New cime directory structure -M components/clm/src/unit_test_stubs/csm_share/seq_comm_mct.F90 - Just change comment as to where - the "real" file exists - ------------- Fix a couple of bugs -M components/clm/src/biogeophys/HumanIndexMod.F90 --- Fix bug 2433 format error -M components/clm/src/dyn_subgrid/dynVarMod.F90.in --- Fix bug 2432 intent issue - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r228 -Originator(s): erik (Erik Kluzek) -Date: Tue Mar 7 14:17:07 MST 2017 -One-line Summary: Bring in changes that were accidentally dropped as part of the clm4_5_14_r226 tag - -Purpose of changes ------------------- - -Bring in changes that were included for the testing of clm4_5_14_r226, but accidentally dropped -when moved to the trunk tag. Only a limited amount of testing was done, since the testing was -done in the clm4_5_14_r226 tag. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: None - -Changes to tests or testing: None - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: short, since full testing was done in clm4_5_14_r226 - -CLM tag used for the baseline comparisons: clm4_5_14_r227 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ----------- Remove --phys option to PTCLM testing -M components/clm/test/tools/nl_files/PTCLM_USUMB_clm4_5 -M components/clm/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 -M components/clm/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 - -M components/clm/cime_config/config_component.xml ------------ Remove unnneeded "" -M components/clm/cime_config/testdefs/ExpectedTestFails.xml -- Add note about hcru_hcru failing test -M components/clm/cime_config/testdefs/testlist_clm.xml ------- Add a test with MOSART on hobart_nag -M components/clm/src/biogeophys/SnowSnicarMod.F90 ------------ Fix bug 2479 workaround for Intel 16/17 compiler -M components/clm/src/main/initGridCellsMod.F90 --------------- Fix bug 2417 for create_crop_landunit - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r227 -Originator(s): sacks (Bill Sacks) -Date: Mon Mar 6 09:42:41 MST 2017 -One-line Summary: Improve performance of dynamic landunits code - -Purpose of changes ------------------- - -Main change is to improve the performance of the column state updates portion of -the dynamic landunits code. In optimized, global runs, this piece of the code -(dyn_cnbal_col) was taking 3 - 5% of total CLM runtime. Its cost was greater in -global debug runs (~ 10 - 15%), and even greater in single-point debug runs (30 -- 40%). - -Here I have introduced a variable that tracks whether there are any changes in -area in this time step for each clump; if not, then it avoids doing most of the -work in dyn_cnbal_col. - -This tag also fixes the fortran unit tests with the new cime version: the -necessary changes were accidentally dropped from the last tag. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: 3-4% performance improvement for global, -optimized runs; greater performance improvement for debug and single-point runs - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_14_r226 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as noted above. Primary changes are in - dynColumnStateUpdater, but other modules needed to be changed in order - to pass the clump index down. Eventually, we should be able to get rid - of this clump index tracking, instead having a separate object for - each clump - but that is waiting on a major refactor of how we handle - threading in CLM. -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 -M components/clm/src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/ch4Mod.F90 - -========= Fix unit tests -M components/clm/src/CMakeLists.txt -M components/clm/src/README.unit_testing - -========= Note expected failure that started failing in r226 -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r226 -Originator(s): erik (Erik Kluzek) -Date: Thu Mar 2 15:12:50 MST 2017 -One-line Summary: Update cime, mosart and cism to a version that is cesm2_0_beta05 or part of beta06 - -Purpose of changes ------------------- - -Update cime version and cism to version that similar to that in cesm2_0_beta05, but with many fixes in cime for -clm. Also update mosart to fix a bug on hobart. The update of cism does change answers as it makes CISM2 the -default with the new 4km greenland grid. - -There are some user improvements in the latest cime version. Long term archiving issues are fixed. A file -called CASEROOT is added to your case's $RUNDIR so that you can easily see where your source code is. A few -options were added to create_newcase and create_clone (see details below). - -NOTE: You will need to use the "--run-unsupported" to create_newcase for compsets/grids that aren't tested or supported!!! - -Fix a few other existing bugs. Fix createcrop_landunit to work with the new CLM surface datasets. Bring in a -workaround for a compiler bug with intel 17 and 18. Bring in a version of PTCLM that works with the latest cime. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2417 -- fix createcrop_landunit for new datasets with 16 PFTs - 2418 -- fix grid match for config_compsets.xml (cime issue 1079 still there) - 2424 -- Update mosart to 1_0_20 to fix the nag bug - 2479 -- workaround for intel compiler bug - 2357 -- PTCLM broken in cime5 - -CIME Issues fixed (include issue #): archiving, unit-tests, grid issues, gnu compiler, - cime issues fixed: 1075, 1053, 1051, 1073, 1072, 1089 - -Known bugs introduced in this tag (include bugzilla ID): - 1074 -- hcru_hcru grid no longer works gives PIO error - 1079 -- mask for grid matching - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - Add support for cheyenne - CASEROOT file added to $RUNDIR to show path to source - Add "--run-unsupported" option to create_newcase - Add "--cime-output-root" option to create_clone - Fix long term achiving issues - -Changes made to namelist defaults (e.g., changed parameter values): drv namelist changes - PIO namelists have different defaults - some grids are null and maps are idmap when they aren't needed - clm40 removed from all active compsets - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: Seems to run faster (~20%)! (we don't understand why) - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - Refactoring in cime for unit-testing, add schema files for cime xml files - buildnml faster - config_grids and xmlquery was refactored - -Changes to tests or testing: Add test with mosart on hobart - -Code reviewed by: self, sacks - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - OK - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_14_r225 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes. Compsets with CISM - - Summarize any changes to answers, i.e., - - what code configurations: All with CISM - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - compsets are updated to default to CISM2 and the new 4km greenland grid - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime, cism, mosart, PTCLM - - cime to cime5.2.0-alpha25 - mosart to mosart1_0_20 - cism to cism2_1_29 - PTCLM to PTCLM2_170302 - -List all files eliminated: - - D components/clm/tools/shared - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/cime_config/config_compsets.xml - Workaround in 2418 for cime issue 1079 - M components/clm/test/tools/TSMscript_tools.sh --- Fix arguments sent to TCB scrip - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r225 -Originator(s): sacks (Bill Sacks) -Date: Sun Feb 19 14:42:13 MST 2017 -One-line Summary: Fix GDD accumulation in new crop columns - -Purpose of changes ------------------- - -For newly-initiating crop columns in the middle of a run, the 20-year-average -GDD variables (gdd*20) were not being initialized correctly. They were starting -as spval, and then taking essentially forever to come down to some reasonable -value. This caused major problems for both dynamic landunits and when running -init_interp from one crop run to another, where the new run had some new crop -types - such as going from a run without irrigation to a run with irrigation. - -This tag fixes these problems. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- If you do a CROP run, setting use_init_interp to .true., and pointing to a - previous initial conditions file generated with a crop run (thus having - restyear > 0 on the restart file), then GDD accumulation will get reset. This - means that the first year of your run won't have any crop growth. After this - initial "burn-in" period, it will run fine. This is only an issue when using - initial conditions generated prior to this tag, and is only an issue when - using init_interp. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: New initial conditions file for tests that use -clm50cropIrrigMonth_interp or irrig_spunup testmods - see details below. - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, some expected baseline failures: - - Baseline comparisons fail because GDD accumulation is now fixed for - transient crops: - ERS_Ly3_Mmpi-serial.1x1_smallvilleIA.IHISTCLM50BGCCROP.yellowstone_gnu.clm-cropMonthOutput - ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHISTCLM50BGCCROP.yellowstone_gnu.clm-cropMonthOutput - SMS_D_Ly6_Mmpi-serial.1x1_smallvilleIA.IHISTCLM45BGCCROP.yellowstone_pgi.clm-cropMonthOutput - - These tests point to a previously-spun-up crop file, and use init_interp. I - have adjusted this file to add the new patch-level nyrs_crop_active - variable, which I set to 30 for all active crop PFTs (in agreement with the - old restyear). However, this initial conditions file does not have any - non-irrigated crop PFTs! So crop behavior was wrong in the baseline run, - because non-irrigated crops started with spval gdd*20 values. - SMS_D_P24x1_Ld5.f10_f10.ICRUCLM50BGCCROP.hobart_nag.clm-irrig_spunup - ERP_D_P15x2_Ld5.f10_f10.ICRUCLM50BGCCROP.yellowstone_intel.clm-irrig_spunup - ERP_P60x2_Lm36.f10_f10.ICRUCLM50BGCCROP.yellowstone_intel.clm-clm50cropIrrigMonth_interp - -CLM tag used for the baseline comparisons: clm4_5_14_r224 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - Transient crop cases - - Any crop case for which initial conditions are init_interp'ed from a - previous crop case: nyrs_crop_active is reset to 0 in this case - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Potentially new climate for transient crop cases - - If bitwise differences were observed, how did you show they were no worse - than roundoff? n/a - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: n/a - - URL for LMWG diagnostics output used to validate new climate: n/a - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as noted above -M components/clm/src/main/clm_driver.F90 -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CropType.F90 - -========= Point to new version of initial conditions file - same as old, but - hacked to have nyrs_crop_active patch-level variable: set to 30 for - active crop PFTs, 0 elsewhere. This hack is needed since we run - init_interp for these tests: this allows crops to grow initially. -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r224 -Originator(s): sacks (Bill Sacks) -Date: Fri Feb 10 06:27:53 MST 2017 -One-line Summary: Tweaks for glaciers and snow - -Purpose of changes ------------------- - -A number of answer-changing tweaks for glaciers and snow, mainly with the intent -of improving glacial melt over Greenland in CESM2. - -(1) New longwave downscaling parameterization, based on Van Tricht et al. (2016, - TC) Figure 6, doi:10.5194/tc-10-2379-2016. This uses a simple linear lapse - rate for LW radiation, which seems better supported by observations than the - old approach based on blackbody radiation relationships. Two new namelist - parameters control this behavior: lapse_rate_longwave and - longwave_downscaling_limit. This changes answers for all cases with multiple - elevation classes - i.e., all cases with CISM (IG, etc.), just over the - regions with downscaling (Greenland and Antarctica). This change is from Leo - van Kampenhout. - -(2) Modified the parameterization of snow cover fraction during melt to improve - glacial melt over Greenland in CESM2: - - (a) New value for n_melt (parameter controlling snow cover fraction as snow - melts) over glc_mec columns for CLM5. The previous value of 10 resulted - in near-100% snow cover fraction over glaciers. The new value of 1 - allows snow cover fractions more similar to other landcover - types. n_melt_glcmec is a new namelist parameter. This changes answers - for all CLM5 cases with glc_mec (i.e., with CISM), just over glc_mec - landunits. - - (b) For all landcover types, maintain snow cover fraction at 100% when - h2osno exceeds 2m SWE in CLM5. This is important in conjunction with - (a), in order to avoid snow cover fraction dropping significantly below - 100% when very deep (e.g., 10m) snow packs begin to melt. This is - controlled by a new namelist parameter, int_snow_max, which can be set - to a very large value to retrieve the old behavior. This changes answers - for all CLM5 cases; in principle, it changes answersfor all landunits, - but in practice, this should only matter where we have a very deep snow - pack - typically, just in regions where the snow persists for more than - a year. - - These two changes were proposed in a discussion with Leo van Kampenhout, - Bill Lipscomb, Dave Lawrence and Sean Swenson. - -(3) Set the ddz3 term controlling snow compaction for glaciers and wetlands in - the same way as for soil and crop landunits. This should have been included - in clm4_5_14_r222 (which brought in consistency in the treatment of snow - cover fraction in glacier & wetland landunits), but was overlooked in that - tag. This changes answers for all cases, just over glacier, glacier_mec and - wetland columns. This change was reviewed by Sean Swenson and Leo van - Kampenhout. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variables: - - lapse_rate: the temperature lapse rate for downscaling over ice sheets - (default kept the same as before, though there may be roundoff-level - differences due to the precision of the namelist parameter) - - lapse_rate_longwave: the longwave radiation lapse rate for downscaling over - ice sheets - - longwave_downscaling_limit: the relative limit capping longwave radiation - downscaling - - n_melt_glcmec: the value of n_melt (parameter controlling snow cover fraction - as snow melts) over glc_mec columns - - int_snow_max: limit applied to integrated snowfall when determining changes in - snow-covered fraction during melt -- INT_SNOW diagnostic now inactive by default - -Changes made to namelist defaults (e.g., changed parameter values): Some of the -new namelist variables have defaults different from the previous hard-coded -values, but no changes to existing namelist defaults. - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: Removed a bunch of no-longer-used test lists: -aux_clm_ys_intel, aux_clm_ys_pgi, aux_science, aux_scripts, aux_testsystem, -csltiming, aux_rasm - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok - - tests pass, differences as expected - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, but differences from baselines and namelist differences - as expected - -CLM tag used for the baseline comparisons: clm4_5_14_r223 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff. Expect at least small regional climate differences - - specifically over Greenland and Antarctica. - - Answer changes are from: - - (1) New longwave downscaling parameterization. This changes answers for all - cases with multiple elevation classes - i.e., all cases with CISM (IG, - etc.), just over the regions with downscaling (Greenland and - Antarctica). - - (2) New value for n_melt over glc_mec columns for CLM5. This changes answers - for all CLM5 cases with glc_mec (i.e., with CISM), just over glc_mec - landunits. - - (3) Modified parameterization of snow cover fraction during melt to maintain - snow cover fraction at 100% when h2osno exceeds 2m SWE in CLM5. This - changes answers for all CLM5 cases; in principle, it changes answersfor - all landunits, but in practice, this should only matter where we have a - very deep snow pack - typically, just in regions where the snow persists - for more than a year. - - (4) Set the ddz3 term controlling snow compaction for glaciers and wetlands - in the same way as for soil and crop landunits. This changes answers for - all cases, just over glacier, glacier_mec and wetland columns. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= New longwave radiation downscaling; make lapse rate a namelist - parameter; refactor unit tests a bit -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/atm2lndType.F90 -M components/clm/src/main/test/atm2lnd_test/test_downscale_forcings.pf -M components/clm/src/main/test/atm2lnd_test/test_partition_precip.pf - -========= Apply int_snow_max; treat ddz3 consistently for glaciers and wetlands -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 - -========= New int_snow_max and n_melt_glcmec namelist variables -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/clm_varcon.F90 -M components/clm/src/main/initVerticalMod.F90 - -========= Add some inactive history fields that just apply over glaciers -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/biogeophys/WaterStateType.F90 - -========= New setup_landunit_ncols utility method -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 - -========= New namelist parameters, as documented above -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm - -========= Remove unneeded use statements -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/clm_instMod.F90 - -========= Remove no-longer-used testlists: aux_clm_ys_intel, aux_clm_ys_pgi, - aux_science, aux_scripts, aux_testsystem, csltiming, aux_rasm. Main - motivation is that lists starting with 'aux_*' now have special - meaning, indicating what compset/grid combinations we test regularly. -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r223 -Originator(s): sacks (Bill Sacks) -Date: Fri Feb 3 10:07:24 MST 2017 -One-line Summary: Handle patch-level C&N variables correctly with dynamic landunits - -Purpose of changes ------------------- - -The infrastructure for handling conservation of patch-level C&N variables when -subgrid weights changed was only considering changes in patch weights on the -COLUMN. For dynamic landunits - where whole columns and landunits can change in -area - this needs to consider changes in patch weights on the GRIDCELL. This tag -makes this change. - -In addition, this makes the fire code work correctly with changing column / -landunit areas: Similarly to the other C&N variables, the variable that triggers -landcover-related fires was previously only considering changes in patch weights -on the column. - -Also, treat patch-level crop-specific variables (grain pools and -cropseed[c/n]_deficit) in DynamicPatchAdjustments routines. C/N in the grain -pool is sent to the crop product pool via a new flux -(dwt_crop_productc_gain_patch / dwt_crop_productn_gain_patch). - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2106: CNFireMod code should be re-evaluated in the presence of dynamic - landunits -- Addresses point 14 in 1679: problems with new CNFireMod - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- Removed history variables: DWT_CLOSS / DWT_CLOSS_DRIBBLED (and similarly for - N). These can be seen with DWT_CONV_CFLUX / DWT_CONV_CFLUX_DRIBBLED - (previously dwt_closs was simply set equal to dwt_conv_cflux). - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changes ciso_bombspike1963 to use monthly output, because this testmod is used - in a long-running test - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, changes answers for some tests as noted below - -CLM tag used for the baseline comparisons: clm4_5_14_r222 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 with transient landcover (HIST, RCP, - DV, IG) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - For transient crop and transient glacier: larger than roundoff, may change - climate slightly - - Without crop: expected to be only roundoff-level changes (I confirmed - this in various ways fo some of the changes; for other changes, I did - not do a careful confirmation that changes were truly just - roundoff-level) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= For some tests that have daily changes in glacier area, bypass the error-checks - that ensure that we only have changes in landcover on the year boundary. -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_clm - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf -M components/clm/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 -M components/clm/src/dyn_subgrid/dynPriorWeightsMod.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - - also, treat initialization of cropseedc_deficit consistently with - grain pools (only initialize if use_crop is .true.) -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 - - also, treat initialization of cropseedc_deficit consistently with - grain pools (only initialize if use_crop is .true.) -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 -M components/clm/src/biogeochem/CNProductsMod.F90 -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 -M components/clm/src/biogeochem/CNFireBaseMod.F90 - -========= Unrelated change: Since we now only initialize cropseedc_deficit when - use_crop is true, make sure we only adjust it over prognostic crop - patches -M components/clm/src/biogeochem/CNC14DecayMod.F90 - -========= Unrelated change: use YEAR_POSITION_START_OF_TIMESTEP for consistency - with other dyn file stuff. This doesn't make any difference for - harvest, now that it's applied once per year at the beginning of the - year, but it seems like we might as well be consistent. -M components/clm/src/biogeochem/dynHarvestMod.F90 - -========= Add create_vegetated_landunit_n_patches to aid unit testing -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 - -========= For some tests that have daily changes in glacier area, bypass the error-checks - that ensure that we only have changes in landcover on the year boundary. -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm -M components/clm/src/biogeochem/CNVegStateType.F90 - -========= Change output to monthly to speed up this long-running test -M components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r222 -Originator(s): sacks (Bill Sacks) -Date: Fri Jan 27 06:14:19 MST 2017 -One-line Summary: Fix energy budget bug with fractional snow on glacier and wetland columns - -Purpose of changes ------------------- - -Leo van Kampenhout discovered a bug in the surface energy budget when there is -fractional snow cover on glacier and wetland columns: frac_sno_eff was being -treated inconsistently for these landcover types. - -Note that the old code did not conserve energy due to this bug! - -The fix slightly increases melt rates over Greenland, and has other minor -effects on the simulation, but not a huge effect. - -More detailed notes on the problem, from Leo, are below. However, note that we -ended up fixing the problem differently from what he suggested - based on Sean -Swenson's suggestion: We fix this by treating glaciers and wetlands the same as -soil with respect to frac_sno_eff. (Note that we still treat lakes differently -[these are handled by different code] and urban differently.) - -Here are the more detailed notes from Leo: - -Background: - -- CLM columns are allowed to have fractional snow cover. - -- The first application of fractional snow cover is to the albedo - calculation. This is done for every landcover type in the same fashion. This - fractional snow cover is referred to as 'frac_sno'. - -- The second type of fractional snow cover is 'frac_sno_eff', which adjusts - surface fluxes other than shortwave radiation, such as sensible and latent - heat. The frac_sno_eff has only been implemented for soil and crop landcover - types. - -- For all other landcovers, such as glaciers, frac_sno_eff =1.0 - -- As such, glaciers can have frac_sno < frac_sno_eff whereas those are otherwise - identical - -Problem: - -- Frac_sno is used to compute absorbed radiation in the soil (sabg_soil) and - snow (sabg_snow). When frac_sno < 1.0, this will lead to a positive value of - sabg_soil at the expense of sabg_snow - -- In other radiation code, notably SoilTemperatureMod.F90, the other definition - of fractional snow cover is used (frac_sno_eff) - -- For glaciers (frac_sno_eff), this means that no radiation is allowed to enter - the soil. To my current understanding, this energy is totally lost: - - eflx_gnet_soil = sabg_soil(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) - lwrad_emit_soil(c) & - - (eflx_sh_soil(p)+qflx_ev_soil(p)*htvp(c)) - - real(r8) , intent(out) :: hs_soil( bounds%begc: ) ! heat flux on soil [W/m2] - - ! separate surface fluxes for soil/snow - hs_soil(c) = hs_soil(c) + eflx_gnet_soil * patch%wtcol(p) - - ! this is the snow/soil interface layer - rt(c,j) = t_soisno(c,j) + fact(c,j) & - *((1._r8-frac_sno_eff(c))*(hs_soil(c) - dhsdT(c)*t_soisno(c,j)) & - + cnfac*(fn(c,j) - frac_sno_eff(c) * fn(c,j-1))) - -BalanceCheckMod: - -- The missing energy should have been detected by BalanceCheckMod, specifically - the check on surface energy balance: - - ! Surface energy balance - ! Changed to using (eflx_lwrad_net) here instead of (forc_lwrad - eflx_lwrad_out) because - ! there are longwave interactions between urban columns (and therefore patches). - ! For surfaces other than urban, (eflx_lwrad_net) equals (forc_lwrad - eflx_lwrad_out), - ! and a separate check is done above for these terms. - - if (.not. lun%urbpoi(l)) then - errseb(p) = sabv(p) + sabg_chk(p) + forc_lwrad(c) - eflx_lwrad_out(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - -- Here, the total absorbed solar radiation is FSA has been been replaced by - sabg_chk. This hides the problem, because sabg_chk itself is also flawed: - - ! save sabg for balancecheck, in case frac_sno is set to zero later - sabg_chk(p) = frac_sno_eff(c) * sabg_snow(p) + (1._r8 - frac_sno_eff(c) ) * sabg_soil(p) - -- With frac_sno_eff = 1.0, this simplifies to sabg_snow. So, sabg_soil is not - accounted for in the surface energy balance check. - -Workaround: - -1. Let all solar soil radiation be absorbed by snow: - -SurfaceRadiationMod: - - if (frac_sno(c) < frac_sno_eff(c)) then - ! LvK: workaround, absorb all soil radiation in snow - sabg_snow(p) = fsa(p) - sabg_soil(p) = 0.0_r8 - end if - -2. Recommended: let the surface energy balance use FSA : - - errseb(p) = sabv(p) + fsa(p) + forc_lwrad(c) - eflx_lwrad_out(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - -Long-term solution: - -- Thought needs to be given on how SW radiation should be treated on partially - covered glacier columns - - -- Allowing radiation to penetrate the soil, yet keeping frac_sno_eff = 1, is a - possibility. This will heat the snowpack from below. - - -- Alternatively, we could look at implementing glacier fractional snow cover for - surface fluxes also. Needs discussion about the physical basis & how to - evaluate this. - - - -Again, note that the final implementation differs from Leo's suggestion - I'm -just giving Leo's original notes for completeness. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson, Leo van Kampenhout, myself - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, but baseline comparisons fail as expected - -CLM tag used for the baseline comparisons: clm4_5_14_r221 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45/CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff; expected to be similar climate (effects are - relatively small) - although there are non-negligible effects on glacier - surface mass balance (SMB). - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r221 -Originator(s): sacks (Bill Sacks) -Date: Tue Jan 24 05:12:14 MST 2017 -One-line Summary: Change rain-snow partitioning and ice albedo for glacier columns - -Purpose of changes ------------------- - -Main change is to change the rain-snow partitioning ramp for glacier columns, -when using clm5 physics: Rather than assuming all snow below 0 C and all rain -above 2 C, for glacier columns we now assume all snow below -2 C and all rain -above 0 C. The main motivation for this change is to increase the -otherwise-too-low glacier melt we have been seeing in recent CESM2 test -runs. The physical justification is: The old partitioning makes sense when you -have a positive atmospheric lapse rate - so slightly-above-freezing temperatures -at the surface are associated with below-freezing temperatures at the cloud -level. However, for glaciers, it is relatively common to have a temperature -inversion. Thus, we would expect a different relationship between near-surface -temperatures and phase of precipitation. This new relationship was proposed and -agreed upon by LIWG leadership, particularly Bill Lipscomb, Jan Lenaerts and Leo -van Kampenhout. - -To implement this change, I have reimplemented the (simple) rain-snow -partitioning code inline, rather than using the csm_share code. In addition, I -have introduced four new namelist parameters controlling its behavior: -- precip_repartition_glc_all_snow_t -- precip_repartition_glc_all_rain_t -- precip_repartition_nonglc_all_snow_t -- precip_repartition_nonglc_all_rain_t - -Also changes ice albedo (albice) for glacier columns from 0.6/0.4 (vis/nir) to -0.5/0.3, when using clm5 physics. This is based on suggestions by Jan Lenaerts, -and agreed upon by the LIWG leadership. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -Four new namelist parameters: -- precip_repartition_glc_all_snow_t -- precip_repartition_glc_all_rain_t -- precip_repartition_nonglc_all_snow_t -- precip_repartition_nonglc_all_rain_t - -Changes made to namelist defaults (e.g., changed parameter values): -- Changed defaults for albice with CLM50 - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- Duplicated code for rain-snow partitioning: in CLM and csm_share (the - csm_share version is used by datm). However, this is just a couple of lines of - code, and it's possible that the CLM version will change in the future, so I - felt that duplication was not a bad thing here. - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok (pass, but differences from baseline for clm45/clm50 as expected) - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, some baseline comparisons fail as noted below - -CLM tag used for the baseline comparisons: clm4_5_14_r220 - - -Answer changes --------------- - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM50 cases - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff; expected to be new climate regionally, but may not - change global climate significantly. I have confirmed via one test that - differences are only over glacier columns. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -MM components/clm/bld/CLMBuildNamelist.pm -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/atm2lndType.F90 -M components/clm/src/main/clm_instMod.F90 -MM components/clm/src/main/controlMod.F90 -M components/clm/src/main/test/atm2lnd_test/test_downscale_forcings.pf -M components/clm/src/main/test/atm2lnd_test/test_partition_precip.pf -M components/clm/src/main/clm_varctl.F90 - -========= Fix unit tests for new interface for initializing atm2lnd -M components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r220 -Originator(s): sacks (Bill Sacks) -Date: Sun Jan 22 14:05:50 MST 2017 -One-line Summary: Fix crop seeding - -Purpose of changes ------------------- - -The implementation of crop seeding made a few months ago didn't handle the -transfers back into the "seed deficit" (cropseedc) pool quite right. In -addition, that implementation didn't treat nitrogen. This tag fixes these -problems. In addition, it separates the seed (deficit) pools into crop seed -deficit and dwt seed deficit, and moves the latter to gridcell level (which is -needed for some upcoming work). - -In the new implementation, when crops are seeded, this is tracked via -cropseedc_deficit_patch and cropseedn_deficit_patch. At the end of the growing -season, these deficits are repaid out of grain c/n, if there is enough available -grain c/n (if there is not enough available, the deficits accumulate until they -can eventually be repaid). Thus, this repayment decreases the fluxes of C & N to -the crop product pools. This new implementation was co-developed with Danica -Lombardozzi. - -In addition, this tag does some other minor cleanup, as noted below. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Seed pools won't restart properly from old initial conditions files. However, - since these seed pools were previously just used as a diagnostic, this won't - affect the evolution of anything except for the seed pools and related summary - variables. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- Removed a few unused diagnostic history variables - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: nothing substantial - -Code reviewed by: Conceptual implementation co-developed with Danica -Lombardozzi (although she has not reviewed the final code) - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; baseline failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_14_r219 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Many CLM45/CLM50, but significant changes only - for CROP - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff / same climate - - Details: - - There are differences from baseline in: - - - Crop product pools and related fluxes, including summary fluxes - (LAND_USE_FLUX, NBP) - - - FCO2 - - - PFT_CTRUNC - changed due to fix in treatment of crop seed (previously, - substantial grain was being truncated) - - - SEEDC / SEEDN - - - STORVEGC / STORVEGN in crop tests - - - Various other summary C/N state variables - - - LITFALL for CLM50 with CROP - - - Other than TOTCOLC / TOTCOLN, greater-than-roundoff diffs just in CROP - tests and tests that have non-blank finidat (latter just in SEEDC & SEEDN, - because we don't read in the current value of SEEDC/SEEDN). Summary - variables have diffs in some CLM45 crop tests as well as CLM50, because of - diffs in which summary variables include seed c/n. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes to crop seed deficit tracking, and moving dwt seed pools - to gridcell level -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 -M components/clm/src/biogeochem/CNNStateUpdate1Mod.F90 -M components/clm/src/biogeochem/CNC14DecayMod.F90 -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 - - Also remove grainc_to_food from LITFALL diagnostic when sending - grain to crop product pool -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - -========= Refactor some loops to support upcoming changes, and remove - no-longer-needed code due to removed variabes -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 - -========= Change arguments used in calling changed routines -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 - -========= Remove unused lf_conv_cflux_col variable and LF_CONV_CFLUX diagnostic field -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 -M components/clm/src/main/clm_driver.F90 - -========= Just add some comments -M components/clm/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 - -========= Change a field that is output, because I have removed the old field -M components/clm/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r219 -Originator(s): erik (Erik Kluzek) -Date: Sat Jan 21 23:36:23 MST 2017 -One-line Summary: Answer changes for CLM50 for several issues that lead to dead crops - -Purpose of changes ------------------- - -Fix several problems that led to dead crops. latbaset was set in InitAllocate -and then reset to spval in InitHist. Set lnca to interp rather than skip for -interpolation on startup. Remove rootfr from restart unless use_dynroots is on. -Fix FERTNITRO and add BTRAN2 to history. Turn LUNA on by default for all CLM50 -cases including SP. Change from Fang Li to remove fb from the calculation of -baf_crop. Fix LUNA in SP mode by setting PARi10 to a small value rather than -zero. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): [If none, remove this line] - bug 2407 -- latbaset is set in InitAllocate and then reset to spval in InitHist - bug 2409 -- set lnca to interp rather than skip on restart - bug 2408 -- remove rootfr from restart unless use_dynroots is on - bug 2402 -- FERTNITRO - bug 2403 -- BTRAN2 - bug 2413 -- luna in SP mode -Known bugs introduced in this tag (include bugzilla ID): [If none, remove this line] - bug 2414 LATBASET is always output to history even if not used and even though it's a constant - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self, oleson, dlawren - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_14_r218 - -Answer changes --------------- - -Changes answers relative to baseline: YES! CLM50 with crop - CLM45 BGCCROP cases show an answer change just because fill value change of LATBASET even though it's unused - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 with CROP - - what platforms/compilers: All - - nature of change: new climate with crops growing - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- LUNA on by - default for ALL CLM50 cases included SP mode - - M components/clm/src/biogeochem/CNFireLi2016Mod.F90 --- Remove fb from calculation of baf_crop - M components/clm/src/biogeochem/CropType.F90 ---------- Move initialization of latbaset_patch - to InitCold, fix FERTNITRO on history file - M components/clm/src/biogeophys/EnergyFluxType.F90 ---- Save BTRAN2 to history files - M components/clm/src/biogeophys/LunaMod.F90 ----------- Set PARi10 to 0.01 rather than zero if - LAI is zero - M components/clm/src/biogeophys/PhotosynthesisMod.F90 - Set lnca_patch to interp rather than skip - M components/clm/src/biogeophys/SoilStateType.F90 ----- Only save rootfr if use_dynroots on. - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r218 -Originator(s): sacks (Bill Sacks) -Date: Fri Jan 13 19:46:27 MST 2017 -One-line Summary: For newly initiating columns: do not copy snow state - -Purpose of changes ------------------- - -Keith Oleson found that, in some circumstances, the model was dying with a snow -balance error in newly initiating crop columns. We tracked this down to an -incomplete copying of the snow state from the 'template' column to the newly -initiating crop column. Our two options for solving this problem were (1) copy -the snow state more completely; or (2) do not try to copy any part of the snow -state - leaving the snow in cold start conditions for the newly initiating -column. (1) is challenging because there are so many snow variables, so we have -chosen to go with (2) for now. Thus, when a column initiates (for now, this just -applies to crop columns), we (Dave Lawrence, Keith Oleson and Bill Sacks) have -decided that we should copy only the belowground temperature and water state. - -Also, some minor, unrelated changes: - -(1) Fix broken unit tests - -(2) Abort run if try to run use_ed with transient crops - -(3) Add two single-point exact restart tests for transient crop, because we did -not have good coverage of exact restart tests for transient crop before this - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - -Added two tests: -ERS_Ly3_Mmpi-serial.1x1_smallvilleIA.IHISTCLM50BGCCROP.yellowstone_gnu.clm-cropMonthOutput # restart is right before the transition from 100% nat veg to 100% crop -ERS_Ly6_Mmpi-serial.1x1_smallvilleIA.IHISTCLM50BGCCROP.yellowstone_gnu.clm-cropMonthOutput # restart is right before increasing natural veg to > 0 while also shifting PCT_CFT - -Code reviewed by: Main change reviewed by Keith Oleson and myself - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - On my Mac - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - - In principle, answers could change for runs with transient crops, but I did - not observe any answer changes in the test suite. - -CLM tag used for the baseline comparisons: clm4_5_14_r217 - - -Answer changes --------------- - -Changes answers relative to baseline: YES, in principle - but not in the test suite - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 with transient crops - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Assumed to be larger than roundoff, but only slightly, and only rare - answer changes - - I did not observe any answer changes in the test suite. But in principle, - this could change answers for any transient crop run, as evidenced by the - change in behavior seen in Keith Oleson's transient crop run with and - without this fix. It just seems like the conditions in which this matters - only occur rarely. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main change: only copy belowground state to new columns -M components/clm/src/dyn_subgrid/dynInitColumnsMod.F90 -M components/clm/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf - -========= Abort run if try to run use_ed with transient crops -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 - -========= Fix a comment -M components/clm/src/dyn_subgrid/dynVarMod.F90.in - -========= Fix unit tests, apparently broken in r215 -M components/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90.in - -========= Add two tests (see above) -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r217 -Originator(s): sacks (Bill Sacks) -Date: Fri Jan 13 05:36:28 MST 2017 -One-line Summary: Bug fix for snow radiation absorption - -Purpose of changes ------------------- - -Bug fix from Leo van Kampenhout regarding snow radiation absorption: Remove -multipliers of (1.-albsnd(c,ib)) or (1.-albsni(c,ib)) in the calculation of -flx_absdv, flx_absiv, flx_absdn, flx_absin. - -This stops this conditional in SurfaceRadiationMod from being triggered every -time step: - - if (abs(sabg_snl_sum-sabg_snow(p)) > 0.00001_r8) then - -The triggering of this conditional led to an unintended constant partitioning of -radiation through the snowpack: 75% of radiation was absorbed in the top layer, -25% in the bottom layer. - -In the old code, Leo found that sabg_snow(p) is over three times as big as -sabg_snl_sum , so these are certainly not roundoff problems. - -With the fix, the conditional is no longer triggered at every time -step. Possible explanation: the factors flx_absd_snw and flx_absi_snw are -already accounted for albedo, because they are "absorbed flux per unit incident -flux at top of snowpack" according to SnowSnicarMod.F90. - -Sean Swenson tested this, and says: I agree with leo; in fact the sum of the -flx_ terms should be the total absorption, or 1-albedo. When I remove the -albedo modification leo suggested, I see most of the cases where the if-block is -triggered go away. Those that remain are much smaller (the abs() in the if -block is ~1.e--4). I don't know if this is a precision issue, or an indication -of a remaining bug. Or it could be those cases for which the if-block was meant -to correct originally. - -Sean later added: a couple more pieces of information: 1) the if-statement is -still needed. If it is removed, a balance check error will abort the model. 2) -in SurfaceAlbedoMod, I tested the equality of sum_over_layers(flx_absdn) and -(1.0 - albsnd). For direct beam, they were equal, but occassionally for ib=2 -(near infrared), they were slightly different. These were the same points that -were then triggered by the if block in SurfaceRadiation. This may point to -something within the snicar_rt subroutine, but I don't plan on following this -issue further. - -Mark Flanner added: I will note that there is an energy conservation check in -the snicarRT code which should ensure that the sum of absorption in all snow -layers never differs substantially (>0.00001) from what is expected from albedo -and transmittance. If it does, the model aborts. This is true, however, only -at the snow column level, so I suspect the issue you identified ultimately -relates either to (1) fractional snow cover and merging of sub-grid energy -fluxes to the gridcell level and/or (2) a change in the number of snow layers in -between the calculations of snow albedo and absorbed energy flux. I think (2) -is what necessitated the patch in the first place. I could be wrong. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, baseline comparisons fail as expected - -CLM tag used for the baseline comparisons: clm4_5_14_r216 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45/CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Based on Sean Swenson's analysis: larger than roundoff; same or only - slightly changed climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Change described above -M components/clm/src/biogeophys/SurfaceAlbedoMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r216 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Thu Jan 12 16:12:45 MST 2017 -One-line Summary: Fix previous broken tag - -Purpose of changes ------------------- - -Three files were missing from the merge to transcrop_n08_clm4_5_14_r214 on the trunk. I don't -know why they were missing, but they were. I have on very rare occasions seen subversion fail -with this problem, and it maybe due to a rare bug in subversion. Manytimes I double check to -make sure this doesn't happen, but I didn't this time. - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): 2400 - 2400 --- Problem with mksurfdata_map for smallville landuse.timeseries (found in clm4_5_14_r215 after it's creation) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users None - -Changes to CLM's user interface: None - -Changes made to namelist defaults: None - -Changes to the datasets: None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: None - -Changes to tests or testing: None - -Code reviewed by: self - -CLM testing: short - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: None - - unit-tests (components/clm/src): None - - tools-tests (components/clm/test/tools): None - - PTCLM testing (components/clm/tools/shared/PTCLM/test): None - - regular tests: clm_short_50 - - yellowstone_intel - PASS - -CLM tag used for the baseline comparisons: none - - -Answer changes None --------------- - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>> Bring in files that were modified on the branch transcrop_n08_clm4_5_14_r214, but for some reason were dropped on ->>>>>> the merge to the trunk - - M components/clm/src/dyn_subgrid/dyncropFileMod.F90 - M components/clm/src/main/clm_initializeMod.F90 - M parse_cime.cs.status - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r215 -Originator(s): erik (Erik Kluzek) -Date: Thu Jan 12 10:29:52 MST 2017 -One-line Summary: Update mksurfdata_map to work with new updated datasets from Peter, and use hand-edited - surfdata/landuse.timeseries datasets for f09/f19 - -Purpose of changes ------------------- - -Use new rawdatasets from Peter Lawrence that have crop landunit changing in size as well as specific crop -and natural vegetation types. Modify mksurfdata_map to use new fields for fertilizer for each crop type. -Add in harvest fields to both surface dataset as well as landuse.timeseries dataset. Also add in two -new fields: UNREPRESENTED_PFT_LULCC, UNREPRESENTED_CFT_LULCC for the impact of landuse changes for -natural and crop vegetation types. Currently these two fields are zeroed out. But, they will be added in -with a new update to the datasets. - -Implement crop fertilizer for each crop type into CLM. The fertilizer is also moved from one crop -type to another by the mapping system between the different crop types (to handle unrepresented crop -types by mapping them to one that is represented). The new datasets also have harvest fields in units by -mass rather than area. This requires new surface and landuse.timeseries datasets. We have hand-edited -versions from Peter Lawrence for f09 and f19. The older datasets for other resolutions still work, but -they don't have the new fertilizer field so anthropogenic fertilizer is zeroed out. - -NOTE: Capability to create rcp scenarios for landuse.timeseries was removed from mksurfdata_map. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2386 -- buildnamelist unit tester can't compare to itself - 2389 -- make nitrogen balance threshold higher - 2382 -- soil depth dataset into subversion - 2369 -- Remove hacks to change PFT's in tropics in mksurfdata_map - 2097 -- mksurfdata_map changes - -Known bugs introduced in this tag (include bugzilla ID): - - 2399 -- Problem with urban points with latest mksurfdata_map - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: - - mksurfdata.pl "-crop" option changed to "-no_crop" so the default is to create datasets with crop on it. - Also default for -glc_nec is now 10 so default is to create datasets with glacier - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - - New optional history field: - - FERTNITRO', 'gN/m2/yr', 'Nitrogen fertilizer for each crop - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): New f09/f19 surfdata/landuse.timeseries - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: - -Changes to tests or testing: Removed clm4_0 tools tests - -Code reviewed by: self, lawrence - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - OK - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_14_r214 - - -Answer changes --------------- - -Changes answers relative to baseline: f09 and f19 CLM45/CLM50 cases change answers because of new datasets - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 for f09 and f19 - - what platforms/compilers: all - - nature of change: adjusted surface datasets - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: Remove clm4_0 tools, rename clm4_5/shared directories under CLM tools - - D components/clm/tools/clm4_0/* - D components/clm/tools/clm4_5/mksurfdata_map/* - D components/clm/tools/clm4_5/refactorTools/* - D components/clm/tools/shared/mkmapdata/* - D components/clm/tools/shared/mkmapgrids/* - D components/clm/tools/shared/mkprocdata_map/* - D components/clm/tools/shared/ncl_scripts/* - - D components/clm/tools/clm4_5/mksurfdata_map/landuse_timeseries_hist_16pfts_simyr1850-2005.txt - -List all files added and what they do: Renamed from clm4_5 or shared subdirectories, unit tests for mkharvest - - A components/clm/tools/mksurfdata_map/* - A components/clm/tools/refactorTools/* - A components/clm/tools/mkmapdata/* - A components/clm/tools/mkmapgrids/* - A components/clm/tools/mkprocdata_map/* - A components/clm/tools/ncl_scripts/* - - A components/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkharvest.F90 - A components/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/harvestfieldsold.nc - A components/clm/tools/clm4_5/mksurfdata_map/unit_testers/inputs/harvestfields.nc - A components/clm/tools/clm4_5/mksurfdata_map/landuse_timeseries_hist_78pfts_simyr1850-2015.txt - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeochem/CNBalanceCheckMod.F90 - Increase threshold for Nitrogen balance check - M components/clm/src/biogeochem/CropType.F90 ---------- Add fertnitro to fert array - M components/clm/src/biogeochem/CNPhenologyMod.F90 ---- Add fertnitro_patch and InitCold for it - Add FERTNITRO as optional output to history files (default inactive) - M components/clm/src/biogeochem/dynHarvestMod.F90 ----- Read in harvest units, divide by deadstem if - new units of gC/m2/yr, otherwise take directly - M components/clm/src/main/surfrdMod.F90 --------------- Read in CONST_FERTNITRO_CFT if on file, - otherwise zero it out, pass fert_cft to collapse_crop_types - M components/clm/src/main/clm_varsur.F90 -------------- Add fert_cft as temporary read in from dataset - M components/clm/src/main/clm_driver.F90 -------------- Pass crop_inst to dynSubgrid_driver - M components/clm/src/main/surfrdUtilsMod.F90 ---------- Handle fert_cft in collapse_crop_types - if crops are being merged also move the fertilizer - M components/clm/src/main/clm_initializeMod.F90 ------- Allocate/dealloc fert_cft, pass crop_inst to dynsubgrid_init - M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 ------ Pass crop_inst in and down to dyncrop_interp - M components/clm/src/dyn_subgrid/dynVarMod.F90.in ------------- Add allow_nodata and data_on_file flags - and get_att method, if allow_nodata is true, read_variable will NOT abort, but zero out the - variable - M components/clm/src/dyn_subgrid/dynVarTimeUninterpMod.F90.in - Pass allow_nodata as optional argument down - M components/clm/src/dyn_subgrid/dyncropFileMod.F90 ----------- Add fertcft dyn_var_time_uninterp_type - initialize it, pass crop_inst to dyncrop_interp, get current data from fertcft%get_current_data - and pass to collapse_crop_types - - M components/clm/bld/listDefaultNamelist.pl -------------- Remove phys option maxpft is now 78 - M components/clm/bld/unit_testers/build-namelist_test.pl - Fix bug 2386 for comparing to itself for - user_nl_clm_real_parameters files - M components/clm/bld/unit_testers/NMLTest/CompFiles.pm - - Fix bug 2386 for comparing to itself, - change double quotes in filenames to a "+" like other special characters - M components/clm/bld/README ------------------------------ Remove note on clm4_0_tools file - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - Updated (hand-edited) surface and - historical landuse.timeseries datasets for f09 and f19 - M components/clm/bld/namelist_files/namelist_defaults_clm4_0_tools.xml - Remove contents - (keep file around as queryDefaultNamelist.pl assumes it's existance) - M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Add "hrv" hgrid/lmask - option for 0.9x1.25/GDRC, add "hrv" mksrf_filename called mksrf_fhrvtyp use - lnd/clm2/rawdata/mksf_soilthk_5x5min_ORNL_SOILS_simyr1900-2015_c150701.nc file in place - of file pointing to Sean Swenson's personal disk space, remove: mksrf_fvegtyp for test - years, crop=off, and all rcp's as well as before 1850, but add historical through 2015 - Add harvest datasets at f09 resolution - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add mksrf_fhrvtyp - - M components/clm/cime_config/config_compsets.xml -- Add IGMHISTCRUCLM50BGCCROP compset - - M components/clm/tools/mksurfdata_map/Makefile.data ------------- Change default list of files created - so crop is output for all resolutions - M components/clm/tools/mksurfdata_map/src/mkharvestMod.F90 ------ Add harvestDataType and it's methods: - init, get1DFieldPtr, get2DFieldPtr, getFieldsIdx, getFieldsDim, isField1D, isField2D, num1DFields - num2DFields, and clean. Increase by three harvest fields, have two names for them (one for - surfdace dataset, and one for landuse.timeseries datasets), mkharvest subroutine sends - harvestDataType as it's output - M components/clm/tools/mksurfdata_map/src/mkncdio.F90 ----------- Add varexists option to check_ret, - make nf_enotatt and nf_strerror public - M components/clm/tools/mksurfdata_map/src/mkfileMod.F90 --------- Send harvdata to mkfile use - it's methods to define and output the harvest data - M components/clm/tools/mksurfdata_map/src/mkpftMod.F90 ---------- Always put CFT's on seperate land-unit - new variables for: natural-veg-percent, crop-percent, fraction for each CFT and PFT - handles oldformat and newformat (oldformat only used when PFT's are specified in namelist) - remove missing_crops logic as crop is now required - M components/clm/tools/mksurfdata_map/src/mkvarctl.F90 ---------- Add mksrf_fhrvtyp - M components/clm/tools/mksurfdata_map/src/mkpctPftTypeMod.F90 --- Add new constructor - constructor_pong to initialize a new pct_pft_type object with all PFT's on the gridcell - M components/clm/tools/mksurfdata_map/src/mksurfdat.F90 --------- Update mkharvestMod calls - and add harvestDataType, add read of harvest dataset names, handle harvest 1D and 2D - data. Remove hack to set pfts 7 and 10 to 6 in the tropics because of bad LAI's (2369) - - M components/clm/tools/mksurfdata_map/unit_testers/Srcfiles ---------------- Add new test files - M components/clm/tools/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 - add mkharvest tests and - test_get_nonexisting_var for test_mkncdio - M components/clm/tools/mksurfdata_map/unit_testers/test_mkncdio.F90 -------- Add test_get_nonexisting_var - - M components/clm/tools/mksurfdata_map/mksurfdata_map.namelist - Updated files, crop and glc_nec=10 is - on, does historical range of: 1850-2005 - M components/clm/tools/mksurfdata_map/mksurfdata.pl ----------- -crop=>-no_crop glc_nec default to 10, - default is to create datasets with crop, rawdatasets always have crop=on for them, harvest resolution different, - remove -rcp option (no longer available), year range 1850-2000 actually does 1850-2015 now. - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r214 -Originator(s): sacks (Bill Sacks) -Date: Tue Jan 3 12:55:28 MST 2017 -One-line Summary: Update column states based on dwt terms between dyn_cnbal_patch and dyn_cnbal_col, and minor fixes - -Purpose of changes ------------------- - -Main change is to move the update of column states based on dwt terms (which -come from shrinking patches) to earlier in the time step - specifically, between -dyn_cnbal_patch and dyn_cnbal_col. This includes updating the seed pools and -decomp_[c/n]pools_vr_col. - -This change is important when there are changing column areas: In order to -conserve C & N, we need to transfer the mass from the dwt terms to the -column-level pools before executing the code to conserve the column-level state -variables. For example, if the natural vegetated column shrinks (with a -corresponding shrinkage of each patch on the column), and is replaced by crop: -Then the dwt terms from the shrinking patches (assuming this was handled -correctly - fix coming in an upcoming tag...) add some C & N to the below-ground -pools. But some of this C & N needs to end up in the growing crop column. Since -the column-level conservation operates on state variables (not fluxes), this -only works properly if the mass from the dwt fluxes is added to the states -before dyn_cnbal_col. - -In addition, this tag fixes a number of minor problems: - -(1) Separates the crop uses of seed(c/n)_to_leaf from the dwt uses. This is - needed for the main change to work correctly. - -(2) Allows longer history field names in hist_fincl and hist_fexcl - -(3) Fixes SNOINTABS diagnostic field (bug 2321) - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2321: SNOINTABS diagnostic field incorrect for columns with more than one patch - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Changes meaning of DWT_SEEDC_TO_LEAF andDWT_SEEDN_TO_LEAF: No longer includes - crop seed terms - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: Minor tweak to crop testmod: Add a history field -that uses SUM, in order to test the SUM history field infrastructure - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, baseline failures as expected, as noted below - -CLM tag used for the baseline comparisons: clm4_5_14_r213 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 in these configurations: - - All transient cases (HIST, RCP, DV): changes due to the main changes in - this tag - - All CROP cases: changes answers in DWT_SEEDC_TO_LEAF and - DWT_SEEDN_TO_LEAF diagnostic fields - - Many cases: differences in SNOINTABS diagnostic field. From one test - (LII_D_Ld3.f19_g16_gl5.IG1850CLM45.yellowstone_intel.clm-glcMEC_spunup_1way), - there are diffs of up to 0.06. No diffs over Antarctica or most of - Greenland (though there are some diffs on the southern tip of - Greenland). Lots of other diffs in the northern hemisphere mid-high - latitudes. This is as expected: expect diffs in vegetated areas, but not - in glacier. - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff; not investigated as to whether this is new climate, - but expected not to be - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Move update of column states based on dwt terms to earlier in the time step -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 -M components/clm/src/biogeochem/CNNStateUpdate1Mod.F90 -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Separate the crop uses of seed(c/n)_to_leaf from the dwt uses -M components/clm/src/biogeochem/CNPhenologyMod.F90 - -========= Change sub_surf_abs_SW to a patch-level variable, rather than - column-level (fixes bug 2321) -M components/clm/src/biogeophys/SurfaceRadiationMod.F90 -M components/clm/src/biogeophys/SolarAbsorbedType.F90 - -========= Allow longer history field names in hist_fincl and hist_fexcl -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -========= Add a history field that uses SUM, in order to test the SUM history - field infrastructure -M components/clm/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r213 -Originator(s): sacks (Bill Sacks) -Date: Fri Dec 30 08:48:44 MST 2016 -One-line Summary: Convert buildnml to python - -Purpose of changes ------------------- - -Changes from Mariana Vertenstein - -Main purpose is to convert buildnml to python; also some minor tweaks to other -related files, which seem to be moving towards the removal of CLM4. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - pass - - I did NOT compare against baseline, because this is currently broken (bug 2386) - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_13_r211 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -A components/clm/cime_config/buildcpp - -List all existing files that have been modified, and describe the changes: - -M components/clm/cime_config/buildlib -M components/clm/cime_config/buildnml -M components/clm/cime_config/config_component.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_14_r212 -Originator(s): sacks (Bill Sacks) -Date: Thu Dec 22 16:06:09 MST 2016 -One-line Summary: Bump science version number due to changes in clm4_5_13_r211 - -Purpose of changes ------------------- - -Bump science version number only. This is the same code base as -clm4_5_13_r211. No additional testing was done. - -clm4_5_13_r211 has a significant change in behavior for transient cases, for -CLM45 as well as CLM50 cases. Thus, we are incrementing the science version -number. - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r211 -Originator(s): sacks (Bill Sacks) -Date: Thu Dec 22 13:46:52 MST 2016 -One-line Summary: Apply transient land cover and harvest all at once in first time step of year - -Purpose of changes ------------------- - -Scientists have found it problematic to have land cover change and harvest -interpolated throughout the year: By having just a bit of deforestation done in -each time step, the forest can regrow, so that you never see the full, -appropriate impacts of land cover change. - -This tag changes the behavior of both land cover change (transient PFTs) and -harvest so that they are applied all at once in the first time step of a given -year. - -This new behavior is consistent with the pre-existing timing of transient crops -and transient glaciers: Now all land cover changes happen all at once on the -first time step of the year. - -For the fire code, we pass a dribbled version of the land cover change - i.e., a -version that smooths the area changes over the year, similarly to what was done -before. This is important because the fire code involves interactions between -the current time step's change in area and the current time step's climate. So, -if the fire code only saw area changes on Jan 1, it could only generated -deforestation fires on Jan 1 (I think). Note there is some inconsistency now, -since the above-ground C/N biomass is all adjusted at once on Jan 1, so the fire -code operates on the already-adjusted biomass. This could be problematic in -principle if there were relatively large changes in area in a given year, but -Fang Li believes this won't cause major problems in practice, since (1) area -changes are typically small, (2) the carbon fluxes from fire are just -diagnostic, and (3) the bigger impact of deforestation fires is as a trigger for -other fires. - -In addition, for fluxes passed to the atmosphere from land cover change and -harvest, we dribble these fluxes over the year, avoiding pulsed fluxes on -Jan. 1. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- Partially addresses 2106: CNFireMod code should be re-evaluated in the presence of dynamic landunits - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Moved some transient tests (HIST/RCP) from CLM45 to CLM50 - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; some baseline comparisons fail as noted below - - NOTE: Most testing done on - dynpft_and_harvest_jan1_n07_clm4_5_13_r210. dynpft_and_harvest_jan1_n08_clm4_5_13_r210 - fixed an error check for CNDV cases. I reran the CNDV tests on the n08 tag, - along with the following additional tests: - - SMS_Ld5_D_P24x1.f10_f10.IHISTCLM50BGC.hobart_nag.clm-monthly - ERP_D_P24x1.f10_f10.IHISTCLM50BGC.hobart_nag.clm-decStart - ERP_D_Ld5.f19_g16.IRCP85CLM45BGC.yellowstone_pgi.clm-drydepnomegan - -CLM tag used for the baseline comparisons: clm4_5_13_r210 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All transient cases (HIST/RCP) with CLM45/CLM50; also DV cases - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - For transient cases: Larger than roundoff; unsure whether this is climate changing - - For DV cases, just roundoff-level changes in FCO2, LAND_USE_FLUX, NBP - I - think from the dribbling of fluxes that are generated on the first time - step of each year. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Do land cover change (transient PFTs) and harvest all at once in the - first time step of the year, rather than gradually throughout the - year; dribble the fluxes to the atmosphere, and dribble the weight - changes to the fire code. -M components/clm/src/dyn_subgrid/dynpftFileMod.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/biogeochem/dynHarvestMod.F90 -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CNVegStateType.F90 - -========= Just add some documentation for history fields -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 - -========= Just remove unneeded use statements -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Introduce ability for dribblers to work at any subgrid level, and some - other feature additions -M components/clm/src/utils/test/annual_flux_dribbler_test/test_annual_flux_dribbler.pf -M components/clm/src/utils/AnnualFluxDribbler.F90 -M components/clm/src/main/decompMod.F90 -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 - -========= Move some transient tests to CLM50 -M components/clm/cime_config/config_compsets.xml -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Unrelated change: add a bit of documentation -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r210 -Originator(s): sacks (Bill Sacks) -Date: Sat Dec 17 05:43:34 MST 2016 -One-line Summary: Update cime to cesm2_0_beta04 version - -Purpose of changes ------------------- - -Update cime to version used in cesm2_0_beta04 - -Main motivation is to get the fix for the problem where manual modifications to -user_nl files in a test case get overwritten. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - pass - ran build-namelist tests without compare or generate - all passed - ran prove test_build_namelist.pl - pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - - (NLCOMP changes for IG tests; this was expected) - -CLM tag used for the baseline comparisons: clm4_5_13_r209 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): -- cime: cime5.2.0-alpha.7 -> cime5.2.0-alpha.9 - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Update cime from cime5.2.0-alpha.7 to cime5.2.0-alpha.9 -M SVN_EXTERNAL_DIRECTORIES - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r209 -Originator(s): sacks (Bill Sacks) -Date: Sun Dec 11 06:09:22 MST 2016 -One-line Summary: Change definition of NBP; bring back some r205 changes that were lost in r207 - -Purpose of changes ------------------- - -Changes definition of NBP to match the definition used by CMIP: Now NBP includes -all terms that contribute to the net carbon exchange between land and -atmosphere. - -Also, moves both NBP and NEE diagnostics to the gridcell level, rather than the -column level - so you can no longer see column-by-column values for these -diagnostics. The move of NBP to gridcell-level is needed because it now includes -some gridcell-level quantities; the move of NEE to gridcell-level is needed to -support some upcoming changes. - -Removes NET_CARBON_EXCHANGE diagnostic output because this is now redundant with -NBP. - -Also, brings back some r205 changes that were lost in r207 - most notably, the -fix for the MEGAN crash due to negative intracellular co2. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2371: Change definition of NBP - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- Changes definition of NBP diagnostic output; also, NBP is now defined at the gridcell level -- Removes NET_CARBON_EXCHANGE diagnostic output -- NEE diagnostic output is now defined at the gridcell level - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self; but change in definition of NBP was reviewed conceptually by Dave Lawrence - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; baseline comparison failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_13_r208 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 change answers as noted below - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Most changes are roundoff-level changes in diagnostics and in FCO2 sent to - atmosphere; larger than roundoff-level changes in the diagnostic field - NBP; potentially larger-than-roundoff level changes in MEG_isoprene - - Roundoff-level diffs in FCO2 (sent to atmosphere), NEE, C13_NEE, C14_NEE - - NBP diagnostic field: roundoff-level change for many cases; larger than - roundoff for transient, crop, or year-2000 using initial conditions from a - transient case (due to non-zero product pools) - - Small diffs in MEG_isoprene in - SMS_Lm1.f09_g16_gl4.IG1850CRUCLM50BGC.yellowstone_intel.clm-clm50KitchenSink, - due to bringing back the fix for Megan. (In principle, this could show up - in other cases as well.) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Change definition of NBP, and other changes to carbon flux diagnostics - as noted above -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 - -========= Bring back fix for Megan crash (prevent negative intracellular CO2) - that was added in r205 and accidentally dropped in r207; also, change - 1. to 1._r8 -M components/clm/src/biogeophys/PhotosynthesisMod.F90 - -========= Bring back SNO_TK_ICE diagnostic field that was added in r205 and - accidentally dropped in r207 -M components/clm/src/biogeophys/SoilStateType.F90 - - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r208 -Originator(s): sacks (Bill Sacks) -Date: Sat Dec 10 15:00:21 MST 2016 -One-line Summary: Rework irrigation; remove glc_smb logical - -Purpose of changes ------------------- - -Main change is a complete rework of the irrigation algorithm. This reworks the -trigger and target for irrigation to be based on soil physical properties, -removing the dependence on btran and smpso (which were problematic in -conjunction with PHS). With the current out-of-the-box parameter values, -irrigation is substantially lower than before. - -In addition, this reworks the river volume-based limitation. One change to the -volr-based limitation is that we now apply the limit to the deficit computed in -calcIrrigationNeeded - rather than applying the limit in applyIrrigation. The -point of this is to avoid problems that arise due to evolving VOLR - e.g., if we -had calculated irrigation demand such that VOLR was just barely big enough, then -we apply irrigation for some time steps, then we get an updated VOLR which is -lower due to these irrigation withdrawals - the old implementation would impose -an unnecessary limit on the irrigation to be applied for the rest of this -day. It's hard to see a clean way around this problem, given that VOLR is -updated in some but not all CLM time steps. So we're going to impose the limit -on irrigation deficit, rather than on the time step-by-time-step flux. The -downside here is that it's somewhat more likely that irrigation would try to -draw volr negative, if volr has been evolving for other reasons. - -Also, this tag pulls out the parameters controlling irrigation to namelist. - -Also reworks the limit_irrigation namelist parameter, changing it to -limit_irrigation_if_rof_enabled. This was a problem before, in that we needed to -remember to set it to false whenever we ran without an active ROF model (e.g., -during spinup); now runtime logic handles that automatically. (We considered -trying to have limit_irrigation set properly by build-namelist, but that turns -out to be tricky because there are a number of ways in which you can end up with -an inactive ROF model.) - -Also removes the glc_smb logical: this has been unused for quite a while (we -have always assumed it's true). - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variables for irrigation -- limit_irrigation changed to limit_irrigation_if_rof_enabled -- Remove glc_smb namelist variable, both for clm4_0 and clm4_5/clm5_0 -- Renamed ICE_MASK history variable to ICE_MODEL_FRACTION - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: minor tweaks to tests involving irrigation, as -described below - -Code reviewed by: Irrigation changes reviewed by Sean Swenson - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok - - Many failures due to bug 2386; other than that, expected differences from - baseline - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - ok - - ok means pass or xfail; expected baseline failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_13_r207 - - -Answer changes --------------- - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All cases with irrigation - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated closely, but potentially new climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): - -List all files eliminated: - -========= Merge irrigation unit tests into a single module -D components/clm/src/biogeophys/test/Irrigation_test/test_irrigation_singlepatch.pf -D components/clm/src/biogeophys/test/Irrigation_test/test_irrigation_deficit.pf -D components/clm/src/biogeophys/test/Irrigation_test/test_irrigation_multipatch.pf -D components/clm/src/biogeophys/test/Irrigation_test/IrrigationWrapperMod.F90 - -========= No longer needed because we turn on irrigation river limitation in - some other irrigation tests -D components/clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw - -List all files added and what they do: - -========= Merge irrigation unit tests into a single module, and add some tests -A components/clm/src/biogeophys/test/Irrigation_test/test_irrigation.pf - -List all existing files that have been modified, and describe the changes: - -========= Rework irrigation: both the core algorithm and the volr limitation -M components/clm/src/biogeophys/IrrigationMod.F90 -M components/clm/src/main/clm_driver.F90 - -========= Determine if rof_enabled is true, needed now that we have changed - limit_irrigation to limit_irrigation_if_rof_enabled -M components/clm/src/cpl/lnd_comp_mct.F90 - -========= Add new irrigation namelist variables, in their own group; also remove - glc_smb namelist item -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/src/main/clm_instMod.F90 - -========= Remove glc_smb logical: we have been assuming it's true for quite a - while -M components/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml -M components/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml -M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml -M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml -M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml -M components/clm/bld/namelist_files/use_cases/glacierMEC_pd.xml -M components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml -M components/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_0.xml -M components/clm/bld/namelist_files/namelist_defaults_overall.xml -M components/clm/cime_config/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm -M components/clm/bld/unit_testers/build-namelist_test.pl -M components/clm/cime_config/buildnml -M components/clm/doc/UsersGuide/preface.xml -M components/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -M components/clm/src_clm40/main/clm_glclnd.F90 -M components/clm/src_clm40/main/controlMod.F90 -M components/clm/src_clm40/main/clm_varctl.F90 - -========= Remove glc_smb and move limit_irrigation logic into IrrigationMod -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/controlMod.F90 - -========= Rework some of the column filter creators to have a clearer interface -M components/clm/src/main/filterColMod.F90 -M components/clm/src/main/test/filter_test/test_filter_col.pf -M components/clm/src/main/TopoMod.F90 -M components/clm/src/main/test/atm2lnd_test/test_downscale_forcings.pf - -========= Put some extra metadata on the restart file: whether we have - create_crop_landunit and irrigate, since these are helpful for - understanding when init_interp is needed -M components/clm/src/main/restFileMod.F90 - -========= Rename ICE_MASK to ICE_MODEL_FRACTION, based on suggestion from Marcus - Lofverstrom -M components/clm/src/main/glc2lndMod.F90 - -========= Merge irrigation unit tests into a single module -M components/clm/src/biogeophys/test/Irrigation_test/CMakeLists.txt - -========= Fix for cime update -M components/clm/bld/test_build_namelist/test_build_namelist.pl - -========= Stop turning off limit_irrigation, since it's working now; also - include QIRRIG_DEMAND in output -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm - -========= Rename limit_irrigation to limit_irrigation_if_rof_enabled -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - -========= Include QIRRIG_DEMAND in output -M components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm - -========= Remove limit_river_withdraw test - now we test that option via other - irrigation tests -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Add a stub routine -M components/clm/src/unit_test_stubs/utils/restUtilMod_stub.F90.in - -========= Add a couple of tests to the xfail list - bug 2388 -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r207 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Dec 8 10:34:56 MST 2016 -One-line Summary: PHS - Calculate separate root water uptake resistances for soil and root pathways - -Purpose of changes ------------------- - -PHS changes from Sean Swenson. Root water uptake resistances -calculated separately for soil and root pathways. These resistances -are added in series to give a soil to root resistance that replaces -the ad hoc expression used in the original code. History variables -added for soil and root resistances, as well as a variable 'QPHSNEG' -obtained by summing negative transpiration terms in each soil layer. - - -Bugs fixed or introduced ------------------------ - -none - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: unknown - -Notes of particular relevance for developers: (including Code reviews and testing) none - ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Sean Swenson, David Lawrence, Keith Oleson - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means - all functionality tests passed. All baseline comparisons passed except: - - all clm5 compsets : expected, tag is answer changing for clm5 - - - SMS_D_Ld5.f10_f10.ICLM45ED.hobart_nag.clm-edTest : - baseline failed with RMS difference in a single field: - RMS NBP 3.3589E-12 NORMALIZED 4.4201E-05 - SMS_D_Ld5.f10_f10.ICLM45ED.yellowstone_{gnu|intel|pgi} tests - are all bit for bit with the baseline. Just documenting the - discrepancy and ignoring. - -CLM tag used for the baseline comparisons: clm4_5_13_r206 - - -Answer changes --------------- - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all clm5 compsets with PHS on - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): unknown, assumed larger than roundoff same climate. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? n/a - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -clm/src/biogeochem/CNVegetationFacade.F90 - new routines to calculate froot and croot carbon. -clm/src/main/histFileMod.F90 - add nlevsoi as 2d output option -clm/src/main/clm_driver.F90 - add calls froot and croot carbon calculations -clm/src/main/pftconMod.F90 - new root desnity and root radius variables -clm/src/biogeophys/WaterfluxType.F90 - new qflx_phs_neg_col variable -clm/src/biogeophys/WaterStateType.F90 - remove smp_l_col variable -clm/src/biogeophys/PhotosynthesisMod.F90 - calculate root-soil interface conductance -clm/src/biogeophys/SoilStateType.F90 - new variables k_soil_root_patch, soil_conductance_patch, root_conductance_patch -clm/src/biogeophys/CanopyFluxesMod.F90 - pass froot and croot carbon through to photosynthesis. -clm/src/biogeophys/SoilWaterMovementMod.F90 - calculate qflx_phs_neg_col - - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r206 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue Nov 29 10:46:24 MST 2016 -One-line Summary: Bugfix for Luna causing arctic to die - -Purpose of changes ------------------- - -Bugfix from Keith Oleson to prevent Luna from causing the arctic to -die. - -Bug 2366 prevented a divide by zero in Luna, but it sets Jmax/Vcmax to -zero. This causes plants in the arctic to never start growing and -hence never get any leaf nitrogen. The fix tested by Keith Oleson is -to set them to the default values that Luna uses when it can't -converge. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2379 - -Bugs introduced: re-opening 2291. An old problem with fire emissions -fields and gnu has resurfaced. This is a two line science change -in clm5-bgc-luna that is unlikely to caused this regression. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none expected - -Notes of particular relevance for developers: (including Code reviews and testing): none - ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: K. Oleson, Erik Kluzek - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - unit tests - fail, can't import perl module: - 'Streams/TemplateGeneric.pm'. Not related to current changes, must - have come in a previous tag. - - unit-tests (components/clm/src): - - yellowstone - all tests pass - - tools-tests (components/clm/test/tools): - - yellowstone - no related changes, not run. - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - no related changes, not run. - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40 : ok, 45 : ok - yellowstone_pgi - 40 : ok, 45 : ok - yellowstone_gnu (clm45 only) - ok, see note below. - hobart_nag - ok - - ok means - all test functionality passes - - baselines pass except for clm5 bgc (answer changing) - - expected failures ignored - - tput, memleak, memcomp, nlcomp ignored. - - - bug 2291 has resurfaced? Also appears to have been an - issue in clm4_5_13_r205. - - FAIL SMS_Lm25.f19_g16.ICLM45BGCCROP.yellowstone_gnu.clm-cropMonthOutput BASELINE - - $ grep -e RMS TestStatus.log - RMS l2x_Fall_fire001 1.9723E-17 NORMALIZED 8.4685E-06 - RMS l2x_Fall_fire002 2.7612E-17 NORMALIZED 1.2077E-06 - RMS l2x_Fall_fire003 1.9723E-17 NORMALIZED 5.5636E-06 - -CLM tag used for the baseline comparisons: clm4_5_13_r205 - - -Answer changes --------------- - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm5-bgc with luna on. - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; - new climate): Unknown, larger than roundoff to prevent die-off - of the arctic. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: unknown, Keith Oleson ran a longer simulation and - verbally confirmend he was happy with the results. - - URL for LMWG diagnostics output used to validate new climate: none - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -clm/src/biogeophys/LunaMod.F90 - bugfix for 2379 set vcmx25 and jmx25 to non-zero values. - -clm/cime_config/testdefs/ExpectedTestFails.xml - add xfail issue 2291 - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r205 -Originator(s): sacks (Bill Sacks) -Date: Wed Nov 16 10:38:15 MST 2016 -One-line Summary: Add diagnostics for snow and glacier; fix crash in Megan - -Purpose of changes ------------------- - -Most changes are to add new diagnostics fields related to the snow pack, and -diagnostic fields that are averaged just over istice/istice_mec landunits -(fields ending with _ICE). These changes are from from Leo van Kampenhout -(l.vankampenhout@uu.nl). - -In addition: - -(1) Fix to prevent negative (or very small positive) values of intracellular - leaf CO2. This just affects Megan emissions, and only has a small - effect. This change is needed to prevent a crash in Megan due to negative - values of these variables. This fix is from Keith Oleson. - -(2) Ensure that we don't try to do any downscaling over urban points; this is - not currently allowed (see bug 2377). This change is needed in case there is - an overlap between active urban points and the CISM domain: without this - change, urban points in the CISM domain would be inside the downscaling - filter, which would then cause an abort in check_downscale_consistency. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - ok - hobart_nag - pass - - ok means tests pass; some answer changes as noted below - -CLM tag used for the baseline comparisons: clm4_5_13_r204 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: some clm45/clm50; answer changes show up rarely - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - seem to be roundoff or only slightly greater - - Changes are due to the fix for Megan, in PhotosynthesisMod. Answer changes - only appeared for three tests in the test suite: - - SMS_Lm1.f09_g16_gl4.IG1850CRUCLM50BGC.yellowstone_intel.clm-clm50KitchenSink - ERP_P15x2_Lm13.f10_f10.IHISTCLM50BGC.yellowstone_intel.clm-monthly - - Small diffs in MEG_isoprene - - SMS_Lm25.f19_g16.ICLM45BGCCROP.yellowstone_gnu.clm-cropMonthOutput - - NaN values in a few fields in old; non-NaN in new: - - RMS l2x_Fall_fire001 NaN NORMALIZED 0.0000E+00 - RMS l2x_Fall_fire002 NaN NORMALIZED 0.0000E+00 - RMS l2x_Fall_fire003 NaN NORMALIZED 0.0000E+00 - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Do not downscale over urban points -M components/clm/src/main/glc2lndMod.F90 -M components/clm/src/main/atm2lndMod.F90 - -========= Fix Megan crash: prevent negative intracellular CO2 -M components/clm/src/biogeophys/PhotosynthesisMod.F90 - -========= New snow / glacier diagnostic fields -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/biogeophys/SoilStateType.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/biogeophys/SolarAbsorbedType.F90 -M components/clm/src/biogeophys/WaterStateType.F90 -M components/clm/src/biogeophys/LakeTemperatureMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/biogeophys/FrictionVelocityMod.F90 -M components/clm/src/biogeophys/TemperatureType.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_13_r204 -Originator(s): erik (Erik Kluzek) -Date: Tue Nov 15 13:55:16 MST 2016 -One-line Summary: A few answer changing bug fixes - -Purpose of changes ------------------- - -This brings in some simple answer changing bug fixes. And some non-answer changing bug fixes for mksurfdata.pl and -the build-namelist unit tester. - -In order to calculate infiltration the fraction of ground covered in surface water is used, before it is updated -to account for snow. Also mulitply k_wet by a factor of 1x10^-4 both of these will makes a difference in surface runoff. -This change is essentially a bug in the original formulation and so we've applied to both CLM45 and CLM50 answers. -Since this is hydrology it will affect answers in all CLM45/CLM%0 cases whether SP, CN or BGC modes. - -For MEGAN we were using a new updated dataset that had the addition of all 78 PFT's including the new crop ones. -Unfortunately it also had bare-soil, and this moved the indexing off by one. So we have a new dataset that removes -the bare-soil and hence works correctly now. - -A simple addition of setting lake energy flux (eflx_grnd_lake) for the case when there isn't one layer os snow. - -For CLM45 we found that the use of the Zheng rooting profile for Carbon resulted in 1850 spinup simulations that couldn't -spinup the tropics. Using the Jackson-1996 profile alleviates this problem. - -There were also some simple problems in using the queryNamelistDefaults.pl tool with the new cime tag brought in -with clm4_5_12_r202. Fixing this allows mksurfdata.pl and build-namelist-unit_tester to work. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2378 Zheng profile for carbon results in tropics that doesn't spin up - 2376 mksurfdata tests fail in clm4_5_12_r202 with new cime version - 2375 84 tests are removed from build-namelist unit_tester - 2374 Use fraction of ground covered in surface water used in infiltration before it's updated to account for snow - 2370 Megan was giving incorrect answers - 1717 Lake hydrology issue - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): carbon rooting is now Jackson-1996 - rooting_profile_method_carbon for CLM$5 was Zheng method, now changed to Jackson-1996 - -Changes to the datasets (e.g., parameter, surface or initial files): New megan dataset without bare-soil - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self, swensosc, fvitt - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS (176 compare tests fail because of bug - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_12_r203 - - -Answer changes --------------- - -Changes answers relative to baseline: YES! Both CLM45 and CLM50 - - Summarize any changes to answers, i.e., - - what code configurations: CLM45BGC/CLM50 - - what platforms/compilers: all - - nature of change: - surface runoff for CLM45/CLM50 changes when snow exists, small change for short simulations - MEGAN answers are corrected, important for isoprene - Change in fill mask for lake energy flux - CLM45BGC changes in an important way - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeophys/CanopyHydrologyMod.F90 --- Save frac_h2osfc_nosnow - M components/clm/src/biogeophys/SoilHydrologyMod.F90 ----- Use frac_h2osfc_nosnow to determine frac_infclust (bug 2374) - Also change k_wet by a factor of e-4 - M components/clm/src/biogeophys/LakeHydrologyMod.F90 ----- Save off eflx_grnd_lake as an "else" in one more conditional - when snl is not 1 layer (bug 1717) - M components/clm/src/biogeophys/WaterStateType.F90 ------- Write out FH2OSFC_NOSNOW to history - M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -- Add commented out change in NBP definition - M components/clm/src/biogeochem/MEGANFactorsMod.F90 ------ Check of n_pft's on MEGAN file changes by 1 - - M components/clm/bld/listDefaultNamelist.pl -------------- Can't use version 2 format datm namelist_definition for datm or drv - but use the version 1 drv file. - M components/clm/bld/queryDefaultNamelist.pl ------------- Can't use version 2 format datm namelist_definition for datm or drv - but use the version 1 drv file. - M components/clm/bld/unit_testers/build-namelist_test.pl - Make sure glc_present is added to tests for glc command line options - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - rooting_profile_method_carbon==1 for clm45 - M components/clm/bld/namelist_files/namelist_defaults_drydep.xml - New 78 pft file for megan that doesn't have bare soil - (bug 2370) - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r203 -Originator(s): sacks (Bill Sacks) -Date: Thu Nov 10 12:14:13 MST 2016 -One-line Summary: Bug fixes for snow-on-lake - -Purpose of changes ------------------- - -Fix a few bugs with the calculation of melt fluxes arising from -snow-on-lake. These appear to mainly just affect diagnostic terms, although in -theory it looks like this fixes a possible balance check error in rare -conditions. - -Changes are from Leo van Kampenhout (l.vankampenhout@uu.nl) - -Specific changes are: - -(1) qflx_sl_top_soil is no longer updated in LakeHydrology. Terms that used to - go into that variable now go into qflx_snow_drain. - -(2) For the case where we have snow above an unfrozen lake: Changed calculation - of qflx_snomelt and eflx_snomelt: - -Old: - qflx_snomelt(c) = qflx_snomelt(c) + h2osno(c)/dtime - eflx_snomelt(c) = eflx_snomelt(c) + h2osno(c)*hfus/dtime - -New: - qflx_snomelt(c) = qflx_snomelt(c) + sumsnowice(c)/dtime - eflx_snomelt(c) = eflx_snomelt(c) + sumsnowice(c)*hfus/dtime - -So note that this now just considers sumsnowice rather than the full h2osno - -i.e., it doesn't remelt the liquid in the snow pack. - -(3) For the case where we have snow above an unfrozen lake: The update of - qflx_snow_drain is changed; and again, note that qflx_sl_top_soil is gone. - -Old: - ! update drainage from snow pack for this case - qflx_snow_drain(c) = qflx_snow_drain(c) + qflx_snomelt(c) - qflx_sl_top_soil(c) = qflx_sl_top_soil(c) + h2osno(c) - -New: - ! update incidental drainage from snow pack for this case - qflx_snow_drain(c) = qflx_snow_drain(c) + h2osno(c)/dtime - -The old version had three apparent problems: - -(a) This drainage term contributed to both qflx_snow_drain and qflx_sl_top_soil, - which later get added together (in BalanceCheck); as noted in (1), the uses - of qflx_sl_top_soil and qflx_snow_drain have been merged into just - qflx_snow_drain in this routine. - -(b) The qflx_sl_top_soil addition adds h2osno, without dividing by dtime - -(c) The qflx_snow_drain addition adds the full qflx_snomelt, which may include - other terms that were set prior to this code. - -Note that, in the new version, we want to drain the *whole* snow pack in this -case - liquid as well as solid. - -(4) qflx_top_soil is changed: - -Old: - qflx_top_soil(c) = qflx_prec_grnd_rain(p) + qflx_snomelt(c) - -New: - qflx_top_soil(c) = qflx_prec_grnd_rain(p) + qflx_snow_drain(c) - -What the soil receives should equal what leaves the snow, i.e. the drainage term. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: Bill Sacks, Sean Swenson - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - ok - hobart_nag - pass - - ok means tests pass; baseline comparison failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_12_r202 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Potentially any clm45/clm50 case - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Appears to only change diagnostic fields - - Answer changes only show up in a few cases, presumably because this case - in the code is relatively uncommon. Specifically, these tests have answer - changes: - - FAIL LII_D_Ld3.f09_g16.ICLM45BGC.yellowstone_gnu.clm-default BASELINE - FAIL ERI_D_Ld9.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay BASELINE - FAIL ERP_Ld5.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default BASELINE - FAIL ERP_P180x2_D_Ld5.f19_g16.I1850CLM45.yellowstone_intel.clm-default BASELINE - FAIL ERS_D_Ld3.f09_g16_gl4.IG1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KitchenSink BASELINE - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/LakeHydrologyMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r202 -Originator(s): sacks (Bill Sacks) -Date: Wed Nov 9 12:02:41 MST 2016 -One-line Summary: Update to cime version used in cesm2_0_beta03 - -Purpose of changes ------------------- - -Update to cime version used in cesm2_0_beta03, which fixes some bugs and has -some new features. - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): -- Unexpected answer change with Build namelist2 PR (#640) (https://github.com/ESMCI/cime/issues/766) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- preview_namelists is now first run by case.build - no longer by case.setup - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- ERI and ERP tests now pass on hobart (previously these were failing silently) - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - pass - hobart_nag - ok - - ok means tests pass; answer changes in these two tests: - - FAIL ERP_Ld5.f19_g16.ICNCROP.yellowstone_pgi.clm-40default BASELINE - - testing-specific change, due to the fact that we now build this ERP test - non-threaded - - FAIL SMS_D_Ld1_Mmpi-serial.1x1_mexicocityMEX.I.hobart_nag BASELINE - - unknown reason for diff: see https://github.com/ESMCI/cime/issues/766 - - -CLM tag used for the baseline comparisons: clm4_5_12_r201 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - but only in the two tests noted above - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: just the two tests noted above - - what platforms/compilers: just the two tests noted above - - nature of change (roundoff; larger than roundoff/same climate; new climate): - not investigated closely - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): -- cime: clm4_5_12_r198_cime5.2.0-alpha.1-9-gd321e4b -> cime5.2.0-alpha.7 - -List all files eliminated: - -========= Just rename xmlchange_cmnds to shell_commands, because xmlchange_cmnds - is being deprecated -D components/clm/cime_config/testdefs/testmods_dirs/clm/pts/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/decStart/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/40pts/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/ptsROA/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLA/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLB/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsROA/xmlchange_cmnds -D components/clm/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/xmlchange_cmnds - -List all files added and what they do: - -========= Just rename xmlchange_cmnds to shell_commands, because xmlchange_cmnds - is being deprecated -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsROA/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLA/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLB/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsROA/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/pts/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLA/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLB/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/40pts/shell_commands - -List all existing files that have been modified, and describe the changes: none - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r201 -Originator(s): sacks (Bill Sacks) -Date: Wed Nov 9 09:18:54 MST 2016 -One-line Summary: Rework initialization of transient weights - important with use_init_interp - -Purpose of changes ------------------- - -Two main purposes: - -(1) When using use_init_interp in a case with CISM, avoid doing dyn landcover - adjustments in the first time step after initialization. This is important - in order to avoid fictitious adjustments simply due to the fact that we - don't have updated glacier areas until the run loop (as in the cold start - case). - -(2) Update prescribed transient weights (for PFTs and crops) in initialization, - rather than weighting for the run loop. This undoes part of - clm4_5_1_r101. This can be important if you're running use_init_interp, so - that the appropriate points are active on the output dataset. - -More details on (1): This was achieved by initializing glacier areas at the -start of the run loop for cold start or interpolated start. - -Rationale: - -In the first time step of a run that used cold start or init_interp, glacier -areas will start at whatever is specified on the surface dataset, because -coupling fields from GLC aren't received until the run loop. Thus, CLM will see -a potentially large, fictitious glacier area change in the first time step after -cold start or init_interp. We don't want this fictitious area change to result -in any state or flux adjustments. Thus, we apply this area change at the start -of the driver loop, so that in dynSubgrid_driver, it will look like there is no -glacier area change in the first time step. - -This needs to happen very early in the run loop, before any balance checks are -initialized, because - by design - this doesn't conserve mass at the grid cell -level. (The whole point of this new code block in the driver is that we adjust -areas without doing the typical state or flux adjustments that need to accompany -those area changes for conservation.) - -This accomplishes approximately the same effect that we would get if we were -able to update glacier areas in initialization. The one difference - and minor, -theoretical problem - that could arise from this start-of-run-loop update is: If -the first time step of the CESM run loop looked like: (1) GLC runs and updates -glacier area (i.e., glacier area changes in the first time step compared with -what was set in initialization); (2) coupler passes new glacier area to CLM; (3) -CLM runs. Then the code here would mean that the true change in glacier area -between initialization and the first time step would be ignored as far as state -and flux adjustments are concerned. But this is unlikely to be an issue in -practice: Currently GLC doesn't update this frequently, and even if it did, the -change in glacier area in a single time step would typically be very small. - -If we are ever able to change the CESM initialization sequence so that GLC -fields are passed to CLM in initialization, then this new code block in the -driver can be removed. - - -Also: Remove handling of first step since cold start in dynSubgrid_driver. This -is no longer needed now that (a) we update prescribed transient weights in -initialization, and (b) we have special-purpose code for glacier in the main -driver run loop. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; a few answer changes as noted below - -CLM tag used for the baseline comparisons: clm4_5_12_r200 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 with CISM, with use_init_interp = .true. - ALSO: Possible answer changes in other transient configurations - see note below - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - not investigated carefully; could have climate changing impacts in a coupled run - - Baseline comparisons failed for the following three tests, as expected: - FAIL ERS_D_Ld3.f09_g16_gl4.IG1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KitchenSink COMPARE_baseline - FAIL ERS_D_Ld12.T31_g37_gl4.IG1850CRUCLM50BGC.yellowstone_intel.clm-glcMEC_spunup_inc_dec_bgc COMPARE_baseline - FAIL SMS_Lm1.f09_g16_gl4.IG1850CRUCLM50BGC.yellowstone_intel.clm-clm50KitchenSink COMPARE_baseline - - In addition, it's possible that answer changes would appear in a coupled, - transient run with cold start or init_interp, due to changes in the fields - sent in initialization (or the first time step???) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Set prescribed transient weights in initialization. Get rid of special - handling of the first step since cold start; this is no longer needed - now that we (1) handle the glacier case specially in the driver, and - (2) initialize prescribed transient weights in initialization -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Handle glacier area specially in the first time step since cold start - or interpolated start -M components/clm/src/main/clm_driver.F90 - -========= Get rid of special handling of the first step since cold start; this - is no longer needed now that we (1) handle the glacier case specially - in the driver, and (2) initialize prescribed transient weights in - initialization -M components/clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 - -========= Add a flag to determine if we're doing an interpolated start -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/clm_initializeMod.F90 - -========= Just add some comments -M components/clm/src/main/subgridWeightsMod.F90 -M components/clm/src/main/glcBehaviorMod.F90 -M components/clm/src/init_interp/initInterpMindist.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r200 -Originator(s): erik (Erik Kluzek) -Date: Tue Nov 8 00:56:00 MST 2016 -One-line Summary: Latest parameter updates from simulations, ignore surface soil layer for plant hydraulic stress for greater variability in surface soil moisture - -Purpose of changes ------------------- - -Ignore surface soil layer for plant hydraulic stress which allows for greater variability in surface soil -moisture. Output some additional diagnostic fields to the history files. Rename fertnitro to manunitro, -both in code and in params files. Add options to vary baset by latitude for tropical crops and subtract -crop seed carbon. Don't call precision control for frootc for CLM50. - -For CLM50 we bring in the latest set of parameter updates to the parameter file as well as namelist items. -Many of these were manually tuned, and many were tuned with the automatic calibration process of Rosie Fisher -and Ben Sanderson. - -Fix several bugs, a couple possible divide by zero errors, only run freelivingfixation when FUN on. Limit -array operation by number of layers. Add option to put list of namelist parameters to an output file. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - bug 2349 Run freelivingfixation only if FUN is on - bug 2362 Possible divide by zero for fert when fertilizer off - bug 2364 maxval check goes over whole range of array when should just go to nlayers - bug 2366 fix divide by zero in Luna - bug 2367 Add a list of real parameters as part of what CLM build-namelist does (partial) - -Known bugs introduced in this tag (include bugzilla ID): [If none, remove this line] - bug 2368 Remove old "use_voc" logic that was put in as a hack to turn off megan when prognostic crop was on - (This existed before, but we just spotted it as a problem) - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - New namelist items: baset_mapping, baset_latvary_slope, baset_latvary_intercept, - initial_seed_at_planting - new clm namelists: cnphenology, crop - New history fields: LNC, BTRANMN, CPHASE, LATBASET, CROPSEEDC all default active - -Changes made to namelist defaults (e.g., changed parameter values): - New parameter calibrations - For CLM50: - baseflow_scalar=0.0090932, zetamaxstable=0.5, pot_hmn_ign_counts_alpha=0.0079611 - Jmaxb1=0.093563, initial_seed_at_planting=3.0, decomp_depth_efolding=10.0 - baset_mapping=varytropicsbylat, baset_latvary_intercept=12, baset_latvary_slope=0.4 - br_root=1.1678d-06, initial_Cstocks=3*200.0 - For CLM45 old defaults used: - -Changes to the datasets (e.g., parameter, surface or initial files): - New parameter dataset with latest calibration changing following fields: - mergetoclmpft modified to remove generic crops and merge to more existing crops - mxmat,arooti,lfemerg,min_planting_temp,bfact,fleafi,manunitro manually calibrated by Yaqiong Lu for crop - soilpsi_off,soilpsi_on manually calibrated - FUN_fracfixers,fun_cn_flex_a,fun_cn_flex_b,fsr_pft,grperc,dsladlai,ekn_active,froot_leaf,kmax,leaf_long,leafcn,mbbopt,psi50,slatop,stem_leaf - modified by automatic calibration scripts - maxpsi_hr hand calibrated by Charlie Koven - i_vcad,s_vcad hand calibrated for crop - FUN_fracfixers,dsladlai,ekn_active,froot_leaf,kmax,krmax,leaf_long,leafcn,mbbopt,psi50,slatop hand calibrated - akn_active,croot_stem,ekc_active,kc_nonmyc,kn_nonmyc modified slightly - leafcn,slato from TRY database - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - crop phase should be changed into integer with parameter indices for the different types - as well as outputting flag_meanings and flag_values attributes. Remove LATBASET from history - as constant. - - There is some complication for clm4_5 to preserve answers for latbarybaset - and subtract_cropseed for fert that should be removed. Will change answers - but shouldn't matter. - -Changes to tests or testing: None - -Code reviewed by: self, oleson, dll, yaqiong - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS (254 comparison tests are different because of namelist changes) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_12_r199 - - -Answer changes --------------- - -Changes answers relative to baseline: YES! for CLM50 (identical for CLM45) - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 - - what platforms/compilers: ALL - - nature of change: calibrated climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - clm5n04r193phs_2deg_calibrateparams_v3_crop_fert10perc_medshrb_1850ADspin - b.e20.B1850.f09_g16.pi_control.all.123 - (neither of these are identical to this tag for different reasons) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M parse_cime.cs.status -- Update to work with newer cime being used now - - M components/clm/bld/unit_testers/build-namelist_test.pl ----------- Add tests for - user_nl_clm_real_parameters and baset_mapping and Jmaxb1 - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - New namelist - items: baset_mapping, baset_latvary_slope, baset_latvary_intercept, - initial_seed_at_planting - M components/clm/bld/namelist_files/namelist_defaults_clm4_0.xml --- Ran xmllint - on it. - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Use latest - calibrated parameters for clm5_0: - baseflow_scalar=0.0090932, zetamaxstable=0.5, pot_hmn_ign_counts_alpha=0.0079611 - Jmaxb1=0.093563, initial_seed_at_planting=3.0, decomp_depth_efolding=10.0 - baset_mapping=varytropicsbylat, baset_latvary_intercept=12, baset_latvary_slope=0.4 - br_root=1.1678d-06, initial_Cstocks=3*200.0 - - New paramfiles with fertnitro renamed to manunitro, clm50 version with updated - parameters - M components/clm/bld/CLMBuildNamelist.pm --- Add output_reals command line option, - new namelist subroutines: setup_logic_crop, setup_logic_friction_vel, setup_logic_century_soilbgcdecompcascade, - new general subroutine: error_if_set to abort on error if a list of - namelist items is set - new namelists: cnphenology, crop - M components/clm/src/biogeochem/CNPhenologyMod.F90 ------- Add CNPhenologyReadNML, and namelist - items: initial_seed_at_planting, and subtract_cropseed, rename fertnitro to manunitro, and add - cropseedc, and cphase, if fertilizer off don't add in manunitro, subtract cropseed - if subtract_cropseed is set. - M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - Add cropseed and CROPSEEDC to history - and restart files - M components/clm/src/biogeochem/CNDriverMod.F90 -- Only call CNFreeLivingFixation if use_fun - M components/clm/src/biogeochem/CropType.F90 ----- Add ReadNML, baset_mapping/latvary_intercept/latvary_slope - cphase_patch, add CPHASE and LATBASET to history files, cphase to restart - M components/clm/src/biogeochem/CNPrecisionControlMod.F90 -- Set prec_control_for_froot to opposite of use_nguardrail - so turned on for clm5_0 and off for clm4_5 (currently needed to get c4 crops to grow) - M components/clm/src/main/clm_initializeMod.F90 --- call energyflux_inst%initAccVars - M components/clm/src/main/controlMod.F90 ---------- call CNPhenologyReadNML - M components/clm/src/main/clm_driver.F90 ---------- call energyflux_inst%UpdateAccVars - M components/clm/src/main/pftconMod.F90 ----------- change fertnitro to manunitro - M components/clm/src/main/clm_instMod.F90 --------- call call crop_inst%ReadNML and energyflux_inst%InitAccBuffer - M components/clm/src/biogeophys/BalanceCheckMod.F90 ------ Set indexg when found - M components/clm/src/biogeophys/SoilWaterMovementMod.F90 - Remove local krmax, and use param_inst version, set - rai to zero, limit array operation to :nlayers as nlayers change - M components/clm/src/biogeophys/EnergyFluxType.F90 ------- Add btran_min, and btran_min_inst, and interfaces: InitAccBuffer, - InitAccVars, UpdateAccVars, add BTRANMN to history, BTRAN_MIN, BTRAN_MIN_INST to restart - M components/clm/src/biogeophys/FrictionVelocityMod.F90 -- Initialize zetamaxstable - M components/clm/src/biogeophys/LunaMod.F90 -------------- Initialize Jmaxb1 = 0.1_r8, check lnc>0 as well as tlai, - otherwise set: jmax25_z/vcmx25_z==0 - M components/clm/src/biogeophys/PhotosynthesisMod.F90 ---- Add LNC to history and lnca to restart, rai(j=1)==0 for PHS - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - initial_Cstocks(:)==200 - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r199 -Originator(s): sacks (Bill Sacks) -Date: Sat Oct 29 14:20:11 MDT 2016 -One-line Summary: Use CISM2 by default - -Purpose of changes ------------------- - -For compsets that use CISM (IG compsets), use CISM2 by default. - -Also update CISM external to a version with an updated input file for CISM2 at 4 -km resolution. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Meaning of IG compset aliases changes - now means CISM2 rather than CISM1 -- This results in slightly changed glacier cover over Greenland -- If you have a restart file from an old IG case (CLM45/CLM50) and plug it into - an IG case with the same compset alias in this tag, there will be an initial - shock to the system as CLM responds to the new glacier area. Thus, this change - should be made in an offline run, and run for a year or more before plugging - the new restart file into a coupled run. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- All IG tests will BFAIL because they use a new resolution - -Changes to tests or testing: -- Removed the ICLM45GLCMEC compset that had been used for testing; replaced its - test with IGCLM45BGC -- Added an ERP IG test, replacing the old PEM IG test - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; IG tests BFAIL because of new CISM resolution - -CLM tag used for the baseline comparisons: clm4_5_12_r198 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Out-of-the-box IG compsets change answers due to - the new definition of these compsets (CISM2 rather than CISM1) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated closely; expected to be larger than roundoff/same climate - for most applications - - Also note that, for the sake of testing, IG tests will BFAIL - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): - -cism: cism2_1_21 -> cism2_1_24 - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/cime_config/config_compsets.xml -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r198 -Originator(s): Sean Swenson, Bill Sacks -Date: Thu Oct 20 20:39:56 MDT 2016 -One-line Summary: Rework mapping of irrigation from CLM to ROF - -Purpose of changes ------------------- - -The combination of the CLM changes and the changes to externals (RTM, MOSART, -CIME) change the way irrigation is mapped from CLM to ROF: Rather than being -mapped like other fluxes, it is mapped with normalization by VOLR. This means -that, if there are multiple ROF cells underlying a single CLM cell, then -irrigation with be withdrawn from each in an amount proportional to the VOLR in -each. So, for example, if a CLM cell overlaps two ROF cells, one with VOLR = 100 -and one with VOLR = 200, then twice as much water will be withdrawn from the -second as from the first. - -The main motivation for this change is to decrease the frequency at which -irrigation exceeds available river volume in a given ROF cell. This will -especially be improved once the volr-limited irrigation is working (this will be -fixed in an upcoming tag). - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- If this CLM tag is plugged in to a CESM tag, note that it depends on - rtm1_0_59, mosart1_0_19, and the cime changes from - https://github.com/ESMCI/cime/pull/681 - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Added some irrigation tests -- Removed some tests from the xfail list which are now passing - -Code reviewed by: Bill Sacks - Note that most changes are originally from Sean Swenson; Bill Sacks reviewed - and tested the changes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; some baseline comparison failures as noted below; - also, many IG tests (i.e., with CISM) showed baseline comparison failures, - but this is simply because, with the new CISM external, CISM now does not - produce a history file in short tests, whereas it did before. - -CLM tag used for the baseline comparisons: clm4_5_12_r197 -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 with irrigation, and all tests with MOSART - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - not investigated carefully, but expected to be larger than roundoff/same - climate - - Irrigation changes are due to the new mapping - - MOSART changes are just in x2l_Flrr_volr, r2x_Flrr_vol,r TWS & VOLR - due to - a fixed calculation of VOLR in the MOSART external - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): -- cime: 5.1.1 -> clm4_5_12_r198_cime5.2.0-alpha.1-9-gd321e4b - This is a cime branch tag, based off of baseline version d321e4b (this - baseline version is 9 commits past cime5.2.0-alpha.1). The changes on this - branch are expected to be available by cime5.2.0-alpha.5 -- cism: 2_1_18 -> 2_1_21 (unrelated to the other changes in this tag) -- rtm: 1_0_58 -> 1_0_59 -- mosart: 1_0_18 -> 1_0_19 - -List all files eliminated: - -========= Renamed to include irrigation -D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp - -List all files added and what they do: - -========= Added more tests with irrigation turned on -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_spunup -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropIrrigMonth_interp - -List all existing files that have been modified, and describe the changes: - -========= Main changes for routing irrigation as a separate field -M components/clm/src/main/lnd2atmType.F90 -M components/clm/src/main/lnd2atmMod.F90 -M components/clm/src/cpl/clm_cpl_indices.F90 -M components/clm/src/cpl/lnd_import_export.F90 - -========= Use volrmch rather than volr for limiting irrigation -M components/clm/src/main/clm_driver.F90 - -========= Add 'target' attributes to some variables that need them -M components/clm/src/init_interp/initInterpMultilevelContainer.F90 - -========= Add a deallocation statement -M components/clm/src/main/atm2lndType.F90 - -========= Rename a variable -M components/clm/src/biogeophys/IrrigationMod.F90 - -========= Add a new diagnostic field -M components/clm/src/biogeophys/WaterfluxType.F90 - -========= Added two debug tests with irrigation; changed the long clm50 crop - test to include irrigation -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Two ERI tests now pass due to fixes in CIME and CISM -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r197 -Originator(s): erik (Erik Kluzek) -Date: Fri Oct 14 03:17:41 MDT 2016 -One-line Summary: Some cleanup for plant hydraulic stress and adding more namelist parameters - -Purpose of changes ------------------- - -Some cleanup and documentation of Plant Hydraulic Stress (PHS) from Keith Oleson and Daniel Kennedy. -Setup some common indices as paraameters for PHS rather than hard-coded magic numbers. -Add several new namelist parameters and -light_res option to use high resolution lightnng dataset. - -Work with bombspike option and add a test for it. Remove ESMF interfaces. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2361 Setting of glc_nec in a clm aux test - 2359 build-namelist_test.pl has 20 fails in clm4_5_12_r195 - 2351 1x1_tropicAtl case issues - 2350 problems with bombspike case - 2339 don't write crootfr and rootfr - 2333 build-namelist_test.pl should label the mode in a more useful way - 2332 fire_emis test is unable to add fire emission-specific history fields - 2325 limit scope of mct vars in decompInitMod and lnd_comp_mod - 2293 better handling of bombspike case - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - new namelist items: initial_Cstocks, freelivfix_slope_wET, freelivfix_intercept, zetamaxstable, Jmaxb1 - new build-namelist option (CLM_NAMELIST_OPTS): light_res - - Change DJK history field to TSINK - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): - Option for a half-degree lightning dataset rather than just the default T62 dataset - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - SoilWaterMovementMod.F90 duplicates the soil and root indices that are in PhotosynthesisMod - -Changes to tests or testing: Add bombspike test - -Code reviewed by: self, oleson, djk - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS (310 comparisons fail, because of namelist changes) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_12_r196 - - -Answer changes --------------- - -Changes answers relative to baseline: no bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: Remove ESMF interfaces no longer supported - - D components/clm/src/cpl/lnd_comp_esmf.F90 - D components/clm/src_clm40/main/lnd_comp_esmf.F90 - -List all files added and what they do: - --------------- Add new test for c14 bombspike - A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/user_nl_clm - A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/include_user_mods - A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_bombspike1963/shell_commands - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/CLMBuildNamelist.pm --------------------------- Add -light_res option, clarify help, set cnfireson - when lightning/pop defns needed - M components/clm/bld/unit_testers/build-namelist_test.pl ----------- set mode to options to configure, add new tests for - the new namelist options - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- set spinup_state, use_dynroot, paramfile for use_ed/clm50 - correct year range for flanduse_timeseries 1x1_tropicAtl, set light_res defaults, add half-degree lightning file, - - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add new namelist items: initial_Cstocks, freelivfix_slope_wET, - freelivfix_intercept, zetamaxstable, Jmaxb1, and light_res option - ---------------- Remove unneeded ndepsrc="stream", add cnfireson for pop-dens and lightning - M components/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/2000_control.xml - M components/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - M components/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - M components/clm/bld/namelist_files/use_cases/1850_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/user_nl_clm - turn hydrstess off - - M components/clm/src/utils/spmdGathScatMod.F90 ------- Add only clause to use statements (bug 2325) - M components/clm/src/biogeochem/CNFireLi2016Mod.F90 -- Add need_lightning_and_popdens, remove note on compiler bug - M components/clm/src/biogeochem/CNNDynamicsMod.F90 --- Add CNNDynamicsReadNML for freelivfix_intercept, freelivfix_slope_wET - M components/clm/src/biogeochem/CNFireMethodMod.F90 -- Add need_lightning_and_popdens - M components/clm/src/biogeochem/CNFireLi2014Mod.F90 -- Set need_lightning_and_popdens=.true. - M components/clm/src/biogeochem/CNFireNoFireMod.F90 -- Set need_lightning_and_popdens=.false. - M components/clm/src/biogeochem/CNFireBaseMod.F90 ---- Add need_lightning_and_popdens, only do them if true - M components/clm/src/main/clm_varpar.F90 ------------- Make i_met_lit, i_cel_lit, i_lig_lit parameters, set i_cwd appropriately - M components/clm/src/main/decompInitMod.F90 ---------- Add only clause to use statements (bug 2325) - M components/clm/src/main/ndepStreamMod.F90 ---------- Add only clause to use statements (bug 2325) - M components/clm/src/main/GetGlobalValuesMod.F90 ----- Add only clause to use statements (bug 2325) - M components/clm/src/main/controlMod.F90 ------------- Add calls to: LunaReadNML, FrictionVelReadNML, and - CNNDynamicsReadNML, DecompCascadeBGCreadNML - M components/clm/src/main/clm_instMod.F90 ------------ Shorten statement - M components/clm/src/main/ncdio_pio.F90.in ----------- Have pio bcast error, so terminate here rather than deep in pio - M components/clm/src/biogeophys/SoilWaterMovementMod.F90 - Change djk to tsink, work on documentation - set soil=1,root=4 as parameters - M components/clm/src/biogeophys/EnergyFluxType.F90 ------- Always allocate bsun_patch/bsha regardless of phs on/off - M components/clm/src/biogeophys/FrictionVelocityMod.F90 -- Add FrictionVelReadNML for zetamaxstable - M components/clm/src/biogeophys/UrbanFluxesMod.F90 ------- Use zetamaxstable from frictionvel_parms_inst - M components/clm/src/biogeophys/LunaMod.F90 -------------- Add LunaReadNML for Jmaxb1 - M components/clm/src/biogeophys/PhotosynthesisMod.F90 ---- Set sun,sha,xyl,root,veg,soil parameters and use them, always allocate - regardless of phs, ensure nvegwcs==4, remove commented out lines, add back call to bombspike, - remove some unused arrays, work on comments, - M components/clm/src/biogeophys/LakeFluxesMod.F90 -------- Use zetamaxstable from frictionvel_parms_inst - M components/clm/src/biogeophys/SoilStateType.F90 -------- Change DJK to TSINK, always alloc tsink, don't output CROOTFR/ROOTFR - M components/clm/src/biogeophys/BareGroundFluxesMod.F90 -- Use zetamaxstable from frictionvel_parms_inst - M components/clm/src/biogeophys/CanopyFluxesMod.F90 ------ Use zetamaxstable from frictionvel_parms_inst, work on comments for PHS - M components/clm/src/biogeophys/CanopyStateType.F90 ------ Always allocate vegwp_patch don't worry about PHS - M components/clm/src/biogeophys/test/HumanStress_test/test_humanstress.pf - Speed up test - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - Add DecompCascadeBGCreadNML for initial_Cstocks, - make som pools indices parameters - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r196 -Originator(s): erik (Erik Kluzek) -Date: Tue Sep 27 02:46:29 MDT 2016 -One-line Summary: Bring new cime5 to clm trunk - -Purpose of changes ------------------- - - Update from cime4 version to cime5.1.1. This has some changes to the user interface - on setting up cases. create_newcase largely works the same, but other scripts have - subtle to more extensive changes to them. cime5 has scripts all done in object oriented Python. - - create_newcase changes some options to use double "--" signs. Standard options - can be done with either one or two. - --user-compset If set, then the --compset argument is treated as a - user specified compset.This assumes that all of the - compset settings in thecompset along name have been - defined for all of its componentsIf the compset name - is found as a supported compset, then it will be - treated as such. - --pesfile PESFILE Only used and required for --user-compset - argument.Full pathname of the pes specification - fileThis argument is required if --user-compset is - True - --user-grid If set, then the -grid argument is treated as a user - specified grid.As such, the additional argument - --gridfile must also be specifiedand all of the grid - settings in the --res argument name (which must be a - grid longnamehave been defined in the grid file - pointed to by --gridfile - --gridfile GRIDFILE Full pathname of config grid file to useThis should be - a copy of cime_config/config_grids.xmlwith the new - user grid changes added to itThis argument is required - if --user-grid is True - - create_newcase adds the following new options ( - --ninst NINST Specify number of component instancesSet the number of - component instances in the case. - --srcroot SRCROOT Alternative path for source root directory. By default - this is set to cimeroot/../ - --walltime WALLTIME Set the wallclock limit for this case. Can use env var - CIME_GLOBAL_WALLTIME to set this. - -q QUEUE, --queue QUEUE - Force batch system to use a certain queue - - New files created in your case: - - Several files are softlinked into the case directory (such as case.setup, case.run, etc.) - software_environment.txt -- your environment variables - PESetupHist --- Directory for processor history changes - - case.clean_build is removed, and you use the --clean option to case.build - - xmlchange adds several options such as -subgroup - xmlquery operation is a bit different. list capability is done via --list-all option. - - Format of *.xml files in your case is a bit different than before - - PIO versions were updated and PIO now catches some errors that it let go before. - - userdefinedmachine is upgraded so that you create a ~/.cime directory and put config_machines.xml - for your machine (as well as config_compilers.xml, config_batch.xml, and config_build.xml - if needed) - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2354 New streams file for urban is in NetCDF4 classic format and new cime5 - gnu/pnetcdf/pio1 combination can't read it - -Known bugs introduced in this tag (include bugzilla ID): - 2359 build-namelist_test.pl has 20 fails in clm4_5_12_r195 - 2358 test_driver.sh has problems with running gen_domain with clm4_5_12_r19620 fails in - 2357 PTCLMmkdata broken in clm4_5_12_r196 due to changes in cime5 - 2356 Test hangs on hobart - 2353 areas wrong on mosart input file - - cime5 issues: - 589 Add back ability of ascii test lists to have comments... - 580 ERI test with REFCASE prestages file into wrong run directory - 506 make 1 processor cases by default mpi-serial (won't fix) - 294 Need an "all" option to --xml-* options - 293 cs.status looses some of the functionality that was in cimeteststatus - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - - No longer need to provide machine name in create_newcase - New options to create_newcase: --queue, --walltime, --ninst - Some less used options were removed. - - Single processor cases, no longer by default use mpi-serial. You have - to manually change MPILIB! - - manage_* scripts command line options changed use --help option to query usage. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): - Urban streams file changed from NetCDF4 format to NetCDF3 so new pio1 and pnetcdf could read it - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - - interface to create_test is changed. Standard operation is like this... - - ./create_test --xml-category aux_clm45 --compare clm4_5_12_r195 --generate clm4_5_12_r196 \ - --xml-machine yellowstone--xml-compiler intel - - Currently in this version cime5.1.1 you can't leave off --xml-compiler as it will run - everything with the default compiler - -Code reviewed by: self, sacks, mvertens - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK 20 tests fail, and 104 namelists are different - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - OK (bug 2358) - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - FAIL (bug 2357) - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_12_r195 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime, rtm, mosart, cism - cime to cime5.1.1 - rtm to rtm1_0_58 - mosart to mosart1_0_18 - cism to cism2_1_18 --- Removes ESMF tests - - add output history frequency "time_period_freq" to history files - -List all files eliminated: Move to name with clm50 in it - -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp/README - -List all files added and what they do: - -A parse_cime.cs.status ---- Script to parse cs.status output like cime4 cimeteststatus - usage: ../../parse_cime.cs.status cs.status.* - - Scripts to take a baseline directory in cime4 format to cime5 format -A components/clm/tools/clm4_5/refactorTools/esmciport/convertbaselines4esmci -A components/clm/tools/clm4_5/refactorTools/esmciport/linkhistorytofileswdate.ncl -A components/clm/tools/clm4_5/refactorTools/esmciport - - Have clm50 in the name, and add new CLM50 crop finidat file -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50cropMonth_interp - -List all existing files that have been modified, and describe the changes: - - Initial changes to get gen_domain build/run working with cime5 -M components/clm/test/tools/test_driver.sh -- update module settings, -M components/clm/test/tools/TCBCFGtools.sh -- update how configure works, and run - .env_mach_specific.sh, don't need to softlink Macros.make - -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- Update urban streams - files so in NetCDF3 format rather than NetCDF4 so cime5/pio can read it - -M components/clm/cime_config/config_compsets.xml - whitespace changes, add CAM55 - -M components/clm/cime_config/testdefs/testmods_dirs/clm/default/shell_commands ---- no - mult-instance extra copies, don't set PIO rearranger type -M components/clm/cime_config/testdefs/testmods_dirs/clm/40pts/xmlchange_cmnds ----- don't - set TOTALPES, but set ESP -M components/clm/cime_config/testdefs/testmods_dirs/clm/pts/xmlchange_cmnds ------- don't - set TOTALPES, but set ESP -M components/clm/cime_config/testdefs/testmods_dirs/clm/40default/shell_commands -- no - mult-instance extra copies -M components/clm/cime_config/testdefs/testlist_clm.xml - Make all single processor - tests with _Mmpi-serial, change cropMonth_interp to clm50cropMonth_interp - change some PEM tests to ERP -M components/clm/cime_config/buildlib ------------------ Changed to python -M components/clm/cime_config/config_component.xml ------ Additive option changed to cime5 - Remove BARRIER_N/OPTION/ATM_PIO_TYPENAME/LND_PIO_REARRANGER moved to cime5 - format changed slightly - -M components/clm/src/biogeochem/MEGANFactorsMod.F90 -- MEGAN comp_names is 40 rather - than 32, to match size on megan emissions file - -M components/clm/src/main/histFileMod.F90 --- Add time_period_freq -MM components/clm/src/main/clm_varcon.F90 ---- Add isecsphr, and isecspmin - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r195 -Originator(s): sacks (Bill Sacks) -Date: Sun Sep 18 07:23:25 MDT 2016 -One-line Summary: Remove dependence on column weights in fire code - -Purpose of changes ------------------- - -When calculating the fractions of BET and BDT, calculate these as fractions of -the column rather than as fractions of the grid cell. This is needed for -consistency with all other code in CLM, where the behavior of a column shouldn't -depend on that column's weight on the grid cell. The earlier code was -problematic in this way: If you did two runs - one with default areas, and one -where the natural veg landunit area was larger or smaller - then the evolution -of the natural veg landunit could change; this is not supposed to happen in CLM. - -This can change answers for the fire code, but should generally only change -answers by a small amount, unless there are tropical grid cells where the -natural vegetation fraction is substantially less than 1. - -Fang Li is okay with this change. She points out that the original formulation -was based on the fact that literataure typically cites 60% of (BET+BDT) on the -grid cell as a cutoff for being classified as tropical closed forest for the -sake of fire determinations, so the earlier code was consistent with that -definition. She also points out that this change could lead to a slightly -greater prevalence of deforestation fires and (after tuning) a consequently -smaller prevalence of non-deforestation fires - which can be undesirable. But -overall she is okay with this change given its likely small impact. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): partial fix of item #14 in bugz 1679 - Still need to address dtrotr_col, but the fix there is different, and is tied - in with other changes for dynamic landunits. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass; some baseline comparisons fail - -CLM tag used for the baseline comparisons: clm4_5_12_r194 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CN/BGC with CLM45/CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Greater than roundoff for at least some tests; from some spot-checks, - seems to be same climate. - - I have spot-checked a few tests that have greater than roundoff-level - diffs (ERP_D_Ld5.f19_g16.IRCP85CLM45BGC.yellowstone_pgi.clm-drydepnomegan - and ERI_D_Ld9.f09_g16.ICLM45BGC.yellowstone_intel.clm-default). These - tests have diffs in just a few grid cells in the tropics. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeochem/CNFireBaseMod.F90 -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 -M components/clm/src/biogeochem/CNVegStateType.F90 -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r194 -Originator(s): sacks (Bill Sacks) -Date: Thu Sep 1 10:17:56 MDT 2016 -One-line Summary: Dribble annual dyn landunit adjustment fluxes; initialize water state for new crop columns - -Purpose of changes ------------------- - -Two main changes in this tag: - -(1) Add infrastructure for dribbling fluxes that are generated once per year (on - the first time step of the year), so that an equal flux is produced - throughout the year. Apply this infrastructure to the correction fluxes that - are generated to conserve water and energy with dynamic columns / landunits. - -(2) When a new column comes into existence (currently, this means a new crop - column), copy h2osoi_liq, h2osoi_ice and h2osoi_vol from the "template" - column (typically a natural veg column on that gridcell), in addition to the - pre-existing copy of t_soisno. - -Also, a minor change that touched many files: Replace inline uses of __FILE__ -with a constant ('sourcefile') defined in each source file where this is -used. This is needed because lines with __FILE__ were sometimes exceeding pgi's -line limit (since pgi enforces the line limit after expanding macros). (See bugz -2049.) - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2049 - __FILE__ expands to be too long sometimes - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): -- New uses of __FILE__ on outstanding branches should be replaced with - sourcefile. Note that I have only added 'sourcefile' in files that currently - needed it; other files may need to have this added. - -Changes to tests or testing: -- Added this test in order to test mid-year restarts with dynamic landunits - (needed to test restartability of annual flux dribbling): - ERS_D_Ld7.1x1_smallvilleIA.IHISTCLM45BGCCROP.yellowstone_intel.clm-decStart1851_noinitial - - Note that the "noinitial" aspect of this can be removed once ignore_ic_date is - made compatible with crop. - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass or xfail; expected baseline failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_12_r193 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 transient (HIST, RCP, DV or IG) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Not investigated carefully, but expected to be new climate for - configurations that have transient column areas (IG or transient crop, - which involve large transitions at the starat of the year), but only - marginally different (approx. roundoff-level) for transient natural PFTs - (which involve gradual transitions throughout the year). - - I have verified that the answer changes due to the new annual flux - dribbler infrastructure are reduced to 0 (i.e., bit-for-bit) if the flux - on the first time step of the year is treated as before - i.e., other than - the dribbling that is applied to this start-of-year flux, this - infrastructure is bit-for-bit with the earlier code in dynConsBiogeophys. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= New infrastructure for dribbling fluxes that are generated on the - first time step of the year - spreading these fluxes throughout the - year -A components/clm/src/utils/AnnualFluxDribbler.F90 -A components/clm/src/utils/test/annual_flux_dribbler_test/test_annual_flux_dribbler.pf -A components/clm/src/utils/test/annual_flux_dribbler_test/CMakeLists.txt -A components/clm/src/utils/test/annual_flux_dribbler_test - -========= Test mods for new test: tests mid-year restarts with dynamic landunits -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart1851_noinitial - -List all existing files that have been modified, and describe the changes: - -========= Use new infrastructure for dribbling fluxes in order to dribble fluxes - generated to conserve water and energy with changing column areas -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 - -========= New time manager routines needed for dribbling infrastructure -M components/clm/src/utils/test/clm_time_manager_test/test_clm_time_manager.pf -M components/clm/src/utils/clm_time_manager.F90 -M components/clm/src/unit_test_shr/unittestTimeManagerMod.F90 - -========= When a new column comes into existence, also copy some soil water - variables from the template column -M components/clm/src/dyn_subgrid/dynInitColumnsMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf - -========= Add tests of new dribbling infrastructure -M components/clm/src/utils/CMakeLists.txt -M components/clm/src/utils/test/CMakeLists.txt - -========= New test: tests mid-year restarts with dynamic landunits -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Replace inline uses of __FILE__ with a constant ('sourcefile') -M components/clm/src/utils/quadraticMod.F90 -M components/clm/src/utils/clmfates_interfaceMod.F90 -M components/clm/src/utils/restUtilMod.F90.in -M components/clm/src/utils/SimpleMathMod.F90 -M components/clm/src/biogeochem/NutrientCompetitionMethodMod.F90 -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNDVType.F90 -M components/clm/src/biogeochem/VOCEmissionMod.F90 -M components/clm/src/biogeochem/CNFireFactoryMod.F90 -M components/clm/src/biogeochem/CNVegComputeSeedMod.F90 -M components/clm/src/biogeochem/C14BompbSpikeMod.F90 -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 -M components/clm/src/biogeochem/DryDepVelocity.F90 -M components/clm/src/biogeochem/CNDVDriverMod.F90 -M components/clm/src/biogeochem/MEGANFactorsMod.F90 -M components/clm/src/biogeochem/SpeciesNonIsotopeType.F90 -M components/clm/src/biogeochem/SatellitePhenologyMod.F90 -M components/clm/src/biogeochem/NutrientCompetitionFactoryMod.F90 -M components/clm/src/biogeochem/CNDVEstablishmentMod.F90 -M components/clm/src/biogeochem/DUSTMod.F90 -M components/clm/src/biogeochem/CNProductsMod.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 -M components/clm/src/biogeochem/CNVegStateType.F90 -M components/clm/src/biogeochem/CNMRespMod.F90 -M components/clm/src/biogeochem/CNFUNMod.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/biogeochem/ch4Mod.F90 -M components/clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 -M components/clm/src/biogeochem/CNGapMortalityMod.F90 -M components/clm/src/biogeochem/SpeciesIsotopeType.F90 -M components/clm/src/biogeochem/CNFireBaseMod.F90 -M components/clm/src/biogeochem/CropType.F90 -M components/clm/src/biogeochem/CNCIsoFluxMod.F90 -M components/clm/src/biogeochem/CNPrecisionControlMod.F90 -M components/clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 -M components/clm/src/biogeochem/dynHarvestMod.F90 -M components/clm/src/biogeochem/ch4varcon.F90 -M components/clm/src/biogeochem/CNSharedParamsMod.F90 -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 -M components/clm/src/init_interp/initInterpBounds.F90 -M components/clm/src/init_interp/initInterpMultilevelCopy.F90 -M components/clm/src/init_interp/initInterp1dData.F90 -M components/clm/src/init_interp/initInterpMultilevelSplit.F90 -M components/clm/src/init_interp/initInterp.F90 -M components/clm/src/init_interp/initInterp2dvar.F90.in -M components/clm/src/init_interp/initInterpMultilevelInterp.F90 -M components/clm/src/init_interp/initInterpMultilevelContainer.F90 -M components/clm/src/init_interp/initInterpMindist.F90 -M components/clm/src/init_interp/initInterpMultilevelSnow.F90 -M components/clm/src/main/subgridAveMod.F90 -M components/clm/src/main/initGridCellsMod.F90 -M components/clm/src/main/initVerticalMod.F90 -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/lnd2atmMod.F90 -M components/clm/src/main/surfrdMod.F90 -M components/clm/src/main/ncdio_pio.F90.in -M components/clm/src/main/reweightMod.F90 -M components/clm/src/main/glcBehaviorMod.F90 -M components/clm/src/main/subgridWeightsMod.F90 -M components/clm/src/main/decompInitMod.F90 -M components/clm/src/main/subgridRestMod.F90 -M components/clm/src/main/subgridMod.F90 -M components/clm/src/main/ndepStreamMod.F90 -M components/clm/src/main/atm2lndType.F90 -M components/clm/src/main/column_varcon.F90 -M components/clm/src/main/histFileMod.F90 -M components/clm/src/main/restFileMod.F90 -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/GetGlobalValuesMod.F90 -M components/clm/src/main/initSubgridMod.F90 -M components/clm/src/main/filterColMod.F90 -M components/clm/src/main/glc2lndMod.F90 -M components/clm/src/main/filterMod.F90 -M components/clm/src/main/lnd2glcMod.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/surfrdUtilsMod.F90 -M components/clm/src/main/pftconMod.F90 -M components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 -M components/clm/src/ED/biogeochem/EDSharedParamsMod.F90 -M components/clm/src/ED/main/EDCLMLinkMod.F90 -M components/clm/src/ED/main/EDRestVectorMod.F90 -M components/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 -M components/clm/src/biogeophys/OzoneOffMod.F90 -M components/clm/src/biogeophys/SnowSnicarMod.F90 -M components/clm/src/biogeophys/SoilMoistStressMod.F90 -M components/clm/src/biogeophys/OzoneMod.F90 -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/biogeophys/FrictionVelocityMod.F90 -M components/clm/src/biogeophys/UrbanFluxesMod.F90 -M components/clm/src/biogeophys/LunaMod.F90 -M components/clm/src/biogeophys/SurfaceAlbedoMod.F90 -M components/clm/src/biogeophys/TemperatureType.F90 -M components/clm/src/biogeophys/HumanIndexMod.F90 -M components/clm/src/biogeophys/SurfaceAlbedoType.F90 -M components/clm/src/biogeophys/PhotosynthesisMod.F90 -M components/clm/src/biogeophys/SoilHydrologyMod.F90 -M components/clm/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 -M components/clm/src/biogeophys/SoilHydrologyType.F90 -M components/clm/src/biogeophys/CanopyFluxesMod.F90 -M components/clm/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 -M components/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 -M components/clm/src/biogeophys/SurfaceRadiationMod.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/biogeophys/WaterStateType.F90 -M components/clm/src/biogeophys/UrbBuildTempOleson2015Mod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/LakeTemperatureMod.F90 -M components/clm/src/biogeophys/CanopyStateType.F90 -M components/clm/src/biogeophys/TridiagonalMod.F90 -M components/clm/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 -M components/clm/src/biogeophys/UrbanTimeVarType.F90 -M components/clm/src/biogeophys/UrbanRadiationMod.F90 -M components/clm/src/biogeophys/BandDiagonalMod.F90 -M components/clm/src/biogeophys/AerosolMod.F90 -M components/clm/src/biogeophys/IrrigationMod.F90 -M components/clm/src/biogeophys/SurfaceResistanceMod.F90 -M components/clm/src/biogeophys/UrbanParamsType.F90 -M components/clm/src/biogeophys/UrbanAlbedoMod.F90 -M components/clm/src/biogeophys/RootBiophysMod.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/SoilWaterMovementMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenUptakeMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 -M components/clm/src/dyn_subgrid/dynTimeInfoMod.F90 -M components/clm/src/dyn_subgrid/dynFileMod.F90 -M components/clm/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 -M components/clm/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 -M components/clm/src/dyn_subgrid/dynColumnTemplateMod.F90 -M components/clm/src/dyn_subgrid/dynpftFileMod.F90 -M components/clm/src/dyn_subgrid/dynVarMod.F90.in -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 -M components/clm/src/dyn_subgrid/dyncropFileMod.F90 -M components/clm/src/dyn_subgrid/dynLandunitAreaMod.F90 -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r193 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue Aug 30 21:08:39 MDT 2016 -One-line Summary: Bugfix in BalanceCheckMod: revert tolerance change and removal of endrun call introduced in r192 - -Purpose of changes ------------------- - -Revert the tolerance change and removal of an endrun call in BalanceCheckMod -that were introduced in r192. - -Bugs fixed or introduced ------------------------- - -see above. - -Notes of particular relevance for users ---------------------------------------- - -none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - n/a, not run - - unit-tests (components/clm/src): - - yellowstone - n/a, not run - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - -CLM tag used for the baseline comparisons: clm4_5_12_r192 - - -Answer changes --------------- - -Changes answers relative to baseline: - - Test suite bit for bit with r191 and r192. Long runs may change from - r192 if the tolerance or endrun condition are encountered, but - should agree with r191. - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - components/clm/src/biogeophys/BalanceCheckMod.F90 - revert tolerance - change and reinstate endrun call. - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r192 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Sat Aug 27 21:32:54 MDT 2016 -One-line Summary: ED bugfixes and initial refactoring for a standalone library - -Purpose of changes ------------------- - -NGEE-T development work on ED. Numerous science and software -improvements including: - -* carbon linkages between ed and subsurface soil biogeochemistry -* improvements to patch fusion -* litter flux outputs -* phenology is self contained -* sites now align to clm columns -* ed is now a bgc mode -* check for incompatible physics -* better error checking of compatible name list options -* fixed memory corruption during restarts -* bit for bit restart for single point and global simulations works -* numerous threading related issues fixed -* numerous improvements to history and diagnostics - -Start renaming some routines and modules to use the new name "FATES". - -Initial development work to isolate ED from CLM and create a -standalone library, including: - -* start defining an API for external drivers to interact with fates. -* start moving interaction between clm and fates into interface routines -* start work on thread safe fates objects -* data structures to clearly identify and isolate input and output -boundary conditions for some fates routines. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): - -BalanceCheckMod.F90 was changed to loosen tolerances, not call endrun -if error in energy balance. This change isn't changing answers in -tests and wasn't caught until late in merging. It should probably be -reverted. - -ED is not thread safe, and is not expected to work or restart with -multiple threads. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CLM's user interface (e.g., new/renamed XML or namelist -variables): ed is now a bgc mode. - -Changes made to namelist defaults (e.g., changed parameter values): - -Changes to the datasets (e.g., parameter, surface or initial files): -updated ed parameters file. - -Substantial timing or memory changes: unknown - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - -Code reviewed by: Ryan Knox, Charlie Koven, Rosie Fisher - -CLM testing: - - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ED tests have been added to the clm test suite on yellowstone and - hobart. These will BFAIL because they do not have baselines in - r191. - - CLM tag used for the baseline comparisons: clm4_5_12_r191 - - ed test suite - baseline 9c008bf - yellowstone gnu, intel, pgi - pass - -Answer changes --------------- - -Changes answers relative to baseline: bit for bit for clm40, clm45 and -clm50. Changes answers for ED compsets, but these were not supported -or expected to work in the trunk. - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: - - components/clm/src/ED/biogeochem/EDPhenologyType.F90 - - List all files added and what they do: - - new mods test for ed - components/clm/cime_config/testdefs/testmods_dirs/clm/edNoFire - components/clm/cime_config/testdefs/testmods_dirs/clm/edNoFire/user_nl_clm - components/clm/cime_config/testdefs/testmods_dirs/clm/edNoFire/include_user_mods - components/clm/cime_config/testdefs/testmods_dirs/clm/edNoFire/shell_commands - - new unit tests for ED build namelist options - components/clm/bld/test_build_namelist/t/test_ed_mode.pm - - new clm-ed interface: - components/clm/src/utils/clmfates_interfaceMod.F90 - - components/clm/src/ED/main/FatesInterfaceMod.F90 - components/clm/src/ED/main/FatesGlobals.F90 - - call subsurface biogeochemistry driven by ED - components/clm/src/biogeochem/EDBGCDynMod.F90 - - List all existing files that have been modified, and describe the changes: - - =============================================================== - - ED as a bgc mode, better testing of namelist options related to ed - and checks for compatibility. - - components/clm/cime_config/config_component.xml - components/clm/bld/CLMBuildNamelist.pm - components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - components/clm/bld/unit_testers/build-namelist_test.pl - components/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml - components/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml - components/clm/bld/test_build_namelist/t/test_vichydro.pm - components/clm/bld/test_build_namelist/t/template_test_XXX.pm - - Update ED test mods and add ED tests to clm test suite - components/clm/cime_config/testdefs/testmods_dirs/clm/edTest/user_nl_clm - components/clm/cime_config/testdefs/testlist_clm.xml - - clm-ed interaction - components/clm/src/main/clm_varpar.F90 - ed compatibility with century decomp - components/clm/src/main/subgridWeightsMod.F90 - ed bugfix with pft diags - components/clm/src/main/decompInitMod.F90 - cohorts aligned with columns - components/clm/src/main/clm_initializeMod.F90 - use ed interfaces, ed as bgc mode - components/clm/src/main/subgridMod.F90 - ed subgrid info updated - components/clm/src/main/ColumnType.F90 - whitespace - components/clm/src/main/histFileMod.F90 - ed specific output - components/clm/src/main/clm_driver.F90 - call ed interfaces - components/clm/src/main/initGridCellsMod.F90 - ed cohorts align with columns - components/clm/src/main/initVerticalMod.F90 - ed levels - components/clm/src/main/surfrdMod.F90 - bug work around, ed related? - components/clm/src/main/clm_instMod.F90 - use ed interfaces, ed as bgc mode - components/clm/src/main/readParamsMod.F90 - ed as bgc mode - components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 - add ed to literfall - components/clm/src/biogeochem/CNVegetationFacade.F90 - ed requires veg data structures for subsurface bgc - components/clm/src/biogeochem/CNDriverMod.F90 - remove canopy state - components/clm/src/biogeophys/BalanceCheckMod.F90 - loosen tolerances, don't endrun if error. - components/clm/src/biogeophys/TemperatureType.F90 - remove ed_gdd0 - components/clm/src/biogeophys/LunaMod.F90 - remove ed variables - components/clm/src/biogeophys/PhotosynthesisMod.F90 - remove ed variables - components/clm/src/biogeophys/CanopyFluxesMod.F90 - interface to get ed canopy fluxes - components/clm/src/biogeophys/SurfaceRadiationMod.F90 - remove ed code - components/clm/src/biogeophys/CanopyStateType.F90 - remove gccanopy_patch - components/clm/src/biogeophys/SurfaceAlbedoMod.F90 - call ED routine through interface - components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 - ed needs hydrology parameters - components/clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 - fates c litr fluxes - components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 - don't do some liter pools if ed on. - - ed as bgc mode, work with subsurface bgc - components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - components/clm/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 - components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 - components/clm/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 - components/clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 - components/clm/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 - - ed refactoring for interfaces, science and software big fixes - components/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 - components/clm/src/ED/biogeochem/EDGrowthFunctionsMod.F90 - components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 - components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 - components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 - components/clm/src/ED/main/EDCLMLinkMod.F90 - components/clm/src/ED/main/EDVecCohortType.F90 - components/clm/src/ED/main/EDRestVectorMod.F90 - components/clm/src/ED/main/EDPftvarcon.F90 - components/clm/src/ED/main/EDInitMod.F90 - components/clm/src/ED/main/EDParamsMod.F90 - components/clm/src/ED/main/EDMainMod.F90 - components/clm/src/ED/main/EDTypesMod.F90 - components/clm/src/ED/main/CMakeLists.txt - components/clm/src/ED/fire/SFMainMod.F90 - components/clm/src/ED/biogeophys/EDAccumulateFluxesMod.F90 - components/clm/src/ED/biogeophys/EDSurfaceAlbedoMod.F90 - components/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 - components/clm/src/ED/biogeophys/EDBtranMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r191 -Originator(s): sacks (Bill Sacks) -Date: Sun Aug 21 06:18:04 MDT 2016 -One-line Summary: New parameterizations for snow overburden compaction and wind drift compaction - -Purpose of changes ------------------- - - Introduces new parameterizations for snow overburden compaction and wind - drift compaction. By default, CLM45 uses the old snow overburden compaction - formula and no wind drift compaction, whereas CLM5 uses the new - parameterizations. - - Also changes the CLM50 default for the snow compaction parameter - upplim_destruct_metamorph - - Scientific changes are from Leo van Kampenhout (l.vankampenhout@uu.nl) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - New namelist option: snow_overburden_compaction_method - -Changes made to namelist defaults (e.g., changed parameter values): - - Changed clm5_0 default for upplim_destruct_metamorph - - upplim_destruct_metamorph appears in namelist for clm4_5 as well as clm5_0 - - upplim_destruct_metamorph default changed for clm5_0 (175 rather than 150) - - overburden_compress_tfactor appears in namelist for clm4_5; does not appear - when using the new Vionnet2012 snow overburden compaction method (so does - not appear by default with clm5_0); no longer has a different default value - for clm5_0 (since it doesn't appear by default in clm5_0) - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - The new parameterizations are more complex, so have a moderate (~ 20%) impact - on SnowCompaction timing, but this is a very small part of the overall CLM - run time. The timing impacts of extracting routines to compute some of - the snow compaction terms were minimal (only increased the SnowCompaction - time by a few percent). - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self; Dave Lawrence also reviewed Leo's initial implementation - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok - - tests pass; differences from baseline for CLM45 and CLM50 as expected - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass (or xfail); differences from baseline for CLM50 as expected - -CLM tag used for the baseline comparisons: clm4_5_12_r190 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Larger than roundoff; I haven't investigated this closely, but suspect - these changes result in new climate, at least regionally - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: - -========= Remove unit tests for a function that has been removed -D components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_windCompactionFactor.pf - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= (a) Add namelist option controlling which snow overburden compaction - method to use; (b) make upplim_destruct_metamorph appear in the - namelist for clm4_5 as well as clm5_0; (c) change default value for - upplim_destruct_metamorph; (d) remove clm5_0 default for - overburden_compress_tfactor (because it is not used by default in - clm5_0), and make sure this namelist item appears with clm4_5 but - doesn't appear when using the new Vionnet2012 snow overburden - compaction method -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm - -========= Unrelated change: Remove spaces from timer names for easier automated - processing of timing output (requested by Sean Santos) -M components/clm/src/main/clm_driver.F90 - -========= Unrelated changes: Add more informative error messages -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/restFileMod.F90 - -========= Remove unit tests for a function that has been removed -M components/clm/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt - -=============================================================== -=============================================================== -Tag name: clm4_5_12_r190 -Originator(s): sacks (Bill Sacks) -Date: Sat Aug 20 05:53:49 MDT 2016 -One-line Summary: Fix snow capping bug - -Purpose of changes ------------------- - - When snow capping was triggered, the bottom snow layer was decreased in mass, - but dz remained unchanged, leading to problematic changes in density. This - tag fixes that problem, so that dz is decreased appropriately. - - These changes are from Leo van Kampenhout (l.vankampenhout@uu.nl) - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2343 (new snow capping scheme does not conserve density) - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - Changed - ERP_P15x2_Lm36.f10_f10.ICRUCLM50BGCCROP.yellowstone_intel.clm-cropMonth_interp - to - ERP_P30x2_Lm36.f10_f10.ICRUCLM50BGCCROP.yellowstone_intel.clm-cropMonth_interp - so that it could reliably finish within 2 hours. - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - pass - - ok means tests pass, some baseline comparisons fail as expected - -CLM tag used for the baseline comparisons: clm4_5_11_r189 - - -Answer changes --------------- - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: potentially all clm45 / clm50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Larger than roundoff. I have not investigated the size of the change, - suspect it is the same climate with respect to land-atmosphere fluxes, but - potentially different climate with respect to snow pack properties and SMB - sent to CISM. (This changes the density of the bottom layer of deep snow - packs.) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? n/a - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: n/a - - URL for LMWG diagnostics output used to validate new climate: n/a - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= Change a test, as noted above -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_11_r189 -Originator(s): erik (Erik Kluzek) -Date: Thu Aug 18 14:52:36 MDT 2016 -One-line Summary: Bring in time varying streams for urban data (currently triggers AC use) - -Purpose of changes ------------------- - -Instead of reading in maximum building temperature from surface dataset, read it in from -a time-varying urban streams file. This allows the urban Air Conditioning use to change -in time as well as spatially. Other spatially and temporally changing parameters can be added -(or moved from the surface dataset) to this stream file as well in the future. The new streams -file has the same kind of controls as other streams file for years to run over, filename, and -mapping algorithm. The time interpolation is assumed to be linear, and it uses taxmode=extend -so it will use the first value before the first year and the last value after the last year. -The current dataset is at one degree resolution (f09_g16). Because of this CLM45 compsets -will change answers to some extent (because interpolation methods for streams are slightly -different) -- but answers will be very similar. CLM50 compsets will change because there is -variation in the max building temperature both spatially and temporally. - -Also fix a problem with the humanstress module for GSWP3 forcing because of temperatures that -are too high for the WetBulb method to converge. WetBulb previously only allowed two iterations -and now it allows more (10,000). If the method fails to converge it will exit with a warning. -This was worked on by Jonathan Buzan with Keith Oleson. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2348 PTCLMmkdata not able to run for clm5_0 - 2305 Nan for wet bulb temperature - -Known bugs introduced in this tag (include bugzilla ID): - 2346 Unnecessary arguments to WetBulb subroutine (WONTFIX) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: No longer reads t_building_max from surface dataset - reads it in from the urban time-varying streams - -Changes to CLM's user interface: New namelist variables - Add: stream_year_first_urbantv, stream_year_last_urbantv - model_year_align_urbantv, stream_fldfilename_urbantv, urbantvmapalgo - -Changes made to namelist defaults: None - -Changes to the datasets: new urban time-varying streams datasets - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: None - -Changes to tests or testing: None - -Code reviewed by: self, oleson - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (all tests PASS and 64 compare tests are different because of namelist changes) - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - OK - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_11_r188 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5 (to a minor degree) and clm5_0 with urban - - what platforms/compilers: All - - nature of change: same climate - - CLM45 answers with urban areas may change to a minor degree because of the use of - the urban time varying stream file to get the max indoor building temperature rather - than reading from the surface dataset. Shorter tests are fairly close and some may be - identical (all CLM45 single point cases are identical). Tests of a month or longer likely - diverge. - - Five of the 22 CLM45 and CLM45BGC tests with f10_f10 on hobart are different, others are the same. - Half of the 46 CLM45 CLM45 tests with f10_f10 on yellowstone are the same. - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): PTCLM - update PTCLM to PTCLM2_160818 - -List all files eliminated: None - -List all files added and what they do: Object to handle time-varying urban data - - A components/clm/src/biogeophys/UrbanTimeVarType.F90 -- Read max building temperature from urban time-varying stream - for three urban classes (Tall Building Disctrict-TBD, High Density-HD, and Medium Density-MD) add TBUILD_MAX as - possible output to history - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/main/clm_instMod.F90 -- Setup urbantv_type and initialize it - M components/clm/src/main/clm_driver.F90 --- Interpolate urban-time-varying data and pass it down - - M components/clm/src/biogeophys/HumanIndexMod.F90 ------------- Remove duplicated wbt_ref2m_u_patch, - output urban stull wet bulb temp, new convergence routine for Wet-Bulb (increase max iterations - from 2 to 10000) - M components/clm/src/biogeophys/SoilTemperatureMod.F90 -------- Pass urbantv down, get t_building_max from it - M components/clm/src/biogeophys/UrbBuildTempOleson2015Mod.F90 - Pass urbantv down, get t_building_max from it - M components/clm/src/biogeophys/UrbanParamsType.F90 ----------- Remove t_building_max and no longer read - T_BUILDING_MAX from surface dataset - M components/clm/src/biogeophys/test/HumanStress_test/test_humanstress.pf -- Test new WetBulb subroutine - - Add in stream_year_ first/last/align for urbantv for clm5_0 - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/2000_control.xml - M components/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - M components/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - M components/clm/bld/namelist_files/use_cases/1850_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - M components/clm/bld/namelist_files/use_cases/20thC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - M components/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add: stream_year_first_urbantv, stream_year_last_urbantv - model_year_align_urbantv, stream_fldfilename_urbantv, urbantvmapalgo - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Defaults for above list. - clm4_5 has first, last and align set to 2000 whereas clm5_0 sets it appropriatly by sim_year and sim_year_range - there is also a CLM45 urbantv streams file that approximates the previous method of reading from the surface dataset - the urbantv streams files are at 0.9x1.25 resolution - - M components/clm/bld/CLMBuildNamelist.pm - Add setup_logic_urbantv_streams, call it and add urbantv_streams namelist - - Remove T_BUILDING_MAX from clm45/clm50 surface datasets - M components/clm/test/tools/test_driver.sh --- Make CLM_SOFF default FALSE - M components/clm/test/tools/README ----------- Show example usage on yellowstone and update note about CLM_SOFF - M components/clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 ----- Don't write T_BUILDING_MAX - M components/clm/tools/clm4_5/mksurfdata_map/src/mkurbanparMod.F90 - Remove T_BUILDING_MAX as urban parameter - M components/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl --------- Remove T_BUILDING_MAX from copy for urban single point datasets - -=============================================================== -=============================================================== -Tag name: clm4_5_11_r188 -Originator(s): erik (Erik Kluzek) -Date: Fri Aug 5 13:53:01 MDT 2016 -One-line Summary: A set of small answer changing issues for both clm45 and clm50 - -Purpose of changes ------------------- - -Changes to CLM45 and CLM50: - -Some adjustments to methane output (for both CLM45BGC) and CLM50BGC from Xiyan Xu. This calculates -finundated from before snow, and rather than multiplying m_tiller by LAI it multiples by a constant four. - -Update Li2014 FireFluxes subroutine for spinupstate=2 capability (so can be shared). Changes to -roundoff, while also allowing spinupstate==2 and fixing bug 2243 to deal with deadstem for CLM45 -from Charlie Koven. - -Carbon and Nitrogen state missing accounting of of live to dead from fire in StateUpdate3. - -Nitrogen uptake code error from Xiaojuan Yang and Charlie Koven. This is dependent on use_nitrif_denitrif=T -so will only affect CLM45BGC/CLM50BGC, but not SP or CN alone simualtions. This is for the 2nd pass at -Nitrogen uptake. - -Issue with carbon Isotopes. Brett Raczka and Henrique Duarte at Univ. Utah have identified a bug in the -CLM4.5 C isotope code, in which isotope ratios are not stabilizing when fire turns on. Turning off the -fire code produces reasonable isotope ratios. We've identified that the problem is that the variables -for the fire fluxes associated with the new fire code were never copied over into CNCIsoFluxMod.F90. Fix -from Charlie Koven, and Brett verified it worked in his version. Also update the C14 half-life value. Used -to be the Libbey value, now use the updated one. - -Changes to CLM50 only: - -Remove discontiniues in new CLM50 snow density. Also if wind is zero (< 0.1m/s), wind_dependent_snowdensity -is increase is also zero. Some changes to fire injection height for fire-emissions from Simone Tilmes, and a unit-conversion -error fix from Fang Li. - -Summary: - -ciso errors bug 2116 (isotopes both clm45/clm5) -Bug 2224 N uptake code clm45/clm50BGC -Transfer of live to dead bug 2264 clm45/clm5) -2326 for shade part clm5 -snow density discontinuities (2328) clm5 -Methane change on mechanges branch clm45/clm5 2338 -2340 Fire emission change from Simone clm5 -Units conversion error in CNfire-emissions bug 2342 clm5 - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - -2116 C isotope (13C and 14C) errors in fire code -2141 Precision of constants in SoilTemperature.F90 is not double -2224 plant N uptake second pass error -2243 Deadstem not taken into account in fire-fluxes for clm4_5 (koven) (FOR CLM45 SIDE) -2264 Fire is missing accounting of C/N for transfer of live to dead -2326 Bad multiplication of btran for soybean or nbrdlf_dcd_tmp_shrub with CNDV in CanopyFluxes -2328 Discontinuities in new CLM50 snow density formulation -2338 Use the pre-snow values to calculate finundated, and use constant for m_tiller rather than elai -2340 Adjustments to fire-emission from Simone Tilmes -2342 Units conversion error in CNfire-emissions - -Known bugs introduced in this tag (include bugzilla ID): - -2332 fire_emiss tests don't work (cime issue) - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: None - -Changes to CLM's user interface: None - -Changes made to namelist defaults: None - -Changes to the datasets: None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: None - -Changes to tests or testing: None - -Code reviewed by: self,fangli,slater,stilmes,koven - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_10_r187 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! for clm4_5 and clm5_0 - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5 BGC and CN compsets and Carbon isotopes - clm5_0 all (BGC, CN, SP) - any fire-emission - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): cime - Add changes to cime branch tag to be able to run on hobart - - cime to clm4_5_11_r188_cime4.5.14 - -List all files eliminated: None - -List all files added and what they do: Add unit tests for new snow bulk density - - M components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/biogeochem/CNNStateUpdate3Mod.F90 - Subtract live to dead from fire Nitrogen for - live/dead and stem/root (both CLM45CN/BGC and CLM50CN/BGC) - M components/clm/src/biogeochem/CNC14DecayMod.F90 ------ Adjust C14 half-life from Libby 5568 to 5730 a - more recent value used (this affects both clm45 and clm50 when use_c14 is on) - M components/clm/src/biogeochem/ch4Mod.F90 ------------- Calculate finundated from before snowfall, and don't multiply - m_tiller by LAI, but by 4.0. - M components/clm/src/biogeochem/CNCStateUpdate3Mod.F90 - Subtract live to dead from fire Nitrogen for - live/dead and stem/root (both CLM45CN/BGC and CLM50CN/BGC) - M components/clm/src/biogeochem/CNCIsoFluxMod.F90 ------ Missing isotope flux calculations (changes for CLM45/50 with c13/c14) - M components/clm/src/biogeochem/CNFireEmissionsMod.F90 - Changes from Simone Tilmes adjusting the fire - injection heights for different PFTS and also use indices rather than hard-coded magic integers - M components/clm/src/biogeochem/CNFireLi2014Mod.F90 ---- Use same version of FireFluxes as in Li2016, - so can use spinup_state==2 and apply a previous bug-fix (). Outside of that answers are roundoff - different. And this allows the base version of the subroutine to be used for both Li2014 and Li2016 - to reduce code duplication. - - M components/clm/src/biogeophys/CanopyFluxesMod.F90 ---- Remove 2nd adjustment to btran for soybean - and nbrdlf_dcd_tmp_shrub for CNDV (both clm45crop/cndv and clm50crop/cndv) - M components/clm/src/biogeophys/SnowHydrologyMod.F90 --- Make new snow bulk density continuous (only CLM50) - add unit-test function: SnowHydrologySetControlForTesting. Apply new wind dependent density increase - only for wind > 0.1m/sec (so no density increase at zero wind) - - M components/clm/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 --- Bug 2224 - - M components/clm/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt - add tests for snow density - -=============================================================== -=============================================================== -Tag name: clm4_5_10_r187 -Originator(s): erik (Erik Kluzek) -Date: Tue Jul 26 21:45:51 MDT 2016 -One-line Summary: Some CLM45/50 changes: seperate carbon and water root profile, turn off undercanopystability, - really turn PHS on, LUNA predict sunlit fraction N fractionation - -Purpose of changes ------------------- - - Seperate the carbon and water fine root profiles and have namelist control over them. This removes the duplicated - code in soilbiogeochem that replicated the Jackson-1996 profile. Also remove several soilbiogeochem specific namelist - control items over the root profile. - - CLM50 changes: - Change water fine root profile to Jackson-1996 with rootprof_beta adjusted for water (dlawren) - Turn off under canopy stability term that decreases csoilc by Sakaguchi&Zeng, 2008 (swensosc) - When fun on -- add cpool_to_leafc to leafc_to_litter and cpool_to_frootc to frootc_to_litter (rfisher) - Really turn Plant Hydrallic Stress on (erik) - Have LUNA predict the scaling of Vcmax/Jmax/tpu-25 for canopy sunlight/shaded average in Photosynthesis (rfisher) - - CLM45 changes: Water fine root profile was used rather than carbon profile (used in soilbiogeochem) in CNMResp and in ch4Mod - The profile used was zeng_2001, it's now Jackson_1996. You can duplicate the old answers if you use zeng-2001 for CNMResp - and ch4Mod, but Jackson-1996 for soilbiogeochem. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2337, 2334, 2331, 2311 - 2337 Methane and maintenance respiration using water root profile rather than carbon root profile - 2334 Plant hydraulic stress not turned on by default in clm4_5_9_r184 - 2331 many build-namelist tests fail when comparing a tag against itself - 2311 Move mbbopt to params file - -Known bugs introduced in this tag (include bugzilla ID): 2339 - 2339 croofr and rootfr profiles are time constant but default output to history - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): Namelist items added and removed - Add: rooting_profile_method_water, rooting_profile_method_carbon, rooting_profile_varindex_water, - rooting_profile_varindex_carbon, and use_undercanopy_stability - Remove: pftspecific_rootingprofile, exponential_rooting_profile, and rootprof_exp - -Changes made to namelist defaults (e.g., changed parameter values): - set: rooting_profile_method_carbon = Jackson1996 (both clm50 and clm45) - rooting_profile_method_water = Zeng_2001 (clm45), Jackson1996 (clm50) - use_undercanopy_stability = .true. (clm45), .false. (clm50) - -Changes to the datasets (e.g., parameter, surface or initial files): - New params files (with 2D rootprof_beta) - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: tests with dynroots need to explicitly turn PHS off - -Code reviewed by: self, dlawren, rfisher - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (83 compare tests FAIL, because of namelist changes) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_9_r186 - - -Answer changes --------------- - -Changes answers relative to baseline: CLM45BGC and all CLM50 - - Summarize any changes to answers, i.e., - - what code configurations: CLM45BGC and all CLM50 compsets - - what platforms/compilers: All - - nature of change: CLM45 - CLM50 - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: rfisher respmods_n31_clm4_5_9_r185_00 - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/unit_testers/NMLTest/CompFiles.pm --- Fix bug comparison to same version (2331) - - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -- Remove: rooting_profile_method - Add: rooting_profile_method_water, rooting_profile_method_carbon, rooting_profile_varindex_water, - rooting_profile_varindex_carbon, and use_undercanopy_stability - Remove: pftspecific_rootingprofile, exponential_rooting_profile, and rootprof_exp - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- new param files, - set: rooting_profile_method_carbon, rooting_profile_method_water, and use_undercanopy_stability - M components/clm/bld/namelist_files/namelist_defaults_drydep.xml -- Update to use 79 PFT megan factors file - - M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/user_nl_clm --- add use_hydrstress = .false. - M components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm - add use_hydrstress = .false. - - M components/clm/bld/CLMBuildNamelist.pm --- Pass use_ed to use_hydrstress default (2334), add setup_logic_canopyfluxes - namelist, change rooting_profile_method to rooting_profile_method_water/carbon, canopyfluxes_inparm namelist group. - - M components/clm/src/biogeochem/CNMRespMod.F90 ------ Use carbon fine root profile (crootfr_patch) rather than water profile (2337) - M components/clm/src/biogeochem/CNFUNMod.F90 -------- Use carbon fine root profile (crootfr_patch) rather than water profile - M components/clm/src/biogeochem/CNDriverMod.F90 ----- Use carbon fine root profile (crootfr_patch) rather than water profile - M components/clm/src/biogeochem/ch4Mod.F90 ---------- Use carbon fine root profile (crootfr_patch) rather than water profile (2337) - M components/clm/src/biogeochem/CNPhenologyMod.F90 -- When fun on -- add cpool_to_leafc to leafc_to_litter and - cpool_to_frootc to frootc_to_litter from Rosie Fisher - M components/clm/src/biogeochem/VOCEmissionMod.F90 -- Have factors handle new PFT size - M components/clm/src/biogeochem/MEGANFactorsMod.F90 - Read mxpft PFT's from emissions file, check that number PFT's is as expected - M components/clm/src/main/controlMod.F90 ------------ Remove exponential_rooting_profile, rootprof_exp, surfprof_exp, pftspecific_rootingprofile - Add CanopyFluxesReadNML call - M components/clm/src/main/pftconMod.F90 ------------- rootprof_beta is 2D with nvariants as 2nd dimension - M components/clm/src/main/clm_varpar.F90 ------------ Add nvariants=2 for variants of PFT constants - M components/clm/src/biogeophys/LunaMod.F90 --------- Make LUNA predict sunlit fraction N fractionation, scale in PhotosynthesisMod - M components/clm/src/biogeophys/PhotosynthesisMod.F90 --------- Implement scaling of Vcmax/Jmax/tpu/25 from sunlit average to shaded canopy - average value (both PHS and non-PHS versions), read mbbopt from params file in PHS section (2311) - M components/clm/src/biogeophys/SoilStateType.F90 ------------- Add crootfr_patch for carbon and initialize. rootfr_patch is for water - write out crootfr and rootfr to history (this should be cleaned up to be only for first history file as it's an unchanging - constant profile) - M components/clm/src/biogeophys/CanopyFluxesMod.F90 ----------- Add CanopyFluxesReadNML with canopyfluxes_inparm namelist - and set use_undercanopy_stability in it, decrease csoilc as in in Sakaguchi&Zeng, 2008 if on - M components/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 - Initialize crootfr - M components/clm/src/biogeophys/RootBiophysMod.F90 ------------ Add water and carbon versions of rooting_profile_method - and add water and carbon rooting_profile_varindx for variant index of rootprof_beta to use from params file, make - m_to_cm and beta double precision, pass 'water' or 'carbon' to init_vegrootfr, varindx for carbon is 2 and 1 for water. - default rooting method is zen_2001 for water and jackson_1996 for carbon. - M components/clm/src/biogeophys/SurfaceRadiationMod.F90 ------- Remove unused single precision reals - M components/clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 - Use crootfr_patch to set cinput_rootfr, remove - version of jackson_1996 carbon root profile that was in here. Also remove: exponential_rooting_profile, pftspecific_rootingprofile, - and rootprof_exp - -=============================================================== -=============================================================== -Tag name: clm4_5_9_r186 -Originator(s): sacks (Bill Sacks) -Date: Wed Jul 13 07:17:04 MDT 2016 -One-line Summary: Initialize biogeochem balance checks AFTER column area updates - -Purpose of changes ------------------- - -Reworking the conservation of patch-level CN variables with dynamic landunits -will make the column-level CN balance checks very tricky to determine, as they -were written before - where the starting point for the comparison was determined -before all of the area adjustments (i.e., the dyn subgrid stuff). This becomes -much more straightforward if the initialization of the balance checks is done -after the dyn subgrid stuff is complete. This tag makes that change. - -In order to accomplish that, we need to re-compute the CN state summaries after -the dyn subgrid stuff is complete - near the beginning of the time step. We -still need the summary routine at the end of the time step for the sake of -diagnostics (e.g., history output). So now we call the summary routines twice -for states. We do NOT need to call the flux summary routines at the beginning of -the time step - and doing so doesn't really make sense (how do you summarize -fluxes that haven't yet been computed) - so I have split the top-level summary -routine into a SummarizeStates and SummarizeFluxes. - -I also reworked the ch4 balance check similarly, in order to be consistent with -the CN balance checks. - -Longer-term, we'll add another set of balance checks that operate on -gridcell-level quantities, which WILL cover the dyn subgrid stuff. So the -overall sequence will look like: - - Initialize gridcell-level balance checks - Dyn subgrid stuff (adjust patch, column, landunit areas, and do associated - state updates) - Initialize column-level balance checks - Science routines - Check column-level balance - Check gridcell-level balance - - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - -ok means tests pass, some answers change as noted below - -CLM tag used for the baseline comparisons: clm4_5_9_r185 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 runs with BGC that involve changes - in subgrid areas (including HIST, RCP, DV and IG cases) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated closely; expected to be larger than roundoff / same climate - - Answer changes come from the fact that some code (e.g., the fire code) - uses the summarized state variables. Previously, this code was using the - state summaries from the previous time step. With this change, the code is - now using the updated state summaries. These updated state summaries can - differ from the ones computed at the end of the last time step if subgrid - areas have changed. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Move initialization of CN and ch4 balance checks to AFTER dyn subgrid -M components/clm/src/main/clm_driver.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 - -========= Split the CNDriverSummary into separate SummarizeStates and - SummarizeFluxes: Only SummarizeStates needs to be done near the start - of the time step. Also move calls to PrecisionControl to a higher - level, since these aren't needed in the initial call to - SummarizeStates. -M components/clm/src/biogeochem/CNDriverMod.F90 - -========= Change which terms (from transient landcover) are included in the - balance checks, due to new placement in the driver sequence -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 - -========= Rework timing of ch4 balance check initialization, too, for - consistency -M components/clm/src/biogeochem/ch4Mod.F90 - -========= Remove some variables from Restart, now that we call the Summary - routines early in the time step. Also no longer update summary - diagnostic variables in DynamicPatchAdjustments -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - -========= No longer need to do p2c of totvegc in fire code: this is done in the - initial call to the summary routines -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 -M components/clm/src/biogeochem/CNFireNoFireMod.F90 - -========= Replace __FILE__ with filename parameter to avoid too-long lines with pgi -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 - -========= Remove - SMS_Lm25.f19_g16.ICLM45BGCCROP.yellowstone_gnu.clm-cropMonthOutput: - baseline comparisons have been passing for me recently -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_9_r185 -Originator(s): sacks (Bill Sacks) -Date: Thu Jul 7 13:54:09 MDT 2016 -One-line Summary: Revert glacial melt behavior to the old treatment for mountain glaciers - -Purpose of changes ------------------- - -The primary change in this tag is reverting glacial melt behavior to the old -scheme (i.e., the scheme used in standard glacier landunits) for mountain -glaciers: The old scheme involves glacial melt remaining in place until it -refreezes (thus, not generating any runoff), whereas the new scheme involves -glacial melt running off and being replaced by ice from below (generating -positive liquid runoff and negative ice runoff). - -The main motivation for this change is that mountain glaciers were generating -substantial negative ice runoff in coupled cases when using the new scheme. This -is presumably because CAM's topographic height is significantly lower than the -real-world topographic height in mountainous regions, so mountain glaciers were -seeing too-warm temperatures. The LIWG, in consultation with members of the -LMWG, decided to revert mountain glaciers to their old behavior to avoid -detrimentally impacting a coupled simulation. Because the LIWG is not currently -concerned with the SMB of mountain glaciers - and because mountain glacier SMB -cannot be realistically simulated yet anyway - this reversion was not considered -a problem from their perspective. - -To accomplish this, this tag introduces a new namelist variable, -glacier_region_melt_behavior. Like glacier_region_behavior, this keys off of the -GLACIER_REGION field on the surface dataset. Thus, different melt behavior can -be used for each glacier region. By default, Greenland and Antarctica use the -new (glc_mec) behavior ('replaced_by_ice'), whereas other regions use the old -behavior ('remains_in_place'). - -For glacier columns that use the 'remains_in_place' melt behavior, we do NOT -compute surface mass balance (SMB). This is because the negative component of -SMB is non-sensical in those columns. To make this clear, the QICE, QICE_FRZ and -QICE_MELT diagnostic fields are filled with missing values in the -'remains_in_place' region. (However, the qice fields sent to the coupler, along -with QICE_FORC, are 0 in that region - giving the values that are actually sent -to the coupler.) - -Note that this means that different glacier regions now have different -physics. And, in order to compute SMB, you would need to change the melt -behavior, thus significantly changing the behavior of mountain glaciers. - -This tag also refactors the code that computes glacier surface mass balance so -that this is centralized in one module: GlacierSurfaceMassBalanceMod.F90. - -Other behavior changes in this tag are: - -(1) The subgrid snow parameterization (subgrid topographic variability) now - differentiates between 'single_at_atm_topo' istice_mec columns and other - istice_mec columns. Previously, istice_mec columns were treated differently - from others because they already have some representation of subgrid - variability. However, 'single_at_atm_topo' columns should be treated more - like other columns, because they do not allow for this elevation class - variability; this has been fixed here. - -(2) Vegetated SMB is computed for all grid cells where we compute glacier - SMB. Previously vegetated SMB was only generated in the 'virtual' glacier - region, but that added complexity to the code logic without having a good - reason (as far as I can tell). This change just affects the lnd -> glc - fields for elevation class 0 (changing where these are valid, rather than - being set to 0): it does not affect the evolution of CLM. - -(3) Adds some error checking for the glacier_region_behavior namelist item as - well as for the new glacier_region_melt_behavior namelist item. - -Between the primary change in this tag and the change in (1), it is now possible -to make the evolution of glacier_mec landunits exactly match the evolution of -standard glacier landunits - by using a glacier_region_behavior of -'single_at_atm_topo' and a glacier_region_melt_behavior of 'remains_in_place'. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Surface mass balance (SMB) is no longer computed for mountain glaciers. In - order to compute SMB, you would need to change the - glacier_region_melt_behavior, which will change behavior significantly for - mountain glaciers. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variable, glacier_region_melt_behavior - as described above. This - variable and glacier_region_behavior both appear in the default namelist for - all clm45/clm50 cases, but only affect the operation of CLM if running with - glc_mec (i.e., a case with CISM). - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: none - -Changes to tests or testing: none - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - ok (tests pass, expected differences from baseline; but see - bug 2331) - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, some answer changes as noted below - -In addition, ran 100-year runs to confirm that glc_mec (istice_mec) landunits -can now be made to operate exactly the same as standard glacier (istice) with -the appropriate namelist settings: - - IG run: 1850_DATM%QIA_CLM50%BGC_SICE_SOCN_RTM_CISM1_SWAV - I run: 1850_DATM%QIA_CLM50%BGC_SICE_SOCN_RTM_SGLC_SWAV - - For the IG run, put the following in user_nl_clm: - - glacier_region_behavior = 'single_at_atm_topo','single_at_atm_topo','single_at_atm_topo' - glacier_region_melt_behavior = 'remains_in_place','remains_in_place','remains_in_place' - - and with the following sourceMods to allow running an IG compset with - single_at_atm_topo & remains_in_place behavior over Greenland (because we - currently cannot run with SGLC with glc_mec): - - --- ../../../components/clm/src/cpl/lnd_import_export.F90 2016-07-01 06:11:13.117799391 -0600 - +++ SourceMods/src.clm/lnd_import_export.F90 2016-07-04 09:58:37.130458468 -0600 - @@ -228,8 +228,8 @@ - glc2lnd_inst%topo_grc(g,num) = x2l(index_x2l_Sg_topo(num),i) - glc2lnd_inst%hflx_grc(g,num) = x2l(index_x2l_Flgg_hflx(num),i) - end do - - glc2lnd_inst%icemask_grc(g) = x2l(index_x2l_Sg_icemask,i) - - glc2lnd_inst%icemask_coupled_fluxes_grc(g) = x2l(index_x2l_Sg_icemask_coupled_fluxes,i) - + glc2lnd_inst%icemask_grc(g) = 0._r8 - + glc2lnd_inst%icemask_coupled_fluxes_grc(g) = 0._r8 - end if - - end do - - Both run at T31_g37 for 100 years; compared last CLM and RTM history files; - these were bit-for-bit except for expected differences in PCT_LANDUNIT - - Also ran similar sets of runs, but with all temperatures increased by 10 deg - (along with setting initial glacier h2osno to 0) or decreased by 10 deg (along - with setting initial glacier h2osno to 10000) to try to make sure we're - exercising both glacier increases and decreases (though I didn't confirm that - we're definitely exercising increases and decreases in those). Ran those hot & - cold runs with both CLM50 and CLM45. - -CLM tag used for the baseline comparisons: clm4_5_9_r184 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 with glc_mec (i.e., compsets with CISM) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - expected to be new climate, at least regionally - but not investigated closely - - Answers change over glaciers outside of Greenland and Antarctica (i.e., - mountain glaciers). In addition, fields sent to coupler are now present - for elevation class 0 (bare ground) over Antarctica. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Consolidate code that computes glacier surface mass balance. This code - was primarily taken from SoilTemperatureMod and HydrologyDrainageMod, - with some other code also removed from BalanceCheckMod and - clm_driver. Relevant fluxes have also been moved here (from - WaterfluxType) -A components/clm/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Add new glacier_region_melt_behavior namelist item; always add - glacier_region_behavior and glacier_region_melt_behavior to namelist, - so error checks pass (these currently aren't needed in cases without - CISM, but will always be needed soon, once glc_mec becomes the only - glacier option - so it seemed reasonable to go ahead and always add - them to the namelist) -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -========= Add differentiation on glacier_region_melt_behavior, add an - 'allow_multiple_columns_grc' flag that can be used elsewhere, improve - error checking, and some other tweaks -M components/clm/src/main/glcBehaviorMod.F90 -M components/clm/src/main/test/glcBehavior_test/test_glcBehavior.pf - -========= Move code out, into new GlacierSurfaceMassBalanceMod -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 - -========= Call new routines, move initialization to 0 out of clm_drv_init into - new GlacierSurfaceMassBalanceMod -M components/clm/src/main/clm_driver.F90 - -========= Change do_smb filter: (1) only includes points where - melt_replaced_by_ice is true; (2) includes vegetated points for the - same grid cells as glacier points, rather than using the - has_virtual_columns mask -M components/clm/src/main/filterMod.F90 - -========= For glc_mec columns: Subgrid topographic variability depends on - whether a gridcell allows multiple elevation classes -M components/clm/src/main/initVerticalMod.F90 - -========= Add new glacier_smb_inst, and pass it where needed -M components/clm/src/main/clm_instMod.F90 -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/lnd2glcMod.F90 - -========= Do some additional error checking -M components/clm/src/main/glc2lndMod.F90 - -========= Build new code for unit tests -M components/clm/src/biogeophys/CMakeLists.txt - -========= Unrelated change: do necessary teardown -M components/clm/src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf - -========= Just remove unneeded use statements -M components/clm/src/biogeochem/DUSTMod.F90 -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/histFileMod.F90 - -========= Remove a bunch of tests that no longer fail (due to changes in r184 or - earlier) or have been removed from the test list; also change bug - associated with one test -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_9_r184 -Originator(s): erik (Erik Kluzek) -Date: Wed Jul 6 14:55:45 MDT 2016 -One-line Summary: CLM50 changes: Atkin form of lmr changed, new parameters and files, turn PHS on by default, new - cold snow density, reseed at exit AD spinup, fix fire bug, fix npool and cpool errors - -Purpose of changes ------------------- - -The CLM50 Atkin method of leaf maintenence respiration was changed by Dr. Rosie Fisher according to communication with Atkin. -New parameter file for CLM50 with new parameters. Plant Hydraulic Stress is now on by default for CLM50. New formulation -for snow density below -15C from Dr. Andrew Slater and Dr. David Lawrence. If plants are dead at the exit AD spinup stage, reseed. -Fix a fire bug which allowed negative nitrogen pools. Fix some npool and cpool errors. - -Work on CNFUNMod, correct indentation, and headers and comments. Remove unused arrays. Initialize arrays in filter loops. Do -some changes to increase performance. Make logic for CNPrecisionControl into three subroutines, when especially negative abort. - - -- Changes from Rosie Fisher to remove leaf_acc term, and implement changes to the Atkin form of lmr25top based on personal communication -with Atkin. - -- new params file - -- Read in PHS parameters from PFT params file. - -- CNPrecisionControl modularization - -- new method for snow density and a change to how wind_dependent_snow_density is done for clm5.0. upplim_destruct_metamorph and - -- overburden_compress_tfactor for clm5 - -- Put mbbopt on params file and use it - -- removed deciduous retranslocation adjustment to plant_ndemand to fix cpool error - -- Checkin Keith's changes to reseed Carbon for forests if in spinup mode and returning to regular mode, this should help in making it so - -- that you can always use spunup initial conditions rather than always having to do a cold start - -- Some FUN optimization. - -- Set barriers, ATM_PIO_TYPENAME - -- removed deciduous retranslocation adjustment to plant_ndemand to fix cpool error - -- If leafn small set leaf-CN and storage_leaf-CN to missing value in NutrientCompetitionFlexibleCNMod - -- add in free N flux direct to npool - -- Move update of grainn_to_food side by side to grainc_to_food with the same equation, from Rosie and Keith (bug 2327) - -- fire (bug 2314) - -- soybean CNDV shrub (bug 2326) - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2255, 2314, 2326, 2327 - - 2327 Change location of where grainn_to_food is updated for CROP - 2326 Bad multiplication of btran for soybean or nbrdlf_dcd_tmp_shrub with CNDV in CanopyFluxes (partial see below) - 2314 Negative carbon pools due to issue in fire model - 2255 bug in soil resistance, likely causes crop soil resistance to remain unset - -Known bugs introduced in this tag (include bugzilla ID): 2326, 2328, 2330 - 2330 Issue with frootc/frootn for C4 crops - 2328 Discontinuities in new CLM50 snow density formulation - The issue that created the need for bug 2326 was removed for both CLM45 and CLM50 in this tag - (The same code was left in the CLM40 version) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - New namelist items: ncrit, ccrit, nnegcrit, cnegcrit, - baseflow_scalar, denitrif_respiration_coefficient/exponent (and nitrconc), lotmp_snowdensity_method, - upplim_destruct_metamorph, overburden_compress_Tfactor, min_wind_snowcompact, remove leaf_acc - -Changes made to namelist defaults: Set new namelist items, update CLM50 params file - -Changes to the datasets: CLM50 params file with updated parameters - -Substantial timing or memory changes: CLM50BGC is a good bit faster - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: Now reading some mxpft dimensioned arrays in local readParams - SnowHydrologyMod parameters should go into a params_type - -Changes to tests or testing: None - -Code reviewed by: self,oleson,rfisher,dlawren,aslater@cu.edu,lifang - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (78 compare tests FAIL because of namelist changes) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_9_r183 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes for CLM50 and CLM45CROP - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 or CLM45CROP - - what platforms/compilers: All - - nature of change: - CLM50 ------ Modified climate - CLM45CROP -- soybean results and grainn_to_food (all CFTS) will be different - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: rfisher: respmods_n30_clm4_5_8_r182_4x5_bareground_AD_1 (has some other SourceMods too) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: - - D components/clm/bld/namelist_files/namelist_definition_drv_flds.xml - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/main/clm_initializeMod.F90 ------------ Always call readParameters - M components/clm/src/main/controlMod.F90 ------------------- Add calls to: soilHydReadNML, nitrifReadNML, CNPrecisionControlReadNML - M components/clm/src/main/clm_driver.F90 ------------------- Work with timing calls - M components/clm/src/main/pftconMod.F90 -------------------- Read in mbbopt - M components/clm/src/main/readParamsMod.F90 ---------------- Add some comments, pass in photosyns_inst and call it's readParams - M components/clm/src/biogeophys/SoilWaterMovementMod.F90 --- Use Photosyns_inst->params_inst%psi_soil_ref in place of -50000 - M components/clm/src/biogeophys/SoilHydrologyMod.F90 ------- Add soilHydReadNML, read in baseflow_scalar - M components/clm/src/biogeophys/SnowHydrologyMod.F90 ------- New namelist items: lotmp_snowdensity_method, - upplim_destruct_metamorph, overburden_compress_Tfactor, min_wind_snowcompact, new_snowdensity method has - lower density for < -15C, change to wind_dependent_snow_density - M components/clm/src/biogeophys/PhotosynthesisMod.F90 ------ New parameters for Plant Hydralic Stress: krmax, kmax, - psi50, psi_soil_ref, lmr_intercept_atkin, remove leaf_acc. Add: allocParams, readParams methods - remove mbbopt and move into pftcon. Atkin method of leaf respiration modified per communication with Atkin. - M components/clm/src/biogeophys/SurfaceResistanceMod.F90 --- Properly use land-unit rather than column (bug 2255) - M components/clm/src/biogeophys/CanopyFluxesMod.F90 -------- Remove multiplication of btran for soybean or nbrdlf_dcd_tmp_shrub - for CNDV, inside the ITERATION loop (bug 2326). This means the reason that brought this code is no longer addressed. - M components/clm/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 --- Add nitrifReadNML, read in: - denitrif_respiration_coefficient, denitrif_respiration_exponent, denitrif_nitrateconc_coefficient, - denitrif_nitrateconc_exponent. Remove k_nitr_max - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - Remove hardwired minpsi - M components/clm/src/biogeochem/CNFireBaseMod.F90 --------- Multiply several terms by (1-cc_other) (bug 2314) - M components/clm/src/biogeochem/CNPrecisionControlMod.F90 - Add CNPrecisionControlReadNML, cnegcrit, nnegcrit - do actual truncation inside new subroutines: TruncateCandNStates, TruncateCState, TruncateNState - Die if C or N is very negative < cnegcrit or < nnegcrit (currently set to very large negative numbers -60 and -6) - M components/clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 Set actual_storage_leafcn to missing value if - leafn_storage is zero. actual_leafcn to missing if leafn is < n_min, remove modification of plant_ndemand if FUN off - M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - Reseed if plants are dead and going from Accel. Decomp. to regular mode - M components/clm/src/biogeochem/CNNStateUpdate1Mod.F90 --- Add handling of npool and retransn - M components/clm/src/biogeochem/CNFUNMod.F90 ------------- Add more comments, correct indentation, speed up, and remove - extra garbage, use filters to zero out arrays - add free_Nretrans and fraction of N retranslocation which is automatic/free - M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 Add free_retransn_to_npool_patch, write out to history, write - LEAFN_TO_LITTER to history by default - M components/clm/src/biogeochem/CNDriverMod.F90 ----------- Pass bounds to CNPrecisionControl - M components/clm/src/biogeochem/CNPhenologyMod.F90 -------- grainn_to_food modified to be similar to Carbon version (bug 2327) - for FUN leafn_to_retransn is paid_retransn_to_npool plus free_retransn_to_npool - - M components/clm/bld/unit_testers/build-namelist_test.pl ----------- Add in new tests for new parameters - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - New namelist items: ncrit, ccrit, nnegcrit, cnegcrit, - baseflow_scalar, denitrif_respiration_coefficient/exponent (and nitrconc), lotmp_snowdensity_method, - upplim_destruct_metamorph, overburden_compress_Tfactor, min_wind_snowcompact, remove leaf_acc - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Add CPOOL to history for clm_accelerated_spinup - remove leaf_acc, set: lotmp_snowdensity_method, upplim_destruct_metamorph, overburden_compress_tfactor, new - params file for CLM50, set ncrit, turn use_hydrstress=T for CLM50 - M components/clm/bld/CLMBuildNamelist.pm --------------------------- Add setup_logic_cnprec, call setup_logic_nitrif_params, - setup_logic_hydrology_params, add in cnprecision_inparm namelist - - M components/clm/cime_config/buildnml ------------ Don't need to copy user_nl_clm to Buildconf use CASEROOT version - be sure to set $tuning options for build-namelist - M components/clm/cime_config/config_component.xml Add BARRIER_N/OPTION, ATM_PIO_TYPENAME settings - -=============================================================== -=============================================================== -Tag name: clm4_5_9_r183 -Originator(s): erik (Erik Kluzek) -Date: Sat Jul 2 18:23:09 MDT 2016 -One-line Summary: Decomposition is not water limited after reaching a field capacity parameter (maxpsi_hr) rather - than only at soil saturation - -Purpose of changes ------------------- - -Replaces the hard-coded assumption present in prior versions of the model that soil respiration was -water-limited whenever it fell below saturation. Now it's no longer water-limited from maxpsi_hr up -to saturation. - -This was due to a wrong interpretation/implementation of the following paper. - -Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: a comparison of models. Ecology, 68(5):1190-1200 - -Also see notes in.. - -http://bb.cgd.ucar.edu/cesm12z-clm45-important-bad-interpretation-maximum-rate-constant-soil-water-content - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2324 Bad interpretation of maximum rate constant for soil water content in SoilbiogeochemDecompCascade - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: None - -Changes to CLM's user interface: None - -Changes made to namelist defaults: new params files - -Changes to the datasets: parameter files - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - maxpsi_hr is a scalar constant but read in on the parameter file (should change to namelist) - -Changes to tests or testing: Removed RTM ESMF test - -Code reviewed by: self, ckoven, dlawren - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (70 comparision tests fail, because of the new params files) - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_8_r182 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes, for CLM4_5/CLM5_0 for BGC and CN cases - - Summarize any changes to answers: - - what code configurations: clm4_5 and clm5_0 with BGC or CN - - what platforms/compilers: all - - nature of change: should be similar climate - - Charlie Koven did some work with sensitivity analysis to find a good value for maxpsi_hr - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): rtm - - rtm to rtm1_0_57 -- remove ESMF test - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- new params file with maxpsi_hr on them - - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - Use maxpsi_hr from params file - rather than max soil saturation - M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 -- Use maxpsi_hr from params file - rather than max soil saturation - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r182 -Originator(s): erik (Erik Kluzek) -Date: Fri Jun 24 23:33:36 MDT 2016 -One-line Summary: Bring in option for plant hydraulic stress for clm50 - -Purpose of changes ------------------- - -Add in option for plant hydraulic stress (PHS). Does Leaf stomatal resistance and leaf photosynthesis -simultaneous solution of sunlit/shaded per Pierre Gentine/Daniel Kennedy PHS method. Vegetation -water potential is calculated for four conductance segments: sun, shade, xylem, and root. - -The main impact in the code is in CanopyFluxes where either the PHS or non-PHS version of Photosynthesis is -called and the sun and shade segments are solved simultaneously. Then it impacts soil water movement -for transpiration. - -PHS is turned on by adding use_hydrstress=.true. in your user_nl_clm file for your case. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): 2323 (duplication in Photosynthesis) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: use_dynroots and use_hydrstress can NOT both be on at the same time! - -Changes to CLM's user interface: None - -Changes made to namelist defaults: Add use_hydrstress=.false. - -Changes to the datasets: None - -Substantial timing or memory changes: Maybe 4% slower with PHS, memory only increases by 0.1MB - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers: PhotosynthesisMod is duplicated for PHS and non-PHS - PhotosynthesisMod more than doubles in size from 2k to 4.5k. Most of it - is duplicated. Thus changes to one part of the code, have to be duplicated - in the other part, causing double maintence. Also the effects of 6 namelist - control items are duplicated meaning those items have to be tested in both - branches to ensure they are working correctly. (bug 2323) - -Changes to tests or testing: Add use_hydrstress=T to KitchenSink tests - add clm50dynroots test directory - -Code reviewed by: self,oleson,Daniel Kennedy - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (78 compare tests fail compared to r181 - because of addition of use_hydrstress=.false.) - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - No - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - No - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_8_r181 - - -Answer changes --------------- - -Changes answers relative to baseline: No (only changes answers if use_hydrstress=.true.) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, mosart, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: - -::::::::::: Add specific tests for dynamic roots - A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/user_nl_clm - A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50dynroots/include_user_mods - -List all existing files that have been modified, and describe the changes: - -::::::::::: Add in use_hydrstress namelist item, add in vegetation water columns mainly handled in Photosynthesis and -::::::::::: then impacts soil water transpiration in soil water movement. - M components/clm/src/main/controlMod.F90 ------------ Read in use_hydrstress, check it - M components/clm/src/main/clm_varctl.F90 ------------ Add use_hydrstress - M components/clm/src/main/clm_driver.F90 ------------ Pass canopystate to HydrologyDrainage - M components/clm/src/main/histFileMod.F90 ----------- Add ability to handle nvegwcs dimension - M components/clm/src/main/restFileMod.F90 ----------- Write out nvegwcs dimension if use_hydrstress - M components/clm/src/main/clm_varpar.F90 ------------ Set nvegwcs number of vegetation water conductance segments to 4 - M components/clm/src/biogeophys/PhotosynthesisMod.F90 ------ Add PHS versions of subroutines - M components/clm/src/biogeophys/SoilStateType.F90 ---------- Add djk column soil transpiration sink by layer, add - SMP and HK to restart file. Set SMP to -1000 for cold start. - M components/clm/src/biogeophys/CanopyFluxesMod.F90 -------- Call PHS or regular version of Photosynthesis - don't limit or adjust qflx_trans_veg by btran0 for PHS - M components/clm/src/biogeophys/SoilWaterMovementMod.F90 --- Add Compute_VertTranSink_PHS, pass canopystate, energyfluxstate - down to soilwater zengdecker and moisture_form, for PHS rootr_col is zeroed only for pervious road. - Compute_VertTranSink_PHS apply transpiration as a sink condition that is vertically distributed over the soil column. - M components/clm/src/biogeophys/SoilMoistStressMod.F90 ----- btran only set if NOT PHS - M components/clm/src/biogeophys/EnergyFluxType.F90 --------- Add bsun/bsha canopy transpiration wetness factor for PHS - M components/clm/src/biogeophys/CanopyStateType.F90 -------- Add vegwp_patch for PHS, add to restart and history - (vegetation water matric potential for sun/sha canopy,xyl,root segments) - M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 - Pass in canopystate and pass canopystate, energystate - to SoilWater - -::::::::::: Handle use_hydrstress in namelist - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Define use_hydrstress - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Set default use_hydrstress to .false. - M components/clm/bld/CLMBuildNamelist.pm --------------------------- Add setup_logic_hydrstress, use_hydrstress - and use_dynroots cannot both be on at the same time. - M components/clm/bld/unit_testers/build-namelist_test.pl ----------- Add checks that can't use PHS with ED or dynroot - -::::::::::: Add dynroot tests and turn on use_hydrstress for KitchenSink tests - M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - Add use_hydrstress=T, remove use_dynroots=T - M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm --- Add init_interp_fill_missing_with_natveg=T - so test will pass as SMP is now required. - M components/clm/cime_config/testdefs/testlist_clm.xml - Add 3 clm50dynroots testing, remove ESMF tests - - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r181 -Originator(s): erik (Erik Kluzek) -Date: Fri Jun 17 16:39:22 MDT 2016 -One-line Summary: Update cime version which fixes several issues and changes answers - -Purpose of changes ------------------- - - Update for CIME: This includes several key important changes and bug-fixes - - Now there is a CLMGSWP3 option for DATM_MODE - - When running with datm driver has a barrier each day (so MP_EAGER_LIMIT is no longer needed) - - PIO1 is now the default (PIO2 still exists as an option, but now both exist and you can choose which one) - - Driver now merges CLM's drv_flds_in file with CAM's and aborts on a conflict - - The drv_flds_in namelists are defined in the driver where the source exists - - The drv_flds_in file is recreated just like other namelist files (no longer have to delete earlier one) - - Changes answers because of shr_orb (see below) - - Changes to tools to include Caspian Sea as a CLM Lake on surface datasets - - Add LND_TUNING_MODE as an env_run.xml variable. The default setting is determined by which major physics - version is being used (clm4_0, clm4_5, or clm5_0). We intend to use this in order to tune parameters - for clm5_0 offline with GSWP3 forcing versus clm5_0 with CAM5.5. - - CLM_ACCELERATED_SPINUP="on" now cuts back I/O and is much faster (only outputs a few fields yearly). It - also applies for both with and without CN. If CN is on, it will by default turn Accellerated Decomposition - on. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2308 prebeta clm40 compsets are using the wrong testmods directories - 2307 MOSART assumes no-leap calendar - 2303 user_compset gives different settings than expected for options defined in config_compsets.xml - 2280 Need to set barriers for I compsets with PE layouts where datm runs concurrently to CLM - 2256 Problems with early versions of PIO2 in CLM - 2252 Changing megan_specifier for I cases doesn't actually change the megan_specifier in the resolved namelist - 1674 RTM assumes no-leap calendar - -CIME Issues fixed (include issue #): - #315 Add CLMGSWP3 - #324 Merge drv_flds_in in driver from different components - #56 SSP test treats ref1 case as the main case - -Known bugs introduced in this tag (include bugzilla ID): cime issue #453 (ESMF tests fail) - cime issue #455 (have to delete Macros file if switch to mpi-serial) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: CLM_ACCELERATED_SPINUP mean is different (see below) - -Changes to CLM's user interface: Add LND_TUNING_MODE, CLM_ACCELERATED_SPINUP changed. - - LND_TUNING_MODE added in with defaults for each CLM physics option (clm4_0, clm4_5, and clm5_0) - clm4_0 wasn't tuned for a specific forcing, clm4_5 was tuned for CRUNCEP forcing, clm5_0 is - currently tuned for running with CAM5.5. We eventually expect to have tunings for clm5_0 - for running offline and also with CAM5.5. - - Also CLM_ACCELERATED_SPINUP is now changed and available whether CN is on or not. For a SP - (Satelite Phenology) case this mode reduces output in order to speed up the simulation. - For a CN case it does that as well as turning on spinup_state to an accelerated decomposition - mode. If you don't want CN to be in accelerated decomposition set spinup_state=0 in your user_nl_clm - (for final spinup after AD mode). - -Changes made to namelist defaults: nsegspc is now 35 instead of 20 - -Changes to the datasets: None - -Changes for tools: - Files for surface dataset creation now set Caspian sea as a Lake - new maps for mksurfdata with Caspian Sea - -Substantial timing or memory changes: The change in nsegspc should improve performance slightly - Running with CLM_ACCELERATED_SPINUP="on" will make a good 20% improvement in performance - from less history output and turning megan off - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - OK (All PASS, but 121 tests are different that r180, because nsegspc changes, new namelists, and spinup_state) - - unit-tests (components/clm/src): - - yellowstone - PASS - - tools-tests (components/clm/test/tools): - - yellowstone - OK (Some mksurfdata compare tests fail because of Caspian as lake) - PTCLM compare tests for clm4_5 fail because of new mapping files being used) - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - OK (all but one PASS and 44 compare tests are different as expected) - U-UMB ------- Testing this resolution works - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_8_r180 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: all including clm4_0 and clm4_5/clm5_0 - - what platforms/compilers: all - - nature of change: same climate - - The cime update includes a change to shr_orb that changes answers - for all simulations. There is also a change in vertical_gradient - calculations for glacier model that changes answers when CISM - is active (IG compsets). - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): cime, rtm, mosart - - cime to clm4_5_8_r180_cime4.5.14 (This includes option for DATM=CLMGSWP3) - rtm to rtm1_0_56 - mosart to mosart1_0_16 - -List all files eliminated: Remove NCL script to compare files (can now use -m option to FORTRAN cprnc program) - - D components/clm/tools/shared/ncl_scripts/cprnc.pl --- use FORTRAN cprnc - D components/clm/tools/shared/ncl_scripts/cprnc.ncl -- use FORTRAN cprnc - D components/clm/bld/namelist_files/namelist_definition_drv_flds.xml --- Now in driver - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -::::::::::::::::::: Replace setting of CPRNC_EXE with CPRNC_OPT="-m" - M components/clm/test/tools/CLM_compare.sh ----- Add use of CPRNC_OPT - M components/clm/test/tools/test_driver.sh ----- Export CPRNC_EXE and set default CPRNC_OPT to blank - M components/clm/test/tools/TBLCFGtools.sh ----- Replace CRPNC_EXE with CPRNC_OPT="-m" - M components/clm/test/tools/TOPtools.sh -------- Replace CRPNC_EXE with CPRNC_OPT="-m" - M components/clm/test/tools/TBLscript_tools.sh - Replace CRPNC_EXE with CPRNC_OPT="-m" - M components/clm/test/tools/TBLtools.sh -------- Replace CRPNC_EXE with CPRNC_OPT="-m" - M components/clm/test/tools/TSMscript_tools.sh - Use $CSMDATA/lnd/clm2/PTCLMmydatafiles.c160208 directory - rather than older directory - M components/clm/test/tools/nl_files/PTCLM_USUMB_clm4_5 -------- Update map date to 160208 - M components/clm/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 -- Update map date to 160208 - M components/clm/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 - Update map date to 160208 - - M components/clm/tools/shared/ncl_scripts/README - Remove mention of cprnc.pl/cprnc.ncl - - M components/clm/tools/shared/mkmapdata/mkmapdata.sh -------- Create map for 3x3min_MODIS-wCsp instead of 3x3min_MODIS - M components/clm/tools/clm4_5/mksurfdata_map/Makefile.data -- By default also create f45 1850 and transient datasets - - M components/clm/bld/unit_testers/build-namelist_test.pl --------------- Add a ton more testing - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ------- Add lnd_tuning_mod, clm_accelerated_spinup, - megan, atm_c14_filename use_c14. Set spinup_state by clm_accelerated_spinup, set hist settings by - clm_accelerated_spinup cutting back history output drastically. Set pot_hmn_ign_counts_alpha by - lnd_tuning_mode. Set nsegspc=35. Change maps from 3x3min_MODIS to 3x3min_MODIS_wCsp to add Caspian Sea to - lake mask - M components/clm/bld/namelist_files/namelist_definition_clm4_0.xml ----- Add lnd_tuning_mod, clm_accelerated_spinup, megan. - M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Add SCRIP grid file for 0.125x0.125 resolution. - add SCRIP grid for 3x3min_MODIS-wCsp, lake mask is now MODIS-wCsp, update mksrf_flakwat to include Caspian Sea - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml ----- Add some commented out namelist variables that - will be added later. Correct or clarify some definitions. Add lnd_tuning_mode, clm_accelerated_spinup and megan. - Remove MEGAN, drydep, and fire-emission namelist items as in drv namelist_definition now. - M components/clm/bld/namelist_files/namelist_defaults_clm4_0.xml ------- Set lnd_tuning_mod, clm_accelerated_spinup, and megan. - Also use history options to cut back history output drastically for clm_accelerated_spinup="on". - M components/clm/bld/CLMBuildNamelist.pm ----- Add clm_accelerated_spinup, lnd_tuning_mode, remove bgc_spinup. Read - in driver namelist-definition for drv_flds_in. Add nitrif_inparm, and soilhydrology_inparm although empty. Always - write out (and overwrite) the drv_flds_in namelist even if empty. Driver now reads clm's version and merges it with - CAM's version and terminates on a contradiction. - - M components/clm/cime_config/testdefs/testlist_clm.xml - Work on test lists. - M components/clm/cime_config/user_nl_clm --------------- Remove note about drv_flds_in file only be written out if certain - build-namelist options are on as no longer true. - M components/clm/cime_config/buildnml ------------------ Turn megan off if NOT datm. Send LND_TUNING_MODE to build-namelist. - Remove setting of bgc_spinup based on CLM_ACCELERATED_SPINUP (build-namelist itself figures this out). Leave drv_flds_in - in clmconf directory and let the driver merge it's contents with CAM and create a version in RUNDIR. Copy - CASEROOT/Buildconf/clmconf/user_nl_clm${inst_string} to clmconf (doesn't really need to be done). - M components/clm/cime_config/config_component.xml ------ Add LND_TUNING_MODE (clm4_0_default,clm5_0_cam5.5,clm5_0_GSW3P,clm4_5_CRUNCEP) - Right now default for CLM5.0 is clm5_0_cam5.5 for all cases. For clm4_0 or clm4_5 the one given default is used. - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r180 -Originator(s): sacks (Bill Sacks) -Date: Mon Jun 6 06:13:57 MDT 2016 -One-line Summary: Refactor dyn_cnbal_patch - -Purpose of changes ------------------- - -There was a lot of duplicated code, as well as almost-but-not-quite-duplicated -code in dyn_cnbal_patch (the code used for updating patch-level BGC variables -when patch weights change). This tag consolidates this duplicated code into some -new shared infrastructure, similar to what is done for column-level variables. - -In addition, do not zero states when patch weights go to zero. (I expected this -to change answers for 1-d history files, but it didn't.) - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2317: incorrect handling of isotopes with transient PFTs starting in clm4_5_1_r097 - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: small timing increase: about 10% increase -in dyn_cnbal_patch, amounting to a 0.3% increase in total CLM runtime (for both -transient and non-transient runs). - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - -NOTE: testing done on -refactor_seed_calculation_n01_maintain_state_zero_weight_n01_dynlu_conserve_cn3_n03_clm4_5_8_r179; -very minor changes since then tested with -SMS_Ld5_D_P24x1.f10_f10.IRCP45CLM45BGC.hobart_nag.clm-decStart - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass, expected baseline failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_8_r179 - CLM40 compared with clm4_5_8_r178 (baselines missing for r179) - - -Answer changes --------------- - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 / CLM50 transient and CNDV runs - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Roundoff-level changes - - Greater than roundoff-level for transient runs with isotopes, due to fixing - bug 2317 - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - Created a branch (dynlu_conserve_cn3_oneoff) that was as similar as possible - to the trunk, with just those changes needed to get bit-for-bit behavior with - my new code (e.g., reordering some calculations). Confirmed that my new code - is bit-for-bit with that. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= New, shared infrastructure for updating patch-level variables -A components/clm/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 -A components/clm/src/dyn_subgrid/test/dynPatchStateUpdater_test/CMakeLists.txt -A components/clm/src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf -A components/clm/src/dyn_subgrid/test/dynPatchStateUpdater_test - -========= Extract code common to carbon and nitrogen, for computing seed amounts -A components/clm/src/biogeochem/CNVegComputeSeedMod.F90 -A components/clm/src/biogeochem/test/CNVegComputeSeed_test/CMakeLists.txt -A components/clm/src/biogeochem/test/CNVegComputeSeed_test/test_ComputeSeedAmounts.pf -A components/clm/src/biogeochem/test/CNVegComputeSeed_test - -========= Define constants for identifying whether we're operating on c12, c13, - c14 or n (used in CNVegComputeSeedMod) -A components/clm/src/biogeochem/CNSpeciesMod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Remove a bunch of code - moved to new infrastructure -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 - -========= Make calls to new patch state updater for each necessary variable -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 - -========= Set up patch state updater -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Other minor changes needed to use the new infrastructure -M components/clm/src/biogeochem/CNVegetationFacade.F90 - -========= Add some unit tests, and some related unit testing infrastructure -M components/clm/src/biogeochem/test/CMakeLists.txt -M components/clm/src/main/pftconMod.F90 -M components/clm/src/biogeochem/CMakeLists.txt -M components/clm/src/dyn_subgrid/CMakeLists.txt -M components/clm/src/dyn_subgrid/test/CMakeLists.txt -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 - -========= Remove a bit of unused code -M components/clm/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 - -========= Remove a test that has been passing for a while, and one that no longer exists -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r179 -Originator(s): sacks (Bill Sacks) -Date: Fri May 27 10:39:15 MDT 2016 -One-line Summary: Update column-level BGC state variables with dynamic landunits - -Purpose of changes ------------------- - -Update column-level BGC state variables as column areas change due to dynamic -landunits. This does NOT yet update column-level biogeophysical variables, NOR -does it handle patch-level variables appropriately. - -Note that some variables that used to only exist on vegetated landunits (soil & -crop landunits) now exist on all landunits. When columns in special landunits -expand, they take on the carbon, nitrogen and methane state variables from the -columns they expanded into. These C / N / CH4 quantities essentially get trapped -underneath the glacier (or lake / urban / whatever), staying fixed until that -column eventually shrinks. If that special column shrinks and is replaced by a -vegetated column, then the vegetated column takes on the state that had been -trapped under the glacier (or whatever). In this way, we avoid destroying or -creating mass when special landunits grow and shrink. This change explains why -summary variables that used to be computed for just soil & crop columns are now -computed for all columns. - -Note: In some testing (particularly in the 6-year Smallville test case), I found -that there was a huge decrease (order of magnitude or more) in methane -concentrations in the unsaturated portion of the growing column after column -area adjustments. As far as I can tell, the state variable is being updated -correctly due to the changing column areas, but then within the timestep evolves -rapidly to a different value. From talking with Dave Lawrence, we assume this is -due to the adjustment of carbon content in the column, since the carbon state -can have a big effect on methane fluxes. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): -- 2283: dynamic landunits: handle methane with changing lake area [enhancement] - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - - When using use_init_interp in cases with CISM (IG/JG/FG/BG) compsets, there - is a large adjustment in Greenland glacier area in the first timestep of the - run, even if glacier evolution is off. (This is because, in initialization, - glacier area comes from CLM's surface dataset; then glacier area is updated - to match CISM in the first timestep, even if glacier evolution is off.) This - results in big adjustments in column-level carbon, nitrogen and methane - content in the first timestep, because it looks to CLM like some glacier - columns have grown significantly (trapping C / N / CH4), while others have - shrunk significantly, causing a significant decrease in area-average C / N / - CH4 in the growing vegetated columns. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests all pass or xfail; expected baseline comparison failures as - noted below - -CLM tag used for the baseline comparisons: clm4_5_8_r178 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 with CN/BGC, either with CISM (IG) - or transient crops (historical / RCP compsets with CROP) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; potentially new climate - - The evolution of C / N / CH4 state variables is now completely different with - transient glacier or crop areas, causing significant answer changes. - - These transient crop tests change answers: - ERS_Ly5_P60x1.f10_f10.IHISTCLM45BGCCROP.yellowstone_intel.clm-cropMonthOutput - SMS_D_Ly6.1x1_smallvilleIA.IHISTCLM45BGCCROP.yellowstone_pgi.clm-cropMonthOutput - - For glacier, typically changes will only be seen if ice evolution is turned - on, but changes will be seen even with ice evolution off - or ice evolution on - in a test too short to actually see any ice evolution - if use_init_interp - is used, as noted in the "caveats" section above. This affects these tests: - ERS_D_Ld3.f09_g16_gl5.IG1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KitchenSink - SMS_Lm1.f09_g16_gl5.IG1850CRUCLM50BGC.yellowstone_intel.clm-clm50KitchenSink - - In addition, there are FILLDIFFs in a few methane variables. The new code - seems correct, in that the fill pattern (over special landunits) is the same - for all vertical levels: the old code had different fill patterns in lower - soil layers. This affects these variables: CONC_O2_SAT, CONC_O2_UNSAT, - CONC_CH4_SAT, CONC_CH4_UNSAT, LAYER_SAT_LAG. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): - cism2_1_10 -> cism2_1_17: Update to latest CISM trunk tag (main purpose is to - bring in new capabilities for overriding glacier areas for testing purposes) - -List all files eliminated: none - -List all files added and what they do: - -========= Add a test that has both increases and decreases in glacier together - with BGC -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_cism -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_inc_dec_bgc - -List all existing files that have been modified, and describe the changes: - -========= Add capabilities to the column state updater: fractional areas (needed - for methane) and keeping track of the adjustments made to each variable -M components/clm/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 -M components/clm/src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf - -========= Update BGC column-level state variables when column areas change -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/main/clm_driver.F90 - -========= Update ch4 column-level state variables when column areas change. Also - did a bunch of refactoring that was either needed or nice to have to - support these changes, especially related to (1) determining whether - it's the first timestep where ch4 is included; (2) how variables that - keep track of states in the previous timestep are set (this needed to - be reworked to simplify what we need to adjust in the column - conservation); (3) initializing conserved state variables to 0 (rather - than spval) over special landunits (this required putting in place - backwards compatibility with old restart files in subroutine Restart); - (4) where start-of-timestep balance check initialization is done -M components/clm/src/biogeochem/ch4Mod.F90 - -========= Add new routine to support restart file backwards compatibility: - set_missing_vals_to_constant -M components/clm/src/utils/restUtilMod.F90.in - -========= Add a new history averaging option: SUM. Also refactored some handling - of avgflag to remove duplication, and allowed l2g_scale_type in more - contexts -M components/clm/src/main/histFileMod.F90 - - -========= Add a new l2g_scale_type: veg_plus_lake (needed for some methane - variables) -M components/clm/src/main/subgridAveMod.F90 - -========= Add a new fiter: allc - all (active) columns -M components/clm/src/main/filterMod.F90 - -========= Add col_filter_from_lunflags, change col_filter_from_ltype to - col_filter_from_ltypes (allowing multiple landunit types) -M components/clm/src/main/filterColMod.F90 -M components/clm/src/main/test/filter_test/test_filter_col.pf -M components/clm/src/main/test/topo_test/test_topo.pf - -========= Updates for modified interface in new CISM -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_cism -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_cism - -========= Add a test that has both increases and decreases in glacier together - with BGC; remove a long test for which we have sufficient coverage - with a similar, shorter test -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r178 -Originator(s): sacks (Bill Sacks) -Date: Sun Apr 17 19:28:55 MDT 2016 -One-line Summary: Remove some consistency checks, and merge crop_prog with use_crop in code - -Purpose of changes ------------------- - -(1) Remove some consistency checks that were doing more harm than good: - - (a) Make init_interp_fill_missing_with_natveg unnecessary for natural veg - and crop output points. This is mainly to support the common use case of - interpolating from non-crop to crop, without requiring the user to set - this flag. - - (b) Remove check_finidat_fsurdat_consistency - now never do this check. This - consistency check was causing more problems than it solved, both for - users and developers (e.g., requiring us to change initial conditions - files whenever we made new versions of the surface dataset). - -(2) Remove crop_prog logical variable from the code. This was identical to - use_crop, and so it was confusing to have these two separate variables. Uses - of crop_prog have been replaced by uses of use_crop. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- No longer need to set init_interp_fill_missing_with_natveg when interpolating -from non-crop to crop - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - pass (ran bld/unit_testers tests) - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_8_r177 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Make init_interp_fill_missing_with_natveg unnecessary for natural veg - and crop output points -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Make init_interp_fill_missing_with_natveg unnecessary for natural veg - and crop output points -M components/clm/src/init_interp/initInterpMindist.F90 -M components/clm/src/init_interp/test/initInterpMindist_test/test_init_interp_mindist.pf -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Remove check_finidat_fsurdat_consistency - now never do this check -M components/clm/src/main/restFileMod.F90 -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -========= Remove crop_prog - use use_crop in its place -M components/clm/src/ED/main/EDCLMLinkMod.F90 -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/biogeophys/TemperatureType.F90 -M components/clm/src/biogeophys/WaterStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 -M components/clm/src/unit_test_stubs/main/histFileMod_stub.F90 -M components/clm/src/biogeochem/CNFUNMod.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/biogeochem/CNPrecisionControlMod.F90 -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CropType.F90 -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -M components/clm/src/biogeochem/CNNStateUpdate1Mod.F90 -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 -M components/clm/src/biogeochem/CNVegStateType.F90 -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/initGridCellsMod.F90 -M components/clm/src/main/histFileMod.F90 -M components/clm/src/main/clm_varpar.F90 -M components/clm/src/main/pftconMod.F90 -M components/clm/src/main/surfrdMod.F90 -M components/clm/src/main/clm_instMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r177 -Originator(s): sacks (Bill Sacks) -Date: Thu Apr 14 14:00:25 MDT 2016 -One-line Summary: Move CN product pools to gridcell level - -Purpose of changes ------------------- - -Move CN product pools from column-level to gridcell-level. This is needed for C -& N conservation with dynamic landunits, because there was no obvious way to -handle column-level product pools. - -This also required moving some of the related fluxes to the gridcell-level. - -Also added capability for init_interp to handle gridcell-level fields. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- If you run an old restart file through init_interp, product pools will be - zeroed out. This is an issue for restart files that come from a transient run - or from a clm5 crop run. Solution: run your old file through the new code for - at least one time step without init_interp, then you can init_interp that - file. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- clmi.I2000CLM45CRUBGC.2000-01-01.0.9x1.25_gx1v6_simyr2000_c160127.nc replaced - by clmi.I2000CLM45CRUBGC.2000-01-01.0.9x1.25_gx1v6_simyr2000_c160413.nc. This - is basically the same, but run for one extra time step using compset ICLM45BGC - with this branch. - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass or xfail, some baseline comparisons fail, as noted below - -CLM tag used for the baseline comparisons: clm4_5_8_r176 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all CLM45/CLM5 with CN/BGC - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - All CLM45/CLM5 CN/BGC cases have roundoff-level changes in product pools and - related fluxes. In addition: - - (1) Bigger answer changes for CN/BGC cases using the f09 year-2000 initial - conditions file: this file has been run through the new code for one - additional time step. Differences were larger than I expected for this - seemingly-minor change; I did not spend time tracking down the cause for - those differences. - - (2) Cases doing interpolation (init_interp) from some other out-of-the-box - initial conditions files have normalized RMS differences greater than - roundoff. This is because some other initial conditions files (including - some 1850 files) have non-zero product pools, which are zeroed out by - init_interp: see the caveat for users above. However, in an absolute sense, - RMS differences are small, because the product pools on these files are very - small. - - (3) Greater than roundoff-level changes in product pools and related fluxes - in transient crop cases. This shows up in the test - ERS_Ly5_P60x1.f10_f10.IHISTCLM45BGCCROP.yellowstone_intel.clm-cropMonthOutput. This - is expected: in the old code, the product pools grew or shrank as the - columns they were on grew or shrank. This was essentially the motivation for - this tag. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - Based on RMS errors in baseline comparisons - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Move product pools from column to gridcell-level, as described above -M components/clm/src/biogeochem/CNProductsMod.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/lnd2atmMod.F90 - -========= Allow suffix on restart field name -M components/clm/src/biogeochem/SpeciesBaseType.F90 -M components/clm/src/biogeochem/SpeciesIsotopeType.F90 -M components/clm/src/biogeochem/SpeciesNonIsotopeType.F90 -M components/clm/src/biogeochem/test/Species_test/test_SpeciesNonIsotope.pf -M components/clm/src/biogeochem/test/Species_test/test_SpeciesIsotope.pf - -========= Add a routine to assist with backwards compatibility: - set_grc_field_from_col_field: Set a gridcell-level field from a - column-level field on the restart file -M components/clm/src/utils/restUtilMod.F90.in - -========= Add capability for init_interp to handle gridcell-level fields. This - is needed for the new gridcell-level product pools. -M components/clm/src/init_interp/test/initInterpMindist_test/test_init_interp_mindist.pf -M components/clm/src/init_interp/initInterp.F90 -M components/clm/src/init_interp/initInterpMindist.F90 -M components/clm/src/init_interp/initInterpBounds.F90 - -========= Point to new year-2000 initial conditions file. This is basically the - same as the old one, but has been run for one timestep using the new - code, in order to have gridcell-level product pools. This is needed - for LII testing. -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Replace a year-1850 LII test with a year-2000 LII test to exercise the - gridcell-level init_interp code (need non-zero product pools to test - that code fully) -M components/clm/cime_config/testdefs/testlist_clm.xml - - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r176 -Originator(s): sacks (Bill Sacks) -Date: Wed Apr 13 09:32:56 MDT 2016 -One-line Summary: Calculate active flags and filters earlier in initialization - -Purpose of changes ------------------- - -Main purpose is to compute the active flags and filters (via reweight_wrapup) -earlier in initialization. These are now computed initially before the restart -file is read, and tehn updated as soon as possible in the midst of the restart -file read. This is useful in case any of the clm_instMod restart routines want -to use the active flags or filters, directly or indirectly (e.g., via a call to -subgridAveMod) - e.g., for the sake of backwards compatibility. This is -something that's needed in an upcoming tag. - -Also: change some CN product history fields, so that they are more consistent - -so totals just give totals for wood: - -- Renamed TOTPROD to TOT_WOODPROD - -- Removed PRODUCT_CLOSS and similar fields, added TOT_WOODPRODC_LOSS and similar - fields: now just include losses from wood product pools - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- renamed CN product history fields: see above - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass or xfail, plus expected failures in CLM5 ERP tests with - threading, just in the NPP_BURNEDOFF field, due to bug 2292 (leading to - differences both in the baseline comparison and in the comparison of the - restart to the baseline) - -CLM tag used for the baseline comparisons: clm4_5_8_r175 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Compute active flags and filters earlier in initialization -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/restFileMod.F90 - -========= Change CN product history fields (see above for details) -M components/clm/src/biogeochem/CNProductsMod.F90 - -========= Unrelated change: fix argument intent -M components/clm/src/biogeochem/CNPhenologyMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r175 -Originator(s): sacks (Bill Sacks) -Date: Sat Apr 9 15:48:47 MDT 2016 -One-line Summary: For glc_mec, change downscaling and where SMB is computed - -Purpose of changes ------------------- - -Two main purposes: - -(1) Change some aspects of the downscaling of atmospheric fields that is done - when running with glc_mec. These change answers for glc_mec cases (i.e., - cases with CISM): - - (a) Change the downscaling equations for forc_th (potential temperature) and - forc_rho (atmospheric density): Previously, these gave different answers - from the gridcell value even if the column's topographic height exactly - matched the atmosphere's topographic height. The new equations are based on - deltas, ensuring that the downscaled values match the atmospheric forcings - if topographic heights match. - - Now all downscaled fields should match the atmosphere forcings if the - topographic heights match, *except* rain and snow (potentially large - differences, by design), and longwave radiation (roundoff-level differences - can be introduced by the normalization). - - (b) Perform downscaling over all column types inside the - icemask. Previously, downscaling was done only for istice_mec and istsoil - columns (because those were the only ones that computed SMB). I realized - that this could result in some undesirable inconsistencies between the - different columns in a gridcell, which could be especially problematic if a - glacier advanced over (e.g.) a lake column. In practice, this seems to - affect a few lake points inside Greenland. - - (c) Do *not* perform downscaling over glacier columns with the - single_at_atm_topo behavior. This is for consistency with other column types - whose topographic height (implicitly) matches the atmosphere's. In practice, - this shouldn't effect the simulation much, if at all (due to the change in - (a)). - - (d) Extracted a function to compute forc_rho, and pulled out some magic - numbers from this calculation - -(2) When running with glc_mec, compute SMB for all vegetated columns in the - 'virtual' glacier region, rather than just in the icemask. This affects the - CLM fields sent to the coupler for elevation class 0, but otherwise has no - direct effect on CLM evolution. - - This is important if you want coupler forcings that can drive a later TG - run: Typically you will want these forcings in the same place where you - wanted virtual columns (for the same reason: so that forcings are available - in every elevation class, including elevation class 0). - -In order to accomplish these changes, I have separated the logic for where to -compute SMB from the logic for where to do downscaling. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: Bill Lipscomb reviewed the new equations for forc_th and -forc_rho. Other changes have not been reviewed. - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass or xfail, except for expected baseline comparison - failures, as noted below. - - Also: There were failures in CLM5 ERP tests with threading, just in the - NPP_BURNEDOFF field, due to bug 2292, which was introduced in the previous - tag. I confirmed that the same tests failed in a fresh checkout of r174. - -CLM tag used for the baseline comparisons: clm4_5_8_r174 - - -Answer changes --------------- - -Changes answers relative to baseline: YES, for CLM45/CLM5 with CISM (IG compsets) - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM5 with CISM (IG compsets) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Not investigated closely, but expected to be larger than roundoff/same - climate - - Differences are due to: - - (1) New downscaling equations for forc_th and forc_rho. I have confirmed - that these differences are relatively small in one test run (one-day - average differences < 0.31 deg for forc_th and < 1e-10 for forc_rho). - - (2) Downscaling now done over all column types within the icemask - (including lakes) - - (3) Small change in constants used in calculation of forc_rho downscaling, - to be consistent with shr_const_mod - - (4) Now compute SMB for all vegetated columns in the 'virtual' glacier - region, rather than just columns in the icemask. This affects fields sent - from CLM to the coupler in elevation class 0. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Changed to a .in file processed by genf90 -D components/clm/src/unit_test_shr/unittestArrayMod.F90 - -List all files added and what they do: - -========= New module to handle coordination of updating topographic heights, as - well as determining which columns need downscaling -A components/clm/src/main/TopoMod.F90 - -========= New unit tests -A components/clm/src/main/test/atm2lnd_test/test_downscale_forcings.pf -A components/clm/src/main/test/topo_test/test_topo.pf -A components/clm/src/main/test/topo_test/CMakeLists.txt -A components/clm/src/main/test/topo_test - -========= Changed to a .in file processed by genf90 -A components/clm/src/unit_test_shr/unittestArrayMod.F90.in - -========= Routines that assist unit tests working with glc_mec landunits -A components/clm/src/unit_test_shr/unittestGlcMec.F90 - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above. Some of these changes have to do - with the creation of TopoMod: topo_type, and the move of glc_topo into - there - now called topo_col -M components/clm/src/main/restFileMod.F90 -M components/clm/src/main/clm_varcon.F90 -M components/clm/src/main/filterMod.F90 -M components/clm/src/main/glcBehaviorMod.F90 -M components/clm/src/main/subgridRestMod.F90 -M components/clm/src/main/ColumnType.F90 -M components/clm/src/main/clm_instMod.F90 -M components/clm/src/main/reweightMod.F90 -M components/clm/src/main/glc2lndMod.F90 -M components/clm/src/main/lnd2glcMod.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= New routines for creating filters - some for production code, some for - unit tests -M components/clm/src/main/filterColMod.F90 - -========= Add some unit tests and some unit test helper functionality -M components/clm/src/main/CMakeLists.txt -M components/clm/src/main/test/filter_test/test_filter_col.pf -M components/clm/src/main/test/glcBehavior_test/test_glcBehavior.pf -M components/clm/src/main/test/CMakeLists.txt -M components/clm/src/main/test/atm2lnd_test/CMakeLists.txt -M components/clm/src/unit_test_shr/unittestFilterBuilderMod.F90 -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 -M components/clm/src/unit_test_shr/unittestSubgridMod.F90 -M components/clm/src/unit_test_shr/CMakeLists.txt -M components/clm/src/unit_test_shr/test/unittestArray_test/test_unittestArray.pf - -========= Add a bit of documentation -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r174 -Originator(s): erik (Erik Kluzek) -Date: Fri Mar 25 01:57:24 MDT 2016 -One-line Summary: Bring Rosie's respiration and FUN changes to the trunk - -Purpose of changes ------------------- - -Changes to respiration from Rosie Fisher. Leaf respiration option (CLM50 default is Atkin 2015) -as well as option for light inhibition. Also reworking of FUN so it calculates both fixers -and non fixers and then figures out the impact of both based on a fixed percentage of plants -that fix by PFT. Add burned-off carbon to FUN (Carbon that can not be used for N uptake). -Add new term to directly account for Ben Houlton's temperature response function. - -New defaults for CLM5.0. Add some new history fields including -LEAFCN and LEAFCN_STORAGE CN ratios. - -Default for snow depth is now lowered to 10m from 20m. If you startup from an initial condition -file with 20m of snow, a big flow of ice-runoff will flow out of the system (takes a few days -to clear it all out). In general you should NOT allow this for fully coupled simulations with -an active ocean model. For other simulations, you should be aware of this sudden ice runoff that -will happen. - -Remove some unused unworking or unrefined options for flexible-CN. - -Check for small C or N values in CNPrecisionControl after -each StateUpdate section rather than just after summary. -This is turned on for CLM50 with use_nguardrail (will turn this -on for CLM45 as well, and remove later). - -Improve some of the documentation of namelist items. Also work on some of the dependencies: -use_flexiblcCN requires CN, carbon_resp_opt=1 only if CN on and FUN off. -use_luna on only if CN and nitrif_denitrif on. -lnc_opt depends on if CN on or off. -FUN on depends on both CN and nitrig_dentrif - -FUN is very expensive in this version and causes model to be significantly slower. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - - 2302 Some missing nh4 arrays set to zero. - 2298 Init method NOT called for NutrientCompetetionFlexibleCN - 2296 Missing meta-data for new data added to params file - 2273 Log output without a "if masterproc " around it... - 2268 Irrigation unit tests broken because of irrigation limiter - 2253 Nitrogen Deposition accidentally turned off when FUN on - 2249 Low LAI over Amazon - -Known bugs introduced in this tag (include bugzilla ID): - - 2295 ch4 conservation error in ne30 1850 case - 2269 log(0) possibility - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: - This changes the default for snow capping from 20m to 10m. If you use an initial condition - file with 20m of snow it will cut the snow depth to 10m, and send 10m of snow as ice runoff. - This sudden influx of ice runoff could be problematic for fully coupled simulations to an - ocean model. - -Changes to CLM's user interface: - New namelist items: leafresp_method, light_inhibit, leaf_acc, rootstem_acc, use_nguardrail - Remove namelist : carbon_excess_opt, carbon_storage_excess_opt, dynamic_plant_alloc_opt - Remove vcmax_opt options 1 and 2 - - new namelist group: photosyns_inparm - - carbon_resp_opt should be 0 when use_fun=.true. - - New history fields: Vcmx25Z, Jcmx25Z, LEAFCN, LEAFCN_STORAGE - COST_NFIX, COST_NACTIVE, COST_NRETRANS, NUPTAKE_NPP_FRACTION - - add IGM1850CRUCLM50BGCCROP and IGM1850CRUCLM50BGC compsets - -Changes made to namelist defaults: - - New defaults: CLM50: leaf_acc, light_inhibit, use_bedrock, use_nguardrail all on - leaf_resp=2 - h2osno_max=10m - use_flexibleCN (if CN on) - carbon_resp_opt=1 (only if use_cn ON and FUN off) - use_luna (only if use_cn and use_nitrif_denitrif on) - lnc_opt depends on CN - FUN on depends on CN and nitrif_denitrif - Change leaf_mr_vcm phys default value - -Changes to the datasets: - New params file for clm5_0 with metadata on new fields. Remove some uneeded - parameters. - -Substantial timing or memory changes: Approximately 20% slower with FUN on - - -Code reviews and testing ------------------------- - -Code reviewed by: self,rfisher - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - PASS - -CLM tag used for the baseline comparisons: clm4_5_8_r173 - - -Answer changes Yes! for CLM50, clm45 and clm40 bit-for-bit --------------- - -Changes answers relative to baseline: - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 - - what platforms/compilers: All - - nature of change: new climate - - - casename: /home/oleson/respn14r172_1850spin - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: - A components/clm/doc/clm3_0_ChangeLog -- split out CLM3.0 section - A components/clm/doc/clm4_0_ChangeLog -- split out CLM4.0 section - -List all existing files that have been modified, and describe the changes: -M components/clm/cime_config/config_component.xml - formatting change, removing extra spaces -M components/clm/cime_config/config_compsets.xml - add IGM1850CRUCLM50BGCCROP and IGM1850CRUCLM50BGC compsets -M components/clm/src/biogeophys/test/Irrigation_test/IrrigationWrapperMod.F90 - Changes from Ben Andre to fix irrigation unit test issue bug 2268 -M components/clm/src/biogeophys/test/Irrigation_test/test_irrigation_singlepatch.pf - Add new test irrigation_for_limiting_volr -M components/clm/src/biogeophys/SoilWaterMovementMod.F90 - Remove warning for h2osoi_liq negative. Limit dLow, diag, dUpp, and rhs - arrays by nlayers. -M components/clm/src/biogeophys/IrrigationMod.F90 - Make sure a constant is double (_r8) -M components/clm/src/biogeophys/UrbanParamsType.F90 - Add if_masterproc -MM components/clm/src/biogeophys/SnowHydrologyMod.F90 - Add min_snow_to_keep, fix bug 2270 -M components/clm/src/biogeophys/LunaMod.F90 - Work on warnings and error conditions. -M components/clm/src/biogeophys/PhotosynthesisMod.F90 - Make Vcmx25Z, Jcmx25Z default inactive on history. Add ReadNML method - add leafresp_method, light_inhibit, leaf_acc, rootstem_acc to namelist. - Remove vcmax_opt=1/2 change to if,else if, else. -M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - Add if_masterproc -M components/clm/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 - Add timer around FUN. Add some new terms when FUN on. Use local version - of use_fun (so optimizer can know it won't change). Write to iulog rather - than *. -M components/clm/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 - Comment out warning -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 - Remove unneeded use_fun dependence -M components/clm/src/biogeochem/CNGapMortalityMod.F90 - Remove: carbon_excess_opt, carbon_storage_excess_opt -M components/clm/src/biogeochem/CNGRespMod.F90 - Remove: carbon_excess_opt and carbon_storage_excess_opt calcs -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 - Lower carbon balance warning from e-10 to e-9, use iulog rather than * -M components/clm/src/biogeochem/CNMRespMod.F90 - Add rootstem_acc option which Rosie says "will increase R and decrease - productivity in boreal forests, A LOT. :)" -M components/clm/src/biogeochem/CNFUNMod.F90 - Extensive changes from Rosie. Some formatting changes. Add burnedoff_carbon. - and timer around main FUN calculations. Fix bug 2302 (missing setting of some nh4 - arrays to zero). Base if fixer on c3psn. Add bit about unmet_demand. Loop - over both fixers and non-fixers, params file has percentage of each for each PFT type. - Set some things to spval for night. Add new term to directly account for Ben - Houlton's temperature response function -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 - Add if masterproc around writes -M components/clm/src/biogeochem/NutrientCompetitionFactoryMod.F90 - Pass in bounds and add call to init method -M components/clm/src/biogeochem/CNPrecisionControlMod.F90 - Make ccrit and ncrit parameters and add n_min (for calculation of CN ratio) -M components/clm/src/biogeochem/NutrientCompetitionMethodMod.F90 - Add init method to abstract class and add readParams as completed method -M components/clm/src/biogeochem/CNPhenologyMod.F90 - Add some use_fun changes, add logical for additional_onset_condition -M components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 - Remove cpool imbalance warning -M components/clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 - Add init method, move readParams to base class. Check if aleaf is nan - in calc_plant_nutrient_competition. Set frootn/livestemn "to_retransn" to zero for fun -M components/clm/src/biogeochem/CNNDynamicsMod.F90 - Remove setting of ndep_to_sminn(c) to zero for FUN, do set nfix_to_sminn to zero -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 - Add new history fields: COST_NFIX, COST_NACTIVE, COST_NRETRANS, NUPTAKE_NPP_FRACTION - all default on. -M components/clm/src/biogeochem/CNDriverMod.F90 - Add some more timers. Call CNPrecisionControl after each set of updates - (if use_nguardrail is on). Move CNPhenology/CNFUNInit call to before - nutrient_demand, so that croplive didn't change half way through crop N cycle -M components/clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 - Add actual_storage_leafcn and actual_leafcn CN ratios and output to history - and always calculate them. Remove readParams, and add init method. Remove - unused dynamic_plant_alloc. Remove "if(use_fun)" and just rely on carbon_resp_opt - to be 0 when FUN on. Use n_min as parameter for minimun N used for CN ratio. -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 - Add NPP_BURNEDOFF to history file, change ordering -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - Add if(masterproc) around write statements -M components/clm/src/main/clm_varpar.F90 - Add if_masterproc -MM components/clm/src/main/clm_initializeMod.F90 - Pass bounds_proc to create_nutrient_competition_method -M components/clm/src/main/findHistFields.pl - Get working again with all F90 files. -MM components/clm/src/main/controlMod.F90 - Remove carbon_excess_opt, carbon_storage_excess_opt, dynamic_plant_alloc_opt - namelist variables. Add use_nguardrail (to preserve answers for clm45 will - remove later). -M components/clm/src/main/clm_driver.F90 - Add some timers. -M components/clm/src/main/clm_varctl.F90 - Remove carbon_excess_opt, carbon_storage_excess_opt, dynamic_plant_alloc_opt - Add use_nguardrail. -M components/clm/src/main/pftconMod.F90 - Add some more FUN parameters and remove some uneeded ones. -M components/clm/src/main/clm_instMod.F90 - Add call to photsyns ReadNML -M components/clm/src/main/ncdio_pio.F90.in - Add some if_masterproc -M components/clm/bld/unit_testers/build-namelist_test.pl - Add some new tests for new variables -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add rootstem_acc, leaf_acc, light_inhibit, leafresp_method - use_nguardrail. Improve documentation for some flex-CN options -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - New defaults: CLM50: leaf_acc=T, light_inhibit=T,leaf_resp=2, use_bedrock=T - h2osno_max=10m, use_flexibleCN (if use_cn=T) - carbon_resp_opt=1 (only if use_cn ON and FUN off) - use_luna (only is use_cn and use_nitrif_denitrif on) - lnc_opt depends on use_cn, use_fun depends on - use_cn=T AND use_nitrif_dentrif=T - Change leaf_mr_vcm phys default value - use_nguardrail=T -M components/clm/bld/CLMBuildNamelist.pm - New photsyns_inparm namelist. carbon_resp_opt should NOT be 1 when FUN on. - lnc_opt only matters when luna on or vcmax_opt=3/4. leafresp_method MUST be 0 - if CN off. - - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r173 -Originator(s): sacks (Bill Sacks) -Date: Thu Mar 17 20:24:45 MDT 2016 -One-line Summary: Major refactor of CN Products - -Purpose of changes ------------------- - -Variables and code related to CN product pools and fluxes were scattered among -12 modules. In addition, CNWoodProducts was difficult to understand and modify, -because the same basic logic was repeated four times: once for carbon, once for -c13, once for c14 and once for nitrogen. - -This tag does a major overhaul of CNWoodProducts - now renamed to CNProducts, -since it includes grain as well as wood products. This is now an object-oriented -class. The major benefits of this overhaul are: - -- Only 2 modules now contain any information about the number of product pools - and their lifetimes: CNProducts and pftconMod. Previously, 12 modules had some - information about the fact that there were 10 & 100-year product pools. This - makes it easier to change the number or lifetimes of product pools in the - future. Code outside CNProducts (and pftconMod) knows that there is some flux - to wood and crop product pools in general, but doesn't need to know anything - about how this is partitioned into the 10 and 100-year product pools - or even - the fact that there are 10 and 100-year product pools. - -- Because this product pool information is now self-contained, with a clear - interface, CNProductsMod could be used by ED, if this were desired. - -- Changes to CNProductsMod no longer need to be replicated four times for the - four different species. Instead, there are four instances of cn_products_type - declared at a higher level. - -This tag also introduces a "species" class (with subclasses for isotope and -non-isotope species), which can be used to remove duplication in the setting of -history and restart variables in classes for which we have one instance for each -species. This is currently used in the new CNProductsMod; eventually it can also -be used in CNVegCarbonStateType, CNVegCarbonFluxType, and the similar -SoilBiogeochem Types (at which point this should probably be moved out of the -biogeochem directory into somewhere like 'utils'). - -This tag also introduces a utility method for setting one restart field (not -found on the restart file) from another (which was present). This is used in a -few places in CNProductsMod, and should be used in other places as well (e.g., -see bug 2282). - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2297 (code looks wrong for initializing carbon isotopes from a restart file - without isotope information) - -Known bugs introduced in this tag (include bugzilla ID): -- 2256 (Problems with early versions of PIO2 in CLM) -- shows up in more - (hobart) tests now, for unclear reasons - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - ok (pass except irrigation expected failure) - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means tests pass or xfail, some baseline comparisons failed as noted - below - - Two new expected failures appear to be PIO2 issues: - RUN ERP_Ly5.1x1_numaIA.ICRUCLM50BGCCROP.hobart_nag.clm-monthly - RUN ERP_Ld5_P24x1.f10_f10.I1850CLM45BGC.hobart_nag.clm-default - - -CLM tag used for the baseline comparisons: clm4_5_8_r172 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 / CLM50 - anything other than 1850 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - This is complicated; ready? Let's work backwards: - - Branch tag product_pools_gridcell2_n03_clm4_5_8_r172 (which is becoming - this trunk tag) was bit-for-bit with branch tag - product_pool_total_fluxes_n01_clm4_5_8_r172 (from branch - product_pool_total_fluxes), except for roundoff-level changes in c13 / c14 - product pools / fluxes for transient cases with ciso. (Those changes - remained roundoff-level throughout the simulation, so their roundoff-level - nature was obvious from the cprnc output.) - - Determining that the changes in product_pool_total_fluxes_n01_clm4_5_8_r172 - were no greater than roundoff-level was tricky, because these differences - propagated over time. To do this, I created another branch: - product_total_roundoff, with branch tag - product_total_roundoff_n01_product_pool_total_fluxes_n01_clm4_5_8_r172. This - was essentially the same as product_pool_total_fluxes_n01_clm4_5_8_r172, - except that hrv_deadstemc_to_prod10c and hrv_deadstemc_to_prod100c (and - same for nitrogen) were computed twice: once the old way and once the new - way. The updates of deadstemc/n in CStateUpdate2h and NStateUpdate2h (which - were the uses that caused differenes to propagate to greater than - roundoff-level) were also done twice: once using the "old" hrv_deadstem - values, and once with the "new" values. The "old" version was used in the - rest of the code, but the two versions were compared for every point in - every time step to ensure that they were never more than roundoff-level - different. I ran the full test suite on - product_total_roundoff_n01_product_pool_total_fluxes_n01_clm4_5_8_r172 and - ensured that it differed by no more than roundoff-level from trunk tag - clm4_5_8_r172. - - To summarize: I ensured that the only differences greater than - roundoff-level in the test suite were attributable to differences in the - order of operations when computing the hrv_deadstem*_to_prod* variables, - and I also ensured that the new and old calculations of the - hrv_deadstem*_to_prod* variables never differed by more than roundoff. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Renamed to CNProductsMod.F90 -D components/clm/src/biogeochem/CNWoodProductsMod.F90 - -List all files added and what they do: - -========= Main change - this used to be CNWoodProductsMod.F90, but has been - completely rewritten, as described above -A components/clm/src/biogeochem/CNProductsMod.F90 - -========= Utility classes to hold metadata for classes that can have one - instance for each species (carbon, nitrogen, c13, c14) - removing - duplication in the calls to hist_addfld and restartvar -A components/clm/src/biogeochem/SpeciesNonIsotopeType.F90 -A components/clm/src/biogeochem/SpeciesBaseType.F90 -A components/clm/src/biogeochem/SpeciesIsotopeType.F90 -A components/clm/src/biogeochem/test/Species_test/test_SpeciesNonIsotope.pf -A components/clm/src/biogeochem/test/Species_test/CMakeLists.txt -A components/clm/src/biogeochem/test/Species_test/test_SpeciesIsotope.pf -A components/clm/src/biogeochem/test/Species_test -A components/clm/src/biogeochem/test/CMakeLists.txt -A components/clm/src/biogeochem/test - -========= Add a short ciso transient test (eventually can remove the long ciso - transient test and just keep this one) -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_decStart/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_decStart - -List all existing files that have been modified, and describe the changes: - -========= Main changes in this tag: remove information about the different - product pools that are scattered throughout the code, and add some - objects of cn_products_type -M components/clm/src/biogeochem/CNCIsoFluxMod.F90 -M components/clm/src/biogeochem/dynHarvestMod.F90 -M components/clm/src/biogeochem/CNCStateUpdate2Mod.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -M components/clm/src/biogeochem/dynConsBiogeochemMod.F90 -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNNStateUpdate2Mod.F90 -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 - -========= Add utility method for setting an absent restart field from one that - was present on the initial conditions file -M components/clm/src/utils/restUtilMod.F90.in - -========= Move duplicate code into clm_varcon, and fix bug 2297 -M components/clm/src/main/clm_varcon.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 - -========= Add a short ciso transient test (eventually can remove the long ciso - transient test and just keep this one) -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Add unit tests of new Species classes -M components/clm/src/CMakeLists.txt -M components/clm/src/biogeochem/CMakeLists.txt - -========= Two new expected failures on hobart; appear to be PIO2-related -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r172 -Originator(s): sacks (Bill Sacks) -Date: Tue Mar 8 13:10:19 MST 2016 -One-line Summary: Exclude land use and product pools / fluxes from CN summary diagnostics - -Purpose of changes ------------------- - -Changed TOTCOLC, TOTECOSYSC, TOTCOLN and TOTECOSYSN (and same for C isotopes) to -no longer include product pools. Also changed NBP and NEE to no longer include -land use or product fluxes (dwt_closs and product_closs). - -Removed LAND_UPTAKE diagnostic, because NEE now gives this quantity. Added -NET_CARBON_EXCHANGE, which gives the sum of NEE and the land use flux - i.e., -what NEE used to be. - -Also, changed TOTPRODN to be consistent with TOTPRODC: no longer includes crop -product pool. - -The main motivation for this change is the upcoming move of product pools to the -grid cell level. However, this also addresses inconsistencies between CLM's -definition of NEE, etc., and what would be more typically considered in the -literature. - -These changes to the meaning of these diagnostics were all proposed and/or -approved by Peter Lawrence. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Changes meaning of a number of diagnostics, as noted above - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - ok - - All pass except expected failure in irrigation - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - All pass or xfail; baseline failures as noted below - -CLM tag used for the baseline comparisons: clm4_5_8_r171, but with mods to -produce FCO2 history field (in order to ensure that this tag hasn't changed the -co2 flux sent to the atmosphere). - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: many CLM45 / CLM50 - see below for details - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff for prognostic fields, larger than roundoff for some diagnostic fields - - Significant changes in the diagnostic fields noted under "purpose of - changes", above, for transient, CNDV and crop runs, and for year-2000 runs - that used initial conditions from a transient run (so presumably had - non-zero product pools). Changes in these diagnostic fields (if any) are - roundoff-level for non-crop, non-CNDV, non-crop 1850 runs. - - Roundoff-level changes in CO2 flux sent to atmosphere and new FCO2 - diagnostic field for some runs. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes as described above. Some files just changed because some - uses of nee have been changed to net_carbon_exchange. -M components/clm/src/cpl/lnd_import_export.F90 -M components/clm/src/biogeochem/CNVegetationFacade.F90 -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/lnd2atmMod.F90 - -========= Since total column C / N no longer includes the product pools, the CN - balance checks needed to be changed so that outputs from the system - include fluxes into the product pools, but NOT fluxes out of the - product pools (the product pools are outside of the system as far as - the balance checks are concerned) -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 - -========= Fluxes into the product pools now need to be saved for the sake of the - balance checks -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CNWoodProductsMod.F90 -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 - -========= Output FCO2 (co2 flux to atmosphere), since otherwise this isn't - covered by any of our tests - since our tests don't turn on this - coupling field -M components/clm/src/main/lnd2atmType.F90 -M components/clm/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm - -========= Add expected baseline failure (bug 2291) -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r171 -Originator(s): erik (Erik Kluzek) -Date: Wed Mar 2 23:53:40 MST 2016 -One-line Summary: Backout COMP_RUN_BARRIERS setting, and remove all ED tests from testlist (as they all fail) - -Purpose of changes ------------------- - -Backout the setting of COMP_RUN_BARRIERS. It has a nasty side effect of disabling the -automatic setting of CONTINUE_RUN=TRUE when RESUBMIT>1. See bug 2280. Now production -simulations with I compsets will fail because datm is allowed to get ahead of CLM. - -Also remove all of the ED tests from the testlists as they currently all fail. - -Known bugs introduced in this tag (include bugzilla ID): bug 2280 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: short - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - regular tests: - - yellowstone_intel - clm_short_45 -- PASS - -CLM tag used for the baseline comparisons: clm4_5_8_r170 - - -Answer changes --------------- - -Changes answers relative to baseline: No, bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/cime_config/config_component.xml ------- Remove setting of COMP_RUN_BARRIERS - M components/clm/cime_config/testdefs/testlist_clm.xml -- remove all ED tests - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r170 -Originator(s): sacks (Bill Sacks) -Date: Sun Feb 28 20:33:37 MST 2016 -One-line Summary: Add a wrapper for CN Vegetation - -Purpose of changes ------------------- - -This tag introduces a wrapper (or "facade" in software design terms) for the CN -vegetation types and modules. - -My main motivations were: - -(1) Insulating the rest of the code from changes in the CNVeg -implementation. For example, I'm about to introduce a class to hold variables -related to the product pools. With the old implementation, I would have to touch -a number of modules outside of the biogeochem directory in order to do this; now -I won't. - -(2) Simplifying interfaces to subroutines – reducing the number of arguments. - -(3) Starting to put in place a structure that could be leveraged to support CN -and ED (and SP) side-by-side, polymorphically, so that we don't need 'if use_cn' -/ 'if use_ed' conditionals scattered throughout the code or direct "use" -statements of types in CN / ED / etc. - -The changes here are a big first step towards these goals, although this isn't -yet complete. There are some notes in comments in CNVegetationFacade.F90 listing -some things that should still be done. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2276: Need ne30_g16 surface dataset with crop for CLM45/CLM50 -- 2291: fire emissions NaN with gnu compiler - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: a bit of review by Erik Kluzek and Ben Andre - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - ok - - ok means: all tests pass except expected irrigation failure - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - There was one unexpected baseline failure: - SMS_Lm25.f19_g16.ICLM45BGCCROP.yellowstone_gnu.clm-cropMonthOutput - - Upon investigation, it appeared that this was a problem in the previous tag - (and possibly earlier): fire emissions differed between the trunk and this - branch, and were often NaN in the trunk version (but no longer NaN on this - branch). This seems most likely to be a compiler-related problem, since it - seems to just appear with gnu. See bug 2291. - -CLM tag used for the baseline comparisons: clm4_5_8_r169 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - (However, see above notes about the baseline failure due to bug 2291.) - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Moved some modules from dyn_subgrid into biogeochem (no changes to contents) -D components/clm/src/dyn_subgrid/dynCNDVMod.F90 -D components/clm/src/dyn_subgrid/dynHarvestMod.F90 -D components/clm/src/dyn_subgrid/dynConsBiogeochemMod.F90 - -List all files added and what they do: - -========= New module, providing a wrapper / facade for the CNVeg stuff; - this is the crux of the change -A components/clm/src/biogeochem/CNVegetationFacade.F90 - -========= Moved some modules from dyn_subgrid into biogeochem (no changes to contents) -A components/clm/src/biogeochem/dynCNDVMod.F90 -A components/clm/src/biogeochem/dynHarvestMod.F90 -A components/clm/src/biogeochem/dynConsBiogeochemMod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Moved stuff out of these places into the new CNVeg, and simplified - some interfaces -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/clm_instMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Rather than passing CNVeg derived types, instead directly pass the - small number of arrays that are needed from CNVeg (removes dependence - on the CNVeg types, which is needed if we ever want to make CNVeg - polymorphic; also makes the connection between CNVeg and other parts - of the model more explicit) -M components/clm/src/biogeophys/CanopyFluxesMod.F90 -M components/clm/src/biogeophys/PhotosynthesisMod.F90 -M components/clm/src/main/lnd2atmMod.F90 -M components/clm/src/biogeochem/ch4Mod.F90 - -========= Added a bit of time manager functionality, and some unit tests -M components/clm/src/utils/clm_time_manager.F90 -M components/clm/src/unit_test_shr/unittestTimeManagerMod.F90 -M components/clm/src/utils/test/clm_time_manager_test/test_clm_time_manager.pf - -========= Moved some crop-specific variables out of CNVegStateType into CropType - (but there are still more that need to be moved) -M components/clm/src/biogeochem/CNVegStateType.F90 -M components/clm/src/biogeochem/CropType.F90 -M components/clm/src/biogeochem/CNPhenologyMod.F90 -M components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 -M components/clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 -M components/clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 -M components/clm/src/biogeochem/NutrientCompetitionMethodMod.F90 -M components/clm/src/biogeochem/CNNDynamicsMod.F90 -M components/clm/src/biogeochem/CNVegStructUpdateMod.F90 -M components/clm/src/biogeochem/CNRootDynMod.F90 -M components/clm/src/biogeochem/CNDriverMod.F90 - -========= Unrelated change: fix xml entries for ne30 and ne120 surface datasets - (bug 2276) -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Restore expected failure that seems to have been deleted accidentally -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r169 -Originator(s): erik (Erik Kluzek) -Date: Tue Feb 23 14:35:02 MST 2016 -One-line Summary: Add fire several fire constants to namelist, add some new clm45/50 surface datasets - -Purpose of changes ------------------- - - Add a bunch of constants to the namelist for the CN Li fire parameterization. - They are added in the new lifire_inparm namelist. - - Work on user interface a bit. - * New lifire_inparm namelist (see above) - * Add CLM_ACCELERATED_SPINNUP env_run variable - * Turn COMP_RUN_BARRIERS for f09 and f19 resolutions - * New compsets: ICLM50BGCDVCROP, IHISTCLM50BGC - * Model dies if CLM namelist isn't found - * Models dies if use_bedrock=.true. and zbedrock NOT on surface dataset - * Remove use_nofire move to fire_method as "nofire" option - - Add some new clm45/50 surface datasets for crop at 1850 for f45, ne30, and ne120 - Add back in the USUMB PTCLMmkdata dataset directory for testing. - - Work on testing a bit. Remove CLM50 testmods directories just there because of - missing CLM50 compsets. Add set of complete clm40 testmod directories. Add nofire - test, update USUMB test. Remove use_dynroot from all but Kitchen sink tests. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): [If none, remove this line] - 2285 Problem creating ne120 surface dataset - 2280 (partial) need to set barriers for concurrent PE layouts with I compsets - 2279 Need new USUMB PTCLMmkdata directory - 2276 New ne30, ne120, f45 surface datasets for CLM45/50 1850 CROP - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - - Introduce new env_run variable: CLM_ACCELERATED_SPINUP (It can be "on" or "off") - When "on" it sets the simulation up in such a way for it to run in an accelerated - fashion - - (currently all it does is turn "-bgc_spinup on" if - - NOTE: Turns on COMP_RUN_BARRIERS by default for f09 and f19 resolutions as they - are usually run concurrent (f09 is by default). - - Add new CLM namelist: lifire_inparm - - Add new compsets: ICLM50BGCDVCROP, IHISTCLM50BGC - - NOTE: Model will now die if you set use_bedrock=.true., and your surface dataset - doesn't have zbedrock on it. - - WARNING: Now if a CLM namelist is NOT found -- the model will abort with an error. - -Changes made to namelist defaults (e.g., changed parameter values): Many new namelist items - - New CN fire namelist items: rh_low, rh_hgh, bt_min, bt_max, cli_scale, - boreal_peatfire_c, pot_hmn_ign_counts_alpha, non_boreal_peatfire_c, - cropfire_a1, and occur_hi_gdp_tree - They are set by default according to either fire_method=li2014qianfrc or li2016crufrc - - use_nofire removed and "nofire" added as an option to fire_method - -Changes to the datasets (e.g., parameter, surface or initial files): A few new surface datasets - New 1850 clm45/50 surface datasets for: f45, ne30, ne120 - Alos new PTCLMmkdata USUMB directory - -Substantial timing or memory changes: None known - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: regular - - build-namelist tests: - - yellowstone - OK (36 comparison tests fail because of new namelist) - - unit-tests (components/clm/src): - - yellowstone - OK - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - Two comparision tests (ro clm4_5_8_r168) fail, because use_dynroot no longer on. - -CLM tag used for the baseline comparisons: clm4_5_8_r168 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): None - -List all files eliminated: - - Eliminate testmods directories just needed for CLM50 compsets - Now that compsets are added they are unneeded. - - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCCROPmonthly/include_user_mods - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCCROPmonthly/shell_commands - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCDVCROPmonthly/include_user_mods - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCDVCROPmonthly/shell_commands - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCmonthly/include_user_mods - D components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCmonthly/shell_commands - -List all files added and what they do: - -A + components/clm/src/biogeochem/CNFireNoFireMod.F90 -- No fire option - - New testmods for nofire, clm40 tests, and USUMB PTCLMmkdata directory -A + components/clm/cime_config/testdefs/testmods_dirs/clm/nofire -A + components/clm/cime_config/testdefs/testmods_dirs/clm/40crop -A + components/clm/cime_config/testdefs/testmods_dirs/clm/40pts -A + components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLA -A + components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsRLB -A + components/clm/cime_config/testdefs/testmods_dirs/clm/40ptsROA -A + components/clm/cime_config/testdefs/testmods_dirs/clm/40reduceOutput -A + components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/shell_commands - -List all existing files that have been modified, and describe the changes: - - M components/clm/bld/CLMBuildNamelist.pm --- Add new fire constants and lifire_inparm - namelist. Allow spinup state to be 1 or 2, and document better - M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- When - -bgc_spinup on, spinup_state=1 for clm45 and 2 for clm50. Add new - fire constants set to values for either lifire2014qianfrc or lifire2016crufrc - new f45, ne30, ne120 datasets (bug 2276) - M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -- Add - nofire option to fire_method, remove use_nofire, and add new fire - constants - M components/clm/cime_config/buildnml --- Add CLM_ACCELERATED_SPINUP - set "-bgc_spinup on" if CLM_ACCELERATED_SPINUP="on" - - M components/clm/cime_config/config_component.xml -- Set COMP_RUN_BARRIERS (bug 2280) - to TRUE for f09 and f19 resolutions. Define CLM_ACCELERATED_SPINUP. - M components/clm/cime_config/config_compsets.xml -- Add ICLM50BGCDVCROP - and IHISTCLM50BGC compsets - - M components/clm/cime_config/testdefs/testlist_clm.xml --- move all clm40 - tests to have 40 testmods directories, add f45 nofire test, remove clm50 - testmods just use new CLM50 compsets - M components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm -- update (bug 2279) - M components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/xmlchange_cmnds -- update - M components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/user_nl_clm -- remove use_dynroot - M components/clm/cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods -- point to default NOT 40default - M components/clm/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/user_nl_clm -- remove use_dynroot - M components/clm/cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods -- point to default not 40default - M components/clm/cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands -- remove -no-fire_emis - - M components/clm/src/biogeochem/CNFireBaseMod.F90 ----- add cnfire_const object - and CNFireReadNML method, put li2016 version of FireFluxes in place (can be - shared by li2014 and li2016). - M components/clm/src/biogeochem/CNFireFactoryMod.F90 -- Abort if namelist not - found, and add nofire case for fire_method. - M components/clm/src/biogeochem/CNFireLi2014Mod.F90 --- Use constants from cnfire_const - object in CNFireBaseMod, remove use_nofire option - M components/clm/src/biogeochem/CNFireLi2016Mod.F90 --- Use constants from cnfire_const - object in CNFireBaseMod, remove use_nofire option, remove CNFireFluxes - M components/clm/src/biogeochem/CNFireMethodMod.F90 --- Add CNFireReadNML_interface - M components/clm/src/biogeochem/CNMRespMod.F90 -------- abort if can't find namelist - M components/clm/src/biogeochem/CNSharedParamsMod.F90 ----- abort if can't find namelist - M components/clm/src/biogeochem/SatellitePhenologyMod.F90 - abort if can't find -namelist - M components/clm/src/biogeochem/VOCEmissionMod.F90 - M components/clm/src/biogeochem/ch4varcon.F90 ---------- abort if can't find namelist - M components/clm/src/biogeophys/CanopyHydrologyMod.F90 - abort if can't find namelist - M components/clm/src/biogeophys/CanopyStateType.F90 ---- abort if can't find namelist - M components/clm/src/biogeophys/HumanIndexMod.F90 ------ abort if can't find namelist - M components/clm/src/biogeophys/RootBiophysMod.F90 ----- abort if can't find namelist - M components/clm/src/biogeophys/SnowHydrologyMod.F90 --- abort if can't find namelist - M components/clm/src/biogeophys/SoilHydrologyType.F90 -- abort if can't find namelist - M components/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 - abort if can't find namelist - M components/clm/src/biogeophys/SoilWaterMovementMod.F90 - abort if can't find namelist - M components/clm/src/biogeophys/SurfaceResistanceMod.F90 - abort if can't find namelist - M components/clm/src/biogeophys/UrbanParamsType.F90 ------ abort if can't find namelist - M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 abort if can't find namelist - M components/clm/src/dyn_subgrid/dynpftFileMod.F90 ------- abort if can't find namelist - M components/clm/src/init_interp/initInterp.F90 ---------- abort if can't find namelist - M components/clm/src/main/clm_initializeMod.F90 ---------- Pass NL_Filename to create_cnfire_method - M components/clm/src/main/clm_varcon.F90 ----------------- Add secsphr - M components/clm/src/main/clm_varctl.F90 ----------------- Remove use_nofire - M components/clm/src/main/controlMod.F90 ----------------- Remove use_nofire, abort - if can't find namelists - M components/clm/src/main/glcBehaviorMod.F90 ------------- abort if can't find namelist - M components/clm/src/main/initVerticalMod.F90 ------------ abort if can't find namelist and abort if use_bedrock and zbedrock NOT on surface dataset - M components/clm/src/main/ndepStreamMod.F90 -------------- abort if can't find namelist - - M components/clm/src/main/restFileMod.F90 ---------------- abort if can't find namelist - - M components/clm/tools/clm4_5/mksurfdata_map/Makefile.data -- by default create crop - 1850 f45, ne30, ne120 datasets - M components/clm/tools/clm4_5/mksurfdata_map/src/mkpftMod.F90 - Lower tolerance to - relerr = 0.0001 (bug 2285) - -=============================================================== -=============================================================== -Tag name: clm4_5_8_r168 -Originator(s): Keith Oleson; brought to trunk by Bill Sacks -Date: Sat Feb 20 20:55:19 MST 2016 -One-line Summary: Fix zero methane production - -Purpose of changes ------------------- - -Methane production has been zero ever since the hydrology reordering in -clm4_5_13 (in June, 2013). The order of subroutine calls appears to be a -problem: -1. CNDriverNoLeaching is called in clm_driver, which calls SetValues, which - zeros out the carbon fluxes (e.g., somhr and lithr) -2. ch4 is called which uses the zero-ed out fluxes -3. Summary is called which sums up the soil layer som and litter heterotrophic - respiration terms which should be used by ch4, but are not. - -This tag puts the call to ch4 back where it was in clm4_5_12 and earlier. - -Keith Oleson found and fixed this bug; Bill Sacks brought it to the trunk. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2225: CH4PROD=0 -- 2287: Methane production is zero - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- Changes answers far more than you might immediately suspect; this was deemed - to be reasonable at the 02/18/2016 TSS meeting - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: Keith Oleson, Bill Sacks - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - 'ok' means: tests pass or xfail, some baseline comparisons fail as noted below - -CLM tag used for the baseline comparisons: clm4_5_7_r167 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 & CLM50 with BGC turned on - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - New climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: clm5_respn05r162_2degGSWP3_1850spin_allN_v01_ch4A_785_799 - - URL for LMWG diagnostics output used to validate new climate: - http://www.cgd.ucar.edu/tss/clm/diagnostics/clm5_dev/clm5_respn05r162_2degGSWP3_1850spin_allN_v01_ch4A_785_799-clm5_respn05r162_2degGSWP3_1850spin_allN_v01_785_799/setsIndex.html - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Move ch4 call to where it was in clm4_5_12 and earlier -M components/clm/src/main/clm_driver.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_7_r167 -Originator(s): sacks (Bill Sacks) -Date: Sat Feb 20 06:24:52 MST 2016 -One-line Summary: Fix carbon isotopes in transient runs - -Purpose of changes ------------------- - -In CNWoodProducts, code that was supposed to operate on c13 / c14 variables was -actually operating on the standard c12 variable. This led to incorrect results -and carbon balance errors if running with carbon isotopes in transient runs. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2207: bug in carbon isotopes in CNWoodProducts - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - not run - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_7_r166 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - In principle, changes answers for transient runs with carbon isotopes - enabled, but since those runs were previously crashing (due to carbon balance - errors), I am listing this as no answer changes. - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Add a long, transient test with carbon isotopes -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_monthly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_monthly - -List all existing files that have been modified, and describe the changes: - -========= Main change -M components/clm/src/biogeochem/CNWoodProductsMod.F90 - -========= Add a long, transient test with carbon isotopes -M components/clm/cime_config/testdefs/testlist_clm.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_7_r166 -Originator(s): sacks (Bill Sacks) -Date: Tue Feb 2 04:58:45 MST 2016 -One-line Summary: Infrastructure for carbon and nitrogen conservation with dynamic landunits - -Purpose of changes ------------------- - -Puts in place the infrastructure that will be used for carbon and nitrogen -conservation, and possibly other column-level conservation, with dynamic -landunits. - -This does NOT yet implement any of teh actual carbon and nitrogen conservation - -that will be done in an upcoming tag via uses of this new infrastructure. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: High-level (design) review by Erik Kluzek and Ben Andre - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_7_r165 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): - -List all files eliminated: - -List all files added and what they do: - -========= Main new code: class for adjusting column-level state variables due to - transient column areas -A components/clm/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 -A components/clm/src/dyn_subgrid/test/dynColumnStateUpdater_test/CMakeLists.txt -A components/clm/src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf -A components/clm/src/dyn_subgrid/test/dynColumnStateUpdater_test - -========= Find a template column to use for the state variables on some other - column of interest. Used by both dynColumnStateUpdater and - dynInitColumns. -A components/clm/src/dyn_subgrid/dynColumnTemplateMod.F90 -A components/clm/src/dyn_subgrid/test/dynColumnTemplate_test/test_column_template.pf -A components/clm/src/dyn_subgrid/test/dynColumnTemplate_test/CMakeLists.txt -A components/clm/src/dyn_subgrid/test/dynColumnTemplate_test - -========= Add test of get_ltype_special -A components/clm/src/unit_test_shr/test/unittestSubgrid_test/test_unittestSubgrid.pf -A components/clm/src/unit_test_shr/test/unittestSubgrid_test/CMakeLists.txt -A components/clm/src/unit_test_shr/test/unittestSubgrid_test - -List all existing files that have been modified, and describe the changes: - -========= Initialize a column state updater object, and set the old and new - weights in each time step -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Extract initial_template_col and some related code into a new class - (dynColumnTemplateMod) -M components/clm/src/dyn_subgrid/dynInitColumnsMod.F90 - -========= New function: landunit_is_special -M components/clm/src/main/landunit_varcon.F90 -M components/clm/src/main/initSubgridMod.F90 - -========= Just add a comment -M components/clm/src/dyn_subgrid/dynPriorWeightsMod.F90 - -========= Add get_ltype_special function -M components/clm/src/unit_test_shr/unittestSubgridMod.F90 - -========= Move test of extracted code to new directory -M components/clm/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf - -========= Add files for unit test build -M components/clm/src/dyn_subgrid/CMakeLists.txt -M components/clm/src/unit_test_shr/test/CMakeLists.txt -M components/clm/src/dyn_subgrid/test/CMakeLists.txt - -=============================================================== -=============================================================== -Tag name: clm4_5_7_r165 -Originator(s): sacks (Bill Sacks) -Date: Fri Jan 29 05:28:46 MST 2016 -One-line Summary: Remove fglcmask, recreate all surface datasets - -Purpose of changes ------------------- - -Remove fglcmask input file. This specified the area where we need virtual -glacier elevation classes for coupling to CISM. There were two main problems -with this: - -- There was a separate file for each CLM resolution at which we can couple to - CISM - currently this is just f09, f19, T31. There was no easy way to generate - these files for all CLM resolutions - which is something that is needed in - order to turn GLC on by default in all CESM runs. - -- This did not provide the flexibility needed to treat three regions - differently: Greenland (virtual columns), Antarctica (multiple elevation - classes, but no virtual columns), and mountain glaciers (single elevation - class). - -This tag removes the fglcmask file, replacing it with an integer-valued -GLACIER_REGION field on the surface dataset, together with a -glacier_region_behavior namelist option. - -I have generated all new surface datasets. In addition to adding the -GLACIER_REGION field, these: -- add zbedrock (most out-of-the-box surface datasets did not yet have this - field) -- remove unused TOPO field - -There are also new initial conditions files, simply for the sake of updating the -surface_dataset metadata. - -Also changed mksurfdata_map's Makefile.data and perl script (including adding a --no_surfdata flag) so that the necessary out-of-the-box surface datasets are all -created correctly (with correct names). Also did some other cleanup of -mksurfdata.pl. - -Also removed kludgey Greenland and Antarctica areas from history file, which -weren't being used. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - - - New surface datasets have zbedrock, in contrast to many old datasets. This - means that runs with use_bedrock = .true. will actually use bedrock now, - changing answers - - - For any run with glc_mec (compsets with CISM): will need to run initial - conditions through init_interp - - - For any initial conditions file of your own that was generated from an - earlier CLM tag (i.e., not an out-of-the-box initial conditions file): will - need to set check_finidat_fsurdat_consistency to .false., because surface - datasets have changed - - - 1/8 deg surface dataset hasn't been updated, so won't work with this tag - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - - - New namelist variable: glacier_region_behavior - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): - - - all new surface datasets; these are the same as before, but have: - - GLACIER_REGION added - - TOPO removed - - zbedrock added (wasn't yet on most default surface datasets) - - - new initial conditions files: just updated surface_dataset metadata to - point to new surface datasets - -Substantial timing or memory changes: NONE - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - pass - 010 blg54 failed due to problems / differences in the baseline; when I - fixed those, it passed - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - ok means: all tests pass or xfail. Baseline comparisons fail for IG tests - and ERS_D_Ld3.f10_f10.ICRUCLM50BGC.yellowstone_intel.clm-deepsoil_bedrock, - as noted below. - -CLM tag used for the baseline comparisons: clm4_5_7_r164 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - configurations with glc_mec (compsets with CISM) - - configurations with use_bedrock = .true. for which zbedrock wasn't - previously on the surface dataset - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; not investigated closely - - - The answer changes in glc_mec runs are due to small changes in the set of - grid cells in the single_at_atm_topo zone. I confirmed that, if I use a - kludged-in GLACIER_REGION field that exactly matches the old fglcmask, then - answers are bit-for-bit. - - The answer changes in use_bedrock configurations are presumably due to - zbedrock being on the surface datasets now. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): No updates -to top-level externals; updated PTCLM to allow build on pronghorn (same as -yellowstone / caldera) - -List all files eliminated: - -========= Mostly-unrelated change: remove unused fields from history file (these - specified Greenland and Antarctica areas in a kludgey way) -D components/clm/src/main/glcDiagnosticsMod.F90 - -========= Renamed to be consistent with new naming convention -D components/clm/tools/clm4_5/mksurfdata_map/landuse_timeseries_hist_simyr1850-2005.txt - -List all files added and what they do: - -========= Add GLACIER_REGION field to surface dataset -A components/clm/tools/clm4_5/mksurfdata_map/src/mkglacierregionMod.F90 - -========= Renamed to be consistent with new naming convention -A components/clm/tools/clm4_5/mksurfdata_map/landuse_timeseries_hist_16pfts_simyr1850-2005.txt - - -List all existing files that have been modified, and describe the changes: - -========= Remove glcmask. Instead make glcBehavior based on GLACIER_REGION on - the surface dataset -M components/clm/src/utils/domainMod.F90 -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/test/glcBehavior_test/test_glcBehavior.pf -M components/clm/src/main/glc2lndMod.F90 -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/surfrdMod.F90 -M components/clm/src/main/clm_instMod.F90 -M components/clm/src/main/glcBehaviorMod.F90 -M components/clm/src/main/clm_initializeMod.F90 - -========= Add GLACIER_REGION to surface datasets. Point to all new surface - datasets. Also new initial conditions files - identical to old ones - except for surface_dataset metadata. Also, remove fglcmask namelist - option and add glacier_region_behavior namelist option. -M components/clm/tools/clm4_5/mksurfdata_map/mksurfdata_map.namelist -M components/clm/tools/clm4_5/mksurfdata_map/README -M components/clm/tools/clm4_5/mksurfdata_map/README.developers -M components/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 -M components/clm/tools/clm4_5/mksurfdata_map/src/README.unit_testing -M components/clm/tools/clm4_5/mksurfdata_map/src/Srcfiles -M components/clm/tools/clm4_5/mksurfdata_map/src/mkvarctl.F90 -M components/clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 -M components/clm/tools/clm4_5/mksurfdata_map/unit_testers/Srcfiles -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/namelist_files/checkmapfiles.ncl -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm -M components/clm/doc/UsersGuide/tools.xml -M components/clm/doc/UsersGuide/adding_files.xml - -========= Make new routine for printing diagnostics of index fields -M components/clm/tools/clm4_5/mksurfdata_map/src/mkdiagnosticsMod.F90 -M components/clm/tools/clm4_5/mksurfdata_map/src/mkagfirepkmonthMod.F90 -M components/clm/tools/clm4_5/mksurfdata_map/src/mkurbanparMod.F90 - -========= Fix makefile-based creation of surface datasets so that 'make all' - gives correctly-named datasets for all needed out-of-the-box surface - datasets -M components/clm/tools/clm4_5/mksurfdata_map/Makefile.data -M components/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - -========= Point to new PTCLM: allow testing on pronghorn (same as yellowstone) -M components/clm/tools/SVN_EXTERNAL_DIRECTORIES - -========= Add tests to xfail list. These all failed in clm4_5_7_r164 except for these new failures: - + RUN ERS_Ly3.f10_f10.I1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KSinkMOut - + RUN SMS_D_Lm1_Mmpi-serial.CLM_USRDAT.I1PTCLM45.yellowstone_pgi.clm-USUMB -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_7_r164 -Originator(s): erik (Erik Kluzek) -Date: Tue Jan 12 00:51:25 MST 2016 -One-line Summary: Update CIME and MOSART - -Purpose of changes ------------------- - -Update CLM to a robust version of CIME and PIO2 (used in the cesm1_5_beta04 tag). -Also fix an issue in MOSART that changes answers (qgwl_volume must be multiplied -by area). - -Note, that this version of CIME removes the archive.locked directory. - -Change the rearranger that PIO uses from being hardcoded to using the one -picked with the env_run.xml variable LND_PIO_REARRANGER (both clm40 and clm45). -By default, as before the rearranger for clm40 is the new SUBSET option, and -for clm45/clm50 it's the old BOX method, eventually we expect both to use -the SUBSET method by default. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - 2265 Workaround for pio_syncfile issue - 2257 Unit tests fail - 2256 Issues with early versions of PIO2 - -Bugs found recently: - 2264 Fire is missing accounting of C/N for transfer of live to dead - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - This version of CIME now creates cimeteststatus instead of cs.status when create_test used - (use the summary option to cimeteststatus "-s"!) - Remove the archive.locked functionality and the creation of the associated hardlinks - Removed the option DOUT_S_SAVE_DATES_RESTART_FILE_SET - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): pio rearranger - set the rearranger for PIO to use by the env_run variable LND_PIO_REARRANGER - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: PIO2 should have better performance - and it allows two options for the rearranger to use (BOX and SUBSET). - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: regular - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - OK (all PASS except irrigation test with known issue) - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - OK (only one expected FAIL) - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -OK means tests pass except those in the ExpectedFail list file - -CLM tag used for the baseline comparisons: clm4_5_7_r163 - -Answer changes --------------- - -Changes answers relative to baseline: only if MOSART used - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: with mosart - - what platforms/compilers: all - - nature of change: fixes bug where area wasn't multiplied in - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): cime, mosart - cime to cime4.3.9 - mosart to mosart1_0_15 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M components/clm/src/README.unit_testing -- Add note about how to delete previous build - - M components/clm/src/init_interp/initInterp.F90 -- workaround for bug in PIO where you can't - do two writes in a row. - M components/clm/src/main/ncdio_pio.F90.in -- Take out specifier for rearranger - so will use the setting from LND_PIO_REARRANGER (was hardcoded to BOX) - - M components/clm/src_clm40/main/ncdio_pio.F90.in - so will use the setting from LND_PIO_REARRANGER (was hardcoded to SUBSET) - - M components/clm/cime_config/config_component.xml -------- Set LND_PIO_REARRANGER - to BOX for clm45/clm50 and to SUBSET for clm40 - M components/clm/cime_config/testdefs/testlist_clm.xml --- change goldbach tests for - prealpha/prebeta to hobart - M components/clm/cime_config/testdefs/testmods_dirs/clm/40default/shell_commands - M components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/shell_commands - M components/clm/cime_config/testdefs/testmods_dirs/clm/default/shell_commands - M components/clm/cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands - - -=============================================================== -=============================================================== -Tag name: clm4_5_7_r163 -Originator(s): sacks (Bill Sacks) -Date: Wed Dec 23 20:31:22 MST 2015 -One-line Summary: Improve crop performance by allocating less memory - -Purpose of changes ------------------- - -Performance of crop runs was being significantly impacted by the fact that we -allocate memory for any crop column that might ever need to come into existence -with dynamic landunits. Most CLM code should not run over 0-weight points, so -this likely reflects problems in memory/cache efficiency. - -This tag changes that behavior, so that for non-transient runs, we only allocate -memory for the crops that actually exist in that run (i.e., have non-zero -area). For transient crop runs, the behavior is currently the same as before. - -Note that this means you need to run init_interp when transitioning from a -non-transient crop run to a transient crop run, or vice versa. - -For an f09 run without i/o (20-day run with compset -1850_DATM%QIA_CLM50%BGC-CROP_SICE_SOCN_RTM_SGLC_SWAV), this resulted in: - -- number of columns reduced from 674,634 to 277,728 - -- number of patches reduced from 968,284 to 571,378 - -- throughput increased from 3.821 seconds/mday to 2.404 seconds/mday - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - -- need to run old crop initial conditions through init_interp (already done for - out-of-the-box finidat files) - -- from now on, need to run init_interp when transitioning from a non-transient - crop run to a transient crop run, or vice versa - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): new finidat -files for crop: same as old, but run through init_interp - -Substantial timing or memory changes: substantial improvement in both timing and -memory for crop cases - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - irrigation test fails, as in r162 - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - NOTE: On yellowstone, I tested with a cime version that had a one-off from - cime4.3.1: changes to cprnc. This was done so that cprnc would indicate - which tests had differences in dimension sizes in the h1 history files. - - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - 'ok' means tests pass, baseline comparisons fail for some diagnostic fields - for crop cases, as described below - - Also, this test failed the baseline comparison due to a problem in the - baseline: - ERS_D_Ld5.f10_f10.IMCRUCLM50BGC.yellowstone_intel.clm-default - - Some r162 baselines were missing on hobart; I reran these tests and verified - that baseline comparisons passed. - -CLM tag used for the baseline comparisons: clm4_5_7_r162 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 with crop - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Changes in diagnostic fields only - - Changes are in: - - (1) PCT_CFT in grid cells that have 0% crop - - (2) dimension sizes differ for history files with dov2xy = .false. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/main/initGridCellsMod.F90 -M components/clm/src/main/subgridMod.F90 - -========= Initialize dynSubgridControl earlier in initialization. This is needed - because it now needs to be initialized before we set up the subgrid - stuff / bounds. -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 -M components/clm/src/main/clm_initializeMod.F90 - -========= Add more informative message if it looks like use_init_interp is needed -M components/clm/src/main/restFileMod.F90 -M components/clm/src/main/ncdio_pio.F90.in - -========= Point to new finidat files for crop, which have been run through init_interp -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_clm - -========= Minor tweak: remove explicit reference to init_interp, to make it - easier to search the ChangeLog for true references to init_interp -M .ChangeLog_template - -=============================================================== -=============================================================== -Tag name: clm4_5_7_r162 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri Dec 18 15:59:23 MST 2015 -One-line Summary: negative runoff updates. - -Purpose of changes ------------------- - -Remove direct to ocean runoff from coupler fields. Negative runoff is -now handled by mosart. Only limit irrigation if volume is below the -threshold instead of lake evaporation and irrigation. - - -Bugs fixed or introduced ------------------------- - -unknown - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): Not well tested after some last minute changes. Not recommended for use. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - limit_lake_evap_and_irrig phys changed to limit_irrigation - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: unknown - - -Code reviews and testing ------------------------- - -Code reviewed by: swenson - -CLM testing: minimal - - build-namelist tests - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - irrigation test fails - - tools-tests (components/clm/test/tools): - - yellowstone - n/a not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - clm50 kitchen sink looks ok - yellowstone_pgi - not run prior to tag - yellowstone_gnu (clm45 only) - not run prior to tag - hobart_nag - not run prior to tag - - prior testing of branch indicated that it was bit for bit with the - exception of coupler and histroy fields related to runoff: - - TWS - VOLR - VOLRMCH - l2x_Flrl_rofgwl - l2x_Flrl_rofdto - x2l_Flrr_volr - x2l_Flrr_volrmch - r2x_Forr_rofl - r2x_Flrr_volr - r2x_Flrr_volrmch - x2r_Flrl_rofgwl - x2r_Flrl_rofdto - - several last minute changes were made and testing was not rerun - before making the tag. No significant problems are expected, but... - -CLM tag used for the baseline comparisons: clm4_5_6_r161 - - -Answer changes --------------- - -Changes answers relative to baseline: yes, only in clm and coupler runoff fields listed above. - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? none - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): rtm1_0_55, mosart1_0_12 - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - change name of limit_irrigation namelist item - clm/bld/CLMBuildNamelist.pm - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw/user_nl_clm - clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - clm/src/biogeophys/test/Irrigation_test/IrrigationWrapperMod.F90 - - change negative runoff - clm/src/main/lnd2atmType.F90 - clm/src/main/controlMod.F90 - clm/src/main/clm_varctl.F90 - clm/src/main/lnd2atmMod.F90 - clm/src/biogeophys/WaterfluxType.F90 - clm/src/biogeophys/LakeFluxesMod.F90 - clm/src/biogeophys/HydrologyDrainageMod.F90 - clm/src/biogeophys/BandDiagonalMod.F90 - clm/src/biogeophys/IrrigationMod.F90 - clm/src/cpl/clm_cpl_indices.F90 - clm/src/cpl/lnd_import_export.F90 - - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r161 -Originator(s): sacks (Bill Sacks) -Date: Thu Dec 17 14:04:29 MST 2015 -One-line Summary: Collapse mountain glaciers to a single elevation class - -Purpose of changes ------------------- - -Mountain glaciers (i.e., glaciers outside of Greenland and Antarctica) have been -problematic when running with glc_mec, because of the adjustments made to the -atmospheric forcings (downscaling to columns). Mountain glaciers generally sit -above the atmospheric forcing height, so this downscaling leads to discrepancies -between the atmospheric forcings and what CLM sees, on the gridcell mean. This -same problem can exist over ice sheets, but it can be more pronounced in -mountain regions because of the steep topography. Furthermore, because no -downscaling is done over the vegetated portion of the grid cell: Even if CLM's -mean grid cell elevation agreed exactly with the atmosphere's topographic -height, there would still be a discrepancy after downscaling, because the -glaciers would see a cooler climate, whereas the rest of the grid cell would see -exactly the climate sent by the atmosphere. - -Mountain glaciers are not currently a focus of the Land Ice Working Group -(LIWG), and surface mass balance is known to have significant problems in -mountain glacier regions. Therefore, because of the above atm-lnd discrepancy, -the LIWG (especially Bill Lipscomb and Jeremy Fyke) decided it would be best to -have only a single glacier elevation class in mountain glacier regions (outside -of Greenland and Antarctica), whose elevation exactly matches the atmosphere's -topographic height. Note that this match of the atmopshere's topographic height -is the same as what is done (implicitly) in all other landunits - resulting in -no adjustment to the atmospheric forcings. - -This tag implements the collapse of mountain glaciers to a single elevation -class, whose topographic height matches the atmosphere's topographic height. It -allows for the possibility that the atmosphere's topographic height could change -in time - in which case the glacier's topographic height (and potentially its -elevation class index) will change in time to follow the atmosphere. - -In addition, this tag puts in place infrastructure to make it easier to define -different glacier regions that receive different treatments (whether virtual -columns are enabled, and whether glacier should be collapsed to a single -elevation class). The "frontend" user interface for this will be added in an -upcoming tag. - -Currently, the definition of the "mountain glacier" region is done so that it -includes everything except the region defined by fglcmask and the region south -of 60 deg S (assumed to be Antarctica). Soon the setting of this region will be -made more robust and more easily user-definable. - -Finally, this tag adds infrastructure to aid in creating and using local -column-level filters. Eventually, this could be extended to cover all of CLM's -filters. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): -- For runs with glc_mec (IG, FG, BG), need to run initial conditions through - init_interp, because there are now slightly fewer glc_mec columns. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- just changed finidat for glcMEC_spunup_1way testmod - -Substantial timing or memory changes: -- small decrease in memory for glc_mec runs, due to a decrease in the number of - columns - - -Code reviews and testing ------------------------- - -Code reviewed by: self; review by others will come later - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - pass - - 'ok' means: tests pass except for baseline comparison failures for IG tests, - as noted below - -CLM tag used for the baseline comparisons: clm4_5_6_r160 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM50 with glc_mec (IG, FG, BG) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - not investigated closely, but expected to give new climate, at least regionally - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - Verified that changes came just from collapsing mountain glaciers to a single - elevation class, by running the affected tests with this change in - glcBehaviorMod: - -- logical, parameter :: collapse_mountain_glaciers = .true. -+ logical, parameter :: collapse_mountain_glaciers = .false. - - -- these tests were bit-for-bit with the trunk, as expected. - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Main addition in this tag. This module determines a number of aspects - of the behavior of glacier_mec classes in each grid cell. -A components/clm/src/main/glcBehaviorMod.F90 - -========= Unit tests of glcBehaviorMod -A components/clm/src/main/test/glcBehavior_test/CMakeLists.txt -A components/clm/src/main/test/glcBehavior_test/test_glcBehavior.pf -A components/clm/src/main/test/glcBehavior_test - -========= Supports creation and use of local column-level filters. Eventually we - may want to consider moving all filters to using infrastructure like - this. -A components/clm/src/main/filterColMod.F90 - -========= Unit tests of filterColMod -A components/clm/src/main/test/filter_test/CMakeLists.txt -A components/clm/src/main/test/filter_test/test_filter_col.pf -A components/clm/src/main/test/filter_test - -========= Stub of module in driver_cpl/shr (needed by glc_elevclass_mod.F90) -A components/clm/src/unit_test_stubs/csm_share/seq_comm_mct.F90 - -========= Minor changes needed to support unit tests - -List all existing files that have been modified, and describe the changes: - -========= Delegate glc_mec-related logic to glcBehaviorMod: this logic is now - complex, and tied in with various aspects of glcBehaviorMod; also, - delegating the logic to glcBehaviorMod allows us to reduce duplication - between initGridCellsMod and subgridMod. Also split the monster - routine in subgridMod (which had a bunch of optional arguments) into - small routines with well-defined interfaces. -M components/clm/src/main/subgridMod.F90 -M components/clm/src/main/initGridCellsMod.F90 - - also, put setting of ice_mec landunits in a separate routine, thus - cleaning up set_landunit_wet_ice_lake; and remove no-longer-used - setdata argument - - -========= Use glc_behavior instead of glcmask -M components/clm/src/main/glc2lndMod.F90 - - also call glc_behavior%update_collapsed_columns -M components/clm/src/main/subgridWeightsMod.F90 - -========= Track whether a column's type is dynamic -M components/clm/src/main/ColumnType.F90 -M components/clm/src/main/initSubgridMod.F90 - -========= Update glc classes upon restart; also separate read and write routines - (which now have different required arguments) -M components/clm/src/main/subgridRestMod.F90 - -========= Declare and initialize glc_behavior, and pass it where needed -M components/clm/src/main/clm_instMod.F90 -M components/clm/src/main/clm_initializeMod.F90 - -========= Pass newly-needed arguments -M components/clm/src/main/clm_driver.F90 -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M components/clm/src/main/decompInitMod.F90 -M components/clm/src/main/restFileMod.F90 -M components/clm/src/main/reweightMod.F90 - -========= Make sure glcmask is always initialized to 0 -M components/clm/src/main/surfrdMod.F90 - -========= Add new history field -M components/clm/src/main/atm2lndType.F90 - -========= For unit tests: add glc_elevclass_mod.F90 from driver_cpl/shr -M components/clm/src/CMakeLists.txt - -========= Minor changes needed to support unit tests -M components/clm/src/unit_test_stubs/csm_share/CMakeLists.txt -M components/clm/src/unit_test_shr/unittestArrayMod.F90 -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 -M components/clm/src/main/CMakeLists.txt -M components/clm/src/main/test/CMakeLists.txt - -========= Remove some costly CLM4 tests -M components/clm/cime_config/testdefs/testlist_clm.xml -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -========= Point to new initial conditions file, init_interp'ed from the old one -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r160 -Originator(s): sacks (Bill Sacks) -Date: Fri Dec 11 10:51:21 MST 2015 -One-line Summary: For glc_mec, get gridcell topographic height from atm - -Purpose of changes ------------------- - -Runs with glc_mec require knowledge of the atmosphere's topographic height. Up -until now, this was specified via the flndtopo file for the three resolutions -that glc_mec can run at: f09, f19, T31. However, this has three problems: - -(1) It made it hard to extend glc_mec to run at other CLM resolutions - -(2) If CAM's topographic height changes (as it did recently), CLM would need to - have its flndtopo files updated to agree. - -(3) It assumes that datm's forcing heights match CAM's. - -In this tag, flndtopo has been removed, and CLM now gets the atmosphere's -topographic height from the atmosphere, via the coupler. References to flndtopo -/ ldomain%topo have been replaced with atm2lnd_inst%forc_topo_grc. - -For now, datm is set up to provide a topographic height that matches the old f09 -file - so offline (I compset) runs at f09 will be the same as before. But this -will soon change. - -Also removed fatmtopo, which was in the code in a few places but was no longer -being used. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- removed flndtopo file for CLM45/CLM5 - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): -- removed flndtopo file for CLM45/CLM5 - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - pass (both sets of tests) - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - pass - - 'ok' means pass except baseline comparison failures for IG tests, as noted - below - - Note that most hobart_nag tests are now in the expected fail list. The only - passing tests on hobart_nag are: - - SMS_D_Ld1_P24x1.f10_f10.ICRUCLM45.hobart_nag.clm-af_bias_v5 - SMS_Ld1_Mmpi-serial.f45_f45.ICLM45.hobart_nag.clm-ptsRLA - SMS_D_Ld1_Mmpi-serial.1x1_vancouverCAN.I1PTCLM50.hobart_nag.clm-default - SMS_Ld1.f45_f45.ICLM45.hobart_nag.clm-ptsRLA - SMS_D_Ld1_Mmpi-serial.1x1_vancouverCAN.I1PTCLM45.hobart_nag.clm-default - SMS_D_Ld1_P24x1.f10_f10.ICLM45BGC.hobart_nag.clm-oldhyd - ERS_D_Ld5_Mmpi-serial.1x1_mexicocityMEX.I1PTCLM45.hobart_nag.clm-default - SMS_D_Ld1_Mmpi-serial.f45_f45.ICLM45.hobart_nag.clm-ptsRLA - ERP_Ly5.1x1_numaIA.ICLM45BGCCROP.hobart_nag.clm-monthly - SMS_Ld1.1x1_mexicocityMEX.I1PT.hobart_nag.clm-40default - SMS_Ld5_P24x1.f10_f10.IRCP26CN.hobart_nag.clm-reduceOutput - SMS_D_Ld1.1x1_mexicocityMEX.I.hobart_nag - -CLM tag used for the baseline comparisons: clm4_5_6_r159 - compared - ERS_Ly3.f10_f10.I1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KSinkMOut - against baselines in directory clm4_5_r159 - - -Answer changes --------------- - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45/CLM5 with glc_mec (IG, FG, BG) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Potentially new climate. Magnitude of change depends on how different - atm's topography is from the flndtopo file that had been used before. - - For now, offline (IG) runs at f09 are the same as before, but all other - offline runs change. Runs coupled to CAM may be the same (or close to the - same), if CAM is using its old topography files, but will change for the - new CAM topography. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml -M components/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/doc/UsersGuide/preface.xml -M components/clm/doc/UsersGuide/adding_files.xml -M components/clm/doc/UsersGuide/single_point.xml -M components/clm/src/cpl/clm_cpl_indices.F90 -M components/clm/src/cpl/lnd_import_export.F90 -M components/clm/src/utils/domainMod.F90 -M components/clm/src/main/clm_initializeMod.F90 -M components/clm/src/main/atm2lndType.F90 -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/surfrdMod.F90 - -========= Remove topo field that is defined but never set -M components/clm/src/main/histFileMod.F90 - -========= Add test to expected fail list; it seemed to pass for Erik, but fails - for me even out of a fresh checkout of clm4_5_6_r159: - ERP_Ly5.1x1_numaIA.ICRUCLM50BGCCROP.hobart_nag.clm-clm50BGCCROPmonthly -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r159 -Originator(s): erik (Erik Kluzek) -Date: Thu Dec 10 15:46:47 MST 2015 -One-line Summary: Update CIME version - -Purpose of changes ------------------- - -Update to very latest version of CIME, which we had held off doing -for two months. The main user change is that CIME no longer names -scripts with your CASENAME. - -This CIME version also updated PIO1 to PIO2 (pio2_0_27). These -early versions of PIO2 do have issues with potential hangs. See -bug 2256 below. As such we do not recommend use of this tag. Or -if you do and run into problems, do the workaround in the bug -report to move the PIO version to pio1_9_23. The behavior is that -after the simulation finishes it times out when writing history and -restart files. mpi-serial (single point) cases seem to work fine. - -Also fix two minor bugs. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): - - 2251 Bad NH max planting date of 6/31 - 2250 History filenames get truncated to 128 characters - -Bugs Introduced (include bugzilla ID): - - 2257 Unit tests fail in clm4_5_6_r159 - 2256 Problems with early versions of PIO2 in CLM - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users: CASE SCRIPTS NO LONGER NAMED $CASE.build, $CASE.run, $CASE.submit - - After ./create_newcase is run you have the scripts named: - ./case.build - ./case.run - ./case.submit - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New params file - -Substantial timing or memory changes: None - - -Code reviews and testing ------------------------- - -Code reviewed by: self, fvitt - -CLM testing: regular - - build-namelist tests: - - yellowstone - PASS - - (several comparision tests to clm4_5_6_r158 FAIL because of the new params - file) - - unit-tests (components/clm/src): - - yellowstone - FAIL - - tools-tests (components/clm/test/tools): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - - OK means failures are in the ExpectedFails list - -CLM tag used for the baseline comparisons: clm4_5_6_r158 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes (but just for two diagnostic cpl fields) - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change: diagnostic change - -atm topo field -For drydep TERPOOH (dd034) is different because of an update by Francis Vitt - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): cime to cime4.3.1 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - Increase max filename length from 128 to 199. -M components/clm/src/main/ncdio_pio.F90.in -- increase tmp_string to 199 -M components/clm/src/main/histFileMod.F90 --- max length filename - and max_chars to 199 and dimension locfnhr by max_length_filename - -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- new params file - change 631 max planting date for NH to 701 - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r158 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri Dec 4 16:10:11 MST 2015 -One-line Summary: misc clm 5.0 bugfixes - -Purpose of changes ------------------- - -Misc. bugfixes for CLM 5.0 - - * LUNA bugfix to endrun if simulation goes out of range. - - * Restore ability to run SP simulations on nag. - - * String length bugfix from Jim Edwards. - - * New long clm50 kitchen sink test. - - * endrun if history filenames exceed maximum allowed length. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2209, 2213 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): - - CLM will now endrun if the generated history filename exceeds the - maximum allowed length. This will result in run time failures for - people running the test suite with the default or longer test ids. - - CLM 5.0 with LUNA will now endrun if nitrogen computations go - outside a valid range. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: unknown, none expected - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40 - pass; 45 - ok - yellowstone_pgi - 40 - pass; 45 - pass - yellowstone_gnu (clm45 only) - 45 - pass - hobart_nag - ok - -CLM tag used for the baseline comparisons: clm4_5_6_r157 - - Notes: 'ok' means: - - * Fixing bug 2213 restores tests an hobart_nag. These tests BFAIL - because they don't have baselines. - - * r157 yellowstone baseline does not include clm history files for - two tests because of filename length issues: - - ERS_D_Ld3.f09_g16_gl5.IG1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KitchenSink - ERP_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-clm50BGCDVCROPmonthly - - * New test does not have baseline: - - ERS_Ly3.f10_f10.I1850CRUCLM50BGCCROP.yellowstone_intel.clm-clm50KSinkMOut - - -Answer changes --------------- - -Changes answers relative to baseline: bit for bit - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - new clm50 kitchen sink test with monthly output - clm/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/user_nl_clm - clm/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut/include_user_mods - clm/cime_config/testdefs/testmods_dirs/clm/clm50KSinkMOut - -List all existing files that have been modified, and describe the changes: - - new clm50 compset w/o glc and test for longer kitchen sink test - clm/cime_config/config_compsets.xml - clm/cime_config/testdefs/testlist_clm.xml - - string length bugfix from Jim Edwards - clm/src/biogeochem/FireEmisFactorsMod.F90 - - runtime error if constructed history filename exceeds max length - clm/src/main/histFileMod.F90 - - bug 2209 - clm/src/biogeophys/LunaMod.F90 - runtime error if LUNA nitrogen computations become unrealistic - - bug 2213 - clm/src/biogeophys/PhotosynthesisMod.F90 - remove association of CN variable that may not be allocated for SP runs. - clm/src/biogeophys/CanopyFluxesMod.F90 - remove association of CN variable that may not be allocated for SP runs. - clm/cime_config/testdefs/ExpectedTestFails.xml - remove nag tests from xfails. - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r157 -Originator(s): sacks (Bill Sacks) -Date: Fri Nov 27 05:52:17 MST 2015 -One-line Summary: Reduce memory use for init_interp - -Purpose of changes ------------------- - -For high-resolution source files (e.g., f09 or higher), the new multilevel -interpolation was using unacceptable amounts of memory, since it was reading all -source points at all levels into memory at once - both for the actual data to -interpolate, and for the metadata used in the multilevel interpolators. - -This tag reworks how 2-d interpolation is done so that only one level from the -source is needed in memory at a time, thus greatly reducing memory use in some -cases. - -In making this change, I extracted routines to do 1-d interpolation. In doing -so, I made some minor changes to their behavior for consistency. The main change -was to remove special handling of inactive points: Inactive points used to have -their values set to spval, and I have now removed that logic, keeping inactive -points at their values before interpolation. This results in some NaNs appearing -in finidat_interp_dest (if values were NaN before interpolation); before spval -was put in all inactive points. - -Also, some unrelated changes: - -- Remove a duplicate and unused entry in config_component.xml (found by Jim - Edwards) - -- Remove redundant settings in CNZero (found by Dave Lawrence) - -- Fix cray compilation problems (found by Jim Edwards) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: -- Big memory decrease in some cases when using init_interp - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - -CLM tag used for the baseline comparisons: clm4_5_6_r156 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Extract interpolation routines so they can be called from a few - places. Note that I have changed the behavior slightly, in ways that - affect the produced restart file, but not a CLM run done with this - restart file. In particular, inactive points are no longer set to - spval. -A components/clm/src/init_interp/initInterp1dData.F90 - - -List all existing files that have been modified, and describe the changes: - -========= Rework multi-level interpolation in order to reduce memory use -M components/clm/src/init_interp/initInterp2dvar.F90.in -M components/clm/src/init_interp/initInterpMultilevelInterp.F90 -M components/clm/src/init_interp/initInterpMultilevelContainer.F90 -M components/clm/src/init_interp/initInterpMultilevelSnow.F90 -M components/clm/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_split.pf -M components/clm/src/init_interp/test/initInterpMultilevel_test/initInterpMultilevelMock.pf -M components/clm/src/init_interp/test/initInterpMultilevel_test/multilevel_interp_factory.F90 -M components/clm/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf -M components/clm/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_snow.pf -M components/clm/src/init_interp/initInterpMultilevelBase.F90 -M components/clm/src/init_interp/initInterpMultilevelCopy.F90 -M components/clm/src/init_interp/initInterpMultilevelSplit.F90 -M components/clm/src/init_interp/initInterp.F90 - -========= Unrelated change: remove an entry that duplicates an entry in the - driver's config_component, and is unused here -M components/clm/cime_config/config_component.xml - -========= Unrelated change: remove redundant settings in CNZero -M components/clm/src/biogeochem/CNDriverMod.F90 - -========= Unrelated change: add helpful tip to output message -M components/clm/src/init_interp/initInterpMindist.F90 - -========= Unrelated change: add a comment -M components/clm/src/main/clm_varcon.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r156 -Originator(s): sacks (Bill Sacks) -Date: Tue Nov 24 10:19:07 MST 2015 -One-line Summary: Fix QSNWCPICE and glacial inception - -Purpose of changes ------------------- - -Previously, qflx_snwcp_ice_col (output to history file as QSNWCPICE) had served -two purposes: (1) the snow capping flux, which is used to specify surface mass -balance to GLC; and (2) the ice runoff flux, sent to ROF. However, these two -uses are not identical, which resulted in a number of problems. - -This tag separates these uses, so that qflx_snwcp_ice_col truly gives the snow -capping flux, and the ice runoff flux is derived separately (via two new -variables: qflx_ice_runoff_snwcp_col and qflx_ice_runoff_xs_col). - -This changes serves the following purposes: - -(1) QSNWCPICE becomes a useful history field, actually giving the amount of snow capping - -(2) Fixes snow balance check: bug 2238 - -(3) Fixes a problem where xs1 could initiate glacial inception, by contributing to qflx_glcice_frz - -(4) simplifies some logic in BalanceCheckMod - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): -- 2238: Possible bug involving qflx_snwcp_ice in BalanceCheckMod.F90 - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - QSNWCPICE_TO_COUPLER history field renamed to QRUNOFF_ICE_TO_COUPLER - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: Leo van Kampenhout - -CLM testing: - - NOTE: most testing done on r75327 (prior to the workaround for the intel - compiler bug); after that, just ran: - ERP_Lm40.1x1_numaIA.ICRUCLM50BGCCROP.yellowstone_gnu.clm-clm50BGCCROPmonthly - (previously-failing test) - ERI_D_Ld9_P24x1.f10_f10.ICRUCLM50BGC.hobart_nag.clm-reduceOutput - (to run one nag test with the change) - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - 'ok' means tests pass, baseline comparisons fail as noted below - - Also BFAILs for: - BFAIL SMS_Ld5_D_P24x1.f10_f10.IHISTCLM45BGC.hobart_nag.clm-clm50BGCmonthly.GC.1123-1949.45.n.nlcomp - BFAIL ERP_Ly5.1x1_numaIA.ICRUCLM50BGCCROP.hobart_nag.clm-clm50BGCCROPmonthly.GC.1123-1949.45.n.nlcomp - - And for the newly-passing: - ERP_Lm40.1x1_numaIA.ICRUCLM50BGCCROP.yellowstone_gnu.clm-clm50BGCCROPmonthly - -CLM tag used for the baseline comparisons: clm4_5_6_r155 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: diagnostic changes for all CLM45/CLM50; - significant changes for IG compsets with CLM45/CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Changes for IG compsets are potentially climate changing - - Changes in non-IG compsets are in the following three fields: - - QSNWCPICE - - ERRH2OSNO - - SNOW_SINKS (roundoff-level) - - Bigger changes in IG compsets are due to no longer including the xs1 term in - qice (SMB) sent to GLC. Of the tests in the test suite, this was just - observed for SMS_Lm37.T31_g37_gl5.IG1850CLM45.yellowstone_intel.clm-glcMEC_long. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 -M components/clm/src/biogeophys/SoilHydrologyMod.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 -M components/clm/src/main/lnd2atmType.F90 -M components/clm/src/main/lnd2atmMod.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 - - also add dtime multiplier for some log message output - -========= Unrelated change: workaround for intel compiler bug -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 - -========= Unrelated change: edit ChangeLog entry for clm4_5_6_r153 -M ChangeLog -M components/clm/doc/ChangeLog - - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r155 -Originator(s): erik (Erik Kluzek) -Date: etl xim 23 1:11:04 carra MST 2015 -One-line Summary: Bring FUN (Fixation and Uptake of Nitrogen) code option to trunk from Mingjie, - as well as latitude varying spinup from Charlie, and a fix for crop with dynamic - roots from Beth - -Purpose of changes ------------------- - -FUN Model (Fixation and Uptake of Nitrogen): Mingjie Shi, Josh Fisher, - and implmentation changes from Rosie Fisher - - FUN is the Fixation and Uptake of Nitrogen, and is designed to extract N from numerous - sources (fixation, active uptake, retranslocation) in proportion to the inverse of the - cost of uptake in term of C spent per unit N acquired. - - The FUN model developed by Fisher et al. 2010 and end Brzostek et al. 2014. Coded by Mingjie Shi 2015. - Coding logic and structure altered by Rosie Fisher. October 2015. - Critically, this removes the 'FUN-resistors' idea of Brzostek et al. 2014 - and replaces it with uptake that is proportional to the N/C exchange rate. - and adjusts the logic so that FUN does not depends upon the CLM4.0 'FPG' downregulation idea - and instead it takes C spent on N uptake away from growth. - The critical output so fthis code are sminn_to_plant_fun and npp_Nuptake, which are the N - available to the plant for growth, and the C spent on obtaining it. - - When FUN is on and flex-CN is on, do NOT do the burn off of excess Carbon. - - Add in Kyla's rainfall trigger for stress decidious when FUN is on. - - Call FUN in the middle of SoilBiogeochemCompetition. Split CNPhenology into - two sections for FUN. Get N available from N in NutrientCompetetion. Add - annual average ET needed for CNFreeLivingFixation which is used in place - of CNNFixation when FUN on. - -Dynamic Roots bug fix: Beth Drewniak - - Initialize huigrain to zero (rather than nan). And add a check for huigrain non zero - to prevent a divide by zero. - -BGC Spinup Changes: Charlie Koven - - Add a latitude dependent factor for accellerated decomposition spinup that is - about 1 at the equator goes to 26 at 60 degree's latitude (south and north) - and then about 50 at the poles. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2237 - 2237 (dynamic root code divides by 0) - -Known bugs introduced in this tag (include bugzilla ID): 2249 - 2249 Simulations have low LAI in the amazon with FUN and Luna on - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): - LAI is low in Amazon (see bug 2249) - FUN requires use_nitrif_denitrif to be on. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): new CLM namelist variables - Add br_root (maintenence respiration for roots) - And leaf_mr_vcm (Scalar of leaf respiration to vcmax) - And use_fun logical to turn the FUN model on - -Changes made to namelist defaults (e.g., changed parameter values): - For CLM50 set leaf_mr_vcm to 0.032 (from Atkin 2015) - For CLM50 with FUN on br_root=2.525e-06 - -Changes to the datasets (e.g., parameter, surface or initial files): - New params files with FUN parameters on them - -Substantial timing or memory changes: Slower with FUN - Will notices that simulations with FUN are slower - (there are optimization issues that I saw that could be worked on) - -Code reviews and testing ------------------------- - -Code reviewed by: self, rfisher, koven, drewniak - -CLM testing: - - build-namelist tests: - - yellowstone - PASS - - unit-tests (components/clm/src): - - yellowstone - PASS - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -OK, means tests PASS or only expected fails do not. -SSP comparision tests FAIL for CLM50, since spinup changes - - -CLM tag used for the baseline comparisons: clm4_5_6_r154 - - -Answer changes --------------- - -Changes answers relative to baseline: No - - Except when spinup on, or when FUN turned on. - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): None - -List all files eliminated: - -=========== Remove flexibleCN test directory and add one for flexCN and FUN -D components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN -D components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN/include_user_mods - -List all files added and what they do: - -=========== Add new tests -=========== NOTE: clm50* tests can be used with CLM45 compsets to create new CLM50 configurations -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCDVCROPmonthly/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCDVCROPmonthly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCDVCROPmonthly -A components/clm/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/flexCN_FUN -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso_flexCN_FUN -A components/clm/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/noFUN_flexCN -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCCROPmonthly/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCCROPmonthly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCCROPmonthly -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCmonthly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCmonthly/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/clm50BGCmonthly - -=========== Add unit test for AC spinup -A components/clm/src/soilbiogeochem/CMakeLists.txt -A components/clm/src/soilbiogeochem/test/CMakeLists.txt -A components/clm/src/soilbiogeochem/test/ACSpinup_test/test_acspinup.pf -A components/clm/src/soilbiogeochem/test/ACSpinup_test/CMakeLists.txt -A components/clm/src/soilbiogeochem/test/ACSpinup_test -A components/clm/src/soilbiogeochem/test - -=========== New FUN module -A components/clm/src/biogeochem/CNFUNMod.F90 - -List all existing files that have been modified, and describe the changes: - -M components/clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - Remove - fsurdat, new finidat file, turn: luna, flex-CN, dynroots, and FUN on, - for interpolation fill missing with bare ground, limit_lake_evap to false - set leaf_mr_vcm to 0.015 -M components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm - turn dynroots on - -M components/clm/bld/namelist_files/namelist_definition.xsl ------- Update to work again -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -- New params file with FUN parameters - c151024 and ED.c151023, turn dynroots off for bgc, add phys version to finidat, set use_fun - br_root, leaf_mr_vcm -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml Add br_root, leaf_mr_vcm, use_fun -M components/clm/bld/CLMBuildNamelist.pm -------------------------- Handle cnmresp_inparm, - clm_canopy_inparm, send phys for finidat -M components/clm/bld/unit_testers/build-namelist_test.pl ---------- Add tests for fun w/o CN, - or w/o nitrif_denitrif, or flexCN w/o CN - -M components/clm/cime_config/config_compsets.xml - Change IGCRUCLM50BGCCROP to IG1850CRUCLM50BGCCROP - add IG1850CRUCLM50BGC - -M components/clm/cime_config/testdefs/testlist_clm.xml ---- Add new tests (noFUN_flexCN, flexCN_FUN, - ciso_flexCN_FUN, clm50KitchenSink w/o crop, clm50BGCDVCROPmonthly, transient clm50BGC, - and new CROP-off clm50KitchenSink test add luna test on hobart, ICRUCLM50BGCCROP tests - use clm50BGCCROPmonthly test-mods (with dynroots on, so change answers) -M components/clm/cime_config/testdefs/testmods_dirs/clm/luna/user_nl_clm - Turn flexCN on -M components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm - Turn dynroot on - (so these tests change answers) - -M components/clm/src/ED/fire/SFMainMod.F90 - Comment from Rosie - -M components/clm/src/biogeophys/WaterfluxType.F90 --- Add running annual mean of ET when FUN is on -M components/clm/src/biogeophys/BalanceCheckMod.F90 - Increase tolerance for snow balance check (see bug 2238) -M components/clm/src/biogeophys/LunaMod.F90 --------- Make 0.015 constant a parameter - (later should use parameter in CanopyStateMod) -M components/clm/src/biogeophys/PhotosynthesisMod.F90 - Use leaf_mr_vcm constant from canopystate_ins - Remove (.not.use_cn) for recalculation of lmr25 when luna on, for natural C3 veg (see bug 2249) -M components/clm/src/biogeophys/CanopyStateType.F90 - Make parameter for leaf_mr_vcm, add ReadNML sub - -M components/clm/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 ---- Call FUN module -M components/clm/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 When FUN on, do not - do precision control of low values for no3 and nh4 -M components/clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 -- Increase transport by - same factor as spinup acceleration by latitude -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 ----- Add soilc_change_col -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 ---- Take into account latitude - varying spinup acceleration for exit and enter spinup states -M components/clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 ---------- Add function for increase - of spinup acceleration by latitude -M components/clm/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 --- For FUN N deposition and fixation put into NH4 - use FUN version of sminn_to_plant_fun - -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 --- Add several FUN nitrogen fixation - terms: ffix_to_sminn_col, ffix_to_sminn_col, sminn_to_plant_fun_no3_vr_col, - sminn_to_plant_fun_nh4_vr_col, sminn_to_plant_fun_vr_col -M components/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 Changes from Charlie to make - spinup acceleration higher as latitude increases. -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 -- decomp_npools_vr depends - on spinup state and depends on latitude. - -M components/clm/src/CMakeLists.txt - Add soilbiogeochem directory for unit tests - -M components/clm/src/biogeochem/CNBalanceCheckMod.F90 --------- Add cbalance warning, for FUN - add in free living fixation, decrease n-balance error from e-8 to e-6, add nbalance warn -M components/clm/src/biogeochem/CNVegStateType.F90 ------------ Init huigrain to zero, add leafcn_offset - and plantCN for FUN -M components/clm/src/biogeochem/CNMRespMod.F90 ---------------- Add CNMRespReadNML, br_root -M components/clm/src/biogeochem/CNVegNitrogenStateType.F90 ---- Add leafn_storage_xfer_acc and - storage_ndemand for FUN, change two conditionals on spinup_state/restart_spinup_state - to include 0 AND 1 -MM components/clm/src/biogeochem/CNRootDynMod.F90 -------------- Only update root_depth if huigrain>0 -M components/clm/src/biogeochem/CNPhenologyMod.F90 ------------ Add phase to CNPhenology (divides - into two parts, needed for FUN), add Kyla's rainfall trigger (ONLY when FUN on) - other changes when FUN on -M components/clm/src/biogeochem/CNCStateUpdate1Mod.F90 -------- Add carbon spent on uptake respiration -M components/clm/src/biogeochem/CNSharedParamsMod.F90 --------- Add use_fun -M components/clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 If FUN on get N available from FUN - turn off some sections when fun on -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 ----------- Changes for spinup from Charlie -M components/clm/src/biogeochem/CNNDynamicsMod.F90 ------------ Add CNFreeLivingFixation subroutine - set ndep_to_sminn to zero for FUN -M components/clm/src/biogeochem/CNVegNitrogenFluxType.F90 ----- Add N demand and aquired arrays for FUN -M components/clm/src/biogeochem/CNDriverMod.F90 --------------- If FUN on call CNFreeLivingFixation - rather than CNNFixation. If FUN on split CNPhenology into two segments -M components/clm/src/biogeochem/CNC14DecayMod.F90 ------------- Speed up radioactive decay by lat factor -M components/clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 Changes for FUN. Burning off option - not used for FUN, for FUN, growth respiration is not part of the allometry calculation -M components/clm/src/biogeochem/CNVegCarbonFluxType.F90 ------- Carbon flux fields for FUN -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 ------ Add leafc_storage_xfer_acc and - storage_cdemand for FUN, change some spinup state if statements from Charlie - -MM components/clm/src/main/clm_initializeMod.F90 - Call clm_instReadNML and waterflux_inst%initAccVar -MM components/clm/src/main/clm_varcon.F90 -------- Add fun_period and small_value for FUN -M components/clm/src/main/pftconMod.F90 --------- Add FUN pft-varying parameters -M components/clm/src/main/clm_instMod.F90 ------- Add clm_instReadNML for namelists, calls - canopystate_inst%ReadNML, add waterflux_inst%InitAccBuffer -M components/clm/src/main/readParamsMod.F90 ----- Add readCNFUNParams -MM components/clm/src/main/controlMod.F90 -------- Set use_fun and call CNMRespReadNML -M components/clm/src/main/clm_driver.F90 -------- Call waterflux_inst%UpdateAccVars - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r154 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Wed Nov 18 16:35:53 MST 2015 -One-line Summary: one year grain product pool - -Purpose of changes ------------------- - - Introduce logic to have the harvested grain products decay over the - course of one year. This is distinct from previous versions, in - which the grain products decayed immediately. Including the one-year - decay time changes soil carbon and nitrogen pools, and is on by - default in the CLM5 crop model. (Danica Lombardozzi, Dave Lawrence) - - Add temporary test for all the clm50 functionality being used in the - preliminary cesm2 coupled run: - - ERS_D_Ld3.f09_g16_gl5.IGCRUCLM50BGCCROP.yellowstone_intel.clm-clm50KitchenSink - - Note: Because of the brittle situation with the surface - datasets/initial conditions files being inconsistent, we had to use - the f09 grid for this test. The run length was kept short to keep - the wall clock time ~30 min. This is too short exercise some new - clm50 functionality, e.g. one year grain product pool. - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - - New namelist variables: use_fertilizer, use_grainproduct - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: unknown, none expected - - -Code reviews and testing ------------------------- - -Code reviewed by: Lombardozzi, Sacks - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 4.0 pass; 4.5 ok - yellowstone_pgi - 4.0 pass; 4.5 ok - yellowstone_gnu (clm45 only) - 4.5 ok - hobart_nag - 4.5 ok - - 'ok' means: all tests passed functionality and baseline - comparisons. only nlcomp failures. new test did not have a - baseline. - - Note: Grain product pool is active by default for clm50 with crops, - and will change answers. None of the tests are affected because they - do not run long enough to trigger the new code. - -CLM tag used for the baseline comparisons: clm4_5_6_r153 - - -Answer changes --------------- - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm50-crop - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - expected to be larger than roundoff, same climate. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - test mods for new test - clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/user_nl_clm - clm/cime_config/testdefs/testmods_dirs/clm/clm50KitchenSink/include_user_mods - -List all existing files that have been modified, and describe the changes: - - one year grain product pool - clm/src/biogeochem/CNPhenologyMod.F90 - fertilizer switch - clm/src/biogeochem/CNVegNitrogenFluxType.F90 - clm/src/biogeochem/CNDriverMod.F90 - clm/src/biogeochem/CNVegCarbonFluxType.F90 - clm/src/biogeochem/CNVegCarbonStateType.F90 - clm/src/biogeochem/CNVegNitrogenStateType.F90 - clm/src/biogeochem/CNWoodProductsMod.F90 - - new namelist/control variables for fertilizer and grain product pool - clm/src/main/clm_varctl.F90 - clm/src/main/controlMod.F90 - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - clm/bld/CLMBuildNamelist.pm - - new test - clm/cime_config/config_compsets.xml - clm/cime_config/testdefs/testlist_clm.xml - - -=============================================================== -=============================================================== -Tag name: clm4_5_6_r153 -Originator(s): Sean Swenson, Bill Sacks -Date: Tue Nov 17 06:01:47 MST 2015 -One-line Summary: Fix snow cover fraction bug - -Purpose of changes ------------------- - -The fix for infinite snow growth made in clm4_5_3_r144 turned out to have a bug -of its own: It made snow cover fraction rarely reach ~ 1, instead maxing out -around 0.8 or 0.9. - -This tag fixes the snow cover fraction bug while still (it appears) preventing -infinite snow growth. - -This results in a potentially large change in model behavior, so the version -number is bumped from clm4_5_5 to clm4_5_6. However, this is mainly due to -backing out some of the (buggy) changes that were put in place in -clm4_5_3_r144. That is, if the changes in this new tag were made on top of -clm4_5_3_r143, the differences would likely be relatively small. - -Changes made by Sean Swenson, brought to trunk by Bill Sacks. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: Bill Sacks - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - 'ok' means: tests pass, but answers change for CLM45 / CLM50 cases - -CLM tag used for the baseline comparisons: clm4_5_5_r152 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45 / CLM50 cases - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - New climate - - Main changes are due to backing out some of the (buggy) changes that were - put in place in clm4_5_3_r144. That is, if the changes in this new tag - were made on top of clm4_5_3_r143, the differences would likely be - relatively small. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes. The change to CanopyHydrologyMod backs out a change that - was made in r144. The change to SnowHydrologyMod is new. -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= Unrelated change: get rid of a write statement that was resulting in - lots of messages to the log file -M components/clm/src/biogeophys/SoilHydrologyMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_5_r152 -Originator(s): sacks (Bill Sacks) -Date: Tue Nov 17 05:22:58 MST 2015 -One-line Summary: Fix glc_mec energy conservation bug - -Purpose of changes ------------------- - -Fix an energy conservation bug that appears when running glc_mec (i.e., in runs -with CISM). Energy loss due to ice melt was essentially being double-counted: -First, all snow capping was being sent as ice runoff, and thus melted by the -ocean; in addition, glacier ice melt removed energy from CLM. This removal of -energy due to both accumulation (snow capping) and melt amounts to -double-counting. - -This is fixed by: For each unit of ice melt, remove one unit of ice runoff -(possibly resulting in negative ice runoff), adding one unit of liquid -runoff. You can think of this as: each unit of ice melt indicates one unit of -snow capping that should not have made it to the ocean, but instead melted en -route. - -Note that we currently adjust qflx_snwcp_ice in order to achieve this ice runoff -adjustment. This affects the QSNWCPICE history field. (In an upcoming tag, I -plan to return qflx_snwcp_ice to its original values (i.e., truly indicating -snow capping), by introducing a new field that explicitly gives ice runoff.) - -This tag also fixes a minor bug in the calculation of negative runoff for -glc_mec columns with glc_dyn_runoff_routing=T. In addition, it reorders some -code in HydrologyDrainageMod in order to remove some complexity. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - pass - - 'ok' means: pass except for baseline failures in IG tests (IG compsets plus - ICLM45GLCMEC) - - Also, unexpected baseline failures in the following tests; however, these - same baseline failures were observed when comparing a fresh checkout of r151 - against the r150 baselines (this new branch is bit-for-bit with a fresh - checkout of r151 for these tests): - - NCK_Ld5.f10_f10.I.yellowstone_pgi.clm-40default - RMS x2l_Flrr_volr 8.8324E-18 NORMALIZED 2.2700E-15 - RMS x2l_Flrr_volrmch 8.8324E-18 NORMALIZED 2.2700E-15 - - SMS_D_Ld3.f10_f10.ICRUCLM50BGC.yellowstone_pgi.clm-default - SMS_Ld5.f19_g16.IRCP45CLM45BGC.yellowstone_pgi.clm-decStart - FILLDIFF topo - - NCK_Ld1.f10_f10.ICRUCLM45.yellowstone_intel.clm-default - RMS VOLR 8.9604E-05 NORMALIZED 1.2335E-14 - RMS VOLRMCH 8.9604E-05 NORMALIZED 1.2335E-14 - RMS x2l_Flrr_volr 2.8268E-17 NORMALIZED 6.8542E-15 - RMS x2l_Flrr_volrmch 2.8268E-17 NORMALIZED 6.8542E-15 - -CLM tag used for the baseline comparisons: clm4_5_4_r151 (baseline directory -named clm4_5_4_r150) - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All IG compsets (compsets with CISM / glc_mec) - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Likely new climate - - For each unit of glacier melt, there is an extra unit of liquid runoff, - and one unit less of ice runoff. - - This results in changes in the following CLM history fields: ERRH2O, - ERRH2OSNO, QRGWL, QRUNOFF, QRUNOFF_TO_COUPLER, QSNWCPICE, - QSNWCPICE_TO_COUPLER, TWS, VOLR, VOLRMCH - - And the following changes in l2x cpl hist fields: l2x_Flrl_rofdto, - l2x_Flrl_rofgwl, l2x_Flrl_rofi - - There are also changes in the consequent x2r, r2x and x2l cpl hist fields. - - I did one test run to confirm that the differences in (l2x_Flrl_rofdto + - l2x_Flrl_rofgwl) exactly balanced the differences in l2x_Flrl_rofi. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 - -========= Unrelated change: just change a comment -M components/clm/src/main/clm_instMod.F90 - -=============================================================== -=============================================================== -Tag name: clm4_5_4_r151 -Originator(s): erik (Erik Kluzek) -Date: Fri Nov 13 15:50:58 MST 2015 -One-line Summary: Fix broken r150 tag, with bgc_spinup issue in it - -Purpose of changes ------------------- - -Backout changes to -bgc_spinup in CLM build-namelist should NOT -have been committed. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2245 - 2245 setup doesn't work, because of issue iwth -bgc_spinup - -Notes of particular relevance for users None ---------------------------------------- - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: None! (but this is the same as what was actually tested for clm4_5_4_r150) - -CLM tag used for the baseline comparisons: clm4_5_4_r150 - - -Answer changes --------------- - -Changes answers relative to baseline: No - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - ->>>>>>> Remove non-working on-accell option to -bgc_spinup to namelist -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_4_r150 -Originator(s): erik (Erik Kluzek) -Date: Fri Nov 13 13:42:39 MST 2015 -One-line Summary: Some needed answer changing fixes for: fire, disallow negative photosynthis, - and reduce LAI of DBT in evergreen state - -Purpose of changes ------------------- - -Add in changes to fire fluxes for deadstem (both clm4_5 and clm5_0). Don't allow -photosynthis to be less than zero. Reduce the Leaf Area Index (LAI) of Deciduous -Broadleaf Tree (DBT) when in an evergreen state (warm enough that all of the leaves never -all fall off) by taking into account leaf longevity and only allowing the amount of -leaf or fine root Carbon storage transfered to be more than the amount of remaining leaf -or fine root Carbon (would be zero unless in an evergreen state). Previously, DBT in -evergreen state would have unrealistically high LAI, that would then cause them to take up -too much water and then kill the trees. So they had an unrealistic cycle for trees that are -supposed to be in an evergreen state. - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2242, 2243, and 2244 - 2244 Change to reduce leaf area of DBT in evergreen state (rfisher) - 2243 Deadstem not taken into account in fire-fluxes for clm4_5 (koven) - 2242 Disallow negative photosynthis (olesen and bonan) - -Known bugs introduced in this tag (include bugzilla ID): 2245 - 2245 setup doesn't work, because of issue iwth -bgc_spinup - -Notes of particular relevance for users None ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - - -Code reviews and testing ------------------------- - -Code reviewed by: self, koven, rfisher, oleson - -CLM testing: - - build-namelist tests: - - yellowstone - yes - - unit-tests (components/clm/src): - - yellowstone - yes - - tools-tests (components/clm/test/tools): - - yellowstone - no - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - no - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - yes - yellowstone_pgi - yes - yellowstone_gnu (clm45 only) - yes - hobart_nag - yes - -CLM tag used for the baseline comparisons: clm4_5_3_r149 - - -Answer changes --------------- - -Changes answers relative to baseline: - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5 and clm5_0 - - what platforms/compilers: all - - nature of change: similar climate - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeochem/CNFireLi2014Mod.F90 --- Deal with deadstem for fire fluxes -M components/clm/src/biogeochem/CNFireLi2016Mod.F90 --- Deal with deadstem for fire fluxes -M components/clm/src/biogeochem/CNPhenologyMod.F90 ---- In CNStressDecidPhenology take into - account leaf longevity in lgsf, lower leaf and froot Carbon storage to transfer, by - the leaf and froot Carbon -M components/clm/src/biogeophys/PhotosynthesisMod.F90 - Make ag max of zero or calculated value - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r149 -Originator(s): sacks (Bill Sacks) -Date: Sun Nov 8 12:41:59 MST 2015 -One-line Summary: Change cold start initialization of snow pack - -Purpose of changes ------------------- - -Change cold start initialization of snow pack to lead to fewer instances where -cold start conditions negatively impact the simulation for long periods. Main -change is to make initial snow pack over glacier and high-latitude vegetation -much smaller. - -Also make istice consistent with istice_mec. - -New method developed in conjunction with Jan Lenaerts, Leo van Kampenhout, and -Dave Lawrence. - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone - NOT RUN - - unit-tests (components/clm/src): - - yellowstone - OK - - tools-tests (components/clm/test/tools): - - yellowstone - NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - OK - yellowstone_pgi - OK - yellowstone_gnu (clm45 only) - OK - hobart_nag - OK - -CLM tag used for the baseline comparisons: clm4_5_3_r148 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45/CLM5 cold start runs - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; not investigated carefully - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/main/clm_instMod.F90 - -========= Add a comment in changelog entry for clm4_5_3_r148 -M ChangeLog -M components/clm/doc/ChangeLog - -========= Minor tweak to template -M .ChangeLog_template - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r148 -Originator(s): sacks (Bill Sacks) -Date: Sat Nov 7 06:41:25 MST 2015 -One-line Summary: For CLM5, increase max snow depth to 20 m - -Purpose of changes ------------------- - -Change CLM5 snow defaults: - -- h2osno_max = 20m rather than 1m - -- nlevsno = 12 rather than 5 - -- glc_snow_persistence_max_days = 0 rather than 7300 (this is just used for - modeling glacial inception when coupled to CISM) - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): - - For CLM5 cases, need to run initial conditions through init_interp, because - of the change in nlevsno. See caveats under clm4_5_3_r146 before doing so. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): - -- h2osno_max = 20m rather than 1m - -- nlevsno = 12 rather than 5 - -- glc_snow_persistence_max_days = 0 rather than 7300 (this is just used for - modeling glacial inception when coupled to CISM) - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: - - This change will lead to some memory increase, and some increase in timing, - due to having more snow layers. I have not investigated this closely. The - tputcomp tests all passed, but these are not very meaningful - in part - because there likely weren't any grid cells with substantially more than 5 - layers in these test runs. - - -Code reviews and testing ------------------------- - -Code reviewed by: self - -CLM testing: - - build-namelist tests: - - yellowstone: NOT RUN - - unit-tests (components/clm/src): - - yellowstone: NOT RUN - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r147 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM5 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff, likely new climate in some regions - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: - - Some runs documented here: - https://docs.google.com/document/d/1Y5kCwa0GUnQ0hy7vNwvtFOKaC3ikysfLXdcNVqRygok/edit - - URL for LMWG diagnostics output used to validate new climate: - - http://www.staff.science.uu.nl/~kampe004/lnd_diag/tr_eraimod_5_cap-tr_eraimod_12_cap/setsIndex.html - - note that this uses 10m snow pack rather than 20m - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Change namelist defaults, as listed above -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Add documentation -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r147 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Nov 5 21:51:53 MST 2015 -One-line Summary: swenson bedrock and coupler runoff bugfixes - -Purpose of changes ------------------- - - Science bugfixs from Sean Swenson for bedrock and coupler runoff fields. - - The bugfix for bedrock corrects an issue where running with debug - flags and bedrock on would generate floating point errors or - unreproducible behavior when run with a surface data set that - contained bedrock data. - - coupler runoff fields bugfix: splitting of runoff for mosart did - not contain all surface and subsurface fields. surface runoff is - the sum of qflx_over, qflx_h2osfc_surf, and qflx_irrig. subsurface - runoff is the sum of qflx_drain and qflx_perched_drain - - Add cropColdStart test mods directory missing from r145. - - -Bugs fixed or introduced ------------------------- - -Bugs fixed (include bugzilla ID): 2241 - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through -init_interp): - use_bedrock is still not true by default because we do - not have a fully consistent set of surface data sets and initial - conditions for testing. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: unknown, none expected - - -Code reviews and testing ------------------------- - -Code reviewed by: Swenson, Andre - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40 pass; 45 ok - yellowstone_pgi - 40 pass; 45 ok - yellowstone_gnu (clm45 only) - 45 ok - hobart_nag - ok - - 'ok' means - all clm45/50 compsets have only the 'baseline compare' - answer changing failures. Fields described below. - - test BFAIL ERP_D_P15x2_Ld3.f10_f10.ICRUCLM50BGCCROP.yellowstone_intel.clm-cropColdStart because baseline is not in r146. - -CLM tag used for the baseline comparisons: clm4_5_3_r146 - - -Answer changes --------------- - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm45/clm50 - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff - - All clm45 and clm50 compsets will have answer changes in the clm - and coupler history files because of changes to the runoff passed - from clm to the coupler. Only the following fields have changed: - - clm: TWS, VOLRMCH, VOLR - - cpl: l2x_Flrl_rofgwl, x2r_Flrl_rofsub, x2r_Flrl_rofsur, - r2x_Flrr_volrmch, r2x_Flrr_volr, r2x_Forr_rofl, x2l_Flrr_volrmch, - x2l_Flrr_volr, l2x_Flrl_rofsub, l2x_Flrl_rofsur, x2r_Flrl_rofgwl - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - Add missing cropColdStart test mods - clm/cime_config/testdefs/testmods_dirs/clm/cropColdStart/user_nl_clm - clm/cime_config/testdefs/testmods_dirs/clm/cropColdStart/include_user_mods - clm/cime_config/testdefs/testmods_dirs/clm/cropColdStart - -List all existing files that have been modified, and describe the changes: - - Bedrock bug fix, initialize and size arrays correctly. - clm/src/biogeophys/SoilWaterMovementMod.F90 - - Remove expected failure from missing test mods: - clm/cime_config/testdefs/ExpectedTestFails.xml - - Coupler runoff bugfix: - clm/src/cpl/lnd_import_export.F90 - clm/src/main/lnd2atmType.F90 - clm/src/main/clm_driver.F90 - clm/src/main/lnd2atmMod.F90 - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r146 -Originator(s): sacks (Bill Sacks) -Date: Wed Nov 4 06:48:41 MST 2015 -One-line Summary: Implement vertical interpolation in init_interp - -Purpose of changes ------------------- - -The major requirements this addresses are: - -(1) Handle changes in the vertical discretization of the soil column, - including changing the number of layers and/or changing the depth of layers. - -(2) Handle changes in which soil layers are considered bedrock vs. "standard" - soil: Information from bedrock layers should not be transmitted to soil - layers, and vice versa. - -(3) Handle changing number of snow layers - -There was previously-existing code to handle (1). However, while it was mostly -right, it was hard-coded to just handle the interpolation from "standard" -vertical levels to "more_vertlevels". And there were a number of special cases -that it mis-handled (such as urban points, which have a different vertical -discretization; also, spvals were not handled correctly). It was also going to -be hard to fit requirements #2 and #3 into the old code. So I removed the old -code and replaced it with a new, object-oriented design. - -Because the number of files involved in init_interp has now grown significantly, -I have moved this code to a new directory (src/init_interp). - -As part of the handling of vertical interpolation, I needed to fix a few -inconsistencies in the use of spval in some multi-level fields (see below for -details). - -Finally, to aid with testing of this new code, and because it is useful in -general, Sean Swenson added nbedrock to the first history file of a run. - - -Bugs fixed or introduced ------------------------- - -Known bugs introduced in this tag (include bugzilla ID): [If none, remove this line] -- 2239: need new initial conditions files with extra metadata on them - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to run initial conditions through init_interp): - -- If you want to use init_interp on an initial conditions file generated prior - to this tag, you will need to first get some new metadata onto your initial - conditions file: COL_Z, LEVGRND_CLASS, COL_Z_p and LEVGRND_CLASS_p. You have - two options for how to do this: - - (1) Run the model for a short time using this tag, with a configuration that - matches the source file, using the source file as finidat (with - use_init_interp = .false.), in order to produce a new restart file with - the necessary metadata. Then use that new file as the finidat file for - init_interp. - - (2) If that is not possible, then an alternative is to run the model for a - short time using this tag, with cold start initial conditions (finidat = " "). - Then use a tool like ncks to copy the misssing fields onto the original source - finidat file. Then use that patched file as the finidat file for - init_interp. CAUTION: A bug in the netcdf library means that adding fields - using ncks can result in data corruption of existing fields. I have - observed this in the plant_nalloc field, which fortunately does not seem - to be needed at all on the restart file. However, if you use this method, - you should compare the old and new files to ensure that nothing other than - plant_nalloc has been changed. - - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): - Some new initial conditions files: same as old, but with metadata needed for - running them through init_interp - -Substantial timing or memory changes: none - - -Code reviews and testing ------------------------- - -Code reviewed by: self; CLM-CMT plans to do a more detailed review later - -CLM testing: - - build-namelist tests: - - yellowstone: NOT RUN - - unit-tests (components/clm/src): - - yellowstone: ok - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r145 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 / CLM50 runs that use init_interp to - interpolate to a different resolution - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; not investigated closely - - Changes arise from the fact that multi-level points are now interpolated - rather than copied from the input to the output. This changes results for - urban points, where the vertical level structure of walls and rooves varies - from gridcell to gridcell. - - There are also FILLDIFFs in SOILLIQ and SOILICE in vector (dov2xy = .false.) - history files, due to a bug fix in the treatment of spval for these - variables. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Moved to new directory for init_interp code -D components/clm/src/main/initInterpMindist.F90 -D components/clm/src/main/initInterp.F90 -D components/clm/src/main/test/initInterpMindist_test/CMakeLists.txt -D components/clm/src/main/test/initInterpMindist_test/test_init_interp_mindist.pf -D components/clm/src/main/test/initInterpMindist_test - -List all files added and what they do: - -========= Added new directory for init_interp code, populated with files that - used to be in main -A components/clm/src/init_interp -A components/clm/src/init_interp/initInterpMindist.F90 -A components/clm/src/init_interp/CMakeLists.txt -A components/clm/src/init_interp/test/initInterpMindist_test/CMakeLists.txt -A components/clm/src/init_interp/test/initInterpMindist_test/test_init_interp_mindist.pf -A components/clm/src/init_interp/test/initInterpMindist_test -A components/clm/src/init_interp/test - -========= Main changes needed for vertical interpolation -A components/clm/src/init_interp/initInterpMultilevelBase.F90 -A components/clm/src/init_interp/initInterpMultilevelCopy.F90 -A components/clm/src/init_interp/initInterpMultilevelInterp.F90 -A components/clm/src/init_interp/initInterpMultilevelSnow.F90 -A components/clm/src/init_interp/initInterpMultilevelSplit.F90 -A components/clm/src/init_interp/initInterpMultilevelContainer.F90 -A components/clm/src/init_interp/initInterp.F90 -A components/clm/src/init_interp/initInterp2dvar.F90.in -A components/clm/src/init_interp/initInterpBounds.F90 - -========= Wrappers to transpose and pack that handle allocation for you (needed - for pgi) -A components/clm/src/utils/array_utils.F90.in - -========= Put unit tests around the parts of the vertical interpolation that - have significant logic -A components/clm/src/init_interp/test/CMakeLists.txt -A components/clm/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_split.pf -A components/clm/src/init_interp/test/initInterpMultilevel_test/initInterpMultilevelMock.pf -A components/clm/src/init_interp/test/initInterpMultilevel_test/multilevel_interp_factory.F90 -A components/clm/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf -A components/clm/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_snow.pf -A components/clm/src/init_interp/test/initInterpMultilevel_test/CMakeLists.txt -A components/clm/src/init_interp/test/initInterpMultilevel_test - -========= Allow vrtlay tests to use init_interp -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay_interp - -========= Add a CLM5 crop test that uses init_interp (init_interp is needed for - CLM5 cases with non-cold-start initial conditions) -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonth_interp - -List all existing files that have been modified, and describe the changes: - -========= Added new directory for init_interp code -M components/clm/bld/configure -M components/clm/src/CMakeLists.txt -M components/clm/src/main/test/CMakeLists.txt - -========= Added new metadata to restart file that is needed for the vertical interpolation -M components/clm/src/main/initVerticalMod.F90 -M components/clm/src/main/subgridRestMod.F90 -M components/clm/src/main/ColumnType.F90 -M components/clm/src/main/column_varcon.F90 -M components/clm/src/main/filterMod.F90 -M components/clm/src/utils/restUtilMod.F90.in - -========= New routines used to add metadata to restart file and to read - variables in init_interp -M components/clm/src/main/ncdio_pio.F90.in - -========= Remove unnecessary use of spval (the vertical interpolation was not - handling this use of spval correctly, because it is inconsistent with - other uses of spval in the code; it turns out this use of spval wasn't - necessary to begin with) -M components/clm/src/biogeochem/ch4Mod.F90 -M components/clm/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 - -========= Fix bug: calculations were being done on spval, leading to values of - 1e75 on the restart file (this was causing problems with the new - vertical interpolation) -M components/clm/src/biogeophys/WaterStateType.F90 - -========= Added new necessary metadata to any initial conditions file that is - used for init_interp testing. I have NOT taken the time to do this for - other out-of-the-box initial conditions, figuring that they'll be - replaced soon anyway. (Any file generated with the new tag will have - the necassary metadata on it.) -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm - -========= Tangentially-related change: add nbedrock to first history file - (changes from Sean Swenson) -M components/clm/src/main/GridcellType.F90 -M components/clm/src/main/histFileMod.F90 - -========= Totally unrelated change: add a comment -M components/clm/src/biogeophys/test/Irrigation_test/IrrigationWrapperMod.F90 - -========= Added another system test of init_interp, and modify snowlayer tests - and some vrtlay tests to use init_interp -M components/clm/cime_config/testdefs/testlist_clm.xml -M components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm -M components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12/user_nl_clm - -========= Put unit tests around the parts of the vertical interpolation that - have significant logic -M components/clm/src/utils/CMakeLists.txt -M components/clm/src/main/CMakeLists.txt - -========= Remove old failing vrtlay tests from xfail list, add new vrtlay_interp - tests to xfail list (fail due to bug 2239); add two new CLM5 crop - tests to xfail list (bugs 2240 and 2241) -M components/clm/cime_config/testdefs/ExpectedTestFails.xml - -========= New ChangeLog template, with sections removed / added / rearranged -M .ChangeLog_template - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r145 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue Nov 3 14:25:30 MST 2015 -One-line Summary: update clm50 defaults, enable clm50 crop compsets - -Purpose of changes: - - CLM 5.0 defaults update from David Lawrence and Erik Kluzek. - - - New namelist defaults for clm50: - - use_bedrock = false - - lower_boundray_condition = 2 - - limit_lake_evap_irrig = true - - use_dynroot = false - - - Remove QICE from default history output in use cases. - - - Some history output variables are now inactive by default: - CONC_CH4_SAT, CONC_CH4_UNSAT, FPI, N tendency due to vertical - transport, vertically resolved N. - - - Some history output is now active by default: O2 decomp depth - unsat, SMINN. - - - Update cime configuration to allow creation of CLM 5.0 crop compsets. - - - Update clm4.0 for pio2 from Jim Edwards. - - Test list update from Ben Andre - - Add tests: short CLM 5.0 crop test, renamed aux_clm_short test suite to - clm_short_45, create clm_short_50 test suite. - - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): cime issue #238 (https://github.com/CESM-Development/cime/issues/238) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - Update namelist defaults for clm50 compsets - - use_bedrock = false - - lower_boundray_condition = 2 - - limit_lake_evap_irrig = true - - use_dynroot = false - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Erik Kluzek, Ben Andre - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - clm/bld/CLMBuildNamelist.pm - add_default() call for use_bedrock - - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - new clm50 defaults - - remove QICE from output - clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - clm/bld/namelist_files/use_cases/glacierMEC_pd.xml - - clm/cime_config/testdefs/testlist_clm.xml - new clm50 crop test, clm_short testlist update - - clm/cime_config/config_compsets.xml - clm50 crop compset - clm/cime_config/config_component.xml - clm50 crop compset - - clm/src_clm40/main/ncdio_pio.F90.in - pio2 update - - change default histroy status for variables listed above. - clm/src/biogeochem/ch4Mod.F90 - clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 - clm/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 - clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40, pass; 45, ok - yellowstone_pgi - 40, pass; 45, ok - yellowstone_gnu (clm45 only) - 45, ok - hobart_nag - not finished prior to tag. no problems expected based on prior branch testing. - - 'ok' means: clm45 tests passed, including baseline comparisons. clm50 - test functionality passed, baseline comparisons failed as expected - because of changes to namelist defaults. nlcomp will fail for clm50 tests. - -CLM tag used for the baseline comparisons: clm4_5_3_r144 - -Changes answers relative to baseline: some - - Summarize any changes to answers, i.e., - - what code configurations: all clm50 compsets - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r144 -Originator(s): Sean Swenson, Keith Oleson, Bill Sacks -Date: Tue Oct 27 09:47:58 MDT 2015 -One-line Summary: Better fix for bug that leads to infinite growth in snow depth - -Purpose of changes: - - Back out fix for infinite snow growth that was put in in clm4_5_3_r141. Put - in place new fix from Sean Swenson and Keith Oleson that fixes the problem - more fundamentally, rather than putting in place a band-aid fix that had its - own problems. - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Sean Swenson, Keith Oleson, Bill Sacks, Leo van Kampenhout - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: NOT RUN - - unit-tests (components/clm/src): - - yellowstone: ok - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r143 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ALL CLM45 & CLM50 - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated carefully, but likely to be larger than roundoff/same climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r143 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Oct 22 23:39:50 MDT 2015 -One-line Summary: flexibleCN and luna bugfixes. - -Purpose of changes: - - flexibleCN and LUNA bugfix changes from Bardan Ghimire, Rosie Fisher - and Chonggang Xu. - - Changes to FlexCN to burn off excess C. Corrected the cpool problem - not going to 0 by changing the order of processes. - - Turn off LUNA for crops and put a boundary cut-off on lnc for very - high lnc fed to LUNA - - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): none - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: new namelist carbon_resp_opt - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: unknown, none expected - -Code reviewed by: Bardan Ghimire, Chonggang Xu, Rosie Fischer, Dave Lawrence - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - new namelist option carbon_resp_opt - clm/bld/CLMBuildNamelist.pm - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - update defaults for carbon_storage_excess_opt - clm/src/main/controlMod.F90 - clm/src/main/clm_varctl.F90 - - flexibleCN - clm/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 - change order of processes - clm/src/biogeochem/CNVegCarbonFluxType.F90 - carbon_resp_opt - clm/src/biogeochem/CNCStateUpdate1Mod.F90 - carbon_resp_opt - clm/src/biogeochem/NutrientCompetitionMethodMod.F90 - update interface - clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 - update interface - clm/src/biogeochem/CNDriverMod.F90 - update interface - - LUNA - clm/src/biogeophys/LunaMod.F90 - leaf nitrogen cutoff - clm/src/biogeophys/PhotosynthesisMod.F90 - turnoff luna for crops - - whitespace / remove dead code - clm/src/biogeochem/CNPhenologyMod.F90 - - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pfunit tests pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass, flexibleCN not expected to be bit for bit with baseline - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - not finished at time of tag, expected to be ok based on prior branch testing. - -CLM tag used for the baseline comparisons: clm4_5_3_r142 - -Changes answers relative to baseline: some - - Summarize any changes to answers, i.e., - - what code configurations: clm50 with flexibleCN and clm50 with LUNA and crop on - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - larger than roundoff - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r142 -Originator(s): sacks (Bill Sacks) -Date: Mon Oct 19 19:57:35 MDT 2015 -One-line Summary: Fix bug in initialization of 12-layer snow pack - -Purpose of changes: - - Expand the dzmax arrays to have 12 elements, with the last element being - 'huge'. This fixes a bug in the initialization of the snow pack when you try - to initialize it to need all 12 layers. And, more generally, this helps avoid - special-case code that would otherwise be needed to handle the edge case at - the bottom layer. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Leo van Kampenhout - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: NOT RUN - - unit-tests (components/clm/src): - - yellowstone: ok - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r141 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r141 -Originator(s): Keith Oleson, Bill Sacks -Date: Mon Oct 19 14:15:06 MDT 2015 -One-line Summary: Fix bug that leads to infinite growth in snow depth - -Purpose of changes: - - Restore 'qflx_snow_grnd_col(c) > 0.0_r8' condition in check for whether snow - pack should be initialized. This was removed in clm4_5_1_r121, because Leo found - that, in some rare cases, with this condition in place, the snow pack wasn't - being initialized when it should have been. However, we have more recently found - that, without this condition, there are some rare cases when snow depth can grow - infinitely - and Keith Oleson traced this bug to the removal of this condition. - - We haven't managed to trace the entire logic here, but for now we feel it's - safest to restore this condition. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Keith Oleson, Bill Sacks - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: NOT RUN - - unit-tests (components/clm/src): - - yellowstone: NOT RUN - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r140 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ALL CLM45 & CLM50 - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated carefully, but likely to be larger than roundoff/same climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r140 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Oct 15 23:45:49 MDT 2015 -One-line Summary: mosart, direct to ocean runoff - -Purpose of changes: - Coordinated changes to clm, mosart and rtm to handle direct to - ocean runoff. - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): 2233 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: unknown, none expected - -Code reviewed by: Sean Swenson - -List any svn externals directories updated (cime, rtm, cism, etc.): cime, rtm, mosart - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - SVN_EXTERNAL_DIRECTORIES - update externals - clm/cime_config/config_compsets.xml - new compset IMCRUCLM50BGC for testing mosart - clm/cime_config/testdefs/ExpectedTestFails.xml - known issue in cime causes test failure - clm/cime_config/testdefs/testlist_clm.xml - add IM compset test for mosart - - add coupler fields for direct ocean runoff - clm/src_clm40/main/clm_cpl_indices.F90 - clm/src_clm40/main/lnd_import_export.F90 - clm/src/biogeophys/WaterfluxType.F90 - clm/src/biogeophys/HydrologyDrainageMod.F90 - clm/src/cpl/clm_cpl_indices.F90 - clm/src/cpl/lnd_import_export.F90 - clm/src/main/lnd2atmMod.F90 - clm/src/main/lnd2atmType.F90 - - -CLM testing: regular - - - build-namelist tests: - - yellowstone - n/a, not run - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - generate tests not finished at time of tag, but expected to be ok based on earlier testing. - - Notes: - - - ok means that all functionality tests pass. bit for bit - comparison with baselines only show differences in the following - runoff fields when rtm or mosart is running: - clm - TWS, VOLR, VOLRMCH - coupler - l2x_Flrl_rofgwl, x2l_Flrr_volr, x2l_Flrr_volrmch, r2x_Forr_rofl, r2x_Flrr_volr, r2x_Flrr_volrmch, x2r_Flrl_rofgwl - - - bfail for new mosart test - - - new expected failure for ERI_N2_Ld9.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default because of cime issue. - -CLM tag used for the baseline comparisons: clm4_5_3_r139 - -Changes answers relative to baseline: some - - Summarize any changes to answers, i.e., - - what code configurations: all with rtm or mosart - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r139 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue Oct 13 10:17:43 MDT 2015 -One-line Summary: dynamic roots from Beth Drewniak - -Purpose of changes: - - Introduce dynamic roots from Beth Drewniak. Allows roots to grow - dynamically, optimizing for water and nutrient uptake. Crop roots - start from zero each season. Generally leads to higher root - densities near the surface, but also deeper maximum root depth. - Overall, water stress is reduced. If use_bedrock = true, roots are - confined exist in soil layers only. Root litter is input into the - soil according to the dynamic root distribution. - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): none - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: new variable use_dynroot - -List any changes to the defaults for the boundary datasets: - updated pft parameter file to c151012, includes merge of dynamic - roots and flexCN params. - - NOTE: ED parameter file was not update. - -Describe any substantial timing or memory changes: unknown, none expected - -Code reviewed by: Dave Lawrence - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - clm/src/biogeochem/CNRootDynMod.F90 - implement dynamic roots - -List all existing files that have been modified, and describe the changes: - - new namelist variable use_dynroots and defaults - clm/bld/CLMBuildNamelist.pm - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - - clm/src/biogeochem/CNDriverMod.F90 - call dynamic roots - clm/src/main/controlMod.F90 - read use_dynroot namelist var - clm/src/main/clm_varctl.F90 - add use_dynroot switch - clm/src/main/pftconMod.F90 - new dynamic root variable - clm/src/biogeophys/SoilStateType.F90 - add root_depth_patch variable - - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pfunit tests pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a, not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a, not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - a couple of manual tests compiled and ran. full suite not finished at time of tag. - - NOTE: ok = amelist changes expected for clm45/50. New defaults - namelist for clm50 turns on dynamic roots, expect all clm50 - compsets to be answer changing. - -CLM tag used for the baseline comparisons: clm4_5_3_r138 - -Changes answers relative to baseline: some - - Summarize any changes to answers, i.e., - - what code configurations: clm50 with use_dynroot = true (default) - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): new climate - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r138 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Sun Oct 11 13:23:12 MDT 2015 -One-line Summary: new accelerated spinup and soil vertical structure - -Purpose of changes: Two sets of changes are included in this tag: - - Accelerated spinup - - New accelerated spinup mode introduced from Dan Ricciuto. - Acceleration factors are calculated directly from the base - decomposition rates for each pool and CWD is added to the pools that - are accelerated. Wood mortality is also accelerated by a factor of 10 - through increasing rates of gap mortality and fire. - - There are now three accelerated spinup modes - - Spinup_state = 0 ; no accelerated spinup - Spinup_state = 1 ; standard accelerated spinup - Spinup_state = 2 ; accelerated accelerated spinup - - Set through env_run.xml (-bgc_spinup on) and via namelist. - - In tests, new spinup method accelerates spinup by ~ a factor of 2 for - a case starting from pre-spunup conditions but shifting to another - forcing dataset. - - Vertical soil structure - - The vertical soil structure has been cleaned up and a new vertical - soil structure has been added. The namelist options more_vertlayers - and deep_soilcolumn have been removed and replaced with the more - general soil_layerstruct. Four options for soil_layerstruct are - included. - - 10SL_3.5m - original soil structure from CLM4.5 and prior versions - 20SL_8.5m - proposed new soil structure for CLM5 - 23SL_3.5m - replaces more_vertlayers - 49SL_10m - replace deep_soilcolumn - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): 2232 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: remove more_vertlayers, -deep_soilcolumn are removed, add soil_layerstruct. new default soil -for clm50 compsets - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: improved spinup, none expected for regular runs. - -Code reviewed by: dlawren - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - remove deep_soilcolumn and more_vertlayers namelist, add soil_layerstruct, update spinup_state: - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - clm/bld/CLMBuildNamelist.pm - - switch tests to use new namelist variable: - clm/cime_config/testdefs/testmods_dirs/clm/vrtlay/user_nl_clm - clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/user_nl_clm - clm/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm - - add failing tests - clm/cime_config/testdefs/ExpectedTestFails.xml - - switch soil layer structure from old to new namelist variable - clm/src/main/clm_varpar.F90 - switch to new namelist variables for soil vertiacal structure - clm/src/main/controlMod.F90 - update namelist variables - clm/src/main/clm_varctl.F90 - add soil_layerstruct - clm/src/main/initVerticalMod.F90 - switch to new namelist variables for soil vertiacal structure - clm/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 - switch to soil_layerstruct - clm/src/biogeophys/SoilStateInitTimeConstMod.F90 - switch to soil_layerstruct - clm/src/biogeophys/IrrigationMod.F90 - clm/src/biogeophys/SoilHydrologyMod.F90 - remove comment - - new spinup mode: - clm/src/biogeochem/CNGapMortalityMod.F90 - clm/src/biogeochem/CNVegStructUpdateMod.F90 - clm/src/biogeochem/CNVegCarbonStateType.F90 - clm/src/biogeochem/CNFireLi2016Mod.F90 - clm/src/biogeochem/CNVegStateType.F90 - clm/src/biogeochem/CNVegNitrogenStateType.F90 - clm/src/biogeochem/CNC14DecayMod.F90 - - clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 - clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 - clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 - clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 - clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 - clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 - clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - n/a - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - ok - yellowstone_pgi - ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - - all clm50 compsets fail bit for bit with baseline because of new - default soil_layer structure. - - spinup tests fail because of new spinup code. - - two new expected fails for clm45 compsets, see bugzilla 2232 - -CLM tag used for the baseline comparisons: clm4_5_3_r137 - -Changes answers relative to baseline: some - - Summarize any changes to answers, i.e., - - what code configurations: clm50, spinup - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): new climate - - clm50 compsets use a new soil layer structure. - - new accelerated spinup - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r137 -Originator(s): erik (Erik Kluzek) -Date: Fri Oct 9 12:07:35 MDT 2015 -One-line Summary: Bring in changes for fire-emissions as well tuning changes to the fire model to be used with clm5_0 - -Purpose of changes: - Move fire_clm4_5_2_r128_tags/fire06_clm4_5_3_r136 branch originated from Francis Vitt and Fang Li - to trunk. This does two things: sends fire-emissions from land to coupler (then to ATM), and has - an updated (retuned) version of CNFire from Fang Li. The retuned version is tuned for running with - CAM, but there are fire parameter changes that allow it to be tuned with CRU forcing. - - CLM can test fire-emissions with the -fire_emis option to CLM_BLDNML_OPTS. Coupled configurations - with CAM-CHEM will turn on fire-emissions when fire_emis_nl namelist added to drv_flds_in coupler - namelist file. - -Requirements for tag: fire-emissions added and tested, clm4_5 identical, clm5_0 uses newly tuned fire-model - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - Bug 2231 – Issue with PTCLM with changes in cime4.0.1 - Bug 2229 – clm scripts not compatible with cime > cime2.x.y - Bug 2220 – Bug in fire model with ED for RH24 and WIND24 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Add ability to use and generate fire-emission namelist: fire_emis_nl - Add cnfire_inparm namelist for clm4_5 with fire_method to either li2014qianfrc (clm4_5 default), - or li2016crufrc (clm5_0 default) - Add -fire_emis option to CLM build-namelist - Add shr_fire_emis_factors_file file to use when fire-emissions are sent to coupler - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, fang-li, fvitt - -List any svn externals directories updated (cime, rtm, cism, etc.): - - PTCLM to PTCLM2_151009 - -List all files eliminated: - -D components/clm/src/biogeochem/CNFireMod.F90 --- clm4_5 fire model was split into - polymorphic versions that include clm4_5 and clm5_0 default versions - -List all files added and what they do: - -A components/clm/bld/namelist_files/namelist_defaults_fire_emis.xml -- fire emissions - defaults to use when -fire_emis CLM_BLDNML_OPTS option is used - -------- Add some clm4_0 specific testmods -A components/clm/cime_config/testdefs/testmods_dirs/clm/fire_emis/user_nl_clm ------- Set fire-emission - history fields, include fire_emis_elevated=.true. -A components/clm/cime_config/testdefs/testmods_dirs/clm/fire_emis/include_user_mods - use default -A components/clm/cime_config/testdefs/testmods_dirs/clm/fire_emis -A components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN/include_user_mods ---- use default -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/shell_commands - turn -fire_emis -A components/clm/cime_config/testdefs/testmods_dirs/clm/40default/user_nl_clm ---- Same as default -A components/clm/cime_config/testdefs/testmods_dirs/clm/40default/shell_commands - Same as default, but no -fire_emis -A components/clm/cime_config/testdefs/testmods_dirs/clm/40default -A components/clm/cime_config/testdefs/testmods_dirs/clm/reduceOutput/shell_commands - -no-fire_emis - -------- Fire model polymorphic options -------- CNFireFactory chooses which version, CNFireMethod is abstract class, CNFireBase is base class -------- CNFireLi2014 extends the base class for clm4_5 default version CNFireLi2016 extends base class -------- for clm5_0 default version -A components/clm/src/biogeochem/CNFireFactoryMod.F90 --- Factory and namelist to figure out which - version to implement. -A components/clm/src/biogeochem/CNFireMethodMod.F90 ---- Abstract class to define all interfaces -A components/clm/src/biogeochem/CNFireBaseMod.F90 ------ Base class, does initialization and - handles lightning and pop-dens datasets -A components/clm/src/biogeochem/CNFireLi2014Mod.F90 ---- Implements CNFireArea and CNFireFluxes - for the clm4_5 default version -A components/clm/src/biogeochem/CNFireLi2016Mod.F90 ---- Implements CNFireArea and CNFireFluxes - for the clm5_0 default version, tuned with CAM5 (parameter changes for version tuned to CRUNCEP) - -------- Fire emission factors -A components/clm/src/biogeochem/FireEmisFactorsMod.F90 -- Fire emission factors from new NetCDF dataset -A components/clm/src/biogeochem/CNFireEmissionsMod.F90 -- Gathers carbon emissions from fire sources - to be sent to CAM-Chem via the coupler - -List all existing files that have been modified, and describe the changes: - -------- Get working with cime4.0.1 -M components/clm/test/tools/TCBCFGtools.sh --- change location of configure and soft link Macros.make -M components/clm/test/tools/TCBtools.sh ------ change location of configure and soft link Macros.make - -------- Update sample namelist (used for tools tests) -M components/clm/tools/clm4_5/mksurfdata_map/mksurfdata_map.namelist - -------- -M components/clm/bld/unit_testers/build-namelist_test.pl ----------- Add fire_emis tests -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Add default fire_method options -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add cnfire_inparm, and fire_emis_nl - namelist groups. Adding: fire_method, fire_emis_elevated, fire_emis_factors_file, and fire_emis_specifier -M components/clm/bld/CLMBuildNamelist.pm --------------------------- Add cnfire_inparm namelist and - handle fire_emis option simialr to megan and drydep options. - Add: fire_emis_elevated, fire_emis_factors_file, and fire_emis_specifier - -------- -M components/clm/cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods - use 40defaults -M components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN/user_nl_clm - use defaults, so just set use_flexibleCN -M components/clm/cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods -- use 40defaults -M components/clm/cime_config/testdefs/testmods_dirs/clm/default/shell_commands - Add -fire_emis -M components/clm/cime_config/testdefs/testlist_clm.xml ------- Change clm4_0 tests to use 40default - and add fire_emis test -M components/clm/cime_config/user_nl_clm ---- Add mention of -fire_emis option - -------- -M components/clm/src/dyn_subgrid/dynSubgridControlMod.F90 - NFileName to NLFilename, and read_namelist -M components/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -- Pass NLFilename down to dynSubgrid_init -M components/clm/src/cpl/clm_cpl_indices.F90 -------------- Add fire-fluxes, and top of fire emissions -M components/clm/src/cpl/lnd_import_export.F90 ------------ Set fire-fluxes and top of fire emission -M components/clm/src/biogeochem/VOCEmissionMod.F90 -------- Add an additional coefficient multiply - (currently just set to 1.0) -M components/clm/src/biogeochem/CNDriverMod.F90 ----------- Pass NLFilename and cnfire_method - down to CNDriverInit and cnfire_method to CNDriverNoLeaching, and use for CNFireArea and - CNFireFluxes calls -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 -- Correct fire variable descriptions - (fuelc_col, fuelc_crop_col) -MM components/clm/src/main/clm_initializeMod.F90 ----------- Add create_cnfire_method, pass NLFilename - down to CNDriverInit, ndep_init, and dynSubgrid_init -M components/clm/src/main/lnd2atmMod.F90 ------------------ Add use shr_fire_emis_mod to handle - fire emissions to send from land to ATM -M components/clm/src/main/ndepStreamMod.F90 --------------- NLFilename passed down rather than using - controlMod -M components/clm/src/main/lnd2atmType.F90 ----------------- Add wild-fire emissions flux and vertical - distribution -M components/clm/src/main/atm2lndType.F90 ----------------- Add RH30, PREC10, and PREC60 - ( 30 day relative humidity, 10 and 60 day precipitation) Fix bug 2220 for ED -M components/clm/src/main/clm_instMod.F90 ----------------- Add cnfire and fireemis objects - call initialize for fireemis -MM components/clm/src/main/controlMod.F90 ------------------ Call CNFireReadNML -M components/clm/src/main/clm_driver.F90 ------------------ Replace cnfire_method object - for calls to CNFire module, add call to CNFireEmisUpdate - -CLM testing: regular - - build-namelist tests: - - yellowstone yes - - unit-tests (components/clm/src): - - yellowstone yes - - tools-tests (components/clm/test/tools): - - yellowstone yes - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone yes - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - hobart_nag yes - -CLM tag used for the baseline comparisons: clm4_5_3_r137 - -Changes answers relative to baseline: Yes, for clm5_0 - - Summarize any changes to answers, i.e., - - what code configurations: clm5_0 - - what platforms/compilers: All - - nature of change (fire tuned differently): - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r136 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Oct 8 10:15:33 MDT 2015 -One-line Summary: coupler field prep for mosart and externals update - -Purpose of changes: - - Changes from T. Craig, M. Vertenstein and S. Swenson to enable - separation of runoff fields passed from CLM to RTM - - Update externals. - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2223 - -Known bugs (include bugzilla ID): 2229 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: unknown, none expected - -Code reviewed by: mvertens, swenson - -List any svn externals directories updated (cime, rtm, cism, etc.): cime, cism, rtm - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - Split river fluxes sent to the coupler into surface, frozen, subsurface and gwl (glacier/wetland/lake). - - clm/src_clm40/main/lnd_import_export.F90 - clm/src_clm40/main/clm_cpl_indices.F90 - clm/src_clm40/main/clm_atmlnd.F90 - clm/src/main/lnd2atmMod.F90 - clm/src/main/atm2lndType.F90 - clm/src/main/lnd2atmType.F90 - clm/src/cpl/lnd_import_export.F90 - clm/src/cpl/clm_cpl_indices.F90 - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pfunit tests pass - - tools-tests (components/clm/test/tools): - - yellowstone - mksurfdata_map unit tests pass - tools system tests not cime compatible - bug 2229 - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - NOTE: the filenames for some tests exceeded the allowed length and comparison against the original r136 baselines may show bfail for: - - ERP_D_P15x2_Ld3.f10_f10.ICRUCLM50BGC.yellowstone_intel.clm-limit_river_withdraw - ERP_P15x2_Lm36.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrig_o3_reduceOutput - - yellowstone_intel - 40 ok, 45 ok - yellowstone_pgi - 40 ok, 45 ok - yellowstone_gnu (clm45 only) - ok - hobart_nag - ok - -CLM tag used for the baseline comparisons: clm4_5_3_r135 - -Changes answers relative to baseline: yes - - Summarize any changes to answers, i.e., - - what code configurations: - * cism update is answer changing for all IG compsets. see cism for details - * splitting river fluxes to the coupler is answer changing for all clm45/50 compsets. - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): much larger than roundoff, assumed new climate. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: no runs were performed - - URL for LMWG diagnostics output used to validate new climate: - no diagnostics created. -=============================================================== -=============================================================== -Tag name: clm4_5_3_r135 -Originator(s): sacks (Bill Sacks) -Date: Tue Oct 6 05:59:45 MDT 2015 -One-line Summary: Substantial reduction in memory allocation for prognostic crops - -Purpose of changes: - - With the introduction of "global" crops (78 pfts), memory use was increased - substantially. The memory use itself was not a problem, but this led to a - significant model slow-down, presumably due to a decrease in cache use - efficiency. Much of this increase in memory use was unnecessary: CLM only - knows about a minority of the new crop functional types (CFTs) - other CFTs - are merged into those known CFTs. Yet space was being set aside in the patch - and column-level arrays even for the CFTs that are never used. - - In this tag, I have reduced prognostic crop memory use by only allocating - space in patch and column-level arrays for the crops CLM knows about. - - This leads to a speedup of prognostic crop cases by about 1.5x. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: - - New initial conditions files for crops, needed because of the change in - number of patches and columns. These were generated by running the old - initial conditions through initInterp. - -Describe any substantial timing or memory changes: Speedup of prognostic crop -cases by about 1.5x. - -Code reviewed by: Erik Kluzek, Ben Andre, Mariana Vertenstein - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as described above -M components/clm/src/main/subgridMod.F90 -M components/clm/src/main/pftconMod.F90 -M components/clm/src/main/initGridCellsMod.F90 -M components/clm/src/main/clm_varpar.F90 - -========= Replace old conditional with use of new is_pft_known_to_model, which - is a more general/robust way to accomplish the conditional -M components/clm/src/biogeochem/CNPhenologyMod.F90 - -========= New initial conditions files for crop -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Remove unneeded 'use' statements -M components/clm/src/main/restFileMod.F90 -M components/clm/src/main/surfrdMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: NOT RUN - - unit-tests (components/clm/src): - - yellowstone: ok - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r134 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r134 -Originator(s): sacks (Bill Sacks) -Date: Sun Oct 4 07:25:05 MDT 2015 -One-line Summary: Fixes for transient and preindustrial crop cases - -Purpose of changes: - - (1) Important bug fix for transient crop: Collapse crop types in the - transient run. Previously, when the transient portion started, (a) the - collapse of the 78 pfts to the "known" crops was not happening, and (b) - the collapse of irrigated pfts in a non-irrigation run was not - happening. These two problems are fixed now. - - (2) Restore lost transient crop test cases - - (3) Add 1850 crop raw dataset (created using - https://github.com/billsacks/clm_misc-make_crop_1850_dataset) - - (4) Add out-of-the-box surface datasets for 1850 crop, and out-of-the-box - landuse timeseries datasets for transient crop - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): -- 2010 (create year-1850 surface datasets for crop) -- 2149 (tweak smallville transient test case) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: new out-of-the-box defaults (see below) - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Remove testmods directories that are no longer needed because - transient crop cases now pick up a surface dataset and landuse - timeseries file out-of-the-box -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10 - -========= Remove testmods directory that is no longer used (should have been removed in clm4_5_2_r127) -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09/README -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09/user_nl_clm -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09/include_user_mods -D components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09 - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Collapse crop types in a transient run -M components/clm/src/main/surfrdUtilsMod.F90 -M components/clm/src/main/surfrdMod.F90 -M components/clm/src/dyn_subgrid/dyncropFileMod.F90 - -========= Relax tolerance for check of PCT_NAT_PFT between landuse timeseries - file and surface dataset. Transient crop runs exceeded the previous - strict tolerance. I'm not sure why they need this relaxed tolerance, - but given the manipulations that were needed both to create the - year-1850 crop raw dataset and to create the crop landuse timeseries - file, I'm willing to accept that this is needed. I have made this - tolerance about 2 orders of magnitude looser than the differences I - observed, to try to prevent the check from being wrongly triggered in - the future. The tolerance of 1e-6 still seems sufficient to catch any - real problems. -M components/clm/src/dyn_subgrid/dynpftFileMod.F90 - -========= Add rules to make some 1850 crop surface datasets -M components/clm/tools/clm4_5/mksurfdata_map/Makefile.data - -========= Add raw dataset for 1850 crop -M components/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - -========= Add some surface datasets for 1850 crop, and landuse timeseries files - for crop -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Just add a comment -M components/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - -========= Restore transient crop tests that were lost shortly after they were - added (when the test list was migrated out of scripts into CLM) -M components/clm/cime_config/testdefs/testlist_clm.xml - -========= Unrelated change: add a note at Ben's request -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/README -M components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/README - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - unit-tests (components/clm/src): - - yellowstone: ok - - tools-tests (components/clm/test/tools): - - yellowstone: NOT RUN - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone: NOT RUN - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r132 - -Changes answers relative to baseline: YES - just for transient crop cases - - Summarize any changes to answers, i.e., - - what code configurations: transient crop cases - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - not investigated, likely to be new climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - - Note that there were no transient crop tests in the test suite prior to this - tag, so the answer changes do not affect any existing tests. - - Note the following unexpected BFAILs: - - BFAIL ERP_D_P15x2_Ld3.f10_f10.ICRUCLM50BGC.yellowstone_intel.clm-limit_river_withdraw.clm2.h0.nc : baseline compare clm2.h0 (baseline: compare .base file with clm4_5_3_r132 file) (baseline history file does not exist) - BFAIL ERP_D_P15x2_Ld3.f10_f10.ICRUCLM50BGC.yellowstone_intel.clm-limit_river_withdraw.clm2.h1.nc : baseline compare clm2.h1 (baseline: compare .base file with clm4_5_3_r132 file) (baseline history file does not exist) - - BFAIL ERP_P15x2_Lm36.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrig_o3_reduceOutput.clm2.h1.nc : baseline compare clm2.h1 (baseline: compare .base file with clm4_5_3_r132 file) (baseline history file does not exist) - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r133 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri Oct 2 16:24:53 MDT 2015 -One-line Summary: Bugfix for mksurfdata_map - add file missed by clm4_5_2_r125. - -Purpose of changes: - - Bugfix for mksurfdata_map. Add new file needed for soil depth. File should have been included in clm4_5_2_r125. - -Requirements for tag: tools - -Test level of tag: mksurfdata_map unit tests - -Bugs fixed (include bugzilla ID): not in bugzilla - -Known bugs (include bugzilla ID): systems tests for clm tools not cime3 compatible. - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - clm/tools/clm4_5/mksurfdata_map/src/mksoildepthMod.F90 - include soil depth data - -List all existing files that have been modified, and describe the changes: none - -CLM testing: tools - - build-namelist tests: not run - - unit-tests (components/clm/src): not run - - tools-tests (components/clm/test/tools): - - yellowstone - clm4_5/mksurfdata_map/unit_testers - all tests passed - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone not run - - regular tests (aux_clm40, aux_clm45): not run. no changes to main clm code. - -CLM tag used for the baseline comparisons: none. - -Changes answers relative to baseline: no - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r132 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri Oct 2 10:29:57 MDT 2015 -One-line Summary: Modify soil BGC diffusion and cryoturbation code to allow for spatially variable soil thickness. - -Purpose of changes: - - Changes from Dave Lawrence to modify soil BGC diffusion and - cryoturbation code to allow for spatially variable soil thickness - (e.g. if use_bedrock = true); fixed dzsoi_decomp for new vertical - grids - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): 2213, 2219 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: unknown none expected - -Code reviewed by: Dave Lawrence - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - clm/src/main/initVerticalMod.F90 - use zmin_bedrock param, fix dzsoi_decomp - clm/src/main/clm_varcon.F90 - make zmin_bedrock a constant parameter - clm/src/main/clm_varpar.F90 - write subsurface discretization levels to land log - clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 - spatially variable soil thickness - clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 - spatially variable soil thickness - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40, pass; 45, ok (see below) - yellowstone_pgi - 40, pass; 45, pass - yellowstone_gnu (clm45 only) - pass - hobart_nag - pass - - Only test not bit for bit with baseline is: - ERS_D_Ld3.f10_f10.ICRUCLM50BGC.yellowstone_intel.clm-deepsoil_bedrock - -CLM tag used for the baseline comparisons: clm4_5_3_r131 - -Changes answers relative to baseline: some - - Tag changes answers for clm50 bgc compsets where use_bedrock = - true. No change to default version of model, doesn't change - results for use_bedrock = true when in SP mode. - - Summarize any changes to answers, i.e., - - what code configurations: clm50 bgc with use_bedrock = true - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): new climate - - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: - none - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r131 -Originator(s): mvertens, sacks -Date: Wed Sep 30 05:13:45 MDT 2015 -One-line Summary: Bring in cime3 - -Purpose of changes: - - Bring in cime3 (de-CESMization of CIME), which requires the addition of a - cime_config directory and a bit of other rework. - - Also, port the pnetcdf problem with dov2xy=false from clm45 to clm4 code base - (workaround for bug 1730 - and 2214 and 2222). This was needed because now - pnetcdf is on by default in most runs. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): -- 2214: CLM4 test fails in PIO while trying to write h1 file -- 2222: CLM4 cases die when writing 1-d history files with pnetcdf - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: rework for cime3 - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): -cime2.0.18-p1.1 -> cime3.0.7 -cism2_1_02 -> cism2_1_05 -rtm1_0_52 -> rtm1_0_53 - - -List all files eliminated: - -========= Moved into cime_config -D components/clm/cimetest/testlist_clm.xml -D components/clm/cimetest/ExpectedTestFails.xml -D components/clm/cimetest/testmods_dirs/clm/glcMEC_long/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/glcMEC_long/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/glcMEC_long/README -D components/clm/cimetest/testmods_dirs/clm/glcMEC_long -D components/clm/cimetest/testmods_dirs/clm/decStart/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/decStart/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/decStart -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetMid/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetMid/README -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetMid/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetMid -D components/clm/cimetest/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/irrigOn_reduceOutput/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/irrigOn_reduceOutput/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/irrigOn_reduceOutput -D components/clm/cimetest/testmods_dirs/clm/default/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/default/shell_commands -D components/clm/cimetest/testmods_dirs/clm/default -D components/clm/cimetest/testmods_dirs/clm/crop_trans_sville/README -D components/clm/cimetest/testmods_dirs/clm/crop_trans_sville/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/crop_trans_sville/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/crop_trans_sville -D components/clm/cimetest/testmods_dirs/clm/edTest/shell_commands -D components/clm/cimetest/testmods_dirs/clm/edTest/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/edTest -D components/clm/cimetest/testmods_dirs/clm/reduceOutput/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/reduceOutput -D components/clm/cimetest/testmods_dirs/clm/cropMonthOutput/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/cropMonthOutput/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/cropMonthOutput -D components/clm/cimetest/testmods_dirs/clm/monthly/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/monthly/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/monthly/user_nl_cpl -D components/clm/cimetest/testmods_dirs/clm/monthly -D components/clm/cimetest/testmods_dirs/clm/glcMEC/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/glcMEC/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/glcMEC/user_nl_cpl -D components/clm/cimetest/testmods_dirs/clm/glcMEC -D components/clm/cimetest/testmods_dirs/clm/ciso/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/ciso/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/ciso -D components/clm/cimetest/testmods_dirs/clm/luna/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/luna/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/luna -D components/clm/cimetest/testmods_dirs/clm/monthly_noinitial/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/monthly_noinitial/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/monthly_noinitial -D components/clm/cimetest/testmods_dirs/clm/interp_from_f09/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/interp_from_f09/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/interp_from_f09/README -D components/clm/cimetest/testmods_dirs/clm/interp_from_f09 -D components/clm/cimetest/testmods_dirs/clm/glcMEC_increase/user_nl_cism -D components/clm/cimetest/testmods_dirs/clm/glcMEC_increase/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/glcMEC_increase/README -D components/clm/cimetest/testmods_dirs/clm/glcMEC_increase -D components/clm/cimetest/testmods_dirs/clm/crop/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/crop/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/crop -D components/clm/cimetest/testmods_dirs/clm/allActive/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/allActive -D components/clm/cimetest/testmods_dirs/clm/cn_conly/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/cn_conly/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/cn_conly -D components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands -D components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/README -D components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way -D components/clm/cimetest/testmods_dirs/clm/snowlayers_12/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/snowlayers_12/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/snowlayers_12 -D components/clm/cimetest/testmods_dirs/clm/ptsROA/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/ptsROA/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/ptsROA -D components/clm/cimetest/testmods_dirs/clm/NoVSNoNI/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/NoVSNoNI/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/NoVSNoNI -D components/clm/cimetest/testmods_dirs/clm/SNICARFRC/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/SNICARFRC/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/SNICARFRC -D components/clm/cimetest/testmods_dirs/clm/flexibleCN/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/flexibleCN -D components/clm/cimetest/testmods_dirs/clm/glcMEC_changeFlags/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/glcMEC_changeFlags/README -D components/clm/cimetest/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/glcMEC_changeFlags -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop/README -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop -D components/clm/cimetest/testmods_dirs/clm/crop_trans_f10/README -D components/clm/cimetest/testmods_dirs/clm/crop_trans_f10/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/crop_trans_f10/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/crop_trans_f10 -D components/clm/cimetest/testmods_dirs/clm/o3/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/o3/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/o3 -D components/clm/cimetest/testmods_dirs/clm/vrtlay/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/vrtlay/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/vrtlay -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetEarly/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetEarly/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetEarly/README -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetEarly -D components/clm/cimetest/testmods_dirs/clm/oldhyd/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/oldhyd -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop/README -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop -D components/clm/cimetest/testmods_dirs/clm/irrig_o3_reduceOutput/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/irrig_o3_reduceOutput/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/irrig_o3_reduceOutput/README -D components/clm/cimetest/testmods_dirs/clm/irrig_o3_reduceOutput -D components/clm/cimetest/testmods_dirs/clm/glcMEC_decrease/user_nl_cism -D components/clm/cimetest/testmods_dirs/clm/glcMEC_decrease/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/glcMEC_decrease/README -D components/clm/cimetest/testmods_dirs/clm/glcMEC_decrease -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subset/README -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subset/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subset -D components/clm/cimetest/testmods_dirs/clm/USUMB/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/USUMB/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/USUMB -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetLate/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetLate/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetLate/README -D components/clm/cimetest/testmods_dirs/clm/tropicAtl_subsetLate -D components/clm/cimetest/testmods_dirs/clm/drydepnomegan/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/drydepnomegan/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/drydepnomegan -D components/clm/cimetest/testmods_dirs/clm/rootlit/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/rootlit/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/rootlit -D components/clm/cimetest/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/deepsoil_bedrock/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/deepsoil_bedrock -D components/clm/cimetest/testmods_dirs/clm/af_bias_v5/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/af_bias_v5/user_nl_datm -D components/clm/cimetest/testmods_dirs/clm/af_bias_v5/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/af_bias_v5 -D components/clm/cimetest/testmods_dirs/clm/limit_river_withdraw/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/limit_river_withdraw/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/limit_river_withdraw -D components/clm/cimetest/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/snowlayers_3_monthly -D components/clm/cimetest/testmods_dirs/clm/interp_f19_crop/README -D components/clm/cimetest/testmods_dirs/clm/interp_f19_crop/user_nl_clm -D components/clm/cimetest/testmods_dirs/clm/interp_f19_crop/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/interp_f19_crop -D components/clm/cimetest/testmods_dirs/clm/ptsRLA/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/ptsRLA/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/ptsRLA -D components/clm/cimetest/testmods_dirs/clm/pts/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/pts/README -D components/clm/cimetest/testmods_dirs/clm/pts/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/pts -D components/clm/cimetest/testmods_dirs/clm/ptsRLB/xmlchange_cmnds -D components/clm/cimetest/testmods_dirs/clm/ptsRLB/include_user_mods -D components/clm/cimetest/testmods_dirs/clm/ptsRLB -D components/clm/cimetest/testmods_dirs/clm -D components/clm/cimetest/testmods_dirs -D components/clm/cimetest -D components/clm/bld/clm.buildlib -D components/clm/bld/user_nl_clm -D components/clm/bld/clm.buildnml - -========= This is no longer needed - it is generated automatically by the build script -D components/clm/src_clm40/main/ncdio_pio.F90 - - -List all files added and what they do: - -========= New stuff needed for cime3 -A components/clm/cime_config -A components/clm/cime_config/config_component.xml -A components/clm/cime_config/config_pes.xml -A components/clm/cime_config/config_compsets.xml - -========= Moved from elsewhere (new organization needed for cime3) -A components/clm/cime_config/testdefs/ExpectedTestFails.xml -A components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/USUMB -A components/clm/cime_config/testdefs/testmods_dirs/clm/rootlit/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/rootlit/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/rootlit -A components/clm/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/drydepnomegan/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/drydepnomegan -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetLate -A components/clm/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/deepsoil_bedrock -A components/clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/limit_river_withdraw -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5/user_nl_datm -A components/clm/cime_config/testdefs/testmods_dirs/clm/af_bias_v5 -A components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_3_monthly -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_crop -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLA/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLA/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLA -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLB/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLB/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsRLB -A components/clm/cime_config/testdefs/testmods_dirs/clm/pts/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/pts/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/pts/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/pts -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/decStart -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_long/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_long -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetMid -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrigOn_reduceOutput -A components/clm/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/default/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/default -A components/clm/cime_config/testdefs/testmods_dirs/clm/reduceOutput/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/reduceOutput -A components/clm/cime_config/testdefs/testmods_dirs/clm/edTest/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/edTest/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/edTest -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_sville -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC/user_nl_cpl -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly/user_nl_cpl -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/cropMonthOutput -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ciso -A components/clm/cime_config/testdefs/testmods_dirs/clm/luna/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/luna/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/luna -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/monthly_noinitial -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_from_f09 -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/user_nl_cism -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_increase -A components/clm/cime_config/testdefs/testmods_dirs/clm/cn_conly/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/cn_conly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/cn_conly -A components/clm/cime_config/testdefs/testmods_dirs/clm/allActive/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/allActive -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_spunup_1way -A components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/snowlayers_12 -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsROA/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsROA/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/ptsROA -A components/clm/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/NoVSNoNI -A components/clm/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/SNICARFRC/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/SNICARFRC -A components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/flexibleCN -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_changeFlags -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/crop_trans_f10 -A components/clm/cime_config/testdefs/testmods_dirs/clm/o3/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/o3/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/o3 -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/vrtlay -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/xmlchange_cmnds -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subsetEarly -A components/clm/cime_config/testdefs/testmods_dirs/clm/oldhyd/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/oldhyd -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/interp_f19_noncrop2crop -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/user_nl_cism -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/glcMEC_decrease -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput/include_user_mods -A components/clm/cime_config/testdefs/testmods_dirs/clm/irrig_o3_reduceOutput -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/README -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset/user_nl_clm -A components/clm/cime_config/testdefs/testmods_dirs/clm/tropicAtl_subset -A components/clm/cime_config/testdefs/testmods_dirs/clm -A components/clm/cime_config/testdefs/testmods_dirs -A components/clm/cime_config/testdefs/testlist_clm.xml -A components/clm/cime_config/testdefs -A components/clm/cime_config/user_nl_clm -A components/clm/cime_config/buildlib -A components/clm/cime_config/buildnml - - -List all existing files that have been modified, and describe the changes: - -========= Minor changes for cime3 -M components/clm/bld/CLMBuildNamelist.pm - -========= Port bug 1730 workaround to clm40, fixing bugs 2214 & 2222 -M components/clm/src_clm40/main/histFileMod.F90 -M components/clm/src_clm40/main/ncdio_pio.F90.in - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - (ran unit_testers and test_build_namelist tests) - - unit-tests (components/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_3_r130 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - There are large differences in the anomaly forcing, due to a bug fix that has - been incorporated in the cime3 changes. This changes answers for this test: - - SMS_Ld1.f09_g16.ICRUCLM45.yellowstone_intel.clm-af_bias_v5 - - In addition, there are roundoff-level changes in x2l_Flrr_volr, VOLR and TWS - in these tests: - ERS_E_Ld9.f45_g37.I.yellowstone_intel.clm-default - ERI_D_Ld9.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay - - Also, this BFAILed: - BFAIL ERP_P15x2_Lm36.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrig_o3_reduceOutput.clm2.h1.nc : baseline compare clm2.h1 (baseline: compare .base file with clm4_5_3_r130 file) (baseline history file does not exist) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r130 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Mon Sep 28 11:16:54 MDT 2015 -One-line Summary: add namelist option to reduce lake evaporation and irrigation when river water storage falls below a threshold value, and add an additional constraint on stress deciduous leaf onset. - -Purpose of changes: - - To maintain river storage above a minimum threshold. To add a - second condition that must be fulfilled prior to leaf onset - occurring for stress deciduous pfts. - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): 2213, 2219 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - new namelist flags: - limit_lake_evap_and_irrig - constrain_stress_deciduous_onset - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: unknown, none expected - -Code reviewed by: Sean Swenson, Dave Lawrence, Bill Sacks (irrigation) - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - - clm/cimetest/testmods_dirs/clm/limit_river_withdraw - testmods for new flag - -List all existing files that have been modified, and describe the changes: - - clm/src/biogeochem/CNDriverMod.F90 - add atm2lnd_inst to function call for phenology - clm/src/biogeochem/CNPhenologyMod.F90 - add atm2lnd_inst, new check for stress deciduous - clm/src/biogeochem/CNSharedParamsMod.F90 - new stress deciduous namelist variable - - clm/src/main/init_hydrology.F90 - note - clm/src/main/controlMod.F90 - add limit_lake_evap_and_irrig namelist variable - clm/src/main/clm_driver.F90 - add volr_grc to ApplyIrrigation function call - clm/src/main/clm_varctl.F90 - add limit_lake_evap_and_irrig namelist variable - - clm/src/biogeophys/IrrigationMod.F90 - check for limit irrigation - clm/src/biogeophys/LakeFluxesMod.F90 - check for limit lake evap - clm/src/biogeophys/test/Irrigation_test/test_irrigation_singlepatch.pf - new unit test - clm/src/biogeophys/test/Irrigation_test/IrrigationWrapperMod.F90 - new unit test - - clm/src/unit_test_stubs/utils/spmdMod_stub.F90 - add stub mpi type - - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - new namelist variables - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/CLMBuildNamelist.pm - - clm/cimetest/testlist_clm.xml - new tests - - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - pass - yellowstone_pgi - pass - yellowstone_gnu (clm45 only) pass - hobart_nag - run, ok - -CLM tag used for the baseline comparisons: clm4_5_2_r128/clm4_5_3_r129 - - Note: new test for limit_river_withdraw got dropped from the - testlist during a merge/manage_testlist update. This wasn't noticed - until after baselines were generated. This test was added to the - baselines manually. - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all clm50 compsets - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - When active, these changes will be climate changing. Lake - evaporation and irrigation limitation will change the surface energy - balance by reducing latent heat and increasing sensible heat when - river storage is below a threshold value. Constraining leaf onset - with a secondary constraint will modify vegetation dynamics, - e.g. LAI will differ in magnitude and seasonality, which will change - the surface energy balance by altering evapotranspiration. - - Note: all of the aux_clm tests for clm50 compsets triggered were - bit for bit with the baseline. The stress deciduous flag is on by - default for clm50, and changes should have been observed. Sean - Swenson verified that the flag is active in 30 day runs, so it is - assumed that the shorter three and nine day runs were not enough - to trigger the new code. A new 30 day test was added. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: none - - URL for LMWG diagnostics output used to validate new climate: none - - -=============================================================== -=============================================================== -Tag name: clm4_5_3_r129 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri Sep 25 15:30:39 MDT 2015 -One-line Summary: bump tag revision number because clm4_5_2_r128 was climate changing. - -Purpose of changes: - - Bump tag revision number only. This is the same code base as - clm4_5_2_r128. No additional testing was done. - - Further review of the answer changes in clm4_5_2_r128 indicated - that they were a climate changing bugfix, and the patch level - version number should have been bumped. - - S. Swenson and D. Lawrence performed a code review of the changes - and decided the original calculation of heat capacity for soil - layers > nlevsoi (i.e. bedrock layers) was incorrect due to the - heat capacity being scaled by (1-watsat). This scaling, which - takes into account the presence of soil voids (the porosity), is - not appropriate for the bedrock layers, which are assumed to be - rock rather than soil. The new code simply applies the bedrock - value for heat capacity without the scaling, which leads to an - increase in heat content for bedrock layers. The code change - therefore results in non-b4b changes to the simulation. - - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r128 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Sep 24 10:34:39 MDT 2015 -One-line Summary: science bugfixes for root fraction and bedrock thermal properties. not bit for bit with baseline. - -Purpose of changes: - - 1) To explicitly set rooting fraction to zero in baresoil patches. - - 2) To place definition of bedrock heat capacity in a location - consistent with other bedrock parameters (e.g. thermal conductivity). - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): 2213, 2219 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none expected - -Code reviewed by: Sean Swenson, Dave Lawrence - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M clm/src/biogeophys/SoilTemperatureMod.F90 - move heat capacity from SoilTemperature -M clm/src/biogeophys/LakeTemperatureMod.F90 - include heat capacity of bedrock -M clm/src/biogeophys/SoilStateInitTimeConstMod.F90 - move heat capacity to SoilTemperature -M clm/src/main/clm_varcon.F90 - move vol heat copacity from SoilStateInitTimeConstMod - -M clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 - set root fraction to zero - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - not run - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40 ok, 45 expected not bfb with baseline - yellowstone_pgi - 40 ok, 45 expected not bfb with baseline - yellowstone_gnu (clm45 only) - 40 ok, 45 expected not bfb with baseline - hobart_nag - 45 compiles, bug 2213 - -CLM tag used for the baseline comparisons: clm4_5_2_r127 - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all clm45 and clm50 compsets - - what platforms/compilers: all/all - - nature of change (roundoff; larger than roundoff/same climate; new climate): roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - Monthly history files were compared from a short CLM Swenson case run. - No further testing was performed - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: No runs were performed - - URL for LMWG diagnostics output used to validate new climate: - No diagnostics were generated - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r127 -Originator(s): sacks (Bill Sacks) -Date: Fri Sep 18 10:53:12 MDT 2015 -One-line Summary: Fix interpolation of initial conditions for glc_mec and crop <-> non-crop - -Purpose of changes: - - Fixes the following bugs in initInterp: (1) interpolation of one glc_mec case - to another glc_mec case (due to bug 2126); (2) interpolation of a non-crop - case to a crop case (problems with generic crop type); (3) interpolation of a - crop case to a non-crop case (problems with generic crop type). - - Note: If you want to use initInterp with an old glc_mec initial conditions - file (generated before this tag), you will need to either: (1) run the same - case with this tag or later, without use_init_interp, for at least one time - step to generate a new (fixed) initial conditions file; or (2) overwrite the - pfts1d_topoglc variable on your original initial conditions file so that it - has the correct size. (1) is easier if it is feasible for you to do so. - - Some related changes to initInterp: - - - Changed the "user interface" for interpolating initial conditions: There is - no longer a finidat_interp_source namelist option; instead, you set finidat - to point to the initial conditions file to interpolate, and set the - use_init_interp namelist option to .true. - - - Changed the default behavior so that it does NOT fill missing points (e.g., - landunits that are in the new case but not on the input file) with the bare - ground patch / vegetated landunit. Instead, it dies with an error message - if it can't find a reasonable template column. If you want to it to use the - nearest bare ground / vegetated point in this case, then rerun with - init_interp_fill_missing_with_natveg set to .true. - - - Added system and unit tests of initInterp. System tests include both - interpolation of a file onto an identical configuration, and ensuring they - are bit-for-bit (LII test), and tests that involve interpolation from one - resolution or configuration to another. For the latter, I have done some - very quick checks, but have NOT carefully checked the current operation to - ensure it is correct. - - Some (mostly) unrelated changes: - - (1) Write more metadata on column type to 1-d (vector) history files - - (2) Updated cime; this included, among other things: - - fix RESUBMIT bug - - no longer set FORCE_COLDSTART for glc_mec runs - - addition of LII test - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): -- 1447 (interpinic needs to be extended to work for glc_mec) -- 1703 (need better testing of interpinic) -- 1725 (interpinic doesn't work right for crop) -- 2126 (Error in writing pfts1d_topoglc to restart file) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: -- Removed finidat_interp_source namelist option -- Added use_init_interp and init_interp_fill_missing_with_natveg namelist option - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): - - cime: cime2.0.17 -> cime2.0.18-p1.1 (see summary above) - -List all files eliminated: none - -List all files added and what they do: - -========= Separate testable parts of initInterp into their own module; fix - initInterp bugs as noted above -A components/clm/src/main/initInterpMindist.F90 - -========= Add system tests that exercise initInterp -A components/clm/cimetest/testmods_dirs/clm/interp_from_f09/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/interp_from_f09/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/interp_from_f09/README -A components/clm/cimetest/testmods_dirs/clm/interp_from_f09 -A components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/shell_commands -A components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/README -A components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/glcMEC_spunup_1way -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop/README -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop/README -A components/clm/cimetest/testmods_dirs/clm/interp_f19_noncrop2crop -A components/clm/cimetest/testmods_dirs/clm/interp_f19_crop/README -A components/clm/cimetest/testmods_dirs/clm/interp_f19_crop/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/interp_f19_crop/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/interp_f19_crop - -========= Add unit tests that exercise initInterp: set_mindist -A components/clm/src/main/test/initInterpMindist_test/CMakeLists.txt -A components/clm/src/main/test/initInterpMindist_test/test_init_interp_mindist.pf -A components/clm/src/main/test/initInterpMindist_test - -List all existing files that have been modified, and describe the changes: - -========= Fix incorrect dimension for pfts1d_topoglc -M components/clm/src/main/subgridRestMod.F90 - -========= Remove finidat_interp_source namelist option; add use_init_interp and - init_interp_fill_missing_with_natveg options -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/clm_varctl.F90 - -========= Refactor to split into two modules; parse new namelist option; change - line endings from DOS to UNIX (changes all lines!) -M components/clm/src/main/initInterp.F90 - -========= Write column type metadata to 1-d (vector) history files -M components/clm/src/main/column_varcon.F90 -M components/clm/src/main/histFileMod.F90 -M components/clm/src/main/restFileMod.F90 - -========= Add optional msg argument to check_dim -M components/clm/src/main/ncdio_pio.F90.in - -========= Add system tests that exercise initInterp -M components/clm/cimetest/testlist_clm.xml - -========= Add unit tests that exercise initInterp: set_mindist -M components/clm/src/main/CMakeLists.txt -M components/clm/src/main/test/CMakeLists.txt -M components/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90.in - - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - This test fails; it looks like it started failing in r125: - 131/547 < FAIL> - - unit-tests (components/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - - Note: There was one BFAIL: - BFAIL ERP_P15x2_Lm36.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrig_o3_reduceOutput.clm2.h1.nc : baseline compare clm2.h1 (baseline: compare .base file with clm4_5_2_r126 file) (baseline history file does not exist) - - -CLM tag used for the baseline comparisons: clm4_5_2_r126 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r126 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Thu Sep 17 14:53:49 MDT 2015 -One-line Summary: New decomp_depth_efolding value for clm5.0, set as a namelist parameter instead of netcdf params file. - -Purpose of changes: - Set decomp_depth_efolding as a namelist parameter instead of netcdf params file. New default value for CLM 5.0. - - Improved error message from build namelist when turning on irrigation. - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2190 - -Known bugs (include bugzilla ID): 2213 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: add namelist group bgc_shared and namelist parameter decomp_depth_efolding. New default value for clm 5.0. - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - new defaults for decomp_depth_efolding - clm/bld/namelist_files/namelist_definition_clm4_5.xml - put decomp_depth_efolding in new namelist group - clm/bld/CLMBuildNamelist.pm - logic for new namelist variable, improve error message - clm/src/unit_test_stubs/utils/spmdMod_stub.F90 - add mpi_real8 so unit tests will compile - clm/src/biogeochem/CNSharedParamsMod.F90 - add new method to set parameters from namelist. - clm/src/main/readParamsMod.F90 - pass namelist filename into CNSharedParamsMod::CNParamsReadShared - - -CLM testing: regular - - build-namelist tests: - - yellowstone - unit tests pass - - unit-tests (components/clm/src): - - yellowstone - passed - - tools-tests (components/clm/test/tools): - - yellowstone - n/a - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel : 40 - ok; 45 - ok; 50 - ok, clm50 bgc answer changing - yellowstone_pgi : 40 - ok; 45 - ok; 50 - ok, clm50 bgc answer changing - yellowstone_gnu (clm45 only) : 45 - ok; 50 - ok, clm50 bgc answer changing - hobart_nag : 45 - ok; 50 - ok, clm50 bgc answer changing - -CLM tag used for the baseline comparisons: clm4_5_2_r125 - -Changes answers relative to baseline: yes - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm50 bgc compsets - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): climate changing for clm 5.0 - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - Parameter change based on experiments described in - - Koven, C.D., D.M. Lawrence, and W.J. Riley, 2015: - Permafrost-carbon feedback: Sensitivity to deep soil - decomposability and nitrogen cycle. PNAS, - DOI:10.1073/pnas.1415123112. - - Lawrence, D.M., C.D. Koven, S.C. Swenson, W.J. Riley, and - A.G. Slater, 2015: Permafrost thaw and resulting soil moisture - changes regulate projected high-latitude CO2 and CH4 - emission. ERL, 10, doi:10.1088/1748-9326/10/9/094011. - - URL for LMWG diagnostics output used to validate new climate: - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r125 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue Sep 15 22:08:09 MDT 2015 -One-line Summary: clm 5.0 hydrology - -Purpose of changes: clm 5.0 hydrology - - Dry surface layer soil evaporative resistance from Sean Swenson - Richards equation with adaptive time stepping from Martyn Clark - Zero-flux lower boundary for soil moisture - Deep soil column (10 meters) - Variable depth to bedrock from Sean Swenson - Canopy interception and maximum leaf wetted fraction change - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): unknown - -Known bugs (include bugzilla ID): 2213 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - Added new namelist variables for clm 5.0 hydrology. See namelist - definition file for details. use_bedrock, deep_soilcolumn, - soilwater_movement_method, upeer_boundary_condition, - lower_boundary_condition, soil_resis_method, - rooting_profile_method, interception_fraction, - maximum_leaf_wetted_fraction. - -List any changes to the defaults for the boundary datasets: unknown - -Describe any substantial timing or memory changes: unknown - -Code reviewed by: Sean Swenson - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: unknown - -List all files added and what they do: - - clm/cimetest/testmods_dirs/clm/deepsoil_bedrock - new test for clm50 hydrology options. - - clm/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 - adds placeholder for vanGenuchten soil water retention curve - - -List all existing files that have been modified, and describe the changes: unknown - - clm/cimetest/testlist_clm.xml - new test - - clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 - clm/tools/clm4_5/mksurfdata_map/src/Srcfiles - clm/tools/clm4_5/mksurfdata_map/src/mkvarctl.F90 - clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 - clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - new namelist options - clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - clm/bld/namelist_files/namelist_definition_clm4_5.xml - clm/bld/CLMBuildNamelist.pm - - clm/src/cpl/lnd_import_export.F90 - - clm/src/biogeochem/CNVegStateType.F90 - - clm/src/main/clm_varpar.F90 - clm/src/main/ColumnType.F90 - clm/src/main/init_hydrology.F90 - clm/src/main/controlMod.F90 - clm/src/main/clm_varctl.F90 - clm/src/main/pftconMod.F90 - clm/src/main/initVerticalMod.F90 - clm/src/main/clm_instMod.F90 - - clm/src/biogeophys/WaterStateType.F90 - clm/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 - clm/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 - clm/src/biogeophys/SoilWaterRetentionCurveMod.F90 - clm/src/biogeophys/IrrigationMod.F90 - clm/src/biogeophys/SurfaceResistanceMod.F90 - clm/src/biogeophys/HydrologyDrainageMod.F90 - clm/src/biogeophys/RootBiophysMod.F90 - clm/src/biogeophys/BalanceCheckMod.F90 - clm/src/biogeophys/SoilWaterMovementMod.F90 - clm/src/biogeophys/SoilMoistStressMod.F90 - clm/src/biogeophys/CanopyHydrologyMod.F90 - clm/src/biogeophys/CanopyTemperatureMod.F90 - clm/src/biogeophys/SoilHydrologyMod.F90 - clm/src/biogeophys/HydrologyNoDrainageMod.F90 - clm/src/biogeophys/SoilStateType.F90 - clm/src/biogeophys/SoilHydrologyType.F90 - clm/src/biogeophys/BareGroundFluxesMod.F90 - clm/src/biogeophys/CanopyFluxesMod.F90 - clm/src/biogeophys/SoilStateInitTimeConstMod.F90 - - clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 - clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 - -CLM testing: - - build-namelist tests: - - yellowstone - CLMBuildNamelist unit tests pass - - unit-tests (components/clm/src): - - yellowstone - pass - - tools-tests (components/clm/test/tools): - - yellowstone - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone - n/a - - regular tests (aux_clm40, aux_clm45): - - NOTE: for all aux_clm45 machine/compiler combinations - clm50 compsets not bit for bit with baseline (new hydrology model is used). - - yellowstone_intel : aux_clm40 - pass; aux_clm45 - clm 45 compsets pass, clm50 compsets not bit for bit - yellowstone_pgi : aux_clm40 - pass; aux_clm45 - clm 45 compsets pass, clm50 compsets not bit for bit - yellowstone_gnu (clm45 only) : aux_clm45 - clm 45 compsets ok, clm50 compsets not bit for bit - hobart_nag : aux_clm45 - clm 45 compsets ok, clm50 compsets not bit for bit. bug 2213 still applies for clm45 compsets. - -CLM tag used for the baseline comparisons: clm4_5_2_r124 - -Changes answers relative to baseline: - clm40 and clm45 compsets are bit for bit. clm50 compsets are answer changing. - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all clm50 compsets - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): larger than roundoff, unknown climate. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: unknown - - URL for LMWG diagnostics output used to validate new climate: - unknown - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r124 -Originator(s): sacks (Bill Sacks) -Date: Sun Sep 13 06:33:20 MDT 2015 -One-line Summary: Wind-dependent snow density - -Purpose of changes: - - Add an option to make snow density dependent on wind speed. There are two - components to this: (1) adding a wind-related factor to the fresh snow - density, and (2) adding a wind-related factor for the compaction of the - existing snow pack (applying just to the top layer). This allows for more - realistic (higher) fresh snow densities in windy conditions. - - Other than myself, contributors to these changes are: Jan Lenaerts, Leo van - Kampenhout and Drew Slater. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: new option: 'wind_dependent_snow_density' - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Renamed -D components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology.pf - -List all files added and what they do: - -========= Tests of some of the new code -A components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_windCompactionFactor.pf - -========= Renamed -A components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_initSnowLayers.pf - -List all existing files that have been modified, and describe the changes: - -========= Add wind-dependent snow density parameterizations and control flag -M components/clm/src/main/controlMod.F90 -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm - -========= Add tests for some of the new code -M components/clm/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - unit-tests (components/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_2_r123 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all CLM50 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; magnitude not investigated in detail - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r123 -Originator(s): sacks (Bill Sacks) -Date: Thu Sep 10 10:25:55 MDT 2015 -One-line Summary: Fix some problems with pgi and nag compilers - -Purpose of changes: - - (1) Fix some problems with the nag compiler: fix bug 2208, but open new bug - 2213 - - (2) Work around some problems that appear with pgi 15.7 (appear to be - compiler bugs), which Sean Santos tracked down: The key problem is that - PGI is exporting some names that should have been aliased. So for - instance: - - use foo_mod, only: foo_bar => bar - - In this case, if you have a "use" without an "only" of foo_mod, you get - both foo_bar and bar imported into the namespace. - - Note: I have not been able to test these changes with pgi 15.7, because - there is a PIO build problem with pgi 15.7 - - (3) No longer kill the run if we're using ozone with pgi: The pgi compiler - bug that showed up with the ozone code has been fixed as of pgi 15.1, - which is now our default. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 2208: nag reports a problem with associate statement to un-allocated LUNA - memory in photosynthesisMod (but see new bug 2213) - 2094: ozone code doesn't work with the PGI compiler - -Known bugs (include bugzilla ID): - 2213: CLM45 / CLM50 runs without BGC die with NAG compiler, due to associate - to unallocated memory - - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Fix for pgi 15.7. CLM40 changes from Sean Santos; I ported these - changes to CLM45 -M components/clm/src_clm40/main/lnd_comp_mct.F90 -M components/clm/src_clm40/main/spmdGathScatMod.F90 -M components/clm/src/cpl/lnd_comp_mct.F90 -M components/clm/src/utils/spmdGathScatMod.F90 - -========= Fix for nag from Ben Andre -M components/clm/src/biogeophys/PhotosynthesisMod.F90 - -========= No longer abort if running with pgi -M components/clm/src/biogeophys/OzoneMod.F90 - -========= Remove ozone pgi test, because it runs out of wallclock time (but I - believe it would now pass: a shorter version now passes) -M components/clm/cimetest/testlist_clm.xml - -========= Update xFails: Add hobart_nag xFails, remove no-longer-relevant or - no-longer-failing tests (many have been passing for a while now) -M components/clm/cimetest/ExpectedTestFails.xml - - -CLM testing: - - unit-tests (components/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: ok - However, all runs without BGC still die: see bug 2213 and - ExpectedTestFails list - -CLM tag used for the baseline comparisons: clm4_5_2_r122 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r122 -Originator(s): sacks (Bill Sacks) -Date: Wed Sep 9 05:57:15 MDT 2015 -One-line Summary: Update to latest cime - -Purpose of changes: - - Update cime to the version likely to be in cesm1_4_beta07 - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: none - -List any svn externals directories updated (cime, rtm, cism, etc.): - - cime2.0.7 -> cime2.0.17 - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Change instructions: no longer need dot in your path -M components/clm/src/README.unit_testing - -========= Remove CME and NCK expected failures: these pass now, presumably due - to fixes in cime (although since the failures were intermittent, it's - hard to say definitively that the problem is fixed) -M components/clm/cimetest/ExpectedTestFails.xml - -- CFAIL CME_Ld5.f10_f10.ICN.yellowstone_intel -- CFAIL CME_Ly4.f10_f10.I1850CLM45BGC.yellowstone_intel.clm-monthly -- FAIL NCK_Ld1.f10_f10.ICRUCLM45.yellowstone_intel.clm-default -- RUN NCK_Ld1.f10_f10.ICRUCLM45.yellowstone_intel.clm-default - -CLM testing: - - unit-tests (components/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: clm40 ok, CLM45 NOT RUN - Note that there is still a problem with clm45 nag - -CLM tag used for the baseline comparisons: clm4_5_2_r121 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_2_r121 -Originator(s): sacks (Bill Sacks) -Date: Fri Sep 4 10:55:54 MDT 2015 -One-line Summary: Rework snow capping - -Purpose of changes: - - Main change is a complete rework of snow capping. Previously, when the snow - pack was in a "capped" state (i.e., h2osno >= h2osno_max), new snow and rain - were prevented from falling on the snow pack: it was as if someone put a roof - over the snow. (However, there were workarounds in place that caused the - aerosol concentration and snow grain size in the top snow layer to continue - to evolve as if new snow was still falling.) This was problematic in terms of - the long-term evolution of the snow pack, since in effect the new, less dense - snow was being removed due to capping. So, at least in some regions, the snow - pack became much more dense than it should be. - - The new snow capping scheme allows snow and rain to fall on the top as they - would in the uncapped state. But if h2osno exceeds h2osno_max, then mass is - removed from the *bottom* snow layer. This removes the need for the old - workarounds, and is more physically realistic: This represents the process of - converting snow to glacial ice, which in reality occurs at the bottom (most - dense) portion of the snow pack. - - - Also, a mostly-unrelated change: rearrange the multi-layer snow history - fields, so that index 1 is always the top of the snow pack. - - - These changes are from Leo van Kampenhout (l.vankampenhout@uu.nl) - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Rework handling of snow capping. This is now done pretty much entirely - in SnowHydrologyMod, in a completely different way than before. -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/LakeFluxesMod.F90 -M components/clm/src/biogeophys/SoilFluxesMod.F90 -M components/clm/src/biogeophys/WaterStateType.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 -M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/main/clm_driver.F90 - -========= Remove some old workarounds that were put in place to get reasonable - answers with the old snow capping method -M components/clm/src/biogeophys/AerosolMod.F90 -M components/clm/src/biogeophys/SnowSnicarMod.F90 - -========= Rearrange multi-layer snow history fields -M components/clm/src/main/histFileMod.F90 -M components/clm/doc/UsersGuide/custom.xml - -========= Trivial changes (removing associate lines, changing comments, etc.) -M components/clm/src/biogeophys/HydrologyDrainageMod.F90 -M components/clm/src/biogeophys/SoilHydrologyMod.F90 -M components/clm/src/biogeophys/CanopyTemperatureMod.F90 -M components/clm/src/biogeophys/UrbanFluxesMod.F90 -M components/clm/src/biogeochem/ch4Mod.F90 - - -CLM testing: - - unit-tests (components/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - hobart_nag: NOT RUN - hobart_nag tests still all fail, as they did in clm4_5_1_r120 - -CLM tag used for the baseline comparisons: clm4_5_1_r120 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All clm4.5 and clm5.0 configurations - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Definitely larger than roundoff. Whether this is the same or new climate - has not been investigated carefully. However, at least in some regions - with persistent snow cover, this change has a significant effect on the - evolution of the snow pack, as described above. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r120 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Sat Aug 29 22:58:57 MDT 2015 -One-line Summary: CLM 5 nitrogen models Flexible CN and LUNA - -Purpose of changes: - CLM 5 nitrogen models Flexible CN (Bardan Ghimire, LBNL) - and LUNA (Chonggang Xu, LANL). The LUNA model predicts - photosynthetic capacities as measured by Vc, max25 and Jmax25 - under different environmental conditions (see Ali et al 2015). - -Requirements for tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - 2208 - https://github.com/CESM-Development/cime/issues - 115, 116 - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - addition of use_luna and use_flexibleCN. use_flexibleCN adds - additional namelist options in the clm_nitrogen group. See xml - definitions file for details. - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self, Bardan Ghimire, Chonggang Xu - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 - flexibleCN. - cimetest/testmods_dirs/clm/flexibleCN - flexible cn regression test - src/biogeophys/LunaMod.F90 - luna model - cimetest/testmods_dirs/clm/luna - luna regression case - -List all existing files that have been modified, and describe the changes: - - new namelist controls for flexibleCN and luna, clm_nitrogen namelist group: - bld/namelist_files/namelist_definition_clm4_5.xml - bld/namelist_files/namelist_defaults_clm4_5.xml - bld/CLMBuildNamelist.pm - src/main/clm_varctl.F90 - src/main/controlMod.F90 - - flexibleCN - src/biogeochem/CNVegCarbonStateType.F90 - Michaelis-Menten Nitrogen uptake - src/biogeochem/CNVegNitrogenStateType.F90 - Michaelis-Menten Nitrogen uptake - - src/biogeochem/CNGRespMod.F90 - excess carbon storage - src/biogeochem/CNGapMortalityMod.F90 - excess carbon storage - - src/biogeochem/NutrientCompetitionFactoryMod.F90 - add flexible cn option - src/biogeochem/NutrientCompetitionMethodMod.F90 - modify interface to accomidate flexiblecn - src/biogeochem/CNPhenologyMod.F90 - floating cn evergreen phenology - src/biogeochem/CNDriverMod.F90 - update function call args - src/main/pftconMod.F90 - flexible cn pft variables - - src/main/histFileMod.F90 - nlev canopy - src/main/clm_driver.F90 - update function call args - src/main/clm_instMod.F90 - update function call args - src/biogeophys/WaterfluxType.F90 - additional water flux vars - src/biogeophys/SoilWaterMovementMod.F90 - soil water work around - - LUNA - src/main/clm_varcon.F90 - new constant for luna - src/biogeophys/PhotosynthesisMod.F90 - luna use of vcmax25 and jmax25 - src/biogeophys/CanopyFluxesMod.F90 - luna calculation of vcmax25 and jmax25 - src/main/atm2lndType.F90 - state data needed for luna - src/biogeophys/FrictionVelocityMod.F90 - luna variables - src/biogeophys/WaterStateType.F90 - luna variables - src/biogeophys/TemperatureType.F90 - luna variables - src/biogeophys/SolarAbsorbedType.F90 - luna variables - src/biogeophys/QSatMod.F90 - saturated vapor pressure density - src/biogeophys/SoilHydrologyType.F90 - luna var - src/biogeophys/CanopyStateType.F90 - update vcmax and jmax for luna - - cimetest/ExpectedTestFails.xml - update for cime bugs 115 and 116 - cimetest/testlist_clm.xml - update test list for aux_clm_short, new luna and flexibleCN tests - - -CLM testing: regular, build-namelist - - build-namelist tests: - - yellowstone - unit tests : pass, other pass - - unit-tests (components/clm/src): - - yellowstone - ok - - tools-tests (components/clm/test/tools): n/a - - PTCLM testing (components/clm/tools/shared/PTCLM/test): n/a - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel - 40 ok, 45 ok - yellowstone_pgi - 40 ok, 45 ok - yellowstone_gnu (clm45 only) ok - hobart_nag - not run, tests hang, see bug 2208 - - Testing notes: - - * new namelist group clm_nitrogen causes all nlcomp tests to fail - * introduces new tests for flexibleCN and luna that do not - have baselines in clm4_5_1_r119. - * two new expected fails believed to be related to cime issues - 115 and 116. - * removes the existing aux_clm_short tests and replaces them with - a new set of SMS, ERS and ERP tests that are replicated for - yellowstone gnu, intel and pgi. - -CLM tag used for the baseline comparisons: clm4_5_1_r119 - -Changes answers relative to baseline: none - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r119 -Originator(s): erik (Erik Kluzek) -Date: Wed Aug 26 22:29:10 MDT 2015 -One-line Summary: Bring hobart/nag bug fixes to trunk, and fix a few bugs - -Purpose of changes: - -Bring hobart/nag bug fixes to trunk. Fix ncl6.3.0 bug for getregional script. -Fix use_c13 bug. Update RTM to handle regional direction files. Make sure _r8 -constants in ED have a decimal point, so the NAG compiler will treat them as -double-precision rather than as integer*2. - -Move testing from goldbach to hobart. For hobart_nag make all of the tests -on just one node (24 processors). - -Requirements for tag: compile run with hobart/nag (fix bugs 2205 and 2199) - move testing from goldbach to hobart - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 2206 (PTCLM stopped working with pft number in surface dataset filenames for mksurfdata.pl) - 2205 (Problems with some constants in ED for NAG compiler) - 2199 (crayftn compiler issue with continuation in middle of string) - 2180 (ncl6.3.0 bug for getregional script) - 2174 (use_c13 bug, unformatted write caused model to die) - 2156 (Update RTM to handle regional direction files) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, klindsay - -List any svn externals directories updated (cime, rtm, cism, etc.): PTCLM, cime and rtm - cime to cime2.0.07 - rtm to rtm1_0_52 - PTCLM to PTCLM2_150826 - -List all files eliminated: Move goldbach to hobart - -D components/clm/test/tools/tests_posttag_goldbach_nompi - -List all files added and what they do: Move goldbach to hobart - -A components/clm/test/tools/tests_posttag_hobart_nompi - -List all existing files that have been modified, and describe the changes: - ------------- Move goldbach to hobart, remove PGI option for hobart -M components/clm/test/tools/test_driver.sh - -M components/clm/bld/unit_testers/build-namelist_test.pl -- Fix ED tests so megan off - -M components/clm/cimetest/testlist_clm.xml --- Move goldbach tests to hobart - Make 2-node hobart_nag tests on a single node - -M components/clm/tools/shared/mkmapgrids/mkscripgrid.ncl -- Fix so will - work with ncl6.3.0, bug 2180 - -M components/clm/src/README.unit_testing --- add some notes about unit-testing - ------------- Bug 2205, some _r8 constants in ED don't have a decimal point ------------- and the NAG compiler then treats them as integer*2. -M components/clm/src/ED/main/EDCLMLinkMod.F90 -M components/clm/src/ED/main/EDRestVectorMod.F90 -M components/clm/src/ED/main/EDInitMod.F90 -M components/clm/src/ED/fire/SFMainMod.F90 -M components/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 -M components/clm/src/ED/biogeophys/EDBtranMod.F90 -M components/clm/src/ED/biogeochem/EDGrowthFunctionsMod.F90 -M components/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 -M components/clm/src/ED/biogeochem/EDPhysiologyMod.F90 -M components/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 - ------------- Bug 2199, write to iulog was unformatted, which caused the model ------------- to die after it had already done formatted writes. -M components/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -M components/clm/src/biogeochem/CNVegCarbonStateType.F90 - -CLM testing: - - build-namelist tests: - - yellowstone yes - - unit-tests (components/clm/src): - - yellowstone yes - - tools testing (components/clm/test/tools): - - yellowstone yes - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, aux_clm_short): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu (clm45 only) yes - hobart_nag yes - hobart_pgi yes - hobart_intel yes - -CLM tag used for the baseline comparisons: clm4_5_1_r118 - -Changes answers relative to baseline: no - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r118 -Originator(s): sacks (Bill Sacks) -Date: Wed Aug 5 16:22:33 MDT 2015 -One-line Summary: Minor rework of glc coupling fields - -Purpose of changes: - - This makes CLM compatible with recent CIME changes. - - (1) Use renamed coupler field, in both clm40 and clm45 - - (2) In clm45 code, rework clm_cpl_indices to use glc_elevclass_mod (simpler - and more robust than the earlier code) - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): - - cime1.1.11 -> cime2.0.0 - cism2_0_09 -> cism2_1_02 - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Main changes -M components/clm/src/cpl/clm_cpl_indices.F90 -M components/clm/src/cpl/lnd_import_export.F90 -M components/clm/src_clm40/main/clm_cpl_indices.F90 -M components/clm/src_clm40/main/lnd_import_export.F90 - -========= Document new unit testing method needed for yellowstone, due to cime update -M components/clm/src/README.unit_testing - -========= Rework test mods due to a fundamental change in how the forced - decrease / increase in glc area works -M components/clm/cimetest/testmods_dirs/clm/glcMEC_decrease/user_nl_cism -M components/clm/cimetest/testmods_dirs/clm/glcMEC_increase/user_nl_cism - -========= New failures, which seem to be attributable to the cime update, - unrelated to my changes. However, the NCK and CME test failures seem - dependent on the order in which tests are run, so these problems are - hard to reproduce. Running them as single tests leads to PASSes. -M components/clm/cimetest/ExpectedTestFails.xml -+ CFAIL CME_Ld5.f10_f10.ICN.yellowstone_intel -+ FAIL NCK_Ld1.f10_f10.ICRUCLM45.yellowstone_intel.clm-default -+ RUN ERS_D_Mmpi-serial_Ld5.1x1_brazil.ICLM45ED.yellowstone_gnu.clm-edTest - - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - but see caveat below! - -As noted above, there are three new test failures. The ERS_D ICLM45ED failure -seems to be a legitimate bug in CLM. The other two (CFAIL -CME_Ld5.f10_f10.ICN.yellowstone_intel and FAIL -NCK_Ld1.f10_f10.ICRUCLM45.yellowstone_intel.clm-default) seem to be intermittent -failures, likely due to a bug in the test system or elsewhere in cime. These -sometimes pass and sometimes fail. They always seem to pass when run as single -tests, but sometimes fail when run as part of a test suite. It's not clear if -the new cime is to blame directly, or if these are arising now simply because -tests are being run in a different order. - -golbach-nag does not run out-of-the-box with this tag. However, it should run -out-of-the-box if you merge in the next commit in cime master -(4b52ec73086a4290323dddfde6087a6d6d12ab96). I did my changes with that commit -merged in, but this hadn't come to master in time for me to include it in this -CLM tag. - -CLM tag used for the baseline comparisons: clm4_5_1_r117 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Configurations with CISM (IG), both CLM4 and CLM45 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Likely larger than roundoff/same climate (but not investigated closely) - - These changes are due to a complete rework of the coupling between CISM - and CLM, manifested as major changes in the CIME and CISM externals. (The - changes in CLM are not directly responsible for the answer changes.) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r117 -Originator(s): sacks (Bill Sacks) -Date: Tue Jul 28 06:01:04 MDT 2015 -One-line Summary: Repartition rain vs. snow from atmosphere - -Purpose of changes: - - Add an option to repartition rain vs. snow from atmosphere based on - near-surface temperature. This repartitioning uses a ramp-based partitioning - that is also used in datm: we ignore the rain vs. snow partitioning sent from - the atmosphere, and generate our own rain vs. snow partitioning. A sensible - heat flux is generated to conserve energy with this repartitioning. - - The motivation for this is two-fold: - - (1) There are biases in CAM which cause rain to be generated in cold - conditions. This is particularly a problem for glacier surface mass - balance in Greenland. Andrew Gettelman has suggested putting in place - this workaround in CLM until CAM can find a robust fix. - - (2) With the downscaling to glacier elevation classes, it is useful to have - a different rain/snow partitioning in each elevation class. - - This repartitioning is on by default in CLM5, off by default in CLM4.5. - - If / when the CAM bias is fixed, we could potentially change this code so - that it just does the repartitioning over the do_smb filter, similarly to the - other downscaling in atm2lndMod. (Rather than doing this correction - everywhere - which we do now in order to correct the rain vs. snow - partitioning bias in CAM.) - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - Removed glcmec_downscale_rain_snow_convert option, added - repartition_rian_snow option - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Sean Swenson reviewed the calculation of the sensible heat -flux correction - -List any svn externals directories updated (cime, rtm, cism, etc.): - - cime1.1.10 -> cime1.1.11 - This creates a new shared routine for partitioning rain vs. snow, now shared - between datm and CLM. - -List all files eliminated: - -List all files added and what they do: - -========= Add unit tests for repartitioning of rain vs snow, and supporting - utility code -A components/clm/src/main/test/atm2lnd_test/test_sens_heat_from_precip_conversion.pf -A components/clm/src/main/test/atm2lnd_test/CMakeLists.txt -A components/clm/src/main/test/atm2lnd_test/test_partition_precip.pf -A components/clm/src/main/test/atm2lnd_test -A components/clm/src/unit_test_shr/unittestArrayMod.F90 -A components/clm/src/unit_test_shr/test/unittestArray_test/CMakeLists.txt -A components/clm/src/unit_test_shr/test/unittestArray_test/test_unittestArray.pf -A components/clm/src/unit_test_shr/test/unittestArray_test - -List all existing files that have been modified, and describe the changes: - -========= Repartition rain vs snow from atmosphere, and add a sensible heat flux - correction for energy conservation -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/src/main/clm_driver.F90 -M components/clm/src/main/clm_varctl.F90 -M components/clm/src/main/controlMod.F90 -M components/clm/src/main/atm2lndType.F90 -M components/clm/src/main/lnd2atmType.F90 -M components/clm/src/main/atm2lndMod.F90 -M components/clm/src/main/lnd2atmMod.F90 - -========= Remove glcmec_rain_snow_threshold -M components/clm/src/main/clm_varcon.F90 - -========= Remove glcmec_downscale_rain_snow_convert option, add - repartition_rain_snow option -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm - -========= Add an IG CLM5 test -M components/clm/cimetest/testlist_clm.xml - -========= Remove glcmec_downscale_rain_snow_convert setting (which no longer exists) -M components/clm/cimetest/testmods_dirs/clm/glcMEC_changeFlags/user_nl_clm - -========= Add unit tests for repartitioning of rain vs snow, and supporting - utility code -M components/clm/src/main/CMakeLists.txt -M components/clm/src/main/test/CMakeLists.txt -M components/clm/src/biogeophys/CMakeLists.txt -M components/clm/src/unit_test_shr/test/CMakeLists.txt -M components/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 -M components/clm/src/unit_test_shr/CMakeLists.txt - -CLM testing: - - build-namelist tests: - - yellowstone: ok (changes namelists, as expected) - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r116 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM5 cases - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Likely new climate, but not investigated closely - - Answer changes are due to new rain vs. snow partitioning, which is on by - default in CLM5. - - Also changes answers for - ERP_D_Ld5.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC_changeFlags - (expected, since it no longer downscales precip). - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r116 -Originator(s): sacks (Bill Sacks) -Date: Wed Jul 22 06:39:28 EDT 2015 -One-line Summary: Rename some history fields - -Purpose of changes: - - (1) Make QSNOMELT point to qflx_snomelt, as it does in CLM4.0, rather than - qflx_snow_drain (previously qflx_snow_melt) - - (2) Turn on QSNOFRZ by default (parallels QSNOMELT) - - (3) For the 3 history fields that have FOO and FOO_NODYNLNDUSE versions: - Rename FOO to FOO_TO_COUPLER and FOO_NODYNLNDUSE to FOO. This is at Sean - Swenson's suggestion: He points out that the version without the dyn landuse - adjustment (and, soon, the sensible heat adjustment from rain/snow - conversion) is the one most people will be interested in, so should be the - one without the suffix. - - (4) Tweak test lists: - - (a) Move prealpha & prebeta goldbach tests to hobart - - (b) Move an aux_clm45 pgi test to intel: With recent versions of cime - (starting with cime1.1.0), threading tests with pgi take a very long time. So - this test took 3 hours with pgi, vs 20 min with intel. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 2178 (QSNOMELT incorrect in clm4.5) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= See summary above -M components/clm/src/main/lnd2atmType.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/EnergyFluxType.F90 -M components/clm/cimetest/testlist_clm.xml - - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: NOT RUN - mac: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r115 - -Changes answers relative to baseline: YES - - Just changes a few diagnostic fields, for CLM4.5 and CLM5: - - - QSNOMELT: changed to qflx_snomelt rather than qflx_snow_drain - - - QRUNOFF: differs for cases with transient landcover - - - FSH: differs for cases with CISM - - - QSNWCPICE: differs for cases with CISM - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r115 -Originator(s): sacks (Bill Sacks) -Date: Wed Jul 15 05:26:37 MDT 2015 -One-line Summary: Remove redundant code, rename a variable - -Purpose of changes: - - (1) Remove some redundant code in SnowHydrologyMod, related to 'void'. This - was supposed to be removed a long time ago. (Apparently the issue this was - trying to fix was fixed in a different, more robust way.) - - (2) Remove redundant, unused copy of accumulMod in utils/ (newer copy is in - main/) - - (3) Rename qflx_snow_melt to qflx_snow_drain, to avoid confusion with the - existing qflx_snomelt. - - (4) Clarify documentation of snowdp_col - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: - -========= Redundant and unused (copy in main/ is used) -D components/clm/src/utils/accumulMod.F90 - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Rename qflx_snow_melt to qflx_snow_drain -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 -M components/clm/src/biogeophys/LakeHydrologyMod.F90 -M components/clm/src/biogeophys/BalanceCheckMod.F90 -M components/clm/src/biogeophys/WaterfluxType.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - - also remove redundant lines of code related to 'void' (see above) -M components/clm/src/biogeophys/LakeTemperatureMod.F90 - -========= Clarify documentation for snowdp_col -M components/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M components/clm/src/biogeophys/WaterStateType.F90 - -========= Remove SMS_Lm25.f10_f10.ICLM45BGCCROP.goldbach_nag.clm-reduceOutput - (runs out of wall-clock time, and we have sufficient test coverage of - that configuration) -M components/clm/cimetest/testlist_clm.xml - - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r114 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r114 -Originator(s): sacks (Bill Sacks) -Date: Fri Jul 10 19:34:57 MDT 2015 -One-line Summary: Update cime external, remove genf90-generated files - -Purpose of changes: - - Main purpose is to update the cime external to the version in cesm1_4_beta05. - - This also required updating the unit test build to use genf90 during the - build rather than relying on already-generated files. - - Making this change led to some genf90'd files being regenerated in-source - during the unit test build, which would lead these files to be updated every - time we make a tag. To avoid this annoyance, I have removed the genf90'd - files from the repository: These are not needed any more in either the unit - test or system builds, and it simplifies things to remove them. - - Then I added an svn:ignore property to ignore files generated by genf90 - during the unit test build. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): - - cime1.0.7 -> cime1.1.10 - - Among other things, this brings in Jay's big batch system refactor - -List all files eliminated: - -========= Remove genf90-generated files, and some scripts that were used to - create them (these are now created as part of the unit test or system build) -D components/clm/src/dyn_subgrid/dynVarMod.F90 -D components/clm/src/dyn_subgrid/dynVarTimeInterpMod.F90 -D components/clm/src/dyn_subgrid/dynVarTimeUninterpMod.F90 -D components/clm/src/dyn_subgrid/do_genf90 -D components/clm/src/unit_test_stubs/utils/do_genf90 -D components/clm/src/unit_test_stubs/utils/restUtilMod_stub.F90 -D components/clm/src/unit_test_stubs/main/ncdio_var.F90 -D components/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90 -D components/clm/src/unit_test_stubs/main/do_genf90 -D components/clm/src/utils/restUtilMod.F90 -D components/clm/src/main/ncdio_pio.F90 - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Generate files with genf90 rather than using pre-generated files -M components/clm/src/CMakeLists.txt - -========= Document new, simpler method for building and running the unit tests - (thanks largely to new default options in run_tests.py) -M components/clm/src/README.unit_testing - -========= Add svn:ignore property to ignore files generated by genf90 during the - unit test build - M components/clm/src/dyn_subgrid - M components/clm/src/unit_test_stubs/utils - M components/clm/src/unit_test_stubs/main - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r112 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: intel - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff, according to cime documentation - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A: Trusting Sean Santos's cime documentation. - - These changes were likely due to this change in cime: - - commit 0d7eab6bd112565ba9eb6eb82b74127ae5a5f390 - Author: Sean Patrick Santos - Date: Fri May 15 12:35:31 2015 -0600 - - Use our native gamma/erf implementations on Intel - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r113 -Originator(s): sacks (Bill Sacks) -Date: Thu Jul 9 10:01:13 MDT 2015 -One-line Summary: Support backwards compatibility of restart variable names - -Purpose of changes: - - Previously, if a restart variable was renamed, backwards compatibility was - implemented in an ad-hoc manner. A key point is taht none of these ad-hoc - solutions allowed backwards compatibility when running - initInterp. (initInterp would just skip any variable if it could not find an - exact match on the input [template] file.) - - This tag provides a standard mechanism for putting in place backwards - compatibility when renaming a restart variable. This backwards compatibility - carries over to initInterp, by communicating the necessary metadata through a - new attribute on the restart file: 'varnames_on_old_files'. - - In order to use this new mechanism, give a colon-delimited list of variable - names in the varname argument to restartvar. For example, if a restart - variable FOO has been renamed to BAR, then specify varname='BAR:FOO'. Note - that this list is searched in order, and the first item should be the current - restart variable name. - - Also, applied this new mechanism to the recently-added LIQCAN - variable. Previously, backwards compatibility of this variable was handled in - an ad-hoc manner, which did not work when running initInterp. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Erik - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Add module for higher-level netcdf utilities. Currently contains - routine for finding a variable on a netcdf file from a list of - possible variables. Also add unit tests for this routine. -A components/clm/src/main/ncdio_utils.F90 -A components/clm/src/main/test/ncdio_utils_test/test_ncdio_utils.pf -A components/clm/src/main/test/ncdio_utils_test/CMakeLists.txt -A components/clm/src/main/test/ncdio_utils_test - -List all existing files that have been modified, and describe the changes: - -========= Allow multiple possible names in reading restart files and in reading - the 'input' file in initInterp -M components/clm/src/utils/restUtilMod.F90.in -M components/clm/src/utils/restUtilMod.F90 -M components/clm/src/main/initInterp.F90 - -========= Apply new mechanism to recently-added LIQCAN restart field. Also - remove redundant setting of snocan_patch to 0 if it isn't found on the - restart file - not needed since initCold is always called. -M components/clm/src/biogeophys/WaterStateType.F90 - -========= Changes to support unit testing of ncdio_utils -M components/clm/src/main/CMakeLists.txt -M components/clm/src/main/test/CMakeLists.txt -M components/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90.in -M components/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90 - -========= Fix path to genf90 for new cime organization -M components/clm/src/unit_test_stubs/main/do_genf90 -M components/clm/src/unit_test_stubs/main/ncdio_var.F90 - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r112 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r112 -Originator(s): oleson (Keith Oleson,UCAR/TSS,303-497-1332) -Date: Wed Jul 1 10:14:11 MDT 2015 -One-line Summary: Justin Perket snow on vegetation - -Purpose of changes: Incorporate Justin Perket's snow on vegetation changes - -Requirements for tag: - -Test level of tag: regular, build-namelist, unit_tests - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: Add snowveg_flag item - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Keith Oleson, Justin Perket, Erik Kluzek - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: -M components/clm/src/README.unit_testing Add note that instructions are for bash shell -M components/clm/src/biogeophys/CanopyFluxesMod.F90 snow/liq on vegetation -M components/clm/src/biogeophys/WaterStateType.F90 history/restart handling for snow/liq on vegetation -M components/clm/src/biogeophys/BalanceCheckMod.F90 line spaces only -M components/clm/src/biogeophys/WaterfluxType.F90 history handling for snow on vegetation -M components/clm/src/biogeophys/CanopyHydrologyMod.F90 snow/liq on vegetation and snowveg_flag handling -M components/clm/src/biogeophys/SurfaceAlbedoMod.F90 snow on vegetation optical properties -M components/clm/src/main/controlMod.F90 line spaces only -M components/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml snowveg_flag handling -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml snowveg_flag handling -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml snowveg_flag handling -M components/clm/bld/CLMBuildNamelist.pm snowveg_flag handling - -CLM testing: - - build-namelist tests: - - yellowstone: ok - All CLM45 and CLM50 tests have namelist differences; this is expected due - to addition of new namelist item - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r111 - -Changes answers relative to baseline: Yes, for CLM50 - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM50 - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - New climate. See Justin Perket (perketj@umich.edu) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? NA - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: NA - - URL for LMWG diagnostics output used to validate new climate: NA - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r111 -Originator(s): sacks (Bill Sacks) -Date: Fri Jun 12 20:19:25 MDT 2015 -One-line Summary: Remove temporary hack to get bfb results in InitSnowLayers - -Purpose of changes: - - In order to get bit-for-bit results in clm4_5_1_r110 (relative to r109), we - put in place a temporary hack in InitSnowLayers that set dz based on the old - equations rather than the new, more general ones - thus avoiding - roundoff-level changes. This looked like: - - if (abs(dz(c,0)-3.59_r8) < eps) then ! TODO remove - col%dz(c, 0) = snow_depth(c)-col%dz(c,-4)-col%dz(c,-3)-col%dz(c,-2)-col%dz(c,-1) - if (abs(dz(c,0)-3.59_r8) > eps) & - call endrun(msg=errmsg(__FILE__, __LINE__)) - endif - - This tag removes that temporary hack. - - In this way, we have separated the answer-changing from non-answer-changing - parts of the r110 refactor. Note that the above code confirms that the - differences are no larger than roundoff (eps was 1e-9 in the above case, but - some tests showed that it could have been much smaller - e.g., ~ 1e-15). - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r110 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM4.5 / CLM5 cold start - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - See above code sample, which confirms that the changes were no greater - than roundoff-level. - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r110 -Originator(s): sacks (Bill Sacks) -Date: Fri Jun 12 15:30:11 MDT 2015 -One-line Summary: Add flexibility to have more snow layers - -Purpose of changes: - - Generalize snow code so that it no longer assumes 5 snow layers. Instead, - make the number of snow layers (and the maximum SWE in the snow pack) a - runtime parameter, allowing 3 - 12 snow layers. - - Most changes were made by Leo van Kampenhout (l.vankampenhout@uu.nl). - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 2182 (possible threading issue with optimized pgi builds) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - new namelist parameters: nlevsno, h2osno_max - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: - -========= Add tests with different number of snow layers -A components/clm/cimetest/testmods_dirs/clm/snowlayers_12/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/snowlayers_12/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/snowlayers_12 -A components/clm/cimetest/testmods_dirs/clm/snowlayers_3_monthly/user_nl_clm -A components/clm/cimetest/testmods_dirs/clm/snowlayers_3_monthly/include_user_mods -A components/clm/cimetest/testmods_dirs/clm/snowlayers_3_monthly - -========= Add unit tests for snow pack initialization (note: these were added - mainly to facilitate debugging InitSnowLayers; since this routine is - only used in cold-start, these are not critical unit tests, and can be - removed if the maintenance cost proves too high) -A components/clm/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt -A components/clm/src/biogeophys/test/SnowHydrology_test/README -A components/clm/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology.pf -A components/clm/src/biogeophys/test/SnowHydrology_test - -List all existing files that have been modified, and describe the changes: - -========= Major rework to remove assumption of 5 snow layers - instead allow - runtime-setable number of snow layers, between 3 and 12. - Also, clean up white space throughout file, and add mode/indentation - emacs line. -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= Minor changes to remove assumption of 5 snow layers -M components/clm/src/biogeophys/SurfaceRadiationMod.F90 -M components/clm/src/biogeophys/SoilTemperatureMod.F90 - - also: remove unused variables, fix array argument declarations to - conform to conventions -M components/clm/src/main/initVerticalMod.F90 - - also: clean up some white space - -========= Add namelist variables to control number of snow layers and maximum SWE -M components/clm/src/main/clm_varcon.F90 -M components/clm/src/main/clm_varpar.F90 -M components/clm/src/main/controlMod.F90 -M components/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M components/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M components/clm/bld/CLMBuildNamelist.pm - -========= Minor changes needed for unit testing of SnowHydrologyMod -M components/clm/src/biogeophys/CMakeLists.txt -M components/clm/src/biogeophys/test/CMakeLists.txt -M components/clm/src/biogeophys/SnowSnicarMod.F90 -M components/clm/src/biogeophys/SnowHydrologyMod.F90 -M components/clm/src/biogeophys/AerosolMod.F90 -M components/clm/src/main/CMakeLists.txt -M components/clm/src/unit_test_stubs/main/histFileMod_stub.F90 - -========= Add tests with different number of snow layers -M components/clm/cimetest/testlist_clm.xml - -========= Unrelated change: remove unused variables in associate statements -M components/clm/src/biogeophys/SoilFluxesMod.F90 - -========= Remove a test that now passes (hooray for weird compiler bugs!) -M components/clm/cimetest/ExpectedTestFails.xml - -CLM testing: - - build-namelist tests: - - yellowstone: ok - All CLM45 and CLM50 tests have namelist differences; this is expected due - to addition of 2 new namelist items. - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r109 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r109 -Originator(s): sacks (Bill Sacks) -Date: Sat Jun 6 06:12:02 MDT 2015 -One-line Summary: Fix bug in DivideSnowLayers - -Purpose of changes: - - Fix bug in DivideSnowLayers. Leo van Kampenhout (l.vankampenhout@uu.nl) - discovered the bug and determined how to fix it. He found this bug in the - course of refactoring this routine to introduce loops; without this bug fix, - answers differed with his new logic that removes duplication. - - Specifically: Logic using many IF-statements is employed to see whether or - not a layer may be subdivided, depending on the layer thickness. Currently, - the test for subdividing the BOTTOM layer are only reachable when the layer - above it was also too thick. As it turns out, this is faulty as a situation - can arise where the bottom layers grows even though the layer above it was - not divided, i.e. dumped mass to it. The current understanding is that this - happens through meltwater percolation (liquid h2o is translated to thickness - as well). - - Note that the indentation has not been appropriately corrected, this is because this - fix is only temporary (less cluttered logic will be implemented next). - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2183 (incorrect logic for sub-dividing bottom -snow layer in DivideSnowLayers) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Mark Flanner - -List any svn externals directories updated (cime, rtm, cism, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Bug fix, described above -M components/clm/src/biogeophys/SnowHydrologyMod.F90 - -========= Remove failures from here, now that we're using the file in cimetest -M components/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -========= Change a failure type from FAIL to RUN (presumably due to new test - reporting) -M components/clm/cimetest/ExpectedTestFails.xml - -CLM testing: - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r108 - -Changes answers relative to baseline: YES - - Summarize any changes to answers, i.e., - - what code configurations: All clm4.5 and clm5 - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Larger than roundoff. While not investigated carefully, Leo showed that - the impacts are relatively small, so this is believed NOT to be - climate-changing. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r108 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Fri May 29 15:14:26 MDT 2015 -One-line Summary: Crop changes from Sam Levis - -Purpose of changes: Crop model changes from Sam Levis. Increases the number of -crops to 64, with 78 total pfts. Requires new parameters file, surface dataset, -and land use timeseries files. - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2146, 2155 - -Known bugs (include bugzilla ID): 2180, 2182 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: n/a - -Describe any changes made to the namelist: n/a - -List any changes to the defaults for the boundary datasets: - Regenerate surface data sets and land use timeseries to increase the number of - pfts and crops with data from Levis. New raw datasets: - rawdata/pftlanduse.3minx3min.simyr2000.c110913/mksrf_78pft_landuse_rc2000_c130927.nc - rawdata/pftlandusedyn.0.5x0.5.simyr1850-2005.c090630/mksrf_78pft_landuse_rc2000_c150130.nc - -Describe any substantial timing or memory changes: - Increased memory usage for all crop runs. Exact consequences requires further study. - -Code reviewed by: andre, levis - -List any svn externals directories updated (cime, rtm, cism, etc.): n/a - -List all files eliminated: n/a - -List all files added and what they do: - components/clm/cimetest/ExpectedTestFails.xml - new expected fails file for upcoming cime xfail integration - components/clm/tools/clm4_5/mksurfdata_map/Makefile.data - automate generating all surface data sets - -List all existing files that have been modified, and describe the changes: - clm/bld/CLMBuildNamelist.pm - increase max pft, add info to error message, fix quoted empty string processing (bug 2146) - clm/bld/namelist_files/namelist_defaults_clm4_5.xml - point to new datasets - clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - update rawdata sets - clm/bld/namelist_files/namelist_definition_clm4_5.xml - update sim year range to avoid special cases for testing - clm/bld/test_build_namelist/t/test_do_harvest.pm - update test (bug 2146) - clm/bld/test_build_namelist/t/test_do_transient_crops.pm - update test (bug 2146) - clm/bld/test_build_namelist/t/test_do_transient_pfts.pm - update test (bug 2146) - - clm/cimetest/testmods_dirs/clm/crop_trans_f10/user_nl_clm - point to new datafiles - clm/cimetest/testmods_dirs/clm/crop_trans_sville/user_nl_clm - point to new datafiles - - clm/src/biogeophys/WaterStateType.F90 - workaround for pgi compiler bug - - clm/src/biogeochem/CNNDynamicsMod.F90 - new crop model - clm/src/biogeochem/CNPhenologyMod.F90 - clm/src/biogeochem/CNVegStructUpdateMod.F90 - clm/src/biogeochem/CropType.F90 - clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 - clm/src/biogeochem/VOCEmissionMod.F90 - clm/src/biogeophys/CanopyFluxesMod.F90 - clm/src/biogeophys/PhotosynthesisMod.F90 - clm/src/main/PatchType.F90 - clm/src/main/clm_varpar.F90 - clm/src/main/pftconMod.F90 - clm/src/main/subgridRestMod.F90 - clm/src/main/surfrdMod.F90 - - clm/tools/clm4_5/mksurfdata_map/README - clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - move file writes into functions. write to __dataset_name__.namelist - clm/tools/clm4_5/mksurfdata_map/src/mklaiMod.F90 - update for new crops - clm/tools/clm4_5/mksurfdata_map/src/mkpftConstantsMod.F90 - clm/tools/clm4_5/mksurfdata_map/src/mkpftMod.F90 - update for new crops, fix bug 2155. - - clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 - work around for an issue causing abort during urban dataset generation - clm/tools/clm4_5/mksurfdata_map/src/mkurbanparMod.F90 - - -CLM testing: regular - - build-namelist tests: - - yellowstone unit tests - ok - - unit-tests (components/clm/src): - - yellowstone_intel - ok - - regular tests (aux_clm40, aux_clm45): - - - yellowstone aux clm40 intel - ok - - yellowstone aux clm40 pgi - ok - - yellowstone aux clm45 intel - ok - - all namelist fail - new datasets and parameters - - crop - new crop model - baseline failures expected - - ed - new parameters file - baseline failures expected, ok'd by rfisher - - ERP_D_Ld5.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC_changeFlags - baseline compare fails, roundoff level, unknown cause, ok'd by sacks - - ERP_E_Ld5.f19_g16.I1850CRUCLM45CN.yellowstone_intel.clm-default - baseline compare fails, only occurs with esmf - ok'd by mvertens - - yellowstone aux clm45 gnu - ok - - all namelist fail - new datasets and parameters - - crop - new crop model - baseline failures expected - - yellowstone aux clm45 pgi - - - all namelist fail - new datasets and parameters - - crop - new crop model - baseline failures expected - - ed - new parameters file - baseline failures expected, ok'd by rfisher - - ERI_D_Ld9.f19_g16.I1850CLM45CN.yellowstone_pgi - roundoff in cpl baseline - - ERI_D_Ld9.f19_g16.I1850CLM45CN.yellowstone_pgi.clm-drydepnomegan - roundoff in baseline - - ERP_P15x2_Lm13.f10_f10.IHISTCLM45BGC.yellowstone_pgi.clm-monthly - new xfail, #2182, dies at runtime in optimized, threaded pgi builds only. - - yellowstone mksurfdata_map unit_testers - ok - - yellowstone tools tests - ok, known issues with PTCLMmkdata (bug 2180) - -CLM tag used for the baseline comparisons: clm4_5_1_r106 (bit for bit with clm4_5_1_r107) - -Changes answers relative to baseline: yes - - Summarize any changes to answers, i.e., - - what code configurations: crop, ed - - what platforms/compilers: all - - nature of change : answer changes updated crop model. approved by levis. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - simulations with all pfts everywhere were run with merged code. Levis compared current runs with his archived runs. - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r107 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Tue May 19 10:05:49 MDT 2015 -One-line Summary: Update externals to use github version of cime1.0.7. - -Purpose of changes: Switch the cime external from using svn to github. Update cime to cime1.0.7. - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (cime, rtm, cism, etc.): cime 1.0.7 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: N/A - -CLM testing: regular - - build-namelist tests: - unit-tests: ok - system-tests: not run - - unit-tests (models/lnd/clm/src): - yellowstone: ok - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel 40 - ok; 45 - ok - yellowstone_pgi 40 - ok; 45 - ok - yellowstone_gnu (clm45 only) 45 - ok - -CLM tag used for the baseline comparisons: clm4_5_1_r106 - -Changes answers relative to baseline: none - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r106 -Originator(s): erik/fvitt -Date: Thu May 14 13:22:51 MDT 2015 -One-line Summary: Fix CO2 forcing for MEGAN - -Purpose of changes: - -Bring in changes from Francis Vitt, and Louisa Emmons to correct CO2 forcing -for MEGAN and dry-deposition. Previously, the fixed value of CO2 was being used -rather than using the CO2 forcing sent in from the atmosphere model. - -Also fix some issues with clm4_0 code where some urban diagnostic fields have -a different fill-value pattern on restart from startup. Fill-value is now only -set over non-land, and areas without urban, are set to zero. - -+M models/lnd/clm/src_clm40/biogeochem/VOCEmissionMod.F90 -+ - use time-dependent atmospheric CO2 concentrations rather than -+ the CCSM_CO2_PPMV constant value -+ -+M models/lnd/clm/src_clm40/biogeochem/DryDepVelocity.F90 -+ - science updates and bug fixes provided by Maria Val Martin -+ -+M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 -+ - use time-dependent atmospheric CO2 concentrations rather than -+ the CCSM_CO2_PPMV constant value -+ - use 10-day average of LAI rather than 1-day average -+ -+M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 -+ - science updates and bug fixes provided by Maria Val Martin -+ -+M models/lnd/clm/src/biogeophys/CanopyStateType.F90 -+ - get 10-day average of LAI rather than 1-day average - -Requirements for tag: Fix 2177 and some 2165 clm40 tests - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 2177 (MEGAN improperly uses constant CO2 rather than time varying) - 2176 (ED doesn't work with MEGAN -- partial just turn MEGAN off when ED on) - 2165 (some clm40 tests have history files differ on restart in urban fillvalue) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Turn MEGAN off when ED on - Have build-namelist make sure MEGAN is off when ED is on - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self,fvitt,simone,emmons - -List any svn externals directories updated (cime, rtm, cism, etc.): cime, cism - cime up to cime0_3_21 (bring in optional orbital calculation) - cism up to cism2_0_09 (just bring the branch to the trunk) - -List all files eliminated: None - -List all files added and what they do: Turn MEGAN off for ED tests - -A components/clm/cimetest/testmods_dirs/clm/edTest/shell_commands - -List all existing files that have been modified, and describe the changes: - - M components/clm/src_clm40/biogeophys/UrbanInitMod.F90 -- Initialize to - zero over land - M components/clm/src_clm40/main/clm_initializeMod.F90 --- Call urbanInit - before reading restart files - M components/clm/src_clm40/main/accFldsMod.F90 ---------- Change running mean - from 1 day to 10 days - M components/clm/src_clm40/main/clmtypeInitMod.F90 ------ Initilize to spval - - M components/clm/src_clm40/biogeochem/VOCEmissionMod.F90 -+ - use time-dependent atmospheric CO2 concentrations rather than -+ the CCSM_CO2_PPMV constant value -+ - use 10-day average of LAI rather than 1-day average - M components/clm/src_clm40/biogeochem/DryDepVelocity.F90 -+ - science updates and bug fixes provided by Maria Val Martin - - M components/clm/src/biogeochem/VOCEmissionMod.F90 -+ - use time-dependent atmospheric CO2 concentrations rather than -+ the CCSM_CO2_PPMV constant value -+ - use 10-day average of LAI rather than 1-day average - M components/clm/src/biogeochem/DryDepVelocity.F90 -+ - science updates and bug fixes provided by Maria Val Martin - M components/clm/src/biogeophys/CanopyStateType.F90 -+ - get 10-day average of LAI rather than 1-day average - - M README_cime --- Update documentation - - M components/clm/bld/CLMBuildNamelist.pm -- Check that MEGAN off when ED on - M components/clm/bld/unit_testers/build-namelist_test.pl - Add check for - MEGAN off when ED on - M components/clm/bld/clm.buildnml --- only copy drv_flds_in over if it - was actually created. - - M components/clm/tools/README ---- Have documentation point to gen_domain - under cime/tools/mapping - -CLM testing: regular - - build-namelist tests: - - yellowstone yes - - unit-tests (models/lnd/clm/src): - - yellowstone yes - - regular tests (aux_clm40, aux_clm45): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - -CLM tag used for the baseline comparisons: clm4_5_1_r105 - -Changes answers relative to baseline: Yes -- MEGAN diagnostic fields only! - as well as dry-deposition because of science update - - Summarize any changes to answers, i.e., - - what code configurations: All with MEGAN on - - what platforms/compilers: All - - nature of change: Diagnostic fields change - - VOC emissions change - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r105 -Originator(s): erik (Erik) -Date: Thu Apr 16 13:23:19 MDT 2015 -One-line Summary: Move test lists to beneath active components, change build scripts from cshell - to perl, move to new cime directory structure - -Purpose of changes: - - * Move CESM test lists from under scripts to under active components. - Now clm and rtm have their own CESM test lists under their "cimetest" directory. - * Change build scripts from cshell to perl - cshell is buggy with arbitrary problems with line lengths and number of arguments - cshell doesn't allow long scripts to be broken up into subroutine -- perl does -:::::::::: Get unit-testing working with directory structure change - M src/CMakeLists.txt - M src/README.unit_testing - -:::::::::: Get tools testing working with directory structure change - M test/tools/TBLtools.sh - M test/tools/TSMCFGtools.sh - M test/tools/TSMscript_tools.sh - M test/tools/TCBCFGtools.sh - M test/tools/TCBscripttools.sh - M test/tools/TSMncl_tools.sh - M test/tools/TBLCFGtools.sh - M test/tools/TSMtools.sh - M test/tools/TBLscript_tools.sh - M test/tools/TCBtools.sh - M test/tools/test_driver.sh - -:::::::::: Get tools working with directory structure change - M tools/clm4_0/mksurfdata_map/mksurfdata.pl - M tools/clm4_5/mksurfdata_map/mksurfdata.pl - M tools/shared/ncl_scripts/getco2_historical.ncl - -:::::::::: Updates to build - M bld/CLMBuildNamelist.pm - M bld/configure - M bld/queryDefaultNamelist.pl - M bld/listDefaultNamelist.pl - M bld/unit_testers/xFail/wrapClmTests.pl - M bld/unit_testers/xFail/expectedFail.pm - M bld/test_build_namelist/test_build_namelist.pl - M bld/namelist_files/checkmapfiles.ncl - M bld/namelist_files/namelist_definition.xsl - -:::::::::: Updates to documentation with new directory structure - M doc/README - M doc/UsersGuide/co2_streams.txt - M doc/Quickstart.userdatasets - M doc/Quickstart.GUIDE - M doc/KnownLimitations - M tools/README - M tools/README.filecopies - M tools/clm4_0/interpinic/README - M tools/clm4_0/mksurfdata_map/README - M tools/clm4_5/refactorTools/associate/README - M tools/clm4_5/refactorTools/clmType/README - M tools/clm4_5/mksurfdata_map/README - M tools/shared/mkmapgrids/README - M tools/shared/mkmapdata/README - M tools/shared/mkprocdata_map/README - M tools/shared/ncl_scripts/README - M tools/README.testing - M bld/README - -CLM testing: - - build-namelist tests: - - yellowstone yes - - unit-tests (models/lnd/clm/src): - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, and aux_clm_short): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - -CLM tag used for the baseline comparisons: clm4_5_1_r104 - -Changes answers relative to baseline: - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r104 -Originator(s): erik (Erik) -Date: Tue Jan 27 11:22:48 MST 2015 -One-line Summary: Update externals to latest cesm beta tag + bring in shared build for clm4_5/clm5_0 for testing - -Purpose of changes: - -* Update externals to cesm1_3_beta15+ shared clm4_5/clm5_0 library build for testing. -* Fix BG1850CN @ f09 by changing fglcmask (Bill Sacks) -* Update more prealpha/prebeta tests to test with clm4_5 -* Create datasets for clm4_5 at ne16 and ne120 resolution - (for ne120 create rcp8.5 and rcp4.5 transient datasets) - M models/lnd/clm/src/cpl/lnd_comp_mct.F90 ----------- Add only for lnd_import_export use statement - ------------- Change so sample subsetting uses the high resolution datasets - M models/lnd/clm/tools/shared/ncl_scripts/README.getregional - M models/lnd/clm/tools/shared/ncl_scripts/sample_inlist - M models/lnd/clm/tools/shared/ncl_scripts/sample_outlist - -CLM testing: - - build-namelist tests: - - yellowstone yes - - unit-tests (models/lnd/clm/src): - - yellowstone yes - - tools testing: - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu (clm45 only) yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - -CLM tag used for the baseline comparisons: clm4_5_1_r103 - -Changes answers relative to baseline: YES! - - Summarize any changes to answers, i.e., - - what code configurations: all - - what platforms/compilers: time-change all, roundoff-intel - - nature of change: roundoff - - Small change in driver changes time-stamps on history files by roundoff (drvseq5_1_05). - Normal cprnc comparison then does NOT compare fields and calls files different. Changes - in the intel build (on yellowstone) change answers to roundoff for intel on yellowstone - (Machines update between Machines_141125 and Machines_150106a causes answers to change) - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r103 -Originator(s): sacks (Bill Sacks) -Date: Thu Jan 1 06:15:57 MST 2015 -One-line Summary: enable transient crops - -Purpose of changes: - -(1) Allow transient crops! Note that carbon and nitrogen conservation still is - not done, but this at least allows crop areas to evolve in time. - -(2) Add control flags for which pieces of the transient dynamics should be done: - transient natural PFTs, transient crops, and/or harvest. - -(3) Reworked both source code and unit tests to be able to use the true CLM time - manager in unit tests rather than a stub version. Also added functionality - to time_info_type to be able to take the date from the end of the current - time step or the beginning of the time step. This flexibility was needed - because: (a) for crops, with an annual update, I wanted the update time to - be consistent with the glacier update time: the first time step after - crossing the year boundary (so take time from the start of the time step); - (b) for transient PFTs and harvest, for consistency with what was being done - before, we need to take the time from the end of the time step. - -(4) Make CNBalanceCheck more modular and object-oriented. Also, bypass the - balance check for newly-active columns, which is needed to avoid balance - check errors with transient crops. - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: New control flags that control which -aspects of transient subgrid dynamics (and harvest) are turned on/off. This lets -you turn on/off transient natural PFTs, transient crops, and/or harvest -independently. - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: some pieces reviewed by Erik - - scripts: append_nl_value_n03_scripts4_141201 -> append_nl_value_n07_scripts4_141201 - esmf_wrf_timemgr: esmf_wrf_timemgr_141028 -> esmf_wrf_timemgr_141217 - -List all files eliminated: - -========= No longer use stub time manager - use true time manager instead -D models/lnd/clm/src/unit_test_stubs/utils/clm_time_manager_stub.F90 - -List all files added and what they do: - -========= Add transient crops -A models/lnd/clm/src/dyn_subgrid/dyncropFileMod.F90 - -========= Reads and stores namelist items controlling transient dynamics. This - allows turning off select pieces of the transient subgrid behavior. -A models/lnd/clm/src/dyn_subgrid/dynSubgridControlMod.F90 - -========= Add unit test utilities that wrap the clm time manager -A models/lnd/clm/src/unit_test_shr/unittestTimeManagerMod.F90 - -========= Start adding unit tests for the clm time manager -A models/lnd/clm/src/utils/test/clm_time_manager_test/test_clm_time_manager.pf -A models/lnd/clm/src/utils/test/clm_time_manager_test/CMakeLists.txt -A models/lnd/clm/src/utils/test/clm_time_manager_test -A models/lnd/clm/src/utils/test/CMakeLists.txt -A models/lnd/clm/src/utils/test - -========= Test logic for new control flags -A models/lnd/clm/bld/test_build_namelist/t/test_do_transient_pfts.pm -A models/lnd/clm/bld/test_build_namelist/t/test_do_harvest.pm -A models/lnd/clm/bld/test_build_namelist/t/test_do_transient_crops.pm - -List all existing files that have been modified, and describe the changes: - -========= Reworked both source code and unit tests to be able to use the true - CLM time manager in unit tests rather than a stub version. Also added - functionality to time_info_type to be able to take the date from the - end of the current time step or the beginning of the time step. Note - that some unit test builds now need to link against the - esmf_wrf_timemgr library, if they use the time manager either directly - or indirectly. -M models/lnd/clm/src/utils/clm_time_manager.F90 -M models/lnd/clm/src/dyn_subgrid/dynTimeInfoMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynVarTimeInterpMod.F90.in -M models/lnd/clm/src/dyn_subgrid/dynVarTimeInterpMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynFileMod.F90 -M models/lnd/clm/src/unit_test_stubs/dyn_subgrid/dynFileMod_stub.F90 -M models/lnd/clm/src/unit_test_stubs/utils/CMakeLists.txt -M models/lnd/clm/src/CMakeLists.txt -M models/lnd/clm/src/unit_test_shr/CMakeLists.txt -M models/lnd/clm/src/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf -M models/lnd/clm/src/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt -M models/lnd/clm/src/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 -M models/lnd/clm/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf -M models/lnd/clm/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf -M models/lnd/clm/src/dyn_subgrid/test/dynVar_test/CMakeLists.txt -M models/lnd/clm/src/biogeophys/test/Daylength_test/CMakeLists.txt -M models/lnd/clm/src/biogeophys/test/Irrigation_test/CMakeLists.txt -M models/lnd/clm/src/utils/CMakeLists.txt - -========= Changes related to new control flags, as well as the rework of the - time_info%set_current_year interface -M models/lnd/clm/src/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynHarvestMod.F90 - -========= Changes related to new control flags and addition of transient crops -M models/lnd/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Moved flanduse_timeseries and other control flags into dynSubgridControlMod -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/main/controlMod.F90 -M models/lnd/clm/src/main/restFileMod.F90 -M models/lnd/clm/src/main/subgridRestMod.F90 -M models/lnd/clm/src/main/clm_varpar.F90 -M models/lnd/clm/src/biogeochem/CNDriverMod.F90 -M models/lnd/clm/src/biogeochem/CNFireMod.F90 - -========= Make CNBalanceCheck more modular and object-oriented -M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 - - also, bypass balance checks for newly-active columns (needed to - avoid balance check errors for newly-active crop columns) -M models/lnd/clm/src/biogeochem/CNVegNitrogenStateType.F90 -M models/lnd/clm/src/biogeochem/CNVegCarbonStateType.F90 -M models/lnd/clm/src/main/clm_instMod.F90 -M models/lnd/clm/src/main/clm_driver.F90 - - also make alt_calc operate over inactive as well as active points - -========= Added new control flags -M models/lnd/clm/bld/CLMBuildNamelist.pm -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -========= Make test files (more) consistent with actual files. This may not have - been necessary. -M models/lnd/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml -M models/lnd/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml - -========= Minor changes (e.g., changes to comments and other small changes) -M models/lnd/clm/src/unit_test_stubs/utils/spmdMod_stub.F90 -M models/lnd/clm/src/dyn_subgrid/do_genf90 -M models/lnd/clm/src/dyn_subgrid/dynVarTimeUninterpMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynVarMod.F90 -M models/lnd/clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 -M models/lnd/clm/src/biogeophys/ActiveLayerMod.F90 - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - Note that there are differences from baseline due to new control flags - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r102 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r102 -Originator(s): sacks (Bill Sacks) -Date: Sat Dec 27 06:52:20 MST 2014 -One-line Summary: make new input datasets to support transient crops - -Purpose of changes: - -While the main purpose of this tag was to make new input datasets to support -transient crops, it also includes a number of reworks of mksurfdata_map, which -were either central or tangential to this overall goal. Specifically: - -(1) Update mksurfdata_map to be able to generate datasets with transient - crops. Currently the logic uses the non-prognostic-crop raw data for the - transient time series: It takes the area of the generic crop from that - timeseries to specify the transient PCT_CROP area, and sets the PCT_CFT - areas based on the year-2000 areas. - -(2) Rewrite mksurfdata_map code that normalizes pct_pft to account for special - landunits. The code to handle urban was very confusing, and I hope this new - code is at least astep towards being less confusing. Note that this - introduces roundoff-level differences. - -(3) Introduce new mksurfdata_map utility routines: ncd_def_spatial_var and - ncd_put_time_slice. These encapsulate behavior that used to be duplicated in - the code. - -(4) Add mksurfdata_map unit tests using the new pfunit-based unit testing - framework. However, I have NOT done a full migration of the mksurfdata_map - unit tests. Thus, there are still some tests that use the old unit testing - framework that I put in place (which leveraged the test stuff that Erik set - up for csm_share a while ago). These tests can be migrated to pfunit - incrementally: as someone touches code that is under test using the old - framework, they could move the relevant tests into the new pfunit-based - framework. - -(5) Create new input datasets, based on the above changes: - - - new flanduse_timeseries files created because I have changed the - information on these files - - - new surface datasets created because I introduced roundoff-level changes - in the surface datasets, and so regenerated all surface datasets now in - order to save someone a headache later. - - - new initial conditions files created so that out-of-the-box initial - conditions will be compatible with the surface datasets, according to - various consistency checks. - - See the following files in inputdata for documentation of how the new - datasets were created: - - lnd/clm2/surfdata_map/README_c141219 - lnd/clm2/initdata_map/README_c141226 - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: -- new surface datasets -- new flanduse_timeseries files -- new initial conditions files - -List any changes to the defaults for the boundary datasets: -- new surface datasets -- new flanduse_timeseries files -- new initial conditions files - -Describe any substantial timing or memory changes: none - -Code reviewed by: Most changes sent to Erik for review, although I can't -remember how much he actually reviewed. - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: append_nl_value_n02_scripts4_141201 -> append_nl_value_n03_scripts4_141201 - - point tropicAtl_subset tests to new file - -List all files eliminated: - -========= Move tests elsewhere -D models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkpftMod.F90 - - -List all files added and what they do: - -========= New object-oriented class for storing and operating on pct_pft - data. Encapsulating a bunch of behavior in here allowed me to simplify - other code. Before this, I was keeping track of two separate - representations of pct_pft: First it was stored as % of grid cell, - then it was later converted into % of landunit together with the - landunit's % of grid cell. This was starting to get hard to manage, - because certain operations could only be done on the first - representation, and other operations could only be done on the second - representation – and at some point in the processing pipeline, the - conversion happened and the first representation was no longer - usable. Now there is a single representation, and the class allows any - desired operation to be performed on that single representation. This - adds some complexity within the class, but removes complexity from the - rest of the code, particularly mksurfdat.F90. -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpctPftTypeMod.F90 - -========= This new module contains routines that operate on both instances of - pct_pft_type (pctnatpft and pctcft) at once. Thus, this contains - higher-level logic than was appropriate for mkpctPftTypeMod. Yet, I - wanted these routines in a separate module from mkpftMod as an aid to - testing, since mkpftMod has a bunch of dependencies. -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpftUtilsMod.F90 - -========= Moved constants from other places into here, partly to centralize - them, and partly to remove problems with circular dependencies -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpftConstantsMod.F90 - -========= Add automated test of making a transient crop surface dataset -A models/lnd/clm/test/tools/nl_files/mksrfdt_10x15_crp_1850-2000 - -========= Add input file for creating a transient smallville dataset for testing - transient crops -A models/lnd/clm/tools/clm4_5/mksurfdata_map/single_point_dynpft_files/README.landuse_timeseries_smallvilleIA_hist_simyr1850-1855 -A models/lnd/clm/tools/clm4_5/mksurfdata_map/single_point_dynpft_files/landuse_timeseries_smallvilleIA_hist_simyr1850-1855.txt -A models/lnd/clm/tools/clm4_5/mksurfdata_map/single_point_dynpft_files/README -A models/lnd/clm/tools/clm4_5/mksurfdata_map/single_point_dynpft_files - -========= Add pfunit-based unit tests for mksurfdata_map -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/CMakeLists.txt -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpftUtils_test/test_adjust_total_veg_area.pf -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpftUtils_test/CMakeLists.txt -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpftUtils_test/test_convert_from_p2g.pf -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpftUtils_test -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpctPftType_test/CMakeLists.txt -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpctPftType_test/test_mkpctPftType.pf -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/mkpctPftType_test -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test/CMakeLists.txt -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/test -A models/lnd/clm/tools/clm4_5/mksurfdata_map/src/README.unit_testing - - -List all existing files that have been modified, and describe the changes: - -========= Changes that take advantage of some of the other refactoring described - here, plus add logic to allow input dataset to not contain crops even - when generating a transient dataset for crops; also add PCT_CROP and - PCT_CFT on the landuse_timeseries output file -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpftMod.F90 - -========= Changes that take advantage of some of the other refactoring described - here, especially making use of the new pct_pft_type methods. Plus: (a) - save pctcft from the initial input file so it can be used when - generating landuse_timeseries, (b) remove unwanted landunit percents - from the landuse_timeseries file, (c) add transient PCT_CROP and - PCT_CFT, (d) complete rewrite of the code that normalizes pct_pft to - account for special landunits: the code to handle urban was very - confusing, and I hope this new code is at least a step towards being - less confusing [this change introduces roundoff-level differences], - (e) remove some error-checking code that is now embedded in the - pct_pft_type routines -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 - -========= Updated for new files -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Srcfiles - -========= Added two new routines: ncd_def_spatial_var and - ncd_put_time_slice. These encapsulate behavior that used to be - duplicated in the code. Also, moved convert_latlon from mkutilsMod to - here, since it is really related to netcdf stuff. -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkncdio.F90 - -========= Simplify this module significantly by using the new - ncd_def_spatial_var. Also change what fields are present on the - transient landuse file: remove some no-longer-desired fields (% of - special landunits, etc.). -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 - -========= Use new ncd_def_spatial_var -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksoilMod.F90 - -========= Delete routines that have been moved to a more appropriate place -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkutilsMod.F90 - -========= Remove tests from old test framework for code that I have deleted or - migrated to my new modules; and fix some minor errors that appeared - when runnng the old unit tests with gfortran. -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkchecksMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkutilsMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkgridmapMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/Srcfiles -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkdomainMod.F90 - -========= Trivial changes (change 'use' statements to reflect migrated code, add - comments, etc.) -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mklaiMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkdomainMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkurbanparMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkgridmapMod.F90 - -========= Add logic needed for creating transient crop datasets. The main - differences are (a) for crop, we create a year-2000 surface dataset - together with the transient dataset (rather than a year-1850 surface - dataset), and (b) we always use the non-crop transient raw data, even - when creating a transient crop dataset. -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - -========= New fsurdat, flanduse_timeseries and finidat files -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Add automated test of making a transient crop surface dataset -M models/lnd/clm/test/tools/input_tests_master -M models/lnd/clm/test/tools/tests_pretag_yellowstone_nompi - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - tools tests: - - yellowstone: ok - - Note that there were diffs in baseline comparisons for mksurfdata_map tests - (and the PTCLM test, which uses mksurfdata_map). See below for details - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r101 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: most clm4_5 runs - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - Note that there were no source code changes in this tag, so the only - differences come from differences in datasets (fsurdat, - flanduse_timeseries, finidat). - - I confirmed that differences in fsurdat and flanduse_timeseries are - generally roundoff-level. There are greater than roundoff-level diffs in - PCT_NAT_PFT at a small number of points, but all of these points have - PCT_NATVEG = 0 (this is due to a fix in how PCT_NAT_PFT is determined for - points with 0% vegetated landunit, and > 0% urban); this would only affect - dynamic landunit runs. Other than that, max normalized RMS diffs are 2e-8, - and most are considerbly smaller. - - finidat files were created as one-offs to ensure that the only differences - are in the subgrid weights, arising from these surface dataset differences. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r101 -Originator(s): sacks (Bill Sacks) -Date: Tue Dec 9 06:27:39 MST 2014 -One-line Summary: rework cold start initialization for transient runs - -Purpose of changes: - - (1) Do not adjust subgrid weights (or set harvest variables) in cold start - initialization. Instead, wait to do this until the first run step. The - motivation for this is (a) this is consistent with what is done for - glacier (for which prognostic weights aren't available until the run - phase), and (b) it simplifies what needs to be done in initialization, - particularly for transient crops (which are coming soon). - - (2) Do not run the biogeophys & biogeochem dyn subgrid conservation code in - the first step of a cold start run. This affects the current operation of - glacier, and is important in conjunction with (1): this avoids doing a - large adjustment of physics or BGC caused by a fictitious change in area - in the first time step after cold start. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: mvertens reviewed conceptual changes to clm_time_manager and - DaylengthMod; other changes only reviewed by self - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Main changes, as documented above -M models/lnd/clm/src/main/clm_initializeMod.F90 -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynConsBiogeochemMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 - -========= Unrelated change: Fix a possible threading bug in DaylengthMod - (although this would rarely cause problems: I think this would only - cause a problem if you started / restarted exactly on the solstice) -M models/lnd/clm/src/utils/clm_time_manager.F90 -M models/lnd/clm/src/biogeophys/DaylengthMod.F90 - - - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r100 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM4.5 cold start runs with glacier and/or - transient PFTs - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Changes answers only in initialization. This shows up as changes in the - fields set to the coupler in initialization, and/or changes in the initial - history file. In offline runs (I compsets), this change does not affect - the simulation beyond initialization, but it is expected to change the - evolution of the system in coupled runs. However, again note that this - only affects cold start runs wth glacier and/or transient PFTs, which - would not be typical for production runs. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r100 -Originator(s): sacks (Bill Sacks); most changes from Jim Edwards -Date: Wed Dec 3 06:21:13 MST 2014 -One-line Summary: update pio calls to pio2 API - -Purpose of changes: - - Update pio calls to the pio2 API, so that the transition to pio2 will be - seamless. Most changes were from Jim Edwards. There are also some other minor - changes that are unrelated to this main change, as noted below. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: sacks - -List any svn externals directories updated (csm_share, mct, etc.): - - pio: pio1_8_13 -> pio1_9_5 - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Main changes needed for pio2 API -M models/lnd/clm/src_clm40/main/ncdio_pio.F90 -M models/lnd/clm/src_clm40/main/ncdio_pio.F90.in -M models/lnd/clm/src/main/ncdio_pio.F90 -M models/lnd/clm/src/main/ncdio_pio.F90.in - -========= Change 2-d array to 1-d. Jim says he thinks this was also needed for - pio2 support. -M models/lnd/clm/src_clm40/main/histFileMod.F90 -M models/lnd/clm/src/main/histFileMod.F90 - -========= Unrelated change: change len to len_trim. Jim says this was needed to - fix a problem on some machine. -M models/lnd/clm/src_clm40/biogeochem/MEGANFactorsMod.F90 -M models/lnd/clm/src/biogeochem/MEGANFactorsMod.F90 - - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r099 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r099 -Originator(s): sacks (Bill Sacks) -Date: Tue Dec 2 15:05:09 MST 2014 -One-line Summary: add ozone stress code from Danica Lombardozzi - -Purpose of changes: - -(1) Implement ozone stress. The scientific implementation was done by Danica - Lombardozzi. The software reimplementation was done by Bill Sacks. - -(2) Fix some misc. bugs, including a restart bug that was introduced in r097. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): -- 2091: some restarts not bit-for-bit starting in clm4_5_1_r097 -- 2029: Memory leak in GetGlobalValuesMod - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ -- 2094: ozone code doesn't work with the PGI compiler - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: new namelist option, use_ozone - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: ozone changes reviewed by Danica Lombardozzi (she reviewed -both the code and the changes seen due to ozone in a short simulation) - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: append_nl_value_n02_scripts4_141129 -> append_nl_value_n02_scripts4_141201 - -List all files eliminated: - -List all files added and what they do: - -========= Implement ozone stress. Uses polymorphism to handle ozone-on vs. ozone-off. -A models/lnd/clm/src/biogeophys/OzoneFactoryMod.F90 -A models/lnd/clm/src/biogeophys/OzoneOffMod.F90 -A models/lnd/clm/src/biogeophys/OzoneBaseMod.F90 -A models/lnd/clm/src/biogeophys/OzoneMod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Calculate and apply ozone stress -M models/lnd/clm/src/biogeophys/PhotosynthesisMod.F90 -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/main/clm_instMod.F90 - - also fix restart bug (bug 2091) -M models/lnd/clm/src/main/clm_driver.F90 - -========= Add namelist flag to turn ozone on -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/main/controlMod.F90 - -========= Fix memory leak (bug 2029) -M models/lnd/clm/src/main/GetGlobalValuesMod.F90 -M models/lnd/clm/src_clm40/main/GetGlobalValuesMod.F90 -M models/lnd/clm/src/ED/main/EDRestVectorMod.F90 - -========= Workarounds for compiler bugs -M models/lnd/clm/src/biogeochem/CNDVType.F90 -M models/lnd/clm/src/biogeochem/CNDriverMod.F90 - -========= Improve documentation comments for compiler bug workarounds -M models/lnd/clm/src/biogeophys/IrrigationMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynpftFileMod.F90 - -========= Add allocation of Points, matching behavior of true routine -M models/lnd/clm/src/unit_test_stubs/csm_share/mct_mod_stub.F90 - -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - Remove these two entries that now pass: - restarts not bit-for-bit - error on hist comparison - - Add this new failure: - compiler bug in PGI's handling of polymorphism - - -CLM testing: - - Note: testing was done on ozone_polymorphism_n09_clm4_5_1_r098, which was - before I put in place the abort if you're trying to run ozone with pgi. After - that, I ran two tests with pgi (one with ozone and one without), and one test - with intel (with ozone) in order to make sure that the abort check was put in - properly. After all testing was complete, I reverted accidental whitespace - changes in clm_initializeMod.F90 and restFileMod.F90 - I did not run any - additional testing after reverting those whitespace changes. - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - - Also, ran these two additional tests, with comparisons to baselines - these - are tests that I have replaced with new tests: - - ERS_Ly5.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrigOn_reduceOutput - PET_P15x2_Ly3.f10_f10.ICLM45BGCCROP.yellowstone_pgi.clm-irrigOn_reduceOutput - - -CLM tag used for the baseline comparisons: clm4_5_1_r098 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r098 -Originator(s): sacks (Bill Sacks) -Date: Sat Nov 29 06:18:59 MST 2014 -One-line Summary: update externals to cesm1_3_beta14 or beyond - -Purpose of changes: - - Update most externals to cesm1_3_beta14 or beyond. The one exception is mct, - for which I had trouble accessing the tag at the location used in beta14, so - I am sticking with the previous mct tag. - - Some notable changes: - - (1) update in intel compiler on yellowstone to intel15 - - (2) robust fix for number of datm streams, using Sean Santos's dynamic vector - - (3) testmods reworked to use recursive testmods - - (4) unit_testing, CMake & Machines updated so that unit tests now work on - yellowstone - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/refactor_koven_tags/refactor_koven_n02_scripts4_141023 -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/append_nl_value_tags/append_nl_value_n02_scripts4_141129 --scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_141017a -+scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_141125 --scripts/ccsm_utils/CMake https://github.com/quantheory/CMake_Fortran_utils/tags/CMake_Fortran_utils_140715 -+scripts/ccsm_utils/CMake https://github.com/quantheory/CMake_Fortran_utils/tags/CMake_Fortran_utils_141122 --models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_17 -+models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_18 --models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_141022 -+models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_141121 --models/utils/esmf_wrf_timemgr https://svn-ccsm-models.cgd.ucar.edu/esmf_wrf_timemgr/trunk_tags/esmf_wrf_timemgr_140529 -+models/utils/esmf_wrf_timemgr https://svn-ccsm-models.cgd.ucar.edu/esmf_wrf_timemgr/trunk_tags/esmf_wrf_timemgr_141028 --models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_8_12/pio -+models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_8_13/pio --tools/load_balancing_tool https://svn-ccsm-models.cgd.ucar.edu/tools/load_balancing_tool/trunk_tags/load_balancing_tool_140818/ -+tools/load_balancing_tool https://svn-ccsm-models.cgd.ucar.edu/tools/load_balancing_tool/trunk_tags/load_balancing_tool_141008 --tools/pyReshaper https://subversion.ucar.edu/asap/pyReshaper/tags/v0.9.1/ -+tools/pyReshaper https://proxy.subversion.ucar.edu/pubasap/pyReshaper/tags/v0.9.1 --tools/unit_testing https://svn-ccsm-models.cgd.ucar.edu/unit_testing/trunk_tags/unit_testing_0_08 -+tools/unit_testing https://svn-ccsm-models.cgd.ucar.edu/unit_testing/trunk_tags/unit_testing_0_12 - - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Workaround for pgi internal compiler error -M models/lnd/clm/src/main/clm_driver.F90 - -========= Rework README, mainly to remove the need for using '--clean' -M models/lnd/clm/src/README.unit_testing - -========= Move an xfail from goldbach to yellowstone; add xfail for ERS_Ly5 test - (bug 2091) -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -========= Update what machine-comiler combos we test -M .ChangeLog_template - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone: ok - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu (clm45 only): ok - goldbach_nag: ok - - Other than xFails, note that the following failed: - - *** presumably this failed in the previous tag, so baselines didn't exist - BFAIL SMS_D.1x1_mexicocityMEX.I.goldbach_nag.compare_hist.clm4_5_1_r097 - - *** ozone tests that won't work until an upcoming tag that brings ozone in - SFAIL ERS_D.f10_f10.I1850CLM45.goldbach_nag.clm-o3.GC.1128-0838.45.n - SFAIL PET_P15x2_Ly3.f10_f10.ICLM45BGCCROP.yellowstone_pgi.clm-irrig_o3_reduceOutput.GC.1128-0838.45.p - SFAIL ERS_Ly5.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrig_o3_reduceOutput.GC.1128-0838.45.i - - Also, note that the following test failed: - - FAIL ERH_D.f19_g16.I1850CLM45CN.yellowstone_pgi.clm-drydepnomegan - - This appears to be a scripts problem. Since Mariana wants to do away with - ERH tests anyway, I just replaced this with: - - PASS ERI_D.f19_g16.I1850CLM45CN.yellowstone_pgi.clm-drydepnomegan - - - Also ran the following two tests, which have been replaced with - (currently-failing) o3 tests: - - ERS_Ly5.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrigOn_reduceOutput - PET_P15x2_Ly3.f10_f10.ICLM45BGCCROP.yellowstone_pgi.clm-irrigOn_reduceOutput - - The PET test passed, but the ERS test failed (see bug 2091) - -CLM tag used for the baseline comparisons: clm4_5_1_r097 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: ALL - - what platforms/compilers: yellowstone-intel - - nature of change (roundoff; larger than roundoff/same climate; new climate): - NOT INVESTIGATED - - These diffs are presumably due to the yellowstone-intel compiler upgrade - to v15. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r097 -Originator(s): mvertens mvertens (Mariana Vertenstein,UCAR/CSEG,303-497-1349) -Date: Mon Nov 24 11:06:30 MST 2014 -One-line Summary: major refactorization to introduce new soilbiogeochem data - types and routines that are independent of either ED or CN datatypes - -Purpose of changes: Major refactorization to introduce new soilbiogeochem - data types and permit ED and CN vegetation to be independent of each other - AND both work with either the same soilbiogeochem or in the future - potentially different soilbiogeochem modules - -Requirements for tag: None - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: bld/configure modified to - accomodate new directory structure - introduction of soilbiogeochem/ - directory - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: Since use_cn and use_ed - are now mutually exclusive, CN memory is not longer allocated when ED is run - and the memory reduction (for f19_g16) seems to be about 50%. - -Code reviewed by: mvertens, muszala, sacks - -List any svn externals directories updated (csm_share, mct, etc.): scripts branch is used - https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/refactor_koven_tags/refactor_koven_n01_scripts4_141023 - -List all files eliminated, added and modified: (see below) -List all files added and what they do: (see below) -List all existing files that have been modified, and describe the changes: (see below) - -These are all grouped together here - since splitting the items up simply did -not make sense in this case - ---------------------------------------------------- -New module where all instances are now declared (moved from clm_initializeMod) -- all calls to instance restarts are here as well - so restFileMod - is greatly simplified ---------------------------------------------------- -A models/lnd/clm/src/main/clm_instMod.F90 - ---------------------------------------------------- -New soilbiogeochem/ directory introduced (new modules and data types) ---------------------------------------------------- -A models/lnd/clm/src/soilbiogeochem - ---------------------------------------------------- -CN state and flux types split into: -SoilBiogeoChem[Carbon|Nitrogen][State|Flux]Type and SoilBiogoechemStateType -CNVeg[Carbon|Nitrogen][State|Flux]Type and CNVegStateType ---------------------------------------------------- -D models/lnd/clm/src/biogeochem/CNStateType.F90 -D models/lnd/clm/src/biogeochem/CNCarbonFluxType.F90 -D models/lnd/clm/src/biogeochem/CNCarbonStateType.F90 -D models/lnd/clm/src/biogeochem/CNNitrogenFluxType.F90 -D models/lnd/clm/src/biogeochem/CNNitrogenStateType.F90 -A models/lnd/clm/src/biogeochem/CNVegStateType.F90 -A models/lnd/clm/src/biogeochem/CNVegCarbonFluxType.F90 -A models/lnd/clm/src/biogeochem/CNVegCarbonStateType.F90 -A models/lnd/clm/src/biogeochem/CNVegNitrogenStateType.F90 -A models/lnd/clm/src/biogeochem/CNVegNitrogenFluxType.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemStateType.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 - ---------------------------------------------------- -New modules in soilbiogeochem/ directory that are independent of CNVeg or ED types ---------------------------------------------------- -D models/lnd/clm/src/biogeochem/CNDecompCascadeConType.F90 -D models/lnd/clm/src/biogeochem/CNNitrifDenitrifMod.F90 -D models/lnd/clm/src/biogeochem/CNVerticalProfileMod.F90 -D models/lnd/clm/src/biogeochem/CNDecompMod.F90 -D models/lnd/clm/src/biogeochem/CNAllocationMod.F90 -D models/lnd/clm/src/biogeochem/CNDecompCascadeBGCMod.F90 -D models/lnd/clm/src/biogeochem/CNDecompCascadeCNMod.F90 -D models/lnd/clm/src/biogeochem/CNSoilLittVertTranspMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemNitrogenUptakeMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 -A models/lnd/clm/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 - ---------------------------------------------------- -Moved CNEcosystemDynMod to CNDRiverMod ---------------------------------------------------- -D models/lnd/clm/src/biogeochem/CNEcosystemDynMod.F90 -A models/lnd/clm/src/biogeochem/CNDriverMod.F90 - ---------------------------------------------------- -Changes to modules in biogeochem/ directory to now use new datatypes (see above) ---------------------------------------------------- -A models/lnd/clm/src/biogeochem/C14BompbSpikeMod.F90 -M models/lnd/clm/src/biogeochem/CNCStateUpdate2Mod.F90 -M models/lnd/clm/src/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/biogeochem/CNGRespMod.F90 -M models/lnd/clm/src/biogeochem/CNNStateUpdate1Mod.F90 -M models/lnd/clm/src/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/biogeochem/CNNStateUpdate3Mod.F90 -M models/lnd/clm/src/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/biogeochem/CNDVDriverMod.F90 -M models/lnd/clm/src/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/biogeochem/MEGANFactorsMod.F90 -M models/lnd/clm/src/biogeochem/SatellitePhenologyMod.F90 -M models/lnd/clm/src/biogeochem/CNWoodProductsMod.F90 -M models/lnd/clm/src/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/biogeochem/CNDVLightMod.F90 -M models/lnd/clm/src/biogeochem/NutrientCompetitionMethodMod.F90 -M models/lnd/clm/src/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/biogeochem/ch4varcon.F90 -M models/lnd/clm/src/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/biogeochem/CNCStateUpdate3Mod.F90 -M models/lnd/clm/src/biogeochem/CNSharedParamsMod.F90 -M models/lnd/clm/src/biogeochem/CNDVType.F90 -M models/lnd/clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 -M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/biogeochem/CNNStateUpdate2Mod.F90 -M models/lnd/clm/src/biogeochem/CropType.F90 -M models/lnd/clm/src/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/biogeochem/CNVegStructUpdateMod.F90 -M models/lnd/clm/src/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/biogeochem/CNC14DecayMod.F90 - ---------------------------------------------------- -Moved frictionvel_type to FrictionVelocityMod ---------------------------------------------------- -D models/lnd/clm/src/biogeophys/FrictionVelocityType.F90 - ---------------------------------------------------- -Moved aerosol_type to AerosolMod ---------------------------------------------------- -D models/lnd/clm/src/biogeophys/AerosolType.F90 - ---------------------------------------------------- -Moved photosyns_type to PhotosynthesisMod ---------------------------------------------------- -D models/lnd/clm/src/biogeophys/PhotosynthesisType.F90 - ---------------------------------------------------- -Moved soilstate cold start initialization to a new module ---------------------------------------------------- -A models/lnd/clm/src/biogeophys/SoilStateInitTimeConstMod.F90 - ---------------------------------------------------- -Moved soilhydrology time constant initialization to a new module ---------------------------------------------------- -A models/lnd/clm/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 - ---------------------------------------------------- -ED Refactorization1 -(1) EDPhenologyMod changed to EDPhenologyType -(2) EDBioType moved as a module type (ed_clm_type) in EDCLMLINKMod.F90 -(3) EDVecPatchType no longer needed (for now is_veg, is_bareground and wt_ed are in PatchType.F90) ---------------------------------------------------- -D models/lnd/clm/src/ED/main/EDBioType.F90 -M models/lnd/clm/src/ED/main/EDCLMLinkMod.F90 -D models/lnd/clm/src/ED/main/EDVecPatchType.F90 -D models/lnd/clm/src/ED/biogeophys/EDPhenologyMod.F90 -A models/lnd/clm/src/ED/biogeochem/EDPhenologyType.F90 -A models/lnd/clm/src/ED/biogeochem/EDSharedParamsMod.F90 - ---------------------------------------------------- -ED Refactorization2 -(1) Modified EDTypesMod.F90 - Removed gridcell_edstate_type (array of pointers) and instance - gridcelledstate - now have the following ED types and instance - defined in clm_instMod.F90 and passed down in clm_initialize and clm_driver (top level) - type(ed_site_type), allocatable, target :: ed_allsites_inst(:) - type(ed_phenology_type) :: ed_phenology_inst - type(ed_clm_type) :: ed_clm_inst - so now have ed_allsites_inst which is an array of sites (at this point allocated at the - gridcell level - but that could easily be modified to be at some other level like the - column level -(2) In EDTypesMod.F90 added method map_clmpatch_to_edpatch that - maps a CLM vector patch to an ED linked-list patch - there is still - a one to one correspondence between an ED patch and a CLM vector patch. The - call looks like the following - currentPatch => map_clmpatch_to_edpatch(ed_allsites_inst(g), p) - -(3) In EDTypesMod.F90 added a ED Patch type-bound method set_root_fraction that computes - the root fraction for an ED patch -(4) In EDTypes.F90 eliminated the following components of userdata - type (site) , pointer :: firstsite_pnt => null() ! pointer to the first site in the system - type (cohort), pointer :: storesmallcohort => null() ! storage of the smallest cohort for insertion routine - type (cohort), pointer :: storebigcohort => null() ! storage of the largest cohort for insertion routine - These are no longer needed since the above pointers are now local variables - in EDCohortDynamics and EDPatchDynamics ---------------------------------------------------- -M models/lnd/clm/src/ED/main/EDVecCohortType.F90 -M models/lnd/clm/src/ED/main/EDRestVectorMod.F90 -M models/lnd/clm/src/ED/main/EDInitMod.F90 -M models/lnd/clm/src/ED/main/EDMainMod.F90 -M models/lnd/clm/src/ED/main/EDTypesMod.F90 -M models/lnd/clm/src/ED/fire/SFMainMod.F90 -M models/lnd/clm/src/ED/biogeochem/EDGrowthFunctionsMod.F90 -M models/lnd/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 -M models/lnd/clm/src/ED/biogeochem/EDPhysiologyMod.F90 -M models/lnd/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 -M models/lnd/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 -M models/lnd/clm/src/ED/biogeophys/EDAccumulateFluxesMod.F90 -M models/lnd/clm/src/ED/biogeophys/EDSurfaceAlbedoMod.F90 -M models/lnd/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 -M models/lnd/clm/src/ED/biogeophys/EDBtranMod.F90 - ---------------------------------------------------- -The following changes are implemented below (and in the above routines) -(1) _vars% changed to _inst% -(2) pft% changed to patch% -(3) merged ecophyscon and pftvarcon into single derived type pftcon (in pftconMod) - "use EcophysConType, only : ecophyscon" changed to "use pftconMod, only : pftcon" -(4) module save statements removed in majority of routines ---------------------------------------------------- -D models/lnd/clm/src/main/EcophysConType.F90 -D models/lnd/clm/src/main/pftvarcon.F90 -A models/lnd/clm/src/main/pftconMod.F90 -M models/lnd/clm/src/main/initInterp.F90 -M models/lnd/clm/src/main/clm_varpar.F90 -M models/lnd/clm/src/main/landunit_varcon.F90 -M models/lnd/clm/src/main/accumulMod.F90 -M models/lnd/clm/src/main/subgridWeightsMod.F90 -M models/lnd/clm/src/main/decompInitMod.F90 -M models/lnd/clm/src/main/clm_initializeMod.F90 -M models/lnd/clm/src/main/subgridRestMod.F90 -M models/lnd/clm/src/main/ColumnType.F90 -M models/lnd/clm/src/main/subgridMod.F90 -M models/lnd/clm/src/main/PatchType.F90 -M models/lnd/clm/src/main/ndepStreamMod.F90 -M models/lnd/clm/src/main/lnd2atmType.F90 -M models/lnd/clm/src/main/atm2lndType.F90 -M models/lnd/clm/src/main/histFileMod.F90 -M models/lnd/clm/src/main/restFileMod.F90 -M models/lnd/clm/src/main/clm_varsur.F90 -M models/lnd/clm/src/main/LandunitType.F90 -M models/lnd/clm/src/main/GetGlobalValuesMod.F90 -M models/lnd/clm/src/main/controlMod.F90 -M models/lnd/clm/src/main/initSubgridMod.F90 -M models/lnd/clm/src/main/filterMod.F90 -M models/lnd/clm/src/main/lnd2glcMod.F90 -M models/lnd/clm/src/main/clm_driver.F90 -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/main/subgridAveMod.F90 -M models/lnd/clm/src/main/initGridCellsMod.F90 -M models/lnd/clm/src/main/atm2lndMod.F90 -M models/lnd/clm/src/main/lnd2atmMod.F90 -M models/lnd/clm/src/main/ncdio_pio.F90 -M models/lnd/clm/src/main/surfrdMod.F90 -M models/lnd/clm/src/main/decompMod.F90 -M models/lnd/clm/src/main/reweightMod.F90 -M models/lnd/clm/src/main/readParamsMod.F90 -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/WaterfluxType.F90 -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/biogeophys/SnowSnicarMod.F90 -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/LakeTemperatureMod.F90 -M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/biogeophys/SoilFluxesMod.F90 -M models/lnd/clm/src/biogeophys/TemperatureType.F90 -M models/lnd/clm/src/biogeophys/HumanIndexMod.F90 -M models/lnd/clm/src/biogeophys/PhotosynthesisMod.F90 -M models/lnd/clm/src/biogeophys/LakeFluxesMod.F90 -M models/lnd/clm/src/biogeophys/AerosolMod.F90 -M models/lnd/clm/src/biogeophys/ActiveLayerMod.F90 -M models/lnd/clm/src/biogeophys/SurfaceResistanceMod.F90 -M models/lnd/clm/src/biogeophys/SoilStateType.F90 -M models/lnd/clm/src/biogeophys/SoilHydrologyType.F90 -M models/lnd/clm/src/biogeophys/HydrologyDrainageMod.F90 -M models/lnd/clm/src/biogeophys/UrbanAlbedoMod.F90 -M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/biogeophys/RootBiophysMod.F90 -M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/biogeophys/SoilWaterMovementMod.F90 -M models/lnd/clm/src/biogeophys/SoilMoistStressMod.F90 -M models/lnd/clm/src/biogeophys/UrbBuildTempOleson2015Mod.F90 -M models/lnd/clm/src/biogeophys/CanopyHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/EnergyFluxType.F90 -M models/lnd/clm/src/biogeophys/CanopyStateType.F90 -M models/lnd/clm/src/biogeophys/UrbanFluxesMod.F90 -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/biogeophys/UrbanRadiationMod.F90 -M models/lnd/clm/src/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/IrrigationMod.F90 -M models/lnd/clm/src/biogeophys/CanopyTemperatureMod.F90 -M models/lnd/clm/src/biogeophys/HydrologyNoDrainageMod.F90 -M models/lnd/clm/src/biogeophys/LakeHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/UrbanParamsType.F90 -M models/lnd/clm/src/dyn_subgrid/dynLandunitAreaMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynTimeInfoMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynFileMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynConsBiogeochemMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynPriorWeightsMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynVarMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynEDMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynVarTimeInterpMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynCNDVMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynVarMod.F90.in -M models/lnd/clm/src/dyn_subgrid/dynVarTimeInterpMod.F90.in -M models/lnd/clm/src/dyn_subgrid/dynInitColumnsMod.F90 -M models/lnd/clm/src/cpl/lnd_comp_esmf.F90 -M models/lnd/clm/src/cpl/lnd_import_export.F90 -M models/lnd/clm/src/cpl/lnd_comp_mct.F90 -M models/lnd/clm/src/utils/accumulMod.F90 -M models/lnd/clm/src/utils/domainMod.F90 - ---------------------------------------------------- -Changes for Unit testing ---------------------------------------------------- -R models/lnd/clm/src/ED/main/CMakeLists.txt -M models/lnd/clm/src/unit_test_shr/unittestSubgridMod.F90 -M models/lnd/clm/src/CMakeLists.txt - ---------------------------------------------------- -Configuration changes for new soilbiogeochem/ ---------------------------------------------------- -M models/lnd/clm/bld/configure - -CLM testing: - - unit-tests (models/lnd/clm/src): - - yellowstone - okay - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - okay - yellowstone_pgi - okay - yellowstone_gnu - okay - goldbach_nag - okay - - goldbach_intel (moved these to yellowstone_intel for future tests) - -CLM tag used for the baseline comparisons: clm4_5_1_r096 - -Changes answers relative to baseline: NO (bit-for-bit) - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r096 -Originator(s): erik (Erik) -Date: Wed Nov 19 02:11:09 MST 2014 -One-line Summary: Several answer changing bug-fixes: snow grain size, lake hydrology, default settings, organic soil - -Purpose of changes: - -Bring in several bug-fixes most of which change answers. - -Snow grain size bug that Mark Flanner discovered under snow layer combination. -Lake hydrology fix from Zack Subin that would rarely cause the code to abort. Snow depth fix from -Sean Swenson. Use Priglent inversion as recommended by Charlie Koven. Correct population density for 2000 conditions -from 1850 to peroperly be 2000. Modify all Carbon on spinup from Dave Lawrenece. Add option to square or not square -the organic fraction (default is to square for clm4_5 and to NOT for clm5_0). Bug with pervious road that Keith -Oleson found. Simplify an if for urban to consistently use a double precision constant. Point to the new CLMNCEP_V5 -dataset. - -For clm4_0 rcp6 and rcp8.5 pftdyn datasets are updated for after 2005. - -Some fixes that don't change answers. Get the Prigilent inversion and usephfact options working again. -Fix a bug in interp_source option that Sean Swenson found. Split out test datasets for getregional script since -the datasets all have to be at the same resolution as the domain file. Also read filelist rather than use env -variables. - -Requirements for tag: Fix the bugs below - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1934 -- snow grain size (both clm4_0 and clm4_5). Just fix on clm4_5 side. - 1717 -- lake hydrology fix (clm4_5 only) - 1941 -- snowdp fix from Sean (both clm4_0 and clm4_5) (fix in clm4_5_1_r087) - 1759 -- ngwh for clm4_0 datasets (apply cesm1_2_x_n10_clm4_5_10) - 1772 -- use Priglent inversion - 1838 -- pop dens is 1850 for 2000 compsets - 1774 -- modify all Carbon on spinup - 1765 -- remove duplicate setting of bd and tkdry - 1764 -- Bug with pervious road - 2066 -- getregional_datasets.pl bug for long lists of files - 2067 -- get Prigilent inversion and usephfact options working. - 2081 -- point to new CLMNCEP_V5 version - 2061 -- make constant consistently double precision rather than have an if around it - 2089 -- bug in interp_source that Sean Swenson found - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Add organic_frac_squared=.false. logical as a clm5_0 default feature - The old behavior organic_frac_squared=.true. is on as before for clm4_5. - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, dlawren, swensosc, mflanner, subin - -List any svn externals directories updated (csm_share, mct, etc.): datm - update datm to datm8_141113 update CRUNCEP_V5 dataset version used - -List all files eliminated: None - -List all files added and what they do: - -=========== Split out getregional lists (all files in list MUST be at same res as domain file) -A models/lnd/clm/test/tools/nl_files/getregional_05popd -A models/lnd/clm/test/tools/nl_files/getregional_T62 -A models/lnd/clm/test/tools/nl_files/getregional_ndep -A models/lnd/clm/tools/shared/ncl_scripts/sample_inlist_0.5popd -A models/lnd/clm/tools/shared/ncl_scripts/sample_inlist_ndep -A models/lnd/clm/tools/shared/ncl_scripts/sample_outlist_0.5popd -A models/lnd/clm/tools/shared/ncl_scripts/sample_outlist_ndep -A models/lnd/clm/tools/shared/ncl_scripts/sample_inlist_T62 -A models/lnd/clm/tools/shared/ncl_scripts/sample_outlist_T62 - -List all existing files that have been modified, and describe the changes: - -=========== Change getregional tests -M models/lnd/clm/test/tools/input_tests_master -M models/lnd/clm/test/tools/tests_posttag_nompi_regression - -=========== Bring in -M models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.pl -M models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.ncl -M models/lnd/clm/tools/shared/ncl_scripts/sample_inlist -M models/lnd/clm/tools/shared/ncl_scripts/sample_outlist - -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl ------------ correct number of tests -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml ---- Update rcp6 and rcp8.5 pftdyn datasets -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ---- Add organic_frac_squared, - set fin_use_fsat=.false. by default -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -- Add organic_frac_squared -M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml ------ Correct year for popd from 1850 to 2000 -M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - Correct year for popd from 1850 to 2000 - -M models/lnd/clm/bld/CLMBuildNamelist.pm - Add organic_frac_squared and change setup_logic_more_vertlayers to - setup_logic_soilstate - -M models/lnd/clm/src/utils/CMakeLists.txt - Add namelist util to source list - -M models/lnd/clm/src/biogeochem/ch4Mod.F90 ------------- Pass fsurdat to initCold -M models/lnd/clm/src/biogeochem/CNCarbonStateType.F90 -- Use nlevdecomp_full in place of nlevdecomp -M models/lnd/clm/src/main/initInterp.F90 --------------- Change use of rbufsli to rbufslo -M models/lnd/clm/src/main/clm_initializeMod.F90 -------- Pass nlfilename into soilstate_vars init -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ---- Add col%itype(c) == icol_road_perv to an if condition -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 - Use 1.0_r8 constant always, rather than integer 1 - for clm4_5 -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 --- Use Mass-weighted combination of radius for combo -M models/lnd/clm/src/biogeophys/SoilStateType.F90 ------ Add organic_frac_squared logical and namelist read - for it. Add two if's that determine if organic_frac - should be squared or not. -M models/lnd/clm/src/biogeophys/LakeHydrologyMod.F90 --- Break apart if-condition for snl==-1 - -CLM testing: regular - - build-namelist tests: - - yellowstone yes - - unit-tests (models/lnd/clm/src): - - yellowstone yes (although still fails) - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - goldbach_nag yes - goldbach_intel yes - - short tests (aux_clm_short) (generally these are NOT used when making a tag): - - yellowstone_intel yes - yellowstone_pgi yes - goldbach_nag yes - - tools testing: (when tools modified or scripts updated (for PTCLM)) - - yellowstone interactive yes - PTCLM (models/lnd/clm/tools/shared/PTCLM/test) yellowstone yes - -CLM tag used for the baseline comparisons: - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5 and clm5_0 - - what platforms/compilers: all - - nature of change (similar climate, except new clm5_0 feature) - - clm4_0 for rcp6 and rcp8.5 changes answers by using the new good wood harvest - datasets for after 2005. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - /home/erik/noorg_clm451r092_I1850CRUCLM45BGC -- clm4_5 default version - /home/erik/clm451r092_I1850CRUCLM45BGC -------- clm4_5 with organic_frac_squared=.false. - (clm5_0 default version) - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r095 -Originator(s): andre (Benjamin Andre,UCAR/CSEG,303-497-1391) -Date: Mon Nov 10 17:54:18 MST 2014 -One-line Summary: refactoring N comp by Jinyun Tang (LBL) and transpiration sink isolation by Gautam Bisht (LBL) - -Purpose of changes: Bring in two refactorings: - Jinyun Tang (LBL) - isolation of the routines to do soil nutrient - competition dynamics into a module, and allow for different - implementations through runtime polymorphism. - - Gautam Bisht (LBL) - new function to make transpiration sink - distribution independent of subsurface flow physics - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2039 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: andre, cmt - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -Nutrient Competition - List all files added and what they do: - A clm/src/biogeochem/NutrientCompetitionFactoryMod.F90 - factory module to select soil nutrient competition method - A clm/src/biogeochem/NutrientCompetitionMethodMod.F90 - abstract base class for soil nutrient competition dynamics - A clm/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 - existing clm45 implementation of soil nutrient competition dynamics - - List all existing files that have been modified, and describe the changes: - M clm/src/biogeochem/CNDecompMod.F90 - add nutrient competition method to function parameters - M clm/src/biogeochem/CropType.F90 - rename UpdateAccVars() to work around pgi compiler error, remove dependency on temperature_type - M clm/src/biogeochem/CNAllocationMod.F90 - move code into clm45 default nutrient competition module - M clm/src/biogeochem/CNEcosystemDynMod.F90 - add nutrient competition method to function parameters - MM clm/src/main/clm_initializeMod.F90 - add nutrient competition method to function parameters - M clm/src/main/clm_driver.F90 - add nutrient competition method to function parameters, call to renamed CropUpdateAccVars - M clm/src/main/readParamsMod.F90 - add nutrient competition method to function parameters - -Transpiration Sink: - List all existing files that have been modified, and describe the changes: -M clm/src/biogeophys/SoilWaterMovementMod.F90 - move transpiration sink into separate function so it is independent of physics. - - -CLM testing: - - build-namelist tests: n/a - - unit-tests (models/lnd/clm/src): no - - yellowstone - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - 4.0 ok; 4.5 ok - yellowstone_pgi - 4.0 ok; 4.5 ok - yellowstone_gnu - n/a; 4.5 ok - goldbach_nag - 4.0 ok; 4.5 ok - goldbach_intel - 4.0 ok; 4.5 ok - - short tests (aux_clm_short) - no - - tools testing: (when tools modified or scripts updated (for PTCLM)) - n/a - -CLM tag used for the baseline comparisons: clm4_5_1_r094 - -Changes answers relative to baseline: no - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r094 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Fri Nov 7 13:43:38 MST 2014 -One-line Summary: misc. glacier-related updates - -Purpose of changes: - -(1) Add dlnd, satm and srof externals, so that TG compsets (CISM-only, forced by - dlnd) can be run from a CLM tag. This will facilitate CISM development and - testing. - -(2) Remove CLM's dependence on the CISM grid. Previously, CLM used the CISM grid - to determine which fglcmask file to use. But the differences between the - fglcmask files were inconsequential (all of them included the full area of - Greenland, which is what was important). I have created a new set of - fglcmask files that are independent of the CISM grid, and point CLM to these - new files. This will make it easier to add new CISM grids in the future, - because no changes will be needed in CLM for this purpose. However, note - that the use of these new files means that the number of virtual landunits & - columns changes for glcmec runs. - -(3) In subgridAveMod, fix c2l routines: change pft%wtlunit to col%wtlunit (bugz - 2077) - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): -- 2077 (c2l references pft instead of col) -- 2085 (listDefaultNamelist is broken) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: change fglcmask - -List any changes to the defaults for the boundary datasets: change fglcmask - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - -========= Added new externals for the sake of running TG compsets (CISM-only) - from a CLM tag -+models/lnd/dlnd https://svn-ccsm-models.cgd.ucar.edu/dlnd7/trunk_tags/dlnd8_131201 -+models/atm/satm https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_04/satm -+models/rof/srof https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_04/srof - -========= Other externals updates --tools/unit_testing https://svn-ccsm-models.cgd.ucar.edu/unit_testing/trunk_tags/unit_testing_0_07 -+tools/unit_testing https://svn-ccsm-models.cgd.ucar.edu/unit_testing/trunk_tags/unit_testing_0_08 - - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -========= Remove dependence on CISM grid -M models/lnd/clm/bld/listDefaultNamelist.pl - - also fix bug 2085 -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml -M models/lnd/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -M models/lnd/clm/bld/clm.buildnml.csh -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults.xsl -M models/lnd/clm/bld/user_nl_clm -M models/lnd/clm/bld/CLMBuildNamelist.pm -M models/lnd/clm/doc/UsersGuide/custom.xml -M models/lnd/clm/src_clm40/main/controlMod.F90 -M models/lnd/clm/src_clm40/main/clm_varctl.F90 -M models/lnd/clm/src/main/controlMod.F90 -M models/lnd/clm/src/main/clm_varctl.F90 - -========= Change pft%wtlunit to col%wtlunit in c2l routines (which currently - aren't called from anywhere in the code) (bugz 2077) -M models/lnd/clm/src/main/subgridAveMod.F90 - -========= fix numbers of build-namelist unit test failures, due to removal of a test -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - expected failure in 23, due to change in fglcmask - - unit-tests (models/lnd/clm/src): - - yellowstone: still broken, due to internal compiler error - roo2 (mac laptop): ok - - See notes in clm4_5_1_r090. Point (2) has been fixed, but point (1) remains. - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu: ok - goldbach_nag: ok - goldbach_intel: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r093 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: IG compsets - both CLM40 and CLM45 - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - only changes diagnostic cpl hist fields - no change in the simulation - - The changes arise from the new glcmask files, which exclude a few points - from the glcmask that used to be included. These points are all outside - of Greenland, so they are not important for coupling to CISM. However, - it means that a few virtual columns have been removed. This, in turn, - changes the values of some l2x topo, tsrf and qice fields sent to the - coupler. But this does NOT feed back on the simulation in any way. - - Some tests also exhibit diffs in the CLM diagnostic fields PCT_GLC_MEC - and QICE_FORC. Again, these are due to changes in where we have virtual - columns, and do not affect the simulation. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r093 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Fri Nov 7 13:17:47 MST 2014 -One-line Summary: change cold-start snow initialization, update cism external - -Purpose of changes: - -(1) Change cold-start snow initialization logic. The original logic did -different snow initialization depending on whether we are inside or outside the -glcmask. That's a problem in that answers change depending on the glcmask. The -new logic instead uses a latitude threshold for determining where to initialize -a non-zero snow pack. Note that this will change answers for all cold-start -cases, including non-glcmec cases. - -(2) Update CISM to version 2. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self; Dave Lawrence agreed with the change to snow initialization - -List any svn externals directories updated (csm_share, mct, etc.): --models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_140916 -+models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism2_0_02 - - -List all files eliminated: - -List all files added and what they do: - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/main/clm_initializeMod.F90 - -CLM testing: - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu: ok - goldbach_nag: ok - goldbach_intel: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r092 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - (1) any CLM4.5 case with cold start initialization, due to change in snow - initialization - - (2) any case that includes CISM, due to answer changes in the CISM external - - I carefully checked the yellowstone-intel clm4.5 tests to ensure that: - (a) FAILed compare_hist all had finidat = ' ' - (b) PASSed compare_hist either had non-blank finidat OR were single-point - - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated, but expected to be larger than roundoff/same climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r092 -Originator(s): muszala (Stefan Muszala) -Date: Tue Nov 4 06:10:16 MST 2014 -One-line Summary: bug fixes from santos that address valgrind problems. update rtm external - -Purpose of changes: Addresses issues found with Valgrind by Santos. Update RTM. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: santos, self - -List any svn externals directories updated (csm_share, mct, etc.): --models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_39 -+models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_40 - -List all files eliminated: N/A - -List all files added and what they do: - -A + models/lnd/clm/src/main/dtypes.h - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml --- update failures - -M SVN_EXTERNAL_DIRECTORIES --- rtm update to 40 - -M models/lnd/clm/src_clm40/main/ncdio_pio.F90 -M models/lnd/clm/src_clm40/main/ncdio_pio.F90.in -M models/lnd/clm/src/main/ncdio_pio.F90 -M models/lnd/clm/src/main/ncdio_pio.F90.in --- example changes: -- status = pio_inq_vardimid(ncid, vardesc , dids) -+ status = pio_inq_vardimid(ncid, vardesc , dids(1:ndims)) - -M models/lnd/clm/src_clm40/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/biogeophys/FrictionVelocityMod.F90 --- change 1.0_8 to 1.0_r8 - -CLM testing: - - build-namelist tests: N/A - - unit-tests (models/lnd/clm/src): N/A - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel 40- OK 45- OK - yellowstone_pgi 40- OK 45- OK - yellowstone_gnu 40- N/A 45- OK - goldbach_nag 40- OK 45- OK - goldbach_intel 40- OK 45- OK - - tools testing: (when tools modified or scripts updated (for PTCLM)) N/A - -CLM tag used for the baseline comparisons: clm4_5_1_r091 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r091 -Originator(s): muszala (Stefan Muszala) -Date: Mon Oct 27 09:48:56 MDT 2014 -One-line Summary: update externals. fix bug so CLM runs with Intel 14x. - -Purpose of changes: Update externals. Fix bug in VOCEmissionMod.F90 that prevented -CLM from running with Intel 14x on yellowstone. Bring in workaround for bug 1730 from -Sacks. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - see CLM test fail list - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, clm developers, particularly Bill Sacks. - -List any svn externals directories updated (csm_share, mct, etc.): --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_141009 -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_141023 --scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_141001 -+scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_141017a --models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_141003 -+models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_141022 --models/utils/timing https://svn-ccsm-models.cgd.ucar.edu/timing/trunk_tags/timing_140416 -+models/utils/timing https://svn-ccsm-models.cgd.ucar.edu/timing/trunk_tags/timing_140925 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - --- reflect changes in new testlists -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml --- Sacks' workaround for bug 1730 -M models/lnd/clm/src/main/histFileMod.F90 -M models/lnd/clm/src/main/ncdio_pio.F90 -M models/lnd/clm/src/main/ncdio_pio.F90.in --- remove duplicate assignment of 0_r8 to meg_out(imeg)%flux_out -M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 --- update externals -M SVN_EXTERNAL_DIRECTORIES - -CLM testing: - - Please view the CLM expected fail list for new test failures. They are matched - to bugzilla bug ids. - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - 40 - OK 45 - OK - yellowstone_pgi - 40 - OK 45 - OK - yellowstone_gnu - 40 - N/A 45 - OK - goldbach_nag - 40 - OK 45 - OK - goldbach_intel - 40 - OK 45 - OK - -CLM tag used for the baseline comparisons: clm4_5_1_r090 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r090 -Originator(s): sacks (Bill Sacks) -Date: Thu Oct 16 06:39:52 MDT 2014 -One-line Summary: modularize irrigation; do some unit test rework - -Purpose of changes: - -(1) Pull irrigation code out of CanopyFluxes and CanopyHydrology, into its - own module - -(2) Pull out the locally-created filters from CanopyFluxes and BareGroundFluxes - into filterMod, in order to support pulling irrigation out of - CanopyFluxes. This will also be needed to support pulling other hydrology - stuff out of CanopyFluxes. - -(3) Add unit tests for irrigation - -(4) Rework some irrigation infrastruture, and add some more unit test utility - routines - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2063 (HumanIndexMod fails to compile with gfortran) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: muszala - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: - -========= Renamed to unit_test_stubs -D models/lnd/clm/src/unit_test_mocks/util_share/ncdio_var.F90 -D models/lnd/clm/src/unit_test_mocks/util_share/restUtilMod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/util_share/GetGlobalValuesMod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/util_share/ncdio_var.F90.in -D models/lnd/clm/src/unit_test_mocks/util_share/restUtilMod_mock.F90.in -D models/lnd/clm/src/unit_test_mocks/util_share/clm_time_manager_mock.F90 -D models/lnd/clm/src/unit_test_mocks/util_share/ncdio_pio_mock.F90 -D models/lnd/clm/src/unit_test_mocks/util_share/spmdMod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/util_share/do_genf90 -D models/lnd/clm/src/unit_test_mocks/util_share/CMakeLists.txt -D models/lnd/clm/src/unit_test_mocks/util_share/ncdio_pio_mock.F90.in -D models/lnd/clm/src/unit_test_mocks/util_share -D models/lnd/clm/src/unit_test_mocks/csm_share/shr_mpi_mod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/csm_share/mct_mod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/csm_share/CMakeLists.txt -D models/lnd/clm/src/unit_test_mocks/csm_share -D models/lnd/clm/src/unit_test_mocks/main/CMakeLists.txt -D models/lnd/clm/src/unit_test_mocks/main/histFileMod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/main -D models/lnd/clm/src/unit_test_mocks/dyn_subgrid/dynFileMod_mock.F90 -D models/lnd/clm/src/unit_test_mocks/dyn_subgrid/CMakeLists.txt -D models/lnd/clm/src/unit_test_mocks/dyn_subgrid -D models/lnd/clm/src/unit_test_mocks/CMakeLists.txt -D models/lnd/clm/src/unit_test_mocks - -========= Remove unnecessary files -D models/lnd/clm/src/ED/CMakeLists.txt -D models/lnd/clm/src/ED/biogeophys/CMakeLists.txt - -List all files added and what they do: - -========= Pull out irrigation code into its own module -A models/lnd/clm/src/biogeophys/IrrigationMod.F90 - -========= Add some unit test utility code (and some tests for the utility code) -A models/lnd/clm/src/unit_test_shr/unittestFilterBuilderMod.F90 -A models/lnd/clm/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 -A models/lnd/clm/src/unit_test_shr/test/unittestFilterBuilder_test/test_filterBuilder.pf -A models/lnd/clm/src/unit_test_shr/test/unittestFilterBuilder_test/CMakeLists.txt -A models/lnd/clm/src/unit_test_shr/test/unittestFilterBuilder_test -A models/lnd/clm/src/unit_test_shr/test/CMakeLists.txt -A models/lnd/clm/src/unit_test_shr/test - -========= Renamed from unit_test_mocks to unit_test_stubs; also renamed - individual files from mock to stub (or 'fake' for ncdio_pio, because - it does more than a stub); also, moved some stubs to match the current - organization of the main source tree -A models/lnd/clm/src/unit_test_stubs/utils/restUtilMod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/utils/do_genf90 -A models/lnd/clm/src/unit_test_stubs/utils/restUtilMod_stub.F90.in -A models/lnd/clm/src/unit_test_stubs/utils/CMakeLists.txt -A models/lnd/clm/src/unit_test_stubs/utils/clm_time_manager_stub.F90 -A models/lnd/clm/src/unit_test_stubs/utils/spmdMod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/utils -A models/lnd/clm/src/unit_test_stubs/csm_share/shr_mpi_mod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/csm_share/mct_mod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/csm_share/CMakeLists.txt -A models/lnd/clm/src/unit_test_stubs/csm_share -A models/lnd/clm/src/unit_test_stubs/main/histFileMod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/main/ncdio_var.F90 -A models/lnd/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90 -A models/lnd/clm/src/unit_test_stubs/main/ncdio_var.F90.in -A models/lnd/clm/src/unit_test_stubs/main/GetGlobalValuesMod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/main/do_genf90 -A models/lnd/clm/src/unit_test_stubs/main/ncdio_pio_fake.F90.in -A models/lnd/clm/src/unit_test_stubs/main/CMakeLists.txt -A models/lnd/clm/src/unit_test_stubs/main -A models/lnd/clm/src/unit_test_stubs/dyn_subgrid/dynFileMod_stub.F90 -A models/lnd/clm/src/unit_test_stubs/dyn_subgrid/CMakeLists.txt -A models/lnd/clm/src/unit_test_stubs/dyn_subgrid -A models/lnd/clm/src/unit_test_stubs/CMakeLists.txt -A models/lnd/clm/src/unit_test_stubs - -========= Add dependencies (direct & indirect) of IrrigationMod -A models/lnd/clm/src/biogeochem/CMakeLists.txt - -========= Add unit tests for irrigation (see README file for some design notes) -A models/lnd/clm/src/biogeophys/test/Irrigation_test/test_irrigation_deficit.pf -A models/lnd/clm/src/biogeophys/test/Irrigation_test/test_irrigation_multipatch.pf -A models/lnd/clm/src/biogeophys/test/Irrigation_test/IrrigationWrapperMod.F90 -A models/lnd/clm/src/biogeophys/test/Irrigation_test/test_irrigation_singlepatch.pf -A models/lnd/clm/src/biogeophys/test/Irrigation_test/CMakeLists.txt -A models/lnd/clm/src/biogeophys/test/Irrigation_test/README -A models/lnd/clm/src/biogeophys/test/Irrigation_test - -List all existing files that have been modified, and describe the changes: - -========= Pull irrigation out of CanopyFluxes into its own routine, and also - pull out the filters that used to be created locally in CanopyFluxes - and BareGroundFluxes -M models/lnd/clm/src/main/clm_driver.F90 - -========= Pull out filters that used to be created locally in CanopyFluxes and - BareGroundFluxes, so that they can be reused in irrigation and - elsewhere -M models/lnd/clm/src/main/filterMod.F90 - -========= Add calls to irrigation init & restart routines -MM models/lnd/clm/src/main/clm_initializeMod.F90 -M models/lnd/clm/src/main/restFileMod.F90 - -========= Irrigation computations are now done in the irrigation module; also, - the relevant filter is now created outside CanopyFluxes -MM models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 - -========= Irrigation computations are now done in the irrigation module -M models/lnd/clm/src/biogeophys/CanopyHydrologyMod.F90 -M models/lnd/clm/src/biogeophys/LakeHydrologyMod.F90 - -========= Irrigation variables are now defined in the irrigation module -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/WaterfluxType.F90 -M models/lnd/clm/src/biogeophys/HydrologyDrainageMod.F90 - -========= Filter is now created outside BareGroundFluxes; also, moved some bare - ground initialization from CanopyFluxes (needed because the filters - are no longer created locally, so CanopyFluxes does not know what - points it would need to set for bare ground) -MM models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 - -========= Remove some dependencies to aid unit testing (this includes combining - two branches of a conditional (allowlakeprod) that were doing the same - thing -M models/lnd/clm/src/biogeophys/SoilStateType.F90 - - -========= Add dependencies (direct & indirect) of IrrigationMod for unit testing -M models/lnd/clm/src/utils/CMakeLists.txt -M models/lnd/clm/src/main/CMakeLists.txt -M models/lnd/clm/src/ED/main/CMakeLists.txt -M models/lnd/clm/src/CMakeLists.txt -M models/lnd/clm/src/biogeophys/CMakeLists.txt -M models/lnd/clm/src/biogeophys/test/CMakeLists.txt - -========= Add new unit test utilities -M models/lnd/clm/src/unit_test_shr/CMakeLists.txt - -========= Make newly-added subgrid units active by default -M models/lnd/clm/src/unit_test_shr/unittestSubgridMod.F90 - -========= Unrelated fix for gfortran -MM models/lnd/clm/src/biogeophys/HumanIndexMod.F90 - -========= Change whitespace -M models/lnd/clm/src/dyn_subgrid/CMakeLists.txt - - -CLM testing: - - build-namelist tests: - - yellowstone: not run - - unit-tests (models/lnd/clm/src): - - yellowstone: fail due to two issues: - - (1) The unit tests currently won't build on yellowstone due to an ICE that - will probably be fixed when we remove dependencies of SoilStateType. - - (2) In addition, even once that's fixed, the yellowstone unit tests either - need (a) a bump in the unit testing external (unit_testing_0_08) and - Machines external (Machines_141007) (I didn't do that for my tag because - it pulls in a bump in the intel compiler version to 14 rather than 13.1), - or (b) the following diffs: - - Index: tools/unit_testing/python/machine_setup.py - =================================================================== - --- tools/unit_testing/python/machine_setup.py (revision 64421) - +++ tools/unit_testing/python/machine_setup.py (working copy) - @@ -52,7 +52,7 @@ - mod.load("ncarenv/1.0") - mod.load("ncarbinlibs/1.0") - if compiler == "intel": - - mod.load("intel/13.1.2") - + mod.load("intel/14.0.2") - elif compiler == "pgi": - mod.load("pgi/13.9") - mod.load("ncarcompilers/1.0") - Index: scripts/ccsm_utils/Machines/config_compilers.xml - =================================================================== - --- scripts/ccsm_utils/Machines/config_compilers.xml (revision 64421) - +++ scripts/ccsm_utils/Machines/config_compilers.xml (working copy) - @@ -547,7 +547,7 @@ - -xHost - -xHost - $(TRILINOS_PATH) - - /glade/u/home/santos/pFUnit/pFUnit_Intel - + /glade/u/home/sacks/pFUnit/pFUnit3.0.1_Intel14.0.2_Serial - - - - - - - However, I have run the unit tests on my mac, with gfortran, and they all - pass - - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu: NOT RUN - goldbach_nag: ok - goldbach_intel: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r089 - -Changes answers relative to baseline: YES (but only because of bug 1998) - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: irrigation - - what platforms/compilers: all - - nature of change: larger than roundoff, not investigated closely - - The changes are entirely due to the btran bug (bug 1998): The old flow was: - - compute btran - - calculate irrigation (depends on btran) - - hack btran for soybeans - - whereas the new flow is: - - call CanopyFluxes: computes btran and hacks btran for soybeans - - calculate irrigation (depends on btran) - - I have confirmed that answers are bit-for-bit for both irrigation tests (for - both cpl and clm hist files), when I introduce the following diffs in both - the trunk and the branch: - - Index: src/biogeophys/CanopyFluxesMod.F90 - =================================================================== - --- src/biogeophys/CanopyFluxesMod.F90 (revision 64406) - +++ src/biogeophys/CanopyFluxesMod.F90 (working copy) - @@ -842,9 +842,6 @@ - btran(p) = min(1._r8, btran(p) * 3.33_r8) - end if - end if - - if (pft%itype(p) == nsoybean .or. pft%itype(p) == nsoybeanirrig) then - - btran(p) = min(1._r8, btran(p) * 1.25_r8) - - end if - end do - - if ( use_ed ) then - @@ -894,9 +891,6 @@ - btran(p) = min(1._r8, btran(p) * 3.33_r8) - end if - end if - - if (pft%itype(p) == nsoybean .or. pft%itype(p) == nsoybeanirrig) then - - btran(p) = min(1._r8, btran(p) * 1.25_r8) - - end if - end do - - call Photosynthesis (bounds, fn, filterp, & - - - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r089 -Originator(s): erik (Erik) -Date: Mon Oct 13 13:46:43 MDT 2014 -One-line Summary: Bring new urban building temperature to trunk as a clm5.0 feature - as well as human-stress index calculations - -Purpose of changes: - -New prognostic internal building air temperature methodology for CLM5.0. Retain the older simpler method -for CLM4.5. The namelist toggle to switch between them is: building_temp_method. By default for clm4_5 physics -the older method is used and for clm5_0 the newer one is used. Also add in a package of human-stress index -calculations. Again this is by default on for clm5_0 and off for clm4_5. - -The new building air temperature methodology, solves the system of equations for internal: air, roof, floor, -and wall (shade and sunlit) Temperatures. It uses the LAPACK subroutine DGESV to solve the system. It also -figures out the energy flux needed to either cool the building air temperature to a maximum allowed temperature -or to heat it to the minimum allowed temperature. - -Add in the new load balancing tool and the PyReshaper tool (changes multi-variable -monthly history files into single-variable time-series files). - -Remove the now unneeded clm4_5 interpinic as well as the mkmapgrids FORTRAN program. - -Requirements for tag: Bring in new clm5_0 building temperature as option, Fix scripts bugs, bug 2053/2032 - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 2053 Problems with dry-deposition for fully coupled cases with CLM4.5 in cesm1_3_beta13 - 2032 rtm.buildnml.csh kills cesm_setup if GET_REFCASE is FALSE - 1685 Drydeposition potentially using "rs" variable before it's defined (over water) - (was fixed but came back) - Fix bugs: 2024, 2035, 2037 in scripts SBN and namelistcompare issues - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: new namelists and namelist items - add: clmu_inparm and clm_humanindex_inparm namelists - move: urban_hac and urban_traffic to clmu_inparm - add: calc_human_stress_indices to clm_humanindex_inparm - building_temp_method to clmu_inparm - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: - clm5_0 memory use is greater than clm4_5 due to human_stress_indices calculations - and output on history (I've seen it make up to a 20% difference) - -Code reviewed by: self, oleson, sacks, mvertens, andre - -List any svn externals directories updated (csm_share, mct, etc.): scripts, Machines, rtm, cism, csm_share - Update to cesm1_3_alpha13c externals. - Also add in load_balancing_tool and pyReshaper - - scripts to scripts4_141009 - Machines to Machines_141001 - rtm to rtm1_0_39 - cism to cism1_140916 - csm_share to share3_141003 - load_balancing_tool to load_balancing_tool_140818 - pyReshaper to v0.9.1 - -List all files eliminated: - ---------- Remove clm4_5 interpinic, online interpinic supersedes it -D models/lnd/clm/tools/clm4_5/interpinic -D models/lnd/clm/tools/clm4_5/interpinic/* -D models/lnd/clm/tools/clm4_5/interpinic/src/* - ---------- Remove mkmapgrids program -D models/lnd/clm/tools/shared/mkmapgrids/src -D models/lnd/clm/tools/shared/mkmapgrids/src/* -D models/lnd/clm/tools/shared/mkmapgrids/mkmapgrids.namelist -D models/lnd/clm/tools/shared/mkmapgrids/mkmapgrids.csh - ---------- shr_sys_mod was mocked only because of it's use of shr_mpi_mod ---------- mock shr_mpi_mod instead and standard shr_sys_mod can be used -D models/lnd/clm/src/unit_test_mocks/csm_share/shr_sys_mod_mock.F90 - -List all files added and what they do: - -A models/lnd/clm/src/biogeophys/HumanIndexMod.F90 -- New module to - calculate a bunch of human stress index values. - -A models/lnd/clm/src/biogeophys/UrbBuildTempOleson2015Mod.F90 --- New module - for calculating the prognostic internal building air temperature. - ---------- New simple unit tester for humanstress indices module -A models/lnd/clm/src/biogeophys/test/HumanStress_test/test_humanstress.pf -A models/lnd/clm/src/biogeophys/test/HumanStress_test/CMakeLists.txt -A models/lnd/clm/src/biogeophys/test/HumanStress_test - -A models/lnd/clm/src/unit_test_mocks/csm_share/shr_mpi_mod_mock.F90 -- shell - for most shr_mpi_ calls that do nothing (so assumes MPI is NOT being done) - shr_mpi_abort does a stop - -List all existing files that have been modified, and describe the changes: - ---------- remove the mkgriddata and clm4_5 interpinic tools from testing -M models/lnd/clm/test/tools/input_tests_master -M models/lnd/clm/test/tools/tests_posttag_yong -M models/lnd/clm/test/tools/tests_posttag_nompi_regression -M models/lnd/clm/test/tools/tests_pretag_yellowstone_nompi - ---------- remove documentation of mkgriddata and clm4_5 interpinic tools ---------- but add documentation on ncl script -M models/lnd/clm/tools/shared/mkmapgrids/README -M models/lnd/clm/tools/README - ---------- Add new namelists: clmu_inparm and clm_humanindex_inparm -M models/lnd/clm/bld/configure ---- use same configuration for clm4_5 AND clm5_0 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Set - calc_human_stress_indices, and building_temp_method by clm4_5/clm5_0 -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Move - urban_hac and urban_traffic to new clmu_inparm namelist and - add building_temp_method and add calc_human_stress_indices to - clm_humanindex_inparm namelist -M models/lnd/clm/bld/CLMBuildNamelist.pm -------- Handle new namelists: - clmu_inparm and clm_humanindex_inparm - ---------- Get unit tests working again, and add a simple humanindex test -M models/lnd/clm/src/utils/CMakeLists.txt -M models/lnd/clm/src/ED/main/CMakeLists.txt -M models/lnd/clm/src/ED/biogeophys/CMakeLists.txt -M models/lnd/clm/src/README.unit_testing -M models/lnd/clm/src/biogeophys/CMakeLists.txt -M models/lnd/clm/src/biogeophys/test/CMakeLists.txt -M models/lnd/clm/src/unit_test_mocks/util_share/spmdMod_mock.F90 - set mpicom -M models/lnd/clm/src/unit_test_mocks/csm_share/CMakeLists.txt -M models/lnd/clm/src/CMakeLists.txt - ---------- Fix so can work with drydeposition namelist and without megan namelist -M models/lnd/clm/src/biogeochem/VOCEmissionMod.F90 - Don't initialize if - megan namelist is turned off (bug 2053) -M models/lnd/clm/src/biogeochem/DryDepVelocity.F90 - Make sure rs is set - before used (bug 1685) - ---------- Handle new building temperature options, add new constants -MM models/lnd/clm/src/main/clm_varcon.F90 -------- Bunch of new constants - for urban-building (should be moved to modules that use them). - Also pass is_simple_buildtemp into init method -MM models/lnd/clm/src/main/clm_initializeMod.F90 - Pass building temp type - down to relevent init methods add initialization for humanindex_vars, - initialize drydepvel_vars (bug 2053) -M models/lnd/clm/src/main/restFileMod.F90 ------- Pass building temp type - logicals down to energyflux_vars and temperature_vars restart methods -M models/lnd/clm/src/main/LandunitType.F90 ------ Add documentation, correct - error in documentation -MM models/lnd/clm/src/main/controlMod.F90 -------- Move urban namelist items to - UrbanReadNML, add HumanIndexReadNML -M models/lnd/clm/src/main/clm_driver.F90 -------- Pass humanindex_vars down as needed - ---------- Change for new shr_cal_mod names -M models/lnd/clm/src/ED/biogeophys/EDPhenologyMod.F90 - Use full name of month - "january" instead of "jan" - ---------- Add new building temperature module and add capability to do old clm4_5 ---------- method as well as new method, also do human_stress_indices calculations -MM models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 --- Add BuildingHAC for - simple building temp method (should move to it's own module) add if - statements for building_temp_method type, call BuildingTemperature - when prognostic method used -M models/lnd/clm/src/biogeophys/SoilFluxesMod.F90 -------- Change name of - eflx_building_heat to eflx_building_heat_errsoi -M models/lnd/clm/src/biogeophys/TemperatureType.F90 ------ Add building - temperature variables (should move to urbBuildTemp module), pass building_temp - method logical down for initialization, add documentation headers - hist, cold, and restart init depends on building temp method logical -M models/lnd/clm/src/biogeophys/LakeFluxesMod.F90 -------- calc_human_stress_indices - (should move to method in humanIndexMod) -MM models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 -- calc_human_stress_indices - (should move to method in humanIndexMod) -MM models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 ------ calc_human_stress_indices - (should move to method in humanIndexMod) -M models/lnd/clm/src/biogeophys/EnergyFluxType.F90 ---- change name of eflx_building_heat_col - to eflx_building_heat_errsoi_col, add some new building temperature flux terms - add documentation, alloc, hist, restart and cold initialization depends on - building temperature method type (should move to urban building module) -M models/lnd/clm/src/biogeophys/UrbanFluxesMod.F90 ---- Add private functions: - wasteheat, simple_wasteheatfromac, calc_simple_internal_building_temp - (should move to building_temp modules). - calc_human_stress_indices (should move to method in humanIndexMod) -M models/lnd/clm/src/biogeophys/UrbanParamsType.F90 --- Add methods: UrbanReadNML, - IsSimpleBuildTemp, IsProgBuildTemp, add clmu_inparm namelist, and move urban_* items - there and add building_temp_method to it. - -CLM testing: - - build-namelist tests: - - yellowstone yes - - unit-tests (models/lnd/clm/src): - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - goldbach_nag yes - goldbach_intel yes - - short tests (aux_clm_short): - - yellowstone_intel yes - yellowstone_pgi yes - goldbach_nag yes - - tools testing: - - yellowstone interactive yes - PTCLM (models/lnd/clm/tools/shared/PTCLM/test) yellowstone yes - -CLM tag used for the baseline comparisons: clm4_5_1_r088 - -Changes answers relative to baseline: No for CLM40 and CLM45 - But, answers DO change for CLM50 - (except scripts tag update changes history files for IG and irrigation compsets/tests) - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r088 -Originator(s): muszala (Stefan Muszala) -Date: Wed Oct 1 09:24:43 MDT 2014 -One-line Summary: Pull out ED deps. in TemperatureTypeMod, can now compile with pgi 14.7 - -Purpose of changes: Pull out the dependency on EDBioType in TemperatureType.F90. The ED -variables related to phenology now reside in EDPhenologyMod.F90. This refactor also had -the effect of getting past a PGI 14.7 ICE which looks like it was due to the use of EDbio_vars -in TemperatureType.F90. When I pulled out lines 1227 and 1226 of biogeophys/TemperatureType.F90 -(in clm4_5_1_r087) and passed the two EDbio_vars variables through the argument list the ICE -went away. - -This tag breaks ED restart tests. We went ahead with the tag because we had to fix a more -general problem with the CESM and CAM builds and PGI 14.7. the ED v0.1.0 branch does not -have these modifications and may be used as an alternative. A new clm tag will shortly -follow that addresses any remaining problems. - -Requirements for tag: None - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - -Temporary addition of a cal parameter type in a branch tag. Will be merged into csm_share trunk shortly. - --models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_140723 -+models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/branch_tags/share_ece_tags/share_ece_01_140723 - -List all files eliminated: N/A - -List all files added and what they do: - -! new home for ED phenology variables and type-bound procedures that -! allow for accumulation of buffers -A + models/lnd/clm/src/ED/biogeophys/EDPhenologyMod.F90 -! put some CMakeLists.txt in place for ED unittests -A + models/lnd/clm/src/ED/main/CMakeLists.txt -A + models/lnd/clm/src/ED/biogeophys/CMakeLists.txt -A + models/lnd/clm/src/ED/CMakeLists.txt - -List all existing files that have been modified, and describe the changes: - -! pull out deps. on EDBioType -M models/lnd/clm/src/biogeophys/TemperatureType.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/main/clm_initializeMod.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/main/restFileMod.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/main/clm_driver.F90 - -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/ED/biogeochem/EDPhysiologyMod.F90 -! pull out ED_GDD_patch and phen_cd_status_patch -M models/lnd/clm/src/ED/main/EDBioType.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/ED/biogeochem/EDPhysiologyMod.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/ED/main/EDMainMod.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/ED/main/EDCLMLinkMod.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/ED/main/EDRestVectorMod.F90 -! add code for new class instance, EDphenology_inst -M models/lnd/clm/src/ED/main/EDInitMod.F90 - -! for ED unit tests -M models/lnd/clm/src/CMakeLists.txt - -! update CNED failures -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - -ERS CNED tests are failing in this tag. It is expected. expectedClmTestFails.xml is updated to reflect this. - - build-namelist tests: N/A - - yellowstone - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel 40-OK, 45-OK - yellowstone_pgi 40-OK, 45-OK - goldbach_nag 40-OK, 45-OK - goldbach_intel 40-OK, 45-OK - -CLM tag used for the baseline comparisons: clm4_5_1_r087 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r087 -Originator(s): erik (Erik) -Date: Tue Sep 30 12:07:10 MDT 2014 -One-line Summary: Fix two balance check errors, and turn abort for balance check back on to appropriate levels - -Purpose of changes: - -Fix two balance check errors that were causing problems for simulations. Also some of the balance check aborts -were turned off in clm4_5_1_r082, so turn them back on again. Tighten water balance error from 1.e-4 to 1.e-5. -Tighten LW, surface-flux and solar radiation balance errors from 1.e-3 to 1.e-5 and add warning for 1.e-7. -Turn surface-flux balance and soil balance check errors abort back on. Soil balance tightened to 1.e-4 (from 1.e-3) -with warnings shown at 1.e-6. - -Also bring in an update to PTCLM, and allow tools tester to be submitted to geyser or caldera. Just as an aside -as something that was already done. - -Requirements for tag: Fix bugs: 2026 and 1941 - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 2026 Soil balance error - 1941 snowdp balance error - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, swensosc - -List any svn externals directories updated (csm_share, mct, etc.): Update PTCLMmkdata version - - Update PTCLM to PTCLM2_140816 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/test/tools/test_driver.sh ------ Allow to run in caldera and geyser as well - -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 ---- Add aborts back as well as warnings - and tighten some error conditions and warnings. -M models/lnd/clm/src/biogeophys/SoilTemperatureMod.F90 - Remove calculation and use of the - heat capacity of frozen h2osfc layer but use the heat capacity of the liquid layer - as balance check doesn't know about the frozen, and the discrepency causes balance - check errors. -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 --- snow includes dew. - -CLM testing: - - build-namelist tests: - - yellowstone YES - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel YES - yellowstone_pgi YES - yellowstone_gnu (optional) YES - goldbach_nag YES - goldbach_intel YES - -CLM tag used for the baseline comparisons: clm4_5_1_r086 - -Changes answers relative to baseline: YES! - - Summarize any changes to answers, i.e., - - what code configurations: CLM4.5 - - what platforms/compilers: ALL - - nature of change: same climate (some shorter simulations are still exact) - -Simulations that Keith ran to test the snowdp change are: - -/glade/p/work/oleson/urb2dev_n00_clm4_5_52/scripts/urb2dev_n03_clm4_5_64_V2DomLam_I20TRCRUCLM45 - -/glade/p/work/oleson/urb2dev_n00_clm4_5_52/scripts/urb2dev_n03_clm4_5_64_V2DomLam_IRCP85CRUCLM45 - - URL for LMWG diagnostics output used to validate new climate: - - For soil balance error... - -http://www.cgd.ucar.edu/staff/swensosc/public/diagnostics/ColdtestTRENDYspinupf091850CRU-ColdtestTRENDYspinupf091850CRU_control/setsIndex.html - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r086 -Originator(s): muszala (Stefan Muszala) -Date: Thu Sep 25 09:04:08 MDT 2014 -One-line Summary: critical ED modifications from r fisher, fix bug 2043 - -Purpose of changes: add modifications to ED, particularly for cold deciduous. add - fix for bug 2043. Consider these ED baselines as fixed (ie. - unless you are modifying ED science, these should now be BFB). - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 2043 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, r fisher - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/main/lnd2atmMod.F90 --- change intent of waterstate_vars to inout (fixes bug 2043) - -M models/lnd/clm/src/main/clm_driver.F90 --- add EDbio_vars to edmodel actual argument list - -M models/lnd/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 --- change leaves_off_switch and laimemory handling - -M models/lnd/clm/src/ED/biogeochem/EDPhysiologyMod.F90 --- rework cold deciduous and threshold code. add fragmentation_scaler routine - -M models/lnd/clm/src/ED/main/EDMainMod.F90 --- change argument lists to include EDbio_vars for ecosystem_dynamics and phenology - -M models/lnd/clm/src/ED/biogeophys/EDSurfaceAlbedoMod.F90 --- overhaul ED norman radiation code - -M models/lnd/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 --- tweak calculation of jmax25top and tpu25top - -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 --- clean up two comments - -CLM testing: - - ED compsets change values. - - For bug 2043. Confirmed that a gnu compile on yellowstone gets passed the intent problem. - - build-namelist tests: N/A - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - 40 OK - 45 OK - yellowstone_pgi - 40 OK - 45 OK - goldbach_nag - 40 OK - 45 OK - goldbach_intel - 40 OK - 45 OK - -CLM tag used for the baseline comparisons: clm4_5_1_r085 - -Changes answers relative to baseline: Only for ED compsets - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r085 -Originator(s): sacks (Bill Sacks) -Date: Fri Sep 19 10:22:30 MDT 2014 -One-line Summary: replace conditionals with polymorphism for soil water retention curve - -Purpose of changes: - -The main motivation for this tag was the need to introduce a -soil_suction_inverse routine, which will be used for irrigation. It is important -that soil_suction_inverse remains consistent with soil_suction for every soil -water retention curve method. In talking with Ben Andre and Erik, we felt the -best way to ensure this consistency was to have a separate, small module for -each soil retention curve method. We felt the best way to implement this was via -polymorphism. Polymorphism is arguably overkill in this simple case, but we -thought it would be good to convert it to polymorphism partly as an example that -we and others can follow in more complex cases where it will provide greater -benefit. - -To add a new soil retention curve method: - - (1) Create a module similar to - SoilWaterRetentionCurveClappHornberg1978Mod.F90 - - (2) Modify the select case statement in SoilWaterRetentionCurveFactoryMod.F90 - so that it is able to create an instance of your new type - -Note that this refactor also combines the soil_suction and soil_hk -parameterization options into a single option. Dave Lawrence and Rosie Fisher -felt that was preferable, and Jinyun Tang was okay with this. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: andre, muszala, Jinyun Tang - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: - -========= Replaced with the 3 new files noted below -D models/lnd/clm/src/biogeophys/SoiWatRetCurveParMod.F90 - -List all files added and what they do: - -========= Replacement for SoiWatRetCurveParMod, implemented using - polymorphism. Note that I have also added a soil_suction_inverse - routine, which is not yet used or tested. I'll be using (and testing) - this in an upcoming tag, where I refactor the irrigation code to use this. -A models/lnd/clm/src/biogeophys/SoilWaterRetentionCurveMod.F90 -A models/lnd/clm/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 -A models/lnd/clm/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Minor changes to accommodate the refactored code -M models/lnd/clm/src/main/clm_initializeMod.F90 -M models/lnd/clm/src/main/init_hydrology.F90 -M models/lnd/clm/src/main/clm_driver.F90 -M models/lnd/clm/src/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/biogeophys/SoilWaterMovementMod.F90 -M models/lnd/clm/src/biogeophys/SoilMoistStressMod.F90 -M models/lnd/clm/src/biogeophys/HydrologyNoDrainageMod.F90 - - -CLM testing: - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu: NOT RUN - goldbach_nag: ok - goldbach_intel: ok - -CLM tag used for the baseline comparisons: clm4_5_1_r084 - -Changes answers relative to baseline: NO - bfb - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r084 -Originator(s): sacks (Bill Sacks) -Date: Thu Sep 18 14:39:44 MDT 2014 -One-line Summary: make glc_dyn_runoff_routing spatially-varying, based on input from glc - -Purpose of changes: - -Dave Lawrence, Bill Lipscomb and Jeremy Fyke have pointed out that -glc_dyn_runoff_routing needs to be spatially-varying: Even when we're coupling -to CISM, we should continue to use the old scheme in regions that don't have an -active icesheet model underneath (which currently includes Antarctica and all of -the world's smaller glaciers - i.e., everything except Greenland). Furthermore, -we have introduced a new ability into CISM to run in diagnostic mode, without -sending calving/runoff fluxes to the coupler. In this case, too, CLM should -revert to using the old scheme (glc_dyn_runoff_routing = .false.). - -To accomplish both of these things, I have introduced a new coupling field, -through which GLC tells CLM which areas have an icesheet that is "active" in the -sense of sending fluxes to the coupler. In this CLM tag, CLM sets a -spatially-varying version of glc_dyn_runoff_routing based on this new coupler -field - replacing the old, namelist-settable version of this flag. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: - - - removed glc_dyn_runoff_routing - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - drv: drvseq5_0_15 -> drvseq5_0_17 - - fix for some multi-instance runs - - add icemask_coupled_fluxes field - - cism: cism1_140602 -> cism1_140914 - - Add zero_gcm_fluxes option; send icemask_coupled_fluxes field to coupler - - scripts: scripts4_140916b -> scripts4_140916c - - Rename CLM_UPDATE_GLC_AREAS to GLC_TWO_WAY_COUPLING - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Rename CLM_UPDATE_GLC_AREAS xml variable to GLC_TWO_WAY_COUPLING. - Remove glc_dyn_runoff_routing namelist variable (this is now a - spatially-varying field, tied more tightly to CISM). -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/CLMBuildNamelist.pm -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/user_nl_clm -M models/lnd/clm/bld/env_run.xml - -========= Receive icemask_coupled_fluxes from CISM -M models/lnd/clm/src/cpl/lnd_import_export.F90 -M models/lnd/clm/src/cpl/clm_cpl_indices.F90 - -========= Set spatially-varying glc_dyn_runoff_routing field based on - icemask_coupled_fluxes, and use this in place of the old scalar - glc_dyn_runoff_routing flag -M models/lnd/clm/src/main/glc2lndMod.F90 -M models/lnd/clm/src/main/clm_driver.F90 -M models/lnd/clm/src/main/clm_varctl.F90 -M models/lnd/clm/src/main/controlMod.F90 -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/biogeophys/HydrologyDrainageMod.F90 -M models/lnd/clm/src/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Add write statement to workaround a pgi compiler problem -M models/lnd/clm/src/main/restFileMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: ok (baseline comparisons fail for clm45 & clm50, as expected) - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - yellowstone_gnu: NOT RUN - goldbach_nag: ok - goldbach_intel: ok - - Note: Most testing was run on glc_runoff_routing_n06_clm4_5_1_r083. After - that tag, I added the following write statement in restFileMod, as a - workaround for a PGI compiler bug: - - write(iulog,*) 'about to call aerosol_vars%restart: ', ubound(waterstate_vars%h2osoi_ice_col) - - After that addition, I just reran a subset of tests: 6 yellowstone-intel - tests, 10 yellowstone-pgi tests (including the 2 that had failed due to the - compiler bug), and 5 goldbach-nag tests. - -NOTE: Unit test build is currently failing due to a change in r082. Stefan is -working on a fix. - -CLM tag used for the baseline comparisons: clm4_5_1_r083 - -Changes answers relative to baseline: YES - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 with CISM (i.e., IG) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - (1) Large changes in runoff from glaciers in IG compsets, due to setting - glc_dyn_runoff_routing to .false. outside of Greenland. - - (2) Roundoff-level changes in icemask for some resolutions and compilers, - due to changes in the cism external. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? For icemask changes: examined cprnc RMS errors. For other - changes, diffs are greater than roundoff. - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r083 -Originator(s): muszala (Stefan Muszala) -Date: Wed Sep 17 09:21:31 MDT 2014 -One-line Summary: only update scripts and run new baselines. this due to an error in yellowstone pgi test naming (clm_aux45 changed to aux_clm45) - -Purpose of changes: Update scripts due to an error in a previous scripts tag in which I named pgi tests as clm_aux45 instead -of aux_clm45. These were for tests moved from goldbach to yellowstone. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts4_140910 -> scripts4_140916b - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: N/A - -- update test list failures -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - WJS: note: Stef told me that he actually ran all the yellowstone tests, and - all were okay - - yellowstone_intel - 40 OK - yellowstone_pgi - - goldbach_nag - 40 OK, 45 OK - goldbach_intel - 40 OK, 45 OK - -Note 1: Due to the fact that in older baselines component_gen_comp was failing due to a scripts error (now fixed) -some older baselines don't have the clm history files. As one example: - - BFAIL ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput.compare_hist.clm4_5_1_r082 - - rerun. compare against clm4_5_1_r081, then it passes. - PASS ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput - PASS ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput.memleak - PASS ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput.compare_hist.clm4_5_1_r082_oldPgi - PASS ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput.memcomp.clm4_5_1_r082_oldPgi - PASS ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput.tputcomp.clm4_5_1_r082_oldPgi - PASS ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput.C.140917-082253.nlcomp - - For these tests, I made sure that clm2 history files were in the clm4_5_1_r083 baseline dirs. They - should pass going forward. - - ERI_D.f10_f10.ICRUCLM50BGC.goldbach_intel.clm-reduceOutput - PEM.f10_f10.ICLM45BGCCROP.goldbach_intel.clm-crop - SSP.f19_g16.I1850CLM45BGC.yellowstone_pgi.clm-default - -Note 2: For these N2 tests, there was a scripts problem with st_archiver in the previous tag. These should pass next time. - BFAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.compare_hist.clm4_5_1_r082 - BFAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.compare_hist.clm4_5_1_r082 - BFAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.clm2.h0.compare_hist.clm4_5_1_r082 - BFAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.clm2.h1.compare_hist.clm4_5_1_r082 - -CLM tag used for the baseline comparisons: clm4_5_1_r082 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r082 -Originator(s): muszala (Stefan Muszala) -Date: Thu Sep 11 14:07:58 MDT 2014 -One-line Summary: Merge in a number of ED changes to address science bugs and infrastructure (particularly restarts) - -Purpose of changes: Merge in ED changes. Most of these have to do with science changes from rfisher. There -is also a refactor and added functionality for ED restarts. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): Bug 2041, 2042 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, rfisher - -List any svn externals directories updated (csm_share, mct, etc.): - scripts4_140814a -> scripts4_140910 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml --- add failing N2 tests (due to scripts, see below). - -M models/lnd/clm/bld/build-namelist --- documentation at top of file should reference CLMBuildNamelist.pm - -M models/lnd/clm/src/main/clm_driver.F90 --- add call to SurfaceAlbedo for use_ed logical branch, add EDBioVars as --- argument to temperature_vars%UpdateAccVars and add canopystate_vars as --- argument to BalanceCheck (for ED) -M models/lnd/clm/src/main/decompMod.F90 --- added openMP output...remove mods after getting ED working with openMP - -M models/lnd/clm/src/ED/biogeochem/EDCanopyStructureMod.F90 --- change handling of CWD_AG and CWD_BG -M models/lnd/clm/src/ED/biogeochem/EDGrowthFunctionsMod.F90 --- added tree_sai function -M models/lnd/clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 --- signifcant reworking of entire module -M models/lnd/clm/src/ED/biogeochem/EDPhysiologyMod.F90 --- minor code clean up -M models/lnd/clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 --- change an error check to: if (( areatot - area ) > 0._r8 ) then - -M models/lnd/clm/src/ED/main/EDBioType.F90 --- add infrastrucutre (define, allocate, etc...) -M models/lnd/clm/src/ED/main/EDMainMod.F90 --- major update for updating canopy biomass pools -M models/lnd/clm/src/ED/main/EDCLMLinkMod.F90 --- modify calls for history file output and error checking -M models/lnd/clm/src/ED/main/EDRestVectorMod.F90 --- add resp_clm as restart variable and use SHR_ASSERT instead of call assert. major refactor --- of createPatchCohortStructure to handle arbitrary number of cohorts and patches -M models/lnd/clm/src/ED/main/EDInitMod.F90 --- add logical to deal with different values of assignemnt dc%laimemory -M models/lnd/clm/src/ED/main/EDTypesMod.F90 --- add cohort_type and change paramters: numCohortsPerPatch, cohorts_per_gcell and fire_threshold - -M models/lnd/clm/src/ED/fire/SFMainMod.F90 --- clean up write statemnts and a bug fix: change tau_b(dg_sf) -> tau_b(c) - -M models/lnd/clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 --- change tpu25top(FT) = 0.06_r8 * jmax25top(FT) to tpu25top(FT) = 0.167_r8 * jmax25top(FT), some cleanup - -M models/lnd/clm/src/biogeophys/SnowHydrologyMod.F90 --- clean up a use statement -M models/lnd/clm/src/biogeophys/BareGroundFluxesMod.F90 --- remove whitespaces after a statement -M models/lnd/clm/src/biogeophys/SurfaceAlbedoMod.F90 --- add a use_ed block to prevent some unassigned pointer errors -M models/lnd/clm/src/biogeophys/BalanceCheckMod.F90 --- add canopystate_vars as argument for elai and esai for more verbose error --- reporting added by rfisher -M models/lnd/clm/src/biogeophys/TemperatureType.F90 --- add arg. for UpdateAccVars for new calculations, split out use_ed and use_crop -M models/lnd/clm/src/biogeophys/SurfaceRadiationMod.F90 --- add associate statement to tlai for error reporting - -M UpDateChangeLog.pl --- fix tiny typo - -M SVN_EXTERNAL_DIRECTORIES --- for scripts update - -CLM testing: - - build-namelist tests: - - yellowstone - N/A, no namelist changes made in this tag - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - 45 OK , 40 OK - - Changes due to update of scripts from scripts4_140814a -> scripts4_140910 (this change came with scripts4_140828) - FAIL namelist compare: user_nl_clm differs - These should pass next time. - - NEW: flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata.pftdyn_1x1_tropicAtl_TEST_simyr1939-1943_c140108.nc' - BASELINE: flanduse_timeseries = '/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/surfdata.pftdyn_1x1_tropicAtl_TEST_simyr1939-1943_c140108.nc' - - FAIL SMS_Ly3.1x1_tropicAtl.I20TRCLM45BGC.yellowstone_intel.clm-tropicAtl_subsetLate.GC.newPgi_45_intel.nlcomp - FAIL SMS_Ly5.1x1_tropicAtl.I20TRCLM45BGC.yellowstone_intel.clm-tropicAtl_subsetMid.GC.newPgi_45_intel.nlcomp - FAIL SMS_Ly8.1x1_tropicAtl.I20TRCLM45BGC.yellowstone_intel.clm-tropicAtl_subsetEarly.GC.newPgi_45_intel.nlcomp - - These fail due to a bug in scripts4_140905c. Alice is aware of this and will provide a fix for a future CLM tag (but 2041): - FAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel - FAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default - - Failure that looks like a hardware problem and that Erik is looking into (bug 2042): - RUN ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.GC.newPgi_45_intel - - yellowstone_pgi - 45 OK , 40 OK - - New PGI tests brought over from goldbach. These are expected as there are no baselines for this on yellowstone - - BFAIL ERI_D.f10_f10.ICLM45BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI_D.f10_f10.ICRUCLM50BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI_D.f19_g16.ICLM45BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI_D.f19_g16.ICLM45.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI_D.f19_g16.ICRUCLM50BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI.f10_f10.ICLM45BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI.f10_f10.ICRUCLM50BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI.f19_g16.ICLM45BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERI.f19_g16.ICRUCLM50BGC.yellowstone_pgi.clm-reduceOutput.compare_hist.clm4_5_1_r081 - BFAIL ERS_D.f10_f10.I20TRCLM45BGC.yellowstone_pgi.clm-decStart.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL ERS_D.f10_f10.I20TRCLM45BGC.yellowstone_pgi.clm-decStart.clm2.h1.compare_hist.clm4_5_1_r081 - BFAIL ERS_D.f10_f10.I20TRCLM45BGC.yellowstone_pgi.clm-decStart.compare_hist.clm4_5_1_r081 - BFAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_pgi.clm-ciso.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_pgi.clm-ciso.clm2.h1.compare_hist.clm4_5_1_r081 - BFAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_pgi.clm-ciso.compare_hist.clm4_5_1_r081 - BFAIL ERS.f10_f10.I1850CLM45BGC.yellowstone_pgi.clm-default.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL ERS.f10_f10.I1850CLM45BGC.yellowstone_pgi.clm-default.clm2.h1.compare_hist.clm4_5_1_r081 - BFAIL ERS.f10_f10.I1850CLM45BGC.yellowstone_pgi.clm-default.compare_hist.clm4_5_1_r081 - BFAIL ERS_Lm3.1x1_smallvilleIA.ICLM45BGCCROP.yellowstone_pgi.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL ERS_Lm3.1x1_smallvilleIA.ICLM45BGCCROP.yellowstone_pgi.compare_hist.clm4_5_1_r081 - BFAIL SMS_D.1x1_vancouverCAN.ICLM45.yellowstone_pgi.clm-default.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL SMS_D.1x1_vancouverCAN.ICLM45.yellowstone_pgi.clm-default.clm2.h1.compare_hist.clm4_5_1_r081 - BFAIL SMS_D.1x1_vancouverCAN.ICLM45.yellowstone_pgi.clm-default.compare_hist.clm4_5_1_r081 - BFAIL SMS.f45_f45.ICLM45.yellowstone_pgi.clm-ptsRLB.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL SMS.f45_f45.ICLM45.yellowstone_pgi.clm-ptsRLB.clm2.h1.compare_hist.clm4_5_1_r081 - BFAIL SMS.f45_f45.ICLM45.yellowstone_pgi.clm-ptsRLB.compare_hist.clm4_5_1_r081 - BFAIL SMS.f45_f45.ICLM45.yellowstone_pgi.clm-ptsROA.compare_hist.clm4_5_1_r081 - BFAIL SMS_Ld5.f19_g16.IRCP45CLM45BGC.yellowstone_pgi.clm-decStart.clm2.h0.compare_hist.clm4_5_1_r081 - BFAIL SMS_Ld5.f19_g16.IRCP45CLM45BGC.yellowstone_pgi.clm-decStart.clm2.h1.compare_hist.clm4_5_1_r081 - BFAIL SMS_Ld5.f19_g16.IRCP45CLM45BGC.yellowstone_pgi.clm-decStart.compare_hist.clm4_5_1_r081 - - goldbach_nag - 45 OK , 40 OK - - Baseline missing from previous tag: - ERI_D.f19_g16.ICLM45BGC.goldbach_nag.clm-reduceOutput- - file /fs/cgd/csm/ccsm_baselines/clm4_5_1_r081/ERI_D.f19_g16.ICLM45BGC.goldbach_nag.clm-reduceOutput/cpl.hi.nc does not exis - SMS.f09_g16.ICRUCLM45.goldbach_nag.clm-af_bias_v5 - file /fs/cgd/csm/ccsm_baselines/clm4_5_1_r081/SMS.f09_g16.ICRUCLM45.goldbach_nag.clm-af_bias_v5/cpl.hi.nc does not exist - SMS_Ly1.f19_g16.ICLM45BGCCROP.goldbach_nag.clm-reduceOutput - file /fs/cgd/csm/ccsm_baselines/clm4_5_1_r081/SMS_Ly1.f19_g16.ICLM45BGCCROP.goldbach_nag.clm-reduceOutput/cpl.hi.nc does no - SMS_Ly1.f19_g16.ICLM45BGCCROP.goldbach_nag.clm-reduceOutput - file /fs/cgd/csm/ccsm_baselines/clm4_5_1_r081/SMS_Ly1.f19_g16.ICLM45BGCCROP.goldbach_nag.clm-reduceOutput/cpl.hi.nc does no t exist - - goldbach_intel - 45 OK , 40 OK - - goldbach_pgi (These have been moved to yellowstone due to PGI 14.1 throwing and ICE on goldbach) - -CLM tag used for the baseline comparisons: clm4_5_1_r081 - -Changes answers relative to baseline: Only for ED compsets - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r081 -Originator(s): mvertens (Mariana Vertenstein) -Date: Sun Aug 24 19:39:50 MDT 2014 -One-line Summary: major infrastructure changes and directory reorganization under src - -Purpose of changes: - - Overview of previous code design - ========================================== - - data structures arranged by subgrid type (pps, cps, lps, grc) - - all functional categorization lumped in that one subgrid type which led to - - centralization rather than modularization of all data - - definition and instantiation in ONE big module (clmtype.F90) - - allocation and initialization in ONE big module (clmtypeInitMod.F90) - - history variables all in ONE big module (histFldsMod.F90) - - restart variables in effectively TWO big modules (biogeophysicsRestMod.F90 and CNRestMod.F90) - - time constant initialization in ONE complex module (initTimeConst.F90) - - time varying cold start initialization in ONE module (initColdMod.F90) - - accumulation variables in ONE module (accumulMod.F90) - - Overview of new code design - ========================================== - data structures arranged by scientific functional categories - (e.g. temperature_type, waterstate_type, energyflux_type, etc) - - a given data structure now contains ALL subgrid levels are in the data structure - - and variables in the data structure are now appended with a unique suffix to - indicate their subgrid levels (new suffixes: _patch, _col, _lun, _grc) - - this does NOT effect the science code base, ONLY the associate statements - - there are separate module for each data type definition - (e.g. TemperatureType.F90, WaterstateType.F90, EnergyFluxType.F90, etc) - - each data type has associated methods for - - Allocation: - variables now initialized as NaNs upon allocation - - Cold Start Initialization: - cold start initialization of variables is now ALWAYS done - and overwritten if finidat is read in as spun up dataset (also now - have on line interpolation of initial conditions as part of this refactor as well) - - History initialization of variables - All history fields now initialized as spval - - Restart initialization of variables - - Accumulation Initialization - initialization and accumulation update of variables - - Instantiation of datatypes is now separate from their declaration - (for now in clm_initialize.F90 - will be moved in the future) - - Centralized routines that no longer exist: - ========================================== - Data types : clmtype.F90, clmtypeInitMod.F90 - Initialization : initTimeConst.F90, initCold.F90 - History : histFldsMod.F90 - Accumulation : accumulMod.F90 - Restart : biogeophysRestMod.F90, CNRestMod.F90 - Biogeochemistry: CNSetValue.F90 - - New Type modules that now replace clmtype.F90 - ========================================== - main/atm2lndType.F90 - main/lnd2atmType.F90 - main/ColumnType.F90 - main/EcophysConType.F90 - main/GridcellType.F90 - main/LandunitType.F90 - main/PatchType.F90 - - biogeochem/CNCarbonFluxType.F90 - biogeochem/CNCarbonStateType.F90 - biogeochem/CNDecompCascadeConType.F90 - biogeochem/CNDVType.F90 - biogeochem/CNNitrogenFluxType.F90 - biogeochem/CNNitrogenStateType.F90 - biogeochem/CNStateType.F90 - biogeochem/CropType.F90 - - biogeophys/AerosolType.F90 - biogeophys/CanopyStateType.F90 - biogeophys/EnergyFluxType.F90 - biogeophys/FrictionVelocityType.F90 - biogeophys/LakeStateType.F90 - biogeophys/PhotosynthesisType.F90 - biogeophys/SoilHydrologyType.F90 - biogeophys/SoilStateType.F90 - biogeophys/SolarAbsorbedType.F90 - biogeophys/SurfaceAlbedoType.F90 - biogeophys/TemperatureType.F90 - biogeophys/UrbanParamsType.F90 - biogeophys/WaterfluxType.F90 - biogeophys/WaterStateType.F90 - - ED/main/EDBioType.F90 - ED/main/EDEcophysConType.F90 - ED/main/EDVecCohortType.F90 - ED/main/EDVecPatchType.F90 - - - Instantiation of Types - -2) Public Types: - - - the following are public types that can BE PASSED AS ARGUMENTS - - the type instances FOR NOW are clm_initialized and then used by the driver - - this will be generalized in the future - - type(ch4_type) :: ch4_vars - type(carbonstate_type) :: carbonstate_vars - type(carbonstate_type) :: c13_carbonstate_vars - type(carbonstate_type) :: c14_carbonstate_vars - type(carbonflux_type) :: carbonflux_vars - type(carbonflux_type) :: c13_carbonflux_vars - type(carbonflux_type) :: c14_carbonflux_vars - type(nitrogenstate_type) :: nitrogenstate_vars - type(nitrogenflux_type) :: nitrogenflux_vars - type(dgvs_type) :: dgvs_vars - type(crop_type) :: crop_vars - type(cnstate_type) :: cnstate_vars - type(dust_type) :: dust_vars - type(vocemis_type) :: vocemis_vars - type(drydepvel_type) :: drydepvel_vars - type(aerosol_type) :: aerosol_vars - type(canopystate_type) :: canopystate_vars - type(energyflux_type) :: energyflux_vars - type(frictionvel_type) :: frictionvel_vars - type(lakestate_type) :: lakestate_vars - type(photosyns_type) :: photosyns_vars - type(soilstate_type) :: soilstate_vars - type(soilhydrology_type) :: soilhydrology_vars - type(solarabs_type) :: solarabs_vars - type(surfalb_type) :: surfalb_vars - type(surfrad_type) :: surfrad_vars - type(temperature_type) :: temperature_vars - type(urbanparams_type) :: urbanparams_vars - type(waterflux_type) :: waterflux_vars - type(waterstate_type) :: waterstate_vars - type(atm2lnd_type) :: atm2lnd_vars - type(glc2lnd_type) :: glc2lnd_vars - type(lnd2atm_type) :: lnd2atm_vars - type(lnd2glc_type) :: lnd2glc_vars - type(glc_diagnostics_type) :: glc_diagnostics_vars - type(EDbio_type) :: EDbio_vars - - - private Types (now som modules have their own PRIVATE types) - - DUSTMod.F90 : type(dust_type) - VOCEmissionMod.F90: type(vocemis_type) - ch4Mod.F90 : type(ch4_type) - - API Changes: - ========================================== - Original APIs: - clmtype was in effect a global common block and all routines had use statements into it - difficult to track any intent or flow through system - difficult to set up functional unit testing (.e.g. CanopyFluxesMod.F90, etc) - - Refactorized APIs: - all new datatype instances are passed as arguments - science code is effectively the same since only the associate statements have been modified - - New Directory Structure under clm/ - ========================================== - bld/ - doc/ - src/biogeochem/ - src/biogeophys/ - src/cpl/ - src/dyn_subgrid/ - src/ED/ - src/ED/biogeochem - src/ED/biogeophys - src/ED/fire - src/ED/main - src/main/ - src/unit_test_mocks/ - src/unit_test_shr/ - src/utils/ - src_clm4_0/ - test/ - tools/ - - Advantages of refactorization: - ========================================== - - Lets compiler enforce intent attributes - - Makes functional unit testing easier since module drivers can be - constructed with relevant mock data more easily - - Makes more sense scientifically since now easier to extend code logic as - to where you want to introduce new variables - - Easier to maintain code since code flow is easier to follow and to modify - - Easy to move variables around from one data type to another since now - know everything that is logically connected to that variable that - needs to be moved Offers new modularity for trading in and out new - formulations of targeted functionality - -Requirements for tag: N.A. - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N.A. - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - directory restructuring has been reflected in changes to configure in setting up the Filepath - -Describe any changes made to the namelist: - clm_hydrology1_inparm changed to clm_canopyhydrology_inparm - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: myself, Bill Sacks - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: - -D clm/src/clm4_5 -D clm/src/clm4_5/biogeochem -D clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 -D clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -D clm/src/clm4_5/biogeochem/CNRestMod.F90 -D clm/src/clm4_5/biogeochem/CropRestMod.F90 -D clm/src/clm4_5/biogeochem/CNGRespMod.F90 -D clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -D clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -D clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -D clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 -D clm/src/clm4_5/biogeochem/CNFireMod.F90 -D clm/src/clm4_5/biogeochem/CNMRespMod.F90 -D clm/src/clm4_5/biogeochem/MEGANFactorsMod.F90 -D clm/src/clm4_5/biogeochem/SatellitePhenologyMod.F90 -D clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -D clm/src/clm4_5/biogeochem/ch4RestMod.F90 -D clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -D clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -D clm/src/clm4_5/biogeochem/CNWoodProductsMod.F90 -D clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -D clm/src/clm4_5/biogeochem/ch4Mod.F90 -D clm/src/clm4_5/biogeochem/DUSTMod.F90 -D clm/src/clm4_5/biogeochem/CNDVLightMod.F90 -D clm/src/clm4_5/biogeochem/CNInitMod.F90 -D clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -D clm/src/clm4_5/biogeochem/ch4varcon.F90 -D clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -D clm/src/clm4_5/biogeochem/CNDecompMod.F90 -D clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -D clm/src/clm4_5/biogeochem/CNDVMod.F90 -D clm/src/clm4_5/biogeochem/ED -D clm/src/clm4_5/biogeochem/ED/EDCanopyStructureMod.F90 -D clm/src/clm4_5/biogeochem/ED/EDSetValuesMod.F90 -D clm/src/clm4_5/biogeochem/ED/EDGrowthFunctionsMod.F90 -D clm/src/clm4_5/biogeochem/ED/EDPhysiologyMod.F90 -D clm/src/clm4_5/biogeochem/ED/EDCohortDynamicsMod.F90 -D clm/src/clm4_5/biogeochem/ED/EDPatchDynamicsMod.F90 -D clm/src/clm4_5/biogeochem/CNSharedParamsMod.F90 -D clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -D clm/src/clm4_5/biogeochem/ch4InitMod.F90 -D clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -D clm/src/clm4_5/biogeochem/CNNStateUpdate2Mod.F90 -D clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -D clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -D clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -D clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -D clm/src/clm4_5/biogeochem/CNDecompCascadeBGCMod.F90 -D clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -D clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 -D clm/src/clm4_5/biogeochem/CNDecompCascadeCNMod.F90 -D clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -D clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -D clm/src/clm4_5/biogeochem/CNDVInitMod.F90 -D clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 - -D clm/src/clm4_5/main -D clm/src/clm4_5/main/clm_varcon.F90 -D clm/src/clm4_5/main/initInterp.F90 -D clm/src/clm4_5/main/clm_varpar.F90 -D clm/src/clm4_5/main/landunit_varcon.F90 -D clm/src/clm4_5/main/initTimeConstMod.F90 -D clm/src/clm4_5/main/subgridWeightsMod.F90 -D clm/src/clm4_5/main/decompInitMod.F90 -D clm/src/clm4_5/main/clm_initializeMod.F90 -D clm/src/clm4_5/main/subgridRestMod.F90 -D clm/src/clm4_5/main/clm_glclnd.F90 -D clm/src/clm4_5/main/paramUtilMod.F90 -D clm/src/clm4_5/main/accFldsMod.F90 -D clm/src/clm4_5/main/subgridMod.F90 -D clm/src/clm4_5/main/clmtypeInitMod.F90 -D clm/src/clm4_5/main/ndepStreamMod.F90 -D clm/src/clm4_5/main/init_hydrology.F90 -D clm/src/clm4_5/main/initColdMod.F90 -D clm/src/clm4_5/main/column_varcon.F90 -D clm/src/clm4_5/main/histFileMod.F90 -D clm/src/clm4_5/main/pft2colMod.F90 -D clm/src/clm4_5/main/clm_atmlnd.F90 -D clm/src/clm4_5/main/findHistFields.pl -D clm/src/clm4_5/main/clm_varsur.F90 -D clm/src/clm4_5/main/restFileMod.F90 -D clm/src/clm4_5/main/CMakeLists.txt -D clm/src/clm4_5/main/controlMod.F90 -D clm/src/clm4_5/main/spitfireSF -D clm/src/clm4_5/main/spitfireSF/SFParamsMod.F90 -D clm/src/clm4_5/main/spitfireSF/SFMainMod.F90 -D clm/src/clm4_5/main/test -D clm/src/clm4_5/main/test/subgridWeights_test -D clm/src/clm4_5/main/test/subgridWeights_test/test_subgridWeights.pf -D clm/src/clm4_5/main/test/subgridWeights_test/CMakeLists.txt -D clm/src/clm4_5/main/test/clm_glclnd_test -D clm/src/clm4_5/main/test/clm_glclnd_test/test_clm_glclnd.pf -D clm/src/clm4_5/main/test/clm_glclnd_test/CMakeLists.txt -D clm/src/clm4_5/main/test/CMakeLists.txt -D clm/src/clm4_5/main/initSubgridMod.F90 -D clm/src/clm4_5/main/filterMod.F90 -D clm/src/clm4_5/main/clm_varctl.F90 -D clm/src/clm4_5/main/clm_driver.F90 -D clm/src/clm4_5/main/surfrdUtilsMod.F90 -D clm/src/clm4_5/main/ED -D clm/src/clm4_5/main/ED/EDInitTimeConst.F90 -D clm/src/clm4_5/main/ED/EDCLMLinkMod.F90 -D clm/src/clm4_5/main/ED/EDClmType.F90 -D clm/src/clm4_5/main/ED/EDRestVectorMod.F90 -D clm/src/clm4_5/main/ED/EDHistFldsMod.F90 -D clm/src/clm4_5/main/ED/EDClmTypeInitMod.F90 -D clm/src/clm4_5/main/ED/EDPftvarcon.F90 -D clm/src/clm4_5/main/ED/EDParamsMod.F90 -D clm/src/clm4_5/main/ED/EDInitMod.F90 -D clm/src/clm4_5/main/ED/EDTypesMod.F90 -D clm/src/clm4_5/main/ED/EDMainMod.F90 -D clm/src/clm4_5/main/subgridAveMod.F90 -D clm/src/clm4_5/main/initGridCellsMod.F90 -D clm/src/clm4_5/main/initSoilParVICMod.F90 -D clm/src/clm4_5/main/pftvarcon.F90 -D clm/src/clm4_5/main/surfrdMod.F90 -D clm/src/clm4_5/main/decompMod.F90 -D clm/src/clm4_5/main/FuncPedotransferMod.F90 -D clm/src/clm4_5/main/clmtype.F90 -D clm/src/clm4_5/main/reweightMod.F90 -D clm/src/clm4_5/main/readParamsMod.F90 -D clm/src/clm4_5/main/histFldsMod.F90 - -D clm/src/clm4_5/biogeophys -D clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -D clm/src/clm4_5/biogeophys/SLakeInitMod.F90 -D clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -D clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -D clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -D clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -D clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -D clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -D clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -D clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -D clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -D clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -D clm/src/clm4_5/biogeophys/UrbanMod.F90 -D clm/src/clm4_5/biogeophys/QSatMod.F90 -D clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 -D clm/src/clm4_5/biogeophys/SurfaceResistanceMod.F90 -D clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -D clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 -D clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -D clm/src/clm4_5/biogeophys/SNICARMod.F90 -D clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -D clm/src/clm4_5/biogeophys/CMakeLists.txt -D clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -D clm/src/clm4_5/biogeophys/RootBiophysMod.F90 -D clm/src/clm4_5/biogeophys/test -D clm/src/clm4_5/biogeophys/test/CMakeLists.txt -D clm/src/clm4_5/biogeophys/test/Daylength_test -D clm/src/clm4_5/biogeophys/test/Daylength_test/test_daylength.pf -D clm/src/clm4_5/biogeophys/test/Daylength_test/CMakeLists.txt -D clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -D clm/src/clm4_5/biogeophys/SoilWaterMovementMod.F90 -D clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -D clm/src/clm4_5/biogeophys/SoilMoistStressMod.F90 -D clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -D clm/src/clm4_5/biogeophys/SoiWatRetCurveParMod.F90 -D clm/src/clm4_5/biogeophys/ED -D clm/src/clm4_5/biogeophys/ED/EDAccumulateFluxesMod.F90 -D clm/src/clm4_5/biogeophys/ED/EDSurfaceAlbedoMod.F90 -D clm/src/clm4_5/biogeophys/ED/EDPhotosynthesisMod.F90 -D clm/src/clm4_5/biogeophys/ED/EDBtranMod.F90 -D clm/src/clm4_5/biogeophys/FracWetMod.F90 -D clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -D clm/src/clm4_5/biogeophys/SLakeRestMod.F90 -D clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -D clm/src/clm4_5/biogeophys/SLakeCon.F90 -D clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -D clm/src/clm4_5/biogeophys/BandDiagonalMod.F90 -D clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -D clm/src/clm4_5/biogeophys/DaylengthMod.F90 - -D clm/src/clm4_5/dyn_subgrid -D clm/src/clm4_5/dyn_subgrid/test -D clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test -D clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf -D clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf -D clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt -D clm/src/clm4_5/dyn_subgrid/test/dynVar_test -D clm/src/clm4_5/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 -D clm/src/clm4_5/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf -D clm/src/clm4_5/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf -D clm/src/clm4_5/dyn_subgrid/test/dynVar_test/CMakeLists.txt -D clm/src/clm4_5/dyn_subgrid/test/dynTimeInfo_test -D clm/src/clm4_5/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf -D clm/src/clm4_5/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt -D clm/src/clm4_5/dyn_subgrid/test/CMakeLists.txt -D clm/src/clm4_5/dyn_subgrid/test/dynInitColumns_test -D clm/src/clm4_5/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf -D clm/src/clm4_5/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt -D clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynTimeInfoMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynFileMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynConsBiogeochemMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynPriorWeightsMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynVarMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynEDMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynCNDVMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynConsBiogeophysMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90 -D clm/src/clm4_5/dyn_subgrid/dynVarMod.F90.in -D clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90.in -D clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90.in -D clm/src/clm4_5/dyn_subgrid/do_genf90 -D clm/src/clm4_5/dyn_subgrid/dynInitColumnsMod.F90 -D clm/src/clm4_5/dyn_subgrid/CMakeLists.txt - -D clm/src/util_share -D clm/src/util_share/organicFileMod.F90 -D clm/src/util_share/spmdGathScatMod.F90 -D clm/src/util_share/clm_time_manager.F90 -D clm/src/util_share/clm_nlUtilsMod.F90 -D clm/src/util_share/clm_varorb.F90 -D clm/src/util_share/abortutils.F90 -D clm/src/util_share/accumulMod.F90 -D clm/src/util_share/getdatetime.F90 -D clm/src/util_share/fileutils.F90 -D clm/src/util_share/dtypes.h -D clm/src/util_share/ncdio_pio.F90 -D clm/src/util_share/SimpleMathMod.F90 -D clm/src/util_share/spmdMod.F90 -D clm/src/util_share/domainMod.F90 -D clm/src/util_share/ncdio_pio.F90.in -D clm/src/util_share/restUtilMod.F90 -D clm/src/util_share/quadraticMod.F90 -D clm/src/util_share/restUtilMod.F90.in -D clm/src/util_share/CMakeLists.txt -D clm/src/util_share/GetGlobalValuesMod.F90 - -D clm/src/clm4_0 -D clm/src/clm4_0/biogeochem -D clm/src/clm4_0/biogeochem/CNCStateUpdate2Mod.F90 -D clm/src/clm4_0/biogeochem/CNC13StateUpdate2Mod.F90 -D clm/src/clm4_0/biogeochem/CNGapMortalityMod.F90 -D clm/src/clm4_0/biogeochem/CropRestMod.F90 -D clm/src/clm4_0/biogeochem/CNGRespMod.F90 -D clm/src/clm4_0/biogeochem/CNNStateUpdate1Mod.F90 -D clm/src/clm4_0/biogeochem/CNBalanceCheckMod.F90 -D clm/src/clm4_0/biogeochem/CNNStateUpdate3Mod.F90 -D clm/src/clm4_0/biogeochem/CNFireMod.F90 -D clm/src/clm4_0/biogeochem/CNMRespMod.F90 -D clm/src/clm4_0/biogeochem/MEGANFactorsMod.F90 -D clm/src/clm4_0/biogeochem/CNPrecisionControlMod.F90 -D clm/src/clm4_0/biogeochem/CNWoodProductsMod.F90 -D clm/src/clm4_0/biogeochem/CNSummaryMod.F90 -D clm/src/clm4_0/biogeochem/DUSTMod.F90 -D clm/src/clm4_0/biogeochem/CNDVLightMod.F90 -D clm/src/clm4_0/biogeochem/CNPhenologyMod.F90 -D clm/src/clm4_0/biogeochem/CNCStateUpdate1Mod.F90 -D clm/src/clm4_0/biogeochem/CNDecompMod.F90 -D clm/src/clm4_0/biogeochem/STATICEcosysDynMod.F90 -D clm/src/clm4_0/biogeochem/CNCStateUpdate3Mod.F90 -D clm/src/clm4_0/biogeochem/CNDVMod.F90 -D clm/src/clm4_0/biogeochem/CNC13StateUpdate1Mod.F90 -D clm/src/clm4_0/biogeochem/CNrestMod.F90 -D clm/src/clm4_0/biogeochem/CNC13StateUpdate3Mod.F90 -D clm/src/clm4_0/biogeochem/VOCEmissionMod.F90 -D clm/src/clm4_0/biogeochem/CNDVEcosystemDynIniMod.F90 -D clm/src/clm4_0/biogeochem/CNAnnualUpdateMod.F90 -D clm/src/clm4_0/biogeochem/CNNStateUpdate2Mod.F90 -D clm/src/clm4_0/biogeochem/C13SummaryMod.F90 -D clm/src/clm4_0/biogeochem/DryDepVelocity.F90 -D clm/src/clm4_0/biogeochem/CNC13FluxMod.F90 -D clm/src/clm4_0/biogeochem/CNAllocationMod.F90 -D clm/src/clm4_0/biogeochem/CNNDynamicsMod.F90 -D clm/src/clm4_0/biogeochem/CNEcosystemDynMod.F90 -D clm/src/clm4_0/biogeochem/CNSetValueMod.F90 -D clm/src/clm4_0/biogeochem/CNVegStructUpdateMod.F90 -D clm/src/clm4_0/biogeochem/CNDVEstablishmentMod.F90 - -D clm/src/clm4_0/main -D clm/src/clm4_0/main/clm_varcon.F90 -D clm/src/clm4_0/main/clm_varpar.F90 -D clm/src/clm4_0/main/CNiniTimeVar.F90 -D clm/src/clm4_0/main/dynlandMod.F90 -D clm/src/clm4_0/main/decompInitMod.F90 -D clm/src/clm4_0/main/clm_initializeMod.F90 -D clm/src/clm4_0/main/subgridRestMod.F90 -D clm/src/clm4_0/main/clm_glclnd.F90 -D clm/src/clm4_0/main/accFldsMod.F90 -D clm/src/clm4_0/main/subgridMod.F90 -D clm/src/clm4_0/main/clmtypeInitMod.F90 -D clm/src/clm4_0/main/ndepStreamMod.F90 -D clm/src/clm4_0/main/pftdynMod.F90 -D clm/src/clm4_0/main/iniTimeConst.F90 -D clm/src/clm4_0/main/histFileMod.F90 -D clm/src/clm4_0/main/pft2colMod.F90 -D clm/src/clm4_0/main/clm_atmlnd.F90 -D clm/src/clm4_0/main/findHistFields.pl -D clm/src/clm4_0/main/restFileMod.F90 -D clm/src/clm4_0/main/clm_varsur.F90 -D clm/src/clm4_0/main/controlMod.F90 -D clm/src/clm4_0/main/initSurfAlbMod.F90 -D clm/src/clm4_0/main/filterMod.F90 -D clm/src/clm4_0/main/clm_driver.F90 -D clm/src/clm4_0/main/clm_varctl.F90 -D clm/src/clm4_0/main/subgridAveMod.F90 -D clm/src/clm4_0/main/initGridCellsMod.F90 -D clm/src/clm4_0/main/CNiniSpecial.F90 -D clm/src/clm4_0/main/pftvarcon.F90 -D clm/src/clm4_0/main/surfrdMod.F90 -D clm/src/clm4_0/main/decompMod.F90 -D clm/src/clm4_0/main/clmtype.F90 -D clm/src/clm4_0/main/histFldsMod.F90 -D clm/src/clm4_0/main/mkarbinitMod.F90 -D clm/src/clm4_0/biogeophys -D clm/src/clm4_0/biogeophys/BalanceCheckMod.F90 -D clm/src/clm4_0/biogeophys/SurfaceRadiationMod.F90 -D clm/src/clm4_0/biogeophys/SoilTemperatureMod.F90 -D clm/src/clm4_0/biogeophys/SnowHydrologyMod.F90 -D clm/src/clm4_0/biogeophys/UrbanInputMod.F90 -D clm/src/clm4_0/biogeophys/Biogeophysics1Mod.F90 -D clm/src/clm4_0/biogeophys/Biogeophysics2Mod.F90 -D clm/src/clm4_0/biogeophys/FracWetMod.F90 -D clm/src/clm4_0/biogeophys/UrbanInitMod.F90 -D clm/src/clm4_0/biogeophys/FrictionVelocityMod.F90 -D clm/src/clm4_0/biogeophys/TridiagonalMod.F90 -D clm/src/clm4_0/biogeophys/SurfaceAlbedoMod.F90 -D clm/src/clm4_0/biogeophys/Hydrology1Mod.F90 -D clm/src/clm4_0/biogeophys/Hydrology2Mod.F90 -D clm/src/clm4_0/biogeophys/BiogeophysicsLakeMod.F90 -D clm/src/clm4_0/biogeophys/BiogeophysRestMod.F90 -D clm/src/clm4_0/biogeophys/UrbanMod.F90 -D clm/src/clm4_0/biogeophys/SoilHydrologyMod.F90 -D clm/src/clm4_0/biogeophys/QSatMod.F90 -D clm/src/clm4_0/biogeophys/clm_driverInitMod.F90 -D clm/src/clm4_0/biogeophys/HydrologyLakeMod.F90 -D clm/src/clm4_0/biogeophys/BareGroundFluxesMod.F90 -D clm/src/clm4_0/biogeophys/SNICARMod.F90 -D clm/src/clm4_0/biogeophys/CanopyFluxesMod.F90 - -List all files added and what they do: - -A clm/src_clm40 -A clm/src_clm40/biogeochem -A clm/src_clm40/biogeochem/CNCStateUpdate2Mod.F90 -A clm/src_clm40/biogeochem/CNC13StateUpdate2Mod.F90 -A clm/src_clm40/biogeochem/CNGRespMod.F90 -A clm/src_clm40/biogeochem/CNBalanceCheckMod.F90 -A clm/src_clm40/biogeochem/CNNStateUpdate3Mod.F90 -A clm/src_clm40/biogeochem/CNSummaryMod.F90 -A clm/src_clm40/biogeochem/CNPhenologyMod.F90 -A clm/src_clm40/biogeochem/STATICEcosysDynMod.F90 -A clm/src_clm40/biogeochem/CNCStateUpdate1Mod.F90 -A clm/src_clm40/biogeochem/CNC13StateUpdate1Mod.F90 -A clm/src_clm40/biogeochem/CNrestMod.F90 -A clm/src_clm40/biogeochem/VOCEmissionMod.F90 -A clm/src_clm40/biogeochem/CNAnnualUpdateMod.F90 -A clm/src_clm40/biogeochem/CNNStateUpdate2Mod.F90 -A clm/src_clm40/biogeochem/C13SummaryMod.F90 -A clm/src_clm40/biogeochem/CNAllocationMod.F90 -A clm/src_clm40/biogeochem/DryDepVelocity.F90 -A clm/src_clm40/biogeochem/CNNDynamicsMod.F90 -A clm/src_clm40/biogeochem/CNSetValueMod.F90 -A clm/src_clm40/biogeochem/CNGapMortalityMod.F90 -A clm/src_clm40/biogeochem/CropRestMod.F90 -A clm/src_clm40/biogeochem/CNNStateUpdate1Mod.F90 -A clm/src_clm40/biogeochem/CNFireMod.F90 -A clm/src_clm40/biogeochem/CNMRespMod.F90 -A clm/src_clm40/biogeochem/MEGANFactorsMod.F90 -A clm/src_clm40/biogeochem/CNWoodProductsMod.F90 -A clm/src_clm40/biogeochem/CNPrecisionControlMod.F90 -A clm/src_clm40/biogeochem/DUSTMod.F90 -A clm/src_clm40/biogeochem/CNDVLightMod.F90 -A clm/src_clm40/biogeochem/CNDecompMod.F90 -A clm/src_clm40/biogeochem/CNDVMod.F90 -A clm/src_clm40/biogeochem/CNCStateUpdate3Mod.F90 -A clm/src_clm40/biogeochem/CNC13StateUpdate3Mod.F90 -A clm/src_clm40/biogeochem/CNDVEcosystemDynIniMod.F90 -A clm/src_clm40/biogeochem/CNC13FluxMod.F90 -A clm/src_clm40/biogeochem/CNEcosystemDynMod.F90 -A clm/src_clm40/biogeochem/CNVegStructUpdateMod.F90 -A clm/src_clm40/biogeochem/CNDVEstablishmentMod.F90 - -A clm/src_clm40/main -A clm/src_clm40/main/spmdGathScatMod.F90 -A clm/src_clm40/main/organicFileMod.F90 -A clm/src_clm40/main/clm_varcon.F90 -A clm/src_clm40/main/clm_varpar.F90 -A clm/src_clm40/main/CNiniTimeVar.F90 -A clm/src_clm40/main/abortutils.F90 -A clm/src_clm40/main/accumulMod.F90 -A clm/src_clm40/main/decompInitMod.F90 -A clm/src_clm40/main/clm_glclnd.F90 -A clm/src_clm40/main/accFldsMod.F90 -A clm/src_clm40/main/subgridMod.F90 -A clm/src_clm40/main/pftdynMod.F90 -A clm/src_clm40/main/pft2colMod.F90 -A clm/src_clm40/main/clm_atmlnd.F90 -A clm/src_clm40/main/quadraticMod.F90 -A clm/src_clm40/main/GetGlobalValuesMod.F90 -A clm/src_clm40/main/clm_time_manager.F90 -A clm/src_clm40/main/filterMod.F90 -A clm/src_clm40/main/clm_varctl.F90 -A clm/src_clm40/main/subgridAveMod.F90 -A clm/src_clm40/main/dtypes.h -A clm/src_clm40/main/CNiniSpecial.F90 -A clm/src_clm40/main/surfrdMod.F90 -A clm/src_clm40/main/domainMod.F90 -A clm/src_clm40/main/lnd_import_export.F90 -A clm/src_clm40/main/restUtilMod.F90 -A clm/src_clm40/main/clmtype.F90 -A clm/src_clm40/main/mkarbinitMod.F90 -A clm/src_clm40/main/restUtilMod.F90.in -A clm/src_clm40/main/dynlandMod.F90 -A clm/src_clm40/main/getdatetime.F90 -A clm/src_clm40/main/clm_initializeMod.F90 -A clm/src_clm40/main/subgridRestMod.F90 -A clm/src_clm40/main/fileutils.F90 -A clm/src_clm40/main/clmtypeInitMod.F90 -A clm/src_clm40/main/ndepStreamMod.F90 -A clm/src_clm40/main/SimpleMathMod.F90 -A clm/src_clm40/main/iniTimeConst.F90 -A clm/src_clm40/main/lnd_comp_esmf.F90 -A clm/src_clm40/main/histFileMod.F90 -A clm/src_clm40/main/clm_cpl_indices.F90 -A clm/src_clm40/main/findHistFields.pl -A clm/src_clm40/main/restFileMod.F90 -A clm/src_clm40/main/clm_varsur.F90 -A clm/src_clm40/main/controlMod.F90 -A clm/src_clm40/main/CMakeLists.txt -A clm/src_clm40/main/initSurfAlbMod.F90 -A clm/src_clm40/main/clm_nlUtilsMod.F90 -A clm/src_clm40/main/clm_driver.F90 -A clm/src_clm40/main/clm_varorb.F90 -A clm/src_clm40/main/initGridCellsMod.F90 -A clm/src_clm40/main/lnd_comp_mct.F90 -A clm/src_clm40/main/pftvarcon.F90 -A clm/src_clm40/main/ncdio_pio.F90 -A clm/src_clm40/main/spmdMod.F90 -A clm/src_clm40/main/decompMod.F90 -A clm/src_clm40/main/ncdio_pio.F90.in -A clm/src_clm40/main/histFldsMod.F90 - -A clm/src_clm40/biogeophys -A clm/src_clm40/biogeophys/BalanceCheckMod.F90 -A clm/src_clm40/biogeophys/SoilTemperatureMod.F90 -A clm/src_clm40/biogeophys/UrbanInputMod.F90 -A clm/src_clm40/biogeophys/SnowHydrologyMod.F90 -A clm/src_clm40/biogeophys/Biogeophysics1Mod.F90 -A clm/src_clm40/biogeophys/FrictionVelocityMod.F90 -A clm/src_clm40/biogeophys/TridiagonalMod.F90 -A clm/src_clm40/biogeophys/Hydrology1Mod.F90 -A clm/src_clm40/biogeophys/BiogeophysRestMod.F90 -A clm/src_clm40/biogeophys/UrbanMod.F90 -A clm/src_clm40/biogeophys/QSatMod.F90 -A clm/src_clm40/biogeophys/clm_driverInitMod.F90 -A clm/src_clm40/biogeophys/HydrologyLakeMod.F90 -A clm/src_clm40/biogeophys/BareGroundFluxesMod.F90 -A clm/src_clm40/biogeophys/SNICARMod.F90 -A clm/src_clm40/biogeophys/CanopyFluxesMod.F90 -A clm/src_clm40/biogeophys/SurfaceRadiationMod.F90 -A clm/src_clm40/biogeophys/Biogeophysics2Mod.F90 -A clm/src_clm40/biogeophys/UrbanInitMod.F90 -A clm/src_clm40/biogeophys/FracWetMod.F90 -A clm/src_clm40/biogeophys/SurfaceAlbedoMod.F90 -A clm/src_clm40/biogeophys/Hydrology2Mod.F90 -A clm/src_clm40/biogeophys/BiogeophysicsLakeMod.F90 -A clm/src_clm40/biogeophys/SoilHydrologyMod.F90 - -A clm/src/main -A clm/src/main/organicFileMod.F90 -A clm/src/main/clm_varcon.F90 -A clm/src/main/initInterp.F90 -A clm/src/main/landunit_varcon.F90 -A clm/src/main/clm_varpar.F90 -A clm/src/main/abortutils.F90 -A clm/src/main/accumulMod.F90 -A clm/src/main/subgridWeightsMod.F90 -A clm/src/main/decompInitMod.F90 -A clm/src/main/subgridMod.F90 -A clm/src/main/atm2lndType.F90 -A clm/src/main/lnd2atmType.F90 -A clm/src/main/column_varcon.F90 -A clm/src/main/EcophysConType.F90 -A clm/src/main/GetGlobalValuesMod.F90 -A clm/src/main/initSubgridMod.F90 -A clm/src/main/lnd2glcMod.F90 -A clm/src/main/glc2lndMod.F90 -A clm/src/main/filterMod.F90 -A clm/src/main/surfrdUtilsMod.F90 -A clm/src/main/clm_varctl.F90 -A clm/src/main/subgridAveMod.F90 -A clm/src/main/initVerticalMod.F90 -A clm/src/main/glcDiagnosticsMod.F90 -A clm/src/main/lnd2atmMod.F90 -A clm/src/main/atm2lndMod.F90 -A clm/src/main/surfrdMod.F90 -A clm/src/main/FuncPedotransferMod.F90 -A clm/src/main/readParamsMod.F90 -A clm/src/main/clm_initializeMod.F90 -A clm/src/main/subgridRestMod.F90 -A clm/src/main/paramUtilMod.F90 -A clm/src/main/ColumnType.F90 -A clm/src/main/PatchType.F90 -A clm/src/main/ndepStreamMod.F90 -A clm/src/main/init_hydrology.F90 -A clm/src/main/histFileMod.F90 -A clm/src/main/findHistFields.pl -A clm/src/main/restFileMod.F90 -A clm/src/main/clm_varsur.F90 -A clm/src/main/controlMod.F90 -A clm/src/main/LandunitType.F90 -A clm/src/main/CMakeLists.txt -A clm/src/main/test -A clm/src/main/test/subgridWeights_test -A clm/src/main/test/subgridWeights_test/test_subgridWeights.pf -A clm/src/main/test/subgridWeights_test/CMakeLists.txt -A clm/src/main/test/clm_glclnd_test -A clm/src/main/test/clm_glclnd_test/test_clm_glclnd.pf -A clm/src/main/test/clm_glclnd_test/CMakeLists.txt -A clm/src/main/test/CMakeLists.txt -A clm/src/main/clm_driver.F90 -A clm/src/main/GridcellType.F90 -A clm/src/main/initGridCellsMod.F90 -A clm/src/main/pftvarcon.F90 -A clm/src/main/ncdio_pio.F90 -A clm/src/main/decompMod.F90 -A clm/src/main/ncdio_pio.F90.in -A clm/src/main/reweightMod.F90 - -A clm/src/ED -A clm/src/ED/biogeochem -A clm/src/ED/biogeochem/EDCanopyStructureMod.F90 -A clm/src/ED/biogeochem/EDGrowthFunctionsMod.F90 -A clm/src/ED/biogeochem/EDPhysiologyMod.F90 -A clm/src/ED/biogeochem/EDCohortDynamicsMod.F90 -A clm/src/ED/biogeochem/EDPatchDynamicsMod.F90 -A clm/src/ED/main -A clm/src/ED/main/EDBioType.F90 -A clm/src/ED/main/EDEcophysConType.F90 -A clm/src/ED/main/EDParamsMod.F90 -A clm/src/ED/main/EDMainMod.F90 -A clm/src/ED/main/EDCLMLinkMod.F90 -A clm/src/ED/main/EDVecCohortType.F90 -A clm/src/ED/main/EDVecPatchType.F90 -A clm/src/ED/main/EDRestVectorMod.F90 -A clm/src/ED/main/EDPftvarcon.F90 -A clm/src/ED/main/EDInitMod.F90 -A clm/src/ED/main/EDTypesMod.F90 -A clm/src/ED/fire -A clm/src/ED/fire/SFParamsMod.F90 -A clm/src/ED/fire/SFMainMod.F90 -A clm/src/ED/biogeophys -A clm/src/ED/biogeophys/EDAccumulateFluxesMod.F90 -A clm/src/ED/biogeophys/EDSurfaceAlbedoMod.F90 -A clm/src/ED/biogeophys/EDPhotosynthesisMod.F90 -A clm/src/ED/biogeophys/EDBtranMod.F90 -A clm/src/Notes -M clm/src/unit_test_shr/unittestSubgridMod.F90 - -A clm/src/utils -A clm/src/utils/spmdGathScatMod.F90 -A clm/src/utils/clm_time_manager.F90 -A clm/src/utils/clm_nlUtilsMod.F90 -A clm/src/utils/clm_varorb.F90 -A clm/src/utils/accumulMod.F90 -A clm/src/utils/getdatetime.F90 -A clm/src/utils/fileutils.F90 -A clm/src/utils/dtypes.h -A clm/src/utils/spmdMod.F90 -A clm/src/utils/SimpleMathMod.F90 -A clm/src/utils/domainMod.F90 -A clm/src/utils/restUtilMod.F90 -A clm/src/utils/quadraticMod.F90 -A clm/src/utils/CMakeLists.txt -A clm/src/utils/restUtilMod.F90.in - -A clm/src/biogeochem -A clm/src/biogeochem/CNCStateUpdate2Mod.F90 -A clm/src/biogeochem/CNDecompCascadeConType.F90 -A clm/src/biogeochem/CNNitrifDenitrifMod.F90 -A clm/src/biogeochem/CNGRespMod.F90 -A clm/src/biogeochem/CNBalanceCheckMod.F90 -A clm/src/biogeochem/CNNStateUpdate3Mod.F90 -A clm/src/biogeochem/CNDVDriverMod.F90 -A clm/src/biogeochem/SatellitePhenologyMod.F90 -A clm/src/biogeochem/CNPhenologyMod.F90 -A clm/src/biogeochem/CNCarbonFluxType.F90 -A clm/src/biogeochem/CNCarbonStateType.F90 -A clm/src/biogeochem/CNCStateUpdate1Mod.F90 -A clm/src/biogeochem/VOCEmissionMod.F90 -A clm/src/biogeochem/CNAnnualUpdateMod.F90 -A clm/src/biogeochem/CNNStateUpdate2Mod.F90 -A clm/src/biogeochem/CropType.F90 -A clm/src/biogeochem/CNAllocationMod.F90 -A clm/src/biogeochem/CNNDynamicsMod.F90 -A clm/src/biogeochem/DryDepVelocity.F90 -A clm/src/biogeochem/CNDecompCascadeBGCMod.F90 -A clm/src/biogeochem/CNSoilLittVertTranspMod.F90 -A clm/src/biogeochem/CNDecompCascadeCNMod.F90 -A clm/src/biogeochem/CNC14DecayMod.F90 -A clm/src/biogeochem/CNGapMortalityMod.F90 -A clm/src/biogeochem/CNNStateUpdate1Mod.F90 -A clm/src/biogeochem/CNFireMod.F90 -A clm/src/biogeochem/CNNitrogenFluxType.F90 -A clm/src/biogeochem/CNMRespMod.F90 -A clm/src/biogeochem/MEGANFactorsMod.F90 -A clm/src/biogeochem/CNVerticalProfileMod.F90 -A clm/src/biogeochem/CNCIsoFluxMod.F90 -A clm/src/biogeochem/CNWoodProductsMod.F90 -A clm/src/biogeochem/CNPrecisionControlMod.F90 -A clm/src/biogeochem/ch4Mod.F90 -A clm/src/biogeochem/DUSTMod.F90 -A clm/src/biogeochem/CNDVLightMod.F90 -A clm/src/biogeochem/ch4varcon.F90 -A clm/src/biogeochem/CNDecompMod.F90 -A clm/src/biogeochem/CNCStateUpdate3Mod.F90 -A clm/src/biogeochem/CNSharedParamsMod.F90 -A clm/src/biogeochem/CNDVType.F90 -A clm/src/biogeochem/CNStateType.F90 -A clm/src/biogeochem/CNEcosystemDynMod.F90 -A clm/src/biogeochem/CNNitrogenStateType.F90 -A clm/src/biogeochem/CNVegStructUpdateMod.F90 -A clm/src/biogeochem/CNDVEstablishmentMod.F90 - -A clm/src/biogeophys -A clm/src/biogeophys/SnowSnicarMod.F90 -A clm/src/biogeophys/SnowHydrologyMod.F90 -A clm/src/biogeophys/TridiagonalMod.F90 -A clm/src/biogeophys/FrictionVelocityType.F90 -A clm/src/biogeophys/LakeFluxesMod.F90 -A clm/src/biogeophys/PhotosynthesisMod.F90 -A clm/src/biogeophys/AerosolType.F90 -A clm/src/biogeophys/ActiveLayerMod.F90 -A clm/src/biogeophys/QSatMod.F90 -A clm/src/biogeophys/SoilHydrologyType.F90 -A clm/src/biogeophys/HydrologyDrainageMod.F90 -A clm/src/biogeophys/LakeStateType.F90 -A clm/src/biogeophys/BareGroundFluxesMod.F90 -A clm/src/biogeophys/SolarAbsorbedType.F90 -A clm/src/biogeophys/CanopyHydrologyMod.F90 -A clm/src/biogeophys/UrbanFluxesMod.F90 -A clm/src/biogeophys/SurfaceAlbedoMod.F90 -A clm/src/biogeophys/UrbanRadiationMod.F90 -A clm/src/biogeophys/PhotosynthesisType.F90 -A clm/src/biogeophys/CanopyTemperatureMod.F90 -A clm/src/biogeophys/HydrologyNoDrainageMod.F90 -A clm/src/biogeophys/DaylengthMod.F90 -A clm/src/biogeophys/WaterfluxType.F90 -A clm/src/biogeophys/BalanceCheckMod.F90 -A clm/src/biogeophys/SoilTemperatureMod.F90 -A clm/src/biogeophys/WaterStateType.F90 -A clm/src/biogeophys/LakeTemperatureMod.F90 -A clm/src/biogeophys/FrictionVelocityMod.F90 -A clm/src/biogeophys/SoilFluxesMod.F90 -A clm/src/biogeophys/TemperatureType.F90 -A clm/src/biogeophys/SurfaceAlbedoType.F90 -A clm/src/biogeophys/AerosolMod.F90 -A clm/src/biogeophys/SoilStateType.F90 -A clm/src/biogeophys/SurfaceResistanceMod.F90 -A clm/src/biogeophys/UrbanAlbedoMod.F90 -A clm/src/biogeophys/CanopyFluxesMod.F90 -A clm/src/biogeophys/CMakeLists.txt -A clm/src/biogeophys/RootBiophysMod.F90 -A clm/src/biogeophys/test -A clm/src/biogeophys/test/CMakeLists.txt -A clm/src/biogeophys/test/Daylength_test -A clm/src/biogeophys/test/Daylength_test/test_daylength.pf -A clm/src/biogeophys/test/Daylength_test/CMakeLists.txt -A clm/src/biogeophys/SurfaceRadiationMod.F90 -A clm/src/biogeophys/SoilWaterMovementMod.F90 -A clm/src/biogeophys/SoilMoistStressMod.F90 -A clm/src/biogeophys/SoiWatRetCurveParMod.F90 -A clm/src/biogeophys/EnergyFluxType.F90 -A clm/src/biogeophys/CanopyStateType.F90 -A clm/src/biogeophys/BandDiagonalMod.F90 -A clm/src/biogeophys/SoilHydrologyMod.F90 -A clm/src/biogeophys/LakeCon.F90 -A clm/src/biogeophys/LakeHydrologyMod.F90 -A clm/src/biogeophys/UrbanParamsType.F90 -A clm/src/dyn_subgrid -A clm/src/dyn_subgrid/dynLandunitAreaMod.F90 -A clm/src/dyn_subgrid/dynTimeInfoMod.F90 -A clm/src/dyn_subgrid/dynSubgridDriverMod.F90 -A clm/src/dyn_subgrid/dynFileMod.F90 -A clm/src/dyn_subgrid/dynConsBiogeochemMod.F90 -A clm/src/dyn_subgrid/dynEDMod.F90 -A clm/src/dyn_subgrid/dynVarMod.F90 -A clm/src/dyn_subgrid/dynVarTimeUninterpMod.F90 -A clm/src/dyn_subgrid/dynVarMod.F90.in -A clm/src/dyn_subgrid/dynVarTimeInterpMod.F90.in -A clm/src/dyn_subgrid/dynVarTimeUninterpMod.F90.in -A clm/src/dyn_subgrid/do_genf90 -A clm/src/dyn_subgrid/CMakeLists.txt -A clm/src/dyn_subgrid/test -A clm/src/dyn_subgrid/test/dynLandunitArea_test -A clm/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf -A clm/src/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt -A clm/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf -A clm/src/dyn_subgrid/test/dynVar_test -A clm/src/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 -A clm/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf -A clm/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf -A clm/src/dyn_subgrid/test/dynVar_test/CMakeLists.txt -A clm/src/dyn_subgrid/test/dynTimeInfo_test -A clm/src/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf -A clm/src/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt -A clm/src/dyn_subgrid/test/CMakeLists.txt -A clm/src/dyn_subgrid/test/dynInitColumns_test -A clm/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf -A clm/src/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt -A clm/src/dyn_subgrid/dynHarvestMod.F90 -A clm/src/dyn_subgrid/dynPriorWeightsMod.F90 -A clm/src/dyn_subgrid/dynpftFileMod.F90 -A clm/src/dyn_subgrid/dynVarTimeInterpMod.F90 -A clm/src/dyn_subgrid/dynCNDVMod.F90 -A clm/src/dyn_subgrid/dynConsBiogeophysMod.F90 -A clm/src/dyn_subgrid/dynInitColumnsMod.F90 -A clm/src/unit_test_mocks/util_share/restUtilMod_mock.F90 -A clm/src/unit_test_mocks/util_share/restUtilMod_mock.F90.in - -List all existing files that have been modified, and describe the changes: - ALL files have been modified - see the general description for an - overview of what was done - the following files have not had their directories - changed - so the summary is below - -M clm/bld/configure - - needed to account for change in filepath - -M clm/bld/CLMBuildNamelist.pm -M clm/bld/namelist_files/namelist_definition_clm4_5.xml - - see namelist changes mentioned above - -M clm/src/unit_test_mocks/util_share/clm_time_manager_mock.F90 -M clm/src/unit_test_mocks/util_share/ncdio_var.F90 -M clm/src/unit_test_mocks/util_share/ncdio_pio_mock.F90 -M clm/src/unit_test_mocks/util_share/do_genf90 -M clm/src/unit_test_mocks/util_share/CMakeLists.txt -M clm/src/unit_test_mocks/util_share/ncdio_pio_mock.F90.in -M clm/src/unit_test_mocks/main/histFileMod_mock.F90 -M clm/src/CMakeLists.txt - - unit test changes needed to account for introduction of new data types and - directory structure - -M clm/src/cpl/lnd_comp_esmf.F90 -M clm/src/cpl/lnd_import_export.F90 -M clm/src/cpl/lnd_comp_mct.F90 - - coupling interface changes needed to account for introduction of new data types - -CLM testing: - - build-namelist tests: - - yellowstone yes - goldbach yes - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - - NOTE for goldbach_nag - four ED compare_hist tests fail with small bit for bit differences. - In fact - looking more closely, these tests are also run for pgi and intel on goldbach - and - values for LITTER_IN and LITTER_OUT are 0. for those compilers but non-zero for nag. - With the refactoring code - those fields are again 0. for intel and pgi - but totally different - and non-zero for nag. Apparently, this is known problem that will get resolved in when new ED changes - are brount in - - ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_nag.clm-edTest - ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_nag.clm-edTest - SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest - SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest - - - short tests (aux_clm_short) (generally these are NOT used when making a tag): N/A - - tools testing: N/A - -CLM tag used for the baseline comparisons: clm4_5_1_r080 - -Changes answers relative to baseline: No - BFB - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r080 -Originator(s): erik (Erik) -Date: Sat Aug 16 15:01:35 MDT 2014 -One-line Summary: Update externals to CESM trunk versions, allow eighth degree as a valid resolution - -Purpose of changes: - -Update all the externals to the very latest CESM trunk versions (based off of current -cesm1_3_alpha13a). - -Requirements for tag: Get working with trunk externals - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 2012 Problem with mksurfdata_map for eighth degree grid... - Scripts issues as follows: - 2024 nlcompareonly option to create_test not working correctly for reporting - 2019 ERH tests don't save the base env_run.xml, so have trouble when resubmitted... - 2018 Failed tests in cesm1_3_beta11 needed for CLM - 2005 Remove untested named compsets and grids - 1999 T85_g16 has inconsistent land domain and surface datasets - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - Archiving updated in support of time series generation - Running test suite now builds some shared libraries built only once - -Describe any changes made to the namelist: - Resolve env and xml vars used in user_nl_* - - Default for drv_in profile_timer changed from 4 to 1 - Some PE layours change: f10_f10 change from 15x1 to 30x1 - -List any changes to the defaults for the boundary datasets: Add 0.125x0.125 mapping files - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): Update to cesm1_3_alpha13a externals - - scripts to scripts4_140814a - scripts/doc to doc_140519 - Machines to Machines_140811 - CMake to CMake_Fortran_utils_140715 - drv to drvseq5_0_15 - cism to cism1_140602 - timing to timing_140416 - pio to pio1_8_12 - cprnc to cprnc_140625 - mapping to mapping_140702b (note: gen_domain changes answers) - unit_testing to unit_testing_0_07 - - PTCLM to PTCLM2_140816 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkgridmapMod.F90 -- decrease tolerance - M models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.ncl - Loop over variables - and then cat the files together at the end. This makes the process possible for - high resolution and speeds up lower resolution sub-setting as well. - M models/lnd/clm/tools/clm4_0/mksurfdata_map/src/mkgridmapMod.F90 -- decrease tolerance - M models/lnd/clm/tools/shared/mkmapdata/README --------------------- Fix/update documentation - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl ----------- Correct test count - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Add 0.125x0.125 - mapping files - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Add 0.125x0.125 - as a valid resolution - M models/lnd/clm/bld/namelist_files/createMapEntry.pl --- Correct path, get working again - -CLM testing: - - build-namelist tests: - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - yellowstone_gnu yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - - short tests (aux_clm_short) (generally these are NOT used when making a tag): - - yellowstone_intel yes - yellowstone_pgi yes - goldbach_nag yes - - tools testing: - - yellowstone interactive yes - -CLM tag used for the baseline comparisons: clm4_5_1_r079 - -Changes answers relative to baseline: Yes! (PE layouts that change) - - Summarize any changes to answers, i.e., - - what code configurations: non single-point configurations, where PE layout - changes (f10_f10) - - what platforms/compilers: all - - nature of change (roundoff) - x2l_Flrr_volr changes to roundoff - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r079 -Originator(s): andre (Benjamin Andre,LAWRENCE BERKELEY NATIONAL LABORATORY,510-486-4617) -Date: Thu Jul 31 17:09:57 MDT 2014 -One-line Summary: G. Bisht (LBL) soil temperature refactor; machines update for goldbach-intel - -Purpose of changes: Refactor soil temperature module to break the construction of the linear system LHS matrix and RHS vector into small physics based routines. Update machines external to fix compiling with goldbach-intel. - -Requirements for tag: regular - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: gbisht, self, muszala - -List any svn externals directories updated (csm_share, mct, etc.): Machines - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 - break creation of linear system into small physics based routines. - - -CLM testing: regular - - build-namelist tests: N/A - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - 4.0 ok, 4.5 ok - yellowstone_pgi - 4.0 ok, 4.5 ok - goldbach_nag - 4.0 ok, 4.5 ok (see note below) - goldbach_intel - 4.0 ok, 4.5 ok - goldbach_pgi - 4.0 ok, 4.5 ok - - NOTE for goldbach_nag - four ED compare_hist tests fail with small non bit for bit differences. This is the same issue described in clm4_5_1_r078 tag notes. - - ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_nag.clm-edTest - ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_nag.clm-edTest - SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest - SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest - - tools testing: N/A - -CLM tag used for the baseline comparisons: clm4_5_1_r078 - -Changes answers relative to baseline: No, bit for bit - - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r078 -Originator(s): muszala (Stefan Muszala) -Date: Wed Jul 23 20:42:00 MDT 2014 -One-line Summary: Add lai stream capability and the ability to run with V5 cruncep data. Code written by swenson, -modified and tested by muszala. - -Purpose of changes: Add lai stream capability with use_lai_streams namelist variable. Also add a datm_mode option -s.t. we can use cruncep V5 data if a user wants. Move anomaly focing code out of CLM and into DATM. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: add setup_logic_lai_streams which controls use_lai_streams namelist variable - -List any changes to the defaults for the boundary datasets: added option to use V5 cruncep data sets. V4 is default. - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: kluzek, swenson, self - -List any svn externals directories updated (csm_share, mct, etc.): - --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/addclm50_tags/addclm50_n06_ED_scripts_015_140305_rev -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/addclm50_tags/addclm50_n09_ED_scripts_015_140305_rev - --models/atm/datm https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_140312 -+models/atm/datm https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_140723 - --models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_140418 -+models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_140723 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -! add setup_logic_lai_streams function -M models/lnd/clm/bld/CLMBuildNamelist.pm -! add entries for: stream_year_first_lai, stream_year_last_lai, model_year_align_lai, stream_fldfilename_lai, lai_mapalgo -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -! add default values for items added in namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -! add use_lai_streams code. lai_init, lai_interp -M models/lnd/clm/src/clm4_5/biogeochem/SatellitePhenologyMod.F90 -! some comment clean up. add use_lai_streams logical -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -! add use_lai_streams namelist handling and mpi_bcast call -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -! remove snomaly forcing streams since they are now in the datm -M models/lnd/clm/src/cpl/clm_cpl_indices.F90 -! remove anomaly forcing code since it is now in datm -M models/lnd/clm/src/cpl/lnd_import_export.F90 - -CLM testing: - - build-namelist tests: - - yellowstone - failed 20 tests of 537. This is expected due to the addition of the use_lai_streams namelist variable. - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - -- nlcomp tests for 45 will fail -- - - yellowstone_intel - 40 OK - 45 OK - yellowstone_pgi - 40 OK - 45 OK - - goldbach_nag - 40 OK - 45 OK - goldbach_intel - 40 OK - 45 OK - goldbach_pgi - 40 OK - 45 OK - -Both NAG tests on goldbach for ED compsets failed BFB. All other compilers and machines pass. Error probably related to a non-BFB error that I (spm) see with varying numbers of -time-steps on an ERS test and am currently trying to fix. - -FAIL ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_nag.clm-edTest.GC.again_45_nag.compare_hist.clm4_5_1_r077_redo -FAIL ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_nag.clm-edTest.GC.again_45_nag.clm2.h0.compare_hist.clm4_5_1_r077_redo -FAIL SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest.GC.again_45_nag.compare_hist.clm4_5_1_r077_redo -FAIL SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest.GC.again_45_nag.clm2.h0.compare_hist.clm4_5_1_r077_redo -CLM tag used for the baseline comparisons: clm4_5_1_r077 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r077 -Originator(s): andre (Benjamin Andre,LAWRENCE BERKELEY NATIONAL LABORATORY,510-486-4617) -Date: Thu Jul 10 21:55:11 MDT 2014 -One-line Summary: Refactor from Jinyun Tang (LBL) to make hydrology more modular and eventually allow runtime selection of different physics implementations. - -Purpose of changes: Refactor a number of routines in clm45 hydrology to move duplicate code into reusable routines, make the code more modular for eventual unit testing and run time selection of different physics. - -Requirements for tag: bit for bit, regular testing - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self, clm-cmt - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: - - models/lnd/clm/src/util_share/SimpleMathMod.F90 - reuseable array functions - models/lnd/clm/src/clm4_5/main/init_hydrology.F90 - initialize different hydrology submodules. - models/lnd/clm/src/clm4_5/main/FuncPedotransferMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/SurfaceResistanceMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/RootBiophysMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/SoilWaterMovementMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/SoilMoistStressMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/SoiWatRetCurveParMod.F90 - modularize - - -List all existing files that have been modified, and describe the changes: - - models/lnd/clm/bld/query-xFail - check python version and provide an error message of it is too old. - models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 - remove unused min/max variables that conflict with intrinsics with gfortran. - - - models/lnd/clm/src/clm4_5/main/initTimeConstMod.F90 - modularize - models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - allocate new variable, fix bounds on porosity - models/lnd/clm/src/clm4_5/main/controlMod.F90 - initialize new hydrology modules - models/lnd/clm/src/clm4_5/main/clmtype.F90 - add new variable - models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 - modularize - models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - modularize - -CLM testing: regular - - build-namelist tests: - - yellowstone - n/a - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - OK clm40, OK clm45 - yellowstone_pgi - OK clm40, OK clm45 - goldbach_nag - OK clm40, OK clm45 - goldbach_intel - OK clm40, OK clm45 - goldbach_pgi - OK clm40, OK clm45 - - short tests (aux_clm_short) (generally these are NOT used when making a tag): - - yellowstone_intel - n/a - yellowstone_pgi - n/a - goldbach_nag - n/a - - tools testing: - - yellowstone interactive - n/a - goldbach interactive - n/a - -CLM tag used for the baseline comparisons: clm4_5_1_r076 - -Changes answers relative to baseline: No, bit for bit - - Note: SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTest is not bit for bit. This is the same test Stef had problems with in clm4_5_75. He has looked at it and given the ok make the tag as is. - -=============================================================== -=============================================================== -Tag name: clm4_5_1_r076 -Originator(s): erik (Erik) -Date: Mon Jul 7 14:24:07 MDT 2014 -Orig Date: Wed Jun 25 13:49:49 MDT 2014 (Date of what was tagged as clm4_6_0, before we changed naming convention) -One-line Summary: Answer changes for fire code from Fang Li - -Purpose of changes: - -Several changes to CN Fire model. Some fixes for non-transient, as well as limiting of fire for high tropical -forest coverage. Change some units from per time-step to per second. Change Lightning input dataset from just -cloud to ground to total lightning. Some fire parameters were also changed and re-tuned for Qian forcing. -Some more documentation on fire fields was added. - -When -ed_mode is sent to CLM build-namelist, a particular ED params dataset is used over the default. Make -a simple change that allows ED to run when CN is off. Add a 1850 and transient 20thC and rcp=8.5 datasets -for 1x1_brazil. - -Requirements for tag: Fix bugs 1805 and 1719, lower fire amount in amazon - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1996 -- change cloud to ground lightning dataset to total lightning - 1995 -- change units from per time-step to per second - 1805 -- fire fix for non-transient - 1719 -- remove double counting of baf in fire area - 1992 -- allow ED to run when use_cn=.false. - 1988 -- Add ED params dataset. - 1991 -- transient datasets for 1x1_brazil - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: - specific rparams file for ED - add 1850 and 20thC, rcp8.5 datasets for 1x1_brazil - use lightning file that is total lightning not just cloud-to-ground - -Describe any substantial timing or memory changes: - The test SMS.f19_g16.IRCP45CN.yellowstone_pgi showed a memory increase - -Code reviewed by: self, lifang - -List any svn externals directories updated (csm_share, mct, etc.): scripts - scripts to addclm50_n06_ED_scripts_015_140305_rev - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl --------- Add some ED tests - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - Different - params file for ED, and add 1850 and 20thC, rcp8.5 datasets for 1x1_brazil - and use lightning file that is total lightning not just cloud-to-ground - M models/lnd/clm/bld/CLMBuildNamelist.pm ------------------------- Pass use_ed - when getting paramfile - M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 ------------- Revisions from - Fang Li (2014), change parameters, add documentation, tropical forests will - only burn if > 60% coverage, change some fields units to per second rather than - per time-step, - M models/lnd/clm/src/clm4_5/biogeochem/CNInitMod.F90 ------------- change units - for nfire, and farea_burned - M models/lnd/clm/src/clm4_5/main/clmtype.F90 --------------------- Change units - for nfire, lfc, lfc2, baf_crop, baf_peatf, fbac, fbac1, farea_burned - M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 ----------------- Change units for: - LFC2, NFIRE, FAREA_BURNED, BAF_CROP, BAF_PEATF - M models/lnd/clm/src/clm4_5/biogeophys/ED/EDPhotosynthesisMod.F90 Allow to work - when use_cn is .false., use c3psn+1 in finding index for dr array. - -CLM testing: - - build-namelist tests: yes - - NOTE: 191 of the 537 compare tests fail, compared to clm4_5_75, because of changes in the namelist. - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - -CLM tag used for the baseline comparisons: clm4_5_75 - -Changes answers relative to baseline: - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CN and BGC with CLM4.5 physics - CLM4.0 for all modes, and CLM4.5 with SP or ED should be identical - - what platforms/compilers: All - - nature of change: new climate - - Fang Li, ran simulations with Qian forcing on yellowstone and tuned fire parameters to that forcing. - However, her simulations had a minor bug in the conversion of total lightning to just cloud-to-ground - (latitude in degree's was used for a cosine, rather than latitude in radians -- see bug 1996). - -=============================================================== -=============================================================== -Tag name: clm4_5_75 -Originator(s): muszala (Stefan Muszala,UCAR/TSS,303-497-1320) -Date: Fri May 30 11:18:35 MDT 2014 -One-line Summary: update externals to rtm1_0_38 and esmf_wrf_timemgr_140529 - -Purpose of changes: update externals to rtm1_0_38 and esmf_wrf_timemgr_140529. These modifications -are based on valgrind errors that orginated in src/riverroute. Tested in clm4_5_72 to make sure -everything was still BFB (at least w.r.t. CLM testing). Retested (results below) against clm4_5_73. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID):N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - --models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_37 -+models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_38 - --models/utils/esmf_wrf_timemgr https://svn-ccsm-models.cgd.ucar.edu/esmf_wrf_timemgr/trunk_tags/esmf_wrf_timemgr_130213 -+models/utils/esmf_wrf_timemgr https://svn-ccsm-models.cgd.ucar.edu/esmf_wrf_timemgr/trunk_tags/esmf_wrf_timemgr_140529 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: N/A - -CLM testing: - -in addition to other clm tests I updated the rtm and esmf externals in cesm1_3_alpha09c and -ran two B cases. - -Note: There is one ED test (SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_nag.clm-edTestGb) that failed for me in my -testing but passed for Bill with the same checkout. We will keep an eye on this, but it's not super-critical at the moment. -Differences are very small in cpl. voc fields (largest RMS difference is 1e-13). - ->>more TestStatus -PASS ERS_PT.T31_g37.B1850CN.yellowstone_gnu -PASS ERS_PT.T31_g37.B1850CN.yellowstone_gnu.memleak - ->>more TestStatus -PASS ERS.ne30_g16.B1850C5CN.yellowstone_intel -PASS ERS.ne30_g16.B1850C5CN.yellowstone_intel.memleak - - build-namelist tests: N/A - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel - 40 OK - 45 OK - component gen comp - OK - yellowstone_pgi - 40 OK - 45 OK - component gen comp - OK - - goldbach_nag - 40 OK - 45 OK - goldbach_intel - 40 OK - 45 OK - goldbach_pgi - 40 OK - 45 OK - -CLM tag used for the baseline comparisons: clm4_5_73 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_74 -Originator(s): sacks (sacks) -Date: Wed May 28 16:05:36 MDT 2014 -One-line Summary: misc. bfb changes - see detailed summary below - -Purpose of changes: - - (1) Rename fpftdyn to flanduse_timeseries, and make related changes to names - throughout the code. This rename is in preparation for an upcoming tag - where this file will take on more general uses (e.g., transient crop - areas). - - (2) Decrease thresholds for water, snow and energy balance checks (these were - too permissive) - - (3) Move stuff out of clm_varcon into landunit_varcon (for constants specific - to CLM's landunits) and column_varcon (for constants specific to CLM's - columns) - analogous to the existing pftvarcon - - (4) Move some routines out of initGridCellsMod into a new initSubgridMod - - (5) Make time_info a public member of dyn_file_type, which allows removing a - bunch of delegation methods. And rename some things in time_info_type for - clarity. - - (6) Rework metadata for the description of landunit, column and pft types - on the history and restart files, to centralize these descriptions to the - appropriate place in the code. - - (7) Add general-purpose functionality for setting up subgrid structure for - unit tests - - (8) Move unit tests into source tree, rather than being in - test/unit_testers. Now the top-level script is in models/lnd/clm/src. - - (9) Fix baseline comparisons for PTCLM tests - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 1928 (create landunit_varcon.F90 and column_varcon.F90 from parts of clm_varcon.F90) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: fpftdyn renamed to flanduse_timeseries - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: addclm50_n03_ED_scripts_015_140305_rev -> addclm50_n04_ED_scripts_015_140305_rev - - Rename CLM's fpftdyn to flanduse_timeseries in tests; update perl5lib - - tools/unit_testing: unit_testing_0_04 -> unit_testing_0_05 - - the major change here is allowing rebuilds with intel without needing to - specify --clean - - models/lnd/clm/tools/PTCLM: PTCLM2_140423 -> PTCLM2_140521 - - rename fpftdyn -> flanduse_timeseries, and other related renames - -List all files eliminated: - -========= Renamed -D models/lnd/clm/tools/clm4_5/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt -D models/lnd/clm/tools/clm4_0/mksurfdata_map/pftdyn_hist_simyr1850-2005.txt - -========= Move unit tests into source tree -D models/lnd/clm/test/unit_testers/clm4_5/biogeophys/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test/test_daylength.pf -D models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test -D models/lnd/clm/test/unit_testers/clm4_5/biogeophys -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/test_update_landunit_weights.pf -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/test_dynVarShared.F90 -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/test_dynVarTimeInterp.pf -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/test_dynVarTimeUninterp.pf -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test/test_dynTimeInfo.pf -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynInitColumns_test/test_init_columns.pf -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynInitColumns_test/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynInitColumns_test -D models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_var.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/GetGlobalValuesMod_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_var.F90.in -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/clm_time_manager_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_pio_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/spmdMod_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/do_genf90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_pio_mock.F90.in -D models/lnd/clm/test/unit_testers/clm4_5/mock/util_share -D models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/shr_sys_mod_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/mct_mod_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share -D models/lnd/clm/test/unit_testers/clm4_5/mock/main/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/mock/main/histFileMod_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/main -D models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/dynFileMod_mock.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid -D models/lnd/clm/test/unit_testers/clm4_5/mock/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/mock -D models/lnd/clm/test/unit_testers/clm4_5/CMakeLists.txt -D models/lnd/clm/test/unit_testers/clm4_5/README -D models/lnd/clm/test/unit_testers/clm4_5 -D models/lnd/clm/test/unit_testers - - -List all files added and what they do: - -========= Renamed -A models/lnd/clm/tools/clm4_5/mksurfdata_map/landuse_timeseries_hist_simyr1850-2005.txt -A models/lnd/clm/tools/clm4_0/mksurfdata_map/landuse_timeseries_hist_simyr1850-2005.txt - -========= Move stuff out of clm_varcon into landunit_varcon (for constants - specific to CLM's landunits) and column_varcon (for constants specific - to CLM's columns) - analogous to the existing pftvarcon. -A models/lnd/clm/src/clm4_5/main/landunit_varcon.F90 -A models/lnd/clm/src/clm4_5/main/column_varcon.F90 - - -========= Move some routines out of initGridCellsMod - these are lower-level - routines that can also be used by unit test code. So initGridCellsMod - contains higher-level stuff that is specific to how the subgrid - structure is set up in a production run; and initSubgridMod contains - lower-level stuff that doesn't know or care how things are actually - set up, conceptually. -A models/lnd/clm/src/clm4_5/main/initSubgridMod.F90 - -========= Add general-purpose functionality for setting up subgrid structure for unit tests -A models/lnd/clm/src/unit_test_shr/unittestSubgridMod.F90 -A models/lnd/clm/src/unit_test_shr/CMakeLists.txt -A models/lnd/clm/src/unit_test_shr - - -========= Move unit tests into source tree; also modify some unit tests to take - advantage of the new unittestSubgridMod; also add tests of - subgridWeightsMod and clm_glclnd -A models/lnd/clm/src/clm4_5/main/test/subgridWeights_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/main/test/subgridWeights_test/test_subgridWeights.pf -A models/lnd/clm/src/clm4_5/main/test/subgridWeights_test -A models/lnd/clm/src/clm4_5/main/test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/main/test/clm_glclnd_test/test_clm_glclnd.pf -A models/lnd/clm/src/clm4_5/main/test/clm_glclnd_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/main/test/clm_glclnd_test -A models/lnd/clm/src/clm4_5/main/test -A models/lnd/clm/src/clm4_5/biogeophys/test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/biogeophys/test/Daylength_test/test_daylength.pf -A models/lnd/clm/src/clm4_5/biogeophys/test/Daylength_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/biogeophys/test/Daylength_test -A models/lnd/clm/src/clm4_5/biogeophys/test -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynLandunitArea_test -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynVar_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynVar_test -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynTimeInfo_test -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt -A models/lnd/clm/src/clm4_5/dyn_subgrid/test/dynInitColumns_test -A models/lnd/clm/src/clm4_5/dyn_subgrid/test -A models/lnd/clm/src/README.unit_testing -A models/lnd/clm/src/unit_test_mocks/util_share/ncdio_var.F90 -A models/lnd/clm/src/unit_test_mocks/util_share/GetGlobalValuesMod_mock.F90 -A models/lnd/clm/src/unit_test_mocks/util_share/ncdio_var.F90.in -A models/lnd/clm/src/unit_test_mocks/util_share/clm_time_manager_mock.F90 - - also add a routine to this mock, needed because of refactor of - dyn_file_type / dyn_time_inof -A models/lnd/clm/src/unit_test_mocks/util_share/ncdio_pio_mock.F90 -A models/lnd/clm/src/unit_test_mocks/util_share/spmdMod_mock.F90 -A models/lnd/clm/src/unit_test_mocks/util_share/do_genf90 -A models/lnd/clm/src/unit_test_mocks/util_share/CMakeLists.txt -A models/lnd/clm/src/unit_test_mocks/util_share/ncdio_pio_mock.F90.in -A models/lnd/clm/src/unit_test_mocks/util_share -A models/lnd/clm/src/unit_test_mocks/csm_share/shr_sys_mod_mock.F90 -A models/lnd/clm/src/unit_test_mocks/csm_share/mct_mod_mock.F90 -A models/lnd/clm/src/unit_test_mocks/csm_share/CMakeLists.txt -A models/lnd/clm/src/unit_test_mocks/csm_share -A models/lnd/clm/src/unit_test_mocks/main/CMakeLists.txt -A models/lnd/clm/src/unit_test_mocks/main/histFileMod_mock.F90 -A models/lnd/clm/src/unit_test_mocks/main -A models/lnd/clm/src/unit_test_mocks/dyn_subgrid/dynFileMod_mock.F90 -A models/lnd/clm/src/unit_test_mocks/dyn_subgrid/CMakeLists.txt -A models/lnd/clm/src/unit_test_mocks/dyn_subgrid -A models/lnd/clm/src/unit_test_mocks/CMakeLists.txt -A models/lnd/clm/src/unit_test_mocks -A models/lnd/clm/src/CMakeLists.txt - -List all existing files that have been modified, and describe the changes: - -========= Renamed fpftdyn -> flanduse_timeseries, and other related changes to - variable names - (NOTE: Some source files are listed both here and elsewhere in the - ChangeLog entry) -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata_map.namelist -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl -M models/lnd/clm/tools/clm4_5/mksurfdata_map/README -M models/lnd/clm/tools/shared/ncl_scripts/sample_inlist -M models/lnd/clm/tools/shared/ncl_scripts/sample_outlist -M models/lnd/clm/tools/clm4_0/mksurfdata_map/src/clm_varctl.F90 -M models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata_map.namelist -M models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata.pl -M models/lnd/clm/tools/clm4_0/mksurfdata_map/README -M models/lnd/clm/bld/CLMBuildNamelist.pm -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/test_build_namelist/t/input/namelist_defaults_clm4_5_test.xml -M models/lnd/clm/bld/test_build_namelist/t/input/namelist_definition_clm4_5_test.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml -M models/lnd/clm/doc/UsersGuide/trouble_shooting.xml -M models/lnd/clm/doc/UsersGuide/single_point.xml -M models/lnd/clm/doc/UsersGuide/tools.xml -M models/lnd/clm/doc/UsersGuide/adding_files.xml -M models/lnd/clm/doc/UsersGuide/custom.xml -M models/lnd/clm/doc/UsersGuide/ptclm.xml -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/surfrdUtilsMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_0/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_0/main/controlMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_0/main/clm_driver.F90 -M models/lnd/clm/src/clm4_0/biogeophys/BiogeophysRestMod.F90 - -========= Updated PTCLM external to rename fpftdyn -> flanduse_timeseries -M models/lnd/clm/tools/SVN_EXTERNAL_DIRECTORIES - -========= Decrease threshold for water & snow balance checks by 3 orders of - magnitude; decrease threshold for energy balance checks by 2 orders of - magnitude -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 - -========= Separate clm_varcon into clm_varcon, column_varcon and landunit_varcon -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/CMakeLists.txt - -========= Move some routines out of initGridCellsMod, into a new initSubgridMod - (see detailed notes above) -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 - -========= Make time_info a public member of dyn_file_type. This allows us to - remove all methods from dyn_file_type (which were just delegating - responsibility to time_info_type). Also rename some methods and - variables in time_info_type. -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynFileMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynTimeInfoMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90.in - - also change intent(in) to intent(inout), fixing a gfortran problem -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90.in -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90.in -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90 - -========= Rework metadata for the description of landunit, column and pft types - on the history and restart files. Point is to centralize the - definition of these different types as much as possible (rather than, - e.g., having restFileMod know about the translation between landunit - indices and names). For the history file, I am removing the metadata - from the PCT_LANDUNIT long name, instead putting it in global - metadata, as is done for the restart file. -M models/lnd/clm/src/clm4_5/main/subgridWeightsMod.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 - -========= Change 'use' statements based on my split of clm_varcon into - clm_varcon, landunit_varcon and column_varcon -M models/lnd/clm/src/clm4_5/biogeochem/CNWoodProductsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4InitMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/main/initTimeConstMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/main/subgridMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/initColdMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/ED/EDCLMLinkMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynConsBiogeochemMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynEDMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynCNDVMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynConsBiogeophysMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynInitColumnsMod.F90 - -========= Fix baseline comparisons for PTCLM tests -M models/lnd/clm/test/tools/TSMscript_tools.sh -M models/lnd/clm/test/tools/TBLscript_tools.sh - -========= Just changes in whitespace -M models/lnd/clm/src/clm4_5/dyn_subgrid/CMakeLists.txt -M models/lnd/clm/src/clm4_5/biogeophys/CMakeLists.txt - - -CLM testing: - - Most testing done on dynlu_crops_n01_addclm50bld_n06_clm4_5_72; PTCLM and - tools testing done on dynlu_crops_n03_addclm50bld_n06_clm4_5_72 - - Note that the branch was up-to-date with addclm50bld_n06_clm4_5_72; this is - identical to clm4_5_73 except for a fix to the build-namelist tests (see below) - - build-namelist tests: - - yellowstone: ok - compared against addclm50bld_n06_clm4_5_72 (essentially clm4_5_73) - expected diffs for transient cases - - The following tests also failed when comparing the baseline against - itself (NOTE: this is apparently fixed in clm4_5_73): - - 466/497 < FAIL> - 467/497 < FAIL> - 496/497 < FAIL> - 497/497 < FAIL> - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel: ok - yellowstone_pgi: ok - goldbach_nag: ok - goldbach_intel: ok - goldbach_pgi: ok - - Most comparisons were done against clm4_5_72. - - These comparisons failed due to a problem with component_gen_comp and the - SSP test; manual comparisons show these to be identical to Erik's tests (for - clm4_5_73): - - FAIL SSP.f19_g16.I1850CLM45BGC.yellowstone_pgi.clm-default.GC.0520-2021.45.p.clm2.h0.compare_hist.clm4_5_72 - FAIL SSP.f19_g16.I1850CLM45BGC.yellowstone_pgi.clm-default.GC.0520-2021.45.p.clm2.h1.compare_hist.clm4_5_72 - - For new tests added in Erik's upcoming tag (clm4_5_73), I did manual - comparisons against Erik's baselines (cpl & clm hist for the yellowstone - tests, just cpl for goldbach tests) - all PASS. - - Note that CLM hist files were NOT compared for any goldbach tests, because - there were no CLM hist file baselines for clm4_5_72. - - tools testing: - - yellowstone interactive: ok - - Compared against addclm50bld_n06_clm4_5_72 (essentially clm4_5_73) - - Failures in the following baseline comparisons, due to changed name of output - file (surfdata.pftdyn -> landuse.timeseries). Manual comparisons showed the - output files to be identical in all cases: - - 010 bl754 TBLtools.sh clm4_0 mksurfdata_map tools__s namelist ...................................\c - rc=7 FAIL - 012 blg54 TBLtools.sh clm4_5 mksurfdata_map tools__s namelist ...................................\c - rc=7 FAIL - 018 bl974 TBLscript_tools.sh clm4_0 mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools_\c - rc=7 FAIL - 030 bli74 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools_\c - rc=7 FAIL - 040 blfg4 TBLscript_tools.sh shared PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools ......\c - rc=7 FAIL - - Other than that, all tests & baseline comparisons passed - -CLM tag used for the baseline comparisons: clm4_5_72, except where noted above - -Changes answers relative to baseline: NO - bfb - -=============================================================== -=============================================================== -Tag name: clm4_5_73 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed May 28 15:33:10 MDT 2014 -One-line Summary: Add the stub ability for clm5_0 physics to CLM build system - -Purpose of changes: - -Add phys=clm5_0 as an option to the build. Currently, nothing is different in the code, this just -adds the capability to do clm5_0 as a seperate configuration. The one thing that is different between -clm4_5 and clm5_0 is the setting of urban_hac. - -Fix several issues needed for CAM: problem in DryDeposition (reoccurance of bug 1883, that was fixed and then -unfixed in clm4_5_48), fix for internal compiler errors. CAM has been using the branch version of this -since: cam5_3_29. - -Work on updates for PTCLM. Add some new sites for Rosie and Jinyun. Correct the call to mkmapdata.sh. -Have CLM1PT forcing directory to use DIN_LOC_ROOT_CLMFORC so you can point it to a location seperate -from DIN_LOC_ROOT. Add a new support script to PTCLM to submit a list of sites to batch: PTCLMsublist. -Also allow release_tags in version find. Get buildtools to work on edison/hopper. - -Get tools to work on hopper and edison, and update mapping to use ESMF6.3.0. - -Fix various bugs: internal compiler error on janus, trigger an error if user_datm.streams.txt file is - readonly (rather than hang). Use DIN_LOC_ROOT_CLMFORC for CLM1PT. - -Requirements for tag: Fix bug 1883 and 1985 for Cheryl and CAM, fix PTCLM, add clm5_0, tools on hopper/edison - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 1985 Internal compiler error on yellowstone with CLM in CAM standalone build - 1965 Internal compiler error on janus with CLM on janus - 1938 Upgrade mkmapdata to ESMF6.3.0 - 1937 Using a read-only user_datm.streams.txt file causes cesm_setup to hang - 1936 CLM1PT forcing directory needs to use DIN_LOC_ROOT_CLMFORC - 1935 Changes needed to get tools to build on hopper... - 1933 Correct call to mkmapdata.sh in PTCLM - 1925 Add more sites to PTCLM - 1904 check for LSF_PJL_TYPE in regridbatch.sh doesn't work correctly - 1883 uninitialized variable in DryDepVelocity.F90 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: Add clm5_0 as a new supported physics type - -Describe any changes made to the namelist: Set urban_hac according to physics - clm5_0=ON_WASTEHEAT, and clm4_5=ON - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self (clm_phys perl object reviewed by team: bandre, muszala, sacks) - -List any svn externals directories updated (csm_share, mct, etc.): scripts, datm - scripts to addclm50_n03_ED_scripts_015_140305_rev - datm to datm8_140312 - csm_share to share3_140418 Use trunk version rather than branch - tools/mapping to mapping_131217a - PTCLM to PTCLM2_140423 - -List all files eliminated: - - D models/lnd/clm/bld/unit_testers/env_run.xml -- This file is now built dynamically when the tester is run. - -List all files added and what they do: - - A models/lnd/clm/bld/query-xFail --- Add a script from Ben Andre to read and report on expected fails. - A models/lnd/clm/bld/env_run.xml --- envxml_dir option is now required, so this provides a env_*.xml - file that can be read by default, when build-namelist is called outside of CESM for testing. - A models/lnd/clm/bld/config_files/clm_phys_vers.pm - Enter physics version as a string i.e.: clm4_0 - and then have the ability to interpret it as different types so you can do logical operations - on physics versions - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/tools/shared/mkmapdata/regridbatch.sh ------- Add ability to run on hopper - M models/lnd/clm/tools/shared/mkmapdata/mkmapdata.sh --------- Add ability to run on hopper/edison - remove jaguarpf, and upgrade to ESMF6.3.0 - M models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.ncl - New version of NCL requires - load before "begin" statement - - M models/lnd/clm/bld/configure ------------- Allow phys=clm5_0 and add in new clm_phys_vers object - M models/lnd/clm/bld/README ---------------- Update info on files - M models/lnd/clm/bld/CLMBuildNamelist.pm --- Put list of required options at top of help, and make envxml_dir - a required option. Add in use of clm_phys_vers object. Make sure use_ed_spitfire is only on if use_ed is - on. If CLM_UPDATE_GLC_AREAS=TRUE and phys=clm4_0 trigger an error - M models/lnd/clm/bld/config_files/config_definition_clm4_5.xml - Add all three physics version options - M models/lnd/clm/bld/config_files/config_definition_clm4_0.xml - Add info. about clm4_5/clm5_0 options - - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl - Add use of clm_phys_vers, and create env_run.xml - on the fly. Also add new tests for glacier update areas, and ED: usespitfireButNOTED, useEDclm40, useEDContradict2 - useEDContradict, clm40andUpdateGlc, clm40andUpdateGlc, UpdateGlcContradict, UpdateGlcNoGLCMe, and tests - for clm5_0 - - M models/lnd/clm/bld/test_build_namelist/t/test_vichydro.pm ----- Needs to use clm_phys_vers object - M models/lnd/clm/bld/test_build_namelist/test_build_namelist.pl - Needs to use clm_phys_vers object - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - urban_hac depends on clm4_5/clm5_0 - --------------- Add phys=clm5_0 for all use-cases that test on phys - M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml - M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - -------------- Fix bugs 1883 (rs over lake) and 1983 (CAM internal compiler error) and 1965 -------------- (janus internal compiler error) - M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 ----- Set rs over lake - M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -------------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 ---------------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 ------ Add use only for ncd_pio - M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -- Add use only for ncd_pio - M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 ----- Add use only for clmtype and dynVarTimeUninterpMod - fixes internal compiler error on janus (1965) - M models/lnd/clm/src/clm4_0/biogeochem/DryDepVelocity.F90 ----- Set rs over lake - M models/lnd/clm/src/clm4_0/main/clm_initializeMod.F90 -------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/main/subgridRestMod.F90 ----------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/main/pftdynMod.F90 ---------------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/main/iniTimeConst.F90 ------------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/main/restFileMod.F90 -------------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/main/surfrdMod.F90 ---------------- Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/biogeophys/UrbanInputMod.F90 ------ Add use only for ncd_pio - M models/lnd/clm/src/clm4_0/biogeophys/BiogeophysRestMod.F90 -- Add use only for ncd_pio - -CLM testing: - - a) regular - b) build_namelist - c) tools - - build-namelist tests: - - yellowstone yes - - regular tests (aux_clm40, aux_clm45, with '-model_gen_comp clm2'): - - yellowstone_intel yes - yellowstone_pgi yes - goldbach_nag yes - goldbach_intel yes - goldbach_pgi yes - - tools testing: - - yellowstone interactive yes - -CLM tag used for the baseline comparisons: clm4_5_72 - -Changes answers relative to baseline: No (bit-for-bit) - -=============================================================== -=============================================================== -Tag name: clm4_5_72 -Originator(s): muszala (Stefan Muszala) -Date: Mon May 5 17:47:52 MDT 2014 -One-line Summary: Introduce code for Ecosystem Demography (CLM(ED)) Model - -Purpose of changes: Introduce code for Ecosystem Demography (CLM(ED)) Model - first functional tag. - -A large chunk of this code was written and re-written by Rosie Fisher. - -"Introduce code for Ecosystem Demography (CLM(ED)) Model. Adds capability to allow plant functional -types to compete for light, to represent recovery from disturbance, and to allow disturbances -(i.e. fire) to only afflict some fraction of the canopy, and to represent vegetation at the scale -of cohorts of trees. Note that this is a large change and includes: - -1. Significant alterations to canopy albedo and surface radiation calculations -2. New photosynthesis scheme, based on existing science but to allow for more complex canopy structure -3. Introduction of a new allocation and growth scheme, (no consistent with that in CLM(CN) -4. Removal, for now, of Nitrogen limitation capabilities -5. Introduction of the SPITFIRE fire model, which interacts with ED via it's representation of - size-structured mortality and removal of litter pools. -6. Introduction of a simple seed bank model to allow persistence of vegetation through fire events. -7. For ED compsets there exists a cohort dimension on the restart files. - -Cold starts and restarts work for the following. The 1x1_brazil is the most heavily tested case both from -science and SE standpoint: - -1x1_brazil.ICLM45CNED.yellowstone_[intel | pgi] -5x5_amazon.ICLM45CNED.yellowstone_[intel | pgi] -1x1_brazil.ICLM45CNED.goldbach_[nag | intel | pgi ] -5x5_amazon.ICLM45CNED.goldbach_[nag | intel | pgi ] - -Cold starts work for: - -f10_f10.ICLM45CNED.yellowstone_[intel | pgi]. -f19_g16.ICLM45CNED.yellowstone_[intel | pgi] - -Code Origins: - -The ED code in CLM is originally based on code by Moorcroft (www.oeb.harvard.edu/faculty/moorcroft/code_and_data/index.html) -and has been heavily modified in regards to both scientific implementation and assumptions. Fom a software engineering -perspective, ED was rewritten from C into F2003 and the structure of the code has been significantly altered to fit into -the CESM/CLM framework. - -The SPITFIRE code is based on (http://www.biogeosciences.net/7/1991/2010/bg-7-1991-2010.pdf) and has been significantly -altered and extended to fit into the CESM/CLM framework. - -Other points: - 1. removed many unused variables and module uses as reported by nag - 2. changing text wrapping on comments so they end at 139 characters - 3. changed many text based logical operators (.ne., .lt., .ge.) with their math. equivlanet (/=, > , <=) - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: ED functionality brought in. Does not change existing -configurations. For ED, there are now a CNED and BGCED compset. Use CNED until BGC issues are worked -out. - -Describe any changes made to the namelist: ED functionality brought in. Does not change existing -configurations. For ED compsets, there are two new namelist variables. They are: - -use_ed = .true. -use_ed_spit_fire = .true. - -use_ed_spit_fire is set to true by default if use_ed is on. Unless you are running our ED tests, you will -have to change your user_nl_clm to something like: - -paramfile ='/glade/p/cesmdata/cseg/inputdata/lnd/clm2/edParams/CLMPARAMS_ED_011514.nc' -finidat = '' -hist_mfilt = 365 -hist_nhtfrq = -24 - -hist_empty_htapes = .true. - -hist_fincl1='NPP','GPP','BTRAN','TOTVEGC','H2OSOI','TLAI','LITTER_IN','LITTER_OUT', -'STORVEGC','FIRE_AREA','SCORCH_HEIGHT','FIRE_INTENSITY','FIRE_TFC_ROS','fire_fuel_mef', -'LITTERC','fire_fuel_bulkd','fire_fuel_sav','FIRE_NESTEROV_INDEX','PFTbiomass', -'PFTleafbiomass','FIRE_ROS','WIND','TFC_ROS','DISPVEGC','AREA_TREES','AREA_PLANT' - -If on goldbach, use: - -paramfile ='/fs/cgd/csm/inputdata/lnd/clm2/edParams/CLMPARAMS_ED_011514.nc' - -List any changes to the defaults for the boundary datasets: N/A. - -Describe any substantial timing or memory changes: - -Code reviewed by: Stefan Muszala and Rosie Fisher. Detailed code review by Bill Sacks, Mariana Vertenstein, -Ben Andre, and Erik Kluzek. Discussion of code review included Dave Lawrence, Forrest Hoffmann -and Ryan Knox. - -List any svn externals directories updated (csm_share, mct, etc.): - -Changed externals to a branch_tag that supports ED compsets. We are using branch_tags because trunk -scripts does not work with all of the current CLM tests: - --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/add_dynlu_tests_tags/add_dynlu_tests_n03_scripts4_140305 -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/ED_scripts_tags/ED_scripts_015_140305_rev - -List all files eliminated: N/A - -List all files added and what they do: - -### SPITFIRE code -# new SPITEFIRE directory -A + models/lnd/clm/src/clm4_5/main/spitfireSF -# main SPITFIRE code -A + models/lnd/clm/src/clm4_5/main/spitfireSF/SFParamsMod.F90 -# handle SPITFIRE parameters -A + models/lnd/clm/src/clm4_5/main/spitfireSF/SFMainMod.F90 - -# pull out, move to a shared location, place in own module -A + models/lnd/clm/src/util_share/quadraticMod.F90 - -### new source and directories for ED -## ED code required for biogeophysics -# ED directory in biogeophys -A + models/lnd/clm/src/clm4_5/biogeophys/ED -# Calculates daily carbon flux drivers from hourly calculations. -A + models/lnd/clm/src/clm4_5/biogeophys/ED/EDAccumulateFluxesMod.F90 -# Calculates absorbed, reflected and transmitted radiation in diffuse and direct streams for -# each of the canopy layer x PFT x leaf layer three-dimensional matrix. Uses iterative Norman -# radiation transfer scheme. -A + models/lnd/clm/src/clm4_5/biogeophys/ED/EDSurfaceAlbedoMod.F90 -# Main photosynthesis model. Calculates leaf level fluxes on a canopy layer x PFT x leaf layer -# three-dimensional matrix. Sums to canopy to produce overall canopy conductance. Unpacks leaf- -# level fluxes into cohort level fluxes. Uses same scientific assumptions as CLM4.5. -A + models/lnd/clm/src/clm4_5/biogeophys/ED/EDPhotosynthesisMod.F90 -# Generates PFT specific BTRAN vector for each ED patch. Includes option for SPA-like calculations. -A + models/lnd/clm/src/clm4_5/biogeophys/ED/EDBtranMod.F90 - -## ED code required for biogeochemistry -# ED directory in biogeochem -A + models/lnd/clm/src/clm4_5/biogeochem/ED -# Determines which cohorts are in the upper and lower canopy layers. Sets leaf area index inputs to biogeophysics calculations. -A + models/lnd/clm/src/clm4_5/biogeochem/ED/EDCanopyStructureMod.F90 -# Initializes some ED-specific variables to zero at startup. -A + models/lnd/clm/src/clm4_5/biogeochem/ED/EDSetValuesMod.F90 -# Contains allometric relationships between vegetation properties (height, dbh, LAI, dead biomass, live biomass, crown area) biogeochem/ED/EDPatchDynamicsMod.F90 : Creates patches, fuses similar patches, controls disturbance and generation of area. -A + models/lnd/clm/src/clm4_5/biogeochem/ED/EDGrowthFunctionsMod.F90 -# Creates, fuses, terminates, sorts, counts and copies cohort structures. -A + models/lnd/clm/src/clm4_5/biogeochem/ED/EDCohortDynamicsMod.F90 -# Contains all calculations of derivatives of biomass, litter and seed pools. Also includes phenology model, seed and litter production and decay models, and canopy optimization model. -A + models/lnd/clm/src/clm4_5/biogeochem/ED/EDPhysiologyMod.F90 -# Creates, fuses, terminates, sorts, counts and copies patch structures. -A + models/lnd/clm/src/clm4_5/biogeochem/ED/EDPatchDynamicsMod.F90 - -## ED core functionality and types that interact with CLM (generally not science) -# ED directory in main -A + models/lnd/clm/src/clm4_5/main/ED -# Transmits required information for CLM (tlai, htop, tile weights). Updates ED-specific history field variables. -A + models/lnd/clm/src/clm4_5/main/ED/EDCLMLinkMod.F90 -# Initializes ED PFT parameter structure. -A + models/lnd/clm/src/clm4_5/main/ED/EDInitTimeConst.F90 -# Contains ED-specific variables for CLM -A + models/lnd/clm/src/clm4_5/main/ED/EDClmType.F90 -# Adds history field variables specific to ED to history file. -A + models/lnd/clm/src/clm4_5/main/ED/EDHistFldsMod.F90 -# Prints out and reads in ED state vector to/from history files. -A + models/lnd/clm/src/clm4_5/main/ED/EDRestVectorMod.F90 -# Initializes ED-specific variables for CLM -A + models/lnd/clm/src/clm4_5/main/ED/EDClmTypeInitMod.F90 -# Allocates ED PFT specific variables. -A + models/lnd/clm/src/clm4_5/main/ED/EDPftvarcon.F90 -# Initializes ED site, patch and cohort structures, either to restarting or bare ground values. -A + models/lnd/clm/src/clm4_5/main/ED/EDInitMod.F90 -# Allocates and initializes ED parameters (that are not PFT specific). -A + models/lnd/clm/src/clm4_5/main/ED/EDParamsMod.F90 -# Main ED model routine. Calls all other daily ED dynamics, integrates variables, checks carbon balance. -A + models/lnd/clm/src/clm4_5/main/ED/EDMainMod.F90 -# Contains ED type structures (cohort, site, patch) and static values. -A + models/lnd/clm/src/clm4_5/main/ED/EDTypesMod.F90 - -# utility routine to help in reading parameter files -A + models/lnd/clm/src/clm4_5/main/paramUtilMod.F90 -# transfers weights calculated internally by ED into wtcol. -A + models/lnd/clm/src/clm4_5/dyn_subgrid/dynEDMod.F90 - -List all existing files that have been modified, and describe the changes: - -### build modifications -# add ED source directories for build -M models/lnd/clm/bld/configure -# build namelist additions for ED -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -# setup_cmdl_ed_mode addition. sets namelist vars -M models/lnd/clm/bld/CLMBuildNamelist.pm - -### util_share modifications -# add function is_beg_curr_day() -M models/lnd/clm/src/util_share/clm_time_manager.F90 -# modify get_proc_bounds to include beg, end cohort -M models/lnd/clm/src/util_share/accumulMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/util_share/ncdio_pio.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/util_share/ncdio_pio.F90.in - -### 4_5 Modifications -# change text based logical with math style (.gt. to >, .ne. to /=) -# modify get_proc_bounds to include beg, end cohort -M models/lnd/clm/src/clm4_5/biogeochem/CNRestMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNInitMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -# move some variables from stack to heap. -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeBGCMod.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -# change spacing, text wrapping -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeCNMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 - -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/main/initInterp.F90 -# change spacing, text wrapping -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -# add call to call EDInitTimeConst -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/main/initTimeConstMod.F90 -# add decomposition for cohort dimension -M models/lnd/clm/src/clm4_5/main/decompInitMod.F90 -# add call for ed_init -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -# add code for cohort dimension -M models/lnd/clm/src/clm4_5/main/subgridMod.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/main/initColdMod.F90 -# change get_proc_global to support cohort dimension -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -# add use_ed logical to support cohort dimension -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -# broadcast ed namelist variables -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -# use_ed logical to call edmodel -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -# change spacing, text wrapping -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -# clean up unsued variables from nag compiler warnings -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -# add routine set_cohort_decomp -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -# change spacing, text wrapping -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 -# add support for cohort dimension -M models/lnd/clm/src/clm4_5/main/decompMod.F90 -# change spacing, text wrapping -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -# add call to read ED and SPITFIRE params -R + models/lnd/clm/src/clm4_5/main/readParamsMod.F90 -# add routine set_cohort_decomp -# add use_ed logical(s) -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 - -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/SLakeInitMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -# change get_proc_global to support cohort dimension -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -# change get_proc_global to support cohort dimension -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -# change get_proc_global to support cohort dimension -M models/lnd/clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 -# change get_proc_global to support cohort dimension -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -# change spacing, text wrapping -# add use_ed logical(s) -# calculate ed root fractionation -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -# add use_ed logical(s) for forc_solai and parsun -# use_ed reporting -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -# add use_ed logical(s) for norman_radiation -# change spacing -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -# remove unused variable -M models/lnd/clm/src/clm4_5/biogeophys/SLakeCon.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -# change text based logical with math style (.gt. to >, .ne. to /=) -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -# add use_ed logical(s) for call dyn_ED -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 - -### 4_0 Modifications -# add optional cohort argument for new ED dimension to get_proc_global and -# get_proc_bounds_old for 40 backward compatibility -M models/lnd/clm/src/clm4_0/main/decompMod.F90 - -CLM testing: - ---SNICARFRC - moved ERI_D.T31_g37.ICLM45.goldbach_nag.clm-SNICARFRC to goldbach and nag. This is a BFAIL. - ---Testing for new ED compsets. All compare hist portions were BFAIL's since this is the first time -the tests are being put in place. - ---ED and yellowstone [ intel | pgi ] - PASS ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.yellowstone_[intel | pgi].clm-edTest - PASS SMS.f10_f10.ICLM45CNED.yellowstone_[intel | pgi].clm-edTest - PASS SMS.f19_g16.ICLM45CNED.yellowstone_[intel | pgi].clm-edTest - PASS SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.yellowstone_[intel | pgi].clm-edTest - ---ED and goldbach [nag | intel | pgi ] - PASS ERS_D_Mmpi-serial.1x1_brazil.ICLM45CNED.goldbach_[nag | intel | pgi ].clm-edTestGb - PASS SMS_D_Mmpi-serial.5x5_amazon.ICLM45CNED.goldbach_[nag | intel | pgi ].clm-edTestGb - ---CLM history file comparison: - -yellowstone [intel | pgi] - OK - -I ran without the -model_gen_comp option, but ran component_gen_comp and summarize_cprnc_diffs -by hand for both yellowstone_intel and yellowstone_pgi. These are both OK - ---Regular tests (aux_clm testlist) - - yellowstone_intel - OK - yellowstone_pgi - OK - goldbach_nag - OK - goldbach_intel - OK - goldbach_pgi - OK - -CLM tag used for the baseline comparisons: clm4_5_71 - -Changes answers relative to baseline: No. Existing compsets do not change. -If you run with an *ED* compset, then results will differ, but that is expected. - -=============================================================== -=============================================================== -Tag name: clm4_5_71 -Originator(s): Bill Sacks & Jeremy Fyke -Date: Fri May 2 13:00:10 MDT 2014 -One-line Summary: 2-way feedbacks for glacier, veg columns compute glacier SMB, and related changes - -Purpose of changes: - - (1) Bring in two-way feedbacks for glacier when coupled to CISM, via dynamic - landunits, so that CLM's glacier area remains consistent with CISM's - glacier area. Also update CLM's glacier topography to be consistent with - CISM. - - (2) Add an elevation class "0", which provides surface mass balance over the - vegetated portion of the grid cell. This is used to achieve glacial - inception in CISM. Along with this change, also (a) set the topographic - height of non-glacier areas based on bare land topography from CISM, and - (b) change the downscaling of atmospheric fields so that they are also - downscaled over vegetated columns within CISM's ice mask, to achieve - greater consistency between what's happening in the glacier and vegetated - portions of CISM's domain. (Note that, because longwave radiation is - normalized, downscaling it over the vegetated column also changes answers - over glacier columns.) These changes were primarily from Jeremy Fyke. - - (3) Rework some consistency checks to play nicely with dynamic landunits. - - (4) Rework unit test build to use libraries for the clm source and csm_share source - - (5) Misc. other changes, as noted below. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 1969 (incorrect values for QSNWCPICE_NODYNLNDUSE) - - 1929 (dynFileMod breaks with gfortran 4.8) - - 1832 (logic for weights error check differs between clm4.0 and clm4.5) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - -Describe any changes made to the namelist: - -List any changes to the defaults for the boundary datasets: - -Describe any substantial timing or memory changes: - -Code reviewed by: - -List any svn externals directories updated (csm_share, mct, etc.): - -========= Add tests --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_140305 -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/branch_tags/add_dynlu_tests_tags/add_dynlu_tests_n03_scripts4_140305 - -========= Pull in Machines_140318, needed for goldbach --scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/branch_tags/arfs_tags/arfs_01_mach140218 -+scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/branch_tags/arfs_tags/arfs_02_mach140218 - -========= Changes needed for elevation class 0, etc. --models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_07 -+models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_10 --models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_140416 -+models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_140501 - - -List all files eliminated: - -========= Point to real decompMod rather than mock -D models/lnd/clm/test/unit_testers/clm4_5/mock/main/decompMod_boundsTypeDecl.F90 - -List all files added and what they do: - -========= Most of reweightMod.F90 moved here; also includes the following changes: - (1) renames some subroutines - (2) adds some diagnostic fields that are written to the history file - (3) adds some utility routines such as get_landunit_weight -A models/lnd/clm/src/clm4_5/main/subgridWeightsMod.F90 - -========= Add code to initialize newly-active columns -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynInitColumnsMod.F90 - -========= New unit tests -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynInitColumns_test/test_init_columns.pf -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynInitColumns_test/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynInitColumns_test - -========= Need new mocks and new real files now that we use the real decompMod, and also because of endrun calls -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/GetGlobalValuesMod_mock.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/mct_mod_mock.F90 -A models/lnd/clm/src/util_share/CMakeLists.txt - -========= Need stub histFileMod now that many modules include calls to hist_addfld -A models/lnd/clm/test/unit_testers/clm4_5/mock/main/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/mock/main/histFileMod_mock.F90 - -List all existing files that have been modified, and describe the changes: - -========= Update glacier cover and topographic heights based on values from CISM; rework - code to accommodate icemask and elevation class 0 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/cpl/clm_cpl_indices.F90 -M models/lnd/clm/src/cpl/lnd_import_export.F90 - -========= Change to be consistent with clm4_5 version, adding elevation class 0 and - x2s%icemask (neither of which are used in the clm4_0 version) -M models/lnd/clm/src/clm4_0/main/clm_glclnd.F90 - -========= Add glc_do_dynglacier namelist option, which triggers off of - CLM_UPDATE_GLC_AREAS; rename glc_dyntopo to glc_dyn_runoff_routing and make it - also trigger off of CLM_UPDATE_GLC_AREAS; add glc_snow_persistence_max_days; add - dynpft_consistency_checks and finidat_consistency_checks groups -M models/lnd/clm/bld/user_nl_clm -M models/lnd/clm/bld/CLMBuildNamelist.pm -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -M models/lnd/clm/bld/unit_testers/env_run.xml -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 - - also use parameter for file name length, so that other modules can - ensure consistency of char length - -========= Add functions to convert between col%itype and icemec class; also add - landunit_names vector -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 - -========= Add functions add_landunit, add_column, add_patch (cleans up this code, and will - assist with setting up unit tests) and use new functions from clm_varcon -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 - -========= Use new functions from initGridCellsMod -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90 - -========= Remove old consistency checks for restart file, add new ones (these changes are - needed so that consistency checks work right with dynamic landunits, and we're - adding some new consistency checks that weren't in place before) -M models/lnd/clm/src/util_share/clm_time_manager.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90.in -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 - - also read all subgrid weights and glc topo on restart - (some of these used to be read in BiogeophysRestMod; - we need all of them with dynamic landunits) - - also remove redundant mcdate, mcsec - - also add icemask restart variable -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 - - also remove redundant PFT_WTGCELL, PFT_WTLUNIT, PFT_WTCOL - (equivalent variables are already output by subgridRestMod) - - also add snow_persistence - -========= Remove old consistency checks for pftdyn file, add new ones - (these changes are needed so that consistency checks work right with dynamic landunits) -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 - - also call init_subgrid_weights_mod, put call to update_clm_s2x in - loop over clumps, and move deallocation of topo_glc_mec to later -M models/lnd/clm/src/clm4_5/main/clm_varsur.F90 -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 - -========= Add new dimensions for multi-level fields - for subgrid weight diagnostics; add - a dimension to accommodate fields dimensioned by glc_nec+1 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 - -========= Call new routines (update_clm_x2s, set_subgrid_diagnostic_fields, initialize_new_columns) -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Make various code operate over veg as well as icemec columns -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - - also put call to update_clm_s2x in a loop over clumps -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 - - also compute snow_persistence, and rework some code for clarity - -========= Add initialization of icemask & snow_persistence; change - initialization of glc_topo and h2osno -M models/lnd/clm/src/clm4_5/main/initColdMod.F90 - -========= Add l2g_scale_type = natveg -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 - -========= Fix QSNWCPICE_NODYNLNDUSE, add l2g_scale_type for QICE & related fields, add - SNOW_PERSISTENCE and ICE_MASK, change _FORC fields to include elevation class 0 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 - -========= Get rid of associate statement that caused problems with some compilers -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynFileMod.F90 - -========= Track old col%active values, needed for initializing new columns -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynPriorWeightsMod.F90 - -========= Moved most functionality to subgridWeightsMod.F90 (now just a small - wrapper to some of the stuff in subgridWeightsMod, whose main purpose - is to avoid a dependency of subgridWeightsMod on filterMod) -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -========= Changes for unit tests: - (1) Update unit tests to use libraries for the clm source and csm_share source - (2) New unit test - (3) Make unit tests work with latest CLM trunk - (4) Point to real decompMod rather than mock -M models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_var.F90 -M models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_var.F90.in -M models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/spmdMod_mock.F90 -M models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/shr_sys_mod_mock.F90 -M models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/mock/main/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/mock/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/CMakeLists.txt -M models/lnd/clm/src/clm4_5/main/CMakeLists.txt -M models/lnd/clm/src/clm4_5/dyn_subgrid/CMakeLists.txt - -========= Add icemask & snow_persistence; remove unused glc_frac, glc_rofi & glc_rofl -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - -========= Minor changes to 'use' statements for the sake of breaking dependencies for unit tests -M models/lnd/clm/src/util_share/GetGlobalValuesMod.F90 -M models/lnd/clm/src/clm4_5/main/decompMod.F90 - -========= Changes to comments only -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/util_share/domainMod.F90 - -========= Remove no-longer-failing test, change failType of a test (it was RUN - rather than FAIL at least as far back as clm4_5_69) -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - regular tests - - NOTE: Most tests were done on bare_land_smb_n15_clm4_5_70, which did NOT - include r59820 (add a comma in histFileMod to fix a syntax error caught by - nag). After r59820, reran all goldbach_nag tests, plus one goldbach_pgi and - one goldbach_intel. - - yellowstone_intel: ok - yellowstone_pgi: ok - goldbach_nag: ok - goldbach_intel: ok - goldbach_pgi: ok - - component_gen_comp on yellowstone_intel & yellowstone_pgi: ok - -CLM tag used for the baseline comparisons: clm4_5_69 (clm4_5_68 for a few tests - with missing baselines in clm4_5_69) - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All IG compsets (i.e., GLC compsets) - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - New Climate - - Changes are: - - (1) All IG compsets (clm4.0 & clm4.5) change due to new CISM external - - (2) In addition, IG compsets with CLM4.5 change further due to: - (a) 2-way feedbacks (CLM updated to match CISM) - (b) downscaling done over vegetated landunits within the icemask - - (3) Also, the QSNWCPICE_NODYNLNDUSE history diagnostic field changes for - ALL CLM4.5 runs, due to fixing bug 1969. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_70 -Originator(s): muszala (Stefan Muszala) -Date: Fri Apr 18 08:24:44 MDT 2014 -One-line Summary: bring in SHR_ASSERT macros - -Purpose of changes: bring in SHR_ASSERT macros for Santos. - -Add: #include "shr_assert.h" to source files -Remove: use shr_assert_mod , only : shr_assert - -then replace "call shr_assert" with SHR_ASSERT_ALL when asserting more than one dim - -- call shr_assert((ubound(carr) == (/bounds%endc/)), errMsg(__FILE__, __LINE__)) -+ SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp/)), errMsg(__FILE__, __LINE__)) - -and use SHR_ASSERT when asserting one dimen - -- call shr_assert(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(__FILE__, __LINE__)) -+ SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(__FILE__, __LINE__)) - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Self, Santos, Sacks - -List any svn externals directories updated (csm_share, mct, etc.): - --scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_140218 -+scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/branch_tags/arfs_tags/arfs_01_mach140218 - --scripts/ccsm_utils/CMake https://github.com/quantheory/CMake_Fortran_utils/tags/CMake_Fortran_utils_140109 -+scripts/ccsm_utils/CMake https://github.com/quantheory/CMake_Fortran_utils/tags/CMake_Fortran_utils_140403 - --models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_34 -+models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_37 - --models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_140303 -+models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_140416 - --models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_131231 -+models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/branch_tags/shr_assert_macro_tags/shr_assert_macro_n04_share3_140115 - --models/utils/mct https://github.com/quantheory/MCT/tags/compiler_fixes_n03_MCT_2.8.3 -+models/utils/mct https://github.com/quantheory/MCT/tags/compiler_fixes_n04_MCT_2.8.3 - --models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_8_9/pio -+models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_8_11/pio - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/DaylengthMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BandDiagonalMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynTimeInfoMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90.in -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90.in -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90.in -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynPriorWeightsMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynConsBiogeophysMod.F90 - -M SVN_EXTERNAL_DIRECTORIES - -CLM testing: - -Tested with two sets of externals because: - -The old scripts do not allow any PGI tests to run while the new scripts have various issues -with ERI tests and selected PGI tests plus nag debug runs (fixed in a more recent machines tag). - -By running with two sets of externals, I am confident that the source mods for SHR_ASSERT are -working correctly. When CLM gets updates in scripts and machines, these will be updated in -later tags. - -I) Those included in this tag -II) Those that are a part of cesm1_3_alpha09b (only tested clm45). - - build-namelist tests: N/A - - regular tests: for (I) above: - - yellowstone_intel - OK - component_comp_gen - OK - goldbach_nag - OK - goldbach_intel - OK - - regular tests: for (II) above: - -1) Yellowstone + Intel : all ERI tests are completing ref1 and ref2 but die a silent death in the base case. Erik looks like you changed Testlists, so the two VIC tests might be expected. - ->>./cs.status.70Intel.yellowstone | grep -v CLM50 | grep -v PASS | grep -v tputcomp | grep -v ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay | grep -v ERS_D.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay | grep -v ERS_Ld211_D_P112x1.f10_f10.ICNCROP -RUN ERI.f09_g16.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI.f10_f10.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI.f19_g16.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_D.T31_g37.ICLM45.yellowstone_intel.clm-SNICARFRC.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_D.f09_g16.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_D.f10_f10.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_D.f19_g16.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -RUN ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.GC.70Intel --- ref1 and ref2 run, then no output in non-ref run -FAIL ERS_D.f10_f10.ICLM45VIC.yellowstone_intel.clm-vrtlay.GC.70Intel.compare_hist.clm4_5_69 - 69 Comparing hist file with baseline hist file, /glade/scratch/muszala/ERS_D.f10_f10.ICLM45VIC.yellowstone_intel.clm-vrtlay.GC.70Intel/run/ERS_D.f10_f10.ICLM45VIC.yellowstone_intel.clm-vrtlay.GC.70Intel.cpl.hi.0001-01-12-00000 .nc /glade/p/cesmdata/cseg/ccsm_baselines/clm4_5_69/ERS_D.f10_f10.ICLM45VIC.yellowstone_intel.clm-vrtlay/cpl.hi.nc - 70 ncdump1 done - 71 ncdump2 done - 72 comparing split files x[a-z][a-z] - 73 xaa - 74 6979,6981c6979,6981 < 0.983149585541109, 0.972017300931466, 0.972017300784614, < 0.972017300929172, 0.964088275988772, 0.971373805810303, < 0.977583443108289, 0.983149585551217, 0.983149585568791, --- - 75 FAIL - 76 hist file comparison is FAIL -FAIL SMS.f19_g16.ICLM45VIC.yellowstone_intel.clm-default.GC.70Intel.compare_hist.clm4_5_69 - 60 /glade/u/spooldir/1397689222.575650.shell: Storing new baseline in /glade/p/cesmdata/cseg/ccsm_baselines/clm4_5_70/SMS.f19_g16.ICLM45VIC.yellowstone_intel.clm-default - 61 Comparing hist file with baseline hist file, /glade/scratch/muszala/SMS.f19_g16.ICLM45VIC.yellowstone_intel.clm-default.GC.70Intel/run/SMS.f19_g16.ICLM45VIC.yellowstone_intel.clm- default.GC.70Intel.cpl.hi.0001-01-06-00000.n c /glade/p/cesmdata/cseg/ccsm_baselines/clm4_5_69/SMS.f19_g16.ICLM45VIC.yellowstone_intel.clm-default/cpl.hi.nc - 62 ncdump1 done - 63 ncdump2 done - 64 comparing split files x[a-z][a-z] - 65 xad - 66 18300c18300 < 0.983410370293909, 0.984052369383093, 0.979227772964994, --- > 0.983410370293909, 0.984052369383093, 0.979228345951215, 18341,18350c18341,18350 - 67 FAIL - 68 hist file comparison is FAIL - -2) Goldbach + NAG seems to have passed OK, _D runs have failed as expected. The reporting is messed up...ie., TestStatus.out look OK, but TestStatus does not. - ->> ./cs.status.70nag.goldbach | grep -v CLM50 | grep -v PASS | grep -v tputcomp | grep -v _D -FAIL ERI.f10_f10.ICLM45BGC.goldbach_nag.clm-reduceOutput.GC.70nag ---look at /scratch/cluster/muszala/tests/ERI.f10_f10.ICLM45BGC.goldbach_nag.clm-reduceOutput.GC.70nag/TestStatus.out and there is no FAIL -FAIL ERI.f19_g16.ICLM45BGC.goldbach_nag.clm-reduceOutput.GC.70nag ---/scratch/cluster/muszala/tests/ERI.f19_g16.ICLM45BGC.goldbach_nag.clm-reduceOutput.GC.70nag and there is no FAIL - -3) Goldbach + Intel - these look all like passes to me: see /scratch/cluster/muszala/tests/*/TestStatus.out - ->> ./cs.status.70intel.goldbach | grep -v CLM50 | grep -v PASS | grep -v tputcomp -FAIL ERI.f10_f10.ICLM45BGC.goldbach_intel.clm-reduceOutput.GC.70intel --- Shows FAIL but PASSes in TestStatus.out -FAIL ERI.f19_g16.ICLM45BGC.goldbach_intel.clm-reduceOutput.GC.70intel --- Shows FAIL but PASSes in TestStatus.out -FAIL ERI_D.T31_g37.I1850CLM45.goldbach_intel.clm-reduceOutput.GC.70intel --- Shows FAIL but PASSes in TestStatus.out -FAIL ERI_D.f10_f10.ICLM45BGC.goldbach_intel.clm-reduceOutput.GC.70intel --- Shows FAIL but PASSes in TestStatus.out -FAIL ERI_D.f19_g16.ICLM45BGC.goldbach_intel.clm-reduceOutput.GC.70intel --- Shows FAIL but PASSes in TestStatus.out - -4) Goldbach + PGI - some are indicating FAIL with TestStatus.out shows PASSes, others are straight out FAILs - -./cs.status.70pgi.goldbach | grep -v CLM50 | grep -v PASS | grep -v tputcomp | grep -v SMS_Ly1.f19_g16.ICLM45BGCCROP.frankfurt_pgi -FAIL ERI.f10_f10.ICLM45BGC.goldbach_pgi.clm-reduceOutput.GC.70pgi --- Shows FAIL but PASSes in TestStatus.out -FAIL ERI.f19_g16.ICLM45BGC.goldbach_pgi.clm-reduceOutput.GC.70pgi --- ref1 fail: - 22 g005.cgd.ucar.edu - daemon did not report back when launched - 23 g006.cgd.ucar.edu - daemon did not report back when launched - 24 g009.cgd.ucar.edu - daemon did not report back when launched - 25 /usr/mpi/pgi/openmpi-1.4.3-qlc/bin/orted: error while loading shared libraries: libpgc.so: cannot open shared object file: No such file or directory -FAIL ERI_D.f10_f10.ICLM45BGC.goldbach_pgi.clm-reduceOutput.GC.70pgi --- Shows FAIL but PASSes in TestStatus.out -FAIL ERI_D.f19_g16.ICLM45.goldbach_pgi.clm-reduceOutput.GC.70pgi --- ref1 fail: - 1 /usr/mpi/pgi/openmpi-1.4.3-qlc/bin/orted: error while loading shared libraries: libpgc.so: cannot open shared object file: No such file or directory - 2 /usr/mpi/pgi/openmpi-1.4.3-qlc/bin/orted: error while loading shared libraries: libpgc.so: cannot open shared object file: No such file or directory - 3 /usr/mpi/pgi/openmpi-1.4.3-qlc/bin/orted: error while loading shared libraries: libpgc.so: cannot open shared object file: No such file or directory - 4 -------------------------------------------------------------------------- - 5 A daemon (pid 29755) died unexpectedly with status 127 while attempting -FAIL ERI_D.f19_g16.ICLM45BGC.goldbach_pgi.clm-reduceOutput.GC.70pgi --- ref1 fail: - 23 g021.cgd.ucar.edu - daemon did not report back when launched - 24 g022.cgd.ucar.edu - daemon did not report back when launched - 25 g023.cgd.ucar.edu - daemon did not report back when launched - 26 /usr/mpi/pgi/openmpi-1.4.3-qlc/bin/orted: error while loading shared libraries: libpgc.so: cannot open shared object file: No such file or directory -FAIL SMS_Ld5.f19_g16.IRCP45CLM45BGC.goldbach_pgi.clm-decStart.GC.70pgi --- ERROR in /var/spool/torque/mom_priv/jobs/19500.goldbach.cgd.ucar.edu.SC: file /fs/cgd/csm/ccsm_baselines/clm4_5_69/SMS_Ld5.f19_g16.IRCP45CLM45BGC.goldbach_pgi.clm-decStart/cpl.hi.nc does not exist - -CLM tag used for the baseline comparisons: clm4_5_69 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_69 -Originator(s): andre (Benjamin Andre,LAWRENCE BERKELEY NATIONAL LABORATORY,510-486-4617) -Date: Tue Mar 18 21:12:34 MDT 2014 -One-line Summary: start unit testing build-namelist - -Purpose of changes: start doing unit testing on construction of the clm namelist. -This involved moving the contents of build-namelist into CLMBuildNamelist.pm and -bringing in perl infrastructure to supplement Test::More. Initial test suites are -implented for several name list variables. - -Requirements for tag: N/A - -Test level of tag: regular, build_namelist - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, clm-cmt - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: - - models/lnd/clm/bld: - CLMBuildNamelist.pm - contents of build-namelist - test_build_namelist/perl5lib/* - CPAN modules needed for unit testing - test_build_namelist/t/input/* - mock input files for build-namelist tests - test_build_namelist/t/template_test_XXX.pm - template for new tests - test_build_namelist/t/test_*.pm - unit tests - test_build_namelist/test_build_namelist.pl - unit test driver - test_build_namelist/README - -List all existing files that have been modified, and describe the changes: - - models/lnd/clm/bld: - build-namelist - moved contents into CLMBuildNamelist.pm, now just a driver calling main function. - - -CLM testing: - - build-namelist tests: - - yellowstone - OK new and existing generate tests - goldbach - OK new and existing generate tests - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - goldbach_nag - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: N/A - - short tests (aux_clm_short): - - yellowstone_intel - OK - yellowstone_pgi - OK - - tools testing: N/A - -CLM tag used for the baseline comparisons: clm4_5_68 - -Changes answers relative to baseline: No - - -=============================================================== -=============================================================== -Tag name: clm4_5_68 -Originator(s): erik (Erik) -Date: Fri Mar 7 16:43:23 MST 2014 -One-line Summary: Update scripts to version that turns on transient CO2 streams for - transient compsets, and update CISM (changes answers) - -Purpose of changes: - -Bring in the scripts version that by default had transient CO2 for any transient -compsets. You can still turn it off by setting DATM_CO2_TSERIES=FALSE in env_run.xml. -Also bring in the latest CISM version that has answer changes for any IG compsets. -It fixes fields sent from CISM to the coupler (fixes an exact restart problem). - -Requirements for tag: - update scripts and CISM, transient and IG compsets have different answers - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 979 (adding CO2 streams) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - scripts to scripts4_140305 - cism to cism1_140303 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: None - -CLM testing: - - build-namelist tests: - - yellowstone yes - - regular tests (aux_clm): - - yellowstone_intel yes - yellowstone_pgi yes - goldbach_nag yes - goldbach_pgi yes - goldbach_intel yes - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel yes - yellowstone_pgi yes - - tools testing: None - -CLM tag used for the baseline comparisons: clm4_5_67 - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers: - - what code configurations: transient and IG compsets - - what platforms/compilers: all - - nature of change: larger than roundoff - -=============================================================== -=============================================================== -Tag name: clm4_5_67 -Originator(s): mvertens -Date: Thu Mar 6 16:53:23 MST 2014 -One-line Summary: removed initSurfAlb as part of the initialization - -Purpose of changes: removed the call to initSurfAlb as well as part of - the initialization and also removed the routine from the clm4.5 - code base - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): None - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -M bld/namelist_files/namelist_defaults_clm4_5.xml - - clmi.ICRUCLM45BGCCROPmp24.0241-01-01.10x15_USGS_simyr2000_c140111.nc had not - in fact been created - this effected the PEM test in the goldbach clm45 test suite - - the default namelist has not been backed up to the original - clmi.ICRUCLM45BGCCROPmp24.0241-01-01.10x15_USGS_simyr2000_c131028.nc - for now - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: mvertens - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -M src/clm4_5/biogeochem/ch4InitMod.F90 - - removal of code block that is no longer needed due to removal of initSurfAlb - (this had already been commented out in clm4_5_66) - -M src/clm4_5/main/initInterp.F90 - - minor bug fix the turn off spval by default for nonactive points - -D src/clm4_5/main/initSurfAlbMod.F90 -M src/clm4_5/main/clm_initializeMod.F90 - - removal of call initSurfAlb (main purpose of this tag) - - removal of code to upgrade old initial data files to have new metadata - a new scheme should be put in place with a namelist option to take clm4.5 - restart datasets that have been created prior to the introduction of initInterp - and introduce the new metadata at run time - -M src/clm4_5/main/initColdMod.F90 - - had to introduce setting values for the following variables in order to remove - call to initSurfAlb - cps%albgrd_pur(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgri_pur(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgrd_bc(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgri_bc(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgrd_oc(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgri_oc(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgrd_dst(bounds%begc:bounds%endc,:) = 0.2_r8 - cps%albgri_dst(bounds%begc:bounds%endc,:) = 0.2_r8 - -M src/clm4_5/main/clm_driver.F90 - - just comments - -CLM testing: - - regular tests (aux_clm): OK means only failures were expected - - yellowstone_intel : OK - yellowstone_pgi : OK - goldbach_nag : OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi : OK - -CLM tag used for the baseline comparisons: clm4_5_66 - -Changes answers relative to baseline: some - for all compsets where - finidat is set to blank, then answers will change relative to baseline - - for all compsets wehre finidat is pointing to a dataset, answers will be bfb - compared to baseline - -=============================================================== -=============================================================== -Tag name: clm4_5_66 -Originator(s): mvertens -Date: Mon Mar 3 10:50:24 MST 2014 -One-line Summary: refactoring of initialization and introduction of run-time finidat interpolation - -Purpose of changes: refactoring of initialization and introduction of run-time finidat interpolation - -Completely rewrote clm_initialize to leverage new initialization scheme -In the new scheme, cold start initialization is ALWAYS called and values -are overwritten by either an appropriate finidat file OR by calling -finidat_interp to interplate finidat to the output resolution/mask. - -Requirements for tag: - -Test level of tag: regular, short, tools, build_namelist, doc - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - - 1930 (MEGAN does not work correctly with prognostic crops on) - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - - NONE - -Describe any changes made to the namelist: - - - ALL clm4.5 finidat files have been updated to contain new metadata that will enable the - online interpinic to operate on them. The time stamp on all new files has the date c140111. - The files have been created so that they are bit-for-bit compatible with the code base. - - The following new namelist variables have been added to the namelist_definition_clm4_5.xml file - - finidat_interp_source - if non-blank, then interpinic will be called to interpolate finidat_interp_source and - create output file specified by finidat_interp_dest. - - finidat_interp_dest - if finidat_interp_source is set to non-blank, then interpinic will be called - to interpolate finidat_interp_source and create output file finidat_interp_dest - -List any changes to the defaults for the boundary datasets: - - None - -Describe any substantial timing or memory changes: - - None - -Code reviewed by: - - mvertens, sacks - -List any svn externals directories updated (csm_share, mct, etc.): - - None - -List all files eliminated: - - The following file pairs were renamed and subsequently extensively modfified - Summaries of the modifications are below: - - ------- New module initColdMod.F90 contains calls to initialize the cold start for - ------- the entire model. The cold start values are then overwritten with either - ------- an finidat file or an interpolation file using finidat_interp_source. -D models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -A models/lnd/clm/src/clm4_5/main/initColdMod.F90 - - ------- Renamed file -D models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -A models/lnd/clm/src/clm4_5/biogeochem/SatellitePhenologyMod.F90 - - ------- Renamed file -D models/lnd/clm/src/clm4_5/biogeochem/CNDVEcosystemDynIniMod.F90 -A models/lnd/clm/src/clm4_5/biogeochem/CNDVInitMod.F90 - - ------- Renamed file, removed initch4, merged routines initTimeConst_ch4 and makearbinit_ch4 - --------into new routine initColdCH4.Also removed almost all associate statements - ------- (but kept the intput/output documentation) and used the explicit clmtype definition. -D models/lnd/clm/src/clm4_5/biogeochem/initch4Mod.F90 -A models/lnd/clm/src/clm4_5/biogeochem/ch4InitMod.F90 - - ------- Renamed and combined files - ------- Migrated all CN cold start initialization for both soil and - ------- special landuntis into new routine initColdCN in new module biogeochem/CNInitMod. -D models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -D models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -A models/lnd/clm/src/clm4_5/biogeochem/CNInitMod.F90 - - ------- Renamed file and merged routines makearbinit and snow_depth2Lake - ------- into one new routine initColdSlake. Also removed almost all associate - ------- statements (but kept the intput/output documentation) and used the explict - ------- clmtype definition. -A models/lnd/clm/src/clm4_5/biogeophys/SLakeInitMod.F90 -D models/lnd/clm/src/clm4_5/biogeophys/initSlakeMod.F90 - - ------- Renamed iniTimeConst, removed associate statements but kept - ------- the documentation of input/output and also explictly listed - ------- full clmtype variables -D models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -A models/lnd/clm/src/clm4_5/main/initTimeConstMod.F90 - -List all files added and what they do: - - ------- New run-time interpolation of input finidat to target resolution/mask - ------- using the new namelist variables finidat_interp_source and finidat_interp_dest -A models/lnd/clm/src/clm4_5/main/initInterp.F90 - - ------- Obtain/write global index space value for target point at given clmlevel -A models/lnd/clm/src/util_share/GetGlobalValuesMod.F90 - -List all existing files that have been modified, and describe the changes: - - ------- In all files, unless otherwise noted added call to errMsg(__FILE__,__LINE__) - ------- and in some cases optional arguments of decomp_index and clmlevel also added - - ------- See documentation for namelist changes above -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - - ------ Overloaded endrun subroutine to also print out global index infromation by - ------ calling new GetGlobalWrite routine if optional arguments decomp_index and - ------ clm_level are passed in -M models/lnd/clm/src/util_share/abortutils.F90 - - ------- Replaced missing value setting of huge(1) with ispval -M models/lnd/clm/src/util_share/accumulMod.F90 - - ------- Replaced endrun with call to shr_sys_abort -M models/lnd/clm/src/util_share/domainMod.F90 - - ------- Added in missing values and special values for variable metadata - this - ------- is needed needed by initInterp -M models/lnd/clm/src/util_share/restUtilMod.F90 -M models/lnd/clm/src/util_share/restUtilMod.F90.in - - ------- Completely rewrote clm_initialize to leverage new initialization scheme - ------- In the new scheme, cold start initialization is ALWAYS called and values - ------- are overwritten by either an appropriate finidat file OR by calling - ------- finidat_interp to interplate finidat to the output resolution/mask. -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 - - ------- Added new metadata and variables - include global indices for parent subgrid - ------- level(s) (i.e. column, landunit and gridcell for pfts) -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 - - ------- Moved view_factor routine and associated variable from a separate routine - ------- in UrbanMod to part of the initTimeConstUrban subroutine in UrbanInitMod -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 - - ------- Removed vf_xx variables from restart file and also - ------- removed do_initsurfalb variable -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 - - ------- In all files, unless otherwise noted added call to errMsg(__FILE__,__LINE__) - ------- and in some cases optional arguments of decomp_index and clmlevel also added -M models/lnd/clm/src/util_share/ncdio_pio.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90.in -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/MEGANFactorsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4RestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4varcon.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSharedParamsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeBGCMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeCNMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -M models/lnd/clm/src/clm4_5/main/decompInitMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/ndepStreamMod.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/surfrdUtilsMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -M models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -M models/lnd/clm/src/clm4_5/main/decompMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynTimeInfoMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynFileMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynConsBiogeochemMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynPriorWeightsMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90.in - -CLM testing: - - regular tests (aux_clm): - - NOTE1: that all namelists compares where finidat was not blank will fail - since - new finidat files are used that have new metadata - BUT - the results are still bfb - - yellowstone_intel - OK - expected failures: - ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay - ERS_D.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay - - yellowstone_pgi - OK - expected failures: - ERH_D.f19_g16.I1850CLM45CN.yellowstone_pgi.clm-default - ERS.f09_g16.ICLM45VIC.yellowstone_pgi.clm-vrtlay - - goldbach_nag - OK - - goldbach_intel - OK - - goldbach_pgi - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - NOTE1: all .h1 tests fail since there are new meta data fields for - cols1d_active, pfts1d_active - and FILLDIFF is different - - yellowstone_intel OK - yellowstone_pgi OK - -CLM tag used for the baseline comparisons: clm4_5_65 - -Changes answers relative to baseline: No - bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_5_65 -Originator(s): mvertens (Mariana Vertenstein,UCAR/CSEG,303-497-1349) -Date: Tue Feb 25 13:45:38 MST 2014 -One-line Summary: Turn off MEGAN vocs when crops is running - -Purpose of changes: - -MEGAN does not currently work with prognostic crops. It needs a table of pft-specific values, and that this table has only been created for the 16 "standard" (non-crop) pfts. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1930 (MEGAN does not work correctly with prognostic crops on) - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.):s - -scripts4_140214a -> scripts4_140220 -Machines_140214 -> Machines_140218 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -======== - Add a new logical variable - use_voc - that is true by default but - is set to false if prognostic cop is activated -======== - -M src/clm4_5/main/clm_initializeMod.F90 -M src/clm4_5/main/clm_atmlnd.F90 -M src/clm4_5/main/controlMod.F90 -M src/clm4_5/main/clm_varctl.F90 -M src/clm4_5/main/clm_driver.F90 -M src/clm4_5/main/histFldsMod.F90 -M src/clm4_0/main/clm_varctl.F90 -M src/cpl/clm_cpl_indices.F90 - - -CLM testing: - - build-namelist tests: N/A - - regular tests (aux_clm): - - yellowstone_intel - OK - expected failures - ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay - ERS_D.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay - expected non-bfb failures due to VIC/CROP changes - ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default - ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel - SMS_Ly1.f19_g16.ICLM45BGCCROP.yellowstone_intel - - yellowstone_pgi - OK - expected failures - ERH_D.f19_g16.I1850CLM45CN.yellowstone_pgi.clm-default - ERS.f09_g16.ICLM45VIC.yellowstone_pgi.clm-vrtlay - - goldbach_nag - OK - expected non-bfb failures due to VIC/CROP changes - ERS_D.f10_f10.ICLM45BGCCROP.goldbach_nag.clm-allActive - ERS_Lm3.1x1_numaIA.ICLM45BGCCROP.goldbach_nag - - goldbach_intel - OK - expected non-bfb failures due to VIC/CROP changes - ERS_Ly20.1x1_numaIA.ICLM45BGCDVCROP.goldbach_intel.clm-crop - PEM.f10_f10.ICLM45BGCCROP.goldbach_intel.clm-crop - - goldbach_pgi - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - - yellowstone_pgi - OK - -CLM tag used for the baseline comparisons: clm4_5_64 - -Changes answers relative to baseline: No - except for VOC fields when - prognostic crop is on (this is a diagnostic only and does not impact - the answers) - -=============================================================== -=============================================================== -Tag name: clm4_5_64 -Originator(s): muszala (Stefan Muszala,UCAR/TSS,303-497-1320) -Date: Wed Feb 19 09:19:40 MST 2014 -One-line Summary: fix and clean ncdio_pio.F90.in. clean clm_time_manager. update externals. - -Purpose of changes: - -Note 1: This is the last tag that is tested on frankfurt; new tests are on goldbach. - -Note 2: Pts. mode is being deprecated for science use as of this tag. Use PTCLM. Pts. mode - remains in place in our test system. - -Note 3: There is an unresolved problem with higher resolutions when dov2xy is .false. and we are - using pnetcdf. Please see bug 1730. - -ncdio_pio.F90.in - fix initialization problem where count and start are sometimes used without - being set. -clm_time_manager - clean out unused variables -update externals to support ED compsets, move pts. mode tests to testmods. Update Machines and - pio to address bug 1730. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.):s - -scripts4_140209 -> scripts4_140214a -Machines_140213 -> Machines_140214 -pio1_8_8 -> pio1_8_9 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/util_share/clm_time_manager.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90.in - -CLM testing: - - build-namelist tests: N/A - - regular tests (aux_clm): - - yellowstone_intel - OK - Expected due to change in pts. mode: - BFAIL SMS.f45_f45.I.yellowstone_intel.clm-ptsRLA.GC.64Intel.compare_hist.clm4_5_63 - BFAIL SMS.f45_f45.I.yellowstone_intel.clm-ptsROA.GC.64Intel.compare_hist.clm4_5_63 - BFAIL SMS_D_Mmpi-serial.f45_f45.ICLM45.yellowstone_intel.clm-ptsRLA.GC.64Intel.compare_hist.clm4_5_63 - BFAIL SMS_Mmpi-serial.f45_f45.ICLM45.yellowstone_intel.clm-ptsRLA.GC.64Intel.compare_hist.clm4_5_63 - Expected due to change in pio_buffer_size_limit - FAIL ERI.f09_g16.ICLM45BGC.yellowstone_intel.GC.64Intel.nlcomp - FAIL ERI_D.f09_g16.ICLM45BGC.yellowstone_intel.GC.64Intel.nlcomp - New Failure for VIC but due to dov2xy problem - ERS_D.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay - - yellowstone_pgi - OK - Expected due to change in pts. mode: - BFAIL SMS.f45_f45.I.yellowstone_pgi.clm-ptsRLB.GC.64Pgi.compare_hist.clm4_5_63 - BFAIL SMS_D_Mmpi-serial.f45_f45.ICLM45.yellowstone_pgi.clm-ptsRLA.GC.64Pgi.compare_hist.clm4_5_63 - BFAIL SMS_Mmpi-serial.f45_f45.ICLM45.yellowstone_pgi.clm-ptsRLA.GC.64Pgi.compare_hist.clm4_5_63 - Expected due to change in pio_buffer_size_limit - FAIL ERI.f09_g16.I1850CRUCLM45BGC.yellowstone_pgi.GC.64Pgi.nlcomp - FAIL ERI.f09_g16.ICLM45BGC.yellowstone_pgi.GC.64Pgi.nlcomp - FAIL ERI_D.f09_g16.ICLM45BGC.yellowstone_pgi.GC.64Pgi.nlcomp - FAIL ERS_D.hcru_hcru.ICRUCLM45BGC.yellowstone_pgi.GC.64Pgi.nlcomp - FAIL ERS_D.hcru_hcru.ICRUCN.yellowstone_pgi.GC.64Pgi.nlcomp - New Failure for VIC but due to dov2xy problem - ERS.f09_g16.ICLM45VIC.yellowstone_pgi.clm-vrtlay - - frankfurt_nag - OK - Expected due to change in pts. mode: - BFAIL SMS_D_Mmpi-serial.f45_f45.ICLM45.frankfurt_nag.clm-ptsRLA.GC.64Nag.compare_hist.clm4_5_63 - BFAIL SMS_Mmpi-serial.f45_f45.ICLM45.frankfurt_nag.clm-ptsRLA.GC.64Nag.compare_hist.clm4_5_63 - BFAIL SMS_Mmpich.f45_f45.ICLM45.frankfurt_nag.clm-ptsRLA.GC.64Nag.compare_hist.clm4_5_63 - - frankfurt_intel - OK - - frankfurt_pgi - OK - Expected due to change in pts. mode: - BFAIL SMS.f45_f45.ICLM45.frankfurt_pgi.clm-ptsRLB.GC.64Pgi.compare_hist.clm4_5_63 - BFAIL SMS.f45_f45.ICLM45.frankfurt_pgi.clm-ptsROA.GC.64Pgi.compare_hist.clm4_5_63 - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_63 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_63 -Originator(s): sacks (sacks) -Date: Fri Feb 14 07:22:37 MST 2014 -One-line Summary: add some code needed for dynamic landunits; activate 0-weight veg landunit sometimes - -Purpose of changes: - -(1) Add grc%landunit_indices(:,:), so you can find a given l index if you have - the g index (this will be needed in a few places for dynamic landunits) - -(2) Add code to update landunit weights; currently has no effect because - landunit areas don't change yet - -(3) Refactor logic in the is_active_X routines, and add logic to activate a - virtual vegetated landunit under some conditions (needed for coupling with - CISM, and helpful for dynamic landunits). Specifically, we activate a - virtual (0-weight) vegetated landunit for any grid cell that is NOT 100% - istice (i.e., standard glacier) (we exclude grid cells that are 100% istice - to avoid the performance penalty, because these aren't used for coupling - with CISM, and the only way this glacier can retreat is if another landunit, - like crop, increases there, which will rarely happen). - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: - - Performance about 6% worse for clm4.5 IG runs at f09 (i.e., with glcmec), - because of the new virtual vegetated columns. Not investigated for f19 or - T31, but probably a similar performance hit. - - There were also a few memcomp failures - -Code reviewed by: quick review by mvertens - -List any svn externals directories updated (csm_share, mct, etc.): - - Machines: Machines_140207a -> Machines_140213 (to fix pgi on yellowstone) - -List all files eliminated: - -========= Remove "IN_PROGRESS" -D models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90.IN_PROGRESS - -List all files added and what they do: - -========= Add code to update landunit weights; currently has no effect because - landunit areas don't change yet -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90 - -========= Add unit tests for dynLandunitAreaMod -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynLandunitArea_test/test_update_landunit_weights.pf - -List all existing files that have been modified, and describe the changes: - -========= Add grc%landunit_indices(:,:), so you can find a given l index if you - have the g index (this will be needed in a few places for dynamic - landunits) -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 - - just add a comment -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 - -========= Call new code in dynLandunitAreaMod -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 - -========= Refactor logic in the is_active_X routines, and add logic to activate - a virtual vegetated landunit under some conditions (needed for - coupling with CISM, and helpful for dynamic landunits) -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -========= Add unit tests for dynLandunitAreaMod -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/CMakeLists.txt -M models/lnd/clm/src/clm4_5/dyn_subgrid/CMakeLists.txt -M models/lnd/clm/src/clm4_5/main/CMakeLists.txt - - -CLM testing: - - regular tests (aux_clm): - - NOTE: frankfurt intel & pgi ran on a slightly older version of the branch - (dynlu_weight_updates_glacier_n05_clm4_5_62, which did not include some - final minor refactoring to reweightMod); frankfurt nag & yellowstone - intel/pgi ran on the final version - - yellowstone_intel: ok - yellowstone_pgi: ok - frankfurt_intel: ok - frankfurt_pgi: ok - frankfurt_nag: ok - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: ok - yellowstone_pgi: ok - - A bunch of expected failures in h1 (1-d) hist files, due to the newly-active - points. - - - Also: Did a manual test to show that answers are the same for virtual - vegetated columns as they would be if the column had non-zero weight (to - ensure there are no dependencies on whether a column's weight is non-zero). - -CLM tag used for the baseline comparisons: clm4_5_62 for yellowstone (but -clm4_5_61 for component_gen_comp); clm4_5_61 for frankfurt - -Changes answers relative to baseline: NO - - However, note diffs in 1-d hist files due to newly-active points. - -=============================================================== -=============================================================== -Tag name: clm4_5_62 -Originator(s): erik (Erik) -Date: Mon Feb 10 04:16:07 MST 2014 -One-line Summary: Get PTCLM working robustly, US-UMB test working, add CO2 streams to datm, add more - consistency testing between compsets and user settings - -Purpose of changes: - -US-UMB fix in scripts and datm update. Fix so build-namelist will abort if there is an inconsistency with CLM_BLDNML_OPTS -and user_nl_clm. Add CO2 streams as a built-in option to datm. Turn CO2 streams on with the DATM_CO2_TSERIES env_run.xml -variable. Can be set to: none,20tr,rcp2.6,rcp4.5,rcp6.0,rcp8.5, by default is none. - -Requirements for tag: - - datm -- CO2 update, streams improvements - Fix build-namelist consistency issues - Fix bug 1847 -- end1d in hist for clm4_0 - Add envxml_dir - check that cndv and fpftdyn aren't on the same time - Add PTCLM tests to test_Driver - Add PTCLM test system in - Make PTCLM more robust - -Test level of tag: regular, tools, build_namelist - -Bugs fixed (include bugzilla ID): - 1918 -- sort options in build-namelist - 1917 -- remove WRF resolutions - 1903 -- buildtools fails for PTCLM - 1900 -- Remove BUILDHEAT and Qanth from output for CLM testing - 1896 -- CLM build-namelist should abort if use_cndv AND fpftdyn are set. - 1881 -- Add envxml_casedir option to CLM build-namelist - 1879 -- need error triggered when use_crop and CLM_BLDNL_OPTS are not consistent - 1847 -- 'histfilemod_mp_hist_restart_ncd_$END1D' is being used without being defined - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: frankfurt switched out for goldbach - -Describe any changes made to the namelist: CLM build-namelist changed to ensure user changes don't conflict with - command-line options - -List any changes to the defaults for the boundary datasets: remove WRF datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts to scripts4_140209 - Machines to Machines_140207a - datm to datm8_140114 - pio to pio1_8_8 - cprnc to cprnc_140203 - - PTCLM to PTCLM2_140204 - -List all files eliminated: move frankfurt to goldbach - -D models/lnd/clm/test/tools/tests_posttag_frankfurt_nompi - -List all files added and what they do: goldbach, and add PTCLM tools testing - -A + models/lnd/clm/test/tools/tests_posttag_goldbach_nompi -A models/lnd/clm/test/tools/TCBscripttools.sh ------------ Add script to run buildtools for PTCLM -A models/lnd/clm/test/tools/config_files/PTCLM__s -------- Config for PTCLM -A models/lnd/clm/test/tools/nl_files/PTCLM_USUMB_clm4_0 -A models/lnd/clm/test/tools/nl_files/PTCLM_USUMB_clm4_5 -A models/lnd/clm/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 -A models/lnd/clm/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 -A models/lnd/clm/bld/unit_testers/myuser_nl_clm --- New build-namelist tests -A models/lnd/clm/bld/unit_testers/env_run.xm - - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/build-namelist ----- Sort options, add -envxml_dir option, check that user hasn't contradicted themself - with CLM_BLDNML_OPTS and user_nl_clm, remove options: -noio, -nofire, -snicar_frc, -vsoilc, -exlaklayers, -clm4me - use Cwd::abs_path and remove home-grown absolute_path, add some more docmentation and comments, redo some ordering and names - M models/lnd/clm/bld/clm.buildnml.csh --- add -envxml_dir so will use env_*.xml files to expand env variables - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml --- Add irrig setting, remove WRF files - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Add irrig, bgc_spinup, and bgc_mode - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml -- Remove WRF resolutions: us20, wus12 - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml - Remove WRF resolutions - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Remove WRF resolutions, add bgc_mode - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl ----------- Add a bunch of new tests - M models/lnd/clm/bld/user_nl_clm ----- make note of variables that should be done by command-line build-namelist options - - M models/lnd/clm/src/clm4_0/main/histFileMod.F90 --- Fix bug 1847 - ------------- Add PTCLM testing - M models/lnd/clm/test/tools/README.testnames - M models/lnd/clm/test/tools/test_driver.sh ------ Remove bluefire, lynx, mirage, jaguarpf -- switch frankfurt for goldbach - M models/lnd/clm/test/tools/TBLscript_tools.sh - M models/lnd/clm/test/tools/TSMscript_tools.sh - M models/lnd/clm/test/tools/input_tests_master - M models/lnd/clm/test/tools/tests_posttag_nompi_regression - M models/lnd/clm/test/tools/tests_posttag_yong - M models/lnd/clm/test/tools/tests_pretag_yellowstone_nompi - ------------- Don't die if debug and files were not created. - M models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata.pl - M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - -CLM testing: regular, build-namelist, tools - - build-namelist tests: - - yellowstone - - regular tests (aux_clm): - - yellowstone_intel - yellowstone_pgi - goldbach_nag - edison_intel - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - yellowstone_pgi - - tools testing: - - yellowstone interactive - goldbach interactive - -CLM tag used for the baseline comparisons: clm4_5_61 - -Changes answers relative to baseline: None, bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_5_61 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Tue Feb 4 09:45:43 MST 2014 -One-line Summary: add 3-d snow history fields; continue harvest past end of pftdyn timeseries - -Purpose of changes: - - There are two separate sets of changes in this tag; both apply just to CLM4.5: - - (1) Addition of 3-d snow history fields: These history fields (inactive by - default) provide diagnostics for each layer of the snow pack. This - involved adding some additional history file infrastructure to handle - the variable number of snow pack layers. See the new section in the - user's guide (custom.xml) for a description of how these new history - fields work, and how to interpret them. - - (2) Change the harvest logic for transient runs that extend past the end of - the pftdyn dataset: Until now, harvest was set to 0 when you passed the - end of the pftdyn dataset. With this tag, this behavior is changed, so - that for all years past the end of the pftdyn dataset, harvest rates - remain fixed at the last year's value. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: - - Memory use increases slightly, as observed by memcomp failures for a few - tests. This is presumably due to new fields in clmtype. - -Code reviewed by: Erik reviewed changes for the 3-d snow history fields. - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Add 3-d snow history fields -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/doc/UsersGuide/custom.xml - -========= Add a new snow diagnostic, sub_surf_abs_SW -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 - -========= Continue harvest past end of pftdyn time series -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynTimeInfoMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynFileMod.F90 -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test/test_dynTimeInfo.pf - - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: ok - yellowstone_pgi: ok - frankfurt_intel: ok - frankfurt_pgi: ok - frankfurt_nag: ok - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: ok - yellowstone_pgi: ok - - Only failures are these expected failures (see notes on answer changes - below): - - FAIL SMS_Ly3.1x1_tropicAtl.I20TRCLM45BGC.yellowstone_intel.clm-tropicAtl_subsetLate.compare_hist.clm4_5_60.clm2.h0 - FAIL SMS_Ly5.1x1_tropicAtl.I20TRCLM45BGC.yellowstone_intel.clm-tropicAtl_subsetMid.compare_hist.clm4_5_60.clm2.h0 - FAIL SMS_Ly8.1x1_tropicAtl.I20TRCLM45BGC.yellowstone_intel.clm-tropicAtl_subsetEarly.compare_hist.clm4_5_60.clm2.h0 - -CLM tag used for the baseline comparisons: clm4_5_60 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 transient runs that continue past the end of the pftdyn dataset - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - New climate: Harvest rates are now continued past the end of the pftdyn - dataset (staying fixed at their value from the last year), for the - remainder of the simulation. This leads to potentially large answer - changes for transient runs that continue past the end of the pftdyn - dataset. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_60 -Originator(s): andre (Benjamin Andre,LAWRENCE BERKELEY NATIONAL LABORATORY,510-486-4617) -Date: Thu Jan 30 18:27:03 MST 2014 -One-line Summary: refactor build-namelist - -Purpose of changes: : break build-namelist into small unit-testable functions - instead of a single massive script. Use output functions to standardize - screen output for errors, warnings and messages so that results can be - automatically searched by scripts. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, Erik - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/build-namelist - major refactor described above - M models/lnd/clm/bld/namelist_files/namelist_defaults_overall.xml - fix incorrect comments - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl - minor updates to check new output style - -CLM testing: - - build-namelist tests: - - yellowstone - pass compare and generate with only xfails - frankfurt - not tested, CLM-CMT believes tests may be broken. - - regular tests (aux_clm): - - yellowstone_intel - ok - yellowstone_pgi - ok - frankfurt_intel - ok - frankfurt_pgi - ok - frankfurt_nag - ok - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - ok - yellowstone_pgi - ok - - short tests (aux_clm_short): - - yellowstone_intel - ok - - tools testing: N/A - -CLM tag used for the baseline comparisons: clm4_5_59 - -Changes answers relative to baseline: none, bit for bit - - -=============================================================== -=============================================================== -Tag name: clm4_5_59 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Wed Jan 22 15:04:12 MST 2014 -One-line Summary: use new get_curr_yearfrac function in clm_time_manager - -Purpose of changes: - - Use the new get_curr_yearfrac function in clm_time_manager in place of - dyn_time_weights. The reason is that, as Erik pointed out, dyn_time_weights - was out of place in dynUtilsMod, and really this functionality belongs in the - clm_time_manager module. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: - -========= Made obsolete by get_curr_yearfrac in clm_time_manager -D models/lnd/clm/src/clm4_5/dyn_subgrid/dynUtilsMod.F90 -D models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/dynUtilsMod_mock.F90 - -List all files added and what they do: - -========= Mock out get_curr_yearfrac: return a fixed fraction -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/clm_time_manager_mock.F90 - -List all existing files that have been modified, and describe the changes: - -========= Fix get_curr_yearfrac to be real rather than integer -M models/lnd/clm/src/util_share/clm_time_manager.F90 - -========= Use get_curr_yearfrac instead of dyn_time_weights -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynCNDVMod.F90 -M models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90.in - -========= Update unit tests to pull in clm_time_manager (mock) rather than dynUtilsMod (mock) -M models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/CMakeLists.txt -M models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/CMakeLists.txt - - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: ok - yellowstone_pgi: ok - frankfurt_intel: ok - frankfurt_pgi: ok - frankfurt_nag: ok - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: ok - yellowstone_pgi: ok - -CLM tag used for the baseline comparisons: clm4_5_58 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45, either transient or with DV - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - roundoff - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - Ran testing on an intermediate tag, where I computed the time weights in - both the old and new ways. I confirmed that the difference in time weights - (which is the only change in this tag) is always less than 1e-13. Actually, - this difference is always less than 2e-16, double-precision roundoff. - - Also examined cpl hist diffs for a few select tests. Diffs are generally - ~ 1e-6 after 5 days. - -=============================================================== -=============================================================== -Tag name: clm4_5_58 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Wed Jan 22 14:11:30 MST 2014 -One-line Summary: major refactor of transient pft code, in prep for dynamic landunits - -Purpose of changes: - -Major refactor of transient pft code, in prep for dynamic landunits. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1899 (harvest rates remain non-zero even after the end of the pftdyn dataset) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Erik; design reviewed by CLM-CMT - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: scripts4_140102 -> scripts4_140114 - Machines: Machines_131206b -> Machines_140107 - csm_share: share3_131226 -> share3_131231 - pio: pio1_8_3 -> pio1_8_6 - - CMake: New external added - -List all files eliminated: - -========= renamed to dynConsBiogeophysMod.F90 -D models/lnd/clm/src/clm4_5/main/dynlandMod.F90 - -========= renamed to dynpftFileMod.F90; much of the stuff in here moved to other - files in the dyn_subgrid directory -D models/lnd/clm/src/clm4_5/main/pftdynMod.F90 - -========= renamed -D models/lnd/clm/test/unit - -List all files added and what they do: - -========= Rename test/unit to test/unit_testers, and add unit tests for some of - the stuff in dyn_subgrid. This also involved adding some mocks - - particularly of ncdio_pio. -A models/lnd/clm/test/unit_testers/clm4_5/biogeophys/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test/test_daylength.pf -A models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/biogeophys/Daylength_test -A models/lnd/clm/test/unit_testers/clm4_5/biogeophys -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/test_dynVarShared.F90 -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/test_dynVarTimeInterp.pf -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/test_dynVarTimeUninterp.pf -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynVar_test -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test/test_dynTimeInfo.pf -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/dynTimeInfo_test -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/dyn_subgrid -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_var.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_var.F90.in -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_pio_mock.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/spmdMod_mock.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/do_genf90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share/ncdio_pio_mock.F90.in -A models/lnd/clm/test/unit_testers/clm4_5/mock/util_share -A models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/shr_sys_mod_mock.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/mock/csm_share -A models/lnd/clm/test/unit_testers/clm4_5/mock/main/decompMod_boundsTypeDecl.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/main/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/mock/main -A models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/dynFileMod_mock.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/dynUtilsMod_mock.F90 -A models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/mock/dyn_subgrid -A models/lnd/clm/test/unit_testers/clm4_5/mock/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/mock -A models/lnd/clm/test/unit_testers/clm4_5/CMakeLists.txt -A models/lnd/clm/test/unit_testers/clm4_5/README -A models/lnd/clm/test/unit_testers/clm4_5 -A models/lnd/clm/test/unit_testers - -========= Make a new directory to hold all of the stuff related to dynamic - subgrid weights. Currently this means transient PFTs, but soon it will - also mean dynamic landunits. This includes stuff that used to be in - pftdynMod and dynlandMod, as well as a bit from clm_driver. I have - added a new driver for the dyn_subgrid stuff (dynSubgridDriverMod), - and pulled out much of the shared, lower-level functionality into new - modules (dynTimeInfoMod, dynFileMod, dynVarMod, dynVarTimeInterpMod, - dynVarTimeUninterpMod, dynUtilsMod [which will soon go away]). In - addition, I have separated the many routines in pftdynMod into - separate modules, each with a single, better-defined function. -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynTimeInfoMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynSubgridDriverMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynHarvestMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynFileMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynConsBiogeochemMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynPriorWeightsMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynpftFileMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynCNDVMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynConsBiogeophysMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarMod.F90.in -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeInterpMod.F90.in -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynLandunitAreaMod.F90.IN_PROGRESS -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynUtilsMod.F90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/dynVarTimeUninterpMod.F90.in -A models/lnd/clm/src/clm4_5/dyn_subgrid/CMakeLists.txt -A models/lnd/clm/src/clm4_5/dyn_subgrid - -========= script to generate files from their .in files using genf90 -A models/lnd/clm/src/clm4_5/dyn_subgrid/do_genf90 - - -========= move check_sums_equal_1 to a new module, partly to reduce dependencies - of unit tests, and partly because it is cleaner design to have it - outside of surfrdMod -A models/lnd/clm/src/clm4_5/main/surfrdUtilsMod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Add dyn_subgrid directory -M models/lnd/clm/bld/configure - -========= Add get_curr_yearfrac function (currently broken, will be fixed in - next tag) -M models/lnd/clm/src/util_share/clm_time_manager.F90 - -========= Change type(file_desc_t) to class(file_desc_t); add 'only' clause to - use statements to allow compilation with pgi -M models/lnd/clm/src/util_share/ncdio_pio.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90.in - -========= Change 'use statement' for reworked dyn_subgrid code -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 - -========= Move surfrd_check_urban and surfrd_check_sums_equal_1 to more - appropriate places -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 - -========= Move some code into dynSubgridDriverMod -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - - also remove incorrect header comment - -========= Add compute_higher_order_weights routine -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -========= Add unit testing support -M models/lnd/clm/src/clm4_5/main/CMakeLists.txt - - -========= Frankfurt-PGI tests now pass! -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - - build-namelist tests: - - yellowstone: ok - - regular tests (aux_clm): - - yellowstone_intel: ok - yellowstone_pgi: ok - frankfurt_intel: ok - frankfurt_pgi: ok - frankfurt_nag: ok - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: ok - yellowstone_pgi: ok - -CLM tag used for the baseline comparisons: clm4_5_57 - -Changes answers relative to baseline: YES (very limited; see below) - - Can change answers due to the following: - - (1) Changes answers for harvest when a run starts inside the pftdyn timeseries - but extends beyond it, without an intervening restart (see bug 1899) - - (2) Could theoretically change answers for yellowstone-pgi or hopper-pgi due - to machines updates, but no changes showed up in the yellowstone test suite - -=============================================================== -=============================================================== -Tag name: clm4_5_57 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Tue Jan 7 14:17:04 MST 2014 -One-line Summary: change CNDV water conservation to use the pftdyn method - -Purpose of changes: - - For my dynamic landunit work, I was trying to reconcile what's going on with - prescribed transient PFTs (pftdyn) vs CNDV. The reason is that I'm trying to - set up an overall control flow for dynamic landunits, and you need to be able - to run either of these in conjunction with dynamic landunits. - - In doing this, I noticed that water conservation is handled differently for - pftdyn vs CNDV: - - For pftdyn, water conservation is done as described in section 21.2 of the - CLM4.5 tech note: water contents are summed before and after transition, and - the difference is put in the runoff term - - CNDV appears not to use this before & after difference. Instead, it does a - correction for canopy water in pftdynMod: pftdyn_wbal. - - For dynamic landunits, we're planning to use an approach like what is - currently done for pftdyn. I think it's going to be messy and confusing to - try to maintain the current CNDV approach when it's possible to have CNDV in - conjunction with dynamic landunits. - - Thus, I am changing CNDV to use the pftdyn approach to water conservation, - whether or not you are running with dynamic landunits. This will change - answers for CNDV/BGCDV cases in CLM4.5, though I expect the effects to be - small. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: erik; concept approved by Sam Levis - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Main changes are here; also minor (somewhat related) cleanup: fix some - section heading comments, add a timer (ndep_interp) - pulling out some - stuff that used to be (inappropriately) in the pftdynwts timer section -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - -========= Remove a bunch of now-unneeded code, especially from pftdynMod -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 - - -CLM testing: - - NOTE: Most testing was done from tag cndv_water_conservation_n01_clm4_5_55 - - up-to-date with clm4_5_55, NOT clm4_5_56. I then updated to clm4_5_56 and - reran just the three tests that were run for that tag (see its ChangeLog - entry, below), with comparison to clm4_5_56. - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - -CLM tag used for the baseline comparisons: clm4_5_55 for most tests, clm4_5_56 -for three tests (see above note) - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 with DV (CNDV / BGCDV) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Not investigated, but expected to be larger than roundoff/same climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_56 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Thu Jan 2 09:06:32 MST 2014 -One-line Summary: update scripts external to fix I20TRCLM45BGC compset - -Purpose of changes: update scripts external to fix I20TRCLM45BGC compset - -Requirements for tag: fix bug 1869 - -Test level of tag: limited (see below) - -Bugs fixed (include bugzilla ID): 1869 (I20TRCLM45BGC compset improperly defined) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: scripts4_131203 -> scripts4_140102 - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: none - -CLM testing: - - ONLY TESTED THE 3 AFFECTED TESTS from the yellowstone & frankfurt aux_clm test suites: - - PASS PET_P15x2_Lm13.f10_f10.I20TRCLM45BGC.yellowstone_pgi.clm-reduceOutput.GC.140102-060037 - PASS ERS_D.f10_f10.I20TRCLM45BGC.frankfurt_pgi.clm-decStart.GC.140102-060448 - PASS ERS_Mmpich.f10_f10.I20TRCLM45BGC.frankfurt_nag.clm-decStart.GC.140102-060608 - -CLM tag used for the baseline comparisons: clm4_5_55 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Only I20TRCLM45BGC compsets - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - New climate for this compset: correctly uses CLM4.5 instead of CLM4.0 code. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_55 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Fri Dec 27 16:21:45 MST 2013 -One-line Summary: add hooks to Sean Santos's unit test framework, and begin to add CLM unit tests - -Purpose of changes: - - (1) add hooks to Sean Santos's unit test framework - - (2) begin to add CLM unit tests - - Note: this tag currently does NOT have the CMake utilities that are needed to - run the unit tests. Instead, the instructions show how to point to a version - of these in my directory. That's because, as of the time I submitted this tag - for testing, the necessary working version of the CMake utilities was not yet - tagged. In the near future, another external could be added to pull in these - CMake utilities in the CLM directory tree. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self, santos - -List any svn externals directories updated (csm_share, mct, etc.): - - tools/unit_testing: added external - models/csm_share: share3_131101 -> share3_131226 (to get changes needed for building unit tests) - -List all files eliminated: None - -List all files added and what they do: - -========= Set up unit test directories & CMakeLists.txt files, and add unit - tests for DaylengthMod. Note that the tests themselves are in - Daylength_test/test_daylength.pf. See the README file for how to run - the tests -A models/lnd/clm/test/unit -A models/lnd/clm/test/unit/clm4_5 -A models/lnd/clm/test/unit/clm4_5/README -A models/lnd/clm/test/unit/clm4_5/CMakeLists.txt -A models/lnd/clm/test/unit/clm4_5/mock -A models/lnd/clm/test/unit/clm4_5/mock/decompMod_boundsTypeDecl.F90 -A models/lnd/clm/test/unit/clm4_5/mock/CMakeLists.txt -A models/lnd/clm/test/unit/clm4_5/Daylength_test -A models/lnd/clm/test/unit/clm4_5/Daylength_test/test_daylength.pf -A models/lnd/clm/test/unit/clm4_5/Daylength_test/CMakeLists.txt - -========= Add CMakeLists.txt files that are needed to build unit tests -A models/lnd/clm/src/clm4_5/main/CMakeLists.txt -A models/lnd/clm/src/clm4_5/biogeophys/CMakeLists.txt - -List all existing files that have been modified, and describe the changes: - -========= Remove unneeded 'use' statement, to prevent pulling in more than is - necessary for the unit test build -M models/lnd/clm/src/clm4_5/main/clmtype.F90 - -========= Externals updated - see above -M SVN_EXTERNAL_DIRECTORIES - - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - Also ran the new unit tests, as per the instructions in - models/lnd/clm/test/unit/clm4_5/README - all PASS - -CLM tag used for the baseline comparisons: clm4_5_54 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_54 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Fri Dec 27 15:55:05 MST 2013 -One-line Summary: update externals to cesm1_3_beta06 - -Purpose of changes: - - Update externals to cesm1_3_beta06 versions. - - However, do NOT update RTM, because the latest version of RTM results in - failures for ERI _N2 tests. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): none - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: not investigated - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - Index: SVN_EXTERNAL_DIRECTORIES - =================================================================== - --- SVN_EXTERNAL_DIRECTORIES (.../trunk_tags/clm4_5_53) (revision 56268) - +++ SVN_EXTERNAL_DIRECTORIES (.../branch_tags/clm_update_externals_cesm1_3_beta06_tags/clm_update_externals_cesm1_3_beta06_n02_clm4_5_53) (revision 56268) - @@ -1,25 +1,25 @@ - # CESM scripts, machines and driver - -scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_131126a - -scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130930b - -models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_02 - +scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_131203 - +scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_131206b - +models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq5_0_07 - - # Model components: Data atmosphere, and stub components as well as land-ice model - -models/atm/datm https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_131116 - -models/ocn/socn https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_03/socn - -models/ice/sice https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_03/sice - -models/glc/sglc https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_03/sglc - -models/wav/swav https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_03/swav - -models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_34 - -models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_130924 - +models/atm/datm https://svn-ccsm-models.cgd.ucar.edu/datm7/trunk_tags/datm8_131201 - +models/ocn/socn https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_04/socn - +models/ice/sice https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_04/sice - +models/glc/sglc https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_04/sglc - +models/wav/swav https://svn-ccsm-models.cgd.ucar.edu/stubs/trunk_tags/stubs1_4_04/swav - +models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_34 - +models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_131008 - - # Utilities: csm_share, esmf, timing, MCT, PIO - -models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_130918 - +models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_131101 - models/utils/esmf_wrf_timemgr https://svn-ccsm-models.cgd.ucar.edu/esmf_wrf_timemgr/trunk_tags/esmf_wrf_timemgr_130213 - -models/utils/timing https://svn-ccsm-models.cgd.ucar.edu/timing/trunk_tags/timing_130506 - +models/utils/timing https://svn-ccsm-models.cgd.ucar.edu/timing/trunk_tags/timing_131108 - models/utils/mct https://github.com/quantheory/MCT/tags/compiler_fixes_n03_MCT_2.8.3 - -models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_7_2/pio - +models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_8_3/pio - - # Mapping tools: - -tools/cprnc https://svn-ccsm-models.cgd.ucar.edu/tools/cprnc/trunk_tags/cprnc_130529 - +tools/cprnc https://svn-ccsm-models.cgd.ucar.edu/tools/cprnc/trunk_tags/cprnc_131120 - tools/mapping https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130716 - models/lnd/clm/tools/shared/gen_domain https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130716/gen_domain_files - - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= NCK tests no longer fail; change fail type of - ERS_D.f19_g16.IGRCP26CN.frankfurt_pgi from CFAIL to RUN -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - - build-namelist tests: - - yellowstone: OK - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: generate only (no baselines from clm4_5_53) - -CLM tag used for the baseline comparisons: clm4_5_53 - -Changes answers relative to baseline: YES, but only for multi-instance - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Multi-instance - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated, but suspected to be new climate - - Note that NCK tests newly pass (they had been failing), so this answer change - for multi-instance tests is expected. - - These answer changes show up in the following tests: - - FAIL CME_N2.f10_f10.I1850CLM45BGC.yellowstone_intel.clm-default.GC.131227-063851.compare_hist.clm4_5_53 - FAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.GC.131227-063851.compare_hist.clm4_5_53 - FAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.GC.131227-063851.compare_hist.clm4_5_53 - - FAIL CME_N2.f10_f10.I1850CLM45BGC.yellowstone_intel.clm-default.compare_hist.clm4_5_53.clm2.h0 - FAIL ERI_N2.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.compare_hist.clm4_5_53.clm2.h0 - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_53 -Originator(s): muszala (Stefan Muszala,UCAR/TSS,303-497-1320) -Date: Thu Dec 19 07:59:56 MST 2013 -One-line Summary: refactor restart interfaces - -Purpose of changes: Refactor restart interfaces. Most work done by mvertens. - -1) Add two *.F90.in files that use genf90.pl go generate source. This saves time - in dev. and maintenence. If you modify only the *.F90 file, your changes will - be lost. Instead modify the *F90.in file, then run genf90.pl on that file. - If you have questions, ask a clm developer for help. -2) Restart capability has now been encapsulated in a subroutine call that uses - Fortran 2003 interfaces over type and dimension. For example: - -- if (flag == 'define') then -- call ncd_defvar(ncid=ncid, varname='grainc_storage_to_xfer', xtype=ncd_double, & -- dim1name='pft',long_name='grain C shift storage to transfer',units='gC/m2/s') -- else if (flag == 'read' .or. flag == 'write') then -- call ncd_io(varname='grainc_storage_to_xfer', data=pcf%grainc_storage_to_xfer, & -- dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) -- if (flag=='read' .and. .not. readvar) then -- if (is_restart()) call endrun -- end if -- end if -+ call restartvar(ncid=ncid, flag=flag, varname='grainc_storage_to_xfer', xtype=ncd_double, & -+ dim1name='pft', & -+ long_name='grain C shift storage to transfer', units='gC/m2/s', & -+ interpinic_flag='interp', readvar=readvar, data=pcf%grainc_storage_to_xfer) - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary data sets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: - -! renamed for consistency -D models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 - -List all files added and what they do: - -A models/lnd/clm/src/util_share/dtypes.h -A models/lnd/clm/src/util_share/ncdio_pio.F90.in -A models/lnd/clm/src/util_share/restUtilMod.F90 -A models/lnd/clm/src/util_share/restUtilMod.F90.in -A models/lnd/clm/src/clm4_5/biogeochem/CNRestMod.F90 - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/util_share/clm_time_manager.F90 -M models/lnd/clm/src/util_share/accumulMod.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4RestMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeRestMod.F90 - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - frankfurt_intel - OK - frankfurt_pgi - OK - frankfurt_nag - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_52 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_52 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Tue Nov 26 22:07:32 MST 2013 -One-line Summary: turn on longwave radiation downscaling for glc_mec by default - -Purpose of changes: Turn on longwave radiation downscaling for glc_mec by default - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: set glcmec_downscale_longwave to true -by default - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: updated to scripts4_131126a, to get tweaked test list - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Change glcmec_downscale_longwave to true by default -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 - -========= Remove build-namelist tests that are no longer xFails -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -========= Update scripts to scripts4_131126a, to get tweaked test list -M SVN_EXTERNAL_DIRECTORIES - - -CLM testing: - - build-namelist tests: - - yellowstone: ok - frankfurt - - regular tests (aux_clm): - - yellowstone_intel: ok - yellowstone_pgi: ok - frankfurt_intel: ok - frankfurt_pgi: ok - frankfurt_nag: ok - -Expected baseline failures: -FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.131126-131812.compare_hist.clm4_5_51 -FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.131126-131812.nlcomp - -Two BFAILs due to changed tests; I reran them as their old versions and confirmed that answers changed, as expected: -BFAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC_changeFlags.GC.131126-131807.compare_hist.clm4_5_51 -BFAIL PEM_D.f19_g16.IG1850CLM45.yellowstone_pgi.clm-glcMEC.GC.131126-214346.compare_hist.clm4_5_51 - - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: ok - yellowstone_pgi: ok - -CLM tag used for the baseline comparisons: clm4_5_51 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 with glc_mec (IG compsets) - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff; not investigated whether it is same climate or new climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_51 -Originator(s): sacks (sacks) -Date: Tue Nov 26 05:46:29 MST 2013 -One-line Summary: rework downscaling of atm fields for glc_mec - -Purpose of changes: - -A number of changes related to downscaling atm -> clm fields for glc_mec -landunits: - -(1) Add new options to downscale precip (division into rain/snow) and longwave - radiation (developed by Bill Lipscomb). Both are currently off by default. - -(2) Move downscaling code out of clm_driverInit into clm_atmlnd.F90 - this is a - more appropriate module, and is a step towards modularity, because the code - to deal with the atmospheric forcing fields lives in the same module as the - definition of these atmospheric forcing fields. - -(3) Ensure that all code uses the downscaled, column-level fields where - possible. Previously, some code (which did not operate over glc_mec - landunits) used the non-downscaled, gridcell-level version of fields such as - forc_t. This was a problem because (a) it was confusing and error-prone, and - (b) we will soon be bringing in code to do downscaling over other landunits - as well as glc_mec landunits. - -(4) To support (3), and make it harder for someone to accidentally use the - gridcell-level version of a field when they should be using the downscaled, - column-level version: Broke clm_a2l into two pieces - one containing fields - that aren't downscaled, and one containing fields that are downscaled. For - fields that are downscaled, clearly distinguished the non-downscaled - versions so they couldn't be used by accident. - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: For glc_mec runs, added two new -namelist options: glcmec_downscale_rain_snow_convert and -glcmec_downscale_longwave. - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: erik; portions reviewed by Bill Lipscomb, Mariana, Stefan - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Significant changes: includes stuff that used to be in - clm_driverInitMod; added new downscaling code for precip & lwrad; - split atm2lnd type into two types; reworked initialization interfaces; - removed unused field rainf, because it currently isn't used and could - theoretically become inconsistent with the downscaled rain/snow -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 - -========= Removed downscaling code from here -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 - -========= Added call to downscale_forcings -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - -========= Changed interface to init_atm2lnd: previously, clm_initialize used - clm_a2l from clm_atmlnd and passed it to init_atm2lnd_type (also in - clm_atmlnd) - there was no reason for this, it was confusing, and to - some extent broke modularity -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 - -========= New parameter -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 - -========= Removed some variables -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - -========= New namelist control variables -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -========= Removed unused rainf, added pointer to allow lnd_import_export to - remain identical between clm4_0 and clm4_5 code -M models/lnd/clm/src/clm4_0/main/clm_atmlnd.F90 - -========= Fixed test ids for failing build-namelist tests -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -========= Minor changes in lots of places to (a) use fields from - a2l_downscaled_col instead of clm_a2l, and (b) index those fields by - column rather than by gridcell -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/cpl/lnd_comp_esmf.F90 -M models/lnd/clm/src/cpl/lnd_import_export.F90 -M models/lnd/clm/src/cpl/lnd_comp_mct.F90 - - -CLM testing: - - build-namelist tests: - - yellowstone: OK - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - Note the following expected nlcomp failures: - FAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC.GC.131125-104703.nlcomp - FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.131125-104751.nlcomp - FAIL PEM_D.f19_g16.IG1850CLM45.yellowstone_pgi.GC.131125-104751.nlcomp - - Also, there were BFAILs for the following, implying that the baselines - didn't exist; I'm not too concerned because baseline comparisons passed for - similar tests: - BFAIL SMS_Ly1_Mmpich.f19_g16.ICLM45BGCCROP.frankfurt_nag.clm-reduceOutput.GC.131125-104832.compare_hist.clm4_5_50 - BFAIL ERS_Ly5.f10_f10.I20TRCRUCLM45BGC.yellowstone_intel.clm-monthly_noinitial.GC.131125-104703.compare_hist.clm4_5_50 - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - As above, baselines were missing for this test: - BFAIL2 ERS_Ly5.f10_f10.I20TRCRUCLM45BGC.yellowstone_intel.clm-monthly_noinitial.compare_hist.clm4_5_50.clm2.h0 (baseline history file does not exist) - BFAIL2 ERS_Ly5.f10_f10.I20TRCRUCLM45BGC.yellowstone_intel.clm-monthly_noinitial.compare_hist.clm4_5_50.clm2.h1 (baseline history file does not exist) - - -CLM tag used for the baseline comparisons: clm4_5_50 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_50 -Originator(s): erik (Erik) -Date: Sun Nov 24 18:51:11 MST 2013 -One-line Summary: Bring in a crop of b4b bugfixes, fix getregional script, - start move of PTCLM to PTCLMmkdata tool - -Purpose of changes: - -Bring in a crop of bit-for-bit bug-fixes to the trunk for November. -Fix the getregional_datasets script and initial move of PTCLM to just -be a CLM tool under models/lnd/clm/tools/shared to create single-point -datasets. - -New option to create_newcase "-user_mods_dir" for a directory with -user chagnes such as user_nl_* namelist modification files, xmlchange_cmnds -file with xmlchanges to make, and SourceMods/src.*/* files. - -Requirements for tag: bit-for-bit bug-fixes and work on PTCLM - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1868 (Add user_mods_dir to create_newcase) - 1854 (Remove fndepdat no longer used) - 1842 (Remove unused variables from gridcell type) (Bill) - 1835 (Add write statement to pftdyn so you can see what it is doing) - 1828 (Clarify modulo used in irrigation code) (Bill) - 1770 (Remove sitespf_pt valid_values list for clm4_0) - 1724 (getregional script does NOT work) - 1625 (Problem setting finidat in CLM for RUN_TYPE=hybrid/branch) - 1543 (large-file format does NOT work in latest clm) - 1481 (Provide a more direct way to set a user provided finidat file) - 1437 (problems with link_dirtree -- no longer needed) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: SourceMods directory on create_newcase - - New -user_mods_dir option to create_newcase that will copy SourceMods/src.*/* - files to the new case. Also copies user_nl_* files and xmlchange_cmnds - -Describe any changes made to the namelist: remove outnc_large_files - Remove outnc_large_files -- wasn't functional - (now always use 64-bit format) - Remove fndepdat from namelist_definition/defaults no longer used. - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, sacks (fixes for 1842 and 1828) - -List any svn externals directories updated (csm_share, mct, etc.): scripts - scripts updated to scripts4_131119 - -List all files eliminated: None - -List all files added and what they do: - ------- Add externals for tools so PTCLM shows up in tool directory ------- Add same files and a README file for getregional -A models/lnd/clm/tools/SVN_EXTERNAL_DIRECTORIES -A models/lnd/clm/tools/shared/ncl_scripts/sample_inlist -A models/lnd/clm/tools/shared/ncl_scripts/sample_outlist -A models/lnd/clm/tools/shared/ncl_scripts/README.getregional - -List all existing files that have been modified, and describe the changes: - ------- Get getregional_datasets script working again. Now operates on ------- lists of files. -M models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.pl -M models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.ncl -M models/lnd/clm/test/tools/TSMscript_tools.sh --- Copy sample_*list files -M models/lnd/clm/test/tools/nl_files/getregional - change arguments - ------- -M models/lnd/clm/tools/clm4_0/interpinic/src/interpinic.F90 - ------- Remove clm_startfile option and outnc_large_files -M models/lnd/clm/bld/config_files/config_definition_clm4_0.xml -- - Remove valid_values from sitespf_pt so can be anything. -M models/lnd/clm/bld/unit_testers/build-namelist_test.pl -- Remove - clm_startfile option and move some clm4_5 configure options - to build-namelist -M models/lnd/clm/bld/build-namelist --- Remove clm_startfile option - and outnc_large_files -M models/lnd/clm/bld/clm.buildnml.csh - Remove clm_startfile option - set finidat/nrevsn like how is done in CAM - ------- Remove fndepdat and outnc_large_files -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0_tools.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -------- Remove - some gridcell variables not sued -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 ------------- write - on what's going on -M models/lnd/clm/src/clm4_5/main/controlMod.F90 ------------ Remove - outnc_large_files -M models/lnd/clm/src/clm4_5/main/clmtype.F90 --------------- Remove - a bunch of gridcell variables not needed -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 - Add - seconds_since_irrig_start_time temporary to clarify - ------- -M models/lnd/clm/src/clm4_0/main/pftdynMod.F90 --- add some writes statements -M models/lnd/clm/src/clm4_0/main/controlMod.F90 -- remove outnc_large_files - -CLM testing: - - build-namelist tests: - - yellowstone yes - frankfurt no - - NOTE: there were some tests that were passing but in the xFail list - from before clm4_5_49 that I marked as working. - - regular tests (aux_clm): - - yellowstone_intel yes - yellowstone_pgi yes - frankfurt_intel yes - frankfurt_pgi yes - frankfurt_nag yes - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel yes - yellowstone_pgi yes - - tools testing: - - yellowstone interactive yes - -CLM tag used for the baseline comparisons: clm4_5_49 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_5_49 -Originator(s): muszala (Stefan Muszala) -Date: Sat Nov 16 07:51:27 MST 2013 -One-line Summary: Swenson anomaly forcing - Part 1 - -purpose of changes: - add additional data streams to modify existing - data streams for purposes such as bias correction or specifying - future changes relative to baseline data streams, e.g. specifying - future atmospheric forcing anomalies when running CLM with data atmosphere. - Paired with datm8_131115. - - For what to set in user_nl_cpl, user_nl_datm, see testing section. - - This is part 1 of 2. Part 2 will address a general way to handle - streams in the DATM that is triggered off of an AF compset. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: swenson, kluzek, self - -List any svn externals directories updated (csm_share, mct, etc.): update to datm8_131116 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_0/main/clm_atmlnd.F90 -M models/lnd/clm/src/cpl/clm_cpl_indices.F90 -M models/lnd/clm/src/cpl/lnd_import_export.F90 -M SVN_EXTERNAL_DIRECTORIES - -CLM testing: - -Testing for features of this tag: f09_g16, ICRUCLM45 - -anomaly forcing namelists - user_nl_cpl: cplflds_custom = 'Sa_prec_af->a2x', 'Sa_prec_af->x2l','Sa_tbot_af->a2x', - 'Sa_tbot_af->x2l','Sa_pbot_af->a2x', 'Sa_pbot_af->x2l','Sa_shum_af->a2x', - 'Sa_shum_af->x2l','Sa_u_af->a2x', 'Sa_u_af->x2 l','Sa_v_af->a2x', - 'Sa_v_af->x2l','Sa_swdn_af->a2x', 'Sa_swdn_af->x2l','Sa_lwdn_af->a2x', - 'Sa_lwdn_af->x2l' - user_nl_datm: anomaly_forcing = 'Anomaly.Forcing.Precip','Anomaly.Forcing.Temperature', - 'Anomaly.Forcing.Pressure','Anomaly.Forcing.Humidity','Anomaly.Forcing.Uwind', - 'Anomaly.Forcing.Vwind','Anomaly.Forcing.Shortwave','Anomaly.Forcing.Longwave' -bias correction namelists - user_nl_cpl: cplflds_custom = 'Sa_precsf->a2x', 'Sa_precsf->x2l' - user_nl_datm: bias_correct = 'BC.CRUNCEP.GPCP.Precip' - - build-namelist tests: N/A - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - frankfurt_intel - OK - frankfurt_pgi - OK - frankfurt_nag - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_48 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_48 -Originator(s): muszala (Stefan Muszala) -Date: Thu Nov 14 08:28:31 MST 2013 -One-line Summary: bug fixes for CLM dry deposition and MEGAN VOC emissions - -Purpose of changes: Bring in bug fixes from fvitt for CLM dry deposition and MEGAN VOC emissions. Any changes - to answers are limited to rare circumstances. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: fvitt, self - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_0/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/DryDepVelocity.F90 - -CLM testing: - - build-namelist tests: N/A - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - frankfurt_intel - OK - frankfurt_pgi - OK - frankfurt_nag - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_47 - -Changes answers relative to baseline: Answers change for some of the chemistry configurations, but - these changes will not be see in the CLM standalone tests. - -=============================================================== -=============================================================== -Tag name: clm4_5_47 -Originator(s): muszala (Stefan Muszala) -Date: Tue Nov 12 09:26:20 MST 2013 -One-line Summary: fix Bug 1858 - AGDD now reset annually - -Purpose of changes: Fix bug 1858. AGDD is now reset annually. Replace -99999_r8 with a - parameter in accumulMod.F90 which is used in accFldsMod.F90 - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1858 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: slevis, sacks, muszala - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/util_share/accumulMod.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 - -CLM testing: - - build-namelist tests: N/A - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - frankfurt_intel - OK - frankfurt_pgi - OK - frankfurt_nag - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_46 - -Changes answers relative to baseline: Generally, No. There may be changes - in DV compsets over very long simulation times and at very high resolutions. - -=============================================================== -=============================================================== -Tag name: clm4_5_46 -Originator(s): sacks (sacks) -Date: Fri Nov 8 17:26:02 MST 2013 -One-line Summary: remove zeroing out of slope for special landunits - -Purpose of changes: - - Previously, there was code to zero out slope for grid cells with 100% special - landunits. However, there were a number of problems with this: - - (1) With dynamic landunits, this is problematic, because a grid cell could - start as 100% special landunits, then later become < 100% special landunits - (e.g., due to retreating glaciers) - - (2) Moreover, why should the slope of a special landunit depend on whether - the grid cell has 100% special landunits. This seems to be saying that, e.g., - the slope of a glacier landunit depends on whether the grid cell is entirely - glacier or part glacier and part natural veg. - - (3) And I guess moreover, why is the slope zeroed out for special landunits - in the first place? - - - From talking with Erik, we decided thish code was probably a relic from a - time when the surface dataset had some bad values (e.g., over Greenland / - Antarctica). This is no longer the case, so this code is no longer needed. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: erik - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - Following are the baseline failures, which are expected (see below): - -FAIL SMS_D.1x1_mexicocityMEX.ICLM45.frankfurt_intel.clm-default.GC.131107-223431.compare_hist.clm4_5_45 -FAIL SMS_D.1x1_vancouverCAN.ICLM45.frankfurt_pgi.clm-default.GC.131107-223435.compare_hist.clm4_5_45 -FAIL ERS_Mmpi-serial.1x1_mexicocityMEX.I1PTCLM45.frankfurt_nag.clm-default.GC.131107-223439.compare_hist.clm4_5_45 -FAIL SMS_D_Mmpi-serial.1x1_vancouverCAN.I1PTCLM45.frankfurt_nag.clm-default.GC.131107-223439.compare_hist.clm4_5_45 -FAIL ERI.f09_g16.ICLM45BGC.yellowstone_intel.GC.131107-223256.compare_hist.clm4_5_45 -FAIL ERI_D.f09_g16.ICLM45BGC.yellowstone_intel.GC.131107-223256.compare_hist.clm4_5_45 -FAIL ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.GC.131107-223256.compare_hist.clm4_5_45 -FAIL ERS_Lm3.1x1_vancouverCAN.I1PTCLM45.yellowstone_intel.clm-default.GC.131107-223256.compare_hist.clm4_5_45 -FAIL SMS.1x1_mexicocityMEX.I1PTCLM45.yellowstone_intel.clm-default.GC.131107-223256.compare_hist.clm4_5_45 -FAIL ERI.f09_g16.I1850CRUCLM45BGC.yellowstone_pgi.GC.131107-223301.compare_hist.clm4_5_45 -FAIL ERI.f09_g16.ICLM45BGC.yellowstone_pgi.GC.131107-223301.compare_hist.clm4_5_45 -FAIL ERI_D.f09_g16.ICLM45BGC.yellowstone_pgi.GC.131107-223301.compare_hist.clm4_5_45 - - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - Following are the baseline failures, which are expected: - -FAIL ERS_Lm3.1x1_vancouverCAN.I1PTCLM45.yellowstone_intel.clm-default.compare_hist.clm4_5_45.clm2.h0 -FAIL ERS_Lm3.1x1_vancouverCAN.I1PTCLM45.yellowstone_intel.clm-default.compare_hist.clm4_5_45.clm2.h1 -FAIL SMS.1x1_mexicocityMEX.I1PTCLM45.yellowstone_intel.clm-default.compare_hist.clm4_5_45.clm2.h0 -FAIL SMS.1x1_mexicocityMEX.I1PTCLM45.yellowstone_intel.clm-default.compare_hist.clm4_5_45.clm2.h1 - - -CLM tag used for the baseline comparisons: clm4_5_45 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Any configuration that includes a grid cell that - has 100% special landunits, including at least some urban - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Not investigated carefully, but expected to be larger than roundoff/same - climate - since this only affects a very small number of grid cells, and - (I believe) only the urban pervious road in those grid cells - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_45 -Originator(s): sacks (sacks) -Date: Fri Nov 8 16:10:22 MST 2013 -One-line Summary: refactor daylength calculation, and other minor changes - -Purpose of changes: - - (1) Compute daylength in a single place, and compute necessary variables at - initialization rather than having them on the restart file - - (2) Compute daylength-related variables at initialization rather than having - them on the restart file, both to clean things up and to fix some daylength - bugs at initialization (these bugs were fixed in a kludgey way in clm4_5_44, - and now are fixed robustly) - - (3) Fix daylength calculation at the poles (previously blew up due to - roundoff errors) (doesn't change behavior currently, but could change - behavior / answers if there were a vegetated landunit at the pole) - - (4) Fix sminn on restart, so that crop restarts can be bfb (bug 1846) - - (5) Add all_active namelist variable that makes even 0-weight points active, - for testing purposes - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - - 1846 (crop restarts aren't exact due to sminn field) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: add all_active namelist variable - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: (1) & (2) reviewed by erik, (3) by self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: update from scripts4_131030 -> scripts4_131107a - -List all files eliminated: none - -List all files added and what they do: - -========= Compute daylength in a single place -A models/lnd/clm/src/clm4_5/biogeophys/DaylengthMod.F90 - -List all existing files that have been modified, and describe the changes: - -========= Refactor daylength calculation to just compute daylength in a single, - central place, and compute necessary variables at initialization - rather than having them on the restart file -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 - - also fix sminn on restart (bug 1846) -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 - -========= Add all_active namelist variable that makes even 0-weight points - active, for testing purposes -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - - -========= Add & remove tests from xFail list -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -*** No longer tested (replaced by CME_Ly4) -- Runs out of time. CME_Ly4.f10_f10.I1850CLM45BGC.yellowstone_intel.clm-monthly passes - -*** Now passes -- restarts not exact due to bug 1846: crop restarts are not exact due to sminn field - -+ Diffs in cpl log files in rofl, rofi and volr -+ Diffs in cpl log files in rofl, rofi and volr - - -CLM testing: - - build-namelist tests: - - yellowstone: OK - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - Note that we get the following failures in compare_hist: - - FAIL PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-reduceOutput.GC.131107-214732.compare_hist.clm4_5_44 - FAIL PET_P15x2_Ly3.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrigOn_reduceOutput.GC.131107-214732.compare_hist.clm4_5_44 - - However, I think that's expected due to the oddities in the clm4_5_44 tag - with openmp - see notes in the ChangeLog for clm4_5_44 for details. Note - that this one is identical to clm4_5_43, suggesting that clm4_5_45 undoes - the problem introduced in clm4_5_44: - - PASS PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-reduceOutput.compare_hist.clm4_5_43.cpl.hi - - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - In particular, note that the clm hist comparison passes for the two above - tests that had unexpected cpl diffs: - - PASS PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-reduceOutput.compare_hist.clm4_5_44.clm2.h0 - PASS PET_P15x2_Ly3.f10_f10.ICLM45BGCCROP.yellowstone_intel.clm-irrigOn_reduceOutput.compare_hist.clm4_5_44.clm2.h0 - - -CLM tag used for the baseline comparisons: clm4_5_44 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_44 -Originator(s): sacks (sacks) -Date: Fri Nov 8 08:19:56 MST 2013 -One-line Summary: temporary hack to daylength initialization to provide baselines for the next tag - -Purpose of changes: - - The next tag (clm4_5_45) involves a major refactor to the daylength - calculation. That refactor is bfb in most respects, but gives differences in - the first time step in a few situations. - - This tag (clm4_5_44) does the minimal changes needed to get the same results - as clm4_5_45, in order to have more confidence when testing clm4_5_45. - - Note that the changes here are a kludge that will be reverted in clm4_5_45. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 1850 (incorrect daylength in first timestep of some runs) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: OK - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - There were a number of expected compare_hist failures, as described below. - - There was one unexpected compare_hist failure: - FAIL PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-reduceOutput.GC.145424.compare_hist.clm4_5_43 - - Diffs are just in voc cpl fields. CLM hist files are identical at the end of - the run. An SMS version of this test passes. Interestingly, the kludgey code - that I have added for clm4_5_44 isn't even executed in this test... so the - only diffs should be in variable declarations and 'use' statements. And - clm4_5_45 (which I will tag soon) gives identical cpl hist files to - clm4_5_43. So there may just be a compiler fluke in the compilation of this - tag with openmp enabled. Because clm4_5_45 will give identical results to - clm4_5_43, I'm not worrying about this. - - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - A number of expected compare_hist failures, as described below. - -CLM tag used for the baseline comparisons: clm4_5_43 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 with BGC (and probably CN), involving - either (a) initial conditions interpolated from a different resolution, or - (b) a change in start date relative to the ref date of an initial file - (which shows up in ERI tests) - see bug 1850 - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated carefully, but almost certainly larger than - roundoff/same climate, since this code mod just changes things in the - first timestep. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_43 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Wed Nov 6 09:21:25 MST 2013 -One-line Summary: allocate memory for most landunits in every grid cell (needed for dynamic landunits) - -Purpose of changes: - - Main change is to allocate memory for most landunits in every grid cell, to - support dynamic landunits. Note that we ALWAYS do this extra memory - allocation, so that the user isn't required to do interpinic between a - non-dynamic run and a dynamic landunit run. (If we eventually change the - restart file format / processing so that you can add / remove 0-weight points - at will, then we could potentially add some logic to only do this extra - allocation if we're using dynamic landunits.) - - Supporting changes are (1) determining which grid cells have enough parameter - data to support urban landunits, (2) new initial conditions files, (3) in - mksurfdata_map, don't set soil parameters to 0 under glacier, and set urban - parameters even if urban cover is 0% - - Other changes are: - - (1) only do snow balance check over active columns - - (2) fix interpinic bug (bug 1839) - - (3) newer files for testing interpinic - - - NOTE: All CLM4.5 initial conditions will need to be interpinic'ed to be - usable in this tag (this has been done for all out-of-the-box initial - conditions) - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - - 1839 (interpinic uses wrong column when there are 0-weight columns in the - input file) - - - 1840 (snow balance check is executed over inactive columns) - - - 1825 (surface datasets need urban parameters even when pcturb is 0 - everywhere): partial fix - still waiting on new USUMB dataset - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: new initial conditions for CLM4.5 - -List any changes to the defaults for the boundary datasets: new initial -conditions for CLM4.5 - -Describe any substantial timing or memory changes: - - Significant memory increases for all CLM4.5 configurations - memory is now - allocated for all natural veg landunits, all crop landunits (if using - create_crop_landunit), and most urban landunits. - - Also, significant performance decrease (~ 10%) associated with the above - change, which I believe is mainly due to decreased cache friendliness. - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: - -========= Change files used for testing interpinic, in order to use files that - are up-to-date with the current version of CLM, for a more accurate test -D models/lnd/clm/tools/clm4_5/interpinic/clmi.I2000CLM45BGC.2000-01-01.10x15_simyr2000_c130607.nc - -List all files added and what they do: - -========= Change files used for testing interpinic, in order to use files that - are up-to-date with the current version of CLM, for a more accurate test -A models/lnd/clm/tools/clm4_5/interpinic/clmi.I2000CLM45BGC.2000-01-01.10x15_simyr2000_c131104.nc - -List all existing files that have been modified, and describe the changes: - -========= Determine which grid cells should have urban landunits -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varsur.F90 -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 - -========= Create a natural veg landunit and crop landunit in all grid cells; - create an urban landunit in all grid cells for which we have - determined that urban is "valid" -M models/lnd/clm/src/clm4_5/main/subgridMod.F90 - -========= Change a comment -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 - -========= Only do snow balance check over active columns (fixes bug 1840) -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 - -========= Use new initial conditions files that are consistent with the expanded - 1-d memory structures -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Don't set soil parameters to 0 under glacier; set urban parameters - even if urban cover is 0% -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksoilMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 - -========= Fix interpinic bug (bug 1839) -M models/lnd/clm/tools/clm4_5/interpinic/src/interpinic.F90 - -========= Change files used for testing interpinic, in order to use files that - are up-to-date with the current version of CLM, for a more accurate test -M models/lnd/clm/tools/clm4_5/interpinic/interpinic.runoptions - - -========= Add two tests to the xFail list -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -+ Runs out of time. CME_Ly4.f10_f10.I1850CLM45BGC.yellowstone_intel.clm-monthly passes -+ Needs new surface dataset - - -CLM testing: - -NOTE: main tests were done with -dynlu_allocate_memory_n11_fix_cndv_time_averages_n01_clm4_5_41; tools tests with -dynlu_allocate_memory_n12_clm4_5_42; build-namelist tests with a slightly older -tag - - build-namelist tests: - - yellowstone: OK. However, the "correct" comparisons are spurious, because I - think the build-namelist test is broken - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - tools testing: - - yellowstone interactive: OK - - *** Expected failures - 027 smiS4 TSMscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional .............\c - rc=6 FAIL - 028 bliS4 TBLscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional .............\c - rc=4 FAIL - - - *** Expected baseline failure (uses new input & output file, and there is a non-bfb change in interpinic) - 016 blh54 TBLtools.sh clm4_5 interpinic tools__ds runoptions ....................................\c - rc=7 FAIL - - *** Expected diffs in PCT_SAND, PCT_CLAY, SOIL_COLOR - 012 blg54 TBLtools.sh clm4_5 mksurfdata_map tools__s namelist ...................................\c - rc=7 FAIL - 020 bli24 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds \c - rc=7 FAIL - 022 bli53 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o ....\c - rc=7 FAIL - 024 bli54 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ds ...\c - rc=7 FAIL - 026 bli57 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__do ...\c - rc=7 FAIL - - *** Expected diffs in urban fields - 030 bli74 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools_\c - rc=7 FAIL - 032 bliT4 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools_\c - rc=7 FAIL - - -CLM tag used for the baseline comparisons: clm4_5_42 - -Changes answers relative to baseline: NO - but see note below: - - NOTE: This tag has the potential to change answers for cases using initial - conditions that were interpinic'ed using the out-of-the-box interpinic, - because of bugs in interpinic. This applies to CLM4.5 cases @ ne30 and hcru - resolutions, as well as CLM4.5 cases using DV @ f09. However, no diffs showed - up in the test suite, so it's possible that this isn't a problem. - -=============================================================== -=============================================================== -Tag name: clm4_5_42 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Mon Nov 4 09:45:36 MST 2013 -One-line Summary: fix bug 1857 for CLM4.5 - CNDV running temperature means are incorrect - -Purpose of changes: - - Fix bug 1857 for CLM4.5 (not yet fixed for CLM4.0!). From the bugzilla entry: - - In this code in CNDVMod: - - do p = bounds%begp, bounds%endp - g = pft%gridcell(p) - if (kyr == 2) then ! slevis: add ".and. start_type==arb_ic" here? - tmomin20(g) = t_mo_min(p) ! NO, b/c want to be able to start dgvm - agdd20(g) = agdd(p) ! w/ clmi file from non-dgvm simulation - end if - tmomin20(g) = (19._r8 * tmomin20(g) + t_mo_min(p)) / 20._r8 - agdd20(g) = (19._r8 * agdd20(g) + agdd(p) ) / 20._r8 - end do - - Notice that this is a loop over p, but it's updating gridcell-level variables. - This means that the running temperature means aren't at all what they purport - to be. e.g., in a grid cell with the 17 natural PFTs and nothing else, the grid - cell-level values will get the 17 pft values averaged in each year, rather than - getting a single pft value per year. This means that these temperature - variables are closer to a single year's value than to a running mean. - - The fix here should be simple: just change tmomin20 & agdd20 to pft-level - variables. - - - WARNING: USE CAUTION WHEN USING THIS TAG WITH AN OLDER RESTART FILE FROM A - CLM4.5 DV CASE (this is not a problem for any out-of-the-box initial - conditions files, but could apply if you have your own initial file from a DV - run): In this case, the two DV-related variables AGDD20 and TMOMIN20 will be - reset to their arbitrary initial conditions. - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1857 - partial fix (still open for clm4.5) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEcosystemDynIniMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 - -========= Remove SSP compare_hist BFAIL from xFAIL list (Ben fixed this in the last tag) -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - All baseline comparisons pass except the following expected failure: - FAIL PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-reduceOutput.GC.104252.compare_hist.clm4_5_41 - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - All baseline comparisons pass except the following expected failure: - FAIL PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel.clm-reduceOutput.compare_hist.clm4_5_41.clm2.h0 - -CLM tag used for the baseline comparisons: clm4_5_41 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM4.5 with DV - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Definitely larger than roundoff, but not investigated as to whether it's - same climate or new climate. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_41 -Originator(s): andre (Benjamin Andre,LAWRENCE BERKELEY NATIONAL LABORATORY,510-486-4617) -Date: Wed Oct 30 17:33:16 MDT 2013 -One-line Summary: update scripts to convert clm4_5 CPP flags to namelist variables. - -Purpose of changes: Convert clm4_5 CPP flags in controlMod.F90 - into namelist variables, update scripts infrastructure - to generate cases with namelist variables for bgc - (CN, CNDV, methane, vsoilc_centbgc), crop, extra lake layers, - vic, nofire, noio, sitespf_pt, snicarfrc, maxpatch_pft. - -Requirements for tag: - -Test level of tag: regular, tools, build_namelist - -Bugs fixed (include bugzilla ID): 1728 (scripts4_20131030 tag). 1770 (clm4_5 portion). - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: removed clm4_5 CPP flags: - NOFIRE, LCH4, NITRIF, VERTSOILC, EXTRALAKELAYERS, VICHYDRO, CENTURY, CN, - CNDV, CROP, SNICAR, VANCOUVER, NOIO, MEXICOCITY - -Describe any changes made to the namelist: added namelist variables: - - use_nofire, use_lch4, use_nitrif_denitrif, use_vertsoilc, use_extralakelayers, - use_vichydro, use_century_decomp, use_cn, use_cndv, use_crop, use_snicar_frc, - use_vancouver, use_mexicocity, use_noio - - All new namelist variables are logicals. - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Erik Kluzek, Bill Sacks - -List any svn externals directories updated (csm_share, mct, etc.): scripts4_131030 - -List all files eliminated: -D models/lnd/clm/bld/config_files/config_definition.xml - split into clm4_X variants - -List all files added and what they do: -A models/lnd/clm/bld/config_files/config_definition_clm4_5.xml -A models/lnd/clm/bld/config_files/config_definition_clm4_0.xml - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - set crop=off by default to pick up correct defaults. -M models/lnd/clm/bld/configure - completely remove clm4_5 only cpp flags, add physics dependent logic to clm4_0 flags. -M models/lnd/clm/bld/queryDefaultNamelist.pl - point to physics specific config_definitions.xml file -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - replace xml special characters with alternatives so file can be parsed. Add new build-namelist failures. - -M models/lnd/clm/bld/build-namelist - add logic for all new clm4_5 namelist variables, commandline options, switch defaults to use_N. - -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - add new namelist variables - -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 - add CNNDynamicsInit() and logic to set nfix_timeconst from use_nitrif_denitrif namelist instead of CPP. -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 - convert ifdef'd parameters to variables -M models/lnd/clm/src/clm4_5/main/controlMod.F90 - final conversion of CPP flags to namelist variables - - Switch the following files to use new namelist variables for attributes: -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/2000_glacierMEC_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/20thC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850_glacierMEC_control.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp2.6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp6_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp4.5_glacierMEC_transient.xml -M models/lnd/clm/bld/namelist_files/use_cases/1850-2100_rcp8.5_glacierMEC_transient.xml - - -CLM testing: - - build-namelist tests: - - yellowstone - most tests will fail, tests need to be updated in future tag - frankfurt - - regular tests (aux_clm): - - nlcomp tests fail for all clm4_5 because of the new namelist variables. - - SSP tests should now be BFAIL, pass on next tag - - All hist comp are bit for bit. - - yellowstone_intel ok - yellowstone_pgi ok - frankfurt_intel ok - frankfurt_pgi ok - frankfurt_nag ok - - tools testing: - - yellowstone interactive - smiS4 (getregional) also fails in clm4_5_40 - frankfurt interactive - N/A - -CLM tag used for the baseline comparisons: clm4_5_40 - -Changes answers relative to baseline: None. - -=============================================================== -=============================================================== -Tag name: clm4_5_40 -Originator(s): muszala (Stefan Muszala,UCAR/TSS,303-497-1320) -Date: Thu Oct 24 07:54:46 MDT 2013 -One-line Summary: fix Bug 1752 - urban conductances depend on weights in an undesirable way - -Purpose of changes: - -Three parts to this tag. Description from Oleson: - -1) - fix Bug 1752 - modified UrbanMod.F90 to calculate -2) - add 2 new diagnostic history fields (FIRE_U, FIRE_R) - the conductances correctly. I created new variables to more clearly - distinguish between scaled and unscaled conductances. -3) - fix small bug in which the history field output of some of the - anthropogenic heat flux variables are not bfb on restart when finidat is blank. - I found this when verifying bfb for the original bug fix. The cause of this - is initialization which sets non-urban to special value, instead of zero, which - is what is desired. On restart, this initialization is not done and the history - file set_nourb=0 has precedent. A related issue is that eflx_building_heat is - not zero for pervious/impervious road when nlevurb /= nlevgrnd. - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1752 - - long test with irrigate=.true. (because irrigation likely never took effect - in the old test). - -Requirements for tag: - -Test level of tag: regular & build_namelist - -Bugs fixed (include bugzilla ID): - - 1827 / 1830: testmods don't work right for multi-instance tests (fix via - scripts update) - - 1829: PCT_SAND, PCT_CLAY and SOIL_COLOR are incorrect for some grid cells - (fix via new surface datasets) - - 1831: turning on irrigation leads to death in initialization (fix via a new - initial conditions file) - - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: see changes in boundary datasets - -List any changes to the defaults for the boundary datasets: - - - new surface datasets for all resolutions for CLM4.5: same as before except - for PCT_SAND, PCT_CLAY and SOIL_COLOR: these are no longer zeroed out under - points that are believed to be 100% glacier ("believed to be" because this - previously zeroed out some points that ended up having some other special - landunits, such as lake) - - - new initial conditions file for CLM4.5, irrigate=.true., f10 - -Describe any substantial timing or memory changes: none - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts: scripts4_131001 -> scripts4_131003 - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= new logic for irrigation for finidat -M models/lnd/clm/bld/build-namelist - -========= new surface datasets; distinguish finidat based on value of 'irriagte' -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -CLM testing: - - build-namelist tests: - - caldera: OK - The following failures were expected due to new surface datasets: - 413/439 < FAIL> - 418/439 < FAIL> - 423/439 < FAIL> - 428/439 < FAIL> - 433/439 < FAIL> - 438/439 < FAIL> - - - regular tests (aux_clm): - - edison_intel (aux_clm_ys_intel & aux_clm_ys_pgi lists): OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - edison_intel: aux_clm_ys_intel list: OK - edison_intel: aux_clm_ys_pgi list: OK - -CLM tag used for the baseline comparisons: clm4_5_35 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45 - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Not investigated carefully, but probably larger than roundoff/same climate. - - Answer changes are due to new surface datasets. This is due to fixing - bug 1829 (PCT_SAND, PCT_CLAY and SOIL_COLOR are incorrect for some grid - cells); it looks like this just affects answers over a small number of - lake points (e.g., 9 lake points in an f19 run). - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_35 -Originator(s): sacks (Bill Sacks) -Date: Tue Oct 1 09:47:45 PDT 2013 -One-line Summary: get CLM running on edison - -Purpose of changes: - - Update scripts and Machines externals to get the CLM test suite running on - edison; this will be our replacement for yellowstone while yellowstone is - down. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: N/A - -List any svn externals directories updated (csm_share, mct, etc.): - --scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_130929 --scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130927 -+scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_131001 -+scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130930b - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Remove PEM test that should pass now; add xFails for edison -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - -CLM testing: - - NOTE: Testing was done on tag port_to_edison_02_clm4_5_34. Since then, scripts - has been updated from scripts4_130930a to scripts4_131001. However, the only - difference is the removal of some duplicated tests from the test list. - - regular tests (aux_clm): - - edison_intel (aux_clm_ys_intel & aux_clm_ys_pgi lists): OK - All pass except: - - See "ERH_D.f19_g16.I1850CLM45CN.yellowstone_pgi.clm-default - Can't find user datasets - Seg fault while writing h1 file - See ERS_Ld211_D_P112x1.f10_f10.ICNCROP in yellowstone intel list - - #1 and #4 have been failing on yellowstone, #2 and #3 are new failures on edison - - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - NOTE: only generate done here, because no baselines existed - - edison_intel: aux_clm_ys_intel list: OK - edison_intel: aux_clm_ys_pgi list: OK - -CLM tag used for the baseline comparisons: clm4_5_34 - - NOTE: Baseline comparisons only done for frankfurt tests; no baseline - comparisons done with component_gen_comp, because no baselines existed on - edison. - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_34 -Originator(s): erik (Erik Kluzek) -Date: Mon Sep 30 01:30:25 MDT 2013 -One-line Summary: Get PTCLM working, fix a few small bugs - -Purpose of changes: - -Get PTCLM fully working. Allow PTCLM to work with ALL I compsets including clm4_0 compsets. -Add a new option to PTCLM from Keith Oleson --cycle_forcing to set it up to cycle over the forcing. -Another option is to build datasets in the "-mydatafiles" directory (by default under PTCLM -directory). The datasets now have creation time-stamps in them as well. Rename QIAN_tower_yrs -to -use_tower_yrs and remove QIANforcing (now chosen by compset). -scripts now has four different I1PT compsets two new ones for CLM40CN and CLM45BGC. datm -CLM_USRDAT domain file for CLM1PT forcing points to the ATM_DOMAIN_FILE/PATH. Add some new -datasets to the siteDIR from Keith Oleson. Update documenation, remove unused template dir. -Add a script to rename creation dates for map files, so you don't have to regenerate them -each day. - -Fix a few small bugs. Allow clm4_5 to have suplnitro and bgc_spinup to only give a warning -rather than die. Fix a corrupted rawdata PFT file. Fix mkscripgrid.ncl for regional SCRIP -grid creation. Remove some leftover fine-mesh variables that aren't needed anymore. Remove -reference to scaled_harvest in CLM build-namelist which was removed a long time ago. - -Remove a mapping file that didn't seem to be needed for clm4_0 mkmapdata (a default -didn't exist for it either). Add -usr_mapdir option to clm4_0 mksurfdata.pl which is needed -for PTCLM for clm4_0 compsets. - -Requirements for tag: Update scripts and get PTCLM working - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1826 (allow clm4_5 and suplnitro to be ALL for bgc_spinup) - 1818 (two new options to PTCLM) - 1762 (Fix corrupted rawdata PFT file) - 1757 (Bug in mkscripgrid.ncl for regional/global SCRIP grid creation) - 1623 (Remove some leftover fine-mesh variables _a arrays) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Allow two options to go without dying - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): scripts, Machines, datm, and csm_share - scripts to scripts4_130929 - Machines to Machines_130927 - datm to datm8_130919 - csm_share to share3_130918 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/tools/shared/mkmapdata/mkmapdata.sh ------- Remove 10x10min_IGBPmergeICESatGIS for clm4_0 - M models/lnd/clm/tools/shared/mkmapgrids/mkscripgrid.ncl --- Fix bug 1757 for regional grid creation - M models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata.pl - Add usr_mapdir option - - M models/lnd/clm/bld/build-namelist - Allow missing clm_usrdat files to continue, remove scaled_harvest (long gone) - allow bgc_spinup and suplnitro to coexist with warning - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0_tools.xml - Fix corrupted 856 raw PFT file - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5_tools.xml - Fix corrupted 856 raw PFT file, remove 1000-1004 testyrs - - M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - Remove finemesh _a variables - M models/lnd/clm/src/clm4_5/main/clmtype.F90 -------- Remove finemesh _a variables - M models/lnd/clm/src/clm4_0/main/clmtypeInitMod.F90 - Remove finemesh _a variables - M models/lnd/clm/src/clm4_0/main/clmtype.F90 -------- Remove finemesh _a variables - -CLM testing: regular, build_namelist, tools - - build-namelist tests: - - yellowstone yes - frankfurt yes - - regular tests (aux_clm): - - yellowstone_intel yes - yellowstone_pgi yes - frankfurt_intel yes - frankfurt_pgi yes - frankfurt_nag yes - - tools testing: - - yellowstone interactive yes - -CLM tag used for the baseline comparisons: clm4_5_33 - -Changes answers relative to baseline: no bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_5_33 -Originator(s): muszala (Stefan Muszala,UCAR/TSS,303-497-1320) -Date: Thu Sep 26 10:42:56 MDT 2013 -One-line Summary: clean up from mistakes in previous tag - -Purpose of changes: clean up time-stamps and a mistake in clm4_5_32 - -Requirements for tag: N/A - -Test level of tag: N/A - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: N/A - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: N/A - -CLM testing: N/A - -CLM tag used for the baseline comparisons: N/A - -Changes answers relative to baseline: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_32 -Originator(s): muszala (Stefan Muszala,UCAR/TSS,303-497-1320) -Date: Thu Sep 26 10:07:14 MDT 2013 -One-line Summary: bug fix tag - 1798, 1810 - -Purpose of changes: fix bug 1798 and 1810. - -http://bugs.cgd.ucar.edu/show_bug.cgi?id=1798 -http://bugs.cgd.ucar.edu/show_bug.cgi?id=1810 - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1798 and 1810 - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -- for bug 1798 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -- for bug 1810 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_0/main/controlMod.F90 - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel - OK - yellowstone_pgi - OK - frankfurt_intel - OK - frankfurt_pgi - OK - frankfurt_nag - OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - -CLM tag used for the baseline comparisons: clm4_5_31 - -Changes answers relative to baseline: no - -=============================================================== -=============================================================== -Tag name: clm4_5_31 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Wed Sep 25 10:12:47 MDT 2013 -One-line Summary: fix bug 1820: incomplete conditional in CNSoyfix leads to buggy results and decomposition dependence - -Purpose of changes: - - Fix bug 1820: incomplete conditional in CNSoyfix leads to buggy results and - decomposition dependence. Fix for this is based on analysis of the original - Agro-IBIS code. - -Requirements for tag: fix bug 1820, the following tests should now pass: - PET_P15x2_Lm25.f10_f10.ICLM45BGCDVCROP.yellowstone_intel - PET_P15x2_Ly3.f10_f10.ICLM45BGCCROP.yellowstone_intel - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - 1820: incomplete conditional in CNSoyfix leads to buggy results and decomposition dependence - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: Beth Drewniak, Sam Levis - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 - -========= Remove now-passing PET tests -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - -CLM tag used for the baseline comparisons: clm4_5_30 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 with CROP - - what platforms/compilers: ALL - - nature of change (roundoff; larger than roundoff/same climate; new climate): - larger than roundoff, but not investigated in detail - - Note that no changes were observed in the test suite, but this is due to - a limitation of the test suite (there are very few multi-year crop tests; - the only global multi-year tests are the newly-passing PET tests, which - don't have baselines) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_30 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Tue Sep 24 13:08:01 MDT 2013 -One-line Summary: fix performance bug in decomposition initialization - -Purpose of changes: - -Fix performance bug in decomposition initialization (bug 1771). Code mods from -Tony Craig. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1771 ( Fix for an initialization performance bug) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: - - Improves timing of initialization for high resolution casse - -Code reviewed by: tcraig - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/main/decompInitMod.F90 -M models/lnd/clm/src/clm4_0/main/decompInitMod.F90 - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - -CLM tag used for the baseline comparisons: clm4_5_29 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_29 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Tue Sep 24 10:55:42 MDT 2013 -One-line Summary: fix threading in CLM4.5, and other misc fixes - -Purpose of changes: - -(Mostly) fix threading in CLM4.5. This consisted of: - -(1) Rework initGridCellsMod to keep all points in a clump contiguous - -(2) Add info in bounds derived type (not necessary, but this allows -for more error checking and simplifies some code) - -(3) Fix which bounds are passed to reweightWrapup in initialization - -(4) Get rid of syntax like foo(:) = 0, instead using explicit bounds - -(5) Rework bounds declarations for subroutine array arguments, both in -caller (explicitly subset argument by bounds) and callee (use -assumed-shape array arguments rather than declaring upper bounds), and -add assertions on array sizes. - -See https://wiki.ucar.edu/display/ccsm/Community+Land+Model+Developers+Guide -("Guidelines for passing array arguments to subroutines") for the new -conventions that are implemented here. - -(6) Fix crop threading bug, related to nyrs (bug 1598), both in clm4.5 and clm4.0 - -However, note that there is still a crop threading bug (bug 1820), which will -need to be fixed in a separate tag. - - -Also, some unrelated changes: - -(1) Fix size of a megan variable, both in clm4.5 and clm4.0. - -(2) Remove some unused variables from Hydrology2Mod / SoilHydrologyMod - -(3) Fix some bugs in histFileMod / histFldsMod - -(4) Reorder a loop in SurfaceAlbedo to get better performance (especially with -expanded memory allocation for dynamic landunits, in an upcoming tag) - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): - - 1598 (crop threading in clm4.0 and clm4.5) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: - - Added f10 initial file for CLM4.5 BGCCROP, for testing purposes - -Describe any substantial timing or memory changes: - - Timing is currently 5-10% worse, due to calls to shr_log_errMsg, within - shr_assert calls. This should return to previous timings in non-debug runs - once shr_assert calls are ifdef'ed out in non-debug runs (this requires a - csm_share update that Sean Santos is working on). - -Code reviewed by: portions reviewed by erik - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts4_130912 -> scripts4_130916 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Significant rework to work with multiple clumps per proc -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 - -========= Add info in bounds derived type -M models/lnd/clm/src/clm4_5/main/decompMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - - also fix crop threading bug (1598) -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - - also use explicit bounds instead of things like foo(:) - -========= Remove some unused variables -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - - also other bounds-related changes as above - -========= Change 'bounds' to 'bounds_proc', use clump bounds for call to - reweightWrapup, get rid of abort if running with openMP -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 - -========= Get rid of syntax like foo(:), instead using explicit bounds -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 - -========= Rework bounds declarations for subroutine array arguments, both in - caller (explicitly subset argument by bounds) and callee (use - assumed-shape array arguments rather than declaring upper bounds), and - add assertions on array sizes -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 - - also use explicit bounds instead of things like foo(:) -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/main/dynlandMod.F90 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 - - also use explicit bounds instead of things like foo(:) -M models/lnd/clm/src/clm4_5/main/pft2colMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 - - also use explicit bounds instead of things like foo(:) -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 - - also use explicit bounds instead of things like foo(:) -M models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 - - also use explicit bounds instead of things like foo(:) -M models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 - - also remove some now-unneeded temporary arrays - - also use explicit bounds instead of things like foo(:) -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 - - also reorder a loop to get better performance -M models/lnd/clm/src/clm4_5/biogeophys/BandDiagonalMod.F90 - -========= Fix crop threading bug (1598), in both clm4.5 and clm4.0, by reworking - where nyrs is updated -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_driver.F90 - -========= Add comments -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 - -========= Fix size of a megan variable -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - - also initialize rootr, as it was in clm4_5_20 and prior -M models/lnd/clm/src/clm4_0/main/clmtypeInitMod.F90 - -========= Fix some hist file bugs: - - increase max number of characters allowed for hist field names - - when adding a field, make it work to say default='active' -- - previously, explicitly setting default='active' did the same thing - as setting default='inactive' - - change ptr_pft to ptr_col for a few column-level history variables - - remove two duplicate hist_addfld calls -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 - - also add some bounds to array arguments -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 - -========= Add f10 initial file for CLM45 BGCCROP, for testing -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Remove some PET tests from the xFail list; note that some PET tests - still fail due to bug 1820 -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - -CLM testing: - - build-namelist tests: - - yellowstone: OK - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - -CLM tag used for the baseline comparisons: clm4_5_28 - -Changes answers relative to baseline: NO, with the following minor exceptions: - - In general, no answer changes for non-threaded runs (changes answers for - threaded runs due to significant bug fixes!) - - Changes answers for CLM45 BGC CROP at f10 due to new initial conditions - (instead of cold start) - -=============================================================== -=============================================================== -Tag name: clm4_5_28 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Fri Sep 20 21:29:39 MDT 2013 -One-line Summary: fix FracH2oSfc bug - -Purpose of changes: - -Fix bug 1811: FracH2oSfc is called from within a loop over all points. Sean -Swenson realized that the offending block of code is no longer needed, so we -have removed it. - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1811 (FracH2oSfc is called from within a loop -over all points) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: Sean Swenson - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Remove the offending (and no longer needed) block of code -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -========= Remove a now-unused variable -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 - -========= Move xFail test to the right location -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - -CLM testing: - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - yellowstone_pgi: OK - - See notes below on answer changes - - -CLM tag used for the baseline comparisons: clm4_5_27 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45 cases - - what platforms/compilers: All - - nature of change: larger than roundoff/same climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - Sean Swenson performed two 20-year runs with and without the fix. His report - is: - - There are some differences, mainly in runoff, and it looks like at the 1% - level mostly, with a few scattered points showing up on the significance - plots. Other fields like latent heat, soil moisture/temperature, or water - table show even less differences. - - http://www.cgd.ucar.edu/staff/swensosc/public/diagnostics/test_frach2o-test_no_frach2o/setsIndex.html - -=============================================================== -=============================================================== -Tag name: clm4_5_27 -Originator(s): sacks (Bill Sacks,UCAR/CSEG,303-497-1762) -Date: Fri Sep 20 20:43:16 MDT 2013 -One-line Summary: fix crop nyrs bug - -Purpose of changes: Fix bug 1815 (nyrs is incorrect at the start of a crop run, -leading to incorrect GDD values for the first 20 years or so of a crop -simulation) - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): -- 1815 (nyrs is incorrect at the start of a crop run, leading to incorrect GDD -values for the first 20 years or so of a crop simulation) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None (but see changes to boundary -datasets below) - -List any changes to the defaults for the boundary datasets: - - New crop initial conditions for CLM4.5 BGCCROP @ f19 - same as old dataset, - but with restyear changed from 1 to 0 - -Describe any substantial timing or memory changes: None - -Code reviewed by: slevis - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Don't increment nyrs on the first timestep of a startup run, so that - nyrs is correctly 0 rather than 1 for the first year -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CNPhenologyMod.F90 - -========= New crop initial conditions for CLM4.5 BGCCROP @ f19 - same as old dataset, - but with restyear changed from 1 to 0 -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= add test that sometimes runs out of time, move test from - yellowstone_intel to yellowstone_pgi -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -CLM testing: - - build-namelist tests: - - yellowstone: OK - - regular tests (aux_clm): - - yellowstone_intel: OK - yellowstone_pgi: OK - frankfurt_intel: OK - frankfurt_pgi: OK - frankfurt_nag: OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: OK - - expected diffs in SMS_Ly1.f19_g16.ICLM45BGCCROP.yellowstone_intel - - baselines messed up for - ERS_Ly5.f10_f10.I20TRCRUCLM45BGC.yellowstone_intel, so comparison not - done for that test - yellowstone_pgi: NO BASELINES, SO COMPARISONS NOT RUN - -CLM tag used for the baseline comparisons: clm4_5_27 - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All crop cases (clm4.0 or clm4.5) that either - use arbitrary initial conditions or use the clm4.5 out-of-the-box initial - conditions for BGCCROP @ f19 - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new - climate): new climate - - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - Sam Levis examined a 3-year run with arbitrary initial conditions, and - verified that crop LAI is much more realistic in the new simulation - (previously, crop LAI was near-zero for the first few years) - -=============================================================== -=============================================================== -Tag name: clm4_5_26 -Originator(s): muszala (Stefan Muszala) -Date: Thu Sep 19 17:07:11 MDT 2013 -One-line Summary: water balance and SMS_Ly1.f19_g16.ICLM45BGCCROP fix - -Purpose of changes: 1) Fix water balance error in f09_g16 I1850CRUCLM45BGC simulation - 2) Get all machine/compiler combinations of - SMS_Ly1.f19_g16.ICLM45BGCCROP working - - this fix required (1) and a fix to fthresh in RtmFloodInit - - new RTM tag rtm1_0_32 to go along with this - - PGI+frankfurt version of this test only work with 16 MPI processes - -Requirements for tag: N/A - -Test level of tag: regular - -Bugs fixed (include bugzilla ID):1808 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: S. Swenson, D. Lawrence - -List any svn externals directories updated (csm_share, mct, etc.): rtm1_0_32 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -Index: models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -=================================================================== ---- models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 (revision 51190) -+++ models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 (working copy) -@@ -1110,15 +1110,8 @@ - do j = 1, nlevsoi - if(h2osoi_liq(c,j)<0._r8)then - qflx_deficit(c) = qflx_deficit(c) - h2osoi_liq(c,j) -- h2osoi_liq(c,j) = 0._r8 - endif - enddo -- !reduce qcharge if necessary -- !ideally, I can set qflx_deficit as a local variable, but it is helpful -- !to diagnose the problem associated with the solver for the richards' equation. -- if(qflx_deficit(c)>0._r8)then -- qcharge(c) = qcharge(c) - qflx_deficit(c)/dtime -- endif - enddo - - end associate -@@ -1892,9 +1885,12 @@ - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) -- xs1(c) = max(max(h2osoi_liq(c,1),0._r8)-max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1))),0._r8) -- h2osoi_liq(c,1) = min(max(0._r8,pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1)), h2osoi_liq(c,1)) - -+ !scs: watmin addition to fix water balance errors -+ xs1(c) = max(max(h2osoi_liq(c,1)-watmin,0._r8)- & -+ max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1)-watmin)),0._r8) -+ h2osoi_liq(c,1) = h2osoi_liq(c,1) - xs1(c) -+ - if (urbpoi(clandunit(c))) then - qflx_rsub_sat(c) = xs1(c) / dtime - else - -CLM testing: - -- general note: for clm45 compsets-both clm and cpl history files change - -- specfic testing for these bug fixes: - -1) Water balance fix-ran a clone of run from Dave Lawrence: - -- create_newcase -compset I1850CRUCLM45BGC -res f09_g16 -mach yellowstone -case /glade/u/home/dlawren/expts/clm4.5/clm45bgc_1deg4519_1850spin_bd - -- this ran for over 25 years with no water balance errors. - -2) SMS_Ly1.f19_g16.ICLM45BGCCROP - -PASS SMS_Ly1.f19_g16.ICLM45BGCCROP.yellowstone_intel.clm-reduceOutput.115612 -PASS SMS_Ly1.f19_g16.ICLM45BGCCROP.yellowstone_pgi.clm-reduceOutput.115522 - -PASS SMS_Ly1.f19_g16.ICLM45BGCCROP.frankfurt_intel.clm-reduceOutput.115217 -PASS SMS_Ly1_Mmpich.f19_g16.ICLM45BGCCROP.frankfurt_nag.clm-reduceOutput.120824 -PASS SMS_Ly1.f19_g16.ICLM45BGCCROP.frankfurt_pgi.clm-reduceOutput.016 -- only with 16 MPI tasks - -3) To make sure the RTM refactor did not create any BFB changes, I ran SMS_D.f19_g16.ICLM45BGCCROP.yellowstone_intel - with rtm1_0_31 and rivrtm/branch_tags/bcf_tags/bcf_02_rtm1_0_31. - - With flood_mode='NULL' - Coupler and land history files were BFB. - - With flood_mode='ACTIVE' - Coupler, rtm and land history files were BFB. - - build-namelist tests: N/A - - regular tests (aux_clm): - - yellowstone_intel - OK - changes in cpl. hist files expected - yellowstone_pgi - OK - changes in cpl. hist files expected - frankfurt_intel - OK - changes in cpl. hist files expected - frankfurt_pgi - OK - changes in cpl. hist files expected - frankfurt_nag - OK - changes in cpl. hist files expected - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel - OK - changes in clm fields expected. - -CLM tag used for the baseline comparisons: clm4_5_25 - -Changes answers relative to baseline: Yes. For CLM45 compsets. All changes are from the SoilHydrology mods -as the RTM refactor and fthresh fix are BFB. - -Coupler history fields that change: - -l2x_Sl_avsdr, l2x_Sl_anidr, l2x_Sl_avsdf, l2x_Sl_anidf, l2x_Sl_tref, l2x_Sl_qref, -l2x_Sl_t, l2x_Sl_fv, l2x_Sl_ram1, l2x_Sl_snowh, l2x_Sl_u10, l2x_Fall_swnet, -l2x_Fall_taux, l2x_Fall_tauy, l2x_Fall_lat, l2x_Fall_sen, l2x_Fall_lwup, -l2x_Fall_evap, l2x_Fall_flxdst1, l2x_Fall_flxdst2, l2x_Fall_flxdst3, l2x_Fall_flxdst4, -l2x_Flrl_rofl, l2x_Fall_voc001, l2x_Fall_voc002, l2x_Fall_voc003, l2x_Fall_voc004, -l2x_Fall_voc005, l2x_Fall_voc006, l2x_Fall_voc007, l2x_Fall_voc008, x2l_Flrr_volr, -r2x_Forr_rofl, r2x_Forr_rofi, r2x_Flrr_volr, x2r_Flrl_rofl - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: CLM45 compsets - - what platforms/compilers: All - -=============================================================== -=============================================================== -Tag name: clm4_5_25 -Originator(s): erik (Erik Kluzek) -Date: Fri Sep 13 13:49:45 MDT 2013 -One-line Summary: Bring in Tony's changes to kick sno all the way up to the coupler layer, makes all - CESM components more similar to each other - -Purpose of changes: - Bring in Tony's cplupa branch (cplupa_n06_clm4_5_24) to trunk. This branch moves sno - fields all the way to the top coupler layer rather than being inside of CLM. This makes all - CESM components more similar to each other. - - There was also some small fixes on the side that allow some more tests to work. - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1789 (fix NoVSNoNI test) - 1788 (fix US-UMB test) - 1779 (fix RTM multi-instance) - 1777 (fix RTM branch cases) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: Add new CPP token to CLM USE_ESMF_METADATA (with no direct machanism to use) - We hate CPP tokens (but had to let this go, only needed by ESMF development folks) - -Describe any changes made to the namelist: drv namelist changes, no changes to CLM namelist - -List any changes to the defaults for the boundary datasets: CLM_USRDAT fsurdat files different directory for clm4_0 than clm4_5 - remove missing ne16np4 fpftdyn file - -Describe any substantial timing or memory changes: - -Code reviewed by: self, tcraig - -List any svn externals directories updated (csm_share, mct, etc.):, scripts, drv, cism, rtm, csm_share, data and stub models - - scripts to scripts4_130912 - drv to drvseq4_3_03 - datm to datm8_130424 - socn/sice/sglc/swav to stubs1_4_02 - rtm to rtm1_0_31 - cism to cism1_130905 - csm_share to share3_130906 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/unit_testers/build-namelist_test.pl ------------ Remove ne16 20thC test - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml ---- Remove missing ne16 fpftdyn file - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Different directory for - clm4_0/clm4_5 surface datasets - - M models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 - Field names change - M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 ------ Remove "sno" and "s" fields - M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 ---- Remove rofi/rofl - M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 ---- Remove "sno" and "s" fields, add USE_ESMF_METADATA #ifdef - M models/lnd/clm/src/cpl_esmf/lnd_comp_mct.F90 ----- Remove "sno" and "s" fields, add USE_ESMF_METADATA #ifdef - M models/lnd/clm/src/clm4_0/main/clm_glclnd.F90 ---- Remove rofi/rofl - -CLM testing: regular - - build-namelist tests: - - bluefire yes - frankfurt yes - - regular tests (aux_clm): - - yellowstone_intel yes - yellowstone_pgi yes - frankfurt_intel yes - frankfurt_pgi yes - frankfurt_nag yes - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel partial (not completed before tag made) - yellowstone_pgi partial (not completed before tag made) - -CLM tag used for the baseline comparisons: clm4_5_24 - -Changes answers relative to baseline: None (bit-for-bit) - - Although my "I compset" testing showed no changes, fully coupled changes - do show differences. Coupler namelists also change. - -=============================================================== -=============================================================== -Tag name: clm4_5_24 -Originator(s): sacks (sacks) -Date: Tue Sep 3 21:36:13 MDT 2013 -One-line Summary: update externals to cesm1_3_beta02 or later - -Purpose of changes: - -Update externals to cesm1_3_beta02 or later - - -Requirements for tag: - -Test level of tag: regular - -Bugs fixed (include bugzilla ID): 1722 (Test failure with VIC and more_vertlayers) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: Not investigated - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - - scripts : scripts4_130816 -> scripts4_130830a - Machines : Machines_130529 -> Machines_130830 - drv : drvseq4_2_33 -> drvseq4_2_35 - cism : cism1_130502 -> cism1_130624 - csm_share : share3_130528 -> share3_130723 - timing : timing_130417 -> timing_130506 - mct : compiler_fixes_n01_MCT_2.8.3 -> compiler_fixes_n03_MCT_2.8.3 - mapping : mapping_130509 -> mapping_130716 - gen_domain : mapping_130509/gen_domain_files -> mapping_130716/gen_domain_files - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Remove trailing whitespace -M .ChangeLog_template - - -Index: models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -=================================================================== ---- models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml (revision 50759) -+++ models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml (working copy) -@@ -51,17 +51,14 @@ - - - use before define in history. runs with frankfurt_pgi, yellowstone_intel and yellowstone_pgi -- floating point exception. problem with VIC combined with vertical layers - once threading fixed, this should pass - once threading fixed, this should pass -- core dumps in ref1. Problems with vertical layers. Run without clm-vrtlay and clm-default and it runs - starting in clm4_5_07--The cpl.hi.nc file is not being copied on a generate like it should. - Cannot turn clm4me mode on -- without clm4_5 physics! problem in scripts4_130809b - - -- Problem with scripts and testId string length. This passes with a long testId -+ Problem with scripts and testId string length. This passes with a long testId - Restart not BFB. Runs as ERH_D.f19_g16.I1850CLM45CN.yellowstone_pgi -- floating point exception. problem with VIC combined with vertical layers - once threading fixed, this should pass - once threading fixed, this should pass - once threading fixed, this should pass -@@ -78,7 +75,7 @@ - Water balance errors followed by "negative conc. in ch4tran", then tries "-10^-12 < smin_nh4 < 0. resetting to zero.", then it exits at approximately 9 months. This same test passes with yellowstone_intel and frankfurt_intel - - -- CMake 2.8.6 or higher is required. You are running version 2.6.4 -+ Problem with cism build - Fails after reading clmforc.Li_2012_hdm_0.5x0.5_AVHRR_simyr1850-2010_c130401.nc. This same test passes with yellowstone_intel, yellowstone_pgi, frankfurt_intel and frankfurt_nag - Fails after reading clmforc.Li_2012_hdm_0.5x0.5_AVHRR_simyr1850-2010_c130401.nc. This same test passes with yellowstone_intel, yellowstone_pgi, frankfurt_intel and frankfurt_nag - Fails after reading clmforc.Li_2012_hdm_0.5x0.5_AVHRR_simyr1850-2010_c130401.nc. This same test passes with yellowstone_intel - - -CLM testing: - - build-namelist tests: - - yellowstone: YES - All PASS or xFAIL - - regular tests (aux_clm): - - yellowstone_intel: YES - yellowstone_pgi: YES - frankfurt_intel: YES - frankfurt_pgi: YES - frankfurt_nag: YES - - All PASS or xFAIL - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel: YES - All PASS except for the following newly-passing tests (for - which these failures are unsurprising): - - BFAIL2 ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_23.clm2.h0 (baseline history file does not exist) - BFAIL2 ERI_D.ne30_g16.ICLM45BGC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_23.clm2.h1 (baseline history file does not exist) - FAIL ERS_D.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_23.clm2.h0 - FAIL ERS_D.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_23.clm2.h1 - - yellowstone_pgi: YES - Some answer changes (presumably due to compiler change) - -CLM tag used for the baseline comparisons: clm4_5_23 - Note: renamed baselines for frankfurt nag because test names have changed - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: - - what platforms/compilers: - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - compsets using cism change answers for g2x gields - - many tests change answers with pgi, both on yellowstone & - frankfurt, presumably due to new compiler - - nature of change not investigated - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_23 -Originator(s): muszala (Stefan Muszala) -Date: Thu Aug 22 09:42:43 MDT 2013 -One-line Summary: refactor to allow CH4 params. to be read from netcdf file and clean up clm4_5_20 - -Purpose of changes: - The second of two tags that brings in parameters that are read from netcdf file (ch4 parameters). Please - see the ChangeLog entry for clm4_5_20. - - - Bring in ch4 parameters - - Combine fconsts file and fpftcon file. New file name is paramfile (clm_params.c130821.nc) - - Refactor so that types, subroutine names and type instances have the names params in them (instead of consts) - - Remove many ch4 namelist vars. since they are now read from the param file - - Add new namelist called use_aereoxid_prog to control old aereoxid namelist - - A bulk of this work was completed by Rajendra Paudel. - -Requirements for tag: N/A - -Test level of tag: regular and build_namelist - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: remove many optional ch4 namelists. - add new namelist valled use_aereoxid_prog. - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, dlawren, Rajendra Paudel - -List any svn externals directories updated (csm_share, mct, etc.): scripts4_130730 -> scripts4_130816 - -List all files eliminated: - -- these were renamed -models/lnd/clm/src/clm4_5/biogeochem/CNSharedConstsMod.F90 -models/lnd/clm/src/clm4_5/main/readConstantsMod.F90 - -List all files added and what they do: - -- renamed -models/lnd/clm/src/clm4_5/biogeochem/CNSharedParamsMod.F90 -models/lnd/clm/src/clm4_5/main/readParamsMod.F90 - -List all existing files that have been modified, and describe the changes: - -- refactor to remove old namelist vars. for ch4 and add new functionality -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -- put in ch4 parameters and refactor const->params names -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4varcon.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeBGCMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeCNMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 -M models/lnd/clm/src/clm4_5/biogeophys/initSLakeMod.F90 - -CLM testing: - - build-namelist tests: - - yellowstone: OK. Some changes to phys45 and phys45-crop. Should be OK in next tag. - - regular tests (aux_clm): A few nlcomp differences that will go away in the next tag. - Other than a few expected failures due to new scripts entries, all OK. - - yellowstone_intel OK - yellowstone_pgi OK - frankfurt_intel OK - frankfurt_pgi OK - frankfurt_nag OK - - history file comparison with component_gen_comp and summarize_cprnc_diffs: - - yellowstone_intel OK - yellowstone_pgi OK - -CLM tag used for the baseline comparisons: clm4_5_22 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_22 -Originator(s): muszala (Stefan Muszala) -Date: Tue Jul 30 15:22:51 MDT 2013 -One-line Summary: aux_clm testlist reorganization - -Purpose of changes: - - Reorganize all aux_clm tests and fix new failing tests. As part of - this, bring in a change from Maoyi for VIC w/vertical layers. - A few bug fixes to get new tests working. - Why did we do this? - - 1) better balance between frankfurt, yellowstone and various compilers - 2) faster turn around time for development - 3) make sure current science functionality is properly tested - 4) removed outdated / irrelevant tests - - Other points: - - 1) Introduce regular and short test list. Testing now can consist of: - - a) regular (must be run before handing off a tag to SEs and must be run - before committing a tag) - b) build_namelist (if namelists and/or build_system changed)) - c) tools (only if tools are modified and no CLM source is modified) - d) short (for use during development and in rare cases where only a small - change with known behavior is added ... eg. a minor bug fix) - e) doc (no source testing required) - - 2) PET tests will fail until threading is fixed in CLM - -Requirements for tag: N/A - -Test level of tag: regular. ran tests with old testlists to double check any new mods. - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: add no-vert:no-nitrif option to configure - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self. Extensive discussion regaring list content with Lawrence, - Sacks, Kluzek and Andre. - -List any svn externals directories updated (csm_share, mct, etc.): new scripts - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -- add no-vert:no-nitrif option -M models/lnd/clm/bld/configure -M models/lnd/clm/bld/config_files/config_definition.xml -- Update expected failures -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -- Maoyi VIC+vertical layers fix -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -- Update change log template -M .ChangeLog_template -- Change intent out to inout for ciso_flux -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -- Remove crop_prog check to get rid of unassociated pointer with NAG -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -- Fix bounds type error (should be intent=in) -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 - -Machines testing ran on: (Tests in priority order) - - Note: - - 1) All PET tests will fail until openMP is fixed. - 2) All IG compsets fail with the NAG compiler due to non-compliant f77 code. - 3) If one combination fails, it's backed up with a another combination that passes. - There are one or two exceptions to this. - - I) aux_clm tests with old testlists: - - yellowstone/aux_clm intel - OK - yellowstone/aux_clm pgi - OK - frankfurt/aux_clm intel - OK - frankfurt/aux_clm pgi - OK - frankfurt/aux_clm nag - OK - - CESM history file comparison: - - yellowstone/aux_clm intel - OK - - II) aux_clm tests with new testlists: - - yellowstone/aux_clm intel - OK - yellowstone/aux_clm pgi - OK - frankfurt/aux_clm intel - OK - frankfurt/aux_clm pgi - OK - frankfurt/aux_clm nag - OK - - III) aux_clm_short tests with new testlists: - - yellowstone/aux_clm intel - OK - yellowstone/aux_clm pgi - OK - frankfurt/aux_clm intel - OK - frankfurt/aux_clm pgi - OK - frankfurt/aux_clm nag - OK - - CESM history file comparison: Not run since no baseline comparisons. - -CLM tag used for the baseline comparison tests if applicable: CLM4_5_21 with old testlist. Only ran generate with new testlists. - -Changes answers relative to baseline: Only for VIC with vertical layers. - -=============================================================== -=============================================================== -Tag name: clm4_5_21 -Originator(s): muszala (Stefan Muszala) -Date: Wed Jul 24 14:23:19 MDT 2013 -One-line Summary: ifdef and bounds refactor - -Purpose of changes: -- Almost all implementation by Mvertens -- Refactor ifdef use so that a majority are now in controlMod.F90. This is the -first step to removing them competely. -- Introduction of bounds_type and clump_type -- Refactor interfaces to support bounds_type and clump_type -- Bug fix from Sacks - -Also: Changed layout of landunit, column and pft-level arrays: Previously, all -points for a given grid cell were grouped together. Now, all points for a given -landunit type are grouped together. This improves performance of loops over -filters, because it leads to more memory locality – this will be especially true -when we add more 0-weight points to arrays for the purpose of dynamic -landunits. For example, if a processor has 2 grid cells and there are 3 landunit -types: - -Old layout in memory: (G1L1, G1L2, G1L3, G2L1, G2L2, G2L3) -New layout in memory: (G1L1, G2L1, G1L2, G2L2, G1L3, G2L3) - - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: mvertens, sacks, self - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: - -D models/lnd/clm/src/util_share/decompInitMod.F90 -D models/lnd/clm/src/util_share/ndepStreamMod.F90 -D models/lnd/clm/src/util_share/decompMod.F90 -D models/lnd/clm/src/clm4_5/main/initParametersMod.F90 - -List all files added and what they do: - -A + models/lnd/clm/src/clm4_5/main/decompInitMod.F90 -A + models/lnd/clm/src/clm4_5/main/ndepStreamMod.F90 -A + models/lnd/clm/src/clm4_5/main/decompMod.F90 -A + models/lnd/clm/src/clm4_0/main/decompInitMod.F90 -A + models/lnd/clm/src/clm4_0/main/ndepStreamMod.F90 -A + models/lnd/clm/src/clm4_0/main/decompMod.F90 - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/doc/ChangeLog -M models/lnd/clm/doc/ChangeSum -M models/lnd/clm/src/cpl_share/clm_cpl_indices.F90 -M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/initch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/MEGANFactorsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4RestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNWoodProductsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVLightMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4varcon.F90 -M models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEcosystemDynIniMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeBGCMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeCNMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSharedConstsMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 -M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -M models/lnd/clm/src/clm4_5/main/dynlandMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/pft2colMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/clm_varsur.F90 -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -M models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -M models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -M models/lnd/clm/src/clm4_5/main/readConstantsMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 -M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/QSatMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/initSLakeMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FracWetMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BandDiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 -M models/lnd/clm/src/clm4_0/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_0/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_0/main/controlMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_varctl.F90 -M models/lnd/clm/src/clm4_0/main/clm_driver.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: Not run - - CESM test lists: - - yellowstone/aux_clm intel BFB - yellowstone/aux_clm pgi BFB - frankfurt/aux_clm intel BFB - frankfurt/aux_clm pgi BFB - frankfurt/aux_clm nag BFB - - CESM history file comparison: - - yellowstone/aux_clm intel BFB - -CLM tag used for the baseline comparison tests if applicable: clm4_5_20 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_20 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Sat Jul 20 10:54:43 MDT 2013 -One-line Summary: refactor to allow CN and BGC params. to be read from netcdf file - -Purpose of changes: - -The first of two tags that allows all parameters to be read from a netcdf file to -provide sensitivity analysis capability, to increase modularity of code and to -remove "magic numbers" from code. This tag introduces a new namelist variable -"fconsts" which points to a netcdf file of CN and BGC parameters. In a future -tag, this netcdf file will be combined with CH4 parameters and PFT parameters. - -Values are read in readConstantsMod.F90. Each module that requires -a parameter provides a read subroutine. That read subroutine is called -from readConstantsMod.F90 and places parameters into a private type -for that module. For example, CNDecompMod.F90 provides readCNDecompConsts which -is called from readConstantsMod and populates the type instance CNConstShareInst. -CHConstShareInst is then used in CNDecompMod as: - -+ sminn_to_denit_decomp_cascade_vr(c,j,k) = -CNDecompConstInst%dnp * pmnf_decomp_cascade(c,j,k - -which replaces: - -- dnp = 0.01_r8 -... -- sminn_to_denit_decomp_cascade_vr(c,j,k) = -dnp * pmnf_decomp_cascade(c,j,k) - -A bulk of this work was completed by Rajendra Paudel. - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: new namelist variable called fconsts. - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, D. Lawrence, R. Paudel. (for design: discussion w/ mvertens, sacks, kluzek) - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: - -Renamed -D models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_BGC.F90 -D models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_CENTURY.F90 - -List all files added and what they do: - -Rename of Deleted files -A + models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeBGCMod.F90 -A + models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeCNMod.F90 - -Module to read parameters shared by multiple modules -A + models/lnd/clm/src/clm4_5/biogeochem/CNSharedConstsMod.F90 - -Module that reads shared an private parameters -A + models/lnd/clm/src/clm4_5/main/readConstantsMod.F90 - -List all existing files that have been modified, and describe the changes: - -Add fconsts namelist variable -M models/lnd/clm/bld/build-namelist -M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -Add in functionality to read parameters off of netcdf file -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK. These FAILs should pass next round: - - 418/444 < FAIL> - 423/444 < FAIL> - 428/444 < FAIL> - 433/444 < FAIL> - 438/444 < FAIL> - 443/444 < FAIL> - - CESM test lists: - -CLM45 compsets have failures for nlcomp due to the introduction of fconsts namelist variable. -For example: - -FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.test20Pgi.nlcomp -FAIL ERH_D.f19_g16.I1850CLM45CN.yellowstone_intel.GC.test20Intel.nlcomp - - yellowstone/aux_clm intel OK - yellowstone/aux_clm pgi OK - frankfurt/aux_clm intel OK - frankfurt/aux_clm pgi OK - frankfurt/aux_clm nag OK - - CLM history file comparison: - - yellowstone/aux_clm intel OK - -CLM tag used for the baseline comparison tests if applicable: clm4_5_19 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_19 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Wed Jul 17 14:29:32 MDT 2013 -One-line Summary: fix setting of bd in iniTimeConst - -Purpose of changes: - -In iniTimeConst, bd (bulk density) was being set incorrectly, so that, -for a given processor, the same value was being put in all (c,j) -locations. In addition to being incorrect, this meant that results -differed depending on processor count. This tag fixes this problem. - -This only affects CLM4.5 BGC runs, because the bd array is only used -in CNNitrifDenitrifMod.F90. (However, as a side note: This array -SHOULD be used in DUSTMod and initSLakeMod, which currently recompute -bd.) - - -Requirements for tag: - -Test level of tag: - -Bugs fixed (include bugzilla ID): - 1736 (bd set incorrectly in iniTimeConst, leads to results that depend on processor count) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: mvertens - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 - - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: NO - - CESM test lists: - - yellowstone/aux_clm intel yes *** - All PASS or xFAIL - yellowstone/aux_clm pgi yes - All PASS - frankfurt/aux_clm intel yes ** - All PASS - frankfurt/aux_clm pgi yes - All PASS - frankfurt/aux_clm nag yes - All PASS - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel yes ** - All PASS or BFAIL1 except CLM45BGC comparisons - - test_driver.sh tools testing: - - yellowstone interactive: no - frankfurt interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_5_18 - -Changes answers relative to baseline: YES - -IF tag changes answers relative to baseline comparison the -following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All CLM45BGC - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Larger than roundoff; still to be determined if this gives new - climate (Dave Lawrence will run a simulation to determine this) - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: (Not yet done) - - URL for LMWG diagnostics output used to validate new climate: (Not - yet done) - -=============================================================== -=============================================================== -Tag name: clm4_5_18 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Tue Jul 9 10:07:08 MDT 2013 -One-line Summary: rework urban indexing - -Purpose of changes: - -Change urban derived type and local variables in UrbanMod subroutines to go -lbl:ubl rather than 1:num_urbanl. There are a few reasons for this: (1) this -works better when the urban filter can change (with dynamic landunits), (2) more -consistency with the rest of the CLM code, (3) no longer have to remember -whether a given variable should be indexed by fl or l. The downside is that it -leads to slightly greater memory use. - -Along with doing this, I also changed a few loops in UrbanMod to be simpler -(which is allowed with the above change). - -Also, no longer run over 0-weight urban columns - we don't have to do this any -more now that I have reworked some loops in UrbanMod. - - -Requirements for tag: - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: - - Increase in memory use by UrbanMod, which should lead to a small overall - memory increase - though this doesn't show up in most memcomp tests, showing - that the increase is pretty small. - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Major changes to indexing: local variables now dimensioned lbl:ubl - rather than 1:num_urbanl. Also, remove canyon_hwr, wtroad_perv, - ht_roof and wtlunit_roof from urban_params, because there are - duplicate variables in clmtype. -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 - -========= No longer make 0-weight urban columns active -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -========= Remove unused wind_hgt_canyon from clmtype -M models/lnd/clm/src/clm4_5/main/clmtype.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 - -========= Minor changes for new UrbanMod interfaces -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - - - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - - build-namelist unit tester: NO - - CESM test lists: - - yellowstone/aux_clm intel yes *** - All PASS or xFAIL - yellowstone/aux_clm pgi yes ** - All PASS - frankfurt/aux_clm intel yes ** - All PASS - frankfurt/aux_clm pgi yes - All PASS, except the following, which appears to be a system problem: - FAIL ERI_D.f19_g16.ICLM45.frankfurt_pgi.GC.214513 - I will rerun the above test once the system problem is resolved - frankfurt/aux_clm nag yes - All PASS - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel yes ** - All PASS or BFAIL, except the following expected failures: - - *** Expected failures because of failures in the base tests - FAIL ERS.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_17.clm2.h0 - FAIL ERS.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS_Ld211_D_P112x1.f10_f10.ICNCROP.yellowstone_intel.clm-crop.compare_hist.clm4_5_17.clm2.h0 (no history file in test case) - - *** Expected differences in cols1d_active and pfts1d_active, as well as - FILLDIFFs, due to making 0-weight urban columns no longer active - FAIL ERI_D.f10_f10.ICLM45BGC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS_D.f10_f10.ICLM45BGCNoVS.yellowstone_intel.clm-rootlit.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_intel.clm-ch4_set2_ciso.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_intel.clm-ch4_set3_pftroot.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.compare_hist.clm4_5_17.clm2.h1 - FAIL ERS_Ld3_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel.clm-default.compare_hist.clm4_5_17.clm2.h1 - FAIL SSP.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default.compare_hist.clm4_5_17.clm2.h1 - - - test_driver.sh tools testing: - - yellowstone interactive: no - frankfurt interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_5_17 - -Changes answers relative to baseline: NO, except for inconsequential changes in -1-d hist files (cols1d_active, pfts1d_active, and some FILLDIFFS, due to making -0-weight urban columns no longer active) - -=============================================================== -=============================================================== -Tag name: clm4_5_17 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Wed Jul 3 10:54:03 MDT 2013 -One-line Summary: misc cleanup and bug fixes - -Purpose of changes: - -Bit-for-bit cleanup following from tag clm4_5_11. The biggest change is the -removal of maxpatch, npatch_* and some related variables from clm_varpar (these -were maintenance headaches). - - -Requirements for tag: - -Test level of tag: standard + tools - -Bugs fixed (include bugzilla ID): - - 1747 (need 1x1_tropicAtl datasets) - 1754 (mksurfdata_map problem making CH4 parameters for ne240 CLM4.5 surface dataset) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: New 1x1_tropicAtl datasets - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - -========= Remove maxpatch, npatch_* and a few related variables that are no - longer needed (these variables were a maintenance headache) -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 - -========= Rework code to not require the variables that were removed from clm_varpar -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90 - -========= Remove unneeded 'use' statements -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 - -========= Allow roundoff-level errors (needed to make ne240 dataset) -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkCH4inversionMod.F90 - -========= Fix generation of 1x1_tropicAtl datasets -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - -========= New 1x1_tropicAtl datasets -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - - - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - - build-namelist unit tester: yes - All PASS or xFAIL - - CESM test lists: - - yellowstone/aux_clm intel yes *** - All PASS or xFAIL - yellowstone/aux_clm pgi yes ** - All PASS - frankfurt/aux_clm intel yes ** - All PASS - frankfurt/aux_clm pgi yes - All PASS - frankfurt/aux_clm nag yes - All PASS - - Additional tests (with comparison to clm4_5_16, including - component_gen_comp; for the FARM test, used a sandbox corresponding to - cesm1_3_alpha01a for components other than CLM): - - ERS_Ly5.f10_f10.I20TRCRUCLM45BGC.yellowstone_intel.clm-monthly_noinitial - SMS.T42_T42.FARM95C4.yellowstone_intel.clm-daily - [the clm-daily nl dir just sets hist_nhtfrq = -24] - - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel yes ** - All PASS or BFAIL1, except irrelevant failures from this failing test: - FAIL ERS.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_16.clm2.h0 - FAIL ERS.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_16.clm2.h1 - - test_driver.sh tools testing: - - yellowstone interactive: yes - All PASS except expected failures: - - 027 smiS4 TSMscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional .............\c - rc=6 FAIL - 028 bliS4 TBLscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional .............\c - rc=4 FAIL - - - frankfurt interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_5_16 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_16 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Tue Jul 2 09:22:41 MDT 2013 -One-line Summary: only run filters over 'active' points - -Purpose of changes: - -In preparation for dynamic landunits, we only want to run most filters over -'active' points. This required changing landunit and column-level filters to -only run over active points. In addition, I changed the nourbanp filter to only -run over active points (in contrast to other pft-level filters, this filter had -previously operated over non-active points, too). - -In addition, this tag includes some related changes, most of which were required -to get the code to run correctly in light of the above changes. Some of these -changes - in particular, the changes to reweightMod, filterMod, and the use of -the new filter_inactive_and_active in some places - effectively undid that -general filter change for select landunits (urban) or subroutine calls. - - -Requirements for tag: - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: none - -Describe any changes made to the namelist: none - -List any changes to the defaults for the boundary datasets: none - -Describe any substantial timing or memory changes: none - -Code reviewed by: changes to filterMod reviewed by erik, mvertens, - stefan, dave lawrence & ben andre; other changes - only by self - -List any svn externals directories updated (csm_share, mct, etc.): none - -List all files eliminated: none - -List all files added and what they do: none - -List all existing files that have been modified, and describe the changes: - -========= Change main filters to just run over active points; add new filters - that include inactive as well as active points; refactor subroutines - to avoid code duplication now that we have two groups of filters -M models/lnd/clm/src/clm4_5/main/filterMod.F90 - -========= Change filter to just run over active points -M models/lnd/clm/src/clm4_5/main/pft2colMod.F90 - -========= Change urban columns & pfts to be active whenever their landunit is - active (to avoid making urban code messier) -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -========= Get rid of wt > 0 checks, which are no longer appropriate in the code - (checks of the active flags should be done instead - and these have - been folded in to the filters) -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 - -========= Make a loop more consistent in its use of a filter; remove undesirable - pactive check (because decomp_vertprofiles now sometimes operates on - inactive as well as active points) -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 - -========= Use filters that include inactive points in call to - decomp_vertprofiles (this is needed because of the unusual placement - of this routine in the driver sequence) -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - -========= Use filters that include inactive points in calls to SurfaceAlbedo and - UrbanAlbedo. For SurfaceAlbedo, this is necessary to avoid floating - point exceptions in transient cases; for UrbanAlbedo, this probably - isn't necessary now, but likely will be needed when we have dynamic - landunits, for the same reason that we need it for SurfaceAlbedo. -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 - -========= Remove pactive check in setting up vegsol / novegsol filters - as far - as I can tell, this check is now unnecessary, and it led to the odd - result that novegsol included all inactive points (e.g., even inactive - istsoil points). Also add some comments and remove some obsolete - comments. -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 - -========= Remove pactive checks that are unnecessary now that the nourbanp - definition has changed -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 - -========= Only check errsoi_col on active columns (to prevent NaN-related - problems in crop runs) -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 - -========= Add comments -M models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -M models/lnd/clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 - - - - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - All PASS or xFAIL - - CESM test lists: - - yellowstone/aux_clm intel yes - All PASS or xFail - - Also ran the following, which PASSes (also PASSes cpl & clm - hist comparisons, except for expected failures in .h1 file - comparisons, as below): - ERS_Ly5.f10_f10.I20TRCRUCLM45BGC.yellowstone_intel.clm-monthly_noinitial - - yellowstone/aux_clm pgi yes - All PASS - - frankfurt/aux_clm intel yes - All PASS - frankfurt/aux_clm pgi yes - All PASS - frankfurt/aux_clm nag yes - All PASS - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel yes - All PASS, except: - *** Irrelevant, because this test fails - FAIL ERS.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_15.clm2.h0 - FAIL ERS.f09_g16.ICLM45VIC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_15.clm2.h1 - - *** Expected diffs in h1 files: differences in cols1d_active, - pfts1d_active, and related FILLDIFFs in a number of variables - FAIL ERI_D.f10_f10.ICLM45BGC.yellowstone_intel.clm-vrtlay.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS_D.f10_f10.ICLM45BGCNoVS.yellowstone_intel.clm-rootlit.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_intel.clm-ch4_set2_ciso.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS_D.f10_f10.ICLM45BGC.yellowstone_intel.clm-ch4_set3_pftroot.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS.f19_g16.ICRUCLM45BGCCROP.yellowstone_intel.clm-default.compare_hist.clm4_5_15.clm2.h1 - FAIL ERS_Ld3_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel.clm-default.compare_hist.clm4_5_15.clm2.h1 - FAIL SSP.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default.compare_hist.clm4_5_15.clm2.h1 - - test_driver.sh tools testing: - - yellowstone interactive: no - frankfurt interactive: no - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_5_15 - -Changes answers relative to baseline: NO, except for changes in fill -patterns & active flags in 1-d hist files, as noted above - -=============================================================== -=============================================================== -Tag name: clm4_5_15 -Originator(s): muszala (Stefan Muszala) -Date: Mon Jul 1 10:44:05 MDT 2013 -One-line Summary: complete associate refactor for pointers in clm4_5 source - -Purpose of changes: Refactor all clm4_5 source so that pointers assignements are - placed in associate blocks at the start of a subroutine. This allows us to - get rid of pointer declarations, makes the code easier to modify, makes the - code more robust and sets us up for future interface refactorings. The refactor is - explained in more detail in models/lnd/clm/tools/clm4_5/refactorTools/README. - -- real(r8), pointer :: fdry(:) ! fraction of foliage that is green and dry [-] (new) -- fdry => pps%fdry -+ associate(& -+ fdry => pps%fdry & ! Output: [real(r8) (:)] fraction of foliage that is green and dry [-] (new) -+ ) - ... -- end subroutine FracWet -+ end associate -+ end subroutine FracWet - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: BGC compsets will see increases - in memory (highwater) use. This can be seen in memcomp portions of testing with - one specific example. Something to keep track of. - - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.clm-default.GC.4515preIntel.memcomp.clm4_5_14 - - highwater goes from 166 MB in clm4_5_14 to 236 MB in clm4_5_15 - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.rtm-rtmOff.GC.4515preIntel.memcomp.clm4_5_14 - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.rtm-rtmOnFloodOnEffvelOff.GC.4515preIntel.memcomp.clm4_5_14 - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.rtm-rtmOnFloodOnEffvelOn.GC.4515preIntel.memcomp.clm4_5_14 - FAIL ERS.f19_g16.I1850CLM45BGC.yellowstone_intel.rtm-rtmOnIceOn.GC.4515preIntel.memcomp.clm4_5_14 - FAIL ERS.f19_g16_r01.I1850CLM45BGC.yellowstone_intel.rtm-rtmOnFloodOnEffvelOff.GC.4515preIntel.memcomp.clm4_5_14 - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: - -A models/lnd/clm/tools/clm4_5/refactorTools/associate/refactor_new.pl -A models/lnd/clm/tools/clm4_5/refactorTools/associate/README - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/initch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_BGC.F90 -M models/lnd/clm/src/clm4_5/biogeochem/MEGANFactorsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVLightMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_CENTURY.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/initSLakeMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FracWetMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -Machines testing ran on: (Tests in priority order) - build-namelist unit tester: OK - - CESM test lists: - - yellowstone/aux_clm intel OK - yellowstone/aux_clm pgi OK - frankfurt/aux_clm intel OK - frankfurt/aux_clm pgi OK - frankfurt/aux_clm nag OK - - CESM history file comparison: - - yellowstone/aux_clm OK - -CLM tag used for the baseline comparison tests if applicable: clm4_5_14 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_14 -Originator(s): muszala (Stefan Muszala) -Date: Thu Jun 20 07:51:54 MDT 2013 -One-line Summary: preparation for associate refactor in clm4_5_15 - -Purpose of changes: - Most work by mvertens. - - prep. work for modifying associate - - refactor subgridAveMod.F90 to accept upper and lower bounds - - remove duplicate pointer uses - - remove inicPerpMod.F90 and is_perpetual use - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: - -D models/lnd/clm/src/clm4_5/main/inicPerpMod.F90 - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/main/pft2colMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK. Fixed generate numbering. - - CESM test lists: - - yellowstone/aux_clm intel OK - yellowstone/aux_clm pgi OK - frankfurt/aux_clm intel OK - frankfurt/aux_clm pgi OK - frankfurt/aux_clm nag OK - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel OK - -CLM tag used for the baseline comparison tests if applicable: clm4_5_13 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_13 -Originator(s): andre (Benjamin Andre,LAWRENCE BERKELEY NATIONAL LABORATORY,510-486-4617) -Date: Fri Jun 14 15:01:33 MDT 2013 -One-line Summary: hydrology reordering from Jinyun Tang - -Purpose of changes: - reordering the operations of the hydrology. hydrology with and without drainage - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: Jinyun Tang, Dave Lawrence - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 - splits out leaching - M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - add icefrac and qflx_deficit - M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 - update calls to CNEcosystemDyn - M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - update calls to CNEcosystemDyn and Hydrology - M models/lnd/clm/src/clm4_5/main/clmtype.F90 - add icefrac and qflx_deficit - M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 - splits out drainage calculations - M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - calculate water table before subsurface drainage, icefraction, water deficit - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes/no *** - - CESM test lists: - - yellowstone/aux_clm intel yes OK - yellowstone/aux_clm pgi yes OK - frankfurt/aux_clm intel no - frankfurt/aux_clm pgi no - frankfurt/aux_clm nag no - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - test_driver.sh tools testing: N/A - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_5_12 - -Changes answers relative to baseline: yes - -IF tag changes answers relative to baseline comparison the -following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all clm 4.5 with hydrology - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): new climate - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: ERS_D.f19_g16.ICLM45 - an 11-year base line simulation - was created with the standard trunk version, then a comparison run - was created with the version including hydrology re-ordering. The - comparisons were evaluated by looking at the relative differences - for hydrologic variables as QDRAI, EFLX_LH_TOT, QRUNOFF. Large - relative differences were found for these variables in a few grid - cells, but their absolute magnitudes in those grid cells were - small. Tests were also conducted with VIC hydrology on, the - change in results were similar as that when VIC hydrology was off. - - URL for LMWG diagnostics output used to validate new climate: N/A - -=============================================================== -=============================================================== -Tag name: clm4_5_12 -Originator(s): muszala (Stefan Muszala) -Date: Thu Jun 13 09:41:56 MDT 2013 -One-line Summary: NoVS test, NAG mods and remove TWS from restart file - -Purpose of changes: - - -Fix (from jedwards) for ERS_D.f10_f10.ICLM45BGCNoVS.yellowstone_intel.clm-rootlit test - Previous tags using ICLM45BGCNoVS are suspect! - -Since I tested this with NAG there are also port mods to CLM that I had to put in. - -Remove TWS from BiogeophysRestMod.F90 per sacks request. OK'd by swenson. - -Update to rtm1_0_29 - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): 1746 - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, NoVs error: Charlie Koven and jedwards - -List any svn externals directories updated (csm_share, mct, etc.): rtm1_0_28 -> rtm1_0_29 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - --NoVS fix and NAG mods -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 --Nag mods -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4varcon.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 --remove TWS from restart -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 --update to rtm1_0_29 -M SVN_EXTERNAL_DIRECTORIES - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: no - - CESM test lists: - - yellowstone/aux_clm intel OK - yellowstone/aux_clm pgi OK - frankfurt/aux_clm intel OK - frankfurt/aux_clm pgi OK - frankfurt/aux_clm nag OK - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel OK. The only differences are in ERS_D.f10_f10.ICLM45BGCNoVS.yellowstone_intel.clm-rootlit. - These are expected due to the fix in ch4Mod.F90. - -CLM tag used for the baseline comparison tests if applicable: clm4_5_11 - -Changes answers relative to baseline: Only for ERS_D.f10_f10.ICLM45BGCNoVS.yellowstone_intel.clm-rootlit. Previous - versions of this compset should be considered suspect. Fields that change (119 in total) for this test are: - - ACTUAL_IMMOB, CH4STRESS_SAT, CH4STRESS_UNSAT, CH4_AERE_DEPTH_SAT, CH4_AERE_DEPTH_UNSAT, CH4_EBUL_DEPTH_SAT, - CH4_OXID_DEPTH_SAT, CH4_OXID_DEPTH_UNSAT, CH4_PROD_DEPTH_SAT, CH4_SURF_AERE_SAT, CH4_SURF_AERE_UNSAT, - CH4_SURF_DIFF_SAT, CH4_SURF_DIFF_UNSAT, CH4_SURF_EBUL_SAT, CH4_TRAN_DEPTH_SAT, CH4_TRAN_DEPTH_UNSAT, - COL_CTRUNC, COL_NTRUNC, CONC_CH4_SAT, CONC_CH4_UNSAT, CONC_O2_SAT, CONC_O2_UNSAT, CWDC, CWDC_LOSS, - CWDC_TO_LITR2C, CWDC_TO_LITR3C, CWDN, CWDN_TO_LITR2N, CWDN_TO_LITR3N, DENIT, ER, FCH4, FCH4TOCO2, - FUELC, F_DENIT, F_N2O_DENIT, F_N2O_NIT, F_NIT, GROSS_NMIN, HR, LAND_UPTAKE, LITHR, LITR1C, LITR1C_TO_SOIL1C, - LITR1N, LITR1N_TO_SOIL1N, LITR1_HR, LITR2C, LITR2C_TO_SOIL1C, LITR2N, LITR2N_TO_SOIL1N, LITR2_HR, LITR3C, - LITR3C_TO_SOIL2C, LITR3N, LITR3N_TO_SOIL2N, LITR3_HR, LITTERC, LITTERC_HR, LITTERC_LOSS, NBP, NEE, NEM, NEP, - NET_NMIN, O2STRESS_SAT, O2_AERE_DEPTH_SAT, O2_DECOMP_DEPTH_SAT, O2_DECOMP_DEPTH_UNSAT, POTENTIAL_IMMOB, - POT_F_DENIT, POT_F_NIT, SMINN_TO_SOIL1N_L1, SMINN_TO_SOIL1N_L2, SMINN_TO_SOIL1N_S2, SMINN_TO_SOIL1N_S3, - SMINN_TO_SOIL2N_L3, SMINN_TO_SOIL2N_S1, SMINN_TO_SOIL3N_S1, SMINN_TO_SOIL3N_S2, SMIN_NH4, SMIN_NO3, - SMIN_NO3_LEACHED, SOIL1C, SOIL1C_TO_SOIL2C, SOIL1C_TO_SOIL3C, SOIL1N, SOIL1N_TO_SOIL2N, SOIL1N_TO_SOIL3N, - SOIL1_HR_S2, SOIL1_HR_S3, SOIL2C, SOIL2C_TO_SOIL1C, SOIL2C_TO_SOIL3C, SOIL2N, SOIL2N_TO_SOIL1N, - SOIL2N_TO_SOIL3N, SOIL2_HR_S1, SOIL2_HR_S3, SOIL3C, SOIL3C_TO_SOIL1C, SOIL3N, SOIL3N_TO_SOIL1N, SOIL3_HR, - SOILC, SOILC_HR, SOILC_LOSS, SOMHR, SR, TOTCOLC, TOTCOLCH4, TOTCOLN, TOTECOSYSC, TOTECOSYSN, TOTLITC, TOTLITN, - TOTSOMC, TOTSOMN - -=============================================================== -=============================================================== -Tag name: clm4_5_11 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Tue Jun 11 20:54:11 MDT 2013 -One-line Summary: Change pct_pft and related surface dataset variables to be % of landunit - -Purpose of changes: - -Main purpose is to change pct_pft and related surface dataset variables to be % -of landunit rather than % of grid cell. This is needed to support transient PFTs -with dynamic landunits. This required substantial changes in both mksurfdata_map -and CLM. This also required generating all new surface datasets. - -A very related change is the separation of PCT_PFT in the surface dataset into -PCT_NAT_PFT and PCT_CFT; in addition to these two variables, there are also new -PCT_NATVEG (% of natural veg landunit on the gridcell) and PCT_CROP (% of crop -landunit on the gridcell) variables. Note that the separation of PCT_PFT into -natural vs crop was only done on the surface dataset -- raw datasets to -mksurfdata_map have not been changed, nor have most of the CLM data structures. - -In addition, this tag includes the following: - -(1) Renumbered landunits to (a) add separate landunit numbers for each urban -landunit, (b) do away with the obsolete shallow lake, and (c) group together -similar landunits - -(2) In any urban landunit, allocate space for ALL urban columns. Previously, -there were some urban landunits with only one of the two road types. This change -simplifies the code and only adds a relatively small number of columns in memory. - -(3) Modified interpinic, partly to have compatibility with (1), partly to fix -urban bug (allowed by (1)), and partly to fix an unrelated bug - -(4) All new initial conditions for CLM4.5, to have compatibility with (1) and (2) - -(5) Check _OPENMP in initialization rather than driver - -(6) Tighten error check in reweightMod: checkWeights. It seems like this error -check can be stricter with the new pct_pft formulation - - -Requirements for tag: Standard test + tools - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - 1621 (normalization issue in ne120np4 datasets and in CLM) - 1675 (need to relax error tolerance in reweightMod: weightsOkay) -- note - that I have actually TIGHTENED the tolerance, but that seems to be - okay now - 1702- PARTIAL FIX (clm4.5 interpinic doesn't work right for urban) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - - 1747 - need 1x1_tropicAtl surface dataset and pftdyn dataset for clm4_5_11 and later - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: Changes to fsurdat and finidat for -CLM4.5, as described below - -List any changes to the defaults for the boundary datasets: - - For CLM4.5, all surface datasets and initial conditions files have been - recreated. For surface datasets, changes result in only roundoff-level - differences in the pct_* fields. For initial conditions, the new initial - conditions are effectively the same as the old, but bugs in interpinic - prevent them from being exactly the same. - -Describe any substantial timing or memory changes: - - Slight (probably < 1%) increase in memory for all CLM4.5 cases, due to - allocation of ALL urban columns wherever there is an urban landunit - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): NONE - -List all files eliminated: - -========= Remove unneeded modules (iulog moved to fileutils.F90) -D models/lnd/clm/tools/clm4_5/mksurfdata_map/src/clm_varpar.F90 -D models/lnd/clm/tools/clm4_5/mksurfdata_map/src/clm_varctl.F90 - -========= Now differs for clm4_0 and clm4_5, so copied to those two places -D models/lnd/clm/src/util_share/clm_varsur.F90 - -========= Replaced with new file for testing interpinic -D models/lnd/clm/tools/clm4_5/interpinic/clmi.BCN.1949-01-01_10x15_USGS_simyr1850_c121113.nc - - -List all files added and what they do: - -========= New file for testing interpinic -A models/lnd/clm/tools/clm4_5/interpinic/clmi.I2000CLM45BGC.2000-01-01.10x15_simyr2000_c130607.nc - -========= Add tests -A models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkpftMod.F90 - -========= Moved from util_share -A models/lnd/clm/src/clm4_0/main/clm_varsur.F90 - -========= Moved from util_share, and modified extensively to support new surface - dataset format -A models/lnd/clm/src/clm4_5/main/clm_varsur.F90 - -========= Add module to do some initialization that doesn't fit well elsewhere, - and/or can't go elsewhere because of circular dependencies -A models/lnd/clm/src/clm4_5/main/initParametersMod.F90 - - -List all existing files that have been modified, and describe the changes: - -========= Change pct_pft and related variables on surface dataset to be % of - landunit; this requires significant changes for mkpftMod, mkglcmecMod - and the error checks / corrections done in mksurfdat.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkutilsMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/fileutils.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkfileMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkglcmecMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkvarpar.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mksurfdat.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Srcfiles -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/mkpftMod.F90 - -========= Add tests -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mkutilsMod.F90 -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/Srcfiles -M models/lnd/clm/tools/clm4_5/mksurfdata_map/unit_testers/test_mksurfdata_map.F90 - -========= Update crop landunit numbering, fix urban bug for column-level - variables, take code out of a conditional to prevent floating point - exceptions -M models/lnd/clm/tools/clm4_5/interpinic/src/interpinic.F90 - -========= New files for testing interpinic -M models/lnd/clm/tools/clm4_5/interpinic/interpinic.runoptions - -========= Change landunit and column numbering; delete udenstype -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 - -========= Add variables for determining number of natural & crop PFTs -M models/lnd/clm/src/clm4_5/main/clm_varpar.F90 - -========= Major changes to handle pct_pft being specified as % of landunit - rather than % of gridcell -M models/lnd/clm/src/clm4_5/main/surfrdMod.F90 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridMod.F90 -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 - -========= Initialize new surface variables, check _OPENMP here instead of driver -M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 - -========= Update comments, remove udenstype -M models/lnd/clm/src/clm4_5/main/clmtype.F90 - -========= Change 'use' statements, use ltype instead of udenstype, fix - initialization for 0-weight columns -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 - -========= Add some consistency checks (moved here from clmtypeInitMod), change others -M models/lnd/clm/src/clm4_5/main/clm_varctl.F90 - -========= Change 'use' statements; use urbpoi rather than isturb; remove - references to 'istslak' -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNEcosystemDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInputMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -M models/lnd/clm/src/clm4_5/main/dynlandMod.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - -- also, remove udenstype, and move some consistency checks elsewhere -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/restFileMod.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 - -- also, move _OPENMP check to initialization -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -M models/lnd/clm/src/clm4_5/main/inicPerpMod.F90 -M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 - -========= Tighten tolerance for error check -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 - -========= Use 'crop_prog' rather than the CROP CPP def -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 - -========= New surface datasets and initial conditions -M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - -========= Change environment variable in component_gen_comp command to something universal -M .ChangeLog_template - -========= Restore a failing test (see bug 1658) -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - - - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - - All PASS or xFail except for the following expected baseline failures: - 418/444 < FAIL> - 423/444 < FAIL> - 428/444 < FAIL> - 433/444 < FAIL> - 438/444 < FAIL> - 443/444 < FAIL> - - - CESM test lists: - - yellowstone/aux_clm intel yes - Tests themselves: All PASS or xFail, except - ERB.ne30_g16.I_1948-2004.yellowstone_intel, which I have re-added to the - xFail list (see bugz 1658) - - Comparisons: Some nlcomp and compare_hist failures, as expected - - yellowstone/aux_clm pgi yes - All PASS or xFail except for some nlcomp & compare_hist failures (expected) - - frankfurt/aux_clm intel yes - All PASS or xFail except for some nlcomp & compare_hist failures (expected) - - frankfurt/aux_clm pgi NO - - frankfurt/aux_clm nag yes - All PASS or xFail except for nlcomp failures (expected) - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $CESMDATAROOT/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel yes - - Some compare_hist failures for CLM4.5 tests, as expected - - test_driver.sh tools testing: - - yellowstone interactive: yes - All PASS except for expected baseline failures: - 012 blg54 TBLtools.sh clm4_5 mksurfdata_map tools__s namelist ...................................rc=7 FAIL - 016 blh54 TBLtools.sh clm4_5 interpinic tools__ds runoptions ....................................rc=7 FAIL - 020 bli24 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds rc=7 FAIL - 022 bli53 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o ....rc=7 FAIL - 024 bli54 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ds ...rc=7 FAIL - 026 bli57 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__do ...rc=7 FAIL - 032 bliT4 TBLscript_tools.sh clm4_5 mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools_rc=7 FAIL - - and expected failures: - 027 smiS4 TSMscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional .............rc=6 FAIL - 028 bliS4 TBLscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional .............rc=4 FAIL - - - frankfurt interactive: NO - - yellowstone/PTCLM: NO - -CLM tag used for the baseline comparison tests if applicable: clm4_5_10 - -Changes answers relative to baseline: YES - -IF tag changes answers relative to baseline comparison the -following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: Changes in all CLM4.5 configurations. See below - for details - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Mostly roundoff, but some larger than roundoff -- see below for details. - - Changes are limited to CLM4.5. Where the below notes refer to "all - configurations", this is really limited to CLM4.5 configurations. - - For all configurations, there are roundoff-level changes due to - roundoff-level differences in subgrid weights. These changes can quickly - grow to greater than roundoff (which I believe is due to nonlinear - feedbacks with snow variables), but as described below, I have verified - that the root cause of differences is this roundoff-level change. - - For cases that use initial conditions, where these initial conditions were - previously interpinic'ed, there are greater-than-roundoff level changes - due to various bugs and limitations of interpinic (for example, some - fields, like tsai, are skipped). I took pains to ensure that, for cases - using original (non-interpinic'ed) initial conditions in clm4_5_10 and - prior, the new initial conditions are nearly identical to the old (but not - entirely identical, due to bug 1702 - see comment 2); this applies to most - f09 initial conditions. However, this was not practical for cases that - used interpinic'ed files; this applies to f19, ne30 and hcru initial - conditions, as well as f09 BGCDV initial conditions. So for this latter - set of cases, there can be large differences from clm4_5_10, especially at - the start of the simulation. - - There are also greater than roundoff-level changes for some glc_mec - virtual columns, because we now use information on topo_glc_mec whenever - we can. - - There are also greater than roundoff-level changes in subgrid weights in - virtual (0-weight) glc_mec and crop landunits, now that we no longer use - arbitrary subgrid weights there; I don't think this will affect anything - important, though. - - Some tests that exhibited larger-than-usual changes from baseline, in cpl - hist and/or clm hist files, were the following (ignoring changes that can - be explained by the above notes): - - ERS_Lm3.f19_g16.IGRCP60CLM45CN.yellowstone_intel - ERS_D.f19_g16.ICLM45GLCMEC.yellowstone_intel.clm-glcMEC - ERS_D.f10_f10.ICLM45BGCNoVS.yellowstone_intel.clm-rootlit - ERS_Ld3_D_P64x1.ne30_g16.ICLM45CN.yellowstone_intel.clm-default - - From these results, it seems that large changes may occur more often in - glc_mec runs, even above and beyond the virtual column changes that are - expected, as noted above. - - For the four above tests, I verified that differences were attributable to - the roundoff-level changes in subgrid weights, using the procedure - documented below. - - - If bitwise differences were observed, how did you show they were no worse - than roundoff? - - In order to confirm that answers only differed by roundoff, I ran 7 - additional tests (these tests all had nl_dirs, but that was not central to - these tests, so I'm not listing them here): - - SMS_Lm1.f19_g16.I_1850_CLM45_BGC - SMS_Ly2.T31_g37.IG1850CLM45CN - SMS_Ly5.T31_g37.I20TRCRUCLM45BGC - SMS_Ly5.T31_g37.ICLM45BGCDV - SMS_Ly5.T31_g37.I_2000_CLM45_BGC - SMS_Ly5.f10_f10.ICLM45BGCDVCROP - SMS_Ly5.f10_f10.I_2000_CLM45_BGC_CROP - - Each test was done as follows: - - (1) Created baselines from clm4_5_04 - - (2) Ran tests from a branch (allocate_all_urban_cols), where all I changed - from the baseline was (a) wherever we have an urban landunit, create ALL - urban landunits, and (b) for f19, change finidat files to use a new, - interpinic'ed file based on the original. Confirmed that this was bfb with - (1) except for (a) 1-d history files (now have extra urban columns), and - (b) any CLM4.5 test that uses initial conditions, since interpinic is - currently broken for urban. - - Side-note: I actually confirmed bfb behavior for the full yellowstone - aux_clm test suite, in addition to the above 7 tests - - This extra branch was necessary because I cannot compare 1-d history files - directly between my main branch and the trunk, because of the extra urban - columns present in the new code. - - - (3) Ran these 7 tests from my main branch, off of clm4_5_04, comparing - with (2). For this comparison, I only confirmed that the subgrid weights - were the same within roundoff (up to about 1e-12 differences for the - transient case; smaller for other cases). Note that greater than - roundoff-level changes are seen in many other fields, presumably because - small differences in subgrid pft weights can cause differences in how - variables are averaged from pft to column. This, in turn, can lead to - larger changes due to nonlinearities in the system (e.g., snow). The - following steps were taken to confirm that other differences between my - branch and the trunk were only due to these small differences in subgrid - weights. - - That is, I am confirming that: - (a) the only differences in the branch are subgrid weights - (b) these subgrid weights only differ by roundoff - - - (4) Reran (2), but with extra code to write out subgrid weights (including - writing these weights at every time step for pftdyn) -- from branch - allocate_all_urban_cols_writeWeights - - (5) Reran (3), but with extra code to read the subgrid weights written in - (4). Confirmed that, with this one-off, my branch was bfb with (4). - - -=============================================================== -=============================================================== -Tag name: clm4_5_10 -Originator(s): muszala (Stefan Muszala) -Date: Mon Jun 10 13:10:31 MDT 2013 -One-line Summary: refactor clmtype - -Purpose of changes: Refactor clmtype so that there is only one level of indirection. - - call hist_addfld1d (fname='SNOOCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow (land) ', & -- ptr_pft=clm3%g%l%c%p%pef%sfc_frc_oc, set_urb=spval) -+ ptr_pft=pef%sfc_frc_oc, set_urb=spval) - -There is a README (with more detailed information) and a script to help with future merges in: - - models/lnd/clm/tools/clm4_5/refactorTools/clmType/{README & renameClmType.pl} - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, mvertens - -List any svn externals directories updated (csm_share, mct, etc.): N/A - -List all files eliminated: N/A - -List all files added and what they do: - -- script and README for refactoring clmType -A models/lnd/clm/tools/clm4_5/refactorTools -A models/lnd/clm/tools/clm4_5/refactorTools/associate -A models/lnd/clm/tools/clm4_5/refactorTools/clmType -A models/lnd/clm/tools/clm4_5/refactorTools/clmType/renameClmType.pl -A models/lnd/clm/tools/clm4_5/refactorTools/clmType/README - -List all existing files that have been modified, and describe the changes: - -- major refactor in these to flatten clmtype -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtype.F90 - -- change derived type access to match those of clmtype -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGapMortalityMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNitrifDenitrifMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNGRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/initch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNBalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNMRespMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_BGC.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVerticalProfileMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4RestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNWoodProductsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPrecisionControlMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVLightMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate3Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/VOCEmissionMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEcosystemDynIniMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAnnualUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNStateUpdate2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompCascadeMod_CENTURY.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNNDynamicsMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSetValueMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNVegStructUpdateMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSoilLittVertTranspMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_varcon.F90 -M models/lnd/clm/src/clm4_5/main/CNiniTimeVar.F90 -M models/lnd/clm/src/clm4_5/main/dynlandMod.F90 -M models/lnd/clm/src/clm4_5/main/subgridRestMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/pftdynMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/pft2colMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/initSurfAlbMod.F90 -M models/lnd/clm/src/clm4_5/main/filterMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -M models/lnd/clm/src/clm4_5/main/initGridCellsMod.F90 -M models/lnd/clm/src/clm4_5/main/initSoilParVICMod.F90 -M models/lnd/clm/src/clm4_5/main/CNiniSpecial.F90 -M models/lnd/clm/src/clm4_5/main/inicPerpMod.F90 -M models/lnd/clm/src/clm4_5/main/reweightMod.F90 -M models/lnd/clm/src/clm4_5/main/mkarbinitMod.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SnowHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FrictionVelocityMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/TridiagonalMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeHydrologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BiogeophysRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/ActiveLayerMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/clm_driverInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CLMVICMapMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BareGroundFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/initSLakeMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Biogeophysics2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/FracWetMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/UrbanInitMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SLakeRestMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceAlbedoMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology2Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - - build-namelist unit tester: no - - CESM test lists: - - yellowstone/aux_clm intel OK - yellowstone/aux_clm pgi OK - frankfurt/aux_clm intel OK - frankfurt/aux_clm pgi OK - frankfurt/aux_clm nag OK - - CESM history file comparison: - - yellowstone/aux_clm intel - -CLM tag used for the baseline comparison tests if applicable: clm4_5_09 - -Changes answers relative to baseline: No. Everything in this refactor should be BFB. - -=============================================================== -=============================================================== -Tag name: clm4_5_09 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Tue Jun 4 15:59:07 MDT 2013 -One-line Summary: volr and vic fix, update mct and rtm - -Purpose of changes: add volr area correction, minor vic fix from maoyi, update mct and - rtm externals - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, swenson - -List any svn externals directories updated (csm_share, mct, etc.): --models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_27 -+models/rof/rtm https://svn-ccsm-models.cgd.ucar.edu/rivrtm/trunk_tags/rtm1_0_28 - --models/utils/mct https://github.com/MCSclimate/MCT/tags/MCT_2.8.3 -+models/utils/mct https://github.com/quantheory/MCT/tags/compiler_fixes_n01_MCT_2.8.3 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -- fix for VIC hydrology -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -- volr area correction -M models/lnd/clm/src/cpl_mct/lnd_comp_mct.F90 -M models/lnd/clm/src/cpl_esmf/lnd_comp_esmf.F90 -- mct and rtm update -M SVN_EXTERNAL_DIRECTORIES -- clean up -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK - - CESM test lists: - - yellowstone/aux_clm intel OK - yellowstone/aux_clm pgi OK - frankfurt/aux_clm intel OK - frankfurt/aux_clm pgi OK - frankfurt/aux_clm nag OK - -CLM tag used for the baseline comparison tests if applicable: clm4_5_08 - -Changes answers relative to baseline: only for VIC compsets. VOLR diagnostic changes. - -=============================================================== -=============================================================== -Tag name: clm4_5_08 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Mon Jun 3 13:29:30 MDT 2013 -One-line Summary: port for NAG compiler - -Purpose of changes: Bring in Sean Santos mods, port clm4_5 and test with the NAG compiler on Frankfurt. - -Requirements for tag: N/A - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): 1721 - Jim Edwards fixed problem in PIO - -Known bugs (include bugzilla ID): 1722 - Error in some VIC tests starting in clm4_5_07 - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, Santos - -List any svn externals directories updated (csm_share, mct, etc.): PIO - update to pio1_7_2 - -List all files eliminated: - -D models/lnd/clm/src/util_share/nanMod.F90 - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/unit_testers/xFail/expectedFail.pm -M models/lnd/clm/src/util_share/clm_time_manager.F90 -M models/lnd/clm/src/util_share/accumulMod.F90 -M models/lnd/clm/src/util_share/ndepStreamMod.F90 -M models/lnd/clm/src/util_share/ncdio_pio.F90 -M models/lnd/clm/src/util_share/spmdMod.F90 -M models/lnd/clm/src/util_share/domainMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCIsoFluxMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNSummaryMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/ch4varcon.F90 -M models/lnd/clm/src/clm4_5/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDecompMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNCStateUpdate1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_5/biogeochem/CNC14DecayMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_5/main/subgridMod.F90 -M models/lnd/clm/src/clm4_5/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_5/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_5/main/histFileMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_5/main/controlMod.F90 -M models/lnd/clm/src/clm4_5/main/clm_driver.F90 -M models/lnd/clm/src/clm4_5/main/pftvarcon.F90 -M models/lnd/clm/src/clm4_5/main/histFldsMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/BalanceCheckMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilTemperatureMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/Hydrology1Mod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SNICARMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/CanopyFluxesMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SurfaceRadiationMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/H2OSfcMod.F90 -M models/lnd/clm/src/clm4_5/biogeophys/SoilHydrologyMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CropRestMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/DUSTMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CNPhenologyMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/STATICEcosysDynMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CNAllocationMod.F90 -M models/lnd/clm/src/clm4_0/biogeochem/CNDVEstablishmentMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_glclnd.F90 -M models/lnd/clm/src/clm4_0/main/subgridMod.F90 -M models/lnd/clm/src/clm4_0/main/accFldsMod.F90 -M models/lnd/clm/src/clm4_0/main/clmtypeInitMod.F90 -M models/lnd/clm/src/clm4_0/main/pftvarcon.F90 -M models/lnd/clm/src/clm4_0/main/iniTimeConst.F90 -M models/lnd/clm/src/clm4_0/main/histFileMod.F90 -M models/lnd/clm/src/clm4_0/main/clm_atmlnd.F90 -M models/lnd/clm/src/clm4_0/biogeophys/SNICARMod.F90 -M SVN_EXTERNAL_DIRECTORIES - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: - OK. - - yellowstone/aux_clm intel - OK. - yellowstone/aux_clm pgi - OK. - One BFAIL for hcru_hcru which should pass next time around. Bug fixed when upgrading to pio1_7_2. - BFAIL ERS_D.hcru_hcru.I_2000_CRUFRC_CLM45_CN.yellowstone_pgi.GC.08testPgi.compare_hist.clm4_5_07 - frankfurt/aux_clm intel - OK. - frankfurt/aux_clm pgi - OK. - frankfurt/aux_clm nag - OK. No baselines to compare against. - -CLM tag used for the baseline comparison tests if applicable: clm4_5_07 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_07 -Originator(s): erik (Erik Kluzek) -Date: Fri May 31 02:49:45 MDT 2013 -One-line Summary: New spinup files for CLM45 AND RTM, work on PTCLM, turn drydep off by default, update externals - -Purpose of changes: - - Bring in new spinup finidat files (f09_g16@1850 for SP and BGC). interpinic to 2deg, hcru_hcru and ne30. - New spinup finidat files for BGCCROP and BGCDV (f19 and f09 respectively) - New spinup finidat files for 2000 (f09_g16 for SP and BGC) - Update RTM to bring in finidat_rtm files for either 1850 or 2000. - Update scripts, Machines, pio - scripts includes update for CLM40CRU hybrid startup - Turn drydep namelist off by default - Do a lot of work on getting PTCLM working and tools working for single-point. - -Requirements for tag: - New spinup files, fix bugs: 1708, 1700 - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - 1715 (rmdups.ncl fails for no-overlap case) - 1714 (mkscripgrid.ncl doesn't calculate corners correctly.) - 1708 (Need Initial conditions for RTM) - 1706 (VIC tests fail) - 1700 (Memory leak in MPI layer on yellowstone) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: drydep namelist now OFF by default - -List any changes to the defaults for the boundary datasets: New initial conditions - Native initial conditions for f09 for: - I1850CLM45SP, I1850CLM45BGC, ICLM45SP, ICLM45BGC - Interpinic for: - I1850CLM45 & I1850CLM45BGC: f19, hcru_hcru, ne30 - ICLM45BGCCROP @ f19 - ICLM45BGCDB @ f09 - - ALSO NOTE THAT NOW RTM HAS INITIAL CONDITIONS FOR R05 -- SO RIVERFLOW CHANGES - FOR BOTH CLM45 AND CLM40 - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): many - csm_share, pio, scripts, Machines, RTM, cprnc, mapping - - - scripts to scripts4_130529 (update PTCLM, send simyr to RTM, new IC for CLM40CRUCN) - csm_share to share3_130528 - rtm to rtm1_0_27 (Set startup initial condition files by -simyr flag) - Machines to Machines_130529 (Set hcru_hcru PE-layout, and PE-layout on yellowstone for f09 I cases) - pio to pio1_7_1 - cprnc to cprnc_130425 - mapping to mapping_130509 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/test/tools/TBLCFGtools.sh --- Correctly point to TSMCFGtools rather than TSMtools.sh. - - M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - Add -usr_mapdir option - - M models/lnd/clm/tools/shared/mkmapdata/rmdups.ncl ------ Exit early if n_s==0 - M models/lnd/clm/tools/shared/mkmapdata/mkmapdata.sh ---- Skip if file already exists, give - directory for rmdups.ncl - M models/lnd/clm/tools/shared/mkmapdata/mknoocnmap.pl --- Don't hide NCL output - M models/lnd/clm/tools/shared/mkmapgrids/mkscripgrid.ncl Explicitly calculate corners - - M models/lnd/clm/bld/build-namelist - Set drydep to off by default, check crop setting for finidat files - - M models/lnd/clm/bld/clm.buildnml.csh - Add back logic in about ignoring IC year or date - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml - New initial conditions for: - Native initial conditions for f09 for: - I1850CLM45SP, I1850CLM45BGC, ICLM45SP, ICLM45BGC - Interpinic for: - I1850CLM45SP & I1850CLM45BGC: f19, hcru_hcru, ne30 - ICLM45BGCCROP @ f19 - ICLM45BGCDB @ f09 - M models/lnd/clm/bld/namelist_files/namelist_defaults_usr_files.xml - Use surfdata_map rather than surfdata - for CLM_USRDAT_NAME fsurdat files - - M models/lnd/clm/bld/namelist_files/use_cases/stdurbpt_pd.xml - Remove setting of dtime, adjust hist output - - More work on readme files... - - M README - M models/lnd/clm/doc/IMPORTANT_NOTES - M models/lnd/clm/doc/Quickstart.GUIDE - M models/lnd/clm/doc/Quickstart.userdatasets - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - - CESM test lists: - - yellowstone/aux_clm intel yes - yellowstone/aux_clm pgi yes - frankfurt/aux_clm intel yes - frankfurt/aux_clm pgi yes - - CESM history file comparison: - (ccsm_utils/Tools/component_gen_comp -compare $oldtag -generate $newtag -testid $testid -baselineroot $GLDCSEG/ccsm_baselines/ -model clm2) - - yellowstone/aux_clm intel yes - - test_driver.sh tools testing: - - yellowstone interactive: yes - frankfurt interactive: yes - - yellowstone/PTCLM: yes! - -CLM tag used for the baseline comparison tests if applicable: clm4_5_06 - -Changes answers relative to baseline: Yes -- due to new initial condition files - for I1850CLM45SP and I1850CLM45BGC @ f09, f19, hcru, ne30 - ICLM45SP and ICLM45BGC @ f09 - ICLM45BGCCROP @ f19 and ICLM45BGCDB @ f09 - and ICLM40CRUCN @ f09 - - AND new initial conditions for RTM for ALL R05 grids - - And turning drydep namelist off in the driver causes answers to appear to be different - when comparing coupler history files. - -=============================================================== -=============================================================== -Tag name: clm4_5_06 -Originator(s): erik (Erik Kluzek) -Date: Wed May 15 13:52:43 MDT 2013 -One-line Summary: A few small bug fixes, more updates to README files - -Purpose of changes: - More work on README files and documentation. - Fix from Danica/Bill for transient simulations. - Fix from Zack for Lake output variables - Another multi-instance script fix. - Fix tropixAtl pftdyn filename. - Remove models/lnd/clm/bld/config_query as doesn't work with new CESM scripts. - -Requirements for tag: - Requirements: Fix bug: 1697, 1691, 1675, fix tropicAtl fpftdyn file, minimal testing on frankfurt - -Test level of tag: critical - -Bugs fixed (include bugzilla ID): - 1675 (need to relax error tolerance in reweightMod: weightsOkay) - 1691 (Scripts issue for multi-instance for CLM/RTM) - 1697 (ZLAKE and DZLAKE are NOT set) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: Fix 1x1_tropicAtl fpftdyn file - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, sacks (transient fix), dlawren/subin (lake fix), jedwards (multi-instance scripts) - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: testing namelist files for old CLM standalone - - D models/lnd/clm/bld/config_query --- no longer works with new CESM scripts - - D models/lnd/clm/test/tools/nl_files/nl_ch4_set2_ciso - D models/lnd/clm/test/tools/nl_files/nl_ch4_set3_pftroot - D models/lnd/clm/test/tools/nl_files/nl_rootlit - D models/lnd/clm/test/tools/nl_files/nl_ciso - D models/lnd/clm/test/tools/nl_files/nl_anoxia_wtsat - D models/lnd/clm/test/tools/nl_files/nl_vrtlay - D models/lnd/clm/test/tools/nl_files/nl_oldhyd - -List all files added and what they do: - - A models/lnd/clm/tools/clm4_5/interpinic/addmetadata --- Add script to add important meta-data to finidat files. - -List all existing files that have been modified, and describe the changes: - ----------------- Work on README files documentation - M models/lnd/clm/test/tools/config_files/README - M models/lnd/clm/test/tools/README - M models/lnd/clm/test/tools/README.testnames - M models/lnd/clm/tools/README - M models/lnd/clm/doc/IMPORTANT_NOTES - M models/lnd/clm/doc/Quickstart.GUIDE - M models/lnd/clm/doc/README - ----------------- - M models/lnd/clm/bld/config_files/config_definition.xml ------------ Document experimental settings / fix syntax error - M models/lnd/clm/bld/clm.buildnml.csh ------------------------------ Multi-instance fix - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml --- Fix 1x1_tropicAtl fpftdyn filename - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml - Document experimental settings - ----------------- - M models/lnd/clm/src/clm4_5/main/histFileMod.F90 ---- ZLAKE/DZLAKE fix - M models/lnd/clm/src/clm4_5/main/subgridAveMod.F90 -- ZLAKE/DZLAKE fix - M models/lnd/clm/src/clm4_5/main/reweightMod.F90 ---- Increase tolerance to 1.e-7 so transient - simulations can run their full course. - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: yes - - CESM test lists: (limited testing on yellowstone/aux_clm/intel) - - frankfurt/aux_clm pgi yes - frankfurt/aux_clm intel yes - -CLM tag used for the baseline comparison tests if applicable: clm4_5_04 - -Changes answers relative to baseline: no (bit-for-bit) - -=============================================================== -=============================================================== -Tag name: clm4_5_05 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Tue May 14 13:15:12 MDT 2013 -One-line Summary: hcru bug fixes - -Purpose of changes: update pio tag and nfire init. mod - -Requirements for tag: N/A - -Test level of tag: Only run hcru_hcru tests - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self, Fang and Erik for nfire problem - -List any svn externals directories updated (csm_share, mct, etc.): update pio to 1_7_0 - -List all files eliminated: N/A - -List all files added and what they do: N/A - -List all existing files that have been modified, and describe the changes: - --- nfire init. changed from nan to spval to fix problem with hcru_hcru debug + intel runs -M models/lnd/clm/src/clm4_5/main/clmtypeInitMod.F90 - -Machines testing ran on: Only testing hcru_hcru resolutions - -Yellowstone Tests: - - The following were run with DEBUG=TRUE and for 1 day initial + 1 day restart - hcru_hcru_I_2000_CRUFRC_CLM45_CN_yellowstone_gnu_pioFixed/ PASS - hcru_hcru_I_2000_CRUFRC_CLM45_CN_yellowstone_intel_pioFixed/ PASS - hcru_hcru_I_2000_CRUFRC_CLM45_CN_yellowstone_pgi_pioFixed/ PASS - - ERS_D.hcru_hcru.I_2000_CRUFRC_CLM45_CN.yellowstone_intel.125102 PASS - ERS_D.hcru_hcru.I_2000_CRUFRC_CLM45_CN.yellowstone_pgi.125128 PASS - -Frankfurt Tests: - - The following were run with DEBUG=TRUE and for 1 day initial + 1 day restart - hcru_hcru_I_2000_CRUFRC_CLM45_CN_frankfurt_pgi_pioFixed/ PASS - hcru_hcru_I_2000_CRUFRC_CLM45_CN_frankfurt_intel_pioFixed/ FAIL initial run (this is - likely related to other existing MPI problems on Frankfurt). - -CLM tag used for the baseline comparison tests if applicable: N/A - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_04 -Originator(s): erik (Erik Kluzek) -Date: Mon May 13 12:25:14 MDT 2013 -One-line Summary: Fix the previous broken tag - -Purpose of changes: - -Fix the problems in the clm4_5_03 untested tag. - -Requirements for tag: Fix bug 1692, 1693 - -Test level of tag: standard - -Bugs fixed (include bugzilla ID): - 1693 (Misc. issues with clm4_5_03) - 1692 (externals screwed up in clm4_5_03) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): externals updated to those in SVN_EXTERNAL_DIRECTORIES - -List all files eliminated: Remove test/system as replaced by CESM testing - - models/lnd/clm/test/system -- Delete the whole directory tree - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/src/clm4_0/main/clm_initializeMod.F90 -- fixed screwed up code - -Machines testing ran on: (Tests in priority order) - Standard Tag Pretag *** Standard Tag Posttag ** - - build-namelist unit tester: yes - - CESM test lists: - - yellowstone/aux_clm intel yes - yellowstone/aux_clm pgi yes - frankfurt/aux_clm intel yes - frankfurt/aux_clm pgi yes - -CLM tag used for the baseline comparison tests if applicable: clm4_5_01 - -Changes answers relative to baseline: No - -=============================================================== -=============================================================== -Tag name: clm4_5_03 -Originator(s): erik (Erik Kluzek) -Date: Fri May 10 17:29:56 MDT 2013 -One-line Summary: Several bug fixes for release, urban and test single point surface datasets - -Purpose of changes: - - Some work on IMPORTANT_NOTES file. - Fix PTS_MODE restarts from John Truesdale. (implimented, but there are still issues) - Fix history change number of tapes on startup issue. - Bring in urban single pt surface datasets and single pt test: mexicocityMEX, vancouverCAN , urbanc_alpha, 1x1_tropicAtl, 1x1_smallvilleIA - Drydep use before defined problem. - Always bypass first two time-steps for CN/BGC. - Fix gregorian calendar on history files. - Remove two fields on clm45 fpftdata file as per Gordon Bonan. - ncd_pio fix from Jim Edwards/Mariana V. - set nsegspc=20 for HOMME and high resolution grids. - Change documentation on CLM build-namelist -drydep, but keep it default on (will change to off in next tag) - Remove a bunch of datm/drv fields in namelist_definition. - Fix some issues with Crop and DV that Sam found. - Fix a scripts issue with multi-instance. - Update RTM (multi-instance fix, allow null grid). - Update test list so that CLM45/DV/CROP are exercised. - Update scripts/machines tag because of multiple problems. - -Requirements for tag: fix bug 1488, 1673, 1677, 1682, 1653, 1689, 1690, 1687, 1688, 1685, 1691 - -Test level of tag: limited! - -Bugs fixed (include bugzilla ID): - - 1025 (partial -- implement changes from John Truesdale so SCAM can read global IC files) - 1488 (HOMME grids can not use nsegspc=20) - 1653 (Calls to PIO are not properly done) - 1673 (B compset gregorian calendar not reflected in CLM history) - 1677 (Remove bypass_CN_balance_check_on_restart in CLM45) - 1682 (Problem starting up CLM with no history files) - 1685 (use before define issue in DryDeposition) - 1687 (SBN scripts bug) - 1688 (misc. issues with new create_test) - 1689 (CLM45 dgvm does not build) - 1690 (CLM45 CNDV lightning namelist is missing) - 1691 (Scripts issue for multi-instance) - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None - -Describe any changes made to the namelist: - Set nsegspc=20 for HOMME and f05/f02 resolutions - Set stream_fldfilename_lightng for CLM45/CNDV - -List any changes to the defaults for the boundary datasets: New single-point test and urban datasets - New surface datsets for: mexicocityMEX, vancouverCAN, urbanc_alpha, 1x1_tropicAtl, 1x1_smallvilleIA - New fpftdyn for: 1x1_tropicAtl 1850-2005 - New pft-physiology file for CLM45 with three fields removed that were NOT being read in (qe25, mp, and resist) - -Describe any substantial timing or memory changes: None - -Code reviewed by: self, jedwards/mvertens (fix for bug 1653), jet (fix for bug 1025), slevis (fixes for DV) - -List any svn externals directories updated (csm_share, mct, etc.): Machines, scripts, rtm - Machines to Machines_130509 - scripts to scripts4_130510 - rtm to rtm1_0_25 - -List all files eliminated: None - -List all files added and what they do: None - -List all existing files that have been modified, and describe the changes: - - M models/lnd/clm/bld/build-namelist ---- Document drydep as if it's off (will actually become off in next tag) - M models/lnd/clm/bld/clm.buildnml.csh -- Multi-instance bug fix. - - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_0.xml ----- nsegspc for ALL grids is 20 - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_0.xml --- Remove datm/drv namelist crap - M models/lnd/clm/bld/namelist_files/namelist_defaults_clm4_5.xml ----- nsegspc for ALL grids is 20 - New pft-physiology file, new surface/fpftdyn datasets for single point test and urban - Set stream_fldfilename_lightng for CNDV. - M models/lnd/clm/bld/namelist_files/namelist_definition_clm4_5.xml --- Remove datm/drv namelist crap - - M models/lnd/clm/doc/IMPORTANT_NOTES -- updates - - M models/lnd/clm/src/util_share/clm_time_manager.F90 - Set parameters for calendar type. - M models/lnd/clm/src/util_share/ncdio_pio.F90 -------- Fix so that type of data output on read is based - on the variable type of the data rather than the type of data on the input file. (from mvertens/jedwards) - - M models/lnd/clm/src/clm4_5/biogeochem/CNFireMod.F90 ------ Fix so CNDV can build. - M models/lnd/clm/src/clm4_5/biogeochem/CNrestMod.F90 ------ Remove bypass_CN_balance_check_on_restart - M models/lnd/clm/src/clm4_5/biogeochem/DryDepVelocity.F90 - Fix use before define error. - M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 ---- On restart set fieldlist and later compare to make sure - not screwed up. - M models/lnd/clm/src/clm4_5/main/histFileMod.F90 ---------- Make htapes_fieldlist public, check calendar for output files, - check that namelist didn't change number of tapes or fields on restart - M models/lnd/clm/src/clm4_5/main/clm_driver.F90 ----------- Remove bypass_CN_balance_check_on_restart, NEVER do balance check - on first time-step - - M models/lnd/clm/src/clm4_0/biogeochem/DryDepVelocity.F90 - Fix use before define error. - M models/lnd/clm/src/clm4_0/main/histFileMod.F90 ---------- Make htapes_fieldlist public, check calendar for output files, - check that namelist didn't change number of tapes or fields on restart - M models/lnd/clm/src/clm4_5/main/clm_initializeMod.F90 ---- On restart set fieldlist and later compare to make sure - not screwed up. - -Machines testing ran on: Limited! (watch out for this tag!) - - I ran preliminary testing, with versions on the cbugfixclm450 ranch. We will fix other issues with the entire - package as we find them. - -CLM tag used for the baseline comparison tests if applicable: clm4_5_02 - -Changes answers relative to baseline: No bit-for-bit - -=============================================================== -=============================================================== -Tag name: clm4_5_02 -Originator(s): sacks (Bill Sacks,UCAR/CGD,303-497-1762) -Date: Tue May 7 21:04:35 MDT 2013 -One-line Summary: make 'shared' tools directory, and other minor tools fixes - -Purpose of changes: - -- Make separate 'shared' tools directory, move some tools from the clm4_5 - directory into there. - -- Change interpinic so that htop and hbot are skipped - -- Change Makefile.common files in tools to use ifort by default on yellowstone, - so users can just type 'gmake' without needing to do 'gmake USER_FC=ifort'. - For simplicity, this has been implemented by defaulting to ifort for ALL Linux - machines. - -- Fix minor mksurfdata.pl bugs (1669, 1681). - -Requirements for tag: -- fix bug 1669, 1681* -- only tools testing needed - -Test level of tag: tools only - -Bugs fixed (include bugzilla ID): -- 1669: change needed for mksurfdata.pl for smallville (or crop PFT override anyway) -- Changes to get mksurfdata.pl working with urban single point datasets - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: None for CLM; tools builds changed to -use ifort by default on Linux machines - -Describe any changes made to the namelist: None - -List any changes to the defaults for the boundary datasets: None - -Describe any substantial timing or memory changes: None - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): None - -List all files eliminated: - -========= Moved to 'shared' directory -D models/lnd/clm/tools/clm4_5/mkmapdata -D models/lnd/clm/tools/clm4_5/mkprocdata_map -D models/lnd/clm/tools/clm4_5/ncl_scripts -D models/lnd/clm/tools/clm4_5/mkmapgrids - -List all files added and what they do: - -========= Tools moved from clm4_5 directory to shared directory -A models/lnd/clm/tools/shared -A models/lnd/clm/tools/shared/mkmapdata/mvNimport.sh -A models/lnd/clm/tools/shared/mkmapdata/rmdups.ncl -A models/lnd/clm/tools/shared/mkmapdata/regridbatch.sh -A models/lnd/clm/tools/shared/mkmapdata/createXMLEntries.pl -A models/lnd/clm/tools/shared/mkmapdata/mkmapdata.sh -A models/lnd/clm/tools/shared/mkmapdata/mkunitymap.ncl -A models/lnd/clm/tools/shared/mkmapdata/mknoocnmap.pl -A models/lnd/clm/tools/shared/mkmapdata/README -A models/lnd/clm/tools/shared/mkmapdata -A models/lnd/clm/tools/shared/mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c121107.nc -A models/lnd/clm/tools/shared/mkprocdata_map/map_ne30np4_nomask_to_fv1.9x2.5_nomask_aave_da_c121107.nc -A models/lnd/clm/tools/shared/mkprocdata_map/mkprocdata_map_functions.bash -A models/lnd/clm/tools/shared/mkprocdata_map/src/mkprocdata_map.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/gridmapMod.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/constMod.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/Makefile.common -A models/lnd/clm/tools/shared/mkprocdata_map/src/fmain.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/shr_file_mod.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/nanMod.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/Mkdepends -A models/lnd/clm/tools/shared/mkprocdata_map/src/Srcfiles -A models/lnd/clm/tools/shared/mkprocdata_map/src/Filepath -A models/lnd/clm/tools/shared/mkprocdata_map/src/Makefile -A models/lnd/clm/tools/shared/mkprocdata_map/src/fileutils.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src/shr_kind_mod.F90 -A models/lnd/clm/tools/shared/mkprocdata_map/src -A models/lnd/clm/tools/shared/mkprocdata_map/mkprocdata_map_in -A models/lnd/clm/tools/shared/mkprocdata_map/mkprocdata_map_all -A models/lnd/clm/tools/shared/mkprocdata_map/clm -A models/lnd/clm/tools/shared/mkprocdata_map/mkprocdata_map_wrap -A models/lnd/clm/tools/shared/mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c121107.nc -A models/lnd/clm/tools/shared/mkprocdata_map/README -A models/lnd/clm/tools/shared/mkprocdata_map -A models/lnd/clm/tools/shared/ncl_scripts/cprnc.pl -A models/lnd/clm/tools/shared/ncl_scripts/getco2_historical.ncl -A models/lnd/clm/tools/shared/ncl_scripts/cprnc.ncl -A models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.pl -A models/lnd/clm/tools/shared/ncl_scripts/getregional_datasets.ncl -A models/lnd/clm/tools/shared/ncl_scripts/README -A models/lnd/clm/tools/shared/ncl_scripts -A models/lnd/clm/tools/shared/mkmapgrids/src/Makefile.common -A models/lnd/clm/tools/shared/mkmapgrids/src/domainMod.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src/shr_sys_mod.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src/shr_file_mod.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src/nanMod.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src/shr_log_mod.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src/Mkdepends -A models/lnd/clm/tools/shared/mkmapgrids/src/Srcfiles -A models/lnd/clm/tools/shared/mkmapgrids/src/mkmapgrids.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src/Filepath -A models/lnd/clm/tools/shared/mkmapgrids/src/Makefile -A models/lnd/clm/tools/shared/mkmapgrids/src/shr_kind_mod.F90 -A models/lnd/clm/tools/shared/mkmapgrids/src -A models/lnd/clm/tools/shared/mkmapgrids/mkmapgrids.namelist -A models/lnd/clm/tools/shared/mkmapgrids/mkscripgrid.ncl -A models/lnd/clm/tools/shared/mkmapgrids/mkmapgrids.csh -A models/lnd/clm/tools/shared/mkmapgrids/README -A models/lnd/clm/tools/shared/mkmapgrids - -========= Add test for mkmapdata using '-p clm4_0' -A models/lnd/clm/test/tools/nl_files/mkmapdata_ne30np4_clm4_0 - -List all existing files that have been modified, and describe the changes: - -========= Point to new 'shared' tools directory where appropriate -M models/lnd/clm/tools/clm4_5/mksurfdata_map/mksurfdata.pl - - also fix mksurfdata.pl for crop PFT override (bug 1669) - - also changes to get mksurfdata.pl working with urban single point datasets (bug 1681) -M models/lnd/clm/tools/clm4_0/mksurfdata_map/mksurfdata.pl - - also fix mksurfdata.pl for crop PFT override (bug 1669) -M models/lnd/clm/test/tools/TBLCFGtools.sh -M models/lnd/clm/test/tools/TOPtools.sh -M models/lnd/clm/test/tools/TBLscript_tools.sh -M models/lnd/clm/test/tools/TBLtools.sh -M models/lnd/clm/test/tools/input_tests_master - - also add test for mkmapdata using '-p clm4_0' -M models/lnd/clm/tools/README -M models/lnd/clm/tools/clm4_5/mksurfdata_map/README.developers - -========= Put gen_domain in 'shared' tools directory -M SVN_EXTERNAL_DIRECTORIES - -========= Use ifort by default on yellowstone (and other Linux machines) -M models/lnd/clm/tools/clm4_5/interpinic/src/Makefile.common -M models/lnd/clm/tools/clm4_5/mksurfdata_map/src/Makefile.common -M models/lnd/clm/tools/clm4_0/interpinic/src/Makefile.common -M models/lnd/clm/tools/clm4_0/mksurfdata_map/src/Makefile.common - -========= Change interpinic so that htop and hbot are skipped -M models/lnd/clm/tools/clm4_5/interpinic/src/interpinic.F90 - - -Machines testing ran on: (Tests in priority order) - build-namelist unit tester: no - - CESM test lists: - - yellowstone/aux_clm intel no - frankfurt/aux_clm_int intel no - yellowstone/aux_clm pgi no - frankfurt/aux_clm intel no - - test_driver.sh tools testing: - - lynx interactive: no - yellowstone interactive: yes - - All PASS except for the following expected failures (note that 006 & 008 - baselines are expected to always fail): - - 006 ble14 TBLCFGtools.sh shared gen_domain CFGtools__ds T31.runoptions .......................... rc=4 FAIL - 008 ble@4 TBLCFGtools.sh shared gen_domain CFGtools__ds ne30.runoptions ......................... rc=4 FAIL - 027 smiS4 TSMscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional ............. rc=6 FAIL - 028 bliS4 TBLscript_tools.sh shared ncl_scripts getregional_datasets.pl getregional ............. rc=4 FAIL - - - yellowstone/PTCLM: no - -CLM tag used for the baseline comparison tests if applicable: clm4_5_01 - -Changes answers relative to baseline: NO - -=============================================================== -=============================================================== -Tag name: clm4_5_01 -Originator(s): muszala (Stefan Muszala,UCAR/CGD,303-497-1320) -Date: Mon May 6 16:52:27 MDT 2013 -One-line Summary: update externals - -Purpose of changes: update externals to alpha08b - -Requirements for tag: N/A - -Test level of tag: std-test - -Bugs fixed (include bugzilla ID): N/A - -Known bugs (include bugzilla ID): N/A - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: N/A - -Describe any changes made to the namelist: N/A - -List any changes to the defaults for the boundary datasets: N/A - -Describe any substantial timing or memory changes: N/A - -Code reviewed by: self - -List any svn externals directories updated (csm_share, mct, etc.): - -< scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_130502 -< scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130502 -< models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq4_2_33 ---- -> scripts https://svn-ccsm-models.cgd.ucar.edu/scripts/trunk_tags/scripts4_130422 -> scripts/ccsm_utils/Machines https://svn-ccsm-models.cgd.ucar.edu/Machines/trunk_tags/Machines_130412 -> models/drv https://svn-ccsm-models.cgd.ucar.edu/drv/seq_mct/trunk_tags/drvseq4_2_29 -13c13 -< models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_130502 ---- -> models/glc/cism https://svn-ccsm-models.cgd.ucar.edu/glc/trunk_tags/cism1_130405 -16c16 -< models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_130423 ---- -> models/csm_share https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_130226 -18c18 -< models/utils/timing https://svn-ccsm-models.cgd.ucar.edu/timing/trunk_tags/timing_130417 ---- -> models/utils/timing https://svn-ccsm-models.cgd.ucar.edu/timing/trunk_tags/timing_130214 -20c20 -< models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_6_9/pio ---- -> models/utils/pio http://parallelio.googlecode.com/svn/trunk_tags/pio1_6_7/pio -23,25c23,25 -< tools/cprnc https://svn-ccsm-models.cgd.ucar.edu/tools/cprnc/trunk_tags/cprnc_130425 -< tools/mapping https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130426a -< models/lnd/clm/tools/clm4_5/gen_domain https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130426a/gen_domain_files ---- -> tools/cprnc https://svn-ccsm-models.cgd.ucar.edu/tools/cprnc/trunk_tags/cprnc_130411 -> tools/mapping https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130403 -> models/lnd/clm/tools/clm4_5/gen_domain https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_130403/gen_domain_files - -List all files eliminated:N/A - -List all files added and what they do:N/A - -List all existing files that have been modified, and describe the changes: - -M models/lnd/clm/bld/unit_testers/xFail/expectedClmTestFails.xml -- clean up test list - -Machines testing ran on: (Tests in priority order) - - build-namelist unit tester: OK - - CESM test lists: - - yellowstone/aux_clm intel OK (detail of fails that should pass next time) - -BFAIL ERI_D.f10_f10.I20TRCN.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -FAIL ERS.f19_g16_r01.I1850CLM45CN4Me.nldir_rtmOnFloodOnEffvelOff.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- No matching time found in cprnc? should pass next time. -FAIL ERS_D.f19_g16.ICLM45GLCMEC.nldir_glcMEC.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -FAIL ERS_D.f19_g16.ICLM45GLCMEC.nldir_glcMEC.yellowstone_intel.GC.170226.nlcomp - -- changes in cism namelist and cism config -FAIL ERS_D.f19_g16.IGRCP26CLM45CN.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -FAIL ERS_D.f19_g16.IGRCP26CLM45CN.yellowstone_intel.GC.170226.nlcomp - -- changes in cism namelist and cism config -FAIL ERS_D.f19_g16.IGRCP26CN.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -FAIL ERS_D.f19_g16.IGRCP26CN.yellowstone_intel.GC.170226.nlcomp - -- changes in cism namelist and cism config -BFAIL ERS_Ld3_D_P64x1.ne30_g16.ICLM45CN.nldir_default.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -BFAIL ERS_Ld3_D_P64x16.ne30_g16.ICN.nldir_default.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -FAIL ERS_Lm3.f19_g16.IGRCP60CN.yellowstone_intel.GC.170226.nlcomp - -- changes in cism namelist and cism config -BFAIL PET_D_P1x30.ne30_g16.ICN.nldir_default.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -BFAIL SMS_RLA.f45_f45.I.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -BFAIL SMS_RLA.f45_f45.ICLM45.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -BFAIL SMS_ROA.f45_f45.I.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round -BFAIL SMS_ROA.f45_f45.ICLM45.yellowstone_intel.GC.170226.compare_hist.clm4_0_81 - -- no baseline, should pass next round - - yellowstone/aux_clm pgi OK (detail of fails that should pass next time) - -FAIL ERI.f19_g16.IG1850.yellowstone_pgi.GC.170137.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -FAIL ERI.f19_g16.IG1850.yellowstone_pgi.GC.170137.nlcomp - -- changes in cism namelist and cism_config -FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.170137.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -FAIL ERI.f19_g16.IG1850CLM45.yellowstone_pgi.GC.170137.nlcomp - -- changes in cism namelist and cism config -BFAIL ERI_D.f10_f10.I20TRCN.yellowstone_pgi.GC.170137.compare_hist.clm4_0_81 - -- no baseline, should pass next round -FAIL SMS.T31_g37.IG4804.yellowstone_pgi.GC.170137.compare_hist.clm4_0_81 -FAIL SMS.T31_g37.IG4804.yellowstone_pgi.GC.170137.nlcomp - -- changes in cism namelist and cism config - -- changes in drv_in (ocn_ntreades=2) -FAIL SMS.T31_g37.IG4804CLM45.yellowstone_pgi.GC.170137.compare_hist.clm4_0_81 - -- changes in g2x_Sg_frac01 and g2x_Sg_topo01 -BFAIL SMS_RLB.f45_f45.I.yellowstone_pgi.GC.170137.compare_hist.clm4_0_81 - -- no baseline, should pass next round -BFAIL SMS_RLB.f45_f45.ICLM45.yellowstone_pgi.GC.170137.compare_hist.clm4_0_8 - -- no baseline, should pass next round - - frankfurt/aux_clm intel OK - -CLM tag used for the baseline comparison tests if applicable: clm4_0_81 - -Changes answers relative to baseline: yes - -IF tag changes answers relative to baseline comparison the -following should be filled in: - - Summarize any changes to answers, i.e., - - what code configurations: only changes in g2x_Sg_frac01 and g2x_Sg_topo01 - - what platforms/compilers: all - -=============================================================== -=============================================================== -Tag name: clm4_5_00 -Originator(s): erik (Erik Kluzek) -Date: Thu May 2 00:20:17 MDT 2013 -One-line Summary: Official end to CLM4.5 development for CLM offline - -Purpose of changes: Changes from clm4_0_54 to now... - -Compsets and Scripts Changes: - -Remove ability to set compset file on command line, and use a new expanded compset file definition that -allows user to create many compsets on the fly by defining a long name with the "-user_compset" option -to "create_newcase". "-user_compset" is in the form of... - -TIME_DATM[%phys]_CLM[40|45][%phys]_SICE_SOCN_RTM[%phys]_GLC[%phys]_SWAV[_BGC%phys] - -Where - TIME = Time period (e.g. 2000, 20TR, RCP8...) - GLC = [CISM1, SGLC] - BGC = optional BGC scenario -The OPTIONAL %phys attributes specify submodes of the given system - -So for example - -./create_newcase -user_compset 1850_DATM%CRU_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV -case cru1850 -res f19_g16 -mach yellowstone -compiler intel - -will setup a 1850 case at f19 resolution with CRUNCEP forcing with CLM4.5-BGC. - -Changes for both clm4.0 and clm4.5: - -* Bug fixes in MEGAN VOC emission fluxes and dry deposition velocities -* CRUNCEP is now an option for atmospheric forcing -* Change from Sam Levis for CROP to pft-physiology file so that CROP parameter is in Kelvin rather than Celsius. -* Don't re-weight pftdyn if weights are essentially identical. - -CLM4.5 includes the following: - -* Bring in flood capability to RTM. -* Bring LBNL-merge branch on with: vertical soil, Methane, CENTURY, split nitrification, new-lake model. -* Modifications to GPP, on gppdev branch, multilayer canopy and then single-layer version that reproduces it. -* Crop model updates. Irrigation included with crop model as an option. Fix CNDV-CROP. -* Urban model updates, multi-density, urban depth seperate from soil depth, wasteheat to zero. -* Bring in permafrostsims09 branch with Sean Swensons's flooding changes. -* Update pft-physiology file, change some CN defaults, change min flow slightly in RTM. -* Set ponding to zero, acclimation mods from Keith Oleson, a hydrology change from Sean Swenson. -* Add active flags, change subgrid weighting convention. -* Turn off subgrid topography snow parameterization for glc_mec landunits. -* Jinyun photosynthesis change impacting arid regions. -* Keith Oleson's photosynthesis change, changes canopy top: triose phosphate util. rate to be dependent on vcmax. -* VIC hydrology is an option. -* Update mksurfdata_map for CLM4.5 (also add support for glc_nec=36 although we have no datasets for this). -* Snow depth averaged over grid-cell (SNOWDP) on history file changed in favor of SNOW_DEPTH (averaged only over snow covered area). -* Spinup changes from Charlie Koven from build-time to run-time (spinup now option added to CLM_BLDNML_OPTS as "-spinup on|off"). -* Bring the F. Li and S. Levis Fire model for CLMCN and CLMBGC based on Li et al. (2012a,b; 2013). -* BSW calculation changed affecting drought phenology and frozen temperature sensitivity (SP, CN, and BGC as well as DV) - -Test level of tag: doc - -Bugs fixed (include bugzilla ID): - -Known bugs (include bugzilla ID): - http://bugs.cgd.ucar.edu/ - -Known Limitations: - 1147 (mkgriddata can't straddle over Greenwich) - 1025 (SCM mode can NOT use a global finidat file) - 1017 (SCM mode can NOT restart) - 896 (T62 mode does not work) - 701 (svn keyword) - 452 (Problem with support of soil-colors != 8 or 20) - -Describe any changes made to build system: - Changes to CLM configure: - -phys option to specify clm4_0 or clm4_5 - -pergro and -c13 option removed - -spinup option removed for CLM4_0 - New options for clm4_5: -clm4me, -vichydro, -exlaklayers, -vsoilc_centbgc - -Describe any changes made to the namelist: - For CLM4.0: WRF and 360x720cru resolutions added - For CLM4.5: new namelists: popd_streams light_streams clm_hydrology1_inparm clm_soilhydrology_inparm - irrigate is a namelist option rather than using different surface datasets - New namelist items for clm_inparm: - anoxia no_frozen_nitrif_denitrif - atm_c14_filename override_bgc_restart_mismatch_dump - cryoturb_diffusion_k perchroot - decomp_depth_efolding perchroot_altk - deepmixing_depthcrit pftspecific_rootingprofile - deepmixing_mixfact rootprof_exp - exponential_rooting_profile rootprof_exp - froz_q10 som_adv_flux - hist_wrtch4diag som_diffus - lake_melt_icealb spinup_state - max_altdepth_cryoturbation surfprof_exp - max_depth_cryoturb use_c13 - more_vertlayers use_c14 - nfix_timeconst use_c14_bombspike - - -List any changes to the defaults for the boundary datasets: - All CLM4.5 datasets are new. - For CLM4.0, new ne120, ne240, and 360x720cru surface datasets (ne120 ne120 finidat files) - new pft-physiology file - -New history fields: - Dozens of new fields for clm4_5. - Three new fields for clm4_0: -+ FAIL ERP_Ld5.f10_f10_musgs.I2000Clm50Vic.cheyenne_gnu.clm-decStart COMPARE_base_rest - FAIL ERP_D.f10_f10_musgs.IHistClm50Bgc.cheyenne_gnu.clm-decStart COMPARE_base_rest - - Differences are just in some cism fields that I’m not concerned - about: roundoff-level differences in internal_time; big differences - in tempstag, uvel and vvel, but those fields don’t really make sense - in this configuration (and I have removed them in the latest CISM - tag). (Note that I did two runs of each of these tests from my - branch, and for both tests, the two runs had identical cism hist - files, so I don’t think this is a reproducibility problem.) - - -CLM tag used for the baseline comparisons: clm5.0.dev008 - - -Answer changes --------------- - -Changes answers relative to baseline: NO - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) -- #352 - -=============================================================== -=============================================================== -Tag name: clm5.0.dev008 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Fri Apr 27 13:28:41 MDT 2018 -One-line Summary: With FUN subtract out soil nitrification flux of plant uptake of soil NH3 and NO3 - -Purpose of changes ------------------- - -Soil nitrification flux wasn't taken out of plant uptake of either soil NH3 or NO3, with FUN on, and now it is. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - #351 -- FATES external to https - #310 -- With FUN on soil nitrification flux is not subtracted out of plant uptake of of soil NH4 or NO3 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: - -Code reviewed by: wweider, rfischer - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm5.0.dev007 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: All CLM50 BGC with FUN on - - what platforms/compilers: All - - nature of change: climate very nearly the same - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - rfisher case -- clm5_nbug_test_case ----- short f45 resolution - oleson case --- clm5_nbug_test_case ----- AD spinup f45 resolution - oleson case --- clm5_nbug_test_casepAD -- Post AD spinup f45 resolution - - URL for LMWG diagnostics output used to validate new climate: - http://webext.cgd.ucar.edu/I1850/clm5_nbug_test_casepAD/lnd/clm5_nbug_test_casepAD.281_300-clm5_nbug_control_casepAD.281_300/setsIndex.html - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): fates changed to https form rather than ssh - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - #344 - -=============================================================== -=============================================================== -Tag name: clm5.0.dev007 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Apr 24 14:50:19 MDT 2018 -One-line Summary: Bring in a few answer changing things: FATES, cism updates, IC file fix, testing 1850 compset use 1850 orbit - -Purpose of changes ------------------- - -Important updates in land-ice model (CISM) version used that changes answers. Fix some initial condition problems -with CLM5.0 cases. Update the FATES version to a new updated science version that hence changes answers. -Change the default orbit for testing of 1850 cases to use 1850 orbit rather than 1990. -Make sure to use f45_f45_g37 and not f45_f45 in test lists. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): - #313 -- Issues with initial condition files - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): New IC file for clm5_0_CRUv7 - CLM5.0 finidat files choosen will be different for both GSWP3.1 and CRUNCEPv7 forcing - -Substantial timing or memory changes: No - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - When the cime version is updated the changes that make the 1850 orbit explicit in testing can be removed - -Changes to tests or testing: 1850 tests explicitly set a 1850 orbit, f45_f45 tests changed to include mask (f45_f45_mg37) - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm5.0.dev006 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes - - Summarize any changes to answers: - - what code configurations: All 1850 tests, all FATES, all with CISM, CLM50 initial conditions - - what platforms/compilers: All - - nature of change: Significant - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): fates, cism - FATES to SCI_1.8.1_API_3.0.0 - cism to cism2_1_49 - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - #349 -- Update manage externals to manic_v1.1.3 - #348 -- Update FATES science version to 1.8.1, and bring in some answer changes - -=============================================================== -=============================================================== -Tag name: clm5.0.dev006 -Originator(s): sacks (Bill Sacks) -Date: Thu Apr 12 06:16:16 MDT 2018 -One-line Summary: Don't allocate memory for zero-weight natveg patches and urban - -Purpose of changes ------------------- - -We have previously been allocating memory for all urban columns and all -natural veg PFTs, everywhere. In some cases this may still be desired, -but in some cases - and particularly non-transient cases - this is a -waste of memory and performance without any benefit. - -In timing runs of a CONUS test case set up by Mike Barlage, where there -were 2 PFTs per gridcell (bare plus grass), only allocating memory for -the non-zero-weight points (i.e., 2 natural pfts per gridcell and -nothing else) reduced land run time from 56.4 sec to 21.6 sec. - -This tag puts in place a more general solution, avoiding allocating -memory for zero-weight natural PFTs in non-transient runs, and avoiding -allocating memory for zero-weight urban points unless requested with a -namelist flag. - -For non-transient runs, this change improves performance and decreases -memory and restart file size substantially: For short timing runs on -cheyenne_intel at f09_g16 (I haven't looked closely at memory use, but -it probably is about the same reduction as the restart file size): -- I1850Clm50Sp - - 91% of the runtime (i.e., 9.0% reduction in runtime) - - Restart file size is 32% of original (68% reduction) -- I1850Clm50Bgc - - 77% of the runtime (i.e., 23% reduction in runtime) - - Restart file size is 33% of original (67% reduction) -- I1850Clm50BgcCrop - - 80% of the runtime (i.e., 20% reduction in runtime) - - Restart file size is 37% of original (63% reduction) - -(Non-transient cases should also be improved due to the urban change, -but I haven't investigated the improvement there.) - -This tag also fixes some other bugs, as noted below. - -NOTE: This change requires running init_interp on any existing initial -conditions files! In addition, moving forward, init_interp will always -be needed when going from a non-transient to a transient run (this has -already been the case when running with crop; now it will also be the -case when running without crop, too). - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #298: Don't allocate memory for zero-weight PFTs and urban - columns -- Fixes #317: c14 bombspike and c13 timeseries code can use the wrong - year, with irreproducible behavior -- Fixes #320: I1850Clm50Sp compset mistakenly uses SGLC - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): -- You will need to run init_interp on any existing initial conditions - files -- Moving forward, init_interp will always be needed when going from a - non-transient to a transient run (this has already been the case when - running with crop; now it will also be the case when running without - crop, too) - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): -- New namelist variable: run_zero_weight_urban: If TRUE, run all urban - landunits everywhere where we have valid urban data. This has two - effects: (1) goes back to the previous behavior of allocating memory - for urban nearly everywhere; (2) makes all urban columns active, even - if they have zero weight. This can be used to evaluate potential urban - behavior globally. - -Changes made to namelist defaults (e.g., changed parameter values): -- Use init_interp for all out-of-the-box finidat files - -Changes to the datasets (e.g., parameter, surface or initial files): -- Remove initial conditions for Fates for 1x1 Brazil - -Substantial timing or memory changes: -- Substantial decreases in memory use and improvements in timing: see - notes above. - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: -- Changed aux_clm Fates tests to use cold start -- Changed the allActive test to be a transient case so that we allocate and run all PFTs - -Code reviewed by: -- Quick review by Erik Kluzek -- Urban change reviewed by Keith Oleson - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - ok - - Tests pass, namelists differ as expected - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means: tests pass, some baseline failures as expected: - - DIMSIZEDIFF for vector output - - ERI_D_Ld9.f09_g16.I1850Clm50Sp.cheyenne_gnu.clm-default differs - due to fix of #320 - - ERP_D_Ld9.f09_g16.I1850Clm50SpCru.cheyenne_gnu.clm-default differs - because this uses init_interp whereas on master we did not use - init_interp, and this changes answers for this ERP test due to - #330 - - SMS_D_Ly2.1x1_brazil.IHistClm50BgcQianGs.cheyenne_intel.clm-ciso_bombspike1963 - differs due to fix of #317 - - Note: For changed tests (allActive and Fates tests), I ran the new - versions of the tests from clm5.0.dev005 and confirmed that dev006 - is bit-for-bit with dev005 for these changed tests. - -CLM tag used for the baseline comparisons: clm5.0.dev005 - - -Answer changes --------------- - -Changes answers relative to baseline: YES, but only in limited situations - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: see below - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - Changes answers in the following situations: - - Vector output is not directly comparable, because dimension sizes - differ - - I1850Clm50Sp cases change substantially due to fix of #320 - - Cases with carbon isotope bombspike change due to fix of #317 - - In some situations, cases that use init_interp now but did not - before can change answers by roundoff due to #330 - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) -- #311: Avoid allocating memory for zero-weight natveg patches and urban - -=============================================================== -=============================================================== -Tag name: clm5.0.dev005 -Originator(s): sacks (Bill Sacks) -Date: Tue Apr 10 14:15:52 MDT 2018 -One-line Summary: Two fixes for init_interp - -Purpose of changes ------------------- - -Two fixes for init_interp: - -(1) Copy as many snow layers as possible in init_interp - - In most cases, we only need data from the existing snow layers. But in a - few cases - in particular, the flx_abs* variables - we need data even - from non-existing snow layers in order for interpolation to be - bit-for-bit. The change here reworks snow interpolation so that, in - addition to copying the existing snow layers, we also copy as many - non-existing snow layers as will fit in the destination layer structure. - - Fixes #326 - -(2) For glcmec, match col/patch types in some cases - - If glcmec used the same elevation class definitions in input and output, - then match classes as we do for most landunit types, rather than just - using topographic heights. (An exception is output cells with the - single_at_atm_topo behavior, because their types could change once we - enter the run loop.) - - Fixes #325 - -The new behavior is covered by unit tests. This tag also expands some -unit testing infrastructure to facilitate the addition of some of these -unit tests. - -I have confirmed that this test passes: -LII_D_Ld9.f09_g16.I1850Clm50SpCru.hobart_intel.clm-default, when I point -to an initial conditions file that I generated from the dev 002 tag -(because I wasn't sure if the current default initial conditions file -was exactly compatible with the latest master). Before the changes in -this tag, that test was failing. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- #326: init_interp can change answers for absorbed radiation in - non-existent snow layers -- #325: init_interp can change answers over the CISM domain - -Known bugs introduced in this tag (include github issue ID): -- #339: cheyenne_gnu restart test fails exact restart comparison sporadically - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests pass, baselines fail as expected (baseline failures - just for tests that use init_interp) - -CLM tag used for the baseline comparisons: clm5.0.dev004 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: all configurations with use_init_interp = .true. - - what platforms/compilers: all - - nature of change (roundoff; larger than roundoff/same climate; new climate): - Not investigated carefully, but expected to be larger than roundoff / same climate - - Differences arise due to both fixes listed above. - - (1) Copy as many snow layers as possible in init_interp: It - appears that this only changes answers for some radiation - terms in the first time step after initialization when a snow - layer had just melted before the restart file was written. In - this case, the flx_abs* variables are set differently for this - just-disappeared layer. This can affect a lot of grid cells, - but I expect differences from this change to be very small and - not scientifically important. - - (2) For glcmec, match col/patch types in some cases: This seems to - only affect a small number of grid cells in Greenland. So I do - not expect the overall effect on a simulation to be significant. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) -- #328: fixes for init_interp - -=============================================================== -=============================================================== -Tag name: clm5.0.dev004 -Originator(s): erik (Erik Kluzek) -Date: Mon Apr 9 00:20:03 MDT 2018 -One-line Summary: List of important bug fixes - -Purpose of changes ------------------- - -A list of important bug and usability fixes. One of those changes makes it easier for the user to end up with -initial condition files that don't match the start date of their simulation. This is problematic because of the -saved counters for prognostic crop. For sure a mismatched date will end up with bad results for the first season, -but this will also affect subsequent years running averages. So we don't recommend that you do that. - -Jim Edwards also brought in some changes for PIO for 64bit_data, and to fix fill values for integer data. And we updated -manage_externals to the newest version. - - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): [If none, remove this line] -#213 -- usability issue for CPLHIST that Keith found. -#210 -- Recent request to increase number of tapes to 10. -#169 -- usability issue for running hybrid or branch cases with crop that keeps biting Mike Mills. -#68 --- workaround for gnu compiler bug -#46 --- needed for multi-instance -#66 --– need to relax tolerance for negative C/N values in order for CLM45 Crop to work -#65 --– need to change a check from "> 0" to "> [small val]" -#240 -- from Jim -#255 -- get PTCLM working -#253 -- bad clm40 IC file - -Known bugs introduced in this tag (include github issue ID): - #329 -- init_interp doesn't work if finidat points to finidat_interp_dest from a different case - #326 -- init_interp can change answers for absorbed radiation in non-existent snow layers - #325 -- init_interp can change answers over the CISM domain - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): - You can bypass the ignore_ic_date error when crop is being used - Matching for initial conditions for crop simulations are allowed to ignore the month/day - When crop is on and the start date doesn't match the date for the initial conditions file, - the counters for the crop model will be incorrect -- and hence the first season will be screwed - up, and the screwed up results will affect the running averages for the future. This was a condition - that we didn't allow you to easily do -- we've made it easier for this to happen now. - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): - Allow ten streams of history tapes rather than just six. - Correct the I1850Clm50BgcSpinup compset - You can bypass the ignore_ic_date error when crop is being used (may affect results) - Matching for initial conditions for crop simulations are allowed to ignore the month/day - The precision control settings for Nitrogen and Carbon are now making it to the namelist - -Changes made to namelist defaults (e.g., changed parameter values): ncrit=1.d-8 (10X looser) - -Changes to the datasets (e.g., parameter, surface or initial files): Correct to a few finidat files (clm4_0_CRUv7) - -Substantial timing or memory changes: Maybe 3% to memory - - There is a 3% increase to memory, but memory high water mark seems to double - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - -Changes to tests or testing: - Added aux_cime_baseline tests - add cplhist test - Add edison to fates testlist - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm5.0.dev003 - - -Answer changes --------------- - -Changes answers relative to baseline: no but, there are some specific potential or small apparant change to answers - in terms of the test suite - 3 fields have a different missing value pattern: landmask, pftmask, nbedrock - roundoff difference in F_N2O_DENIT due to #65 - LVG_Ld5_D.f10_f10.I1850Clm50Bgc.cheyenne_intel.clm-no_vector_output - landmask was different for two cases: - ERP_P36x2_Lm25.f10_f10_musgs.I2000Clm50BgcDvCrop.cheyenne_intel.clm-monthly - ERP_P72x2_Lm25.f10_f10_musgs.I2000Clm50BgcDvCrop.cheyenne_intel.clm-monthly - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): manic - manage_externals to manicv1.0.2 - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #337 Update manage_externals to manicv1.0.2 - #333 Important fixes - #241 Add support for 64bit_data, fix fillvalues - -=============================================================== -=============================================================== -Tag name: clm5.0.dev003 -Originator(s): erik (Erik Kluzek) -Date: Fri Mar 9 00:34:04 MST 2018 -One-line Summary: Bug fixes for energy imbalance associated with surface water and lakes - -Purpose of changes ------------------- - -These are bug fixes for the land energy imbalance over land as determined by coupler diagnostics. -They include bug fixes for surface water phase change and lake/snow interactions developed by -Sean Swenson and Keith Oleson. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): #304 - #304 -- Energy imbalance over land per coupler diagnostics - -Known bugs introduced in this tag (include github issue ID): [If none, remove this line] - #317 -- c14 bombspike and c13 timeseries code can use the wrong year, with irreproducible behavior - #313 -- Problems with CLM5 initial conditions files - #310 -- With FUN on soil nitrification flux is not subtracted out of plant uptake of of soil NH4 or NO3 - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): - There is some dupliciation in calculations by level that could be consolidated - For example, the calculation of c1. - There is a check for ffrac_sno(c) > 0, that probably should be greater than a small value - -Changes to tests or testing: none - -Code reviewed by: self, sacks, swensosc - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: regular - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -CLM tag used for the baseline comparisons: clm5.0.dev002 - - -Answer changes --------------- - -Changes answers relative to baseline: Yes! - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: clm4_5 and clm5_0 - - what platforms/compilers: all - - nature of change: climate similar - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: clm50_r272_1deg_GSWP3V1_iso_h2osfclakefix_1850.1443_1461 - - username: oleson - - machine: cheyenne - - URL for LMWG diagnostics output used to validate new climate: - -http://webext.cgd.ucar.edu/I1850/clm50_r272_1deg_GSWP3V1_iso_h2osfclakefix_1850/lnd/clm50_r272_1deg_GSWP3V1_iso_h2osfclakefix_1850.1443_1461-clm50_r272_1deg_GSWP3V1_iso_1850.1443_1461/setsIndex.html - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #307 -- Bug fixes for energy imbalance associated with surface water and lakes - -=============================================================== -=============================================================== -Tag name: clm5.0.dev002 -Originator(s): sacks (Bill Sacks) -Date: Sun Feb 25 06:53:36 MST 2018 -One-line Summary: Add some land ice diagnostic vars needed for CMIP6 - -Purpose of changes ------------------- - -Add some diagnostic variables needed for analyzing land ice that have -been requested by some of the MIPs in CMIP6 (especially ISMIP). - -Also, fixes c2l_scale_type to fix urban scaling for SNOWICE, SNOWLIQ - -Some changes from Leo van Kampenhout. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -- https://github.com/ESCOMP/ctsm/issues/271 Add some land ice fields for cmip6 - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): none - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): none - -Changes made to namelist defaults (e.g., changed parameter values): none - -Changes to the datasets (e.g., parameter, surface or initial files): none - -Substantial timing or memory changes: none - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): none - -Changes to tests or testing: none - -Code reviewed by: self, Erik Kluzek - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - not run - - unit-tests (components/clm/src): - - cheyenne - pass - - tools-tests (components/clm/test/tools): - - cheyenne - not run - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - not run - - regular tests (aux_clm): - - cheyenne_intel ---- ok - cheyenne_gnu ------ ok - hobart_nag -------- ok - hobart_pgi -------- ok - hobart_intel ------ ok - - ok means tests pass, answer changes as expected, as noted below - -CLM tag used for the baseline comparisons: clm5.0.dev001 - - -Answer changes --------------- - -Changes answers relative to baseline: YES - just in SNOWICE, SNOWLIQ - - If a tag changes answers relative to baseline comparison the - following should be filled in (otherwise remove this section): - - Summarize any changes to answers, i.e., - - what code configurations: All - - what platforms/compilers: All - - nature of change (roundoff; larger than roundoff/same climate; new climate): - - just changes the diagnostic fields SNOWICE, SNOWLIQ, due to - fixed c2l_scale_type for these fields - - - The test - ERP_P72x2_Ly3.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-irrig_o3_reduceOutput - also showed small answer changes just in the cpl field - l2x_Sl_tsrf00, for a single grid cell in Antarctica - (221.485144932008 vs. 221.485144910486). However, I reran it 10 - times, and it was bit-for-bit (other than SNOWICE and SNOWLIQ) in - all 10 of those re-runs. So I'm chalking this up to a machine - fluke. (The restart file from the problematic run showed diffs in - a bunch of fields; from spot-checking one - SNOW_DEPTH - diffs - were just in one point. But since this is a reduceOutput run, - diffs didn't show up in CLM history files. I confirmed that there - were no diffs in finidat_interp_dest or in namelists.) I - regenerated baselines for this test using one of the cases without - this machine fluke. - - If bitwise differences were observed, how did you show they were no worse - than roundoff? N/A - - If this tag changes climate describe the run(s) done to evaluate the new - climate (put details of the simulations in the experiment database) - - casename: N/A - - URL for LMWG diagnostics output used to validate new climate: N/A - - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): none - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - -#303 - Snow integrated temperature -#306 - Add some land ice diagnostic variables needed for cmip6 - -=============================================================== -=============================================================== -Tag name: clm5.0.dev001 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Feb 14 14:14:34 MST 2018 -One-line Summary: Fix LND_TUNING_MODE for fully coupled case, update some README files/PTCLM - -Purpose of changes ------------------- - -Fix problem with default LND_TUNING_MODE for cases coupled to CAM. Update some of the README -files. And also bring in a PTCLM version that will work in the new CTSM git checkout directory -structure. - -Bugs fixed or introduced ------------------------- - -Issues fixed (include CTSM Issue #): -#255 PTCLMmkdata doesn't work in the CLM git checkout - -Known bugs found in this tag (include github issue ID): - -#262 hirespft option for mksurfdata.pl doesn't work - - -Notes of particular relevance for users ---------------------------------------- - -Caveats for users (e.g., need to interpolate initial conditions): None - -Changes to CLM's user interface (e.g., new/renamed XML or namelist variables): None - -Changes made to namelist defaults (e.g., changed parameter values): None - -Changes to the datasets (e.g., parameter, surface or initial files): None - -Substantial timing or memory changes: None - -Notes of particular relevance for developers: (including Code reviews and testing) ---------------------------------------------- - -Caveats for developers (e.g., code that is duplicated that requires double maintenance): None - -Changes to tests or testing: None - -Code reviewed by: self - -Did you follow the steps in .CLMTrunkChecklist: yes - -CLM testing: doc - -PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - PASS - - Extra Tests: - -ERS_Ld5.f19_g17.E1850L45TEST.cheyenne_intel.cice-default -SMS_Ld1.f09_f09_mg17.FW1850.cheyenne_intel.cam-reduced_hist1d -SMS_Ld7.f09_g17.B1850.cheyenne_intel.allactive-defaultio - -CLM tag used for the baseline comparisons: clm5.0.dev000 - - -Answer changes --------------- - -Changes answers relative to baseline: No bit-for-bit - -Detailed list of changes ------------------------- - -List any externals directories updated (cime, rtm, mosart, cism, fates, etc.): PTCLM - PTCLM to PTCLM2_180214 - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - -#297 -- README files -#296 -- Make LND_TUNING_MODE correct and consistent when coupled with CAM -#295 -- Bring in a working PTCLMmkdata version -#261 -- Reorder links - -=============================================================== -=============================================================== -Tag name: clm5.0.dev000 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Feb 05 2018 -One-line Summary: Initial version of CLM5.0 - -This is the initial science version of CLM5.0. - -Developments for CLM5.0 build on the progress made in CLM4.5. Most major components of the model have been updated with particularly -notable changes made to soil and plant hydrology, snow density, river modeling, carbon and nitrogen cycling and coupling, and crop -modeling. -The updates to CLM science are documented here: - -https://escomp.github.io/ctsm-docs/doc/build/html/tech_note/Introduction/CLM50_Tech_Note_Introduction.html#clm5-0 - -This version has production versions of CLM5.0 CMIP6 land-use change files for 1850, historical, and 2000. It has preliminary -versions of CMIP6 forcing files for Nitrogen deposition and population density. Further updates are needed for prescribed aerosols, -and future scenarios. - -Spunup initial conditions are provided for several CLM physics and forcing combinations from simulations run at 1-degree resolution -(fv 0.9x1.25 with g1xv6 ocean mask). - -=============================================================== diff --git a/doc/design/oo_design.rst b/doc/design/oo_design.rst deleted file mode 100644 index 6d2a355867..0000000000 --- a/doc/design/oo_design.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. sectnum:: - -.. contents:: - -============================================================= - Use of Init method rather than constructor for most classes -============================================================= - -Most of the object-oriented classes in CTSM (and particularly the science-focused classes) -are initialized with a method named ``Init``, rather than the more standard -object-oriented pattern of using a constructor. This is largely for historical reasons: -Object initialization was done this way when object orientation was first introduced to -CESM (possibly because of compiler bugs that prevented the general use of constructors for -this purpose?). As more object orientation was added, we continued to use an ``Init`` -method for this purpose to remain consistent with existing code. - -At this point, we could probably refactor this to use constructors. diff --git a/doc/release-clm5.0.ChangeLog b/doc/release-clm5.0.ChangeLog deleted file mode 100644 index be078c167a..0000000000 --- a/doc/release-clm5.0.ChangeLog +++ /dev/null @@ -1,767 +0,0 @@ -=============================================================== -Tag name: release-clm5.0.08 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Fri Sep 28 14:17:52 MDT 2018 -One-line Summary: Updated CMIP6 ndep file for historical transient Bgc cases, 1850_control same as before - -Purpose of this version: ------------------------- - -Update the ndep file for transient cases for CLM50 to the CMIP6 version that has identical -data for 1849-1850 to the previous CMIP6 1850_control (with different mid-month times however), and -new 3-member ensemble average/5-year smoothing from the WACCM case: b.e21.BWHIST.f09_g17.CMIP6-historical-WACCM.00[123]. -The new data is monthly rather than yearly, which means there will be a seasonal cycle to nitrogen deposition -for transient cases now. The midmonth times/dates are different for the multi-year file from -the previous file, so answers change when using it for 1850_control cases even though the data is exactly the same. -Because, of that we are still pointing to the previous 1850 CMIP6 ndep file. - -CLM4.5 is still using the previous CMIP5 ndep dataset. - -CTSM Master Tag This Corresponds To: ctsm1.0.dev008 (minus ctsm1.0.dev005 and ctsm1.0.dev001) - -Summary of changes: -------------------- - -Science changes since: New cmip6 ndep file for transient cases - -Software changes since: None - -Changes to User Interface since: None - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): PASS (limited testing) - PASS SMS_D.f09_g16.I1850Clm50BgcSpinup.cheyenne_intel.clm-cplhist - PASS SMS_D_Ld3.f10_f10_musgs.I1850Clm50BgcCrop.cheyenne_intel.clm-default - PASS SMS_D_Ly2.1x1_brazil.IHistClm50BgcQianGs.cheyenne_intel.clm-ciso_bombspike1963 - PASS SMS_D_Ly2.1x1_numaIA.IHistClm50BgcCropGs.cheyenne_intel.clm-ciso_bombspike1963 - PASS SMS_Ld5.f10_f10_musgs.I1850Clm45BgcCrop.cheyenne_intel.clm-crop - PASS SMS_Ld5.f19_g17.IHistClm50Bgc.cheyenne_intel.clm-decStart - PASS SMS_Ld5_D.f09_g16.I1850Clm50BgcCrop.cheyenne_intel.clm-cmip6 - PASS SMS_Lm1.f09_g17_gl4.I1850Clm50Bgc.cheyenne_intel.clm-clm50KitchenSink - PASS SMS_Lm1.f19_g17_gl4.I1850Clm50Bgc.cheyenne_intel.clm-clm50dynroots - PASS SMS_Lm1_D.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-snowlayers_3_monthly - PASS ERP_P36x2_D_Ld5.f10_f10_musgs.IHistClm45BgcCruGs.cheyenne_intel.clm-decStart - - Tests that are different from baseline (as expected) - DIFF SMS_D_Ly2.1x1_brazil.IHistClm50BgcQianGs.cheyenne_intel.clm-ciso_bombspike1963 - DIFF SMS_D_Ly2.1x1_numaIA.IHistClm50BgcCropGs.cheyenne_intel.clm-ciso_bombspike1963 - DIFF SMS_Ld5.f19_g17.IHistClm50Bgc.cheyenne_intel.clm-decStart - DIFF SMS_Lm1_D.f10_f10_musgs.I2000Clm50BgcCrop.cheyenne_intel.clm-snowlayers_3_monthly - - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: release-clm5.0.07 - -Changes answers relative to baseline: Yes! for CLM4.5/CLM5.0 CN or Bgc transient cases - - Summarize any changes to answers, i.e., - - what code configurations: IHist Clm45Bgc* and Clm50Bgc (Bgc or Cn) - - what platforms/compilers: All - - nature of change: Changes in climate for Nitrogen - New nitrogen deposition and change from yearly to monthly - -Detailed list of changes: ------------------------- - -Externals being used: Update cime - - cism: release-cesm2.0.04 - rtm: release-cesm2.0.00 - mosart: release-cesm2.0.00 - cime: cime_cesm2_0_rel_05 - FATES: fates_s1.8.1_a3.0.0 - PTCLM: PTCLM2_180611 - -CTSM Tag versions pulled over from master development branch: None - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #522 -- Point to the new ndep historical file for all cases, also update cime - -=============================================================== -=============================================================== -Tag name: release-clm5.0.07 -Originator(s): erik (Erik Kluzek) -Date: Wed Aug 8 14:02:04 MDT 2018 -One-line Summary: Bring in some simple fixes from ctsm1.0.dev006 and avoid glacier adjustment at startup from ctsm1.0.dev007 - -Purpose of this version: ------------------------- - -This is a duplicate of the previous tag, since the previous tag ended up being off of the release-clm5.0 branch. -All the details of the tag are the same as the previous one. - -=============================================================== -=============================================================== -Tag name: release-clm5.0.06 -Originator(s): erik (Erik Kluzek) -Date: Tue Aug 7 14:49:04 MDT 2018 -One-line Summary: Bring in some simple fixes from ctsm1.0.dev006 and avoid glacier adjustment at startup from ctsm1.0.dev007 - -Purpose of this version: ------------------------- - -Bring in a list of simple fixes that came to CTSM master. Also change so glacier initialization is *ALWAYS* done -at startup (time step zero) even if it isn't cold or interpolated initial conditions. Also synchronize some of the -files in the doc directory with the files in ctsm/master. - - -CTSM Master Tag This Corresponds To: ctsm1.0.dev007 (minus ctsm1.0.dev005 and ctsm1.0.dev001) - -Summary of changes: -------------------- - -Issues fixed (include CTSM Issue #): -- Fixes #340 (Avoid generating dynamic landunit adjustment fluxes for - glacier changes in the first timestep) -- Fixes #24 (ncd_io_1d_log_glob is broken) -- Fixes #120 (Incorrect comments in Biogeophysics1Mod.F90 -- Fixes #245 (Put all .gitignore entries in top-level file) -- Fixes #272 (Code should error on missing mxsoil_color when SOIL_COLOR - is used) -- Fixes #283 (Add more helpful message about need to do init_interp with - wrong number of vertical layers) -- Fixes #367 (For cmip6 runs: Turn on cpl hist output needed to drive a - TG compset) -- Fixes #412 (Fix documentation of init_interp_method) -- Fixes #419 (Do not allow SOYFIXN diagnostic field with FUN) -- Fixes #465 (Remove backwards compatibility check for snw_rds) - -Science changes since: release-clm5.0.05 (always do glacier initialization at startup even if NOT cold or interpolated startup) - -Software changes since: release-clm5.0.05 - remove ncd_io_1d_log_glob, remove a backwards compatability check for snw_rds on restart file - -Changes to User Interface since: release-clm5.0.05 - Add another field to cmip6_outputA, Remove SOYFIXN history field when FUN is on - Add error for missing mxsoil_color, better error message for wrong # of vertical soil layers, - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: release-clm5.0.05 - -Changes answers relative to baseline: possibly at startup - - Summarize any changes to answers, i.e., - - what code configurations: startup with Glacier model and NOT a cold or interpolated start - - what platforms/compilers: All - - nature of change: nearly identical - - Only tests that showed differences in answers were: - - ERI_N2_Ld9.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-default - SMS_Lm13.f19_g17.I2000Clm50BgcCrop.cheyenne_intel.clm-cropMonthOutput - -Detailed list of changes: ------------------------- - -Externals being used: - - cism: release-cesm2.0.04 - rtm: release-cesm2.0.00 - mosart: release-cesm2.0.00 - cime: cime5.6.10 - FATES: fates_s1.8.1_a3.0.0 - PTCLM: PTCLM2_180611 - -CTSM Tag versions pulled over from master development branch: ctsm1.0.dev006, ctsm1.0.dev007 - - ctsm1.0.dev007 sacks 08/05/2018 Avoid glacier dynamic landunit adjustments in first time step - ctsm1.0.dev006 sacks 08/04/2018 Minor bug fixes, cleanup, documentation and enhancements - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #473 -- Always do glacier startup even if not cold or interpoalted start (ctsm1.0.dev007) - #468 -- Minor bug fixes (ctsm1.0.dev006) - -=============================================================== -=============================================================== -Tag name: release-clm5.0.05 -Originator(s): erik (Erik Kluzek) -Date: Sun Aug 5 23:31:45 MDT 2018 -One-line Summary: Update 1850 ndep file, and last year for transient streams - -Purpose of this version: ------------------------- - -Update to latest Nitrogen Deposition file from simulations with WACCM for 1850. -Also fix an issue with the last year for historical transient cases. - - -Summary of changes: -------------------- - -Issues fixed (include CTSM Issue #): $461 - #461 -- increase year last for streams - -Science changes since: release-clm5.0.04 - New ndep file, and updated last year for transient streams - -Software changes since: None - -Changes to User Interface since: None - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - hobart --- PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - hobart --- PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - hobart --- OK - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - - regular tests (fates): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - - regular tests (clm_short): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: release-clm5.0.04 - -Changes answers relative to baseline: Yes - - Summarize any changes to answers, i.e., - - what code configurations: for 1850 Bgc cases and after 2005 for transient cases - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes: ------------------------- - -Externals being used: - - cism: release-cesm2.0.04 - rtm: release-cesm2.0.00 - mosart: release-cesm2.0.00 - cime: cime5.6.10 - FATES: fates_s1.8.1_a3.0.0 - PTCLM: PTCLM2_180611 - -Pull Requests that document the changes (include PR ids): -(https://github.com/ESCOMP/ctsm/pull) - - #471 -- update ndep and last year of streams - -=============================================================== -=============================================================== -Tag name: release-clm5.0.04 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Wed Jul 18 04:04:57 MDT 2018 -One-line Summary: Fix some NFIX variables, update cime/cism for upgraded hobart new glade, new diagnostic fields, update cmip6 output - -Purpose of this version: ------------------------- - -Add some new diagnostic fields. Some needed for CMIP6. Update the CMIP6 user-mods output. -Fix a couple issues. Get full list of history tapes working correctly. Check for valid range -of CO2. New IC file interpolated from the previous one for f19_g17_gl4 for 2000 Clm50BgcCrop - -Update cime and cism so can work on upgraded hobart. Also fix an issue that the Nag6.2 compiler found -in CTSM. Also get working with glade changes that happened on cheyenne, DIN_LOC_ROOT_CLMFORC was -changed to a new directory. - -Nitrogen Fixation flux arrays were being set to missing value over non-vegetated landunits. This sets them to zero everywhere -and averages in the zero's at the gridcell level for history output. It also reads in restarts with missing values and converts -them to zero's. - -There are also some tools updates, getting the tools working on the new upgraded hobart.cgd.ucar.edu. - -And mksurfdata_map is updated to add some *_MAX files on the landuse.timeseries files that will allow us to conserve memory -for transient cases. - - -CTSM Master Tag This Corresponds To: ctsm1.0.dev004 (minus ctsm1.0.dev001) - -Summary of changes: -------------------- - -Issues fixed (include CTSM Issue #): - - #210 -- increase number of history tapes - $427 -- Check for zero CO2 - #429 -- New IC for present day - #441 -- Changes in glade invalidate previous softlinks and data locations - #438 -- Illegal argument aliasing caught by nag6.2 - #433 -- with hobart upgrade CTSM not working - #435 -- intel build for tools - #426 -- Nitrogen Fixation flux variables - #433 -- hobart broken, got it working for tools - -Science changes since: release-clm5.0.03 - - Changes to Nitrogen fixation flux arrays so that they are zero everywhere and the zeros are averaged in for history output. - Answers change because of interpolated initial conditions for 2000 simulation year at f19_g17_gl4 - -Software changes since: release-clm5.0.03 - - Get working on updated hobart. Add some new fields to mksurfdata_map tool. - -Changes to User Interface since: release-clm5.0.03 - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - regular tests (clm_short): - - cheyenne_intel ---- PASS - cheyenne_gnu ------ PASS - hobart_nag -------- PASS - hobart_intel ------ PASS - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: clm5.0.dev013 - -Changes answers relative to baseline: Yes! - - Summarize any changes to answers, i.e., - - what code configurations: Clm50 2000 and NFIX history variables - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes: ------------------------- - -Externals being used: - - cism: release-cesm2.0.04 - rtm: release-cesm2.0.00 - mosart: release-cesm2.0.00 - cime: cime5.6.10 - FATES: fates_s1.8.1_a3.0.0 - PTCLM: PTCLM2_180611 - -CTSM Tag versions pulled over from master development branch: ctsm1.0.dev002, ctsm1.0dev003, ctsm1.0dev004 - -=============================================================== -=============================================================== -Tag name: release-clm5.0.03 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Tue Jun 12 15:32:53 MDT 2018 -One-line Summary: Second release branch tag for CESM2.0 release, fixing DA and tools and README files, identical to clm5.0.dev013 - -Purpose of this version: ------------------------- - -Update cime and cism to newer versions used in release. These bring in some answer -changes. The cime version updates the orbit for 2000 compsets. The cism version -changes answers for two fields with NO_EVOLVE and more fields for EVOLVE. - -Fixes an important bug needed for use with Data Assimulation. Several changes -to testing. Adding wallclock as needed, changing a few compsets so science -supported compsets are used, added tput_tolerance to some tests known to be -variable. - -Many changes to the clm tools for creating input files. Added the version by -querying "git describe" and adding it as an attribute to NetCDF files. Changes -to get tools working, and tested. Also changed so that tools can be run in either -a CTSM checkout or a CESM checkout. - -Updated README files so they are accurate. - -CTSM Master Tag This Corresponds To: clm5.0.dev013 - -Summary of changes: -------------------- - -Issues fixed (include CTSM Issue #): - #188 -- Global PTCLM tools test fails - #187 -- PTCLM tools tests fail baseline comparisons due to a seg fault - #259 -- Most README files in ctsm are incorrect - #386 -- Shorten some currently very long debug tests - #387 -- Lots of testmods still set orb_iyear and orb_iyear_align - #388 -- Add "git describe" to input files that are created - #389 -- Post data-assimilation processing broken with multi-driver - #393 -- Increase wallclock - #399 -- minor format update needed in namelist_definition_clm4_5.xml - #402 -- Some smaller tests can be slow.. - #411 -- Refactor tools aren't useful anymore - #414 -- PTCLM tests aren't working - #415 -- mkprocdata_map tests aren't working because of bad return statement in script type: bug - other - #418 -- Path needs to be updated for getco2 script type: bug - other - -Science changes since release-clm5.0.01: None - -Software changes since release-clm5.0.01: - Fix an important bug for data assimulation. Work on the CLM tools for creating input files. - Some changes to the CLM testing. - -Changes to User Interface since release-clm5.0.01: None - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - hobart --- PASS - - tools-tests (components/clm/test/tools): - - cheyenne - PASS - hobart --- PASS - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - hobart --- OK - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - - regular tests (prealpha): - - cheyenne_intel - OK - cheyenne_gnu --- OK - hobart_nag ----- OK - - regular tests (prebeta): - - cheyenne_intel - OK - cheyenne_gnu --- OK - hobart_nag ----- OK - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: release-5.0.01 - -Changes answers relative to baseline: Yes - -Changes answers relative to baseline: Yes! Because of changes in cism and cime - - Summarize any changes to answers: - - what code configurations: All 2000 compsets and some cases with cism - - what platforms/compilers: All - - nature of change: similar climate - -Detailed list of changes: ------------------------- - -Externals being used: - cime cime_cesm2_0_rel_03 - cism release-v2.1.01 - rtm release-cesm2.0.00 - mosart release-cesm2.0.00 - fates fates_s1.8.1_a3.0.0 - PTCLM PTCLM2_180611 - - -CTSM Tag versions pulled over from master development branch: clm5.0.dev013 - -=============================================================== -=============================================================== -Tag name: release-clm5.0.01 -Originator(s): erik (Erik Kluzek) -Date: Tue May 22 10:09:15 MDT 2018 -One-line Summary: First release branch tag for CESM2.0 release, identical to clm5.0.dev012 - -Purpose of this version: ------------------------- - -This is the first release branch tag for the CESM2.0 release for CTSM. There are many changes -to software mostly to fix a list of issues. There are some changes to the science that change -answers to fix some small problems, but don't have a large effect on simulations. Externals are -updated to new versions, fixing issues, and in most cases changing answers. The cime version -was updated and brings in some new features. - - -CTSM Master Tag This Corresponds To: clm5.0.dev012 - -Summary of changes: -------------------- - -Issues fixed (include CTSM Issue #): - #379 -- Problems with Hist decStart restart tests due to variable orbital year - #260 -- max daylength doesn't change over time for varying orbital parameters - #363 -- PE Layout - $374 -- Turn BFBFLAG on for testing (so PE layout changes won't appear to change answers) - #382 -- Write statement for VIC - $383 -- mkmapdata intel version` - #68 --- gnu compiler workaround - #364 -- crop f05 datasets - #362 -- svn checkout - #318 -- quadratic bug - #249 -- bypass balance checks for DART - #341 -- add model_doi_url - #346 -- New mode of operation for init_interp: Copy subgrid areas, too - #347 -- endrun message behavior - #345 -- Add a cmip6_evolving_icesheet usermods directory - #351 -- FATES external to https - #310 -- With FUN on soil nitrification flux is not subtracted out of plant uptake of of soil NH4 or NO3 - #313 -- Issues with initial condition files - #298 -- Don't allocate memory for zero-weight PFTs and urban columns - #317 -- c14 bombspike and c13 timeseries code can use the wrong year, with irreproducible behavior - #320 -- I1850Clm50Sp compset mistakenly uses SGLC - #326 -- init_interp can change answers for absorbed radiation in non-existent snow layers - #325 -- init_interp can change answers over the CISM domain - #213 -- usability issue for CPLHIST that Keith found. - #210 -- Recent request to increase number of tapes to 10. - #169 -- usability issue for running hybrid or branch cases with crop that keeps biting Mike Mills. - #68 --- workaround for gnu compiler bug - #46 --- needed for multi-instance - #66 --– need to relax tolerance for negative C/N values in order for CLM45 Crop to work - #65 --– need to change a check from "> 0" to "> [small val]" - #240 -- from Jim - #255 -- get PTCLM working - #253 -- bad clm40 IC file - #304 -- Energy imbalance over land per coupler diagnostics - #271 -- Add some land ice fields for cmip6 - #255 -- PTCLMmkdata doesn't work in the CLM git checkout - -CIME Issues fixed (include issue #): [If none, remove this line] -- ESMCI/cime#2598 (datm doesn't restart properly with variable year orbit) - -Science changes since: clm5.0.000 - - - Max day length is recalculated every time-step so works with a variable orbit - - CISM updates with answer changes - - Update 1850 Nitrogen deposition file used when coupled to cam - - By default orbit for 1850 is for 1850 conditions and for transient is variable by simulation year - - Soil nitrification flux wasn't taken out of plant uptake of either soil NH3 or NO3, with FUN on, and now it is. - - FATES version updated with science changes - - New initial condition files for most configurations - - Bug fixes for energy imbalance associated with surface water and lakes - -Softare changes since: clm5.0.000 - - - Update PE layouts for f45, f09, and f19 - - Turn BFBFLAG on for most testing - - Some fixes to tools for batch submission - - Update cime version - - Update mosart and RTM - - Add f05 crop datasets - - Add pauseResume test and don't do balance checks for two steps after Data Assimulation is done - - Don't allocate memory for zero-weight natveg patches and urban - - Fix some issues with init_interp for glaciers and snow covered areas - - Add some land ice diagnostic vars needed for CMIP6 - - Fix LND_TUNING_MODE for fully coupled case, update some README files/PTCLM - -Changes to User Interface since: clm5.000 - - New namelist item: init_interp_method - - xmlquery will now accept derived attributes. - - New XML variables, PAUSE_ACTIVE_XXX. - - jobid now added to CaseStatus case_submit entry. - - Splits GLC2OCN_RMAPNAME xml variable into - GLC2OCN_LIQ_RMAPNAME and GLC2OCN_ICE_RMAPNAME, and similarly for - GLC2OCN_RMAPTYPE - - New --retry option to create_test. - - Add --clean-depends to case.build, this argument can take a component list and will - clean all components if one is not provided. - -Testing: --------- - - [PASS means all tests PASS and OK means tests PASS other than expected fails.] - - build-namelist tests: - - cheyenne - PASS - - unit-tests (components/clm/src): - - cheyenne - PASS - - tools-tests (components/clm/test/tools): - - cheyenne - OK - - PTCLM testing (components/clm/tools/shared/PTCLM/test): - - cheyenne - OK - - regular tests (aux_clm): - - cheyenne_intel ---- OK - cheyenne_gnu ------ OK - hobart_nag -------- OK - hobart_pgi -------- OK - hobart_intel ------ OK - - regular tests (prealpha): - - cheyenne_intel - OK - cheyenne_gnu --- OK - hobart_nag ----- OK - - regular tests (prebeta): - - cheyenne_intel - OK - cheyenne_gnu --- OK - hobart_nag ----- OK - -Summary of Answer changes: -------------------------- - -Baseline version for comparison: clm5.0.000 - -Changes answers relative to baseline: Yes - - Summarize any changes to answers, i.e., - - what code configurations: - all Clm45 and Clm50 - all 1850, all IHIST cases, all with CISM, all CLM50-BGC with FUN on - all with FATES, all with use_init_interp=T, - all CLM40, CLM45, and cLM%0 because of new initial conditions - - what platforms/compilers: all - - nature of change: similar climate - - URL for LMWG diagnostics output for new climate: - -Detailed list of changes: ------------------------- - -Externals being used: - - cism updated from cism2_1_46 to release-v2.1.00 (answer changes) - rtm updated from rtm1_0_65 to rtm1_0_66 - mosart updated from mosart1_0_30 to mosart1_0_31 - cime updated from cime5.4.0-alpha.03 to a67dceae95567cc7529c4cfed153017f4b65b210 - (answer changes due to new orbit) - fates updated from fates_s1.4.1_a3.0.0_rev3 to fates_s1.8.1_a3.0.0 (answer changes due to science updates) - PTCLM updated from PTCLM2_171216c to PTCLM2_180214 - -CTSM Tag versions pulled over from master development branch: - - clm5.0.dev012 sacks 05/17/2018 Fixes for variable_year orbital mode - clm5.0.dev011 erik 05/16/2018 1850 ndep update, cism update, PE layouts, - turn BFBFLAG for testing - clm5.0.dev010 erik 05/15/2018 Update cime version to version in cesm2.0.beta10, - changes answers for 1850 compsets because of orbit - clm5.0.dev009 sacks 05/10/2018 New init_interp method - clm5.0.dev008 erik 04/27/2018 With FUN subtract out soil nitrification flux of plant - uptake of soil NH3 and NO3 - clm5.0.dev007 erik 04/24/2018 Bring in a few answer changing things: FATES, - cism updates, IC file fix, - testing 1850 compset use 1850 orbit - clm5.0.dev006 sacks 04/12/2018 Don't allocate memory for zero-weight natveg - patches and urban - clm5.0.dev005 sacks 04/10/2018 Two fixes for init_interp - clm5.0.dev004 erik 04/09/2018 List of important bug fixes - clm5.0.dev003 erik 03/09/2018 Bug fixes for energy imbalance associated - with surface water and lakes - clm5.0.dev002 sacks 02/25/2018 Add some land ice diagnostic vars needed for CMIP6 - clm5.0.dev001 erik 02/14/2018 Fix LND_TUNING_MODE for fully coupled case, - update some README files/PTCLM - -=============================================================== -=============================================================== -Tag name: clm5.0.000 -Originator(s): erik (Erik Kluzek,UCAR/TSS,303-497-1326) -Date: Feb 05 2018 -One-line Summary: Initial version of CLM5.0 - -This is the initial science version of CLM5.0. - -Developments for CLM5.0 build on the progress made in CLM4.5. Most major components of the model have been updated with particularly -notable changes made to soil and plant hydrology, snow density, river modeling, carbon and nitrogen cycling and coupling, and crop -modeling. -The updates to CLM science are documented here: - -https://escomp.github.io/ctsm-docs/doc/build/html/tech_note/Introduction/CLM50_Tech_Note_Introduction.html#clm5-0 - -This version has production versions of CLM5.0 CMIP6 land-use change files for 1850, historical, and 2000. It has preliminary -versions of CMIP6 forcing files for Nitrogen deposition and population density. Further updates are needed for prescribed aerosols, -and future scenarios. - -Spunup initial conditions are provided for several CLM physics and forcing combinations from simulations run at 1-degree resolution -(fv 0.9x1.25 with g1xv6 ocean mask). - -=============================================================== - diff --git a/manage_externals/.github/PULL_REQUEST_TEMPLATE.md b/manage_externals/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b68b1fb5e2..0000000000 --- a/manage_externals/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,17 +0,0 @@ -[ 50 character, one line summary ] - -[ Description of the changes in this commit. It should be enough - information for someone not following this development to understand. - Lines should be wrapped at about 72 characters. ] - -User interface changes?: [ No/Yes ] -[ If yes, describe what changed, and steps taken to ensure backward compatibilty ] - -Fixes: [Github issue #s] And brief description of each issue. - -Testing: - test removed: - unit tests: - system tests: - manual testing: - diff --git a/manage_externals/.gitignore b/manage_externals/.gitignore deleted file mode 100644 index 411de5d96e..0000000000 --- a/manage_externals/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -# directories that are checked out by the tool -cime/ -cime_config/ -components/ - -# generated local files -*.log - -# editor files -*~ -*.bak - -# generated python files -*.pyc diff --git a/manage_externals/.travis.yml b/manage_externals/.travis.yml deleted file mode 100644 index b32f81bd28..0000000000 --- a/manage_externals/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -# NOTE(bja, 2017-11) travis-ci dosen't support python language builds -# on mac os. As a work around, we use built-in python on linux, and -# declare osx a 'generic' language, and create our own python env. - -language: python -os: linux -python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" -matrix: - include: - - os: osx - language: generic - before_install: - # NOTE(bja, 2017-11) update is slow, 2.7.12 installed by default, good enough! - # - brew update - # - brew outdated python2 || brew upgrade python2 - - pip install virtualenv - - virtualenv env -p python2 - - source env/bin/activate -install: - - pip install -r test/requirements.txt -before_script: - - git --version -script: - - cd test; make test - - cd test; make lint -after_success: - - cd test; make coverage - - cd test; coveralls diff --git a/manage_externals/test/repos/simple-ext.git/refs/heads/master b/manage_externals/test/repos/simple-ext.git/refs/heads/master deleted file mode 100644 index 5c67504966..0000000000 --- a/manage_externals/test/repos/simple-ext.git/refs/heads/master +++ /dev/null @@ -1 +0,0 @@ -9b75494003deca69527bb64bcaa352e801611dd2 diff --git a/manage_externals/manic/__init__.py b/manic/__init__.py similarity index 100% rename from manage_externals/manic/__init__.py rename to manic/__init__.py diff --git a/manage_externals/manic/checkout.py b/manic/checkout.py similarity index 91% rename from manage_externals/manic/checkout.py rename to manic/checkout.py index c5bbaf5f43..edc5655954 100755 --- a/manage_externals/manic/checkout.py +++ b/manic/checkout.py @@ -227,6 +227,21 @@ def commandline_arguments(args=None): Now, %(prog)s will process Externals.cfg and also process Externals_LIBX.cfg as if it was a sub-external. + * from_submodule (True / False) : used to pull the repo_url, local_path, + and hash properties for this external from the .gitmodules file in + this repository. Note that the section name (the entry in square + brackets) must match the name in the .gitmodules file. + If from_submodule is True, the protocol must be git and no repo_url, + local_path, hash, branch, or tag entries are allowed. + Default: False + + * sparse (string) : used to control a sparse checkout. This optional + entry should point to a filename (path relative to local_path) that + contains instructions on which repository paths to include (or + exclude) from the working tree. + See the "SPARSE CHECKOUT" section of https://git-scm.com/docs/git-read-tree + Default: sparse checkout is disabled + * Lines beginning with '#' or ';' are comments and will be ignored. # Obtaining this tool, reporting issues, etc. @@ -280,6 +295,13 @@ def commandline_arguments(args=None): 'used up to two times, increasing the ' 'verbosity level each time.') + parser.add_argument('--svn-ignore-ancestry', action='store_true', default=False, + help='By default, subversion will abort if a component is ' + 'already checked out and there is no common ancestry with ' + 'the new URL. This flag passes the "--ignore-ancestry" flag ' + 'to the svn switch call. (This is not recommended unless ' + 'you are sure about what you are doing.)') + # # developer options # @@ -348,7 +370,7 @@ def main(args): "No component {} found in {}".format( comp, args.externals)) - source_tree = SourceTree(root_dir, external) + source_tree = SourceTree(root_dir, external, svn_ignore_ancestry=args.svn_ignore_ancestry) printlog('Checking status of externals: ', end='') tree_status = source_tree.status() printlog('') diff --git a/manage_externals/manic/externals_description.py b/manic/externals_description.py similarity index 56% rename from manage_externals/manic/externals_description.py rename to manic/externals_description.py index b32d37cfc6..b0c4f736a7 100644 --- a/manage_externals/manic/externals_description.py +++ b/manic/externals_description.py @@ -22,15 +22,17 @@ import os.path import re -# ConfigParser was renamed in python2 to configparser. In python2, -# ConfigParser returns byte strings, str, instead of unicode. We need -# unicode to be compatible with xml and json parser and python3. +# ConfigParser in python2 was renamed to configparser in python3. +# In python2, ConfigParser returns byte strings, str, instead of unicode. +# We need unicode to be compatible with xml and json parser and python3. try: # python2 from ConfigParser import SafeConfigParser as config_parser from ConfigParser import MissingSectionHeaderError from ConfigParser import NoSectionError, NoOptionError + USE_PYTHON2 = True + def config_string_cleaner(text): """convert strings into unicode """ @@ -41,6 +43,8 @@ def config_string_cleaner(text): from configparser import MissingSectionHeaderError from configparser import NoSectionError, NoOptionError + USE_PYTHON2 = False + def config_string_cleaner(text): """Python3 already uses unicode strings, so just return the string without modification. @@ -49,6 +53,7 @@ def config_string_cleaner(text): return text from .utils import printlog, fatal_error, str_to_bool, expand_local_url +from .utils import execute_subprocess from .global_constants import EMPTY_STR, PPRINTER, VERSION_SEPERATOR # @@ -59,8 +64,8 @@ def config_string_cleaner(text): def read_externals_description_file(root_dir, file_name): - """Given a file name containing a externals description, determine the - format and read it into it's internal representation. + """Read a file containing an externals description and + create its internal representation. """ root_dir = os.path.abspath(root_dir) @@ -70,29 +75,193 @@ def read_externals_description_file(root_dir, file_name): file_path = os.path.join(root_dir, file_name) if not os.path.exists(file_name): - msg = ('ERROR: Model description file, "{0}", does not ' - 'exist at path:\n {1}\nDid you run from the root of ' - 'the source tree?'.format(file_name, file_path)) + if file_name.lower() == "none": + msg = ('INTERNAL ERROR: Attempt to read externals file ' + 'from {0} when not configured'.format(file_path)) + else: + msg = ('ERROR: Model description file, "{0}", does not ' + 'exist at path:\n {1}\nDid you run from the root of ' + 'the source tree?'.format(file_name, file_path)) + fatal_error(msg) + externals_description = None + if file_name == ExternalsDescription.GIT_SUBMODULES_FILENAME: + externals_description = read_gitmodules_file(root_dir, file_name) + else: + try: + config = config_parser() + config.read(file_path) + externals_description = config + except MissingSectionHeaderError: + # not a cfg file + pass + + if externals_description is None: + msg = 'Unknown file format!' + fatal_error(msg) + + return externals_description + +class LstripReader(object): + "LstripReader formats .gitmodules files to be acceptable for configparser" + def __init__(self, filename): + with open(filename, 'r') as infile: + lines = infile.readlines() + self._lines = list() + self._num_lines = len(lines) + self._index = 0 + for line in lines: + self._lines.append(line.lstrip()) + + def readlines(self): + """Return all the lines from this object's file""" + return self._lines + + def readline(self, size=-1): + """Format and return the next line or raise StopIteration""" + try: + line = self.next() + except StopIteration: + line = '' + + if (size > 0) and (len(line) < size): + return line[0:size] + + return line + + def __iter__(self): + """Begin an iteration""" + self._index = 0 + return self + + def next(self): + """Return the next line or raise StopIteration""" + if self._index >= self._num_lines: + raise StopIteration + + self._index = self._index + 1 + return self._lines[self._index - 1] + + def __next__(self): + return self.next() + +def git_submodule_status(repo_dir): + """Run the git submodule status command to obtain submodule hashes. + """ + # This function is here instead of GitRepository to avoid a dependency loop + cwd = os.getcwd() + os.chdir(repo_dir) + cmd = ['git', 'submodule', 'status'] + git_output = execute_subprocess(cmd, output_to_caller=True) + submodules = {} + submods = git_output.split('\n') + for submod in submods: + if submod: + status = submod[0] + items = submod[1:].split(' ') + if len(items) > 2: + tag = items[2] + else: + tag = None + + submodules[items[1]] = {'hash':items[0], 'status':status, 'tag':tag} + + os.chdir(cwd) + return submodules + +def parse_submodules_desc_section(section_items, file_path): + """Find the path and url for this submodule description""" + path = None + url = None + for item in section_items: + name = item[0].strip().lower() + if name == 'path': + path = item[1].strip() + elif name == 'url': + url = item[1].strip() + else: + msg = 'WARNING: Ignoring unknown {} property, in {}' + msg = msg.format(item[0], file_path) # fool pylint + logging.warning(msg) + + return path, url + +def read_gitmodules_file(root_dir, file_name): + # pylint: disable=deprecated-method + # Disabling this check because the method is only used for python2 + """Read a .gitmodules file and convert it to be compatible with an + externals description. + """ + root_dir = os.path.abspath(root_dir) + msg = 'In directory : {0}'.format(root_dir) + logging.info(msg) + printlog('Processing submodules description file : {0}'.format(file_name)) + + file_path = os.path.join(root_dir, file_name) + if not os.path.exists(file_name): + msg = ('ERROR: submodules description file, "{0}", does not ' + 'exist at path:\n {1}'.format(file_name, file_path)) + fatal_error(msg) + + submodules_description = None externals_description = None try: config = config_parser() - config.read(file_path) - externals_description = config + if USE_PYTHON2: + config.readfp(LstripReader(file_path), filename=file_name) + else: + config.read_file(LstripReader(file_path), source=file_name) + + submodules_description = config except MissingSectionHeaderError: # not a cfg file pass - if externals_description is None: + if submodules_description is None: msg = 'Unknown file format!' fatal_error(msg) + else: + # Convert the submodules description to an externals description + externals_description = config_parser() + # We need to grab all the commit hashes for this repo + submods = git_submodule_status(root_dir) + for section in submodules_description.sections(): + if section[0:9] == 'submodule': + sec_name = section[9:].strip(' "') + externals_description.add_section(sec_name) + section_items = submodules_description.items(section) + path, url = parse_submodules_desc_section(section_items, + file_path) + + if path is None: + msg = 'Submodule {} missing path'.format(sec_name) + fatal_error(msg) - return externals_description + if url is None: + msg = 'Submodule {} missing url'.format(sec_name) + fatal_error(msg) + externals_description.set(sec_name, + ExternalsDescription.PATH, path) + externals_description.set(sec_name, + ExternalsDescription.PROTOCOL, 'git') + externals_description.set(sec_name, + ExternalsDescription.REPO_URL, url) + externals_description.set(sec_name, + ExternalsDescription.REQUIRED, 'True') + git_hash = submods[sec_name]['hash'] + externals_description.set(sec_name, + ExternalsDescription.HASH, git_hash) + + # Required items + externals_description.add_section(DESCRIPTION_SECTION) + externals_description.set(DESCRIPTION_SECTION, VERSION_ITEM, '1.0.0') + + return externals_description def create_externals_description( - model_data, model_format='cfg', components=None): + model_data, model_format='cfg', components=None, parent_repo=None): """Create the a externals description object from the provided data """ externals_description = None @@ -103,7 +272,7 @@ def create_externals_description( major, _, _ = get_cfg_schema_version(model_data) if major == 1: externals_description = ExternalsDescriptionConfigV1( - model_data, components=components) + model_data, components=components, parent_repo=parent_repo) else: msg = ('Externals description file has unsupported schema ' 'version "{0}".'.format(major)) @@ -173,18 +342,21 @@ class ExternalsDescription(dict): # keywords defining the interface into the externals description data EXTERNALS = 'externals' BRANCH = 'branch' - REPO = 'repo' - REQUIRED = 'required' - TAG = 'tag' + SUBMODULE = 'from_submodule' + HASH = 'hash' + NAME = 'name' PATH = 'local_path' PROTOCOL = 'protocol' + REPO = 'repo' REPO_URL = 'repo_url' - HASH = 'hash' - NAME = 'name' + REQUIRED = 'required' + TAG = 'tag' + SPARSE = 'sparse' PROTOCOL_EXTERNALS_ONLY = 'externals_only' PROTOCOL_GIT = 'git' PROTOCOL_SVN = 'svn' + GIT_SUBMODULES_FILENAME = '.gitmodules' KNOWN_PRROTOCOLS = [PROTOCOL_GIT, PROTOCOL_SVN, PROTOCOL_EXTERNALS_ONLY] # v1 xml keywords @@ -197,15 +369,17 @@ class ExternalsDescription(dict): _source_schema = {REQUIRED: True, PATH: 'string', EXTERNALS: 'string', + SUBMODULE : True, REPO: {PROTOCOL: 'string', REPO_URL: 'string', TAG: 'string', BRANCH: 'string', HASH: 'string', - } - } + SPARSE: 'string', + } + } - def __init__(self): + def __init__(self, parent_repo=None): """Convert the xml into a standardized dict that can be used to construct the source objects @@ -218,6 +392,7 @@ def __init__(self): self._input_major = None self._input_minor = None self._input_patch = None + self._parent_repo = parent_repo def _verify_schema_version(self): """Use semantic versioning rules to verify we can process this schema. @@ -265,6 +440,7 @@ def _check_user_input(self): self._validate() def _check_data(self): + # pylint: disable=too-many-branches,too-many-statements """Check user supplied data is valid where possible. """ for ext_name in self.keys(): @@ -282,6 +458,13 @@ def _check_data(self): ext_name)) fatal_error(msg) + if ((self[ext_name][self.REPO][self.PROTOCOL] != self.PROTOCOL_GIT) + and (self.SUBMODULE in self[ext_name])): + msg = ('self.SUBMODULE is only supported with {0} protocol, ' + '"{1}" is defined as an {2} repository') + fatal_error(msg.format(self.PROTOCOL_GIT, ext_name, + self[ext_name][self.REPO][self.PROTOCOL])) + if (self[ext_name][self.REPO][self.PROTOCOL] != self.PROTOCOL_EXTERNALS_ONLY): ref_count = 0 @@ -301,11 +484,23 @@ def _check_data(self): found_refs = '"{0} = {1}", {2}'.format( self.HASH, self[ext_name][self.REPO][self.HASH], found_refs) + if (self.SUBMODULE in self[ext_name] and + self[ext_name][self.SUBMODULE]): + ref_count += 1 + found_refs = '"{0} = {1}", {2}'.format( + self.SUBMODULE, + self[ext_name][self.SUBMODULE], found_refs) if ref_count > 1: - msg = ('Model description is over specified! Only one of ' - '"tag", "branch", or "hash" may be specified for ' - 'repo description of "{0}".'.format(ext_name)) + msg = 'Model description is over specified! ' + if self.SUBMODULE in self[ext_name]: + msg += ('from_submodule is not compatible with ' + '"tag", "branch", or "hash" ') + else: + msg += (' Only one of "tag", "branch", or "hash" ' + 'may be specified ') + + msg += 'for repo description of "{0}".'.format(ext_name) msg = '{0}\nFound: {1}'.format(msg, found_refs) fatal_error(msg) elif ref_count < 1: @@ -314,17 +509,39 @@ def _check_data(self): 'repo description of "{0}"'.format(ext_name)) fatal_error(msg) - if self.REPO_URL not in self[ext_name][self.REPO]: + if (self.REPO_URL not in self[ext_name][self.REPO] and + (self.SUBMODULE not in self[ext_name] or + not self[ext_name][self.SUBMODULE])): msg = ('Model description is under specified! Must have ' '"repo_url" in repo ' 'description for "{0}"'.format(ext_name)) fatal_error(msg) - url = expand_local_url( - self[ext_name][self.REPO][self.REPO_URL], ext_name) - self[ext_name][self.REPO][self.REPO_URL] = url + if (self.SUBMODULE in self[ext_name] and + self[ext_name][self.SUBMODULE]): + if self.REPO_URL in self[ext_name][self.REPO]: + msg = ('Model description is over specified! ' + 'from_submodule keyword is not compatible ' + 'with {0} keyword for'.format(self.REPO_URL)) + msg = '{0} repo description of "{1}"'.format(msg, + ext_name) + fatal_error(msg) + + if self.PATH in self[ext_name]: + msg = ('Model description is over specified! ' + 'from_submodule keyword is not compatible with ' + '{0} keyword for'.format(self.PATH)) + msg = '{0} repo description of "{1}"'.format(msg, + ext_name) + fatal_error(msg) + + if self.REPO_URL in self[ext_name][self.REPO]: + url = expand_local_url( + self[ext_name][self.REPO][self.REPO_URL], ext_name) + self[ext_name][self.REPO][self.REPO_URL] = url def _check_optional(self): + # pylint: disable=too-many-branches """Some fields like externals, repo:tag repo:branch are (conditionally) optional. We don't want the user to be required to enter them in every externals description file, but @@ -332,6 +549,7 @@ def _check_optional(self): default values if appropriate. """ + submod_desc = None # Only load submodules info once for field in self: # truely optional if self.EXTERNALS not in self[field]: @@ -346,6 +564,72 @@ def _check_optional(self): self[field][self.REPO][self.HASH] = EMPTY_STR if self.REPO_URL not in self[field][self.REPO]: self[field][self.REPO][self.REPO_URL] = EMPTY_STR + if self.SPARSE not in self[field][self.REPO]: + self[field][self.REPO][self.SPARSE] = EMPTY_STR + + # from_submodule has a complex relationship with other fields + if self.SUBMODULE in self[field]: + # User wants to use submodule information, is it available? + if self._parent_repo is None: + # No parent == no submodule information + PPRINTER.pprint(self[field]) + msg = 'No parent submodule for "{0}"'.format(field) + fatal_error(msg) + elif self._parent_repo.protocol() != self.PROTOCOL_GIT: + PPRINTER.pprint(self[field]) + msg = 'Parent protocol, "{0}", does not support submodules' + fatal_error(msg.format(self._parent_repo.protocol())) + else: + args = self._repo_config_from_submodule(field, submod_desc) + repo_url, repo_path, ref_hash, submod_desc = args + + if repo_url is None: + msg = ('Cannot checkout "{0}" as a submodule, ' + 'repo not found in {1} file') + fatal_error(msg.format(field, + self.GIT_SUBMODULES_FILENAME)) + # Fill in submodule fields + self[field][self.REPO][self.REPO_URL] = repo_url + self[field][self.REPO][self.HASH] = ref_hash + self[field][self.PATH] = repo_path + + if self[field][self.SUBMODULE]: + # We should get everything from the parent submodule + # configuration. + pass + # No else (from _submodule = False is the default) + else: + # Add the default value (not using submodule information) + self[field][self.SUBMODULE] = False + + def _repo_config_from_submodule(self, field, submod_desc): + """Find the external config information for a repository from + its submodule configuration information. + """ + if submod_desc is None: + repo_path = os.getcwd() # Is this always correct? + submod_file = self._parent_repo.submodules_file(repo_path=repo_path) + if submod_file is None: + msg = ('Cannot checkout "{0}" from submodule information\n' + ' Parent repo, "{1}" does not have submodules') + fatal_error(msg.format(field, self._parent_repo.name())) + + submod_file = read_gitmodules_file(repo_path, submod_file) + submod_desc = create_externals_description(submod_file) + + # Can we find our external? + repo_url = None + repo_path = None + ref_hash = None + for ext_field in submod_desc: + if field == ext_field: + ext = submod_desc[ext_field] + repo_url = ext[self.REPO][self.REPO_URL] + repo_path = ext[self.PATH] + ref_hash = ext[self.REPO][self.HASH] + break + + return repo_url, repo_path, ref_hash, submod_desc def _validate(self): """Validate that the parsed externals description contains all necessary @@ -383,11 +667,12 @@ def validate_data_struct(schema, data): if isinstance(schema, dict) and isinstance(data, dict): # Both are dicts, recursively verify that all fields # in schema are present in the data. - for k in schema: - in_ref = in_ref and (k in data) + for key in schema: + in_ref = in_ref and (key in data) if in_ref: valid = valid and ( - validate_data_struct(schema[k], data[k])) + validate_data_struct(schema[key], data[key])) + is_valid = in_ref and valid else: # non-recursive structure. verify data and schema have @@ -434,9 +719,9 @@ def __init__(self, model_data, components=None): self._input_patch = 0 self._verify_schema_version() if components: - for k in model_data.items(): - if k not in components: - del model_data[k] + for key in model_data.items(): + if key not in components: + del model_data[key] self.update(model_data) self._check_user_input() @@ -448,12 +733,12 @@ class ExternalsDescriptionConfigV1(ExternalsDescription): """ - def __init__(self, model_data, components=None): + def __init__(self, model_data, components=None, parent_repo=None): """Convert the config data into a standardized dict that can be used to construct the source objects """ - ExternalsDescription.__init__(self) + ExternalsDescription.__init__(self, parent_repo=parent_repo) self._schema_major = 1 self._schema_minor = 1 self._schema_patch = 0 diff --git a/manage_externals/manic/externals_status.py b/manic/externals_status.py similarity index 100% rename from manage_externals/manic/externals_status.py rename to manic/externals_status.py diff --git a/manage_externals/manic/global_constants.py b/manic/global_constants.py similarity index 100% rename from manage_externals/manic/global_constants.py rename to manic/global_constants.py diff --git a/manage_externals/manic/repository.py b/manic/repository.py similarity index 78% rename from manage_externals/manic/repository.py rename to manic/repository.py index d01849d37a..ea4230fb7b 100644 --- a/manage_externals/manic/repository.py +++ b/manic/repository.py @@ -21,6 +21,7 @@ def __init__(self, component_name, repo): self._branch = repo[ExternalsDescription.BRANCH] self._hash = repo[ExternalsDescription.HASH] self._url = repo[ExternalsDescription.REPO_URL] + self._sparse = repo[ExternalsDescription.SPARSE] if self._url is EMPTY_STR: fatal_error('repo must have a URL') @@ -40,12 +41,14 @@ def __init__(self, component_name, repo): fatal_error('repo {0} must have exactly one of ' 'tag, branch or hash.'.format(self._name)) - def checkout(self, base_dir_path, repo_dir_name, verbosity): # pylint: disable=unused-argument + def checkout(self, base_dir_path, repo_dir_name, verbosity, recursive): # pylint: disable=unused-argument """ If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the source. If the repo destination directory does not exist, checkout the correce branch or tag. + NB: is include as an argument for compatibility with + git functionality (repository_git.py) """ msg = ('DEV_ERROR: checkout method must be implemented in all ' 'repository classes! {0}'.format(self.__class__.__name__)) @@ -59,6 +62,11 @@ def status(self, stat, repo_dir_path): # pylint: disable=unused-argument 'repository classes! {0}'.format(self.__class__.__name__)) fatal_error(msg) + def submodules_file(self, repo_path=None): + # pylint: disable=no-self-use,unused-argument + """Stub for use by non-git VC systems""" + return None + def url(self): """Public access of repo url. """ @@ -78,3 +86,13 @@ def hash(self): """Public access of repo hash. """ return self._hash + + def name(self): + """Public access of repo name. + """ + return self._name + + def protocol(self): + """Public access of repo protocol. + """ + return self._protocol diff --git a/manage_externals/manic/repository_factory.py b/manic/repository_factory.py similarity index 83% rename from manage_externals/manic/repository_factory.py rename to manic/repository_factory.py index c95e7a509b..80a92a9d8a 100644 --- a/manage_externals/manic/repository_factory.py +++ b/manic/repository_factory.py @@ -11,7 +11,7 @@ from .utils import fatal_error -def create_repository(component_name, repo_info): +def create_repository(component_name, repo_info, svn_ignore_ancestry=False): """Determine what type of repository we have, i.e. git or svn, and create the appropriate object. @@ -20,7 +20,7 @@ def create_repository(component_name, repo_info): if protocol == 'git': repo = GitRepository(component_name, repo_info) elif protocol == 'svn': - repo = SvnRepository(component_name, repo_info) + repo = SvnRepository(component_name, repo_info, ignore_ancestry=svn_ignore_ancestry) elif protocol == 'externals_only': repo = None else: diff --git a/manage_externals/manic/repository_git.py b/manic/repository_git.py similarity index 85% rename from manage_externals/manic/repository_git.py rename to manic/repository_git.py index efb775d0bc..f986051001 100644 --- a/manage_externals/manic/repository_git.py +++ b/manic/repository_git.py @@ -12,6 +12,7 @@ from .global_constants import VERBOSITY_VERBOSE from .repository import Repository from .externals_status import ExternalStatus +from .externals_description import ExternalsDescription, git_submodule_status from .utils import expand_local_url, split_remote_url, is_remote_url from .utils import fatal_error, printlog from .utils import execute_subprocess @@ -41,17 +42,19 @@ def __init__(self, component_name, repo): Parse repo (a XML element). """ Repository.__init__(self, component_name, repo) + self._gitmodules = None + self._submods = None # ---------------------------------------------------------------- # # Public API, defined by Repository # # ---------------------------------------------------------------- - def checkout(self, base_dir_path, repo_dir_name, verbosity): + def checkout(self, base_dir_path, repo_dir_name, verbosity, recursive): """ If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the source. - If the repo destination directory does not exist, checkout the correce + If the repo destination directory does not exist, checkout the correct branch or tag. """ repo_dir_path = os.path.join(base_dir_path, repo_dir_name) @@ -59,7 +62,15 @@ def checkout(self, base_dir_path, repo_dir_name, verbosity): if (repo_dir_exists and not os.listdir( repo_dir_path)) or not repo_dir_exists: self._clone_repo(base_dir_path, repo_dir_name, verbosity) - self._checkout_ref(repo_dir_path, verbosity) + self._checkout_ref(repo_dir_path, verbosity, recursive) + gmpath = os.path.join(repo_dir_path, + ExternalsDescription.GIT_SUBMODULES_FILENAME) + if os.path.exists(gmpath): + self._gitmodules = gmpath + self._submods = git_submodule_status(repo_dir_path) + else: + self._gitmodules = None + self._submods = None def status(self, stat, repo_dir_path): """ @@ -72,6 +83,16 @@ def status(self, stat, repo_dir_path): if os.path.exists(repo_dir_path): self._status_summary(stat, repo_dir_path) + def submodules_file(self, repo_path=None): + if repo_path is not None: + gmpath = os.path.join(repo_path, + ExternalsDescription.GIT_SUBMODULES_FILENAME) + if os.path.exists(gmpath): + self._gitmodules = gmpath + self._submods = git_submodule_status(repo_path) + + return self._gitmodules + # ---------------------------------------------------------------- # # Internal work functions @@ -282,23 +303,30 @@ def _create_remote_name(self): remote_name = "{0}_{1}".format(base_name, repo_name) return remote_name - def _checkout_ref(self, repo_dir, verbosity): + def _checkout_ref(self, repo_dir, verbosity, submodules): """Checkout the user supplied reference + if is True, recursively initialize and update + the repo's submodules """ # import pdb; pdb.set_trace() cwd = os.getcwd() os.chdir(repo_dir) if self._url.strip() == LOCAL_PATH_INDICATOR: - self._checkout_local_ref(verbosity) + self._checkout_local_ref(verbosity, submodules) else: - self._checkout_external_ref(verbosity) + self._checkout_external_ref(verbosity, submodules) + + if self._sparse: + self._sparse_checkout(repo_dir, verbosity) os.chdir(cwd) - def _checkout_local_ref(self, verbosity): + + def _checkout_local_ref(self, verbosity, submodules): """Checkout the reference considering the local repo only. Do not fetch any additional remotes or specify the remote when checkout out the ref. - + if is True, recursively initialize and update + the repo's submodules """ if self._tag: ref = self._tag @@ -308,10 +336,12 @@ def _checkout_local_ref(self, verbosity): ref = self._hash self._check_for_valid_ref(ref) - self._git_checkout_ref(ref, verbosity) + self._git_checkout_ref(ref, verbosity, submodules) - def _checkout_external_ref(self, verbosity): + def _checkout_external_ref(self, verbosity, submodules): """Checkout the reference from a remote repository + if is True, recursively initialize and update + the repo's submodules """ if self._tag: ref = self._tag @@ -326,14 +356,28 @@ def _checkout_external_ref(self, verbosity): self._git_remote_add(remote_name, self._url) self._git_fetch(remote_name) - # NOTE(bja, 2018-03) we need to send seperate ref and remote + # NOTE(bja, 2018-03) we need to send separate ref and remote # name to check_for_vaild_ref, but the combined name to # checkout_ref! self._check_for_valid_ref(ref, remote_name) if self._branch: ref = '{0}/{1}'.format(remote_name, ref) - self._git_checkout_ref(ref, verbosity) + self._git_checkout_ref(ref, verbosity, submodules) + + def _sparse_checkout(self, repo_dir, verbosity): + """Use git read-tree to thin the working tree.""" + cwd = os.getcwd() + + cmd = ['cp', self._sparse, os.path.join(repo_dir, + '.git/info/sparse-checkout')] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + execute_subprocess(cmd) + os.chdir(repo_dir) + self._git_sparse_checkout(verbosity) + + os.chdir(cwd) def _check_for_valid_ref(self, ref, remote_name=None): """Try some basic sanity checks on the user supplied reference so we @@ -687,6 +731,19 @@ def _git_remote_verbose(): git_output = execute_subprocess(cmd, output_to_caller=True) return git_output + @staticmethod + def has_submodules(repo_dir_path=None): + """Return True iff the repository at (or the current + directory if is None) has a '.gitmodules' file + """ + if repo_dir_path is None: + fname = ExternalsDescription.GIT_SUBMODULES_FILENAME + else: + fname = os.path.join(repo_dir_path, + ExternalsDescription.GIT_SUBMODULES_FILENAME) + + return os.path.exists(fname) + # ---------------------------------------------------------------- # # system call to git for sideffects modifying the working tree @@ -696,28 +753,34 @@ def _git_remote_verbose(): def _git_clone(url, repo_dir_name, verbosity): """Run git clone for the side effect of creating a repository. """ - cmd = ['git', 'clone', '--quiet', url, repo_dir_name] + cmd = ['git', 'clone', '--quiet'] + subcmd = None + + cmd.extend([url, repo_dir_name]) if verbosity >= VERBOSITY_VERBOSE: printlog(' {0}'.format(' '.join(cmd))) execute_subprocess(cmd) + if subcmd is not None: + os.chdir(repo_dir_name) + execute_subprocess(subcmd) @staticmethod def _git_remote_add(name, url): - """Run the git remote command to for the side effect of adding a remote + """Run the git remote command for the side effect of adding a remote """ cmd = ['git', 'remote', 'add', name, url] execute_subprocess(cmd) @staticmethod def _git_fetch(remote_name): - """Run the git fetch command to for the side effect of updating the repo + """Run the git fetch command for the side effect of updating the repo """ cmd = ['git', 'fetch', '--quiet', '--tags', remote_name] execute_subprocess(cmd) @staticmethod - def _git_checkout_ref(ref, verbosity): - """Run the git checkout command to for the side effect of updating the repo + def _git_checkout_ref(ref, verbosity, submodules): + """Run the git checkout command for the side effect of updating the repo Param: ref is a reference to a local or remote object in the form 'origin/my_feature', or 'tag1'. @@ -727,3 +790,30 @@ def _git_checkout_ref(ref, verbosity): if verbosity >= VERBOSITY_VERBOSE: printlog(' {0}'.format(' '.join(cmd))) execute_subprocess(cmd) + if submodules: + GitRepository._git_update_submodules(verbosity) + + @staticmethod + def _git_sparse_checkout(verbosity): + """Configure repo via read-tree.""" + cmd = ['git', 'config', 'core.sparsecheckout', 'true'] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + execute_subprocess(cmd) + cmd = ['git', 'read-tree', '-mu', 'HEAD'] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + execute_subprocess(cmd) + + @staticmethod + def _git_update_submodules(verbosity): + """Run git submodule update for the side effect of updating this + repo's submodules. + """ + # First, verify that we have a .gitmodules file + if os.path.exists(ExternalsDescription.GIT_SUBMODULES_FILENAME): + cmd = ['git', 'submodule', 'update', '--init', '--recursive'] + if verbosity >= VERBOSITY_VERBOSE: + printlog(' {0}'.format(' '.join(cmd))) + + execute_subprocess(cmd) diff --git a/manage_externals/manic/repository_svn.py b/manic/repository_svn.py similarity index 92% rename from manage_externals/manic/repository_svn.py rename to manic/repository_svn.py index bef6f81414..408ed84676 100644 --- a/manage_externals/manic/repository_svn.py +++ b/manic/repository_svn.py @@ -37,11 +37,12 @@ class SvnRepository(Repository): """ RE_URLLINE = re.compile(r'^URL:') - def __init__(self, component_name, repo): + def __init__(self, component_name, repo, ignore_ancestry=False): """ Parse repo (a XML element). """ Repository.__init__(self, component_name, repo) + self._ignore_ancestry = ignore_ancestry if self._branch: self._url = os.path.join(self._url, self._branch) elif self._tag: @@ -55,7 +56,7 @@ def __init__(self, component_name, repo): # Public API, defined by Repository # # ---------------------------------------------------------------- - def checkout(self, base_dir_path, repo_dir_name, verbosity): + def checkout(self, base_dir_path, repo_dir_name, verbosity, recursive): # pylint: disable=unused-argument """Checkout or update the working copy If the repo destination directory exists, switch the sandbox to @@ -63,13 +64,15 @@ def checkout(self, base_dir_path, repo_dir_name, verbosity): If the repo destination directory does not exist, checkout the correct branch or tag. + NB: is include as an argument for compatibility with + git functionality (repository_git.py) """ repo_dir_path = os.path.join(base_dir_path, repo_dir_name) if os.path.exists(repo_dir_path): cwd = os.getcwd() os.chdir(repo_dir_path) - self._svn_switch(self._url, verbosity) + self._svn_switch(self._url, self._ignore_ancestry, verbosity) # svn switch can lead to a conflict state, but it gives a # return code of 0. So now we need to make sure that we're # in a clean (non-conflict) state. @@ -137,9 +140,7 @@ def _abort_if_dirty(self, repo_dir_path, message): To recover: Clean up the above directory (resolving conflicts, etc.), then rerun checkout_externals. -""".format(cwd=repo_dir_path, - message=message, - status=status) +""".format(cwd=repo_dir_path, message=message, status=status) fatal_error(errmsg) @@ -219,9 +220,8 @@ def xml_status_is_dirty(svn_output): continue if item == SVN_UNVERSIONED: continue - else: - is_dirty = True - break + is_dirty = True + break return is_dirty # ---------------------------------------------------------------- @@ -270,11 +270,14 @@ def _svn_checkout(url, repo_dir_path, verbosity): execute_subprocess(cmd) @staticmethod - def _svn_switch(url, verbosity): + def _svn_switch(url, ignore_ancestry, verbosity): """ Switch branches for in an svn sandbox """ - cmd = ['svn', 'switch', '--quiet', url] + cmd = ['svn', 'switch', '--quiet'] + if ignore_ancestry: + cmd.append('--ignore-ancestry') + cmd.append(url) if verbosity >= VERBOSITY_VERBOSE: printlog(' {0}'.format(' '.join(cmd))) execute_subprocess(cmd) diff --git a/manage_externals/manic/sourcetree.py b/manic/sourcetree.py similarity index 80% rename from manage_externals/manic/sourcetree.py rename to manic/sourcetree.py index dff91dc1af..b9c9c21082 100644 --- a/manage_externals/manic/sourcetree.py +++ b/manic/sourcetree.py @@ -11,12 +11,12 @@ from .externals_description import read_externals_description_file from .externals_description import create_externals_description from .repository_factory import create_repository +from .repository_git import GitRepository from .externals_status import ExternalStatus from .utils import fatal_error, printlog from .global_constants import EMPTY_STR, LOCAL_PATH_INDICATOR from .global_constants import VERBOSITY_VERBOSE - class _External(object): """ _External represents an external object inside a SourceTree @@ -24,7 +24,7 @@ class _External(object): # pylint: disable=R0902 - def __init__(self, root_dir, name, ext_description): + def __init__(self, root_dir, name, ext_description, svn_ignore_ancestry): """Parse an external description file into a dictionary of externals. Input: @@ -37,12 +37,15 @@ def __init__(self, root_dir, name, ext_description): ext_description : dict - source ExternalsDescription object + svn_ignore_ancestry : bool - use --ignore-externals with svn switch + """ self._name = name self._repo = None self._externals = EMPTY_STR self._externals_sourcetree = None self._stat = ExternalStatus() + self._sparse = None # Parse the sub-elements # _path : local path relative to the containing source tree @@ -59,13 +62,20 @@ def __init__(self, root_dir, name, ext_description): self._required = ext_description[ExternalsDescription.REQUIRED] self._externals = ext_description[ExternalsDescription.EXTERNALS] - if self._externals: - self._create_externals_sourcetree() + # Treat a .gitmodules file as a backup externals config + if not self._externals: + if GitRepository.has_submodules(self._repo_dir_path): + self._externals = ExternalsDescription.GIT_SUBMODULES_FILENAME + repo = create_repository( - name, ext_description[ExternalsDescription.REPO]) + name, ext_description[ExternalsDescription.REPO], + svn_ignore_ancestry=svn_ignore_ancestry) if repo: self._repo = repo + if self._externals and (self._externals.lower() != 'none'): + self._create_externals_sourcetree() + def get_name(self): """ Return the external object's name @@ -122,7 +132,7 @@ def status(self): if self._externals and self._externals_sourcetree: # we expect externals and they exist cwd = os.getcwd() - # SourceTree expecteds to be called from the correct + # SourceTree expects to be called from the correct # root directory. os.chdir(self._repo_dir_path) ext_stats = self._externals_sourcetree.status(self._local_path) @@ -145,7 +155,7 @@ def checkout(self, verbosity, load_all): """ If the repo destination directory exists, ensure it is correct (from correct URL, correct branch or tag), and possibly update the external. - If the repo destination directory does not exist, checkout the correce + If the repo destination directory does not exist, checkout the correct branch or tag. If load_all is True, also load all of the the externals sub-externals. """ @@ -180,13 +190,14 @@ def checkout(self, verbosity, load_all): checkout_verbosity = verbosity - 1 else: checkout_verbosity = verbosity - self._repo.checkout(self._base_dir_path, - self._repo_dir_name, checkout_verbosity) + + self._repo.checkout(self._base_dir_path, self._repo_dir_name, + checkout_verbosity, self.clone_recursive()) def checkout_externals(self, verbosity, load_all): """Checkout the sub-externals for this object """ - if self._externals: + if self.load_externals(): if self._externals_sourcetree: # NOTE(bja, 2018-02): the subtree externals objects # were created during initial status check. Updating @@ -198,6 +209,24 @@ def checkout_externals(self, verbosity, load_all): self._create_externals_sourcetree() self._externals_sourcetree.checkout(verbosity, load_all) + def load_externals(self): + 'Return True iff an externals file should be loaded' + load_ex = False + if os.path.exists(self._repo_dir_path): + if self._externals: + if self._externals.lower() != 'none': + load_ex = os.path.exists(os.path.join(self._repo_dir_path, + self._externals)) + + return load_ex + + def clone_recursive(self): + 'Return True iff any .gitmodules files should be processed' + # Try recursive unless there is an externals entry + recursive = not self._externals + + return recursive + def _create_externals_sourcetree(self): """ """ @@ -210,6 +239,15 @@ def _create_externals_sourcetree(self): cwd = os.getcwd() os.chdir(self._repo_dir_path) + if self._externals.lower() == 'none': + msg = ('Internal: Attempt to create source tree for ' + 'externals = none in {}'.format(self._repo_dir_path)) + fatal_error(msg) + + if not os.path.exists(self._externals): + if GitRepository.has_submodules(): + self._externals = ExternalsDescription.GIT_SUBMODULES_FILENAME + if not os.path.exists(self._externals): # NOTE(bja, 2017-10) this check is redundent with the one # in read_externals_description_file! @@ -221,17 +259,17 @@ def _create_externals_sourcetree(self): externals_root = self._repo_dir_path model_data = read_externals_description_file(externals_root, self._externals) - externals = create_externals_description(model_data) + externals = create_externals_description(model_data, + parent_repo=self._repo) self._externals_sourcetree = SourceTree(externals_root, externals) os.chdir(cwd) - class SourceTree(object): """ SourceTree represents a group of managed externals """ - def __init__(self, root_dir, model): + def __init__(self, root_dir, model, svn_ignore_ancestry=False): """ Build a SourceTree object from a model description """ @@ -239,7 +277,7 @@ def __init__(self, root_dir, model): self._all_components = {} self._required_compnames = [] for comp in model: - src = _External(self._root_dir, comp, model[comp]) + src = _External(self._root_dir, comp, model[comp], svn_ignore_ancestry) self._all_components[comp] = src if model[comp][ExternalsDescription.REQUIRED]: self._required_compnames.append(comp) @@ -261,18 +299,20 @@ def status(self, relative_path_base=LOCAL_PATH_INDICATOR): for comp in load_comps: printlog('{0}, '.format(comp), end='') stat = self._all_components[comp].status() + stat_final = {} for name in stat.keys(): # check if we need to append the relative_path_base to # the path so it will be sorted in the correct order. - if not stat[name].path.startswith(relative_path_base): - stat[name].path = os.path.join(relative_path_base, - stat[name].path) - # store under key = updated path, and delete the - # old key. - comp_stat = stat[name] - del stat[name] - stat[comp_stat.path] = comp_stat - summary.update(stat) + if stat[name].path.startswith(relative_path_base): + # use as is, without any changes to path + stat_final[name] = stat[name] + else: + # append relative_path_base to path and store under key = updated path + modified_path = os.path.join(relative_path_base, + stat[name].path) + stat_final[modified_path] = stat[name] + stat_final[modified_path].path = modified_path + summary.update(stat_final) return summary diff --git a/manage_externals/manic/utils.py b/manic/utils.py similarity index 100% rename from manage_externals/manic/utils.py rename to manic/utils.py diff --git a/parse_cime.cs.status b/parse_cime.cs.status deleted file mode 100755 index 08bb1bfc86..0000000000 --- a/parse_cime.cs.status +++ /dev/null @@ -1,416 +0,0 @@ -#!/usr/bin/env perl -#======================================================================= -# -# Parse a cime5 cs.status file to give summary output -# -# Usage: -# -# ./parse_cime.cs.status -# -# Erik Kluzek -# Sep/19/2016 -# -#======================================================================= -use Cwd; -use strict; -#use diagnostics; -use English; -use Getopt::Long; -use IO::File; - -#----------------------------------------------------------------------------------------------- -# Set the directory that contains this scripts. If the command was issued using a -# relative or absolute path, that path is in $ProgDir. Otherwise assume the -# command was issued from the current working directory. - -sub GetNameNDir { - (my $ProgName = $0) =~ s!(.*)/!!; # name of this script - my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script is in - # the user's PATH - my $cmdline = "@ARGV"; # Command line arguments to script - my $cwd = getcwd(); # current working directory - my $scrdir; # absolute pathname of directory that contains this script - my $nm = "$ProgName::"; # name to use if script dies - if ($ProgDir) { - $scrdir = absolute_path($ProgDir); - } else { - $scrdir = $cwd; - } - return( $ProgName, $scrdir ); -} - - -#----------------------------------------------------------------------------------------------- - -sub usage { - my $ProgName = shift; - die < [options] -REQUIRED OPTIONS - cime5 cs.status. file(s) that will be run and parsed - At least one file needs to be given, but you can also - give a list of space seperated files. -OPTIONS - -die_on_duplicate Die if find a duplicate testname - -summarize [or -s] Summarize results into lists of tests in categories (pend, pass, fail etc.) - -sum_results_perline Summarize results categories of each test into one line - -help [or -h] Print usage to STDOUT. - -verbose [or -v] Make output more verbose. - --summarize and -sum_results_perline can NOT both be asked for as they contrdict each other. -EOF -} - -#----------------------------------------------------------------------------------------------- - - -sub process_cmdline { -# Process command-line options. - my $ProgName = shift; - - my %opts = ( - csstatusfiles_ref => undef, - sumintocats => 0, - sumperline => 0, - dieondup => 0, - help => 0, - verbose => 0, - ); - - GetOptions( - "h|help" => \$opts{'help'}, - "s|summarize" => \$opts{'sumintocats'}, - "die_on_duplicate" => \$opts{'dieondup'}, - "sum_results_perline" => \$opts{'sumperline'}, - "v|verbose" => \$opts{'verbose'}, - ) or usage($ProgName); - - # Give usage message. - usage($ProgName) if $opts{'help'}; - - # If bad input - if ( $opts{'sumintocats'} && $opts{'sumperline'} ) { - print "ERROR: options -summarize and -sum_results_perline contradict each other, choose one or the other or neither\n"; - usage($ProgName); - } - - # Get cs.status filenames - $opts{'csstatusfiles_ref'} = \@ARGV; - - my $files_ref = $opts{'csstatusfiles_ref'}; - - if ( $#$files_ref == -1 ) { - print "ERROR: cs.status filename(s) was (were) NOT input\n"; - usage($ProgName); - } - - foreach my $file ( @$files_ref ) { - if ( ! -x $file ) { - print "ERROR: cs.status filename does NOT exist: $file\n"; - usage($ProgName); - } - } - - return( %opts ); -} - -#------------------------------------------------------------------------------- - -sub absolute_path { -# -# Convert a pathname into an absolute pathname, expanding any . or .. characters. -# Assumes pathnames refer to a local filesystem. -# Assumes the directory separator is "/". -# - my $path = shift; - my $cwd = getcwd(); # current working directory - my $abspath; # resulting absolute pathname - -# Strip off any leading or trailing whitespace. (This pattern won't match if -# there's embedded whitespace. - $path =~ s!^\s*(\S*)\s*$!$1!; - -# Convert relative to absolute path. - - if ($path =~ m!^\.$!) { # path is "." - return $cwd; - } elsif ($path =~ m!^\./!) { # path starts with "./" - $path =~ s!^\.!$cwd!; - } elsif ($path =~ m!^\.\.$!) { # path is ".." - $path = "$cwd/.."; - } elsif ($path =~ m!^\.\./!) { # path starts with "../" - $path = "$cwd/$path"; - } elsif ($path =~ m!^[^/]!) { # path starts with non-slash character - $path = "$cwd/$path"; - } - - my ($dir, @dirs2); - my @dirs = split "/", $path, -1; # The -1 prevents split from stripping trailing nulls - # This enables correct processing of the input "/". - - # Remove any "" that are not leading. - for (my $i=0; $i<=$#dirs; ++$i) { - if ($i == 0 or $dirs[$i] ne "") { - push @dirs2, $dirs[$i]; - } - } - @dirs = (); - - # Remove any "." - foreach $dir (@dirs2) { - unless ($dir eq ".") { - push @dirs, $dir; - } - } - @dirs2 = (); - - # Remove the "subdir/.." parts. - foreach $dir (@dirs) { - if ( $dir !~ /^\.\.$/ ) { - push @dirs2, $dir; - } else { - pop @dirs2; # remove previous dir when current dir is .. - } - } - if ($#dirs2 == 0 and $dirs2[0] eq "") { return "/"; } - $abspath = join '/', @dirs2; - return( $abspath ); -} - -sub run_csstatus { - # run a cs.status file and parse it's output - my ( $csstatusfilename, $verbose, $csstatus_ref, $dieondup ) = @_; - - if ( ! -x $csstatusfilename ) { - die "ERROR: cs.status file does NOT exist or can not execute: $csstatusfilename\n"; - } - my $csdate = undef; - if ( $csstatusfilename =~ /cs.status.([0-9_]+)/ ) { - $csdate = $1; - chomp( $csdate ); - } - if ( $verbose ) { print "Parse file: $csstatusfilename\n"; } - my @lines = `$csstatusfilename`; - while ( my $line = shift(@lines) ) { - if ( $line =~ /([^ ]+) \(Overall: ([^ ,]+)\)/ ) { - my $test = $1; - my $over = $2; - my $fails = ""; my $passes = ""; my $pendings = ""; - my $newline; - my $bfail = 0; - if ( $verbose ) { print "$test\n"; } - do { - $newline = shift(@lines); - if ( $newline =~ /FAIL[ ]+$test ([^ ]+)/ ) { - $fails .= " $1"; - chomp( $fails ); - if ( $1 eq "BASELINE" ) { - if ( $newline =~ /ERROR BFAIL baseline directory/ ) { - $bfail = 1; - } - } - } elsif ( $newline =~ /PASS[ ]+$test ([^ ]+)/ ) { - $passes .= " $1"; - chomp( $passes ); - } elsif ( $newline =~ /PEND[ ]+$test ([^ ]+)/ ) { - $pendings .= " $1"; - chomp( $pendings ); - } elsif ( (! $newline) || ($newline =~ /Overall:/) ) { - } else { - if ( $verbose ) { print "ERROR: parsing line: $newline\n"; } - } - } until ( (! $newline) || ($newline =~ /Overall:/) ); - if ( $newline ) { - unshift( @lines, $newline ); - } - if ( $over eq "NLFAIL" ) { - $over = "PASS"; - } - elsif ( $over eq "NLCOMP" ) { - $over = "PASS"; - } - elsif ( $over eq "DIFF" ) { - if ( $bfail ) { - $over = "FAIL_BDNE"; - } else { - $over = "DIFF"; - } - } - if ( exists($$csstatus_ref{$test}) ) { - if ( $dieondup ) { - die "ERROR: Already had a test that matches this one: $test\n"; - } - next; - } - $$csstatus_ref{$test}{'over'} = $over; - $$csstatus_ref{$test}{'FAIL'} = $fails; - $$csstatus_ref{$test}{'PASS'} = $passes; - $$csstatus_ref{$test}{'PEND'} = $pendings; - if ( ! $newline ) { last; } - } else { - if ( $verbose ) { print( "WARNING: Didn't parse following line:\n$line" ); } - } - } - -} - -sub print_status { - # Print status info for each test - - my %csstatus = @_; - - foreach my $key ( keys(%csstatus) ) { - foreach my $type ( "PASS", "FAIL", "PEND" ) { - if ( $csstatus{$key}{$type} ne "" ) { - foreach my $phase ( split( / /, $csstatus{$key}{$type}) ) { - if ( $phase =~ /[^ ]+/ ) { - printf( "%-10s %-90s %s\n", $type, $key, $phase ); - } - } - } - } - } -} - -sub print_sumperline { - # Print summary info for each test - - my %csstatus = @_; - - foreach my $key ( keys(%csstatus) ) { - printf( "%-10s %-90s Passing: %s\n", $csstatus{$key}{'over'}, $key, $csstatus{$key}{'PASS'} ); - if ( $csstatus{$key}{'FAIL'} ne "" ) { - printf( "%-10s %-90s %s\n", "FAIL", $key, $csstatus{$key}{'FAIL'} ); - } - if ( $csstatus{$key}{'PEND'} ne "" ) { - printf( "%-10s %-90s %s\n", "PEND", $key, $csstatus{$key}{'PEND'} ); - } - } -} - - - -sub print_categories { - # Seperate tests into categories - - my $scrdir = shift(@_); - my %csstatus = @_; - - my $expectedfailfile = "$scrdir/components/clm/cime_config/testdefs/ExpectedTestFails.xml"; - if ( ! -f $expectedfailfile ) { - $expectedfailfile = "$scrdir/cime_config/testdefs/ExpectedTestFails.xml"; - } - my @passes; - my @fails; - my @pendings; - my @compares_diff; - my @compares_diff_nobase; - my @keys = sort( keys(%csstatus) ); - foreach my $key ( @keys ) { - if ( $csstatus{$key}{'over'} eq "PASS" ) { - push( @passes, $key ); - } elsif ( $csstatus{$key}{'over'} eq "DIFF" ) { - push( @passes, $key ); - push( @compares_diff, $key ); - } elsif ( $csstatus{$key}{'over'} eq "FAIL_BDNE" ) { - push( @passes, $key ); - push( @compares_diff_nobase, $key ); - } elsif ( $csstatus{$key}{'over'} eq "FAIL" ) { - push( @fails, $key ); - } elsif ( $csstatus{$key}{'over'} eq "PEND" ) { - push( @pendings, $key ); - } else { - print( "WARNING: unclassified overall status: $key, $csstatus{$key}{'over'}\n" ); - } - } - print( "================================================================================\n" ); - print( "Test summary\n" ); - printf( "%d Total tests\n", $#keys+1 ); - printf( "%d Tests passed\n", $#passes+1 ); - printf( "%d Tests compare different to baseline\n", $#compares_diff+1 ); - printf( "%d Tests are new where there is no baseline\n", $#compares_diff_nobase+1 ); - printf( "%d Tests pending\n", $#pendings+1 ); - printf( "%d Tests failed\n", $#fails+1 ); - print( "================================================================================\n" ); - - if ( $#passes >= 0 ) { - print( "================================================================================\n" ); - print( "These tests passed\n" ); - print( "================================================================================\n" ); - foreach my $key ( @passes ) { - my $expect = ""; - `grep $key $expectedfailfile > /dev/null`; - if ( $? == 0 ) { $expect = "FAILED PREVIOUSLY"; } - print( "$key\t\t\t$expect\n" ); - } - } - if ( $#compares_diff >= 0 ) { - print( "================================================================================\n" ); - print( "These tests compare different to the baseline\n" ); - print( "================================================================================\n" ); - foreach my $key ( @compares_diff ) { - print( "$key\n" ); - } - } - if ( $#compares_diff_nobase >= 0 ) { - print( "================================================================================\n" ); - print( "These tests don't have a baseline to compare to\n" ); - print( "================================================================================\n" ); - foreach my $key ( @compares_diff_nobase ) { - print( "$key\n" ); - } - } - if ( $#pendings >= 0 ) { - print( "================================================================================\n" ); - print( "These tests are pending (some tests may fail in the pending state)\n" ); - print( "================================================================================\n" ); - foreach my $key ( @pendings ) { - my $expect = ""; - `grep $key $expectedfailfile > /dev/null`; - if ( $? == 0 ) { $expect = "EXPECTED"; } - print( "$key\t\t$expect\n" ); - } - } - if ( $#fails >= 0 ) { - print( "================================================================================\n" ); - print( "These tests failed\n" ); - print( "================================================================================\n" ); - foreach my $key ( @fails ) { - my $expect = ""; - `grep $key $expectedfailfile > /dev/null`; - if ( $? == 0 ) { $expect = "EXPECTED"; } - print( "$key\t\t$expect\n" ); - } - } -} - -#----------------------------------------------------------------------------------------------- - -sub main { -# main subroutine - my ($ProgName, $scrdir) = &GetNameNDir( ); - my $pwd = `pwd`; - chomp( $pwd ); - my %opts = &process_cmdline( $ProgName ); - my %csstatus; - my $files_ref = $opts{'csstatusfiles_ref'}; - foreach my $file ( @$files_ref ) { - &run_csstatus( "$pwd/$file", $opts{'verbose'}, \%csstatus, $opts{'dieondup'} ); - } - if ( $opts{'verbose'} ) { - print "Print summary of testing:\n"; - } - if ( $opts{'sumintocats'} ) { - &print_categories( $scrdir, %csstatus ); - } elsif ( $opts{'sumperline'} ) { - &print_sumperline( %csstatus ); - } else { - &print_status( %csstatus ); - } -} - -# Invoke the main subroutine -&main(); - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index be66201047..0000000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,108 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -list(APPEND CMAKE_MODULE_PATH ${CIME_CMAKE_MODULE_DIRECTORY}) -include(CIME_initial_setup) - -project(clm45_tests Fortran C) - -include(CIME_utils) - -set(CLM_ROOT "..") - -# This definition is needed to avoid having ESMF depend on mpi -add_definitions(-DHIDE_MPI) - -# Add source directories from other share code (csm_share, etc.). This should be -# done first, so that in case of name collisions, the CLM versions take -# precedence (when there are two files with the same name, the one added later -# wins). -add_subdirectory(${CIMEROOT}/src/share/util csm_share) -add_subdirectory(${CIMEROOT}/src/share/unit_test_stubs/util csm_share_stubs) -add_subdirectory(${CIMEROOT}/src/share/esmf_wrf_timemgr esmf_wrf_timemgr) -add_subdirectory(${CIMEROOT}/src/drivers/mct/shr drv_share) - -# Extract just the files we need from drv_share -set (drv_sources_needed_base - glc_elevclass_mod.F90 - ) -extract_sources("${drv_sources_needed_base}" "${drv_sources}" drv_sources_needed) - -# Add CLM source directories (these add their own test directories) -add_subdirectory(${CLM_ROOT}/src/utils clm_utils) -add_subdirectory(${CLM_ROOT}/src/biogeochem clm_biogeochem) -add_subdirectory(${CLM_ROOT}/src/soilbiogeochem clm_soilbiogeochem) -add_subdirectory(${CLM_ROOT}/src/biogeophys clm_biogeophys) -add_subdirectory(${CLM_ROOT}/src/dyn_subgrid clm_dyn_subgrid) -add_subdirectory(${CLM_ROOT}/src/main clm_main) -add_subdirectory(${CLM_ROOT}/src/init_interp clm_init_interp) -add_subdirectory(${CLM_ROOT}/src/fates/main fates_main) - -# Add general unit test directories (stubbed out files, etc.) -add_subdirectory(unit_test_stubs) -add_subdirectory(unit_test_shr) - -# Remove shr_mpi_mod from share_sources. -# This is needed because we want to use the mock shr_mpi_mod in place of the real one -# -# TODO: this should be moved into a general-purpose function in Sourcelist_utils. -# Then this block of code could be replaced with a single call, like: -# remove_source_file(${share_sources} "shr_mpi_mod.F90") -foreach (sourcefile ${share_sources}) - string(REGEX MATCH "shr_mpi_mod.F90" match_found ${sourcefile}) - if(match_found) - list(REMOVE_ITEM share_sources ${sourcefile}) - endif() -endforeach() - -# Remove shr_cal_mod from share_sources. -# -# shr_cal_mod depends on ESMF (or the lightweight esmf wrf timemgr, at -# least). Since CTSM doesn't currently use shr_cal_mod, we're avoiding -# the extra overhead of including esmf_wrf_timemgr sources in this -# build. -# -# TODO: like above, this should be moved into a general-purpose function -# in Sourcelist_utils. Then this block of code could be replaced with a -# single call, like: remove_source_file(${share_sources} -# "shr_cal_mod.F90") -foreach (sourcefile ${share_sources}) - string(REGEX MATCH "shr_cal_mod.F90" match_found ${sourcefile}) - if(match_found) - list(REMOVE_ITEM share_sources ${sourcefile}) - endif() -endforeach() - -# Build libraries containing stuff needed for the unit tests. -# Eventually, these add_library calls should probably be distributed into the correct location, rather than being in this top-level CMakeLists.txt file. -add_library(csm_share ${share_sources} ${drv_sources_needed}) -declare_generated_dependencies(csm_share "${share_genf90_sources}") -add_library(esmf_wrf_timemgr ${esmf_wrf_timemgr_sources}) -add_library(clm ${clm_sources}) -declare_generated_dependencies(clm "${clm_genf90_sources}") -add_dependencies(esmf_wrf_timemgr csm_share) -add_dependencies(clm csm_share esmf_wrf_timemgr) - -# We need to look for header files here, in order to pick up shr_assert.h -include_directories(${CIMEROOT}/src/share/include) - -# And we need to look for header files here, for some include files needed by -# the esmf_wrf_timemgr code -include_directories(${CIMEROOT}/src/share/esmf_wrf_timemgr) - -# Tell cmake to look for libraries & mod files here, because this is where we built libraries -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -link_directories(${CMAKE_CURRENT_BINARY_DIR}) - -# Add the test directories -# Note: it's possible that these could be added by each source directory that -# has tests in it. However, it appears that the order needs to be done -# carefully: for example, include_directories and link_directories needs to be -# done before adding the tests themselves. -add_subdirectory(${CLM_ROOT}/src/unit_test_shr/test clm_unit_test_shr_test) -add_subdirectory(${CLM_ROOT}/src/utils/test clm_utils_test) -add_subdirectory(${CLM_ROOT}/src/biogeophys/test clm_biogeophys_test) -add_subdirectory(${CLM_ROOT}/src/biogeochem/test clm_biogeochem_test) -add_subdirectory(${CLM_ROOT}/src/soilbiogeochem/test clm_soilbiogeochem_test) -add_subdirectory(${CLM_ROOT}/src/dyn_subgrid/test clm_dyn_subgrid_test) -add_subdirectory(${CLM_ROOT}/src/main/test clm_main_test) -add_subdirectory(${CLM_ROOT}/src/init_interp/test clm_init_interp_test) diff --git a/src/README.unit_testing b/src/README.unit_testing deleted file mode 100644 index de503ca8d3..0000000000 --- a/src/README.unit_testing +++ /dev/null @@ -1,13 +0,0 @@ -# To run all CTSM unit tests on caldera, run the following command: -# -# The creation of a temporary directory ensures that you are doing a completely -# clean build of the unit tests. (The use of the --clean flag to run_tests.py -# cleans most, but not all of the files created by the unit test build.) For -# rerunning the tests after an incremental change, you can instead use an -# existing build directory. - -# From a standalone CTSM checkout: -../cime/scripts/fortran_unit_testing/run_tests.py --build-dir `mktemp -d --tmpdir=. unit_tests.XXXXXXXX` - -# If you are within a full CESM checkout, you would instead do: -# ../../../cime/scripts/fortran_unit_testing/run_tests.py --build-dir `mktemp -d --tmpdir=. unit_tests.XXXXXXXX` diff --git a/src/biogeochem/CMakeLists.txt b/src/biogeochem/CMakeLists.txt deleted file mode 100644 index 0a7ef162f4..0000000000 --- a/src/biogeochem/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -list(APPEND clm_sources - CNSharedParamsMod.F90 - CNSpeciesMod.F90 - CNVegComputeSeedMod.F90 - SpeciesBaseType.F90 - SpeciesIsotopeType.F90 - SpeciesNonIsotopeType.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/biogeochem/CNAnnualUpdateMod.F90 b/src/biogeochem/CNAnnualUpdateMod.F90 deleted file mode 100644 index 508b7cf08e..0000000000 --- a/src/biogeochem/CNAnnualUpdateMod.F90 +++ /dev/null @@ -1,113 +0,0 @@ -module CNAnnualUpdateMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for updating annual summation variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNvegStateType , only : cnveg_state_type - use PatchType , only : patch - use filterColMod , only : filter_col_type, col_filter_from_filter_and_logical_array - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: CNAnnualUpdate - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNAnnualUpdate(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update annual summation variables - ! - ! !USES: - use clm_time_manager, only: get_step_size, get_days_per_year - use clm_varcon , only: secspday - use SubgridAveMod , only: p2c - ! - ! !ARGUMENTS: - 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(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: secspyear - real(r8):: dt ! radiation time step (seconds) - logical :: end_of_year(bounds%begc:bounds%endc) ! whether each column has reached the end of the year, according to its own annsum_counter - type(filter_col_type) :: filter_endofyear_c - !----------------------------------------------------------------------- - - dt = real( get_step_size(), r8 ) - secspyear = get_days_per_year() * secspday - - do fc = 1,num_soilc - c = filter_soilc(fc) - cnveg_state_inst%annsum_counter_col(c) = cnveg_state_inst%annsum_counter_col(c) + dt - if (cnveg_state_inst%annsum_counter_col(c) >= secspyear) then - end_of_year(c) = .true. - cnveg_state_inst%annsum_counter_col(c) = 0._r8 - else - end_of_year(c) = .false. - end if - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - if (end_of_year(c)) then - - ! update annual plant ndemand accumulator - cnveg_state_inst%annsum_potential_gpp_patch(p) = cnveg_state_inst%tempsum_potential_gpp_patch(p) - cnveg_state_inst%tempsum_potential_gpp_patch(p) = 0._r8 - - ! update annual total N retranslocation accumulator - cnveg_state_inst%annmax_retransn_patch(p) = cnveg_state_inst%tempmax_retransn_patch(p) - cnveg_state_inst%tempmax_retransn_patch(p) = 0._r8 - - ! update annual average 2m air temperature accumulator - cnveg_state_inst%annavg_t2m_patch(p) = cnveg_state_inst%tempavg_t2m_patch(p) - cnveg_state_inst%tempavg_t2m_patch(p) = 0._r8 - - ! update annual NPP accumulator, convert to annual total - cnveg_carbonflux_inst%annsum_npp_patch(p) = cnveg_carbonflux_inst%tempsum_npp_patch(p) * dt - cnveg_carbonflux_inst%tempsum_npp_patch(p) = 0._r8 - - ! update annual litfall accumulator, convert to annual total - cnveg_carbonflux_inst%annsum_litfall_patch(p) = cnveg_carbonflux_inst%tempsum_litfall_patch(p) * dt - cnveg_carbonflux_inst%tempsum_litfall_patch(p) = 0._r8 - - end if - end do - - ! Get column-level averages, just for the columns that have reached their personal end-of-year - filter_endofyear_c = col_filter_from_filter_and_logical_array( & - bounds = bounds, & - num_orig = num_soilc, & - filter_orig = filter_soilc, & - logical_col = end_of_year(bounds%begc:bounds%endc)) - - call p2c(bounds, filter_endofyear_c%num, filter_endofyear_c%indices, & - cnveg_carbonflux_inst%annsum_npp_patch(bounds%begp:bounds%endp), & - cnveg_carbonflux_inst%annsum_npp_col(bounds%begc:bounds%endc)) - - call p2c(bounds, filter_endofyear_c%num, filter_endofyear_c%indices, & - cnveg_state_inst%annavg_t2m_patch(bounds%begp:bounds%endp), & - cnveg_state_inst%annavg_t2m_col(bounds%begc:bounds%endc)) - - end subroutine CNAnnualUpdate - -end module CNAnnualUpdateMod diff --git a/src/biogeochem/CNBalanceCheckMod.F90 b/src/biogeochem/CNBalanceCheckMod.F90 deleted file mode 100644 index f2811d290a..0000000000 --- a/src/biogeochem/CNBalanceCheckMod.F90 +++ /dev/null @@ -1,358 +0,0 @@ -module CNBalanceCheckMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for carbon/nitrogen mass balance checking. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog, use_nitrif_denitrif - use clm_time_manager , only : get_step_size - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use SoilBiogeochemNitrogenfluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemCarbonfluxType , only : soilbiogeochem_carbonflux_type - use ColumnType , only : col - use GridcellType , only : grc - use CNSharedParamsMod , only : use_fun - - ! - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: cn_balance_type - private - real(r8), pointer :: begcb_col(:) ! (gC/m2) carbon mass, beginning of time step - real(r8), pointer :: endcb_col(:) ! (gC/m2) carbon mass, end of time step - real(r8), pointer :: begnb_col(:) ! (gN/m2) nitrogen mass, beginning of time step - real(r8), pointer :: endnb_col(:) ! (gN/m2) nitrogen mass, end of time step - contains - procedure , public :: Init - procedure , public :: BeginCNBalance - procedure , public :: CBalanceCheck - procedure , public :: NBalanceCheck - procedure , private :: InitAllocate - end type cn_balance_type - ! - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - class(cn_balance_type) :: this - type(bounds_type) , intent(in) :: bounds - - call this%InitAllocate(bounds) - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - class(cn_balance_type) :: this - type(bounds_type) , intent(in) :: bounds - - integer :: begc, endc - - begc = bounds%begc; endc= bounds%endc - - allocate(this%begcb_col(begc:endc)) ; this%begcb_col(:) = nan - allocate(this%endcb_col(begc:endc)) ; this%endcb_col(:) = nan - allocate(this%begnb_col(begc:endc)) ; this%begnb_col(:) = nan - allocate(this%endnb_col(begc:endc)) ; this%endnb_col(:) = nan - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine BeginCNBalance(this, bounds, num_soilc, filter_soilc, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Calculate beginning column-level carbon/nitrogen balance, for mass conservation check - ! - ! Should be called after the CN state summaries have been computed for this time step - ! (which should be after the dynamic landunit area updates and the associated filter - ! updates - i.e., using the new version of the filters) - ! - ! !ARGUMENTS: - class(cn_balance_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c - !----------------------------------------------------------------------- - - associate( & - col_begcb => this%begcb_col , & ! Output: [real(r8) (:)] (gC/m2) carbon mass, beginning of time step - col_begnb => this%begnb_col , & ! Output: [real(r8) (:)] (gN/m2) nitrogen mass, beginning of time step - totcolc => cnveg_carbonstate_inst%totc_col , & ! Input: [real(r8) (:)] (gC/m2) total column carbon, incl veg and cpool - totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:)] (gN/m2) total column nitrogen, incl veg - ) - - do fc = 1,num_soilc - c = filter_soilc(fc) - col_begcb(c) = totcolc(c) - col_begnb(c) = totcoln(c) - end do - - end associate - - end subroutine BeginCNBalance - - !----------------------------------------------------------------------- - subroutine CBalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_carbonflux_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Perform carbon mass conservation check for column and patch - ! - ! !ARGUMENTS: - class(cn_balance_type) , intent(inout) :: 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 - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,err_index ! indices - integer :: fc ! lake filter indices - logical :: err_found ! error flag - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: col_cinputs - real(r8) :: col_coutputs - real(r8) :: col_errcb(bounds%begc:bounds%endc) - !----------------------------------------------------------------------- - - associate( & - col_begcb => this%begcb_col , & ! Input: [real(r8) (:) ] (gC/m2) carbon mass, beginning of time step - col_endcb => this%endcb_col , & ! Output: [real(r8) (:) ] (gC/m2) carbon mass, end of time step - wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) wood harvest (to product pools) - grainc_to_cropprodc => cnveg_carbonflux_inst%grainc_to_cropprodc_col , & ! Input: [real(r8) (:) ] (gC/m2/s) grain C to 1-year crop product pool - gpp => cnveg_carbonflux_inst%gpp_col , & ! Input: [real(r8) (:) ] (gC/m2/s) gross primary production - er => cnveg_carbonflux_inst%er_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - col_fire_closs => cnveg_carbonflux_inst%fire_closs_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total column-level fire C loss - col_hrv_xsmrpool_to_atm => cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_col , & ! Input: [real(r8) (:) ] (gC/m2/s) excess MR pool harvest mortality - - som_c_leached => soilbiogeochem_carbonflux_inst%som_c_leached_col , & ! Input: [real(r8) (:) ] (gC/m2/s) total SOM C loss from vertical transport - - totcolc => cnveg_carbonstate_inst%totc_col & ! Input: [real(r8) (:) ] (gC/m2) total column carbon, incl veg and cpool - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - err_found = .false. - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate the total column-level carbon storage, for mass conservation check - col_endcb(c) = totcolc(c) - - ! calculate total column-level inputs - col_cinputs = gpp(c) - - ! calculate total column-level outputs - ! er = ar + hr, col_fire_closs includes patch-level fire losses - col_coutputs = er(c) + col_fire_closs(c) + col_hrv_xsmrpool_to_atm(c) - - ! Fluxes to product pools are included in column-level outputs: the product - ! pools are not included in totcolc, so are outside the system with respect to - ! these balance checks. (However, the dwt flux to product pools is NOT included, - ! since col_begcb is initialized after the dynamic area adjustments - i.e., - ! after the dwt term has already been taken out.) - col_coutputs = col_coutputs + & - wood_harvestc(c) + & - grainc_to_cropprodc(c) - - ! subtract leaching flux - col_coutputs = col_coutputs - som_c_leached(c) - - ! calculate the total column-level carbon balance error for this time step - col_errcb(c) = (col_cinputs - col_coutputs)*dt - & - (col_endcb(c) - col_begcb(c)) - - ! check for significant errors - if (abs(col_errcb(c)) > 1e-7_r8) then - err_found = .true. - err_index = c - end if - if (abs(col_errcb(c)) > 1e-8_r8) then - write(iulog,*) 'cbalance warning',c,col_errcb(c),col_endcb(c) - end if - - - - end do ! end of columns loop - - if (err_found) then - c = err_index - write(iulog,*)'column cbalance error = ', col_errcb(c), c - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(col%gridcell(c)),grc%londeg(col%gridcell(c)) - write(iulog,*)'begcb = ',col_begcb(c) - write(iulog,*)'endcb = ',col_endcb(c) - write(iulog,*)'delta store = ',col_endcb(c)-col_begcb(c) - write(iulog,*)'--- Inputs ---' - write(iulog,*)'gpp = ',gpp(c)*dt - write(iulog,*)'--- Outputs ---' - write(iulog,*)'er = ',er(c)*dt - write(iulog,*)'col_fire_closs = ',col_fire_closs(c)*dt - write(iulog,*)'col_hrv_xsmrpool_to_atm = ',col_hrv_xsmrpool_to_atm(c)*dt - write(iulog,*)'wood_harvestc = ',wood_harvestc(c)*dt - write(iulog,*)'grainc_to_cropprodc = ',grainc_to_cropprodc(c)*dt - write(iulog,*)'-1*som_c_leached = ',som_c_leached(c)*dt - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end associate - - end subroutine CBalanceCheck - - !----------------------------------------------------------------------- - subroutine NBalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_nitrogenflux_inst, cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Perform nitrogen mass conservation check - ! - ! !USES: - use clm_varctl, only : use_crop - ! - ! !ARGUMENTS: - class(cn_balance_type) , intent(inout) :: 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 - type(soilbiogeochem_nitrogenflux_type) , intent(in) :: soilbiogeochem_nitrogenflux_inst - type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,err_index,j ! indices - integer :: fc ! lake filter indices - logical :: err_found ! error flag - real(r8):: dt ! radiation time step (seconds) - real(r8):: col_ninputs(bounds%begc:bounds%endc) - real(r8):: col_noutputs(bounds%begc:bounds%endc) - real(r8):: col_errnb(bounds%begc:bounds%endc) - !----------------------------------------------------------------------- - - associate( & - col_begnb => this%begnb_col , & ! Input: [real(r8) (:) ] (gN/m2) nitrogen mass, beginning of time step - col_endnb => this%endnb_col , & ! Output: [real(r8) (:) ] (gN/m2) nitrogen mass, end of time step - ndep_to_sminn => soilbiogeochem_nitrogenflux_inst%ndep_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) atmospheric N deposition to soil mineral N - nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) symbiotic/asymbiotic N fixation to soil mineral N - ffix_to_sminn => soilbiogeochem_nitrogenflux_inst%ffix_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) free living N fixation to soil mineral N - fert_to_sminn => soilbiogeochem_nitrogenflux_inst%fert_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) - soyfixn_to_sminn => soilbiogeochem_nitrogenflux_inst%soyfixn_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) - supplement_to_sminn => soilbiogeochem_nitrogenflux_inst%supplement_to_sminn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) supplemental N supply - denit => soilbiogeochem_nitrogenflux_inst%denit_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total rate of denitrification - sminn_leached => soilbiogeochem_nitrogenflux_inst%sminn_leached_col , & ! Input: [real(r8) (:) ] (gN/m2/s) soil mineral N pool loss to leaching - smin_no3_leached => soilbiogeochem_nitrogenflux_inst%smin_no3_leached_col , & ! Input: [real(r8) (:) ] (gN/m2/s) soil mineral NO3 pool loss to leaching - smin_no3_runoff => soilbiogeochem_nitrogenflux_inst%smin_no3_runoff_col , & ! Input: [real(r8) (:) ] (gN/m2/s) soil mineral NO3 pool loss to runoff - f_n2o_nit => soilbiogeochem_nitrogenflux_inst%f_n2o_nit_col , & ! Input: [real(r8) (:) ] (gN/m2/s) flux of N2o from nitrification - som_n_leached => soilbiogeochem_nitrogenflux_inst%som_n_leached_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total SOM N loss from vertical transport - - col_fire_nloss => cnveg_nitrogenflux_inst%fire_nloss_col , & ! Input: [real(r8) (:) ] (gN/m2/s) total column-level fire N loss - wood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) wood harvest (to product pools) - grainn_to_cropprodn => cnveg_nitrogenflux_inst%grainn_to_cropprodn_col , & ! Input: [real(r8) (:) ] (gN/m2/s) grain N to 1-year crop product pool - - totcoln => cnveg_nitrogenstate_inst%totn_col & ! Input: [real(r8) (:) ] (gN/m2) total column nitrogen, incl veg - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - err_found = .false. - do fc = 1,num_soilc - c=filter_soilc(fc) - - ! calculate the total column-level nitrogen storage, for mass conservation check - col_endnb(c) = totcoln(c) - - ! calculate total column-level inputs - col_ninputs(c) = ndep_to_sminn(c) + nfix_to_sminn(c) + supplement_to_sminn(c) - - if(use_fun)then - col_ninputs(c) = col_ninputs(c) + ffix_to_sminn(c) ! for FUN, free living fixation is a seprate flux. RF. - endif - - if (use_crop) then - col_ninputs(c) = col_ninputs(c) + fert_to_sminn(c) + soyfixn_to_sminn(c) - end if - - ! calculate total column-level outputs - col_noutputs(c) = denit(c) + col_fire_nloss(c) - - ! Fluxes to product pools are included in column-level outputs: the product - ! pools are not included in totcoln, so are outside the system with respect to - ! these balance checks. (However, the dwt flux to product pools is NOT included, - ! since col_begnb is initialized after the dynamic area adjustments - i.e., - ! after the dwt term has already been taken out.) - col_noutputs(c) = col_noutputs(c) + & - wood_harvestn(c) + & - grainn_to_cropprodn(c) - - if (.not. use_nitrif_denitrif) then - col_noutputs(c) = col_noutputs(c) + sminn_leached(c) - else - col_noutputs(c) = col_noutputs(c) + f_n2o_nit(c) - - col_noutputs(c) = col_noutputs(c) + smin_no3_leached(c) + smin_no3_runoff(c) - end if - - col_noutputs(c) = col_noutputs(c) - som_n_leached(c) - - ! calculate the total column-level nitrogen balance error for this time step - col_errnb(c) = (col_ninputs(c) - col_noutputs(c))*dt - & - (col_endnb(c) - col_begnb(c)) - - if (abs(col_errnb(c)) > 1e-3_r8) then - err_found = .true. - err_index = c - end if - - if (abs(col_errnb(c)) > 1e-7_r8) then - write(iulog,*) 'nbalance warning',c,col_errnb(c),col_endnb(c) - write(iulog,*)'inputs,ffix,nfix,ndep = ',ffix_to_sminn(c)*dt,nfix_to_sminn(c)*dt,ndep_to_sminn(c)*dt - write(iulog,*)'outputs,lch,roff,dnit = ',smin_no3_leached(c)*dt, smin_no3_runoff(c)*dt,f_n2o_nit(c)*dt - end if - - end do ! end of columns loop - - if (err_found) then - c = err_index - write(iulog,*)'column nbalance error = ',col_errnb(c), c - write(iulog,*)'Latdeg,Londeg = ',grc%latdeg(col%gridcell(c)),grc%londeg(col%gridcell(c)) - write(iulog,*)'begnb = ',col_begnb(c) - write(iulog,*)'endnb = ',col_endnb(c) - write(iulog,*)'delta store = ',col_endnb(c)-col_begnb(c) - write(iulog,*)'input mass = ',col_ninputs(c)*dt - write(iulog,*)'output mass = ',col_noutputs(c)*dt - write(iulog,*)'net flux = ',(col_ninputs(c)-col_noutputs(c))*dt - write(iulog,*)'inputs,ffix,nfix,ndep = ',ffix_to_sminn(c)*dt,nfix_to_sminn(c)*dt,ndep_to_sminn(c)*dt - write(iulog,*)'outputs,ffix,nfix,ndep = ',smin_no3_leached(c)*dt, smin_no3_runoff(c)*dt,f_n2o_nit(c)*dt - - - - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end associate - - end subroutine NBalanceCheck - -end module CNBalanceCheckMod diff --git a/src/biogeochem/CNC14DecayMod.F90 b/src/biogeochem/CNC14DecayMod.F90 deleted file mode 100644 index 4c05995385..0000000000 --- a/src/biogeochem/CNC14DecayMod.F90 +++ /dev/null @@ -1,159 +0,0 @@ -module CNC14DecayMod - - !----------------------------------------------------------------------- - ! Module for 14-carbon flux variable update, non-mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size, get_days_per_year - use clm_varpar , only : ndecomp_cascade_transitions, nlevdecomp, ndecomp_pools - use clm_varcon , only : secspday - use clm_varctl , only : spinup_state - use decompMod , only : bounds_type - use pftconMod , only : npcropmin - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use PatchType , only : patch - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: C14Decay - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine C14Decay( bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - c14_cnveg_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, calculate the radioactive decay of C14 - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns 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(CNVeg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,j,g,l,p,fc,c,i - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: half_life - real(r8) :: decay_const - real(r8) :: days_per_year ! days per year - real(r8) :: spinup_term ! spinup accelerated decomposition factor, used to accelerate transport as well - !----------------------------------------------------------------------- - - associate( & - spinup_factor => decomp_cascade_con%spinup_factor , & ! Input: [real(r8) (:) ] factor for AD spinup associated with each pool - - decomp_cpools_vr => c14_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col , & ! Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - cropseedc_deficit => c14_cnveg_carbonstate_inst%cropseedc_deficit_patch , & ! Output: [real(r8) (:) ] - seedc => c14_cnveg_carbonstate_inst%seedc_grc , & ! Output: [real(r8) (:) ] - cpool => c14_cnveg_carbonstate_inst%cpool_patch , & ! Output: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool - xsmrpool => c14_cnveg_carbonstate_inst%xsmrpool_patch , & ! Output: [real(r8) (:) ] (gC/m2) execss maint resp C pool - deadcrootc => c14_cnveg_carbonstate_inst%deadcrootc_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C - deadcrootc_storage => c14_cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C storage - deadcrootc_xfer => c14_cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - deadstemc => c14_cnveg_carbonstate_inst%deadstemc_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C - deadstemc_storage => c14_cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C storage - deadstemc_xfer => c14_cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - frootc => c14_cnveg_carbonstate_inst%frootc_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C - frootc_storage => c14_cnveg_carbonstate_inst%frootc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C storage - frootc_xfer => c14_cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer - gresp_storage => c14_cnveg_carbonstate_inst%gresp_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) growth respiration storage - gresp_xfer => c14_cnveg_carbonstate_inst%gresp_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) growth respiration transfer - leafc => c14_cnveg_carbonstate_inst%leafc_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C - leafc_storage => c14_cnveg_carbonstate_inst%leafc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C storage - leafc_xfer => c14_cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - livecrootc => c14_cnveg_carbonstate_inst%livecrootc_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C - livecrootc_storage => c14_cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C storage - livecrootc_xfer => c14_cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - livestemc => c14_cnveg_carbonstate_inst%livestemc_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C - livestemc_storage => c14_cnveg_carbonstate_inst%livestemc_storage_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C storage - livestemc_xfer => c14_cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer - pft_ctrunc => c14_cnveg_carbonstate_inst%ctrunc_patch & ! Output: [real(r8) (:) ] (gC/m2) patch-level sink for C truncation - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - days_per_year = get_days_per_year() - - half_life = 5730._r8 * secspday * days_per_year - decay_const = - log(0.5_r8) / half_life - - do g = bounds%begg, bounds%endg - seedc(g) = seedc(g) * (1._r8 - decay_const * dt) - end do - - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if ( spinup_state >= 1) then - ! speed up radioactive decay by the same factor as decomposition so tat SOM ages prematurely in all respects - spinup_term = spinup_factor(l) - if ( abs(spinup_factor(l) - 1._r8) .gt. .000001_r8 ) then - spinup_term = spinup_term * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - endif - else - spinup_term = 1. - endif - decomp_cpools_vr(c,j,l) = decomp_cpools_vr(c,j,l) * (1._r8 - decay_const * spinup_term * dt) - end do - end do - end do ! end of columns loop - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - cpool(p) = cpool(p) * (1._r8 - decay_const * dt) - xsmrpool(p) = xsmrpool(p) * (1._r8 - decay_const * dt) - deadcrootc(p) = deadcrootc(p) * (1._r8 - decay_const * dt) - deadcrootc_storage(p) = deadcrootc_storage(p) * (1._r8 - decay_const * dt) - deadcrootc_xfer(p) = deadcrootc_xfer(p) * (1._r8 - decay_const * dt) - deadstemc(p) = deadstemc(p) * (1._r8 - decay_const * dt) - deadstemc_storage(p) = deadstemc_storage(p) * (1._r8 - decay_const * dt) - deadstemc_xfer(p) = deadstemc_xfer(p) * (1._r8 - decay_const * dt) - frootc(p) = frootc(p) * (1._r8 - decay_const * dt) - frootc_storage(p) = frootc_storage(p) * (1._r8 - decay_const * dt) - frootc_xfer(p) = frootc_xfer(p) * (1._r8 - decay_const * dt) - gresp_storage(p) = gresp_storage(p) * (1._r8 - decay_const * dt) - gresp_xfer(p) = gresp_xfer(p) * (1._r8 - decay_const * dt) - leafc(p) = leafc(p) * (1._r8 - decay_const * dt) - leafc_storage(p) = leafc_storage(p) * (1._r8 - decay_const * dt) - leafc_xfer(p) = leafc_xfer(p) * (1._r8 - decay_const * dt) - livecrootc(p) = livecrootc(p) * (1._r8 - decay_const * dt) - livecrootc_storage(p) = livecrootc_storage(p) * (1._r8 - decay_const * dt) - livecrootc_xfer(p) = livecrootc_xfer(p) * (1._r8 - decay_const * dt) - livestemc(p) = livestemc(p) * (1._r8 - decay_const * dt) - livestemc_storage(p) = livestemc_storage(p) * (1._r8 - decay_const * dt) - livestemc_xfer(p) = livestemc_xfer(p) * (1._r8 - decay_const * dt) - pft_ctrunc(p) = pft_ctrunc(p) * (1._r8 - decay_const * dt) - - ! NOTE(wjs, 2017-02-02) This isn't a completely robust way to check if this is a - ! prognostic crop patch (at the very least it should also check if <= npcropmax; - ! ideally it should use a prognostic_crop flag that doesn't seem to exist - ! currently). But I'm just being consistent with what's done elsewhere (e.g., in - ! CStateUpdate1). - if (patch%itype(p) >= npcropmin) then ! skip 2 generic crops - cropseedc_deficit(p) = cropseedc_deficit(p) * (1._r8 - decay_const * dt) - end if - end do - - end associate - - end subroutine C14Decay - -end module CNC14DecayMod diff --git a/src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90 b/src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90 deleted file mode 100644 index 5e15c98d3b..0000000000 --- a/src/biogeochem/CNCIsoAtmTimeSeriesReadMod.F90 +++ /dev/null @@ -1,319 +0,0 @@ -module CIsoAtmTimeseriesMod - - !----------------------------------------------------------------------- - ! Module for transient atmospheric boundary to the c13 and c14 codes - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_time_manager , only : get_curr_date,get_days_per_year, get_curr_yearfrac - use clm_varcon , only : c14ratio, secspday - use shr_const_mod , only : SHR_CONST_PDB ! Ratio of C13/C12 - use clm_varctl , only : iulog - use abortutils , only : endrun - use spmdMod , only : masterproc - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: C14BombSpike ! Time series for C14 data - public:: C14_init_BombSpike ! Initialize C14 data series and read data in - public:: C13Timeseries ! Time series for C13 data - public:: C13_init_Timeseries ! Initialize C13 data series and read data in - - ! !PUBLIC TYPES: - logical , public :: use_c14_bombspike = .false. ! do we use time-varying atmospheric C14? - character(len=256) , public :: atm_c14_filename = ' ' ! file name of C14 input data - logical , public :: use_c13_timeseries = .false. ! do we use time-varying atmospheric C13? - character(len=256) , public :: atm_c13_filename = ' ' ! file name of C13 input data - integer, parameter , public :: nsectors_c14 = 3 ! Number of latitude sectors the C14 data has - - ! - ! !PRIVATE MEMBER FUNCTIONS: - private:: check_units ! Check the units of the data on the input file - - ! !PRIVATE TYPES: - real(r8), allocatable, private :: atm_c14file_time(:) ! time for C14 data - real(r8), allocatable, private :: atm_delta_c14(:,:) ! Delta C14 data - real(r8), allocatable, private :: atm_c13file_time(:) ! time for C13 data - real(r8), allocatable, private :: atm_delta_c13(:) ! Delta C13 data - real(r8), parameter :: time_axis_offset = 1850.0_r8 ! Offset in years of time on file - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine C14BombSpike( rc14_atm ) - ! - ! !DESCRIPTION: - ! for transient simulation, read in an atmospheric timeseries file to impose bomb spike - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(out) :: rc14_atm(nsectors_c14) ! Ratio of C14 to C12 - ! - ! !LOCAL VARIABLES: - integer :: yr, mon, day, tod ! year, month, day, time-of-day - real(r8) :: dateyear ! Date converted to year - real(r8) :: delc14o2_atm(nsectors_c14) ! C14 delta units - integer :: fp, p, nt ! Indices - integer :: ind_below ! Time index below current time - integer :: ntim_atm_ts ! Number of times on file - real(r8) :: twt_1, twt_2 ! weighting fractions for interpolating - integer :: l ! Loop index of sectors - !----------------------------------------------------------------------- - - ! get current date - call get_curr_date(yr, mon, day, tod) - dateyear = real(yr) + get_curr_yearfrac() - - ! find points in atm timeseries to interpolate between - ntim_atm_ts = size(atm_c14file_time) - ind_below = 0 - do nt = 1, ntim_atm_ts - if ((dateyear - time_axis_offset) >= atm_c14file_time(nt) ) then - ind_below = ind_below+1 - endif - end do - - ! loop over lat bands to pass all three to photosynthesis - do l = 1,nsectors_c14 - ! interpolate between nearest two points in atm c14 timeseries - if (ind_below .eq. 0 ) then - delc14o2_atm(l) = atm_delta_c14(l,1) - elseif (ind_below .eq. ntim_atm_ts ) then - delc14o2_atm(l) = atm_delta_c14(l,ntim_atm_ts) - else - twt_2 = min(1._r8, max(0._r8,((dateyear - time_axis_offset)-atm_c14file_time(ind_below)) & - / (atm_c14file_time(ind_below+1)-atm_c14file_time(ind_below)))) - twt_1 = 1._r8 - twt_2 - delc14o2_atm(l) = atm_delta_c14(l,ind_below) * twt_1 + atm_delta_c14(l,ind_below+1) * twt_2 - endif - - ! change delta units to ratio - rc14_atm(l) = (delc14o2_atm(l) * 1.e-3_r8 + 1._r8) * c14ratio - end do - - end subroutine C14BombSpike - - !----------------------------------------------------------------------- - subroutine C14_init_BombSpike() - ! - ! !DESCRIPTION: - ! read netcdf file containing a timeseries of atmospheric delta C14 values; save in module-level array - ! - ! !USES: - use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, file_desc_t, ncd_inqdlen, ncd_io - use fileutils , only : getfil - ! - ! !LOCAL VARIABLES: - implicit none - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nsec ! number of input data sectors - integer :: t ! time index - logical :: readvar ! if variable read or not - character(len=*), parameter :: vname = 'Delta14co2_in_air' ! Variable name on file - !----------------------------------------------------------------------- - - if ( masterproc ) then - write(iulog, *) 'C14_init_BombSpike: preparing to open file:' - write(iulog, *) trim(locfn) - endif - - call getfil(atm_c14_filename, locfn, 0) - - call ncd_pio_openfile (ncid, trim(locfn), 0) - - call ncd_inqdlen(ncid,dimid,ntim,'time') - call ncd_inqdlen(ncid,dimid,nsec,'sector') - if ( nsec /= nsectors_c14 )then - call endrun(msg="ERROR: number of sectors on file not what's expected"//errMsg(sourcefile, __LINE__)) - end if - - !! allocate arrays based on size of netcdf timeseries - allocate(atm_c14file_time(ntim)) - allocate(atm_delta_c14(nsectors_c14,ntim)) - atm_delta_c14(:,:) = 0.0_r8 - - call ncd_io(ncid=ncid, varname='time', flag='read', data=atm_c14file_time, & - readvar=readvar) - if ( .not. readvar ) then - call endrun(msg="ERROR: time not on file"//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname=vname, flag='read', data=atm_delta_c14, & - readvar=readvar) - if ( .not. readvar ) then - call endrun(msg="ERROR: '//vname//' not on file"//errMsg(sourcefile, __LINE__)) - end if - ! Check units - call check_units( ncid, vname, "Modern" ) - call ncd_pio_closefile(ncid) - - ! check to make sure that time dimension is well behaved - do t = 2, ntim - if ( atm_c14file_time(t) - atm_c14file_time(t-1) <= 0._r8 ) then - write(iulog, *) 'C14_init_BombSpike: error. time axis must be monotonically increasing' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end do - - end subroutine C14_init_BombSpike - - - !----------------------------------------------------------------------- - subroutine C13TimeSeries( rc13_atm ) - ! - ! !DESCRIPTION: - ! for transient pulse simulation, impose a time-varying atm boundary condition - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(out) :: rc13_atm ! Ratio of C13 to C12 - ! - ! !LOCAL VARIABLES: - integer :: yr, mon, day, tod ! year, month, day, time-of-day - real(r8) :: dateyear ! date translated to year - real(r8) :: delc13o2_atm ! Delta C13 - integer :: fp, p, nt ! Indices - integer :: ind_below ! Index of time in file before current time - integer :: ntim_atm_ts ! Number of times on file - real(r8) :: twt_1, twt_2 ! weighting fractions for interpolating - !----------------------------------------------------------------------- - - ! get current date - call get_curr_date(yr, mon, day, tod) - dateyear = real(yr) + get_curr_yearfrac() - - ! find points in atm timeseries to interpolate between - ntim_atm_ts = size(atm_c13file_time) - ind_below = 0 - do nt = 1, ntim_atm_ts - if ((dateyear - time_axis_offset) >= atm_c13file_time(nt) ) then - ind_below = ind_below+1 - endif - end do - - ! interpolate between nearest two points in atm c13 timeseries - ! cdknotes. for now and for simplicity, just use the northern hemisphere values (sector 1) - if (ind_below .eq. 0 ) then - delc13o2_atm = atm_delta_c13(1) - elseif (ind_below .eq. ntim_atm_ts ) then - delc13o2_atm = atm_delta_c13(ntim_atm_ts) - else - twt_2 = min(1._r8, max(0._r8,((dateyear - time_axis_offset)-atm_c13file_time(ind_below)) & - / (atm_c13file_time(ind_below+1)-atm_c13file_time(ind_below)))) - twt_1 = 1._r8 - twt_2 - delc13o2_atm = atm_delta_c13(ind_below) * twt_1 + atm_delta_c13(ind_below+1) * twt_2 - endif - - ! change delta units to ratio, put on patch loop - - rc13_atm = (delc13o2_atm * 1.e-3_r8 + 1._r8) * SHR_CONST_PDB - - end subroutine C13TimeSeries - - !----------------------------------------------------------------------- - subroutine C13_init_TimeSeries() - ! - ! !DESCRIPTION: - ! read netcdf file containing a timeseries of atmospheric delta C13 values; save in module-level array - ! - ! !USES: - use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, file_desc_t, ncd_inqdlen, ncd_io - use fileutils , only : getfil - ! - ! !LOCAL VARIABLES: - implicit none - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: t ! Time index - logical :: readvar ! if variable read or not - character(len=*), parameter :: vname = 'delta13co2_in_air' ! Variable name on file - !----------------------------------------------------------------------- - - if ( masterproc ) then - write(iulog, *) 'C13_init_TimeSeries: preparing to open file:' - write(iulog, *) trim(locfn) - endif - - call getfil(atm_c13_filename, locfn, 0) - - call ncd_pio_openfile (ncid, trim(locfn), 0) - - call ncd_inqdlen(ncid,dimid,ntim,'time') - - !! allocate arrays based on size of netcdf timeseries - allocate(atm_c13file_time(ntim)) - allocate(atm_delta_c13(ntim)) - - call ncd_io(ncid=ncid, varname='time', flag='read', data=atm_c13file_time, & - readvar=readvar) - if ( .not. readvar ) then - call endrun(msg="ERROR: time not on file"//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname=vname, flag='read', data=atm_delta_c13, & - readvar=readvar) - if ( .not. readvar ) then - call endrun(msg="ERROR: '//vname//' not on file"//errMsg(sourcefile, __LINE__)) - end if - - ! Check units - call check_units( ncid, vname, "VPDB" ) - call ncd_pio_closefile(ncid) - - ! check to make sure that time dimension is well behaved - do t = 2, ntim - if ( atm_c13file_time(t) - atm_c13file_time(t-1) <= 0._r8 ) then - write(iulog, *) 'C13_init_TimeSeries: error. time axis must be monotonically increasing' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end do - - end subroutine C13_init_TimeSeries - - !----------------------------------------------------------------------- - subroutine check_units( ncid, vname, relativeto ) - ! - ! !DESCRIPTION: - ! check that time and data units are what's expected or else abort - ! - ! !USES: - use ncdio_pio, only : file_desc_t, ncd_inqvid, ncd_getatt, var_desc_t - ! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*), intent(in) :: vname ! Variable name - character(len=*), intent(in) :: relativeto ! What are data units relative to - ! - ! !LOCAL VARIABLES: - type(var_desc_t) :: vardesc ! variable descriptor - integer :: varid ! variable index - character(len=50) :: units ! Data units - character(len=50) :: t_units_expected ! Time units to expect - - call ncd_inqvid( ncid, 'time', varid, vardesc ) - call ncd_getatt( ncid, varid, "units", units ) - write(t_units_expected,'("years since", I5, "-01-01 0:0:0.0")' ) nint(time_axis_offset) - if ( trim(units) /= t_units_expected )then - call endrun(msg="ERROR: time units on file are NOT what's expected"//errMsg(sourcefile, __LINE__)) - end if - call ncd_inqvid( ncid, vname, varid, vardesc ) - call ncd_getatt( ncid, varid, "units", units ) - if ( trim(units) /= "per mil, relative to "//relativeto )then - call endrun(msg="ERROR: units on file for "//vname//" are NOT what's expected"//errMsg(sourcefile, __LINE__)) - end if - end subroutine check_units - - -end module CIsoAtmTimeseriesMod diff --git a/src/biogeochem/CNCIsoFluxMod.F90 b/src/biogeochem/CNCIsoFluxMod.F90 deleted file mode 100644 index a92ab44e47..0000000000 --- a/src/biogeochem/CNCIsoFluxMod.F90 +++ /dev/null @@ -1,1606 +0,0 @@ -module CNCIsoFluxMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for carbon isotopic flux variable update, non-mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, nlevdecomp, ndecomp_pools - use clm_varpar , only : max_patch_per_col, maxpatch_pft - use abortutils , only : endrun - use pftconMod , only : pftcon - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use ColumnType , only : col - use PatchType , only : patch - use clm_varctl , only : use_crop - use clm_varctl , only : use_grainproduct - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CIsoFlux1 - public :: CIsoFlux2 - public :: CIsoFlux2h - public :: CIsoFlux3 - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: CNCIsoLitterToColumn - private :: CNCIsoGapPftToColumn - private :: CNCIsoHarvestPftToColumn - private :: CIsoFluxCalc - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - iso_soilbiogeochem_carbonflux_inst, iso_soilbiogeochem_carbonstate_inst, & - iso_cnveg_carbonflux_inst, iso_cnveg_carbonstate_inst, & - isotope) - ! - ! !DESCRIPTION: - ! On the radiation time step, set the carbon isotopic flux - ! variables (except for gap-phase mortality and fire fluxes) - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns 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(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: soilbiogeochem_carbonstate_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: iso_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: iso_soilbiogeochem_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: iso_cnveg_carbonstate_inst - character(len=*) , intent(in) :: isotope ! 'c13' or 'c14' - ! - ! !LOCAL VARIABLES: - integer :: fp,pi,l,fc,cc,j,p - integer :: cdp - !----------------------------------------------------------------------- - - associate( & - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & - soilbiogeochem_cs => soilbiogeochem_carbonstate_inst , & - soilbiogeochem_cf => soilbiogeochem_carbonflux_inst , & - cnveg_cf => cnveg_carbonflux_inst , & - cnveg_cs => cnveg_carbonstate_inst , & - iso_cnveg_cf => iso_cnveg_carbonflux_inst , & - iso_cnveg_cs => iso_cnveg_carbonstate_inst , & - iso_soilbiogeochem_cs => iso_soilbiogeochem_carbonstate_inst , & - iso_soilbiogeochem_cf => iso_soilbiogeochem_carbonflux_inst & - ) - - ! patch-level non-mortality fluxes - - ! Note: if the variables which are arguments to CIsoFluxCalc are ever changed to NOT be - ! pointers, then the CIsoFluxCalc routine will need to be changed to declare the bounds - ! of each argument, these bounds will need to be passed in, and - importantly for - ! threading to work properly - the subroutine calls will need to be changed so that - ! instead of 'call CIsoFluxCalc(foo, ...)' we have 'call CIsoFluxCalc(foo(begp:endp), ...)'. - - call CIsoFluxCalc(& - iso_cnveg_cf%leafc_xfer_to_leafc_patch , cnveg_cf%leafc_xfer_to_leafc_patch, & - iso_cnveg_cs%leafc_xfer_patch , cnveg_cs%leafc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%frootc_xfer_to_frootc_patch , cnveg_cf%frootc_xfer_to_frootc_patch, & - iso_cnveg_cs%frootc_xfer_patch , cnveg_cs%frootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livestemc_xfer_to_livestemc_patch , cnveg_cf%livestemc_xfer_to_livestemc_patch, & - iso_cnveg_cs%livestemc_xfer_patch , cnveg_cs%livestemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%deadstemc_xfer_to_deadstemc_patch , cnveg_cf%deadstemc_xfer_to_deadstemc_patch, & - iso_cnveg_cs%deadstemc_xfer_patch , cnveg_cs%deadstemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livecrootc_xfer_to_livecrootc_patch , cnveg_cf%livecrootc_xfer_to_livecrootc_patch, & - iso_cnveg_cs%livecrootc_xfer_patch , cnveg_cs%livecrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%deadcrootc_xfer_to_deadcrootc_patch , cnveg_cf%deadcrootc_xfer_to_deadcrootc_patch, & - iso_cnveg_cs%deadcrootc_xfer_patch , cnveg_cs%deadcrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%leafc_to_litter_patch , cnveg_cf%leafc_to_litter_patch, & - iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%frootc_to_litter_patch , cnveg_cf%frootc_to_litter_patch, & - iso_cnveg_cs%frootc_patch , cnveg_cs%frootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livestemc_to_deadstemc_patch , cnveg_cf%livestemc_to_deadstemc_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livecrootc_to_deadcrootc_patch , cnveg_cf%livecrootc_to_deadcrootc_patch, & - iso_cnveg_cs%livecrootc_patch , cnveg_cs%livecrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%leaf_curmr_patch , cnveg_cf%leaf_curmr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%froot_curmr_patch , cnveg_cf%froot_curmr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livestem_curmr_patch , cnveg_cf%livestem_curmr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livecroot_curmr_patch , cnveg_cf%livecroot_curmr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%leaf_xsmr_patch , cnveg_cf%leaf_xsmr_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%froot_xsmr_patch , cnveg_cf%froot_xsmr_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livestem_xsmr_patch , cnveg_cf%livestem_xsmr_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livecroot_xsmr_patch , cnveg_cf%livecroot_xsmr_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_xsmrpool_patch , cnveg_cf%cpool_to_xsmrpool_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_leafc_patch , cnveg_cf%cpool_to_leafc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_leafc_storage_patch , cnveg_cf%cpool_to_leafc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_frootc_patch , cnveg_cf%cpool_to_frootc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_frootc_storage_patch , cnveg_cf%cpool_to_frootc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_livestemc_patch , cnveg_cf%cpool_to_livestemc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_livestemc_storage_patch , cnveg_cf%cpool_to_livestemc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_deadstemc_patch , cnveg_cf%cpool_to_deadstemc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_deadstemc_storage_patch , cnveg_cf%cpool_to_deadstemc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_livecrootc_patch , cnveg_cf%cpool_to_livecrootc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_livecrootc_storage_patch , cnveg_cf%cpool_to_livecrootc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_deadcrootc_patch , cnveg_cf%cpool_to_deadcrootc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_deadcrootc_storage_patch , cnveg_cf%cpool_to_deadcrootc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_leaf_gr_patch , cnveg_cf%cpool_leaf_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_froot_gr_patch , cnveg_cf%cpool_froot_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_livestem_gr_patch , cnveg_cf%cpool_livestem_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_deadstem_gr_patch , cnveg_cf%cpool_deadstem_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_livecroot_gr_patch , cnveg_cf%cpool_livecroot_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_deadcroot_gr_patch , cnveg_cf%cpool_deadcroot_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_leaf_storage_gr_patch , cnveg_cf%cpool_leaf_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_froot_storage_gr_patch , cnveg_cf%cpool_froot_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_livestem_storage_gr_patch , cnveg_cf%cpool_livestem_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_deadstem_storage_gr_patch , cnveg_cf%cpool_deadstem_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_livecroot_storage_gr_patch , cnveg_cf%cpool_livecroot_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_deadcroot_storage_gr_patch , cnveg_cf%cpool_deadcroot_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_gresp_storage_patch , cnveg_cf%cpool_to_gresp_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_leaf_gr_patch , cnveg_cf%transfer_leaf_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_froot_gr_patch , cnveg_cf%transfer_froot_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_livestem_gr_patch , cnveg_cf%transfer_livestem_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_deadstem_gr_patch , cnveg_cf%transfer_deadstem_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_livecroot_gr_patch , cnveg_cf%transfer_livecroot_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_deadcroot_gr_patch , cnveg_cf%transfer_deadcroot_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%leafc_storage_to_xfer_patch , cnveg_cf%leafc_storage_to_xfer_patch, & - iso_cnveg_cs%leafc_storage_patch , cnveg_cs%leafc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%frootc_storage_to_xfer_patch , cnveg_cf%frootc_storage_to_xfer_patch, & - iso_cnveg_cs%frootc_storage_patch , cnveg_cs%frootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livestemc_storage_to_xfer_patch , cnveg_cf%livestemc_storage_to_xfer_patch, & - iso_cnveg_cs%livestemc_storage_patch , cnveg_cs%livestemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%deadstemc_storage_to_xfer_patch , cnveg_cf%deadstemc_storage_to_xfer_patch, & - iso_cnveg_cs%deadstemc_storage_patch , cnveg_cs%deadstemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livecrootc_storage_to_xfer_patch , cnveg_cf%livecrootc_storage_to_xfer_patch, & - iso_cnveg_cs%livecrootc_storage_patch , cnveg_cs%livecrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%deadcrootc_storage_to_xfer_patch , cnveg_cf%deadcrootc_storage_to_xfer_patch, & - iso_cnveg_cs%deadcrootc_storage_patch , cnveg_cs%deadcrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%gresp_storage_to_xfer_patch , cnveg_cf%gresp_storage_to_xfer_patch, & - iso_cnveg_cs%gresp_storage_patch , cnveg_cs%gresp_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%soilc_change_patch , cnveg_cf%soilc_change_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - ! Note that cpool_to_resp_patch is a diagnostic flux and therefore this Iso flux calculation - ! not strictly required. - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_resp_patch , cnveg_cf%cpool_to_resp_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - if ( use_crop )then - call CIsoFluxCalc(& - iso_cnveg_cf%grainc_xfer_to_grainc_patch , cnveg_cf%grainc_xfer_to_grainc_patch, & - iso_cnveg_cs%grainc_xfer_patch , cnveg_cs%grainc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%grainc_to_food_patch , cnveg_cf%grainc_to_food_patch, & - iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%grainc_to_seed_patch , cnveg_cf%grainc_to_seed_patch, & - iso_cnveg_cs%grainc_patch , cnveg_cs%grainc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%crop_seedc_to_leaf_patch , cnveg_cf%crop_seedc_to_leaf_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%grain_curmr_patch , cnveg_cf%grain_curmr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%grain_xsmr_patch , cnveg_cf%grain_xsmr_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_grain_gr_patch , cnveg_cf%cpool_grain_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_grainc_patch , cnveg_cf%cpool_to_grainc_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_to_grainc_storage_patch , cnveg_cf%cpool_to_grainc_storage_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%transfer_grain_gr_patch , cnveg_cf%transfer_grain_gr_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%cpool_grain_storage_gr_patch , cnveg_cf%cpool_grain_storage_gr_patch, & - iso_cnveg_cs%cpool_patch , cnveg_cs%cpool_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%grainc_storage_to_xfer_patch , cnveg_cf%grainc_storage_to_xfer_patch, & - iso_cnveg_cs%grainc_storage_patch , cnveg_cs%grainc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%livestemc_to_litter_patch , cnveg_cf%livestemc_to_litter_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - if (use_grainproduct) then - do fp = 1,num_soilp - p = filter_soilp(fp) - iso_cnveg_cf%grainc_to_cropprodc_patch(p) = iso_cnveg_cf%grainc_to_food_patch(p) - iso_cnveg_cf%grain_mr_patch(p) = iso_cnveg_cf%grain_xsmr_patch(p) + iso_cnveg_cf%grain_curmr_patch(p) - end do - endif - end if - - ! call routine to shift patch-level litterfall fluxes to column, for isotopes - ! the non-isotope version of this routine is called in CNPhenologyMod.F90 - ! For later clean-up, it would be possible to generalize this function to operate on a single - ! patch-to-column flux. - - call CNCIsoLitterToColumn(num_soilc, filter_soilc, soilbiogeochem_state_inst, iso_cnveg_carbonflux_inst) - - ! column-level non-mortality fluxes - - do fc = 1,num_soilc - cc = filter_soilc(fc) - do j = 1, nlevdecomp - do l = 1, ndecomp_cascade_transitions - cdp = cascade_donor_pool(l) - if ( soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,cdp) /= 0._r8) then - iso_soilbiogeochem_cf%decomp_cascade_hr_vr_col(cc,j,l) = & - soilbiogeochem_cf%decomp_cascade_hr_vr_col(cc,j,l) * & - (iso_soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,cdp) & - / soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,cdp)) * 1._r8 - else - iso_soilbiogeochem_cf%decomp_cascade_hr_vr_col(cc,j,l) = 0._r8 - end if - end do - end do - end do - - do fc = 1,num_soilc - cc = filter_soilc(fc) - do j = 1, nlevdecomp - do l = 1, ndecomp_cascade_transitions - cdp = cascade_donor_pool(l) - if ( soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,cdp) /= 0._r8) then - iso_soilbiogeochem_cf%decomp_cascade_ctransfer_vr_col(cc,j,l) = & - soilbiogeochem_cf%decomp_cascade_ctransfer_vr_col(cc,j,l) * & - (iso_soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,cdp) & - / soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,cdp)) * 1._r8 - else - iso_soilbiogeochem_cf%decomp_cascade_ctransfer_vr_col(cc,j,l) = 0._r8 - end if - end do - end do - end do - - end associate - - end subroutine CIsoFlux1 - - !----------------------------------------------------------------------- - subroutine CIsoFlux2(num_soilc, filter_soilc, num_soilp , filter_soilp, & - soilbiogeochem_state_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - iso_cnveg_carbonflux_inst, iso_cnveg_carbonstate_inst, isotope) - ! - ! !DESCRIPTION: - ! On the radiation time step, set the carbon isotopic fluxes for gap mortality - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns 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(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: iso_cnveg_carbonstate_inst - character(len=*) , intent(in) :: isotope ! 'c13' or 'c14' - - ! - ! !LOCAL VARIABLES: - integer :: fp,pi - !----------------------------------------------------------------------- - - associate( & - cnveg_cf => cnveg_carbonflux_inst , & - cnveg_cs => cnveg_carbonstate_inst , & - iso_cnveg_cf => iso_cnveg_carbonflux_inst , & - iso_cnveg_cs => iso_cnveg_carbonstate_inst & - ) - - ! patch-level gap mortality fluxes - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_to_litter_patch , cnveg_cf%m_leafc_to_litter_patch, & - iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_storage_to_litter_patch , cnveg_cf%m_leafc_storage_to_litter_patch, & - iso_cnveg_cs%leafc_storage_patch , cnveg_cs%leafc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_xfer_to_litter_patch , cnveg_cf%m_leafc_xfer_to_litter_patch, & - iso_cnveg_cs%leafc_xfer_patch , cnveg_cs%leafc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_to_litter_patch , cnveg_cf%m_frootc_to_litter_patch, & - iso_cnveg_cs%frootc_patch , cnveg_cs%frootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_storage_to_litter_patch , cnveg_cf%m_frootc_storage_to_litter_patch, & - iso_cnveg_cs%frootc_storage_patch , cnveg_cs%frootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_xfer_to_litter_patch , cnveg_cf%m_frootc_xfer_to_litter_patch, & - iso_cnveg_cs%frootc_xfer_patch , cnveg_cs%frootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_to_litter_patch , cnveg_cf%m_livestemc_to_litter_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_storage_to_litter_patch , cnveg_cf%m_livestemc_storage_to_litter_patch, & - iso_cnveg_cs%livestemc_storage_patch , cnveg_cs%livestemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_xfer_to_litter_patch , cnveg_cf%m_livestemc_xfer_to_litter_patch, & - iso_cnveg_cs%livestemc_xfer_patch , cnveg_cs%livestemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_to_litter_patch , cnveg_cf%m_deadstemc_to_litter_patch, & - iso_cnveg_cs%deadstemc_patch , cnveg_cs%deadstemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_storage_to_litter_patch , cnveg_cf%m_deadstemc_storage_to_litter_patch, & - iso_cnveg_cs%deadstemc_storage_patch , cnveg_cs%deadstemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_xfer_to_litter_patch , cnveg_cf%m_deadstemc_xfer_to_litter_patch, & - iso_cnveg_cs%deadstemc_xfer_patch , cnveg_cs%deadstemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_to_litter_patch , cnveg_cf%m_livecrootc_to_litter_patch, & - iso_cnveg_cs%livecrootc_patch , cnveg_cs%livecrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_storage_to_litter_patch , cnveg_cf%m_livecrootc_storage_to_litter_patch, & - iso_cnveg_cs%livecrootc_storage_patch , cnveg_cs%livecrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_xfer_to_litter_patch , cnveg_cf%m_livecrootc_xfer_to_litter_patch, & - iso_cnveg_cs%livecrootc_xfer_patch , cnveg_cs%livecrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_to_litter_patch , cnveg_cf%m_deadcrootc_to_litter_patch, & - iso_cnveg_cs%deadcrootc_patch , cnveg_cs%deadcrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_storage_to_litter_patch , cnveg_cf%m_deadcrootc_storage_to_litter_patch, & - iso_cnveg_cs%deadcrootc_storage_patch , cnveg_cs%deadcrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_xfer_to_litter_patch , cnveg_cf%m_deadcrootc_xfer_to_litter_patch, & - iso_cnveg_cs%deadcrootc_xfer_patch , cnveg_cs%deadcrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_gresp_storage_to_litter_patch , cnveg_cf%m_gresp_storage_to_litter_patch, & - iso_cnveg_cs%gresp_storage_patch , cnveg_cs%gresp_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_gresp_xfer_to_litter_patch , cnveg_cf%m_gresp_xfer_to_litter_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - ! call routine to shift patch-level gap mortality fluxes to column , for isotopes - ! the non-isotope version of this routine is in CNGapMortalityMod.F90. - - call CNCIsoGapPftToColumn(num_soilc, filter_soilc, soilbiogeochem_state_inst, iso_cnveg_carbonflux_inst) - - end associate - - end subroutine CIsoFlux2 - - !----------------------------------------------------------------------- - subroutine CIsoFlux2h(num_soilc , filter_soilc, num_soilp , filter_soilp, & - soilbiogeochem_state_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - iso_cnveg_carbonflux_inst, iso_cnveg_carbonstate_inst, isotope) - ! - ! !DESCRIPTION: - ! set the carbon isotopic fluxes for harvest mortality - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns 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(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: iso_cnveg_carbonstate_inst - character(len=*) , intent(in) :: isotope ! 'c13' or 'c14' - - !----------------------------------------------------------------------- - - associate( & - cnveg_cf => cnveg_carbonflux_inst , & - cnveg_cs => cnveg_carbonstate_inst , & - iso_cnveg_cf => iso_cnveg_carbonflux_inst , & - iso_cnveg_cs => iso_cnveg_carbonstate_inst & - ) - - ! patch-level gap mortality fluxes - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_leafc_to_litter_patch , cnveg_cf%hrv_leafc_to_litter_patch, & - iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_leafc_storage_to_litter_patch , cnveg_cf%hrv_leafc_storage_to_litter_patch, & - iso_cnveg_cs%leafc_storage_patch , cnveg_cs%leafc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_leafc_xfer_to_litter_patch , cnveg_cf%hrv_leafc_xfer_to_litter_patch, & - iso_cnveg_cs%leafc_xfer_patch , cnveg_cs%leafc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_frootc_to_litter_patch , cnveg_cf%hrv_frootc_to_litter_patch, & - iso_cnveg_cs%frootc_patch , cnveg_cs%frootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_frootc_storage_to_litter_patch , cnveg_cf%hrv_frootc_storage_to_litter_patch, & - iso_cnveg_cs%frootc_storage_patch , cnveg_cs%frootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_frootc_xfer_to_litter_patch , cnveg_cf%hrv_frootc_xfer_to_litter_patch, & - iso_cnveg_cs%frootc_xfer_patch , cnveg_cs%frootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_livestemc_to_litter_patch , cnveg_cf%hrv_livestemc_to_litter_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_livestemc_storage_to_litter_patch , cnveg_cf%hrv_livestemc_storage_to_litter_patch, & - iso_cnveg_cs%livestemc_storage_patch , cnveg_cs%livestemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_livestemc_xfer_to_litter_patch , cnveg_cf%hrv_livestemc_xfer_to_litter_patch, & - iso_cnveg_cs%livestemc_xfer_patch , cnveg_cs%livestemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%wood_harvestc_patch , cnveg_cf%wood_harvestc_patch, & - iso_cnveg_cs%deadstemc_patch , cnveg_cs%deadstemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_deadstemc_storage_to_litter_patch , cnveg_cf%hrv_deadstemc_storage_to_litter_patch, & - iso_cnveg_cs%deadstemc_storage_patch , cnveg_cs%deadstemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_deadstemc_xfer_to_litter_patch , cnveg_cf%hrv_deadstemc_xfer_to_litter_patch, & - iso_cnveg_cs%deadstemc_xfer_patch , cnveg_cs%deadstemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_livecrootc_to_litter_patch , cnveg_cf%hrv_livecrootc_to_litter_patch, & - iso_cnveg_cs%livecrootc_patch , cnveg_cs%livecrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_livecrootc_storage_to_litter_patch , cnveg_cf%hrv_livecrootc_storage_to_litter_patch, & - iso_cnveg_cs%livecrootc_storage_patch , cnveg_cs%livecrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_livecrootc_xfer_to_litter_patch , cnveg_cf%hrv_livecrootc_xfer_to_litter_patch, & - iso_cnveg_cs%livecrootc_xfer_patch , cnveg_cs%livecrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_deadcrootc_to_litter_patch , cnveg_cf%hrv_deadcrootc_to_litter_patch, & - iso_cnveg_cs%deadcrootc_patch , cnveg_cs%deadcrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_deadcrootc_storage_to_litter_patch , cnveg_cf%hrv_deadcrootc_storage_to_litter_patch, & - iso_cnveg_cs%deadcrootc_storage_patch , cnveg_cs%deadcrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_deadcrootc_xfer_to_litter_patch , cnveg_cf%hrv_deadcrootc_xfer_to_litter_patch, & - iso_cnveg_cs%deadcrootc_xfer_patch , cnveg_cs%deadcrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_gresp_storage_to_litter_patch , cnveg_cf%hrv_gresp_storage_to_litter_patch, & - iso_cnveg_cs%gresp_storage_patch , cnveg_cs%gresp_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_gresp_xfer_to_litter_patch , cnveg_cf%hrv_gresp_xfer_to_litter_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%hrv_xsmrpool_to_atm_patch , cnveg_cf%hrv_xsmrpool_to_atm_patch, & - iso_cnveg_cs%totvegc_patch , cnveg_cs%totvegc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - ! call routine to shift patch-level gap mortality fluxes to column, - ! for isotopes the non-isotope version of this routine is in CNGapMortalityMod.F90. - - call CNCIsoHarvestPftToColumn(num_soilc, filter_soilc, soilbiogeochem_state_inst, iso_cnveg_carbonflux_inst) - - end associate - - end subroutine CIsoFlux2h - - !----------------------------------------------------------------------- - subroutine CIsoFlux3(num_soilc , filter_soilc, num_soilp , filter_soilp, & - soilbiogeochem_state_inst , soilbiogeochem_carbonstate_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - iso_cnveg_carbonflux_inst, iso_cnveg_carbonstate_inst, & - iso_soilbiogeochem_carbonstate_inst, isotope) - ! - ! !DESCRIPTION: - ! On the radiation time step, set the carbon isotopic fluxes for fire mortality - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns 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(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: soilbiogeochem_carbonstate_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(in) :: iso_cnveg_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: iso_soilbiogeochem_carbonstate_inst - character(len=*) , intent(in) :: isotope ! 'c13' or 'c14' - ! - ! !LOCAL VARIABLES: - integer :: pi,pp,l,fc,cc,j - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) for this patch (0-1) - croot_prof => soilbiogeochem_state_inst%croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => soilbiogeochem_state_inst%stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - soilbiogeochem_cs => soilbiogeochem_carbonstate_inst , & - cnveg_cf => cnveg_carbonflux_inst , & - cnveg_cs => cnveg_carbonstate_inst , & - iso_cnveg_cf => iso_cnveg_carbonflux_inst , & - iso_cnveg_cs => iso_cnveg_carbonstate_inst , & - iso_soilbiogeochem_cs => iso_soilbiogeochem_carbonstate_inst , & - lf_flab => pftcon%lf_flab , & ! Input: [real(r8) (:) ] leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: [real(r8) (:) ] leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: [real(r8) (:) ] leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: [real(r8) (:) ] fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: [real(r8) (:) ] fine root litter cellulose fraction - fr_flig => pftcon%fr_flig & ! Input: [real(r8) (:) ] fine root litter lignin fraction - ) - - ! patch-level fire mortality fluxes - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_to_fire_patch , cnveg_cf%m_leafc_to_fire_patch, & - iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_storage_to_fire_patch , cnveg_cf%m_leafc_storage_to_fire_patch, & - iso_cnveg_cs%leafc_storage_patch , cnveg_cs%leafc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_xfer_to_fire_patch , cnveg_cf%m_leafc_xfer_to_fire_patch, & - iso_cnveg_cs%leafc_xfer_patch , cnveg_cs%leafc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_to_fire_patch , cnveg_cf%m_frootc_to_fire_patch, & - iso_cnveg_cs%frootc_patch , cnveg_cs%frootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_storage_to_fire_patch , cnveg_cf%m_frootc_storage_to_fire_patch, & - iso_cnveg_cs%frootc_storage_patch , cnveg_cs%frootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_xfer_to_fire_patch , cnveg_cf%m_frootc_xfer_to_fire_patch, & - iso_cnveg_cs%frootc_xfer_patch , cnveg_cs%frootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_to_fire_patch , cnveg_cf%m_livestemc_to_fire_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_storage_to_fire_patch , cnveg_cf%m_livestemc_storage_to_fire_patch, & - iso_cnveg_cs%livestemc_storage_patch , cnveg_cs%livestemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_xfer_to_fire_patch , cnveg_cf%m_livestemc_xfer_to_fire_patch, & - iso_cnveg_cs%livestemc_xfer_patch , cnveg_cs%livestemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_to_fire_patch , cnveg_cf%m_deadstemc_to_fire_patch, & - iso_cnveg_cs%deadstemc_patch , cnveg_cs%deadstemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_to_litter_fire_patch , cnveg_cf%m_deadstemc_to_litter_fire_patch, & - iso_cnveg_cs%deadstemc_patch , cnveg_cs%deadstemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_storage_to_fire_patch , cnveg_cf%m_deadstemc_storage_to_fire_patch, & - iso_cnveg_cs%deadstemc_storage_patch , cnveg_cs%deadstemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_xfer_to_fire_patch , cnveg_cf%m_deadstemc_xfer_to_fire_patch, & - iso_cnveg_cs%deadstemc_xfer_patch , cnveg_cs%deadstemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_to_fire_patch , cnveg_cf%m_livecrootc_to_fire_patch, & - iso_cnveg_cs%livecrootc_patch , cnveg_cs%livecrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_storage_to_fire_patch , cnveg_cf%m_livecrootc_storage_to_fire_patch, & - iso_cnveg_cs%livecrootc_storage_patch , cnveg_cs%livecrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_xfer_to_fire_patch , cnveg_cf%m_livecrootc_xfer_to_fire_patch, & - iso_cnveg_cs%livecrootc_xfer_patch , cnveg_cs%livecrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_to_fire_patch , cnveg_cf%m_deadcrootc_to_fire_patch, & - iso_cnveg_cs%deadcrootc_patch , cnveg_cs%deadcrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_to_litter_fire_patch , cnveg_cf%m_deadcrootc_to_litter_fire_patch, & - iso_cnveg_cs%deadcrootc_patch , cnveg_cs%deadcrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_storage_to_fire_patch , cnveg_cf%m_deadcrootc_storage_to_fire_patch, & - iso_cnveg_cs%deadcrootc_storage_patch , cnveg_cs%deadcrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_xfer_to_fire_patch , cnveg_cf%m_deadcrootc_xfer_to_fire_patch, & - iso_cnveg_cs%deadcrootc_xfer_patch , cnveg_cs%deadcrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_gresp_storage_to_fire_patch , cnveg_cf%m_gresp_storage_to_fire_patch, & - iso_cnveg_cs%gresp_storage_patch , cnveg_cs%gresp_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_gresp_xfer_to_fire_patch , cnveg_cf%m_gresp_xfer_to_fire_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_to_litter_fire_patch , cnveg_cf%m_leafc_to_litter_fire_patch, & - iso_cnveg_cs%leafc_patch , cnveg_cs%leafc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_storage_to_litter_fire_patch, cnveg_cf%m_leafc_storage_to_litter_fire_patch, & - iso_cnveg_cs%leafc_storage_patch , cnveg_cs%leafc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_leafc_xfer_to_litter_fire_patch , cnveg_cf%m_leafc_xfer_to_litter_fire_patch, & - iso_cnveg_cs%leafc_xfer_patch , cnveg_cs%leafc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_to_litter_fire_patch , cnveg_cf%m_livestemc_to_litter_fire_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_storage_to_litter_fire_patch, cnveg_cf%m_livestemc_storage_to_litter_fire_patch, & - iso_cnveg_cs%livestemc_storage_patch , cnveg_cs%livestemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_xfer_to_litter_fire_patch, cnveg_cf%m_livestemc_xfer_to_litter_fire_patch, & - iso_cnveg_cs%livestemc_xfer_patch , cnveg_cs%livestemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livestemc_to_deadstemc_fire_patch, cnveg_cf%m_livestemc_to_deadstemc_fire_patch, & - iso_cnveg_cs%livestemc_patch , cnveg_cs%livestemc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_storage_to_litter_fire_patch, cnveg_cf%m_deadstemc_storage_to_litter_fire_patch, & - iso_cnveg_cs%deadstemc_storage_patch , cnveg_cs%deadstemc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadstemc_xfer_to_litter_fire_patch, cnveg_cf%m_deadstemc_xfer_to_litter_fire_patch, & - iso_cnveg_cs%deadstemc_xfer_patch , cnveg_cs%deadstemc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_to_litter_fire_patch , cnveg_cf%m_frootc_to_litter_fire_patch, & - iso_cnveg_cs%frootc_patch , cnveg_cs%frootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_storage_to_litter_fire_patch, cnveg_cf%m_frootc_storage_to_litter_fire_patch, & - iso_cnveg_cs%frootc_storage_patch , cnveg_cs%frootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_frootc_xfer_to_litter_fire_patch , cnveg_cf%m_frootc_xfer_to_litter_fire_patch, & - iso_cnveg_cs%frootc_xfer_patch , cnveg_cs%frootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_to_litter_fire_patch , cnveg_cf%m_livecrootc_to_litter_fire_patch, & - iso_cnveg_cs%livecrootc_patch , cnveg_cs%livecrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_storage_to_litter_fire_patch, cnveg_cf%m_livecrootc_storage_to_litter_fire_patch, & - iso_cnveg_cs%livecrootc_storage_patch , cnveg_cs%livecrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_xfer_to_litter_fire_patch, cnveg_cf%m_livecrootc_xfer_to_litter_fire_patch, & - iso_cnveg_cs%livecrootc_xfer_patch , cnveg_cs%livecrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_livecrootc_to_deadcrootc_fire_patch, cnveg_cf%m_livecrootc_to_deadcrootc_fire_patch, & - iso_cnveg_cs%livecrootc_patch , cnveg_cs%livecrootc_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_storage_to_litter_fire_patch, cnveg_cf%m_deadcrootc_storage_to_litter_fire_patch, & - iso_cnveg_cs%deadcrootc_storage_patch , cnveg_cs%deadcrootc_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_deadcrootc_xfer_to_litter_fire_patch, cnveg_cf%m_deadcrootc_xfer_to_litter_fire_patch, & - iso_cnveg_cs%deadcrootc_xfer_patch , cnveg_cs%deadcrootc_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_gresp_storage_to_litter_fire_patch, cnveg_cf%m_gresp_storage_to_litter_fire_patch, & - iso_cnveg_cs%gresp_storage_patch , cnveg_cs%gresp_storage_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - call CIsoFluxCalc(& - iso_cnveg_cf%m_gresp_xfer_to_litter_fire_patch , cnveg_cf%m_gresp_xfer_to_litter_fire_patch, & - iso_cnveg_cs%gresp_xfer_patch , cnveg_cs%gresp_xfer_patch, & - num_soilp , filter_soilp, 1._r8, 0, isotope) - - - - ! calculate the column-level flux of deadstem and deadcrootc to cwdc as the result of fire mortality. - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - cc = filter_soilc(fc) - if ( pi <= col%npatches(cc) ) then - pp = col%patchi(cc) + pi - 1 - if (patch%active(pp)) then - do j = 1, nlevdecomp - iso_cnveg_cf%fire_mortality_c_to_cwdc_col(cc,j) = & - iso_cnveg_cf%fire_mortality_c_to_cwdc_col(cc,j) + & - (iso_cnveg_cf%m_deadstemc_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_livestemc_to_litter_fire_patch(pp)) * & - patch%wtcol(pp) * stem_prof(pp,j) - iso_cnveg_cf%fire_mortality_c_to_cwdc_col(cc,j) = & - iso_cnveg_cf%fire_mortality_c_to_cwdc_col(cc,j) + & - (iso_cnveg_cf%m_deadcrootc_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_livecrootc_to_litter_fire_patch(pp)) * & - patch%wtcol(pp) * croot_prof(pp,j) - end do - end if - end if - end do - end do - - - do fc = 1,num_soilc - cc = filter_soilc(fc) - do j = 1, nlevdecomp - do l = 1, ndecomp_pools - if ( soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,l) /= 0._r8) then - iso_cnveg_cf%m_decomp_cpools_to_fire_vr_col(cc,j,l) = & - cnveg_cf%m_decomp_cpools_to_fire_vr_col(cc,j,l) * & - (iso_soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,l) / & - soilbiogeochem_cs%decomp_cpools_vr_col(cc,j,l)) * 1._r8 - else - iso_cnveg_cf%m_decomp_cpools_to_fire_vr_col(cc,j,l) = 0._r8 - end if - end do - end do - end do - - - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - cc = filter_soilc(fc) - if ( pi <= col%npatches(cc) ) then - pp = col%patchi(cc) + pi - 1 - if (patch%active(pp)) then - do j = 1, nlevdecomp - iso_cnveg_cf%m_c_to_litr_met_fire_col(cc,j) = iso_cnveg_cf%m_c_to_litr_met_fire_col(cc,j) + & - ((iso_cnveg_cf%m_leafc_to_litter_fire_patch(pp)*lf_flab(ivt(pp)) & - +iso_cnveg_cf%m_leafc_storage_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_leafc_xfer_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_gresp_storage_to_litter_fire_patch(pp) & - +iso_cnveg_cf%m_gresp_xfer_to_litter_fire_patch(pp))*leaf_prof(pp,j) + & - (iso_cnveg_cf%m_frootc_to_litter_fire_patch(pp)*fr_flab(ivt(pp)) & - +iso_cnveg_cf%m_frootc_storage_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_frootc_xfer_to_litter_fire_patch(pp))*froot_prof(pp,j) & - +(iso_cnveg_cf%m_livestemc_storage_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_livestemc_xfer_to_litter_fire_patch(pp) & - +iso_cnveg_cf%m_deadstemc_storage_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_deadstemc_xfer_to_litter_fire_patch(pp))* stem_prof(pp,j)& - +(iso_cnveg_cf%m_livecrootc_storage_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_livecrootc_xfer_to_litter_fire_patch(pp) & - +iso_cnveg_cf%m_deadcrootc_storage_to_litter_fire_patch(pp) + & - iso_cnveg_cf%m_deadcrootc_xfer_to_litter_fire_patch(pp))* croot_prof(pp,j)) * patch%wtcol(pp) - - iso_cnveg_cf%m_c_to_litr_cel_fire_col(cc,j) = iso_cnveg_cf%m_c_to_litr_cel_fire_col(cc,j) + & - (iso_cnveg_cf%m_leafc_to_litter_fire_patch(pp)*lf_fcel(ivt(pp))*leaf_prof(pp,j) + & - iso_cnveg_cf%m_frootc_to_litter_fire_patch(pp)*fr_fcel(ivt(pp))*froot_prof(pp,j)) * patch%wtcol(pp) - - iso_cnveg_cf%m_c_to_litr_lig_fire_col(cc,j) = iso_cnveg_cf%m_c_to_litr_lig_fire_col(cc,j) + & - (iso_cnveg_cf%m_leafc_to_litter_fire_patch(pp)*lf_flig(ivt(pp))*leaf_prof(pp,j) + & - iso_cnveg_cf%m_frootc_to_litter_fire_patch(pp)*fr_flig(ivt(pp))*froot_prof(pp,j)) * patch%wtcol(pp) - end do - end if - end if - end do - end do - - end associate - - end subroutine CIsoFlux3 - - !----------------------------------------------------------------------- - subroutine CNCIsoLitterToColumn (num_soilc, filter_soilc, & - soilbiogeochem_state_inst, iso_cnveg_carbonflux_inst) - ! - ! !DESCRIPTION: - ! called at the end of cn_phenology to gather all patch-level litterfall fluxes - ! to the column level and assign them to the three litter pools - ! - ! !USES: -!DML - use pftconMod , only : npcropmin - use clm_varctl , only : use_grainproduct -!DML - - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) for this patch (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction - - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - - leafc_to_litter => iso_cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Input: [real(r8) (:) ] - frootc_to_litter => iso_cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Input: [real(r8) (:) ] -!DML - livestemc_to_litter => iso_cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] - grainc_to_food => iso_cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] -!DML - phenology_c_to_litr_met_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) - phenology_c_to_litr_cel_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) - phenology_c_to_litr_lig_c => iso_cnveg_carbonflux_inst%phenology_c_to_litr_lig_c_col & ! InOut: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) - ) - - do j = 1, nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - ! leaf litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - -!DML - if (ivt(p) >= npcropmin) then ! add livestemc to litter - ! stem litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + livestemc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - if (.not. use_grainproduct) then - ! grain litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - end if - - end if -!DML - end if - end if - - end do - end do - - end do - - end associate - - end subroutine CNCIsoLitterToColumn - - !----------------------------------------------------------------------- - subroutine CNCIsoGapPftToColumn (num_soilc, filter_soilc, & - soilbiogeochem_state_inst, iso_cnveg_carbonflux_inst) - ! - ! !DESCRIPTION: - ! gather all patch-level gap mortality fluxes - ! to the column level and assign them to the three litter pools (+ cwd pool) - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! soil column filter - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] patch weight relative to column (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction - - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => soilbiogeochem_state_inst%croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => soilbiogeochem_state_inst%stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - - m_leafc_to_litter => iso_cnveg_carbonflux_inst%m_leafc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_to_litter => iso_cnveg_carbonflux_inst%m_frootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_to_litter => iso_cnveg_carbonflux_inst%m_livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_to_litter => iso_cnveg_carbonflux_inst%m_deadstemc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_to_litter => iso_cnveg_carbonflux_inst%m_livecrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_to_litter => iso_cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafc_storage_to_litter => iso_cnveg_carbonflux_inst%m_leafc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_storage_to_litter => iso_cnveg_carbonflux_inst%m_frootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_storage_to_litter => iso_cnveg_carbonflux_inst%m_livestemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_storage_to_litter => iso_cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_storage_to_litter => iso_cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_storage_to_litter => iso_cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_gresp_storage_to_litter => iso_cnveg_carbonflux_inst%m_gresp_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafc_xfer_to_litter => iso_cnveg_carbonflux_inst%m_leafc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_xfer_to_litter => iso_cnveg_carbonflux_inst%m_frootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_xfer_to_litter => iso_cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_xfer_to_litter => iso_cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_xfer_to_litter => iso_cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_xfer_to_litter => iso_cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_gresp_xfer_to_litter => iso_cnveg_carbonflux_inst%m_gresp_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - - gap_mortality_c_to_litr_met_c => iso_cnveg_carbonflux_inst%gap_mortality_c_to_litr_met_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter metabolic pool (gC/m3/s) - gap_mortality_c_to_litr_cel_c => iso_cnveg_carbonflux_inst%gap_mortality_c_to_litr_cel_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter cellulose pool (gC/m3/s) - gap_mortality_c_to_litr_lig_c => iso_cnveg_carbonflux_inst%gap_mortality_c_to_litr_lig_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter lignin pool (gC/m3/s) - gap_mortality_c_to_cwdc => iso_cnveg_carbonflux_inst%gap_mortality_c_to_cwdc_col & ! InOut: [real(r8) (:,:) ] C fluxes associated with gap mortality to CWD pool (gC/m3/s) - ) - - do j = 1, nlevdecomp - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - - ! leaf gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_cel_c(c,j) = gap_mortality_c_to_litr_cel_c(c,j) + & - m_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_lig_c(c,j) = gap_mortality_c_to_litr_lig_c(c,j) + & - m_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_cel_c(c,j) = gap_mortality_c_to_litr_cel_c(c,j) + & - m_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_lig_c(c,j) = gap_mortality_c_to_litr_lig_c(c,j) + & - m_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood gap mortality carbon fluxes - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - m_livestemc_to_litter(p) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - m_deadstemc_to_litter(p) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - m_livecrootc_to_litter(p) * wtcol(p) * croot_prof(p,j) - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - m_deadcrootc_to_litter(p) * wtcol(p) * croot_prof(p,j) - - ! storage gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_leafc_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_livestemc_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_deadstemc_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_livecrootc_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_deadcrootc_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_gresp_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! transfer gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_leafc_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_livestemc_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_deadstemc_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_livecrootc_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_deadcrootc_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_gresp_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - end if - end if - - end do - - end do - end do - - end associate - - end subroutine CNCIsoGapPftToColumn - - !----------------------------------------------------------------------- - subroutine CNCIsoHarvestPftToColumn (num_soilc, filter_soilc, & - soilbiogeochem_state_inst, iso_cnveg_carbonflux_inst) - ! - ! !DESCRIPTION: - ! gather all patch-level harvest mortality fluxes - ! to the column level and assign them to the litter, cwd, and wood product pools - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! soil column filter - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: iso_cnveg_carbonflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] patch weight relative to column (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction - - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => soilbiogeochem_state_inst%croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => soilbiogeochem_state_inst%stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - - hrv_leafc_to_litter => iso_cnveg_carbonflux_inst%hrv_leafc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootc_to_litter => iso_cnveg_carbonflux_inst%hrv_frootc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemc_to_litter => iso_cnveg_carbonflux_inst%hrv_livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] - pwood_harvestc => iso_cnveg_carbonflux_inst%wood_harvestc_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootc_to_litter => iso_cnveg_carbonflux_inst%hrv_livecrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootc_to_litter => iso_cnveg_carbonflux_inst%hrv_deadcrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_leafc_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_leafc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootc_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_frootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemc_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_livestemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadstemc_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_deadstemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootc_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_livecrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootc_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_deadcrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_gresp_storage_to_litter => iso_cnveg_carbonflux_inst%hrv_gresp_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_leafc_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_leafc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootc_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_frootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemc_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_livestemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadstemc_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_deadstemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootc_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_livecrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootc_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_deadcrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_gresp_xfer_to_litter => iso_cnveg_carbonflux_inst%hrv_gresp_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - cwood_harvestc => iso_cnveg_carbonflux_inst%wood_harvestc_col , & ! Output: [real(r8) (:) ] - harvest_c_to_litr_met_c => iso_cnveg_carbonflux_inst%harvest_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with harvest to litter metabolic pool (gC/m3/s) - harvest_c_to_litr_cel_c => iso_cnveg_carbonflux_inst%harvest_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with harvest to litter cellulose pool (gC/m3/s) - harvest_c_to_litr_lig_c => iso_cnveg_carbonflux_inst%harvest_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with harvest to litter lignin pool (gC/m3/s) - harvest_c_to_cwdc => iso_cnveg_carbonflux_inst%harvest_c_to_cwdc_col & ! Output: [real(r8) (:,:) ] C fluxes associated with harvest to CWD pool (gC/m3/s) - ) - - do j = 1, nlevdecomp - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - - ! leaf harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_cel_c(c,j) = harvest_c_to_litr_cel_c(c,j) + & - hrv_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_lig_c(c,j) = harvest_c_to_litr_lig_c(c,j) + & - hrv_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_cel_c(c,j) = harvest_c_to_litr_cel_c(c,j) + & - hrv_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_lig_c(c,j) = harvest_c_to_litr_lig_c(c,j) + & - hrv_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood harvest mortality carbon fluxes - harvest_c_to_cwdc(c,j) = harvest_c_to_cwdc(c,j) + & - hrv_livestemc_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_cwdc(c,j) = harvest_c_to_cwdc(c,j) + & - hrv_livecrootc_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_cwdc(c,j) = harvest_c_to_cwdc(c,j) + & - hrv_deadcrootc_to_litter(p) * wtcol(p) * croot_prof(p,j) - - ! storage harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_leafc_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_frootc_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livestemc_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadstemc_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livecrootc_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadcrootc_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_gresp_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! transfer harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_leafc_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_frootc_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livestemc_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadstemc_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livecrootc_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadcrootc_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_gresp_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - end if - end if - - end do - - end do - end do - - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - cwood_harvestc(c) = cwood_harvestc(c) + & - pwood_harvestc(p) * wtcol(p) - end if - end if - end do - end do - - end associate - - end subroutine CNCIsoHarvestPftToColumn - - !----------------------------------------------------------------------- - subroutine CIsoFluxCalc(& - ciso_flux, ctot_flux, & - ciso_state, ctot_state, & - num, filter, frax_c13, diag, isotope) - ! - ! !DESCRIPTION: - ! On the radiation time step, set the carbon isotopic flux - ! variables (except for gap-phase mortality and fire fluxes) - ! - ! !ARGUMENTS: - real(r8) , intent(inout), pointer :: ciso_flux(:) ! isoC flux - real(r8) , intent(in) , pointer :: ctot_flux(:) ! totC flux - real(r8) , intent(in) , pointer :: ciso_state(:) ! isoC state, upstream pool - real(r8) , intent(in) , pointer :: ctot_state(:) ! totC state, upstream pool - real(r8) , intent(in) :: frax_c13 ! fractionation factor (1 = no fractionation) for C13 - integer , intent(in) :: num ! number of filter members - integer , intent(in) :: filter(:) ! filter indices - integer , intent(in) :: diag ! 0=no diagnostics, 1=print diagnostics - character(len=*) , intent(in) :: isotope ! 'c13' or 'c14' - ! - ! ! LOCAL VARIABLES: - integer :: i,f ! indices - real(r8) :: temp - real(r8) :: frax - !----------------------------------------------------------------------- - - ! if C14, double the fractionation - select case (isotope) - case ('c14') - frax = 1._r8 + (1._r8 - frax_c13) * 2._r8 - case ('c13') - frax = frax_c13 - case default - call endrun(msg='CNCIsoFluxMod: iso must be either c13 or c14'//errMsg(sourcefile, __LINE__)) - end select - - ! loop over the supplied filter - do f = 1,num - i = filter(f) - if (ctot_state(i) /= 0._r8 .and. ciso_state(i) /= 0._r8) then - ciso_flux(i) = ctot_flux(i) * (ciso_state(i)/ctot_state(i)) * frax - else - ciso_flux(i) = 0._r8 - end if - - if (diag == 1) then - ! put diagnostic print statements here for isoC flux calculations - end if - end do - - end subroutine CIsoFluxCalc - -end module CNCIsoFluxMod diff --git a/src/biogeochem/CNCStateUpdate1Mod.F90 b/src/biogeochem/CNCStateUpdate1Mod.F90 deleted file mode 100644 index ac7cb89162..0000000000 --- a/src/biogeochem/CNCStateUpdate1Mod.F90 +++ /dev/null @@ -1,497 +0,0 @@ -module CNCStateUpdate1Mod - - !----------------------------------------------------------------------- - ! Module for carbon state variable update, non-mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, nlevdecomp - use clm_time_manager , only : get_step_size, get_step_size_real - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use pftconMod , only : npcropmin, nc3crop, pftcon - use abortutils , only : endrun - use decompMod , only : bounds_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CropType , only : crop_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use PatchType , only : patch - use clm_varctl , only : use_fates, use_cn, iulog - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CStateUpdateDynPatch - public :: CStateUpdate0 - public :: CStateUpdate1 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CStateUpdateDynPatch(bounds, num_soilc_with_inactive, filter_soilc_with_inactive, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Update carbon states based on fluxes from dyn_cnbal_patch - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_soilc_with_inactive ! number of columns in soil filter - integer, intent(in) :: filter_soilc_with_inactive(:) ! soil column filter that includes inactive points - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c ! column index - integer :: fc ! column filter index - integer :: g ! gridcell index - integer :: j ! level index - real(r8) :: dt ! time step (seconds) - - character(len=*), parameter :: subname = 'CStateUpdateDynPatch' - !----------------------------------------------------------------------- - - associate( & - cf_veg => cnveg_carbonflux_inst , & - cs_veg => cnveg_carbonstate_inst , & - cs_soil => soilbiogeochem_carbonstate_inst & - ) - - dt = get_step_size_real() - - if (.not. use_fates) then - do j = 1,nlevdecomp - do fc = 1, num_soilc_with_inactive - c = filter_soilc_with_inactive(fc) - cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) = cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) + & - cf_veg%dwt_frootc_to_litr_met_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) = cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) + & - cf_veg%dwt_frootc_to_litr_cel_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) = cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) + & - cf_veg%dwt_frootc_to_litr_lig_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_cwd) = cs_soil%decomp_cpools_vr_col(c,j,i_cwd) + & - ( cf_veg%dwt_livecrootc_to_cwdc_col(c,j) + cf_veg%dwt_deadcrootc_to_cwdc_col(c,j) ) * dt - end do - end do - - do g = bounds%begg, bounds%endg - cs_veg%seedc_grc(g) = cs_veg%seedc_grc(g) - cf_veg%dwt_seedc_to_leaf_grc(g) * dt - cs_veg%seedc_grc(g) = cs_veg%seedc_grc(g) - cf_veg%dwt_seedc_to_deadstem_grc(g) * dt - end do - - end if - - ! TODO(wjs, 2017-01-02) Do we need to move some of the FATES fluxes into here (from - ! CStateUpdate1) if use_fates is true? Specifically, some portion or all of the fluxes - ! from these updates in CStateUpdate1: - ! cf_soil%decomp_cpools_sourcesink_col(c,j,i_met_lit) = cf_soil%FATES_c_to_litr_lab_c_col(c,j) * dt - ! cf_soil%decomp_cpools_sourcesink_col(c,j,i_cel_lit) = cf_soil%FATES_c_to_litr_cel_c_col(c,j) * dt - ! cf_soil%decomp_cpools_sourcesink_col(c,j,i_lig_lit) = cf_soil%FATES_c_to_litr_lig_c_col(c,j) * dt - - end associate - - end subroutine CStateUpdateDynPatch - - !----------------------------------------------------------------------- - subroutine CStateUpdate0(num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update cpool carbon state - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - cf_veg => cnveg_carbonflux_inst , & - cs_veg => cnveg_carbonstate_inst & - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - - - ! gross photosynthesis fluxes - do fp = 1,num_soilp - p = filter_soilp(fp) - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) + cf_veg%psnsun_to_cpool_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) + cf_veg%psnshade_to_cpool_patch(p)*dt - end do - - - end associate - - end subroutine CStateUpdate0 - - !----------------------------------------------------------------------- - subroutine CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & - crop_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic carbon state - ! variables (except for gap-phase mortality and fire fluxes) - ! - use clm_varctl, only : carbon_resp_opt - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns 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(crop_type) , intent(in) :: crop_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst ! See note below for xsmrpool_to_atm_patch - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,k,l ! indices - integer :: fp,fc ! filter indices - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: check_cpool - real(r8) :: cpool_delta - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step - - harvdate => crop_inst%harvdate_patch , & ! Input: [integer (:) ] harvest date - - cf_veg => cnveg_carbonflux_inst , & ! Output: - cs_veg => cnveg_carbonstate_inst , & ! Output: - cf_soil => soilbiogeochem_carbonflux_inst & ! Output: - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! Below is the input into the soil biogeochemistry model - - ! plant to litter fluxes - if (.not. use_fates) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! phenology and dynamic land cover fluxes - cf_soil%decomp_cpools_sourcesink_col(c,j,i_met_lit) = & - cf_veg%phenology_c_to_litr_met_c_col(c,j) *dt - cf_soil%decomp_cpools_sourcesink_col(c,j,i_cel_lit) = & - cf_veg%phenology_c_to_litr_cel_c_col(c,j) *dt - cf_soil%decomp_cpools_sourcesink_col(c,j,i_lig_lit) = & - cf_veg%phenology_c_to_litr_lig_c_col(c,j) *dt - - ! NOTE(wjs, 2017-01-02) This used to be set to a non-zero value, but the - ! terms have been moved to CStateUpdateDynPatch. I think this is zeroed every - ! time step, but to be safe, I'm explicitly setting it to zero here. - cf_soil%decomp_cpools_sourcesink_col(c,j,i_cwd) = 0._r8 - end do - end do - else !use_fates - ! here add all fates litterfall and CWD breakdown to litter fluxes - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! TODO(wjs, 2017-01-02) Should some portion or all of the following fluxes - ! be moved to the updates in CStateUpdateDynPatch? - cf_soil%decomp_cpools_sourcesink_col(c,j,i_met_lit) = cf_soil%FATES_c_to_litr_lab_c_col(c,j) * dt - cf_soil%decomp_cpools_sourcesink_col(c,j,i_cel_lit) = cf_soil%FATES_c_to_litr_cel_c_col(c,j) * dt - cf_soil%decomp_cpools_sourcesink_col(c,j,i_lig_lit) = cf_soil%FATES_c_to_litr_lig_c_col(c,j) * dt - end do - end do - endif - - ! litter and SOM HR fluxes - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cf_soil%decomp_cpools_sourcesink_col(c,j,cascade_donor_pool(k)) = & - cf_soil%decomp_cpools_sourcesink_col(c,j,cascade_donor_pool(k)) & - - ( cf_soil%decomp_cascade_hr_vr_col(c,j,k) + cf_soil%decomp_cascade_ctransfer_vr_col(c,j,k)) *dt - end do - end do - end do - do k = 1, ndecomp_cascade_transitions - if ( cascade_receiver_pool(k) /= 0 ) then ! skip terminal transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cf_soil%decomp_cpools_sourcesink_col(c,j,cascade_receiver_pool(k)) = & - cf_soil%decomp_cpools_sourcesink_col(c,j,cascade_receiver_pool(k)) & - + cf_soil%decomp_cascade_ctransfer_vr_col(c,j,k)*dt - end do - end do - end if - end do - - if (.not. use_fates) then - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! phenology: transfer growth fluxes - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) + cf_veg%leafc_xfer_to_leafc_patch(p)*dt - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) - cf_veg%leafc_xfer_to_leafc_patch(p)*dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) + cf_veg%frootc_xfer_to_frootc_patch(p)*dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) - cf_veg%frootc_xfer_to_frootc_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%deadstemc_xfer_to_deadstemc_patch(p)*dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) - cf_veg%deadstemc_xfer_to_deadstemc_patch(p)*dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) + cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) - cf_veg%livecrootc_xfer_to_livecrootc_patch(p)*dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - cf_veg%deadcrootc_xfer_to_deadcrootc_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - cf_veg%livestemc_xfer_to_livestemc_patch(p)*dt - cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) + cf_veg%grainc_xfer_to_grainc_patch(p)*dt - cs_veg%grainc_xfer_patch(p) = cs_veg%grainc_xfer_patch(p) - cf_veg%grainc_xfer_to_grainc_patch(p)*dt - end if - - ! phenology: litterfall fluxes - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - cf_veg%leafc_to_litter_patch(p)*dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - cf_veg%frootc_to_litter_patch(p)*dt - - - - - ! livewood turnover fluxes - if (woody(ivt(p)) == 1._r8) then - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_deadstemc_patch(p)*dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%livestemc_to_deadstemc_patch(p)*dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) - cf_veg%livecrootc_to_deadcrootc_patch(p)*dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%livecrootc_to_deadcrootc_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - cf_veg%livestemc_to_litter_patch(p)*dt - cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) & - - (cf_veg%grainc_to_food_patch(p) + cf_veg%grainc_to_seed_patch(p))*dt - cs_veg%cropseedc_deficit_patch(p) = cs_veg%cropseedc_deficit_patch(p) & - - cf_veg%crop_seedc_to_leaf_patch(p) * dt & - + cf_veg%grainc_to_seed_patch(p) * dt - end if - - check_cpool = cs_veg%cpool_patch(p)- cf_veg%psnsun_to_cpool_patch(p)*dt-cf_veg%psnshade_to_cpool_patch(p)*dt - cpool_delta = cs_veg%cpool_patch(p) - - ! maintenance respiration fluxes from cpool - - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_xsmrpool_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%leaf_curmr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%froot_curmr_patch(p)*dt - If (woody(ivt(p)) == 1._r8) then - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livecroot_curmr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%livestem_curmr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%grain_curmr_patch(p)*dt - end if - - - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_resp_patch(p)*dt - - !RF Add in the carbon spent on uptake respiration. - cs_veg%cpool_patch(p)= cs_veg%cpool_patch(p) - cf_veg%soilc_change_patch(p)*dt - - ! maintenance respiration fluxes from xsmrpool - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) + cf_veg%cpool_to_xsmrpool_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%leaf_xsmr_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%froot_xsmr_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livecroot_xsmr_patch(p)*dt - end if - - ! allocation fluxes - if (carbon_resp_opt == 1) then - cf_veg%cpool_to_leafc_patch(p) = cf_veg%cpool_to_leafc_patch(p) - cf_veg%cpool_to_leafc_resp_patch(p) - cf_veg%cpool_to_leafc_storage_patch(p) = cf_veg%cpool_to_leafc_storage_patch(p) - & - cf_veg%cpool_to_leafc_storage_resp_patch(p) - cf_veg%cpool_to_frootc_patch(p) = cf_veg%cpool_to_frootc_patch(p) - cf_veg%cpool_to_frootc_resp_patch(p) - cf_veg%cpool_to_frootc_storage_patch(p) = cf_veg%cpool_to_frootc_storage_patch(p) & - - cf_veg%cpool_to_frootc_storage_resp_patch(p) - end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_leafc_patch(p)*dt - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) + cf_veg%cpool_to_leafc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_leafc_storage_patch(p)*dt - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) + cf_veg%cpool_to_leafc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_frootc_patch(p)*dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) + cf_veg%cpool_to_frootc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_frootc_storage_patch(p)*dt - - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) + cf_veg%cpool_to_frootc_storage_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - if (carbon_resp_opt == 1) then - cf_veg%cpool_to_livecrootc_patch(p) = cf_veg%cpool_to_livecrootc_patch(p) - cf_veg%cpool_to_livecrootc_resp_patch(p) - cf_veg%cpool_to_livecrootc_storage_patch(p) = cf_veg%cpool_to_livecrootc_storage_patch(p) - & - cf_veg%cpool_to_livecrootc_storage_resp_patch(p) - cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - & - cf_veg%cpool_to_livestemc_storage_resp_patch(p) - end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadstemc_patch(p)*dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) + cf_veg%cpool_to_deadstemc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadstemc_storage_patch(p)*dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) + cf_veg%cpool_to_deadstemc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livecrootc_patch(p)*dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) + cf_veg%cpool_to_livecrootc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livecrootc_storage_patch(p)*dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) + cf_veg%cpool_to_livecrootc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadcrootc_patch(p)*dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) + cf_veg%cpool_to_deadcrootc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) + cf_veg%cpool_to_deadcrootc_storage_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - if (carbon_resp_opt == 1) then - cf_veg%cpool_to_livestemc_patch(p) = cf_veg%cpool_to_livestemc_patch(p) - cf_veg%cpool_to_livestemc_resp_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p) = cf_veg%cpool_to_livestemc_storage_patch(p) - & - cf_veg%cpool_to_livestemc_storage_resp_patch(p) - end if - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) + cf_veg%cpool_to_livestemc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) + cf_veg%cpool_to_livestemc_storage_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_grainc_patch(p)*dt - cs_veg%grainc_patch(p) = cs_veg%grainc_patch(p) + cf_veg%cpool_to_grainc_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_grainc_storage_patch(p)*dt - cs_veg%grainc_storage_patch(p) = cs_veg%grainc_storage_patch(p) + cf_veg%cpool_to_grainc_storage_patch(p)*dt - end if - - ! growth respiration fluxes for current growth - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_leaf_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_froot_gr_patch(p)*dt - - if (woody(ivt(p)) == 1._r8) then - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadstem_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_gr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_grain_gr_patch(p)*dt - end if - - ! growth respiration for transfer growth - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_leaf_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_froot_gr_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadstem_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livecroot_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_deadcroot_gr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_livestem_gr_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - cf_veg%transfer_grain_gr_patch(p)*dt - end if - - ! growth respiration at time of storage - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_leaf_storage_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_froot_storage_gr_patch(p)*dt - - if (woody(ivt(p)) == 1._r8) then - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_storage_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadstem_storage_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livecroot_storage_gr_patch(p)*dt - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_deadcroot_storage_gr_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_livestem_storage_gr_patch(p)*dt - - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_grain_storage_gr_patch(p)*dt - - end if - - ! growth respiration stored for release during transfer growth - cs_veg%cpool_patch(p) = cs_veg%cpool_patch(p) - cf_veg%cpool_to_gresp_storage_patch(p)*dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) + cf_veg%cpool_to_gresp_storage_patch(p)*dt - - ! move storage pools into transfer pools - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) - cf_veg%leafc_storage_to_xfer_patch(p)*dt - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) + cf_veg%leafc_storage_to_xfer_patch(p)*dt - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) - cf_veg%frootc_storage_to_xfer_patch(p)*dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) + cf_veg%frootc_storage_to_xfer_patch(p)*dt - if (woody(ivt(p)) == 1._r8) then - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) + cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) - cf_veg%deadstemc_storage_to_xfer_patch(p)*dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) + cf_veg%deadstemc_storage_to_xfer_patch(p)*dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p)- cf_veg%livecrootc_storage_to_xfer_patch(p)*dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) + cf_veg%livecrootc_storage_to_xfer_patch(p)*dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p)- cf_veg%deadcrootc_storage_to_xfer_patch(p)*dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) + cf_veg%deadcrootc_storage_to_xfer_patch(p)*dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) - cf_veg%gresp_storage_to_xfer_patch(p)*dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) + cf_veg%gresp_storage_to_xfer_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) + cf_veg%livestemc_storage_to_xfer_patch(p)*dt - cs_veg%grainc_storage_patch(p) = cs_veg%grainc_storage_patch(p) - cf_veg%grainc_storage_to_xfer_patch(p)*dt - cs_veg%grainc_xfer_patch(p) = cs_veg%grainc_xfer_patch(p) + cf_veg%grainc_storage_to_xfer_patch(p)*dt - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%livestem_xsmr_patch(p)*dt - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) - cf_veg%grain_xsmr_patch(p)*dt - if (harvdate(p) < 999) then ! beginning at harvest, send to atm - ! TODO (mv, 11-02-2014) the following lines are why the cf_veg is - ! an intent(inout) - ! fluxes should not be updated in this module - not sure where - ! this belongs - ! DML (06-20-2017) While debugging crop isotope code, found that cpool_patch and frootc_patch - ! could occasionally be very small but nonzero numbers after crop harvest, which persists - ! through to next planting and for reasons that could not 100% - ! isolate, caused C12/C13 ratios to occasionally go out of - ! bounds. Zeroing out these small pools and putting them into the flux to the - ! atmosphere solved many of the crop isotope problems - - cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%xsmrpool_patch(p)/dt - cs_veg%xsmrpool_patch(p) = 0._r8 - cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%cpool_patch(p)/dt - cs_veg%cpool_patch(p) = 0._r8 - cf_veg%xsmrpool_to_atm_patch(p) = cf_veg%xsmrpool_to_atm_patch(p) + cs_veg%frootc_patch(p)/dt - cs_veg%frootc_patch(p) = 0._r8 - end if - end if - - - end do ! end of patch loop - end if - - end associate - - end subroutine CStateUpdate1 - -end module CNCStateUpdate1Mod diff --git a/src/biogeochem/CNCStateUpdate2Mod.F90 b/src/biogeochem/CNCStateUpdate2Mod.F90 deleted file mode 100644 index ef1f6f9345..0000000000 --- a/src/biogeochem/CNCStateUpdate2Mod.F90 +++ /dev/null @@ -1,247 +0,0 @@ -module CNCStateUpdate2Mod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for carbon state variable update, mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevdecomp, i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use CNvegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use SoilBiogeochemCarbonStatetype , only : soilbiogeochem_carbonstate_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: CStateUpdate2 - public:: CStateUpdate2h - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic carbon state - ! variables affected by gap-phase mortality fluxes - ! - ! !ARGUMENTS: - 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(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c ,p,j ! indices - integer :: fp,fc ! lake filter indices - real(r8) :: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - cf_veg => cnveg_carbonflux_inst , & - cs_veg => cnveg_carbonstate_inst , & - - cs_soil => soilbiogeochem_carbonstate_inst & - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column level carbon fluxes from gap-phase mortality - do j = 1,nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column gap mortality fluxes - cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) = & - cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) + cf_veg%gap_mortality_c_to_litr_met_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) = & - cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) + cf_veg%gap_mortality_c_to_litr_cel_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) = & - cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) + cf_veg%gap_mortality_c_to_litr_lig_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_cwd) = & - cs_soil%decomp_cpools_vr_col(c,j,i_cwd) + cf_veg%gap_mortality_c_to_cwdc_col(c,j) * dt - - end do - end do - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! patch-level carbon fluxes from gap-phase mortality - ! displayed pools - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) & - - cf_veg%m_leafc_to_litter_patch(p) * dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) & - - cf_veg%m_frootc_to_litter_patch(p) * dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) & - - cf_veg%m_livestemc_to_litter_patch(p) * dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) & - - cf_veg%m_deadstemc_to_litter_patch(p) * dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) & - - cf_veg%m_livecrootc_to_litter_patch(p) * dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) & - - cf_veg%m_deadcrootc_to_litter_patch(p) * dt - - ! storage pools - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) & - - cf_veg%m_leafc_storage_to_litter_patch(p) * dt - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) & - - cf_veg%m_frootc_storage_to_litter_patch(p) * dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) & - - cf_veg%m_livestemc_storage_to_litter_patch(p) * dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) & - - cf_veg%m_deadstemc_storage_to_litter_patch(p) * dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) & - - cf_veg%m_livecrootc_storage_to_litter_patch(p) * dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) & - - cf_veg%m_deadcrootc_storage_to_litter_patch(p) * dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) & - - cf_veg%m_gresp_storage_to_litter_patch(p) * dt - - ! transfer pools - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) & - - cf_veg%m_leafc_xfer_to_litter_patch(p) * dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) & - - cf_veg%m_frootc_xfer_to_litter_patch(p) * dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) & - - cf_veg%m_livestemc_xfer_to_litter_patch(p) * dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) & - - cf_veg%m_deadstemc_xfer_to_litter_patch(p) * dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) & - - cf_veg%m_livecrootc_xfer_to_litter_patch(p) * dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) & - - cf_veg%m_deadcrootc_xfer_to_litter_patch(p) * dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) & - - cf_veg%m_gresp_xfer_to_litter_patch(p) * dt - end do ! end of patch loop - - end associate - - end subroutine CStateUpdate2 - - !----------------------------------------------------------------------- - subroutine CStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Update all the prognostic carbon state - ! variables affected by harvest mortality fluxes - ! - ! !ARGUMENTS: - 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(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,k,l ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - cf_veg => cnveg_carbonflux_inst , & - cs_veg => cnveg_carbonstate_inst , & - cs_soil => soilbiogeochem_carbonstate_inst & - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column level carbon fluxes from harvest mortality - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column harvest fluxes - cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) = & - cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) + cf_veg%harvest_c_to_litr_met_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) = & - cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) + cf_veg%harvest_c_to_litr_cel_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) = & - cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) + cf_veg%harvest_c_to_litr_lig_c_col(c,j) * dt - cs_soil%decomp_cpools_vr_col(c,j,i_cwd) = & - cs_soil%decomp_cpools_vr_col(c,j,i_cwd) + cf_veg%harvest_c_to_cwdc_col(c,j) * dt - - ! wood to product pools - states updated in CNProducts - end do - end do - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! patch-level carbon fluxes from harvest mortality - ! displayed pools - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) & - - cf_veg%hrv_leafc_to_litter_patch(p) * dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) & - - cf_veg%hrv_frootc_to_litter_patch(p) * dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) & - - cf_veg%hrv_livestemc_to_litter_patch(p) * dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) & - - cf_veg%wood_harvestc_patch(p) * dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) & - - cf_veg%hrv_livecrootc_to_litter_patch(p) * dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) & - - cf_veg%hrv_deadcrootc_to_litter_patch(p) * dt - - ! xsmrpool - cs_veg%xsmrpool_patch(p) = cs_veg%xsmrpool_patch(p) & - - cf_veg%hrv_xsmrpool_to_atm_patch(p) * dt - - ! storage pools - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) & - - cf_veg%hrv_leafc_storage_to_litter_patch(p) * dt - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) & - - cf_veg%hrv_frootc_storage_to_litter_patch(p) * dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) & - - cf_veg%hrv_livestemc_storage_to_litter_patch(p) * dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) & - - cf_veg%hrv_deadstemc_storage_to_litter_patch(p) * dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) & - - cf_veg%hrv_livecrootc_storage_to_litter_patch(p) * dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) & - - cf_veg%hrv_deadcrootc_storage_to_litter_patch(p) * dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) & - - cf_veg%hrv_gresp_storage_to_litter_patch(p) * dt - - ! transfer pools - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) & - - cf_veg%hrv_leafc_xfer_to_litter_patch(p) * dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) & - - cf_veg%hrv_frootc_xfer_to_litter_patch(p) * dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) & - - cf_veg%hrv_livestemc_xfer_to_litter_patch(p) * dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) & - - cf_veg%hrv_deadstemc_xfer_to_litter_patch(p) * dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) & - - cf_veg%hrv_livecrootc_xfer_to_litter_patch(p) * dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) & - - cf_veg%hrv_deadcrootc_xfer_to_litter_patch(p) * dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) & - - cf_veg%hrv_gresp_xfer_to_litter_patch(p) * dt - - end do ! end of patch loop - - end associate - - end subroutine CStateUpdate2h - -end module CNCStateUpdate2Mod diff --git a/src/biogeochem/CNCStateUpdate3Mod.F90 b/src/biogeochem/CNCStateUpdate3Mod.F90 deleted file mode 100644 index 422c56f75e..0000000000 --- a/src/biogeochem/CNCStateUpdate3Mod.F90 +++ /dev/null @@ -1,187 +0,0 @@ -module CNCStateUpdate3Mod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for carbon state variable update, mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevdecomp, ndecomp_pools, i_cwd, i_met_lit, i_cel_lit, i_lig_lit - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: CStateUpdate3 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CStateUpdate3( num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic carbon state - ! variables affected by fire fluxes - ! - ! !ARGUMENTS: - 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(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,l,k ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - cf_veg => cnveg_carbonflux_inst , & ! Input - cs_veg => cnveg_carbonstate_inst, & ! Output - cs_soil => soilbiogeochem_carbonstate_inst & ! Output - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column level carbon fluxes from fire - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! patch-level wood to column-level CWD (uncombusted wood) - cs_soil%decomp_cpools_vr_col(c,j,i_cwd) = cs_soil%decomp_cpools_vr_col(c,j,i_cwd) + & - cf_veg%fire_mortality_c_to_cwdc_col(c,j) * dt - - ! patch-level wood to column-level litter (uncombusted wood) - cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) = cs_soil%decomp_cpools_vr_col(c,j,i_met_lit) + & - cf_veg%m_c_to_litr_met_fire_col(c,j)* dt - cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) = cs_soil%decomp_cpools_vr_col(c,j,i_cel_lit) + & - cf_veg%m_c_to_litr_cel_fire_col(c,j)* dt - cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) = cs_soil%decomp_cpools_vr_col(c,j,i_lig_lit) + & - cf_veg%m_c_to_litr_lig_fire_col(c,j)* dt - end do - end do - - ! litter and CWD losses to fire - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cs_soil%decomp_cpools_vr_col(c,j,l) = cs_soil%decomp_cpools_vr_col(c,j,l) - & - cf_veg%m_decomp_cpools_to_fire_vr_col(c,j,l) * dt - end do - end do - end do - - ! patch-level carbon fluxes from fire - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! displayed pools - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - & - cf_veg%m_leafc_to_fire_patch(p) * dt - cs_veg%leafc_patch(p) = cs_veg%leafc_patch(p) - & - cf_veg%m_leafc_to_litter_fire_patch(p) * dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - & - cf_veg%m_frootc_to_fire_patch(p) * dt - cs_veg%frootc_patch(p) = cs_veg%frootc_patch(p) - & - cf_veg%m_frootc_to_litter_fire_patch(p) * dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - & - cf_veg%m_livestemc_to_fire_patch(p) * dt - cs_veg%livestemc_patch(p) = cs_veg%livestemc_patch(p) - & - cf_veg%m_livestemc_to_litter_fire_patch(p) * dt - & - cf_veg%m_livestemc_to_deadstemc_fire_patch(p) * dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) - & - cf_veg%m_deadstemc_to_fire_patch(p) * dt - cs_veg%deadstemc_patch(p) = cs_veg%deadstemc_patch(p) - & - cf_veg%m_deadstemc_to_litter_fire_patch(p) * dt + & - cf_veg%m_livestemc_to_deadstemc_fire_patch(p) * dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) - & - cf_veg%m_livecrootc_to_fire_patch(p) * dt - cs_veg%livecrootc_patch(p) = cs_veg%livecrootc_patch(p) - & - cf_veg%m_livecrootc_to_litter_fire_patch(p) * dt - & - cf_veg%m_livecrootc_to_deadcrootc_fire_patch(p) * dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) - & - cf_veg%m_deadcrootc_to_fire_patch(p) * dt - cs_veg%deadcrootc_patch(p) = cs_veg%deadcrootc_patch(p) - & - cf_veg%m_deadcrootc_to_litter_fire_patch(p)* dt + & - cf_veg%m_livecrootc_to_deadcrootc_fire_patch(p) * dt - - ! storage pools - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) - & - cf_veg%m_leafc_storage_to_fire_patch(p) * dt - cs_veg%leafc_storage_patch(p) = cs_veg%leafc_storage_patch(p) - & - cf_veg%m_leafc_storage_to_litter_fire_patch(p) * dt - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) - & - cf_veg%m_frootc_storage_to_fire_patch(p) * dt - cs_veg%frootc_storage_patch(p) = cs_veg%frootc_storage_patch(p) - & - cf_veg%m_frootc_storage_to_litter_fire_patch(p) * dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - & - cf_veg%m_livestemc_storage_to_fire_patch(p) * dt - cs_veg%livestemc_storage_patch(p) = cs_veg%livestemc_storage_patch(p) - & - cf_veg%m_livestemc_storage_to_litter_fire_patch(p) * dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) - & - cf_veg%m_deadstemc_storage_to_fire_patch(p) * dt - cs_veg%deadstemc_storage_patch(p) = cs_veg%deadstemc_storage_patch(p) - & - cf_veg%m_deadstemc_storage_to_litter_fire_patch(p) * dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) - & - cf_veg%m_livecrootc_storage_to_fire_patch(p) * dt - cs_veg%livecrootc_storage_patch(p) = cs_veg%livecrootc_storage_patch(p) - & - cf_veg%m_livecrootc_storage_to_litter_fire_patch(p)* dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) - & - cf_veg%m_deadcrootc_storage_to_fire_patch(p) * dt - cs_veg%deadcrootc_storage_patch(p) = cs_veg%deadcrootc_storage_patch(p) - & - cf_veg%m_deadcrootc_storage_to_litter_fire_patch(p)* dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) - & - cf_veg%m_gresp_storage_to_fire_patch(p) * dt - cs_veg%gresp_storage_patch(p) = cs_veg%gresp_storage_patch(p) - & - cf_veg%m_gresp_storage_to_litter_fire_patch(p) * dt - - ! transfer pools - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) - & - cf_veg%m_leafc_xfer_to_fire_patch(p) * dt - cs_veg%leafc_xfer_patch(p) = cs_veg%leafc_xfer_patch(p) - & - cf_veg%m_leafc_xfer_to_litter_fire_patch(p) * dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) - & - cf_veg%m_frootc_xfer_to_fire_patch(p) * dt - cs_veg%frootc_xfer_patch(p) = cs_veg%frootc_xfer_patch(p) - & - cf_veg%m_frootc_xfer_to_litter_fire_patch(p) * dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - & - cf_veg%m_livestemc_xfer_to_fire_patch(p) * dt - cs_veg%livestemc_xfer_patch(p) = cs_veg%livestemc_xfer_patch(p) - & - cf_veg%m_livestemc_xfer_to_litter_fire_patch(p) * dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) - & - cf_veg%m_deadstemc_xfer_to_fire_patch(p) * dt - cs_veg%deadstemc_xfer_patch(p) = cs_veg%deadstemc_xfer_patch(p) - & - cf_veg%m_deadstemc_xfer_to_litter_fire_patch(p) * dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) - & - cf_veg%m_livecrootc_xfer_to_fire_patch(p) * dt - cs_veg%livecrootc_xfer_patch(p) = cs_veg%livecrootc_xfer_patch(p) - & - cf_veg%m_livecrootc_xfer_to_litter_fire_patch(p)* dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - & - cf_veg%m_deadcrootc_xfer_to_fire_patch(p) * dt - cs_veg%deadcrootc_xfer_patch(p) = cs_veg%deadcrootc_xfer_patch(p) - & - cf_veg%m_deadcrootc_xfer_to_litter_fire_patch(p)* dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - & - cf_veg%m_gresp_xfer_to_fire_patch(p) * dt - cs_veg%gresp_xfer_patch(p) = cs_veg%gresp_xfer_patch(p) - & - cf_veg%m_gresp_xfer_to_litter_fire_patch(p) * dt - - end do ! end of patch loop - - end associate - - end subroutine CStateUpdate3 - -end module CNCStateUpdate3Mod diff --git a/src/biogeochem/CNDVDriverMod.F90 b/src/biogeochem/CNDVDriverMod.F90 deleted file mode 100644 index c188d34004..0000000000 --- a/src/biogeochem/CNDVDriverMod.F90 +++ /dev/null @@ -1,467 +0,0 @@ -module CNDVDriverMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Note that this module was created simply to contain the subroutine dv - ! which cannot cannot be in CNDVMod due to circular dependencies - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use CNDVType , only : dgvs_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use clm_varcon , only : grlnd - use LandunitType , only : lun - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNDVDriver - public :: CNDVHist - ! - ! !PRIVATE MEMBER FUNCTIONS: - private set_dgvm_filename - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNDVDriver(bounds, & - num_natvegp, filter_natvegp, kyr, & - atm2lnd_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, dgvs_inst) - ! - ! !DESCRIPTION: - ! Drives the annual dynamic vegetation that works with CN - ! - ! !USES: - use CNDVLightMod , only : Light - use CNDVEstablishmentMod , only : Establishment - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(inout) :: num_natvegp ! number of naturally-vegetated patches in filter - integer , intent(inout) :: filter_natvegp(:) ! filter for naturally-vegetated patches - integer , intent(in) :: kyr ! used in routine climate20 below - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - !----------------------------------------------------------------------- - - associate( & - fpcgrid => dgvs_inst%fpcgrid_patch , & ! Input: [real(r8) (:) ] foliar projective cover on gridcell (fraction) - agdd20 => dgvs_inst%agdd20_patch , & ! Output: [real(r8) (:) ] 20-yr running mean of agdd - tmomin20 => dgvs_inst%tmomin20_patch , & ! Output: [real(r8) (:) ] 20-yr running mean of tmomin - agdd => dgvs_inst%agdd_patch , & ! Input: [real(r8) (:) ] accumulated growing degree days above 5 - - t_mo_min => atm2lnd_inst%t_mo_min_patch , & ! Output: [real(r8) (:) ] annual min of t_mo (Kelvin) - - leafcmax => cnveg_carbonstate_inst%leafcmax_patch & ! Output: [real(r8) (:) ] (gC/m2) ann max leaf C - ) - - ! ************************************************************************* - ! S. Levis version of LPJ's routine climate20: 'Returns' tmomin20 & agdd20 - ! for use in routine bioclim, which I have placed in routine Establishment - ! Instead of 20-yr running mean of coldest monthly temperature, - ! use 20-yr running mean of minimum 10-day running mean - ! ************************************************************************* - - do p = bounds%begp, bounds%endp - if (kyr == 2) then ! slevis: add ".and. start_type==arb_ic" here? - tmomin20(p) = t_mo_min(p) ! NO, b/c want to be able to start dgvm - agdd20(p) = agdd(p) ! w/ clmi file from non-dgvm simulation - end if - tmomin20(p) = (19._r8 * tmomin20(p) + t_mo_min(p)) / 20._r8 - agdd20(p) = (19._r8 * agdd20(p) + agdd(p) ) / 20._r8 - end do - - ! Rebuild filter of present natually-vegetated patches after Kill() - - num_natvegp = 0 - do p = bounds%begp,bounds%endp - if (dgvs_inst%present_patch(p)) then - num_natvegp = num_natvegp + 1 - filter_natvegp(num_natvegp) = p - end if - end do - - ! Returns fpcgrid and nind - - call Light(bounds, num_natvegp, filter_natvegp, & - cnveg_carbonstate_inst, dgvs_inst) - - ! Returns updated fpcgrid, nind, crownarea, and present. Due to updated - ! present, we do not use the natveg filter in this subroutine. - - call Establishment(bounds, & - atm2lnd_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, dgvs_inst) - - ! Reset dgvm variables needed in next yr (too few to keep subr. dvreset) - - do p = bounds%begp,bounds%endp - leafcmax(p) = 0._r8 - t_mo_min(p) = 1.0e+36_r8 - end do - - end associate - - end subroutine CNDVDriver - - !----------------------------------------------------------------------- - subroutine CNDVHist(bounds, dgvs_inst) - ! - ! !DESCRIPTION: - ! Write CNDV history file - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_CDAY - use shr_sys_mod , only : shr_sys_getenv - use clm_varpar , only : maxpatch_pft - use clm_varctl , only : caseid, ctitle, finidat, fsurdat, paramfile, iulog - use clm_varcon , only : spval - use clm_time_manager, only : get_ref_date, get_nstep, get_curr_date, get_curr_time - use domainMod , only : ldomain - use fileutils , only : get_filename - use spmdMod , only : masterproc - use ncdio_pio - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(dgvs_type) , intent(in) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - character(len=256) :: dgvm_fn ! dgvm history filename - type(file_desc_t) :: ncid ! netcdf file id - integer :: ncprec ! output precision - integer :: g,p,l ! indices - integer :: ier ! error status - integer :: mdcur, mscur, mcdate ! outputs from get_curr_time - integer :: yr,mon,day,mcsec ! outputs from get_curr_date - integer :: hours,minutes,secs ! hours,minutes,seconds of hh:mm:ss - integer :: nstep ! time step - integer :: nbsec ! seconds components of a date - integer :: dimid ! dimension, variable id - real(r8):: time ! current time - character(len=256) :: str ! temporary string - character(len= 8) :: curdate ! current date - character(len= 8) :: curtime ! current time - character(len= 10) :: basedate ! base date (yyyymmdd) - character(len= 8) :: basesec ! base seconds - real(r8) , pointer :: rbuf2dg (:,:) ! Input: [real(r8) (:,:)] temporary - !----------------------------------------------------------------------- - - associate(& - fpcgrid => dgvs_inst%fpcgrid_patch , & ! Input: [real(r8) (:)] foliar projective cover on gridcell (fraction) - nind => dgvs_inst%nind_patch & ! Input: [real(r8) (:)] number of individuals (#/m**2) - ) - - allocate(rbuf2dg(bounds%begg:bounds%endg,maxpatch_pft), stat=ier) - if (ier /= 0) call endrun(msg='histCNDV: allocation error for rbuf2dg'//& - errMsg(sourcefile, __LINE__)) - - ! Set output precision - - ncprec = ncd_double - - ! ----------------------------------------------------------------------- - ! Create new netCDF file. File will be in define mode - ! ----------------------------------------------------------------------- - - dgvm_fn = set_dgvm_filename() - call ncd_pio_createfile(ncid, trim(dgvm_fn)) - - ! ----------------------------------------------------------------------- - ! Create global attributes. - ! ----------------------------------------------------------------------- - - str = 'CF1.0' - call ncd_putatt (ncid, ncd_global, 'conventions', trim(str)) - - call getdatetime(curdate, curtime) - str = 'created on ' // curdate // ' ' // curtime - call ncd_putatt(ncid, ncd_global,'history', trim(str)) - - call shr_sys_getenv('LOGNAME', str, ier) - if (ier /= 0) call endrun(msg='error: LOGNAME environment variable not defined'//& - errMsg(sourcefile, __LINE__)) - - call ncd_putatt (ncid, ncd_global, 'logname', trim(str)) - - call shr_sys_getenv('HOST', str, ier) - call ncd_putatt (ncid, ncd_global, 'host', trim(str)) - - str = 'Community Land Model: CLM3' - call ncd_putatt (ncid, ncd_global, 'source', trim(str)) - - str = '$Name$' - call ncd_putatt (ncid, ncd_global, 'version', trim(str)) - - str = '$Id$' - call ncd_putatt (ncid, ncd_global, 'revision_id', trim(str)) - - str = ctitle - call ncd_putatt (ncid, ncd_global, 'case_title', trim(str)) - - str = caseid - call ncd_putatt (ncid, ncd_global, 'case_id', trim(str)) - - str = get_filename(fsurdat) - call ncd_putatt(ncid, ncd_global, 'Surface_dataset', trim(str)) - - str = 'arbitrary initialization' - if (finidat /= ' ') str = get_filename(finidat) - call ncd_putatt(ncid, ncd_global, 'Initial_conditions_dataset', trim(str)) - - str = get_filename(paramfile) - call ncd_putatt(ncid, ncd_global, 'PFT_physiological_constants_dataset', trim(str)) - - ! ----------------------------------------------------------------------- - ! Define dimensions. - ! ----------------------------------------------------------------------- - - if (ldomain%isgrid2d) then - call ncd_defdim (ncid, 'lon' ,ldomain%ni, dimid) - call ncd_defdim (ncid, 'lat' ,ldomain%nj, dimid) - else - call ncd_defdim (ncid, 'gridcell', ldomain%ns, dimid) - end if - call ncd_defdim (ncid, 'pft' , maxpatch_pft , dimid) - call ncd_defdim (ncid, 'time', ncd_unlimited, dimid) - call ncd_defdim (ncid, 'string_length', 80 , dimid) - - ! ----------------------------------------------------------------------- - ! Define variables - ! ----------------------------------------------------------------------- - - ! Define coordinate variables (including time) - - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=ncid, varname='lon', xtype=ncprec, dim1name='lon', & - long_name='coordinate longitude', units='degrees_east') - - call ncd_defvar(ncid=ncid, varname='lat', xtype=ncprec, dim1name='lat', & - long_name='coordinate latitude', units='degrees_north') - end if - - call get_curr_time(mdcur, mscur) - call get_ref_date(yr, mon, day, nbsec) - hours = nbsec / 3600 - minutes = (nbsec - hours*3600) / 60 - secs = (nbsec - hours*3600 - minutes*60) - write(basedate,80) yr,mon,day -80 format(i4.4,'-',i2.2,'-',i2.2) - write(basesec ,90) hours, minutes, secs -90 format(i2.2,':',i2.2,':',i2.2) - str = 'days since ' // basedate // " " // basesec - time = mdcur + mscur/SHR_CONST_CDAY - - call ncd_defvar(ncid=ncid, varname='time', xtype=ncd_double, dim1name='time', & - long_name='time', units=str) - - ! Define surface grid (coordinate variables, latitude, longitude, surface type). - - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=ncid, varname='longxy', xtype=ncprec, & - dim1name='lon', dim2name='lat', & - long_name='longitude', units='degrees_east') - - call ncd_defvar(ncid=ncid, varname='latixy', xtype=ncprec, & - dim1name='lon', dim2name='lat', & - long_name='latitude', units='degrees_north') - - call ncd_defvar(ncid=ncid, varname='landmask', xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='land/ocean mask (0.=ocean and 1.=land)') - else - call ncd_defvar(ncid=ncid, varname='longxy', xtype=ncprec, & - dim1name='gridcell',& - long_name='longitude', units='degrees_east') - - call ncd_defvar(ncid=ncid, varname='latixy', xtype=ncprec, & - dim1name='gridcell',& - long_name='latitude', units='degrees_north') - - call ncd_defvar(ncid=ncid, varname='landmask', xtype=ncd_int, & - dim1name='gridcell', & - long_name='land/ocean mask (0.=ocean and 1.=land)') - end if - - ! Define time information - - call ncd_defvar(ncid=ncid, varname='mcdate', xtype=ncd_int, dim1name='time',& - long_name='current date (YYYYMMDD)') - - call ncd_defvar(ncid=ncid, varname='mcsec', xtype=ncd_int, dim1name='time',& - long_name='current seconds of current date', units='s') - - call ncd_defvar(ncid=ncid, varname='mdcur', xtype=ncd_int, dim1name='time',& - long_name='current day (from base day)') - - call ncd_defvar(ncid=ncid, varname='mscur', xtype=ncd_int, dim1name='time',& - long_name='current seconds of current day', units='s') - - call ncd_defvar(ncid=ncid, varname='nstep', xtype=ncd_int, dim1name='time',& - long_name='time step', units='s') - - ! Define time dependent variables - - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=ncid, varname='FPCGRID', xtype=ncprec, & - dim1name='lon', dim2name='lat', dim3name='pft', dim4name='time', & - long_name='plant functional type cover', units='fraction of vegetated area', & - missing_value=spval, fill_value=spval) - - call ncd_defvar(ncid=ncid, varname='NIND', xtype=ncprec, & - dim1name='lon', dim2name='lat', dim3name='pft', dim4name='time', & - long_name='number of individuals', units='individuals/m2 vegetated land', & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=ncid, varname='FPCGRID', xtype=ncprec, & - dim1name='gridcell', dim2name='pft', dim3name='time', & - long_name='plant functional type cover', units='fraction of vegetated area', & - missing_value=spval, fill_value=spval) - - call ncd_defvar(ncid=ncid, varname='NIND', xtype=ncprec, & - dim1name='gridcell', dim2name='pft', dim3name='time', & - long_name='number of individuals', units='individuals/m2 vegetated land', & - missing_value=spval, fill_value=spval) - end if - - call ncd_enddef(ncid) - - ! ----------------------------------------------------------------------- - ! Write variables - ! ----------------------------------------------------------------------- - - ! Write surface grid (coordinate variables, latitude, longitude, surface type). - - call ncd_io(ncid=ncid, varname='longxy' , data=ldomain%lonc, flag='write', & - dim1name=grlnd) - call ncd_io(ncid=ncid, varname='latixy' , data=ldomain%latc, flag='write', & - dim1name=grlnd) - call ncd_io(ncid=ncid, varname='landmask', data=ldomain%mask, flag='write', & - dim1name=grlnd) - - ! Write current date, current seconds, current day, current nstep - - call get_curr_date(yr, mon, day, mcsec) - mcdate = yr*10000 + mon*100 + day - nstep = get_nstep() - - call ncd_io(ncid=ncid, varname='mcdate', data=mcdate, nt=1, flag='write') - call ncd_io(ncid=ncid, varname='mcsec' , data=mcsec , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='mdcur' , data=mdcur , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='mscur' , data=mcsec , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='nstep' , data=nstep , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='time' , data=time , nt=1, flag='write') - - ! Write time dependent variables to CNDV history file - - ! The if .not. ifspecial statment below guarantees that the m index will - ! always lie between 1 and maxpatch_pft - - rbuf2dg(bounds%begg : bounds%endg, :) = 0._r8 - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - if (.not. lun%ifspecial(l)) rbuf2dg(g,patch%mxy(p)) = fpcgrid(p)*100._r8 - end do - call ncd_io(ncid=ncid, varname='FPCGRID', dim1name=grlnd, data=rbuf2dg, & - nt=1, flag='write') - - rbuf2dg(bounds%begg : bounds%endg, :) = 0._r8 - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - if (.not. lun%ifspecial(l)) rbuf2dg(g,patch%mxy(p)) = nind(p) - end do - call ncd_io(ncid=ncid, varname='NIND', dim1name=grlnd, data=rbuf2dg, & - nt=1, flag='write') - - ! Deallocate dynamic memory - - deallocate(rbuf2dg) - - !------------------------------------------------------------------ - ! Close and archive netcdf CNDV history file - !------------------------------------------------------------------ - - call ncd_pio_closefile(ncid) - - if (masterproc) then - write(iulog,*)'(histCNDV): Finished writing CNDV history dataset ',& - trim(dgvm_fn), 'at nstep = ',get_nstep() - end if - - end associate - - end subroutine CNDVHist - - !----------------------------------------------------------------------- - character(len=256) function set_dgvm_filename () - ! - ! !DESCRIPTION: - ! Determine initial dataset filenames - ! - ! !USES: - use clm_varctl , only : caseid, inst_suffix - use clm_time_manager , only : get_curr_date - ! - ! !ARGUMENTS: - implicit none - ! - ! !LOCAL VARIABLES: - character(len=256) :: cdate !date char string - integer :: day !day (1 -> 31) - integer :: mon !month (1 -> 12) - integer :: yr !year (0 -> ...) - integer :: sec !seconds into current day - !----------------------------------------------------------------------- - - call get_curr_date (yr, mon, day, sec) - write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec - set_dgvm_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& - ".hv."//trim(cdate)//".nc" - - end function set_dgvm_filename - - !----------------------------------------------------------------------- - subroutine BuildNatVegFilter(bounds, num_natvegp, filter_natvegp, dgvs_inst) - ! - ! !DESCRIPTION: - ! Reconstruct a filter of naturally-vegetated Patches for use in DGVM - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(out) :: num_natvegp ! number of patches in naturally-vegetated filter - integer , intent(out) :: filter_natvegp(:) ! patch filter for naturally-vegetated points - type(dgvs_type) , intent(in) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - integer :: p - !----------------------------------------------------------------------- - - num_natvegp = 0 - do p = bounds%begp,bounds%endp - if (dgvs_inst%present_patch(p)) then - num_natvegp = num_natvegp + 1 - filter_natvegp(num_natvegp) = p - end if - end do - - end subroutine BuildNatVegFilter - -end module CNDVDriverMod diff --git a/src/biogeochem/CNDVEstablishmentMod.F90 b/src/biogeochem/CNDVEstablishmentMod.F90 deleted file mode 100644 index a387417da9..0000000000 --- a/src/biogeochem/CNDVEstablishmentMod.F90 +++ /dev/null @@ -1,451 +0,0 @@ -module CNDVEstablishmentMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates establishment of new patches - ! Called once per year - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use atm2lndType , only : atm2lnd_type - use CNDVType , only : dgvs_type, dgv_ecophyscon - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegcarbonfluxType , only : cnveg_carbonflux_type - use LandunitType , only : lun - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: Establishment - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Establishment(bounds, & - atm2lnd_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, dgvs_inst) - ! - ! !DESCRIPTION: - ! Calculates establishment of new patches - called once per year - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_PI, SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use landunit_varcon , only : istsoil - use clm_varctl , only : iulog - use pftconMod , only : noveg, nc3_arctic_grass - use abortutils , only : endrun - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,m ! indices - integer :: fn, filterg(bounds%begg-bounds%endg+1) ! local gridcell filter for error check - ! - ! gridcell level variables - integer :: ngrass(bounds%begg:bounds%endg) ! counter - integer :: npft_estab(bounds%begg:bounds%endg) ! counter - real(r8) :: fpc_tree_total(bounds%begg:bounds%endg) ! total fractional cover of trees in vegetated portion of gridcell - real(r8) :: fpc_total(bounds%begg:bounds%endg) ! old-total fractional vegetated portion of gridcell (without bare ground) - real(r8) :: fpc_total_new(bounds%begg:bounds%endg) ! new-total fractional vegetated portion of gridcell (without bare ground) - - ! patch level variables - logical :: survive(bounds%begp:bounds%endp) ! true=>pft survives - logical :: estab(bounds%begp:bounds%endp) ! true=>pft is established - real(r8) :: dstemc(bounds%begp:bounds%endp) ! local copy of deadstemc - - ! local and temporary variables or parameters - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - real(r8) :: estab_rate ! establishment rate - real(r8) :: estab_grid ! establishment rate on grid cell - real(r8) :: fpcgridtemp ! temporary - real(r8) :: stemdiam ! stem diameter - real(r8) :: stocking ! #stems / ha (stocking density) - real(r8) :: lai_ind ! LAI per individual - real(r8) :: lm_ind ! leaf carbon (gC/ind) - real(r8) :: fpc_ind ! individual foliage projective cover - real(r8):: bm_delta - - ! parameters - real(r8), parameter :: ramp_agddtw = 300.0 - - ! minimum individual density for persistence of PATCH (indiv/m2) - real(r8), parameter :: nind_min = 1.0e-10_r8 - - ! minimum precip. for establishment (mm/s) - real(r8), parameter :: prec_min_estab = 100._r8/(365._r8*SHR_CONST_CDAY) - - ! maximum sapling establishment rate (indiv/m2) - real(r8), parameter :: estab_max = 0.24_r8 - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis [m^2/gC] - dsladlai => pftcon%dsladlai , & ! Input: dSLA/dLAI, projected area basis [m^2/gC] - dwood => pftcon%dwood , & ! Input: wood density (gC/m3) - woody => pftcon%woody , & ! Input: woody patch or not - - crownarea_max => dgv_ecophyscon%crownarea_max , & ! Input: [real(r8) (:) ] ecophys const - tree maximum crown area [m2] - twmax => dgv_ecophyscon%twmax , & ! Input: [real(r8) (:) ] ecophys const - upper limit of temperature of the warmest month - reinickerp => dgv_ecophyscon%reinickerp , & ! Input: [real(r8) (:) ] ecophys const - parameter in allometric equation - allom1 => dgv_ecophyscon%allom1 , & ! Input: [real(r8) (:) ] ecophys const - parameter in allometric - tcmax => dgv_ecophyscon%tcmax , & ! Input: [real(r8) (:) ] ecophys const - maximum coldest monthly mean temperature - tcmin => dgv_ecophyscon%tcmin , & ! Input: [real(r8) (:) ] ecophys const - minimum coldest monthly mean temperature - gddmin => dgv_ecophyscon%gddmin , & ! Input: [real(r8) (:) ] ecophys const - minimum growing degree days (at or above 5 C) - - prec365 => atm2lnd_inst%prec365_col , & ! Input: [real(r8) (:) ] 365-day running mean of tot. precipitation - - agddtw => dgvs_inst%agddtw_patch , & ! Input: [real(r8) (:) ] accumulated growing degree days above twmax - agdd20 => dgvs_inst%agdd20_patch , & ! Input: [real(r8) (:) ] 20-yr running mean of agdd - tmomin20 => dgvs_inst%tmomin20_patch , & ! Input: [real(r8) (:) ] 20-yr running mean of tmomin - pftmayexist => dgvs_inst%pftmayexist_patch , & ! Input: [logical (:) ] exclude seasonal decid patches from tropics [1=true, 0=false] - present => dgvs_inst%present_patch , & ! Output: [logical (:) ] true=> PATCH present in patch - nind => dgvs_inst%nind_patch , & ! Output: [real(r8) (:) ] number of individuals (#/m**2) - fpcgrid => dgvs_inst%fpcgrid_patch , & ! Output: [real(r8) (:) ] foliar projective cover on gridcell (fraction) - crownarea => dgvs_inst%crownarea_patch , & ! Output: [real(r8) (:) ] area that each individual tree takes up (m^2) - greffic => dgvs_inst%greffic_patch , & ! Output: [real(r8) (:) ] lpj's growth efficiency - heatstress => dgvs_inst%heatstress_patch , & ! Output: [real(r8) (:) ] - - annsum_npp => cnveg_carbonflux_inst%annsum_npp_patch , & ! Input: [real(r8) (:) ] annual sum NPP (gC/m2/yr) - annsum_litfall => cnveg_carbonflux_inst%annsum_litfall_patch , & ! Input: [real(r8) (:) ] annual sum litfall (gC/m2/yr) - - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - leafcmax => cnveg_carbonstate_inst%leafcmax_patch & ! Output: [real(r8) (:) ] (gC/m2) ann max leaf C - ) - - ! ********************************************************************** - ! Slevis version of LPJ's subr. bioclim - ! Limits based on 20-year running averages of coldest-month mean - ! temperature and growing degree days (5 degree base). - ! For SURVIVAL, coldest month temperature and GDD should be - ! at least as high as PFT-specific limits. - ! For REGENERATION, PATCH must be able to survive AND coldest month - ! temperature should be no higher than a PFT-specific limit. - ! ********************************************************************** - - taper = 200._r8 ! make a global constant as with dwood (lpj's wooddens) - - ! Initialize gridcell-level metrics - - do g = bounds%begg,bounds%endg - ngrass(g) = 0 - npft_estab(g) = 0 - fpc_tree_total(g) = 0._r8 - fpc_total(g) = 0._r8 - fpc_total_new(g) = 0._r8 - end do - - do p = bounds%begp,bounds%endp - ! Set the presence of patch for this gridcell - - if (nind(p) == 0._r8) present(p) = .false. - if (.not. present(p)) then - nind(p) = 0._r8 - fpcgrid(p) = 0._r8 - end if - survive(p) = .false. - estab(p) = .false. - dstemc(p) = deadstemc(p) - end do - - ! Must go thru all 16 patches and decide which can/cannot establish or survive - ! Determine present, survive, estab. Note: Even if tmomin20>tcmax, crops - ! and 2nd boreal summergreen tree cannot exist (see - ! EcosystemDynini) because this model cannot simulate such patches, yet. - ! Note - agddtw is only defined at the patch level and has now been moved - ! to an if-statement below to determine establishment of boreal trees - - do p = bounds%begp,bounds%endp - if (tmomin20(p) >= tcmin(ivt(p)) + SHR_CONST_TKFRZ ) then - if (tmomin20(p) <= tcmax(ivt(p)) + SHR_CONST_TKFRZ .and. agdd20(p) >= gddmin(ivt(p))) then - estab(p) = .true. - end if - survive(p) = .true. - ! seasonal decid. patches that would have occurred in regions without - ! short winter day lengths (see CNPhenology) - if (.not. pftmayexist(p)) then - survive(p) = .false. - estab(p) = .false. - pftmayexist(p) = .true. - end if - end if - end do - - do p = bounds%begp,bounds%endp - c = patch%column(p) - l = patch%landunit(p) - - ! Case 1 -- patch ceases to exist -kill patches not adapted to current climate - - if (present(p) .and. (.not. survive(p) .or. nind(p)= prec_min_estab .and. estab(p)) then - if (twmax(ivt(p)) > 999._r8 .or. agddtw(p) == 0._r8) then - - present(p) = .true. - nind(p) = 0._r8 - ! lpj starts with fpcgrid=0 and calculates - ! seed fpcgrid from the carbon of saplings; - ! with CN we need the seed fpcgrid up front - ! to scale seed leafc to lm_ind to get fpcgrid; - ! sounds circular; also seed fpcgrid depends on sla, - ! so theoretically need diff value for each pft;slevis - fpcgrid(p) = 0.000844_r8 - if (woody(ivt(p)) < 1._r8) then - fpcgrid(p) = 0.05_r8 - end if - - ! Seed carbon for newly established patches - ! Equiv. to pleaf=1 & pstor=1 set in subr pftwt_cnbal (slevis) - ! ***Dangerous*** to hardwire leafcmax here; find alternative! - ! Consider just assigning nind and fpcgrid for newly - ! established patches instead of entering the circular procedure - ! outlined in the paragraph above - leafcmax(p) = 1._r8 - if (dstemc(p) <= 0._r8) dstemc(p) = 0.1_r8 - - end if ! conditions required for establishment - end if ! conditions required for establishment - end if ! if soil - - ! Case 3 -- some patches continue to exist (no change) and some patches - ! continue to not exist (no change). Do nothing for this case. - - end do - - ! Sapling and grass establishment - ! Calculate total woody FPC, FPC increment and grass cover (= crown area) - ! Calculate total woody FPC and number of woody Patches present and able to establish - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - if (present(p)) then - if (woody(ivt(p)) == 1._r8) then - fpc_tree_total(g) = fpc_tree_total(g) + fpcgrid(p) - if (estab(p)) npft_estab(g) = npft_estab(g) + 1 - else if (woody(ivt(p)) < 1._r8 .and. ivt(p) > noveg) then !grass - ngrass(g) = ngrass(g) + 1 - end if - end if - end do - - ! Above grid-level establishment counters are required for the next steps. - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - - if (present(p) .and. woody(ivt(p)) == 1._r8 .and. estab(p)) then - - ! Calculate establishment rate over available space, per tree PFT - ! Max establishment rate reduced by shading as tree FPC approaches 1 - ! Total establishment rate partitioned equally among regenerating woody Patches - - estab_rate = estab_max * (1._r8-exp(5._r8*(fpc_tree_total(g)-1._r8))) / real(npft_estab(g)) - - ! Calculate grid-level establishment rate per woody PFT - ! Space available for woody PATCH establishment is fraction of grid cell - ! not currently occupied by woody Patches - - estab_grid = estab_rate * (1._r8-fpc_tree_total(g)) - - ! Add new saplings to current population - - nind(p) = nind(p) + estab_grid - - !slevis: lpj's lm_ind was the max leaf mass for the year; - !now lm_ind is the max leaf mass for the year calculated in CNFire - !except when a patch is newly established (nind==0); then lm_ind - !is assigned a leafcmax above - - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) ! nind>0 for sure - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area - ! stemdiam derived here from cn's formula for htop found in - ! CNVegStructUpdate and cn's assumption stemdiam=2*htop/taper - ! this derivation neglects upper htop limit enforced elsewhere - stemdiam = (24._r8 * dstemc(p) / (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) - else - stemdiam = 0._r8 - end if - ! Eqn D (now also in Light; need here for 1st yr when patches haven't established, yet) - crownarea(p) = min(crownarea_max(ivt(p)), allom1(ivt(p))*stemdiam**reinickerp(ivt(p))) - - ! Update LAI and FPC - - if (crownarea(p) > 0._r8) then - if (dsladlai(ivt(p)) > 0._r8) then - ! make lai_ind >= 0.001 to avoid killing plants at this stage - lai_ind = max(0.001_r8,((exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) - & - slatop(ivt(p)))/dsladlai(ivt(p))) / crownarea(p)) - else ! currently redundant because dsladlai=0 for grasses only - lai_ind = lm_ind * slatop(ivt(p)) / crownarea(p) ! lpj's formula - end if - else - lai_ind = 0._r8 - end if - - fpc_ind = 1._r8 - exp(-0.5_r8*lai_ind) - fpcgrid(p) = crownarea(p) * nind(p) * fpc_ind - - end if ! add new saplings block - if (present(p) .and. woody(ivt(p)) == 1._r8) then - fpc_total_new(g) = fpc_total_new(g) + fpcgrid(p) - end if - end do ! close loop to update fpc_total_new - - ! Adjustments- don't allow trees to exceed 95% of vegetated landunit - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - if (fpc_total_new(g) > 0.95_r8) then - if (woody(ivt(p)) == 1._r8 .and. present(p)) then - nind(p) = nind(p) * 0.95_r8 / fpc_total_new(g) - fpcgrid(p) = fpcgrid(p) * 0.95_r8 / fpc_total_new(g) - end if - fpc_total(g) = 0.95_r8 - - else - fpc_total(g) = fpc_total_new(g) - end if - end do - - ! Section for grasses. Grasses can establish in non-vegetated areas - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - if (present(p) .and. woody(ivt(p)) < 1._r8) then - if (leafcmax(p) <= 0._r8 .or. fpcgrid(p) <= 0._r8 ) then - present(p) = .false. - nind(p) = 0._r8 - else - nind(p) = 1._r8 ! in case these grasses just established - crownarea(p) = 1._r8 - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) - if (dsladlai(ivt(p)) > 0._r8) then - lai_ind = max(0.001_r8,((exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) - & - slatop(ivt(p)))/dsladlai(ivt(p))) / crownarea(p)) - else ! 'if' is currently redundant b/c dsladlai=0 for grasses only - lai_ind = lm_ind * slatop(ivt(p)) / crownarea(p) - end if - fpc_ind = 1._r8 - exp(-0.5_r8*lai_ind) - fpcgrid(p) = crownarea(p) * nind(p) * fpc_ind - fpc_total(g) = fpc_total(g) + fpcgrid(p) - end if - end if - end do ! end of pft-loop - - ! Adjustment of fpc_total > 1 due to grasses (ivt >= nc3_arctic_grass) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - - if (fpc_total(g) > 1._r8) then - if (ivt(p) >= nc3_arctic_grass .and. fpcgrid(p) > 0._r8) then - fpcgridtemp = fpcgrid(p) - fpcgrid(p) = max(0._r8, fpcgrid(p) - (fpc_total(g)-1._r8)) - fpc_total(g) = fpc_total(g) - fpcgridtemp + fpcgrid(p) - end if - end if - - ! Remove tiny fpcgrid amounts - - if (fpcgrid(p) < 1.e-15_r8) then - fpc_total(g) = fpc_total(g) - fpcgrid(p) - fpcgrid(p) = 0._r8 - present(p) = .false. - nind(p) = 0._r8 - end if - - ! Set the fpcgrid for bare ground if there is bare ground in - ! vegetated landunit and patch is bare ground so that everything - ! can add up to one. - - if (fpc_total(g) < 1._r8 .and. ivt(p) == noveg) then - fpcgrid(p) = 1._r8 - fpc_total(g) - fpc_total(g) = fpc_total(g) + fpcgrid(p) - end if - - end do - - ! Annual calculations used hourly in GapMortality - ! Ultimately may wish to place in separate subroutine... - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - - ! Stress mortality from lpj's subr Mortality - - if (woody(ivt(p)) == 1._r8 .and. nind(p) > 0._r8 .and. & - leafcmax(p) > 0._r8 .and. fpcgrid(p) > 0._r8) then - - if (twmax(ivt(p)) < 999._r8) then - heatstress(p) = max(0._r8, min(1._r8, agddtw(p) / ramp_agddtw)) - else - heatstress(p) = 0._r8 - end if - - ! Net individual living biomass increment - ! NB: lpj's turnover not exactly same as cn's litfall: - ! lpj's sap->heartwood turnover not included in litfall (slevis) - - bm_delta = max(0._r8, annsum_npp(p) - annsum_litfall(p)) - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) - - ! Growth efficiency (net biomass increment per unit leaf area) - - if (dsladlai(ivt(p)) > 0._r8) then - greffic(p) = bm_delta / (max(0.001_r8, & - ( ( exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) & - - slatop(ivt(p)) ) / dsladlai(ivt(p)) ))) - else ! currently redundant because dsladlai=0 for grasses only - greffic(p) = bm_delta / (lm_ind * slatop(ivt(p))) - end if - else - greffic(p) = 0. - heatstress(p) = 0. - end if - - end do - - ! Check for error in establishment - fn = 0 - do g = bounds%begg,bounds%endg - if (abs(fpc_total(g) - 1._r8) > 1.e-6) then - fn = fn + 1 - filterg(fn) = g - end if - end do - ! Just print out the first error - if (fn > 0) then - g = filterg(1) - write(iulog,*) 'Error in Establishment: fpc_total =',fpc_total(g), ' at gridcell ',g - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end associate - - end subroutine Establishment - -end module CNDVEstablishmentMod diff --git a/src/biogeochem/CNDVLightMod.F90 b/src/biogeochem/CNDVLightMod.F90 deleted file mode 100644 index 3c498742b9..0000000000 --- a/src/biogeochem/CNDVLightMod.F90 +++ /dev/null @@ -1,231 +0,0 @@ -module CNDVLightMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate light competition - ! Update fpc for establishment routine - ! Called once per year - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use CNDVType , only : dgv_ecophyscon, dgvs_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: Light - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Light(bounds, num_natvegp, filter_natvegp, & - cnveg_carbonstate_inst, dgvs_inst) - ! - ! !DESCRIPTION: - ! Calculate light competition and update fpc for establishment routine - ! Called once per year - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_natvegp ! number of naturally-vegetated patches in filter - integer , intent(in) :: filter_natvegp(:) ! patch filter for naturally-vegetated points - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: fpc_tree_max = 0.95_r8 !maximum total tree FPC - integer :: p,fp, g ! indices - real(r8) :: fpc_tree_total(bounds%begg:bounds%endg) - real(r8) :: fpc_inc_tree(bounds%begg:bounds%endg) - real(r8) :: fpc_inc(bounds%begp:bounds%endp) ! foliar projective cover increment (fraction) - real(r8) :: fpc_grass_total(bounds%begg:bounds%endg) - real(r8) :: fpc_shrub_total(bounds%begg:bounds%endg) - real(r8) :: fpc_grass_max(bounds%begg:bounds%endg) - real(r8) :: fpc_shrub_max(bounds%begg:bounds%endg) - integer :: numtrees(bounds%begg:bounds%endg) - real(r8) :: excess - real(r8) :: nind_kill - real(r8) :: lai_ind - real(r8) :: fpc_ind - real(r8) :: fpcgrid_old - real(r8) :: lm_ind ! leaf carbon (gC/individual) - real(r8) :: stemdiam ! stem diameter - real(r8) :: stocking ! #stems / ha (stocking density) - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - crownarea_max => dgv_ecophyscon%crownarea_max , & ! Input: [real(r8) (:) ] ecophys const - tree maximum crown a - reinickerp => dgv_ecophyscon%reinickerp , & ! Input: [real(r8) (:) ] ecophys const - parameter in allomet - allom1 => dgv_ecophyscon%allom1 , & ! Input: [real(r8) (:) ] ecophys const - parameter in allomet - - dwood => pftcon%dwood , & ! Input: wood density (gC/m3) - slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis (m2/gC) - dsladlai => pftcon%dsladlai , & ! Input: dSLA/dLAI, projected area basis (m2/gC) - woody => pftcon%woody , & ! Input: woody patch or not - tree => pftcon%tree , & ! Input: tree patch or not - - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - leafcmax => cnveg_carbonstate_inst%leafcmax_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - - crownarea => dgvs_inst%crownarea_patch , & ! Output: [real(r8) (:) ] area that each individual tree takes up (m^2) - nind => dgvs_inst%nind_patch , & ! Output: [real(r8) (:) ] number of individuals - fpcgrid => dgvs_inst%fpcgrid_patch & ! Output: [real(r8) (:) ] foliar projective cover on gridcell (fraction) - ) - - taper = 200._r8 ! make a global constant; used in Establishment + ? - - ! Initialize gridcell-level metrics - - do g = bounds%begg, bounds%endg - fpc_tree_total(g) = 0._r8 - fpc_inc_tree(g) = 0._r8 - fpc_grass_total(g) = 0._r8 - fpc_shrub_total(g) = 0._r8 - numtrees(g) = 0 - end do - - do fp = 1,num_natvegp - p = filter_natvegp(fp) - g = patch%gridcell(p) - - ! Update LAI and FPC as in the last lines of DGVMAllocation - - if (woody(ivt(p))==1._r8) then - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area - ! stemdiam derived here from cn's formula for htop found in - ! CNVegStructUpdate and cn's assumption stemdiam=2*htop/taper - ! this derivation neglects upper htop limit enforced elsewhere - stemdiam = (24._r8 * deadstemc(p) / (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) - else - stemdiam = 0._r8 - end if - crownarea(p) = min(crownarea_max(ivt(p)), allom1(ivt(p))*stemdiam**reinickerp(ivt(p))) ! Eqn D (from Establishment) - !else ! crownarea is 1 and does not need updating - end if - - if (crownarea(p) > 0._r8 .and. nind(p) > 0._r8) then - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) - if (dsladlai(ivt(p)) > 0._r8) then - lai_ind = max(0.001_r8,((exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) - & - slatop(ivt(p)))/dsladlai(ivt(p))) / crownarea(p)) - else - lai_ind = lm_ind * slatop(ivt(p)) / crownarea(p) - end if - else - lai_ind = 0._r8 - end if - - fpc_ind = 1._r8 - exp(-0.5_r8*lai_ind) - fpcgrid_old = fpcgrid(p) - fpcgrid(p) = crownarea(p) * nind(p) * fpc_ind - fpc_inc(p) = max(0._r8, fpcgrid(p) - fpcgrid_old) - - if (woody(ivt(p)) == 1._r8) then - if (tree(ivt(p)) == 1) then - numtrees(g) = numtrees(g) + 1 - fpc_tree_total(g) = fpc_tree_total(g) + fpcgrid(p) - fpc_inc_tree(g) = fpc_inc_tree(g) + fpc_inc(p) - else ! if shrubs - fpc_shrub_total(g) = fpc_shrub_total(g) + fpcgrid(p) - end if - else ! if grass - fpc_grass_total(g) = fpc_grass_total(g) + fpcgrid(p) - end if - end do - - do g = bounds%begg, bounds%endg - fpc_grass_max(g) = 1._r8 - min(fpc_tree_total(g), fpc_tree_max) - fpc_shrub_max(g) = max(0._r8, fpc_grass_max(g) - fpc_grass_total(g)) - end do - - ! The gridcell level metrics are now in place; continue... - ! slevis replaced the previous code that updated pfpcgrid - ! with a simpler way of doing so: - ! fpcgrid(p) = fpcgrid(p) - excess - ! Later we may wish to update this subroutine - ! according to Strassmann's recommendations (see relevant pdf) - - do fp = 1,num_natvegp - p = filter_natvegp(fp) - g = patch%gridcell(p) - - ! light competition - - if (woody(ivt(p))==1._r8 .and. tree(ivt(p))==1._r8) then - - if (fpc_tree_total(g) > fpc_tree_max) then - - if (fpc_inc_tree(g) > 0._r8) then - excess = (fpc_tree_total(g) - fpc_tree_max) * & - fpc_inc(p) / fpc_inc_tree(g) - else - excess = (fpc_tree_total(g) - fpc_tree_max) / & - real(numtrees(g)) - end if - - ! Reduce individual density (and thereby gridcell-level biomass) - ! so that total tree FPC reduced to 'fpc_tree_max' - - if (fpcgrid(p) > 0._r8) then - nind_kill = nind(p) * excess / fpcgrid(p) - nind(p) = max(0._r8, nind(p) - nind_kill) - fpcgrid(p) = max(0._r8, fpcgrid(p) - excess) - else - nind(p) = 0._r8 - fpcgrid(p) = 0._r8 - end if - - ! Transfer lost biomass to litter - - end if ! if tree cover exceeds max allowed - else if (woody(ivt(p))==0._r8) then ! grass - - if (fpc_grass_total(g) > fpc_grass_max(g)) then - - ! grass competes with itself if total fpc exceeds 1 - - excess = (fpc_grass_total(g) - fpc_grass_max(g)) * fpcgrid(p) / fpc_grass_total(g) - fpcgrid(p) = max(0._r8, fpcgrid(p) - excess) - - end if - - else if (woody(ivt(p))==1._r8 .and. tree(ivt(p))==0._r8) then ! shrub - - if (fpc_shrub_total(g) > fpc_shrub_max(g)) then - - excess = 1._r8 - fpc_shrub_max(g) / fpc_shrub_total(g) - - ! Reduce individual density (and thereby gridcell-level biomass) - ! so that total shrub FPC reduced to fpc_shrub_max(g) - - if (fpcgrid(p) > 0._r8) then - nind_kill = nind(p) * excess / fpcgrid(p) - nind(p) = max(0._r8, nind(p) - nind_kill) - fpcgrid(p) = max(0._r8, fpcgrid(p) - excess) - else - nind(p) = 0._r8 - fpcgrid(p) = 0._r8 - end if - - end if - - end if ! end of if-tree - - end do - - end associate - - end subroutine Light - -end module CNDVLightMod diff --git a/src/biogeochem/CNDVType.F90 b/src/biogeochem/CNDVType.F90 deleted file mode 100644 index ca6b2b030f..0000000000 --- a/src/biogeochem/CNDVType.F90 +++ /dev/null @@ -1,519 +0,0 @@ -module CNDVType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing routines to drive the annual dynamic vegetation - ! that works with CN, reset related variables, - ! and initialize/reset time invariant variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varctl , only : use_cndv, iulog - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC DATA TYPES: - ! - ! DGVM-specific ecophysiological constants structure (patch-level) - type, public :: dgv_ecophyscon_type - real(r8), pointer :: crownarea_max(:) ! patch tree maximum crown area [m2] - real(r8), pointer :: tcmin(:) ! patch minimum coldest monthly mean temperature [units?] - real(r8), pointer :: tcmax(:) ! patch maximum coldest monthly mean temperature [units?] - real(r8), pointer :: gddmin(:) ! patch minimum growing degree days (at or above 5 C) - real(r8), pointer :: twmax(:) ! patch upper limit of temperature of the warmest month [units?] - real(r8), pointer :: reinickerp(:) ! patch parameter in allometric equation - real(r8), pointer :: allom1(:) ! patch parameter in allometric - real(r8), pointer :: allom2(:) ! patch parameter in allometric - real(r8), pointer :: allom3(:) ! patch parameter in allometric - end type dgv_ecophyscon_type - type(dgv_ecophyscon_type), public :: dgv_ecophyscon - ! - ! DGVM state variables structure - type, public :: dgvs_type - real(r8), pointer, public :: agdd_patch (:) ! patch accumulated growing degree days above 5 - real(r8), pointer, public :: agddtw_patch (:) ! patch accumulated growing degree days above twmax - real(r8), pointer, public :: agdd20_patch (:) ! patch 20-yr running mean of agdd - real(r8), pointer, public :: tmomin20_patch (:) ! patch 20-yr running mean of tmomin - logical , pointer, public :: present_patch (:) ! patch whether PATCH present in patch - logical , pointer, public :: pftmayexist_patch (:) ! patch if .false. then exclude seasonal decid patches from tropics - real(r8), pointer, public :: nind_patch (:) ! patch number of individuals (#/m**2) - real(r8), pointer, public :: lm_ind_patch (:) ! patch individual leaf mass - real(r8), pointer, public :: lai_ind_patch (:) ! patch LAI per individual - real(r8), pointer, public :: fpcinc_patch (:) ! patch foliar projective cover increment (fraction) - real(r8), pointer, public :: fpcgrid_patch (:) ! patch foliar projective cover on gridcell (fraction) - real(r8), pointer, public :: fpcgridold_patch (:) ! patch last yr's fpcgrid - real(r8), pointer, public :: crownarea_patch (:) ! patch area that each individual tree takes up (m^2) - real(r8), pointer, public :: greffic_patch (:) - real(r8), pointer, public :: heatstress_patch (:) - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: InitAccBuffer - procedure , public :: InitAccVars - procedure , public :: UpdateAccVars - procedure , private :: InitAllocate - procedure , private :: InitCold - procedure , private :: InitHistory - end type dgvs_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - - ! Note - need allocation so that associate statements can be used - ! at run time for NAG (allocation of variables is needed) - history - ! should only be initialized if use_cndv is true - - call this%InitAllocate (bounds) - - if (use_cndv) then - call this%InitCold (bounds) - call this%InitHistory (bounds) - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : numpft - use pftconMod , only : allom1s, allom2s, allom1, allom2, allom3, reinickerp - use pftconMod , only : ntree, nbrdlf_dcd_brl_shrub - use pftconMod , only : pftcon - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: m - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - allocate(this%agdd_patch (begp:endp)) ; this%agdd_patch (:) = nan - allocate(this%agddtw_patch (begp:endp)) ; this%agddtw_patch (:) = nan - allocate(this%agdd20_patch (begp:endp)) ; this%agdd20_patch (:) = nan - allocate(this%tmomin20_patch (begp:endp)) ; this%tmomin20_patch (:) = nan - allocate(this%present_patch (begp:endp)) ; this%present_patch (:) = .false. - allocate(this%pftmayexist_patch (begp:endp)) ; this%pftmayexist_patch (:) = .true. - allocate(this%nind_patch (begp:endp)) ; this%nind_patch (:) = nan - allocate(this%lm_ind_patch (begp:endp)) ; this%lm_ind_patch (:) = nan - allocate(this%lai_ind_patch (begp:endp)) ; this%lai_ind_patch (:) = nan - allocate(this%fpcinc_patch (begp:endp)) ; this%fpcinc_patch (:) = nan - allocate(this%fpcgrid_patch (begp:endp)) ; this%fpcgrid_patch (:) = nan - allocate(this%fpcgridold_patch (begp:endp)) ; this%fpcgridold_patch (:) = nan - allocate(this%crownarea_patch (begp:endp)) ; this%crownarea_patch (:) = nan - allocate(this%greffic_patch (begp:endp)) ; this%greffic_patch (:) = nan - allocate(this%heatstress_patch (begp:endp)) ; this%heatstress_patch (:) = nan - - allocate(dgv_ecophyscon%crownarea_max (0:numpft)) - allocate(dgv_ecophyscon%tcmin (0:numpft)) - allocate(dgv_ecophyscon%tcmax (0:numpft)) - allocate(dgv_ecophyscon%gddmin (0:numpft)) - allocate(dgv_ecophyscon%twmax (0:numpft)) - allocate(dgv_ecophyscon%reinickerp (0:numpft)) - allocate(dgv_ecophyscon%allom1 (0:numpft)) - allocate(dgv_ecophyscon%allom2 (0:numpft)) - allocate(dgv_ecophyscon%allom3 (0:numpft)) - - do m = 0,numpft - dgv_ecophyscon%crownarea_max(m) = pftcon%pftpar20(m) - dgv_ecophyscon%tcmin(m) = pftcon%pftpar28(m) - dgv_ecophyscon%tcmax(m) = pftcon%pftpar29(m) - dgv_ecophyscon%gddmin(m) = pftcon%pftpar30(m) - dgv_ecophyscon%twmax(m) = pftcon%pftpar31(m) - dgv_ecophyscon%reinickerp(m) = reinickerp - dgv_ecophyscon%allom1(m) = allom1 - dgv_ecophyscon%allom2(m) = allom2 - dgv_ecophyscon%allom3(m) = allom3 - ! modification for shrubs by X.D.Z - if (m > ntree .and. m <= nbrdlf_dcd_brl_shrub ) then - dgv_ecophyscon%allom1(m) = allom1s - dgv_ecophyscon%allom2(m) = allom2s - end if - end do - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - !----------------------------------------------------------------------- - - do p = bounds%begp,bounds%endp - this%present_patch(p) = .false. - this%crownarea_patch(p) = 0._r8 - this%nind_patch(p) = 0._r8 - this%agdd20_patch(p) = 0._r8 - this%tmomin20_patch(p) = SHR_CONST_TKFRZ - 5._r8 !initialize this way for Phenology code - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize history variables - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - call hist_addfld1d (fname='AGDD', units='K', & - avgflag='A', long_name='growing degree-days base 5C', & - ptr_patch=this%agdd_patch) - - end subroutine InitHistory - - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use clm_varcon , only : spval - use spmdMod , only : masterproc - use decompMod , only : get_proc_global - use restUtilMod - use ncdio_pio - use pio - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c,p ! indices - logical :: readvar ! determine if variable is on initial file - logical :: do_io ! whether to do i/o for the given variable - integer :: nump_global ! total number of patches, globally - integer :: dimlen ! dimension length - integer :: ier ! error status - integer :: itemp ! temporary - integer , pointer :: iptemp(:) ! pointer to memory to be allocated - integer :: err_code ! error code - !----------------------------------------------------------------------- - - ! Get expected total number of points, for later error checks - call get_proc_global(np=nump_global) - - call restartvar(ncid=ncid, flag=flag, varname='CROWNAREA', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%crownarea_patch) - - call restartvar(ncid=ncid, flag=flag, varname='nind', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%nind_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fpcgrid', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fpcgrid_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fpcgridold', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fpcgridold_patch) - - ! tmomin20 - do_io = .true. - if (flag == 'read') then - ! On a read, confirm that this variable has the expected size; if not, don't - ! read it (instead leave it at its arbitrary initial value). This is needed to - ! support older initial conditions for which this variable had a different size. - call ncd_inqvdlen(ncid, 'TMOMIN20', 1, dimlen, err_code) - if (dimlen /= nump_global) then - do_io = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='TMOMIN20', xtype=ncd_double, & - dim1name='pft', & - long_name='',units='', & - interpinic_flag='interp', readvar=readvar, data=this%tmomin20_patch) - end if - - ! agdd20 - do_io = .true. - if (flag == 'read') then - ! On a read, confirm that this variable has the expected size; if not, don't - ! read it (instead leave it at its arbitrary initial value). This is needed to - ! support older initial conditions for which this variable had a different size. - call ncd_inqvdlen(ncid, 'AGDD20', 1, dimlen, err_code) - if (dimlen /= nump_global) then - do_io = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='AGDD20', xtype=ncd_double, & - dim1name='pft',& - long_name='',units='', & - interpinic_flag='interp', readvar=readvar, data=this%agdd20_patch) - end if - - ! present - if (flag == 'read' .or. flag == 'write') then - allocate (iptemp(bounds%begp:bounds%endp), stat=ier) - end if - if (flag == 'write') then - do p = bounds%begp,bounds%endp - iptemp(p) = 0 - if (this%present_patch(p)) iptemp(p) = 1 - end do - end if - call restartvar(ncid=ncid, flag=flag, varname='present', xtype=ncd_int, & - dim1name='pft',& - long_name='',units='', & - interpinic_flag='interp', readvar=readvar, data=iptemp) - if (flag=='read' .and. readvar) then - do p = bounds%begp,bounds%endp - this%present_patch(p) = .false. - if (iptemp(p) == 1) this%present_patch(p) = .true. - end do - end if - if (flag == 'read' .or. flag == 'write') then - deallocate (iptemp) - end if - - call restartvar(ncid=ncid, flag=flag, varname='heatstress', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%heatstress_patch) - - call restartvar(ncid=ncid, flag=flag, varname='greffic', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%greffic_patch) - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateCNDVAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateCNDVAccVars]. - ! - ! This should only be called if use_cndv is true. - ! - ! !USES - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer, parameter :: not_used = huge(1) - - !--------------------------------------------------------------------- - - ! The following are accumulated fields. - ! These types of fields are accumulated until a trigger value resets - ! the accumulation to zero (see subroutine update_accum_field). - ! Hence, [accper] is not valid. - - call init_accum_field (name='AGDDTW', units='K', & - desc='growing degree-days base twmax', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='AGDD', units='K', & - desc='growing degree-days base 5C', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! This should only be called if use_cndv is true. - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(dgvs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier ! error status - real(r8), pointer :: rbufslp(:) ! temporary - - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg=" allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - nstep = get_nstep() - - call extract_accum_field ('AGDDTW', rbufslp, nstep) - this%agddtw_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('AGDD', rbufslp, nstep) - this%agdd_patch(begp:endp) = rbufslp(begp:endp) - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine UpdateAccVars(this, bounds, t_a10_patch, t_ref2m_patch) - ! - ! !DESCRIPTION: - ! Update accumulated variables. Should be called every time step. - ! - ! This should only be called if use_cndv is true. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, get_curr_date - use pftconMod , only : ndllf_dcd_brl_tree - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - ! - ! !ARGUMENTS: - class(dgvs_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! COMPILER_BUG(wjs, 2014-11-30, pgi 14.7) These arrays get resized to 0 when running - ! with threading with pgi 14.7 on yellowstone. My standard workarounds weren't - ! working; the only thing that I can find that works is to change them to pointers -! real(r8) , intent(in) :: t_a10_patch( bounds%begp:) ! 10-day running mean of the 2 m temperature (K) -! real(r8) , intent(in) :: t_ref2m_patch( bounds%begp:) ! 2 m height surface air temperature (K) - real(r8), pointer , intent(in) :: t_a10_patch(:) ! 10-day running mean of the 2 m temperature (K) - real(r8), pointer , intent(in) :: t_ref2m_patch(:) ! 2 m height surface air temperature (K) - ! - ! !LOCAL VARIABLES: - integer :: p ! index - integer :: ier ! error status - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(t_a10_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_ref2m_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate growing degree days based on 10-day running mean temperature. - ! The trigger to reset the accumulated values to zero is -99999. - - ! Accumulate and extract AGDDTW (gdd base twmax, which is 23 deg C - ! for boreal woody patches) - - do p = begp,endp - rbufslp(p) = max(0._r8, & - (t_a10_patch(p) - SHR_CONST_TKFRZ - dgv_ecophyscon%twmax(ndllf_dcd_brl_tree)) & - * dtime/SHR_CONST_CDAY) - if (month==1 .and. day==1 .and. secs==int(dtime)) rbufslp(p) = accumResetVal - end do - call update_accum_field ('AGDDTW', rbufslp, nstep) - call extract_accum_field ('AGDDTW', this%agddtw_patch, nstep) - - ! Accumulate and extract AGDD - - do p = begp,endp - rbufslp(p) = max(0.0_r8, & - (t_ref2m_patch(p) - (SHR_CONST_TKFRZ + 5.0_r8)) * dtime/SHR_CONST_CDAY) - ! - ! Fix (for bug 1858) from Sam Levis to reset the annual AGDD variable - ! - if (month==1 .and. day==1 .and. secs==int(dtime)) rbufslp(p) = accumResetVal - end do - call update_accum_field ('AGDD', rbufslp, nstep) - call extract_accum_field ('AGDD', this%agdd_patch, nstep) - - deallocate(rbufslp) - - end subroutine UpdateAccVars - -end module CNDVType diff --git a/src/biogeochem/CNDriverMod.F90 b/src/biogeochem/CNDriverMod.F90 deleted file mode 100644 index a2823fc557..0000000000 --- a/src/biogeochem/CNDriverMod.F90 +++ /dev/null @@ -1,1057 +0,0 @@ -module CNDriverMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Ecosystem dynamics: phenology, vegetation - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : use_c13, use_c14, use_fates, use_dynroot - use dynSubgridControlMod , only : get_do_harvest - use decompMod , only : bounds_type - use perf_mod , only : t_startf, t_stopf - use clm_varctl , only : use_century_decomp, use_nitrif_denitrif, use_nguardrail - use clm_varctl , only : use_crop - use CNSharedParamsMod , only : use_fun - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNProductsMod , only : cn_products_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use CNDVType , only : dgvs_type - use CanopyStateType , only : canopystate_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use atm2lndType , only : atm2lnd_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use PhotosynthesisMod , only : photosyns_type - use ch4Mod , only : ch4_type - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNDriverInit ! Ecosystem dynamics: initialization - public :: CNDriverNoLeaching ! Ecosystem dynamics: phenology, vegetation, before doing N leaching - public :: CNDriverLeaching ! Ecosystem dynamics: phenology, vegetation, doing N leaching - public :: CNDriverSummarizeStates - public :: CNDriverSummarizeFluxes - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNDriverInit(bounds, NLFilename, cnfire_method) - ! - ! !DESCRIPTION: - ! Initialzation of the CN Ecosystem dynamics. - ! - ! !USES: - use CNSharedParamsMod , only : use_fun - use CNPhenologyMod , only : CNPhenologyInit - use CNFireMethodMod , only : cnfire_method_type - use SoilBiogeochemCompetitionMod, only : SoilBiogeochemCompetitionInit - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! Namelist filename - class(cnfire_method_type) , intent(inout) :: cnfire_method - !----------------------------------------------------------------------- - call SoilBiogeochemCompetitionInit(bounds) - call CNPhenologyInit(bounds) - call cnfire_method%CNFireInit(bounds, NLFilename) - - end subroutine CNDriverInit - - !----------------------------------------------------------------------- - subroutine CNDriverNoLeaching(bounds, & - num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, doalb, & - cnveg_state_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & - c_products_inst, c13_products_inst, c14_products_inst, n_products_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & - dgvs_inst, photosyns_inst, soilhydrology_inst, energyflux_inst, & - nutrient_competition_method, cnfire_method) - ! - ! !DESCRIPTION: - ! The core CN code is executed here. Calculates fluxes for maintenance - ! respiration, decomposition, allocation, phenology, and growth respiration. - ! These routines happen on the radiation time step so that canopy structure - ! stays synchronized with albedo calculations. - ! - ! !USES: - use clm_varpar , only: nlevgrnd, nlevdecomp_full - use clm_varpar , only: nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use subgridAveMod , only: p2c, p2c_2d - use CropType , only: crop_type - use CNNDynamicsMod , only: CNNDeposition,CNNFixation, CNNFert, CNSoyfix,CNFreeLivingFixation - use CNMRespMod , only: CNMResp - use CNFUNMod , only: CNFUNInit !, CNFUN - use CNPhenologyMod , only: CNPhenology - use CNGRespMod , only: CNGResp - use CNFireMethodMod , only: cnfire_method_type - use CNCIsoFluxMod , only: CIsoFlux1, CIsoFlux2, CIsoFlux2h, CIsoFlux3 - use CNC14DecayMod , only: C14Decay - use CNCStateUpdate1Mod , only: CStateUpdate1,CStateUpdate0 - use CNCStateUpdate2Mod , only: CStateUpdate2, CStateUpdate2h - use CNCStateUpdate3Mod , only: CStateUpdate3 - use CNNStateUpdate1Mod , only: NStateUpdate1 - use CNNStateUpdate2Mod , only: NStateUpdate2, NStateUpdate2h - use CNGapMortalityMod , only: CNGapMortality - use CNSharedParamsMod , only: use_fun - use dynHarvestMod , only: CNHarvest - use SoilBiogeochemDecompCascadeBGCMod , only: decomp_rate_constants_bgc - use SoilBiogeochemDecompCascadeCNMod , only: decomp_rate_constants_cn - use SoilBiogeochemCompetitionMod , only: SoilBiogeochemCompetition - use SoilBiogeochemDecompMod , only: SoilBiogeochemDecomp - use SoilBiogeochemLittVertTranspMod , only: SoilBiogeochemLittVertTransp - use SoilBiogeochemPotentialMod , only: SoilBiogeochemPotential - use SoilBiogeochemVerticalProfileMod , only: SoilBiogeochemVerticalProfile - use SoilBiogeochemNitrifDenitrifMod , only: SoilBiogeochemNitrifDenitrif - use SoilBiogeochemNStateUpdate1Mod , only: SoilBiogeochemNStateUpdate1 - use NutrientCompetitionMethodMod , only: nutrient_competition_method_type - use CNRootDynMod , only: CNRootDyn - use CNPrecisionControlMod , only: CNPrecisionControl - ! - ! !ARGUMENTS: - 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 - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - 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 - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cn_products_type) , intent(inout) :: c_products_inst - type(cn_products_type) , intent(inout) :: c13_products_inst - type(cn_products_type) , intent(inout) :: c14_products_inst - type(cn_products_type) , intent(inout) :: n_products_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(crop_type) , intent(inout) :: crop_inst - type(ch4_type) , intent(in) :: ch4_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(energyflux_type) , intent(in) :: energyflux_inst - class(nutrient_competition_method_type) , intent(inout) :: nutrient_competition_method - class(cnfire_method_type) , intent(inout) :: cnfire_method - ! - ! !LOCAL VARIABLES: - real(r8):: cn_decomp_pools(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_pools) - real(r8):: p_decomp_cpool_loss(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_cascade_transitions) !potential C loss from one pool to another - real(r8):: pmnf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_cascade_transitions) !potential mineral N flux, from one pool to another - real(r8):: arepr(bounds%begp:bounds%endp) ! reproduction allocation coefficient (only used for use_crop) - real(r8):: aroot(bounds%begp:bounds%endp) ! root allocation coefficient (only used for use_crop) - integer :: begp,endp - integer :: begc,endc - - integer :: dummy_to_make_pgi_happy - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - !real(r8) , intent(in) :: rootfr_patch(bounds%begp:, 1:) - !integer , intent(in) :: altmax_lastyear_indx_col(bounds%begc:) ! frost table depth (m) - - associate( & - crootfr_patch => soilstate_inst%crootfr_patch , & ! fraction of roots for carbon in each soil layer (nlevgrnd) - altmax_lastyear_indx_col => canopystate_inst%altmax_lastyear_indx_col , & ! frost table depth (m) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch , & ! Output: [integer (:) ] frac of vegetation not covered by snow [-] - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index, no burying by snow - elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch & ! Output: [real(r8) (:) ] canopy bottom (m) - ) - - ! -------------------------------------------------- - ! zero the column-level C and N fluxes - ! -------------------------------------------------- - - call t_startf('CNZero') - - ! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) Without this, the filter is full of garbage - ! in some situations - dummy_to_make_pgi_happy = ubound(filter_soilc, 1) - call soilbiogeochem_carbonflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - if ( use_c13 ) then - call c13_soilbiogeochem_carbonflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - end if - if ( use_c14 ) then - call c14_soilbiogeochem_carbonflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - end if - - call cnveg_carbonflux_inst%SetValues( & - num_soilp, filter_soilp, 0._r8, & - num_soilc, filter_soilc, 0._r8) - if ( use_c13 ) then - call c13_cnveg_carbonflux_inst%SetValues( & - num_soilp, filter_soilp, 0._r8, & - num_soilc, filter_soilc, 0._r8) - end if - if ( use_c14 ) then - call c14_cnveg_carbonflux_inst%SetValues( & - num_soilp, filter_soilp, 0._r8, & - num_soilc, filter_soilc, 0._r8) - end if - - call cnveg_nitrogenflux_inst%SetValues( & - num_soilp, filter_soilp, 0._r8, & - num_soilc, filter_soilc, 0._r8) - - call soilbiogeochem_nitrogenflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - - call t_stopf('CNZero') - - ! -------------------------------------------------- - ! Nitrogen Deposition, Fixation and Respiration - ! -------------------------------------------------- - - call t_startf('CNDeposition') - call CNNDeposition(bounds, & - atm2lnd_inst, soilbiogeochem_nitrogenflux_inst) - call t_stopf('CNDeposition') - - if(use_fun)then - call t_startf('CNFLivFixation') - call CNFreeLivingFixation( num_soilc, filter_soilc, & - waterflux_inst, soilbiogeochem_nitrogenflux_inst) - call t_stopf('CNFLivFixation') - else - call t_startf('CNFixation') - call CNNFixation( num_soilc, filter_soilc, & - cnveg_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) - call t_stopf('CNFixation') - end if - - - if (use_crop) then - call CNNFert(bounds, num_soilc,filter_soilc, & - cnveg_nitrogenflux_inst, soilbiogeochem_nitrogenflux_inst) - - if (.not. use_fun) then ! if FUN is active, then soy fixation handled by FUN - call CNSoyfix (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - waterstate_inst, crop_inst, cnveg_state_inst, cnveg_nitrogenflux_inst , & - soilbiogeochem_state_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - end if - end if - - call t_startf('CNMResp') - call CNMResp(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - canopystate_inst, soilstate_inst, temperature_inst, photosyns_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenstate_inst) - call t_stopf('CNMResp') - - !-------------------------------------------- - ! Soil Biogeochemistry - !-------------------------------------------- - - call t_startf('SoilBiogeochem') - if (use_century_decomp) then - call decomp_rate_constants_bgc(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - else - call decomp_rate_constants_cn(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - end if - - ! calculate potential decomp rates and total immobilization demand (previously inlined in CNDecompAlloc) - call SoilBiogeochemPotential (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools=cn_decomp_pools(begc:endc,1:nlevdecomp,1:ndecomp_pools), & - p_decomp_cpool_loss=p_decomp_cpool_loss(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions), & - pmnf_decomp_cascade=pmnf_decomp_cascade(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions)) - - ! calculate vertical profiles for distributing soil and litter C and N (previously subroutine decomp_vertprofiles called from CNDecompAlloc) - call SoilBiogeochemVerticalProfile(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - canopystate_inst, soilstate_inst,soilbiogeochem_state_inst) - - ! calculate nitrification and denitrification rates (previously subroutine nitrif_denitrif called from CNDecompAlloc) - if (use_nitrif_denitrif) then - call SoilBiogeochemNitrifDenitrif(bounds, num_soilc, filter_soilc, & - soilstate_inst, waterstate_inst, temperature_inst, ch4_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - end if - call t_stopf('SoilBiogeochem') - - !-------------------------------------------- - ! Resolve the competition between plants and soil heterotrophs - ! for available soil mineral N resource - !-------------------------------------------- - - call t_startf('CNDecompAlloc') - - ! Jinyun Tang: at this stage, the plant_nutrient_demand only calculates the plant ntirgeon demand. - ! Assume phosphorus dynamics will be included in the future. Also, I consider plant_nutrient_demand - ! as a generic interface to call actual nutrient calculation from different aboveground plantbgc. - ! Right now it is assumed the plant nutrient demand is summarized into columnwise demand, and the - ! nutrient redistribution after uptake is done by the plant bgc accordingly. - ! When nutrient competition is required to be done at cohort level both plant_nutrient_demand and - ! do_nutrient_competition should be modified, but that modification should not significantly change - ! the current interface. - - !RF: moved ths call to before nutrient_demand, so that croplive didn't change half way through crop N cycle. - if ( use_fun ) then - call t_startf('CNPhenology_phase1') - call CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & - filter_soilp, num_pcropp, filter_pcropp, & - doalb, waterstate_inst, temperature_inst, atm2lnd_inst, & - crop_inst, canopystate_inst, soilstate_inst, dgvs_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp,1:nlevdecomp_full), & - froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp,1:nlevdecomp_full), & - phase=1) - call t_stopf('CNPhenology_phase1') - - call t_startf('CNFUNInit') - call CNFUNInit(bounds,cnveg_state_inst,cnveg_carbonstate_inst,cnveg_nitrogenstate_inst) - call t_stopf('CNFUNInit') - - end if - - call t_startf('calc_plant_nutrient_demand') - call nutrient_competition_method%calc_plant_nutrient_demand ( & - bounds, num_soilp, filter_soilp, & - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, & - energyflux_inst, & - aroot=aroot(begp:endp), arepr=arepr(begp:endp)) - - ! get the column-averaged plant_ndemand (needed for following call to SoilBiogeochemCompetition) - - call p2c(bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst%plant_ndemand_patch(begp:endp), & - soilbiogeochem_state_inst%plant_ndemand_col(begc:endc)) - call t_stopf('calc_plant_nutrient_demand') - - ! resolve plant/heterotroph competition for mineral N - - - call t_startf('soilbiogeochemcompetition') - call SoilBiogeochemCompetition (bounds, num_soilc, filter_soilc,num_soilp, filter_soilp, waterstate_inst, & - waterflux_inst,temperature_inst,soilstate_inst,cnveg_state_inst, & - cnveg_carbonstate_inst ,& - cnveg_carbonflux_inst,cnveg_nitrogenstate_inst,cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst,& - soilbiogeochem_state_inst,soilbiogeochem_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst,canopystate_inst) - call t_stopf('soilbiogeochemcompetition') - - ! distribute the available N between the competing patches on the basis of - ! relative demand, and allocate C and N to new growth and storage - - call t_startf('calc_plant_nutrient_competition') - call nutrient_competition_method%calc_plant_nutrient_competition ( & - bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_nitrogenstate_inst, & - aroot=aroot(begp:endp), & - arepr=arepr(begp:endp), & - fpg_col=soilbiogeochem_state_inst%fpg_col(begc:endc)) - call t_stopf('calc_plant_nutrient_competition') - - call t_stopf('CNDecompAlloc') - - !-------------------------------------------- - ! Calculate litter and soil decomposition rate - !-------------------------------------------- - - ! Calculation of actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N (previously inlined in CNDecompAllocation in CNDecompMod) - - call t_startf('SoilBiogeochemDecomp') - - call SoilBiogeochemDecomp (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools=cn_decomp_pools(begc:endc,1:nlevdecomp,1:ndecomp_pools), & - p_decomp_cpool_loss=p_decomp_cpool_loss(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions), & - pmnf_decomp_cascade=pmnf_decomp_cascade(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions)) - - call t_stopf('SoilBiogeochemDecomp') - - !-------------------------------------------- - ! Phenology - !-------------------------------------------- - - ! CNphenology needs to be called after above calls, since it depends on current - ! time-step fluxes to new growth on the lastlitterfall timestep in deciduous systems - - call t_startf('CNPhenology') - - if ( .not. use_fun ) then - call CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & - filter_soilp, num_pcropp, filter_pcropp, & - doalb, waterstate_inst, temperature_inst, atm2lnd_inst, & - crop_inst, canopystate_inst, soilstate_inst, dgvs_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp,1:nlevdecomp_full), & - froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp,1:nlevdecomp_full), & - phase=1) - end if - call CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & - filter_soilp, num_pcropp, filter_pcropp, & - doalb, waterstate_inst, temperature_inst, atm2lnd_inst, & - crop_inst, canopystate_inst, soilstate_inst, dgvs_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp,1:nlevdecomp_full), & - froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp,1:nlevdecomp_full), & - phase=2) - - call t_stopf('CNPhenology') - - !-------------------------------------------- - ! Growth respiration - !-------------------------------------------- - - call t_startf('CNGResp') - - call CNGResp(num_soilp, filter_soilp,& - cnveg_carbonflux_inst, canopystate_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - - call t_stopf('CNGResp') - - !-------------------------------------------- - ! Dynamic Roots - !-------------------------------------------- - - if( use_dynroot ) then - call t_startf('CNRootDyn') - - call CNRootDyn(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, & - cnveg_state_inst, crop_inst, soilstate_inst, soilbiogeochem_nitrogenstate_inst) - - call t_stopf('CNRootDyn') - end if - - !-------------------------------------------- - ! CNUpdate0 - !-------------------------------------------- - - call t_startf('CNUpdate0') - - call CStateUpdate0(num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst) - - if ( use_c13 ) then - call CStateUpdate0(num_soilp, filter_soilp, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst) - end if - - if ( use_c14 ) then - call CStateUpdate0(num_soilp, filter_soilp, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst) - end if - - call t_stopf('CNUpdate0') - - if ( use_nguardrail ) then - call t_startf('CNPrecisionControl') - call CNPrecisionControl(bounds, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, & - c14_cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - call t_stopf('CNPrecisionControl') - end if - !-------------------------------------------- - ! Update1 - !-------------------------------------------- - - call t_startf('CNUpdate1') - - ! Set the carbon isotopic flux variables (except for gap-phase mortality and fire fluxes) - if ( use_c13 ) then - - call CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - isotope='c13') - end if - if ( use_c14 ) then - call CIsoFlux1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - isotope='c14') - end if - - ! Update all prognostic carbon state variables (except for gap-phase mortality and fire fluxes) - call CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & - crop_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst) - if ( use_c13 ) then - call CStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - crop_inst, c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst) - end if - if ( use_c14 ) then - call CStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - crop_inst, c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst) - end if - - ! Update all prognostic nitrogen state variables (except for gap-phase mortality and fire fluxes) - call NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - - call t_stopf('CNUpdate1') - - if ( use_nguardrail ) then - call t_startf('CNPrecisionControl') - call CNPrecisionControl(bounds, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, & - c14_cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - call t_stopf('CNPrecisionControl') - end if - - call t_startf('SoilBiogeochemStateUpdate1') - call SoilBiogeochemNStateUpdate1(num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - call t_stopf('SoilBiogeochemStateUpdate1') - - - !-------------------------------------------- - ! Calculate vertical mixing of soil and litter pools - !-------------------------------------------- - - call t_startf('SoilBiogeochemLittVertTransp') - - call SoilBiogeochemLittVertTransp(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilbiogeochem_state_inst, & - soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - - call t_stopf('SoilBiogeochemLittVertTransp') - - !-------------------------------------------- - ! Calculate the gap mortality carbon and nitrogen fluxes - !-------------------------------------------- - - call t_startf('CNGapMortality') - - call CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - dgvs_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, canopystate_inst, & - !cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp, 1:nlevdecomp_full), & - froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), & - croot_prof_patch=soilbiogeochem_state_inst%croot_prof_patch(begp:endp, 1:nlevdecomp_full), & - stem_prof_patch=soilbiogeochem_state_inst%stem_prof_patch(begp:endp, 1:nlevdecomp_full)) - - call t_stopf('CNGapMortality') - - !-------------------------------------------- - ! Update2 (gap mortality) - !-------------------------------------------- - - call t_startf('CNUpdate2') - - ! Set the carbon isotopic fluxes for gap mortality - if ( use_c13 ) then - call CIsoFlux2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - iso_cnveg_carbonflux_inst=c13_cnveg_carbonflux_inst, & - iso_cnveg_carbonstate_inst=c13_cnveg_carbonstate_inst, & - isotope='c13') - end if - if ( use_c14 ) then - call CIsoFlux2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - iso_cnveg_carbonflux_inst=c14_cnveg_carbonflux_inst, & - iso_cnveg_carbonstate_inst=c14_cnveg_carbonstate_inst, & - isotope='c14') - end if - - ! Update all the prognostic carbon state variables affected by gap-phase mortality fluxes - call CStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - if ( use_c13 ) then - call CStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst) - end if - if ( use_c14 ) then - call CStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst) - end if - - ! Update all the prognostic nitrogen state variables affected by gap-phase mortality fluxes - call NStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenstate_inst) - - !-------------------------------------------- - ! Update2h (harvest) - !-------------------------------------------- - - ! Set harvest mortality routine - if (get_do_harvest()) then - call CNHarvest(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - end if - - if ( use_c13 ) then - call CIsoFlux2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - isotope='c13') - end if - if ( use_c14 ) then - call CIsoFlux2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - isotope='c14') - end if - - call CStateUpdate2h( num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - if ( use_c13 ) then - call CStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst) - end if - if ( use_c14 ) then - call CStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst) - end if - - call NStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenstate_inst) - call t_stopf('CNUpdate2') - - if ( use_nguardrail ) then - call t_startf('CNPrecisionControl') - call CNPrecisionControl(bounds, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, & - c14_cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - call t_stopf('CNPrecisionControl') - end if - !-------------------------------------------- - ! Calculate loss fluxes from wood products pools - ! and update product pool state variables - !-------------------------------------------- - - call t_startf('CNWoodProducts') - call c_products_inst%UpdateProducts(bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch = cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), & - wood_harvest_patch = cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), & - dwt_crop_product_gain_patch = cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), & - grain_to_cropprod_patch = cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp)) - call t_stopf('CNWoodProducts') - - if (use_c13) then - call c13_products_inst%UpdateProducts(bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch = c13_cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), & - wood_harvest_patch = c13_cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), & - dwt_crop_product_gain_patch = c13_cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), & - grain_to_cropprod_patch = c13_cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp)) - end if - - if (use_c14) then - call c14_products_inst%UpdateProducts(bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch = c14_cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(begp:endp), & - wood_harvest_patch = c14_cnveg_carbonflux_inst%wood_harvestc_patch(begp:endp), & - dwt_crop_product_gain_patch = c14_cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(begp:endp), & - grain_to_cropprod_patch = c14_cnveg_carbonflux_inst%grainc_to_cropprodc_patch(begp:endp)) - end if - - call n_products_inst%UpdateProducts(bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch = cnveg_nitrogenflux_inst%dwt_wood_productn_gain_patch(begp:endp), & - wood_harvest_patch = cnveg_nitrogenflux_inst%wood_harvestn_patch(begp:endp), & - dwt_crop_product_gain_patch = cnveg_nitrogenflux_inst%dwt_crop_productn_gain_patch(begp:endp), & - grain_to_cropprod_patch = cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(begp:endp)) - - !-------------------------------------------- - ! Calculate fire area and fluxes - !-------------------------------------------- - - call t_startf('CNFire') - call cnfire_method%CNFireArea(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, soilhydrology_inst, waterstate_inst, & - 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), & - t_soi17cm_col=temperature_inst%t_soi17cm_col(begc:endc)) - - call cnfire_method%CNFireFluxes(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - dgvs_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch=soilbiogeochem_state_inst%leaf_prof_patch(begp:endp, 1:nlevdecomp_full), & - froot_prof_patch=soilbiogeochem_state_inst%froot_prof_patch(begp:endp, 1:nlevdecomp_full), & - croot_prof_patch=soilbiogeochem_state_inst%croot_prof_patch(begp:endp, 1:nlevdecomp_full), & - stem_prof_patch=soilbiogeochem_state_inst%stem_prof_patch(begp:endp, 1:nlevdecomp_full), & - totsomc_col=soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), & - decomp_cpools_vr_col=soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), & - decomp_npools_vr_col=soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), & - somc_fire_col=soilbiogeochem_carbonflux_inst%somc_fire_col(begc:endc)) - call t_stopf('CNFire') - - - !-------------------------------------------- - ! Update3 - !-------------------------------------------- - - call t_startf('CNUpdate3') - if ( use_c13 ) then - call CIsoFlux3(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst , soilbiogeochem_carbonstate_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, & - isotope='c13') - end if - if ( use_c14 ) then - call CIsoFlux3(num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst , soilbiogeochem_carbonstate_inst, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, & - isotope='c14') - end if - - call CStateUpdate3( num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, soilbiogeochem_carbonstate_inst) - - if ( use_c13 ) then - call CStateUpdate3( num_soilc, filter_soilc, num_soilp, filter_soilp, & - c13_cnveg_carbonflux_inst, c13_cnveg_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst) - end if - - if ( use_c14 ) then - call CStateUpdate3( num_soilc, filter_soilc, num_soilp, filter_soilp, & - c14_cnveg_carbonflux_inst, c14_cnveg_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst) - - call C14Decay(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - c14_cnveg_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst) - end if - call t_stopf('CNUpdate3') - - if ( use_nguardrail ) then - call t_startf('CNPrecisionControl') - call CNPrecisionControl(bounds, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, & - c14_cnveg_carbonstate_inst, cnveg_nitrogenstate_inst) - call t_stopf('CNPrecisionControl') - end if - - end associate - - end subroutine CNDriverNoLeaching - - !----------------------------------------------------------------------- - subroutine CNDriverLeaching(bounds, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - waterstate_inst, waterflux_inst, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Update the nitrogen leaching rate as a function of soluble mineral N and total soil water outflow. - ! Also update nitrogen state variables - ! - ! !USES: - use SoilBiogeochemNLeachingMod, only: SoilBiogeochemNLeaching - use CNNStateUpdate3Mod , only: NStateUpdate3 - ! - ! !ARGUMENTS: - 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(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - !----------------------------------------------------------------------- - - ! Mineral nitrogen dynamics (deposition, fixation, leaching) - - call t_startf('SoilBiogeochemNLeaching') - call SoilBiogeochemNLeaching(bounds, num_soilc, filter_soilc, & - waterstate_inst, waterflux_inst, soilbiogeochem_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst) - call t_stopf('SoilBiogeochemNLeaching') - - ! Nitrogen state variable update, mortality fluxes. - - call t_startf('NUpdate3') - - call NstateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - - call t_stopf('NUpdate3') - - end subroutine CNDriverLeaching - - !----------------------------------------------------------------------- - subroutine CNDriverSummarizeStates(bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - cnveg_nitrogenstate_inst, & - soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Call to all CN and SoilBiogeochem summary routines, for state variables - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - 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(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - - character(len=*), parameter :: subname = 'CNDriverSummarizeStates' - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - - call t_startf('CNsum') - - ! ---------------------------------------------- - ! soilbiogeochem carbon/nitrogen state summary - ! ---------------------------------------------- - - call soilbiogeochem_carbonstate_inst%summary(bounds, num_allc, filter_allc) - if ( use_c13 ) then - call c13_soilbiogeochem_carbonstate_inst%summary(bounds, num_allc, filter_allc) - end if - if ( use_c14 ) then - call c14_soilbiogeochem_carbonstate_inst%summary(bounds, num_allc, filter_allc) - end if - call soilbiogeochem_nitrogenstate_inst%summary(bounds, num_allc, filter_allc) - - ! ---------------------------------------------- - ! cnveg carbon/nitrogen state summary - ! ---------------------------------------------- - - call cnveg_carbonstate_inst%Summary(bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_cwdc_col=soilbiogeochem_carbonstate_inst%cwdc_col(begc:endc), & - soilbiogeochem_totlitc_col=soilbiogeochem_carbonstate_inst%totlitc_col(begc:endc), & - soilbiogeochem_totsomc_col=soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), & - soilbiogeochem_ctrunc_col=soilbiogeochem_carbonstate_inst%ctrunc_col(begc:endc)) - - if ( use_c13 ) then - call c13_cnveg_carbonstate_inst%Summary(bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_cwdc_col=c13_soilbiogeochem_carbonstate_inst%cwdc_col(begc:endc), & - soilbiogeochem_totlitc_col=c13_soilbiogeochem_carbonstate_inst%totlitc_col(begc:endc), & - soilbiogeochem_totsomc_col=c13_soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), & - soilbiogeochem_ctrunc_col=c13_soilbiogeochem_carbonstate_inst%ctrunc_col(begc:endc)) - end if - - if ( use_c14 ) then - call c14_cnveg_carbonstate_inst%Summary(bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_cwdc_col=c14_soilbiogeochem_carbonstate_inst%cwdc_col(begc:endc), & - soilbiogeochem_totlitc_col=c14_soilbiogeochem_carbonstate_inst%totlitc_col(begc:endc), & - soilbiogeochem_totsomc_col=c14_soilbiogeochem_carbonstate_inst%totsomc_col(begc:endc), & - soilbiogeochem_ctrunc_col=c14_soilbiogeochem_carbonstate_inst%ctrunc_col(begc:endc)) - end if - - call cnveg_nitrogenstate_inst%Summary(bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_nitrogenstate_inst) - - call t_stopf('CNsum') - - end subroutine CNDriverSummarizeStates - - !----------------------------------------------------------------------- - subroutine CNDriverSummarizeFluxes(bounds, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonflux_inst, c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenflux_inst, & - c_products_inst, c13_products_inst, c14_products_inst, & - soilbiogeochem_carbonflux_inst, & - c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Call to all CN and SoilBiogeochem summary routines, for state variables - ! - ! !USES: - use clm_varpar , only: ndecomp_cascade_transitions - ! - ! !ARGUMENTS: - 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(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cn_products_type) , intent(in) :: c_products_inst - type(cn_products_type) , intent(in) :: c13_products_inst - type(cn_products_type) , intent(in) :: c14_products_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - integer :: begg,endg - - character(len=*), parameter :: subname = 'CNDriverSummarizeFluxes' - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg = bounds%endg - - call t_startf('CNsum') - - ! ---------------------------------------------- - ! soilbiogeochem carbon/nitrogen flux summary - ! ---------------------------------------------- - - call soilbiogeochem_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc) - if ( use_c13 ) then - call c13_soilbiogeochem_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc) - end if - if ( use_c14 ) then - call c14_soilbiogeochem_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc) - end if - call soilbiogeochem_nitrogenflux_inst%Summary(bounds, num_soilc, filter_soilc) - - ! ---------------------------------------------- - ! cnveg carbon/nitrogen flux summary - ! ---------------------------------------------- - - call cnveg_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - isotope='bulk', & - soilbiogeochem_hr_col=soilbiogeochem_carbonflux_inst%hr_col(begc:endc), & - soilbiogeochem_lithr_col=soilbiogeochem_carbonflux_inst%lithr_col(begc:endc), & - soilbiogeochem_decomp_cascade_ctransfer_col=& - soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_col(begc:endc,1:ndecomp_cascade_transitions), & - product_closs_grc=c_products_inst%product_loss_grc(begg:endg)) - - if ( use_c13 ) then - call c13_cnveg_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - isotope='c13', & - soilbiogeochem_hr_col=c13_soilbiogeochem_carbonflux_inst%hr_col(begc:endc), & - soilbiogeochem_lithr_col=c13_soilbiogeochem_carbonflux_inst%lithr_col(begc:endc), & - soilbiogeochem_decomp_cascade_ctransfer_col=& - c13_soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_col(begc:endc,1:ndecomp_cascade_transitions), & - product_closs_grc=c13_products_inst%product_loss_grc(begg:endg)) - end if - - if ( use_c14 ) then - call c14_cnveg_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - isotope='c14', & - soilbiogeochem_hr_col=c14_soilbiogeochem_carbonflux_inst%hr_col(begc:endc), & - soilbiogeochem_lithr_col=c14_soilbiogeochem_carbonflux_inst%lithr_col(begc:endc), & - soilbiogeochem_decomp_cascade_ctransfer_col=& - c14_soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_col(begc:endc,1:ndecomp_cascade_transitions), & - product_closs_grc=c14_products_inst%product_loss_grc(begg:endg)) - end if - - call cnveg_nitrogenflux_inst%Summary(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp) - - call t_stopf('CNsum') - - end subroutine CNDriverSummarizeFluxes - -end module CNDriverMod diff --git a/src/biogeochem/CNFUNMod.F90 b/src/biogeochem/CNFUNMod.F90 deleted file mode 100644 index f1adee8f6b..0000000000 --- a/src/biogeochem/CNFUNMod.F90 +++ /dev/null @@ -1,1801 +0,0 @@ -module CNFUNMod -!-------------------------------------------------------------------- - !--- -! ! DESCRIPTION -! ! The FUN model developed by Fisher et al. 2010 and -! ! end Brzostek et al. 2014. Coded by Mingjie Shi 2015. -! ! Coding logic and structure altered by Rosie Fisher. October 2015. -! ! Critically, this removes the 'FUN-resistors' idea of Brzostek et - ! al. 2014 -! ! and replaces it with uptake that is proportional to the N/C - ! exchange rate. -! ! and adjusts the logic so that FUN does not depends upon the - ! CLM4.0 'FPG' downregulation idea -! ! and instead it takes C spent on N uptake away from growth. -! ! The critical output so fthis code are sminn_to_plant_fun and - ! npp_Nuptake, which are the N -! ! available to the plant for grwoth, and the C spent on obtaining - ! it. - -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use PatchType , only : patch - use ColumnType , only : col - use pftconMod , only : pftcon, npcropmin - use decompMod , only : bounds_type - use clm_varctl , only : use_nitrif_denitrif,use_flexiblecn - use abortutils , only : endrun - use CNVegstateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use WaterStateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use TemperatureType , only : temperature_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use perf_mod , only : t_startf, t_stopf - - implicit none - private -! -! !PUBLIC MEMBER FUNCTIONS: - public:: readParams ! Read in parameters needed for FUN - public:: CNFUNInit ! FUN calculation initialization - public:: CNFUN ! Run FUN - - type, private :: params_type - real(r8) :: ndays_on ! number of days to complete leaf onset - real(r8) :: ndays_off ! number of days to complete leaf offset - end type params_type - - ! - type(params_type), private :: params_inst ! params_inst is - ! populated in readParamsMod - ! - ! - ! !PRIVATE DATA MEMBERS: - real(r8) :: dt ! decomp timestep (seconds) - real(r8) :: ndays_on ! number of days to complete onset - real(r8) :: ndays_off ! number of days to complete offset - - integer, private, parameter :: COST_METHOD = 2 !new way of doing the N uptake - ! resistances. see teamwork thread on over-cheap uptake in N - ! resistors. - integer, private, parameter :: nstp = 2 ! Number of - ! calculation part - integer, private, parameter :: ncost6 = 6 ! Number of - ! N transport pathways - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -! -!-------------------------------------------------------------------- - !--- - contains -!-------------------------------------------------------------------- - !--- - subroutine readParams ( ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNFUNParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading -!-------------------------------------------------------------------- - !--- - - ! read in parameters - - tString='ndays_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_on=tempr - - tString='ndays_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_off=tempr - - - end subroutine readParams - -!-------------------------------------------------------------------- - !--- - subroutine CNFUNInit (bounds,cnveg_state_inst,cnveg_carbonstate_inst,cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! - ! !USES: - use clm_varcon , only: secspday, fun_period - use clm_time_manager, only: get_step_size,get_nstep,get_curr_date,get_days_per_year - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type), intent(inout) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: dayspyr ! days per year (days) - real(r8) :: timestep_fun ! Timestep length for - ! FUN (s) - real(r8) :: numofyear ! number of days per - ! year - integer :: nstep ! time step number - integer :: nstep_fun ! Number of - ! atmospheric timesteps between calls to FUN - character(len=32) :: subname = 'CNFUNInit' -!-------------------------------------------------------------------- - !--- - -! Set local pointers - associate(ivt => patch%itype , & ! Input: [integer (:) ] p - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - leafcn_offset => cnveg_state_inst%leafcn_offset_patch , & ! Output: - ! [real(r8) (:) ] Leaf C:N used by FUN - leafc_storage_xfer_acc => cnveg_carbonstate_inst%leafc_storage_xfer_acc_patch , & ! Output: [real(r8) (:) - ! ] Accmulated leaf C transfer (gC/m2) - storage_cdemand => cnveg_carbonstate_inst%storage_cdemand_patch , & ! Output: [real(r8) (:) - ! ] C use from the C storage pool - leafn_storage_xfer_acc => cnveg_nitrogenstate_inst%leafn_storage_xfer_acc_patch, & ! Output: [real(r8) (:) - ! ] Accmulated leaf N transfer (gC/m2) - storage_ndemand => cnveg_nitrogenstate_inst%storage_ndemand_patch & ! Output: [real(r8) (:) - ! ] N demand during the offset period - ) - !-------------------------------------------------------------------- - !--- - ! Calculate some timestep-related values. - !-------------------------------------------------------------------- - !--- - ! set time steps - dt = real(get_step_size(), r8) - dayspyr = get_days_per_year() - nstep = get_nstep() - timestep_fun = real(secspday * fun_period) - nstep_fun = int(secspday * dayspyr / dt) - - ndays_on = params_inst%ndays_on - ndays_off = params_inst%ndays_off - - !-------------------------------------------------------------------- - !--- - ! Decide if FUN will be called on this timestep. - !-------------------------------------------------------------------- - !--- - numofyear = nstep/nstep_fun - if (mod(nstep,nstep_fun) == 0) then - leafcn_offset(bounds%begp:bounds%endp) = leafcn(ivt(bounds%begp:bounds%endp)) - storage_cdemand(bounds%begp:bounds%endp) = 0._r8 - storage_ndemand(bounds%begp:bounds%endp) = 0._r8 - leafn_storage_xfer_acc(bounds%begp:bounds%endp) = 0._r8 - leafc_storage_xfer_acc(bounds%begp:bounds%endp) = 0._r8 - end if -!-------------------------------------------------------------------- - !--- - end associate - end subroutine CNFUNInit -!-------------------------------------------------------------------- - !--- - - !-------------------------------------------------------------------- - !--- - ! Start the CNFUN subroutine - !-------------------------------------------------------------------- - !--- - subroutine CNFUN(bounds,num_soilc, filter_soilc,num_soilp& - &,filter_soilp,waterstate_inst ,& - & waterflux_inst,temperature_inst,soilstate_inst& - &,cnveg_state_inst,cnveg_carbonstate_inst,& - & cnveg_carbonflux_inst,cnveg_nitrogenstate_inst& - &,cnveg_nitrogenflux_inst ,& - & soilbiogeochem_nitrogenflux_inst& - &,soilbiogeochem_carbonflux_inst,canopystate_inst,& - & soilbiogeochem_nitrogenstate_inst) - -! !USES: - use clm_time_manager, only : get_step_size, get_curr_date, get_days_per_year - use clm_varpar , only : nlevdecomp - use clm_varcon , only : secspday, smallValue, fun_period, tfrz, dzsoi_decomp, spval - use clm_varctl , only : use_nitrif_denitrif - use PatchType , only : patch - use subgridAveMod , only : p2c - use pftconMod , only : npcropmin -! -! !ARGUMENTS: - 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(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(temperature_type) , intent(in) :: temperature_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - ! local pointers to implicit in arrays - ! - !-------------------------------------------------------------------- - ! ------------ - ! Integer parameters - !-------------------------------------------------------------------- - !----------- - integer, parameter :: icostFix = 1 ! Process - ! number for fixing. - integer, parameter :: icostRetrans = 2 ! Process - ! number for retranslocation. - integer, parameter :: icostActiveNO3 = 3 ! Process - ! number for mycorrhizal uptake of NO3. - integer, parameter :: icostActiveNH4 = 4 ! Process - ! number for mycorrhizal uptake of NH4 - integer, parameter :: icostnonmyc_no3 = 5 ! Process - ! number for nonmyc uptake of NO3. - integer, parameter :: icostnonmyc_nh4 = 6 ! Process - ! number for nonmyc uptake of NH4. - real(r8), parameter :: big_cost = 1000000000._r8! An arbitrarily large cost - - ! array index when plant is fixing - integer, parameter :: plants_are_fixing = 1 - integer, parameter :: plants_not_fixing = 2 - - ! array index for ECM step versus AM step - integer, parameter :: ecm_step = 1 - integer, parameter :: am_step = 2 - ! arbitrary large cost (gC/gN). - !-------------------------------------------------------------------- - !----------------------------------------------- - ! Local Real variables. - !-------------------------------------------------------------------- - !----------------------------------------------- - real(r8) :: excess ! excess N taken up by transpiration (gN/m2) - real(r8) :: steppday ! model time steps in each day (-) - real(r8) :: rootc_dens_step ! root C for each PFT in each soil layer(gC/m2) - real(r8) :: retrans_limit1 ! a temporary variable for leafn (gN/m2) - real(r8) :: qflx_tran_veg_layer ! transpiration in each soil layer (mm H2O/S) - real(r8) :: dn ! Increment of N (gN/m2) - real(r8) :: dn_retrans ! Increment of N (gN/m2) - real(r8) :: dnpp ! Increment of NPP (gC/m2) - real(r8) :: dnpp_retrans ! Increment of NPP (gC/m2) - real(r8) :: rootc_dens(bounds%begp:bounds%endp,1:nlevdecomp) ! the root carbon density (gC/m2) - real(r8) :: rootC(bounds%begp:bounds%endp) ! root biomass (gC/m2) - real(r8) :: permyc(bounds%begp:bounds%endp,1:nstp) ! the arrary for the ECM and AM ratio (-) - real(r8) :: kc_active(bounds%begp:bounds%endp,1:nstp) ! the kc_active parameter (gC/m2) - real(r8) :: kn_active(bounds%begp:bounds%endp,1:nstp) ! the kn_active parameter (gC/m2) - real(r8) :: availc_pool(bounds%begp:bounds%endp) ! The avaible C pool for allocation (gC/m2) - real(r8) :: plantN(bounds%begp:bounds%endp) ! Plant N (gN/m2) - real(r8) :: plant_ndemand_pool(bounds%begp:bounds%endp) ! The N demand pool (gN/m2) - real(r8) :: plant_ndemand_pool_step(bounds%begp:bounds%endp,1:nstp) ! the N demand pool (gN/m2) - real(r8) :: leafn_step(bounds%begp:bounds%endp,1:nstp) ! N loss based for deciduous trees (gN/m2) - real(r8) :: leafn_retrans_step(bounds%begp:bounds%endp,1:nstp) ! N loss based for deciduous trees (gN/m2) - real(r8) :: litterfall_n(bounds%begp:bounds%endp) ! N loss based on the leafc to litter (gN/m2) - real(r8) :: litterfall_n_step(bounds%begp:bounds%endp,1:nstp) ! N loss based on the leafc to litter (gN/m2) - real(r8) :: litterfall_c_step(bounds%begp:bounds%endp,1:nstp) ! N loss based on the leafc to litter (gN/m2) - real(r8) :: tc_soisno(bounds%begc:bounds%endc,1:nlevdecomp) ! Soil temperature (degrees Celsius) - real(r8) :: npp_remaining(bounds%begp:bounds%endp,1:nstp) ! A temporary variable for npp_remaining(gC/m2) - real(r8) :: n_passive_step(bounds%begp:bounds%endp,1:nstp) ! N taken up by transpiration at substep(gN/m2) - real(r8) :: n_passive_acc(bounds%begp:bounds%endp) ! N acquired by passive uptake (gN/m2) - real(r8) :: cost_retran(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of retran (gC/gN) - real(r8) :: cost_fix(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of fixation (gC/gN) - real(r8) :: cost_resis(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of resis (gC/gN) - real(r8) :: cost_res_resis(bounds%begp:bounds%endp,1:nlevdecomp) ! The cost of resis (gN/gC) - real(r8) :: n_fix_acc(bounds%begp:bounds%endp,1:nstp) ! N acquired by fixation (gN/m2) - real(r8) :: n_fix_acc_total(bounds%begp:bounds%endp) ! N acquired by fixation (gN/m2) - real(r8) :: npp_fix_acc(bounds%begp:bounds%endp,1:nstp) ! Amount of NPP used by fixation (gC/m2) - real(r8) :: npp_fix_acc_total(bounds%begp:bounds%endp) ! Amount of NPP used by fixation (gC/m2) - real(r8) :: n_retrans_acc(bounds%begp:bounds%endp,1:nstp) ! N acquired by retranslocation (gN/m2) - real(r8) :: n_retrans_acc_total(bounds%begp:bounds%endp) ! N acquired by retranslocation (gN/m2) - real(r8) :: free_nretrans_acc(bounds%begp:bounds%endp,1:nstp) ! N acquired by retranslocation (gN/m2) - real(r8) :: npp_retrans_acc(bounds%begp:bounds%endp,1:nstp) ! NPP used for the extraction (gC/m2) - real(r8) :: npp_retrans_acc_total(bounds%begp:bounds%endp) ! NPP used for the extraction (gC/m2) - real(r8) :: nt_uptake(bounds%begp:bounds%endp,1:nstp) ! N uptake from retrans, active, and fix(gN/m2) - real(r8) :: npp_uptake(bounds%begp:bounds%endp,1:nstp) ! NPP used by the uptakes (gC/m2) - - !----------NITRIF_DENITRIF-------------! - - real(r8) :: sminn_no3_diff ! A temporary limit for N uptake (gN/m2) - real(r8) :: sminn_nh4_diff ! A temporary limit for N uptake (gN/m2) - real(r8) :: active_no3_limit1 ! A temporary limit for N uptake (gN/m2) - real(r8) :: active_nh4_limit1 ! A temporary limit for N uptake (gN/m2) - real(r8) :: cost_active_no3(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of mycorrhizal (gC/gN) - real(r8) :: cost_active_nh4(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of mycorrhizal (gC/gN) - real(r8) :: cost_nonmyc_no3(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of nonmyc (gC/gN) - real(r8) :: cost_nonmyc_nh4(bounds%begp:bounds%endp,1:nlevdecomp) ! cost of nonmyc (gC/gN) - - real(r8) :: sminn_no3_conc(bounds%begc:bounds%endc,1:nlevdecomp) ! Concentration of no3 in soil water (gN/gH2O) - real(r8) :: sminn_no3_conc_step(bounds%begp:bounds%endp,1:nlevdecomp,1:nstp) ! A temporary variable for soil mineral N (gN/gH2O) - real(r8) :: sminn_no3_layer(bounds%begc:bounds%endc,1:nlevdecomp) ! Available no3 in each soil layer (gN/m2) - real(r8) :: sminn_no3_layer_step(bounds%begp:bounds%endp,1:nlevdecomp,1:nstp)! A temporary variable for soil no3 (gN/m2) - real(r8) :: sminn_no3_uptake(bounds%begp:bounds%endp,1:nlevdecomp,1:nstp) ! A temporary variable for soil mineral N (gN/m2/s) - real(r8) :: sminn_nh4_conc(bounds%begc:bounds%endc,1:nlevdecomp) ! Concentration of nh4 in soil water (gN/gH2O) - real(r8) :: sminn_nh4_conc_step(bounds%begp:bounds%endp,1:nlevdecomp,1:nstp) ! A temporary variable for soil mineral N (gN/gH2O) - real(r8) :: sminn_nh4_layer(bounds%begc:bounds%endc,1:nlevdecomp) ! Available nh4 in each soil layer (gN/m2) - real(r8) :: sminn_nh4_layer_step(bounds%begp:bounds%endp,1:nlevdecomp,1:nstp)! A temporary variable for soil mineral N (gN/m2) - real(r8) :: sminn_nh4_uptake(bounds%begp:bounds%endp,1:nlevdecomp,1:nstp) ! A temporary variable for soil mineral N (gN/m2/s) - - real(r8) :: active_no3_uptake1(bounds%begp:bounds%endp,1:nlevdecomp) ! no3 mycorrhizal uptake (gN/m2) - real(r8) :: active_nh4_uptake1(bounds%begp:bounds%endp,1:nlevdecomp) ! nh4 mycorrhizal uptake (gN/m2) - real(r8) :: nonmyc_no3_uptake1(bounds%begp:bounds%endp,1:nlevdecomp) ! no3 non-mycorrhizal uptake (gN/m2) - real(r8) :: nonmyc_nh4_uptake1(bounds%begp:bounds%endp,1:nlevdecomp) ! nh4 non-mycorrhizal uptake (gN/m2) - real(r8) :: active_no3_uptake2(bounds%begp:bounds%endp,1:nlevdecomp) ! no3 mycorrhizal uptake (gN/m2) - real(r8) :: active_nh4_uptake2(bounds%begp:bounds%endp,1:nlevdecomp) ! nh4 mycorrhizal uptake (gN/m2) - real(r8) :: nonmyc_no3_uptake2(bounds%begp:bounds%endp,1:nlevdecomp) ! no3 non-mycorrhizal uptake (gN/m2) - real(r8) :: nonmyc_nh4_uptake2(bounds%begp:bounds%endp,1:nlevdecomp) ! nh4 non-mycorrhizal uptake (gN/m2) - real(r8) :: n_am_no3_acc(bounds%begp:bounds%endp) ! AM no3 uptake (gN/m2) - real(r8) :: n_am_nh4_acc(bounds%begp:bounds%endp) ! AM nh4 uptake (gN/m2) - real(r8) :: n_ecm_no3_acc(bounds%begp:bounds%endp) ! ECM no3 uptake (gN/m2) - real(r8) :: n_ecm_nh4_acc(bounds%begp:bounds%endp) ! ECM nh4 uptake (gN/m2) - real(r8) :: n_active_no3_acc(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal no3 uptake (gN/m2) - real(r8) :: n_active_nh4_acc(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal nh4 uptake (gN/m2) - real(r8) :: n_nonmyc_no3_acc(bounds%begp:bounds%endp,1:nstp) ! Non-myc no3 uptake (gN/m2) - real(r8) :: n_nonmyc_nh4_acc(bounds%begp:bounds%endp,1:nstp) ! Non-myc nh4 uptake (gN/m2) - real(r8) :: n_active_no3_acc_total(bounds%begp:bounds%endp) ! Mycorrhizal no3 uptake (gN/m2) - real(r8) :: n_active_nh4_acc_total(bounds%begp:bounds%endp) ! Mycorrhizal no3 uptake (gN/m2) - - real(r8) :: n_nonmyc_no3_acc_total(bounds%begp:bounds%endp) ! Non-myc no3 uptake (gN/m2) - real(r8) :: n_nonmyc_nh4_acc_total(bounds%begp:bounds%endp) ! Non-myc no3 uptake (gN/m2) - real(r8) :: npp_active_no3_acc(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal no3 uptake used C (gC/m2) - real(r8) :: npp_active_nh4_acc(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal nh4 uptake used C (gC/m2) - real(r8) :: npp_nonmyc_no3_acc(bounds%begp:bounds%endp,1:nstp) ! Non-myc no3 uptake used C (gC/m2) - real(r8) :: npp_nonmyc_nh4_acc(bounds%begp:bounds%endp,1:nstp) ! Non-myc nh4 uptake used C (gC/m2) - real(r8) :: npp_active_no3_acc_total(bounds%begp:bounds%endp) ! Mycorrhizal no3 uptake used C (gC/m2) - real(r8) :: npp_active_nh4_acc_total(bounds%begp:bounds%endp) ! Mycorrhizal nh4 uptake used C (gC/m2) - real(r8) :: npp_nonmyc_no3_acc_total(bounds%begp:bounds%endp) ! Non-myc no3 uptake used C (gC/m2) - real(r8) :: npp_nonmyc_nh4_acc_total(bounds%begp:bounds%endp) ! Non-myc nh4 uptake used C (gC/m2) - real(r8) :: n_am_no3_retrans(bounds%begp:bounds%endp) ! AM no3 uptake for offset (gN/m2) - real(r8) :: n_am_nh4_retrans(bounds%begp:bounds%endp) ! AM nh4 uptake for offset (gN/m2) - real(r8) :: n_ecm_no3_retrans(bounds%begp:bounds%endp) ! ECM no3 uptake for offset (gN/m2) - real(r8) :: n_ecm_nh4_retrans(bounds%begp:bounds%endp) ! ECM nh4 uptake for offset (gN/m2) - real(r8) :: n_active_no3_retrans(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal no3 for offset (gN/m2) - real(r8) :: n_active_nh4_retrans(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal nh4 for offset (gN/m2) - real(r8) :: n_nonmyc_no3_retrans(bounds%begp:bounds%endp,1:nstp) ! Non-myc no3 for offset (gN/m2) - real(r8) :: n_nonmyc_nh4_retrans(bounds%begp:bounds%endp,1:nstp) ! Non-myc nh4 for offset (gN/m2) - real(r8) :: n_active_no3_retrans_total(bounds%begp:bounds%endp) ! Mycorrhizal no3 for offset (gN/m2) - real(r8) :: n_active_nh4_retrans_total(bounds%begp:bounds%endp) ! Mycorrhizal nh4 for offset (gN/m2) - real(r8) :: n_nonmyc_no3_retrans_total(bounds%begp:bounds%endp) ! Non-myc no3 for offset (gN/m2) - real(r8) :: n_nonmyc_nh4_retrans_total(bounds%begp:bounds%endp) ! Non-myc nh4 for offset (gN/m2) - real(r8) :: n_passive_no3_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer passive no3 uptake (gN/m2) - real(r8) :: n_passive_nh4_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer passive nh4 uptake (gN/m2) - real(r8) :: n_fix_no3_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer fixation no3 uptake (gN/m2) - real(r8) :: n_fix_nh4_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer fixation nh4 uptake (gN/m2) - real(r8) :: n_active_no3_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer mycorrhizal no3 uptake (gN/m2) - real(r8) :: n_nonmyc_no3_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer non-myc no3 uptake (gN/m2) - real(r8) :: n_active_nh4_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer mycorrhizal nh4 uptake (gN/m2) - real(r8) :: n_nonmyc_nh4_vr(bounds%begp:bounds%endp,1:nlevdecomp) ! Layer non-myc nh4 uptake (gN/m2) - real(r8) :: npp_active_no3_retrans(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal no3 uptake used C for offset (gN/m2) - real(r8) :: npp_active_nh4_retrans(bounds%begp:bounds%endp,1:nstp) ! Mycorrhizal nh4 uptake used C for offset (gN/m2) - real(r8) :: npp_nonmyc_no3_retrans(bounds%begp:bounds%endp,1:nstp) ! Non-myc no3 uptake used C for offset (gN/m2) - real(r8) :: npp_nonmyc_nh4_retrans(bounds%begp:bounds%endp,1:nstp) ! Non-myc nh4 uptake used C for offset (gN/m2) - real(r8) :: npp_active_no3_retrans_total(bounds%begp:bounds%endp) ! Mycorrhizal no3 uptake used C for offset (gN/m2) - real(r8) :: npp_active_nh4_retrans_total(bounds%begp:bounds%endp) ! Mycorrhizal nh4 uptake used C for offset (gN/m2) - real(r8) :: npp_nonmyc_no3_retrans_total(bounds%begp:bounds%endp) ! Non-myc no3 uptake used C for offset (gN/m2) - real(r8) :: npp_nonmyc_nh4_retrans_total(bounds%begp:bounds%endp) ! Non-myc nh4 uptake used C for offset (gN/m2) - - - real(r8) :: costNit(1:nlevdecomp,ncost6) ! Cost of N via each process (gC/gN) - - ! Uptake fluxes for COST_METHOD=2 - ! actual npp to each layer for each uptake process - real(r8) :: npp_to_fixation(1:nlevdecomp) - real(r8) :: npp_to_retrans(1:nlevdecomp) - real(r8) :: npp_to_active_nh4(1:nlevdecomp) - real(r8) :: npp_to_nonmyc_nh4(1:nlevdecomp) - real(r8) :: npp_to_active_no3(1:nlevdecomp) - real(r8) :: npp_to_nonmyc_no3 (1:nlevdecomp) - - ! fraction of carbon to each uptake process - real(r8) :: npp_frac_to_fixation(1:nlevdecomp) - real(r8) :: npp_frac_to_retrans(1:nlevdecomp) - real(r8) :: npp_frac_to_active_nh4(1:nlevdecomp) - real(r8) :: npp_frac_to_nonmyc_nh4(1:nlevdecomp) - real(r8) :: npp_frac_to_active_no3(1:nlevdecomp) - real(r8) :: npp_frac_to_nonmyc_no3 (1:nlevdecomp) - - ! hypothetical fluxes on N in each layer - real(r8) :: n_exch_fixation(1:nlevdecomp) ! N aquired from one unit of C for fixation (unitless) - real(r8) :: n_exch_retrans(1:nlevdecomp) ! N aquired from one unit of C for retrans (unitless) - real(r8) :: n_exch_active_nh4(1:nlevdecomp) ! N aquired from one unit of C for act nh4(unitless) - real(r8) :: n_exch_nonmyc_nh4(1:nlevdecomp) ! N aquired from one unit of C for nonmy nh4 (unitless) - real(r8) :: n_exch_active_no3(1:nlevdecomp) ! N aquired from one unit of C for act no3 (unitless) - real(r8) :: n_exch_nonmyc_no3(1:nlevdecomp) ! N aquired from one unit of C for nonmyc no3 (unitless) - - !actual fluxes of N in each layer - real(r8) :: n_from_fixation(1:nlevdecomp) ! N aquired in each layer for fixation (gN m-2 s-1) - real(r8) :: n_from_retrans(1:nlevdecomp) ! N aquired in each layer of C for retrans (gN m-2 s-1) - real(r8) :: n_from_active_nh4(1:nlevdecomp) ! N aquired in each layer of C for act nh4 (gN m-2 s-1) - real(r8) :: n_from_nonmyc_nh4(1:nlevdecomp) ! N aquired in each layer of C for nonmy nh4 (gN m-2 s-1) - real(r8) :: n_from_active_no3(1:nlevdecomp) ! N aquired in each layer of C for act no3 (gN m-2 s-1) - real(r8) :: n_from_nonmyc_no3(1:nlevdecomp) ! N aquired in each layer of C for nonmyc no3 (gN m-2 s-1) - - real(r8) :: free_Nretrans(bounds%begp:bounds%endp) ! the total amount of NO3 and NH4 (gN/m3/s) - - ! Uptake fluxes for COST_METHOD=2 - !actual fluxes of N in each layer - real(r8) :: frac_ideal_C_use ! How much less C do we use for 'buying' N than that - ! needed to get to the ideal ratio? fraction. - - real(r8) :: N_acquired - real(r8) :: C_spent - real(r8) :: leaf_narea ! leaf n per unit leaf - ! area in gN/m2 (averaged across canopy, which is OK for the cost - ! calculation) - - - real(r8) :: sum_n_acquired ! Sum N aquired from one unit of C (unitless) - real(r8) :: burned_off_carbon ! carbon wasted by poor allocation algorithm. If - ! this is too big, we need a better iteration. - real(r8) :: temp_n_flux - real(r8) :: delta_cn ! difference between 'ideal' leaf CN ration and - ! actual leaf C:N ratio. C/N - real(r8) :: excess_carbon ! how much carbon goes into the leaf C - ! pool on account of the flexibleCN modifications. - real(r8) :: excess_carbon_acc ! excess accumulated over layers. - ! WITHOUT GROWTH RESP - real(r8) :: fixerfrac ! what fraction of plants can fix? - real(r8) :: npp_to_spend ! how much carbon do we need to get - ! rid of? - real(r8) :: soil_n_extraction ! calculates total N pullled from - ! soil - real(r8) :: total_N_conductance !inverse of C to of N for whole soil - ! -leaf pathway - real(r8) :: total_N_resistance ! C to of N for whole soil -leaf - ! pathway - real(r8) :: free_RT_frac=0.0_r8 !fraction of N retranslocation which is automatic/free. - ! SHould be made into a PFT parameter. - - real(r8) :: paid_for_n_retrans - real(r8) :: free_n_retrans - real(r8) :: total_c_spent_retrans - real(r8) :: total_c_accounted_retrans - - - !------end of not_use_nitrif_denitrif------! - !-------------------------------------------------------------------- - !------------ - ! Local Integer variables - !-------------------------------------------------------------------- - !------------ - integer :: fn ! number of values - ! in pft filter - integer :: fp ! lake filter pft - ! index - integer :: fc ! lake filter column - ! index - integer :: p, c ! pft index - integer :: g, l ! indices - integer :: j, i, k ! soil/snow level - ! index - integer :: istp ! Loop counters/work - integer :: icost ! a local index - integer :: fixer ! 0 = non-fixer, 1 - ! =fixer - logical :: unmetDemand ! True while there - ! is still demand for N - logical :: local_use_flexibleCN ! local version of use_flexCN - integer :: FIX ! for loop. 1 for - ! fixers, 2 for non fixers. This will become redundant with the - ! 'fixer' parameter if it works. - - !-------------------------------------------------------------------- - !--------------------------------- - associate(ivt => patch%itype , & ! Input: [integer (:) ] p - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) - season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal - ! -deciduous leaf habit (0 or 1) - stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress - ! -deciduous leaf habit (0 or 1) - a_fix => pftcon%a_fix , & ! Input: A BNF parameter - b_fix => pftcon%b_fix , & ! Input: A BNF parameter - c_fix => pftcon%c_fix , & ! Input: A BNF parameter - s_fix => pftcon%s_fix , & ! Input: A BNF parameter - akc_active => pftcon%akc_active , & ! Input: A mycorrhizal uptake - ! parameter - akn_active => pftcon%akn_active , & ! Input: A mycorrhizal uptake - ! parameter - ekc_active => pftcon%ekc_active , & ! Input: A mycorrhizal uptake - ! parameter - ekn_active => pftcon%ekn_active , & ! Input: A mycorrhizal upatke - ! parameter - kc_nonmyc => pftcon%kc_nonmyc , & ! Input: A non-mycorrhizal uptake - ! parameter - kn_nonmyc => pftcon%kn_nonmyc , & ! Input: A non-mycorrhizal uptake - ! parameter - perecm => pftcon%perecm , & ! Input: The fraction of ECM - ! -associated PFT - grperc => pftcon%grperc , & ! Input: growth percentage - fun_cn_flex_a => pftcon%fun_cn_flex_a , & ! Parameter a of FUN-flexcn link code (def 5) - fun_cn_flex_b => pftcon%fun_cn_flex_b , & ! Parameter b of FUN-flexcn link code (def 200) - fun_cn_flex_c => pftcon%fun_cn_flex_c , & ! Parameter b of FUN-flexcn link code (def 80) - FUN_fracfixers => pftcon%FUN_fracfixers , & ! Fraction of C that can be used for fixation. - leafcn_offset => cnveg_state_inst%leafcn_offset_patch , & ! Output: - ! [real(r8) (:)] Leaf C:N used by FUN - plantCN => cnveg_state_inst%plantCN_patch , & ! Output: [real(r8) (:)] Plant - ! C:N used by FUN - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:)] onset - ! flag - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:)] offset - ! flag - availc => cnveg_carbonflux_inst%availc_patch , & ! Iutput: [real(r8) (:)] C flux - ! available for allocation (gC/m2/s) - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:)] (gC/m2) - ! leaf C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) - ! (:)] (gC/m2) leaf C storage - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) - ! (:)] (gC/m2) fine root C - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) - ! (:)] (gC/m2) fine root C storage - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) - ! (:)] (gC/m2) live stem C - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) - ! (:)] (gC/m2) live coarse root C - leafc_storage_xfer_acc => cnveg_carbonstate_inst%leafc_storage_xfer_acc_patch , & ! uutput: [real(r8) - ! (:)] Accmulated leaf C transfer (gC/m2) - storage_cdemand => cnveg_carbonstate_inst%storage_cdemand_patch , & ! Output: [real(r8) - ! (:)] C use f rom the C storage pool - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one - ! -sided leaf area index - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:)] - ! (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:)] - ! (gN/m2) fine root N - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:)] - ! (gN/m2) live stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:)] - ! (gN/m2) live coarse root N - leafn_storage_xfer_acc => cnveg_nitrogenstate_inst%leafn_storage_xfer_acc_patch, & ! Output: [real(r8) (:)] - ! Accmulated leaf N transfer (gC/m2) - storage_ndemand => cnveg_nitrogenstate_inst%storage_ndemand_patch , & ! Output: [real(r8) (:)] - ! N demand during the offset period - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) - ! (:) ] leaf C litterfall (gC/m2/s) - leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch , & ! Output: [real(r8) - ! (:) ] leaf C litterfall used by FUN (gC/m2/s) - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) - ! ] previous timestep leaf C litterfall flux (gC/m2/s) - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) - ! (:) ] - npp_Nactive => cnveg_carbonflux_inst%npp_Nactive_patch , & ! Output: [real(r8) - ! (:) ] Mycorrhizal N uptake used C (gC/m2/s) - npp_Nnonmyc => cnveg_carbonflux_inst%npp_Nnonmyc_patch , & ! Output: [real(r8) - ! (:) ] Non-mycorrhizal N uptake use C (gC/m2/s) - npp_Nam => cnveg_carbonflux_inst%npp_Nam_patch , & ! Output: [real(r8) - ! (:) ] AM uptake use C (gC/m2/s) - npp_Necm => cnveg_carbonflux_inst%npp_Necm_patch , & ! Output: [real(r8) - ! (:) ] ECM uptake use C (gC/m2/s) - npp_Nactive_no3 => cnveg_carbonflux_inst%npp_Nactive_no3_patch , & ! Output: [real(r8) - ! (:) ] Mycorrhizal N uptake used C (gC/m2/s) - npp_Nnonmyc_no3 => cnveg_carbonflux_inst%npp_Nnonmyc_no3_patch , & ! Output: [real(r8) - ! (:) ] Non-myco uptake use C (gC/m2/s) rrhizal N uptake - ! (gN/m2/s) - npp_Nam_no3 => cnveg_carbonflux_inst%npp_Nam_no3_patch , & ! Output: [real(r8) - ! (:) ] AM uptake use C (gC/m2/s) - npp_Necm_no3 => cnveg_carbonflux_inst%npp_Necm_no3_patch , & ! Output: [real(r8) - ! (:) ] ECM uptake use C (gC/m2/s) - npp_Nactive_nh4 => cnveg_carbonflux_inst%npp_Nactive_nh4_patch , & ! Output: [real(r8) - ! (:) ] Mycorrhizal N uptake used C (gC/m2/s) - npp_Nnonmyc_nh4 => cnveg_carbonflux_inst%npp_Nnonmyc_nh4_patch , & ! Output: [real(r8) - ! (:) ] Non-mycorrhizal N uptake used C (gC/m2/s) - npp_Nam_nh4 => cnveg_carbonflux_inst%npp_Nam_nh4_patch , & ! Output: [real(r8) - ! (:) ] AM uptake used C(gC/m2/s) - npp_Necm_nh4 => cnveg_carbonflux_inst%npp_Necm_nh4_patch , & ! Output: [real(r8) - ! (:) ] ECM uptake used C (gC/m2/s) - npp_Nfix => cnveg_carbonflux_inst%npp_Nfix_patch , & ! Output: [real(r8) - ! (:) ] Symbiotic BNF used C (gC/m2/s) - npp_Nretrans => cnveg_carbonflux_inst%npp_Nretrans_patch , & ! Output: [real(r8) - ! (:) ] Retranslocation N uptake used C (gC/m2/s) - npp_Nuptake => cnveg_carbonflux_inst%npp_Nuptake_patch , & ! Output: [real(r8) - ! (:) ] Total N uptake of FUN used C (gC/m2/s) - npp_growth => cnveg_carbonflux_inst%npp_growth_patch , & ! Output: [real(r8) - ! (:) ] Total N uptake of FUN used C (gC/m2/s) - burnedoff_carbon => cnveg_carbonflux_inst%npp_burnedoff_patch , & ! Output: [real(r8) - ! (:) ] C that cannot be used for N uptake(gC/m2/s) - leafc_change => cnveg_carbonflux_inst%leafc_change_patch , & ! Output: [real(r8) - ! (:) ] Used C from the leaf (gC/m2/s) - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Iutput: [real(r8) (:) - ! ] N flux required to support initial GPP (gN/m2/s) - plant_ndemand_retrans => cnveg_nitrogenflux_inst%plant_ndemand_retrans_patch , & ! Output: [real(r8) (:) - ! ] N demand generated for FUN (gN/m2/s) - plant_ndemand_season => cnveg_nitrogenflux_inst%plant_ndemand_season_patch , & ! Output: [real(r8) (:) - ! ] N demand for seasonal deciduous forest (gN/m2/s) - plant_ndemand_stress => cnveg_nitrogenflux_inst%plant_ndemand_stress_patch , & ! Output: [real(r8) (:) - ! ] N demand for stress deciduous forest (gN/m2/s) - Nactive => cnveg_nitrogenflux_inst%Nactive_patch , & ! Output: [real(r8) (:) - ! ] Mycorrhizal N uptake (gN/m2/s) - Nnonmyc => cnveg_nitrogenflux_inst%Nnonmyc_patch , & ! Output: [real(r8) (:) - ! ] Non-mycorrhizal N uptake (gN/m2/s) - Nam => cnveg_nitrogenflux_inst%Nam_patch , & ! Output: [real(r8) (:) ] AM - ! uptake (gN/m2/s) - Necm => cnveg_nitrogenflux_inst%Necm_patch , & ! Output: [real(r8) (:) ] ECM - ! uptake (gN/m2/s) - Nactive_no3 => cnveg_nitrogenflux_inst%Nactive_no3_patch , & ! Output: [real(r8) (:) - ! ] Mycorrhizal N uptake (gN/m2/s) - Nnonmyc_no3 => cnveg_nitrogenflux_inst%Nnonmyc_no3_patch , & ! Output: [real(r8) (:) - ! ] Non-mycorrhizal N uptake (gN/m2/s) - Nam_no3 => cnveg_nitrogenflux_inst%Nam_no3_patch , & ! Output: [real(r8) (:) - ! ] AM uptake (gN/m2/s) - Necm_no3 => cnveg_nitrogenflux_inst%Necm_no3_patch , & ! Output: [real(r8) (:) - ! ] ECM uptake (gN/m2/s) - Nactive_nh4 => cnveg_nitrogenflux_inst%Nactive_nh4_patch , & ! Output: [real(r8) (:) - ! ] Mycorrhizal N uptake (gN/m2/s) - Nnonmyc_nh4 => cnveg_nitrogenflux_inst%Nnonmyc_nh4_patch , & ! Output: [real(r8) (:) - ! ] Non-mycorrhizal N uptake (gN/m2/s) - Nam_nh4 => cnveg_nitrogenflux_inst%Nam_nh4_patch , & ! Output: [real(r8) (:) - ! ] AM uptake (gN/m2/s) - Necm_nh4 => cnveg_nitrogenflux_inst%Necm_nh4_patch , & ! Output: [real(r8) (:) - ! ] ECM uptake (gN/m2/s) - Npassive => cnveg_nitrogenflux_inst%Npassive_patch , & ! Output: [real(r8) (:) - ! ] Passive N uptake (gN/m2/s) - Nfix => cnveg_nitrogenflux_inst%Nfix_patch , & ! Output: [real(r8) (:) ] - ! Symbiotic BNF (gN/m2/s) - cost_nfix => cnveg_nitrogenflux_inst%cost_Nfix_patch , & ! Output: [real(r8) (:) - ! ] Cost of fixation gC:gN - cost_nactive => cnveg_nitrogenflux_inst%cost_Nactive_patch , & ! Output: [real(r8) (:) ] - ! Cost of active uptake gC:gN - cost_nretrans => cnveg_nitrogenflux_inst%cost_Nretrans_patch , & ! Output: [real(r8) (:) ] - ! Cost of retranslocation gC:gN - nuptake_npp_fraction_patch => cnveg_nitrogenflux_inst%nuptake_npp_fraction_patch , & ! Output: [real(r8) (:) - ! ] frac of NPP in NUPTAKE - - c_allometry => cnveg_state_inst%c_allometry_patch , & ! Output: [real(r8) (:) ] C - ! allocation index (DIM) - n_allometry => cnveg_state_inst%n_allometry_patch , & ! Output: [real(r8) (:) ] N - ! allocation index (DIM) - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) - ! ] (gN/m2) leaf N store - nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col , & ! Output: [real(r8) (:)] - ! symbiotic/asymbiotic N fixation to soil mineral N (gN/m2 - ! /s) - Nretrans => cnveg_nitrogenflux_inst%Nretrans_patch , & ! Output: [real(r8) (:) - ! ] Retranslocation N uptake (gN/m2/s) - Nretrans_season => cnveg_nitrogenflux_inst%Nretrans_season_patch , & ! Output: [real(r8) (:) - ! ] Retranslocation N uptake (gN/m2/s) - Nretrans_stress => cnveg_nitrogenflux_inst%Nretrans_stress_patch , & ! Output: [real(r8) (:) - ! ] Retranslocation N uptake (gN/m2/s) - Nuptake => cnveg_nitrogenflux_inst%Nuptake_patch , & ! Output: [real(r8) (:) - ! ] Total N uptake of FUN (gN/m2/s) - retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) - ! (:) ] deployment of retranslocated N (gN/m2/s) - free_retransn_to_npool => cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Output: [real(r8) - ! uptake of free N from leaves (needed to allow RT during the night with no NPP - sminn_to_plant_fun => cnveg_nitrogenflux_inst%sminn_to_plant_fun_patch , & ! Output: - ! [real(r8) (:) ] Total soil N uptake of FUN (gN/m2/s) - sminn_to_plant_fun_vr => cnveg_nitrogenflux_inst%sminn_to_plant_fun_vr_patch , & ! Output: - ! [real(r8) (:) ] Total layer soil N uptake of FUN (gN/m2 - ! /s) - sminn_to_plant_fun_no3_vr => cnveg_nitrogenflux_inst%sminn_to_plant_fun_no3_vr_patch , & ! Output: [real(r8) - ! (:) ] Total layer no3 uptake of FUN (gN/m2/s) - sminn_to_plant_fun_nh4_vr => cnveg_nitrogenflux_inst%sminn_to_plant_fun_nh4_vr_patch , & ! Output: [real(r8) - ! (:) ] Total layer nh4 uptake of FUN (gN/m2/s) - sminn_to_plant_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_plant_vr_col , & ! Output: [real(r8) (: - ! ,:) ] - smin_no3_to_plant_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_to_plant_vr_col , & ! Output: [real(r8) (: - ! ,:) ] - smin_nh4_to_plant_vr => soilbiogeochem_nitrogenflux_inst%smin_nh4_to_plant_vr_col , & ! Output: [real(r8) (: - ! ,:) ] - smin_vr_nh4 => soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral - ! NH4 - smin_vr_no3 => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral - ! NO3 - soilc_change => cnveg_carbonflux_inst%soilc_change_patch , & ! Output: [real(r8) - ! (:) ] Used C from the soil (gC/m2/s) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:)] - ! liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:)] - ! soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - crootfr => soilstate_inst%crootfr_patch & ! Input: [real(r8) (:,:)] - ! fraction of roots for carbon in each soil layer (nlevgrnd) - ) - !-------------------------------------------------------------------- - !----------- - ! Initialize output fluxes, which were also initialized in CNFUNMod. - !-------------------------------------------------------------------- - !----------- - local_use_flexibleCN = use_flexibleCN - steppday = 48._r8 - qflx_tran_veg_layer = 0._r8 - rootc_dens_step = 0._r8 - plant_ndemand_pool = 0._r8 - - call t_startf('CNFUNzeroarrays') - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - availc_pool(p) = 0._r8 - rootC(p) = 0._r8 - litterfall_n(p) = 0._r8 - burnedoff_carbon(p) = 0._r8 - end do - - - do j = 1, nlevdecomp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - c = patch%column(p) - rootc_dens(p,j) = 0._r8 - cost_retran(p,j) = 0._r8 - cost_fix(p,j) = 0._r8 - cost_resis(p,j) = 0._r8 - cost_res_resis(p,j) = 0._r8 - cost_active_no3(p,j) = 0._r8 - cost_active_nh4(p,j) = 0._r8 - cost_nonmyc_no3(p,j) = 0._r8 - cost_nonmyc_nh4(p,j) = 0._r8 - - sminn_no3_conc(c,j) = 0._r8 - sminn_no3_layer(c,j) = 0._r8 - sminn_nh4_conc(c,j) = 0._r8 - sminn_nh4_layer(c,j) = 0._r8 - end do - end do - - do istp = 1, nstp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - npp_remaining(p,istp) = 0._r8 - permyc(p,istp) = 0._r8 - plant_ndemand_pool_step(p,istp) = 0._r8 - nt_uptake(p,istp) = 0._r8 - npp_uptake(p,istp) = 0._r8 - leafn_step(p,istp) = 0._r8 - leafn_retrans_step(p,istp) = 0._r8 - litterfall_n_step(p,istp) = 0._r8 - litterfall_c_step(p,istp) = 0._r8 - end do - do j = 1, nlevdecomp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - sminn_no3_conc_step(p,j,istp) = 0._r8 - sminn_no3_layer_step(p,j,istp) = 0._r8 - sminn_no3_uptake(p,j,istp) = 0._r8 - sminn_nh4_conc_step(p,j,istp) = 0._r8 - sminn_nh4_layer_step(p,j,istp) = 0._r8 - sminn_nh4_uptake(p,j,istp) = 0._r8 - end do - end do - end do - - do icost = 1, ncost6 - do j = 1, nlevdecomp - costNit(j,icost) = big_cost - end do - end do - - ! Time step of FUN - dt = real(get_step_size(), r8) - call t_stopf('CNFUNzeroarrays') - !-------------------------------------------------------------------- - !---------------------------- - ! Calculation starts - !-------------------------------------------------------------------- - call t_startf('CNFUNcalcs1') - !---------------------------- - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - - litterfall_n(p) = (leafc_to_litter_fun(p) / leafcn_offset(p)) * dt - rootC(p) = frootc(p) - - plantN(p) = leafn(p) + frootn(p) + livestemn(p) + livecrootn(p) - if (n_allometry(p).gt.0._r8) then - plantCN(p) = c_allometry(p)/n_allometry(p) !changed RF. - ! above code gives CN ratio too low. - else - plantCN(p) = 0._r8 - end if - end do ! PFT ends - do istp = 1, nstp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - - if (istp.eq.ecm_step) then - permyc(p,istp) = perecm(ivt(p)) - kc_active(p,istp) = ekc_active(ivt(p)) - kn_active(p,istp) = ekn_active(ivt(p)) - else - permyc(p,istp) = 1._r8 - perecm(ivt(p)) - kc_active(p,istp) = akc_active(ivt(p)) - kn_active(p,istp) = akn_active(ivt(p)) - end if - - if(leafc(p)>0.0_r8)then - ! N available in leaf which fell off in this timestep. Same fraction loss as C. - litterfall_c_step(p,istp) = dt * permyc(p,istp) * leafc_to_litter_fun(p) - litterfall_n_step(p,istp) = dt * permyc(p,istp) * leafn(p) * leafc_to_litter_fun(p)/leafc(p) - endif - - if (season_decid(ivt(p)) == 1._r8.or.stress_decid(ivt(p)) == 1._r8) then - if (offset_flag(p) .ne. 1._r8) then - litterfall_n_step(p,istp) = 0.0_r8 - litterfall_c_step(p,istp) = 0.0_r8 - endif - endif - - end do - end do - - do j = 1, nlevdecomp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - c = patch%column(p) - sminn_no3_layer(c,j)= smin_no3_to_plant_vr(c,j) * dzsoi_decomp(j) * dt - sminn_nh4_layer(c,j)= smin_nh4_to_plant_vr(c,j) * dzsoi_decomp(j) * dt - if (h2osoi_liq(c,j) < smallValue) then - sminn_no3_layer(c,j) = 0._r8 - sminn_nh4_layer(c,j) = 0._r8 - end if - sminn_no3_layer(c,j) = max(sminn_no3_layer(c,j),0._r8) - sminn_nh4_layer(c,j) = max(sminn_nh4_layer(c,j),0._r8) - if (h2osoi_liq(c,j) > smallValue) then - sminn_no3_conc(c,j) = sminn_no3_layer(c,j) / (h2osoi_liq(c,j) * 1000._r8) ! (gN/m2)/(gH2O/m2) (coverted from - ! kg2g) - sminn_nh4_conc(c,j) = sminn_nh4_layer(c,j) / (h2osoi_liq(c,j) * 1000._r8) ! (gN/m2)/(gH2O/m2) (coverted from - ! kg2g) - else - sminn_no3_conc(c,j) = 0._r8 - sminn_nh4_conc(c,j) = 0._r8 - end if - end do - end do - - do istp = 1, nstp - do j = 1, nlevdecomp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - c = patch%column(p) - - sminn_no3_layer_step(p,j,istp) = sminn_no3_layer(c,j) * permyc(p,istp) - sminn_nh4_layer_step(p,j,istp) = sminn_nh4_layer(c,j) * permyc(p,istp) - sminn_no3_conc_step(p,j,istp) = sminn_no3_conc(c,j) * permyc(p,istp) - sminn_nh4_conc_step(p,j,istp) = sminn_nh4_conc(c,j) * permyc(p,istp) - end do - end do - end do - call t_stopf('CNFUNcalcs1') - - call t_startf('CNFUNzeroarrays2') - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - n_passive_acc(p) = 0._r8 - n_fix_acc_total(p) = 0._r8 - n_retrans_acc_total(p) = 0._r8 - npp_fix_acc_total(p) = 0._r8 - n_nonmyc_no3_retrans_total(p) = 0._r8 - n_nonmyc_nh4_retrans_total(p) = 0._r8 - npp_retrans_acc_total(p) = 0._r8 - n_am_no3_acc(p) = 0._r8 - n_am_nh4_acc(p) = 0._r8 - n_am_no3_retrans(p) = 0._r8 - n_am_nh4_retrans(p) = 0._r8 - n_ecm_no3_acc(p) = 0._r8 - n_ecm_nh4_acc(p) = 0._r8 - n_ecm_no3_retrans(p) = 0._r8 - n_ecm_nh4_retrans(p) = 0._r8 - n_active_no3_acc_total(p) = 0._r8 - n_active_nh4_acc_total(p) = 0._r8 - n_active_no3_retrans_total(p) = 0._r8 - n_active_nh4_retrans_total(p) = 0._r8 - n_nonmyc_no3_acc_total(p) = 0._r8 - n_nonmyc_nh4_acc_total(p) = 0._r8 - npp_active_no3_acc_total(p) = 0._r8 - npp_active_nh4_acc_total(p) = 0._r8 - npp_active_no3_retrans_total(p) = 0._r8 - npp_active_nh4_retrans_total(p) = 0._r8 - npp_nonmyc_no3_acc_total(p) = 0._r8 - npp_nonmyc_nh4_acc_total(p) = 0._r8 - npp_nonmyc_no3_retrans_total(p) = 0._r8 - npp_nonmyc_nh4_retrans_total(p) = 0._r8 - free_Nretrans(p) = 0._r8 - end do - - do j = 1, nlevdecomp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - n_passive_no3_vr(p,j) = 0._r8 - n_passive_nh4_vr(p,j) = 0._r8 - n_active_no3_vr(p,j) = 0._r8 - n_nonmyc_no3_vr(p,j) = 0._r8 - n_active_nh4_vr(p,j) = 0._r8 - n_nonmyc_nh4_vr(p,j) = 0._r8 - end do - end do - do istp = 1, nstp - do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - n_passive_step(p,istp) = 0._r8 - n_fix_acc(p,istp) = 0._r8 - n_retrans_acc(p,istp) = 0._r8 - npp_fix_acc(p,istp) = 0._r8 - npp_retrans_acc(p,istp) = 0._r8 - n_active_no3_acc(p,istp) = 0._r8 - n_active_nh4_acc(p,istp) = 0._r8 - n_active_no3_retrans(p,istp) = 0._r8 - n_active_nh4_retrans(p,istp) = 0._r8 - n_nonmyc_no3_acc(p,istp) = 0._r8 - n_nonmyc_nh4_acc(p,istp) = 0._r8 - n_nonmyc_no3_retrans(p,istp) = 0._r8 - n_nonmyc_nh4_retrans(p,istp) = 0._r8 - npp_active_no3_acc(p,istp) = 0._r8 - npp_active_nh4_acc(p,istp) = 0._r8 - npp_active_no3_retrans(p,istp) = 0._r8 - npp_active_nh4_retrans(p,istp) = 0._r8 - npp_nonmyc_no3_acc(p,istp) = 0._r8 - npp_nonmyc_nh4_acc(p,istp) = 0._r8 - npp_nonmyc_no3_retrans(p,istp) = 0._r8 - npp_nonmyc_nh4_retrans(p,istp) = 0._r8 - end do - end do - - burned_off_carbon = 0._r8 - call t_stopf('CNFUNzeroarrays2') - - - call t_startf('CNFUNcalcs') -pft:do fp = 1,num_soilp ! PFT Starts - p = filter_soilp(fp) - c = patch%column(p) - excess_carbon_acc = 0.0_r8 - burned_off_carbon = 0.0_r8 - - sminn_to_plant_fun_nh4_vr(p,:) = 0._r8 - sminn_to_plant_fun_no3_vr(p,:) = 0._r8 - - ! I have turned off this r etranslocation functionality for now. To - ! be rolled back in to a new version later on once the rest of - ! th - ! mode is working OK. RF - - if (season_decid(ivt(p)) == 1._r8.or.stress_decid(ivt(p)) == 1._r8) then - if (onset_flag(p) == 1._r8) then - leafc_storage_xfer_acc(p) = leafc_storage_xfer_acc(p) + leafc_storage_to_xfer(p) * dt - leafn_storage_xfer_acc(p) = leafn_storage_xfer_acc(p) + leafn_storage_to_xfer(p) * dt - end if - if (offset_flag(p) == 1._r8) then - storage_cdemand(p) = leafc_storage(p) / (ndays_off * steppday) - storage_ndemand(p) = leafn_storage_xfer_acc(p) / (ndays_off * steppday) - storage_ndemand(p) = max(storage_ndemand(p),0._r8) - else - storage_cdemand(p) = 0._r8 - storage_ndemand(p) = 0._r8 - end if - else - storage_cdemand(p) = 0._r8 - storage_ndemand(p) = 0._r8 - end if ! end for deciduous - - !---------How much carbon is provided, to be used for either growth - ! or Nitrogen uptake?------------------- - availc_pool(p) = availc(p) * dt - - if (availc_pool(p) > 0._r8) then - do j = 1, nlevdecomp - rootc_dens(p,j) = crootfr(p,j) * rootC(p) - end do - end if - - plant_ndemand_pool(p) = plant_ndemand(p) * dt - plant_ndemand_pool(p) = max(plant_ndemand_pool(p),0._r8) - plant_ndemand_retrans(p) = storage_ndemand(p) - - !-------------------------------------------------------------------- - !---------- -stp: do istp = ecm_step, am_step ! TWO STEPS - retrans_limit1 = 0._r8 - dn = 0._r8 - dnpp = 0._r8 - - ! zero out all of the fluxes that get accumulated accross ISTP - sminn_no3_diff = 0._r8 - sminn_nh4_diff = 0._r8 - active_no3_limit1 = 0._r8 - active_nh4_limit1 = 0._r8 - - - n_from_active_no3(:) = 0.0_r8 - n_from_active_nh4(:) = 0.0_r8 - n_from_nonmyc_no3(:) = 0.0_r8 - n_from_nonmyc_nh4(:) = 0.0_r8 - n_from_fixation(:) = 0.0_r8 - n_from_retrans(:) = 0.0_r8 - - n_active_no3_acc(p,istp) = 0.0_r8 - n_active_nh4_acc(p,istp) = 0.0_r8 - n_nonmyc_no3_acc(p,istp) = 0.0_r8 - n_nonmyc_nh4_acc(p,istp) = 0.0_r8 - n_fix_acc(p,istp) = 0.0_r8 - n_retrans_acc(p,istp) = 0.0_r8 - free_nretrans_acc(p,istp) = 0.0_r8 - - npp_active_no3_acc(p,istp) = 0.0_r8 - npp_active_nh4_acc(p,istp) = 0.0_r8 - npp_nonmyc_no3_acc(p,istp) = 0.0_r8 - npp_nonmyc_no3_acc(p,istp) = 0.0_r8 - npp_fix_acc(p,istp) = 0.0_r8 - npp_retrans_acc(p,istp) = 0.0_r8 - - npp_to_active_no3(:) = 0.0_r8 - npp_to_active_nh4(:) = 0.0_r8 - npp_to_nonmyc_no3(:) = 0.0_r8 - npp_to_nonmyc_nh4(:) = 0.0_r8 - npp_to_fixation(:) = 0.0_r8 - npp_to_retrans(:) = 0.0_r8 - - - - unmetDemand = .TRUE. - plant_ndemand_pool_step(p,istp) = plant_ndemand_pool(p) * permyc(p,istp) - npp_remaining(p,istp) = availc_pool(p) * permyc(p,istp) - - - ! if (plant_ndemand_pool_step(p,istp) .gt. 0._r8) then ! - ! plant_ndemand_pool_step > 0.0 - - do j = 1, nlevdecomp - tc_soisno(c,j) = t_soisno(c,j) - tfrz - if(pftcon%c3psn(patch%itype(p)).eq.1)then - fixer=1 - else - fixer=0 - endif - costNit(j,icostFix) = fun_cost_fix(fixer,a_fix(ivt(p)),b_fix(ivt(p))& - ,c_fix(ivt(p)) ,big_cost,crootfr(p,j),s_fix(ivt(p)),tc_soisno(c,j)) - end do - cost_fix(p,1:nlevdecomp) = costNit(:,icostFix) - - - !-------------------------------------------------------------------- - !------------ - ! If passive uptake is insufficient, consider fixation, - ! mycorrhizal - ! non-mycorrhizal, storage, and retranslocation. - !-------------------------------------------------------------------- - !------------ - !-------------------------------------------------------------------- - !------------ - ! Costs of active uptake. - !-------------------------------------------------------------------- - !------------ - !------Mycorrhizal Uptake Cost-----------------! - do j = 1,nlevdecomp - rootc_dens_step = rootc_dens(p,j) * permyc(p,istp) - costNit(j,icostActiveNO3) = fun_cost_active(sminn_no3_layer_step(p,j,istp) & - ,big_cost,kc_active(p,istp),kn_active(p,istp) ,rootc_dens_step,crootfr(p,j),smallValue) - costNit(j,icostActiveNH4) = fun_cost_active(sminn_nh4_layer_step(p,j,istp) & - ,big_cost,kc_active(p,istp),kn_active(p,istp) ,rootc_dens_step,crootfr(p,j),smallValue) - end do - cost_active_no3(p,1:nlevdecomp) = costNit(:,icostActiveNO3) - cost_active_nh4(p,1:nlevdecomp) = costNit(:,icostActiveNH4) - - - !------Non-mycorrhizal Uptake Cost-------------! - do j = 1,nlevdecomp - rootc_dens_step = rootc_dens(p,j) * permyc(p,istp) - costNit(j,icostnonmyc_no3) = fun_cost_nonmyc(sminn_no3_layer_step(p,j,istp) & - ,big_cost,kc_nonmyc(ivt(p)),kn_nonmyc(ivt(p)) ,rootc_dens_step,crootfr(p,j),smallValue) - costNit(j,icostnonmyc_nh4) = fun_cost_nonmyc(sminn_nh4_layer_step(p,j,istp) & - ,big_cost,kc_nonmyc(ivt(p)),kn_nonmyc(ivt(p)) ,rootc_dens_step,crootfr(p,j),smallValue) - end do - cost_nonmyc_no3(p,1:nlevdecomp) = costNit(:,icostnonmyc_no3) - cost_nonmyc_nh4(p,1:nlevdecomp) = costNit(:,icostnonmyc_nh4) - - - ! Remove C required to pair with N from passive uptake - ! from the available pool. - npp_remaining(p,istp) = npp_remaining(p,istp) - n_passive_step(p,istp)*plantCN(p) - -fix_loop: do FIX =plants_are_fixing, plants_not_fixing !loop around percentages of fixers and non - ! fixers, with differnt costs. - if(FIX==plants_are_fixing)then ! How much of the carbon in this PFT can in principle be used for fixation? - ! This is analagous to fixing the % of fixers for a given PFT - may not be realistic in the long run - ! but prevents wholesale switching to fixer dominance during e.g. CO2 fertilization. - fixerfrac = FUN_fracfixers(ivt(p)) - else - fixerfrac = 1.0_r8 - FUN_fracfixers(ivt(p)) - endif - npp_to_spend = npp_remaining(p,istp) * fixerfrac !put parameter here. - - - - n_from_active_no3(1:nlevdecomp) = 0._r8 - n_from_active_nh4(1:nlevdecomp) = 0._r8 - n_from_nonmyc_no3(1:nlevdecomp) = 0._r8 - n_from_nonmyc_nh4(1:nlevdecomp) = 0._r8 - !-------------------------------------------------------------------- - !----------- - ! Calculate Integrated Resistance OF WHOLE SOIL COLUMN - !-------------------------------------------------------------------- - !----------- - - sum_n_acquired = 0.0_r8 - total_N_conductance = 0.0_r8 - do j = 1, nlevdecomp - !----------! - ! Method changed from FUN-resistors method to a method which - ! allocates fluxs based on conductance. rosief - !----------! - - ! Sum the conductances - total_N_conductance = total_N_conductance + 1._r8/ & - cost_active_no3(p,j) + 1._r8/cost_active_nh4(p,j) & - + 1._r8/cost_nonmyc_no3(p,j) & - + 1._r8/cost_nonmyc_nh4(p,j) - if(FIX==plants_are_fixing)then - total_N_conductance = total_N_conductance + 1.0_r8 * 1._r8/cost_fix(p,j) - end if - - end do - - do j = 1, nlevdecomp - ! Calculate npp allocation to pathways proportional to their exchange rate (N/C) - - npp_frac_to_active_nh4(j) = (1._r8/cost_active_nh4(p,j)) / total_N_conductance - npp_frac_to_nonmyc_nh4(j) = (1._r8/cost_nonmyc_nh4(p,j)) / total_N_conductance - npp_frac_to_active_no3(j) = (1._r8/cost_active_no3(p,j)) / total_N_conductance - npp_frac_to_nonmyc_no3(j) = (1._r8/cost_nonmyc_no3(p,j)) / total_N_conductance - if(FIX==plants_are_fixing)then - npp_frac_to_fixation(j) = (1.0_r8 * 1._r8/cost_fix(p,j)) / total_N_conductance - else - npp_frac_to_fixation(j) = 0.0_r8 - end if - - ! Calculate hypothetical N uptake from each source - if(FIX==plants_are_fixing)then - n_exch_fixation(j) = npp_frac_to_fixation(j) / cost_fix(p,j) - else - n_exch_fixation(j) = 0.0_r8 - end if - - n_exch_active_nh4(j) = npp_frac_to_active_nh4(j) / cost_active_nh4(p,j) - n_exch_nonmyc_nh4(j) = npp_frac_to_nonmyc_nh4(j) / cost_nonmyc_nh4(p,j) - n_exch_active_no3(j) = npp_frac_to_active_no3(j) / cost_active_no3(p,j) - n_exch_nonmyc_no3(j) = npp_frac_to_nonmyc_no3(j) / cost_nonmyc_no3(p,j) - - ! Total N aquired from one unit of carbon (N/C) - sum_n_acquired = sum_n_acquired + n_exch_active_nh4(j) +& - n_exch_nonmyc_nh4(j)+ n_exch_active_no3(j) + n_exch_nonmyc_no3(j) - - if(FIX==plants_are_fixing)then - sum_n_acquired= sum_n_acquired + n_exch_fixation(j) - end if - - end do !nlevdecomp - - total_N_resistance = 1.0_r8/sum_n_acquired - - !------------------------------------------------------------------------------- - ! Calculate appropriate degree of retranslocation - !------------------------------------------------------------------------------- - - if(leafc(p).gt.0.0_r8.and.litterfall_n_step(p,istp)* fixerfrac>0.0_r8.and.ivt(p) 0._r8 - end do stp ! NSTEP - - - !------------------------------------------------------------------------------- - ! Turn step level quantities back into fluxes per second. - !------------------------------------------------------------------------------- - - !---------------------------N fluxes--------------------! - Npassive(p) = n_passive_acc(p)/dt - Nfix(p) = n_fix_acc_total(p)/dt - retransn_to_npool(p) = n_retrans_acc_total(p)/dt - free_retransn_to_npool(p) = free_nretrans(p)/dt - ! this is the N that comes off leaves. - Nretrans(p) = retransn_to_npool(p) + free_retransn_to_npool(p) - - - - - !Extract active uptake N from soil pools. - do j = 1, nlevdecomp - !RF change. The N fixed doesn't actually come out of the soil mineral pools, it is 'new'... - sminn_to_plant_fun_no3_vr(p,j) = (n_passive_no3_vr(p,j) + n_active_no3_vr(p,j) & - + n_nonmyc_no3_vr(p,j))/(dzsoi_decomp(j)*dt) - sminn_to_plant_fun_nh4_vr(p,j) = (n_passive_nh4_vr(p,j) + n_active_nh4_vr(p,j) & - + n_nonmyc_nh4_vr(p,j))/(dzsoi_decomp(j)*dt) - - end do - - - - Nactive_no3(p) = n_active_no3_acc_total(p)/dt + n_active_no3_retrans_total(p)/dt - Nactive_nh4(p) = n_active_nh4_acc_total(p)/dt + n_active_nh4_retrans_total(p)/dt - - - - Necm_no3(p) = n_ecm_no3_acc(p)/dt + n_ecm_no3_retrans(p)/dt - Necm_nh4(p) = n_ecm_nh4_acc(p)/dt + n_ecm_nh4_retrans(p)/dt - Necm(p) = Necm_no3(p) + Necm_nh4(p) - Nam_no3(p) = n_am_no3_acc(p)/dt + n_am_no3_retrans(p)/dt - Nam_nh4(p) = n_am_nh4_acc(p)/dt + n_am_nh4_retrans(p)/dt - Nam(p) = Nam_no3(p) + Nam_nh4(p) - Nnonmyc_no3(p) = n_nonmyc_no3_acc_total(p)/dt + n_nonmyc_no3_retrans_total(p)/dt - Nnonmyc_nh4(p) = n_nonmyc_nh4_acc_total(p)/dt + n_nonmyc_nh4_retrans_total(p)/dt - Nnonmyc(p) = Nnonmyc_no3(p) + Nnonmyc_nh4(p) - plant_ndemand_retrans(p) = plant_ndemand_retrans(p)/dt - Nuptake(p) = Nactive_no3(p) + Nactive_nh4(p) + Nnonmyc_no3(p) & - + Nnonmyc_nh4(p) + Nfix(p) + Npassive(p) + & - retransn_to_npool(p)+free_retransn_to_npool(p) - Nactive(p) = Nactive_no3(p) + Nactive_nh4(p) + Nnonmyc_no3(p) + Nnonmyc_nh4(p) - - ! free N goes straight to the npool, not throught Nuptake... - sminn_to_plant_fun(p) = Nactive_no3(p) + Nactive_nh4(p) + Nnonmyc_no3(p) + Nnonmyc_nh4(p) + Nfix(p) + Npassive(p) - - - soil_n_extraction = ( sum(n_active_no3_vr(p,1: nlevdecomp))+sum(n_nonmyc_no3_vr(p,1: nlevdecomp))+& - sum(n_active_nh4_vr(p,1: nlevdecomp)) + sum(n_nonmyc_nh4_vr(p,1: nlevdecomp))) - - !---------------------------C fluxes--------------------! - - npp_Nactive_no3(p) = npp_active_no3_acc_total(p)/dt + npp_active_no3_retrans_total(p)/dt - npp_Nactive_nh4(p) = npp_active_nh4_acc_total(p)/dt + npp_active_nh4_retrans_total(p)/dt - - npp_Nnonmyc_no3(p) = npp_nonmyc_no3_acc_total(p)/dt + npp_nonmyc_no3_retrans_total(p)/dt - npp_Nnonmyc_nh4(p) = npp_nonmyc_nh4_acc_total(p)/dt + npp_nonmyc_nh4_retrans_total(p)/dt - npp_Nactive(p) = npp_Nactive_no3(p) + npp_Nactive_nh4(p) + npp_Nnonmyc_no3(p) + npp_Nnonmyc_nh4(p) - npp_Nnonmyc(p) = npp_Nnonmyc_no3(p) + npp_Nnonmyc_nh4(p) - npp_Nfix(p) = npp_fix_acc_total(p)/dt - npp_Nretrans(p) = npp_retrans_acc_total(p)/dt - - !---------------------------Extra Respiration Fluxes--------------------! - soilc_change(p) = (npp_active_no3_acc_total(p) + npp_active_nh4_acc_total(p) & - + npp_nonmyc_no3_acc_total(p) & - + npp_nonmyc_nh4_acc_total(p) + npp_fix_acc_total(p))/dt & - + npp_Nretrans(p) - soilc_change(p) = soilc_change(p) + burned_off_carbon / dt - burnedoff_carbon(p) = burned_off_carbon/dt - npp_Nuptake(p) = soilc_change(p) - ! how much carbon goes to growth of tissues? - npp_growth(p) = (Nuptake(p)- free_retransn_to_npool(p))*plantCN(p)+(excess_carbon_acc/dt) !does not include gresp, since this is calculated from growth - - - - !-----------------------Diagnostic Fluxes------------------------------! - if(availc(p).gt.0.0_r8)then !what happens in the night? - nuptake_npp_fraction_patch(p) = npp_Nuptake(p)/availc(p) - else - nuptake_npp_fraction_patch(p) = spval - endif - if(npp_Nfix(p).gt.0.0_r8)then - cost_nfix(p) = Nfix(p)/npp_Nfix(p) - else - cost_nfix(p) = spval - endif - if(npp_Nactive(p).gt.0.0_r8)then - cost_nactive(p) = Nactive(p)/npp_Nactive(p) - else - cost_nactive(p) = spval - endif - if(npp_Nretrans(p).gt.0.0_r8)then - cost_nretrans(p) = Nretrans(p)/npp_Nretrans(p) - else - cost_nretrans(p) = spval - endif - - - end do pft ! PFT Ends - - call t_stopf('CNFUNcalcs') - - call p2c(bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst%soilc_change_patch(bounds%begp:bounds%endp), & - soilbiogeochem_carbonflux_inst%soilc_change_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst%Nfix_patch(bounds%begp:bounds%endp), & - soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col(bounds%begc:bounds%endc)) - - end associate - end subroutine CNFUN -!========================================================================================= - real(r8) function fun_cost_fix(fixer,a_fix,b_fix,c_fix,big_cost,crootfr,s_fix, tc_soisno) - -! Description: -! Calculate the cost of fixing N by nodules. -! Code Description: -! This code is written to CLM4CN by Mingjie Shi on 06/27/2013 - - implicit none -!-------------------------------------------------------------------------- -! Function result. -!-------------------------------------------------------------------------- -! real(r8) , intent(out) :: cost_of_n !!! cost of fixing N (kgC/kgN) -!-------------------------------------------------------------------------- -! Scalar arguments with intent(in). -!-------------------------------------------------------------------------- - integer, intent(in) :: fixer ! flag indicating if plant is a fixer - ! 1=yes, otherwise no. - real(r8), intent(in) :: a_fix ! As in Houlton et al. (Nature) 2008 - real(r8), intent(in) :: b_fix ! As in Houlton et al. (Nature) 2008 - real(r8), intent(in) :: c_fix ! As in Houlton et al. (Nature) 2008 - real(r8), intent(in) :: big_cost ! an arbitrary large cost (gC/gN) - real(r8), intent(in) :: crootfr ! fraction of roots for carbon that are in this layer - real(r8), intent(in) :: s_fix ! Inverts Houlton et al. 2008 and constrains between 7.5 and 12.5 - real(r8), intent(in) :: tc_soisno ! soil temperature (degrees Celsius) - - if (fixer == 1 .and. crootfr > 1.e-6_r8) then - fun_cost_fix = s_fix * (exp(a_fix + b_fix * tc_soisno * (1._r8 - 0.5_r8 * tc_soisno / c_fix)) - 2._r8) - - - ! New term to directly account for Ben Houlton's temperature response function. - ! Assumes s_fix is -6. (RF, Jan 2015) - ! 1.25 converts from the Houlton temp response function to a 0-1 limitation factor. - ! The cost of N should probably be 6 gC/gN (or 9, including maintenance costs of nodules) - ! for 'optimal' temperatures. This cost should increase in a way that mirrors - ! Houlton et al's observations of temperautre limitations on the mirboial fixation rates. - ! We don't actually simulate the rate of fixation (and assume that N uptake is instantaneous) - ! here, so instead the limitation term is here rolled into the cost function. - - ! Here we invert the 'cost' to give the optimal N:C ratio (1/6 gN/gC) The amount of N - ! you get for a given C goes down as it gets colder, so this can be multiplied by - ! the temperature function to give a temperature-limited N:C of f/6. This number - ! can then be inverted to give a temperature limited C:N, as 1/(f/6). Which is the - ! same as 6/f, given here" - fun_cost_fix = (-1*s_fix) * 1.0_r8 / (1.25_r8* (exp(a_fix + b_fix * tc_soisno * (1._r8 - 0.5_r8 * tc_soisno / c_fix)) )) - else - fun_cost_fix = big_cost - end if ! ends up with the fixer or non-fixer decision - - end function fun_cost_fix -!========================================================================================= - real(r8) function fun_cost_active(sminn_layer,big_cost,kc_active,kn_active,rootc_dens,crootfr,smallValue) - -! Description: -! Calculate the cost of active uptake of N frm the soil. -! Code Description: -! This code is written to CLM4 by Mingjie Shi. - - implicit none -!-------------------------------------------------------------------------- -! Function result. -!-------------------------------------------------------------------------- - real(r8), intent(in) :: sminn_layer ! Amount of N (as NH4 or NO3) in the soil that is available to plants (gN/m2). - real(r8), intent(in) :: big_cost ! An arbitrary large cost (gC/gN). - real(r8), intent(in) :: kc_active ! Constant for cost of active uptake (gC/m2). - real(r8), intent(in) :: kn_active ! Constant for cost of active uptake (gC/m2). - real(r8), intent(in) :: rootc_dens ! Root carbon density in layer (gC/m3). - real(r8), intent(in) :: crootfr ! Fraction of roots that are in this layer. - real(r8), intent(in) :: smallValue ! A small number. - - if (rootc_dens > 1.e-6_r8.and.sminn_layer > smallValue) then - fun_cost_active = kn_active/sminn_layer + kc_active/rootc_dens - else -! There are very few roots in this layer. Set a high cost. - fun_cost_active = big_cost - end if - - end function fun_cost_active -!========================================================================================= - real(r8) function fun_cost_nonmyc(sminn_layer,big_cost,kc_nonmyc,kn_nonmyc,rootc_dens,crootfr,smallValue) - -! Description: -! Calculate the cost of nonmyc uptake of N frm the soil. -! Code Description: -! This code is written to CLM4 by Mingjie Shi. - - implicit none -!-------------------------------------------------------------------------- -! Function result. -!-------------------------------------------------------------------------- - real(r8), intent(in) :: sminn_layer ! Amount of N (as NH4 or NO3) in the soil that is available to plants (gN/m2). - real(r8), intent(in) :: big_cost ! An arbitrary large cost (gC/gN). - real(r8), intent(in) :: kc_nonmyc ! Constant for cost of nonmyc uptake (gC/m2). - real(r8), intent(in) :: kn_nonmyc ! Constant for cost of nonmyc uptake (gC/m2). - real(r8), intent(in) :: rootc_dens ! Root carbon density in layer (gC/m3). - real(r8), intent(in) :: crootfr ! Fraction of roots that are in this layer. - real(r8), intent(in) :: smallValue ! A small number. - - if (rootc_dens > 1.e-6_r8.and.sminn_layer > smallValue) then - fun_cost_nonmyc = kn_nonmyc / sminn_layer + kc_nonmyc / rootc_dens - else -! There are very few roots in this layer. Set a high cost. - fun_cost_nonmyc = big_cost - end if - - end function fun_cost_nonmyc - -!========================================================================== - - subroutine fun_retranslocation(p,dt,npp_to_spend,total_falling_leaf_c, & - total_falling_leaf_n, total_n_resistance, total_c_spent_retrans, & - total_c_accounted_retrans, free_n_retrans, paid_for_n_retrans, & - target_leafcn, grperc, plantCN) -! -! Description: -! This subroutine (should it be a function?) calculates the amount of N absorbed and C spent -! during retranslocation. -! Rosie Fisher. April 2016. -! !USES: - implicit none - -! !ARGUMENTS: - real(r8), intent(IN) :: total_falling_leaf_c ! INPUT gC/m2/timestep - real(r8), intent(IN) :: total_falling_leaf_n ! INPUT gC/m2/timestep - real(r8), intent(IN) :: total_n_resistance ! INPUT gC/gN - real(r8), intent(IN) :: npp_to_spend ! INPUT gN/m2/timestep - real(r8), intent(IN) :: target_leafcn ! INPUT gC/gN - real(r8), intent(IN) :: dt ! INPUT seconds - real(r8), intent(IN) :: grperc ! INPUT growth respiration fraction - real(r8), intent(IN) :: plantCN ! INPUT plant CN ratio - integer, intent(IN) :: p ! INPUT patch index - - real(r8), intent(OUT) :: total_c_spent_retrans ! OUTPUT gC/m2/timestep - real(r8), intent(OUT) :: total_c_accounted_retrans ! OUTPUT gC/m2/timestep - real(r8), intent(OUT) :: paid_for_n_retrans ! OUTPUT gN/m2/timestep - real(r8), intent(OUT) :: free_n_retrans ! OUTPUT gN/m2/timestep - - ! - ! !LOCAL VARIABLES: - real(r8) :: kresorb ! INTERNAL used factor - real(r8) :: falling_leaf_c ! INTERNAL gC/m2/timestep - real(r8) :: falling_leaf_n ! INTERNAL gN/m2/timestep - real(r8) :: falling_leaf_cn ! INTERNAL gC/gN - real(r8) :: cost_retrans_temp ! INTERNAL gC/gN - real(r8) :: leaf_n_ext ! INTERNAL gN/m2/timestep - real(r8) :: c_spent_retrans ! INTERNAL gC/m2/timestep - real(r8) :: c_accounted_retrans ! INTERNAL gC/m2/timestep - real(r8) :: npp_to_spend_temp ! INTERNAL gC/m2/timestep - real(r8) :: max_falling_leaf_cn ! INTERNAL gC/gN - real(r8) :: min_falling_leaf_cn ! INTERNAL gC/gN - real(r8) :: cost_escalation ! INTERNAL cost function parameter - integer :: iter ! INTERNAL - integer :: exitloop ! INTERNAL - ! ------------------------------------------------------------------------------- - - - ! ------------------ Initialize total fluxes. ------------------! - total_c_spent_retrans = 0.0_r8 - total_c_accounted_retrans = 0.0_r8 - c_accounted_retrans = 0.0_r8 - paid_for_n_retrans = 0.0_r8 - npp_to_spend_temp = npp_to_spend - - ! ------------------ Initial C and N pools in falling leaves. ------------------! - falling_leaf_c = total_falling_leaf_c - falling_leaf_n = total_falling_leaf_n - - ! ------------------ PARAMETERS ------------------ - max_falling_leaf_cn = target_leafcn * 3.0_r8 - min_falling_leaf_cn = target_leafcn * 1.5_r8 - cost_escalation = 1.3_r8 - - ! ------------------ Free uptake ------------------ - free_n_retrans = max(falling_leaf_n - (falling_leaf_c/min_falling_leaf_cn),0.0_r8) - falling_leaf_n = falling_leaf_n - free_n_retrans - - ! ------------------ Initial CN ratio and costs ------------------! - falling_leaf_cn = falling_leaf_c/falling_leaf_n - kresorb = (1.0_r8/target_leafcn) - cost_retrans_temp = kresorb / ((1.0_r8/falling_leaf_cn )**1.3_r8) - - ! ------------------ Iteration loops to figure out extraction limit ------------! - iter = 0 - exitloop = 0 - do while(exitloop==0.and.cost_retrans_temp .lt. total_n_resistance.and. & - falling_leaf_n.ge.0.0_r8.and.npp_to_spend.gt.0.0_r8) - ! ------------------ Spend some C on removing N ------------! - ! spend enough C to increase leaf C/N by 1 unit. - c_spent_retrans = cost_retrans_temp * (falling_leaf_n - falling_leaf_c / & - (falling_leaf_cn + 1.0_r8)) - ! don't spend more C than you have - c_spent_retrans = min(npp_to_spend_temp, c_spent_retrans) - ! N extracted, per this amount of C expenditure - leaf_n_ext = c_spent_retrans / cost_retrans_temp - ! Do not empty N pool - leaf_n_ext = min(falling_leaf_n, leaf_n_ext) - !How much C do you need to account for the N that got taken up? - c_accounted_retrans = leaf_n_ext * plantCN * (1.0_r8 + grperc) - - ! ------------------ Update leafCN, recalculate costs ------------! - falling_leaf_n = falling_leaf_n - leaf_n_ext ! remove N from falling leaves pool - if(falling_leaf_n.gt.0.0_r8)then - falling_leaf_cn = falling_leaf_c/falling_leaf_n ! C/N ratio - cost_retrans_temp = kresorb /((1.0_r8/falling_leaf_cn)**1.3_r8) ! cost function. PARAMETER - else - exitloop=1 - endif - - ! ------------------ Accumulate total fluxes ------------! - total_c_spent_retrans = total_c_spent_retrans + c_spent_retrans - total_c_accounted_retrans = total_c_accounted_retrans + c_accounted_retrans - paid_for_n_retrans = paid_for_n_retrans + leaf_n_ext - npp_to_spend_temp = npp_to_spend_temp - c_spent_retrans - c_accounted_retrans - iter = iter+1 - - ! run out of C or N - if(npp_to_spend_temp.le.0.0_r8)then - exitloop=1 - ! if we made a solving error on this (expenditure and n uptake should - ! really be solved simultaneously) - ! then remove the error from the expenditure. This changes the notional cost, - ! but only by a bit and prevents cpool errors. - - total_c_spent_retrans = total_c_spent_retrans + npp_to_spend_temp - endif - ! leaf CN is too high - if(falling_leaf_cn.ge.max_falling_leaf_cn)then - exitloop=1 - endif - ! safety check to prevent hanging code - if(iter.ge.150)then - exitloop=1 - endif - end do - - end subroutine fun_retranslocation - -!========================================================================== - -end module CNFUNMod diff --git a/src/biogeochem/CNFireBaseMod.F90 b/src/biogeochem/CNFireBaseMod.F90 deleted file mode 100644 index 04c3e232ed..0000000000 --- a/src/biogeochem/CNFireBaseMod.F90 +++ /dev/null @@ -1,1260 +0,0 @@ -module CNFireBaseMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! module for fire dynamics - ! created in Nov, 2012 and revised in Apr, 2013 by F. Li and S. Levis - ! based on Li et al. (2012a,b; 2013) - ! revised in Apr, 2014 according Li et al.(2014) - ! Fire-related parameters were calibrated or tuned in Apr, 2013 based on the - ! 20th Century transient simulations at f19_g16 with (newfire05_clm45sci15_clm4_0_58) - ! a CLM4.5 version, Qian et al. (2006) atmospheric forcing, and - ! climatological lightning data. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create, shr_strdata_print - use shr_strdata_mod , only : shr_strdata_advance - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use spmdMod , only : masterproc, mpicom, comp_id - use fileutils , only : getavu, relavu - use decompMod , only : gsmap_lnd_gdc2glo - use domainMod , only : ldomain - use pftconMod , only : noveg, pftcon - use abortutils , only : endrun - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use CNDVType , only : dgvs_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use ColumnType , only : col - use PatchType , only : patch - use mct_mod - use CNFireMethodMod , only : cnfire_method_type - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: cnfire_base_type - - integer, private, parameter :: num_fp = 2 ! Number of pools relevent for fire - integer, private, parameter :: lit_fp = 1 ! Pool for liter - integer, private, parameter :: cwd_fp = 2 ! Pool for CWD Course woody debris - type, public :: cnfire_const_type - ! !PRIVATE MEMBER DATA: - real(r8) :: borealat = 40._r8 ! Latitude for boreal peat fires - real(r8) :: lfuel=75._r8 ! lower threshold of fuel mass (gC/m2) for ignition, Li et al.(2014) - real(r8) :: ufuel=650._r8 ! upper threshold of fuel mass(gC/m2) for ignition - real(r8) :: g0=0.05_r8 ! g(W) when W=0 m/s - real(r8) :: rh_low=30.0_r8 ! Relative humidty low (%) - real(r8) :: rh_hgh=80.0_r8 ! Relative humidty high (%) - real(r8) :: bt_min=0.3_r8 ! btran minimum (fraction) - real(r8) :: bt_max=0.7_r8 ! btran maximum (fraction) - real(r8) :: cli_scale=0.035_r8 ! global constant for deforestation fires (/d) - real(r8) :: boreal_peatfire_c = 4.2e-5_r8 ! c parameter for boreal peatland fire in Li et. al. (2013) (/hr) - real(r8) :: pot_hmn_ign_counts_alpha=0.0035_r8 ! Potential human ignition counts (alpha in Li et. al. 2012) (/person/month) - real(r8) :: non_boreal_peatfire_c = 0.001_r8 ! c parameter for non-boreal peatland fire in Li et. al. (2013) (/hr) - real(r8) :: cropfire_a1 = 0.3_r8 ! a1 parameter for cropland fire in (Li et. al., 2014) (/hr) - real(r8) :: occur_hi_gdp_tree = 0.39_r8 ! fire occurance for high GDP areas that are tree dominated (fraction) - - real(r8) :: cmb_cmplt_fact(num_fp) = (/ 0.5_r8, 0.25_r8 /) ! combustion completion factor (unitless) - end type - - ! - type, extends(cnfire_method_type) :: cnfire_base_type - private - ! !PRIVATE MEMBER DATA: - - real(r8), public, pointer :: forc_lnfm(:) ! Lightning frequency - real(r8), public, pointer :: forc_hdm(:) ! Human population density - - type(shr_strdata_type) :: sdat_hdm ! Human population density input data stream - type(shr_strdata_type) :: sdat_lnfm ! Lightning input data stream - - - contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireInit ! Initialization of CNFire - procedure, public :: CNFireReadNML ! Read in namelist for CNFire - procedure, public :: CNFireInterp ! Interpolate fire data - procedure, public :: CNFireArea ! Calculate fire area - procedure, public :: CNFireFluxes ! Calculate fire fluxes - ! - ! !PRIVATE MEMBER FUNCTIONS: - procedure, private :: hdm_init ! position datasets for dynamic human population density - procedure, private :: hdm_interp ! interpolates between two years of human pop. density file data - procedure, private :: lnfm_init ! position datasets for Lightning - procedure, private :: lnfm_interp ! interpolates between two years of Lightning file data - end type cnfire_base_type - !----------------------------------------------------------------------- - - type(cnfire_const_type), public, protected :: cnfire_const ! Fire constants shared by Li versons - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine CNFireInit( this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize CN Fire module - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - !----------------------------------------------------------------------- - - if ( this%need_lightning_and_popdens ) then - ! Allocate lightning forcing data - allocate( this%forc_lnfm(bounds%begg:bounds%endg) ) - this%forc_lnfm(bounds%begg:) = nan - ! Allocate pop dens forcing data - allocate( this%forc_hdm(bounds%begg:bounds%endg) ) - this%forc_hdm(bounds%begg:) = nan - - call this%hdm_init(bounds, NLFilename) - call this%hdm_interp(bounds) - call this%lnfm_init(bounds, NLFilename) - call this%lnfm_interp(bounds) - end if - - end subroutine CNFireInit - - !----------------------------------------------------------------------- - subroutine CNFireReadNML( this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CNFire - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNFireReadNML' - character(len=*), parameter :: nmlname = 'lifire_inparm' - !----------------------------------------------------------------------- - real(r8) :: cli_scale, boreal_peatfire_c, pot_hmn_ign_counts_alpha - real(r8) :: non_boreal_peatfire_c, cropfire_a1 - real(r8) :: rh_low, rh_hgh, bt_min, bt_max, occur_hi_gdp_tree - real(r8) :: lfuel, ufuel, cmb_cmplt_fact(num_fp) - - namelist /lifire_inparm/ cli_scale, boreal_peatfire_c, pot_hmn_ign_counts_alpha, & - non_boreal_peatfire_c, cropfire_a1, & - rh_low, rh_hgh, bt_min, bt_max, occur_hi_gdp_tree, & - lfuel, ufuel, cmb_cmplt_fact - - if ( this%need_lightning_and_popdens ) then - cli_scale = cnfire_const%cli_scale - boreal_peatfire_c = cnfire_const%boreal_peatfire_c - non_boreal_peatfire_c = cnfire_const%non_boreal_peatfire_c - pot_hmn_ign_counts_alpha = cnfire_const%pot_hmn_ign_counts_alpha - cropfire_a1 = cnfire_const%cropfire_a1 - rh_low = cnfire_const%rh_low - rh_hgh = cnfire_const%rh_hgh - lfuel = cnfire_const%lfuel - ufuel = cnfire_const%ufuel - bt_min = cnfire_const%bt_min - bt_max = cnfire_const%bt_max - occur_hi_gdp_tree = cnfire_const%occur_hi_gdp_tree - cmb_cmplt_fact(:) = cnfire_const%cmb_cmplt_fact(:) - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=lifire_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (cli_scale , mpicom) - call shr_mpi_bcast (boreal_peatfire_c , mpicom) - call shr_mpi_bcast (pot_hmn_ign_counts_alpha, mpicom) - call shr_mpi_bcast (non_boreal_peatfire_c , mpicom) - call shr_mpi_bcast (cropfire_a1 , mpicom) - call shr_mpi_bcast (rh_low , mpicom) - call shr_mpi_bcast (rh_hgh , mpicom) - call shr_mpi_bcast (lfuel , mpicom) - call shr_mpi_bcast (ufuel , mpicom) - call shr_mpi_bcast (bt_min , mpicom) - call shr_mpi_bcast (bt_max , mpicom) - call shr_mpi_bcast (occur_hi_gdp_tree , mpicom) - call shr_mpi_bcast (cmb_cmplt_fact , mpicom) - - cnfire_const%cli_scale = cli_scale - cnfire_const%boreal_peatfire_c = boreal_peatfire_c - cnfire_const%non_boreal_peatfire_c = non_boreal_peatfire_c - cnfire_const%pot_hmn_ign_counts_alpha = pot_hmn_ign_counts_alpha - cnfire_const%cropfire_a1 = cropfire_a1 - cnfire_const%rh_low = rh_low - cnfire_const%rh_hgh = rh_hgh - cnfire_const%lfuel = lfuel - cnfire_const%ufuel = ufuel - cnfire_const%bt_min = bt_min - cnfire_const%bt_max = bt_max - cnfire_const%occur_hi_gdp_tree = occur_hi_gdp_tree - cnfire_const%cmb_cmplt_fact(:) = cmb_cmplt_fact(:) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=lifire_inparm) - write(iulog,*) ' ' - end if - end if - - end subroutine CNFireReadNML - - !----------------------------------------------------------------------- - subroutine CNFireInterp(this,bounds) - ! - ! !DESCRIPTION: - ! Interpolate CN Fire datasets - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - if ( this%need_lightning_and_popdens ) then - call this%hdm_interp(bounds) - call this%lnfm_interp(bounds) - end if - - end subroutine CNFireInterp - - !----------------------------------------------------------------------- - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, soilhydrology_inst, waterstate_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(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_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, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch, & - totsomc_col, decomp_cpools_vr_col, decomp_npools_vr_col, somc_fire_col) - ! - ! !DESCRIPTION: - ! Fire effects routine for coupled carbon-nitrogen code (CN). - ! Relies primarily on estimate of fractional area burned, from CNFireArea(). - ! - ! Total fire carbon emissions (g C/m2 land area/yr) - ! =avg(COL_FIRE_CLOSS)*seconds_per_year + avg(SOMC_FIRE)*seconds_per_year + - ! avg(LF_CONV_CFLUX)*seconds_per_year*min(1.0,avg(LFC2)*seconds_per_year)*0.8 - ! where avg means the temporal average in a year - ! seconds_per_year is the number of seconds in a year. - ! - ! !USES: - use clm_time_manager , only: get_step_size,get_days_per_year,get_curr_date - use clm_varpar , only: max_patch_per_col - use clm_varctl , only: use_cndv, spinup_state - use clm_varcon , only: secspday - use pftconMod , only: nc3crop - use dynSubgridControlMod , only: run_has_transient_landcover - use clm_varpar , only: nlevdecomp_full, ndecomp_pools, nlevdecomp - ! - ! !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(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: totsomc_col(bounds%begc:) ! (gC/m2) total soil organic matter C - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) ! (gC/m3) VR decomp. (litter, cwd, soil) - real(r8) , intent(in) :: decomp_npools_vr_col(bounds%begc:,1:,1:) ! (gC/m3) VR decomp. (litter, cwd, soil) - real(r8) , intent(out) :: somc_fire_col(bounds%begc:) ! (gC/m2/s) fire C emissions due to peat burning - ! - ! !LOCAL VARIABLES: - integer :: g,c,p,j,l,pi,kyr, kmo, kda, mcsec ! indices - integer :: fp,fc ! filter indices - real(r8):: f ! rate for fire effects (1/s) - real(r8):: m ! acceleration factor for fuel carbon - real(r8):: dt ! time step variable (s) - real(r8):: dayspyr ! days per year - logical :: transient_landcover ! whether this run has any prescribed transient landcover - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(croot_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(stem_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(totsomc_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_npools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(somc_fire_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - - ! NOTE: VR = Vertically Resolved - ! conv. = conversion - ! frac. = fraction - ! BAF = Burned Area Fraction - ! ann. = annual - ! GC = gridcell - ! dt = timestep - ! C = Carbon - ! N = Nitrogen - ! emis. = emissions - ! decomp. = decomposing - - associate( & - croot_prof => croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - totsomc => totsomc_col , & ! Input: [real(r8) (:) ] (gC/m2) total soil organic matter C - decomp_cpools_vr => decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) - decomp_npools_vr => decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) - somc_fire => somc_fire_col , & ! Output: [real(r8) (:) ] (gC/m2/s) fire C emissions due to peat burning - - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - is_litter => decomp_cascade_con%is_litter , & ! Input: [logical (:) ] TRUE => pool is a litter pool - - woody => pftcon%woody , & ! Input: woody lifeform (1=woody, 0=not woody) - cc_leaf => pftcon%cc_leaf , & ! Input: - cc_lstem => pftcon%cc_lstem , & ! Input: - cc_dstem => pftcon%cc_dstem , & ! Input: - cc_other => pftcon%cc_other , & ! Input: - fm_leaf => pftcon%fm_leaf , & ! Input: - fm_lstem => pftcon%fm_lstem , & ! Input: - fm_other => pftcon%fm_other , & ! Input: - fm_root => pftcon%fm_root , & ! Input: - fm_lroot => pftcon%fm_lroot , & ! Input: - fm_droot => pftcon%fm_droot , & ! Input: - lf_flab => pftcon%lf_flab , & ! Input: - lf_fcel => pftcon%lf_fcel , & ! Input: - lf_flig => pftcon%lf_flig , & ! Input: - fr_flab => pftcon%fr_flab , & ! Input: - fr_fcel => pftcon%fr_fcel , & ! Input: - fr_flig => pftcon%fr_flig , & ! Input: - - cmb_cmplt_fact => cnfire_const%cmb_cmplt_fact , & ! Input: [real(r8) (:) ] Combustion completion factor (unitless) - - nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m2) - - cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column - farea_burned => cnveg_state_inst%farea_burned_col , & ! Input: [real(r8) (:) ] fractional area burned (/sec) - fbac1 => cnveg_state_inst%fbac1_col , & ! Input: [real(r8) (:) ] burned area out of conv. region due to LU fire - fbac => cnveg_state_inst%fbac_col , & ! Input: [real(r8) (:) ] total burned area out of conversion (/sec) - baf_crop => cnveg_state_inst%baf_crop_col , & ! Input: [real(r8) (:) ] BAF for cropland - baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Input: [real(r8) (:) ] BAF for peatlabd - trotr1_col => cnveg_state_inst%trotr1_col , & ! Input: [real(r8) (:) ] patch weight of BET on the column (0-1) - trotr2_col => cnveg_state_inst%trotr2_col , & ! Input: [real(r8) (:) ] patch weight of BDT on the column (0-1) - dtrotr_col => cnveg_state_inst%dtrotr_col , & ! Input: [real(r8) (:) ] ann. decreased frac. coverage of BET+BDT (0-1) on GC - lfc => cnveg_state_inst%lfc_col , & ! Input: [real(r8) (:) ] conv. area frac. of BET+BDT that haven't burned before - lfc2 => cnveg_state_inst%lfc2_col , & ! Output: [real(r8) (:) ] conv. area frac. of BET+BDT burned this dt (/sec) - - leafcmax => cnveg_carbonstate_inst%leafcmax_patch , & ! Output: [real(r8) (:) ] (gC/m2) ann max leaf C - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - gresp_xfer => cnveg_carbonstate_inst%gresp_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration transfer - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn => cnveg_nitrogenstate_inst%deadstemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn => cnveg_nitrogenstate_inst%deadcrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - - fire_mortality_c_to_cwdc => cnveg_carbonflux_inst%fire_mortality_c_to_cwdc_col , & ! Input: [real(r8) (:,:) ] C flux fire mortality to CWD (gC/m3/s) - m_leafc_to_fire => cnveg_carbonflux_inst%m_leafc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc - m_leafc_storage_to_fire => cnveg_carbonflux_inst%m_leafc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_storage - m_leafc_xfer_to_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_xfer - m_livestemc_to_fire => cnveg_carbonflux_inst%m_livestemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from livestemc - m_livestemc_storage_to_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_storage - m_livestemc_xfer_to_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_xfer - m_deadstemc_to_fire => cnveg_carbonflux_inst%m_deadstemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer - m_deadstemc_storage_to_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_storage - m_deadstemc_xfer_to_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer - m_frootc_to_fire => cnveg_carbonflux_inst%m_frootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc - m_frootc_storage_to_fire => cnveg_carbonflux_inst%m_frootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_storage - m_frootc_xfer_to_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_xfer - m_livecrootc_to_fire => cnveg_carbonflux_inst%m_livecrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc - m_livecrootc_storage_to_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_storage - m_livecrootc_xfer_to_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_xfer - m_deadcrootc_to_fire => cnveg_carbonflux_inst%m_deadcrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc - m_deadcrootc_storage_to_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_storage - m_deadcrootc_xfer_to_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_xfer - m_gresp_storage_to_fire => cnveg_carbonflux_inst%m_gresp_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_storage - m_gresp_xfer_to_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_xfer - m_leafc_to_litter_fire => cnveg_carbonflux_inst%m_leafc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafc_storage_to_litter_fire => cnveg_carbonflux_inst%m_leafc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_to_deadstemc_fire => cnveg_carbonflux_inst%m_livestemc_to_deadstemc_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_to_litter_fire => cnveg_carbonflux_inst%m_frootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_frootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_to_deadcrootc_fire => cnveg_carbonflux_inst%m_livecrootc_to_deadcrootc_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_gresp_storage_to_litter_fire => cnveg_carbonflux_inst%m_gresp_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_gresp_xfer_to_litter_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_decomp_cpools_to_fire_vr => cnveg_carbonflux_inst%m_decomp_cpools_to_fire_vr_col , & ! Output: [real(r8) (:,:,:) ] (gC/m3/s) VR decomp. C fire loss - m_c_to_litr_met_fire => cnveg_carbonflux_inst%m_c_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] - m_c_to_litr_cel_fire => cnveg_carbonflux_inst%m_c_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] - m_c_to_litr_lig_fire => cnveg_carbonflux_inst%m_c_to_litr_lig_fire_col , & ! Output: [real(r8) (:,:) ] - - fire_mortality_n_to_cwdn => cnveg_nitrogenflux_inst%fire_mortality_n_to_cwdn_col , & ! Input: [real(r8) (:,:) ] N flux fire mortality to CWD (gN/m3/s) - m_leafn_to_fire => cnveg_nitrogenflux_inst%m_leafn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn - m_leafn_storage_to_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_storage - m_leafn_xfer_to_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_xfer - m_livestemn_to_fire => cnveg_nitrogenflux_inst%m_livestemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn - m_livestemn_storage_to_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_s - m_livestemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_xfer - m_deadstemn_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn - m_deadstemn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_storage - m_deadstemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_xfer - m_frootn_to_fire => cnveg_nitrogenflux_inst%m_frootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn - m_frootn_storage_to_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_storage - m_frootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_xfer - m_livecrootn_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. m_livecrootn_to_fire - m_livecrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_storage - m_livecrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_xfer - m_deadcrootn_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn - m_deadcrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_storage - m_deadcrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_xfer - m_retransn_to_fire => cnveg_nitrogenflux_inst%m_retransn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. retransn - m_leafn_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_to_deadstemn_fire => cnveg_nitrogenflux_inst%m_livestemn_to_deadstemn_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_to_deadcrootn_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_deadcrootn_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_retransn_to_litter_fire => cnveg_nitrogenflux_inst%m_retransn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_decomp_npools_to_fire_vr => cnveg_nitrogenflux_inst%m_decomp_npools_to_fire_vr_col , & ! Output: [real(r8) (:,:,:) ] VR decomp. N fire loss (gN/m3/s) - m_n_to_litr_met_fire => cnveg_nitrogenflux_inst%m_n_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] - m_n_to_litr_cel_fire => cnveg_nitrogenflux_inst%m_n_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] - m_n_to_litr_lig_fire => cnveg_nitrogenflux_inst%m_n_to_litr_lig_fire_col & ! Output: [real(r8) (:,:) ] - ) - - transient_landcover = run_has_transient_landcover() - - ! Get model step size - ! calculate burned area fraction per sec - dt = real( get_step_size(), r8 ) - - dayspyr = get_days_per_year() - ! - ! patch loop - ! - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8)then - ! For non-crop (bare-soil and natural vegetation) - if (transient_landcover) then - f = (fbac(c)-baf_crop(c))/(1.0_r8-cropf_col(c)) - else - f = (farea_burned(c)-baf_crop(c))/(1.0_r8-cropf_col(c)) - end if - else - ! For crops - if(cropf_col(c) > 0._r8)then - f = baf_crop(c) /cropf_col(c) - else - f = 0._r8 - end if - end if - - ! apply this rate to the patch state variables to get flux rates - ! biomass burning - ! carbon fluxes - m = 1._r8 - if (spinup_state == 2) then - m = 10._r8 - end if - - m_leafc_to_fire(p) = leafc(p) * f * cc_leaf(patch%itype(p)) - m_leafc_storage_to_fire(p) = leafc_storage(p) * f * cc_other(patch%itype(p)) - m_leafc_xfer_to_fire(p) = leafc_xfer(p) * f * cc_other(patch%itype(p)) - m_livestemc_to_fire(p) = livestemc(p) * f * cc_lstem(patch%itype(p)) - m_livestemc_storage_to_fire(p) = livestemc_storage(p) * f * cc_other(patch%itype(p)) - m_livestemc_xfer_to_fire(p) = livestemc_xfer(p) * f * cc_other(patch%itype(p)) - m_deadstemc_to_fire(p) = deadstemc(p) * f * cc_dstem(patch%itype(p)) * m - m_deadstemc_storage_to_fire(p) = deadstemc_storage(p) * f * cc_other(patch%itype(p)) - m_deadstemc_xfer_to_fire(p) = deadstemc_xfer(p) * f * cc_other(patch%itype(p)) - m_frootc_to_fire(p) = frootc(p) * f * 0._r8 - m_frootc_storage_to_fire(p) = frootc_storage(p) * f * cc_other(patch%itype(p)) - m_frootc_xfer_to_fire(p) = frootc_xfer(p) * f * cc_other(patch%itype(p)) - m_livecrootc_to_fire(p) = livecrootc(p) * f * 0._r8 - m_livecrootc_storage_to_fire(p) = livecrootc_storage(p) * f * cc_other(patch%itype(p)) - m_livecrootc_xfer_to_fire(p) = livecrootc_xfer(p) * f * cc_other(patch%itype(p)) - m_deadcrootc_to_fire(p) = deadcrootc(p) * f * 0._r8 - m_deadcrootc_storage_to_fire(p) = deadcrootc_storage(p) * f* cc_other(patch%itype(p)) - m_deadcrootc_xfer_to_fire(p) = deadcrootc_xfer(p) * f * cc_other(patch%itype(p)) - m_gresp_storage_to_fire(p) = gresp_storage(p) * f * cc_other(patch%itype(p)) - m_gresp_xfer_to_fire(p) = gresp_xfer(p) * f * cc_other(patch%itype(p)) - - - ! nitrogen fluxes - m_leafn_to_fire(p) = leafn(p) * f * cc_leaf(patch%itype(p)) - m_leafn_storage_to_fire(p) = leafn_storage(p) * f * cc_other(patch%itype(p)) - m_leafn_xfer_to_fire(p) = leafn_xfer(p) * f * cc_other(patch%itype(p)) - m_livestemn_to_fire(p) = livestemn(p) * f * cc_lstem(patch%itype(p)) - m_livestemn_storage_to_fire(p) = livestemn_storage(p) * f * cc_other(patch%itype(p)) - m_livestemn_xfer_to_fire(p) = livestemn_xfer(p) * f * cc_other(patch%itype(p)) - m_deadstemn_to_fire(p) = deadstemn(p) * f * cc_dstem(patch%itype(p)) * m - m_deadstemn_storage_to_fire(p) = deadstemn_storage(p) * f * cc_other(patch%itype(p)) - m_deadstemn_xfer_to_fire(p) = deadstemn_xfer(p) * f * cc_other(patch%itype(p)) - m_frootn_to_fire(p) = frootn(p) * f * 0._r8 - m_frootn_storage_to_fire(p) = frootn_storage(p) * f * cc_other(patch%itype(p)) - m_frootn_xfer_to_fire(p) = frootn_xfer(p) * f * cc_other(patch%itype(p)) - m_livecrootn_to_fire(p) = livecrootn(p) * f * 0._r8 - m_livecrootn_storage_to_fire(p) = livecrootn_storage(p) * f * cc_other(patch%itype(p)) - m_livecrootn_xfer_to_fire(p) = livecrootn_xfer(p) * f * cc_other(patch%itype(p)) - m_deadcrootn_to_fire(p) = deadcrootn(p) * f * 0._r8 - m_deadcrootn_xfer_to_fire(p) = deadcrootn_xfer(p) * f * cc_other(patch%itype(p)) - m_deadcrootn_storage_to_fire(p) = deadcrootn_storage(p) * f * cc_other(patch%itype(p)) - m_retransn_to_fire(p) = retransn(p) * f * cc_other(patch%itype(p)) - - ! mortality due to fire - ! carbon pools - m_leafc_to_litter_fire(p) = leafc(p) * f * & - (1._r8 - cc_leaf(patch%itype(p))) * & - fm_leaf(patch%itype(p)) - m_leafc_storage_to_litter_fire(p) = leafc_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_leafc_xfer_to_litter_fire(p) = leafc_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent fraction of transport from livestem/livecroot to litter - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) - m_livestemc_to_litter_fire(p) = livestemc(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_livestemc_storage_to_litter_fire(p) = livestemc_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemc_xfer_to_litter_fire(p) = livestemc_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent the fraction of plant-tissue mortality for deadstem/deadcroot - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 - m_livestemc_to_deadstemc_fire(p) = livestemc(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - (fm_lstem(patch%itype(p))-fm_droot(patch%itype(p))) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent fraction of transport from deadstem/deadcroot to litter - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) - m_deadstemc_to_litter_fire(p) = deadstemc(p) * f * m * & - (1._r8 - cc_dstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_deadstemc_storage_to_litter_fire(p) = deadstemc_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadstemc_xfer_to_litter_fire(p) = deadstemc_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootc_to_litter_fire(p) = frootc(p) * f * & - fm_root(patch%itype(p)) - m_frootc_storage_to_litter_fire(p) = frootc_storage(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootc_xfer_to_litter_fire(p) = frootc_xfer(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent fraction of transport from livestem/livecroot to litter - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) - m_livecrootc_to_litter_fire(p) = livecrootc(p) * f * & - fm_droot(patch%itype(p)) - m_livecrootc_storage_to_litter_fire(p) = livecrootc_storage(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootc_xfer_to_litter_fire(p) = livecrootc_xfer(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootc_to_deadcrootc_fire(p) = livecrootc(p) * f * & - (fm_lroot(patch%itype(p))-fm_droot(patch%itype(p))) - m_deadcrootc_to_litter_fire(p) = deadcrootc(p) * f * m * & - fm_droot(patch%itype(p)) - m_deadcrootc_storage_to_litter_fire(p) = deadcrootc_storage(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadcrootc_xfer_to_litter_fire(p) = deadcrootc_xfer(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_gresp_storage_to_litter_fire(p) = gresp_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_gresp_xfer_to_litter_fire(p) = gresp_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - - - ! nitrogen pools - m_leafn_to_litter_fire(p) = leafn(p) * f * & - (1._r8 - cc_leaf(patch%itype(p))) * & - fm_leaf(patch%itype(p)) - m_leafn_storage_to_litter_fire(p) = leafn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_leafn_xfer_to_litter_fire(p) = leafn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent fraction of transport from livestem/livecroot to litter - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) - m_livestemn_to_litter_fire(p) = livestemn(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_livestemn_storage_to_litter_fire(p) = livestemn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemn_xfer_to_litter_fire(p) = livestemn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent the fraction of plant-tissue mortality for deadstem/deadcroot - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 - m_livestemn_to_deadstemn_fire(p) = livestemn(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - (fm_lstem(patch%itype(p))-fm_droot(patch%itype(p))) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent fraction of transport from deadstem/deadcroot to litter - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) - m_deadstemn_to_litter_fire(p) = deadstemn(p) * f * m * & - (1._r8 - cc_dstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_deadstemn_storage_to_litter_fire(p) = deadstemn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadstemn_xfer_to_litter_fire(p) = deadstemn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootn_to_litter_fire(p) = frootn(p) * f * & - fm_root(patch%itype(p)) - m_frootn_storage_to_litter_fire(p) = frootn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootn_xfer_to_litter_fire(p) = frootn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - ! NOTE: It looks incorrect to use fm_droot here, but it's used to represent fraction of transport from livestem/livecroot to litter - ! EBK Oct/06/2017 see bug 2516 http://bugs.cgd.ucar.edu/show_bug.cgi?id=2516 (stem and root live or dead assumed to have the same transport) - m_livecrootn_to_litter_fire(p) = livecrootn(p) * f * & - fm_droot(patch%itype(p)) - m_livecrootn_storage_to_litter_fire(p) = livecrootn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootn_xfer_to_litter_fire(p) = livecrootn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootn_to_deadcrootn_fire(p) = livecrootn(p) * f * & - (fm_lroot(patch%itype(p))-fm_droot(patch%itype(p))) - m_deadcrootn_to_litter_fire(p) = deadcrootn(p) * f * m * & - fm_droot(patch%itype(p)) - m_deadcrootn_storage_to_litter_fire(p) = deadcrootn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadcrootn_xfer_to_litter_fire(p) = deadcrootn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_retransn_to_litter_fire(p) = retransn(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - - if (use_cndv) then - if ( woody(patch%itype(p)) == 1._r8 )then - if ( livestemc(p)+deadstemc(p) > 0._r8 )then - nind(p) = nind(p)*(1._r8-1._r8*fm_droot(patch%itype(p))*f) - else - nind(p) = 0._r8 - end if - end if - leafcmax(p) = max(leafc(p)-m_leafc_to_fire(p)*dt, leafcmax(p)) - if (patch%itype(p) == noveg) leafcmax(p) = 0._r8 - end if - - end do ! end of patches loop - - ! fire-induced transfer of carbon and nitrogen pools to litter and cwd - - do j = 1,nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if ( patch%active(p) ) then - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadstemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadcrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadstemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadcrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livestemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livecrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livestemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livecrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - m_c_to_litr_met_fire(c,j)=m_c_to_litr_met_fire(c,j) + & - ((m_leafc_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafc_storage_to_litter_fire(p) + & - m_leafc_xfer_to_litter_fire(p) + & - m_gresp_storage_to_litter_fire(p) & - +m_gresp_xfer_to_litter_fire(p))*leaf_prof(p,j) + & - (m_frootc_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootc_storage_to_litter_fire(p) + & - m_frootc_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemc_storage_to_litter_fire(p) + & - m_livestemc_xfer_to_litter_fire(p) & - +m_deadstemc_storage_to_litter_fire(p) + & - m_deadstemc_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootc_storage_to_litter_fire(p) + & - m_livecrootc_xfer_to_litter_fire(p) & - +m_deadcrootc_storage_to_litter_fire(p) + & - m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - - m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & - ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafn_storage_to_litter_fire(p) + & - m_leafn_xfer_to_litter_fire(p)+m_retransn_to_litter_fire(p)) & - *leaf_prof(p,j) +(m_frootn_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootn_storage_to_litter_fire(p) + & - m_frootn_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemn_storage_to_litter_fire(p) + & - m_livestemn_xfer_to_litter_fire(p) & - +m_deadstemn_storage_to_litter_fire(p) + & - m_deadstemn_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootn_storage_to_litter_fire(p) + & - m_livecrootn_xfer_to_litter_fire(p) & - +m_deadcrootn_storage_to_litter_fire(p) + & - m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - end if - end if - end do - end do - end do - ! - ! vertically-resolved decomposing C/N fire loss - ! column loop - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - - f = farea_burned(c) - - do j = 1, nlevdecomp - ! carbon fluxes - do l = 1, ndecomp_pools - if ( is_litter(l) ) then - m_decomp_cpools_to_fire_vr(c,j,l) = decomp_cpools_vr(c,j,l) * f * & - cmb_cmplt_fact(lit_fp) - end if - if ( is_cwd(l) ) then - m_decomp_cpools_to_fire_vr(c,j,l) = decomp_cpools_vr(c,j,l) * & - (f-baf_crop(c)) * cmb_cmplt_fact(cwd_fp) - end if - end do - - ! nitrogen fluxes - do l = 1, ndecomp_pools - if ( is_litter(l) ) then - m_decomp_npools_to_fire_vr(c,j,l) = decomp_npools_vr(c,j,l) * f * & - cmb_cmplt_fact(lit_fp) - end if - if ( is_cwd(l) ) then - m_decomp_npools_to_fire_vr(c,j,l) = decomp_npools_vr(c,j,l) * & - (f-baf_crop(c)) * cmb_cmplt_fact(cwd_fp) - end if - end do - - end do - end do ! end of column loop - - ! carbon loss due to deforestation fires - - if (transient_landcover) then - call get_curr_date (kyr, kmo, kda, mcsec) - do fc = 1,num_soilc - c = filter_soilc(fc) - lfc2(c)=0._r8 - if( .not. (kmo == 1 .and. kda == 1 .and. mcsec == 0) )then - if( trotr1_col(c)+trotr2_col(c) > 0.6_r8 .and. dtrotr_col(c) > 0._r8 .and. & - lfc(c) > 0._r8 .and. fbac1(c) == 0._r8) then - lfc2(c) = max(0._r8, min(lfc(c), (farea_burned(c)-baf_crop(c) - & - baf_peatf(c))/2.0*dt))/(dtrotr_col(c)*dayspyr*secspday/dt)/dt - lfc(c) = lfc(c) - max(0._r8, min(lfc(c), (farea_burned(c)-baf_crop(c) - & - baf_peatf(c))*dt/2.0_r8)) - end if - end if - end do - end if - ! - ! Carbon loss due to peat fires - ! - ! somc_fire is not connected to clm45 soil carbon pool, ie does not decrease - ! soil carbon b/c clm45 soil carbon was very low in several peatland grids - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if( grc%latdeg(g) < cnfire_const%borealat)then - somc_fire(c)= totsomc(c)*baf_peatf(c)*6.0_r8/33.9_r8 - else - somc_fire(c)= baf_peatf(c)*2.2e3_r8 - end if - end do - - ! Fang Li has not added aerosol and trace gas emissions due to fire, yet - ! They will be added here in proportion to the carbon emission - ! Emission factors differ for various fire types - - end associate - - end subroutine CNFireFluxes - - !----------------------------------------------------------------------- - subroutine hdm_init( this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize data stream information for population density. - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - implicit none - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: stream_year_first_popdens ! first year in pop. dens. stream to use - integer :: stream_year_last_popdens ! last year in pop. dens. stream to use - integer :: model_year_align_popdens ! align stream_year_first_hdm with - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_popdens ! population density streams filename - character(len=CL) :: popdensmapalgo = 'bilinear' ! mapping alogrithm for population density - character(*), parameter :: subName = "('hdmdyn_init')" - character(*), parameter :: F00 = "('(hdmdyn_init) ',4a)" - !----------------------------------------------------------------------- - - namelist /popd_streams/ & - stream_year_first_popdens, & - stream_year_last_popdens, & - model_year_align_popdens, & - popdensmapalgo, & - stream_fldFileName_popdens - - ! Default values for namelist - stream_year_first_popdens = 1 ! first year in stream to use - stream_year_last_popdens = 1 ! last year in stream to use - model_year_align_popdens = 1 ! align stream_year_first_popdens with this model year - stream_fldFileName_popdens = ' ' - - ! Read popd_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'popd_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=popd_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading popd_streams namelist'//errMsg(sourcefile, __LINE__)) - end if - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_popdens, mpicom) - call shr_mpi_bcast(stream_year_last_popdens, mpicom) - call shr_mpi_bcast(model_year_align_popdens, mpicom) - call shr_mpi_bcast(stream_fldFileName_popdens, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'popdens_streams settings:' - write(iulog,*) ' stream_year_first_popdens = ',stream_year_first_popdens - write(iulog,*) ' stream_year_last_popdens = ',stream_year_last_popdens - write(iulog,*) ' model_year_align_popdens = ',model_year_align_popdens - write(iulog,*) ' stream_fldFileName_popdens = ',stream_fldFileName_popdens - write(iulog,*) ' ' - endif - - call clm_domain_mct (bounds, dom_clm) - - call shr_strdata_create(this%sdat_hdm,name="clmhdm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_popdens, & - yearLast=stream_year_last_popdens, & - yearAlign=model_year_align_popdens, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_popdens), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/trim(stream_fldFileName_popdens)/) , & - fldListFile='hdm', & - fldListModel='hdm', & - fillalgo='none', & - mapalgo=popdensmapalgo, & - calendar=get_calendar(), & - tintalgo='nearest', & - taxmode='extend' ) - - if (masterproc) then - call shr_strdata_print(this%sdat_hdm,'population density data') - endif - - ! Add history fields - call hist_addfld1d (fname='HDM', units='counts/km^2', & - avgflag='A', long_name='human population density', & - ptr_lnd=this%forc_hdm, default='inactive') - - end subroutine hdm_init - - !----------------------------------------------------------------------- - subroutine hdm_interp( this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate data stream information for population density. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, ig - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(this%sdat_hdm, mcdate, sec, mpicom, 'hdmdyn') - - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - this%forc_hdm(g) = this%sdat_hdm%avs(1)%rAttr(1,ig) - end do - - end subroutine hdm_interp - - !----------------------------------------------------------------------- - subroutine lnfm_init( this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! - ! Initialize data stream information for Lightning. - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - implicit none - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - ! - ! !LOCAL VARIABLES: - integer :: stream_year_first_lightng ! first year in Lightning stream to use - integer :: stream_year_last_lightng ! last year in Lightning stream to use - integer :: model_year_align_lightng ! align stream_year_first_lnfm with - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_lightng ! lightning stream filename to read - character(len=CL) :: lightngmapalgo = 'bilinear'! Mapping alogrithm - character(*), parameter :: subName = "('lnfmdyn_init')" - character(*), parameter :: F00 = "('(lnfmdyn_init) ',4a)" - !----------------------------------------------------------------------- - - namelist /light_streams/ & - stream_year_first_lightng, & - stream_year_last_lightng, & - model_year_align_lightng, & - lightngmapalgo, & - stream_fldFileName_lightng - - ! Default values for namelist - stream_year_first_lightng = 1 ! first year in stream to use - stream_year_last_lightng = 1 ! last year in stream to use - model_year_align_lightng = 1 ! align stream_year_first_lnfm with this model year - stream_fldFileName_lightng = ' ' - - ! Read light_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'light_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=light_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading light_streams namelist'//errMsg(sourcefile, __LINE__)) - end if - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_lightng, mpicom) - call shr_mpi_bcast(stream_year_last_lightng, mpicom) - call shr_mpi_bcast(model_year_align_lightng, mpicom) - call shr_mpi_bcast(stream_fldFileName_lightng, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'light_stream settings:' - write(iulog,*) ' stream_year_first_lightng = ',stream_year_first_lightng - write(iulog,*) ' stream_year_last_lightng = ',stream_year_last_lightng - write(iulog,*) ' model_year_align_lightng = ',model_year_align_lightng - write(iulog,*) ' stream_fldFileName_lightng = ',stream_fldFileName_lightng - write(iulog,*) ' ' - endif - - call clm_domain_mct (bounds, dom_clm) - - call shr_strdata_create(this%sdat_lnfm,name="clmlnfm", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_lightng, & - yearLast=stream_year_last_lightng, & - yearAlign=model_year_align_lightng, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_lightng), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/trim(stream_fldFileName_lightng)/),& - fldListFile='lnfm', & - fldListModel='lnfm', & - fillalgo='none', & - mapalgo=lightngmapalgo, & - calendar=get_calendar(), & - taxmode='cycle' ) - - if (masterproc) then - call shr_strdata_print(this%sdat_lnfm,'Lightning data') - endif - - ! Add history fields - call hist_addfld1d (fname='LNFM', units='counts/km^2/hr', & - avgflag='A', long_name='Lightning frequency', & - ptr_lnd=this%forc_lnfm, default='inactive') - - end subroutine lnfm_init - - !----------------------------------------------------------------------- - subroutine lnfm_interp(this, bounds ) - ! - ! !DESCRIPTION: - ! Interpolate data stream information for Lightning. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - ! - ! !ARGUMENTS: - class(cnfire_base_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, ig - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(this%sdat_lnfm, mcdate, sec, mpicom, 'lnfmdyn') - - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - this%forc_lnfm(g) = this%sdat_lnfm%avs(1)%rAttr(1,ig) - end do - - end subroutine lnfm_interp - -end module CNFireBaseMod diff --git a/src/biogeochem/CNFireEmissionsMod.F90 b/src/biogeochem/CNFireEmissionsMod.F90 deleted file mode 100644 index 7f85ded3a3..0000000000 --- a/src/biogeochem/CNFireEmissionsMod.F90 +++ /dev/null @@ -1,377 +0,0 @@ -module CNFireEmissionsMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Gathers carbon emissions from fire sources to be sent to CAM-Chem via - ! the coupler .... - ! Created by F. Vitt, and revised by F. Li - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils, only : endrun - use PatchType, only : patch - use decompMod, only : bounds_type - use shr_fire_emis_mod, only : shr_fire_emis_comps_n, shr_fire_emis_comp_t, shr_fire_emis_linkedlist - use shr_fire_emis_mod, only : shr_fire_emis_mechcomps_n, shr_fire_emis_mechcomps - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNFireEmisUpdate - ! - ! !PRIVATE TYPES: - type, private :: emis_t - real(r8), pointer :: emis(:) - end type emis_t - ! - ! !PUBLIC TYPES: - type, public :: fireemis_type - real(r8), pointer, public :: fireflx_patch(:,:) ! carbon flux from fire sources (kg/m2/sec) - real(r8), pointer, public :: ztop_patch(:) ! height of the smoke plume (meters) - type(emis_t), pointer, private :: comp(:) ! fire emissions component (corresponds to emis factors table input file) - type(emis_t), pointer, private :: mech(:) ! cam-chem mechism species emissions - type(emis_t), private :: totfire ! sum of all species emissions - contains - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - end type fireemis_type - !------------------------------------------------------------------------ -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - - use shr_fire_emis_mod, only : shr_fire_emis_factors_file - use FireEmisFactorsMod, only : fire_emis_factors_init, fire_emis_factors_get - use clm_varpar, only : numpft - - implicit none - - ! args - class(fireemis_type) :: this - type(bounds_type), intent(in) :: bounds - - ! local vars - integer :: nmech, nemis - real(r8) :: factors(numpft) - real(r8) :: molec_wght - type(shr_fire_emis_comp_t), pointer :: emis_cmp - - if ( shr_fire_emis_mechcomps_n < 1) return - - call fire_emis_factors_init( shr_fire_emis_factors_file ) - - emis_cmp => shr_fire_emis_linkedlist - do while(associated(emis_cmp)) - allocate(emis_cmp%emis_factors(numpft)) - call fire_emis_factors_get( trim(emis_cmp%name), factors, molec_wght ) - emis_cmp%emis_factors = factors*1.e-3_r8 ! convert g/kg dry fuel to kg/kg - emis_cmp%molec_weight = molec_wght - emis_cmp => emis_cmp%next_emiscomp - enddo - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! Allocate memory for module datatypes - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : spval - - ! !ARGUMENTS: - class(fireemis_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: beg, end, i - !--------------------------------------------------------------------- - - beg = bounds%begp - end = bounds%endp - - allocate(this%totfire%emis(beg:end)) - this%totfire%emis(beg:end) = nan - - if (shr_fire_emis_mechcomps_n>0) then - allocate(this%ztop_patch(beg:end)) - this%ztop_patch(beg:end) = spval - - allocate(this%fireflx_patch(beg:end,shr_fire_emis_mechcomps_n)) - this%fireflx_patch(beg:end,:) = spval - - allocate(this%mech(shr_fire_emis_mechcomps_n)) - do i = 1, shr_fire_emis_mechcomps_n - allocate(this%mech(i)%emis(beg:end)) - this%mech(i)%emis(beg:end) = nan - enddo - endif - - if (shr_fire_emis_comps_n>0) then - allocate(this%comp(shr_fire_emis_comps_n)) - do i = 1, shr_fire_emis_comps_n - allocate(this%comp(i)%emis(beg:end)) - this%comp(i)%emis(beg:end) = nan - enddo - endif - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d - - ! !ARGUMENTS: - class(fireemis_type) :: this - type(bounds_type), intent(in) :: bounds - - ! !LOCAL VARIABLES - integer :: begp, endp - integer :: imech, icomp - type(shr_fire_emis_comp_t), pointer :: emis_cmp - - if (shr_fire_emis_mechcomps_n>0) then - - emis_cmp => shr_fire_emis_linkedlist - - ! loop over fire components - emis_cmp_loop: do while(associated(emis_cmp)) - - icomp = emis_cmp%index - - call hist_addfld1d (fname='FireComp_'//trim(emis_cmp%name), units='kg/m2/sec', & - avgflag='A', long_name='fire emissions flux of '//trim(emis_cmp%name), & - ptr_patch=this%comp(icomp)%emis, default='inactive') - - emis_cmp => emis_cmp%next_emiscomp - - enddo emis_cmp_loop - - ! loop over atm chem mechanism species - do imech = 1,shr_fire_emis_mechcomps_n - - call hist_addfld1d (fname='FireMech_'//trim(shr_fire_emis_mechcomps(imech)%name), units='kg/m2/sec', & - avgflag='A', long_name='fire emissions flux of '//trim(shr_fire_emis_mechcomps(imech)%name), & - ptr_patch=this%mech(imech)%emis, default='inactive') - - enddo - - call hist_addfld1d (fname='FireEmis_TOT', units='gC/m2/sec', & - avgflag='A', long_name='Total fire emissions flux ', & - ptr_patch=this%totfire%emis, default='inactive') - - call hist_addfld1d (fname='FireEmis_ZTOP', units='m', & - avgflag='A', long_name='Top of vertical fire emissions distribution ', & - ptr_patch=this%ztop_patch, default='inactive') - endif - - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine CNFireEmisUpdate(bounds, num_soilp, filter_soilp, cnveg_cf_inst, cnveg_cs_inst, fireemis_inst ) - - use CNVegcarbonfluxType, only : cnveg_carbonflux_type - use CNVegCarbonStateType, only : cnveg_carbonstate_type - use clm_varpar, only : ndecomp_pools, nlevdecomp - use clm_varcon, only : dzsoi_decomp - - !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts - type(cnveg_carbonflux_type), intent(in) :: cnveg_cf_inst - type(cnveg_carbonstate_type),intent(in) :: cnveg_cs_inst - type(fireemis_type), intent(inout) :: fireemis_inst - - !LOCAL VARIABLES: - real(r8) :: fire_flux - real(r8) :: fire_flux_lf - real(r8) :: fire_flux_lf1 - type(shr_fire_emis_comp_t), pointer :: emis_cmp - real(r8) :: emis_flux(shr_fire_emis_comps_n) - integer :: fp,p,g,c ! indices - real(r8) :: epsilon ! emission factor [ug m-2 h-1] - integer :: i, ii, icomp, imech, n_emis_comps, l, j - - if ( shr_fire_emis_mechcomps_n < 1) return - - associate( & - fire_emis => fireemis_inst%fireflx_patch, & - totfire => fireemis_inst%totfire, & - mech => fireemis_inst%mech, & - comp => fireemis_inst%comp, & - ztop => fireemis_inst%ztop_patch & - ) - - ! initialize to zero ... - fire_emis(bounds%begp:bounds%endp,:) = 0._r8 - totfire%emis(bounds%begp:bounds%endp) = 0._r8 - ztop(bounds%begp:bounds%endp) = 0._r8 - - do i = 1, shr_fire_emis_mechcomps_n - mech(i)%emis(bounds%begp:bounds%endp) = 0._r8 - enddo - - do i = 1, shr_fire_emis_comps_n - comp(i)%emis(bounds%begp:bounds%endp) = 0._r8 - enddo - - ! Begin loop over points - !_______________________________________________________________________________ - do fp = 1,num_soilp - p = filter_soilp(fp) - g = patch%gridcell(p) - c = patch%column(p) - - ! initialize EF - epsilon=0._r8 - emis_flux(:) = 0._r8 - - ! calculate fire emissions for non-bare ground PFTs - if (patch%itype(p) > 0)then - if(cnveg_cs_inst%totvegc_col(c) > 0._r8)then - fire_flux_lf1=0._r8 - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - fire_flux_lf1 = fire_flux_lf1 + & - cnveg_cf_inst%m_decomp_cpools_to_fire_vr_col(c,j,l)*dzsoi_decomp(j) - enddo - end do - fire_flux_lf = fire_flux_lf1*cnveg_cs_inst%totvegc_patch(p)/cnveg_cs_inst%totvegc_col(c) - else - fire_flux_lf=0._r8 - end if - fire_flux = fire_flux_lf & - + cnveg_cf_inst%m_leafc_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from leafc - + cnveg_cf_inst%m_leafc_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from leafc_storage - + cnveg_cf_inst%m_leafc_xfer_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from leafc_xfer - + cnveg_cf_inst%m_livestemc_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from livestemc - + cnveg_cf_inst%m_livestemc_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from livestemc_storage - + cnveg_cf_inst%m_livestemc_xfer_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from livestemc_xfer - + cnveg_cf_inst%m_deadstemc_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from deadstemc_xfer - + cnveg_cf_inst%m_deadstemc_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from deadstemc_storage - + cnveg_cf_inst%m_deadstemc_xfer_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from deadstemc_xfer - + cnveg_cf_inst%m_frootc_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from frootc - + cnveg_cf_inst%m_frootc_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from frootc_storage - + cnveg_cf_inst%m_frootc_xfer_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from frootc_xfer - + cnveg_cf_inst%m_livecrootc_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from livecrootc - + cnveg_cf_inst%m_livecrootc_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from livecrootc_storage - + cnveg_cf_inst%m_livecrootc_xfer_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from livecrootc_xfer - + cnveg_cf_inst%m_deadcrootc_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from deadcrootc - + cnveg_cf_inst%m_deadcrootc_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from deadcrootc_storage - + cnveg_cf_inst%m_deadcrootc_xfer_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from deadcrootc_xfer - + cnveg_cf_inst%m_gresp_storage_to_fire_patch (p) & ! (gC/m2/s) fire C emissions from gresp_storage - + cnveg_cf_inst%m_gresp_xfer_to_fire_patch (p) ! (gC/m2/s) fire C emissions from gresp_xfer - ! for diagnostics - totfire%emis(p) = fire_flux ! gC/m2/sec - - ! loop over fire components - emis_cmp => shr_fire_emis_linkedlist - emis_cmp_loop: do while(associated(emis_cmp)) - - icomp = emis_cmp%index - epsilon = emis_cmp%emis_factors(patch%itype(p)) - - comp(icomp)%emis(p) = epsilon * fire_flux* 1.e-3_r8/0.5_r8 ! (to convert gC/m2/sec to kg species/m2/sec) - emis_flux(icomp) = emis_cmp%coeff*comp(icomp)%emis(p) - - emis_cmp => emis_cmp%next_emiscomp - - enddo emis_cmp_loop - - ! sum up the emissions compontent fluxes for the fluxes of chem mechanism compounds - do imech = 1,shr_fire_emis_mechcomps_n - n_emis_comps = shr_fire_emis_mechcomps(imech)%n_emis_comps - do icomp = 1,n_emis_comps ! loop over number of emission components that make up the nth mechanism compoud - ii = shr_fire_emis_mechcomps(imech)%emis_comps(icomp)%ptr%index - fire_emis(p,imech) = fire_emis(p,imech) + emis_flux(ii) - mech(imech)%emis(p) = fire_emis(p,imech) - enddo - enddo - - ztop(p) = vert_dist_top( patch%itype(p) ) - - end if ! ivt(1:15 only) - - enddo ! fp - end associate - - end subroutine CNFireEmisUpdate - -! Private methods -!----------------------------------------------------------------------- -!ztop compiled from Val Martin et al ACP 2010, Tosca et al. JGR 2011 and Jian et al., ACP 2013 -!st ztop updated based on Val Martin pers. communication Jan2015 -!----------------------------------------------------------------------- -! not_vegetated 500 m -!PFT1: needleleaf_evergreen_temperate_tree 4000 m -!2: needleleaf_evergreen_boreal_tree 4000 m -!3: needleleaf_deciduous_boreal_tree 3000 m -!4: broadleaf_evergreen_tropical_tree 2500 m -!5: broadleaf_evergreen_temperate_tree 3000 m -!6: broadleaf_deciduous_tropical_tree 2500 m -!7: broadleaf_deciduous_temperate_tree 3000 m -!8: broadleaf_deciduous_boreal_tree 3000 m -!9: broadleaf_evergreen_shrub 2000 m -!10: broadleaf_deciduous_temperate_shrub 2000 m -!11: broadleaf_deciduous_boreal_shrub 2000 m -!12: c3_arctic_grass 1000 m -!13: c3_non-arctic_grass 1000 m -!14: c4_grass 1000 m -!15: c3_crop 1000 m -!(and all new crops: 1000m) - - function vert_dist_top( veg_type ) result(ztop) - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use pftconMod , only : noveg, ndllf_evr_tmp_tree, ndllf_evr_brl_tree - use pftconMod , only : ndllf_dcd_brl_tree, nbrdlf_evr_tmp_tree - use pftconMod , only : nbrdlf_dcd_tmp_tree, nbrdlf_dcd_brl_tree - use pftconMod , only : nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree - use pftconMod , only : nbrdlf_evr_shrub, nbrdlf_dcd_brl_shrub - use pftconMod , only : nc3_arctic_grass, nc3_nonarctic_grass - use pftconMod , only : nc3crop, nc3irrig - use pftconMod , only : npcropmin, npcropmax - implicit none - integer, intent(in) :: veg_type - - real(r8) :: ztop - - ! Bare soil, won't be used - if ( veg_type == noveg ) then - ztop = nan - ! temperate and boreal evergreen needleleaf trees - else if ( veg_type == ndllf_evr_tmp_tree .or. veg_type == ndllf_evr_brl_tree ) then - ztop = 4.e3_r8 ! m - ! temperate and boreal trees - else if ( veg_type == ndllf_dcd_brl_tree .or. veg_type == nbrdlf_evr_tmp_tree .or. & - veg_type == nbrdlf_dcd_tmp_tree .or. veg_type == nbrdlf_dcd_brl_tree ) then - ztop = 3.e3_r8 ! m - ! tropical broadleaf trees (evergreen and decidious) - else if ( veg_type == nbrdlf_evr_trp_tree .or. veg_type == nbrdlf_dcd_trp_tree ) then - ztop = 2.5e3_r8 ! m - ! shrubs - else if ( veg_type >= nbrdlf_evr_shrub .and. veg_type <= nbrdlf_dcd_brl_shrub ) then - ztop = 2.e3_r8 ! m - ! grasses - else if ( veg_type >= nc3_arctic_grass .and. veg_type <= nc3_nonarctic_grass ) then - ztop = 1.e3_r8 ! m - ! generic unmanaged crops - else if ( veg_type == nc3crop .or. veg_type <= nc3irrig ) then - ztop = 1.e3_r8 ! m - ! Prognostic crops - else if ( veg_type >= npcropmin .and. veg_type <= npcropmax ) then - ztop = 1.e3_r8 ! m - else - call endrun('ERROR:: undefined veg_type' ) - end if - - end function vert_dist_top - -end module CNFireEmissionsMod - diff --git a/src/biogeochem/CNFireFactoryMod.F90 b/src/biogeochem/CNFireFactoryMod.F90 deleted file mode 100644 index 71376116b9..0000000000 --- a/src/biogeochem/CNFireFactoryMod.F90 +++ /dev/null @@ -1,125 +0,0 @@ -module CNFireFactoryMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Factory to create an instance of cnfire_method_type. This module figures - ! out the particular type to return. - ! - ! !USES: - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - - implicit none - save - private - ! - ! !PUBLIC ROUTINES: - public :: CNFireReadNML ! read the fire namelist - public :: create_cnfire_method ! create an object of class cnfire_method_type - - ! !PRIVATE DATA MEMBERS: - character(len=80), private :: fire_method = "li2014qianfrc" - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine CNFireReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for cnfire - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNFireReadNML' - character(len=*), parameter :: nmlname = 'cnfire_inparm' - !----------------------------------------------------------------------- - - namelist /cnfire_inparm/ fire_method - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnfire_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (fire_method, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnfire_inparm) - write(iulog,*) ' ' - end if - end subroutine CNFireReadNML - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - function create_cnfire_method( NLFilename ) result(cnfire_method) - ! - ! !DESCRIPTION: - ! Create and return an object of cnfire_method_type. The particular type - ! is determined based on a namelist parameter. - ! - ! !USES: - use shr_kind_mod , only : SHR_KIND_CL - use CNFireMethodMod , only : cnfire_method_type - use CNFireNoFireMod , only : cnfire_nofire_type - use CNFireLi2014Mod , only : cnfire_li2014_type - use CNFireLi2016Mod , only : cnfire_li2016_type - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - class(cnfire_method_type), allocatable :: cnfire_method ! function result - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'create_cnfire_method' - !----------------------------------------------------------------------- - - select case (trim(fire_method)) - - case ("nofire") - allocate(cnfire_method, source=cnfire_nofire_type()) - case ("li2014qianfrc") - allocate(cnfire_method, source=cnfire_li2014_type()) - case ("li2016crufrc") - allocate(cnfire_method, source=cnfire_li2016_type()) - - case default - write(iulog,*) subname//' ERROR: unknown method: ', fire_method - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end select - call cnfire_method%CNFireReadNML( NLFilename ) - - end function create_cnfire_method - -end module CNFireFactoryMod diff --git a/src/biogeochem/CNFireLi2014Mod.F90 b/src/biogeochem/CNFireLi2014Mod.F90 deleted file mode 100644 index 3e023a68a8..0000000000 --- a/src/biogeochem/CNFireLi2014Mod.F90 +++ /dev/null @@ -1,1268 +0,0 @@ -module CNFireLi2014Mod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! module for fire dynamics - ! created in Nov, 2012 and revised in Apr, 2013 by F. Li and S. Levis - ! based on Li et al. (2012a,b; 2013) - ! revised in Apr, 2014 according Li et al.(2014) - ! Fire-related parameters were calibrated or tuned in Apr, 2013 based on the - ! 20th Century transient simulations at f19_g16 with (newfire05_clm45sci15_clm4_0_58) - ! a CLM4.5 version, Qian et al. (2006) atmospheric forcing, and - ! climatological lightning data. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use shr_const_mod , only : SHR_CONST_PI,SHR_CONST_TKFRZ - use shr_infnan_mod , only : shr_infnan_isnan - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog, spinup_state - use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full - use clm_varcon , only : dzsoi_decomp - use pftconMod , only : noveg, pftcon - use abortutils , only : endrun - use decompMod , only : bounds_type - use subgridAveMod , only : p2c - use atm2lndType , only : atm2lnd_type - use CNDVType , only : dgvs_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use ColumnType , only : col - use PatchType , only : patch - use CNFireMethodMod , only : cnfire_method_type - use CNFireBaseMod , only : cnfire_base_type, cnfire_const - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: cnfire_li2014_type - ! - type, extends(cnfire_base_type) :: cnfire_li2014_type - private - contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireArea ! Calculate fire area - procedure, public :: CNFireFluxes - end type cnfire_li2014_type - - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface cnfire_li2014_type - ! initialize a new cnfire_base object - module procedure constructor - end interface cnfire_li2014_type - !----------------------------------------------------------------------- - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - type(cnfire_li2014_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type cnfire_base_type. - ! !ARGUMENTS: - constructor%need_lightning_and_popdens = .true. - end function constructor - - !----------------------------------------------------------------------- - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, soilhydrology_inst, waterstate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - use clm_time_manager , only: get_step_size, get_days_per_year, get_curr_date, get_nstep - use clm_varpar , only: max_patch_per_col - use clm_varcon , only: secspday, secsphr - use pftconMod , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree - use pftconMod , only: nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree, nbrdlf_evr_shrub - use dynSubgridControlMod , only: run_has_transient_landcover - ! - ! !ARGUMENTS: - class(cnfire_li2014_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(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_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:) - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,pi,j,fc,fp,kyr, kmo, kda, mcsec ! index variables - real(r8) :: dt ! time step variable (s) - real(r8) :: m ! top-layer soil moisture (proportion) - real(r8) :: dayspyr ! days per year - real(r8) :: cli ! effect of climate on deforestation fires (0-1) - real(r8) :: cri ! thresholds used for cli, (mm/d), see Eq.(7) in Li et al.(2013) - real(r8) :: fb ! availability of fuel for regs A and C - real(r8) :: fhd ! impact of hd on agricultural fire - real(r8) :: fgdp ! impact of gdp on agricultural fire - real(r8) :: fire_m ! combustability of fuel for fire occurrence - real(r8) :: spread_m ! combustability of fuel for fire spread - real(r8) :: Lb_lf ! length-to-breadth ratio added by Lifang - integer :: i_cwd ! cwd pool - real(r8) :: lh ! anthro. ignitions (count/km2/hr) - real(r8) :: fs ! hd-dependent fires suppression (0-1) - real(r8) :: ig ! total ignitions (count/km2/hr) - real(r8) :: hdmlf ! human density - real(r8) :: btran_col(bounds%begc:bounds%endc) - logical :: transient_landcover ! whether this run has any prescribed transient landcover - real(r8), target :: prec60_col_target(bounds%begc:bounds%endc) - real(r8), target :: prec10_col_target(bounds%begc:bounds%endc) - real(r8), pointer :: prec60_col(:) - real(r8), pointer :: prec10_col(:) - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(totlitc_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soi17cm_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - - associate( & - totlitc => totlitc_col , & ! Input: [real(r8) (:) ] (gC/m2) total lit C (column-level mean) - decomp_cpools_vr => decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) - tsoi17 => t_soi17cm_col , & ! Input: [real(r8) (:) ] (K) soil T for top 0.17 m - lfuel => cnfire_const%lfuel , & ! Input: [real(r8) ] (gC/m2) Lower threshold of fuel mass - ufuel => cnfire_const%ufuel , & ! Input: [real(r8) ] (gC/m2) Upper threshold of fuel mass - rh_hgh => cnfire_const%rh_hgh , & ! Input: [real(r8) ] (%) High relative humidity - rh_low => cnfire_const%rh_low , & ! Input: [real(r8) ] (%) Low relative humidity - bt_min => cnfire_const%bt_min , & ! Input: [real(r8) ] (0-1) Minimum btran - bt_max => cnfire_const%bt_max , & ! Input: [real(r8) ] (0-1) Maximum btran - cli_scale => cnfire_const%cli_scale , & ! Input: [real(r8) ] (/d) global constant for deforestation fires - cropfire_a1 => cnfire_const%cropfire_a1 , & ! Input: [real(r8) ] (/hr) a1 parameter for cropland fire - non_boreal_peatfire_c => cnfire_const%non_boreal_peatfire_c , & ! Input: [real(r8) ] (/hr) c parameter for non-boreal peatland fire - pot_hmn_ign_counts_alpha => cnfire_const%pot_hmn_ign_counts_alpha , & ! Input: [real(r8) ] (/person/month) Potential human ignition counts - boreal_peatfire_c => cnfire_const%boreal_peatfire_c , & ! Input: [real(r8) ] (/hr) c parameter for boreal peatland fire - - fsr_pft => pftcon%fsr_pft , & ! Input: - fd_pft => pftcon%fd_pft , & ! Input: - - btran2 => energyflux_inst%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness - fsat => soilhydrology_inst%fsat_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface - wf => waterstate_inst%wf_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m - wf2 => waterstate_inst%wf2_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m - - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - - forc_rh => atm2lnd_inst%forc_rh_grc , & ! Input: [real(r8) (:) ] relative humidity - forc_wind => atm2lnd_inst%forc_wind_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric temperature (Kelvin) - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] downscaled rain - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] downscaled snow - prec60 => atm2lnd_inst%prec60_patch , & ! Input: [real(r8) (:) ] 60-day running mean of tot. precipitation - prec10 => atm2lnd_inst%prec10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation - - dwt_smoothed => cnveg_state_inst%dwt_smoothed_patch , & ! Input: [real(r8) (:) ] change in patch weight (-1 to 1) on the gridcell, smoothed over the year - cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column - gdp_lf => cnveg_state_inst%gdp_lf_col , & ! Input: [real(r8) (:) ] gdp data - peatf_lf => cnveg_state_inst%peatf_lf_col , & ! Input: [real(r8) (:) ] peatland fraction data - abm_lf => cnveg_state_inst%abm_lf_col , & ! Input: [integer (:) ] prescribed crop fire time - baf_crop => cnveg_state_inst%baf_crop_col , & ! Output: [real(r8) (:) ] burned area fraction for cropland (/sec) - baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Output: [real(r8) (:) ] burned area fraction for peatland (/sec) - burndate => cnveg_state_inst%burndate_patch , & ! Output: [integer (:) ] burn date for crop - fbac => cnveg_state_inst%fbac_col , & ! Output: [real(r8) (:) ] total burned area out of conversion (/sec) - fbac1 => cnveg_state_inst%fbac1_col , & ! Output: [real(r8) (:) ] burned area out of conversion region due to land use fire - farea_burned => cnveg_state_inst%farea_burned_col , & ! Output: [real(r8) (:) ] total fractional area burned (/sec) - nfire => cnveg_state_inst%nfire_col , & ! Output: [real(r8) (:) ] fire counts (count/km2/sec), valid only in Reg. C - fsr_col => cnveg_state_inst%fsr_col , & ! Output: [real(r8) (:) ] fire spread rate at column level - fd_col => cnveg_state_inst%fd_col , & ! Output: [real(r8) (:) ] fire duration rate at column level - lgdp_col => cnveg_state_inst%lgdp_col , & ! Output: [real(r8) (:) ] gdp limitation factor for nfire - lgdp1_col => cnveg_state_inst%lgdp1_col , & ! Output: [real(r8) (:) ] gdp limitation factor for baf per fire - lpop_col => cnveg_state_inst%lpop_col , & ! Output: [real(r8) (:) ] pop limitation factor for baf per fire - lfwt => cnveg_state_inst%lfwt_col , & ! Output: [real(r8) (:) ] fractional coverage of non-crop and non-bare-soil Patches - trotr1_col => cnveg_state_inst%trotr1_col , & ! Output: [real(r8) (:) ] patch weight of BET on the column (0-1) - trotr2_col => cnveg_state_inst%trotr2_col , & ! Output: [real(r8) (:) ] patch weight of BDT on the column (0-1) - dtrotr_col => cnveg_state_inst%dtrotr_col , & ! Output: [real(r8) (:) ] decreased frac. coverage of BET+BDT on grid for dt - lfc => cnveg_state_inst%lfc_col , & ! Output: [real(r8) (:) ] conversion area frac. of BET+BDT that haven't burned before - wtlf => cnveg_state_inst%wtlf_col , & ! Output: [real(r8) (:) ] fractional coverage of non-crop Patches - - totvegc => cnveg_carbonstate_inst%totvegc_col , & ! Input: [real(r8) (:) ] totvegc at column level - deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - rootc_col => cnveg_carbonstate_inst%rootc_col , & ! Output: [real(r8) (:) ] root carbon - leafc_col => cnveg_carbonstate_inst%leafc_col , & ! Output: [real(r8) (:) ] leaf carbon at column level - fuelc => cnveg_carbonstate_inst%fuelc_col , & ! Output: [real(r8) (:) ] fuel avalability factor for Reg.C - fuelc_crop => cnveg_carbonstate_inst%fuelc_crop_col & ! Output: [real(r8) (:) ] fuel avalability factor for Reg.A - ) - - transient_landcover = run_has_transient_landcover() - - !pft to column average - prec10_col =>prec10_col_target - call p2c(bounds, num_soilc, filter_soilc, & - prec10(bounds%begp:bounds%endp), & - prec10_col(bounds%begc:bounds%endc)) - - prec60_col =>prec60_col_target - call p2c(bounds, num_soilc, filter_soilc, & - prec60(bounds%begp:bounds%endp), & - prec60_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - leafc(bounds%begp:bounds%endp), & - leafc_col(bounds%begc:bounds%endc)) - - call get_curr_date (kyr, kmo, kda, mcsec) - dayspyr = get_days_per_year() - ! Get model step size - dt = real( get_step_size(), r8 ) - ! - ! On first time-step, just set area burned to zero and exit - ! - if ( get_nstep() == 0 )then - do fc = 1,num_soilc - c = filter_soilc(fc) - farea_burned(c) = 0._r8 - baf_crop(c) = 0._r8 - baf_peatf(c) = 0._r8 - fbac(c) = 0._r8 - fbac1(c) = 0._r8 - cropf_col(c) = 0._r8 - end do - return - end if - ! - ! Calculate fraction of crop (cropf_col) and non-crop and non-bare-soil - ! vegetation (lfwt) in vegetated column - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - cropf_col(c) = 0._r8 - lfwt(c) = 0._r8 - end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop veg types - if( patch%itype(p) > nc4_grass )then - cropf_col(c) = cropf_col(c) + patch%wtcol(p) - end if - ! For natural vegetation (non-crop and non-bare-soil) - if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then - lfwt(c) = lfwt(c) + patch%wtcol(p) - end if - end if - end do - end do - ! - ! Calculate crop fuel - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - fuelc_crop(c)=0._r8 - end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop PFTs, fuel load includes leaf and litter; only - ! column-level litter carbon - ! is available, so we use leaf carbon to estimate the - ! litter carbon for crop PFTs - if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then - fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & - leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & - totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) - end if - end if - end do - end do - ! - ! Calculate noncrop column variables - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - fsr_col(c) = 0._r8 - fd_col(c) = 0._r8 - rootc_col(c) = 0._r8 - lgdp_col(c) = 0._r8 - lgdp1_col(c) = 0._r8 - lpop_col(c) = 0._r8 - btran_col(c) = 0._r8 - wtlf(c) = 0._r8 - trotr1_col(c)= 0._r8 - trotr2_col(c)= 0._r8 - if (transient_landcover) then - dtrotr_col(c)=0._r8 - end if - end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - ! For non-crop -- natural vegetation and bare-soil - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - if( .not. shr_infnan_isnan(btran2(p))) then - if (btran2(p) <= 1._r8 ) then - btran_col(c) = btran_col(c)+btran2(p)*patch%wtcol(p) - wtlf(c) = wtlf(c)+patch%wtcol(p) - end if - end if - - ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen - ! and deciduous tropical trees (used to determine if a column is - ! tropical closed forest) use the current fractions. However, I think - ! they are used in code that applies to land cover change. Note that - ! land cover change is currently generated on the first time step of the - ! year (even though the fire code sees the annually-smoothed dwt). Thus, - ! I think that, for this to be totally consistent, this code should - ! consider the fractional coverage of each PFT prior to the relevant - ! land cover change event. (These fractions could be computed in the - ! code that handles land cover change, so that the fire code remains - ! agnostic to exactly how and when land cover change happens.) - ! - ! For example, if a year started with fractional coverages of - ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then - ! the start-of-year land cover change reduced both of these to 0.2: The - ! current code would consider the column to NOT be tropical closed - ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), - ! whereas in fact the land cover change occurred when the column *was* - ! tropical closed forest. - if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) - end if - if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) - end if - - if (transient_landcover) then - if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then - if(dwt_smoothed(p) < 0._r8)then - ! Land cover change in CLM happens all at once on the first time - ! step of the year. However, the fire code needs deforestation - ! rates throughout the year, in order to combine these - ! deforestation rates with the current season's climate. So we - ! use a smoothed version of dwt. - ! - ! This isn't ideal, because the carbon stocks that the fire code - ! is operating on will have decreased by the full annual amount - ! before the fire code does anything. But the biggest effect of - ! these deforestation fires is as a trigger for other fires, and - ! the C fluxes are merely diagnostic so don't need to be - ! conservative, so this isn't a big issue. - ! - ! (Actually, it would be even better if the fire code had a - ! realistic breakdown of annual deforestation into the - ! different seasons. But having deforestation spread evenly - ! throughout the year is much better than having it all - ! concentrated on January 1.) - dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) - end if - end if - end if - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - - fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) - - if( lfwt(c) /= 0.0_r8 )then - hdmlf=this%forc_hdm(g) - - ! all these constants are in Li et al. BG (2012a,b;2013) - - if( hdmlf > 0.1_r8 )then - ! For NOT bare-soil - if( patch%itype(p) /= noveg )then - ! For shrub and grass (crop already excluded above) - if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass - lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & - /(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/7._r8)))*patch%wtcol(p)/lfwt(c) - lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/lfwt(c) - else ! for trees - if( gdp_lf(c) > 20._r8 )then - lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - end if - if( gdp_lf(c) > 20._r8 )then - lgdp1_col(c) = lgdp1_col(c)+0.62_r8*patch%wtcol(p)/lfwt(c) - else - if( gdp_lf(c) > 8._r8 ) then - lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/lfwt(c) - else - lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/lfwt(c) - end if - end if - lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/125._r8)))*patch%wtcol(p)/lfwt(c) - end if - end if - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/lfwt(c) - lpop_col(c) = lpop_col(c)+patch%wtcol(p)/lfwt(c) - end if - end if - - fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) - end if - end if - end do - end do - - ! estimate annual decreased fractional coverage of BET+BDT - ! land cover conversion in CLM4.5 is the same for each timestep except for the beginning - - if (transient_landcover) then - do fc = 1,num_soilc - c = filter_soilc(fc) - if( dtrotr_col(c) > 0._r8 )then - if( kmo == 1 .and. kda == 1 .and. mcsec == 0)then - lfc(c) = 0._r8 - end if - if( kmo == 1 .and. kda == 1 .and. mcsec == dt)then - lfc(c) = dtrotr_col(c)*dayspyr*secspday/dt - end if - else - lfc(c)=0._r8 - end if - end do - end if - ! - ! calculate burned area fraction in cropland - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - baf_crop(c)=0._r8 - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - if( kmo == 1 .and. kda == 1 .and. mcsec == 0 )then - burndate(p) = 10000 ! init. value; actual range [0 365] - end if - end do - - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - hdmlf=this%forc_hdm(g) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop - if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & - kmo == abm_lf(c) .and. forc_rain(c)+forc_snow(c) == 0._r8 .and. & - burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time - - ! calculate human density impact on ag. fire - fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) - - ! calculate impact of GDP on ag. fire - fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) - - ! calculate burned area - fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) - - ! crop fire only for generic crop types at this time - ! managed crops are treated as grasses if crop model is turned on - baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fb*fhd*fgdp*patch%wtcol(p) - if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then - burndate(p)=kda - end if - end if - end if - end do - end do - ! - ! calculate peatland fire - ! - do fc = 1, num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - if(grc%latdeg(g) < cnfire_const%borealat )then - baf_peatf(c) = non_boreal_peatfire_c/secsphr*max(0._r8, & - min(1._r8,(4.0_r8-prec60_col(c)*secspday)/ & - 4.0_r8))**2*peatf_lf(c)*(1._r8-fsat(c)) - else - baf_peatf(c) = boreal_peatfire_c/secsphr*exp(-SHR_CONST_PI*(max(wf2(c),0._r8)/0.3_r8))* & - max(0._r8,min(1._r8,(tsoi17(c)-SHR_CONST_TKFRZ)/10._r8))*peatf_lf(c)* & - (1._r8-fsat(c)) - end if - end do - ! - ! calculate other fires - ! - - ! Set the number of timesteps for e-folding. - ! When the simulation has run fewer than this number of steps, - ! re-scale the e-folding time to get a stable early estimate. - - ! find which pool is the cwd pool - i_cwd = 0 - do l = 1, ndecomp_pools - if ( is_cwd(l) ) then - i_cwd = l - endif - end do - - ! - ! begin column loop to calculate fractional area affected by fire - ! - do fc = 1, num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - hdmlf=this%forc_hdm(g) - if( cropf_col(c) < 1.0 )then - if (trotr1_col(c)+trotr2_col(c)>0.6_r8) then - farea_burned(c)=min(1.0_r8,baf_crop(c)+baf_peatf(c)) - else - fuelc(c) = totlitc(c)+totvegc(c)-rootc_col(c)-fuelc_crop(c)*cropf_col(c) - do j = 1, nlevdecomp - fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) - end do - fuelc(c) = fuelc(c)/(1._r8-cropf_col(c)) - fb = max(0.0_r8,min(1.0_r8,(fuelc(c)-lfuel)/(ufuel-lfuel))) - m = max(0._r8,wf(c)) - fire_m = exp(-SHR_CONST_PI *(m/0.69_r8)**2)*(1.0_r8 - max(0._r8, & - min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low))))* & - min(1._r8,exp(SHR_CONST_PI*(forc_t(c)-SHR_CONST_TKFRZ)/10._r8)) - lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8 - fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf)) - ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(3._r8*grc%lat(g)))*0.25_r8)*(1._r8-fs)*(1._r8-cropf_col(c)) - nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec - Lb_lf = 1._r8+10.0_r8*(1._r8-EXP(-0.06_r8*forc_wind(g))) - if ( wtlf(c) > 0.0_r8 )then - spread_m = (1.0_r8 - max(0._r8,min(1._r8,(btran_col(c)/wtlf(c)-bt_min)/ & - (bt_max-bt_min))))*(1.0_r8-max(0._r8, & - min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low)))) - else - spread_m = 0.0_r8 - end if - farea_burned(c) = min(1._r8,(cnfire_const%g0*spread_m*fsr_col(c)* & - fd_col(c)/1000._r8)**2*lgdp1_col(c)* & - lpop_col(c)*nfire(c)*SHR_CONST_PI*Lb_lf+ & - baf_crop(c)+baf_peatf(c)) ! fraction (0-1) per sec - end if - ! - ! if landuse change data is used, calculate deforestation fires and - ! add it in the total of burned area fraction - ! - if (transient_landcover) then - if( trotr1_col(c)+trotr2_col(c) > 0.6_r8 )then - if(( kmo == 1 .and. kda == 1 .and. mcsec == 0) .or. & - dtrotr_col(c) <=0._r8 )then - fbac1(c) = 0._r8 - farea_burned(c) = baf_crop(c)+baf_peatf(c) - else - cri = (4.0_r8*trotr1_col(c)+1.8_r8*trotr2_col(c))/(trotr1_col(c)+trotr2_col(c)) - cli = (max(0._r8,min(1._r8,(cri-prec60_col(c)*secspday)/cri))**0.5)* & - (max(0._r8,min(1._r8,(cri-prec10_col(c)*secspday)/cri))**0.5)* & - max(0.0005_r8,min(1._r8,19._r8*dtrotr_col(c)*dayspyr*secspday/dt-0.001_r8))* & - max(0._r8,min(1._r8,(0.25_r8-(forc_rain(c)+forc_snow(c))*secsphr)/0.25_r8)) - farea_burned(c) = cli*(cli_scale/secspday)+baf_crop(c)+baf_peatf(c) - ! burned area out of conversion region due to land use fire - fbac1(c) = max(0._r8,cli*(cli_scale/secspday) - 2.0_r8*lfc(c)/dt) - end if - ! total burned area out of conversion - fbac(c) = fbac1(c)+baf_crop(c)+baf_peatf(c) - else - fbac(c) = farea_burned(c) - end if - end if - - else - farea_burned(c) = min(1._r8,baf_crop(c)+baf_peatf(c)) - end if - - end do ! end of column loop - - end associate - - end subroutine CNFireArea - - !----------------------------------------------------------------------- - subroutine CNFireFluxes (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - dgvs_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch, & - totsomc_col, decomp_cpools_vr_col, decomp_npools_vr_col, somc_fire_col) - ! - ! !DESCRIPTION: - ! Fire effects routine for coupled carbon-nitrogen code (CN). - ! Relies primarily on estimate of fractional area burned, from CNFireArea(). - ! - ! Total fire carbon emissions (g C/m2 land area/yr) - ! =avg(COL_FIRE_CLOSS)*seconds_per_year + avg(SOMC_FIRE)*seconds_per_year + - ! avg(LF_CONV_CFLUX)*seconds_per_year*min(1.0,avg(LFC2)*seconds_per_year)*0.8 - ! where avg means the temporal average in a year - ! seconds_per_year is the number of seconds in a year. - ! - ! !USES: - use clm_time_manager , only: get_step_size,get_days_per_year,get_curr_date - use clm_varpar , only: max_patch_per_col - use clm_varctl , only: use_cndv - use clm_varcon , only: secspday - use pftconMod , only: nc3crop - use dynSubgridControlMod , only: run_has_transient_landcover - ! - ! !ARGUMENTS: - class(cnfire_li2014_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(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: totsomc_col(bounds%begc:) ! (gC/m2) total soil organic matter C - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) ! (gC/m3) VR decomp. (litter, cwd, soil) - real(r8) , intent(in) :: decomp_npools_vr_col(bounds%begc:,1:,1:) ! (gC/m3) VR decomp. (litter, cwd, soil) - real(r8) , intent(out) :: somc_fire_col(bounds%begc:) ! (gC/m2/s) fire C emissions due to peat burning - ! - ! !LOCAL VARIABLES: - integer :: g,c,p,j,l,pi,kyr, kmo, kda, mcsec ! indices - integer :: fp,fc ! filter indices - real(r8):: f ! rate for fire effects (1/s) - real(r8):: m ! acceleration factor for fuel carbon - real(r8):: dt ! time step variable (s) - real(r8):: dayspyr ! days per year - logical :: transient_landcover ! whether this run has any prescribed transient landcover - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(croot_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(stem_prof_patch) == (/bounds%endp,nlevdecomp_full/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(totsomc_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_npools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(somc_fire_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - - ! NOTE: VR = Vertically Resolved - ! conv. = conversion - ! frac. = fraction - ! BAF = Burned Area Fraction - ! ann. = annual - ! GC = gridcell - ! dt = timestep - ! C = Carbon - ! N = Nitrogen - ! emis. = emissions - ! decomp. = decomposing - - associate( & - croot_prof => croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - totsomc => totsomc_col , & ! Input: [real(r8) (:) ] (gC/m2) total soil organic matter C - decomp_cpools_vr => decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) - decomp_npools_vr => decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) - somc_fire => somc_fire_col , & ! Output: [real(r8) (:) ] (gC/m2/s) fire C emissions due to peat burning - - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - is_litter => decomp_cascade_con%is_litter , & ! Input: [logical (:) ] TRUE => pool is a litter pool - - woody => pftcon%woody , & ! Input: woody lifeform (1=woody, 0=not woody) - cc_leaf => pftcon%cc_leaf , & ! Input: - cc_lstem => pftcon%cc_lstem , & ! Input: - cc_dstem => pftcon%cc_dstem , & ! Input: - cc_other => pftcon%cc_other , & ! Input: - fm_leaf => pftcon%fm_leaf , & ! Input: - fm_lstem => pftcon%fm_lstem , & ! Input: - fm_other => pftcon%fm_other , & ! Input: - fm_root => pftcon%fm_root , & ! Input: - fm_lroot => pftcon%fm_lroot , & ! Input: - fm_droot => pftcon%fm_droot , & ! Input: - lf_flab => pftcon%lf_flab , & ! Input: - lf_fcel => pftcon%lf_fcel , & ! Input: - lf_flig => pftcon%lf_flig , & ! Input: - fr_flab => pftcon%fr_flab , & ! Input: - fr_fcel => pftcon%fr_fcel , & ! Input: - fr_flig => pftcon%fr_flig , & ! Input: - - nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m2) - - cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column - farea_burned => cnveg_state_inst%farea_burned_col , & ! Input: [real(r8) (:) ] fractional area burned (/sec) - fbac1 => cnveg_state_inst%fbac1_col , & ! Input: [real(r8) (:) ] burned area out of conv. region due to LU fire - fbac => cnveg_state_inst%fbac_col , & ! Input: [real(r8) (:) ] total burned area out of conversion (/sec) - baf_crop => cnveg_state_inst%baf_crop_col , & ! Input: [real(r8) (:) ] BAF for cropland - baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Input: [real(r8) (:) ] BAF for peatlabd - trotr1_col => cnveg_state_inst%trotr1_col , & ! Input: [real(r8) (:) ] patch weight of BET on the column (0-1) - trotr2_col => cnveg_state_inst%trotr2_col , & ! Input: [real(r8) (:) ] patch weight of BDT on the column (0-1) - dtrotr_col => cnveg_state_inst%dtrotr_col , & ! Input: [real(r8) (:) ] ann. decreased frac. coverage of BET+BDT (0-1) on GC - lfc => cnveg_state_inst%lfc_col , & ! Input: [real(r8) (:) ] conv. area frac. of BET+BDT that haven't burned before - lfc2 => cnveg_state_inst%lfc2_col , & ! Output: [real(r8) (:) ] conv. area frac. of BET+BDT burned this dt (/sec) - - leafcmax => cnveg_carbonstate_inst%leafcmax_patch , & ! Output: [real(r8) (:) ] (gC/m2) ann max leaf C - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - gresp_xfer => cnveg_carbonstate_inst%gresp_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration transfer - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn => cnveg_nitrogenstate_inst%deadstemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn => cnveg_nitrogenstate_inst%deadcrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - - fire_mortality_c_to_cwdc => cnveg_carbonflux_inst%fire_mortality_c_to_cwdc_col , & ! Input: [real(r8) (:,:) ] C flux fire mortality to CWD (gC/m3/s) - m_leafc_to_fire => cnveg_carbonflux_inst%m_leafc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc - m_leafc_storage_to_fire => cnveg_carbonflux_inst%m_leafc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_storage - m_leafc_xfer_to_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from leafc_xfer - m_livestemc_to_fire => cnveg_carbonflux_inst%m_livestemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) fire C emis. from livestemc - m_livestemc_storage_to_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_storage - m_livestemc_xfer_to_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livestemc_xfer - m_deadstemc_to_fire => cnveg_carbonflux_inst%m_deadstemc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer - m_deadstemc_storage_to_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_storage - m_deadstemc_xfer_to_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadstemc_xfer - m_frootc_to_fire => cnveg_carbonflux_inst%m_frootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc - m_frootc_storage_to_fire => cnveg_carbonflux_inst%m_frootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_storage - m_frootc_xfer_to_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. frootc_xfer - m_livecrootc_to_fire => cnveg_carbonflux_inst%m_livecrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc - m_livecrootc_storage_to_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_storage - m_livecrootc_xfer_to_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. livecrootc_xfer - m_deadcrootc_to_fire => cnveg_carbonflux_inst%m_deadcrootc_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc - m_deadcrootc_storage_to_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_storage - m_deadcrootc_xfer_to_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. deadcrootc_xfer - m_gresp_storage_to_fire => cnveg_carbonflux_inst%m_gresp_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_storage - m_gresp_xfer_to_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) C emis. gresp_xfer - m_leafc_to_litter_fire => cnveg_carbonflux_inst%m_leafc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafc_storage_to_litter_fire => cnveg_carbonflux_inst%m_leafc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_leafc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemc_to_deadstemc_fire => cnveg_carbonflux_inst%m_livestemc_to_deadstemc_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_to_litter_fire => cnveg_carbonflux_inst%m_frootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_frootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_frootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootc_to_deadcrootc_fire => cnveg_carbonflux_inst%m_livecrootc_to_deadcrootc_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_storage_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootc_xfer_to_litter_fire => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_gresp_storage_to_litter_fire => cnveg_carbonflux_inst%m_gresp_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_gresp_xfer_to_litter_fire => cnveg_carbonflux_inst%m_gresp_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_decomp_cpools_to_fire_vr => cnveg_carbonflux_inst%m_decomp_cpools_to_fire_vr_col , & ! Output: [real(r8) (:,:,:) ] (gC/m3/s) VR decomp. C fire loss - m_c_to_litr_met_fire => cnveg_carbonflux_inst%m_c_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] - m_c_to_litr_cel_fire => cnveg_carbonflux_inst%m_c_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] - m_c_to_litr_lig_fire => cnveg_carbonflux_inst%m_c_to_litr_lig_fire_col , & ! Output: [real(r8) (:,:) ] - - fire_mortality_n_to_cwdn => cnveg_nitrogenflux_inst%fire_mortality_n_to_cwdn_col , & ! Input: [real(r8) (:,:) ] N flux fire mortality to CWD (gN/m3/s) - m_leafn_to_fire => cnveg_nitrogenflux_inst%m_leafn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn - m_leafn_storage_to_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_storage - m_leafn_xfer_to_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. leafn_xfer - m_livestemn_to_fire => cnveg_nitrogenflux_inst%m_livestemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn - m_livestemn_storage_to_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_s - m_livestemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livestemn_xfer - m_deadstemn_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn - m_deadstemn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_storage - m_deadstemn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadstemn_xfer - m_frootn_to_fire => cnveg_nitrogenflux_inst%m_frootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn - m_frootn_storage_to_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_storage - m_frootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. frootn_xfer - m_livecrootn_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. m_livecrootn_to_fire - m_livecrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_storage - m_livecrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. livecrootn_xfer - m_deadcrootn_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn - m_deadcrootn_storage_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_storage - m_deadcrootn_xfer_to_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. deadcrootn_xfer - m_retransn_to_fire => cnveg_nitrogenflux_inst%m_retransn_to_fire_patch , & ! Input: [real(r8) (:) ] (gN/m2/s) N emis. retransn - m_leafn_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_leafn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livestemn_to_deadstemn_fire => cnveg_nitrogenflux_inst%m_livestemn_to_deadstemn_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadstemn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_frootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_livecrootn_to_deadcrootn_fire => cnveg_nitrogenflux_inst%m_livecrootn_to_deadcrootn_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_storage_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_deadcrootn_xfer_to_litter_fire => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_retransn_to_litter_fire => cnveg_nitrogenflux_inst%m_retransn_to_litter_fire_patch , & ! Output: [real(r8) (:) ] - m_decomp_npools_to_fire_vr => cnveg_nitrogenflux_inst%m_decomp_npools_to_fire_vr_col , & ! Output: [real(r8) (:,:,:) ] VR decomp. N fire loss (gN/m3/s) - m_n_to_litr_met_fire => cnveg_nitrogenflux_inst%m_n_to_litr_met_fire_col , & ! Output: [real(r8) (:,:) ] - m_n_to_litr_cel_fire => cnveg_nitrogenflux_inst%m_n_to_litr_cel_fire_col , & ! Output: [real(r8) (:,:) ] - m_n_to_litr_lig_fire => cnveg_nitrogenflux_inst%m_n_to_litr_lig_fire_col & ! Output: [real(r8) (:,:) ] - ) - - transient_landcover = run_has_transient_landcover() - - ! Get model step size - ! calculate burned area fraction per sec - dt = real( get_step_size(), r8 ) - - dayspyr = get_days_per_year() - ! - ! patch loop - ! - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8)then - ! For non-crop (bare-soil and natural vegetation) - if (transient_landcover) then - f = (fbac(c)-baf_crop(c))/(1.0_r8-cropf_col(c)) - else - f = (farea_burned(c)-baf_crop(c))/(1.0_r8-cropf_col(c)) - end if - else - ! For crops - if(cropf_col(c) > 0._r8)then - f = baf_crop(c) /cropf_col(c) - else - f = 0._r8 - end if - end if - - ! apply this rate to the patch state variables to get flux rates - ! biomass burning - ! carbon fluxes - m = 1._r8 - if (spinup_state == 2) then - m = 10._r8 - end if - - m_leafc_to_fire(p) = leafc(p) * f * cc_leaf(patch%itype(p)) - m_leafc_storage_to_fire(p) = leafc_storage(p) * f * cc_other(patch%itype(p)) - m_leafc_xfer_to_fire(p) = leafc_xfer(p) * f * cc_other(patch%itype(p)) - m_livestemc_to_fire(p) = livestemc(p) * f * cc_lstem(patch%itype(p)) - m_livestemc_storage_to_fire(p) = livestemc_storage(p) * f * cc_other(patch%itype(p)) - m_livestemc_xfer_to_fire(p) = livestemc_xfer(p) * f * cc_other(patch%itype(p)) - m_deadstemc_to_fire(p) = deadstemc(p) * f * cc_dstem(patch%itype(p)) * m - m_deadstemc_storage_to_fire(p) = deadstemc_storage(p) * f * cc_other(patch%itype(p)) - m_deadstemc_xfer_to_fire(p) = deadstemc_xfer(p) * f * cc_other(patch%itype(p)) - m_frootc_to_fire(p) = frootc(p) * f * 0._r8 - m_frootc_storage_to_fire(p) = frootc_storage(p) * f * cc_other(patch%itype(p)) - m_frootc_xfer_to_fire(p) = frootc_xfer(p) * f * cc_other(patch%itype(p)) - m_livecrootc_to_fire(p) = livecrootc(p) * f * 0._r8 - m_livecrootc_storage_to_fire(p) = livecrootc_storage(p) * f * cc_other(patch%itype(p)) - m_livecrootc_xfer_to_fire(p) = livecrootc_xfer(p) * f * cc_other(patch%itype(p)) - m_deadcrootc_to_fire(p) = deadcrootc(p) * f * 0._r8 - m_deadcrootc_storage_to_fire(p) = deadcrootc_storage(p) * f* cc_other(patch%itype(p)) - m_deadcrootc_xfer_to_fire(p) = deadcrootc_xfer(p) * f * cc_other(patch%itype(p)) - m_gresp_storage_to_fire(p) = gresp_storage(p) * f * cc_other(patch%itype(p)) - m_gresp_xfer_to_fire(p) = gresp_xfer(p) * f * cc_other(patch%itype(p)) - - - ! nitrogen fluxes - m_leafn_to_fire(p) = leafn(p) * f * cc_leaf(patch%itype(p)) - m_leafn_storage_to_fire(p) = leafn_storage(p) * f * cc_other(patch%itype(p)) - m_leafn_xfer_to_fire(p) = leafn_xfer(p) * f * cc_other(patch%itype(p)) - m_livestemn_to_fire(p) = livestemn(p) * f * cc_lstem(patch%itype(p)) - m_livestemn_storage_to_fire(p) = livestemn_storage(p) * f * cc_other(patch%itype(p)) - m_livestemn_xfer_to_fire(p) = livestemn_xfer(p) * f * cc_other(patch%itype(p)) - m_deadstemn_to_fire(p) = deadstemn(p) * f * cc_dstem(patch%itype(p)) * m - m_deadstemn_storage_to_fire(p) = deadstemn_storage(p) * f * cc_other(patch%itype(p)) - m_deadstemn_xfer_to_fire(p) = deadstemn_xfer(p) * f * cc_other(patch%itype(p)) - m_frootn_to_fire(p) = frootn(p) * f * 0._r8 - m_frootn_storage_to_fire(p) = frootn_storage(p) * f * cc_other(patch%itype(p)) - m_frootn_xfer_to_fire(p) = frootn_xfer(p) * f * cc_other(patch%itype(p)) - m_livecrootn_to_fire(p) = livecrootn(p) * f * 0._r8 - m_livecrootn_storage_to_fire(p) = livecrootn_storage(p) * f * cc_other(patch%itype(p)) - m_livecrootn_xfer_to_fire(p) = livecrootn_xfer(p) * f * cc_other(patch%itype(p)) - m_deadcrootn_to_fire(p) = deadcrootn(p) * f * 0._r8 - m_deadcrootn_xfer_to_fire(p) = deadcrootn_xfer(p) * f * cc_other(patch%itype(p)) - m_deadcrootn_storage_to_fire(p) = deadcrootn_storage(p) * f * cc_other(patch%itype(p)) - m_retransn_to_fire(p) = retransn(p) * f * cc_other(patch%itype(p)) - - ! mortality due to fire - ! carbon pools - m_leafc_to_litter_fire(p) = leafc(p) * f * & - (1._r8 - cc_leaf(patch%itype(p))) * & - fm_leaf(patch%itype(p)) - m_leafc_storage_to_litter_fire(p) = leafc_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_leafc_xfer_to_litter_fire(p) = leafc_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemc_to_litter_fire(p) = livestemc(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_livestemc_storage_to_litter_fire(p) = livestemc_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemc_xfer_to_litter_fire(p) = livestemc_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemc_to_deadstemc_fire(p) = livestemc(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - (fm_lstem(patch%itype(p))-fm_droot(patch%itype(p))) - m_deadstemc_to_litter_fire(p) = deadstemc(p) * f * m * & - (1._r8 - cc_dstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_deadstemc_storage_to_litter_fire(p) = deadstemc_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadstemc_xfer_to_litter_fire(p) = deadstemc_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootc_to_litter_fire(p) = frootc(p) * f * & - fm_root(patch%itype(p)) - m_frootc_storage_to_litter_fire(p) = frootc_storage(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootc_xfer_to_litter_fire(p) = frootc_xfer(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootc_to_litter_fire(p) = livecrootc(p) * f * & - fm_droot(patch%itype(p)) - m_livecrootc_storage_to_litter_fire(p) = livecrootc_storage(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootc_xfer_to_litter_fire(p) = livecrootc_xfer(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootc_to_deadcrootc_fire(p) = livecrootc(p) * f * & - (fm_lroot(patch%itype(p))-fm_droot(patch%itype(p))) - m_deadcrootc_to_litter_fire(p) = deadcrootc(p) * f * m * & - fm_droot(patch%itype(p)) - m_deadcrootc_storage_to_litter_fire(p) = deadcrootc_storage(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadcrootc_xfer_to_litter_fire(p) = deadcrootc_xfer(p) * f * & - (1._r8- cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_gresp_storage_to_litter_fire(p) = gresp_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_gresp_xfer_to_litter_fire(p) = gresp_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - - - ! nitrogen pools - m_leafn_to_litter_fire(p) = leafn(p) * f * & - (1._r8 - cc_leaf(patch%itype(p))) * & - fm_leaf(patch%itype(p)) - m_leafn_storage_to_litter_fire(p) = leafn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_leafn_xfer_to_litter_fire(p) = leafn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemn_to_litter_fire(p) = livestemn(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_livestemn_storage_to_litter_fire(p) = livestemn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemn_xfer_to_litter_fire(p) = livestemn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livestemn_to_deadstemn_fire(p) = livestemn(p) * f * & - (1._r8 - cc_lstem(patch%itype(p))) * & - (fm_lstem(patch%itype(p))-fm_droot(patch%itype(p))) - m_deadstemn_to_litter_fire(p) = deadstemn(p) * f * m * & - (1._r8 - cc_dstem(patch%itype(p))) * & - fm_droot(patch%itype(p)) - m_deadstemn_storage_to_litter_fire(p) = deadstemn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadstemn_xfer_to_litter_fire(p) = deadstemn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootn_to_litter_fire(p) = frootn(p) * f * & - fm_root(patch%itype(p)) - m_frootn_storage_to_litter_fire(p) = frootn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_frootn_xfer_to_litter_fire(p) = frootn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootn_to_litter_fire(p) = livecrootn(p) * f * & - fm_droot(patch%itype(p)) - m_livecrootn_storage_to_litter_fire(p) = livecrootn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootn_xfer_to_litter_fire(p) = livecrootn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_livecrootn_to_deadcrootn_fire(p) = livecrootn(p) * f * & - (fm_lroot(patch%itype(p))-fm_droot(patch%itype(p))) - m_deadcrootn_to_litter_fire(p) = deadcrootn(p) * f * m * & - fm_droot(patch%itype(p)) - m_deadcrootn_storage_to_litter_fire(p) = deadcrootn_storage(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_deadcrootn_xfer_to_litter_fire(p) = deadcrootn_xfer(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - m_retransn_to_litter_fire(p) = retransn(p) * f * & - (1._r8 - cc_other(patch%itype(p))) * & - fm_other(patch%itype(p)) - - if (use_cndv) then - if ( woody(patch%itype(p)) == 1._r8 )then - if ( livestemc(p)+deadstemc(p) > 0._r8 )then - nind(p) = nind(p)*(1._r8-1._r8*fm_droot(patch%itype(p))*f) - else - nind(p) = 0._r8 - end if - end if - leafcmax(p) = max(leafc(p)-m_leafc_to_fire(p)*dt, leafcmax(p)) - if (patch%itype(p) == noveg) leafcmax(p) = 0._r8 - end if - - end do ! end of patches loop - - ! fire-induced transfer of carbon and nitrogen pools to litter and cwd - - do j = 1,nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if ( patch%active(p) ) then - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadstemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_deadcrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadstemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_deadcrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livestemc_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_c_to_cwdc(c,j) = fire_mortality_c_to_cwdc(c,j) + & - m_livecrootc_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livestemn_to_litter_fire(p) * patch%wtcol(p) * stem_prof(p,j) - fire_mortality_n_to_cwdn(c,j) = fire_mortality_n_to_cwdn(c,j) + & - m_livecrootn_to_litter_fire(p) * patch%wtcol(p) * croot_prof(p,j) - - - m_c_to_litr_met_fire(c,j)=m_c_to_litr_met_fire(c,j) + & - ((m_leafc_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafc_storage_to_litter_fire(p) + & - m_leafc_xfer_to_litter_fire(p) + & - m_gresp_storage_to_litter_fire(p) & - +m_gresp_xfer_to_litter_fire(p))*leaf_prof(p,j) + & - (m_frootc_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootc_storage_to_litter_fire(p) + & - m_frootc_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemc_storage_to_litter_fire(p) + & - m_livestemc_xfer_to_litter_fire(p) & - +m_deadstemc_storage_to_litter_fire(p) + & - m_deadstemc_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootc_storage_to_litter_fire(p) + & - m_livecrootc_xfer_to_litter_fire(p) & - +m_deadcrootc_storage_to_litter_fire(p) + & - m_deadcrootc_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_cel_fire(c,j)=m_c_to_litr_cel_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_c_to_litr_lig_fire(c,j)=m_c_to_litr_lig_fire(c,j) + & - (m_leafc_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootc_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - - m_n_to_litr_met_fire(c,j)=m_n_to_litr_met_fire(c,j) + & - ((m_leafn_to_litter_fire(p)*lf_flab(patch%itype(p)) & - +m_leafn_storage_to_litter_fire(p) + & - m_leafn_xfer_to_litter_fire(p)+m_retransn_to_litter_fire(p)) & - *leaf_prof(p,j) +(m_frootn_to_litter_fire(p)*fr_flab(patch%itype(p)) & - +m_frootn_storage_to_litter_fire(p) + & - m_frootn_xfer_to_litter_fire(p))*froot_prof(p,j) & - +(m_livestemn_storage_to_litter_fire(p) + & - m_livestemn_xfer_to_litter_fire(p) & - +m_deadstemn_storage_to_litter_fire(p) + & - m_deadstemn_xfer_to_litter_fire(p))* stem_prof(p,j)& - +(m_livecrootn_storage_to_litter_fire(p) + & - m_livecrootn_xfer_to_litter_fire(p) & - +m_deadcrootn_storage_to_litter_fire(p) + & - m_deadcrootn_xfer_to_litter_fire(p))* croot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_cel_fire(c,j)=m_n_to_litr_cel_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_fcel(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_fcel(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - m_n_to_litr_lig_fire(c,j)=m_n_to_litr_lig_fire(c,j) + & - (m_leafn_to_litter_fire(p)*lf_flig(patch%itype(p))*leaf_prof(p,j) + & - m_frootn_to_litter_fire(p)*fr_flig(patch%itype(p))*froot_prof(p,j))* patch%wtcol(p) - end if - end if - end do - end do - end do - ! - ! vertically-resolved decomposing C/N fire loss - ! column loop - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - - f = farea_burned(c) - - ! change CC for litter from 0.4_r8 to 0.5_r8 and CC for CWD from 0.2_r8 - ! to 0.25_r8 according to Li et al.(2014) - do j = 1, nlevdecomp - ! carbon fluxes - do l = 1, ndecomp_pools - 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 - if ( is_cwd(l) ) then - m_decomp_cpools_to_fire_vr(c,j,l) = decomp_cpools_vr(c,j,l) * & - (f-baf_crop(c)) * 0.25_r8 - end if - end do - - ! nitrogen fluxes - do l = 1, ndecomp_pools - 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 - if ( is_cwd(l) ) then - m_decomp_npools_to_fire_vr(c,j,l) = decomp_npools_vr(c,j,l) * & - (f-baf_crop(c)) * 0.25_r8 - end if - end do - - end do - end do ! end of column loop - - ! carbon loss due to deforestation fires - - if (transient_landcover) then - call get_curr_date (kyr, kmo, kda, mcsec) - do fc = 1,num_soilc - c = filter_soilc(fc) - lfc2(c)=0._r8 - if( .not. (kmo == 1 .and. kda == 1 .and. mcsec == 0) )then - if( trotr1_col(c)+trotr2_col(c) > 0.6_r8 .and. dtrotr_col(c) > 0._r8 .and. & - lfc(c) > 0._r8 .and. fbac1(c) == 0._r8) then - lfc2(c) = max(0._r8, min(lfc(c), (farea_burned(c)-baf_crop(c) - & - baf_peatf(c))/2.0*dt))/(dtrotr_col(c)*dayspyr*secspday/dt)/dt - lfc(c) = lfc(c) - max(0._r8, min(lfc(c), (farea_burned(c)-baf_crop(c) - & - baf_peatf(c))*dt/2.0_r8)) - end if - end if - end do - end if - ! - ! Carbon loss due to peat fires - ! - ! somc_fire is not connected to clm45 soil carbon pool, ie does not decrease - ! soil carbon b/c clm45 soil carbon was very low in several peatland grids - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if( grc%latdeg(g) < cnfire_const%borealat)then - somc_fire(c)= totsomc(c)*baf_peatf(c)*6.0_r8/33.9_r8 - else - somc_fire(c)= baf_peatf(c)*2.2e3_r8 - end if - end do - - ! Fang Li has not added aerosol and trace gas emissions due to fire, yet - ! They will be added here in proportion to the carbon emission - ! Emission factors differ for various fire types - - end associate - - end subroutine CNFireFluxes - -end module CNFireLi2014Mod diff --git a/src/biogeochem/CNFireLi2016Mod.F90 b/src/biogeochem/CNFireLi2016Mod.F90 deleted file mode 100644 index e108462244..0000000000 --- a/src/biogeochem/CNFireLi2016Mod.F90 +++ /dev/null @@ -1,657 +0,0 @@ -module CNFireLi2016Mod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! module for fire dynamics - ! created in Nov, 2012 and revised in Apr, 2013 by F. Li and S. Levis - ! based on Li et al. (2012a,b; 2013) - ! revised in Apr, 2014 according to Li et al.(2014) - ! revised in May, 2015, according to Li et al. (2015, in prep.) - ! Fire-related parameters were calibrated or tuned in May, 2015 based on the - ! 20th Century transient simulations at f19_g16 with a CLM4.5 version - ! (clm50fire), CRUNCEPv5, and climatological lightning data. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use shr_const_mod , only : SHR_CONST_PI,SHR_CONST_TKFRZ - use shr_infnan_mod , only : shr_infnan_isnan - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full - use clm_varcon , only : dzsoi_decomp - use pftconMod , only : noveg, pftcon - use abortutils , only : endrun - use decompMod , only : bounds_type - use subgridAveMod , only : p2c - use atm2lndType , only : atm2lnd_type - use CNDVType , only : dgvs_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use ColumnType , only : col - use PatchType , only : patch - use SoilBiogeochemStateType , only : get_spinup_latitude_term - use CNFireMethodMod , only : cnfire_method_type - use CNFireBaseMod , only : cnfire_base_type, cnfire_const - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: cnfire_li2016_type - ! - type, extends(cnfire_base_type) :: cnfire_li2016_type - private - contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireArea ! Calculate fire area - end type cnfire_li2016_type - - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface cnfire_li2016_type - ! initialize a new cnfire_base object - module procedure constructor - end interface cnfire_li2016_type - !----------------------------------------------------------------------- - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - type(cnfire_li2016_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type cnfire_base_type. - ! !ARGUMENTS: - - constructor%need_lightning_and_popdens = .true. - end function constructor - - !----------------------------------------------------------------------- - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, soilhydrology_inst, waterstate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - use clm_time_manager , only: get_step_size, get_days_per_year, get_curr_date, get_nstep - use clm_varpar , only: max_patch_per_col - use clm_varcon , only: secspday, secsphr - use clm_varctl , only: spinup_state - use pftconMod , only: nc4_grass, nc3crop, ndllf_evr_tmp_tree - use pftconMod , only: nbrdlf_evr_trp_tree, nbrdlf_dcd_trp_tree, nbrdlf_evr_shrub - use dynSubgridControlMod , only : run_has_transient_landcover - ! - ! !ARGUMENTS: - class(cnfire_li2016_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(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_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:) - ! - ! !LOCAL VARIABLES: - ! - integer :: g,l,c,p,pi,j,fc,fp,kyr, kmo, kda, mcsec ! index variables - real(r8) :: dt ! time step variable (s) - real(r8) :: dayspyr ! days per year - real(r8) :: cli ! effect of climate on deforestation fires (0-1) - real(r8) :: cri ! thresholds used for cli, (mm/d), see Eq.(7) in Li et al.(2013) - real(r8) :: fb ! availability of fuel for regs A and C - real(r8) :: fhd ! impact of hd on agricultural fire - real(r8) :: fgdp ! impact of gdp on agricultural fire - real(r8) :: fire_m ! combustability of fuel for fire occurrence - real(r8) :: spread_m ! combustability of fuel for fire spread - real(r8) :: Lb_lf ! length-to-breadth ratio added by Lifang - integer :: i_cwd ! cwd pool - real(r8) :: lh ! anthro. ignitions (count/km2/hr) - real(r8) :: fs ! hd-dependent fires suppression (0-1) - real(r8) :: ig ! total ignitions (count/km2/hr) - real(r8) :: hdmlf ! human density - real(r8) :: arh, arh30 !combustability of fuel related to RH and RH30 - real(r8) :: afuel !weight for arh and arh30 - real(r8) :: btran_col(bounds%begc:bounds%endc) - logical :: transient_landcover ! whether this run has any prescribed transient landcover - real(r8), target :: prec60_col_target(bounds%begc:bounds%endc) - real(r8), target :: prec10_col_target(bounds%begc:bounds%endc) - real(r8), target :: rh30_col_target(bounds%begc:bounds%endc) - real(r8), pointer :: prec60_col(:) - real(r8), pointer :: prec10_col(:) - real(r8), pointer :: rh30_col(:) - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(totlitc_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soi17cm_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - - associate( & - totlitc => totlitc_col , & ! Input: [real(r8) (:) ] (gC/m2) total lit C (column-level mean) - decomp_cpools_vr => decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) VR decomp. (litter, cwd, soil) - tsoi17 => t_soi17cm_col , & ! Input: [real(r8) (:) ] (K) soil T for top 0.17 m - - lfuel => cnfire_const%lfuel , & ! Input: [real(r8) ] (gC/m2) Lower threshold of fuel mass - ufuel => cnfire_const%ufuel , & ! Input: [real(r8) ] (gC/m2) Upper threshold of fuel mass - rh_hgh => cnfire_const%rh_hgh , & ! Input: [real(r8) ] (%) High relative humidity - rh_low => cnfire_const%rh_low , & ! Input: [real(r8) ] (%) Low relative humidity - bt_min => cnfire_const%bt_min , & ! Input: [real(r8) ] (0-1) Minimum btran - bt_max => cnfire_const%bt_max , & ! Input: [real(r8) ] (0-1) Maximum btran - cli_scale => cnfire_const%cli_scale , & ! Input: [real(r8) ] (/d) global constant for deforestation fires - cropfire_a1 => cnfire_const%cropfire_a1 , & ! Input: [real(r8) ] (/hr) a1 parameter for cropland fire - non_boreal_peatfire_c => cnfire_const%non_boreal_peatfire_c , & ! Input: [real(r8) ] (/hr) c parameter for non-boreal peatland fire - pot_hmn_ign_counts_alpha => cnfire_const%pot_hmn_ign_counts_alpha , & ! Input: [real(r8) ] (/person/month) Potential human ignition counts - boreal_peatfire_c => cnfire_const%boreal_peatfire_c , & ! Input: [real(r8) ] (/hr) c parameter for boreal peatland fire - - fsr_pft => pftcon%fsr_pft , & ! Input: - fd_pft => pftcon%fd_pft , & ! Input: - - btran2 => energyflux_inst%btran2_patch , & ! Input: [real(r8) (:) ] root zone soil wetness - fsat => soilhydrology_inst%fsat_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface - wf2 => waterstate_inst%wf2_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m - - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - spinup_factor => decomp_cascade_con%spinup_factor , & ! Input: [real(r8) (:) ] factor for AD spinup associated with each pool - - forc_rh => atm2lnd_inst%forc_rh_grc , & ! Input: [real(r8) (:) ] relative humidity - forc_wind => atm2lnd_inst%forc_wind_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric temperature (Kelvin) - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] downscaled rain - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] downscaled snow - prec60 => atm2lnd_inst%prec60_patch , & ! Input: [real(r8) (:) ] 60-day running mean of tot. precipitation - prec10 => atm2lnd_inst%prec10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation - rh30 => atm2lnd_inst%rh30_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation - dwt_smoothed => cnveg_state_inst%dwt_smoothed_patch , & ! Input: [real(r8) (:) ] change in patch weight (-1 to 1) on the gridcell, smoothed over the year - cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column - gdp_lf => cnveg_state_inst%gdp_lf_col , & ! Input: [real(r8) (:) ] gdp data - peatf_lf => cnveg_state_inst%peatf_lf_col , & ! Input: [real(r8) (:) ] peatland fraction data - abm_lf => cnveg_state_inst%abm_lf_col , & ! Input: [integer (:) ] prescribed crop fire time - baf_crop => cnveg_state_inst%baf_crop_col , & ! Output: [real(r8) (:) ] burned area fraction for cropland (/sec) - baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Output: [real(r8) (:) ] burned area fraction for peatland (/sec) - burndate => cnveg_state_inst%burndate_patch , & ! Output: [integer (:) ] burn date for crop - fbac => cnveg_state_inst%fbac_col , & ! Output: [real(r8) (:) ] total burned area out of conversion (/sec) - fbac1 => cnveg_state_inst%fbac1_col , & ! Output: [real(r8) (:) ] burned area out of conversion region due to land use fire - farea_burned => cnveg_state_inst%farea_burned_col , & ! Output: [real(r8) (:) ] total fractional area burned (/sec) - nfire => cnveg_state_inst%nfire_col , & ! Output: [real(r8) (:) ] fire counts (count/km2/sec), valid only in Reg. C - fsr_col => cnveg_state_inst%fsr_col , & ! Output: [real(r8) (:) ] fire spread rate at column level - fd_col => cnveg_state_inst%fd_col , & ! Output: [real(r8) (:) ] fire duration rate at column level - lgdp_col => cnveg_state_inst%lgdp_col , & ! Output: [real(r8) (:) ] gdp limitation factor for nfire - lgdp1_col => cnveg_state_inst%lgdp1_col , & ! Output: [real(r8) (:) ] gdp limitation factor for baf per fire - lpop_col => cnveg_state_inst%lpop_col , & ! Output: [real(r8) (:) ] pop limitation factor for baf per fire - lfwt => cnveg_state_inst%lfwt_col , & ! Output: [real(r8) (:) ] fractional coverage of non-crop and non-bare-soil Patches - trotr1_col => cnveg_state_inst%trotr1_col , & ! Output: [real(r8) (:) ] patch weight of BET on the column (0-1) - trotr2_col => cnveg_state_inst%trotr2_col , & ! Output: [real(r8) (:) ] patch weight of BDT on the column (0-1) - dtrotr_col => cnveg_state_inst%dtrotr_col , & ! Output: [real(r8) (:) ] decreased frac. coverage of BET+BDT on grid for dt - lfc => cnveg_state_inst%lfc_col , & ! Output: [real(r8) (:) ] conversion area frac. of BET+BDT that haven't burned before - wtlf => cnveg_state_inst%wtlf_col , & ! Output: [real(r8) (:) ] fractional coverage of non-crop Patches - - totvegc => cnveg_carbonstate_inst%totvegc_col , & ! Input: [real(r8) (:) ] totvegc at column level - deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem root C - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - rootc_col => cnveg_carbonstate_inst%rootc_col , & ! Output: [real(r8) (:) ] root carbon - leafc_col => cnveg_carbonstate_inst%leafc_col , & ! Output: [real(r8) (:) ] leaf carbon at column level - deadstemc_col => cnveg_carbonstate_inst%deadstemc_col , & ! Output: [real(r8) (:) ] deadstem carbon at column level - fuelc => cnveg_carbonstate_inst%fuelc_col , & ! Output: [real(r8) (:) ] fuel load coutside cropland - fuelc_crop => cnveg_carbonstate_inst%fuelc_crop_col & ! Output: [real(r8) (:) ] fuel load for cropland - ) - - transient_landcover = run_has_transient_landcover() - - !pft to column average - prec10_col =>prec10_col_target - call p2c(bounds, num_soilc, filter_soilc, & - prec10(bounds%begp:bounds%endp), & - prec10_col(bounds%begc:bounds%endc)) - - prec60_col =>prec60_col_target - call p2c(bounds, num_soilc, filter_soilc, & - prec60(bounds%begp:bounds%endp), & - prec60_col(bounds%begc:bounds%endc)) - - rh30_col =>rh30_col_target - call p2c(bounds, num_soilc, filter_soilc, & - rh30(bounds%begp:bounds%endp), & - rh30_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - leafc(bounds%begp:bounds%endp), & - leafc_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - deadstemc(bounds%begp:bounds%endp), & - deadstemc_col(bounds%begc:bounds%endc)) - - call get_curr_date (kyr, kmo, kda, mcsec) - dayspyr = get_days_per_year() - ! Get model step size - dt = real( get_step_size(), r8 ) - ! - ! On first time-step, just set area burned to zero and exit - ! - if ( get_nstep() == 0 )then - do fc = 1,num_soilc - c = filter_soilc(fc) - farea_burned(c) = 0._r8 - baf_crop(c) = 0._r8 - baf_peatf(c) = 0._r8 - fbac(c) = 0._r8 - fbac1(c) = 0._r8 - cropf_col(c) = 0._r8 - end do - return - end if - ! - ! Calculate fraction of crop (cropf_col) and non-crop and non-bare-soil - ! vegetation (lfwt) in vegetated column - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - cropf_col(c) = 0._r8 - lfwt(c) = 0._r8 - end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop veg types - if( patch%itype(p) > nc4_grass )then - cropf_col(c) = cropf_col(c) + patch%wtcol(p) - end if - ! For natural vegetation (non-crop and non-bare-soil) - if( patch%itype(p) >= ndllf_evr_tmp_tree .and. patch%itype(p) <= nc4_grass )then - lfwt(c) = lfwt(c) + patch%wtcol(p) - end if - end if - end do - end do - ! - ! Calculate crop fuel - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - fuelc_crop(c)=0._r8 - end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop PFTs, fuel load includes leaf and litter; only - ! column-level litter carbon - ! is available, so we use leaf carbon to estimate the - ! litter carbon for crop PFTs - if( patch%itype(p) > nc4_grass .and. patch%wtcol(p) > 0._r8 .and. leafc_col(c) > 0._r8 )then - fuelc_crop(c)=fuelc_crop(c) + (leafc(p) + leafc_storage(p) + & - leafc_xfer(p))*patch%wtcol(p)/cropf_col(c) + & - totlitc(c)*leafc(p)/leafc_col(c)*patch%wtcol(p)/cropf_col(c) - end if - end if - end do - end do - ! - ! Calculate noncrop column variables - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - fsr_col(c) = 0._r8 - fd_col(c) = 0._r8 - rootc_col(c) = 0._r8 - lgdp_col(c) = 0._r8 - lgdp1_col(c) = 0._r8 - lpop_col(c) = 0._r8 - btran_col(c) = 0._r8 - wtlf(c) = 0._r8 - trotr1_col(c)= 0._r8 - trotr2_col(c)= 0._r8 - if (transient_landcover) then - dtrotr_col(c)=0._r8 - end if - end do - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - ! For non-crop -- natural vegetation and bare-soil - if( patch%itype(p) < nc3crop .and. cropf_col(c) < 1.0_r8 )then - if( .not. shr_infnan_isnan(btran2(p))) then - if (btran2(p) <= 1._r8 ) then - btran_col(c) = btran_col(c)+btran2(p)*patch%wtcol(p) - wtlf(c) = wtlf(c)+patch%wtcol(p) - end if - end if - - ! NOTE(wjs, 2016-12-15) These calculations of the fraction of evergreen - ! and deciduous tropical trees (used to determine if a column is - ! tropical closed forest) use the current fractions. However, I think - ! they are used in code that applies to land cover change. Note that - ! land cover change is currently generated on the first time step of the - ! year (even though the fire code sees the annually-smoothed dwt). Thus, - ! I think that, for this to be totally consistent, this code should - ! consider the fractional coverage of each PFT prior to the relevant - ! land cover change event. (These fractions could be computed in the - ! code that handles land cover change, so that the fire code remains - ! agnostic to exactly how and when land cover change happens.) - ! - ! For example, if a year started with fractional coverages of - ! nbrdlf_evr_trp_tree = 0.35 and nbrdlf_dcd_trp_tree = 0.35, but then - ! the start-of-year land cover change reduced both of these to 0.2: The - ! current code would consider the column to NOT be tropical closed - ! forest (because nbrdlf_evr_trp_tree+nbrdlf_dcd_trp_tree < 0.6), - ! whereas in fact the land cover change occurred when the column *was* - ! tropical closed forest. - if( patch%itype(p) == nbrdlf_evr_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr1_col(c)=trotr1_col(c)+patch%wtcol(p) - end if - if( patch%itype(p) == nbrdlf_dcd_trp_tree .and. patch%wtcol(p) > 0._r8 )then - trotr2_col(c)=trotr2_col(c)+patch%wtcol(p) - end if - - if (transient_landcover) then - if( patch%itype(p) == nbrdlf_evr_trp_tree .or. patch%itype(p) == nbrdlf_dcd_trp_tree )then - if(dwt_smoothed(p) < 0._r8)then - ! Land cover change in CLM happens all at once on the first time - ! step of the year. However, the fire code needs deforestation - ! rates throughout the year, in order to combine these - ! deforestation rates with the current season's climate. So we - ! use a smoothed version of dwt. - ! - ! This isn't ideal, because the carbon stocks that the fire code - ! is operating on will have decreased by the full annual amount - ! before the fire code does anything. But the biggest effect of - ! these deforestation fires is as a trigger for other fires, and - ! the C fluxes are merely diagnostic so don't need to be - ! conservative, so this isn't a big issue. - ! - ! (Actually, it would be even better if the fire code had a - ! realistic breakdown of annual deforestation into the - ! different seasons. But having deforestation spread evenly - ! throughout the year is much better than having it all - ! concentrated on January 1.) - dtrotr_col(c)=dtrotr_col(c)-dwt_smoothed(p) - end if - end if - end if - if (spinup_state == 2) then - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) * 10._r8 + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - else - rootc_col(c) = rootc_col(c) + (frootc(p) + frootc_storage(p) + & - frootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + & - livecrootc(p)+livecrootc_storage(p) + & - livecrootc_xfer(p))*patch%wtcol(p) - endif - - fsr_col(c) = fsr_col(c) + fsr_pft(patch%itype(p))*patch%wtcol(p)/(1.0_r8-cropf_col(c)) - - hdmlf=this%forc_hdm(g) - - ! all these constants are in Li et al. BG (2012a,b;2013) - - if( hdmlf > 0.1_r8 )then - ! For NOT bare-soil - if( patch%itype(p) /= noveg )then - ! For shrub and grass (crop already excluded above) - if( patch%itype(p) >= nbrdlf_evr_shrub )then !for shurb and grass - lgdp_col(c) = lgdp_col(c) + (0.1_r8 + 0.9_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/8._r8)**0.5_r8))*patch%wtcol(p) & - /(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (gdp_lf(c)/7._r8)))*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lpop_col(c) = lpop_col(c) + (0.2_r8 + 0.8_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/450._r8)**0.5_r8))*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else ! for trees - if( gdp_lf(c) > 20._r8 )then - lgdp_col(c) =lgdp_col(c)+cnfire_const%occur_hi_gdp_tree*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c) =lgdp1_col(c)+0.62_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else - if( gdp_lf(c) > 8._r8 )then - lgdp_col(c)=lgdp_col(c)+0.79_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c)=lgdp1_col(c)+0.83_r8*patch%wtcol(p)/(1._r8 - cropf_col(c)) - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) - lgdp1_col(c)=lgdp1_col(c)+patch%wtcol(p)/(1._r8 - cropf_col(c)) - end if - end if - lpop_col(c) = lpop_col(c) + (0.4_r8 + 0.6_r8* & - exp(-1._r8*SHR_CONST_PI* & - (hdmlf/125._r8)))*patch%wtcol(p)/(1._r8 -cropf_col(c)) - end if - end if - else - lgdp_col(c) = lgdp_col(c)+patch%wtcol(p)/(1.0_r8 - cropf_col(c)) - lgdp1_col(c) = lgdp1_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) - lpop_col(c) = lpop_col(c)+patch%wtcol(p)/(1.0_r8 -cropf_col(c)) - end if - - fd_col(c) = fd_col(c) + fd_pft(patch%itype(p)) * patch%wtcol(p) * secsphr / (1.0_r8-cropf_col(c)) - end if - end if - end do - end do - - ! estimate annual decreased fractional coverage of BET+BDT - ! land cover conversion in CLM4.5 is the same for each timestep except for the beginning - - if (transient_landcover) then - do fc = 1,num_soilc - c = filter_soilc(fc) - if( dtrotr_col(c) > 0._r8 )then - if( kmo == 1 .and. kda == 1 .and. mcsec == 0)then - lfc(c) = 0._r8 - end if - if( kmo == 1 .and. kda == 1 .and. mcsec == dt)then - lfc(c) = dtrotr_col(c)*dayspyr*secspday/dt - end if - else - lfc(c)=0._r8 - end if - end do - end if - ! - ! calculate burned area fraction in cropland - ! - do fc = 1,num_soilc - c = filter_soilc(fc) - baf_crop(c)=0._r8 - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - if( kmo == 1 .and. kda == 1 .and. mcsec == 0 )then - burndate(p) = 10000 ! init. value; actual range [0 365] - end if - end do - - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - hdmlf=this%forc_hdm(g) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - ! For crop - if( forc_t(c) >= SHR_CONST_TKFRZ .and. patch%itype(p) > nc4_grass .and. & - kmo == abm_lf(c) .and. & - burndate(p) >= 999 .and. patch%wtcol(p) > 0._r8 )then ! catch crop burn time - - ! calculate human density impact on ag. fire - fhd = 0.04_r8+0.96_r8*exp(-1._r8*SHR_CONST_PI*(hdmlf/350._r8)**0.5_r8) - - ! calculate impact of GDP on ag. fire - fgdp = 0.01_r8+0.99_r8*exp(-1._r8*SHR_CONST_PI*(gdp_lf(c)/10._r8)) - - ! calculate burned area - fb = max(0.0_r8,min(1.0_r8,(fuelc_crop(c)-lfuel)/(ufuel-lfuel))) - - ! crop fire only for generic crop types at this time - ! managed crops are treated as grasses if crop model is turned on - baf_crop(c) = baf_crop(c) + cropfire_a1/secsphr*fhd*fgdp*patch%wtcol(p) - if( fb*fhd*fgdp*patch%wtcol(p) > 0._r8)then - burndate(p)=kda - end if - end if - end if - end do - end do - ! - ! calculate peatland fire - ! - do fc = 1, num_soilc - c = filter_soilc(fc) - g= col%gridcell(c) - if(grc%latdeg(g) < cnfire_const%borealat )then - baf_peatf(c) = non_boreal_peatfire_c/secsphr*max(0._r8, & - min(1._r8,(4.0_r8-prec60_col(c)*secspday)/ & - 4.0_r8))**2*peatf_lf(c)*(1._r8-fsat(c)) - else - baf_peatf(c) = boreal_peatfire_c/secsphr*exp(-SHR_CONST_PI*(max(wf2(c),0._r8)/0.3_r8))* & - max(0._r8,min(1._r8,(tsoi17(c)-SHR_CONST_TKFRZ)/10._r8))*peatf_lf(c)* & - (1._r8-fsat(c)) - end if - end do - ! - ! calculate other fires - ! - - ! Set the number of timesteps for e-folding. - ! When the simulation has run fewer than this number of steps, - ! re-scale the e-folding time to get a stable early estimate. - - ! find which pool is the cwd pool - i_cwd = 0 - do l = 1, ndecomp_pools - if ( is_cwd(l) ) then - i_cwd = l - endif - end do - - ! - ! begin column loop to calculate fractional area affected by fire - ! - do fc = 1, num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - hdmlf=this%forc_hdm(g) - if( cropf_col(c) < 1._r8 )then - fuelc(c) = totlitc(c)+totvegc(c)-rootc_col(c)-fuelc_crop(c)*cropf_col(c) - if (spinup_state == 2) then - fuelc(c) = fuelc(c) + ((10._r8 - 1._r8)*deadstemc_col(c)) - do j = 1, nlevdecomp - fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) * spinup_factor(i_cwd) & - * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - end do - else - do j = 1, nlevdecomp - fuelc(c) = fuelc(c)+decomp_cpools_vr(c,j,i_cwd) * dzsoi_decomp(j) - end do - end if - fuelc(c) = fuelc(c)/(1._r8-cropf_col(c)) - fb = max(0.0_r8,min(1.0_r8,(fuelc(c)-lfuel)/(ufuel-lfuel))) - if (trotr1_col(c)+trotr2_col(c)<=0.6_r8) then - afuel =min(1._r8,max(0._r8,(fuelc(c)-2500._r8)/(5000._r8-2500._r8))) - arh=1._r8-max(0._r8, min(1._r8,(forc_rh(g)-rh_low)/(rh_hgh-rh_low))) - arh30=1._r8-max(0.7_r8, min(1._r8,rh30_col(c)/90._r8)) - if (forc_rh(g) < rh_hgh.and. wtlf(c) > 0._r8 .and. tsoi17(c)> SHR_CONST_TKFRZ)then - fire_m = ((afuel*arh30+(1._r8-afuel)*arh)**1.5_r8)*((1._r8 -max(0._r8,& - min(1._r8,(btran_col(c)/wtlf(c)-bt_min)/(bt_max-bt_min))))**0.5_r8) - else - fire_m = 0._r8 - end if - lh = pot_hmn_ign_counts_alpha*6.8_r8*hdmlf**(0.43_r8)/30._r8/24._r8 - fs = 1._r8-(0.01_r8+0.98_r8*exp(-0.025_r8*hdmlf)) - ig = (lh+this%forc_lnfm(g)/(5.16_r8+2.16_r8*cos(3*min(60._r8,abs(grc%latdeg(g)))))*0.22_r8) & - *(1._r8-fs)*(1._r8-cropf_col(c)) - nfire(c) = ig/secsphr*fb*fire_m*lgdp_col(c) !fire counts/km2/sec - Lb_lf = 1._r8+10._r8*(1._r8-EXP(-0.06_r8*forc_wind(g))) - spread_m = fire_m**0.5_r8 - farea_burned(c) = min(1._r8,(cnfire_const%g0*spread_m*fsr_col(c)* & - fd_col(c)/1000._r8)**2*lgdp1_col(c)* & - lpop_col(c)*nfire(c)*SHR_CONST_PI*Lb_lf+ & - baf_crop(c)+baf_peatf(c)) ! fraction (0-1) per sec - else - farea_burned(c)=min(1._r8,baf_crop(c)+baf_peatf(c)) - end if - ! - ! if landuse change data is used, calculate deforestation fires and - ! add it in the total of burned area fraction - ! - if (transient_landcover) then - if( trotr1_col(c)+trotr2_col(c) > 0.6_r8 )then - if(( kmo == 1 .and. kda == 1 .and. mcsec == 0) .or. & - dtrotr_col(c) <=0._r8 )then - fbac1(c) = 0._r8 - farea_burned(c) = baf_crop(c)+baf_peatf(c) - else - cri = (4.0_r8*trotr1_col(c)+1.8_r8*trotr2_col(c))/(trotr1_col(c)+trotr2_col(c)) - cli = (max(0._r8,min(1._r8,(cri-prec60_col(c)*secspday)/cri))**0.5)* & - (max(0._r8,min(1._r8,(cri-prec10_col(c)*secspday)/cri))**0.5)* & - max(0.0005_r8,min(1._r8,19._r8*dtrotr_col(c)*dayspyr*secspday/dt-0.001_r8))* & - max(0._r8,min(1._r8,(0.25_r8-(forc_rain(c)+forc_snow(c))*secsphr)/0.25_r8)) - farea_burned(c) = cli*(cli_scale/secspday)+baf_crop(c)+baf_peatf(c) - ! burned area out of conversion region due to land use fire - fbac1(c) = max(0._r8,fb*cli*(cli_scale/secspday) - 2.0_r8*lfc(c)/dt) - end if - ! total burned area out of conversion - fbac(c) = fbac1(c)+baf_crop(c)+baf_peatf(c) - else - fbac(c) = farea_burned(c) - end if - end if - - else - farea_burned(c) = min(1._r8,baf_crop(c)+baf_peatf(c)) - end if - - end do ! end of column loop - - end associate - - end subroutine CNFireArea - -end module CNFireLi2016Mod diff --git a/src/biogeochem/CNFireMethodMod.F90 b/src/biogeochem/CNFireMethodMod.F90 deleted file mode 100644 index d3c9afe1f8..0000000000 --- a/src/biogeochem/CNFireMethodMod.F90 +++ /dev/null @@ -1,191 +0,0 @@ -module CNFireMethodMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Abstract base class for functions to implement CN and BGC fire model - ! - ! Created by Erik Kluzek, following Bill Sack's implementation of polymorphism - ! !USES: - implicit none - private - ! - ! !PUBLIC TYPES: - public :: cnfire_method_type - - type, abstract :: cnfire_method_type - logical, public :: need_lightning_and_popdens = .true. ! If need lightning and population density - contains - - ! Initialize the fire datasets - procedure(CNFireInit_interface) , public, deferred :: CNFireInit - - ! Read namelist for the fire datasets - procedure(CNFireReadNML_interface), public, deferred :: CNFireReadNML - - ! Interpolate the fire datasets - procedure(CNFireInterp_interface) , public, deferred :: CNFireInterp - - ! Figure out the fire area - procedure(CNFireArea_interface) , public, deferred :: CNFireArea - - ! Figure out the fire fluxes - procedure(CNFireFluxes_interface) , public, deferred :: CNFireFluxes - - end type cnfire_method_type - - abstract interface - - ! Note: The following code is adapted based on what Bill Sacks has done for soil water retention curve - ! polymorphism. Therefore, I also keep some suggestions he gave there. - ! - ! - Make the interfaces contain all possible inputs that are needed by any - ! implementation; each implementation will then ignore the inputs it doesn't need. - ! - ! - For inputs that are needed only by particular implementations - and particularly - ! for inputs that are constant in time - ! pass these into the constructor, and save pointers to these inputs as components - ! of the child type that needs them. Then they aren't needed as inputs to the - ! individual routines, allowing the interfaces for these routines to remain more - ! consistent between different implementations. - ! - !--------------------------------------------------------------------------- - subroutine CNFireInit_interface(this, bounds, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize CN Fire datasets - ! - ! USES - use decompMod , only : bounds_type - import :: cnfire_method_type - ! !ARGUMENTS: - class(cnfire_method_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - !----------------------------------------------------------------------- - - end subroutine CNFireInit_interface - - subroutine CNFireReadNML_interface(this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read general fire namelist - ! - ! USES - import :: cnfire_method_type - ! !ARGUMENTS: - class(cnfire_method_type) :: this - character(len=*), intent(in) :: NLFilename - !----------------------------------------------------------------------- - - end subroutine CNFireReadNML_interface - - subroutine CNFireInterp_interface(this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate CN Fire datasets - ! - ! USES - use decompMod , only : bounds_type - import :: cnfire_method_type - ! !ARGUMENTS: - class(cnfire_method_type) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - end subroutine CNFireInterp_interface - - !----------------------------------------------------------------------- - subroutine CNFireArea_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, soilhydrology_inst, waterstate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - import :: cnfire_method_type - ! - ! !ARGUMENTS: - class(cnfire_method_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(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_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:) - !----------------------------------------------------------------------- - end subroutine CNFireArea_interface - - !----------------------------------------------------------------------- - subroutine CNFireFluxes_interface (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - dgvs_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch, & - totsomc_col, decomp_cpools_vr_col, decomp_npools_vr_col, somc_fire_col) - ! - ! !DESCRIPTION: - ! Fire effects routine for coupled carbon-nitrogen code (CN). - ! Relies primarily on estimate of fractional area burned, from CNFireArea(). - ! - ! Total fire carbon emissions (g C/m2 land area/yr) - ! =avg(COL_FIRE_CLOSS)*seconds_per_year + avg(SOMC_FIRE)*seconds_per_year + - ! avg(LF_CONV_CFLUX)*seconds_per_year*min(1.0,avg(LFC2)*seconds_per_year)*0.8 - ! where avg means the temporal average in a year - ! seconds_per_year is the number of seconds in a year. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use CNDVType , only : dgvs_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - import :: cnfire_method_type - ! - ! !ARGUMENTS: - class(cnfire_method_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(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: totsomc_col(bounds%begc:) ! (gC/m2) total soil organic matter C - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,1:,1:) ! (gC/m3) VR decomp. (litter, cwd, soil) - real(r8) , intent(in) :: decomp_npools_vr_col(bounds%begc:,1:,1:) ! (gC/m3) VR decomp. (litter, cwd, soil) - real(r8) , intent(out) :: somc_fire_col(bounds%begc:) ! (gC/m2/s) fire C emissions due to peat burning - !----------------------------------------------------------------------- - end subroutine CNFireFluxes_interface - - !----------------------------------------------------------------------- - - end interface - -end module CNFireMethodMod diff --git a/src/biogeochem/CNFireNoFireMod.F90 b/src/biogeochem/CNFireNoFireMod.F90 deleted file mode 100644 index e752bc9a2f..0000000000 --- a/src/biogeochem/CNFireNoFireMod.F90 +++ /dev/null @@ -1,130 +0,0 @@ -module CNFireNoFireMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! module for fire dynamics with fire explicitly turned off - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use CNFireMethodMod , only : cnfire_method_type - use CNFireBaseMod , only : cnfire_base_type - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: cnfire_nofire_type - ! - type, extends(cnfire_base_type) :: cnfire_nofire_type - private - contains - ! - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: CNFireArea ! Calculate fire area - end type cnfire_nofire_type - - ! - ! !PRIVATE MEMBER DATA: - !----------------------------------------------------------------------- - - interface cnfire_nofire_type - ! initialize a new cnfire_base object - module procedure constructor - end interface cnfire_nofire_type - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - type(cnfire_nofire_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type cnfire_base_type. - ! !ARGUMENTS: - constructor%need_lightning_and_popdens = .false. - end function constructor - - !----------------------------------------------------------------------- - subroutine CNFireArea (this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - atm2lnd_inst, energyflux_inst, soilhydrology_inst, waterstate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, totlitc_col, decomp_cpools_vr_col, t_soi17cm_col) - ! - ! !DESCRIPTION: - ! Computes column-level burned area - ! - ! !USES: - use subgridAveMod , only : p2c - ! - ! !ARGUMENTS: - class(cnfire_nofire_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(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_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:) - ! - ! !LOCAL VARIABLES: - integer :: c,fc ! index variables - !----------------------------------------------------------------------- - - associate( & - cropf_col => cnveg_state_inst%cropf_col , & ! Input: [real(r8) (:) ] cropland fraction in veg column - baf_crop => cnveg_state_inst%baf_crop_col , & ! Output: [real(r8) (:) ] burned area fraction for cropland (/sec) - baf_peatf => cnveg_state_inst%baf_peatf_col , & ! Output: [real(r8) (:) ] burned area fraction for peatland (/sec) - fbac => cnveg_state_inst%fbac_col , & ! Output: [real(r8) (:) ] total burned area out of conversion (/sec) - fbac1 => cnveg_state_inst%fbac1_col , & ! Output: [real(r8) (:) ] burned area out of conversion region due to land use fire - lfc => cnveg_state_inst%lfc_col , & ! Output: [real(r8) (:) ] conversion area frac. of BET+BDT that haven't burned before - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - leafc_col => cnveg_carbonstate_inst%leafc_col , & ! Output: [real(r8) (:) ] leaf carbon at column level - farea_burned => cnveg_state_inst%farea_burned_col & ! Output: [real(r8) (:) ] total fractional area burned (/sec) - ) - - !pft to column average - call p2c(bounds, num_soilc, filter_soilc, & - leafc(bounds%begp:bounds%endp), & - leafc_col(bounds%begc:bounds%endc)) - ! - ! begin column loop to calculate fractional area affected by fire - ! - do fc = 1, num_soilc - c = filter_soilc(fc) - - ! zero out the fire area - - farea_burned(c) = 0._r8 - baf_crop(c) = 0._r8 - baf_peatf(c) = 0._r8 - fbac(c) = 0._r8 - fbac1(c) = 0._r8 - cropf_col(c) = 0._r8 - lfc(c) = 0._r8 - ! with NOFIRE, tree carbon is still removed in landuse change regions by the - ! landuse code - end do ! end of column loop - - end associate - - end subroutine CNFireArea - -end module CNFireNoFireMod diff --git a/src/biogeochem/CNGRespMod.F90 b/src/biogeochem/CNGRespMod.F90 deleted file mode 100644 index d95761e61f..0000000000 --- a/src/biogeochem/CNGRespMod.F90 +++ /dev/null @@ -1,214 +0,0 @@ -module CNGRespMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for growth respiration fluxes, - ! for coupled carbon-nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use pftconMod , only : npcropmin, pftcon - use CNVegcarbonfluxType , only : cnveg_carbonflux_type - use PatchType , only : patch - use CanopyStateType , only : canopystate_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNGResp - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - ! subroutine CNGResp(num_soilp, filter_soilp, cnveg_carbonflux_inst) - subroutine CNGResp(num_soilp, filter_soilp, cnveg_carbonflux_inst, canopystate_inst, cnveg_carbonstate_inst, & - cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic carbon state - ! variables - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8):: respfact_leaf - real(r8):: respfact_froot - real(r8):: respfact_livecroot - real(r8):: respfact_livestem - real(r8):: respfact_leaf_storage - real(r8):: respfact_froot_storage - real(r8):: respfact_livecroot_storage - real(r8):: respfact_livestem_storage - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:)] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - grperc => pftcon%grperc , & ! Input: growth respiration parameter - grpnow => pftcon%grpnow , & ! Input: growth respiration parameter - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:)] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:)] shaded projected leaf area index - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:)] - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:)] - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:)] - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:)] - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C storage - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N storage - - cpool_to_leafc => cnveg_carbonflux_inst%cpool_to_leafc_patch , & ! Input: [real(r8) (:)] - cpool_to_leafc_storage => cnveg_carbonflux_inst%cpool_to_leafc_storage_patch , & ! Input: [real(r8) (:)] - cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Input: [real(r8) (:)] - cpool_to_frootc_storage => cnveg_carbonflux_inst%cpool_to_frootc_storage_patch , & ! Input: [real(r8) (:)] - cpool_to_livestemc => cnveg_carbonflux_inst%cpool_to_livestemc_patch , & ! Input: [real(r8) (:)] - cpool_to_livestemc_storage => cnveg_carbonflux_inst%cpool_to_livestemc_storage_patch , & ! Input: [real(r8) (:)] - cpool_to_deadstemc => cnveg_carbonflux_inst%cpool_to_deadstemc_patch , & ! Input: [real(r8) (:)] - cpool_to_deadstemc_storage => cnveg_carbonflux_inst%cpool_to_deadstemc_storage_patch , & ! Input: [real(r8) (:)] - cpool_to_livecrootc => cnveg_carbonflux_inst%cpool_to_livecrootc_patch , & ! Input: [real(r8) (:)] - cpool_to_livecrootc_storage => cnveg_carbonflux_inst%cpool_to_livecrootc_storage_patch , & ! Input: [real(r8) (:)] - cpool_to_deadcrootc => cnveg_carbonflux_inst%cpool_to_deadcrootc_patch , & ! Input: [real(r8) (:)] allocation to dead coarse root C (gC/m2/s) - cpool_to_deadcrootc_storage => cnveg_carbonflux_inst%cpool_to_deadcrootc_storage_patch , & ! Input: [real(r8) (:)] allocation to dead coarse root C storage (gC/m2/s) - cpool_to_grainc => cnveg_carbonflux_inst%cpool_to_grainc_patch , & ! Input: [real(r8) (:)] allocation to grain C (gC/m2/s) - cpool_to_grainc_storage => cnveg_carbonflux_inst%cpool_to_grainc_storage_patch , & ! Input: [real(r8) (:)] allocation to grain C storage (gC/m2/s) - grainc_xfer_to_grainc => cnveg_carbonflux_inst%grainc_xfer_to_grainc_patch , & ! Input: [real(r8) (:)] grain C growth from storage (gC/m2/s) - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Input: [real(r8) (:)] leaf C growth from storage (gC/m2/s) - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Input: [real(r8) (:)] fine root C growth from storage (gC/m2/s) - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Input: [real(r8) (:)] live stem C growth from storage (gC/m2/s) - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Input: [real(r8) (:)] dead stem C growth from storage (gC/m2/s) - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Input: [real(r8) (:)] live coarse root C growth from storage (gC/m2/s) - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Input: [real(r8) (:)] dead coarse root C growth from storage (gC/m2/s) - cpool_grain_gr => cnveg_carbonflux_inst%cpool_grain_gr_patch , & ! Output: [real(r8) (:)] - cpool_grain_storage_gr => cnveg_carbonflux_inst%cpool_grain_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_grain_gr => cnveg_carbonflux_inst%transfer_grain_gr_patch , & ! Output: [real(r8) (:)] - cpool_leaf_gr => cnveg_carbonflux_inst%cpool_leaf_gr_patch , & ! Output: [real(r8) (:)] - cpool_leaf_storage_gr => cnveg_carbonflux_inst%cpool_leaf_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_leaf_gr => cnveg_carbonflux_inst%transfer_leaf_gr_patch , & ! Output: [real(r8) (:)] - cpool_froot_gr => cnveg_carbonflux_inst%cpool_froot_gr_patch , & ! Output: [real(r8) (:)] - cpool_froot_storage_gr => cnveg_carbonflux_inst%cpool_froot_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_froot_gr => cnveg_carbonflux_inst%transfer_froot_gr_patch , & ! Output: [real(r8) (:)] - cpool_livestem_gr => cnveg_carbonflux_inst%cpool_livestem_gr_patch , & ! Output: [real(r8) (:)] - cpool_livestem_storage_gr => cnveg_carbonflux_inst%cpool_livestem_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_livestem_gr => cnveg_carbonflux_inst%transfer_livestem_gr_patch , & ! Output: [real(r8) (:)] - cpool_deadstem_gr => cnveg_carbonflux_inst%cpool_deadstem_gr_patch , & ! Output: [real(r8) (:)] - cpool_deadstem_storage_gr => cnveg_carbonflux_inst%cpool_deadstem_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_deadstem_gr => cnveg_carbonflux_inst%transfer_deadstem_gr_patch , & ! Output: [real(r8) (:)] - cpool_livecroot_gr => cnveg_carbonflux_inst%cpool_livecroot_gr_patch , & ! Output: [real(r8) (:)] - cpool_livecroot_storage_gr => cnveg_carbonflux_inst%cpool_livecroot_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_livecroot_gr => cnveg_carbonflux_inst%transfer_livecroot_gr_patch , & ! Output: [real(r8) (:)] - cpool_deadcroot_gr => cnveg_carbonflux_inst%cpool_deadcroot_gr_patch , & ! Output: [real(r8) (:)] - cpool_deadcroot_storage_gr => cnveg_carbonflux_inst%cpool_deadcroot_storage_gr_patch , & ! Output: [real(r8) (:)] - transfer_deadcroot_gr => cnveg_carbonflux_inst%transfer_deadcroot_gr_patch & ! Output: [real(r8) (:)] - ) - - ! Loop through patches - ! start patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - respfact_leaf = 1.0_r8 - respfact_froot = 1.0_r8 - respfact_livecroot = 1.0_r8 - respfact_livestem = 1.0_r8 - respfact_livecroot = 1.0_r8 - respfact_livestem = 1.0_r8 - respfact_leaf_storage = 1.0_r8 - respfact_froot_storage = 1.0_r8 - respfact_livecroot_storage = 1.0_r8 - respfact_livestem_storage = 1.0_r8 - respfact_livecroot_storage = 1.0_r8 - respfact_livestem_storage = 1.0_r8 - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) * respfact_livestem - - cpool_livestem_storage_gr(p) = cpool_to_livestemc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) * & - respfact_livestem_storage - - transfer_livestem_gr(p) = livestemc_xfer_to_livestemc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) * & - respfact_livestem_storage - - cpool_grain_gr(p) = cpool_to_grainc(p) * grperc(ivt(p)) - - cpool_grain_storage_gr(p) = cpool_to_grainc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) - - transfer_grain_gr(p) = grainc_xfer_to_grainc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - end if - - ! leaf and fine root growth respiration - cpool_leaf_gr(p) = cpool_to_leafc(p) * grperc(ivt(p)) * respfact_leaf - - cpool_leaf_storage_gr(p) = cpool_to_leafc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) * respfact_leaf_storage - - transfer_leaf_gr(p) = leafc_xfer_to_leafc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) * respfact_leaf_storage - - cpool_froot_gr(p) = cpool_to_frootc(p) * grperc(ivt(p)) * respfact_froot * respfact_froot - - cpool_froot_storage_gr(p) = cpool_to_frootc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) * respfact_froot_storage - - transfer_froot_gr(p) = frootc_xfer_to_frootc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) * respfact_froot_storage - - if (woody(ivt(p)) == 1._r8) then - cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) * respfact_livestem - - cpool_livestem_storage_gr(p) = cpool_to_livestemc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) * & -respfact_livestem_storage - - transfer_livestem_gr(p) = livestemc_xfer_to_livestemc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) * & -respfact_livestem_storage - - cpool_deadstem_gr(p) = cpool_to_deadstemc(p) * grperc(ivt(p)) - - cpool_deadstem_storage_gr(p) = cpool_to_deadstemc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) - - transfer_deadstem_gr(p) = deadstemc_xfer_to_deadstemc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - - cpool_livecroot_gr(p) = cpool_to_livecrootc(p) * grperc(ivt(p)) * respfact_livecroot - - cpool_livecroot_storage_gr(p) = cpool_to_livecrootc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) * & -respfact_livecroot_storage - - transfer_livecroot_gr(p) = livecrootc_xfer_to_livecrootc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) * & -respfact_livecroot_storage - - cpool_deadcroot_gr(p) = cpool_to_deadcrootc(p) * grperc(ivt(p)) - - cpool_deadcroot_storage_gr(p) = cpool_to_deadcrootc_storage(p) * grperc(ivt(p)) * grpnow(ivt(p)) - - transfer_deadcroot_gr(p) = deadcrootc_xfer_to_deadcrootc(p) * grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - end if - - end do - - end associate - - end subroutine CNGResp - -end module CNGRespMod diff --git a/src/biogeochem/CNGapMortalityMod.F90 b/src/biogeochem/CNGapMortalityMod.F90 deleted file mode 100644 index 939d4b52eb..0000000000 --- a/src/biogeochem/CNGapMortalityMod.F90 +++ /dev/null @@ -1,493 +0,0 @@ -module CNGapMortalityMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines used in gap mortality for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use pftconMod , only : pftcon - use CNDVType , only : dgvs_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CanopyStateType , only : canopystate_type - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: CNGapMortality - - type, private :: params_type - real(r8):: am ! mortality rate based on annual rate, fractional mortality (1/yr) - real(r8):: k_mort ! coeff. of growth efficiency in mortality equation - end type params_type - ! - type(params_type), private :: params_inst - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: CNGap_PatchToColumn - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read in parameters - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNGapMortParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='r_mort' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%am=tempr - - tString='k_mort' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_mort=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine CNGapMortality (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - dgvs_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, canopystate_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch) - ! - ! !DESCRIPTION: - ! Gap-phase mortality routine for coupled carbon-nitrogen code (CN) - ! - ! !USES: - use clm_time_manager , only: get_days_per_year - use clm_varpar , only: nlevdecomp_full - use clm_varcon , only: secspday - use clm_varctl , only: use_cndv, spinup_state - use pftconMod , only: npcropmin - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(canopystate_type) , intent(in) :: canopystate_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - integer :: fp ! patch filter index - real(r8):: am ! rate for fractional mortality (1/yr) - real(r8):: m ! rate for fractional mortality (1/s) - real(r8):: mort_max ! asymptotic max mortality rate (/yr) - real(r8):: k_mort = 0.3 ! coeff of growth efficiency in mortality equation - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(croot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(stem_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform - - greffic => dgvs_inst%greffic_patch , & ! Input: [real(r8) (:) ] - heatstress => dgvs_inst%heatstress_patch , & ! Input: [real(r8) (:) ] - - leafcn => pftcon%leafcn , & ! Input: [real(r8) (:)] leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: [real(r8) (:)] fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: [real(r8) (:)] live wood (phloem and ray parenchyma) C:N (gC/gN) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - - nind => dgvs_inst%nind_patch & ! Output: [real(r8) (:) ] number of individuals (#/m2) added by F. Li and S. Levis - ) - - ! set the mortality rate based on annual rate - am = params_inst%am - ! set coeff of growth efficiency in mortality equation - k_mort = params_inst%k_mort - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - if (use_cndv) then - ! Stress mortality from lpj's subr Mortality. - - if (woody(ivt(p)) == 1._r8) then - - if (ivt(p) == 8) then - mort_max = 0.03_r8 ! BDT boreal - else - mort_max = 0.01_r8 ! original value for all patches - end if - - ! heatstress and greffic calculated in Establishment once/yr - - ! Mortality rate inversely related to growth efficiency - ! (Prentice et al 1993) - am = mort_max / (1._r8 + k_mort * greffic(p)) - - ! Mortality rate inversely related to growth efficiency - ! (Prentice et al 1993) - am = mort_max / (1._r8 + k_mort * greffic(p)) - - am = min(1._r8, am + heatstress(p)) - else ! lpj didn't set this for grasses; cn does - ! set the mortality rate based on annual rate - am = params_inst%am - end if - - end if - - m = am/(get_days_per_year() * secspday) - - !------------------------------------------------------ - ! patch-level gap mortality carbon fluxes - !------------------------------------------------------ - - ! displayed pools - cnveg_carbonflux_inst%m_leafc_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_patch(p) * m - cnveg_carbonflux_inst%m_frootc_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_patch(p) * m - cnveg_carbonflux_inst%m_livestemc_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_patch(p) * m - cnveg_carbonflux_inst%m_livecrootc_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_patch(p) * m - if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m * 10._r8 - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m * 10._r8 - else - cnveg_carbonflux_inst%m_deadstemc_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_patch(p) * m - end if - - ! storage pools - cnveg_carbonflux_inst%m_leafc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_storage_patch(p) * m - cnveg_carbonflux_inst%m_frootc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_storage_patch(p) * m - cnveg_carbonflux_inst%m_livestemc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_storage_patch(p) * m - cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_storage_patch(p) * m - cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_storage_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_storage_patch(p) * m - cnveg_carbonflux_inst%m_gresp_storage_to_litter_patch(p) = cnveg_carbonstate_inst%gresp_storage_patch(p) * m - - ! transfer pools - cnveg_carbonflux_inst%m_leafc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%leafc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_frootc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%frootc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%livestemc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%deadstemc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%livecrootc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%deadcrootc_xfer_patch(p) * m - cnveg_carbonflux_inst%m_gresp_xfer_to_litter_patch(p) = cnveg_carbonstate_inst%gresp_xfer_patch(p) * m - - !------------------------------------------------------ - ! patch-level gap mortality nitrogen fluxes - !------------------------------------------------------ - - ! displayed pools - cnveg_nitrogenflux_inst%m_leafn_to_litter_patch(p) = cnveg_nitrogenstate_inst%leafn_patch(p) * m - cnveg_nitrogenflux_inst%m_frootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%frootn_patch(p) * m - cnveg_nitrogenflux_inst%m_livestemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%livestemn_patch(p) * m - cnveg_nitrogenflux_inst%m_livecrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_patch(p) * m - - if (spinup_state == 2 .and. .not. use_cndv) then !accelerate mortality of dead woody pools - cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m * 10._r8 - cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m * 10._r8 - else - cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_patch(p) * m - cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_patch(p) * m - end if - - if (ivt(p) < npcropmin) then - cnveg_nitrogenflux_inst%m_retransn_to_litter_patch(p) = cnveg_nitrogenstate_inst%retransn_patch(p) * m - end if - - ! storage pools - cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%leafn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%frootn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%livestemn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) * m - cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_storage_patch(p) * m - - ! transfer pools - cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%leafn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%frootn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%livestemn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadstemn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%livecrootn_xfer_patch(p) * m - cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_patch(p) = cnveg_nitrogenstate_inst%deadcrootn_xfer_patch(p) * m - - ! added by F. Li and S. Levis - if (use_cndv) then - if (woody(ivt(p)) == 1._r8)then - if (cnveg_carbonstate_inst%livestemc_patch(p) + cnveg_carbonstate_inst%deadstemc_patch(p)> 0._r8)then - nind(p)=nind(p)*(1._r8-m) - else - nind(p) = 0._r8 - end if - end if - end if - - end do ! end of patch loop - - ! gather all patch-level litterfall fluxes to the column - ! for litter C and N inputs - - call CNGap_PatchToColumn(bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full), & - froot_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full), & - croot_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full), & - stem_prof_patch(bounds%begp:bounds%endp, 1:nlevdecomp_full)) - - end associate - - end subroutine CNGapMortality - - !----------------------------------------------------------------------- - subroutine CNGap_PatchToColumn (bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch, croot_prof_patch, stem_prof_patch) - ! - ! !DESCRIPTION: - ! gathers all patch-level gap mortality fluxes to the column level and - ! assigns them to the three litter pools - ! - ! !USES: - use clm_varpar , only : maxpatch_pft, nlevdecomp, nlevdecomp_full - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! soil column filter - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: croot_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: stem_prof_patch(bounds%begp:,1:) - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(croot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(stem_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - - associate( & - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] patch weight relative to column (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: [real(r8) (:) ] leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: [real(r8) (:) ] leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: [real(r8) (:) ] leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: [real(r8) (:) ] fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: [real(r8) (:) ] fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: [real(r8) (:) ] fine root litter lignin fraction - - m_leafc_to_litter => cnveg_carbonflux_inst%m_leafc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_to_litter => cnveg_carbonflux_inst%m_frootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_to_litter => cnveg_carbonflux_inst%m_livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_to_litter => cnveg_carbonflux_inst%m_deadstemc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_to_litter => cnveg_carbonflux_inst%m_livecrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_to_litter => cnveg_carbonflux_inst%m_deadcrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafc_storage_to_litter => cnveg_carbonflux_inst%m_leafc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_storage_to_litter => cnveg_carbonflux_inst%m_frootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_storage_to_litter => cnveg_carbonflux_inst%m_livestemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_storage_to_litter => cnveg_carbonflux_inst%m_deadstemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_storage_to_litter => cnveg_carbonflux_inst%m_livecrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_storage_to_litter => cnveg_carbonflux_inst%m_deadcrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_gresp_storage_to_litter => cnveg_carbonflux_inst%m_gresp_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafc_xfer_to_litter => cnveg_carbonflux_inst%m_leafc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootc_xfer_to_litter => cnveg_carbonflux_inst%m_frootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemc_xfer_to_litter => cnveg_carbonflux_inst%m_livestemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemc_xfer_to_litter => cnveg_carbonflux_inst%m_deadstemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootc_xfer_to_litter => cnveg_carbonflux_inst%m_livecrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootc_xfer_to_litter => cnveg_carbonflux_inst%m_deadcrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_gresp_xfer_to_litter => cnveg_carbonflux_inst%m_gresp_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - gap_mortality_c_to_litr_met_c => cnveg_carbonflux_inst%gap_mortality_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter metabolic pool (gC/m3/s) - gap_mortality_c_to_litr_cel_c => cnveg_carbonflux_inst%gap_mortality_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter cellulose pool (gC/m3/s) - gap_mortality_c_to_litr_lig_c => cnveg_carbonflux_inst%gap_mortality_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to litter lignin pool (gC/m3/s) - gap_mortality_c_to_cwdc => cnveg_carbonflux_inst%gap_mortality_c_to_cwdc_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with gap mortality to CWD pool (gC/m3/s) - - m_leafn_to_litter => cnveg_nitrogenflux_inst%m_leafn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootn_to_litter => cnveg_nitrogenflux_inst%m_frootn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemn_to_litter => cnveg_nitrogenflux_inst%m_livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemn_to_litter => cnveg_nitrogenflux_inst%m_deadstemn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootn_to_litter => cnveg_nitrogenflux_inst%m_livecrootn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootn_to_litter => cnveg_nitrogenflux_inst%m_deadcrootn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_retransn_to_litter => cnveg_nitrogenflux_inst%m_retransn_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafn_storage_to_litter => cnveg_nitrogenflux_inst%m_leafn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootn_storage_to_litter => cnveg_nitrogenflux_inst%m_frootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemn_storage_to_litter => cnveg_nitrogenflux_inst%m_livestemn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemn_storage_to_litter => cnveg_nitrogenflux_inst%m_deadstemn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootn_storage_to_litter => cnveg_nitrogenflux_inst%m_livecrootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootn_storage_to_litter => cnveg_nitrogenflux_inst%m_deadcrootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - m_leafn_xfer_to_litter => cnveg_nitrogenflux_inst%m_leafn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_frootn_xfer_to_litter => cnveg_nitrogenflux_inst%m_frootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livestemn_xfer_to_litter => cnveg_nitrogenflux_inst%m_livestemn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadstemn_xfer_to_litter => cnveg_nitrogenflux_inst%m_deadstemn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_livecrootn_xfer_to_litter => cnveg_nitrogenflux_inst%m_livecrootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - m_deadcrootn_xfer_to_litter => cnveg_nitrogenflux_inst%m_deadcrootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - gap_mortality_n_to_litr_met_n => cnveg_nitrogenflux_inst%gap_mortality_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to litter metabolic pool (gN/m3/s) - gap_mortality_n_to_litr_cel_n => cnveg_nitrogenflux_inst%gap_mortality_n_to_litr_cel_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to litter cellulose pool (gN/m3/s) - gap_mortality_n_to_litr_lig_n => cnveg_nitrogenflux_inst%gap_mortality_n_to_litr_lig_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to litter lignin pool (gN/m3/s) - gap_mortality_n_to_cwdn => cnveg_nitrogenflux_inst%gap_mortality_n_to_cwdn_col & ! Output: [real(r8) (:,:) ] N fluxes associated with gap mortality to CWD pool (gN/m3/s) - ) - - do j = 1,nlevdecomp - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - - ! leaf gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_cel_c(c,j) = gap_mortality_c_to_litr_cel_c(c,j) + & - m_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_lig_c(c,j) = gap_mortality_c_to_litr_lig_c(c,j) + & - m_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_cel_c(c,j) = gap_mortality_c_to_litr_cel_c(c,j) + & - m_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_lig_c(c,j) = gap_mortality_c_to_litr_lig_c(c,j) + & - m_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood gap mortality carbon fluxes - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - (m_livestemc_to_litter(p) + m_deadstemc_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_cwdc(c,j) = gap_mortality_c_to_cwdc(c,j) + & - (m_livecrootc_to_litter(p) + m_deadcrootc_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! storage gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_leafc_storage_to_litter(p) + m_gresp_storage_to_litter(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livestemc_storage_to_litter(p) + m_deadstemc_storage_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livecrootc_storage_to_litter(p) + m_deadcrootc_storage_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! transfer gap mortality carbon fluxes - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_leafc_xfer_to_litter(p) + m_gresp_xfer_to_litter(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - m_frootc_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livestemc_xfer_to_litter(p) + m_deadstemc_xfer_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_c_to_litr_met_c(c,j) = gap_mortality_c_to_litr_met_c(c,j) + & - (m_livecrootc_xfer_to_litter(p) + m_deadcrootc_xfer_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! leaf gap mortality nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_cel_n(c,j) = gap_mortality_n_to_litr_cel_n(c,j) + & - m_leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_lig_n(c,j) = gap_mortality_n_to_litr_lig_n(c,j) + & - m_leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root litter nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_cel_n(c,j) = gap_mortality_n_to_litr_cel_n(c,j) + & - m_frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_lig_n(c,j) = gap_mortality_n_to_litr_lig_n(c,j) + & - m_frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood gap mortality nitrogen fluxes - gap_mortality_n_to_cwdn(c,j) = gap_mortality_n_to_cwdn(c,j) + & - (m_livestemn_to_litter(p) + m_deadstemn_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_n_to_cwdn(c,j) = gap_mortality_n_to_cwdn(c,j) + & - (m_livecrootn_to_litter(p) + m_deadcrootn_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! retranslocated N pool gap mortality fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_retransn_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! storage gap mortality nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_leafn_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_frootn_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livestemn_storage_to_litter(p) + m_deadstemn_storage_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livecrootn_storage_to_litter(p) + m_deadcrootn_storage_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - ! transfer gap mortality nitrogen fluxes - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_leafn_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - m_frootn_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livestemn_xfer_to_litter(p) + m_deadstemn_xfer_to_litter(p)) * wtcol(p) * stem_prof(p,j) - gap_mortality_n_to_litr_met_n(c,j) = gap_mortality_n_to_litr_met_n(c,j) + & - (m_livecrootn_xfer_to_litter(p) + m_deadcrootn_xfer_to_litter(p)) * wtcol(p) * croot_prof(p,j) - - - end if - end if - - end do - end do - end do - - end associate - - end subroutine CNGap_PatchToColumn - -end module CNGapMortalityMod diff --git a/src/biogeochem/CNMRespMod.F90 b/src/biogeochem/CNMRespMod.F90 deleted file mode 100644 index 3a7052d0bb..0000000000 --- a/src/biogeochem/CNMRespMod.F90 +++ /dev/null @@ -1,298 +0,0 @@ -module CNMRespMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding maintenance respiration routines for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevgrnd - use clm_varcon , only : spval - use decompMod , only : bounds_type - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use pftconMod , only : npcropmin, pftcon - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use PhotosynthesisMod , only : photosyns_type - use CNVegcarbonfluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNSharedParamsMod , only : CNParamsShareInst - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNMRespReadNML ! Read in namelist (CALL FIRST!) - public :: readParams ! Read in parameters from file - public :: CNMResp ! Apply maintenance respiration - - type, private :: params_type - real(r8) :: br = spval ! base rate for maintenance respiration (gC/gN/s) - real(r8) :: br_root = spval ! base rate for maintenance respiration for roots (gC/gN/s) - end type params_type - - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNMRespReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CNMResp (MUST BE CALLED BEFORE readParams!!!) - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNMRespReadNML' - character(len=*), parameter :: nmlname = 'cnmresp_inparm' - real(r8) :: br_root = spval ! base rate for maintenance respiration for roots (gC/gN/s) - !----------------------------------------------------------------------- - - namelist /cnmresp_inparm/ br_root - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnmresp_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (br_root, mpicom) - - params_inst%br_root = br_root - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnmresp_inparm) - write(iulog,*) ' ' - end if - - end subroutine CNMRespReadNML - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read parameters (call AFTER CNMRespReadNML!) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNMRespParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='br_mr' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%br=tempr - - if ( params_inst%br_root == spval ) then - params_inst%br_root = params_inst%br - end if - - end subroutine readParams - - !----------------------------------------------------------------------- - ! FIX(SPM,032414) this shouldn't even be called with fates on. - ! - subroutine CNMResp(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - canopystate_inst, soilstate_inst, temperature_inst, photosyns_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! - ! !ARGUMENTS: - use clm_varcon , only : tfrz - - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil points in column filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - integer , intent(in) :: num_soilp ! number of soil points in patch filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j ! indices - integer :: fp ! soil filter patch index - integer :: fc ! soil filter column index - real(r8):: br ! base rate (gC/gN/s) - real(r8):: br_root ! root base rate (gC/gN/s) - real(r8):: q10 ! temperature dependence - - real(r8):: tc ! temperature correction, 2m air temp (unitless) - real(r8):: tcsoi(bounds%begc:bounds%endc,nlevgrnd) ! temperature correction by soil layer (unitless) - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - - crootfr => soilstate_inst%crootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots for carbon in each soil layer (nlevgrnd) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) - - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - - lmrsun => photosyns_inst%lmrsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf maintenance respiration rate (umol CO2/m**2/s) - lmrsha => photosyns_inst%lmrsha_patch , & ! Input: [real(r8) (:) ] shaded leaf maintenance respiration rate (umol CO2/m**2/s) - rootstem_acc => photosyns_inst%rootstem_acc , & ! Input: [logical ] root and stem acclimation switch - - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - grainn => cnveg_nitrogenstate_inst%grainn_patch , & ! Input: [real(r8) (:) ] (kgN/m2) grain N - - leaf_mr => cnveg_carbonflux_inst%leaf_mr_patch , & ! Output: [real(r8) (:) ] - froot_mr => cnveg_carbonflux_inst%froot_mr_patch , & ! Output: [real(r8) (:) ] - livestem_mr => cnveg_carbonflux_inst%livestem_mr_patch , & ! Output: [real(r8) (:) ] - livecroot_mr => cnveg_carbonflux_inst%livecroot_mr_patch , & ! Output: [real(r8) (:) ] - grain_mr => cnveg_carbonflux_inst%grain_mr_patch & ! Output: [real(r8) (:) ] - - ) - - ! base rate for maintenance respiration is from: - ! M. Ryan, 1991. Effects of climate change on plant respiration. - ! Ecological Applications, 1(2), 157-167. - ! Original expression is br = 0.0106 molC/(molN h) - ! Conversion by molecular weights of C and N gives 2.525e-6 gC/(gN s) - ! set constants - br = params_inst%br - br_root = params_inst%br_root - - ! Peter Thornton: 3/13/09 - ! Q10 was originally set to 2.0, an arbitrary choice, but reduced to 1.5 as part of the tuning - ! to improve seasonal cycle of atmospheric CO2 concentration in global - ! simulatoins - Q10 = CNParamsShareInst%Q10 - - ! column loop to calculate temperature factors in each soil layer - do j=1,nlevgrnd - do fc = 1, num_soilc - c = filter_soilc(fc) - - ! calculate temperature corrections for each soil layer, for use in - ! estimating fine root maintenance respiration with depth - tcsoi(c,j) = Q10**((t_soisno(c,j)-SHR_CONST_TKFRZ - 20.0_r8)/10.0_r8) - end do - end do - - ! patch loop for leaves and live wood - do fp = 1, num_soilp - p = filter_soilp(fp) - - ! calculate maintenance respiration fluxes in - ! gC/m2/s for each of the live plant tissues. - ! Leaf and live wood MR - - tc = Q10**((t_ref2m(p)-SHR_CONST_TKFRZ - 20.0_r8)/10.0_r8) - - !RF: acclimation of root and stem respiration fluxes - ! n.b. we do not yet know if this is defensible scientifically (awaiting data analysis) - ! turning this on will increase R and decrease productivity in boreal forests, A LOT. :) - - if(rootstem_acc)then - br = br * 10._r8**(-0.00794_r8*((t10(p)-tfrz)-25._r8)) - br_root = br_root * 10._r8**(-0.00794_r8*((t10(p)-tfrz)-25._r8)) - end if - - if (frac_veg_nosno(p) == 1) then - - leaf_mr(p) = lmrsun(p) * laisun(p) * 12.011e-6_r8 + & - lmrsha(p) * laisha(p) * 12.011e-6_r8 - - else !nosno - - leaf_mr(p) = 0._r8 - - end if - - if (woody(ivt(p)) == 1) then - livestem_mr(p) = livestemn(p)*br*tc - livecroot_mr(p) = livecrootn(p)*br_root*tc - else if (ivt(p) >= npcropmin) then - livestem_mr(p) = livestemn(p)*br*tc - grain_mr(p) = grainn(p)*br*tc - end if - end do - - ! soil and patch loop for fine root - - do j = 1,nlevgrnd - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! Fine root MR - ! crootfr(j) sums to 1.0 over all soil layers, and - ! describes the fraction of root mass for carbon that is in each - ! layer. This is used with the layer temperature correction - ! to estimate the total fine root maintenance respiration as a - ! function of temperature and N content. - if(rootstem_acc)then - br_root = br_root * 10._r8**(-0.00794_r8*((t10(p)-tfrz)-25._r8)) - end if - froot_mr(p) = froot_mr(p) + frootn(p)*br_root*tcsoi(c,j)*crootfr(p,j) - - end do - end do - - end associate - - end subroutine CNMResp - -end module CNMRespMod diff --git a/src/biogeochem/CNNDynamicsMod.F90 b/src/biogeochem/CNNDynamicsMod.F90 deleted file mode 100644 index b8796912a2..0000000000 --- a/src/biogeochem/CNNDynamicsMod.F90 +++ /dev/null @@ -1,441 +0,0 @@ -module CNNDynamicsMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for mineral nitrogen dynamics (deposition, fixation, leaching) - ! for coupled carbon-nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varcon , only : dzsoi_decomp, zisoi - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, nfix_timeconst - use subgridAveMod , only : p2c - use atm2lndType , only : atm2lnd_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use CropType , only : crop_type - use ColumnType , only : col - use PatchType , only : patch - use perf_mod , only : t_startf, t_stopf - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNNDynamicsReadNML ! Read in namelist for Mineral Nitrogen Dynamics - public :: CNNDeposition ! Update N deposition rate from atm forcing - public :: CNNFixation ! Update N Fixation rate - public :: CNNFert ! Update N fertilizer for crops - public :: CNSoyfix ! N Fixation for soybeans - public :: CNFreeLivingFixation ! N free living fixation - - ! - ! !PRIVATE DATA MEMBERS: - type, private :: params_type - real(r8) :: freelivfix_intercept ! intercept of line of free living fixation with annual ET - real(r8) :: freelivfix_slope_wET ! slope of line of free living fixation with annual ET - end type params_type - type(params_type) :: params_inst - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNNDynamicsReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for Mineral Nitrogen Dynamics - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNNDynamicsReadNML' - character(len=*), parameter :: nmlname = 'mineral_nitrogen_dynamics' - !----------------------------------------------------------------------- - real(r8) :: freelivfix_intercept ! intercept of line of free living fixation with annual ET - real(r8) :: freelivfix_slope_wET ! slope of line of free living fixation with annual ET - namelist /mineral_nitrogen_dynamics/ freelivfix_slope_wET, freelivfix_intercept - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - - freelivfix_intercept = 0.0117_r8 - freelivfix_slope_wET = 0.0006_r8 - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=mineral_nitrogen_dynamics, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (freelivfix_intercept, mpicom) - call shr_mpi_bcast (freelivfix_slope_wET, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=mineral_nitrogen_dynamics) - write(iulog,*) ' ' - end if - params_inst%freelivfix_intercept = freelivfix_intercept - params_inst%freelivfix_slope_wET = freelivfix_slope_wET - - end subroutine CNNDynamicsReadNML - - !----------------------------------------------------------------------- - subroutine CNNDeposition( bounds, & - atm2lnd_inst, soilbiogeochem_nitrogenflux_inst ) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen deposition rate - ! from atmospheric forcing. For now it is assumed that all the atmospheric - ! N deposition goes to the soil mineral N pool. - ! This could be updated later to divide the inputs between mineral N absorbed - ! directly into the canopy and mineral N entering the soil pool. - ! - ! !USES: - use CNSharedParamsMod , only: use_fun - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: g,c ! indices - !----------------------------------------------------------------------- - - associate( & - forc_ndep => atm2lnd_inst%forc_ndep_grc , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) - ndep_to_sminn => soilbiogeochem_nitrogenflux_inst%ndep_to_sminn_col & ! Output: [real(r8) (:)] atmospheric N deposition to soil mineral N (gN/m2/s) - ) - - ! Loop through columns - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - ndep_to_sminn(c) = forc_ndep(g) - - end do - - end associate - - end subroutine CNNDeposition - - !----------------------------------------------------------------------- - subroutine CNFreeLivingFixation(num_soilc, filter_soilc, & - waterflux_inst, soilbiogeochem_nitrogenflux_inst) - - - use clm_time_manager , only : get_days_per_year, get_step_size - use shr_sys_mod , only : shr_sys_flush - use clm_varcon , only : secspday, spval - - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc !indices - real(r8) :: dayspyr !days per year - real(r8) :: secs_per_year !seconds per year - - associate( & - AnnET => waterflux_inst%AnnET, & ! Input: [real(:) ] : Annual average ET flux mmH20/s - freelivfix_slope => params_inst%freelivfix_slope_wET, & ! Input: [real ] : slope of fixation with ET - freelivfix_inter => params_inst%freelivfix_intercept, & ! Input: [real ] : intercept of fixation with ET - ffix_to_sminn => soilbiogeochem_nitrogenflux_inst%ffix_to_sminn_col & ! Output: [real(:) ] : free living N fixation to soil mineral N (gN/m2/s) - ) - - dayspyr = get_days_per_year() - secs_per_year = dayspyr*24_r8*3600_r8 - - do fc = 1,num_soilc - c = filter_soilc(fc) - ffix_to_sminn(c) = (freelivfix_slope*(max(0._r8,AnnET(c))*secs_per_year) + freelivfix_inter )/secs_per_year !(units g N m-2 s-1) - - end do - - end associate - end subroutine CNFreeLivingFixation - - !----------------------------------------------------------------------- - subroutine CNNFixation(num_soilc, filter_soilc, & - cnveg_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen fixation rate - ! as a function of annual total NPP. This rate gets updated once per year. - ! All N fixation goes to the soil mineral N pool. - ! - ! !USES: - use clm_time_manager , only : get_days_per_year, get_step_size - use shr_sys_mod , only : shr_sys_flush - use clm_varcon , only : secspday, spval - use CNSharedParamsMod , only: use_fun - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc ! indices - real(r8) :: t ! temporary - real(r8) :: dayspyr ! days per year - !----------------------------------------------------------------------- - - associate( & - cannsum_npp => cnveg_carbonflux_inst%annsum_npp_col , & ! Input: [real(r8) (:)] nitrogen deposition rate (gN/m2/s) - col_lag_npp => cnveg_carbonflux_inst%lag_npp_col , & ! Input: [real(r8) (:)] (gC/m2/s) lagged net primary production - - nfix_to_sminn => soilbiogeochem_nitrogenflux_inst%nfix_to_sminn_col & ! Output: [real(r8) (:)] symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - ) - - dayspyr = get_days_per_year() - - if ( nfix_timeconst > 0._r8 .and. nfix_timeconst < 500._r8 ) then - ! use exponential relaxation with time constant nfix_timeconst for NPP - NFIX relation - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (col_lag_npp(c) /= spval) then - ! need to put npp in units of gC/m^2/year here first - t = (1.8_r8 * (1._r8 - exp(-0.003_r8 * col_lag_npp(c)*(secspday * dayspyr))))/(secspday * dayspyr) - nfix_to_sminn(c) = max(0._r8,t) - else - nfix_to_sminn(c) = 0._r8 - endif - end do - else - ! use annual-mean values for NPP-NFIX relation - do fc = 1,num_soilc - c = filter_soilc(fc) - - t = (1.8_r8 * (1._r8 - exp(-0.003_r8 * cannsum_npp(c))))/(secspday * dayspyr) - nfix_to_sminn(c) = max(0._r8,t) - end do - endif - if(use_fun)then - nfix_to_sminn(c) = 0.0_r8 - end if - - end associate - - end subroutine CNNFixation - - !----------------------------------------------------------------------- - subroutine CNNFert(bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen fertilizer for crops - ! All fertilizer goes into the soil mineral N pool. - ! - ! !USES: - ! - ! !ARGUMENTS: - 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 - type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc ! indices - !----------------------------------------------------------------------- - - associate( & - fert => cnveg_nitrogenflux_inst%fert_patch , & ! Input: [real(r8) (:)] nitrogen fertilizer rate (gN/m2/s) - fert_to_sminn => soilbiogeochem_nitrogenflux_inst%fert_to_sminn_col & ! Output: [real(r8) (:)] - ) - - call p2c(bounds, num_soilc, filter_soilc, & - fert(bounds%begp:bounds%endp), & - fert_to_sminn(bounds%begc:bounds%endc)) - - end associate - - end subroutine CNNFert - - !----------------------------------------------------------------------- - subroutine CNSoyfix (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - waterstate_inst, crop_inst, cnveg_state_inst, cnveg_nitrogenflux_inst , & - soilbiogeochem_state_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! This routine handles the fixation of nitrogen for soybeans based on - ! the EPICPHASE model M. Cabelguenne et al., Agricultural systems 60: 175-196, 1999 - ! N-fixation is based on soil moisture, plant growth phase, and availibility of - ! nitrogen in the soil root zone. - ! - ! !USES: - use pftconMod, only : ntmp_soybean, nirrig_tmp_soybean - use pftconMod, only : ntrp_soybean, nirrig_trp_soybean - ! - ! !ARGUMENTS: - 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(waterstate_type) , intent(in) :: waterstate_inst - type(crop_type) , intent(in) :: crop_inst - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,p,c - real(r8):: fxw,fxn,fxg,fxr ! soil water factor, nitrogen factor, growth stage factor - real(r8):: soy_ndemand ! difference between nitrogen supply and demand - real(r8):: GDDfrac - real(r8):: sminnthreshold1, sminnthreshold2 - real(r8):: GDDfracthreshold1, GDDfracthreshold2 - real(r8):: GDDfracthreshold3, GDDfracthreshold4 - !----------------------------------------------------------------------- - - associate( & - wf => waterstate_inst%wf_col , & ! Input: [real(r8) (:) ] soil water as frac. of whc for top 0.5 m - - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] gdd since planting (gddplant) - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] true if planted and not harvested - - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Input: [real(r8) (:) ] gdd needed to harvest - - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Input: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) - soyfixn => cnveg_nitrogenflux_inst%soyfixn_patch , & ! Output: [real(r8) (:) ] nitrogen fixed to each soybean crop - - fpg => soilbiogeochem_state_inst%fpg_col , & ! Input: [real(r8) (:) ] fraction of potential gpp (no units) - - sminn => soilbiogeochem_nitrogenstate_inst%sminn_col , & ! Input: [real(r8) (:) ] (kgN/m2) soil mineral N - soyfixn_to_sminn => soilbiogeochem_nitrogenflux_inst%soyfixn_to_sminn_col & ! Output: [real(r8) (:) ] - ) - - sminnthreshold1 = 30._r8 - sminnthreshold2 = 10._r8 - GDDfracthreshold1 = 0.15_r8 - GDDfracthreshold2 = 0.30_r8 - GDDfracthreshold3 = 0.55_r8 - GDDfracthreshold4 = 0.75_r8 - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! if soybean currently growing then calculate fixation - - if (croplive(p) .and. & - (patch%itype(p) == ntmp_soybean .or. & - patch%itype(p) == nirrig_tmp_soybean .or. & - patch%itype(p) == ntrp_soybean .or. & - patch%itype(p) == nirrig_trp_soybean) ) then - - ! difference between supply and demand - - if (fpg(c) < 1._r8) then - soy_ndemand = 0._r8 - soy_ndemand = plant_ndemand(p) - plant_ndemand(p)*fpg(c) - - ! fixation depends on nitrogen, soil water, and growth stage - - ! soil water factor - - fxw = 0._r8 - fxw = wf(c)/0.85_r8 - - ! soil nitrogen factor (Beth says: CHECK UNITS) - - if (sminn(c) > sminnthreshold1) then - fxn = 0._r8 - else if (sminn(c) > sminnthreshold2 .and. sminn(c) <= sminnthreshold1) then - fxn = 1.5_r8 - .005_r8 * (sminn(c) * 10._r8) - else if (sminn(c) <= sminnthreshold2) then - fxn = 1._r8 - end if - - ! growth stage factor - ! slevis: to replace GDDfrac, assume... - ! Beth's crit_offset_gdd_def is similar to my gddmaturity - ! Beth's ac_gdd (base 5C) similar to my hui=gddplant (base 10 - ! for soy) - ! Ranges below are not firm. Are they lit. based or tuning based? - - GDDfrac = hui(p) / gddmaturity(p) - - if (GDDfrac <= GDDfracthreshold1) then - fxg = 0._r8 - else if (GDDfrac > GDDfracthreshold1 .and. GDDfrac <= GDDfracthreshold2) then - fxg = 6.67_r8 * GDDfrac - 1._r8 - else if (GDDfrac > GDDfracthreshold2 .and. GDDfrac <= GDDfracthreshold3) then - fxg = 1._r8 - else if (GDDfrac > GDDfracthreshold3 .and. GDDfrac <= GDDfracthreshold4) then - fxg = 3.75_r8 - 5._r8 * GDDfrac - else ! GDDfrac > GDDfracthreshold4 - fxg = 0._r8 - end if - - ! calculate the nitrogen fixed by the soybean - - fxr = min(1._r8, fxw, fxn) * fxg - fxr = max(0._r8, fxr) - soyfixn(p) = fxr * soy_ndemand - soyfixn(p) = min(soyfixn(p), soy_ndemand) - - else ! if nitrogen demand met, no fixation - - soyfixn(p) = 0._r8 - - end if - - else ! if not live soybean, no fixation - - soyfixn(p) = 0._r8 - - end if - end do - - call p2c(bounds, num_soilc, filter_soilc, & - soyfixn(bounds%begp:bounds%endp), & - soyfixn_to_sminn(bounds%begc:bounds%endc)) - - end associate - - end subroutine CNSoyfix - -end module CNNDynamicsMod diff --git a/src/biogeochem/CNNStateUpdate1Mod.F90 b/src/biogeochem/CNNStateUpdate1Mod.F90 deleted file mode 100644 index 6c1d112029..0000000000 --- a/src/biogeochem/CNNStateUpdate1Mod.F90 +++ /dev/null @@ -1,287 +0,0 @@ -module CNNStateUpdate1Mod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for nitrogen state variable updates, non-mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size, get_step_size_real - use clm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog, use_nitrif_denitrif - use clm_varcon , only : nitrif_n2o_loss_frac - use pftconMod , only : npcropmin, pftcon - use decompMod , only : bounds_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: NStateUpdateDynPatch - public :: NStateUpdate1 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine NStateUpdateDynPatch(bounds, num_soilc_with_inactive, filter_soilc_with_inactive, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Update nitrogen states based on fluxes from dyn_cnbal_patch - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_soilc_with_inactive ! number of columns in soil filter - integer, intent(in) :: filter_soilc_with_inactive(:) ! soil column filter that includes inactive points - type(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c ! column index - integer :: g ! gridcell index - integer :: fc ! column filter index - integer :: j ! level index - real(r8) :: dt ! time step (seconds) - - character(len=*), parameter :: subname = 'NStateUpdateDynPatch' - !----------------------------------------------------------------------- - - associate( & - nf_veg => cnveg_nitrogenflux_inst , & - ns_veg => cnveg_nitrogenstate_inst , & - ns_soil => soilbiogeochem_nitrogenstate_inst & - ) - - dt = get_step_size_real() - - do j = 1, nlevdecomp - do fc = 1, num_soilc_with_inactive - c = filter_soilc_with_inactive(fc) - ns_soil%decomp_npools_vr_col(c,j,i_met_lit) = ns_soil%decomp_npools_vr_col(c,j,i_met_lit) + & - nf_veg%dwt_frootn_to_litr_met_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) = ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) + & - nf_veg%dwt_frootn_to_litr_cel_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) = ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) + & - nf_veg%dwt_frootn_to_litr_lig_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_cwd) = ns_soil%decomp_npools_vr_col(c,j,i_cwd) + & - ( nf_veg%dwt_livecrootn_to_cwdn_col(c,j) + nf_veg%dwt_deadcrootn_to_cwdn_col(c,j) ) * dt - end do - end do - - do g = bounds%begg, bounds%endg - ns_veg%seedn_grc(g) = ns_veg%seedn_grc(g) - nf_veg%dwt_seedn_to_leaf_grc(g) * dt - ns_veg%seedn_grc(g) = ns_veg%seedn_grc(g) - nf_veg%dwt_seedn_to_deadstem_grc(g) * dt - end do - - end associate - - end subroutine NStateUpdateDynPatch - - !----------------------------------------------------------------------- - subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic nitrogen state - ! variables (except for gap-phase mortality and fire fluxes) - ! - ! !ARGUMENTS: - 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(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,l,g,k ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - nf_veg => cnveg_nitrogenflux_inst , & ! Input: - ns_veg => cnveg_nitrogenstate_inst , & ! Output: - nf_soil => soilbiogeochem_nitrogenflux_inst & ! Output: - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - - ! soilbiogeochemistry fluxes TODO - this should be moved elsewhere - ! plant to litter fluxes - phenology and dynamic landcover fluxes - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - nf_soil%decomp_npools_sourcesink_col(c,j,i_met_lit) = & - nf_veg%phenology_n_to_litr_met_n_col(c,j) * dt - - nf_soil%decomp_npools_sourcesink_col(c,j,i_cel_lit) = & - nf_veg%phenology_n_to_litr_cel_n_col(c,j) * dt - - nf_soil%decomp_npools_sourcesink_col(c,j,i_lig_lit) = & - nf_veg%phenology_n_to_litr_lig_n_col(c,j) * dt - - ! NOTE(wjs, 2017-01-02) This used to be set to a non-zero value, but the - ! terms have been moved to CStateUpdateDynPatch. I think this is zeroed every - ! time step, but to be safe, I'm explicitly setting it to zero here. - nf_soil%decomp_npools_sourcesink_col(c,j,i_cwd) = 0._r8 - - end do - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! phenology: transfer growth fluxes - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) + nf_veg%leafn_xfer_to_leafn_patch(p)*dt - ns_veg%leafn_xfer_patch(p) = ns_veg%leafn_xfer_patch(p) - nf_veg%leafn_xfer_to_leafn_patch(p)*dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) + nf_veg%frootn_xfer_to_frootn_patch(p)*dt - ns_veg%frootn_xfer_patch(p) = ns_veg%frootn_xfer_patch(p) - nf_veg%frootn_xfer_to_frootn_patch(p)*dt - - if (woody(ivt(p)) == 1.0_r8) then - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) + nf_veg%livestemn_xfer_to_livestemn_patch(p)*dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) - nf_veg%livestemn_xfer_to_livestemn_patch(p)*dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) + nf_veg%deadstemn_xfer_to_deadstemn_patch(p)*dt - ns_veg%deadstemn_xfer_patch(p) = ns_veg%deadstemn_xfer_patch(p) - nf_veg%deadstemn_xfer_to_deadstemn_patch(p)*dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) + nf_veg%livecrootn_xfer_to_livecrootn_patch(p)*dt - ns_veg%livecrootn_xfer_patch(p) = ns_veg%livecrootn_xfer_patch(p) - nf_veg%livecrootn_xfer_to_livecrootn_patch(p)*dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) + nf_veg%deadcrootn_xfer_to_deadcrootn_patch(p)*dt - ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) - nf_veg%deadcrootn_xfer_to_deadcrootn_patch(p)*dt - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) + nf_veg%livestemn_xfer_to_livestemn_patch(p)*dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) - nf_veg%livestemn_xfer_to_livestemn_patch(p)*dt - ns_veg%grainn_patch(p) = ns_veg%grainn_patch(p) + nf_veg%grainn_xfer_to_grainn_patch(p)*dt - ns_veg%grainn_xfer_patch(p) = ns_veg%grainn_xfer_patch(p) - nf_veg%grainn_xfer_to_grainn_patch(p)*dt - end if - - ! phenology: litterfall and retranslocation fluxes - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_litter_patch(p)*dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_litter_patch(p)*dt - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - nf_veg%leafn_to_retransn_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%leafn_to_retransn_patch(p)*dt - - ! live wood turnover and retranslocation fluxes - if (woody(ivt(p)) == 1._r8) then - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_deadstemn_patch(p)*dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) + nf_veg%livestemn_to_deadstemn_patch(p)*dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_retransn_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%livestemn_to_retransn_patch(p)*dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) - nf_veg%livecrootn_to_deadcrootn_patch(p)*dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) + nf_veg%livecrootn_to_deadcrootn_patch(p)*dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) - nf_veg%livecrootn_to_retransn_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%livecrootn_to_retransn_patch(p)*dt - end if - if (ivt(p) >= npcropmin) then ! Beth adds retrans from froot - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - nf_veg%frootn_to_retransn_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%frootn_to_retransn_patch(p)*dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_litter_patch(p)*dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - nf_veg%livestemn_to_retransn_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) + nf_veg%livestemn_to_retransn_patch(p)*dt - ns_veg%grainn_patch(p) = ns_veg%grainn_patch(p) & - - (nf_veg%grainn_to_food_patch(p) + nf_veg%grainn_to_seed_patch(p))*dt - ns_veg%cropseedn_deficit_patch(p) = ns_veg%cropseedn_deficit_patch(p) & - - nf_veg%crop_seedn_to_leaf_patch(p) * dt & - + nf_veg%grainn_to_seed_patch(p) * dt - end if - - ! uptake from soil mineral N pool - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) + nf_veg%sminn_to_npool_patch(p)*dt - - ! deployment from retranslocation pool - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) + nf_veg%retransn_to_npool_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) - nf_veg%retransn_to_npool_patch(p)*dt - - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) + nf_veg%free_retransn_to_npool_patch(p)*dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) - nf_veg%free_retransn_to_npool_patch(p)*dt !how is retransn a state? - - ! allocation fluxes - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_leafn_patch(p)*dt - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) + nf_veg%npool_to_leafn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_leafn_storage_patch(p)*dt - ns_veg%leafn_storage_patch(p) = ns_veg%leafn_storage_patch(p) + nf_veg%npool_to_leafn_storage_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_frootn_patch(p)*dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) + nf_veg%npool_to_frootn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_frootn_storage_patch(p)*dt - ns_veg%frootn_storage_patch(p) = ns_veg%frootn_storage_patch(p) + nf_veg%npool_to_frootn_storage_patch(p)*dt - - if (woody(ivt(p)) == 1._r8) then - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livestemn_patch(p)*dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) + nf_veg%npool_to_livestemn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livestemn_storage_patch(p)*dt - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) + nf_veg%npool_to_livestemn_storage_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_deadstemn_patch(p)*dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) + nf_veg%npool_to_deadstemn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_deadstemn_storage_patch(p)*dt - ns_veg%deadstemn_storage_patch(p) = ns_veg%deadstemn_storage_patch(p) + nf_veg%npool_to_deadstemn_storage_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livecrootn_patch(p)*dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) + nf_veg%npool_to_livecrootn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livecrootn_storage_patch(p)*dt - ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) + nf_veg%npool_to_livecrootn_storage_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_deadcrootn_patch(p)*dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) + nf_veg%npool_to_deadcrootn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_deadcrootn_storage_patch(p)*dt - ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) + nf_veg%npool_to_deadcrootn_storage_patch(p)*dt - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livestemn_patch(p)*dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) + nf_veg%npool_to_livestemn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_livestemn_storage_patch(p)*dt - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) + nf_veg%npool_to_livestemn_storage_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_grainn_patch(p)*dt - ns_veg%grainn_patch(p) = ns_veg%grainn_patch(p) + nf_veg%npool_to_grainn_patch(p)*dt - ns_veg%npool_patch(p) = ns_veg%npool_patch(p) - nf_veg%npool_to_grainn_storage_patch(p)*dt - ns_veg%grainn_storage_patch(p) = ns_veg%grainn_storage_patch(p) + nf_veg%npool_to_grainn_storage_patch(p)*dt - end if - - ! move storage pools into transfer pools - ns_veg%leafn_storage_patch(p) = ns_veg%leafn_storage_patch(p) - nf_veg%leafn_storage_to_xfer_patch(p)*dt - ns_veg%leafn_xfer_patch(p) = ns_veg%leafn_xfer_patch(p) + nf_veg%leafn_storage_to_xfer_patch(p)*dt - ns_veg%frootn_storage_patch(p) = ns_veg%frootn_storage_patch(p) - nf_veg%frootn_storage_to_xfer_patch(p)*dt - ns_veg%frootn_xfer_patch(p) = ns_veg%frootn_xfer_patch(p) + nf_veg%frootn_storage_to_xfer_patch(p)*dt - - if (woody(ivt(p)) == 1._r8) then - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) - nf_veg%livestemn_storage_to_xfer_patch(p)*dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) + nf_veg%livestemn_storage_to_xfer_patch(p)*dt - ns_veg%deadstemn_storage_patch(p) = ns_veg%deadstemn_storage_patch(p) - nf_veg%deadstemn_storage_to_xfer_patch(p)*dt - ns_veg%deadstemn_xfer_patch(p) = ns_veg%deadstemn_xfer_patch(p) + nf_veg%deadstemn_storage_to_xfer_patch(p)*dt - ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) - nf_veg%livecrootn_storage_to_xfer_patch(p)*dt - ns_veg%livecrootn_xfer_patch(p) = ns_veg%livecrootn_xfer_patch(p) + nf_veg%livecrootn_storage_to_xfer_patch(p)*dt - ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) - nf_veg%deadcrootn_storage_to_xfer_patch(p)*dt - ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) + nf_veg%deadcrootn_storage_to_xfer_patch(p)*dt - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) - nf_veg%livestemn_storage_to_xfer_patch(p)*dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) + nf_veg%livestemn_storage_to_xfer_patch(p)*dt - ns_veg%grainn_storage_patch(p) = ns_veg%grainn_storage_patch(p) - nf_veg%grainn_storage_to_xfer_patch(p)*dt - ns_veg%grainn_xfer_patch(p) = ns_veg%grainn_xfer_patch(p) + nf_veg%grainn_storage_to_xfer_patch(p)*dt - end if - - end do - - end associate - - end subroutine NStateUpdate1 - -end module CNNStateUpdate1Mod diff --git a/src/biogeochem/CNNStateUpdate2Mod.F90 b/src/biogeochem/CNNStateUpdate2Mod.F90 deleted file mode 100644 index 24070f6890..0000000000 --- a/src/biogeochem/CNNStateUpdate2Mod.F90 +++ /dev/null @@ -1,238 +0,0 @@ -module CNNStateUpdate2Mod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for nitrogen state variable update, mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi, nlevdecomp - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: NStateUpdate2 - public:: NStateUpdate2h - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine NStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic nitrogen state - ! variables affected by gap-phase mortality fluxes - ! NOTE - associate statements have been removed where there are - ! no science equations. This increases readability and maintainability - ! - ! !ARGUMENTS: - 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(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,l ! indices - integer :: fp,fc ! lake filter indices - real(r8) :: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - nf_veg => cnveg_nitrogenflux_inst , & - ns_veg => cnveg_nitrogenstate_inst , & - ns_soil => soilbiogeochem_nitrogenstate_inst & - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column-level nitrogen fluxes from gap-phase mortality - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - ns_soil%decomp_npools_vr_col(c,j,i_met_lit) = & - ns_soil%decomp_npools_vr_col(c,j,i_met_lit) + nf_veg%gap_mortality_n_to_litr_met_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) = & - ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) + nf_veg%gap_mortality_n_to_litr_cel_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) = & - ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) + nf_veg%gap_mortality_n_to_litr_lig_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_cwd) = & - ns_soil%decomp_npools_vr_col(c,j,i_cwd) + nf_veg%gap_mortality_n_to_cwdn_col(c,j) * dt - end do - end do - - ! patch -level nitrogen fluxes from gap-phase mortality - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! displayed pools - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) & - - nf_veg%m_leafn_to_litter_patch(p) * dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) & - - nf_veg%m_frootn_to_litter_patch(p) * dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) & - - nf_veg%m_livestemn_to_litter_patch(p) * dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) & - - nf_veg%m_deadstemn_to_litter_patch(p) * dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) & - - nf_veg%m_livecrootn_to_litter_patch(p) * dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) & - - nf_veg%m_deadcrootn_to_litter_patch(p) * dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) & - - nf_veg%m_retransn_to_litter_patch(p) * dt - - ! storage pools - ns_veg%leafn_storage_patch(p) = ns_veg%leafn_storage_patch(p) & - - nf_veg%m_leafn_storage_to_litter_patch(p) * dt - ns_veg%frootn_storage_patch(p) = ns_veg%frootn_storage_patch(p) & - - nf_veg%m_frootn_storage_to_litter_patch(p) * dt - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) & - - nf_veg%m_livestemn_storage_to_litter_patch(p) * dt - ns_veg%deadstemn_storage_patch(p) = ns_veg%deadstemn_storage_patch(p) & - - nf_veg%m_deadstemn_storage_to_litter_patch(p) * dt - ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) & - - nf_veg%m_livecrootn_storage_to_litter_patch(p) * dt - ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) & - - nf_veg%m_deadcrootn_storage_to_litter_patch(p) * dt - - ! transfer pools - ns_veg%leafn_xfer_patch(p) = ns_veg%leafn_xfer_patch(p) & - - nf_veg%m_leafn_xfer_to_litter_patch(p) * dt - ns_veg%frootn_xfer_patch(p) = ns_veg%frootn_xfer_patch(p) & - - nf_veg%m_frootn_xfer_to_litter_patch(p) * dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) & - - nf_veg%m_livestemn_xfer_to_litter_patch(p) * dt - ns_veg%deadstemn_xfer_patch(p) = ns_veg%deadstemn_xfer_patch(p) & - - nf_veg%m_deadstemn_xfer_to_litter_patch(p) * dt - ns_veg%livecrootn_xfer_patch(p) = ns_veg%livecrootn_xfer_patch(p) & - - nf_veg%m_livecrootn_xfer_to_litter_patch(p) * dt - ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) & - - nf_veg%m_deadcrootn_xfer_to_litter_patch(p) * dt - - end do - - end associate - - end subroutine NStateUpdate2 - - !----------------------------------------------------------------------- - subroutine NStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Update all the prognostic nitrogen state - ! variables affected by harvest mortality fluxes - ! NOTE - associate statements have been removed where there are - ! no science equations. This increases readability and maintainability - ! - ! !ARGUMENTS: - 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(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,l ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - nf_veg => cnveg_nitrogenflux_inst , & - ns_veg => cnveg_nitrogenstate_inst , & - ns_soil => soilbiogeochem_nitrogenstate_inst & - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column-level nitrogen fluxes from harvest mortality - - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ns_soil%decomp_npools_vr_col(c,j,i_met_lit) = & - ns_soil%decomp_npools_vr_col(c,j,i_met_lit) + nf_veg%harvest_n_to_litr_met_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) = & - ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) + nf_veg%harvest_n_to_litr_cel_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) = & - ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) + nf_veg%harvest_n_to_litr_lig_n_col(c,j) * dt - ns_soil%decomp_npools_vr_col(c,j,i_cwd) = & - ns_soil%decomp_npools_vr_col(c,j,i_cwd) + nf_veg%harvest_n_to_cwdn_col(c,j) * dt - end do - end do - - ! patch-level nitrogen fluxes from harvest mortality - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! displayed pools - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) & - - nf_veg%hrv_leafn_to_litter_patch(p) * dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) & - - nf_veg%hrv_frootn_to_litter_patch(p) * dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) & - - nf_veg%hrv_livestemn_to_litter_patch(p) * dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) & - - nf_veg%wood_harvestn_patch(p) * dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) & - - nf_veg%hrv_livecrootn_to_litter_patch(p) * dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) & - - nf_veg%hrv_deadcrootn_to_litter_patch(p) * dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) & - - nf_veg%hrv_retransn_to_litter_patch(p) * dt - - ! storage pools - ns_veg%leafn_storage_patch(p) = ns_veg%leafn_storage_patch(p) & - - nf_veg%hrv_leafn_storage_to_litter_patch(p) * dt - ns_veg%frootn_storage_patch(p) = ns_veg%frootn_storage_patch(p) & - - nf_veg%hrv_frootn_storage_to_litter_patch(p) * dt - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) & - - nf_veg%hrv_livestemn_storage_to_litter_patch(p) * dt - ns_veg%deadstemn_storage_patch(p) = ns_veg%deadstemn_storage_patch(p) & - - nf_veg%hrv_deadstemn_storage_to_litter_patch(p) * dt - ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) & - - nf_veg%hrv_livecrootn_storage_to_litter_patch(p) * dt - ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) & - - nf_veg%hrv_deadcrootn_storage_to_litter_patch(p) * dt - - ! transfer pools - ns_veg%leafn_xfer_patch(p) = ns_veg%leafn_xfer_patch(p) & - - nf_veg%hrv_leafn_xfer_to_litter_patch(p) *dt - ns_veg%frootn_xfer_patch(p) = ns_veg%frootn_xfer_patch(p) & - - nf_veg%hrv_frootn_xfer_to_litter_patch(p) *dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) & - - nf_veg%hrv_livestemn_xfer_to_litter_patch(p) *dt - ns_veg%deadstemn_xfer_patch(p) = ns_veg%deadstemn_xfer_patch(p) & - - nf_veg%hrv_deadstemn_xfer_to_litter_patch(p) *dt - ns_veg%livecrootn_xfer_patch(p) = ns_veg%livecrootn_xfer_patch(p) & - - nf_veg%hrv_livecrootn_xfer_to_litter_patch(p) *dt - ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) & - - nf_veg%hrv_deadcrootn_xfer_to_litter_patch(p) *dt - - end do - - end associate - - end subroutine NStateUpdate2h - -end module CNNStateUpdate2Mod diff --git a/src/biogeochem/CNNStateUpdate3Mod.F90 b/src/biogeochem/CNNStateUpdate3Mod.F90 deleted file mode 100644 index 455f69765b..0000000000 --- a/src/biogeochem/CNNStateUpdate3Mod.F90 +++ /dev/null @@ -1,210 +0,0 @@ -module CNNStateUpdate3Mod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for nitrogen state variable update, mortality fluxes. - ! Also, sminn leaching flux. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use clm_varpar , only: nlevdecomp, ndecomp_pools - use clm_time_manager , only : get_step_size - use clm_varctl , only : iulog, use_nitrif_denitrif - use clm_varpar , only : i_cwd, i_met_lit, i_cel_lit, i_lig_lit - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: NStateUpdate3 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine NStateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_nitrogenflux_inst, cnveg_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic nitrogen state - ! variables affected by gap-phase mortality fluxes. Also the Sminn leaching flux. - ! NOTE - associate statements have been removed where there are - ! no science equations. This increases readability and maintainability. - ! - ! !ARGUMENTS: - 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(cnveg_nitrogenflux_type) , intent(in) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(in) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,l,k ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - !----------------------------------------------------------------------- - - associate( & - nf_veg => cnveg_nitrogenflux_inst , & ! Input - ns_veg => cnveg_nitrogenstate_inst , & ! Output - nf_soil => soilbiogeochem_nitrogenflux_inst , & ! Input - ns_soil => soilbiogeochem_nitrogenstate_inst & ! Output - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. use_nitrif_denitrif) then - ! mineral N loss due to leaching - ns_soil%sminn_vr_col(c,j) = ns_soil%sminn_vr_col(c,j) - nf_soil%sminn_leached_vr_col(c,j) * dt - else - ! mineral N loss due to leaching and runoff - ns_soil%smin_no3_vr_col(c,j) = max( ns_soil%smin_no3_vr_col(c,j) - & - ( nf_soil%smin_no3_leached_vr_col(c,j) + nf_soil%smin_no3_runoff_vr_col(c,j) ) * dt, 0._r8) - - ns_soil%sminn_vr_col(c,j) = ns_soil%smin_no3_vr_col(c,j) + ns_soil%smin_nh4_vr_col(c,j) - end if - - ! column level nitrogen fluxes from fire - ! patch-level wood to column-level CWD (uncombusted wood) - ns_soil%decomp_npools_vr_col(c,j,i_cwd) = ns_soil%decomp_npools_vr_col(c,j,i_cwd) + & - nf_veg%fire_mortality_n_to_cwdn_col(c,j) * dt - - ! patch-level wood to column-level litter (uncombusted wood) - ns_soil%decomp_npools_vr_col(c,j,i_met_lit) = ns_soil%decomp_npools_vr_col(c,j,i_met_lit) + & - nf_veg%m_n_to_litr_met_fire_col(c,j)* dt - ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) = ns_soil%decomp_npools_vr_col(c,j,i_cel_lit) + & - nf_veg%m_n_to_litr_cel_fire_col(c,j)* dt - ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) = ns_soil%decomp_npools_vr_col(c,j,i_lig_lit) + & - nf_veg%m_n_to_litr_lig_fire_col(c,j)* dt - end do ! end of column loop - end do - - ! litter and CWD losses to fire - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - ns_soil%decomp_npools_vr_col(c,j,l) = ns_soil%decomp_npools_vr_col(c,j,l) - & - nf_veg%m_decomp_npools_to_fire_vr_col(c,j,l) * dt - end do - end do - end do - - ! patch-level nitrogen fluxes - - do fp = 1,num_soilp - p = filter_soilp(fp) - - !from fire displayed pools - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - & - nf_veg%m_leafn_to_fire_patch(p) * dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - & - nf_veg%m_frootn_to_fire_patch(p) * dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - & - nf_veg%m_livestemn_to_fire_patch(p) * dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) - & - nf_veg%m_deadstemn_to_fire_patch(p) * dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) - & - nf_veg%m_livecrootn_to_fire_patch(p) * dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) - & - nf_veg%m_deadcrootn_to_fire_patch(p) * dt - - ns_veg%leafn_patch(p) = ns_veg%leafn_patch(p) - & - nf_veg%m_leafn_to_litter_fire_patch(p) * dt - ns_veg%frootn_patch(p) = ns_veg%frootn_patch(p) - & - nf_veg%m_frootn_to_litter_fire_patch(p) * dt - ns_veg%livestemn_patch(p) = ns_veg%livestemn_patch(p) - & - nf_veg%m_livestemn_to_litter_fire_patch(p) * dt - & - nf_veg%m_livestemn_to_deadstemn_fire_patch(p) * dt - ns_veg%deadstemn_patch(p) = ns_veg%deadstemn_patch(p) - & - nf_veg%m_deadstemn_to_litter_fire_patch(p) * dt + & - nf_veg%m_livestemn_to_deadstemn_fire_patch(p) * dt - ns_veg%livecrootn_patch(p) = ns_veg%livecrootn_patch(p) - & - nf_veg%m_livecrootn_to_litter_fire_patch(p) * dt - & - nf_veg%m_livecrootn_to_deadcrootn_fire_patch(p) * dt - ns_veg%deadcrootn_patch(p) = ns_veg%deadcrootn_patch(p) - & - nf_veg%m_deadcrootn_to_litter_fire_patch(p) * dt + & - nf_veg%m_livecrootn_to_deadcrootn_fire_patch(p) * dt - - ! storage pools - ns_veg%leafn_storage_patch(p) = ns_veg%leafn_storage_patch(p) - & - nf_veg%m_leafn_storage_to_fire_patch(p) * dt - ns_veg%frootn_storage_patch(p) = ns_veg%frootn_storage_patch(p) - & - nf_veg%m_frootn_storage_to_fire_patch(p) * dt - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) - & - nf_veg%m_livestemn_storage_to_fire_patch(p) * dt - ns_veg%deadstemn_storage_patch(p) = ns_veg%deadstemn_storage_patch(p) - & - nf_veg%m_deadstemn_storage_to_fire_patch(p) * dt - ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) - & - nf_veg%m_livecrootn_storage_to_fire_patch(p) * dt - ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) - & - nf_veg%m_deadcrootn_storage_to_fire_patch(p) * dt - - ns_veg%leafn_storage_patch(p) = ns_veg%leafn_storage_patch(p) - & - nf_veg%m_leafn_storage_to_litter_fire_patch(p) * dt - ns_veg%frootn_storage_patch(p) = ns_veg%frootn_storage_patch(p) - & - nf_veg%m_frootn_storage_to_litter_fire_patch(p) * dt - ns_veg%livestemn_storage_patch(p) = ns_veg%livestemn_storage_patch(p) - & - nf_veg%m_livestemn_storage_to_litter_fire_patch(p) * dt - ns_veg%deadstemn_storage_patch(p) = ns_veg%deadstemn_storage_patch(p) - & - nf_veg%m_deadstemn_storage_to_litter_fire_patch(p) * dt - ns_veg%livecrootn_storage_patch(p) = ns_veg%livecrootn_storage_patch(p) - & - nf_veg%m_livecrootn_storage_to_litter_fire_patch(p) * dt - ns_veg%deadcrootn_storage_patch(p) = ns_veg%deadcrootn_storage_patch(p) - & - nf_veg%m_deadcrootn_storage_to_litter_fire_patch(p) * dt - - - ! transfer pools - ns_veg%leafn_xfer_patch(p) = ns_veg%leafn_xfer_patch(p) - & - nf_veg%m_leafn_xfer_to_fire_patch(p) * dt - ns_veg%frootn_xfer_patch(p) = ns_veg%frootn_xfer_patch(p) - & - nf_veg%m_frootn_xfer_to_fire_patch(p) * dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) - & - nf_veg%m_livestemn_xfer_to_fire_patch(p) * dt - ns_veg%deadstemn_xfer_patch(p) = ns_veg%deadstemn_xfer_patch(p) - & - nf_veg%m_deadstemn_xfer_to_fire_patch(p) * dt - ns_veg%livecrootn_xfer_patch(p) = ns_veg%livecrootn_xfer_patch(p) - & - nf_veg%m_livecrootn_xfer_to_fire_patch(p) * dt - ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) - & - nf_veg%m_deadcrootn_xfer_to_fire_patch(p) * dt - - ns_veg%leafn_xfer_patch(p) = ns_veg%leafn_xfer_patch(p) - & - nf_veg%m_leafn_xfer_to_litter_fire_patch(p) * dt - ns_veg%frootn_xfer_patch(p) = ns_veg%frootn_xfer_patch(p) - & - nf_veg%m_frootn_xfer_to_litter_fire_patch(p) * dt - ns_veg%livestemn_xfer_patch(p) = ns_veg%livestemn_xfer_patch(p) - & - nf_veg%m_livestemn_xfer_to_litter_fire_patch(p) * dt - ns_veg%deadstemn_xfer_patch(p) = ns_veg%deadstemn_xfer_patch(p) - & - nf_veg%m_deadstemn_xfer_to_litter_fire_patch(p) * dt - ns_veg%livecrootn_xfer_patch(p) = ns_veg%livecrootn_xfer_patch(p) - & - nf_veg%m_livecrootn_xfer_to_litter_fire_patch(p) * dt - ns_veg%deadcrootn_xfer_patch(p) = ns_veg%deadcrootn_xfer_patch(p) - & - nf_veg%m_deadcrootn_xfer_to_litter_fire_patch(p) * dt - - ! retranslocated N pool - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) - & - nf_veg%m_retransn_to_fire_patch(p) * dt - ns_veg%retransn_patch(p) = ns_veg%retransn_patch(p) - & - nf_veg%m_retransn_to_litter_fire_patch(p) * dt - end do - - end associate - - end subroutine NStateUpdate3 - -end module CNNStateUpdate3Mod diff --git a/src/biogeochem/CNPhenologyMod.F90 b/src/biogeochem/CNPhenologyMod.F90 deleted file mode 100644 index 9d66373085..0000000000 --- a/src/biogeochem/CNPhenologyMod.F90 +++ /dev/null @@ -1,3014 +0,0 @@ -module CNPhenologyMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !MODULE: CNPhenologyMod - ! - ! !DESCRIPTION: - ! Module holding routines used in phenology model for coupled carbon - ! nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_flush - use decompMod , only : bounds_type - use clm_varpar , only : numpft, nlevdecomp_full - use clm_varctl , only : iulog, use_cndv - use clm_varcon , only : tfrz - use abortutils , only : endrun - use CanopyStateType , only : canopystate_type - use CNDVType , only : dgvs_type - use CNVegstateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type - use CropType , only : crop_type - use pftconMod , only : pftcon - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use ColumnType , only : col - use GridcellType , only : grc - use PatchType , only : patch - use atm2lndType , only : atm2lnd_type - use atm2lndType , only : atm2lnd_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams ! Read parameters - public :: CNPhenologyreadNML ! Read namelist - public :: CNPhenologyInit ! Initialization - public :: CNPhenology ! Update - ! - ! !PRIVATE DATA MEMBERS: - type, private :: params_type - real(r8) :: crit_dayl ! critical day length for senescence - real(r8) :: ndays_on ! number of days to complete leaf onset - real(r8) :: ndays_off ! number of days to complete leaf offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer for each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days to set gdd counter - real(r8) :: crit_onset_swi ! critical number of days > soilpsi_on for onset - real(r8) :: soilpsi_on ! critical soil water potential for leaf onset - real(r8) :: crit_offset_fdd ! critical number of freezing days to initiate offset - real(r8) :: crit_offset_swi ! critical number of water stress days to initiate offset - real(r8) :: soilpsi_off ! critical soil water potential for leaf offset - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - end type params_type - - type(params_type) :: params_inst - - real(r8) :: dt ! radiation time step delta t (seconds) - real(r8) :: fracday ! dtime as a fraction of day - real(r8) :: crit_dayl ! critical daylength for offset (seconds) - real(r8) :: ndays_on ! number of days to complete onset - real(r8) :: ndays_off ! number of days to complete offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer on each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days - real(r8) :: crit_onset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_on ! water potential for onset trigger (MPa) - real(r8) :: crit_offset_fdd ! critical number of freezing degree days to trigger offset - real(r8) :: crit_offset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_off ! water potential for offset trigger (MPa) - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - - ! CropPhenology variables and constants - real(r8) :: p1d, p1v ! photoperiod factor constants for crop vernalization - real(r8) :: hti ! cold hardening index threshold for vernalization - real(r8) :: tbase ! base temperature for vernalization - - integer, parameter :: NOT_Planted = 999 ! If not planted yet in year - integer, parameter :: NOT_Harvested = 999 ! If not harvested yet in year - integer, parameter :: inNH = 1 ! Northern Hemisphere - integer, parameter :: inSH = 2 ! Southern Hemisphere - integer, pointer :: inhemi(:) ! Hemisphere that patch is in - - integer, allocatable :: minplantjday(:,:) ! minimum planting julian day - integer, allocatable :: maxplantjday(:,:) ! maximum planting julian day - integer :: jdayyrstart(inSH) ! julian day of start of year - - real(r8), private :: initial_seed_at_planting = 3._r8 ! Initial seed at planting - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNPhenologyReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CNPhenology - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNPhenologyReadNML' - character(len=*), parameter :: nmlname = 'cnphenology' - !----------------------------------------------------------------------- - namelist /cnphenology/ initial_seed_at_planting - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnphenology, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (initial_seed_at_planting, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnphenology) - write(iulog,*) ' ' - end if - - - !----------------------------------------------------------------------- - - end subroutine CNPhenologyReadNML - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNPhenolParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! - ! read in parameters - ! - tString='crit_dayl' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_dayl=tempr - - tString='ndays_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_on=tempr - - tString='ndays_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ndays_off=tempr - - tString='fstor2tran' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%fstor2tran=tempr - - tString='crit_onset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_fdd=tempr - - tString='crit_onset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_onset_swi=tempr - - tString='soilpsi_on' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_on=tempr - - tString='crit_offset_fdd' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_fdd=tempr - - tString='crit_offset_swi' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%crit_offset_swi=tempr - - tString='soilpsi_off' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%soilpsi_off=tempr - - tString='lwtop_ann' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun( msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lwtop=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine CNPhenology (bounds, num_soilc, filter_soilc, num_soilp, & - filter_soilp, num_pcropp, filter_pcropp, & - doalb, waterstate_inst, temperature_inst, atm2lnd_inst, crop_inst, & - canopystate_inst, soilstate_inst, dgvs_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - leaf_prof_patch, froot_prof_patch, phase) - ! !USES: - use CNSharedParamsMod, only: use_fun - ! - ! !DESCRIPTION: - ! Dynamic phenology routine for coupled carbon-nitrogen code (CN) - ! 1. grass phenology - ! - ! !ARGUMENTS: - 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 - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:)! filter for prognostic crop patches - logical , intent(in) :: doalb ! true if time for sfc albedo calc - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(crop_type) , intent(inout) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - integer , intent(in) :: phase - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - - ! each of the following phenology type routines includes a filter - ! to operate only on the relevant patches - - - if ( phase == 1 ) then - call CNPhenologyClimate(num_soilp, filter_soilp, num_pcropp, filter_pcropp, & - temperature_inst, cnveg_state_inst, crop_inst) - - call CNEvergreenPhenology(num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNSeasonDecidPhenology(num_soilp, filter_soilp, & - temperature_inst, cnveg_state_inst, dgvs_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNStressDecidPhenology(num_soilp, filter_soilp, & - soilstate_inst, temperature_inst, atm2lnd_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - if (doalb .and. num_pcropp > 0 ) then - call CropPhenology(num_pcropp, filter_pcropp, & - waterstate_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst) - end if - else if ( phase == 2 ) then - ! the same onset and offset routines are called regardless of - ! phenology type - they depend only on onset_flag, offset_flag, bglfr, and bgtr - - call CNOnsetGrowth(num_soilp, filter_soilp, & - cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNOffsetLitterfall(num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNBackgroundLitterfall(num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNLivewoodTurnover(num_soilp, filter_soilp, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - call CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - ! gather all patch-level litterfall fluxes to the column for litter C and N inputs - - call CNLitterToColumn(bounds, num_soilc, filter_soilc, & - cnveg_state_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch(bounds%begp:bounds%endp,1:nlevdecomp_full), & - froot_prof_patch(bounds%begp:bounds%endp,1:nlevdecomp_full)) - else - call endrun( 'bad phase' ) - end if - - end subroutine CNPhenology - - !----------------------------------------------------------------------- - subroutine CNPhenologyInit(bounds) - ! - ! !DESCRIPTION: - ! Initialization of CNPhenology. Must be called after time-manager is - ! initialized, and after pftcon file is read in. - ! - ! !USES: - use clm_time_manager, only: get_step_size - use clm_varctl , only: use_crop - use clm_varcon , only: secspday - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - !------------------------------------------------------------------------ - - ! - ! Get time-step and what fraction of a day it is - ! - dt = real( get_step_size(), r8 ) - fracday = dt/secspday - - ! set constants for CNSeasonDecidPhenology - ! (critical daylength from Biome-BGC, v4.1.2) - crit_dayl=params_inst%crit_dayl - - ! Set constants for CNSeasonDecidPhenology and CNStressDecidPhenology - ndays_on=params_inst%ndays_on - ndays_off=params_inst%ndays_off - - ! set transfer parameters - fstor2tran=params_inst%fstor2tran - - ! ----------------------------------------- - ! Constants for CNStressDecidPhenology - ! ----------------------------------------- - - ! onset parameters - crit_onset_fdd=params_inst%crit_onset_fdd - ! critical onset gdd now being calculated as a function of annual - ! average 2m temp. - ! crit_onset_gdd = 150.0 ! c3 grass value - ! crit_onset_gdd = 1000.0 ! c4 grass value - crit_onset_swi=params_inst%crit_onset_swi - soilpsi_on=params_inst%soilpsi_on - - ! offset parameters - crit_offset_fdd=params_inst%crit_offset_fdd - crit_offset_swi=params_inst%crit_offset_swi - soilpsi_off=params_inst%soilpsi_off - - ! ----------------------------------------- - ! Constants for CNLivewoodTurnover - ! ----------------------------------------- - - ! set the global parameter for livewood turnover rate - ! define as an annual fraction (0.7), and convert to fraction per second - lwtop=params_inst%lwtop/31536000.0_r8 !annual fraction converted to per second - - ! ----------------------------------------- - ! Call any subroutine specific initialization routines - ! ----------------------------------------- - - if ( use_crop ) call CropPhenologyInit(bounds) - - end subroutine CNPhenologyInit - - !----------------------------------------------------------------------- - subroutine CNPhenologyClimate (num_soilp, filter_soilp, num_pcropp, filter_pcropp, & - temperature_inst, cnveg_state_inst, crop_inst) - ! - ! !DESCRIPTION: - ! For coupled carbon-nitrogen code (CN). - ! - ! !USES: - use clm_time_manager , only : get_days_per_year - use clm_time_manager , only : get_curr_date, is_first_step - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_pcropp ! number of prognostic crops in filter - integer , intent(in) :: filter_pcropp(:)! filter for prognostic crop patches - type(temperature_type) , intent(inout) :: temperature_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(inout) :: crop_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8) :: dayspyr ! days per year (days) - integer :: kyr ! current year - integer :: kmo ! month of year (1, ..., 12) - integer :: kda ! day of month (1, ..., 31) - integer :: mcsec ! seconds of day (0, ..., seconds/day) - real(r8), parameter :: yravg = 20.0_r8 ! length of years to average for gdd - real(r8), parameter :: yravgm1 = yravg-1.0_r8 ! minus 1 of above - !----------------------------------------------------------------------- - - associate( & - nyrs_crop_active => crop_inst%nyrs_crop_active_patch, & ! InOut: [integer (:) ] number of years this crop patch has been active - - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2m air temperature (K) - gdd0 => temperature_inst%gdd0_patch , & ! Output: [real(r8) (:) ] growing deg. days base 0 deg C (ddays) - gdd8 => temperature_inst%gdd8_patch , & ! Output: [real(r8) (:) ] " " " " 8 " " " - gdd10 => temperature_inst%gdd10_patch , & ! Output: [real(r8) (:) ] " " " " 10 " " " - gdd020 => temperature_inst%gdd020_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd0 (ddays) - gdd820 => temperature_inst%gdd820_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd8 (ddays) - gdd1020 => temperature_inst%gdd1020_patch , & ! Output: [real(r8) (:) ] 20-yr mean of gdd10 (ddays) - - tempavg_t2m => cnveg_state_inst%tempavg_t2m_patch & ! Output: [real(r8) (:) ] temp. avg 2m air temperature (K) - ) - - ! set time steps - - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - tempavg_t2m(p) = tempavg_t2m(p) + t_ref2m(p) * (fracday/dayspyr) - end do - - ! - ! The following crop related steps are done here rather than CropPhenology - ! so that they will be completed each time-step rather than with doalb. - ! - ! The following lines come from ibis's climate.f + stats.f - ! gdd SUMMATIONS ARE RELATIVE TO THE PLANTING DATE (see subr. updateAccFlds) - - if (num_pcropp > 0) then - ! get time-related info - call get_curr_date(kyr, kmo, kda, mcsec) - end if - - do fp = 1,num_pcropp - p = filter_pcropp(fp) - if (kmo == 1 .and. kda == 1 .and. nyrs_crop_active(p) == 0) then ! YR 1: - gdd020(p) = 0._r8 ! set gdd..20 variables to 0 - gdd820(p) = 0._r8 ! and crops will not be planted - gdd1020(p) = 0._r8 - end if - if (kmo == 1 .and. kda == 1 .and. mcsec == 0) then ! <-- END of EVERY YR: - if (nyrs_crop_active(p) == 1) then ! <-- END of YR 1 - gdd020(p) = gdd0(p) ! <-- END of YR 1 - gdd820(p) = gdd8(p) ! <-- END of YR 1 - gdd1020(p) = gdd10(p) ! <-- END of YR 1 - end if ! <-- END of YR 1 - gdd020(p) = (yravgm1* gdd020(p) + gdd0(p)) / yravg ! gdd..20 must be long term avgs - gdd820(p) = (yravgm1* gdd820(p) + gdd8(p)) / yravg ! so ignore results for yrs 1 & 2 - gdd1020(p) = (yravgm1* gdd1020(p) + gdd10(p)) / yravg - end if - end do - - end associate - - end subroutine CNPhenologyClimate - - !----------------------------------------------------------------------- - subroutine CNEvergreenPhenology (num_soilp, filter_soilp , & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! cnveg_state_inst) - ! - ! !DESCRIPTION: - ! For coupled carbon-nitrogen code (CN). - ! - ! !USES: - use clm_varcon , only : secspday - use clm_time_manager , only : get_days_per_year - use clm_varctl , only : CN_evergreen_phenology_opt - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type), intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - real(r8):: dayspyr ! Days per year - integer :: p ! indices - integer :: fp ! lake filter patch index - - real(r8):: tranr - real(r8):: t1 ! temporary variable - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - evergreen => pftcon%evergreen , & ! Input: binary flag for evergreen leaf habit (0 or 1) - leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! InOut: [real(r8) (:)] (gC/m2) dead coarse root C transfer - - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! InOut: [real(r8) (:)] (gN/m2) dead coarse root N transfer - - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! InOut: [real(r8) (:)] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! InOut: [real(r8) (:)] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! InOut: [real(r8) (:)] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! InOut: [real(r8) (:)] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! InOut: [real(r8) (:)] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! InOut: [real(r8) (:)] - - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch , & ! InOut: [real(r8) (:)] - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! InOut: [real(r8) (:)] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! InOut: [real(r8) (:)] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! InOut: [real(r8) (:)] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! InOut: [real(r8) (:)] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! InOut: [real(r8) (:)] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! InOut: [real(r8) (:)] - - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - lgsf => cnveg_state_inst%lgsf_patch & ! Output: [real(r8) (:) ] long growing season factor [0-1] - ) - - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - if (evergreen(ivt(p)) == 1._r8) then - bglfr(p) = 1._r8/(leaf_long(ivt(p)) * dayspyr * secspday) - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - end if - end do - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (CN_evergreen_phenology_opt == 1) then - do fp = 1,num_soilp - p = filter_soilp(fp) - if (evergreen(ivt(p)) == 1._r8) then - - tranr=0.0002_r8 - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = tranr * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = tranr * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = tranr * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = tranr * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = tranr * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = tranr * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = tranr * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = tranr * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = tranr * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = tranr * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = tranr * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = tranr * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = tranr * deadcrootn_storage(p)/dt - end if - - t1 = 1.0_r8 / dt - - leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) - frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) - - leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) - frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) - deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) - livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) - - livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) - deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) - livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) - deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) - end if - - end if ! end of if (evergreen(ivt(p)) == 1._r8) then - - end do ! end of pft loop - - end if ! end of if (CN_evergreen_phenology_opt == 1) then - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - end associate - - end subroutine CNEvergreenPhenology - - !----------------------------------------------------------------------- - subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp , & - temperature_inst, cnveg_state_inst, dgvs_inst , & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! For coupled carbon-nitrogen code (CN). - ! This routine handles the seasonal deciduous phenology code (temperate - ! deciduous vegetation that has only one growing season per year). - ! - ! !USES: - use shr_const_mod , only: SHR_CONST_TKFRZ, SHR_CONST_PI - use clm_varcon , only: secspday - use clm_varctl , only: use_cndv - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(temperature_type) , intent(in) :: temperature_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(dgvs_type) , intent(inout) :: dgvs_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: g,c,p !indices - integer :: fp !lake filter patch index - real(r8):: ws_flag !winter-summer solstice flag (0 or 1) - real(r8):: crit_onset_gdd !critical onset growing degree-day sum - real(r8):: soilt - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - prev_dayl => grc%prev_dayl , & ! Input: [real(r8) (:) ] daylength from previous time step (s) - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - pftmayexist => dgvs_inst%pftmayexist_patch , & ! Output: [logical (:) ] exclude seasonal decid patches from tropics - - annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Input: [real(r8) (:) ] annual average 2m air temperature (K) - dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Output: [real(r8) (:) ] dormancy flag - days_active => cnveg_state_inst%days_active_patch , & ! Output: [real(r8) (:) ] number of days since last dormancy - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter (seconds) - onset_gddflag => cnveg_state_inst%onset_gddflag_patch , & ! Output: [real(r8) (:) ] onset freeze flag - onset_gdd => cnveg_state_inst%onset_gdd_patch , & ! Output: [real(r8) (:) ] onset growing degree days - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter (seconds) - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] - - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) - prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] - ) - - ! start patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - g = patch%gridcell(p) - - if (season_decid(ivt(p)) == 1._r8) then - - ! set background litterfall rate, background transfer rate, and - ! long growing season factor to 0 for seasonal deciduous types - bglfr(p) = 0._r8 - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - - ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - - ! set flag for solstice period (winter->summer = 1, summer->winter = 0) - if (dayl(g) >= prev_dayl(g)) then - ws_flag = 1._r8 - else - ws_flag = 0._r8 - end if - - ! update offset_counter and test for the end of the offset period - if (offset_flag(p) == 1.0_r8) then - ! decrement counter for offset period - offset_counter(p) = offset_counter(p) - dt - - ! if this is the end of the offset_period, reset phenology - ! flags and indices - if (offset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_offset_cleanup(p) - ! inlined during vectorization - - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - if (use_cndv) then - pftmayexist(p) = .true. - end if - - ! reset the previous timestep litterfall flux memory - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! update onset_counter and test for the end of the onset period - if (onset_flag(p) == 1.0_r8) then - ! decrement counter for onset period - onset_counter(p) = onset_counter(p) - dt - - ! if this is the end of the onset period, reset phenology - ! flags and indices - if (onset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_onset_cleanup(p) - ! inlined during vectorization - - onset_flag(p) = 0.0_r8 - onset_counter(p) = 0.0_r8 - ! set all transfer growth rates to 0.0 - leafc_xfer_to_leafc(p) = 0.0_r8 - frootc_xfer_to_frootc(p) = 0.0_r8 - leafn_xfer_to_leafn(p) = 0.0_r8 - frootn_xfer_to_frootn(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = 0.0_r8 - deadstemc_xfer_to_deadstemc(p) = 0.0_r8 - livecrootc_xfer_to_livecrootc(p) = 0.0_r8 - deadcrootc_xfer_to_deadcrootc(p) = 0.0_r8 - livestemn_xfer_to_livestemn(p) = 0.0_r8 - deadstemn_xfer_to_deadstemn(p) = 0.0_r8 - livecrootn_xfer_to_livecrootn(p) = 0.0_r8 - deadcrootn_xfer_to_deadcrootn(p) = 0.0_r8 - end if - ! set transfer pools to 0.0 - leafc_xfer(p) = 0.0_r8 - leafn_xfer(p) = 0.0_r8 - frootc_xfer(p) = 0.0_r8 - frootn_xfer(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer(p) = 0.0_r8 - livestemn_xfer(p) = 0.0_r8 - deadstemc_xfer(p) = 0.0_r8 - deadstemn_xfer(p) = 0.0_r8 - livecrootc_xfer(p) = 0.0_r8 - livecrootn_xfer(p) = 0.0_r8 - deadcrootc_xfer(p) = 0.0_r8 - deadcrootn_xfer(p) = 0.0_r8 - end if - end if - end if - - ! test for switching from dormant period to growth period - if (dormant_flag(p) == 1.0_r8) then - - ! Test to turn on growing degree-day sum, if off. - ! switch on the growing degree day sum on the winter solstice - - if (onset_gddflag(p) == 0._r8 .and. ws_flag == 1._r8) then - onset_gddflag(p) = 1._r8 - onset_gdd(p) = 0._r8 - end if - - ! Test to turn off growing degree-day sum, if on. - ! This test resets the growing degree day sum if it gets past - ! the summer solstice without reaching the threshold value. - ! In that case, it will take until the next winter solstice - ! before the growing degree-day summation starts again. - - if (onset_gddflag(p) == 1._r8 .and. ws_flag == 0._r8) then - onset_gddflag(p) = 0._r8 - onset_gdd(p) = 0._r8 - end if - - ! if the gdd flag is set, and if the soil is above freezing - ! then accumulate growing degree days for onset trigger - - soilt = t_soisno(c,3) - if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then - onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday - end if - - ! set onset_flag if critical growing degree-day sum is exceeded - if (onset_gdd(p) > crit_onset_gdd) then - onset_flag(p) = 1.0_r8 - dormant_flag(p) = 0.0_r8 - onset_gddflag(p) = 0.0_r8 - onset_gdd(p) = 0.0_r8 - onset_counter(p) = ndays_on * secspday - - ! move all the storage pools into transfer pools, - ! where they will be transfered to displayed growth over the onset period. - ! this code was originally handled with call cn_storage_to_xfer(p) - ! inlined during vectorization - - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt - end if - end if - - ! test for switching from growth period to offset period - else if (offset_flag(p) == 0.0_r8) then - if (use_cndv) then - ! If days_active > 355, then remove patch in - ! CNDVEstablishment at the end of the year. - ! days_active > 355 is a symptom of seasonal decid. patches occurring in - ! gridcells where dayl never drops below crit_dayl. - ! This results in TLAI>1e4 in a few gridcells. - days_active(p) = days_active(p) + fracday - if (days_active(p) > 355._r8) pftmayexist(p) = .false. - end if - - ! only begin to test for offset daylength once past the summer sol - if (ws_flag == 0._r8 .and. dayl(g) < crit_dayl) then - offset_flag(p) = 1._r8 - offset_counter(p) = ndays_off * secspday - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - end if ! end if seasonal deciduous - - end do ! end of patch loop - - end associate - - end subroutine CNSeasonDecidPhenology - - !----------------------------------------------------------------------- - subroutine CNStressDecidPhenology (num_soilp, filter_soilp , & - soilstate_inst, temperature_inst, atm2lnd_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! This routine handles phenology for vegetation types, such as grasses and - ! tropical drought deciduous trees, that respond to cold and drought stress - ! signals and that can have multiple growing seasons in a given year. - ! This routine allows for the possibility that leaves might persist year-round - ! in the absence of a suitable stress trigger, by switching to an essentially - ! evergreen habit, but maintaining a deciduous leaf longevity, while waiting - ! for the next stress trigger. This is in contrast to the seasonal deciduous - ! algorithm (for temperate deciduous trees) that forces a single growing season - ! per year. - ! - ! !USES: - use clm_time_manager , only : get_days_per_year - use CNSharedParamsMod, only : use_fun - use clm_varcon , only : secspday - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_PI - use CNSharedParamsMod, only : CNParamsShareInst - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - real(r8),parameter :: secspqtrday = secspday / 4 ! seconds per quarter day - integer :: g,c,p ! indices - integer :: fp ! lake filter patch index - real(r8):: dayspyr ! days per year - real(r8):: crit_onset_gdd ! degree days for onset trigger - real(r8):: soilt ! temperature of top soil layer - real(r8):: psi ! water stress of top soil layer - real(r8):: rain_threshold ! rain threshold for leaf on [mm] - logical :: additional_onset_condition ! additional condition for leaf onset - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - - prec10 => atm2lnd_inst%prec10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of tot. precipitation - leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1) - - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Output: [real(r8) (:) ] dormancy flag - days_active => cnveg_state_inst%days_active_patch , & ! Output: [real(r8) (:) ] number of days since last dormancy - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter (seconds) - onset_gddflag => cnveg_state_inst%onset_gddflag_patch , & ! Output: [real(r8) (:) ] onset freeze flag - onset_fdd => cnveg_state_inst%onset_fdd_patch , & ! Output: [real(r8) (:) ] onset freezing degree days counter - onset_gdd => cnveg_state_inst%onset_gdd_patch , & ! Output: [real(r8) (:) ] onset growing degree days - onset_swi => cnveg_state_inst%onset_swi_patch , & ! Output: [real(r8) (:) ] onset soil water index - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter (seconds) - offset_fdd => cnveg_state_inst%offset_fdd_patch , & ! Output: [real(r8) (:) ] offset freezing degree days counter - offset_swi => cnveg_state_inst%offset_swi_patch , & ! Output: [real(r8) (:) ] offset soil water index - lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - annavg_t2m => cnveg_state_inst%annavg_t2m_patch , & ! Output: [real(r8) (:) ] annual average 2m air temperature (K) - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:) ] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) - prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - leafc_storage_to_xfer => cnveg_carbonflux_inst%leafc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootc_storage_to_xfer => cnveg_carbonflux_inst%frootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemc_storage_to_xfer => cnveg_carbonflux_inst%livestemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemc_storage_to_xfer => cnveg_carbonflux_inst%deadstemc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootc_storage_to_xfer => cnveg_carbonflux_inst%livecrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootc_storage_to_xfer => cnveg_carbonflux_inst%deadcrootc_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - gresp_storage_to_xfer => cnveg_carbonflux_inst%gresp_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - leafn_storage_to_xfer => cnveg_nitrogenflux_inst%leafn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - frootn_storage_to_xfer => cnveg_nitrogenflux_inst%frootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livestemn_storage_to_xfer => cnveg_nitrogenflux_inst%livestemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadstemn_storage_to_xfer => cnveg_nitrogenflux_inst%deadstemn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - livecrootn_storage_to_xfer => cnveg_nitrogenflux_inst%livecrootn_storage_to_xfer_patch , & ! Output: [real(r8) (:) ] - deadcrootn_storage_to_xfer => cnveg_nitrogenflux_inst%deadcrootn_storage_to_xfer_patch & ! Output: [real(r8) (:) ] - ) - - ! set time steps - dayspyr = get_days_per_year() - - ! specify rain threshold for leaf onset - rain_threshold = 20._r8 - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - g = patch%gridcell(p) - - if (stress_decid(ivt(p)) == 1._r8) then - soilt = t_soisno(c,3) - psi = soilpsi(c,3) - - ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - - - ! update offset_counter and test for the end of the offset period - if (offset_flag(p) == 1._r8) then - ! decrement counter for offset period - offset_counter(p) = offset_counter(p) - dt - - ! if this is the end of the offset_period, reset phenology - ! flags and indices - if (offset_counter(p) == 0._r8) then - ! this code block was originally handled by call cn_offset_cleanup(p) - ! inlined during vectorization - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - - ! reset the previous timestep litterfall flux memory - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! update onset_counter and test for the end of the onset period - if (onset_flag(p) == 1.0_r8) then - ! decrement counter for onset period - onset_counter(p) = onset_counter(p) - dt - - ! if this is the end of the onset period, reset phenology - ! flags and indices - if (onset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_onset_cleanup(p) - ! inlined during vectorization - onset_flag(p) = 0._r8 - onset_counter(p) = 0._r8 - ! set all transfer growth rates to 0.0 - leafc_xfer_to_leafc(p) = 0._r8 - frootc_xfer_to_frootc(p) = 0._r8 - leafn_xfer_to_leafn(p) = 0._r8 - frootn_xfer_to_frootn(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = 0._r8 - deadstemc_xfer_to_deadstemc(p) = 0._r8 - livecrootc_xfer_to_livecrootc(p) = 0._r8 - deadcrootc_xfer_to_deadcrootc(p) = 0._r8 - livestemn_xfer_to_livestemn(p) = 0._r8 - deadstemn_xfer_to_deadstemn(p) = 0._r8 - livecrootn_xfer_to_livecrootn(p) = 0._r8 - deadcrootn_xfer_to_deadcrootn(p) = 0._r8 - end if - ! set transfer pools to 0.0 - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = 0._r8 - frootc_xfer(p) = 0._r8 - frootn_xfer(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer(p) = 0._r8 - livestemn_xfer(p) = 0._r8 - deadstemc_xfer(p) = 0._r8 - deadstemn_xfer(p) = 0._r8 - livecrootc_xfer(p) = 0._r8 - livecrootn_xfer(p) = 0._r8 - deadcrootc_xfer(p) = 0._r8 - deadcrootn_xfer(p) = 0._r8 - end if - end if - end if - - ! test for switching from dormant period to growth period - if (dormant_flag(p) == 1._r8) then - - ! keep track of the number of freezing degree days in this - ! dormancy period (only if the freeze flag has not previously been set - ! for this dormancy period - - if (onset_gddflag(p) == 0._r8 .and. soilt < SHR_CONST_TKFRZ) onset_fdd(p) = onset_fdd(p) + fracday - - ! if the number of freezing degree days exceeds a critical value, - ! then onset will require both wet soils and a critical soil - ! temperature sum. If this case is triggered, reset any previously - ! accumulated value in onset_swi, so that onset now depends on - ! the accumulated soil water index following the freeze trigger - - if (onset_fdd(p) > crit_onset_fdd) then - onset_gddflag(p) = 1._r8 - onset_fdd(p) = 0._r8 - onset_swi(p) = 0._r8 - end if - - ! if the freeze flag is set, and if the soil is above freezing - ! then accumulate growing degree days for onset trigger - - if (onset_gddflag(p) == 1._r8 .and. soilt > SHR_CONST_TKFRZ) then - onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday - end if - - ! if soils are wet, accumulate soil water index for onset trigger - additional_onset_condition = .true. - if(CNParamsShareInst%constrain_stress_deciduous_onset) then - ! if additional constraint condition not met, set to false - if ((prec10(p) * (3600.0_r8*10.0_r8*24.0_r8)) < rain_threshold) then - additional_onset_condition = .false. - endif - endif - - if (psi >= soilpsi_on) then - onset_swi(p) = onset_swi(p) + fracday - endif - - ! if critical soil water index is exceeded, set onset_flag, and - ! then test for soil temperature criteria - - ! Adding in Kyla's rainfall trigger when fun on. RF. prec10 (mm/s) needs to be higher than 8mm over 10 days. - - if (onset_swi(p) > crit_onset_swi.and. additional_onset_condition) then - onset_flag(p) = 1._r8 - - ! only check soil temperature criteria if freeze flag set since - ! beginning of last dormancy. If freeze flag set and growing - ! degree day sum (since freeze trigger) is lower than critical - ! value, then override the onset_flag set from soil water. - - if (onset_gddflag(p) == 1._r8 .and. onset_gdd(p) < crit_onset_gdd) onset_flag(p) = 0._r8 - end if - - ! only allow onset if dayl > 6hrs - if (onset_flag(p) == 1._r8 .and. dayl(g) <= secspqtrday) then - onset_flag(p) = 0._r8 - end if - - ! if this is the beginning of the onset period - ! then reset the phenology flags and indices - - if (onset_flag(p) == 1._r8) then - dormant_flag(p) = 0._r8 - days_active(p) = 0._r8 - onset_gddflag(p) = 0._r8 - onset_fdd(p) = 0._r8 - onset_gdd(p) = 0._r8 - onset_swi(p) = 0._r8 - onset_counter(p) = ndays_on * secspday - - ! call subroutine to move all the storage pools into transfer pools, - ! where they will be transfered to displayed growth over the onset period. - ! this code was originally handled with call cn_storage_to_xfer(p) - ! inlined during vectorization - - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt - end if - end if - - ! test for switching from growth period to offset period - else if (offset_flag(p) == 0._r8) then - - ! if soil water potential lower than critical value, accumulate - ! as stress in offset soil water index - - if (psi <= soilpsi_off) then - offset_swi(p) = offset_swi(p) + fracday - - ! if the offset soil water index exceeds critical value, and - ! if this is not the middle of a previously initiated onset period, - ! then set flag to start the offset period and reset index variables - - if (offset_swi(p) >= crit_offset_swi .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 - - ! if soil water potential higher than critical value, reduce the - ! offset water stress index. By this mechanism, there must be a - ! sustained period of water stress to initiate offset. - - else if (psi >= soilpsi_on) then - offset_swi(p) = offset_swi(p) - fracday - offset_swi(p) = max(offset_swi(p),0._r8) - end if - - ! decrease freezing day accumulator for warm soil - if (offset_fdd(p) > 0._r8 .and. soilt > SHR_CONST_TKFRZ) then - offset_fdd(p) = offset_fdd(p) - fracday - offset_fdd(p) = max(0._r8, offset_fdd(p)) - end if - - ! increase freezing day accumulator for cold soil - if (soilt <= SHR_CONST_TKFRZ) then - offset_fdd(p) = offset_fdd(p) + fracday - - ! if freezing degree day sum is greater than critical value, initiate offset - if (offset_fdd(p) > crit_offset_fdd .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 - end if - - ! force offset if daylength is < 6 hrs - if (dayl(g) <= secspqtrday) then - offset_flag(p) = 1._r8 - end if - - ! if this is the beginning of the offset period - ! then reset flags and indices - if (offset_flag(p) == 1._r8) then - offset_fdd(p) = 0._r8 - offset_swi(p) = 0._r8 - offset_counter(p) = ndays_off * secspday - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! keep track of number of days since last dormancy for control on - ! fraction of new growth to send to storage for next growing season - - if (dormant_flag(p) == 0.0_r8) then - days_active(p) = days_active(p) + fracday - end if - - ! calculate long growing season factor (lgsf) - ! only begin to calculate a lgsf greater than 0.0 once the number - ! of days active exceeds days/year. - lgsf(p) = max(min(3.0_r8*(days_active(p)-leaf_long(ivt(p))*dayspyr )/dayspyr, 1._r8),0._r8) - ! RosieF. 5 Nov 2015. Changed this such that the increase in leaf turnover is faster after - ! trees enter the 'fake evergreen' state. Otherwise, they have a whole year of - ! cheating, with less litterfall than they should have, resulting in very high LAI. - ! Further, the 'fake evergreen' state (where lgsf>0) is entered at the end of a single leaf lifespan - ! and not a whole year. The '3' is arbitrary, given that this entire system is quite abstract. - - - ! set background litterfall rate, when not in the phenological offset period - if (offset_flag(p) == 1._r8) then - bglfr(p) = 0._r8 - else - ! calculate the background litterfall rate (bglfr) - ! in units 1/s, based on leaf longevity (yrs) and correction for long growing season - - bglfr(p) = (1._r8/(leaf_long(ivt(p))*dayspyr*secspday))*lgsf(p) - end if - - ! set background transfer rate when active but not in the phenological onset period - if (onset_flag(p) == 1._r8) then - bgtr(p) = 0._r8 - else - ! the background transfer rate is calculated as the rate that would result - ! in complete turnover of the storage pools in one year at steady state, - ! once lgsf has reached 1.0 (after 730 days active). - - bgtr(p) = (1._r8/(dayspyr*secspday))*lgsf(p) - - ! set carbon fluxes for shifting storage pools to transfer pools - - ! reduced the amount of stored carbon flowing to display pool by only counting the delta - ! between leafc and leafc_store in the flux. RosieF, Nov5 2015. - leafc_storage_to_xfer(p) = max(0.0_r8,(leafc_storage(p)-leafc(p))) * bgtr(p) - frootc_storage_to_xfer(p) = max(0.0_r8,(frootc_storage(p)-frootc(p))) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = livestemc_storage(p) * bgtr(p) - deadstemc_storage_to_xfer(p) = deadstemc_storage(p) * bgtr(p) - livecrootc_storage_to_xfer(p) = livecrootc_storage(p) * bgtr(p) - deadcrootc_storage_to_xfer(p) = deadcrootc_storage(p) * bgtr(p) - gresp_storage_to_xfer(p) = gresp_storage(p) * bgtr(p) - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = leafn_storage(p) * bgtr(p) - frootn_storage_to_xfer(p) = frootn_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = livestemn_storage(p) * bgtr(p) - deadstemn_storage_to_xfer(p) = deadstemn_storage(p) * bgtr(p) - livecrootn_storage_to_xfer(p) = livecrootn_storage(p) * bgtr(p) - deadcrootn_storage_to_xfer(p) = deadcrootn_storage(p) * bgtr(p) - end if - end if - - end if ! end if stress deciduous - - end do ! end of patch loop - - end associate - - end subroutine CNStressDecidPhenology - - !----------------------------------------------------------------------- - subroutine CropPhenology(num_pcropp, filter_pcropp , & - waterstate_inst, temperature_inst, crop_inst, canopystate_inst, cnveg_state_inst , & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst,& - c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst) - - ! !DESCRIPTION: - ! Code from AgroIBIS to determine crop phenology and code from CN to - ! handle CN fluxes during the phenological onset & offset periods. - - ! !USES: - use clm_time_manager , only : get_curr_date, get_curr_calday, get_days_per_year, get_rad_step_size - use pftconMod , only : ntmp_corn, nswheat, nwwheat, ntmp_soybean - use pftconMod , only : nirrig_tmp_corn, nirrig_swheat, nirrig_wwheat, nirrig_tmp_soybean - use pftconMod , only : ntrp_corn, nsugarcane, ntrp_soybean, ncotton, nrice - use pftconMod , only : nirrig_trp_corn, nirrig_sugarcane, nirrig_trp_soybean - use pftconMod , only : nirrig_cotton, nirrig_rice - use clm_varcon , only : spval, secspday - use clm_varctl , only : use_fertilizer - use clm_varctl , only : use_c13, use_c14 - use clm_varcon , only : c13ratio, c14ratio - ! - ! !ARGUMENTS: - integer , intent(in) :: num_pcropp ! number of prog crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(crop_type) , intent(inout) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - ! - ! LOCAL VARAIBLES: - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) - integer jday ! julian day of the year - integer fp,p ! patch indices - integer c ! column indices - integer g ! gridcell indices - integer h ! hemisphere indices - integer idpp ! number of days past planting - real(r8) :: dtrad ! radiation time step delta t (seconds) - real(r8) dayspyr ! days per year - real(r8) crmcorn ! comparitive relative maturity for corn - real(r8) ndays_on ! number of days to fertilize - !------------------------------------------------------------------------ - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - leaf_long => pftcon%leaf_long , & ! Input: leaf longevity (yrs) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - manunitro => pftcon%manunitro , & ! Input: max manure to be applied in total (kgN/m2) - mxmat => pftcon%mxmat , & ! Input: - minplanttemp => pftcon%minplanttemp , & ! Input: - planttemp => pftcon%planttemp , & ! Input: - gddmin => pftcon%gddmin , & ! Input: - hybgdd => pftcon%hybgdd , & ! Input: - lfemerg => pftcon%lfemerg , & ! Input: - grnfill => pftcon%grnfill , & ! Input: - - t_ref2m_min => temperature_inst%t_ref2m_min_patch , & ! Input: [real(r8) (:) ] daily minimum of average 2 m height surface air temperature (K) - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - a5tmin => temperature_inst%t_a5min_patch , & ! Input: [real(r8) (:) ] 5-day running mean of min 2-m temperature - a10tmin => temperature_inst%t_a10min_patch , & ! Input: [real(r8) (:) ] 10-day running mean of min 2-m temperature - gdd020 => temperature_inst%gdd020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd0 - gdd820 => temperature_inst%gdd820_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd8 - gdd1020 => temperature_inst%gdd1020_patch , & ! Input: [real(r8) (:) ] 20 yr mean of gdd10 - - fertnitro => crop_inst%fertnitro_patch , & ! Input: [real(r8) (:) ] fertilizer nitrogen - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] gdd since planting (gddplant) - leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] gdd from top soil layer temperature - harvdate => crop_inst%harvdate_patch , & ! Output: [integer (:) ] harvest date - croplive => crop_inst%croplive_patch , & ! Output: [logical (:) ] Flag, true if planted, not harvested - cropplant => crop_inst%cropplant_patch , & ! Output: [logical (:) ] Flag, true if crop may be planted - vf => crop_inst%vf_patch , & ! Output: [real(r8) (:) ] vernalization factor - peaklai => cnveg_state_inst%peaklai_patch , & ! Output: [integer (:) ] 1: max allowed lai; 0: not at max - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - - idop => cnveg_state_inst%idop_patch , & ! Output: [integer (:) ] date of planting - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest - huileaf => cnveg_state_inst%huileaf_patch , & ! Output: [real(r8) (:) ] heat unit index needed from planting to leaf emergence - huigrain => cnveg_state_inst%huigrain_patch , & ! Output: [real(r8) (:) ] same to reach vegetative maturity - cumvd => cnveg_state_inst%cumvd_patch , & ! Output: [real(r8) (:) ] cumulative vernalization d?ependence? - hdidx => cnveg_state_inst%hdidx_patch , & ! Output: [real(r8) (:) ] cold hardening index? - bglfr => cnveg_state_inst%bglfr_patch , & ! Output: [real(r8) (:) ] background litterfall rate (1/s) - bgtr => cnveg_state_inst%bgtr_patch , & ! Output: [real(r8) (:) ] background transfer growth rate (1/s) - lgsf => cnveg_state_inst%lgsf_patch , & ! Output: [real(r8) (:) ] long growing season factor [0-1] - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Output: [real(r8) (:) ] onset flag - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Output: [real(r8) (:) ] offset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Output: [real(r8) (:) ] onset counter - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Output: [real(r8) (:) ] offset counter - - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Output: [real(r8) (:) ] (gC/m2) leaf C transfer - - crop_seedc_to_leaf => cnveg_carbonflux_inst%crop_seedc_to_leaf_patch, & ! Output: [real(r8) (:) ] (gC/m2/s) seed source to leaf - - fert_counter => cnveg_nitrogenflux_inst%fert_counter_patch , & ! Output: [real(r8) (:) ] >0 fertilize; <=0 not (seconds) - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Output: [real(r8) (:) ] (gN/m2) leaf N transfer - crop_seedn_to_leaf => cnveg_nitrogenflux_inst%crop_seedn_to_leaf_patch, & ! Output: [real(r8) (:) ] (gN/m2/s) seed source to leaf - cphase => crop_inst%cphase_patch , & ! Output: [real(r8) (:)] phenology phase - fert => cnveg_nitrogenflux_inst%fert_patch & ! Output: [real(r8) (:) ] (gN/m2/s) fertilizer applied each timestep - ) - - ! get time info - dayspyr = get_days_per_year() - jday = get_curr_calday() - call get_curr_date(kyr, kmo, kda, mcsec) - dtrad = real( get_rad_step_size(), r8 ) - - if (use_fertilizer) then - ndays_on = 20._r8 ! number of days to fertilize - else - ndays_on = 0._r8 ! number of days to fertilize - end if - - do fp = 1, num_pcropp - p = filter_pcropp(fp) - c = patch%column(p) - g = patch%gridcell(p) - h = inhemi(p) - - ! background litterfall and transfer rates; long growing season factor - - bglfr(p) = 0._r8 ! this value changes later in a crop's life cycle - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - - ! --------------------------------- - ! from AgroIBIS subroutine planting - ! --------------------------------- - - ! in order to allow a crop to be planted only once each year - ! initialize cropplant = .false., but hold it = .true. through the end of the year - - ! initialize other variables that are calculated for crops - ! on an annual basis in cropresidue subroutine - - if ( jday == jdayyrstart(h) .and. mcsec == 0 )then - - ! make sure variables aren't changed at beginning of the year - ! for a crop that is currently planted, such as - ! WINTER TEMPERATE CEREAL = winter (wheat + barley + rye) - ! represented here by the winter wheat pft - - if (.not. croplive(p)) then - cropplant(p) = .false. - idop(p) = NOT_Planted - - ! keep next for continuous, annual winter temperate cereal crop; - ! if we removed elseif, - ! winter cereal grown continuously would amount to a cereal/fallow - ! rotation because cereal would only be planted every other year - - else if (croplive(p) .and. (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat)) then - cropplant(p) = .false. - ! else ! not possible to have croplive and ivt==cornORsoy? (slevis) - end if - - end if - - if ( (.not. croplive(p)) .and. (.not. cropplant(p)) ) then - - ! gdd needed for * chosen crop and a likely hybrid (for that region) * - ! to reach full physiological maturity - - ! based on accumulated seasonal average growing degree days from - ! April 1 - Sept 30 (inclusive) - ! for corn and soybeans in the United States - - ! decided upon by what the typical average growing season length is - ! and the gdd needed to reach maturity in those regions - - ! first choice is used for spring temperate cereal and/or soybeans and maize - - ! slevis: ibis reads xinpdate in io.f from control.crops.nc variable name 'plantdate' - ! According to Chris Kucharik, the dataset of - ! xinpdate was generated from a previous model run at 0.5 deg resolution - - ! winter temperate cereal : use gdd0 as a limit to plant winter cereal - - if (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat) then - - ! add check to only plant winter cereal after other crops (soybean, maize) - ! have been harvested - - ! *** remember order of planting is crucial - in terms of which crops you want - ! to be grown in what order *** - - ! in this case, corn or soybeans are assumed to be planted before - ! cereal would be in any particular year that both patches are allowed - ! to grow in the same grid cell (e.g., double-cropping) - - ! slevis: harvdate below needs cropplant(p) above to be cropplant(p,ivt(p)) - ! where ivt(p) has rotated to winter cereal because - ! cropplant through the end of the year for a harvested crop. - ! Also harvdate(p) should be harvdate(p,ivt(p)) and should be - ! updated on Jan 1st instead of at harvest (slevis) - if (a5tmin(p) /= spval .and. & - a5tmin(p) <= minplanttemp(ivt(p)) .and. & - jday >= minplantjday(ivt(p),h) .and. & - (gdd020(p) /= spval .and. & - gdd020(p) >= gddmin(ivt(p)))) then - - cumvd(p) = 0._r8 - hdidx(p) = 0._r8 - vf(p) = 0._r8 - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - gddmaturity(p) = hybgdd(ivt(p)) - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - - ! latest possible date to plant winter cereal and after all other - ! crops were harvested for that year - - else if (jday >= maxplantjday(ivt(p),h) .and. & - gdd020(p) /= spval .and. & - gdd020(p) >= gddmin(ivt(p))) then - - cumvd(p) = 0._r8 - hdidx(p) = 0._r8 - vf(p) = 0._r8 - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - gddmaturity(p) = hybgdd(ivt(p)) - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - else - gddmaturity(p) = 0._r8 - end if - - else ! not winter cereal... slevis: added distinction between NH and SH - ! slevis: The idea is that jday will equal idop sooner or later in the year - ! while the gdd part is either true or false for the year. - if (t10(p) /= spval.and. a10tmin(p) /= spval .and. & - t10(p) > planttemp(ivt(p)) .and. & - a10tmin(p) > minplanttemp(ivt(p)) .and. & - jday >= minplantjday(ivt(p),h) .and. & - jday <= maxplantjday(ivt(p),h) .and. & - t10(p) /= spval .and. a10tmin(p) /= spval .and. & - gdd820(p) /= spval .and. & - gdd820(p) >= gddmin(ivt(p))) then - - ! impose limit on growing season length needed - ! for crop maturity - for cold weather constraints - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - - ! go a specified amount of time before/after - ! climatological date - if (ivt(p) == ntmp_soybean .or. ivt(p) == nirrig_tmp_soybean .or. & - ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then - gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) - end if - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then - gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) - gddmaturity(p) = max(950._r8, min(gddmaturity(p)+150._r8, 1850._r8)) - end if - if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & - ivt(p) == ncotton .or. ivt(p) == nirrig_cotton .or. & - ivt(p) == nrice .or. ivt(p) == nirrig_rice) then - gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) - end if - - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - - - ! If hit the max planting julian day -- go ahead and plant - else if (jday == maxplantjday(ivt(p),h) .and. gdd820(p) > 0._r8 .and. & - gdd820(p) /= spval ) then - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - - if (ivt(p) == ntmp_soybean .or. ivt(p) == nirrig_tmp_soybean .or. & - ivt(p) == ntrp_soybean .or. ivt(p) == nirrig_trp_soybean) then - gddmaturity(p) = min(gdd1020(p), hybgdd(ivt(p))) - end if - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then - gddmaturity(p) = max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) - end if - if (ivt(p) == nswheat .or. ivt(p) == nirrig_swheat .or. & - ivt(p) == ncotton .or. ivt(p) == nirrig_cotton .or. & - ivt(p) == nrice .or. ivt(p) == nirrig_rice) then - gddmaturity(p) = min(gdd020(p), hybgdd(ivt(p))) - end if - - leafc_xfer(p) = initial_seed_at_planting - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - crop_seedc_to_leaf(p) = leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = leafn_xfer(p)/dt - - ! because leafc_xfer is set above rather than incremneted through the normal process, must also set its isotope - ! pools here. use totvegc_patch as the closest analogue if nonzero, and use initial value otherwise - if (use_c13) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c13_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c13ratio - endif - endif - if (use_c14) then - if ( cnveg_carbonstate_inst%totvegc_patch(p) .gt. 0._r8) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * & - c14_cnveg_carbonstate_inst%totvegc_patch(p) / cnveg_carbonstate_inst%totvegc_patch(p) - else - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = leafc_xfer(p) * c14ratio - endif - endif - - else - gddmaturity(p) = 0._r8 - end if - end if ! crop patch distinction - - ! crop phenology (gdd thresholds) controlled by gdd needed for - ! maturity (physiological) which is based on the average gdd - ! accumulation and hybrids in United States from April 1 - Sept 30 - - ! calculate threshold from phase 1 to phase 2: - ! threshold for attaining leaf emergence (based on fraction of - ! gdd(i) -- climatological average) - ! Hayhoe and Dwyer, 1990, Can. J. Soil Sci 70:493-497 - ! Carlson and Gage, 1989, Agric. For. Met., 45: 313-324 - ! J.T. Ritchie, 1991: Modeling Plant and Soil systems - - huileaf(p) = lfemerg(ivt(p)) * gddmaturity(p) ! 3-7% in cereal - - ! calculate threshhold from phase 2 to phase 3: - ! from leaf emergence to beginning of grain-fill period - ! this hypothetically occurs at the end of tassling, not the beginning - ! tassel initiation typically begins at 0.5-0.55 * gddmaturity - - ! calculate linear relationship between huigrain fraction and relative - ! maturity rating for maize - - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then - ! the following estimation of crmcorn from gddmaturity is based on a linear - ! regression using data from Pioneer-brand corn hybrids (Kucharik, 2003, - ! Earth Interactions 7:1-33: fig. 2) - crmcorn = max(73._r8, min(135._r8, (gddmaturity(p)+ 53.683_r8)/13.882_r8)) - - ! the following adjustment of grnfill based on crmcorn is based on a tuning - ! of Agro-IBIS to give reasonable results for max LAI and the seasonal - ! progression of LAI growth (pers. comm. C. Kucharik June 10, 2010) - huigrain(p) = -0.002_r8 * (crmcorn - 73._r8) + grnfill(ivt(p)) - - huigrain(p) = min(max(huigrain(p), grnfill(ivt(p))-0.1_r8), grnfill(ivt(p))) - huigrain(p) = huigrain(p) * gddmaturity(p) ! Cabelguenne et - else - huigrain(p) = grnfill(ivt(p)) * gddmaturity(p) ! al. 1999 - end if - - end if ! crop not live nor planted - - ! ---------------------------------- - ! from AgroIBIS subroutine phenocrop - ! ---------------------------------- - - ! all of the phenology changes are based on the total number of gdd needed - ! to change to the next phase - based on fractions of the total gdd typical - ! for that region based on the April 1 - Sept 30 window of development - - ! crop phenology (gdd thresholds) controlled by gdd needed for - ! maturity (physiological) which is based on the average gdd - ! accumulation and hybrids in United States from April 1 - Sept 30 - - ! Phase 1: Planting to leaf emergence (now in CNAllocation) - ! Phase 2: Leaf emergence to beginning of grain fill (general LAI accumulation) - ! Phase 3: Grain fill to physiological maturity and harvest (LAI decline) - ! Harvest: if gdd past grain fill initiation exceeds limit - ! or number of days past planting reaches a maximum, the crop has - ! reached physiological maturity and plant is harvested; - ! crop could be live or dead at this stage - these limits - ! could lead to reaching physiological maturity or determining - ! a harvest date for a crop killed by an early frost (see next comments) - ! --- --- --- - ! keeping comments without the code (slevis): - ! if minimum temperature, t_ref2m_min <= freeze kill threshold, tkill - ! for 3 consecutive days and lai is above a minimum, - ! plant will be damaged/killed. This function is more for spring freeze events - ! or for early fall freeze events - - ! spring temperate cereal is affected by this, winter cereal kill function - ! is determined in crops.f - is a more elaborate function of - ! cold hardening of the plant - - ! currently simulates too many grid cells killed by freezing temperatures - - ! removed on March 12 2002 - C. Kucharik - ! until it can be a bit more refined, or used at a smaller scale. - ! we really have no way of validating this routine - ! too difficult to implement on 0.5 degree scale grid cells - ! --- --- --- - - onset_flag(p) = 0._r8 ! CN terminology to trigger certain - offset_flag(p) = 0._r8 ! carbon and nitrogen transfers - - if (croplive(p)) then - cphase(p) = 1._r8 - - ! call vernalization if winter temperate cereal planted, living, and the - ! vernalization factor is not 1; - ! vf affects the calculation of gddtsoi & gddplant - - if (t_ref2m_min(p) < 1.e30_r8 .and. vf(p) /= 1._r8 .and. & - (ivt(p) == nwwheat .or. ivt(p) == nirrig_wwheat)) then - call vernalization(p, & - canopystate_inst, temperature_inst, waterstate_inst, cnveg_state_inst, & - crop_inst) - end if - - ! days past planting may determine harvest - - if (jday >= idop(p)) then - idpp = jday - idop(p) - else - idpp = int(dayspyr) + jday - idop(p) - end if - - ! onset_counter initialized to zero when .not. croplive - ! offset_counter relevant only at time step of harvest - - onset_counter(p) = onset_counter(p) - dt - - ! enter phase 2 onset for one time step: - ! transfer seed carbon to leaf emergence - - if (peaklai(p) >= 1) then - hui(p) = max(hui(p),huigrain(p)) - endif - - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat(ivt(p))) then - cphase(p) = 2._r8 - if (abs(onset_counter(p)) > 1.e-6_r8) then - onset_flag(p) = 1._r8 - onset_counter(p) = dt - fert_counter(p) = ndays_on * secspday - if (ndays_on .gt. 0) then - fert(p) = (manunitro(ivt(p)) * 1000._r8 + fertnitro(p))/ fert_counter(p) - else - fert(p) = 0._r8 - end if - else - ! this ensures no re-entry to onset of phase2 - ! b/c onset_counter(p) = onset_counter(p) - dt - ! at every time step - - onset_counter(p) = dt - end if - - ! enter harvest for one time step: - ! - transfer live biomass to litter and to crop yield - ! - send xsmrpool to the atmosphere - ! if onset and harvest needed to last longer than one timestep - ! the onset_counter would change from dt and you'd need to make - ! changes to the offset subroutine below - - else if (hui(p) >= gddmaturity(p) .or. idpp >= mxmat(ivt(p))) then - if (harvdate(p) >= NOT_Harvested) harvdate(p) = jday - croplive(p) = .false. ! no re-entry in greater if-block - cphase(p) = 4._r8 - if (tlai(p) > 0._r8) then ! plant had emerged before harvest - offset_flag(p) = 1._r8 - offset_counter(p) = dt - else ! plant never emerged from the ground - ! Revert planting transfers; this will replenish the crop seed deficit. - ! We subtract from any existing value in crop_seedc_to_leaf / - ! crop_seedn_to_leaf in the unlikely event that we enter this block of - ! code in the same time step where the planting transfer originally - ! occurred. - crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) - if (use_c13) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - if (use_c14) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - - end if - - ! enter phase 3 while previous criteria fail and next is true; - ! in terms of order, phase 3 occurs before harvest, but when - ! harvest *can* occur, we want it to have first priority. - ! AgroIBIS uses a complex formula for lai decline. - ! Use CN's simple formula at least as a place holder (slevis) - - else if (hui(p) >= huigrain(p)) then - cphase(p) = 3._r8 - bglfr(p) = 1._r8/(leaf_long(ivt(p))*dayspyr*secspday) - end if - - ! continue fertilizer application while in phase 2; - ! assumes that onset of phase 2 took one time step only - - if (fert_counter(p) <= 0._r8) then - fert(p) = 0._r8 - else ! continue same fert application every timestep - fert_counter(p) = fert_counter(p) - dtrad - end if - - else ! crop not live - ! next 2 lines conserve mass if leaf*_xfer > 0 due to interpinic. - ! We subtract from any existing value in crop_seedc_to_leaf / - ! crop_seedn_to_leaf in the unlikely event that we enter this block of - ! code in the same time step where the planting transfer originally - ! occurred. - crop_seedc_to_leaf(p) = crop_seedc_to_leaf(p) - leafc_xfer(p)/dt - crop_seedn_to_leaf(p) = crop_seedn_to_leaf(p) - leafn_xfer(p)/dt - onset_counter(p) = 0._r8 - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) - if (use_c13) then - c13_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - if (use_c14) then - c14_cnveg_carbonstate_inst%leafc_xfer_patch(p) = 0._r8 - endif - end if ! croplive - - end do ! prognostic crops loop - - end associate - - end subroutine CropPhenology - - !----------------------------------------------------------------------- - subroutine CropPhenologyInit(bounds) - ! - ! !DESCRIPTION: - ! Initialization of CropPhenology. Must be called after time-manager is - ! initialized, and after pftcon file is read in. - ! - ! !USES: - use pftconMod , only: npcropmin, npcropmax - use clm_time_manager, only: get_calday - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! LOCAL VARAIBLES: - integer :: p,g,n,i ! indices - !------------------------------------------------------------------------ - - allocate( inhemi(bounds%begp:bounds%endp) ) - - allocate( minplantjday(0:numpft,inSH)) ! minimum planting julian day - allocate( maxplantjday(0:numpft,inSH)) ! minimum planting julian day - - ! Julian day for the start of the year (mid-winter) - jdayyrstart(inNH) = 1 - jdayyrstart(inSH) = 182 - - ! Convert planting dates into julian day - minplantjday(:,:) = huge(1) - maxplantjday(:,:) = huge(1) - do n = npcropmin, npcropmax - if (pftcon%is_pft_known_to_model(n)) then - minplantjday(n, inNH) = int( get_calday( pftcon%mnNHplantdate(n), 0 ) ) - maxplantjday(n, inNH) = int( get_calday( pftcon%mxNHplantdate(n), 0 ) ) - - minplantjday(n, inSH) = int( get_calday( pftcon%mnSHplantdate(n), 0 ) ) - maxplantjday(n, inSH) = int( get_calday( pftcon%mxSHplantdate(n), 0 ) ) - end if - end do - - ! Figure out what hemisphere each PATCH is in - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - ! Northern hemisphere - if ( grc%latdeg(g) > 0.0_r8 )then - inhemi(p) = inNH - else - inhemi(p) = inSH - end if - end do - - ! - ! Constants for Crop vernalization - ! - ! photoperiod factor calculation - ! genetic constant - can be modified - - p1d = 0.004_r8 ! average for genotypes from Ritchey, 1991. - ! Modeling plant & soil systems: Wheat phasic developmt - p1v = 0.003_r8 ! average for genotypes from Ritchey, 1991. - - hti = 1._r8 - tbase = 0._r8 - - end subroutine CropPhenologyInit - - !----------------------------------------------------------------------- - subroutine vernalization(p, & - canopystate_inst, temperature_inst, waterstate_inst, cnveg_state_inst, crop_inst) - ! - ! !DESCRIPTION: - ! - ! * * * only call for winter temperate cereal * * * - ! - ! subroutine calculates vernalization and photoperiod effects on - ! gdd accumulation in winter temperate cereal varieties. Thermal time accumulation - ! is reduced in 1st period until plant is fully vernalized. During this - ! time of emergence to spikelet formation, photoperiod can also have a - ! drastic effect on plant development. - ! - ! !ARGUMENTS: - integer , intent(in) :: p ! PATCH index running over - type(canopystate_type) , intent(in) :: canopystate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(inout) :: crop_inst - ! - ! LOCAL VARAIBLES: - real(r8) tcrown ! ? - real(r8) vd, vd1, vd2 ! vernalization dependence - real(r8) tkil ! Freeze kill threshold - integer c,g ! indices - !------------------------------------------------------------------------ - - associate( & - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2 m height surface air temperature (K) - t_ref2m_min => temperature_inst%t_ref2m_min_patch , & ! Input: [real(r8) (:) ] daily minimum of average 2 m height surface air temperature (K) - t_ref2m_max => temperature_inst%t_ref2m_max_patch , & ! Input: [real(r8) (:) ] daily maximum of average 2 m height surface air temperature (K) - - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - - hdidx => cnveg_state_inst%hdidx_patch , & ! Output: [real(r8) (:) ] cold hardening index? - cumvd => cnveg_state_inst%cumvd_patch , & ! Output: [real(r8) (:) ] cumulative vernalization d?ependence? - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Output: [real(r8) (:) ] gdd needed to harvest - huigrain => cnveg_state_inst%huigrain_patch , & ! Output: [real(r8) (:) ] heat unit index needed to reach vegetative maturity - - vf => crop_inst%vf_patch & ! Output: [real(r8) (:) ] vernalization factor for cereal - ) - - c = patch%column(p) - - ! for all equations - temperatures must be in degrees (C) - ! calculate temperature of crown of crop (e.g., 3 cm soil temperature) - ! snow depth in centimeters - - if (t_ref2m(p) < tfrz) then !slevis: t_ref2m inst of td=daily avg (K) - tcrown = 2._r8 + (t_ref2m(p) - tfrz) * (0.4_r8 + 0.0018_r8 * & - (min(snow_depth(c)*100._r8, 15._r8) - 15._r8)**2) - else !slevis: snow_depth inst of adsnod=daily average (m) - tcrown = t_ref2m(p) - tfrz - end if - - ! vernalization factor calculation - ! if vf(p) = 1. then plant is fully vernalized - and thermal time - ! accumulation in phase 1 will be unaffected - ! refers to gddtsoi & gddplant, defined in the accumulation routines (slevis) - ! reset vf, cumvd, and hdidx to 0 at planting of crop (slevis) - - if (t_ref2m_max(p) > tfrz) then - if (t_ref2m_min(p) <= tfrz+15._r8) then - vd1 = 1.4_r8 - 0.0778_r8 * tcrown - vd2 = 0.5_r8 + 13.44_r8 / ((t_ref2m_max(p)-t_ref2m_min(p)+3._r8)**2) * tcrown - vd = max(0._r8, min(1._r8, vd1, vd2)) - cumvd(p) = cumvd(p) + vd - end if - - if (cumvd(p) < 10._r8 .and. t_ref2m_max(p) > tfrz+30._r8) then - cumvd(p) = cumvd(p) - 0.5_r8 * (t_ref2m_max(p) - tfrz - 30._r8) - end if - cumvd(p) = max(0._r8, cumvd(p)) ! must be > 0 - - vf(p) = 1._r8 - p1v * (50._r8 - cumvd(p)) - vf(p) = max(0._r8, min(vf(p), 1._r8)) ! must be between 0 - 1 - end if - - ! calculate cold hardening of plant - ! determines for winter cereal varieties whether the plant has completed - ! a period of cold hardening to protect it from freezing temperatures. If - ! not, then exposure could result in death or killing of plants. - - ! there are two distinct phases of hardening - - if (t_ref2m_min(p) <= tfrz-3._r8 .or. hdidx(p) /= 0._r8) then - if (hdidx(p) >= hti) then ! done with phase 1 - hdidx(p) = hdidx(p) + 0.083_r8 - hdidx(p) = min(hdidx(p), hti*2._r8) - end if - - if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then - hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - hdidx(p) = max(0._r8, hdidx(p)) - end if - - else if (tcrown >= tbase-1._r8) then - if (tcrown <= tbase+8._r8) then - hdidx(p) = hdidx(p) + 0.1_r8 - (tcrown-tbase+3.5_r8)**2 / 506._r8 - if (hdidx(p) >= hti .and. tcrown <= tbase + 0._r8) then - hdidx(p) = hdidx(p) + 0.083_r8 - hdidx(p) = min(hdidx(p), hti*2._r8) - end if - end if - - if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then - hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - hdidx(p) = max(0._r8, hdidx(p)) - end if - end if - - ! calculate what the cereal killing temperature - ! there is a linear inverse relationship between - ! hardening of the plant and the killing temperature or - ! threshold that the plant can withstand - ! when plant is fully-hardened (hdidx = 2), the killing threshold is -18 C - - ! will have to develop some type of relationship that reduces LAI and - ! biomass pools in response to cold damaged crop - - if (t_ref2m_min(p) <= tfrz - 6._r8) then - tkil = (tbase - 6._r8) - 6._r8 * hdidx(p) - if (tkil >= tcrown) then - if ((0.95_r8 - 0.02_r8 * (tcrown - tkil)**2) >= 0.02_r8) then - write (iulog,*) 'crop damaged by cold temperatures at p,c =', p,c - else if (tlai(p) > 0._r8) then ! slevis: kill if past phase1 - gddmaturity(p) = 0._r8 ! by forcing through - huigrain(p) = 0._r8 ! harvest - write (iulog,*) '95% of crop killed by cold temperatures at p,c =', p,c - end if - end if - end if - - end associate - - end subroutine vernalization - - !----------------------------------------------------------------------- - subroutine CNOnsetGrowth (num_soilp, filter_soilp, & - cnveg_state_inst, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of stored C and N from transfer pools to display - ! pools during the phenological onset period. - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8):: t1 ! temporary variable - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - - onset_flag => cnveg_state_inst%onset_flag_patch , & ! Input: [real(r8) (:) ] onset flag - onset_counter => cnveg_state_inst%onset_counter_patch , & ! Input: [real(r8) (:) ] onset days counter - bgtr => cnveg_state_inst%bgtr_patch , & ! Input: [real(r8) (:) ] background transfer growth rate (1/s) - - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - - leafc_xfer_to_leafc => cnveg_carbonflux_inst%leafc_xfer_to_leafc_patch , & ! Output: [real(r8) (:) ] - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Output: [real(r8) (:) ] - livestemc_xfer_to_livestemc => cnveg_carbonflux_inst%livestemc_xfer_to_livestemc_patch , & ! Output: [real(r8) (:) ] - deadstemc_xfer_to_deadstemc => cnveg_carbonflux_inst%deadstemc_xfer_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_xfer_to_livecrootc => cnveg_carbonflux_inst%livecrootc_xfer_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - deadcrootc_xfer_to_deadcrootc => cnveg_carbonflux_inst%deadcrootc_xfer_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - - leafn_xfer_to_leafn => cnveg_nitrogenflux_inst%leafn_xfer_to_leafn_patch , & ! Output: [real(r8) (:) ] - frootn_xfer_to_frootn => cnveg_nitrogenflux_inst%frootn_xfer_to_frootn_patch , & ! Output: [real(r8) (:) ] - livestemn_xfer_to_livestemn => cnveg_nitrogenflux_inst%livestemn_xfer_to_livestemn_patch , & ! Output: [real(r8) (:) ] - deadstemn_xfer_to_deadstemn => cnveg_nitrogenflux_inst%deadstemn_xfer_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livecrootn_xfer_to_livecrootn => cnveg_nitrogenflux_inst%livecrootn_xfer_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - deadcrootn_xfer_to_deadcrootn => cnveg_nitrogenflux_inst%deadcrootn_xfer_to_deadcrootn_patch & ! Output: [real(r8) (:) ] - ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes during onset period - if (onset_flag(p) == 1._r8) then - - ! The transfer rate is a linearly decreasing function of time, - ! going to zero on the last timestep of the onset period - - if (onset_counter(p) == dt) then - t1 = 1.0_r8 / dt - else - t1 = 2.0_r8 / (onset_counter(p)) - end if - leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) - frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) - leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) - frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) - deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) - livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) - livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) - deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) - livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) - deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) - end if - - end if ! end if onset period - - ! calculate the background rate of transfer growth (used for stress - ! deciduous algorithm). In this case, all of the mass in the transfer - ! pools should be moved to displayed growth in each timestep. - - if (bgtr(p) > 0._r8) then - leafc_xfer_to_leafc(p) = leafc_xfer(p) / dt - frootc_xfer_to_frootc(p) = frootc_xfer(p) / dt - leafn_xfer_to_leafn(p) = leafn_xfer(p) / dt - frootn_xfer_to_frootn(p) = frootn_xfer(p) / dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = livestemc_xfer(p) / dt - deadstemc_xfer_to_deadstemc(p) = deadstemc_xfer(p) / dt - livecrootc_xfer_to_livecrootc(p) = livecrootc_xfer(p) / dt - deadcrootc_xfer_to_deadcrootc(p) = deadcrootc_xfer(p) / dt - livestemn_xfer_to_livestemn(p) = livestemn_xfer(p) / dt - deadstemn_xfer_to_deadstemn(p) = deadstemn_xfer(p) / dt - livecrootn_xfer_to_livecrootn(p) = livecrootn_xfer(p) / dt - deadcrootn_xfer_to_deadcrootn(p) = deadcrootn_xfer(p) / dt - end if - end if ! end if bgtr - - end do ! end patch loop - - end associate - - end subroutine CNOnsetGrowth - - !----------------------------------------------------------------------- - subroutine CNOffsetLitterfall (num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of C and N from displayed pools to litter - ! pools during the phenological offset period. - ! - ! !USES: - use pftconMod , only : npcropmin - use CNSharedParamsMod, only : use_fun - use clm_varctl , only : CNratio_floating - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p, c ! indices - integer :: fp ! lake filter patch index - real(r8):: t1 ! temporary variable - real(r8):: denom ! temporary variable for divisor - real(r8) :: ntovr_leaf - real(r8) :: fr_leafn_to_litter ! fraction of the nitrogen turnover that goes to litter; remaining fraction is retranslocated - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) - - offset_flag => cnveg_state_inst%offset_flag_patch , & ! Input: [real(r8) (:) ] offset flag - offset_counter => cnveg_state_inst%offset_counter_patch , & ! Input: [real(r8) (:) ] offset days counter - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - grainc => cnveg_carbonstate_inst%grainc_patch , & ! Input: [real(r8) (:) ] (gC/m2) grain C - cropseedc_deficit => cnveg_carbonstate_inst%cropseedc_deficit_patch , & ! Input: [real(r8) (:) ] (gC/m2) crop seed C deficit - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) livestem C - cropseedn_deficit => cnveg_nitrogenstate_inst%cropseedn_deficit_patch , & ! Input: [real(r8) (:) ] (gC/m2) crop seed N deficit - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N - - cpool_to_grainc => cnveg_carbonflux_inst%cpool_to_grainc_patch , & ! Input: [real(r8) (:) ] allocation to grain C (gC/m2/s) - npool_to_grainn => cnveg_nitrogenflux_inst%npool_to_grainn_patch , & ! Input: [real(r8) (:) ] allocation to grain N (gN/m2/s) - grainn => cnveg_nitrogenstate_inst%grainn_patch , & ! Input: [real(r8) (:) ] (kgN/m2) grain N - cpool_to_livestemc => cnveg_carbonflux_inst%cpool_to_livestemc_patch , & ! Input: [real(r8) (:) ] allocation to live stem C (gC/m2/s) - cpool_to_leafc => cnveg_carbonflux_inst%cpool_to_leafc_patch , & ! Input: [real(r8) (:) ] allocation to leaf C (gC/m2/s) - cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Input: [real(r8) (:) ] allocation to fine root C (gC/m2/s) - prev_leafc_to_litter => cnveg_carbonflux_inst%prev_leafc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep leaf C litterfall flux (gC/m2/s) - prev_frootc_to_litter => cnveg_carbonflux_inst%prev_frootc_to_litter_patch , & ! Output: [real(r8) (:) ] previous timestep froot C litterfall flux (gC/m2/s) - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] leaf C litterfall (gC/m2/s) - frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] fine root C litterfall (gC/m2/s) - livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Output: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Output: [real(r8) (:) ] grain C to food (gC/m2/s) - grainc_to_seed => cnveg_carbonflux_inst%grainc_to_seed_patch , & ! Output: [real(r8) (:) ] grain C to seed (gC/m2/s) - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - - livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Output: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Output: [real(r8) (:) ] grain N to food (gN/m2/s) - grainn_to_seed => cnveg_nitrogenflux_inst%grainn_to_seed_patch , & ! Output: [real(r8) (:) ] grain N to seed (gN/m2/s) - leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] leaf N litterfall (gN/m2/s) - leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Input: [real(r8) (:) ] leaf N to retranslocated N pool (gN/m2/s) - free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - paid_retransn_to_npool=> cnveg_nitrogenflux_inst%retransn_to_npool_patch, & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Output: [real(r8) (:) ] fine root N litterfall (gN/m2/s) - leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch , & ! Output: [real(r8) (:) ] leaf C litterfall used by FUN (gC/m2/s) - leafcn_offset => cnveg_state_inst%leafcn_offset_patch & ! Output: [real(r8) (:) ] Leaf C:N used by FUN - ) - - ! The litterfall transfer rate starts at 0.0 and increases linearly - ! over time, with displayed growth going to 0.0 on the last day of litterfall - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate fluxes during offset period - if (offset_flag(p) == 1._r8) then - - if (offset_counter(p) == dt) then - t1 = 1.0_r8 / dt - leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) - frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) - ! this assumes that offset_counter == dt for crops - ! if this were ever changed, we'd need to add code to the "else" - if (ivt(p) >= npcropmin) then - ! Replenish the seed deficits from grain, if there is enough - ! available grain. (If there is not enough available grain, the seed - ! deficits will accumulate until there is eventually enough grain to - ! replenish them.) - grainc_to_seed(p) = t1 * min(-cropseedc_deficit(p), grainc(p)) - grainn_to_seed(p) = t1 * min(-cropseedn_deficit(p), grainn(p)) - ! Send the remaining grain to the food product pool - grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - grainc_to_seed(p) - grainn_to_food(p) = t1 * grainn(p) + npool_to_grainn(p) - grainn_to_seed(p) - - livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) - end if - else - t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) - leafc_to_litter(p) = prev_leafc_to_litter(p) + t1*(leafc(p) - prev_leafc_to_litter(p)*offset_counter(p)) - frootc_to_litter(p) = prev_frootc_to_litter(p) + t1*(frootc(p) - prev_frootc_to_litter(p)*offset_counter(p)) - - end if - - if ( use_fun ) then - if(leafc_to_litter(p)*dt.gt.leafc(p))then - leafc_to_litter(p) = leafc(p)/dt + cpool_to_leafc(p) - endif - if(frootc_to_litter(p)*dt.gt.frootc(p))then - frootc_to_litter(p) = frootc(p)/dt + cpool_to_frootc(p) - endif - end if - - - if ( use_fun ) then - leafc_to_litter_fun(p) = leafc_to_litter(p) - leafn_to_retransn(p) = paid_retransn_to_npool(p) + free_retransn_to_npool(p) - if (leafn(p).gt.0._r8) then - if (leafn(p)-leafn_to_retransn(p)*dt.gt.0._r8) then - leafcn_offset(p) = leafc(p)/(leafn(p)-leafn_to_retransn(p)*dt) - else - leafcn_offset(p) = leafc(p)/leafn(p) - end if - else - leafcn_offset(p) = leafcn(ivt(p)) - end if - leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p) - leafn_to_litter(p) = max(leafn_to_litter(p),0._r8) - - denom = ( leafn_to_retransn(p) + leafn_to_litter(p) ) - if ( denom /= 0.0_r8 ) then - fr_leafn_to_litter = leafn_to_litter(p) / ( leafn_to_retransn(p) + leafn_to_litter(p) ) - else if ( leafn_to_litter(p) == 0.0_r8 ) then - fr_leafn_to_litter = 0.0_r8 - else - fr_leafn_to_litter = 1.0_r8 - end if - - else - if (CNratio_floating .eqv. .true.) then - fr_leafn_to_litter = 0.5_r8 ! assuming 50% of nitrogen turnover goes to litter - end if - ! calculate the leaf N litterfall and retranslocation - leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) - leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) - - end if - - ! calculate fine root N litterfall (no retranslocation of fine root N) - frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (leafc(p) == 0.0_r8) then - ntovr_leaf = 0.0_r8 - else - ntovr_leaf = leafc_to_litter(p) * (leafn(p) / leafc(p)) - end if - - leafn_to_litter(p) = fr_leafn_to_litter * ntovr_leaf - leafn_to_retransn(p) = ntovr_leaf - leafn_to_litter(p) - if (frootc(p) == 0.0_r8) then - frootn_to_litter(p) = 0.0_r8 - else - frootn_to_litter(p) = frootc_to_litter(p) * (frootn(p) / frootc(p)) - end if - end if - - if ( use_fun ) then - if(frootn_to_litter(p)*dt.gt.frootn(p))then - frootn_to_litter(p) = frootn(p)/dt - endif - end if - - if (ivt(p) >= npcropmin) then - ! NOTE(slevis, 2014-12) results in -ve livestemn and -ve totpftn - !X! livestemn_to_litter(p) = livestemc_to_litter(p) / livewdcn(ivt(p)) - ! NOTE(slevis, 2014-12) Beth Drewniak suggested this instead - livestemn_to_litter(p) = livestemn(p) / dt - end if - - ! save the current litterfall fluxes - prev_leafc_to_litter(p) = leafc_to_litter(p) - prev_frootc_to_litter(p) = frootc_to_litter(p) - - end if ! end if offset period - - end do ! end patch loop - - end associate - - end subroutine CNOffsetLitterfall - - !----------------------------------------------------------------------- - subroutine CNBackgroundLitterfall (num_soilp, filter_soilp, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of C and N from displayed pools to litter - ! pools as the result of background litter fall. - ! - ! !USES: - use CNSharedParamsMod , only : use_fun - use clm_varctl , only : CNratio_floating - ! !ARGUMENTS: - implicit none - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8) :: fr_leafn_to_litter ! fraction of the nitrogen turnover that goes to litter; remaining fraction is retranslocated - real(r8) :: ntovr_leaf - real(r8) :: denom - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - lflitcn => pftcon%lflitcn , & ! Input: leaf litter C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - - bglfr => cnveg_state_inst%bglfr_patch , & ! Input: [real(r8) (:) ] background litterfall rate (1/s) - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) fine root C - - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Output: [real(r8) (:) ] - frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Output: [real(r8) (:) ] - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Output: [real(r8) (:) ] - leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Output: [real(r8) (:) ] - frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Output: [real(r8) (:) ] - leafc_to_litter_fun => cnveg_carbonflux_inst%leafc_to_litter_fun_patch, & ! Output: [real(r8) (:) ] leaf C litterfall used by FUN (gC/m2/s) - leafcn_offset => cnveg_state_inst%leafcn_offset_patch , & ! Output: [real(r8) (:) ] Leaf C:N used by FUN - free_retransn_to_npool=> cnveg_nitrogenflux_inst%free_retransn_to_npool_patch , & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - paid_retransn_to_npool=> cnveg_nitrogenflux_inst%retransn_to_npool_patch & ! Input: [real(r8) (:) ] free leaf N to retranslocated N pool (gN/m2/s) - ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes if the background litterfall rate is non-zero - if (bglfr(p) > 0._r8) then - ! units for bglfr are already 1/s - leafc_to_litter(p) = bglfr(p) * leafc(p) - frootc_to_litter(p) = bglfr(p) * frootc(p) - if ( use_fun ) then - leafc_to_litter_fun(p) = leafc_to_litter(p) - leafn_to_retransn(p) = paid_retransn_to_npool(p) + free_retransn_to_npool(p) - if (leafn(p).gt.0._r8) then - if (leafn(p)-leafn_to_retransn(p)*dt.gt.0._r8) then - leafcn_offset(p) = leafc(p)/(leafn(p)-leafn_to_retransn(p)*dt) - else - leafcn_offset(p) = leafc(p)/leafn(p) - end if - else - leafcn_offset(p) = leafcn(ivt(p)) - end if - leafn_to_litter(p) = leafc_to_litter(p)/leafcn_offset(p) - leafn_to_retransn(p) - leafn_to_litter(p) = max(leafn_to_litter(p),0._r8) - - denom = ( leafn_to_retransn(p) + leafn_to_litter(p) ) - if ( denom /= 0.0_r8 ) then - fr_leafn_to_litter = leafn_to_litter(p) / ( leafn_to_retransn(p) + leafn_to_litter(p) ) - else if ( leafn_to_litter(p) == 0.0_r8 ) then - fr_leafn_to_litter = 0.0_r8 - else - fr_leafn_to_litter = 1.0_r8 - end if - - - else - if (CNratio_floating .eqv. .true.) then - fr_leafn_to_litter = 0.5_r8 ! assuming 50% of nitrogen turnover goes to litter - end if - ! calculate the leaf N litterfall and retranslocation - leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) - leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) - - end if - - ! calculate fine root N litterfall (no retranslocation of fine root N) - frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (leafc(p) == 0.0_r8) then - ntovr_leaf = 0.0_r8 - else - ntovr_leaf = leafc_to_litter(p) * (leafn(p) / leafc(p)) - end if - - leafn_to_litter(p) = fr_leafn_to_litter * ntovr_leaf - leafn_to_retransn(p) = ntovr_leaf - leafn_to_litter(p) - if (frootc(p) == 0.0_r8) then - frootn_to_litter(p) = 0.0_r8 - else - frootn_to_litter(p) = frootc_to_litter(p) * (frootn(p) / frootc(p)) - end if - end if - - if ( use_fun ) then - if(frootn_to_litter(p)*dt.gt.frootn(p))then - frootn_to_litter(p) = frootn(p)/dt - endif - end if - - end if - - end do - - end associate - - end subroutine CNBackgroundLitterfall - - !----------------------------------------------------------------------- - subroutine CNLivewoodTurnover (num_soilp, filter_soilp, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Determines the flux of C and N from live wood to - ! dead wood pools, for stem and coarse root. - ! - use CNSharedParamsMod, only: use_fun - use clm_varctl , only : CNratio_floating - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter patch index - real(r8):: ctovr ! temporary variable for carbon turnover - real(r8):: ntovr ! temporary variable for nitrogen turnover - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) - - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live stem C - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] (gC/m2) live coarse root C - - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) live coarse root N - - livestemc_to_deadstemc => cnveg_carbonflux_inst%livestemc_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - livecrootc_to_deadcrootc => cnveg_carbonflux_inst%livecrootc_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - - livestemn_to_deadstemn => cnveg_nitrogenflux_inst%livestemn_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch , & ! Output: [real(r8) (:) ] - livecrootn_to_deadcrootn => cnveg_nitrogenflux_inst%livecrootn_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - livecrootn_to_retransn => cnveg_nitrogenflux_inst%livecrootn_to_retransn_patch & ! Output: [real(r8) (:) ] - ) - - - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes for woody types - if (woody(ivt(p)) > 0._r8) then - - ! live stem to dead stem turnover - - ctovr = livestemc(p) * lwtop - ntovr = ctovr / livewdcn(ivt(p)) - livestemc_to_deadstemc(p) = ctovr - livestemn_to_deadstemn(p) = ctovr / deadwdcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (livestemc(p) == 0.0_r8) then - ntovr = 0.0_r8 - else - ntovr = ctovr * (livestemn(p) / livestemc(p)) - end if - - livestemn_to_deadstemn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn - end if - - livestemn_to_retransn(p) = ntovr - livestemn_to_deadstemn(p) - - ! live coarse root to dead coarse root turnover - - ctovr = livecrootc(p) * lwtop - ntovr = ctovr / livewdcn(ivt(p)) - livecrootc_to_deadcrootc(p) = ctovr - livecrootn_to_deadcrootn(p) = ctovr / deadwdcn(ivt(p)) - - if (CNratio_floating .eqv. .true.) then - if (livecrootc(p) == 0.0_r8) then - ntovr = 0.0_r8 - else - ntovr = ctovr * (livecrootn(p) / livecrootc(p)) - end if - - livecrootn_to_deadcrootn(p) = 0.5_r8 * ntovr ! assuming 50% goes to deadstemn - end if - - livecrootn_to_retransn(p) = ntovr - livecrootn_to_deadcrootn(p) - if(use_fun)then - !TURNED OFF FLUXES TO CORRECT N ACCUMULATION ISSUE. RF. Oct 2015. - livecrootn_to_retransn(p) = 0.0_r8 - livestemn_to_retransn(p) = 0.0_r8 - endif - - end if - - end do - - end associate - - end subroutine CNLivewoodTurnover - - !----------------------------------------------------------------------- - subroutine CNGrainToProductPools(bounds, num_soilp, filter_soilp, num_soilc, filter_soilc, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! If using prognostic crop along with use_grainproduct, then move the patch-level - ! grain-to-food fluxes into the column-level grain-to-cropprod fluxes - ! - ! !USES: - use clm_varctl , only : use_crop - use clm_varctl , only : use_grainproduct - use subgridAveMod , only : p2c - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fp, p - - character(len=*), parameter :: subname = 'CNGrainToProductPools' - !----------------------------------------------------------------------- - - ! Explicitly checking use_crop is probably unnecessary here (because presumably - ! use_grainproduct is only true if use_crop is true), but we do it for safety because - ! the grain*_to_food_patch fluxes are not set if use_crop is false. - if (use_crop .and. use_grainproduct) then - do fp = 1, num_soilp - p = filter_soilp(fp) - cnveg_carbonflux_inst%grainc_to_cropprodc_patch(p) = & - cnveg_carbonflux_inst%grainc_to_food_patch(p) - cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(p) = & - cnveg_nitrogenflux_inst%grainn_to_food_patch(p) - end do - - call p2c (bounds, num_soilc, filter_soilc, & - cnveg_carbonflux_inst%grainc_to_cropprodc_patch(bounds%begp:bounds%endp), & - cnveg_carbonflux_inst%grainc_to_cropprodc_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_soilc, filter_soilc, & - cnveg_nitrogenflux_inst%grainn_to_cropprodn_patch(bounds%begp:bounds%endp), & - cnveg_nitrogenflux_inst%grainn_to_cropprodn_col(bounds%begc:bounds%endc)) - end if - - ! No else clause: if use_grainproduct is false, then the grain*_to_cropprod fluxes - ! will remain at their initial value (0). - - end subroutine CNGrainToProductPools - - !----------------------------------------------------------------------- - subroutine CNLitterToColumn (bounds, num_soilc, filter_soilc, & - cnveg_state_inst,cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - leaf_prof_patch, froot_prof_patch) - ! - ! !DESCRIPTION: - ! called at the end of cn_phenology to gather all patch-level litterfall fluxes - ! to the column level and assign them to the three litter pools - ! - ! !USES: - use clm_varpar , only : max_patch_per_col, nlevdecomp - use pftconMod , only : npcropmin - use clm_varctl , only : use_grainproduct - ! - ! !ARGUMENTS: - 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 - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: leaf_prof_patch(bounds%begp:,1:) - real(r8) , intent(in) :: froot_prof_patch(bounds%begp:,1:) - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(leaf_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(froot_prof_patch) == (/bounds%endp,nlevdecomp_full/)), errMsg(sourcefile, __LINE__)) - - associate( & - leaf_prof => leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) for this patch (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction - - leafc_to_litter => cnveg_carbonflux_inst%leafc_to_litter_patch , & ! Input: [real(r8) (:) ] leaf C litterfall (gC/m2/s) - frootc_to_litter => cnveg_carbonflux_inst%frootc_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) - livestemc_to_litter => cnveg_carbonflux_inst%livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] live stem C litterfall (gC/m2/s) - grainc_to_food => cnveg_carbonflux_inst%grainc_to_food_patch , & ! Input: [real(r8) (:) ] grain C to food (gC/m2/s) - phenology_c_to_litr_met_c => cnveg_carbonflux_inst%phenology_c_to_litr_met_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) - phenology_c_to_litr_cel_c => cnveg_carbonflux_inst%phenology_c_to_litr_cel_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) - phenology_c_to_litr_lig_c => cnveg_carbonflux_inst%phenology_c_to_litr_lig_c_col , & ! Output: [real(r8) (:,:) ] C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) - - livestemn_to_litter => cnveg_nitrogenflux_inst%livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] livestem N to litter (gN/m2/s) - grainn_to_food => cnveg_nitrogenflux_inst%grainn_to_food_patch , & ! Input: [real(r8) (:) ] grain N to food (gN/m2/s) - leafn_to_litter => cnveg_nitrogenflux_inst%leafn_to_litter_patch , & ! Input: [real(r8) (:) ] leaf N litterfall (gN/m2/s) - frootn_to_litter => cnveg_nitrogenflux_inst%frootn_to_litter_patch , & ! Input: [real(r8) (:) ] fine root N litterfall (gN/m2/s) - phenology_n_to_litr_met_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_met_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) - phenology_n_to_litr_cel_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_cel_n_col , & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gN/m3/s) - phenology_n_to_litr_lig_n => cnveg_nitrogenflux_inst%phenology_n_to_litr_lig_n_col & ! Output: [real(r8) (:,:) ] N fluxes associated with phenology (litterfall and crop) to litter lignin pool (gN/m3/s) - ) - - do j = 1, nlevdecomp - do pi = 1,max_patch_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - - ! leaf litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! leaf litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! fine root litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! agroibis puts crop stem litter together with leaf litter - ! so I've used the leaf lf_f* parameters instead of making - ! new ones for now (slevis) - ! also for simplicity I've put "food" into the litter pools - - if (ivt(p) >= npcropmin) then ! add livestemc to litter - ! stem litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + livestemc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! stem litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + livestemn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + livestemn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + livestemn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - if (.not. use_grainproduct) then - ! grain litter carbon fluxes - phenology_c_to_litr_met_c(c,j) = phenology_c_to_litr_met_c(c,j) & - + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_cel_c(c,j) = phenology_c_to_litr_cel_c(c,j) & - + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_c_to_litr_lig_c(c,j) = phenology_c_to_litr_lig_c(c,j) & - + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! grain litter nitrogen fluxes - phenology_n_to_litr_met_n(c,j) = phenology_n_to_litr_met_n(c,j) & - + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_cel_n(c,j) = phenology_n_to_litr_cel_n(c,j) & - + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - phenology_n_to_litr_lig_n(c,j) = phenology_n_to_litr_lig_n(c,j) & - + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - end if - - - end if - end if - end if - - end do - - end do - end do - - end associate - - end subroutine CNLitterToColumn - -end module CNPhenologyMod diff --git a/src/biogeochem/CNPrecisionControlMod.F90 b/src/biogeochem/CNPrecisionControlMod.F90 deleted file mode 100644 index 818e8eabca..0000000000 --- a/src/biogeochem/CNPrecisionControlMod.F90 +++ /dev/null @@ -1,615 +0,0 @@ -module CNPrecisionControlMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! controls on very low values in critical state variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use PatchType , only : patch - use abortutils , only : endrun - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: CNPrecisionControlReadNML - public:: CNPrecisionControl - - ! !PUBLIC DATA: - real(r8), public :: ccrit = 1.e-8_r8 ! critical carbon state value for truncation (gC/m2) - real(r8), public :: cnegcrit = -6.e+1_r8 ! critical negative carbon state value for abort (gC/m2) - real(r8), public :: ncrit = 1.e-8_r8 ! critical nitrogen state value for truncation (gN/m2) - real(r8), public :: nnegcrit = -6.e+0_r8 ! critical negative nitrogen state value for abort (gN/m2) - real(r8), public, parameter :: n_min = 0.000000001_r8 ! Minimum Nitrogen value to use when calculating CN ratio (gN/m2) - - ! !PRIVATE DATA: - logical, private :: prec_control_for_froot = .true. ! If true do precision control for frootc/frootn - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNPrecisionControlReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CN Precision control - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog, use_nguardrail - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNPrecisionControlReadNML' - character(len=*), parameter :: nmlname = 'cnprecision_inparm' - !----------------------------------------------------------------------- - namelist /cnprecision_inparm/ ncrit, ccrit, cnegcrit, nnegcrit - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnprecision_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (ncrit , mpicom) - call shr_mpi_bcast (ccrit , mpicom) - call shr_mpi_bcast (nnegcrit, mpicom) - call shr_mpi_bcast (cnegcrit, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnprecision_inparm) - write(iulog,*) ' ' - end if - - ! Have precision control for froot be determined by use_nguardrail setting - prec_control_for_froot = .not. use_nguardrail - - end subroutine CNPrecisionControlReadNML - - !----------------------------------------------------------------------- - subroutine CNPrecisionControl(bounds, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - cnveg_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Force leaf and deadstem c and n to 0 if they get too small. - ! - ! !USES: - use clm_varctl , only : iulog, use_c13, use_c14 - use clm_varpar , only : use_crop - use pftconMod , only : nc3crop - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,j,k ! indices - integer :: fp ! filter indices - real(r8):: pc(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections Carbon - real(r8):: pn(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections nitrogen - real(r8):: pc13(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections - real(r8):: pc14(bounds%begp:bounds%endp) ! truncation terms for patch-level corrections - !----------------------------------------------------------------------- - - ! cnveg_carbonstate_inst%cpool_patch Output: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool - ! cnveg_carbonstate_inst%deadcrootc_patch Output: [real(r8) (:) ] (gC/m2) dead coarse root C - ! cnveg_carbonstate_inst%deadcrootc_storage_patch Output: [real(r8) (:) ] (gC/m2) dead coarse root C storage - ! cnveg_carbonstate_inst%deadcrootc_xfer_patch Output: [real(r8) (:) ] (gC/m2) dead coarse root C transfer - ! cnveg_carbonstate_inst%deadstemc_patch Output: [real(r8) (:) ] (gC/m2) dead stem C - ! cnveg_carbonstate_inst%deadstemc_storage_patch Output: [real(r8) (:) ] (gC/m2) dead stem C storage - ! cnveg_carbonstate_inst%deadstemc_xfer_patch Output: [real(r8) (:) ] (gC/m2) dead stem C transfer - ! cnveg_carbonstate_inst%frootc_patch Output: [real(r8) (:) ] (gC/m2) fine root C - ! cnveg_carbonstate_inst%frootc_storage_patch Output: [real(r8) (:) ] (gC/m2) fine root C storage - ! cnveg_carbonstate_inst%frootc_xfer_patch Output: [real(r8) (:) ] (gC/m2) fine root C transfer - ! cnveg_carbonstate_inst%gresp_storage_patch Output: [real(r8) (:) ] (gC/m2) growth respiration storage - ! cnveg_carbonstate_inst%gresp_xfer_patch Output: [real(r8) (:) ] (gC/m2) growth respiration transfer - ! cnveg_carbonstate_inst%leafc_patch Output: [real(r8) (:) ] (gC/m2) leaf C - ! cnveg_carbonstate_inst%leafc_storage_patch Output: [real(r8) (:) ] (gC/m2) leaf C storage - ! cnveg_carbonstate_inst%leafc_xfer_patch Output: [real(r8) (:) ] (gC/m2) leaf C transfer - ! cnveg_carbonstate_inst%livecrootc_patch Output: [real(r8) (:) ] (gC/m2) live coarse root C - ! cnveg_carbonstate_inst%livecrootc_storage_patch Output: [real(r8) (:) ] (gC/m2) live coarse root C storage - ! cnveg_carbonstate_inst%livecrootc_xfer_patch Output: [real(r8) (:) ] (gC/m2) live coarse root C transfer - ! cnveg_carbonstate_inst%livestemc_patch Output: [real(r8) (:) ] (gC/m2) live stem C - ! cnveg_carbonstate_inst%livestemc_storage_patch Output: [real(r8) (:) ] (gC/m2) live stem C storage - ! cnveg_carbonstate_inst%livestemc_xfer_patch Output: [real(r8) (:) ] (gC/m2) live stem C transfer - ! cnveg_carbonstate_inst%ctrunc_patch Output: [real(r8) (:) ] (gC/m2) patch-level sink for C truncation - ! cnveg_carbonstate_inst%xsmrpool_patch Output: [real(r8) (:) ] (gC/m2) execss maint resp C pool - ! cnveg_carbonstate_inst%grainc_patch Output: [real(r8) (:) ] (gC/m2) grain C - ! cnveg_carbonstate_inst%grainc_storage_patch Output: [real(r8) (:) ] (gC/m2) grain C storage - ! cnveg_carbonstate_inst%grainc_xfer_patch Output: [real(r8) (:) ] (gC/m2) grain C transfer - - ! cnveg_nitrogenstate_inst%deadcrootn_patch Output: [real(r8) (:) ] (gN/m2) dead coarse root N - ! cnveg_nitrogenstate_inst%deadcrootn_storage_patch Output: [real(r8) (:) ] (gN/m2) dead coarse root N storage - ! cnveg_nitrogenstate_inst%deadcrootn_xfer_patch Output: [real(r8) (:) ] (gN/m2) dead coarse root N transfer - ! cnveg_nitrogenstate_inst%deadstemn_patch Output: [real(r8) (:) ] (gN/m2) dead stem N - ! cnveg_nitrogenstate_inst%deadstemn_storage_patch Output: [real(r8) (:) ] (gN/m2) dead stem N storage - ! cnveg_nitrogenstate_inst%deadstemn_xfer_patch Output: [real(r8) (:) ] (gN/m2) dead stem N transfer - ! cnveg_nitrogenstate_inst%frootn_patch Output: [real(r8) (:) ] (gN/m2) fine root N - ! cnveg_nitrogenstate_inst%frootn_storage_patch Output: [real(r8) (:) ] (gN/m2) fine root N storage - ! cnveg_nitrogenstate_inst%frootn_xfer_patch Output: [real(r8) (:) ] (gN/m2) fine root N transfer - ! cnveg_nitrogenstate_inst%leafn_patch Output: [real(r8) (:) ] (gN/m2) leaf N - ! cnveg_nitrogenstate_inst%leafn_storage_patch Output: [real(r8) (:) ] (gN/m2) leaf N storage - ! cnveg_nitrogenstate_inst%leafn_xfer_patch Output: [real(r8) (:) ] (gN/m2) leaf N transfer - ! cnveg_nitrogenstate_inst%livecrootn_patch Output: [real(r8) (:) ] (gN/m2) live coarse root N - ! cnveg_nitrogenstate_inst%livecrootn_storage_patch Output: [real(r8) (:) ] (gN/m2) live coarse root N storage - ! cnveg_nitrogenstate_inst%livecrootn_xfer_patch Output: [real(r8) (:) ] (gN/m2) live coarse root N transfer - ! cnveg_nitrogenstate_inst%grainn_patch Output: [real(r8) (:) ] (gC/m2) grain N - ! cnveg_nitrogenstate_inst%grainn_storage_patch Output: [real(r8) (:) ] (gC/m2) grain N storage - ! cnveg_nitrogenstate_inst%grainn_xfer_patch Output: [real(r8) (:) ] (gC/m2) grain N transfer - ! cnveg_nitrogenstate_inst%livestemn_patch Output: [real(r8) (:) ] (gN/m2) live stem N - ! cnveg_nitrogenstate_inst%livestemn_storage_patch Output: [real(r8) (:) ] (gN/m2) live stem N storage - ! cnveg_nitrogenstate_inst%livestemn_xfer_patch Output: [real(r8) (:) ] (gN/m2) live stem N transfer - ! cnveg_nitrogenstate_inst%npool_patch Output: [real(r8) (:) ] (gN/m2) temporary plant N pool - ! cnveg_nitrogenstate_inst%ntrunc_patch Output: [real(r8) (:) ] (gN/m2) patch-level sink for N truncation - ! cnveg_nitrogenstate_inst%retransn_patch Output: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - - - associate( & - cs => cnveg_carbonstate_inst , & - ns => cnveg_nitrogenstate_inst , & - c13cs => c13_cnveg_carbonstate_inst , & - c14cs => c14_cnveg_carbonstate_inst & - ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! initialize the patch-level C and N truncation terms - pc(p) = 0._r8 - pn(p) = 0._r8 - if ( use_c13 ) pc13(p) = 0._r8 - if ( use_c14 ) pc14(p) = 0._r8 - end do - - ! do tests on state variables for precision control - ! for linked C-N state variables, perform precision test on - ! the C component, but truncate C, C13, and N components - - ! leaf C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_patch(bounds%begp:bounds%endp), & - ns%leafn_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_patch, c14=c14cs%leafc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! leaf storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_storage_patch(bounds%begp:bounds%endp), & - ns%leafn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_storage_patch, c14=c14cs%leafc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! leaf transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%leafc_xfer_patch(bounds%begp:bounds%endp), & - ns%leafn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%leafc_xfer_patch, c14=c14cs%leafc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! froot C and N - ! EBK KO DML: For some reason frootc/frootn can go negative and allowing - ! it to be negative is important for C4 crops (otherwise they die) Jun/3/2016 - if ( prec_control_for_froot ) then - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_patch(bounds%begp:bounds%endp), & - ns%frootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_patch, c14=c14cs%frootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true. ) - end if - - ! froot storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_storage_patch(bounds%begp:bounds%endp), & - ns%frootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%frootc_storage_patch, c14=c14cs%frootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! froot transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%frootc_xfer_patch(bounds%begp:bounds%endp), & - ns%frootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%frootc_xfer_patch, c14=c14cs%frootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - if ( use_crop )then - ! grain C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_patch(bounds%begp:bounds%endp), & - ns%grainn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_patch, c14=c14cs%grainc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - - ! grain storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_storage_patch(bounds%begp:bounds%endp), & - ns%grainn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%grainc_storage_patch, c14=c14cs%grainc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - - ! grain transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%grainc_xfer_patch(bounds%begp:bounds%endp), & - ns%grainn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%grainc_xfer_patch, c14=c14cs%grainc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), croponly=.true. ) - - ! grain transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%cropseedc_deficit_patch(bounds%begp:bounds%endp), & - ns%cropseedn_deficit_patch(bounds%begp:bounds%endp), pc(bounds%begp:), & - pn(bounds%begp:), __LINE__, & - c13=c13cs%cropseedc_deficit_patch, c14=c14cs%cropseedc_deficit_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) - - end if - - ! livestem C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_patch(bounds%begp:bounds%endp), & - ns%livestemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livestemc_patch, c14=c14cs%livestemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livestem storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_storage_patch(bounds%begp:bounds%endp), & - ns%livestemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_storage_patch, c14=c14cs%livestemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livestem transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livestemc_xfer_patch(bounds%begp:bounds%endp), & - ns%livestemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livestemc_xfer_patch, c14=c14cs%livestemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadstem C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_patch(bounds%begp:bounds%endp), & - ns%deadstemn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadstemc_patch, c14=c14cs%deadstemc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - ! deadstem storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_storage_patch(bounds%begp:bounds%endp), & - ns%deadstemn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_storage_patch, c14=c14cs%deadstemc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadstem transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadstemc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadstemn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadstemc_xfer_patch, c14=c14cs%deadstemc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livecroot C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_patch(bounds%begp:bounds%endp), & - ns%livecrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%livecrootc_patch, c14=c14cs%livecrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livecroot storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_storage_patch(bounds%begp:bounds%endp), & - ns%livecrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_storage_patch, c14=c14cs%livecrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! livecroot transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%livecrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%livecrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%livecrootc_xfer_patch, c14=c14cs%livecrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadcroot C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), __LINE__, & - c13=c13cs%deadcrootc_patch, c14=c14cs%deadcrootc_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadcroot storage C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_storage_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_storage_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_storage_patch, c14=c14cs%deadcrootc_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! deadcroot transfer C and N - call TruncateCandNStates( bounds, filter_soilp, num_soilp, cs%deadcrootc_xfer_patch(bounds%begp:bounds%endp), & - ns%deadcrootn_xfer_patch(bounds%begp:bounds%endp), pc(bounds%begp:), pn(bounds%begp:), & - __LINE__, c13=c13cs%deadcrootc_xfer_patch, c14=c14cs%deadcrootc_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! gresp_storage (C only) - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_storage_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_storage_patch, c14=c14cs%gresp_storage_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! gresp_xfer(c only) - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%gresp_xfer_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%gresp_xfer_patch, c14=c14cs%gresp_xfer_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - ! cpool (C only) - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%cpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%cpool_patch, c14=c14cs%cpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:) ) - - if ( use_crop )then - ! xsmrpool (C only) - ! xsmr is a pool to balance the budget and as such can be freely negative - call TruncateCStates( bounds, filter_soilp, num_soilp, cs%xsmrpool_patch(bounds%begp:bounds%endp), & - pc(bounds%begp:), __LINE__, & - c13=c13cs%xsmrpool_patch, c14=c14cs%xsmrpool_patch, & - pc13=pc13(bounds%begp:), pc14=pc14(bounds%begp:), allowneg=.true., croponly=.true. ) - - end if - - ! retransn (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%retransn_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & - __LINE__ ) - - ! npool (N only) - call TruncateNStates( bounds, filter_soilp, num_soilp, ns%npool_patch(bounds%begp:bounds%endp), pn(bounds%begp:), & - __LINE__ ) - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - cs%ctrunc_patch(p) = cs%ctrunc_patch(p) + pc(p) - - ns%ntrunc_patch(p) = ns%ntrunc_patch(p) + pn(p) - - if ( use_c13 ) then - c13cs%ctrunc_patch(p) = c13cs%ctrunc_patch(p) + pc13(p) - endif - if ( use_c14 ) then - c14cs%ctrunc_patch(p) = c14cs%ctrunc_patch(p) + pc14(p) - endif - end do - - end associate - - end subroutine CNPrecisionControl - - subroutine TruncateCandNStates( bounds, filter_soilp, num_soilp, carbon_patch, nitrogen_patch, pc, pn, lineno, c13, c14, & - pc13, pc14, croponly, allowneg ) - ! - ! !DESCRIPTION: - ! Truncate paired Carbon and Nitrogen states. If a paired carbon and nitrogen state iare too small truncate - ! the pair of them to zero. - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl , only : use_c13, use_c14, use_nguardrail - use clm_varctl , only : iulog - use pftconMod , only : nc3crop - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8), intent(inout) :: carbon_patch(bounds%begp:) - real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) - real(r8), intent(inout) :: pc(bounds%begp:) - real(r8), intent(inout) :: pn(bounds%begp:) - integer, intent(in) :: lineno - real(r8), intent(inout), optional, pointer :: c13(:) - real(r8), intent(inout), optional, pointer :: c14(:) - real(r8), intent(inout), optional :: pc13(bounds%begp:) - real(r8), intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg - - logical :: lcroponly, lallowneg - integer :: fp, p - - SHR_ASSERT_ALL((ubound(carbon_patch) == (/bounds%endp/)), 'ubnd(carb)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(nitrogen_patch) == (/bounds%endp/)), 'ubnd(nitro)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(pc) == (/bounds%endp/)), 'ubnd(pc)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(pn) == (/bounds%endp/)), 'ubnd(pn)'//errMsg(sourcefile, lineno)) -#ifndef _OPENMP - if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL((lbound(c13) == (/bounds%begp/)), 'lbnd(c13)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(c13) == (/bounds%endp/)), 'ubnd(c13)'//errMsg(sourcefile, lineno)) - end if - if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL((lbound(c14) == (/bounds%begp/)), 'lbnd(c14)'//errMsg(sourcefile, lineno)) - SHR_ASSERT_ALL((ubound(c14) == (/bounds%endp/)), 'ubnd(c14)'//errMsg(sourcefile, lineno)) - end if -#endif - if ( present(pc13) )then - SHR_ASSERT_ALL((ubound(pc13) == (/bounds%endp/)), 'ubnd(pc13)'//errMsg(sourcefile, lineno)) - end if - if ( present(pc14) )then - SHR_ASSERT_ALL((ubound(pc14) == (/bounds%endp/)), 'ubnd(pc14)'//errMsg(sourcefile, lineno)) - end if - ! patch loop - lcroponly = .false. - if ( present(croponly) )then - if ( croponly ) lcroponly = .true. - end if - lallowneg = .false. - if ( present(allowneg) )then - if ( allowneg ) lallowneg = .true. - end if - do fp = 1,num_soilp - p = filter_soilp(fp) - - if ( .not. lcroponly .or. (patch%itype(p) >= nc3crop) ) then - if ( .not. lallowneg .and. ((carbon_patch(p) < cnegcrit) .or. (nitrogen_patch(p) < nnegcrit)) ) then - write(iulog,*) 'ERROR: Carbon or Nitrogen patch negative = ', carbon_patch(p), nitrogen_patch(p) - write(iulog,*) 'ERROR: limits = ', cnegcrit, nnegcrit - call endrun(msg='ERROR: carbon or nitrogen state critically negative '//errMsg(sourcefile, lineno)) - else if ( abs(carbon_patch(p)) < ccrit .or. (use_nguardrail .and. abs(nitrogen_patch(p)) < ncrit) ) then - pc(p) = pc(p) + carbon_patch(p) - carbon_patch(p) = 0._r8 - - pn(p) = pn(p) + nitrogen_patch(p) - nitrogen_patch(p) = 0._r8 - - if ( use_c13 .and. present(c13) .and. present(pc13) ) then - pc13(p) = pc13(p) + c13(p) - c13(p) = 0._r8 - endif - if ( use_c14 .and. present(c14) .and. present(pc14)) then - pc14(p) = pc14(p) + c14(p) - c14(p) = 0._r8 - endif - end if - end if - end do - end subroutine TruncateCandNStates - - subroutine TruncateCStates( bounds, filter_soilp, num_soilp, carbon_patch, pc, lineno, c13, c14, pc13, pc14, croponly, allowneg ) - ! - ! !DESCRIPTION: - ! Truncate Carbon states. If a carbon state is too small truncate it to - ! zero. - ! - ! !USES: - use abortutils , only : endrun - use clm_varctl , only : iulog - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl , only : use_c13, use_c14 - use pftconMod , only : nc3crop - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8) , intent(inout) :: carbon_patch(bounds%begp:) - real(r8) , intent(inout) :: pc(bounds%begp:) - integer , intent(in) :: lineno - real(r8) , intent(inout), optional, pointer :: c13(:) - real(r8) , intent(inout), optional, pointer :: c14(:) - real(r8) , intent(inout), optional :: pc13(bounds%begp:) - real(r8) , intent(inout), optional :: pc14(bounds%begp:) - logical , intent(in) , optional :: croponly - logical , intent(in) , optional :: allowneg - - logical :: lcroponly, lallowneg - integer :: fp, p - - SHR_ASSERT_ALL((ubound(carbon_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pc) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) -#ifndef _OPENMP - if ( present(c13) .and. use_c13 )then - SHR_ASSERT_ALL((lbound(c13) == (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c13) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - if ( present(c14) .and. use_c14 )then - SHR_ASSERT_ALL((lbound(c14) == (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c14) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if -#endif - if ( present(pc13) )then - SHR_ASSERT_ALL((ubound(pc13) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - if ( present(pc14) )then - SHR_ASSERT_ALL((ubound(pc14) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - if ( -ccrit < cnegcrit )then - call endrun(msg='ERROR: cnegcrit should be less than -ccrit: '//errMsg(sourcefile, lineno)) - end if - lcroponly = .false. - if ( present(croponly) )then - if ( croponly ) lcroponly = .true. - end if - lallowneg = .false. - if ( present(allowneg) )then - if ( allowneg ) lallowneg = .true. - end if - do fp = 1,num_soilp - p = filter_soilp(fp) - - if ( .not. lcroponly .or. (patch%itype(p) >= nc3crop) ) then - if ( .not. lallowneg .and. (carbon_patch(p) < cnegcrit) ) then - write(iulog,*) 'ERROR: Carbon patch negative = ', carbon_patch(p) - write(iulog,*) 'ERROR: limit = ', cnegcrit - call endrun(msg='ERROR: carbon state critically negative '//errMsg(sourcefile, lineno)) - else if ( abs(carbon_patch(p)) < ccrit) then - pc(p) = pc(p) + carbon_patch(p) - carbon_patch(p) = 0._r8 - - if ( use_c13 .and. present(c13) .and. present(pc13) ) then - pc13(p) = pc13(p) + c13(p) - c13(p) = 0._r8 - endif - if ( use_c14 .and. present(c14) .and. present(pc14)) then - pc14(p) = pc14(p) + c14(p) - c14(p) = 0._r8 - endif - end if - end if - end do - end subroutine TruncateCStates - - subroutine TruncateNStates( bounds, filter_soilp, num_soilp, nitrogen_patch, pn, lineno ) - ! - ! !DESCRIPTION: - ! Truncate Nitrogen states. If a nitrogen state is too small truncate it to - ! zero. - ! - ! !USES: - use abortutils , only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_soilp ! number of soil patchs in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - real(r8), intent(inout) :: nitrogen_patch(bounds%begp:) - real(r8), intent(inout) :: pn(bounds%begp:) - integer, intent(in) :: lineno - - integer :: fp, p - - SHR_ASSERT_ALL((ubound(nitrogen_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pn) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - do fp = 1,num_soilp - p = filter_soilp(fp) - if ( nitrogen_patch(p) < nnegcrit ) then - !write(iulog,*) 'WARNING: Nitrogen patch negative = ', nitrogen_patch - !call endrun(msg='ERROR: nitrogen state critically negative'//errMsg(sourcefile, lineno)) - else if ( abs(nitrogen_patch(p)) < ncrit) then - pn(p) = pn(p) + nitrogen_patch(p) - nitrogen_patch(p) = 0._r8 - - end if - end do - end subroutine TruncateNStates - -end module CNPrecisionControlMod diff --git a/src/biogeochem/CNProductsMod.F90 b/src/biogeochem/CNProductsMod.F90 deleted file mode 100644 index 59891ba330..0000000000 --- a/src/biogeochem/CNProductsMod.F90 +++ /dev/null @@ -1,741 +0,0 @@ -module CNProductsMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate loss fluxes from wood products pools, and update product pool state variables - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_time_manager , only : get_step_size - use SpeciesBaseType , only : species_base_type - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: cn_products_type - private - ! ------------------------------------------------------------------------ - ! Public instance variables - ! ------------------------------------------------------------------------ - - real(r8), pointer, public :: product_loss_grc(:) ! (g[C or N]/m2/s) total decomposition loss from ALL product pools - - ! ------------------------------------------------------------------------ - ! Private instance variables - ! ------------------------------------------------------------------------ - - class(species_base_type), allocatable :: species ! C, N, C13, C14, etc. - - ! States - real(r8), pointer :: cropprod1_grc(:) ! (g[C or N]/m2) grain product pool, 1-year lifespan - real(r8), pointer :: prod10_grc(:) ! (g[C or N]/m2) wood product pool, 10-year lifespan - real(r8), pointer :: prod100_grc(:) ! (g[C or N]/m2) wood product pool, 100-year lifespan - real(r8), pointer :: tot_woodprod_grc(:) ! (g[C or N]/m2) total wood product pool - - ! Fluxes: gains - real(r8), pointer :: dwt_prod10_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 10-year wood product pool - real(r8), pointer :: dwt_prod100_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 100-year wood product pool - real(r8), pointer :: dwt_woodprod_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to wood product pools - real(r8), pointer :: dwt_cropprod1_gain_grc(:) ! (g[C or N]/m2/s) dynamic landcover addition to 1-year crop product pool - real(r8), pointer :: hrv_deadstem_to_prod10_patch(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool - real(r8), pointer :: hrv_deadstem_to_prod10_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 10-year wood product pool - real(r8), pointer :: hrv_deadstem_to_prod100_patch(:) ! (g[C or N]/m2/s) dead stem harvest to 100-year wood product pool - real(r8), pointer :: hrv_deadstem_to_prod100_grc(:) ! (g[C or N]/m2/s) dead stem harvest to 100-year wood product pool - real(r8), pointer :: grain_to_cropprod1_patch(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool - real(r8), pointer :: grain_to_cropprod1_grc(:) ! (g[C or N]/m2/s) grain to 1-year crop product pool - - ! Fluxes: losses - real(r8), pointer :: cropprod1_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 1-yr grain product pool - real(r8), pointer :: prod10_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 10-yr wood product pool - real(r8), pointer :: prod100_loss_grc(:) ! (g[C or N]/m2/s) decomposition loss from 100-yr wood product pool - real(r8), pointer :: tot_woodprod_loss_grc(:) ! (g[C or N]/m2/s) decompomposition loss from all wood product pools - - contains - - ! Infrastructure routines - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: Restart - - ! Science routines - procedure, public :: UpdateProducts - procedure, private :: PartitionWoodFluxes - procedure, private :: PartitionGrainFluxes - procedure, private :: ComputeSummaryVars - - end type cn_products_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds, species) - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - - ! species tells whether this object is being used for C, N, C13, C14, etc. This is - ! just used for naming history and restart fields - class(species_base_type), intent(in) :: species - - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - allocate(this%species, source = species) - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begg,endg - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - begg = bounds%begg - endg = bounds%endg - - allocate(this%cropprod1_grc(begg:endg)) ; this%cropprod1_grc(:) = nan - allocate(this%prod10_grc(begg:endg)) ; this%prod10_grc(:) = nan - allocate(this%prod100_grc(begg:endg)) ; this%prod100_grc(:) = nan - allocate(this%tot_woodprod_grc(begg:endg)) ; this%tot_woodprod_grc(:) = nan - - allocate(this%dwt_prod10_gain_grc(begg:endg)) ; this%dwt_prod10_gain_grc(:) = nan - allocate(this%dwt_prod100_gain_grc(begg:endg)) ; this%dwt_prod100_gain_grc(:) = nan - allocate(this%dwt_woodprod_gain_grc(begg:endg)) ; this%dwt_woodprod_gain_grc(:) = nan - - allocate(this%dwt_cropprod1_gain_grc(begg:endg)) ; this%dwt_cropprod1_gain_grc(:) = nan - - allocate(this%hrv_deadstem_to_prod10_patch(begp:endp)) ; this%hrv_deadstem_to_prod10_patch(:) = nan - allocate(this%hrv_deadstem_to_prod10_grc(begg:endg)) ; this%hrv_deadstem_to_prod10_grc(:) = nan - - allocate(this%hrv_deadstem_to_prod100_patch(begp:endp)) ; this%hrv_deadstem_to_prod100_patch(:) = nan - allocate(this%hrv_deadstem_to_prod100_grc(begg:endg)) ; this%hrv_deadstem_to_prod100_grc(:) = nan - - allocate(this%grain_to_cropprod1_patch(begp:endp)) ; this%grain_to_cropprod1_patch(:) = nan - allocate(this%grain_to_cropprod1_grc(begg:endg)) ; this%grain_to_cropprod1_grc(:) = nan - - allocate(this%cropprod1_loss_grc(begg:endg)) ; this%cropprod1_loss_grc(:) = nan - allocate(this%prod10_loss_grc(begg:endg)) ; this%prod10_loss_grc(:) = nan - allocate(this%prod100_loss_grc(begg:endg)) ; this%prod100_loss_grc(:) = nan - allocate(this%tot_woodprod_loss_grc(begg:endg)) ; this%tot_woodprod_loss_grc(:) = nan - allocate(this%product_loss_grc(begg:endg)) ; this%product_loss_grc(:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! !USES: - use histFileMod, only : hist_addfld1d - use clm_varcon , only : spval - ! - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg,endg - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - this%cropprod1_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('CROPPROD1'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = '1-yr grain product ' // this%species%get_species(), & - ptr_gcell = this%cropprod1_grc) - - this%prod10_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD10'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = '10-yr wood product ' // this%species%get_species(), & - ptr_gcell = this%prod10_grc, default='inactive') - - this%prod100_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD100'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = '100-yr wood product ' // this%species%get_species(), & - ptr_gcell = this%prod100_grc, default='inactive') - - this%tot_woodprod_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('TOT_WOODPROD'), & - units = 'g' // this%species%get_species() // '/m^2', & - avgflag = 'A', & - long_name = 'total wood product ' // this%species%get_species(), & - ptr_gcell = this%tot_woodprod_grc) - - this%dwt_prod10_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_PROD10', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to 10-yr wood product pool', & - ptr_gcell = this%dwt_prod10_gain_grc, default='inactive') - - this%dwt_prod100_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_PROD100', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to 100-yr wood product pool', & - ptr_gcell = this%dwt_prod100_gain_grc, default='inactive') - - this%dwt_woodprod_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_WOODPROD', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to wood product pools', & - ptr_gcell = this%dwt_woodprod_gain_grc) - - this%dwt_cropprod1_gain_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('DWT_CROPPROD1', suffix='_GAIN'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'landcover change-driven addition to 1-year crop product pool', & - ptr_gcell = this%dwt_cropprod1_gain_grc) - - this%cropprod1_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('CROPPROD1', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'loss from 1-yr grain product pool', & - ptr_gcell = this%cropprod1_loss_grc) - - this%prod10_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD10', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'loss from 10-yr wood product pool', & - ptr_gcell = this%prod10_loss_grc, default='inactive') - - this%prod100_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('PROD100', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'loss from 100-yr wood product pool', & - ptr_gcell = this%prod100_loss_grc, default='inactive') - - this%tot_woodprod_loss_grc(begg:endg) = spval - call hist_addfld1d( & - fname = this%species%hist_fname('TOT_WOODPROD', suffix='_LOSS'), & - units = 'g' // this%species%get_species() // '/m^2/s', & - avgflag = 'A', & - long_name = 'total loss from wood product pools', & - ptr_gcell = this%tot_woodprod_loss_grc) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, p - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - this%cropprod1_grc(g) = 0._r8 - this%prod10_grc(g) = 0._r8 - this%prod100_grc(g) = 0._r8 - this%tot_woodprod_grc(g) = 0._r8 - end do - - ! Need to set these patch-level fluxes to 0 everywhere for the sake of special - ! landunits (because they don't get set over special landunits in the run loop) - do p = bounds%begp, bounds%endp - this%hrv_deadstem_to_prod10_patch(p) = 0._r8 - this%hrv_deadstem_to_prod100_patch(p) = 0._r8 - this%grain_to_cropprod1_patch(p) = 0._r8 - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag, & - template_for_missing_fields, template_multiplier) - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_double - use restUtilMod, only : restartvar, set_missing_from_template, set_grc_field_from_col_field - ! - ! !ARGUMENTS: - class(cn_products_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*), intent(in) :: flag ! 'read' or 'write' - - ! If template_for_missing_fields and template_multiplier are provided, then: When - ! reading the restart file, for any field not present on the restart file, the field - ! in this object is set equal to the corresponding field in - ! template_for_missing_fields times template_multiplier. - ! - ! The Restart routine must have been called on template_for_missing_fields before - ! calling it on this object. - ! - ! (Must provide both template_for_missing_fields and template_multiplier or neither) - class(cn_products_type), optional, intent(in) :: template_for_missing_fields - real(r8), optional, intent(in) :: template_multiplier - - ! - ! !LOCAL VARIABLES: - logical :: template_provided - logical :: readvar - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - if (present(template_for_missing_fields) .and. present(template_multiplier)) then - template_provided = .true. - else if (present(template_for_missing_fields)) then - call endrun(& - msg='template_for_missing_fields provided; must also provide template_multiplier' // & - errMsg(sourcefile, __LINE__)) - else if (present(template_multiplier)) then - call endrun(& - msg='template_multiplier provided; must also provide template_for_missing_fields' // & - errMsg(sourcefile, __LINE__)) - else - template_provided = .false. - end if - - ! NOTE(wjs, 2016-03-29) Adding '_g' suffixes to the end of the restart field names to - ! distinguish these gridcell-level restart fields from the obsolete column-level - ! restart fields that are present on old restart files. - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('cropprod1', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cropprod1_grc) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't - ! present, try to find a column-level field (which may be present on an older - ! restart file). - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('cropprod1'), & - data_grc = this%cropprod1_grc, & - readvar = readvar) - - ! If we still haven't found an appropriate field on the restart file, then set - ! this field from the template, if provided - if (.not. readvar .and. template_provided) then - call set_missing_from_template(this%cropprod1_grc, & - template_for_missing_fields%cropprod1_grc, & - multiplier = template_multiplier) - end if - end if - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('prod10', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prod10_grc) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't - ! present, try to find a column-level field (which may be present on an older - ! restart file). - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('prod10'), & - data_grc = this%prod10_grc, & - readvar = readvar) - - ! If we still haven't found an appropriate field on the restart file, then set - ! this field from the template, if provided - if (.not. readvar .and. template_provided) then - call set_missing_from_template(this%prod10_grc, & - template_for_missing_fields%prod10_grc, & - multiplier = template_multiplier) - end if - end if - - call restartvar(ncid=ncid, flag=flag, & - varname=this%species%rest_fname('prod100', suffix='_g'), & - xtype=ncd_double, dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prod100_grc) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-03-31) If the gridcell-level field isn't - ! present, try to find a column-level field (which may be present on an older - ! restart file). - call set_grc_field_from_col_field( & - bounds = bounds, & - ncid = ncid, & - varname = this%species%rest_fname('prod100'), & - data_grc = this%prod100_grc, & - readvar = readvar) - - ! If we still haven't found an appropriate field on the restart file, then set - ! this field from the template, if provided - if (.not. readvar .and. template_provided) then - call set_missing_from_template(this%prod100_grc, & - template_for_missing_fields%prod100_grc, & - multiplier = template_multiplier) - end if - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine UpdateProducts(this, bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch, & - wood_harvest_patch, & - dwt_crop_product_gain_patch, & - grain_to_cropprod_patch) - ! - ! !DESCRIPTION: - ! Update all loss fluxes from wood and grain product pools, and update product pool - ! state variables for both loss and gain terms - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - - ! dynamic landcover addition to wood product pools (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_wood_product_gain_patch( bounds%begp: ) - - ! wood harvest addition to wood product pools (g/m2/s) [patch] - real(r8), intent(in) :: wood_harvest_patch( bounds%begp: ) - - ! dynamic landcover addition to crop product pools (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_crop_product_gain_patch( bounds%begp: ) - - ! grain to crop product pool (g/m2/s) [patch] - real(r8), intent(in) :: grain_to_cropprod_patch( bounds%begp: ) - ! - ! !LOCAL VARIABLES: - integer :: g ! indices - real(r8) :: dt ! time step (seconds) - real(r8) :: kprod1 ! decay constant for 1-year product pool - real(r8) :: kprod10 ! decay constant for 10-year product pool - real(r8) :: kprod100 ! decay constant for 100-year product pool - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(dwt_wood_product_gain_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wood_harvest_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_crop_product_gain_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(grain_to_cropprod_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - call this%PartitionWoodFluxes(bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch(bounds%begp:bounds%endp), & - wood_harvest_patch(bounds%begp:bounds%endp)) - - call this%PartitionGrainFluxes(bounds, & - num_soilp, filter_soilp, & - dwt_crop_product_gain_patch(bounds%begp:bounds%endp), & - grain_to_cropprod_patch(bounds%begp:bounds%endp)) - - ! calculate losses from product pools - ! the following (1/s) rate constants result in ~90% loss of initial state over 1, 10 and 100 years, - ! respectively, using a discrete-time fractional decay algorithm. - kprod1 = 7.2e-8 - kprod10 = 7.2e-9 - kprod100 = 7.2e-10 - - do g = bounds%begg, bounds%endg - ! calculate fluxes out of product pools (1/sec) - this%cropprod1_loss_grc(g) = this%cropprod1_grc(g) * kprod1 - this%prod10_loss_grc(g) = this%prod10_grc(g) * kprod10 - this%prod100_loss_grc(g) = this%prod100_grc(g) * kprod100 - end do - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! update product state variables - do g = bounds%begg, bounds%endg - - ! fluxes into wood & grain product pools, from landcover change - this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%dwt_cropprod1_gain_grc(g)*dt - this%prod10_grc(g) = this%prod10_grc(g) + this%dwt_prod10_gain_grc(g)*dt - this%prod100_grc(g) = this%prod100_grc(g) + this%dwt_prod100_gain_grc(g)*dt - - ! fluxes into wood & grain product pools, from harvest - this%cropprod1_grc(g) = this%cropprod1_grc(g) + this%grain_to_cropprod1_grc(g)*dt - this%prod10_grc(g) = this%prod10_grc(g) + this%hrv_deadstem_to_prod10_grc(g)*dt - this%prod100_grc(g) = this%prod100_grc(g) + this%hrv_deadstem_to_prod100_grc(g)*dt - - ! fluxes out of wood & grain product pools, from decomposition - this%cropprod1_grc(g) = this%cropprod1_grc(g) - this%cropprod1_loss_grc(g)*dt - this%prod10_grc(g) = this%prod10_grc(g) - this%prod10_loss_grc(g)*dt - this%prod100_grc(g) = this%prod100_grc(g) - this%prod100_loss_grc(g)*dt - - end do - - call this%ComputeSummaryVars(bounds) - - end subroutine UpdateProducts - - !----------------------------------------------------------------------- - subroutine PartitionWoodFluxes(this, bounds, & - num_soilp, filter_soilp, & - dwt_wood_product_gain_patch, & - wood_harvest_patch) - ! - ! !DESCRIPTION: - ! Partition input wood fluxes into 10 and 100 year product pools - ! - ! !USES: - use pftconMod , only : pftcon - use subgridAveMod, only : p2g - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - - ! dynamic landcover addition to wood product pools (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_wood_product_gain_patch( bounds%begp: ) - - ! wood harvest addition to wood product pools (g/m2/s) [patch] - real(r8), intent(in) :: wood_harvest_patch( bounds%begp: ) - - ! - ! !LOCAL VARIABLES: - integer :: fp - integer :: p - integer :: g - real(r8) :: pprod10 ! PFT proportion of deadstem to 10-year product pool - real(r8) :: pprod100 ! PFT proportion of deadstem to 100-year product pool - real(r8) :: pprod_tot ! PFT proportion of deadstem to any product pool - real(r8) :: pprod10_frac ! PFT fraction of deadstem to product pool that goes to 10-year product pool - real(r8) :: pprod100_frac ! PFT fraction of deadstem to product pool that goes to 100-year product pool - - character(len=*), parameter :: subname = 'PartitionWoodFluxes' - !----------------------------------------------------------------------- - - ! Partition patch-level harvest fluxes to 10 and 100-year product pools - do fp = 1, num_soilp - p = filter_soilp(fp) - this%hrv_deadstem_to_prod10_patch(p) = & - wood_harvest_patch(p) * pftcon%pprodharv10(patch%itype(p)) - this%hrv_deadstem_to_prod100_patch(p) = & - wood_harvest_patch(p) * (1.0_r8 - pftcon%pprodharv10(patch%itype(p))) - end do - - ! Average harvest fluxes from patch to gridcell - call p2g(bounds, & - this%hrv_deadstem_to_prod10_patch(bounds%begp:bounds%endp), & - this%hrv_deadstem_to_prod10_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - call p2g(bounds, & - this%hrv_deadstem_to_prod100_patch(bounds%begp:bounds%endp), & - this%hrv_deadstem_to_prod100_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - ! Zero the dwt gains - do g = bounds%begg, bounds%endg - this%dwt_prod10_gain_grc(g) = 0._r8 - this%dwt_prod100_gain_grc(g) = 0._r8 - end do - - ! Partition dynamic land cover fluxes to 10 and 100-year product pools. - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - ! Note that pprod10 + pprod100 do NOT sum to 1: some fraction of the dwt changes - ! was lost to other fluxes. dwt_wood_product_gain_patch gives the amount that goes - ! to all product pools, so we need to determine the fraction of that flux that - ! goes to each pool. - pprod10 = pftcon%pprod10(patch%itype(p)) - pprod100 = pftcon%pprod100(patch%itype(p)) - pprod_tot = pprod10 + pprod100 - if (pprod_tot > 0) then - pprod10_frac = pprod10 / pprod_tot - pprod100_frac = pprod100 / pprod_tot - else - ! Avoid divide by 0 - pprod10_frac = 0._r8 - pprod100_frac = 0._r8 - end if - - ! Note that the patch-level fluxes are expressed per unit gridcell area. So, to go - ! from patch-level fluxes to gridcell-level fluxes, we simply add up the various - ! patch contributions, without having to multiply by any area weightings. - this%dwt_prod10_gain_grc(g) = this%dwt_prod10_gain_grc(g) + & - dwt_wood_product_gain_patch(p) * pprod10_frac - this%dwt_prod100_gain_grc(g) = this%dwt_prod100_gain_grc(g) + & - dwt_wood_product_gain_patch(p) * pprod100_frac - end do - - end subroutine PartitionWoodFluxes - - !----------------------------------------------------------------------- - subroutine PartitionGrainFluxes(this, bounds, & - num_soilp, filter_soilp, & - dwt_crop_product_gain_patch, & - grain_to_cropprod_patch) - ! - ! !DESCRIPTION: - ! Partition input grain fluxes into crop product pools - ! - ! For now this doesn't do much, since there is just a single (1-year) crop product - ! pool. But this provides the capability to add different crop product pools in the - ! future, without requiring any changes to code outside of this class. It also gives - ! symmetry with the wood fluxes. - ! - ! !USES: - use subgridAveMod, only : p2g - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - - ! dynamic landcover addition to crop product pool (g/m2/s) [patch]; although this is - ! a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), intent(in) :: dwt_crop_product_gain_patch( bounds%begp: ) - - ! grain to crop product pool(s) (g/m2/s) [patch] - real(r8) , intent(in) :: grain_to_cropprod_patch( bounds%begp: ) - ! - ! !LOCAL VARIABLES: - integer :: fp - integer :: p - integer :: g - - character(len=*), parameter :: subname = 'PartitionGrainFluxes' - !----------------------------------------------------------------------- - - ! Determine gains from crop harvest - - do fp = 1, num_soilp - p = filter_soilp(fp) - - ! For now all crop product is put in the 1-year crop product pool - this%grain_to_cropprod1_patch(p) = grain_to_cropprod_patch(p) - end do - - call p2g(bounds, & - this%grain_to_cropprod1_patch(bounds%begp:bounds%endp), & - this%grain_to_cropprod1_grc(bounds%begg:bounds%endg), & - p2c_scale_type = 'unity', & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - ! Determine gains from dynamic landcover - - do g = bounds%begg, bounds%endg - this%dwt_cropprod1_gain_grc(g) = 0._r8 - end do - - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - ! Note that the patch-level fluxes are expressed per unit gridcell area. So, to go - ! from patch-level fluxes to gridcell-level fluxes, we simply add up the various - ! patch contributions, without having to multiply by any area weightings. - this%dwt_cropprod1_gain_grc(g) = this%dwt_cropprod1_gain_grc(g) + & - dwt_crop_product_gain_patch(p) - end do - - end subroutine PartitionGrainFluxes - - - !----------------------------------------------------------------------- - subroutine ComputeSummaryVars(this, bounds) - ! - ! !DESCRIPTION: - ! Compute summary variables in this object: sums across multiple product pools - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_products_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! indices - - character(len=*), parameter :: subname = 'ComputeSummaryVars' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - ! total wood products - this%tot_woodprod_grc(g) = & - this%prod10_grc(g) + & - this%prod100_grc(g) - - ! total loss from wood products - this%tot_woodprod_loss_grc(g) = & - this%prod10_loss_grc(g) + & - this%prod100_loss_grc(g) - - ! total loss from ALL products - this%product_loss_grc(g) = & - this%cropprod1_loss_grc(g) + & - this%prod10_loss_grc(g) + & - this%prod100_loss_grc(g) - - this%dwt_woodprod_gain_grc(g) = & - this%dwt_prod100_gain_grc(g) + & - this%dwt_prod10_gain_grc(g) - end do - - end subroutine ComputeSummaryVars - - -end module CNProductsMod diff --git a/src/biogeochem/CNRootDynMod.F90 b/src/biogeochem/CNRootDynMod.F90 deleted file mode 100644 index b6ac830905..0000000000 --- a/src/biogeochem/CNRootDynMod.F90 +++ /dev/null @@ -1,277 +0,0 @@ -module CNRootDynMod - -!----------------------------------------------------------------------- -! !DESCRIPTION: -! Module holding routines used for determining fine root distribution for all pfts. -! Includes dynamic root depth for crops -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi, nlevgrnd - use clm_varctl , only : use_vertsoilc, use_bedrock - use decompMod , only : bounds_type - use pftconMod , only : noveg, npcropmin, pftcon - use ColumnType , only : col - use PatchType , only : patch - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use SoilStateType , only : soilstate_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use CropType , only : crop_type - -! !PUBLIC TYPES: - implicit none - save - private - public :: CNRootDyn -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -! -subroutine CNRootDyn(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, cnveg_carbonflux_inst, & - cnveg_state_inst, crop_inst, soilstate_inst, soilbiogeochem_nitrogenstate_inst) -! -! !DESCRIPTION: -! This routine determine the fine root distribution -! Needs to be called after the photosynthesis calculation -! May need to update other subroutines that use the fixed root profile for calculations -! i.e. CNVerticalProfileMod -! -! !USES: - - -! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer, intent(in) :: num_soilc - integer, intent(in) :: filter_soilc(:) - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts - type(cnveg_state_type) , intent(in) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(in) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(crop_type) , intent(in) :: crop_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - -! -! !LOCAL VARIABLES: - - integer :: f,c,p,lev,j ! indices - real(r8):: dt ! radiation time step delta t (seconds) - real(r8), allocatable :: w_limit(:) - real(r8), allocatable :: rswa(:,:) ! soil water availability in each soil layer - real(r8), allocatable :: rsmn(:,:) ! soil nitrogen availability in each soil layer - real(r8), allocatable :: sumrswa(:) ! scaling soil water availability in each soil layer - real(r8), allocatable :: sumrsmn(:) ! scaling soil mineral N availability in each soil layer - real(r8) :: frootc_dz(bounds%begp:bounds%endp, 1:nlevgrnd) - real(r8), allocatable :: sumfrootc(:) ! fine root carbon total before turnover in each step - real(r8):: minpsi ! minimum soil moisture potential - real(r8):: psi - real(r8):: maxpsi - real(r8):: new_growth - -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - associate(& - ivt => patch%itype , & ! Input: [integer (:)] pft vegetation type - pcolumn => patch%column , & ! Input: [integer (:)] pft's column index - roota_par => pftcon%roota_par , & ! Input: [real(r8) (:)] pft's roota index - rootb_par => pftcon%rootb_par , & ! Input: [real(r8) (:)] pft's rootb index - root_dmx => pftcon%root_dmx , & ! Input: [real(r8) (:)] crop maximum root depth - cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Input: [real(r8) (:)] allocation to fine root C (gC/m2/s) - frootc_xfer_to_frootc => cnveg_carbonflux_inst%frootc_xfer_to_frootc_patch , & ! Input: [real(r8) (:)] fine root C growth from storage (gC/m2/s) - dormant_flag => cnveg_state_inst%dormant_flag_patch , & ! Input: [real(r8) (:)] dormancy flag - root_depth => soilstate_inst%root_depth_patch , & ! InOut: [real(r8) (:)] current root depth - dz => col%dz , & ! Input: layer thickness (m) (-nlevsno+1:nlevgrnd) - zi => col%zi , & ! Input: interface level below a "z" level (m) (-nlevsno+0:nlevgrnd) - rootfr => soilstate_inst%rootfr_patch , & ! Output: [real(r8) (:,:)] fraction of roots in each soil layer - sucsat => soilstate_inst%sucsat_col , & ! Input: minimum soil suction (mm) - soilpsi => soilstate_inst%soilpsi_col , & ! Input: soil water potential in each soil layer (MPa) - sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Iniput: [real(r8) (:,:)] (gN/m3) soil mineral N - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:)] =gdd since planting (gddplant) - croplive => crop_inst%croplive_patch , & ! Input: [logical (:)] flag, true if planted, not harvested - huigrain => cnveg_state_inst%huigrain_patch & ! Input: [real(r8) (:)] same to reach vegetative maturity - ) - -! set time steps - dt = get_step_size() - -! set minpsi to permanent wilting point - minpsi = -1.5_r8 - - allocate(sumrswa(bounds%begp:bounds%endp)) - allocate(sumrsmn(bounds%begp:bounds%endp)) - allocate(sumfrootc(bounds%begp:bounds%endp)) - allocate(rswa(bounds%begp:bounds%endp,nlevgrnd)) - allocate(rsmn(bounds%begp:bounds%endp,nlevgrnd)) - allocate(w_limit(bounds%begp:bounds%endp)) - -!initialize to 0 - w_limit(bounds%begp:bounds%endp) = 0._r8 - sumrswa(bounds%begp:bounds%endp) = 0._r8 - sumrsmn(bounds%begp:bounds%endp) = 0._r8 - sumfrootc(bounds%begp:bounds%endp) = 0._r8 - rswa(bounds%begp:bounds%endp,:) = 0._r8 - rsmn(bounds%begp:bounds%endp,:) = 0._r8 - - frootc_dz(bounds%begp:bounds%endp,1:nlevgrnd) = 0._r8 - - -!--------------------------------------------------------------- -! Set root depth, dynamic for crops, fixed for other vegetation -!--------------------------------------------------------------- - - do f = 1, num_soilp - p = filter_soilp(f) - c = pcolumn(p) - if (ivt(p) /= noveg) then - if((ivt(p)) >= npcropmin)then !skip generic crop types - if(huigrain(p) > 0._r8)then - root_depth(p) = max(zi(c,2), min(hui(p)/huigrain(p)* root_dmx(ivt(p)), root_dmx(ivt(p)))) - end if - else - ! this can be changed to any depth (i.e. the maximum soil depth) - root_depth(p) = zi(c,nlevsoi) - end if - if (use_bedrock) then - root_depth(p) = min(root_depth(p),zi(c,col%nbedrock(c))) - end if - else - root_depth(p) = 0._r8 - end if - end do - -!---------------------------------------------------------------- -! ! calculate a weighting function by soil depth that depends on the - ! fine root distribution per pft and depth and the pft weight on the column. - ! This will be used to weight the temperature and water potential scalars - ! for decomposition control. - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlevsoi - do f = 1,num_soilp - p = filter_soilp(f) - c = pcolumn(p) - maxpsi = sucsat(c,j) * (-9.8e-6_r8) - psi = min(soilpsi(c,j),maxpsi) - if (psi > minpsi) then -! First calculate water in the root zone - if(root_depth(p) > 0.15_r8 .and. (zi(c,j) <= root_depth(p) .or. & - (zi(c,j-1) < root_depth(p) .and. zi(c,j) > root_depth(p)))) then - w_limit(p) = w_limit(p) + max(0._r8,log(minpsi/psi)/log(minpsi/maxpsi))*rootfr(p,j) - end if -! Calculate the water in each soil layer - if (root_depth(p) >= zi(c,j) .or. & - (zi(c,j-1) < root_depth(p) .and. zi(c,j) > root_depth(p))) then - rswa(p,j) = max(0._r8, (log(minpsi/psi)/log(minpsi/maxpsi))) - end if - end if - sumrswa(p) = sumrswa(p) + rswa(p,j) - -! Calculate the nitrogen profile in each layer -! For now, the profile for each PFT is equivilent to the -! column profile, in the future, this could be changed to a weighted profile - if(use_vertsoilc) then !for vertical soil profile - rsmn(p,j) = sminn_vr(c,j) - else ! need to calculate a profile, top 0.2m are constant, and decrease linearly - if(zi(c,j) <= 0.2_r8)then - rsmn(p,j) = dz(c,j) - end if - if(zi(c,j) > 0.2_r8)then - rsmn(p,j) = dz(c,j) * (zi(c,nlevsoi) - zi(c,j)) / (zi(c,nlevsoi) - 0.2_r8) - end if - end if - if (root_depth(p) >= zi(c,j).or. & - (zi(c,j-1) < root_depth(p) .and. zi(c,j) > root_depth(p))) then - sumrsmn(p) = sumrsmn(p) + rsmn(p,j) - end if - end do - end do - - -!-------------------------------------------------------------------- -! Now calculate the density of roots in each soil layer for each pft -! based on this timesteps growth -!-------------------------------------------------------------------- - do lev = 1, nlevgrnd - - do f = 1, num_soilp - p = filter_soilp(f) - c = pcolumn(p) - - new_growth = (cpool_to_frootc(p) + frootc_xfer_to_frootc(p))*dt - if(zi(c,lev) <= root_depth(p) .or. & - (zi(c,lev-1) < root_depth(p) .and. zi(c,lev) > root_depth(p))) then - if(sumrswa(p) <= 0._r8 .or. sumrsmn(p) <= 0._r8) then -! when sumrswa or sumrsmn are less than or equal to 0 rootfr will not be updated - else - frootc_dz(p,lev) = (frootc(p))*rootfr(p,lev) & - + new_growth * ((1._r8 - w_limit(p)) * rswa(p,lev) / sumrswa(p) & - + w_limit(p) * rsmn(p,lev) / sumrsmn(p)) - end if - else - frootc_dz(p,lev) = 0._r8 - end if - - sumfrootc(p) = sumfrootc(p) + frootc_dz(p,lev) - - end do - end do -!---------------------------------- -!Calculate root fraction -!---------------------------------- - - do lev = 1, nlevgrnd - do f = 1, num_soilp - p = filter_soilp(f) - c = pcolumn(p) - if(sumfrootc(p) > 0._r8)then - rootfr(p,lev) = frootc_dz(p,lev)/sumfrootc(p) - end if - if(ivt(p) >= npcropmin .and. .not. croplive(p))then -! CROPS are dormant, there are no roots! -! but, need an initial frootr so crops can start root production - if (lev < 2)then - rootfr(p,lev) = .5_r8*( exp(-roota_par(patch%itype(p)) * zi(c,lev-1)) & - + exp(-rootb_par(patch%itype(p)) * zi(c,lev-1)) & - - exp(-roota_par(patch%itype(p)) * zi(c,lev )) & - - exp(-rootb_par(patch%itype(p)) * zi(c,lev )) ) - elseif (lev == 2) then - rootfr(p,lev) = .5_r8*( exp(-roota_par(patch%itype(p)) * zi(c,lev-1)) & - + exp(-rootb_par(patch%itype(p)) * zi(c,lev-1)) ) - else - rootfr(p,lev) = 0.0_r8 - end if - - end if - end do - end do - -!********************** - deallocate(sumrswa) - deallocate(sumrsmn) - deallocate(sumfrootc) - deallocate(rsmn) - deallocate(rswa) - deallocate(w_limit) - - end associate - - end subroutine CNRootDyn - -end module CNRootDynMod diff --git a/src/biogeochem/CNSharedParamsMod.F90 b/src/biogeochem/CNSharedParamsMod.F90 deleted file mode 100644 index 42156b1158..0000000000 --- a/src/biogeochem/CNSharedParamsMod.F90 +++ /dev/null @@ -1,192 +0,0 @@ -module CNSharedParamsMod - - !----------------------------------------------------------------------- - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - - ! CNParamsShareInst. PGI wants the type decl. public but the instance - ! is indeed protected. A generic private statement at the start of the module - ! overrides the protected functionality with PGI - - type, public :: CNParamsShareType - real(r8) :: Q10 ! temperature dependence - real(r8) :: minpsi ! minimum soil water potential for heterotrophic resp - real(r8) :: cwd_fcel ! cellulose fraction of coarse woody debris - real(r8) :: cwd_flig ! lignin fraction of coarse woody debris - real(r8) :: froz_q10 ! separate q10 for frozen soil respiration rates - real(r8) :: decomp_depth_efolding ! e-folding depth for reduction in decomposition (m) - real(r8) :: mino2lim ! minimum anaerobic decomposition rate as a fraction of potential aerobic rate - real(r8) :: organic_max ! organic matter content (kg/m3) where soil is assumed to act like peat - logical :: constrain_stress_deciduous_onset ! if true use additional constraint on stress deciduous onset trigger - end type CNParamsShareType - - type(CNParamsShareType), protected :: CNParamsShareInst - - logical, public :: anoxia_wtsat = .false. - logical, public :: use_fun = .false. ! Use the FUN2.0 model - integer, public :: nlev_soildecomp_standard = 5 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNParamsReadShared(ncid, namelist_file) - - use ncdio_pio , only : file_desc_t - - type(file_desc_t), intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: namelist_file - - call CNParamsReadShared_netcdf(ncid) - call CNParamsReadShared_namelist(namelist_file) - - end subroutine CNParamsReadShared - - !----------------------------------------------------------------------- - subroutine CNParamsReadShared_netcdf(ncid) - ! - use ncdio_pio , only : file_desc_t, ncd_io - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - character(len=32) :: subname = 'CNParamsReadShared' - character(len=100) :: errCode = '-Error reading in CN and BGC shared params file. Var:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - ! - ! netcdf read here - ! - tString='q10_mr' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%Q10=tempr - - tString='minpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%minpsi=tempr - - tString='cwd_fcel' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%cwd_fcel=tempr - - tString='cwd_flig' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%cwd_flig=tempr - - tString='froz_q10' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%froz_q10=tempr - - tString='mino2lim' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%mino2lim=tempr - !CNParamsShareInst%mino2lim=0.2_r8 - - tString='organic_max' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - CNParamsShareInst%organic_max=tempr - - end subroutine CNParamsReadShared_netcdf - - !----------------------------------------------------------------------- - subroutine CNParamsReadShared_namelist(namelist_file) - ! - ! !DESCRIPTION: - ! Read and initialize CN Shared parameteres from the namelist. - ! - ! !USES: - use fileutils , only : relavu, getavu - use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_LOGICAL - use shr_nl_mod , only : shr_nl_find_group_name - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_mpi_mod , only : shr_mpi_bcast - - ! - implicit none - ! - - character(len=*), intent(in) :: namelist_file - - integer :: i,j,n ! loop indices - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - real(r8) :: decomp_depth_efolding = 0.0_r8 - logical :: constrain_stress_deciduous_onset = .false. - - character(len=32) :: subroutine_name = 'CNParamsReadNamelist' - character(len=10) :: namelist_group = 'bgc_shared' - - !----------------------------------------------------------------------- - - ! ---------------------------------------------------------------------- - ! Namelist Variables - ! ---------------------------------------------------------------------- - - namelist /bgc_shared/ & - decomp_depth_efolding, & - constrain_stress_deciduous_onset - - - ! Read namelist from standard input. - if (masterproc) then - - write(iulog,*) 'Attempting to read CN/BGC shared namelist parameters .....' - unitn = getavu() - write(iulog,*) 'Read in ' // namelist_group // ' namelist from: ', trim(namelist_file) - open( unitn, file=trim(namelist_file), status='old' ) - call shr_nl_find_group_name(unitn, namelist_group, status=ierr) - if (ierr == 0) then - read(unitn, bgc_shared, iostat=ierr) - if (ierr /= 0) then - call endrun(msg='error in reading in ' // namelist_group // ' namelist' // & - errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='error in finding ' // namelist_group // ' namelist' // & - errMsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if ! masterproc - - ! Broadcast the parameters from master - call shr_mpi_bcast ( decomp_depth_efolding, mpicom ) - call shr_mpi_bcast ( constrain_stress_deciduous_onset, mpicom ) - - ! Save the parameter to the instance - CNParamsShareInst%decomp_depth_efolding = decomp_depth_efolding - CNParamsShareInst%constrain_stress_deciduous_onset = constrain_stress_deciduous_onset - - ! Output read parameters to the lnd.log - if (masterproc) then - write(iulog,*) 'CN/BGC shared namelist parameters:' - write(iulog,*)' ' - write(iulog,*)' decomp_depth_efolding = ', decomp_depth_efolding - write(iulog,*)' constrain_stress_deciduous_onset = ',constrain_stress_deciduous_onset - - write(iulog,*) - - end if - - end subroutine CNParamsReadShared_namelist - -end module CNSharedParamsMod diff --git a/src/biogeochem/CNSpeciesMod.F90 b/src/biogeochem/CNSpeciesMod.F90 deleted file mode 100644 index fc89f3ac02..0000000000 --- a/src/biogeochem/CNSpeciesMod.F90 +++ /dev/null @@ -1,68 +0,0 @@ -module CNSpeciesMod - - !----------------------------------------------------------------------- - ! Module holding information about different species available in the CN code (C, C13, - ! C14, N). - ! - ! - ! NOTE(wjs, 2016-06-05) Eventually I could imagine having a cn_species base class, with - ! derived classes for each species type - so a cn_species_c class, a cn_species_c13 - ! class, a cn_species_c14 class and a cn_species_n class. These would contain methods - ! to handle calculations specific to each species type. For example, there could be a - ! carbon_multiplier method that returns the species-specific multiplier that you would - ! apply to a variable in units of gC/m2 to give you g[this species]/m2 (this would - ! depend on pft type). - ! - ! Basically, anywhere where there is code that has a conditional based on the constants - ! defined here, we could replace that with polymorphism using a cn_species class. - ! - ! Eventually I think it would make sense to make this contain an instance of - ! species_base_type (i.e., the class used to determine history & restart field names), - ! with forwarding methods. So then (e.g.) a cn_products_type object would just contain a - ! cn_species object (which in turn would contain a species_metadata [or whatever we call - ! it] object). - - implicit none - private - - integer, parameter, public :: CN_SPECIES_C12 = 1 - integer, parameter, public :: CN_SPECIES_C13 = 2 - integer, parameter, public :: CN_SPECIES_C14 = 3 - integer, parameter, public :: CN_SPECIES_N = 4 - - public :: species_from_string ! convert a string representation to one of the constants defined here - -contains - - !----------------------------------------------------------------------- - function species_from_string(species_string) result(species) - ! - ! !DESCRIPTION: - ! Convert a string representation to one of the constants defined here - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: species ! function result - character(len=*), intent(in) :: species_string ! string representation of species (should be lowercase) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'species_from_string' - !----------------------------------------------------------------------- - - select case (species_string) - case ('c12') - species = CN_SPECIES_C12 - case ('c13') - species = CN_SPECIES_C13 - case ('c14') - species = CN_SPECIES_C14 - case ('n') - species = CN_SPECIES_N - end select - - end function species_from_string - - -end module CNSpeciesMod diff --git a/src/biogeochem/CNVegCarbonFluxType.F90 b/src/biogeochem/CNVegCarbonFluxType.F90 deleted file mode 100644 index 2ec35353f0..0000000000 --- a/src/biogeochem/CNVegCarbonFluxType.F90 +++ /dev/null @@ -1,4597 +0,0 @@ -module CNVegCarbonFluxType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp_full, nlevgrnd, nlevdecomp - use clm_varcon , only : spval, dzsoi_decomp - use clm_varctl , only : use_cndv, use_c13, use_nitrif_denitrif, use_crop - use clm_varctl , only : use_grainproduct - use clm_varctl , only : iulog - use landunit_varcon , only : istsoil, istcrop, istdlak - use pftconMod , only : npcropmin - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use AnnualFluxDribbler , only : annual_flux_dribbler_type, annual_flux_dribbler_gridcell - use dynSubgridControlMod , only : get_for_testing_allow_non_annual_changes - use abortutils , only : endrun - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: cnveg_carbonflux_type - - ! gap mortality fluxes - real(r8), pointer :: m_leafc_to_litter_patch (:) ! leaf C mortality (gC/m2/s) - real(r8), pointer :: m_leafc_storage_to_litter_patch (:) ! leaf C storage mortality (gC/m2/s) - real(r8), pointer :: m_leafc_xfer_to_litter_patch (:) ! leaf C transfer mortality (gC/m2/s) - real(r8), pointer :: m_frootc_to_litter_patch (:) ! fine root C mortality (gC/m2/s) - real(r8), pointer :: m_frootc_storage_to_litter_patch (:) ! fine root C storage mortality (gC/m2/s) - real(r8), pointer :: m_frootc_xfer_to_litter_patch (:) ! fine root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_to_litter_patch (:) ! live stem C mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_storage_to_litter_patch (:) ! live stem C storage mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_xfer_to_litter_patch (:) ! live stem C transfer mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_to_litter_patch (:) ! dead stem C mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_storage_to_litter_patch (:) ! dead stem C storage mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_xfer_to_litter_patch (:) ! dead stem C transfer mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_to_litter_patch (:) ! live coarse root C mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_storage_to_litter_patch (:) ! live coarse root C storage mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_xfer_to_litter_patch (:) ! live coarse root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_litter_patch (:) ! dead coarse root C mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_storage_to_litter_patch (:) ! dead coarse root C storage mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_xfer_to_litter_patch (:) ! dead coarse root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_gresp_storage_to_litter_patch (:) ! growth respiration storage mortality (gC/m2/s) - real(r8), pointer :: m_gresp_xfer_to_litter_patch (:) ! growth respiration transfer mortality (gC/m2/s) - - ! harvest mortality fluxes - real(r8), pointer :: hrv_leafc_to_litter_patch (:) ! leaf C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_leafc_storage_to_litter_patch (:) ! leaf C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_leafc_xfer_to_litter_patch (:) ! leaf C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_to_litter_patch (:) ! fine root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_storage_to_litter_patch (:) ! fine root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_xfer_to_litter_patch (:) ! fine root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_to_litter_patch (:) ! live stem C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_storage_to_litter_patch (:) ! live stem C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_xfer_to_litter_patch (:) ! live stem C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_storage_to_litter_patch (:) ! dead stem C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter_patch (:) ! dead stem C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_to_litter_patch (:) ! live coarse root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_storage_to_litter_patch (:) ! live coarse root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter_patch (:) ! live coarse root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_to_litter_patch (:) ! dead coarse root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter_patch (:) ! dead coarse root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter_patch (:) ! dead coarse root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_gresp_storage_to_litter_patch (:) ! growth respiration storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_gresp_xfer_to_litter_patch (:) ! growth respiration transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_xsmrpool_to_atm_patch (:) ! excess MR pool harvest mortality (gC/m2/s) - - ! fire fluxes - real(r8), pointer :: m_leafc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from leafc - real(r8), pointer :: m_leafc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from leafc_storage - real(r8), pointer :: m_leafc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from leafc_xfer - real(r8), pointer :: m_livestemc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livestemc - real(r8), pointer :: m_livestemc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livestemc_storage - real(r8), pointer :: m_livestemc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livestemc_xfer - real(r8), pointer :: m_deadstemc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadstemc_xfer - real(r8), pointer :: m_deadstemc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadstemc_storage - real(r8), pointer :: m_deadstemc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadstemc_xfer - real(r8), pointer :: m_frootc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from frootc - real(r8), pointer :: m_frootc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from frootc_storage - real(r8), pointer :: m_frootc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from frootc_xfer - real(r8), pointer :: m_livecrootc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livecrootc - real(r8), pointer :: m_livecrootc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livecrootc_storage - real(r8), pointer :: m_livecrootc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from livecrootc_xfer - real(r8), pointer :: m_deadcrootc_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadcrootc - real(r8), pointer :: m_deadcrootc_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadcrootc_storage - real(r8), pointer :: m_deadcrootc_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from deadcrootc_xfer - real(r8), pointer :: m_gresp_storage_to_fire_patch (:) ! (gC/m2/s) fire C emissions from gresp_storage - real(r8), pointer :: m_gresp_xfer_to_fire_patch (:) ! (gC/m2/s) fire C emissions from gresp_xfer - real(r8), pointer :: m_leafc_to_litter_fire_patch (:) ! (gC/m2/s) from leafc to litter c due to fire - real(r8), pointer :: m_leafc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from leafc_storage to litter C due to fire - real(r8), pointer :: m_leafc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from leafc_xfer to litter C due to fire - real(r8), pointer :: m_livestemc_to_litter_fire_patch (:) ! (gC/m2/s) from livestemc to litter C due to fire - real(r8), pointer :: m_livestemc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from livestemc_storage to litter C due to fire - real(r8), pointer :: m_livestemc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from livestemc_xfer to litter C due to fire - real(r8), pointer :: m_livestemc_to_deadstemc_fire_patch (:) ! (gC/m2/s) from livestemc to deadstemc due to fire - real(r8), pointer :: m_deadstemc_to_litter_fire_patch (:) ! (gC/m2/s) from deadstemc to litter C due to fire - real(r8), pointer :: m_deadstemc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from deadstemc_storage to litter C due to fire - real(r8), pointer :: m_deadstemc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from deadstemc_xfer to litter C due to fire - real(r8), pointer :: m_frootc_to_litter_fire_patch (:) ! (gC/m2/s) from frootc to litter C due to fire - real(r8), pointer :: m_frootc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from frootc_storage to litter C due to fire - real(r8), pointer :: m_frootc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from frootc_xfer to litter C due to fire - real(r8), pointer :: m_livecrootc_to_litter_fire_patch (:) ! (gC/m2/s) from livecrootc to litter C due to fire - real(r8), pointer :: m_livecrootc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from livecrootc_storage to litter C due to fire - real(r8), pointer :: m_livecrootc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from livecrootc_xfer to litter C due to fire - real(r8), pointer :: m_livecrootc_to_deadcrootc_fire_patch (:) ! (gC/m2/s) from livecrootc to deadstemc due to fire - real(r8), pointer :: m_deadcrootc_to_litter_fire_patch (:) ! (gC/m2/s) from deadcrootc to litter C due to fire - real(r8), pointer :: m_deadcrootc_storage_to_litter_fire_patch (:) ! (gC/m2/s) from deadcrootc_storage to litter C due to fire - real(r8), pointer :: m_deadcrootc_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from deadcrootc_xfer to litter C due to fire - real(r8), pointer :: m_gresp_storage_to_litter_fire_patch (:) ! (gC/m2/s) from gresp_storage to litter C due to fire - real(r8), pointer :: m_gresp_xfer_to_litter_fire_patch (:) ! (gC/m2/s) from gresp_xfer to litter C due to fire - - ! phenology fluxes from transfer pools - real(r8), pointer :: grainc_xfer_to_grainc_patch (:) ! grain C growth from storage for prognostic crop(gC/m2/s) - real(r8), pointer :: leafc_xfer_to_leafc_patch (:) ! leaf C growth from storage (gC/m2/s) - real(r8), pointer :: frootc_xfer_to_frootc_patch (:) ! fine root C growth from storage (gC/m2/s) - real(r8), pointer :: livestemc_xfer_to_livestemc_patch (:) ! live stem C growth from storage (gC/m2/s) - real(r8), pointer :: deadstemc_xfer_to_deadstemc_patch (:) ! dead stem C growth from storage (gC/m2/s) - real(r8), pointer :: livecrootc_xfer_to_livecrootc_patch (:) ! live coarse root C growth from storage (gC/m2/s) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc_patch (:) ! dead coarse root C growth from storage (gC/m2/s) - - ! leaf and fine root litterfall fluxes - real(r8), pointer :: leafc_to_litter_patch (:) ! leaf C litterfall (gC/m2/s) - real(r8), pointer :: leafc_to_litter_fun_patch (:) ! leaf C litterfall used by FUN (gC/m2/s) - real(r8), pointer :: frootc_to_litter_patch (:) ! fine root C litterfall (gC/m2/s) - real(r8), pointer :: livestemc_to_litter_patch (:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc_to_food_patch (:) ! grain C to food for prognostic crop(gC/m2/s) - real(r8), pointer :: grainc_to_seed_patch (:) ! grain C to seed for prognostic crop(gC/m2/s) - - ! maintenance respiration fluxes - real(r8), pointer :: cpool_to_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_storage_resp_patch (:) ! CNflex excess C maintenance respiration (gC/m2/s) - real(r8), pointer :: leaf_mr_patch (:) ! leaf maintenance respiration (gC/m2/s) - real(r8), pointer :: froot_mr_patch (:) ! fine root maintenance respiration (gC/m2/s) - real(r8), pointer :: livestem_mr_patch (:) ! live stem maintenance respiration (gC/m2/s) - real(r8), pointer :: livecroot_mr_patch (:) ! live coarse root maintenance respiration (gC/m2/s) - real(r8), pointer :: grain_mr_patch (:) ! crop grain or organs maint. respiration (gC/m2/s) - real(r8), pointer :: leaf_curmr_patch (:) ! leaf maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: froot_curmr_patch (:) ! fine root maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: livestem_curmr_patch (:) ! live stem maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: livecroot_curmr_patch (:) ! live coarse root maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: grain_curmr_patch (:) ! crop grain or organs maint. respiration from current GPP (gC/m2/s) - real(r8), pointer :: leaf_xsmr_patch (:) ! leaf maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: froot_xsmr_patch (:) ! fine root maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: livestem_xsmr_patch (:) ! live stem maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: livecroot_xsmr_patch (:) ! live coarse root maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: grain_xsmr_patch (:) ! crop grain or organs maint. respiration from storage (gC/m2/s) - - ! photosynthesis fluxes - real(r8), pointer :: psnsun_to_cpool_patch (:) ! C fixation from sunlit canopy (gC/m2/s) - real(r8), pointer :: psnshade_to_cpool_patch (:) ! C fixation from shaded canopy (gC/m2/s) - - ! allocation fluxes, from current GPP - real(r8), pointer :: cpool_to_xsmrpool_patch (:) ! allocation to maintenance respiration storage pool (gC/m2/s) - real(r8), pointer :: cpool_to_grainc_patch (:) ! allocation to grain C for prognostic crop(gC/m2/s) - real(r8), pointer :: cpool_to_grainc_storage_patch (:) ! allocation to grain C storage for prognostic crop(gC/m2/s) - real(r8), pointer :: cpool_to_leafc_patch (:) ! allocation to leaf C (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_storage_patch (:) ! allocation to leaf C storage (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_patch (:) ! allocation to fine root C (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_storage_patch (:) ! allocation to fine root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_patch (:) ! allocation to live stem C (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_storage_patch (:) ! allocation to live stem C storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc_patch (:) ! allocation to dead stem C (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc_storage_patch (:) ! allocation to dead stem C storage (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_patch (:) ! allocation to live coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_storage_patch (:) ! allocation to live coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc_patch (:) ! allocation to dead coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc_storage_patch (:) ! allocation to dead coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_gresp_storage_patch (:) ! allocation to growth respiration storage (gC/m2/s) - - ! growth respiration fluxes - real(r8), pointer :: xsmrpool_to_atm_patch (:) ! excess MR pool harvest mortality (gC/m2/s) - real(r8), pointer :: cpool_leaf_gr_patch (:) ! leaf growth respiration (gC/m2/s) - real(r8), pointer :: cpool_leaf_storage_gr_patch (:) ! leaf growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_leaf_gr_patch (:) ! leaf growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_froot_gr_patch (:) ! fine root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_froot_storage_gr_patch (:) ! fine root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_froot_gr_patch (:) ! fine root growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_livestem_gr_patch (:) ! live stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livestem_storage_gr_patch (:) ! live stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_livestem_gr_patch (:) ! live stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_deadstem_gr_patch (:) ! dead stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadstem_storage_gr_patch (:) ! dead stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadstem_gr_patch (:) ! dead stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_livecroot_gr_patch (:) ! live coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livecroot_storage_gr_patch (:) ! live coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_livecroot_gr_patch (:) ! live coarse root growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_gr_patch (:) ! dead coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_storage_gr_patch (:) ! dead coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadcroot_gr_patch (:) ! dead coarse root growth respiration from storage (gC/m2/s) - - ! growth respiration for prognostic crop model - real(r8), pointer :: cpool_grain_gr_patch (:) ! grain growth respiration (gC/m2/s) - real(r8), pointer :: cpool_grain_storage_gr_patch (:) ! grain growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_grain_gr_patch (:) ! grain growth respiration from storage (gC/m2/s) - - ! annual turnover of storage to transfer pools - real(r8), pointer :: grainc_storage_to_xfer_patch (:) ! grain C shift storage to transfer for prognostic crop model (gC/m2/s) - real(r8), pointer :: leafc_storage_to_xfer_patch (:) ! leaf C shift storage to transfer (gC/m2/s) - real(r8), pointer :: frootc_storage_to_xfer_patch (:) ! fine root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livestemc_storage_to_xfer_patch (:) ! live stem C shift storage to transfer (gC/m2/s) - real(r8), pointer :: deadstemc_storage_to_xfer_patch (:) ! dead stem C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livecrootc_storage_to_xfer_patch (:) ! live coarse root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: deadcrootc_storage_to_xfer_patch (:) ! dead coarse root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: gresp_storage_to_xfer_patch (:) ! growth respiration shift storage to transfer (gC/m2/s) - - ! turnover of livewood to deadwood - real(r8), pointer :: livestemc_to_deadstemc_patch (:) ! live stem C turnover (gC/m2/s) - real(r8), pointer :: livecrootc_to_deadcrootc_patch (:) ! live coarse root C turnover (gC/m2/s) - - ! phenology: litterfall and crop fluxes - real(r8), pointer :: phenology_c_to_litr_met_c_col (:,:) ! C fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gC/m3/s) - real(r8), pointer :: phenology_c_to_litr_cel_c_col (:,:) ! C fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gC/m3/s) - real(r8), pointer :: phenology_c_to_litr_lig_c_col (:,:) ! C fluxes associated with phenology (litterfall and crop) to litter lignin pool (gC/m3/s) - - ! gap mortality - real(r8), pointer :: gap_mortality_c_to_litr_met_c_col (:,:) ! C fluxes associated with gap mortality to litter metabolic pool (gC/m3/s) - real(r8), pointer :: gap_mortality_c_to_litr_cel_c_col (:,:) ! C fluxes associated with gap mortality to litter cellulose pool (gC/m3/s) - real(r8), pointer :: gap_mortality_c_to_litr_lig_c_col (:,:) ! C fluxes associated with gap mortality to litter lignin pool (gC/m3/s) - real(r8), pointer :: gap_mortality_c_to_cwdc_col (:,:) ! C fluxes associated with gap mortality to CWD pool (gC/m3/s) - - ! fire - real(r8), pointer :: fire_mortality_c_to_cwdc_col (:,:) ! C fluxes associated with fire mortality to CWD pool (gC/m3/s) - - ! harvest - real(r8), pointer :: harvest_c_to_litr_met_c_col (:,:) ! C fluxes associated with harvest to litter metabolic pool (gC/m3/s) - real(r8), pointer :: harvest_c_to_litr_cel_c_col (:,:) ! C fluxes associated with harvest to litter cellulose pool (gC/m3/s) - real(r8), pointer :: harvest_c_to_litr_lig_c_col (:,:) ! C fluxes associated with harvest to litter lignin pool (gC/m3/s) - real(r8), pointer :: harvest_c_to_cwdc_col (:,:) ! C fluxes associated with harvest to CWD pool (gC/m3/s) - real(r8), pointer :: grainc_to_cropprodc_patch (:) ! grain C to crop product pool (gC/m2/s) - real(r8), pointer :: grainc_to_cropprodc_col (:) ! grain C to crop product pool (gC/m2/s) - - ! fire fluxes - real(r8), pointer :: m_decomp_cpools_to_fire_vr_col (:,:,:) ! vertically-resolved decomposing C fire loss (gC/m3/s) - real(r8), pointer :: m_decomp_cpools_to_fire_col (:,:) ! vertically-integrated (diagnostic) decomposing C fire loss (gC/m2/s) - real(r8), pointer :: m_c_to_litr_met_fire_col (:,:) ! C from leaf, froot, xfer and storage C to litter labile C by fire (gC/m3/s) - real(r8), pointer :: m_c_to_litr_cel_fire_col (:,:) ! C from leaf, froot, xfer and storage C to litter cellulose C by fire (gC/m3/s) - real(r8), pointer :: m_c_to_litr_lig_fire_col (:,:) ! C from leaf, froot, xfer and storage C to litter lignin C by fire (gC/m3/s) - - ! dynamic landcover fluxes - real(r8), pointer :: dwt_seedc_to_leaf_patch (:) ! (gC/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedc_to_leaf_grc (:) ! (gC/m2/s) dwt_seedc_to_leaf_patch summed to the gridcell-level - real(r8), pointer :: dwt_seedc_to_deadstem_patch (:) ! (gC/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedc_to_deadstem_grc (:) ! (gC/m2/s) dwt_seedc_to_leaf_patch summed to the gridcell-level - real(r8), pointer :: dwt_conv_cflux_patch (:) ! (gC/m2/s) conversion C flux (immediate loss to atm); although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_conv_cflux_grc (:) ! (gC/m2/s) dwt_conv_cflux_patch summed to the gridcell-level - real(r8), pointer :: dwt_conv_cflux_dribbled_grc (:) ! (gC/m2/s) dwt_conv_cflux_grc dribbled evenly throughout the year - real(r8), pointer :: dwt_wood_productc_gain_patch (:) ! (gC/m2/s) addition to wood product pools from landcover change; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_crop_productc_gain_patch (:) ! (gC/m2/s) addition to crop product pools from landcover change; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_slash_cflux_col (:) ! (gC/m2/s) conversion slash flux due to landcover change - real(r8), pointer :: dwt_frootc_to_litr_met_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootc_to_litr_cel_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootc_to_litr_lig_c_col (:,:) ! (gC/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_livecrootc_to_cwdc_col (:,:) ! (gC/m3/s) live coarse root to CWD due to landcover change - real(r8), pointer :: dwt_deadcrootc_to_cwdc_col (:,:) ! (gC/m3/s) dead coarse root to CWD due to landcover change - - ! crop fluxes - real(r8), pointer :: crop_seedc_to_leaf_patch (:) ! (gC/m2/s) seed source to leaf, for crops - - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: gpp_before_downreg_patch (:) ! (gC/m2/s) gross primary production before down regulation - real(r8), pointer :: current_gr_patch (:) ! (gC/m2/s) growth resp for new growth displayed in this timestep - real(r8), pointer :: transfer_gr_patch (:) ! (gC/m2/s) growth resp for transfer growth displayed in this timestep - real(r8), pointer :: storage_gr_patch (:) ! (gC/m2/s) growth resp for growth sent to storage for later display - real(r8), pointer :: plant_calloc_patch (:) ! (gC/m2/s) total allocated C flux - real(r8), pointer :: excess_cflux_patch (:) ! (gC/m2/s) C flux not allocated due to downregulation - real(r8), pointer :: prev_leafc_to_litter_patch (:) ! (gC/m2/s) previous timestep leaf C litterfall flux - real(r8), pointer :: prev_frootc_to_litter_patch (:) ! (gC/m2/s) previous timestep froot C litterfall flux - real(r8), pointer :: availc_patch (:) ! (gC/m2/s) C flux available for allocation - real(r8), pointer :: xsmrpool_recover_patch (:) ! (gC/m2/s) C flux assigned to recovery of negative cpool - real(r8), pointer :: xsmrpool_c13ratio_patch (:) ! C13/C(12+13) ratio for xsmrpool (proportion) - - real(r8), pointer :: cwdc_hr_col (:) ! (gC/m2/s) col-level coarse woody debris C heterotrophic respiration - real(r8), pointer :: cwdc_loss_col (:) ! (gC/m2/s) col-level coarse woody debris C loss - real(r8), pointer :: litterc_loss_col (:) ! (gC/m2/s) col-level litter C loss - real(r8), pointer :: frootc_alloc_patch (:) ! (gC/m2/s) patch-level fine root C alloc - real(r8), pointer :: frootc_loss_patch (:) ! (gC/m2/s) patch-level fine root C loss - real(r8), pointer :: leafc_alloc_patch (:) ! (gC/m2/s) patch-level leaf C alloc - real(r8), pointer :: leafc_loss_patch (:) ! (gC/m2/s) patch-level leaf C loss - real(r8), pointer :: woodc_alloc_patch (:) ! (gC/m2/s) patch-level wood C alloc - real(r8), pointer :: woodc_loss_patch (:) ! (gC/m2/s) patch-level wood C loss - - real(r8), pointer :: gpp_patch (:) ! (gC/m2/s) patch gross primary production - real(r8), pointer :: gpp_col (:) ! (gC/m2/s) column GPP flux before downregulation (p2c) - real(r8), pointer :: rr_patch (:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: rr_col (:) ! (gC/m2/s) root respiration (fine root MR + total root GR) (p2c) - real(r8), pointer :: mr_patch (:) ! (gC/m2/s) maintenance respiration - real(r8), pointer :: gr_patch (:) ! (gC/m2/s) total growth respiration - real(r8), pointer :: ar_patch (:) ! (gC/m2/s) patch autotrophic respiration (MR + GR) - real(r8), pointer :: ar_col (:) ! (gC/m2/s) column autotrophic respiration (MR + GR) (p2c) - real(r8), pointer :: npp_patch (:) ! (gC/m2/s) patch net primary production - real(r8), pointer :: npp_col (:) ! (gC/m2/s) column net primary production (p2c) - real(r8), pointer :: agnpp_patch (:) ! (gC/m2/s) aboveground NPP - real(r8), pointer :: bgnpp_patch (:) ! (gC/m2/s) belowground NPP - real(r8), pointer :: litfall_patch (:) ! (gC/m2/s) patch litterfall (leaves and fine roots) - real(r8), pointer :: wood_harvestc_patch (:) ! (gC/m2/s) patch-level wood harvest (to product pools) - real(r8), pointer :: wood_harvestc_col (:) ! (gC/m2/s) column-level wood harvest (to product pools) (p2c) - real(r8), pointer :: slash_harvestc_patch (:) ! (gC/m2/s) patch-level slash from harvest (to litter) - real(r8), pointer :: cinputs_patch (:) ! (gC/m2/s) patch-level carbon inputs (for balance checking) - real(r8), pointer :: coutputs_patch (:) ! (gC/m2/s) patch-level carbon outputs (for balance checking) - real(r8), pointer :: sr_col (:) ! (gC/m2/s) total soil respiration (HR + root resp) - real(r8), pointer :: er_col (:) ! (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - real(r8), pointer :: litfire_col (:) ! (gC/m2/s) litter fire losses - real(r8), pointer :: somfire_col (:) ! (gC/m2/s) soil organic matter fire losses - real(r8), pointer :: totfire_col (:) ! (gC/m2/s) total ecosystem fire losses - real(r8), pointer :: hrv_xsmrpool_to_atm_col (:) ! (gC/m2/s) excess MR pool harvest mortality (p2c) - - ! fire code - real(r8), pointer :: fire_closs_patch (:) ! (gC/m2/s) total fire C loss - real(r8), pointer :: fire_closs_p2c_col (:) ! (gC/m2/s) patch2col averaged column-level fire C loss (p2c) - real(r8), pointer :: fire_closs_col (:) ! (gC/m2/s) total patch-level fire C loss - - ! temporary and annual sums - real(r8), pointer :: tempsum_litfall_patch (:) ! (gC/m2/yr) temporary annual sum of litfall (CNDV only for now) - real(r8), pointer :: annsum_litfall_patch (:) ! (gC/m2/yr) annual sum of litfall (CNDV only for now) - real(r8), pointer :: tempsum_npp_patch (:) ! (gC/m2/yr) temporary annual sum of NPP - real(r8), pointer :: annsum_npp_patch (:) ! (gC/m2/yr) annual sum of NPP - real(r8), pointer :: annsum_npp_col (:) ! (gC/m2/yr) annual sum of NPP, averaged from patch-level - real(r8), pointer :: lag_npp_col (:) ! (gC/m2/yr) lagged net primary production - - ! Summary C fluxes. - real(r8), pointer :: nep_col (:) ! (gC/m2/s) net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink - real(r8), pointer :: nbp_grc (:) ! (gC/m2/s) net biome production, includes fire, landuse, harvest and hrv_xsmrpool flux, positive for sink (same as net carbon exchange between land and atmosphere) - real(r8), pointer :: nee_grc (:) ! (gC/m2/s) net ecosystem exchange of carbon, includes fire and hrv_xsmrpool, excludes landuse and harvest flux, positive for source - - ! Dynamic landcover fluxnes - real(r8), pointer :: landuseflux_grc(:) ! (gC/m2/s) dwt_conv_cflux+product_closs - real(r8), pointer :: npp_Nactive_patch (:) ! C used by mycorrhizal uptake (gC/m2/s) - real(r8), pointer :: npp_burnedoff_patch (:) ! C that cannot be used for N uptake (gC/m2/s) - real(r8), pointer :: npp_Nnonmyc_patch (:) ! C used by non-myc uptake (gC/m2/s) - real(r8), pointer :: npp_Nam_patch (:) ! C used by AM plant (gC/m2/s) - real(r8), pointer :: npp_Necm_patch (:) ! C used by ECM plant (gC/m2/s) - real(r8), pointer :: npp_Nactive_no3_patch (:) ! C used by mycorrhizal uptake (gC/m2/s) - real(r8), pointer :: npp_Nactive_nh4_patch (:) ! C used by mycorrhizal uptake (gC/m2/s) - real(r8), pointer :: npp_Nnonmyc_no3_patch (:) ! C used by non-myc (gC/m2/s) - real(r8), pointer :: npp_Nnonmyc_nh4_patch (:) ! C used by non-myc (gC/m2/s) - real(r8), pointer :: npp_Nam_no3_patch (:) ! C used by AM plant (gC/m2/s) - real(r8), pointer :: npp_Nam_nh4_patch (:) ! C used by AM plant (gC/m2/s) - real(r8), pointer :: npp_Necm_no3_patch (:) ! C used by ECM plant (gC/m2/s) - real(r8), pointer :: npp_Necm_nh4_patch (:) ! C used by ECM plant (gC/m2/s) - real(r8), pointer :: npp_Nfix_patch (:) ! C used by Symbiotic BNF (gC/m2/s) - real(r8), pointer :: npp_Nretrans_patch (:) ! C used by retranslocation (gC/m2/s) - real(r8), pointer :: npp_Nuptake_patch (:) ! Total C used by N uptake in FUN (gC/m2/s) - real(r8), pointer :: npp_growth_patch (:) ! Total C u for growth in FUN (gC/m2/s) - real(r8), pointer :: leafc_change_patch (:) ! Total used C from leaves (gC/m2/s) - real(r8), pointer :: soilc_change_patch (:) ! Total used C from soil (gC/m2/s) - -! real(r8), pointer :: soilc_change_col (:) ! Total used C from soil (gC/m2/s) - - ! Objects that help convert once-per-year dynamic land cover changes into fluxes - ! that are dribbled throughout the year - type(annual_flux_dribbler_type) :: dwt_conv_cflux_dribbler - type(annual_flux_dribbler_type) :: hrv_xsmrpool_to_atm_dribbler - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - procedure , public :: Restart - procedure , private :: RestartBulkOnly ! Handle restart fields only present for bulk C - procedure , private :: RestartAllIsotopes ! Handle restart fields present for both bulk C and isotopes - procedure , public :: SetValues - procedure , public :: ZeroDWT - procedure , public :: Summary => Summary_carbonflux - - end type cnveg_carbonflux_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type) - - class(cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - - call this%InitAllocate ( bounds, carbon_type) - call this%InitHistory ( bounds, carbon_type ) - call this%InitCold (bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds, carbon_type) - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - logical :: allows_non_annual_delta - character(len=:), allocatable :: carbon_type_suffix - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%m_leafc_to_litter_patch (begp:endp)) ; this%m_leafc_to_litter_patch (:) = nan - allocate(this%m_frootc_to_litter_patch (begp:endp)) ; this%m_frootc_to_litter_patch (:) = nan - allocate(this%m_leafc_storage_to_litter_patch (begp:endp)) ; this%m_leafc_storage_to_litter_patch (:) = nan - allocate(this%m_frootc_storage_to_litter_patch (begp:endp)) ; this%m_frootc_storage_to_litter_patch (:) = nan - allocate(this%m_livestemc_storage_to_litter_patch (begp:endp)) ; this%m_livestemc_storage_to_litter_patch (:) = nan - allocate(this%m_deadstemc_storage_to_litter_patch (begp:endp)) ; this%m_deadstemc_storage_to_litter_patch (:) = nan - allocate(this%m_livecrootc_storage_to_litter_patch (begp:endp)) ; this%m_livecrootc_storage_to_litter_patch (:) = nan - allocate(this%m_deadcrootc_storage_to_litter_patch (begp:endp)) ; this%m_deadcrootc_storage_to_litter_patch (:) = nan - allocate(this%m_leafc_xfer_to_litter_patch (begp:endp)) ; this%m_leafc_xfer_to_litter_patch (:) = nan - allocate(this%m_frootc_xfer_to_litter_patch (begp:endp)) ; this%m_frootc_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemc_xfer_to_litter_patch (begp:endp)) ; this%m_livestemc_xfer_to_litter_patch (:) = nan - allocate(this%m_deadstemc_xfer_to_litter_patch (begp:endp)) ; this%m_deadstemc_xfer_to_litter_patch (:) = nan - allocate(this%m_livecrootc_xfer_to_litter_patch (begp:endp)) ; this%m_livecrootc_xfer_to_litter_patch (:) = nan - allocate(this%m_deadcrootc_xfer_to_litter_patch (begp:endp)) ; this%m_deadcrootc_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemc_to_litter_patch (begp:endp)) ; this%m_livestemc_to_litter_patch (:) = nan - allocate(this%m_deadstemc_to_litter_patch (begp:endp)) ; this%m_deadstemc_to_litter_patch (:) = nan - allocate(this%m_livecrootc_to_litter_patch (begp:endp)) ; this%m_livecrootc_to_litter_patch (:) = nan - allocate(this%m_deadcrootc_to_litter_patch (begp:endp)) ; this%m_deadcrootc_to_litter_patch (:) = nan - allocate(this%m_gresp_storage_to_litter_patch (begp:endp)) ; this%m_gresp_storage_to_litter_patch (:) = nan - allocate(this%m_gresp_xfer_to_litter_patch (begp:endp)) ; this%m_gresp_xfer_to_litter_patch (:) = nan - allocate(this%hrv_leafc_to_litter_patch (begp:endp)) ; this%hrv_leafc_to_litter_patch (:) = nan - allocate(this%hrv_leafc_storage_to_litter_patch (begp:endp)) ; this%hrv_leafc_storage_to_litter_patch (:) = nan - allocate(this%hrv_leafc_xfer_to_litter_patch (begp:endp)) ; this%hrv_leafc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_frootc_to_litter_patch (begp:endp)) ; this%hrv_frootc_to_litter_patch (:) = nan - allocate(this%hrv_frootc_storage_to_litter_patch (begp:endp)) ; this%hrv_frootc_storage_to_litter_patch (:) = nan - allocate(this%hrv_frootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_frootc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livestemc_to_litter_patch (begp:endp)) ; this%hrv_livestemc_to_litter_patch (:) = nan - allocate(this%hrv_livestemc_storage_to_litter_patch (begp:endp)) ; this%hrv_livestemc_storage_to_litter_patch (:) = nan - allocate(this%hrv_livestemc_xfer_to_litter_patch (begp:endp)) ; this%hrv_livestemc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadstemc_storage_to_litter_patch (begp:endp)) ; this%hrv_deadstemc_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadstemc_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadstemc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livecrootc_to_litter_patch (begp:endp)) ; this%hrv_livecrootc_to_litter_patch (:) = nan - allocate(this%hrv_livecrootc_storage_to_litter_patch (begp:endp)) ; this%hrv_livecrootc_storage_to_litter_patch (:) = nan - allocate(this%hrv_livecrootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_livecrootc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootc_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootc_storage_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootc_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadcrootc_xfer_to_litter_patch (:) = nan - allocate(this%hrv_gresp_storage_to_litter_patch (begp:endp)) ; this%hrv_gresp_storage_to_litter_patch (:) = nan - allocate(this%hrv_gresp_xfer_to_litter_patch (begp:endp)) ; this%hrv_gresp_xfer_to_litter_patch (:) = nan - allocate(this%hrv_xsmrpool_to_atm_patch (begp:endp)) ; this%hrv_xsmrpool_to_atm_patch (:) = nan - allocate(this%m_leafc_to_fire_patch (begp:endp)) ; this%m_leafc_to_fire_patch (:) = nan - allocate(this%m_leafc_storage_to_fire_patch (begp:endp)) ; this%m_leafc_storage_to_fire_patch (:) = nan - allocate(this%m_leafc_xfer_to_fire_patch (begp:endp)) ; this%m_leafc_xfer_to_fire_patch (:) = nan - allocate(this%m_livestemc_to_fire_patch (begp:endp)) ; this%m_livestemc_to_fire_patch (:) = nan - allocate(this%m_livestemc_storage_to_fire_patch (begp:endp)) ; this%m_livestemc_storage_to_fire_patch (:) = nan - allocate(this%m_livestemc_xfer_to_fire_patch (begp:endp)) ; this%m_livestemc_xfer_to_fire_patch (:) = nan - allocate(this%m_deadstemc_to_fire_patch (begp:endp)) ; this%m_deadstemc_to_fire_patch (:) = nan - allocate(this%m_deadstemc_storage_to_fire_patch (begp:endp)) ; this%m_deadstemc_storage_to_fire_patch (:) = nan - allocate(this%m_deadstemc_xfer_to_fire_patch (begp:endp)) ; this%m_deadstemc_xfer_to_fire_patch (:) = nan - allocate(this%m_frootc_to_fire_patch (begp:endp)) ; this%m_frootc_to_fire_patch (:) = nan - allocate(this%m_frootc_storage_to_fire_patch (begp:endp)) ; this%m_frootc_storage_to_fire_patch (:) = nan - allocate(this%m_frootc_xfer_to_fire_patch (begp:endp)) ; this%m_frootc_xfer_to_fire_patch (:) = nan - allocate(this%m_livecrootc_to_fire_patch (begp:endp)) ; this%m_livecrootc_to_fire_patch (:) = nan - allocate(this%m_livecrootc_storage_to_fire_patch (begp:endp)) ; this%m_livecrootc_storage_to_fire_patch (:) = nan - allocate(this%m_livecrootc_xfer_to_fire_patch (begp:endp)) ; this%m_livecrootc_xfer_to_fire_patch (:) = nan - allocate(this%m_deadcrootc_to_fire_patch (begp:endp)) ; this%m_deadcrootc_to_fire_patch (:) = nan - allocate(this%m_deadcrootc_storage_to_fire_patch (begp:endp)) ; this%m_deadcrootc_storage_to_fire_patch (:) = nan - allocate(this%m_deadcrootc_xfer_to_fire_patch (begp:endp)) ; this%m_deadcrootc_xfer_to_fire_patch (:) = nan - allocate(this%m_gresp_storage_to_fire_patch (begp:endp)) ; this%m_gresp_storage_to_fire_patch (:) = nan - allocate(this%m_gresp_xfer_to_fire_patch (begp:endp)) ; this%m_gresp_xfer_to_fire_patch (:) = nan - allocate(this%m_leafc_to_litter_fire_patch (begp:endp)) ; this%m_leafc_to_litter_fire_patch (:) = nan - allocate(this%m_leafc_storage_to_litter_fire_patch (begp:endp)) ; this%m_leafc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_leafc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_leafc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_to_litter_fire_patch (begp:endp)) ; this%m_livestemc_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_storage_to_litter_fire_patch (begp:endp)) ; this%m_livestemc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livestemc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemc_to_deadstemc_fire_patch (begp:endp)) ; this%m_livestemc_to_deadstemc_fire_patch (:) = nan - allocate(this%m_deadstemc_to_litter_fire_patch (begp:endp)) ; this%m_deadstemc_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemc_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadstemc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadstemc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_frootc_to_litter_fire_patch (begp:endp)) ; this%m_frootc_to_litter_fire_patch (:) = nan - allocate(this%m_frootc_storage_to_litter_fire_patch (begp:endp)) ; this%m_frootc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_frootc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_frootc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_to_litter_fire_patch (begp:endp)) ; this%m_livecrootc_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_storage_to_litter_fire_patch (begp:endp)) ; this%m_livecrootc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livecrootc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootc_to_deadcrootc_fire_patch (begp:endp)) ; this%m_livecrootc_to_deadcrootc_fire_patch (:) = nan - allocate(this%m_deadcrootc_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootc_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootc_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootc_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootc_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootc_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_gresp_storage_to_litter_fire_patch (begp:endp)) ; this%m_gresp_storage_to_litter_fire_patch (:) = nan - allocate(this%m_gresp_xfer_to_litter_fire_patch (begp:endp)) ; this%m_gresp_xfer_to_litter_fire_patch (:) = nan - allocate(this%leafc_xfer_to_leafc_patch (begp:endp)) ; this%leafc_xfer_to_leafc_patch (:) = nan - allocate(this%frootc_xfer_to_frootc_patch (begp:endp)) ; this%frootc_xfer_to_frootc_patch (:) = nan - allocate(this%livestemc_xfer_to_livestemc_patch (begp:endp)) ; this%livestemc_xfer_to_livestemc_patch (:) = nan - allocate(this%deadstemc_xfer_to_deadstemc_patch (begp:endp)) ; this%deadstemc_xfer_to_deadstemc_patch (:) = nan - allocate(this%livecrootc_xfer_to_livecrootc_patch (begp:endp)) ; this%livecrootc_xfer_to_livecrootc_patch (:) = nan - allocate(this%deadcrootc_xfer_to_deadcrootc_patch (begp:endp)) ; this%deadcrootc_xfer_to_deadcrootc_patch (:) = nan - allocate(this%leafc_to_litter_patch (begp:endp)) ; this%leafc_to_litter_patch (:) = nan - allocate(this%leafc_to_litter_fun_patch (begp:endp)) ; this%leafc_to_litter_fun_patch (:) = nan - allocate(this%frootc_to_litter_patch (begp:endp)) ; this%frootc_to_litter_patch (:) = nan - allocate(this%cpool_to_resp_patch (begp:endp)) ; this%cpool_to_resp_patch (:) = nan - allocate(this%cpool_to_leafc_resp_patch (begp:endp)) ; this%cpool_to_leafc_resp_patch (:) = nan - allocate(this%cpool_to_leafc_storage_resp_patch (begp:endp)) ; this%cpool_to_leafc_storage_resp_patch (:) = nan - allocate(this%cpool_to_frootc_resp_patch (begp:endp)) ; this%cpool_to_frootc_resp_patch (:) = nan - allocate(this%cpool_to_frootc_storage_resp_patch (begp:endp)) ; this%cpool_to_frootc_storage_resp_patch (:) = nan - allocate(this%cpool_to_livecrootc_resp_patch (begp:endp)) ; this%cpool_to_livecrootc_resp_patch (:) = nan - allocate(this%cpool_to_livecrootc_storage_resp_patch (begp:endp)) ; this%cpool_to_livecrootc_storage_resp_patch (:) = nan - allocate(this%cpool_to_livestemc_resp_patch (begp:endp)) ; this%cpool_to_livestemc_resp_patch (:) = nan - allocate(this%cpool_to_livestemc_storage_resp_patch (begp:endp)) ; this%cpool_to_livestemc_storage_resp_patch (:) = nan - allocate(this%leaf_mr_patch (begp:endp)) ; this%leaf_mr_patch (:) = nan - allocate(this%froot_mr_patch (begp:endp)) ; this%froot_mr_patch (:) = nan - allocate(this%livestem_mr_patch (begp:endp)) ; this%livestem_mr_patch (:) = nan - allocate(this%livecroot_mr_patch (begp:endp)) ; this%livecroot_mr_patch (:) = nan - allocate(this%grain_mr_patch (begp:endp)) ; this%grain_mr_patch (:) = nan - allocate(this%leaf_curmr_patch (begp:endp)) ; this%leaf_curmr_patch (:) = nan - allocate(this%froot_curmr_patch (begp:endp)) ; this%froot_curmr_patch (:) = nan - allocate(this%livestem_curmr_patch (begp:endp)) ; this%livestem_curmr_patch (:) = nan - allocate(this%livecroot_curmr_patch (begp:endp)) ; this%livecroot_curmr_patch (:) = nan - allocate(this%grain_curmr_patch (begp:endp)) ; this%grain_curmr_patch (:) = nan - allocate(this%leaf_xsmr_patch (begp:endp)) ; this%leaf_xsmr_patch (:) = nan - allocate(this%froot_xsmr_patch (begp:endp)) ; this%froot_xsmr_patch (:) = nan - allocate(this%livestem_xsmr_patch (begp:endp)) ; this%livestem_xsmr_patch (:) = nan - allocate(this%livecroot_xsmr_patch (begp:endp)) ; this%livecroot_xsmr_patch (:) = nan - allocate(this%grain_xsmr_patch (begp:endp)) ; this%grain_xsmr_patch (:) = nan - allocate(this%psnsun_to_cpool_patch (begp:endp)) ; this%psnsun_to_cpool_patch (:) = nan - allocate(this%psnshade_to_cpool_patch (begp:endp)) ; this%psnshade_to_cpool_patch (:) = nan - allocate(this%cpool_to_xsmrpool_patch (begp:endp)) ; this%cpool_to_xsmrpool_patch (:) = nan - allocate(this%cpool_to_leafc_patch (begp:endp)) ; this%cpool_to_leafc_patch (:) = nan - allocate(this%cpool_to_leafc_storage_patch (begp:endp)) ; this%cpool_to_leafc_storage_patch (:) = nan - allocate(this%cpool_to_frootc_patch (begp:endp)) ; this%cpool_to_frootc_patch (:) = nan - allocate(this%cpool_to_frootc_storage_patch (begp:endp)) ; this%cpool_to_frootc_storage_patch (:) = nan - allocate(this%cpool_to_livestemc_patch (begp:endp)) ; this%cpool_to_livestemc_patch (:) = nan - allocate(this%cpool_to_livestemc_storage_patch (begp:endp)) ; this%cpool_to_livestemc_storage_patch (:) = nan - allocate(this%cpool_to_deadstemc_patch (begp:endp)) ; this%cpool_to_deadstemc_patch (:) = nan - allocate(this%cpool_to_deadstemc_storage_patch (begp:endp)) ; this%cpool_to_deadstemc_storage_patch (:) = nan - allocate(this%cpool_to_livecrootc_patch (begp:endp)) ; this%cpool_to_livecrootc_patch (:) = nan - allocate(this%cpool_to_livecrootc_storage_patch (begp:endp)) ; this%cpool_to_livecrootc_storage_patch (:) = nan - allocate(this%cpool_to_deadcrootc_patch (begp:endp)) ; this%cpool_to_deadcrootc_patch (:) = nan - allocate(this%cpool_to_deadcrootc_storage_patch (begp:endp)) ; this%cpool_to_deadcrootc_storage_patch (:) = nan - allocate(this%cpool_to_gresp_storage_patch (begp:endp)) ; this%cpool_to_gresp_storage_patch (:) = nan - allocate(this%cpool_leaf_gr_patch (begp:endp)) ; this%cpool_leaf_gr_patch (:) = nan - allocate(this%cpool_leaf_storage_gr_patch (begp:endp)) ; this%cpool_leaf_storage_gr_patch (:) = nan - allocate(this%transfer_leaf_gr_patch (begp:endp)) ; this%transfer_leaf_gr_patch (:) = nan - allocate(this%cpool_froot_gr_patch (begp:endp)) ; this%cpool_froot_gr_patch (:) = nan - allocate(this%cpool_froot_storage_gr_patch (begp:endp)) ; this%cpool_froot_storage_gr_patch (:) = nan - allocate(this%transfer_froot_gr_patch (begp:endp)) ; this%transfer_froot_gr_patch (:) = nan - allocate(this%cpool_livestem_gr_patch (begp:endp)) ; this%cpool_livestem_gr_patch (:) = nan - allocate(this%cpool_livestem_storage_gr_patch (begp:endp)) ; this%cpool_livestem_storage_gr_patch (:) = nan - allocate(this%transfer_livestem_gr_patch (begp:endp)) ; this%transfer_livestem_gr_patch (:) = nan - allocate(this%cpool_deadstem_gr_patch (begp:endp)) ; this%cpool_deadstem_gr_patch (:) = nan - allocate(this%cpool_deadstem_storage_gr_patch (begp:endp)) ; this%cpool_deadstem_storage_gr_patch (:) = nan - allocate(this%transfer_deadstem_gr_patch (begp:endp)) ; this%transfer_deadstem_gr_patch (:) = nan - allocate(this%cpool_livecroot_gr_patch (begp:endp)) ; this%cpool_livecroot_gr_patch (:) = nan - allocate(this%cpool_livecroot_storage_gr_patch (begp:endp)) ; this%cpool_livecroot_storage_gr_patch (:) = nan - allocate(this%transfer_livecroot_gr_patch (begp:endp)) ; this%transfer_livecroot_gr_patch (:) = nan - allocate(this%cpool_deadcroot_gr_patch (begp:endp)) ; this%cpool_deadcroot_gr_patch (:) = nan - allocate(this%cpool_deadcroot_storage_gr_patch (begp:endp)) ; this%cpool_deadcroot_storage_gr_patch (:) = nan - allocate(this%transfer_deadcroot_gr_patch (begp:endp)) ; this%transfer_deadcroot_gr_patch (:) = nan - allocate(this%leafc_storage_to_xfer_patch (begp:endp)) ; this%leafc_storage_to_xfer_patch (:) = nan - allocate(this%frootc_storage_to_xfer_patch (begp:endp)) ; this%frootc_storage_to_xfer_patch (:) = nan - allocate(this%livestemc_storage_to_xfer_patch (begp:endp)) ; this%livestemc_storage_to_xfer_patch (:) = nan - allocate(this%deadstemc_storage_to_xfer_patch (begp:endp)) ; this%deadstemc_storage_to_xfer_patch (:) = nan - allocate(this%livecrootc_storage_to_xfer_patch (begp:endp)) ; this%livecrootc_storage_to_xfer_patch (:) = nan - allocate(this%deadcrootc_storage_to_xfer_patch (begp:endp)) ; this%deadcrootc_storage_to_xfer_patch (:) = nan - allocate(this%gresp_storage_to_xfer_patch (begp:endp)) ; this%gresp_storage_to_xfer_patch (:) = nan - allocate(this%livestemc_to_deadstemc_patch (begp:endp)) ; this%livestemc_to_deadstemc_patch (:) = nan - allocate(this%livecrootc_to_deadcrootc_patch (begp:endp)) ; this%livecrootc_to_deadcrootc_patch (:) = nan - allocate(this%current_gr_patch (begp:endp)) ; this%current_gr_patch (:) = nan - allocate(this%transfer_gr_patch (begp:endp)) ; this%transfer_gr_patch (:) = nan - allocate(this%storage_gr_patch (begp:endp)) ; this%storage_gr_patch (:) = nan - allocate(this%plant_calloc_patch (begp:endp)) ; this%plant_calloc_patch (:) = nan - allocate(this%excess_cflux_patch (begp:endp)) ; this%excess_cflux_patch (:) = nan - allocate(this%prev_leafc_to_litter_patch (begp:endp)) ; this%prev_leafc_to_litter_patch (:) = nan - allocate(this%prev_frootc_to_litter_patch (begp:endp)) ; this%prev_frootc_to_litter_patch (:) = nan - allocate(this%gpp_before_downreg_patch (begp:endp)) ; this%gpp_before_downreg_patch (:) = nan - allocate(this%availc_patch (begp:endp)) ; this%availc_patch (:) = nan - allocate(this%xsmrpool_recover_patch (begp:endp)) ; this%xsmrpool_recover_patch (:) = nan - allocate(this%xsmrpool_c13ratio_patch (begp:endp)) ; this%xsmrpool_c13ratio_patch (:) = nan - - allocate(this%cpool_to_grainc_patch (begp:endp)) ; this%cpool_to_grainc_patch (:) = nan - allocate(this%cpool_to_grainc_storage_patch (begp:endp)) ; this%cpool_to_grainc_storage_patch (:) = nan - allocate(this%livestemc_to_litter_patch (begp:endp)) ; this%livestemc_to_litter_patch (:) = nan - allocate(this%grainc_to_food_patch (begp:endp)) ; this%grainc_to_food_patch (:) = nan - allocate(this%grainc_to_seed_patch (begp:endp)) ; this%grainc_to_seed_patch (:) = nan - allocate(this%grainc_xfer_to_grainc_patch (begp:endp)) ; this%grainc_xfer_to_grainc_patch (:) = nan - allocate(this%cpool_grain_gr_patch (begp:endp)) ; this%cpool_grain_gr_patch (:) = nan - allocate(this%cpool_grain_storage_gr_patch (begp:endp)) ; this%cpool_grain_storage_gr_patch (:) = nan - allocate(this%transfer_grain_gr_patch (begp:endp)) ; this%transfer_grain_gr_patch (:) = nan - allocate(this%xsmrpool_to_atm_patch (begp:endp)) ; this%xsmrpool_to_atm_patch (:) = nan - allocate(this%grainc_storage_to_xfer_patch (begp:endp)) ; this%grainc_storage_to_xfer_patch (:) = nan - allocate(this%frootc_alloc_patch (begp:endp)) ; this%frootc_alloc_patch (:) = nan - allocate(this%frootc_loss_patch (begp:endp)) ; this%frootc_loss_patch (:) = nan - allocate(this%leafc_alloc_patch (begp:endp)) ; this%leafc_alloc_patch (:) = nan - allocate(this%leafc_loss_patch (begp:endp)) ; this%leafc_loss_patch (:) = nan - allocate(this%woodc_alloc_patch (begp:endp)) ; this%woodc_alloc_patch (:) = nan - allocate(this%woodc_loss_patch (begp:endp)) ; this%woodc_loss_patch (:) = nan - - allocate(this%phenology_c_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); - this%phenology_c_to_litr_met_c_col (:,:)=nan - - allocate(this%phenology_c_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%phenology_c_to_litr_cel_c_col (:,:)=nan - allocate(this%phenology_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%phenology_c_to_litr_lig_c_col (:,:)=nan - - allocate(this%gap_mortality_c_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_litr_met_c_col(:,:)=nan - allocate(this%gap_mortality_c_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_litr_cel_c_col(:,:)=nan - allocate(this%gap_mortality_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_litr_lig_c_col(:,:)=nan - - allocate(this%gap_mortality_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%gap_mortality_c_to_cwdc_col (:,:)=nan - allocate(this%fire_mortality_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%fire_mortality_c_to_cwdc_col (:,:)=nan - allocate(this%m_c_to_litr_met_fire_col (begc:endc,1:nlevdecomp_full)); this%m_c_to_litr_met_fire_col (:,:)=nan - allocate(this%m_c_to_litr_cel_fire_col (begc:endc,1:nlevdecomp_full)); this%m_c_to_litr_cel_fire_col (:,:)=nan - allocate(this%m_c_to_litr_lig_fire_col (begc:endc,1:nlevdecomp_full)); this%m_c_to_litr_lig_fire_col (:,:)=nan - allocate(this%harvest_c_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_met_c_col (:,:)=nan - allocate(this%harvest_c_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_cel_c_col (:,:)=nan - allocate(this%harvest_c_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_litr_lig_c_col (:,:)=nan - allocate(this%harvest_c_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%harvest_c_to_cwdc_col (:,:)=nan - - allocate(this%dwt_slash_cflux_col (begc:endc)) ; this%dwt_slash_cflux_col (:) =nan - allocate(this%dwt_frootc_to_litr_met_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_met_c_col (:,:)=nan - allocate(this%dwt_frootc_to_litr_cel_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_cel_c_col (:,:)=nan - allocate(this%dwt_frootc_to_litr_lig_c_col (begc:endc,1:nlevdecomp_full)); this%dwt_frootc_to_litr_lig_c_col (:,:)=nan - allocate(this%dwt_livecrootc_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%dwt_livecrootc_to_cwdc_col (:,:)=nan - allocate(this%dwt_deadcrootc_to_cwdc_col (begc:endc,1:nlevdecomp_full)); this%dwt_deadcrootc_to_cwdc_col (:,:)=nan - - allocate(this%dwt_seedc_to_leaf_patch (begp:endp)) ; this%dwt_seedc_to_leaf_patch (:) =nan - allocate(this%dwt_seedc_to_leaf_grc (begg:endg)) ; this%dwt_seedc_to_leaf_grc (:) =nan - allocate(this%dwt_seedc_to_deadstem_patch (begp:endp)) ; this%dwt_seedc_to_deadstem_patch(:) =nan - allocate(this%dwt_seedc_to_deadstem_grc (begg:endg)) ; this%dwt_seedc_to_deadstem_grc (:) =nan - allocate(this%dwt_conv_cflux_patch (begp:endp)) ; this%dwt_conv_cflux_patch (:) =nan - allocate(this%dwt_conv_cflux_grc (begg:endg)) ; this%dwt_conv_cflux_grc (:) =nan - allocate(this%dwt_conv_cflux_dribbled_grc (begg:endg)) ; this%dwt_conv_cflux_dribbled_grc(:) =nan - allocate(this%dwt_wood_productc_gain_patch (begp:endp)) ; this%dwt_wood_productc_gain_patch(:) =nan - allocate(this%dwt_crop_productc_gain_patch (begp:endp)) ; this%dwt_crop_productc_gain_patch(:) =nan - - allocate(this%crop_seedc_to_leaf_patch (begp:endp)) ; this%crop_seedc_to_leaf_patch (:) =nan - - allocate(this%cwdc_hr_col (begc:endc)) ; this%cwdc_hr_col (:) =nan - allocate(this%cwdc_loss_col (begc:endc)) ; this%cwdc_loss_col (:) =nan - allocate(this%litterc_loss_col (begc:endc)) ; this%litterc_loss_col (:) =nan - - allocate(this%grainc_to_cropprodc_patch(begp:endp)) - this%grainc_to_cropprodc_patch(:) = nan - - allocate(this%grainc_to_cropprodc_col(begc:endc)) - this%grainc_to_cropprodc_col(:) = nan - - allocate(this%m_decomp_cpools_to_fire_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_vr_col(:,:,:)= nan - - allocate(this%m_decomp_cpools_to_fire_col(begc:endc,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_col(:,:)= nan - - allocate(this%m_decomp_cpools_to_fire_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_vr_col(:,:,:)= nan - - allocate(this%m_decomp_cpools_to_fire_col(begc:endc,1:ndecomp_pools)) - this%m_decomp_cpools_to_fire_col(:,:)= nan - - allocate(this%rr_patch (begp:endp)) ; this%rr_patch (:) = nan - allocate(this%mr_patch (begp:endp)) ; this%mr_patch (:) = nan - allocate(this%gr_patch (begp:endp)) ; this%gr_patch (:) = nan - allocate(this%ar_patch (begp:endp)) ; this%ar_patch (:) = nan - allocate(this%npp_patch (begp:endp)) ; this%npp_patch (:) = nan - allocate(this%agnpp_patch (begp:endp)) ; this%agnpp_patch (:) = nan - allocate(this%bgnpp_patch (begp:endp)) ; this%bgnpp_patch (:) = nan - allocate(this%litfall_patch (begp:endp)) ; this%litfall_patch (:) = nan - allocate(this%wood_harvestc_patch (begp:endp)) ; this%wood_harvestc_patch (:) = nan - allocate(this%slash_harvestc_patch (begp:endp)) ; this%slash_harvestc_patch (:) = nan - allocate(this%cinputs_patch (begp:endp)) ; this%cinputs_patch (:) = nan - allocate(this%coutputs_patch (begp:endp)) ; this%coutputs_patch (:) = nan - allocate(this%gpp_patch (begp:endp)) ; this%gpp_patch (:) = nan - allocate(this%fire_closs_patch (begp:endp)) ; this%fire_closs_patch (:) = nan - allocate(this%sr_col (begc:endc)) ; this%sr_col (:) = nan - allocate(this%er_col (begc:endc)) ; this%er_col (:) = nan - allocate(this%litfire_col (begc:endc)) ; this%litfire_col (:) = nan - allocate(this%somfire_col (begc:endc)) ; this%somfire_col (:) = nan - allocate(this%totfire_col (begc:endc)) ; this%totfire_col (:) = nan - allocate(this%rr_col (begc:endc)) ; this%rr_col (:) = nan - allocate(this%ar_col (begc:endc)) ; this%ar_col (:) = nan - allocate(this%gpp_col (begc:endc)) ; this%gpp_col (:) = nan - allocate(this%npp_col (begc:endc)) ; this%npp_col (:) = nan - allocate(this%fire_closs_p2c_col (begc:endc)) ; this%fire_closs_p2c_col (:) = nan - allocate(this%fire_closs_col (begc:endc)) ; this%fire_closs_col (:) = nan - allocate(this%wood_harvestc_col (begc:endc)) ; this%wood_harvestc_col (:) = nan - allocate(this%hrv_xsmrpool_to_atm_col (begc:endc)) ; this%hrv_xsmrpool_to_atm_col (:) = nan - allocate(this%tempsum_npp_patch (begp:endp)) ; this%tempsum_npp_patch (:) = nan - allocate(this%annsum_npp_patch (begp:endp)) ; this%annsum_npp_patch (:) = nan - allocate(this%tempsum_litfall_patch (begp:endp)) ; this%tempsum_litfall_patch (:) = nan - allocate(this%annsum_litfall_patch (begp:endp)) ; this%annsum_litfall_patch (:) = nan - allocate(this%annsum_npp_col (begc:endc)) ; this%annsum_npp_col (:) = nan - allocate(this%lag_npp_col (begc:endc)) ; this%lag_npp_col (:) = spval - - allocate(this%nep_col (begc:endc)) ; this%nep_col (:) = nan - allocate(this%nbp_grc (begg:endg)) ; this%nbp_grc (:) = nan - allocate(this%nee_grc (begg:endg)) ; this%nee_grc (:) = nan - allocate(this%landuseflux_grc (begg:endg)) ; this%landuseflux_grc (:) = nan - allocate(this%npp_Nactive_patch (begp:endp)) ; this%npp_Nactive_patch (:) = nan - allocate(this%npp_burnedoff_patch (begp:endp)) ; this%npp_burnedoff_patch (:) = nan - allocate(this%npp_Nnonmyc_patch (begp:endp)) ; this%npp_Nnonmyc_patch (:) = nan - allocate(this%npp_Nam_patch (begp:endp)) ; this%npp_Nam_patch (:) = nan - allocate(this%npp_Necm_patch (begp:endp)) ; this%npp_Necm_patch (:) = nan - allocate(this%npp_Nactive_no3_patch (begp:endp)) ; this%npp_Nactive_no3_patch (:) = nan - allocate(this%npp_Nactive_nh4_patch (begp:endp)) ; this%npp_Nactive_nh4_patch (:) = nan - allocate(this%npp_Nnonmyc_no3_patch (begp:endp)) ; this%npp_Nnonmyc_no3_patch (:) = nan - allocate(this%npp_Nnonmyc_nh4_patch (begp:endp)) ; this%npp_Nnonmyc_nh4_patch (:) = nan - allocate(this%npp_Nam_no3_patch (begp:endp)) ; this%npp_Nam_no3_patch (:) = nan - allocate(this%npp_Nam_nh4_patch (begp:endp)) ; this%npp_Nam_nh4_patch (:) = nan - allocate(this%npp_Necm_no3_patch (begp:endp)) ; this%npp_Necm_no3_patch (:) = nan - allocate(this%npp_Necm_nh4_patch (begp:endp)) ; this%npp_Necm_nh4_patch (:) = nan - allocate(this%npp_Nfix_patch (begp:endp)) ; this%npp_Nfix_patch (:) = nan - allocate(this%npp_Nretrans_patch (begp:endp)) ; this%npp_Nretrans_patch (:) = nan - allocate(this%npp_Nuptake_patch (begp:endp)) ; this%npp_Nuptake_patch (:) = nan - allocate(this%npp_growth_patch (begp:endp)) ; this%npp_growth_patch (:) = nan - allocate(this%leafc_change_patch (begp:endp)) ; this%leafc_change_patch (:) = nan - allocate(this%soilc_change_patch (begp:endp)) ; this%soilc_change_patch (:) = nan - - ! Construct restart field names consistently to what is done in SpeciesNonIsotope & - ! SpeciesIsotope, to aid future migration to that infrastructure - if (carbon_type == 'c12') then - carbon_type_suffix = 'c' - else if (carbon_type == 'c13') then - carbon_type_suffix = 'c_13' - else if (carbon_type == 'c14') then - carbon_type_suffix = 'c_14' - else - write(iulog,*) 'CNVegCarbonFluxType InitAllocate: Unknown carbon_type: ', trim(carbon_type) - call endrun(msg='CNVegCarbonFluxType InitAllocate: Unknown carbon_type: ' // & - errMsg(sourcefile, __LINE__)) - end if - - ! Note that, for both of these dribblers, we set allows_non_annual_delta to false - ! because we expect both land cover change and harvest to be applied entirely at the - ! start of the year, and want to be notified if this changes. If this behavior is - ! changed intentionally, then this setting of allows_non_annual_delta to .false. can - ! safely be removed. - ! - ! However, we do keep allows_non_annual_delta = .true. for the dwt_conv_cflux_dribbler if - ! running with CNDV, because (in contrast with other land cover change) CNDV currently - ! still interpolates land cover change throughout the year. - if (get_for_testing_allow_non_annual_changes()) then - allows_non_annual_delta = .true. - else if (use_cndv) then - allows_non_annual_delta = .true. - else - allows_non_annual_delta = .false. - end if - this%dwt_conv_cflux_dribbler = annual_flux_dribbler_gridcell( & - bounds = bounds, & - name = 'dwt_conv_flux_' // carbon_type_suffix, & - units = 'gC/m^2', & - allows_non_annual_delta = allows_non_annual_delta) - this%hrv_xsmrpool_to_atm_dribbler = annual_flux_dribbler_gridcell( & - bounds = bounds, & - name = 'hrv_xsmrpool_to_atm_' // carbon_type_suffix, & - units = 'gC/m^2', & - allows_non_annual_delta = .false.) - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varpar , only : nlevdecomp, nlevdecomp_full, nlevgrnd - use clm_varctl , only : hist_wrtch4diag - use CNSharedParamsMod, only: use_fun - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - character(8) :: vr_suffix - character(10) :: active - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - !------------------------------- - ! C flux variables - patch - !------------------------------- - - if (carbon_type == 'c12') then - - if (use_crop) then - this%grainc_to_food_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINC_TO_FOOD', units='gC/m^2/s', & - avgflag='A', long_name='grain C to food', & - ptr_patch=this%grainc_to_food_patch) - - this%grainc_to_seed_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINC_TO_SEED', units='gC/m^2/s', & - avgflag='A', long_name='grain C to seed', & - ptr_patch=this%grainc_to_seed_patch) - end if - - this%litterc_loss_col(begc:endc) = spval - call hist_addfld1d (fname='LITTERC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='litter C loss', & - ptr_col=this%litterc_loss_col) - - this%woodc_alloc_patch(begp:endp) = spval - call hist_addfld1d (fname='WOODC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='wood C eallocation', & - ptr_patch=this%woodc_alloc_patch) - - this%woodc_loss_patch(begp:endp) = spval - call hist_addfld1d (fname='WOODC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='wood C loss', & - ptr_patch=this%woodc_loss_patch) - - this%leafc_loss_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='leaf C loss', & - ptr_patch=this%leafc_loss_patch) - - this%leafc_alloc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='leaf C allocation', & - ptr_patch=this%leafc_alloc_patch) - - this%frootc_loss_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='fine root C loss', & - ptr_patch=this%frootc_loss_patch) - - this%frootc_alloc_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='fine root C allocation', & - ptr_patch=this%frootc_alloc_patch) - - this%m_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C mortality', & - ptr_patch=this%m_leafc_to_litter_patch, default='inactive') - - this%m_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C mortality', & - ptr_patch=this%m_frootc_to_litter_patch, default='inactive') - - this%m_leafc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage mortality', & - ptr_patch=this%m_leafc_storage_to_litter_patch, default='inactive') - - this%m_frootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage mortality', & - ptr_patch=this%m_frootc_storage_to_litter_patch, default='inactive') - - this%m_livestemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C storage mortality', & - ptr_patch=this%m_livecrootc_storage_to_litter_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage mortality', & - ptr_patch=this%m_deadcrootc_storage_to_litter_patch, default='inactive') - - this%m_leafc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer mortality', & - ptr_patch=this%m_leafc_xfer_to_litter_patch, default='inactive') - - this%m_frootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer mortality', & - ptr_patch=this%m_frootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer mortality', & - ptr_patch=this%m_deadstemc_xfer_to_litter_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C transfer mortality', & - ptr_patch=this%m_livecrootc_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C transfer mortality', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') - - this%m_deadstemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C mortality', & - ptr_patch=this%m_deadstemc_to_litter_patch, default='inactive') - - this%m_livecrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C mortality', & - ptr_patch=this%m_livecrootc_to_litter_patch, default='inactive') - - this%m_deadcrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C mortality', & - ptr_patch=this%m_deadcrootc_to_litter_patch, default='inactive') - - this%m_gresp_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage mortality', & - ptr_patch=this%m_gresp_storage_to_litter_patch, default='inactive') - - this%m_gresp_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer mortality', & - ptr_patch=this%m_gresp_xfer_to_litter_patch, default='inactive') - - this%m_leafc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire loss', & - ptr_patch=this%m_leafc_to_fire_patch, default='inactive') - - this%m_leafc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage fire loss', & - ptr_patch=this%m_leafc_storage_to_fire_patch, default='inactive') - - this%m_leafc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer fire loss', & - ptr_patch=this%m_leafc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') - - this%m_livestemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') - - this%m_deadstemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C fire loss', & - ptr_patch=this%m_deadstemc_to_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage fire loss', & - ptr_patch=this%m_deadstemc_storage_to_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer fire loss', & - ptr_patch=this%m_deadstemc_xfer_to_fire_patch, default='inactive') - - this%m_frootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C fire loss', & - ptr_patch=this%m_frootc_to_fire_patch, default='inactive') - - this%m_frootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage fire loss', & - ptr_patch=this%m_frootc_storage_to_fire_patch, default='inactive') - - this%m_frootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer fire loss', & - ptr_patch=this%m_frootc_xfer_to_fire_patch, default='inactive') - - this%m_livecrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C fire loss', & - ptr_patch=this%m_livecrootc_to_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C storage fire loss', & - ptr_patch=this%m_livecrootc_storage_to_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C transfer fire loss', & - ptr_patch=this%m_livecrootc_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C fire loss', & - ptr_patch=this%m_deadcrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C storage fire loss', & - ptr_patch=this%m_deadcrootc_storage_to_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C transfer fire loss', & - ptr_patch=this%m_deadcrootc_xfer_to_fire_patch, default='inactive') - - this%m_gresp_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage fire loss', & - ptr_patch=this%m_gresp_storage_to_fire_patch, default='inactive') - - this%m_gresp_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer fire loss', & - ptr_patch=this%m_gresp_xfer_to_fire_patch, default='inactive') - - this%m_leafc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire mortality to litter', & - ptr_patch=this%m_leafc_to_litter_fire_patch, default='inactive') - - ! add by F. Li and S. Levis - this%m_leafc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire mortality to litter', & - ptr_patch=this%m_leafc_storage_to_litter_fire_patch, default='inactive') - - this%m_leafc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer fire mortality to litter', & - ptr_patch=this%m_leafc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livestemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire mortality to litter', & - ptr_patch=this%m_livestemc_to_litter_fire_patch, default='inactive') - - this%m_livestemc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage fire mortality to litter', & - ptr_patch=this%m_livestemc_storage_to_litter_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer fire mortality to litter', & - ptr_patch=this%m_livestemc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livestemc_to_deadstemc_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMC_TO_DEADSTEMC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire mortality to dead stem C', & - ptr_patch=this%m_livestemc_to_deadstemc_fire_patch, default='inactive') - - this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C fire mortality to litter', & - ptr_patch=this%m_deadstemc_to_litter_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage fire mortality to litter', & - ptr_patch=this%m_deadstemc_storage_to_litter_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer fire mortality to litter', & - ptr_patch=this%m_deadstemc_xfer_to_litter_fire_patch, default='inactive') - - this%m_frootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C fire mortality to litter', & - ptr_patch=this%m_frootc_to_litter_fire_patch, default='inactive') - - this%m_frootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage fire mortality to litter', & - ptr_patch=this%m_frootc_storage_to_litter_fire_patch, default='inactive') - - this%m_frootc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer fire mortality to litter', & - ptr_patch=this%m_frootc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C fire mortality to litter', & - ptr_patch=this%m_livecrootc_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C storage fire mortality to litter', & - ptr_patch=this%m_livecrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C transfer fire mortality to litter', & - ptr_patch=this%m_livecrootc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_deadcrootc_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVEROOTC_TO_DEADROOTC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live root C fire mortality to dead root C', & - ptr_patch=this%m_livecrootc_to_deadcrootc_fire_patch, default='inactive') - - - this%m_deadcrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C fire mortality to litter', & - ptr_patch=this%m_deadcrootc_to_litter_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C storage fire mortality to litter', & - ptr_patch=this%m_deadcrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADROOTC_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead root C transfer fire mortality to litter', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C fire mortality to litter', & - ptr_patch=this%m_livecrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage fire mortality to litter', & - ptr_patch=this%m_deadcrootc_storage_to_litter_fire_patch, default='inactive') - - this%m_gresp_storage_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage fire mortality to litter', & - ptr_patch=this%m_gresp_storage_to_litter_fire_patch, default='inactive') - - this%m_gresp_xfer_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_GRESP_XFER_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer fire mortality to litter', & - ptr_patch=this%m_gresp_xfer_to_litter_fire_patch, default='inactive') - - this%leafc_xfer_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_XFER_TO_LEAFC', units='gC/m^2/s', & - avgflag='A', long_name='leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') - - this%frootc_xfer_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_XFER_TO_FROOTC', units='gC/m^2/s', & - avgflag='A', long_name='fine root C growth from storage', & - ptr_patch=this%frootc_xfer_to_frootc_patch, default='inactive') - - this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_XFER_TO_LIVESTEMC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') - - this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_XFER_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') - - this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_XFER_TO_LIVECROOTC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C growth from storage', & - ptr_patch=this%livecrootc_xfer_to_livecrootc_patch, default='inactive') - - this%deadcrootc_xfer_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_XFER_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C growth from storage', & - ptr_patch=this%deadcrootc_xfer_to_deadcrootc_patch, default='inactive') - - this%leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall', & - ptr_patch=this%leafc_to_litter_patch, default='inactive') - - if ( use_fun ) then - this%leafc_to_litter_fun_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_TO_LITTER_FUN', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall used by FUN', & - ptr_patch=this%leafc_to_litter_fun_patch) - end if - - this%frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C litterfall', & - ptr_patch=this%frootc_to_litter_patch, default='inactive') - - this%cpool_to_resp_patch(begp:endp) = spval - call hist_addfld1d (fname='EXCESSC_MR', units='gC/m^2/s', & - avgflag='A', long_name='excess C maintenance respiration', & - ptr_patch=this%cpool_to_resp_patch, default='inactive') - this%leaf_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAF_MR', units='gC/m^2/s', & - avgflag='A', long_name='leaf maintenance respiration', & - ptr_patch=this%leaf_mr_patch) - - this%froot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOT_MR', units='gC/m^2/s', & - avgflag='A', long_name='fine root maintenance respiration', & - ptr_patch=this%froot_mr_patch, default='inactive') - - this%livestem_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEM_MR', units='gC/m^2/s', & - avgflag='A', long_name='live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') - - this%livecroot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOT_MR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') - - this%psnsun_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSUN_TO_CPOOL', units='gC/m^2/s', & - avgflag='A', long_name='C fixation from sunlit canopy', & - ptr_patch=this%psnsun_to_cpool_patch) - - this%psnshade_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSHADE_TO_CPOOL', units='gC/m^2/s', & - avgflag='A', long_name='C fixation from shaded canopy', & - ptr_patch=this%psnshade_to_cpool_patch) - - this%cpool_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LEAFC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to leaf C', & - ptr_patch=this%cpool_to_leafc_patch, default='inactive') - - this%cpool_to_leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LEAFC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to leaf C storage', & - ptr_patch=this%cpool_to_leafc_storage_patch, default='inactive') - - this%cpool_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_FROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to fine root C', & - ptr_patch=this%cpool_to_frootc_patch, default='inactive') - - this%cpool_to_frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_FROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to fine root C storage', & - ptr_patch=this%cpool_to_frootc_storage_patch, default='inactive') - - this%cpool_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') - - this%cpool_to_livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') - - this%cpool_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') - - this%cpool_to_deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') - - this%cpool_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') - - this%cpool_to_livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') - - this%cpool_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') - - this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') - - this%cpool_to_gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_TO_GRESP_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to growth respiration storage', & - ptr_patch=this%cpool_to_gresp_storage_patch, default='inactive') - - this%cpool_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LEAF_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration', & - ptr_patch=this%cpool_leaf_gr_patch, default='inactive') - - this%cpool_leaf_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LEAF_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration to storage', & - ptr_patch=this%cpool_leaf_storage_gr_patch, default='inactive') - - this%transfer_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_LEAF_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration from storage', & - ptr_patch=this%transfer_leaf_gr_patch, default='inactive') - - this%cpool_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_FROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration', & - ptr_patch=this%cpool_froot_gr_patch, default='inactive') - - this%cpool_froot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_FROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration to storage', & - ptr_patch=this%cpool_froot_storage_gr_patch, default='inactive') - - this%transfer_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_FROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration from storage', & - ptr_patch=this%transfer_froot_gr_patch, default='inactive') - - this%cpool_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVESTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') - - this%cpool_livestem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVESTEM_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') - - this%transfer_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_LIVESTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') - - this%cpool_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADSTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') - - this%cpool_deadstem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADSTEM_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') - - this%transfer_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_DEADSTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') - - this%cpool_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVECROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') - - this%cpool_livecroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_LIVECROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') - - this%transfer_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_LIVECROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration from storage', & - ptr_patch=this%transfer_livecroot_gr_patch, default='inactive') - - this%cpool_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADCROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration', & - ptr_patch=this%cpool_deadcroot_gr_patch, default='inactive') - - this%cpool_deadcroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL_DEADCROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration to storage', & - ptr_patch=this%cpool_deadcroot_storage_gr_patch, default='inactive') - - this%transfer_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_DEADCROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration from storage', & - ptr_patch=this%transfer_deadcroot_gr_patch, default='inactive') - - this%leafc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C shift storage to transfer', & - ptr_patch=this%leafc_storage_to_xfer_patch, default='inactive') - - this%frootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C shift storage to transfer', & - ptr_patch=this%frootc_storage_to_xfer_patch, default='inactive') - - this%livestemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') - - this%deadstemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') - - this%livecrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C shift storage to transfer', & - ptr_patch=this%livecrootc_storage_to_xfer_patch, default='inactive') - - this%deadcrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C shift storage to transfer', & - ptr_patch=this%deadcrootc_storage_to_xfer_patch, default='inactive') - - this%gresp_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='GRESP_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration shift storage to transfer', & - ptr_patch=this%gresp_storage_to_xfer_patch, default='inactive') - - this%livestemc_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') - - this%livecrootc_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') - - this%gpp_before_downreg_patch(begp:endp) = spval - call hist_addfld1d (fname='INIT_GPP', units='gC/m^2/s', & - avgflag='A', long_name='GPP flux before downregulation', & - ptr_patch=this%gpp_before_downreg_patch, default='inactive') - - this%current_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='CURRENT_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for new growth displayed in this timestep', & - ptr_patch=this%current_gr_patch, default='inactive') - - this%transfer_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='TRANSFER_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for transfer growth displayed in this timestep', & - ptr_patch=this%transfer_gr_patch, default='inactive') - - this%storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for growth sent to storage for later display', & - ptr_patch=this%storage_gr_patch, default='inactive') - - this%availc_patch(begp:endp) = spval - call hist_addfld1d (fname='AVAILC', units='gC/m^2/s', & - avgflag='A', long_name='C flux available for allocation', & - ptr_patch=this%availc_patch, default='inactive') - - this%plant_calloc_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANT_CALLOC', units='gC/m^2/s', & - avgflag='A', long_name='total allocated C flux', & - ptr_patch=this%plant_calloc_patch, default='inactive') - - this%excess_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='EXCESS_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C flux not allocated due to downregulation', & - ptr_patch=this%excess_cflux_patch, default='inactive') - - this%prev_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='PREV_LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='previous timestep leaf C litterfall flux', & - ptr_patch=this%prev_leafc_to_litter_patch, default='inactive') - - this%prev_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='PREV_FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='previous timestep froot C litterfall flux', & - ptr_patch=this%prev_frootc_to_litter_patch, default='inactive') - - this%xsmrpool_recover_patch(begp:endp) = spval - call hist_addfld1d (fname='XSMRPOOL_RECOVER', units='gC/m^2/s', & - avgflag='A', long_name='C flux assigned to recovery of negative xsmrpool', & - ptr_patch=this%xsmrpool_recover_patch) - - this%gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='GPP', units='gC/m^2/s', & - avgflag='A', long_name='gross primary production', & - ptr_patch=this%gpp_patch) - - this%rr_patch(begp:endp) = spval - call hist_addfld1d (fname='RR', units='gC/m^2/s', & - avgflag='A', long_name='root respiration (fine root MR + total root GR)', & - ptr_patch=this%rr_patch) - - this%mr_patch(begp:endp) = spval - call hist_addfld1d (fname='MR', units='gC/m^2/s', & - avgflag='A', long_name='maintenance respiration', & - ptr_patch=this%mr_patch) - - this%gr_patch(begp:endp) = spval - call hist_addfld1d (fname='GR', units='gC/m^2/s', & - avgflag='A', long_name='total growth respiration', & - ptr_patch=this%gr_patch) - - this%ar_patch(begp:endp) = spval - call hist_addfld1d (fname='AR', units='gC/m^2/s', & - avgflag='A', long_name='autotrophic respiration (MR + GR)', & - ptr_patch=this%ar_patch) - - this%npp_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP', units='gC/m^2/s', & - avgflag='A', long_name='net primary production', & - ptr_patch=this%npp_patch) - - this%agnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='AGNPP', units='gC/m^2/s', & - avgflag='A', long_name='aboveground NPP', & - ptr_patch=this%agnpp_patch) - - this%bgnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='BGNPP', units='gC/m^2/s', & - avgflag='A', long_name='belowground NPP', & - ptr_patch=this%bgnpp_patch) - - this%litfall_patch(begp:endp) = spval - call hist_addfld1d (fname='LITFALL', units='gC/m^2/s', & - avgflag='A', long_name='litterfall (leaves and fine roots)', & - ptr_patch=this%litfall_patch) - - this%wood_harvestc_patch(begp:endp) = spval - call hist_addfld1d (fname='WOOD_HARVESTC', units='gC/m^2/s', & - avgflag='A', long_name='wood harvest carbon (to product pools)', & - ptr_patch=this%wood_harvestc_patch) - - this%slash_harvestc_patch(begp:endp) = spval - call hist_addfld1d (fname='SLASH_HARVESTC', units='gC/m^2/s', & - avgflag='A', long_name='slash harvest carbon (to litter)', & - ptr_patch=this%slash_harvestc_patch) - - this%fire_closs_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_FIRE_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total patch-level fire C loss for non-peat fires outside land-type converted region', & - ptr_patch=this%fire_closs_patch) - - if ( use_fun ) then - this%npp_Nactive_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NACTIVE', units='gC/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake used C', & - ptr_patch=this%npp_Nactive_patch) - - ! BUG(wjs, 2016-04-13, bugz 2292) This field has a threading bug. Making it - ! inactive for now. - this%npp_burnedoff_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_BURNEDOFF', units='gC/m^2/s', & - avgflag='A', long_name='C that cannot be used for N uptake', & - ptr_patch=this%npp_burnedoff_patch, default='inactive') - - this%npp_Nnonmyc_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NNONMYC', units='gC/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake used C', & - ptr_patch=this%npp_Nnonmyc_patch) - - this%npp_Nam_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NAM', units='gC/m^2/s', & - avgflag='A', long_name='AM-associated N uptake used C', & - ptr_patch=this%npp_Nam_patch) - - this%npp_Necm_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NECM', units='gC/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake used C', & - ptr_patch=this%npp_Necm_patch) - - if (use_nitrif_denitrif) then - this%npp_Nactive_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NACTIVE_NO3', units='gC/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake used C', & - ptr_patch=this%npp_Nactive_no3_patch) - - this%npp_Nactive_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NACTIVE_NH4', units='gC/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake use C', & - ptr_patch=this%npp_Nactive_nh4_patch) - - this%npp_Nnonmyc_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NNONMYC_NO3', units='gC/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake use C', & - ptr_patch=this%npp_Nnonmyc_no3_patch) - - this%npp_Nnonmyc_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NNONMYC_NH4', units='gC/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake use C', & - ptr_patch=this%npp_Nnonmyc_nh4_patch) - - this%npp_Nam_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NAM_NO3', units='gC/m^2/s', & - avgflag='A', long_name='AM-associated N uptake use C', & - ptr_patch=this%npp_Nam_no3_patch) - - this%npp_Nam_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NAM_NH4', units='gC/m^2/s', & - avgflag='A', long_name='AM-associated N uptake use C', & - ptr_patch=this%npp_Nam_nh4_patch) - - this%npp_Necm_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NECM_NO3', units='gC/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake used C', & - ptr_patch=this%npp_Necm_no3_patch) - - this%npp_Necm_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NECM_NH4', units='gC/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake use C', & - ptr_patch=this%npp_Necm_nh4_patch) - end if - - this%npp_Nfix_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NFIX', units='gC/m^2/s', & - avgflag='A', long_name='Symbiotic BNF uptake used C', & - ptr_patch=this%npp_Nfix_patch) - - this%npp_Nretrans_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NRETRANS', units='gC/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%npp_Nretrans_patch) - - this%npp_Nuptake_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_NUPTAKE', units='gC/m^2/s', & - avgflag='A', long_name='Total C used by N uptake in FUN', & - ptr_patch=this%npp_Nuptake_patch) - - this%npp_growth_patch(begp:endp) = spval - call hist_addfld1d (fname='NPP_GROWTH', units='gC/m^2/s', & - avgflag='A', long_name='Total C used for growth in FUN', & - ptr_patch=this%npp_growth_patch) - - this%leafc_change_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_CHANGE', units='gC/m^2/s', & - avgflag='A', long_name='C change in leaf', & - ptr_patch=this%leafc_change_patch) - - this%soilc_change_patch(begp:endp) = spval - call hist_addfld1d (fname='SOILC_CHANGE', units='gC/m^2/s', & - avgflag='A', long_name='C change in soil', & - ptr_patch=this%soilc_change_patch) - end if -! FUN Ends - - end if ! end of if-c12 - - !------------------------------- - ! C13 flux variables - patch - !------------------------------- - - if ( carbon_type == 'c13') then - - this%gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 gross primary production', & - ptr_patch=this%gpp_patch) - - this%rr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_RR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 root respiration (fine root MR + total root GR)', & - ptr_patch=this%rr_patch) - - this%mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 maintenance respiration', & - ptr_patch=this%mr_patch) - - this%gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total growth respiration', & - ptr_patch=this%gr_patch) - - this%ar_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_AR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 autotrophic respiration (MR + GR)', & - ptr_patch=this%ar_patch) - - this%npp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_NPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net primary production', & - ptr_patch=this%npp_patch) - - this%agnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_AGNPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 aboveground NPP', & - ptr_patch=this%agnpp_patch) - - this%bgnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_BGNPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 belowground NPP', & - ptr_patch=this%bgnpp_patch) - - this%litfall_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LITFALL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litterfall (leaves and fine roots)', & - ptr_patch=this%litfall_patch, default='inactive') - - this%fire_closs_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PFT_FIRE_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total patch-level fire C loss', & - ptr_patch=this%fire_closs_patch) - - this%m_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C mortality', & - ptr_patch=this%m_leafc_to_litter_patch, default='inactive') - - this%m_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C mortality', & - ptr_patch=this%m_frootc_to_litter_patch, default='inactive') - - this%m_leafc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage mortality', & - ptr_patch=this%m_leafc_storage_to_litter_patch, default='inactive') - - this%m_frootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage mortality', & - ptr_patch=this%m_frootc_storage_to_litter_patch, default='inactive') - - this%m_livestemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage mortality', & - ptr_patch=this%m_livecrootc_storage_to_litter_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage mortality', & - ptr_patch=this%m_deadcrootc_storage_to_litter_patch, default='inactive') - - this%m_leafc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer mortality', & - ptr_patch=this%m_leafc_xfer_to_litter_patch, default='inactive') - - this%m_frootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer mortality', & - ptr_patch=this%m_frootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer mortality', & - ptr_patch=this%m_deadstemc_xfer_to_litter_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer mortality', & - ptr_patch=this%m_livecrootc_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer mortality', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') - - this%m_deadstemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C mortality', & - ptr_patch=this%m_deadstemc_to_litter_patch, default='inactive') - - this%m_livecrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C mortality', & - ptr_patch=this%m_livecrootc_to_litter_patch, default='inactive') - - this%m_deadcrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C mortality', & - ptr_patch=this%m_deadcrootc_to_litter_patch, default='inactive') - - this%m_gresp_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage mortality', & - ptr_patch=this%m_gresp_storage_to_litter_patch, default='inactive') - - this%m_gresp_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer mortality', & - ptr_patch=this%m_gresp_xfer_to_litter_patch, default='inactive') - - this%m_leafc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C fire loss', & - ptr_patch=this%m_leafc_to_fire_patch, default='inactive') - - this%m_frootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C fire loss', & - ptr_patch=this%m_frootc_to_fire_patch, default='inactive') - - this%m_leafc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage fire loss', & - ptr_patch=this%m_leafc_storage_to_fire_patch, default='inactive') - - this%m_frootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage fire loss', & - ptr_patch=this%m_frootc_storage_to_fire_patch, default='inactive') - - this%m_livestemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage fire loss', & - ptr_patch=this%m_deadstemc_storage_to_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage fire loss', & - ptr_patch=this%m_livecrootc_storage_to_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage fire loss', & - ptr_patch=this%m_deadcrootc_storage_to_fire_patch, default='inactive') - - this%m_leafc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer fire loss', & - ptr_patch=this%m_leafc_xfer_to_fire_patch, default='inactive') - - this%m_frootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer fire loss', & - ptr_patch=this%m_frootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer fire loss', & - ptr_patch=this%m_deadstemc_xfer_to_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer fire loss', & - ptr_patch=this%m_livecrootc_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer fire loss', & - ptr_patch=this%m_deadcrootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C fire loss', & - ptr_patch=this%m_deadstemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_LITTER_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C fire mortality to litter', & - ptr_patch=this%m_deadstemc_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C fire loss', & - ptr_patch=this%m_livecrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C fire loss', & - ptr_patch=this%m_deadcrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_LITTER_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C fire mortality to litter', & - ptr_patch=this%m_deadcrootc_to_litter_fire_patch, default='inactive') - - this%m_gresp_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage fire loss', & - ptr_patch=this%m_gresp_storage_to_fire_patch, default='inactive') - - this%m_gresp_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer fire loss', & - ptr_patch=this%m_gresp_xfer_to_fire_patch, default='inactive') - - this%leafc_xfer_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_XFER_TO_LEAFC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') - - this%frootc_xfer_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_XFER_TO_FROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C growth from storage', & - ptr_patch=this%frootc_xfer_to_frootc_patch, default='inactive') - - this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_XFER_TO_LIVESTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') - - this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_XFER_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') - - this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_XFER_TO_LIVECROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C growth from storage', & - ptr_patch=this%livecrootc_xfer_to_livecrootc_patch, default='inactive') - - this%deadcrootc_xfer_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_XFER_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C growth from storage', & - ptr_patch=this%deadcrootc_xfer_to_deadcrootc_patch, default='inactive') - - this%leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C litterfall', & - ptr_patch=this%leafc_to_litter_patch, default='inactive') - - this%frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall', & - ptr_patch=this%frootc_to_litter_patch, default='inactive') - - this%leaf_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAF_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf maintenance respiration', & - ptr_patch=this%leaf_mr_patch, default='inactive') - - this%froot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOT_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root maintenance respiration', & - ptr_patch=this%froot_mr_patch, default='inactive') - - this%livestem_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEM_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') - - this%livecroot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOT_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') - - this%psnsun_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PSNSUN_TO_CPOOL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 C fixation from sunlit canopy', & - ptr_patch=this%psnsun_to_cpool_patch) - - this%psnshade_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PSNSHADE_TO_CPOOL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 C fixation from shaded canopy', & - ptr_patch=this%psnshade_to_cpool_patch) - - this%cpool_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to leaf C', & - ptr_patch=this%cpool_to_leafc_patch, default='inactive') - - this%cpool_to_leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to leaf C storage', & - ptr_patch=this%cpool_to_leafc_storage_patch, default='inactive') - - this%cpool_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_FROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to fine root C', & - ptr_patch=this%cpool_to_frootc_patch, default='inactive') - - this%cpool_to_frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_FROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to fine root C storage', & - ptr_patch=this%cpool_to_frootc_storage_patch, default='inactive') - - this%cpool_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVESTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') - - this%cpool_to_livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVESTEMC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') - - this%cpool_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') - - this%cpool_to_deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADSTEMC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') - - this%cpool_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVECROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') - - this%cpool_to_livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_LIVECROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') - - this%cpool_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') - - this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_DEADCROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') - - this%cpool_to_gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_TO_GRESP_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to growth respiration storage', & - ptr_patch=this%cpool_to_gresp_storage_patch, default='inactive') - - this%cpool_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LEAF_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration', & - ptr_patch=this%cpool_leaf_gr_patch, default='inactive') - - this%cpool_leaf_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LEAF_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration to storage', & - ptr_patch=this%cpool_leaf_storage_gr_patch, default='inactive') - - this%transfer_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_LEAF_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration from storage', & - ptr_patch=this%transfer_leaf_gr_patch, default='inactive') - - this%cpool_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_FROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration', & - ptr_patch=this%cpool_froot_gr_patch, default='inactive') - - this%cpool_froot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_FROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration to storage', & - ptr_patch=this%cpool_froot_storage_gr_patch, default='inactive') - - this%transfer_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_FROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration from storage', & - ptr_patch=this%transfer_froot_gr_patch, default='inactive') - - this%cpool_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVESTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') - - this%cpool_livestem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVESTEM_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') - - this%transfer_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_LIVESTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') - - this%cpool_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADSTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') - - this%cpool_deadstem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADSTEM_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') - - this%transfer_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_DEADSTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') - - this%cpool_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVECROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') - - this%cpool_livecroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_LIVECROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') - - this%transfer_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_LIVECROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration from storage', & - ptr_patch=this%transfer_livecroot_gr_patch, default='inactive') - - this%cpool_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADCROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration', & - ptr_patch=this%cpool_deadcroot_gr_patch, default='inactive') - - this%cpool_deadcroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL_DEADCROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration to storage', & - ptr_patch=this%cpool_deadcroot_storage_gr_patch, default='inactive') - - this%transfer_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_DEADCROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration from storage', & - ptr_patch=this%transfer_deadcroot_gr_patch, default='inactive') - - this%leafc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C shift storage to transfer', & - ptr_patch=this%leafc_storage_to_xfer_patch, default='inactive') - - this%frootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C shift storage to transfer', & - ptr_patch=this%frootc_storage_to_xfer_patch, default='inactive') - - this%livestemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') - - this%deadstemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') - - this%livecrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C shift storage to transfer', & - ptr_patch=this%livecrootc_storage_to_xfer_patch, default='inactive') - - this%deadcrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C shift storage to transfer', & - ptr_patch=this%deadcrootc_storage_to_xfer_patch, default='inactive') - - this%gresp_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRESP_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration shift storage to transfer', & - ptr_patch=this%gresp_storage_to_xfer_patch, default='inactive') - - this%livestemc_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') - - this%livecrootc_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') - - this%current_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CURRENT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for new growth displayed in this timestep', & - ptr_patch=this%current_gr_patch, default='inactive') - - this%transfer_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TRANSFER_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for transfer growth displayed in this timestep', & - ptr_patch=this%transfer_gr_patch, default='inactive') - - this%storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for growth sent to storage for later display', & - ptr_patch=this%storage_gr_patch, default='inactive') - - this%xsmrpool_c13ratio_patch(begp:endp) = spval - call hist_addfld1d (fname='XSMRPOOL_C13RATIO', units='proportion', & - avgflag='A', long_name='C13/C(12+13) ratio for xsmrpool', & - ptr_patch=this%xsmrpool_c13ratio_patch, default='inactive') - - endif - - !------------------------------- - ! C14 flux variables - patch - !------------------------------- - - if ( carbon_type == 'c14' ) then - - this%m_leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C mortality', & - ptr_patch=this%m_leafc_to_litter_patch, default='inactive') - - this%m_frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C mortality', & - ptr_patch=this%m_frootc_to_litter_patch, default='inactive') - - this%m_leafc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C storage mortality', & - ptr_patch=this%m_leafc_storage_to_litter_patch, default='inactive') - - this%m_frootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C storage mortality', & - ptr_patch=this%m_frootc_storage_to_litter_patch, default='inactive') - - this%m_livestemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C storage mortality', & - ptr_patch=this%m_livestemc_storage_to_litter_patch, default='inactive') - - this%m_deadstemc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C storage mortality', & - ptr_patch=this%m_deadstemc_storage_to_litter_patch, default='inactive') - - this%m_livecrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C storage mortality', & - ptr_patch=this%m_livecrootc_storage_to_litter_patch, default='inactive') - - this%m_deadcrootc_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C storage mortality', & - ptr_patch=this%m_deadcrootc_storage_to_litter_patch, default='inactive') - - this%m_leafc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C transfer mortality', & - ptr_patch=this%m_leafc_xfer_to_litter_patch, default='inactive') - - this%m_frootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C transfer mortality', & - ptr_patch=this%m_frootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C transfer mortality', & - ptr_patch=this%m_livestemc_xfer_to_litter_patch, default='inactive') - - this%m_deadstemc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C transfer mortality', & - ptr_patch=this%m_deadstemc_xfer_to_litter_patch, default='inactive') - - this%m_livecrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C transfer mortality', & - ptr_patch=this%m_livecrootc_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootc_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C transfer mortality', & - ptr_patch=this%m_deadcrootc_xfer_to_litter_patch, default='inactive') - - this%m_livestemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C mortality', & - ptr_patch=this%m_livestemc_to_litter_patch, default='inactive') - - this%m_deadstemc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C mortality', & - ptr_patch=this%m_deadstemc_to_litter_patch, default='inactive') - - this%m_livecrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C mortality', & - ptr_patch=this%m_livecrootc_to_litter_patch, default='inactive') - - this%m_deadcrootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C mortality', & - ptr_patch=this%m_deadcrootc_to_litter_patch, default='inactive') - - this%m_gresp_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_STORAGE_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration storage mortality', & - ptr_patch=this%m_gresp_storage_to_litter_patch, default='inactive') - - this%m_gresp_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_XFER_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration transfer mortality', & - ptr_patch=this%m_gresp_xfer_to_litter_patch, default='inactive') - - this%m_leafc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C fire loss', & - ptr_patch=this%m_leafc_to_fire_patch, default='inactive') - - this%m_frootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C fire loss', & - ptr_patch=this%m_frootc_to_fire_patch, default='inactive') - - this%m_leafc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C storage fire loss', & - ptr_patch=this%m_leafc_storage_to_fire_patch, default='inactive') - - this%m_frootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C storage fire loss', & - ptr_patch=this%m_frootc_storage_to_fire_patch, default='inactive') - - this%m_livestemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C storage fire loss', & - ptr_patch=this%m_livestemc_storage_to_fire_patch, default='inactive') - - this%m_deadstemc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C storage fire loss', & - ptr_patch=this%m_deadstemc_storage_to_fire_patch, default='inactive') - - this%m_livecrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C storage fire loss', & - ptr_patch=this%m_livecrootc_storage_to_fire_patch, default='inactive') - - this%m_deadcrootc_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C storage fire loss', & - ptr_patch=this%m_deadcrootc_storage_to_fire_patch, default='inactive') - - this%m_leafc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LEAFC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C transfer fire loss', & - ptr_patch=this%m_leafc_xfer_to_fire_patch, default='inactive') - - this%m_frootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_FROOTC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C transfer fire loss', & - ptr_patch=this%m_frootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C transfer fire loss', & - ptr_patch=this%m_livestemc_xfer_to_fire_patch, default='inactive') - - this%m_deadstemc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C transfer fire loss', & - ptr_patch=this%m_deadstemc_xfer_to_fire_patch, default='inactive') - - this%m_livecrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C transfer fire loss', & - ptr_patch=this%m_livecrootc_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootc_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C transfer fire loss', & - ptr_patch=this%m_deadcrootc_xfer_to_fire_patch, default='inactive') - - this%m_livestemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVESTEMC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C fire loss', & - ptr_patch=this%m_livestemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C fire loss', & - ptr_patch=this%m_deadstemc_to_fire_patch, default='inactive') - - this%m_deadstemc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADSTEMC_TO_LITTER_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C fire mortality to litter', & - ptr_patch=this%m_deadstemc_to_litter_fire_patch, default='inactive') - - this%m_livecrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_LIVECROOTC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C fire loss', & - ptr_patch=this%m_livecrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C fire loss', & - ptr_patch=this%m_deadcrootc_to_fire_patch, default='inactive') - - this%m_deadcrootc_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_DEADCROOTC_TO_LITTER_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C fire mortality to litter', & - ptr_patch=this%m_deadcrootc_to_litter_fire_patch, default='inactive') - - this%m_gresp_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_STORAGE_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration storage fire loss', & - ptr_patch=this%m_gresp_storage_to_fire_patch, default='inactive') - - this%m_gresp_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_M_GRESP_XFER_TO_FIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration transfer fire loss', & - ptr_patch=this%m_gresp_xfer_to_fire_patch, default='inactive') - - this%leafc_xfer_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_XFER_TO_LEAFC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C growth from storage', & - ptr_patch=this%leafc_xfer_to_leafc_patch, default='inactive') - - this%frootc_xfer_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_XFER_TO_FROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C growth from storage', & - ptr_patch=this%frootc_xfer_to_frootc_patch, default='inactive') - - this%livestemc_xfer_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_XFER_TO_LIVESTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C growth from storage', & - ptr_patch=this%livestemc_xfer_to_livestemc_patch, default='inactive') - - this%deadstemc_xfer_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_XFER_TO_DEADSTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C growth from storage', & - ptr_patch=this%deadstemc_xfer_to_deadstemc_patch, default='inactive') - - this%livecrootc_xfer_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_XFER_TO_LIVECROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C growth from storage', & - ptr_patch=this%livecrootc_xfer_to_livecrootc_patch, default='inactive') - - this%deadcrootc_xfer_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_XFER_TO_DEADCROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C growth from storage', & - ptr_patch=this%deadcrootc_xfer_to_deadcrootc_patch, default='inactive') - - this%leafc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C litterfall', & - ptr_patch=this%leafc_to_litter_patch, default='inactive') - - this%frootc_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_TO_LITTER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C litterfall', & - ptr_patch=this%frootc_to_litter_patch, default='inactive') - - this%leaf_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAF_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf maintenance respiration', & - ptr_patch=this%leaf_mr_patch, default='inactive') - - this%froot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOT_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root maintenance respiration', & - ptr_patch=this%froot_mr_patch, default='inactive') - - this%livestem_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEM_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem maintenance respiration', & - ptr_patch=this%livestem_mr_patch, default='inactive') - - this%livecroot_mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOT_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root maintenance respiration', & - ptr_patch=this%livecroot_mr_patch, default='inactive') - - this%psnsun_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PSNSUN_TO_CPOOL', units='gC14/m^2/s', & - avgflag='A', long_name='C14 C fixation from sunlit canopy', & - ptr_patch=this%psnsun_to_cpool_patch) - - this%psnshade_to_cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PSNSHADE_TO_CPOOL', units='gC14/m^2/s', & - avgflag='A', long_name='C14 C fixation from shaded canopy', & - ptr_patch=this%psnshade_to_cpool_patch) - - this%cpool_to_leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LEAFC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to leaf C', & - ptr_patch=this%cpool_to_leafc_patch, default='inactive') - - this%cpool_to_leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LEAFC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to leaf C storage', & - ptr_patch=this%cpool_to_leafc_storage_patch, default='inactive') - - this%cpool_to_frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_FROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to fine root C', & - ptr_patch=this%cpool_to_frootc_patch, default='inactive') - - this%cpool_to_frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_FROOTC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to fine root C storage', & - ptr_patch=this%cpool_to_frootc_storage_patch, default='inactive') - - this%cpool_to_livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVESTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live stem C', & - ptr_patch=this%cpool_to_livestemc_patch, default='inactive') - - this%cpool_to_livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVESTEMC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live stem C storage', & - ptr_patch=this%cpool_to_livestemc_storage_patch, default='inactive') - - this%cpool_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADSTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead stem C', & - ptr_patch=this%cpool_to_deadstemc_patch, default='inactive') - - this%cpool_to_deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADSTEMC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead stem C storage', & - ptr_patch=this%cpool_to_deadstemc_storage_patch, default='inactive') - - this%cpool_to_livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVECROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live coarse root C', & - ptr_patch=this%cpool_to_livecrootc_patch, default='inactive') - - this%cpool_to_livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_LIVECROOTC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to live coarse root C storage', & - ptr_patch=this%cpool_to_livecrootc_storage_patch, default='inactive') - - this%cpool_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADCROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead coarse root C', & - ptr_patch=this%cpool_to_deadcrootc_patch, default='inactive') - - this%cpool_to_deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_DEADCROOTC_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to dead coarse root C storage', & - ptr_patch=this%cpool_to_deadcrootc_storage_patch, default='inactive') - - this%cpool_to_gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_TO_GRESP_STORAGE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 allocation to growth respiration storage', & - ptr_patch=this%cpool_to_gresp_storage_patch, default='inactive') - - this%cpool_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LEAF_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf growth respiration', & - ptr_patch=this%cpool_leaf_gr_patch, default='inactive') - - this%cpool_leaf_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LEAF_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf growth respiration to storage', & - ptr_patch=this%cpool_leaf_storage_gr_patch, default='inactive') - - this%transfer_leaf_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_LEAF_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf growth respiration from storage', & - ptr_patch=this%transfer_leaf_gr_patch, default='inactive') - - this%cpool_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_FROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root growth respiration', & - ptr_patch=this%cpool_froot_gr_patch, default='inactive') - - this%cpool_froot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_FROOT_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root growth respiration to storage', & - ptr_patch=this%cpool_froot_storage_gr_patch, default='inactive') - - this%transfer_froot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_FROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root growth respiration from storage', & - ptr_patch=this%transfer_froot_gr_patch, default='inactive') - - this%cpool_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVESTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem growth respiration', & - ptr_patch=this%cpool_livestem_gr_patch, default='inactive') - - this%cpool_livestem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVESTEM_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem growth respiration to storage', & - ptr_patch=this%cpool_livestem_storage_gr_patch, default='inactive') - - this%transfer_livestem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_LIVESTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem growth respiration from storage', & - ptr_patch=this%transfer_livestem_gr_patch, default='inactive') - - this%cpool_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADSTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem growth respiration', & - ptr_patch=this%cpool_deadstem_gr_patch, default='inactive') - - this%cpool_deadstem_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADSTEM_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem growth respiration to storage', & - ptr_patch=this%cpool_deadstem_storage_gr_patch, default='inactive') - - this%transfer_deadstem_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_DEADSTEM_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem growth respiration from storage', & - ptr_patch=this%transfer_deadstem_gr_patch, default='inactive') - - this%cpool_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVECROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root growth respiration', & - ptr_patch=this%cpool_livecroot_gr_patch, default='inactive') - - this%cpool_livecroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_LIVECROOT_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root growth respiration to storage', & - ptr_patch=this%cpool_livecroot_storage_gr_patch, default='inactive') - - this%transfer_livecroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_LIVECROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root growth respiration from storage', & - ptr_patch=this%transfer_livecroot_gr_patch, default='inactive') - - this%cpool_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADCROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root growth respiration', & - ptr_patch=this%cpool_deadcroot_gr_patch, default='inactive') - - this%cpool_deadcroot_storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL_DEADCROOT_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root growth respiration to storage', & - ptr_patch=this%cpool_deadcroot_storage_gr_patch, default='inactive') - - this%transfer_deadcroot_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_DEADCROOT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root growth respiration from storage', & - ptr_patch=this%transfer_deadcroot_gr_patch, default='inactive') - - this%leafc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 leaf C shift storage to transfer', & - ptr_patch=this%leafc_storage_to_xfer_patch, default='inactive') - - this%frootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 fine root C shift storage to transfer', & - ptr_patch=this%frootc_storage_to_xfer_patch, default='inactive') - - this%livestemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C shift storage to transfer', & - ptr_patch=this%livestemc_storage_to_xfer_patch, default='inactive') - - this%deadstemc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead stem C shift storage to transfer', & - ptr_patch=this%deadstemc_storage_to_xfer_patch, default='inactive') - - this%livecrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C shift storage to transfer', & - ptr_patch=this%livecrootc_storage_to_xfer_patch, default='inactive') - - this%deadcrootc_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 dead coarse root C shift storage to transfer', & - ptr_patch=this%deadcrootc_storage_to_xfer_patch, default='inactive') - - this%gresp_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRESP_STORAGE_TO_XFER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth respiration shift storage to transfer', & - ptr_patch=this%gresp_storage_to_xfer_patch, default='inactive') - - this%livestemc_to_deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_TO_DEADSTEMC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live stem C turnover', & - ptr_patch=this%livestemc_to_deadstemc_patch, default='inactive') - - this%livecrootc_to_deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_TO_DEADCROOTC', units='gC14/m^2/s', & - avgflag='A', long_name='C14 live coarse root C turnover', & - ptr_patch=this%livecrootc_to_deadcrootc_patch, default='inactive') - - this%current_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CURRENT_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth resp for new growth displayed in this timestep', & - ptr_patch=this%current_gr_patch, default='inactive') - - this%transfer_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TRANSFER_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth resp for transfer growth displayed in this timestep', & - ptr_patch=this%transfer_gr_patch, default='inactive') - - this%storage_gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_STORAGE_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 growth resp for growth sent to storage for later display', & - ptr_patch=this%storage_gr_patch, default='inactive') - - this%gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 gross primary production', & - ptr_patch=this%gpp_patch) - - this%rr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_RR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 root respiration (fine root MR + total root GR)', & - ptr_patch=this%rr_patch) - - this%mr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_MR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 maintenance respiration', & - ptr_patch=this%mr_patch) - - this%gr_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total growth respiration', & - ptr_patch=this%gr_patch) - - this%ar_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_AR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 autotrophic respiration (MR + GR)', & - ptr_patch=this%ar_patch) - - this%npp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_NPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 net primary production', & - ptr_patch=this%npp_patch) - - this%agnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_AGNPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 aboveground NPP', & - ptr_patch=this%agnpp_patch) - - this%bgnpp_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_BGNPP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 belowground NPP', & - ptr_patch=this%bgnpp_patch) - - this%litfall_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LITFALL', units='gC14/m^2/s', & - avgflag='A', long_name='C14 litterfall (leaves and fine roots)', & - ptr_patch=this%litfall_patch, default='inactive') - - this%fire_closs_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PFT_FIRE_CLOSS', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total patch-level fire C loss', & - ptr_patch=this%fire_closs_patch) - endif - - !------------------------------- - ! C flux variables - column - !------------------------------- - - if (carbon_type == 'c12') then - - this%cwdc_loss_col(begc:endc) = spval - call hist_addfld1d (fname='CWDC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='coarse woody debris C loss', & - ptr_col=this%cwdc_loss_col) - - this%m_decomp_cpools_to_fire_col(begc:endc,:) = spval - this%m_decomp_cpools_to_fire_vr_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%m_decomp_cpools_to_fire_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%m_decomp_cpools_to_fire_vr_col(:,:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE'//trim(vr_suffix) - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - endif - end do - - this%dwt_seedc_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_LEAF', units='gC/m^2/s', & - avgflag='A', long_name='seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedc_to_leaf_grc, default='inactive') - - this%dwt_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_LEAF_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_leaf_patch, default='inactive') - - this%dwt_seedc_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_DEADSTEM', units='gC/m^2/s', & - avgflag='A', long_name='seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedc_to_deadstem_grc, default='inactive') - - this%dwt_seedc_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDC_TO_DEADSTEM_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_deadstem_patch, default='inactive') - - this%dwt_conv_cflux_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_CONV_CFLUX', units='gC/m^2/s', & - avgflag='A', & - long_name='conversion C flux (immediate loss to atm) (0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_cflux_grc) - - this%dwt_conv_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_CONV_CFLUX_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_cflux_patch, default='inactive') - - this%dwt_conv_cflux_dribbled_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_CONV_CFLUX_DRIBBLED', units='gC/m^2/s', & - avgflag='A', & - long_name='conversion C flux (immediate loss to atm), dribbled throughout the year', & - ptr_gcell=this%dwt_conv_cflux_dribbled_grc) - - this%dwt_wood_productc_gain_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_WOOD_PRODUCTC_GAIN_PATCH', units='gC/m^2/s', & - avgflag='A', & - long_name='patch-level landcover change-driven addition to wood product pools' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_wood_productc_gain_patch, default='inactive') - - this%dwt_slash_cflux_col(begc:endc) = spval - call hist_addfld1d (fname='DWT_SLASH_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='slash C flux to litter and CWD due to land use', & - ptr_col=this%dwt_slash_cflux_col) - - this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_MET_C', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_met_c_col, default='inactive') - - this%dwt_frootc_to_litr_cel_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_CEL_C', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_cel_c_col, default='inactive') - - this%dwt_frootc_to_litr_lig_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTC_TO_LITR_LIG_C', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_lig_c_col, default='inactive') - - this%dwt_livecrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_LIVECROOTC_TO_CWDC', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootc_to_cwdc_col, default='inactive') - - this%dwt_deadcrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_DEADCROOTC_TO_CWDC', units='gC/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootc_to_cwdc_col, default='inactive') - - this%crop_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='CROP_SEEDC_TO_LEAF', units='gC/m^2/s', & - avgflag='A', long_name='crop seed source to leaf', & - ptr_patch=this%crop_seedc_to_leaf_patch, default='inactive') - - this%sr_col(begc:endc) = spval - call hist_addfld1d (fname='SR', units='gC/m^2/s', & - avgflag='A', long_name='total soil respiration (HR + root resp)', & - ptr_col=this%sr_col) - - this%er_col(begc:endc) = spval - call hist_addfld1d (fname='ER', units='gC/m^2/s', & - avgflag='A', long_name='total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=this%er_col) - - this%litfire_col(begc:endc) = spval - call hist_addfld1d (fname='LITFIRE', units='gC/m^2/s', & - avgflag='A', long_name='litter fire losses', & - ptr_col=this%litfire_col, default='inactive') - - this%somfire_col(begc:endc) = spval - call hist_addfld1d (fname='SOMFIRE', units='gC/m^2/s', & - avgflag='A', long_name='soil organic matter fire losses', & - ptr_col=this%somfire_col, default='inactive') - - this%totfire_col(begc:endc) = spval - call hist_addfld1d (fname='TOTFIRE', units='gC/m^2/s', & - avgflag='A', long_name='total ecosystem fire losses', & - ptr_col=this%totfire_col, default='inactive') - - this%fire_closs_col(begc:endc) = spval - call hist_addfld1d (fname='COL_FIRE_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total column-level fire C loss for non-peat fires outside land-type converted region', & - ptr_col=this%fire_closs_col) - - this%annsum_npp_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNSUM_NPP', units='gC/m^2/yr', & - avgflag='A', long_name='annual sum of NPP', & - ptr_patch=this%annsum_npp_patch, default='inactive') - - this%annsum_npp_col(begc:endc) = spval - call hist_addfld1d (fname='CANNSUM_NPP', units='gC/m^2/s', & - avgflag='A', long_name='annual sum of column-level NPP', & - ptr_col=this%annsum_npp_col, default='inactive') - - this%nep_col(begc:endc) = spval - call hist_addfld1d (fname='NEP', units='gC/m^2/s', & - avgflag='A', long_name='net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink', & - ptr_col=this%nep_col) - - this%nbp_grc(begg:endg) = spval - call hist_addfld1d (fname='NBP', units='gC/m^2/s', & - avgflag='A', long_name='net biome production, includes fire, landuse,'& - //' harvest and hrv_xsmrpool flux (latter smoothed over the year), positive for sink'& - //' (same as net carbon exchange between land and atmosphere)', & - ptr_gcell=this%nbp_grc) - - this%nee_grc(begg:endg) = spval - call hist_addfld1d (fname='NEE', units='gC/m^2/s', & - avgflag='A', long_name='net ecosystem exchange of carbon,'& - //' includes fire and hrv_xsmrpool (latter smoothed over the year),'& - //' excludes landuse and harvest flux, positive for source', & - ptr_gcell=this%nee_grc) - - this%landuseflux_grc(begg:endg) = spval - call hist_addfld1d (fname='LAND_USE_FLUX', units='gC/m^2/s', & - avgflag='A', & - long_name='total C emitted from land cover conversion (smoothed over the year)'& - //' and wood and grain product pools (NOTE: not a net value)', & - ptr_gcell=this%landuseflux_grc) - - end if - !------------------------------- - ! C13 flux variables - column - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%m_decomp_cpools_to_fire_col(begc:endc,:) = spval - this%m_decomp_cpools_to_fire_vr_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%m_decomp_cpools_to_fire_col(:,k) - fieldname = 'C13_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE' - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld1d (fname=fieldname, units='gC13/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%m_decomp_cpools_to_fire_vr_col(:,:,k) - fieldname = 'C13_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE'//trim(vr_suffix) - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld_decomp (fname=fieldname, units='gC13/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end if - endif - end do - - this%dwt_seedc_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_LEAF', units='gC13/m^2/s', & - avgflag='A', long_name='C13 seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedc_to_leaf_grc, default='inactive') - - this%dwt_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_LEAF_PATCH', units='gC13/m^2/s', & - avgflag='A', & - long_name='patch-level C13 seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_leaf_patch, default='inactive') - - this%dwt_seedc_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_DEADSTEM', units='gC13/m^2/s', & - avgflag='A', long_name='C13 seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedc_to_deadstem_grc, default='inactive') - - this%dwt_seedc_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_DEADSTEM_PATCH', units='gC13/m^2/s', & - avgflag='A', & - long_name='patch-level C13 seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_deadstem_patch, default='inactive') - - this%dwt_conv_cflux_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX', units='gC13/m^2/s', & - avgflag='A', long_name='C13 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_cflux_grc) - - this%dwt_conv_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX_PATCH', units='gC13/m^2/s', & - avgflag='A', & - long_name='patch-level C13 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_cflux_patch, default='inactive') - - this%dwt_conv_cflux_dribbled_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX_DRIBBLED', units='gC13/m^2/s', & - avgflag='A', & - long_name='C13 conversion C flux (immediate loss to atm), dribbled throughout the year', & - ptr_gcell=this%dwt_conv_cflux_dribbled_grc) - - this%dwt_slash_cflux_col(begc:endc) = spval - call hist_addfld1d (fname='C13_DWT_SLASH_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C13 slash C flux to litter and CWD due to land use', & - ptr_col=this%dwt_slash_cflux_col) - - this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_MET_C', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_met_c_col, default='inactive') - - this%dwt_frootc_to_litr_cel_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_CEL_C', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_cel_c_col, default='inactive') - - this%dwt_frootc_to_litr_lig_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_FROOTC_TO_LITR_LIG_C', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_lig_c_col, default='inactive') - - this%dwt_livecrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_LIVECROOTC_TO_CWDC', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootc_to_cwdc_col, default='inactive') - - this%dwt_deadcrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C13_DWT_DEADCROOTC_TO_CWDC', units='gC13/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C13 dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootc_to_cwdc_col, default='inactive') - - this%crop_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CROP_SEEDC_TO_LEAF', units='gC13/m^2/s', & - avgflag='A', long_name='C13 crop seed source to leaf', & - ptr_patch=this%crop_seedc_to_leaf_patch, default='inactive') - - this%sr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_SR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total soil respiration (HR + root resp)', & - ptr_col=this%sr_col) - - this%er_col(begc:endc) = spval - call hist_addfld1d (fname='C13_ER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=this%er_col) - - this%litfire_col(begc:endc) = spval - call hist_addfld1d (fname='C13_LITFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter fire losses', & - ptr_col=this%litfire_col, default='inactive') - - this%somfire_col(begc:endc) = spval - call hist_addfld1d (fname='C13_SOMFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 soil organic matter fire losses', & - ptr_col=this%somfire_col, default='inactive') - - this%totfire_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total ecosystem fire losses', & - ptr_col=this%totfire_col, default='inactive') - - this%fire_closs_col(begc:endc) = spval - call hist_addfld1d (fname='C13_COL_FIRE_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total column-level fire C loss', & - ptr_col=this%fire_closs_col) - - this%nep_col(begc:endc) = spval - call hist_addfld1d (fname='C13_NEP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net ecosystem production, excludes fire flux, positive for sink', & - ptr_col=this%nep_col) - - this%nee_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_NEE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net ecosystem exchange of carbon, includes fire flux, positive for source', & - ptr_gcell=this%nee_grc) - - endif - - !------------------------------- - ! C14 flux variables - column - !------------------------------- - - if (carbon_type == 'c14') then - - this%m_decomp_cpools_to_fire_col(begc:endc,:) = spval - this%m_decomp_cpools_to_fire_vr_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%m_decomp_cpools_to_fire_col(:,k) - fieldname = 'C14_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE' - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld1d (fname=fieldname, units='gC14/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%m_decomp_cpools_to_fire_vr_col(:,:,k) - fieldname = 'C14_M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_FIRE'//trim(vr_suffix) - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_long(k))//' C fire loss' - call hist_addfld_decomp (fname=fieldname, units='gC14/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end if - endif - end do - - this%dwt_seedc_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_LEAF', units='gC14/m^2/s', & - avgflag='A', long_name='C14 seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedc_to_leaf_grc, default='inactive') - - this%dwt_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_LEAF_PATCH', units='gC14/m^2/s', & - avgflag='A', & - long_name='patch-level C14 seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_leaf_patch, default='inactive') - - this%dwt_seedc_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_DEADSTEM', units='gC14/m^2/s', & - avgflag='A', long_name='C14 seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedc_to_deadstem_grc, default='inactive') - - this%dwt_seedc_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DWT_SEEDC_TO_DEADSTEM_PATCH', units='gC14/m^2/s', & - avgflag='A', & - long_name='patch-level C14 seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedc_to_deadstem_patch, default='inactive') - - this%dwt_conv_cflux_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_CONV_CFLUX', units='gC14/m^2/s', & - avgflag='A', long_name='C14 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_cflux_grc) - - this%dwt_conv_cflux_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DWT_CONV_CFLUX_PATCH', units='gC14/m^2/s', & - avgflag='A', & - long_name='patch-level C14 conversion C flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_cflux_patch, default='inactive') - - this%dwt_conv_cflux_dribbled_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_DWT_CONV_CFLUX_DRIBBLED', units='gC14/m^2/s', & - avgflag='A', & - long_name='C14 conversion C flux (immediate loss to atm), dribbled throughout the year', & - ptr_gcell=this%dwt_conv_cflux_dribbled_grc) - - this%dwt_slash_cflux_col(begc:endc) = spval - call hist_addfld1d (fname='C14_DWT_SLASH_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C14 slash C flux to litter and CWD due to land use', & - ptr_col=this%dwt_slash_cflux_col) - - this%dwt_frootc_to_litr_met_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_MET_C', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_met_c_col, default='inactive') - - this%dwt_frootc_to_litr_cel_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_CEL_C', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_cel_c_col, default='inactive') - - this%dwt_frootc_to_litr_lig_c_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_FROOTC_TO_LITR_LIG_C', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 fine root to litter due to landcover change', & - ptr_col=this%dwt_frootc_to_litr_lig_c_col, default='inactive') - - this%dwt_livecrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_LIVECROOTC_TO_CWDC', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootc_to_cwdc_col, default='inactive') - - this%dwt_deadcrootc_to_cwdc_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='C14_DWT_DEADCROOTC_TO_CWDC', units='gC14/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='C14 dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootc_to_cwdc_col, default='inactive') - - this%crop_seedc_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CROP_SEEDC_TO_LEAF', units='gC14/m^2/s', & - avgflag='A', long_name='C14 crop seed source to leaf', & - ptr_patch=this%crop_seedc_to_leaf_patch, default='inactive') - - this%sr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_SR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total soil respiration (HR + root resp)', & - ptr_col=this%sr_col) - - this%er_col(begc:endc) = spval - call hist_addfld1d (fname='C14_ER', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=this%er_col) - - this%litfire_col(begc:endc) = spval - call hist_addfld1d (fname='C14_LITFIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 litter fire losses', & - ptr_col=this%litfire_col, default='inactive') - - this%somfire_col(begc:endc) = spval - call hist_addfld1d (fname='C14_SOMFIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 soil organic matter fire losses', & - ptr_col=this%somfire_col, default='inactive') - - this%totfire_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTFIRE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total ecosystem fire losses', & - ptr_col=this%totfire_col, default='inactive') - - this%fire_closs_col(begc:endc) = spval - call hist_addfld1d (fname='C14_COL_FIRE_CLOSS', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total column-level fire C loss', & - ptr_col=this%fire_closs_col) - - this%nep_col(begc:endc) = spval - call hist_addfld1d (fname='C14_NEP', units='gC14/m^2/s', & - avgflag='A', long_name='C14 net ecosystem production, excludes fire flux, positive for sink', & - ptr_col=this%nep_col) - - this%nee_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_NEE', units='gC14/m^2/s', & - avgflag='A', long_name='C14 net ecosystem exchange of carbon, includes fire flux, positive for source', & - ptr_gcell=this%nee_grc) - - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p, c, l, j - integer :: fc ! filter index - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch(bounds%endp-bounds%begp+1) ! special landunit filter - patches - !----------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! Set patch filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - this%gpp_before_downreg_patch(p) = 0._r8 - ! WW should these be considered spval or 0? - if (lun%ifspecial(l)) then - this%availc_patch(p) = spval - this%xsmrpool_recover_patch(p) = spval - this%excess_cflux_patch(p) = spval - this%plant_calloc_patch(p) = spval - this%prev_leafc_to_litter_patch(p) = spval - this%prev_frootc_to_litter_patch(p) = spval - this%leafc_to_litter_fun_patch(p) = spval - if ( use_c13 ) then - this%xsmrpool_c13ratio_patch(p) = spval - endif - end if - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%availc_patch(p) = 0._r8 - this%xsmrpool_recover_patch(p) = 0._r8 - this%excess_cflux_patch(p) = 0._r8 - this%prev_leafc_to_litter_patch(p) = 0._r8 - this%leafc_to_litter_fun_patch(p) = 0._r8 - this%prev_frootc_to_litter_patch(p) = 0._r8 - this%plant_calloc_patch(p) = 0._r8 - end if - end do - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - ! also initialize dynamic landcover fluxes so that they have - ! real values on first timestep, prior to calling pftdyn_cnbal - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%dwt_slash_cflux_col(c) = 0._r8 - do j = 1, nlevdecomp_full - this%dwt_frootc_to_litr_met_c_col(c,j) = 0._r8 - this%dwt_frootc_to_litr_cel_c_col(c,j) = 0._r8 - this%dwt_frootc_to_litr_lig_c_col(c,j) = 0._r8 - this%dwt_livecrootc_to_cwdc_col(c,j) = 0._r8 - this%dwt_deadcrootc_to_cwdc_col(c,j) = 0._r8 - end do - end if - end do - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - this%gpp_patch(p) = 0._r8 - if (lun%ifspecial(l)) then - this%tempsum_npp_patch(p) = spval - this%annsum_npp_patch(p) = spval - this%tempsum_litfall_patch(p) = spval - this%annsum_litfall_patch(p) = spval - end if - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%tempsum_npp_patch(p) = 0._r8 - this%annsum_npp_patch(p) = 0._r8 - this%tempsum_litfall_patch(p) = 0._r8 - this%annsum_litfall_patch(p) = 0._r8 - end if - end do - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%ifspecial(l)) then - this%annsum_npp_col(c) = spval - end if - - ! also initialize dynamic landcover fluxes so that they have - ! real values on first timestep, prior to calling pftdyn_cnbal - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%annsum_npp_col(c) = 0._r8 - end if - end do - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, carbon_type ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon fluxes - ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=*) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - !------------------------------------------------------------------------ - - if (carbon_type == 'c12') then - call this%RestartBulkOnly(bounds, ncid, flag) - end if - - call this%RestartAllIsotopes(bounds, ncid, flag) - - end subroutine Restart - - - !----------------------------------------------------------------------- - subroutine RestartBulkOnly ( this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon fluxes - fields only present for bulk C - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_time_manager , only : is_restart - use clm_varcon , only : c13ratio, c14ratio - use clm_varctl , only : use_lch4 - use CNSharedParamsMod, only : use_fun - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !------------------------------------------------------------------------ - - if (use_crop) then - - call restartvar(ncid=ncid, flag=flag, varname='grainc_xfer_to_grainc', xtype=ncd_double, & - dim1name='pft', & - long_name='grain C growth from storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_to_grainc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='live stem C litterfall', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_to_litter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_to_food', xtype=ncd_double, & - dim1name='pft', & - long_name='grain C to food', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_to_food_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain C', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_to_grainc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_to_grainc_storage', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain C storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_to_grainc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_grain_gr', xtype=ncd_double, & - dim1name='pft', & - long_name='grain growth respiration', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_grain_gr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool_grain_storage_gr', xtype=ncd_double, & - dim1name='pft', & - long_name='grain growth respiration to storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_grain_storage_gr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='transfer_grain_gr', xtype=ncd_double, & - dim1name='pft', & - long_name='grain growth respiration from storage', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%transfer_grain_gr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_storage_to_xfer', xtype=ncd_double, & - dim1name='pft', & - long_name='grain C shift storage to transfer', units='gC/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_to_xfer_patch) - - end if - - call restartvar(ncid=ncid, flag=flag, varname='gpp_pepv', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gpp_before_downreg_patch) - - call restartvar(ncid=ncid, flag=flag, varname='availc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%availc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_recover', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_recover_patch) - - call restartvar(ncid=ncid, flag=flag, varname='plant_calloc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_calloc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='excess_cflux', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%excess_cflux_patch) - - call restartvar(ncid=ncid, flag=flag, varname='prev_leafc_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prev_leafc_to_litter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='prev_frootc_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%prev_frootc_to_litter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempsum_npp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempsum_npp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_npp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_npp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='col_lag_npp', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%lag_npp_col) - - call restartvar(ncid=ncid, flag=flag, varname='cannsum_npp', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_npp_col) - - call restartvar(ncid=ncid, flag=flag, varname='tempsum_litfall', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempsum_litfall_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_litfall', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_litfall_patch) - - if ( use_fun ) then - call restartvar(ncid=ncid, flag=flag, varname='leafc_to_litter_fun', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_to_litter_fun_patch) - ! BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 - call set_missing_vals_to_constant(this%leafc_to_litter_fun_patch, 0._r8) - end if - - end subroutine RestartBulkOnly - - - !----------------------------------------------------------------------- - subroutine RestartAllIsotopes ( this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon fluxes - fields present for both bulk C and isotopes - ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - !----------------------------------------------------------------------- - - call this%dwt_conv_cflux_dribbler%Restart(bounds, ncid, flag) - call this%hrv_xsmrpool_to_atm_dribbler%Restart(bounds, ncid, flag) - - end subroutine RestartAllIsotopes - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon state fluxes - ! - ! !ARGUMENTS: - class (cnveg_carbonflux_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k,l ! indices - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i = filter_patch(fi) - - this%m_leafc_to_litter_patch(i) = value_patch - this%m_frootc_to_litter_patch(i) = value_patch - this%m_leafc_storage_to_litter_patch(i) = value_patch - this%m_frootc_storage_to_litter_patch(i) = value_patch - this%m_livestemc_storage_to_litter_patch(i) = value_patch - this%m_deadstemc_storage_to_litter_patch(i) = value_patch - this%m_livecrootc_storage_to_litter_patch(i) = value_patch - this%m_deadcrootc_storage_to_litter_patch(i) = value_patch - this%m_leafc_xfer_to_litter_patch(i) = value_patch - this%m_frootc_xfer_to_litter_patch(i) = value_patch - this%m_livestemc_xfer_to_litter_patch(i) = value_patch - this%m_deadstemc_xfer_to_litter_patch(i) = value_patch - this%m_livecrootc_xfer_to_litter_patch(i) = value_patch - this%m_deadcrootc_xfer_to_litter_patch(i) = value_patch - this%m_livestemc_to_litter_patch(i) = value_patch - this%m_deadstemc_to_litter_patch(i) = value_patch - this%m_livecrootc_to_litter_patch(i) = value_patch - this%m_deadcrootc_to_litter_patch(i) = value_patch - this%m_gresp_storage_to_litter_patch(i) = value_patch - this%m_gresp_xfer_to_litter_patch(i) = value_patch - this%hrv_leafc_to_litter_patch(i) = value_patch - this%hrv_leafc_storage_to_litter_patch(i) = value_patch - this%hrv_leafc_xfer_to_litter_patch(i) = value_patch - this%hrv_frootc_to_litter_patch(i) = value_patch - this%hrv_frootc_storage_to_litter_patch(i) = value_patch - this%hrv_frootc_xfer_to_litter_patch(i) = value_patch - this%hrv_livestemc_to_litter_patch(i) = value_patch - this%hrv_livestemc_storage_to_litter_patch(i) = value_patch - this%hrv_livestemc_xfer_to_litter_patch(i) = value_patch - this%hrv_deadstemc_storage_to_litter_patch(i) = value_patch - this%hrv_deadstemc_xfer_to_litter_patch(i) = value_patch - this%hrv_livecrootc_to_litter_patch(i) = value_patch - this%hrv_livecrootc_storage_to_litter_patch(i) = value_patch - this%hrv_livecrootc_xfer_to_litter_patch(i) = value_patch - this%hrv_deadcrootc_to_litter_patch(i) = value_patch - this%hrv_deadcrootc_storage_to_litter_patch(i) = value_patch - this%hrv_deadcrootc_xfer_to_litter_patch(i) = value_patch - this%hrv_gresp_storage_to_litter_patch(i) = value_patch - this%hrv_gresp_xfer_to_litter_patch(i) = value_patch - this%hrv_xsmrpool_to_atm_patch(i) = value_patch - - this%m_leafc_to_fire_patch(i) = value_patch - this%m_leafc_storage_to_fire_patch(i) = value_patch - this%m_leafc_xfer_to_fire_patch(i) = value_patch - this%m_livestemc_to_fire_patch(i) = value_patch - this%m_livestemc_storage_to_fire_patch(i) = value_patch - this%m_livestemc_xfer_to_fire_patch(i) = value_patch - this%m_deadstemc_to_fire_patch(i) = value_patch - this%m_deadstemc_storage_to_fire_patch(i) = value_patch - this%m_deadstemc_xfer_to_fire_patch(i) = value_patch - this%m_frootc_to_fire_patch(i) = value_patch - this%m_frootc_storage_to_fire_patch(i) = value_patch - this%m_frootc_xfer_to_fire_patch(i) = value_patch - this%m_livecrootc_to_fire_patch(i) = value_patch - this%m_livecrootc_storage_to_fire_patch(i) = value_patch - this%m_livecrootc_xfer_to_fire_patch(i) = value_patch - this%m_deadcrootc_to_fire_patch(i) = value_patch - this%m_deadcrootc_storage_to_fire_patch(i) = value_patch - this%m_deadcrootc_xfer_to_fire_patch(i) = value_patch - this%m_gresp_storage_to_fire_patch(i) = value_patch - this%m_gresp_xfer_to_fire_patch(i) = value_patch - - this%m_leafc_to_litter_fire_patch(i) = value_patch - this%m_leafc_storage_to_litter_fire_patch(i) = value_patch - this%m_leafc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemc_to_litter_fire_patch(i) = value_patch - this%m_livestemc_storage_to_litter_fire_patch(i) = value_patch - this%m_livestemc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemc_to_deadstemc_fire_patch(i) = value_patch - this%m_deadstemc_to_litter_fire_patch(i) = value_patch - this%m_deadstemc_storage_to_litter_fire_patch(i) = value_patch - this%m_deadstemc_xfer_to_litter_fire_patch(i) = value_patch - this%m_frootc_to_litter_fire_patch(i) = value_patch - this%m_frootc_storage_to_litter_fire_patch(i) = value_patch - this%m_frootc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_storage_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootc_to_deadcrootc_fire_patch(i) = value_patch - this%m_deadcrootc_to_litter_fire_patch(i) = value_patch - this%m_deadcrootc_storage_to_litter_fire_patch(i) = value_patch - this%m_deadcrootc_xfer_to_litter_fire_patch(i) = value_patch - this%m_gresp_storage_to_litter_fire_patch(i) = value_patch - this%m_gresp_xfer_to_litter_fire_patch(i) = value_patch - - this%leafc_xfer_to_leafc_patch(i) = value_patch - this%frootc_xfer_to_frootc_patch(i) = value_patch - this%livestemc_xfer_to_livestemc_patch(i) = value_patch - this%deadstemc_xfer_to_deadstemc_patch(i) = value_patch - this%livecrootc_xfer_to_livecrootc_patch(i) = value_patch - this%deadcrootc_xfer_to_deadcrootc_patch(i) = value_patch - this%leafc_to_litter_patch(i) = value_patch - this%frootc_to_litter_patch(i) = value_patch - this%cpool_to_resp_patch(i) = value_patch - this%cpool_to_leafc_resp_patch(i) = value_patch - this%cpool_to_leafc_storage_resp_patch(i) = value_patch - this%cpool_to_frootc_resp_patch(i) = value_patch - this%cpool_to_frootc_storage_resp_patch(i) = value_patch - this%cpool_to_livecrootc_resp_patch(i) = value_patch - this%cpool_to_livecrootc_storage_resp_patch(i) = value_patch - this%cpool_to_livestemc_resp_patch(i) = value_patch - this%cpool_to_livestemc_storage_resp_patch(i) = value_patch - this%leaf_mr_patch(i) = value_patch - this%froot_mr_patch(i) = value_patch - this%livestem_mr_patch(i) = value_patch - this%livecroot_mr_patch(i) = value_patch - this%grain_mr_patch(i) = value_patch - this%leaf_curmr_patch(i) = value_patch - this%froot_curmr_patch(i) = value_patch - this%livestem_curmr_patch(i) = value_patch - this%livecroot_curmr_patch(i) = value_patch - this%grain_curmr_patch(i) = value_patch - this%leaf_xsmr_patch(i) = value_patch - this%froot_xsmr_patch(i) = value_patch - this%livestem_xsmr_patch(i) = value_patch - this%livecroot_xsmr_patch(i) = value_patch - this%grain_xsmr_patch(i) = value_patch - this%psnsun_to_cpool_patch(i) = value_patch - this%psnshade_to_cpool_patch(i) = value_patch - this%cpool_to_xsmrpool_patch(i) = value_patch - this%cpool_to_leafc_patch(i) = value_patch - this%cpool_to_leafc_storage_patch(i) = value_patch - this%cpool_to_frootc_patch(i) = value_patch - this%cpool_to_frootc_storage_patch(i) = value_patch - this%cpool_to_livestemc_patch(i) = value_patch - this%cpool_to_livestemc_storage_patch(i) = value_patch - this%cpool_to_deadstemc_patch(i) = value_patch - this%cpool_to_deadstemc_storage_patch(i) = value_patch - this%cpool_to_livecrootc_patch(i) = value_patch - this%cpool_to_livecrootc_storage_patch(i) = value_patch - this%cpool_to_deadcrootc_patch(i) = value_patch - this%cpool_to_deadcrootc_storage_patch(i) = value_patch - this%cpool_to_gresp_storage_patch(i) = value_patch - this%cpool_leaf_gr_patch(i) = value_patch - this%cpool_leaf_storage_gr_patch(i) = value_patch - this%transfer_leaf_gr_patch(i) = value_patch - this%cpool_froot_gr_patch(i) = value_patch - this%cpool_froot_storage_gr_patch(i) = value_patch - this%transfer_froot_gr_patch(i) = value_patch - this%cpool_livestem_gr_patch(i) = value_patch - this%cpool_livestem_storage_gr_patch(i) = value_patch - this%transfer_livestem_gr_patch(i) = value_patch - this%cpool_deadstem_gr_patch(i) = value_patch - this%cpool_deadstem_storage_gr_patch(i) = value_patch - this%transfer_deadstem_gr_patch(i) = value_patch - this%cpool_livecroot_gr_patch(i) = value_patch - this%cpool_livecroot_storage_gr_patch(i) = value_patch - this%transfer_livecroot_gr_patch(i) = value_patch - this%cpool_deadcroot_gr_patch(i) = value_patch - this%cpool_deadcroot_storage_gr_patch(i) = value_patch - this%transfer_deadcroot_gr_patch(i) = value_patch - this%leafc_storage_to_xfer_patch(i) = value_patch - this%frootc_storage_to_xfer_patch(i) = value_patch - this%livestemc_storage_to_xfer_patch(i) = value_patch - this%deadstemc_storage_to_xfer_patch(i) = value_patch - this%livecrootc_storage_to_xfer_patch(i) = value_patch - this%deadcrootc_storage_to_xfer_patch(i) = value_patch - this%gresp_storage_to_xfer_patch(i) = value_patch - this%livestemc_to_deadstemc_patch(i) = value_patch - this%livecrootc_to_deadcrootc_patch(i) = value_patch - - this%current_gr_patch(i) = value_patch - this%transfer_gr_patch(i) = value_patch - this%storage_gr_patch(i) = value_patch - this%frootc_alloc_patch(i) = value_patch - this%frootc_loss_patch(i) = value_patch - this%leafc_alloc_patch(i) = value_patch - this%leafc_loss_patch(i) = value_patch - this%woodc_alloc_patch(i) = value_patch - this%woodc_loss_patch(i) = value_patch - - this%crop_seedc_to_leaf_patch(i) = value_patch - this%grainc_to_cropprodc_patch(i) = value_patch - end do - - if ( use_crop )then - do fi = 1,num_patch - i = filter_patch(fi) - this%xsmrpool_to_atm_patch(i) = value_patch - this%livestemc_to_litter_patch(i) = value_patch - this%grainc_to_food_patch(i) = value_patch - this%grainc_to_seed_patch(i) = value_patch - this%grainc_xfer_to_grainc_patch(i) = value_patch - this%cpool_to_grainc_patch(i) = value_patch - this%cpool_to_grainc_storage_patch(i) = value_patch - this%cpool_grain_gr_patch(i) = value_patch - this%cpool_grain_storage_gr_patch(i) = value_patch - this%transfer_grain_gr_patch(i) = value_patch - this%grainc_storage_to_xfer_patch(i) = value_patch - end do - end if - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - - this%phenology_c_to_litr_met_c_col(i,j) = value_column - this%phenology_c_to_litr_cel_c_col(i,j) = value_column - this%phenology_c_to_litr_lig_c_col(i,j) = value_column - - this%gap_mortality_c_to_litr_met_c_col(i,j) = value_column - this%gap_mortality_c_to_litr_cel_c_col(i,j) = value_column - this%gap_mortality_c_to_litr_lig_c_col(i,j) = value_column - this%gap_mortality_c_to_cwdc_col(i,j) = value_column - - this%fire_mortality_c_to_cwdc_col(i,j) = value_column - this%m_c_to_litr_met_fire_col(i,j) = value_column - this%m_c_to_litr_cel_fire_col(i,j) = value_column - this%m_c_to_litr_lig_fire_col(i,j) = value_column - - this%harvest_c_to_litr_met_c_col(i,j) = value_column - this%harvest_c_to_litr_cel_c_col(i,j) = value_column - this%harvest_c_to_litr_lig_c_col(i,j) = value_column - this%harvest_c_to_cwdc_col(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_col(i,j,k) = value_column - end do - end do - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_cpools_to_fire_col(i,k) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%grainc_to_cropprodc_col(i) = value_column - this%cwdc_hr_col(i) = value_column - this%cwdc_loss_col(i) = value_column - this%litterc_loss_col(i) = value_column - end do - - do fi = 1,num_patch - i = filter_patch(fi) - - this%gpp_patch(i) = value_patch - this%mr_patch(i) = value_patch - this%gr_patch(i) = value_patch - this%ar_patch(i) = value_patch - this%rr_patch(i) = value_patch - this%npp_patch(i) = value_patch - this%agnpp_patch(i) = value_patch - this%bgnpp_patch(i) = value_patch - this%litfall_patch(i) = value_patch - this%wood_harvestc_patch(i) = value_patch - this%slash_harvestc_patch(i) = value_patch - this%cinputs_patch(i) = value_patch - this%coutputs_patch(i) = value_patch - this%fire_closs_patch(i) = value_patch - this%npp_Nactive_patch(i) = value_patch - this%npp_burnedoff_patch(i) = value_patch - this%npp_Nnonmyc_patch(i) = value_patch - this%npp_Nam_patch(i) = value_patch - this%npp_Necm_patch(i) = value_patch - this%npp_Nactive_no3_patch(i) = value_patch - this%npp_Nactive_nh4_patch(i) = value_patch - this%npp_Nnonmyc_no3_patch(i) = value_patch - this%npp_Nnonmyc_nh4_patch(i) = value_patch - this%npp_Nam_no3_patch(i) = value_patch - this%npp_Nam_nh4_patch(i) = value_patch - this%npp_Necm_no3_patch(i) = value_patch - this%npp_Necm_nh4_patch(i) = value_patch - this%npp_Nfix_patch(i) = value_patch - this%npp_Nretrans_patch(i) = value_patch - this%npp_Nuptake_patch(i) = value_patch - this%npp_growth_patch(i) = value_patch - this%leafc_change_patch(i) = value_patch - this%soilc_change_patch(i) = value_patch - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%sr_col(i) = value_column - this%er_col(i) = value_column - this%litfire_col(i) = value_column - this%somfire_col(i) = value_column - this%totfire_col(i) = value_column - this%fire_closs_col(i) = value_column - - ! Zero p2c column fluxes - this%rr_col(i) = value_column - this%ar_col(i) = value_column - this%gpp_col(i) = value_column - this%npp_col(i) = value_column - this%fire_closs_col(i) = value_column - this%wood_harvestc_col(i) = value_column - this%hrv_xsmrpool_to_atm_col(i) = value_column - - this%nep_col(i) = value_column - - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine ZeroDwt( this, bounds ) - ! - ! !DESCRIPTION - ! Initialize flux variables needed for dynamic land use. - ! - ! !ARGUMENTS: - class(cnveg_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c, g, j ! indices - !----------------------------------------------------------------------- - - ! set conversion and product pool fluxes to 0 at the beginning of every timestep - - do g = bounds%begg, bounds%endg - this%dwt_seedc_to_leaf_grc(g) = 0._r8 - this%dwt_seedc_to_deadstem_grc(g) = 0._r8 - this%dwt_conv_cflux_grc(g) = 0._r8 - end do - - do c = bounds%begc,bounds%endc - this%dwt_slash_cflux_col(c) = 0._r8 - end do - - do j = 1, nlevdecomp_full - do c = bounds%begc,bounds%endc - this%dwt_frootc_to_litr_met_c_col(c,j) = 0._r8 - this%dwt_frootc_to_litr_cel_c_col(c,j) = 0._r8 - this%dwt_frootc_to_litr_lig_c_col(c,j) = 0._r8 - this%dwt_livecrootc_to_cwdc_col(c,j) = 0._r8 - this%dwt_deadcrootc_to_cwdc_col(c,j) = 0._r8 - end do - end do - - end subroutine ZeroDwt - - !----------------------------------------------------------------------- - subroutine Summary_carbonflux(this, & - bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - isotope, soilbiogeochem_hr_col, soilbiogeochem_lithr_col, & - soilbiogeochem_decomp_cascade_ctransfer_col, & - product_closs_grc) - ! - ! !DESCRIPTION: - ! Perform patch and column-level carbon summary calculations - ! - ! !USES: - use clm_time_manager , only: get_step_size - use clm_varcon , only: secspday - use clm_varctl , only: nfix_timeconst, carbon_resp_opt - use subgridAveMod , only: p2c, c2g - use SoilBiogeochemDecompCascadeConType , only: decomp_cascade_con - use CNSharedParamsMod , only: use_fun - ! - ! !ARGUMENTS: - class(cnveg_carbonflux_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 - character(len=*) , intent(in) :: isotope - real(r8) , intent(in) :: soilbiogeochem_hr_col(bounds%begc:) - real(r8) , intent(in) :: soilbiogeochem_lithr_col(bounds%begc:) - real(r8) , intent(in) :: soilbiogeochem_decomp_cascade_ctransfer_col(bounds%begc:,1:) - real(r8) , intent(in) :: product_closs_grc(bounds%begg:) - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,k,l,g ! indices - integer :: fp,fc ! lake filter indices - real(r8) :: nfixlags, dtime ! temp variables for making lagged npp - real(r8) :: maxdepth ! depth to integrate soil variables - real(r8) :: nep_grc(bounds%begg:bounds%endg) ! nep_col averaged to gridcell - real(r8) :: fire_closs_grc(bounds%begg:bounds%endg) ! fire_closs_col averaged to gridcell - real(r8) :: hrv_xsmrpool_to_atm_grc(bounds%begg:bounds%endg) ! hrv_xsmrpool_to_atm_col averaged to gridcell (gC/m2/s) - real(r8) :: hrv_xsmrpool_to_atm_delta_grc(bounds%begg:bounds%endg) ! hrv_xsmrpool_to_atm_col averaged to gridcell, expressed as a delta (not a flux) (gC/m2) - real(r8) :: hrv_xsmrpool_to_atm_dribbled_grc(bounds%begg:bounds%endg) ! hrv_xsmrpool_to_atm, dribbled over the year (gC/m2/s) - real(r8) :: dwt_conv_cflux_delta_grc(bounds%begg:bounds%endg) ! dwt_conv_cflux_grc expressed as a total delta (not a flux) (gC/m2) - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(product_closs_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - ! calculate patch-level summary carbon fluxes and states - - dtime = get_step_size() - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! maintenance respiration (MR) - if ( trim(isotope) == 'c13' .or. trim(isotope) == 'c14') then - this%leaf_mr_patch(p) = this%leaf_curmr_patch(p) + this%leaf_xsmr_patch(p) - this%froot_mr_patch(p) = this%froot_curmr_patch(p) + this%froot_xsmr_patch(p) - this%livestem_mr_patch(p) = this%livestem_curmr_patch(p) + this%livestem_xsmr_patch(p) - this%livecroot_mr_patch(p) = this%livecroot_curmr_patch(p) + this%livecroot_xsmr_patch(p) - endif - - this%mr_patch(p) = & - this%leaf_mr_patch(p) + & - this%froot_mr_patch(p) + & - this%livestem_mr_patch(p) + & - this%livecroot_mr_patch(p) - - if (carbon_resp_opt == 1) then - this%mr_patch(p) = & - this%cpool_to_resp_patch(p) + & - this%leaf_mr_patch(p) + & - this%froot_mr_patch(p) + & - this%livestem_mr_patch(p) + & - this%livecroot_mr_patch(p) - end if - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%mr_patch(p) = & - this%mr_patch(p) + & - this%grain_mr_patch(p) - end if - - ! growth respiration (GR) - - ! current GR is respired this time step for new growth displayed in this timestep - this%current_gr_patch(p) = & - this%cpool_leaf_gr_patch(p) + & - this%cpool_froot_gr_patch(p) + & - this%cpool_livestem_gr_patch(p) + & - this%cpool_deadstem_gr_patch(p) + & - this%cpool_livecroot_gr_patch(p) + & - this%cpool_deadcroot_gr_patch(p) - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%current_gr_patch(p) = this%current_gr_patch(p) + & - this%cpool_grain_gr_patch(p) - end if - - - ! transfer GR is respired this time step for transfer growth displayed in this timestep - this%transfer_gr_patch(p) = & - this%transfer_leaf_gr_patch(p) + & - this%transfer_froot_gr_patch(p) + & - this%transfer_livestem_gr_patch(p) + & - this%transfer_deadstem_gr_patch(p) + & - this%transfer_livecroot_gr_patch(p) + & - this%transfer_deadcroot_gr_patch(p) - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%transfer_gr_patch(p) = this%transfer_gr_patch(p) + & - this%transfer_grain_gr_patch(p) - end if - - ! storage GR is respired this time step for growth sent to storage for later display - this%storage_gr_patch(p) = & - this%cpool_leaf_storage_gr_patch(p) + & - this%cpool_froot_storage_gr_patch(p) + & - this%cpool_livestem_storage_gr_patch(p) + & - this%cpool_deadstem_storage_gr_patch(p) + & - this%cpool_livecroot_storage_gr_patch(p) + & - this%cpool_deadcroot_storage_gr_patch(p) - - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%storage_gr_patch(p) = this%storage_gr_patch(p) + & - this%cpool_grain_storage_gr_patch(p) - end if - - ! GR is the sum of current + transfer + storage GR - this%gr_patch(p) = & - this%current_gr_patch(p) + & - this%transfer_gr_patch(p) + & - this%storage_gr_patch(p) - - ! autotrophic respiration (AR) adn - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%ar_patch(p) = & - this%mr_patch(p) + & - this%gr_patch(p) + & - this%xsmrpool_to_atm_patch(p) ! xsmr... is -ve (slevis) - else - this%ar_patch(p) = & - this%mr_patch(p) + & - this%gr_patch(p) - end if - - if (use_fun) then - this%ar_patch(p) = this%ar_patch(p) + this%soilc_change_patch(p) - end if - - ! gross primary production (GPP) - this%gpp_patch(p) = & - this%psnsun_to_cpool_patch(p) + & - this%psnshade_to_cpool_patch(p) - - ! net primary production (NPP) - this%npp_patch(p) = & - this%gpp_patch(p) - & - this%ar_patch(p) - - ! root respiration (RR) - this%rr_patch(p) = & - this%froot_mr_patch(p) + & - this%cpool_froot_gr_patch(p) + & - this%cpool_livecroot_gr_patch(p) + & - this%cpool_deadcroot_gr_patch(p) + & - this%transfer_froot_gr_patch(p) + & - this%transfer_livecroot_gr_patch(p) + & - this%transfer_deadcroot_gr_patch(p) + & - this%cpool_froot_storage_gr_patch(p) + & - this%cpool_livecroot_storage_gr_patch(p) + & - this%cpool_deadcroot_storage_gr_patch(p) - - ! update the annual NPP accumulator, for use in allocation code - if (trim(isotope) == 'bulk') then - this%tempsum_npp_patch(p) = & - this%tempsum_npp_patch(p) + & - this%npp_patch(p) - end if - - ! aboveground NPP: leaf, live stem, dead stem (AGNPP) - ! This is supposed to correspond as closely as possible to - ! field measurements of AGNPP, so it ignores the storage pools - ! and only treats the fluxes into displayed pools. - - this%agnpp_patch(p) = & - this%cpool_to_leafc_patch(p) + & - this%leafc_xfer_to_leafc_patch(p) + & - this%cpool_to_livestemc_patch(p) + & - this%livestemc_xfer_to_livestemc_patch(p) + & - this%cpool_to_deadstemc_patch(p) + & - this%deadstemc_xfer_to_deadstemc_patch(p) - - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%agnpp_patch(p) = & - this%agnpp_patch(p) + & - this%cpool_to_grainc_patch(p) + & - this%grainc_xfer_to_grainc_patch(p) - end if - - ! belowground NPP: fine root, live coarse root, dead coarse root (BGNPP) - ! This is supposed to correspond as closely as possible to - ! field measurements of BGNPP, so it ignores the storage pools - ! and only treats the fluxes into displayed pools. - - this%bgnpp_patch(p) = & - this%cpool_to_frootc_patch(p) + & - this%frootc_xfer_to_frootc_patch(p) + & - this%cpool_to_livecrootc_patch(p) + & - this%livecrootc_xfer_to_livecrootc_patch(p) + & - this%cpool_to_deadcrootc_patch(p) + & - this%deadcrootc_xfer_to_deadcrootc_patch(p) - - ! litterfall (LITFALL) - - this%litfall_patch(p) = & - this%leafc_to_litter_patch(p) + & - this%frootc_to_litter_patch(p) + & - this%m_leafc_to_litter_patch(p) + & - this%m_leafc_storage_to_litter_patch(p) + & - this%m_leafc_xfer_to_litter_patch(p) + & - this%m_frootc_to_litter_patch(p) + & - this%m_frootc_storage_to_litter_patch(p) + & - this%m_frootc_xfer_to_litter_patch(p) + & - this%m_livestemc_to_litter_patch(p) + & - this%m_livestemc_storage_to_litter_patch(p) + & - this%m_livestemc_xfer_to_litter_patch(p) + & - this%m_deadstemc_to_litter_patch(p) + & - this%m_deadstemc_storage_to_litter_patch(p) + & - this%m_deadstemc_xfer_to_litter_patch(p) + & - this%m_livecrootc_to_litter_patch(p) + & - this%m_livecrootc_storage_to_litter_patch(p) + & - this%m_livecrootc_xfer_to_litter_patch(p) + & - this%m_deadcrootc_to_litter_patch(p) + & - this%m_deadcrootc_storage_to_litter_patch(p) + & - this%m_deadcrootc_xfer_to_litter_patch(p) + & - this%m_gresp_storage_to_litter_patch(p) + & - this%m_gresp_xfer_to_litter_patch(p) + & - - this%m_leafc_to_litter_fire_patch(p) + & - this%m_leafc_storage_to_litter_fire_patch(p) + & - this%m_leafc_xfer_to_litter_fire_patch(p) + & - this%m_livestemc_to_litter_fire_patch(p) + & - this%m_livestemc_storage_to_litter_fire_patch(p) + & - this%m_livestemc_xfer_to_litter_fire_patch(p) + & - this%m_deadstemc_to_litter_fire_patch(p) + & - this%m_deadstemc_storage_to_litter_fire_patch(p) + & - this%m_deadstemc_xfer_to_litter_fire_patch(p) + & - this%m_frootc_to_litter_fire_patch(p) + & - this%m_frootc_storage_to_litter_fire_patch(p) + & - this%m_frootc_xfer_to_litter_fire_patch(p) + & - this%m_livecrootc_to_litter_fire_patch(p) + & - this%m_livecrootc_storage_to_litter_fire_patch(p) + & - this%m_livecrootc_xfer_to_litter_fire_patch(p) + & - this%m_deadcrootc_to_litter_fire_patch(p) + & - this%m_deadcrootc_storage_to_litter_fire_patch(p) + & - this%m_deadcrootc_xfer_to_litter_fire_patch(p) + & - this%m_gresp_storage_to_litter_fire_patch(p) + & - this%m_gresp_xfer_to_litter_fire_patch(p) + & - - this%hrv_leafc_to_litter_patch(p) + & - this%hrv_leafc_storage_to_litter_patch(p) + & - this%hrv_leafc_xfer_to_litter_patch(p) + & - this%hrv_frootc_to_litter_patch(p) + & - this%hrv_frootc_storage_to_litter_patch(p) + & - this%hrv_frootc_xfer_to_litter_patch(p) + & - this%hrv_livestemc_to_litter_patch(p) + & - this%hrv_livestemc_storage_to_litter_patch(p) + & - this%hrv_livestemc_xfer_to_litter_patch(p) + & - this%hrv_deadstemc_storage_to_litter_patch(p) + & - this%hrv_deadstemc_xfer_to_litter_patch(p) + & - this%hrv_livecrootc_to_litter_patch(p) + & - this%hrv_livecrootc_storage_to_litter_patch(p) + & - this%hrv_livecrootc_xfer_to_litter_patch(p) + & - this%hrv_deadcrootc_to_litter_patch(p) + & - this%hrv_deadcrootc_storage_to_litter_patch(p) + & - this%hrv_deadcrootc_xfer_to_litter_patch(p) + & - this%hrv_gresp_storage_to_litter_patch(p) + & - this%hrv_gresp_xfer_to_litter_patch(p) - - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%litfall_patch(p) = & - this%litfall_patch(p) + & - this%livestemc_to_litter_patch(p) - - if (.not. use_grainproduct) then - this%litfall_patch(p) = & - this%litfall_patch(p) + & - this%grainc_to_food_patch(p) - end if - end if - - ! update the annual litfall accumulator, for use in mortality code - - if (use_cndv) then - this%tempsum_litfall_patch(p) = & - this%tempsum_litfall_patch(p) + & - this%leafc_to_litter_patch(p) + & - this%frootc_to_litter_patch(p) - end if - - ! patch-level carbon losses to fire changed by F. Li and S. Levis - - this%fire_closs_patch(p) = & - this%m_leafc_to_fire_patch(p) + & - this%m_leafc_storage_to_fire_patch(p) + & - this%m_leafc_xfer_to_fire_patch(p) + & - this%m_frootc_to_fire_patch(p) + & - this%m_frootc_storage_to_fire_patch(p) + & - this%m_frootc_xfer_to_fire_patch(p) + & - this%m_livestemc_to_fire_patch(p) + & - this%m_livestemc_storage_to_fire_patch(p) + & - this%m_livestemc_xfer_to_fire_patch(p) + & - this%m_deadstemc_to_fire_patch(p) + & - this%m_deadstemc_storage_to_fire_patch(p) + & - this%m_deadstemc_xfer_to_fire_patch(p) + & - this%m_livecrootc_to_fire_patch(p) + & - this%m_livecrootc_storage_to_fire_patch(p) + & - this%m_livecrootc_xfer_to_fire_patch(p) + & - this%m_deadcrootc_to_fire_patch(p) + & - this%m_deadcrootc_storage_to_fire_patch(p) + & - this%m_deadcrootc_xfer_to_fire_patch(p) + & - this%m_gresp_storage_to_fire_patch(p) + & - this%m_gresp_xfer_to_fire_patch(p) - - ! new summary variables for CLAMP - - ! (FROOTC_ALLOC) - fine root C allocation - this%frootc_alloc_patch(p) = & - this%frootc_xfer_to_frootc_patch(p) + & - this%cpool_to_frootc_patch(p) - - ! (FROOTC_LOSS) - fine root C loss changed by F. Li and S. Levis - this%frootc_loss_patch(p) = & - this%m_frootc_to_litter_patch(p) + & - this%m_frootc_to_fire_patch(p) + & - this%m_frootc_to_litter_fire_patch(p) + & - this%hrv_frootc_to_litter_patch(p) + & - this%frootc_to_litter_patch(p) - - ! (LEAFC_ALLOC) - leaf C allocation - this%leafc_alloc_patch(p) = & - this%leafc_xfer_to_leafc_patch(p) + & - this%cpool_to_leafc_patch(p) - - ! (LEAFC_LOSS) - leaf C loss changed by F. Li and S. Levis - this%leafc_loss_patch(p) = & - this%m_leafc_to_litter_patch(p) + & - this%m_leafc_to_fire_patch(p) + & - this%m_leafc_to_litter_fire_patch(p) + & - this%hrv_leafc_to_litter_patch(p) + & - this%leafc_to_litter_patch(p) - - ! (WOODC_ALLOC) - wood C allocation - this%woodc_alloc_patch(p) = & - this%livestemc_xfer_to_livestemc_patch(p) + & - this%deadstemc_xfer_to_deadstemc_patch(p) + & - this%livecrootc_xfer_to_livecrootc_patch(p) + & - this%deadcrootc_xfer_to_deadcrootc_patch(p) + & - this%cpool_to_livestemc_patch(p) + & - this%cpool_to_deadstemc_patch(p) + & - this%cpool_to_livecrootc_patch(p) + & - this%cpool_to_deadcrootc_patch(p) - - ! (WOODC_LOSS) - wood C loss - this%woodc_loss_patch(p) = & - this%m_livestemc_to_litter_patch(p) + & - this%m_deadstemc_to_litter_patch(p) + & - this%m_livecrootc_to_litter_patch(p) + & - this%m_deadcrootc_to_litter_patch(p) + & - this%m_livestemc_to_fire_patch(p) + & - this%m_deadstemc_to_fire_patch(p) + & - this%m_livecrootc_to_fire_patch(p) + & - this%m_deadcrootc_to_fire_patch(p) + & - this%hrv_livestemc_to_litter_patch(p) + & - this%hrv_livestemc_storage_to_litter_patch(p) + & - this%hrv_livestemc_xfer_to_litter_patch(p) + & - this%wood_harvestc_patch(p) + & - this%hrv_deadstemc_storage_to_litter_patch(p) + & - this%hrv_deadstemc_xfer_to_litter_patch(p) + & - this%hrv_livecrootc_to_litter_patch(p) + & - this%hrv_livecrootc_storage_to_litter_patch(p) + & - this%hrv_livecrootc_xfer_to_litter_patch(p) + & - this%hrv_deadcrootc_to_litter_patch(p) + & - this%hrv_deadcrootc_storage_to_litter_patch(p) + & - this%hrv_deadcrootc_xfer_to_litter_patch(p) - - ! (Slash Harvest Flux) - Additional Wood Harvest Veg C Losses - this%slash_harvestc_patch(p) = & - this%hrv_leafc_to_litter_patch(p) + & - this%hrv_leafc_storage_to_litter_patch(p) + & - this%hrv_leafc_xfer_to_litter_patch(p) + & - this%hrv_frootc_to_litter_patch(p) + & - this%hrv_frootc_storage_to_litter_patch(p) + & - this%hrv_frootc_xfer_to_litter_patch(p) + & - this%hrv_livestemc_to_litter_patch(p) + & - this%hrv_livestemc_storage_to_litter_patch(p) + & - this%hrv_livestemc_xfer_to_litter_patch(p) + & - this%hrv_deadstemc_storage_to_litter_patch(p) + & - this%hrv_deadstemc_xfer_to_litter_patch(p) + & - this%hrv_livecrootc_to_litter_patch(p) + & - this%hrv_livecrootc_storage_to_litter_patch(p) + & - this%hrv_livecrootc_xfer_to_litter_patch(p) + & - this%hrv_deadcrootc_to_litter_patch(p) + & - this%hrv_deadcrootc_storage_to_litter_patch(p) + & - this%hrv_deadcrootc_xfer_to_litter_patch(p) + & - this%hrv_xsmrpool_to_atm_patch(p) + & - this%hrv_gresp_storage_to_litter_patch(p) + & - this%hrv_gresp_xfer_to_litter_patch(p) - - end do ! end of patches loop - - !------------------------------------------------ - ! column variables - !------------------------------------------------ - - ! use p2c routine to get selected column-average patch-level fluxes and states - - call p2c(bounds, num_soilc, filter_soilc, & - this%hrv_xsmrpool_to_atm_patch(bounds%begp:bounds%endp), & - this%hrv_xsmrpool_to_atm_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%fire_closs_patch(bounds%begp:bounds%endp), & - this%fire_closs_p2c_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%npp_patch(bounds%begp:bounds%endp), & - this%npp_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%rr_patch(bounds%begp:bounds%endp), & - this%rr_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%ar_patch(bounds%begp:bounds%endp), & - this%ar_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%gpp_patch(bounds%begp:bounds%endp), & - this%gpp_col(bounds%begc:bounds%endc)) - - ! this code is to calculate an exponentially-relaxed npp value for use in NDynamics code - - if ( trim(isotope) == 'bulk') then - if (nfix_timeconst > 0._r8 .and. nfix_timeconst < 500._r8 ) then - nfixlags = nfix_timeconst * secspday - do fc = 1,num_soilc - c = filter_soilc(fc) - if ( this%lag_npp_col(c) /= spval ) then - this%lag_npp_col(c) = & - this%lag_npp_col(c) * exp(-dtime/nfixlags) + & - this%npp_col(c) * (1._r8 - exp(-dtime/nfixlags)) - else - ! first timestep - this%lag_npp_col(c) = this%npp_col(c) - endif - end do - endif - endif - - - ! vertically integrate column-level carbon fire losses - do l = 1, ndecomp_pools - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%m_decomp_cpools_to_fire_col(c,l) = & - this%m_decomp_cpools_to_fire_col(c,l) + & - this%m_decomp_cpools_to_fire_vr_col(c,j,l)*dzsoi_decomp(j) - end do - end do - end do - - do fc = 1,num_soilc - c = filter_soilc(fc) - - g = col%gridcell(c) - - ! litter fire losses (LITFIRE) - this%litfire_col(c) = 0._r8 - - ! soil organic matter fire losses (SOMFIRE) - this%somfire_col(c) = 0._r8 - - ! total ecosystem fire losses (TOTFIRE) - this%totfire_col(c) = & - this%litfire_col(c) + & - this%somfire_col(c) - - ! carbon losses to fire, including patch losses - this%fire_closs_col(c) = this%fire_closs_p2c_col(c) - do l = 1, ndecomp_pools - this%fire_closs_col(c) = & - this%fire_closs_col(c) + & - this%m_decomp_cpools_to_fire_col(c,l) - end do - - ! total soil respiration, heterotrophic + root respiration (SR) - this%sr_col(c) = & - this%rr_col(c) + & - soilbiogeochem_hr_col(c) - - ! total ecosystem respiration, autotrophic + heterotrophic (ER) - this%er_col(c) = & - this%ar_col(c) + & - soilbiogeochem_hr_col(c) - - ! coarse woody debris heterotrophic respiration - this%cwdc_hr_col(c) = 0._r8 - - ! net ecosystem production, excludes fire flux, landcover change, - ! and loss from wood products, positive for sink (NEP) - this%nep_col(c) = & - this%gpp_col(c) - & - this%er_col(c) - - end do - - call c2g( bounds = bounds, & - carr = this%nep_col(bounds%begc:bounds%endc), & - garr = nep_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - call c2g( bounds = bounds, & - carr = this%fire_closs_col(bounds%begc:bounds%endc), & - garr = fire_closs_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - call c2g( bounds = bounds, & - carr = this%hrv_xsmrpool_to_atm_col(bounds%begc:bounds%endc), & - garr = hrv_xsmrpool_to_atm_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - hrv_xsmrpool_to_atm_delta_grc(bounds%begg:bounds%endg) = & - hrv_xsmrpool_to_atm_grc(bounds%begg:bounds%endg) * dtime - call this%hrv_xsmrpool_to_atm_dribbler%set_curr_delta(bounds, & - hrv_xsmrpool_to_atm_delta_grc(bounds%begg:bounds%endg)) - call this%hrv_xsmrpool_to_atm_dribbler%get_curr_flux(bounds, & - hrv_xsmrpool_to_atm_dribbled_grc(bounds%begg:bounds%endg)) - - dwt_conv_cflux_delta_grc(bounds%begg:bounds%endg) = & - this%dwt_conv_cflux_grc(bounds%begg:bounds%endg) * dtime - call this%dwt_conv_cflux_dribbler%set_curr_delta(bounds, & - dwt_conv_cflux_delta_grc(bounds%begg:bounds%endg)) - call this%dwt_conv_cflux_dribbler%get_curr_flux(bounds, & - this%dwt_conv_cflux_dribbled_grc(bounds%begg:bounds%endg)) - - do g = bounds%begg, bounds%endg - ! net ecosystem exchange of carbon, includes fire flux and hrv_xsmrpool flux, - ! positive for source (NEE) - this%nee_grc(g) = & - -nep_grc(g) + & - fire_closs_grc(g) + & - hrv_xsmrpool_to_atm_dribbled_grc(g) - - this%landuseflux_grc(g) = & - this%dwt_conv_cflux_dribbled_grc(g) + & - product_closs_grc(g) - - ! net biome production of carbon, positive for sink - this%nbp_grc(g) = & - -this%nee_grc(g) - & - this%landuseflux_grc(g) - end do - - ! coarse woody debris C loss - do fc = 1,num_soilc - c = filter_soilc(fc) - this%cwdc_loss_col(c) = 0._r8 - end do - associate(is_cwd => decomp_cascade_con%is_cwd) ! TRUE => pool is a cwd pool - do l = 1, ndecomp_pools - if ( is_cwd(l) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%cwdc_loss_col(c) = & - this%cwdc_loss_col(c) + & - this%m_decomp_cpools_to_fire_col(c,l) - end do - end if - end do - do k = 1, ndecomp_cascade_transitions - if ( is_cwd(decomp_cascade_con%cascade_donor_pool(k)) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%cwdc_loss_col(c) = & - this%cwdc_loss_col(c) + & - soilbiogeochem_decomp_cascade_ctransfer_col(c,k) - end do - end if - end do - end associate - - - ! litter C loss - do fc = 1,num_soilc - c = filter_soilc(fc) - this%litterc_loss_col(c) = soilbiogeochem_lithr_col(c) - end do - associate(is_litter => decomp_cascade_con%is_litter) ! TRUE => pool is a litter pool - do l = 1, ndecomp_pools - if ( is_litter(l) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%litterc_loss_col(c) = & - this%litterc_loss_col(c) + & - this%m_decomp_cpools_to_fire_col(c,l) - end do - end if - end do - do k = 1, ndecomp_cascade_transitions - if ( is_litter(decomp_cascade_con%cascade_donor_pool(k)) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%litterc_loss_col(c) = & - this%litterc_loss_col(c) + & - soilbiogeochem_decomp_cascade_ctransfer_col(c,k) - end do - end if - end do - end associate - - end subroutine Summary_carbonflux - -end module CNVegCarbonFluxType - - diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 deleted file mode 100644 index 41eb79134f..0000000000 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ /dev/null @@ -1,2743 +0,0 @@ -module CNVegCarbonStateType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_const_mod , only : SHR_CONST_PDB - use shr_log_mod , only : errMsg => shr_log_errMsg - use pftconMod , only : noveg, npcropmin, pftcon - use clm_varcon , only : spval, c3_r2, c4_r2, c14ratio - use clm_varctl , only : iulog, use_cndv, use_crop - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use CNSpeciesMod , only : species_from_string, CN_SPECIES_C12 - use dynPatchStateUpdaterMod, only : patch_state_updater_type - use CNVegComputeSeedMod, only : ComputeSeedAmounts - ! - ! !PUBLIC TYPES: - implicit none - private - ! - - type, public :: cnveg_carbonstate_type - - integer :: species ! c12, c13, c14 - - real(r8), pointer :: grainc_patch (:) ! (gC/m2) grain C (crop model) - real(r8), pointer :: grainc_storage_patch (:) ! (gC/m2) grain C storage (crop model) - real(r8), pointer :: grainc_xfer_patch (:) ! (gC/m2) grain C transfer (crop model) - real(r8), pointer :: leafc_patch (:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage_patch (:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer_patch (:) ! (gC/m2) leaf C transfer - real(r8), pointer :: leafc_storage_xfer_acc_patch (:) ! (gC/m2) Accmulated leaf C transfer - real(r8), pointer :: storage_cdemand_patch (:) ! (gC/m2) C use from the C storage pool - real(r8), pointer :: frootc_patch (:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage_patch (:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer_patch (:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_patch (:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage_patch (:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer_patch (:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_patch (:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage_patch (:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer_patch (:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_patch (:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage_patch (:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer_patch (:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_patch (:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage_patch (:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer_patch (:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: gresp_storage_patch (:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer_patch (:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: cpool_patch (:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool_patch (:) ! (gC/m2) abstract C pool to meet excess MR demand - real(r8), pointer :: ctrunc_patch (:) ! (gC/m2) patch-level sink for C truncation - real(r8), pointer :: woodc_patch (:) ! (gC/m2) wood C - real(r8), pointer :: leafcmax_patch (:) ! (gC/m2) ann max leaf C - real(r8), pointer :: totc_patch (:) ! (gC/m2) total patch-level carbon, including cpool - real(r8), pointer :: rootc_col (:) ! (gC/m2) root carbon at column level (fire) - real(r8), pointer :: leafc_col (:) ! (gC/m2) column-level leafc (fire) - real(r8), pointer :: deadstemc_col (:) ! (gC/m2) column-level deadstemc (fire) - real(r8), pointer :: fuelc_col (:) ! fuel load outside cropland - real(r8), pointer :: fuelc_crop_col (:) ! fuel load for cropland - real(r8), pointer :: cropseedc_deficit_patch (:) ! (gC/m2) pool for seeding new crop growth; this is a NEGATIVE term, indicating the amount of seed usage that needs to be repaid - - ! pools for dynamic landcover - real(r8), pointer :: seedc_grc (:) ! (gC/m2) gridcell-level pool for seeding new PFTs via dynamic landcover - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: dispvegc_patch (:) ! (gC/m2) displayed veg carbon, excluding storage and cpool - real(r8), pointer :: storvegc_patch (:) ! (gC/m2) stored vegetation carbon, excluding cpool - real(r8), pointer :: totvegc_patch (:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: totvegc_col (:) ! (gC/m2) total vegetation carbon, excluding cpool averaged to column (p2c) - - ! Total C pools - real(r8), pointer :: totc_p2c_col (:) ! (gC/m2) totc_patch averaged to col - real(r8), pointer :: totc_col (:) ! (gC/m2) total column carbon, incl veg and cpool - real(r8), pointer :: totecosysc_col (:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool - - contains - - procedure , public :: Init - procedure , public :: SetValues - procedure , public :: ZeroDWT - procedure , public :: Restart - procedure , public :: Summary => Summary_carbonstate - procedure , public :: DynamicPatchAdjustments ! adjust state variables when patch areas change - - procedure , private :: InitAllocate ! Allocate arrays - procedure , private :: InitReadNML ! Read in namelist - procedure , private :: InitHistory ! Initialize history - procedure , private :: InitCold ! Initialize arrays for a cold-start - - end type cnveg_carbonstate_type - - ! !PRIVATE DATA: - - type, private :: cnvegcarbonstate_const_type - ! !PRIVATE MEMBER DATA: - real(r8) :: initial_vegC = 20._r8 ! Initial vegetation carbon for leafc/frootc and storage - end type - type(cnvegcarbonstate_const_type), private :: cnvegcstate_const ! Constants used here - character(len=*), parameter :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type, ratio, NLFilename, & - c12_cnveg_carbonstate_inst) - - class(cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: ratio - character(len=*) , intent(in) :: carbon_type ! Carbon isotope type C12, C13 or C1 - character(len=*) , intent(in) :: NLFilename ! Namelist filename - type(cnveg_carbonstate_type) , intent(in), optional :: c12_cnveg_carbonstate_inst ! cnveg_carbonstate for C12 (if C13 or C14) - !----------------------------------------------------------------------- - - this%species = species_from_string(carbon_type) - - call this%InitAllocate ( bounds) - call this%InitReadNML ( NLFilename ) - call this%InitHistory ( bounds, carbon_type) - if (present(c12_cnveg_carbonstate_inst)) then - call this%InitCold ( bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst ) - else - call this%InitCold ( bounds, ratio, carbon_type ) - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitReadNML(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the namelist for CNVegCarbonState - ! - !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) :: this - character(len=*) , intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'InitReadNML' - character(len=*), parameter :: nmlname = 'cnvegcarbonstate' ! MUST match what is in namelist below - !----------------------------------------------------------------------- - real(r8) :: initial_vegC - namelist /cnvegcarbonstate/ initial_vegC - - initial_vegC = cnvegcstate_const%initial_vegC - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cnvegcarbonstate, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (initial_vegC , mpicom) - - cnvegcstate_const%initial_vegC = initial_vegC - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cnvegcarbonstate) ! Name here MUST be the same as in nmlname above! - write(iulog,*) ' ' - end if - - !----------------------------------------------------------------------- - - end subroutine InitReadNML - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%leafc_patch (begp:endp)) ; this%leafc_patch (:) = nan - allocate(this%leafc_storage_patch (begp:endp)) ; this%leafc_storage_patch (:) = nan - allocate(this%leafc_xfer_patch (begp:endp)) ; this%leafc_xfer_patch (:) = nan - allocate(this%leafc_storage_xfer_acc_patch (begp:endp)) ; this%leafc_storage_xfer_acc_patch (:) = nan - allocate(this%storage_cdemand_patch (begp:endp)) ; this%storage_cdemand_patch (:) = nan - allocate(this%frootc_patch (begp:endp)) ; this%frootc_patch (:) = nan - allocate(this%frootc_storage_patch (begp:endp)) ; this%frootc_storage_patch (:) = nan - allocate(this%frootc_xfer_patch (begp:endp)) ; this%frootc_xfer_patch (:) = nan - allocate(this%livestemc_patch (begp:endp)) ; this%livestemc_patch (:) = nan - allocate(this%livestemc_storage_patch (begp:endp)) ; this%livestemc_storage_patch (:) = nan - allocate(this%livestemc_xfer_patch (begp:endp)) ; this%livestemc_xfer_patch (:) = nan - allocate(this%deadstemc_patch (begp:endp)) ; this%deadstemc_patch (:) = nan - allocate(this%deadstemc_storage_patch (begp:endp)) ; this%deadstemc_storage_patch (:) = nan - allocate(this%deadstemc_xfer_patch (begp:endp)) ; this%deadstemc_xfer_patch (:) = nan - allocate(this%livecrootc_patch (begp:endp)) ; this%livecrootc_patch (:) = nan - allocate(this%livecrootc_storage_patch (begp:endp)) ; this%livecrootc_storage_patch (:) = nan - allocate(this%livecrootc_xfer_patch (begp:endp)) ; this%livecrootc_xfer_patch (:) = nan - allocate(this%deadcrootc_patch (begp:endp)) ; this%deadcrootc_patch (:) = nan - allocate(this%deadcrootc_storage_patch (begp:endp)) ; this%deadcrootc_storage_patch (:) = nan - allocate(this%deadcrootc_xfer_patch (begp:endp)) ; this%deadcrootc_xfer_patch (:) = nan - allocate(this%gresp_storage_patch (begp:endp)) ; this%gresp_storage_patch (:) = nan - allocate(this%gresp_xfer_patch (begp:endp)) ; this%gresp_xfer_patch (:) = nan - allocate(this%cpool_patch (begp:endp)) ; this%cpool_patch (:) = nan - allocate(this%xsmrpool_patch (begp:endp)) ; this%xsmrpool_patch (:) = nan - allocate(this%ctrunc_patch (begp:endp)) ; this%ctrunc_patch (:) = nan - allocate(this%dispvegc_patch (begp:endp)) ; this%dispvegc_patch (:) = nan - allocate(this%storvegc_patch (begp:endp)) ; this%storvegc_patch (:) = nan - allocate(this%leafcmax_patch (begp:endp)) ; this%leafcmax_patch (:) = nan - allocate(this%totc_patch (begp:endp)) ; this%totc_patch (:) = nan - allocate(this%grainc_patch (begp:endp)) ; this%grainc_patch (:) = nan - allocate(this%grainc_storage_patch (begp:endp)) ; this%grainc_storage_patch (:) = nan - allocate(this%grainc_xfer_patch (begp:endp)) ; this%grainc_xfer_patch (:) = nan - allocate(this%woodc_patch (begp:endp)) ; this%woodc_patch (:) = nan - - allocate(this%cropseedc_deficit_patch (begp:endp)) ; this%cropseedc_deficit_patch (:) = nan - allocate(this%seedc_grc (begg:endg)) ; this%seedc_grc (:) = nan - allocate(this%rootc_col (begc:endc)) ; this%rootc_col (:) = nan - allocate(this%leafc_col (begc:endc)) ; this%leafc_col (:) = nan - allocate(this%deadstemc_col (begc:endc)) ; this%deadstemc_col (:) = nan - allocate(this%fuelc_col (begc:endc)) ; this%fuelc_col (:) = nan - allocate(this%fuelc_crop_col (begc:endc)) ; this%fuelc_crop_col (:) = nan - - allocate(this%totvegc_patch (begp:endp)) ; this%totvegc_patch (:) = nan - allocate(this%totvegc_col (begc:endc)) ; this%totvegc_col (:) = nan - - allocate(this%totc_p2c_col (begc:endc)) ; this%totc_p2c_col (:) = nan - allocate(this%totc_col (begc:endc)) ; this%totc_col (:) = nan - allocate(this%totecosysc_col (begc:endc)) ; this%totecosysc_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varctl , only : use_c13, use_c14 - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - character(10) :: active - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - !------------------------------- - ! C12 state variables - !------------------------------- - - if (carbon_type == 'c12') then - - if (use_crop) then - this%grainc_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINC', units='gC/m^2', & - avgflag='A', long_name='grain C (does not equal yield)', & - ptr_patch=this%grainc_patch) - this%cropseedc_deficit_patch(begp:endp) = spval - call hist_addfld1d (fname='CROPSEEDC_DEFICIT', units='gC/m^2', & - avgflag='A', long_name='C used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedc_deficit_patch) - end if - - this%woodc_patch(begp:endp) = spval - call hist_addfld1d (fname='WOODC', units='gC/m^2', & - avgflag='A', long_name='wood C', & - ptr_patch=this%woodc_patch) - - this%leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC', units='gC/m^2', & - avgflag='A', long_name='leaf C', & - ptr_patch=this%leafc_patch) - - this%leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='leaf C storage', & - ptr_patch=this%leafc_storage_patch, default='inactive') - - this%leafc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_XFER', units='gC/m^2', & - avgflag='A', long_name='leaf C transfer', & - ptr_patch=this%leafc_xfer_patch, default='inactive') - - this%leafc_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFC_STORAGE_XFER_ACC', units='gC/m^2', & - avgflag='A', long_name='Accumulated leaf C transfer', & - ptr_patch=this%leafc_storage_xfer_acc_patch, default='inactive') - - this%storage_cdemand_patch(begp:endp) = spval - call hist_addfld1d (fname='STORAGE_CDEMAND', units='gC/m^2', & - avgflag='A', long_name='C use from the C storage pool', & - ptr_patch=this%storage_cdemand_patch, default='inactive') - - this%frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC', units='gC/m^2', & - avgflag='A', long_name='fine root C', & - ptr_patch=this%frootc_patch) - - this%frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='fine root C storage', & - ptr_patch=this%frootc_storage_patch, default='inactive') - - this%frootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='fine root C transfer', & - ptr_patch=this%frootc_xfer_patch, default='inactive') - - this%livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC', units='gC/m^2', & - avgflag='A', long_name='live stem C', & - ptr_patch=this%livestemc_patch) - - this%livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='live stem C storage', & - ptr_patch=this%livestemc_storage_patch, default='inactive') - - this%livestemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMC_XFER', units='gC/m^2', & - avgflag='A', long_name='live stem C transfer', & - ptr_patch=this%livestemc_xfer_patch, default='inactive') - - this%deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC', units='gC/m^2', & - avgflag='A', long_name='dead stem C', & - ptr_patch=this%deadstemc_patch) - - this%deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='dead stem C storage', & - ptr_patch=this%deadstemc_storage_patch, default='inactive') - - this%deadstemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMC_XFER', units='gC/m^2', & - avgflag='A', long_name='dead stem C transfer', & - ptr_patch=this%deadstemc_xfer_patch, default='inactive') - - this%livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC', units='gC/m^2', & - avgflag='A', long_name='live coarse root C', & - ptr_patch=this%livecrootc_patch) - - this%livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='live coarse root C storage', & - ptr_patch=this%livecrootc_storage_patch, default='inactive') - - this%livecrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='live coarse root C transfer', & - ptr_patch=this%livecrootc_xfer_patch, default='inactive') - - this%deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C', & - ptr_patch=this%deadcrootc_patch) - - this%deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C storage', & - ptr_patch=this%deadcrootc_storage_patch, default='inactive') - - this%deadcrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C transfer', & - ptr_patch=this%deadcrootc_xfer_patch, default='inactive') - - this%gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='GRESP_STORAGE', units='gC/m^2', & - avgflag='A', long_name='growth respiration storage', & - ptr_patch=this%gresp_storage_patch, default='inactive') - - this%gresp_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='GRESP_XFER', units='gC/m^2', & - avgflag='A', long_name='growth respiration transfer', & - ptr_patch=this%gresp_xfer_patch, default='inactive') - - this%cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='CPOOL', units='gC/m^2', & - avgflag='A', long_name='temporary photosynthate C pool', & - ptr_patch=this%cpool_patch) - - this%xsmrpool_patch(begp:endp) = spval - call hist_addfld1d (fname='XSMRPOOL', units='gC/m^2', & - avgflag='A', long_name='temporary photosynthate C pool', & - ptr_patch=this%xsmrpool_patch) - - this%ctrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_CTRUNC', units='gC/m^2', & - avgflag='A', long_name='patch-level sink for C truncation', & - ptr_patch=this%ctrunc_patch, default='inactive') - - this%dispvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='DISPVEGC', units='gC/m^2', & - avgflag='A', long_name='displayed veg carbon, excluding storage and cpool', & - ptr_patch=this%dispvegc_patch) - - this%storvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='STORVEGC', units='gC/m^2', & - avgflag='A', long_name='stored vegetation carbon, excluding cpool', & - ptr_patch=this%storvegc_patch) - - this%totvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTVEGC', units='gC/m^2', & - avgflag='A', long_name='total vegetation carbon, excluding cpool', & - ptr_patch=this%totvegc_patch) - - this%totc_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTPFTC', units='gC/m^2', & - avgflag='A', long_name='total patch-level carbon, including cpool', & - ptr_patch=this%totc_patch) - - this%seedc_grc(begg:endg) = spval - call hist_addfld1d (fname='SEEDC', units='gC/m^2', & - avgflag='A', long_name='pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedc_grc) - - this%fuelc_col(begc:endc) = spval - call hist_addfld1d (fname='FUELC', units='gC/m^2', & - avgflag='A', long_name='fuel load', & - ptr_col=this%fuelc_col) - - this%totc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTCOLC', units='gC/m^2', & - avgflag='A', long_name='total column carbon, incl veg and cpool but excl product pools', & - ptr_col=this%totc_col) - - this%totecosysc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTECOSYSC', units='gC/m^2', & - avgflag='A', long_name='total ecosystem carbon, incl veg but excl cpool and product pools', & - ptr_col=this%totecosysc_col) - - end if - - !------------------------------- - ! C13 state variables - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C', & - ptr_patch=this%leafc_patch) - - this%leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C storage', & - ptr_patch=this%leafc_storage_patch, default='inactive') - - this%leafc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C transfer', & - ptr_patch=this%leafc_xfer_patch, default='inactive') - - this%leafc_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LEAFC_STORAGE_XFER_ACC', units='gC13/m^2', & - avgflag='A', long_name='Accumulated C13 leaf C transfer', & - ptr_patch=this%leafc_storage_xfer_acc_patch, default='inactive') - - this%frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C', & - ptr_patch=this%frootc_patch) - - this%frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C storage', & - ptr_patch=this%frootc_storage_patch, default='inactive') - - this%frootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_FROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C transfer', & - ptr_patch=this%frootc_xfer_patch, default='inactive') - - this%livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C', & - ptr_patch=this%livestemc_patch) - - this%livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C storage', & - ptr_patch=this%livestemc_storage_patch, default='inactive') - - this%livestemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVESTEMC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C transfer', & - ptr_patch=this%livestemc_xfer_patch, default='inactive') - - this%deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C', & - ptr_patch=this%deadstemc_patch) - - this%deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C storage', & - ptr_patch=this%deadstemc_storage_patch, default='inactive') - - this%deadstemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADSTEMC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C transfer', & - ptr_patch=this%deadstemc_xfer_patch, default='inactive') - - this%livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C', & - ptr_patch=this%livecrootc_patch) - - this%livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C storage', & - ptr_patch=this%livecrootc_storage_patch, default='inactive') - - this%livecrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_LIVECROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C transfer', & - ptr_patch=this%livecrootc_xfer_patch, default='inactive') - - this%deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C', & - ptr_patch=this%deadcrootc_patch) - - this%deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C storage', & - ptr_patch=this%deadcrootc_storage_patch, default='inactive') - - this%deadcrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DEADCROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C transfer', & - ptr_patch=this%deadcrootc_xfer_patch, default='inactive') - - this%gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRESP_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 growth respiration storage', & - ptr_patch=this%gresp_storage_patch, default='inactive') - - this%gresp_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRESP_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 growth respiration transfer', & - ptr_patch=this%gresp_xfer_patch, default='inactive') - - this%cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CPOOL', units='gC13/m^2', & - avgflag='A', long_name='C13 temporary photosynthate C pool', & - ptr_patch=this%cpool_patch) - - this%xsmrpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_XSMRPOOL', units='gC13/m^2', & - avgflag='A', long_name='C13 temporary photosynthate C pool', & - ptr_patch=this%xsmrpool_patch) - - this%ctrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PFT_CTRUNC', units='gC13/m^2', & - avgflag='A', long_name='C13 patch-level sink for C truncation', & - ptr_patch=this%ctrunc_patch, default='inactive') - - this%dispvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_DISPVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 displayed veg carbon, excluding storage and cpool', & - ptr_patch=this%dispvegc_patch) - - this%storvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_STORVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 stored vegetation carbon, excluding cpool', & - ptr_patch=this%storvegc_patch) - - this%totvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TOTVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 total vegetation carbon, excluding cpool', & - ptr_patch=this%totvegc_patch) - - this%totc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_TOTPFTC', units='gC13/m^2', & - avgflag='A', long_name='C13 total patch-level carbon, including cpool', & - ptr_patch=this%totc_patch) - - this%seedc_grc(begg:endg) = spval - call hist_addfld1d (fname='C13_SEEDC', units='gC13/m^2', & - avgflag='A', long_name='C13 pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedc_grc) - - this%totc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTCOLC', units='gC13/m^2', & - avgflag='A', long_name='C13 total column carbon, incl veg and cpool but excl product pools', & - ptr_col=this%totc_col) - - this%totecosysc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTECOSYSC', units='gC13/m^2', & - avgflag='A', long_name='C13 total ecosystem carbon, incl veg but excl cpool and product pools', & - ptr_col=this%totecosysc_col) - - if (use_crop) then - this%grainc_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_GRAINC', units='gC/m^2', & - avgflag='A', long_name='C13 grain C (does not equal yield)', & - ptr_patch=this%grainc_patch) - this%cropseedc_deficit_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_CROPSEEDC_DEFICIT', units='gC/m^2', & - avgflag='A', long_name='C13 C used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedc_deficit_patch) - end if - - - endif - - !------------------------------- - ! C14 state variables - !------------------------------- - - if ( carbon_type == 'c14') then - - this%leafc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC', units='gC14/m^2', & - avgflag='A', long_name='C14 leaf C', & - ptr_patch=this%leafc_patch) - - this%leafc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 leaf C storage', & - ptr_patch=this%leafc_storage_patch, default='inactive') - - this%leafc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 leaf C transfer', & - ptr_patch=this%leafc_xfer_patch, default='inactive') - - this%leafc_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LEAFC_STORAGE_XFER_ACC', units='gC14/m^2', & - avgflag='A', long_name='Accumulated C14 leaf C transfer', & - ptr_patch=this%leafc_storage_xfer_acc_patch, default='inactive') - - this%frootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC', units='gC14/m^2', & - avgflag='A', long_name='C14 fine root C', & - ptr_patch=this%frootc_patch) - - this%frootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 fine root C storage', & - ptr_patch=this%frootc_storage_patch, default='inactive') - - this%frootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_FROOTC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 fine root C transfer', & - ptr_patch=this%frootc_xfer_patch, default='inactive') - - this%livestemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC', units='gC14/m^2', & - avgflag='A', long_name='C14 live stem C', & - ptr_patch=this%livestemc_patch) - - this%livestemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 live stem C storage', & - ptr_patch=this%livestemc_storage_patch, default='inactive') - - this%livestemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVESTEMC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 live stem C transfer', & - ptr_patch=this%livestemc_xfer_patch, default='inactive') - - this%deadstemc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC', units='gC14/m^2', & - avgflag='A', long_name='C14 dead stem C', & - ptr_patch=this%deadstemc_patch) - - this%deadstemc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 dead stem C storage', & - ptr_patch=this%deadstemc_storage_patch, default='inactive') - - this%deadstemc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADSTEMC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 dead stem C transfer', & - ptr_patch=this%deadstemc_xfer_patch, default='inactive') - - this%livecrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC', units='gC14/m^2', & - avgflag='A', long_name='C14 live coarse root C', & - ptr_patch=this%livecrootc_patch) - - this%livecrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 live coarse root C storage', & - ptr_patch=this%livecrootc_storage_patch, default='inactive') - - this%livecrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_LIVECROOTC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 live coarse root C transfer', & - ptr_patch=this%livecrootc_xfer_patch, default='inactive') - - this%deadcrootc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC', units='gC14/m^2', & - avgflag='A', long_name='C14 dead coarse root C', & - ptr_patch=this%deadcrootc_patch) - - this%deadcrootc_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 dead coarse root C storage', & - ptr_patch=this%deadcrootc_storage_patch, default='inactive') - - this%deadcrootc_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DEADCROOTC_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 dead coarse root C transfer', & - ptr_patch=this%deadcrootc_xfer_patch, default='inactive') - - this%gresp_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRESP_STORAGE', units='gC14/m^2', & - avgflag='A', long_name='C14 growth respiration storage', & - ptr_patch=this%gresp_storage_patch, default='inactive') - - this%gresp_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRESP_XFER', units='gC14/m^2', & - avgflag='A', long_name='C14 growth respiration transfer', & - ptr_patch=this%gresp_xfer_patch, default='inactive') - - this%cpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CPOOL', units='gC14/m^2', & - avgflag='A', long_name='C14 temporary photosynthate C pool', & - ptr_patch=this%cpool_patch) - - this%xsmrpool_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_XSMRPOOL', units='gC14/m^2', & - avgflag='A', long_name='C14 temporary photosynthate C pool', & - ptr_patch=this%xsmrpool_patch) - - this%ctrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PFT_CTRUNC', units='gC14/m^2', & - avgflag='A', long_name='C14 patch-level sink for C truncation', & - ptr_patch=this%ctrunc_patch) - - this%dispvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_DISPVEGC', units='gC14/m^2', & - avgflag='A', long_name='C14 displayed veg carbon, excluding storage and cpool', & - ptr_patch=this%dispvegc_patch) - - this%storvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_STORVEGC', units='gC14/m^2', & - avgflag='A', long_name='C14 stored vegetation carbon, excluding cpool', & - ptr_patch=this%storvegc_patch) - - this%totvegc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TOTVEGC', units='gC14/m^2', & - avgflag='A', long_name='C14 total vegetation carbon, excluding cpool', & - ptr_patch=this%totvegc_patch) - - this%totc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_TOTPFTC', units='gC14/m^2', & - avgflag='A', long_name='C14 total patch-level carbon, including cpool', & - ptr_patch=this%totc_patch) - - this%seedc_grc(begg:endg) = spval - call hist_addfld1d (fname='C14_SEEDC', units='gC14/m^2', & - avgflag='A', long_name='C14 pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedc_grc) - - this%totc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTCOLC', units='gC14/m^2', & - avgflag='A', long_name='C14 total column carbon, incl veg and cpool but excl product pools', & - ptr_col=this%totc_col) - - this%totecosysc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTECOSYSC', units='gC14/m^2', & - avgflag='A', long_name='C14 total ecosystem carbon, incl veg but excl cpool and product pools', & - ptr_col=this%totecosysc_col) - - if (use_crop) then - this%grainc_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_GRAINC', units='gC/m^2', & - avgflag='A', long_name='C14 grain C (does not equal yield)', & - ptr_patch=this%grainc_patch) - this%cropseedc_deficit_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_CROPSEEDC_DEFICIT', units='gC/m^2', & - avgflag='A', long_name='C14 C used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedc_deficit_patch) - end if - - - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, ratio, carbon_type, c12_cnveg_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use landunit_varcon , only : istsoil, istcrop - use clm_time_manager , only : is_restart, get_nstep - use clm_varctl, only : MM_Nuptake_opt - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: ratio ! Standard isotope ratio - character(len=*) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - type(cnveg_carbonstate_type) , optional, intent(in) :: c12_cnveg_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g,j,k,i - integer :: fc ! filter index - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch(bounds%endp-bounds%begp+1) ! special landunit filter - patches - !----------------------------------------------------------------------- - - if (carbon_type == 'c13' .or. carbon_type == 'c14') then - if (.not. present(c12_cnveg_carbonstate_inst)) then - call endrun(msg=' ERROR: for C13 or C14 must pass in c12_cnveg_carbonstate_inst as argument' //& - errMsg(sourcefile, __LINE__)) - end if - end if - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! Set patch filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - !----------------------------------------------- - ! initialize patch-level carbon state variables - !----------------------------------------------- - - do p = bounds%begp,bounds%endp - - this%leafcmax_patch(p) = 0._r8 - - l = patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - if (patch%itype(p) == noveg) then - this%leafc_patch(p) = 0._r8 - this%leafc_storage_patch(p) = 0._r8 - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = 0._r8 - else - if (pftcon%evergreen(patch%itype(p)) == 1._r8) then - this%leafc_patch(p) = cnvegcstate_const%initial_vegC * ratio - this%leafc_storage_patch(p) = 0._r8 - this%frootc_patch(p) = cnvegcstate_const%initial_vegC * ratio - this%frootc_storage_patch(p) = 0._r8 - else if (patch%itype(p) >= npcropmin) then ! prognostic crop types - this%leafc_patch(p) = 0._r8 - this%leafc_storage_patch(p) = 0._r8 - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = 0._r8 - else - this%leafc_patch(p) = 0._r8 - this%leafc_storage_patch(p) = cnvegcstate_const%initial_vegC * ratio - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = cnvegcstate_const%initial_vegC * ratio - end if - end if - this%leafc_xfer_patch(p) = 0._r8 - this%leafc_storage_xfer_acc_patch(p) = 0._r8 - this%storage_cdemand_patch(p) = 0._r8 - - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootc_patch(p) = 0._r8 - this%frootc_storage_patch(p) = 0._r8 - end if - this%frootc_xfer_patch(p) = 0._r8 - - this%livestemc_patch(p) = 0._r8 - this%livestemc_storage_patch(p) = 0._r8 - this%livestemc_xfer_patch(p) = 0._r8 - - if (pftcon%woody(patch%itype(p)) == 1._r8) then - this%deadstemc_patch(p) = 0.1_r8 * ratio - else - this%deadstemc_patch(p) = 0._r8 - end if - this%deadstemc_storage_patch(p) = 0._r8 - this%deadstemc_xfer_patch(p) = 0._r8 - - this%livecrootc_patch(p) = 0._r8 - this%livecrootc_storage_patch(p) = 0._r8 - this%livecrootc_xfer_patch(p) = 0._r8 - - this%deadcrootc_patch(p) = 0._r8 - this%deadcrootc_storage_patch(p) = 0._r8 - this%deadcrootc_xfer_patch(p) = 0._r8 - - this%gresp_storage_patch(p) = 0._r8 - this%gresp_xfer_patch(p) = 0._r8 - - this%cpool_patch(p) = 0._r8 - this%xsmrpool_patch(p) = 0._r8 - this%ctrunc_patch(p) = 0._r8 - this%dispvegc_patch(p) = 0._r8 - this%storvegc_patch(p) = 0._r8 - this%woodc_patch(p) = 0._r8 - this%totc_patch(p) = 0._r8 - - if ( use_crop )then - this%grainc_patch(p) = 0._r8 - this%grainc_storage_patch(p) = 0._r8 - this%grainc_xfer_patch(p) = 0._r8 - this%cropseedc_deficit_patch(p) = 0._r8 - end if - - endif - - end do - - ! ----------------------------------------------- - ! initialize column-level variables - ! ----------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then -! this%totgrainc_col(c) = 0._r8 - - ! total carbon pools - this%totecosysc_col(c) = 0._r8 - this%totc_p2c_col(c) = 0._r8 - this%totc_col(c) = 0._r8 - end if - end do - - - do g = bounds%begg, bounds%endg - this%seedc_grc(g) = 0._r8 - end do - - if ( .not. is_restart() .and. get_nstep() == 1 ) then - - do p = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(p)) == 1._r8) then - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c3_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c3_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c3_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c3_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c3_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c3_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c3_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c3_r2 - else - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c4_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c4_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c4_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c4_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c4_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c4_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c4_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c4_r2 - end if - end do - end if - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, carbon_type, reseed_dead_plants, & - c12_cnveg_carbonstate_inst, filter_reseed_patch, & - num_reseed_patch) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : c13ratio, c14ratio - use clm_varctl , only : spinup_state, use_cndv, MM_Nuptake_opt - use clm_time_manager , only : get_nstep, is_restart, get_nstep - use landunit_varcon , only : istsoil, istcrop - use spmdMod , only : mpicom - use shr_mpi_mod , only : shr_mpi_sum - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=*) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - logical , intent(in) :: reseed_dead_plants - type (cnveg_carbonstate_type) , intent(in), optional :: c12_cnveg_carbonstate_inst - integer , intent(out), optional :: filter_reseed_patch(:) - integer , intent(out), optional :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,l,c,p - real(r8) :: ratio - character(len=128) :: varname ! temporary - logical :: readvar - integer :: idata - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - ! flags for comparing the model and restart decomposition cascades - integer :: decomp_cascade_state, restart_file_decomp_cascade_state - ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - integer :: restart_file_spinup_state - integer :: total_num_reseed_patch ! Total number of patches to reseed across all processors - - !------------------------------------------------------------------------ - - if (carbon_type == 'c13' .or. carbon_type == 'c14') then - if (.not. present(c12_cnveg_carbonstate_inst)) then - call endrun(msg=' ERROR: for C14 must pass in c12_cnveg_carbonstate_inst as argument' //& - errMsg(sourcefile, __LINE__)) - end if - end if - if (carbon_type == 'c12') then - ratio = 1._r8 - else if (carbon_type == 'c13') then - ratio = c13ratio - else if (carbon_type == 'c14') then - ratio = c14ratio - end if - - if ( ( present(num_reseed_patch) .and. .not. present(filter_reseed_patch)) & - .or. (.not. present(num_reseed_patch) .and. present(filter_reseed_patch) ) )then - call endrun(msg=' ERROR: filter_reseed_patch and num_reseed_patch both need to be entered ' //& - errMsg(sourcefile, __LINE__)) - end if - if ( present(num_reseed_patch) )then - num_reseed_patch = 0 - filter_reseed_patch(:) = -1 - end if - - !-------------------------------- - ! patch carbon state variables (c12) - !-------------------------------- - - if (carbon_type == 'c12') then - call restartvar(ncid=ncid, flag=flag, varname='leafc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage_xfer_acc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_xfer_acc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='storage_cdemand', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%storage_cdemand_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gresp_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gresp_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cpool', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_patch) - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - - call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafcmax', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafcmax_patch) - - if (flag == 'read') then - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup, 2 = AAD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - - if (readvar) then - restart_file_spinup_state = idata - else - restart_file_spinup_state = spinup_state - if ( masterproc ) then - write(iulog,*) ' CNRest: WARNING! Restart file does not contain info ' & - // ' on spinup state used to generate the restart file. ' - write(iulog,*) ' Assuming the same as current setting: ', spinup_state - end if - end if - end if - - if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then - if ( masterproc ) write(iulog, *) 'exit_spinup ',exit_spinup,' restart_file_spinup_state ',restart_file_spinup_state - if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools out of AD spinup mode' - exit_spinup = .true. - if ( masterproc ) write(iulog, *) 'Multiplying stemc and crootc by 10 for exit spinup' - do i = bounds%begp,bounds%endp - this%deadstemc_patch(i) = this%deadstemc_patch(i) * 10._r8 - this%deadcrootc_patch(i) = this%deadcrootc_patch(i) * 10._r8 - end do - else if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then - if (spinup_state == 2 .and. restart_file_spinup_state <= 1 )then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood C pools into AD spinup mode' - enter_spinup = .true. - if ( masterproc ) write(iulog, *) 'Dividing stemc and crootc by 10 for enter spinup ' - do i = bounds%begp,bounds%endp - this%deadstemc_patch(i) = this%deadstemc_patch(i) / 10._r8 - this%deadcrootc_patch(i) = this%deadcrootc_patch(i) / 10._r8 - end do - end if - end if - end if - !-------------------------------- - ! C12 carbon state variables - !-------------------------------- - - if (carbon_type == 'c12') then - call restartvar(ncid=ncid, flag=flag, varname='totvegc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_patch) - ! totvegc_col needed for resetting soil carbon stocks during AD spinup exit - call restartvar(ncid=ncid, flag=flag, varname='totvegc_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_col) - end if - - !-------------------------------- - ! C13 carbon state variables - !-------------------------------- - - if ( carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='totvegc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing cnveg_carbonstate_inst%totvegc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%totvegc_patch(i) = c12_cnveg_carbonstate_inst%totvegc_patch(i) * c3_r2 - else - this%totvegc_patch(i) = c12_cnveg_carbonstate_inst%totvegc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='totvegc_col_13', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_col) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing cnveg_carbonstate_inst%totvegc with atmospheric c13 value' - do i = bounds%begc,bounds%endc - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%totvegc_col(i) = c12_cnveg_carbonstate_inst%totvegc_col(i) * c3_r2 - else - this%totvegc_col(i) = c12_cnveg_carbonstate_inst%totvegc_col(i) * c4_r2 - endif - end do - end if - - end if - - !-------------------------------- - ! C14 patch carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14') then - call restartvar(ncid=ncid, flag=flag, varname='totvegc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%totvegc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%totvegc_patch(i) /= spval .and. & - .not. isnan(this%totvegc_patch(i)) ) then - this%totvegc_patch(i) = c12_cnveg_carbonstate_inst%totvegc_patch(i) * c14ratio - endif - end do - endif - - call restartvar(ncid=ncid, flag=flag, varname='totvegc_col_14', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%totvegc_col) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing cnveg_carbonstate_inst%totvegc with atmospheric c14 value' - do i = bounds%begc,bounds%endc - if (this%totvegc_col(i) /= spval .and. & - .not. isnan(this%totvegc_col(i)) ) then - this%totvegc_col(i) = c12_cnveg_carbonstate_inst%totvegc_col(i) * c14ratio - endif - end do - end if - end if - - - if ( flag == 'read' .and. (enter_spinup .or. (reseed_dead_plants .and. .not. is_restart())) .and. .not. use_cndv) then - if ( masterproc ) write(iulog, *) 'Reseeding dead plants for CNVegCarbonState' - ! If a pft is dead (indicated by totvegc = 0) then we reseed that - ! pft according to the cold start protocol in the InitCold subroutine. - ! Thus, the variable totvegc is required to be read before here - ! so that if it is zero for a given pft, the pft can be reseeded. - do i = bounds%begp,bounds%endp - if (this%totvegc_patch(i) .le. 0.0_r8) then - !----------------------------------------------- - ! initialize patch-level carbon state variables - !----------------------------------------------- - - this%leafcmax_patch(i) = 0._r8 - - l = patch%landunit(i) - if (lun%itype(l) == istsoil )then - if ( present(num_reseed_patch) ) then - num_reseed_patch = num_reseed_patch + 1 - filter_reseed_patch(num_reseed_patch) = i - end if - - if (patch%itype(i) == noveg) then - this%leafc_patch(i) = 0._r8 - this%leafc_storage_patch(i) = 0._r8 - this%frootc_patch(i) = 0._r8 - this%frootc_storage_patch(i) = 0._r8 - else - if (pftcon%evergreen(patch%itype(i)) == 1._r8) then - this%leafc_patch(i) = cnvegcstate_const%initial_vegC * ratio - this%leafc_storage_patch(i) = 0._r8 - this%frootc_patch(i) = cnvegcstate_const%initial_vegC * ratio - this%frootc_storage_patch(i) = 0._r8 - else - this%leafc_patch(i) = 0._r8 - this%leafc_storage_patch(i) = cnvegcstate_const%initial_vegC * ratio - this%frootc_patch(i) = 0._r8 - this%frootc_storage_patch(i) = cnvegcstate_const%initial_vegC * ratio - end if - end if - this%leafc_xfer_patch(i) = 0._r8 - this%leafc_storage_xfer_acc_patch(i) = 0._r8 - this%storage_cdemand_patch(i) = 0._r8 - - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootc_patch(i) = 0._r8 - this%frootc_storage_patch(i) = 0._r8 - end if - this%frootc_xfer_patch(i) = 0._r8 - - this%livestemc_patch(i) = 0._r8 - this%livestemc_storage_patch(i) = 0._r8 - this%livestemc_xfer_patch(i) = 0._r8 - - if (pftcon%woody(patch%itype(i)) == 1._r8) then - this%deadstemc_patch(i) = 0.1_r8 * ratio - else - this%deadstemc_patch(i) = 0._r8 - end if - this%deadstemc_storage_patch(i) = 0._r8 - this%deadstemc_xfer_patch(i) = 0._r8 - - this%livecrootc_patch(i) = 0._r8 - this%livecrootc_storage_patch(i) = 0._r8 - this%livecrootc_xfer_patch(i) = 0._r8 - - this%deadcrootc_patch(i) = 0._r8 - this%deadcrootc_storage_patch(i) = 0._r8 - this%deadcrootc_xfer_patch(i) = 0._r8 - - this%gresp_storage_patch(i) = 0._r8 - this%gresp_xfer_patch(i) = 0._r8 - - this%cpool_patch(i) = 0._r8 - this%xsmrpool_patch(i) = 0._r8 - this%ctrunc_patch(i) = 0._r8 - this%dispvegc_patch(i) = 0._r8 - this%storvegc_patch(i) = 0._r8 - this%woodc_patch(i) = 0._r8 - this%totc_patch(i) = 0._r8 - - if ( use_crop )then - this%grainc_patch(i) = 0._r8 - this%grainc_storage_patch(i) = 0._r8 - this%grainc_xfer_patch(i) = 0._r8 - this%cropseedc_deficit_patch(i) = 0._r8 - end if - - ! calculate totvegc explicitly so that it is available for the isotope - ! code on the first time step. - - this%totvegc_patch(i) = & - this%leafc_patch(i) + & - this%leafc_storage_patch(i) + & - this%leafc_xfer_patch(i) + & - this%frootc_patch(i) + & - this%frootc_storage_patch(i) + & - this%frootc_xfer_patch(i) + & - this%livestemc_patch(i) + & - this%livestemc_storage_patch(i) + & - this%livestemc_xfer_patch(i) + & - this%deadstemc_patch(i) + & - this%deadstemc_storage_patch(i) + & - this%deadstemc_xfer_patch(i) + & - this%livecrootc_patch(i) + & - this%livecrootc_storage_patch(i) + & - this%livecrootc_xfer_patch(i) + & - this%deadcrootc_patch(i) + & - this%deadcrootc_storage_patch(i) + & - this%deadcrootc_xfer_patch(i) + & - this%gresp_storage_patch(i) + & - this%gresp_xfer_patch(i) + & - this%cpool_patch(i) - - if ( use_crop )then - this%totvegc_patch(i) = & - this%totvegc_patch(i) + & - this%grainc_patch(i) + & - this%grainc_storage_patch(i) + & - this%grainc_xfer_patch(i) - end if - - endif - end if - end do - if ( .not. is_restart() .and. get_nstep() == 1 ) then - - do p = bounds%begp,bounds%endp - if (this%leafc_patch(p) .lt. 0.01_r8) then - if (pftcon%c3psn(patch%itype(p)) == 1._r8) then - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c3_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c3_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c3_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c3_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c3_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c3_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c3_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c3_r2 - else - this%grainc_patch(p) = c12_cnveg_carbonstate_inst%grainc_patch(p) * c4_r2 - this%grainc_storage_patch(p) = c12_cnveg_carbonstate_inst%grainc_storage_patch(p) * c4_r2 - this%grainc_xfer_patch(p) = c12_cnveg_carbonstate_inst%grainc_xfer_patch(p) * c4_r2 - this%dispvegc_patch(p) = c12_cnveg_carbonstate_inst%dispvegc_patch(p) * c4_r2 - this%storvegc_patch(p) = c12_cnveg_carbonstate_inst%storvegc_patch(p) * c4_r2 - this%totvegc_patch(p) = c12_cnveg_carbonstate_inst%totvegc_patch(p) * c4_r2 - this%totc_patch(p) = c12_cnveg_carbonstate_inst%totc_patch(p) * c4_r2 - this%woodc_patch(p) = c12_cnveg_carbonstate_inst%woodc_patch(p) * c4_r2 - end if - end if - end do - end if - if ( present(num_reseed_patch) ) then - call shr_mpi_sum( num_reseed_patch, total_num_reseed_patch, mpicom ) - if ( masterproc ) write(iulog,*) 'Total num_reseed, over all tasks = ', total_num_reseed_patch - end if - end if - - end if - - !-------------------------------- - ! C13 patch carbon state variables - !-------------------------------- - - if ( carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='leafc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%leafc_patch(i) = c12_cnveg_carbonstate_inst%leafc_patch(i) * c3_r2 - else - this%leafc_patch(i) = c12_cnveg_carbonstate_inst%leafc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c3_r2 - else - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c4_r2 - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%leafc_xfer_patch(i) = c12_cnveg_carbonstate_inst%leafc_xfer_patch(i) * c3_r2 - else - this%leafc_xfer_patch(i) = c12_cnveg_carbonstate_inst%leafc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%frootc_patch(i) = c12_cnveg_carbonstate_inst%frootc_patch(i) * c3_r2 - else - this%frootc_patch(i) = c12_cnveg_carbonstate_inst%frootc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%frootc_storage_patch(i) = c12_cnveg_carbonstate_inst%frootc_storage_patch(i) * c3_r2 - else - this%frootc_storage_patch(i) = c12_cnveg_carbonstate_inst%frootc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%frootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%frootc_xfer_patch(i) * c3_r2 - else - this%frootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%frootc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livestemc_patch(i) = c12_cnveg_carbonstate_inst%livestemc_patch(i) * c3_r2 - else - this%livestemc_patch(i) = c12_cnveg_carbonstate_inst%livestemc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livestemc_storage_patch(i) = c12_cnveg_carbonstate_inst%livestemc_storage_patch(i) * c3_r2 - else - this%livestemc_storage_patch(i) = c12_cnveg_carbonstate_inst%livestemc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livestemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livestemc_xfer_patch(i) * c3_r2 - else - this%livestemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livestemc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadstemc_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_patch(i) * c3_r2 - else - this%deadstemc_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadstemc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_storage_patch(i) * c3_r2 - else - this%deadstemc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadstemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_xfer_patch(i) * c3_r2 - else - this%deadstemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livecrootc_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_patch(i) * c3_r2 - else - this%livecrootc_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livecrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_storage_patch(i) * c3_r2 - else - this%livecrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%livecrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_xfer_patch(i) * c3_r2 - else - this%livecrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadcrootc_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_patch(i) * c3_r2 - else - this%deadcrootc_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadcrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_storage_patch(i) * c3_r2 - else - this%deadcrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_xfer_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%deadcrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_xfer_patch(i) * c3_r2 - else - this%deadcrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_storage_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_storage with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%gresp_storage_patch(i) = c12_cnveg_carbonstate_inst%gresp_storage_patch(i) * c3_r2 - else - this%gresp_storage_patch(i) = c12_cnveg_carbonstate_inst%gresp_storage_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_xfer_13', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_xfer with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%gresp_xfer_patch(i) = c12_cnveg_carbonstate_inst%gresp_xfer_patch(i) * c3_r2 - else - this%gresp_xfer_patch(i) = c12_cnveg_carbonstate_inst%gresp_xfer_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='cpool_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%cpool with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%cpool_patch(i) = c12_cnveg_carbonstate_inst%cpool_patch(i) * c3_r2 - else - this%cpool_patch(i) = c12_cnveg_carbonstate_inst%cpool_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_13', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%xsmrpool with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%xsmrpool_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_patch(i) * c3_r2 - else - this%xsmrpool_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_patch(i) * c4_r2 - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc_13', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%ctrunc with atmospheric c13 value' - do i = bounds%begp,bounds%endp - if (pftcon%c3psn(patch%itype(i)) == 1._r8) then - this%ctrunc_patch(i) = c12_cnveg_carbonstate_inst%ctrunc_patch(i) * c3_r2 - else - this%ctrunc_patch(i) = c12_cnveg_carbonstate_inst%ctrunc_patch(i) * c4_r2 - endif - end do - end if - - end if - - !-------------------------------- - ! C14 patch carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14') then - call restartvar(ncid=ncid, flag=flag, varname='leafc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%leafc_patch(i) /= spval .and. & - .not. isnan(this%leafc_patch(i)) ) then - this%leafc_patch(i) = c12_cnveg_carbonstate_inst%leafc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%leafc_storage_patch(i) /= spval .and. & - .not. isnan(this%leafc_storage_patch(i)) ) then - this%leafc_storage_patch(i) = c12_cnveg_carbonstate_inst%leafc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='leafc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%leafc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%leafc_xfer_patch(i) /= spval .and. .not. isnan(this%leafc_xfer_patch(i)) ) then - this%leafc_xfer_patch(i) = c12_cnveg_carbonstate_inst%leafc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%frootc_patch(i) /= spval .and. & - .not. isnan(this%frootc_patch(i)) ) then - this%frootc_patch(i) = c12_cnveg_carbonstate_inst%frootc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%frootc_storage_patch(i) /= spval .and. & - .not. isnan(this%frootc_storage_patch(i)) ) then - this%frootc_storage_patch(i) = c12_cnveg_carbonstate_inst%frootc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='frootc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%frootc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%frootc_xfer_patch(i) /= spval .and. & - .not. isnan(this%frootc_xfer_patch(i)) ) then - this%frootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%frootc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livestemc_patch(i) /= spval .and. .not. isnan(this%livestemc_patch(i)) ) then - this%livestemc_patch(i) = c12_cnveg_carbonstate_inst%livestemc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livestemc_storage_patch(i) /= spval .and. .not. isnan(this%livestemc_storage_patch(i)) ) then - this%livestemc_storage_patch(i) = c12_cnveg_carbonstate_inst%livestemc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livestemc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livestemc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livestemc_xfer_patch(i) /= spval .and. .not. isnan(this%livestemc_xfer_patch(i)) ) then - this%livestemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livestemc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadstemc_patch(i) /= spval .and. .not. isnan(this%deadstemc_patch(i)) ) then - this%deadstemc_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadstemc_storage_patch(i) /= spval .and. .not. isnan(this%deadstemc_storage_patch(i)) ) then - this%deadstemc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadstemc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadstemc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadstemc_xfer_patch(i) /= spval .and. .not. isnan(this%deadstemc_xfer_patch(i)) ) then - this%deadstemc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadstemc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livecrootc_patch(i) /= spval .and. .not. isnan(this%livecrootc_patch(i)) ) then - this%livecrootc_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livecrootc_storage_patch(i) /= spval .and. .not. isnan(this%livecrootc_storage_patch(i)) ) then - this%livecrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='livecrootc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%livecrootc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%livecrootc_xfer_patch(i) /= spval .and. .not. isnan(this%livecrootc_xfer_patch(i)) ) then - this%livecrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%livecrootc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadcrootc_patch(i) /= spval .and. .not. isnan(this%deadcrootc_patch(i)) ) then - this%deadcrootc_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadcrootc_storage_patch(i) /= spval .and. .not. isnan(this%deadcrootc_storage_patch(i)) ) then - this%deadcrootc_storage_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootc_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%deadcrootc_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%deadcrootc_xfer_patch(i) /= spval .and. .not. isnan(this%deadcrootc_xfer_patch(i)) ) then - this%deadcrootc_xfer_patch(i) = c12_cnveg_carbonstate_inst%deadcrootc_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_storage_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_storage_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_storage_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%gresp_storage_patch(i) /= spval .and. .not. isnan(this%gresp_storage_patch(i)) ) then - this%gresp_storage_patch(i) = c12_cnveg_carbonstate_inst%gresp_storage_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='gresp_xfer_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%gresp_xfer_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%gresp_xfer_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%gresp_xfer_patch(i) /= spval .and. .not. isnan(this%gresp_xfer_patch(i)) ) then - this%gresp_xfer_patch(i) = c12_cnveg_carbonstate_inst%gresp_xfer_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='cpool_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%cpool_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%cpool_patch(i) /= spval .and. .not. isnan(this%cpool_patch(i)) ) then - this%cpool_patch(i) = c12_cnveg_carbonstate_inst%cpool_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='xsmrpool_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%xsmrpool_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%xsmrpool_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%xsmrpool_patch(i) /= spval .and. .not. isnan(this%xsmrpool_patch(i)) ) then - this%xsmrpool_patch(i) = c12_cnveg_carbonstate_inst%xsmrpool_patch(i) * c14ratio - endif - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='pft_ctrunc_14', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ctrunc_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%ctrunc_patch with atmospheric c14 value' - do i = bounds%begp,bounds%endp - if (this%ctrunc_patch(i) /= spval .and. .not. isnan(this%ctrunc_patch(i)) ) then - this%ctrunc_patch(i) = c12_cnveg_carbonstate_inst%ctrunc_patch(i) * c14ratio - endif - end do - end if - - end if - - !-------------------------------- - ! patch prognostic crop variables - !-------------------------------- - - if (use_crop) then - if (carbon_type == 'c12') then - call restartvar(ncid=ncid, flag=flag, varname='grainc', xtype=ncd_double, & - dim1name='pft', long_name='grain C', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_storage', xtype=ncd_double, & - dim1name='pft', long_name='grain C storage', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainc_xfer', xtype=ncd_double, & - dim1name='pft', long_name='grain C transfer', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cropseedc_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gC/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedc_deficit_patch) - end if - - if (carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='grainc_13', xtype=ncd_double, & - dim1name='pft', long_name='c13 grain C', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_13_storage', xtype=ncd_double, & - dim1name='pft', long_name='c13 grain C storage', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_storage_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_storage_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_13_xfer', xtype=ncd_double, & - dim1name='pft', long_name='c13 grain C transfer', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_xfer_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_xfer_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='cropseedc_13_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gC13/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedc_deficit_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%cropseedc_deficit_patch, & - template_var = c12_cnveg_carbonstate_inst%cropseedc_deficit_patch, & - multiplier = c3_r2) - end if - end if - - if ( carbon_type == 'c14' ) then - - call restartvar(ncid=ncid, flag=flag, varname='grainc_14', xtype=ncd_double, & - dim1name='pft', long_name='c14 grain C', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_14_storage', xtype=ncd_double, & - dim1name='pft', long_name='c14 grain C storage', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_storage_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_storage_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_storage_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='grainc_14_xfer', xtype=ncd_double, & - dim1name='pft', long_name='c14 grain C transfer', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainc_xfer_patch) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%grainc_xfer_patch, & - template_var = c12_cnveg_carbonstate_inst%grainc_xfer_patch, & - multiplier = c3_r2) - end if - - call restartvar(ncid=ncid, flag=flag, varname='cropseedc_14_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gC14/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedc_deficit_patch) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%cropseedc_deficit_patch with atmospheric c14 value' - call set_missing_from_template( & - my_var = this%cropseedc_deficit_patch, & - template_var = c12_cnveg_carbonstate_inst%cropseedc_deficit_patch, & - multiplier = c14ratio) - end if - end if - end if - - !-------------------------------- - ! gridcell carbon state variables - !-------------------------------- - - if (carbon_type == 'c12') then - ! BACKWARDS_COMPATIBILITY(wjs, 2017-01-12) Naming this with a _g suffix in order - ! to distinguish it from the old column-level seedc restart variable - call restartvar(ncid=ncid, flag=flag, varname='seedc_g', xtype=ncd_double, & - dim1name='gridcell', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedc_grc) - end if - - !-------------------------------- - ! C13 gridcell carbon state variables - !-------------------------------- - - if (carbon_type == 'c13') then - call restartvar(ncid=ncid, flag=flag, varname='seedc_13_g', xtype=ncd_double, & - dim1name='gridcell', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedc_grc) - if (flag=='read' .and. .not. readvar) then - call set_missing_from_template( & - my_var = this%seedc_grc, & - template_var = c12_cnveg_carbonstate_inst%seedc_grc, & - multiplier = c3_r2) - end if - end if - - !-------------------------------- - ! C14 column carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14' ) then - call restartvar(ncid=ncid, flag=flag, varname='seedc_14_g', xtype=ncd_double, & - dim1name='gridcell', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedc_grc) - if (flag=='read' .and. .not. readvar) then - if ( masterproc ) write(iulog,*) 'initializing this%seedc_grc with atmospheric c14 value' - call set_missing_from_template( & - my_var = this%seedc_grc, & - template_var = c12_cnveg_carbonstate_inst%seedc_grc, & - multiplier = c14ratio) - end if - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon state variables - ! - ! !ARGUMENTS: - class (cnveg_carbonstate_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i = filter_patch(fi) - this%leafc_patch(i) = value_patch - this%leafc_storage_patch(i) = value_patch - this%leafc_xfer_patch(i) = value_patch - this%leafc_storage_xfer_acc_patch(i) = value_patch - this%storage_cdemand_patch(i) = value_patch - this%frootc_patch(i) = value_patch - this%frootc_storage_patch(i) = value_patch - this%frootc_xfer_patch(i) = value_patch - this%livestemc_patch(i) = value_patch - this%livestemc_storage_patch(i) = value_patch - this%livestemc_xfer_patch(i) = value_patch - this%deadstemc_patch(i) = value_patch - this%deadstemc_storage_patch(i) = value_patch - this%deadstemc_xfer_patch(i) = value_patch - this%livecrootc_patch(i) = value_patch - this%livecrootc_storage_patch(i) = value_patch - this%livecrootc_xfer_patch(i) = value_patch - this%deadcrootc_patch(i) = value_patch - this%deadcrootc_storage_patch(i) = value_patch - this%deadcrootc_xfer_patch(i) = value_patch - this%gresp_storage_patch(i) = value_patch - this%gresp_xfer_patch(i) = value_patch - this%cpool_patch(i) = value_patch - this%xsmrpool_patch(i) = value_patch - this%ctrunc_patch(i) = value_patch - this%dispvegc_patch(i) = value_patch - this%storvegc_patch(i) = value_patch - this%woodc_patch(i) = value_patch - this%totvegc_patch(i) = value_patch - this%totc_patch(i) = value_patch - if ( use_crop ) then - this%grainc_patch(i) = value_patch - this%grainc_storage_patch(i) = value_patch - this%grainc_xfer_patch(i) = value_patch - this%cropseedc_deficit_patch(i) = value_patch - end if - end do - - do fi = 1,num_column - i = filter_column(fi) - this%rootc_col(i) = value_column - this%leafc_col(i) = value_column - this%deadstemc_col(i) = value_column - this%fuelc_col(i) = value_column - this%fuelc_crop_col(i) = value_column - this%totvegc_col(i) = value_column - this%totc_p2c_col(i) = value_column - this%totc_col(i) = value_column - this%totecosysc_col(i) = value_column - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine ZeroDwt( this, bounds ) - ! - ! !DESCRIPTION - ! Initialize variables needed for dynamic land use. - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - !----------------------------------------------------------------------- - - do p = bounds%begp,bounds%endp - this%dispvegc_patch(p) = 0._r8 - this%storvegc_patch(p) = 0._r8 - this%totc_patch(p) = 0._r8 - end do - - end subroutine ZeroDwt - - !----------------------------------------------------------------------- - subroutine Summary_carbonstate(this, bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_cwdc_col, soilbiogeochem_totlitc_col, soilbiogeochem_totsomc_col, & - soilbiogeochem_ctrunc_col) - ! - ! !USES: - use subgridAveMod, only : p2c - use clm_time_manager , only : get_nstep - - ! - ! !DESCRIPTION: - ! Perform patch and column-level carbon summary calculations - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - 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 - real(r8) , intent(in) :: soilbiogeochem_cwdc_col(bounds%begc:) - real(r8) , intent(in) :: soilbiogeochem_totlitc_col(bounds%begc:) - real(r8) , intent(in) :: soilbiogeochem_totsomc_col(bounds%begc:) - real(r8) , intent(in) :: soilbiogeochem_ctrunc_col(bounds%begc:) - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,k,l ! indices - integer :: fp,fc ! lake filter indices - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(soilbiogeochem_cwdc_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(soilbiogeochem_totlitc_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(soilbiogeochem_totsomc_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(soilbiogeochem_ctrunc_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - ! calculate patch -level summary of carbon state - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! displayed vegetation carbon, excluding storage and cpool (DISPVEGC) - this%dispvegc_patch(p) = & - this%leafc_patch(p) + & - this%frootc_patch(p) + & - this%livestemc_patch(p) + & - this%deadstemc_patch(p) + & - this%livecrootc_patch(p) + & - this%deadcrootc_patch(p) - - ! stored vegetation carbon, excluding cpool (STORVEGC) - this%storvegc_patch(p) = & - this%cpool_patch(p) + & - this%leafc_storage_patch(p) + & - this%frootc_storage_patch(p) + & - this%livestemc_storage_patch(p) + & - this%deadstemc_storage_patch(p) + & - this%livecrootc_storage_patch(p) + & - this%deadcrootc_storage_patch(p) + & - this%leafc_xfer_patch(p) + & - this%frootc_xfer_patch(p) + & - this%livestemc_xfer_patch(p) + & - this%deadstemc_xfer_patch(p) + & - this%livecrootc_xfer_patch(p) + & - this%deadcrootc_xfer_patch(p) + & - this%gresp_storage_patch(p) + & - this%gresp_xfer_patch(p) - - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%storvegc_patch(p) = & - this%storvegc_patch(p) + & - this%grainc_storage_patch(p) + & - this%grainc_xfer_patch(p) - - this%dispvegc_patch(p) = & - this%dispvegc_patch(p) + & - this%grainc_patch(p) - end if - - ! total vegetation carbon, excluding cpool (TOTVEGC) - this%totvegc_patch(p) = & - this%dispvegc_patch(p) + & - this%storvegc_patch(p) - - ! total patch-level carbon, including xsmrpool, ctrunc - this%totc_patch(p) = & - this%totvegc_patch(p) + & - this%xsmrpool_patch(p) + & - this%ctrunc_patch(p) - - if (use_crop) then - this%totc_patch(p) = this%totc_patch(p) + this%cropseedc_deficit_patch(p) - end if - - ! (WOODC) - wood C - this%woodc_patch(p) = & - this%deadstemc_patch(p) + & - this%livestemc_patch(p) + & - this%deadcrootc_patch(p) + & - this%livecrootc_patch(p) - - end do - - ! -------------------------------------------- - ! column level summary - ! -------------------------------------------- - - call p2c(bounds, num_soilc, filter_soilc, & - this%totvegc_patch(bounds%begp:bounds%endp), & - this%totvegc_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%totc_patch(bounds%begp:bounds%endp), & - this%totc_p2c_col(bounds%begc:bounds%endc)) - - do fc = 1,num_allc - c = filter_allc(fc) - - ! total ecosystem carbon, including veg but excluding cpool (TOTECOSYSC) - this%totecosysc_col(c) = & - soilbiogeochem_cwdc_col(c) + & - soilbiogeochem_totlitc_col(c) + & - soilbiogeochem_totsomc_col(c) + & - this%totvegc_col(c) - - ! total column carbon, including veg and cpool (TOTCOLC) - this%totc_col(c) = this%totc_p2c_col(c) + & - soilbiogeochem_cwdc_col(c) + & - soilbiogeochem_totlitc_col(c) + & - soilbiogeochem_totsomc_col(c) + & - soilbiogeochem_ctrunc_col(c) - - end do - - end subroutine Summary_carbonstate - - !----------------------------------------------------------------------- - subroutine DynamicPatchAdjustments(this, bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - patch_state_updater, & - leafc_seed, deadstemc_seed, & - conv_cflux, wood_product_cflux, crop_product_cflux, & - dwt_frootc_to_litter, & - dwt_livecrootc_to_litter, & - dwt_deadcrootc_to_litter, & - dwt_leafc_seed, & - dwt_deadstemc_seed) - ! - ! !DESCRIPTION: - ! Adjust state variables and compute associated fluxes when patch areas change due to - ! dynamic landuse - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnveg_carbonstate_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp_with_inactive ! number of points in filter - integer , intent(in) :: filter_soilp_with_inactive(:) ! soil patch filter that includes inactive points - type(patch_state_updater_type) , intent(in) :: patch_state_updater - real(r8) , intent(in) :: leafc_seed ! seed amount for leaf C - real(r8) , intent(in) :: deadstemc_seed ! seed amount for deadstem C - real(r8) , intent(inout) :: conv_cflux( bounds%begp: ) ! patch-level conversion C flux to atm (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: wood_product_cflux( bounds%begp: ) ! patch-level product C flux (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: crop_product_cflux( bounds%begp: ) ! patch-level crop product C flux (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: dwt_frootc_to_litter( bounds%begp: ) ! patch-level fine root C to litter (expressed per unit COLUMN area) - real(r8) , intent(inout) :: dwt_livecrootc_to_litter( bounds%begp: ) ! patch-level live coarse root C to litter (expressed per unit COLUMN area) - real(r8) , intent(inout) :: dwt_deadcrootc_to_litter( bounds%begp: ) ! patch-level live coarse root C to litter (expressed per unit COLUMN area) - real(r8) , intent(inout) :: dwt_leafc_seed( bounds%begp: ) ! patch-level mass gain due to seeding of new area: leaf C (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: dwt_deadstemc_seed( bounds%begp: ) ! patch-level mass gain due to seeding of new area: deadstem C (expressed per unit GRIDCELL area) - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - logical :: old_weight_was_zero(bounds%begp:bounds%endp) - logical :: patch_grew(bounds%begp:bounds%endp) - - ! The following are only set for growing patches: - real(r8) :: seed_leafc_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leafc_storage_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leafc_xfer_patch(bounds%begp:bounds%endp) - real(r8) :: seed_deadstemc_patch(bounds%begp:bounds%endp) - - character(len=*), parameter :: subname = 'DynamicPatchAdjustments' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - SHR_ASSERT_ALL((ubound(conv_cflux) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wood_product_cflux) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(crop_product_cflux) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_frootc_to_litter) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_livecrootc_to_litter) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_deadcrootc_to_litter) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_leafc_seed) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_deadstemc_seed) == (/endp/)), errMsg(sourcefile, __LINE__)) - - old_weight_was_zero = patch_state_updater%old_weight_was_zero(bounds) - patch_grew = patch_state_updater%patch_grew(bounds) - - call ComputeSeedAmounts(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - species = this%species, & - leafc_seed = leafc_seed, & - deadstemc_seed = deadstemc_seed, & - leaf_patch = this%leafc_patch(begp:endp), & - leaf_storage_patch = this%leafc_storage_patch(begp:endp), & - leaf_xfer_patch = this%leafc_xfer_patch(begp:endp), & - - ! Calculations only needed for patches that grew: - compute_here_patch = patch_grew(begp:endp), & - - ! For patches that previously had zero area, ignore the current state for the - ! sake of computing leaf proportions: - ignore_current_state_patch = old_weight_was_zero(begp:endp), & - - seed_leaf_patch = seed_leafc_patch(begp:endp), & - seed_leaf_storage_patch = seed_leafc_storage_patch(begp:endp), & - seed_leaf_xfer_patch = seed_leafc_xfer_patch(begp:endp), & - seed_deadstem_patch = seed_deadstemc_patch(begp:endp)) - - call update_patch_state( & - var = this%leafc_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp), & - seed = seed_leafc_patch(begp:endp), & - seed_addition = dwt_leafc_seed(begp:endp)) - - call update_patch_state( & - var = this%leafc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp), & - seed = seed_leafc_storage_patch(begp:endp), & - seed_addition = dwt_leafc_seed(begp:endp)) - - call update_patch_state( & - var = this%leafc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp), & - seed = seed_leafc_xfer_patch(begp:endp), & - seed_addition = dwt_leafc_seed(begp:endp)) - - call update_patch_state( & - var = this%frootc_patch(begp:endp), & - flux_out_col_area = dwt_frootc_to_litter(begp:endp)) - - call update_patch_state( & - var = this%frootc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%frootc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%livestemc_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%livestemc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%livestemc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call patch_state_updater%update_patch_state_partition_flux_by_type(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - flux1_fraction_by_pft_type = pftcon%pconv, & - var = this%deadstemc_patch(begp:endp), & - flux1_out = conv_cflux(begp:endp), & - flux2_out = wood_product_cflux(begp:endp), & - seed = seed_deadstemc_patch(begp:endp), & - seed_addition = dwt_deadstemc_seed(begp:endp)) - - call update_patch_state( & - var = this%deadstemc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%deadstemc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%livecrootc_patch(begp:endp), & - flux_out_col_area = dwt_livecrootc_to_litter(begp:endp)) - - call update_patch_state( & - var = this%livecrootc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%livecrootc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%deadcrootc_patch(begp:endp), & - flux_out_col_area = dwt_deadcrootc_to_litter(begp:endp)) - - call update_patch_state( & - var = this%deadcrootc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%deadcrootc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%gresp_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%gresp_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%cpool_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%xsmrpool_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%ctrunc_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - if (use_crop) then - call update_patch_state( & - var = this%grainc_patch(begp:endp), & - flux_out_grc_area = crop_product_cflux(begp:endp)) - - call update_patch_state( & - var = this%grainc_storage_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - call update_patch_state( & - var = this%grainc_xfer_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - - if (use_crop) then - ! This is a negative pool. So any deficit that we haven't repaid gets sucked out - ! of the atmosphere. - call update_patch_state( & - var = this%cropseedc_deficit_patch(begp:endp), & - flux_out_grc_area = conv_cflux(begp:endp)) - end if - end if - - contains - subroutine update_patch_state(var, flux_out_col_area, flux_out_grc_area, & - seed, seed_addition) - ! Wraps call to update_patch_state, in order to remove duplication - real(r8), intent(inout) :: var( bounds%begp: ) - real(r8), intent(inout), optional :: flux_out_col_area( bounds%begp: ) - real(r8), intent(inout), optional :: flux_out_grc_area( bounds%begp: ) - real(r8), intent(in), optional :: seed( bounds%begp: ) - real(r8), intent(inout), optional :: seed_addition( bounds%begp: ) - - call patch_state_updater%update_patch_state(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - var = var, & - flux_out_col_area = flux_out_col_area, & - flux_out_grc_area = flux_out_grc_area, & - seed = seed, & - seed_addition = seed_addition) - end subroutine update_patch_state - - end subroutine DynamicPatchAdjustments - -end module CNVegCarbonStateType diff --git a/src/biogeochem/CNVegComputeSeedMod.F90 b/src/biogeochem/CNVegComputeSeedMod.F90 deleted file mode 100644 index 01cf471e20..0000000000 --- a/src/biogeochem/CNVegComputeSeedMod.F90 +++ /dev/null @@ -1,259 +0,0 @@ -module CNVegComputeSeedMod - - !----------------------------------------------------------------------- - ! Module to compute seed amounts for new patch areas - ! - ! !USES: -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon, noveg - use clm_varcon , only : c3_r2, c4_r2, c14ratio - use clm_varctl , only : iulog - use PatchType , only : patch - use abortutils , only : endrun - use CNSpeciesMod , only : CN_SPECIES_C12, CN_SPECIES_C13, CN_SPECIES_C14, CN_SPECIES_N - ! - ! !PUBLIC ROUTINES: - implicit none - private - - public :: ComputeSeedAmounts - - ! !PRIVATE ROUTINES: - - private :: SpeciesTypeMultiplier - private :: LeafProportions ! compute leaf proportions (leaf, storage and xfer) - - ! !PRIVATE DATA: - - integer, parameter :: COMPONENT_LEAF = 1 - integer, parameter :: COMPONENT_DEADWOOD = 2 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine ComputeSeedAmounts(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - species, & - leafc_seed, deadstemc_seed, & - leaf_patch, leaf_storage_patch, leaf_xfer_patch, & - compute_here_patch, ignore_current_state_patch, & - seed_leaf_patch, seed_leaf_storage_patch, seed_leaf_xfer_patch, & - seed_deadstem_patch) - ! - ! !DESCRIPTION: - ! Compute seed amounts for patches that increase in area, for various variables, for - ! the given species (c12, c13, c14 or n). - ! - ! The output variables are only set for patches inside the filter, where - ! compute_here_patch is true; for other patches, they remain at their original values. - ! - ! Note that, regardless of the species, leafc_seed and deadstemc_seed are specified - ! in terms of gC/m2; these amounts are converted to the amount of the given species - ! here. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp_with_inactive ! number of points in filter - integer , intent(in) :: filter_soilp_with_inactive(:) ! soil patch filter that includes inactive points - integer , intent(in) :: species ! which C/N species we're operating on; should be one of the values in CNSpeciesMod - real(r8) , intent(in) :: leafc_seed ! seed amount for leaf C - real(r8) , intent(in) :: deadstemc_seed ! seed amount for deadstem C - real(r8) , intent(in) :: leaf_patch( bounds%begp: ) ! current leaf C or N content (g/m2) - real(r8) , intent(in) :: leaf_storage_patch( bounds%begp: ) ! current leaf C or N storage content (g/m2) - real(r8) , intent(in) :: leaf_xfer_patch( bounds%begp: ) ! current leaf C or N xfer content (g/m2) - - ! whether to compute outputs for each patch - logical, intent(in) :: compute_here_patch( bounds%begp: ) - - ! If ignore_current_state is true, then use default leaf proportions rather than - ! proportions based on current state. - logical, intent(in) :: ignore_current_state_patch( bounds%begp: ) - - real(r8), intent(inout) :: seed_leaf_patch( bounds%begp: ) ! seed amount for leaf itself for this species (g/m2) - real(r8), intent(inout) :: seed_leaf_storage_patch( bounds%begp: ) ! seed amount for leaf storage for this species (g/m2) - real(r8), intent(inout) :: seed_leaf_xfer_patch( bounds%begp: ) ! seed amount for leaf xfer for this species (g/m2) - real(r8), intent(inout) :: seed_deadstem_patch( bounds%begp: ) ! seed amount for deadstem for this species (g/m2) - ! - ! !LOCAL VARIABLES: - integer :: fp, p - integer :: begp, endp - real(r8) :: my_leaf_seed - real(r8) :: my_deadstem_seed - integer :: pft_type - real(r8) :: pleaf - real(r8) :: pstor - real(r8) :: pxfer - - character(len=*), parameter :: subname = 'ComputeSeedAmounts' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - SHR_ASSERT_ALL((ubound(leaf_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leaf_storage_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leaf_xfer_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(compute_here_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ignore_current_state_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_leaf_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_leaf_storage_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_leaf_xfer_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(seed_deadstem_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - - - do fp = 1, num_soilp_with_inactive - p = filter_soilp_with_inactive(fp) - - if (compute_here_patch(p)) then - - my_leaf_seed = 0._r8 - my_deadstem_seed = 0._r8 - - pft_type = patch%itype(p) - - call LeafProportions( & - ignore_current_state = ignore_current_state_patch(p), & - pft_type = pft_type, & - leaf = leaf_patch(p), & - leaf_storage = leaf_storage_patch(p), & - leaf_xfer = leaf_xfer_patch(p), & - pleaf = pleaf, & - pstorage = pstor, & - pxfer = pxfer) - - if (pft_type /= noveg) then - my_leaf_seed = leafc_seed * & - SpeciesTypeMultiplier(species, pft_type, COMPONENT_LEAF) - if (pftcon%woody(pft_type) == 1._r8) then - my_deadstem_seed = deadstemc_seed * & - SpeciesTypeMultiplier(species, pft_type, COMPONENT_DEADWOOD) - end if - end if - - seed_leaf_patch(p) = my_leaf_seed * pleaf - seed_leaf_storage_patch(p) = my_leaf_seed * pstor - seed_leaf_xfer_patch(p) = my_leaf_seed * pxfer - seed_deadstem_patch(p) = my_deadstem_seed - end if - - end do - - end subroutine ComputeSeedAmounts - - - !----------------------------------------------------------------------- - function SpeciesTypeMultiplier(species, pft_type, component) result(multiplier) - ! - ! !DESCRIPTION: - ! Returns a multiplier based on the species type. This multiplier is - ! meant to be applied to some state variable expressed in terms of g C, translating - ! this value into an appropriate value for c13, c14 or n. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) :: multiplier ! function result - integer, intent(in) :: species ! which C/N species we're operating on; should be one of the values in CNSpeciesMod - integer, intent(in) :: pft_type - integer, intent(in) :: component ! which plant component; should be one of the COMPONENT_* parameters defined in this module - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'SpeciesTypeMultiplier' - !----------------------------------------------------------------------- - - select case (species) - case (CN_SPECIES_C12) - multiplier = 1._r8 - - case (CN_SPECIES_C13) - if (pftcon%c3psn(pft_type) == 1._r8) then - multiplier = c3_r2 - else - multiplier = c4_r2 - end if - - case (CN_SPECIES_C14) - ! 14c state is initialized assuming initial "modern" 14C of 1.e-12 - multiplier = c14ratio - - case (CN_SPECIES_N) - select case (component) - case (COMPONENT_LEAF) - multiplier = 1._r8 / pftcon%leafcn(pft_type) - case (COMPONENT_DEADWOOD) - multiplier = 1._r8 / pftcon%deadwdcn(pft_type) - case default - write(iulog,*) subname//' ERROR: unknown component: ', component - call endrun(subname//': unknown component') - end select - - case default - write(iulog,*) subname//' ERROR: unknown species: ', species - call endrun(subname//': unknown species') - end select - - end function SpeciesTypeMultiplier - - - !----------------------------------------------------------------------- - subroutine LeafProportions(ignore_current_state, & - pft_type, & - leaf, leaf_storage, leaf_xfer, & - pleaf, pstorage, pxfer) - ! - ! !DESCRIPTION: - ! Compute leaf proportions (leaf, storage and xfer) - ! - ! If ignore_current_state is true, then use default proportions rather than - ! proportions based on current state. (Also use default proportions if total leaf mass - ! is 0 for this patch.) - ! - ! !USES: - ! - ! !ARGUMENTS: - logical, intent(in) :: ignore_current_state ! see comment above - integer , intent(in) :: pft_type - real(r8), intent(in) :: leaf ! g/m2 leaf C or N - real(r8), intent(in) :: leaf_storage ! g/m2 leaf C or N storage - real(r8), intent(in) :: leaf_xfer ! g/m2 leaf C or N transfer - - real(r8), intent(out) :: pleaf ! proportion in leaf itself - real(r8), intent(out) :: pstorage ! proportion in leaf storage - real(r8), intent(out) :: pxfer ! proportion in leaf xfer - ! - ! !LOCAL VARIABLES: - real(r8) :: tot_leaf - - character(len=*), parameter :: subname = 'LeafProportions' - !----------------------------------------------------------------------- - - tot_leaf = leaf + leaf_storage + leaf_xfer - pleaf = 0._r8 - pstorage = 0._r8 - pxfer = 0._r8 - - if (tot_leaf == 0._r8 .or. ignore_current_state) then - if (pftcon%evergreen(pft_type) == 1._r8) then - pleaf = 1._r8 - else - pstorage = 1._r8 - end if - else - pleaf = leaf/tot_leaf - pstorage = leaf_storage/tot_leaf - pxfer = leaf_xfer/tot_leaf - end if - - end subroutine LeafProportions - -end module CNVegComputeSeedMod diff --git a/src/biogeochem/CNVegNitrogenFluxType.F90 b/src/biogeochem/CNVegNitrogenFluxType.F90 deleted file mode 100644 index 47b620bf91..0000000000 --- a/src/biogeochem/CNVegNitrogenFluxType.F90 +++ /dev/null @@ -1,1881 +0,0 @@ -module CNVegNitrogenFluxType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp_full, nlevdecomp - use clm_varcon , only : spval, ispval, dzsoi_decomp - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_crop - use CNSharedParamsMod , only : use_fun - use decompMod , only : bounds_type - use abortutils , only : endrun - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: cnveg_nitrogenflux_type - - ! gap mortality fluxes - real(r8), pointer :: m_leafn_to_litter_patch (:) ! patch leaf N mortality (gN/m2/s) - real(r8), pointer :: m_frootn_to_litter_patch (:) ! patch fine root N mortality (gN/m2/s) - real(r8), pointer :: m_leafn_storage_to_litter_patch (:) ! patch leaf N storage mortality (gN/m2/s) - real(r8), pointer :: m_frootn_storage_to_litter_patch (:) ! patch fine root N storage mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_storage_to_litter_patch (:) ! patch live stem N storage mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_storage_to_litter_patch (:) ! patch dead stem N storage mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_storage_to_litter_patch (:) ! patch live coarse root N storage mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_storage_to_litter_patch (:) ! patch dead coarse root N storage mortality (gN/m2/s) - real(r8), pointer :: m_leafn_xfer_to_litter_patch (:) ! patch leaf N transfer mortality (gN/m2/s) - real(r8), pointer :: m_frootn_xfer_to_litter_patch (:) ! patch fine root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_xfer_to_litter_patch (:) ! patch live stem N transfer mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_xfer_to_litter_patch (:) ! patch dead stem N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_xfer_to_litter_patch (:) ! patch live coarse root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_xfer_to_litter_patch (:) ! patch dead coarse root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_to_litter_patch (:) ! patch live stem N mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_to_litter_patch (:) ! patch dead stem N mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_to_litter_patch (:) ! patch live coarse root N mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_litter_patch (:) ! patch dead coarse root N mortality (gN/m2/s) - real(r8), pointer :: m_retransn_to_litter_patch (:) ! patch retranslocated N pool mortality (gN/m2/s) - - ! harvest fluxes - real(r8), pointer :: hrv_leafn_to_litter_patch (:) ! patch leaf N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_to_litter_patch (:) ! patch fine root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_leafn_storage_to_litter_patch (:) ! patch leaf N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_storage_to_litter_patch (:) ! patch fine root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_storage_to_litter_patch (:) ! patch live stem N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_storage_to_litter_patch (:) ! patch dead stem N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_storage_to_litter_patch (:) ! patch live coarse root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_storage_to_litter_patch (:) ! patch dead coarse root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_leafn_xfer_to_litter_patch (:) ! patch leaf N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_xfer_to_litter_patch (:) ! patch fine root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_xfer_to_litter_patch (:) ! patch live stem N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_xfer_to_litter_patch (:) ! patch dead stem N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_xfer_to_litter_patch (:) ! patch live coarse root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litter_patch (:) ! patch dead coarse root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_to_litter_patch (:) ! patch live stem N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_to_litter_patch (:) ! patch live coarse root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_to_litter_patch (:) ! patch dead coarse root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_retransn_to_litter_patch (:) ! patch retranslocated N pool harvest mortality (gN/m2/s) - real(r8), pointer :: grainn_to_cropprodn_patch (:) ! patch grain N to crop product pool (gN/m2/s) - real(r8), pointer :: grainn_to_cropprodn_col (:) ! col grain N to crop product pool (gN/m2/s) - real(r8), pointer :: m_n_to_litr_met_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter labile N by fire (gN/m3/s) - real(r8), pointer :: m_n_to_litr_cel_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter cellulose N by fire (gN/m3/s) - real(r8), pointer :: m_n_to_litr_lig_fire_col (:,:) ! col N from leaf, froot, xfer and storage N to litter lignin N by fire (gN/m3/s) - real(r8), pointer :: harvest_n_to_litr_met_n_col (:,:) ! col N fluxes associated with harvest to litter metabolic pool (gN/m3/s) - real(r8), pointer :: harvest_n_to_litr_cel_n_col (:,:) ! col N fluxes associated with harvest to litter cellulose pool (gN/m3/s) - real(r8), pointer :: harvest_n_to_litr_lig_n_col (:,:) ! col N fluxes associated with harvest to litter lignin pool (gN/m3/s) - real(r8), pointer :: harvest_n_to_cwdn_col (:,:) ! col N fluxes associated with harvest to CWD pool (gN/m3/s) - - ! fire N fluxes - real(r8), pointer :: m_decomp_npools_to_fire_vr_col (:,:,:) ! col vertically-resolved decomposing N fire loss (gN/m3/s) - real(r8), pointer :: m_decomp_npools_to_fire_col (:,:) ! col vertically-integrated (diagnostic) decomposing N fire loss (gN/m2/s) - real(r8), pointer :: m_leafn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from leafn - real(r8), pointer :: m_leafn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from leafn_storage - real(r8), pointer :: m_leafn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from leafn_xfer - real(r8), pointer :: m_livestemn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livestemn - real(r8), pointer :: m_livestemn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livestemn_storage - real(r8), pointer :: m_livestemn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livestemn_xfer - real(r8), pointer :: m_deadstemn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadstemn - real(r8), pointer :: m_deadstemn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadstemn_storage - real(r8), pointer :: m_deadstemn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadstemn_xfer - real(r8), pointer :: m_frootn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from frootn - real(r8), pointer :: m_frootn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from frootn_storage - real(r8), pointer :: m_frootn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from frootn_xfer - real(r8), pointer :: m_livecrootn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from m_livecrootn_to_fire - real(r8), pointer :: m_livecrootn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livecrootn_storage - real(r8), pointer :: m_livecrootn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from livecrootn_xfer - real(r8), pointer :: m_deadcrootn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadcrootn - real(r8), pointer :: m_deadcrootn_storage_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadcrootn_storage - real(r8), pointer :: m_deadcrootn_xfer_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from deadcrootn_xfer - real(r8), pointer :: m_retransn_to_fire_patch (:) ! patch (gN/m2/s) fire N emissions from retransn - real(r8), pointer :: m_leafn_to_litter_fire_patch (:) ! patch (gN/m2/s) from leafn to litter N due to fire - real(r8), pointer :: m_leafn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from leafn_storage to litter N due to fire - real(r8), pointer :: m_leafn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from leafn_xfer to litter N due to fire - real(r8), pointer :: m_livestemn_to_litter_fire_patch (:) ! patch (gN/m2/s) from livestemn to litter N due to fire - real(r8), pointer :: m_livestemn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from livestemn_storage to litter N due to fire - real(r8), pointer :: m_livestemn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from livestemn_xfer to litter N due to fire - real(r8), pointer :: m_livestemn_to_deadstemn_fire_patch (:) ! patch (gN/m2/s) from livestemn to deadstemn N due to fire - real(r8), pointer :: m_deadstemn_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadstemn to litter N due to fire - real(r8), pointer :: m_deadstemn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadstemn_storage to litter N due to fire - real(r8), pointer :: m_deadstemn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadstemn_xfer to litter N due to fire - real(r8), pointer :: m_frootn_to_litter_fire_patch (:) ! patch (gN/m2/s) from frootn to litter N due to fire - real(r8), pointer :: m_frootn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from frootn_storage to litter N due to fire - real(r8), pointer :: m_frootn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from frootn_xfer to litter N due to fire - real(r8), pointer :: m_livecrootn_to_litter_fire_patch (:) ! patch (gN/m2/s) from livecrootn to litter N due to fire - real(r8), pointer :: m_livecrootn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from livecrootn_storage to litter N due to fire - real(r8), pointer :: m_livecrootn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from livecrootn_xfer to litter N due to fire - real(r8), pointer :: m_livecrootn_to_deadcrootn_fire_patch (:) ! patch (gN/m2/s) from livecrootn_xfer to deadcrootn due to fire - real(r8), pointer :: m_deadcrootn_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadcrootn to deadcrootn due to fire - real(r8), pointer :: m_deadcrootn_storage_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadcrootn_storage to deadcrootn due to fire - real(r8), pointer :: m_deadcrootn_xfer_to_litter_fire_patch (:) ! patch (gN/m2/s) from deadcrootn_xfer to deadcrootn due to fire - real(r8), pointer :: m_retransn_to_litter_fire_patch (:) ! patch (gN/m2/s) from retransn to deadcrootn due to fire - real(r8), pointer :: fire_nloss_patch (:) ! patch total patch-level fire N loss (gN/m2/s) - real(r8), pointer :: fire_nloss_col (:) ! col total column-level fire N loss (gN/m2/s) - real(r8), pointer :: fire_nloss_p2c_col (:) ! col patch2col column-level fire N loss (gN/m2/s) (p2c) - real(r8), pointer :: fire_mortality_n_to_cwdn_col (:,:) ! col N fluxes associated with fire mortality to CWD pool (gN/m3/s) - - ! phenology fluxes from transfer pool - real(r8), pointer :: grainn_xfer_to_grainn_patch (:) ! patch grain N growth from storage for prognostic crop model (gN/m2/s) - real(r8), pointer :: leafn_xfer_to_leafn_patch (:) ! patch leaf N growth from storage (gN/m2/s) - real(r8), pointer :: frootn_xfer_to_frootn_patch (:) ! patch fine root N growth from storage (gN/m2/s) - real(r8), pointer :: livestemn_xfer_to_livestemn_patch (:) ! patch live stem N growth from storage (gN/m2/s) - real(r8), pointer :: deadstemn_xfer_to_deadstemn_patch (:) ! patch dead stem N growth from storage (gN/m2/s) - real(r8), pointer :: livecrootn_xfer_to_livecrootn_patch (:) ! patch live coarse root N growth from storage (gN/m2/s) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn_patch (:) ! patch dead coarse root N growth from storage (gN/m2/s) - - ! litterfall fluxes - real(r8), pointer :: livestemn_to_litter_patch (:) ! patch livestem N to litter (gN/m2/s) - real(r8), pointer :: grainn_to_food_patch (:) ! patch grain N to food for prognostic crop (gN/m2/s) - real(r8), pointer :: grainn_to_seed_patch (:) ! patch grain N to seed for prognostic crop (gN/m2/s) - real(r8), pointer :: leafn_to_litter_patch (:) ! patch leaf N litterfall (gN/m2/s) - real(r8), pointer :: leafn_to_retransn_patch (:) ! patch leaf N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: frootn_to_retransn_patch (:) ! patch fine root N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: frootn_to_litter_patch (:) ! patch fine root N litterfall (gN/m2/s) - - ! allocation fluxes - real(r8), pointer :: retransn_to_npool_patch (:) ! patch deployment of retranslocated N (gN/m2/s) - real(r8), pointer :: free_retransn_to_npool_patch (:) ! patch deployment of free retranslocated N (gN/m2/s) - real(r8), pointer :: sminn_to_npool_patch (:) ! patch deployment of soil mineral N uptake (gN/m2/s) - real(r8), pointer :: npool_to_grainn_patch (:) ! patch allocation to grain N for prognostic crop (gN/m2/s) - real(r8), pointer :: npool_to_grainn_storage_patch (:) ! patch allocation to grain N storage for prognostic crop (gN/m2/s) - real(r8), pointer :: npool_to_leafn_patch (:) ! patch allocation to leaf N (gN/m2/s) - real(r8), pointer :: npool_to_leafn_storage_patch (:) ! patch allocation to leaf N storage (gN/m2/s) - real(r8), pointer :: npool_to_frootn_patch (:) ! patch allocation to fine root N (gN/m2/s) - real(r8), pointer :: npool_to_frootn_storage_patch (:) ! patch allocation to fine root N storage (gN/m2/s) - real(r8), pointer :: npool_to_livestemn_patch (:) ! patch allocation to live stem N (gN/m2/s) - real(r8), pointer :: npool_to_livestemn_storage_patch (:) ! patch allocation to live stem N storage (gN/m2/s) - real(r8), pointer :: npool_to_deadstemn_patch (:) ! patch allocation to dead stem N (gN/m2/s) - real(r8), pointer :: npool_to_deadstemn_storage_patch (:) ! patch allocation to dead stem N storage (gN/m2/s) - real(r8), pointer :: npool_to_livecrootn_patch (:) ! patch allocation to live coarse root N (gN/m2/s) - real(r8), pointer :: npool_to_livecrootn_storage_patch (:) ! patch allocation to live coarse root N storage (gN/m2/s) - real(r8), pointer :: npool_to_deadcrootn_patch (:) ! patch allocation to dead coarse root N (gN/m2/s) - real(r8), pointer :: npool_to_deadcrootn_storage_patch (:) ! patch allocation to dead coarse root N storage (gN/m2/s) - - ! annual turnover of storage to transfer pools - real(r8), pointer :: grainn_storage_to_xfer_patch (:) ! patch grain N shift storage to transfer for prognostic crop (gN/m2/s) - real(r8), pointer :: leafn_storage_to_xfer_patch (:) ! patch leaf N shift storage to transfer (gN/m2/s) - real(r8), pointer :: frootn_storage_to_xfer_patch (:) ! patch fine root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: livestemn_storage_to_xfer_patch (:) ! patch live stem N shift storage to transfer (gN/m2/s) - real(r8), pointer :: deadstemn_storage_to_xfer_patch (:) ! patch dead stem N shift storage to transfer (gN/m2/s) - real(r8), pointer :: livecrootn_storage_to_xfer_patch (:) ! patch live coarse root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: deadcrootn_storage_to_xfer_patch (:) ! patch dead coarse root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: fert_patch (:) ! patch applied fertilizer (gN/m2/s) - real(r8), pointer :: fert_counter_patch (:) ! patch >0 fertilize; <=0 not - real(r8), pointer :: soyfixn_patch (:) ! patch soybean fixed N (gN/m2/s) - - ! turnover of livewood to deadwood, with retranslocation - real(r8), pointer :: livestemn_to_deadstemn_patch (:) ! patch live stem N turnover (gN/m2/s) - real(r8), pointer :: livestemn_to_retransn_patch (:) ! patch live stem N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: livecrootn_to_deadcrootn_patch (:) ! patch live coarse root N turnover (gN/m2/s) - real(r8), pointer :: livecrootn_to_retransn_patch (:) ! patch live coarse root N to retranslocated N pool (gN/m2/s) - - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: ndeploy_patch (:) ! patch total N deployed to growth and storage (gN/m2/s) - real(r8), pointer :: wood_harvestn_patch (:) ! patch total N losses to wood product pools (gN/m2/s) - real(r8), pointer :: wood_harvestn_col (:) ! col total N losses to wood product pools (gN/m2/s) (p2c) - ! phenology: litterfall and crop fluxes - real(r8), pointer :: phenology_n_to_litr_met_n_col (:,:) ! col N fluxes associated with phenology (litterfall and crop) to litter metabolic pool (gN/m3/s) - real(r8), pointer :: phenology_n_to_litr_cel_n_col (:,:) ! col N fluxes associated with phenology (litterfall and crop) to litter cellulose pool (gN/m3/s) - real(r8), pointer :: phenology_n_to_litr_lig_n_col (:,:) ! col N fluxes associated with phenology (litterfall and crop) to litter lignin pool (gN/m3/s) - - ! gap mortality fluxes - real(r8), pointer :: gap_mortality_n_to_litr_met_n_col (:,:) ! col N fluxes associated with gap mortality to litter metabolic pool (gN/m3/s) - real(r8), pointer :: gap_mortality_n_to_litr_cel_n_col (:,:) ! col N fluxes associated with gap mortality to litter cellulose pool (gN/m3/s) - real(r8), pointer :: gap_mortality_n_to_litr_lig_n_col (:,:) ! col N fluxes associated with gap mortality to litter lignin pool (gN/m3/s) - real(r8), pointer :: gap_mortality_n_to_cwdn_col (:,:) ! col N fluxes associated with gap mortality to CWD pool (gN/m3/s) - - ! dynamic landcover fluxes - real(r8), pointer :: dwt_seedn_to_leaf_patch (:) ! (gN/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedn_to_leaf_grc (:) ! (gN/m2/s) dwt_seedn_to_leaf_patch summed to the gridcell-level - real(r8), pointer :: dwt_seedn_to_deadstem_patch (:) ! (gN/m2/s) seed source to patch-level; although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_seedn_to_deadstem_grc (:) ! (gN/m2/s) dwt_seedn_to_deadstem_patch summed to the gridcell-level - real(r8), pointer :: dwt_conv_nflux_patch (:) ! (gN/m2/s) conversion N flux (immediate loss to atm); although this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_conv_nflux_grc (:) ! (gN/m2/s) dwt_conv_nflux_patch summed to the gridcell-level - real(r8), pointer :: dwt_wood_productn_gain_patch (:) ! patch (gN/m2/s) addition to wood product pools from landcover change; even though this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_crop_productn_gain_patch (:) ! patch (gN/m2/s) addition to crop product pool from landcover change; even though this is a patch-level flux, it is expressed per unit GRIDCELL area - real(r8), pointer :: dwt_frootn_to_litr_met_n_col (:,:) ! col (gN/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootn_to_litr_cel_n_col (:,:) ! col (gN/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootn_to_litr_lig_n_col (:,:) ! col (gN/m3/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_livecrootn_to_cwdn_col (:,:) ! col (gN/m3/s) live coarse root to CWD due to landcover change - real(r8), pointer :: dwt_deadcrootn_to_cwdn_col (:,:) ! col (gN/m3/s) dead coarse root to CWD due to landcover change - - ! crop fluxes - real(r8), pointer :: crop_seedn_to_leaf_patch (:) ! patch (gN/m2/s) seed source to leaf, for crops - - ! Misc - real(r8), pointer :: plant_ndemand_patch (:) ! N flux required to support initial GPP (gN/m2/s) - real(r8), pointer :: avail_retransn_patch (:) ! N flux available from retranslocation pool (gN/m2/s) - real(r8), pointer :: plant_nalloc_patch (:) ! total allocated N flux (gN/m2/s) - real(r8), pointer :: plant_ndemand_retrans_patch (:) ! The N demand pool generated for FUN2.0; mainly used for deciduous trees (gN/m2/s) - real(r8), pointer :: plant_ndemand_season_patch (:) ! The N demand pool for seasonal deciduous (gN/m2/s) - real(r8), pointer :: plant_ndemand_stress_patch (:) ! The N demand pool for stress deciduous (gN/m2/s) - real(r8), pointer :: Nactive_patch (:) ! N acquired by mycorrhizal uptake (gN/m2/s) - real(r8), pointer :: Nnonmyc_patch (:) ! N acquired by non-myc uptake (gN/m2/s) - real(r8), pointer :: Nam_patch (:) ! N acquired by AM plant (gN/m2/s) - real(r8), pointer :: Necm_patch (:) ! N acquired by ECM plant (gN/m2/s) - real(r8), pointer :: Nactive_no3_patch (:) ! N acquired by mycorrhizal uptake (gN/m2/s) - real(r8), pointer :: Nactive_nh4_patch (:) ! N acquired by mycorrhizal uptake (gN/m2/s) - real(r8), pointer :: Nnonmyc_no3_patch (:) ! N acquired by non-myc (gN/m2/s) - real(r8), pointer :: Nnonmyc_nh4_patch (:) ! N acquired by non-myc (gN/m2/s) - real(r8), pointer :: Nam_no3_patch (:) ! N acquired by AM plant (gN/m2/s) - real(r8), pointer :: Nam_nh4_patch (:) ! N acquired by AM plant (gN/m2/s) - real(r8), pointer :: Necm_no3_patch (:) ! N acquired by ECM plant (gN/m2/s) - real(r8), pointer :: Necm_nh4_patch (:) ! N acquired by ECM plant (gN/m2/s) - real(r8), pointer :: Nfix_patch (:) ! N acquired by Symbiotic BNF (gN/m2/s) - real(r8), pointer :: Npassive_patch (:) ! N acquired by passive uptake (gN/m2/s) - real(r8), pointer :: Nretrans_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nretrans_org_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nretrans_season_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nretrans_stress_patch (:) ! N acquired by retranslocation (gN/m2/s) - real(r8), pointer :: Nuptake_patch (:) ! Total N uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_patch (:) ! Total soil N uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_vr_patch (:,:) ! Total layer soil N uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_no3_vr_patch (:,:) ! Total layer no3 uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_nh4_vr_patch (:,:) ! Total layer nh4 uptake of FUN (gN/m2/s) - real(r8), pointer :: cost_nfix_patch (:) ! Average cost of fixation (gN/m2/s) - real(r8), pointer :: cost_nactive_patch (:) ! Average cost of active uptake (gN/m2/s) - real(r8), pointer :: cost_nretrans_patch (:) ! Average cost of retranslocation (gN/m2/s) - real(r8), pointer :: nuptake_npp_fraction_patch (:) ! frac of npp spent on N acquisition (gN/m2/s) - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , public :: ZeroDWT - procedure , public :: Summary => Summary_nitrogenflux - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type cnveg_nitrogenflux_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize patch nitrogen flux - ! - ! !ARGUMENTS: - class (cnveg_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%m_leafn_to_litter_patch (begp:endp)) ; this%m_leafn_to_litter_patch (:) = nan - allocate(this%m_frootn_to_litter_patch (begp:endp)) ; this%m_frootn_to_litter_patch (:) = nan - allocate(this%m_leafn_storage_to_litter_patch (begp:endp)) ; this%m_leafn_storage_to_litter_patch (:) = nan - allocate(this%m_frootn_storage_to_litter_patch (begp:endp)) ; this%m_frootn_storage_to_litter_patch (:) = nan - allocate(this%m_livestemn_storage_to_litter_patch (begp:endp)) ; this%m_livestemn_storage_to_litter_patch (:) = nan - allocate(this%m_deadstemn_storage_to_litter_patch (begp:endp)) ; this%m_deadstemn_storage_to_litter_patch (:) = nan - allocate(this%m_livecrootn_storage_to_litter_patch (begp:endp)) ; this%m_livecrootn_storage_to_litter_patch (:) = nan - allocate(this%m_deadcrootn_storage_to_litter_patch (begp:endp)) ; this%m_deadcrootn_storage_to_litter_patch (:) = nan - allocate(this%m_leafn_xfer_to_litter_patch (begp:endp)) ; this%m_leafn_xfer_to_litter_patch (:) = nan - allocate(this%m_frootn_xfer_to_litter_patch (begp:endp)) ; this%m_frootn_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemn_xfer_to_litter_patch (begp:endp)) ; this%m_livestemn_xfer_to_litter_patch (:) = nan - allocate(this%m_deadstemn_xfer_to_litter_patch (begp:endp)) ; this%m_deadstemn_xfer_to_litter_patch (:) = nan - allocate(this%m_livecrootn_xfer_to_litter_patch (begp:endp)) ; this%m_livecrootn_xfer_to_litter_patch (:) = nan - allocate(this%m_deadcrootn_xfer_to_litter_patch (begp:endp)) ; this%m_deadcrootn_xfer_to_litter_patch (:) = nan - allocate(this%m_livestemn_to_litter_patch (begp:endp)) ; this%m_livestemn_to_litter_patch (:) = nan - allocate(this%m_deadstemn_to_litter_patch (begp:endp)) ; this%m_deadstemn_to_litter_patch (:) = nan - allocate(this%m_livecrootn_to_litter_patch (begp:endp)) ; this%m_livecrootn_to_litter_patch (:) = nan - allocate(this%m_deadcrootn_to_litter_patch (begp:endp)) ; this%m_deadcrootn_to_litter_patch (:) = nan - allocate(this%m_retransn_to_litter_patch (begp:endp)) ; this%m_retransn_to_litter_patch (:) = nan - allocate(this%hrv_leafn_to_litter_patch (begp:endp)) ; this%hrv_leafn_to_litter_patch (:) = nan - allocate(this%hrv_frootn_to_litter_patch (begp:endp)) ; this%hrv_frootn_to_litter_patch (:) = nan - allocate(this%hrv_leafn_storage_to_litter_patch (begp:endp)) ; this%hrv_leafn_storage_to_litter_patch (:) = nan - allocate(this%hrv_frootn_storage_to_litter_patch (begp:endp)) ; this%hrv_frootn_storage_to_litter_patch (:) = nan - allocate(this%hrv_livestemn_storage_to_litter_patch (begp:endp)) ; this%hrv_livestemn_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadstemn_storage_to_litter_patch (begp:endp)) ; this%hrv_deadstemn_storage_to_litter_patch (:) = nan - allocate(this%hrv_livecrootn_storage_to_litter_patch (begp:endp)) ; this%hrv_livecrootn_storage_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootn_storage_to_litter_patch (begp:endp)) ; this%hrv_deadcrootn_storage_to_litter_patch (:) = nan - allocate(this%hrv_leafn_xfer_to_litter_patch (begp:endp)) ; this%hrv_leafn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_frootn_xfer_to_litter_patch (begp:endp)) ; this%hrv_frootn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livestemn_xfer_to_litter_patch (begp:endp)) ; this%hrv_livestemn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadstemn_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadstemn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livecrootn_xfer_to_litter_patch (begp:endp)) ; this%hrv_livecrootn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootn_xfer_to_litter_patch (begp:endp)) ; this%hrv_deadcrootn_xfer_to_litter_patch (:) = nan - allocate(this%hrv_livestemn_to_litter_patch (begp:endp)) ; this%hrv_livestemn_to_litter_patch (:) = nan - allocate(this%hrv_livecrootn_to_litter_patch (begp:endp)) ; this%hrv_livecrootn_to_litter_patch (:) = nan - allocate(this%hrv_deadcrootn_to_litter_patch (begp:endp)) ; this%hrv_deadcrootn_to_litter_patch (:) = nan - allocate(this%hrv_retransn_to_litter_patch (begp:endp)) ; this%hrv_retransn_to_litter_patch (:) = nan - - allocate(this%m_leafn_to_fire_patch (begp:endp)) ; this%m_leafn_to_fire_patch (:) = nan - allocate(this%m_leafn_storage_to_fire_patch (begp:endp)) ; this%m_leafn_storage_to_fire_patch (:) = nan - allocate(this%m_leafn_xfer_to_fire_patch (begp:endp)) ; this%m_leafn_xfer_to_fire_patch (:) = nan - allocate(this%m_livestemn_to_fire_patch (begp:endp)) ; this%m_livestemn_to_fire_patch (:) = nan - allocate(this%m_livestemn_storage_to_fire_patch (begp:endp)) ; this%m_livestemn_storage_to_fire_patch (:) = nan - allocate(this%m_livestemn_xfer_to_fire_patch (begp:endp)) ; this%m_livestemn_xfer_to_fire_patch (:) = nan - allocate(this%m_deadstemn_to_fire_patch (begp:endp)) ; this%m_deadstemn_to_fire_patch (:) = nan - allocate(this%m_deadstemn_storage_to_fire_patch (begp:endp)) ; this%m_deadstemn_storage_to_fire_patch (:) = nan - allocate(this%m_deadstemn_xfer_to_fire_patch (begp:endp)) ; this%m_deadstemn_xfer_to_fire_patch (:) = nan - allocate(this%m_frootn_to_fire_patch (begp:endp)) ; this%m_frootn_to_fire_patch (:) = nan - allocate(this%m_frootn_storage_to_fire_patch (begp:endp)) ; this%m_frootn_storage_to_fire_patch (:) = nan - allocate(this%m_frootn_xfer_to_fire_patch (begp:endp)) ; this%m_frootn_xfer_to_fire_patch (:) = nan - allocate(this%m_livecrootn_to_fire_patch (begp:endp)) ; - allocate(this%m_livecrootn_storage_to_fire_patch (begp:endp)) ; this%m_livecrootn_storage_to_fire_patch (:) = nan - allocate(this%m_livecrootn_xfer_to_fire_patch (begp:endp)) ; this%m_livecrootn_xfer_to_fire_patch (:) = nan - allocate(this%m_deadcrootn_to_fire_patch (begp:endp)) ; this%m_deadcrootn_to_fire_patch (:) = nan - allocate(this%m_deadcrootn_storage_to_fire_patch (begp:endp)) ; this%m_deadcrootn_storage_to_fire_patch (:) = nan - allocate(this%m_deadcrootn_xfer_to_fire_patch (begp:endp)) ; this%m_deadcrootn_xfer_to_fire_patch (:) = nan - allocate(this%m_retransn_to_fire_patch (begp:endp)) ; this%m_retransn_to_fire_patch (:) = nan - - allocate(this%m_leafn_to_litter_fire_patch (begp:endp)) ; this%m_leafn_to_litter_fire_patch (:) = nan - allocate(this%m_leafn_storage_to_litter_fire_patch (begp:endp)) ; this%m_leafn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_leafn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_leafn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_to_litter_fire_patch (begp:endp)) ; this%m_livestemn_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_storage_to_litter_fire_patch (begp:endp)) ; this%m_livestemn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livestemn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livestemn_to_deadstemn_fire_patch (begp:endp)) ; this%m_livestemn_to_deadstemn_fire_patch (:) = nan - allocate(this%m_deadstemn_to_litter_fire_patch (begp:endp)) ; this%m_deadstemn_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemn_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadstemn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadstemn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadstemn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_frootn_to_litter_fire_patch (begp:endp)) ; this%m_frootn_to_litter_fire_patch (:) = nan - allocate(this%m_frootn_storage_to_litter_fire_patch (begp:endp)) ; this%m_frootn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_frootn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_frootn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_to_litter_fire_patch (begp:endp)) ; this%m_livecrootn_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_storage_to_litter_fire_patch (begp:endp)) ; this%m_livecrootn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_livecrootn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_livecrootn_to_deadcrootn_fire_patch (begp:endp)) ; this%m_livecrootn_to_deadcrootn_fire_patch (:) = nan - allocate(this%m_deadcrootn_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootn_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootn_storage_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootn_storage_to_litter_fire_patch (:) = nan - allocate(this%m_deadcrootn_xfer_to_litter_fire_patch (begp:endp)) ; this%m_deadcrootn_xfer_to_litter_fire_patch (:) = nan - allocate(this%m_retransn_to_litter_fire_patch (begp:endp)) ; this%m_retransn_to_litter_fire_patch (:) = nan - - allocate(this%leafn_xfer_to_leafn_patch (begp:endp)) ; this%leafn_xfer_to_leafn_patch (:) = nan - allocate(this%frootn_xfer_to_frootn_patch (begp:endp)) ; this%frootn_xfer_to_frootn_patch (:) = nan - allocate(this%livestemn_xfer_to_livestemn_patch (begp:endp)) ; this%livestemn_xfer_to_livestemn_patch (:) = nan - allocate(this%deadstemn_xfer_to_deadstemn_patch (begp:endp)) ; this%deadstemn_xfer_to_deadstemn_patch (:) = nan - allocate(this%livecrootn_xfer_to_livecrootn_patch (begp:endp)) ; this%livecrootn_xfer_to_livecrootn_patch (:) = nan - allocate(this%deadcrootn_xfer_to_deadcrootn_patch (begp:endp)) ; this%deadcrootn_xfer_to_deadcrootn_patch (:) = nan - allocate(this%leafn_to_litter_patch (begp:endp)) ; this%leafn_to_litter_patch (:) = nan - allocate(this%leafn_to_retransn_patch (begp:endp)) ; this%leafn_to_retransn_patch (:) = nan - allocate(this%frootn_to_retransn_patch (begp:endp)) ; this%frootn_to_retransn_patch (:) = nan - allocate(this%frootn_to_litter_patch (begp:endp)) ; this%frootn_to_litter_patch (:) = nan - allocate(this%retransn_to_npool_patch (begp:endp)) ; this%retransn_to_npool_patch (:) = nan - allocate(this%free_retransn_to_npool_patch (begp:endp)) ; this%free_retransn_to_npool_patch (:) = nan - allocate(this%sminn_to_npool_patch (begp:endp)) ; this%sminn_to_npool_patch (:) = nan - - allocate(this%npool_to_leafn_patch (begp:endp)) ; this%npool_to_leafn_patch (:) = nan - allocate(this%npool_to_leafn_storage_patch (begp:endp)) ; this%npool_to_leafn_storage_patch (:) = nan - allocate(this%npool_to_frootn_patch (begp:endp)) ; this%npool_to_frootn_patch (:) = nan - allocate(this%npool_to_frootn_storage_patch (begp:endp)) ; this%npool_to_frootn_storage_patch (:) = nan - allocate(this%npool_to_livestemn_patch (begp:endp)) ; this%npool_to_livestemn_patch (:) = nan - allocate(this%npool_to_livestemn_storage_patch (begp:endp)) ; this%npool_to_livestemn_storage_patch (:) = nan - allocate(this%npool_to_deadstemn_patch (begp:endp)) ; this%npool_to_deadstemn_patch (:) = nan - allocate(this%npool_to_deadstemn_storage_patch (begp:endp)) ; this%npool_to_deadstemn_storage_patch (:) = nan - allocate(this%npool_to_livecrootn_patch (begp:endp)) ; this%npool_to_livecrootn_patch (:) = nan - allocate(this%npool_to_livecrootn_storage_patch (begp:endp)) ; this%npool_to_livecrootn_storage_patch (:) = nan - allocate(this%npool_to_deadcrootn_patch (begp:endp)) ; this%npool_to_deadcrootn_patch (:) = nan - allocate(this%npool_to_deadcrootn_storage_patch (begp:endp)) ; this%npool_to_deadcrootn_storage_patch (:) = nan - allocate(this%leafn_storage_to_xfer_patch (begp:endp)) ; this%leafn_storage_to_xfer_patch (:) = nan - allocate(this%frootn_storage_to_xfer_patch (begp:endp)) ; this%frootn_storage_to_xfer_patch (:) = nan - allocate(this%livestemn_storage_to_xfer_patch (begp:endp)) ; this%livestemn_storage_to_xfer_patch (:) = nan - allocate(this%deadstemn_storage_to_xfer_patch (begp:endp)) ; this%deadstemn_storage_to_xfer_patch (:) = nan - allocate(this%livecrootn_storage_to_xfer_patch (begp:endp)) ; this%livecrootn_storage_to_xfer_patch (:) = nan - allocate(this%deadcrootn_storage_to_xfer_patch (begp:endp)) ; this%deadcrootn_storage_to_xfer_patch (:) = nan - allocate(this%livestemn_to_deadstemn_patch (begp:endp)) ; this%livestemn_to_deadstemn_patch (:) = nan - allocate(this%livestemn_to_retransn_patch (begp:endp)) ; this%livestemn_to_retransn_patch (:) = nan - allocate(this%livecrootn_to_deadcrootn_patch (begp:endp)) ; this%livecrootn_to_deadcrootn_patch (:) = nan - allocate(this%livecrootn_to_retransn_patch (begp:endp)) ; this%livecrootn_to_retransn_patch (:) = nan - allocate(this%ndeploy_patch (begp:endp)) ; this%ndeploy_patch (:) = nan - allocate(this%wood_harvestn_patch (begp:endp)) ; this%wood_harvestn_patch (:) = nan - allocate(this%fire_nloss_patch (begp:endp)) ; this%fire_nloss_patch (:) = nan - allocate(this%npool_to_grainn_patch (begp:endp)) ; this%npool_to_grainn_patch (:) = nan - allocate(this%npool_to_grainn_storage_patch (begp:endp)) ; this%npool_to_grainn_storage_patch (:) = nan - allocate(this%livestemn_to_litter_patch (begp:endp)) ; this%livestemn_to_litter_patch (:) = nan - allocate(this%grainn_to_food_patch (begp:endp)) ; this%grainn_to_food_patch (:) = nan - allocate(this%grainn_to_seed_patch (begp:endp)) ; this%grainn_to_seed_patch (:) = nan - allocate(this%grainn_xfer_to_grainn_patch (begp:endp)) ; this%grainn_xfer_to_grainn_patch (:) = nan - allocate(this%grainn_storage_to_xfer_patch (begp:endp)) ; this%grainn_storage_to_xfer_patch (:) = nan - allocate(this%fert_patch (begp:endp)) ; this%fert_patch (:) = nan - allocate(this%fert_counter_patch (begp:endp)) ; this%fert_counter_patch (:) = nan - allocate(this%soyfixn_patch (begp:endp)) ; this%soyfixn_patch (:) = nan - - allocate(this%grainn_to_cropprodn_patch (begp:endp)) ; this%grainn_to_cropprodn_patch (:) = nan - allocate(this%grainn_to_cropprodn_col (begc:endc)) ; this%grainn_to_cropprodn_col (:) = nan - - allocate(this%fire_nloss_col (begc:endc)) ; this%fire_nloss_col (:) = nan - allocate(this%fire_nloss_p2c_col (begc:endc)) ; this%fire_nloss_p2c_col (:) = nan - - allocate(this%m_n_to_litr_met_fire_col (begc:endc,1:nlevdecomp_full)) ; this%m_n_to_litr_met_fire_col (:,:) = nan - allocate(this%m_n_to_litr_cel_fire_col (begc:endc,1:nlevdecomp_full)) ; this%m_n_to_litr_cel_fire_col (:,:) = nan - allocate(this%m_n_to_litr_lig_fire_col (begc:endc,1:nlevdecomp_full)) ; this%m_n_to_litr_lig_fire_col (:,:) = nan - - allocate(this%dwt_seedn_to_leaf_patch (begp:endp)) ; this%dwt_seedn_to_leaf_patch (:) = nan - allocate(this%dwt_seedn_to_leaf_grc (begg:endg)) ; this%dwt_seedn_to_leaf_grc (:) = nan - allocate(this%dwt_seedn_to_deadstem_patch (begp:endp)) ; this%dwt_seedn_to_deadstem_patch (:) = nan - allocate(this%dwt_seedn_to_deadstem_grc (begg:endg)) ; this%dwt_seedn_to_deadstem_grc (:) = nan - allocate(this%dwt_conv_nflux_patch (begp:endp)) ; this%dwt_conv_nflux_patch (:) = nan - allocate(this%dwt_conv_nflux_grc (begg:endg)) ; this%dwt_conv_nflux_grc (:) = nan - allocate(this%dwt_wood_productn_gain_patch (begp:endp)) ; this%dwt_wood_productn_gain_patch (:) = nan - allocate(this%dwt_crop_productn_gain_patch (begp:endp)) ; this%dwt_crop_productn_gain_patch (:) = nan - allocate(this%wood_harvestn_col (begc:endc)) ; this%wood_harvestn_col (:) = nan - - allocate(this%dwt_frootn_to_litr_met_n_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_frootn_to_litr_met_n_col (:,:) = nan - allocate(this%dwt_frootn_to_litr_cel_n_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_frootn_to_litr_cel_n_col (:,:) = nan - allocate(this%dwt_frootn_to_litr_lig_n_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_frootn_to_litr_lig_n_col (:,:) = nan - allocate(this%dwt_livecrootn_to_cwdn_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_livecrootn_to_cwdn_col (:,:) = nan - allocate(this%dwt_deadcrootn_to_cwdn_col (begc:endc,1:nlevdecomp_full)) ; this%dwt_deadcrootn_to_cwdn_col (:,:) = nan - - allocate(this%crop_seedn_to_leaf_patch (begp:endp)) ; this%crop_seedn_to_leaf_patch (:) = nan - - allocate(this%m_decomp_npools_to_fire_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - allocate(this%m_decomp_npools_to_fire_col (begc:endc,1:ndecomp_pools )) - - this%m_decomp_npools_to_fire_vr_col (:,:,:) = nan - this%m_decomp_npools_to_fire_col (:,:) = nan - - allocate(this%phenology_n_to_litr_met_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%phenology_n_to_litr_cel_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%phenology_n_to_litr_lig_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_litr_met_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_litr_cel_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_litr_lig_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%gap_mortality_n_to_cwdn_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%fire_mortality_n_to_cwdn_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_litr_met_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_litr_cel_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_litr_lig_n_col (begc:endc, 1:nlevdecomp_full)) - allocate(this%harvest_n_to_cwdn_col (begc:endc, 1:nlevdecomp_full)) - - this%phenology_n_to_litr_met_n_col (:,:) = nan - this%phenology_n_to_litr_cel_n_col (:,:) = nan - this%phenology_n_to_litr_lig_n_col (:,:) = nan - this%gap_mortality_n_to_litr_met_n_col (:,:) = nan - this%gap_mortality_n_to_litr_cel_n_col (:,:) = nan - this%gap_mortality_n_to_litr_lig_n_col (:,:) = nan - this%gap_mortality_n_to_cwdn_col (:,:) = nan - this%fire_mortality_n_to_cwdn_col (:,:) = nan - this%harvest_n_to_litr_met_n_col (:,:) = nan - this%harvest_n_to_litr_cel_n_col (:,:) = nan - this%harvest_n_to_litr_lig_n_col (:,:) = nan - this%harvest_n_to_cwdn_col (:,:) = nan - - allocate(this%plant_ndemand_patch (begp:endp)) ; this%plant_ndemand_patch (:) = nan - allocate(this%avail_retransn_patch (begp:endp)) ; this%avail_retransn_patch (:) = nan - allocate(this%plant_nalloc_patch (begp:endp)) ; this%plant_nalloc_patch (:) = nan - - allocate(this%plant_ndemand_retrans_patch (begp:endp)) ; this%plant_ndemand_retrans_patch (:) = nan - allocate(this%plant_ndemand_season_patch (begp:endp)) ; this%plant_ndemand_season_patch (:) = nan - allocate(this%plant_ndemand_stress_patch (begp:endp)) ; this%plant_ndemand_stress_patch (:) = nan - allocate(this%Nactive_patch (begp:endp)) ; this%Nactive_patch (:) = nan - allocate(this%Nnonmyc_patch (begp:endp)) ; this%Nnonmyc_patch (:) = nan - allocate(this%Nam_patch (begp:endp)) ; this%Nam_patch (:) = nan - allocate(this%Necm_patch (begp:endp)) ; this%Necm_patch (:) = nan - allocate(this%Nactive_no3_patch (begp:endp)) ; this%Nactive_no3_patch (:) = nan - allocate(this%Nactive_nh4_patch (begp:endp)) ; this%Nactive_nh4_patch (:) = nan - allocate(this%Nnonmyc_no3_patch (begp:endp)) ; this%Nnonmyc_no3_patch (:) = nan - allocate(this%Nnonmyc_nh4_patch (begp:endp)) ; this%Nnonmyc_nh4_patch (:) = nan - allocate(this%Nam_no3_patch (begp:endp)) ; this%Nam_no3_patch (:) = nan - allocate(this%Nam_nh4_patch (begp:endp)) ; this%Nam_nh4_patch (:) = nan - allocate(this%Necm_no3_patch (begp:endp)) ; this%Necm_no3_patch (:) = nan - allocate(this%Necm_nh4_patch (begp:endp)) ; this%Necm_nh4_patch (:) = nan - allocate(this%Npassive_patch (begp:endp)) ; this%Npassive_patch (:) = nan - allocate(this%Nfix_patch (begp:endp)) ; this%Nfix_patch (:) = nan - allocate(this%Nretrans_patch (begp:endp)) ; this%Nretrans_patch (:) = nan - allocate(this%Nretrans_org_patch (begp:endp)) ; this%Nretrans_org_patch (:) = nan - allocate(this%Nretrans_season_patch (begp:endp)) ; this%Nretrans_season_patch (:) = nan - allocate(this%Nretrans_stress_patch (begp:endp)) ; this%Nretrans_stress_patch (:) = nan - allocate(this%Nuptake_patch (begp:endp)) ; this%Nuptake_patch (:) = nan - allocate(this%sminn_to_plant_fun_patch (begp:endp)) ; this%sminn_to_plant_fun_patch (:) = nan - allocate(this%sminn_to_plant_fun_vr_patch (begp:endp,1:nlevdecomp_full)) - this%sminn_to_plant_fun_vr_patch (:,:) = nan - allocate(this%sminn_to_plant_fun_no3_vr_patch (begp:endp,1:nlevdecomp_full)) - this%sminn_to_plant_fun_no3_vr_patch (:,:) = nan - allocate(this%sminn_to_plant_fun_nh4_vr_patch (begp:endp,1:nlevdecomp_full)) - this%sminn_to_plant_fun_nh4_vr_patch (:,:) = nan - allocate(this%cost_nfix_patch (begp:endp)) ; this%cost_nfix_patch (:) = nan - allocate(this%cost_nactive_patch (begp:endp)) ; this%cost_nactive_patch (:) = nan - allocate(this%cost_nretrans_patch (begp:endp)) ; this%cost_nretrans_patch (:) = nan - allocate(this%nuptake_npp_fraction_patch (begp:endp)) ; this%nuptake_npp_fraction_patch (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd - use histFileMod , only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - character(10) :: active - character(24) :: fieldname - character(100) :: longname - character(8) :: vr_suffix - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - ! add suffix if number of soil decomposition depths is greater than 1 - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - this%m_leafn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N mortality', & - ptr_patch=this%m_leafn_to_litter_patch, default='inactive') - - this%m_frootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N mortality', & - ptr_patch=this%m_frootn_to_litter_patch, default='inactive') - - this%m_leafn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage mortality', & - ptr_patch=this%m_leafn_storage_to_litter_patch, default='inactive') - - this%m_frootn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage mortality', & - ptr_patch=this%m_frootn_storage_to_litter_patch, default='inactive') - - this%m_livestemn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage mortality', & - ptr_patch=this%m_livestemn_storage_to_litter_patch, default='inactive') - - this%m_deadstemn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage mortality', & - ptr_patch=this%m_deadstemn_storage_to_litter_patch, default='inactive') - - this%m_livecrootn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage mortality', & - ptr_patch=this%m_livecrootn_storage_to_litter_patch, default='inactive') - - this%m_deadcrootn_storage_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage mortality', & - ptr_patch=this%m_deadcrootn_storage_to_litter_patch, default='inactive') - - this%m_leafn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer mortality', & - ptr_patch=this%m_leafn_xfer_to_litter_patch, default='inactive') - - this%m_frootn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer mortality', & - ptr_patch=this%m_frootn_xfer_to_litter_patch, default='inactive') - - this%m_livestemn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer mortality', & - ptr_patch=this%m_livestemn_xfer_to_litter_patch, default='inactive') - - this%m_deadstemn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer mortality', & - ptr_patch=this%m_deadstemn_xfer_to_litter_patch, default='inactive') - - this%m_livecrootn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer mortality', & - ptr_patch=this%m_livecrootn_xfer_to_litter_patch, default='inactive') - - this%m_deadcrootn_xfer_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer mortality', & - ptr_patch=this%m_deadcrootn_xfer_to_litter_patch, default='inactive') - - this%m_livestemn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N mortality', & - ptr_patch=this%m_livestemn_to_litter_patch, default='inactive') - - this%m_deadstemn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N mortality', & - ptr_patch=this%m_deadstemn_to_litter_patch, default='inactive') - - this%m_livecrootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N mortality', & - ptr_patch=this%m_livecrootn_to_litter_patch, default='inactive') - - this%m_deadcrootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N mortality', & - ptr_patch=this%m_deadcrootn_to_litter_patch, default='inactive') - - this%m_retransn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='M_RETRANSN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool mortality', & - ptr_patch=this%m_retransn_to_litter_patch, default='inactive') - - this%m_leafn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N fire loss', & - ptr_patch=this%m_leafn_to_fire_patch, default='inactive') - - this%m_frootn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N fire loss ', & - ptr_patch=this%m_frootn_to_fire_patch, default='inactive') - - this%m_leafn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage fire loss', & - ptr_patch=this%m_leafn_storage_to_fire_patch, default='inactive') - - this%m_frootn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage fire loss', & - ptr_patch=this%m_frootn_storage_to_fire_patch, default='inactive') - - this%m_livestemn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage fire loss', & - ptr_patch=this%m_livestemn_storage_to_fire_patch, default='inactive') - - this%m_deadstemn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage fire loss', & - ptr_patch=this%m_deadstemn_storage_to_fire_patch, default='inactive') - - this%m_livecrootn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage fire loss', & - ptr_patch=this%m_livecrootn_storage_to_fire_patch, default='inactive') - - this%m_deadcrootn_storage_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage fire loss', & - ptr_patch=this%m_deadcrootn_storage_to_fire_patch, default='inactive') - - this%m_leafn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LEAFN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer fire loss', & - ptr_patch=this%m_leafn_xfer_to_fire_patch, default='inactive') - - this%m_frootn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_FROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer fire loss', & - ptr_patch=this%m_frootn_xfer_to_fire_patch, default='inactive') - - this%m_livestemn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer fire loss', & - ptr_patch=this%m_livestemn_xfer_to_fire_patch, default='inactive') - - this%m_deadstemn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer fire loss', & - ptr_patch=this%m_deadstemn_xfer_to_fire_patch, default='inactive') - - this%m_livecrootn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer fire loss', & - ptr_patch=this%m_livecrootn_xfer_to_fire_patch, default='inactive') - - this%m_deadcrootn_xfer_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer fire loss', & - ptr_patch=this%m_deadcrootn_xfer_to_fire_patch, default='inactive') - - this%m_livestemn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVESTEMN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N fire loss', & - ptr_patch=this%m_livestemn_to_fire_patch, default='inactive') - - this%m_deadstemn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N fire loss', & - ptr_patch=this%m_deadstemn_to_fire_patch, default='inactive') - - this%m_deadstemn_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N fire mortality to litter', & - ptr_patch=this%m_deadstemn_to_litter_fire_patch, default='inactive') - - this%m_livecrootn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_LIVECROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N fire loss', & - ptr_patch=this%m_livecrootn_to_fire_patch, default='inactive') - - this%m_deadcrootn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N fire loss', & - ptr_patch=this%m_deadcrootn_to_fire_patch, default='inactive') - - this%m_deadcrootn_to_litter_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_DEADCROOTN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N fire mortality to litter', & - ptr_patch=this%m_deadcrootn_to_litter_fire_patch, default='inactive') - - this%m_retransn_to_fire_patch(begp:endp) = spval - call hist_addfld1d (fname='M_RETRANSN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool fire loss', & - ptr_patch=this%m_retransn_to_fire_patch, default='inactive') - - this%leafn_xfer_to_leafn_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_XFER_TO_LEAFN', units='gN/m^2/s', & - avgflag='A', long_name='leaf N growth from storage', & - ptr_patch=this%leafn_xfer_to_leafn_patch, default='inactive') - - this%frootn_xfer_to_frootn_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_XFER_TO_FROOTN', units='gN/m^2/s', & - avgflag='A', long_name='fine root N growth from storage', & - ptr_patch=this%frootn_xfer_to_frootn_patch, default='inactive') - - this%livestemn_xfer_to_livestemn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_XFER_TO_LIVESTEMN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N growth from storage', & - ptr_patch=this%livestemn_xfer_to_livestemn_patch, default='inactive') - - this%deadstemn_xfer_to_deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_XFER_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N growth from storage', & - ptr_patch=this%deadstemn_xfer_to_deadstemn_patch, default='inactive') - - this%livecrootn_xfer_to_livecrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_XFER_TO_LIVECROOTN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N growth from storage', & - ptr_patch=this%livecrootn_xfer_to_livecrootn_patch, default='inactive') - - this%deadcrootn_xfer_to_deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_XFER_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N growth from storage', & - ptr_patch=this%deadcrootn_xfer_to_deadcrootn_patch, default='inactive') - - this%leafn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N litterfall', & - ptr_patch=this%leafn_to_litter_patch) - - this%leafn_to_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='leaf N to retranslocated N pool', & - ptr_patch=this%leafn_to_retransn_patch, default='inactive') - - this%frootn_to_litter_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N litterfall', & - ptr_patch=this%frootn_to_litter_patch, default='inactive') - - this%retransn_to_npool_patch(begp:endp) = spval - call hist_addfld1d (fname='RETRANSN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of retranslocated N', & - ptr_patch=this%retransn_to_npool_patch) - - this%free_retransn_to_npool_patch(begp:endp) = spval - call hist_addfld1d (fname='FREE_RETRANSN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of retranslocated N', & - ptr_patch=this%free_retransn_to_npool_patch) - - this%sminn_to_npool_patch(begp:endp) = spval - call hist_addfld1d (fname='SMINN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of soil mineral N uptake', & - ptr_patch=this%sminn_to_npool_patch) - - this%npool_to_leafn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LEAFN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to leaf N', & - ptr_patch=this%npool_to_leafn_patch, default='inactive') - - this%npool_to_leafn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LEAFN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to leaf N storage', & - ptr_patch=this%npool_to_leafn_storage_patch, default='inactive') - - this%npool_to_frootn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_FROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to fine root N', & - ptr_patch=this%npool_to_frootn_patch, default='inactive') - - this%npool_to_frootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_FROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to fine root N storage', & - ptr_patch=this%npool_to_frootn_storage_patch, default='inactive') - - this%npool_to_livestemn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live stem N', & - ptr_patch=this%npool_to_livestemn_patch, default='inactive') - - this%npool_to_livestemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live stem N storage', & - ptr_patch=this%npool_to_livestemn_storage_patch, default='inactive') - - this%npool_to_deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead stem N', & - ptr_patch=this%npool_to_deadstemn_patch, default='inactive') - - this%npool_to_deadstemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead stem N storage', & - ptr_patch=this%npool_to_deadstemn_storage_patch, default='inactive') - - this%npool_to_livecrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live coarse root N', & - ptr_patch=this%npool_to_livecrootn_patch, default='inactive') - - this%npool_to_livecrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live coarse root N storage', & - ptr_patch=this%npool_to_livecrootn_storage_patch, default='inactive') - - this%npool_to_deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root N', & - ptr_patch=this%npool_to_deadcrootn_patch, default='inactive') - - this%npool_to_deadcrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL_TO_DEADCROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root N storage', & - ptr_patch=this%npool_to_deadcrootn_storage_patch, default='inactive') - - this%leafn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N shift storage to transfer', & - ptr_patch=this%leafn_storage_to_xfer_patch, default='inactive') - - this%frootn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N shift storage to transfer', & - ptr_patch=this%frootn_storage_to_xfer_patch, default='inactive') - - this%livestemn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N shift storage to transfer', & - ptr_patch=this%livestemn_storage_to_xfer_patch, default='inactive') - - this%deadstemn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N shift storage to transfer', & - ptr_patch=this%deadstemn_storage_to_xfer_patch, default='inactive') - - this%livecrootn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N shift storage to transfer', & - ptr_patch=this%livecrootn_storage_to_xfer_patch, default='inactive') - - this%deadcrootn_storage_to_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N shift storage to transfer', & - ptr_patch=this%deadcrootn_storage_to_xfer_patch, default='inactive') - - this%livestemn_to_deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N turnover', & - ptr_patch=this%livestemn_to_deadstemn_patch, default='inactive') - - this%livestemn_to_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N to retranslocated N pool', & - ptr_patch=this%livestemn_to_retransn_patch, default='inactive') - - this%livecrootn_to_deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N turnover', & - ptr_patch=this%livecrootn_to_deadcrootn_patch, default='inactive') - - this%livecrootn_to_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N to retranslocated N pool', & - ptr_patch=this%livecrootn_to_retransn_patch, default='inactive') - - this%ndeploy_patch(begp:endp) = spval - call hist_addfld1d (fname='NDEPLOY', units='gN/m^2/s', & - avgflag='A', long_name='total N deployed in new growth', & - ptr_patch=this%ndeploy_patch) - - this%wood_harvestn_patch(begp:endp) = spval - call hist_addfld1d (fname='WOOD_HARVESTN', units='gN/m^2/s', & - avgflag='A', long_name='wood harvest N (to product pools)', & - ptr_patch=this%wood_harvestn_patch) - - this%fire_nloss_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_FIRE_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total patch-level fire N loss', & - ptr_patch=this%fire_nloss_patch) - - if (use_crop) then - this%fert_patch(begp:endp) = spval - call hist_addfld1d (fname='NFERTILIZATION', units='gN/m^2/s', & - avgflag='A', long_name='fertilizer added', & - ptr_patch=this%fert_patch) - end if - - if (use_crop .and. .not. use_fun) then - this%soyfixn_patch(begp:endp) = spval - call hist_addfld1d (fname='SOYFIXN', units='gN/m^2/s', & - avgflag='A', long_name='soybean fixation', & - ptr_patch=this%soyfixn_patch) - end if - - if (use_crop) then - this%fert_counter_patch(begp:endp) = spval - call hist_addfld1d (fname='FERT_COUNTER', units='seconds', & - avgflag='A', long_name='time left to fertilize', & - ptr_patch=this%fert_counter_patch, default='inactive') - end if - - !------------------------------- - ! N flux variables - native to column - !------------------------------- - - do k = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(k) .or. decomp_cascade_con%is_cwd(k) ) then - this%m_decomp_npools_to_fire_col(begc:endc,k) = spval - data1dptr => this%m_decomp_npools_to_fire_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TO_FIRE' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N fire loss' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%m_decomp_npools_to_fire_vr_col(begc:endc,:,k) = spval - data2dptr => this%m_decomp_npools_to_fire_vr_col(:,:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TO_FIRE'//trim(vr_suffix) - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N fire loss' - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - endif - end do - - this%fire_nloss_col(begc:endc) = spval - call hist_addfld1d (fname='COL_FIRE_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total column-level fire N loss', & - ptr_col=this%fire_nloss_col) - - this%dwt_seedn_to_leaf_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_LEAF', units='gN/m^2/s', & - avgflag='A', long_name='seed source to patch-level leaf', & - ptr_gcell=this%dwt_seedn_to_leaf_grc) - - this%dwt_seedn_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_LEAF_PATCH', units='gN/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level leaf ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedn_to_leaf_patch, default='inactive') - - this%dwt_seedn_to_deadstem_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_DEADSTEM', units='gN/m^2/s', & - avgflag='A', long_name='seed source to patch-level deadstem', & - ptr_gcell=this%dwt_seedn_to_deadstem_grc) - - this%dwt_seedn_to_deadstem_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_SEEDN_TO_DEADSTEM_PATCH', units='gN/m^2/s', & - avgflag='A', & - long_name='patch-level seed source to patch-level deadstem ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_seedn_to_deadstem_patch, default='inactive') - - this%dwt_conv_nflux_grc(begg:endg) = spval - call hist_addfld1d (fname='DWT_CONV_NFLUX', units='gN/m^2/s', & - avgflag='A', & - long_name='conversion N flux (immediate loss to atm) (0 at all times except first timestep of year)', & - ptr_gcell=this%dwt_conv_nflux_grc) - - this%dwt_conv_nflux_patch(begp:endp) = spval - call hist_addfld1d (fname='DWT_CONV_NFLUX_PATCH', units='gN/m^2/s', & - avgflag='A', & - long_name='patch-level conversion N flux (immediate loss to atm) ' // & - '(0 at all times except first timestep of year) ' // & - '(per-area-gridcell; only makes sense with dov2xy=.false.)', & - ptr_patch=this%dwt_conv_nflux_patch, default='inactive') - - this%dwt_frootn_to_litr_met_n_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTN_TO_LITR_MET_N', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootn_to_litr_met_n_col, default='inactive') - - this%dwt_frootn_to_litr_cel_n_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTN_TO_LITR_CEL_N', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootn_to_litr_cel_n_col, default='inactive') - - this%dwt_frootn_to_litr_lig_n_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_FROOTN_TO_LITR_LIG_N', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=this%dwt_frootn_to_litr_lig_n_col, default='inactive') - - this%dwt_livecrootn_to_cwdn_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_LIVECROOTN_TO_CWDN', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='live coarse root to CWD due to landcover change', & - ptr_col=this%dwt_livecrootn_to_cwdn_col, default='inactive') - - this%dwt_deadcrootn_to_cwdn_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='DWT_DEADCROOTN_TO_CWDN', units='gN/m^2/s', type2d='levdcmp', & - avgflag='A', long_name='dead coarse root to CWD due to landcover change', & - ptr_col=this%dwt_deadcrootn_to_cwdn_col, default='inactive') - - this%crop_seedn_to_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='CROP_SEEDN_TO_LEAF', units='gN/m^2/s', & - avgflag='A', long_name='crop seed source to leaf', & - ptr_patch=this%crop_seedn_to_leaf_patch, default='inactive') - - this%plant_ndemand_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANT_NDEMAND', units='gN/m^2/s', & - avgflag='A', long_name='N flux required to support initial GPP', & - ptr_patch=this%plant_ndemand_patch) - - this%avail_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='AVAIL_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='N flux available from retranslocation pool', & - ptr_patch=this%avail_retransn_patch, default='inactive') - - this%plant_nalloc_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANT_NALLOC', units='gN/m^2/s', & - avgflag='A', long_name='total allocated N flux', & - ptr_patch=this%plant_nalloc_patch, default='inactive') - - if ( use_fun ) then - this%Nactive_patch(begp:endp) = spval - call hist_addfld1d (fname='NACTIVE', units='gN/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake flux', & - ptr_patch=this%Nactive_patch) - - this%Nnonmyc_patch(begp:endp) = spval - call hist_addfld1d (fname='NNONMYC', units='gN/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake flux', & - ptr_patch=this%Nnonmyc_patch) - - this%Nam_patch(begp:endp) = spval - call hist_addfld1d (fname='NAM', units='gN/m^2/s', & - avgflag='A', long_name='AM-associated N uptake flux', & - ptr_patch=this%Nam_patch) - - this%Necm_patch(begp:endp) = spval - call hist_addfld1d (fname='NECM', units='gN/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake flux', & - ptr_patch=this%Necm_patch) - - if (use_nitrif_denitrif) then - this%Nactive_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NACTIVE_NO3', units='gN/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake flux', & - ptr_patch=this%Nactive_no3_patch) - - this%Nactive_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NACTIVE_NH4', units='gN/m^2/s', & - avgflag='A', long_name='Mycorrhizal N uptake flux', & - ptr_patch=this%Nactive_nh4_patch) - - this%Nnonmyc_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NNONMYC_NO3', units='gN/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake flux', & - ptr_patch=this%Nnonmyc_no3_patch) - - this%Nnonmyc_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NNONMYC_NH4', units='gN/m^2/s', & - avgflag='A', long_name='Non-mycorrhizal N uptake flux', & - ptr_patch=this%Nnonmyc_nh4_patch) - - this%Nam_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NAM_NO3', units='gN/m^2/s', & - avgflag='A', long_name='AM-associated N uptake flux', & - ptr_patch=this%Nam_no3_patch) - - this%Nam_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NAM_NH4', units='gN/m^2/s', & - avgflag='A', long_name='AM-associated N uptake flux', & - ptr_patch=this%Nam_nh4_patch) - - this%Necm_no3_patch(begp:endp) = spval - call hist_addfld1d (fname='NECM_NO3', units='gN/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake flux', & - ptr_patch=this%Necm_no3_patch) - - this%Necm_nh4_patch(begp:endp) = spval - call hist_addfld1d (fname='NECM_NH4', units='gN/m^2/s', & - avgflag='A', long_name='ECM-associated N uptake flux', & - ptr_patch=this%Necm_nh4_patch) - end if - - this%Npassive_patch(begp:endp) = spval - call hist_addfld1d (fname='NPASSIVE', units='gN/m^2/s', & - avgflag='A', long_name='Passive N uptake flux', & - ptr_patch=this%Npassive_patch) - - this%Nfix_patch(begp:endp) = spval - call hist_addfld1d (fname='NFIX', units='gN/m^2/s', & - avgflag='A', long_name='Symbiotic BNF uptake flux', & - ptr_patch=this%Nfix_patch) - - this%Nretrans_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_patch) - - this%Nretrans_org_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS_REG', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_org_patch) - - this%Nretrans_season_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS_SEASON', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_season_patch) - - this%Nretrans_stress_patch(begp:endp) = spval - call hist_addfld1d (fname='NRETRANS_STRESS', units='gN/m^2/s', & - avgflag='A', long_name='Retranslocated N uptake flux', & - ptr_patch=this%Nretrans_stress_patch) - - this%Nuptake_patch(begp:endp) = spval - call hist_addfld1d (fname='NUPTAKE', units='gN/m^2/s', & - avgflag='A', long_name='Total N uptake of FUN', & - ptr_patch=this%Nuptake_patch) - - this%sminn_to_plant_fun_patch(begp:endp) = spval - call hist_addfld1d (fname='SMINN_TO_PLANT_FUN', units='gN/m^2/s',& - avgflag='A', long_name='Total soil N uptake of FUN', & - ptr_patch=this%sminn_to_plant_fun_patch) - - this%cost_nfix_patch(begp:endp) = spval - call hist_addfld1d (fname='COST_NFIX', units='gN/gC', & - avgflag='A', long_name='Cost of fixation', & - ptr_patch=this%cost_nfix_patch) - - this%cost_nactive_patch(begp:endp) = spval - call hist_addfld1d (fname='COST_NACTIVE', units='gN/gC', & - avgflag='A', long_name='Cost of active uptake', & - ptr_patch=this%cost_nactive_patch) - - this%cost_nretrans_patch(begp:endp) = spval - call hist_addfld1d (fname='COST_NRETRANS', units='gN/gC', & - avgflag='A', long_name='Cost of retranslocation', & - ptr_patch=this%cost_nretrans_patch) - - this%nuptake_npp_fraction_patch(begp:endp) = spval - call hist_addfld1d (fname='NUPTAKE_NPP_FRACTION', units='-', & - avgflag='A', long_name='frac of NPP used in N uptake', & - ptr_patch=this%nuptake_npp_fraction_patch) - - - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use landunit_varcon , only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,j - integer :: fp, fc ! filter indices - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch(bounds%endp-bounds%begp+1) ! special landunit filter - patches - !--------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! Set patch filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - !----------------------------------------------- - ! initialize nitrogen flux variables - !----------------------------------------------- - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - if ( use_crop )then - this%fert_counter_patch(p) = spval - this%fert_patch(p) = 0._r8 - this%soyfixn_patch(p) = 0._r8 - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%fert_counter_patch(p) = 0._r8 - end if - if ( use_fun ) then !previously set to spval for special land units - if (lun%ifspecial(l)) then - this%plant_ndemand_patch(p) = 0._r8 - this%avail_retransn_patch(p) = 0._r8 - this%plant_nalloc_patch(p) = 0._r8 - this%Npassive_patch(p) = 0._r8 - this%Nactive_patch(p) = 0._r8 - this%Nnonmyc_patch(p) = 0._r8 - this%Nam_patch(p) = 0._r8 - this%Necm_patch(p) = 0._r8 - if (use_nitrif_denitrif) then - this%Nactive_no3_patch(p) = 0._r8 - this%Nactive_nh4_patch(p) = 0._r8 - this%Nnonmyc_no3_patch(p) = 0._r8 - this%Nnonmyc_nh4_patch(p) = 0._r8 - this%Nam_no3_patch(p) = 0._r8 - this%Nam_nh4_patch(p) = 0._r8 - this%Necm_no3_patch(p) = 0._r8 - this%Necm_nh4_patch(p) = 0._r8 - end if - this%Nfix_patch(p) = 0._r8 - this%Nretrans_patch(p) = 0._r8 - this%Nretrans_org_patch(p) = 0._r8 - this%Nretrans_season_patch(p) = 0._r8 - this%Nretrans_stress_patch(p) = 0._r8 - this%Nuptake_patch(p) = 0._r8 - this%sminn_to_plant_fun_patch(p) = 0._r8 - this%cost_nfix_patch = 0._r8 - this%cost_nactive_patch = 0._r8 - this%cost_nretrans_patch = 0._r8 - this%nuptake_npp_fraction_patch = 0._r8 - - do j = 1, nlevdecomp - this%sminn_to_plant_fun_vr_patch(p,j) = 0._r8 - this%sminn_to_plant_fun_no3_vr_patch(p,j) = 0._r8 - this%sminn_to_plant_fun_nh4_vr_patch(p,j) = 0._r8 - end do - end if - end if - end do - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart (this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (cnveg_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='fert_counter', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fert_counter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fert', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fert_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn_xfer_to_grainn', xtype=ncd_double, & - dim1name='pft', & - long_name='grain N growth from storage', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_xfer_to_grainn_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='livestemn_to_litter', xtype=ncd_double, & - dim1name='pft', & - long_name='livestem N to litter', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_to_litter_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn_to_food', xtype=ncd_double, & - dim1name='pft', & - long_name='grain N to food', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_to_food_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='npool_to_grainn', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain N', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%npool_to_grainn_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='npool_to_grainn_storage', xtype=ncd_double, & - dim1name='pft', & - long_name='allocation to grain N storage', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%npool_to_grainn_storage_patch) - end if - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn_storage_to_xfer', xtype=ncd_double, & - dim1name='pft', & - long_name='grain N shift storage to transfer', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_storage_to_xfer_patch) - end if - - call restartvar(ncid=ncid, flag=flag, varname='plant_ndemand', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_ndemand_patch) - - call restartvar(ncid=ncid, flag=flag, varname='avail_retransn', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%avail_retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='plant_nalloc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plant_nalloc_patch) - - if ( use_fun ) then -! set_missing_vals_to_constant for BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 -! special land units previously set to spval, not 0 -! modifications here should correct this - call restartvar(ncid=ncid, flag=flag, varname='Nactive', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nactive_patch) - call set_missing_vals_to_constant(this%Nactive_patch, 0._r8) -! - call restartvar(ncid=ncid, flag=flag, varname='Nnonmyc', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nnonmyc_patch) - call set_missing_vals_to_constant(this%Nnonmyc_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nam', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nam_patch) - call set_missing_vals_to_constant(this%Nam_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Necm', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Necm_patch) - call set_missing_vals_to_constant(this%Necm_patch, 0._r8) - - if (use_nitrif_denitrif) then - call restartvar(ncid=ncid, flag=flag, varname='Nactive_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nactive_no3_patch) - call set_missing_vals_to_constant(this%Nactive_no3_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nactive_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nactive_nh4_patch) - call set_missing_vals_to_constant(this%Nactive_nh4_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nnonmyc_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nnonmyc_no3_patch) - call set_missing_vals_to_constant(this%Nnonmyc_no3_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nnonmyc_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nnonmyc_nh4_patch) - call set_missing_vals_to_constant(this%Nnonmyc_nh4_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nam_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nam_no3_patch) - call set_missing_vals_to_constant(this%Nam_no3_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nam_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nam_nh4_patch) - call set_missing_vals_to_constant(this%Nam_nh4_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Necm_no3', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Necm_no3_patch) - call set_missing_vals_to_constant(this%Necm_no3_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Necm_nh4', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Necm_nh4_patch) - call set_missing_vals_to_constant(this%Necm_nh4_patch, 0._r8) - end if -! - call restartvar(ncid=ncid, flag=flag, varname='Npassive', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Npassive_patch) - call set_missing_vals_to_constant(this%Npassive_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nfix', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nfix_patch) - call set_missing_vals_to_constant(this%Nfix_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_patch) - call set_missing_vals_to_constant(this%Nretrans_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans_org', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_org_patch) - call set_missing_vals_to_constant(this%Nretrans_org_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans_season', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_season_patch) - call set_missing_vals_to_constant(this%Nretrans_season_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nretrans_stress', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nretrans_stress_patch) - call set_missing_vals_to_constant(this%Nretrans_stress_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='Nuptake', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%Nuptake_patch) - call set_missing_vals_to_constant(this%Nuptake_patch, 0._r8) - - call restartvar(ncid=ncid, flag=flag, varname='sminn_to_plant_fun', xtype=ncd_double, & - dim1name='pft', & - long_name='Total soil N uptake of FUN', units='gN/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%sminn_to_plant_fun_patch) - call set_missing_vals_to_constant(this%sminn_to_plant_fun_patch, 0._r8) - end if -! End BACKWARDS_COMPATIBILITY(wrw, 2018-06-28) re. issue #426 - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set nitrogen flux variables - ! - ! !ARGUMENTS: - ! !ARGUMENTS: - class (cnveg_nitrogenflux_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i=filter_patch(fi) - - this%m_leafn_to_litter_patch(i) = value_patch - this%m_frootn_to_litter_patch(i) = value_patch - this%m_leafn_storage_to_litter_patch(i) = value_patch - this%m_frootn_storage_to_litter_patch(i) = value_patch - this%m_livestemn_storage_to_litter_patch(i) = value_patch - this%m_deadstemn_storage_to_litter_patch(i) = value_patch - this%m_livecrootn_storage_to_litter_patch(i) = value_patch - this%m_deadcrootn_storage_to_litter_patch(i) = value_patch - this%m_leafn_xfer_to_litter_patch(i) = value_patch - this%m_frootn_xfer_to_litter_patch(i) = value_patch - this%m_livestemn_xfer_to_litter_patch(i) = value_patch - this%m_deadstemn_xfer_to_litter_patch(i) = value_patch - this%m_livecrootn_xfer_to_litter_patch(i) = value_patch - this%m_deadcrootn_xfer_to_litter_patch(i) = value_patch - this%m_livestemn_to_litter_patch(i) = value_patch - this%m_deadstemn_to_litter_patch(i) = value_patch - this%m_livecrootn_to_litter_patch(i) = value_patch - this%m_deadcrootn_to_litter_patch(i) = value_patch - this%m_retransn_to_litter_patch(i) = value_patch - this%hrv_leafn_to_litter_patch(i) = value_patch - this%hrv_frootn_to_litter_patch(i) = value_patch - this%hrv_leafn_storage_to_litter_patch(i) = value_patch - this%hrv_frootn_storage_to_litter_patch(i) = value_patch - this%hrv_livestemn_storage_to_litter_patch(i) = value_patch - this%hrv_deadstemn_storage_to_litter_patch(i) = value_patch - this%hrv_livecrootn_storage_to_litter_patch(i) = value_patch - this%hrv_deadcrootn_storage_to_litter_patch(i) = value_patch - this%hrv_leafn_xfer_to_litter_patch(i) = value_patch - this%hrv_frootn_xfer_to_litter_patch(i) = value_patch - this%hrv_livestemn_xfer_to_litter_patch(i) = value_patch - this%hrv_deadstemn_xfer_to_litter_patch(i) = value_patch - this%hrv_livecrootn_xfer_to_litter_patch(i) = value_patch - this%hrv_deadcrootn_xfer_to_litter_patch(i) = value_patch - this%hrv_livestemn_to_litter_patch(i) = value_patch - this%hrv_livecrootn_to_litter_patch(i) = value_patch - this%hrv_deadcrootn_to_litter_patch(i) = value_patch - this%hrv_retransn_to_litter_patch(i) = value_patch - - this%m_leafn_to_fire_patch(i) = value_patch - this%m_leafn_storage_to_fire_patch(i) = value_patch - this%m_leafn_xfer_to_fire_patch(i) = value_patch - this%m_livestemn_to_fire_patch(i) = value_patch - this%m_livestemn_storage_to_fire_patch(i) = value_patch - this%m_livestemn_xfer_to_fire_patch(i) = value_patch - this%m_deadstemn_to_fire_patch(i) = value_patch - this%m_deadstemn_storage_to_fire_patch(i) = value_patch - this%m_deadstemn_xfer_to_fire_patch(i) = value_patch - this%m_frootn_to_fire_patch(i) = value_patch - this%m_frootn_storage_to_fire_patch(i) = value_patch - this%m_frootn_xfer_to_fire_patch(i) = value_patch - this%m_livecrootn_to_fire_patch(i) = value_patch - this%m_livecrootn_storage_to_fire_patch(i) = value_patch - this%m_livecrootn_xfer_to_fire_patch(i) = value_patch - this%m_deadcrootn_to_fire_patch(i) = value_patch - this%m_deadcrootn_storage_to_fire_patch(i) = value_patch - this%m_deadcrootn_xfer_to_fire_patch(i) = value_patch - this%m_retransn_to_fire_patch(i) = value_patch - - - this%m_leafn_to_litter_fire_patch(i) = value_patch - this%m_leafn_storage_to_litter_fire_patch(i) = value_patch - this%m_leafn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemn_to_litter_fire_patch(i) = value_patch - this%m_livestemn_storage_to_litter_fire_patch(i) = value_patch - this%m_livestemn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livestemn_to_deadstemn_fire_patch(i) = value_patch - this%m_deadstemn_to_litter_fire_patch(i) = value_patch - this%m_deadstemn_storage_to_litter_fire_patch(i) = value_patch - this%m_deadstemn_xfer_to_litter_fire_patch(i) = value_patch - this%m_frootn_to_litter_fire_patch(i) = value_patch - this%m_frootn_storage_to_litter_fire_patch(i) = value_patch - this%m_frootn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_storage_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_xfer_to_litter_fire_patch(i) = value_patch - this%m_livecrootn_to_deadcrootn_fire_patch(i) = value_patch - this%m_deadcrootn_to_litter_fire_patch(i) = value_patch - this%m_deadcrootn_storage_to_litter_fire_patch(i) = value_patch - this%m_deadcrootn_xfer_to_litter_fire_patch(i) = value_patch - this%m_retransn_to_litter_fire_patch(i) = value_patch - - this%leafn_xfer_to_leafn_patch(i) = value_patch - this%frootn_xfer_to_frootn_patch(i) = value_patch - this%livestemn_xfer_to_livestemn_patch(i) = value_patch - this%deadstemn_xfer_to_deadstemn_patch(i) = value_patch - this%livecrootn_xfer_to_livecrootn_patch(i) = value_patch - this%deadcrootn_xfer_to_deadcrootn_patch(i) = value_patch - this%leafn_to_litter_patch(i) = value_patch - this%leafn_to_retransn_patch(i) = value_patch - this%frootn_to_litter_patch(i) = value_patch - this%retransn_to_npool_patch(i) = value_patch - this%free_retransn_to_npool_patch(i) = value_patch - this%sminn_to_npool_patch(i) = value_patch - this%npool_to_leafn_patch(i) = value_patch - this%npool_to_leafn_storage_patch(i) = value_patch - this%npool_to_frootn_patch(i) = value_patch - this%npool_to_frootn_storage_patch(i) = value_patch - this%npool_to_livestemn_patch(i) = value_patch - this%npool_to_livestemn_storage_patch(i) = value_patch - this%npool_to_deadstemn_patch(i) = value_patch - this%npool_to_deadstemn_storage_patch(i) = value_patch - this%npool_to_livecrootn_patch(i) = value_patch - this%npool_to_livecrootn_storage_patch(i) = value_patch - this%npool_to_deadcrootn_patch(i) = value_patch - this%npool_to_deadcrootn_storage_patch(i) = value_patch - this%leafn_storage_to_xfer_patch(i) = value_patch - this%frootn_storage_to_xfer_patch(i) = value_patch - this%livestemn_storage_to_xfer_patch(i) = value_patch - this%deadstemn_storage_to_xfer_patch(i) = value_patch - this%livecrootn_storage_to_xfer_patch(i) = value_patch - this%deadcrootn_storage_to_xfer_patch(i) = value_patch - this%livestemn_to_deadstemn_patch(i) = value_patch - this%livestemn_to_retransn_patch(i) = value_patch - this%livecrootn_to_deadcrootn_patch(i) = value_patch - this%livecrootn_to_retransn_patch(i) = value_patch - this%ndeploy_patch(i) = value_patch - this%wood_harvestn_patch(i) = value_patch - this%fire_nloss_patch(i) = value_patch - - this%crop_seedn_to_leaf_patch(i) = value_patch - this%grainn_to_cropprodn_patch(i) = value_patch - end do - - if ( use_crop )then - do fi = 1,num_patch - i = filter_patch(fi) - this%livestemn_to_litter_patch(i) = value_patch - this%grainn_to_food_patch(i) = value_patch - this%grainn_to_seed_patch(i) = value_patch - this%grainn_xfer_to_grainn_patch(i) = value_patch - this%npool_to_grainn_patch(i) = value_patch - this%npool_to_grainn_storage_patch(i) = value_patch - this%grainn_storage_to_xfer_patch(i) = value_patch - this%soyfixn_patch(i) = value_patch - this%frootn_to_retransn_patch(i) = value_patch - end do - end if - - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - - ! phenology: litterfall and crop fluxes associated wit - this%phenology_n_to_litr_met_n_col(i,j) = value_column - this%phenology_n_to_litr_cel_n_col(i,j) = value_column - this%phenology_n_to_litr_lig_n_col(i,j) = value_column - - ! gap mortality - this%gap_mortality_n_to_litr_met_n_col(i,j) = value_column - this%gap_mortality_n_to_litr_cel_n_col(i,j) = value_column - this%gap_mortality_n_to_litr_lig_n_col(i,j) = value_column - this%gap_mortality_n_to_cwdn_col(i,j) = value_column - - ! fire - this%fire_mortality_n_to_cwdn_col(i,j) = value_column - this%m_n_to_litr_met_fire_col(i,j) = value_column - this%m_n_to_litr_cel_fire_col(i,j) = value_column - this%m_n_to_litr_lig_fire_col(i,j) = value_column - - ! harvest - this%harvest_n_to_litr_met_n_col(i,j) = value_column - this%harvest_n_to_litr_cel_n_col(i,j) = value_column - this%harvest_n_to_litr_lig_n_col(i,j) = value_column - this%harvest_n_to_cwdn_col(i,j) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%grainn_to_cropprodn_col(i) = value_column - this%fire_nloss_col(i) = value_column - - ! Zero p2c column fluxes - this%fire_nloss_col(i) = value_column - this%wood_harvestn_col(i) = value_column - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%m_decomp_npools_to_fire_col(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_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine ZeroDwt( this, bounds ) - ! - ! !DESCRIPTION - ! Initialize flux variables needed for dynamic land use. - ! - ! !ARGUMENTS: - class(cnveg_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c, g, j ! indices - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - this%dwt_seedn_to_leaf_grc(g) = 0._r8 - this%dwt_seedn_to_deadstem_grc(g) = 0._r8 - this%dwt_conv_nflux_grc(g) = 0._r8 - end do - - do j = 1, nlevdecomp_full - do c = bounds%begc,bounds%endc - this%dwt_frootn_to_litr_met_n_col(c,j) = 0._r8 - this%dwt_frootn_to_litr_cel_n_col(c,j) = 0._r8 - this%dwt_frootn_to_litr_lig_n_col(c,j) = 0._r8 - this%dwt_livecrootn_to_cwdn_col(c,j) = 0._r8 - this%dwt_deadcrootn_to_cwdn_col(c,j) = 0._r8 - end do - end do - - end subroutine ZeroDwt - - !----------------------------------------------------------------------- - subroutine Summary_nitrogenflux(this, bounds, num_soilc, filter_soilc, num_soilp, filter_soilp) - ! - ! !USES: - use clm_varpar , only: nlevdecomp,ndecomp_cascade_transitions,ndecomp_pools - use clm_varctl , only: use_nitrif_denitrif - use subgridAveMod , only: p2c - ! - ! !ARGUMENTS: - class (cnveg_nitrogenflux_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 - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,k,l ! indices - integer :: fp,fc ! lake filter indices - real(r8) :: maxdepth ! depth to integrate soil variables - !----------------------------------------------------------------------- - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! total N deployment (from sminn and retranslocated N pool) (NDEPLOY) - this%ndeploy_patch(p) = & - this%sminn_to_npool_patch(p) + & - this%retransn_to_npool_patch(p) + & - this%free_retransn_to_npool_patch(p) - - ! total patch-level fire N losses - this%fire_nloss_patch(p) = & - this%m_leafn_to_fire_patch(p) + & - this%m_leafn_storage_to_fire_patch(p) + & - this%m_leafn_xfer_to_fire_patch(p) + & - this%m_frootn_to_fire_patch(p) + & - this%m_frootn_storage_to_fire_patch(p) + & - this%m_frootn_xfer_to_fire_patch(p) + & - this%m_livestemn_to_fire_patch(p) + & - this%m_livestemn_storage_to_fire_patch(p) + & - this%m_livestemn_xfer_to_fire_patch(p) + & - this%m_deadstemn_to_fire_patch(p) + & - this%m_deadstemn_storage_to_fire_patch(p) + & - this%m_deadstemn_xfer_to_fire_patch(p) + & - this%m_livecrootn_to_fire_patch(p) + & - this%m_livecrootn_storage_to_fire_patch(p) + & - this%m_livecrootn_xfer_to_fire_patch(p) + & - this%m_deadcrootn_to_fire_patch(p) + & - this%m_deadcrootn_storage_to_fire_patch(p) + & - this%m_deadcrootn_xfer_to_fire_patch(p) + & - this%m_retransn_to_fire_patch(p) - - end do - - call p2c(bounds, num_soilc, filter_soilc, & - this%fire_nloss_patch(bounds%begp:bounds%endp), & - this%fire_nloss_p2c_col(bounds%begc:bounds%endc)) - - ! vertically integrate column-level fire N losses - do k = 1, ndecomp_pools - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%m_decomp_npools_to_fire_col(c,k) = & - this%m_decomp_npools_to_fire_col(c,k) + & - this%m_decomp_npools_to_fire_vr_col(c,j,k) * dzsoi_decomp(j) - end do - end do - end do - - ! total column-level fire N losses - do fc = 1,num_soilc - c = filter_soilc(fc) - this%fire_nloss_col(c) = this%fire_nloss_p2c_col(c) - end do - do k = 1, ndecomp_pools - do fc = 1,num_soilc - c = filter_soilc(fc) - this%fire_nloss_col(c) = & - this%fire_nloss_col(c) + & - this%m_decomp_npools_to_fire_col(c,k) - end do - end do - - end subroutine Summary_nitrogenflux - -end module CNVegNitrogenFluxType - diff --git a/src/biogeochem/CNVegNitrogenStateType.F90 b/src/biogeochem/CNVegNitrogenStateType.F90 deleted file mode 100644 index 97a5ffaae4..0000000000 --- a/src/biogeochem/CNVegNitrogenStateType.F90 +++ /dev/null @@ -1,1286 +0,0 @@ -module CNVegNitrogenStateType - -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevdecomp - use clm_varcon , only : spval, ispval, dzsoi_decomp, zisoi - use landunit_varcon , only : istcrop, istsoil - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_century_decomp - use clm_varctl , only : iulog, override_bgc_restart_mismatch_dump - use clm_varctl , only : use_crop - use CNSharedParamsMod , only : use_fun - use decompMod , only : bounds_type - use pftconMod , only : npcropmin, noveg, pftcon - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use abortutils , only : endrun - use spmdMod , only : masterproc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use dynPatchStateUpdaterMod, only : patch_state_updater_type - use CNSpeciesMod , only : CN_SPECIES_N - use CNVegComputeSeedMod, only : ComputeSeedAmounts - ! - ! !PUBLIC TYPES: - implicit none - - private - - - ! - type, public :: cnveg_nitrogenstate_type - - real(r8), pointer :: grainn_patch (:) ! (gN/m2) grain N (crop) - real(r8), pointer :: grainn_storage_patch (:) ! (gN/m2) grain N storage (crop) - real(r8), pointer :: grainn_xfer_patch (:) ! (gN/m2) grain N transfer (crop) - real(r8), pointer :: leafn_patch (:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage_patch (:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer_patch (:) ! (gN/m2) leaf N transfer - real(r8), pointer :: leafn_storage_xfer_acc_patch (:) ! (gN/m2) Accmulated leaf N transfer - real(r8), pointer :: storage_ndemand_patch (:) ! (gN/m2) N demand during the offset period - real(r8), pointer :: frootn_patch (:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage_patch (:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer_patch (:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_patch (:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage_patch (:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer_patch (:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_patch (:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage_patch (:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer_patch (:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_patch (:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage_patch (:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer_patch (:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_patch (:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage_patch (:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer_patch (:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: retransn_patch (:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: npool_patch (:) ! (gN/m2) temporary plant N pool - real(r8), pointer :: ntrunc_patch (:) ! (gN/m2) patch-level sink for N truncation - real(r8), pointer :: cropseedn_deficit_patch (:) ! (gN/m2) pool for seeding new crop growth; this is a NEGATIVE term, indicating the amount of seed usage that needs to be repaid - real(r8), pointer :: seedn_grc (:) ! (gN/m2) gridcell-level pool for seeding new pFTs via dynamic landcover - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: dispvegn_patch (:) ! (gN/m2) displayed veg nitrogen, excluding storage - real(r8), pointer :: storvegn_patch (:) ! (gN/m2) stored vegetation nitrogen - real(r8), pointer :: totvegn_patch (:) ! (gN/m2) total vegetation nitrogen - real(r8), pointer :: totvegn_col (:) ! (gN/m2) total vegetation nitrogen (p2c) - real(r8), pointer :: totn_patch (:) ! (gN/m2) total patch-level nitrogen - real(r8), pointer :: totn_p2c_col (:) ! (gN/m2) totn_patch averaged to col - real(r8), pointer :: totn_col (:) ! (gN/m2) total column nitrogen, incl veg - real(r8), pointer :: totecosysn_col (:) ! (gN/m2) total ecosystem nitrogen, incl veg - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , public :: ZeroDWT - procedure , public :: Summary => Summary_nitrogenstate - procedure , public :: DynamicPatchAdjustments ! adjust state variables when patch areas change - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type cnveg_nitrogenstate_type - !------------------------------------------------------------------------ - - ! !PRIVATE DATA: - character(len=*), parameter :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - leafc_patch, leafc_storage_patch, frootc_patch, frootc_storage_patch, deadstemc_patch) - - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: leafc_patch (bounds%begp:) - real(r8) , intent(in) :: leafc_storage_patch (bounds%begp:) - real(r8) , intent(in) :: frootc_patch (bounds%begp:) - real(r8) , intent(in) :: frootc_storage_patch (bounds%begp:) - real(r8) , intent(in) :: deadstemc_patch (bounds%begp:) - - call this%InitAllocate (bounds ) - call this%InitHistory (bounds) - call this%InitCold ( bounds, & - leafc_patch, leafc_storage_patch, frootc_patch, frootc_storage_patch, deadstemc_patch) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%grainn_patch (begp:endp)) ; this%grainn_patch (:) = nan - allocate(this%grainn_storage_patch (begp:endp)) ; this%grainn_storage_patch (:) = nan - allocate(this%grainn_xfer_patch (begp:endp)) ; this%grainn_xfer_patch (:) = nan - allocate(this%leafn_patch (begp:endp)) ; this%leafn_patch (:) = nan - allocate(this%leafn_storage_patch (begp:endp)) ; this%leafn_storage_patch (:) = nan - allocate(this%leafn_xfer_patch (begp:endp)) ; this%leafn_xfer_patch (:) = nan - allocate(this%leafn_storage_xfer_acc_patch (begp:endp)) ; this%leafn_storage_xfer_acc_patch (:) = nan - allocate(this%storage_ndemand_patch (begp:endp)) ; this%storage_ndemand_patch (:) = nan - allocate(this%frootn_patch (begp:endp)) ; this%frootn_patch (:) = nan - allocate(this%frootn_storage_patch (begp:endp)) ; this%frootn_storage_patch (:) = nan - allocate(this%frootn_xfer_patch (begp:endp)) ; this%frootn_xfer_patch (:) = nan - allocate(this%livestemn_patch (begp:endp)) ; this%livestemn_patch (:) = nan - allocate(this%livestemn_storage_patch (begp:endp)) ; this%livestemn_storage_patch (:) = nan - allocate(this%livestemn_xfer_patch (begp:endp)) ; this%livestemn_xfer_patch (:) = nan - allocate(this%deadstemn_patch (begp:endp)) ; this%deadstemn_patch (:) = nan - allocate(this%deadstemn_storage_patch (begp:endp)) ; this%deadstemn_storage_patch (:) = nan - allocate(this%deadstemn_xfer_patch (begp:endp)) ; this%deadstemn_xfer_patch (:) = nan - allocate(this%livecrootn_patch (begp:endp)) ; this%livecrootn_patch (:) = nan - allocate(this%livecrootn_storage_patch (begp:endp)) ; this%livecrootn_storage_patch (:) = nan - allocate(this%livecrootn_xfer_patch (begp:endp)) ; this%livecrootn_xfer_patch (:) = nan - allocate(this%deadcrootn_patch (begp:endp)) ; this%deadcrootn_patch (:) = nan - allocate(this%deadcrootn_storage_patch (begp:endp)) ; this%deadcrootn_storage_patch (:) = nan - allocate(this%deadcrootn_xfer_patch (begp:endp)) ; this%deadcrootn_xfer_patch (:) = nan - allocate(this%retransn_patch (begp:endp)) ; this%retransn_patch (:) = nan - allocate(this%npool_patch (begp:endp)) ; this%npool_patch (:) = nan - allocate(this%ntrunc_patch (begp:endp)) ; this%ntrunc_patch (:) = nan - allocate(this%dispvegn_patch (begp:endp)) ; this%dispvegn_patch (:) = nan - allocate(this%storvegn_patch (begp:endp)) ; this%storvegn_patch (:) = nan - allocate(this%totvegn_patch (begp:endp)) ; this%totvegn_patch (:) = nan - allocate(this%totn_patch (begp:endp)) ; this%totn_patch (:) = nan - - allocate(this%cropseedn_deficit_patch (begp:endp)) ; this%cropseedn_deficit_patch (:) = nan - allocate(this%seedn_grc (begg:endg)) ; this%seedn_grc (:) = nan - allocate(this%totvegn_col (begc:endc)) ; this%totvegn_col (:) = nan - allocate(this%totn_p2c_col (begc:endc)) ; this%totn_p2c_col (:) = nan - allocate(this%totn_col (begc:endc)) ; this%totn_col (:) = nan - allocate(this%totecosysn_col (begc:endc)) ; this%totecosysn_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - integer :: begp,endp - integer :: begc,endc - integer :: begg,endg - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - !------------------------------- - ! patch state variables - !------------------------------- - - if (use_crop) then - this%grainn_patch(begp:endp) = spval - call hist_addfld1d (fname='GRAINN', units='gN/m^2', & - avgflag='A', long_name='grain N', & - ptr_patch=this%grainn_patch) - call hist_addfld1d (fname='CROPSEEDN_DEFICIT', units='gN/m^2', & - avgflag='A', long_name='N used for crop seed that needs to be repaid', & - ptr_patch=this%cropseedn_deficit_patch, default='inactive') - end if - - this%leafn_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN', units='gN/m^2', & - avgflag='A', long_name='leaf N', & - ptr_patch=this%leafn_patch) - - this%leafn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='leaf N storage', & - ptr_patch=this%leafn_storage_patch, default='inactive') - - this%leafn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_XFER', units='gN/m^2', & - avgflag='A', long_name='leaf N transfer', & - ptr_patch=this%leafn_xfer_patch, default='inactive') - - if ( use_fun ) then - this%leafn_storage_xfer_acc_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFN_STORAGE_XFER_ACC', units='gN/m^2', & - avgflag='A', long_name='Accmulated leaf N transfer', & - ptr_patch=this%leafn_storage_xfer_acc_patch, default='inactive') - - this%storage_ndemand_patch(begp:endp) = spval - call hist_addfld1d (fname='STORAGE_NDEMAND', units='gN/m^2', & - avgflag='A', long_name='N demand during the offset period', & - ptr_patch=this%storage_ndemand_patch, default='inactive') - end if - - this%frootn_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN', units='gN/m^2', & - avgflag='A', long_name='fine root N', & - ptr_patch=this%frootn_patch) - - this%frootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='fine root N storage', & - ptr_patch=this%frootn_storage_patch, default='inactive') - - this%frootn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='FROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='fine root N transfer', & - ptr_patch=this%frootn_xfer_patch, default='inactive') - - this%livestemn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN', units='gN/m^2', & - avgflag='A', long_name='live stem N', & - ptr_patch=this%livestemn_patch) - - this%livestemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='live stem N storage', & - ptr_patch=this%livestemn_storage_patch, default='inactive') - - this%livestemn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVESTEMN_XFER', units='gN/m^2', & - avgflag='A', long_name='live stem N transfer', & - ptr_patch=this%livestemn_xfer_patch, default='inactive') - - this%deadstemn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN', units='gN/m^2', & - avgflag='A', long_name='dead stem N', & - ptr_patch=this%deadstemn_patch) - - this%deadstemn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='dead stem N storage', & - ptr_patch=this%deadstemn_storage_patch, default='inactive') - - this%deadstemn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADSTEMN_XFER', units='gN/m^2', & - avgflag='A', long_name='dead stem N transfer', & - ptr_patch=this%deadstemn_xfer_patch, default='inactive') - - this%livecrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN', units='gN/m^2', & - avgflag='A', long_name='live coarse root N', & - ptr_patch=this%livecrootn_patch) - - this%livecrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='live coarse root N storage', & - ptr_patch=this%livecrootn_storage_patch, default='inactive') - - this%livecrootn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='LIVECROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='live coarse root N transfer', & - ptr_patch=this%livecrootn_xfer_patch, default='inactive') - - this%deadcrootn_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N', & - ptr_patch=this%deadcrootn_patch) - - this%deadcrootn_storage_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N storage', & - ptr_patch=this%deadcrootn_storage_patch, default='inactive') - - this%deadcrootn_xfer_patch(begp:endp) = spval - call hist_addfld1d (fname='DEADCROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N transfer', & - ptr_patch=this%deadcrootn_xfer_patch, default='inactive') - - this%retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='RETRANSN', units='gN/m^2', & - avgflag='A', long_name='plant pool of retranslocated N', & - ptr_patch=this%retransn_patch) - - this%npool_patch(begp:endp) = spval - call hist_addfld1d (fname='NPOOL', units='gN/m^2', & - avgflag='A', long_name='temporary plant N pool', & - ptr_patch=this%npool_patch) - - this%ntrunc_patch(begp:endp) = spval - call hist_addfld1d (fname='PFT_NTRUNC', units='gN/m^2', & - avgflag='A', long_name='patch-level sink for N truncation', & - ptr_patch=this%ntrunc_patch, default='inactive') - - this%dispvegn_patch(begp:endp) = spval - call hist_addfld1d (fname='DISPVEGN', units='gN/m^2', & - avgflag='A', long_name='displayed vegetation nitrogen', & - ptr_patch=this%dispvegn_patch) - - this%storvegn_patch(begp:endp) = spval - call hist_addfld1d (fname='STORVEGN', units='gN/m^2', & - avgflag='A', long_name='stored vegetation nitrogen', & - ptr_patch=this%storvegn_patch) - - this%totvegn_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTVEGN', units='gN/m^2', & - avgflag='A', long_name='total vegetation nitrogen', & - ptr_patch=this%totvegn_patch) - - this%totn_patch(begp:endp) = spval - call hist_addfld1d (fname='TOTPFTN', units='gN/m^2', & - avgflag='A', long_name='total patch-level nitrogen', & - ptr_patch=this%totn_patch) - - !------------------------------- - ! column state variables - !------------------------------- - - this%seedn_grc(begg:endg) = spval - call hist_addfld1d (fname='SEEDN', units='gN/m^2', & - avgflag='A', long_name='pool for seeding new PFTs via dynamic landcover', & - ptr_gcell=this%seedn_grc) - - this%totecosysn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTECOSYSN', units='gN/m^2', & - avgflag='A', long_name='total ecosystem N, excluding product pools', & - ptr_col=this%totecosysn_col) - - this%totn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTCOLN', units='gN/m^2', & - avgflag='A', long_name='total column-level N, excluding product pools', & - ptr_col=this%totn_col) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - leafc_patch, leafc_storage_patch, frootc_patch, frootc_storage_patch, deadstemc_patch) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - use clm_varctl , only : MM_Nuptake_opt - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: leafc_patch(bounds%begp:) - real(r8) , intent(in) :: leafc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: deadstemc_patch(bounds%begp:) - ! - ! !LOCAL VARIABLES: - integer :: fc,fp,g,l,c,p,j,k ! indices - integer :: num_special_col ! number of good values in special_col filter - integer :: num_special_patch ! number of good values in special_patch filter - integer :: special_col (bounds%endc-bounds%begc+1) ! special landunit filter - columns - integer :: special_patch (bounds%endp-bounds%begp+1) ! special landunit filter - patches - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(leafc_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leafc_storage_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frootc_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frootc_storage_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(deadstemc_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - ! Set column filters - - num_special_patch = 0 - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - if (lun%ifspecial(l)) then - num_special_patch = num_special_patch + 1 - special_patch(num_special_patch) = p - end if - end do - - ! Set patch filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - !------------------------------------------- - ! initialize patch-level variables - !------------------------------------------- - - do p = bounds%begp,bounds%endp - - l = patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - if (patch%itype(p) == noveg) then - this%leafn_patch(p) = 0._r8 - this%leafn_storage_patch(p) = 0._r8 - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - else - this%leafn_patch(p) = leafc_patch(p) / pftcon%leafcn(patch%itype(p)) - this%leafn_storage_patch(p) = leafc_storage_patch(p) / pftcon%leafcn(patch%itype(p)) - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = frootc_patch(p) / pftcon%frootcn(patch%itype(p)) - this%frootn_storage_patch(p) = frootc_storage_patch(p) / pftcon%frootcn(patch%itype(p)) - end if - end if - - this%leafn_xfer_patch(p) = 0._r8 - - this%leafn_storage_xfer_acc_patch(p) = 0._r8 - this%storage_ndemand_patch(p) = 0._r8 - - if ( use_crop )then - this%grainn_patch(p) = 0._r8 - this%grainn_storage_patch(p) = 0._r8 - this%grainn_xfer_patch(p) = 0._r8 - this%cropseedn_deficit_patch(p) = 0._r8 - end if - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - this%frootn_xfer_patch(p) = 0._r8 - this%livestemn_patch(p) = 0._r8 - this%livestemn_storage_patch(p) = 0._r8 - this%livestemn_xfer_patch(p) = 0._r8 - - ! tree types need to be initialized with some stem mass so that - ! roughness length is not zero in canopy flux calculation - - if (pftcon%woody(patch%itype(p)) == 1._r8) then - this%deadstemn_patch(p) = deadstemc_patch(p) / pftcon%deadwdcn(patch%itype(p)) - else - this%deadstemn_patch(p) = 0._r8 - end if - - this%deadstemn_storage_patch(p) = 0._r8 - this%deadstemn_xfer_patch(p) = 0._r8 - this%livecrootn_patch(p) = 0._r8 - this%livecrootn_storage_patch(p) = 0._r8 - this%livecrootn_xfer_patch(p) = 0._r8 - this%deadcrootn_patch(p) = 0._r8 - this%deadcrootn_storage_patch(p) = 0._r8 - this%deadcrootn_xfer_patch(p) = 0._r8 - this%retransn_patch(p) = 0._r8 - this%npool_patch(p) = 0._r8 - this%ntrunc_patch(p) = 0._r8 - this%dispvegn_patch(p) = 0._r8 - this%storvegn_patch(p) = 0._r8 - this%totvegn_patch(p) = 0._r8 - this%totn_patch(p) = 0._r8 - end if - end do - - !------------------------------------------- - ! initialize column-level variables - !------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - ! total nitrogen pools - this%totecosysn_col(c) = 0._r8 - this%totn_p2c_col(c) = 0._r8 - this%totn_col(c) = 0._r8 - end if - end do - - - do g = bounds%begg, bounds%endg - this%seedn_grc(g) = 0._r8 - end do - - ! now loop through special filters and explicitly set the variables that - ! have to be in place for biogeophysics - - ! initialize fields for special filters - - call this%SetValues (& - num_patch=num_special_patch, filter_patch=special_patch, value_patch=0._r8, & - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, leafc_patch, & - leafc_storage_patch, frootc_patch, frootc_storage_patch, & - deadstemc_patch, filter_reseed_patch, num_reseed_patch ) - ! - ! !DESCRIPTION: - ! Read/write restart data - ! - ! !USES: - use restUtilMod - use ncdio_pio - use clm_varctl , only : spinup_state, use_cndv - use clm_time_manager , only : get_nstep, is_restart - use clm_varctl , only : MM_Nuptake_opt - - ! - ! !ARGUMENTS: - class (cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: flag !'read' or 'write' or 'define' - real(r8) , intent(in) :: leafc_patch(bounds%begp:) - real(r8) , intent(in) :: leafc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_patch(bounds%begp:) - real(r8) , intent(in) :: frootc_storage_patch(bounds%begp:) - real(r8) , intent(in) :: deadstemc_patch(bounds%begp:) - integer , intent(in) :: filter_reseed_patch(:) - integer , intent(in) :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - integer :: i, p, l - logical :: readvar - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - character(len=128) :: varname ! temporary - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - integer :: idata - - ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - integer :: restart_file_spinup_state - - !------------------------------------------------------------------------ - - !-------------------------------- - ! patch nitrogen state variables - !-------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='leafn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_xfer_patch) - - if ( use_fun ) then - call restartvar(ncid=ncid, flag=flag, varname='leafn_storage_xfer_acc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafn_storage_xfer_acc_patch) - - call restartvar(ncid=ncid, flag=flag, varname='storage_ndemand', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%storage_ndemand_patch) - end if - - - call restartvar(ncid=ncid, flag=flag, varname='frootn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='frootn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frootn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livestemn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livestemn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadstemn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadstemn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='livecrootn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%livecrootn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootn_storage', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='deadcrootn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%deadcrootn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='retransn', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='npool', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%npool_patch) - - call restartvar(ncid=ncid, flag=flag, varname='pft_ntrunc', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ntrunc_patch) - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='grainn', xtype=ncd_double, & - dim1name='pft', long_name='grain N', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainn_storage', xtype=ncd_double, & - dim1name='pft', long_name='grain N storage', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_storage_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grainn_xfer', xtype=ncd_double, & - dim1name='pft', long_name='grain N transfer', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%grainn_xfer_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cropseedn_deficit', xtype=ncd_double, & - dim1name='pft', long_name='pool for seeding new crop growth', units='gN/m2', & - interpinic_flag='interp', readvar=readvar, data=this%cropseedn_deficit_patch) - end if - - !-------------------------------- - ! gridcell nitrogen state variables - !-------------------------------- - - ! BACKWARDS_COMPATIBILITY(wjs, 2017-01-12) Naming this with a _g suffix in order to - ! distinguish it from the old column-level seedn restart variable - call restartvar(ncid=ncid, flag=flag, varname='seedn_g', xtype=ncd_double, & - dim1name='gridcell', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%seedn_grc) - - - if (flag == 'read') then - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - - if (readvar) then - restart_file_spinup_state = idata - else - restart_file_spinup_state = spinup_state - if ( masterproc ) then - write(iulog,*) ' CNRest: WARNING! Restart file does not contain info ' & - // ' on spinup state used to generate the restart file. ' - write(iulog,*) ' Assuming the same as current setting: ', spinup_state - end if - end if - end if - - if (flag == 'read' .and. spinup_state /= restart_file_spinup_state .and. .not. use_cndv) then - if (spinup_state <= 1 .and. restart_file_spinup_state == 2 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood N pools out of AD spinup mode' - exit_spinup = .true. - if ( masterproc ) write(iulog, *) 'Multiplying stemn and crootn by 10 for exit spinup ' - do i = bounds%begp,bounds%endp - this%deadstemn_patch(i) = this%deadstemn_patch(i) * 10._r8 - this%deadcrootn_patch(i) = this%deadcrootn_patch(i) * 10._r8 - end do - else if (spinup_state == 2 .and. restart_file_spinup_state <= 1 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking Dead wood N pools into AD spinup mode' - enter_spinup = .true. - if ( masterproc ) write(iulog, *) 'Dividing stemn and crootn by 10 for enter spinup ' - do i = bounds%begp,bounds%endp - this%deadstemn_patch(i) = this%deadstemn_patch(i) / 10._r8 - this%deadcrootn_patch(i) = this%deadcrootn_patch(i) / 10._r8 - end do - endif - - end if - ! Reseed dead plants - if ( flag == 'read' .and. num_reseed_patch > 0 )then - if ( masterproc ) write(iulog, *) 'Reseed dead plants for CNVegNitrogenState' - do i = 1, num_reseed_patch - p = filter_reseed_patch(i) - - l = patch%landunit(p) - - if (patch%itype(p) == noveg) then - this%leafn_patch(p) = 0._r8 - this%leafn_storage_patch(p) = 0._r8 - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - else - this%leafn_patch(p) = leafc_patch(p) / pftcon%leafcn(patch%itype(p)) - this%leafn_storage_patch(p) = leafc_storage_patch(p) / pftcon%leafcn(patch%itype(p)) - if (MM_Nuptake_opt .eqv. .true.) then - this%frootn_patch(p) = frootc_patch(p) / pftcon%frootcn(patch%itype(p)) - this%frootn_storage_patch(p) = frootc_storage_patch(p) / pftcon%frootcn(patch%itype(p)) - end if - end if - - this%leafn_xfer_patch(p) = 0._r8 - - this%leafn_storage_xfer_acc_patch(p) = 0._r8 - this%storage_ndemand_patch(p) = 0._r8 - - if ( use_crop )then - this%grainn_patch(p) = 0._r8 - this%grainn_storage_patch(p) = 0._r8 - this%grainn_xfer_patch(p) = 0._r8 - this%cropseedn_deficit_patch(p) = 0._r8 - end if - if (MM_Nuptake_opt .eqv. .false.) then ! if not running in floating CN ratio option - this%frootn_patch(p) = 0._r8 - this%frootn_storage_patch(p) = 0._r8 - end if - this%frootn_xfer_patch(p) = 0._r8 - this%livestemn_patch(p) = 0._r8 - this%livestemn_storage_patch(p) = 0._r8 - this%livestemn_xfer_patch(p) = 0._r8 - - ! tree types need to be initialized with some stem mass so that - ! roughness length is not zero in canopy flux calculation - - if (pftcon%woody(patch%itype(p)) == 1._r8) then - this%deadstemn_patch(p) = deadstemc_patch(p) / pftcon%deadwdcn(patch%itype(p)) - else - this%deadstemn_patch(p) = 0._r8 - end if - - this%deadstemn_storage_patch(p) = 0._r8 - this%deadstemn_xfer_patch(p) = 0._r8 - this%livecrootn_patch(p) = 0._r8 - this%livecrootn_storage_patch(p) = 0._r8 - this%livecrootn_xfer_patch(p) = 0._r8 - this%deadcrootn_patch(p) = 0._r8 - this%deadcrootn_storage_patch(p) = 0._r8 - this%deadcrootn_xfer_patch(p) = 0._r8 - this%retransn_patch(p) = 0._r8 - this%npool_patch(p) = 0._r8 - this%ntrunc_patch(p) = 0._r8 - this%dispvegn_patch(p) = 0._r8 - this%storvegn_patch(p) = 0._r8 - this%totvegn_patch(p) = 0._r8 - this%totn_patch(p) = 0._r8 - - ! calculate totvegc explicitly so that it is available for the isotope - ! code on the first time step. - - this%totvegn_patch(p) = & - this%leafn_patch(p) + & - this%leafn_storage_patch(p) + & - this%leafn_xfer_patch(p) + & - this%frootn_patch(p) + & - this%frootn_storage_patch(p) + & - this%frootn_xfer_patch(p) + & - this%livestemn_patch(p) + & - this%livestemn_storage_patch(p) + & - this%livestemn_xfer_patch(p) + & - this%deadstemn_patch(p) + & - this%deadstemn_storage_patch(p) + & - this%deadstemn_xfer_patch(p) + & - this%livecrootn_patch(p) + & - this%livecrootn_storage_patch(p) + & - this%livecrootn_xfer_patch(p) + & - this%deadcrootn_patch(p) + & - this%deadcrootn_storage_patch(p) + & - this%deadcrootn_xfer_patch(p) + & - this%npool_patch(p) - - if ( use_crop )then - this%totvegn_patch(p) = & - this%totvegn_patch(p) + & - this%grainn_patch(p) + & - this%grainn_storage_patch(p) + & - this%grainn_xfer_patch(p) - end if - end do - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_patch, filter_patch, value_patch, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set nitrogen state variables - ! - ! !ARGUMENTS: - class (cnveg_nitrogenstate_type) :: this - integer , intent(in) :: num_patch - integer , intent(in) :: filter_patch(:) - real(r8), intent(in) :: value_patch - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k ! indices - !------------------------------------------------------------------------ - - do fi = 1,num_patch - i = filter_patch(fi) - - this%leafn_patch(i) = value_patch - this%leafn_storage_patch(i) = value_patch - this%leafn_xfer_patch(i) = value_patch - this%leafn_storage_xfer_acc_patch(i) = value_patch - this%frootn_patch(i) = value_patch - this%frootn_storage_patch(i) = value_patch - this%frootn_xfer_patch(i) = value_patch - this%livestemn_patch(i) = value_patch - this%livestemn_storage_patch(i) = value_patch - this%livestemn_xfer_patch(i) = value_patch - this%deadstemn_patch(i) = value_patch - this%deadstemn_storage_patch(i) = value_patch - this%deadstemn_xfer_patch(i) = value_patch - this%livecrootn_patch(i) = value_patch - this%livecrootn_storage_patch(i) = value_patch - this%livecrootn_xfer_patch(i) = value_patch - this%deadcrootn_patch(i) = value_patch - this%deadcrootn_storage_patch(i) = value_patch - this%deadcrootn_xfer_patch(i) = value_patch - this%retransn_patch(i) = value_patch - this%npool_patch(i) = value_patch - this%ntrunc_patch(i) = value_patch - this%dispvegn_patch(i) = value_patch - this%storvegn_patch(i) = value_patch - this%totvegn_patch(i) = value_patch - this%totn_patch(i) = value_patch - end do - - if ( use_crop )then - do fi = 1,num_patch - i = filter_patch(fi) - this%grainn_patch(i) = value_patch - this%grainn_storage_patch(i) = value_patch - this%grainn_xfer_patch(i) = value_patch - this%cropseedn_deficit_patch(i) = value_patch - end do - end if - - do fi = 1,num_column - i = filter_column(fi) - - this%totecosysn_col(i) = value_column - this%totvegn_col(i) = value_column - this%totn_p2c_col(i) = value_column - this%totn_col(i) = value_column - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine ZeroDwt( this, bounds ) - ! - ! !DESCRIPTION - ! Initialize variables needed for dynamic land use. - ! - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p ! indices - !----------------------------------------------------------------------- - - do p = bounds%begp,bounds%endp - this%dispvegn_patch(p) = 0._r8 - this%storvegn_patch(p) = 0._r8 - this%totvegn_patch(p) = 0._r8 - this%totn_patch(p) = 0._r8 - end do - - end subroutine ZeroDwt - - !----------------------------------------------------------------------- - subroutine Summary_nitrogenstate(this, bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp,& - soilbiogeochem_nitrogenstate_inst) - ! - ! !USES: - use subgridAveMod, only : p2c - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - ! - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - 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(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,k,l ! indices - integer :: fp,fc ! lake filter indices - real(r8) :: maxdepth ! depth to integrate soil variables - !----------------------------------------------------------------------- - - ! -------------------------------------------- - ! patch level summary - ! -------------------------------------------- - - do fp = 1,num_soilp - p = filter_soilp(fp) - - - ! displayed vegetation nitrogen, excluding storage (DISPVEGN) - this%dispvegn_patch(p) = & - this%leafn_patch(p) + & - this%frootn_patch(p) + & - this%livestemn_patch(p) + & - this%deadstemn_patch(p) + & - this%livecrootn_patch(p) + & - this%deadcrootn_patch(p) - - ! stored vegetation nitrogen, including retranslocated N pool (STORVEGN) - this%storvegn_patch(p) = & - this%leafn_storage_patch(p) + & - this%frootn_storage_patch(p) + & - this%livestemn_storage_patch(p) + & - this%deadstemn_storage_patch(p) + & - this%livecrootn_storage_patch(p) + & - this%deadcrootn_storage_patch(p) + & - this%leafn_xfer_patch(p) + & - this%frootn_xfer_patch(p) + & - this%livestemn_xfer_patch(p) + & - this%deadstemn_xfer_patch(p) + & - this%livecrootn_xfer_patch(p) + & - this%deadcrootn_xfer_patch(p) + & - this%npool_patch(p) + & - this%retransn_patch(p) - - if ( use_crop .and. patch%itype(p) >= npcropmin )then - this%dispvegn_patch(p) = & - this%dispvegn_patch(p) + & - this%grainn_patch(p) - - this%storvegn_patch(p) = & - this%storvegn_patch(p) + & - this%grainn_storage_patch(p) + & - this%grainn_xfer_patch(p) + & - this%cropseedn_deficit_patch(p) - end if - - ! total vegetation nitrogen (TOTVEGN) - this%totvegn_patch(p) = & - this%dispvegn_patch(p) + & - this%storvegn_patch(p) - - ! total patch-level carbon (add ntrunc) - this%totn_patch(p) = & - this%totvegn_patch(p) + & - this%ntrunc_patch(p) - - end do - - ! -------------------------------------------- - ! column level summary - ! -------------------------------------------- - - call p2c(bounds, num_soilc, filter_soilc, & - this%totvegn_patch(bounds%begp:bounds%endp), & - this%totvegn_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_soilc, filter_soilc, & - this%totn_patch(bounds%begp:bounds%endp), & - this%totn_p2c_col(bounds%begc:bounds%endc)) - - do fc = 1,num_allc - c = filter_allc(fc) - - ! total ecosystem nitrogen, including veg (TOTECOSYSN) - this%totecosysn_col(c) = & - soilbiogeochem_nitrogenstate_inst%cwdn_col(c) + & - soilbiogeochem_nitrogenstate_inst%totlitn_col(c) + & - soilbiogeochem_nitrogenstate_inst%totsomn_col(c) + & - soilbiogeochem_nitrogenstate_inst%sminn_col(c) + & - this%totvegn_col(c) - - ! total column nitrogen, including patch (TOTCOLN) - - this%totn_col(c) = this%totn_p2c_col(c) + & - soilbiogeochem_nitrogenstate_inst%cwdn_col(c) + & - soilbiogeochem_nitrogenstate_inst%totlitn_col(c) + & - soilbiogeochem_nitrogenstate_inst%totsomn_col(c) + & - soilbiogeochem_nitrogenstate_inst%sminn_col(c) + & - soilbiogeochem_nitrogenstate_inst%ntrunc_col(c) - - end do - - - - - end subroutine Summary_nitrogenstate - - !----------------------------------------------------------------------- - subroutine DynamicPatchAdjustments(this, bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - patch_state_updater, & - leafc_seed, deadstemc_seed, & - conv_nflux, wood_product_nflux, crop_product_nflux, & - dwt_frootn_to_litter, & - dwt_livecrootn_to_litter, & - dwt_deadcrootn_to_litter, & - dwt_leafn_seed, & - dwt_deadstemn_seed) - ! - ! !DESCRIPTION: - ! Adjust state variables and compute associated fluxes when patch areas change due to - ! dynamic landuse - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cnveg_nitrogenstate_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp_with_inactive ! number of points in filter - integer , intent(in) :: filter_soilp_with_inactive(:) ! soil patch filter that includes inactive points - type(patch_state_updater_type) , intent(in) :: patch_state_updater - real(r8) , intent(in) :: leafc_seed ! seed amount for leaf C - real(r8) , intent(in) :: deadstemc_seed ! seed amount for deadstem C - real(r8) , intent(inout) :: conv_nflux( bounds%begp: ) ! patch-level conversion N flux to atm (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: wood_product_nflux( bounds%begp: ) ! patch-level product N flux (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: crop_product_nflux( bounds%begp: ) ! patch-level crop product N flux (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: dwt_frootn_to_litter( bounds%begp: ) ! patch-level fine root N to litter (expressed per unit COLUMN area) - real(r8) , intent(inout) :: dwt_livecrootn_to_litter( bounds%begp: ) ! patch-level live coarse root N to litter (expressed per unit COLUMN area) - real(r8) , intent(inout) :: dwt_deadcrootn_to_litter( bounds%begp: ) ! patch-level live coarse root N to litter (expressed per unit COLUMN area) - real(r8) , intent(inout) :: dwt_leafn_seed( bounds%begp: ) ! patch-level mass gain due to seeding of new area: leaf N (expressed per unit GRIDCELL area) - real(r8) , intent(inout) :: dwt_deadstemn_seed( bounds%begp: ) ! patch-level mass gain due to seeding of new area: deadstem N (expressed per unit GRIDCELL area) - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - logical :: old_weight_was_zero(bounds%begp:bounds%endp) - logical :: patch_grew(bounds%begp:bounds%endp) - - ! The following are only set for growing patches: - real(r8) :: seed_leafn_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leafn_storage_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leafn_xfer_patch(bounds%begp:bounds%endp) - real(r8) :: seed_deadstemn_patch(bounds%begp:bounds%endp) - - character(len=*), parameter :: subname = 'DynamicPatchAdjustments' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - SHR_ASSERT_ALL((ubound(conv_nflux) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wood_product_nflux) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(crop_product_nflux) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_frootn_to_litter) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_livecrootn_to_litter) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_deadcrootn_to_litter) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_leafn_seed) == (/endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dwt_deadstemn_seed) == (/endp/)), errMsg(sourcefile, __LINE__)) - - old_weight_was_zero = patch_state_updater%old_weight_was_zero(bounds) - patch_grew = patch_state_updater%patch_grew(bounds) - - call ComputeSeedAmounts(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - species = CN_SPECIES_N, & - leafc_seed = leafc_seed, & - deadstemc_seed = deadstemc_seed, & - leaf_patch = this%leafn_patch(begp:endp), & - leaf_storage_patch = this%leafn_storage_patch(begp:endp), & - leaf_xfer_patch = this%leafn_xfer_patch(begp:endp), & - - ! Calculations only needed for patches that grew: - compute_here_patch = patch_grew(begp:endp), & - - ! For patches that previously had zero area, ignore the current state for the - ! sake of computing leaf proportions: - ignore_current_state_patch = old_weight_was_zero(begp:endp), & - - seed_leaf_patch = seed_leafn_patch(begp:endp), & - seed_leaf_storage_patch = seed_leafn_storage_patch(begp:endp), & - seed_leaf_xfer_patch = seed_leafn_xfer_patch(begp:endp), & - seed_deadstem_patch = seed_deadstemn_patch(begp:endp)) - - call update_patch_state( & - var = this%leafn_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp), & - seed = seed_leafn_patch(begp:endp), & - seed_addition = dwt_leafn_seed(begp:endp)) - - call update_patch_state( & - var = this%leafn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp), & - seed = seed_leafn_storage_patch(begp:endp), & - seed_addition = dwt_leafn_seed(begp:endp)) - - call update_patch_state( & - var = this%leafn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp), & - seed = seed_leafn_xfer_patch(begp:endp), & - seed_addition = dwt_leafn_seed(begp:endp)) - - call update_patch_state( & - var = this%frootn_patch(begp:endp), & - flux_out_col_area = dwt_frootn_to_litter(begp:endp)) - - call update_patch_state( & - var = this%frootn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%frootn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%livestemn_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%livestemn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%livestemn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call patch_state_updater%update_patch_state_partition_flux_by_type(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - flux1_fraction_by_pft_type = pftcon%pconv, & - var = this%deadstemn_patch(begp:endp), & - flux1_out = conv_nflux(begp:endp), & - flux2_out = wood_product_nflux(begp:endp), & - seed = seed_deadstemn_patch(begp:endp), & - seed_addition = dwt_deadstemn_seed(begp:endp)) - - call update_patch_state( & - var = this%deadstemn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%deadstemn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%livecrootn_patch(begp:endp), & - flux_out_col_area = dwt_livecrootn_to_litter(begp:endp)) - - call update_patch_state( & - var = this%livecrootn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%livecrootn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%deadcrootn_patch(begp:endp), & - flux_out_col_area = dwt_deadcrootn_to_litter(begp:endp)) - - call update_patch_state( & - var = this%deadcrootn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%deadcrootn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%retransn_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%npool_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%ntrunc_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - if (use_crop) then - call update_patch_state( & - var = this%grainn_patch(begp:endp), & - flux_out_grc_area = crop_product_nflux(begp:endp)) - - call update_patch_state( & - var = this%grainn_storage_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - call update_patch_state( & - var = this%grainn_xfer_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - - if (use_crop) then - ! This is a negative pool. So any deficit that we haven't repaid gets sucked out - ! of the atmosphere. - call update_patch_state( & - var = this%cropseedn_deficit_patch(begp:endp), & - flux_out_grc_area = conv_nflux(begp:endp)) - end if - end if - - contains - subroutine update_patch_state(var, flux_out_col_area, flux_out_grc_area, & - seed, seed_addition) - ! Wraps call to update_patch_state, in order to remove duplication - real(r8), intent(inout) :: var( bounds%begp: ) - real(r8), intent(inout), optional :: flux_out_col_area( bounds%begp: ) - real(r8), intent(inout), optional :: flux_out_grc_area( bounds%begp: ) - real(r8), intent(in), optional :: seed( bounds%begp: ) - real(r8), intent(inout), optional :: seed_addition( bounds%begp: ) - - call patch_state_updater%update_patch_state(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - var = var, & - flux_out_col_area = flux_out_col_area, & - flux_out_grc_area = flux_out_grc_area, & - seed = seed, & - seed_addition = seed_addition) - end subroutine update_patch_state - - - end subroutine DynamicPatchAdjustments - -end module CNVegNitrogenStateType diff --git a/src/biogeochem/CNVegStateType.F90 b/src/biogeochem/CNVegStateType.F90 deleted file mode 100644 index 85d18431c9..0000000000 --- a/src/biogeochem/CNVegStateType.F90 +++ /dev/null @@ -1,948 +0,0 @@ -module CNVegStateType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevsoi - use clm_varctl , only : use_cn, iulog, fsurdat, use_crop, use_cndv - use clm_varcon , only : spval, ispval, grlnd - use landunit_varcon, only : istsoil, istcrop - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use AnnualFluxDribbler, only : annual_flux_dribbler_type, annual_flux_dribbler_patch - use dynSubgridControlMod, only : get_for_testing_allow_non_annual_changes - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: cnveg_state_type - - integer , pointer :: burndate_patch (:) ! patch crop burn date - type(annual_flux_dribbler_type) :: dwt_dribbler_patch ! object to convert instantaneous dwt values into values that are smoothed / dribbled throughout the year - real(r8) , pointer :: dwt_smoothed_patch (:) ! change in patch weight (-1 to 1) on the gridcell in this time step; changes in first time step of year are smoothed (dribbled) over the whole year - - ! Prognostic crop model - ! - ! TODO(wjs, 2016-02-22) Most / all of these crop-specific state variables should be - ! moved to CropType - real(r8) , pointer :: hdidx_patch (:) ! patch cold hardening index? - real(r8) , pointer :: cumvd_patch (:) ! patch cumulative vernalization d?ependence? - real(r8) , pointer :: gddmaturity_patch (:) ! patch growing degree days (gdd) needed to harvest (ddays) - real(r8) , pointer :: huileaf_patch (:) ! patch heat unit index needed from planting to leaf emergence - real(r8) , pointer :: huigrain_patch (:) ! patch heat unit index needed to reach vegetative maturity - real(r8) , pointer :: aleafi_patch (:) ! patch saved leaf allocation coefficient from phase 2 - real(r8) , pointer :: astemi_patch (:) ! patch saved stem allocation coefficient from phase 2 - real(r8) , pointer :: aleaf_patch (:) ! patch leaf allocation coefficient - real(r8) , pointer :: astem_patch (:) ! patch stem allocation coefficient - real(r8) , pointer :: htmx_patch (:) ! patch max hgt attained by a crop during yr (m) - integer , pointer :: peaklai_patch (:) ! patch 1: max allowed lai; 0: not at max - - integer , pointer :: idop_patch (:) ! patch date of planting - - real(r8) , pointer :: gdp_lf_col (:) ! col global real gdp data (k US$/capita) - real(r8) , pointer :: peatf_lf_col (:) ! col global peatland fraction data (0-1) - integer , pointer :: abm_lf_col (:) ! col global peak month of crop fire emissions - - real(r8) , pointer :: lgdp_col (:) ! col gdp limitation factor for fire occurrence (0-1) - real(r8) , pointer :: lgdp1_col (:) ! col gdp limitation factor for fire spreading (0-1) - real(r8) , pointer :: lpop_col (:) ! col pop limitation factor for fire spreading (0-1) - - real(r8) , pointer :: tempavg_t2m_patch (:) ! patch temporary average 2m air temperature (K) - real(r8) , pointer :: annavg_t2m_patch (:) ! patch annual average 2m air temperature (K) - real(r8) , pointer :: annavg_t2m_col (:) ! col annual average of 2m air temperature, averaged from patch-level (K) - real(r8) , pointer :: annsum_counter_col (:) ! col seconds since last annual accumulator turnover - - ! Fire - real(r8) , pointer :: nfire_col (:) ! col fire counts (count/km2/sec), valid only in Reg. C - real(r8) , pointer :: fsr_col (:) ! col fire spread rate at column level (m/s) - real(r8) , pointer :: fd_col (:) ! col fire duration at column level (hr) - real(r8) , pointer :: lfc_col (:) ! col conversion area fraction of BET and BDT that haven't burned before (/timestep) - real(r8) , pointer :: lfc2_col (:) ! col conversion area fraction of BET and BDT that burned (/sec) - real(r8) , pointer :: dtrotr_col (:) ! col annual decreased fraction coverage of BET on the gridcell (0-1) - real(r8) , pointer :: trotr1_col (:) ! col patch weight of BET on the column (0-1) - real(r8) , pointer :: trotr2_col (:) ! col patch weight of BDT on the column (0-1) - real(r8) , pointer :: cropf_col (:) ! col crop fraction in veg column (0-1) - real(r8) , pointer :: baf_crop_col (:) ! col baf for cropland(/sec) - real(r8) , pointer :: baf_peatf_col (:) ! col baf for peatland (/sec) - real(r8) , pointer :: fbac_col (:) ! col total burned area out of conversion (/sec) - real(r8) , pointer :: fbac1_col (:) ! col burned area out of conversion region due to land use fire (/sec) - real(r8) , pointer :: wtlf_col (:) ! col fractional coverage of non-crop Patches (0-1) - real(r8) , pointer :: lfwt_col (:) ! col fractional coverage of non-crop and non-bare-soil Patches (0-1) - real(r8) , pointer :: farea_burned_col (:) ! col fractional area burned (/sec) - - real(r8), pointer :: dormant_flag_patch (:) ! patch dormancy flag - real(r8), pointer :: days_active_patch (:) ! patch number of days since last dormancy - real(r8), pointer :: onset_flag_patch (:) ! patch onset flag - real(r8), pointer :: onset_counter_patch (:) ! patch onset days counter - real(r8), pointer :: onset_gddflag_patch (:) ! patch onset flag for growing degree day sum - real(r8), pointer :: onset_fdd_patch (:) ! patch onset freezing degree days counter - real(r8), pointer :: onset_gdd_patch (:) ! patch onset growing degree days - real(r8), pointer :: onset_swi_patch (:) ! patch onset soil water index - real(r8), pointer :: offset_flag_patch (:) ! patch offset flag - real(r8), pointer :: offset_counter_patch (:) ! patch offset days counter - real(r8), pointer :: offset_fdd_patch (:) ! patch offset freezing degree days counter - real(r8), pointer :: offset_swi_patch (:) ! patch offset soil water index - real(r8), pointer :: grain_flag_patch (:) ! patch 1: grain fill stage; 0: not - real(r8), pointer :: lgsf_patch (:) ! patch long growing season factor [0-1] - real(r8), pointer :: bglfr_patch (:) ! patch background litterfall rate (1/s) - real(r8), pointer :: bgtr_patch (:) ! patch background transfer growth rate (1/s) - real(r8), pointer :: c_allometry_patch (:) ! patch C allocation index (DIM) - real(r8), pointer :: n_allometry_patch (:) ! patch N allocation index (DIM) - - real(r8), pointer :: tempsum_potential_gpp_patch (:) ! patch temporary annual sum of potential GPP - real(r8), pointer :: annsum_potential_gpp_patch (:) ! patch annual sum of potential GPP - real(r8), pointer :: tempmax_retransn_patch (:) ! patch temporary annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: annmax_retransn_patch (:) ! patch annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: downreg_patch (:) ! patch fractional reduction in GPP due to N limitation (DIM) - real(r8), pointer :: leafcn_offset_patch (:) ! patch leaf C:N used by FUN - real(r8), pointer :: plantCN_patch (:) ! patch plant C:N used by FUN - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type cnveg_state_type - !------------------------------------------------------------------------ - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate ( bounds ) - if (use_cn) then - call this%InitHistory ( bounds ) - end if - call this%InitCold ( bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - logical :: allows_non_annual_delta - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - ! Note that we set allows_non_annual_delta to false because we expect land cover - ! change to be applied entirely at the start of the year. Currently the fire code - ! appears to assume that the land cover change rate is constant throughout the year, - ! in this code (which is accompanied by the comment, 'land cover conversion in CLM4.5 - ! is the same for each timestep except for the beginning'): - ! - ! if( kmo == 1 .and. kda == 1 .and. mcsec == dt)then - ! lfc(c) = dtrotr_col(c)*dayspyr*secspday/dt - ! end if - ! - ! so setting allows_non_annual_delta to .false. helps ensure that remains true. - ! - ! However, we do keep allows_non_annual_delta = .true. if running with CNDV, because - ! (in contrast with other land cover change) CNDV currently still interpolates land - ! cover change throughout the year. Note that there is therefore an inconsistency with - ! the fire code if we're using CNDV, due to the way the annual flux dribbler works: - ! The dwt generated by CNDV on the first time step of the year is dribbled throughout - ! the year by dwt_dribbler_patch, but the CNDV dwt on every other time step comes at - ! its full value. So there will be a lower dwt in the first time step of the year - ! relative to every other time step of the year. If CNDV is the main contributor to - ! dwt, I think this can lead to a large violation of the above assumption of constant - ! dwt in the fire code. However, the fire code doesn't seem designed to work with - ! CNDV at all (because land cover change is assumed to be associated with - ! deforestation, not natural changes in areas), so maybe this inconsistency is the - ! least of the problem: see bug 2392. - if (get_for_testing_allow_non_annual_changes()) then - allows_non_annual_delta = .true. - else if (use_cndv) then - allows_non_annual_delta = .true. - else - allows_non_annual_delta = .false. - end if - this%dwt_dribbler_patch = annual_flux_dribbler_patch( & - bounds = bounds, & - name = 'dwt', & - units = 'fractional area', & - allows_non_annual_delta = allows_non_annual_delta) - - allocate(this%burndate_patch (begp:endp)) ; this%burndate_patch (:) = ispval - allocate(this%dwt_smoothed_patch (begp:endp)) ; this%dwt_smoothed_patch (:) = nan - - allocate(this%hdidx_patch (begp:endp)) ; this%hdidx_patch (:) = nan - allocate(this%cumvd_patch (begp:endp)) ; this%cumvd_patch (:) = nan - allocate(this%gddmaturity_patch (begp:endp)) ; this%gddmaturity_patch (:) = spval - allocate(this%huileaf_patch (begp:endp)) ; this%huileaf_patch (:) = nan - allocate(this%huigrain_patch (begp:endp)) ; this%huigrain_patch (:) = 0.0_r8 - allocate(this%aleafi_patch (begp:endp)) ; this%aleafi_patch (:) = nan - allocate(this%astemi_patch (begp:endp)) ; this%astemi_patch (:) = nan - allocate(this%aleaf_patch (begp:endp)) ; this%aleaf_patch (:) = nan - allocate(this%astem_patch (begp:endp)) ; this%astem_patch (:) = nan - allocate(this%htmx_patch (begp:endp)) ; this%htmx_patch (:) = 0.0_r8 - allocate(this%peaklai_patch (begp:endp)) ; this%peaklai_patch (:) = 0 - - allocate(this%idop_patch (begp:endp)) ; this%idop_patch (:) = huge(1) - - allocate(this%gdp_lf_col (begc:endc)) ; - allocate(this%peatf_lf_col (begc:endc)) ; - allocate(this%abm_lf_col (begc:endc)) ; - - allocate(this%lgdp_col (begc:endc)) ; - allocate(this%lgdp1_col (begc:endc)) ; - allocate(this%lpop_col (begc:endc)) ; - - allocate(this%tempavg_t2m_patch (begp:endp)) ; this%tempavg_t2m_patch (:) = nan - allocate(this%annsum_counter_col (begc:endc)) ; this%annsum_counter_col (:) = nan - allocate(this%annavg_t2m_col (begc:endc)) ; this%annavg_t2m_col (:) = nan - allocate(this%annavg_t2m_patch (begp:endp)) ; this%annavg_t2m_patch (:) = nan - - allocate(this%nfire_col (begc:endc)) ; this%nfire_col (:) = spval - allocate(this%fsr_col (begc:endc)) ; this%fsr_col (:) = nan - allocate(this%fd_col (begc:endc)) ; this%fd_col (:) = nan - allocate(this%lfc_col (begc:endc)) ; this%lfc_col (:) = spval - allocate(this%lfc2_col (begc:endc)) ; this%lfc2_col (:) = 0._r8 - allocate(this%dtrotr_col (begc:endc)) ; this%dtrotr_col (:) = 0._r8 - allocate(this%trotr1_col (begc:endc)) ; this%trotr1_col (:) = 0._r8 - allocate(this%trotr2_col (begc:endc)) ; this%trotr2_col (:) = 0._r8 - allocate(this%cropf_col (begc:endc)) ; this%cropf_col (:) = nan - allocate(this%baf_crop_col (begc:endc)) ; this%baf_crop_col (:) = nan - allocate(this%baf_peatf_col (begc:endc)) ; this%baf_peatf_col (:) = nan - allocate(this%fbac_col (begc:endc)) ; this%fbac_col (:) = nan - allocate(this%fbac1_col (begc:endc)) ; this%fbac1_col (:) = nan - allocate(this%wtlf_col (begc:endc)) ; this%wtlf_col (:) = nan - allocate(this%lfwt_col (begc:endc)) ; this%lfwt_col (:) = nan - allocate(this%farea_burned_col (begc:endc)) ; this%farea_burned_col (:) = nan - - allocate(this%dormant_flag_patch (begp:endp)) ; this%dormant_flag_patch (:) = nan - allocate(this%days_active_patch (begp:endp)) ; this%days_active_patch (:) = nan - allocate(this%onset_flag_patch (begp:endp)) ; this%onset_flag_patch (:) = nan - allocate(this%onset_counter_patch (begp:endp)) ; this%onset_counter_patch (:) = nan - allocate(this%onset_gddflag_patch (begp:endp)) ; this%onset_gddflag_patch (:) = nan - allocate(this%onset_fdd_patch (begp:endp)) ; this%onset_fdd_patch (:) = nan - allocate(this%onset_gdd_patch (begp:endp)) ; this%onset_gdd_patch (:) = nan - allocate(this%onset_swi_patch (begp:endp)) ; this%onset_swi_patch (:) = nan - allocate(this%offset_flag_patch (begp:endp)) ; this%offset_flag_patch (:) = nan - allocate(this%offset_counter_patch (begp:endp)) ; this%offset_counter_patch (:) = nan - allocate(this%offset_fdd_patch (begp:endp)) ; this%offset_fdd_patch (:) = nan - allocate(this%offset_swi_patch (begp:endp)) ; this%offset_swi_patch (:) = nan - allocate(this%grain_flag_patch (begp:endp)) ; this%grain_flag_patch (:) = nan - allocate(this%lgsf_patch (begp:endp)) ; this%lgsf_patch (:) = nan - allocate(this%bglfr_patch (begp:endp)) ; this%bglfr_patch (:) = nan - allocate(this%bgtr_patch (begp:endp)) ; this%bgtr_patch (:) = nan - allocate(this%c_allometry_patch (begp:endp)) ; this%c_allometry_patch (:) = nan - allocate(this%n_allometry_patch (begp:endp)) ; this%n_allometry_patch (:) = nan - allocate(this%tempsum_potential_gpp_patch (begp:endp)) ; this%tempsum_potential_gpp_patch (:) = nan - allocate(this%annsum_potential_gpp_patch (begp:endp)) ; this%annsum_potential_gpp_patch (:) = nan - allocate(this%tempmax_retransn_patch (begp:endp)) ; this%tempmax_retransn_patch (:) = nan - allocate(this%annmax_retransn_patch (begp:endp)) ; this%annmax_retransn_patch (:) = nan - allocate(this%downreg_patch (begp:endp)) ; this%downreg_patch (:) = nan - allocate(this%leafcn_offset_patch (begp:endp)) ; this%leafcn_offset_patch (:) = nan - allocate(this%plantCN_patch (begp:endp)) ; this%plantCN_patch (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use histFileMod , only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp, no_snow_normal - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - character(8) :: vr_suffix - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - if ( use_crop) then - this%gddmaturity_patch(begp:endp) = spval - call hist_addfld1d (fname='GDDHARV', units='ddays', & - avgflag='A', long_name='Growing degree days (gdd) needed to harvest', & - ptr_patch=this%gddmaturity_patch, default='inactive') - end if - - this%lfc2_col(begc:endc) = spval - call hist_addfld1d (fname='LFC2', units='per sec', & - avgflag='A', long_name='conversion area fraction of BET and BDT that burned', & - ptr_col=this%lfc2_col) - - this%annsum_counter_col(begc:endc) = spval - call hist_addfld1d (fname='ANNSUM_COUNTER', units='s', & - avgflag='A', long_name='seconds since last annual accumulator turnover', & - ptr_col=this%annsum_counter_col, default='inactive') - - this%annavg_t2m_col(begc:endc) = spval - call hist_addfld1d (fname='CANNAVG_T2M', units='K', & - avgflag='A', long_name='annual average of 2m air temperature', & - ptr_col=this%annavg_t2m_col, default='inactive') - - this%nfire_col(begc:endc) = spval - call hist_addfld1d (fname='NFIRE', units='counts/km2/sec', & - avgflag='A', long_name='fire counts valid only in Reg.C', & - ptr_col=this%nfire_col) - - this%farea_burned_col(begc:endc) = spval - call hist_addfld1d (fname='FAREA_BURNED', units='proportion/sec', & - avgflag='A', long_name='timestep fractional area burned', & - ptr_col=this%farea_burned_col) - - this%baf_crop_col(begc:endc) = spval - call hist_addfld1d (fname='BAF_CROP', units='proportion/sec', & - avgflag='A', long_name='fractional area burned for crop', & - ptr_col=this%baf_crop_col) - - this%baf_peatf_col(begc:endc) = spval - call hist_addfld1d (fname='BAF_PEATF', units='proportion/sec', & - avgflag='A', long_name='fractional area burned in peatland', & - ptr_col=this%baf_peatf_col) - - this%annavg_t2m_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNAVG_T2M', units='K', & - avgflag='A', long_name='annual average 2m air temperature', & - ptr_patch=this%annavg_t2m_patch, default='inactive') - - this%tempavg_t2m_patch(begp:endp) = spval - call hist_addfld1d (fname='TEMPAVG_T2M', units='K', & - avgflag='A', long_name='temporary average 2m air temperature', & - ptr_patch=this%tempavg_t2m_patch, default='inactive') - - this%dormant_flag_patch(begp:endp) = spval - call hist_addfld1d (fname='DORMANT_FLAG', units='none', & - avgflag='A', long_name='dormancy flag', & - ptr_patch=this%dormant_flag_patch, default='inactive') - - this%days_active_patch(begp:endp) = spval - call hist_addfld1d (fname='DAYS_ACTIVE', units='days', & - avgflag='A', long_name='number of days since last dormancy', & - ptr_patch=this%days_active_patch, default='inactive') - - this%onset_flag_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_FLAG', units='none', & - avgflag='A', long_name='onset flag', & - ptr_patch=this%onset_flag_patch, default='inactive') - - this%onset_counter_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_COUNTER', units='days', & - avgflag='A', long_name='onset days counter', & - ptr_patch=this%onset_counter_patch, default='inactive') - - this%onset_gddflag_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_GDDFLAG', units='none', & - avgflag='A', long_name='onset flag for growing degree day sum', & - ptr_patch=this%onset_gddflag_patch, default='inactive') - - this%onset_fdd_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_FDD', units='C degree-days', & - avgflag='A', long_name='onset freezing degree days counter', & - ptr_patch=this%onset_fdd_patch, default='inactive') - - this%onset_gdd_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_GDD', units='C degree-days', & - avgflag='A', long_name='onset growing degree days', & - ptr_patch=this%onset_gdd_patch, default='inactive') - - this%onset_swi_patch(begp:endp) = spval - call hist_addfld1d (fname='ONSET_SWI', units='none', & - avgflag='A', long_name='onset soil water index', & - ptr_patch=this%onset_swi_patch, default='inactive') - - this%offset_flag_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_FLAG', units='none', & - avgflag='A', long_name='offset flag', & - ptr_patch=this%offset_flag_patch, default='inactive') - - this%offset_counter_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_COUNTER', units='days', & - avgflag='A', long_name='offset days counter', & - ptr_patch=this%offset_counter_patch, default='inactive') - - this%offset_fdd_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_FDD', units='C degree-days', & - avgflag='A', long_name='offset freezing degree days counter', & - ptr_patch=this%offset_fdd_patch, default='inactive') - - this%offset_swi_patch(begp:endp) = spval - call hist_addfld1d (fname='OFFSET_SWI', units='none', & - avgflag='A', long_name='offset soil water index', & - ptr_patch=this%offset_swi_patch, default='inactive') - - this%lgsf_patch(begp:endp) = spval - call hist_addfld1d (fname='LGSF', units='proportion', & - avgflag='A', long_name='long growing season factor', & - ptr_patch=this%lgsf_patch, default='inactive') - - this%bglfr_patch(begp:endp) = spval - call hist_addfld1d (fname='BGLFR', units='1/s', & - avgflag='A', long_name='background litterfall rate', & - ptr_patch=this%bglfr_patch, default='inactive') - - this%bgtr_patch(begp:endp) = spval - call hist_addfld1d (fname='BGTR', units='1/s', & - avgflag='A', long_name='background transfer growth rate', & - ptr_patch=this%bgtr_patch, default='inactive') - - this%c_allometry_patch(begp:endp) = spval - call hist_addfld1d (fname='C_ALLOMETRY', units='none', & - avgflag='A', long_name='C allocation index', & - ptr_patch=this%c_allometry_patch, default='inactive') - - this%n_allometry_patch(begp:endp) = spval - call hist_addfld1d (fname='N_ALLOMETRY', units='none', & - avgflag='A', long_name='N allocation index', & - ptr_patch=this%n_allometry_patch, default='inactive') - - this%tempsum_potential_gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='TEMPSUM_POTENTIAL_GPP', units='gC/m^2/yr', & - avgflag='A', long_name='temporary annual sum of potential GPP', & - ptr_patch=this%tempsum_potential_gpp_patch, default='inactive') - - this%annsum_potential_gpp_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNSUM_POTENTIAL_GPP', units='gN/m^2/yr', & - avgflag='A', long_name='annual sum of potential GPP', & - ptr_patch=this%annsum_potential_gpp_patch, default='inactive') - - this%tempmax_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='TEMPMAX_RETRANSN', units='gN/m^2', & - avgflag='A', long_name='temporary annual max of retranslocated N pool', & - ptr_patch=this%tempmax_retransn_patch, default='inactive') - - this%annmax_retransn_patch(begp:endp) = spval - call hist_addfld1d (fname='ANNMAX_RETRANSN', units='gN/m^2', & - avgflag='A', long_name='annual max of retranslocated N pool', & - ptr_patch=this%annmax_retransn_patch, default='inactive') - - this%downreg_patch(begp:endp) = spval - call hist_addfld1d (fname='DOWNREG', units='proportion', & - avgflag='A', long_name='fractional reduction in GPP due to N limitation', & - ptr_patch=this%downreg_patch, default='inactive') - - this%leafcn_offset_patch(begp:endp) = spval - call hist_addfld1d (fname='LEAFCN_OFFSET', units='unitless', & - avgflag='A', long_name='Leaf C:N used by FUN', & - ptr_patch=this%leafcn_offset_patch, default='inactive') - - this%plantCN_patch(begp:endp) = spval - call hist_addfld1d (fname='PLANTCN', units='unitless', & - avgflag='A', long_name='Plant C:N used by FUN', & - ptr_patch=this%plantCN_patch, default='inactive') - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine initCold(this, bounds) - ! - ! !USES: - use spmdMod , only : masterproc - use fileutils , only : getfil - use clm_varctl , only : nsrest, nsrStartup - use ncdio_pio - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,n,j,m ! indices - real(r8) ,pointer :: gdp (:) ! global gdp data (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: peatf (:) ! global peatf data (needs to be a pointer for use in ncdio) - integer ,pointer :: abm (:) ! global abm data (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: gti (:) ! read in - fmax (needs to be a pointer for use in ncdio) - integer :: dimid ! dimension id - integer :: ier ! error status - type(file_desc_t) :: ncid ! netcdf id - logical :: readvar - character(len=256) :: locfn ! local filename - integer :: begc, endc - integer :: begg, endg - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - ! -------------------------------------------------------------------- - ! Open surface dataset - ! -------------------------------------------------------------------- - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! -------------------------------------------------------------------- - ! Read in GDP data - ! -------------------------------------------------------------------- - - allocate(gdp(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='gdp', flag='read', data=gdp, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: gdp NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%gdp_lf_col(c) = gdp(g) - end do - deallocate(gdp) - - ! -------------------------------------------------------------------- - ! Read in peatf data - ! -------------------------------------------------------------------- - - allocate(peatf(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='peatf', flag='read', data=peatf, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: peatf NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%peatf_lf_col(c) = peatf(g) - end do - deallocate(peatf) - - ! -------------------------------------------------------------------- - ! Read in ABM data - ! -------------------------------------------------------------------- - - allocate(abm(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='abm', flag='read', data=abm, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: abm NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%abm_lf_col(c) = abm(g) - end do - deallocate(abm) - - ! Close file - - call ncd_pio_closefile(ncid) - - if (masterproc) then - write(iulog,*) 'Successfully read fmax, soil color, sand and clay boundary data' - write(iulog,*) - endif - - ! -------------------------------------------------------------------- - ! Initialize terms needed for dust model - ! TODO - move these terms to DUSTMod module variables - ! -------------------------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - this%annsum_counter_col (c) = spval - this%annavg_t2m_col (c) = spval - this%nfire_col (c) = spval - this%baf_crop_col (c) = spval - this%baf_peatf_col (c) = spval - this%fbac_col (c) = spval - this%fbac1_col (c) = spval - this%farea_burned_col (c) = spval - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%annsum_counter_col(c) = 0._r8 - this%annavg_t2m_col(c) = 280._r8 - - ! fire related variables - this%baf_crop_col(c) = 0._r8 - this%baf_peatf_col(c) = 0._r8 - this%fbac_col(c) = 0._r8 - this%fbac1_col(c) = 0._r8 - this%farea_burned_col(c) = 0._r8 - this%nfire_col(c) = 0._r8 - end if - end do - - ! ecophysiological and phenology variables - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - if (lun%ifspecial(l)) then - this%annavg_t2m_patch (p) = spval - this%tempavg_t2m_patch (p) = spval - this%dormant_flag_patch(p) = spval - this%days_active_patch(p) = spval - this%onset_flag_patch(p) = spval - this%onset_counter_patch(p) = spval - this%onset_gddflag_patch(p) = spval - this%onset_fdd_patch(p) = spval - this%onset_gdd_patch(p) = spval - this%onset_swi_patch(p) = spval - this%offset_flag_patch(p) = spval - this%offset_counter_patch(p) = spval - this%offset_fdd_patch(p) = spval - this%offset_swi_patch(p) = spval - this%grain_flag_patch(p) = spval - this%lgsf_patch(p) = spval - this%bglfr_patch(p) = spval - this%bgtr_patch(p) = spval - this%c_allometry_patch(p) = spval - this%n_allometry_patch(p) = spval - this%tempsum_potential_gpp_patch(p) = spval - this%annsum_potential_gpp_patch(p) = spval - this%tempmax_retransn_patch(p) = spval - this%annmax_retransn_patch(p) = spval - this%downreg_patch(p) = spval - this%leafcn_offset_patch(p) = spval - this%plantCN_patch(p) = spval - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - ! phenology variables - this%dormant_flag_patch(p) = 1._r8 - this%days_active_patch(p) = 0._r8 - this%onset_flag_patch(p) = 0._r8 - this%onset_counter_patch(p) = 0._r8 - this%onset_gddflag_patch(p) = 0._r8 - this%onset_fdd_patch(p) = 0._r8 - this%onset_gdd_patch(p) = 0._r8 - this%onset_swi_patch(p) = 0._r8 - this%offset_flag_patch(p) = 0._r8 - this%offset_counter_patch(p) = 0._r8 - this%offset_fdd_patch(p) = 0._r8 - this%offset_swi_patch(p) = 0._r8 - this%lgsf_patch(p) = 0._r8 - this%bglfr_patch(p) = 0._r8 - this%bgtr_patch(p) = 0._r8 - this%annavg_t2m_patch(p) = 280._r8 - this%tempavg_t2m_patch(p) = 0._r8 - this%grain_flag_patch(p) = 0._r8 - - ! non-phenology variables - this%c_allometry_patch(p) = 0._r8 - this%n_allometry_patch(p) = 0._r8 - this%tempsum_potential_gpp_patch(p) = 0._r8 - this%annsum_potential_gpp_patch(p) = 0._r8 - this%tempmax_retransn_patch(p) = 0._r8 - this%annmax_retransn_patch(p) = 0._r8 - this%downreg_patch(p) = 0._r8 - this%leafcn_offset_patch(p) = spval - this%plantCN_patch(p) = spval - end if - - end do - - ! fire variables - - do c = bounds%begc,bounds%endc - this%lfc2_col(c) = 0._r8 - end do - - end subroutine initCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, cnveg_carbonstate, & - cnveg_nitrogenstate, filter_reseed_patch, num_reseed_patch) - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use CNVegNitrogenStateType, only: cnveg_nitrogenstate_type - use CNVegCarbonStateType , only: cnveg_carbonstate_type - use restUtilMod - use ncdio_pio - use pftconMod , only : pftcon - ! - ! !ARGUMENTS: - class(cnveg_state_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - type(cnveg_nitrogenstate_type), intent(in) :: cnveg_nitrogenstate - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate - integer , intent(out), optional :: filter_reseed_patch(:) - integer , intent(out), optional :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - integer :: j,c,i,p ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !----------------------------------------------------------------------- - - call this%dwt_dribbler_patch%Restart(bounds, ncid, flag) - - call restartvar(ncid=ncid, flag=flag, varname='dormant_flag', xtype=ncd_double, & - dim1name='pft', & - long_name='dormancy flag', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%dormant_flag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='days_active', xtype=ncd_double, & - dim1name='pft', & - long_name='number of days since last dormancy', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%days_active_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_flag', xtype=ncd_double, & - dim1name='pft', & - long_name='flag if critical growing degree-day sum is exceeded', units='unitless' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_flag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_counter', xtype=ncd_double, & - dim1name='pft', & - long_name='onset days counter', units='sec' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_counter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_gddflag', xtype=ncd_double, & - dim1name='pft', & - long_name='onset flag for growing degree day sum', units='' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_gddflag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_fdd', xtype=ncd_double, & - dim1name='pft', & - long_name='onset freezing degree days counter', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_fdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_gdd', xtype=ncd_double, & - dim1name='pft', & - long_name='onset growing degree days', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_gdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='onset_swi', xtype=ncd_double, & - dim1name='pft', & - long_name='onset soil water index', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%onset_swi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_flag', xtype=ncd_double, & - dim1name='pft', & - long_name='offset flag', units='unitless' , & - interpinic_flag='interp', readvar=readvar, data=this%offset_flag_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_counter', xtype=ncd_double, & - dim1name='pft', & - long_name='offset days counter', units='sec' , & - interpinic_flag='interp', readvar=readvar, data=this%offset_counter_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_fdd', xtype=ncd_double, & - dim1name='pft', & - long_name='offset freezing degree days counter', units='days' , & - interpinic_flag='interp', readvar=readvar, data=this%offset_fdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='offset_swi', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%offset_swi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='lgsf', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%lgsf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='bglfr', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%bglfr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='bgtr', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%bgtr_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annavg_t2m', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annavg_t2m_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempavg_t2m', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempavg_t2m_patch) - - call restartvar(ncid=ncid, flag=flag, varname='c_allometry', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%c_allometry_patch) - - call restartvar(ncid=ncid, flag=flag, varname='n_allometry', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%n_allometry_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempsum_potential_gpp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempsum_potential_gpp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_potential_gpp', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_potential_gpp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tempmax_retransn', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tempmax_retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annmax_retransn', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annmax_retransn_patch) - - call restartvar(ncid=ncid, flag=flag, varname='downreg', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%downreg_patch) - - call restartvar(ncid=ncid, flag=flag, varname='leafcn_offset', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%leafcn_offset_patch) - - call restartvar(ncid=ncid, flag=flag, varname='plantCN', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%plantCN_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_counter', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annsum_counter_col) - - call restartvar(ncid=ncid, flag=flag, varname='burndate', xtype=ncd_int, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%burndate_patch) - - call restartvar(ncid=ncid, flag=flag, varname='lfc', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%lfc_col) - - call restartvar(ncid=ncid, flag=flag, varname='cannavg_t2m', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%annavg_t2m_col) - - if (use_crop) then - - call restartvar(ncid=ncid, flag=flag, varname='htmx', xtype=ncd_double, & - dim1name='pft', long_name='max height attained by a crop during year', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%htmx_patch) - - call restartvar(ncid=ncid, flag=flag, varname='peaklai', xtype=ncd_int, & - dim1name='pft', long_name='Flag if at max allowed LAI or not', & - flag_values=(/0,1/), nvalid_range=(/0,1/), & - flag_meanings=(/'NOT-at-peak', 'AT_peak-LAI' /) , & - interpinic_flag='interp', readvar=readvar, data=this%peaklai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='idop', xtype=ncd_int, & - dim1name='pft', long_name='Date of planting', units='jday', nvalid_range=(/1,366/), & - interpinic_flag='interp', readvar=readvar, data=this%idop_patch) - - call restartvar(ncid=ncid, flag=flag, varname='aleaf', xtype=ncd_double, & - dim1name='pft', long_name='leaf allocation coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%aleaf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='aleafi', xtype=ncd_double, & - dim1name='pft', long_name='Saved leaf allocation coefficient from phase 2', units='', & - interpinic_flag='interp', readvar=readvar, data=this%aleafi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='astem', xtype=ncd_double, & - dim1name='pft', long_name='stem allocation coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%astem_patch) - - call restartvar(ncid=ncid, flag=flag, varname='astemi', xtype=ncd_double, & - dim1name='pft', long_name='Saved stem allocation coefficient from phase 2', units='', & - interpinic_flag='interp', readvar=readvar, data=this%astemi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='hdidx', xtype=ncd_double, & - dim1name='pft', long_name='cold hardening index', units='', & - interpinic_flag='interp', readvar=readvar, data=this%hdidx_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cumvd', xtype=ncd_double, & - dim1name='pft', long_name='cumulative vernalization d', units='', & - interpinic_flag='interp', readvar=readvar, data=this%cumvd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gddmaturity', xtype=ncd_double, & - dim1name='pft', long_name='Growing degree days needed to harvest', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gddmaturity_patch) - - call restartvar(ncid=ncid, flag=flag, varname='huileaf', xtype=ncd_double, & - dim1name='pft', long_name='heat unit index needed from planting to leaf emergence', units='', & - interpinic_flag='interp', readvar=readvar, data=this%huileaf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='huigrain', xtype=ncd_double, & - dim1name='pft', long_name='heat unit index needed to reach vegetative maturity', units='', & - interpinic_flag='interp', readvar=readvar, data=this%huigrain_patch) - - call restartvar(ncid=ncid, flag=flag, varname='grain_flag', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%grain_flag_patch) - end if - if ( flag == 'read' .and. num_reseed_patch > 0 )then - if ( masterproc ) write(iulog, *) 'Reseed dead plants for CNVegState' - do i = 1, num_reseed_patch - p = filter_reseed_patch(i) - ! phenology variables - this%dormant_flag_patch(p) = 1._r8 - this%days_active_patch(p) = 0._r8 - this%onset_flag_patch(p) = 0._r8 - this%onset_counter_patch(p) = 0._r8 - this%onset_gddflag_patch(p) = 0._r8 - this%onset_fdd_patch(p) = 0._r8 - this%onset_gdd_patch(p) = 0._r8 - this%onset_swi_patch(p) = 0._r8 - this%offset_flag_patch(p) = 0._r8 - this%offset_counter_patch(p) = 0._r8 - this%offset_fdd_patch(p) = 0._r8 - this%offset_swi_patch(p) = 0._r8 - this%lgsf_patch(p) = 0._r8 - this%bglfr_patch(p) = 0._r8 - this%bgtr_patch(p) = 0._r8 - this%annavg_t2m_patch(p) = 280._r8 - this%tempavg_t2m_patch(p) = 0._r8 - this%grain_flag_patch(p) = 0._r8 - - this%c_allometry_patch(p) = 0._r8 - this%n_allometry_patch(p) = 0._r8 - this%tempsum_potential_gpp_patch(p) = 0._r8 - this%annsum_potential_gpp_patch(p) = 0._r8 - this%tempmax_retransn_patch(p) = 0._r8 - this%annmax_retransn_patch(p) = 0._r8 - this%downreg_patch(p) = 0._r8 - this%leafcn_offset_patch(p) = spval - this%plantCN_patch(p) = spval - end do - end if - - end subroutine Restart - -end module CNVegStateType diff --git a/src/biogeochem/CNVegStructUpdateMod.F90 b/src/biogeochem/CNVegStructUpdateMod.F90 deleted file mode 100644 index 27b677b04d..0000000000 --- a/src/biogeochem/CNVegStructUpdateMod.F90 +++ /dev/null @@ -1,307 +0,0 @@ -module CNVegStructUpdateMod - - !----------------------------------------------------------------------- - ! Module for vegetation structure updates (LAI, SAI, htop, hbot) - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use clm_varctl , only : iulog, use_cndv - use CNDVType , only : dgv_ecophyscon - use WaterStateType , only : waterstate_type - use FrictionVelocityMod , only : frictionvel_type - use CNDVType , only : dgvs_type - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CanopyStateType , only : canopystate_type - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CNVegStructUpdate - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CNVegStructUpdate(num_soilp, filter_soilp, & - waterstate_inst, frictionvel_inst, dgvs_inst, cnveg_state_inst, crop_inst, & - cnveg_carbonstate_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, use C state variables and epc to diagnose - ! vegetation structure (LAI, SAI, height) - ! - ! !USES: - use pftconMod , only : noveg, nc3crop, nc3irrig, nbrdlf_evr_shrub, nbrdlf_dcd_brl_shrub - use pftconMod , only : npcropmin - use pftconMod , only : ntmp_corn, nirrig_tmp_corn - use pftconMod , only : ntrp_corn, nirrig_trp_corn - use pftconMod , only : nsugarcane, nirrig_sugarcane - use pftconMod , only : pftcon - use clm_varctl , only : spinup_state - use clm_time_manager , only : get_rad_step_size - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilp ! number of column soil points in patch filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(waterstate_type) , intent(in) :: waterstate_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(dgvs_type) , intent(in) :: dgvs_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !REVISION HISTORY: - ! 10/28/03: Created by Peter Thornton - ! 2/29/08, David Lawrence: revised snow burial fraction for short vegetation - ! - ! !LOCAL VARIABLES: - integer :: p,c,g ! indices - integer :: fp ! lake filter indices - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - real(r8) :: stocking ! #stems / ha (stocking density) - real(r8) :: ol ! thickness of canopy layer covered by snow (m) - real(r8) :: fb ! fraction of canopy layer covered by snow - real(r8) :: tlai_old ! for use in Zeng tsai formula - real(r8) :: tsai_old ! for use in Zeng tsai formula - real(r8) :: tsai_min ! PATCH derived minimum tsai - real(r8) :: tsai_alpha ! monthly decay rate of tsai - real(r8) :: dt ! radiation time step (sec) - - real(r8), parameter :: dtsmonth = 2592000._r8 ! number of seconds in a 30 day month (60x60x24x30) - !----------------------------------------------------------------------- - ! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 - ! - ! tsai(p) = max( tsai_alpha(ivt(p))*tsai_old + max(tlai_old-tlai(p),0_r8), tsai_min(ivt(p)) ) - ! notes: - ! * RHS tsai & tlai are from previous timestep - ! * should create tsai_alpha(ivt(p)) & tsai_min(ivt(p)) in pftconMod.F90 - slevis - ! * all non-crop patches use same values: - ! crop tsai_alpha,tsai_min = 0.0,0.1 - ! noncrop tsai_alpha,tsai_min = 0.5,1.0 (includes bare soil and urban) - !------------------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis [m^2/gC] - dsladlai => pftcon%dsladlai , & ! Input: dSLA/dLAI, projected area basis [m^2/gC] - z0mr => pftcon%z0mr , & ! Input: ratio of momentum roughness length to canopy top height (-) - displar => pftcon%displar , & ! Input: ratio of displacement height to canopy top height (-) - dwood => pftcon%dwood , & ! Input: density of wood (gC/m^3) - ztopmx => pftcon%ztopmx , & ! Input: - laimx => pftcon%laimx , & ! Input: - - allom2 => dgv_ecophyscon%allom2 , & ! Input: [real(r8) (:) ] ecophys const - allom3 => dgv_ecophyscon%allom3 , & ! Input: [real(r8) (:) ] ecophys const - - nind => dgvs_inst%nind_patch , & ! Input: [real(r8) (:) ] number of individuals (#/m**2) - fpcgrid => dgvs_inst%fpcgrid_patch , & ! Input: [real(r8) (:) ] fractional area of patch (pft area/nat veg area) - - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at patch-level [m] - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] (gC/m2) leaf C - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:) ] (gC/m2) dead stem C - - farea_burned => cnveg_state_inst%farea_burned_col , & ! Input: [real(r8) (:) ] F. Li and S. Levis - htmx => cnveg_state_inst%htmx_patch , & ! Output: [real(r8) (:) ] max hgt attained by a crop during yr (m) - peaklai => cnveg_state_inst%peaklai_patch , & ! Output: [integer (:) ] 1: max allowed lai; 0: not at max - - harvdate => crop_inst%harvdate_patch , & ! Input: [integer (:) ] harvest date - - ! *** Key Output from CN*** - tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) - elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] frac of vegetation not covered by snow [-] - ) - - dt = real( get_rad_step_size(), r8 ) - - ! constant allometric parameters - taper = 200._r8 - stocking = 1000._r8 - - ! convert from stems/ha -> stems/m^2 - stocking = stocking / 10000._r8 - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - g = patch%gridcell(p) - - if (ivt(p) /= noveg) then - - tlai_old = tlai(p) ! n-1 value - tsai_old = tsai(p) ! n-1 value - - ! update the leaf area index based on leafC and SLA - ! Eq 3 from Thornton and Zimmerman, 2007, J Clim, 20, 3902-3923. - if (dsladlai(ivt(p)) > 0._r8) then - tlai(p) = (slatop(ivt(p))*(exp(leafc(p)*dsladlai(ivt(p))) - 1._r8))/dsladlai(ivt(p)) - else - tlai(p) = slatop(ivt(p)) * leafc(p) - end if - tlai(p) = max(0._r8, tlai(p)) - - ! update the stem area index and height based on LAI, stem mass, and veg type. - ! With the exception of htop for woody vegetation, this follows the DGVM logic. - - ! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 (see notes) - ! Assumes doalb time step .eq. CLM time step, SAI min and monthly decay factor - ! alpha are set by PFT, and alpha is scaled to CLM time step by multiplying by - ! dt and dividing by dtsmonth (seconds in average 30 day month) - ! tsai_min scaled by 0.5 to match MODIS satellite derived values - if (ivt(p) == nc3crop .or. ivt(p) == nc3irrig) then ! generic crops - - tsai_alpha = 1.0_r8-1.0_r8*dt/dtsmonth - tsai_min = 0.1_r8 - else - tsai_alpha = 1.0_r8-0.5_r8*dt/dtsmonth - tsai_min = 1.0_r8 - end if - tsai_min = tsai_min * 0.5_r8 - tsai(p) = max(tsai_alpha*tsai_old+max(tlai_old-tlai(p),0._r8),tsai_min) - - if (woody(ivt(p)) == 1._r8) then - - ! trees and shrubs - - ! if shrubs have a squat taper - if (ivt(p) >= nbrdlf_evr_shrub .and. ivt(p) <= nbrdlf_dcd_brl_shrub) then - taper = 10._r8 - ! otherwise have a tall taper - else - taper = 200._r8 - end if - - ! trees and shrubs for now have a very simple allometry, with hard-wired - ! stem taper (height:radius) and hard-wired stocking density (#individuals/area) - if (use_cndv) then - - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 patch area - htop(p) = allom2(ivt(p)) * ( (24._r8 * deadstemc(p) / & - (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) )**allom3(ivt(p)) ! lpj's htop w/ cn's stemdiam - - else - htop(p) = 0._r8 - end if - - else - !correct height calculation if doing accelerated spinup - if (spinup_state == 2) then - htop(p) = ((3._r8 * deadstemc(p) * 10._r8 * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) - else - htop(p) = ((3._r8 * deadstemc(p) * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) - end if - - endif - - ! Peter Thornton, 5/3/2004 - ! Adding test to keep htop from getting too close to forcing height for windspeed - ! Also added for grass, below, although it is not likely to ever be an issue. - htop(p) = min(htop(p),(forc_hgt_u_patch(p)/(displar(ivt(p))+z0mr(ivt(p))))-3._r8) - - ! Peter Thornton, 8/11/2004 - ! Adding constraint to keep htop from going to 0.0. - ! This becomes an issue when fire mortality is pushing deadstemc - ! to 0.0. - htop(p) = max(htop(p), 0.01_r8) - - hbot(p) = max(0._r8, min(3._r8, htop(p)-1._r8)) - - else if (ivt(p) >= npcropmin) then ! prognostic crops - - if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation - - if (ivt(p) == ntmp_corn .or. ivt(p) == nirrig_tmp_corn .or. & - ivt(p) == ntrp_corn .or. ivt(p) == nirrig_trp_corn .or. & - ivt(p) == nsugarcane .or. ivt(p) == nirrig_sugarcane) then - tsai(p) = 0.1_r8 * tlai(p) - else - tsai(p) = 0.2_r8 * tlai(p) - end if - - ! "stubble" after harvest - if (harvdate(p) < 999 .and. tlai(p) == 0._r8) then - tsai(p) = 0.25_r8*(1._r8-farea_burned(c)*0.90_r8) !changed by F. Li and S. Levis - htmx(p) = 0._r8 - peaklai(p) = 0 - end if - !if (harvdate(p) < 999 .and. tlai(p) > 0._r8) write(iulog,*) 'CNVegStructUpdate: tlai>0 after harvest!' ! remove after initial debugging? - - ! canopy top and bottom heights - htop(p) = ztopmx(ivt(p)) * (min(tlai(p)/(laimx(ivt(p))-1._r8),1._r8))**2 - htmx(p) = max(htmx(p), htop(p)) - htop(p) = max(0.05_r8, max(htmx(p),htop(p))) - hbot(p) = 0.02_r8 - - else ! generic crops and ... - - ! grasses - - ! height for grasses depends only on LAI - htop(p) = max(0.25_r8, tlai(p) * 0.25_r8) - - htop(p) = min(htop(p),(forc_hgt_u_patch(p)/(displar(ivt(p))+z0mr(ivt(p))))-3._r8) - - ! Peter Thornton, 8/11/2004 - ! Adding constraint to keep htop from going to 0.0. - htop(p) = max(htop(p), 0.01_r8) - - hbot(p) = max(0.0_r8, min(0.05_r8, htop(p)-0.20_r8)) - end if - - else - - tlai(p) = 0._r8 - tsai(p) = 0._r8 - htop(p) = 0._r8 - hbot(p) = 0._r8 - - end if - - ! adjust lai and sai for burying by snow. - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. - if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then - ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) - fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) - else - fb = 1._r8 - max(min(snow_depth(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses - endif - - elai(p) = max(tlai(p)*fb, 0.0_r8) - esai(p) = max(tsai(p)*fb, 0.0_r8) - - ! Fraction of vegetation free of snow - if ((elai(p) + esai(p)) > 0._r8) then - frac_veg_nosno_alb(p) = 1 - else - frac_veg_nosno_alb(p) = 0 - end if - - end do - - end associate - - end subroutine CNVegStructUpdate - -end module CNVegStructUpdateMod diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 deleted file mode 100644 index 9f555f6b14..0000000000 --- a/src/biogeochem/CNVegetationFacade.F90 +++ /dev/null @@ -1,1437 +0,0 @@ -module CNVegetationFacade - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Facade for the CN Vegetation subsystem. - ! - ! (A "facade", in software engineering terms, is a unified interface to a set of - ! interfaces in a subsystem. The facade defines a higher-level interface that makes the - ! subsystem easier to use.) - ! - ! NOTE(wjs, 2016-02-19) I envision that we will introduce an abstract base class - ! (VegBase). Then both CNVeg and EDVeg will extend VegBase. The rest of the CLM code can - ! then have an instance of VegBase, which depending on the run, can be either a CNVeg or - ! EDVeg instance. - ! - ! In addition, we probably want an implementation when running without CN or fates - i.e., - ! an SPVeg inst. This would provide implementations for get_leafn_patch, - ! get_downreg_patch, etc., so that we don't need to handle the non-cn case here (note - ! that, currently, we return NaN for most of these getters, because these arrays are - ! invalid and shouldn't be used when running in SP mode). Also, in its EcosystemDynamics - ! routine, it would call SatellitePhenology (but note that the desired interface for - ! EcosystemDynamics would be quite different... could just pass everything needed by any - ! model, and ignore unneeded arguments). Then we can get rid of comments in this module - ! like, "only call if use_cn is true", as well as use_cn conditionals in this module. - ! - ! NOTE(wjs, 2016-02-23) Currently, SatellitePhenology is called even when running with - ! CN, for the sake of dry deposition. This seems weird to me, and my gut feeling - - ! without understanding it well - is that this should be rewritten to depend on LAI from - ! CN rather than from satellite phenology. Until that is done, the separation between SP - ! and other Veg modes will be messier. - ! - ! NOTE(wjs, 2016-02-23) Currently, this class coordinates calls to soil BGC routines as - ! well as veg BGC routines (even though it doesn't contain any soil BGC types). This is - ! because CNDriver coordinates both the veg & soil BGC. We should probably split up - ! CNDriver so that there is a cleaner separation between veg BGC and soil BGC, to allow - ! easier swapping of (for example) CN and ED. At that point, this class could - ! coordinate just the calls to veg BGC routines, with a similar facade class - ! coordinating the calls to soil BGC routines. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use perf_mod , only : t_startf, t_stopf - use decompMod , only : bounds_type - use clm_varctl , only : iulog, use_cn, use_cndv, use_c13, use_c14 - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_time_manager , only : get_curr_date, get_ref_date - use clm_time_manager , only : get_nstep, is_end_curr_year, is_first_step - use CNBalanceCheckMod , only : cn_balance_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNFireMethodMod , only : cnfire_method_type - use CNProductsMod , only : cn_products_type - use NutrientCompetitionMethodMod , only : nutrient_competition_method_type - use SpeciesIsotopeType , only : species_isotope_type - use SpeciesNonIsotopeType , only : species_non_isotope_type - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use atm2lndType , only : atm2lnd_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use CropType , only : crop_type - use ch4Mod , only : ch4_type - use CNDVType , only : dgvs_type - use CNDVDriverMod , only : CNDVDriver, CNDVHIST - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use FrictionVelocityMod , only : frictionvel_type - use SoilBiogeochemStateType , only : soilBiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilBiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use CNFireEmissionsMod , only : fireemis_type, CNFireEmisUpdate - use CNDriverMod , only : CNDriverInit - use CNDriverMod , only : CNDriverSummarizeStates, CNDriverSummarizeFluxes - use CNDriverMod , only : CNDriverNoLeaching, CNDriverLeaching - use CNCStateUpdate1Mod , only : CStateUpdateDynPatch - use CNNStateUpdate1Mod , only : NStateUpdateDynPatch - use CNVegStructUpdateMod , only : CNVegStructUpdate - use CNAnnualUpdateMod , only : CNAnnualUpdate - use dynConsBiogeochemMod , only : dyn_cnbal_patch, dyn_cnbal_col - use dynCNDVMod , only : dynCNDV_init, dynCNDV_interp - use CNPrecisionControlMod , only: CNPrecisionControl - use SoilBiogeochemPrecisionControlMod , only: SoilBiogeochemPrecisionControl - ! - implicit none - private - - ! !PUBLIC TYPES: - - type, public :: cn_vegetation_type - ! FIXME(bja, 2016-06) These need to be public for use when fates is - ! turned on. Should either be moved out of here or create some ED - ! version of the facade.... - type(cnveg_state_type) :: cnveg_state_inst - type(cnveg_carbonstate_type) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) :: cnveg_carbonflux_inst - - !X!private - - type(cnveg_carbonstate_type) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) :: c14_cnveg_carbonstate_inst - type(cnveg_carbonflux_type) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) :: cnveg_nitrogenflux_inst - - type(cn_products_type) :: c_products_inst - type(cn_products_type) :: c13_products_inst - type(cn_products_type) :: c14_products_inst - type(cn_products_type) :: n_products_inst - - type(cn_balance_type) :: cn_balance_inst - class(cnfire_method_type), allocatable :: cnfire_method - type(dgvs_type) :: dgvs_inst - - ! Control variables - logical, private :: reseed_dead_plants ! Flag to indicate if should reseed dead plants when starting up the model - - ! TODO(wjs, 2016-02-19) Evaluate whether some other variables should be moved in - ! here. Whether they should be moved in depends on how tightly they are tied in with - ! the other CN Vegetation stuff. A question to ask is: Is this module used when - ! running with SP or ED? If so, then it should probably remain outside of CNVeg. - ! - ! From the clm_instMod section on "CN vegetation types": - ! - nutrient_competition_method - ! - I'm pretty sure this should be moved into here; it's just a little messy to do - ! so, because of how it's initialized (specifically, the call to readParameters - ! in clm_initializeMod). - ! - ! From the clm_instMod section on "general biogeochem types": - ! - ch4_inst - ! - probably not: really seems to belong in soilbiogeochem - ! - crop_inst - ! - dust_inst - ! - vocemis_inst - ! - fireemis_inst - ! - drydepvel_inst - - contains - procedure, public :: Init - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - procedure, public :: Restart - - procedure, public :: Init2 ! Do initialization in initialize phase, after subgrid weights are determined - procedure, public :: InitEachTimeStep ! Do initializations at the start of each time step - procedure, public :: InterpFileInputs ! Interpolate inputs from files - procedure, public :: UpdateSubgridWeights ! Update subgrid weights if running with prognostic patch weights - procedure, public :: DynamicAreaConservation ! Conserve C & N with updates in subgrid weights - procedure, public :: InitColumnBalance ! Set the starting point for col-level balance checks - procedure, public :: EcosystemDynamicsPreDrainage ! Do the main science that needs to be done before hydrology-drainage - procedure, public :: EcosystemDynamicsPostDrainage ! Do the main science that needs to be done after hydrology-drainage - procedure, public :: BalanceCheck ! Check the carbon and nitrogen balance - procedure, public :: EndOfTimeStepVegDynamics ! Do vegetation dynamics that should be done at the end of each time step - procedure, public :: WriteHistory ! Do any history writes that are specific to veg dynamics - - procedure, public :: get_net_carbon_exchange_grc ! Get gridcell-level net carbon exchange array - procedure, public :: get_leafn_patch ! Get patch-level leaf nitrogen array - procedure, public :: get_downreg_patch ! Get patch-level downregulation array - procedure, public :: get_root_respiration_patch ! Get patch-level root respiration array - procedure, public :: get_annsum_npp_patch ! Get patch-level annual sum NPP array - procedure, public :: get_agnpp_patch ! Get patch-level aboveground NPP array - procedure, public :: get_bgnpp_patch ! Get patch-level belowground NPP array - procedure, public :: get_froot_carbon_patch ! Get patch-level fine root carbon array - procedure, public :: get_croot_carbon_patch ! Get patch-level coarse root carbon array - procedure, public :: get_totvegc_col ! Get column-level total vegetation carbon array - - procedure, private :: CNReadNML ! Read in the CN general namelist - end type cn_vegetation_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Initialize a CNVeg object. - ! - ! Should be called regardless of whether use_cn is true - ! - ! !USES: - use CNFireFactoryMod , only : create_cnfire_method - use clm_varcon , only : c13ratio, c14ratio - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - ! Note - always initialize the memory for cnveg_state_inst (used in biogeophys/) - call this%cnveg_state_inst%Init(bounds) - - if (use_cn) then - - ! Read in the general CN namelist - call this%CNReadNML( NLFilename ) ! MUST be called first as passes down control information to others - - call this%cnveg_carbonstate_inst%Init(bounds, carbon_type='c12', ratio=1._r8, NLFilename=NLFilename) - if (use_c13) then - call this%c13_cnveg_carbonstate_inst%Init(bounds, carbon_type='c13', ratio=c13ratio, & - NLFilename=NLFilename, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) - end if - if (use_c14) then - call this%c14_cnveg_carbonstate_inst%Init(bounds, carbon_type='c14', ratio=c14ratio, & - NLFilename=NLFilename, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) - end if - call this%cnveg_carbonflux_inst%Init(bounds, carbon_type='c12') - if (use_c13) then - call this%c13_cnveg_carbonflux_inst%Init(bounds, carbon_type='c13') - end if - if (use_c14) then - call this%c14_cnveg_carbonflux_inst%Init(bounds, carbon_type='c14') - end if - call this%cnveg_nitrogenstate_inst%Init(bounds, & - this%cnveg_carbonstate_inst%leafc_patch(begp:endp), & - this%cnveg_carbonstate_inst%leafc_storage_patch(begp:endp), & - this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & - this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & - this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp) ) - call this%cnveg_nitrogenflux_inst%Init(bounds) - - call this%c_products_inst%Init(bounds, species_non_isotope_type('C')) - if (use_c13) then - call this%c13_products_inst%Init(bounds, species_isotope_type('C', '13')) - end if - if (use_c14) then - call this%c14_products_inst%Init(bounds, species_isotope_type('C', '14')) - end if - call this%n_products_inst%Init(bounds, species_non_isotope_type('N')) - - call this%cn_balance_inst%Init(bounds) - - ! Initialize the memory for the dgvs_inst data structure regardless of whether - ! use_cndv is true so that it can be used in associate statements (nag compiler - ! complains otherwise) - call this%dgvs_inst%Init(bounds) - end if - - allocate(this%cnfire_method, & - source=create_cnfire_method(NLFilename)) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine CNReadNML( this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read in the general CN control namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - character(len=*) , intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CNReadNML' - character(len=*), parameter :: nmlname = 'cn_general' ! MUST match what is in namelist below - !----------------------------------------------------------------------- - logical :: reseed_dead_plants - namelist /cn_general/ reseed_dead_plants - - reseed_dead_plants = this%reseed_dead_plants - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=cn_general, iostat=ierr) ! Namelist name here MUST be the same as in nmlname above! - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (reseed_dead_plants , mpicom) - - this%reseed_dead_plants = reseed_dead_plants - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=cn_general) ! Name here MUST be the same as in nmlname above! - write(iulog,*) ' ' - end if - - !----------------------------------------------------------------------- - - end subroutine CNReadNML - - - !----------------------------------------------------------------------- - subroutine InitAccBuffer(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for types contained here - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitAccBuffer' - !----------------------------------------------------------------------- - - if (use_cndv) then - call this%dgvs_inst%InitAccBuffer(bounds) - end if - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize variables that are associated with accumulated fields - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitAccVars' - !----------------------------------------------------------------------- - - if (use_cndv) then - call this%dgvs_inst%initAccVars(bounds) - end if - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine UpdateAccVars(this, bounds, t_a10_patch, t_ref2m_patch) - ! - ! !DESCRIPTION: - ! Update accumulated variables - ! - ! Should be called every time step - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! NOTE(wjs, 2016-02-23) These need to be pointers to agree with the interface of - ! UpdateAccVars in CNDVType (they are pointers there as a workaround for a compiler - ! bug). - real(r8), pointer , intent(in) :: t_a10_patch(:) ! 10-day running mean of the 2 m temperature (K) - real(r8), pointer , intent(in) :: t_ref2m_patch(:) ! 2 m height surface air temperature (K) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'UpdateAccVars' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(t_a10_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_ref2m_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - if (use_cndv) then - call this%dgvs_inst%UpdateAccVars(bounds, & - t_a10_patch = t_a10_patch, & - t_ref2m_patch = t_ref2m_patch) - end if - - end subroutine UpdateAccVars - - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart (read / write) for CNVeg - ! - ! Should be called regardless of whether use_cn is true - ! - ! !USES: - use ncdio_pio, only : file_desc_t - use clm_varcon, only : c3_r2, c14ratio - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - integer :: reseed_patch(bounds%endp-bounds%begp+1) - integer :: num_reseed_patch - ! - ! !LOCAL VARIABLES: - - integer :: begp, endp - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - if (use_cn) then - begp = bounds%begp - endp = bounds%endp - call this%cnveg_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c12', & - reseed_dead_plants=this%reseed_dead_plants, filter_reseed_patch=reseed_patch, & - num_reseed_patch=num_reseed_patch ) - if ( flag /= 'read' .and. num_reseed_patch /= 0 )then - call endrun(msg="ERROR num_reseed should be zero and is not"//errmsg(sourcefile, __LINE__)) - end if - if (use_c13) then - call this%c13_cnveg_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c13', & - reseed_dead_plants=this%reseed_dead_plants, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) - end if - if (use_c14) then - call this%c14_cnveg_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c14', & - reseed_dead_plants=this%reseed_dead_plants, c12_cnveg_carbonstate_inst=this%cnveg_carbonstate_inst) - end if - - call this%cnveg_carbonflux_inst%restart(bounds, ncid, flag=flag, carbon_type='c12') - if (use_c13) then - call this%c13_cnveg_carbonflux_inst%restart(bounds, ncid, flag=flag, carbon_type='c13') - end if - if (use_c14) then - call this%c14_cnveg_carbonflux_inst%restart(bounds, ncid, flag=flag, carbon_type='c14') - end if - - call this%cnveg_nitrogenstate_inst%restart(bounds, ncid, flag=flag, & - leafc_patch=this%cnveg_carbonstate_inst%leafc_patch(begp:endp), & - leafc_storage_patch=this%cnveg_carbonstate_inst%leafc_storage_patch(begp:endp), & - frootc_patch=this%cnveg_carbonstate_inst%frootc_patch(begp:endp), & - frootc_storage_patch=this%cnveg_carbonstate_inst%frootc_storage_patch(begp:endp), & - deadstemc_patch=this%cnveg_carbonstate_inst%deadstemc_patch(begp:endp), & - filter_reseed_patch=reseed_patch, num_reseed_patch=num_reseed_patch) - call this%cnveg_nitrogenflux_inst%restart(bounds, ncid, flag=flag) - call this%cnveg_state_inst%restart(bounds, ncid, flag=flag, & - cnveg_carbonstate=this%cnveg_carbonstate_inst, & - cnveg_nitrogenstate=this%cnveg_nitrogenstate_inst, & - filter_reseed_patch=reseed_patch, num_reseed_patch=num_reseed_patch) - - call this%c_products_inst%restart(bounds, ncid, flag) - if (use_c13) then - call this%c13_products_inst%restart(bounds, ncid, flag, & - template_for_missing_fields = this%c_products_inst, & - template_multiplier = c3_r2) - end if - if (use_c14) then - call this%c14_products_inst%restart(bounds, ncid, flag, & - template_for_missing_fields = this%c_products_inst, & - template_multiplier = c14ratio) - end if - call this%n_products_inst%restart(bounds, ncid, flag) - - end if - - if (use_cndv) then - call this%dgvs_inst%Restart(bounds, ncid, flag=flag) - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine Init2(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Do initialization that is needed in the initialize phase, after subgrid weights are - ! determined - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! namelist filename - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init2' - !----------------------------------------------------------------------- - - call CNDriverInit(bounds, NLFilename, this%cnfire_method) - - if (use_cndv) then - call dynCNDV_init(bounds, this%dgvs_inst) - end if - - end subroutine Init2 - - - !----------------------------------------------------------------------- - subroutine InitEachTimeStep(this, bounds, num_soilc, filter_soilc) - ! - ! !DESCRIPTION: - ! Do initializations that need to be done at the start of every time step - ! - ! This includes zeroing fluxes - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of soil columns filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitEachTimeStep' - !----------------------------------------------------------------------- - - call this%cnveg_carbonflux_inst%ZeroDWT(bounds) - if (use_c13) then - call this%c13_cnveg_carbonflux_inst%ZeroDWT(bounds) - end if - if (use_c14) then - call this%c14_cnveg_carbonflux_inst%ZeroDWT(bounds) - end if - call this%cnveg_nitrogenflux_inst%ZeroDWT(bounds) - call this%cnveg_carbonstate_inst%ZeroDWT(bounds) - call this%cnveg_nitrogenstate_inst%ZeroDWT(bounds) - - end subroutine InitEachTimeStep - - !----------------------------------------------------------------------- - subroutine InterpFileInputs(this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate inputs from files - ! - ! NOTE(wjs, 2016-02-23) Stuff done here could probably be done at the end of - ! InitEachTimeStep, rather than in this separate routine, except for the fact that - ! (currently) this Interp stuff is done with proc bounds rather thna clump bounds. I - ! think that is needed so that you don't update a given stream multiple times. If we - ! rework the handling of threading / clumps so that there is a separate object for - ! each clump, then I think this problem would disappear - at which point we could - ! remove this Interp routine, moving its body to the end of InitEachTimeStep. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InterpFileInputs' - !----------------------------------------------------------------------- - - call this%cnfire_method%CNFireInterp(bounds) - - end subroutine InterpFileInputs - - - !----------------------------------------------------------------------- - subroutine UpdateSubgridWeights(this, bounds) - ! - ! !DESCRIPTION: - ! Update subgrid weights if running with prognostic patch weights - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'UpdateSubgridWeights' - !----------------------------------------------------------------------- - - if (use_cndv) then - call dynCNDV_interp(bounds, this%dgvs_inst) - end if - - end subroutine UpdateSubgridWeights - - - !----------------------------------------------------------------------- - subroutine DynamicAreaConservation(this, bounds, clump_index, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - num_soilc_with_inactive, filter_soilc_with_inactive, & - prior_weights, patch_state_updater, column_state_updater, & - canopystate_inst, photosyns_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst, ch4_inst, soilbiogeochem_state_inst) - ! - ! !DESCRIPTION: - ! Conserve C & N with updates in subgrid weights - ! - ! Should only be called if use_cn is true - ! - ! !USES: - use dynPriorWeightsMod , only : prior_weights_type - use dynPatchStateUpdaterMod, only : patch_state_updater_type - use dynColumnStateUpdaterMod, only : column_state_updater_type - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer , intent(in) :: clump_index - - integer , intent(in) :: num_soilp_with_inactive ! number of points in filter_soilp_with_inactive - integer , intent(in) :: filter_soilp_with_inactive(:) ! soil patch filter that includes inactive points - integer , intent(in) :: num_soilc_with_inactive ! number of points in filter_soilc_with_inactive - integer , intent(in) :: filter_soilc_with_inactive(:) ! soil column filter that includes inactive points - type(prior_weights_type) , intent(in) :: prior_weights ! weights prior to the subgrid weight updates - type(patch_state_updater_type) , intent(in) :: patch_state_updater - type(column_state_updater_type) , intent(in) :: column_state_updater - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(ch4_type) , intent(inout) :: ch4_inst - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'DynamicAreaConservation' - !----------------------------------------------------------------------- - - call t_startf('dyn_cnbal_patch') - call dyn_cnbal_patch(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - prior_weights, patch_state_updater, & - canopystate_inst, photosyns_inst, & - this%cnveg_state_inst, & - this%cnveg_carbonstate_inst, this%c13_cnveg_carbonstate_inst, this%c14_cnveg_carbonstate_inst, & - this%cnveg_carbonflux_inst, this%c13_cnveg_carbonflux_inst, this%c14_cnveg_carbonflux_inst, & - this%cnveg_nitrogenstate_inst, this%cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_state_inst) - call t_stopf('dyn_cnbal_patch') - - ! It is important to update column-level state variables based on the fluxes - ! generated by dyn_cnbal_patch (which handles the change in aboveground / patch-level - ! C/N due to shrinking patches), before calling dyn_cnbal_col (which handles the - ! change in belowground / column-level C/N due to changing column areas). This way, - ! any aboveground biomass which is sent to litter or soil due to shrinking patch - ! areas is accounted for by the column-level conservation. This is important if - ! column weights on the grid cell are changing at the same time as patch weights on - ! the grid cell (which will typically be the case when columns change in area). - ! - ! The filters here need to include inactive points as well as active points so that - ! we correctly update column states in columns that have just shrunk to 0 area - - ! since those column states are still important in the following dyn_cnbal_col. - call t_startf('CNUpdateDynPatch') - call CStateUpdateDynPatch(bounds, num_soilc_with_inactive, filter_soilc_with_inactive, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & - soilbiogeochem_carbonstate_inst) - if (use_c13) then - call CStateUpdateDynPatch(bounds, num_soilc_with_inactive, filter_soilc_with_inactive, & - this%c13_cnveg_carbonflux_inst, this%c13_cnveg_carbonstate_inst, & - soilbiogeochem_carbonstate_inst) - end if - if (use_c14) then - call CStateUpdateDynPatch(bounds, num_soilc_with_inactive, filter_soilc_with_inactive, & - this%c14_cnveg_carbonflux_inst, this%c14_cnveg_carbonstate_inst, & - soilbiogeochem_carbonstate_inst) - end if - call NStateUpdateDynPatch(bounds, num_soilc_with_inactive, filter_soilc_with_inactive, & - this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst, & - soilbiogeochem_nitrogenstate_inst) - call t_stopf('CNUpdateDynPatch') - - call t_startf('dyn_cnbal_col') - call dyn_cnbal_col(bounds, clump_index, column_state_updater, & - soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst, & - ch4_inst) - call t_stopf('dyn_cnbal_col') - - end subroutine DynamicAreaConservation - - !----------------------------------------------------------------------- - subroutine InitColumnBalance(this, bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Set the starting point for column-level balance checks. - ! - ! This should be called after DynamicAreaConservation, since the changes made by - ! DynamicAreaConservation can break column-level conservation checks. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - 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(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitColumnBalance' - !----------------------------------------------------------------------- - - call CNDriverSummarizeStates(bounds, & - num_allc, filter_allc, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - this%cnveg_carbonstate_inst, & - this%c13_cnveg_carbonstate_inst, & - this%c14_cnveg_carbonstate_inst, & - this%cnveg_nitrogenstate_inst, & - soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst) - - call this%cn_balance_inst%BeginCNBalance( & - bounds, num_soilc, filter_soilc, & - this%cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst) - - end subroutine InitColumnBalance - - - !----------------------------------------------------------------------- - subroutine EcosystemDynamicsPreDrainage(this, bounds, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - num_pcropp, filter_pcropp, & - doalb, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & - photosyns_inst, soilhydrology_inst, energyflux_inst, & - nutrient_competition_method, fireemis_inst) - ! - ! !DESCRIPTION: - ! Do the main science for CN vegetation that needs to be done before hydrology-drainage - ! - ! Should only be called if use_cn is true - ! - ! !USES: - - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: 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 - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - 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 - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(crop_type) , intent(inout) :: crop_inst - type(ch4_type) , intent(in) :: ch4_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(energyflux_type) , intent(in) :: energyflux_inst - class(nutrient_competition_method_type) , intent(inout) :: nutrient_competition_method - type(fireemis_type) , intent(inout) :: fireemis_inst - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'EcosystemDynamicsPreDrainage' - !----------------------------------------------------------------------- - - call crop_inst%CropIncrementYear(num_pcropp, filter_pcropp) - - call CNDriverNoLeaching(bounds, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - num_pcropp, filter_pcropp, doalb, & - this%cnveg_state_inst, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, & - this%c13_cnveg_carbonflux_inst, this%c13_cnveg_carbonstate_inst, & - this%c14_cnveg_carbonflux_inst, this%c14_cnveg_carbonstate_inst, & - this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst, & - this%c_products_inst, this%c13_products_inst, this%c14_products_inst, & - this%n_products_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & - this%dgvs_inst, photosyns_inst, soilhydrology_inst, energyflux_inst, & - nutrient_competition_method, this%cnfire_method) - - ! fire carbon emissions - call CNFireEmisUpdate(bounds, num_soilp, filter_soilp, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, fireemis_inst ) - - call CNAnnualUpdate(bounds, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - this%cnveg_state_inst, this%cnveg_carbonflux_inst) - - end subroutine EcosystemDynamicsPreDrainage - - !----------------------------------------------------------------------- - subroutine EcosystemDynamicsPostDrainage(this, bounds, num_allc, filter_allc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, doalb, crop_inst, & - waterstate_inst, waterflux_inst, frictionvel_inst, canopystate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! Do the main science for CN vegetation that needs to be done after hydrology-drainage - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - 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 - logical , intent(in) :: doalb ! true = surface albedo calculation time step - type(crop_type) , intent(in) :: crop_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'EcosystemDynamicsPostDrainage' - !----------------------------------------------------------------------- - - ! Update the nitrogen leaching rate as a function of soluble mineral N - ! and total soil water outflow. - - call CNDriverLeaching(bounds, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - waterstate_inst, waterflux_inst, & - this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - - ! Set controls on very low values in critical state variables - - call t_startf('CNPrecisionControl') - call CNPrecisionControl(bounds, num_soilp, filter_soilp, & - this%cnveg_carbonstate_inst, this%c13_cnveg_carbonstate_inst, & - this%c14_cnveg_carbonstate_inst, this%cnveg_nitrogenstate_inst) - call t_stopf('CNPrecisionControl') - - call t_startf('SoilBiogeochemPrecisionControl') - call SoilBiogeochemPrecisionControl(num_soilc, filter_soilc, & - soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst,soilbiogeochem_nitrogenstate_inst) - call t_stopf('SoilBiogeochemPrecisionControl') - - ! Call to all CN summary routines - - call CNDriverSummarizeStates(bounds, & - num_allc, filter_allc, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - this%cnveg_carbonstate_inst, & - this%c13_cnveg_carbonstate_inst, & - this%c14_cnveg_carbonstate_inst, & - this%cnveg_nitrogenstate_inst, & - soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst) - - call CNDriverSummarizeFluxes(bounds, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - this%cnveg_carbonflux_inst, & - this%c13_cnveg_carbonflux_inst, & - this%c14_cnveg_carbonflux_inst, & - this%cnveg_nitrogenflux_inst, & - this%c_products_inst, this%c13_products_inst, this%c14_products_inst, & - soilbiogeochem_carbonflux_inst, & - c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenflux_inst) - - ! On the radiation time step, use C state variables to calculate - ! vegetation structure (LAI, SAI, height) - - if (doalb) then - call CNVegStructUpdate(num_soilp, filter_soilp, & - waterstate_inst, frictionvel_inst, this%dgvs_inst, this%cnveg_state_inst, & - crop_inst, this%cnveg_carbonstate_inst, canopystate_inst) - end if - - end subroutine EcosystemDynamicsPostDrainage - - !----------------------------------------------------------------------- - subroutine BalanceCheck(this, bounds, num_soilc, filter_soilc, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Check the carbon and nitrogen balance - ! - ! Should only be called if use_cn is true - ! - ! !USES: - use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause - ! - ! !ARGUMENTS: - class(cn_vegetation_type) , intent(inout) :: 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 - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: DA_nstep ! time step number - - character(len=*), parameter :: subname = 'BalanceCheck' - !----------------------------------------------------------------------- - - DA_nstep = get_nstep_since_startup_or_lastDA_restart_or_pause() - if (DA_nstep < 2 )then - if (masterproc) then - write(iulog,*) '--WARNING-- skipping CN balance check for first timesteps after startup or data assimilation' - end if - else - - call this%cn_balance_inst%CBalanceCheck( & - bounds, num_soilc, filter_soilc, & - soilbiogeochem_carbonflux_inst, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst) - - call this%cn_balance_inst%NBalanceCheck( & - bounds, num_soilc, filter_soilc, & - soilbiogeochem_nitrogenflux_inst, & - this%cnveg_nitrogenflux_inst, this%cnveg_nitrogenstate_inst) - - end if - - end subroutine BalanceCheck - - !----------------------------------------------------------------------- - subroutine EndOfTimeStepVegDynamics(this, bounds, num_natvegp, filter_natvegp, & - atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Do vegetation dynamics that should be done at the end of each time step - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(inout) :: num_natvegp ! number of naturally-vegetated patches in filter - integer , intent(inout) :: filter_natvegp(:) ! filter for naturally-vegetated patches - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: nstep ! time step number - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day - integer :: ncdate ! current date - integer :: nbdate ! base date (reference date) - integer :: kyr ! thousand years, equals 2 at end of first year - - character(len=*), parameter :: subname = 'EndOfTimeStepVegDynamics' - !----------------------------------------------------------------------- - - if (use_cndv) then - ! Call dv (dynamic vegetation) at last time step of year - - call t_startf('d2dgvm') - if (is_end_curr_year() .and. .not. is_first_step()) then - - ! Get date info. kyr is used in lpj(). At end of first year, kyr = 2. - call get_curr_date(yr, mon, day, sec) - ncdate = yr*10000 + mon*100 + day - call get_ref_date(yr, mon, day, sec) - nbdate = yr*10000 + mon*100 + day - kyr = ncdate/10000 - nbdate/10000 + 1 - - if (masterproc) then - nstep = get_nstep() - write(iulog,*) 'End of year. CNDV called now: ncdate=', & - ncdate,' nbdate=',nbdate,' kyr=',kyr,' nstep=', nstep - end if - - call CNDVDriver(bounds, & - num_natvegp, filter_natvegp, kyr, & - atm2lnd_inst, & - this%cnveg_carbonflux_inst, this%cnveg_carbonstate_inst, this%dgvs_inst) - end if - call t_stopf('d2dgvm') - end if - - end subroutine EndOfTimeStepVegDynamics - - !----------------------------------------------------------------------- - subroutine WriteHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Do any history writes that are specific to vegetation dynamics - ! - ! NOTE(wjs, 2016-02-23) This could probably be combined with - ! EndOfTimeStepVegDynamics, except for the fact that (currently) history writes are - ! done with proc bounds rather than clump bounds. If that were changed, then the body - ! of this could be moved into EndOfTimeStepVegDynamics, inside a "if (.not. - ! use_noio)" conditional. - ! - ! Should only be called if use_cn is true - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'WriteHistory' - !----------------------------------------------------------------------- - - ! Write to CNDV history buffer if appropriate - if (use_cndv) then - if (is_end_curr_year() .and. .not. is_first_step()) then - call t_startf('clm_drv_io_hdgvm') - call CNDVHist( bounds, this%dgvs_inst ) - if (masterproc) write(iulog,*) 'Annual CNDV calculations are complete' - call t_stopf('clm_drv_io_hdgvm') - end if - end if - - end subroutine WriteHistory - - - !----------------------------------------------------------------------- - function get_net_carbon_exchange_grc(this, bounds) result(net_carbon_exchange_grc) - ! - ! !DESCRIPTION: - ! Get gridcell-level net carbon exchange array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: net_carbon_exchange_grc(bounds%begg:bounds%endg) ! function result: net carbon exchange between land and atmosphere, includes fire, landuse, harvest and hrv_xsmrpool flux, positive for source (gC/m2/s) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_net_carbon_exchange_grc' - !----------------------------------------------------------------------- - - if (use_cn) then - net_carbon_exchange_grc(bounds%begg:bounds%endg) = & - -this%cnveg_carbonflux_inst%nbp_grc(bounds%begg:bounds%endg) - else - net_carbon_exchange_grc(bounds%begg:bounds%endg) = 0._r8 - end if - - end function get_net_carbon_exchange_grc - - - !----------------------------------------------------------------------- - function get_leafn_patch(this, bounds) result(leafn_patch) - ! - ! !DESCRIPTION: - ! Get patch-level leaf nitrogen array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: leafn_patch(bounds%begp:bounds%endp) ! function result: leaf N (gN/m2) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_leafn_patch' - !----------------------------------------------------------------------- - - if (use_cn) then - leafn_patch(bounds%begp:bounds%endp) = & - this%cnveg_nitrogenstate_inst%leafn_patch(bounds%begp:bounds%endp) - else - leafn_patch(bounds%begp:bounds%endp) = nan - end if - - end function get_leafn_patch - - !----------------------------------------------------------------------- - function get_downreg_patch(this, bounds) result(downreg_patch) - ! - ! !DESCRIPTION: - ! Get patch-level downregulation array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: downreg_patch(bounds%begp:bounds%endp) ! function result: fractional reduction in GPP due to N limitation (dimensionless) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_downreg_patch' - !----------------------------------------------------------------------- - - if (use_cn) then - downreg_patch(bounds%begp:bounds%endp) = & - this%cnveg_state_inst%downreg_patch(bounds%begp:bounds%endp) - else - downreg_patch(bounds%begp:bounds%endp) = nan - end if - - end function get_downreg_patch - - !----------------------------------------------------------------------- - function get_root_respiration_patch(this, bounds) result(root_respiration_patch) - ! - ! !DESCRIPTION: - ! Get patch-level root respiration array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: root_respiration_patch(bounds%begp:bounds%endp) ! function result: root respiration (fine root MR + total root GR) (gC/m2/s) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_root_respiration_patch' - !----------------------------------------------------------------------- - - if (use_cn) then - root_respiration_patch(bounds%begp:bounds%endp) = & - this%cnveg_carbonflux_inst%rr_patch(bounds%begp:bounds%endp) - else - root_respiration_patch(bounds%begp:bounds%endp) = nan - end if - - end function get_root_respiration_patch - - ! TODO(wjs, 2016-02-19) annsum_npp, agnpp and bgnpp are all needed for the estimation - ! of tillers in ch4Mod. Rather than providing getters for these three things so that - ! ch4Mod can estimate tillers, it would probably be better if the tiller estimation - ! algorithm was moved into some CNVeg-specific module, and then tillers could be - ! queried directly. - - !----------------------------------------------------------------------- - function get_annsum_npp_patch(this, bounds) result(annsum_npp_patch) - ! - ! !DESCRIPTION: - ! Get patch-level annual sum NPP array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: annsum_npp_patch(bounds%begp:bounds%endp) ! function result: annual sum NPP (gC/m2/yr) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_annsum_npp_patch' - !----------------------------------------------------------------------- - - if (use_cn) then - annsum_npp_patch(bounds%begp:bounds%endp) = & - this%cnveg_carbonflux_inst%annsum_npp_patch(bounds%begp:bounds%endp) - else - annsum_npp_patch(bounds%begp:bounds%endp) = nan - end if - - end function get_annsum_npp_patch - - !----------------------------------------------------------------------- - function get_agnpp_patch(this, bounds) result(agnpp_patch) - ! - ! !DESCRIPTION: - ! Get patch-level aboveground NPP array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: agnpp_patch(bounds%begp:bounds%endp) ! function result: aboveground NPP (gC/m2/s) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_agnpp_patch' - !----------------------------------------------------------------------- - - if (use_cn) then - agnpp_patch(bounds%begp:bounds%endp) = & - this%cnveg_carbonflux_inst%agnpp_patch(bounds%begp:bounds%endp) - else - agnpp_patch(bounds%begp:bounds%endp) = nan - end if - - end function get_agnpp_patch - - !----------------------------------------------------------------------- - function get_bgnpp_patch(this, bounds) result(bgnpp_patch) - ! - ! !DESCRIPTION: - ! Get patch-level belowground NPP array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: bgnpp_patch(bounds%begp:bounds%endp) ! function result: belowground NPP (gC/m2/s) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_bgnpp_patch' - !----------------------------------------------------------------------- - - if (use_cn) then - bgnpp_patch(bounds%begp:bounds%endp) = & - this%cnveg_carbonflux_inst%bgnpp_patch(bounds%begp:bounds%endp) - else - bgnpp_patch(bounds%begp:bounds%endp) = nan - end if - - end function get_bgnpp_patch - - !----------------------------------------------------------------------- - function get_froot_carbon_patch(this, bounds, tlai) result(froot_carbon_patch) - ! - ! !DESCRIPTION: - ! Get patch-level fine root carbon array - ! - ! !USES: - use pftconMod , only : pftcon - use PatchType , only : patch - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) , intent(in) :: tlai( bounds%begp: ) - real(r8) :: froot_carbon_patch(bounds%begp:bounds%endp) ! function result: (gC/m2) - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'get_froot_carbon_patch' - integer :: p - !----------------------------------------------------------------------- - - if (use_cn) then - froot_carbon_patch(bounds%begp:bounds%endp) = & - this%cnveg_carbonstate_inst%frootc_patch(bounds%begp:bounds%endp) - else -! To get leaf biomass: -! bleaf = LAI / slatop -! g/m2 = m2/m2 / m2/g -! To get root biomass: -! broot = bleaf * froot_leaf(ivt(p)) -! g/m2 = g/m2 * g/g - do p=bounds%begp, bounds%endp - if (pftcon%slatop(patch%itype(p)) > 0._r8) then - froot_carbon_patch(p) = tlai(p) & - / pftcon%slatop(patch%itype(p)) & - *pftcon%froot_leaf(patch%itype(p)) - else - froot_carbon_patch(p) = 0._r8 - endif - enddo - end if - - end function get_froot_carbon_patch - - !----------------------------------------------------------------------- - function get_croot_carbon_patch(this, bounds, tlai) result(croot_carbon_patch) - ! - ! !DESCRIPTION: - ! Get patch-level live coarse root carbon array - ! - ! !USES: - use pftconMod , only : pftcon - use PatchType , only : patch - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) , intent(in) :: tlai( bounds%begp: ) - real(r8) :: croot_carbon_patch(bounds%begp:bounds%endp) ! function result: (gC/m2) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_croot_carbon_patch' - integer :: p - !----------------------------------------------------------------------- - - if (use_cn) then - croot_carbon_patch(bounds%begp:bounds%endp) = & - this%cnveg_carbonstate_inst%livecrootc_patch(bounds%begp:bounds%endp) - else -! To get leaf biomass: -! bleaf = LAI / slatop -! g/m2 = m2/m2 / m2/g -! To get root biomass: -! broot = bleaf * froot_leaf(ivt(p)) -! g/m2 = g/m2 * g/g - do p=bounds%begp, bounds%endp - if (pftcon%slatop(patch%itype(p)) > 0._r8) then - croot_carbon_patch(p) = tlai(p) & - / pftcon%slatop(patch%itype(p)) & - *pftcon%stem_leaf(patch%itype(p)) & - *pftcon%croot_stem(patch%itype(p)) - else - croot_carbon_patch(p) = 0._r8 - endif - enddo - end if - - end function get_croot_carbon_patch - - !----------------------------------------------------------------------- - function get_totvegc_col(this, bounds) result(totvegc_col) - ! - ! !DESCRIPTION: - ! Get column-level total vegetation carbon array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(cn_vegetation_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8) :: totvegc_col(bounds%begc:bounds%endc) ! function result: (gC/m2) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_totvegc_col' - !----------------------------------------------------------------------- - - if (use_cn) then - totvegc_col(bounds%begc:bounds%endc) = & - this%cnveg_carbonstate_inst%totvegc_col(bounds%begc:bounds%endc) - else - totvegc_col(bounds%begc:bounds%endc) = nan - end if - - end function get_totvegc_col - - -end module CNVegetationFacade diff --git a/src/biogeochem/CropType.F90 b/src/biogeochem/CropType.F90 deleted file mode 100644 index eaed486bc5..0000000000 --- a/src/biogeochem/CropType.F90 +++ /dev/null @@ -1,723 +0,0 @@ -module CropType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing variables needed for the crop model - ! - ! TODO(wjs, 2014-08-05) Move more crop-specific variables into here - many are - ! currently in CNVegStateType - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varcon , only : spval - use clm_varctl , only : iulog, use_crop - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC DATA TYPES: - ! - ! Crop state variables structure - type, public :: crop_type - - ! Note that cropplant and harvdate could be 2D to facilitate rotation - integer , pointer :: nyrs_crop_active_patch (:) ! number of years this crop patch has been active (0 for non-crop patches) - logical , pointer :: croplive_patch (:) ! patch Flag, true if planted, not harvested - logical , pointer :: cropplant_patch (:) ! patch Flag, true if planted - integer , pointer :: harvdate_patch (:) ! patch harvest date - real(r8), pointer :: fertnitro_patch (:) ! patch fertilizer nitrogen - real(r8), pointer :: gddplant_patch (:) ! patch accum gdd past planting date for crop (ddays) - real(r8), pointer :: gddtsoi_patch (:) ! patch growing degree-days from planting (top two soil layers) (ddays) - real(r8), pointer :: vf_patch (:) ! patch vernalization factor for cereal - real(r8), pointer :: cphase_patch (:) ! phenology phase - real(r8), pointer :: latbaset_patch (:) ! Latitude vary baset for gddplant (degree C) - character(len=20) :: baset_mapping - real(r8) :: baset_latvary_intercept - real(r8) :: baset_latvary_slope - - contains - ! Public routines - procedure, public :: Init ! Initialize the crop type - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: Restart - procedure, public :: ReadNML ! Read in the crop namelist - - ! NOTE(wjs, 2014-09-29) need to rename this from UpdateAccVars to CropUpdateAccVars - ! to prevent cryptic error messages with pgi (v. 13.9 on yellowstone) - ! This is probably related to this bug - ! , which was fixed in pgi 14.7. - procedure, public :: CropUpdateAccVars - - procedure, public :: CropIncrementYear - - ! Private routines - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, private, nopass :: checkDates - - end type crop_type - - character(len=*), parameter, private :: baset_map_constant = 'constant' - character(len=*), parameter, private :: baset_map_latvary = 'varytropicsbylat' - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - ! - ! !ARGUMENTS: - class(crop_type) , intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - - if (use_crop) then - call this%InitHistory(bounds) - call this%InitCold(bounds) - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine ReadNML(this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CropType - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(crop_type) , intent(inout) :: this - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'Crop::ReadNML' - character(len=*), parameter :: nmlname = 'crop' - !----------------------------------------------------------------------- - character(len=20) :: baset_mapping - real(r8) :: baset_latvary_intercept - real(r8) :: baset_latvary_slope - namelist /crop/ baset_mapping, baset_latvary_intercept, baset_latvary_slope - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - baset_mapping = 'constant' - baset_latvary_intercept = 12._r8 - baset_latvary_slope = 0.4_r8 - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=crop, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (baset_mapping , mpicom) - call shr_mpi_bcast (baset_latvary_intercept , mpicom) - call shr_mpi_bcast (baset_latvary_slope , mpicom) - - this%baset_mapping = baset_mapping - this%baset_latvary_intercept = baset_latvary_intercept - this%baset_latvary_slope = baset_latvary_slope - if ( trim(this%baset_mapping) == baset_map_constant ) then - if ( masterproc ) write(iulog,*) 'baset mapping for ALL crops are constant' - else if ( trim(this%baset_mapping) == baset_map_latvary ) then - if ( masterproc ) write(iulog,*) 'baset mapping for crops vary with latitude' - else - call endrun(msg="Bad value for baset_mapping in "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=crop) - write(iulog,*) ' ' - end if - - !----------------------------------------------------------------------- - - end subroutine ReadNML - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! !USES: - ! - ! !ARGUMENTS: - class(crop_type) , intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - allocate(this%nyrs_crop_active_patch(begp:endp)) ; this%nyrs_crop_active_patch(:) = 0 - allocate(this%croplive_patch (begp:endp)) ; this%croplive_patch (:) = .false. - allocate(this%cropplant_patch(begp:endp)) ; this%cropplant_patch(:) = .false. - allocate(this%harvdate_patch (begp:endp)) ; this%harvdate_patch (:) = huge(1) - allocate(this%fertnitro_patch (begp:endp)) ; this%fertnitro_patch (:) = spval - allocate(this%gddplant_patch (begp:endp)) ; this%gddplant_patch (:) = spval - allocate(this%gddtsoi_patch (begp:endp)) ; this%gddtsoi_patch (:) = spval - allocate(this%vf_patch (begp:endp)) ; this%vf_patch (:) = 0.0_r8 - allocate(this%cphase_patch (begp:endp)) ; this%cphase_patch (:) = 0.0_r8 - allocate(this%latbaset_patch (begp:endp)) ; this%latbaset_patch (:) = spval - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - this%fertnitro_patch(begp:endp) = spval - call hist_addfld1d (fname='FERTNITRO', units='gN/m2/yr', & - avgflag='A', long_name='Nitrogen fertilizer for each crop', & - ptr_patch=this%fertnitro_patch, default='inactive') - - this%gddplant_patch(begp:endp) = spval - call hist_addfld1d (fname='GDDPLANT', units='ddays', & - avgflag='A', long_name='Accumulated growing degree days past planting date for crop', & - ptr_patch=this%gddplant_patch, default='inactive') - - this%gddtsoi_patch(begp:endp) = spval - call hist_addfld1d (fname='GDDTSOI', units='ddays', & - avgflag='A', long_name='Growing degree-days from planting (top two soil layers)', & - ptr_patch=this%gddtsoi_patch, default='inactive') - - this%cphase_patch(begp:endp) = spval - call hist_addfld1d (fname='CPHASE', units='0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest', & - avgflag='A', long_name='crop phenology phase', & - ptr_patch=this%cphase_patch, default='active') - - if ( (trim(this%baset_mapping) == baset_map_latvary) )then - this%latbaset_patch(begp:endp) = spval - call hist_addfld1d (fname='LATBASET', units='degree C', & - avgflag='A', long_name='latitude vary base temperature for gddplant', & - ptr_patch=this%latbaset_patch, default='inactive') - end if - - end subroutine InitHistory - - subroutine InitCold(this, bounds) - ! !USES: - use LandunitType, only : lun - use landunit_varcon, only : istcrop - use PatchType, only : patch - use clm_instur, only : fert_cft - use pftconMod , only : pftcon - use GridcellType , only : grc - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c, l, g, p, m, ivt ! indices - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - -!DLL - added wheat & sugarcane restrictions to base T vary by lat - do p= bounds%begp,bounds%endp - g = patch%gridcell(p) - ivt = patch%itype(p) - - this%nyrs_crop_active_patch(p) = 0 - - if ( grc%latdeg(g) >= 0.0_r8 .and. grc%latdeg(g) <= 30.0_r8) then - this%latbaset_patch(p)=pftcon%baset(ivt)+12._r8-0.4_r8*grc%latdeg(g) - else if (grc%latdeg(g) < 0.0_r8 .and. grc%latdeg(g) >= -30.0_r8) then - this%latbaset_patch(p)=pftcon%baset(ivt)+12._r8+0.4_r8*grc%latdeg(g) - else - this%latbaset_patch(p)=pftcon%baset(ivt) - end if - if ( trim(this%baset_mapping) == baset_map_constant ) then - this%latbaset_patch(p) = nan - end if - end do -!DLL -- end of mods - - if (use_crop) then - do p= bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - c = patch%column(p) - - if (lun%itype(l) == istcrop) then - m = patch%itype(p) - this%fertnitro_patch(p) = fert_cft(g,m) - end if - end do - end if - - end subroutine InitCold - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateAccVars]. - ! - ! Should only be called if use_crop is true - ! - ! !USES - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(crop_type) , intent(in) :: this - type(bounds_type), intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer, parameter :: not_used = huge(1) - - !--------------------------------------------------------------------- - - call init_accum_field (name='GDDPLANT', units='K', & - desc='growing degree-days from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDDTSOI', units='K', & - desc='growing degree-days from planting (top two soil layers)', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES: - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - - character(len=*), parameter :: subname = 'InitAccVars' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg=" allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - nstep = get_nstep() - - call extract_accum_field ('GDDPLANT', rbufslp, nstep) - this%gddplant_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('GDDTSOI', rbufslp, nstep) - this%gddtsoi_patch(begp:endp) = rbufslp(begp:endp) - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use restUtilMod - use ncdio_pio - use PatchType, only : patch - use pftconMod, only : npcropmin, npcropmax - ! - ! !ARGUMENTS: - class(crop_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - ! - ! !LOCAL VARIABLES: - integer, pointer :: temp1d(:) ! temporary - integer :: restyear - integer :: p - logical :: readvar ! determine if variable is on initial file - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='nyrs_crop_active', xtype=ncd_int, & - dim1name='pft', & - long_name='Number of years this crop patch has been active (0 for non-crop patches)', & - units='years', & - interpinic_flag='interp', readvar=readvar, data=this%nyrs_crop_active_patch) - if (flag == 'read' .and. .not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2017-02-17) Old restart files did not have this - ! patch-level variable. Instead, they had a single scalar tracking the number - ! of years the crop model ran. Copy this scalar onto all *active* crop patches. - - ! Some arguments in the following restartvar call are irrelevant, because we - ! only call this for 'read'. I'm simply maintaining the old restartvar call. - call restartvar(ncid=ncid, flag=flag, varname='restyear', xtype=ncd_int, & - long_name='Number of years prognostic crop ran', units="years", & - interpinic_flag='copy', readvar=readvar, data=restyear) - if (readvar) then - do p = bounds%begp, bounds%endp - if (patch%itype(p) >= npcropmin .and. patch%itype(p) <= npcropmax .and. & - patch%active(p)) then - this%nyrs_crop_active_patch(p) = restyear - end if - end do - end if - end if - - allocate(temp1d(bounds%begp:bounds%endp)) - if (flag == 'write') then - do p= bounds%begp,bounds%endp - if (this%croplive_patch(p)) then - temp1d(p) = 1 - else - temp1d(p) = 0 - end if - end do - end if - call restartvar(ncid=ncid, flag=flag, varname='croplive', xtype=ncd_log, & - dim1name='pft', & - long_name='Flag that crop is alive, but not harvested', & - interpinic_flag='interp', readvar=readvar, data=temp1d) - if (flag == 'read') then - do p= bounds%begp,bounds%endp - if (temp1d(p) == 1) then - this%croplive_patch(p) = .true. - else - this%croplive_patch(p) = .false. - end if - end do - end if - deallocate(temp1d) - - allocate(temp1d(bounds%begp:bounds%endp)) - if (flag == 'write') then - do p= bounds%begp,bounds%endp - if (this%cropplant_patch(p)) then - temp1d(p) = 1 - else - temp1d(p) = 0 - end if - end do - end if - call restartvar(ncid=ncid, flag=flag, varname='cropplant', xtype=ncd_log, & - dim1name='pft', & - long_name='Flag that crop is planted, but not harvested' , & - interpinic_flag='interp', readvar=readvar, data=temp1d) - if (flag == 'read') then - do p= bounds%begp,bounds%endp - if (temp1d(p) == 1) then - this%cropplant_patch(p) = .true. - else - this%cropplant_patch(p) = .false. - end if - end do - end if - deallocate(temp1d) - - call restartvar(ncid=ncid, flag=flag, varname='harvdate', xtype=ncd_int, & - dim1name='pft', long_name='harvest date', units='jday', nvalid_range=(/1,366/), & - interpinic_flag='interp', readvar=readvar, data=this%harvdate_patch) - - call restartvar(ncid=ncid, flag=flag, varname='vf', xtype=ncd_double, & - dim1name='pft', long_name='vernalization factor', units='', & - interpinic_flag='interp', readvar=readvar, data=this%vf_patch) - - call restartvar(ncid=ncid, flag=flag, varname='cphase',xtype=ncd_double, & - dim1name='pft', long_name='crop phenology phase', & - units='0-not planted, 1-planted, 2-leaf emerge, 3-grain fill, 4-harvest', & - interpinic_flag='interp', readvar=readvar, data=this%cphase_patch) - if (flag=='read' )then - call this%checkDates( ) ! Check that restart date is same calendar date (even if year is different) - ! This is so that it properly goes through - ! the crop phases - end if - end if - - end subroutine Restart - - - !----------------------------------------------------------------------- - subroutine CropUpdateAccVars(this, bounds, t_ref2m_patch, t_soisno_col) - ! - ! !DESCRIPTION: - ! Update accumulated variables. Should be called every time step. - ! Should only be called if use_crop is true. - ! - ! !USES: - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep - use clm_varpar , only : nlevsno, nlevgrnd - use pftconMod , only : nswheat, nirrig_swheat, pftcon - use pftconMod , only : nwwheat, nirrig_wwheat - use pftconMod , only : nsugarcane, nirrig_sugarcane - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - implicit none - class(crop_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: t_ref2m_patch( bounds%begp:) - real(r8) , intent(inout) :: t_soisno_col(bounds%begc:, -nlevsno+1:) - ! - ! !LOCAL VARIABLES: - integer :: p,c,g ! indices - integer :: ivt ! vegetation type - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - character(len=*), parameter :: subname = 'CropUpdateAccVars' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(t_ref2m_patch) == (/endp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno_col) == (/endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - - dtime = get_step_size() - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract GDDPLANT - - call extract_accum_field ('GDDPLANT', rbufslp, nstep) - do p = begp,endp - rbufslp(p) = max(0.,this%gddplant_patch(p)-rbufslp(p)) - end do - call update_accum_field ('GDDPLANT', rbufslp, nstep) - do p = begp,endp - if (this%croplive_patch(p)) then ! relative to planting date - ivt = patch%itype(p) - if ( (trim(this%baset_mapping) == baset_map_latvary) .and. & - ((ivt == nswheat) .or. (ivt == nirrig_swheat) .or. & - (ivt == nsugarcane) .or. (ivt == nirrig_sugarcane)) ) then - rbufslp(p) = max(0._r8, min(pftcon%mxtmp(ivt), & - t_ref2m_patch(p)-(SHR_CONST_TKFRZ + this%latbaset_patch(p)))) & - * dtime/SHR_CONST_CDAY - else - rbufslp(p) = max(0._r8, min(pftcon%mxtmp(ivt), & - t_ref2m_patch(p)-(SHR_CONST_TKFRZ + pftcon%baset(ivt)))) & - * dtime/SHR_CONST_CDAY - end if - if (ivt == nwwheat .or. ivt == nirrig_wwheat) then - rbufslp(p) = rbufslp(p) * this%vf_patch(p) - end if - else - rbufslp(p) = accumResetVal - end if - end do - call update_accum_field ('GDDPLANT', rbufslp, nstep) - call extract_accum_field ('GDDPLANT', this%gddplant_patch, nstep) - - ! Accumulate and extract GDDTSOI - ! In agroibis this variable is calculated - ! to 0.05 m, so here we use the top two soil layers - - do p = begp,endp - if (this%croplive_patch(p)) then ! relative to planting date - ivt = patch%itype(p) - c = patch%column(p) - rbufslp(p) = max(0._r8, min(pftcon%mxtmp(ivt), & - ((t_soisno_col(c,1)*col%dz(c,1) + & - t_soisno_col(c,2)*col%dz(c,2))/(col%dz(c,1)+col%dz(c,2))) - & - (SHR_CONST_TKFRZ + pftcon%baset(ivt)))) * dtime/SHR_CONST_CDAY - if (ivt == nwwheat .or. ivt == nwwheat) then - rbufslp(p) = rbufslp(p) * this%vf_patch(p) - end if - else - rbufslp(p) = accumResetVal - end if - end do - call update_accum_field ('GDDTSOI', rbufslp, nstep) - call extract_accum_field ('GDDTSOI', this%gddtsoi_patch, nstep) - - deallocate(rbufslp) - - end subroutine CropUpdateAccVars - - !----------------------------------------------------------------------- - subroutine CropIncrementYear (this, num_pcropp, filter_pcropp) - ! - ! !DESCRIPTION: - ! Increment the crop year, if appropriate - ! - ! This routine should be called every time step - ! - ! !USES: - use clm_time_manager , only : get_curr_date, is_first_step - ! - ! !ARGUMENTS: - class(crop_type) :: this - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - ! - ! !LOCAL VARIABLES: - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) - integer :: fp, p - !----------------------------------------------------------------------- - - call get_curr_date ( kyr, kmo, kda, mcsec) - ! Update nyrs when it's the end of the year (unless it's the very start of the - ! run). This assumes that, if this patch is active at the end of the year, then it was - ! active for the whole year. - if ((kmo == 1 .and. kda == 1 .and. mcsec == 0) .and. .not. is_first_step()) then - do fp = 1, num_pcropp - p = filter_pcropp(fp) - - this%nyrs_crop_active_patch(p) = this%nyrs_crop_active_patch(p) + 1 - end do - end if - - end subroutine CropIncrementYear - - !----------------------------------------------------------------------- - subroutine checkDates( ) - ! - ! !DESCRIPTION: - ! Make sure the dates are compatible. The date given to startup the model - ! and the date on the restart file must be the same although years can be - ! different. The dates need to be checked when the restart file is being - ! read in for a startup or branch case (they are NOT allowed to be different - ! for a restart case). - ! - ! For the prognostic crop model the date of planting is tracked and growing - ! degree days is tracked (with a 20 year mean) -- so shifting the start dates - ! messes up these bits of saved information. - ! - ! !ARGUMENTS: - use clm_time_manager, only : get_driver_start_ymd, get_start_date - use clm_varctl , only : iulog - use clm_varctl , only : nsrest, nsrBranch, nsrStartup - ! - ! !LOCAL VARIABLES: - integer :: stymd ! Start date YYYYMMDD from driver - integer :: styr ! Start year from driver - integer :: stmon_day ! Start date MMDD from driver - integer :: rsmon_day ! Restart date MMDD from restart file - integer :: rsyr ! Restart year from restart file - integer :: rsmon ! Restart month from restart file - integer :: rsday ! Restart day from restart file - integer :: tod ! Restart time of day from restart file - character(len=*), parameter :: formDate = '(A,i4.4,"/",i2.2,"/",i2.2)' ! log output format - character(len=32) :: subname = 'CropRest::checkDates' - !----------------------------------------------------------------------- - ! - ! If branch or startup make sure the startdate is compatible with the date - ! on the restart file. - ! - if ( nsrest == nsrBranch .or. nsrest == nsrStartup )then - stymd = get_driver_start_ymd() - styr = stymd / 10000 - stmon_day = stymd - styr*10000 - call get_start_date( rsyr, rsmon, rsday, tod ) - rsmon_day = rsmon*100 + rsday - if ( masterproc ) & - write(iulog,formDate) 'Date on the restart file is: ', rsyr, rsmon, rsday - if ( stmon_day /= rsmon_day )then - write(iulog,formDate) 'Start date is: ', styr, stmon_day/100, & - (stmon_day - stmon_day/100) - call endrun(msg=' ERROR: For prognostic crop to work correctly, the start date (month and day)'// & - ' and the date on the restart file needs to match (years can be different)'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine checkDates - -end module CropType - diff --git a/src/biogeochem/DUSTMod.F90 b/src/biogeochem/DUSTMod.F90 deleted file mode 100644 index ad2e5bf6a9..0000000000 --- a/src/biogeochem/DUSTMod.F90 +++ /dev/null @@ -1,925 +0,0 @@ -module DUSTMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Routines in this module calculate Dust mobilization and dry deposition for dust. - ! Simulates dust mobilization due to wind from the surface into the - ! lowest atmospheric layer. On output flx_mss_vrt_dst(ndst) is the surface dust - ! emission (kg/m**2/s) [ + = to atm]. - ! Calculates the turbulent component of dust dry deposition, (the turbulent deposition - ! velocity through the lowest atmospheric layer). CAM will calculate the settling - ! velocity through the whole atmospheric column. The two calculations will determine - ! the dust dry deposition flux to the surface. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : dst_src_nbr, ndst, sz_nbr - use clm_varcon , only : grav, spval - use landunit_varcon , only : istcrop, istsoil - use clm_varctl , only : iulog - use abortutils , only : endrun - use subgridAveMod , only : p2l_1d - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use WaterstateType , only : waterstate_type - use FrictionVelocityMod , only : frictionvel_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - ! - public DustEmission ! Dust mobilization - public DustDryDep ! Turbulent dry deposition for dust - ! - ! !PUBLIC DATA: - ! - real(r8) , allocatable :: ovr_src_snk_mss(:,:) - real(r8) , allocatable :: dmt_vwr(:) ![m] Mass-weighted mean diameter resolved - real(r8) , allocatable :: stk_crc(:) ![frc] Correction to Stokes settling velocity - real(r8) tmp1 !Factor in saltation computation (named as in Charlie's code) - real(r8) dns_aer ![kg m-3] Aerosol density - ! - ! !PUBLIC DATA TYPES: - ! - type, public :: dust_type - - real(r8), pointer, PUBLIC :: flx_mss_vrt_dst_patch (:,:) ! surface dust emission (kg/m**2/s) [ + = to atm] (ndst) - real(r8), pointer, private :: flx_mss_vrt_dst_tot_patch (:) ! total dust flux into atmosphere - real(r8), pointer, private :: vlc_trb_patch (:,:) ! turbulent deposition velocity (m/s) (ndst) - real(r8), pointer, private :: vlc_trb_1_patch (:) ! turbulent deposition velocity 1(m/s) - real(r8), pointer, private :: vlc_trb_2_patch (:) ! turbulent deposition velocity 2(m/s) - real(r8), pointer, private :: vlc_trb_3_patch (:) ! turbulent deposition velocity 3(m/s) - real(r8), pointer, private :: vlc_trb_4_patch (:) ! turbulent deposition velocity 4(m/s) - real(r8), pointer, private :: mbl_bsn_fct_col (:) ! basin factor - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - procedure , private :: InitDustVars ! Initialize variables used in subroutine Dust - - end type dust_type - !------------------------------------------------------------------------ - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(dust_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - call this%InitDustVars (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - !------------------------------------------------------------------------ - - begp = bounds%begp ; endp = bounds%endp - begc = bounds%begc ; endc = bounds%endc - - allocate(this%flx_mss_vrt_dst_patch (begp:endp,1:ndst)) ; this%flx_mss_vrt_dst_patch (:,:) = nan - allocate(this%flx_mss_vrt_dst_tot_patch (begp:endp)) ; this%flx_mss_vrt_dst_tot_patch (:) = nan - allocate(this%vlc_trb_patch (begp:endp,1:ndst)) ; this%vlc_trb_patch (:,:) = nan - allocate(this%vlc_trb_1_patch (begp:endp)) ; this%vlc_trb_1_patch (:) = nan - allocate(this%vlc_trb_2_patch (begp:endp)) ; this%vlc_trb_2_patch (:) = nan - allocate(this%vlc_trb_3_patch (begp:endp)) ; this%vlc_trb_3_patch (:) = nan - allocate(this%vlc_trb_4_patch (begp:endp)) ; this%vlc_trb_4_patch (:) = nan - allocate(this%mbl_bsn_fct_col (begc:endc)) ; this%mbl_bsn_fct_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! - ! !ARGUMENTS: - class (dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - - this%flx_mss_vrt_dst_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='DSTFLXT', units='kg/m2/s', & - avgflag='A', long_name='total surface dust emission', & - ptr_patch=this%flx_mss_vrt_dst_tot_patch, set_lake=0._r8, set_urb=0._r8) - - this%vlc_trb_1_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB1', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 1', & - ptr_patch=this%vlc_trb_1_patch, default='inactive') - - this%vlc_trb_2_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB2', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 2', & - ptr_patch=this%vlc_trb_2_patch, default='inactive') - - this%vlc_trb_3_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB3', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 3', & - ptr_patch=this%vlc_trb_3_patch, default='inactive') - - this%vlc_trb_4_patch(begp:endp) = spval - call hist_addfld1d (fname='DPVLTRB4', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 4', & - ptr_patch=this%vlc_trb_4_patch, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class (dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l - !----------------------------------------------------------------------- - - ! Set basin factor to 1 for now - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (.not.lun%lakpoi(l)) then - this%mbl_bsn_fct_col(c) = 1.0_r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine DustEmission (bounds, & - num_nolakep, filter_nolakep, & - atm2lnd_inst, soilstate_inst, canopystate_inst, waterstate_inst, & - frictionvel_inst, dust_inst) - ! - ! !DESCRIPTION: - ! Dust mobilization. This code simulates dust mobilization due to wind - ! from the surface into the lowest atmospheric layer - ! On output flx_mss_vrt_dst(ndst) is the surface dust emission - ! (kg/m**2/s) [ + = to atm] - ! Source: C. Zender's dust model - ! - ! !USES - use shr_const_mod, only : SHR_CONST_RHOFW - use subgridaveMod, only : p2g - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter - integer , intent(in) :: filter_nolakep(num_nolakep) ! patch filter for non-lake points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(dust_type) , intent(inout) :: dust_inst - - ! - ! !LOCAL VARIABLES - integer :: fp,p,c,l,g,m,n ! indices - real(r8) :: liqfrac ! fraction of total water that is liquid - real(r8) :: wnd_frc_rat ! [frc] Wind friction threshold over wind friction - real(r8) :: wnd_frc_slt_dlt ! [m s-1] Friction velocity increase from saltatn - real(r8) :: wnd_rfr_dlt ! [m s-1] Reference windspeed excess over threshld - real(r8) :: dst_slt_flx_rat_ttl - real(r8) :: flx_mss_hrz_slt_ttl - real(r8) :: flx_mss_vrt_dst_ttl(bounds%begp:bounds%endp) - real(r8) :: frc_thr_wet_fct - real(r8) :: frc_thr_rgh_fct - real(r8) :: wnd_frc_thr_slt - real(r8) :: wnd_rfr_thr_slt - real(r8) :: wnd_frc_slt - real(r8) :: lnd_frc_mbl(bounds%begp:bounds%endp) - real(r8) :: bd - real(r8) :: gwc_sfc - real(r8) :: ttlai(bounds%begp:bounds%endp) - real(r8) :: tlai_lu(bounds%begl:bounds%endl) - real(r8) :: sumwt(bounds%begl:bounds%endl) ! sum of weights - logical :: found ! temporary for error check - integer :: index - ! - ! constants - ! - real(r8), parameter :: cst_slt = 2.61_r8 ! [frc] Saltation constant - real(r8), parameter :: flx_mss_fdg_fct = 5.0e-4_r8 ! [frc] Empir. mass flx tuning eflx_lh_vegt - real(r8), parameter :: vai_mbl_thr = 0.3_r8 ! [m2 m-2] VAI threshold quenching dust mobilization - !------------------------------------------------------------------------ - - associate( & - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] downscaled density (kg/m**3) - - gwc_thr => soilstate_inst%gwc_thr_col , & ! Input: [real(r8) (:) ] threshold gravimetric soil moisture based on clay content - mss_frc_cly_vld => soilstate_inst%mss_frc_cly_vld_col , & ! Input: [real(r8) (:) ] [frc] Mass fraction clay limited to 0.20 - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] saturated volumetric soil water - - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index, no burying by snow - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid soil water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] frozen soil water (kg/m2) - - fv => frictionvel_inst%fv_patch , & ! Input: [real(r8) (:) ] friction velocity (m/s) (for dust model) - u10 => frictionvel_inst%u10_patch , & ! Input: [real(r8) (:) ] 10-m wind (m/s) (created for dust model) - - mbl_bsn_fct => dust_inst%mbl_bsn_fct_col , & ! Input: [real(r8) (:) ] basin factor - flx_mss_vrt_dst => dust_inst%flx_mss_vrt_dst_patch , & ! Output: [real(r8) (:,:) ] surface dust emission (kg/m**2/s) - flx_mss_vrt_dst_tot => dust_inst%flx_mss_vrt_dst_tot_patch & ! Output: [real(r8) (:) ] total dust flux back to atmosphere (pft) - ) - - ttlai(bounds%begp : bounds%endp) = 0._r8 - ! make lai average at landunit level - do fp = 1,num_nolakep - p = filter_nolakep(fp) - ttlai(p) = tlai(p)+tsai(p) - enddo - - tlai_lu(bounds%begl : bounds%endl) = spval - sumwt(bounds%begl : bounds%endl) = 0._r8 - do p = bounds%begp,bounds%endp - if (ttlai(p) /= spval .and. patch%active(p) .and. patch%wtlunit(p) /= 0._r8) then - c = patch%column(p) - l = patch%landunit(p) - if (sumwt(l) == 0._r8) tlai_lu(l) = 0._r8 - tlai_lu(l) = tlai_lu(l) + ttlai(p) * patch%wtlunit(p) - sumwt(l) = sumwt(l) + patch%wtlunit(p) - end if - end do - found = .false. - do l = bounds%begl,bounds%endl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - exit - else if (sumwt(l) /= 0._r8) then - tlai_lu(l) = tlai_lu(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*) 'p2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Loop through patches - - ! initialize variables which get passed to the atmosphere - flx_mss_vrt_dst(bounds%begp:bounds%endp,:)=0._r8 - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - l = patch%landunit(p) - - ! the following code from subr. lnd_frc_mbl_get was adapted for lsm use - ! purpose: return fraction of each gridcell suitable for dust mobilization - - ! the "bare ground" fraction of the current sub-gridscale cell decreases - ! linearly from 1 to 0 as VAI(=tlai+tsai) increases from 0 to vai_mbl_thr - ! if ice sheet, wetland, or lake, no dust allowed - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (tlai_lu(l) < vai_mbl_thr) then - lnd_frc_mbl(p) = 1.0_r8 - (tlai_lu(l))/vai_mbl_thr - else - lnd_frc_mbl(p) = 0.0_r8 - endif - lnd_frc_mbl(p) = lnd_frc_mbl(p) * (1.0_r8 - frac_sno(c)) - else - lnd_frc_mbl(p) = 0.0_r8 - end if - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p)>1.0_r8 .or. lnd_frc_mbl(p)<0.0_r8) then - write(iulog,*)'Error dstmbl: pft= ',p,' lnd_frc_mbl(p)= ',lnd_frc_mbl(p) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end do - - ! reset history output variables before next if-statement to avoid output = inf - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - flx_mss_vrt_dst_tot(p) = 0.0_r8 - end do - do n = 1, ndst - do fp = 1,num_nolakep - p = filter_nolakep(fp) - flx_mss_vrt_dst(p,n) = 0.0_r8 - end do - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - - ! only perform the following calculations if lnd_frc_mbl is non-zero - - if (lnd_frc_mbl(p) > 0.0_r8) then - - ! the following comes from subr. frc_thr_rgh_fct_get - ! purpose: compute factor by which surface roughness increases threshold - ! friction velocity (currently a constant) - - frc_thr_rgh_fct = 1.0_r8 - - ! the following comes from subr. frc_thr_wet_fct_get - ! purpose: compute factor by which soil moisture increases threshold friction velocity - ! adjust threshold velocity for inhibition by moisture - ! modified 4/5/2002 (slevis) to use gravimetric instead of volumetric - ! water content - - bd = (1._r8-watsat(c,1))*2.7e3_r8 ![kg m-3] Bulk density of dry surface soil - gwc_sfc = h2osoi_vol(c,1)*SHR_CONST_RHOFW/bd ![kg kg-1] Gravimetric H2O cont - if (gwc_sfc > gwc_thr(c)) then - frc_thr_wet_fct = sqrt(1.0_r8 + 1.21_r8 * (100.0_r8*(gwc_sfc - gwc_thr(c)))**0.68_r8) - else - frc_thr_wet_fct = 1.0_r8 - end if - - ! slevis: adding liqfrac here, because related to effects from soil water - - liqfrac = max( 0.0_r8, min( 1.0_r8, h2osoi_liq(c,1) / (h2osoi_ice(c,1)+h2osoi_liq(c,1)+1.0e-6_r8) ) ) - - ! the following lines come from subr. dst_mbl - ! purpose: adjust threshold friction velocity to acct for moisture and - ! roughness. The ratio tmp1 / sqrt(forc_rho) comes from - ! subr. wnd_frc_thr_slt_get which computes dry threshold - ! friction velocity for saltation - - wnd_frc_thr_slt = tmp1 / sqrt(forc_rho(c)) * frc_thr_wet_fct * frc_thr_rgh_fct - - ! reset these variables which will be updated in the following if-block - - wnd_frc_slt = fv(p) - flx_mss_hrz_slt_ttl = 0.0_r8 - flx_mss_vrt_dst_ttl(p) = 0.0_r8 - - ! the following line comes from subr. dst_mbl - ! purpose: threshold saltation wind speed - - wnd_rfr_thr_slt = u10(p) * wnd_frc_thr_slt / fv(p) - - ! the following if-block comes from subr. wnd_frc_slt_get - ! purpose: compute the saltating friction velocity - ! theory: saltation roughens the boundary layer, AKA "Owen's effect" - - if (u10(p) >= wnd_rfr_thr_slt) then - wnd_rfr_dlt = u10(p) - wnd_rfr_thr_slt - wnd_frc_slt_dlt = 0.003_r8 * wnd_rfr_dlt * wnd_rfr_dlt - wnd_frc_slt = fv(p) + wnd_frc_slt_dlt - end if - - ! the following comes from subr. flx_mss_hrz_slt_ttl_Whi79_get - ! purpose: compute vertically integrated streamwise mass flux of particles - - if (wnd_frc_slt > wnd_frc_thr_slt) then - wnd_frc_rat = wnd_frc_thr_slt / wnd_frc_slt - flx_mss_hrz_slt_ttl = cst_slt * forc_rho(c) * (wnd_frc_slt**3.0_r8) * & - (1.0_r8 - wnd_frc_rat) * (1.0_r8 + wnd_frc_rat) * (1.0_r8 + wnd_frc_rat) / grav - - ! the following loop originates from subr. dst_mbl - ! purpose: apply land sfc and veg limitations and global tuning factor - ! slevis: multiply flx_mss_hrz_slt_ttl by liqfrac to incude the effect - ! of frozen soil - - flx_mss_hrz_slt_ttl = flx_mss_hrz_slt_ttl * lnd_frc_mbl(p) * mbl_bsn_fct(c) * & - flx_mss_fdg_fct * liqfrac - end if - - ! the following comes from subr. flx_mss_vrt_dst_ttl_MaB95_get - ! purpose: diagnose total vertical mass flux of dust from vertically - ! integrated streamwise mass flux - - dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) - flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl - - end if ! lnd_frc_mbl > 0.0 - - end do - - ! the following comes from subr. flx_mss_vrt_dst_prt in C. Zender's code - ! purpose: partition total vertical mass flux of dust into transport bins - - do n = 1, ndst - do m = 1, dst_src_nbr - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p) > 0.0_r8) then - flx_mss_vrt_dst(p,n) = flx_mss_vrt_dst(p,n) + ovr_src_snk_mss(m,n) * flx_mss_vrt_dst_ttl(p) - end if - end do - end do - end do - - do n = 1, ndst - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p) > 0.0_r8) then - flx_mss_vrt_dst_tot(p) = flx_mss_vrt_dst_tot(p) + flx_mss_vrt_dst(p,n) - end if - end do - end do - - end associate - - end subroutine DustEmission - - !------------------------------------------------------------------------ - subroutine DustDryDep (bounds, & - atm2lnd_inst, frictionvel_inst, dust_inst) - ! - ! !DESCRIPTION: - ! - ! Determine Turbulent dry deposition for dust. Calculate the turbulent - ! component of dust dry deposition, (the turbulent deposition velocity - ! through the lowest atmospheric layer. CAM will calculate the settling - ! velocity through the whole atmospheric column. The two calculations - ! will determine the dust dry deposition flux to the surface. - ! Note: Same process should occur over oceans. For the coupled CESM, - ! we may find it more efficient to let CAM calculate the turbulent dep - ! velocity over all surfaces. This would require passing the - ! aerodynamic resistance, ram(1), and the friction velocity, fv, from - ! the land to the atmosphere component. In that case, dustini need not - ! calculate particle diamter (dmt_vwr) and particle density (dns_aer). - ! Source: C. Zender's dry deposition code - ! - ! !USES - use shr_const_mod, only : SHR_CONST_PI, SHR_CONST_RDAIR, SHR_CONST_BOLTZ - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(dust_type) , intent(inout) :: dust_inst - ! - ! !LOCAL VARIABLES - integer :: p,c,g,m,n ! indices - real(r8) :: vsc_dyn_atm(bounds%begp:bounds%endp) ! [kg m-1 s-1] Dynamic viscosity of air - real(r8) :: vsc_knm_atm(bounds%begp:bounds%endp) ! [m2 s-1] Kinematic viscosity of atmosphere - real(r8) :: shm_nbr_xpn ! [frc] Sfc-dep exponent for aerosol-diffusion dependence on Schmidt number - real(r8) :: shm_nbr ! [frc] Schmidt number - real(r8) :: stk_nbr ! [frc] Stokes number - real(r8) :: mfp_atm ! [m] Mean free path of air - real(r8) :: dff_aer ! [m2 s-1] Brownian diffusivity of particle - real(r8) :: rss_trb ! [s m-1] Resistance to turbulent deposition - real(r8) :: slp_crc(bounds%begp:bounds%endp,ndst) ! [frc] Slip correction factor - real(r8) :: vlc_grv(bounds%begp:bounds%endp,ndst) ! [m s-1] Settling velocity - real(r8) :: rss_lmn(bounds%begp:bounds%endp,ndst) ! [s m-1] Quasi-laminar layer resistance - real(r8) :: tmp ! temporary - real(r8), parameter::shm_nbr_xpn_lnd=-2._r8/3._r8 ![frc] shm_nbr_xpn over land - !------------------------------------------------------------------------ - - associate( & - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atm pressure (Pa) - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] atm density (kg/m**3) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atm temperature (K) - - ram1 => frictionvel_inst%ram1_patch , & ! Input: [real(r8) (:) ] aerodynamical resistance (s/m) - fv => frictionvel_inst%fv_patch , & ! Input: [real(r8) (:) ] friction velocity (m/s) - - vlc_trb => dust_inst%vlc_trb_patch , & ! Output: [real(r8) (:,:) ] Turbulent deposn velocity (m/s) - vlc_trb_1 => dust_inst%vlc_trb_1_patch , & ! Output: [real(r8) (:) ] Turbulent deposition velocity 1 - vlc_trb_2 => dust_inst%vlc_trb_2_patch , & ! Output: [real(r8) (:) ] Turbulent deposition velocity 2 - vlc_trb_3 => dust_inst%vlc_trb_3_patch , & ! Output: [real(r8) (:) ] Turbulent deposition velocity 3 - vlc_trb_4 => dust_inst%vlc_trb_4_patch & ! Output: [real(r8) (:) ] Turbulent deposition velocity 4 - ) - - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - g = patch%gridcell(p) - c = patch%column(p) - - ! from subroutine dst_dps_dry (consider adding sanity checks from line 212) - ! when code asks to use midlayer density, pressure, temperature, - ! I use the data coming in from the atmosphere, ie forc_t, forc_pbot, forc_rho - - ! Quasi-laminar layer resistance: call rss_lmn_get - ! Size-independent thermokinetic properties - - vsc_dyn_atm(p) = 1.72e-5_r8 * ((forc_t(c)/273.0_r8)**1.5_r8) * 393.0_r8 / & - (forc_t(c)+120.0_r8) ![kg m-1 s-1] RoY94 p. 102 - mfp_atm = 2.0_r8 * vsc_dyn_atm(p) / & ![m] SeP97 p. 455 - (forc_pbot(c)*sqrt(8.0_r8/(SHR_CONST_PI*SHR_CONST_RDAIR*forc_t(c)))) - vsc_knm_atm(p) = vsc_dyn_atm(p) / forc_rho(c) ![m2 s-1] Kinematic viscosity of air - - do m = 1, ndst - slp_crc(p,m) = 1.0_r8 + 2.0_r8 * mfp_atm * & - (1.257_r8+0.4_r8*exp(-1.1_r8*dmt_vwr(m)/(2.0_r8*mfp_atm))) / & - dmt_vwr(m) ![frc] Slip correction factor SeP97 p. 464 - vlc_grv(p,m) = (1.0_r8/18.0_r8) * dmt_vwr(m) * dmt_vwr(m) * dns_aer * & - grav * slp_crc(p,m) / vsc_dyn_atm(p) ![m s-1] Stokes' settling velocity SeP97 p. 466 - vlc_grv(p,m) = vlc_grv(p,m) * stk_crc(m) ![m s-1] Correction to Stokes settling velocity - end do - end if - end do - - do m = 1, ndst - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - g = patch%gridcell(p) - c = patch%column(p) - - stk_nbr = vlc_grv(p,m) * fv(p) * fv(p) / (grav * vsc_knm_atm(p)) ![frc] SeP97 p.965 - dff_aer = SHR_CONST_BOLTZ * forc_t(c) * slp_crc(p,m) / & ![m2 s-1] - (3.0_r8*SHR_CONST_PI * vsc_dyn_atm(p) * dmt_vwr(m)) !SeP97 p.474 - shm_nbr = vsc_knm_atm(p) / dff_aer ![frc] SeP97 p.972 - shm_nbr_xpn = shm_nbr_xpn_lnd ![frc] - - ! fxm: Turning this on dramatically reduces - ! deposition velocity in low wind regimes - ! Schmidt number exponent is -2/3 over solid surfaces and - ! -1/2 over liquid surfaces SlS80 p. 1014 - ! if (oro(i)==0.0) shm_nbr_xpn=shm_nbr_xpn_ocn else shm_nbr_xpn=shm_nbr_xpn_lnd - ! [frc] Surface-dependent exponent for aerosol-diffusion dependence on Schmidt # - - tmp = shm_nbr**shm_nbr_xpn + 10.0_r8**(-3.0_r8/stk_nbr) - rss_lmn(p,m) = 1.0_r8 / (tmp * fv(p)) ![s m-1] SeP97 p.972,965 - end if - end do - end do - - ! Lowest layer: Turbulent deposition (CAM will calc. gravitational dep) - - do m = 1, ndst - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - rss_trb = ram1(p) + rss_lmn(p,m) + ram1(p) * rss_lmn(p,m) * vlc_grv(p,m) ![s m-1] - vlc_trb(p,m) = 1.0_r8 / rss_trb ![m s-1] - end if - end do - end do - - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - vlc_trb_1(p) = vlc_trb(p,1) - vlc_trb_2(p) = vlc_trb(p,2) - vlc_trb_3(p) = vlc_trb(p,3) - vlc_trb_4(p) = vlc_trb(p,4) - end if - end do - - end associate - - end subroutine DustDryDep - - !------------------------------------------------------------------------ - subroutine InitDustVars(this, bounds) - ! - ! !DESCRIPTION: - ! - ! Compute source efficiency factor from topography - ! Initialize other variables used in subroutine Dust: - ! ovr_src_snk_mss(m,n) and tmp1. - ! Define particle diameter and density needed by atm model - ! as well as by dry dep model - ! Source: Paul Ginoux (for source efficiency factor) - ! Modifications by C. Zender and later by S. Levis - ! Rest of subroutine from C. Zender's dust model - ! - ! !USES - use shr_const_mod , only: SHR_CONST_PI, SHR_CONST_RDAIR - use shr_spfn_mod , only: erf => shr_spfn_erf - use decompMod , only : get_proc_bounds - ! - ! !ARGUMENTS: - class(dust_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES - integer :: fc,c,l,m,n ! indices - real(r8) :: ovr_src_snk_frc - real(r8) :: sqrt2lngsdi ! [frc] Factor in erf argument - real(r8) :: lndmaxjovrdmdni ! [frc] Factor in erf argument - real(r8) :: lndminjovrdmdni ! [frc] Factor in erf argument - real(r8) :: ryn_nbr_frc_thr_prx_opt ! [frc] Threshold friction Reynolds number approximation for optimal size - real(r8) :: ryn_nbr_frc_thr_opt_fnc ! [frc] Threshold friction Reynolds factor for saltation calculation - real(r8) :: icf_fct ! Interpartical cohesive forces factor for saltation calc - real(r8) :: dns_fct ! Density ratio factor for saltation calculation - real(r8) :: dmt_min(ndst) ! [m] Size grid minimum - real(r8) :: dmt_max(ndst) ! [m] Size grid maximum - real(r8) :: dmt_ctr(ndst) ! [m] Diameter at bin center - real(r8) :: dmt_dlt(ndst) ! [m] Width of size bin - real(r8) :: slp_crc(ndst) ! [frc] Slip correction factor - real(r8) :: vlm_rsl(ndst) ! [m3 m-3] Volume concentration resolved - real(r8) :: vlc_stk(ndst) ! [m s-1] Stokes settling velocity - real(r8) :: vlc_grv(ndst) ! [m s-1] Settling velocity - real(r8) :: ryn_nbr_grv(ndst) ! [frc] Reynolds number at terminal velocity - real(r8) :: cff_drg_grv(ndst) ! [frc] Drag coefficient at terminal velocity - real(r8) :: tmp ! temporary - real(r8) :: ln_gsd ! [frc] ln(gsd) - real(r8) :: gsd_anl ! [frc] Geometric standard deviation - real(r8) :: dmt_vma ! [m] Mass median diameter analytic She84 p.75 Tabl.1 - real(r8) :: dmt_nma ! [m] Number median particle diameter - real(r8) :: lgn_dst ! Lognormal distribution at sz_ctr - real(r8) :: eps_max ! [frc] Relative accuracy for convergence - real(r8) :: eps_crr ! [frc] Current relative accuracy - real(r8) :: itr_idx ! [idx] Counting index - real(r8) :: dns_mdp ! [kg m-3] Midlayer density - real(r8) :: mfp_atm ! [m] Mean free path of air - real(r8) :: vsc_dyn_atm ! [kg m-1 s-1] Dynamic viscosity of air - real(r8) :: vsc_knm_atm ! [kg m-1 s-1] Kinematic viscosity of air - real(r8) :: vlc_grv_old ! [m s-1] Previous gravitational settling velocity - real(r8) :: series_ratio ! Factor for logarithmic grid - real(r8) :: lngsdsqrttwopi_rcp ! Factor in lognormal distribution - real(r8) :: sz_min(sz_nbr) ! [m] Size Bin minima - real(r8) :: sz_max(sz_nbr) ! [m] Size Bin maxima - real(r8) :: sz_ctr(sz_nbr) ! [m] Size Bin centers - real(r8) :: sz_dlt(sz_nbr) ! [m] Size Bin widths - - ! constants - real(r8), allocatable :: dmt_vma_src(:) ! [m] Mass median diameter BSM96 p. 73 Table 2 - real(r8), allocatable :: gsd_anl_src(:) ! [frc] Geometric std deviation BSM96 p. 73 Table 2 - real(r8), allocatable :: mss_frc_src(:) ! [frc] Mass fraction BSM96 p. 73 Table 2 - - real(r8) :: dmt_grd(5) = & ! [m] Particle diameter grid - (/ 0.1e-6_r8, 1.0e-6_r8, 2.5e-6_r8, 5.0e-6_r8, 10.0e-6_r8 /) - real(r8), parameter :: dmt_slt_opt = 75.0e-6_r8 ! [m] Optim diam for saltation - real(r8), parameter :: dns_slt = 2650.0_r8 ! [kg m-3] Density of optimal saltation particles - !------------------------------------------------------------------------ - - associate(& - mbl_bsn_fct => this%mbl_bsn_fct_col & ! Output: [real(r8) (:)] basin factor - ) - - ! allocate module variable - allocate (ovr_src_snk_mss(dst_src_nbr,ndst)) - allocate (dmt_vwr(ndst)) - allocate (stk_crc(ndst)) - - ! allocate local variable - allocate (dmt_vma_src(dst_src_nbr)) - allocate (gsd_anl_src(dst_src_nbr)) - allocate (mss_frc_src(dst_src_nbr)) - - dmt_vma_src(:) = (/ 0.832e-6_r8 , 4.82e-6_r8 , 19.38e-6_r8 /) - gsd_anl_src(:) = (/ 2.10_r8 , 1.90_r8 , 1.60_r8 /) - mss_frc_src(:) = (/ 0.036_r8 , 0.957_r8 , 0.007_r8 /) - - ! the following comes from (1) szdstlgn.F subroutine ovr_src_snk_frc_get - ! and (2) dstszdst.F subroutine dst_szdst_ini - ! purpose(1): given one set (the "source") of lognormal distributions, - ! and one set of bin boundaries (the "sink"), compute and return - ! the overlap factors between the source and sink distributions - ! purpose(2): set important statistics of size distributions - - do m = 1, dst_src_nbr - sqrt2lngsdi = sqrt(2.0_r8) * log(gsd_anl_src(m)) - do n = 1, ndst - lndmaxjovrdmdni = log(dmt_grd(n+1)/dmt_vma_src(m)) - lndminjovrdmdni = log(dmt_grd(n )/dmt_vma_src(m)) - ovr_src_snk_frc = 0.5_r8 * (erf(lndmaxjovrdmdni/sqrt2lngsdi) - & - erf(lndminjovrdmdni/sqrt2lngsdi)) - ovr_src_snk_mss(m,n) = ovr_src_snk_frc * mss_frc_src(m) - end do - end do - - ! The following code from subroutine wnd_frc_thr_slt_get was placed - ! here because tmp1 needs to be defined just once - - ryn_nbr_frc_thr_prx_opt = 0.38_r8 + 1331.0_r8 * (100.0_r8*dmt_slt_opt)**1.56_r8 - - if (ryn_nbr_frc_thr_prx_opt < 0.03_r8) then - write(iulog,*) 'dstmbl: ryn_nbr_frc_thr_prx_opt < 0.03' - call endrun(msg=errMsg(sourcefile, __LINE__)) - else if (ryn_nbr_frc_thr_prx_opt < 10.0_r8) then - ryn_nbr_frc_thr_opt_fnc = -1.0_r8 + 1.928_r8 * (ryn_nbr_frc_thr_prx_opt**0.0922_r8) - ryn_nbr_frc_thr_opt_fnc = 0.1291_r8 * 0.1291_r8 / ryn_nbr_frc_thr_opt_fnc - else - ryn_nbr_frc_thr_opt_fnc = 1.0_r8 - 0.0858_r8 * exp(-0.0617_r8*(ryn_nbr_frc_thr_prx_opt-10.0_r8)) - ryn_nbr_frc_thr_opt_fnc = 0.120_r8 * 0.120_r8 * ryn_nbr_frc_thr_opt_fnc * ryn_nbr_frc_thr_opt_fnc - end if - - icf_fct = 1.0_r8 + 6.0e-07_r8 / (dns_slt * grav * (dmt_slt_opt**2.5_r8)) - dns_fct = dns_slt * grav * dmt_slt_opt - tmp1 = sqrt(icf_fct * dns_fct * ryn_nbr_frc_thr_opt_fnc) - - ! Introducing particle diameter. Needed by atm model and by dry dep model. - ! Taken from Charlie Zender's subroutines dst_psd_ini, dst_sz_rsl, - ! grd_mk (dstpsd.F90) and subroutine lgn_evl (psdlgn.F90) - - ! Charlie allows logarithmic or linear option for size distribution - ! however, he hardwires the distribution to logarithmic in his code - ! therefore, I take his logarithmic code only - ! furthermore, if dst_nbr == 4, he overrides the automatic grid calculation - ! he currently works with dst_nbr = 4, so I only take the relevant code - ! if ndst ever becomes different from 4, must add call grd_mk (dstpsd.F90) - ! as done in subroutine dst_psd_ini - ! note that here ndst = dst_nbr - - ! Override automatic grid with preset grid if available - - if (ndst == 4) then - do n = 1, ndst - dmt_min(n) = dmt_grd(n) ![m] Max diameter in bin - dmt_max(n) = dmt_grd(n+1) ![m] Min diameter in bin - dmt_ctr(n) = 0.5_r8 * (dmt_min(n)+dmt_max(n)) ![m] Diameter at bin ctr - dmt_dlt(n) = dmt_max(n)-dmt_min(n) ![m] Width of size bin - end do - else - write(iulog,*) 'Dustini error: ndst must equal to 4 with current code' - call endrun(msg=errMsg(sourcefile, __LINE__)) - !see more comments above end if ndst == 4 - end if - - ! Bin physical properties - - gsd_anl = 2.0_r8 ! [frc] Geometric std dev PaG77 p. 2080 Table1 - ln_gsd = log(gsd_anl) - dns_aer = 2.5e+3_r8 ! [kg m-3] Aerosol density - - ! Set a fundamental statistic for each bin - - dmt_vma = 3.5000e-6_r8 ! [m] Mass median diameter analytic She84 p.75 Table1 - - ! Compute analytic size statistics - ! Convert mass median diameter to number median diameter (call vma2nma) - - dmt_nma = dmt_vma * exp(-3.0_r8*ln_gsd*ln_gsd) ! [m] - - ! Compute resolved size statistics for each size distribution - ! In C. Zender's code call dst_sz_rsl - - do n = 1, ndst - - series_ratio = (dmt_max(n)/dmt_min(n))**(1.0_r8/sz_nbr) - sz_min(1) = dmt_min(n) - do m = 2, sz_nbr ! Loop starts at 2 - sz_min(m) = sz_min(m-1) * series_ratio - end do - - ! Derived grid values - do m = 1, sz_nbr-1 ! Loop ends at sz_nbr-1 - sz_max(m) = sz_min(m+1) ! [m] - end do - sz_max(sz_nbr) = dmt_max(n) ! [m] - - ! Final derived grid values - do m = 1, sz_nbr - sz_ctr(m) = 0.5_r8 * (sz_min(m)+sz_max(m)) - sz_dlt(m) = sz_max(m)-sz_min(m) - end do - - lngsdsqrttwopi_rcp = 1.0_r8 / (ln_gsd*sqrt(2.0_r8*SHR_CONST_PI)) - dmt_vwr(n) = 0.0_r8 ! [m] Mass wgted diameter resolved - vlm_rsl(n) = 0.0_r8 ! [m3 m-3] Volume concentration resolved - - do m = 1, sz_nbr - - ! Evaluate lognormal distribution for these sizes (call lgn_evl) - tmp = log(sz_ctr(m)/dmt_nma) / ln_gsd - lgn_dst = lngsdsqrttwopi_rcp * exp(-0.5_r8*tmp*tmp) / sz_ctr(m) - - ! Integrate moments of size distribution - dmt_vwr(n) = dmt_vwr(n) + sz_ctr(m) * & - SHR_CONST_PI / 6.0_r8 * (sz_ctr(m)**3.0_r8) * & ![m3] Volume - lgn_dst * sz_dlt(m) ![# m-3] Number concentrn - vlm_rsl(n) = vlm_rsl(n) + & - SHR_CONST_PI / 6.0_r8 * (sz_ctr(m)**3.0_r8) * & ![m3] Volume - lgn_dst * sz_dlt(m) ![# m-3] Number concentrn - - end do - - dmt_vwr(n) = dmt_vwr(n) / vlm_rsl(n) ![m] Mass weighted diameter resolved - - end do - - ! calculate correction to Stokes' settling velocity (subroutine stk_crc_get) - - eps_max = 1.0e-4_r8 - dns_mdp = 100000._r8 / (295.0_r8*SHR_CONST_RDAIR) ![kg m-3] const prs_mdp & tpt_vrt - - ! Size-independent thermokinetic properties - - vsc_dyn_atm = 1.72e-5_r8 * ((295.0_r8/273.0_r8)**1.5_r8) * 393.0_r8 / & - (295.0_r8+120.0_r8) ![kg m-1 s-1] RoY94 p.102 tpt_mdp=295.0 - mfp_atm = 2.0_r8 * vsc_dyn_atm / & !SeP97 p. 455 constant prs_mdp, tpt_mdp - (100000._r8*sqrt(8.0_r8/(SHR_CONST_PI*SHR_CONST_RDAIR*295.0_r8))) - vsc_knm_atm = vsc_dyn_atm / dns_mdp ![m2 s-1] Kinematic viscosity of air - - do m = 1, ndst - slp_crc(m) = 1.0_r8 + 2.0_r8 * mfp_atm * & - (1.257_r8+0.4_r8*exp(-1.1_r8*dmt_vwr(m)/(2.0_r8*mfp_atm))) / & - dmt_vwr(m) ! [frc] Slip correction factor SeP97 p.464 - vlc_stk(m) = (1.0_r8/18.0_r8) * dmt_vwr(m) * dmt_vwr(m) * dns_aer * & - grav * slp_crc(m) / vsc_dyn_atm ! [m s-1] SeP97 p.466 - end do - - ! For Reynolds number flows Re < 0.1 Stokes' velocity is valid for - ! vlc_grv SeP97 p. 466 (8.42). For larger Re, inertial effects become - ! important and empirical drag coefficients must be employed - ! Implicit equation for Re, Cd, and Vt is SeP97 p. 467 (8.44) - ! Using Stokes' velocity rather than iterative solution with empirical - ! drag coefficient causes 60% errors for D = 200 um SeP97 p. 468 - - ! Iterative solution for drag coefficient, Reynolds number, and terminal veloc - do m = 1, ndst - - ! Initialize accuracy and counter - eps_crr = eps_max + 1.0_r8 ![frc] Current relative accuracy - itr_idx = 0 ![idx] Counting index - - ! Initial guess for vlc_grv is exact for Re < 0.1 - vlc_grv(m) = vlc_stk(m) ![m s-1] - - do while(eps_crr > eps_max) - - ! Save terminal velocity for convergence test - vlc_grv_old = vlc_grv(m) ![m s-1] - ryn_nbr_grv(m) = vlc_grv(m) * dmt_vwr(m) / vsc_knm_atm !SeP97 p.460 - - ! Update drag coefficient based on new Reynolds number - if (ryn_nbr_grv(m) < 0.1_r8) then - cff_drg_grv(m) = 24.0_r8 / ryn_nbr_grv(m) !Stokes' law Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 2.0_r8) then - cff_drg_grv(m) = (24.0_r8/ryn_nbr_grv(m)) * & - (1.0_r8 + 3.0_r8*ryn_nbr_grv(m)/16.0_r8 + & - 9.0_r8*ryn_nbr_grv(m)*ryn_nbr_grv(m)* & - log(2.0_r8*ryn_nbr_grv(m))/160.0_r8) !Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 500.0_r8) then - cff_drg_grv(m) = (24.0_r8/ryn_nbr_grv(m)) * & - (1.0_r8 + 0.15_r8*ryn_nbr_grv(m)**0.687_r8) !Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 2.0e5_r8) then - cff_drg_grv(m) = 0.44_r8 !Sep97 p.463 (8.32) - else - write(iulog,'(a,es9.2)') "ryn_nbr_grv(m) = ",ryn_nbr_grv(m) - write(iulog,*)'Dustini error: Reynolds number too large in stk_crc_get()' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Update terminal velocity based on new Reynolds number and drag coeff - ! [m s-1] Terminal veloc SeP97 p.467 (8.44) - - vlc_grv(m) = sqrt(4.0_r8 * grav * dmt_vwr(m) * slp_crc(m) * dns_aer / & - (3.0_r8*cff_drg_grv(m)*dns_mdp)) - eps_crr = abs((vlc_grv(m)-vlc_grv_old)/vlc_grv(m)) !Relative convergence - if (itr_idx == 12) then - ! Numerical pingpong may occur when Re = 0.1, 2.0, or 500.0 - ! due to discontinuities in derivative of drag coefficient - vlc_grv(m) = 0.5_r8 * (vlc_grv(m)+vlc_grv_old) ! [m s-1] - end if - if (itr_idx > 20) then - write(iulog,*) 'Dustini error: Terminal velocity not converging ',& - ' in stk_crc_get(), breaking loop...' - goto 100 !to next iteration - end if - itr_idx = itr_idx + 1 - - end do !end while - -100 continue !Label to jump to when iteration does not converge - end do !end loop over size - - ! Compute factors to convert Stokes' settling velocities to - ! actual settling velocities - - do m = 1, ndst - stk_crc(m) = vlc_grv(m) / vlc_stk(m) - end do - - end associate - - end subroutine InitDustVars - -end module DUSTMod diff --git a/src/biogeochem/DryDepVelocity.F90 b/src/biogeochem/DryDepVelocity.F90 deleted file mode 100644 index 603e9d24c4..0000000000 --- a/src/biogeochem/DryDepVelocity.F90 +++ /dev/null @@ -1,678 +0,0 @@ -Module DryDepVelocity - - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Deposition velocity (m/s) - ! - ! Method: - ! This code simulates dry deposition velocities using the Wesely scheme. - ! Details of this method can be found in: - ! - ! M.L Wesely. Parameterization of surface resistances to gaseous dry deposition - ! in regional-scale numericl models. 1989. Atmospheric Environment vol.23 No.6 - ! pp. 1293-1304. - ! - ! In Wesely (1998) "the magnitude of the dry deposition velocity can be found - ! as: - ! - ! |vd|=(ra+rb+rc)^-1 - ! - ! where ra is the aerodynamic resistance (common to all gases) between a - ! specific height and the surface, rb is the quasilaminar sublayer resistance - ! (whose only dependence on the porperties of the gas of interest is its - ! molecular diffusivity in air), and rc is the bulk surface resistance". - ! - ! In this subroutine both ra and rb are calculated elsewhere in CLM. - ! - ! In Wesely (1989) rc is estimated for five seasonal categories and 11 landuse - ! types. For each season and landuse type, Wesely compiled data into a - ! look-up-table for several parameters used to calculate rc. In this subroutine - ! the same values are used as found in wesely's look-up-tables, the only - ! difference is that this subroutine uses a CLM generated LAI to select values - ! from the look-up-table instead of seasonality. Inaddition, Wesely(1989) - ! land use types are "mapped" into CLM patch types. - ! - ! Subroutine written to operate at the patch level. - ! - ! Output: - ! - ! vd(n_species) !Dry deposition velocity [m s-1] for each molecule or species - ! - ! Author: Beth Holland and James Sulzman - ! - ! Modified: Francis Vitt -- 30 Mar 2007 - ! Modified: Maria Val Martin -- 15 Jan 2014 - ! Corrected major bugs in the leaf and stomatal resitances. The code is now - ! coupled to LAI and Rs uses the Ball-Berry Scheme. Also, corrected minor - ! bugs in rlu and rcl calculations. Added - ! no vegetation removal for CO. See README for details and - ! Val Martin et al., 2014 GRL for major corrections - ! Modified: Louisa Emmons -- 30 November 2017 - ! Corrected the equation calculating stomatal resistance from rssun and rssha, - ! and removed factor that scaled Rs to match observations - ! - !----------------------------------------------------------------------- - - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_time_manager , only : get_nstep, get_curr_date, get_curr_time - use spmdMod , only : masterproc - use seq_drydep_mod , only : n_drydep, drydep_list - use seq_drydep_mod , only : drydep_method, DD_XLND - use seq_drydep_mod , only : index_o3=>o3_ndx, index_o3a=>o3a_ndx, index_so2=>so2_ndx, index_h2=>h2_ndx - use seq_drydep_mod , only : index_co=>co_ndx, index_ch4=>ch4_ndx, index_pan=>pan_ndx - use seq_drydep_mod , only : index_xpan=>xpan_ndx - use decompMod , only : bounds_type - use clm_varcon , only : namep - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use FrictionVelocityMod , only : frictionvel_type - use PhotosynthesisMod , only : photosyns_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use LandunitType , only : lun - use PatchType , only : patch - ! - implicit none - private - ! - public :: depvel_compute - ! - type, public :: drydepvel_type - - real(r8), pointer, public :: velocity_patch (:,:) ! Dry Deposition Velocity - real(r8), pointer, private :: rs_drydep_patch (:) ! Stomatal resistance associated with dry deposition velocity for Ozone - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - - end type drydepvel_type - !----------------------------------------------------------------------- - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -CONTAINS - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(drydepvel_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - ! - ! !ARGUMENTS: - class(drydepvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - - ! Dry Deposition Velocity - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - allocate(this%velocity_patch(begp:endp, n_drydep)); this%velocity_patch(:,:) = nan - allocate(this%rs_drydep_patch(begp:endp)) ; this%rs_drydep_patch(:) = nan - end if - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize history output fields for dry deposition diagnositics - ! - ! !USES - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d - use seq_drydep_mod , only : mapping - ! - ! !ARGUMENTS: - class(drydepvel_type) :: this - type(bounds_type), intent(in) :: bounds - real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array - ! - ! !LOCAL VARIABLES - integer :: ispec - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - if ( n_drydep == 0 .or. drydep_method /= DD_XLND ) return - - do ispec=1,n_drydep - if(mapping(ispec) <= 0) cycle - - this%velocity_patch(begp:endp,ispec)= spval - ptr_1d => this%velocity_patch(begp:endp,ispec) - call hist_addfld1d ( fname='DRYDEPV_'//trim(drydep_list(ispec)), units='cm/sec', & - avgflag='A', long_name='Dry Deposition Velocity', & - ptr_patch=ptr_1d, default='inactive' ) - end do - - this%rs_drydep_patch(begp:endp)= spval - call hist_addfld1d ( fname='RS_DRYDEP_O3', units='s/m', & - avgflag='A', long_name='Stomatal Resistance Associated with Ozone Dry Deposition Velocity', & - ptr_patch=this%rs_drydep_patch, default='inactive' ) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine depvel_compute( bounds, & - atm2lnd_inst, canopystate_inst, waterstate_inst, frictionvel_inst, & - photosyns_inst, drydepvel_inst) - ! - ! !DESCRIPTION: - ! computes the dry deposition velocity of tracers - ! - ! !USES: - use shr_const_mod , only : tmelt => shr_const_tkfrz - use seq_drydep_mod , only : seq_drydep_setHCoeff, mapping, drat, foxd - use seq_drydep_mod , only : rcls, h2_a, h2_b, h2_c, ri, rac, rclo, rlu, rgss, rgso - use landunit_varcon, only : istsoil, istice_mec, istdlak, istwet - use clm_varctl , only : iulog - use pftconMod , only : noveg, ndllf_evr_tmp_tree, ndllf_evr_brl_tree - use pftconMod , only : ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree - use pftconMod , only : nbrdlf_evr_tmp_tree, nbrdlf_dcd_trp_tree - use pftconMod , only : nbrdlf_dcd_tmp_tree, nbrdlf_dcd_brl_tree - use pftconMod , only : nbrdlf_evr_shrub, nbrdlf_dcd_tmp_shrub - use pftconMod , only : nbrdlf_dcd_brl_shrub,nc3_arctic_grass - use pftconMod , only : nc3_nonarctic_grass, nc4_grass, nc3crop - use pftconMod , only : nc3irrig, npcropmin, npcropmax - use clm_varcon , only : spval - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(drydepvel_type) , intent(inout) :: drydepvel_inst - ! - ! !LOCAL VARIABLES: - integer :: c - real(r8) :: soilw, var_soilw, fact_h2, dv_soil_h2 - integer :: pi,g, l - integer :: ispec - integer :: length - integer :: wesveg !wesely vegegation index - integer :: clmveg !clm veg index from ivegtype - integer :: i - integer :: index_season !seasonal index based on LAI. This indexs wesely data tables - integer :: nstep !current step - integer :: indexp - - real(r8) :: pg ! surface pressure - real(r8) :: tc ! temperature in celsius - real(r8) :: es ! saturation vapor pressur - real(r8) :: ws ! saturation mixing ratio - real(r8) :: rmx ! resistance by vegetation - real(r8) :: qs ! saturation specific humidity - real(r8) :: dewm ! multiplier for rs when dew occurs - real(r8) :: crs ! multiplier to calculate crs - real(r8) :: rdc ! part of lower canopy resistance - real(r8) :: rain ! rain fall - real(r8) :: spec_hum ! specific humidity - real(r8) :: solar_flux ! solar radiation(direct beam) W/m2 - real(r8) :: lat ! latitude in degrees - real(r8) :: lon ! longitude in degrees - real(r8) :: sfc_temp ! surface temp - real(r8) :: minlai ! minimum of monthly lai - real(r8) :: maxlai ! maximum of monthly lai - real(r8) :: rds ! resistance for aerosols - - !mvm 11/30/2013 - real(r8) :: rlu_lai ! constant to calculate rlu over bulk canopy - - logical :: has_dew - logical :: has_rain - real(r8), parameter :: rain_threshold = 1.e-7_r8 ! of the order of 1cm/day expressed in m/s - - ! local arrays: dependent on species only - real(r8), dimension(n_drydep) :: rsmx !vegetative resistance (plant mesophyll) - real(r8), dimension(n_drydep) :: rclx !lower canopy resistance - real(r8), dimension(n_drydep) :: rlux !vegetative resistance (upper canopy) - real(r8), dimension(n_drydep) :: rgsx !gournd resistance - real(r8), dimension(n_drydep) :: heff - real(r8) :: rs ! stomatal resistance associated with dry deposition velocity (s/m) - real(r8) :: rc !combined surface resistance - real(r8) :: cts !correction to flu rcl and rgs for frost - real(r8) :: rlux_o3 !to calculate O3 leaf resistance in dew/rain conditions - - ! constants - real(r8), parameter :: slope = 0._r8 ! Used to calculate rdc in (lower canopy resistance) - integer, parameter :: wveg_unset = -1 ! Unset Wesley vegetation type - character(len=32), parameter :: subname = "depvel_compute" - - ! jfl : mods for PAN - real(r8) :: dv_pan - real(r8) :: c0_pan(11) = (/ 0.000_r8, 0.006_r8, 0.002_r8, 0.009_r8, 0.015_r8, & - 0.006_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.002_r8, 0.002_r8 /) - real(r8) :: k_pan (11) = (/ 0.000_r8, 0.010_r8, 0.005_r8, 0.004_r8, 0.003_r8, & - 0.005_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.075_r8, 0.002_r8 /) - !----------------------------------------------------------------------- - - if ( n_drydep == 0 .or. drydep_method /= DD_XLND ) return - - associate( & - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (visible only) - forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (visible only) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric temperature (Kelvin) - forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric specific humidity (kg/kg) - forc_psrf => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] downscaled surface pressure (Pa) - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] downscaled rain rate [mm/s] - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - - ram1 => frictionvel_inst%ram1_patch , & ! Input: [real(r8) (:) ] aerodynamical resistance - rb1 => frictionvel_inst%rb1_patch , & ! Input: [real(r8) (:) ] leaf boundary layer resistance [s/m] - vds => frictionvel_inst%vds_patch , & ! Input: [real(r8) (:) ] aerodynamical resistance - - rssun => photosyns_inst%rssun_patch , & ! Input: [real(r8) (:) ] stomatal resistance - rssha => photosyns_inst%rssha_patch , & ! Input: [real(r8) (:) ] shaded stomatal resistance (s/m) - - fsun => canopystate_inst%fsun_patch , & ! Input: [real(r8) (:) ] sunlit fraction of canopy - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - mlaidiff => canopystate_inst%mlaidiff_patch , & ! Input: [real(r8) (:) ] difference in lai between month one and month two - annlai => canopystate_inst%annlai_patch , & ! Input: [real(r8) (:,:) ] 12 months of monthly lai from input data set - - velocity => drydepvel_inst%velocity_patch , & ! Output: [real(r8) (:,:) ] cm/sec - rs_drydep => drydepvel_inst%rs_drydep_patch & ! Output: [real(r8) (:) ] stomatal resistance associated with Ozone dry deposition velocity (s/m) - ) - - !_________________________________________________________________ - ! Begin loop through patches - - pft_loop: do pi = bounds%begp,bounds%endp - l = patch%landunit(pi) - - active: if (patch%active(pi)) then - - c = patch%column(pi) - g = patch%gridcell(pi) - pg = forc_psrf(c) - spec_hum = forc_q(c) - rain = forc_rain(c) - sfc_temp = forc_t(c) - solar_flux = forc_solad(g,1) - lat = grc%latdeg(g) - lon = grc%londeg(g) - clmveg = patch%itype(pi) - soilw = h2osoi_vol(c,1) - - !map CLM veg type into Wesely veg type - wesveg = wveg_unset - if (clmveg == noveg ) wesveg = 8 - if (clmveg == ndllf_evr_tmp_tree ) wesveg = 5 - if (clmveg == ndllf_evr_brl_tree ) wesveg = 5 - if (clmveg == ndllf_dcd_brl_tree ) wesveg = 5 - if (clmveg == nbrdlf_evr_trp_tree ) wesveg = 4 - if (clmveg == nbrdlf_evr_tmp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_trp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_tmp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_brl_tree ) wesveg = 4 - if (clmveg == nbrdlf_evr_shrub ) wesveg = 11 - if (clmveg == nbrdlf_dcd_tmp_shrub ) wesveg = 11 - if (clmveg == nbrdlf_dcd_brl_shrub ) wesveg = 11 - if (clmveg == nc3_arctic_grass ) wesveg = 3 - if (clmveg == nc3_nonarctic_grass ) wesveg = 3 - if (clmveg == nc4_grass ) wesveg = 3 - if (clmveg == nc3crop ) wesveg = 2 - if (clmveg == nc3irrig ) wesveg = 2 - if (clmveg >= npcropmin .and. clmveg <= npcropmax ) wesveg = 2 - if (wesveg == wveg_unset )then - write(iulog,*) 'clmveg = ', clmveg, 'lun%itype = ', lun%itype(l) - call endrun(decomp_index=pi, clmlevel=namep, & - msg='ERROR: Not able to determine Wesley vegetation type'//& - errMsg(sourcefile, __LINE__)) - end if - - ! create seasonality index used to index wesely data tables from LAI, Bascially - !if elai is between max lai from input data and half that max the index_season=1 - - - !mail1j and mlai2j are the two monthly lai values pulled from a CLM input data set - !/fs/cgd/csm/inputdata/lnd/clm2/rawdata/mksrf_lai.nc. lai for dates in the middle - !of the month are interpolated using using these values and stored in the variable - !elai (done elsewhere). If the difference between mlai1j and mlai2j is greater - !than zero it is assumed to be fall and less than zero it is assumed to be spring. - - !wesely seasonal "index_season" - ! 1 - midsummer with lush vegetation - ! 2 - Autumn with unharvested cropland - ! 3 - Late autumn after frost, no snow - ! 4 - Winter, snow on ground and subfreezing - ! 5 - Transitional spring with partially green short annuals - - - !mlaidiff=jan-feb - minlai=minval(annlai(:,pi)) - maxlai=maxval(annlai(:,pi)) - - index_season = -1 - - if ( lun%itype(l) /= istsoil )then - if ( lun%itype(l) == istice_mec ) then - wesveg = 8 - index_season = 4 - elseif ( lun%itype(l) == istdlak ) then - wesveg = 7 - index_season = 4 - elseif ( lun%itype(l) == istwet ) then - wesveg = 9 - index_season = 2 - elseif ( lun%urbpoi(l) ) then - wesveg = 1 - index_season = 2 - end if - else if ( snow_depth(c) > 0 ) then - index_season = 4 - else if(elai(pi) > 0.5_r8*maxlai) then - index_season = 1 - endif - - if (index_season<0) then - if (elai(pi) < (minlai+0.05*(maxlai-minlai))) then - index_season = 3 - endif - endif - - if (index_season<0) then - if (mlaidiff(pi) > 0.0_r8) then - index_season = 2 - elseif (mlaidiff(pi) < 0.0_r8) then - index_season = 5 - elseif (mlaidiff(pi).eq.0.0_r8) then - index_season = 3 - endif - endif - - if (index_season<0) then - call endrun('ERROR: not able to determine season'//errmsg(sourcefile, __LINE__)) - endif - - ! saturation specific humidity - ! - es = 611_r8*exp(5414.77_r8*((1._r8/tmelt)-(1._r8/sfc_temp))) - ws = .622_r8*es/(pg-es) - qs = ws/(1._r8+ws) - - has_dew = .false. - if( qs <= spec_hum ) then - has_dew = .true. - end if - if( sfc_temp < tmelt ) then - has_dew = .false. - end if - - has_rain = rain > rain_threshold - - if ( has_dew .or. has_rain ) then - dewm = 3._r8 - else - dewm = 1._r8 - end if - - !Define tc - tc = sfc_temp - tmelt - - ! - ! rdc (lower canopy res) - ! - rdc=100._r8*(1._r8+1000._r8/(solar_flux+10._r8))/(1._r8+1000._r8*slope) - - ! surface resistance : depends on both land type and species - ! land types are computed seperately, then resistance is computed as average of values - ! following wesely rc=(1/(rs+rm) + 1/rlu +1/(rdc+rcl) + 1/(rac+rgs))**-1 - - !******************************************************* - call seq_drydep_setHCoeff( sfc_temp, heff(:n_drydep) ) - !********************************************************* - - species_loop1: do ispec=1, n_drydep - if(mapping(ispec) <= 0) cycle - - if(ispec.eq.index_o3.or.ispec.eq.index_o3a.or.ispec.eq.index_so2) then - rmx=0._r8 - else - rmx=1._r8/((heff(ispec)/3000._r8)+(100._r8*foxd(ispec))) - endif - - ! correction for frost - cts = 1000._r8*exp( -tc - 4._r8 ) - - !ground resistance - rgsx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rgss(index_season,wesveg)+cts))) + & - (foxd(ispec)/(rgso(index_season,wesveg)+cts))) - - !------------------------------------------------------------------------------------- - ! special case for H2 and CO;; CH4 is set ot a fraction of dv(H2) - !------------------------------------------------------------------------------------- - if( ispec == index_h2 .or. ispec == index_co .or. ispec == index_ch4 ) then - - if( ispec == index_co ) then - fact_h2 = 1.0_r8 - elseif ( ispec == index_h2 ) then - fact_h2 = 0.5_r8 - elseif ( ispec == index_ch4 ) then - fact_h2 = 50.0_r8 - end if - - !------------------------------------------------------------------------------------- - ! no deposition on snow, ice, desert, and water - !------------------------------------------------------------------------------------- - if( wesveg == 1 .or. wesveg == 7 .or. wesveg == 8 .or. index_season == 4 ) then - rgsx(ispec) = spval - else - var_soilw = max( .1_r8,min( soilw,.3_r8 ) ) - if( wesveg == 3 ) then - var_soilw = log( var_soilw ) - end if - dv_soil_h2 = h2_c(wesveg) + var_soilw*(h2_b(wesveg) + var_soilw*h2_a(wesveg)) - if( dv_soil_h2 > 0._r8 ) then - rgsx(ispec) = fact_h2/(dv_soil_h2*1.e-4_r8) - end if - end if - end if - - !------------------------------------------------------------------------------------- - ! no deposition on water or no vegetation or snow (elai<=0) - !------------------------------------------------------------------------------------- - - no_dep: if( wesveg == 7 .or. elai(pi).le.0_r8 ) then !mvm 11/26/2013 - rclx(ispec) = spval - rsmx(ispec) = spval - rlux(ispec) = spval - rs = spval - else - - !Stomatal resistance - - ! fvitt -- at midnight rssun and/or rssha can be zero in some places which sets rs to zero - ! --- this fix prevents divide by zero error (when rsmx is zero) - if (rssun(pi)>0._r8 .and. rssun(pi)<1.e30 .and. rssha(pi)>0._r8 .and. rssha(pi)<1.e30 ) then - !LKE: corrected rs to add rssun and rssha in parallel (11/30/2017) - rs=1._r8/(fsun(pi)*elai(pi)/rssun(pi) + (1.-fsun(pi))*elai(pi)/rssha(pi)) - else - rs=spval - endif - - rsmx(ispec) = rs*drat(ispec)+rmx - - ! Leaf resistance - !MVM: adjusted rlu by LAI to get leaf resistance over bulk canopy (gao and wesely, 1995) - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec) = rlu_lai/(1.e-5_r8*heff(ispec)+foxd(ispec)) - - !Lower canopy resistance - rclx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rcls(index_season,wesveg)+cts))) + & - (foxd(ispec)/(rclo(index_season,wesveg)+cts))) - - !----------------------------------- - !mvm 11/30/2013: special case for CO - !Dry deposition of CO and hydrocarbons is negligibly - !small in vegetation [Mueller and Brasseur, 1995]. - !------------------------------------ - if( ispec == index_co ) then - rclx(ispec) = spval - rsmx(ispec) = spval - rlux(ispec) = spval - endif - - !-------------------------------------------- - ! jfl : special case for PAN - !-------------------------------------------- - if( ispec == index_pan ) then - dv_pan = c0_pan(wesveg) * (1._r8 - exp(-k_pan(wesveg)*(rs*drat(ispec))*1.e-2_r8 )) - - if( dv_pan > 0._r8 .and. index_season /= 4 ) then - rsmx(ispec) = ( 1._r8/dv_pan ) - end if - end if - - endif no_dep - if ( ispec == index_o3 )then - rs_drydep(pi) = rs - end if - - end do species_loop1 - - - !---------------------------------------------- - !Adjustment for dew and rain in leaf resitances - !--------------------------------------------- - ! no effect over water - no_water: if( wesveg.ne.7 ) then - !MVM: effect only on vegetated areas (elai> 0) - with_LAI: if (elai(pi).gt.0._r8) then - - ! - ! no effect if sfc_temp < O C - ! - non_freezing: if(sfc_temp.gt.tmelt) then - if( has_dew ) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux_o3 = 1._r8/((1._r8/3000._r8)+(1._r8/(3._r8*rlu_lai))) - - if (index_o3 > 0) then - rlux(index_o3) = rlux_o3 - endif - if (index_o3a > 0) then - rlux(index_o3a) = rlux_o3 - endif - endif - - if(has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux_o3 = 1._r8/((1._r8/1000._r8)+(1._r8/(3._r8*rlu_lai))) - - if (index_o3 > 0) then - rlux(index_o3) = rlux_o3 - endif - if (index_o3a > 0) then - rlux(index_o3a) = rlux_o3 - endif - endif - - species_loop2: do ispec=1,n_drydep - if(mapping(ispec).le.0) cycle - if(ispec.ne.index_o3.and.ispec.ne.index_o3a.and.ispec.ne.index_so2) then - - if( has_dew .or. has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec)=1._r8/((1._r8/(3._r8*rlu_lai))+ & - (1.e-7_r8*heff(ispec))+(foxd(ispec)/rlux_o3)) - endif - - elseif(ispec.eq.index_so2) then - - if( has_dew ) then - rlux(ispec) = 100._r8 - endif - - if(has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec) = 1._r8/((1._r8/5000._r8)+(1._r8/(3._r8*rlu_lai))) - endif - - if( has_dew .or. has_rain ) then - !MVM:rlux=50 for SO2 in dew or rain only for *urban land* type surfaces. - if (wesveg.eq.1) then - rlux(ispec)=50._r8 - endif - endif - end if - !mvm 11/30/2013: special case for CO - if( ispec.eq.index_co ) then - rlux(ispec) = spval - endif - end do species_loop2 - endif non_freezing - endif with_LAI - endif no_water - - ! resistance for aerosols - rds = 1._r8/vds(pi) - - species_loop3: do ispec=1,n_drydep - if(mapping(ispec) <= 0) cycle - - ! - ! compute rc - ! - rc = 1._r8/((1._r8/rsmx(ispec))+(1._r8/rlux(ispec)) + & - (1._r8/(rdc+rclx(ispec)))+(1._r8/(rac(index_season,wesveg)+rgsx(ispec)))) - rc = max( 10._r8, rc) - ! - ! assume no surface resistance for SO2 over water - ! - if ( drydep_list(ispec) == 'SO2' .and. wesveg == 7 ) then - rc = 0._r8 - end if - - select case( drydep_list(ispec) ) - case ( 'SO4' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+rds))*100._r8 - case ( 'NH4','NH4NO3','XNH4NO3' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+0.5_r8*rds))*100._r8 - case ( 'Pb' ) - velocity(pi,ispec) = 0.2_r8 - case ( 'CB1', 'CB2', 'OC1', 'OC2', 'SOAM', 'SOAI', 'SOAT', 'SOAB', 'SOAX' ) - velocity(pi,ispec) = 0.10_r8 - case ( 'SO2' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+rb1(pi)+rc))*200._r8 - case default - velocity(pi,ispec) = (1._r8/(ram1(pi)+rb1(pi)+rc))*100._r8 - end select - end do species_loop3 - endif active - end do pft_loop - - end associate - - end subroutine depvel_compute - -end module DryDepVelocity diff --git a/src/biogeochem/EDBGCDynMod.F90 b/src/biogeochem/EDBGCDynMod.F90 deleted file mode 100644 index 107cdf91c0..0000000000 --- a/src/biogeochem/EDBGCDynMod.F90 +++ /dev/null @@ -1,362 +0,0 @@ -module EDBGCDynMod - -! This module creates a pathway to call the belowground biogeochemistry code as driven by the fates vegetation model -! but bypassing the aboveground CN vegetation code. It is modeled after the CNDriverMod in its call sequence and -! functionality. - - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : use_c13, use_c14, use_fates - use decompMod , only : bounds_type - use perf_mod , only : t_startf, t_stopf - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : use_century_decomp, use_nitrif_denitrif - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use CanopyStateType , only : canopystate_type - use SoilStateType , only : soilstate_type - use SoilHydrologyType , only : soilhydrology_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use atm2lndType , only : atm2lnd_type - use SoilStateType , only : soilstate_type - use ch4Mod , only : ch4_type - - - ! public :: EDBGCDynInit ! BGC dynamics: initialization - public :: EDBGCDyn ! BGC Dynamics - public :: EDBGCDynSummary ! BGC dynamics: summary - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - - !----------------------------------------------------------------------- - subroutine EDBGCDyn(bounds, & - num_soilc, filter_soilc, num_soilp, filter_soilp, num_pcropp, filter_pcropp, doalb, & - cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst) - ! - ! !DESCRIPTION: - - ! - ! !USES: - use clm_varpar , only: nlevgrnd, nlevdecomp_full - use clm_varpar , only: nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use subgridAveMod , only: p2c - use CropType , only: crop_type - use CNNDynamicsMod , only: CNNDeposition,CNNFixation, CNNFert, CNSoyfix - use CNMRespMod , only: CNMResp - use CNPhenologyMod , only: CNPhenology - use CNGRespMod , only: CNGResp - use CNCIsoFluxMod , only: CIsoFlux1, CIsoFlux2, CIsoFlux2h, CIsoFlux3 - use CNC14DecayMod , only: C14Decay - use CNCStateUpdate1Mod , only: CStateUpdate1,CStateUpdate0 - use CNCStateUpdate2Mod , only: CStateUpdate2, CStateUpdate2h - use CNCStateUpdate3Mod , only: CStateUpdate3 - use CNNStateUpdate1Mod , only: NStateUpdate1 - use CNNStateUpdate2Mod , only: NStateUpdate2, NStateUpdate2h - use CNGapMortalityMod , only: CNGapMortality - use dynHarvestMod , only: CNHarvest - use SoilBiogeochemDecompCascadeBGCMod , only: decomp_rate_constants_bgc - use SoilBiogeochemDecompCascadeCNMod , only: decomp_rate_constants_cn - use SoilBiogeochemCompetitionMod , only: SoilBiogeochemCompetition - use SoilBiogeochemDecompMod , only: SoilBiogeochemDecomp - use SoilBiogeochemLittVertTranspMod , only: SoilBiogeochemLittVertTransp - use SoilBiogeochemPotentialMod , only: SoilBiogeochemPotential - use SoilBiogeochemVerticalProfileMod , only: SoilBiogeochemVerticalProfile - use SoilBiogeochemNitrifDenitrifMod , only: SoilBiogeochemNitrifDenitrif - use SoilBiogeochemNStateUpdate1Mod , only: SoilBiogeochemNStateUpdate1 - ! - ! !ARGUMENTS: - 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 - integer , intent(in) :: num_pcropp ! number of prog. crop patches in filter - integer , intent(in) :: filter_pcropp(:) ! filter for prognostic crop patches - logical , intent(in) :: doalb ! true = surface albedo calculation time step - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(crop_type) , intent(in) :: crop_inst - type(ch4_type) , intent(in) :: ch4_inst - ! - ! !LOCAL VARIABLES: - real(r8):: cn_decomp_pools(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_pools) - real(r8):: p_decomp_cpool_loss(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_cascade_transitions) !potential C loss from one pool to another - real(r8):: pmnf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,1:ndecomp_cascade_transitions) !potential mineral N flux, from one pool to another - real(r8):: arepr(bounds%begp:bounds%endp) ! reproduction allocation coefficient (only used for crop_prog) - real(r8):: aroot(bounds%begp:bounds%endp) ! root allocation coefficient (only used for crop_prog) - integer :: begp,endp - integer :: begc,endc - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - !real(r8) , intent(in) :: rootfr_patch(bounds%begp:, 1:) - !integer , intent(in) :: altmax_lastyear_indx_col(bounds%begc:) ! frost table depth (m) - - associate( & - rootfr_patch => soilstate_inst%rootfr_patch , & ! fraction of roots in each soil layer (nlevgrnd) - altmax_lastyear_indx_col => canopystate_inst%altmax_lastyear_indx_col , & ! frost table depth (m) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch , & ! Output: [integer (:) ] frac of vegetation not covered by snow [-] - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index, no burying by snow - elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch & ! Output: [real(r8) (:) ] canopy bottom (m) - ) - - ! -------------------------------------------------- - ! zero the column-level C and N fluxes - ! -------------------------------------------------- - - call t_startf('BGCZero') - - call soilbiogeochem_carbonflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - if ( use_c13 ) then - call c13_soilbiogeochem_carbonflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - end if - if ( use_c14 ) then - call c14_soilbiogeochem_carbonflux_inst%SetValues( & - num_soilc, filter_soilc, 0._r8) - end if - - call t_stopf('BGCZero') - - ! -------------------------------------------------- - ! Nitrogen Deposition, Fixation and Respiration - ! -------------------------------------------------- - - ! call t_startf('CNDeposition') - ! call CNNDeposition(bounds, & - ! atm2lnd_inst, soilbiogeochem_nitrogenflux_inst) - ! call t_stopf('CNDeposition') - - - ! if (crop_prog) then - ! call CNNFert(bounds, num_soilc,filter_soilc, & - ! cnveg_nitrogenflux_inst, soilbiogeochem_nitrogenflux_inst) - - ! call CNSoyfix (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - ! waterstate_inst, crop_inst, cnveg_state_inst, cnveg_nitrogenflux_inst , & - ! soilbiogeochem_state_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! end if - - !-------------------------------------------- - ! Soil Biogeochemistry - !-------------------------------------------- - - if (use_century_decomp) then - call decomp_rate_constants_bgc(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - else - call decomp_rate_constants_cn(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - end if - - ! calculate potential decomp rates and total immobilization demand (previously inlined in CNDecompAlloc) - call SoilBiogeochemPotential (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools=cn_decomp_pools(begc:endc,1:nlevdecomp,1:ndecomp_pools), & - p_decomp_cpool_loss=p_decomp_cpool_loss(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions), & - pmnf_decomp_cascade=pmnf_decomp_cascade(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions)) - - - !-------------------------------------------- - ! Resolve the competition between plants and soil heterotrophs - ! for available soil mineral N resource - !-------------------------------------------- - ! will add this back in when integrtating hte nutirent cycles - - - !-------------------------------------------- - ! Calculate litter and soil decomposition rate - !-------------------------------------------- - - ! Calculation of actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N (previously inlined in CNDecompAllocation in CNDecompMod) - - call t_startf('SoilBiogeochemDecomp') - - call SoilBiogeochemDecomp (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools=cn_decomp_pools(begc:endc,1:nlevdecomp,1:ndecomp_pools), & - p_decomp_cpool_loss=p_decomp_cpool_loss(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions), & - pmnf_decomp_cascade=pmnf_decomp_cascade(begc:endc,1:nlevdecomp,1:ndecomp_cascade_transitions)) - - call t_stopf('SoilBiogeochemDecomp') - - - !-------------------------------------------- - ! Update1 - !-------------------------------------------- - - call t_startf('BNGCUpdate1') - - - ! Update all prognostic carbon state variables (except for gap-phase mortality and fire fluxes) - call CStateUpdate1( num_soilc, filter_soilc, num_soilp, filter_soilp, & - crop_inst, cnveg_carbonflux_inst, cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst) - - call t_stopf('BNGCUpdate1') - - !-------------------------------------------- - ! Calculate vertical mixing of soil and litter pools - !-------------------------------------------- - - call t_startf('SoilBiogeochemLittVertTransp') - - call SoilBiogeochemLittVertTransp(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilbiogeochem_state_inst, & - soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - - call t_stopf('SoilBiogeochemLittVertTransp') - - end associate - - end subroutine EDBGCDyn - - - !----------------------------------------------------------------------- - subroutine EDBGCDynSummary(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - clm_fates, nc) - ! - ! !DESCRIPTION: - ! Call to all CN and SoilBiogeochem summary routines - ! also aggregate production and decomposition fluxes to whole-ecosystem balance fluxes - ! - ! !USES: - use clm_varpar , only: ndecomp_cascade_transitions - use CNPrecisionControlMod , only: CNPrecisionControl - use SoilBiogeochemPrecisionControlMod , only: SoilBiogeochemPrecisionControl - use CLMFatesInterfaceMod , only: hlm_fates_interface_type - ! - ! !ARGUMENTS: - 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(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(hlm_fates_interface_type) , intent(inout) :: clm_fates - integer , intent(in) :: nc ! thread index - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - - ! Call to all summary routines - - call t_startf('BGCsum') - - ! Set controls on very low values in critical state variables - - call SoilBiogeochemPrecisionControl(num_soilc, filter_soilc, & - soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst,soilbiogeochem_nitrogenstate_inst) - - ! Note - all summary updates to cnveg_carbonstate_inst and cnveg_carbonflux_inst are done in - ! soilbiogeochem_carbonstate_inst%summary and CNVeg_carbonstate_inst%summary - - ! ---------------------------------------------- - ! soilbiogeochem carbon/nitrogen state summary - ! ---------------------------------------------- - - call soilbiogeochem_carbonstate_inst%summary(bounds, num_soilc, filter_soilc) - if ( use_c13 ) then - call c13_soilbiogeochem_carbonstate_inst%summary(bounds, num_soilc, filter_soilc) - end if - if ( use_c14 ) then - call c14_soilbiogeochem_carbonstate_inst%summary(bounds, num_soilc, filter_soilc) - end if - ! call soilbiogeochem_nitrogenstate_inst%summary(bounds, num_soilc, filter_soilc) - - ! ---------------------------------------------- - ! soilbiogeochem carbon/nitrogen flux summary - ! ---------------------------------------------- - - call soilbiogeochem_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc) - if ( use_c13 ) then - call c13_soilbiogeochem_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc) - end if - if ( use_c14 ) then - call c14_soilbiogeochem_carbonflux_inst%Summary(bounds, num_soilc, filter_soilc) - end if - ! call soilbiogeochem_nitrogenflux_inst%Summary(bounds, num_soilc, filter_soilc) - - - ! ----------------------------------------------------------------------------------- - ! fates veg carbon state and flux summary, Nitrogen (TBD) and Balance Checks - ! ----------------------------------------------------------------------------------- - ! ---------------------------------------------- - ! fates veg nitrogen flux summary - ! ---------------------------------------------- - ! ---------------------------------------------- - ! calculate balance checks on entire carbon cycle (FATES + BGC) - ! ---------------------------------------------- - - call clm_fates%wrap_bgc_summary(nc, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_carbonstate_inst) - - call t_stopf('BGCsum') - - end subroutine EDBGCDynSummary - -end module EDBGCDynMod diff --git a/src/biogeochem/FireEmisFactorsMod.F90 b/src/biogeochem/FireEmisFactorsMod.F90 deleted file mode 100644 index 7aef11ffc3..0000000000 --- a/src/biogeochem/FireEmisFactorsMod.F90 +++ /dev/null @@ -1,262 +0,0 @@ -module FireEmisFactorsMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: FireEmisFactorsMod -! -! !DESCRIPTION: -! Manages input of fire emissions factors from netCDF file -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils, only : endrun - use clm_varctl, only : iulog -! - implicit none - private - save -! -! !PUBLIC MEMBERS: - public :: fire_emis_factors_init - public :: fire_emis_factors_get - -! !PRIVATE MEMBERS: - integer :: npfts ! number of plant function types -! - type emis_eff_t - real(r8), pointer :: eff(:) ! emissions efficiency factor - real(r8) :: wght ! molecular weight - endtype emis_eff_t -! - type(emis_eff_t), pointer :: comp_factors_table(:) ! hash table of FireEmis factors (points to an array of pointers) - integer, pointer :: hash_table_indices(:) ! pointer to hash table indices - integer, parameter :: tbl_hash_sz = 2**16 ! hash table size -! -! -! !REVISION HISTORY: -! 28 Oct 2011: Created by Francis Vitt -! -!EOP -!----------------------------------------------------------------------- -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: fire_emis_factors_get -! -! !INTERFACE: - subroutine fire_emis_factors_get( comp_name, factors, molecwght ) -! -! !DESCRIPTION: -! Method for getting FireEmis information for a named compound -! -! !USES: - use pftconMod , only : nc3crop -! !ARGUMENTS: - character(len=*),intent(in) :: comp_name ! FireEmis compound name - real(r8), intent(out) :: factors(:) ! vegetation type factors for the compound of interest - real(r8), intent(out) :: molecwght ! molecular weight of the compound of intrest -! -!EOP -!----------------------------------------------------------------------- -! local vars: - integer :: hashkey, ndx - character(len=120) :: errmes - - hashkey = gen_hashkey(comp_name) - ndx = hash_table_indices(hashkey) - - if (ndx<1) then - errmes = 'fire_emis_factors_get: '//trim(comp_name)//' compound not found in FireEmis table' - write(iulog,*) trim(errmes) - call endrun(errmes) - endif - - factors(:npfts) = comp_factors_table( ndx )%eff(:npfts) - if ( size(factors) > npfts )then - factors(npfts+1:) = comp_factors_table( ndx )%eff(nc3crop) - end if - molecwght = comp_factors_table( ndx )%wght - - end subroutine fire_emis_factors_get -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: fire_emis_factors_init -! -! !INTERFACE: - subroutine fire_emis_factors_init( filename ) -! -! !DESCRIPTION: -! Initializes the FireEmis factors using data from input file -! -! !USES: - use ncdio_pio, only : ncd_pio_openfile,ncd_inqdlen - use pio, only : pio_inq_varid,pio_get_var,file_desc_t,pio_closefile - use fileutils , only : getfil - use clm_varpar , only : mxpft -! -! !ARGUMENTS: - character(len=*),intent(in) :: filename ! FireEmis factors input file - -!EOP -!----------------------------------------------------------------------- -! - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - - integer :: start(2), count(2) - - integer :: ierr, i, vid - integer :: dimid, n_comps, n_pfts - integer :: comp_ef_vid,comp_name_vid,comp_mw_vid - - real(r8), allocatable :: comp_factors(:) - character(len=64), allocatable :: comp_names(:) ! FireEmis compound names - real(r8), allocatable :: comp_molecwghts(:)! FireEmis compound molecular weights - - allocate(comp_factors_table(150)) - allocate(hash_table_indices(tbl_hash_sz)) - - call getfil(filename, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - call ncd_inqdlen( ncid, dimid, n_comps, name='Comp_Num') - call ncd_inqdlen( ncid, dimid, n_pfts, name='PFT_Num') - - npfts = n_pfts - if ( npfts /= mxpft .and. npfts /= 16 )then - call endrun('Number of PFTs on fire emissions file is NOT correct. Its neither the total number of PFTS nor 16') - end if - - ierr = pio_inq_varid(ncid,'Comp_EF', comp_ef_vid) - ierr = pio_inq_varid(ncid,'Comp_Name',comp_name_vid) - ierr = pio_inq_varid(ncid,'Comp_MW', comp_mw_vid) - - allocate( comp_factors(n_pfts) ) - allocate( comp_names(n_comps) ) - allocate( comp_molecwghts(n_comps) ) - - ierr = pio_get_var( ncid, comp_name_vid, comp_names ) - ierr = pio_get_var( ncid, comp_mw_vid, comp_molecwghts ) - - ! set up hash table where data is stored - call bld_hash_table_indices( comp_names ) - do i=1,n_comps - start=(/i,1/) - count=(/1,npfts/) - ierr = pio_get_var( ncid, comp_ef_vid, start, count, comp_factors ) - - call enter_hash_data( trim(comp_names(i)), comp_factors, comp_molecwghts(i) ) - enddo - - call pio_closefile(ncid) - - deallocate( comp_factors, comp_names, comp_molecwghts ) - - endsubroutine fire_emis_factors_init -!----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! Private methods... - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine bld_hash_table_indices( names ) - character(len=*),intent(in) :: names(:) - - integer :: n, i, hashkey - - hash_table_indices(:) = 0 - - n = size(names) - do i=1,n - hashkey = gen_hashkey(names(i)) - hash_table_indices(hashkey) = i - enddo - - endsubroutine bld_hash_table_indices - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine enter_hash_data( name, data, molec_wght ) - character(len=*), intent(in) :: name - real(r8), intent(in) :: data(:) - real(r8), intent(in) :: molec_wght - - integer :: hashkey, ndx - integer :: nfactors - - hashkey = gen_hashkey(name) - nfactors = size(data) - ndx = hash_table_indices(hashkey) - - if(ndx < 1) then - call endrun('ndx out of bounds '//name) - endif - - allocate (comp_factors_table(ndx)%eff(nfactors)) - - comp_factors_table(ndx)%eff(:) = data(:) - comp_factors_table(ndx)%wght = molec_wght - - end subroutine enter_hash_data - - !----------------------------------------------------------------------- - !from cam_history - ! - ! Purpose: Generate a hash key on the interval [0 .. tbl_hash_sz-1] - ! given a character string. - ! - ! Algorithm is a variant of perl's internal hashing function. - ! - !----------------------------------------------------------------------- - integer function gen_hashkey(string) - - implicit none - ! - ! Arguments: - ! - character(len=*), intent(in) :: string - ! - ! Local vars - ! - integer :: hash - integer :: i - integer :: strlen - integer, parameter :: tbl_max_idx = 15 ! 2**N - 1 - integer, parameter :: gen_hash_key_offset = z'000053db' - integer, dimension(0:tbl_max_idx) :: tbl_gen_hash_key = (/61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1/) - - hash = gen_hash_key_offset - strlen = len_trim(string) - if ( strlen /= 19 ) then - ! - ! Process arbitrary string length. - ! - do i = 1, strlen - hash = ieor(hash , (ichar(string(i:i)) * tbl_gen_hash_key(iand(i-1,tbl_max_idx)))) - end do - else - ! - ! Special case string length = 19 - ! - do i = 1, tbl_max_idx+1 - hash = ieor(hash , ichar(string(i:i)) * tbl_gen_hash_key(i-1)) - end do - do i = tbl_max_idx+2, strlen - hash = ieor(hash , ichar(string(i:i)) * tbl_gen_hash_key(i-tbl_max_idx-2)) - end do - end if - - gen_hashkey = iand(hash, tbl_hash_sz-1) - - return - - end function gen_hashkey - -end module FireEmisFactorsMod - - diff --git a/src/biogeochem/MEGANFactorsMod.F90 b/src/biogeochem/MEGANFactorsMod.F90 deleted file mode 100644 index 8c91959b88..0000000000 --- a/src/biogeochem/MEGANFactorsMod.F90 +++ /dev/null @@ -1,307 +0,0 @@ -module MEGANFactorsMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Manages input of MEGAN emissions factors from netCDF file - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils, only : endrun - use clm_varctl, only : iulog - use shr_log_mod, only : errMsg => shr_log_errMsg - ! - implicit none - private - ! - ! !PUBLIC MEMBERS: - public :: megan_factors_init - public :: megan_factors_get - public :: comp_names - ! - ! !PUBLIC DATA: - real(r8), public, allocatable :: LDF(:) ! light dependent fraction - real(r8), public, allocatable :: Agro(:) ! growing leaf age factor - real(r8), public, allocatable :: Amat(:) ! mature leaf age factor - real(r8), public, allocatable :: Anew(:) ! new leaf age factor - real(r8), public, allocatable :: Aold(:) ! old leaf age factor - real(r8), public, allocatable :: betaT(:)! temperature factor - real(r8), public, allocatable :: ct1(:) ! temperature coefficient 1 - real(r8), public, allocatable :: ct2(:) ! temperature coefficient 2 - real(r8), public, allocatable :: Ceo(:) ! Eopt coefficient - ! - ! !PRIVATE MEMBERS: - integer :: npfts ! number of plant function types - ! - type emis_eff_t - real(r8) , pointer :: eff (:) ! [real(r8) (:)] emissions efficiency factor - real(r8) :: wght ! molecular weight - integer :: class_num ! MEGAN class number - endtype emis_eff_t - ! - type(emis_eff_t) , pointer :: comp_factors_table (:) ! [type(emis_eff_t) (:)] hash table of MEGAN factors (points to an array of pointers) - integer , pointer :: hash_table_indices (:) ! [integer (:)] pointer to hash table indices - integer, parameter :: tbl_hash_sz = 2**16 ! hash table size - ! - character(len=40), allocatable :: comp_names(:) ! MEGAN compound names - real(r8), allocatable :: comp_molecwghts(:)! MEGAN compound molecular weights - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine megan_factors_get( comp_name, factors, class_n, molecwght ) - ! - ! !DESCRIPTION: - ! Method for getting MEGAN information for a named compound - ! - ! !ARGUMENTS: - character(len=*),intent(in) :: comp_name ! MEGAN compound name - real(r8), intent(out) :: factors(npfts) ! vegitation type factors for the compound of intrest - integer, intent(out) :: class_n ! MEGAN class number for the compound of intrest - real(r8), intent(out) :: molecwght ! molecular weight of the compound of intrest - ! - ! LOCAL VARS: - integer :: hashkey, ndx - character(len=120) :: errmes - !----------------------------------------------------------------------- - - hashkey = gen_hashkey(comp_name) - ndx = hash_table_indices(hashkey) - - if (ndx<1) then - errmes = 'megan_factors_get: '//trim(comp_name)//' compound not found in MEGAN table' - write(iulog,*) trim(errmes) - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - factors(:) = comp_factors_table( ndx )%eff(:) - class_n = comp_factors_table( ndx )%class_num - molecwght = comp_factors_table( ndx )%wght - - end subroutine megan_factors_get - - !----------------------------------------------------------------------- - subroutine megan_factors_init( filename ) - ! - ! !DESCRIPTION: - ! Initializes the MEGAN factors using data from input file - ! - ! !USES: - use ncdio_pio, only : ncd_pio_openfile,ncd_inqdlen - use pio, only : pio_inq_varid,pio_get_var,file_desc_t,pio_closefile - use fileutils , only : getfil - use clm_varpar , only : mxpft - ! - ! !ARGUMENTS: - character(len=*),intent(in) :: filename ! MEGAN factors input file - !----------------------------------------------------------------------- - - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - - integer :: start(2), count(2) - - integer :: ierr, i, vid - integer :: dimid, n_comps, n_classes, n_patchs - integer :: class_ef_vid,comp_ef_vid,comp_name_vid,class_num_vid - integer :: comp_mw_vid - integer, allocatable :: class_nums(:) - - real(r8),allocatable :: factors(:) - real(r8),allocatable :: comp_factors(:) - real(r8),allocatable :: class_factors(:) - - allocate(comp_factors_table(150)) - allocate(hash_table_indices(tbl_hash_sz)) - - - call getfil(filename, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - call ncd_inqdlen( ncid, dimid, n_comps, name='Comp_Num') - call ncd_inqdlen( ncid, dimid, n_classes, name='Class_Num') - call ncd_inqdlen( ncid, dimid, n_patchs, name='PFT_Num') - - if ( n_patchs /= mxpft )then - call endrun(msg='PFT_Num does NOT equal mxpft: '//errMsg(sourcefile, __LINE__)) - end if - npfts = n_patchs - - ierr = pio_inq_varid(ncid,'Class_EF', class_ef_vid) - ierr = pio_inq_varid(ncid,'Comp_EF', comp_ef_vid) - ierr = pio_inq_varid(ncid,'Comp_Name',comp_name_vid) - ierr = pio_inq_varid(ncid,'Class_Num',class_num_vid) - ierr = pio_inq_varid(ncid,'Comp_MW', comp_mw_vid) - - allocate( factors(n_patchs) ) - allocate( comp_factors(n_patchs) ) - allocate( class_factors(n_patchs) ) - - factors(1:n_patchs) = 0._r8 - comp_factors(1:n_patchs) = 0._r8 - class_factors(1:n_patchs) = 0._r8 - - allocate( comp_names(n_comps) ) - allocate( comp_molecwghts(n_comps) ) - allocate( class_nums(n_comps) ) - - ierr = pio_get_var( ncid, comp_name_vid, comp_names ) - ierr = pio_get_var( ncid, comp_mw_vid, comp_molecwghts ) - ierr = pio_get_var( ncid, class_num_vid, class_nums ) - - ! set up hash table where data is stored - call bld_hash_table_indices( comp_names ) - do i=1,n_comps - start=(/i,1/) - count=(/1,mxpft/) - ierr = pio_get_var( ncid, comp_ef_vid, start, count, comp_factors ) - start=(/class_nums(i),1/) - ierr = pio_get_var( ncid, class_ef_vid, start, count, class_factors ) - factors(:) = comp_factors(:)*class_factors(:) - call enter_hash_data( trim(comp_names(i)), factors, class_nums(i), comp_molecwghts(i) ) - enddo - - allocate( LDF(n_classes) ) - allocate( Agro(n_classes) ) - allocate( Amat(n_classes) ) - allocate( Anew(n_classes) ) - allocate( Aold(n_classes) ) - allocate( betaT(n_classes) ) - allocate( ct1(n_classes) ) - allocate( ct2(n_classes) ) - allocate( Ceo(n_classes) ) - - ierr = pio_inq_varid(ncid,'LDF', vid) - ierr = pio_get_var( ncid, vid, LDF ) - - ierr = pio_inq_varid(ncid,'Agro', vid) - ierr = pio_get_var( ncid, vid, Agro ) - - ierr = pio_inq_varid(ncid,'Amat', vid) - ierr = pio_get_var( ncid, vid, Amat ) - - ierr = pio_inq_varid(ncid,'Anew', vid) - ierr = pio_get_var( ncid, vid, Anew ) - - ierr = pio_inq_varid(ncid,'Aold', vid) - ierr = pio_get_var( ncid, vid, Aold ) - - ierr = pio_inq_varid(ncid,'betaT', vid) - ierr = pio_get_var( ncid, vid, betaT ) - - ierr = pio_inq_varid(ncid,'ct1', vid) - ierr = pio_get_var( ncid, vid, ct1 ) - - ierr = pio_inq_varid(ncid,'ct2', vid) - ierr = pio_get_var( ncid, vid, ct2 ) - - ierr = pio_inq_varid(ncid,'Ceo', vid) - ierr = pio_get_var( ncid, vid, Ceo ) - - call pio_closefile(ncid) - - deallocate( class_nums, comp_factors,class_factors,factors ) - - endsubroutine megan_factors_init -!----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! Private methods... - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine bld_hash_table_indices( names ) - character(len=*),intent(in) :: names(:) - - integer :: n, i, hashkey - - hash_table_indices(:) = 0 - - n = size(names) - do i=1,n - hashkey = gen_hashkey(names(i)) - hash_table_indices(hashkey) = i - enddo - - endsubroutine bld_hash_table_indices - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine enter_hash_data( name, data, class_n, molec_wght ) - character(len=*), intent(in) :: name - real(r8), intent(in) :: data(:) - integer, intent(in) :: class_n - real(r8), intent(in) :: molec_wght - - integer :: hashkey, ndx - integer :: nfactors - - hashkey = gen_hashkey(name) - nfactors = size(data) - - ndx = hash_table_indices(hashkey) - - allocate (comp_factors_table(ndx)%eff(nfactors)) - - comp_factors_table(ndx)%eff(:) = data(:) - comp_factors_table(ndx)%class_num = class_n - comp_factors_table(ndx)%wght = molec_wght - - end subroutine enter_hash_data - - !----------------------------------------------------------------------- - !from cam_history - ! - ! Purpose: Generate a hash key on the interval [0 .. tbl_hash_sz-1] - ! given a character string. - ! - ! Algorithm is a variant of perl's internal hashing function. - ! - !----------------------------------------------------------------------- - integer function gen_hashkey(string) - - implicit none - ! - ! Arguments: - ! - character(len=*), intent(in) :: string - ! - ! Local vars - ! - integer :: hash - integer :: i - - integer, parameter :: tbl_max_idx = 15 ! 2**N - 1 - integer, parameter :: gen_hash_key_offset = z'000053db' - integer, dimension(0:tbl_max_idx) :: tbl_gen_hash_key = (/61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1/) - - hash = gen_hash_key_offset - - if ( len_trim(string) /= 19 ) then - ! - ! Process arbitrary string length. - ! - do i = 1, len_trim(string) - hash = ieor(hash , (ichar(string(i:i)) * tbl_gen_hash_key(iand(i-1,tbl_max_idx)))) - end do - else - ! - ! Special case string length = 19 - ! - do i = 1, tbl_max_idx+1 - hash = ieor(hash , ichar(string(i:i)) * tbl_gen_hash_key(i-1)) - end do - do i = tbl_max_idx+2, len_trim(string) - hash = ieor(hash , ichar(string(i:i)) * tbl_gen_hash_key(i-tbl_max_idx-2)) - end do - end if - - gen_hashkey = iand(hash, tbl_hash_sz-1) - - return - - end function gen_hashkey - -end module MEGANFactorsMod diff --git a/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 b/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 deleted file mode 100644 index 5d29efbeb5..0000000000 --- a/src/biogeochem/NutrientCompetitionCLM45defaultMod.F90 +++ /dev/null @@ -1,992 +0,0 @@ -module NutrientCompetitionCLM45defaultMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! DESCRIPTION - ! module contains different subroutines to do soil nutrient competition dynamics - ! - ! created by Jinyun Tang, Sep 8, 2014 - ! modified by Mariana Vertenstein, Nov 15, 2014 - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use NutrientCompetitionMethodMod, only : nutrient_competition_method_type - use NutrientCompetitionMethodMod, only : params_inst - !use clm_varctl , only : iulog - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: nutrient_competition_clm45default_type - ! - type, extends(nutrient_competition_method_type) :: nutrient_competition_clm45default_type - private - contains - ! public methocs - procedure, public :: init ! Initialize the class - procedure, public :: calc_plant_nutrient_competition ! calculate nutrient yield rate from competition - procedure, public :: calc_plant_nutrient_demand ! calculate plant nutrient demand - ! - ! private methods - procedure, private:: calc_plant_cn_alloc - procedure, private:: calc_plant_nitrogen_demand - end type nutrient_competition_clm45default_type - ! - interface nutrient_competition_clm45default_type - ! initialize a new nutrient_competition_clm45default_type object - module procedure constructor - end interface nutrient_competition_clm45default_type - ! - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - type(nutrient_competition_clm45default_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type nutrient_competition_clm45default_type. - ! For now, this is simply a place-holder. - - end function constructor - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize the class (currently empty for this version) - ! - class(nutrient_competition_clm45default_type) :: this - type(bounds_type), intent(in) :: bounds - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine calc_plant_nutrient_competition (this, & - bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, cnveg_carbonstate_inst, & - cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_nitrogenstate_inst, & - aroot, arepr, fpg_col) - ! - ! !USES: - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CanopyStateType , only : canopystate_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType, only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use CNSharedParamsMod , only : use_fun - ! - ! !ARGUMENTS: - class(nutrient_competition_clm45default_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - real(r8) , intent(in) :: aroot(bounds%begp:) - real(r8) , intent(in) :: arepr(bounds%begp:) - real(r8) , intent(in) :: fpg_col(bounds%begc:) - - call this%calc_plant_cn_alloc (bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, c13_cnveg_carbonflux_inst, & - c14_cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - aroot=aroot(bounds%begp:bounds%endp), & - arepr=arepr(bounds%begp:bounds%endp), & - fpg_col=fpg_col(bounds%begc:bounds%endc)) - - end subroutine calc_plant_nutrient_competition - - !----------------------------------------------------------------------- - subroutine calc_plant_cn_alloc (this, bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, c13_cnveg_carbonflux_inst, & - c14_cnveg_carbonflux_inst, cnveg_nitrogenflux_inst, & - aroot, arepr, fpg_col) - ! - ! !USES: - use pftconMod , only : pftcon, npcropmin - use clm_varctl , only : use_c13, use_c14 - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CanopyStateType , only : canopystate_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNSharedParamsMod , only : use_fun - use shr_infnan_mod , only : shr_infnan_isnan - - ! - ! !ARGUMENTS: - class(nutrient_competition_clm45default_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(in) :: aroot(bounds%begp:) - real(r8) , intent(in) :: arepr(bounds%begp:) - real(r8) , intent(in) :: fpg_col(bounds%begc:) - ! - ! !LOCAL VARIABLES: - integer :: c,p,l,j ! indices - integer :: fp ! lake filter patch index - real(r8):: f1,f2,f3,f4,g1,g2 ! allocation parameters - real(r8):: cnl,cnfr,cnlw,cndw ! C:N ratios for leaf, fine root, and wood - real(r8):: fcur ! fraction of current psn displayed as growth - real(r8):: gresp_storage ! temporary variable for growth resp to storage - real(r8):: nlc ! temporary variable for total new leaf carbon allocation - real(r8):: f5 ! grain allocation parameter - real(r8):: cng ! C:N ratio for grain (= cnlw for now; slevis) - real(r8):: fsmn(bounds%begp:bounds%endp) ! A emperate variable for adjusting FUN uptakes - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fpg_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - fpg => fpg_col , & ! Input: [real(r8) (:) ] fraction of potential gpp (no units) - - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - froot_leaf => pftcon%froot_leaf , & ! Input: allocation parameter: new fine root C per new leaf C (gC/gC) - croot_stem => pftcon%croot_stem , & ! Input: allocation parameter: new coarse root C per new stem C (gC/gC) - stem_leaf => pftcon%stem_leaf , & ! Input: allocation parameter: new stem c per new leaf C (gC/gC) - flivewd => pftcon%flivewd , & ! Input: allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) - fcur2 => pftcon%fcur , & ! Input: allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) - grperc => pftcon%grperc , & ! Input: growth respiration parameter - grpnow => pftcon%grpnow , & ! Input: growth respiration parameter - - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] flag, true if planted, not harvested - - peaklai => cnveg_state_inst%peaklai_patch , & ! Input: [integer (:) ] 1: max allowed lai; 0: not at max - aleaf => cnveg_state_inst%aleaf_patch , & ! Output: [real(r8) (:) ] leaf allocation coefficient - astem => cnveg_state_inst%astem_patch , & ! Output: [real(r8) (:) ] stem allocation coefficient - c_allometry => cnveg_state_inst%c_allometry_patch , & ! Output: [real(r8) (:) ] C allocation index (DIM) - n_allometry => cnveg_state_inst%n_allometry_patch , & ! Output: [real(r8) (:) ] N allocation index (DIM) - downreg => cnveg_state_inst%downreg_patch , & ! Output: [real(r8) (:) ] fractional reduction in GPP due to N limitation (DIM) - - annsum_npp => cnveg_carbonflux_inst%annsum_npp_patch , & ! Input: [real(r8) (:) ] annual sum of NPP, for wood allocation - gpp => cnveg_carbonflux_inst%gpp_before_downreg_patch , & ! Output: [real(r8) (:) ] GPP flux before downregulation (gC/m2/s) - availc => cnveg_carbonflux_inst%availc_patch , & ! Output: [real(r8) (:) ] C flux available for allocation (gC/m2/s) - excess_cflux => cnveg_carbonflux_inst%excess_cflux_patch , & ! Output: [real(r8) (:) ] C flux not allocated due to downregulation (gC/m2/s) - plant_calloc => cnveg_carbonflux_inst%plant_calloc_patch , & ! Output: [real(r8) (:) ] total allocated C flux (gC/m2/s) - psnsun_to_cpool => cnveg_carbonflux_inst%psnsun_to_cpool_patch , & ! Output: [real(r8) (:) ] - psnshade_to_cpool => cnveg_carbonflux_inst%psnshade_to_cpool_patch , & ! Output: [real(r8) (:) ] - cpool_to_leafc => cnveg_carbonflux_inst%cpool_to_leafc_patch , & ! Output: [real(r8) (:) ] - cpool_to_leafc_storage => cnveg_carbonflux_inst%cpool_to_leafc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Output: [real(r8) (:) ] - cpool_to_frootc_storage => cnveg_carbonflux_inst%cpool_to_frootc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_livestemc => cnveg_carbonflux_inst%cpool_to_livestemc_patch , & ! Output: [real(r8) (:) ] - cpool_to_livestemc_storage => cnveg_carbonflux_inst%cpool_to_livestemc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadstemc => cnveg_carbonflux_inst%cpool_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadstemc_storage => cnveg_carbonflux_inst%cpool_to_deadstemc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_livecrootc => cnveg_carbonflux_inst%cpool_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - cpool_to_livecrootc_storage => cnveg_carbonflux_inst%cpool_to_livecrootc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadcrootc => cnveg_carbonflux_inst%cpool_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadcrootc_storage => cnveg_carbonflux_inst%cpool_to_deadcrootc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_gresp_storage => cnveg_carbonflux_inst%cpool_to_gresp_storage_patch , & ! Output: [real(r8) (:) ] allocation to growth respiration storage (gC/m2/s) - cpool_to_grainc => cnveg_carbonflux_inst%cpool_to_grainc_patch , & ! Output: [real(r8) (:) ] allocation to grain C (gC/m2/s) - cpool_to_grainc_storage => cnveg_carbonflux_inst%cpool_to_grainc_storage_patch , & ! Output: [real(r8) (:) ] allocation to grain C storage (gC/m2/s) - - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Output: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) - plant_nalloc => cnveg_nitrogenflux_inst%plant_nalloc_patch , & ! Output: [real(r8) (:) ] total allocated N flux (gN/m2/s) - npool_to_grainn => cnveg_nitrogenflux_inst%npool_to_grainn_patch , & ! Output: [real(r8) (:) ] allocation to grain N (gN/m2/s) - npool_to_grainn_storage => cnveg_nitrogenflux_inst%npool_to_grainn_storage_patch , & ! Output: [real(r8) (:) ] allocation to grain N storage (gN/m2/s) - retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of retranslocated N (gN/m2/s) - sminn_to_npool => cnveg_nitrogenflux_inst%sminn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of soil mineral N uptake (gN/m2/s) - npool_to_leafn => cnveg_nitrogenflux_inst%npool_to_leafn_patch , & ! Output: [real(r8) (:) ] allocation to leaf N (gN/m2/s) - npool_to_leafn_storage => cnveg_nitrogenflux_inst%npool_to_leafn_storage_patch , & ! Output: [real(r8) (:) ] allocation to leaf N storage (gN/m2/s) - npool_to_frootn => cnveg_nitrogenflux_inst%npool_to_frootn_patch , & ! Output: [real(r8) (:) ] allocation to fine root N (gN/m2/s) - npool_to_frootn_storage => cnveg_nitrogenflux_inst%npool_to_frootn_storage_patch , & ! Output: [real(r8) (:) ] allocation to fine root N storage (gN/m2/s) - npool_to_livestemn => cnveg_nitrogenflux_inst%npool_to_livestemn_patch , & ! Output: [real(r8) (:) ] - npool_to_livestemn_storage => cnveg_nitrogenflux_inst%npool_to_livestemn_storage_patch , & ! Output: [real(r8) (:) ] - npool_to_deadstemn => cnveg_nitrogenflux_inst%npool_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - npool_to_deadstemn_storage => cnveg_nitrogenflux_inst%npool_to_deadstemn_storage_patch , & ! Output: [real(r8) (:) ] - npool_to_livecrootn => cnveg_nitrogenflux_inst%npool_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - npool_to_livecrootn_storage => cnveg_nitrogenflux_inst%npool_to_livecrootn_storage_patch , & ! Output: [real(r8) (:) ] - npool_to_deadcrootn => cnveg_nitrogenflux_inst%npool_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - npool_to_deadcrootn_storage => cnveg_nitrogenflux_inst%npool_to_deadcrootn_storage_patch , & ! Output: [real(r8) (:) ] - Npassive => cnveg_nitrogenflux_inst%Npassive_patch , & ! Output: [real(r8) (:) ] Passive N uptake (gN/m2/s) - Nfix => cnveg_nitrogenflux_inst%Nfix_patch , & ! Output: [real(r8) (:) ] Symbiotic BNF (gN/m2/s) - Nactive => cnveg_nitrogenflux_inst%Nactive_patch , & ! Output: [real(r8) (:) ] Mycorrhizal N uptake (gN/m2/s) - Nnonmyc => cnveg_nitrogenflux_inst%Nnonmyc_patch , & ! Output: [real(r8) (:) ] Non-mycorrhizal N uptake (gN/m2/s) - Nam => cnveg_nitrogenflux_inst%Nam_patch , & ! Output: [real(r8) (:) ] AM uptake (gN/m2/s) - Necm => cnveg_nitrogenflux_inst%Necm_patch , & ! Output: [real(r8) (:) ] ECM uptake (gN/m2/s) - sminn_to_plant_fun => cnveg_nitrogenflux_inst%sminn_to_plant_fun_patch & ! Output: [real(r8) (:) ] Total N uptake of FUN (gN/m2/s) - ) - - ! patch loop to distribute the available N between the competing patches - ! on the basis of relative demand, and allocate C and N to new growth and storage - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - - ! set some local allocation variables - f1 = froot_leaf(ivt(p)) - f2 = croot_stem(ivt(p)) - - ! modified wood allocation to be 2.2 at npp=800 gC/m2/yr, 0.2 at npp=0, - ! constrained so that it does not go lower than 0.2 (under negative annsum_npp) - ! There was an error in this formula in previous version, where the coefficient - ! was 0.004 instead of 0.0025. - ! This variable allocation is only for trees. Shrubs have a constant - ! allocation as specified in the pft-physiology file. The value is also used - ! as a trigger here: -1.0 means to use the dynamic allocation (trees). - if (stem_leaf(ivt(p)) == -1._r8) then - f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4 - else - f3 = stem_leaf(ivt(p)) - end if - - f4 = flivewd(ivt(p)) - g1 = grperc(ivt(p)) - g2 = grpnow(ivt(p)) - cnl = leafcn(ivt(p)) - cnfr = frootcn(ivt(p)) - cnlw = livewdcn(ivt(p)) - cndw = deadwdcn(ivt(p)) - fcur = fcur2(ivt(p)) - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - if (croplive(p).and.(.not.shr_infnan_isnan(aleaf(p)))) then - f1 = aroot(p) / aleaf(p) - f3 = astem(p) / aleaf(p) - f5 = arepr(p) / aleaf(p) - g1 = 0.25_r8 - else - f1 = 0._r8 - f3 = 0._r8 - f5 = 0._r8 - g1 = 0.25_r8 - end if - end if - - if(use_fun)then ! if we are using FUN, we get the N available from there. - sminn_to_npool(p) = sminn_to_plant_fun(p) - else ! no FUN. :( we get N available from the FPG calculation in soilbiogeochemistry competition. - sminn_to_npool(p) = plant_ndemand(p) * fpg(c) - endif - - plant_nalloc(p) = sminn_to_npool(p) + retransn_to_npool(p) - plant_calloc(p) = plant_nalloc(p) * (c_allometry(p)/n_allometry(p)) - - - if(.not.use_fun)then !ORIGINAL CLM(CN) downregulation code. - excess_cflux(p) = availc(p) - plant_calloc(p) - ! reduce gpp fluxes due to N limitation - if (gpp(p) > 0.0_r8) then - downreg(p) = excess_cflux(p)/gpp(p) - - psnsun_to_cpool(p) = psnsun_to_cpool(p) *(1._r8 - downreg(p)) - psnshade_to_cpool(p) = psnshade_to_cpool(p)*(1._r8 - downreg(p)) - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = & - c13_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) *(1._r8 - downreg(p)) - c13_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = & - c13_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p)*(1._r8 - downreg(p)) - endif - if ( use_c14 ) then - c14_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = & - c14_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) *(1._r8 - downreg(p)) - c14_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = & - c14_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p)*(1._r8 - downreg(p)) - endif - end if - - end if !use_fun - - ! calculate the amount of new leaf C dictated by these allocation - ! decisions, and calculate the daily fluxes of C and N to current - ! growth and storage pools - - ! fcur is the proportion of this day's growth that is displayed now, - ! the remainder going into storage for display next year through the - ! transfer pools - - nlc = plant_calloc(p) / c_allometry(p) - - cpool_to_leafc(p) = nlc * fcur - cpool_to_leafc_storage(p) = nlc * (1._r8 - fcur) - cpool_to_frootc(p) = nlc * f1 * fcur - cpool_to_frootc_storage(p) = nlc * f1 * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - cpool_to_livestemc(p) = nlc * f3 * f4 * fcur - cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) - cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur - cpool_to_deadstemc_storage(p) = nlc * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_livecrootc(p) = nlc * f2 * f3 * f4 * fcur - cpool_to_livecrootc_storage(p) = nlc * f2 * f3 * f4 * (1._r8 - fcur) - cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur - cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool_to_livestemc(p) = nlc * f3 * f4 * fcur - cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) - cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur - cpool_to_deadstemc_storage(p) = nlc * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_livecrootc(p) = nlc * f2 * f3 * f4 * fcur - cpool_to_livecrootc_storage(p) = nlc * f2 * f3 * f4 * (1._r8 - fcur) - cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur - cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_grainc(p) = nlc * f5 * fcur - cpool_to_grainc_storage(p) = nlc * f5 * (1._r8 -fcur) - end if - - ! corresponding N fluxes - npool_to_leafn(p) = (nlc / cnl) * fcur - npool_to_leafn_storage(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_frootn(p) = (nlc * f1 / cnfr) * fcur - npool_to_frootn_storage(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cng = graincn(ivt(p)) - npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_grainn(p) = (nlc * f5 / cng) * fcur - npool_to_grainn_storage(p) = (nlc * f5 / cng) * (1._r8 -fcur) - end if - - ! Calculate the amount of carbon that needs to go into growth - ! respiration storage to satisfy all of the storage growth demands. - ! Allows for the fraction of growth respiration that is released at the - ! time of fixation, versus the remaining fraction that is stored for - ! release at the time of display. Note that all the growth respiration - ! fluxes that get released on a given timestep are calculated in growth_resp(), - ! but that the storage of C for growth resp during display of transferred - ! growth is assigned here. - - gresp_storage = cpool_to_leafc_storage(p) + cpool_to_frootc_storage(p) - if (woody(ivt(p)) == 1._r8) then - gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) - gresp_storage = gresp_storage + cpool_to_deadstemc_storage(p) - - gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) - gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) - gresp_storage = gresp_storage + cpool_to_grainc_storage(p) - end if - cpool_to_gresp_storage(p) = gresp_storage * g1 * (1._r8 - g2) - - end do ! end patch loop - - end associate - - end subroutine calc_plant_cn_alloc - - !----------------------------------------------------------------------- - subroutine calc_plant_nutrient_demand(this, bounds, num_soilp, filter_soilp,& - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, & - energyflux_inst, & - aroot, arepr) - ! - ! !USES: - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use CropType , only : crop_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemCarbonFluxType, only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use EnergyFluxType , only : energyflux_type - use CNSharedParamsMod , only : use_fun - ! - ! !ARGUMENTS: - class(nutrient_competition_clm45default_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(photosyns_type) , intent(in) :: photosyns_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - real(r8) , intent(out) :: aroot(bounds%begp:) - real(r8) , intent(out) :: arepr(bounds%begp:) - !----------------------------------------------------------------------- - - call this%calc_plant_nitrogen_demand(bounds, num_soilp, filter_soilp, & - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - aroot=aroot(bounds%begp:bounds%endp), & - arepr=arepr(bounds%begp:bounds%endp)) - - end subroutine calc_plant_nutrient_demand - - !----------------------------------------------------------------------- - subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - aroot, arepr) - ! - ! !USES: - use pftconMod , only : npcropmin, pftcon - use pftconMod , only : ntmp_soybean, nirrig_tmp_soybean - use pftconMod , only : ntrp_soybean, nirrig_trp_soybean - use clm_varcon , only : secspday - use clm_varctl , only : use_c13, use_c14 - use clm_time_manager , only : get_step_size - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use CropType , only : crop_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNSharedParamsMod , only : use_fun - ! - ! !ARGUMENTS: - class(nutrient_competition_clm45default_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(photosyns_type) , intent(in) :: photosyns_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - real(r8) , intent(out) :: aroot(bounds%begp:) - real(r8) , intent(out) :: arepr(bounds%begp:) - ! - ! !LOCAL VARIABLES: - integer :: c,p,l,j ! indices - integer :: fp ! lake filter patch index - real(r8):: mr ! maintenance respiration (gC/m2/s) - real(r8):: f1,f2,f3,f4,g1,g2 ! allocation parameters - real(r8):: cnl,cnfr,cnlw,cndw ! C:N ratios for leaf, fine root, and wood - real(r8):: curmr, curmr_ratio ! xsmrpool temporary variables - real(r8):: f5 ! grain allocation parameter - real(r8):: cng ! C:N ratio for grain (= cnlw for now; slevis) - real(r8):: fleaf ! fraction allocated to leaf - real(r8):: t1 ! temporary variable - real(r8):: dt ! model time step - real(r8):: dayscrecover ! number of days to recover negative cpool - - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - froot_leaf => pftcon%froot_leaf , & ! Input: allocation parameter: new fine root C per new leaf C (gC/gC) - croot_stem => pftcon%croot_stem , & ! Input: allocation parameter: new coarse root C per new stem C (gC/gC) - stem_leaf => pftcon%stem_leaf , & ! Input: allocation parameter: new stem c per new leaf C (gC/gC) - flivewd => pftcon%flivewd , & ! Input: allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) - graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) - fleafcn => pftcon%fleafcn , & ! Input: leaf c:n during organ fill - ffrootcn => pftcon%ffrootcn , & ! Input: froot c:n during organ fill - fstemcn => pftcon%fstemcn , & ! Input: stem c:n during organ fill - bfact => pftcon%bfact , & ! Input: parameter used below - aleaff => pftcon%aleaff , & ! Input: parameter used below - arootf => pftcon%arootf , & ! Input: parameter used below - astemf => pftcon%astemf , & ! Input: parameter used below - arooti => pftcon%arooti , & ! Input: parameter used below - fleafi => pftcon%fleafi , & ! Input: parameter used below - allconsl => pftcon%allconsl , & ! Input: parameter used below - allconss => pftcon%allconss , & ! Input: parameter used below - grperc => pftcon%grperc , & ! Input: parameter used below - grpnow => pftcon%grpnow , & ! Input: parameter used below - declfact => pftcon%declfact , & ! Input: - season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) - stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1) - psnsun => photosyns_inst%psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - psnsha => photosyns_inst%psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - c13_psnsun => photosyns_inst%c13_psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - c13_psnsha => photosyns_inst%c13_psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - c14_psnsun => photosyns_inst%c14_psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - c14_psnsha => photosyns_inst%c14_psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] =gdd since planting (gddplant) - leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] =gdd from top soil layer temperature - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] flag, true if planted, not harvested - - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Input: [real(r8) (:) ] gdd needed to harvest - huileaf => cnveg_state_inst%huileaf_patch , & ! Input: [real(r8) (:) ] heat unit index needed from planting to leaf emergence - huigrain => cnveg_state_inst%huigrain_patch , & ! Input: [real(r8) (:) ] same to reach vegetative maturity - peaklai => cnveg_state_inst%peaklai_patch , & ! Input: [integer (:) ] 1: max allowed lai; 0: not at max - aleafi => cnveg_state_inst%aleafi_patch , & ! Output: [real(r8) (:) ] saved allocation coefficient from phase 2 - astemi => cnveg_state_inst%astemi_patch , & ! Output: [real(r8) (:) ] saved allocation coefficient from phase 2 - aleaf => cnveg_state_inst%aleaf_patch , & ! Output: [real(r8) (:) ] leaf allocation coefficient - astem => cnveg_state_inst%astem_patch , & ! Output: [real(r8) (:) ] stem allocation coefficient - grain_flag => cnveg_state_inst%grain_flag_patch , & ! Output: [real(r8) (:) ] 1: grain fill stage; 0: not - c_allometry => cnveg_state_inst%c_allometry_patch , & ! Output: [real(r8) (:) ] C allocation index (DIM) - n_allometry => cnveg_state_inst%n_allometry_patch , & ! Output: [real(r8) (:) ] N allocation index (DIM) - tempsum_potential_gpp => cnveg_state_inst%tempsum_potential_gpp_patch , & ! Output: [real(r8) (:) ] temporary annual sum of potential GPP - tempmax_retransn => cnveg_state_inst%tempmax_retransn_patch , & ! Output: [real(r8) (:) ] temporary annual max of retranslocated N pool (gN/m2) - annsum_potential_gpp => cnveg_state_inst%annsum_potential_gpp_patch , & ! Output: [real(r8) (:) ] annual sum of potential GPP - annmax_retransn => cnveg_state_inst%annmax_retransn_patch , & ! Output: [real(r8) (:) ] annual max of retranslocated N pool - - xsmrpool => cnveg_carbonstate_inst%xsmrpool_patch , & ! Input: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] - - retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - - annsum_npp => cnveg_carbonflux_inst%annsum_npp_patch , & ! Input: [real(r8) (:) ] annual sum of NPP, for wood allocation - leaf_mr => cnveg_carbonflux_inst%leaf_mr_patch , & ! Input: [real(r8) (:) ] - froot_mr => cnveg_carbonflux_inst%froot_mr_patch , & ! Input: [real(r8) (:) ] - livestem_mr => cnveg_carbonflux_inst%livestem_mr_patch , & ! Input: [real(r8) (:) ] - livecroot_mr => cnveg_carbonflux_inst%livecroot_mr_patch , & ! Input: [real(r8) (:) ] - grain_mr => cnveg_carbonflux_inst%grain_mr_patch , & ! Input: [real(r8) (:) ] - gpp => cnveg_carbonflux_inst%gpp_before_downreg_patch , & ! Output: [real(r8) (:) ] GPP flux before downregulation (gC/m2/s) - availc => cnveg_carbonflux_inst%availc_patch , & ! Output: [real(r8) (:) ] C flux available for allocation (gC/m2/s) - xsmrpool_recover => cnveg_carbonflux_inst%xsmrpool_recover_patch , & ! Output: [real(r8) (:) ] C flux assigned to recovery of negative cpool (gC/m2/s) - psnsun_to_cpool => cnveg_carbonflux_inst%psnsun_to_cpool_patch , & ! Output: [real(r8) (:) ] - psnshade_to_cpool => cnveg_carbonflux_inst%psnshade_to_cpool_patch , & ! Output: [real(r8) (:) ] - leaf_curmr => cnveg_carbonflux_inst%leaf_curmr_patch , & ! Output: [real(r8) (:) ] - froot_curmr => cnveg_carbonflux_inst%froot_curmr_patch , & ! Output: [real(r8) (:) ] - livestem_curmr => cnveg_carbonflux_inst%livestem_curmr_patch , & ! Output: [real(r8) (:) ] - livecroot_curmr => cnveg_carbonflux_inst%livecroot_curmr_patch , & ! Output: [real(r8) (:) ] - grain_curmr => cnveg_carbonflux_inst%grain_curmr_patch , & ! Output: [real(r8) (:) ] - leaf_xsmr => cnveg_carbonflux_inst%leaf_xsmr_patch , & ! Output: [real(r8) (:) ] - froot_xsmr => cnveg_carbonflux_inst%froot_xsmr_patch , & ! Output: [real(r8) (:) ] - livestem_xsmr => cnveg_carbonflux_inst%livestem_xsmr_patch , & ! Output: [real(r8) (:) ] - livecroot_xsmr => cnveg_carbonflux_inst%livecroot_xsmr_patch , & ! Output: [real(r8) (:) ] - grain_xsmr => cnveg_carbonflux_inst%grain_xsmr_patch , & ! Output: [real(r8) (:) ] - cpool_to_xsmrpool => cnveg_carbonflux_inst%cpool_to_xsmrpool_patch , & ! Output: [real(r8) (:) ] - - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Output: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) - avail_retransn => cnveg_nitrogenflux_inst%avail_retransn_patch , & ! Output: [real(r8) (:) ] N flux available from retranslocation pool (gN/m2/s) - retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of retranslocated N (gN/m2/s) - sminn_to_npool => cnveg_nitrogenflux_inst%sminn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of soil mineral N uptake (gN/m2/s) - leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Output: [real(r8) (:) ] - frootn_to_retransn => cnveg_nitrogenflux_inst%frootn_to_retransn_patch , & ! Output: [real(r8) (:) ] - livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch & ! Output: [real(r8) (:) ] - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! set number of days to recover negative cpool - dayscrecover = params_inst%dayscrecover - - ! loop over patches to assess the total plant N demand - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! get the time step total gross photosynthesis - ! this is coming from the canopy fluxes code, and is the - ! gpp that is used to control stomatal conductance. - ! For the nitrogen downregulation code, this is assumed - ! to be the potential gpp, and the actual gpp will be - ! reduced due to N limitation. - - ! Convert psn from umol/m2/s -> gC/m2/s - - ! The input psn (psnsun and psnsha) are expressed per unit LAI - ! in the sunlit and shaded canopy, respectively. These need to be - ! scaled by laisun and laisha to get the total gpp for allocation - - ! Note that no associate statement is used for the isotope carbon fluxes below - ! since they are not always allocated AND nag compiler will complain if you try to - ! to have an associate statement with unallocated memory - - psnsun_to_cpool(p) = psnsun(p) * laisun(p) * 12.011e-6_r8 - psnshade_to_cpool(p) = psnsha(p) * laisha(p) * 12.011e-6_r8 - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = c13_psnsun(p) * laisun(p) * 12.011e-6_r8 - c13_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = c13_psnsha(p) * laisha(p) * 12.011e-6_r8 - endif - - if ( use_c14 ) then - c14_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = c14_psnsun(p) * laisun(p) * 12.011e-6_r8 - c14_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = c14_psnsha(p) * laisha(p) * 12.011e-6_r8 - endif - - gpp(p) = psnsun_to_cpool(p) + psnshade_to_cpool(p) - - ! get the time step total maintenance respiration - ! These fluxes should already be in gC/m2/s - - mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then - mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin) then - if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) - end if - - ! carbon flux available for allocation - availc(p) = gpp(p) - mr - - ! new code added for isotope calculations, 7/1/05, PET - ! If mr > gpp, then some mr comes from gpp, the rest comes from - ! cpool (xsmr) - if (mr > 0._r8 .and. availc(p) < 0._r8) then - curmr = gpp(p) - curmr_ratio = curmr / mr - else - curmr_ratio = 1._r8 - end if - leaf_curmr(p) = leaf_mr(p) * curmr_ratio - leaf_xsmr(p) = leaf_mr(p) - leaf_curmr(p) - froot_curmr(p) = froot_mr(p) * curmr_ratio - froot_xsmr(p) = froot_mr(p) - froot_curmr(p) - livestem_curmr(p) = livestem_mr(p) * curmr_ratio - livestem_xsmr(p) = livestem_mr(p) - livestem_curmr(p) - livecroot_curmr(p) = livecroot_mr(p) * curmr_ratio - livecroot_xsmr(p) = livecroot_mr(p) - livecroot_curmr(p) - grain_curmr(p) = grain_mr(p) * curmr_ratio - grain_xsmr(p) = grain_mr(p) - grain_curmr(p) - - ! no allocation when available c is negative - availc(p) = max(availc(p),0.0_r8) - - ! test for an xsmrpool deficit - if (xsmrpool(p) < 0.0_r8) then - ! Running a deficit in the xsmrpool, so the first priority is to let - ! some availc from this timestep accumulate in xsmrpool. - ! Determine rate of recovery for xsmrpool deficit - - xsmrpool_recover(p) = -xsmrpool(p)/(dayscrecover*secspday) - if (xsmrpool_recover(p) < availc(p)) then - ! available carbon reduced by amount for xsmrpool recovery - availc(p) = availc(p) - xsmrpool_recover(p) - else - ! all of the available carbon goes to xsmrpool recovery - xsmrpool_recover(p) = availc(p) - availc(p) = 0.0_r8 - end if - cpool_to_xsmrpool(p) = xsmrpool_recover(p) - end if - - f1 = froot_leaf(ivt(p)) - f2 = croot_stem(ivt(p)) - - ! modified wood allocation to be 2.2 at npp=800 gC/m2/yr, 0.2 at npp=0, - ! constrained so that it does not go lower than 0.2 (under negative annsum_npp) - ! This variable allocation is only for trees. Shrubs have a constant - ! allocation as specified in the pft-physiologfy file. The value is also used - ! as a trigger here: -1.0 means to use the dynamic allocation (trees). - - if (stem_leaf(ivt(p)) == -1._r8) then - f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4 - else - f3 = stem_leaf(ivt(p)) - end if - - f4 = flivewd(ivt(p)) - g1 = grperc(ivt(p)) - g2 = grpnow(ivt(p)) - cnl = leafcn(ivt(p)) - cnfr = frootcn(ivt(p)) - cnlw = livewdcn(ivt(p)) - cndw = deadwdcn(ivt(p)) - - ! calculate f1 to f5 for prog crops following AgroIBIS subr phenocrop - - f5 = 0._r8 ! continued intializations from above - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - if (croplive(p)) then - ! same phases appear in subroutine CropPhenology - - ! Phase 1 completed: - ! ================== - ! if hui is less than the number of gdd needed for filling of grain - ! leaf emergence also has to have taken place for lai changes to occur - ! and carbon assimilation - ! Next phase: leaf emergence to start of leaf decline - - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p)) then - - ! allocation rules for crops based on maturity and linear decrease - ! of amount allocated to roots over course of the growing season - - if (peaklai(p) == 1) then ! lai at maximum allowed - arepr(p) = 0._r8 - aleaf(p) = 1.e-5_r8 - astem(p) = 0._r8 - aroot(p) = 1._r8 - arepr(p) - aleaf(p) - astem(p) - else - arepr(p) = 0._r8 - aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - & - (arooti(ivt(p)) - arootf(ivt(p))) * & - min(1._r8, hui(p)/gddmaturity(p)))) - fleaf = fleafi(ivt(p)) * (exp(-bfact(ivt(p))) - & - exp(-bfact(ivt(p))*hui(p)/huigrain(p))) / & - (exp(-bfact(ivt(p)))-1) ! fraction alloc to leaf (from J Norman alloc curve) - aleaf(p) = max(1.e-5_r8, (1._r8 - aroot(p)) * fleaf) - astem(p) = 1._r8 - arepr(p) - aleaf(p) - aroot(p) - end if - - ! AgroIBIS included here an immediate adjustment to aleaf & astem if the - ! predicted lai from the above allocation coefficients exceeded laimx. - ! We have decided to live with lais slightly higher than laimx by - ! enforcing the cap in the following tstep through the peaklai logic above. - - astemi(p) = astem(p) ! save for use by equations after shift - aleafi(p) = aleaf(p) ! to reproductive phenology stage begins - grain_flag(p) = 0._r8 ! setting to 0 while in phase 2 - - ! Phase 2 completed: - ! ================== - ! shift allocation either when enough gdd are accumulated or maximum number - ! of days has elapsed since planting - - else if (hui(p) >= huigrain(p)) then - - aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - & - (arooti(ivt(p)) - arootf(ivt(p))) * min(1._r8, hui(p)/gddmaturity(p)))) - if (astemi(p) > astemf(ivt(p))) then - astem(p) = max(0._r8, max(astemf(ivt(p)), astem(p) * & - (1._r8 - min((hui(p)- & - huigrain(p))/((gddmaturity(p)*declfact(ivt(p)))- & - huigrain(p)),1._r8)**allconss(ivt(p)) ))) - end if - if (aleafi(p) > aleaff(ivt(p))) then - aleaf(p) = max(1.e-5_r8, max(aleaff(ivt(p)), aleaf(p) * & - (1._r8 - min((hui(p)- & - huigrain(p))/((gddmaturity(p)*declfact(ivt(p)))- & - huigrain(p)),1._r8)**allconsl(ivt(p)) ))) - end if - - !Beth's retranslocation of leafn, stemn, rootn to organ - !Filter excess plant N to retransn pool for organ N - !Only do one time then hold grain_flag till onset next season - - ! slevis: Will astem ever = astemf exactly? - ! Beth's response: ...looks like astem can equal astemf under the right circumstances. - !It might be worth a rewrite to capture what I was trying to do, but the retranslocation for - !corn and wheat begins at the beginning of the grain fill stage, but for soybean I was holding it - !until after the leaf and stem decline were complete. Looking at how astem is calculated, once the - !stem decline is near complete, astem should (usually) be set to astemf. The reason for holding off - !on soybean is that the retranslocation scheme begins at the beginning of the grain phase, when the - !leaf and stem are still growing, but declining. Since carbon is still getting allocated and now - !there is more nitrogen available, the nitrogen can be diverted from grain. For corn and wheat - !the impact was probably enough to boost productivity, but for soybean the nitrogen was better off - !fulfilling the grain fill. It seems that if the peak lai is reached for soybean though that this - !would be bypassed altogether, not the intended outcome. I checked several of my output files and - !they all seemed to be going through the retranslocation loop for soybean - good news. - - if (astem(p) == astemf(ivt(p)) .or. & - (ivt(p) /= ntmp_soybean .and. ivt(p) /= nirrig_tmp_soybean .and.& - ivt(p) /= ntrp_soybean .and. ivt(p) /= nirrig_trp_soybean)) then - if (grain_flag(p) == 0._r8)then - if(.not.use_fun) then - t1 = 1 / dt - leafn_to_retransn(p) = t1 * ((leafc(p) / leafcn(ivt(p))) - (leafc(p) / & - fleafcn(ivt(p)))) - livestemn_to_retransn(p) = t1 * ((livestemc(p) / livewdcn(ivt(p))) - (livestemc(p) / & - fstemcn(ivt(p)))) - frootn_to_retransn(p) = 0._r8 - if (ffrootcn(ivt(p)) > 0._r8) then - frootn_to_retransn(p) = t1 * ((frootc(p) / frootcn(ivt(p))) - (frootc(p) / & - ffrootcn(ivt(p)))) - end if - else !leafn retrans flux is handled in phenology - frootn_to_retransn(p) = 0._r8 - livestemn_to_retransn(p)=0.0_r8 - end if !fun - grain_flag(p) = 1._r8 - end if - end if - - arepr(p) = 1._r8 - aroot(p) - astem(p) - aleaf(p) - - else ! pre emergence - aleaf(p) = 1.e-5_r8 ! allocation coefficients should be irrelevant - astem(p) = 0._r8 ! because crops have no live carbon pools; - aroot(p) = 0._r8 ! this applies to this "else" and to the "else" - arepr(p) = 0._r8 ! a few lines down - end if - - f1 = aroot(p) / aleaf(p) - f3 = astem(p) / aleaf(p) - f5 = arepr(p) / aleaf(p) - g1 = 0.25_r8 - - else ! .not croplive - f1 = 0._r8 - f3 = 0._r8 - f5 = 0._r8 - g1 = 0.25_r8 - end if - end if - - ! based on available C, use constant allometric relationships to - ! determine N requirements - - !RF. I removed the growth respiration from this, because it is used to calculate - !plantCN for N uptake AND c_allometry for allocation. If we add gresp to the - !allometry calculation then we allocate too much carbon since gresp is not allocated here. - if(.not.use_fun)then - if (woody(ivt(p)) == 1.0_r8) then - c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else if (ivt(p) >= npcropmin) then ! skip generic crops - cng = graincn(ivt(p)) - c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + f5/cng + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else - c_allometry(p) = 1._r8+g1+f1+f1*g1 - n_allometry(p) = 1._r8/cnl + f1/cnfr - end if - else !no FUN. - if (woody(ivt(p)) == 1.0_r8) then - c_allometry(p) = (1._r8)*(1._r8+f1+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else if (ivt(p) >= npcropmin) then ! skip generic crops - cng = graincn(ivt(p)) - c_allometry(p) = (1._r8)*(1._r8+f1+f5+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + f5/cng + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else - c_allometry(p) = 1._r8+f1 - n_allometry(p) = 1._r8/cnl + f1/cnfr - end if - end if !use_fun - - plant_ndemand(p) = availc(p)*(n_allometry(p)/c_allometry(p)) - - ! retranslocated N deployment depends on seasonal cycle of potential GPP - ! (requires one year run to accumulate demand) - - tempsum_potential_gpp(p) = tempsum_potential_gpp(p) + gpp(p) - - ! Adding the following line to carry max retransn info to CN Annual Update - tempmax_retransn(p) = max(tempmax_retransn(p),retransn(p)) - - ! Beth's code: crops pull from retransn pool only during grain fill; - ! retransn pool has N from leaves, stems, and roots for - ! retranslocation - - if(.not.use_fun)then - - if (ivt(p) >= npcropmin .and. grain_flag(p) == 1._r8) then - avail_retransn(p) = plant_ndemand(p) - else if (ivt(p) < npcropmin .and. annsum_potential_gpp(p) > 0._r8) then - avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt - else - avail_retransn(p) = 0.0_r8 - end if - - ! make sure available retrans N doesn't exceed storage - avail_retransn(p) = min(avail_retransn(p), retransn(p)/dt) - - ! modify plant N demand according to the availability of - ! retranslocated N - ! take from retransn pool at most the flux required to meet - ! plant ndemand - - if (plant_ndemand(p) > avail_retransn(p)) then - retransn_to_npool(p) = avail_retransn(p) - else - retransn_to_npool(p) = plant_ndemand(p) - end if - - if ( .not. use_fun ) then - plant_ndemand(p) = plant_ndemand(p) - retransn_to_npool(p) - else - if (season_decid(ivt(p)) == 1._r8.or.stress_decid(ivt(p))==1._r8) then - plant_ndemand(p) = plant_ndemand(p) - retransn_to_npool(p) - end if - end if - - end if !use_fun - - end do ! end patch loop - - end associate - - end subroutine calc_plant_nitrogen_demand - -end module NutrientCompetitionCLM45defaultMod diff --git a/src/biogeochem/NutrientCompetitionFactoryMod.F90 b/src/biogeochem/NutrientCompetitionFactoryMod.F90 deleted file mode 100644 index 99daa738ff..0000000000 --- a/src/biogeochem/NutrientCompetitionFactoryMod.F90 +++ /dev/null @@ -1,87 +0,0 @@ -module NutrientCompetitionFactoryMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Factory to create an instance of nutrient_competition_method_type. This module figures - ! out the particular type to return. - ! - ! !USES: - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - - implicit none - save - private - ! - ! !PUBLIC ROUTINES: - public :: create_nutrient_competition_method ! create an object of class nutrient_competition_method_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - function create_nutrient_competition_method(bounds) result(nutrient_competition_method) - ! - ! !DESCRIPTION: - ! Create and return an object of nutrient_competition_method_type. The particular type - ! is determined based on a namelist parameter. - ! - ! !USES: - use shr_kind_mod , only : SHR_KIND_CL - use NutrientCompetitionMethodMod , only : nutrient_competition_method_type - use NutrientCompetitionCLM45defaultMod, only : nutrient_competition_clm45default_type - use NutrientCompetitionFlexibleCNMod , only : nutrient_competition_FlexibleCN_type - use decompMod , only : bounds_type - - ! FIXME(bja, 2015-06) need to pass method control in as a parameter - ! instead of relying on a global! - use clm_varctl, only : use_flexibleCN - - ! - ! !ARGUMENTS: - class(nutrient_competition_method_type), allocatable :: nutrient_competition_method ! function result - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - ! For now, hard-code the method. Eventually this will be set from namelist, either by - ! this routine (appropriate if the 'method' is in its own namelist group), or do the - ! namelist read outside this module and pass the method in as a parameter (appropriate - ! if the 'method' is part of a larger namelist group). - character(len=SHR_KIND_CL) :: method - - character(len=*), parameter :: subname = 'create_nutrient_competition_method' - !----------------------------------------------------------------------- - - ! FIXME(bja, 2015-06) flexible_cn may need to be - ! merged with other nitrogen code, so a more robust method of - ! selecting the competition method will depend on how the science - ! is merged. - method = "clm45default" - if (use_flexibleCN) then - method = "flexible_cn" - end if - - select case (trim(method)) - - case ("clm45default") - allocate(nutrient_competition_method, & - source=nutrient_competition_clm45default_type()) - - case ("flexible_cn") - allocate(nutrient_competition_method, & - source=nutrient_competition_FlexibleCN_type()) - - case default - write(iulog,*) subname//' ERROR: unknown method: ', method - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end select - call nutrient_competition_method%Init(bounds) - - end function create_nutrient_competition_method - -end module NutrientCompetitionFactoryMod diff --git a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 b/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 deleted file mode 100644 index f404ac9611..0000000000 --- a/src/biogeochem/NutrientCompetitionFlexibleCNMod.F90 +++ /dev/null @@ -1,1773 +0,0 @@ -module NutrientCompetitionFlexibleCNMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! DESCRIPTION - ! module contains different subroutines to do soil nutrient competition dynamics - ! - ! FIXME(bja, 2015-08) This module was copied from - ! NutrientCompetitionCLM45default then flexible cn modifications - ! were added for the clm50 nitrogen science changes (r120). There is - ! a significant amount of duplicate code between the two - ! modules. They need to be reexamined and the common code pulled out - ! into a common base class. - ! - ! created by Jinyun Tang, Sep 8, 2014 - ! modified by Mariana Vertenstein, Nov 15, 2014 - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use NutrientCompetitionMethodMod, only : nutrient_competition_method_type - use NutrientCompetitionMethodMod, only : params_inst - use clm_varctl , only : iulog - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: nutrient_competition_FlexibleCN_type - ! - type, extends(nutrient_competition_method_type) :: nutrient_competition_FlexibleCN_type - private - real(r8), pointer :: actual_leafcn(:) ! leaf CN ratio used by flexible CN - real(r8), pointer :: actual_storage_leafcn(:) ! storage leaf CN ratio used by flexible CN - contains - ! public methocs - procedure, public :: Init ! Initialization - procedure, public :: calc_plant_nutrient_competition ! calculate nutrient yield rate from competition - procedure, public :: calc_plant_nutrient_demand ! calculate plant nutrient demand - ! - ! private methods - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: calc_plant_cn_alloc - procedure, private :: calc_plant_nitrogen_demand - end type nutrient_competition_FlexibleCN_type - ! - interface nutrient_competition_FlexibleCN_type - ! initialize a new nutrient_competition_FlexibleCN_type object - module procedure constructor - end interface nutrient_competition_FlexibleCN_type - ! - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - type(nutrient_competition_FlexibleCN_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type nutrient_competition_FlexibleCN_type. - ! For now, this is simply a place-holder. - end function constructor - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize the class - ! - class(nutrient_competition_FlexibleCN_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate memory for the class data - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! !ARGUMENTS: - class(nutrient_competition_FlexibleCN_type) :: this - type(bounds_type), intent(in) :: bounds - - allocate(this%actual_leafcn(bounds%begp:bounds%endp)) ; this%actual_leafcn(:) = nan - allocate(this%actual_storage_leafcn(bounds%begp:bounds%endp)) ; this%actual_storage_leafcn(:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Send data to history file - ! - ! !USES: - use histFileMod , only : hist_addfld1d - use clm_varcon , only : spval - ! - ! !ARGUMENTS: - class(nutrient_competition_FlexibleCN_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - - this%actual_leafcn(begp:endp) = spval - call hist_addfld1d (fname='LEAFCN', units='gC/gN', & - avgflag='A', long_name='Leaf CN ratio used for flexible CN', & - ptr_patch=this%actual_leafcn ) - this%actual_storage_leafcn(begp:endp) = spval - call hist_addfld1d (fname='LEAFCN_STORAGE', units='gC/gN', & - avgflag='A', long_name='Storage Leaf CN ratio used for flexible CN', & - ptr_patch=this%actual_storage_leafcn, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine calc_plant_nutrient_competition (this, & - bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, cnveg_carbonstate_inst, & - cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_nitrogenstate_inst, & - aroot, arepr, fpg_col) - ! - ! !USES: - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CanopyStateType , only : canopystate_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - ! - ! !ARGUMENTS: - class(nutrient_competition_FlexibleCN_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - real(r8), intent(in) :: aroot (bounds%begp:) - real(r8), intent(in) :: arepr (bounds%begp:) - real(r8), intent(in) :: fpg_col (bounds%begc:) - - call this%calc_plant_cn_alloc(bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, c13_cnveg_carbonflux_inst, & - c14_cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_nitrogenstate_inst, & - aroot=aroot(bounds%begp:bounds%endp), & - arepr=arepr(bounds%begp:bounds%endp), & - fpg_col=fpg_col(bounds%begc:bounds%endc)) - - end subroutine calc_plant_nutrient_competition - -!----------------------------------------------------------------------- - subroutine calc_plant_cn_alloc(this, bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, c13_cnveg_carbonflux_inst, & - c14_cnveg_carbonflux_inst, cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_nitrogenstate_inst, & - aroot, arepr, fpg_col) - ! - ! !USES: - use pftconMod , only : pftcon, npcropmin - use clm_varctl , only : use_c13, use_c14, carbon_resp_opt - use clm_varctl , only : downreg_opt - use clm_varctl , only : CN_residual_opt - use clm_varctl , only : CN_partition_opt - use clm_time_manager , only : get_step_size - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CanopyStateType , only : canopystate_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use CNSharedParamsMod , only : use_fun - use CNPrecisionControlMod , only : n_min - use clm_varcon , only : spval - - ! - ! !ARGUMENTS: - class(nutrient_competition_FlexibleCN_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - real(r8) , intent(in) :: aroot(bounds%begp:) - real(r8) , intent(in) :: arepr(bounds%begp:) - real(r8) , intent(in) :: fpg_col(bounds%begc:) - ! - ! !LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp ! lake filter patch index - real(r8) :: f1,f2,f3,f4,g1,g2 ! allocation parameters - real(r8) :: cnl,cnfr,cnlw,cndw ! C:N ratios for leaf, fine root, and wood - real(r8) :: fcur ! fraction of current psn displayed as growth - real(r8) :: gresp_storage ! temporary variable for growth resp to storage - real(r8) :: nlc ! temporary variable for total new leaf carbon allocation - real(r8) :: f5 ! grain allocation parameter - real(r8) :: cng ! C:N ratio for grain (= cnlw for now; slevis) - real(r8) :: dt ! model time step - real(r8):: fsmn(bounds%begp:bounds%endp) ! A emperate variable for adjusting FUN uptakes - - real(r8):: frootcn_storage_actual - real(r8):: frootcn_actual - real(r8):: livestemcn_storage_actual - real(r8):: livestemcn_actual - real(r8):: livecrootcn_storage_actual - real(r8):: livecrootcn_actual - real(r8):: leafcn_max - real(r8):: frootcn_max - real(r8):: livewdcn_max - real(r8):: frac_resp - real(r8) :: npool_to_leafn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_leafn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_leafn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_leafn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_frootn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_frootn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_frootn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_frootn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_livestemn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_livestemn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_livestemn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_livestemn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_livecrootn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_livecrootn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_livecrootn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_livecrootn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadstemn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadstemn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadstemn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadstemn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadcrootn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadcrootn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadcrootn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_deadcrootn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_grainn_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_grainn_supply (bounds%begp:bounds%endp) - real(r8) :: npool_to_grainn_storage_demand (bounds%begp:bounds%endp) - real(r8) :: npool_to_grainn_storage_supply (bounds%begp:bounds%endp) - real(r8) :: total_plant_Ndemand (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_leafn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_leafn_storage (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_frootn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_frootn_storage (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_livestemn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_livestemn_storage (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_deadstemn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_deadstemn_storage (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_livecrootn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_livecrootn_storage (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_deadcrootn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_deadcrootn_storage (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_grainn (bounds%begp:bounds%endp) - real(r8) :: frNdemand_npool_to_grainn_storage (bounds%begp:bounds%endp) - - ! ----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fpg_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_storage_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_storage_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - - associate( & - fpg => fpg_col , & ! Input: [real(r8) (:) ] fraction of potential gpp (no units) - - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - froot_leaf => pftcon%froot_leaf , & ! Input: allocation parameter: new fine root C per new leaf C (gC/gC) - croot_stem => pftcon%croot_stem , & ! Input: allocation parameter: new coarse root C per new stem C (gC/gC) - stem_leaf => pftcon%stem_leaf , & ! Input: allocation parameter: new stem c per new leaf C (gC/gC) - flivewd => pftcon%flivewd , & ! Input: allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) - fcur2 => pftcon%fcur , & ! Input: allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) - grperc => pftcon%grperc , & ! Input: growth respiration parameter - grpnow => pftcon%grpnow , & ! Input: growth respiration parameter - evergreen => pftcon%evergreen , & ! Input: binary flag for evergreen leaf habit (0 or 1) - - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] flag, true if planted, not harvested - - peaklai => cnveg_state_inst%peaklai_patch , & ! Input: [integer (:) ] 1: max allowed lai; 0: not at max - aleaf => cnveg_state_inst%aleaf_patch , & ! Output: [real(r8) (:) ] leaf allocation coefficient - astem => cnveg_state_inst%astem_patch , & ! Output: [real(r8) (:) ] stem allocation coefficient - c_allometry => cnveg_state_inst%c_allometry_patch , & ! Output: [real(r8) (:) ] C allocation index (DIM) - n_allometry => cnveg_state_inst%n_allometry_patch , & ! Output: [real(r8) (:) ] N allocation index (DIM) - downreg => cnveg_state_inst%downreg_patch , & ! Output: [real(r8) (:) ] fractional reduction in GPP due to N limitation (DIM) - - annsum_npp => cnveg_carbonflux_inst%annsum_npp_patch , & ! Input: [real(r8) (:) ] annual sum of NPP, for wood allocation - gpp => cnveg_carbonflux_inst%gpp_before_downreg_patch , & ! Output: [real(r8) (:) ] GPP flux before downregulation (gC/m2/s) - availc => cnveg_carbonflux_inst%availc_patch , & ! Output: [real(r8) (:) ] C flux available for allocation (gC/m2/s) - excess_cflux => cnveg_carbonflux_inst%excess_cflux_patch , & ! Output: [real(r8) (:) ] C flux not allocated due to downregulation (gC/m2/s) - plant_calloc => cnveg_carbonflux_inst%plant_calloc_patch , & ! Output: [real(r8) (:) ] total allocated C flux (gC/m2/s) - npp_growth => cnveg_carbonflux_inst%npp_growth_patch , & ! Output: [real(r8) (:) ] C for growth in FUN. g/m2/s - cpool_to_resp => cnveg_carbonflux_inst%cpool_to_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_leafc_resp => cnveg_carbonflux_inst%cpool_to_leafc_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_leafc_storage_resp => cnveg_carbonflux_inst%cpool_to_leafc_storage_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_frootc_resp => cnveg_carbonflux_inst%cpool_to_frootc_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_frootc_storage_resp => cnveg_carbonflux_inst%cpool_to_frootc_storage_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_livecrootc_resp => cnveg_carbonflux_inst%cpool_to_livecrootc_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_livecrootc_storage_resp => cnveg_carbonflux_inst%cpool_to_livecrootc_storage_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_livestemc_resp => cnveg_carbonflux_inst%cpool_to_livestemc_resp_patch , & ! Output: [real(r8) (:) ] - cpool_to_livestemc_storage_resp => cnveg_carbonflux_inst%cpool_to_livestemc_storage_resp_patch , & ! Output: [real(r8) (:) ] - psnsun_to_cpool => cnveg_carbonflux_inst%psnsun_to_cpool_patch , & ! Output: [real(r8) (:) ] - psnshade_to_cpool => cnveg_carbonflux_inst%psnshade_to_cpool_patch , & ! Output: [real(r8) (:) ] - cpool_to_leafc => cnveg_carbonflux_inst%cpool_to_leafc_patch , & ! Output: [real(r8) (:) ] - cpool_to_leafc_storage => cnveg_carbonflux_inst%cpool_to_leafc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_frootc => cnveg_carbonflux_inst%cpool_to_frootc_patch , & ! Output: [real(r8) (:) ] - cpool_to_frootc_storage => cnveg_carbonflux_inst%cpool_to_frootc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_livestemc => cnveg_carbonflux_inst%cpool_to_livestemc_patch , & ! Output: [real(r8) (:) ] - cpool_to_livestemc_storage => cnveg_carbonflux_inst%cpool_to_livestemc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadstemc => cnveg_carbonflux_inst%cpool_to_deadstemc_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadstemc_storage => cnveg_carbonflux_inst%cpool_to_deadstemc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_livecrootc => cnveg_carbonflux_inst%cpool_to_livecrootc_patch , & ! Output: [real(r8) (:) ] - cpool_to_livecrootc_storage => cnveg_carbonflux_inst%cpool_to_livecrootc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadcrootc => cnveg_carbonflux_inst%cpool_to_deadcrootc_patch , & ! Output: [real(r8) (:) ] - cpool_to_deadcrootc_storage => cnveg_carbonflux_inst%cpool_to_deadcrootc_storage_patch , & ! Output: [real(r8) (:) ] - cpool_to_gresp_storage => cnveg_carbonflux_inst%cpool_to_gresp_storage_patch , & ! Output: [real(r8) (:) ] allocation to growth respiration storage (gC/m2/s) - cpool_to_grainc => cnveg_carbonflux_inst%cpool_to_grainc_patch , & ! Output: [real(r8) (:) ] allocation to grain C (gC/m2/s) - cpool_to_grainc_storage => cnveg_carbonflux_inst%cpool_to_grainc_storage_patch , & ! Output: [real(r8) (:) ] allocation to grain C storage (gC/m2/s) - - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3) soil mineral NO3 - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - npool => cnveg_nitrogenstate_inst%npool_patch , & ! Input: [real(r8) (:) ] (gN/m2) temporary plant N pool - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Output: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) - plant_nalloc => cnveg_nitrogenflux_inst%plant_nalloc_patch , & ! Output: [real(r8) (:) ] total allocated N flux (gN/m2/s) - npool_to_grainn => cnveg_nitrogenflux_inst%npool_to_grainn_patch , & ! Output: [real(r8) (:) ] allocation to grain N (gN/m2/s) - npool_to_grainn_storage => cnveg_nitrogenflux_inst%npool_to_grainn_storage_patch , & ! Output: [real(r8) (:) ] allocation to grain N storage (gN/m2/s) - retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of retranslocated N (gN/m2/s) - sminn_to_npool => cnveg_nitrogenflux_inst%sminn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of soil mineral N uptake (gN/m2/s) - npool_to_leafn => cnveg_nitrogenflux_inst%npool_to_leafn_patch , & ! Output: [real(r8) (:) ] allocation to leaf N (gN/m2/s) - npool_to_leafn_storage => cnveg_nitrogenflux_inst%npool_to_leafn_storage_patch , & ! Output: [real(r8) (:) ] allocation to leaf N storage (gN/m2/s) - npool_to_frootn => cnveg_nitrogenflux_inst%npool_to_frootn_patch , & ! Output: [real(r8) (:) ] allocation to fine root N (gN/m2/s) - npool_to_frootn_storage => cnveg_nitrogenflux_inst%npool_to_frootn_storage_patch , & ! Output: [real(r8) (:) ] allocation to fine root N storage (gN/m2/s) - npool_to_livestemn => cnveg_nitrogenflux_inst%npool_to_livestemn_patch , & ! Output: [real(r8) (:) ] - npool_to_livestemn_storage => cnveg_nitrogenflux_inst%npool_to_livestemn_storage_patch , & ! Output: [real(r8) (:) ] - npool_to_deadstemn => cnveg_nitrogenflux_inst%npool_to_deadstemn_patch , & ! Output: [real(r8) (:) ] - npool_to_deadstemn_storage => cnveg_nitrogenflux_inst%npool_to_deadstemn_storage_patch , & ! Output: [real(r8) (:) ] - npool_to_livecrootn => cnveg_nitrogenflux_inst%npool_to_livecrootn_patch , & ! Output: [real(r8) (:) ] - npool_to_livecrootn_storage => cnveg_nitrogenflux_inst%npool_to_livecrootn_storage_patch , & ! Output: [real(r8) (:) ] - npool_to_deadcrootn => cnveg_nitrogenflux_inst%npool_to_deadcrootn_patch , & ! Output: [real(r8) (:) ] - npool_to_deadcrootn_storage => cnveg_nitrogenflux_inst%npool_to_deadcrootn_storage_patch , & ! Output: [real(r8) (:) ] - Npassive => cnveg_nitrogenflux_inst%Npassive_patch , & ! Output: [real(r8) (:) ] Passive N uptake (gN/m2/s) - Nfix => cnveg_nitrogenflux_inst%Nfix_patch , & ! Output: [real(r8) (:) ] Symbiotic BNF (gN/m2/s) - Nactive => cnveg_nitrogenflux_inst%Nactive_patch , & ! Output: [real(r8) (:) ] Mycorrhizal N uptake (gN/m2/s) - Nnonmyc => cnveg_nitrogenflux_inst%Nnonmyc_patch , & ! Output: [real(r8) (:) ] Non-mycorrhizal N uptake (gN/m2/s) - Nam => cnveg_nitrogenflux_inst%Nam_patch , & ! Output: [real(r8) (:) ] AM uptake (gN/m2/s) - Necm => cnveg_nitrogenflux_inst%Necm_patch , & ! Output: [real(r8) (:) ] ECM uptake (gN/m2/s) - sminn_to_plant_fun => cnveg_nitrogenflux_inst%sminn_to_plant_fun_patch & ! Output: [real(r8) (:) ] Total soil N uptake of FUN (gN/m2/s) - - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! patch loop to distribute the available N between the competing patches - ! on the basis of relative demand, and allocate C and N to new growth and storage - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - ! set some local allocation variables - f1 = froot_leaf(ivt(p)) - f2 = croot_stem(ivt(p)) - - ! modified wood allocation to be 2.2 at npp=800 gC/m2/yr, 0.2 at npp=0, - ! constrained so that it does not go lower than 0.2 (under negative annsum_npp) - ! There was an error in this formula in previous version, where the coefficient - ! was 0.004 instead of 0.0025. - ! This variable allocation is only for trees. Shrubs have a constant - ! allocation as specified in the pft-physiology file. The value is also used - ! as a trigger here: -1.0 means to use the dynamic allocation (trees). - if (stem_leaf(ivt(p)) == -1._r8) then - f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4 - else - f3 = stem_leaf(ivt(p)) - end if - - f4 = flivewd(ivt(p)) - g1 = grperc(ivt(p)) - g2 = grpnow(ivt(p)) - cnl = leafcn(ivt(p)) - cnfr = frootcn(ivt(p)) - cnlw = livewdcn(ivt(p)) - cndw = deadwdcn(ivt(p)) - fcur = fcur2(ivt(p)) - - if (.not. downreg_opt) then - if (evergreen(ivt(p)) == 1._r8) then - fcur = 0.0_r8 - end if - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - if (croplive(p)) then - f1 = aroot(p) / aleaf(p) - f3 = astem(p) / aleaf(p) - f5 = arepr(p) / aleaf(p) - g1 = 0.25_r8 - else - f1 = 0._r8 - f3 = 0._r8 - f5 = 0._r8 - g1 = 0.25_r8 - end if - end if - - ! increase fcur linearly with ndays_active, until fcur reaches 1.0 at - ! ndays_active = days/year. This prevents the continued storage of C and N. - ! turning off this correction (PET, 12/11/03), instead using bgtr in - ! phenology algorithm. - - - if(use_fun)then ! if we are using FUN, we get the N available from there. - sminn_to_npool(p) = sminn_to_plant_fun(p) - else ! no FUN. :( we get N available from the FPG calculation in soilbiogeochemistry competition. - sminn_to_npool(p) = plant_ndemand(p) * fpg(c) - endif - - plant_nalloc(p) = sminn_to_npool(p) + retransn_to_npool(p) - - if(.not.use_fun)then - if (downreg_opt) then - ! calculate the associated carbon allocation, and the excess - ! carbon flux that must be accounted for through downregulation - plant_calloc(p) = plant_nalloc(p) * (c_allometry(p)/n_allometry(p)) - excess_cflux(p) = availc(p) - plant_calloc(p) - - ! reduce gpp fluxes due to N limitation - if (gpp(p) > 0.0_r8) then - downreg(p) = excess_cflux(p)/gpp(p) - - psnsun_to_cpool(p) = psnsun_to_cpool(p) *(1._r8 - downreg(p)) - psnshade_to_cpool(p) = psnshade_to_cpool(p)*(1._r8 - downreg(p)) - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = & - c13_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) *(1._r8 - downreg(p)) - c13_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = & - c13_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p)*(1._r8 - downreg(p)) - endif - if ( use_c14 ) then - c14_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = & - c14_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) *(1._r8 - downreg(p)) - c14_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = & - c14_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p)*(1._r8 - downreg(p)) - endif - end if - end if - end if - - - if(use_fun)then - plant_calloc(p) = npp_growth(p) - else - if (.not. downreg_opt) then - plant_calloc(p) = availc(p) - end if - end if - - ! calculate the amount of new leaf C dictated by these allocation - ! decisions, and calculate the daily fluxes of C and N to current - ! growth and storage pools - - ! fcur is the proportion of this day's growth that is displayed now, - ! the remainder going into storage for display next year through the - ! transfer pools - - nlc = plant_calloc(p) / c_allometry(p) - - cpool_to_leafc(p) = nlc * fcur - cpool_to_leafc_storage(p) = nlc * (1._r8 - fcur) - cpool_to_frootc(p) = nlc * f1 * fcur - cpool_to_frootc_storage(p) = nlc * f1 * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - cpool_to_livestemc(p) = nlc * f3 * f4 * fcur - cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) - cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur - cpool_to_deadstemc_storage(p) = nlc * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_livecrootc(p) = nlc * f2 * f3 * f4 * fcur - cpool_to_livecrootc_storage(p) = nlc * f2 * f3 * f4 * (1._r8 - fcur) - cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur - cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool_to_livestemc(p) = nlc * f3 * f4 * fcur - cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) - cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur - cpool_to_deadstemc_storage(p) = nlc * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_livecrootc(p) = nlc * f2 * f3 * f4 * fcur - cpool_to_livecrootc_storage(p) = nlc * f2 * f3 * f4 * (1._r8 - fcur) - cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur - cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_grainc(p) = nlc * f5 * fcur - cpool_to_grainc_storage(p) = nlc * f5 * (1._r8 -fcur) - end if - - if (downreg_opt) then - ! corresponding N fluxes - npool_to_leafn(p) = (nlc / cnl) * fcur - npool_to_leafn_storage(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_frootn(p) = (nlc * f1 / cnfr) * fcur - npool_to_frootn_storage(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cng = graincn(ivt(p)) - npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_grainn(p) = (nlc * f5 / cng) * fcur - npool_to_grainn_storage(p) = (nlc * f5 / cng) * (1._r8 -fcur) - end if - end if - - if (downreg_opt .eqv. .false. .AND. CN_partition_opt == 0) then - - ! N transfer depends on supply and demand - npool_to_frootn_demand(p) = (nlc * f1 / cnfr) * fcur - npool_to_frootn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) = max(min(npool_to_frootn_supply(p),npool_to_frootn_demand(p)),0.0_r8) - - npool_to_frootn_storage_demand(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - npool_to_frootn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) = max(min(npool_to_frootn_storage_supply(p),npool_to_frootn_storage_demand(p)),0.0_r8) - - npool_to_leafn_demand(p) = (nlc / cnl) * fcur - npool_to_leafn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_leafn(p) = max(min(npool_to_leafn_supply(p),npool_to_leafn_demand(p)),0.0_r8) - - npool_to_leafn_storage_demand(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_leafn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - npool_to_leafn_storage(p) = max(min(npool_to_leafn_storage_supply(p),npool_to_leafn_storage_demand(p)),0.0_r8) - - if (CN_residual_opt == 1) then - npool_to_leafn(p) = max(npool_to_leafn_supply(p),0.0_r8) - npool_to_leafn_storage(p) = max(npool_to_leafn_storage_supply(p),0.0_r8) - end if - - if (woody(ivt(p)) == 1._r8) then - npool_to_livestemn_demand(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) = max(min(npool_to_livestemn_supply(p),npool_to_livestemn_demand(p)),0.0_r8) - - npool_to_livestemn_storage_demand(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_livestemn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - npool_to_livestemn_storage(p) = max(min(npool_to_livestemn_storage_supply(p), & - npool_to_livestemn_storage_demand(p)),0.0_r8) - - npool_to_livecrootn_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - npool_to_livecrootn(p) = max(min(npool_to_livecrootn_supply(p),npool_to_livecrootn_demand(p)),0.0_r8) - - npool_to_livecrootn_storage_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_livecrootn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) = max(min(npool_to_livecrootn_storage_supply(p), & - npool_to_livecrootn_storage_demand(p)),0.0_r8) - - npool_to_deadstemn_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) = max(min(npool_to_deadstemn_supply(p),npool_to_deadstemn_demand(p)),0.0_r8) - - npool_to_deadstemn_storage_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_deadstemn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) - npool_to_deadstemn_storage(p) = max(min(npool_to_deadstemn_storage_supply(p), & - npool_to_deadstemn_storage_demand(p)),0.0_r8) - - npool_to_deadcrootn_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) - npool_to_deadcrootn(p) = max(min(npool_to_deadcrootn_supply(p),npool_to_deadcrootn_demand(p)),0.0_r8) - - npool_to_deadcrootn_storage_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_deadcrootn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) - npool_to_deadstemn_storage(p) - npool_to_deadcrootn_storage(p) = max(min(npool_to_deadcrootn_storage_supply(p), & - npool_to_deadcrootn_storage_demand(p)),0.0_r8) - - npool_to_leafn_demand(p) = (nlc / cnl) * fcur - npool_to_leafn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) - npool_to_deadcrootn(p) - npool_to_leafn(p) = max(min(npool_to_leafn_supply(p),npool_to_leafn_demand(p)),0.0_r8) - - npool_to_leafn_storage_demand(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_leafn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) - npool_to_deadstemn_storage(p) - & - npool_to_deadcrootn_storage(p) - npool_to_leafn_storage(p) = max(min(npool_to_leafn_storage_supply(p),& - npool_to_leafn_storage_demand(p)),0.0_r8) - - if (CN_residual_opt == 1) then - npool_to_leafn(p) = max(npool_to_leafn_supply(p),0.0_r8) - npool_to_leafn_storage(p) = max(npool_to_leafn_storage_supply(p),0.0_r8) - end if - - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cng = graincn(ivt(p)) - npool_to_livestemn_demand(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) = max(min(npool_to_livestemn_supply(p),npool_to_livestemn_demand(p)),0.0_r8) - - npool_to_livestemn_storage_demand(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_livestemn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - npool_to_livestemn_storage(p) = max(min(npool_to_livestemn_storage_supply(p), & - npool_to_livestemn_storage_demand(p)),0.0_r8) - - npool_to_livecrootn_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - npool_to_livecrootn(p) = max(min(npool_to_livecrootn_supply(p),npool_to_livecrootn_demand(p)),0.0_r8) - - npool_to_livecrootn_storage_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_livecrootn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) = max(min(npool_to_livecrootn_storage_supply(p), & - npool_to_livecrootn_storage_demand(p)),0.0_r8) - - npool_to_deadstemn_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) = max(min(npool_to_deadstemn_supply(p), npool_to_deadstemn_demand(p)), 0.0_r8) - - npool_to_deadstemn_storage_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_deadstemn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) - npool_to_deadstemn_storage(p) = max(min(npool_to_deadstemn_storage_supply(p), & - npool_to_deadstemn_storage_demand(p)),0.0_r8) - - npool_to_deadcrootn_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) - npool_to_deadcrootn(p) = max(min(npool_to_deadcrootn_supply(p), npool_to_deadcrootn_demand(p)), 0.0_r8) - - npool_to_deadcrootn_storage_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_deadcrootn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) - npool_to_deadstemn_storage(p) - npool_to_deadcrootn_storage(p) = max(min(npool_to_deadcrootn_storage_supply(p), & - npool_to_deadcrootn_storage_demand(p)),0.0_r8) - - npool_to_grainn_demand(p) = (nlc * f5 / cng) * fcur - npool_to_grainn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) - npool_to_deadcrootn(p) - npool_to_grainn(p) = max(min(npool_to_grainn_supply(p), npool_to_grainn_demand(p)), 0.0_r8) - - npool_to_grainn_storage_demand(p) = (nlc * f5 / cng) * (1._r8 -fcur) - npool_to_grainn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) - npool_to_deadstemn_storage(p) - & - npool_to_deadcrootn_storage(p) - npool_to_grainn_storage(p) = max(min(npool_to_grainn_storage_supply(p), npool_to_grainn_storage_demand(p)), & - 0.0_r8) - - npool_to_leafn_demand(p) = (nlc / cnl) * fcur - npool_to_leafn_supply(p) = npool(p)/dt * fcur - npool_to_frootn(p) - npool_to_livestemn(p) - & - npool_to_livecrootn(p) - npool_to_deadstemn(p) - npool_to_deadcrootn(p) - npool_to_grainn(p) - npool_to_leafn(p) = max(min(npool_to_leafn_supply(p), npool_to_leafn_demand(p)), 0.0_r8) - - npool_to_leafn_storage_demand(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_leafn_storage_supply(p) = npool(p)/dt * (1._r8 - fcur) - npool_to_frootn_storage(p) - & - npool_to_livestemn_storage(p) - npool_to_livecrootn_storage(p) & - - npool_to_deadstemn_storage(p) - npool_to_deadcrootn_storage(p) - npool_to_grainn_storage(p) - npool_to_leafn_storage(p) = max(min(npool_to_leafn_storage_supply(p), npool_to_leafn_storage_demand(p)), & - 0.0_r8) - - if (CN_residual_opt == 1) then - npool_to_leafn(p) = max(npool_to_leafn_supply(p),0.0_r8) - npool_to_leafn_storage(p) = max(npool_to_leafn_storage_supply(p),0.0_r8) - end if - - end if - - end if - - - ! Calculate the amount of carbon that needs to go into growth - ! respiration storage to satisfy all of the storage growth demands. - ! Allows for the fraction of growth respiration that is released at the - ! time of fixation, versus the remaining fraction that is stored for - ! release at the time of display. Note that all the growth respiration - ! fluxes that get released on a given timestep are calculated in growth_resp(), - ! but that the storage of C for growth resp during display of transferred - ! growth is assigned here. - - gresp_storage = cpool_to_leafc_storage(p) + cpool_to_frootc_storage(p) - if (woody(ivt(p)) == 1._r8) then - gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) - gresp_storage = gresp_storage + cpool_to_deadstemc_storage(p) - - gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) - gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) - gresp_storage = gresp_storage + cpool_to_grainc_storage(p) - end if - cpool_to_gresp_storage(p) = gresp_storage * g1 * (1._r8 - g2) - - - ! computing 1.) fractional N demand and 2.) N allocation after uptake for different plant parts - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if (downreg_opt .eqv. .false. .AND. CN_partition_opt == 1) then - - ! computing nitrogen demand for different pools based on carbon allocated and CN ratio - npool_to_leafn_demand(p) = (nlc / cnl) * fcur - npool_to_leafn_storage_demand(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_frootn_demand(p) = (nlc * f1 / cnfr) * fcur - npool_to_frootn_storage_demand(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - - npool_to_livestemn_demand(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage_demand(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - cng = graincn(ivt(p)) - npool_to_livestemn_demand(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage_demand(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage_demand(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage_demand(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage_demand(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_grainn_demand(p) = (nlc * f5 / cng) * fcur - npool_to_grainn_storage_demand(p) = (nlc * f5 / cng) * (1._r8 -fcur) - end if - - - ! computing 1.) fractional N demand for different plant parts - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - total_plant_Ndemand(p) = npool_to_leafn_demand(p) + npool_to_leafn_storage_demand(p) + & - npool_to_frootn_demand(p) + npool_to_frootn_storage_demand(p) - - if (woody(ivt(p)) == 1._r8) then - - total_plant_Ndemand(p) = npool_to_leafn_demand(p) + npool_to_leafn_storage_demand(p) + & - npool_to_frootn_demand(p) + npool_to_frootn_storage_demand(p) + & - npool_to_livestemn_demand(p) + npool_to_livestemn_storage_demand(p) + npool_to_deadstemn_demand(p) + & - npool_to_deadstemn_storage_demand(p) + & - npool_to_livecrootn_demand(p) + npool_to_livecrootn_storage_demand(p) + npool_to_deadcrootn_demand(p) + & - npool_to_deadcrootn_storage_demand(p) - - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - total_plant_Ndemand(p) = npool_to_leafn_demand(p) + npool_to_leafn_storage_demand(p) + & - npool_to_frootn_demand(p) + npool_to_frootn_storage_demand(p) + & - npool_to_livestemn_demand(p) + npool_to_livestemn_storage_demand(p) + npool_to_deadstemn_demand(p) + & - npool_to_deadstemn_storage_demand(p) + & - npool_to_livecrootn_demand(p) + npool_to_livecrootn_storage_demand(p) + npool_to_deadcrootn_demand(p) + & - npool_to_deadcrootn_storage_demand(p) + & - npool_to_grainn_demand(p) + npool_to_grainn_storage_demand(p) - - end if - - if (total_plant_Ndemand(p) == 0.0_r8) then ! removing division by zero - - frNdemand_npool_to_leafn(p) = 0.0_r8 - frNdemand_npool_to_leafn_storage(p) = 0.0_r8 - frNdemand_npool_to_frootn(p) = 0.0_r8 - frNdemand_npool_to_frootn_storage(p) = 0.0_r8 - if (woody(ivt(p)) == 1._r8) then - - frNdemand_npool_to_livestemn(p) = 0.0_r8 - frNdemand_npool_to_livestemn_storage(p) = 0.0_r8 - frNdemand_npool_to_deadstemn(p) = 0.0_r8 - frNdemand_npool_to_deadstemn_storage(p) = 0.0_r8 - frNdemand_npool_to_livecrootn(p) = 0.0_r8 - frNdemand_npool_to_livecrootn_storage(p) = 0.0_r8 - frNdemand_npool_to_deadcrootn(p) = 0.0_r8 - frNdemand_npool_to_deadcrootn_storage(p) = 0.0_r8 - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - frNdemand_npool_to_livestemn(p) = 0.0_r8 - frNdemand_npool_to_livestemn_storage(p) = 0.0_r8 - frNdemand_npool_to_deadstemn(p) = 0.0_r8 - frNdemand_npool_to_deadstemn_storage(p) = 0.0_r8 - frNdemand_npool_to_livecrootn(p) = 0.0_r8 - frNdemand_npool_to_livecrootn_storage(p) = 0.0_r8 - frNdemand_npool_to_deadcrootn(p) = 0.0_r8 - frNdemand_npool_to_deadcrootn_storage(p) = 0.0_r8 - frNdemand_npool_to_grainn(p) = 0.0_r8 - frNdemand_npool_to_grainn_storage(p) = 0.0_r8 - end if - - else - - frNdemand_npool_to_leafn(p) = npool_to_leafn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_leafn_storage(p) = npool_to_leafn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_frootn(p) = npool_to_frootn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_frootn_storage(p) = npool_to_frootn_storage_demand(p) / total_plant_Ndemand(p) - if (woody(ivt(p)) == 1._r8) then - - frNdemand_npool_to_livestemn(p) = npool_to_livestemn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_livestemn_storage(p) = npool_to_livestemn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadstemn(p) = npool_to_deadstemn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadstemn_storage(p) = npool_to_deadstemn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_livecrootn(p) = npool_to_livecrootn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_livecrootn_storage(p) = npool_to_livecrootn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadcrootn(p) = npool_to_deadcrootn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadcrootn_storage(p) = npool_to_deadcrootn_storage_demand(p) / total_plant_Ndemand(p) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - frNdemand_npool_to_livestemn(p) = npool_to_livestemn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_livestemn_storage(p) = npool_to_livestemn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadstemn(p) = npool_to_deadstemn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadstemn_storage(p) = npool_to_deadstemn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_livecrootn(p) = npool_to_livecrootn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_livecrootn_storage(p) = npool_to_livecrootn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadcrootn(p) = npool_to_deadcrootn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_deadcrootn_storage(p) = npool_to_deadcrootn_storage_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_grainn(p) = npool_to_grainn_demand(p) / total_plant_Ndemand(p) - frNdemand_npool_to_grainn_storage(p) = npool_to_grainn_storage_demand(p) / total_plant_Ndemand(p) - end if - - end if - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - - ! computing N allocation for different plant parts - ! allocating allocation to different plant parts in proportion to the fractional demand - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - npool_to_leafn(p) = frNdemand_npool_to_leafn(p) * npool(p) / dt - npool_to_leafn_storage(p) = frNdemand_npool_to_leafn_storage(p) * npool(p) / dt - npool_to_frootn(p) = frNdemand_npool_to_frootn(p) * npool(p) / dt - npool_to_frootn_storage(p) = frNdemand_npool_to_frootn_storage(p) * npool(p) / dt - if (woody(ivt(p)) == 1._r8) then - npool_to_livestemn(p) = frNdemand_npool_to_livestemn(p) * npool(p) / dt - npool_to_livestemn_storage(p) = frNdemand_npool_to_livestemn_storage(p) * npool(p) / dt - npool_to_deadstemn(p) = frNdemand_npool_to_deadstemn(p) * npool(p) / dt - npool_to_deadstemn_storage(p) = frNdemand_npool_to_deadstemn_storage(p) * npool(p) / dt - npool_to_livecrootn(p) = frNdemand_npool_to_livecrootn(p) * npool(p) / dt - npool_to_livecrootn_storage(p) = frNdemand_npool_to_livecrootn_storage(p) * npool(p) / dt - npool_to_deadcrootn(p) = frNdemand_npool_to_deadcrootn(p) * npool(p) / dt - npool_to_deadcrootn_storage(p) = frNdemand_npool_to_deadcrootn_storage(p) * npool(p) / dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - npool_to_livestemn(p) = frNdemand_npool_to_livestemn(p) * npool(p) / dt - npool_to_livestemn_storage(p) = frNdemand_npool_to_livestemn_storage(p) * npool(p) / dt - npool_to_deadstemn(p) = frNdemand_npool_to_deadstemn(p) * npool(p) / dt - npool_to_deadstemn_storage(p) = frNdemand_npool_to_deadstemn_storage(p) * npool(p) / dt - npool_to_livecrootn(p) = frNdemand_npool_to_livecrootn(p) * npool(p) / dt - npool_to_livecrootn_storage(p) = frNdemand_npool_to_livecrootn_storage(p) * npool(p) / dt - npool_to_deadcrootn(p) = frNdemand_npool_to_deadcrootn(p) * npool(p) / dt - npool_to_deadcrootn_storage(p) = frNdemand_npool_to_deadcrootn_storage(p) * npool(p) / dt - npool_to_grainn(p) = frNdemand_npool_to_grainn(p) * npool(p) / dt - npool_to_grainn_storage(p) = frNdemand_npool_to_grainn_storage(p) * npool(p) / dt - end if - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - - cpool_to_resp(p) = 0.0_r8 - cpool_to_leafc_resp(p) = 0.0_r8 - cpool_to_leafc_storage_resp(p) = 0.0_r8 - cpool_to_frootc_resp(p) = 0.0_r8 - cpool_to_frootc_storage_resp(p) = 0.0_r8 - cpool_to_livecrootc_resp(p) = 0.0_r8 - cpool_to_livecrootc_storage_resp(p) = 0.0_r8 - cpool_to_livestemc_resp(p) = 0.0_r8 - cpool_to_livestemc_storage_resp(p) = 0.0_r8 - - if ( laisun(p)+laisha(p) > 0.0_r8 ) then - if (cnveg_nitrogenstate_inst%leafn_storage_patch(p) == 0.0_r8 ) then - ! to avoid division by zero, and also to make actual_leafncn(p) a very large number if leafn(p) is zero - this%actual_storage_leafcn(p) = spval - else - ! leaf CN ratio - this%actual_storage_leafcn(p) = cnveg_carbonstate_inst%leafc_storage_patch(p) & - / cnveg_nitrogenstate_inst%leafn_storage_patch(p) - end if - end if - - if (carbon_resp_opt == 1 .AND. laisun(p)+laisha(p) > 0.0_r8) then - ! computing carbon to nitrogen ratio of different plant parts - - - if (cnveg_nitrogenstate_inst%frootn_storage_patch(p) == 0.0_r8) then - ! to avoid division by zero, and also to make frootcn_actual(p) a very large number if frootc(p) is zero - frootcn_actual = cnveg_carbonstate_inst%frootc_storage_patch(p) / n_min - else - ! fine root CN ratio - frootcn_actual = cnveg_carbonstate_inst%frootc_storage_patch(p) / cnveg_nitrogenstate_inst%frootn_storage_patch(p) - end if - - if (woody(ivt(p)) == 1._r8) then - - if (cnveg_nitrogenstate_inst%livestemn_storage_patch(p) == 0.0_r8) then - ! to avoid division by zero, and also to make livestemcn_actual(p) a very large number if livestemc(p) is zero - livestemcn_actual = cnveg_carbonstate_inst%livestemc_storage_patch(p) / n_min - else - ! live stem CN ratio - livestemcn_actual = cnveg_carbonstate_inst%livestemc_storage_patch(p) / & - cnveg_nitrogenstate_inst%livestemn_storage_patch(p) - end if - - if (cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) == 0.0_r8) then - ! to avoid division by zero, and also to make livecrootcn_actual(p) a very large number if livecrootc(p) is zero - livecrootcn_actual = cnveg_carbonstate_inst%livecrootc_storage_patch(p) / n_min - else - ! live coarse root CN ratio - livecrootcn_actual = cnveg_carbonstate_inst%livecrootc_storage_patch(p) / & - cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) - end if - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - if (cnveg_nitrogenstate_inst%livestemn_storage_patch(p) == 0.0_r8) then - ! to avoid division by zero, and also to make livestemcn_actual(p) a very large number if livestemc(p) is zero - livestemcn_actual = cnveg_carbonstate_inst%livestemc_storage_patch(p) / n_min - else - ! live stem CN ratio - livestemcn_actual = cnveg_carbonstate_inst%livestemc_storage_patch(p) / & - cnveg_nitrogenstate_inst%livestemn_storage_patch(p) - end if - - if (cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) == 0.0_r8) then - ! to avoid division by zero, and also to make livecrootcn_actual(p) a very large number if livecrootc(p) is zero - livecrootcn_actual = cnveg_carbonstate_inst%livecrootc_storage_patch(p) / n_min - else - ! live coarse root CN ratio - livecrootcn_actual = cnveg_carbonstate_inst%livecrootc_storage_patch(p) / & - cnveg_nitrogenstate_inst%livecrootn_storage_patch(p) - end if - end if - - leafcn_max = leafcn(ivt(p)) + 15.0_r8 - frootcn_max = frootcn(ivt(p)) + 15.0_r8 - - ! Note that for high CN ratio stress the plant part does not retranslocate nitrogen as the plant part will need the N - ! if high leaf CN ratio (i.e., high leaf C compared to N) then turnover extra C - if (this%actual_storage_leafcn(p) > leafcn_max) then - - frac_resp = (this%actual_storage_leafcn(p) - leafcn_max) / 10.0_r8 - frac_resp = min(1.0_r8, max(0.0_r8, frac_resp)) - - cpool_to_leafc_resp(p) = frac_resp * cpool_to_leafc(p) - cpool_to_leafc_storage_resp(p) = frac_resp * cpool_to_leafc_storage(p) - - !cpool_to_leafc(p) = cpool_to_leafc(p) - cpool_to_leafc_resp(p) - !cpool_to_leafc_storage(p) = cpool_to_leafc_storage(p) - cpool_to_leafc_storage_resp(p) - - end if - - ! if high fine root CN ratio (i.e., high fine root C compared to N) then turnover extra C - if (frootcn_actual > frootcn_max) then - - frac_resp = (frootcn_actual - frootcn_max) / 10.0_r8 - frac_resp = min(1.0_r8, max(0.0_r8, frac_resp)) - - cpool_to_frootc_resp(p) = frac_resp * cpool_to_frootc(p) - cpool_to_frootc_storage_resp(p) = frac_resp * cpool_to_frootc_storage(p) - - !cpool_to_frootc(p) = cpool_to_frootc(p) - cpool_to_frootc_resp(p) - !cpool_to_frootc_storage(p) = cpool_to_frootc_storage(p) - cpool_to_frootc_storage_resp(p) - - end if - - if (woody(ivt(p)) == 1._r8) then - - livewdcn_max = livewdcn(ivt(p)) + 15.0_r8 - - ! if high coarse root CN ratio (i.e., high coarse root C compared to N) then turnover extra C - if (livecrootcn_actual > livewdcn_max) then - - frac_resp = (livecrootcn_actual - livewdcn_max) / 10.0_r8 - frac_resp = min(1.0_r8, max(0.0_r8, frac_resp)) - - cpool_to_livecrootc_resp(p) = frac_resp * cpool_to_livecrootc(p) - cpool_to_livecrootc_storage_resp(p) = frac_resp * cpool_to_livecrootc_storage(p) - - !cpool_to_livecrootc(p) = cpool_to_livecrootc(p) - cpool_to_livecrootc_resp(p) - !cpool_to_livecrootc_storage(p) = cpool_to_livecrootc_storage(p) - cpool_to_livecrootc_storage_resp(p) - - end if - - ! if high stem CN ratio (i.e., high stem C compared to N) then turnover extra C - if (livestemcn_actual > livewdcn_max) then - - frac_resp = (livestemcn_actual - livewdcn_max) / 10.0_r8 - frac_resp = min(1.0_r8, max(0.0_r8, frac_resp)) - - cpool_to_livestemc_resp(p) = frac_resp * cpool_to_livestemc(p) - cpool_to_livestemc_storage_resp(p) = frac_resp * cpool_to_livestemc_storage(p) - - !cpool_to_livestemc(p) = cpool_to_livestemc(p) - cpool_to_livestemc_resp(p) - !cpool_to_livestemc_storage(p) = cpool_to_livestemc_storage(p) - cpool_to_livestemc_storage_resp(p) - - end if - - end if - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - livewdcn_max = livewdcn(ivt(p)) + 15.0_r8 - - ! if high coarse root CN ratio (i.e., high coarse root C compared to N) then turnover extra C - if (livecrootcn_actual > livewdcn_max) then - - frac_resp = (livecrootcn_actual - livewdcn_max) / 10.0_r8 - frac_resp = min(1.0_r8, max(0.0_r8, frac_resp)) - - cpool_to_livecrootc_resp(p) = frac_resp * cpool_to_livecrootc(p) - cpool_to_livecrootc_storage_resp(p) = frac_resp * cpool_to_livecrootc_storage(p) - - !cpool_to_livecrootc(p) = cpool_to_livecrootc(p) - cpool_to_livecrootc_resp(p) - !cpool_to_livecrootc_storage(p) = cpool_to_livecrootc_storage(p) - cpool_to_livecrootc_storage_resp(p) - - end if - - ! if high stem CN ratio (i.e., high stem C compared to N) then turnover extra C - if (livestemcn_actual > livewdcn_max) then - - frac_resp = (livestemcn_actual - livewdcn_max) / 10.0_r8 - frac_resp = min(1.0_r8, max(0.0_r8, frac_resp)) - - cpool_to_livestemc_resp(p) = frac_resp * cpool_to_livestemc(p) - cpool_to_livestemc_storage_resp(p) = frac_resp * cpool_to_livestemc_storage(p) - - !cpool_to_livestemc(p) = cpool_to_livestemc(p) - cpool_to_livestemc_resp(p) - !cpool_to_livestemc_storage(p) = cpool_to_livestemc_storage(p) - cpool_to_livestemc_storage_resp(p) - - end if - - end if - - cpool_to_resp(p) = cpool_to_leafc_resp(p) + cpool_to_leafc_storage_resp(p) + cpool_to_frootc_resp(p) + & - cpool_to_frootc_storage_resp(p) + cpool_to_livecrootc_resp(p) + cpool_to_livecrootc_storage_resp(p) + & - cpool_to_livestemc_resp(p) + cpool_to_livestemc_storage_resp(p) - - end if ! end of if (carbon_resp_opt == 1 .AND. laisun(p)+laisha(p) > 0.0_r8) then - - !if (cnveg_nitrogenstate_inst%leafn_storage_patch(p) < n_min .or. laisun(p)+laisha(p) <= 0.0_r8) then - !! to make output on history missing value - !this%actual_storage_leafcn(p) = spval - !end if - - end if ! end of if (downreg_opt .eqv. .false. .AND. CN_partition_opt == 1) then - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - end do ! end patch loop - - end associate - - end subroutine calc_plant_cn_alloc - -! ----------------------------------------------------------------------- - subroutine calc_plant_nutrient_demand(this, bounds, num_soilp, filter_soilp,& - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, & - energyflux_inst, & - aroot, arepr) - ! - ! !USES: - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use CropType , only : crop_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemCarbonFluxType, only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use EnergyFluxType , only : energyflux_type ! - ! !ARGUMENTS: - class(nutrient_competition_FlexibleCN_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(photosyns_type) , intent(in) :: photosyns_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - real(r8) , intent(out) :: aroot(bounds%begp:) - real(r8) , intent(out) :: arepr(bounds%begp:) - !----------------------------------------------------------------------- - - call this%calc_plant_nitrogen_demand(bounds, num_soilp, filter_soilp, & - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, & - energyflux_inst, & - aroot=aroot(bounds%begp:bounds%endp), & - arepr=arepr(bounds%begp:bounds%endp)) - - end subroutine calc_plant_nutrient_demand - - !----------------------------------------------------------------------- - subroutine calc_plant_nitrogen_demand(this, bounds, num_soilp, filter_soilp, & - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, & - energyflux_inst, & - aroot, arepr) - ! - ! !USES: - use pftconMod , only : npcropmin, pftcon - use pftconMod , only : ntmp_soybean, nirrig_tmp_soybean - use pftconMod , only : ntrp_soybean, nirrig_trp_soybean - use clm_varcon , only : secspday, dzsoi_decomp - use clm_varctl , only : use_c13, use_c14 - use clm_varctl , only : nscalar_opt, plant_ndemand_opt, substrate_term_opt, temp_scalar_opt - use clm_varpar , only : nlevdecomp - use clm_time_manager , only : get_step_size - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use CropType , only : crop_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemCarbonFluxType, only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use EnergyFluxType , only : energyflux_type ! - use CNSharedParamsMod , only : use_fun - use CNPrecisionControlMod , only : n_min - use clm_varcon , only : spval - ! !ARGUMENTS: - class(nutrient_competition_FlexibleCN_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(photosyns_type) , intent(in) :: photosyns_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - real(r8) , intent(out) :: aroot(bounds%begp:) - real(r8) , intent(out) :: arepr(bounds%begp:) - ! - ! !LOCAL VARIABLES: - integer :: c, p, j ! indices - integer :: fp ! lake filter patch index - real(r8) :: mr ! maintenance respiration (gC/m2/s) - real(r8) :: f1, f2, f3, f4, g1, g2 ! allocation parameters - real(r8) :: cnl, cnfr, cnlw, cndw ! C:N ratios for leaf, fine root, and wood - real(r8) :: curmr, curmr_ratio ! xsmrpool temporary variables - real(r8) :: f5 ! grain allocation parameter - real(r8) :: cng ! C:N ratio for grain (= cnlw for now; slevis) - real(r8) :: fleaf ! fraction allocated to leaf - real(r8) :: t1 ! temporary variable - real(r8) :: dt ! model time step - real(r8) :: dayscrecover ! number of days to recover negative cpool - real(r8) :: f_N (bounds%begp:bounds%endp) - real(r8) :: Kmin - real(r8) :: leafcn_max - real(r8) :: leafcn_min - real(r8) :: nscalar - real(r8) :: sminn_total - real(r8) :: substrate_term - real(r8) :: temp_scalar - real(r8) :: Vmax_N - real(r8) :: allocation_leaf (bounds%begp:bounds%endp) - real(r8) :: allocation_stem (bounds%begp:bounds%endp) - real(r8) :: allocation_froot (bounds%begp:bounds%endp) - - ! ----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(aroot) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arepr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(this%actual_leafcn) >= (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((lbound(this%actual_leafcn) <= (/bounds%begp/)), errMsg(sourcefile, __LINE__)) - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - woody => pftcon%woody , & ! Input: binary flag for woody lifeform (1=woody, 0=not woody) - froot_leaf => pftcon%froot_leaf , & ! Input: allocation parameter: new fine root C per new leaf C (gC/gC) - croot_stem => pftcon%croot_stem , & ! Input: allocation parameter: new coarse root C per new stem C (gC/gC) - stem_leaf => pftcon%stem_leaf , & ! Input: allocation parameter: new stem c per new leaf C (gC/gC) - flivewd => pftcon%flivewd , & ! Input: allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - frootcn => pftcon%frootcn , & ! Input: fine root C:N (gC/gN) - livewdcn => pftcon%livewdcn , & ! Input: live wood (phloem and ray parenchyma) C:N (gC/gN) - deadwdcn => pftcon%deadwdcn , & ! Input: dead wood (xylem and heartwood) C:N (gC/gN) - graincn => pftcon%graincn , & ! Input: grain C:N (gC/gN) - fleafcn => pftcon%fleafcn , & ! Input: leaf c:n during organ fill - ffrootcn => pftcon%ffrootcn , & ! Input: froot c:n during organ fill - fstemcn => pftcon%fstemcn , & ! Input: stem c:n during organ fill - bfact => pftcon%bfact , & ! Input: parameter used below - aleaff => pftcon%aleaff , & ! Input: parameter used below - arootf => pftcon%arootf , & ! Input: parameter used below - astemf => pftcon%astemf , & ! Input: parameter used below - arooti => pftcon%arooti , & ! Input: parameter used below - fleafi => pftcon%fleafi , & ! Input: parameter used below - allconsl => pftcon%allconsl , & ! Input: parameter used below - allconss => pftcon%allconss , & ! Input: parameter used below - grperc => pftcon%grperc , & ! Input: parameter used below - grpnow => pftcon%grpnow , & ! Input: parameter used below - declfact => pftcon%declfact , & ! Input: - season_decid => pftcon%season_decid , & ! Input: binary flag for seasonal-deciduous leaf habit (0 or 1) - stress_decid => pftcon%stress_decid , & ! Input: binary flag for stress-deciduous leaf habit (0 or 1) - psnsun => photosyns_inst%psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - psnsha => photosyns_inst%psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - c13_psnsun => photosyns_inst%c13_psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - c13_psnsha => photosyns_inst%c13_psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - c14_psnsun => photosyns_inst%c14_psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - c14_psnsha => photosyns_inst%c14_psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit projected leaf area index - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded projected leaf area index - - hui => crop_inst%gddplant_patch , & ! Input: [real(r8) (:) ] =gdd since planting (gddplant) - leafout => crop_inst%gddtsoi_patch , & ! Input: [real(r8) (:) ] =gdd from top soil layer temperature - croplive => crop_inst%croplive_patch , & ! Input: [logical (:) ] flag, true if planted, not harvested - - gddmaturity => cnveg_state_inst%gddmaturity_patch , & ! Input: [real(r8) (:) ] gdd needed to harvest - huileaf => cnveg_state_inst%huileaf_patch , & ! Input: [real(r8) (:) ] heat unit index needed from planting to leaf emergence - huigrain => cnveg_state_inst%huigrain_patch , & ! Input: [real(r8) (:) ] same to reach vegetative maturity - peaklai => cnveg_state_inst%peaklai_patch , & ! Input: [integer (:) ] 1: max allowed lai; 0: not at max - aleafi => cnveg_state_inst%aleafi_patch , & ! Output: [real(r8) (:) ] saved allocation coefficient from phase 2 - astemi => cnveg_state_inst%astemi_patch , & ! Output: [real(r8) (:) ] saved allocation coefficient from phase 2 - aleaf => cnveg_state_inst%aleaf_patch , & ! Output: [real(r8) (:) ] leaf allocation coefficient - astem => cnveg_state_inst%astem_patch , & ! Output: [real(r8) (:) ] stem allocation coefficient - grain_flag => cnveg_state_inst%grain_flag_patch , & ! Output: [real(r8) (:) ] 1: grain fill stage; 0: not - c_allometry => cnveg_state_inst%c_allometry_patch , & ! Output: [real(r8) (:) ] C allocation index (DIM) - n_allometry => cnveg_state_inst%n_allometry_patch , & ! Output: [real(r8) (:) ] N allocation index (DIM) - tempsum_potential_gpp => cnveg_state_inst%tempsum_potential_gpp_patch , & ! Output: [real(r8) (:) ] temporary annual sum of potential GPP - tempmax_retransn => cnveg_state_inst%tempmax_retransn_patch , & ! Output: [real(r8) (:) ] temporary annual max of retranslocated N pool (gN/m2) - annsum_potential_gpp => cnveg_state_inst%annsum_potential_gpp_patch , & ! Output: [real(r8) (:) ] annual sum of potential GPP - annmax_retransn => cnveg_state_inst%annmax_retransn_patch , & ! Output: [real(r8) (:) ] annual max of retranslocated N pool - - xsmrpool => cnveg_carbonstate_inst%xsmrpool_patch , & ! Input: [real(r8) (:) ] (gC/m2) temporary photosynthate C pool - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:) ] - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:) ] - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:) ] - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:) ] - retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:) ] (gN/m2) plant pool of retranslocated N - - annsum_npp => cnveg_carbonflux_inst%annsum_npp_patch , & ! Input: [real(r8) (:) ] annual sum of NPP, for wood allocation - leaf_mr => cnveg_carbonflux_inst%leaf_mr_patch , & ! Input: [real(r8) (:) ] - froot_mr => cnveg_carbonflux_inst%froot_mr_patch , & ! Input: [real(r8) (:) ] - livestem_mr => cnveg_carbonflux_inst%livestem_mr_patch , & ! Input: [real(r8) (:) ] - livecroot_mr => cnveg_carbonflux_inst%livecroot_mr_patch , & ! Input: [real(r8) (:) ] - grain_mr => cnveg_carbonflux_inst%grain_mr_patch , & ! Input: [real(r8) (:) ] - gpp => cnveg_carbonflux_inst%gpp_before_downreg_patch , & ! Output: [real(r8) (:) ] GPP flux before downregulation (gC/m2/s) - availc => cnveg_carbonflux_inst%availc_patch , & ! Output: [real(r8) (:) ] C flux available for allocation (gC/m2/s) - xsmrpool_recover => cnveg_carbonflux_inst%xsmrpool_recover_patch , & ! Output: [real(r8) (:) ] C flux assigned to recovery of negative cpool (gC/m2/s) - psnsun_to_cpool => cnveg_carbonflux_inst%psnsun_to_cpool_patch , & ! Output: [real(r8) (:) ] - psnshade_to_cpool => cnveg_carbonflux_inst%psnshade_to_cpool_patch , & ! Output: [real(r8) (:) ] - leaf_curmr => cnveg_carbonflux_inst%leaf_curmr_patch , & ! Output: [real(r8) (:) ] - froot_curmr => cnveg_carbonflux_inst%froot_curmr_patch , & ! Output: [real(r8) (:) ] - livestem_curmr => cnveg_carbonflux_inst%livestem_curmr_patch , & ! Output: [real(r8) (:) ] - livecroot_curmr => cnveg_carbonflux_inst%livecroot_curmr_patch , & ! Output: [real(r8) (:) ] - grain_curmr => cnveg_carbonflux_inst%grain_curmr_patch , & ! Output: [real(r8) (:) ] - leaf_xsmr => cnveg_carbonflux_inst%leaf_xsmr_patch , & ! Output: [real(r8) (:) ] - froot_xsmr => cnveg_carbonflux_inst%froot_xsmr_patch , & ! Output: [real(r8) (:) ] - livestem_xsmr => cnveg_carbonflux_inst%livestem_xsmr_patch , & ! Output: [real(r8) (:) ] - livecroot_xsmr => cnveg_carbonflux_inst%livecroot_xsmr_patch , & ! Output: [real(r8) (:) ] - grain_xsmr => cnveg_carbonflux_inst%grain_xsmr_patch , & ! Output: [real(r8) (:) ] - cpool_to_xsmrpool => cnveg_carbonflux_inst%cpool_to_xsmrpool_patch , & ! Output: [real(r8) (:) ] - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:) ] (gN/m2) leaf N - plant_ndemand => cnveg_nitrogenflux_inst%plant_ndemand_patch , & ! Output: [real(r8) (:) ] N flux required to support initial GPP (gN/m2/s) - avail_retransn => cnveg_nitrogenflux_inst%avail_retransn_patch , & ! Output: [real(r8) (:) ] N flux available from retranslocation pool (gN/m2/s) - retransn_to_npool => cnveg_nitrogenflux_inst%retransn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of retranslocated N (gN/m2/s) - sminn_to_npool => cnveg_nitrogenflux_inst%sminn_to_npool_patch , & ! Output: [real(r8) (:) ] deployment of soil mineral N uptake (gN/m2/s) - leafn_to_retransn => cnveg_nitrogenflux_inst%leafn_to_retransn_patch , & ! Output: [real(r8) (:) ] - frootn_to_retransn => cnveg_nitrogenflux_inst%frootn_to_retransn_patch , & ! Output: [real(r8) (:) ] - livestemn_to_retransn => cnveg_nitrogenflux_inst%livestemn_to_retransn_patch,& ! Output: [real(r8) (:) ] - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:) ] (gN/m2) livestem N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:) ] (gN/m2) fine root N - sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N - btran => energyflux_inst%btran_patch , & ! Input: [real(r8) (:) ] transpiration wetness factor (0 to 1) - t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col & ! Input: [real(r8) (:,:) ] soil temperature scalar for decomp - - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! set number of days to recover negative cpool - dayscrecover = params_inst%dayscrecover ! loop over patches to assess the total plant N demand - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! get the time step total gross photosynthesis - ! this is coming from the canopy fluxes code, and is the - ! gpp that is used to control stomatal conductance. - ! For the nitrogen downregulation code, this is assumed - ! to be the potential gpp, and the actual gpp will be - ! reduced due to N limitation. - - ! Convert psn from umol/m2/s -> gC/m2/s - - ! The input psn (psnsun and psnsha) are expressed per unit LAI - ! in the sunlit and shaded canopy, respectively. These need to be - ! scaled by laisun and laisha to get the total gpp for allocation - - ! Note that no associate statement is used for the isotope carbon fluxes below - ! since they are not always allocated AND nag compiler will complain if you try to - ! to have an associate statement with unallocated memory - - psnsun_to_cpool(p) = psnsun(p) * laisun(p) * 12.011e-6_r8 - psnshade_to_cpool(p) = psnsha(p) * laisha(p) * 12.011e-6_r8 - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = c13_psnsun(p) * laisun(p) * 12.011e-6_r8 - c13_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = c13_psnsha(p) * laisha(p) * 12.011e-6_r8 - endif - - if ( use_c14 ) then - c14_cnveg_carbonflux_inst%psnsun_to_cpool_patch(p) = c14_psnsun(p) * laisun(p) * 12.011e-6_r8 - c14_cnveg_carbonflux_inst%psnshade_to_cpool_patch(p) = c14_psnsha(p) * laisha(p) * 12.011e-6_r8 - endif - - gpp(p) = psnsun_to_cpool(p) + psnshade_to_cpool(p) - - ! get the time step total maintenance respiration - ! These fluxes should already be in gC/m2/s - - mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then - mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin) then - if (croplive(p)) mr = mr + livestem_mr(p) + grain_mr(p) - end if ! carbon flux available for allocation - availc(p) = gpp(p) - mr - - ! new code added for isotope calculations, 7/1/05, PET - ! If mr > gpp, then some mr comes from gpp, the rest comes from - ! cpool (xsmr) - if (mr > 0._r8 .and. availc(p) < 0._r8) then - curmr = gpp(p) - curmr_ratio = curmr / mr - else - curmr_ratio = 1._r8 - end if - leaf_curmr(p) = leaf_mr(p) * curmr_ratio - leaf_xsmr(p) = leaf_mr(p) - leaf_curmr(p) - froot_curmr(p) = froot_mr(p) * curmr_ratio - froot_xsmr(p) = froot_mr(p) - froot_curmr(p) - livestem_curmr(p) = livestem_mr(p) * curmr_ratio - livestem_xsmr(p) = livestem_mr(p) - livestem_curmr(p) - livecroot_curmr(p) = livecroot_mr(p) * curmr_ratio - livecroot_xsmr(p) = livecroot_mr(p) - livecroot_curmr(p) - grain_curmr(p) = grain_mr(p) * curmr_ratio - grain_xsmr(p) = grain_mr(p) - grain_curmr(p) - - ! no allocation when available c is negative - availc(p) = max(availc(p),0.0_r8) - - ! test for an xsmrpool deficit - if (xsmrpool(p) < 0.0_r8) then - ! Running a deficit in the xsmrpool, so the first priority is to let - ! some availc from this timestep accumulate in xsmrpool. - ! Determine rate of recovery for xsmrpool deficit - - xsmrpool_recover(p) = -xsmrpool(p)/(dayscrecover*secspday) - if (xsmrpool_recover(p) < availc(p)) then - ! available carbon reduced by amount for xsmrpool recovery - availc(p) = availc(p) - xsmrpool_recover(p) - else - ! all of the available carbon goes to xsmrpool recovery - xsmrpool_recover(p) = availc(p) - availc(p) = 0.0_r8 - end if - cpool_to_xsmrpool(p) = xsmrpool_recover(p) - end if - - f1 = froot_leaf(ivt(p)) - f2 = croot_stem(ivt(p)) - - ! modified wood allocation to be 2.2 at npp=800 gC/m2/yr, 0.2 at npp=0, - ! constrained so that it does not go lower than 0.2 (under negative annsum_npp) - ! This variable allocation is only for trees. Shrubs have a constant - ! allocation as specified in the pft-physiology file. The value is also used - ! as a trigger here: -1.0 means to use the dynamic allocation (trees). - - if (stem_leaf(ivt(p)) == -1._r8) then - f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4 - else - f3 = stem_leaf(ivt(p)) - end if - - f4 = flivewd(ivt(p)) - g1 = grperc(ivt(p)) - g2 = grpnow(ivt(p)) - cnl = leafcn(ivt(p)) - cnfr = frootcn(ivt(p)) - cnlw = livewdcn(ivt(p)) - cndw = deadwdcn(ivt(p)) - - - ! calculate f1 to f5 for prog crops following AgroIBIS subr phenocrop - - f5 = 0._r8 ! continued intializations from above - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - if (croplive(p)) then - ! same phases appear in subroutine CropPhenology - - ! Phase 1 completed: - ! ================== - ! if hui is less than the number of gdd needed for filling of grain - ! leaf emergence also has to have taken place for lai changes to occur - ! and carbon assimilation - ! Next phase: leaf emergence to start of leaf decline - - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p)) then - - ! allocation rules for crops based on maturity and linear decrease - ! of amount allocated to roots over course of the growing season - - if (peaklai(p) == 1) then ! lai at maximum allowed - arepr(p) = 0._r8 - aleaf(p) = 1.e-5_r8 - astem(p) = 0._r8 - aroot(p) = 1._r8 - arepr(p) - aleaf(p) - astem(p) - else - arepr(p) = 0._r8 - aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - & - (arooti(ivt(p)) - arootf(ivt(p))) * & - min(1._r8, hui(p)/gddmaturity(p)))) - fleaf = fleafi(ivt(p)) * (exp(-bfact(ivt(p))) - & - exp(-bfact(ivt(p))*hui(p)/huigrain(p))) / & - (exp(-bfact(ivt(p)))-1) ! fraction alloc to leaf (from J Norman alloc curve) - aleaf(p) = max(1.e-5_r8, (1._r8 - aroot(p)) * fleaf) - astem(p) = 1._r8 - arepr(p) - aleaf(p) - aroot(p) - end if - - ! AgroIBIS included here an immediate adjustment to aleaf & astem if the - ! predicted lai from the above allocation coefficients exceeded laimx. - ! We have decided to live with lais slightly higher than laimx by - ! enforcing the cap in the following tstep through the peaklai logic above. - - astemi(p) = astem(p) ! save for use by equations after shift - aleafi(p) = aleaf(p) ! to reproductive phenology stage begins - grain_flag(p) = 0._r8 ! setting to 0 while in phase 2 - - ! Phase 2 completed: - ! ================== - ! shift allocation either when enough gdd are accumulated or maximum number - ! of days has elapsed since planting - - else if (hui(p) >= huigrain(p)) then - aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - & - (arooti(ivt(p)) - arootf(ivt(p))) * min(1._r8, hui(p)/gddmaturity(p)))) - if (astemi(p) > astemf(ivt(p))) then - astem(p) = max(0._r8, max(astemf(ivt(p)), astem(p) * & - (1._r8 - min((hui(p)- & - huigrain(p))/((gddmaturity(p)*declfact(ivt(p)))- & - huigrain(p)),1._r8)**allconss(ivt(p)) ))) - end if - - ! If crops have hit peaklai, then set leaf allocation to small value - if (peaklai(p) == 1) then - aleaf(p) = 1.e-5_r8 - else if (aleafi(p) > aleaff(ivt(p))) then - aleaf(p) = max(1.e-5_r8, max(aleaff(ivt(p)), aleaf(p) * & - (1._r8 - min((hui(p)- & - huigrain(p))/((gddmaturity(p)*declfact(ivt(p)))- & - huigrain(p)),1._r8)**allconsl(ivt(p)) ))) - end if - - !Beth's retranslocation of leafn, stemn, rootn to organ - !Filter excess plant N to retransn pool for organ N - !Only do one time then hold grain_flag till onset next season - - ! slevis: Will astem ever = astemf exactly? - ! Beth's response: ...looks like astem can equal astemf under the right circumstances. - !It might be worth a rewrite to capture what I was trying to do, but the retranslocation for - !corn and wheat begins at the beginning of the grain fill stage, but for soybean I was holding it - !until after the leaf and stem decline were complete. Looking at how astem is calculated, once the - !stem decline is near complete, astem should (usually) be set to astemf. The reason for holding off - !on soybean is that the retranslocation scheme begins at the beginning of the grain phase, when the - !leaf and stem are still growing, but declining. Since carbon is still getting allocated and now - !there is more nitrogen available, the nitrogen can be diverted from grain. For corn and wheat - !the impact was probably enough to boost productivity, but for soybean the nitrogen was better off - !fulfilling the grain fill. It seems that if the peak lai is reached for soybean though that this - !would be bypassed altogether, not the intended outcome. I checked several of my output files and - !they all seemed to be going through the retranslocation loop for soybean - good news. - - if (astem(p) == astemf(ivt(p)) .or. & - (ivt(p) /= ntmp_soybean .and. ivt(p) /= nirrig_tmp_soybean .and.& - ivt(p) /= ntrp_soybean .and. ivt(p) /= nirrig_trp_soybean)) then - if (grain_flag(p) == 0._r8) then - t1 = 1 / dt - leafn_to_retransn(p) = t1 * max(leafn(p)- (leafc(p) / fleafcn(ivt(p))),0._r8) - livestemn_to_retransn(p) = t1 * max(livestemn(p) - (livestemc(p) / fstemcn(ivt(p))),0._r8) - frootn_to_retransn(p) = 0._r8 - if (ffrootcn(ivt(p)) > 0._r8) then - frootn_to_retransn(p) = t1 * max(frootn(p) - (frootc(p) / ffrootcn(ivt(p))),0._r8) - end if - grain_flag(p) = 1._r8 - end if - end if - - arepr(p) = 1._r8 - aroot(p) - astem(p) - aleaf(p) - - else ! pre emergence - aleaf(p) = 1.e-5_r8 ! allocation coefficients should be irrelevant - astem(p) = 0._r8 ! because crops have no live carbon pools; - aroot(p) = 0._r8 ! this applies to this "else" and to the "else" - arepr(p) = 0._r8 ! a few lines down - end if - - f1 = aroot(p) / aleaf(p) - f3 = astem(p) / aleaf(p) - f5 = arepr(p) / aleaf(p) - g1 = 0.25_r8 - - - else ! .not croplive - f1 = 0._r8 - f3 = 0._r8 - f5 = 0._r8 - g1 = 0.25_r8 - end if - end if - - ! based on available C, use constant allometric relationships to - ! determine N requirements - if(use_fun)then ! In FUN, growth respiration is not part of the allometry calculation. - if (woody(ivt(p)) == 1.0_r8) then - c_allometry(p) = (1._r8)*(1._r8+f1+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else if (ivt(p) >= npcropmin) then ! skip generic crops - cng = graincn(ivt(p)) - c_allometry(p) = (1._r8)*(1._r8+f1+f5+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + f5/cng + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else - c_allometry(p) = 1._r8+f1 - n_allometry(p) = 1._r8/cnl + f1/cnfr - end if - else !no FUN. - if (woody(ivt(p)) == 1.0_r8) then - c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else if (ivt(p) >= npcropmin) then ! skip generic crops - cng = graincn(ivt(p)) - c_allometry(p) = (1._r8+g1)*(1._r8+f1+f5+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + f5/cng + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else - c_allometry(p) = 1._r8+g1+f1+f1*g1 - n_allometry(p) = 1._r8/cnl + f1/cnfr - end if - end if !FUN - - ! when we have "if (leafn(p) == 0.0_r8)" below then we - ! have floating overflow (out of floating point range) - ! error in "actual_leafcn(p) = leafc(p) / leafn(p)" - if (leafn(p) < n_min ) then - ! to avoid division by zero, and to set leafcn to missing value for history files - this%actual_leafcn(p) = spval - else - ! leaf CN ratio - this%actual_leafcn(p) = leafc(p) / leafn(p) - end if - - - if (nscalar_opt) then - - leafcn_min = leafcn(ivt(p)) - 10.0_r8 - leafcn_max = leafcn(ivt(p)) + 10.0_r8 - - this%actual_leafcn(p) = max( this%actual_leafcn(p), leafcn_min-0.0001_r8 ) - this%actual_leafcn(p) = min( this%actual_leafcn(p), leafcn_max ) - - nscalar = (this%actual_leafcn(p) - leafcn_min ) / (leafcn_max - leafcn_min) ! Nitrogen scaler factor - nscalar = min( max(0.0_r8, nscalar), 1.0_r8 ) - else ! if (nscalar_opt == .false.) then - nscalar = 1.0_r8 - end if - - - if (substrate_term_opt) then - c = patch%column(p) - sminn_total = 0.0_r8 - do j = 1, nlevdecomp - sminn_total = sminn_total + sminn_vr(c,j) * dzsoi_decomp(j) - end do - Kmin = 1.0_r8 - substrate_term = sminn_total / (sminn_total + Kmin) - else ! if (substrate_term_opt == .false) then - substrate_term = 1.0_r8 - end if - - if (.not. temp_scalar_opt) then - temp_scalar = 1.0_r8 - else !(temp_scalar_opt == .true.) then - c = patch%column(p) - temp_scalar=t_scalar(c,1) - temp_scalar = min( max(0.0_r8, temp_scalar), 1.0_r8 ) - end if - - if(use_fun)then ! in FUN, plant_ndemand is just used as a maximum draw on soil N pools. - plant_ndemand(p) = availc(p)*(n_allometry(p)/c_allometry(p)) - else !FUN - if (plant_ndemand_opt == 0) then - plant_ndemand(p) = availc(p)*(n_allometry(p)/c_allometry(p)) - else if (plant_ndemand_opt == 1) then - plant_ndemand(p) = availc(p)*(n_allometry(p)/c_allometry(p)) * substrate_term - else if (plant_ndemand_opt == 2) then ! N uptake happens at day time only - - if (gpp(p) > 0.0_r8) then - Vmax_N = 2.7E-8_r8 - plant_ndemand(p) = Vmax_N * frootc(p) * substrate_term * temp_scalar * nscalar - else - plant_ndemand(p) = 0.0_r8 - end if - else if (plant_ndemand_opt == 3) then ! N uptake happens at day and night time - - if (laisun(p)+laisha(p) > 0.0_r8) then - Vmax_N = 2.7E-8_r8 - plant_ndemand(p) = Vmax_N * frootc(p) * substrate_term * temp_scalar * nscalar - else - plant_ndemand(p) = 0.0_r8 - end if - - if (this%actual_leafcn(p) < leafcn_min )then - plant_ndemand(p) = 0.0_r8 - end if - - end if - end if !FUN - - !if (leafn(p) < n_min ) then - !! to set leafcn to missing value for history files - !this%actual_leafcn(p) = spval - !end if - - ! retranslocated N deployment depends on seasonal cycle of potential GPP - ! (requires one year run to accumulate demand) - - tempsum_potential_gpp(p) = tempsum_potential_gpp(p) + gpp(p) - - ! Adding the following line to carry max retransn info to CN Annual Update - tempmax_retransn(p) = max(tempmax_retransn(p),retransn(p)) - - ! Beth's code: crops pull from retransn pool only during grain fill; - ! retransn pool has N from leaves, stems, and roots for - ! retranslocation - - if (ivt(p) >= npcropmin .and. grain_flag(p) == 1._r8) then - avail_retransn(p) = plant_ndemand(p) - else if (ivt(p) < npcropmin .and. annsum_potential_gpp(p) > 0._r8) then - avail_retransn(p) = (annmax_retransn(p)/2._r8)*(gpp(p)/annsum_potential_gpp(p))/dt - else - avail_retransn(p) = 0.0_r8 - end if - - ! make sure available retrans N doesn't exceed storage - avail_retransn(p) = min(avail_retransn(p), retransn(p)/dt) - - ! modify plant N demand according to the availability of - ! retranslocated N - ! take from retransn pool at most the flux required to meet - ! plant ndemand - - if (plant_ndemand(p) > avail_retransn(p)) then - retransn_to_npool(p) = avail_retransn(p) - else - retransn_to_npool(p) = plant_ndemand(p) - end if - - if ( .not. use_fun ) then - plant_ndemand(p) = plant_ndemand(p) - retransn_to_npool(p) - end if - - end do ! end patch loop - - end associate - - end subroutine calc_plant_nitrogen_demand - -end module NutrientCompetitionFlexibleCNMod diff --git a/src/biogeochem/NutrientCompetitionMethodMod.F90 b/src/biogeochem/NutrientCompetitionMethodMod.F90 deleted file mode 100644 index 56ebcc4f67..0000000000 --- a/src/biogeochem/NutrientCompetitionMethodMod.F90 +++ /dev/null @@ -1,202 +0,0 @@ -module NutrientCompetitionMethodMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Abstract base class for functions to calculate nutrient competition - ! - ! Created by Jinyun Tang, following Bill Sack's implementation of polymorphism - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - private - ! - ! !PUBLIC TYPES: - public :: nutrient_competition_method_type - - type, abstract :: nutrient_competition_method_type - private - contains - - ! initialization - procedure(init_interface), public, deferred :: init - - ! Read in parameters - procedure, public :: readParams - - ! compute plant nutrient demand - procedure(calc_plant_nutrient_demand_interface), public, deferred :: calc_plant_nutrient_demand - - ! compute the nutrient yield for different components - procedure(calc_plant_nutrient_competition_interface), public, deferred :: calc_plant_nutrient_competition - - end type nutrient_competition_method_type - - type, public :: params_type - real(r8) :: dayscrecover ! number of days to recover negative cpool - end type params_type - ! - type(params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod - - abstract interface - - ! Note: The following code is adapted based on what Bill Scaks has done for soil water retention curve - ! polymorphism. Therefore, I also keep some suggestions he gave there. - ! - ! - Make the interfaces contain all possible inputs that are needed by any - ! implementation; each implementation will then ignore the inputs it doesn't need. - ! - ! - For inputs that are needed only by particular implementations - and particularly - ! for inputs that are constant in time - ! pass these into the constructor, and save pointers to these inputs as components - ! of the child type that needs them. Then they aren't needed as inputs to the - ! individual routines, allowing the interfaces for these routines to remain more - ! consistent between different implementations. - ! - !--------------------------------------------------------------------------- - subroutine init_interface(this, bounds) - ! !DESCRIPTION: - ! read in kinetic parameters that are needed for doing nutrient competition - ! - ! !USES: - use decompMod , only : bounds_type - import :: nutrient_competition_method_type - ! - ! !ARGUMENTS: - class(nutrient_competition_method_type) :: this - type(bounds_type) , intent(in) :: bounds - - end subroutine init_interface - - !--------------------------------------------------------------------------- - subroutine calc_plant_nutrient_demand_interface (this, bounds, num_soilp, filter_soilp, & - photosyns_inst, crop_inst, canopystate_inst, & - cnveg_state_inst, cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, & - energyflux_inst, & - aroot, arepr) - ! - ! DESCRIPTION - ! calculate nutrient yield after considering competition between different components - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use PhotosynthesisMod , only : photosyns_type - use CropType , only : crop_type - use CanopyStateType , only : canopystate_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemCarbonFluxType, only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use EnergyFluxType , only : energyflux_type - import :: nutrient_competition_method_type - ! - ! !ARGUMENTS: - class(nutrient_competition_method_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(photosyns_type) , intent(in) :: photosyns_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type), intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - real(r8) , intent(out) :: aroot(bounds%begp:) - real(r8) , intent(out) :: arepr(bounds%begp:) - - end subroutine calc_plant_nutrient_demand_interface - - !----------------------------------------------------------------------- - subroutine calc_plant_nutrient_competition_interface (this, & - bounds, num_soilp, filter_soilp, & - cnveg_state_inst, crop_inst, canopystate_inst, & - cnveg_carbonstate_inst, cnveg_carbonflux_inst, & - c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, & - soilbiogeochem_nitrogenstate_inst, & - aroot, arepr, fpg_col) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use CNVegStateType , only : cnveg_state_type - use CropType , only : crop_type - use CanopyStateType , only : canopystate_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType, only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - import :: nutrient_competition_method_type - ! - ! !ARGUMENTS: - class(nutrient_competition_method_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! filter for soil patches - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(crop_type) , intent(in) :: crop_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type), intent(in) :: soilbiogeochem_nitrogenstate_inst - real(r8) , intent(in) :: aroot(bounds%begp:) - real(r8) , intent(in) :: arepr(bounds%begp:) - real(r8) , intent(in) :: fpg_col(bounds%begc:) - - end subroutine calc_plant_nutrient_competition_interface - - end interface - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine readParams (this, ncid ) - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use ncdio_pio , only : file_desc_t,ncd_io - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(nutrient_competition_method_type), intent(in) :: this - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNAllocParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! read in parameters - - tString='dayscrecover' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dayscrecover=tempr - - end subroutine readParams - -end module NutrientCompetitionMethodMod diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 deleted file mode 100644 index 78b2cf0e24..0000000000 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ /dev/null @@ -1,684 +0,0 @@ -module SatellitePhenologyMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! CLM Satelitte Phenology model (SP) ecosystem dynamics (phenology, vegetation). - ! Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) - ! so that DryDeposition code can get estimates of LAI differences between months. - ! - ! !USES: - use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create - use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_kind_mod , only : CL => shr_kind_CL - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : scmlat,scmlon,single_column - use clm_varctl , only : iulog, use_lai_streams - use clm_varcon , only : grlnd - use controlMod , only : NLFilename - use decompMod , only : gsmap_lnd_gdc2glo - use domainMod , only : ldomain - use fileutils , only : getavu, relavu - use PatchType , only : patch - use CanopyStateType , only : canopystate_type - use WaterstateType , only : waterstate_type - use perf_mod , only : t_startf, t_stopf - use spmdMod , only : masterproc - use spmdMod , only : mpicom, comp_id - use mct_mod - use ncdio_pio - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SatellitePhenology ! CLMSP Ecosystem dynamics: phenology, vegetation - public :: SatellitePhenologyInit ! Dynamically allocate memory - public :: interpMonthlyVeg ! interpolate monthly vegetation data - public :: readAnnualVegetation ! Read in annual vegetation (needed for Dry-deposition) - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: readMonthlyVegetation ! read monthly vegetation data for two months - private :: lai_init ! position datasets for LAI - private :: lai_interp ! interpolates between two years of LAI data - - ! !PRIVATE MEMBER DATA: - type(shr_strdata_type) :: sdat_lai ! LAI input data stream - ! - ! !PRIVATE TYPES: - integer , private :: InterpMonths1 ! saved month index - real(r8), private :: timwt(2) ! time weights for month 1 and month 2 - real(r8), private, allocatable :: mlai2t(:,:) ! lai for interpolation (2 months) - real(r8), private, allocatable :: msai2t(:,:) ! sai for interpolation (2 months) - real(r8), private, allocatable :: mhvt2t(:,:) ! top vegetation height for interpolation (2 months) - real(r8), private, allocatable :: mhvb2t(:,:) ! bottom vegetation height for interpolation(2 months) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - ! - ! lai_init - ! - !----------------------------------------------------------------------- - subroutine lai_init(bounds) - ! - ! Initialize data stream information for LAI. - ! - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use histFileMod , only : hist_addfld1d - use shr_stream_mod , only : shr_stream_file_null - use shr_string_mod , only : shr_string_listCreateField - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: i ! index - integer :: stream_year_first_lai ! first year in Lai stream to use - integer :: stream_year_last_lai ! last year in Lai stream to use - integer :: model_year_align_lai ! align stream_year_first_lai with - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_lai ! lai stream filename to read - character(len=CL) :: lai_mapalgo = 'bilinear' ! Mapping alogrithm - - character(*), parameter :: subName = "('laidyn_init')" - character(*), parameter :: F00 = "('(laidyn_init) ',4a)" - character(*), parameter :: laiString = "LAI" ! base string for field string - integer , parameter :: numLaiFields = 16 ! number of fields to build field string - character(SHR_KIND_CXX) :: fldList ! field string - !----------------------------------------------------------------------- - ! - ! deal with namelist variables here in init - ! - namelist /lai_streams/ & - stream_year_first_lai, & - stream_year_last_lai, & - model_year_align_lai, & - lai_mapalgo, & - stream_fldFileName_lai - - ! Default values for namelist - stream_year_first_lai = 1 ! first year in stream to use - stream_year_last_lai = 1 ! last year in stream to use - model_year_align_lai = 1 ! align stream_year_first_lai with this model year - stream_fldFileName_lai = shr_stream_file_null - - ! Read lai_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'lai_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=lai_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading lai_streams namelist') - end if - else - call endrun(subname // ':: ERROR finding lai_streams namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_lai, mpicom) - call shr_mpi_bcast(stream_year_last_lai, mpicom) - call shr_mpi_bcast(model_year_align_lai, mpicom) - call shr_mpi_bcast(stream_fldFileName_lai, mpicom) - - if (masterproc) then - - write(iulog,*) ' ' - write(iulog,*) 'lai_stream settings:' - write(iulog,*) ' stream_year_first_lai = ',stream_year_first_lai - write(iulog,*) ' stream_year_last_lai = ',stream_year_last_lai - write(iulog,*) ' model_year_align_lai = ',model_year_align_lai - write(iulog,*) ' stream_fldFileName_lai = ',trim(stream_fldFileName_lai) - - endif - - call clm_domain_mct (bounds, dom_clm) - - ! - ! create the field list for these lai fields...use in shr_strdata_create - ! - fldList = shr_string_listCreateField( numLaiFields, laiString ) - - call shr_strdata_create(sdat_lai,name="laidyn", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_lai, & - yearLast=stream_year_last_lai, & - yearAlign=model_year_align_lai, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_lai), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/stream_fldFileName_lai/), & - fldListFile=fldList, & - fldListModel=fldList, & - fillalgo='none', & - mapalgo=lai_mapalgo, & - calendar=get_calendar(), & - taxmode='cycle' ) - - if (masterproc) then - call shr_strdata_print(sdat_lai,'LAI data') - endif - - end subroutine lai_init - - !----------------------------------------------------------------------- - ! - ! lai_interp - ! - !----------------------------------------------------------------------- - subroutine lai_interp(bounds, canopystate_inst) - ! - ! Interpolate data stream information for Lai. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - use pftconMod , only : noveg - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: ivt, p, g, ip, ig, gpft - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - character(len=CL) :: stream_var_name - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(sdat_lai, mcdate, sec, mpicom, 'laidyn') - - do p = bounds%begp, bounds%endp - ivt = patch%itype(p) - if (ivt /= noveg) then ! vegetated pft - write(stream_var_name,"(i6)") ivt - stream_var_name = 'LAI_'//trim(adjustl(stream_var_name)) - ip = mct_aVect_indexRA(sdat_lai%avs(1),trim(stream_var_name)) - endif - gpft = patch%gridcell(p) - - ! - ! Determine vector index corresponding to gpft - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == gpft) exit - end do - - ! - ! Set lai for each gridcell/patch combination - ! - if (ivt /= noveg) then ! vegetated pft - canopystate_inst%tlai_patch(p) = sdat_lai%avs(1)%rAttr(ip,ig) - else ! non-vegetated pft - canopystate_inst%tlai_patch(p) = 0._r8 - endif - end do - - end subroutine lai_interp - - !----------------------------------------------------------------------- - subroutine SatellitePhenologyInit (bounds) - ! - ! !DESCRIPTION: - ! Dynamically allocate memory and set to signaling NaN. - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: ier ! error code - !----------------------------------------------------------------------- - - InterpMonths1 = -999 ! saved month index - - ier = 0 - if(.not.allocated(mlai2t)) then - allocate (mlai2t(bounds%begp:bounds%endp,2), & - msai2t(bounds%begp:bounds%endp,2), & - mhvt2t(bounds%begp:bounds%endp,2), & - mhvb2t(bounds%begp:bounds%endp,2), stat=ier) - end if - if (ier /= 0) then - write(iulog,*) 'EcosystemDynini allocation error' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - mlai2t(bounds%begp : bounds%endp, :) = nan - msai2t(bounds%begp : bounds%endp, :) = nan - mhvt2t(bounds%begp : bounds%endp, :) = nan - mhvb2t(bounds%begp : bounds%endp, :) = nan - - if (use_lai_streams) then - call lai_init(bounds) - endif - - end subroutine SatellitePhenologyInit - - !----------------------------------------------------------------------- - subroutine SatellitePhenology(bounds, num_nolakep, filter_nolakep, & - waterstate_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! Ecosystem dynamics: phenology, vegetation - ! Calculates leaf areas (tlai, elai), stem areas (tsai, esai) and height (htop). - ! - ! !USES: - use pftconMod, only : noveg, nbrdlf_dcd_brl_shrub - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter - integer , intent(in) :: filter_nolakep(bounds%endp-bounds%begp+1) ! patch filter for non-lake points - type(waterstate_type) , intent(in) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,p,c ! indices - real(r8) :: ol ! thickness of canopy layer covered by snow (m) - real(r8) :: fb ! fraction of canopy layer covered by snow - !----------------------------------------------------------------------- - - associate( & - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - tlai => canopystate_inst%tlai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index, no burying by snow - elai => canopystate_inst%elai_patch , & ! Output: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Output: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Output: [real(r8) (:) ] canopy top (m) - hbot => canopystate_inst%hbot_patch , & ! Output: [real(r8) (:) ] canopy bottom (m) - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - ) - - if (use_lai_streams) then - call lai_interp(bounds, canopystate_inst) - endif - - do fp = 1, num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - - ! need to update elai and esai only every albedo time step so do not - ! have any inconsistency in lai and sai between SurfaceAlbedo calls (i.e., - ! if albedos are not done every time step). - ! leaf phenology - ! Set leaf and stem areas based on day of year - ! Interpolate leaf area index, stem area index, and vegetation heights - ! between two monthly - ! The weights below (timwt(1) and timwt(2)) were obtained by a call to - ! routine InterpMonthlyVeg in subroutine NCARlsm. - ! Field Monthly Values - ! ------------------------- - ! leaf area index LAI <- mlai1 and mlai2 - ! leaf area index SAI <- msai1 and msai2 - ! top height HTOP <- mhvt1 and mhvt2 - ! bottom height HBOT <- mhvb1 and mhvb2 - - if (.not. use_lai_streams) then - tlai(p) = timwt(1)*mlai2t(p,1) + timwt(2)*mlai2t(p,2) - endif - - tsai(p) = timwt(1)*msai2t(p,1) + timwt(2)*msai2t(p,2) - htop(p) = timwt(1)*mhvt2t(p,1) + timwt(2)*mhvt2t(p,2) - hbot(p) = timwt(1)*mhvb2t(p,1) + timwt(2)*mhvb2t(p,2) - - ! adjust lai and sai for burying by snow. if exposed lai and sai - ! are less than 0.05, set equal to zero to prevent numerical - ! problems associated with very small lai and sai. - - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. - - if (patch%itype(p) > noveg .and. patch%itype(p) <= nbrdlf_dcd_brl_shrub ) then - ol = min( max(snow_depth(c)-hbot(p), 0._r8), htop(p)-hbot(p)) - fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) - else - fb = 1._r8 - max(min(snow_depth(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses - endif - - ! area weight by snow covered fraction - - elai(p) = max(tlai(p)*(1.0_r8 - frac_sno(c)) + tlai(p)*fb*frac_sno(c), 0.0_r8) - esai(p) = max(tsai(p)*(1.0_r8 - frac_sno(c)) + tsai(p)*fb*frac_sno(c), 0.0_r8) - if (elai(p) < 0.05_r8) elai(p) = 0._r8 - if (esai(p) < 0.05_r8) esai(p) = 0._r8 - - ! Fraction of vegetation free of snow - - if ((elai(p) + esai(p)) >= 0.05_r8) then - frac_veg_nosno_alb(p) = 1 - else - frac_veg_nosno_alb(p) = 0 - end if - - end do ! end of patch loop - - end associate - - end subroutine SatellitePhenology - - !----------------------------------------------------------------------- - subroutine interpMonthlyVeg (bounds, canopystate_inst) - ! - ! !DESCRIPTION: - ! Determine if 2 new months of data are to be read. - ! - ! !USES: - use clm_varctl , only : fsurdat - use clm_time_manager, only : get_curr_date, get_step_size, get_nstep - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: kyr ! year (0, ...) for nstep+1 - integer :: kmo ! month (1, ..., 12) - integer :: kda ! day of month (1, ..., 31) - integer :: ksec ! seconds into current date for nstep+1 - real(r8):: dtime ! land model time step (sec) - real(r8):: t ! a fraction: kda/ndaypm - integer :: it(2) ! month 1 and month 2 (step 1) - integer :: months(2) ! months to be interpolated (1 to 12) - integer, dimension(12) :: ndaypm= & - (/31,28,31,30,31,30,31,31,30,31,30,31/) !days per month - !----------------------------------------------------------------------- - - dtime = get_step_size() - - call get_curr_date(kyr, kmo, kda, ksec, offset=int(dtime)) - - t = (kda-0.5_r8) / ndaypm(kmo) - it(1) = t + 0.5_r8 - it(2) = it(1) + 1 - months(1) = kmo + it(1) - 1 - months(2) = kmo + it(2) - 1 - if (months(1) < 1) months(1) = 12 - if (months(2) > 12) months(2) = 1 - timwt(1) = (it(1)+0.5_r8) - t - timwt(2) = 1._r8-timwt(1) - - if (InterpMonths1 /= months(1)) then - if (masterproc) then - write(iulog,*) 'Attempting to read monthly vegetation data .....' - write(iulog,*) 'nstep = ',get_nstep(),' month = ',kmo,' day = ',kda - end if - call t_startf('readMonthlyVeg') - call readMonthlyVegetation (bounds, fsurdat, months, canopystate_inst) - InterpMonths1 = months(1) - call t_stopf('readMonthlyVeg') - end if - - end subroutine interpMonthlyVeg - - !----------------------------------------------------------------------- - subroutine readAnnualVegetation (bounds, canopystate_inst) - ! - ! !DESCRIPTION: - ! read 12 months of veg data for dry deposition - ! - ! !USES: - use clm_varpar , only : numpft - use pftconMod , only : noveg - use domainMod , only : ldomain - use fileutils , only : getfil - use clm_varctl , only : fsurdat - use shr_scam_mod, only : shr_scam_getCloseLatLon - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set - real(r8), pointer :: mlai(:,:) ! lai read from input files - real(r8):: closelat,closelon ! single column vars - integer :: ier ! error code - integer :: g,k,l,m,n,p ! indices - integer :: ni,nj,ns ! indices - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nlon_i ! number of input data longitudes - integer :: nlat_i ! number of input data latitudes - integer :: npft_i ! number of input data patch types - integer :: closelatidx,closelonidx ! single column vars - logical :: isgrid2d ! true => file is 2d - character(len=256) :: locfn ! local file name - character(len=32) :: subname = 'readAnnualVegetation' - !----------------------------------------------------------------------- - - annlai => canopystate_inst%annlai_patch - - ! Determine necessary indices - - allocate(mlai(bounds%begg:bounds%endg,0:numpft), stat=ier) - if (ier /= 0) then - write(iulog,*)subname, 'allocation error ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (masterproc) then - write (iulog,*) 'Attempting to read annual vegetation data .....' - end if - - call getfil(fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - call check_dim(ncid, 'lsmpft', numpft+1) - - if (single_column) then - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - endif - - do k=1,12 !! loop over months and read vegetated data - - call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, & - dim1name=grlnd, nt=k) - - !! only vegetated patches have nonzero values - !! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] patches - !! as determined in subroutine surfrd - - do p = bounds%begp,bounds%endp - g =patch%gridcell(p) - if (patch%itype(p) /= noveg) then !! vegetated pft - do l = 0, numpft - if (l == patch%itype(p)) then - annlai(k,p) = mlai(g,l) - end if - end do - else !! non-vegetated pft - annlai(k,p) = 0._r8 - end if - end do ! end of loop over patches - - enddo ! months loop - - call ncd_pio_closefile(ncid) - - deallocate(mlai) - - endsubroutine readAnnualVegetation - - !----------------------------------------------------------------------- - subroutine readMonthlyVegetation (bounds, & - fveg, months, canopystate_inst) - ! - ! !DESCRIPTION: - ! Read monthly vegetation data for two consec. months. - ! - ! !USES: - use clm_varpar , only : numpft - use pftconMod , only : noveg - use fileutils , only : getfil - use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_INTEGER - use shr_scam_mod , only : shr_scam_getCloseLatLon - use clm_time_manager , only : get_nstep - use netcdf - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: fveg ! file with monthly vegetation data - integer , intent(in) :: months(2) ! months to be interpolated (1 to 12) - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: g,n,k,l,m,p,ni,nj,ns ! indices - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nlon_i ! number of input data longitudes - integer :: nlat_i ! number of input data latitudes - integer :: npft_i ! number of input data patch types - integer :: ier ! error code - integer :: closelatidx,closelonidx - real(r8):: closelat,closelon - logical :: readvar - real(r8), pointer :: mlai(:,:) ! lai read from input files - real(r8), pointer :: msai(:,:) ! sai read from input files - real(r8), pointer :: mhgtt(:,:) ! top vegetation height - real(r8), pointer :: mhgtb(:,:) ! bottom vegetation height - character(len=32) :: subname = 'readMonthlyVegetation' - !----------------------------------------------------------------------- - - ! Determine necessary indices - - allocate(& - mlai(bounds%begg:bounds%endg,0:numpft), & - msai(bounds%begg:bounds%endg,0:numpft), & - mhgtt(bounds%begg:bounds%endg,0:numpft), & - mhgtb(bounds%begg:bounds%endg,0:numpft), & - stat=ier) - if (ier /= 0) then - write(iulog,*)subname, 'allocation big error ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! ---------------------------------------------------------------------- - ! Open monthly vegetation file - ! Read data and convert from gridcell to patch data - ! ---------------------------------------------------------------------- - - call getfil(fveg, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - if (single_column) then - call shr_scam_getCloseLatLon (ncid, scmlat, scmlon, closelat, closelon,& - closelatidx, closelonidx) - endif - - do k=1,2 !loop over months and read vegetated data - - call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_LAI NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='MONTHLY_SAI', flag='read', data=msai, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_SAI NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='MONTHLY_HEIGHT_TOP', flag='read', data=mhgtt, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='MONTHLY_HEIGHT_BOT', flag='read', data=mhgtb, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun(msg=' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file'//errMsg(sourcefile, __LINE__)) - - ! Only vegetated patches have nonzero values - ! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] patches - ! as determined in subroutine surfrd - - do p = bounds%begp,bounds%endp - g =patch%gridcell(p) - if (patch%itype(p) /= noveg) then ! vegetated pft - do l = 0, numpft - if (l == patch%itype(p)) then - mlai2t(p,k) = mlai(g,l) - msai2t(p,k) = msai(g,l) - mhvt2t(p,k) = mhgtt(g,l) - mhvb2t(p,k) = mhgtb(g,l) - end if - end do - else ! non-vegetated pft - mlai2t(p,k) = 0._r8 - msai2t(p,k) = 0._r8 - mhvt2t(p,k) = 0._r8 - mhvb2t(p,k) = 0._r8 - end if - end do ! end of loop over patches - - end do ! end of loop over months - - call ncd_pio_closefile(ncid) - - if (masterproc) then - k = 2 - write(iulog,*) 'Successfully read monthly vegetation data for' - write(iulog,*) 'month ', months(k) - write(iulog,*) - end if - - deallocate(mlai, msai, mhgtt, mhgtb) - - do p = bounds%begp,bounds%endp - canopystate_inst%mlaidiff_patch(p) = mlai2t(p,1)-mlai2t(p,2) - enddo - - end subroutine readMonthlyVegetation - -end module SatellitePhenologyMod diff --git a/src/biogeochem/SpeciesBaseType.F90 b/src/biogeochem/SpeciesBaseType.F90 deleted file mode 100644 index 239ca91fe3..0000000000 --- a/src/biogeochem/SpeciesBaseType.F90 +++ /dev/null @@ -1,67 +0,0 @@ -module SpeciesBaseType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a base class for working with chemical species, such as building history and - ! restart field names. - ! - ! !USES: - ! - implicit none - private - - ! !PUBLIC TYPES: - - type, abstract, public :: species_base_type - contains - ! Get a history field name for this species - procedure(hist_fname_interface), public, deferred :: hist_fname - - ! Get a restart field name for this species - procedure(rest_fname_interface), public, deferred :: rest_fname - - ! Get the full species name - procedure(get_species_interface), public, deferred :: get_species - end type species_base_type - - abstract interface - pure function hist_fname_interface(this, basename, suffix) result(fname) - ! Get a history field name for this species - ! - ! basename gives the base name of the history field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - import :: species_base_type - - character(len=:) , allocatable :: fname ! function result - class(species_base_type) , intent(in) :: this - character(len=*) , intent(in) :: basename - character(len=*) , optional, intent(in) :: suffix - end function hist_fname_interface - - function rest_fname_interface(this, basename, suffix) result(fname) - ! Get a restart field name for this species - ! - ! basename gives the base name of the restart field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - import :: species_base_type - - character(len=:) , allocatable :: fname ! function result - class(species_base_type) , intent(in) :: this - character(len=*) , intent(in) :: basename - character(len=*) , optional, intent(in) :: suffix - end function rest_fname_interface - - pure function get_species_interface(this) result(species_name) - ! Get the full species name - import :: species_base_type - - character(len=:), allocatable :: species_name - class(species_base_type) , intent(in) :: this - end function get_species_interface - end interface - -end module SpeciesBaseType diff --git a/src/biogeochem/SpeciesIsotopeType.F90 b/src/biogeochem/SpeciesIsotopeType.F90 deleted file mode 100644 index b5fb749823..0000000000 --- a/src/biogeochem/SpeciesIsotopeType.F90 +++ /dev/null @@ -1,136 +0,0 @@ -module SpeciesIsotopeType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a class for working with chemical species, such as building history and - ! restart field names. - ! - ! This version is used for isotopic species - ! - ! !USES: - ! - use SpeciesBaseType, only : species_base_type - use abortutils, only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl, only : iulog - - implicit none - save - private - - ! COMPILER_BUG(wjs, 2016-03-16, pgi 15.10) Ideally, we would use allocatable characters - ! for species_name and isotope_name. However, this causes problems for pgi: it seems - ! that these allocatable characters randomly get changed. So, for now, using - ! fixed-length character variables. (It's possible that this was programmer error on my - ! part, although using allocatable character variables worked with other compilers.) - ! - ! If species_name and isotope_name were changed back to allocatable-length characters, - ! then we could remove the error checking in the constructor as well as various 'trim' - ! statements scattered throughout the code (because this%species_name and - ! this%isotope_name would already be trimmed). - integer, parameter :: species_name_maxlen = 8 - integer, parameter :: isotope_name_maxlen = 8 - - type, extends(species_base_type), public :: species_isotope_type - private - character(len=species_name_maxlen) :: species_name ! does not contain the isotope number - character(len=isotope_name_maxlen) :: isotope_name ! e.g., just the 13 for C13 - contains - procedure, public :: hist_fname - procedure, public :: rest_fname - procedure, public :: get_species - end type species_isotope_type - - interface species_isotope_type - module procedure constructor - end interface species_isotope_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - function constructor(species_name, isotope_name) result(this) - ! Create a species_isotope_type object - - type(species_isotope_type) :: this ! function result - character(len=*), intent(in) :: species_name ! e.g., 'C' or 'N' - without the isotope number - character(len=*), intent(in) :: isotope_name ! e.g., '13' for C13 - !----------------------------------------------------------------------- - - if (len_trim(species_name) > species_name_maxlen) then - write(iulog,*) 'species_isotope_type constructor: species_name too long' - write(iulog,*) trim(species_name) // ' exceeds max length: ', species_name_maxlen - call endrun(msg='species_isotope_type constructor: species_name too long: '// & - errMsg(sourcefile, __LINE__)) - end if - if (len_trim(isotope_name) > isotope_name_maxlen) then - write(iulog,*) 'species_isotope_type constructor: isotope_name too long' - write(iulog,*) trim(isotope_name) // ' exceeds max length: ', isotope_name_maxlen - call endrun(msg='species_isotope_type constructor: isotope_name too long: '// & - errMsg(sourcefile, __LINE__)) - end if - - this%species_name = trim(species_name) - this%isotope_name = trim(isotope_name) - end function constructor - - pure function hist_fname(this, basename, suffix) result(fname) - ! Get a history field name for this species - ! - ! basename gives the base name of the history field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - - character(len=:), allocatable :: fname ! function result - class(species_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - !----------------------------------------------------------------------- - - fname = trim(this%species_name) // trim(this%isotope_name) // '_' // & - trim(basename) // trim(this%species_name) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function hist_fname - - function rest_fname(this, basename, suffix) result(fname) - ! Get a restart field name for this species - ! - ! basename gives the base name of the restart field - ! - ! suffix, if provided, gives a suffix that appears after all species information in - ! the field name - use shr_string_mod, only : shr_string_toLower - - character(len=:), allocatable :: fname ! function result - class(species_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - - character(len=:), allocatable :: species_name_lcase - !----------------------------------------------------------------------- - - species_name_lcase = shr_string_toLower(trim(this%species_name)) - fname = trim(basename) // species_name_lcase // '_' // trim(this%isotope_name) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function rest_fname - - pure function get_species(this) result(species_name) - ! Get the full species name (e.g., 'C13') - - character(len=:), allocatable :: species_name - class(species_isotope_type) , intent(in) :: this - !----------------------------------------------------------------------- - - species_name = trim(this%species_name) // trim(this%isotope_name) - - end function get_species - -end module SpeciesIsotopeType diff --git a/src/biogeochem/SpeciesNonIsotopeType.F90 b/src/biogeochem/SpeciesNonIsotopeType.F90 deleted file mode 100644 index 0daf6b3f72..0000000000 --- a/src/biogeochem/SpeciesNonIsotopeType.F90 +++ /dev/null @@ -1,125 +0,0 @@ -module SpeciesNonIsotopeType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a class for working with chemical species, such as building history and - ! restart field names. - ! - ! This version is used for non-isotopic species - ! - ! !USES: - ! - use SpeciesBaseType, only : species_base_type - use abortutils, only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use clm_varctl, only : iulog - - implicit none - save - private - - ! COMPILER_BUG(wjs, 2016-03-16, pgi 15.10) Ideally, we would use an allocatable - ! character variable for species_name. However, this causes problems for pgi: it seems - ! that this allocatable character variable randomly gets changed. So, for now, using a - ! fixed-length character variable. (It's possible that this was programmer error on my - ! part, although using allocatable character variables worked with other compilers.) - ! - ! If species_name was changed back to an allocatable-length character variable, then we - ! could remove the error checking in the constructor as well as various 'trim' - ! statements scattered throughout the code (because this%species_name would already be - ! trimmed). - integer, parameter :: species_name_maxlen = 8 - - type, extends(species_base_type), public :: species_non_isotope_type - private - character(len=species_name_maxlen) :: species_name - contains - procedure, public :: hist_fname - procedure, public :: rest_fname - procedure, public :: get_species - end type species_non_isotope_type - - interface species_non_isotope_type - module procedure constructor - end interface species_non_isotope_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - function constructor(species_name) result(this) - ! Create a species_non_isotope_type object - - type(species_non_isotope_type) :: this ! function result - character(len=*), intent(in) :: species_name ! e.g., 'C' or 'N' - !----------------------------------------------------------------------- - - if (len_trim(species_name) > species_name_maxlen) then - write(iulog,*) 'species_isotope_type constructor: species_name too long' - write(iulog,*) trim(species_name) // ' exceeds max length: ', species_name_maxlen - call endrun(msg='species_isotope_type constructor: species_name too long: '// & - errMsg(sourcefile, __LINE__)) - end if - - this%species_name = trim(species_name) - end function constructor - - pure function hist_fname(this, basename, suffix) result(fname) - ! Get a history field name for this species - ! - ! basename gives the base name of the history field - ! - ! suffix, if provided, gives a suffix that appears after all species information - ! in the field name - - character(len=:), allocatable :: fname ! function result - class(species_non_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - !----------------------------------------------------------------------- - - fname = trim(basename) // trim(this%species_name) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function hist_fname - - function rest_fname(this, basename, suffix) result(fname) - ! Get a restart field name for this species - ! - ! basename gives the base name of the restart field - ! - ! suffix, if provided, gives a suffix that appears after all species information in - ! the field name - use shr_string_mod, only : shr_string_toLower - - character(len=:), allocatable :: fname ! function result - class(species_non_isotope_type) , intent(in) :: this - character(len=*), intent(in) :: basename - character(len=*), optional, intent(in) :: suffix - - character(len=:), allocatable :: species_name_lcase - !----------------------------------------------------------------------- - - species_name_lcase = shr_string_toLower(trim(this%species_name)) - fname = trim(basename) // trim(species_name_lcase) - if (present(suffix)) then - fname = trim(fname) // trim(suffix) - end if - - end function rest_fname - - pure function get_species(this) result(species_name) - ! Get the full species name - - character(len=:), allocatable :: species_name - class(species_non_isotope_type) , intent(in) :: this - !----------------------------------------------------------------------- - - species_name = trim(this%species_name) - - end function get_species - -end module SpeciesNonIsotopeType diff --git a/src/biogeochem/VOCEmissionMod.F90 b/src/biogeochem/VOCEmissionMod.F90 deleted file mode 100644 index 30dd5ba4e7..0000000000 --- a/src/biogeochem/VOCEmissionMod.F90 +++ /dev/null @@ -1,1102 +0,0 @@ -module VOCEmissionMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Volatile organic compound emission - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use clm_varpar , only : numpft, nlevcan - use pftconMod , only : ndllf_evr_tmp_tree, ndllf_evr_brl_tree - use pftconMod , only : ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree - use pftconMod , only : nbrdlf_evr_tmp_tree, nbrdlf_dcd_brl_shrub - use pftconMod , only : nbrdlf_dcd_trp_tree, nbrdlf_dcd_tmp_tree - use pftconMod , only : nbrdlf_dcd_brl_tree, nbrdlf_evr_shrub - use pftconMod , only : nc3_arctic_grass , nc3crop - use pftconMod , only : nc4_grass, noveg - use shr_megan_mod , only : shr_megan_megcomps_n, shr_megan_megcomp_t, shr_megan_linkedlist - use shr_megan_mod , only : shr_megan_mechcomps_n, shr_megan_mechcomps, shr_megan_mapped_emisfctrs - use MEGANFactorsMod , only : Agro, Amat, Anew, Aold, betaT, ct1, ct2, LDF, Ceo - use decompMod , only : bounds_type - use abortutils , only : endrun - use fileutils , only : getfil - use clm_varcon , only : grlnd - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use SoilStateType , only : soilstate_type - use SolarAbsorbedType , only : solarabs_type - use TemperatureType , only : temperature_type - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: VOCEmission - ! - ! !PUBLIC TYPES: - type, public :: vocemis_type - real(r8) , pointer, private :: Eopt_out_patch (:) ! Eopt coefficient - real(r8) , pointer, private :: topt_out_patch (:) ! topt coefficient - real(r8) , pointer, private :: alpha_out_patch (:) ! alpha coefficient - real(r8) , pointer, private :: cp_out_patch (:) ! cp coefficient - real(r8) , pointer, private :: paru_out_patch (:) ! - real(r8) , pointer, private :: par24u_out_patch (:) ! - real(r8) , pointer, private :: par240u_out_patch (:) ! - real(r8) , pointer, private :: para_out_patch (:) ! - real(r8) , pointer, private :: par24a_out_patch (:) ! - real(r8) , pointer, private :: par240a_out_patch (:) ! - real(r8) , pointer, private :: gamma_out_patch (:) ! - real(r8) , pointer, private :: gammaL_out_patch (:) ! - real(r8) , pointer, private :: gammaT_out_patch (:) ! - real(r8) , pointer, private :: gammaP_out_patch (:) ! - real(r8) , pointer, private :: gammaA_out_patch (:) ! - real(r8) , pointer, private :: gammaS_out_patch (:) ! - real(r8) , pointer, private :: gammaC_out_patch (:) ! - real(r8) , pointer, private :: vocflx_tot_patch (:) ! total VOC flux into atmosphere [moles/m2/sec] - real(r8) , pointer, PUBLIC :: vocflx_patch (:,:) ! (num_mech_comps) MEGAN flux [moles/m2/sec] - real(r8) , pointer, private :: efisop_grc (:,:) ! gridcell isoprene emission factors - contains - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - end type vocemis_type - ! - ! !PRIVATE TYPES: - type :: megan_out_type - ! VOC fluxes structure for CLM history output - real(r8), pointer, private :: flux_out(:) ! patch MEGAN flux [ug C m-2 h-1] - end type megan_out_type - type(megan_out_type), private, pointer :: meg_out(:) ! (n_megan_comps) points to output fluxes - ! - logical, parameter :: debug = .false. - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(vocemis_type) :: this - type(bounds_type), intent(in) :: bounds - - if ( shr_megan_mechcomps_n > 0) then - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! Allocate memory for module datatypes - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_megan_mod , only : shr_megan_factors_file - use MEGANFactorsMod , only : megan_factors_init, megan_factors_get - use clm_varpar , only : mxpft - ! - ! !ARGUMENTS: - class(vocemis_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: i, imeg - integer :: class_num - real(r8) :: factors(mxpft+1) - real(r8) :: molec_wght - integer :: begg, endg - integer :: begp, endp - type(shr_megan_megcomp_t), pointer :: meg_cmp - !----------------------------------------------------------------------- - - - begg = bounds%begg; endg = bounds%endg - begp = bounds%begp; endp = bounds%endp - - call megan_factors_init( shr_megan_factors_file ) - - meg_cmp => shr_megan_linkedlist - do while(associated(meg_cmp)) - allocate(meg_cmp%emis_factors(numpft)) - call megan_factors_get( trim(meg_cmp%name), factors, class_num, molec_wght ) - meg_cmp%emis_factors(1:numpft) = factors(1:numpft) - meg_cmp%class_number = class_num - meg_cmp%molec_weight = molec_wght - meg_cmp => meg_cmp%next_megcomp - enddo - - allocate(this%Eopt_out_patch (begp:endp)) ; this%EOPT_out_patch (:) = nan - allocate(this%topt_out_patch (begp:endp)) ; this%topt_out_patch (:) = nan - allocate(this%topt_out_patch (begp:endp)) ; this%Eopt_out_patch (:) = nan - allocate(this%alpha_out_patch (begp:endp)) ; this%alpha_out_patch (:) = nan - allocate(this%cp_out_patch (begp:endp)) ; this%cp_out_patch (:) = nan - allocate(this%para_out_patch (begp:endp)) ; this%para_out_patch (:) = nan - allocate(this%par24a_out_patch (begp:endp)) ; this%par24a_out_patch (:) = nan - allocate(this%par240a_out_patch (begp:endp)) ; this%par240a_out_patch (:) = nan - allocate(this%paru_out_patch (begp:endp)) ; this%paru_out_patch (:) = nan - allocate(this%par24u_out_patch (begp:endp)) ; this%par24u_out_patch (:) = nan - allocate(this%par240u_out_patch (begp:endp)) ; this%par240u_out_patch (:) = nan - allocate(this%gamma_out_patch (begp:endp)) ; this%gamma_out_patch (:) = nan - allocate(this%gammaL_out_patch (begp:endp)) ; this%gammaL_out_patch (:) = nan - allocate(this%gammaT_out_patch (begp:endp)) ; this%gammaT_out_patch (:) = nan - allocate(this%gammaP_out_patch (begp:endp)) ; this%gammaP_out_patch (:) = nan - allocate(this%gammaA_out_patch (begp:endp)) ; this%gammaA_out_patch (:) = nan - allocate(this%gammaS_out_patch (begp:endp)) ; this%gammaS_out_patch (:) = nan - allocate(this%gammaC_out_patch (begp:endp)) ; this%gammaC_out_patch (:) = nan - - allocate(this%vocflx_tot_patch (begp:endp)); this%vocflx_tot_patch (:) = nan - allocate(this%efisop_grc (6,begg:endg)); this%efisop_grc (:,:) = nan - - allocate(meg_out(shr_megan_megcomps_n)) - do i=1,shr_megan_megcomps_n - allocate(meg_out(i)%flux_out(begp:endp)) - meg_out(i)%flux_out(:) = 0._r8 - end do - - allocate(this%vocflx_patch(begp:endp,1:shr_megan_mechcomps_n)) - this%vocflx_patch(:,1:shr_megan_mechcomps_n)= nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize history output fields for MEGAN emissions diagnositics - ! - ! !USES - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(vocemis_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES - integer :: imeg, ii - integer :: begp, endp - type(shr_megan_megcomp_t), pointer :: meg_cmp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - if (shr_megan_megcomps_n>0) then - - ! loop over megan compounds - meg_cmp => shr_megan_linkedlist - do while(associated(meg_cmp)) - imeg = meg_cmp%index - - call hist_addfld1d ( fname='MEG_'//trim(meg_cmp%name), units='kg/m2/sec', & - avgflag='A', long_name='MEGAN flux', & - ptr_patch=meg_out(imeg)%flux_out, set_lake=0._r8, set_urb=0._r8 ) - - meg_cmp => meg_cmp%next_megcomp - enddo - - this%vocflx_tot_patch(begp:endp)= spval - call hist_addfld1d (fname='VOCFLXT', units='moles/m2/sec', & - avgflag='A', long_name='total VOC flux into atmosphere', & - ptr_patch=this%vocflx_tot_patch, set_lake=0._r8, set_urb=0._r8, default='inactive') - - this%gamma_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMA', units='non', & - avgflag='A', long_name='total gamma for VOC calc', & - ptr_patch=this%gamma_out_patch, set_lake=0._r8, default='inactive') - - this%gammaL_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMAL', units='non', & - avgflag='A', long_name='gamma L for VOC calc', & - ptr_patch=this%gammaL_out_patch, set_lake=0._r8, default='inactive') - - this%gammaT_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMAT', units='non', & - avgflag='A', long_name='gamma T for VOC calc', & - ptr_patch=this%gammaT_out_patch, set_lake=0._r8, default='inactive') - - this%gammaP_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMAP', units='non', & - avgflag='A', long_name='gamma P for VOC calc', & - ptr_patch=this%gammaP_out_patch, set_lake=0._r8, default='inactive') - - this%gammaA_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMAA', units='non', & - avgflag='A', long_name='gamma A for VOC calc', & - ptr_patch=this%gammaA_out_patch, set_lake=0._r8, default='inactive') - - this%gammaS_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMAS', units='non', & - avgflag='A', long_name='gamma S for VOC calc', & - ptr_patch=this%gammaS_out_patch, set_lake=0._r8, default='inactive') - - this%gammaC_out_patch(begp:endp) = spval - call hist_addfld1d (fname='GAMMAC', units='non', & - avgflag='A', long_name='gamma C for VOC calc', & - ptr_patch=this%gammaC_out_patch, set_lake=0._r8, default='inactive') - - this%EOPT_out_patch(begp:endp) = spval - call hist_addfld1d (fname='EOPT', units='non', & - avgflag='A', long_name='Eopt coefficient for VOC calc', & - ptr_patch=this%Eopt_out_patch, set_lake=0._r8, default='inactive') - - this%topt_out_patch(begp:endp) = spval - call hist_addfld1d (fname='TOPT', units='non', & - avgflag='A', long_name='topt coefficient for VOC calc', & - ptr_patch=this%topt_out_patch, set_lake=0._r8, default='inactive') - - this%alpha_out_patch(begp:endp) = spval - call hist_addfld1d (fname='ALPHA', units='non', & - avgflag='A', long_name='alpha coefficient for VOC calc', & - ptr_patch=this%alpha_out_patch, set_lake=0._r8, default='inactive') - - this%cp_out_patch(begp:endp) = spval - call hist_addfld1d (fname='currentPatch', units='non', & - avgflag='A', long_name='currentPatch coefficient for VOC calc', & - ptr_patch=this%cp_out_patch, set_lake=0._r8, default='inactive') - - this%paru_out_patch(begp:endp) = spval - call hist_addfld1d (fname='PAR_sun', units='umol/m2/s', & - avgflag='A', long_name='sunlit PAR', & - ptr_patch=this%paru_out_patch, set_lake=0._r8, default='inactive') - - this%par24u_out_patch(begp:endp) = spval - call hist_addfld1d (fname='PAR24_sun', units='umol/m2/s', & - avgflag='A', long_name='sunlit PAR (24 hrs)', & - ptr_patch=this%par24u_out_patch, set_lake=0._r8, default='inactive') - - this%par240u_out_patch(begp:endp) = spval - call hist_addfld1d (fname='PAR240_sun', units='umol/m2/s', & - avgflag='A', long_name='sunlit PAR (240 hrs)', & - ptr_patch=this%par240u_out_patch, set_lake=0._r8, default='inactive') - - this%para_out_patch(begp:endp) = spval - call hist_addfld1d (fname='PAR_shade', units='umol/m2/s', & - avgflag='A', long_name='shade PAR', & - ptr_patch=this%para_out_patch, set_lake=0._r8, default='inactive') - - this%par24a_out_patch(begp:endp) = spval - call hist_addfld1d (fname='PAR24_shade', units='umol/m2/s', & - avgflag='A', long_name='shade PAR (24 hrs)', & - ptr_patch=this%par24a_out_patch, set_lake=0._r8, default='inactive') - - this%par240a_out_patch(begp:endp) = spval - call hist_addfld1d (fname='PAR240_shade', units='umol/m2/s', & - avgflag='A', long_name='shade PAR (240 hrs)', & - ptr_patch=this%par240a_out_patch, set_lake=0._r8, default='inactive') - - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize cold start conditions for module variables - ! - ! !USES - use ncdio_pio - use clm_varctl, only : fsurdat - ! - ! !ARGUMENTS: - class(vocemis_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - logical :: readvar - integer :: begg, endg - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: locfn ! local filename - real(r8) ,pointer :: temp_ef(:) ! read in - temporary EFs - !----------------------------------------------------------------------- - - begg = bounds%begg; endg = bounds%endg - - ! Time constant - - allocate(temp_ef(begg:endg)) - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - call ncd_io(ncid=ncid, varname='EF1_BTR', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg='iniTimeConst: errror reading EF1_BTR'//errMsg(sourcefile, __LINE__)) - end if - this%efisop_grc(1,begg:endg)=temp_ef(begg:endg) - - call ncd_io(ncid=ncid, varname='EF1_FET', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg='iniTimeConst: errror reading EF1_FET'//errMsg(sourcefile, __LINE__)) - end if - this%efisop_grc(2,begg:endg)=temp_ef(begg:endg) - - call ncd_io(ncid=ncid, varname='EF1_FDT', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg='iniTimeConst: errror reading EF1_FDT'//errMsg(sourcefile, __LINE__)) - end if - this%efisop_grc(3,begg:endg)=temp_ef(begg:endg) - - call ncd_io(ncid=ncid, varname='EF1_SHR', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg='iniTimeConst: errror reading EF1_SHR'//errMsg(sourcefile, __LINE__)) - end if - this%efisop_grc(4,begg:endg)=temp_ef(begg:endg) - - call ncd_io(ncid=ncid, varname='EF1_GRS', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg='iniTimeConst: errror reading EF1_GRS'//errMsg(sourcefile, __LINE__)) - end if - this%efisop_grc(5,begg:endg)=temp_ef(begg:endg) - - call ncd_io(ncid=ncid, varname='EF1_CRP', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg='iniTimeConst: errror reading EF1_CRP'//errMsg(sourcefile, __LINE__)) - end if - this%efisop_grc(6,begg:endg)=temp_ef(begg:endg) - - deallocate(temp_ef) - - call ncd_pio_closefile(ncid) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine VOCEmission (bounds, num_soilp, filter_soilp, & - atm2lnd_inst, canopystate_inst, photosyns_inst, temperature_inst, & - vocemis_inst) - ! - ! ! NEW DESCRIPTION - ! Volatile organic compound emission - ! This code simulates volatile organic compound emissions following - ! MEGAN (Model of Emissions of Gases and Aerosols from Nature) v2.1 - ! for 20 compound classes. The original description of this - ! algorithm (for isoprene only) can be found in Guenther et al., 2006 - ! (we follow equations 2-9, 16-17, 20 for explicit canopy). - ! The model scheme came be described as: - ! E= epsilon * gamma * rho - ! VOC flux (E) [ug m-2 h-1] is calculated from baseline emission - ! factors (epsilon) [ug m-2 h-1] which are specified for each of the 16 - ! CLM Patches (in input file) OR in the case of isoprene, from - ! mapped EFs for each PATCH which reflect species divergence of emissions, - ! particularly in North America. - ! The emission activity factor (gamma) [unitless] for includes - ! dependence on PPFT, temperature, LAI, leaf age and soil moisture. - ! For isoprene only we also include the effect of CO2 inhibition as - ! described by Heald et al., 2009. - ! The canopy environment constant was calculated offline for CLM+CAM at - ! standard conditions. - ! We assume that the escape efficiency (rho) here is unity following - ! Guenther et al., 2006. - ! A manuscript describing MEGAN 2.1 and the implementation in CLM is - ! in preparation: Guenther, Heald et al., 2012 - ! Subroutine written to operate at the patch level. - ! - ! Input: to be read in with EFs and some parameters. - ! Currently these are set in procedure init_EF_params - ! Output: vocflx(shr_megan_mechcomps_n) !VOC flux [moles/m2/sec] - ! - ! !USES: - use subgridAveMod , only : p2g - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp ! number of columns in soil patch filter - integer , intent(in) :: filter_soilp(num_soilp) ! patch filter for soil - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(photosyns_type) , intent(in) :: photosyns_inst - type(temperature_type) , intent(in) :: temperature_inst - type(vocemis_type) , intent(inout) :: vocemis_inst - ! - ! !REVISION HISTORY: - ! 4/29/11: Colette L. Heald: expand MEGAN to 20 compound classes - ! 7 Feb 2012: Francis Vitt: Implemented capability to specify MEGAN emissions in namelist - ! and read in MEGAN factors from file. - ! - ! !LOCAL VARIABLES: - integer :: fp,p,g,c ! indices - real(r8) :: epsilon ! emission factor [ug m-2 h-1] - real(r8) :: gamma ! activity factor (accounting for light, T, age, LAI conditions) - real(r8) :: gamma_p ! activity factor for PPFD - real(r8) :: gamma_l ! activity factor for PPFD & LAI - real(r8) :: gamma_t ! activity factor for temperature - real(r8) :: gamma_a ! activity factor for leaf age - real(r8) :: gamma_sm ! activity factor for soil moisture - real(r8) :: gamma_c ! activity factor for CO2 (only isoprene) - real(r8) :: par_sun ! temporary - real(r8) :: par24_sun ! temporary - real(r8) :: par240_sun ! temporary - real(r8) :: par_sha ! temporary - real(r8) :: par24_sha ! temporary - real(r8) :: par240_sha ! temporary - - integer :: class_num, n_meg_comps, imech, imeg, ii - character(len=16) :: mech_name - type(shr_megan_megcomp_t), pointer :: meg_cmp - real(r8) :: cp, alpha, Eopt, topt ! for history output - real(r8) :: co2_ppmv - - real(r8) :: vocflx_meg(shr_megan_megcomps_n) - - ! factor used convert MEGAN units [micro-grams/m2/hr] to CAM srf emis units [g/m2/sec] - real(r8), parameter :: megemis_units_factor = 1._r8/3600._r8/1.e6_r8 - - ! real(r8) :: root_depth(0:numpft) ! Root depth [m] - character(len=32), parameter :: subname = "VOCEmission" - !----------------------------------------------------------------------- - - ! ! root depth (m) (defined based on Zeng et al., 2001, cf Guenther 2006) - ! root_depth(noveg) = 0._r8 ! bare-soil - ! root_depth(ndllf_evr_tmp_tree:ndllf_evr_brl_tree) = 1.8_r8 ! evergreen tree - ! root_depth(ndllf_dcd_brl_tree) = 2.0_r8 ! needleleaf deciduous boreal tree - ! root_depth(nbrdlf_evr_trp_tree:nbrdlf_evr_tmp_tree) = 3.0_r8 ! broadleaf evergreen tree - ! root_depth(nbrdlf_dcd_trp_tree:nbrdlf_dcd_brl_tree) = 2.0_r8 ! broadleaf deciduous tree - ! root_depth(nbrdlf_evr_shrub:nbrdlf_dcd_brl_shrub) = 2.5_r8 ! shrub - ! root_depth(nc3_arctic_grass:numpft) = 1.5_r8 ! grass/crop - ! - if ( shr_megan_mechcomps_n < 1) return - - if ( nlevcan /= 1 )then - call endrun( subname//' error: can NOT work without nlevcan == 1' ) - end if - - associate( & - !dz => col%dz , & ! Input: [real(r8) (:,:) ] depth of layer (m) - !bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" (nlevgrnd) - !clayfrac => soilstate_inst%clayfrac_col , & ! Input: [real(r8) (:) ] fraction of soil that is clay - !sandfrac => soilstate_inst%sandfrac_col , & ! Input: [real(r8) (:) ] fraction of soil that is sand - !watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) (nlevgrnd) - !sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) (nlevgrnd) - !h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (m3/m3) - !h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice soil content (kg/m3) - - forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (visible only) - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (visible only) - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] downscaled atmospheric pressure (Pa) - forc_pco2 => atm2lnd_inst%forc_pco2_grc , & ! Input: [real(r8) (:) ] partial pressure co2 (Pa) - forc_solad24 => atm2lnd_inst%fsd24_patch , & ! Input: [real(r8) (:) ] direct beam radiation last 24hrs (visible only) - forc_solad240 => atm2lnd_inst%fsd240_patch , & ! Input: [real(r8) (:) ] direct beam radiation last 240hrs (visible only) - forc_solai24 => atm2lnd_inst%fsi24_patch , & ! Input: [real(r8) (:) ] diffuse radiation last 24hrs (visible only) - forc_solai240 => atm2lnd_inst%fsi240_patch , & ! Input: [real(r8) (:) ] diffuse radiation last 240hrs (visible only) - - fsun => canopystate_inst%fsun_patch , & ! Input: [real(r8) (:) ] sunlit fraction of canopy - fsun24 => canopystate_inst%fsun24_patch , & ! Input: [real(r8) (:) ] sunlit fraction of canopy last 24 hrs - fsun240 => canopystate_inst%fsun240_patch , & ! Input: [real(r8) (:) ] sunlit fraction of canopy last 240 hrs - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - elai240 => canopystate_inst%elai240_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow last 240 hrs - - cisun_z => photosyns_inst%cisun_z_patch , & ! Input: [real(r8) (:,:) ] sunlit intracellular CO2 (Pa) - cisha_z => photosyns_inst%cisha_z_patch , & ! Input: [real(r8) (:,:) ] shaded intracellular CO2 (Pa) - - t_veg => temperature_inst%t_veg_patch , & ! Input: [real(r8) (:) ] patch vegetation temperature (Kelvin) - t_veg24 => temperature_inst%t_veg24_patch , & ! Input: [real(r8) (:) ] avg patch vegetation temperature for last 24 hrs - t_veg240 => temperature_inst%t_veg240_patch , & ! Input: [real(r8) (:) ] avg patch vegetation temperature for last 240 hrs - - Eopt_out => vocemis_inst%Eopt_out_patch , & ! Output: [real(r8) (:) ] - topt_out => vocemis_inst%topt_out_patch , & ! Output: [real(r8) (:) ] - alpha_out => vocemis_inst%alpha_out_patch , & ! Output: [real(r8) (:) ] - cp_out => vocemis_inst%cp_out_patch , & ! Output: [real(r8) (:) ] - paru_out => vocemis_inst%paru_out_patch , & ! Output: [real(r8) (:) ] - par24u_out => vocemis_inst%par24u_out_patch , & ! Output: [real(r8) (:) ] - par240u_out => vocemis_inst%par240u_out_patch , & ! Output: [real(r8) (:) ] - para_out => vocemis_inst%para_out_patch , & ! Output: [real(r8) (:) ] - par24a_out => vocemis_inst%par24a_out_patch , & ! Output: [real(r8) (:) ] - par240a_out => vocemis_inst%par240a_out_patch , & ! Output: [real(r8) (:) ] - gammaL_out => vocemis_inst%gammaL_out_patch , & ! Output: [real(r8) (:) ] - gammaT_out => vocemis_inst%gammaT_out_patch , & ! Output: [real(r8) (:) ] - gammaP_out => vocemis_inst%gammaP_out_patch , & ! Output: [real(r8) (:) ] - gammaA_out => vocemis_inst%gammaA_out_patch , & ! Output: [real(r8) (:) ] - gammaS_out => vocemis_inst%gammaS_out_patch , & ! Output: [real(r8) (:) ] - gammaC_out => vocemis_inst%gammaC_out_patch , & ! Output: [real(r8) (:) ] - gamma_out => vocemis_inst%gamma_out_patch , & ! Output: [real(r8) (:) ] - vocflx => vocemis_inst%vocflx_patch , & ! Output: [real(r8) (:,:) ] VOC flux [moles/m2/sec] - vocflx_tot => vocemis_inst%vocflx_tot_patch & ! Output: [real(r8) (:) ] VOC flux [moles/m2/sec] - ) - - ! initialize variables which get passed to the atmosphere - vocflx(bounds%begp:bounds%endp,:) = 0._r8 - vocflx_tot(bounds%begp:bounds%endp) = 0._r8 - - do imeg=1,shr_megan_megcomps_n - meg_out(imeg)%flux_out(bounds%begp:bounds%endp) = 0._r8 - enddo - - ! Begin loop over points - !_______________________________________________________________________________ - do fp = 1,num_soilp - p = filter_soilp(fp) - g = patch%gridcell(p) - c = patch%column(p) - - ! initialize EF - epsilon=0._r8 - - ! initalize to zero since this might not alway get set - ! this needs to be within the fp loop ... - vocflx_meg(:) = 0._r8 - - ! calculate VOC emissions for non-bare ground Patches - if (patch%itype(p) > 0) then - gamma=0._r8 - - ! Calculate PAR: multiply w/m2 by 4.6 to get umol/m2/s for par (added 8/14/02) - !------------------------ - ! SUN: - par_sun = (forc_solad(g,1) + fsun(p) * forc_solai(g,1)) * 4.6_r8 - par24_sun = (forc_solad24(p) + fsun24(p) * forc_solai24(p)) * 4.6_r8 - par240_sun = (forc_solad240(p) + fsun240(p) * forc_solai240(p)) * 4.6_r8 - - ! SHADE: - par_sha = ((1._r8 - fsun(p)) * forc_solai(g,1)) * 4.6_r8 - par24_sha = ((1._r8 - fsun24(p)) * forc_solai24(p)) * 4.6_r8 - par240_sha = ((1._r8 - fsun240(p)) * forc_solai240(p)) * 4.6_r8 - - ! Activity factor for LAI (Guenther et al., 2006): all species - gamma_l = get_gamma_L(fsun240(p), elai(p)) - - ! Activity factor for soil moisture: all species (commented out for now) - ! gamma_sm = get_gamma_SM(clayfrac(p), sandfrac(p), h2osoi_vol(c,:), h2osoi_ice(c,:), & - ! col%dz(c,:), soilstate_inst%bsw_col(c,:), watsat(c,:), sucsat(c,:), root_depth(patch%itype(p))) - gamma_sm = 1.0_r8 - - ! Loop through VOCs for light, temperature and leaf age activity factor & apply - ! all final activity factors to baseline emission factors - !_______________________________________________________________________________ - - ! loop over megan compounds - meg_cmp => shr_megan_linkedlist - meg_cmp_loop: do while(associated(meg_cmp)) - imeg = meg_cmp%index - - ! set emis factor - ! if specified, set EF for isoprene with mapped values - if ( trim(meg_cmp%name) == 'isoprene' .and. shr_megan_mapped_emisfctrs) then - epsilon = get_map_EF(patch%itype(p),g, vocemis_inst) - else - epsilon = meg_cmp%emis_factors(patch%itype(p)) - end if - - class_num = meg_cmp%class_number - - ! Activity factor for PPFD - gamma_p = get_gamma_P(par_sun, par24_sun, par240_sun, par_sha, par24_sha, par240_sha, & - fsun(p), fsun240(p), forc_solad240(p),forc_solai240(p), LDF(class_num), cp, alpha) - - ! Activity factor for T - gamma_t = get_gamma_T(t_veg240(p), t_veg24(p),t_veg(p), ct1(class_num), ct2(class_num),& - betaT(class_num),LDF(class_num), Ceo(class_num), Eopt, topt) - - ! Activity factor for Leaf Age - gamma_a = get_gamma_A(patch%itype(p), elai240(p),elai(p),class_num) - - ! Activity factor for CO2 (only for isoprene) - if (trim(meg_cmp%name) == 'isoprene') then - co2_ppmv = 1.e6*forc_pco2(g)/forc_pbot(c) - gamma_c = get_gamma_C(cisun_z(p,1),cisha_z(p,1),forc_pbot(c),fsun(p), co2_ppmv) - else - gamma_c = 1._r8 - end if - - ! Calculate total scaling factor - gamma = gamma_l * gamma_sm * gamma_a * gamma_p * gamma_T * gamma_c - - if ( (gamma >=0.0_r8) .and. (gamma< 100._r8) ) then - - vocflx_meg(imeg) = meg_cmp%coeff * epsilon * gamma * megemis_units_factor / meg_cmp%molec_weight ! moles/m2/sec - - ! assign to arrays for history file output (not weighted by landfrac) - meg_out(imeg)%flux_out(p) = meg_out(imeg)%flux_out(p) & - + epsilon * gamma * megemis_units_factor*1.e-3_r8 ! Kg/m2/sec - - if (imeg==1) then - ! - gamma_out(p)=gamma - gammaP_out(p)=gamma_p - gammaT_out(p)=gamma_t - gammaA_out(p)=gamma_a - gammaS_out(p)=gamma_sm - gammaL_out(p)=gamma_l - gammaC_out(p)=gamma_c - - paru_out(p)=par_sun - par24u_out(p)=par24_sun - par240u_out(p)=par240_sun - - para_out(p)=par_sha - par24a_out(p)=par24_sha - par240a_out(p)=par240_sha - - alpha_out(p)=alpha - cp_out(p)=cp - - topt_out(p)=topt - Eopt_out(p)=Eopt - - end if - endif - - if (debug .and. gamma > 0.0_r8) then - write(iulog,*) 'MEGAN: n, megan name, epsilon, gamma, vocflx: ', & - imeg, meg_cmp%name, epsilon, gamma, vocflx_meg(imeg), gamma_p,gamma_t,gamma_a,gamma_sm,gamma_l - endif - - meg_cmp => meg_cmp%next_megcomp - enddo meg_cmp_loop - - ! sum up the megan compound fluxes for the fluxes of chem mechanism compounds - do imech = 1,shr_megan_mechcomps_n - n_meg_comps = shr_megan_mechcomps(imech)%n_megan_comps - do imeg = 1,n_meg_comps ! loop over number of megan compounds that make up the nth mechanism compoud - ii = shr_megan_mechcomps(imech)%megan_comps(imeg)%ptr%index - vocflx(p,imech) = vocflx(p,imech) + vocflx_meg(ii) - enddo - vocflx_tot(p) = vocflx_tot(p) + vocflx(p,imech) ! moles/m2/sec - enddo - - end if ! patch%itype(1:15 only) - - enddo ! fp - - - end associate - end subroutine VOCEmission - - !----------------------------------------------------------------------- - function get_map_EF(ivt_in, g_in, vocemis_inst) - ! - ! Get mapped EF for isoprene - ! Use gridded values for 6 Patches specified by MEGAN following - ! Guenther et al. (2006). Map the numpft CLM Patches to these 6. - ! Units: [ug m-2 h-1] - ! - ! !ARGUMENTS: - integer, intent(in) :: ivt_in - integer, intent(in) :: g_in - type(vocemis_type), intent(in) :: vocemis_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: get_map_EF - !----------------------------------------------------------------------- - - ! vocemis_inst%efisop_patch ! Output: [real(r8) (:,:)] emission factors for isoprene for each patch [ug m-2 h-1] - - get_map_EF = 0._r8 - - if ( ivt_in == ndllf_evr_tmp_tree & - .or. ivt_in == ndllf_evr_brl_tree) then !fineleaf evergreen - get_map_EF = vocemis_inst%efisop_grc(2,g_in) - else if (ivt_in == ndllf_dcd_brl_tree) then !fineleaf deciduous - get_map_EF = vocemis_inst%efisop_grc(3,g_in) - else if (ivt_in >= nbrdlf_evr_trp_tree & - .and. ivt_in <= nbrdlf_dcd_brl_tree) then !broadleaf trees - get_map_EF = vocemis_inst%efisop_grc(1,g_in) - else if (ivt_in >= nbrdlf_evr_shrub & - .and. ivt_in <= nbrdlf_dcd_brl_shrub) then !shrubs - get_map_EF = vocemis_inst%efisop_grc(4,g_in) - else if (ivt_in >= nc3_arctic_grass & - .and. ivt_in <= nc4_grass) then !grass - get_map_EF = vocemis_inst%efisop_grc(5,g_in) - else if (ivt_in >= nc3crop) then !crops - get_map_EF = vocemis_inst%efisop_grc(6,g_in) - end if - - end function get_map_EF - - !----------------------------------------------------------------------- - function get_gamma_P(par_sun_in, par24_sun_in, par240_sun_in, par_sha_in, par24_sha_in, par240_sha_in, & - fsun_in, fsun240_in, forc_solad240_in,forc_solai240_in, LDF_in, cp, alpha) - ! - ! Activity factor for PPFD (Guenther et al., 2006): all light dependent species - !------------------------- - ! With distinction between sunlit and shaded leafs, weight scalings by - ! fsun and fshade - ! Scale total incident par by fraction of sunlit leaves (added on 1/2002) - - ! fvitt -- forc_solad240, forc_solai240 can be zero when CLM finidat is specified - ! which will cause par240 to be zero and produce NaNs via log(par240) - ! dml -- fsun240 can be equal to or greater than one before 10 day averages are - ! set on startup or if a new patch comes online during land cover change. - ! Avoid this problem by only doing calculations with fsun240 when fsun240 is - ! between 0 and 1 - ! - ! !ARGUMENTS: - implicit none - real(r8),intent(in) :: par_sun_in - real(r8),intent(in) :: par24_sun_in - real(r8),intent(in) :: par240_sun_in - real(r8),intent(in) :: par_sha_in - real(r8),intent(in) :: par24_sha_in - real(r8),intent(in) :: par240_sha_in - real(r8),intent(in) :: fsun_in - real(r8),intent(in) :: fsun240_in - real(r8),intent(in) :: forc_solad240_in - real(r8),intent(in) :: forc_solai240_in - real(r8),intent(in) :: LDF_in - real(r8),intent(out):: cp ! temporary - real(r8),intent(out):: alpha ! temporary - ! - ! !LOCAL VARIABLES: - real(r8) :: gamma_p_LDF ! activity factor for PPFD - real(r8) :: get_gamma_P ! return value - real(r8), parameter :: ca1 = 0.004_r8 ! empirical coefficent for alpha - real(r8), parameter :: ca2 = 0.0005_r8 ! empirical coefficent for alpha - real(r8), parameter :: ca3 = 0.0468_r8 ! empirical coefficent for cp - real(r8), parameter :: par0_sun = 200._r8 ! std conditions for past 24 hrs [umol/m2/s] - real(r8), parameter :: par0_shade = 50._r8 ! std conditions for past 24 hrs [umol/m2/s] - real(r8), parameter :: alpha_fix = 0.001_r8 ! empirical coefficient - real(r8), parameter :: cp_fix = 1.21_r8 ! empirical coefficient - !----------------------------------------------------------------------- - - if ( (fsun240_in > 0._r8) .and. (fsun240_in < 1._r8) .and. (forc_solad240_in > 0._r8) & - .and. (forc_solai240_in > 0._r8)) then - ! With alpha and cp calculated based on eq 6 and 7: - ! Note indexing for accumulated variables is all at patch level - ! SUN: - alpha = ca1 - ca2 * log(par240_sun_in) - cp = ca3 * exp(ca2 * (par24_sun_in-par0_sun))*par240_sun_in**(0.6_r8) - gamma_p_LDF = fsun_in * ( cp * alpha * par_sun_in * (1._r8 + alpha*alpha*par_sun_in*par_sun_in)**(-0.5_r8) ) - ! SHADE: - alpha = ca1 - ca2 * log(par240_sha_in) - cp = ca3 * exp(ca2 * (par_sha_in-par0_shade))*par240_sha_in**(0.6_r8) - gamma_p_LDF = gamma_p_LDF + (1._r8-fsun_in) * (cp*alpha*par_sha_in*(1._r8 + alpha*alpha*par_sha_in*par_sha_in)**(-0.5_r8)) - else - ! With fixed alpha and cp (from MEGAN User's Guide): - ! SUN: direct + diffuse - alpha = alpha_fix - cp = cp_fix - gamma_p_LDF = fsun_in * ( cp * alpha*par_sun_in * (1._r8 + alpha*alpha*par_sun_in*par_sun_in)**(-0.5_r8) ) - ! SHADE: diffuse - gamma_p_LDF = gamma_p_LDF + (1._r8-fsun_in) * (cp*alpha*par_sha_in*(1._r8 + alpha*alpha*par_sha_in*par_sha_in)**(-0.5_r8)) - end if - - ! Calculate total activity factor for PPFD accounting for light-dependent fraction - get_gamma_P = (1._r8 - LDF_in) + LDF_in * gamma_p_LDF - - end function get_gamma_P - - !----------------------------------------------------------------------- - function get_gamma_L(fsun240_in,elai_in) - ! - ! Activity factor for LAI (Guenther et al., 2006): all species - ! Guenther et al., 2006 eq 3 - ! - ! !USES: - use clm_varcon , only : denice - use clm_varpar , only : nlevsoi - ! - ! !ARGUMENTS: - implicit none - real(r8),intent(in) :: fsun240_in - real(r8),intent(in) :: elai_in - real(r8) :: get_gamma_L ! return value - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: cce = 0.30_r8 ! factor to set emissions to unity @ std - real(r8), parameter :: cce1 = 0.24_r8 ! same as Cce but for non-accumulated vars - !----------------------------------------------------------------------- - if ( (fsun240_in > 0.0_r8) .and. (fsun240_in < 1.e30_r8) ) then - get_gamma_L = cce * elai_in - else - get_gamma_L = cce1 * elai_in - end if - - end function get_gamma_L - - !----------------------------------------------------------------------- - function get_gamma_SM(clayfrac_in, sandfrac_in, h2osoi_vol_in, h2osoi_ice_in, dz_in, & - bsw_in, watsat_in, sucsat_in, root_depth_in) - ! - ! Activity factor for soil moisture (Guenther et al., 2006): all species - !---------------------------------- - ! Calculate the mean scaling factor throughout the root depth. - ! wilting point potential is in units of matric potential (mm) - ! (1 J/Kg = 0.001 MPa, approx = 0.1 m) - ! convert to volumetric soil water using equation 7.118 of the CLM4 Technical Note - ! - ! !USES: - use clm_varcon , only : denice - use clm_varpar , only : nlevsoi - ! - ! !ARGUMENTS: - implicit none - real(r8),intent(in) :: clayfrac_in - real(r8),intent(in) :: sandfrac_in - real(r8),intent(in) :: h2osoi_vol_in(nlevsoi) - real(r8),intent(in) :: h2osoi_ice_in(nlevsoi) - real(r8),intent(in) :: dz_in(nlevsoi) - real(r8),intent(in) :: bsw_in(nlevsoi) - real(r8),intent(in) :: watsat_in(nlevsoi) - real(r8),intent(in) :: sucsat_in(nlevsoi) - real(r8),intent(in) :: root_depth_in - ! - ! !LOCAL VARIABLES: - real(r8) :: get_gamma_SM - integer :: j - real(r8) :: nl ! temporary number of soil levels - real(r8) :: theta_ice ! water content in ice in m3/m3 - real(r8) :: wilt ! wilting point in m3/m3 - real(r8) :: theta1 ! temporary - real(r8), parameter :: deltheta1=0.06_r8 ! empirical coefficient - real(r8), parameter :: smpmax = 2.57e5_r8 ! maximum soil matrix potential - !----------------------------------------------------------------------- - - if ((clayfrac_in > 0) .and. (sandfrac_in > 0)) then - get_gamma_SM = 0._r8 - nl=0._r8 - - do j = 1,nlevsoi - if (sum(dz_in(1:j)) < root_depth_in) then - theta_ice = h2osoi_ice_in(j)/(dz_in(j)*denice) - wilt = ((smpmax/sucsat_in(j))**(-1._r8/bsw_in(j))) * (watsat_in(j) - theta_ice) - theta1 = wilt + deltheta1 - if (h2osoi_vol_in(j) >= theta1) then - get_gamma_SM = get_gamma_SM + 1._r8 - else if ( (h2osoi_vol_in(j) > wilt) .and. (h2osoi_vol_in(j) < theta1) ) then - get_gamma_SM = get_gamma_SM + ( h2osoi_vol_in(j) - wilt ) / deltheta1 - else - get_gamma_SM = get_gamma_SM + 0._r8 - end if - nl=nl+1._r8 - end if - end do - - if (nl > 0._r8) then - get_gamma_SM = get_gamma_SM/nl - endif - - if (get_gamma_SM > 1.0_r8) then - write(iulog,*) 'healdSM > 1: gamma_SM, nl', get_gamma_SM, nl - get_gamma_SM=1.0_r8 - endif - - else - get_gamma_SM = 1.0_r8 - end if - - end function get_gamma_SM - - !----------------------------------------------------------------------- - function get_gamma_T(t_veg240_in, t_veg24_in,t_veg_in, ct1_in, ct2_in, betaT_in, LDF_in, Ceo_in, Eopt, topt) - - ! Activity factor for temperature - !-------------------------------- - ! Calculate both a light-dependent fraction as in Guenther et al., 2006 for isoprene - ! of a max saturation type form. Also caculate a light-independent fraction of the - ! form of an exponential. Final activity factor depends on light dependent fraction - ! of compound type. - ! - ! !ARGUMENTS: - implicit none - real(r8),intent(in) :: t_veg240_in - real(r8),intent(in) :: t_veg24_in - real(r8),intent(in) :: t_veg_in - real(r8),intent(in) :: ct1_in - real(r8),intent(in) :: ct2_in - real(r8),intent(in) :: betaT_in - real(r8),intent(in) :: LDF_in - real(r8),intent(in) :: Ceo_in - real(r8),intent(out) :: Eopt ! temporary - real(r8),intent(out) :: topt ! temporary - ! - ! !LOCAL VARIABLES: - real(r8) :: get_gamma_T - real(r8) :: gamma_t_LDF ! activity factor for temperature - real(r8) :: gamma_t_LIF ! activity factor for temperature - real(r8) :: x ! temporary - real(r8), parameter :: co1 = 313._r8 ! empirical coefficient - real(r8), parameter :: co2 = 0.6_r8 ! empirical coefficient - real(r8), parameter :: co4 = 0.05_r8 ! empirical coefficient - real(r8), parameter :: tstd0 = 297_r8 ! std temperature [K] - real(r8), parameter :: topt_fix = 317._r8 ! std temperature [K] - real(r8), parameter :: Eopt_fix = 2.26_r8 ! empirical coefficient - real(r8), parameter :: ct3 = 0.00831_r8 ! empirical coefficient (0.0083 in User's Guide) - real(r8), parameter :: tstd = 303.15_r8 ! std temperature [K] - real(r8), parameter :: bet = 0.09_r8 ! beta empirical coefficient [K-1] - !----------------------------------------------------------------------- - - ! Light dependent fraction (Guenther et al., 2006) - if ( (t_veg240_in > 0.0_r8) .and. (t_veg240_in < 1.e30_r8) ) then - ! topt and Eopt from eq 8 and 9: - topt = co1 + (co2 * (t_veg240_in-tstd0)) - Eopt = Ceo_in * exp (co4 * (t_veg24_in-tstd0)) * exp(co4 * (t_veg240_in -tstd0)) - else - topt = topt_fix - Eopt = Eopt_fix - endif - x = ( (1._r8/topt) - (1._r8/(t_veg_in)) ) / ct3 - gamma_t_LDF = Eopt * ( ct2_in * exp(ct1_in * x)/(ct2_in - ct1_in * (1._r8 - exp(ct2_in * x))) ) - - - ! Light independent fraction (of exp(beta T) form) - gamma_t_LIF = exp(betaT_in * (t_veg_in - tstd)) - - ! Calculate total activity factor for light as a function of light-dependent fraction - !-------------------------------- - get_gamma_T = (1-LDF_in)*gamma_T_LIF + LDF_in*gamma_T_LDF - - end function get_gamma_T - - !----------------------------------------------------------------------- - function get_gamma_A(ivt_in, elai240_in, elai_in, nclass_in) - - ! Activity factor for leaf age (Guenther et al., 2006) - !----------------------------- - ! If not CNDV elai is constant therefore gamma_a=1.0 - ! gamma_a set to unity for evergreens (Patches 1, 2, 4, 5) - ! Note that we assume here that the time step is shorter than the number of - !days after budbreak required to induce isoprene emissions (ti=12 days) and - ! the number of days after budbreak to reach peak emission (tm=28 days) - ! - ! !ARGUMENTS: - implicit none - integer,intent(in) :: ivt_in - integer,intent(in) :: nclass_in - real(r8),intent(in) :: elai240_in - real(r8),intent(in) :: elai_in - ! - ! !LOCAL VARIABLES: - real(r8) :: get_gamma_A - real(r8) :: elai_prev ! lai for previous timestep - real(r8) :: fnew, fgro, fmat, fold ! fractions of leaves at different phenological stages - !----------------------------------------------------------------------- - if ( (ivt_in == ndllf_dcd_brl_tree) .or. (ivt_in >= nbrdlf_dcd_trp_tree) ) then ! non-evergreen - - if ( (elai240_in > 0.0_r8) .and. (elai240_in < 1.e30_r8) )then - elai_prev = 2._r8*elai240_in-elai_in ! have accumulated average lai over last 10 days - if (elai_prev == elai_in) then - fnew = 0.0_r8 - fgro = 0.0_r8 - fmat = 1.0_r8 - fold = 0.0_r8 - else if (elai_prev > elai_in) then - fnew = 0.0_r8 - fgro = 0.0_r8 - fmat = 1.0_r8 - (elai_prev - elai_in)/elai_prev - fold = (elai_prev - elai_in)/elai_prev - else if (elai_prev < elai_in) then - fnew = 1 - (elai_prev / elai_in) - fgro = 0.0_r8 - fmat = (elai_prev / elai_in) - fold = 0.0_r8 - end if - - get_gamma_A = fnew*Anew(nclass_in) + fgro*Agro(nclass_in) + fmat*Amat(nclass_in) + fold*Aold(nclass_in) - - else - get_gamma_A = 1.0_r8 - end if - - else - get_gamma_A = 1.0_r8 - end if - - - end function get_gamma_A - - !----------------------------------------------------------------------- - function get_gamma_C(cisun_in,cisha_in,forc_pbot_in,fsun_in, co2_ppmv) - - ! Activity factor for instantaneous CO2 changes (Heald et al., 2009) - !------------------------- - ! With distinction between sunlit and shaded leaves, weight scalings by - ! fsun and fshade - ! - ! !CALLED FROM: VOCEmission - ! - ! !REVISION HISTORY: - ! Author: Colette L. Heald (11/30/11) - ! Louisa K. Emmons (16/03/2015) - implement Colette's intended code - ! and use atmosphere CO2 (not nml setting) - ! - ! !USES: - ! use clm_varctl, only : co2_ppmv ! corresponds to CCSM_CO2_PPMV set in env_conf.xml - ! - ! !ARGUMENTS: - implicit none - ! !LOCAL VARIABLES: - - ! varibles in - real(r8),intent(in) :: cisun_in - real(r8),intent(in) :: cisha_in - real(r8),intent(in) :: forc_pbot_in - real(r8),intent(in) :: fsun_in - real(r8),intent(in) :: co2_ppmv - - real(r8) :: get_gamma_C - - ! local variables - real(r8) :: Ismax ! empirical coeff for CO2 - real(r8) :: h ! empirical coeff for CO2 - real(r8) :: Cstar ! empirical coeff for CO2 - real(r8) :: fint ! interpolation fraction for CO2 - real(r8) :: ci ! temporary sunlight/shade weighted cisun & cisha (umolCO2/mol) - real(r8) :: gamma_ci ! short-term exposure gamma - real(r8) :: gamma_ca ! long-term exposure gamma - real(r8), parameter :: Ismax_ca = 1.344_r8 ! Estimated asymptote at which further decreases in intercellular CO2 have a negligible effect on isoprene emission - real(r8), parameter :: h_ca = 1.4614_r8 ! Exponential scalar - real(r8), parameter :: Cstar_ca = 585._r8 ! Scaling coefficient - real(r8), parameter :: CiCa_ratio = 0.7_r8 ! Ratio of intercellular CO2 to atmospheric CO2 - !----------------------------------------------------------------------- - - - ! LONG-TERM EXPOSURE (based on ambient CO2, Ca) - !----------------------------------------------------------------------------- - gamma_ca = Ismax_ca - ((Ismax_ca * (CiCa_ratio*co2_ppmv)**h_ca) / (Cstar_ca**h_ca + (CiCa_ratio*co2_ppmv)**h_ca) ) - - - ! SHORT-TERM EXPOSURE (based on intercellular CO2, Ci) - !----------------------------------------------------------------------------- - ! Determine long-term CO2 growth environment (ie. ambient CO2) and interpolate - ! parameters - if ( co2_ppmv < 400._r8 ) then - Ismax = 1.072_r8 - h = 1.70_r8 - Cstar = 1218._r8 - else if ( (co2_ppmv > 400._r8) .and. (co2_ppmv < 600._r8) ) then - fint = (co2_ppmv - 400._r8)/200._r8 - Ismax = fint*1.036_r8 + (1.- fint)*1.072_r8 - h = fint*2.0125_r8 + (1.- fint)*1.70_r8 - Cstar = fint*1150._r8 + (1.- fint)*1218._r8 - else if ( (co2_ppmv > 600._r8) .and. (co2_ppmv < 800._r8) ) then - fint = (co2_ppmv - 600._r8)/200._r8 - Ismax = fint*1.046_r8 + (1.- fint)*1.036_r8 - h = fint*1.5380_r8 + (1.- fint)*2.0125_r8 - Cstar = fint*2025._r8 + (1.- fint)*1150._r8 - else if ( co2_ppmv > 800._r8 ) then - Ismax = 1.014_r8 - h = 2.861_r8 - Cstar = 1525._r8 - end if - - ! Intercellular CO2 concentrations (ci) given in Pa, divide by atmos - ! pressure to get mixing ratio (umolCO2/mol) - if ( (cisun_in .eq. cisun_in) .and. (cisha_in .eq. cisha_in) .and. (forc_pbot_in > 0._r8) .and. (fsun_in > 0._r8) ) then - ci = ( fsun_in*cisun_in + (1._r8-fsun_in)*cisha_in )/forc_pbot_in * 1.e6_r8 - gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) ) - else if ( (cisun_in > 0.0_r8) .and. (cisun_in < 1.e30_r8) .and. (forc_pbot_in > 0._r8) .and. (fsun_in .eq. 1._r8) ) then - ci = cisun_in/forc_pbot_in * 1.e6_r8 - gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) ) - else if ( (cisha_in > 0.0_r8) .and. (cisha_in < 1.e30_r8) .and. (forc_pbot_in > 0._r8) .and. (fsun_in .eq. 0._r8) ) then - ci = cisha_in/forc_pbot_in * 1.e6_r8 - gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) ) - else - gamma_ci = 1._r8 - end if - - get_gamma_C = gamma_ci * gamma_ca - - end function get_gamma_C - -end module VOCEmissionMod - - diff --git a/src/biogeochem/ch4FInundatedStreamType.F90 b/src/biogeochem/ch4FInundatedStreamType.F90 deleted file mode 100644 index eb9f743f67..0000000000 --- a/src/biogeochem/ch4FInundatedStreamType.F90 +++ /dev/null @@ -1,393 +0,0 @@ - -module ch4FInundatedStreamType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains methods for reading in finundated streams file for methane code. - ! - ! !USES - use shr_kind_mod , only: r8 => shr_kind_r8, CL => shr_kind_cl - use spmdMod , only: mpicom, masterproc - use clm_varctl , only: iulog - use abortutils , only: endrun - use decompMod , only: bounds_type - use ch4varcon , only: finundation_mtd - - ! !PUBLIC TYPES: - implicit none - private - save - - type, public :: ch4finundatedstream_type - real(r8), pointer, private :: zwt0_gdc (:) ! col coefficient for determining finundated (m) - real(r8), pointer, private :: f0_gdc (:) ! col maximum inundated fraction for a gridcell (for methane code) - real(r8), pointer, private :: p3_gdc (:) ! col coefficient for determining finundated (m) - real(r8), pointer, private :: fws_slope_gdc (:) ! col slope in fws = slope * tws + intercept (A coefficient) - real(r8), pointer, private :: fws_intercept_gdc (:) ! col slope in fws = slope * tws + intercept (B coefficient) - contains - - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: Init ! Initialize and read data in - procedure, public :: CalcFinundated ! Calculate finundated based on input streams - procedure, public :: UseStreams ! If streams will be used - - ! !PRIVATE MEMBER FUNCTIONS: - procedure, private :: InitAllocate ! Allocate data - - end type ch4finundatedstream_type - - - ! ! PRIVATE DATA: - - type, private :: streamcontrol_type - character(len=CL) :: stream_fldFileName_ch4finundated ! Filename - character(len=CL) :: ch4finundatedmapalgo ! map algo - character(len=CL) :: fldList ! List of fields to read - contains - procedure, private :: ReadNML ! Read in namelist - end type streamcontrol_type - - type(streamcontrol_type), private :: control ! Stream control data - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !============================================================================== - -contains - - !============================================================================== - - subroutine Init(this, bounds, NLFilename) - ! - ! Initialize the ch4 finundated stream object - ! - ! Uses: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar, get_curr_date - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use shr_nl_mod , only : shr_nl_find_group_name - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_mpi_mod , only : shr_mpi_bcast - use ndepStreamMod , only : clm_domain_mct - use domainMod , only : ldomain - use decompMod , only : bounds_type, gsmap_lnd_gdc2glo - use mct_mod , only : mct_ggrid, mct_avect_indexra - use shr_strdata_mod , only : shr_strdata_type, shr_strdata_create - use shr_strdata_mod , only : shr_strdata_print, shr_strdata_advance - use spmdMod , only : comp_id, iam - use ch4varcon , only : finundation_mtd_h2osfc - use ch4varcon , only : finundation_mtd_ZWT_inversion, finundation_mtd_TWS_inversion - ! - ! arguments - implicit none - class(ch4finundatedstream_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! local variables - integer :: ig, g ! Indices - type(mct_ggrid) :: dom_clm ! domain information - type(shr_strdata_type) :: sdat ! input data stream - integer :: index_ZWT0 = 0 ! Index of ZWT0 field - integer :: index_F0 = 0 ! Index of F0 field - integer :: index_P3 = 0 ! Index of P3 field - integer :: index_FWS_TWS_A = 0 ! Index of FWS_TWS_A field - integer :: index_FWS_TWS_B = 0 ! Index of FWS_TWS_B field - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - character(len=*), parameter :: stream_name = 'ch4finundated' - character(*), parameter :: subName = "('ch4finundatedstream::Init')" - !----------------------------------------------------------------------- - if ( finundation_mtd /= finundation_mtd_h2osfc )then - call this%InitAllocate( bounds ) - call control%ReadNML( bounds, NLFileName ) - - if ( this%useStreams() )then - call clm_domain_mct (bounds, dom_clm) - - call shr_strdata_create(sdat,name=stream_name,& - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=1996, & - yearLast=1996, & - yearAlign=1, & - offset=0, & - domFilePath='', & - domFileName=trim(control%stream_fldFileName_ch4finundated), & - domTvarName='time', & - domXvarName='LONGXY' , & - domYvarName='LATIXY' , & - domAreaName='AREA', & - domMaskName='LANDMASK', & - filePath='', & - filename=(/trim(control%stream_fldFileName_ch4finundated)/),& - fldListFile=control%fldList, & - fldListModel=control%fldList, & - fillalgo='none', & - mapalgo=control%ch4finundatedmapalgo, & - calendar=get_calendar(), & - taxmode='extend' ) - - if (masterproc) then - call shr_strdata_print(sdat,'CLM '//stream_name//' data') - endif - - if( finundation_mtd == finundation_mtd_ZWT_inversion )then - index_ZWT0 = mct_avect_indexra(sdat%avs(1),'ZWT0') - index_F0 = mct_avect_indexra(sdat%avs(1),'F0' ) - index_P3 = mct_avect_indexra(sdat%avs(1),'P3' ) - else if( finundation_mtd == finundation_mtd_TWS_inversion )then - index_FWS_TWS_A = mct_avect_indexra(sdat%avs(1),'FWS_TWS_A') - index_FWS_TWS_B = mct_avect_indexra(sdat%avs(1),'FWS_TWS_B') - end if - - - ! Explicitly set current date to a hardcoded constant value. Otherwise - ! using the real date can cause roundoff differences that are - ! detrected as issues with exact restart. EBK M05/20/2017 - !call get_curr_date(year, mon, day, sec) - year = 1996 - mon = 12 - day = 31 - sec = 0 - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(sdat, mcdate, sec, mpicom, 'ch4finundated') - - ! Get the data - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if ( index_ZWT0 > 0 )then - this%zwt0_gdc(g) = sdat%avs(1)%rAttr(index_ZWT0,ig) - end if - if ( index_F0 > 0 )then - this%f0_gdc(g) = sdat%avs(1)%rAttr(index_F0,ig) - end if - if ( index_P3 > 0 )then - this%p3_gdc(g) = sdat%avs(1)%rAttr(index_P3,ig) - end if - if ( index_FWS_TWS_A > 0 )then - this%fws_slope_gdc(g) = sdat%avs(1)%rAttr(index_FWS_TWS_A,ig) - end if - if ( index_FWS_TWS_B > 0 )then - this%fws_intercept_gdc(g) = sdat%avs(1)%rAttr(index_FWS_TWS_B,ig) - end if - end do - end if - end if - - end subroutine Init - - !----------------------------------------------------------------------- - logical function UseStreams(this) - ! - ! !DESCRIPTION: - ! Return true if - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - class(ch4finundatedstream_type) :: this - ! - ! !LOCAL VARIABLES: - if ( trim(control%stream_fldFileName_ch4finundated) == '' )then - UseStreams = .false. - else - UseStreams = .true. - end if - end function UseStreams - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use ch4varcon , only: finundation_mtd_ZWT_inversion, finundation_mtd_TWS_inversion - ! - ! !ARGUMENTS: - implicit none - class(ch4finundatedstream_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begg, endg - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - if( finundation_mtd == finundation_mtd_ZWT_inversion )then - allocate(this%zwt0_gdc (begg:endg)) ; this%zwt0_gdc (:) = nan - allocate(this%f0_gdc (begg:endg)) ; this%f0_gdc (:) = nan - allocate(this%p3_gdc (begg:endg)) ; this%p3_gdc (:) = nan - else if( finundation_mtd == finundation_mtd_TWS_inversion )then - allocate(this%fws_slope_gdc (begg:endg)) ; this%fws_slope_gdc (:) = nan - allocate(this%fws_intercept_gdc(begg:endg)) ; this%fws_intercept_gdc(:) = nan - end if - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine CalcFinundated(this, bounds, num_soilc, filter_soilc, soilhydrology_inst, waterstate_inst, & - qflx_surf_lag_col, finundated ) - ! - ! !DESCRIPTION: - ! - ! Calculate finundated according to the appropriate methodology - ! - ! !USES: - use ColumnType , only : col - use ch4varcon , only : finundation_mtd_h2osfc, finundation_mtd_ZWT_inversion - use ch4varcon , only : finundation_mtd_TWS_inversion - use clm_varpar , only : nlevsoi - use SoilHydrologyType, only : soilhydrology_type - use WaterstateType , only : waterstate_type - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - implicit none - class(ch4finundatedstream_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of column soil points in column filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(in) :: qflx_surf_lag_col(bounds%begc:) !time-lagged surface runoff (mm H2O /s) - real(r8) , intent(inout) :: finundated(bounds%begc:) ! fractional inundated area in soil column (excluding dedicated wetland columns) - ! - ! !LOCAL VARIABLES: - integer :: g, c, fc ! Indices - real(r8) :: zwt_actual ! Total water storage (ZWT) to use either perched or total depending on conditions - - SHR_ASSERT_ALL((ubound(qflx_surf_lag_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(finundated) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevsoi) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Input: [real(r8) (:) ] perched water table depth (m) - tws => waterstate_inst%tws_grc , & ! Input: [real(r8) (:) ] total water storage (kg m-2) - frac_h2osfc => waterstate_inst%frac_h2osfc_col & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - ) - - ! Calculate finundated - do fc = 1, num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - select case( finundation_mtd ) - case ( finundation_mtd_h2osfc ) - finundated(c) = frac_h2osfc(c) - case ( finundation_mtd_ZWT_inversion ) - if (this%zwt0_gdc(g) > 0._r8) then - if (zwt_perched(c) < z(c,nlevsoi)-1.e-5_r8 .and. zwt_perched(c) < zwt(c)) then - zwt_actual = zwt_perched(c) - else - zwt_actual = zwt(c) - end if - finundated(c) = this%f0_gdc(g) * exp(-zwt_actual/this%zwt0_gdc(g)) + this%p3_gdc(g)*qflx_surf_lag_col(c) - else - finundated(c) = this%p3_gdc(g)*qflx_surf_lag_col(c) - end if - case ( finundation_mtd_TWS_inversion ) - finundated(c) = this%fws_slope_gdc(g) * tws(g) + this%fws_intercept_gdc(g) - end select - finundated(c) = min( 1.0_r8, max( 0.0_r8, finundated(c) ) ) - end do - end associate - - end subroutine CalcFinundated - !============================================================================== - - subroutine ReadNML(this, bounds, NLFilename) - ! - ! Read the namelist data stream information. - ! - ! Uses: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use shr_nl_mod , only : shr_nl_find_group_name - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_mpi_mod , only : shr_mpi_bcast - use fileutils , only : getavu, relavu - use ch4varcon , only : finundation_mtd_ZWT_inversion, finundation_mtd_TWS_inversion - ! - ! arguments - implicit none - class(streamcontrol_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! local variables - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - character(len=CL) :: stream_fldFileName_ch4finundated = ' ' - character(len=CL) :: ch4finundatedmapalgo = 'bilinear' - character(len=*), parameter :: namelist_name = 'ch4finundated' ! MUST agree with name in namelist and read - character(len=*), parameter :: shr_strdata_unset = 'NOT_SET' - character(len=*), parameter :: subName = "('ch4finundated::ReadNML')" - character(len=*), parameter :: F00 = "('(ch4finundated_readnml) ',4a)" - !----------------------------------------------------------------------- - - namelist /ch4finundated/ & ! MUST agree with namelist_name above - ch4finundatedmapalgo, stream_fldFileName_ch4finundated - - ! Default values for namelist - - ! Read ch4finundateddyn_nml namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call shr_nl_find_group_name(nu_nml, namelist_name, status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=ch4finundated,iostat=nml_error) ! MUST agree with namelist_name above - if (nml_error /= 0) then - call endrun(msg=' ERROR reading '//namelist_name//' namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg=' ERROR finding '//namelist_name//' namelist'//errMsg(sourcefile, __LINE__)) - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_fldFileName_ch4finundated, mpicom) - call shr_mpi_bcast(ch4finundatedmapalgo , mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) namelist_name, ' stream settings:' - write(iulog,*) ' stream_fldFileName_ch4finundated = ',stream_fldFileName_ch4finundated - write(iulog,*) ' ch4finundatedmapalgo = ',ch4finundatedmapalgo - write(iulog,*) ' ' - endif - this%stream_fldFileName_ch4finundated = stream_fldFileName_ch4finundated - this%ch4finundatedmapalgo = ch4finundatedmapalgo - if ( finundation_mtd == finundation_mtd_ZWT_inversion )then - this%fldList = "ZWT0:F0:P3" - else if ( finundation_mtd == finundation_mtd_TWS_inversion )then - this%fldList = "FWS_TWS_A:FWS_TWS_B" - else - call endrun(msg=' ERROR do NOT know what list of variables to read for this finundation_mtd type'// & - errMsg(sourcefile, __LINE__)) - end if - - end subroutine ReadNML - -end module ch4FInundatedStreamType diff --git a/src/biogeochem/ch4Mod.F90 b/src/biogeochem/ch4Mod.F90 deleted file mode 100644 index 26dc791f72..0000000000 --- a/src/biogeochem/ch4Mod.F90 +++ /dev/null @@ -1,4197 +0,0 @@ -module ch4Mod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines to calculate methane fluxes - ! The driver averages up to gridcell, weighting by finundated, and checks for balance errors. - ! Sources, sinks, "competition" for CH4 & O2, & transport are resolved in ch4_tran. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=), shr_infnan_isnan - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevsoi, ngases, nlevsno, nlevdecomp - use clm_varcon , only : denh2o, denice, tfrz, grav, spval, rgas, grlnd - use clm_varcon , only : catomw, s_con, d_con_w, d_con_g, c_h_inv, kh_theta, kh_tbase - use landunit_varcon , only : istsoil, istcrop, istdlak - use clm_time_manager , only : get_step_size, get_nstep - use clm_varctl , only : iulog, use_cn, use_nitrif_denitrif, use_lch4 - use abortutils , only : endrun - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use CNSharedParamsMod , only : CNParamsShareInst - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use EnergyFluxType , only : energyflux_type - use LakeStateType , only : lakestate_type - use lnd2atmType , only : lnd2atm_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use ch4FInundatedStreamType , only : ch4finundatedstream_type - ! - implicit none - private - - ! Non-tunable constants - real(r8) :: rgasm ! J/mol.K; rgas / 1000; will be set below - real(r8), parameter :: rgasLatm = 0.0821_r8 ! L.atm/mol.K - - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: ch4_init_balance_check - public :: ch4 - - ! !PRIVATE MEMBER FUNCTIONS: - private :: ch4_prod - private :: ch4_oxid - private :: ch4_aere - private :: ch4_ebul - private :: ch4_tran - private :: ch4_annualupdate - private :: ch4_totcolch4 - private :: get_jwt - - type, private :: params_type - ! ch4 production constants - real(r8) :: q10ch4 ! additional Q10 for methane production ABOVE the soil decomposition temperature relationship - real(r8) :: q10ch4base ! temperature at which the effective f_ch4 actually equals the constant f_ch4 - real(r8) :: f_ch4 ! ratio of CH4 production to total C mineralization - real(r8) :: rootlitfrac ! Fraction of soil organic matter associated with roots - real(r8) :: cnscalefactor ! scale factor on CN decomposition for assigning methane flux - real(r8) :: redoxlag ! Number of days to lag in the calculation of finundated_lag - real(r8) :: lake_decomp_fact ! Base decomposition rate (1/s) at 25C - real(r8) :: redoxlag_vertical ! time lag (days) to inhibit production for newly unsaturated layers - real(r8) :: pHmax ! maximum pH for methane production(= 9._r8) - real(r8) :: pHmin ! minimum pH for methane production(= 2.2_r8) - real(r8) :: oxinhib ! inhibition of methane production by oxygen (m^3/mol) - - ! ch4 oxidation constants - real(r8) :: vmax_ch4_oxid ! oxidation rate constant (= 45.e-6_r8 * 1000._r8 / 3600._r8) [mol/m3-w/s]; - real(r8) :: k_m ! Michaelis-Menten oxidation rate constant for CH4 concentration - real(r8) :: q10_ch4oxid ! Q10 oxidation constant - real(r8) :: smp_crit ! Critical soil moisture potential - real(r8) :: k_m_o2 ! Michaelis-Menten oxidation rate constant for O2 concentration - real(r8) :: k_m_unsat ! Michaelis-Menten oxidation rate constant for CH4 concentration - real(r8) :: vmax_oxid_unsat ! (= 45.e-6_r8 * 1000._r8 / 3600._r8 / 10._r8) [mol/m3-w/s] - - ! ch4 aerenchyma constants - real(r8) :: aereoxid ! fraction of methane flux entering aerenchyma rhizosphere that will be - - ! oxidized rather than emitted - real(r8) :: scale_factor_aere ! scale factor on the aerenchyma area for sensitivity tests - real(r8) :: nongrassporosratio ! Ratio of root porosity in non-grass to grass, used for aerenchyma transport - real(r8) :: unsat_aere_ratio ! Ratio to multiply upland vegetation aerenchyma porosity by compared to inundated systems (= 0.05_r8 / 0.3_r8) - real(r8) :: porosmin ! minimum aerenchyma porosity (unitless)(= 0.05_r8) - - ! ch4 ebbulition constants - real(r8) :: vgc_max ! ratio of saturation pressure triggering ebullition - - ! ch4 transport constants - real(r8) :: satpow ! exponent on watsat for saturated soil solute diffusion - real(r8) :: scale_factor_gasdiff ! For sensitivity tests; convection would allow this to be > 1 - real(r8) :: scale_factor_liqdiff ! For sensitivity tests; convection would allow this to be > 1 - real(r8) :: capthick ! min thickness before assuming h2osfc is impermeable (mm) (= 100._r8) - - ! additional constants - real(r8) :: f_sat ! volumetric soil water defining top of water table or where production is allowed (=0.95) - real(r8) :: qflxlagd ! days to lag qflx_surf_lag in the tropics (days) ( = 30._r8) - real(r8) :: highlatfact ! multiple of qflxlagd for high latitudes (= 2._r8) - real(r8) :: q10lakebase ! (K) base temperature for lake CH4 production (= 298._r8) - real(r8) :: atmch4 ! Atmospheric CH4 mixing ratio to prescribe if not provided by the atmospheric model (= 1.7e-6_r8) (mol/mol) - real(r8) :: rob ! ratio of root length to vertical depth ("root obliquity") (= 3._r8) - end type params_type - type(params_type), private :: params_inst - - type, public :: ch4_type - real(r8), pointer, private :: ch4_prod_depth_sat_col (:,:) ! col CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_prod_depth_unsat_col (:,:) ! col CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_prod_depth_lake_col (:,:) ! col CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_oxid_depth_sat_col (:,:) ! col CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_oxid_depth_unsat_col (:,:) ! col CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_oxid_depth_lake_col (:,:) ! col CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_aere_depth_sat_col (:,:) ! col CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_aere_depth_unsat_col (:,:) ! col CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_tran_depth_sat_col (:,:) ! col CH4 loss rate via transpiration in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_tran_depth_unsat_col (:,:) ! col CH4 loss rate via transpiration in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_ebul_depth_sat_col (:,:) ! col CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_ebul_depth_unsat_col (:,:) ! col CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: ch4_ebul_total_sat_col (:) ! col Total col CH4 ebullition (mol/m2/s) - real(r8), pointer, private :: ch4_ebul_total_unsat_col (:) ! col Total col CH4 ebullition (mol/m2/s) - real(r8), pointer, private :: ch4_surf_aere_sat_col (:) ! col CH4 aerenchyma flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_aere_unsat_col (:) ! col CH4 aerenchyma flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_ebul_sat_col (:) ! col CH4 ebullition flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_ebul_unsat_col (:) ! col CH4 ebullition flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: ch4_surf_ebul_lake_col (:) ! col CH4 ebullition flux to atmosphere (after oxidation) (mol/m2/s) - real(r8), pointer, private :: co2_aere_depth_sat_col (:,:) ! col CO2 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: co2_aere_depth_unsat_col (:,:) ! col CO2 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_oxid_depth_sat_col (:,:) ! col O2 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_oxid_depth_unsat_col (:,:) ! col O2 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_aere_depth_sat_col (:,:) ! col O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: o2_aere_depth_unsat_col (:,:) ! col O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: co2_decomp_depth_sat_col (:,:) ! col CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, private :: co2_decomp_depth_unsat_col (:,:) ! col CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, private :: co2_oxid_depth_sat_col (:,:) ! col CO2 production rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: co2_oxid_depth_unsat_col (:,:) ! col CO2 production rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - real(r8), pointer, private :: conc_o2_lake_col (:,:) ! col O2 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: conc_ch4_sat_col (:,:) ! col CH4 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: conc_ch4_unsat_col (:,:) ! col CH4 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: conc_ch4_lake_col (:,:) ! col CH4 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, private :: ch4_surf_diff_sat_col (:) ! col CH4 surface flux (mol/m2/s) - real(r8), pointer, private :: ch4_surf_diff_unsat_col (:) ! col CH4 surface flux (mol/m2/s) - real(r8), pointer, private :: ch4_surf_diff_lake_col (:) ! col CH4 surface flux (mol/m2/s) - real(r8), pointer, private :: ch4_dfsat_flux_col (:) ! col CH4 flux to atm due to decreasing fsat (kg C/m^2/s) [+] - - real(r8), pointer, private :: zwt_ch4_unsat_col (:) ! col depth of water table for unsaturated fraction (m) - real(r8), pointer, private :: lake_soilc_col (:,:) ! col total soil organic matter found in level (g C / m^3) (nlevsoi) - real(r8), pointer, private :: totcolch4_col (:) ! col total methane found in soil col (g C / m^2) - real(r8), pointer, private :: totcolch4_bef_col (:) ! col total methane found in soil col, start of timestep (g C / m^2) - real(r8), pointer, private :: annsum_counter_col (:) ! col seconds since last annual accumulator turnover - real(r8), pointer, private :: tempavg_somhr_col (:) ! col temporary average SOM heterotrophic resp. (gC/m2/s) - real(r8), pointer, private :: annavg_somhr_col (:) ! col annual average SOM heterotrophic resp. (gC/m2/s) - real(r8), pointer, private :: tempavg_finrw_col (:) ! col respiration-weighted annual average of finundated - real(r8), pointer, private :: annavg_finrw_col (:) ! col respiration-weighted annual average of finundated - real(r8), pointer, private :: sif_col (:) ! col (unitless) ratio applied to sat. prod. to account for seasonal inundation - real(r8), pointer, private :: ch4stress_unsat_col (:,:) ! col Ratio of methane available to the total per-timestep methane sinks (nlevsoi) - real(r8), pointer, private :: ch4stress_sat_col (:,:) ! col Ratio of methane available to the total per-timestep methane sinks (nlevsoi) - real(r8), pointer, private :: qflx_surf_lag_col (:) ! col time-lagged surface runoff (mm H2O /s) - real(r8), pointer, private :: finundated_lag_col (:) ! col time-lagged fractional inundated area - real(r8), pointer, private :: layer_sat_lag_col (:,:) ! col Lagged saturation status of soil layer in the unsaturated zone (1 = sat) - real(r8), pointer, private :: zwt0_col (:) ! col coefficient for determining finundated (m) - real(r8), pointer, private :: f0_col (:) ! col maximum inundated fraction for a gridcell (for methane code) - real(r8), pointer, private :: p3_col (:) ! col coefficient for determining finundated (m) - real(r8), pointer, private :: pH_col (:) ! col pH values for methane production - ! - real(r8), pointer, private :: dyn_ch4bal_adjustments_col (:) ! adjustments to each column made in this timestep via dynamic column area adjustments (only makes sense at the column-level: meaningless if averaged to the gridcell-level) (g C / m^2) - ! - real(r8), pointer, private :: c_atm_grc (:,:) ! grc atmospheric conc of CH4, O2, CO2 (mol/m3) - real(r8), pointer, private :: ch4co2f_grc (:) ! grc CO2 production from CH4 oxidation (g C/m**2/s) - real(r8), pointer, private :: ch4prodg_grc (:) ! grc average CH4 production (g C/m^2/s) - ! - ! for aerenchyma calculations - real(r8), pointer, private :: annavg_agnpp_patch (:) ! patch (gC/m2/s) annual average aboveground NPP - real(r8), pointer, private :: annavg_bgnpp_patch (:) ! patch (gC/m2/s) annual average belowground NPP - real(r8), pointer, private :: tempavg_agnpp_patch (:) ! patch (gC/m2/s) temp. average aboveground NPP - real(r8), pointer, private :: tempavg_bgnpp_patch (:) ! patch (gC/m2/s) temp. average belowground NPP - ! - ! The following variable reports whether this is the first timestep that includes - ! ch4. It is true in the first timestep of the run, and remains true until the - ! methane code is first run - at which point it becomes false, and remains - ! false. This could be a scalar, but scalars cause problems with threading, so we use - ! a column-level array (column-level for convenience, because it is referenced in - ! column-level loops). - logical , pointer, private :: ch4_first_time_col (:) ! col whether this is the first time step that includes ch4 - ! - real(r8), pointer, public :: finundated_col (:) ! col fractional inundated area (excluding dedicated wetland cols) - real(r8), pointer, public :: finundated_pre_snow_col (:) ! col fractional inundated area (excluding dedicated wetland cols) before snow - real(r8), pointer, public :: o2stress_unsat_col (:,:) ! col Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - real(r8), pointer, public :: o2stress_sat_col (:,:) ! col Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - real(r8), pointer, public :: conc_o2_sat_col (:,:) ! col O2 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, public :: conc_o2_unsat_col (:,:) ! col O2 conc in each soil layer (mol/m3) (nlevsoi) - real(r8), pointer, public :: o2_decomp_depth_sat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, public :: o2_decomp_depth_unsat_col (:,:) ! col O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - real(r8), pointer, public :: ch4_surf_flux_tot_col (:) ! col CH4 surface flux (to atm) (kg C/m**2/s) - - real(r8), pointer, public :: grnd_ch4_cond_patch (:) ! patch tracer conductance for boundary layer [m/s] - real(r8), pointer, public :: grnd_ch4_cond_col (:) ! col tracer conductance for boundary layer [m/s] - type(ch4finundatedstream_type), private :: ch4findstream ! ch4 finundated stream data - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: Restart - procedure, public :: DynamicColumnAdjustments ! adjust state variables when column areas change - - end type ch4_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init( this, bounds, cellorg_col, fsurdat, NLFilename ) - - class(ch4_type) :: this - type(bounds_type), intent(in) :: bounds - real(r8) , intent(in) :: cellorg_col (bounds%begc:, 1:) - character(len=*) , intent(in) :: fsurdat ! surface data file name - character(len=*), intent(in) :: NLFilename ! Namelist filename - - call this%InitAllocate (bounds) - if (use_lch4) then - call this%InitHistory (bounds) - call this%InitCold (bounds, cellorg_col, fsurdat) - call this%ch4findstream%Init( bounds, NLFilename ) - end if - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varpar , only: nlevgrnd - ! - ! !ARGUMENTS: - class(ch4_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%ch4_prod_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%ch4_prod_depth_sat_col (:,:) = nan - allocate(this%ch4_prod_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%ch4_prod_depth_unsat_col (:,:) = nan - allocate(this%ch4_prod_depth_lake_col (begc:endc,1:nlevgrnd)) ; this%ch4_prod_depth_lake_col (:,:) = nan - allocate(this%ch4_oxid_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%ch4_oxid_depth_sat_col (:,:) = nan - allocate(this%ch4_oxid_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%ch4_oxid_depth_unsat_col (:,:) = nan - allocate(this%ch4_oxid_depth_lake_col (begc:endc,1:nlevgrnd)) ; this%ch4_oxid_depth_lake_col (:,:) = nan - allocate(this%o2_oxid_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%o2_oxid_depth_sat_col (:,:) = nan - allocate(this%o2_oxid_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%o2_oxid_depth_unsat_col (:,:) = nan - allocate(this%o2_aere_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%o2_aere_depth_sat_col (:,:) = nan - allocate(this%o2_aere_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%o2_aere_depth_unsat_col (:,:) = nan - allocate(this%co2_decomp_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%co2_decomp_depth_sat_col (:,:) = nan - allocate(this%co2_decomp_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%co2_decomp_depth_unsat_col (:,:) = nan - allocate(this%co2_oxid_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%co2_oxid_depth_sat_col (:,:) = nan - allocate(this%co2_oxid_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%co2_oxid_depth_unsat_col (:,:) = nan - allocate(this%ch4_aere_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%ch4_aere_depth_sat_col (:,:) = nan - allocate(this%ch4_aere_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%ch4_aere_depth_unsat_col (:,:) = nan - allocate(this%ch4_tran_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%ch4_tran_depth_sat_col (:,:) = nan - allocate(this%ch4_tran_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%ch4_tran_depth_unsat_col (:,:) = nan - allocate(this%co2_aere_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%co2_aere_depth_sat_col (:,:) = nan - allocate(this%co2_aere_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%co2_aere_depth_unsat_col (:,:) = nan - allocate(this%ch4_surf_aere_sat_col (begc:endc)) ; this%ch4_surf_aere_sat_col (:) = nan - allocate(this%ch4_surf_aere_unsat_col (begc:endc)) ; this%ch4_surf_aere_unsat_col (:) = nan - allocate(this%ch4_ebul_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%ch4_ebul_depth_sat_col (:,:) = nan - allocate(this%ch4_ebul_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%ch4_ebul_depth_unsat_col (:,:) = nan - allocate(this%ch4_ebul_total_sat_col (begc:endc)) ; this%ch4_ebul_total_sat_col (:) = nan - allocate(this%ch4_ebul_total_unsat_col (begc:endc)) ; this%ch4_ebul_total_unsat_col (:) = nan - allocate(this%ch4_surf_ebul_sat_col (begc:endc)) ; this%ch4_surf_ebul_sat_col (:) = nan - allocate(this%ch4_surf_ebul_unsat_col (begc:endc)) ; this%ch4_surf_ebul_unsat_col (:) = nan - allocate(this%ch4_surf_ebul_lake_col (begc:endc)) ; this%ch4_surf_ebul_lake_col (:) = nan - allocate(this%conc_ch4_sat_col (begc:endc,1:nlevgrnd)) ; this%conc_ch4_sat_col (:,:) = spval ! detect file input - allocate(this%conc_ch4_unsat_col (begc:endc,1:nlevgrnd)) ; this%conc_ch4_unsat_col (:,:) = spval ! detect file input - allocate(this%conc_ch4_lake_col (begc:endc,1:nlevgrnd)) ; this%conc_ch4_lake_col (:,:) = nan - allocate(this%ch4_surf_diff_sat_col (begc:endc)) ; this%ch4_surf_diff_sat_col (:) = nan - allocate(this%ch4_surf_diff_unsat_col (begc:endc)) ; this%ch4_surf_diff_unsat_col (:) = nan - allocate(this%ch4_surf_diff_lake_col (begc:endc)) ; this%ch4_surf_diff_lake_col (:) = nan - allocate(this%conc_o2_lake_col (begc:endc,1:nlevgrnd)) ; this%conc_o2_lake_col (:,:) = nan - allocate(this%ch4_dfsat_flux_col (begc:endc)) ; this%ch4_dfsat_flux_col (:) = nan - allocate(this%zwt_ch4_unsat_col (begc:endc)) ; this%zwt_ch4_unsat_col (:) = nan - allocate(this%lake_soilc_col (begc:endc,1:nlevgrnd)) ; this%lake_soilc_col (:,:) = spval !first time-step - allocate(this%totcolch4_col (begc:endc)) ; this%totcolch4_col (:) = nan - allocate(this%totcolch4_bef_col (begc:endc)) ; this%totcolch4_bef_col (:) = nan - allocate(this%annsum_counter_col (begc:endc)) ; this%annsum_counter_col (:) = nan - allocate(this%tempavg_somhr_col (begc:endc)) ; this%tempavg_somhr_col (:) = nan - allocate(this%annavg_somhr_col (begc:endc)) ; this%annavg_somhr_col (:) = nan - allocate(this%tempavg_finrw_col (begc:endc)) ; this%tempavg_finrw_col (:) = nan - allocate(this%annavg_finrw_col (begc:endc)) ; this%annavg_finrw_col (:) = nan - allocate(this%sif_col (begc:endc)) ; this%sif_col (:) = nan - allocate(this%ch4stress_unsat_col (begc:endc,1:nlevgrnd)) ; this%ch4stress_unsat_col (:,:) = nan - allocate(this%ch4stress_sat_col (begc:endc,1:nlevgrnd)) ; this%ch4stress_sat_col (:,:) = nan - allocate(this%qflx_surf_lag_col (begc:endc)) ; this%qflx_surf_lag_col (:) = nan - allocate(this%finundated_lag_col (begc:endc)) ; this%finundated_lag_col (:) = nan - allocate(this%layer_sat_lag_col (begc:endc,1:nlevgrnd)) ; this%layer_sat_lag_col (:,:) = nan - allocate(this%zwt0_col (begc:endc)) ; this%zwt0_col (:) = nan - allocate(this%f0_col (begc:endc)) ; this%f0_col (:) = nan - allocate(this%p3_col (begc:endc)) ; this%p3_col (:) = nan - allocate(this%pH_col (begc:endc)) ; this%pH_col (:) = nan - allocate(this%ch4_surf_flux_tot_col (begc:endc)) ; this%ch4_surf_flux_tot_col (:) = nan - allocate(this%dyn_ch4bal_adjustments_col (begc:endc)) ; this%dyn_ch4bal_adjustments_col (:) = nan - - allocate(this%c_atm_grc (begg:endg,1:ngases)) ; this%c_atm_grc (:,:) = nan - allocate(this%ch4co2f_grc (begg:endg)) ; this%ch4co2f_grc (:) = nan - allocate(this%ch4prodg_grc (begg:endg)) ; this%ch4prodg_grc (:) = nan - - allocate(this%tempavg_agnpp_patch (begp:endp)) ; this%tempavg_agnpp_patch (:) = nan - allocate(this%tempavg_bgnpp_patch (begp:endp)) ; this%tempavg_bgnpp_patch (:) = nan - allocate(this%annavg_agnpp_patch (begp:endp)) ; this%annavg_agnpp_patch (:) = spval ! To detect first year - allocate(this%annavg_bgnpp_patch (begp:endp)) ; this%annavg_bgnpp_patch (:) = spval ! To detect first year - - allocate(this%ch4_first_time_col (begc:endc)) ; this%ch4_first_time_col (:) = .true. - - allocate(this%finundated_col (begc:endc)) ; this%finundated_col (:) = nan - allocate(this%finundated_pre_snow_col (begc:endc)) ; this%finundated_pre_snow_col (:) = nan - allocate(this%o2stress_unsat_col (begc:endc,1:nlevgrnd)) ; this%o2stress_unsat_col (:,:) = nan - allocate(this%o2stress_sat_col (begc:endc,1:nlevgrnd)) ; this%o2stress_sat_col (:,:) = nan - allocate(this%conc_o2_sat_col (begc:endc,1:nlevgrnd)) ; this%conc_o2_sat_col (:,:) = nan - allocate(this%conc_o2_unsat_col (begc:endc,1:nlevgrnd)) ; this%conc_o2_unsat_col (:,:) = nan - allocate(this%o2_decomp_depth_sat_col (begc:endc,1:nlevgrnd)) ; this%o2_decomp_depth_sat_col (:,:) = nan - allocate(this%o2_decomp_depth_unsat_col (begc:endc,1:nlevgrnd)) ; this%o2_decomp_depth_unsat_col (:,:) = nan - allocate(this%ch4_surf_flux_tot_col (begc:endc)) ; this%ch4_surf_flux_tot_col (:) = nan - - allocate(this%grnd_ch4_cond_patch (begp:endp)) ; this%grnd_ch4_cond_patch (:) = nan - allocate(this%grnd_ch4_cond_col (begc:endc)) ; this%grnd_ch4_cond_col (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use clm_varpar , only : nlevgrnd, nlevdecomp - use clm_varctl , only : hist_wrtch4diag - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - use ch4varcon , only : allowlakeprod - ! - ! !ARGUMENTS: - class(ch4_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - character(8) :: vr_suffix - character(10) :: active - integer :: begc,endc - integer :: begg,endg - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - if (hist_wrtch4diag) then - active = "active" - else - active = "inactive" - end if - - this%finundated_col(begc:endc) = spval - ! Using l2g_scale_type='veg' to exclude values in special landunits, which can change - ! from dynamic column adjustments (also want to exclude lakes here, for which - ! finundated is implicitly 1). - call hist_addfld1d (fname='FINUNDATED', units='unitless', & - avgflag='A', long_name='fractional inundated area of vegetated columns', & - ptr_col=this%finundated_col, l2g_scale_type='veg') - - this%finundated_lag_col(begc:endc) = spval - ! Using l2g_scale_type='veg' to exclude values in special landunits, which can change - ! from dynamic column adjustments (also want to exclude lakes here, for which - ! finundated is implicitly 1). - call hist_addfld1d (fname='FINUNDATED_LAG', units='unitless', & - avgflag='A', long_name='time-lagged inundated fraction of vegetated columns', & - ptr_col=this%finundated_lag_col, l2g_scale_type='veg', default='inactive') - - this%ch4_surf_diff_sat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_DIFF_SAT', units='mol/m2/s', & - avgflag='A', long_name='diffusive surface CH4 flux for inundated / lake area; (+ to atm)', & - ptr_col=this%ch4_surf_diff_sat_col) - - this%ch4_surf_diff_unsat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_DIFF_UNSAT', units='mol/m2/s', & - avgflag='A', long_name='diffusive surface CH4 flux for non-inundated area; (+ to atm)', & - ptr_col=this%ch4_surf_diff_unsat_col) - - this%ch4_ebul_total_sat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_EBUL_TOTAL_SAT', units='mol/m2/s', & - avgflag='A', long_name='ebullition surface CH4 flux; (+ to atm)', & - ptr_col=this%ch4_ebul_total_sat_col, default='inactive') - - this%ch4_ebul_total_unsat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_EBUL_TOTAL_UNSAT', units='mol/m2/s', & - avgflag='A', long_name='ebullition surface CH4 flux; (+ to atm)', & - ptr_col=this%ch4_ebul_total_unsat_col, default='inactive') - - this%ch4_surf_ebul_sat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_EBUL_SAT', units='mol/m2/s', & - avgflag='A', long_name='ebullition surface CH4 flux for inundated / lake area; (+ to atm)', & - ptr_col=this%ch4_surf_ebul_sat_col) - - this%ch4_surf_ebul_unsat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_EBUL_UNSAT', units='mol/m2/s', & - avgflag='A', long_name='ebullition surface CH4 flux for non-inundated area; (+ to atm)', & - ptr_col=this%ch4_surf_ebul_unsat_col) - - this%ch4_surf_aere_sat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_AERE_SAT', units='mol/m2/s', & - avgflag='A', long_name='aerenchyma surface CH4 flux for inundated area; (+ to atm)', & - ptr_col=this%ch4_surf_aere_sat_col) - - this%ch4_surf_aere_unsat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_AERE_UNSAT', units='mol/m2/s', & - avgflag='A', long_name='aerenchyma surface CH4 flux for non-inundated area; (+ to atm)', & - ptr_col=this%ch4_surf_aere_unsat_col) - - this%totcolch4_col(begc:endc) = spval - ! Unlike other ch4 diagnostic fields, TOTCOLCH4 includes all landunits. Values will - ! typically be 0 for non-lake special landunits, but may be non-zero due to the state - ! adjustments from dynamic landunits. - call hist_addfld1d (fname='TOTCOLCH4', units='gC/m2', & - avgflag='A', & - long_name='total belowground CH4 (0 for non-lake special landunits in the absence of dynamic landunits)', & - ptr_col=this%totcolch4_col) - - this%conc_ch4_sat_col(begc:endc,1:nlevgrnd) = spval - ! Using l2g_scale_type='veg_plus_lake' to exclude mass in non-lake special landunits, - ! which can arise from dynamic column adjustments - call hist_addfld2d (fname='CONC_CH4_SAT', units='mol/m3', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil Concentration for inundated / lake area', & - ptr_col=this%conc_ch4_sat_col, l2g_scale_type='veg_plus_lake', default='inactive') - - this%conc_ch4_unsat_col(begc:endc,1:nlevgrnd) = spval - ! Using l2g_scale_type='veg' to exclude mass in special landunits, which can arise - ! from dynamic column adjustments. (We also exclude lakes here, because they don't - ! have any unsaturated area.) - call hist_addfld2d (fname='CONC_CH4_UNSAT', units='mol/m3', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil Concentration for non-inundated area', & - ptr_col=this%conc_ch4_unsat_col, l2g_scale_type='veg', default='inactive') - - if (hist_wrtch4diag) then - this%ch4_prod_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_PROD_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil production for inundated / lake area', & - ptr_col=this%ch4_prod_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_prod_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_PROD_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil production for non-inundated area', & - ptr_col=this%ch4_prod_depth_unsat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_oxid_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_OXID_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil oxidation for inundated / lake area', & - ptr_col=this%ch4_oxid_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_oxid_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_OXID_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil oxidation for non-inundated area', & - ptr_col=this%ch4_oxid_depth_unsat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_aere_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_AERE_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil aerenchyma loss for inundated / lake area '// & - ' (including transpiration flux if activated)', & - ptr_col=this%ch4_aere_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_aere_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_AERE_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil aerenchyma loss for non-inundated area '// & - ' (including transpiration flux if activated)', & - ptr_col=this%ch4_aere_depth_unsat_col) - end if - - if (hist_wrtch4diag) then - this%o2_aere_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='O2_AERE_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='O2 aerenchyma diffusion into soil for inundated / lake area', & - ptr_col=this%o2_aere_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%o2_aere_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='O2_AERE_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='O2 aerenchyma diffusion into soil for non-inundated area', & - ptr_col=this%o2_aere_depth_unsat_col) - end if - - if (hist_wrtch4diag) then - call hist_addfld2d (fname='O2_DECOMP_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='O2 consumption from HR and AR for inundated / lake area', & - ptr_col=this%o2_decomp_depth_sat_col) - end if - - this%o2_decomp_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='O2_DECOMP_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='O2 consumption from HR and AR for non-inundated area', & - ptr_col=this%o2_decomp_depth_unsat_col, default=active) - - if (hist_wrtch4diag) then - this%ch4_tran_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_TRAN_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil loss from transpiration for inundated / lake area', & - ptr_col=this%ch4_tran_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_tran_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_TRAN_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil loss from transpiration for non-inundated area', & - ptr_col=this%ch4_tran_depth_unsat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_ebul_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_EBUL_DEPTH_SAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil ebullition for inundated / lake area', & - ptr_col=this%ch4_ebul_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%ch4_ebul_depth_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_EBUL_DEPTH_UNSAT', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 soil ebullition for non-inundated area', & - ptr_col=this%ch4_ebul_depth_unsat_col) - end if - - if (hist_wrtch4diag) then - this%o2stress_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='O2STRESS_SAT', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='Ratio of oxygen available to demanded for non-inundated area', & - ptr_col=this%o2stress_sat_col) - end if - - if (hist_wrtch4diag) then - this%o2stress_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='O2STRESS_UNSAT', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='Ratio of oxygen available to demanded for inundated / lake area', & - ptr_col=this%o2stress_unsat_col) - end if - - if (hist_wrtch4diag) then - this%ch4stress_unsat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4STRESS_UNSAT', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='Ratio of methane available to total potential sink for inundated / lake area', & - ptr_col=this%ch4stress_unsat_col) - end if - - if (hist_wrtch4diag) then - this%ch4stress_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4STRESS_SAT', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='Ratio of methane available to total potential sink for non-inundated area', & - ptr_col=this%ch4stress_sat_col) - end if - - if (hist_wrtch4diag .and. allowlakeprod) then - this%ch4_prod_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_PROD_DEPTH_LAKE', units='mol/m3/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 production in each soil layer, lake col. only', & - ptr_col=this%ch4_prod_depth_sat_col) - end if - - if (hist_wrtch4diag .and. allowlakeprod) then - this%conc_ch4_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CONC_CH4_LAKE', units='mol/m3', type2d='levgrnd', & - avgflag='A', long_name='CH4 Concentration each soil layer, lake col. only', & - ptr_col=this%conc_ch4_sat_col) - end if - - if (hist_wrtch4diag .and. allowlakeprod) then - this%conc_o2_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CONC_O2_LAKE', units='mol/m3', type2d='levgrnd', & - avgflag='A', long_name='O2 Concentration each soil layer, lake col. only', & - ptr_col=this%conc_o2_sat_col) - end if - - if (hist_wrtch4diag .and. allowlakeprod) then - this%ch4_surf_diff_sat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_DIFF_LAKE', units='mol/m2/s', & - avgflag='A', long_name='diffusive surface CH4 flux, lake col. only (+ to atm)', & - ptr_col=this%ch4_surf_diff_sat_col) - end if - - if (hist_wrtch4diag .and. allowlakeprod) then - this%ch4_surf_ebul_sat_col(begc:endc) = spval - call hist_addfld1d (fname='CH4_SURF_EBUL_LAKE', units='mol/m2/s', & - avgflag='A', long_name='ebullition surface CH4 flux, lake col. only (+ to atm)', & - ptr_col=this%ch4_surf_ebul_sat_col) - end if - - if (hist_wrtch4diag .and. allowlakeprod) then - this%ch4_oxid_depth_sat_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='CH4_OXID_DEPTH_LAKE', units='mol/m2/s', type2d='levgrnd', & - avgflag='A', long_name='CH4 oxidation in each soil layer, lake col. only', & - ptr_col=this%ch4_oxid_depth_sat_col) - end if - - if (hist_wrtch4diag) then - this%layer_sat_lag_col(begc:endc,1:nlevgrnd) = spval - ! Using l2g_scale_type='veg' to exclude mass in special landunits, which can arise - ! from dynamic column adjustments. (We also exclude lakes here, because they don't - ! have any unsaturated area.) - call hist_addfld2d (fname='LAYER_SAT_LAG', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='lagged saturation status of layer in unsat. zone', & - ptr_col=this%layer_sat_lag_col, l2g_scale_type='veg') - end if - - if (hist_wrtch4diag) then - this%annavg_finrw_col(begc:endc) = spval - call hist_addfld1d (fname='ANNAVG_FINRW', units='unitless', & - avgflag='A', long_name='annual average respiration-weighted FINUNDATED', & - ptr_col=this%annavg_finrw_col) - end if - - if (hist_wrtch4diag) then - this%sif_col(begc:endc) = spval - call hist_addfld1d (fname='SIF', units='unitless', & - avgflag='A', long_name='seasonal inundation factor calculated for sat. CH4 prod. (non-lake)', & - ptr_col=this%sif_col) - end if - - this%conc_o2_sat_col(begc:endc,1:nlevgrnd) = spval - ! Using l2g_scale_type='veg_plus_lake' to exclude mass in non-lake special landunits, - ! which can arise from dynamic column adjustments - data2dptr => this%conc_o2_sat_col(:,1:nlevsoi) - call hist_addfld2d (fname='CONC_O2_SAT', units='mol/m3', type2d='levsoi', & - avgflag='A', long_name='O2 soil Concentration for inundated / lake area', & - ptr_col=data2dptr, l2g_scale_type='veg_plus_lake') - - this%conc_o2_unsat_col(begc:endc,1:nlevgrnd) = spval - ! Using l2g_scale_type='veg' to exclude mass in special landunits, which can arise - ! from dynamic column adjustments. (We also exclude lakes here, because they don't - ! have any unsaturated area.) - data2dptr => this%conc_o2_unsat_col(:,1:nlevsoi) - call hist_addfld2d (fname='CONC_O2_UNSAT', units='mol/m3', type2d='levsoi', & - avgflag='A', long_name='O2 soil Concentration for non-inundated area', & - ptr_col=data2dptr, l2g_scale_type='veg') - - this%ch4co2f_grc(begg:endg) = spval - call hist_addfld1d (fname='FCH4TOCO2', units='gC/m2/s', & - avgflag='A', long_name='Gridcell oxidation of CH4 to CO2', & - ptr_lnd=this%ch4co2f_grc) - - this%ch4prodg_grc(begg:endg) = spval - call hist_addfld1d (fname='CH4PROD', units='gC/m2/s', & - avgflag='A', long_name='Gridcell total production of CH4', & - ptr_lnd=this%ch4prodg_grc) - - this%ch4_dfsat_flux_col(begc:endc) = spval - call hist_addfld1d (fname='FCH4_DFSAT', units='kgC/m2/s', & - avgflag='A', long_name='CH4 additional flux due to changing fsat, vegetated landunits only', & - ptr_col=this%ch4_dfsat_flux_col) - - this%zwt_ch4_unsat_col(begc:endc) = spval - call hist_addfld1d (fname='ZWT_CH4_UNSAT', units='m', & - avgflag='A', long_name='depth of water table for methane production used in non-inundated area', & - ptr_col=this%zwt_ch4_unsat_col) - - this%qflx_surf_lag_col(begc:endc) = spval - call hist_addfld1d (fname='QOVER_LAG', units='mm/s', & - avgflag='A', long_name='time-lagged surface runoff for soil columns', & - ptr_col=this%qflx_surf_lag_col, default='inactive') - - if (allowlakeprod) then - this%lake_soilc_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld2d (fname='LAKE_SOILC', units='gC/m3', type2d='levgrnd', & - avgflag='A', long_name='Soil carbon under lakes', & - ptr_col=this%lake_soilc_col) - end if - - this%grnd_ch4_cond_col(begc:endc) = spval - call hist_addfld1d (fname='WTGQ', units='m/s', & - avgflag='A', long_name='surface tracer conductance', & - ptr_col=this%grnd_ch4_cond_col) - - this%dyn_ch4bal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='DYN_COL_ADJUSTMENTS_CH4', units='gC/m^2', & - avgflag='SUM', & - long_name='Adjustments in ch4 due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_ch4bal_adjustments_col, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, cellorg_col, fsurdat) - ! - ! !DESCRIPTION: - ! - Sets cold start values for time varying values. - ! Initializes the following time varying variables: - ! conc_ch4_sat, conc_ch4_unsat, conc_o2_sat, conc_o2_unsat, - ! lake_soilc, o2stress, finunduated - ! - Sets variables for ch4 code that will not be input - ! from restart/inic file. - ! - Sets values for inactive CH4 columns to spval so that they will - ! not be averaged in history file. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : nlevsoi, nlevgrnd, nlevdecomp - use landunit_varcon , only : istsoil, istdlak, istcrop - use clm_varctl , only : iulog - use ch4varcon , only : allowlakeprod, usephfact, finundation_mtd - use ch4varcon , only : finundation_mtd_ZWT_inversion - use spmdMod , only : masterproc - use fileutils , only : getfil - use ncdio_pio - ! - ! !ARGUMENTS: - class(ch4_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: cellorg_col (bounds%begc:, 1:) - character(len=*) , intent(in) :: fsurdat ! surface data file name - ! - ! !LOCAL VARIABLES: - integer :: j ,g, l,c,p ! indices - type(file_desc_t) :: ncid ! netcdf id - real(r8) ,pointer :: zwt0_in (:) ! read in - zwt0 - real(r8) ,pointer :: f0_in (:) ! read in - f0 - real(r8) ,pointer :: p3_in (:) ! read in - p3 - real(r8) ,pointer :: pH_in (:) ! read in - pH - character(len=256) :: locfn ! local file name - logical :: readvar ! If read variable from file or not - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(cellorg_col) == (/bounds%endc, nlevsoi/)), errMsg(sourcefile, __LINE__)) - - !---------------------------------------- - ! Initialize time constant variables - !---------------------------------------- - - allocate(zwt0_in (bounds%begg:bounds%endg)) - allocate(f0_in (bounds%begg:bounds%endg)) - allocate(p3_in (bounds%begg:bounds%endg)) - if (usephfact) allocate(ph_in(bounds%begg:bounds%endg)) - - ! Methane code parameters for finundated - - call getfil( fsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - if ( finundation_mtd == finundation_mtd_zwt_inversion ) then - call ncd_io(ncid=ncid, varname='ZWT0', flag='read', data=zwt0_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Running with CH4 Model but ZWT0 not on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='F0', flag='read', data=f0_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Running with CH4 Model but F0 not on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='P3', flag='read', data=p3_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Running with CH4 Model but P3 not on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - ! pH factor for methane model - if (usephfact) then - call ncd_io(ncid=ncid, varname='PH', flag='read', data=ph_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: CH4 pH production factor activated in ch4par_in'//& - 'but pH is not on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - end if - call ncd_pio_closefile(ncid) - - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - - if (finundation_mtd == finundation_mtd_ZWT_inversion ) then - this%zwt0_col(c) = zwt0_in(g) - this%f0_col(c) = f0_in(g) - this%p3_col(c) = p3_in(g) - end if - if (usephfact) this%pH_col(c) = pH_in(g) - end do - - deallocate(zwt0_in, f0_in, p3_in) - if (usephfact) deallocate(pH_in) - - !---------------------------------------- - ! Initialize time varying variables - !---------------------------------------- - - if ( masterproc ) write (iulog,*) 'Setting initial data to non-spun up values for CH4 Mod' - - do c = bounds%begc,bounds%endc - - ! To detect first year - this%annavg_somhr_col(c) = spval - this%annavg_finrw_col(c) = spval - - ! To detect file input - this%qflx_surf_lag_col (c) = spval - this%o2stress_sat_col (c,:) = spval - this%o2stress_unsat_col (c,:) = spval - this%ch4stress_sat_col (c,:) = spval - this%ch4stress_unsat_col(c,:) = spval - this%lake_soilc_col (c,:) = spval - - ! The following variables need to be initialized for all columns, for the sake of - ! DynamicColumnAdjustments - ! - ! TODO(wjs, 2016-02-11) Should the initial value of finundated depend on landunit - ! type? I am setting it to 1, because that's the appropriate value for lakes (and - ! probably other landunits, like wetlands and glaciers) - but this may not be - ! appropriate for urban. (The setting here should agree with the setting of - ! finundated_col where it was spval in subroutine Restart.) Note that - ! finundated_col is overwritten for istsoil / istcrop below. - this%finundated_col(c) = 1._r8 - this%finundated_pre_snow_col(c) = 1._r8 - this%finundated_lag_col(c) = 1._r8 - this%layer_sat_lag_col (c,1:nlevsoi) = 1._r8 - this%conc_ch4_sat_col (c,1:nlevsoi) = 0._r8 - this%conc_ch4_unsat_col (c,1:nlevsoi) = 0._r8 - this%conc_o2_sat_col (c,1:nlevsoi) = 0._r8 - this%conc_o2_unsat_col (c,1:nlevsoi) = 0._r8 - - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop .or. & - lun%itype(l) == istdlak) then - this%annsum_counter_col(c) = 0._r8 - this%tempavg_somhr_col(c) = 0._r8 - this%tempavg_finrw_col(c) = 0._r8 - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - this%o2stress_sat_col (c,1:nlevsoi) = 1._r8 - this%o2stress_unsat_col (c,1:nlevsoi) = 1._r8 - this%o2_decomp_depth_sat_col(c,1:nlevsoi) = 0._r8 - this%o2_decomp_depth_unsat_col(c,1:nlevsoi) = 0._r8 - - this%qflx_surf_lag_col (c) = 0._r8 - this%finundated_col (c) = 0._r8 - this%finundated_pre_snow_col(c) = 0._r8 - this%finundated_lag_col (c) = 0._r8 - - else if (lun%itype(l) == istdlak) then - - this%lake_soilc_col (c,1:nlevsoi) = 580._r8 * cellorg_col(c,1:nlevsoi) - - end if - - ! Set values for all columns equal below nlevsoi - - this%conc_ch4_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%conc_ch4_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%conc_o2_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%conc_o2_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%lake_soilc_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2stress_sat_col (c,nlevsoi+1:nlevgrnd) = 1._r8 - this%o2stress_unsat_col (c,nlevsoi+1:nlevgrnd) = 1._r8 - this%layer_sat_lag_col (c,nlevsoi+1:nlevgrnd) = 1._r8 - this%ch4_prod_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_prod_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_prod_depth_lake_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_oxid_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_oxid_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_oxid_depth_lake_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2_oxid_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2_oxid_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2_decomp_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2_decomp_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2_aere_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%o2_aere_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%co2_decomp_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%co2_decomp_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%co2_oxid_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%co2_oxid_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_aere_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_aere_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_tran_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_tran_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%co2_aere_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%co2_aere_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_ebul_depth_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4_ebul_depth_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%conc_ch4_lake_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%conc_o2_lake_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4stress_unsat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - this%ch4stress_sat_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - this%conc_ch4_lake_col (c,:) = spval - this%conc_o2_lake_col (c,:) = spval - this%ch4_surf_diff_lake_col (c) = spval - this%ch4_surf_ebul_lake_col (c) = spval - this%ch4_prod_depth_lake_col (c,:) = spval - this%ch4_oxid_depth_lake_col (c,:) = spval - - else if (lun%itype(l) == istdlak .and. allowlakeprod) then - - this%ch4_prod_depth_unsat_col (c,:) = spval - this%ch4_oxid_depth_unsat_col (c,:) = spval - this%o2_oxid_depth_unsat_col (c,:) = spval - this%o2_decomp_depth_unsat_col (c,:) = spval - this%o2_aere_depth_unsat_col (c,:) = spval - this%co2_decomp_depth_unsat_col (c,:) = spval - this%co2_oxid_depth_unsat_col (c,:) = spval - this%ch4_aere_depth_unsat_col (c,:) = spval - this%ch4_tran_depth_unsat_col (c,:) = spval - this%co2_aere_depth_unsat_col (c,:) = spval - this%ch4_surf_aere_unsat_col (c) = spval - this%ch4_ebul_depth_unsat_col (c,:) = spval - this%ch4_ebul_total_unsat_col (c) = spval - this%ch4_surf_ebul_unsat_col (c) = spval - this%ch4_surf_diff_unsat_col (c) = spval - this%ch4_dfsat_flux_col (c) = spval - this%zwt_ch4_unsat_col (c) = spval - this%sif_col (c) = spval - this%o2stress_unsat_col (c,:) = spval - this%ch4stress_unsat_col (c,:) = spval - - else ! Inactive CH4 columns - - this%ch4_prod_depth_sat_col (c,:) = spval - this%ch4_prod_depth_unsat_col (c,:) = spval - this%ch4_prod_depth_lake_col (c,:) = spval - this%ch4_oxid_depth_sat_col (c,:) = spval - this%ch4_oxid_depth_unsat_col (c,:) = spval - this%ch4_oxid_depth_lake_col (c,:) = spval - this%o2_oxid_depth_sat_col (c,:) = spval - this%o2_oxid_depth_unsat_col (c,:) = spval - this%o2_decomp_depth_sat_col (c,:) = spval - this%o2_decomp_depth_unsat_col (c,:) = spval - this%o2_aere_depth_sat_col (c,:) = spval - this%o2_aere_depth_unsat_col (c,:) = spval - this%co2_decomp_depth_sat_col (c,:) = spval - this%co2_decomp_depth_unsat_col (c,:) = spval - this%co2_oxid_depth_sat_col (c,:) = spval - this%co2_oxid_depth_unsat_col (c,:) = spval - this%ch4_aere_depth_sat_col (c,:) = spval - this%ch4_aere_depth_unsat_col (c,:) = spval - this%ch4_tran_depth_sat_col (c,:) = spval - this%ch4_tran_depth_unsat_col (c,:) = spval - this%co2_aere_depth_sat_col (c,:) = spval - this%co2_aere_depth_unsat_col (c,:) = spval - this%ch4_surf_aere_sat_col (c) = spval - this%ch4_surf_aere_unsat_col (c) = spval - this%ch4_ebul_depth_sat_col (c,:) = spval - this%ch4_ebul_depth_unsat_col (c,:) = spval - this%ch4_ebul_total_sat_col (c) = spval - this%ch4_ebul_total_unsat_col (c) = spval - this%ch4_surf_ebul_sat_col (c) = spval - this%ch4_surf_ebul_unsat_col (c) = spval - this%ch4_surf_ebul_lake_col (c) = spval - this%ch4_surf_diff_sat_col (c) = spval - this%ch4_surf_diff_unsat_col (c) = spval - this%ch4_surf_diff_lake_col (c) = spval - this%ch4_dfsat_flux_col (c) = spval - this%zwt_ch4_unsat_col (c) = spval - this%conc_ch4_lake_col (c,:) = spval - this%conc_o2_lake_col (c,:) = spval - this%sif_col (c) = spval - this%o2stress_unsat_col (c,:) = spval - this%o2stress_sat_col (c,:) = spval - this%ch4stress_unsat_col (c,:) = spval - this%ch4stress_sat_col (c,:) = spval - this%grnd_ch4_cond_col (c) = spval - - ! totcolch4 Set to zero for inactive columns so that this can be used - ! as an appropriate area-weighted gridcell average soil methane content. - this%totcolch4_col (c) = 0._r8 - - end if - end do - - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop .or. & - lun%itype(l) == istdlak) then - this%tempavg_agnpp_patch(p) = 0._r8 - this%tempavg_bgnpp_patch(p) = 0._r8 - end if - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart( this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/Write biogeophysics information to/from restart file. - ! - ! !USES: - use ncdio_pio , only : ncd_double - use pio , only : file_desc_t - use decompMod , only : bounds_type - use restUtilMod - use filterColMod, only : filter_col_type - ! - ! !ARGUMENTS: - class(ch4_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*), intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: c, p, j - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='tempavg_agnpp', xtype=ncd_double, & - dim1name='pft',& - long_name='Temp. Average AGNPP',units='gC/m^2/s', & - readvar=readvar, interpinic_flag='interp', data=this%tempavg_agnpp_patch) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-16) The following is needed for backwards - ! compatibility with older restart files, where this variable was nan or spval rather - ! than 0 over inactive points - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%tempavg_agnpp_patch, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='tempavg_bgnpp', xtype=ncd_double, & - dim1name='pft',& - long_name='Temp. Average BGNPP',units='gC/m^2/s', & - readvar=readvar, interpinic_flag='interp', data=this%tempavg_bgnpp_patch) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-16) The following is needed for backwards - ! compatibility with older restart files, where this variable was nan or spval rather - ! than 0 over inactive points - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%tempavg_bgnpp_patch, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='annavg_agnpp', xtype=ncd_double, & - dim1name='pft',& - long_name='Ann. Average AGNPP',units='gC/m^2/s', & - readvar=readvar, interpinic_flag='interp', data=this%annavg_agnpp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='annavg_bgnpp', xtype=ncd_double, & - dim1name='pft',& - long_name='Ann. Average BGNPP',units='gC/m^2/s', & - readvar=readvar, interpinic_flag='interp', data=this%annavg_bgnpp_patch) - - call restartvar(ncid=ncid, flag=flag, varname='CONC_O2_SAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='oxygen soil concentration', units='mol/m^3', & - readvar=readvar, interpinic_flag='interp', data=this%conc_o2_sat_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-17) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! this variable was initialized to spval rather than 0 for special landunits. - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%conc_o2_sat_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='CONC_O2_UNSAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='oxygen soil concentration', units='mol/m^3', & - readvar=readvar, interpinic_flag='interp', data=this%conc_o2_unsat_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-17) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! this variable was initialized to spval rather than 0 for special landunits. - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%conc_o2_unsat_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='O2STRESS_SAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='oxygen stress fraction', units='', & - readvar=readvar, interpinic_flag='interp', data=this%o2stress_sat_col) - - call restartvar(ncid=ncid, flag=flag, varname='O2STRESS_UNSAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='oxygen stress fraction', units='', & - readvar=readvar, interpinic_flag='interp', data=this%o2stress_unsat_col) - - call restartvar(ncid=ncid, flag=flag, varname='O2_DECOMP_DEPTH_SAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='O2 consumption during decomposition', units='mol/m3/s', & - readvar=readvar, interpinic_flag='interp', data=this%o2_decomp_depth_sat_col) - - call restartvar(ncid=ncid, flag=flag, varname='O2_DECOMP_DEPTH_UNSAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='O2 consumption during decomposition', units='mol/m3/s', & - readvar=readvar, interpinic_flag='interp', data=this%o2_decomp_depth_unsat_col) - - call restartvar(ncid=ncid, flag=flag, varname='CONC_CH4_SAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='methane soil concentration', units='mol/m^3', & - readvar=readvar, interpinic_flag='interp', data=this%conc_ch4_sat_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-02-11) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! this variable was initialized to spval rather than 0 for special landunits. - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%conc_ch4_sat_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='CONC_CH4_UNSAT', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='methane soil concentration', units='mol/m^3', & - readvar=readvar, interpinic_flag='interp', data=this%conc_ch4_unsat_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-02-11) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! this variable was initialized to spval rather than 0 for special landunits. - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%conc_ch4_unsat_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='LAYER_SAT_LAG', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='lagged saturation status of layer in unsat. zone', units='', & - readvar=readvar, interpinic_flag='interp', data=this%layer_sat_lag_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-18) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! this variable was initialized to spval rather than 1 for special landunits. - if (flag == 'read' .and. readvar) then - ! The value here (1) should agree with the setting for special landunits in initCold - call set_missing_vals_to_constant(this%layer_sat_lag_col, 1._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='QFLX_SURF_LAG', xtype=ncd_double, & - dim1name='column', & - long_name='time-lagged surface runoff', units='mm/s', & - readvar=readvar, interpinic_flag='interp', data=this%qflx_surf_lag_col) - - call restartvar(ncid=ncid, flag=flag, varname='FINUNDATED_LAG', xtype=ncd_double, & - dim1name='column', & - long_name='time-lagged inundated fraction', units='', & - readvar=readvar, interpinic_flag='interp', data=this%finundated_lag_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-18) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! this variable was initialized to spval rather than 1 for special landunits. - if (flag == 'read' .and. readvar) then - ! The value here (1) should agree with the setting for special landunits in initCold - call set_missing_vals_to_constant(this%finundated_lag_col, 1._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='FINUNDATED', xtype=ncd_double, & - dim1name='column', & - long_name='inundated fraction', units='', & - readvar=readvar, interpinic_flag='interp', data=this%finundated_col) - if (flag == 'read' .and. readvar) then - ! Determine whether the methane model was present in the run that generated the - ! restart file based on whether FINUNDATED is present on the restart file. We - ! could use any methane variable, but FINUNDATED is a good choice because this - ! "first time" variable is used in connection with FINUNDATED. - this%ch4_first_time_col(bounds%begc:bounds%endc) = .false. - - ! BACKWARDS_COMPATIBILITY(wjs, 2016-02-11) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! these variables were initialized to spval rather than 1 for special landunits. - ! - ! The value here (1) should agree with the setting for special landunits in initCold - call set_missing_vals_to_constant(this%finundated_col, 1._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='FINUNDATED_PRESNOW', xtype=ncd_double, & - dim1name='column', & - long_name='inundated fraction before snow', units='', & - readvar=readvar, interpinic_flag='interp', data=this%finundated_pre_snow_col) - if (flag == 'read' .and. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2016-02-11) The following is needed for backwards - ! compatibility with restart files generated from older versions of the code, where - ! these variables were initialized to spval rather than 1 for special landunits. - ! - ! The value here (1) should agree with the setting for special landunits in initCold - call set_missing_vals_to_constant(this%finundated_pre_snow_col, 1._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='annavg_somhr', xtype=ncd_double, & - dim1name='column',& - long_name='Annual Average SOMHR',units='gC/m^2/s', & - readvar=readvar, interpinic_flag='interp', data=this%annavg_somhr_col) - - call restartvar(ncid=ncid, flag=flag, varname='annavg_finrw', xtype=ncd_double, & - dim1name='column',& - long_name='Annual Average Respiration-Weighted FINUNDATED',units='', & - readvar=readvar, interpinic_flag='interp', data=this%annavg_finrw_col) - - call restartvar(ncid=ncid, flag=flag, varname='annsum_counter_ch4', xtype=ncd_double, & - dim1name='column',& - long_name='CH4 Ann. Sum Time Counter',units='s', & - readvar=readvar, interpinic_flag='interp', data=this%annsum_counter_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-16) The following is needed for backwards - ! compatibility with older restart files, where this variable was nan or spval rather - ! than 0 over inactive points - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%annsum_counter_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='tempavg_somhr', xtype=ncd_double, & - dim1name='column',& - long_name='Temp. Average SOMHR',units='gC/m^2/s', & - readvar=readvar, interpinic_flag='interp', data=this%tempavg_somhr_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-16) The following is needed for backwards - ! compatibility with older restart files, where this variable was nan or spval rather - ! than 0 over inactive points - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%tempavg_somhr_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='tempavg_finrw', xtype=ncd_double, & - dim1name='column',& - long_name='Temp. Average Respiration-Weighted FINUNDATED',units='', & - readvar=readvar, interpinic_flag='interp', data=this%tempavg_finrw_col) - ! BACKWARDS_COMPATIBILITY(wjs, 2016-05-16) The following is needed for backwards - ! compatibility with older restart files, where this variable was nan or spval rather - ! than 0 over inactive points - if (flag == 'read' .and. readvar) then - call set_missing_vals_to_constant(this%tempavg_finrw_col, 0._r8) - end if - - call restartvar(ncid=ncid, flag=flag, varname='LAKE_SOILC', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true.,& - long_name='lake soil carbon concentration', units='g/m^3', & - readvar=readvar, interpinic_flag='interp', data=this%lake_soilc_col) - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine DynamicColumnAdjustments(this, bounds, clump_index, column_state_updater) - ! - ! !DESCRIPTION: - ! Adjust state variables when column areas change due to dynamic landuse - ! - ! !USES: - use dynColumnStateUpdaterMod, only : column_state_updater_type - ! - ! !ARGUMENTS: - class(ch4_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer , intent(in) :: clump_index - - type(column_state_updater_type) , intent(in) :: column_state_updater - ! - ! !LOCAL VARIABLES: - real(r8) :: finundated_new_col(bounds%begc:bounds%endc) ! finundated after column adjustments - real(r8) :: f_uninundated_col(bounds%begc:bounds%endc) ! 1 - finundated_col - real(r8) :: f_uninundated_new_col(bounds%begc:bounds%endc) ! f_uninundated after column adjustments - real(r8) :: adjustment_one_level(bounds%begc:bounds%endc) - integer :: j, c - integer :: begc, endc - - character(len=*), parameter :: subname = 'DynamicColumnAdjustments' - !----------------------------------------------------------------------- - - ! BUG(wjs, 2016-02-16, bugz 2283) Need to do some special handling of finundated for - ! increases in lake area, since lakes are assumed to be 100% inundated. Probably it's - ! most appropriate for this special handling to happen elsewhere - i.e., within this - ! routine, we do the standard adjustments as they are currently done, but then in the - ! "science" code in this module, there is a check of whether a lake has finundated < - ! 1, and if so, variables are adjusted so that it is once again fully inundated. - - ! Note that some of the variables updated here aren't strictly needed for - ! conservation purposes (because they don't represent any mass in the system), but it - ! seems like a good idea to update these anyway so that growing columns will be in a - ! more self-consistent state. - - begc = bounds%begc - endc = bounds%endc - - finundated_new_col(begc:endc) = & - this%finundated_col(begc:endc) - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = finundated_new_col(begc:endc)) - - f_uninundated_col(begc:endc) = & - 1._r8 - this%finundated_col(begc:endc) - f_uninundated_new_col(begc:endc) = & - f_uninundated_col(begc:endc) - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = f_uninundated_new_col(begc:endc)) - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%finundated_lag_col(begc:endc)) - - this%dyn_ch4bal_adjustments_col(begc:endc) = 0._r8 - - do j = 1, nlevsoi - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%conc_ch4_sat_col(begc:endc, j), & - fractional_area_old = this%finundated_col(begc:endc), & - fractional_area_new = finundated_new_col(begc:endc), & - adjustment = adjustment_one_level(begc:endc)) - do c = bounds%begc, bounds%endc - this%dyn_ch4bal_adjustments_col(c) = & - this%dyn_ch4bal_adjustments_col(c) + & - adjustment_one_level(c) * col%dz(c,j) * catomw - end do - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%conc_ch4_unsat_col(begc:endc, j), & - fractional_area_old = f_uninundated_col(begc:endc), & - fractional_area_new = f_uninundated_new_col(begc:endc), & - adjustment = adjustment_one_level(begc:endc)) - do c = bounds%begc, bounds%endc - this%dyn_ch4bal_adjustments_col(c) = & - this%dyn_ch4bal_adjustments_col(c) + & - adjustment_one_level(c) * col%dz(c,j) * catomw - end do - - ! layer_sat_lag just applies to the UNinundated portion of the column - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%layer_sat_lag_col(begc:endc, j), & - fractional_area_old = f_uninundated_col(begc:endc), & - fractional_area_new = f_uninundated_new_col(begc:endc)) - - ! We don't bother tracking the adjustment terms for the following o2 state - ! variables, because they're not needed for balance checks and because people are - ! less likely to be interested in viewing those adjustment terms. - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%conc_o2_sat_col(begc:endc, j), & - fractional_area_old = this%finundated_col(begc:endc), & - fractional_area_new = finundated_new_col(begc:endc)) - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%conc_o2_unsat_col(begc:endc, j), & - fractional_area_old = f_uninundated_col(begc:endc), & - fractional_area_new = f_uninundated_new_col(begc:endc)) - end do - - this%finundated_col(begc:endc) = & - finundated_new_col(begc:endc) - - end subroutine DynamicColumnAdjustments - - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use ncdio_pio , only : file_desc_t,ncd_io - use ch4varcon , only : use_aereoxid_prog - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !-------------------------------------------------------------------- - - if ( .not. use_aereoxid_prog ) then - tString='aereoxid' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%aereoxid=tempr - else - ! value should never be used. - params_inst%aereoxid=nan - endif - - tString='q10ch4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%q10ch4=tempr - - tString='q10ch4base' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%q10ch4base=tempr - - tString='f_ch4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%f_ch4=tempr - - tString='rootlitfrac' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rootlitfrac=tempr - - tString='cnscalefactor' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cnscalefactor=tempr - - tString='redoxlag' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%redoxlag=tempr - - tString='lake_decomp_fact' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lake_decomp_fact=tempr - - tString='redoxlag_vertical' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%redoxlag_vertical=tempr - - tString='pHmax' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%pHmax=tempr - - tString='pHmin' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%pHmin=tempr - - tString='vmax_ch4_oxid' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%vmax_ch4_oxid=45.e-6_r8 * 1000._r8 / 3600._r8 - ! FIX(FIX(SPM,032414),032414) can't be read off of param file. not bfb since it is a divide - !params_inst%vmax_ch4_oxid=tempr - - tString='oxinhib' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%oxinhib=tempr - - tString='k_m' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_m= 5.e-6_r8 * 1000._r8 - ! FIX(FIX(SPM,032414),032414) can't be read off of param file. not bfb since it is a divide - !params_inst%k_m=tempr - - tString='q10_ch4oxid' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%q10_ch4oxid=tempr - - tString='smp_crit' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%smp_crit=tempr - - tString='k_m_o2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_m_o2 = 20.e-6_r8 * 1000._r8 - ! FIX(FIX(SPM,032414),032414) can't be read off of param file. not bfb since it is a divide - !params_inst%k_m_o2=tempr - - tString='k_m_unsat' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_m_unsat= 5.e-6_r8 * 1000._r8 / 10._r8 - ! FIX(FIX(SPM,032414),032414) can't be read off of param file. not bfb since it is a divide - !params_inst%k_m_unsat=tempr - - tString='vmax_oxid_unsat' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%vmax_oxid_unsat = 45.e-6_r8 * 1000._r8 / 3600._r8 / 10._r8 - ! FIX(FIX(SPM,032414),032414) can't be read off of param file. not bfb since it is a divide - !params_inst%vmax_oxid_unsat=tempr - - tString='scale_factor_aere' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%scale_factor_aere=tempr - - tString='nongrassporosratio' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%nongrassporosratio=tempr - - tString='unsat_aere_ratio' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%unsat_aere_ratio= 0.05_r8 / 0.3_r8 - ! FIX(FIX(SPM,032414),032414) can't be read off of param file. not bfb since it is a divide - !params_inst%unsat_aere_ratio=tempr - - tString='porosmin' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%porosmin=tempr - - tString='vgc_max' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%vgc_max=tempr - - tString='satpow' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%satpow=tempr - - tString='scale_factor_gasdiff' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%scale_factor_gasdiff=tempr - - tString='scale_factor_liqdiff' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%scale_factor_liqdiff=tempr - - tString='f_sat' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%f_sat=tempr - - tString='qflxlagd' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%qflxlagd=tempr - - tString='highlatfact' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%highlatfact=tempr - - tString='q10lakebase' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%q10lakebase=tempr - - tString='atmch4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%atmch4=tempr - - tString='rob' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rob=tempr - - tString='capthick' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%capthick=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine ch4_init_balance_check(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - ch4_inst) - ! - ! !DESCRIPTION: - ! Calculate beginning column-level ch4 balance, for mass conservation check - ! - ! This sets ch4_inst%totcolch4_bef - ! - ! This should be called after the weight updates due to dynamic landunits, and the - ! associated filter updates - i.e., using the new version of the filters. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: fc, c - - character(len=*), parameter :: subname = 'ch4_init_balance_check' - !----------------------------------------------------------------------- - - ! This is only really needed for soilc and lakec, but we use nolakec rather than just - ! soilc for consistency with the other call to ch4_totcolch4 (which computes - ! ch4_inst%totcolch4 over all columns for diagnostic purposes). - call ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - ch4_inst, ch4_inst%totcolch4_bef_col(bounds%begc:bounds%endc)) - - end subroutine ch4_init_balance_check - - - !----------------------------------------------------------------------- - subroutine ch4 (bounds, num_soilc, filter_soilc, num_lakec, filter_lakec, & - num_nolakec, filter_nolakec, num_soilp, filter_soilp, & - atm2lnd_inst, lakestate_inst, canopystate_inst, soilstate_inst, soilhydrology_inst, & - temperature_inst, energyflux_inst, waterstate_inst, waterflux_inst, & - soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenflux_inst, ch4_inst, lnd2atm_inst, & - agnpp, bgnpp, annsum_npp, rr) - ! - ! !DESCRIPTION: - ! Driver for the methane emissions model - ! - ! !USES: - use subgridAveMod , only : p2c, c2g - use clm_varpar , only : nlevgrnd, nlevdecomp - use pftconMod , only : noveg - use ch4varcon , only : replenishlakec, allowlakeprod, ch4offline - use clm_varcon , only : secspday - use ch4varcon , only : finundation_mtd, finundation_mtd_h2osfc - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilc ! number of column soil points in column filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_soilp ! number of soil points in patch filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! output ONLY for forcp_ch4 in ch4offline mode - type(lakestate_type) , intent(in) :: lakestate_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(temperature_type) , intent(in) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(in) :: soilbiogeochem_nitrogenflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - type(lnd2atm_type) , intent(inout) :: lnd2atm_inst - real(r8) , intent(in) :: agnpp( bounds%begp: ) ! aboveground NPP (gC/m2/s) - real(r8) , intent(in) :: bgnpp( bounds%begp: ) ! belowground NPP (gC/m2/s) - real(r8) , intent(in) :: annsum_npp( bounds%begp: ) ! annual sum NPP (gC/m2/yr) - real(r8) , intent(in) :: rr ( bounds%begp: ) ! root respiration (fine root MR + total root GR) (gC/m2/s) - ! - ! !LOCAL VARIABLES: - integer :: sat ! 0 = unsatured, 1 = saturated - logical :: lake ! lake or not lake - integer :: j,fc,c,g,fp,p ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: dtime_ch4 ! ch4 model time step (sec) - integer :: nstep - integer :: jwt(bounds%begc:bounds%endc) ! index of the soil layer right above the water table (-) - real(r8) :: ch4_prod_tot(bounds%begc:bounds%endc) ! CH4 production for column (g C/m**2/s) - real(r8) :: ch4_oxid_tot(bounds%begc:bounds%endc) ! CH4 oxidation for column (g C/m**2/s) - real(r8) :: nem_col(bounds%begc:bounds%endc) ! net adjustment to atm. C flux from methane production (g C/m**2/s) - real(r8) :: totalsat - real(r8) :: totalunsat - real(r8) :: dfsat - real(r8) :: rootfraction(bounds%begp:bounds%endp, 1:nlevgrnd) - real(r8) :: fsat_bef(bounds%begc:bounds%endc) ! finundated from previous timestep - real(r8) :: errch4 ! g C / m^2 - real(r8) :: zwt_actual - real(r8) :: qflxlags ! Time to lag qflx_surf_lag (s) - real(r8) :: redoxlag ! Redox time lag - real(r8) :: redoxlag_vertical ! Vertical redox lag time - real(r8) :: atmch4 ! Atmospheric CH4 mixing ratio to - ! prescribe if not provided by the atmospheric model (= 1.7e-6_r8) (mol/mol) - real(r8) :: redoxlags ! Redox time lag in s - real(r8) :: redoxlags_vertical ! Vertical redox lag time in s - real(r8) :: qflxlagd ! days to lag qflx_surf_lag in the tropics (days) - real(r8) :: highlatfact ! multiple of qflxlagd for high latitudes - integer :: dummyfilter(1) ! empty filter - character(len=32) :: subname='ch4' ! subroutine name - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(agnpp) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bgnpp) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(annsum_npp) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevsoi) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevsoi) - - forc_t => atm2lnd_inst%forc_t_not_downscaled_grc , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - forc_pbot => atm2lnd_inst%forc_pbot_not_downscaled_grc , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_po2 => atm2lnd_inst%forc_po2_grc , & ! Input: [real(r8) (:) ] O2 partial pressure (Pa) - forc_pco2 => atm2lnd_inst%forc_pco2_grc , & ! Input: [real(r8) (:) ] CO2 partial pressure (Pa) - forc_pch4 => atm2lnd_inst%forc_pch4_grc , & ! Input: [real(r8) (:) ] CH4 partial pressure (Pa) - - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Input: [real(r8) (:) ] perched water table depth (m) - - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer (nlevgrnd) - rootfr_col => soilstate_inst%rootfr_col , & ! Output: [real(r8) (:,:) ] fraction of roots in each soil layer (nlevgrnd) (p2c) - - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - tws => waterstate_inst%tws_grc , & ! Input: [real(r8) (:) ] total water storage (kg m-2) - qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) - - conc_o2_sat => ch4_inst%conc_o2_sat_col , & ! Input: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - zwt0 => ch4_inst%zwt0_col , & ! Input: [real(r8) (:) ] decay factor for finundated (m) - f0 => ch4_inst%f0_col , & ! Input: [real(r8) (:) ] maximum gridcell fractional inundated area - p3 => ch4_inst%p3_col , & ! Input: [real(r8) (:) ] coefficient for qflx_surf_lag for finunated (s/mm) - totcolch4_bef => ch4_inst%totcolch4_bef_col , & ! Input: [real(r8) (:) ] total methane in soil column, start of timestep (g C / m^2) - - grnd_ch4_cond_patch => ch4_inst%grnd_ch4_cond_patch , & ! Input: [real(r8) (:) ] tracer conductance for boundary layer [m/s] - grnd_ch4_cond_col => ch4_inst%grnd_ch4_cond_col , & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] (p2c) - - ch4_surf_diff_sat => ch4_inst%ch4_surf_diff_sat_col , & ! Output: [real(r8) (:) ] CH4 surface flux (mol/m2/s) - ch4_surf_diff_unsat => ch4_inst%ch4_surf_diff_unsat_col , & ! Output: [real(r8) (:) ] CH4 surface flux (mol/m2/s) - ch4_surf_diff_lake => ch4_inst%ch4_surf_diff_lake_col , & ! Output: [real(r8) (:) ] CH4 surface flux (mol/m2/s) - ch4_surf_ebul_sat => ch4_inst%ch4_surf_ebul_sat_col , & ! Output: [real(r8) (:) ] CH4 ebullition to atmosphere (mol/m2/s) - ch4_surf_ebul_unsat => ch4_inst%ch4_surf_ebul_unsat_col , & ! Output: [real(r8) (:) ] CH4 ebullition to atmosphere (mol/m2/s) - ch4_surf_ebul_lake => ch4_inst%ch4_surf_ebul_lake_col , & ! Output: [real(r8) (:) ] CH4 ebullition to atmosphere (mol/m2/s) - ch4_surf_aere_sat => ch4_inst%ch4_surf_aere_sat_col , & ! Output: [real(r8) (:) ] Total column CH4 aerenchyma (mol/m2/s) - ch4_surf_aere_unsat => ch4_inst%ch4_surf_aere_unsat_col , & ! Output: [real(r8) (:) ] Total column CH4 aerenchyma (mol/m2/s) - ch4_oxid_depth_sat => ch4_inst%ch4_oxid_depth_sat_col , & ! Output: [real(r8) (:,:) ] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_oxid_depth_unsat => ch4_inst%ch4_oxid_depth_unsat_col , & ! Output: [real(r8) (:,:) ] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_oxid_depth_lake => ch4_inst%ch4_oxid_depth_lake_col , & ! Output: [real(r8) (:,:) ] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_prod_depth_sat => ch4_inst%ch4_prod_depth_sat_col , & ! Output: [real(r8) (:,:) ] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - ch4_prod_depth_unsat => ch4_inst%ch4_prod_depth_unsat_col , & ! Output: [real(r8) (:,:) ] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - ch4_prod_depth_lake => ch4_inst%ch4_prod_depth_lake_col , & ! Output: [real(r8) (:,:) ] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - lake_soilc => ch4_inst%lake_soilc_col , & ! Output: [real(r8) (:,:) ] total soil organic matter found in level (g C / m^3) (nlevsoi) - conc_ch4_sat => ch4_inst%conc_ch4_sat_col , & ! Output: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_ch4_unsat => ch4_inst%conc_ch4_unsat_col , & ! Output: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_ch4_lake => ch4_inst%conc_ch4_lake_col , & ! Output: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2_lake => ch4_inst%conc_o2_lake_col , & ! Output: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - ch4_dfsat_flux => ch4_inst%ch4_dfsat_flux_col , & ! Output: [real(r8) (:) ] CH4 flux to atm due to decreasing finundated (kg C/m^2/s) [+] - zwt_ch4_unsat => ch4_inst%zwt_ch4_unsat_col , & ! Output: [real(r8) (:) ] depth of water table for unsaturated fraction (m) - totcolch4 => ch4_inst%totcolch4_col , & ! Output: [real(r8) (:) ] total methane in soil column (g C / m^2) - finundated => ch4_inst%finundated_col , & ! Output: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) - finundated_pre_snow => ch4_inst%finundated_pre_snow_col , & ! Output: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) before snow - ch4_first_time => ch4_inst%ch4_first_time_col , & ! Output: [logical (:) ] whether this is the first time step that includes ch4 - qflx_surf_lag => ch4_inst%qflx_surf_lag_col , & ! Output: [real(r8) (:) ] time-lagged surface runoff (mm H2O /s) - finundated_lag => ch4_inst%finundated_lag_col , & ! Output: [real(r8) (:) ] time-lagged fractional inundated area - layer_sat_lag => ch4_inst%layer_sat_lag_col , & ! Output: [real(r8) (:,:) ] Lagged saturation status of soil layer in the unsaturated zone (1 = sat) - c_atm => ch4_inst%c_atm_grc , & ! Output: [real(r8) (:,:) ] CH4, O2, CO2 atmospheric conc (mol/m3) - ch4co2f => ch4_inst%ch4co2f_grc , & ! Output: [real(r8) (:) ] gridcell CO2 production from CH4 oxidation (g C/m**2/s) - ch4prodg => ch4_inst%ch4prodg_grc , & ! Output: [real(r8) (:) ] gridcell average CH4 production (g C/m^2/s) - ch4_surf_flux_tot => ch4_inst%ch4_surf_flux_tot_col , & ! Output: [real(r8) (:) ] col CH4 flux to atm. (kg C/m**2/s) - - nem_grc => lnd2atm_inst%nem_grc , & ! Output: [real(r8) (:) ] gridcell average net methane correction to CO2 flux (g C/m^2/s) - - begg => bounds%begg , & - endg => bounds%endg , & - begc => bounds%begc , & - endc => bounds%endc , & - begp => bounds%begp , & - endp => bounds%endp & - ) - - redoxlag = params_inst%redoxlag - redoxlag_vertical = params_inst%redoxlag_vertical - atmch4 = params_inst%atmch4 - qflxlagd = params_inst%qflxlagd - highlatfact = params_inst%highlatfact - - dtime = get_step_size() - nstep = get_nstep() - dtime_ch4 = dtime - redoxlags = redoxlag*secspday ! days --> s - redoxlags_vertical = redoxlag_vertical*secspday ! days --> s - rgasm = rgas / 1000._r8 - - jwt(begc:endc) = huge(1) - - ! Initialize local fluxes to zero: necessary for columns outside the filters because averaging up to gridcell will be done - ch4_surf_flux_tot(begc:endc) = 0._r8 - ch4_prod_tot(begc:endc) = 0._r8 - ch4_oxid_tot(begc:endc) = 0._r8 - rootfraction(begp:endp,:) = spval - - ! Adjustment to NEE for methane production - oxidation - nem_col(begc:endc) = 0._r8 - - do g= begg, endg - if (ch4offline) then - forc_pch4(g) = atmch4*forc_pbot(g) - else - if (forc_pch4(g) == 0._r8) then - write(iulog,*)'not using ch4offline, but methane concentration not passed from the atmosphere', & - 'to land model! CLM Model is stopping.' - call endrun(msg=' ERROR: Methane not being passed to atmosphere'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - c_atm(g,1) = forc_pch4(g) / rgasm / forc_t(g) ! [mol/m3 air] - c_atm(g,2) = forc_po2(g) / rgasm / forc_t(g) ! [mol/m3 air] - c_atm(g,3) = forc_pco2(g) / rgasm / forc_t(g) ! [mol/m3 air] - end do - - ! Save finundated before, and calculate lagged surface runoff - do fc = 1, num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - - fsat_bef(c) = finundated(c) - - ! Update lagged surface runoff - - if (grc%latdeg(g) < 45._r8) then - qflxlags = qflxlagd * secspday ! 30 days - else - qflxlags = qflxlagd * secspday * highlatfact ! 60 days - end if - qflx_surf_lag(c) = qflx_surf_lag(c) * exp(-dtime/qflxlags) & - + qflx_surf(c) * (1._r8 - exp(-dtime/qflxlags)) - - end do - - ! Caulculate finundated - if ( ch4_inst%ch4findstream%useStreams() & - .or. (finundation_mtd == finundation_mtd_h2osfc) )then - call ch4_inst%ch4findstream%CalcFinundated( bounds, num_soilc, & - filter_soilc, soilhydrology_inst, waterstate_inst, & - qflx_surf_lag(begc:endc), finundated(begc:endc) ) - else - - ! Calculate finundated with ZWT inversion from surface dataset - do fc = 1, num_soilc - c = filter_soilc(fc) - if (zwt0(c) > 0._r8) then - if (zwt_perched(c) < z(c,nlevsoi)-1.e-5_r8 .and. zwt_perched(c) < zwt(c)) then - zwt_actual = zwt_perched(c) - else - zwt_actual = zwt(c) - end if - finundated(c) = f0(c) * exp(-zwt_actual/zwt0(c)) + p3(c)*qflx_surf_lag(c) - else - finundated(c) = p3(c)*qflx_surf_lag(c) - end if - - end do - end if - - ! Calculate finundated before snow and lagged version of finundated - do fc = 1, num_soilc - c = filter_soilc(fc) - if (snow_depth(c) <= 0._r8) then ! If snow_depth<=0,use the above method to calculate finundated. - finundated(c) = max( min(finundated(c),1._r8), 0._r8) - finundated_pre_snow(c) = finundated(c) - else - finundated(c) = finundated_pre_snow(c) !If snow_depth>0, keep finundated from the previous time step of snow season. (by Xiyan Xu, 05/2016) - end if - - ! Update lagged finundated for redox calculation - if (redoxlags > 0._r8) then - finundated_lag(c) = finundated_lag(c) * exp(-dtime/redoxlags) & - + finundated(c) * (1._r8 - exp(-dtime/redoxlags)) - else - finundated_lag(c) = finundated(c) - end if - - end do - - ! Check to see if finundated changed since the last timestep. If it increased, then reduce conc_ch4_sat - ! proportionally. If it decreased, then add flux to atm. - - do j=1,nlevsoi - do fc = 1, num_soilc - c = filter_soilc(fc) - - if (j==1) then - ch4_dfsat_flux(c) = 0._r8 - end if - - if (.not. ch4_first_time(c)) then - if (finundated(c) > fsat_bef(c)) then !Reduce conc_ch4_sat - dfsat = finundated(c) - fsat_bef(c) - conc_ch4_sat(c,j) = (fsat_bef(c)*conc_ch4_sat(c,j) + dfsat*conc_ch4_unsat(c,j)) / finundated(c) - else if (finundated(c) < fsat_bef(c)) then - ch4_dfsat_flux(c) = ch4_dfsat_flux(c) + & - (fsat_bef(c) - finundated(c))*(conc_ch4_sat(c,j) - conc_ch4_unsat(c,j)) * & - dz(c,j) / dtime * catomw / 1000._r8 ! mol --> kg - end if - end if - end do - end do - - !!!! Begin biochemistry - - ! First for soil - lake = .false. - - ! Do CH4 Annual Averages - call ch4_annualupdate(bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - agnpp(begp:endp), bgnpp(begp:endp), & - soilbiogeochem_carbonflux_inst, ch4_inst) - - ! Determine rootfr_col and also check for inactive columns - - if (nlevdecomp == 1) then - - ! Set rootfraction to spval for non-veg points, unless patch%wtcol > 0.99, - ! in which case set it equal to uniform dist. - do j=1, nlevsoi - do fp = 1, num_soilp - p = filter_soilp(fp) - c = patch%column(p) - - if (patch%itype(p) /= noveg) then - rootfraction(p,j) = rootfr(p,j) - else if (patch%wtcol(p) < 0.99_r8) then - rootfraction(p,j) = spval - else - rootfraction(p,j) = dz(c,j) / zi(c,nlevsoi) ! Set equal to uniform distribution - end if - end do - end do - - call p2c (bounds, nlevgrnd, & - rootfraction(bounds%begp:bounds%endp, :), & - rootfr_col(bounds%begc:bounds%endc, :), & - 'unity') - - do j=1, nlevsoi - do fc = 1, num_soilc - c = filter_soilc(fc) - if (.not. col%active(c)) rootfr_col(c,j) = dz(c,j) / zi(c,nlevsoi) - end do - end do - end if - - ! Determine grnd_ch4_cond_col - ! Needed to use non-filter form above so that spval would be treated properly. - - call p2c (bounds, num_soilc, filter_soilc, & - grnd_ch4_cond_patch(bounds%begp:bounds%endp), & - grnd_ch4_cond_col(bounds%begc:bounds%endc)) - - ! Set the gridcell atmospheric CH4 and O2 concentrations - do fc = 1, num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - - c_atm(g,1) = forc_pch4(g) / rgasm / forc_t(g) ! [mol/m3 air] - c_atm(g,2) = forc_po2(g) / rgasm / forc_t(g) ! [mol/m3 air] - !c_atm(g,3) = forc_pco2(g) / rgasm / forc_t(g) ! [mol/m3 air] - Not currently used - enddo - - !------------------------------------------------- - ! Loop over saturated and unsaturated, non-lakes - !------------------------------------------------ - - do sat = 0, 1 ! 0 == unsaturated; 1 = saturated - - ! Get index of water table - if (sat == 0) then ! unsaturated - - call get_jwt (bounds, num_soilc, filter_soilc, jwt(begc:endc), & - soilstate_inst, waterstate_inst, temperature_inst) - - do fc = 1, num_soilc - c = filter_soilc(fc) - zwt_ch4_unsat(c) = zi(c,jwt(c)) - - end do - - ! Update lagged saturation status of layer - do j=1,nlevsoi - do fc = 1, num_soilc - c = filter_soilc(fc) - - if (j > jwt(c) .and. redoxlags_vertical > 0._r8) then ! saturated currently - layer_sat_lag(c,j) = layer_sat_lag(c,j) * exp(-dtime/redoxlags_vertical) & - + (1._r8 - exp(-dtime/redoxlags_vertical)) - else if (redoxlags_vertical > 0._r8) then - layer_sat_lag(c,j) = layer_sat_lag(c,j) * exp(-dtime/redoxlags_vertical) - else if (j > jwt(c)) then ! redoxlags_vertical = 0 - layer_sat_lag(c,j) = 1._r8 - else - layer_sat_lag(c,j) = 0._r8 - end if - end do - end do - - else ! saturated - do fc = 1, num_soilc - c = filter_soilc(fc) - jwt(c) = 0 - end do - endif - - ! calculate CH4 production in each soil layer - call ch4_prod (bounds, num_soilc, filter_soilc, num_soilp, filter_soilp, & - rr(begp:endp), jwt(begc:endc), sat, lake, & - soilstate_inst, temperature_inst, waterstate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst, & - ch4_inst) - - ! calculate CH4 oxidation in each soil layer - call ch4_oxid (bounds, & - num_soilc, filter_soilc, & - jwt(begc:endc), sat, lake, & - waterstate_inst, soilstate_inst, temperature_inst, ch4_inst) - - ! calculate CH4 aerenchyma losses in each soil layer - call ch4_aere (bounds, & - num_soilc, filter_soilc, & - num_soilp, filter_soilp, & - annsum_npp(begp:endp), jwt(begc:endc), sat, lake, & - canopystate_inst, soilstate_inst, temperature_inst, energyflux_inst, & - waterstate_inst, waterflux_inst, ch4_inst) - - ! calculate CH4 ebullition losses in each soil layer - call ch4_ebul (bounds, & - num_soilc, filter_soilc, & - jwt(begc:endc), sat, lake, & - atm2lnd_inst, temperature_inst, lakestate_inst, soilstate_inst, waterstate_inst, & - ch4_inst) - - ! Solve CH4 reaction/diffusion equation - ! Competition for oxygen will occur here. - call ch4_tran (bounds, & - num_soilc, filter_soilc, & - jwt(begc:endc), dtime_ch4, sat, lake, & - soilstate_inst, temperature_inst, waterstate_inst, energyflux_inst, ch4_inst) - - enddo ! sat/unsat - - !------------------------------------------------- - ! Now do over lakes - !------------------------------------------------- - - if (allowlakeprod) then - lake = .true. - sat = 1 - do fc = 1, num_lakec - c = filter_lakec(fc) - jwt(c) = 0 - end do - - ! calculate CH4 production in each lake layer - call ch4_prod (bounds, num_lakec, filter_lakec, 0, dummyfilter, & - rr(begp:endp), jwt(begc:endc), sat, lake, & - soilstate_inst, temperature_inst, waterstate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst, & - ch4_inst) - - ! calculate CH4 oxidation in each lake layer - call ch4_oxid (bounds, & - num_lakec, filter_lakec, & - jwt(begc:endc), sat, lake, & - waterstate_inst, soilstate_inst, temperature_inst, ch4_inst) - - ! calculate CH4 aerenchyma losses in each lake layer - ! The p filter will not be used here; the relevant column vars will just be set to 0. - call ch4_aere (bounds, num_lakec, filter_lakec, 0, dummyfilter, & - annsum_npp(begp:endp), jwt(begc:endc), sat, lake, & - canopystate_inst, soilstate_inst, temperature_inst, energyflux_inst, & - waterstate_inst, waterflux_inst, ch4_inst) - - ! calculate CH4 ebullition losses in each lake layer - call ch4_ebul (bounds, num_lakec, filter_lakec, & - jwt(begc:endc), sat, lake, & - atm2lnd_inst, temperature_inst, lakestate_inst, soilstate_inst, waterstate_inst, & - ch4_inst) - - ! Solve CH4 reaction/diffusion equation - ! Competition for oxygen will occur here. - call ch4_tran (bounds, num_lakec, filter_lakec, & - jwt(begc:endc), dtime_ch4, sat, lake, & - soilstate_inst, temperature_inst, waterstate_inst, energyflux_inst, ch4_inst) - - end if - - !------------------------------------------------- - ! Average up to gridcell flux and column oxidation and production rate. - !------------------------------------------------- - - ! First weight the soil columns by finundated. - do j=1,nlevsoi - do fc = 1, num_soilc - c = filter_soilc(fc) - - if (j == 1) then - totalsat = ch4_surf_diff_sat(c) + ch4_surf_aere_sat(c) + ch4_surf_ebul_sat(c) - totalunsat = ch4_surf_diff_unsat(c) + ch4_surf_aere_unsat(c) + ch4_surf_ebul_unsat(c) - ch4_surf_flux_tot(c) = (finundated(c)*totalsat + (1._r8 - finundated(c))*totalunsat) * & - catomw / 1000._r8 - !Convert from mol to kg C - ! ch4_oxid_tot and ch4_prod_tot are initialized to zero above - end if - - ch4_oxid_tot(c) = ch4_oxid_tot(c) + (finundated(c)*ch4_oxid_depth_sat(c,j) + & - (1._r8 - finundated(c))*ch4_oxid_depth_unsat(c,j))*dz(c,j) * catomw - !Convert from mol to g C - ch4_prod_tot(c) = ch4_prod_tot(c) + (finundated(c)*ch4_prod_depth_sat(c,j) + & - (1._r8 - finundated(c))*ch4_prod_depth_unsat(c,j))*dz(c,j) * catomw - !Convert from mol to g C - if (j == nlevsoi) then - ! Adjustment to NEE flux to atm. for methane production - nem_col(c) = nem_col(c) - ch4_prod_tot(c) - ! Adjustment to NEE flux to atm. for methane oxidation - nem_col(c) = nem_col(c) + ch4_oxid_tot(c) - end if - end do - end do - - ! Correct for discrepancies in CH4 concentration from changing finundated - - do fc = 1, num_soilc - c = filter_soilc(fc) - - ch4_surf_flux_tot(c) = ch4_surf_flux_tot(c) + ch4_dfsat_flux(c) - end do - - if (allowlakeprod) then - do j=1,nlevsoi - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (j == 1) then - ! ch4_oxid_tot and ch4_prod_tot are initialized to zero above - totalsat = ch4_surf_diff_sat(c) + ch4_surf_aere_sat(c) + ch4_surf_ebul_sat(c) - ch4_surf_flux_tot(c) = totalsat*catomw / 1000._r8 - end if - - ch4_oxid_tot(c) = ch4_oxid_tot(c) + ch4_oxid_depth_sat(c,j)*dz(c,j)*catomw - ch4_prod_tot(c) = ch4_prod_tot(c) + ch4_prod_depth_sat(c,j)*dz(c,j)*catomw - - if (.not. replenishlakec) then - !Adjust lake_soilc for production. - lake_soilc(c,j) = lake_soilc(c,j) - 2._r8*ch4_prod_depth_sat(c,j)*dtime*catomw - ! Factor of 2 is for CO2 that comes off with CH4 because of stoichiometry - end if - - if (j == nlevsoi) then - ! Adjustment to NEE flux to atm. for methane production - if (.not. replenishlakec) then - nem_col(c) = nem_col(c) + ch4_prod_tot(c) - ! Here this is positive because it is actually the CO2 that comes off with the methane - ! NOTE THIS MODE ASSUMES TRANSIENT CARBON SUPPLY FROM LAKES; COUPLED MODEL WILL NOT CONSERVE CARBON - ! IN THIS MODE. - else ! replenishlakec - nem_col(c) = nem_col(c) - ch4_prod_tot(c) - ! Keep total C constant, just shift from CO2 to methane - end if - - ! Adjustment to NEE flux to atm. for methane oxidation - nem_col(c) = nem_col(c) + ch4_oxid_tot(c) - - end if - - - !Set lake diagnostic output variables - ch4_prod_depth_lake(c,j) = ch4_prod_depth_sat(c,j) - conc_ch4_lake(c,j) = conc_ch4_sat(c,j) - conc_o2_lake(c,j) = conc_o2_sat(c,j) - ch4_oxid_depth_lake(c,j) = ch4_oxid_depth_sat(c,j) - if (j == 1) then - ch4_surf_diff_lake(c) = ch4_surf_diff_sat(c) - ch4_surf_ebul_lake(c) = ch4_surf_ebul_sat(c) - end if - - end do - end do - end if ! ch4_surf_flux_tot, ch4_oxid_tot, and ch4_prod_tot should be initialized to 0 above if .not. allowlakeprod - - ! Finalize CH4 balance and check for errors - - call ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - ch4_inst, totcolch4(bounds%begc:bounds%endc)) - - do fc = 1, num_soilc - c = filter_soilc(fc) - - if (.not. ch4_first_time(c)) then - ! Check balance - errch4 = totcolch4(c) - totcolch4_bef(c) & - - dtime*(ch4_prod_tot(c) - ch4_oxid_tot(c) & - - ch4_surf_flux_tot(c)*1000._r8) ! kg C --> g C - if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep - write(iulog,*)'CH4 Conservation Error in CH4Mod driver, nstep, c, errch4 (gC /m^2.timestep)', & - nstep,c,errch4 - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg,col%itype=',grc%latdeg(g),grc%londeg(g),col%itype(c) - write(iulog,*)'totcolch4 = ', totcolch4(c) - write(iulog,*)'totcolch4_bef = ', totcolch4_bef(c) - write(iulog,*)'dtime*ch4_prod_tot = ', dtime*ch4_prod_tot(c) - write(iulog,*)'dtime*ch4_oxid_tot = ', dtime*ch4_oxid_tot(c) - write(iulog,*)'dtime*ch4_surf_flux_tot*1000 = ', dtime*& - ch4_surf_flux_tot(c)*1000._r8 - call endrun(msg=' ERROR: Methane conservation error'//errMsg(sourcefile, __LINE__)) - end if - end if - - end do - if (allowlakeprod) then - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (.not. ch4_first_time(c)) then - ! Check balance - errch4 = totcolch4(c) - totcolch4_bef(c) & - - dtime*(ch4_prod_tot(c) - ch4_oxid_tot(c) & - - ch4_surf_flux_tot(c)*1000._r8) ! kg C --> g C - if (abs(errch4) > 1.e-7_r8) then ! g C / m^2 / timestep - write(iulog,*)'CH4 Conservation Error in CH4Mod driver for lake column, nstep, c, errch4 (gC/m^2.timestep)', & - nstep,c,errch4 - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - write(iulog,*)'totcolch4 = ', totcolch4(c) - write(iulog,*)'totcolch4_bef = ', totcolch4_bef(c) - write(iulog,*)'dtime*ch4_prod_tot = ', dtime*ch4_prod_tot(c) - write(iulog,*)'dtime*ch4_oxid_tot = ', dtime*ch4_oxid_tot(c) - write(iulog,*)'dtime*ch4_surf_flux_tot*1000 = ', dtime*& - ch4_surf_flux_tot(c)*1000._r8 - call endrun(msg=' ERROR: Methane conservation error, allowlakeprod'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - end do - end if - - ! Now average up to gridcell for fluxes - call c2g( bounds, & - ch4_oxid_tot(begc:endc), ch4co2f(begg:endg), & - c2l_scale_type= 'unity', l2g_scale_type='unity' ) - - call c2g( bounds, & - ch4_prod_tot(begc:endc), ch4prodg(begg:endg), & - c2l_scale_type= 'unity', l2g_scale_type='unity' ) - - call c2g( bounds, & - nem_col(begc:endc), nem_grc(begg:endg), & - c2l_scale_type= 'unity', l2g_scale_type='unity' ) - - ch4_first_time(begc:endc) = .false. - - end associate - - end subroutine ch4 - - !----------------------------------------------------------------------- - subroutine ch4_prod (bounds, num_methc, filter_methc, num_methp, & - filter_methp, rr, jwt, sat, lake, & - soilstate_inst, temperature_inst, waterstate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst, & - ch4_inst) - ! - ! !DESCRIPTION: - ! Production is done below the water table, based on CN heterotrophic respiration. - ! O2 is consumed by roots & by heterotrophic aerobes. - ! Production is done separately for sat & unsat, and is adjusted for temperature, seasonal inundation, - ! pH (optional), & redox lag factor. - ! - ! !USES: - use ch4varcon , only: usephfact, anoxicmicrosites, ch4rmcnlim - use clm_varctl , only: anoxia - use clm_varpar , only: nlevdecomp, nlevdecomp_full - use CNSharedParamsMod , only: nlev_soildecomp_standard - use pftconMod , only: noveg - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of column soil points in column filter - integer , intent(in) :: filter_methc(:) ! column filter for soil points - integer , intent(in) :: num_methp ! number of soil points in patch filter - integer , intent(in) :: filter_methp(:) ! patch filter for soil points - real(r8) , intent(in) :: rr ( bounds%begp: ) ! root respiration (fine root MR + total root GR) (gC/m2/s) - integer , intent(in) :: jwt( bounds%begc: ) ! index of the soil layer right above the water table (-) [col] - integer , intent(in) :: sat ! 0 = unsaturated; 1 = saturated - logical , intent(in) :: lake ! function called with lake filter - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenflux_type) , intent(in) :: soilbiogeochem_nitrogenflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,j,g ! indices - integer :: fc ! column index - integer :: fp ! PATCH index - real(r8) :: dtime - real(r8) :: base_decomp ! base rate (mol/m2/s) - real(r8) :: q10lake ! For now, take to be the same as q10ch4 * 1.5. - real(r8) :: q10lakebase ! (K) base temperature for lake CH4 production - real(r8) :: partition_z - real(r8) :: mino2lim ! minimum anaerobic decomposition rate as a fraction of potential aerobic rate - real(r8) :: q10ch4 ! additional Q10 for methane production ABOVE the soil decomposition temperature relationship - real(r8) :: q10ch4base ! temperature at which the effective f_ch4 actually equals the constant f_ch4 - real(r8) :: f_ch4 ! ratio of CH4 production to total C mineralization - real(r8) :: rootlitfrac ! Fraction of soil organic matter associated with roots - real(r8) :: cnscalefactor ! scale factor on CN decomposition for assigning methane flux - real(r8) :: lake_decomp_fact ! Base decomposition rate (1/s) at 25C - - ! added by Lei Meng to account for pH influence of CH4 production - real(r8) :: pHmax - real(r8) :: pHmin - real(r8) :: pH_fact_ch4 ! pH factor in methane production - - ! Factors for methanogen temperature dependence being greater than soil aerobes - real(r8) :: f_ch4_adj ! Adjusted f_ch4 - real(r8) :: t_fact_ch4 ! Temperature factor calculated using additional Q10 - ! O2 limitation on decomposition and methanogenesis - real(r8) :: seasonalfin ! finundated in excess of respiration-weighted annual average - real(r8) :: oxinhib ! inhibition of methane production by oxygen (m^3/mol) - - ! For calculating column average (rootfrac(p,j)*rr(p,j)) - real(r8) :: rr_vr(bounds%begc:bounds%endc, 1:nlevsoi) ! vertically resolved column-mean root respiration (g C/m^2/s) - real(r8), pointer :: ch4_prod_depth(:,:) ! backwards compatibility - real(r8), pointer :: o2_decomp_depth(:,:) ! backwards compatibility - real(r8), pointer :: co2_decomp_depth(:,:) ! backwards compatibility - real(r8), pointer :: conc_o2(:,:) ! backwards compatibility - - character(len=32) :: subname='ch4_prod' ! subroutine name - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(rr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(jwt) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevsoi) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevsoi) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevsoi) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - crootfr => soilstate_inst%crootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots for carbon in each soil layer (nlevsoi) - rootfr_col => soilstate_inst%rootfr_col , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer (nlevsoi) - - somhr => soilbiogeochem_carbonflux_inst%somhr_col , & ! Input: [real(r8) (:) ] (gC/m2/s) soil organic matter heterotrophic respiration - lithr => soilbiogeochem_carbonflux_inst%lithr_col , & ! Input: [real(r8) (:) ] (gC/m2/s) litter heterotrophic respiration - hr_vr => soilbiogeochem_carbonflux_inst%hr_vr_col , & ! Input: [real(r8) (:,:) ] total vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - o_scalar => soilbiogeochem_carbonflux_inst%o_scalar_col , & ! Input: [real(r8) (:,:) ] fraction by which decomposition is limited by anoxia - fphr => soilbiogeochem_carbonflux_inst%fphr_col , & ! Input: [real(r8) (:,:) ] fraction of potential heterotrophic respiration - - pot_f_nit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_nit_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3/s) potential soil nitrification flux - - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area in soil column - pH => ch4_inst%pH_col , & ! Input: [real(r8) (:) ] soil water pH - lake_soilc => ch4_inst%lake_soilc_col , & ! Input: [real(r8) (:,:) ] total soil organic matter found in level (g C / m^3) (nlevsoi) - annavg_finrw => ch4_inst%annavg_finrw_col , & ! Input: [real(r8) (:) ] respiration-weighted annual average of finundated - finundated_lag => ch4_inst%finundated_lag_col , & ! Input: [real(r8) (:) ] time-lagged fractional inundated area - layer_sat_lag => ch4_inst%layer_sat_lag_col , & ! Input: [real(r8) (: ,:) ] Lagged saturation status of soil layer in the unsaturated zone (1 = sat) - sif => ch4_inst%sif_col & ! Output: [real(r8) (:) ] (unitless) ratio applied to sat. prod. to account for seasonal inundation - ) - - if (sat == 0) then ! unsaturated - conc_o2 => ch4_inst%conc_o2_unsat_col ! Input: [real(r8) (:,:)] O2 conc in each soil layer (mol/m3) (nlevsoi) - ch4_prod_depth => ch4_inst%ch4_prod_depth_unsat_col ! Output: [real(r8) (:,:)] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - o2_decomp_depth => ch4_inst%o2_decomp_depth_unsat_col ! Output: [real(r8) (:,:)] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - co2_decomp_depth => ch4_inst%co2_decomp_depth_unsat_col ! Output: [real(r8) (:,:)] CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - else ! saturated - conc_o2 => ch4_inst%conc_o2_sat_col ! Input: [real(r8) (:,:)] O2 conc in each soil layer (mol/m3) (nlevsoi) - ch4_prod_depth => ch4_inst%ch4_prod_depth_sat_col ! Output: [real(r8) (:,:)] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - o2_decomp_depth => ch4_inst%o2_decomp_depth_sat_col ! Output: [real(r8) (:,:)] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - co2_decomp_depth => ch4_inst%co2_decomp_depth_sat_col ! Output: [real(r8) (:,:)] CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - endif - - dtime = get_step_size() - - q10ch4 = params_inst%q10ch4 - q10ch4base = params_inst%q10ch4base - f_ch4 = params_inst%f_ch4 - rootlitfrac = params_inst%rootlitfrac - cnscalefactor = params_inst%cnscalefactor - lake_decomp_fact = params_inst%lake_decomp_fact - pHmax = params_inst%pHmax - pHmin = params_inst%pHmin - oxinhib = params_inst%oxinhib - q10lakebase = params_inst%q10lakebase - - ! Shared constant with other modules - mino2lim = CNParamsShareInst%mino2lim - - q10lake = q10ch4 * 1.5_r8 - - ! PATCH loop to calculate vertically resolved column-averaged root respiration - if (.not. lake) then - rr_vr(bounds%begc:bounds%endc,:) = nan - - do fp = 1, num_methc - c = filter_methc(fp) - rr_vr(c,:) = 0.0_r8 - end do - do j=1,nlevsoi - do fp = 1, num_methp - p = filter_methp(fp) - c = patch%column(p) - - if (wtcol(p) > 0._r8 .and. patch%itype(p) /= noveg) then - rr_vr(c,j) = rr_vr(c,j) + rr(p)*crootfr(p,j)*wtcol(p) - end if - end do - end do - end if - - partition_z = 1._r8 - base_decomp = 0.0_r8 - - ! column loop to partition decomposition_rate into each soil layer - do j=1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - if (.not. lake) then - - if (use_cn) then - ! Use soil heterotrophic respiration (based on Wania) - base_decomp = (somhr(c)+lithr(c)) / catomw - ! Convert from gC to molC - ! Multiply base_decomp by factor accounting for lower carbon stock in seasonally inundated areas than - ! if it were inundated all year. - ! This is to reduce emissions in seasonally inundated zones, because the eq. - ! C-flux will be less than predicted by a non-O2-lim model - if (sat == 1) then - sif(c) = 1._r8 - if (.not. anoxia) then - if (annavg_finrw(c) /= spval) then - seasonalfin = max(finundated(c)-annavg_finrw(c), 0._r8) - if (seasonalfin > 0._r8) then - sif(c) = (annavg_finrw(c) + mino2lim*seasonalfin) / finundated(c) - base_decomp = base_decomp * sif(c) - end if - end if - end if ! anoxia - end if - else - call endrun(msg=' ERROR: No source for decomp rate in CH4Prod.'//& - ' CH4 model currently requires CN.'//errMsg(sourcefile, __LINE__)) - end if ! use_cn - - ! For sensitivity studies - base_decomp = base_decomp * cnscalefactor - - else !lake - - base_decomp = lake_decomp_fact * lake_soilc(c,j) * dz(c,j) * & - q10lake**( (t_soisno(c,j)-q10lakebase)/10._r8) / catomw - ! convert from g C to mol C - end if - - ! For all landunits, prevent production or oxygen consumption when soil is at or below freezing. - ! If using VERTSOILC, it is OK to use base_decomp as given because liquid water stress will limit decomp. - if (t_soisno(c,j) <= tfrz .and. (nlevdecomp == 1 .or. lake)) base_decomp = 0._r8 - - ! depth dependence of production either from rootfr or decomp model - if (.not. lake) then ! use default rootfr, averaged to the column level in the ch4 driver, or vert HR - if (nlevdecomp == 1) then ! not VERTSOILC - if (j <= nlev_soildecomp_standard) then ! Top 5 levels are also used in the CLM code for establishing temperature - ! and moisture constraints on SOM activity - partition_z = rootfr_col(c,j)*rootlitfrac + (1._r8 - rootlitfrac)*dz(c,j)/zi(c,nlev_soildecomp_standard) - else - partition_z = rootfr_col(c,j)*rootlitfrac - end if - else - if ( (somhr(c) + lithr(c)) > 0._r8) then - partition_z = hr_vr(c,j) * dz(c,j) / (somhr(c) + lithr(c)) - else - partition_z = 1._r8 - end if - end if - else ! lake - partition_z = 1._r8 - endif - - ! Adjust f_ch4 to account for the fact that methanogens may have a higher Q10 than aerobic decomposers. - ! Note this is crude and should ideally be applied to all anaerobic decomposition rather than just the - ! f_ch4. - f_ch4_adj = 1.0_r8 - if (.not. lake) then - t_fact_ch4 = q10ch4**((t_soisno(c,j) - q10ch4base)/10._r8) - ! Adjust f_ch4 by the ratio - f_ch4_adj = f_ch4 * t_fact_ch4 - - ! Remove CN nitrogen limitation, as methanogenesis is not N limited. - ! Also remove (low) moisture limitation - if (ch4rmcnlim) then - if (j > nlevdecomp) then - if (fphr(c,1) > 0._r8) then - f_ch4_adj = f_ch4_adj / fphr(c,1) - end if - else ! j == 1 or VERTSOILC - if (fphr(c,j) > 0._r8) then - f_ch4_adj = f_ch4_adj / fphr(c,j) - end if - end if - end if - - else ! lake - f_ch4_adj = 0.5_r8 ! For lakes assume no redox limitation. Production only depends on temp, soil C, and - ! lifetime parameter. - end if - - ! If switched on, use pH factor for production based on spatial pH data defined in surface data. - if (.not. lake .and. usephfact .and. pH(c) > pHmin .and.pH(c) < pHmax) then - pH_fact_ch4 = 10._r8**(-0.2235_r8*pH(c)*pH(c) + 2.7727_r8*pH(c) - 8.6_r8) - ! fitted function using data from Dunfield et al. 1993 - ! Strictly less than one, with optimum at 6.5 - ! From Lei Meng - f_ch4_adj = f_ch4_adj * pH_fact_ch4 - else - ! if no data, then no pH effects - end if - - ! Redox factor - if ( (.not. lake) .and. sat == 1 .and. finundated_lag(c) < finundated(c)) then - f_ch4_adj = f_ch4_adj * finundated_lag(c) / finundated(c) - else if (sat == 0 .and. j > jwt(c)) then ! Assume lag in decay of alternative electron acceptors vertically - f_ch4_adj = f_ch4_adj * layer_sat_lag(c,j) - end if - ! Alternative electron acceptors will be consumed first after soil is inundated. - - f_ch4_adj = min(f_ch4_adj, 0.5_r8) - ! Must be less than 0.5 because otherwise the actual implied aerobic respiration would be negative. - ! The total of aer. respiration + methanogenesis must remain equal to the SOMHR calculated in CN, - ! so that the NEE is sensible. Even perfectly anaerobic conditions with no alternative - ! electron acceptors would predict no more than 0.5 b/c some oxygen is present in organic matter. - ! e.g. 2CH2O --> CH4 + CO2. - - - ! Decomposition uses 1 mol O2 per mol CO2 produced (happens below WT also, to deplete O2 below WT) - ! o2_decomp_depth is the demand in the absense of O2 supply limitation, in addition to autotrophic respiration. - ! Competition will be done in ch4_oxid - - o2_decomp_depth(c,j) = base_decomp * partition_z / dz (c,j) - if (anoxia) then - ! Divide off o_scalar to use potential O2-unlimited HR to represent aerobe demand for oxygen competition - if (.not. lake .and. j > nlevdecomp) then - if (o_scalar(c,1) > 0._r8) then - o2_decomp_depth(c,j) = o2_decomp_depth(c,j) / o_scalar(c,1) - end if - else if (.not. lake) then ! j == 1 or VERTSOILC - if (o_scalar(c,j) > 0._r8) then - o2_decomp_depth(c,j) = o2_decomp_depth(c,j) / o_scalar(c,j) - end if - end if - end if ! anoxia - - ! Add root respiration - if (.not. lake) then - o2_decomp_depth(c,j) = o2_decomp_depth(c,j) + rr_vr(c,j)/catomw/dz(c,j) ! mol/m^3/s - ! g C/m2/s ! gC/mol O2 ! m - end if - - ! Add oxygen demand for nitrification - if (use_nitrif_denitrif) then - if (.not. lake .and. j<= nlevdecomp_full ) then - o2_decomp_depth(c,j) = o2_decomp_depth(c,j) + pot_f_nit_vr(c,j) * 2.0_r8/14.0_r8 - ! g N/m^3/s mol O2 / g N - end if - end if - - if (j > jwt(c)) then ! Below the water table so anaerobic CH4 production can occur - ! partition decomposition to layer - ! turn into per volume-total by dz - ch4_prod_depth(c,j) = f_ch4_adj * base_decomp * partition_z / dz (c,j)! [mol/m3-total/s] - else ! Above the WT - if (anoxicmicrosites) then - ch4_prod_depth(c,j) = f_ch4_adj * base_decomp * partition_z / dz (c,j) & - / (1._r8 + oxinhib*conc_o2(c,j)) - else - ch4_prod_depth(c,j) = 0._r8 ! [mol/m3 total/s] - endif ! anoxicmicrosites - endif ! WT - - end do ! fc - end do ! nlevsoi - - end associate - - end subroutine ch4_prod - - !----------------------------------------------------------------------- - subroutine ch4_oxid (bounds, & - num_methc, filter_methc, & - jwt, sat, lake, & - waterstate_inst, soilstate_inst, temperature_inst, ch4_inst) - ! - ! !DESCRIPTION: - ! Oxidation is based on double Michaelis-Mentin kinetics, and is adjusted for low soil moisture. - ! Oxidation will be limited by available oxygen in ch4_tran. - - ! !USES: - use clm_time_manager, only : get_step_size - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of column soil points in column filter - integer , intent(in) :: filter_methc(:) ! column filter for soil points - integer , intent(in) :: jwt( bounds%begc: ) ! index of the soil layer right above the water table (-) [col] - integer , intent(in) :: sat ! 0 = unsaturated; 1 = saturated - logical , intent(in) :: lake ! function called with lake filter - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(ch4_type) , intent(in) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j ! indices - integer :: fc ! column index - real(r8) :: dtime ! land model time step (sec) - real(r8):: t0 ! Base temperature for Q10 - real(r8):: porevol ! air-filled volume ratio to total soil volume - real(r8):: h2osoi_vol_min ! h2osoi_vol restricted to be below watsat - real(r8):: conc_ch4_rel ! concentration with respect to water volume (mol/m^3 water) - real(r8):: conc_o2_rel ! concentration with respect to water volume (mol/m^3 water) - real(r8):: oxid_a ! Oxidation predicted by method A (temperature & enzyme limited) (mol CH4/m3/s) - real(r8):: smp_fact ! factor for reduction based on soil moisture (unitless) - real(r8):: porewatfrac ! fraction of soil pore space that is filled with water - real(r8):: k_h_cc, k_h_inv ! see functions below for description - real(r8):: k_m_eff ! effective k_m - real(r8):: vmax_eff ! effective vmax - ! ch4 oxidation parameters - real(r8) :: vmax_ch4_oxid ! oxidation rate constant (= 45.e-6_r8 * 1000._r8 / 3600._r8) [mol/m3-w/s]; - real(r8) :: k_m ! Michaelis-Menten oxidation rate constant for CH4 concentration - real(r8) :: q10_ch4oxid ! Q10 oxidation constant - real(r8) :: smp_crit ! Critical soil moisture potential - real(r8) :: k_m_o2 ! Michaelis-Menten oxidation rate constant for O2 concentration - real(r8) :: k_m_unsat ! Michaelis-Menten oxidation rate constant for CH4 concentration - real(r8) :: vmax_oxid_unsat ! (= 45.e-6_r8 * 1000._r8 / 3600._r8 / 10._r8) [mol/m3-w/s] - ! - real(r8), pointer :: ch4_oxid_depth(:,:) - real(r8), pointer :: o2_oxid_depth(:,:) - real(r8), pointer :: co2_oxid_depth(:,:) - real(r8), pointer :: o2_decomp_depth(:,:) - real(r8), pointer :: conc_o2(:,:) - real(r8), pointer :: conc_ch4(:,:) - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jwt) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (: ,:) ] soil matrix potential [mm] - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - - t_soisno => temperature_inst%t_soisno_col & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevsoi) - ) - - if (sat == 0) then ! unsaturated - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_unsat_col ! Output: [real(r8) (:,:)] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - o2_oxid_depth => ch4_inst%o2_oxid_depth_unsat_col ! Output: [real(r8) (:,:)] O2 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - co2_oxid_depth => ch4_inst%co2_oxid_depth_unsat_col ! Output: [real(r8) (:,:)] CO2 production rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - conc_ch4 => ch4_inst%conc_ch4_unsat_col ! Input: [real(r8) (:,:)] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2 => ch4_inst%conc_o2_unsat_col ! Input: [real(r8) (:,:)] O2 conc in each soil layer (mol/m3) (nlevsoi) - o2_decomp_depth => ch4_inst%o2_decomp_depth_unsat_col ! Output: [real(r8) (:,:)] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - else ! saturated - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_sat_col ! Output: [real(r8) (:,:)] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - o2_oxid_depth => ch4_inst%o2_oxid_depth_sat_col ! Output: [real(r8) (:,:)] O2 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - co2_oxid_depth => ch4_inst%co2_oxid_depth_sat_col ! Output: [real(r8) (:,:)] CO2 production rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - conc_ch4 => ch4_inst%conc_ch4_sat_col ! Input: [real(r8) (:,:)] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2 => ch4_inst%conc_o2_sat_col ! Input: [real(r8) (:,:)] O2 conc in each soil layer (mol/m3) (nlevsoi) - o2_decomp_depth => ch4_inst%o2_decomp_depth_sat_col ! Output: [real(r8) (:,:)] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - endif - - ! Get land model time step - dtime = get_step_size() - - ! Set oxidation parameters - vmax_ch4_oxid = params_inst%vmax_ch4_oxid - k_m = params_inst%k_m - q10_ch4oxid = params_inst%q10_ch4oxid - smp_crit = params_inst%smp_crit - k_m_o2 = params_inst%k_m_o2 - k_m_unsat = params_inst%k_m_unsat - vmax_oxid_unsat = params_inst%vmax_oxid_unsat - - t0 = tfrz + 12._r8 ! Walter, for Michigan site where the 45 M/h comes from - - ! Loop to determine oxidation in each layer - do j=1,nlevsoi - do fc = 1, num_methc - c = filter_methc(fc) - - if (sat == 1 .or. j > jwt(c)) then - ! Literature (e.g. Bender & Conrad, 1992) suggests lower k_m and vmax for high-CH4-affinity methanotrophs in - ! upland soils consuming ambient methane. - k_m_eff = k_m - vmax_eff = vmax_ch4_oxid - else - k_m_eff = k_m_unsat - vmax_eff = vmax_oxid_unsat - end if - - porevol = max(watsat(c,j) - h2osoi_vol(c,j), 0._r8) - h2osoi_vol_min = min(watsat(c,j), h2osoi_vol(c,j)) - if (j <= jwt(c) .and. smp_l(c,j) < 0._r8) then - smp_fact = exp(-smp_l(c,j)/smp_crit) - ! Schnell & King, 1996, Figure 3 - else - smp_fact = 1._r8 - end if - - if (j <= jwt(c)) then ! Above the water table - k_h_inv = exp(-c_h_inv(1) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(1))) - k_h_cc = t_soisno(c,j) / k_h_inv * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - conc_ch4_rel = conc_ch4(c,j) / (h2osoi_vol_min + porevol/k_h_cc) - - k_h_inv = exp(-c_h_inv(2) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(2))) - k_h_cc = t_soisno(c,j) / k_h_inv * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - conc_o2_rel = conc_o2(c,j) / (h2osoi_vol_min + porevol/k_h_cc) - else - conc_ch4_rel = conc_ch4(c,j) / watsat(c,j) - conc_o2_rel = conc_o2(c,j) / watsat(c,j) - endif - - oxid_a = vmax_eff * h2osoi_vol_min* conc_ch4_rel / (k_m_eff + conc_ch4_rel) & - ![mol/m3-t/s] [mol/m3-w/s] [m3-w/m3-t] [mol/m3-w] [mol/m3-w] [mol/m3-w] - * conc_o2_rel / (k_m_o2 + conc_o2_rel) & - * q10_ch4oxid ** ((t_soisno(c,j) - t0) / 10._r8) * smp_fact - - ! For all landunits / levels, prevent oxidation if at or below freezing - if (t_soisno(c,j) <= tfrz) oxid_a = 0._r8 - - ch4_oxid_depth(c,j) = oxid_a - o2_oxid_depth(c,j) = ch4_oxid_depth(c,j) * 2._r8 - - end do - end do - - end associate - end subroutine ch4_oxid - - !----------------------------------------------------------------------- - subroutine ch4_aere (bounds, num_methc, filter_methc, num_methp, filter_methp, & - annsum_npp, jwt, sat, lake, & - canopystate_inst, soilstate_inst, temperature_inst, energyflux_inst, & - waterstate_inst, waterflux_inst, ch4_inst) - ! - ! !DESCRIPTION: - ! Arctic c3 grass (which is often present in fens) and all vegetation in inundated areas is assumed to have - ! some root porosity. Currently, root porosity is allowed to be different for grasses & non-grasses. - ! CH4 diffuses out and O2 diffuses into the soil. CH4 is also lossed via transpiration, which is both - ! included in the "aere" variables and output separately. In practice this value is small. - ! By default upland veg. has small 5% porosity but this can be switched to be equal to inundated porosity. - - ! !USES: - use clm_varcon , only : rpi - use clm_time_manager , only : get_step_size - use pftconMod , only : nc3_arctic_grass, nc3_nonarctic_grass, nc4_grass, noveg, pftcon - use ch4varcon , only : transpirationloss, use_aereoxid_prog - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of column soil points in column filter - integer , intent(in) :: filter_methc(:) ! column filter for soil points - integer , intent(in) :: num_methp ! number of soil points in patch filter - integer , intent(in) :: filter_methp(:) ! patch filter for soil points - real(r8) , intent(in) :: annsum_npp( bounds%begp: ) ! annual sum NPP (gC/m2/yr) - integer , intent(in) :: jwt( bounds%begc: ) ! index of the soil layer right above the water table (-) [col] - integer , intent(in) :: sat ! 0 = unsaturated; 1 = saturated - logical , intent(in) :: lake ! function called with lake filter - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,g,j ! indices - integer :: fc,fp ! soil filter column index - integer :: itype ! temporary - real(r8) :: f_oxid ! fraction of CH4 oxidized in oxic zone around roots - real(r8) :: diffus_aere ! gas diffusivity through aerenchyma (m^2/s) - real(r8) :: m_tiller - real(r8) :: n_tiller - real(r8) :: poros_tiller - real(r8) :: rob ! root obliquity, e.g. csc of root angle relative to vertical - ! (ratio of root total length to depth) - real(r8) :: area_tiller ! cross-sectional area of tillers (m^2/m^2) - real(r8) :: tranloss ! loss due to transpiration (mol / m3 /s) - real(r8) :: aere, aeretran, oxaere ! (mol / m3 /s) - real(r8) :: k_h_cc, k_h_inv, dtime, oxdiffus, anpp, nppratio, h2osoi_vol_min, conc_ch4_wat - real(r8) :: aerecond ! aerenchyma conductance (m/s) - ! ch4 aerenchyma parameters - real(r8) :: aereoxid ! fraction of methane flux entering aerenchyma rhizosphere - real(r8) :: scale_factor_aere ! scale factor on the aerenchyma area for sensitivity tests - real(r8) :: nongrassporosratio ! Ratio of root porosity in non-grass to grass, used for aerenchyma transport - real(r8) :: unsat_aere_ratio ! Ratio to multiply upland vegetation aerenchyma porosity by compared to inundated systems (= 0.05_r8 / 0.3_r8) - real(r8) :: porosmin ! minimum aerenchyma porosity (unitless)(= 0.05_r8) - - real(r8), parameter :: smallnumber = 1.e-12_r8 - - real(r8), pointer :: ch4_aere_depth(:,:) - real(r8), pointer :: ch4_tran_depth(:,:) - real(r8), pointer :: o2_aere_depth(:,:) - real(r8), pointer :: co2_aere_depth(:,:) - real(r8), pointer :: ch4_oxid_depth(:,:) - real(r8), pointer :: ch4_prod_depth(:,:) - real(r8), pointer :: conc_o2(:,:) - real(r8), pointer :: conc_ch4(:,:) - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(annsum_npp) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(jwt) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevsoi) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevsoi) - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] weight (relative to column) - - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevsoi) - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - rootr => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] effective fraction of roots in each soil layer (nlevgrnd) - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer (nlevsoi) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - - canopy_cond => energyflux_inst%canopy_cond_patch , & ! Input: [real(r8) (:) ] tracer conductance for canopy [m/s] - - annavg_agnpp => ch4_inst%annavg_agnpp_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) annual average aboveground NPP - annavg_bgnpp => ch4_inst%annavg_bgnpp_patch , & ! Input: [real(r8) (:) ] (gC/m2/s) annual average belowground NPP - grnd_ch4_cond => ch4_inst%grnd_ch4_cond_patch , & ! Input: [real(r8) (:) ] tracer conductance for boundary layer [m/s] - c_atm => ch4_inst%c_atm_grc & ! Input: [real(r8) (: ,:) ] CH4, O2, CO2 atmospheric conc (mol/m3) - ) - - if (sat == 0) then ! unsaturated - ch4_aere_depth => ch4_inst%ch4_aere_depth_unsat_col ! Output: [real(r8) (:,:)] CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4_tran_depth => ch4_inst%ch4_tran_depth_unsat_col ! Output: [real(r8) (:,:)] CH4 loss rate via transpiration in each soil layer (mol/m3/s) (nlevsoi) - o2_aere_depth => ch4_inst%o2_aere_depth_unsat_col ! Output: [real(r8) (:,:)] O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - co2_aere_depth => ch4_inst%co2_aere_depth_unsat_col ! Output: [real(r8) (:,:)] CO2 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - conc_ch4 => ch4_inst%conc_ch4_unsat_col ! Input: [real(r8) (:,:)] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2 => ch4_inst%conc_o2_unsat_col ! Input: [real(r8) (:,:)] O2 conc in each soil layer (mol/m3) (nlevsoi) - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_unsat_col ! Input: [real(r8) (:,:)] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_prod_depth => ch4_inst%ch4_prod_depth_unsat_col ! Input: [real(r8) (:,:)] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - else ! saturated - ch4_aere_depth => ch4_inst%ch4_aere_depth_sat_col ! Output: [real(r8) (:,:)] CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4_tran_depth => ch4_inst%ch4_tran_depth_sat_col ! Output: [real(r8) (:,:)] CH4 loss rate via transpiration in each soil layer (mol/m3/s) (nlevsoi) - o2_aere_depth => ch4_inst%o2_aere_depth_sat_col ! Output: [real(r8) (:,:)] O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - co2_aere_depth => ch4_inst%co2_aere_depth_sat_col ! Output: [real(r8) (:,:)] CO2 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - conc_ch4 => ch4_inst%conc_ch4_sat_col ! Input: [real(r8) (:,:)] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2 => ch4_inst%conc_o2_sat_col ! Input: [real(r8) (:,:)] O2 conc in each soil layer (mol/m3) (nlevsoi) - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_sat_col ! Input: [real(r8) (:,:)] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_prod_depth => ch4_inst%ch4_prod_depth_sat_col ! Input: [real(r8) (:,:)] production of CH4 in each soil layer (nlevsoi) (mol/m3/s) - endif - - dtime = get_step_size() - - ! Set aerenchyma parameters - aereoxid = params_inst%aereoxid - scale_factor_aere = params_inst%scale_factor_aere - nongrassporosratio = params_inst%nongrassporosratio - unsat_aere_ratio = params_inst%unsat_aere_ratio - porosmin = params_inst%porosmin - rob = params_inst%rob - - ! Initialize ch4_aere_depth - do j=1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - ch4_aere_depth(c,j) = 0._r8 - ch4_tran_depth(c,j) = 0._r8 - o2_aere_depth(c,j) = 0._r8 - end do - end do - - diffus_aere = d_con_g(1,1)*1.e-4_r8 ! for CH4: m^2/s - ! This parameter is poorly constrained and should be done on a patch-specific basis... - - ! point loop to partition aerenchyma flux into each soil layer - if (.not. lake) then - do j=1,nlevsoi - do fp = 1, num_methp - p = filter_methp (fp) - c = patch%column(p) - g = col%gridcell(c) - - ! Calculate transpiration loss - if (transpirationloss .and. patch%itype(p) /= noveg) then !allow tloss above WT ! .and. j > jwt(c)) then - ! Calculate water concentration - h2osoi_vol_min = min(watsat(c,j), h2osoi_vol(c,j)) - k_h_inv = exp(-c_h_inv(1) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(1))) - k_h_cc = t_soisno(c,j) / k_h_inv * rgasLatm - conc_ch4_wat = conc_ch4(c,j) / ( (watsat(c,j)-h2osoi_vol_min)/k_h_cc + h2osoi_vol_min) - - tranloss = conc_ch4_wat * rootr(p,j)*qflx_tran_veg(p) / dz(c,j) / 1000._r8 - ! mol/m3/s mol/m3 mm / s m mm/m - ! Use rootr here for effective per-layer transpiration, which may not be the same as rootfr - tranloss = max(tranloss, 0._r8) ! in case transpiration is pathological - else - tranloss = 0._r8 - end if - - ! Calculate aerenchyma diffusion - if (j > jwt(c) .and. t_soisno(c,j) > tfrz .and. patch%itype(p) /= noveg) then - ! Attn EK: This calculation of aerenchyma properties is very uncertain. Let's check in once all - ! the new components are in; if there is any tuning to be done to get a realistic global flux, - ! this would probably be the place. We will have to document clearly in the Tech Note - ! any major changes from the Riley et al. 2011 version. (There are a few other minor ones.) - - anpp = annsum_npp(p) ! g C / m^2/yr - anpp = max(anpp, 0._r8) ! NPP can be negative b/c of consumption of storage pools - - if (annavg_agnpp(p) /= spval .and. annavg_bgnpp(p) /= spval .and. & - annavg_agnpp(p) > 0._r8 .and. annavg_bgnpp(p) > 0._r8) then - nppratio = annavg_bgnpp(p) / (annavg_agnpp(p) + annavg_bgnpp(p)) - else - nppratio = 0.5_r8 - end if - - ! Estimate area of tillers (see Wania thesis) - ! m_tiller = anpp * r_leaf_root * lai ! (4.17 Wania) - ! m_tiller = 600._r8 * 0.5_r8 * 2._r8 ! used to be 300 - ! Note: this calculation is based on Arctic graminoids, and should be refined for woody plants, if not - ! done on a patch-specific basis. - - m_tiller = anpp * nppratio * 4._r8 !replace the elai(p) by constant 4 (by Xiyan Xu, 05/2016) - - n_tiller = m_tiller / 0.22_r8 - - itype = patch%itype(p) - if (itype == nc3_arctic_grass .or. pftcon%crop(itype) == 1 .or. & - itype == nc3_nonarctic_grass .or. itype == nc4_grass) then - poros_tiller = 0.3_r8 ! Colmer 2003 - else - poros_tiller = 0.3_r8 * nongrassporosratio - end if - - if (sat == 0) then - poros_tiller = poros_tiller * unsat_aere_ratio - end if - - poros_tiller = max(poros_tiller, porosmin) - - area_tiller = scale_factor_aere * n_tiller * poros_tiller * rpi * 2.9e-3_r8**2._r8 ! (m2/m2) - - k_h_inv = exp(-c_h_inv(1) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(1))) ! (4.12) Wania (L atm/mol) - k_h_cc = t_soisno(c,j) / k_h_inv * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - aerecond = area_tiller * rootfr(p,j) * diffus_aere / (z(c,j)*rob) - ! Add in boundary layer resistance - aerecond = 1._r8 / (1._r8/(aerecond+smallnumber) + 1._r8/(grnd_ch4_cond(p)+smallnumber)) - - aere = aerecond * (conc_ch4(c,j)/watsat(c,j)/k_h_cc - c_atm(g,1)) / dz(c,j) ![mol/m3-total/s] - !ZS: Added watsat & Henry's const. - aere = max(aere, 0._r8) ! prevent backwards diffusion - - ! Do oxygen diffusion into layer - k_h_inv = exp(-c_h_inv(2) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(2))) - k_h_cc = t_soisno(c,j) / k_h_inv * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - oxdiffus = diffus_aere * d_con_g(2,1) / d_con_g(1,1) ! adjust for O2:CH4 molecular diffusion - aerecond = area_tiller * rootfr(p,j) * oxdiffus / (z(c,j)*rob) - aerecond = 1._r8 / (1._r8/(aerecond+smallnumber) + 1._r8/(grnd_ch4_cond(p)+smallnumber)) - oxaere = -aerecond *(conc_o2(c,j)/watsat(c,j)/k_h_cc - c_atm(g,2)) / dz(c,j) ![mol/m3-total/s] - oxaere = max(oxaere, 0._r8) - ! Diffusion in is positive; prevent backwards diffusion - if ( .not. use_aereoxid_prog ) then ! fixed aere oxid proportion; will be done in ch4_tran - oxaere = 0._r8 - end if - else - aere = 0._r8 - oxaere = 0._r8 - end if ! veg type, below water table, & above freezing - - ! Impose limitation based on available methane during timestep - ! By imposing the limitation here, don't allow aerenchyma access to methane from other Patches. - aeretran = min(aere+tranloss, conc_ch4(c,j)/dtime + ch4_prod_depth(c,j)) - ch4_aere_depth (c, j) = ch4_aere_depth(c,j) + aeretran*wtcol(p) ! patch weight in col. - ch4_tran_depth (c, j) = ch4_tran_depth(c,j) + min(tranloss, aeretran)*wtcol(p) - o2_aere_depth (c, j) = o2_aere_depth (c,j) + oxaere*wtcol(p) - end do ! p filter - end do ! over levels - end if ! not lake - - end associate - - end subroutine ch4_aere - - !----------------------------------------------------------------------- - subroutine ch4_ebul (bounds, & - num_methc, filter_methc, & - jwt, sat, lake, & - atm2lnd_inst, temperature_inst, lakestate_inst, soilstate_inst, waterstate_inst, & - ch4_inst) - ! - ! !DESCRIPTION: - ! Bubbling is based on temperature & pressure dependent solubility (k_h_cc), - ! with assumed proportion of bubbles - ! which are CH4, and assumed early nucleation at vgc_max sat (Wania). - ! Bubbles are released to the water table surface in ch4_tran. - - ! !USES: - use clm_time_manager , only : get_step_size - use LakeCon - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of column soil points in column filter - integer , intent(in) :: filter_methc(:) ! column filter for soil points - integer , intent(in) :: jwt( bounds%begc: ) ! index of the soil layer right above the water table (-) [col] - integer , intent(in) :: sat ! 0 = unsaturated; 1 = saturated - logical , intent(in) :: lake ! function called with lake filter - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(temperature_type) , intent(in) :: temperature_inst - type(lakestate_type) , intent(in) :: lakestate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j ! indices - integer :: fc ! soil filter column index - integer :: fp ! soil filter patch index - real(r8) :: dtime ! land model time step (sec) - real(r8) :: vgc ! volumetric CH4 content (m3 CH4/m3 pore air) - real(r8) :: vgc_min ! minimum aqueous CH4 content when ebullition ceases - real(r8) :: k_h_inv ! - real(r8) :: k_h ! - real(r8) :: k_h_cc ! - real(r8) :: pressure! sum atmospheric and hydrostatic pressure - real(r8) :: bubble_f! CH4 content in gas bubbles (Kellner et al. 2006) - real(r8) :: ebul_timescale - real(r8) :: vgc_max ! ratio of saturation pressure triggering ebullition - real(r8), pointer :: ch4_ebul_depth(:,:) ! backwards compatibility - real(r8), pointer :: ch4_ebul_total(:) ! backwards compatibility - real(r8), pointer :: conc_ch4(:,:) ! backwards compatibility - real(r8), pointer :: ch4_aere_depth(:,:) ! backwards compatibility - real(r8), pointer :: ch4_oxid_depth(:,:) ! backwards compatibility - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jwt) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] soil layer depth (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevsoi) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - lakedepth => col%lakedepth , & ! Input: [real(r8) (:) ] column lake depth (m) - - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevsoi) - - lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Input: [real(r8) (:,:) ] mass fraction of lake layer that is frozen - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - frac_h2osfc => waterstate_inst%frac_h2osfc_col & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - ) - - if (sat == 0) then ! unsaturated - ch4_ebul_depth => ch4_inst%ch4_ebul_depth_unsat_col ! Output: [real(r8) (:,:)] CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - ch4_ebul_total => ch4_inst%ch4_ebul_total_unsat_col ! Output: [real(r8) (:)] Total column CH4 ebullition (mol/m2/s) - conc_ch4 => ch4_inst%conc_ch4_unsat_col ! Output: [real(r8) (:,:)] CH4 conc in each soil layer (mol/m3) (nlevsoi) - ch4_aere_depth => ch4_inst%ch4_aere_depth_unsat_col ! Input: [real(r8) (:,:)] CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_unsat_col ! Input: [real(r8) (:,:)] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - else ! saturated - ch4_ebul_depth => ch4_inst%ch4_ebul_depth_sat_col ! Output: [real(r8) (:,:)] CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - ch4_ebul_total => ch4_inst%ch4_ebul_total_sat_col ! Output: [real(r8) (:)] Total column CH4 ebullition (mol/m2/s) - conc_ch4 => ch4_inst%conc_ch4_sat_col ! Output: [real(r8) (:,:)] CH4 conc in each soil layer (mol/m3) (nlevsoi) - ch4_aere_depth => ch4_inst%ch4_aere_depth_sat_col ! Input: [real(r8) (:,:)] CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_sat_col ! Input: [real(r8) (:,:)] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - endif - - ! Get land model time step - dtime = get_step_size() - vgc_max = params_inst%vgc_max - - bubble_f = 0.57_r8 ! CH4 content in gas bubbles (Kellner et al. 2006) - vgc_min = vgc_max - ebul_timescale = dtime ! Allow fast bubbling - - ! column loop to estimate ebullition CH4 flux from each soil layer - do j=1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - if (j > jwt(c) .and. t_soisno(c,j) > tfrz) then ! Ebullition occurs only below the water table - - k_h_inv = exp(-c_h_inv(1) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(1))) ! (4.12 Wania) (atm.L/mol) - k_h = 1._r8 / k_h_inv ! (mol/L.atm) - k_h_cc = t_soisno(c,j) * k_h * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - - if (.not. lake) then - pressure = forc_pbot(c) + denh2o * grav * (z(c,j)-zi(c,jwt(c))) ! (Pa) - if (sat == 1 .and. frac_h2osfc(c) > 0._r8) then ! Add ponding pressure head - pressure = pressure + denh2o * grav * h2osfc(c)/1000._r8/frac_h2osfc(c) - ! mm / mm/m - end if - else - pressure = forc_pbot(c) + denh2o * grav * (z(c,j) + lakedepth(c)) - end if - - ! Compare partial pressure to ambient pressure. - vgc = conc_ch4(c,j) / watsat(c,j) / k_h_cc * rgasm * t_soisno(c,j) / pressure - ! [mol/m3t] [m3w/m3t] [m3g/m3w] [Pa/(mol/m3g)] [Pa] - - if (vgc > vgc_max * bubble_f) then ! If greater than max value, remove amount down to vgc_min - ch4_ebul_depth (c,j) = (vgc - vgc_min * bubble_f) * conc_ch4(c,j) / ebul_timescale - ! [mol/m3t/s] [mol/m3t] [s] - else - ch4_ebul_depth (c,j) = 0._r8 - endif - - else ! above the water table or freezing - ch4_ebul_depth (c,j) = 0._r8 - endif ! below the water table and not freezing - - ! Prevent ebullition from reaching the surface for frozen lakes - if (lake .and. lake_icefrac(c,1) > 0.1_r8) ch4_ebul_depth(c,j) = 0._r8 - - end do ! fc - end do ! j - - end associate - - end subroutine ch4_ebul - - !----------------------------------------------------------------------- - subroutine ch4_tran (bounds, & - num_methc, filter_methc, & - jwt, dtime_ch4, sat, lake, & - soilstate_inst, temperature_inst, waterstate_inst, energyflux_inst, ch4_inst) - ! - ! !DESCRIPTION: - ! Solves the reaction & diffusion equation for the timestep. First "competition" between processes for - ! CH4 & O2 demand is done. Then concentrations are apportioned into gas & liquid fractions; only the gas - ! fraction is considered for diffusion in unsat. Snow and lake water resistance to diffusion is added as - ! a bulk term in the ground conductance (which is really a surface layer conductance), but concentrations - ! are not tracked and oxidation is not allowed inside snow and lake water. - ! Diffusivity is set based on soil texture and organic matter fraction. A Crank-Nicholson solution is used. - ! Then CH4 diffusive flux is calculated and consistency is checked. - - ! !USES: - use clm_time_manager , only : get_step_size, get_nstep - use TridiagonalMod , only : Tridiagonal - use ch4varcon , only : ch4frzout, use_aereoxid_prog - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of column soil points in column filter - integer , intent(in) :: filter_methc(:) ! column filter for soil points - integer , intent(in) :: jwt( bounds%begc: ) ! index of the soil layer right above the water table (-) [col] - integer , intent(in) :: sat ! 0 = unsaturated; 1 = saturated - logical , intent(in) :: lake ! function called with lake filter - real(r8) , intent(in) :: dtime_ch4 ! time step for ch4 calculations - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,g,p,s,i,ll ! indices - integer :: fc ! soil filter column index - integer :: fp ! soil filter patch index - integer :: jtop(bounds%begc:bounds%endc) ! top level at each column - integer :: iter ! iteration counter when dtime_ch4 < dtime - real(r8) :: dtime ! land model time step (sec) - real(r8) :: at (bounds%begc:bounds%endc,0:nlevsoi) ! "a" vector for tridiagonal matrix - real(r8) :: bt (bounds%begc:bounds%endc,0:nlevsoi) ! "b" vector for tridiagonal matrix - real(r8) :: ct (bounds%begc:bounds%endc,0:nlevsoi) ! "c" vector for tridiagonal matrix - real(r8) :: rt (bounds%begc:bounds%endc,0:nlevsoi) ! "r" vector for tridiagonal solution - real(r8) :: f_a ! air-filled fraction of available pore space - real(r8) :: diffus (bounds%begc:bounds%endc,0:nlevsoi) ! diffusivity (m2/s) - real(r8) :: k_h_inv ! 1/Henry's Law Constant in Latm/mol - real(r8) :: k_h_cc(bounds%begc:bounds%endc,0:nlevsoi,ngases) ! ratio of mol/m3 in liquid to mol/m3 in gas - real(r8) :: dzj ! - real(r8) :: dp1_zp1 (bounds%begc:bounds%endc,0:nlevsoi) ! diffusivity/delta_z for next j - real(r8) :: dm1_zm1 (bounds%begc:bounds%endc,0:nlevsoi) ! diffusivity/delta_z for previous j - real(r8) :: t_soisno_c ! soil temperature (C) (-nlevsno+1:nlevsoi) - real(r8) :: eps ! either epsilon_a or epsilon_w, depending on where in soil, wrt WT - real(r8) :: deficit ! mol CH4 /m^2 that must be subtracted from diffusive flux to atm. to make up - ! for keeping concentrations always above zero - real(r8) :: conc_ch4_bef(bounds%begc:bounds%endc,1:nlevsoi) ! concentration at the beginning of the timestep - real(r8) :: errch4(bounds%begc:bounds%endc) ! Error (Mol CH4 /m^2) [+ = too much CH4] - real(r8) :: conc_ch4_rel(bounds%begc:bounds%endc,0:nlevsoi) ! Concentration per volume of air or water - real(r8) :: conc_o2_rel(bounds%begc:bounds%endc,0:nlevsoi) ! Concentration per volume of air or water - real(r8) :: conc_ch4_rel_old(bounds%begc:bounds%endc,0:nlevsoi) ! Concentration during last Crank-Nich. loop - real(r8) :: h2osoi_vol_min(bounds%begc:bounds%endc,1:nlevsoi) ! h2osoi_vol restricted to be <= watsat - real(r8), parameter :: smallnumber = 1.e-12_r8 - real(r8) :: snowdiff ! snow diffusivity (m^2/s) - real(r8) :: snowres(bounds%begc:bounds%endc) ! Cumulative Snow resistance (s/m). Also includes - real(r8) :: pondres ! Additional resistance from ponding, up to pondmx water on top of top soil layer (s/m) - real(r8) :: pondz ! Depth of ponding (m) - real(r8) :: ponddiff ! Pondwater diffusivity (m^2/s) - real(r8) :: spec_grnd_cond(bounds%begc:bounds%endc,1:ngases) ! species grnd conductance (s/m) - real(r8) :: airfrac ! air fraction in snow - real(r8) :: waterfrac ! water fraction in snow - real(r8) :: icefrac ! ice fraction in snow - real(r8) :: epsilon_t (bounds%begc:bounds%endc,1:nlevsoi,1:ngases) ! - real(r8) :: epsilon_t_old (bounds%begc:bounds%endc,1:nlevsoi,1:ngases) ! epsilon_t from last time step !Currently deprecated - real(r8) :: source (bounds%begc:bounds%endc,1:nlevsoi,1:ngases) ! source - real(r8) :: source_old (bounds%begc:bounds%endc,1:nlevsoi,1:ngases) ! source from last time step !Currently deprecated - real(r8) :: om_frac ! organic matter fraction - real(r8) :: o2demand, ch4demand ! mol/m^3/s - real(r8) :: liqfrac(bounds%begc:bounds%endc, 1:nlevsoi) - real(r8) :: capthick ! (mm) min thickness before assuming h2osfc is impermeable - real(r8) :: satpow ! exponent on watsat for saturated soil solute diffusion - real(r8) :: scale_factor_gasdiff ! For sensitivity tests; convection would allow this to be > 1 - real(r8) :: scale_factor_liqdiff ! For sensitivity tests; convection would allow this to be > 1 - real(r8) :: organic_max ! organic matter content (kg/m3) where soil is assumed to act like peat - real(r8) :: aereoxid ! fraction of methane flux entering aerenchyma rhizosphere - - real(r8), pointer :: ch4_prod_depth (:,:) - real(r8), pointer :: ch4_oxid_depth (:,:) - real(r8), pointer :: ch4_aere_depth (:,:) - real(r8), pointer :: ch4_surf_aere (:) - real(r8), pointer :: ch4_ebul_depth (:,:) - real(r8), pointer :: ch4_ebul_total (:) - real(r8), pointer :: ch4_surf_ebul (:) - real(r8), pointer :: ch4_surf_diff (:) - real(r8), pointer :: o2_oxid_depth (:,:) - real(r8), pointer :: o2_decomp_depth (:,:) - real(r8), pointer :: o2_aere_depth (:,:) - real(r8), pointer :: o2stress (:,:) - real(r8), pointer :: ch4stress (:,:) - real(r8), pointer :: co2_decomp_depth (:,:) - real(r8), pointer :: conc_o2 (:,:) - real(r8), pointer :: conc_ch4 (:,:) - - integer :: nstep ! time step number - character(len=32) :: subname='ch4_tran' ! subroutine name - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(jwt) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] soil layer depth (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevsoi) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - snl => col%snl , & ! Input: [integer (:) ] negative of number of snow layers - - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" (nlevgrnd) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - cellorg => soilstate_inst%cellorg_col , & ! Input: [real(r8) (:,:) ] column 3D org (kg/m^3 organic matter) (nlevgrnd) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevsoi) - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) [for snow & soil layers] - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) [for snow & soil layers] - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - - c_atm => ch4_inst%c_atm_grc , & ! Input: [real(r8) (:,:) ] CH4, O2, CO2 atmospheric conc (mol/m3) - - grnd_ch4_cond => ch4_inst%grnd_ch4_cond_col & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] - ) - - if (sat == 0) then ! unsaturated - o2_decomp_depth => ch4_inst%o2_decomp_depth_unsat_col ! Output: [real(r8) (:,:) ] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - o2stress => ch4_inst%o2stress_unsat_col ! Output: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_unsat_col ! Output: [real(r8) (:,:) ] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_prod_depth => ch4_inst%ch4_prod_depth_unsat_col ! Output: [real(r8) (:,:) ] CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - ch4_aere_depth => ch4_inst%ch4_aere_depth_unsat_col ! Output: [real(r8) (:,:) ] CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4_surf_aere => ch4_inst%ch4_surf_aere_unsat_col ! Output: [real(r8) (:) ] Total column CH4 aerenchyma (mol/m2/s) - ch4_ebul_depth => ch4_inst%ch4_ebul_depth_unsat_col ! Output: [real(r8) (:,:) ] CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - ch4_ebul_total => ch4_inst%ch4_ebul_total_unsat_col ! Output: [real(r8) (:) ] Total column CH4 ebullition (mol/m2/s) - ch4_surf_ebul => ch4_inst%ch4_surf_ebul_unsat_col ! Output: [real(r8) (:) ] CH4 ebullition to atmosphere (mol/m2/s) - ch4_surf_diff => ch4_inst%ch4_surf_diff_unsat_col ! Output: [real(r8) (:) ] CH4 surface flux (mol/m2/s) - o2_oxid_depth => ch4_inst%o2_oxid_depth_unsat_col ! Output: [real(r8) (:,:) ] O2 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - o2_aere_depth => ch4_inst%o2_aere_depth_unsat_col ! Output: [real(r8) (:,:) ] O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4stress => ch4_inst%ch4stress_unsat_col ! Output: [real(r8) (:,:) ] Ratio of methane available to the total per-timestep methane sinks (nlevsoi) - co2_decomp_depth => ch4_inst%co2_decomp_depth_unsat_col ! Output: [real(r8) (:,:) ] CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - conc_ch4 => ch4_inst%conc_ch4_unsat_col ! Output: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2 => ch4_inst%conc_o2_unsat_col ! Output: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - else ! saturated - o2_decomp_depth => ch4_inst%o2_decomp_depth_sat_col ! Output: [real(r8) (:,:) ] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - o2stress => ch4_inst%o2stress_sat_col ! Output: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - ch4_oxid_depth => ch4_inst%ch4_oxid_depth_sat_col ! Output: [real(r8) (:,:) ] CH4 consumption rate via oxidation in each soil layer (mol/m3/s) (nlevsoi) - ch4_prod_depth => ch4_inst%ch4_prod_depth_sat_col ! Output: [real(r8) (:,:) ] CH4 production rate from methanotrophs (mol/m3/s) (nlevsoi) - ch4_aere_depth => ch4_inst%ch4_aere_depth_sat_col ! Output: [real(r8) (:,:) ] CH4 loss rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4_surf_aere => ch4_inst%ch4_surf_aere_sat_col ! Output: [real(r8) (:) ] Total column CH4 aerenchyma (mol/m2/s) - ch4_ebul_depth => ch4_inst%ch4_ebul_depth_sat_col ! Output: [real(r8) (:,:) ] CH4 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - ch4_ebul_total => ch4_inst%ch4_ebul_total_sat_col ! Output: [real(r8) (:) ] Total column CH4 ebullition (mol/m2/s) - ch4_surf_ebul => ch4_inst%ch4_surf_ebul_sat_col ! Output: [real(r8) (:) ] CH4 ebullition to atmosphere (mol/m2/s) - ch4_surf_diff => ch4_inst%ch4_surf_diff_sat_col ! Output: [real(r8) (:) ] CH4 surface flux (mol/m2/s) - o2_oxid_depth => ch4_inst%o2_oxid_depth_sat_col ! Output: [real(r8) (:,:) ] O2 loss rate via ebullition in each soil layer (mol/m3/s) (nlevsoi) - o2_aere_depth => ch4_inst%o2_aere_depth_sat_col ! Output: [real(r8) (:,:) ] O2 gain rate via aerenchyma in each soil layer (mol/m3/s) (nlevsoi) - ch4stress => ch4_inst%ch4stress_sat_col ! Output: [real(r8) (:,:) ] Ratio of methane available to the total per-timestep methane sinks (nlevsoi) - co2_decomp_depth => ch4_inst%co2_decomp_depth_sat_col ! Output: [real(r8) (:,:) ] CO2 production during decomposition in each soil layer (nlevsoi) (mol/m3/s) - conc_ch4 => ch4_inst%conc_ch4_sat_col ! Output: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_o2 => ch4_inst%conc_o2_sat_col ! Output: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - endif - - ! Get land model time step - dtime = get_step_size() - nstep = get_nstep() - - ! Set transport parameters - satpow = params_inst%satpow - scale_factor_gasdiff = params_inst%scale_factor_gasdiff - scale_factor_liqdiff = params_inst%scale_factor_liqdiff - capthick = params_inst%capthick - aereoxid = params_inst%aereoxid - - ! Set shared constant - organic_max = CNParamsShareInst%organic_max - - ! Perform competition for oxygen and methane in each soil layer if demands over the course of the timestep - ! exceed that available. Assign to each process in proportion to the quantity demanded in the absense of - ! the limitation. - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - o2demand = o2_decomp_depth(c,j) + o2_oxid_depth(c,j) ! o2_decomp_depth includes autotrophic root respiration - if (o2demand > 0._r8) then - if ( (conc_o2(c,j) / dtime + o2_aere_depth(c,j)) > o2demand )then - o2stress(c,j) = 1._r8 - else - o2stress(c,j) = (conc_o2(c,j) / dtime + o2_aere_depth(c,j)) / o2demand - end if - else - o2stress(c,j) = 1._r8 - end if - - ch4demand = ch4_oxid_depth(c,j) + ch4_aere_depth(c,j) + ch4_ebul_depth(c,j) - if (ch4demand > 0._r8) then - ch4stress(c,j) = min((conc_ch4(c,j) / dtime + ch4_prod_depth(c,j)) / ch4demand, 1._r8) - else - ch4stress(c,j) = 1._r8 - end if - - ! Resolve methane oxidation - if (o2stress(c,j) < 1._r8 .or. ch4stress(c,j) < 1._r8) then - if (ch4stress(c,j) <= o2stress(c,j)) then ! methane limited - if (o2stress(c,j) < 1._r8) then - ! Recalculate oxygen limitation - o2demand = o2_decomp_depth(c,j) - if (o2demand > 0._r8) then - o2stress(c,j) = min( (conc_o2(c,j) / dtime + o2_aere_depth(c,j) - ch4stress(c,j)*o2_oxid_depth(c,j) ) & - / o2demand, 1._r8) - else - o2stress(c,j) = 1._r8 - end if - end if - ! Reset oxidation - ch4_oxid_depth(c,j) = ch4_oxid_depth(c,j) * ch4stress(c,j) - o2_oxid_depth(c,j) = o2_oxid_depth(c,j) * ch4stress(c,j) - else ! oxygen limited - if (ch4stress(c,j) < 1._r8) then - ! Recalculate methane limitation - ch4demand = ch4_aere_depth(c,j) + ch4_ebul_depth(c,j) - if (ch4demand > 0._r8) then - ch4stress(c,j) = min( (conc_ch4(c,j) / dtime + ch4_prod_depth(c,j) - & - o2stress(c,j)*ch4_oxid_depth(c,j)) / ch4demand, 1._r8) - else - ch4stress(c,j) = 1._r8 - end if - end if - ! Reset oxidation - ch4_oxid_depth(c,j) = ch4_oxid_depth(c,j) * o2stress(c,j) - o2_oxid_depth(c,j) = o2_oxid_depth(c,j) * o2stress(c,j) - end if - end if - - ! Reset non-methanotroph demands - ch4_aere_depth(c,j) = ch4_aere_depth(c,j) * ch4stress(c,j) - ch4_ebul_depth(c,j) = ch4_ebul_depth(c,j) * ch4stress(c,j) - o2_decomp_depth(c,j) = o2_decomp_depth(c,j) * o2stress(c,j) - - end do !c - end do !j - - - ! Accumulate ebullition to place in first layer above water table, or directly to atmosphere - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - if (j == 1) ch4_ebul_total(c) = 0._r8 - ch4_ebul_total(c) = ch4_ebul_total(c) + ch4_ebul_depth(c,j) * dz(c,j) - enddo - enddo - - - ! Set the Henry's Law coefficients - do j = 0,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - do s=1,2 - if (j == 0) then - k_h_inv = exp(-c_h_inv(s) * (1._r8 / t_grnd(c) - 1._r8 / kh_tbase) + log (kh_theta(s))) - ! (4.12) Wania (L atm/mol) - k_h_cc(c,j,s) = t_grnd(c) / k_h_inv * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - else - k_h_inv = exp(-c_h_inv(s) * (1._r8 / t_soisno(c,j) - 1._r8 / kh_tbase) + log (kh_theta(s))) - ! (4.12) Wania (L atm/mol) - k_h_cc(c,j,s) = t_soisno(c,j) / k_h_inv * rgasLatm ! (4.21) Wania [(mol/m3w) / (mol/m3g)] - end if - end do - end do - end do - - - ! Set the source term for each species (no need to do j=0, since epsilon_t and source not used there) - ! Note that because of the semi-implicit diffusion and the 30 min timestep combined with explicit - ! sources, occasionally negative concentration will result. In this case it is brought to zero and the - ! surface flux is adjusted to conserve. This results in some inaccuracy as compared to a shorter timestep - ! or iterative solution. - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - if ( .not. use_aereoxid_prog ) then - ! First remove the CH4 oxidation that occurs at the base of root tissues (aere), and add to oxidation - ch4_oxid_depth(c,j) = ch4_oxid_depth(c,j) + aereoxid * ch4_aere_depth(c,j) - ch4_aere_depth(c,j) = ch4_aere_depth(c,j) - aereoxid * ch4_aere_depth(c,j) - end if ! else oxygen is allowed to diffuse in via aerenchyma - - source(c,j,1) = ch4_prod_depth(c,j) - ch4_oxid_depth(c,j) - & - ch4_aere_depth(c,j) - ch4_ebul_depth(c,j) ! [mol/m3-total/s] - ! aerenchyma added to surface flux below - ! ebul added to soil depth just above WT - if (source(c,j,1) + conc_ch4(c,j) / dtime < -1.e-12_r8) then - write(iulog,*) 'Methane demands exceed methane available. Error in methane competition (mol/m^3/s), c,j:', & - source(c,j,1) + conc_ch4(c,j) / dtime, c, j - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - call endrun(msg=' ERROR: Methane demands exceed methane available.'& - //errMsg(sourcefile, __LINE__)) - else if (ch4stress(c,j) < 1._r8 .and. source(c,j,1) + conc_ch4(c,j) / dtime > 1.e-12_r8) then - write(iulog,*) 'Methane limited, yet some left over. Error in methane competition (mol/m^3/s), c,j:', & - source(c,j,1) + conc_ch4(c,j) / dtime, c, j - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - call endrun(msg=' ERROR: Methane limited, yet some left over.'//& - errMsg(sourcefile, __LINE__)) - end if - - source(c,j,2) = -o2_oxid_depth(c,j) - o2_decomp_depth(c,j) + o2_aere_depth(c,j) ! O2 [mol/m3/s] - if (source(c,j,2) + conc_o2(c,j) / dtime < -1.e-12_r8) then - write(iulog,*) 'Oxygen demands exceed oxygen available. Error in oxygen competition (mol/m^3/s), c,j:', & - source(c,j,2) + conc_o2(c,j) / dtime, c, j - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - call endrun(msg=' ERROR: Oxygen demands exceed oxygen available.'//& - errMsg(sourcefile, __LINE__) ) - else if (o2stress(c,j) < 1._r8 .and. source(c,j,2) + conc_o2(c,j) / dtime > 1.e-12_r8) then - write(iulog,*) 'Oxygen limited, yet some left over. Error in oxygen competition (mol/m^3/s), c,j:', & - source(c,j,2) + conc_o2(c,j) / dtime, c, j - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - call endrun(msg=' ERROR: Oxygen limited, yet some left over.'//errMsg(sourcefile, __LINE__)) - end if - - conc_ch4_bef(c,j) = conc_ch4(c,j) !For Balance Check - enddo ! fc - enddo ! j - - ! Accumulate aerenchyma to add directly to atmospheric flux - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - if (j==1) ch4_surf_aere(c) = 0._r8 - ch4_surf_aere(c) = ch4_surf_aere(c) + ch4_aere_depth(c,j) * dz(c,j) - enddo - enddo - - ! Add in ebullition to source at depth just above WT - do fc = 1, num_methc - c = filter_methc(fc) - if (jwt(c) /= 0) then - source(c,jwt(c),1) = source(c,jwt(c),1) + ch4_ebul_total(c)/dz(c,jwt(c)) - endif - enddo ! fc - - ! Calculate concentration relative to m^3 of air or water: needed for the diffusion - do j = 0,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - g = col%gridcell(c) - - if (j == 0) then - conc_ch4_rel(c,j) = c_atm(g,1) - conc_o2_rel(c,j) = c_atm(g,2) - else - h2osoi_vol_min(c,j) = min(watsat(c,j), h2osoi_vol(c,j)) - if (ch4frzout) then - liqfrac(c,j) = max(0.05_r8, (h2osoi_liq(c,j)/denh2o+smallnumber)/ & - (h2osoi_liq(c,j)/denh2o+h2osoi_ice(c,j)/denice+smallnumber)) - else - liqfrac(c,j) = 1._r8 - end if - if (j <= jwt(c)) then ! Above the WT - do s=1,2 - epsilon_t(c,j,s) = watsat(c,j)- (1._r8-k_h_cc(c,j,s))*h2osoi_vol_min(c,j)*liqfrac(c,j) - end do - ! Partition between the liquid and gas phases. The gas phase will drive the diffusion. - else ! Below the WT - do s=1,2 - epsilon_t(c,j,s) = watsat(c,j)*liqfrac(c,j) - end do - end if - conc_ch4_rel(c,j) = conc_ch4(c,j)/epsilon_t(c,j,1) - conc_o2_rel(c,j) = conc_o2(c,j) /epsilon_t(c,j,2) - end if - end do - end do - - - ! Loop over species - do s = 1, 2 ! 1=CH4; 2=O2; 3=CO2 - - - ! Adjust the grnd_ch4_cond to keep it positive, and add the snow resistance & pond resistance - do j = -nlevsno + 1,0 - do fc = 1, num_methc - c = filter_methc (fc) - - if (j == -nlevsno + 1) then - if (grnd_ch4_cond(c) < smallnumber .and. s==1) grnd_ch4_cond(c) = smallnumber - ! Needed to prevent overflow when ground is frozen, e.g. for lakes - snowres(c) = 0._r8 - end if - - ! Add snow resistance - if (j >= snl(c) + 1) then - t_soisno_c = t_soisno(c,j) - tfrz - icefrac = h2osoi_ice(c,j)/denice/dz(c,j) - waterfrac = h2osoi_liq(c,j)/denh2o/dz(c,j) - airfrac = max(1._r8 - icefrac - waterfrac, 0._r8) - ! Calculate snow diffusivity - if (airfrac > 0.05_r8) then - f_a = airfrac / (airfrac + waterfrac) - eps = airfrac ! Air-filled fraction of total snow volume - ! Use Millington-Quirk Expression, as hydraulic properties (bsw) not available - snowdiff = (d_con_g(s,1) + d_con_g(s,2)*t_soisno_c) * 1.e-4_r8 * & - f_a**(10._r8/3._r8) / (airfrac+waterfrac)**2 & - * scale_factor_gasdiff - else !solute diffusion in water only - eps = waterfrac ! Water-filled fraction of total soil volume - snowdiff = eps**satpow * (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & - * scale_factor_liqdiff - end if - snowdiff = max(snowdiff, smallnumber) - snowres(c) = snowres(c) + dz(c,j)/snowdiff - end if - - if (j == 0) then ! final loop - ! Add pond resistance - pondres = 0._r8 - - ! First old pond formulation up to pondmx - if (.not. lake .and. snl(c) == 0 .and. h2osoi_vol(c,1) > watsat(c,1)) then - t_soisno_c = t_soisno(c,1) - tfrz - if (t_soisno(c,1) <= tfrz) then - ponddiff = (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & - * (h2osoi_liq(c,1)/denh2o+smallnumber)/ & - (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice+smallnumber) & - * scale_factor_liqdiff - else ! Unfrozen - ponddiff = (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & - * scale_factor_liqdiff - end if - pondz = dz(c,1) * (h2osoi_vol(c,1) - watsat(c,1)) - pondres = pondz / ponddiff - end if - - ! Now add new h2osfc form - if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8 .and. t_h2osfc(c) >= tfrz) then - t_soisno_c = t_h2osfc(c) - tfrz - ponddiff = (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & - * scale_factor_liqdiff - pondz = h2osfc(c) / 1000._r8 / frac_h2osfc(c) ! Assume all h2osfc corresponds to sat area - ! mm / mm/m - pondres = pondres + pondz / ponddiff - else if (.not. lake .and. sat == 1 .and. frac_h2osfc(c) > 0._r8 .and. & - h2osfc(c)/frac_h2osfc(c) > capthick) then ! Assuming short-circuit logic will avoid FPE here. - ! assume surface ice is impermeable - pondres = 1/smallnumber - end if - - spec_grnd_cond(c,s) = 1._r8/(1._r8/grnd_ch4_cond(c) + snowres(c) + pondres) - end if - - end do ! fc - end do ! j - - ! Determine gas diffusion and fraction of open pore (f_a) - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - g = col%gridcell(c) - - t_soisno_c = t_soisno(c,j) - tfrz - - if (j <= jwt(c)) then ! Above the WT - f_a = 1._r8 - h2osoi_vol_min(c,j) / watsat(c,j) - ! Provisionally calculate diffusivity as linear combination of the Millington-Quirk - ! expression in Wania (for peat) & Moldrup (for mineral soil) - eps = watsat(c,j)-h2osoi_vol_min(c,j) ! Air-filled fraction of total soil volume - if (organic_max > 0._r8) then - om_frac = min(cellorg(c,j)/organic_max, 1._r8) - ! Use first power, not square as in iniTimeConst - else - om_frac = 1._r8 - end if - diffus (c,j) = (d_con_g(s,1) + d_con_g(s,2)*t_soisno_c) * 1.e-4_r8 * & - (om_frac * f_a**(10._r8/3._r8) / watsat(c,j)**2._r8 + & - (1._r8-om_frac) * eps**2._r8 * f_a**(3._r8 / bsw(c,j)) ) & - * scale_factor_gasdiff - else ! Below the WT use saturated diffusivity and only water in epsilon_t - ! Note the following is not currently corrected for the effect on diffusivity of excess ice in soil under - ! lakes (which is currently experimental only). - eps = watsat(c,j) ! Water-filled fraction of total soil volume - diffus (c,j) = eps**satpow * (d_con_w(s,1) + d_con_w(s,2)*t_soisno_c + d_con_w(s,3)*t_soisno_c**2) * 1.e-9_r8 & - * scale_factor_liqdiff - if (t_soisno(c,j)<=tfrz) then - diffus(c,j) = diffus(c,j)*(h2osoi_liq(c,j)/denh2o+smallnumber)/ & - (h2osoi_liq(c,j)/denh2o+h2osoi_ice(c,j)/denice+smallnumber) - end if - endif ! Above/below the WT - diffus(c,j) = max(diffus(c,j), smallnumber) ! Prevent overflow - - enddo ! fp - enddo ! j - - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - ! Set up coefficients for tridiagonal solver. - if (j == 1 .and. j /= jwt(c) .and. j /= jwt(c)+1) then - dm1_zm1(c,j) = 1._r8/(1._r8/spec_grnd_cond(c,s)+dz(c,j)/(diffus(c,j)*2._r8)) - ! replace Diffusivity / Delta_z by conductance (grnd_ch4_cond) for top layer - dp1_zp1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j+1)/diffus(c,j+1)) - else if (j == 1 .and. j == jwt(c)) then - dm1_zm1(c,j) = 1._r8/(1._r8/spec_grnd_cond(c,s)+dz(c,j)/(diffus(c,j)*2._r8)) - ! layer resistance mult. by k_h_cc for dp1_zp1 term - dp1_zp1(c,j) = 2._r8/(dz(c,j)*k_h_cc(c,j,s)/diffus(c,j)+dz(c,j+1)/diffus(c,j+1)) - else if (j == 1) then ! water table at surface: multiply ground resistance by k_h_cc - dm1_zm1(c,j) = 1._r8/(k_h_cc(c,j-1,s)/spec_grnd_cond(c,s)+dz(c,j)/(diffus(c,j)*2._r8)) - ! air concentration will be mult. by k_h_cc below - dp1_zp1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j+1)/diffus(c,j+1)) - else if (j <= nlevsoi-1 .and. j /= jwt(c) .and. j /= jwt(c)+1) then - dm1_zm1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j-1)/diffus(c,j-1)) - dp1_zp1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j+1)/diffus(c,j+1)) - else if (j <= nlevsoi-1 .and. j == jwt(c)) then ! layer resistance mult. by k_h_cc for dp1_zp1 term - dm1_zm1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j-1)/diffus(c,j-1)) - dp1_zp1(c,j) = 2._r8/(dz(c,j)*k_h_cc(c,j,s)/diffus(c,j)+dz(c,j+1)/diffus(c,j+1)) - ! Concentration in layer will be mult. by k_h_cc below - else if (j <= nlevsoi-1) then ! j==jwt+1: layer above resistance mult. by k_h_cc for dm1_zm1 term - dm1_zm1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j-1)*k_h_cc(c,j-1,s)/diffus(c,j-1)) - ! Concentration in layer above will be mult. by k_h_cc below - dp1_zp1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j+1)/diffus(c,j+1)) - else if (j /= jwt(c)+1) then ! j ==nlevsoi - dm1_zm1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j-1)/diffus(c,j-1)) - else ! jwt == nlevsoi-1: layer above resistance mult. by k_h_cc for dm1_zm1 term - dm1_zm1(c,j) = 2._r8/(dz(c,j)/diffus(c,j)+dz(c,j-1)*k_h_cc(c,j-1,s)/diffus(c,j-1)) - end if - enddo ! fp; patch - end do ! j; nlevsoi - - ! Perform a second loop for the tridiagonal coefficients since need dp1_zp1 and dm1_z1 at each depth - do j = 0,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - g = col%gridcell(c) - - conc_ch4_rel_old(c,j) = conc_ch4_rel(c,j) - - if (j > 0) dzj = dz(c,j) - if (j == 0) then ! top layer (atmosphere) doesn't change regardless of where WT is - at(c,j) = 0._r8 - bt(c,j) = 1._r8 - ct(c,j) = 0._r8 - rt(c,j) = c_atm(g,s) ! 0th level stays at constant atmospheric conc - elseif (j < nlevsoi .and. j == jwt(c)) then ! concentration inside needs to be mult. by k_h_cc for dp1_zp1 term - at(c,j) = -0.5_r8 / dzj * dm1_zm1(c,j) - bt(c,j) = epsilon_t(c,j,s) / dtime_ch4 + 0.5_r8 / dzj * (dp1_zp1(c,j)*k_h_cc(c,j,s) + dm1_zm1(c,j)) - ct(c,j) = -0.5_r8 / dzj * dp1_zp1(c,j) - elseif (j < nlevsoi .and. j == jwt(c)+1) then - ! concentration above needs to be mult. by k_h_cc for dm1_zm1 term - at(c,j) = -0.5_r8 / dzj * dm1_zm1(c,j) * k_h_cc(c,j-1,s) - bt(c,j) = epsilon_t(c,j,s) / dtime_ch4 + 0.5_r8 / dzj * (dp1_zp1(c,j) + dm1_zm1(c,j)) - ct(c,j) = -0.5_r8 / dzj * dp1_zp1(c,j) - elseif (j < nlevsoi) then - at(c,j) = -0.5_r8 / dzj * dm1_zm1(c,j) - bt(c,j) = epsilon_t(c,j,s) / dtime_ch4 + 0.5_r8 / dzj * (dp1_zp1(c,j) + dm1_zm1(c,j)) - ct(c,j) = -0.5_r8 / dzj * dp1_zp1(c,j) - else if (j == nlevsoi .and. j== jwt(c)+1) then - ! concentration above needs to be mult. by k_h_cc for dm1_zm1 term - at(c,j) = -0.5_r8 / dzj * dm1_zm1(c,j) * k_h_cc(c,j-1,s) - bt(c,j) = epsilon_t(c,j,s) / dtime_ch4 + 0.5_r8 / dzj * dm1_zm1(c,j) - ct(c,j) = 0._r8 - else ! j==nlevsoi and jwt 1.e-3_r8 * scale_factor_gasdiff) then - if (deficit > 1.e-2_r8) then - write(iulog,*)'Note: sink > source in ch4_tran, sources are changing '// & - ' quickly relative to diffusion timestep, and/or diffusion is rapid.' - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - write(iulog,*)'This typically occurs when there is a larger than normal '// & - ' diffusive flux.' - write(iulog,*)'If this occurs frequently, consider reducing land model (or '// & - ' methane model) timestep, or reducing the max. sink per timestep in the methane model.' - end if - write(iulog,*) 'Negative conc. in ch4tran. c,j,deficit (mol):',c,j,deficit - end if - conc_ch4_rel(c,j) = 0._r8 - ! Subtract deficit - ch4_surf_diff(c) = ch4_surf_diff(c) - deficit/dtime_ch4 - end if - enddo - enddo - - - elseif (s == 2) then ! O2 - - ! Set rt, since it depends on conc - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - ! For correct balance, deprecate source_old. - source_old(c,j,s) = source(c,j,s) - ! source_old could be removed later - epsilon_t_old(c,j,s) = epsilon_t(c,j,s) - ! epsilon_t acts like source also - dzj = dz(c,j) - if (j < nlevsoi .and. j == jwt(c)) then ! concentration inside needs to be mult. by k_h_cc for dp1_zp1 term - rt(c,j) = epsilon_t_old(c,j,s) / dtime_ch4 * conc_o2_rel(c,j) + & - 0.5_r8 / dzj * (dp1_zp1(c,j) * (conc_o2_rel(c,j+1)-conc_o2_rel(c,j)*k_h_cc(c,j,s)) - & - dm1_zm1(c,j) * (conc_o2_rel(c,j) -conc_o2_rel(c,j-1))) + & - 0.5_r8 * (source(c,j,s) + source_old(c,j,s)) - elseif (j < nlevsoi .and. j == jwt(c)+1) then - ! concentration above needs to be mult. by k_h_cc for dm1_zm1 term - rt(c,j) = epsilon_t_old(c,j,s) / dtime_ch4 * conc_o2_rel(c,j) + & - 0.5_r8 / dzj * (dp1_zp1(c,j) * (conc_o2_rel(c,j+1)-conc_o2_rel(c,j)) - & - dm1_zm1(c,j) * (conc_o2_rel(c,j) -conc_o2_rel(c,j-1)*k_h_cc(c,j-1,s))) + & - 0.5_r8 * (source(c,j,s) + source_old(c,j,s)) - elseif (j < nlevsoi) then - rt(c,j) = epsilon_t_old(c,j,s) / dtime_ch4 * conc_o2_rel(c,j) + & - 0.5_r8 / dzj * (dp1_zp1(c,j) * (conc_o2_rel(c,j+1)-conc_o2_rel(c,j)) - & - dm1_zm1(c,j) * (conc_o2_rel(c,j) -conc_o2_rel(c,j-1))) + & - 0.5_r8 * (source(c,j,s) + source_old(c,j,s)) - else if (j == nlevsoi .and. j== jwt(c)+1) then - ! concentration above needs to be mult. by k_h_cc for dm1_zm1 term - rt(c,j) = epsilon_t_old(c,j,s) / dtime_ch4 * conc_o2_rel(c,j) + & - 0.5_r8 / dzj * ( - dm1_zm1(c,j) * (conc_o2_rel(c,j) -conc_o2_rel(c,j-1)*k_h_cc(c,j-1,s))) + & - 0.5_r8 * (source(c,j,s) + source_old(c,j,s)) - else !j==nlevsoi - rt(c,j) = epsilon_t_old(c,j,s) / dtime_ch4 * conc_o2_rel(c,j) + & - 0.5_r8 / dzj * ( - dm1_zm1(c,j) * (conc_o2_rel(c,j) -conc_o2_rel(c,j-1))) + & - 0.5_r8 * (source(c,j,s) + source_old(c,j,s)) - endif - epsilon_t_old(c,j,s) = epsilon_t(c,j,s) - source_old(c,j,s) = source(c,j,s) - - enddo ! fc; column - enddo ! j; nlevsoi - - call Tridiagonal(bounds, 0, nlevsoi, jtop(bounds%begc:bounds%endc), & - num_methc, filter_methc, & - at(bounds%begc:bounds%endc, :), & - bt(bounds%begc:bounds%endc, :), & - ct(bounds%begc:bounds%endc, :), & - rt(bounds%begc:bounds%endc, :), & - conc_o2_rel(bounds%begc:bounds%endc,0:nlevsoi)) - - ! Ensure that concentrations stay above 0 - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - g = col%gridcell(c) - conc_o2_rel(c,j) = max (conc_o2_rel(c,j), 1.e-12_r8) - ! In case of pathologically large aerenchyma conductance. Should be OK in general but - ! this will maintain stability even if a PATCH with very small weight somehow has an absurd NPP or LAI. - ! Also, oxygen above ambient will probably bubble. - conc_o2_rel(c,j) = min (conc_o2_rel(c,j), c_atm(g,2)/epsilon_t(c,j,2)) - enddo - enddo - - endif ! species - - enddo ! species - - ! Update absolute concentrations per unit volume - do j = 1,nlevsoi ! No need to update the atm. level concentrations - do fc = 1, num_methc - c = filter_methc (fc) - - conc_ch4(c,j) = conc_ch4_rel(c,j)*epsilon_t(c,j,1) - conc_o2(c,j) = conc_o2_rel(c,j) *epsilon_t(c,j,2) - end do - end do - - ! Do Balance Check and absorb small - ! discrepancy into surface flux. - do j = 1,nlevsoi - do fc = 1, num_methc - c = filter_methc (fc) - - if (j == 1) errch4(c) = 0._r8 - errch4(c) = errch4(c) + (conc_ch4(c,j) - conc_ch4_bef(c,j))*dz(c,j) - errch4(c) = errch4(c) - ch4_prod_depth(c,j)*dz(c,j)*dtime - errch4(c) = errch4(c) + ch4_oxid_depth(c,j)*dz(c,j)*dtime - end do - end do - - do fc = 1, num_methc - c = filter_methc (fc) - - ! For history make sure that grnd_ch4_cond includes snow, for methane diffusivity - grnd_ch4_cond(c) = spec_grnd_cond(c,1) - - errch4(c) = errch4(c) + (ch4_surf_aere(c) + ch4_surf_ebul(c) + ch4_surf_diff(c))*dtime - - if (abs(errch4(c)) < 1.e-8_r8) then - ch4_surf_diff(c) = ch4_surf_diff(c) - errch4(c)/dtime - else ! errch4 > 1e-8 mol / m^2 / timestep - write(iulog,*)'CH4 Conservation Error in CH4Mod during diffusion, nstep, c, errch4 (mol /m^2.timestep)', & - nstep,c,errch4(c) - g = col%gridcell(c) - write(iulog,*)'Latdeg,Londeg=',grc%latdeg(g),grc%londeg(g) - call endrun(msg=' ERROR: CH4 Conservation Error in CH4Mod during diffusion'//& - errMsg(sourcefile, __LINE__)) - end if - end do - - end associate - - end subroutine ch4_tran - - !----------------------------------------------------------------------- - subroutine get_jwt (bounds, num_methc, filter_methc, jwt, & - soilstate_inst, waterstate_inst, temperature_inst) - ! - ! !DESCRIPTION: - ! Finds the first unsaturated layer going up. Also allows a perched water table over ice. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of column soil points in column filter - integer , intent(in) :: filter_methc(:) ! column filter for soil points - integer , intent(out) :: jwt( bounds%begc: ) ! index of the soil layer right above the water table (-) [col] - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: f_sat ! volumetric soil water defining top of water table or where production is allowed - integer :: c,j,perch! indices - integer :: fc ! filter column index - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(jwt) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - t_soisno => temperature_inst%t_soisno_col & ! Input: [real(r8) (: ,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevsoi) - ) - - f_sat = params_inst%f_sat - - ! The layer index of the first unsaturated layer, i.e., the layer right above - ! the water table. - ! ZS: Loop is currently not vectorized. - do fc = 1, num_methc - c = filter_methc(fc) - - ! Check to see if any soil layers are frozen and saturated. If so, start looking at the first layer above the top - ! such layer. This is potentially important for perched water tables in the Tundra. - - perch = nlevsoi - do j = nlevsoi, 1, -1 - if (t_soisno(c,j) < tfrz .and. h2osoi_vol(c,j) > f_sat * watsat(c,j)) then - ! strictly less than freezing because it could be permeable otherwise - perch = j-1 - end if - end do - jwt(c) = perch - - do j = perch, 2, -1 - if(h2osoi_vol(c,j) > f_sat * watsat(c,j) .and. h2osoi_vol(c,j-1) < f_sat * watsat(c,j-1)) then - jwt(c) = j-1 - exit - end if - enddo - if (jwt(c) == perch .and. h2osoi_vol(c,1) > f_sat * watsat(c,1)) then ! missed that the top layer is saturated - jwt(c) = 0 - endif - end do - - end associate - - end subroutine get_jwt - - !----------------------------------------------------------------------- - subroutine ch4_annualupdate(bounds, num_methc, filter_methc, num_methp, filter_methp, & - agnpp, bgnpp, & - soilbiogeochem_carbonflux_inst, ch4_inst) - ! - ! !DESCRIPTION: Annual mean fields. - ! - ! !USES: - use clm_time_manager, only: get_step_size, get_days_per_year, get_nstep - use clm_varcon , only: secspday - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_methc ! number of soil columns in filter - integer , intent(in) :: filter_methc(:) ! filter for soil columns - integer , intent(in) :: num_methp ! number of soil points in patch filter - integer , intent(in) :: filter_methp(:) ! patch filter for soil points - real(r8) , intent(in) :: agnpp( bounds%begp: ) ! aboveground NPP (gC/m2/s) - real(r8) , intent(in) :: bgnpp( bounds%begp: ) ! belowground NPP (gC/m2/s) - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fc ! soil column filter indices - integer :: fp ! soil patch filter indices - real(r8):: dt ! time step (seconds) - real(r8):: secsperyear - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(agnpp) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bgnpp) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - somhr => soilbiogeochem_carbonflux_inst%somhr_col , & ! Input: [real(r8) (:) ] (gC/m2/s) soil organic matter heterotrophic respiration - - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area in soil column - tempavg_agnpp => ch4_inst%tempavg_agnpp_patch , & ! Output: [real(r8) (:) ] temporary average above-ground NPP (gC/m2/s) - annavg_agnpp => ch4_inst%annavg_agnpp_patch , & ! Output: [real(r8) (:) ] annual average above-ground NPP (gC/m2/s) - tempavg_bgnpp => ch4_inst%tempavg_bgnpp_patch , & ! Output: [real(r8) (:) ] temporary average below-ground NPP (gC/m2/s) - annavg_bgnpp => ch4_inst%annavg_bgnpp_patch , & ! Output: [real(r8) (:) ] annual average below-ground NPP (gC/m2/s) - annsum_counter => ch4_inst%annsum_counter_col , & ! Output: [real(r8) (:) ] seconds since last annual accumulator turnover - tempavg_somhr => ch4_inst%tempavg_somhr_col , & ! Output: [real(r8) (:) ] temporary average SOM heterotrophic resp. (gC/m2/s) - annavg_somhr => ch4_inst%annavg_somhr_col , & ! Output: [real(r8) (:) ] annual average SOM heterotrophic resp. (gC/m2/s) - tempavg_finrw => ch4_inst%tempavg_finrw_col , & ! Output: [real(r8) (:) ] respiration-weighted annual average of finundated - annavg_finrw => ch4_inst%annavg_finrw_col & ! Output: [real(r8) (:) ] respiration-weighted annual average of finundated - ) - - ! set time steps - dt = real(get_step_size(), r8) - secsperyear = real( get_days_per_year() * secspday, r8) - - do fc = 1,num_methc - c = filter_methc(fc) - annsum_counter(c) = annsum_counter(c) + dt - end do - - do fc = 1,num_methc - c = filter_methc(fc) - if (annsum_counter(c) >= secsperyear) then - - ! update annual average somhr - annavg_somhr(c) = tempavg_somhr(c) - tempavg_somhr(c) = 0._r8 - - ! update annual average finrw - if (annavg_somhr(c) > 0._r8) then - annavg_finrw(c) = tempavg_finrw(c) / annavg_somhr(c) - else - annavg_finrw(c) = 0._r8 - end if - tempavg_finrw(c) = 0._r8 - else - tempavg_somhr(c) = tempavg_somhr(c) + dt/secsperyear * somhr(c) - tempavg_finrw(c) = tempavg_finrw(c) + dt/secsperyear * finundated(c) * somhr(c) - end if - end do - - do fp = 1,num_methp - p = filter_methp(fp) - c = patch%column(p) - if (annsum_counter(c) >= secsperyear) then - - annavg_agnpp(p) = tempavg_agnpp(p) - tempavg_agnpp(p) = 0._r8 - - annavg_bgnpp(p) = tempavg_bgnpp(p) - tempavg_bgnpp(p) = 0._r8 - - else - tempavg_agnpp(p) = tempavg_agnpp(p) + dt/secsperyear * agnpp(p) - tempavg_bgnpp(p) = tempavg_bgnpp(p) + dt/secsperyear * bgnpp(p) - end if - end do - - ! column loop - do fc = 1,num_methc - c = filter_methc(fc) - if (annsum_counter(c) >= secsperyear) annsum_counter(c) = 0._r8 - end do - - end associate - - end subroutine ch4_annualupdate - - !----------------------------------------------------------------------- - subroutine ch4_totcolch4(bounds, num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - ch4_inst, totcolch4) - ! - ! !DESCRIPTION: - ! Computes total column ch4, returned in totcolch4 - ! - ! totcolch4 is set over both the nolakec and the lakec filters; elsewhere, it retains - ! its original values - ! - ! !USES: - use ch4varcon , only : allowlakeprod - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(ch4_type) , intent(in) :: ch4_inst - real(r8) , intent(inout) :: totcolch4( bounds%begc: ) ! total methane in soil column (g C / m^2) - ! - ! !LOCAL VARIABLES: - integer :: fc, c - integer :: j - - character(len=*), parameter :: subname = 'ch4_totcolch4' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(totcolch4) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevsoi) - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) - conc_ch4_sat => ch4_inst%conc_ch4_sat_col , & ! Input: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - conc_ch4_unsat => ch4_inst%conc_ch4_unsat_col & ! Input: [real(r8) (:,:) ] CH4 conc in each soil layer (mol/m3) (nlevsoi) - ) - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - totcolch4(c) = 0._r8 - end do - - do fc = 1, num_lakec - c = filter_lakec(fc) - totcolch4(c) = 0._r8 - end do - - do j = 1, nlevsoi - do fc = 1, num_nolakec - c = filter_nolakec(fc) - totcolch4(c) = totcolch4(c) + & - (finundated(c)*conc_ch4_sat(c,j) + (1._r8-finundated(c))*conc_ch4_unsat(c,j)) * & - dz(c,j)*catomw - ! mol CH4 --> g C - end do - - if (allowlakeprod) then - do fc = 1, num_lakec - c = filter_lakec(fc) - totcolch4(c) = totcolch4(c) + conc_ch4_sat(c,j)*dz(c,j)*catomw ! mol CH4 --> g C - end do - end if - end do - - end associate - - end subroutine ch4_totcolch4 - - -end module ch4Mod - diff --git a/src/biogeochem/ch4varcon.F90 b/src/biogeochem/ch4varcon.F90 deleted file mode 100644 index 5bf4917e74..0000000000 --- a/src/biogeochem/ch4varcon.F90 +++ /dev/null @@ -1,192 +0,0 @@ -module ch4varcon - - !----------------------------------------------------------------------- - ! Module containing CH4 parameters and logical switches and routine to read constants from CLM namelist. - ! - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varctl , only : NLFileName_in - ! - implicit none - ! - ! Methane Model Parameters - ! - private - - logical, public :: use_aereoxid_prog = .true. ! if false then aereoxid is read off of - ! the parameter file and may be modifed by the user (default aereoxid on the - ! file is 0.0). - - logical, public :: transpirationloss = .true. ! switch for activating CH4 loss from transpiration - ! Transpiration loss assumes that the methane concentration in dissolved soil - ! water remains constant through the plant and is released when the water evaporates - ! from the stomata. - ! Currently hard-wired to true; impact is < 1 Tg CH4/yr - - logical, public :: allowlakeprod = .false. ! Switch to allow production under lakes based on soil carbon dataset - ! (Methane can be produced, and CO2 produced from methane oxidation, - ! which will slowly reduce the available carbon stock, if ! replenishlakec, but no other biogeochem is done.) - ! Note: switching this off turns off ALL lake methane biogeochem. However, 0 values - ! will still be averaged into the concentration _sat history fields. - - logical, public :: usephfact = .false. ! Switch to use pH factor in methane production - - logical, public :: replenishlakec = .true. ! Switch for keeping carbon storage under lakes constant - ! so that lakes do not affect the carbon balance - ! Good for long term rather than transient warming experiments - ! NOTE SWITCHING THIS OFF ASSUMES TRANSIENT CARBON SUPPLY FROM LAKES; COUPLED MODEL WILL NOT CONSERVE CARBON - ! IN THIS MODE. - - ! inundatrion fraction -- which is used in methane code and potentially soil code - integer, public :: finundation_mtd ! Finundation method type to use, one of the following - integer, public, parameter :: finundation_mtd_h2osfc = 0 ! Use prognostic fsat h2osfc - integer, public, parameter :: finundation_mtd_ZWT_inversion = 1 ! Use inversion of ZWT to Prigent satellite inundation obs. data - integer, public, parameter :: finundation_mtd_TWS_inversion = 2 ! Use inversion of TWS to Prigent satellite inundation obs. data - - logical, public :: usefrootc = .false. ! Use CLMCN fine root C rather than ann NPP & LAI based parameterization to - ! calculate tiller C for aerenchyma area calculation. - ! The NPP & LAI param. was based on Wania for Arctic sedges and may not be - ! appropriate for woody Patches, although nongrassporosratio above partly adjusts - ! for this. However, using fine root C reduces the aerenchyma area by a large - ! factor. - - logical, public :: ch4offline = .true. ! true --> Methane is not passed between the land & atmosphere. - ! NEM is not added to NEE flux to atm. to correct for methane production, - ! and ambient CH4 is set to constant 2009 value. - - logical, public :: ch4rmcnlim = .false. ! Remove the N and low moisture limitations on SOM HR when calculating - ! methanogenesis. - ! Note: this option has not been extensively tested. - ! Currently hardwired off. - - logical, public :: anoxicmicrosites = .false. ! Use Arah & Stephen 1998 expression to allow production above the water table - ! Currently hardwired off; expression is crude. - - logical, public :: ch4frzout = .false. ! Exclude CH4 from frozen fraction of soil pore H2O, to simulate "freeze-out" pulse - ! as in Mastepanov 2008. - ! Causes slight increase in emissions in the fall and decrease in the spring. - ! Currently hardwired off; small impact. - - public :: ch4conrd ! Read and initialize CH4 constants - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine ch4conrd () - ! - ! !DESCRIPTION: - ! Read and initialize CH4 constants - ! - ! !USES: - use fileutils , only : relavu, getavu - use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_LOGICAL, MPI_INTEGER - use shr_nl_mod , only : shr_nl_find_group_name - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - implicit none - ! - integer :: i,j,n ! loop indices - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'ch4conrd' ! subroutine name - character(len=50) :: finundation_method = 'ZWT_inversion' ! String for finundation_method to use - !----------------------------------------------------------------------- - - ! ---------------------------------------------------------------------- - ! Namelist Variables - ! ---------------------------------------------------------------------- - - ! Driver - namelist /ch4par_in/ & - ch4offline, replenishlakec, allowlakeprod, finundation_method - - ! Production - namelist /ch4par_in/ & - usephfact - - ! Methane - namelist /ch4par_in/ & - use_aereoxid_prog, usefrootc - - ! ---------------------------------------------------------------------- - ! Read namelist from standard input. - ! ---------------------------------------------------------------------- - - if (masterproc) then - - write(iulog,*) 'Attempting to read CH4 parameters .....' - unitn = getavu() - write(iulog,*) 'Read in ch4par_in namelist from: ', trim(NLFilename_in) - open( unitn, file=trim(NLFilename_in), status='old' ) - call shr_nl_find_group_name(unitn, 'ch4par_in', status=ierr) - if (ierr == 0) then - read(unitn, ch4par_in, iostat=ierr) - if (ierr /= 0) then - call endrun(msg='error in reading in ch4par_in namelist'//& - errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='error in finding ch4par_in namelist'//& - errMsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - if ( trim(finundation_method) == "h2osfc" )then - finundation_mtd = finundation_mtd_h2osfc - else if ( trim(finundation_method) == "TWS_inversion" )then - finundation_mtd = finundation_mtd_tws_inversion - else if ( trim(finundation_method) == "ZWT_inversion" )then - finundation_mtd = finundation_mtd_zwt_inversion - else - call endrun(msg='error bad value for finundation_method in ch4par_in namelist'//& - errMsg(sourcefile, __LINE__)) - end if - - end if ! masterproc - - - call mpi_bcast ( use_aereoxid_prog, 1 , MPI_LOGICAL, 0, mpicom, ierr ) - call mpi_bcast (allowlakeprod, 1 , MPI_LOGICAL, 0, mpicom, ierr) - call mpi_bcast (usephfact, 1 , MPI_LOGICAL, 0, mpicom, ierr) - call mpi_bcast (replenishlakec, 1 , MPI_LOGICAL, 0, mpicom, ierr) - call mpi_bcast (finundation_mtd, 1 , MPI_INTEGER, 0, mpicom, ierr) - call mpi_bcast (usefrootc, 1 , MPI_LOGICAL, 0, mpicom, ierr) - call mpi_bcast (ch4offline, 1 , MPI_LOGICAL, 0, mpicom, ierr) - - if (masterproc) then - write(iulog,*) 'Successfully read CH4 namelist' - write(iulog,*)' ' - write(iulog,*)'allowlakeprod = ', allowlakeprod - write(iulog,*)'usephfact = ', usephfact - write(iulog,*)'replenishlakec = ', replenishlakec - write(iulog,*)'finundation_method = ', finundation_method - write(iulog,*)'usefrootc = ', usefrootc - write(iulog,*)'ch4offline = ', ch4offline - write(iulog,*)'use_aereoxid_prog = ', use_aereoxid_prog - - if (ch4offline) write(iulog,*)'CH4 Model will be running offline and not affect fluxes to atmosphere' - - if ( .not. use_aereoxid_prog ) then - write(iulog,*) 'Aerenchyma oxidation (aereoxid) value is being read from '//& - ' the parameters file' - endif - - if (.not. allowlakeprod) write(iulog,*) 'Lake production has been disabled. '// & - ' Lakes will not factor into CH4 BGC. "Sat" history fields will not average'// & - ' over lakes except for concentrations, which will average zero from lakes.' - if (.not. replenishlakec .and. .not. ch4offline) write(iulog,*)'LAKE SOIL CARBON WILL NOT BE REPLENISHED BUT INSTEAD ',& - 'WILL BE TRANSIENTLY RELEASED: COUPLED MODEL WILL NOT CONSERVE CARBON IN THIS MODE!' - write(iulog,*)'Successfully initialized CH4 parameters from namelist.' - write(iulog,*) - - end if - - end subroutine ch4conrd - -end module ch4varcon - diff --git a/src/biogeochem/dynCNDVMod.F90 b/src/biogeochem/dynCNDVMod.F90 deleted file mode 100644 index 2bea506938..0000000000 --- a/src/biogeochem/dynCNDVMod.F90 +++ /dev/null @@ -1,110 +0,0 @@ -module dynCNDVMod - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Handle weight updates associated with prognostic dynamic vegetation (CNDV) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use LandunitType , only : lun - use PatchType , only : patch - use CNDVType , only : dgvs_type - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - public :: dynCNDV_init ! initialize CNDV weight updates - public :: dynCNDV_interp ! interpolate CNDV weight updates to the time step - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine dynCNDV_init(bounds, dgvs_inst) - ! - ! !DESCRIPTION: - ! Initialize time interpolation of cndv pft weights from annual to time step - ! - ! Should be called once, in model initialization - ! - ! !USES: - use clm_varctl, only : nsrest, nsrStartup - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(dgvs_type) , intent(inout) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - integer :: ier, p ! error status, do-loop index - character(len=32) :: subname='dynCNDV_init' ! subroutine name - !----------------------------------------------------------------------- - - if (nsrest == nsrStartup) then - do p = bounds%begp,bounds%endp - dgvs_inst%fpcgrid_patch(p) = patch%wtcol(p) - dgvs_inst%fpcgridold_patch(p) = patch%wtcol(p) - end do - end if - - end subroutine dynCNDV_init - - !----------------------------------------------------------------------- - subroutine dynCNDV_interp( bounds, dgvs_inst) - ! - ! !DESCRIPTION: - ! Time interpolate cndv pft weights from annual to time step - ! - ! !USES: - use clm_time_manager, only : get_curr_date, get_step_size, get_nstep, get_curr_yearfrac - use landunit_varcon , only : istsoil ! CNDV incompatible with dynLU - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(dgvs_type) , intent(inout) :: dgvs_inst - ! - ! !LOCAL VARIABLES: - integer :: c,g,l,p ! indices - real(r8) :: cday ! current calendar day (1.0 = 0Z on Jan 1) - real(r8) :: wt1 ! time interpolation weights (weight of time 1) - real(r8) :: dtime ! model time step - real(r8) :: days_per_year ! days per year - integer :: nstep ! time step number - integer :: year ! year (0, ...) at nstep + 1 - integer :: mon ! month (1, ..., 12) at nstep + 1 - integer :: day ! day of month (1, ..., 31) at nstep + 1 - integer :: sec ! seconds into current date at nstep + 1 - character(len=32) :: subname='dynCNDV_interp' ! subroutine name - !----------------------------------------------------------------------- - - ! Interpolate pft weight to current time step - ! Map interpolated pctpft to subgrid weights - ! assumes maxpatch_pft = numpft + 1, each landunit has 1 column, - ! SCAM not defined and create_croplandunit = .false. - - nstep = get_nstep() - dtime = get_step_size() - - wt1 = 1.0_r8 - get_curr_yearfrac(offset = -int(dtime)) - - call get_curr_date(year, mon, day, sec, offset=int(dtime)) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - - if (lun%itype(l) == istsoil .and. lun%wtgcell(l) > 0._r8) then ! CNDV incompatible with dynLU - patch%wtcol(p) = dgvs_inst%fpcgrid_patch(p) + & - wt1 * (dgvs_inst%fpcgridold_patch(p) - dgvs_inst%fpcgrid_patch(p)) - - if (mon==1 .and. day==1 .and. sec==dtime .and. nstep>0) then - dgvs_inst%fpcgridold_patch(p) = dgvs_inst%fpcgrid_patch(p) - end if - end if - end do - - end subroutine dynCNDV_interp - -end module dynCNDVMod diff --git a/src/biogeochem/dynConsBiogeochemMod.F90 b/src/biogeochem/dynConsBiogeochemMod.F90 deleted file mode 100644 index e233653ca7..0000000000 --- a/src/biogeochem/dynConsBiogeochemMod.F90 +++ /dev/null @@ -1,886 +0,0 @@ -module dynConsBiogeochemMod - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Handle conservation of biogeochemical quantities (C & N) with dynamic land cover. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog, use_c13, use_c14, use_lch4 - use pftconMod , only : pftcon - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use CNVegStateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemStateType , only : soilBiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilBiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType, only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use ch4Mod , only : ch4_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - public :: dyn_cnbal_patch - public :: dyn_cnbal_col - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine dyn_cnbal_patch(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - prior_weights, patch_state_updater, & - canopystate_inst, photosyns_inst, cnveg_state_inst, & - cnveg_carbonstate_inst, c13_cnveg_carbonstate_inst, c14_cnveg_carbonstate_inst, & - cnveg_carbonflux_inst, c13_cnveg_carbonflux_inst, c14_cnveg_carbonflux_inst, & - cnveg_nitrogenstate_inst, cnveg_nitrogenflux_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_state_inst) - ! - ! !DESCRIPTION: - ! Modify patch-level state and flux variables to maintain carbon and nitrogen balance with - ! dynamic patch-weights. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_PDB - use landunit_varcon , only : istsoil, istcrop - use clm_varpar , only : numveg, nlevdecomp - use clm_varcon , only : c13ratio, c14ratio, c3_r2, c4_r2 - use clm_time_manager , only : get_step_size - use dynPriorWeightsMod , only : prior_weights_type - use dynPatchStateUpdaterMod, only : patch_state_updater_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_soilp_with_inactive ! number of points in filter - integer , intent(in) :: filter_soilp_with_inactive(:) ! soil patch filter that includes inactive points - type(prior_weights_type) , intent(in) :: prior_weights ! weights prior to the subgrid weight updates - type(patch_state_updater_type) , intent(in) :: patch_state_updater - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c13_cnveg_carbonstate_inst - type(cnveg_carbonstate_type) , intent(inout) :: c14_cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c13_cnveg_carbonflux_inst - type(cnveg_carbonflux_type) , intent(inout) :: c14_cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g,j ! indices - integer :: begp, endp - integer :: ier ! error code - real(r8) :: dt ! land model time step (sec) - real(r8), allocatable :: dwt(:) ! change in patch weight (relative to gridcell) - real(r8), allocatable :: dwt_leafc_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_leafn_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemc_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemn_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_frootc_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable :: dwt_livecrootc_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable :: dwt_deadcrootc_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_frootn_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_livecrootn_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_deadcrootn_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable :: conv_cflux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: wood_product_cflux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: crop_product_cflux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable, target :: conv_nflux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: wood_product_nflux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: crop_product_nflux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - character(len=32) :: subname='dyn_cbal' ! subroutine name - !! C13 - real(r8), allocatable :: dwt_leafc13_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemc13_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable, target :: dwt_frootc13_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_livecrootc13_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_deadcrootc13_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: conv_c13flux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: wood_product_c13flux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: crop_product_c13flux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - !! C14 - real(r8), allocatable :: dwt_leafc14_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemc14_seed(:) ! patch-level mass gain due to seeding of new area - real(r8), allocatable, target :: dwt_frootc14_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_livecrootc14_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: dwt_deadcrootc14_to_litter(:) ! patch-level mass loss due to weight shift (expressed per unit COLUMN area) - real(r8), allocatable, target :: conv_c14flux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: wood_product_c14flux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - real(r8), allocatable :: crop_product_c14flux(:) ! patch-level mass loss due to weight shift (expressed per unit GRIDCELL area) - - logical :: patch_initiating(bounds%begp:bounds%endp) - - ! amounts to add to growing patches - real(r8), parameter :: leafc_seed = 1._r8 - real(r8), parameter :: deadstemc_seed = 0.1_r8 - - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - ! Allocate patch-level mass loss arrays - allocate(dwt(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_leafc_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafc_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_leafn_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafn_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadstemc_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemc_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadstemn_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemn_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_frootc_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootc_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_livecrootc_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootc_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadcrootc_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootc_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_frootn_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootn_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_livecrootn_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootn_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadcrootn_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootn_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(conv_cflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_cflux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(wood_product_cflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for wood_product_cflux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(crop_product_cflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for crop_product_cflux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(conv_nflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_nflux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(wood_product_nflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for wood_product_nflux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(crop_product_nflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for crop_product_nflux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if ( use_c13 ) then - allocate(dwt_leafc13_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafc13_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadstemc13_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemc13_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_frootc13_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootc13_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_livecrootc13_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootc13_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadcrootc13_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootc13_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(conv_c13flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_c13flux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(wood_product_c13flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for wood_product_c13flux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(crop_product_c13flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for crop_product_c13flux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - endif - if ( use_c14 ) then - allocate(dwt_leafc14_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafc14_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadstemc14_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemc14_seed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_frootc14_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootc14_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_livecrootc14_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootc14_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(dwt_deadcrootc14_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootc14_to_litter' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(conv_c14flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_c14flux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(wood_product_c14flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for wood_product_c14flux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(crop_product_c14flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for crop_product_c14flux' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - endif - - ! Get time step - dt = real( get_step_size(), r8 ) - - patch_initiating = patch_state_updater%patch_initiating(bounds) - - do p = begp,endp - c = patch%column(p) - ! initialize all the patch-level local flux arrays - dwt(p) = 0._r8 - dwt_leafc_seed(p) = 0._r8 - dwt_leafn_seed(p) = 0._r8 - dwt_deadstemc_seed(p) = 0._r8 - dwt_deadstemn_seed(p) = 0._r8 - dwt_frootc_to_litter(p) = 0._r8 - dwt_livecrootc_to_litter(p) = 0._r8 - dwt_deadcrootc_to_litter(p) = 0._r8 - dwt_frootn_to_litter(p) = 0._r8 - dwt_livecrootn_to_litter(p) = 0._r8 - dwt_deadcrootn_to_litter(p) = 0._r8 - conv_cflux(p) = 0._r8 - wood_product_cflux(p) = 0._r8 - crop_product_cflux(p) = 0._r8 - conv_nflux(p) = 0._r8 - wood_product_nflux(p) = 0._r8 - crop_product_nflux(p) = 0._r8 - - if ( use_c13 ) then - dwt_leafc13_seed(p) = 0._r8 - dwt_deadstemc13_seed(p) = 0._r8 - dwt_frootc13_to_litter(p) = 0._r8 - dwt_livecrootc13_to_litter(p) = 0._r8 - dwt_deadcrootc13_to_litter(p) = 0._r8 - conv_c13flux(p) = 0._r8 - wood_product_c13flux(p) = 0._r8 - crop_product_c13flux(p) = 0._r8 - endif - - if ( use_c14 ) then - dwt_leafc14_seed(p) = 0._r8 - dwt_deadstemc14_seed(p) = 0._r8 - dwt_frootc14_to_litter(p) = 0._r8 - dwt_livecrootc14_to_litter(p) = 0._r8 - dwt_deadcrootc14_to_litter(p) = 0._r8 - conv_c14flux(p) = 0._r8 - wood_product_c14flux(p) = 0._r8 - crop_product_c14flux(p) = 0._r8 - endif - - l = patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - ! calculate the change in weight for the timestep - dwt(p) = patch%wtgcell(p)-prior_weights%pwtgcell(p) - - ! Identify patches that are initiating on this timestep and set all the - ! necessary state and flux variables - - ! TODO(wjs, 2016-06-01) It seems like this code should be moved to a new - ! subroutine that is solely responsible for initializing newly-active patches - - ! NOTE(wjs, 2016-06-01) We could replace the check of patch_initiating with a - ! check of something like (patch%active(p) .and. .not. - ! prior_weights%pactive(p)). That would mean that 0-weight active patches would - ! remain in their spunup state when they began to grow. But I think that's a bad - ! idea, because it means that the evolution of the system depends on which - ! 0-weight patches we choose to keep active. It seems better to reinitialize - ! patches as soon as they grow to > 0 area, as is done here. - - if (patch_initiating(p)) then - - canopystate_inst%laisun_patch(p) = 0._r8 - canopystate_inst%laisha_patch(p) = 0._r8 - - cnveg_state_inst%dormant_flag_patch(p) = 1._r8 - cnveg_state_inst%days_active_patch(p) = 0._r8 - cnveg_state_inst%onset_flag_patch(p) = 0._r8 - cnveg_state_inst%onset_counter_patch(p) = 0._r8 - cnveg_state_inst%onset_gddflag_patch(p) = 0._r8 - cnveg_state_inst%onset_fdd_patch(p) = 0._r8 - cnveg_state_inst%onset_gdd_patch(p) = 0._r8 - cnveg_state_inst%onset_swi_patch(p) = 0._r8 - cnveg_state_inst%offset_flag_patch(p) = 0._r8 - cnveg_state_inst%offset_counter_patch(p) = 0._r8 - cnveg_state_inst%offset_fdd_patch(p) = 0._r8 - cnveg_state_inst%offset_swi_patch(p) = 0._r8 - cnveg_state_inst%lgsf_patch(p) = 0._r8 - cnveg_state_inst%bglfr_patch(p) = 0._r8 - cnveg_state_inst%bgtr_patch(p) = 0._r8 - cnveg_state_inst%annavg_t2m_patch(p) = cnveg_state_inst%annavg_t2m_col(c) - cnveg_state_inst%tempavg_t2m_patch(p) = 0._r8 - cnveg_state_inst%c_allometry_patch(p) = 0._r8 - cnveg_state_inst%n_allometry_patch(p) = 0._r8 - cnveg_state_inst%tempsum_potential_gpp_patch(p) = 0._r8 - cnveg_state_inst%annsum_potential_gpp_patch(p) = 0._r8 - cnveg_state_inst%tempmax_retransn_patch(p) = 0._r8 - cnveg_state_inst%annmax_retransn_patch(p) = 0._r8 - cnveg_state_inst%downreg_patch(p) = 0._r8 - - cnveg_carbonflux_inst%xsmrpool_recover_patch(p) = 0._r8 - cnveg_carbonflux_inst%plant_calloc_patch(p) = 0._r8 - cnveg_carbonflux_inst%excess_cflux_patch(p) = 0._r8 - cnveg_carbonflux_inst%prev_leafc_to_litter_patch(p) = 0._r8 - cnveg_carbonflux_inst%prev_frootc_to_litter_patch(p) = 0._r8 - cnveg_carbonflux_inst%availc_patch(p) = 0._r8 - cnveg_carbonflux_inst%gpp_before_downreg_patch(p) = 0._r8 - - cnveg_carbonflux_inst%tempsum_npp_patch(p) = 0._r8 - cnveg_carbonflux_inst%annsum_npp_patch(p) = 0._r8 - - cnveg_nitrogenflux_inst%plant_ndemand_patch(p) = 0._r8 - cnveg_nitrogenflux_inst%avail_retransn_patch(p) = 0._r8 - cnveg_nitrogenflux_inst%plant_nalloc_patch(p) = 0._r8 - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%xsmrpool_c13ratio_patch(p) = c13ratio - end if - - call photosyns_inst%NewPatchinit(p) - - end if ! end initialization of new patch - end if ! is soil - end do ! patch loop - - ! Determine annually-smoothed (dribbled) change in weight - call CNveg_state_inst%dwt_dribbler_patch%set_curr_delta(bounds, & - dwt(bounds%begp:bounds%endp)) - call CNveg_state_inst%dwt_dribbler_patch%get_dribbled_delta(bounds, & - CNveg_state_inst%dwt_smoothed_patch(bounds%begp:bounds%endp)) - - ! Adjust patch variables and compute associated fluxes for changing patch areas - - call cnveg_carbonstate_inst%DynamicPatchAdjustments(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - patch_state_updater, & - leafc_seed = leafc_seed, & - deadstemc_seed = deadstemc_seed, & - conv_cflux = conv_cflux(begp:endp), & - wood_product_cflux = wood_product_cflux(begp:endp), & - crop_product_cflux = crop_product_cflux(begp:endp), & - dwt_frootc_to_litter = dwt_frootc_to_litter(begp:endp), & - dwt_livecrootc_to_litter = dwt_livecrootc_to_litter(begp:endp), & - dwt_deadcrootc_to_litter = dwt_deadcrootc_to_litter(begp:endp), & - dwt_leafc_seed = dwt_leafc_seed(begp:endp), & - dwt_deadstemc_seed = dwt_deadstemc_seed(begp:endp)) - - ! These fluxes are computed as negative quantities, but are expected to be positive, - ! so flip the signs - do p = begp, endp - dwt_frootc_to_litter(p) = -1._r8 * dwt_frootc_to_litter(p) - dwt_livecrootc_to_litter(p) = -1._r8 * dwt_livecrootc_to_litter(p) - dwt_deadcrootc_to_litter(p) = -1._r8 * dwt_deadcrootc_to_litter(p) - end do - - if (use_c13) then - call c13_cnveg_carbonstate_inst%DynamicPatchAdjustments(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - patch_state_updater, & - leafc_seed = leafc_seed, & - deadstemc_seed = deadstemc_seed, & - conv_cflux = conv_c13flux(begp:endp), & - wood_product_cflux = wood_product_c13flux(begp:endp), & - crop_product_cflux = crop_product_c13flux(begp:endp), & - dwt_frootc_to_litter = dwt_frootc13_to_litter(begp:endp), & - dwt_livecrootc_to_litter = dwt_livecrootc13_to_litter(begp:endp), & - dwt_deadcrootc_to_litter = dwt_deadcrootc13_to_litter(begp:endp), & - dwt_leafc_seed = dwt_leafc13_seed(begp:endp), & - dwt_deadstemc_seed = dwt_deadstemc13_seed(begp:endp)) - - ! These fluxes are computed as negative quantities, but are expected to be positive, - ! so flip the signs - do p = begp,endp - dwt_frootc13_to_litter(p) = -1._r8 * dwt_frootc13_to_litter(p) - dwt_livecrootc13_to_litter(p) = -1._r8 * dwt_livecrootc13_to_litter(p) - dwt_deadcrootc13_to_litter(p) = -1._r8 * dwt_deadcrootc13_to_litter(p) - end do - - end if - - if (use_c14) then - call c14_cnveg_carbonstate_inst%DynamicPatchAdjustments(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - patch_state_updater, & - leafc_seed = leafc_seed, & - deadstemc_seed = deadstemc_seed, & - conv_cflux = conv_c14flux(begp:endp), & - wood_product_cflux = wood_product_c14flux(begp:endp), & - crop_product_cflux = crop_product_c14flux(begp:endp), & - dwt_frootc_to_litter = dwt_frootc14_to_litter(begp:endp), & - dwt_livecrootc_to_litter = dwt_livecrootc14_to_litter(begp:endp), & - dwt_deadcrootc_to_litter = dwt_deadcrootc14_to_litter(begp:endp), & - dwt_leafc_seed = dwt_leafc14_seed(begp:endp), & - dwt_deadstemc_seed = dwt_deadstemc14_seed(begp:endp)) - - ! These fluxes are computed as negative quantities, but are expected to be positive, - ! so flip the signs - do p = begp,endp - dwt_frootc14_to_litter(p) = -1._r8 * dwt_frootc14_to_litter(p) - dwt_livecrootc14_to_litter(p) = -1._r8 * dwt_livecrootc14_to_litter(p) - dwt_deadcrootc14_to_litter(p) = -1._r8 * dwt_deadcrootc14_to_litter(p) - end do - - end if - - call cnveg_nitrogenstate_inst%DynamicPatchAdjustments(bounds, & - num_soilp_with_inactive, filter_soilp_with_inactive, & - patch_state_updater, & - leafc_seed = leafc_seed, & - deadstemc_seed = deadstemc_seed, & - conv_nflux = conv_nflux(begp:endp), & - wood_product_nflux = wood_product_nflux(begp:endp), & - crop_product_nflux = crop_product_nflux(begp:endp), & - dwt_frootn_to_litter = dwt_frootn_to_litter(begp:endp), & - dwt_livecrootn_to_litter = dwt_livecrootn_to_litter(begp:endp), & - dwt_deadcrootn_to_litter = dwt_deadcrootn_to_litter(begp:endp), & - dwt_leafn_seed = dwt_leafn_seed(begp:endp), & - dwt_deadstemn_seed = dwt_deadstemn_seed(begp:endp)) - - ! These fluxes are computed as negative quantities, but are expected to be positive, - ! so flip the signs - do p = begp,endp - dwt_frootn_to_litter(p) = -1._r8 * dwt_frootn_to_litter(p) - dwt_livecrootn_to_litter(p) = -1._r8 * dwt_livecrootn_to_litter(p) - dwt_deadcrootn_to_litter(p) = -1._r8 * dwt_deadcrootn_to_litter(p) - end do - - ! calculate column-level seeding fluxes - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - ! C fluxes - cnveg_carbonflux_inst%dwt_seedc_to_leaf_patch(p) = dwt_leafc_seed(p)/dt - cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc(g) = & - cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc(g) + & - cnveg_carbonflux_inst%dwt_seedc_to_leaf_patch(p) - - cnveg_carbonflux_inst%dwt_seedc_to_deadstem_patch(p) = dwt_deadstemc_seed(p)/dt - cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc(g) = & - cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc(g) + & - cnveg_carbonflux_inst%dwt_seedc_to_deadstem_patch(p) - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%dwt_seedc_to_leaf_patch(p) = dwt_leafc13_seed(p)/dt - c13_cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc(g) = & - c13_cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc(g) + & - c13_cnveg_carbonflux_inst%dwt_seedc_to_leaf_patch(p) - - c13_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_patch(p) = dwt_deadstemc13_seed(p)/dt - c13_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc(g) = & - c13_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc(g) + & - c13_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_patch(p) - endif - - if ( use_c14 ) then - c14_cnveg_carbonflux_inst%dwt_seedc_to_leaf_patch(p) = dwt_leafc14_seed(p)/dt - c14_cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc(g) = & - c14_cnveg_carbonflux_inst%dwt_seedc_to_leaf_grc(g) + & - c14_cnveg_carbonflux_inst%dwt_seedc_to_leaf_patch(p) - - c14_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_patch(p) = dwt_deadstemc14_seed(p)/dt - c14_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc(g) = & - c14_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_grc(g) + & - c14_cnveg_carbonflux_inst%dwt_seedc_to_deadstem_patch(p) - endif - - ! N fluxes - cnveg_nitrogenflux_inst%dwt_seedn_to_leaf_patch(p) = dwt_leafn_seed(p)/dt - cnveg_nitrogenflux_inst%dwt_seedn_to_leaf_grc(g) = & - cnveg_nitrogenflux_inst%dwt_seedn_to_leaf_grc(g) + & - cnveg_nitrogenflux_inst%dwt_seedn_to_leaf_patch(p) - - cnveg_nitrogenflux_inst%dwt_seedn_to_deadstem_patch(p) = dwt_deadstemn_seed(p)/dt - cnveg_nitrogenflux_inst%dwt_seedn_to_deadstem_grc(g) = & - cnveg_nitrogenflux_inst%dwt_seedn_to_deadstem_grc(g) + & - cnveg_nitrogenflux_inst%dwt_seedn_to_deadstem_patch(p) - - end do - - - ! calculate patch-to-column slash fluxes into litter and CWD pools - do p = bounds%begp, bounds%endp - c = patch%column(p) - - ! fine and coarse root to litter and CWD slash carbon fluxes - cnveg_carbonflux_inst%dwt_slash_cflux_col(c) = & - cnveg_carbonflux_inst%dwt_slash_cflux_col(c) + & - dwt_frootc_to_litter(p)/dt + & - dwt_livecrootc_to_litter(p)/dt + & - dwt_deadcrootc_to_litter(p)/dt - - if ( use_c13 ) then - c13_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) = & - c13_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) + & - dwt_frootc13_to_litter(p)/dt + & - dwt_livecrootc13_to_litter(p)/dt + & - dwt_deadcrootc13_to_litter(p)/dt - endif - - if ( use_c14 ) then - c14_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) = & - c14_cnveg_carbonflux_inst%dwt_slash_cflux_col(c) + & - dwt_frootc14_to_litter(p)/dt + & - dwt_livecrootc14_to_litter(p)/dt + & - dwt_deadcrootc14_to_litter(p)/dt - endif - - end do - - - ! calculate patch-to-column for fluxes into litter and CWD pools - do j = 1, nlevdecomp - do p = bounds%begp, bounds%endp - c = patch%column(p) - - ! fine root litter carbon fluxes - cnveg_carbonflux_inst%dwt_frootc_to_litr_met_c_col(c,j) = & - cnveg_carbonflux_inst%dwt_frootc_to_litr_met_c_col(c,j) + & - (dwt_frootc_to_litter(p)*pftcon%fr_flab(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - cnveg_carbonflux_inst%dwt_frootc_to_litr_cel_c_col(c,j) = & - cnveg_carbonflux_inst%dwt_frootc_to_litr_cel_c_col(c,j) + & - (dwt_frootc_to_litter(p)*pftcon%fr_fcel(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - cnveg_carbonflux_inst%dwt_frootc_to_litr_lig_c_col(c,j) = & - cnveg_carbonflux_inst%dwt_frootc_to_litr_lig_c_col(c,j) + & - (dwt_frootc_to_litter(p)*pftcon%fr_flig(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - - ! fine root litter nitrogen fluxes - cnveg_nitrogenflux_inst%dwt_frootn_to_litr_met_n_col(c,j) = & - cnveg_nitrogenflux_inst%dwt_frootn_to_litr_met_n_col(c,j) + & - (dwt_frootn_to_litter(p)*pftcon%fr_flab(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - cnveg_nitrogenflux_inst%dwt_frootn_to_litr_cel_n_col(c,j) = & - cnveg_nitrogenflux_inst%dwt_frootn_to_litr_cel_n_col(c,j) + & - (dwt_frootn_to_litter(p)*pftcon%fr_fcel(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - cnveg_nitrogenflux_inst%dwt_frootn_to_litr_lig_n_col(c,j) = & - cnveg_nitrogenflux_inst%dwt_frootn_to_litr_lig_n_col(c,j) + & - (dwt_frootn_to_litter(p)*pftcon%fr_flig(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - ! livecroot fluxes to cwd - cnveg_carbonflux_inst%dwt_livecrootc_to_cwdc_col(c,j) = & - cnveg_carbonflux_inst%dwt_livecrootc_to_cwdc_col(c,j) + & - (dwt_livecrootc_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - cnveg_nitrogenflux_inst%dwt_livecrootn_to_cwdn_col(c,j) = & - cnveg_nitrogenflux_inst%dwt_livecrootn_to_cwdn_col(c,j) + & - (dwt_livecrootn_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - ! deadcroot fluxes to cwd - cnveg_carbonflux_inst%dwt_deadcrootc_to_cwdc_col(c,j) = & - cnveg_carbonflux_inst%dwt_deadcrootc_to_cwdc_col(c,j) + & - (dwt_deadcrootc_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - cnveg_nitrogenflux_inst%dwt_deadcrootn_to_cwdn_col(c,j) = & - cnveg_nitrogenflux_inst%dwt_deadcrootn_to_cwdn_col(c,j) + & - (dwt_deadcrootn_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - if ( use_c13 ) then - ! C13 fine root litter fluxes - c13_cnveg_carbonflux_inst%dwt_frootc_to_litr_met_c_col(c,j) = & - c13_cnveg_carbonflux_inst%dwt_frootc_to_litr_met_c_col(c,j) + & - (dwt_frootc13_to_litter(p)*pftcon%fr_flab(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - c13_cnveg_carbonflux_inst%dwt_frootc_to_litr_cel_c_col(c,j) = & - c13_cnveg_carbonflux_inst%dwt_frootc_to_litr_cel_c_col(c,j) + & - (dwt_frootc13_to_litter(p)*pftcon%fr_fcel(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - c13_cnveg_carbonflux_inst%dwt_frootc_to_litr_lig_c_col(c,j) = & - c13_cnveg_carbonflux_inst%dwt_frootc_to_litr_lig_c_col(c,j) + & - (dwt_frootc13_to_litter(p)*pftcon%fr_flig(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - ! livecroot fluxes to cwd - c13_cnveg_carbonflux_inst%dwt_livecrootc_to_cwdc_col(c,j) = & - c13_cnveg_carbonflux_inst%dwt_livecrootc_to_cwdc_col(c,j) + & - (dwt_livecrootc13_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - ! deadcroot fluxes to cwd - c13_cnveg_carbonflux_inst%dwt_deadcrootc_to_cwdc_col(c,j) = & - c13_cnveg_carbonflux_inst%dwt_deadcrootc_to_cwdc_col(c,j) + & - (dwt_deadcrootc13_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - endif - - if ( use_c14 ) then - ! C14 fine root litter fluxes - c14_cnveg_carbonflux_inst%dwt_frootc_to_litr_met_c_col(c,j) = & - c14_cnveg_carbonflux_inst%dwt_frootc_to_litr_met_c_col(c,j) + & - (dwt_frootc14_to_litter(p)*pftcon%fr_flab(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - c14_cnveg_carbonflux_inst%dwt_frootc_to_litr_cel_c_col(c,j) = & - c14_cnveg_carbonflux_inst%dwt_frootc_to_litr_cel_c_col(c,j) + & - (dwt_frootc14_to_litter(p)*pftcon%fr_fcel(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - c14_cnveg_carbonflux_inst%dwt_frootc_to_litr_lig_c_col(c,j) = & - c14_cnveg_carbonflux_inst%dwt_frootc_to_litr_lig_c_col(c,j) + & - (dwt_frootc14_to_litter(p)*pftcon%fr_flig(patch%itype(p)))/dt & - * soilbiogeochem_state_inst%froot_prof_patch(p,j) - - ! livecroot fluxes to cwd - c14_cnveg_carbonflux_inst%dwt_livecrootc_to_cwdc_col(c,j) = & - c14_cnveg_carbonflux_inst%dwt_livecrootc_to_cwdc_col(c,j) + & - (dwt_livecrootc14_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - - ! deadcroot fluxes to cwd - c14_cnveg_carbonflux_inst%dwt_deadcrootc_to_cwdc_col(c,j) = & - c14_cnveg_carbonflux_inst%dwt_deadcrootc_to_cwdc_col(c,j) + & - (dwt_deadcrootc14_to_litter(p))/dt * soilbiogeochem_state_inst%croot_prof_patch(p,j) - endif - - end do - end do - - ! Store fluxes into product pools. Note that the temporary conv_cflux, wood_product_cflux - ! (and similar) fluxes are accumulated as negative values, but the values stored in - ! carbonflux_inst and nitrogenflux_inst are positive values. - do p = begp, endp - cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(p) = -wood_product_cflux(p)/dt - cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(p) = -crop_product_cflux(p)/dt - if (use_c13) then - c13_cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(p) = -wood_product_c13flux(p)/dt - c13_cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(p) = -crop_product_c13flux(p)/dt - end if - if (use_c14) then - c14_cnveg_carbonflux_inst%dwt_wood_productc_gain_patch(p) = -wood_product_c14flux(p)/dt - c14_cnveg_carbonflux_inst%dwt_crop_productc_gain_patch(p) = -crop_product_c14flux(p)/dt - end if - cnveg_nitrogenflux_inst%dwt_wood_productn_gain_patch(p) = -wood_product_nflux(p)/dt - cnveg_nitrogenflux_inst%dwt_crop_productn_gain_patch(p) = -crop_product_nflux(p)/dt - end do - - ! Set column-level conversion fluxes - - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - ! Note that patch-level fluxes are stored per unit GRIDCELL area - thus, we don't - ! need to multiply by the patch's gridcell weight when translating patch-level - ! fluxes into gridcell-level fluxes. - - cnveg_carbonflux_inst%dwt_conv_cflux_patch(p) = -conv_cflux(p)/dt - cnveg_carbonflux_inst%dwt_conv_cflux_grc(g) = & - cnveg_carbonflux_inst%dwt_conv_cflux_grc(g) + & - cnveg_carbonflux_inst%dwt_conv_cflux_patch(p) - - if ( use_c13 ) then - ! C13 column-level flux updates - c13_cnveg_carbonflux_inst%dwt_conv_cflux_patch(p) = -conv_c13flux(p)/dt - c13_cnveg_carbonflux_inst%dwt_conv_cflux_grc(g) = & - c13_cnveg_carbonflux_inst%dwt_conv_cflux_grc(g) + & - c13_cnveg_carbonflux_inst%dwt_conv_cflux_patch(p) - endif - - if ( use_c14 ) then - ! C14 column-level flux updates - c14_cnveg_carbonflux_inst%dwt_conv_cflux_patch(p) = -conv_c14flux(p)/dt - c14_cnveg_carbonflux_inst%dwt_conv_cflux_grc(g) = & - c14_cnveg_carbonflux_inst%dwt_conv_cflux_grc(g) + & - c14_cnveg_carbonflux_inst%dwt_conv_cflux_patch(p) - endif - - cnveg_nitrogenflux_inst%dwt_conv_nflux_patch(p) = -conv_nflux(p)/dt - cnveg_nitrogenflux_inst%dwt_conv_nflux_grc(g) = & - cnveg_nitrogenflux_inst%dwt_conv_nflux_grc(g) + & - cnveg_nitrogenflux_inst%dwt_conv_nflux_patch(p) - - end do - - ! Deallocate patch-level flux arrays - deallocate(dwt) - deallocate(dwt_leafc_seed) - deallocate(dwt_leafn_seed) - deallocate(dwt_deadstemc_seed) - deallocate(dwt_deadstemn_seed) - deallocate(dwt_frootc_to_litter) - deallocate(dwt_livecrootc_to_litter) - deallocate(dwt_deadcrootc_to_litter) - deallocate(dwt_frootn_to_litter) - deallocate(dwt_livecrootn_to_litter) - deallocate(dwt_deadcrootn_to_litter) - deallocate(conv_cflux) - deallocate(wood_product_cflux) - deallocate(crop_product_cflux) - deallocate(conv_nflux) - deallocate(wood_product_nflux) - deallocate(crop_product_nflux) - - if ( use_c13 ) then - deallocate(dwt_leafc13_seed) - deallocate(dwt_deadstemc13_seed) - deallocate(dwt_frootc13_to_litter) - deallocate(dwt_livecrootc13_to_litter) - deallocate(dwt_deadcrootc13_to_litter) - deallocate(conv_c13flux) - deallocate(wood_product_c13flux) - deallocate(crop_product_c13flux) - endif - - if ( use_c14 ) then - deallocate(dwt_leafc14_seed) - deallocate(dwt_deadstemc14_seed) - deallocate(dwt_frootc14_to_litter) - deallocate(dwt_livecrootc14_to_litter) - deallocate(dwt_deadcrootc14_to_litter) - deallocate(conv_c14flux) - deallocate(wood_product_c14flux) - deallocate(crop_product_c14flux) - endif - - end subroutine dyn_cnbal_patch - - !----------------------------------------------------------------------- - subroutine dyn_cnbal_col(bounds, clump_index, column_state_updater, & - soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst, & - ch4_inst) - ! - ! !DESCRIPTION: - ! Modify column-level state variables to maintain carbon and nitrogen balance with - ! dynamic column weights. - ! - ! !USES: - use dynColumnStateUpdaterMod, only : column_state_updater_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer , intent(in) :: clump_index - - type(column_state_updater_type) , intent(in) :: column_state_updater - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(ch4_type) , intent(inout) :: ch4_inst - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'dyn_cnbal_col' - !----------------------------------------------------------------------- - - call soilbiogeochem_carbonstate_inst%DynamicColumnAdjustments(bounds, clump_index, & - column_state_updater) - if (use_c13) then - call c13_soilbiogeochem_carbonstate_inst%DynamicColumnAdjustments(bounds, clump_index, & - column_state_updater) - end if - if (use_c14) then - call c14_soilbiogeochem_carbonstate_inst%DynamicColumnAdjustments(bounds, clump_index, & - column_state_updater) - end if - - call soilbiogeochem_nitrogenstate_inst%DynamicColumnAdjustments(bounds, clump_index, & - column_state_updater) - - if (use_lch4) then - call ch4_inst%DynamicColumnAdjustments(bounds, clump_index, column_state_updater) - end if - - end subroutine dyn_cnbal_col - - -end module dynConsBiogeochemMod diff --git a/src/biogeochem/dynHarvestMod.F90 b/src/biogeochem/dynHarvestMod.F90 deleted file mode 100644 index a9344fd5cf..0000000000 --- a/src/biogeochem/dynHarvestMod.F90 +++ /dev/null @@ -1,648 +0,0 @@ -module dynHarvestMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle reading of the harvest data, as well as the state updates that happen as a - ! result of harvest. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC - use abortutils , only : endrun - use dynFileMod , only : dyn_file_type - use dynVarTimeUninterpMod , only : dyn_var_time_uninterp_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegNitrogenStateType , only : cnveg_nitrogenstate_type - use CNVegNitrogenFluxType , only : cnveg_nitrogenflux_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use pftconMod , only : pftcon - use clm_varcon , only : grlnd - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - public :: dynHarvest_init ! initialize data structures for harvest information - public :: dynHarvest_interp ! get harvest data for current time step, if needed - public :: CNHarvest ! harvest mortality routine for CN code - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: CNHarvestPftToColumn ! gather patch-level harvest fluxes to the column level - ! - ! !PRIVATE TYPES: - - ! Note that, since we have our own dynHarvest_file object (distinct from dynpft_file), - ! we could theoretically have a separate file providing harvest data from that providing - ! the pftdyn data - type(dyn_file_type), target :: dynHarvest_file ! information for the file containing harvest data - - ! Define the underlying harvest variables - integer, parameter :: num_harvest_inst = 5 - character(len=64), parameter :: harvest_varnames(num_harvest_inst) = & - [character(len=64) :: 'HARVEST_VH1', 'HARVEST_VH2', 'HARVEST_SH1', 'HARVEST_SH2', 'HARVEST_SH3'] - - type(dyn_var_time_uninterp_type) :: harvest_inst(num_harvest_inst) ! value of each harvest variable - - real(r8) , allocatable :: harvest(:) ! harvest rates - logical :: do_harvest ! whether we're in a period when we should do harvest - character(len=*), parameter :: string_not_set = "not_set" ! string to initialize with to indicate string wasn't set - character(len=64) :: harvest_units = string_not_set ! units from harvest variables - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !--------------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine dynHarvest_init(bounds, harvest_filename) - ! - ! !DESCRIPTION: - ! Initialize data structures for harvest information. - ! This should be called once, during model initialization. - ! - ! !USES: - use dynVarTimeUninterpMod , only : dyn_var_time_uninterp_type - use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! proc-level bounds - character(len=*) , intent(in) :: harvest_filename ! name of file containing harvest information - ! - ! !LOCAL VARIABLES: - integer :: varnum ! counter for harvest variables - integer :: num_points ! number of spatial points - integer :: ier ! error code - character(len=64) :: units = string_not_set - - character(len=*), parameter :: subname = 'dynHarvest_init' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - allocate(harvest(bounds%begg:bounds%endg),stat=ier) - if (ier /= 0) then - call endrun(msg=' allocation error for harvest'//errMsg(sourcefile, __LINE__)) - end if - - ! Get the year from the START of the timestep for consistency with other dyn file - ! stuff (though it shouldn't actually matter for harvest, given the way the - ! once-per-year harvest is applied). - dynHarvest_file = dyn_file_type(harvest_filename, YEAR_POSITION_START_OF_TIMESTEP) - - ! Get initial harvest data - num_points = (bounds%endg - bounds%begg + 1) - do varnum = 1, num_harvest_inst - harvest_inst(varnum) = dyn_var_time_uninterp_type( & - dyn_file=dynHarvest_file, varname=harvest_varnames(varnum), & - dim1name=grlnd, conversion_factor=1.0_r8, & - do_check_sums_equal_1=.false., data_shape=[num_points]) - call harvest_inst(varnum)%get_att("units",units) - if ( trim(units) == string_not_set ) then - units = "unitless" - else if ( trim(units) == "unitless" ) then - - else if ( trim(units) /= "gC/m2/yr" ) then - call endrun(msg=' bad units read in from file='//trim(units)//errMsg(sourcefile, __LINE__)) - end if - if ( varnum > 1 .and. trim(units) /= trim(harvest_units) )then - call endrun(msg=' harvest units are inconsitent on file ='// & - trim(harvest_filename)//errMsg(sourcefile, __LINE__)) - end if - harvest_units = units - units = string_not_set - end do - - end subroutine dynHarvest_init - - - !----------------------------------------------------------------------- - subroutine dynHarvest_interp(bounds) - ! - ! !DESCRIPTION: - ! Get harvest data for model time, when needed. - ! - ! Note that harvest data are stored as rates (not weights) and so time interpolation - ! is not necessary - the harvest rate is held constant through the year. This is - ! consistent with the treatment of changing PFT weights, where interpolation of the - ! annual endpoint weights leads to a constant rate of change in PFT weight through the - ! year, with abrupt changes in the rate at annual boundaries. - ! - ! !USES: - use dynTimeInfoMod , only : time_info_type - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! proc-level bounds - ! - ! !LOCAL VARIABLES: - integer :: varnum ! counter for harvest variables - real(r8), allocatable :: this_data(:) ! data for a single harvest variable - - character(len=*), parameter :: subname = 'dynHarvest_interp' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - call dynHarvest_file%time_info%set_current_year() - - ! Get total harvest for this time step - harvest(bounds%begg:bounds%endg) = 0._r8 - - if (dynHarvest_file%time_info%is_before_time_series()) then - ! Turn off harvest before the start of the harvest time series - do_harvest = .false. - else - ! Note that do_harvest stays true even past the end of the time series. This - ! means that harvest rates will be maintained at the rate given in the last - ! year of the file for all years past the end of this specified time series. - do_harvest = .true. - allocate(this_data(bounds%begg:bounds%endg)) - do varnum = 1, num_harvest_inst - call harvest_inst(varnum)%get_current_data(this_data) - harvest(bounds%begg:bounds%endg) = harvest(bounds%begg:bounds%endg) + & - this_data(bounds%begg:bounds%endg) - end do - deallocate(this_data) - end if - - end subroutine dynHarvest_interp - - - !----------------------------------------------------------------------- - subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp, & - soilbiogeochem_state_inst, cnveg_carbonstate_inst, cnveg_nitrogenstate_inst, & - cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Harvest mortality routine for coupled carbon-nitrogen code (CN) - ! - ! !USES: - use pftconMod , only : noveg, nbrdlf_evr_shrub - use clm_varcon , only : secspday - use clm_time_manager, only : get_step_size_real, is_beg_curr_year - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! column filter for soil points - integer , intent(in) :: num_soilp ! number of soil patches in filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonstate_type) , intent(in) :: cnveg_carbonstate_inst - type(cnveg_nitrogenstate_type) , intent(in) :: cnveg_nitrogenstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - integer :: g ! gridcell index - integer :: fp ! patch filter index - real(r8):: thistreec ! carbon in this tree for calculating harvest fraction (gC/m2) - real(r8):: cm ! rate for carbon harvest mortality (gC/m2/yr) - real(r8):: am ! rate for fractional harvest mortality (1/yr) - real(r8):: m ! rate for fractional harvest mortality (1/s) - real(r8):: dtime ! model time step (s) - !----------------------------------------------------------------------- - - associate(& - ivt => patch%itype , & ! Input: [integer (:)] pft vegetation type - - leafc => cnveg_carbonstate_inst%leafc_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C - frootc => cnveg_carbonstate_inst%frootc_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C - livestemc => cnveg_carbonstate_inst%livestemc_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C - deadstemc => cnveg_carbonstate_inst%deadstemc_patch , & ! Input: [real(r8) (:)] (gC/m2) dead stem C - livecrootc => cnveg_carbonstate_inst%livecrootc_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C - deadcrootc => cnveg_carbonstate_inst%deadcrootc_patch , & ! Input: [real(r8) (:)] (gC/m2) dead coarse root C - xsmrpool => cnveg_carbonstate_inst%xsmrpool_patch , & ! Input: [real(r8) (:)] (gC/m2) abstract C pool to meet excess MR demand - leafc_storage => cnveg_carbonstate_inst%leafc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C storage - frootc_storage => cnveg_carbonstate_inst%frootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C storage - livestemc_storage => cnveg_carbonstate_inst%livestemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C storage - deadstemc_storage => cnveg_carbonstate_inst%deadstemc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead stem C storage - livecrootc_storage => cnveg_carbonstate_inst%livecrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C storage - deadcrootc_storage => cnveg_carbonstate_inst%deadcrootc_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) dead coarse root C storage - gresp_storage => cnveg_carbonstate_inst%gresp_storage_patch , & ! Input: [real(r8) (:)] (gC/m2) growth respiration storage - leafc_xfer => cnveg_carbonstate_inst%leafc_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) leaf C transfer - frootc_xfer => cnveg_carbonstate_inst%frootc_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) fine root C transfer - livestemc_xfer => cnveg_carbonstate_inst%livestemc_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) live stem C transfer - deadstemc_xfer => cnveg_carbonstate_inst%deadstemc_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) dead stem C transfer - livecrootc_xfer => cnveg_carbonstate_inst%livecrootc_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) live coarse root C transfer - deadcrootc_xfer => cnveg_carbonstate_inst%deadcrootc_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) dead coarse root C transfer - gresp_xfer => cnveg_carbonstate_inst%gresp_xfer_patch , & ! Input: [real(r8) (:)] (gC/m2) growth respiration transfer - - leafn => cnveg_nitrogenstate_inst%leafn_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N - frootn => cnveg_nitrogenstate_inst%frootn_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N - livestemn => cnveg_nitrogenstate_inst%livestemn_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N - deadstemn => cnveg_nitrogenstate_inst%deadstemn_patch , & ! Input: [real(r8) (:)] (gN/m2) dead stem N - livecrootn => cnveg_nitrogenstate_inst%livecrootn_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N - deadcrootn => cnveg_nitrogenstate_inst%deadcrootn_patch , & ! Input: [real(r8) (:)] (gN/m2) dead coarse root N - retransn => cnveg_nitrogenstate_inst%retransn_patch , & ! Input: [real(r8) (:)] (gN/m2) plant pool of retranslocated N - leafn_storage => cnveg_nitrogenstate_inst%leafn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N storage - frootn_storage => cnveg_nitrogenstate_inst%frootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N storage - livestemn_storage => cnveg_nitrogenstate_inst%livestemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N storage - deadstemn_storage => cnveg_nitrogenstate_inst%deadstemn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead stem N storage - livecrootn_storage => cnveg_nitrogenstate_inst%livecrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N storage - deadcrootn_storage => cnveg_nitrogenstate_inst%deadcrootn_storage_patch , & ! Input: [real(r8) (:)] (gN/m2) dead coarse root N storage - leafn_xfer => cnveg_nitrogenstate_inst%leafn_xfer_patch , & ! Input: [real(r8) (:)] (gN/m2) leaf N transfer - frootn_xfer => cnveg_nitrogenstate_inst%frootn_xfer_patch , & ! Input: [real(r8) (:)] (gN/m2) fine root N transfer - livestemn_xfer => cnveg_nitrogenstate_inst%livestemn_xfer_patch , & ! Input: [real(r8) (:)] (gN/m2) live stem N transfer - deadstemn_xfer => cnveg_nitrogenstate_inst%deadstemn_xfer_patch , & ! Input: [real(r8) (:)] (gN/m2) dead stem N transfer - livecrootn_xfer => cnveg_nitrogenstate_inst%livecrootn_xfer_patch , & ! Input: [real(r8) (:)] (gN/m2) live coarse root N transfer - deadcrootn_xfer => cnveg_nitrogenstate_inst%deadcrootn_xfer_patch , & ! Input: [real(r8) (:)] (gN/m2) dead coarse root N transfer - - hrv_leafc_to_litter => cnveg_carbonflux_inst%hrv_leafc_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_frootc_to_litter => cnveg_carbonflux_inst%hrv_frootc_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livestemc_to_litter => cnveg_carbonflux_inst%hrv_livestemc_to_litter_patch , & ! Output: [real(r8) (:)] - wood_harvestc => cnveg_carbonflux_inst%wood_harvestc_patch , & ! Output: [real(r8) (:)] - hrv_livecrootc_to_litter => cnveg_carbonflux_inst%hrv_livecrootc_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadcrootc_to_litter => cnveg_carbonflux_inst%hrv_deadcrootc_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_xsmrpool_to_atm => cnveg_carbonflux_inst%hrv_xsmrpool_to_atm_patch , & ! Output: [real(r8) (:)] - hrv_leafc_storage_to_litter => cnveg_carbonflux_inst%hrv_leafc_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_frootc_storage_to_litter => cnveg_carbonflux_inst%hrv_frootc_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livestemc_storage_to_litter => cnveg_carbonflux_inst%hrv_livestemc_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadstemc_storage_to_litter => cnveg_carbonflux_inst%hrv_deadstemc_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livecrootc_storage_to_litter => cnveg_carbonflux_inst%hrv_livecrootc_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadcrootc_storage_to_litter => cnveg_carbonflux_inst%hrv_deadcrootc_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_gresp_storage_to_litter => cnveg_carbonflux_inst%hrv_gresp_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_leafc_xfer_to_litter => cnveg_carbonflux_inst%hrv_leafc_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_frootc_xfer_to_litter => cnveg_carbonflux_inst%hrv_frootc_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livestemc_xfer_to_litter => cnveg_carbonflux_inst%hrv_livestemc_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadstemc_xfer_to_litter => cnveg_carbonflux_inst%hrv_deadstemc_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livecrootc_xfer_to_litter => cnveg_carbonflux_inst%hrv_livecrootc_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadcrootc_xfer_to_litter => cnveg_carbonflux_inst%hrv_deadcrootc_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_gresp_xfer_to_litter => cnveg_carbonflux_inst%hrv_gresp_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - - hrv_leafn_to_litter => cnveg_nitrogenflux_inst%hrv_leafn_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_frootn_to_litter => cnveg_nitrogenflux_inst%hrv_frootn_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livestemn_to_litter => cnveg_nitrogenflux_inst%hrv_livestemn_to_litter_patch , & ! Output: [real(r8) (:)] - wood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_patch , & ! Output: [real(r8) (:)] - hrv_livecrootn_to_litter => cnveg_nitrogenflux_inst%hrv_livecrootn_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadcrootn_to_litter => cnveg_nitrogenflux_inst%hrv_deadcrootn_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_retransn_to_litter => cnveg_nitrogenflux_inst%hrv_retransn_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_leafn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_leafn_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_frootn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_frootn_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livestemn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_livestemn_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadstemn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_deadstemn_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livecrootn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_livecrootn_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadcrootn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_deadcrootn_storage_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_leafn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_leafn_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_frootn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_frootn_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livestemn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_livestemn_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadstemn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_deadstemn_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_livecrootn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_livecrootn_xfer_to_litter_patch , & ! Output: [real(r8) (:)] - hrv_deadcrootn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_deadcrootn_xfer_to_litter_patch & ! Output: [real(r8) (:)] - ) - - dtime = get_step_size_real() - - ! patch loop - do fp = 1,num_soilp - p = filter_soilp(fp) - g = patch%gridcell(p) - - ! If this is a tree pft, then - ! get the annual harvest "mortality" rate (am) from harvest array - ! and convert to rate per second - if (ivt(p) > noveg .and. ivt(p) < nbrdlf_evr_shrub) then - - if (do_harvest) then - if (harvest_units == "gC/m2/yr") then - thistreec = leafc(p) + frootc(p) + livestemc(p) + deadstemc(p) + livecrootc(p) + deadcrootc(p) + xsmrpool(p) - cm = harvest(g) - if (thistreec > 0.0_r8) then - am = min(0.98_r8,cm/thistreec) ! Only harvest up to 98% so regrowth is possible PJL - else - am = 0._r8 - end if - else - am = harvest(g) - end if - - ! Apply all harvest at the start of the year - if (is_beg_curr_year()) then - m = am/dtime - else - m = 0._r8 - end if - else - m = 0._r8 - end if - - ! patch-level harvest carbon fluxes - ! displayed pools - hrv_leafc_to_litter(p) = leafc(p) * m - hrv_frootc_to_litter(p) = frootc(p) * m - hrv_livestemc_to_litter(p) = livestemc(p) * m - wood_harvestc(p) = deadstemc(p) * m - hrv_livecrootc_to_litter(p) = livecrootc(p) * m - hrv_deadcrootc_to_litter(p) = deadcrootc(p) * m - hrv_xsmrpool_to_atm(p) = xsmrpool(p) * m - - ! storage pools - hrv_leafc_storage_to_litter(p) = leafc_storage(p) * m - hrv_frootc_storage_to_litter(p) = frootc_storage(p) * m - hrv_livestemc_storage_to_litter(p) = livestemc_storage(p) * m - hrv_deadstemc_storage_to_litter(p) = deadstemc_storage(p) * m - hrv_livecrootc_storage_to_litter(p) = livecrootc_storage(p) * m - hrv_deadcrootc_storage_to_litter(p) = deadcrootc_storage(p) * m - hrv_gresp_storage_to_litter(p) = gresp_storage(p) * m - - ! transfer pools - hrv_leafc_xfer_to_litter(p) = leafc_xfer(p) * m - hrv_frootc_xfer_to_litter(p) = frootc_xfer(p) * m - hrv_livestemc_xfer_to_litter(p) = livestemc_xfer(p) * m - hrv_deadstemc_xfer_to_litter(p) = deadstemc_xfer(p) * m - hrv_livecrootc_xfer_to_litter(p) = livecrootc_xfer(p) * m - hrv_deadcrootc_xfer_to_litter(p) = deadcrootc_xfer(p) * m - hrv_gresp_xfer_to_litter(p) = gresp_xfer(p) * m - - ! patch-level harvest mortality nitrogen fluxes - ! displayed pools - hrv_leafn_to_litter(p) = leafn(p) * m - hrv_frootn_to_litter(p) = frootn(p) * m - hrv_livestemn_to_litter(p) = livestemn(p) * m - wood_harvestn(p) = deadstemn(p) * m - hrv_livecrootn_to_litter(p) = livecrootn(p) * m - hrv_deadcrootn_to_litter(p) = deadcrootn(p) * m - hrv_retransn_to_litter(p) = retransn(p) * m - - ! storage pools - hrv_leafn_storage_to_litter(p) = leafn_storage(p) * m - hrv_frootn_storage_to_litter(p) = frootn_storage(p) * m - hrv_livestemn_storage_to_litter(p) = livestemn_storage(p) * m - hrv_deadstemn_storage_to_litter(p) = deadstemn_storage(p) * m - hrv_livecrootn_storage_to_litter(p) = livecrootn_storage(p) * m - hrv_deadcrootn_storage_to_litter(p) = deadcrootn_storage(p) * m - - ! transfer pools - hrv_leafn_xfer_to_litter(p) = leafn_xfer(p) * m - hrv_frootn_xfer_to_litter(p) = frootn_xfer(p) * m - hrv_livestemn_xfer_to_litter(p) = livestemn_xfer(p) * m - hrv_deadstemn_xfer_to_litter(p) = deadstemn_xfer(p) * m - hrv_livecrootn_xfer_to_litter(p) = livecrootn_xfer(p) * m - hrv_deadcrootn_xfer_to_litter(p) = deadcrootn_xfer(p) * m - - end if ! end tree block - - end do ! end of pft loop - - ! gather all patch-level litterfall fluxes from harvest to the column - ! for litter C and N inputs - - call CNHarvestPftToColumn(num_soilc, filter_soilc, & - soilbiogeochem_state_inst, cnveg_carbonflux_inst, cnveg_nitrogenflux_inst) - - end associate - - end subroutine CNHarvest - - !----------------------------------------------------------------------- - subroutine CNHarvestPftToColumn (num_soilc, filter_soilc, & - soilbiogeochem_state_inst, CNVeg_carbonflux_inst, cnveg_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! called at the end of CNHarvest to gather all patch-level harvest litterfall fluxes - ! to the column level and assign them to the three litter pools - ! - ! !USES: - use clm_varpar , only : maxpatch_pft, nlevdecomp - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! soil column filter - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c,pi,p,j ! indices - !----------------------------------------------------------------------- - - associate( & - ivt => patch%itype , & ! Input: [integer (:) ] pft vegetation type - wtcol => patch%wtcol , & ! Input: [real(r8) (:) ] pft weight relative to column (0-1) - - lf_flab => pftcon%lf_flab , & ! Input: leaf litter labile fraction - lf_fcel => pftcon%lf_fcel , & ! Input: leaf litter cellulose fraction - lf_flig => pftcon%lf_flig , & ! Input: leaf litter lignin fraction - fr_flab => pftcon%fr_flab , & ! Input: fine root litter labile fraction - fr_fcel => pftcon%fr_fcel , & ! Input: fine root litter cellulose fraction - fr_flig => pftcon%fr_flig , & ! Input: fine root litter lignin fraction - - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => soilbiogeochem_state_inst%croot_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => soilbiogeochem_state_inst%stem_prof_patch , & ! Input: [real(r8) (:,:) ] (1/m) profile of stems - - hrv_leafc_to_litter => cnveg_carbonflux_inst%hrv_leafc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootc_to_litter => cnveg_carbonflux_inst%hrv_frootc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemc_to_litter => cnveg_carbonflux_inst%hrv_livestemc_to_litter_patch , & ! Input: [real(r8) (:) ] - pwood_harvestc => cnveg_carbonflux_inst%wood_harvestc_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootc_to_litter => cnveg_carbonflux_inst%hrv_livecrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootc_to_litter => cnveg_carbonflux_inst%hrv_deadcrootc_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_leafc_storage_to_litter => cnveg_carbonflux_inst%hrv_leafc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootc_storage_to_litter => cnveg_carbonflux_inst%hrv_frootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemc_storage_to_litter => cnveg_carbonflux_inst%hrv_livestemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadstemc_storage_to_litter => cnveg_carbonflux_inst%hrv_deadstemc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootc_storage_to_litter => cnveg_carbonflux_inst%hrv_livecrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootc_storage_to_litter => cnveg_carbonflux_inst%hrv_deadcrootc_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_gresp_storage_to_litter => cnveg_carbonflux_inst%hrv_gresp_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_leafc_xfer_to_litter => cnveg_carbonflux_inst%hrv_leafc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootc_xfer_to_litter => cnveg_carbonflux_inst%hrv_frootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemc_xfer_to_litter => cnveg_carbonflux_inst%hrv_livestemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadstemc_xfer_to_litter => cnveg_carbonflux_inst%hrv_deadstemc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootc_xfer_to_litter => cnveg_carbonflux_inst%hrv_livecrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootc_xfer_to_litter => cnveg_carbonflux_inst%hrv_deadcrootc_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_gresp_xfer_to_litter => cnveg_carbonflux_inst%hrv_gresp_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - cwood_harvestc => cnveg_carbonflux_inst%wood_harvestc_col , & ! InOut: [real(r8) (:) ] - harvest_c_to_litr_met_c => cnveg_carbonflux_inst%harvest_c_to_litr_met_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with harvest to litter metabolic pool (gC/m3/s) - harvest_c_to_litr_cel_c => cnveg_carbonflux_inst%harvest_c_to_litr_cel_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with harvest to litter cellulose pool (gC/m3/s) - harvest_c_to_litr_lig_c => cnveg_carbonflux_inst%harvest_c_to_litr_lig_c_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with harvest to litter lignin pool (gC/m3/s) - harvest_c_to_cwdc => cnveg_carbonflux_inst%harvest_c_to_cwdc_col , & ! InOut: [real(r8) (:,:) ] C fluxes associated with harvest to CWD pool (gC/m3/s) - - hrv_leafn_to_litter => cnveg_nitrogenflux_inst%hrv_leafn_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootn_to_litter => cnveg_nitrogenflux_inst%hrv_frootn_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemn_to_litter => cnveg_nitrogenflux_inst%hrv_livestemn_to_litter_patch , & ! Input: [real(r8) (:) ] - pwood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootn_to_litter => cnveg_nitrogenflux_inst%hrv_livecrootn_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootn_to_litter => cnveg_nitrogenflux_inst%hrv_deadcrootn_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_retransn_to_litter => cnveg_nitrogenflux_inst%hrv_retransn_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_leafn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_leafn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_frootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_livestemn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadstemn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_deadstemn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_livecrootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootn_storage_to_litter => cnveg_nitrogenflux_inst%hrv_deadcrootn_storage_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_leafn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_leafn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_frootn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_frootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livestemn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_livestemn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadstemn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_deadstemn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_livecrootn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_livecrootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - hrv_deadcrootn_xfer_to_litter => cnveg_nitrogenflux_inst%hrv_deadcrootn_xfer_to_litter_patch , & ! Input: [real(r8) (:) ] - cwood_harvestn => cnveg_nitrogenflux_inst%wood_harvestn_col , & ! InOut: [real(r8) (:) ] - harvest_n_to_litr_met_n => cnveg_nitrogenflux_inst%harvest_n_to_litr_met_n_col , & ! InOut: [real(r8) (:,:) ] N fluxes associated with harvest to litter metabolic pool (gN/m3/s) - harvest_n_to_litr_cel_n => cnveg_nitrogenflux_inst%harvest_n_to_litr_cel_n_col , & ! InOut: [real(r8) (:,:) ] N fluxes associated with harvest to litter cellulose pool (gN/m3/s) - harvest_n_to_litr_lig_n => cnveg_nitrogenflux_inst%harvest_n_to_litr_lig_n_col , & ! InOut: [real(r8) (:,:) ] N fluxes associated with harvest to litter lignin pool (gN/m3/s) - harvest_n_to_cwdn => cnveg_nitrogenflux_inst%harvest_n_to_cwdn_col & ! InOut: [real(r8) (:,:) ] N fluxes associated with harvest to CWD pool (gN/m3/s) - ) - - do j = 1, nlevdecomp - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - - ! leaf harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_cel_c(c,j) = harvest_c_to_litr_cel_c(c,j) + & - hrv_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_lig_c(c,j) = harvest_c_to_litr_lig_c(c,j) + & - hrv_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_cel_c(c,j) = harvest_c_to_litr_cel_c(c,j) + & - hrv_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_lig_c(c,j) = harvest_c_to_litr_lig_c(c,j) + & - hrv_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood harvest mortality carbon fluxes - harvest_c_to_cwdc(c,j) = harvest_c_to_cwdc(c,j) + & - hrv_livestemc_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_cwdc(c,j) = harvest_c_to_cwdc(c,j) + & - hrv_livecrootc_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_cwdc(c,j) = harvest_c_to_cwdc(c,j) + & - hrv_deadcrootc_to_litter(p) * wtcol(p) * croot_prof(p,j) - - ! storage harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_leafc_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_frootc_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livestemc_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadstemc_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livecrootc_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadcrootc_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_gresp_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! transfer harvest mortality carbon fluxes - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_leafc_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_frootc_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livestemc_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadstemc_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_livecrootc_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_deadcrootc_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_c_to_litr_met_c(c,j) = harvest_c_to_litr_met_c(c,j) + & - hrv_gresp_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! leaf harvest mortality nitrogen fluxes - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) * leaf_prof(p,j) - harvest_n_to_litr_cel_n(c,j) = harvest_n_to_litr_cel_n(c,j) + & - hrv_leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) * leaf_prof(p,j) - harvest_n_to_litr_lig_n(c,j) = harvest_n_to_litr_lig_n(c,j) + & - hrv_leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) * leaf_prof(p,j) - - ! fine root litter nitrogen fluxes - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) * froot_prof(p,j) - harvest_n_to_litr_cel_n(c,j) = harvest_n_to_litr_cel_n(c,j) + & - hrv_frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) * froot_prof(p,j) - harvest_n_to_litr_lig_n(c,j) = harvest_n_to_litr_lig_n(c,j) + & - hrv_frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) * froot_prof(p,j) - - ! wood harvest mortality nitrogen fluxes - harvest_n_to_cwdn(c,j) = harvest_n_to_cwdn(c,j) + & - hrv_livestemn_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_n_to_cwdn(c,j) = harvest_n_to_cwdn(c,j) + & - hrv_livecrootn_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_n_to_cwdn(c,j) = harvest_n_to_cwdn(c,j) + & - hrv_deadcrootn_to_litter(p) * wtcol(p) * croot_prof(p,j) - - ! retranslocated N pool harvest mortality fluxes - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_retransn_to_litter(p) * wtcol(p) * leaf_prof(p,j) - - ! storage harvest mortality nitrogen fluxes - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_leafn_storage_to_litter(p) * wtcol(p) * leaf_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_frootn_storage_to_litter(p) * wtcol(p) * froot_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_livestemn_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_deadstemn_storage_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_livecrootn_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_deadcrootn_storage_to_litter(p) * wtcol(p) * croot_prof(p,j) - - ! transfer harvest mortality nitrogen fluxes - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_leafn_xfer_to_litter(p) * wtcol(p) * leaf_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_frootn_xfer_to_litter(p) * wtcol(p) * froot_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_livestemn_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_deadstemn_xfer_to_litter(p) * wtcol(p) * stem_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_livecrootn_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - harvest_n_to_litr_met_n(c,j) = harvest_n_to_litr_met_n(c,j) + & - hrv_deadcrootn_xfer_to_litter(p) * wtcol(p) * croot_prof(p,j) - - end if - end if - - end do - - end do - end do - - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - - if (patch%active(p)) then - ! wood harvest mortality carbon fluxes to product pools - cwood_harvestc(c) = cwood_harvestc(c) + & - pwood_harvestc(p) * wtcol(p) - - ! wood harvest mortality nitrogen fluxes to product pools - cwood_harvestn(c) = cwood_harvestn(c) + & - pwood_harvestn(p) * wtcol(p) - end if - end if - - end do - - end do - - end associate - - end subroutine CNHarvestPftToColumn - -end module dynHarvestMod diff --git a/src/biogeochem/test/CMakeLists.txt b/src/biogeochem/test/CMakeLists.txt deleted file mode 100644 index 15d41be10a..0000000000 --- a/src/biogeochem/test/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_subdirectory(Species_test) -add_subdirectory(CNVegComputeSeed_test) \ No newline at end of file diff --git a/src/biogeochem/test/CNVegComputeSeed_test/CMakeLists.txt b/src/biogeochem/test/CNVegComputeSeed_test/CMakeLists.txt deleted file mode 100644 index 35173a6dc3..0000000000 --- a/src/biogeochem/test/CNVegComputeSeed_test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set (pfunit_sources - test_ComputeSeedAmounts.pf) - -create_pFUnit_test(CNVegComputeSeed test_CNVegComputeSeed_exe - "${pfunit_sources}" "") - -target_link_libraries(test_CNVegComputeSeed_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/biogeochem/test/CNVegComputeSeed_test/test_ComputeSeedAmounts.pf b/src/biogeochem/test/CNVegComputeSeed_test/test_ComputeSeedAmounts.pf deleted file mode 100644 index f5e8aeff9b..0000000000 --- a/src/biogeochem/test/CNVegComputeSeed_test/test_ComputeSeedAmounts.pf +++ /dev/null @@ -1,361 +0,0 @@ -module test_ComputeSeedAmounts - - ! Tests of CNVegComputeSeedMod: ComputeSeedAmounts - - use pfunit_mod - use CNVegComputeSeedMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestFilterBuilderMod - use pftconMod - use CNSpeciesMod - use PatchType - use clm_varcon, only : c3_r2, c4_r2, c14ratio - - implicit none - - @TestCase - type, extends(TestCase) :: TestComputeSeed - ! filter - integer :: numf - integer, allocatable :: filter(:) - contains - procedure :: setUp - procedure :: tearDown - procedure :: do_ComputeSeedAmounts - end type TestComputeSeed - - real(r8), parameter :: tol = 1.e-13_r8 - - ! patch of interest - integer, parameter :: POI = begp + 1 - - ! PFT type in the patch of interest - integer, parameter :: POI_TYPE = 7 - - real(r8), parameter :: LEAFC_SEED = 12._r8 - real(r8), parameter :: DEADSTEMC_SEED = 13._r8 - - ! leaf contents in the patch of interest - real(r8), parameter :: LEAF_POI = 1._r8 - real(r8), parameter :: LEAF_STORAGE_POI = 2._r8 - real(r8), parameter :: LEAF_XFER_POI = 3._r8 - real(r8), parameter :: LEAF_TOTAL_POI = LEAF_POI + LEAF_STORAGE_POI + LEAF_XFER_POI - -contains - - subroutine setUp(this) - class(TestComputeSeed), intent(inout) :: this - integer :: pft_types(begp:begp+2) - - ! Tests use a grid with a single gridcell containing 3 vegetated patches, with a - ! filter active over all patches - pft_types(:) = 1 - pft_types(POI) = POI_TYPE - call setup_n_veg_patches(pwtcol = [0.25_r8, 0.5_r8, 0.25_r8], pft_types = pft_types) - call filter_from_range(bounds%begp, bounds%endp, this%numf, this%filter) - - ! Set relevant pftcon values to defaults; these should be overridden by individual - ! tests where they matter - call pftcon%InitForTesting() - pftcon%evergreen(:) = 0 - pftcon%woody(:) = 1 - pftcon%c3psn(:) = 1 - pftcon%leafcn(:) = 1._r8 - pftcon%deadwdcn(:) = 1._r8 - - end subroutine setUp - - subroutine tearDown(this) - class(TestComputeSeed), intent(inout) :: this - - call unittest_subgrid_teardown() - call pftcon%Clean() - end subroutine tearDown - - subroutine do_ComputeSeedAmounts(this, species, & - ignore_current_state, & - seed_leaf, seed_leaf_storage, seed_leaf_xfer, seed_deadstem) - ! Wraps the call to ComputeSeedAmounts - ! - ! Returns values for patch POI - class(TestComputeSeed), intent(inout) :: this - integer, intent(in) :: species - - ! if not provided, ignore_current_state is assumed to be false - logical, intent(in), optional :: ignore_current_state - - ! The following outputs are all for patch POI - real(r8), intent(out), optional :: seed_leaf - real(r8), intent(out), optional :: seed_leaf_storage - real(r8), intent(out), optional :: seed_leaf_xfer - real(r8), intent(out), optional :: seed_deadstem - - real(r8) :: leaf_patch(bounds%begp:bounds%endp) - real(r8) :: leaf_storage_patch(bounds%begp:bounds%endp) - real(r8) :: leaf_xfer_patch(bounds%begp:bounds%endp) - logical :: compute_here_patch(bounds%begp:bounds%endp) - logical :: ignore_current_state_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leaf_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leaf_storage_patch(bounds%begp:bounds%endp) - real(r8) :: seed_leaf_xfer_patch(bounds%begp:bounds%endp) - real(r8) :: seed_deadstem_patch(bounds%begp:bounds%endp) - - leaf_patch(:) = 0._r8 - leaf_patch(POI) = LEAF_POI - leaf_storage_patch(:) = 0._r8 - leaf_storage_patch(POI) = LEAF_STORAGE_POI - leaf_xfer_patch(:) = 0._r8 - leaf_xfer_patch(POI) = LEAF_XFER_POI - - compute_here_patch(:) = .true. - ignore_current_state_patch(:) = .false. - if (present(ignore_current_state)) then - ignore_current_state_patch(POI) = ignore_current_state - end if - - call ComputeSeedAmounts(bounds, & - this%numf, this%filter, & - species = species, & - leafc_seed = LEAFC_SEED, & - deadstemc_seed = DEADSTEMC_SEED, & - leaf_patch = leaf_patch, & - leaf_storage_patch = leaf_storage_patch, & - leaf_xfer_patch = leaf_xfer_patch, & - compute_here_patch = compute_here_patch, & - ignore_current_state_patch = ignore_current_state_patch, & - seed_leaf_patch = seed_leaf_patch, & - seed_leaf_storage_patch = seed_leaf_storage_patch, & - seed_leaf_xfer_patch = seed_leaf_xfer_patch, & - seed_deadstem_patch = seed_deadstem_patch) - - if (present(seed_leaf)) then - seed_leaf = seed_leaf_patch(POI) - end if - if (present(seed_leaf_storage)) then - seed_leaf_storage = seed_leaf_storage_patch(POI) - end if - if (present(seed_leaf_xfer)) then - seed_leaf_xfer = seed_leaf_xfer_patch(POI) - end if - if (present(seed_deadstem)) then - seed_deadstem = seed_deadstem_patch(POI) - end if - - end subroutine do_ComputeSeedAmounts - - @Test - subroutine c12_leaf(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_leaf - real(r8) :: expected - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - seed_leaf = seed_leaf) - - expected = LEAFC_SEED * LEAF_POI / LEAF_TOTAL_POI - @assertEqual(expected, seed_leaf, tolerance=tol) - end subroutine c12_leaf - - @Test - subroutine c12_leaf_storage(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_leaf_storage - real(r8) :: expected - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - seed_leaf_storage = seed_leaf_storage) - - expected = LEAFC_SEED * LEAF_STORAGE_POI / LEAF_TOTAL_POI - @assertEqual(expected, seed_leaf_storage, tolerance=tol) - end subroutine c12_leaf_storage - - @Test - subroutine c12_leaf_xfer(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_leaf_xfer - real(r8) :: expected - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - seed_leaf_xfer = seed_leaf_xfer) - - expected = LEAFC_SEED * LEAF_XFER_POI / LEAF_TOTAL_POI - @assertEqual(expected, seed_leaf_xfer, tolerance=tol) - end subroutine c12_leaf_xfer - - @Test - subroutine c12_deadstem_woody(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_deadstem - real(r8) :: expected - - pftcon%woody(POI_TYPE) = 1 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - seed_deadstem = seed_deadstem) - - expected = DEADSTEMC_SEED - @assertEqual(expected, seed_deadstem, tolerance=tol) - end subroutine c12_deadstem_woody - - @Test - subroutine c12_deadstem_nonwoody(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_deadstem - - pftcon%woody(POI_TYPE) = 0 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - seed_deadstem = seed_deadstem) - - @assertEqual(0._r8, seed_deadstem, tolerance=tol) - end subroutine c12_deadstem_nonwoody - - @Test - subroutine c12_leaf_ignoreCurrentState_evergreen(this) - ! When ignoring the current state, for evergreen, all leaf seed amount should be put - ! in the leaf itself - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_leaf - real(r8) :: expected - - pftcon%evergreen(POI_TYPE) = 1 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - ignore_current_state = .true., & - seed_leaf = seed_leaf) - - expected = LEAFC_SEED - @assertEqual(expected, seed_leaf, tolerance=tol) - end subroutine c12_leaf_ignoreCurrentState_evergreen - - @Test - subroutine c12_leaf_storage_ignoreCurrentState_nonEvergreen(this) - ! When ignoring the current state, for evergreen, all leaf seed amount should be put - ! in leaf storage - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_leaf_storage - real(r8) :: expected - - pftcon%evergreen(POI_TYPE) = 0 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - ignore_current_state = .true., & - seed_leaf_storage = seed_leaf_storage) - - expected = LEAFC_SEED - @assertEqual(expected, seed_leaf_storage, tolerance=tol) - end subroutine c12_leaf_storage_ignoreCurrentState_nonEvergreen - - @Test - subroutine c13_deadstem_woody_c3(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_deadstem - real(r8) :: expected - - pftcon%woody(POI_TYPE) = 1 - pftcon%c3psn(POI_TYPE) = 1 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C13, & - seed_deadstem = seed_deadstem) - - expected = DEADSTEMC_SEED * c3_r2 - @assertEqual(expected, seed_deadstem, tolerance=tol) - end subroutine c13_deadstem_woody_c3 - - @Test - subroutine c13_deadstem_woody_c4(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_deadstem - real(r8) :: expected - - pftcon%woody(POI_TYPE) = 1 - pftcon%c3psn(POI_TYPE) = 0 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C13, & - seed_deadstem = seed_deadstem) - - expected = DEADSTEMC_SEED * c4_r2 - @assertEqual(expected, seed_deadstem, tolerance=tol) - end subroutine c13_deadstem_woody_c4 - - @Test - subroutine c14_deadstem_woody(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_deadstem - real(r8) :: expected - - pftcon%woody(POI_TYPE) = 1 - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C14, & - seed_deadstem = seed_deadstem) - - expected = DEADSTEMC_SEED * c14ratio - @assertEqual(expected, seed_deadstem, tolerance=tol) - end subroutine c14_deadstem_woody - - @Test - subroutine n_leaf(this) - class(TestComputeSeed), intent(inout) :: this - real(r8), parameter :: leafcn = 10._r8 - real(r8) :: seed_leaf - real(r8) :: expected - - pftcon%leafcn(POI_TYPE) = leafcn - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_N, & - seed_leaf = seed_leaf) - - expected = (LEAFC_SEED / leafcn) * (LEAF_POI / LEAF_TOTAL_POI) - @assertEqual(expected, seed_leaf, tolerance=tol) - end subroutine n_leaf - - @Test - subroutine n_deadstem_woody(this) - class(TestComputeSeed), intent(inout) :: this - real(r8), parameter :: deadwdcn = 10._r8 - real(r8) :: seed_deadstem - real(r8) :: expected - - pftcon%deadwdcn(POI_TYPE) = deadwdcn - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_N, & - seed_deadstem = seed_deadstem) - - expected = DEADSTEMC_SEED / deadwdcn - @assertEqual(expected, seed_deadstem, tolerance=tol) - end subroutine n_deadstem_woody - - @Test - subroutine nonveg(this) - class(TestComputeSeed), intent(inout) :: this - real(r8) :: seed_leaf, seed_leaf_storage, seed_leaf_xfer, seed_deadstem - - patch%itype(POI) = noveg - - call this%do_ComputeSeedAmounts( & - species = CN_SPECIES_C12, & - seed_leaf = seed_leaf, seed_leaf_storage = seed_leaf_storage, & - seed_leaf_xfer = seed_leaf_xfer, seed_deadstem = seed_deadstem) - - @assertEqual(0._r8, seed_leaf) - @assertEqual(0._r8, seed_leaf_storage) - @assertEqual(0._r8, seed_leaf_xfer) - @assertEqual(0._r8, seed_deadstem) - end subroutine nonveg - -end module test_ComputeSeedAmounts - diff --git a/src/biogeochem/test/Species_test/CMakeLists.txt b/src/biogeochem/test/Species_test/CMakeLists.txt deleted file mode 100644 index 3a0bc4b50c..0000000000 --- a/src/biogeochem/test/Species_test/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -set (pfunit_sources - test_SpeciesNonIsotope.pf - test_SpeciesIsotope.pf) - -create_pFUnit_test(Species test_Species_exe - "${pfunit_sources}" "") - -target_link_libraries(test_Species_exe clm csm_share) \ No newline at end of file diff --git a/src/biogeochem/test/Species_test/test_SpeciesIsotope.pf b/src/biogeochem/test/Species_test/test_SpeciesIsotope.pf deleted file mode 100644 index 8199b1c92a..0000000000 --- a/src/biogeochem/test/Species_test/test_SpeciesIsotope.pf +++ /dev/null @@ -1,95 +0,0 @@ -module test_SpeciesIsotope - - ! Tests of SpeciesIsotopeType - - use pfunit_mod - use SpeciesIsotopeType - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestSpeciesIsotope - contains - procedure :: setUp - procedure :: tearDown - end type TestSpeciesIsotope - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - subroutine setUp(this) - class(TestSpeciesIsotope), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestSpeciesIsotope), intent(inout) :: this - end subroutine tearDown - - @Test - subroutine histFname_noSuffix(this) - class(TestSpeciesIsotope), intent(inout) :: this - type(species_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_isotope_type('C', '13') - - fname = species%hist_fname('FOO') - - @assertEqual('C13_FOOC', fname) - end subroutine histFname_noSuffix - - @Test - subroutine histFname_withSuffix(this) - class(TestSpeciesIsotope), intent(inout) :: this - type(species_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_isotope_type('C', '13') - - fname = species%hist_fname('FOO', suffix='_BAR') - - @assertEqual('C13_FOOC_BAR', fname) - end subroutine histFname_withSuffix - - @Test - subroutine restFname_noSuffix(this) - class(TestSpeciesIsotope), intent(inout) :: this - type(species_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_isotope_type('C', '13') - - fname = species%rest_fname('foo') - - @assertEqual('fooc_13', fname) - end subroutine restFname_noSuffix - - @Test - subroutine restFname_withSuffix(this) - class(TestSpeciesIsotope), intent(inout) :: this - type(species_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_isotope_type('C', '13') - - fname = species%rest_fname('foo', suffix='_bar') - - @assertEqual('fooc_13_bar', fname) - end subroutine restFname_withSuffix - - @Test - subroutine getSpecies(this) - class(TestSpeciesIsotope), intent(inout) :: this - type(species_isotope_type) :: species - character(len=:), allocatable :: species_name - - species = species_isotope_type('C', '13') - - species_name = species%get_species() - - @assertEqual('C13', species_name) - end subroutine getSpecies - -end module test_SpeciesIsotope diff --git a/src/biogeochem/test/Species_test/test_SpeciesNonIsotope.pf b/src/biogeochem/test/Species_test/test_SpeciesNonIsotope.pf deleted file mode 100644 index e9e4b9fac5..0000000000 --- a/src/biogeochem/test/Species_test/test_SpeciesNonIsotope.pf +++ /dev/null @@ -1,83 +0,0 @@ -module test_SpeciesNonIsotope - - ! Tests of SpeciesNonIsotopeType - - use pfunit_mod - use SpeciesNonIsotopeType - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestSpeciesNonIsotope - contains - procedure :: setUp - procedure :: tearDown - end type TestSpeciesNonIsotope - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - subroutine setUp(this) - class(TestSpeciesNonIsotope), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestSpeciesNonIsotope), intent(inout) :: this - end subroutine tearDown - - @Test - subroutine histFname_noSuffix(this) - class(TestSpeciesNonIsotope), intent(inout) :: this - type(species_non_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_non_isotope_type('C') - - fname = species%hist_fname('FOO') - - @assertEqual('FOOC', fname) - end subroutine histFname_noSuffix - - @Test - subroutine histFname_withSuffix(this) - class(TestSpeciesNonIsotope), intent(inout) :: this - type(species_non_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_non_isotope_type('C') - - fname = species%hist_fname('FOO', suffix='_BAR') - - @assertEqual('FOOC_BAR', fname) - end subroutine histFname_withSuffix - - @Test - subroutine restFname_noSuffix(this) - class(TestSpeciesNonIsotope), intent(inout) :: this - type(species_non_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_non_isotope_type('C') - - fname = species%rest_fname('foo') - - @assertEqual('fooc', fname) - end subroutine restFname_noSuffix - - @Test - subroutine restFname_withSuffix(this) - class(TestSpeciesNonIsotope), intent(inout) :: this - type(species_non_isotope_type) :: species - character(len=:), allocatable :: fname - - species = species_non_isotope_type('C') - - fname = species%rest_fname('foo', suffix='_bar') - - @assertEqual('fooc_bar', fname) - end subroutine restFname_withSuffix - - -end module test_SpeciesNonIsotope diff --git a/src/biogeophys/ActiveLayerMod.F90 b/src/biogeophys/ActiveLayerMod.F90 deleted file mode 100644 index a1b871829c..0000000000 --- a/src/biogeophys/ActiveLayerMod.F90 +++ /dev/null @@ -1,155 +0,0 @@ -module ActiveLayerMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines for calculation of active layer dynamics - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varctl , only : iulog - use TemperatureType , only : temperature_type - use CanopyStateType , only : canopystate_type - use GridcellType , only : grc - use ColumnType , only : col - ! - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: alt_calc - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine alt_calc(num_soilc, filter_soilc, & - temperature_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! define active layer thickness similarly to frost_table, except set as deepest thawed layer and define on nlevgrnd - ! also update annual maxima, and keep track of prior year for rooting memory - ! - ! BUG(wjs, 2014-12-15, bugz 2107) Because of this routine's placement in the driver - ! sequence (it is called very early in each timestep, before weights are adjusted and - ! filters are updated), it may be necessary for this routine to compute values over - ! inactive as well as active points (since some inactive points may soon become - ! active) - so that's what is done now. Currently, it seems to be okay to do this, - ! because the variables computed here seem to only depend on quantities that are valid - ! over inactive as well as active points. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevgrnd - use clm_time_manager , only : get_curr_date, get_step_size - use clm_varctl , only : iulog - use clm_varcon , only : zsoi - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(temperature_type) , intent(in) :: temperature_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc, g ! counters - integer :: alt_ind ! index of base of activel layer - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: dtime ! time step length in seconds - integer :: k_frz ! index of first nonfrozen soil layer - logical :: found_thawlayer ! used to break loop when first unfrozen layer reached - real(r8) :: t1, t2, z1, z2 ! temporary variables - !----------------------------------------------------------------------- - - associate( & - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - alt => canopystate_inst%alt_col , & ! Output: [real(r8) (:) ] current depth of thaw - altmax => canopystate_inst%altmax_col , & ! Output: [real(r8) (:) ] maximum annual depth of thaw - altmax_lastyear => canopystate_inst%altmax_lastyear_col , & ! Output: [real(r8) (:) ] prior year maximum annual depth of thaw - alt_indx => canopystate_inst%alt_indx_col , & ! Output: [integer (:) ] current depth of thaw - altmax_indx => canopystate_inst%altmax_indx_col , & ! Output: [integer (:) ] maximum annual depth of thaw - altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col & ! Output: [integer (:) ] prior year maximum annual depth of thaw - ) - - ! on a set annual timestep, update annual maxima - ! make this 1 January for NH columns, 1 July for SH columns - call get_curr_date(year, mon, day, sec) - dtime = get_step_size() - if ( (mon .eq. 1) .and. (day .eq. 1) .and. ( sec / dtime .eq. 1) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if ( grc%lat(g) > 0. ) then - altmax_lastyear(c) = altmax(c) - altmax_lastyear_indx(c) = altmax_indx(c) - altmax(c) = 0. - altmax_indx(c) = 0 - endif - end do - endif - if ( (mon .eq. 7) .and. (day .eq. 1) .and. ( sec / dtime .eq. 1) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - g = col%gridcell(c) - if ( grc%lat(g) <= 0. ) then - altmax_lastyear(c) = altmax(c) - altmax_lastyear_indx(c) = altmax_indx(c) - altmax(c) = 0. - altmax_indx(c) = 0 - endif - end do - endif - - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate alt for a given timestep - ! start from base of soil and search upwards for first thawed layer. - ! note that this will put talik in with active layer - ! a different way of doing this could be to keep track of how long a given layer has ben frozen for, and define ALT as the first layer that has been frozen for less than 2 years. - if (t_soisno(c,nlevgrnd) > SHR_CONST_TKFRZ ) then - alt(c) = zsoi(nlevgrnd) - alt_indx(c) = nlevgrnd - else - k_frz=0 - found_thawlayer = .false. - do j=nlevgrnd-1,1,-1 - if ( ( t_soisno(c,j) > SHR_CONST_TKFRZ ) .and. .not. found_thawlayer ) then - k_frz=j - found_thawlayer = .true. - endif - end do - - if ( k_frz > 0 ) then - ! define active layer as the depth at which the linearly interpolated temperature line intersects with zero - z1 = zsoi(k_frz) - z2 = zsoi(k_frz+1) - t1 = t_soisno(c,k_frz) - t2 = t_soisno(c,k_frz+1) - alt(c) = z1 + (t1-SHR_CONST_TKFRZ)*(z2-z1)/(t1-t2) - alt_indx(c) = k_frz - else - alt(c)=0._r8 - alt_indx(c) = 0 - endif - endif - - - ! if appropriate, update maximum annual active layer thickness - if (alt(c) > altmax(c)) then - altmax(c) = alt(c) - altmax_indx(c) = alt_indx(c) - endif - - end do - - end associate - - end subroutine alt_calc - -end module ActiveLayerMod diff --git a/src/biogeophys/AerosolMod.F90 b/src/biogeophys/AerosolMod.F90 deleted file mode 100644 index e45aad41ab..0000000000 --- a/src/biogeophys/AerosolMod.F90 +++ /dev/null @@ -1,797 +0,0 @@ -module AerosolMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varpar , only : nlevsno, nlevgrnd - use clm_time_manager , only : get_step_size - use atm2lndType , only : atm2lnd_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use ColumnType , only : col - use abortutils , only : endrun - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: AerosolMasses - public :: AerosolFluxes - ! - ! !PUBLIC DATA MEMBERS: - real(r8), public, parameter :: snw_rds_min = 54.526_r8 ! minimum allowed snow effective radius (also cold "fresh snow" value) [microns] - real(r8), public :: fresh_snw_rds_max = 204.526_r8 ! maximum warm fresh snow effective radius [microns] - ! - type, public :: aerosol_type - real(r8), pointer, public :: mss_bcpho_col(:,:) ! mass of hydrophobic BC in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_bcphi_col(:,:) ! mass of hydrophillic BC in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_bctot_col(:,:) ! total mass of BC in snow (pho+phi) (col,lyr) [kg] - real(r8), pointer, public :: mss_bc_col_col(:) ! column-integrated mass of total BC [kg] - real(r8), pointer, public :: mss_bc_top_col(:) ! top-layer mass of total BC [kg] - - real(r8), pointer, public :: mss_ocpho_col(:,:) ! mass of hydrophobic OC in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_ocphi_col(:,:) ! mass of hydrophillic OC in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_octot_col(:,:) ! total mass of OC in snow (pho+phi) (col,lyr) [kg] - real(r8), pointer, public :: mss_oc_col_col(:) ! column-integrated mass of total OC [kg] - real(r8), pointer, public :: mss_oc_top_col(:) ! top-layer mass of total OC [kg] - - real(r8), pointer, public :: mss_dst1_col(:,:) ! mass of dust species 1 in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_dst2_col(:,:) ! mass of dust species 2 in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_dst3_col(:,:) ! mass of dust species 3 in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_dst4_col(:,:) ! mass of dust species 4 in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_dsttot_col(:,:) ! total mass of dust in snow (col,lyr) [kg] - real(r8), pointer, public :: mss_dst_col_col(:) ! column-integrated mass of dust in snow [kg] - real(r8), pointer, public :: mss_dst_top_col(:) ! top-layer mass of dust in snow [kg] - - real(r8), pointer, public :: mss_cnc_bcphi_col(:,:) ! mass concentration of hydrophilic BC in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_bcpho_col(:,:) ! mass concentration of hydrophilic BC in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_ocphi_col(:,:) ! mass concentration of hydrophilic OC in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_ocpho_col(:,:) ! mass concentration of hydrophilic OC in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_dst1_col(:,:) ! mass concentration of dust species 1 in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_dst2_col(:,:) ! mass concentration of dust species 2 in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_dst3_col(:,:) ! mass concentration of dust species 3 in snow (col,lyr) [kg/kg] - real(r8), pointer, public :: mss_cnc_dst4_col(:,:) ! mass concentration of dust species 4 in snow (col,lyr) [kg/kg] - - real(r8), pointer, private :: flx_dst_dep_dry1_col(:) ! dust species 1 dry deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_wet1_col(:) ! dust species 1 wet deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_dry2_col(:) ! dust species 2 dry deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_wet2_col(:) ! dust species 2 wet deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_dry3_col(:) ! dust species 3 dry deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_wet3_col(:) ! dust species 3 wet deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_dry4_col(:) ! dust species 4 dry deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_wet4_col(:) ! dust species 4 wet deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_dst_dep_col(:) ! total (dry+wet) dust deposition on ground (positive definite) [kg/s] - - real(r8), pointer, private :: flx_bc_dep_dry_col(:) ! dry (BCPHO+BCPHI) BC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_bc_dep_wet_col(:) ! wet (BCPHI) BC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_bc_dep_pho_col(:) ! hydrophobic BC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_bc_dep_phi_col(:) ! hydrophillic BC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_bc_dep_col(:) ! total (dry+wet) BC deposition on ground (positive definite) [kg/s] - - real(r8), pointer, private :: flx_oc_dep_dry_col(:) ! dry (OCPHO+OCPHI) OC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_oc_dep_wet_col(:) ! wet (OCPHI) OC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_oc_dep_pho_col(:) ! hydrophobic OC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_oc_dep_phi_col(:) ! hydrophillic OC deposition on ground (positive definite) [kg/s] - real(r8), pointer, private :: flx_oc_dep_col(:) ! total (dry+wet) OC deposition on ground (positive definite) [kg/s] - - contains - - ! Public procedures - procedure, public :: Init - procedure, public :: Restart - procedure, public :: Reset - - ! Private procedures - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, private :: InitReadNML - - end type aerosol_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) - - class(aerosol_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Input namelist filename - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - call this%InitReadNML(NLFilename) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class(aerosol_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - !--------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - - allocate(this%flx_dst_dep_dry1_col (begc:endc)) ; this%flx_dst_dep_dry1_col (:) = nan - allocate(this%flx_dst_dep_wet1_col (begc:endc)) ; this%flx_dst_dep_wet1_col (:) = nan - allocate(this%flx_dst_dep_dry2_col (begc:endc)) ; this%flx_dst_dep_dry2_col (:) = nan - allocate(this%flx_dst_dep_wet2_col (begc:endc)) ; this%flx_dst_dep_wet2_col (:) = nan - allocate(this%flx_dst_dep_dry3_col (begc:endc)) ; this%flx_dst_dep_dry3_col (:) = nan - allocate(this%flx_dst_dep_wet3_col (begc:endc)) ; this%flx_dst_dep_wet3_col (:) = nan - allocate(this%flx_dst_dep_dry4_col (begc:endc)) ; this%flx_dst_dep_dry4_col (:) = nan - allocate(this%flx_dst_dep_wet4_col (begc:endc)) ; this%flx_dst_dep_wet4_col (:) = nan - allocate(this%flx_dst_dep_col (begc:endc)) ; this%flx_dst_dep_col (:) = nan - - allocate(this%flx_bc_dep_dry_col (begc:endc)) ; this%flx_bc_dep_dry_col (:) = nan - allocate(this%flx_bc_dep_wet_col (begc:endc)) ; this%flx_bc_dep_wet_col (:) = nan - allocate(this%flx_bc_dep_pho_col (begc:endc)) ; this%flx_bc_dep_pho_col (:) = nan - allocate(this%flx_bc_dep_phi_col (begc:endc)) ; this%flx_bc_dep_phi_col (:) = nan - allocate(this%flx_bc_dep_col (begc:endc)) ; this%flx_bc_dep_col (:) = nan - - allocate(this%flx_oc_dep_dry_col (begc:endc)) ; this%flx_oc_dep_dry_col (:) = nan - allocate(this%flx_oc_dep_wet_col (begc:endc)) ; this%flx_oc_dep_wet_col (:) = nan - allocate(this%flx_oc_dep_pho_col (begc:endc)) ; this%flx_oc_dep_pho_col (:) = nan - allocate(this%flx_oc_dep_phi_col (begc:endc)) ; this%flx_oc_dep_phi_col (:) = nan - allocate(this%flx_oc_dep_col (begc:endc)) ; this%flx_oc_dep_col (:) = nan - - allocate(this%mss_bcpho_col (begc:endc,-nlevsno+1:0)) ; this%mss_bcpho_col (:,:) = nan - allocate(this%mss_bcphi_col (begc:endc,-nlevsno+1:0)) ; this%mss_bcphi_col (:,:) = nan - allocate(this%mss_bctot_col (begc:endc,-nlevsno+1:0)) ; this%mss_bctot_col (:,:) = nan - allocate(this%mss_bc_col_col (begc:endc)) ; this%mss_bc_col_col (:) = nan - allocate(this%mss_bc_top_col (begc:endc)) ; this%mss_bc_top_col (:) = nan - - allocate(this%mss_ocpho_col (begc:endc,-nlevsno+1:0)) ; this%mss_ocpho_col (:,:) = nan - allocate(this%mss_ocphi_col (begc:endc,-nlevsno+1:0)) ; this%mss_ocphi_col (:,:) = nan - allocate(this%mss_octot_col (begc:endc,-nlevsno+1:0)) ; this%mss_octot_col (:,:) = nan - allocate(this%mss_oc_col_col (begc:endc)) ; this%mss_oc_col_col (:) = nan - allocate(this%mss_oc_top_col (begc:endc)) ; this%mss_oc_top_col (:) = nan - - allocate(this%mss_dst1_col (begc:endc,-nlevsno+1:0)) ; this%mss_dst1_col (:,:) = nan - allocate(this%mss_dst2_col (begc:endc,-nlevsno+1:0)) ; this%mss_dst2_col (:,:) = nan - allocate(this%mss_dst3_col (begc:endc,-nlevsno+1:0)) ; this%mss_dst3_col (:,:) = nan - allocate(this%mss_dst4_col (begc:endc,-nlevsno+1:0)) ; this%mss_dst4_col (:,:) = nan - allocate(this%mss_dsttot_col (begc:endc,-nlevsno+1:0)) ; this%mss_dsttot_col (:,:) = nan - allocate(this%mss_dst_col_col (begc:endc)) ; this%mss_dst_col_col (:) = nan - allocate(this%mss_dst_top_col (begc:endc)) ; this%mss_dst_top_col (:) = nan - - allocate(this%mss_cnc_bcphi_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_bcphi_col (:,:) = nan - allocate(this%mss_cnc_bcpho_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_bcpho_col (:,:) = nan - allocate(this%mss_cnc_ocphi_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_ocphi_col (:,:) = nan - allocate(this%mss_cnc_ocpho_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_ocpho_col (:,:) = nan - allocate(this%mss_cnc_dst1_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_dst1_col (:,:) = nan - allocate(this%mss_cnc_dst2_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_dst2_col (:,:) = nan - allocate(this%mss_cnc_dst3_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_dst3_col (:,:) = nan - allocate(this%mss_cnc_dst4_col (begc:endc,-nlevsno+1:0)) ; this%mss_cnc_dst4_col (:,:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varcon , only: spval - use clm_varpar , only: nlevsno - use histFileMod , only: hist_addfld1d, hist_addfld2d - use histFileMod , only: no_snow_normal, no_snow_zero - ! - ! !ARGUMENTS: - class(aerosol_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - - this%flx_dst_dep_col(begc:endc) = spval - call hist_addfld1d (fname='DSTDEP', units='kg/m^2/s', & - avgflag='A', long_name='total dust deposition (dry+wet) from atmosphere', & - ptr_col=this%flx_dst_dep_col, set_urb=spval) - - this%flx_bc_dep_col(begc:endc) = spval - call hist_addfld1d (fname='BCDEP', units='kg/m^2/s', & - avgflag='A', long_name='total BC deposition (dry+wet) from atmosphere', & - ptr_col=this%flx_bc_dep_col, set_urb=spval) - - this%flx_oc_dep_col(begc:endc) = spval - call hist_addfld1d (fname='OCDEP', units='kg/m^2/s', & - avgflag='A', long_name='total OC deposition (dry+wet) from atmosphere', & - ptr_col=this%flx_oc_dep_col, set_urb=spval) - - this%mss_bc_col_col(begc:endc) = spval - call hist_addfld1d (fname='SNOBCMCL', units='kg/m2', & - avgflag='A', long_name='mass of BC in snow column', & - ptr_col=this%mss_bc_col_col, set_urb=spval) - - this%mss_bc_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOBCMSL', units='kg/m2', & - avgflag='A', long_name='mass of BC in top snow layer', & - ptr_col=this%mss_bc_top_col, set_urb=spval) - - this%mss_oc_col_col(begc:endc) = spval - call hist_addfld1d (fname='SNOOCMCL', units='kg/m2', & - avgflag='A', long_name='mass of OC in snow column', & - ptr_col=this%mss_oc_col_col, set_urb=spval) - - this%mss_oc_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOOCMSL', units='kg/m2', & - avgflag='A', long_name='mass of OC in top snow layer', & - ptr_col=this%mss_oc_top_col, set_urb=spval) - - this%mss_dst_col_col(begc:endc) = spval - call hist_addfld1d (fname='SNODSTMCL', units='kg/m2', & - avgflag='A', long_name='mass of dust in snow column', & - ptr_col=this%mss_dst_col_col, set_urb=spval) - - this%mss_dst_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNODSTMSL', units='kg/m2', & - avgflag='A', long_name='mass of dust in top snow layer', & - ptr_col=this%mss_dst_top_col, set_urb=spval) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(aerosol_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c ! index - !----------------------------------------------------------------------- - - do c = bounds%begc,bounds%endc - this%mss_cnc_bcphi_col(c,:) = 0._r8 - this%mss_cnc_bcpho_col(c,:) = 0._r8 - this%mss_cnc_ocphi_col(c,:) = 0._r8 - this%mss_cnc_ocpho_col(c,:) = 0._r8 - this%mss_cnc_dst1_col(c,:) = 0._r8 - this%mss_cnc_dst2_col(c,:) = 0._r8 - this%mss_cnc_dst3_col(c,:) = 0._r8 - this%mss_cnc_dst4_col(c,:) = 0._r8 - - this%mss_bctot_col(c,:) = 0._r8 - this%mss_bcpho_col(c,:) = 0._r8 - this%mss_bcphi_col(c,:) = 0._r8 - - this%mss_octot_col(c,:) = 0._r8 - this%mss_ocpho_col(c,:) = 0._r8 - this%mss_ocphi_col(c,:) = 0._r8 - - this%mss_dst1_col(c,:) = 0._r8 - this%mss_dst2_col(c,:) = 0._r8 - this%mss_dst3_col(c,:) = 0._r8 - this%mss_dst4_col(c,:) = 0._r8 - this%mss_dsttot_col(c,:) = 0._r8 - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine InitReadNML(this, NLFilename) - ! - ! !USES: - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(aerosol_type) :: this - character(len=*), intent(in) :: NLFilename ! Input namelist filename - ! - ! !LOCAL VARIABLES: - !----------------------------------------------------------------------- - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'Aerosol::InitReadNML' - character(len=*), parameter :: nmlname = 'aerosol' - !----------------------------------------------------------------------- - namelist/aerosol/ fresh_snw_rds_max - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=aerosol, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//" namelist "//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//" namelist "//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (fresh_snw_rds_max , mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=aerosol) - write(iulog,*) ' ' - end if - - end subroutine InitReadNML - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, & - h2osoi_ice_col, h2osoi_liq_col) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use clm_varpar , only : nlevsno, nlevsoi - use clm_varcon , only : spval - use clm_varctl , only : iulog - use clm_varpar , only : nlevsno - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(aerosol_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - real(r8) , intent(in) :: h2osoi_ice_col( bounds%begc: , -nlevsno+1: ) ! ice content (col,lyr) [kg/m2] - real(r8) , intent(in) :: h2osoi_liq_col( bounds%begc: , -nlevsno+1: ) ! liquid water content (col,lyr) [kg/m2] - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(h2osoi_ice_col) == (/bounds%endc,nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_liq_col) == (/bounds%endc,nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - call restartvar(ncid=ncid, flag=flag, varname='mss_bcpho', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer hydrophobic black carbon mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_bcpho_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_bcpho to zero - this%mss_bcpho_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='mss_bcphi', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer hydrophilic black carbon mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_bcphi_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_bcphi to zero - this%mss_bcphi_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='mss_ocpho', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer hydrophobic organic carbon mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_ocpho_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_ocpho to zero - this%mss_ocpho_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='mss_ocphi', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer hydrophilic organic carbon mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_ocphi_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_ocphi to zero - this%mss_ocphi_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='mss_dst1', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer dust species 1 mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_dst1_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_dst1 to zero - this%mss_dst1_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='mss_dst2', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer dust species 2 mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_dst2_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_dst2 to zero - this%mss_dst2_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - endif - - call restartvar(ncid=ncid, flag=flag, varname='mss_dst3', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer dust species 3 mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_dst3_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_dst3 to zero - this%mss_dst3_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - endif - - call restartvar(ncid=ncid, flag=flag, varname='mss_dst4', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer dust species 4 mass', units='kg m-2', & - interpinic_flag='interp', readvar=readvar, data=this%mss_dst4_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize mss_dst4 to zero - this%mss_dst4_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - end if - - ! initialize other variables that are derived from those stored in the restart buffer (SNICAR variables) - if (flag == 'read' ) then - do j = -nlevsno+1,0 - do c = bounds%begc, bounds%endc - ! mass concentrations of aerosols in snow - if (h2osoi_ice_col(c,j) + h2osoi_liq_col(c,j) > 0._r8) then - this%mss_cnc_bcpho_col(c,j) = this%mss_bcpho_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - this%mss_cnc_bcphi_col(c,j) = this%mss_bcphi_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - this%mss_cnc_ocpho_col(c,j) = this%mss_ocpho_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - this%mss_cnc_ocphi_col(c,j) = this%mss_ocphi_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - - this%mss_cnc_dst1_col(c,j) = this%mss_dst1_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - this%mss_cnc_dst2_col(c,j) = this%mss_dst2_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - this%mss_cnc_dst3_col(c,j) = this%mss_dst3_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - this%mss_cnc_dst4_col(c,j) = this%mss_dst4_col(c,j) / (h2osoi_ice_col(c,j)+h2osoi_liq_col(c,j)) - else - this%mss_cnc_bcpho_col(c,j) = 0._r8 - this%mss_cnc_bcphi_col(c,j) = 0._r8 - this%mss_cnc_ocpho_col(c,j) = 0._r8 - this%mss_cnc_ocphi_col(c,j) = 0._r8 - - this%mss_cnc_dst1_col(c,j) = 0._r8 - this%mss_cnc_dst2_col(c,j) = 0._r8 - this%mss_cnc_dst3_col(c,j) = 0._r8 - this%mss_cnc_dst4_col(c,j) = 0._r8 - endif - enddo - enddo - endif - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine Reset(this, column) - ! - ! !DESCRIPTION: - ! Intitialize SNICAR variables for fresh snow column - ! - ! !ARGUMENTS: - class(aerosol_type) :: this - integer , intent(in) :: column ! column index - !----------------------------------------------------------------------- - - this%mss_bcpho_col(column,:) = 0._r8 - this%mss_bcphi_col(column,:) = 0._r8 - this%mss_bctot_col(column,:) = 0._r8 - this%mss_bc_col_col(column) = 0._r8 - this%mss_bc_top_col(column) = 0._r8 - - this%mss_ocpho_col(column,:) = 0._r8 - this%mss_ocphi_col(column,:) = 0._r8 - this%mss_octot_col(column,:) = 0._r8 - this%mss_oc_col_col(column) = 0._r8 - this%mss_oc_top_col(column) = 0._r8 - - this%mss_dst1_col(column,:) = 0._r8 - this%mss_dst2_col(column,:) = 0._r8 - this%mss_dst3_col(column,:) = 0._r8 - this%mss_dst4_col(column,:) = 0._r8 - this%mss_dsttot_col(column,:) = 0._r8 - this%mss_dst_col_col(column) = 0._r8 - this%mss_dst_top_col(column) = 0._r8 - - end subroutine Reset - - !----------------------------------------------------------------------- - subroutine AerosolMasses(bounds, num_on, filter_on, num_off, filter_off, & - waterflux_inst, waterstate_inst, aerosol_inst) - ! - ! !DESCRIPTION: - ! Calculate column-integrated aerosol masses, and - ! mass concentrations for radiative calculations and output - ! (based on new snow level state, after SnowFilter is rebuilt. - ! NEEDS TO BE AFTER SnowFiler is rebuilt in Hydrology2, otherwise there - ! can be zero snow layers but an active column in filter) - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in ) :: bounds - integer , intent(in) :: num_on ! number of column filter-ON points - integer , intent(in) :: filter_on(:) ! column filter for filter-ON points - integer , intent(in) :: num_off ! number of column non filter-OFF points - integer , intent(in) :: filter_off(:) ! column filter for filter-OFF points - type(waterflux_type) , intent(in) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(aerosol_type) , intent(inout) :: aerosol_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime ! land model time step (sec) - integer :: g,l,c,j,fc ! indices - real(r8) :: snowmass ! liquid+ice snow mass in a layer [kg/m2] - real(r8) :: snowcap_scl_fct ! temporary factor used to correct for snow capping - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - - h2osno_top => waterstate_inst%h2osno_top_col , & ! Output: [real(r8) (:) | top-layer mass of snow [kg] - snw_rds => waterstate_inst%snw_rds_col , & ! Output: [real(r8) (:,:) ] effective snow grain radius (col,lyr) [microns, m^-6] - - mss_bcpho => aerosol_inst%mss_bcpho_col , & ! Output: [real(r8) (:,:) ] mass of hydrophobic BC in snow (col,lyr) [kg] - mss_bcphi => aerosol_inst%mss_bcphi_col , & ! Output: [real(r8) (:,:) ] mass of hydrophillic BC in snow (col,lyr) [kg] - mss_bctot => aerosol_inst%mss_bctot_col , & ! Output: [real(r8) (:,:) ] total mass of BC (pho+phi) (col,lyr) [kg] - mss_bc_col => aerosol_inst%mss_bc_col_col , & ! Output: [real(r8) (:) ] total mass of BC in snow column (col) [kg] - mss_bc_top => aerosol_inst%mss_bc_top_col , & ! Output: [real(r8) (:) ] total mass of BC in top snow layer (col) [kg] - mss_ocpho => aerosol_inst%mss_ocpho_col , & ! Output: [real(r8) (:,:) ] mass of hydrophobic OC in snow (col,lyr) [kg] - mss_ocphi => aerosol_inst%mss_ocphi_col , & ! Output: [real(r8) (:,:) ] mass of hydrophillic OC in snow (col,lyr) [kg] - mss_octot => aerosol_inst%mss_octot_col , & ! Output: [real(r8) (:,:) ] total mass of OC (pho+phi) (col,lyr) [kg] - mss_oc_col => aerosol_inst%mss_oc_col_col , & ! Output: [real(r8) (:) ] total mass of OC in snow column (col) [kg] - mss_oc_top => aerosol_inst%mss_oc_top_col , & ! Output: [real(r8) (:) ] total mass of OC in top snow layer (col) [kg] - mss_dst1 => aerosol_inst%mss_dst1_col , & ! Output: [real(r8) (:,:) ] mass of dust species 1 in snow (col,lyr) [kg] - mss_dst2 => aerosol_inst%mss_dst2_col , & ! Output: [real(r8) (:,:) ] mass of dust species 2 in snow (col,lyr) [kg] - mss_dst3 => aerosol_inst%mss_dst3_col , & ! Output: [real(r8) (:,:) ] mass of dust species 3 in snow (col,lyr) [kg] - mss_dst4 => aerosol_inst%mss_dst4_col , & ! Output: [real(r8) (:,:) ] mass of dust species 4 in snow (col,lyr) [kg] - mss_dsttot => aerosol_inst%mss_dsttot_col , & ! Output: [real(r8) (:,:) ] total mass of dust in snow (col,lyr) [kg] - mss_dst_col => aerosol_inst%mss_dst_col_col , & ! Output: [real(r8) (:) ] total mass of dust in snow column (col) [kg] - mss_dst_top => aerosol_inst%mss_dst_top_col , & ! Output: [real(r8) (:) ] total mass of dust in top snow layer (col) [kg] - mss_cnc_bcphi => aerosol_inst%mss_cnc_bcphi_col , & ! Output: [real(r8) (:,:) ] mass concentration of BC species 1 (col,lyr) [kg/kg] - mss_cnc_bcpho => aerosol_inst%mss_cnc_bcpho_col , & ! Output: [real(r8) (:,:) ] mass concentration of BC species 2 (col,lyr) [kg/kg] - mss_cnc_ocphi => aerosol_inst%mss_cnc_ocphi_col , & ! Output: [real(r8) (:,:) ] mass concentration of OC species 1 (col,lyr) [kg/kg] - mss_cnc_ocpho => aerosol_inst%mss_cnc_ocpho_col , & ! Output: [real(r8) (:,:) ] mass concentration of OC species 2 (col,lyr) [kg/kg] - mss_cnc_dst1 => aerosol_inst%mss_cnc_dst1_col , & ! Output: [real(r8) (:,:) ] mass concentration of dust species 1 (col,lyr) [kg/kg] - mss_cnc_dst2 => aerosol_inst%mss_cnc_dst2_col , & ! Output: [real(r8) (:,:) ] mass concentration of dust species 2 (col,lyr) [kg/kg] - mss_cnc_dst3 => aerosol_inst%mss_cnc_dst3_col , & ! Output: [real(r8) (:,:) ] mass concentration of dust species 3 (col,lyr) [kg/kg] - mss_cnc_dst4 => aerosol_inst%mss_cnc_dst4_col & ! Output: [real(r8) (:,:) ] mass concentration of dust species 4 (col,lyr) [kg/kg] - ) - - dtime = get_step_size() - - do fc = 1, num_on - c = filter_on(fc) - - ! Zero column-integrated aerosol mass before summation - mss_bc_col(c) = 0._r8 - mss_oc_col(c) = 0._r8 - mss_dst_col(c) = 0._r8 - - do j = -nlevsno+1, 0 - - ! layer mass of snow: - snowmass = h2osoi_ice(c,j) + h2osoi_liq(c,j) - - if (j >= snl(c)+1) then - - mss_bctot(c,j) = mss_bcpho(c,j) + mss_bcphi(c,j) - mss_bc_col(c) = mss_bc_col(c) + mss_bctot(c,j) - mss_cnc_bcphi(c,j) = mss_bcphi(c,j) / snowmass - mss_cnc_bcpho(c,j) = mss_bcpho(c,j) / snowmass - - mss_octot(c,j) = mss_ocpho(c,j) + mss_ocphi(c,j) - mss_oc_col(c) = mss_oc_col(c) + mss_octot(c,j) - mss_cnc_ocphi(c,j) = mss_ocphi(c,j) / snowmass - mss_cnc_ocpho(c,j) = mss_ocpho(c,j) / snowmass - - mss_dsttot(c,j) = mss_dst1(c,j) + mss_dst2(c,j) + mss_dst3(c,j) + mss_dst4(c,j) - mss_dst_col(c) = mss_dst_col(c) + mss_dsttot(c,j) - mss_cnc_dst1(c,j) = mss_dst1(c,j) / snowmass - mss_cnc_dst2(c,j) = mss_dst2(c,j) / snowmass - mss_cnc_dst3(c,j) = mss_dst3(c,j) / snowmass - mss_cnc_dst4(c,j) = mss_dst4(c,j) / snowmass - - else - !set variables of empty snow layers to zero - snw_rds(c,j) = 0._r8 - - mss_bcpho(c,j) = 0._r8 - mss_bcphi(c,j) = 0._r8 - mss_bctot(c,j) = 0._r8 - mss_cnc_bcphi(c,j) = 0._r8 - mss_cnc_bcpho(c,j) = 0._r8 - - mss_ocpho(c,j) = 0._r8 - mss_ocphi(c,j) = 0._r8 - mss_octot(c,j) = 0._r8 - mss_cnc_ocphi(c,j) = 0._r8 - mss_cnc_ocpho(c,j) = 0._r8 - - mss_dst1(c,j) = 0._r8 - mss_dst2(c,j) = 0._r8 - mss_dst3(c,j) = 0._r8 - mss_dst4(c,j) = 0._r8 - mss_dsttot(c,j) = 0._r8 - mss_cnc_dst1(c,j) = 0._r8 - mss_cnc_dst2(c,j) = 0._r8 - mss_cnc_dst3(c,j) = 0._r8 - mss_cnc_dst4(c,j) = 0._r8 - endif - enddo - - ! top-layer diagnostics - h2osno_top(c) = h2osoi_ice(c,snl(c)+1) + h2osoi_liq(c,snl(c)+1) !TODO MV - is this correct to be placed here??? - mss_bc_top(c) = mss_bctot(c,snl(c)+1) - mss_oc_top(c) = mss_octot(c,snl(c)+1) - mss_dst_top(c) = mss_dsttot(c,snl(c)+1) - enddo - - ! Zero mass variables in columns without snow - - do fc = 1, num_off - c = filter_off(fc) - - mss_bc_top(c) = 0._r8 - mss_bc_col(c) = 0._r8 - mss_bcpho(c,:) = 0._r8 - mss_bcphi(c,:) = 0._r8 - mss_bctot(c,:) = 0._r8 - mss_cnc_bcphi(c,:) = 0._r8 - mss_cnc_bcpho(c,:) = 0._r8 - - mss_oc_top(c) = 0._r8 - mss_oc_col(c) = 0._r8 - mss_ocpho(c,:) = 0._r8 - mss_ocphi(c,:) = 0._r8 - mss_octot(c,:) = 0._r8 - mss_cnc_ocphi(c,:) = 0._r8 - mss_cnc_ocpho(c,:) = 0._r8 - - mss_dst_top(c) = 0._r8 - mss_dst_col(c) = 0._r8 - mss_dst1(c,:) = 0._r8 - mss_dst2(c,:) = 0._r8 - mss_dst3(c,:) = 0._r8 - mss_dst4(c,:) = 0._r8 - mss_dsttot(c,:) = 0._r8 - - mss_cnc_dst1(c,:) = 0._r8 - mss_cnc_dst2(c,:) = 0._r8 - mss_cnc_dst3(c,:) = 0._r8 - mss_cnc_dst4(c,:) = 0._r8 - - enddo - - end associate - - end subroutine AerosolMasses - - !----------------------------------------------------------------------- - subroutine AerosolFluxes(bounds, num_snowc, filter_snowc, & - atm2lnd_inst, aerosol_inst) - ! - ! !DESCRIPTION: - ! Compute aerosol fluxes through snowpack and aerosol deposition fluxes into top layere - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_snowc ! number of snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(aerosol_type) , intent(inout) :: aerosol_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime ! land model time step (sec) - integer :: c,g,j,fc - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - forc_aer => atm2lnd_inst%forc_aer_grc , & ! Input: [real(r8) (:,:) ] aerosol deposition from atmosphere model (grd,aer) [kg m-1 s-1] - - mss_bcphi => aerosol_inst%mss_bcphi_col , & ! Output: [real(r8) (:,:) ] hydrophillic BC mass in snow (col,lyr) [kg] - mss_bcpho => aerosol_inst%mss_bcpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic BC mass in snow (col,lyr) [kg] - mss_ocphi => aerosol_inst%mss_ocphi_col , & ! Output: [real(r8) (:,:) ] hydrophillic OC mass in snow (col,lyr) [kg] - mss_ocpho => aerosol_inst%mss_ocpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic OC mass in snow (col,lyr) [kg] - mss_dst1 => aerosol_inst%mss_dst1_col , & ! Output: [real(r8) (:,:) ] mass of dust species 1 in snow (col,lyr) [kg] - mss_dst2 => aerosol_inst%mss_dst2_col , & ! Output: [real(r8) (:,:) ] mass of dust species 2 in snow (col,lyr) [kg] - mss_dst3 => aerosol_inst%mss_dst3_col , & ! Output: [real(r8) (:,:) ] mass of dust species 3 in snow (col,lyr) [kg] - mss_dst4 => aerosol_inst%mss_dst4_col , & ! Output: [real(r8) (:,:) ] mass of dust species 4 in snow (col,lyr) [kg] - - flx_bc_dep => aerosol_inst%flx_bc_dep_col , & ! Output: [real(r8) (:) ] total BC deposition (col) [kg m-2 s-1] - flx_bc_dep_wet => aerosol_inst%flx_bc_dep_wet_col , & ! Output: [real(r8) (:) ] wet BC deposition (col) [kg m-2 s-1] - flx_bc_dep_dry => aerosol_inst%flx_bc_dep_dry_col , & ! Output: [real(r8) (:) ] dry BC deposition (col) [kg m-2 s-1] - flx_bc_dep_phi => aerosol_inst%flx_bc_dep_phi_col , & ! Output: [real(r8) (:) ] hydrophillic BC deposition (col) [kg m-1 s-1] - flx_bc_dep_pho => aerosol_inst%flx_bc_dep_pho_col , & ! Output: [real(r8) (:) ] hydrophobic BC deposition (col) [kg m-1 s-1] - flx_oc_dep => aerosol_inst%flx_oc_dep_col , & ! Output: [real(r8) (:) ] total OC deposition (col) [kg m-2 s-1] - flx_oc_dep_wet => aerosol_inst%flx_oc_dep_wet_col , & ! Output: [real(r8) (:) ] wet OC deposition (col) [kg m-2 s-1] - flx_oc_dep_dry => aerosol_inst%flx_oc_dep_dry_col , & ! Output: [real(r8) (:) ] dry OC deposition (col) [kg m-2 s-1] - flx_oc_dep_phi => aerosol_inst%flx_oc_dep_phi_col , & ! Output: [real(r8) (:) ] hydrophillic OC deposition (col) [kg m-1 s-1] - flx_oc_dep_pho => aerosol_inst%flx_oc_dep_pho_col , & ! Output: [real(r8) (:) ] hydrophobic OC deposition (col) [kg m-1 s-1] - flx_dst_dep => aerosol_inst%flx_dst_dep_col , & ! Output: [real(r8) (:) ] total dust deposition (col) [kg m-2 s-1] - flx_dst_dep_wet1 => aerosol_inst%flx_dst_dep_wet1_col , & ! Output: [real(r8) (:) ] wet dust (species 1) deposition (col) [kg m-2 s-1] - flx_dst_dep_dry1 => aerosol_inst%flx_dst_dep_dry1_col , & ! Output: [real(r8) (:) ] dry dust (species 1) deposition (col) [kg m-2 s-1] - flx_dst_dep_wet2 => aerosol_inst%flx_dst_dep_wet2_col , & ! Output: [real(r8) (:) ] wet dust (species 2) deposition (col) [kg m-2 s-1] - flx_dst_dep_dry2 => aerosol_inst%flx_dst_dep_dry2_col , & ! Output: [real(r8) (:) ] dry dust (species 2) deposition (col) [kg m-2 s-1] - flx_dst_dep_wet3 => aerosol_inst%flx_dst_dep_wet3_col , & ! Output: [real(r8) (:) ] wet dust (species 3) deposition (col) [kg m-2 s-1] - flx_dst_dep_dry3 => aerosol_inst%flx_dst_dep_dry3_col , & ! Output: [real(r8) (:) ] dry dust (species 3) deposition (col) [kg m-2 s-1] - flx_dst_dep_wet4 => aerosol_inst%flx_dst_dep_wet4_col , & ! Output: [real(r8) (:) ] wet dust (species 4) deposition (col) [kg m-2 s-1] - flx_dst_dep_dry4 => aerosol_inst%flx_dst_dep_dry4_col & ! Output: [real(r8) (:) ] dry dust (species 4) deposition (col) [kg m-2 s-1] - ) - - ! set aerosol deposition fluxes from forcing array - ! The forcing array is either set from an external file - ! or from fluxes received from the atmosphere model - - do c = bounds%begc,bounds%endc - g = col%gridcell(c) - - flx_bc_dep_dry(c) = forc_aer(g,1) + forc_aer(g,2) - flx_bc_dep_wet(c) = forc_aer(g,3) - flx_bc_dep_phi(c) = forc_aer(g,1) + forc_aer(g,3) - flx_bc_dep_pho(c) = forc_aer(g,2) - flx_bc_dep(c) = forc_aer(g,1) + forc_aer(g,2) + forc_aer(g,3) - - flx_oc_dep_dry(c) = forc_aer(g,4) + forc_aer(g,5) - flx_oc_dep_wet(c) = forc_aer(g,6) - flx_oc_dep_phi(c) = forc_aer(g,4) + forc_aer(g,6) - flx_oc_dep_pho(c) = forc_aer(g,5) - flx_oc_dep(c) = forc_aer(g,4) + forc_aer(g,5) + forc_aer(g,6) - - flx_dst_dep_wet1(c) = forc_aer(g,7) - flx_dst_dep_dry1(c) = forc_aer(g,8) - flx_dst_dep_wet2(c) = forc_aer(g,9) - flx_dst_dep_dry2(c) = forc_aer(g,10) - flx_dst_dep_wet3(c) = forc_aer(g,11) - flx_dst_dep_dry3(c) = forc_aer(g,12) - flx_dst_dep_wet4(c) = forc_aer(g,13) - flx_dst_dep_dry4(c) = forc_aer(g,14) - flx_dst_dep(c) = forc_aer(g,7) + forc_aer(g,8) + forc_aer(g,9) + & - forc_aer(g,10) + forc_aer(g,11) + forc_aer(g,12) + & - forc_aer(g,13) + forc_aer(g,14) - end do - - ! aerosol deposition fluxes into top layer - ! This is done after the inter-layer fluxes so that some aerosol - ! is in the top layer after deposition, and is not immediately - ! washed out before radiative calculations are done - - dtime = get_step_size() - - do fc = 1, num_snowc - c = filter_snowc(fc) - mss_bcphi(c,snl(c)+1) = mss_bcphi(c,snl(c)+1) + (flx_bc_dep_phi(c)*dtime) - mss_bcpho(c,snl(c)+1) = mss_bcpho(c,snl(c)+1) + (flx_bc_dep_pho(c)*dtime) - mss_ocphi(c,snl(c)+1) = mss_ocphi(c,snl(c)+1) + (flx_oc_dep_phi(c)*dtime) - mss_ocpho(c,snl(c)+1) = mss_ocpho(c,snl(c)+1) + (flx_oc_dep_pho(c)*dtime) - - mss_dst1(c,snl(c)+1) = mss_dst1(c,snl(c)+1) + (flx_dst_dep_dry1(c) + flx_dst_dep_wet1(c))*dtime - mss_dst2(c,snl(c)+1) = mss_dst2(c,snl(c)+1) + (flx_dst_dep_dry2(c) + flx_dst_dep_wet2(c))*dtime - mss_dst3(c,snl(c)+1) = mss_dst3(c,snl(c)+1) + (flx_dst_dep_dry3(c) + flx_dst_dep_wet3(c))*dtime - mss_dst4(c,snl(c)+1) = mss_dst4(c,snl(c)+1) + (flx_dst_dep_dry4(c) + flx_dst_dep_wet4(c))*dtime - end do - - end associate - - end subroutine AerosolFluxes - -end module AerosolMod diff --git a/src/biogeophys/BalanceCheckMod.F90 b/src/biogeophys/BalanceCheckMod.F90 deleted file mode 100644 index 91fdd30ad3..0000000000 --- a/src/biogeophys/BalanceCheckMod.F90 +++ /dev/null @@ -1,637 +0,0 @@ -module BalanceCheckMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Water and energy balance check. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : namep, namec - use clm_varpar , only : nlevsoi - use GetGlobalValuesMod , only : GetGlobalIndex - use atm2lndType , only : atm2lnd_type - use EnergyFluxType , only : energyflux_type - use SolarAbsorbedType , only : solarabs_type - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use IrrigationMod , only : irrigation_type - use GlacierSurfaceMassBalanceMod, only : glacier_smb_type - use TotalWaterAndHeatMod, only : ComputeWaterMassNonLake, ComputeWaterMassLake - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use landunit_varcon , only : istdlak, istsoil,istcrop,istwet,istice_mec - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varcon , only : aquifer_water_baseline - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - - public :: BeginWaterBalance ! Initialize water balance check - public :: BalanceCheck ! Water and energy balance check - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine BeginWaterBalance(bounds, & - num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - soilhydrology_inst, waterstate_inst) - ! - ! !DESCRIPTION: - ! Initialize column-level water balance at beginning of time step - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices - !----------------------------------------------------------------------- - - associate( & - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - wa => soilhydrology_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) - begwb => waterstate_inst%begwb_col & ! Output: [real(r8) (:) ] water mass begining of the time step - ) - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if (col%hydrologically_active(c)) then - if(zwt(c) <= zi(c,nlevsoi)) then - wa(c) = aquifer_water_baseline - end if - end if - end do - - call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & - soilhydrology_inst, waterstate_inst, begwb(bounds%begc:bounds%endc)) - - call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, begwb(bounds%begc:bounds%endc)) - - end associate - - end subroutine BeginWaterBalance - - !----------------------------------------------------------------------- - subroutine BalanceCheck( bounds, & - atm2lnd_inst, solarabs_inst, waterflux_inst, waterstate_inst, & - irrigation_inst, glacier_smb_inst, energyflux_inst, canopystate_inst) - ! - ! !DESCRIPTION: - ! This subroutine accumulates the numerical truncation errors of the water - ! and energy balance calculation. It is helpful to see the performance of - ! the process of integration. - ! - ! The error for energy balance: - ! - ! error = abs(Net radiation - change of internal energy - Sensible heat - ! - Latent heat) - ! - ! The error for water balance: - ! - ! error = abs(precipitation - change of water storage - evaporation - runoff) - ! - ! !USES: - use clm_varcon , only : spval - use clm_time_manager , only : get_step_size, get_nstep - use clm_time_manager , only : get_nstep_since_startup_or_lastDA_restart_or_pause - use clm_instMod , only : surfalb_inst - use CanopyStateType , only : canopystate_type - use subgridAveMod - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(irrigation_type) , intent(in) :: irrigation_inst - type(glacier_smb_type), intent(in) :: glacier_smb_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(canopystate_type), intent(inout) :: canopystate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g,fc ! indices - real(r8) :: dtime ! land model time step (sec) - integer :: nstep ! time step number - integer :: DAnstep ! time step number since last Data Assimilation (DA) - logical :: found ! flag in search loop - integer :: indexp,indexc,indexl,indexg ! index of first found in search loop - real(r8) :: forc_rain_col(bounds%begc:bounds%endc) ! column level rain rate [mm/s] - real(r8) :: forc_snow_col(bounds%begc:bounds%endc) ! column level snow rate [mm/s] - !----------------------------------------------------------------------- - - associate( & - volr => atm2lnd_inst%volr_grc , & ! Input: [real(r8) (:) ] river water storage (m3) - forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (vis=forc_solsd, nir=forc_solld) - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] rain rate [mm/s] - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] snow rate [mm/s] - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osno_old => waterstate_inst%h2osno_old_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) at previous time step - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] effective snow fraction - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - begwb => waterstate_inst%begwb_col , & ! Input: [real(r8) (:) ] water mass begining of the time step - errh2o => waterstate_inst%errh2o_col , & ! Output: [real(r8) (:) ] water conservation error (mm H2O) - errh2osno => waterstate_inst%errh2osno_col , & ! Output: [real(r8) (:) ] error in h2osno (kg m-2) - endwb => waterstate_inst%endwb_col , & ! Output: [real(r8) (:) ] water mass end of the time step - total_plant_stored_h2o_col => waterstate_inst%total_plant_stored_h2o_col, & ! Input: [real(r8) (:) ] water mass in plant tissues (kg m-2) - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Input [real(r8) (:) ] water loss in soil layers to root uptake (mm H2O/s) - ! (ie transpiration demand, often = transpiration) - qflx_rain_grnd_col => waterflux_inst%qflx_rain_grnd_col , & ! Input: [real(r8) (:) ] rain on ground after interception (mm H2O/s) [+] - qflx_snow_grnd_col => waterflux_inst%qflx_snow_grnd_col , & ! Input: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] - qflx_evap_soi => waterflux_inst%qflx_evap_soi_col , & ! Input: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_snwcp_liq => waterflux_inst%qflx_snwcp_liq_col , & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping (outgoing) (mm H2O /s) [+]` - qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col , & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+]` - qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` - qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+]` - qflx_evap_tot => waterflux_inst%qflx_evap_tot_col , & ! Input: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - qflx_dew_snow => waterflux_inst%qflx_dew_snow_col , & ! Input: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_sub_snow => waterflux_inst%qflx_sub_snow_col , & ! Input: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_evap_grnd => waterflux_inst%qflx_evap_grnd_col , & ! Input: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_col , & ! Input: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_prec_grnd => waterflux_inst%qflx_prec_grnd_col , & ! Input: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)] - qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Input: [real(r8) (:) ] snow falling on surface water (mm/s) - qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Input: [real(r8) (:) ] conversion of h2osfc to ice - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] total runoff due to flooding - qflx_h2osfc_surf => waterflux_inst%qflx_h2osfc_surf_col , & ! Input: [real(r8) (:) ] surface water runoff (mm/s) - qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack - qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) - qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Input: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes - qflx_drain => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_runoff => waterflux_inst%qflx_runoff_col , & ! Input: [real(r8) (:) ] total runoff (mm H2O /s) - qflx_ice_runoff_snwcp => waterflux_inst%qflx_ice_runoff_snwcp_col, & ! Input: [real(r8) (:) ] solid runoff from snow capping (mm H2O /s) - qflx_ice_runoff_xs => waterflux_inst%qflx_ice_runoff_xs_col , & ! Input: [real(r8) (:) ] solid runoff from excess ice in soil (mm H2O /s) - qflx_top_soil => waterflux_inst%qflx_top_soil_col , & ! Input: [real(r8) (:) ] net water input into soil from top (mm/s) - qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Input: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - qflx_liq_dynbal => waterflux_inst%qflx_liq_dynbal_grc , & ! Input: [real(r8) (:) ] liq runoff due to dynamic land cover change (mm H2O /s) - qflx_ice_dynbal => waterflux_inst%qflx_ice_dynbal_grc , & ! Input: [real(r8) (:) ] ice runoff due to dynamic land cover change (mm H2O /s) - snow_sources => waterflux_inst%snow_sources_col , & ! Output: [real(r8) (:) ] snow sources (mm H2O /s) - snow_sinks => waterflux_inst%snow_sinks_col , & ! Output: [real(r8) (:) ] snow sinks (mm H2O /s) - - qflx_irrig => irrigation_inst%qflx_irrig_col , & ! Input: [real(r8) (:) ] irrigation flux (mm H2O /s) - - qflx_glcice_dyn_water_flux => glacier_smb_inst%qflx_glcice_dyn_water_flux_col, & ! Input: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) - - eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Input: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Input: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch , & ! Input: [real(r8) (:) ] total latent heat flux (W/m**2) [+ to atm] - eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Input: [real(r8) (:) ] soil heat flux (W/m**2) [+ = into soil] - eflx_wasteheat_patch => energyflux_inst%eflx_wasteheat_patch , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_heat_from_ac_patch => energyflux_inst%eflx_heat_from_ac_patch , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_traffic_patch => energyflux_inst%eflx_traffic_patch , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_dynbal => energyflux_inst%eflx_dynbal_grc , & ! Input: [real(r8) (:) ] energy conversion flux due to dynamic land cover change(W/m**2) [+ to atm] - errsoi_col => energyflux_inst%errsoi_col , & ! Output: [real(r8) (:) ] column-level soil/lake energy conservation error (W/m**2) - errsol => energyflux_inst%errsol_patch , & ! Output: [real(r8) (:) ] solar radiation conservation error (W/m**2) - errseb => energyflux_inst%errseb_patch , & ! Output: [real(r8) (:) ] surface energy conservation error (W/m**2) - errlon => energyflux_inst%errlon_patch , & ! Output: [real(r8) (:) ] longwave radiation conservation error (W/m**2) - - sabg_soil => solarabs_inst%sabg_soil_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) - sabg_snow => solarabs_inst%sabg_snow_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) - sabg_chk => solarabs_inst%sabg_chk_patch , & ! Input: [real(r8) (:) ] sum of soil/snow using current fsno, for balance check - fsa => solarabs_inst%fsa_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed (total) (W/m**2) - fsr => solarabs_inst%fsr_patch , & ! Input: [real(r8) (:) ] solar radiation reflected (W/m**2) - sabv => solarabs_inst%sabv_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by vegetation (W/m**2) - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:,:)] - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:,:)] - - fabd => surfalb_inst%fabd_patch , & ! Input: [real(r8) (:,:)] flux absorbed by canopy per unit direct flux - fabi => surfalb_inst%fabi_patch , & ! Input: [real(r8) (:,:)] flux absorbed by canopy per unit indirect flux - albd => surfalb_inst%albd_patch , & ! Output: [real(r8) (:,:)] surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Output: [real(r8) (:,:)] surface albedo (diffuse) - ftdd => surfalb_inst%ftdd_patch , & ! Input: [real(r8) (:,:)] down direct flux below canopy per unit direct flux - ftid => surfalb_inst%ftid_patch , & ! Input: [real(r8) (:,:)] down diffuse flux below canopy per unit direct flux - ftii => surfalb_inst%ftii_patch , & ! Input: [real(r8) (:,:)] down diffuse flux below canopy per unit diffuse flux - - netrad => energyflux_inst%netrad_patch & ! Output: [real(r8) (:) ] net radiation (positive downward) (W/m**2) - ) - - ! Get step size and time step - - nstep = get_nstep() - DAnstep = get_nstep_since_startup_or_lastDA_restart_or_pause() - dtime = get_step_size() - - ! Determine column level incoming snow and rain - ! Assume no incident precipitation on urban wall columns (as in CanopyHydrologyMod.F90). - - do c = bounds%begc,bounds%endc - g = col%gridcell(c) - l = col%landunit(c) - - if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - forc_rain_col(c) = 0. - forc_snow_col(c) = 0. - else - forc_rain_col(c) = forc_rain(c) - forc_snow_col(c) = forc_snow(c) - end if - end do - - ! Water balance check - - do c = bounds%begc, bounds%endc - - ! add qflx_drain_perched and qflx_flood - if (col%active(c)) then - - errh2o(c) = endwb(c) - begwb(c) & - - (forc_rain_col(c) & - + forc_snow_col(c) & - + qflx_floodc(c) & - + qflx_irrig(c) & - + qflx_glcice_dyn_water_flux(c) & - - qflx_evap_tot(c) & - - qflx_surf(c) & - - qflx_h2osfc_surf(c) & - - qflx_qrgwl(c) & - - qflx_drain(c) & - - qflx_drain_perched(c) & - - qflx_ice_runoff_snwcp(c) & - - qflx_ice_runoff_xs(c) & - - qflx_snwcp_discarded_liq(c) & - - qflx_snwcp_discarded_ice(c)) * dtime - - else - - errh2o(c) = 0.0_r8 - - end if - - end do - - found = .false. - do c = bounds%begc, bounds%endc - if (abs(errh2o(c)) > 1.e-9_r8) then - found = .true. - indexc = c - end if - end do - - if ( found ) then - - write(iulog,*)'WARNING: water balance error ',& - ' nstep= ',nstep, & - ' local indexc= ',indexc,& - ! ' global indexc= ',GetGlobalIndex(decomp_index=indexc, clmlevel=namec), & - ' errh2o= ',errh2o(indexc) - - if ((col%itype(indexc) == icol_roof .or. & - col%itype(indexc) == icol_road_imperv .or. & - col%itype(indexc) == icol_road_perv) .and. & - abs(errh2o(indexc)) > 1.e-5_r8 .and. (DAnstep > 2) ) then - - write(iulog,*)'clm urban model is stopping - error is greater than 1e-5 (mm)' - write(iulog,*)'nstep = ',nstep - write(iulog,*)'errh2o = ',errh2o(indexc) - write(iulog,*)'forc_rain = ',forc_rain_col(indexc)*dtime - write(iulog,*)'forc_snow = ',forc_snow_col(indexc)*dtime - write(iulog,*)'endwb = ',endwb(indexc) - write(iulog,*)'begwb = ',begwb(indexc) - write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot(indexc)*dtime - write(iulog,*)'qflx_irrig = ',qflx_irrig(indexc)*dtime - write(iulog,*)'qflx_surf = ',qflx_surf(indexc)*dtime - write(iulog,*)'qflx_h2osfc_surf = ',qflx_h2osfc_surf(indexc)*dtime - write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc)*dtime - write(iulog,*)'qflx_drain = ',qflx_drain(indexc)*dtime - write(iulog,*)'qflx_ice_runoff_snwcp = ',qflx_ice_runoff_snwcp(indexc)*dtime - write(iulog,*)'qflx_ice_runoff_xs = ',qflx_ice_runoff_xs(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime - write(iulog,*)'qflx_rootsoi_col(1:nlevsoil) = ',qflx_rootsoi_col(indexc,:)*dtime - write(iulog,*)'total_plant_stored_h2o_col = ',total_plant_stored_h2o_col(indexc) - write(iulog,*)'deltawb = ',endwb(indexc)-begwb(indexc) - write(iulog,*)'deltawb/dtime = ',(endwb(indexc)-begwb(indexc))/dtime - write(iulog,*)'deltaflux = ',forc_rain_col(indexc)+forc_snow_col(indexc) - (qflx_evap_tot(indexc) + & - qflx_surf(indexc)+qflx_h2osfc_surf(indexc)+qflx_drain(indexc)) - - write(iulog,*)'clm model is stopping' - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - - else if (abs(errh2o(indexc)) > 1.e-5_r8 .and. (DAnstep > 2) ) then - - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' - write(iulog,*)'nstep = ',nstep - write(iulog,*)'errh2o = ',errh2o(indexc) - write(iulog,*)'forc_rain = ',forc_rain_col(indexc)*dtime - write(iulog,*)'forc_snow = ',forc_snow_col(indexc)*dtime - write(iulog,*)'total_plant_stored_h2o_col = ',total_plant_stored_h2o_col(indexc) - write(iulog,*)'endwb = ',endwb(indexc) - write(iulog,*)'begwb = ',begwb(indexc) - - write(iulog,*)'qflx_evap_tot = ',qflx_evap_tot(indexc)*dtime - write(iulog,*)'qflx_irrig = ',qflx_irrig(indexc)*dtime - write(iulog,*)'qflx_surf = ',qflx_surf(indexc)*dtime - write(iulog,*)'qflx_h2osfc_surf = ',qflx_h2osfc_surf(indexc)*dtime - write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc)*dtime - write(iulog,*)'qflx_drain = ',qflx_drain(indexc)*dtime - write(iulog,*)'qflx_drain_perched = ',qflx_drain_perched(indexc)*dtime - write(iulog,*)'qflx_flood = ',qflx_floodc(indexc)*dtime - write(iulog,*)'qflx_ice_runoff_snwcp = ',qflx_ice_runoff_snwcp(indexc)*dtime - write(iulog,*)'qflx_ice_runoff_xs = ',qflx_ice_runoff_xs(indexc)*dtime - write(iulog,*)'qflx_glcice_dyn_water_flux = ', qflx_glcice_dyn_water_flux(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime - write(iulog,*)'qflx_rootsoi_col(1:nlevsoil) = ',qflx_rootsoi_col(indexc,:)*dtime - write(iulog,*)'clm model is stopping' - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - ! Snow balance check - - do c = bounds%begc,bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - l = col%landunit(c) - - ! As defined here, snow_sources - snow_sinks will equal the change in h2osno at - ! any given time step but only if there is at least one snow layer. h2osno - ! also includes snow that is part of the soil column (an initial snow layer is - ! only created if h2osno > 10mm). - - if (col%snl(c) < 0) then - snow_sources(c) = qflx_prec_grnd(c) + qflx_dew_snow(c) + qflx_dew_grnd(c) - snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) + qflx_snow_drain(c) & - + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snwcp_discarded_ice(c) + qflx_snwcp_discarded_liq(c) & - + qflx_sl_top_soil(c) - - if (lun%itype(l) == istdlak) then - snow_sources(c) = qflx_snow_grnd_col(c) & - + frac_sno_eff(c) * (qflx_rain_grnd_col(c) & - + qflx_dew_snow(c) + qflx_dew_grnd(c) ) - snow_sinks(c) = frac_sno_eff(c) * (qflx_sub_snow(c) + qflx_evap_grnd(c) ) & - + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snwcp_discarded_ice(c) + qflx_snwcp_discarded_liq(c) & - + qflx_snow_drain(c) + qflx_sl_top_soil(c) - endif - - if (col%itype(c) == icol_road_perv .or. lun%itype(l) == istsoil .or. & - lun%itype(l) == istcrop .or. lun%itype(l) == istwet .or. & - lun%itype(l) == istice_mec) then - snow_sources(c) = (qflx_snow_grnd_col(c) - qflx_snow_h2osfc(c) ) & - + frac_sno_eff(c) * (qflx_rain_grnd_col(c) & - + qflx_dew_snow(c) + qflx_dew_grnd(c) ) + qflx_h2osfc_to_ice(c) - snow_sinks(c) = frac_sno_eff(c) * (qflx_sub_snow(c) + qflx_evap_grnd(c)) & - + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snwcp_discarded_ice(c) + qflx_snwcp_discarded_liq(c) & - + qflx_snow_drain(c) + qflx_sl_top_soil(c) - endif - - errh2osno(c) = (h2osno(c) - h2osno_old(c)) - (snow_sources(c) - snow_sinks(c)) * dtime - else - snow_sources(c) = 0._r8 - snow_sinks(c) = 0._r8 - errh2osno(c) = 0._r8 - end if - - end if - end do - - found = .false. - do c = bounds%begc,bounds%endc - if (col%active(c)) then - if (abs(errh2osno(c)) > 1.0e-9_r8) then - found = .true. - indexc = c - end if - end if - end do - if ( found ) then - write(iulog,*)'WARNING: snow balance error ' - write(iulog,*)'nstep= ',nstep, & - ' local indexc= ',indexc, & - ! ' global indexc= ',GetGlobalIndex(decomp_index=indexc, clmlevel=namec), & - ' col%itype= ',col%itype(indexc), & - ' lun%itype= ',lun%itype(col%landunit(indexc)), & - ' errh2osno= ',errh2osno(indexc) - - if (abs(errh2osno(indexc)) > 1.e-5_r8 .and. (DAnstep > 2) ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (mm)' - write(iulog,*)'nstep = ',nstep - write(iulog,*)'errh2osno = ',errh2osno(indexc) - write(iulog,*)'snl = ',col%snl(indexc) - write(iulog,*)'snow_depth = ',snow_depth(indexc) - write(iulog,*)'frac_sno_eff = ',frac_sno_eff(indexc) - write(iulog,*)'h2osno = ',h2osno(indexc) - write(iulog,*)'h2osno_old = ',h2osno_old(indexc) - write(iulog,*)'snow_sources = ',snow_sources(indexc)*dtime - write(iulog,*)'snow_sinks = ',snow_sinks(indexc)*dtime - write(iulog,*)'qflx_prec_grnd = ',qflx_prec_grnd(indexc)*dtime - write(iulog,*)'qflx_snow_grnd_col = ',qflx_snow_grnd_col(indexc)*dtime - write(iulog,*)'qflx_rain_grnd_col = ',qflx_rain_grnd_col(indexc)*dtime - write(iulog,*)'qflx_sub_snow = ',qflx_sub_snow(indexc)*dtime - write(iulog,*)'qflx_snow_drain = ',qflx_snow_drain(indexc)*dtime - write(iulog,*)'qflx_evap_grnd = ',qflx_evap_grnd(indexc)*dtime - write(iulog,*)'qflx_top_soil = ',qflx_top_soil(indexc)*dtime - write(iulog,*)'qflx_dew_snow = ',qflx_dew_snow(indexc)*dtime - write(iulog,*)'qflx_dew_grnd = ',qflx_dew_grnd(indexc)*dtime - write(iulog,*)'qflx_snwcp_ice = ',qflx_snwcp_ice(indexc)*dtime - write(iulog,*)'qflx_snwcp_liq = ',qflx_snwcp_liq(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_ice = ',qflx_snwcp_discarded_ice(indexc)*dtime - write(iulog,*)'qflx_snwcp_discarded_liq = ',qflx_snwcp_discarded_liq(indexc)*dtime - write(iulog,*)'qflx_sl_top_soil = ',qflx_sl_top_soil(indexc)*dtime - write(iulog,*)'clm model is stopping' - - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - ! Energy balance checks - - do p = bounds%begp, bounds%endp - if (patch%active(p)) then - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - - ! Solar radiation energy balance - ! Do not do this check for an urban patch since it will not balance on a per-column - ! level because of interactions between columns and since a separate check is done - ! in the urban radiation module - if (.not. lun%urbpoi(l)) then - errsol(p) = fsa(p) + fsr(p) & - - (forc_solad(g,1) + forc_solad(g,2) + forc_solai(g,1) + forc_solai(g,2)) - else - errsol(p) = spval - end if - - ! Longwave radiation energy balance - ! Do not do this check for an urban patch since it will not balance on a per-column - ! level because of interactions between columns and since a separate check is done - ! in the urban radiation module - if (.not. lun%urbpoi(l)) then - errlon(p) = eflx_lwrad_out(p) - eflx_lwrad_net(p) - forc_lwrad(c) - else - errlon(p) = spval - end if - - ! Surface energy balance - ! Changed to using (eflx_lwrad_net) here instead of (forc_lwrad - eflx_lwrad_out) because - ! there are longwave interactions between urban columns (and therefore patches). - ! For surfaces other than urban, (eflx_lwrad_net) equals (forc_lwrad - eflx_lwrad_out), - ! and a separate check is done above for these terms. - - if (.not. lun%urbpoi(l)) then - errseb(p) = sabv(p) + sabg_chk(p) + forc_lwrad(c) - eflx_lwrad_out(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - else - errseb(p) = sabv(p) + sabg(p) & - - eflx_lwrad_net(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) & - + eflx_wasteheat_patch(p) + eflx_heat_from_ac_patch(p) + eflx_traffic_patch(p) - end if - !TODO MV - move this calculation to a better place - does not belong in BalanceCheck - netrad(p) = fsa(p) - eflx_lwrad_net(p) - end if - end do - - ! Solar radiation energy balance check - - found = .false. - do p = bounds%begp, bounds%endp - if (patch%active(p)) then - if ( (errsol(p) /= spval) .and. (abs(errsol(p)) > 1.e-7_r8) ) then - found = .true. - indexp = p - indexg = patch%gridcell(indexp) - end if - end if - end do - if ( found .and. (DAnstep > 2) ) then - write(iulog,*)'WARNING:: BalanceCheck, solar radiation balance error (W/m2)' - write(iulog,*)'nstep = ',nstep - write(iulog,*)'errsol = ',errsol(indexp) - if (abs(errsol(indexp)) > 1.e-5_r8 ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (W/m2)' - write(iulog,*)'fsa = ',fsa(indexp) - write(iulog,*)'fsr = ',fsr(indexp) - write(iulog,*)'forc_solad(1) = ',forc_solad(indexg,1) - write(iulog,*)'forc_solad(2) = ',forc_solad(indexg,2) - write(iulog,*)'forc_solai(1) = ',forc_solai(indexg,1) - write(iulog,*)'forc_solai(2) = ',forc_solai(indexg,2) - write(iulog,*)'forc_tot = ',forc_solad(indexg,1)+forc_solad(indexg,2) & - +forc_solai(indexg,1)+forc_solai(indexg,2) - write(iulog,*)'clm model is stopping' - call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - ! Longwave radiation energy balance check - - found = .false. - do p = bounds%begp, bounds%endp - if (patch%active(p)) then - if ( (errlon(p) /= spval) .and. (abs(errlon(p)) > 1.e-7_r8) ) then - found = .true. - indexp = p - end if - end if - end do - if ( found .and. (DAnstep > 2) ) then - write(iulog,*)'WARNING: BalanceCheck: longwave energy balance error (W/m2)' - write(iulog,*)'nstep = ',nstep - write(iulog,*)'errlon = ',errlon(indexp) - if (abs(errlon(indexp)) > 1.e-5_r8 ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (W/m2)' - call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - ! Surface energy balance check - - found = .false. - do p = bounds%begp, bounds%endp - if (patch%active(p)) then - if (abs(errseb(p)) > 1.e-7_r8 ) then - found = .true. - indexp = p - indexc = patch%column(indexp) - indexg = patch%gridcell(indexp) - end if - end if - end do - if ( found .and. (DAnstep > 2) ) then - write(iulog,*)'WARNING: BalanceCheck: surface flux energy balance error (W/m2)' - write(iulog,*)'nstep = ' ,nstep - write(iulog,*)'errseb = ' ,errseb(indexp) - if (abs(errseb(indexp)) > 1.e-5_r8 ) then - write(iulog,*)'clm model is stopping - error is greater than 1e-5 (W/m2)' - write(iulog,*)'sabv = ' ,sabv(indexp) - - write(iulog,*)'sabg = ' ,sabg(indexp), ((1._r8- frac_sno(indexc))*sabg_soil(indexp) + & - frac_sno(indexc)*sabg_snow(indexp)),sabg_chk(indexp) - - write(iulog,*)'forc_tot = ' ,forc_solad(indexg,1) + forc_solad(indexg,2) + & - forc_solai(indexg,1) + forc_solai(indexg,2) - - write(iulog,*)'eflx_lwrad_net = ' ,eflx_lwrad_net(indexp) - write(iulog,*)'eflx_sh_tot = ' ,eflx_sh_tot(indexp) - write(iulog,*)'eflx_lh_tot = ' ,eflx_lh_tot(indexp) - write(iulog,*)'eflx_soil_grnd = ' ,eflx_soil_grnd(indexp) - write(iulog,*)'fsa fsr = ' ,fsa(indexp), fsr(indexp) - write(iulog,*)'fabd fabi = ' ,fabd(indexp,:), fabi(indexp,:) - write(iulog,*)'albd albi = ' ,albd(indexp,:), albi(indexp,:) - write(iulog,*)'ftii ftdd ftid = ' ,ftii(indexp,:), ftdd(indexp,:),ftid(indexp,:) - write(iulog,*)'elai esai = ' ,elai(indexp), esai(indexp) - write(iulog,*)'clm model is stopping' - call endrun(decomp_index=indexp, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - ! Soil energy balance check - - found = .false. - do c = bounds%begc,bounds%endc - if (col%active(c)) then - if (abs(errsoi_col(c)) > 1.0e-5_r8 ) then - found = .true. - indexc = c - end if - end if - end do - if ( found ) then - write(iulog,*)'WARNING: BalanceCheck: soil balance error (W/m2)' - write(iulog,*)'nstep = ',nstep - write(iulog,*)'errsoi_col = ',errsoi_col(indexc) - if (abs(errsoi_col(indexc)) > 1.e-4_r8 .and. (DAnstep > 2) ) then - write(iulog,*)'clm model is stopping' - call endrun(decomp_index=indexc, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - end associate - - end subroutine BalanceCheck - -end module BalanceCheckMod diff --git a/src/biogeophys/BandDiagonalMod.F90 b/src/biogeophys/BandDiagonalMod.F90 deleted file mode 100644 index 5065ea59b5..0000000000 --- a/src/biogeophys/BandDiagonalMod.F90 +++ /dev/null @@ -1,224 +0,0 @@ -module BandDiagonalMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Band Diagonal matrix solution - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : iulog - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: BandDiagonal - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine BandDiagonal(bounds, lbj, ubj, jtop, jbot, numf, filter, nband, b, r, u) - ! - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] - integer , intent(in) :: jbot( bounds%begc: ) ! bottom level for each column [col] - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: nband ! band width - integer , intent(in) :: filter(:) ! filter - real(r8), intent(in) :: b( bounds%begc: , 1: , lbj: ) ! compact band matrix [col, nband, j] - real(r8), intent(in) :: r( bounds%begc: , lbj: ) ! "r" rhs of linear system [col, j] - real(r8), intent(inout) :: u( bounds%begc: , lbj: ) ! solution [col, j] - ! - ! ! LOCAL VARIABLES: - integer :: j,ci,fc,info,m,n !indices - integer :: kl,ku !number of sub/super diagonals - integer, allocatable :: ipiv(:) !temporary - real(r8),allocatable :: ab(:,:),temp(:,:) !compact storage array - real(r8),allocatable :: result(:) - - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jtop) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(jbot) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(b) == (/bounds%endc, nband, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(r) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(u) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - - -!!$ SUBROUTINE SGBSV( N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO ) -!!$* -!!$* -- LAPACK driver routine (version 3.1) -- -!!$* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. -!!$* November 2006 -!!$* -!!$* .. Scalar Arguments .. -!!$ INTEGER INFO, KL, KU, LDAB, LDB, N, NRHS -!!$* .. -!!$* .. Array Arguments .. -!!$ INTEGER IPIV( * ) -!!$ REAL AB( LDAB, * ), B( LDB, * ) -!!$* .. -!!$* -!!$* Purpose -!!$* ======= -!!$* -!!$* SGBSV computes the solution to a real system of linear equations -!!$* A * X = B, where A is a band matrix of order N with KL subdiagonals -!!$* and KU superdiagonals, and X and B are N-by-NRHS matrices. -!!$* -!!$* The LU decomposition with partial pivoting and row interchanges is -!!$* used to factor A as A = L * U, where L is a product of permutation -!!$* and unit lower triangular matrices with KL subdiagonals, and U is -!!$* upper triangular with KL+KU superdiagonals. The factored form of A -!!$* is then used to solve the system of equations A * X = B. -!!$* -!!$* Arguments -!!$* ========= -!!$* -!!$* N (input) INTEGER -!!$* The number of linear equations, i.e., the order of the -!!$* matrix A. N >= 0. -!!$* -!!$* KL (input) INTEGER -!!$* The number of subdiagonals within the band of A. KL >= 0. -!!$* -!!$* KU (input) INTEGER -!!$* The number of superdiagonals within the band of A. KU >= 0. -!!$* -!!$* NRHS (input) INTEGER -!!$* The number of right hand sides, i.e., the number of columns -!!$* of the matrix B. NRHS >= 0. -!!$* -!!$* AB (input/output) REAL array, dimension (LDAB,N) -!!$* On entry, the matrix A in band storage, in rows KL+1 to -!!$* 2*KL+KU+1; rows 1 to KL of the array need not be set. -!!$* The j-th column of A is stored in the j-th column of the -!!$* array AB as follows: -!!$* AB(KL+KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+KL) -!!$* On exit, details of the factorization: U is stored as an -!!$* upper triangular band matrix with KL+KU superdiagonals in -!!$* rows 1 to KL+KU+1, and the multipliers used during the -!!$* factorization are stored in rows KL+KU+2 to 2*KL+KU+1. -!!$* See below for further details. -!!$* -!!$* LDAB (input) INTEGER -!!$* The leading dimension of the array AB. LDAB >= 2*KL+KU+1. -!!$* -!!$* IPIV (output) INTEGER array, dimension (N) -!!$* The pivot indices that define the permutation matrix P; -!!$* row i of the matrix was interchanged with row IPIV(i). -!!$* -!!$* B (input/output) REAL array, dimension (LDB,NRHS) -!!$* On entry, the N-by-NRHS right hand side matrix B. -!!$* On exit, if INFO = 0, the N-by-NRHS solution matrix X. -!!$* -!!$* LDB (input) INTEGER -!!$* The leading dimension of the array B. LDB >= max(1,N). -!!$* -!!$* INFO (output) INTEGER -!!$* = 0: successful exit -!!$* < 0: if INFO = -i, the i-th argument had an illegal value -!!$* > 0: if INFO = i, U(i,i) is exactly zero. The factorization -!!$* has been completed, but the factor U is exactly -!!$* singular, and the solution has not been computed. -!!$* -!!$* Further Details -!!$* =============== -!!$* -!!$* The band storage scheme is illustrated by the following example, when -!!$* M = N = 6, KL = 2, KU = 1: -!!$* -!!$* On entry: On exit: -!!$* -!!$* * * * + + + * * * u14 u25 u36 -!!$* * * + + + + * * u13 u24 u35 u46 -!!$* * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56 -!!$* a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66 -!!$* a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 * -!!$* a31 a42 a53 a64 * * m31 m42 m53 m64 * * -!!$* -!!$* Array elements marked * are not used by the routine; elements marked -!!$* + need not be set on entry, but are required by the routine to store -!!$* elements of U because of fill-in resulting from the row interchanges. - - -!Set up input matrix AB -!An m-by-n band matrix with kl subdiagonals and ku superdiagonals -!may be stored compactly in a two-dimensional array with -!kl+ku+1 rows and n columns -!AB(KL+KU+1+i-j,j) = A(i,j) - - do fc = 1,numf - ci = filter(fc) - - kl=(nband-1)/2 - ku=kl -! m is the number of rows required for storage space by dgbsv - m=2*kl+ku+1 -! n is the number of levels (snow/soil) -!scs: replace ubj with jbot - n=jbot(ci)-jtop(ci)+1 - - allocate(ab(m,n)) - ab=0.0 - - ab(kl+ku-1,3:n)=b(ci,1,jtop(ci):jbot(ci)-2) ! 2nd superdiagonal - ab(kl+ku+0,2:n)=b(ci,2,jtop(ci):jbot(ci)-1) ! 1st superdiagonal - ab(kl+ku+1,1:n)=b(ci,3,jtop(ci):jbot(ci)) ! diagonal - ab(kl+ku+2,1:n-1)=b(ci,4,jtop(ci)+1:jbot(ci)) ! 1st subdiagonal - ab(kl+ku+3,1:n-2)=b(ci,5,jtop(ci)+2:jbot(ci)) ! 2nd subdiagonal - - allocate(temp(m,n)) - temp=ab - - allocate(ipiv(n)) - allocate(result(n)) - -! on input result is rhs, on output result is solution vector - result(:)=r(ci,jtop(ci):jbot(ci)) - -! DGBSV( N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO ) - call dgbsv( n, kl, ku, 1, ab, m, ipiv, result, n, info ) - u(ci,jtop(ci):jbot(ci))=result(:) - - if(info /= 0) then - write(iulog,*)'index: ', ci - write(iulog,*)'n,kl,ku,m ',n,kl,ku,m - write(iulog,*)'dgbsv info: ',ci,info - - write(iulog,*) '' - write(iulog,*) 'ab matrix' - do j=1,n - ! write(iulog,'(i2,7f18.7)') j,temp(:,j) - write(iulog,'(i2,5f18.7)') j,temp(3:7,j) - enddo - write(iulog,*) '' - call endrun( 'BandDiagonal ERROR: dgbsv returned error code' ) - endif - deallocate(temp) - - deallocate(ab) - deallocate(ipiv) - deallocate(result) - end do - - end subroutine BandDiagonal - -end module BandDiagonalMod diff --git a/src/biogeophys/BareGroundFluxesMod.F90 b/src/biogeophys/BareGroundFluxesMod.F90 deleted file mode 100644 index cfbc99b740..0000000000 --- a/src/biogeophys/BareGroundFluxesMod.F90 +++ /dev/null @@ -1,431 +0,0 @@ -module BareGroundFluxesMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Compute sensible and latent fluxes and their derivatives with respect - ! to ground temperature using ground temperatures from previous time step. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use ch4Mod , only : ch4_type - use atm2lndType , only : atm2lnd_type - use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use PhotosynthesisMod , only : photosyns_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use HumanIndexMod , only : humanindex_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: BareGroundFluxes ! Calculate sensible and latent heat fluxes - !------------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------------ - subroutine BareGroundFluxes(bounds, num_noexposedvegp, filter_noexposedvegp, & - atm2lnd_inst, soilstate_inst, & - frictionvel_inst, ch4_inst, energyflux_inst, temperature_inst, & - waterflux_inst, waterstate_inst, photosyns_inst, humanindex_inst) - ! - ! !DESCRIPTION: - ! Compute sensible and latent fluxes and their derivatives with respect - ! to ground temperature using ground temperatures from previous time step. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_RGAS - use clm_varpar , only : nlevgrnd - use clm_varcon , only : cpair, vkc, grav, denice, denh2o - use clm_varctl , only : use_lch4 - use landunit_varcon , only : istsoil, istcrop - use FrictionVelocityMod , only : FrictionVelocity, MoninObukIni - use QSatMod , only : QSat - use SurfaceResistanceMod , only : do_soilevap_beta,do_soil_resistance_sl14 - use HumanIndexMod , only : calc_human_stress_indices, Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & - swbgt, hmdex, dis_coi, dis_coiS, THIndex, & - SwampCoolEff, KtoC, VaporPres - use FrictionVelocityMod , only : frictionvel_parms_inst - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_noexposedvegp ! number of points in filter_noexposedvegp - integer , intent(in) :: filter_noexposedvegp(:) ! patch filter where frac_veg_nosno is 0 - ! (but does NOT include lake or urban) - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - type(ch4_type) , intent(inout) :: ch4_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(humanindex_type) , intent(inout) :: humanindex_inst - ! - ! !LOCAL VARIABLES: - integer, parameter :: niters = 3 ! maximum number of iterations for surface temperature - integer :: p,c,g,f,j,l ! indices - integer :: iter ! iteration index - real(r8) :: zldis(bounds%begp:bounds%endp) ! reference height "minus" zero displacement height [m] - real(r8) :: displa(bounds%begp:bounds%endp) ! displacement height [m] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: dth(bounds%begp:bounds%endp) ! diff of virtual temp. between ref. height and surface - real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: dqh(bounds%begp:bounds%endp) ! diff of humidity between ref. height and surface - real(r8) :: obu(bounds%begp:bounds%endp) ! Monin-Obukhov length (m) - real(r8) :: ur(bounds%begp:bounds%endp) ! wind speed at reference height [m/s] - real(r8) :: um(bounds%begp:bounds%endp) ! wind speed including the stablity effect [m/s] - real(r8) :: temp1(bounds%begp:bounds%endp) ! relation for potential temperature profile - real(r8) :: temp12m(bounds%begp:bounds%endp) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(bounds%begp:bounds%endp) ! relation for specific humidity profile - real(r8) :: temp22m(bounds%begp:bounds%endp) ! relation for specific humidity profile applied at 2-m - real(r8) :: ustar(bounds%begp:bounds%endp) ! friction velocity [m/s] - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: cf_bare ! heat transfer coefficient from bare ground [-] - real(r8) :: ram ! aerodynamical resistance [s/m] - real(r8) :: rah ! thermal resistance [s/m] - real(r8) :: raw ! moisture resistance [s/m] - real(r8) :: raih ! temporary variable [kg/m2/s] - real(r8) :: raiw ! temporary variable [kg/m2/s] - real(r8) :: fm(bounds%begp:bounds%endp) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: z0mg_patch(bounds%begp:bounds%endp) - real(r8) :: z0hg_patch(bounds%begp:bounds%endp) - real(r8) :: z0qg_patch(bounds%begp:bounds%endp) - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - real(r8) :: www ! surface soil wetness [-] - !------------------------------------------------------------------------------ - - associate( & - soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:,:) ] evaporative soil resistance (s/m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - zii => col%zii , & ! Input: [real(r8) (:) ] convective boundary height [m] - - tc_ref2m => humanindex_inst%tc_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (C) - vap_ref2m => humanindex_inst%vap_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height vapor pressure (Pa) - appar_temp_ref2m => humanindex_inst%appar_temp_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m apparent temperature (C) - appar_temp_ref2m_r => humanindex_inst%appar_temp_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m apparent temperature (C) - swbgt_ref2m => humanindex_inst%swbgt_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Simplified Wetbulb Globe temperature (C) - swbgt_ref2m_r => humanindex_inst%swbgt_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Simplified Wetbulb Globe temperature (C) - humidex_ref2m => humanindex_inst%humidex_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Humidex (C) - humidex_ref2m_r => humanindex_inst%humidex_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Humidex (C) - wbt_ref2m => humanindex_inst%wbt_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Stull Wet Bulb temperature (C) - wbt_ref2m_r => humanindex_inst%wbt_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Stull Wet Bulb temperature (C) - wb_ref2m => humanindex_inst%wb_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Wet Bulb temperature (C) - wb_ref2m_r => humanindex_inst%wb_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Wet Bulb temperature (C) - teq_ref2m => humanindex_inst%teq_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height Equivalent temperature (K) - teq_ref2m_r => humanindex_inst%teq_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Equivalent temperature (K) - ept_ref2m => humanindex_inst%ept_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height Equivalent Potential temperature (K) - ept_ref2m_r => humanindex_inst%ept_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height Equivalent Potential temperature (K) - discomf_index_ref2m => humanindex_inst%discomf_index_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Discomfort Index temperature (C) - discomf_index_ref2m_r => humanindex_inst%discomf_index_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Discomfort Index temperature (C) - discomf_index_ref2mS => humanindex_inst%discomf_index_ref2mS_patch , & ! Output: [real(r8) (:) ] 2 m height Discomfort Index Stull temperature (C) - discomf_index_ref2mS_r => humanindex_inst%discomf_index_ref2mS_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Discomfort Index Stull temperature (K) - nws_hi_ref2m => humanindex_inst%nws_hi_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m NWS Heat Index (C) - nws_hi_ref2m_r => humanindex_inst%nws_hi_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m NWS Heat Index (C) - thip_ref2m => humanindex_inst%thip_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Temperature Humidity Index Physiology (C) - thip_ref2m_r => humanindex_inst%thip_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Temperature Humidity Index Physiology (C) - thic_ref2m => humanindex_inst%thic_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Temperature Humidity Index Comfort (C) - thic_ref2m_r => humanindex_inst%thic_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Temperature Humidity Index Comfort (C) - swmp65_ref2m => humanindex_inst%swmp65_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Swamp Cooler temperature 65% effi (C) - swmp65_ref2m_r => humanindex_inst%swmp65_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Swamp Cooler temperature 65% effi (C) - swmp80_ref2m => humanindex_inst%swmp80_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Swamp Cooler temperature 80% effi (C) - swmp80_ref2m_r => humanindex_inst%swmp80_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Swamp Cooler temperature 80% effi (C) - - forc_u => atm2lnd_inst%forc_u_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in east direction (m/s) - forc_v => atm2lnd_inst%forc_v_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in north direction (m/s) - forc_th => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric potential temperature (Kelvin) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) - forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - soilbeta => soilstate_inst%soilbeta_col , & ! Input: [real(r8) (:) ] soil wetness relative to field capacity - rootr => soilstate_inst%rootr_patch , & ! Output: [real(r8) (:,:) ] effective fraction of roots in each soil layer - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground surface temperature [K] - thv => temperature_inst%thv_col , & ! Input: [real(r8) (:) ] virtual potential temperature (kelvin) - thm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] intermediate variable (forc_t+0.0098*forc_hgt_t_patch) - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - beta => temperature_inst%beta_col , & ! Input: [real(r8) (:) ] coefficient of conective velocity [-] - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - qg_snow => waterstate_inst%qg_snow_col , & ! Input: [real(r8) (:) ] specific humidity at snow surface [kg/kg] - qg_soil => waterstate_inst%qg_soil_col , & ! Input: [real(r8) (:) ] specific humidity at soil surface [kg/kg] - qg_h2osfc => waterstate_inst%qg_h2osfc_col , & ! Input: [real(r8) (:) ] specific humidity at h2osfc surface [kg/kg] - qg => waterstate_inst%qg_col , & ! Input: [real(r8) (:) ] specific humidity at ground surface [kg/kg] - dqgdT => waterstate_inst%dqgdT_col , & ! Input: [real(r8) (:) ] temperature derivative of "qg" - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - grnd_ch4_cond => ch4_inst%grnd_ch4_cond_patch , & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] - - eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - taux => energyflux_inst%taux_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: e-w (kg/m/s**2) - tauy => energyflux_inst%tauy_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: n-s (kg/m/s**2) - dlrad => energyflux_inst%dlrad_patch , & ! Output: [real(r8) (:) ] downward longwave radiation below the canopy [W/m2] - ulrad => energyflux_inst%ulrad_patch , & ! Output: [real(r8) (:) ] upward longwave radiation above the canopy [W/m2] - cgrnds => energyflux_inst%cgrnds_patch , & ! Output: [real(r8) (:) ] deriv, of soil sensible heat flux wrt soil temp [w/m2/k] - cgrndl => energyflux_inst%cgrndl_patch , & ! Output: [real(r8) (:) ] deriv of soil latent heat flux wrt soil temp [w/m**2/k] - cgrnd => energyflux_inst%cgrnd_patch , & ! Output: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] - btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) - rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root resistance by layer (0-1) (nlevgrnd) - - t_ref2m => temperature_inst%t_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) - t_ref2m_r => temperature_inst%t_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface air temperature (Kelvin) - t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (Kelvin) - - q_ref2m => waterstate_inst%q_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface specific humidity (kg/kg) - rh_ref2m_r => waterstate_inst%rh_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface relative humidity (%) - rh_ref2m => waterstate_inst%rh_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface relative humidity (%) - - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: - u10_clm => frictionvel_inst%u10_clm_patch , & ! Input: [real(r8) (:) ] 10 m height winds (m/s) - zetamax => frictionvel_parms_inst%zetamaxstable , & ! Input: [real(r8) ] max zeta value under stable conditions - z0mg_col => frictionvel_inst%z0mg_col , & ! Output: [real(r8) (:) ] roughness length, momentum [m] - z0hg_col => frictionvel_inst%z0hg_col , & ! Output: [real(r8) (:) ] roughness length, sensible heat [m] - z0qg_col => frictionvel_inst%z0qg_col , & ! Output: [real(r8) (:) ] roughness length, latent heat [m] - ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) - - htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) [J/kg] - qflx_ev_snow => waterflux_inst%qflx_ev_snow_patch , & ! Output: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] - qflx_ev_soil => waterflux_inst%qflx_ev_soil_patch , & ! Output: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - qflx_ev_h2osfc => waterflux_inst%qflx_ev_h2osfc_patch , & ! Output: [real(r8) (:) ] evaporation flux from h2osfc (mm H2O/s) [+ to atm] - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - - rssun => photosyns_inst%rssun_patch , & ! Output: [real(r8) (:) ] leaf sunlit stomatal resistance (s/m) (output from Photosynthesis) - rssha => photosyns_inst%rssha_patch , & ! Output: [real(r8) (:) ] leaf shaded stomatal resistance (s/m) (output from Photosynthesis) - - begp => bounds%begp , & - endp => bounds%endp & - ) - - ! First do some simple settings of values over points where frac vegetation covered - ! by snow is zero - - do f = 1, num_noexposedvegp - p = filter_noexposedvegp(f) - c = patch%column(p) - btran(p) = 0._r8 - t_veg(p) = forc_t(c) - cf_bare = forc_pbot(c)/(SHR_CONST_RGAS*0.001_r8*thm(p))*1.e06_r8 - rssun(p) = 1._r8/1.e15_r8 * cf_bare - rssha(p) = 1._r8/1.e15_r8 * cf_bare - do j = 1, nlevgrnd - rootr(p,j) = 0._r8 - rresis(p,j) = 0._r8 - end do - end do - - ! Compute sensible and latent fluxes and their derivatives with respect - ! to ground temperature using ground temperatures from previous time step - - do f = 1, num_noexposedvegp - p = filter_noexposedvegp(f) - c = patch%column(p) - g = patch%gridcell(p) - - ! Initialization variables - - displa(p) = 0._r8 - dlrad(p) = 0._r8 - ulrad(p) = 0._r8 - - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - dth(p) = thm(p)-t_grnd(c) - dqh(p) = forc_q(c) - qg(c) - dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p) - zldis(p) = forc_hgt_u_patch(p) - - ! Copy column roughness to local patch-level arrays - - z0mg_patch(p) = z0mg_col(c) - z0hg_patch(p) = z0hg_col(c) - z0qg_patch(p) = z0qg_col(c) - - ! Initialize Monin-Obukhov length and wind speed - - call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg_patch(p), um(p), obu(p)) - - end do - - ! Perform stability iteration - ! Determine friction velocity, and potential temperature and humidity - ! profiles of the surface boundary layer - - do iter = 1, niters - - call FrictionVelocity(begp, endp, num_noexposedvegp, filter_noexposedvegp, & - displa(begp:endp), z0mg_patch(begp:endp), z0hg_patch(begp:endp), z0qg_patch(begp:endp), & - obu(begp:endp), iter, ur(begp:endp), um(begp:endp), ustar(begp:endp), & - temp1(begp:endp), temp2(begp:endp), temp12m(begp:endp), temp22m(begp:endp), fm(begp:endp), & - frictionvel_inst) - - do f = 1, num_noexposedvegp - p = filter_noexposedvegp(f) - c = patch%column(p) - g = patch%gridcell(p) - - tstar = temp1(p)*dth(p) - qstar = temp2(p)*dqh(p) - z0hg_patch(p) = z0mg_patch(p)/exp(0.13_r8 * (ustar(p)*z0mg_patch(p)/1.5e-5_r8)**0.45_r8) - z0qg_patch(p) = z0hg_patch(p) - thvstar = tstar*(1._r8+0.61_r8*forc_q(c)) + 0.61_r8*forc_th(c)*qstar - zeta = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) - - if (zeta >= 0._r8) then !stable - zeta = min(zetamax,max(zeta,0.01_r8)) - um(p) = max(ur(p),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta(c)*(-grav*ustar(p)*thvstar*zii(c)/thv(c))**0.333_r8 - um(p) = sqrt(ur(p)*ur(p) + wc*wc) - end if - obu(p) = zldis(p)/zeta - end do - - end do ! end stability iteration - - do f = 1, num_noexposedvegp - p = filter_noexposedvegp(f) - c = patch%column(p) - g = patch%gridcell(p) - l = patch%landunit(p) - - ! Determine aerodynamic resistances - - ram = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah = 1._r8/(temp1(p)*ustar(p)) - raw = 1._r8/(temp2(p)*ustar(p)) - raih = forc_rho(c)*cpair/rah - if (use_lch4) then - grnd_ch4_cond(p) = 1._r8/raw - end if - - ! Soil evaporation resistance - www = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/dz(c,1)/watsat(c,1) - www = min(max(www,0.0_r8),1._r8) - - !changed by K.Sakaguchi. Soilbeta is used for evaporation - if (dqh(p) > 0._r8) then !dew (beta is not applied, just like rsoil used to be) - raiw = forc_rho(c)/(raw) - else - if(do_soilevap_beta())then - ! Lee and Pielke 1992 beta is applied - raiw = soilbeta(c)*forc_rho(c)/(raw) - endif - if(do_soil_resistance_sl14())then - ! Swenson & Lawrence 2014 soil resistance is applied - raiw = forc_rho(c)/(raw+soilresis(c)) - endif - end if - - ram1(p) = ram !pass value to global variable - - ! Output to patch-level data structures - ! Derivative of fluxes with respect to ground temperature - cgrnds(p) = raih - cgrndl(p) = raiw*dqgdT(c) - cgrnd(p) = cgrnds(p) + htvp(c)*cgrndl(p) - - - ! Variables needed by history tape - - ! Surface fluxes of momentum, sensible and latent heat - ! using ground temperatures from previous time step - taux(p) = -forc_rho(c)*forc_u(g)/ram - tauy(p) = -forc_rho(c)*forc_v(g)/ram - eflx_sh_grnd(p) = -raih*dth(p) - eflx_sh_tot(p) = eflx_sh_grnd(p) - - ! compute sensible heat fluxes individually - eflx_sh_snow(p) = -raih*(thm(p)-t_soisno(c,snl(c)+1)) - eflx_sh_soil(p) = -raih*(thm(p)-t_soisno(c,1)) - eflx_sh_h2osfc(p) = -raih*(thm(p)-t_h2osfc(c)) - - ! water fluxes from soil - qflx_evap_soi(p) = -raiw*dqh(p) - qflx_evap_tot(p) = qflx_evap_soi(p) - - ! compute latent heat fluxes individually - qflx_ev_snow(p) = -raiw*(forc_q(c) - qg_snow(c)) - qflx_ev_soil(p) = -raiw*(forc_q(c) - qg_soil(c)) - qflx_ev_h2osfc(p) = -raiw*(forc_q(c) - qg_h2osfc(c)) - - ! 2 m height air temperature - t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) - - ! 2 m height specific humidity - q_ref2m(p) = forc_q(c) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) - - ! 2 m height relative humidity - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - rh_ref2m_r(p) = rh_ref2m(p) - t_ref2m_r(p) = t_ref2m(p) - end if - - ! Human Heat Stress - if ( calc_human_stress_indices )then - call KtoC(t_ref2m(p), tc_ref2m(p)) - call VaporPres(rh_ref2m(p), e_ref2m, vap_ref2m(p)) - call Wet_Bulb(t_ref2m(p), vap_ref2m(p), forc_pbot(c), rh_ref2m(p), q_ref2m(p), & - teq_ref2m(p), ept_ref2m(p), wb_ref2m(p)) - call Wet_BulbS(tc_ref2m(p),rh_ref2m(p), wbt_ref2m(p)) - call HeatIndex(tc_ref2m(p), rh_ref2m(p), nws_hi_ref2m(p)) - call AppTemp(tc_ref2m(p), vap_ref2m(p), u10_clm(p), appar_temp_ref2m(p)) - call swbgt(tc_ref2m(p), vap_ref2m(p), swbgt_ref2m(p)) - call hmdex(tc_ref2m(p), vap_ref2m(p), humidex_ref2m(p)) - call dis_coi(tc_ref2m(p), wb_ref2m(p), discomf_index_ref2m(p)) - call dis_coiS(tc_ref2m(p), rh_ref2m(p), wbt_ref2m(p), discomf_index_ref2mS(p)) - call THIndex(tc_ref2m(p), wb_ref2m(p), thic_ref2m(p), thip_ref2m(p)) - call SwampCoolEff(tc_ref2m(p), wb_ref2m(p), swmp80_ref2m(p), swmp65_ref2m(p)) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - teq_ref2m_r(p) = teq_ref2m(p) - ept_ref2m_r(p) = ept_ref2m(p) - wb_ref2m_r(p) = wb_ref2m(p) - wbt_ref2m_r(p) = wbt_ref2m(p) - nws_hi_ref2m_r(p) = nws_hi_ref2m(p) - appar_temp_ref2m_r(p) = appar_temp_ref2m(p) - swbgt_ref2m_r(p) = swbgt_ref2m(p) - humidex_ref2m_r(p) = humidex_ref2m(p) - discomf_index_ref2m_r(p) = discomf_index_ref2m(p) - discomf_index_ref2mS_r(p) = discomf_index_ref2mS(p) - thic_ref2m_r(p) = thic_ref2m(p) - thip_ref2m_r(p) = thip_ref2m(p) - swmp80_ref2m_r(p) = swmp80_ref2m(p) - swmp65_ref2m_r(p) = swmp65_ref2m(p) - end if - end if - end do - - end associate - - end subroutine BareGroundFluxes - -end module BareGroundFluxesMod diff --git a/src/biogeophys/CMakeLists.txt b/src/biogeophys/CMakeLists.txt deleted file mode 100644 index 55ad7e1c65..0000000000 --- a/src/biogeophys/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -list(APPEND clm_sources - AerosolMod.F90 - DaylengthMod.F90 - GlacierSurfaceMassBalanceMod.F90 - HumanIndexMod.F90 - IrrigationMod.F90 - LakeCon.F90 - QSatMod.F90 - RootBiophysMod.F90 - SnowHydrologyMod.F90 - SnowSnicarMod.F90 - SoilHydrologyType.F90 - SoilStateType.F90 - SoilWaterRetentionCurveMod.F90 - TemperatureType.F90 - TotalWaterAndHeatMod.F90 - UrbanParamsType.F90 - WaterfluxType.F90 - WaterStateType.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/biogeophys/CanopyFluxesMod.F90 b/src/biogeophys/CanopyFluxesMod.F90 deleted file mode 100644 index 9b662bb372..0000000000 --- a/src/biogeophys/CanopyFluxesMod.F90 +++ /dev/null @@ -1,1372 +0,0 @@ -module CanopyFluxesMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Performs calculation of leaf temperature and surface fluxes. - ! SoilFluxes then determines soil/snow and ground temperatures and updates the surface - ! fluxes for the new ground temperature. - ! - ! !USES: - use shr_sys_mod , only : shr_sys_flush - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog, use_cn, use_lch4, use_c13, use_c14, use_cndv, use_fates, & - use_luna, use_hydrstress - use clm_varpar , only : nlevgrnd, nlevsno - use clm_varcon , only : namep - use pftconMod , only : pftcon - use decompMod , only : bounds_type - use PhotosynthesisMod , only : Photosynthesis, PhotoSynthesisHydraulicStress, PhotosynthesisTotal, Fractionation - use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDBtranMod , only : btran_ed - use SoilMoistStressMod , only : calc_effective_soilporosity, calc_volumetric_h2oliq - use SoilMoistStressMod , only : calc_root_moist_stress, set_perchroot_opt - use SimpleMathMod , only : array_div_vector - use SurfaceResistanceMod , only : do_soilevap_beta,do_soil_resistance_sl14 - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use FrictionvelocityMod , only : frictionvel_type - use OzoneBaseMod , only : ozone_base_type - use SoilStateType , only : soilstate_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use CanopyHydrologyMod , only : IsSnowvegFlagOn, IsSnowvegFlagOnRad - use HumanIndexMod , only : humanindex_type - use ch4Mod , only : ch4_type - use PhotosynthesisMod , only : photosyns_type - use GridcellType , only : grc - use ColumnType , only : col - use PatchType , only : patch - use EDTypesMod , only : ed_site_type - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use LunaMod , only : Update_Photosynthesis_Capacity, Acc24_Climate_LUNA,Acc240_Climate_LUNA,Clear24_Climate_LUNA - ! - ! !PUBLIC TYPES: - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CanopyFluxesReadNML ! Read in namelist settings - public :: CanopyFluxes ! Calculate canopy fluxes - ! - ! !PUBLIC DATA MEMBERS: - ! true => btran is based only on unfrozen soil levels - logical, public :: perchroot = .false. - - ! true => btran is based on active layer (defined over two years); - ! false => btran is based on currently unfrozen levels - logical, public :: perchroot_alt = .false. - ! - ! !PRIVATE DATA MEMBERS: - ! Snow in vegetation canopy namelist options. - logical, private :: snowveg_on = .false. ! snowveg_flag = 'ON' - logical, private :: snowveg_onrad = .true. ! snowveg_flag = 'ON_RAD' - logical, private :: use_undercanopy_stability = .true. ! use undercanopy stability term or not - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine CanopyFluxesReadNML(NLFilename) - ! - ! !DESCRIPTION: - ! Read the namelist for Canopy Fluxes - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'CanopyFluxeseadNML' - character(len=*), parameter :: nmlname = 'canopyfluxes_inparm' - !----------------------------------------------------------------------- - - namelist /canopyfluxes_inparm/ use_undercanopy_stability - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=canopyfluxes_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (use_undercanopy_stability, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=canopyfluxes_inparm) - write(iulog,*) ' ' - end if - - end subroutine CanopyFluxesReadNML - - !------------------------------------------------------------------------------ - subroutine CanopyFluxes(bounds, num_exposedvegp, filter_exposedvegp, & - clm_fates, nc, atm2lnd_inst, canopystate_inst, & - energyflux_inst, frictionvel_inst, soilstate_inst, solarabs_inst, surfalb_inst, & - temperature_inst, waterflux_inst, waterstate_inst, ch4_inst, ozone_inst, photosyns_inst, & - humanindex_inst, soil_water_retention_curve, & - downreg_patch, leafn_patch, froot_carbon, croot_carbon) - ! - ! !DESCRIPTION: - ! 1. Calculates the leaf temperature: - ! 2. Calculates the leaf fluxes, transpiration, photosynthesis and - ! updates the dew accumulation due to evaporation. - ! - ! Method: - ! Use the Newton-Raphson iteration to solve for the foliage - ! temperature that balances the surface energy budget: - ! - ! f(t_veg) = Net radiation - Sensible - Latent = 0 - ! f(t_veg) + d(f)/d(t_veg) * dt_veg = 0 (*) - ! - ! Note: - ! (1) In solving for t_veg, t_grnd is given from the previous timestep. - ! (2) The partial derivatives of aerodynamical resistances, which cannot - ! be determined analytically, are ignored for d(H)/dT and d(LE)/dT - ! (3) The weighted stomatal resistance of sunlit and shaded foliage is used - ! (4) Canopy air temperature and humidity are derived from => Hc + Hg = Ha - ! => Ec + Eg = Ea - ! (5) Energy loss is due to: numerical truncation of energy budget equation - ! (*); and "ecidif" (see the code) which is dropped into the sensible - ! heat - ! (6) The convergence criteria: the difference, del = t_veg(n+1)-t_veg(n) - ! and del2 = t_veg(n)-t_veg(n-1) less than 0.01 K, and the difference - ! of water flux from the leaf between the iteration step (n+1) and (n) - ! less than 0.1 W/m2; or the iterative steps over 40. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_RGAS - use clm_time_manager , only : get_step_size, get_prev_date,is_end_curr_day - use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice - use clm_varcon , only : denh2o, tfrz, csoilc, tlsai_crit, alpha_aero - use clm_varcon , only : c14ratio - use perf_mod , only : t_startf, t_stopf - use QSatMod , only : QSat - use CLMFatesInterfaceMod, only : hlm_fates_interface_type - use FrictionVelocityMod, only : FrictionVelocity, MoninObukIni, frictionvel_parms_inst - use HumanIndexMod , only : calc_human_stress_indices, Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & - swbgt, hmdex, dis_coi, dis_coiS, THIndex, & - SwampCoolEff, KtoC, VaporPres - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - type(hlm_fates_interface_type) , intent(inout) :: clm_fates - integer , intent(in) :: nc ! clump index - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - class(ozone_base_type) , intent(inout) :: ozone_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(humanindex_type) , intent(inout) :: humanindex_inst - class(soil_water_retention_curve_type) , intent(in) :: soil_water_retention_curve - real(r8), intent(in) :: downreg_patch(bounds%begp:) ! fractional reduction in GPP due to N limitation (dimensionless) - 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) - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: bsun(:) ! sunlit canopy transpiration wetness factor (0 to 1) - real(r8), pointer :: bsha(:) ! shaded canopy transpiration wetness factor (0 to 1) - real(r8), parameter :: btran0 = 0.0_r8 ! initial value - real(r8), parameter :: zii = 1000.0_r8 ! convective boundary layer height [m] - real(r8), parameter :: beta = 1.0_r8 ! coefficient of conective velocity [-] - real(r8), parameter :: delmax = 1.0_r8 ! maxchange in leaf temperature [K] - real(r8), parameter :: dlemin = 0.1_r8 ! max limit for energy flux convergence [w/m2] - real(r8), parameter :: dtmin = 0.01_r8 ! max limit for temperature convergence [K] - integer , parameter :: itmax = 40 ! maximum number of iteration [-] - integer , parameter :: itmin = 2 ! minimum number of iteration [-] - - !added by K.Sakaguchi for litter resistance - real(r8), parameter :: lai_dl = 0.5_r8 ! placeholder for (dry) plant litter area index (m2/m2) - real(r8), parameter :: z_dl = 0.05_r8 ! placeholder for (dry) litter layer thickness (m) - - !added by K.Sakaguchi for stability formulation - real(r8), parameter :: ria = 0.5_r8 ! free parameter for stable formulation (currently = 0.5, "gamma" in Sakaguchi&Zeng,2008) - - real(r8) :: dtime ! land model time step (sec) - real(r8) :: zldis(bounds%begp:bounds%endp) ! reference height "minus" zero displacement height [m] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: dth(bounds%begp:bounds%endp) ! diff of virtual temp. between ref. height and surface - real(r8) :: dthv(bounds%begp:bounds%endp) ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: dqh(bounds%begp:bounds%endp) ! diff of humidity between ref. height and surface - real(r8) :: obu(bounds%begp:bounds%endp) ! Monin-Obukhov length (m) - real(r8) :: um(bounds%begp:bounds%endp) ! wind speed including the stablity effect [m/s] - real(r8) :: ur(bounds%begp:bounds%endp) ! wind speed at reference height [m/s] - real(r8) :: uaf(bounds%begp:bounds%endp) ! velocity of air within foliage [m/s] - real(r8) :: temp1(bounds%begp:bounds%endp) ! relation for potential temperature profile - real(r8) :: temp12m(bounds%begp:bounds%endp) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(bounds%begp:bounds%endp) ! relation for specific humidity profile - real(r8) :: temp22m(bounds%begp:bounds%endp) ! relation for specific humidity profile applied at 2-m - real(r8) :: ustar(bounds%begp:bounds%endp) ! friction velocity [m/s] - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: taf(bounds%begp:bounds%endp) ! air temperature within canopy space [K] - real(r8) :: qaf(bounds%begp:bounds%endp) ! humidity of canopy air [kg/kg] - real(r8) :: rpp ! fraction of potential evaporation from leaf [-] - real(r8) :: rppdry ! fraction of potential evaporation through transp [-] - real(r8) :: cf ! heat transfer coefficient from leaves [-] - real(r8) :: rb(bounds%begp:bounds%endp) ! leaf boundary layer resistance [s/m] - real(r8) :: rah(bounds%begp:bounds%endp,2) ! thermal resistance [s/m] - real(r8) :: raw(bounds%begp:bounds%endp,2) ! moisture resistance [s/m] - real(r8) :: wta ! heat conductance for air [m/s] - real(r8) :: wtg(bounds%begp:bounds%endp) ! heat conductance for ground [m/s] - real(r8) :: wtl ! heat conductance for leaf [m/s] - real(r8) :: wta0(bounds%begp:bounds%endp) ! normalized heat conductance for air [-] - real(r8) :: wtl0(bounds%begp:bounds%endp) ! normalized heat conductance for leaf [-] - real(r8) :: wtg0 ! normalized heat conductance for ground [-] - real(r8) :: wtal(bounds%begp:bounds%endp) ! normalized heat conductance for air and leaf [-] - real(r8) :: wtga ! normalized heat cond. for air and ground [-] - real(r8) :: wtaq ! latent heat conductance for air [m/s] - real(r8) :: wtlq ! latent heat conductance for leaf [m/s] - real(r8) :: wtgq(bounds%begp:bounds%endp) ! latent heat conductance for ground [m/s] - real(r8) :: wtaq0(bounds%begp:bounds%endp) ! normalized latent heat conductance for air [-] - real(r8) :: wtlq0(bounds%begp:bounds%endp) ! normalized latent heat conductance for leaf [-] - real(r8) :: wtgq0 ! normalized heat conductance for ground [-] - real(r8) :: wtalq(bounds%begp:bounds%endp) ! normalized latent heat cond. for air and leaf [-] - real(r8) :: wtgaq ! normalized latent heat cond. for air and ground [-] - real(r8) :: el(bounds%begp:bounds%endp) ! vapor pressure on leaf surface [pa] - real(r8) :: deldT ! derivative of "el" on "t_veg" [pa/K] - real(r8) :: qsatl(bounds%begp:bounds%endp) ! leaf specific humidity [kg/kg] - real(r8) :: qsatldT(bounds%begp:bounds%endp) ! derivative of "qsatl" on "t_veg" - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - real(r8) :: air(bounds%begp:bounds%endp) ! atmos. radiation temporay set - real(r8) :: bir(bounds%begp:bounds%endp) ! atmos. radiation temporay set - real(r8) :: cir(bounds%begp:bounds%endp) ! atmos. radiation temporay set - real(r8) :: dc1,dc2 ! derivative of energy flux [W/m2/K] - real(r8) :: delt ! temporary - real(r8) :: delq(bounds%begp:bounds%endp) ! temporary - real(r8) :: del(bounds%begp:bounds%endp) ! absolute change in leaf temp in current iteration [K] - real(r8) :: del2(bounds%begp:bounds%endp) ! change in leaf temperature in previous iteration [K] - real(r8) :: dele(bounds%begp:bounds%endp) ! change in latent heat flux from leaf [K] - real(r8) :: dels ! change in leaf temperature in current iteration [K] - real(r8) :: det(bounds%begp:bounds%endp) ! maximum leaf temp. change in two consecutive iter [K] - real(r8) :: efeb(bounds%begp:bounds%endp) ! latent heat flux from leaf (previous iter) [mm/s] - real(r8) :: efeold ! latent heat flux from leaf (previous iter) [mm/s] - real(r8) :: efpot ! potential latent energy flux [kg/m2/s] - real(r8) :: efe(bounds%begp:bounds%endp) ! water flux from leaf [mm/s] - real(r8) :: efsh ! sensible heat from leaf [mm/s] - real(r8) :: obuold(bounds%begp:bounds%endp) ! monin-obukhov length from previous iteration - real(r8) :: tlbef(bounds%begp:bounds%endp) ! leaf temperature from previous iteration [K] - real(r8) :: ecidif ! excess energies [W/m2] - real(r8) :: err(bounds%begp:bounds%endp) ! balance error - real(r8) :: erre ! balance error - real(r8) :: co2(bounds%begp:bounds%endp) ! atmospheric co2 partial pressure (pa) - real(r8) :: c13o2(bounds%begp:bounds%endp) ! atmospheric c13o2 partial pressure (pa) - real(r8) :: o2(bounds%begp:bounds%endp) ! atmospheric o2 partial pressure (pa) - real(r8) :: svpts(bounds%begp:bounds%endp) ! saturation vapor pressure at t_veg (pa) - real(r8) :: eah(bounds%begp:bounds%endp) ! canopy air vapor pressure (pa) - real(r8) :: s_node ! vol_liq/eff_porosity - real(r8) :: smp_node ! matrix potential - real(r8) :: smp_node_lf ! F. Li and S. Levis - real(r8) :: vol_liq ! partial volume of liquid water in layer - integer :: itlef ! counter for leaf temperature iteration [-] - integer :: nmozsgn(bounds%begp:bounds%endp) ! number of times stability changes sign - real(r8) :: w ! exp(-LSAI) - real(r8) :: csoilcn ! interpolated csoilc for less than dense canopies - real(r8) :: fm(bounds%begp:bounds%endp) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: wtshi ! sensible heat resistance for air, grnd and leaf [-] - real(r8) :: wtsqi ! latent heat resistance for air, grnd and leaf [-] - integer :: j ! soil/snow level index - integer :: p ! patch index - integer :: c ! column index - integer :: l ! landunit index - integer :: g ! gridcell index - integer :: fn ! number of values in vegetated patch filter - integer :: filterp(bounds%endp-bounds%begp+1) ! vegetated patch filter - integer :: fnorig ! number of values in patch filter copy - integer :: fporig(bounds%endp-bounds%begp+1) ! temporary filter - integer :: fnold ! temporary copy of patch count - integer :: f ! filter index - logical :: found ! error flag for canopy above forcing hgt - integer :: index ! patch index for error - real(r8) :: egvf ! effective green vegetation fraction - real(r8) :: lt ! elai+esai - real(r8) :: ri ! stability parameter for under canopy air (unitless) - real(r8) :: csoilb ! turbulent transfer coefficient over bare soil (unitless) - real(r8) :: ricsoilc ! modified transfer coefficient under dense canopy (unitless) - real(r8) :: snow_depth_c ! critical snow depth to cover plant litter (m) - real(r8) :: rdl ! dry litter layer resistance for water vapor (s/m) - real(r8) :: elai_dl ! exposed (dry) plant litter area index - real(r8) :: fsno_dl ! effective snow cover over plant litter - real(r8) :: dayl_factor(bounds%begp:bounds%endp) ! scalar (0-1) for daylength effect on Vcmax - ! If no unfrozen layers, put all in the top layer. - real(r8) :: rootsum(bounds%begp:bounds%endp) - real(r8) :: delt_snow - real(r8) :: delt_soil - real(r8) :: delt_h2osfc - real(r8) :: lw_grnd - real(r8) :: delq_snow - real(r8) :: delq_soil - real(r8) :: delq_h2osfc - real(r8) :: dt_veg(bounds%begp:bounds%endp) ! change in t_veg, last iteration (Kelvin) - integer :: jtop(bounds%begc:bounds%endc) ! lbning - integer :: filterc_tmp(bounds%endp-bounds%begp+1) ! temporary variable - integer :: ft ! plant functional type index - real(r8) :: temprootr - real(r8) :: dt_veg_temp(bounds%begp:bounds%endp) - integer :: iv - logical :: is_end_day ! is end of current day - - integer :: dummy_to_make_pgi_happy - !------------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(downreg_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leafn_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - soilresis => soilstate_inst%soilresis_col , & ! Input: [real(r8) (:) ] soil evaporative resistance - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - max_dayl => grc%max_dayl , & ! Input: [real(r8) (:) ] maximum daylength for this grid cell (s) - - dleaf => pftcon%dleaf , & ! Input: characteristic leaf dimension (m) - - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_th => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric potential temperature (Kelvin) - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - forc_u => atm2lnd_inst%forc_u_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in east direction (m/s) - forc_v => atm2lnd_inst%forc_v_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in north direction (m/s) - forc_pco2 => atm2lnd_inst%forc_pco2_grc , & ! Input: [real(r8) (:) ] partial pressure co2 (Pa) - forc_pc13o2 => atm2lnd_inst%forc_pc13o2_grc , & ! Input: [real(r8) (:) ] partial pressure c13o2 (Pa) - forc_po2 => atm2lnd_inst%forc_po2_grc , & ! Input: [real(r8) (:) ] partial pressure o2 (Pa) - - tc_ref2m => humanindex_inst%tc_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (C) - vap_ref2m => humanindex_inst%vap_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height vapor pressure (Pa) - appar_temp_ref2m => humanindex_inst%appar_temp_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m apparent temperature (C) - appar_temp_ref2m_r => humanindex_inst%appar_temp_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m apparent temperature (C) - swbgt_ref2m => humanindex_inst%swbgt_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Simplified Wetbulb Globe temperature (C) - swbgt_ref2m_r => humanindex_inst%swbgt_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Simplified Wetbulb Globe temperature (C) - humidex_ref2m => humanindex_inst%humidex_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Humidex (C) - humidex_ref2m_r => humanindex_inst%humidex_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Humidex (C) - wbt_ref2m => humanindex_inst%wbt_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Stull Wet Bulb temperature (C) - wbt_ref2m_r => humanindex_inst%wbt_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Stull Wet Bulb temperature (C) - wb_ref2m => humanindex_inst%wb_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Wet Bulb temperature (C) - wb_ref2m_r => humanindex_inst%wb_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Wet Bulb temperature (C) - teq_ref2m => humanindex_inst%teq_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height Equivalent temperature (K) - teq_ref2m_r => humanindex_inst%teq_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Equivalent temperature (K) - ept_ref2m => humanindex_inst%ept_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height Equivalent Potential temperature (K) - ept_ref2m_r => humanindex_inst%ept_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height Equivalent Potential temperature (K) - discomf_index_ref2m => humanindex_inst%discomf_index_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Discomfort Index temperature (C) - discomf_index_ref2m_r => humanindex_inst%discomf_index_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Discomfort Index temperature (C) - discomf_index_ref2mS => humanindex_inst%discomf_index_ref2mS_patch , & ! Output: [real(r8) (:) ] 2 m height Discomfort Index Stull temperature (C) - discomf_index_ref2mS_r => humanindex_inst%discomf_index_ref2mS_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Discomfort Index Stull temperature (K) - nws_hi_ref2m => humanindex_inst%nws_hi_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m NWS Heat Index (C) - nws_hi_ref2m_r => humanindex_inst%nws_hi_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m NWS Heat Index (C) - thip_ref2m => humanindex_inst%thip_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Temperature Humidity Index Physiology (C) - thip_ref2m_r => humanindex_inst%thip_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Temperature Humidity Index Physiology (C) - thic_ref2m => humanindex_inst%thic_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Temperature Humidity Index Comfort (C) - thic_ref2m_r => humanindex_inst%thic_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Temperature Humidity Index Comfort (C) - swmp65_ref2m => humanindex_inst%swmp65_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Swamp Cooler temperature 65% effi (C) - swmp65_ref2m_r => humanindex_inst%swmp65_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Swamp Cooler temperature 65% effi (C) - swmp80_ref2m => humanindex_inst%swmp80_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Swamp Cooler temperature 80% effi (C) - swmp80_ref2m_r => humanindex_inst%swmp80_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m Swamp Cooler temperature 80% effi (C) - - sabv => solarabs_inst%sabv_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by vegetation (W/m**2) - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - displa => canopystate_inst%displa_patch , & ! Input: [real(r8) (:) ] displacement height (m) - htop => canopystate_inst%htop_patch , & ! Input: [real(r8) (:) ] canopy top(m) - altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col , & ! Input: [integer (:) ] prior year maximum annual depth of thaw - altmax_indx => canopystate_inst%altmax_indx_col , & ! Input: [integer (:) ] maximum annual depth of thaw - dleaf_patch => canopystate_inst%dleaf_patch , & ! Output: [real(r8) (:) ] mean leaf diameter for this patch/pft - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) (constant) - watdry => soilstate_inst%watdry_col , & ! Input: [real(r8) (:,:) ] btran parameter for btran=0 (constant) - watopt => soilstate_inst%watopt_col , & ! Input: [real(r8) (:,:) ] btran parameter for btran=1 (constant) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Output: [real(r8) (:,:) ] effective soil porosity - soilbeta => soilstate_inst%soilbeta_col , & ! Input: [real(r8) (:) ] soil wetness relative to field capacity - rootr => soilstate_inst%rootr_patch , & ! Output: [real(r8) (:,:) ] effective fraction of roots in each soil layer - - u10_clm => frictionvel_inst%u10_clm_patch , & ! Input: [real(r8) (:) ] 10 m height winds (m/s) - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at patch level [m] - z0mg => frictionvel_inst%z0mg_col , & ! Input: [real(r8) (:) ] roughness length of ground, momentum [m] - zetamax => frictionvel_parms_inst%zetamaxstable , & ! Input: [real(r8) ] max zeta value under stable conditions - ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) - z0mv => frictionvel_inst%z0mv_patch , & ! Output: [real(r8) (:) ] roughness length over vegetation, momentum [m] - z0hv => frictionvel_inst%z0hv_patch , & ! Output: [real(r8) (:) ] roughness length over vegetation, sensible heat [m] - z0qv => frictionvel_inst%z0qv_patch , & ! Output: [real(r8) (:) ] roughness length over vegetation, latent heat [m] - rb1 => frictionvel_inst%rb1_patch , & ! Output: [real(r8) (:) ] boundary layer resistance (s/m) - - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground surface temperature [K] - thv => temperature_inst%thv_col , & ! Input: [real(r8) (:) ] virtual potential temperature (kelvin) - thm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] intermediate variable (forc_t+0.0098*forc_hgt_t_patch) - emv => temperature_inst%emv_patch , & ! Input: [real(r8) (:) ] vegetation emissivity - emg => temperature_inst%emg_col , & ! Input: [real(r8) (:) ] vegetation emissivity - t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (Kelvin) - t_ref2m => temperature_inst%t_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) - t_ref2m_r => temperature_inst%t_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface air temperature (Kelvin) - t_skin_patch => temperature_inst%t_skin_patch , & ! Output: [real(r8) (:) ] patch skin temperature (K) - - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of surface water - fwet => waterstate_inst%fwet_patch , & ! Input: [real(r8) (:) ] fraction of canopy that is wet (0 to 1) - fdry => waterstate_inst%fdry_patch , & ! Input: [real(r8) (:) ] fraction of foliage that is green and dry [-] - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - qg_snow => waterstate_inst%qg_snow_col , & ! Input: [real(r8) (:) ] specific humidity at snow surface [kg/kg] - qg_soil => waterstate_inst%qg_soil_col , & ! Input: [real(r8) (:) ] specific humidity at soil surface [kg/kg] - qg_h2osfc => waterstate_inst%qg_h2osfc_col , & ! Input: [real(r8) (:) ] specific humidity at h2osfc surface [kg/kg] - qg => waterstate_inst%qg_col , & ! Input: [real(r8) (:) ] specific humidity at ground surface [kg/kg] - dqgdT => waterstate_inst%dqgdT_col , & ! Input: [real(r8) (:) ] temperature derivative of "qg" - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] by F. Li and S. Levis - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_liqvol => waterstate_inst%h2osoi_liqvol_col , & ! Output: [real(r8) (:,:) ] volumetric liquid water (v/v) - h2ocan => waterstate_inst%h2ocan_patch , & ! Output: [real(r8) (:) ] canopy water (mm H2O) - snocan => waterstate_inst%snocan_patch , & ! Output: [real(r8) (:) ] canopy snow (mm H2O) - liqcan => waterstate_inst%liqcan_patch , & ! Output: [real(r8) (:) ] canopy liquid (mm H2O) - snounload => waterstate_inst%snounload_patch , & ! Output: [real(r8) (:) ] canopy snow unloading mass (mm H2O) - - q_ref2m => waterstate_inst%q_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface specific humidity (kg/kg) - rh_ref2m_r => waterstate_inst%rh_ref2m_r_patch , & ! Output: [real(r8) (:) ] Rural 2 m height surface relative humidity (%) - rh_ref2m => waterstate_inst%rh_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface relative humidity (%) - rhaf => waterstate_inst%rh_af_patch , & ! Output: [real(r8) (:) ] fractional humidity of canopy air [dimensionless] - - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Output: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_evap_veg => waterflux_inst%qflx_evap_veg_patch , & ! Output: [real(r8) (:) ] vegetation evaporation (mm H2O/s) (+ = to atm) - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_ev_snow => waterflux_inst%qflx_ev_snow_patch , & ! Output: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] - qflx_ev_soil => waterflux_inst%qflx_ev_soil_patch , & ! Output: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - qflx_ev_h2osfc => waterflux_inst%qflx_ev_h2osfc_patch , & ! Output: [real(r8) (:) ] evaporation flux from h2osfc (mm H2O/s) [+ to atm] - - rssun => photosyns_inst%rssun_patch , & ! Output: [real(r8) (:) ] leaf sunlit stomatal resistance (s/m) (output from Photosynthesis) - rssha => photosyns_inst%rssha_patch , & ! Output: [real(r8) (:) ] leaf shaded stomatal resistance (s/m) (output from Photosynthesis) - - grnd_ch4_cond => ch4_inst%grnd_ch4_cond_patch , & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] - - htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) [J/kg] (constant) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] F. Li and S. Levis - btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) - rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root resistance by layer (0-1) (nlevgrnd) - taux => energyflux_inst%taux_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: e-w (kg/m/s**2) - tauy => energyflux_inst%tauy_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: n-s (kg/m/s**2) - canopy_cond => energyflux_inst%canopy_cond_patch , & ! Output: [real(r8) (:) ] tracer conductance for canopy [m/s] - cgrnds => energyflux_inst%cgrnds_patch , & ! Output: [real(r8) (:) ] deriv. of soil sensible heat flux wrt soil temp [w/m2/k] - cgrndl => energyflux_inst%cgrndl_patch , & ! Output: [real(r8) (:) ] deriv. of soil latent heat flux wrt soil temp [w/m**2/k] - dlrad => energyflux_inst%dlrad_patch , & ! Output: [real(r8) (:) ] downward longwave radiation below the canopy [W/m2] - ulrad => energyflux_inst%ulrad_patch , & ! Output: [real(r8) (:) ] upward longwave radiation above the canopy [W/m2] - cgrnd => energyflux_inst%cgrnd_patch , & ! Output: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] - eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - begp => bounds%begp , & - endp => bounds%endp , & - begg => bounds%begg , & - endg => bounds%endg & - ) - if (use_hydrstress) then - bsun => energyflux_inst%bsun_patch ! Output: [real(r8) (:) ] sunlit canopy transpiration wetness factor (0 to 1) - bsha => energyflux_inst%bsha_patch ! Output: [real(r8) (:) ] sunlit canopy transpiration wetness factor (0 to 1) - end if - - ! Determine step size - - dtime = get_step_size() - is_end_day = is_end_curr_day() - - ! Make a local copy of the exposedvegp filter. With the current implementation, - ! this is needed because the filter is modified in the iteration loop. - ! - ! TODO(wjs, 2014-09-24) Determine if this is really needed. I suspect that we could - ! do away with either this temporary fn/filterp, or the temporary fnorig/fporig, - ! with one of these simply using the passed-in filter (num_exposedvegp / - ! filter_exposedvegp) - - fn = num_exposedvegp - filterp(1:fn) = filter_exposedvegp(1:fn) - - ! ----------------------------------------------------------------- - ! Time step initialization of photosynthesis variables - ! ----------------------------------------------------------------- - - call photosyns_inst%TimeStepInit(bounds) - - - ! ----------------------------------------------------------------- - ! Prep some IO variables and some checks on patch pointers if FATES - ! is running. - ! Filter explanation: The patch filter in this routine identifies all - ! non-lake, non-urban patches that are not covered by ice. The - ! filter is set over a few steps: - ! - ! 1a) for CN: - ! clm_drv() -> - ! bgc_vegetation_inst%EcosystemDynamicsPostDrainage() -> - ! CNVegStructUpdate() - ! if(elai(p)+esai(p)>0) frac_veg_nosno_alb(p) = 1 - ! - ! 1b) for FATES: - ! clm_drv() -> - ! clm_fates%dynamics_driv() -> - ! ed_clm_link() -> - ! ed_clm_leaf_area_profile(): - ! if(elai(p)+esai(p)>0) frac_veg_nosno_alb(p) = 1 - ! - ! 2) during clm_drv()->clm_drv_init(): - ! frac_veg_nosno_alb(p) is then combined with the active(p) - ! flag via union to create frac_veg_nosno_patch(p) - ! 3) immediately after, during clm_drv()->setExposedvegpFilter() - ! the list used here "exposedvegp(fe)" is incremented if - ! frac_veg_nosno_patch > 0 - ! ----------------------------------------------------------------- - - if (use_fates) then - call clm_fates%prep_canopyfluxes(nc, fn, filterp, photosyns_inst) - end if - - ! Initialize - - do f = 1, fn - p = filterp(f) - del(p) = 0._r8 ! change in leaf temperature from previous iteration - efeb(p) = 0._r8 ! latent head flux from leaf for previous iteration - wtlq0(p) = 0._r8 - wtalq(p) = 0._r8 - wtgq(p) = 0._r8 - wtaq0(p) = 0._r8 - obuold(p) = 0._r8 - btran(p) = btran0 - btran2(p) = btran0 - end do - - ! calculate daylength control for Vcmax - do f = 1, fn - p=filterp(f) - g=patch%gridcell(p) - ! calculate dayl_factor as the ratio of (current:max dayl)^2 - ! set a minimum of 0.01 (1%) for the dayl_factor - dayl_factor(p)=min(1._r8,max(0.01_r8,(dayl(g)*dayl(g))/(max_dayl(g)*max_dayl(g)))) - end do - - rb1(begp:endp) = 0._r8 - - !assign the temporary filter - do f = 1, fn - p = filterp(f) - filterc_tmp(f)=patch%column(p) - enddo - - !compute effective soil porosity - call calc_effective_soilporosity(bounds, & - ubj = nlevgrnd, & - numf = fn, & - filter = filterc_tmp(1:fn), & - watsat = watsat(bounds%begc:bounds%endc, 1:nlevgrnd), & - h2osoi_ice = h2osoi_ice(bounds%begc:bounds%endc,1:nlevgrnd), & - denice = denice, & - eff_por=eff_porosity(bounds%begc:bounds%endc, 1:nlevgrnd) ) - - !compute volumetric liquid water content - jtop(bounds%begc:bounds%endc) = 1 - - call calc_volumetric_h2oliq(bounds, & - jtop = jtop(bounds%begc:bounds%endc), & - lbj = 1, & - ubj = nlevgrnd, & - numf = fn, & - filter = filterc_tmp(1:fn), & - eff_porosity = eff_porosity(bounds%begc:bounds%endc, 1:nlevgrnd), & - h2osoi_liq = h2osoi_liq(bounds%begc:bounds%endc, 1:nlevgrnd), & - denh2o = denh2o, & - vol_liq = h2osoi_liqvol(bounds%begc:bounds%endc, 1:nlevgrnd) ) - - !set up perchroot options - call set_perchroot_opt(perchroot, perchroot_alt) - - ! -------------------------------------------------------------------------- - ! if this is a FATES simulation - ! ask fates to calculate btran functions and distribution of uptake - ! this will require boundary conditions from CLM, boundary conditions which - ! may only be available from a smaller subset of patches that meet the - ! exposed veg. - ! calc_root_moist_stress already calculated root soil water stress 'rresis' - ! this is the input boundary condition to calculate the transpiration - ! wetness factor btran and the root weighting factors for FATES. These - ! values require knowledge of the belowground root structure. - ! -------------------------------------------------------------------------- - - if(use_fates)then - call clm_fates%wrap_btran(nc, fn, filterc_tmp(1:fn), soilstate_inst, waterstate_inst, & - temperature_inst, energyflux_inst, soil_water_retention_curve) - - else - - !calculate root moisture stress - call calc_root_moist_stress(bounds, & - nlevgrnd = nlevgrnd, & - fn = fn, & - filterp = filterp, & - canopystate_inst=canopystate_inst, & - energyflux_inst=energyflux_inst, & - soilstate_inst=soilstate_inst, & - temperature_inst=temperature_inst, & - waterstate_inst=waterstate_inst, & - soil_water_retention_curve=soil_water_retention_curve) - - - end if - - ! Modify aerodynamic parameters for sparse/dense canopy (X. Zeng) - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - lt = min(elai(p)+esai(p), tlsai_crit) - egvf =(1._r8 - alpha_aero * exp(-lt)) / (1._r8 - alpha_aero * exp(-tlsai_crit)) - displa(p) = egvf * displa(p) - z0mv(p) = exp(egvf * log(z0mv(p)) + (1._r8 - egvf) * log(z0mg(c))) - z0hv(p) = z0mv(p) - z0qv(p) = z0mv(p) - end do - - found = .false. - do f = 1, fn - p = filterp(f) - c = patch%column(p) - g = patch%gridcell(p) - - ! Net absorbed longwave radiation by canopy and ground - ! =air+bir*t_veg**4+cir*t_grnd(c)**4 - - air(p) = emv(p) * (1._r8+(1._r8-emv(p))*(1._r8-emg(c))) * forc_lwrad(c) - bir(p) = - (2._r8-emv(p)*(1._r8-emg(c))) * emv(p) * sb - cir(p) = emv(p)*emg(c)*sb - - ! Saturated vapor pressure, specific humidity, and their derivatives - ! at the leaf surface - - call QSat (t_veg(p), forc_pbot(c), el(p), deldT, qsatl(p), qsatldT(p)) - - ! Determine atmospheric co2 and o2 - - co2(p) = forc_pco2(g) - o2(p) = forc_po2(g) - - if ( use_c13 ) then - c13o2(p) = forc_pc13o2(g) - end if - - ! Initialize flux profile - - nmozsgn(p) = 0 - - taf(p) = (t_grnd(c) + thm(p))/2._r8 - qaf(p) = (forc_q(c)+qg(c))/2._r8 - - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - dth(p) = thm(p)-taf(p) - dqh(p) = forc_q(c)-qaf(p) - delq(p) = qg(c) - qaf(p) - dthv(p) = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p) - zldis(p) = forc_hgt_u_patch(p) - displa(p) - - ! Check to see if the forcing height is below the canopy height - if (zldis(p) < 0._r8) then - found = .true. - index = p - end if - - end do - - if (found) then - if ( .not. use_fates ) then - write(iulog,*)'Error: Forcing height is below canopy height for patch index ' - call endrun(decomp_index=index, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - ! Initialize Monin-Obukhov length and wind speed - - call MoninObukIni(ur(p), thv(c), dthv(p), zldis(p), z0mv(p), um(p), obu(p)) - - end do - - ! Set counter for leaf temperature iteration (itlef) - - itlef = 0 - fnorig = fn - fporig(1:fn) = filterp(1:fn) - - ! Begin stability iteration - - call t_startf('can_iter') - ITERATION : do while (itlef <= itmax .and. fn > 0) - - ! Determine friction velocity, and potential temperature and humidity - ! profiles of the surface boundary layer - - call FrictionVelocity (begp, endp, fn, filterp, & - displa(begp:endp), z0mv(begp:endp), z0hv(begp:endp), z0qv(begp:endp), & - obu(begp:endp), itlef+1, ur(begp:endp), um(begp:endp), ustar(begp:endp), & - temp1(begp:endp), temp2(begp:endp), temp12m(begp:endp), temp22m(begp:endp), fm(begp:endp), & - frictionvel_inst) - - - - - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - g = patch%gridcell(p) - - tlbef(p) = t_veg(p) - del2(p) = del(p) - - ! Determine aerodynamic resistances - - ram1(p) = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah(p,1) = 1._r8/(temp1(p)*ustar(p)) - raw(p,1) = 1._r8/(temp2(p)*ustar(p)) - - ! Bulk boundary layer resistance of leaves - - uaf(p) = um(p)*sqrt( 1._r8/(ram1(p)*um(p)) ) - - ! Use pft parameter for leaf characteristic width - ! dleaf_patch if this is not an fates patch. - ! Otherwise, the value has already been loaded - ! during the FATES dynamics call - if(.not.patch%is_fates(p)) then - dleaf_patch(p) = dleaf(patch%itype(p)) - end if - - cf = 0.01_r8/(sqrt(uaf(p))*sqrt( dleaf_patch(p) )) - rb(p) = 1._r8/(cf*uaf(p)) - rb1(p) = rb(p) - - ! Parameterization for variation of csoilc with canopy density from - ! X. Zeng, University of Arizona - - w = exp(-(elai(p)+esai(p))) - - ! changed by K.Sakaguchi from here - ! transfer coefficient over bare soil is changed to a local variable - ! just for readability of the code (from line 680) - csoilb = (vkc/(0.13_r8*(z0mg(c)*uaf(p)/1.5e-5_r8)**0.45_r8)) - - !compute the stability parameter for ricsoilc ("S" in Sakaguchi&Zeng,2008) - - ri = ( grav*htop(p) * (taf(p) - t_grnd(c)) ) / (taf(p) * uaf(p) **2.00_r8) - - !! modify csoilc value (0.004) if the under-canopy is in stable condition - - if (use_undercanopy_stability .and. (taf(p) - t_grnd(c) ) > 0._r8) then - ! decrease the value of csoilc by dividing it with (1+gamma*min(S, 10.0)) - ! ria ("gmanna" in Sakaguchi&Zeng, 2008) is a constant (=0.5) - ricsoilc = csoilc / (1.00_r8 + ria*min( ri, 10.0_r8) ) - csoilcn = csoilb*w + ricsoilc*(1._r8-w) - else - csoilcn = csoilb*w + csoilc*(1._r8-w) - end if - - !! Sakaguchi changes for stability formulation ends here - - rah(p,2) = 1._r8/(csoilcn*uaf(p)) - raw(p,2) = rah(p,2) - if (use_lch4) then - grnd_ch4_cond(p) = 1._r8/(raw(p,1)+raw(p,2)) - end if - - ! Stomatal resistances for sunlit and shaded fractions of canopy. - ! Done each iteration to account for differences in eah, tv. - - svpts(p) = el(p) ! pa - eah(p) = forc_pbot(c) * qaf(p) / 0.622_r8 ! pa - rhaf(p) = eah(p)/svpts(p) - end do - - if ( use_fates ) then - - call clm_fates%wrap_photosynthesis(nc, bounds, fn, filterp(1:fn), & - svpts(begp:endp), eah(begp:endp), o2(begp:endp), & - co2(begp:endp), rb(begp:endp), dayl_factor(begp:endp), & - atm2lnd_inst, temperature_inst, canopystate_inst, photosyns_inst) - - else ! not use_fates - - if ( use_hydrstress ) then - call PhotosynthesisHydraulicStress (bounds, fn, filterp, & - svpts(begp:endp), eah(begp:endp), o2(begp:endp), co2(begp:endp), rb(begp:endp), bsun(begp:endp), & - bsha(begp:endp), btran(begp:endp), dayl_factor(begp:endp), leafn_patch(begp:endp), & - qsatl(begp:endp), qaf(begp:endp), & - atm2lnd_inst, temperature_inst, soilstate_inst, waterstate_inst, surfalb_inst, solarabs_inst, & - canopystate_inst, ozone_inst, photosyns_inst, waterflux_inst, froot_carbon(begp:endp), croot_carbon(begp:endp)) - else - call Photosynthesis (bounds, fn, filterp, & - svpts(begp:endp), eah(begp:endp), o2(begp:endp), co2(begp:endp), rb(begp:endp), btran(begp:endp), & - dayl_factor(begp:endp), leafn_patch(begp:endp), & - atm2lnd_inst, temperature_inst, surfalb_inst, solarabs_inst, & - canopystate_inst, ozone_inst, photosyns_inst, phase='sun') - endif - - if ( use_cn .and. use_c13 ) then - call Fractionation (bounds, fn, filterp, downreg_patch(begp:endp), & - atm2lnd_inst, canopystate_inst, solarabs_inst, surfalb_inst, photosyns_inst, & - phase='sun') - endif - - if ( .not.(use_hydrstress) ) then - call Photosynthesis (bounds, fn, filterp, & - svpts(begp:endp), eah(begp:endp), o2(begp:endp), co2(begp:endp), rb(begp:endp), btran(begp:endp), & - dayl_factor(begp:endp), leafn_patch(begp:endp), & - atm2lnd_inst, temperature_inst, surfalb_inst, solarabs_inst, & - canopystate_inst, ozone_inst, photosyns_inst, phase='sha') - end if - - if ( use_cn .and. use_c13 ) then - call Fractionation (bounds, fn, filterp, downreg_patch(begp:endp), & - atm2lnd_inst, canopystate_inst, solarabs_inst, surfalb_inst, photosyns_inst, & - phase='sha') - end if - - end if ! end of if use_fates - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - g = patch%gridcell(p) - - ! Sensible heat conductance for air, leaf and ground - ! Moved the original subroutine in-line... - - wta = 1._r8/rah(p,1) ! air - wtl = (elai(p)+esai(p))/rb(p) ! leaf - wtg(p) = 1._r8/rah(p,2) ! ground - wtshi = 1._r8/(wta+wtl+wtg(p)) - - wtl0(p) = wtl*wtshi ! leaf - wtg0 = wtg(p)*wtshi ! ground - wta0(p) = wta*wtshi ! air - - wtga = wta0(p)+wtg0 ! ground + air - wtal(p) = wta0(p)+wtl0(p) ! air + leaf - - ! Fraction of potential evaporation from leaf - - if (fdry(p) > 0._r8) then - rppdry = fdry(p)*rb(p)*(laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/elai(p) - else - rppdry = 0._r8 - end if - - ! Calculate canopy conductance for methane / oxygen (e.g. stomatal conductance & leaf bdy cond) - if (use_lch4) then - canopy_cond(p) = (laisun(p)/(rb(p)+rssun(p)) + laisha(p)/(rb(p)+rssha(p)))/max(elai(p), 0.01_r8) - end if - - efpot = forc_rho(c)*wtl*(qsatl(p)-qaf(p)) - - ! When the hydraulic stress parameterization is active calculate rpp - ! but not transpiration - if ( use_hydrstress ) then - if (efpot > 0._r8) then - if (btran(p) > btran0) then - rpp = rppdry + fwet(p) - else - rpp = fwet(p) - end if - !Check total evapotranspiration from leaves - rpp = min(rpp, (qflx_tran_veg(p)+h2ocan(p)/dtime)/efpot) - else - rpp = 1._r8 - end if - else - if (efpot > 0._r8) then - if (btran(p) > btran0) then - qflx_tran_veg(p) = efpot*rppdry - rpp = rppdry + fwet(p) - else - !No transpiration if btran below 1.e-10 - rpp = fwet(p) - qflx_tran_veg(p) = 0._r8 - end if - !Check total evapotranspiration from leaves - rpp = min(rpp, (qflx_tran_veg(p)+h2ocan(p)/dtime)/efpot) - else - !No transpiration if potential evaporation less than zero - rpp = 1._r8 - qflx_tran_veg(p) = 0._r8 - end if - end if - - ! Update conductances for changes in rpp - ! Latent heat conductances for ground and leaf. - ! Air has same conductance for both sensible and latent heat. - ! Moved the original subroutine in-line... - - wtaq = frac_veg_nosno(p)/raw(p,1) ! air - wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf - - !Litter layer resistance. Added by K.Sakaguchi - snow_depth_c = z_dl ! critical depth for 100% litter burial by snow (=litter thickness) - fsno_dl = snow_depth(c)/snow_depth_c ! effective snow cover for (dry)plant litter - elai_dl = lai_dl*(1._r8 - min(fsno_dl,1._r8)) ! exposed (dry)litter area index - rdl = ( 1._r8 - exp(-elai_dl) ) / ( 0.004_r8*uaf(p)) ! dry litter layer resistance - - ! add litter resistance and Lee and Pielke 1992 beta - if (delq(p) < 0._r8) then !dew. Do not apply beta for negative flux (follow old rsoil) - wtgq(p) = frac_veg_nosno(p)/(raw(p,2)+rdl) - else - if (do_soilevap_beta()) then - wtgq(p) = soilbeta(c)*frac_veg_nosno(p)/(raw(p,2)+rdl) - endif - if (do_soil_resistance_sl14()) then - wtgq(p) = frac_veg_nosno(p)/(raw(p,2)+soilresis(c)) - endif - end if - - wtsqi = 1._r8/(wtaq+wtlq+wtgq(p)) - - wtgq0 = wtgq(p)*wtsqi ! ground - wtlq0(p) = wtlq*wtsqi ! leaf - wtaq0(p) = wtaq*wtsqi ! air - - wtgaq = wtaq0(p)+wtgq0 ! air + ground - wtalq(p) = wtaq0(p)+wtlq0(p) ! air + leaf - - dc1 = forc_rho(c)*cpair*wtl - dc2 = hvap*forc_rho(c)*wtlq - - efsh = dc1*(wtga*t_veg(p)-wtg0*t_grnd(c)-wta0(p)*thm(p)) - efe(p) = dc2*(wtgaq*qsatl(p)-wtgq0*qg(c)-wtaq0(p)*forc_q(c)) - - ! Evaporation flux from foliage - - erre = 0._r8 - if (efe(p)*efeb(p) < 0._r8) then - efeold = efe(p) - efe(p) = 0.1_r8*efeold - erre = efe(p) - efeold - end if - ! fractionate ground emitted longwave - lw_grnd=(frac_sno(c)*t_soisno(c,snl(c)+1)**4 & - +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & - +frac_h2osfc(c)*t_h2osfc(c)**4) - - dt_veg(p) = (sabv(p) + air(p) + bir(p)*t_veg(p)**4 + & - cir(p)*lw_grnd - efsh - efe(p)) / & - (- 4._r8*bir(p)*t_veg(p)**3 +dc1*wtga +dc2*wtgaq*qsatldT(p)) - t_veg(p) = tlbef(p) + dt_veg(p) - dels = dt_veg(p) - del(p) = abs(dels) - err(p) = 0._r8 - if (del(p) > delmax) then - dt_veg(p) = delmax*dels/del(p) - t_veg(p) = tlbef(p) + dt_veg(p) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + cir(p)*lw_grnd - & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & - dc2*wtgaq*qsatldT(p)*dt_veg(p)) - end if - - ! Fluxes from leaves to canopy space - ! "efe" was limited as its sign changes frequently. This limit may - ! result in an imbalance in "hvap*qflx_evap_veg" and - ! "efe + dc2*wtgaq*qsatdt_veg" - - efpot = forc_rho(c)*wtl*(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & - -wtgq0*qg(c)-wtaq0(p)*forc_q(c)) - qflx_evap_veg(p) = rpp*efpot - - ! Calculation of evaporative potentials (efpot) and - ! interception losses; flux in kg m**-2 s-1. ecidif - ! holds the excess energy if all intercepted water is evaporated - ! during the timestep. This energy is later added to the - ! sensible heat flux. - - ! Note that when the hydraulic stress parameterization is active we don't - ! adjust transpiration for the new values of potential evaporation and rppdry - ! as calculated above because transpiration would then no longer be consistent - ! with the vertical transpiration sink terms that are passed to Compute_VertTranSink_PHS, - ! thereby causing a water balance error. However, because this adjustment occurs - ! within the leaf temperature iteration, this ends up being a small inconsistency. - if ( use_hydrstress ) then - ecidif = max(0._r8, qflx_evap_veg(p)-qflx_tran_veg(p)-h2ocan(p)/dtime) - qflx_evap_veg(p) = min(qflx_evap_veg(p),qflx_tran_veg(p)+h2ocan(p)/dtime) - else - ecidif = 0._r8 - if (efpot > 0._r8 .and. btran(p) > btran0) then - qflx_tran_veg(p) = efpot*rppdry - else - qflx_tran_veg(p) = 0._r8 - end if - ecidif = max(0._r8, qflx_evap_veg(p)-qflx_tran_veg(p)-h2ocan(p)/dtime) - qflx_evap_veg(p) = min(qflx_evap_veg(p),qflx_tran_veg(p)+h2ocan(p)/dtime) - end if - - ! The energy loss due to above two limits is added to - ! the sensible heat flux. - - eflx_sh_veg(p) = efsh + dc1*wtga*dt_veg(p) + err(p) + erre + hvap*ecidif - - ! Re-calculate saturated vapor pressure, specific humidity, and their - ! derivatives at the leaf surface - - call QSat(t_veg(p), forc_pbot(c), el(p), deldT, qsatl(p), qsatldT(p)) - - ! Update vegetation/ground surface temperature, canopy air - ! temperature, canopy vapor pressure, aerodynamic temperature, and - ! Monin-Obukhov stability parameter for next iteration. - - taf(p) = wtg0*t_grnd(c) + wta0(p)*thm(p) + wtl0(p)*t_veg(p) - qaf(p) = wtlq0(p)*qsatl(p) + wtgq0*qg(c) + forc_q(c)*wtaq0(p) - - ! Update Monin-Obukhov length and wind speed including the - ! stability effect - - dth(p) = thm(p)-taf(p) - dqh(p) = forc_q(c)-qaf(p) - delq(p) = wtalq(p)*qg(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) - - tstar = temp1(p)*dth(p) - qstar = temp2(p)*dqh(p) - - thvstar = tstar*(1._r8+0.61_r8*forc_q(c)) + 0.61_r8*forc_th(c)*qstar - zeta = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) - - if (zeta >= 0._r8) then !stable - zeta = min(zetamax,max(zeta,0.01_r8)) - um(p) = max(ur(p),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta*(-grav*ustar(p)*thvstar*zii/thv(c))**0.333_r8 - um(p) = sqrt(ur(p)*ur(p)+wc*wc) - end if - obu(p) = zldis(p)/zeta - - if (obuold(p)*obu(p) < 0._r8) nmozsgn(p) = nmozsgn(p)+1 - if (nmozsgn(p) >= 4) obu(p) = zldis(p)/(-0.01_r8) - obuold(p) = obu(p) - - end do ! end of filtered patch loop - - ! Test for convergence - - itlef = itlef+1 - if (itlef > itmin) then - do f = 1, fn - p = filterp(f) - dele(p) = abs(efe(p)-efeb(p)) - efeb(p) = efe(p) - det(p) = max(del(p),del2(p)) - end do - fnold = fn - fn = 0 - do f = 1, fnold - p = filterp(f) - if (.not. (det(p) < dtmin .and. dele(p) < dlemin)) then - fn = fn + 1 - filterp(fn) = p - end if - end do - end if - - end do ITERATION ! End stability iteration - call t_stopf('can_iter') - - fn = fnorig - filterp(1:fn) = fporig(1:fn) - - ! Set status of snowveg_flag - snowveg_on = IsSnowvegFlagOn() - snowveg_onrad = IsSnowvegFlagOnRad() - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - g = patch%gridcell(p) - - ! Energy balance check in canopy - - lw_grnd=(frac_sno(c)*t_soisno(c,snl(c)+1)**4 & - +(1._r8-frac_sno(c)-frac_h2osfc(c))*t_soisno(c,1)**4 & - +frac_h2osfc(c)*t_h2osfc(c)**4) - - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - !+ cir(p)*t_grnd(c)**4 - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - + cir(p)*lw_grnd - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - - ! Fluxes from ground to canopy space - - delt = wtal(p)*t_grnd(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) - taux(p) = -forc_rho(c)*forc_u(g)/ram1(p) - tauy(p) = -forc_rho(c)*forc_v(g)/ram1(p) - eflx_sh_grnd(p) = cpair*forc_rho(c)*wtg(p)*delt - - ! compute individual sensible heat fluxes - delt_snow = wtal(p)*t_soisno(c,snl(c)+1)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) - eflx_sh_snow(p) = cpair*forc_rho(c)*wtg(p)*delt_snow - - delt_soil = wtal(p)*t_soisno(c,1)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) - eflx_sh_soil(p) = cpair*forc_rho(c)*wtg(p)*delt_soil - - delt_h2osfc = wtal(p)*t_h2osfc(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) - eflx_sh_h2osfc(p) = cpair*forc_rho(c)*wtg(p)*delt_h2osfc - qflx_evap_soi(p) = forc_rho(c)*wtgq(p)*delq(p) - - ! compute individual latent heat fluxes - delq_snow = wtalq(p)*qg_snow(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) - qflx_ev_snow(p) = forc_rho(c)*wtgq(p)*delq_snow - - delq_soil = wtalq(p)*qg_soil(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) - qflx_ev_soil(p) = forc_rho(c)*wtgq(p)*delq_soil - - delq_h2osfc = wtalq(p)*qg_h2osfc(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(c) - qflx_ev_h2osfc(p) = forc_rho(c)*wtgq(p)*delq_h2osfc - - ! 2 m height air temperature - - t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) - t_ref2m_r(p) = t_ref2m(p) - - ! 2 m height specific humidity - - q_ref2m(p) = forc_q(c) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - rh_ref2m_r(p) = rh_ref2m(p) - - ! Human Heat Stress - if ( calc_human_stress_indices )then - - call KtoC(t_ref2m(p), tc_ref2m(p)) - call VaporPres(rh_ref2m(p), e_ref2m, vap_ref2m(p)) - call Wet_Bulb(t_ref2m(p), vap_ref2m(p), forc_pbot(c), rh_ref2m(p), q_ref2m(p), & - teq_ref2m(p), ept_ref2m(p), wb_ref2m(p)) - call Wet_BulbS(tc_ref2m(p),rh_ref2m(p), wbt_ref2m(p)) - call HeatIndex(tc_ref2m(p), rh_ref2m(p), nws_hi_ref2m(p)) - call AppTemp(tc_ref2m(p), vap_ref2m(p), u10_clm(p), appar_temp_ref2m(p)) - call swbgt(tc_ref2m(p), vap_ref2m(p), swbgt_ref2m(p)) - call hmdex(tc_ref2m(p), vap_ref2m(p), humidex_ref2m(p)) - call dis_coi(tc_ref2m(p), wb_ref2m(p), discomf_index_ref2m(p)) - call dis_coiS(tc_ref2m(p), rh_ref2m(p), wbt_ref2m(p), discomf_index_ref2mS(p)) - call THIndex(tc_ref2m(p), wb_ref2m(p), thic_ref2m(p), thip_ref2m(p)) - call SwampCoolEff(tc_ref2m(p), wb_ref2m(p), swmp80_ref2m(p), swmp65_ref2m(p)) - - teq_ref2m_r(p) = teq_ref2m(p) - ept_ref2m_r(p) = ept_ref2m(p) - wb_ref2m_r(p) = wb_ref2m(p) - wbt_ref2m_r(p) = wbt_ref2m(p) - nws_hi_ref2m_r(p) = nws_hi_ref2m(p) - appar_temp_ref2m_r(p) = appar_temp_ref2m(p) - swbgt_ref2m_r(p) = swbgt_ref2m(p) - humidex_ref2m_r(p) = humidex_ref2m(p) - discomf_index_ref2m_r(p) = discomf_index_ref2m(p) - discomf_index_ref2mS_r(p) = discomf_index_ref2mS(p) - thic_ref2m_r(p) = thic_ref2m(p) - thip_ref2m_r(p) = thip_ref2m(p) - swmp80_ref2m_r(p) = swmp80_ref2m(p) - swmp65_ref2m_r(p) = swmp65_ref2m(p) - end if - - ! Downward longwave radiation below the canopy - - dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(c) + & - emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) - - ! Upward longwave radiation above the canopy - - ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(c) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*lw_grnd) - - ! Calculate the skin temperature as a weighted sum of all the ground and vegetated fraction - ! The weight is the so-called vegetation emissivity, but not that emv is actually an attentuation - ! function that goes to zero as LAI (ELAI + ESAI) go to zero. - - t_skin_patch(p) = emv(p)*t_veg(p) + (1._r8 - emv(p))*sqrt(sqrt(lw_grnd)) - - ! Derivative of soil energy flux with respect to soil temperature - - cgrnds(p) = cgrnds(p) + cpair*forc_rho(c)*wtg(p)*wtal(p) - cgrndl(p) = cgrndl(p) + forc_rho(c)*wtgq(p)*wtalq(p)*dqgdT(c) - cgrnd(p) = cgrnds(p) + cgrndl(p)*htvp(c) - - ! Update dew accumulation (kg/m2) - h2ocan(p) = max(0._r8,h2ocan(p)+(qflx_tran_veg(p)-qflx_evap_veg(p))*dtime) - - if (snowveg_on .or. snowveg_onrad) then - if (t_veg(p) > tfrz ) then ! above freezing, update accumulation in liqcan - if ((qflx_evap_veg(p)-qflx_tran_veg(p))*dtime > liqcan(p)) then ! all liq evap - ! In this case, all liqcan will evap. Take remainder from snocan - snocan(p)=snocan(p)+liqcan(p)+(qflx_tran_veg(p)-qflx_evap_veg(p))*dtime - end if - liqcan(p) = max(0._r8,liqcan(p)+(qflx_tran_veg(p)-qflx_evap_veg(p))*dtime) - - else if (t_veg(p) <= tfrz) then ! below freezing, update accumulation in snocan - if ((qflx_evap_veg(p)-qflx_tran_veg(p))*dtime > snocan(p)) then ! all sno evap - ! In this case, all snocan will evap. Take remainder from liqcan - liqcan(p)=liqcan(p)+snocan(p)+(qflx_tran_veg(p)-qflx_evap_veg(p))*dtime - end if - snocan(p) = max(0._r8,snocan(p)+(qflx_tran_veg(p)-qflx_evap_veg(p))*dtime) - end if - end if - - end do - - if ( use_fates ) then - - - call clm_fates%wrap_accumulatefluxes(nc,fn,filterp(1:fn)) - call clm_fates%wrap_hydraulics_drive(bounds,nc,soilstate_inst, & - waterstate_inst,waterflux_inst,solarabs_inst,energyflux_inst) - - else - - ! Determine total photosynthesis - - call PhotosynthesisTotal(fn, filterp, & - atm2lnd_inst, canopystate_inst, photosyns_inst) - - ! Calculate ozone stress. This needs to be done after rssun and rsshade are - ! computed by the Photosynthesis routine. However, Photosynthesis also uses the - ! ozone stress computed here. Thus, the ozone stress computed in timestep i is - ! applied in timestep (i+1). - - ! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) The following dummy variable assignment is - ! needed with pgi 14.7 on yellowstone; without it, forc_pbot_downscaled_col gets - ! resized inappropriately in the following subroutine call, due to a compiler bug. - dummy_to_make_pgi_happy = ubound(atm2lnd_inst%forc_pbot_downscaled_col, 1) - call ozone_inst%CalcOzoneStress( & - bounds, fn, filterp, & - forc_pbot = atm2lnd_inst%forc_pbot_downscaled_col(bounds%begc:bounds%endc), & - forc_th = atm2lnd_inst%forc_th_downscaled_col(bounds%begc:bounds%endc), & - rssun = photosyns_inst%rssun_patch(bounds%begp:bounds%endp), & - rssha = photosyns_inst%rssha_patch(bounds%begp:bounds%endp), & - rb = frictionvel_inst%rb1_patch(bounds%begp:bounds%endp), & - ram = frictionvel_inst%ram1_patch(bounds%begp:bounds%endp), & - tlai = canopystate_inst%tlai_patch(bounds%begp:bounds%endp)) - - !--------------------------------------------------------- - !update Vc,max and Jmax by LUNA model - if(use_luna)then - call Acc24_Climate_LUNA(bounds, fn, filterp, & - canopystate_inst, photosyns_inst, & - surfalb_inst, solarabs_inst, & - temperature_inst) - - if(is_end_day)then - - call Acc240_Climate_LUNA(bounds, fn, filterp, & - o2(begp:endp), & - co2(begp:endp), & - rb(begp:endp), & - rhaf(begp:endp),& - temperature_inst, & - photosyns_inst, & - surfalb_inst, & - solarabs_inst, & - waterstate_inst,& - frictionvel_inst) - - call Update_Photosynthesis_Capacity(bounds, fn, filterp, & - dayl_factor(begp:endp), & - atm2lnd_inst, & - temperature_inst, & - canopystate_inst, & - photosyns_inst, & - surfalb_inst, & - solarabs_inst, & - waterstate_inst,& - frictionvel_inst) - - call Clear24_Climate_LUNA(bounds, fn, filterp, & - canopystate_inst, photosyns_inst, & - surfalb_inst, solarabs_inst, & - temperature_inst) - endif - - endif - end if - - ! Filter out patches which have small energy balance errors; report others - - fnold = fn - fn = 0 - do f = 1, fnold - p = filterp(f) - if (abs(err(p)) > 0.1_r8) then - fn = fn + 1 - filterp(fn) = p - end if - end do - - do f = 1, fn - p = filterp(f) - write(iulog,*) 'energy balance in canopy ',p,', err=',err(p) - end do - - - end associate - - - end subroutine CanopyFluxes - -end module CanopyFluxesMod - diff --git a/src/biogeophys/CanopyHydrologyMod.F90 b/src/biogeophys/CanopyHydrologyMod.F90 deleted file mode 100644 index ecb35092c7..0000000000 --- a/src/biogeophys/CanopyHydrologyMod.F90 +++ /dev/null @@ -1,923 +0,0 @@ -module CanopyHydrologyMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculation of - ! (1) water storage of intercepted precipitation - ! (2) direct throughfall and canopy drainage of precipitation - ! (3) the fraction of foliage covered by water and the fraction - ! of foliage that is dry and transpiring. - ! (4) snow layer initialization if the snow accumulation exceeds 10 mm. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_flush - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog - use LandunitType , only : lun - use atm2lndType , only : atm2lnd_type - use AerosolMod , only : aerosol_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use IrrigationMod , only : irrigation_type - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CanopyHydrology_readnl ! Read namelist - public :: CanopyHydrology ! Run - public :: IsSnowvegFlagOff ! Returns true if snowveg_flag is OFF - public :: IsSnowvegFlagOn ! Returns true if snowveg_flag is ON - public :: IsSnowvegFlagOnRad ! Returns true if snowveg_flag is ON_RAD - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: FracWet ! Determine fraction of vegetated surface that is wet - private :: FracH2oSfc ! Determine fraction of land surfaces which are submerged - ! - ! !PRIVATE DATA MEMBERS: - integer :: oldfflag=0 ! use old fsno parameterization (N&Y07) - real(r8) :: interception_fraction ! Fraction of intercepted precipitation - real(r8) :: maximum_leaf_wetted_fraction ! Maximum fraction of leaf that may be wet - logical, private :: use_clm5_fpi = .false. ! use clm5 fpi equation - ! Snow in vegetation canopy namelist options. - logical, private :: snowveg_off = .false. ! snowveg_flag = 'OFF' - logical, private :: snowveg_on = .false. ! snowveg_flag = 'ON' - logical, private :: snowveg_onrad = .true. ! snowveg_flag = 'ON_RAD' - ! for now, all mods on by default: - character(len= 10), public :: snowveg_flag = 'ON_RAD' - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine CanopyHydrology_readnl( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for CanopyHydrology - ! - ! !USES: - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'CanopyHydrology_readnl' ! subroutine name - !----------------------------------------------------------------------- - - namelist /clm_canopyhydrology_inparm/ & - oldfflag, & - interception_fraction, & - maximum_leaf_wetted_fraction, & - use_clm5_fpi, & - snowveg_flag - - ! ---------------------------------------------------------------------- - ! Read namelist from standard input. - ! ---------------------------------------------------------------------- - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clm_CanopyHydrology_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_canopyhydrology_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_canopyhydrology_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_canopyhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_canopyhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - snowveg_off = IsSnowvegFlagOff() - snowveg_on = IsSnowvegFlagOn() - snowveg_onrad = IsSnowvegFlagOnRad() - write(iulog,*) 'snowveg_off = ',snowveg_off - write(iulog,*) 'snowveg_on = ',snowveg_on - write(iulog,*) 'snowveg_onrad = ',snowveg_onrad - if (snowveg_off .or. snowveg_on .or. snowveg_onrad) then - write(iulog,*) 'snowveg_flag = ',snowveg_flag - else - call endrun(msg="snowveg_flag is set incorrectly (not ON, ON_RAD, or OFF)"//errmsg(sourcefile, __LINE__)) - end if - end if - ! Broadcast namelist variables read in - call shr_mpi_bcast(oldfflag, mpicom) - call shr_mpi_bcast(interception_fraction, mpicom) - call shr_mpi_bcast(maximum_leaf_wetted_fraction, mpicom) - call shr_mpi_bcast(use_clm5_fpi, mpicom) - call shr_mpi_bcast(snowveg_flag, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'canopyhydrology settings:' - write(iulog,*) ' interception_fraction = ',interception_fraction - write(iulog,*) ' maximum_leaf_wetted_fraction = ',maximum_leaf_wetted_fraction - write(iulog,*) ' use_clm5_fpi = ',use_clm5_fpi - endif - - end subroutine CanopyHydrology_readnl - - !----------------------------------------------------------------------- - subroutine CanopyHydrology(bounds, & - num_nolakec, filter_nolakec, num_nolakep, filter_nolakep, & - atm2lnd_inst, canopystate_inst, temperature_inst, & - aerosol_inst, waterstate_inst, waterflux_inst, irrigation_inst) - ! - ! !DESCRIPTION: - ! Calculation of - ! (1) water storage of intercepted precipitation - ! (2) direct throughfall and canopy drainage of precipitation - ! (3) the fraction of foliage covered by water and the fraction - ! of foliage that is dry and transpiring. - ! (4) snow layer initialization if the snow accumulation exceeds 10 mm. - ! Note: The evaporation loss is taken off after the calculation of leaf - ! temperature in the subroutine clm\_leaftem.f90, not in this subroutine. - ! - ! !USES: - use clm_varcon , only : hfus, denice, zlnd, rpi, spval, tfrz, int_snow_max - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use landunit_varcon , only : istcrop, istwet, istsoil, istice_mec - use clm_varctl , only : subgridflag - use clm_varpar , only : nlevsoi,nlevsno - use clm_time_manager , only : get_step_size - use subgridAveMod , only : p2c - use SnowHydrologyMod , only : NewSnowBulkDensity - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_nolakep ! number of pft non-lake points in pft filter - integer , intent(in) :: filter_nolakep(:) ! patch filter for non-lake points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(aerosol_type) , intent(inout) :: aerosol_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(irrigation_type) , intent(in) :: irrigation_inst - ! - ! !LOCAL VARIABLES: - integer :: f ! filter index - integer :: pi ! patch index - integer :: p ! patch index - integer :: c ! column index - integer :: l ! landunit index - integer :: g ! gridcell index - integer :: newnode ! flag when new snow node is set, (1=yes, 0=no) - real(r8) :: dtime ! land model time step (sec) - real(r8) :: h2ocanmx ! maximum allowed water on canopy [mm] - real(r8) :: snocanmx ! maximum allowed snow on canopy [mm equiv. water] - real(r8) :: liqcanmx ! maximum allowed snowliquid water on canopy [mm equiv. water] - real(r8) :: xsnorun ! excess snow that exceeds the leaf capacity [mm/s] - real(r8) :: xliqrun ! excess liquid water - real(r8) :: qflx_snocanfall(bounds%begp:bounds%endp) ! rate of excess canopy snow falling off canopy - real(r8) :: qflx_liqcanfall(bounds%begp:bounds%endp) ! rate of excess canopy liquid falling off canopy - real(r8) :: fpi ! coefficient of interception - real(r8) :: fpisnow ! coefficient of interception for snowfall - real(r8) :: xrun ! excess water that exceeds the leaf capacity [mm/s] - real(r8) :: dz_snowf ! layer thickness rate change due to precipitation [mm/s] - real(r8) :: bifall(bounds%begc:bounds%endc) ! bulk density of newly fallen dry snow [kg/m3] - real(r8) :: fracsnow(bounds%begp:bounds%endp) ! frac of precipitation that is snow - real(r8) :: fracrain(bounds%begp:bounds%endp) ! frac of precipitation that is rain - real(r8) :: qflx_candrip(bounds%begp:bounds%endp) ! rate of canopy runoff and snow falling off canopy [mm/s] - real(r8) :: qflx_through_rain(bounds%begp:bounds%endp) ! direct rain throughfall [mm/s] - real(r8) :: qflx_through_snow(bounds%begp:bounds%endp) ! direct snow throughfall [mm/s] - real(r8) :: qflx_prec_grnd_snow(bounds%begp:bounds%endp) ! snow precipitation incident on ground [mm/s] - real(r8) :: qflx_prec_grnd_rain(bounds%begp:bounds%endp) ! rain precipitation incident on ground [mm/s] - real(r8) :: z_avg ! grid cell average snow depth - real(r8) :: rho_avg ! avg density of snow column - real(r8) :: temp_snow_depth,temp_intsnow ! temporary variables - real(r8) :: fmelt - real(r8) :: smr - real(r8) :: delf_melt - real(r8) :: fsno_new - real(r8) :: accum_factor - real(r8) :: int_snow_limited ! integrated snowfall, limited to be no greater than int_snow_max [mm] - real(r8) :: newsnow(bounds%begc:bounds%endc) - real(r8) :: snowmelt(bounds%begc:bounds%endc) - integer :: j - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - n_melt => col%n_melt , & ! Input: [real(r8) (:) ] SCA shape parameter - zi => col%zi , & ! Output: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Output: [real(r8) (:,:) ] layer depth (m) - z => col%z , & ! Output: [real(r8) (:,:) ] layer thickness (m) - - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] rain rate [mm/s] - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] snow rate [mm/s] - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - qflx_floodg => atm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] gridcell flux of flood water from RTM - forc_wind => atm2lnd_inst%forc_wind_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s) - dewmx => canopystate_inst%dewmx_patch , & ! Input: [real(r8) (:) ] Maximum allowed dew [mm] - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2ocan => waterstate_inst%h2ocan_patch , & ! Output: [real(r8) (:) ] total canopy water (mm H2O) - snocan => waterstate_inst%snocan_patch , & ! Output: [real(r8) (:) ] canopy snow (mm H2O) - liqcan => waterstate_inst%liqcan_patch , & ! Output: [real(r8) (:) ] canopy liquid (mm H2O) - snounload => waterstate_inst%snounload_patch , & ! Output: [real(r8) (:) ] canopy snow unloading (mm H2O) - h2osfc => waterstate_inst%h2osfc_col , & ! Output: [real(r8) (:) ] surface water (mm) - h2osno => waterstate_inst%h2osno_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) - snow_depth => waterstate_inst%snow_depth_col , & ! Output: [real(r8) (:) ] snow height (m) - int_snow => waterstate_inst%int_snow_col , & ! Output: [real(r8) (:) ] integrated snowfall [mm] - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Output: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - frac_sno => waterstate_inst%frac_sno_col , & ! Output: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Output: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - frac_iceold => waterstate_inst%frac_iceold_col , & ! Output: [real(r8) (:,:) ] fraction of ice relative to the tot water - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - swe_old => waterstate_inst%swe_old_col , & ! Output: [real(r8) (:,:) ] snow water before update - - qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Output: [real(r8) (:) ] column flux of flood water from RTM - qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Input: [real(r8) (:) ] drainage from snow pack from previous time step - qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Output: [real(r8) (:) ] snow falling on surface water (mm/s) - qflx_snow_grnd_col => waterflux_inst%qflx_snow_grnd_col , & ! Output: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] - qflx_snow_grnd_patch => waterflux_inst%qflx_snow_grnd_patch , & ! Output: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] - qflx_prec_intr => waterflux_inst%qflx_prec_intr_patch , & ! Output: [real(r8) (:) ] interception of precipitation [mm/s] - qflx_prec_grnd => waterflux_inst%qflx_prec_grnd_patch , & ! Output: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)] - qflx_rain_grnd => waterflux_inst%qflx_rain_grnd_patch , & ! Output: [real(r8) (:) ] rain on ground after interception (mm H2O/s) [+] - - qflx_irrig => irrigation_inst%qflx_irrig_patch , & ! Input: [real(r8) (:) ] irrigation amount (mm/s) - qflx_snowindunload => waterflux_inst%qflx_snowindunload_patch , & ! Output: [real(r8) (:) ] canopy snow unloading from wind [mm/s] - qflx_snotempunload => waterflux_inst%qflx_snotempunload_patch & ! Output: [real(r8) (:) ] canopy snow unloading from temp. [mm/s] - ) - - ! Compute time step - - dtime = get_step_size() - - ! Set status of snowveg_flag - snowveg_on = IsSnowvegFlagOn() - snowveg_onrad = IsSnowvegFlagOnRad() - - ! Start patch loop - - do f = 1, num_nolakep - p = filter_nolakep(f) - g = patch%gridcell(p) - l = patch%landunit(p) - c = patch%column(p) - - ! Canopy interception and precipitation onto ground surface - ! Add precipitation to leaf water - - if (lun%itype(l)==istsoil .or. lun%itype(l)==istwet .or. lun%urbpoi(l) .or. & - lun%itype(l)==istcrop) then - - qflx_candrip(p) = 0._r8 ! rate of canopy runoff - qflx_snocanfall(p) = 0._r8 ! rate of just snow canopy fall - qflx_liqcanfall(p) = 0._r8 - qflx_snowindunload(p) = 0._r8 - qflx_snotempunload(p) = 0._r8 - snounload(p)=0._r8 - qflx_through_snow(p) = 0._r8 ! rain precipitation direct through canopy - qflx_through_rain(p) = 0._r8 ! snow precipitation direct through canopy - qflx_prec_intr(p) = 0._r8 ! total intercepted precipitation - fracsnow(p) = 0._r8 ! fraction of input precip that is snow - fracrain(p) = 0._r8 ! fraction of input precip that is rain - - - if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall) then - - if (frac_veg_nosno(p) == 1 .and. (forc_rain(c) + forc_snow(c)) > 0._r8) then - - ! determine fraction of input precipitation that is snow and rain - fracsnow(p) = forc_snow(c)/(forc_snow(c) + forc_rain(c)) - fracrain(p) = forc_rain(c)/(forc_snow(c) + forc_rain(c)) - - ! The leaf water capacities for solid and liquid are different, - ! generally double for snow, but these are of somewhat less - ! significance for the water budget because of lower evap. rate at - ! lower temperature. Hence, it is reasonable to assume that - ! vegetation storage of solid water is the same as liquid water. - h2ocanmx = dewmx(p) * (elai(p) + esai(p)) - ! Coefficient of interception - if(use_clm5_fpi) then - fpi = interception_fraction * tanh(elai(p) + esai(p)) - else - fpi = 0.25_r8*(1._r8 - exp(-0.5_r8*(elai(p) + esai(p)))) - endif - - if (snowveg_on .or. snowveg_onrad) then - snocanmx = 60._r8*dewmx(p) * (elai(p) + esai(p)) ! 6*(LAI+SAI) - liqcanmx = h2ocanmx - - fpisnow = (1._r8 - exp(-0.5_r8*(elai(p) + esai(p)))) ! max interception of 1 - ! Direct throughfall - qflx_through_snow(p) = forc_snow(c) * (1._r8-fpisnow) - else - ! Direct throughfall - qflx_through_snow(p) = forc_snow(c) * (1._r8-fpi) - end if - - ! Direct throughfall - qflx_through_rain(p) = forc_rain(c) * (1._r8-fpi) - - if (snowveg_on .or. snowveg_onrad) then - ! Intercepted precipitation [mm/s] - qflx_prec_intr(p) = forc_snow(c)*fpisnow + forc_rain(c)*fpi - ! storage of intercepted snowfall, rain, and dew - snocan(p) = max(0._r8, snocan(p) + dtime*forc_snow(c)*fpisnow) - liqcan(p) = max(0._r8, liqcan(p) + dtime*forc_rain(c)*fpi) - else - ! Intercepted precipitation [mm/s] - qflx_prec_intr(p) = (forc_snow(c) + forc_rain(c)) * fpi - end if - - ! Water storage of intercepted precipitation and dew - h2ocan(p) = max(0._r8, h2ocan(p) + dtime*qflx_prec_intr(p)) - - ! Initialize rate of canopy runoff and snow falling off canopy - qflx_candrip(p) = 0._r8 - qflx_snocanfall(p) = 0._r8 - qflx_liqcanfall(p) = 0._r8 - qflx_snowindunload(p) = 0._r8 - qflx_snotempunload(p) = 0._r8 - snounload(p)=0._r8 - - if (snowveg_on .or. snowveg_onrad) then - if (forc_t(c) > tfrz) then ! Above freezing (Use t_veg?) - xliqrun = (liqcan(p) - liqcanmx)/dtime - if (xliqrun > 0._r8) then - qflx_liqcanfall(p) = xliqrun - liqcan(p) = liqcanmx - end if - else ! Below freezing - xsnorun = (snocan(p) - snocanmx)/dtime - if (xsnorun > 0._r8) then ! exceeds snow capacity - qflx_snocanfall(p) = xsnorun - snocan(p) = snocanmx - end if - end if - qflx_candrip(p) = qflx_snocanfall(p) + qflx_liqcanfall(p) - h2ocan(p) = snocan(p) + liqcan(p) - else - ! Excess water that exceeds the leaf capacity - xrun = (h2ocan(p) - h2ocanmx)/dtime - - ! Test on maximum dew on leaf - ! Note if xrun > 0 then h2ocan must be at least h2ocanmx - if (xrun > 0._r8) then - qflx_candrip(p) = xrun - h2ocan(p) = h2ocanmx - end if - end if - end if - end if - - else if (lun%itype(l)==istice_mec) then - - h2ocan(p) = 0._r8 - qflx_candrip(p) = 0._r8 - qflx_through_snow(p) = 0._r8 - qflx_through_rain(p) = 0._r8 - qflx_prec_intr(p) = 0._r8 - fracsnow(p) = 0._r8 - fracrain(p) = 0._r8 - snocan(p) = 0._r8 - liqcan(p) = 0._r8 - qflx_snocanfall(p) = 0._r8 - qflx_liqcanfall(p) = 0._r8 - qflx_snowindunload(p) = 0._r8 - qflx_snotempunload(p) = 0._r8 - snounload(p)=0._r8 - - end if - - ! Precipitation onto ground (kg/(m2 s)) - - if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall) then - if (frac_veg_nosno(p) == 0) then - qflx_prec_grnd_snow(p) = forc_snow(c) - qflx_prec_grnd_rain(p) = forc_rain(c) - else - if (snowveg_on .or. snowveg_onrad) then - qflx_snowindunload(p)=0._r8 - qflx_snotempunload(p)=0._r8 - snounload(p)=0._r8 - if (snocan(p) > 0._r8) then - qflx_snotempunload(p) = max(0._r8,snocan(p)*(forc_t(c)-270.15_r8)/1.87e5_r8) - qflx_snowindunload(p) = 0.5_r8*snocan(p)*forc_wind(g)/1.56e5_r8 - snounload(p) = (qflx_snowindunload(p)+qflx_snotempunload(p))*dtime ! total canopy unloading in timestep - if ( snounload(p) > snocan(p) ) then ! Limit unloading to snow in canopy - snounload(p) = snocan(p) - write(iulog,"(A,I2.2,A,ES13.4E2)") "snocan",p,": ",snocan(p) - end if - snocan(p) = snocan(p) - snounload(p) - h2ocan(p) = h2ocan(p) - snounload(p) - endif - qflx_prec_grnd_snow(p) = qflx_through_snow(p) + qflx_snocanfall(p) + snounload(p)/dtime - qflx_prec_grnd_rain(p) = qflx_through_rain(p) + qflx_liqcanfall(p) - - else - qflx_prec_grnd_snow(p) = qflx_through_snow(p) + (qflx_candrip(p) * fracsnow(p)) - qflx_prec_grnd_rain(p) = qflx_through_rain(p) + (qflx_candrip(p) * fracrain(p)) - end if - end if - ! Urban sunwall and shadewall have no intercepted precipitation - else - qflx_prec_grnd_snow(p) = 0. - qflx_prec_grnd_rain(p) = 0. - end if - - ! Add irrigation water directly onto ground (bypassing canopy interception) - ! Note that it's still possible that (some of) this irrigation water will runoff (as runoff is computed later) - qflx_prec_grnd_rain(p) = qflx_prec_grnd_rain(p) + qflx_irrig(p) - - qflx_prec_grnd(p) = qflx_prec_grnd_snow(p) + qflx_prec_grnd_rain(p) - - qflx_snow_grnd_patch(p) = qflx_prec_grnd_snow(p) ! ice onto ground (mm/s) - qflx_rain_grnd(p) = qflx_prec_grnd_rain(p) ! liquid water onto ground (mm/s) - - end do ! (end patch loop) - - ! Determine the fraction of foliage covered by water and the - ! fraction of foliage that is dry and transpiring. - - call FracWet(num_nolakep, filter_nolakep, & - canopystate_inst, waterstate_inst) - - ! Update column level state variables for snow. - - call p2c(bounds, num_nolakec, filter_nolakec, & - qflx_snow_grnd_patch(bounds%begp:bounds%endp), & - qflx_snow_grnd_col(bounds%begc:bounds%endc)) - - ! apply gridcell flood water flux to non-lake columns - do f = 1, num_nolakec - c = filter_nolakec(f) - g = col%gridcell(c) - if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall) then - qflx_floodc(c) = qflx_floodg(g) - else - qflx_floodc(c) = 0._r8 - endif - enddo - - ! Determine snow height and snow water - - call NewSnowBulkDensity(bounds, num_nolakec, filter_nolakec, & - atm2lnd_inst, bifall(bounds%begc:bounds%endc)) - - do f = 1, num_nolakec - c = filter_nolakec(f) - l = col%landunit(c) - g = col%gridcell(c) - - ! Use Alta relationship, Anderson(1976); LaChapelle(1961), - ! U.S.Department of Agriculture Forest Service, Project F, - ! Progress Rep. 1, Alta Avalanche Study Center:Snow Layer Densification. - - qflx_snow_h2osfc(c) = 0._r8 - ! set temporary variables prior to updating - temp_snow_depth=snow_depth(c) - ! save initial snow content - do j= -nlevsno+1,snl(c) - swe_old(c,j) = 0.0_r8 - end do - do j= snl(c)+1,0 - swe_old(c,j)=h2osoi_liq(c,j)+h2osoi_ice(c,j) - enddo - - ! all snow falls on ground, no snow on h2osfc - newsnow(c) = qflx_snow_grnd_col(c) * dtime - - ! update int_snow - int_snow(c) = max(int_snow(c),h2osno(c)) !h2osno could be larger due to frost - - ! snowmelt from previous time step * dtime - snowmelt(c) = qflx_snow_drain(c) * dtime - - ! set shape factor for accumulation of snow - accum_factor=0.1 - - if (h2osno(c) > 0.0) then - - !====================== FSCA PARAMETERIZATIONS ====================== - ! fsca parameterization based on *changes* in swe - ! first compute change from melt during previous time step - if(snowmelt(c) > 0._r8) then - - int_snow_limited = min(int_snow(c), int_snow_max) - smr=min(1._r8,h2osno(c)/int_snow_limited) - - frac_sno(c) = 1. - (acos(min(1._r8,(2.*smr - 1._r8)))/rpi)**(n_melt(c)) - - endif - - ! update fsca by new snow event, add to previous fsca - if (newsnow(c) > 0._r8) then - fsno_new = 1._r8 - (1._r8 - tanh(accum_factor*newsnow(c)))*(1._r8 - frac_sno(c)) - frac_sno(c) = fsno_new - - ! reset int_snow after accumulation events - temp_intsnow= (h2osno(c) + newsnow(c)) & - / (0.5*(cos(rpi*(1._r8-max(frac_sno(c),1e-6_r8))**(1./n_melt(c)))+1._r8)) - int_snow(c) = min(1.e8_r8,temp_intsnow) - endif - - !==================================================================== - - ! for subgrid fluxes - if (subgridflag ==1 .and. .not. lun%urbpoi(l)) then - if (frac_sno(c) > 0._r8)then - snow_depth(c)=snow_depth(c) + newsnow(c)/(bifall(c) * frac_sno(c)) - else - snow_depth(c)=0._r8 - end if - else - ! for uniform snow cover - snow_depth(c)=snow_depth(c)+newsnow(c)/bifall(c) - endif - - ! use original fsca formulation (n&y 07) - if (oldfflag == 1) then - ! snow cover fraction in Niu et al. 2007 - if(snow_depth(c) > 0.0_r8) then - frac_sno(c) = tanh(snow_depth(c)/(2.5_r8*zlnd* & - (min(800._r8,(h2osno(c)+ newsnow(c))/snow_depth(c))/100._r8)**1._r8) ) - endif - if(h2osno(c) < 1.0_r8) then - frac_sno(c)=min(frac_sno(c),h2osno(c)) - endif - endif - - else !h2osno == 0 - ! initialize frac_sno and snow_depth when no snow present initially - if (newsnow(c) > 0._r8) then - z_avg = newsnow(c)/bifall(c) - fmelt=newsnow(c) - frac_sno(c) = tanh(accum_factor*newsnow(c)) - - ! make int_snow consistent w/ new fsno, h2osno - int_snow(c) = 0. !reset prior to adding newsnow below - temp_intsnow= (h2osno(c) + newsnow(c)) & - / (0.5*(cos(rpi*(1._r8-max(frac_sno(c),1e-6_r8))**(1./n_melt(c)))+1._r8)) - int_snow(c) = min(1.e8_r8,temp_intsnow) - - ! update snow_depth and h2osno to be consistent with frac_sno, z_avg - if (subgridflag ==1 .and. .not. lun%urbpoi(l)) then - snow_depth(c)=z_avg/frac_sno(c) - else - snow_depth(c)=newsnow(c)/bifall(c) - endif - ! use n&y07 formulation - if (oldfflag == 1) then - ! snow cover fraction in Niu et al. 2007 - if(snow_depth(c) > 0.0_r8) then - frac_sno(c) = tanh(snow_depth(c)/(2.5_r8*zlnd* & - (min(800._r8,newsnow(c)/snow_depth(c))/100._r8)**1._r8) ) - endif - endif - else - z_avg = 0._r8 - snow_depth(c) = 0._r8 - frac_sno(c) = 0._r8 - endif - endif ! end of h2osno > 0 - - ! no snow on surface water - qflx_snow_h2osfc(c) = 0._r8 - - ! update h2osno for new snow - h2osno(c) = h2osno(c) + newsnow(c) - int_snow(c) = int_snow(c) + newsnow(c) - - ! update change in snow depth - dz_snowf = (snow_depth(c) - temp_snow_depth) / dtime - - ! set frac_sno_eff variable - if (.not. lun%urbpoi(l)) then - if (subgridflag ==1) then - frac_sno_eff(c) = frac_sno(c) - else - frac_sno_eff(c) = 1._r8 - endif - else - frac_sno_eff(c) = 1._r8 - endif - - if (lun%itype(l)==istwet .and. t_grnd(c)>tfrz) then - h2osno(c)=0._r8 - snow_depth(c)=0._r8 - end if - - ! When the snow accumulation exceeds 10 mm, initialize snow layer - ! Currently, the water temperature for the precipitation is simply set - ! as the surface air temperature - - newnode = 0 ! flag for when snow node will be initialized - if (snl(c) == 0 .and. frac_sno(c)*snow_depth(c) >= 0.01_r8) then - newnode = 1 - snl(c) = -1 - dz(c,0) = snow_depth(c) ! meter - z(c,0) = -0.5_r8*dz(c,0) - zi(c,-1) = -dz(c,0) - t_soisno(c,0) = min(tfrz, forc_t(c)) ! K - h2osoi_ice(c,0) = h2osno(c) ! kg/m2 - h2osoi_liq(c,0) = 0._r8 ! kg/m2 - frac_iceold(c,0) = 1._r8 - - ! intitialize SNICAR variables for fresh snow: - call aerosol_inst%Reset(column=c) - call waterstate_inst%Reset(column=c) - end if - - ! The change of ice partial density of surface node due to precipitation. - ! Only ice part of snowfall is added here, the liquid part will be added - ! later. - - if (snl(c) < 0 .and. newnode == 0) then - h2osoi_ice(c,snl(c)+1) = h2osoi_ice(c,snl(c)+1)+newsnow(c) - dz(c,snl(c)+1) = dz(c,snl(c)+1)+dz_snowf*dtime - end if - - end do - - ! update surface water fraction (this may modify frac_sno) - call FracH2oSfc(bounds, num_nolakec, filter_nolakec, & - waterstate_inst) - - end associate - - end subroutine CanopyHydrology - - !----------------------------------------------------------------------- - subroutine FracWet(numf, filter, canopystate_inst, waterstate_inst) - ! - ! !DESCRIPTION: - ! Determine fraction of vegetated surfaces which are wet and - ! fraction of elai which is dry. The variable ``fwet'' is the - ! fraction of all vegetation surfaces which are wet including - ! stem area which contribute to evaporation. The variable ``fdry'' - ! is the fraction of elai which is dry because only leaves - ! can transpire. Adjusted for stem area which does not transpire. - ! - ! ! USES: - use clm_varcon , only : tfrz - ! !ARGUMENTS: - integer , intent(in) :: numf ! number of filter non-lake points - integer , intent(in) :: filter(numf) ! patch filter for non-lake points - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,p ! indices - real(r8) :: vegt ! lsai - real(r8) :: dewmxi ! inverse of maximum allowed dew [1/mm] - !----------------------------------------------------------------------- - - associate( & - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:)] fraction of veg not covered by snow (0/1 now) [-] - dewmx => canopystate_inst%dewmx_patch , & ! Input: [real(r8) (:) ] Maximum allowed dew [mm] - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - - h2ocan => waterstate_inst%h2ocan_patch , & ! Input: [real(r8) (:) ] total canopy water (mm H2O) - snocan => waterstate_inst%snocan_patch , & ! Output: [real(r8) (:) ] canopy snow (mm H2O) - liqcan => waterstate_inst%liqcan_patch , & ! Output: [real(r8) (:) ] canopy liquid (mm H2O) - - fwet => waterstate_inst%fwet_patch , & ! Output: [real(r8) (:) ] fraction of canopy that is wet (0 to 1) - fcansno => waterstate_inst%fcansno_patch , & ! Output: [real(r8) (:) ] fraction of canopy that is snow covered (0 to 1) - fdry => waterstate_inst%fdry_patch & ! Output: [real(r8) (:) ] fraction of foliage that is green and dry [-] (new) - ) - - ! Set status of snowveg_flag - snowveg_onrad = IsSnowvegFlagOnRad() - - do fp = 1,numf - p = filter(fp) - if (frac_veg_nosno(p) == 1) then - if (h2ocan(p) > 0._r8) then - vegt = frac_veg_nosno(p)*(elai(p) + esai(p)) - dewmxi = 1.0_r8/dewmx(p) - fwet(p) = ((dewmxi/vegt)*h2ocan(p))**0.666666666666_r8 - fwet(p) = min (fwet(p),maximum_leaf_wetted_fraction) ! Check for maximum limit of fwet - if (snowveg_onrad) then - if (snocan(p) > 0._r8) then - dewmxi = 1.0_r8/dewmx(p) - fcansno(p) = ((dewmxi/(vegt*6.0_r8*10.0_r8))*snocan(p))**0.15_r8 ! must match snocanmx - fcansno(p) = min (fcansno(p),1.0_r8) - else - fcansno(p) = 0._r8 - end if - else - fcansno(p) = 0._r8 - end if - else - fwet(p) = 0._r8 - fcansno(p) = 0._r8 - end if - fdry(p) = (1._r8-fwet(p))*elai(p)/(elai(p)+esai(p)) - else - fwet(p) = 0._r8 - fdry(p) = 0._r8 - end if - end do - - end associate - end subroutine FracWet - - !----------------------------------------------------------------------- - subroutine FracH2OSfc(bounds, num_h2osfc, filter_h2osfc, & - waterstate_inst, no_update) - ! - ! !DESCRIPTION: - ! Determine fraction of land surfaces which are submerged - ! based on surface microtopography and surface water storage. - ! - ! !USES: - use shr_const_mod , only : shr_const_pi - use shr_spfn_mod , only : erf => shr_spfn_erf - use landunit_varcon , only : istsoil, istcrop - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_h2osfc ! number of column points in column filter - integer , intent(in) :: filter_h2osfc(:) ! column filter - type(waterstate_type) , intent(inout) :: waterstate_inst - integer , intent(in), optional :: no_update ! flag to make calculation w/o updating variables - ! - ! !LOCAL VARIABLES: - integer :: c,f,l ! indices - real(r8):: d,fd,dfdd ! temporary variable for frac_h2o iteration - real(r8):: sigma ! microtopography pdf sigma in mm - real(r8):: min_h2osfc - !----------------------------------------------------------------------- - - associate( & - micro_sigma => col%micro_sigma , & ! Input: [real(r8) (:) ] microtopography pdf sigma (m) - - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (col,lyr) [kg/m2] - h2osfc => waterstate_inst%h2osfc_col , & ! Output: [real(r8) (:) ] surface water (mm) - frac_sno => waterstate_inst%frac_sno_col , & ! Output: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Output: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col, & ! Output: [real(r8) (:) ] col fractional area with surface water greater than zero - frac_h2osfc_nosnow => waterstate_inst%frac_h2osfc_nosnow_col & ! Output: [real(r8) (:) ] col fractional area with surface water greater than zero (if no snow present) - ) - - ! arbitrary lower limit on h2osfc for safer numerics... - min_h2osfc=1.e-8_r8 - - do f = 1, num_h2osfc - c = filter_h2osfc(f) - l = col%landunit(c) - - ! h2osfc only calculated for soil vegetated land units - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - ! Use newton-raphson method to iteratively determine frac_h2osfc - ! based on amount of surface water storage (h2osfc) and - ! microtopography variability (micro_sigma) - - if (h2osfc(c) > min_h2osfc) then - ! a cutoff is needed for numerical reasons...(nonconvergence after 5 iterations) - d=0.0 - - sigma=1.0e3 * micro_sigma(c) ! convert to mm - do l=1,10 - fd = 0.5*d*(1.0_r8+erf(d/(sigma*sqrt(2.0)))) & - +sigma/sqrt(2.0*shr_const_pi)*exp(-d**2/(2.0*sigma**2)) & - -h2osfc(c) - dfdd = 0.5*(1.0_r8+erf(d/(sigma*sqrt(2.0)))) - - d = d - fd/dfdd - enddo - !-- update the submerged areal fraction using the new d value - frac_h2osfc(c) = 0.5*(1.0_r8+erf(d/(sigma*sqrt(2.0)))) - - else - frac_h2osfc(c) = 0._r8 - h2osoi_liq(c,1) = h2osoi_liq(c,1) + h2osfc(c) - h2osfc(c)=0._r8 - endif - - frac_h2osfc_nosnow(c) = frac_h2osfc(c) - - - if (.not. present(no_update)) then - - ! adjust fh2o, fsno when sum is greater than zero - if (frac_sno(c) > (1._r8 - frac_h2osfc(c)) .and. h2osno(c) > 0) then - - if (frac_h2osfc(c) > 0.01_r8) then - frac_h2osfc(c) = max(1.0_r8 - frac_sno(c),0.01_r8) - frac_sno(c) = 1.0_r8 - frac_h2osfc(c) - else - frac_sno(c) = 1.0_r8 - frac_h2osfc(c) - endif - frac_sno_eff(c)=frac_sno(c) - - endif - - endif ! end of no_update construct - - else !if landunit not istsoil/istcrop, set frac_h2osfc to zero - - frac_h2osfc(c) = 0._r8 - - endif - - end do - - end associate - - end subroutine FracH2OSfc - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsSnowvegFlagOff - ! - ! !INTERFACE: - ! - logical function IsSnowvegFlagOff( ) - ! - ! !DESCRIPTION: - ! - ! Return true if snowveg_flag is OFF - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - IsSnowvegFlagOff = (trim(snowveg_flag) == 'OFF') - - end function IsSnowvegFlagOff - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsSnowvegFlagOn - ! - ! !INTERFACE: - ! - logical function IsSnowvegFlagOn( ) - ! - ! !DESCRIPTION: - ! - ! Return true if snowveg_flag is ON - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - IsSnowvegFlagOn = (trim(snowveg_flag) == 'ON') - - end function IsSnowvegFlagOn - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsSnowvegFlagOnRad - ! - ! !INTERFACE: - ! - logical function IsSnowvegFlagOnRad( ) - ! - ! !DESCRIPTION: - ! - ! Return true if snowveg_flag is ON_RAD - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - IsSnowvegFlagOnRad = (trim(snowveg_flag) == 'ON_RAD') - - end function IsSnowvegFlagOnRad - -end module CanopyHydrologyMod diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 deleted file mode 100644 index bfb5196d79..0000000000 --- a/src/biogeophys/CanopyStateType.F90 +++ /dev/null @@ -1,640 +0,0 @@ -module CanopyStateType - - !------------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, shr_infnan_isnan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use landunit_varcon , only : istsoil, istcrop - use clm_varpar , only : nlevcan, nvegwcs - use clm_varcon , only : spval - use clm_varctl , only : iulog, use_cn, use_fates, use_hydrstress - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: CanopyState_type - - integer , pointer :: frac_veg_nosno_patch (:) ! patch fraction of vegetation not covered by snow (0 OR 1) [-] - integer , pointer :: frac_veg_nosno_alb_patch (:) ! patch fraction of vegetation not covered by snow (0 OR 1) [-] - - real(r8) , pointer :: tlai_patch (:) ! patch canopy one-sided leaf area index, no burying by snow - real(r8) , pointer :: tsai_patch (:) ! patch canopy one-sided stem area index, no burying by snow - real(r8) , pointer :: elai_patch (:) ! patch canopy one-sided leaf area index with burying by snow - real(r8) , pointer :: esai_patch (:) ! patch canopy one-sided stem area index with burying by snow - real(r8) , pointer :: elai240_patch (:) ! patch canopy one-sided leaf area index with burying by snow average over 10days - real(r8) , pointer :: laisun_patch (:) ! patch patch sunlit projected leaf area index - real(r8) , pointer :: laisha_patch (:) ! patch patch shaded projected leaf area index - real(r8) , pointer :: laisun_z_patch (:,:) ! patch patch sunlit leaf area for canopy layer - real(r8) , pointer :: laisha_z_patch (:,:) ! patch patch shaded leaf area for canopy layer - real(r8) , pointer :: mlaidiff_patch (:) ! patch difference between lai month one and month two (for dry deposition of chemical tracers) - real(r8) , pointer :: annlai_patch (:,:) ! patch 12 months of monthly lai from input data set (for dry deposition of chemical tracers) - real(r8) , pointer :: htop_patch (:) ! patch canopy top (m) - real(r8) , pointer :: hbot_patch (:) ! patch canopy bottom (m) - real(r8) , pointer :: displa_patch (:) ! patch displacement height (m) - real(r8) , pointer :: fsun_patch (:) ! patch sunlit fraction of canopy - real(r8) , pointer :: fsun24_patch (:) ! patch 24hr average of sunlit fraction of canopy - real(r8) , pointer :: fsun240_patch (:) ! patch 240hr average of sunlit fraction of canopy - - real(r8) , pointer :: alt_col (:) ! col current depth of thaw - integer , pointer :: alt_indx_col (:) ! col current depth of thaw - real(r8) , pointer :: altmax_col (:) ! col maximum annual depth of thaw - real(r8) , pointer :: altmax_lastyear_col (:) ! col prior year maximum annual depth of thaw - integer , pointer :: altmax_indx_col (:) ! col maximum annual depth of thaw - integer , pointer :: altmax_lastyear_indx_col (:) ! col prior year maximum annual depth of thaw - - real(r8) , pointer :: dewmx_patch (:) ! patch maximum allowed dew [mm] - real(r8) , pointer :: dleaf_patch (:) ! patch characteristic leaf width (diameter) [m] - ! for non-ED/FATES this is the same as pftcon%dleaf() - real(r8) , pointer :: rscanopy_patch (:) ! patch canopy stomatal resistance (s/m) (ED specific) - - real(r8) , pointer :: vegwp_patch (:,:) ! patch vegetation water matric potential (mm) - - real(r8) :: leaf_mr_vcm = spval ! Scalar constant of leaf respiration with Vcmax - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: ReadNML - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - procedure, public :: Restart - - end type CanopyState_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - if ( this%leaf_mr_vcm == spval ) then - call endrun(msg="ERROR canopystate Init called before ReadNML"//errmsg(sourcefile, __LINE__)) - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%frac_veg_nosno_patch (begp:endp)) ; this%frac_veg_nosno_patch (:) = huge(1) - allocate(this%frac_veg_nosno_alb_patch (begp:endp)) ; this%frac_veg_nosno_alb_patch (:) = 0 - allocate(this%tlai_patch (begp:endp)) ; this%tlai_patch (:) = nan - allocate(this%tsai_patch (begp:endp)) ; this%tsai_patch (:) = nan - allocate(this%elai_patch (begp:endp)) ; this%elai_patch (:) = nan - allocate(this%elai240_patch (begp:endp)) ; this%elai240_patch (:) = nan - allocate(this%esai_patch (begp:endp)) ; this%esai_patch (:) = nan - allocate(this%laisun_patch (begp:endp)) ; this%laisun_patch (:) = nan - allocate(this%laisha_patch (begp:endp)) ; this%laisha_patch (:) = nan - allocate(this%laisun_z_patch (begp:endp,1:nlevcan)) ; this%laisun_z_patch (:,:) = nan - allocate(this%laisha_z_patch (begp:endp,1:nlevcan)) ; this%laisha_z_patch (:,:) = nan - allocate(this%mlaidiff_patch (begp:endp)) ; this%mlaidiff_patch (:) = nan - allocate(this%annlai_patch (12,begp:endp)) ; this%annlai_patch (:,:) = nan - allocate(this%htop_patch (begp:endp)) ; this%htop_patch (:) = nan - allocate(this%hbot_patch (begp:endp)) ; this%hbot_patch (:) = nan - allocate(this%displa_patch (begp:endp)) ; this%displa_patch (:) = nan - allocate(this%fsun_patch (begp:endp)) ; this%fsun_patch (:) = nan - allocate(this%fsun24_patch (begp:endp)) ; this%fsun24_patch (:) = nan - allocate(this%fsun240_patch (begp:endp)) ; this%fsun240_patch (:) = nan - - allocate(this%alt_col (begc:endc)) ; this%alt_col (:) = spval - allocate(this%altmax_col (begc:endc)) ; this%altmax_col (:) = spval - allocate(this%altmax_lastyear_col (begc:endc)) ; this%altmax_lastyear_col (:) = spval - allocate(this%alt_indx_col (begc:endc)) ; this%alt_indx_col (:) = huge(1) - allocate(this%altmax_indx_col (begc:endc)) ; this%altmax_indx_col (:) = huge(1) - allocate(this%altmax_lastyear_indx_col (begc:endc)) ; this%altmax_lastyear_indx_col (:) = huge(1) - - allocate(this%dewmx_patch (begp:endp)) ; this%dewmx_patch (:) = nan - allocate(this%dleaf_patch (begp:endp)) ; this%dleaf_patch (:) = nan - allocate(this%rscanopy_patch (begp:endp)) ; this%rscanopy_patch (:) = nan -! allocate(this%gccanopy_patch (begp:endp)) ; this%gccanopy_patch (:) = 0.0_r8 - allocate(this%vegwp_patch (begp:endp,1:nvegwcs)) ; this%vegwp_patch (:,:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%elai_patch(begp:endp) = spval - call hist_addfld1d (fname='ELAI', units='m^2/m^2', & - avgflag='A', long_name='exposed one-sided leaf area index', & - ptr_patch=this%elai_patch) - - this%esai_patch(begp:endp) = spval - call hist_addfld1d (fname='ESAI', units='m^2/m^2', & - avgflag='A', long_name='exposed one-sided stem area index', & - ptr_patch=this%esai_patch) - - this%tlai_patch(begp:endp) = spval - call hist_addfld1d (fname='TLAI', units='m^2/m^2', & - avgflag='A', long_name='total projected leaf area index', & - ptr_patch=this%tlai_patch) - - this%tsai_patch(begp:endp) = spval - call hist_addfld1d (fname='TSAI', units='m^2/m^2', & - avgflag='A', long_name='total projected stem area index', & - ptr_patch=this%tsai_patch) - - this%laisun_patch(begp:endp) = spval - call hist_addfld1d (fname='LAISUN', units='m^2/m^2', & - avgflag='A', long_name='sunlit projected leaf area index', & - ptr_patch=this%laisun_patch, set_urb=0._r8) - - this%laisha_patch(begp:endp) = spval - call hist_addfld1d (fname='LAISHA', units='m^2/m^2', & - avgflag='A', long_name='shaded projected leaf area index', & - ptr_patch=this%laisha_patch, set_urb=0._r8) - - if (use_cn .or. use_fates) then - this%fsun_patch(begp:endp) = spval - call hist_addfld1d (fname='FSUN', units='proportion', & - avgflag='A', long_name='sunlit fraction of canopy', & - ptr_patch=this%fsun_patch, default='inactive') - - this%dewmx_patch(begp:endp) = spval - call hist_addfld1d (fname='DEWMX', units='mm', & - avgflag='A', long_name='Maximum allowed dew', & - ptr_patch=this%dewmx_patch, default='inactive') - - this%htop_patch(begp:endp) = spval - call hist_addfld1d (fname='HTOP', units='m', & - avgflag='A', long_name='canopy top', & - ptr_patch=this%htop_patch) - - this%hbot_patch(begp:endp) = spval - call hist_addfld1d (fname='HBOT', units='m', & - avgflag='A', long_name='canopy bottom', & - ptr_patch=this%hbot_patch, default='inactive') - - this%displa_patch(begp:endp) = spval - call hist_addfld1d (fname='DISPLA', units='m', & - avgflag='A', long_name='displacement height', & - ptr_patch=this%displa_patch, default='inactive') - end if - - if (use_cn) then - this%alt_col(begc:endc) = spval - call hist_addfld1d (fname='ALT', units='m', & - avgflag='A', long_name='current active layer thickness', & - ptr_col=this%alt_col) - - this%altmax_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX', units='m', & - avgflag='A', long_name='maximum annual active layer thickness', & - ptr_col=this%altmax_col) - - this%altmax_lastyear_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX_LASTYEAR', units='m', & - avgflag='A', long_name='maximum prior year active layer thickness', & - ptr_col=this%altmax_lastyear_col, default='inactive') - end if - - ! Allow active layer fields to be optionally output even if not running CN - - if (.not. use_cn) then - this%alt_col(begc:endc) = spval - call hist_addfld1d (fname='ALT', units='m', & - avgflag='A', long_name='current active layer thickness', & - ptr_col=this%alt_col, default='inactive') - - this%altmax_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX', units='m', & - avgflag='A', long_name='maximum annual active layer thickness', & - ptr_col=this%altmax_col, default='inactive') - - this%altmax_lastyear_col(begc:endc) = spval - call hist_addfld1d (fname='ALTMAX_LASTYEAR', units='m', & - avgflag='A', long_name='maximum prior year active layer thickness', & - ptr_col=this%altmax_lastyear_col, default='inactive') - end if - - - - ! Accumulated fields - this%fsun24_patch(begp:endp) = spval - call hist_addfld1d (fname='FSUN24', units='K', & - avgflag='A', long_name='fraction sunlit (last 24hrs)', & - ptr_patch=this%fsun24_patch, default='inactive') - - this%fsun240_patch(begp:endp) = spval - call hist_addfld1d (fname='FSUN240', units='K', & - avgflag='A', long_name='fraction sunlit (last 240hrs)', & - ptr_patch=this%fsun240_patch, default='inactive') - - this%elai240_patch(begp:endp) = spval - call hist_addfld1d (fname='LAI240', units='m^2/m^2', & - avgflag='A', long_name='240hr average of leaf area index', & - ptr_patch=this%elai240_patch, default='inactive') - - ! Ed specific field - if ( use_fates ) then - this%rscanopy_patch(begp:endp) = spval - call hist_addfld1d (fname='RSCANOPY', units=' s m-1', & - avgflag='A', long_name='canopy resistance', & - ptr_patch=this%rscanopy_patch, set_lake=0._r8, set_urb=0._r8) - end if - -! call hist_addfld1d (fname='GCCANOPY', units='none', & -! avgflag='A', long_name='Canopy Conductance: mmol m-2 s-1', & -! ptr_patch=this%GCcanopy_patch, set_lake=0._r8, set_urb=0._r8) - - if ( use_hydrstress ) then - this%vegwp_patch(begp:endp,:) = spval - call hist_addfld2d (fname='VEGWP', units='mm', type2d='nvegwcs', & - avgflag='A', long_name='vegetation water matric potential for sun/sha canopy,xyl,root segments', & - ptr_patch=this%vegwp_patch) - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! - ! !USES - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - !--------------------------------------------------------------------- - - this%fsun24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSUN24', units='fraction', & - desc='24hr average of diffuse solar radiation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%fsun240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSUN240', units='fraction', & - desc='240hr average of diffuse solar radiation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%elai240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='LAI240', units='m2/m2', & - desc='240hr average of leaf area index', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="extract_accum_hist allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - ! Determine time step - nstep = get_nstep() - - call extract_accum_field ('FSUN24', rbufslp, nstep) - this%fsun24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSUN240', rbufslp, nstep) - this%fsun240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('LAI240', rbufslp, nstep) - this%elai240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSUN24', rbufslp, nstep) - this%fsun24_patch(begp:endp) = rbufslp(begp:endp) - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine ReadNML( this, NLFilename ) - ! - ! Read in canopy parameter namelist - ! - ! USES: - use shr_mpi_mod , only : shr_mpi_bcast - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! ARGUMENTS: - implicit none - class(canopystate_type) :: this - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - real(r8) :: leaf_mr_vcm ! Scalar of leaf respiration to vcmax - character(len=32) :: subname = 'CanopyStateType::ReadNML' ! subroutine name - !----------------------------------------------------------------------- - namelist / clm_canopy_inparm / leaf_mr_vcm - - ! ---------------------------------------------------------------------- - ! Read namelist from input namelist filename - ! ---------------------------------------------------------------------- - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clm_canopy_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_canopy_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_canopy_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_canopy_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_canopy_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - ! Broadcast namelist variables read in - call shr_mpi_bcast(leaf_mr_vcm, mpicom) - this%leaf_mr_vcm = leaf_mr_vcm - - end subroutine ReadNML - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use clm_time_manager, only : get_nstep - use accumulMod , only : update_accum_field, extract_accum_field - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,p ! indices - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract fsun24 & fsun240 - do p = begp,endp - rbufslp(p) = this%fsun_patch(p) - end do - call update_accum_field ('FSUN24' , rbufslp , nstep) - call extract_accum_field ('FSUN24' , this%fsun24_patch , nstep) - call update_accum_field ('FSUN240', rbufslp , nstep) - call extract_accum_field ('FSUN240', this%fsun240_patch , nstep) - - ! Accumulate and extract elai240 - do p = begp,endp - rbufslp(p) = this%elai_patch(p) - end do - call update_accum_field ('LAI240', rbufslp , nstep) - call extract_accum_field ('LAI240', this%elai240_patch , nstep) - - deallocate(rbufslp) - - end subroutine UpdateAccVars - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l,c,g - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - - this%frac_veg_nosno_patch(p) = 0._r8 - this%tlai_patch(p) = 0._r8 - this%tsai_patch(p) = 0._r8 - this%elai_patch(p) = 0._r8 - this%esai_patch(p) = 0._r8 - this%htop_patch(p) = 0._r8 - this%hbot_patch(p) = 0._r8 - this%dewmx_patch(p) = 0.1_r8 - this%vegwp_patch(p,:) = -2.5e4_r8 - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%laisun_patch(p) = 0._r8 - this%laisha_patch(p) = 0._r8 - end if - - ! needs to be initialized to spval to avoid problems when averaging for the accum - ! field - this%fsun_patch(p) = spval - end do - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%alt_col(c) = 0._r8 !iniitialized to spval for all columns - this%altmax_col(c) = 0._r8 !iniitialized to spval for all columns - this%altmax_lastyear_col(c) = 0._r8 !iniitialized to spval for all columns - this%alt_indx_col(c) = 0 !initiialized to huge for all columns - this%altmax_indx_col(c) = 0 !initiialized to huge for all columns - this%altmax_lastyear_indx_col = 0 !initiialized to huge for all columns - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(canopystate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,p,c,iv ! indices - logical :: readvar ! determine if variable is on initial file - integer :: begp, endp - !----------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - call restartvar(ncid=ncid, flag=flag, varname='FRAC_VEG_NOSNO_ALB', xtype=ncd_int, & - dim1name='pft', long_name='fraction of vegetation not covered by snow (0 or 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frac_veg_nosno_alb_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tlai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided leaf area index, no burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tlai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tsai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided stem area index, no burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tsai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='elai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided leaf area index, with burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%elai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='esai', xtype=ncd_double, & - dim1name='pft', long_name='one-sided stem area index, with burying by snow', units='', & - interpinic_flag='interp', readvar=readvar, data=this%esai_patch) - - call restartvar(ncid=ncid, flag=flag, varname='htop', xtype=ncd_double, & - dim1name='pft', long_name='canopy top', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%htop_patch) - - call restartvar(ncid=ncid, flag=flag, varname='hbot', xtype=ncd_double, & - dim1name='pft', long_name='canopy botton', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%hbot_patch) - - call restartvar(ncid=ncid, flag=flag, varname='mlaidiff', xtype=ncd_double, & - dim1name='pft', long_name='difference between lai month one and month two', units='', & - interpinic_flag='interp', readvar=readvar, data=this%mlaidiff_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fsun', xtype=ncd_double, & - dim1name='pft', long_name='sunlit fraction of canopy', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fsun_patch) - - if (flag=='read' )then - do p = bounds%begp,bounds%endp - if (shr_infnan_isnan(this%fsun_patch(p)) ) then - this%fsun_patch(p) = spval - end if - end do - end if - - if (use_cn .or. use_fates) then - call restartvar(ncid=ncid, flag=flag, varname='altmax', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_col) - - call restartvar(ncid=ncid, flag=flag, varname='altmax_lastyear', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_lastyear_col) - - call restartvar(ncid=ncid, flag=flag, varname='altmax_indx', xtype=ncd_int, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_indx_col) - - call restartvar(ncid=ncid, flag=flag, varname='altmax_lastyear_indx', xtype=ncd_int, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%altmax_lastyear_indx_col) - end if - - if ( use_hydrstress ) then - call restartvar(ncid=ncid, flag=flag, varname='vegwp', xtype=ncd_double, & - dim1name='pft', dim2name='vegwcs', switchdim=.true., & - long_name='vegetation water matric potential', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%vegwp_patch) - - end if - - end subroutine Restart - -end module CanopyStateType diff --git a/src/biogeophys/CanopyTemperatureMod.F90 b/src/biogeophys/CanopyTemperatureMod.F90 deleted file mode 100644 index de9c977f93..0000000000 --- a/src/biogeophys/CanopyTemperatureMod.F90 +++ /dev/null @@ -1,502 +0,0 @@ -module CanopyTemperatureMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! CanopyFluxes calculates the leaf temperature and the leaf fluxes, - ! transpiration, photosynthesis and updates the dew accumulation due to evaporation. - ! CanopyTemperature performs calculation of leaf temperature and surface fluxes. - ! SoilFluxes then determines soil/snow and ground temperatures and updates the surface - ! fluxes for the new ground temperature. - - ! - ! !USES: - use shr_sys_mod , only : shr_sys_flush - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_const_mod , only : SHR_CONST_PI - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog, use_fates - use PhotosynthesisMod , only : Photosynthesis, PhotosynthesisTotal, Fractionation - use SurfaceResistanceMod , only : calc_soilevap_resis - use pftconMod , only : pftcon - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: CanopyTemperature - !------------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------------ - subroutine CanopyTemperature(bounds, & - num_nolakec, filter_nolakec, num_nolakep, filter_nolakep, & - clm_fates, & - atm2lnd_inst, canopystate_inst, soilstate_inst, frictionvel_inst, & - waterstate_inst, waterflux_inst, energyflux_inst, temperature_inst ) - ! - ! !DESCRIPTION: - ! This is the main subroutine to execute the calculation of leaf temperature - ! and surface fluxes. Subroutine SoilFluxes then determines soil/snow and ground - ! temperatures and updates the surface fluxes for the new ground temperature. - ! - ! Calling sequence is: - ! Biogeophysics1: surface biogeophysics driver - ! -> QSat: saturated vapor pressure, specific humidity, and - ! derivatives at ground surface and derivatives at - ! leaf surface using updated leaf temperature - ! Leaf temperature - ! Foliage energy conservation is given by the foliage energy budget - ! equation: - ! Rnet - Hf - LEf = 0 - ! The equation is solved by Newton-Raphson iteration, in which this - ! iteration includes the calculation of the photosynthesis and - ! stomatal resistance, and the integration of turbulent flux profiles. - ! The sensible and latent heat transfer between foliage and atmosphere - ! and ground is linked by the equations: - ! Ha = Hf + Hg and Ea = Ef + Eg - ! - ! !USES: - use QSatMod , only : QSat - use clm_varcon , only : denh2o, denice, roverg, hvap, hsub, zlnd, zsno, tfrz, spval - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_imperv, icol_road_perv - use landunit_varcon , only : istice_mec, istwet, istsoil, istdlak, istcrop, istdlak - use clm_varpar , only : nlevgrnd, nlevurb, nlevsno, nlevsoi - use clm_varctl , only : use_fates - use CLMFatesInterfaceMod, only : hlm_fates_interface_type - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_nolakep ! number of column non-lake points in patch filter - integer , intent(in) :: filter_nolakep(:) ! patch filter for non-lake points - type(hlm_fates_interface_type), intent(inout) :: clm_fates - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p ! indices - integer :: j ! soil/snow level index - integer :: fp ! lake filter patch index - integer :: fc ! lake filter column index - real(r8) :: qred ! soil surface relative humidity - real(r8) :: avmuir ! ir inverse optical depth per unit leaf area - real(r8) :: eg ! water vapor pressure at temperature T [pa] - real(r8) :: qsatg ! saturated humidity [kg/kg] - real(r8) :: degdT ! d(eg)/dT - real(r8) :: qsatgdT ! d(qsatg)/dT - real(r8) :: fac ! soil wetness of surface layer - real(r8) :: psit ! negative potential of soil - real(r8) :: hr ! alpha soil - real(r8) :: hr_road_perv ! alpha soil for urban pervious road - real(r8) :: wx ! partial volume of ice and water of surface layer - real(r8) :: fac_fc ! soil wetness of surface layer relative to field capacity - real(r8) :: eff_porosity ! effective porosity in layer - real(r8) :: vol_ice ! partial volume of ice lens in layer - real(r8) :: vol_liq ! partial volume of liquid water in layer - real(r8) :: fh2o_eff(bounds%begc:bounds%endc) ! effective surface water fraction (i.e. seen by atm) - !------------------------------------------------------------------------------ - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - zii => col%zii , & ! Output: [real(r8) (:) ] convective boundary height [m] - z_0_town => lun%z_0_town , & ! Input: [real(r8) (:) ] momentum roughness length of urban landunit (m) - z_d_town => lun%z_d_town , & ! Input: [real(r8) (:) ] displacement height of urban landunit (m) - urbpoi => lun%urbpoi , & ! Input: [logical (:) ] true => landunit is an urban point - - z0mr => pftcon%z0mr , & ! Input: ratio of momentum roughness length to canopy top height (-) - displar => pftcon%displar , & ! Input: ratio of displacement height to canopy top height (-) - - forc_hgt_t => atm2lnd_inst%forc_hgt_t_grc , & ! Input: [real(r8) (:) ] observational height of temperature [m] - forc_u => atm2lnd_inst%forc_u_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in east direction (m/s) - forc_v => atm2lnd_inst%forc_v_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in north direction (m/s) - forc_hgt_u => atm2lnd_inst%forc_hgt_u_grc , & ! Input: [real(r8) (:) ] observational height of wind [m] - forc_hgt_q => atm2lnd_inst%forc_hgt_q_grc , & ! Input: [real(r8) (:) ] observational height of specific humidity [m] - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - forc_th => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric potential temperature (Kelvin) - - - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - qg_snow => waterstate_inst%qg_snow_col , & ! Output: [real(r8) (:) ] specific humidity at snow surface [kg/kg] - qg_soil => waterstate_inst%qg_soil_col , & ! Output: [real(r8) (:) ] specific humidity at soil surface [kg/kg] - qg => waterstate_inst%qg_col , & ! Output: [real(r8) (:) ] ground specific humidity [kg/kg] - qg_h2osfc => waterstate_inst%qg_h2osfc_col , & ! Output: [real(r8) (:) ] specific humidity at h2osfc surface [kg/kg] - dqgdT => waterstate_inst%dqgdT_col , & ! Output: [real(r8) (:) ] d(qg)/dT - - qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - qflx_evap_veg => waterflux_inst%qflx_evap_veg_patch , & ! Output: [real(r8) (:) ] vegetation evaporation (mm H2O/s) (+ = to atm) - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Output: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - - htvp => energyflux_inst%htvp_col , & ! Output: [real(r8) (:) ] latent heat of vapor of water (or sublimation) [j/kg] - cgrnd => energyflux_inst%cgrnd_patch , & ! Output: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] - cgrnds => energyflux_inst%cgrnds_patch , & ! Output: [real(r8) (:) ] deriv. of soil sensible heat flux wrt soil temp [w/m2/k] - cgrndl => energyflux_inst%cgrndl_patch , & ! Output: [real(r8) (:) ] deriv. of soil latent heat flux wrt soil temp [w/m**2/k] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_tot_r => energyflux_inst%eflx_sh_tot_r_patch , & ! Output: [real(r8) (:) ] rural total sensible heat flux (W/m**2) [+ to atm] - eflx_lh_tot_u => energyflux_inst%eflx_lh_tot_u_patch , & ! Output: [real(r8) (:) ] urban total latent heat flux (W/m**2) [+ to atm] - eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch , & ! Output: [real(r8) (:) ] total latent heat flux (W/m**2) [+ to atm] - eflx_lh_tot_r => energyflux_inst%eflx_lh_tot_r_patch , & ! Output: [real(r8) (:) ] rural total latent heat flux (W/m**2) [+ to atm] - eflx_sh_tot_u => energyflux_inst%eflx_sh_tot_u_patch , & ! Output: [real(r8) (:) ] urban total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] - - forc_hgt_t_patch => frictionvel_inst%forc_hgt_t_patch , & ! Input: [real(r8) (:) ] observational height of temperature at patch level [m] - forc_hgt_q_patch => frictionvel_inst%forc_hgt_q_patch , & ! Input: [real(r8) (:) ] observational height of specific humidity at patch level [m] - z0m => frictionvel_inst%z0m_patch , & ! Output: [real(r8) (:) ] momentum roughness length (m) - z0mv => frictionvel_inst%z0mv_patch , & ! Output: [real(r8) (:) ] roughness length over vegetation, momentum [m] - z0hv => frictionvel_inst%z0hv_patch , & ! Output: [real(r8) (:) ] roughness length over vegetation, sensible heat [m] - z0qv => frictionvel_inst%z0qv_patch , & ! Output: [real(r8) (:) ] roughness length over vegetation, latent heat [m] - z0hg => frictionvel_inst%z0hg_col , & ! Output: [real(r8) (:) ] roughness length over ground, sensible heat [m] - z0mg => frictionvel_inst%z0mg_col , & ! Output: [real(r8) (:) ] roughness length over ground, momentum [m] - z0qg => frictionvel_inst%z0qg_col , & ! Output: [real(r8) (:) ] roughness length over ground, latent heat [m] - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Output: [real(r8) (:) ] observational height of wind at patch level [m] - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - htop => canopystate_inst%htop_patch , & ! Input: [real(r8) (:) ] canopy top (m) - displa => canopystate_inst%displa_patch , & ! Output: [real(r8) (:) ] displacement height (m) - - smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - watfc => soilstate_inst%watfc_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at field capacity - watdry => soilstate_inst%watdry_col , & ! Input: [real(r8) (:,:) ] volumetric soil moisture corresponding to no restriction on ET from urban pervious surface - watopt => soilstate_inst%watopt_col , & ! Input: [real(r8) (:,:) ] volumetric soil moisture corresponding to no restriction on ET from urban pervious surface - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - rootfr_road_perv => soilstate_inst%rootfr_road_perv_col , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer for urban pervious road - rootr_road_perv => soilstate_inst%rootr_road_perv_col , & ! Input: [real(r8) (:,:) ] effective fraction of roots in each soil layer for urban pervious road - soilalpha => soilstate_inst%soilalpha_col , & ! Output: [real(r8) (:) ] factor that reduces ground saturated specific humidity (-) - soilalpha_u => soilstate_inst%soilalpha_u_col , & ! Output: [real(r8) (:) ] Urban factor that reduces ground saturated specific humidity (-) - - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - beta => temperature_inst%beta_col , & ! Output: [real(r8) (:) ] coefficient of convective velocity [-] - emg => temperature_inst%emg_col , & ! Output: [real(r8) (:) ] ground emissivity - emv => temperature_inst%emv_patch , & ! Output: [real(r8) (:) ] vegetation emissivity - t_h2osfc_bef => temperature_inst%t_h2osfc_bef_col , & ! Output: [real(r8) (:) ] saved surface water temperature - t_grnd => temperature_inst%t_grnd_col , & ! Output: [real(r8) (:) ] ground temperature (Kelvin) - thv => temperature_inst%thv_col , & ! Output: [real(r8) (:) ] virtual potential temperature (kelvin) - thm => temperature_inst%thm_patch , & ! Output: [real(r8) (:) ] intermediate variable (forc_t+0.0098*forc_hgt_t_patch) - tssbef => temperature_inst%t_ssbef_col & ! Output: [real(r8) (:,:) ] soil/snow temperature before update - ) - - do j = -nlevsno+1, nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j > nlevurb) then - tssbef(c,j) = spval - else - tssbef(c,j) = t_soisno(c,j) - end if - ! record t_h2osfc prior to updating - t_h2osfc_bef(c) = t_h2osfc(c) - end do - end do - - ! calculate moisture stress/resistance for soil evaporation - call calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, soilstate_inst, waterstate_inst, temperature_inst) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - - if (col%itype(c) == icol_road_perv) then - hr_road_perv = 0._r8 - end if - - ! begin calculations that relate only to the column level - ! Ground and soil temperatures from previous time step - - ! ground temperature is weighted average of exposed soil, snow, and h2osfc - if (snl(c) < 0) then - t_grnd(c) = frac_sno_eff(c) * t_soisno(c,snl(c)+1) & - + (1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c)) * t_soisno(c,1) & - + frac_h2osfc(c) * t_h2osfc(c) - else - t_grnd(c) = (1 - frac_h2osfc(c)) * t_soisno(c,1) + frac_h2osfc(c) * t_h2osfc(c) - endif - - ! Saturated vapor pressure, specific humidity and their derivatives - ! at ground surface - qred = 1._r8 - if (lun%itype(l)/=istwet .AND. lun%itype(l)/=istice_mec) then - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - wx = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/dz(c,1) - fac = min(1._r8, wx/watsat(c,1)) - fac = max( fac, 0.01_r8 ) - psit = -sucsat(c,1) * fac ** (-bsw(c,1)) - psit = max(smpmin(c), psit) - ! modify qred to account for h2osfc - hr = exp(psit/roverg/t_soisno(c,1)) - qred = (1._r8 - frac_sno(c) - frac_h2osfc(c))*hr & - + frac_sno(c) + frac_h2osfc(c) - soilalpha(c) = qred - - else if (col%itype(c) == icol_road_perv) then - ! Pervious road depends on water in total soil column - do j = 1, nlevsoi - if (t_soisno(c,j) >= tfrz) then - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - eff_porosity = watsat(c,j)-vol_ice - vol_liq = min(eff_porosity, h2osoi_liq(c,j)/(dz(c,j)*denh2o)) - fac = min( max(vol_liq-watdry(c,j),0._r8) / (watopt(c,j)-watdry(c,j)), 1._r8 ) - else - fac = 0._r8 - end if - rootr_road_perv(c,j) = rootfr_road_perv(c,j)*fac - hr_road_perv = hr_road_perv + rootr_road_perv(c,j) - end do - ! Allows for sublimation of snow or dew on snow - qred = (1.-frac_sno(c))*hr_road_perv + frac_sno(c) - - ! Normalize root resistances to get layer contribution to total ET - if (hr_road_perv > 0._r8) then - do j = 1, nlevsoi - rootr_road_perv(c,j) = rootr_road_perv(c,j)/hr_road_perv - end do - end if - soilalpha_u(c) = qred - - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - qred = 0._r8 - soilalpha_u(c) = spval - - else if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - qred = 1._r8 - soilalpha_u(c) = spval - end if - - else - soilalpha(c) = spval - - end if - - ! compute humidities individually for snow, soil, h2osfc for vegetated landunits - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - call QSat(t_soisno(c,snl(c)+1), forc_pbot(c), eg, degdT, qsatg, qsatgdT) - if (qsatg > forc_q(c) .and. forc_q(c) > qsatg) then - qsatg = forc_q(c) - qsatgdT = 0._r8 - end if - - qg_snow(c) = qsatg - dqgdT(c) = frac_sno(c)*qsatgdT - - call QSat(t_soisno(c,1) , forc_pbot(c), eg, degdT, qsatg, qsatgdT) - if (qsatg > forc_q(c) .and. forc_q(c) > hr*qsatg) then - qsatg = forc_q(c) - qsatgdT = 0._r8 - end if - qg_soil(c) = hr*qsatg - dqgdT(c) = dqgdT(c) + (1._r8 - frac_sno(c) - frac_h2osfc(c))*hr*qsatgdT - - ! to be consistent with hs_top values in SoilTemp, set qg_snow to qg_soil for snl = 0 case - ! this ensures hs_top_snow will equal hs_top_soil - if (snl(c) >= 0) then - qg_snow(c) = qg_soil(c) - dqgdT(c) = (1._r8 - frac_h2osfc(c))*hr*dqgdT(c) - endif - - call QSat(t_h2osfc(c), forc_pbot(c), eg, degdT, qsatg, qsatgdT) - if (qsatg > forc_q(c) .and. forc_q(c) > qsatg) then - qsatg = forc_q(c) - qsatgdT = 0._r8 - end if - qg_h2osfc(c) = qsatg - dqgdT(c) = dqgdT(c) + frac_h2osfc(c) * qsatgdT - - ! qg(c) = frac_sno(c)*qg_snow(c) + (1._r8 - frac_sno(c) - frac_h2osfc(c))*qg_soil(c) & - qg(c) = frac_sno_eff(c)*qg_snow(c) + (1._r8 - frac_sno_eff(c) - frac_h2osfc(c))*qg_soil(c) & - + frac_h2osfc(c) * qg_h2osfc(c) - - else - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg, qsatgdT) - qg(c) = qred*qsatg - dqgdT(c) = qred*qsatgdT - - if (qsatg > forc_q(c) .and. forc_q(c) > qred*qsatg) then - qg(c) = forc_q(c) - dqgdT(c) = 0._r8 - end if - - qg_snow(c) = qg(c) - qg_soil(c) = qg(c) - qg_h2osfc(c) = qg(c) - endif - - ! Ground emissivity - only calculate for non-urban landunits - ! Urban emissivities are currently read in from data file - - if (.not. urbpoi(l)) then - if (lun%itype(l)==istice_mec) then - emg(c) = 0.97_r8 - else - emg(c) = (1._r8-frac_sno(c))*0.96_r8 + frac_sno(c)*0.97_r8 - end if - end if - - ! Latent heat. We arbitrarily assume that the sublimation occurs - ! only as h2osoi_liq = 0 - - htvp(c) = hvap - if (h2osoi_liq(c,snl(c)+1) <= 0._r8 .and. h2osoi_ice(c,snl(c)+1) > 0._r8) htvp(c) = hsub - - ! Ground roughness lengths over non-lake columns (includes bare ground, ground - ! underneath canopy, wetlands, etc.) - - if (frac_sno(c) > 0._r8) then - z0mg(c) = zsno - else - z0mg(c) = zlnd - end if - z0hg(c) = z0mg(c) ! initial set only - z0qg(c) = z0mg(c) ! initial set only - - ! Potential, virtual potential temperature, and wind speed at the - ! reference height - - beta(c) = 1._r8 - zii(c) = 1000._r8 - thv(c) = forc_th(c)*(1._r8+0.61_r8*forc_q(c)) - - end do ! (end of columns loop) - - - ! Set roughness and displacement - ! Note that FATES passes back z0m and displa at the end - ! of its dynamics call. If and when crops are - ! enabled simultaneously with FATES, we will - ! have to apply a filter here. - if(use_fates) then - call clm_fates%TransferZ0mDisp(bounds,frictionvel_inst,canopystate_inst) - end if - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if( .not.(patch%is_fates(p))) then - z0m(p) = z0mr(patch%itype(p)) * htop(p) - displa(p) = displar(patch%itype(p)) * htop(p) - end if - end do - - ! Initialization - do fp = 1,num_nolakep - p = filter_nolakep(fp) - - ! Initial set (needed for history tape fields) - - eflx_sh_tot(p) = 0._r8 - l = patch%landunit(p) - if (urbpoi(l)) then - eflx_sh_tot_u(p) = 0._r8 - else if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - eflx_sh_tot_r(p) = 0._r8 - end if - eflx_lh_tot(p) = 0._r8 - if (urbpoi(l)) then - eflx_lh_tot_u(p) = 0._r8 - else if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - eflx_lh_tot_r(p) = 0._r8 - end if - eflx_sh_veg(p) = 0._r8 - qflx_evap_tot(p) = 0._r8 - qflx_evap_veg(p) = 0._r8 - qflx_tran_veg(p) = 0._r8 - - ! Initial set for calculation - - cgrnd(p) = 0._r8 - cgrnds(p) = 0._r8 - cgrndl(p) = 0._r8 - - ! Vegetation Emissivity - - avmuir = 1._r8 - emv(p) = 1._r8-exp(-(elai(p)+esai(p))/avmuir) - - ! Roughness lengths over vegetation - - z0mv(p) = z0m(p) - z0hv(p) = z0mv(p) - z0qv(p) = z0mv(p) - end do - - ! Make forcing height a patch-level quantity that is the atmospheric forcing - ! height plus each patch's z0m+displa - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - g = patch%gridcell(p) - l = patch%landunit(p) - c = patch%column(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (frac_veg_nosno(p) == 0) then - forc_hgt_u_patch(p) = forc_hgt_u(g) + z0mg(c) + displa(p) - forc_hgt_t_patch(p) = forc_hgt_t(g) + z0mg(c) + displa(p) - forc_hgt_q_patch(p) = forc_hgt_q(g) + z0mg(c) + displa(p) - else - forc_hgt_u_patch(p) = forc_hgt_u(g) + z0m(p) + displa(p) - forc_hgt_t_patch(p) = forc_hgt_t(g) + z0m(p) + displa(p) - forc_hgt_q_patch(p) = forc_hgt_q(g) + z0m(p) + displa(p) - end if - else if (lun%itype(l) == istwet .or. lun%itype(l) == istice_mec) then - forc_hgt_u_patch(p) = forc_hgt_u(g) + z0mg(c) - forc_hgt_t_patch(p) = forc_hgt_t(g) + z0mg(c) - forc_hgt_q_patch(p) = forc_hgt_q(g) + z0mg(c) - ! Appropriate momentum roughness length will be added in LakeFLuxesMod. - else if (lun%itype(l) == istdlak) then - forc_hgt_u_patch(p) = forc_hgt_u(g) - forc_hgt_t_patch(p) = forc_hgt_t(g) - forc_hgt_q_patch(p) = forc_hgt_q(g) - else if (urbpoi(l)) then - forc_hgt_u_patch(p) = forc_hgt_u(g) + z_0_town(l) + z_d_town(l) - forc_hgt_t_patch(p) = forc_hgt_t(g) + z_0_town(l) + z_d_town(l) - forc_hgt_q_patch(p) = forc_hgt_q(g) + z_0_town(l) + z_d_town(l) - end if - end if - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - - thm(p) = forc_t(c) + 0.0098_r8*forc_hgt_t_patch(p) - end do - - end associate - - end subroutine CanopyTemperature - -end module CanopyTemperatureMod diff --git a/src/biogeophys/DaylengthMod.F90 b/src/biogeophys/DaylengthMod.F90 deleted file mode 100644 index 546ecb1e4f..0000000000 --- a/src/biogeophys/DaylengthMod.F90 +++ /dev/null @@ -1,215 +0,0 @@ -module DaylengthMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Computes daylength - ! -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use GridcellType , only : grc - ! - implicit none - save - private - - ! TODO(wjs, 2018-05-16) We should make this object-oriented, and move max_dayl, dayl - ! and prev_dayl out of GridcellType into a new type defined here. Then can also move - ! the hist_addfld1d calls for DAYL and PREV_DAYL to here. - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: InitDaylength ! initialize daylength for all grid cells - public :: UpdateDaylength ! update daylength for all grid cells - - ! The following are public only to support unit testing, and shouldn't generally be - ! called from outside this module. - public :: daylength ! function to compute daylength - public :: ComputeMaxDaylength ! compute max daylength for each grid cell - ! - !----------------------------------------------------------------------- - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - elemental real(r8) function daylength(lat, decl) - ! - ! !DESCRIPTION: - ! Computes daylength (in seconds) - ! - ! Latitude and solar declination angle should both be specified in radians. decl must - ! be strictly less than pi/2; lat must be less than pi/2 within a small tolerance. - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, & - assignment(=) - use shr_const_mod , only : SHR_CONST_PI - ! - ! !ARGUMENTS: - real(r8), intent(in) :: lat ! latitude (radians) - real(r8), intent(in) :: decl ! solar declination angle (radians) - ! - ! !LOCAL VARIABLES: - real(r8) :: my_lat ! local version of lat, possibly adjusted slightly - real(r8) :: temp ! temporary variable - - ! number of seconds per radian of hour-angle - real(r8), parameter :: secs_per_radian = 13750.9871_r8 - - ! epsilon for defining latitudes "near" the pole - real(r8), parameter :: lat_epsilon = 10._r8 * epsilon(1._r8) - - ! Define an offset pole as slightly less than pi/2 to avoid problems with cos(lat) being negative - real(r8), parameter :: pole = SHR_CONST_PI/2.0_r8 - real(r8), parameter :: offset_pole = pole - lat_epsilon - !----------------------------------------------------------------------- - - ! Can't SHR_ASSERT in an elemental function; instead, return a bad value if any - ! preconditions are violated - - ! lat must be less than pi/2 within a small tolerance - if (abs(lat) >= (pole + lat_epsilon)) then - daylength = nan - - ! decl must be strictly less than pi/2 - else if (abs(decl) >= pole) then - daylength = nan - - ! normal case - else - ! Ensure that latitude isn't too close to pole, to avoid problems with cos(lat) being negative - my_lat = min(offset_pole, max(-1._r8 * offset_pole, lat)) - - temp = -(sin(my_lat)*sin(decl))/(cos(my_lat) * cos(decl)) - temp = min(1._r8,max(-1._r8,temp)) - daylength = 2.0_r8 * secs_per_radian * acos(temp) - end if - - end function daylength - - !----------------------------------------------------------------------- - subroutine ComputeMaxDaylength(bounds, lat, obliquity, max_daylength) - ! - ! !DESCRIPTION: - ! Compute max daylength for each grid cell - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: obliquity ! earth's obliquity (radians) - real(r8), intent(in) :: lat(bounds%begg: ) ! latitude (radians) - real(r8), intent(out) :: max_daylength(bounds%begg: ) ! maximum daylength for each gridcell (s) - ! - ! !LOCAL VARIABLES: - integer :: g - real(r8) :: max_decl ! max declination angle - - character(len=*), parameter :: subname = 'ComputeMaxDaylength' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(lat) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(max_daylength) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - do g = bounds%begg,bounds%endg - max_decl = obliquity - if (lat(g) < 0._r8) max_decl = -max_decl - max_daylength(g) = daylength(lat(g), max_decl) - end do - - end subroutine ComputeMaxDaylength - - !----------------------------------------------------------------------- - subroutine InitDaylength(bounds, declin, declinm1, obliquity) - ! - ! !DESCRIPTION: - ! Initialize daylength, previous daylength and max daylength for all grid cells. - ! - ! This should be called with declin set at the value for the first model time step, - ! and declinm1 at the value for the previous time step - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: declin ! solar declination angle for the first model time step (radians) - real(r8), intent(in) :: declinm1 ! solar declination angle for the previous time step (radians) - real(r8), intent(in) :: obliquity ! earth's obliquity (radians) - ! - !----------------------------------------------------------------------- - - associate(& - lat => grc%lat, & ! Input: [real(r8) (:)] latitude (radians) - dayl => grc%dayl, & ! Output: [real(r8) (:)] day length (s) - prev_dayl => grc%prev_dayl, & ! Output: [real(r8) (:)] day length from previous time step (s) - max_dayl => grc%max_dayl , & ! Output: [real(r8) (:)] maximum day length (s) - - begg => bounds%begg , & ! beginning grid cell index - endg => bounds%endg & ! ending grid cell index - ) - - prev_dayl(begg:endg) = daylength(lat(begg:endg), declinm1) - dayl(begg:endg) = daylength(lat(begg:endg), declin) - - call ComputeMaxDaylength(bounds, & - lat = lat(bounds%begg:bounds%endg), & - obliquity = obliquity, & - max_daylength = max_dayl(bounds%begg:bounds%endg)) - - end associate - - end subroutine InitDaylength - - - !----------------------------------------------------------------------- - subroutine UpdateDaylength(bounds, declin, obliquity) - ! - ! !DESCRIPTION: - ! Update daylength, previous daylength and max daylength for all grid cells. - ! - ! This should be called exactly once per time step. - ! - ! Assumes that InitDaylength has been called in initialization. This Update routine - ! should NOT be called in initialization. - ! - ! !USES: - use clm_time_manager, only : is_first_step_of_this_run_segment - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: declin ! solar declination angle (radians) - real(r8), intent(in) :: obliquity ! earth's obliquity (radians) - ! - !----------------------------------------------------------------------- - - associate(& - lat => grc%lat, & ! Input: [real(r8) (:)] latitude (radians) - dayl => grc%dayl, & ! InOut: [real(r8) (:)] day length (s) - prev_dayl => grc%prev_dayl, & ! Output: [real(r8) (:)] day length from previous time step (s) - max_dayl => grc%max_dayl , & ! Output: [real(r8) (:)] maximum day length (s) - - begg => bounds%begg , & ! beginning grid cell index - endg => bounds%endg & ! ending grid cell index - ) - - if (is_first_step_of_this_run_segment()) then - ! DO NOTHING - ! - ! In the first time step, we simply use dayl & prev_dayl that were set in - ! initialization. (We do NOT want to run the normal code in that case, because that - ! would incorrectly set prev_dayl to be the same as the current dayl in the first - ! time step, because of the way prev_dayl is initialized.) - else - prev_dayl(begg:endg) = dayl(begg:endg) - dayl(begg:endg) = daylength(lat(begg:endg), declin) - end if - - call ComputeMaxDaylength(bounds, & - lat = lat(bounds%begg:bounds%endg), & - obliquity = obliquity, & - max_daylength = max_dayl(bounds%begg:bounds%endg)) - - end associate - - end subroutine UpdateDaylength - -end module DaylengthMod diff --git a/src/biogeophys/EnergyFluxType.F90 b/src/biogeophys/EnergyFluxType.F90 deleted file mode 100644 index 0869e4136e..0000000000 --- a/src/biogeophys/EnergyFluxType.F90 +++ /dev/null @@ -1,1036 +0,0 @@ -module EnergyFluxType - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! Energy flux data structure - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : spval - use decompMod , only : bounds_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use AnnualFluxDribbler, only : annual_flux_dribbler_type, annual_flux_dribbler_gridcell - ! - implicit none - save - private - ! - type, public :: energyflux_type - - ! Fluxes - real(r8), pointer :: eflx_h2osfc_to_snow_col (:) ! col snow melt to h2osfc heat flux (W/m**2) - real(r8), pointer :: eflx_sh_grnd_patch (:) ! patch sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_veg_patch (:) ! patch sensible heat flux from leaves (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_snow_patch (:) ! patch sensible heat flux from snow (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_soil_patch (:) ! patch sensible heat flux from soil (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_h2osfc_patch (:) ! patch sensible heat flux from surface water (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_patch (:) ! patch total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_u_patch (:) ! patch urban total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_r_patch (:) ! patch rural total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_precip_conversion_col(:) ! col sensible heat flux from precipitation conversion (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_patch (:) ! patch total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_u_patch (:) ! patch urban total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_r_patch (:) ! patch rural total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vegt_patch (:) ! patch transpiration heat flux from veg (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vege_patch (:) ! patch evaporation heat flux from veg (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_grnd_patch (:) ! patch evaporation heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_soil_grnd_patch (:) ! patch soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_u_patch (:) ! patch urban soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_r_patch (:) ! patch rural soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_lwrad_net_patch (:) ! patch net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_r_patch (:) ! patch rural net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_u_patch (:) ! patch urban net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_out_patch (:) ! patch emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_out_r_patch (:) ! patch rural emitted infrared (longwave) rad (W/m**2) - real(r8), pointer :: eflx_lwrad_out_u_patch (:) ! patch urban emitted infrared (longwave) rad (W/m**2) - real(r8), pointer :: eflx_snomelt_col (:) ! col snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_r_col (:) ! col rural snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_u_col (:) ! col urban snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_gnet_patch (:) ! patch net heat flux into ground (W/m**2) - real(r8), pointer :: eflx_grnd_lake_patch (:) ! patch net heat flux into lake / snow surface, excluding light transmission (W/m**2) - real(r8), pointer :: eflx_dynbal_grc (:) ! grc dynamic land cover change conversion energy flux (W/m**2) - real(r8), pointer :: eflx_bot_col (:) ! col heat flux from beneath the soil or ice column (W/m**2) - real(r8), pointer :: eflx_fgr12_col (:) ! col ground heat flux between soil layers 1 and 2 (W/m**2) - real(r8), pointer :: eflx_fgr_col (:,:) ! col (rural) soil downward heat flux (W/m2) (1:nlevgrnd) (pos upward; usually eflx_bot >= 0) - real(r8), pointer :: eflx_building_heat_errsoi_col(:) ! col heat flux to interior surface of walls and roof for errsoi check (W m-2) - real(r8), pointer :: eflx_urban_ac_col (:) ! col urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat_col (:) ! col urban heating flux (W/m**2) - real(r8), pointer :: eflx_anthro_patch (:) ! patch total anthropogenic heat flux (W/m**2) - real(r8), pointer :: eflx_traffic_patch (:) ! patch traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat_patch (:) ! patch sensible heat flux from domestic heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_patch (:) ! patch sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_traffic_lun (:) ! lun traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat_lun (:) ! lun sensible heat flux from domestic heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_lun (:) ! lun sensible heat flux to be put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_building_lun (:) ! lun building heat flux from change in interior building air temperature (W/m**2) - real(r8), pointer :: eflx_urban_ac_lun (:) ! lun urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat_lun (:) ! lun urban heating flux (W/m**2) - - ! Derivatives of energy fluxes - real(r8), pointer :: dgnetdT_patch (:) ! patch derivative of net ground heat flux wrt soil temp (W/m**2 K) - real(r8), pointer :: netrad_patch (:) ! col net radiation (W/m**2) [+ = to sfc] - real(r8), pointer :: cgrnd_patch (:) ! col deriv. of soil energy flux wrt to soil temp [W/m2/k] - real(r8), pointer :: cgrndl_patch (:) ! col deriv. of soil latent heat flux wrt soil temp [W/m**2/k] - real(r8), pointer :: cgrnds_patch (:) ! col deriv. of soil sensible heat flux wrt soil temp [W/m2/k] - - ! Canopy radiation - real(r8), pointer :: dlrad_patch (:) ! col downward longwave radiation below the canopy [W/m2] - real(r8), pointer :: ulrad_patch (:) ! col upward longwave radiation above the canopy [W/m2] - - ! Wind Stress - real(r8), pointer :: taux_patch (:) ! patch wind (shear) stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy_patch (:) ! patch wind (shear) stress: n-s (kg/m/s**2) - - ! Conductance - real(r8), pointer :: canopy_cond_patch (:) ! patch tracer conductance for canopy [m/s] - - ! Transpiration - real(r8), pointer :: btran_patch (:) ! patch transpiration wetness factor (0 to 1) - real(r8), pointer :: btran_min_patch (:) ! patch daily minimum transpiration wetness factor (0 to 1) - real(r8), pointer :: btran_min_inst_patch (:) ! patch instantaneous daily minimum transpiration wetness factor (0 to 1) - real(r8), pointer :: bsun_patch (:) ! patch sunlit canopy transpiration wetness factor (0 to 1) - real(r8), pointer :: bsha_patch (:) ! patch shaded canopy transpiration wetness factor (0 to 1) - - ! Roots - real(r8), pointer :: btran2_patch (:) ! patch root zone soil wetness factor (0 to 1) - real(r8), pointer :: rresis_patch (:,:) ! patch root resistance by layer (0-1) (nlevgrnd) - - ! Latent heat - real(r8), pointer :: htvp_col (:) ! latent heat of vapor of water (or sublimation) [j/kg] - - ! Balance Checks - real(r8), pointer :: errsoi_patch (:) ! soil/lake energy conservation error (W/m**2) - real(r8), pointer :: errsoi_col (:) ! soil/lake energy conservation error (W/m**2) - real(r8), pointer :: errseb_patch (:) ! surface energy conservation error (W/m**2) - real(r8), pointer :: errseb_col (:) ! surface energy conservation error (W/m**2) - real(r8), pointer :: errsol_patch (:) ! solar radiation conservation error (W/m**2) - real(r8), pointer :: errsol_col (:) ! solar radiation conservation error (W/m**2) - real(r8), pointer :: errlon_patch (:) ! longwave radiation conservation error (W/m**2) - real(r8), pointer :: errlon_col (:) ! longwave radiation conservation error (W/m**2) - - ! Objects that help convert once-per-year dynamic land cover changes into fluxes - ! that are dribbled throughout the year - type(annual_flux_dribbler_type) :: eflx_dynbal_dribbler - - contains - - procedure, public :: Init ! Public initialization method - procedure, private :: InitAllocate ! initialize/allocate - procedure, private :: InitHistory ! setup history fields - procedure, private :: InitCold ! initialize for cold start - procedure, public :: Restart ! setup restart fields - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - - end type energyflux_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp ) - ! - ! !DESCRIPTION: - ! Allocate and initialize the data type and setup history, and initialize for cold-start. - ! !USES: - implicit none - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: t_grnd_col( bounds%begc: ) - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - logical , intent(in) :: is_prog_buildtemp ! If using prognostic building temp method - - SHR_ASSERT_ALL((ubound(t_grnd_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds, is_simple_buildtemp ) - call this%InitCold ( bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize and allocate data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - implicit none - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - allocate( this%eflx_h2osfc_to_snow_col (begc:endc)) ; this%eflx_h2osfc_to_snow_col (:) = nan - allocate( this%eflx_sh_snow_patch (begp:endp)) ; this%eflx_sh_snow_patch (:) = nan - allocate( this%eflx_sh_soil_patch (begp:endp)) ; this%eflx_sh_soil_patch (:) = nan - allocate( this%eflx_sh_h2osfc_patch (begp:endp)) ; this%eflx_sh_h2osfc_patch (:) = nan - allocate( this%eflx_sh_tot_patch (begp:endp)) ; this%eflx_sh_tot_patch (:) = nan - allocate( this%eflx_sh_tot_u_patch (begp:endp)) ; this%eflx_sh_tot_u_patch (:) = nan - allocate( this%eflx_sh_tot_r_patch (begp:endp)) ; this%eflx_sh_tot_r_patch (:) = nan - allocate( this%eflx_sh_grnd_patch (begp:endp)) ; this%eflx_sh_grnd_patch (:) = nan - allocate( this%eflx_sh_veg_patch (begp:endp)) ; this%eflx_sh_veg_patch (:) = nan - allocate( this%eflx_sh_precip_conversion_col(begc:endc)) ; this%eflx_sh_precip_conversion_col(:) = nan - allocate( this%eflx_lh_tot_u_patch (begp:endp)) ; this%eflx_lh_tot_u_patch (:) = nan - allocate( this%eflx_lh_tot_patch (begp:endp)) ; this%eflx_lh_tot_patch (:) = nan - allocate( this%eflx_lh_tot_r_patch (begp:endp)) ; this%eflx_lh_tot_r_patch (:) = nan - allocate( this%eflx_lh_grnd_patch (begp:endp)) ; this%eflx_lh_grnd_patch (:) = nan - allocate( this%eflx_lh_vege_patch (begp:endp)) ; this%eflx_lh_vege_patch (:) = nan - allocate( this%eflx_lh_vegt_patch (begp:endp)) ; this%eflx_lh_vegt_patch (:) = nan - allocate( this%eflx_soil_grnd_patch (begp:endp)) ; this%eflx_soil_grnd_patch (:) = nan - allocate( this%eflx_soil_grnd_u_patch (begp:endp)) ; this%eflx_soil_grnd_u_patch (:) = nan - allocate( this%eflx_soil_grnd_r_patch (begp:endp)) ; this%eflx_soil_grnd_r_patch (:) = nan - allocate( this%eflx_lwrad_net_patch (begp:endp)) ; this%eflx_lwrad_net_patch (:) = nan - allocate( this%eflx_lwrad_net_u_patch (begp:endp)) ; this%eflx_lwrad_net_u_patch (:) = nan - allocate( this%eflx_lwrad_net_r_patch (begp:endp)) ; this%eflx_lwrad_net_r_patch (:) = nan - allocate( this%eflx_lwrad_out_patch (begp:endp)) ; this%eflx_lwrad_out_patch (:) = nan - allocate( this%eflx_lwrad_out_u_patch (begp:endp)) ; this%eflx_lwrad_out_u_patch (:) = nan - allocate( this%eflx_lwrad_out_r_patch (begp:endp)) ; this%eflx_lwrad_out_r_patch (:) = nan - allocate( this%eflx_gnet_patch (begp:endp)) ; this%eflx_gnet_patch (:) = nan - allocate( this%eflx_grnd_lake_patch (begp:endp)) ; this%eflx_grnd_lake_patch (:) = nan - allocate( this%eflx_dynbal_grc (begg:endg)) ; this%eflx_dynbal_grc (:) = nan - allocate( this%eflx_bot_col (begc:endc)) ; this%eflx_bot_col (:) = nan - allocate( this%eflx_snomelt_col (begc:endc)) ; this%eflx_snomelt_col (:) = nan - allocate( this%eflx_snomelt_r_col (begc:endc)) ; this%eflx_snomelt_r_col (:) = nan - allocate( this%eflx_snomelt_u_col (begc:endc)) ; this%eflx_snomelt_u_col (:) = nan - allocate( this%eflx_fgr12_col (begc:endc)) ; this%eflx_fgr12_col (:) = nan - allocate( this%eflx_fgr_col (begc:endc, 1:nlevgrnd)) ; this%eflx_fgr_col (:,:) = nan - allocate( this%eflx_building_heat_errsoi_col (begc:endc)) ; this%eflx_building_heat_errsoi_col(:)= nan - allocate( this%eflx_urban_ac_col (begc:endc)) ; this%eflx_urban_ac_col (:) = nan - allocate( this%eflx_urban_heat_col (begc:endc)) ; this%eflx_urban_heat_col (:) = nan - allocate( this%eflx_wasteheat_patch (begp:endp)) ; this%eflx_wasteheat_patch (:) = nan - allocate( this%eflx_traffic_patch (begp:endp)) ; this%eflx_traffic_patch (:) = nan - allocate( this%eflx_heat_from_ac_patch (begp:endp)) ; this%eflx_heat_from_ac_patch (:) = nan - allocate( this%eflx_heat_from_ac_lun (begl:endl)) ; this%eflx_heat_from_ac_lun (:) = nan - allocate( this%eflx_building_lun (begl:endl)) ; this%eflx_building_lun (:) = nan - allocate( this%eflx_urban_ac_lun (begl:endl)) ; this%eflx_urban_ac_lun (:) = nan - allocate( this%eflx_urban_heat_lun (begl:endl)) ; this%eflx_urban_heat_lun (:) = nan - allocate( this%eflx_traffic_lun (begl:endl)) ; this%eflx_traffic_lun (:) = nan - allocate( this%eflx_wasteheat_lun (begl:endl)) ; this%eflx_wasteheat_lun (:) = nan - allocate( this%eflx_anthro_patch (begp:endp)) ; this%eflx_anthro_patch (:) = nan - - allocate( this%dgnetdT_patch (begp:endp)) ; this%dgnetdT_patch (:) = nan - allocate( this%cgrnd_patch (begp:endp)) ; this%cgrnd_patch (:) = nan - allocate( this%cgrndl_patch (begp:endp)) ; this%cgrndl_patch (:) = nan - allocate( this%cgrnds_patch (begp:endp)) ; this%cgrnds_patch (:) = nan - allocate( this%dlrad_patch (begp:endp)) ; this%dlrad_patch (:) = nan - allocate( this%ulrad_patch (begp:endp)) ; this%ulrad_patch (:) = nan - allocate( this%netrad_patch (begp:endp)) ; this%netrad_patch (:) = nan - - allocate( this%taux_patch (begp:endp)) ; this%taux_patch (:) = nan - allocate( this%tauy_patch (begp:endp)) ; this%tauy_patch (:) = nan - - allocate( this%canopy_cond_patch (begp:endp)) ; this%canopy_cond_patch (:) = nan - - allocate( this%htvp_col (begc:endc)) ; this%htvp_col (:) = nan - - allocate(this%rresis_patch (begp:endp,1:nlevgrnd)) ; this%rresis_patch (:,:) = nan - allocate(this%btran_patch (begp:endp)) ; this%btran_patch (:) = nan - allocate(this%btran_min_patch (begp:endp)) ; this%btran_min_patch (:) = nan - allocate(this%btran_min_inst_patch (begp:endp)) ; this%btran_min_inst_patch (:) = nan - allocate(this%btran2_patch (begp:endp)) ; this%btran2_patch (:) = nan - allocate( this%bsun_patch (begp:endp)) ; this%bsun_patch (:) = nan - allocate( this%bsha_patch (begp:endp)) ; this%bsha_patch (:) = nan - allocate( this%errsoi_patch (begp:endp)) ; this%errsoi_patch (:) = nan - allocate( this%errsoi_col (begc:endc)) ; this%errsoi_col (:) = nan - allocate( this%errseb_patch (begp:endp)) ; this%errseb_patch (:) = nan - allocate( this%errseb_col (begc:endc)) ; this%errseb_col (:) = nan - allocate( this%errsol_patch (begp:endp)) ; this%errsol_patch (:) = nan - allocate( this%errsol_col (begc:endc)) ; this%errsol_col (:) = nan - allocate( this%errlon_patch (begp:endp)) ; this%errlon_patch (:) = nan - allocate( this%errlon_col (begc:endc)) ; this%errlon_col (:) = nan - - this%eflx_dynbal_dribbler = annual_flux_dribbler_gridcell( & - bounds = bounds, & - name = 'eflx_dynbal', & - units = 'J/m**2') - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, is_simple_buildtemp) - ! - ! !DESCRIPTION: - ! Setup fields that can be output to history files - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd - use clm_varctl , only : use_cn, use_hydrstress - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - use ncdio_pio , only : ncd_inqvdlen - implicit none - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - integer :: dimlen - integer :: err_code - logical :: do_io - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - - this%eflx_dynbal_grc(begg:endg) = spval - call hist_addfld1d (fname='EFLX_DYNBAL', units='W/m^2', & - avgflag='A', long_name='dynamic land cover change conversion energy flux', & - ptr_lnd=this%eflx_dynbal_grc) - - this%eflx_snomelt_col(begc:endc) = spval - call hist_addfld1d (fname='FSM', units='W/m^2', & - avgflag='A', long_name='snow melt heat flux', & - ptr_col=this%eflx_snomelt_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSM_ICE', units='W/m^2', & - avgflag='A', long_name='snow melt heat flux (ice landunits only)', & - ptr_col=this%eflx_snomelt_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_snomelt_r_col(begc:endc) = spval - call hist_addfld1d (fname='FSM_R', units='W/m^2', & - avgflag='A', long_name='Rural snow melt heat flux', & - ptr_col=this%eflx_snomelt_r_col, set_spec=spval, default='inactive') - - this%eflx_snomelt_u_col(begc:endc) = spval - call hist_addfld1d (fname='FSM_U', units='W/m^2', & - avgflag='A', long_name='Urban snow melt heat flux', & - ptr_col=this%eflx_snomelt_u_col, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_lwrad_net_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRA', units='W/m^2', & - avgflag='A', long_name='net infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_net_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FIRA_ICE', units='W/m^2', & - avgflag='A', long_name='net infrared (longwave) radiation (ice landunits only)', & - ptr_patch=this%eflx_lwrad_net_patch, c2l_scale_type='urbanf', l2g_scale_type='ice',& - default='inactive') - - this%eflx_lwrad_net_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRA_R', units='W/m^2', & - avgflag='A', long_name='Rural net infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_net_r_patch, set_spec=spval) - - this%eflx_lwrad_out_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRE', units='W/m^2', & - avgflag='A', long_name='emitted infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_out_patch, c2l_scale_type='urbanf') - ! Rename of FIRE for Urban intercomparision project - call hist_addfld1d (fname='LWup', units='W/m^2', & - avgflag='A', long_name='upwelling longwave radiation', & - ptr_patch=this%eflx_lwrad_out_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FIRE_ICE', units='W/m^2', & - avgflag='A', long_name='emitted infrared (longwave) radiation (ice landunits only)', & - ptr_patch=this%eflx_lwrad_out_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_lwrad_out_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRE_R', units='W/m^2', & - avgflag='A', long_name='Rural emitted infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_out_r_patch, set_spec=spval) - - this%eflx_lh_vegt_patch(begp:endp) = spval - call hist_addfld1d (fname='FCTR', units='W/m^2', & - avgflag='A', long_name='canopy transpiration', & - ptr_patch=this%eflx_lh_vegt_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%eflx_lh_vege_patch(begp:endp) = spval - call hist_addfld1d (fname='FCEV', units='W/m^2', & - avgflag='A', long_name='canopy evaporation', & - ptr_patch=this%eflx_lh_vege_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%eflx_lh_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='FGEV', units='W/m^2', & - avgflag='A', long_name='ground evaporation', & - ptr_patch=this%eflx_lh_grnd_patch, c2l_scale_type='urbanf') - - this%eflx_sh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH', units='W/m^2', & - avgflag='A', long_name='sensible heat not including correction for land use change and rain/snow conversion', & - ptr_patch=this%eflx_sh_tot_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSH_ICE', units='W/m^2', & - avgflag='A', & - long_name='sensible heat not including correction for land use change and rain/snow conversion (ice landunits only)', & - ptr_patch=this%eflx_sh_tot_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_sh_tot_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_R', units='W/m^2', & - avgflag='A', long_name='Rural sensible heat', & - ptr_patch=this%eflx_sh_tot_r_patch, set_spec=spval) - - this%eflx_sh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='Qh', units='W/m^2', & - avgflag='A', long_name='sensible heat', & - ptr_patch=this%eflx_sh_tot_patch, c2l_scale_type='urbanf', & - default = 'inactive') - - this%eflx_lh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='Qle', units='W/m^2', & - avgflag='A', long_name='total evaporation', & - ptr_patch=this%eflx_lh_tot_patch, c2l_scale_type='urbanf', & - default = 'inactive') - - this%eflx_lh_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_LH_TOT', units='W/m^2', & - avgflag='A', long_name='total latent heat flux [+ to atm]', & - ptr_patch=this%eflx_lh_tot_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='EFLX_LH_TOT_ICE', units='W/m^2', & - avgflag='A', long_name='total latent heat flux [+ to atm] (ice landunits only)', & - ptr_patch=this%eflx_lh_tot_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_lh_tot_r_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_LH_TOT_R', units='W/m^2', & - avgflag='A', long_name='Rural total evaporation', & - ptr_patch=this%eflx_lh_tot_r_patch, set_spec=spval) - - this%eflx_soil_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='Qstor', units='W/m^2', & - avgflag='A', long_name='storage heat flux (includes snowmelt)', & - ptr_patch=this%eflx_soil_grnd_patch, c2l_scale_type='urbanf', & - default = 'inactive') - this%eflx_sh_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_V', units='W/m^2', & - avgflag='A', long_name='sensible heat from veg', & - ptr_patch=this%eflx_sh_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%eflx_sh_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_G', units='W/m^2', & - avgflag='A', long_name='sensible heat from ground', & - ptr_patch=this%eflx_sh_grnd_patch, c2l_scale_type='urbanf') - - this%eflx_soil_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='FGR', units='W/m^2', & - avgflag='A', long_name='heat flux into soil/snow including snow melt and lake / snow light transmission', & - ptr_patch=this%eflx_soil_grnd_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FGR_ICE', units='W/m^2', & - avgflag='A', & - long_name='heat flux into soil/snow including snow melt and lake / snow light transmission (ice landunits only)', & - ptr_patch=this%eflx_soil_grnd_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%eflx_soil_grnd_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FGR_R', units='W/m^2', & - avgflag='A', long_name='Rural heat flux into soil/snow including snow melt and snow light transmission', & - ptr_patch=this%eflx_soil_grnd_r_patch, set_spec=spval, default='inactive') - - this%eflx_lwrad_net_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRA_U', units='W/m^2', & - avgflag='A', long_name='Urban net infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_net_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_soil_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_SOIL_GRND', units='W/m^2', & - avgflag='A', long_name='soil heat flux [+ into soil]', & - ptr_patch=this%eflx_soil_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%eflx_lwrad_out_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FIRE_U', units='W/m^2', & - avgflag='A', long_name='Urban emitted infrared (longwave) radiation', & - ptr_patch=this%eflx_lwrad_out_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_sh_tot_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FSH_U', units='W/m^2', & - avgflag='A', long_name='Urban sensible heat', & - ptr_patch=this%eflx_sh_tot_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_sh_precip_conversion_col(begc:endc) = spval - call hist_addfld1d (fname = 'FSH_PRECIP_CONVERSION', units='W/m^2', & - avgflag='A', long_name='Sensible heat flux from conversion of rain/snow atm forcing', & - ptr_col=this%eflx_sh_precip_conversion_col, c2l_scale_type='urbanf') - - this%eflx_lh_tot_u_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_LH_TOT_U', units='W/m^2', & - avgflag='A', long_name='Urban total evaporation', & - ptr_patch=this%eflx_lh_tot_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%eflx_soil_grnd_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FGR_U', units='W/m^2', & - avgflag='A', long_name='Urban heat flux into soil/snow including snow melt', & - ptr_patch=this%eflx_soil_grnd_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%netrad_patch(begp:endp) = spval - call hist_addfld1d (fname='Rnet', units='W/m^2', & - avgflag='A', long_name='net radiation', & - ptr_patch=this%netrad_patch, c2l_scale_type='urbanf', & - default='inactive') - - if (use_cn) then - this%dlrad_patch(begp:endp) = spval - call hist_addfld1d (fname='DLRAD', units='W/m^2', & - avgflag='A', long_name='downward longwave radiation below the canopy', & - ptr_patch=this%dlrad_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%ulrad_patch(begp:endp) = spval - call hist_addfld1d (fname='ULRAD', units='W/m^2', & - avgflag='A', long_name='upward longwave radiation above the canopy', & - ptr_patch=this%ulrad_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%cgrnd_patch(begp:endp) = spval - call hist_addfld1d (fname='CGRND', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil energy flux wrt to soil temp', & - ptr_patch=this%cgrnd_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%cgrndl_patch(begp:endp) = spval - call hist_addfld1d (fname='CGRNDL', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil latent heat flux wrt soil temp', & - ptr_patch=this%cgrndl_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%cgrnds_patch(begp:endp) = spval - call hist_addfld1d (fname='CGRNDS', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil sensible heat flux wrt soil temp', & - ptr_patch=this%cgrnds_patch, default='inactive', c2l_scale_type='urbanf') - end if - - if (use_cn) then - this%eflx_gnet_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_GNET', units='W/m^2', & - avgflag='A', long_name='net heat flux into ground', & - ptr_patch=this%eflx_gnet_patch, default='inactive', c2l_scale_type='urbanf') - end if - - this%eflx_grnd_lake_patch(begp:endp) = spval - call hist_addfld1d (fname='EFLX_GRND_LAKE', units='W/m^2', & - avgflag='A', long_name='net heat flux into lake/snow surface, excluding light transmission', & - ptr_patch=this%eflx_grnd_lake_patch, set_nolake=spval) - - if ( is_simple_buildtemp )then - this%eflx_building_heat_errsoi_col(begc:endc) = spval - call hist_addfld1d (fname='BUILDHEAT', units='W/m^2', & - avgflag='A', long_name='heat flux from urban building interior to walls and roof', & - ptr_col=this%eflx_building_heat_errsoi_col, set_nourb=0._r8, c2l_scale_type='urbanf') - - this%eflx_urban_ac_col(begc:endc) = spval - call hist_addfld1d (fname='URBAN_AC', units='W/m^2', & - avgflag='A', long_name='urban air conditioning flux', & - ptr_col=this%eflx_urban_ac_col, set_nourb=0._r8, c2l_scale_type='urbanf') - - this%eflx_urban_heat_col(begc:endc) = spval - call hist_addfld1d (fname='URBAN_HEAT', units='W/m^2', & - avgflag='A', long_name='urban heating flux', & - ptr_col=this%eflx_urban_heat_col, set_nourb=0._r8, c2l_scale_type='urbanf') - else - this%eflx_urban_ac_lun(begl:endl) = spval - call hist_addfld1d (fname='EFLXBUILD', units='W/m^2', & - avgflag='A', long_name='building heat flux from change in interior building air temperature', & - ptr_lunit=this%eflx_building_lun, set_nourb=0._r8, l2g_scale_type='unity') - - this%eflx_urban_ac_lun(begl:endl) = spval - call hist_addfld1d (fname='URBAN_AC', units='W/m^2', & - avgflag='A', long_name='urban air conditioning flux', & - ptr_lunit=this%eflx_urban_ac_lun, set_nourb=0._r8, l2g_scale_type='unity') - - this%eflx_urban_heat_lun(begl:endl) = spval - call hist_addfld1d (fname='URBAN_HEAT', units='W/m^2', & - avgflag='A', long_name='urban heating flux', & - ptr_lunit=this%eflx_urban_heat_lun, set_nourb=0._r8, l2g_scale_type='unity') - end if - - - this%dgnetdT_patch(begp:endp) = spval - call hist_addfld1d (fname='DGNETDT', units='W/m^2/K', & - avgflag='A', long_name='derivative of net ground heat flux wrt soil temp', & - ptr_patch=this%dgnetdT_patch, default='inactive', c2l_scale_type='urbanf') - - this%eflx_fgr12_col(begc:endc) = spval - call hist_addfld1d (fname='FGR12', units='W/m^2', & - avgflag='A', long_name='heat flux between soil layers 1 and 2', & - ptr_col=this%eflx_fgr12_col, set_lake=spval) - - this%eflx_fgr_col(begc:endc,:) = spval - call hist_addfld2d (fname='FGR_SOIL_R', units='watt/m^2', type2d='levgrnd', & - avgflag='A', long_name='Rural downward heat flux at interface below each soil layer', & - ptr_col=this%eflx_fgr_col, set_spec=spval, default='inactive') - - this%eflx_traffic_patch(begp:endp) = spval - call hist_addfld1d (fname='TRAFFICFLUX', units='W/m^2', & - avgflag='A', long_name='sensible heat flux from urban traffic', & - ptr_patch=this%eflx_traffic_patch, set_nourb=0._r8, c2l_scale_type='urbanf', & - default='inactive') - - this%eflx_wasteheat_patch(begp:endp) = spval - call hist_addfld1d (fname='WASTEHEAT', units='W/m^2', & - avgflag='A', long_name='sensible heat flux from heating/cooling sources of urban waste heat', & - ptr_patch=this%eflx_wasteheat_patch, set_nourb=0._r8, c2l_scale_type='urbanf') - - this%eflx_heat_from_ac_patch(begp:endp) = spval - call hist_addfld1d (fname='HEAT_FROM_AC', units='W/m^2', & - avgflag='A', long_name='sensible heat flux put into canyon due to heat removed from air conditioning', & - ptr_patch=this%eflx_heat_from_ac_patch, set_nourb=0._r8, c2l_scale_type='urbanf') - - if ( is_simple_buildtemp )then - this%eflx_anthro_patch(begp:endp) = spval - call hist_addfld1d (fname='Qanth', units='W/m^2', & - avgflag='A', long_name='anthropogenic heat flux', & - ptr_patch=this%eflx_anthro_patch, set_nourb=0._r8, c2l_scale_type='urbanf', & - default='inactive') - end if - - this%taux_patch(begp:endp) = spval - call hist_addfld1d (fname='TAUX', units='kg/m/s^2', & - avgflag='A', long_name='zonal surface stress', & - ptr_patch=this%taux_patch) - ! Rename of TAUX for Urban intercomparision project (when U=V) - call hist_addfld1d (fname='Qtau', units='kg/m/s^2', & - avgflag='A', long_name='momentum flux', & - ptr_patch=this%taux_patch, default='inactive') - - this%tauy_patch(begp:endp) = spval - call hist_addfld1d (fname='TAUY', units='kg/m/s^2', & - avgflag='A', long_name='meridional surface stress', & - ptr_patch=this%tauy_patch) - - this%btran_patch(begp:endp) = spval - if (.not. use_hydrstress) then - call hist_addfld1d (fname='BTRAN', units='unitless', & - avgflag='A', long_name='transpiration beta factor', & - ptr_patch=this%btran_patch, set_lake=spval, set_urb=spval) - end if - - this%btran_min_patch(begp:endp) = spval - call hist_addfld1d (fname='BTRANMN', units='unitless', & - avgflag='A', long_name='daily minimum of transpiration beta factor', & - ptr_patch=this%btran_min_patch, set_lake=spval, set_urb=spval) - - this%btran2_patch(begp:endp) = spval - call hist_addfld1d (fname='BTRAN2', units='unitless', & - avgflag='A', long_name='root zone soil wetness factor', & - ptr_patch=this%btran2_patch, set_lake=spval, set_urb=spval) - - if (use_cn) then - this%rresis_patch(begp:endp,:) = spval - call hist_addfld2d (fname='RRESIS', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='root resistance in each soil layer', & - ptr_patch=this%rresis_patch, default='inactive') - end if - - this%errsoi_col(begc:endc) = spval - call hist_addfld1d (fname='ERRSOI', units='W/m^2', & - avgflag='A', long_name='soil/lake energy conservation error', & - ptr_col=this%errsoi_col) - - this%errseb_patch(begp:endp) = spval - call hist_addfld1d (fname='ERRSEB', units='W/m^2', & - avgflag='A', long_name='surface energy conservation error', & - ptr_patch=this%errseb_patch) - - this%errsol_patch(begp:endp) = spval - call hist_addfld1d (fname='ERRSOL', units='W/m^2', & - avgflag='A', long_name='solar radiation conservation error', & - ptr_patch=this%errsol_patch, set_urb=spval) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, t_grnd_col, is_simple_buildtemp, is_prog_buildtemp) - ! - ! !DESCRIPTION: - ! Initialize cold start conditions for module variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb - use clm_varcon , only : denice, denh2o, sb - use landunit_varcon , only : istwet, istsoil, istdlak - use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall - use column_varcon , only : icol_shadewall, icol_road_perv - use clm_varctl , only : iulog, use_vancouver, use_mexicocity - implicit none - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: t_grnd_col( bounds%begc: ) - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - logical , intent(in) :: is_prog_buildtemp ! If using prognostic building temp method - ! - ! !LOCAL VARIABLES: - integer :: j,l,c,p,levs,lev - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(t_grnd_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - ! Columns - if ( is_simple_buildtemp )then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%urbpoi(l)) then - this%eflx_building_heat_errsoi_col(c) = 0._r8 - this%eflx_urban_ac_col(c) = 0._r8 - this%eflx_urban_heat_col(c) = 0._r8 - else - this%eflx_building_heat_errsoi_col(c) = 0._r8 - this%eflx_urban_ac_col(c) = 0._r8 - this%eflx_urban_heat_col(c) = 0._r8 - end if - - end do - end if - - ! Patches - do p = bounds%begp, bounds%endp - c = patch%column(p) - l = patch%landunit(p) - - if (.not. lun%urbpoi(l)) then ! non-urban - this%eflx_lwrad_net_u_patch(p) = spval - this%eflx_lwrad_out_u_patch(p) = spval - this%eflx_lh_tot_u_patch(p) = spval - this%eflx_sh_tot_u_patch(p) = spval - this%eflx_soil_grnd_u_patch(p) = spval - end if - - this%eflx_lwrad_out_patch(p) = sb * (t_grnd_col(c))**4 - end do - - ! patches - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - - if (.not. lun%urbpoi(l)) then - this%eflx_traffic_lun(l) = spval - this%eflx_wasteheat_lun(l) = spval - if ( is_prog_buildtemp )then - this%eflx_building_lun(l) = 0._r8 - this%eflx_urban_ac_lun(l) = 0._r8 - this%eflx_urban_heat_lun(l) = 0._r8 - end if - - this%eflx_wasteheat_patch(p) = 0._r8 - this%eflx_heat_from_ac_patch(p) = 0._r8 - this%eflx_traffic_patch(p) = 0._r8 - if ( is_simple_buildtemp) & - this%eflx_anthro_patch(p) = 0._r8 - else - if ( is_prog_buildtemp )then - this%eflx_building_lun(l) = 0._r8 - this%eflx_urban_ac_lun(l) = 0._r8 - this%eflx_urban_heat_lun(l) = 0._r8 - end if - end if - end do - - ! initialize rresis, for use in ecosystemdyn - do p = bounds%begp,bounds%endp - do lev = 1,nlevgrnd - this%rresis_patch(p,lev) = 0._r8 - end do - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildtemp) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, & - ncd_inqvdlen - use restUtilMod - use decompMod , only : get_proc_global - implicit none - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - logical , intent(in) :: is_simple_buildtemp ! If using simple building temp method - logical , intent(in) :: is_prog_buildtemp ! If using prognostic building temp method - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - integer :: dimlen - integer :: err_code - integer :: numl_global - logical :: readvar ! determine if variable is on initial file - logical :: do_io - !----------------------------------------------------------------------- - - call get_proc_global(nl=numl_global) - call restartvar(ncid=ncid, flag=flag, varname='EFLX_LWRAD_OUT', xtype=ncd_double, & - dim1name='pft', & - long_name='emitted infrared (longwave) radiation', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_lwrad_out_patch) - - ! Restart for building air temperature method - if ( is_prog_buildtemp )then - ! landunit urban energy state variable - eflx_urban_ac - do_io = .true. - ! On a read, confirm that this variable has the expected size (landunit-level); if not, - ! don't read it (instead give it a default value). This is needed to support older initial - ! conditions for which this variable had a different size (column-level). - if (flag == 'read') then - call ncd_inqvdlen(ncid, 'URBAN_AC_L', 1, dimlen, err_code) - if (dimlen /= numl_global) then - do_io = .false. - readvar = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='URBAN_AC_L', xtype=ncd_double, & - dim1name='landunit',& - long_name='urban air conditioning flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_ac_lun) - else - this%eflx_urban_ac_lun = 0.0_r8 - end if - ! landunit urban energy state variable - eflx_urban_heat - do_io = .true. - ! On a read, confirm that this variable has the expected size (landunit-level); if not, - ! don't read it (instead give it a default value). This is needed to support older initial - ! conditions for which this variable had a different size (column-level). - if (flag == 'read') then - call ncd_inqvdlen(ncid, 'URBAN_HEAT_L', 1, dimlen, err_code) - if (dimlen /= numl_global) then - do_io = .false. - readvar = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='URBAN_HEAT_L', xtype=ncd_double, & - dim1name='landunit',& - long_name='urban heating flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_heat_lun) - else - this%eflx_urban_heat_lun = 0.0_r8 - end if - else if ( is_simple_buildtemp )then - call restartvar(ncid=ncid, flag=flag, varname='URBAN_AC', xtype=ncd_double, & - dim1name='column', & - long_name='urban air conditioning flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_ac_col) - call restartvar(ncid=ncid, flag=flag, varname='URBAN_HEAT', xtype=ncd_double, & - dim1name='column', & - long_name='urban heating flux', units='watt/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_urban_heat_col) - end if - - call restartvar(ncid=ncid, flag=flag, varname='btran2', xtype=ncd_double, & - dim1name='pft', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran2_patch) - - call restartvar(ncid=ncid, flag=flag, varname='BTRAN_MIN', xtype=ncd_double, & - dim1name='pft', & - long_name='daily minimum of transpiration wetness factor', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran_min_patch) - - call restartvar(ncid=ncid, flag=flag, varname='BTRAN_MIN_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily minimum of transpiration wetness factor', units='', & - interpinic_flag='interp', readvar=readvar, data=this%btran_min_inst_patch) - - call restartvar(ncid=ncid, flag=flag, varname='eflx_grnd_lake', xtype=ncd_double, & - dim1name='pft', & - long_name='net heat flux into lake/snow surface, excluding light transmission', units='W/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%eflx_grnd_lake_patch) - - call this%eflx_dynbal_dribbler%Restart(bounds, ncid, flag) - - end subroutine Restart - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateAccVars]. - ! Four types of accumulations are possible: - ! o average over time interval - ! o running mean over time interval - ! o running accumulation over time interval - ! Time average fields are only valid at the end of the averaging interval. - ! Running means are valid once the length of the simulation exceeds the - ! averaging interval. Accumulated fields are continuously accumulated. - ! The trigger value "-99999." resets the accumulation to zero. - ! - ! !USES - use accumulMod , only : init_accum_field - use clm_time_manager , only : get_step_size - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime - integer, parameter :: not_used = huge(1) - !--------------------------------------------------------------------- - - dtime = get_step_size() - - call init_accum_field(name='BTRANAV', units='-', & - desc='average over an hour of btran', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end subroutine InitAccBuffer - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : init_accum_field, extract_accum_field - use clm_time_manager , only : get_nstep - use clm_varctl , only : nsrest, nsrStartup - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Initialize variables that are to be time accumulated - ! Initialize btran min values - if (nsrest == nsrStartup) then - this%btran_min_patch(begp:endp) = spval - - this%btran_min_inst_patch(begp:endp) = spval - end if - - end subroutine InitAccVars - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - use clm_varctl , only : iulog - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(energyflux_type) :: this - type(bounds_type) , intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer :: m,g,l,c,p ! indices - integer :: ier ! error status - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - logical :: end_cd ! temporary for is_end_curr_day() value - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - pft level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Allocate needed dynamic memory for single level pft field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(__FILE__, __LINE__)) - endif - - ! Accumulate and extract BTRANAV - hourly average btran - ! Used to compute minimum of hourly averaged btran - ! over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('BTRANAV', this%btran_patch, nstep) - call extract_accum_field ('BTRANAV', rbufslp, nstep) - end_cd = is_end_curr_day() - do p = begp,endp - if (rbufslp(p) /= spval) then - this%btran_min_inst_patch(p) = min(rbufslp(p), this%btran_min_inst_patch(p)) - endif - if (end_cd) then - this%btran_min_patch(p) = this%btran_min_inst_patch(p) - this%btran_min_inst_patch(p) = spval - else if (secs == dtime) then - this%btran_min_patch(p) = spval - endif - end do - - deallocate(rbufslp) - - end subroutine UpdateAccVars - -end module EnergyFluxType diff --git a/src/biogeophys/FrictionVelocityMod.F90 b/src/biogeophys/FrictionVelocityMod.F90 deleted file mode 100644 index ce793aa9bc..0000000000 --- a/src/biogeophys/FrictionVelocityMod.F90 +++ /dev/null @@ -1,834 +0,0 @@ -module FrictionVelocityMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Calculation of the friction velocity, relation for potential - ! temperature and humidity profiles of surface boundary layer. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varcon , only : spval - use clm_varctl , only : use_cn, use_luna - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: FrictionVelReadNML ! Read in the namelist for settings and parameters - public :: FrictionVelocity ! Calculate friction velocity - public :: MoninObukIni ! Initialization of the Monin-Obukhov length - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: StabilityFunc1 ! Stability function for rib < 0. - private :: StabilityFunc2 ! Stability function for rib < 0. - - type, public :: frictionvel_type - - ! Roughness length/resistance for friction velocity calculation - - real(r8), pointer, public :: forc_hgt_u_patch (:) ! patch wind forcing height (10m+z0m+d) (m) - real(r8), pointer, public :: forc_hgt_t_patch (:) ! patch temperature forcing height (10m+z0m+d) (m) - real(r8), pointer, public :: forc_hgt_q_patch (:) ! patch specific humidity forcing height (10m+z0m+d) (m) - real(r8), pointer, public :: u10_patch (:) ! patch 10-m wind (m/s) (for dust model) - real(r8), pointer, public :: u10_clm_patch (:) ! patch 10-m wind (m/s) (for clm_map2gcell) - real(r8), pointer, public :: va_patch (:) ! patch atmospheric wind speed plus convective velocity (m/s) - real(r8), pointer, public :: vds_patch (:) ! patch deposition velocity term (m/s) (for dry dep SO4, NH4NO3) - real(r8), pointer, public :: fv_patch (:) ! patch friction velocity (m/s) (for dust model) - real(r8), pointer, public :: rb1_patch (:) ! patch aerodynamical resistance (s/m) (for dry deposition of chemical tracers) - real(r8), pointer, public :: rb10_patch (:) ! 10-day mean patch aerodynamical resistance (s/m) (for LUNA model) - real(r8), pointer, public :: ram1_patch (:) ! patch aerodynamical resistance (s/m) - real(r8), pointer, public :: z0m_patch (:) ! patch momentum roughness length (m) - real(r8), pointer, public :: z0mv_patch (:) ! patch roughness length over vegetation, momentum [m] - real(r8), pointer, public :: z0hv_patch (:) ! patch roughness length over vegetation, sensible heat [m] - real(r8), pointer, public :: z0qv_patch (:) ! patch roughness length over vegetation, latent heat [m] - real(r8), pointer, public :: z0mg_col (:) ! col roughness length over ground, momentum [m] - real(r8), pointer, public :: z0hg_col (:) ! col roughness length over ground, sensible heat [m] - real(r8), pointer, public :: z0qg_col (:) ! col roughness length over ground, latent heat [m] - - contains - - ! Public procedures - procedure, public :: Init - procedure, public :: Restart - - ! Private procedures - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type frictionvel_type - - type, public :: frictionvel_parms_type - real(r8) :: zetamaxstable ! Max value zeta ("height" used in Monin-Obukhov theory) can go to under stable conditions - end type frictionvel_parms_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------------ - - type(frictionvel_parms_type), public, protected :: frictionvel_parms_inst - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%forc_hgt_u_patch (begp:endp)) ; this%forc_hgt_u_patch (:) = nan - allocate(this%forc_hgt_t_patch (begp:endp)) ; this%forc_hgt_t_patch (:) = nan - allocate(this%forc_hgt_q_patch (begp:endp)) ; this%forc_hgt_q_patch (:) = nan - allocate(this%u10_patch (begp:endp)) ; this%u10_patch (:) = nan - allocate(this%u10_clm_patch (begp:endp)) ; this%u10_clm_patch (:) = nan - allocate(this%va_patch (begp:endp)) ; this%va_patch (:) = nan - allocate(this%vds_patch (begp:endp)) ; this%vds_patch (:) = nan - allocate(this%fv_patch (begp:endp)) ; this%fv_patch (:) = nan - allocate(this%rb1_patch (begp:endp)) ; this%rb1_patch (:) = nan - allocate(this%rb10_patch (begp:endp)) ; this%rb10_patch (:) = spval - allocate(this%ram1_patch (begp:endp)) ; this%ram1_patch (:) = nan - allocate(this%z0m_patch (begp:endp)) ; this%z0m_patch (:) = nan - allocate(this%z0mv_patch (begp:endp)) ; this%z0mv_patch (:) = nan - allocate(this%z0hv_patch (begp:endp)) ; this%z0hv_patch (:) = nan - allocate(this%z0qv_patch (begp:endp)) ; this%z0qv_patch (:) = nan - allocate(this%z0mg_col (begc:endc)) ; this%z0mg_col (:) = nan - allocate(this%z0qg_col (begc:endc)) ; this%z0qg_col (:) = nan - allocate(this%z0hg_col (begc:endc)) ; this%z0hg_col (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%z0mg_col(begc:endc) = spval - call hist_addfld1d (fname='Z0MG', units='m', & - avgflag='A', long_name='roughness length over ground, momentum', & - ptr_col=this%z0mg_col, default='inactive') - - this%z0hg_col(begc:endc) = spval - call hist_addfld1d (fname='Z0HG', units='m', & - avgflag='A', long_name='roughness length over ground, sensible heat', & - ptr_col=this%z0hg_col, default='inactive') - - this%z0qg_col(begc:endc) = spval - call hist_addfld1d (fname='Z0QG', units='m', & - avgflag='A', long_name='roughness length over ground, latent heat', & - ptr_col=this%z0qg_col, default='inactive') - - this%va_patch(begp:endp) = spval - call hist_addfld1d (fname='VA', units='m/s', & - avgflag='A', long_name='atmospheric wind speed plus convective velocity', & - ptr_patch=this%va_patch, default='inactive') - - this%u10_clm_patch(begp:endp) = spval - call hist_addfld1d (fname='U10', units='m/s', & - avgflag='A', long_name='10-m wind', & - ptr_patch=this%u10_clm_patch) - - call hist_addfld1d (fname='U10_ICE', units='m/s', & - avgflag='A', long_name='10-m wind (ice landunits only)', & - ptr_patch=this%u10_clm_patch, l2g_scale_type='ice', default='inactive') - - this%u10_patch(begp:endp) = spval - call hist_addfld1d (fname='U10_DUST', units='m/s', & - avgflag='A', long_name='10-m wind for dust model', & - ptr_patch=this%u10_patch) - - if (use_cn) then - this%ram1_patch(begp:endp) = spval - call hist_addfld1d (fname='RAM1', units='s/m', & - avgflag='A', long_name='aerodynamical resistance ', & - ptr_patch=this%ram1_patch, default='inactive') - end if - - if (use_cn) then - this%fv_patch(begp:endp) = spval - call hist_addfld1d (fname='FV', units='m/s', & - avgflag='A', long_name='friction velocity for dust model', & - ptr_patch=this%fv_patch, default='inactive') - end if - - if (use_cn) then - this%z0hv_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0HV', units='m', & - avgflag='A', long_name='roughness length over vegetation, sensible heat', & - ptr_patch=this%z0hv_patch, default='inactive') - end if - - if (use_cn) then - this%z0m_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0M', units='m', & - avgflag='A', long_name='momentum roughness length', & - ptr_patch=this%z0m_patch, default='inactive') - end if - - if (use_cn) then - this%z0mv_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0MV', units='m', & - avgflag='A', long_name='roughness length over vegetation, momentum', & - ptr_patch=this%z0mv_patch, default='inactive') - end if - - if (use_cn) then - this%z0qv_patch(begp:endp) = spval - call hist_addfld1d (fname='Z0QV', units='m', & - avgflag='A', long_name='roughness length over vegetation, latent heat', & - ptr_patch=this%z0qv_patch, default='inactive') - end if - - if (use_luna) then - call hist_addfld1d (fname='RB10', units='s/m', & - avgflag='A', long_name='10 day running mean boundary layer resistance', & - ptr_patch=this%rb10_patch, default='inactive') - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! Initialize module surface albedos to reasonable values - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p, c, l ! indices - !----------------------------------------------------------------------- - - ! Added 5/4/04, PET: initialize forc_hgt_u (gridcell-level), - ! since this is not initialized before first call to CNVegStructUpdate, - ! and it is required to set the upper bound for canopy top height. - ! Changed 3/21/08, KO: still needed but don't have sufficient information - ! to set this properly (e.g., patch-level displacement height and roughness - ! length). So leave at 30m. - - if (use_cn) then - do p = bounds%begp, bounds%endp - this%forc_hgt_u_patch(p) = 30._r8 - end do - end if - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%lakpoi(l)) then !lake - this%z0mg_col(c) = 0.0004_r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(frictionvel_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='Z0MG', xtype=ncd_double, & - dim1name='column', & - long_name='ground momentum roughness length', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%z0mg_col) - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='rb10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean boundary layer resistance at the pacth', units='s/m', & - interpinic_flag='interp', readvar=readvar, data=this%rb10_patch) - endif - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine FrictionVelReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for Friction Velocity - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'FrictionVelocityReadNML' - character(len=*), parameter :: nmlname = 'friction_velocity' - !----------------------------------------------------------------------- - real(r8) :: zetamaxstable - namelist /friction_velocity/ zetamaxstable - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - zetamaxstable = 0.5_r8 - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=friction_velocity, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (zetamaxstable, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=friction_velocity) - write(iulog,*) ' ' - end if - frictionvel_parms_inst%zetamaxstable = zetamaxstable - - end subroutine FrictionVelReadNML - - !------------------------------------------------------------------------------ - subroutine FrictionVelocity(lbn, ubn, fn, filtern, & - displa, z0m, z0h, z0q, & - obu, iter, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm, frictionvel_inst, landunit_index) - ! - ! !DESCRIPTION: - ! Calculation of the friction velocity, relation for potential - ! temperature and humidity profiles of surface boundary layer. - ! The scheme is based on the work of Zeng et al. (1998): - ! Intercomparison of bulk aerodynamic algorithms for the computation - ! of sea surface fluxes using TOGA CORE and TAO data. J. Climate, - ! Vol. 11, 2628-2644. - ! - ! !USES: - use clm_varcon, only : vkc - use clm_varctl, only : iulog - ! - ! !ARGUMENTS: - integer , intent(in) :: lbn, ubn ! pft/landunit array bounds - integer , intent(in) :: fn ! number of filtered pft/landunit elements - integer , intent(in) :: filtern(fn) ! pft/landunit filter - real(r8) , intent(in) :: displa ( lbn: ) ! displacement height (m) [lbn:ubn] - real(r8) , intent(in) :: z0m ( lbn: ) ! roughness length over vegetation, momentum [m] [lbn:ubn] - real(r8) , intent(in) :: z0h ( lbn: ) ! roughness length over vegetation, sensible heat [m] [lbn:ubn] - real(r8) , intent(in) :: z0q ( lbn: ) ! roughness length over vegetation, latent heat [m] [lbn:ubn] - real(r8) , intent(in) :: obu ( lbn: ) ! monin-obukhov length (m) [lbn:ubn] - integer , intent(in) :: iter ! iteration number - real(r8) , intent(in) :: ur ( lbn: ) ! wind speed at reference height [m/s] [lbn:ubn] - real(r8) , intent(in) :: um ( lbn: ) ! wind speed including the stablity effect [m/s] [lbn:ubn] - real(r8) , intent(out) :: ustar ( lbn: ) ! friction velocity [m/s] [lbn:ubn] - real(r8) , intent(out) :: temp1 ( lbn: ) ! relation for potential temperature profile [lbn:ubn] - real(r8) , intent(out) :: temp12m ( lbn: ) ! relation for potential temperature profile applied at 2-m [lbn:ubn] - real(r8) , intent(out) :: temp2 ( lbn: ) ! relation for specific humidity profile [lbn:ubn] - real(r8) , intent(out) :: temp22m ( lbn: ) ! relation for specific humidity profile applied at 2-m [lbn:ubn] - real(r8) , intent(inout) :: fm ( lbn: ) ! diagnose 10m wind (DUST only) [lbn:ubn] - type(frictionvel_type) , intent(inout) :: frictionvel_inst - logical , intent(in), optional :: landunit_index ! optional argument that defines landunit or pft level - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: zetam = 1.574_r8 ! transition point of flux-gradient relation (wind profile) - real(r8), parameter :: zetat = 0.465_r8 ! transition point of flux-gradient relation (temp. profile) - integer :: f ! pft/landunit filter index - integer :: n ! pft/landunit index - integer :: g ! gridcell index - integer :: pp ! pfti,pftf index - real(r8) :: zldis(lbn:ubn) ! reference height "minus" zero displacement heght [m] - real(r8) :: zeta(lbn:ubn) ! dimensionless height used in Monin-Obukhov theory - real(r8) :: tmp1,tmp2,tmp3,tmp4 ! Used to diagnose the 10 meter wind - real(r8) :: fmnew ! Used to diagnose the 10 meter wind - real(r8) :: fm10 ! Used to diagnose the 10 meter wind - real(r8) :: zeta10 ! Used to diagnose the 10 meter wind - real(r8) :: vds_tmp ! Temporary for dry deposition velocity - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(displa) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(z0m) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(z0h) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(z0q) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(obu) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ur) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(um) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ustar) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp1) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp12m) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp2) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(temp22m) == (/ubn/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fm) == (/ubn/)), errMsg(sourcefile, __LINE__)) - - associate( & - pfti => lun%patchi , & ! Input: [integer (:) ] beginning pfti index for landunit - pftf => lun%patchf , & ! Input: [integer (:) ] final pft index for landunit - - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at pft level [m] - forc_hgt_t_patch => frictionvel_inst%forc_hgt_t_patch , & ! Input: [real(r8) (:) ] observational height of temperature at pft level [m] - forc_hgt_q_patch => frictionvel_inst%forc_hgt_q_patch , & ! Input: [real(r8) (:) ] observational height of specific humidity at pft level [m] - vds => frictionvel_inst%vds_patch , & ! Output: [real(r8) (:) ] dry deposition velocity term (m/s) (for SO4 NH4NO3) - u10 => frictionvel_inst%u10_patch , & ! Output: [real(r8) (:) ] 10-m wind (m/s) (for dust model) - u10_clm => frictionvel_inst%u10_clm_patch , & ! Output: [real(r8) (:) ] 10-m wind (m/s) - va => frictionvel_inst%va_patch , & ! Output: [real(r8) (:) ] atmospheric wind speed plus convective velocity (m/s) - fv => frictionvel_inst%fv_patch & ! Output: [real(r8) (:) ] friction velocity (m/s) (for dust model) - ) - - ! Adjustment factors for unstable (moz < 0) or stable (moz > 0) conditions. - - do f = 1, fn - n = filtern(f) - if (present(landunit_index)) then - g = lun%gridcell(n) - else - g = patch%gridcell(n) - end if - - ! Wind profile - - if (present(landunit_index)) then - zldis(n) = forc_hgt_u_patch(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_u_patch(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetam) then - ustar(n) = vkc*um(n)/(log(-zetam*obu(n)/z0m(n))& - - StabilityFunc1(-zetam) & - + StabilityFunc1(z0m(n)/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) - else if (zeta(n) < 0._r8) then - ustar(n) = vkc*um(n)/(log(zldis(n)/z0m(n))& - - StabilityFunc1(zeta(n))& - + StabilityFunc1(z0m(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - ustar(n) = vkc*um(n)/(log(zldis(n)/z0m(n)) + 5._r8*zeta(n) -5._r8*z0m(n)/obu(n)) - else - ustar(n) = vkc*um(n)/(log(obu(n)/z0m(n))+5._r8-5._r8*z0m(n)/obu(n) & - +(5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - if (zeta(n) < 0._r8) then - vds_tmp = 2.e-3_r8*ustar(n) * ( 1._r8 + (300._r8/(-obu(n)))**0.666_r8) - else - vds_tmp = 2.e-3_r8*ustar(n) - endif - - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - vds(pp) = vds_tmp - end do - else - vds(n) = vds_tmp - end if - - ! Calculate a 10-m wind (10m + z0m + d) - ! For now, this will not be the same as the 10-m wind calculated for the dust - ! model because the CLM stability functions are used here, not the LSM stability - ! functions used in the dust model. We will eventually change the dust model to be - ! consistent with the following formulation. - ! Note that the 10-m wind calculated this way could actually be larger than the - ! atmospheric forcing wind because 1) this includes the convective velocity, 2) - ! this includes the 1 m/s minimum wind threshold - - ! If forcing height is less than or equal to 10m, then set 10-m wind to um - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - if (zldis(n)-z0m(n) <= 10._r8) then - u10_clm(pp) = um(n) - else - if (zeta(n) < -zetam) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(-zetam*obu(n)/(10._r8+z0m(n))) & - - StabilityFunc1(-zetam) & - + StabilityFunc1((10._r8+z0m(n))/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) ) - else if (zeta(n) < 0._r8) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - - StabilityFunc1(zeta(n)) & - + StabilityFunc1((10._r8+z0m(n))/obu(n))) ) - else if (zeta(n) <= 1._r8) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - + 5._r8*zeta(n) - 5._r8*(10._r8+z0m(n))/obu(n)) ) - else - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(obu(n)/(10._r8+z0m(n))) & - + 5._r8 - 5._r8*(10._r8+z0m(n))/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) ) - - end if - end if - va(pp) = um(n) - end do - else - if (zldis(n)-z0m(n) <= 10._r8) then - u10_clm(n) = um(n) - else - if (zeta(n) < -zetam) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(-zetam*obu(n)/(10._r8+z0m(n))) & - - StabilityFunc1(-zetam) & - + StabilityFunc1((10._r8+z0m(n))/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) ) - else if (zeta(n) < 0._r8) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - - StabilityFunc1(zeta(n)) & - + StabilityFunc1((10._r8+z0m(n))/obu(n))) ) - else if (zeta(n) <= 1._r8) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - + 5._r8*zeta(n) - 5._r8*(10._r8+z0m(n))/obu(n)) ) - else - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(obu(n)/(10._r8+z0m(n))) & - + 5._r8 - 5._r8*(10._r8+z0m(n))/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) ) - end if - end if - va(n) = um(n) - end if - - ! Temperature profile - - if (present(landunit_index)) then - zldis(n) = forc_hgt_t_patch(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_t_patch(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp1(n) = vkc/(log(-zetat*obu(n)/z0h(n))& - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0h(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp1(n) = vkc/(log(zldis(n)/z0h(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0h(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp1(n) = vkc/(log(zldis(n)/z0h(n)) + 5._r8*zeta(n) - 5._r8*z0h(n)/obu(n)) - else - temp1(n) = vkc/(log(obu(n)/z0h(n)) + 5._r8 - 5._r8*z0h(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - ! Humidity profile - - if (present(landunit_index)) then - if (forc_hgt_q_patch(pfti(n)) == forc_hgt_t_patch(pfti(n)) .and. z0q(n) == z0h(n)) then - temp2(n) = temp1(n) - else - zldis(n) = forc_hgt_q_patch(pfti(n))-displa(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp2(n) = vkc/(log(-zetat*obu(n)/z0q(n)) & - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp2(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - end if - else - if (forc_hgt_q_patch(n) == forc_hgt_t_patch(n) .and. z0q(n) == z0h(n)) then - temp2(n) = temp1(n) - else - zldis(n) = forc_hgt_q_patch(n)-displa(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp2(n) = vkc/(log(-zetat*obu(n)/z0q(n)) & - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp2(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - endif - endif - - ! Temperature profile applied at 2-m - - zldis(n) = 2.0_r8 + z0h(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp12m(n) = vkc/(log(-zetat*obu(n)/z0h(n))& - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0h(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp12m(n) = vkc/(log(zldis(n)/z0h(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0h(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp12m(n) = vkc/(log(zldis(n)/z0h(n)) + 5._r8*zeta(n) - 5._r8*z0h(n)/obu(n)) - else - temp12m(n) = vkc/(log(obu(n)/z0h(n)) + 5._r8 - 5._r8*z0h(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - ! Humidity profile applied at 2-m - - if (z0q(n) == z0h(n)) then - temp22m(n) = temp12m(n) - else - zldis(n) = 2.0_r8 + z0q(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp22m(n) = vkc/(log(-zetat*obu(n)/z0q(n)) - & - StabilityFunc2(-zetat) + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp22m(n) = vkc/(log(zldis(n)/z0q(n)) - & - StabilityFunc2(zeta(n))+StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp22m(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp22m(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - end if - - ! diagnose 10-m wind for dust model (dstmbl.F) - ! Notes from C. Zender's dst.F: - ! According to Bon96 p. 62, the displacement height d (here displa) is - ! 0.0 <= d <= 0.34 m in dust source regions (i.e., regions w/o trees). - ! Therefore d <= 0.034*z1 and may safely be neglected. - ! Code from LSM routine SurfaceTemperature was used to obtain u10 - - if (present(landunit_index)) then - zldis(n) = forc_hgt_u_patch(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_u_patch(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (min(zeta(n), 1._r8) < 0._r8) then - tmp1 = (1._r8 - 16._r8*min(zeta(n),1._r8))**0.25_r8 - tmp2 = log((1._r8+tmp1*tmp1)/2._r8) - tmp3 = log((1._r8+tmp1)/2._r8) - fmnew = 2._r8*tmp3 + tmp2 - 2._r8*atan(tmp1) + 1.5707963_r8 - else - fmnew = -5._r8*min(zeta(n),1._r8) - endif - if (iter == 1) then - fm(n) = fmnew - else - fm(n) = 0.5_r8 * (fm(n)+fmnew) - end if - zeta10 = min(10._r8/obu(n), 1._r8) - if (zeta(n) == 0._r8) zeta10 = 0._r8 - if (zeta10 < 0._r8) then - tmp1 = (1.0_r8 - 16.0_r8 * zeta10)**0.25_r8 - tmp2 = log((1.0_r8 + tmp1*tmp1)/2.0_r8) - tmp3 = log((1.0_r8 + tmp1)/2.0_r8) - fm10 = 2.0_r8*tmp3 + tmp2 - 2.0_r8*atan(tmp1) + 1.5707963_r8 - else ! not stable - fm10 = -5.0_r8 * zeta10 - end if - if (present(landunit_index)) then - tmp4 = log( max( 1.0_r8, forc_hgt_u_patch(pfti(n)) / 10._r8) ) - else - tmp4 = log( max( 1.0_r8, forc_hgt_u_patch(n) / 10._r8) ) - end if - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - u10(pp) = ur(n) - ustar(n)/vkc * (tmp4 - fm(n) + fm10) - fv(pp) = ustar(n) - end do - else - u10(n) = ur(n) - ustar(n)/vkc * (tmp4 - fm(n) + fm10) - fv(n) = ustar(n) - end if - - end do - - end associate - end subroutine FrictionVelocity - - !------------------------------------------------------------------------------ - real(r8) function StabilityFunc1(zeta) - ! - ! !DESCRIPTION: - ! Stability function for rib < 0. - ! - ! !USES: - use shr_const_mod, only: SHR_CONST_PI - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: zeta ! dimensionless height used in Monin-Obukhov theory - ! - ! !LOCAL VARIABLES: - real(r8) :: chik, chik2 - !------------------------------------------------------------------------------ - - chik2 = sqrt(1._r8-16._r8*zeta) - chik = sqrt(chik2) - StabilityFunc1 = 2._r8*log((1._r8+chik)*0.5_r8) & - + log((1._r8+chik2)*0.5_r8)-2._r8*atan(chik)+SHR_CONST_PI*0.5_r8 - - end function StabilityFunc1 - - !------------------------------------------------------------------------------ - real(r8) function StabilityFunc2(zeta) - ! - ! !DESCRIPTION: - ! Stability function for rib < 0. - ! - ! !USES: - use shr_const_mod, only: SHR_CONST_PI - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: zeta ! dimensionless height used in Monin-Obukhov theory - ! - ! !LOCAL VARIABLES: - real(r8) :: chik2 - !------------------------------------------------------------------------------ - - chik2 = sqrt(1._r8-16._r8*zeta) - StabilityFunc2 = 2._r8*log((1._r8+chik2)*0.5_r8) - - end function StabilityFunc2 - - !----------------------------------------------------------------------- - subroutine MoninObukIni (ur, thv, dthv, zldis, z0m, um, obu) - ! - ! !DESCRIPTION: - ! Initialization of the Monin-Obukhov length. - ! The scheme is based on the work of Zeng et al. (1998): - ! Intercomparison of bulk aerodynamic algorithms for the computation - ! of sea surface fluxes using TOGA CORE and TAO data. J. Climate, - ! Vol. 11, 2628-2644. - ! - ! !USES: - use clm_varcon, only : grav - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: ur ! wind speed at reference height [m/s] - real(r8), intent(in) :: thv ! virtual potential temperature (kelvin) - real(r8), intent(in) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8), intent(in) :: zldis ! reference height "minus" zero displacement heght [m] - real(r8), intent(in) :: z0m ! roughness length, momentum [m] - real(r8), intent(out) :: um ! wind speed including the stability effect [m/s] - real(r8), intent(out) :: obu ! monin-obukhov length (m) - ! - ! !LOCAL VARIABLES: - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: rib ! bulk Richardson number - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: ustar ! friction velocity [m/s] - !----------------------------------------------------------------------- - - ! Initial values of u* and convective velocity - - ustar=0.06_r8 - wc=0.5_r8 - if (dthv >= 0._r8) then - um=max(ur,0.1_r8) - else - um=sqrt(ur*ur+wc*wc) - endif - - rib=grav*zldis*dthv/(thv*um*um) - - if (rib >= 0._r8) then ! neutral or stable - zeta = rib*log(zldis/z0m)/(1._r8-5._r8*min(rib,0.19_r8)) - zeta = min(frictionvel_parms_inst%zetamaxstable,max(zeta,0.01_r8 )) - else ! unstable - zeta=rib*log(zldis/z0m) - zeta = max(-100._r8,min(zeta,-0.01_r8 )) - endif - - obu=zldis/zeta - - end subroutine MoninObukIni - -end module FrictionVelocityMod diff --git a/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 b/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 deleted file mode 100644 index 22cf2a3a56..0000000000 --- a/src/biogeophys/GlacierSurfaceMassBalanceMod.F90 +++ /dev/null @@ -1,452 +0,0 @@ -module GlacierSurfaceMassBalanceMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Computes fluxes that are specific to glaciers - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varcon , only : spval, secspday - use clm_varpar , only : nlevgrnd - use clm_varctl , only : glc_snow_persistence_max_days - use clm_time_manager, only : get_step_size - use landunit_varcon, only : istice_mec - use ColumnType , only : col - use LandunitType , only : lun - use glc2lndMod , only : glc2lnd_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - - ! !PUBLIC TYPES: - implicit none - private - save - - type, public :: glacier_smb_type - private - - ! ------------------------------------------------------------------------ - ! Public data - ! ------------------------------------------------------------------------ - - real(r8), pointer, public :: qflx_glcice_col(:) ! col net flux of new glacial ice (growth - melt) (mm H2O/s), passed to GLC; only valid inside the do_smb_c filter - real(r8), pointer, public :: qflx_glcice_dyn_water_flux_col(:) ! col water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system); valid for all columns - - ! ------------------------------------------------------------------------ - ! Private data - ! ------------------------------------------------------------------------ - - real(r8), pointer :: qflx_glcice_frz_col (:) ! col ice growth (positive definite) (mm H2O/s); only valid inside the do_smb_c filter - real(r8), pointer :: qflx_glcice_melt_col(:) ! col ice melt (positive definite) (mm H2O/s); only valid inside the do_smb_c filter - - contains - - ! ------------------------------------------------------------------------ - ! Public routines - ! ------------------------------------------------------------------------ - - procedure, public :: Init - - ! The science routines need to be separated into a few pieces so they can be - ! sequenced properly based on what variables they depend on, and what they affect - procedure, public :: HandleIceMelt ! compute ice melt in glacier columns, and convert liquid back to ice - procedure, public :: ComputeSurfaceMassBalance ! compute fluxes other than ice melt - procedure, public :: AdjustRunoffTerms ! adjust liquid and ice runoff fluxes due to glacier fluxes - - ! ------------------------------------------------------------------------ - ! Private routines - ! ------------------------------------------------------------------------ - - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type glacier_smb_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Infrastructure routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - - integer :: begc, endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - allocate(this%qflx_glcice_col (begc:endc)) ; this%qflx_glcice_col (:) = nan - allocate(this%qflx_glcice_dyn_water_flux_col(begc:endc)) ; this%qflx_glcice_dyn_water_flux_col (:) = nan - allocate(this%qflx_glcice_frz_col (begc:endc)) ; this%qflx_glcice_frz_col (:) = nan - allocate(this%qflx_glcice_melt_col (begc:endc)) ; this%qflx_glcice_melt_col (:) = nan - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - this%qflx_glcice_col(begc:endc) = spval - call hist_addfld1d (fname='QICE', units='mm/s', & - avgflag='A', long_name='ice growth/melt', & - ptr_col=this%qflx_glcice_col, l2g_scale_type='ice') - - this%qflx_glcice_frz_col(begc:endc) = spval - call hist_addfld1d (fname='QICE_FRZ', units='mm/s', & - avgflag='A', long_name='ice growth', & - ptr_col=this%qflx_glcice_frz_col, l2g_scale_type='ice') - - this%qflx_glcice_melt_col(begc:endc) = spval - call hist_addfld1d (fname='QICE_MELT', units='mm/s', & - avgflag='A', long_name='ice melt', & - ptr_col=this%qflx_glcice_melt_col, l2g_scale_type='ice') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - - integer :: c - !----------------------------------------------------------------------- - - ! Initialize qflx_glcice_dyn_water_flux_col to 0 for all columns because we want this - ! flux to remain 0 for columns where is is never set, including non-glacier columns. - ! - ! Other fluxes intentionally remain unset (spval) outside the do_smb filter, so that - ! they are flagged as missing value outside that filter. - do c = bounds%begc, bounds%endc - this%qflx_glcice_dyn_water_flux_col(c) = 0._r8 - end do - - end subroutine InitCold - - ! ======================================================================== - ! Science routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine HandleIceMelt(this, bounds, num_do_smb_c, filter_do_smb_c, & - waterstate_inst) - ! - ! !DESCRIPTION: - ! Compute ice melt in glacier columns, and convert liquid back to ice - ! - ! Ideally this should be called immediately after ice is melted, so that liquid is - ! converted back to ice as soon as possible. - ! - ! NOTE(wjs, 2016-06-29) Currently this is separated from the main ComputeSurfaceMassBalance - ! routine so that it can be called from the same place in the driver loop where it was - ! done before the introduction of GlacierSurfaceMassBalanceMod. This was needed to maintain - ! identical answers, due to the adjustment of h2osoi_ice and h2osoi_liq in this - ! routine. In principle we should be able to do these adjustments of h2osoi_ice and - ! h2osoi_liq later in the driver loop: this would just mean that some intervening - ! science code is operating on the temporarily-thawed state, before the water runs off - ! and is replaced by ice from below. The main reason to make this change would be to - ! simplify the driver logic, consolidating calls to this module. On the other hand, - ! having a period when there is liquid water at the top of the glacier column could - ! defeat some of the purpose of converting it immediately back to ice (i.e., so that - ! the surface fluxes are always generated based on an ice-covered surface) - so it - ! may be best to keep this separate. - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_do_smb_c ! number of column points in filter_do_smb_c - integer, intent(in) :: filter_do_smb_c(:) ! column filter for points where SMB is calculated - type(waterstate_type), intent(inout) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: j - integer :: fc, c, l - real(r8) :: dtime ! land model time step (sec) - - character(len=*), parameter :: subname = 'HandleIceMelt' - !----------------------------------------------------------------------- - - associate( & - qflx_glcice_melt => this%qflx_glcice_melt_col , & ! Output: [real(r8) (:) ] ice melt (positive definite) (mm H2O/s) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - ) - - dtime = get_step_size() - - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - qflx_glcice_melt(c) = 0._r8 - end do - - ! Note that, because the following code only operates over the do_smb filter, that - ! means that the conversion of water back to ice only happens for glacier columns - ! where we're computing SMB. - - do j = 1, nlevgrnd - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - l = col%landunit(c) - - if (lun%itype(l) == istice_mec) then - if (h2osoi_liq(c,j) > 0._r8) then ! ice layer with meltwater - qflx_glcice_melt(c) = qflx_glcice_melt(c) + h2osoi_liq(c,j)/dtime - - ! convert layer back to pure ice by "borrowing" ice from below the column - h2osoi_ice(c,j) = h2osoi_ice(c,j) + h2osoi_liq(c,j) - h2osoi_liq(c,j) = 0._r8 - end if ! liquid water is present - end if ! istice_mec - end do - end do - - end associate - - end subroutine HandleIceMelt - - !----------------------------------------------------------------------- - subroutine ComputeSurfaceMassBalance(this, bounds, num_allc, filter_allc, & - num_do_smb_c, filter_do_smb_c, glc2lnd_inst, waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Compute glacier fluxes other than ice melt. - ! - ! This sets the public fields qflx_glcice_col and qflx_glcice_dyn_water_flux_col to - ! their final values. - ! - ! Should be called after HandleIceMelt, and after waterflux_inst%qflx_snwcp_ice_col is - ! computed - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_allc ! number of column points in filter_allc - integer, intent(in) :: filter_allc(:) ! column filter for all points - integer, intent(in) :: num_do_smb_c ! number of column points in filter_do_smb_c - integer, intent(in) :: filter_do_smb_c(:) ! column filter for points where SMB is calculated - type(glc2lnd_type), intent(in) :: glc2lnd_inst - type(waterstate_type), intent(in) :: waterstate_inst - type(waterflux_type), intent(in) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fc, c, l, g - - character(len=*), parameter :: subname = 'ComputeSurfaceMassBalance' - !----------------------------------------------------------------------- - - associate( & - qflx_glcice => this%qflx_glcice_col , & ! Output: [real(r8) (:)] net flux of new glacial ice (growth - melt) (mm H2O/s) - qflx_glcice_frz => this%qflx_glcice_frz_col , & ! Output: [real(r8) (:)] ice growth (positive definite) (mm H2O/s) - qflx_glcice_dyn_water_flux => this%qflx_glcice_dyn_water_flux_col , & ! Output: [real(r8) (:)] water flux needed for balance check due to glc_dyn_runoff_routing (mm H2O/s) (positive means addition of water to the system) - qflx_glcice_melt => this%qflx_glcice_melt_col , & ! Input: [real(r8) (:)] ice melt (positive definite) (mm H2O/s) - glc_dyn_runoff_routing => glc2lnd_inst%glc_dyn_runoff_routing_grc , & ! Input: [real(r8) (:)] whether we're doing runoff routing appropriate for having a dynamic icesheet - snow_persistence => waterstate_inst%snow_persistence_col , & ! Input: [real(r8) (:)] counter for length of time snow-covered - qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col & ! Input: [real(r8) (:)] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+] - ) - - ! NOTE(wjs, 2016-06-29) The following initialization is done in case the columns - ! included / excluded in the do_smb_c filter can change mid-run (besides just being - ! active vs. inactive): If an active column was inside this filter in the previous - ! timestep, but is no longer inside this filter in this timestep, we want this flux to - ! be 0 (rather than remaining at its previous value). (Currently, the set of active - ! columns included in the do_smb filter cannot change mid-run, but the logic is - ! complex enough that I don't want to assume that that will always remain true.) This - ! initialization also handles the case where glc_dyn_runoff_routing may change - ! mid-run, so that a point previously inside that mask no longer is. - do fc = 1, num_allc - c = filter_allc(fc) - qflx_glcice_dyn_water_flux(c) = 0._r8 - end do - - - ! Calculate positive surface mass balance to ice sheets, both from already-glaciated - ! landunits and from non-glaciated landunits (glacial inception) - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - l = col%landunit(c) - g = col%gridcell(c) - ! In the following, we convert glc_snow_persistence_max_days to r8 to avoid overflow - if ( (snow_persistence(c) >= (real(glc_snow_persistence_max_days, r8) * secspday)) & - .or. lun%itype(l) == istice_mec) then - qflx_glcice_frz(c) = qflx_snwcp_ice(c) - else - qflx_glcice_frz(c) = 0._r8 - end if - - qflx_glcice(c) = qflx_glcice_frz(c) - qflx_glcice_melt(c) - - ! For glc_dyn_runoff_routing > 0:: - ! (1) All or part of the excess snow (from snow capping) has been incorporated in - ! qflx_glcice_frz. This flux must be included here to complete the water - ! balance, because it is a sink of water as far as CLM is concerned (this water - ! will now be owned by CISM). - ! (2) Meltwater from ice (qflx_glcice_melt) is allowed to run off and is included - ! in qflx_qrgwl, but the water content of the ice column has not changed - ! because an equivalent ice mass has been "borrowed" from the base of the - ! column. So this borrowing is a source of water as far as CLM is concerned. - ! - ! For glc_dyn_runoff_routing = 0: Point (2) is the same as for the - ! glc_dyn_runoff_routing > 0 case: there is a source of water equal to - ! qflx_glcice_melt. However, in this case, the sink of water is also equal to - ! qflx_glcice_melt: We have simply replaced some liquid water with an equal amount - ! of solid ice. Another way to think about this is: - ! (1) qflx_ice_runoff_snwcp is reduced by an amount equal to qflx_glcice_melt (done - ! elsewhere in this module). The amount of snow removal is therefore given by - ! (qflx_ice_runoff_snwcp + qflx_glcice_melt), meaning that there is an - ! additional sink of water equal to qflx_glcice_melt. - ! (2) Meltwater from ice (qflx_glcice_melt) is allowed to run off and is included - ! in qflx_qrgwl, but the water content of the ice column has not changed - ! because an equivalent ice mass has been "borrowed" from the base of the - ! column. So this borrowing is a source of water as far as CLM is concerned. - ! These two corrections cancel out, so nothing is done here. - qflx_glcice_dyn_water_flux(c) = glc_dyn_runoff_routing(g) * (qflx_glcice_melt(c) - qflx_glcice_frz(c)) - end do - - end associate - - end subroutine ComputeSurfaceMassBalance - - !----------------------------------------------------------------------- - subroutine AdjustRunoffTerms(this, bounds, num_do_smb_c, filter_do_smb_c, & - glc2lnd_inst, qflx_qrgwl, qflx_ice_runoff_snwcp) - ! - ! !DESCRIPTION: - ! Adjust liquid and ice runoff fluxes due to glacier fluxes - ! - ! Should be called after ComputeSurfaceMassBalance, and after qflx_qrgwl and - ! qflx_ice_runoff_snwcp have been given their initial values - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glacier_smb_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_do_smb_c ! number of column points in filter_do_smb_c - integer, intent(in) :: filter_do_smb_c(:) ! column filter for points where SMB is calculated - type(glc2lnd_type), intent(in) :: glc2lnd_inst - real(r8), intent(inout) :: qflx_qrgwl( bounds%begc: ) ! col qflx_surf at glaciers, wetlands, lakes - real(r8), intent(inout) :: qflx_ice_runoff_snwcp( bounds%begc: ) ! col solid runoff from snow capping (mm H2O /s) - ! - ! !LOCAL VARIABLES: - integer :: fc, c, g - - character(len=*), parameter :: subname = 'AdjustRunoffTerms' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(qflx_qrgwl) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(qflx_ice_runoff_snwcp) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - qflx_glcice_frz => this%qflx_glcice_frz_col , & ! Input: [real(r8) (:)] ice growth (positive definite) (mm H2O/s) - qflx_glcice_melt => this%qflx_glcice_melt_col , & ! Input: [real(r8) (:)] ice melt (positive definite) (mm H2O/s) - glc_dyn_runoff_routing => glc2lnd_inst%glc_dyn_runoff_routing_grc & ! Input: [real(r8) (:)] gridcell fraction coupled to dynamic ice sheet - ) - - ! Note that, because the following code only operates over the do_smb filter, that - ! means that the adjustments here are only applied for glacier columns where we're - ! computing SMB. This is consistent with the use of the do_smb filter in - ! HandleIceMelt. - - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - g = col%gridcell(c) - - ! Melt is only generated for glacier columns. But it doesn't hurt to do this for - ! all columns in the do_smb filter: this melt term will be 0 for other columns. - ! Note: Ice melt is added to the runoff whether or not the column is coupled - ! to a dynamic glacier model. - - qflx_qrgwl(c) = qflx_qrgwl(c) + qflx_glcice_melt(c) - - ! For the part of the column that is coupled to a dynamic glacier model, - ! the glacier model handles the fate of capped snow, so we do not want it sent to runoff. - qflx_ice_runoff_snwcp(c) = qflx_ice_runoff_snwcp(c) - glc_dyn_runoff_routing(g)*qflx_glcice_frz(c) - - ! In places where we are not coupled to a dynamic glacier model, CLM sends all of - ! the snow capping to the ocean as an ice runoff term. (This is essentially a crude - ! parameterization of calving, assuming steady state - i.e., all ice gain is - ! balanced by an ice loss.) But each unit of melt that happens is an indication - ! that 1 unit of the ice shouldn't have made it to the ocean - but instead melted - ! before it got there. So we need to correct for that by removing 1 unit of ice - ! runoff for each unit of melt. Note that, for a given point in space & time, this - ! can result in negative ice runoff. However, we expect that, in a temporally and - ! spatially-integrated sense (if we're near equilibrium), this will just serve to - ! decrease the too-high positive ice runoff. - ! - ! Another way to think about this is: ice melt removes mass; the snow capping flux - ! also removes mass. If both the accumulation and melt remove mass, there is a - ! double-counting. So we need to correct that by: for each unit of ice melt - ! (resulting in 1 unit of liquid runoff), remove 1 unit of ice runoff. (This is not - ! an issue for parts of the column coupled to the dynamic glacier model, because - ! then the snow capping mass is retained in the LND-GLC coupled system.) - ! - ! The alternative of simply not adding ice melt to the runoff stream where - ! glc_dyn_runoff_routing = 0 conserves mass, but fails to conserve energy, for a - ! similar reason: Ice melt in CLM removes energy; also, the ocean's melting of the - ! snow capping flux removes energy. If both the accumulation and melting remove - ! energy, there is a double-counting. - ! - ! Yet another way to think about this is: When ice melted, we let the liquid run - ! off, and replaced it with new ice from below. But that new ice needed to come - ! from somewhere to keep the system in water balance. We "request" the new ice from - ! the ocean by generating a negataive ice runoff equivalent to the amount we have - ! melted (i.e., equivalent to the amount of new ice that we created from below). - - ! As above: Melt is only generated for glacier columns. But it doesn't hurt to do - ! this for all columns in the do_smb filter: this melt term will be 0 for other - ! columns. - - qflx_ice_runoff_snwcp(c) = qflx_ice_runoff_snwcp(c) - (1.0_r8 - glc_dyn_runoff_routing(g)) * qflx_glcice_melt(c) - - ! Recall that glc_dyn_runoff_routing = min(lfrac, Sg_icemask_coupled_fluxes_l) / lfrac. - ! - ! Consider a cell with lfrac = 0.8 and Sg_icemask_coupled_fluxes_l = 0.4. (For - ! instance, the cell might have half its land coverage in Greenland and the other - ! half in Ellemere.) Given qflx_ice_runoff_snwcp(c) = 1 m/yr, half the flux (0.5 - ! m/yr) will be sent to the runoff model, where it will be multiplied by lfrac to - ! give a net flux of 0.4 m/yr times the cell area. - ! - ! The full SMB of 1 m/yr will be sent to the coupler's prep_glc_mod, but it will be - ! weighted by 0.4 when integrating over the whole ice sheet. So a net flux of 0.4 - ! m/yr will also be applied to the ice sheet model. The total flux of 0.8 m/yr, - ! split evenly between runoff and ice sheet, is what we want. - - end do - - end associate - - end subroutine AdjustRunoffTerms - -end module GlacierSurfaceMassBalanceMod diff --git a/src/biogeophys/HumanIndexMod.F90 b/src/biogeophys/HumanIndexMod.F90 deleted file mode 100644 index b2f3d8abff..0000000000 --- a/src/biogeophys/HumanIndexMod.F90 +++ /dev/null @@ -1,1354 +0,0 @@ -module HumanIndexMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: HumanIndexMod -! -! !DESCRIPTION: -! Calculates Wetbulb Temperature, Stull Wet Bulb Temperature, -! Heat Index, Apparent Temperature, Simplified Wet Bulb -! Globe Temperature, Humidex, Discomfort Index, Stull -! Discomfort Index, Temperature Humidity Comfort Index, -! Temperature Humidity Physiology Index, Swamp Cooler -! Temperature, Kelvin to Celsius, Vapor Pressure, & QSat_2 -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type -! !PUBLIC TYPES: - implicit none - save - private -! -! !PUBLIC MEMBER FUNCTIONS: - public :: HumanIndexReadNML ! Read in the namelist for HumanIndex - public :: Wet_Bulb ! Wet bulb temperature - public :: Wet_BulbS ! Wet bulb temperature from relative humidity - public :: HeatIndex ! Heat index - public :: AppTemp ! Apparant temperature - public :: swbgt ! Simplified Wetbulb Globe temperature - public :: hmdex ! humidex, human discomfort based on heat and humidity - public :: dis_coi ! Discomfort index - public :: dis_coiS ! Discomfort index from relative humidity - public :: THIndex ! Temperature humidity index - public :: SwampCoolEff ! Swamp Cooling efficiency - public :: KtoC ! Convert Kelvin to Celcius - public :: VaporPres ! Vapor pressure - public :: QSat_2 ! Saturation mix. ratio and the change in sat. mix rat. with respect to Temp - -! -! !PUBLIC MEMBER DATA: - logical, public :: calc_human_stress_indices = .true. ! If should calculate the set of human stress indices - type, public :: humanindex_type - real(r8), pointer :: tc_ref2m_patch (:) ! Patch 2 m height surface air temperature (C) - real(r8), pointer :: vap_ref2m_patch (:) ! Patch 2 m height vapor pressure (Pa) - real(r8), pointer :: appar_temp_ref2m_patch (:) ! Patch 2 m apparent temperature (C) - real(r8), pointer :: appar_temp_ref2m_r_patch (:) ! Patch Rural 2 m apparent temperature (C) - real(r8), pointer :: swbgt_ref2m_patch (:) ! Patch 2 m Simplified Wetbulb Globe temperature (C) - real(r8), pointer :: swbgt_ref2m_r_patch (:) ! Patch Rural 2 m Simplified Wetbulb Globe temperature (C) - real(r8), pointer :: humidex_ref2m_patch (:) ! Patch 2 m Humidex (C) - real(r8), pointer :: humidex_ref2m_r_patch (:) ! Patch Rural 2 m Humidex (C) - real(r8), pointer :: wbt_ref2m_patch (:) ! Patch 2 m Stull Wet Bulb temperature (C) - real(r8), pointer :: wbt_ref2m_r_patch (:) ! Patch Rural 2 m Stull Wet Bulb temperature (C) - real(r8), pointer :: wb_ref2m_patch (:) ! Patch 2 m Wet Bulb temperature (C) - real(r8), pointer :: wb_ref2m_r_patch (:) ! Patch Rural 2 m Wet Bulb temperature (C) - real(r8), pointer :: teq_ref2m_patch (:) ! Patch 2 m height Equivalent temperature (K) - real(r8), pointer :: teq_ref2m_r_patch (:) ! Patch Rural 2 m Equivalent temperature (K) - real(r8), pointer :: ept_ref2m_patch (:) ! Patch 2 m height Equivalent Potential temperature (K) - real(r8), pointer :: ept_ref2m_r_patch (:) ! Patch Rural 2 m height Equivalent Potential temperature (K) - real(r8), pointer :: discomf_index_ref2m_patch (:) ! Patch 2 m Discomfort Index temperature (C) - real(r8), pointer :: discomf_index_ref2m_r_patch (:) ! Patch Rural 2 m Discomfort Index temperature (C) - real(r8), pointer :: discomf_index_ref2mS_patch (:) ! Patch 2 m height Discomfort Index Stull temperature (C) - real(r8), pointer :: discomf_index_ref2mS_r_patch(:) ! Patch Rural 2 m Discomfort Index Stull temperature (K) - real(r8), pointer :: nws_hi_ref2m_patch (:) ! Patch 2 m NWS Heat Index (C) - real(r8), pointer :: nws_hi_ref2m_r_patch (:) ! Patch Rural 2 m NWS Heat Index (C) - real(r8), pointer :: thip_ref2m_patch (:) ! Patch 2 m Temperature Humidity Index Physiology (C) - real(r8), pointer :: thip_ref2m_r_patch (:) ! Patch Rural 2 m Temperature Humidity Index Physiology (C) - real(r8), pointer :: thic_ref2m_patch (:) ! Patch 2 m Temperature Humidity Index Comfort (C) - real(r8), pointer :: thic_ref2m_r_patch (:) ! Patch Rural 2 m Temperature Humidity Index Comfort (C) - real(r8), pointer :: swmp65_ref2m_patch (:) ! Patch 2 m Swamp Cooler temperature 65% effi (C) - real(r8), pointer :: swmp65_ref2m_r_patch (:) ! Patch Rural 2 m Swamp Cooler temperature 65% effi (C) - real(r8), pointer :: swmp80_ref2m_patch (:) ! Patch 2 m Swamp Cooler temperature 80% effi (C) - real(r8), pointer :: swmp80_ref2m_r_patch (:) ! Patch Rural 2 m Swamp Cooler temperature 80% effi (C) - real(r8), pointer :: appar_temp_ref2m_u_patch (:) ! Patch Urban 2 m apparent temperature (C) - real(r8), pointer :: swbgt_ref2m_u_patch (:) ! Patch Urban 2 m Simplified Wetbulb Globe temperature (C) - real(r8), pointer :: humidex_ref2m_u_patch (:) ! Patch Urban 2 m Humidex (C) - real(r8), pointer :: wbt_ref2m_u_patch (:) ! Patch Urban 2 m Stull Wet Bulb temperature (C) - real(r8), pointer :: wb_ref2m_u_patch (:) ! Patch Urban 2 m Wet Bulb temperature (C) - real(r8), pointer :: teq_ref2m_u_patch (:) ! Patch Urban 2 m Equivalent - real(r8), pointer :: ept_ref2m_u_patch (:) ! Patch Urban 2 m height Equivalent Potential temperature (K) - real(r8), pointer :: discomf_index_ref2m_u_patch (:) !Urban 2 m Discomfort Index temperature (C) - real(r8), pointer :: discomf_index_ref2mS_u_patch(:) !Urban 2 m Discomfort Index Stull temperature (K) - real(r8), pointer :: nws_hi_ref2m_u_patch (:) !Urban 2 m NWS Heat Index (C) - real(r8), pointer :: thip_ref2m_u_patch (:) !Urban 2 m Temperature Humidity Index Physiology (C) - real(r8), pointer :: thic_ref2m_u_patch (:) !Urban 2 m Temperature Humidity Index Comfort (C) - real(r8), pointer :: swmp65_ref2m_u_patch (:) !Urban 2 m Swamp Cooler temperature 65% effi (C) - real(r8), pointer :: swmp80_ref2m_u_patch (:) !Urban 2 m Swamp Cooler temperature 80% effi (C) temperature (K) - contains - procedure, public :: Init ! Public initialization - procedure, private :: InitAllocate ! Private allocation method - procedure, private :: InitHistory ! Private history setup method - end type humanindex_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ -! -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-07-12 -! Modified 03-14-12--- filter routines for WB -! -! Modified 08-12-12--- filter for below zero calculation. -! Added WB = T at 0 and below -! Modified 05-13-13--- Adding additional Metrics. -! Added Apparent Temperature (Australian BOM) -! Added Simplified Wetbulb Globe Temperature -! Added Humidex -! Added Discomfort Index -! The previous Metrics were from Keith Oleson -! Added Temperature Humidity Index -! Added Swamp Cooler Efficiency -! -! Modified 05-16-13--- Added Current Vapor Pressure and -! Kelvin to Celsius and converted all -! equations that use these inputs -! Modified 08-30-13--- Finalized Comments. Added a new -! qsat algorithm. Changed wet bulb calculations -! to calculate over the large range of atmospheric -! conditions. -! Modified 03-21-14--- Changed Specific Humidity to Mixing -! Ratio. -! Modified 04-08-16--- Added new convergence routine for -! Wet_Bulb. CLM4.5 Inputs at 50C 100% RH cause NaN. -! Davies-Jones is not calibrated for Tw above 40C. -! Modification makes all moisture calculations -! internal to Wet_Bulb. External input of RH used, -! Not external Q due to differences in QSat_2 and -! QSatMod at high RH and T>45C. -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Init -! -! !INTERFACE: -subroutine Init(this, bounds ) -! -! !DESCRIPTION: Initialize human index object -! -! !USES: -! !ARGUMENTS: - implicit none - class(humanindex_type) :: this - type(bounds_type) , intent(in) :: bounds -! !LOCAL VARIABLES: - type(bounds_type) :: bounds_tmp -!EOP -!----------------------------------------------------------------------- - if ( calc_human_stress_indices ) then - call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds ) - else - ! Associate statements need humanindex_inst to be allocated - ! So allocate with size 1 when not being used - bounds_tmp%begp = 1 - bounds_tmp%endp = 1 - call this%InitAllocate ( bounds ) - end if - -end subroutine Init - -!------------------------------------------------------------------------ -subroutine InitAllocate(this, bounds) -! -! !DESCRIPTION: -! Initialize module data structure -! -! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) -! -! !ARGUMENTS: - class(humanindex_type) :: this - type(bounds_type), intent(in) :: bounds -! -! !LOCAL VARIABLES: - integer :: begp, endp -!------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - - allocate(this%vap_ref2m_patch (begp:endp)) ; this%vap_ref2m_patch (:) = nan - allocate(this%humidex_ref2m_u_patch (begp:endp)) ; this%humidex_ref2m_u_patch (:) = nan - allocate(this%humidex_ref2m_patch (begp:endp)) ; this%humidex_ref2m_patch (:) = nan - allocate(this%humidex_ref2m_r_patch (begp:endp)) ; this%humidex_ref2m_r_patch (:) = nan - allocate(this%nws_hi_ref2m_patch (begp:endp)) ; this%nws_hi_ref2m_patch (:) = nan - allocate(this%nws_hi_ref2m_r_patch (begp:endp)) ; this%nws_hi_ref2m_r_patch (:) = nan - allocate(this%thip_ref2m_patch (begp:endp)) ; this%thip_ref2m_patch (:) = nan - allocate(this%thip_ref2m_r_patch (begp:endp)) ; this%thip_ref2m_r_patch (:) = nan - allocate(this%thic_ref2m_patch (begp:endp)) ; this%thic_ref2m_patch (:) = nan - allocate(this%thic_ref2m_r_patch (begp:endp)) ; this%thic_ref2m_r_patch (:) = nan - allocate(this%nws_hi_ref2m_u_patch (begp:endp)) ; this%nws_hi_ref2m_u_patch (:) = nan - allocate(this%thip_ref2m_u_patch (begp:endp)) ; this%thip_ref2m_u_patch (:) = nan - allocate(this%thic_ref2m_u_patch (begp:endp)) ; this%thic_ref2m_u_patch (:) = nan - allocate(this%tc_ref2m_patch (begp:endp)) ; this%tc_ref2m_patch (:) = nan - allocate(this%appar_temp_ref2m_patch (begp:endp)) ; this%appar_temp_ref2m_patch (:) = nan - allocate(this%appar_temp_ref2m_r_patch (begp:endp)) ; this%appar_temp_ref2m_r_patch (:) = nan - allocate(this%swbgt_ref2m_patch (begp:endp)) ; this%swbgt_ref2m_patch (:) = nan - allocate(this%swbgt_ref2m_r_patch (begp:endp)) ; this%swbgt_ref2m_r_patch (:) = nan - allocate(this%wbt_ref2m_patch (begp:endp)) ; this%wbt_ref2m_patch (:) = nan - allocate(this%wbt_ref2m_r_patch (begp:endp)) ; this%wbt_ref2m_r_patch (:) = nan - allocate(this%wb_ref2m_patch (begp:endp)) ; this%wb_ref2m_patch (:) = nan - allocate(this%wb_ref2m_r_patch (begp:endp)) ; this%wb_ref2m_r_patch (:) = nan - allocate(this%teq_ref2m_patch (begp:endp)) ; this%teq_ref2m_patch (:) = nan - allocate(this%teq_ref2m_r_patch (begp:endp)) ; this%teq_ref2m_r_patch (:) = nan - allocate(this%ept_ref2m_patch (begp:endp)) ; this%ept_ref2m_patch (:) = nan - allocate(this%ept_ref2m_r_patch (begp:endp)) ; this%ept_ref2m_r_patch (:) = nan - allocate(this%discomf_index_ref2m_patch (begp:endp)) ; this%discomf_index_ref2m_patch (:) = nan - allocate(this%discomf_index_ref2m_r_patch(begp:endp)) ; this%discomf_index_ref2m_r_patch(:) = nan - allocate(this%discomf_index_ref2mS_patch(begp:endp)) ; this%discomf_index_ref2mS_patch (:) = nan - allocate(this%discomf_index_ref2mS_r_patch(begp:endp)) ; this%discomf_index_ref2mS_r_patch(:) = nan - allocate(this%discomf_index_ref2mS_u_patch(begp:endp)) ; this%discomf_index_ref2mS_u_patch(:) = nan - allocate(this%swmp65_ref2m_patch (begp:endp)) ; this%swmp65_ref2m_patch (:) = nan - allocate(this%swmp65_ref2m_r_patch (begp:endp)) ; this%swmp65_ref2m_r_patch (:) = nan - allocate(this%swmp80_ref2m_patch (begp:endp)) ; this%swmp80_ref2m_patch (:) = nan - allocate(this%swmp80_ref2m_r_patch (begp:endp)) ; this%swmp80_ref2m_r_patch (:) = nan - allocate(this%swmp80_ref2m_u_patch (begp:endp)) ; this%swmp80_ref2m_u_patch (:) = nan - allocate(this%appar_temp_ref2m_u_patch (begp:endp)) ; this%appar_temp_ref2m_u_patch (:) = nan - allocate(this%swbgt_ref2m_u_patch (begp:endp)) ; this%swbgt_ref2m_u_patch (:) = nan - allocate(this%wbt_ref2m_u_patch (begp:endp)) ; this%wbt_ref2m_u_patch (:) = nan - allocate(this%wb_ref2m_u_patch (begp:endp)) ; this%wb_ref2m_u_patch (:) = nan - allocate(this%teq_ref2m_u_patch (begp:endp)) ; this%teq_ref2m_u_patch (:) = nan - allocate(this%ept_ref2m_u_patch (begp:endp)) ; this%ept_ref2m_u_patch (:) = nan - allocate(this%discomf_index_ref2m_u_patch(begp:endp)) ; this%discomf_index_ref2m_u_patch(:) = nan - allocate(this%swmp65_ref2m_u_patch (begp:endp)) ; this%swmp65_ref2m_u_patch (:) = nan -end subroutine InitAllocate - - -!------------------------------------------------------------------------ -subroutine InitHistory(this, bounds) -! -! !DESCRIPTION: -! Initialize history data -! -! !USES: - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d -! -! !ARGUMENTS: - class(humanindex_type) :: this - type(bounds_type), intent(in) :: bounds -! -! !LOCAL VARIABLES: - integer :: begp, endp -!------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - - this%appar_temp_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='APPAR_TEMP', units='C', & - avgflag='A', long_name='2 m apparent temperature', & - ptr_patch=this%appar_temp_ref2m_patch, default='inactive') - - this%appar_temp_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='APPAR_TEMP_U', units='C', & - avgflag='A', long_name='Urban 2 m apparent temperature', & - ptr_patch=this%appar_temp_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%appar_temp_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='APPAR_TEMP_R', units='C', & - avgflag='A', long_name='Rural 2 m apparent temperature', & - ptr_patch=this%appar_temp_ref2m_r_patch, set_spec=spval, default='inactive') - - this%swbgt_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='SWBGT', units='C', & - avgflag='A', long_name='2 m Simplified Wetbulb Globe Temp', & - ptr_patch=this%swbgt_ref2m_patch) - - this%swbgt_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='SWBGT_U', units='C', & - avgflag='A', long_name='Urban 2 m Simplified Wetbulb Globe Temp', & - ptr_patch=this%swbgt_ref2m_u_patch, set_nourb=spval) - - this%swbgt_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='SWBGT_R', units='C', & - avgflag='A', long_name='Rural 2 m Simplified Wetbulb Globe Temp', & - ptr_patch=this%swbgt_ref2m_r_patch, set_spec=spval) - - this%humidex_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='HUMIDEX', units='C', & - avgflag='A', long_name='2 m Humidex', & - ptr_patch=this%humidex_ref2m_patch) - - this%humidex_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='HUMIDEX_U', units='C', & - avgflag='A', long_name='Urban 2 m Humidex', & - ptr_patch=this%humidex_ref2m_u_patch, set_nourb=spval) - - this%humidex_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='HUMIDEX_R', units='C', & - avgflag='A', long_name='Rural 2 m Humidex', & - ptr_patch=this%humidex_ref2m_r_patch, set_spec=spval) - - this%wbt_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='WBT', units='C', & - avgflag='A', long_name='2 m Stull Wet Bulb', & - ptr_patch=this%wbt_ref2m_patch) - - this%wbt_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='WBT_U', units='C', & - avgflag='A', long_name='Urban 2 m Stull Wet Bulb', & - ptr_patch=this%wbt_ref2m_u_patch, set_nourb=spval) - - this%wbt_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='WBT_R', units='C', & - avgflag='A', long_name='Rural 2 m Stull Wet Bulb', & - ptr_patch=this%wbt_ref2m_r_patch, set_spec=spval) - - this%wb_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='WBA', units='C', & - avgflag='A', long_name='2 m Wet Bulb', & - ptr_patch=this%wb_ref2m_patch, default='inactive') - - this%wb_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='WBA_U', units='C', & - avgflag='A', long_name='Urban 2 m Wet Bulb', & - ptr_patch=this%wb_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%wb_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='WBA_R', units='C', & - avgflag='A', long_name='Rural 2 m Wet Bulb', & - ptr_patch=this%wb_ref2m_r_patch, set_spec=spval, default='inactive') - - this%teq_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='TEQ', units='K', & - avgflag='A', long_name='2 m Equiv Temp', & - ptr_patch=this%teq_ref2m_patch, default='inactive') - - this%teq_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TEQ_U', units='K', & - avgflag='A', long_name='Urban 2 m Equiv Temp', & - ptr_patch=this%teq_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%teq_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TEQ_R', units='K', & - avgflag='A', long_name='Rural 2 m Equiv Temp', & - ptr_patch=this%teq_ref2m_r_patch, set_spec=spval, default='inactive') - - this%ept_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='EPT', units='K', & - avgflag='A', long_name='2 m Equiv Pot Temp', & - ptr_patch=this%ept_ref2m_patch, default='inactive') - - this%ept_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='EPT_U', units='K', & - avgflag='A', long_name='Urban 2 m Equiv Pot Temp', & - ptr_patch=this%ept_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%ept_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='EPT_R', units='K', & - avgflag='A', long_name='Rural 2 m Equiv Pot Temp', & - ptr_patch=this%ept_ref2m_r_patch, set_spec=spval, default='inactive') - - this%discomf_index_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='DISCOI', units='C', & - avgflag='A', long_name='2 m Discomfort Index', & - ptr_patch=this%discomf_index_ref2m_patch, default='inactive') - - this%discomf_index_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='DISCOI_U', units='C', & - avgflag='A', long_name='Urban 2 m Discomfort Index', & - ptr_patch=this%discomf_index_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%discomf_index_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='DISCOI_R', units='C', & - avgflag='A', long_name='Rural 2 m Discomfort Index', & - ptr_patch=this%discomf_index_ref2m_r_patch, set_spec=spval, default='inactive') - - this%discomf_index_ref2mS_patch(begp:endp) = spval - call hist_addfld1d (fname='DISCOIS', units='C', & - avgflag='A', long_name='2 m Stull Discomfort Index', & - ptr_patch=this%discomf_index_ref2mS_patch, default='inactive') - - this%discomf_index_ref2mS_u_patch(begp:endp) = spval - call hist_addfld1d (fname='DISCOIS_U', units='C', & - avgflag='A', long_name='Urban 2 m Stull Discomfort Index', & - ptr_patch=this%discomf_index_ref2mS_u_patch, set_nourb=spval, default='inactive') - - this%discomf_index_ref2mS_r_patch(begp:endp) = spval - call hist_addfld1d (fname='DISCOIS_R', units='C', & - avgflag='A', long_name='Rural 2 m Stull Discomfort Index', & - ptr_patch=this%discomf_index_ref2mS_r_patch, set_spec=spval, default='inactive') - - this%nws_hi_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='HIA', units='C', & - avgflag='A', long_name='2 m NWS Heat Index', & - ptr_patch=this%nws_hi_ref2m_patch) - - this%nws_hi_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='HIA_U', units='C', & - avgflag='A', long_name='Urban 2 m NWS Heat Index', & - ptr_patch=this%nws_hi_ref2m_u_patch, set_nourb=spval) - - this%nws_hi_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='HIA_R', units='C', & - avgflag='A', long_name='Rural 2 m NWS Heat Index', & - ptr_patch=this%nws_hi_ref2m_r_patch, set_spec=spval) - - this%thip_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='THIP', units='C', & - avgflag='A', long_name='2 m Temp Hum Index Physiology', & - ptr_patch=this%thip_ref2m_patch, default='inactive') - - this%thip_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='THIP_U', units='C', & - avgflag='A', long_name='Urban 2 m Temp Hum Index Physiology', & - ptr_patch=this%thip_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%thip_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='THIP_R', units='C', & - avgflag='A', long_name='Rural 2 m Temp Hum Index Physiology', & - ptr_patch=this%thip_ref2m_r_patch, set_spec=spval, default='inactive') - - this%thic_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='THIC', units='C', & - avgflag='A', long_name='2 m Temp Hum Index Comfort', & - ptr_patch=this%thic_ref2m_patch, default='inactive') - - this%thic_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='THIC_U', units='C', & - avgflag='A', long_name='Urban 2 m Temp Hum Index Comfort', & - ptr_patch=this%thic_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%thic_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='THIC_R', units='C', & - avgflag='A', long_name='Rural 2 m Temp Hum Index Comfort', & - ptr_patch=this%thic_ref2m_r_patch, set_spec=spval, default='inactive') - - this%swmp65_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='SWMP65', units='C', & - avgflag='A', long_name='2 m Swamp Cooler Temp 65% Eff', & - ptr_patch=this%swmp65_ref2m_patch, default='inactive') - - this%swmp65_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='SWMP65_U', units='C', & - avgflag='A', long_name='Urban 2 m Swamp Cooler Temp 65% Eff', & - ptr_patch=this%swmp65_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%swmp65_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='SWMP65_R', units='C', & - avgflag='A', long_name='Rural 2 m Swamp Cooler Temp 65% Eff', & - ptr_patch=this%swmp65_ref2m_r_patch, set_spec=spval, default='inactive') - - this%swmp80_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='SWMP80', units='C', & - avgflag='A', long_name='2 m Swamp Cooler Temp 80% Eff', & - ptr_patch=this%swmp80_ref2m_patch, default='inactive') - - this%swmp80_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='SWMP80_U', units='C', & - avgflag='A', long_name='Urban 2 m Swamp Cooler Temp 80% Eff', & - ptr_patch=this%swmp80_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%swmp80_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='SWMP80_R', units='C', & - avgflag='A', long_name='Rural 2 m Swamp Cooler Temp 80% Eff', & - ptr_patch=this%swmp80_ref2m_r_patch, set_spec=spval, default='inactive') - -end subroutine InitHistory - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: HumanIndexReadNML -! -! !INTERFACE: - subroutine HumanIndexReadNML( NLFilename ) -! -! !DESCRIPTION: -! -! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg -! -! !ARGUMENTS: - implicit none - character(len=*), intent(IN) :: NLFilename ! Namelist filename -! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'UrbanReadNML' ! subroutine name -!EOP -!----------------------------------------------------------------------- - namelist / clm_humanindex_inparm / calc_human_stress_indices - - ! ---------------------------------------------------------------------- - ! Read namelist from input namelist filename - ! ---------------------------------------------------------------------- - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clm_humanindex_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_humanindex_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_humanindex_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_humanindex_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_humanindex_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - ! Broadcast namelist variables read in - call shr_mpi_bcast(calc_human_stress_indices, mpicom) - - end subroutine HumanIndexReadNML - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: AppTemp -! -! !INTERFACE: - subroutine AppTemp (Tc_1, vap_pres, u10_m, app_temp) -! -! !DESCRIPTION: -! Apparent Temperature (Australian BOM): Here we use equation 22 -! where AT is a function of air temperature (C), water -! vapor pressure (kPa), and 10-m wind speed (m/s). vap_pres -! from Erich Fischer (consistent with CLM equations) -! -! Reference: Steadman, R.G., 1994: Norms of apparent temperature -! in Australia, Aust. Met. Mag., 43, 1-16. -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_1 ! temperature (C) - real(r8), intent(in) :: vap_pres ! Vapor Pressure (pa) - real(r8), intent(in) :: u10_m ! Winds at 10m (m/s) - real(r8), intent(out) :: app_temp ! Apparent Temperature (C) -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - app_temp = Tc_1 + 3.30_r8*vap_pres/1000._r8 - 0.70_r8*u10_m - 4.0_r8 - - end subroutine AppTemp -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: swbgt -! -! !INTERFACE: - subroutine swbgt (Tc_2, vap_pres, s_wbgt) -! -! !DESCRIPTION: -! Simplified Wet Bulb Globe Temperature: -! Requires air temperature (C), water vapor pressure (hPa) -! -! Reference: Willett, K.M., and S. Sherwood, 2010: Exceedance of heat -! index thresholds for 15 regions under a warming -! climate using the wet-bulb globe temperature, -! Int. J. Climatol., doi:10.1002/joc.2257 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_2 ! temperature (C) - real(r8), intent(in) :: vap_pres ! Vapor Pressure (pa) - real(r8), intent(out) :: s_wbgt ! Simplified Wet Bulb Globe Temperature (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - s_wbgt = 0.567_r8*(Tc_2) + 0.393_r8*vap_pres/100._r8 + 3.94_r8 - - end subroutine swbgt -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hmdex -! -! !INTERFACE: - subroutine hmdex (Tc_3, vap_pres, humidex) -! -! !DESCRIPTION: -! Humidex: -! Requires air temperature (C), water vapor pressure (hPa) -! Reference: Masterson, J., and F. Richardson, 1979: Humidex, a -! method of quantifying human discomfort due to -! excessive heat and humidity, CLI 1-79, Environment -! Canada, Atmosheric Environment Service, Downsview, Ontario -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_3 ! temperature (C) - real(r8), intent(in) :: vap_pres ! Vapor Pressure (Pa) - real(r8), intent(out) :: humidex ! Humidex (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - humidex = Tc_3 + ((5._r8/9._r8) * (vap_pres/100._r8 - 10._r8)) - - end subroutine hmdex -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: dis_coi -! -! !INTERFACE: - subroutine dis_coi (Tc_4, wb_t, discoi) -! -! !DESCRIPTION: -! Discomfort Index -! The wet bulb temperature is from Davies-Jones, 2008. -! Requires air temperature (C), wet bulb temperature (C) -! Reference: Epstein, Y., and D.S. Moran, 2006: Thermal comfort and the heat stress indices, -! Ind. Health, 44, 388-398. -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_4 ! temperature (C) - real(r8), intent(in) :: wb_t ! Wet Bulb Temperature (C) - real(r8), intent(out) :: discoi ! Discomfort Index (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - discoi = 0.5_r8*wb_t + 0.5_r8*Tc_4 - - end subroutine dis_coi -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: dis_coiS -! -! !INTERFACE: - subroutine dis_coiS (Tc_5, relhum, wbt_s, discois) -! -! !DESCRIPTION: -! Discomfort Index -! The wet bulb temperature is from Stull, 2011. -! Requires air temperature (C), wet bulb temperature (C) -! Reference: Epstein, Y., and D.S. Moran, 2006: Thermal comfort and the heat stress indices, -! Ind. Health, 44, 388-398. -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_5 ! temperature (C) - real(r8), intent(in) :: wbt_s ! Wet Bulb Temperature (C) - real(r8), intent(in) :: relhum ! Relative Humidity (%) - real(r8), intent(out) :: discois ! Discomfort Index (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: Tc ! 2-m temperature with limit (C) - real(r8) :: rh ! 2-m relative humidity with limit (%) - real(r8) :: rh_min ! Minimum 2-m relative humidity (%) - -! -!----------------------------------------------------------------------- - Tc = min(Tc_5,50._r8) - rh = min(relhum,99._r8) - rh = max(rh,5._r8) - rh_min = Tc*(-2.27_r8)+27.7_r8 - if (Tc < -20._r8 .or. rh < rh_min) then - ! wbt_s calculation invalid - discois = Tc - else - ! wbt_s calculation valid - discois = 0.5_r8*wbt_s + 0.5_r8*Tc - end if - - end subroutine dis_coiS -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Wet_Bulb -! -! !INTERFACE: - subroutine Wet_Bulb (Tin_1,vape,pin,relhum,qin,Teq,epott,wb_it) - -! -! !DESCRIPTION: -! Calculates Wet Bulb Temperature, Theta_wb, Theta_e, Moist Pot Temp, -! Lifting Cond Temp, and Equiv Temp using Davies-Jones 2008 Method. -! 1st calculates the lifting cond temperature (Bolton 1980 eqn 22). -! Then calculates the moist pot temp (Bolton 1980 eqn 24). Then -! calculates Equivalent Potential Temperature (Bolton 1980 eqn 39). -! From equivalent pot temp, equiv temp and Theta_w (Davies-Jones -! 2008 eqn 3.5-3.8). An accurate 'first guess' of wet bulb temperature -! is determined (Davies-Jones 2008 eqn 4.8-4.11). Newton-Raphson -! is used for 2 iterations, determining final wet bulb temperature -! (Davies-Jones 2008 eqn 2.6). -! Requires Temperature,Vapor Pressure,Atmospheric Pressure,Relative Humidity,Mixing Ratio -! Reference: Bolton: The computation of equivalent potential temperature. -! Monthly weather review (1980) vol. 108 (7) pp. 1046-1053 -! Davies-Jones: An efficient and accurate method for computing the -! wet-bulb temperature along pseudoadiabats. Monthly Weather Review -! (2008) vol. 136 (7) pp. 2764-2785 -! Flatau et al: Polynomial fits to saturation vapor pressure. -! Journal of Applied Meteorology (1992) vol. 31 pp. 1507-1513 -! Note: Pressure needs to be in mb, mixing ratio needs to be in -! kg/kg in some equations, and in g/kg in others. -! Calculates Iteration via Newton-Raphson Method. Only 2 iterations. -! Reference: Davies-Jones: An efficient and accurate method for computing the -! wet-bulb temperature along pseudoadiabats. Monthly Weather Review -! (2008) vol. 136 (7) pp. 2764-2785 -! Flatau et al: Polynomial fits to saturation vapor pressure. -! Journal of Applied Meteorology (1992) vol. 31 pp. 1507-1513 -! Note: Pressure needs to be in mb, mixing ratio needs to be in -! kg/kg in some equations. -! -! !REVISION HISTORY: -! -! Created by Jonathan R Buzan 03-07-12 -! Modified JRBuzan 06-29-13: Major Revision. Changes all Calculations to be based -! upon Bolton eqn 39. Uses Derivatives in Davies-Jones -! 2008 for calculation of vapor pressure. -! Modified JRBuzan 03-21-14: Minor Revision. Changed specific humidity to mixing -! ratio. -! Modified JRBuzan 04-08-16: Added new convergence routine for -! Wet_Bulb. CLM4.5 Inputs at 50C 100% RH cause NaN. -! Davies-Jones is not calibrated for Tw above 40C. -! Modification makes all moisture calculations -! internal to Wet_Bulb. External input of RH used, -! Not external Q due to differences in QSat_2 and -! QSatMod at high RH and T>45C. -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ - use clm_varctl , only: iulog -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tin_1 ! 2-m air temperature (K) - real(r8), intent(in) :: vape ! Vapor Pressure (Pa) - real(r8), intent(in) :: pin ! Atmospheric Pressure (Pa) - real(r8), intent(in) :: relhum ! Relative Humidity (%) - real(r8), intent(in) :: qin ! Specific Humidity (kg/kg) - - real(r8), intent(out) :: Teq ! Equivalent Temperature (K) - real(r8), intent(out) :: epott ! Equivalent Potential Temperature (K) - real(r8), intent(out) :: wb_it ! Wet bulb Temperature (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: k1 ! Quadratic Parameter (C) - real(r8) :: k2 ! Quadratic Parameter scaled by X (C) - real(r8) :: pmb ! Atmospheric Surface Pressure (mb) - real(r8) :: D ! Linear Interpolation of X - - real(r8) :: constA = 2675._r8 ! Constant used for extreme cold temparatures (K) - real(r8) :: grms = 1000._r8 ! Gram per Kilogram (g/kg) - real(r8) :: p0 = 1000._r8 ! surface pressure (mb) - real(r8) :: C ! Temperature of Freezing (K) - - real(r8) :: hot ! Dimensionless Quantity used for changing temperature regimes - real(r8) :: cold ! Dimensionless Quantity used for changing temperature regimes - - real(r8) :: kappad = 0.2854_r8 ! Heat Capacity - real(r8) :: T1 ! Temperature (K) - real(r8) :: vapemb ! Vapor Pressure (mb) - real(r8) :: mixr ! Mixing Ratio (g/kg) - - real(r8) :: es_mb_teq ! saturated vapour pressure for wrt TEQ (mb) - real(r8) :: de_mbdTeq ! Derivative of Saturated Vapor pressure wrt TEQ (mb/K) - real(r8) :: dlnes_mbdTeq ! Log derivative of the sat. vap pressure wrt TEQ (mb/K) - real(r8) :: rs_teq ! Mixing Ratio wrt TEQ (kg/kg) - real(r8) :: rsdTeq ! Derivative of Mixing Ratio wrt TEQ (kg/kg/K) - real(r8) :: foftk_teq ! Function of EPT wrt TEQ - real(r8) :: fdTeq ! Derivative of Function of EPT wrt TEQ - - real(r8) :: wb_temp ! Wet Bulb Temperature First Guess (C) - real(r8) :: es_mb_wb_temp ! Vapor Pressure wrt Wet Bulb Temp (mb) - real(r8) :: de_mbdwb_temp ! Derivative of Sat. Vapor Pressure wrt WB Temp (mb/K) - real(r8) :: dlnes_mbdwb_temp ! Log Derivative of sat. vap. pressure wrt WB Temp (mb/K) - real(r8) :: rs_wb_temp ! Mixing Ratio wrt WB Temp (kg/kg) - real(r8) :: rsdwb_temp ! Derivative of Mixing Ratio wrt WB Temp (kg/kg/K) - real(r8) :: foftk_wb_temp ! Function of EPT wrt WB Temp - real(r8) :: fdwb_temp ! Derivative of function of EPT wrt WB Temp - - real(r8) :: tl ! Lifting Condensation Temperature (K) - real(r8) :: theta_dl ! Moist Potential Temperature (K) - real(r8) :: pi ! Non dimensional Pressure - real(r8) :: X ! Ratio of equivalent temperature to freezing scaled by Heat Capacity - real(r8) :: vapemb_sat ! Saturated vapor pressure (mb) - real(r8) :: de_mbdT_sat ! Saturated d(es)/d(T) - real(r8) :: dlnes_mbdT_sat ! Saturated dln(es)/d(T) - real(r8) :: rs_T_sat ! Saturated humidity (kg/kg) - real(r8) :: rsdT_sat ! Saturated d(qs)/d(T) - real(r8) :: foftk_t_sat ! Saturated Davies-Jones eqn 2.3 - real(r8) :: fdT_sat ! Saturated d(f)/d(T) - real(r8) :: convergence = 0.00001_r8 ! Convergence value - real(r8) :: wb_temp_new ! Wet Bulb Temperature Subsequent Guess (C) - integer :: iter ! Iteration number - integer :: max_iter = 10000 ! Iteration Maximum - integer :: converged ! Converge Result: 0 = No, 1 = Yes - integer :: j ! Iteration Step Number -!----------------------------------------------------------------------- - - C = SHR_CONST_TKFRZ ! Freezing Temperature - pmb = pin*0.01_r8 ! pa to mb - T1 = Tin_1 ! Use holder for T - - call QSat_2(T1, pin, vapemb_sat, de_mbdT_sat, dlnes_mbdT_sat, rs_T_sat, rsdT_sat, foftk_t_sat, fdT_sat) - - vapemb = vapemb_sat * relhum * 0.01_r8 ! vapor pressure (mb) - mixr = rs_T_sat * relhum * 0.01_r8 * grms ! change specific humidity to mixing ratio (g/kg) - - ! Calculate Equivalent Pot. Temp (pmb, T, mixing ratio (g/kg), pott, epott) - ! Calculate Parameters for Wet Bulb Temp (epott, pmb) - pi = (pmb/p0)**(kappad) - D = (0.1859_r8*pmb/p0 + 0.6512)**(-1._r8) - k1 = -38.5_r8*pi*pi +137.81_r8*pi -53.737_r8 - k2 = -4.392_r8*pi*pi +56.831_r8*pi -0.384_r8 - - ! Calculate lifting condensation level. first eqn - ! uses vapor pressure (mb) - ! 2nd eqn uses relative humidity. - ! first equation: Bolton 1980 Eqn 21. - ! tl = (2840._r8/(3.5_r8*log(T1) - log(vapemb) - 4.805_r8)) + 55._r8 - ! second equation: Bolton 1980 Eqn 22. relhum = relative humidity - tl = (1._r8/((1._r8/((T1 - 55._r8))) - (log(relhum/100._r8)/2840._r8))) + 55._r8 - - ! Theta_DL: Bolton 1980 Eqn 24. - theta_dl = T1*((p0/(pmb-vapemb))**kappad)*((T1/tl)**(mixr*0.00028_r8)) - - ! EPT: Bolton 1980 Eqn 39. - epott = theta_dl*exp(((3.036_r8/tl)-0.00178_r8)*mixr*(1._r8 + 0.000448_r8*mixr)) - Teq = epott*pi ! Equivalent Temperature at pressure - X = (C/Teq)**3.504_r8 - - ! Calculates the regime requirements of wet bulb equations. - if (Teq > 355.15_r8) then - hot = 1.0_r8 - else - hot = 0.0_r8 - endif - - if ((X >= 1._r8) .AND. (X <= D)) then - cold = 0._r8 - else - cold = 1._r8 - endif - - ! Calculate Wet Bulb Temperature, initial guess - ! Extremely cold regime if X.gt.D then need to - ! calculate dlnesTeqdTeq - if (X > D) then - call QSat_2(Teq, pin, es_mb_teq, de_mbdTeq, dlnes_mbdTeq, rs_teq, rsdTeq, foftk_teq, fdTeq) - wb_temp = Teq - C - ((constA*rs_teq)/(1._r8 + (constA*rs_teq*dlnes_mbdTeq))) - else - wb_temp = k1 - 1.21_r8 * cold - 1.45_r8 * hot - (k2 - 1.21_r8 * cold) * X + (0.58_r8 / X) * hot - endif - - converged = 0 - iter = 0 - do while ( converged .eq. 0 .and. iter < max_iter) - - iter = iter + 1 - if ( wb_temp > 100._r8 ) exit - call QSat_2(wb_temp+C, pin, es_mb_wb_temp, de_mbdwb_temp, dlnes_mbdwb_temp, & - rs_wb_temp, rsdwb_temp, foftk_wb_temp, fdwb_temp) - wb_temp_new = wb_temp - ((foftk_wb_temp - X)/fdwb_temp) - - if ( abs(wb_temp - wb_temp_new) < convergence ) converged = 1 - wb_temp = (0.9_r8*wb_temp + 0.1_r8*wb_temp_new) - - end do - - if ( converged .eq. 1 ) then - wb_it = wb_temp - else - wb_it = T1 - C ! Place Holder. wet bulb temperature same as dry bulb (C) - write(iulog,*) 'WARNING: Wet_Bulb algorithm failed to converge. Setting to T: WB, P, T, RH, Q, VaporP: ', & - wb_it, pin, T1, relhum, qin, vape - endif - - end subroutine Wet_Bulb -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Wet_BulbS -! -! !INTERFACE: - subroutine Wet_BulbS (Tc_6,rh,wbt) - -! -! !DESCRIPTION: -! Reference: Stull, R., 2011: Wet-bulb temperature from relative humidity -! and air temperature, J. Appl. Meteor. Climatol., doi:10.1175/JAMC-D-11-0143.1 -! Note: Requires air temperature (C) and relative humidity (%) -! Note: Pressure needs to be in mb, mixing ratio needs to be in -! kg/kg in some equations. -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-07-12 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_6 ! Temperature (C) - real(r8), intent(in) :: rh ! Relative Humidity (%) - real(r8), intent(out) :: wbt ! Wet Bulb Temperature (C) -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -! - wbt = Tc_6 * atan(0.151977_r8*sqrt(rh + 8.313659_r8)) + & - atan(Tc_6+rh) - atan(rh-1.676331_r8) + & - 0.00391838_r8*rh**(3._r8/2._r8)*atan(0.023101_r8*rh) - & - 4.686035_r8 - - end subroutine Wet_BulbS -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: HeatIndex -! -! !INTERFACE: - subroutine HeatIndex (Tc_7, rh, hi) -! -! !DESCRIPTION: -! National Weather Service Heat Index -! Requires air temperature (F), relative humidity (%) -! Valid for air temperatures above 20C. If below this set heatindex to air temperature. -! Reference: Steadman. The assessment of sultriness. Part I: -! A temperature-humidity index based on human physiology -! and clothing science. J Appl Meteorol (1979) vol. 18 (7) pp. 861-873 -! Lans P. Rothfusz. "The heat index 'equation' (or -! more than you ever wanted to know about heat index)", -! Scientific Services Division (NWS Southern Region Headquarters), 1 July 1990 -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-07-12 -! Modified JRBuzan 03-10-12 -! Modified JRBuzan 05-14-13: removed testing algorithm -! Switched output to Celsius -! Used Boundary Conditions from -! Keith Oleson -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_7 ! temperature (C) - real(r8), intent(in) :: rh ! relative humidity (%) - real(r8), intent(out) :: hi ! Heat Index (C) -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: tf -! -!----------------------------------------------------------------------- - tf = (Tc_7) * 9._r8/5._r8 + 32._r8 ! fahrenheit - - if (tf < 68._r8) then - hi = tf - else - hi = -42.379_r8 + 2.04901523_r8*tf & - + 10.14333127_r8*rh & - + (-0.22475541_r8*tf*rh) & - + (-6.83783e-3_r8*tf**2._r8) & - + (-5.481717e-2_r8*rh**2._r8) & - + 1.22874e-3_r8*(tf**2._r8)*rh & - + 8.5282e-4_r8*tf*rh**2._r8 & - + (-1.99e-6_r8*(tf**2._r8)*(rh**2._r8)) - endif - hi = (hi - 32._r8) * 5._r8/9._r8 ! Celsius - - end subroutine HeatIndex -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: THIndex -! -! !INTERFACE: - subroutine THIndex (Tc_8, wb_t, thic, thip) -! -! !DESCRIPTION: -! Temperature Humidity Index -! The wet bulb temperature is Davies-Jones 2008 (subroutine WetBulb) -! Requires air temperature (C), wet bulb temperature (C) -! Calculates two forms of the index: Comfort and Physiology -! Reference: NWSCR (1976): Livestock hot weather stress. -! Regional operations manual letter C-31-76. -! National Weather Service Central Region, USA -! Ingram: Evaporative cooling in the pig. Nature (1965) -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-15-13 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_8 ! temperature (C) - real(r8), intent(in) :: wb_t ! Wet Bulb Temperature (C) - real(r8), intent(out) :: thic ! Temperature Humidity Index Comfort (C) - real(r8), intent(out) :: thip ! Temperature Humidity Index Physiology (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -! -! real(r8) :: - -! -!----------------------------------------------------------------------- - thic = 0.72_r8*wb_t + 0.72_r8*(Tc_8) + 40.6_r8 - thip = 0.63_r8*wb_t + 1.17_r8*(Tc_8) + 32._r8 - - end subroutine THIndex -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SwampCoolEff -! -! !INTERFACE: - subroutine SwampCoolEff (Tc_9, wb_t, tswmp80, tswmp65) -! -! !DESCRIPTION: -! Swamp Cooler Efficiency -! The wet bulb temperature is Davies-Jones 2008 (subroutine WetBulb) -! Requires air temperature (C), wet bulb temperature (C) -! Assumes that the Swamp Cooler Efficiency 80% (properly maintained) -! and 65% (improperly maintained). -! Reference: Koca et al: Evaporative cooling pads: test -! procedure and evaluation. Applied engineering -! in agriculture (1991) vol. 7 -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-15-13 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: Tc_9 ! temperature (C) - real(r8), intent(in) :: wb_t ! Wet Bulb Temperature (C) - real(r8), intent(out) :: tswmp80 ! Swamp Cooler Temp 80% Efficient (C) - real(r8), intent(out) :: tswmp65 ! Swamp Cooler Temp 65% Efficient (C) - -! -! !CALLED FROM: -! subroutine LakeFluxes in module LakeFluxesMod -! subroutine CanopyFluxes in module CanopyFluxesMod -! subroutine UrbanFluxes in module UrbanFluxesMod -! subroutine BareGroundFluxes in module BareGroundFluxesMod -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: neu80 = 0.80_r8 ! 80% Efficient - real(r8) :: neu65 = 0.65_r8 ! 65% Efficient - -! -!----------------------------------------------------------------------- - tswmp80 = Tc_9 - neu80*(Tc_9 - wb_t) - tswmp65 = Tc_9 - neu65*(Tc_9 - wb_t) - - end subroutine SwampCoolEff -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: KtoC -! -! !INTERFACE: - subroutine KtoC (T_k, T_c) -! -! !DESCRIPTION: -! Converts Kelvins to Celsius -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-16-13 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: T_k ! temperature (K) - real(r8), intent(out) :: T_c ! temperature (C) - -! -! !CALLED FROM: -! subroutines within this module -! -! !LOCAL VARIABLES: -!EOP -! -! real(r8) :: - -! -!----------------------------------------------------------------------- - T_c = T_k - SHR_CONST_TKFRZ - - end subroutine KtoC -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: VaporPres -! -! !INTERFACE: - subroutine VaporPres (rh, e, erh) -! -! !DESCRIPTION: -! Calculates Vapor Pressure -! Vapor Pressure from Erich Fischer (consistent with CLM -! equations, Keith Oleson) -! !REVISION HISTORY: -! Created by Jonathan R Buzan 03-16-13 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: rh ! Relative Humidity (%) - real(r8), intent(in) :: e ! Saturated Vapor Pressure (Pa) - real(r8), intent(out) :: erh ! Vapor Pressure (Pa) - -! -! !CALLED FROM: -! subroutines within this module -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - erh = (rh/100._r8) *e ! Pa - - end subroutine VaporPres -!EOP -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: QSat_2 -! -! !INTERFACE: - subroutine QSat_2 (T_k, p_t, es_mb, de_mbdT, dlnes_mbdT, rs, rsdT, foftk, fdT) -! -! !DESCRIPTION: -! Computes saturation mixing ratio and the change in saturation -! mixing ratio with respect to temperature. Uses Bolton eqn 10, 39. -! Davies-Jones eqns 2.3,A.1-A.10 -! Reference: Bolton: The computation of equivalent potential temperature. -! Monthly weather review (1980) vol. 108 (7) pp. 1046-1053 -! Davies-Jones: An efficient and accurate method for computing the -! wet-bulb temperature along pseudoadiabats. Monthly Weather Review -! (2008) vol. 136 (7) pp. 2764-2785 -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: T_k ! temperature (K) - real(r8), intent(in) :: p_t ! surface atmospheric pressure (pa) - real(r8), intent(out) :: es_mb ! vapor pressure (pa) - real(r8), intent(out) :: de_mbdT ! d(es)/d(T) - real(r8), intent(out) :: dlnes_mbdT ! dln(es)/d(T) - real(r8), intent(out) :: rs ! humidity (kg/kg) - real(r8), intent(out) :: rsdT ! d(qs)/d(T) - real(r8), intent(out) :: foftk ! Davies-Jones eqn 2.3 - real(r8), intent(out) :: fdT ! d(f)/d(T) - -! -! !CALLED FROM: -! subroutines within this module -! -! !REVISION HISTORY: -! Created by: Jonathan R Buzan 08/08/13 -! -! !LOCAL VARIABLES: -!EOP -! -! - real(r8) :: lambd_a = 3.504_r8 ! Inverse of Heat Capacity - real(r8) :: alpha = 17.67_r8 ! Constant to calculate vapour pressure - real(r8) :: beta = 243.5_r8 ! Constant to calculate vapour pressure - real(r8) :: epsilon = 0.6220_r8 ! Conversion between pressure/mixing ratio - real(r8) :: es_C = 6.112_r8 ! Vapor Pressure at Freezing STD (mb) - real(r8) :: vkp = 0.2854_r8 ! Heat Capacity - real(r8) :: y0 = 3036._r8 ! constant - real(r8) :: y1 = 1.78_r8 ! constant - real(r8) :: y2 = 0.448_r8 ! constant - real(r8) :: Cf = SHR_CONST_TKFRZ ! Freezing Temp (K) - real(r8) :: refpres = 1000._r8 ! Reference Pressure (mb) - real(r8) :: p_tmb ! Pressure (mb) - real(r8) :: ndimpress ! Non-dimensional Pressure - real(r8) :: prersdt ! Place Holder for derivative humidity - real(r8) :: pminuse ! Vapor Pressure Difference (mb) - real(r8) :: tcfbdiff ! Temp diff ref (C) - real(r8) :: p0ndplam ! dimensionless pressure modified by ref pressure - - real(r8) :: rsy2rs2 ! Constant function of humidity - real(r8) :: oty2rs ! Constant function of humidity - real(r8) :: y0tky1 ! Constant function of Temp - - real(r8) :: d2e_mbdT2 ! d2(es)/d(T)2 - real(r8) :: d2rsdT2 ! d2(r)/d(T)2 - real(r8) :: goftk ! g(T) exponential in f(T) - real(r8) :: gdT ! d(g)/d(T) - real(r8) :: d2gdT2 ! d2(g)/d(T)2 - - real(r8) :: d2fdT2 ! d2(f)/d(T)2 (K) -! -!----------------------------------------------------------------------- - ! Constants used to calculate es(T) - ! Clausius-Clapeyron - p_tmb = p_t*0.01_r8 - tcfbdiff = T_k - Cf + beta - es_mb = es_C*exp(alpha*(T_k - Cf)/(tcfbdiff)) - dlnes_mbdT = alpha*beta/((tcfbdiff)*(tcfbdiff)) - pminuse = p_tmb - es_mb - de_mbdT = es_mb*dlnes_mbdT - d2e_mbdT2 = dlnes_mbdT*(de_mbdT - 2*es_mb/(tcfbdiff)) - - ! Constants used to calculate rs(T) - ndimpress = (p_tmb/refpres)**vkp - p0ndplam = refpres*ndimpress**lambd_a - rs = epsilon*es_mb/(p0ndplam - es_mb) - prersdt = epsilon*p_tmb/((pminuse)*(pminuse)) - rsdT = prersdt*de_mbdT - d2rsdT2 = prersdt*(d2e_mbdT2 -de_mbdT*de_mbdT*(2._r8/(pminuse))) - - ! Constants used to calculate g(T) - rsy2rs2 = rs + y2*rs*rs - oty2rs = 1._r8 + 2._r8*y2*rs - y0tky1 = y0/T_k - y1 - goftk = y0tky1*(rs + y2*rs*rs) - gdT = - y0*(rsy2rs2)/(T_k*T_k) + (y0tky1)*(oty2rs)*rsdT - d2gdT2 = 2._r8*y0*rsy2rs2/(T_k*T_k*T_k) - 2._r8*y0*rsy2rs2*(oty2rs)*rsdT + & - y0tky1*2._r8*y2*rsdT*rsdT + y0tky1*oty2rs*d2rsdT2 - - ! Calculations for used to calculate f(T,ndimpress) - foftk = ((Cf/T_k)**lambd_a)*(1._r8 - es_mb/p0ndplam)**(vkp*lambd_a)* & - exp(-lambd_a*goftk) - fdT = -lambd_a*(1._r8/T_k + vkp*de_mbdT/pminuse + gdT) - d2fdT2 = lambd_a*(1._r8/(T_k*T_k) - vkp*de_mbdT*de_mbdT/(pminuse*pminuse) - & - vkp*d2e_mbdT2/pminuse - d2gdT2) - - end subroutine QSat_2 -!EOP -!----------------------------------------------------------------------- - -end module HumanIndexMod - diff --git a/src/biogeophys/HydrologyDrainageMod.F90 b/src/biogeophys/HydrologyDrainageMod.F90 deleted file mode 100644 index 3dd434661b..0000000000 --- a/src/biogeophys/HydrologyDrainageMod.F90 +++ /dev/null @@ -1,225 +0,0 @@ -module HydrologyDrainageMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates soil/snow hydrology with drainage (subsurface runoff) - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varctl , only : iulog, use_vichydro - use clm_varcon , only : e_ice, denh2o, denice, rpi, spval - use atm2lndType , only : atm2lnd_type - use glc2lndMod , only : glc2lnd_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use IrrigationMod , only : irrigation_type - use GlacierSurfaceMassBalanceMod, only : glacier_smb_type - use TotalWaterAndHeatMod, only : ComputeWaterMassNonLake - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: HydrologyDrainage ! Calculates soil/snow hydrolog with drainage - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine HydrologyDrainage(bounds, & - num_nolakec, filter_nolakec, & - num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - num_do_smb_c, filter_do_smb_c, & - atm2lnd_inst, glc2lnd_inst, temperature_inst, & - soilhydrology_inst, soilstate_inst, waterstate_inst, waterflux_inst, & - irrigation_inst, glacier_smb_inst) - ! - ! !DESCRIPTION: - ! Calculates soil/snow hydrology with drainage (subsurface runoff) - ! - ! !USES: - use landunit_varcon , only : istwet, istsoil, istice_mec, istcrop - use column_varcon , only : icol_roof, icol_road_imperv, icol_road_perv, icol_sunwall, icol_shadewall - use clm_varcon , only : denh2o, denice - use clm_varctl , only : use_vichydro - use clm_varpar , only : nlevgrnd, nlevurb - use clm_time_manager , only : get_step_size, get_nstep - use SoilHydrologyMod , only : CLMVICMap, Drainage, PerchedLateralFlow, LateralFlowPowerLaw - use SoilWaterMovementMod , only : use_aquifer_layer - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: num_do_smb_c ! number of columns in which SMB is calculated, in column filter - integer , intent(in) :: filter_do_smb_c(:) ! column filter for bare landwhere SMB is calculated - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(glc2lnd_type) , intent(in) :: glc2lnd_inst - type(temperature_type) , intent(in) :: temperature_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(irrigation_type) , intent(in) :: irrigation_inst - type(glacier_smb_type) , intent(in) :: glacier_smb_inst - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,j,fc ! indices - real(r8) :: dtime ! land model time step (sec) - !----------------------------------------------------------------------- - - associate( & ! Input: layer thickness depth (m) - dz => col%dz , & ! Input: column type - ctype => col%itype , & ! Input: gridcell flux of flood water from RTM - qflx_floodg => atm2lnd_inst%forc_flood_grc , & ! Input: rain rate [mm/s] - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: snow rate [mm/s] - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: water mass begining of the time step - begwb => waterstate_inst%begwb_col , & ! Output:water mass end of the time step - endwb => waterstate_inst%endwb_col , & ! Output:water mass end of the time step - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: liquid water (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Output: volumetric soil water - ! (0<=h2osoi_vol<=watsat) [m3/m3] - qflx_evap_tot => waterflux_inst%qflx_evap_tot_col , & ! Input: qflx_evap_soi + qflx_evap_can + qflx_tran_veg - qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col , & ! Input: excess solid h2o due to snow - ! capping (outgoing) (mm H2O /s) [+] - qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! excess solid h2o due to snow capping, - ! which we simply discard in order to reset - ! the snow pack (mm H2O /s) [+] - qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! excess liquid h2o due to snow capping, - ! which we simply discard in order to reset - ! the snow pack (mm H2O /s) [+] - qflx_h2osfc_surf => waterflux_inst%qflx_h2osfc_surf_col , & ! surface water runoff (mm/s) - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! sub-surface runoff from perched zwt (mm H2O /s) - qflx_rsub_sat => waterflux_inst%qflx_rsub_sat_col , & ! soil saturation excess [mm h2o/s] - qflx_drain => waterflux_inst%qflx_drain_col , & ! sub-surface runoff (mm H2O /s) - qflx_surf => waterflux_inst%qflx_surf_col , & ! surface runoff (mm H2O /s) - qflx_infl => waterflux_inst%qflx_infl_col , & ! infiltration (mm H2O /s) - qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! qflx_surf at glaciers, wetlands, lakes - qflx_runoff => waterflux_inst%qflx_runoff_col , & ! total runoff - ! (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - qflx_runoff_u => waterflux_inst%qflx_runoff_u_col , & ! Urban total runoff (qflx_drain+qflx_surf) (mm H2O /s) - qflx_runoff_r => waterflux_inst%qflx_runoff_r_col , & ! Rural total runoff - ! (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - qflx_ice_runoff_snwcp => waterflux_inst%qflx_ice_runoff_snwcp_col, & ! solid runoff from snow capping (mm H2O /s) - qflx_irrig => irrigation_inst%qflx_irrig_col & ! irrigation flux (mm H2O /s) - ) - - ! Determine time step and step size - - dtime = get_step_size() - - if (use_vichydro) then - call CLMVICMap(bounds, num_hydrologyc, filter_hydrologyc, & - soilhydrology_inst, waterstate_inst) - endif - - if (use_aquifer_layer()) then - call Drainage(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc,& - temperature_inst, soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - else - - call PerchedLateralFlow(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc,& - soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - - - call LateralFlowPowerLaw(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc,& - soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - - endif - - do j = 1, nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & - .or. ctype(c) == icol_roof) .and. j > nlevurb) then - else - h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) - end if - end do - end do - - call ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & - soilhydrology_inst, waterstate_inst, endwb(bounds%begc:bounds%endc)) - - - - - ! Determine wetland and land ice hydrology (must be placed here - ! since need snow updated from CombineSnowLayers) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - g = col%gridcell(c) - - if (lun%itype(l)==istwet .or. lun%itype(l)==istice_mec) then - - qflx_drain(c) = 0._r8 - qflx_drain_perched(c) = 0._r8 - qflx_h2osfc_surf(c) = 0._r8 - qflx_surf(c) = 0._r8 - qflx_infl(c) = 0._r8 - qflx_qrgwl(c) = forc_rain(c) + forc_snow(c) + qflx_floodg(g) - qflx_evap_tot(c) - qflx_snwcp_ice(c) - & - qflx_snwcp_discarded_ice(c) - qflx_snwcp_discarded_liq(c) - & - (endwb(c)-begwb(c))/dtime - - else if (lun%urbpoi(l) .and. ctype(c) /= icol_road_perv) then - - qflx_drain_perched(c) = 0._r8 - qflx_h2osfc_surf(c) = 0._r8 - qflx_rsub_sat(c) = spval - - end if - - qflx_ice_runoff_snwcp(c) = qflx_snwcp_ice(c) - end do - - ! This call needs to be here so that it comes after the initial calculation of - ! qflx_qrgwl and qflx_ice_runoff_snwcp, but before the ues of qflx_qrgwl in - ! qflx_runoff. - call glacier_smb_inst%AdjustRunoffTerms(bounds, num_do_smb_c, filter_do_smb_c, & - glc2lnd_inst, & - qflx_qrgwl = qflx_qrgwl(bounds%begc:bounds%endc), & - qflx_ice_runoff_snwcp = qflx_ice_runoff_snwcp(bounds%begc:bounds%endc)) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - - qflx_runoff(c) = qflx_drain(c) + qflx_surf(c) + qflx_h2osfc_surf(c) + qflx_qrgwl(c) + qflx_drain_perched(c) - - if ((lun%itype(l)==istsoil .or. lun%itype(l)==istcrop) .and. col%active(c)) then - qflx_runoff(c) = qflx_runoff(c) - qflx_irrig(c) - end if - if (lun%urbpoi(l)) then - qflx_runoff_u(c) = qflx_runoff(c) - else if (lun%itype(l)==istsoil .or. lun%itype(l)==istcrop) then - qflx_runoff_r(c) = qflx_runoff(c) - end if - - end do - - end associate - - end subroutine HydrologyDrainage - -end module HydrologyDrainageMod diff --git a/src/biogeophys/HydrologyNoDrainageMod.F90 b/src/biogeophys/HydrologyNoDrainageMod.F90 deleted file mode 100644 index 05dcb8a145..0000000000 --- a/src/biogeophys/HydrologyNoDrainageMod.F90 +++ /dev/null @@ -1,574 +0,0 @@ -Module HydrologyNoDrainageMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate snow and soil temperatures including phase change - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varctl , only : iulog, use_vichydro, use_fates - use clm_varcon , only : e_ice, denh2o, denice, rpi, spval - use CLMFatesInterfaceMod, only : hlm_fates_interface_type - use atm2lndType , only : atm2lnd_type - use AerosolMod , only : aerosol_type - use EnergyFluxType , only : energyflux_type - use TemperatureType , only : temperature_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use CanopyStateType , only : canopystate_type - use LandunitType , only : lun - use ColumnType , only : col - use TopoMod, only : topo_type - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: HydrologyNoDrainage ! Calculates soil/snow hydrology without drainage - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine HydrologyNoDrainage(bounds, & - num_nolakec, filter_nolakec, & - num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - num_snowc, filter_snowc, & - num_nosnowc, filter_nosnowc, & - clm_fates, & - atm2lnd_inst, soilstate_inst, energyflux_inst, temperature_inst, & - waterflux_inst, waterstate_inst, & - soilhydrology_inst, aerosol_inst, & - canopystate_inst, soil_water_retention_curve, topo_inst) - ! - ! !DESCRIPTION: - ! This is the main subroutine to execute the calculation of soil/snow - ! hydrology - ! Calling sequence is: - ! -> SnowWater: change of snow mass and snow water onto soil - ! -> SurfaceRunoff: surface runoff - ! -> Infiltration: infiltration into surface soil layer - ! -> SoilWater: soil water movement between layers - ! -> Tridiagonal tridiagonal matrix solution - ! -> Drainage: subsurface runoff - ! -> SnowCompaction: compaction of snow layers - ! -> CombineSnowLayers: combine snow layers that are thinner than minimum - ! -> DivideSnowLayers: subdivide snow layers that are thicker than maximum - ! - ! !USES: - use clm_varcon , only : denh2o, denice, hfus, grav, tfrz - use landunit_varcon , only : istwet, istsoil, istcrop, istdlak - use column_varcon , only : icol_roof, icol_road_imperv, icol_road_perv, icol_sunwall - use column_varcon , only : icol_shadewall - use clm_varctl , only : use_cn - use clm_varpar , only : nlevgrnd, nlevsno, nlevsoi, nlevurb - use clm_time_manager , only : get_step_size, get_nstep - use SnowHydrologyMod , only : SnowCompaction, CombineSnowLayers, DivideSnowLayers, SnowCapping - use SnowHydrologyMod , only : SnowWater, BuildSnowFilter - use SoilHydrologyMod , only : CLMVICMap, SurfaceRunoff, Infiltration, WaterTable, PerchedWaterTable - use SoilHydrologyMod , only : ThetaBasedWaterTable, RenewCondensation - use SoilWaterMovementMod , only : SoilWater - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use SoilWaterMovementMod , only : use_aquifer_layer - use SoilWaterPlantSinkMod , only : Compute_EffecRootFrac_And_VertTranSink - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(inout) :: num_snowc ! number of column snow points - integer , intent(inout) :: filter_snowc(:) ! column filter for snow points - integer , intent(inout) :: num_nosnowc ! number of column non-snow points - integer , intent(inout) :: filter_nosnowc(:) ! column filter for non-snow points - type(hlm_fates_interface_type), intent(inout) :: clm_fates - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(aerosol_type) , intent(inout) :: aerosol_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - class(topo_type) , intent(in) :: topo_inst - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,j,fc ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: psi,vwc,fsattmp,psifrz ! temporary variables for soilpsi calculation - real(r8) :: watdry ! temporary - real(r8) :: rwat(bounds%begc:bounds%endc) ! soil water wgted by depth to maximum depth of 0.5 m - real(r8) :: swat(bounds%begc:bounds%endc) ! same as rwat but at saturation - real(r8) :: rz(bounds%begc:bounds%endc) ! thickness of soil layers contributing to rwat (m) - real(r8) :: tsw ! volumetric soil water to 0.5 m - real(r8) :: stsw ! volumetric soil water to 0.5 m at saturation - real(r8) :: fracl ! fraction of soil layer contributing to 10cm total soil water - real(r8) :: s_node ! soil wetness (-) - real(r8) :: icefrac(bounds%begc:bounds%endc,1:nlevsoi) - !----------------------------------------------------------------------- - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface depth (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - ctype => col%itype , & ! Input: [integer (:) ] column type - - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - dTdz_top => temperature_inst%dTdz_top_col , & ! Output: [real(r8) (:) ] temperature gradient in top layer (col) [K m-1] ! - snot_top => temperature_inst%snot_top_col , & ! Output: [real(r8) (:) ] snow temperature in top layer (col) [K] - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - t_grnd => temperature_inst%t_grnd_col , & ! Output: [real(r8) (:) ] ground temperature (Kelvin) - t_grnd_u => temperature_inst%t_grnd_u_col , & ! Output: [real(r8) (:) ] Urban ground temperature (Kelvin) - t_grnd_r => temperature_inst%t_grnd_r_col , & ! Output: [real(r8) (:) ] Rural ground temperature (Kelvin) - tsl => temperature_inst%tsl_col , & ! Output: [real(r8) (:) ] temperature of near-surface soil layer (Kelvin) - t_soi_10cm => temperature_inst%t_soi10cm_col , & ! Output: [real(r8) (:) ] soil temperature in top 10cm of soil (Kelvin) - tsoi17 => temperature_inst%t_soi17cm_col , & ! Output: [real(r8) (:) ] soil temperature in top 17cm of soil (Kelvin) - t_sno_mul_mss => temperature_inst%t_sno_mul_mss_col , & ! Output: [real(r8) (:) ] col snow temperature multiplied by layer mass, layer sum (K * kg/m2) - - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height of snow covered area (m) - snowdp => waterstate_inst%snowdp_col , & ! Input: [real(r8) (:) ] area-averaged snow height (m) - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. snow cover fraction (col) [frc] - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - snw_rds => waterstate_inst%snw_rds_col , & ! Output: [real(r8) (:,:) ] effective snow grain radius (col,lyr) [microns, m^-6] - snw_rds_top => waterstate_inst%snw_rds_top_col , & ! Output: [real(r8) (:) ] effective snow grain size, top layer(col) [microns] - sno_liq_top => waterstate_inst%sno_liq_top_col , & ! Output: [real(r8) (:) ] liquid water fraction in top snow layer (col) [frc] - snowice => waterstate_inst%snowice_col , & ! Output: [real(r8) (:) ] average snow ice lens - snowliq => waterstate_inst%snowliq_col , & ! Output: [real(r8) (:) ] average snow liquid water - snow_persistence => waterstate_inst%snow_persistence_col , & ! Output: [real(r8) (:) ] counter for length of time snow-covered - h2osoi_liqice_10cm => waterstate_inst%h2osoi_liqice_10cm_col , & ! Output: [real(r8) (:) ] liquid water + ice lens in top 10cm of soil (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice_tot => waterstate_inst%h2osoi_ice_tot_col , & ! Output: [real(r8) (:) ] vertically summed ice lens (kg/m2) - h2osoi_liq_tot => waterstate_inst%h2osoi_liq_tot_col , & ! Output: [real(r8) (:) ] vertically summed liquid water (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - h2osno_top => waterstate_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer (col) [kg] - wf => waterstate_inst%wf_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.05 m - wf2 => waterstate_inst%wf2_col , & ! Output: [real(r8) (:) ] soil water as frac. of whc for top 0.17 m - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) - soilpsi => soilstate_inst%soilpsi_col & ! Output: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - ) - - ! Determine step size - - dtime = get_step_size() - - ! Determine initial snow/no-snow filters (will be modified possibly by - ! routines CombineSnowLayers and DivideSnowLayers below - - call BuildSnowFilter(bounds, num_nolakec, filter_nolakec, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - - ! Determine the change of snow mass and the snow water onto soil - - call SnowWater(bounds, num_snowc, filter_snowc, num_nosnowc, filter_nosnowc, & - atm2lnd_inst, waterflux_inst, waterstate_inst, aerosol_inst) - - ! mapping soilmoist from CLM to VIC layers for runoff calculations - if (use_vichydro) then - call CLMVICMap(bounds, num_hydrologyc, filter_hydrologyc, & - soilhydrology_inst, waterstate_inst) - end if - - call SurfaceRunoff(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - soilhydrology_inst, soilstate_inst, waterflux_inst, waterstate_inst) - - call Infiltration(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc,& - energyflux_inst, soilhydrology_inst, soilstate_inst, temperature_inst, & - waterflux_inst, waterstate_inst) - - call Compute_EffecRootFrac_And_VertTranSink(bounds, num_hydrologyc, & - filter_hydrologyc, soilstate_inst, canopystate_inst, waterflux_inst, energyflux_inst) - - if ( use_fates ) call clm_fates%ComputeRootSoilFlux(bounds, num_hydrologyc, filter_hydrologyc, soilstate_inst, waterflux_inst) - - call SoilWater(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - soilhydrology_inst, soilstate_inst, waterflux_inst, waterstate_inst, temperature_inst, & - canopystate_inst, energyflux_inst, soil_water_retention_curve) - - if (use_vichydro) then - ! mapping soilmoist from CLM to VIC layers for runoff calculations - call CLMVICMap(bounds, num_hydrologyc, filter_hydrologyc, & - soilhydrology_inst, waterstate_inst) - end if - - if (use_aquifer_layer()) then - call WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - soilhydrology_inst, soilstate_inst, temperature_inst, waterstate_inst, waterflux_inst) - else - - call PerchedWaterTable(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - temperature_inst, waterstate_inst, waterflux_inst) - - call ThetaBasedWaterTable(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - - call RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc,& - soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - - endif - - ! Snow capping - call SnowCapping(bounds, num_nolakec, filter_nolakec, num_snowc, filter_snowc, & - aerosol_inst, waterflux_inst, waterstate_inst, topo_inst) - - ! Natural compaction and metamorphosis. - call SnowCompaction(bounds, num_snowc, filter_snowc, & - temperature_inst, waterstate_inst, atm2lnd_inst) - - ! Combine thin snow elements - call CombineSnowLayers(bounds, num_snowc, filter_snowc, & - aerosol_inst, temperature_inst, waterflux_inst, waterstate_inst) - - ! Divide thick snow elements - call DivideSnowLayers(bounds, num_snowc, filter_snowc, & - aerosol_inst, temperature_inst, waterstate_inst, is_lake=.false.) - - ! Set empty snow layers to zero - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j <= snl(c) .and. snl(c) > -nlevsno) then - h2osoi_ice(c,j) = 0._r8 - h2osoi_liq(c,j) = 0._r8 - t_soisno(c,j) = 0._r8 - dz(c,j) = 0._r8 - z(c,j) = 0._r8 - zi(c,j-1) = 0._r8 - end if - end do - end do - - ! Build new snow filter - - call BuildSnowFilter(bounds, num_nolakec, filter_nolakec, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - - ! For columns where snow exists, accumulate 'time-covered-by-snow' counters. - ! Otherwise, re-zero counter, since it is bareland - - do fc = 1, num_snowc - c = filter_snowc(fc) - snow_persistence(c) = snow_persistence(c) + dtime - end do - do fc = 1, num_nosnowc - c = filter_nosnowc(fc) - snow_persistence(c) = 0._r8 - enddo - - ! Vertically average t_soisno and sum of h2osoi_liq and h2osoi_ice - ! over all snow layers for history output - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - snowice(c) = 0._r8 - snowliq(c) = 0._r8 - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - snowice(c) = snowice(c) + h2osoi_ice(c,j) - snowliq(c) = snowliq(c) + h2osoi_liq(c,j) - end if - end do - end do - - ! Calculate column average snow depth - do c = bounds%begc,bounds%endc - snowdp(c) = snow_depth(c) * frac_sno_eff(c) - end do - - ! Calculate snow internal temperature - ! - ! Snow internal (or: integrated) temperature is the average temperature of the entire - ! snowpack, weighted by the layer mass. In a formula this reads: - ! - ! SIT = [ Sum_t Sum_i w(t,i) * T(t,i) ] / - ! [ Sum_t Sum_i w(t,i) ] - ! - ! where - ! - ! t = time - ! i = layer index - ! w(t,i) = layer mass or weight (kg /m2) - ! T(t,i) = layer temperature (K) - ! - ! SIT can be calculated offline from two components: the nominator and denominator, which are output - ! separately. - ! - ! Both the nominator and denominator are scaled with a factor 1/Nstep, the number of time samples, - ! to make them independent of the number of time steps that were used in the averaging. - ! This is simply implemented as avgflag='A' in any calls to the history output routines. - ! - ! Snow packs without layers are not taken into account, as they have no temperature. - ! - ! The denominator Sum_t Sum_i w(t,i) is already output as SNOWICE and SNOWLIQ (mass of - ! snow in layered snowpacks). Note that these != H2OSNO which does account for layerless snowpacks. - ! - ! The nominator Sum_t Sum_i w(t,i) * T(t,i) is computed and stored as t_sno_mul_mss - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - t_sno_mul_mss(c) = 0._r8 - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - t_sno_mul_mss(c) = t_sno_mul_mss(c) + h2osoi_ice(c,j) * t_soisno(c,j) - t_sno_mul_mss(c) = t_sno_mul_mss(c) + h2osoi_liq(c,j) * tfrz - end if - end do - end do - - ! Determine ground temperature, ending water balance and volumetric soil water - ! Calculate temperature of near-surface soil layer - ! Calculate soil temperature and total water (liq+ice) in top 10cm of soil - ! Calculate soil temperature and total water (liq+ice) in top 17cm of soil - do fc = 1, num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - t_soi_10cm(c) = 0._r8 - tsoi17(c) = 0._r8 - h2osoi_liqice_10cm(c) = 0._r8 - h2osoi_liq_tot(c) = 0._r8 - h2osoi_ice_tot(c) = 0._r8 - end if - end do - do j = 1, nlevsoi - do fc = 1, num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j == 1) then - tsl(c) = t_soisno(c,j) - end if - ! soil T at top 17 cm added by F. Li and S. Levis - if (zi(c,j) <= 0.17_r8) then - fracl = 1._r8 - tsoi17(c) = tsoi17(c) + t_soisno(c,j)*dz(c,j)*fracl - else - if (zi(c,j) > 0.17_r8 .and. zi(c,j-1) < 0.17_r8) then - fracl = (0.17_r8 - zi(c,j-1))/dz(c,j) - tsoi17(c) = tsoi17(c) + t_soisno(c,j)*dz(c,j)*fracl - end if - end if - - if (zi(c,j) <= 0.1_r8) then - fracl = 1._r8 - t_soi_10cm(c) = t_soi_10cm(c) + t_soisno(c,j)*dz(c,j)*fracl - h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + & - (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & - fracl - else - if (zi(c,j) > 0.1_r8 .and. zi(c,j-1) < 0.1_r8) then - fracl = (0.1_r8 - zi(c,j-1))/dz(c,j) - t_soi_10cm(c) = t_soi_10cm(c) + t_soisno(c,j)*dz(c,j)*fracl - h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + & - (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & - fracl - end if - end if - - h2osoi_liq_tot(c) = h2osoi_liq_tot(c) + h2osoi_liq(c,j) - h2osoi_ice_tot(c) = h2osoi_ice_tot(c) + h2osoi_ice(c,j) - - end if - end do - end do - - ! TODO - if this block of code is moved out of here - the SoilHydrology - ! will NOT effect t_grnd, t_grnd_u or t_grnd_r - - do fc = 1, num_nolakec - - c = filter_nolakec(fc) - l = col%landunit(c) - - ! t_grnd is weighted average of exposed soil and snow - if (snl(c) < 0) then - t_grnd(c) = frac_sno_eff(c) * t_soisno(c,snl(c)+1) & - + (1 - frac_sno_eff(c)- frac_h2osfc(c)) * t_soisno(c,1) & - + frac_h2osfc(c) * t_h2osfc(c) - else - t_grnd(c) = (1 - frac_h2osfc(c)) * t_soisno(c,1) + frac_h2osfc(c) * t_h2osfc(c) - endif - - if (lun%urbpoi(l)) then - t_grnd_u(c) = t_soisno(c,snl(c)+1) - else - t_soi_10cm(c) = t_soi_10cm(c)/0.1_r8 - tsoi17(c) = tsoi17(c)/0.17_r8 ! F. Li and S. Levis - end if - if (lun%itype(l)==istsoil .or. lun%itype(l)==istcrop) then - t_grnd_r(c) = t_soisno(c,snl(c)+1) - end if - - end do - - do j = 1, nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if ((ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall & - .or. ctype(c) == icol_roof) .and. j > nlevurb) then - else - h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) - end if - end do - end do - -! if (use_cn) then - ! Update soilpsi. - ! ZMS: Note this could be merged with the following loop updating smp_l in the future. - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - if (h2osoi_liq(c,j) > 0._r8) then - - vwc = h2osoi_liq(c,j)/(dz(c,j)*denh2o) - - ! the following limit set to catch very small values of - ! fractional saturation that can crash the calculation of psi - - ! use the same contants used in the supercool so that psi for frozen soils is consistent - fsattmp = max(vwc/watsat(c,j), 0.001_r8) - psi = sucsat(c,j) * (-9.8e-6_r8) * (fsattmp)**(-bsw(c,j)) ! Mpa - soilpsi(c,j) = min(max(psi,-15.0_r8),0._r8) - - else - soilpsi(c,j) = -15.0_r8 - end if - end do - end do -! end if - - ! Update smp_l for history and for ch4Mod. - ! ZMS: Note, this form, which seems to be the same as used in SoilWater, DOES NOT distinguish between - ! ice and water volume, in contrast to the soilpsi calculation above. It won't be used in ch4Mod if - ! t_soisno <= tfrz, though. - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - s_node = min(1.0_r8, s_node) - - smp_l(c,j) = -sucsat(c,j)*s_node**(-bsw(c,j)) - smp_l(c,j) = max(smpmin(c), smp_l(c,j)) - end do - end do - - ! if (use_cn) then - ! Available soil water up to a depth of 0.05 m. - ! Potentially available soil water (=whc) up to a depth of 0.05 m. - ! Water content as fraction of whc up to a depth of 0.05 m. - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - rwat(c) = 0._r8 - swat(c) = 0._r8 - rz(c) = 0._r8 - end do - - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - !if (z(c,j)+0.5_r8*dz(c,j) <= 0.5_r8) then - if (z(c,j)+0.5_r8*dz(c,j) <= 0.05_r8) then - watdry = watsat(c,j) * (316230._r8/sucsat(c,j)) ** (-1._r8/bsw(c,j)) - rwat(c) = rwat(c) + (h2osoi_vol(c,j)-watdry) * dz(c,j) - swat(c) = swat(c) + (watsat(c,j) -watdry) * dz(c,j) - rz(c) = rz(c) + dz(c,j) - end if - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (rz(c) /= 0._r8) then - tsw = rwat(c)/rz(c) - stsw = swat(c)/rz(c) - else - watdry = watsat(c,1) * (316230._r8/sucsat(c,1)) ** (-1._r8/bsw(c,1)) - tsw = h2osoi_vol(c,1) - watdry - stsw = watsat(c,1) - watdry - end if - wf(c) = tsw/stsw - end do - - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (z(c,j)+0.5_r8*dz(c,j) <= 0.17_r8) then - watdry = watsat(c,j) * (316230._r8/sucsat(c,j)) ** (-1._r8/bsw(c,j)) - rwat(c) = rwat(c) + (h2osoi_vol(c,j)-watdry) * dz(c,j) - swat(c) = swat(c) + (watsat(c,j) -watdry) * dz(c,j) - rz(c) = rz(c) + dz(c,j) - end if - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (rz(c) /= 0._r8) then - tsw = rwat(c)/rz(c) - stsw = swat(c)/rz(c) - else - watdry = watsat(c,1) * (316230._r8/sucsat(c,1)) ** (-1._r8/bsw(c,1)) - tsw = h2osoi_vol(c,1) - watdry - stsw = watsat(c,1) - watdry - end if - wf2(c) = tsw/stsw - end do - ! end if - - ! top-layer diagnostics - do fc = 1, num_snowc - c = filter_snowc(fc) - h2osno_top(c) = h2osoi_ice(c,snl(c)+1) + h2osoi_liq(c,snl(c)+1) - enddo - - ! Zero variables in columns without snow - do fc = 1, num_nosnowc - c = filter_nosnowc(fc) - - h2osno_top(c) = 0._r8 - snw_rds(c,:) = 0._r8 - - ! top-layer diagnostics (spval is not averaged when computing history fields) - snot_top(c) = spval - dTdz_top(c) = spval - snw_rds_top(c) = spval - sno_liq_top(c) = spval - end do - - end associate - - end subroutine HydrologyNoDrainage - -end Module HydrologyNoDrainageMod diff --git a/src/biogeophys/IrrigationMod.F90 b/src/biogeophys/IrrigationMod.F90 deleted file mode 100644 index cccb8dbc6b..0000000000 --- a/src/biogeophys/IrrigationMod.F90 +++ /dev/null @@ -1,1206 +0,0 @@ -module IrrigationMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates irrigation flux. - ! - ! Usage: - ! - ! - Call CalcIrrigationNeeded in order to compute whether and how much irrigation is - ! needed for the next call to ApplyIrrigation. This should be called once per - ! timestep. - ! - ! - Call ApplyIrrigation in order to calculate qflx_irrig. This should be called - ! exactly once per time step, before the first time qflx_irrig is needed by other - ! parts of the code. It is acceptable for this to be called earlier in the timestep - ! than CalcIrrigationNeeded. - ! - ! - Access the timestep's irrigation flux via qflx_irrig_patch or - ! qflx_irrig_col. These should be treated as read-only. - ! - ! Design notes: - ! - ! In principle, ApplyIrrigation and CalcIrrigationNeeded could be combined into a - ! single routine. Their separation is largely for historical reasons: In the past, - ! irrigation depended on btran, and qflx_irrig is needed earlier in the driver loop - ! than when btran becomes available. (And qflx_irrig is also used late in the driver - ! loop - so it wouldn't work, for example, to calculate qflx_irrig after btran is - ! computed, and then save it on the restart file for the next iteration of the driver - ! loop: then the uses of qflx_irrig early and late in the driver loop would be - ! inconsistent.) - ! - ! Now that we no longer have a dependency on btran, we could call CalcIrrigationNeeded - ! before the first time qflx_irrig is needed. Thus, there might be some advantage to - ! combining ApplyIrrigation and CalcIrrigationNeeded - or at least calling these two - ! routines from the same place. In particular: this separation of the irrigation - ! calculation into two routines that are done at different times in the driver loop - ! makes it harder and less desirable to nest the irrigation object within some other - ! object: Doing so might make it harder to do the two separate steps at the right - ! time, and would lead to less clarity about how these two steps are ordered with - ! respect to the rest of the driver loop. So if we start trying to create a hierarchy - ! of objects in CLM, we may want to rework this design. And we may want to rework it - ! to keep things simpler anyway, even if we aren't nesting objects. Note that this - ! rework would change behavior slightly, because irrigation would be applied in the - ! same time step that CalcIrrigationNeeded first determines it's needed, rather than - ! waiting until the following time step. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type, get_proc_global - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : isecspday, degpsec, denh2o, spval, namec - use clm_varpar , only : nlevsoi, nlevgrnd - use clm_time_manager , only : get_step_size - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use GridcellType , only : grc - use ColumnType , only : col - use PatchType , only : patch - use subgridAveMod , only : p2c, c2g - use filterColMod , only : filter_col_type, col_filter_from_logical_array - ! - implicit none - private - - ! !PUBLIC TYPES: - - ! This type is public (and its components are public, too) to aid unit testing - type, public :: irrigation_params_type - ! Minimum LAI for irrigation - real(r8) :: irrig_min_lai - - ! Time of day to check whether we need irrigation, seconds (0 = midnight). - ! We start applying the irrigation in the time step FOLLOWING this time, - ! since we won't begin irrigating until the next call to ApplyIrrigation - integer :: irrig_start_time - - ! Desired amount of time to irrigate per day (sec). Actual time may - ! differ if this is not a multiple of dtime. Irrigation won't work properly - ! if dtime > secsperday - integer :: irrig_length - - ! Target soil matric potential for irrigation (mm) - ! - ! When we irrigate, we aim to bring the total soil moisture in the top (irrig_depth) - ! m of soil up to this level. - ! - ! (Note: When we convert this to a relative saturation, we ensure that the relative - ! saturation target is bounded by [0,1].) - real(r8) :: irrig_target_smp - - ! Soil depth to which we measure for irrigation (m) - real(r8) :: irrig_depth - - ! Determines soil moisture threshold at which we irrigate. If - ! h2osoi_liq_wilting_point is the soil moisture level at wilting point and - ! h2osoi_liq_target is the soil moisture level at the target irrigation level (given - ! by irrig_target_smp), then the threshold at which we irrigate is - ! h2osoi_liq_wilting_point + - ! irrig_threshold_fraction*(h2osoi_liq_target - h2osoi_liq_wilting_point) - ! A value of 1 means that we irrigate whenever soil moisture falls below the target - ! A value of 0 means that we only irrigate when soil moisture falls below the - ! wilting point - real(r8) :: irrig_threshold_fraction - - ! Threshold for river water volume below which irrigation is shut off, if - ! limit_irrigation is .true. (fraction of available river water). A threshold of 0 - ! means allow all river water to be used; a threshold of 0.1 means allow 90% of the - ! river volume to be used; etc. - real(r8) :: irrig_river_volume_threshold - - ! Whether irrigation is limited based on river storage. This only applies if ROF is - ! enabled (i.e., rof_prognostic is .true.) - otherwise we don't limit irrigation, - ! regardless of the value of this flag. - logical :: limit_irrigation_if_rof_enabled - - end type irrigation_params_type - - - type, public :: irrigation_type - private - ! Public data members - ! Note: these should be treated as read-only by other modules - real(r8), pointer, public :: qflx_irrig_patch(:) ! patch irrigation flux (mm H2O/s) - real(r8), pointer, public :: qflx_irrig_col (:) ! col irrigation flux (mm H2O/s) - - ! Private data members; set in initialization: - type(irrigation_params_type) :: params - integer :: dtime ! land model time step (sec) - integer :: irrig_nsteps_per_day ! number of time steps per day in which we irrigate - real(r8), pointer :: relsat_wilting_point_col(:,:) ! relative saturation at which smp = wilting point [col, nlevsoi] - real(r8), pointer :: relsat_target_col(:,:) ! relative saturation at which smp is at the irrigation target [col, nlevsoi] - - ! Private data members; time-varying: - real(r8), pointer :: irrig_rate_patch (:) ! current irrigation rate [mm/s] - real(r8), pointer :: irrig_rate_demand_patch (:) ! current irrigation rate, neglecting surface water source limitation [mm/s] - integer , pointer :: n_irrig_steps_left_patch (:) ! number of time steps for which we still need to irrigate today (if 0, ignore) - real(r8), pointer :: qflx_irrig_demand_patch (:) ! irrigation flux neglecting surface water source limitation [mm/s] - - contains - ! Public routines - ! COMPILER_BUG(wjs, 2014-10-15, pgi 14.7) Add an "Irrigation" prefix to some generic routines like "Init" - ! (without this workaround, pgi compilation fails in restFileMod) - procedure, public :: Init => IrrigationInit - procedure, public :: Restart - procedure, public :: ApplyIrrigation - procedure, public :: CalcIrrigationNeeded - procedure, public :: Clean => IrrigationClean ! deallocate memory - - ! Public simply to support unit testing; should not be used from CLM code - procedure, public :: InitForTesting ! version of Init meant for unit testing - procedure, public :: RelsatToH2osoi ! convert from relative saturation to kg/m2 water for a single column and layer - - ! Private routines - procedure, private :: ReadNamelist - procedure, private :: CheckNamelistValidity ! Check for validity of input parameters - procedure, private :: InitAllocate => IrrigationInitAllocate - procedure, private :: InitHistory => IrrigationInitHistory - procedure, private :: InitCold => IrrigationInitCold - procedure, private :: CalcIrrigNstepsPerDay ! given dtime, calculate irrig_nsteps_per_day - procedure, private :: PointNeedsCheckForIrrig ! whether a given point needs to be checked for irrigation now - procedure, private :: CalcDeficitVolrLimited ! calculate deficit limited by river volume for each patch - end type irrigation_type - - interface irrigation_params_type - module procedure irrigation_params_constructor - end interface irrigation_params_type - - ! Soil matric potential at wilting point (mm) - ! - ! There is no reason to make this a tunable parameter, because the behavior it governs - ! (the trigger for irrigation) can be tuned via other parameters. - ! - ! TODO(wjs, 2016-09-08) It looks like there is other code in CLM that also uses an - ! assumed wilting point (CNRootDynMod, maybe others). We should probably make this a - ! shared parameter, e.g., in clm_varcon. - real(r8), parameter, private :: wilting_point_smp = -150000._r8 - - ! Conversion factors - real(r8), parameter :: m3_over_km2_to_mm = 1.e-3_r8 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function irrigation_params_constructor(irrig_min_lai, & - irrig_start_time, irrig_length, & - irrig_target_smp, & - irrig_depth, irrig_threshold_fraction, irrig_river_volume_threshold, & - limit_irrigation_if_rof_enabled) & - result(this) - ! - ! !DESCRIPTION: - ! Create an irrigation_params instance - ! - ! !USES: - ! - ! !ARGUMENTS: - type(irrigation_params_type) :: this ! function result - real(r8), intent(in) :: irrig_min_lai - integer , intent(in) :: irrig_start_time - integer , intent(in) :: irrig_length - real(r8), intent(in) :: irrig_target_smp - real(r8), intent(in) :: irrig_depth - real(r8), intent(in) :: irrig_threshold_fraction - real(r8), intent(in) :: irrig_river_volume_threshold - logical , intent(in) :: limit_irrigation_if_rof_enabled - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'irrigation_params_constructor' - !----------------------------------------------------------------------- - - this%irrig_min_lai = irrig_min_lai - this%irrig_start_time = irrig_start_time - this%irrig_length = irrig_length - this%irrig_depth = irrig_depth - this%irrig_target_smp = irrig_target_smp - this%irrig_threshold_fraction = irrig_threshold_fraction - this%irrig_river_volume_threshold = irrig_river_volume_threshold - this%limit_irrigation_if_rof_enabled = limit_irrigation_if_rof_enabled - - end function irrigation_params_constructor - - - ! ======================================================================== - ! Infrastructure routines (initialization, restart, etc.) - ! ======================================================================== - - !------------------------------------------------------------------------ - subroutine IrrigationInit(this, bounds, NLFilename, & - soilstate_inst, soil_water_retention_curve) - use SoilStateType , only : soilstate_type - - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! Namelist filename - type(soilstate_type) , intent(in) :: soilstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - - call this%ReadNamelist(NLFilename) - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds, soilstate_inst, soil_water_retention_curve) - end subroutine IrrigationInit - - !----------------------------------------------------------------------- - subroutine InitForTesting(this, bounds, params, dtime, & - relsat_wilting_point, relsat_target) - ! - ! !DESCRIPTION: - ! Does initialization needed for unit testing. Allows caller to prescribe values of - ! some internal variables. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - type(irrigation_params_type) , intent(in) :: params - integer , intent(in) :: dtime ! model time step (sec) - real(r8) , intent(in) :: relsat_wilting_point( bounds%begc: , 1: ) ! relative saturation at which smp = irrig_wilting_point_smp [col, nlevsoi] - real(r8) , intent(in) :: relsat_target( bounds%begc: , 1: ) ! relative saturation at which smp = irrig_target_smp [col, nlevsoi] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitForTesting' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(relsat_wilting_point) == (/bounds%endc, nlevsoi/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(relsat_target) == (/bounds%endc, nlevsoi/)), errMsg(sourcefile, __LINE__)) - - call this%InitAllocate(bounds) - this%params = params - this%dtime = dtime - this%irrig_nsteps_per_day = this%CalcIrrigNstepsPerDay(dtime) - this%relsat_wilting_point_col(:,:) = relsat_wilting_point(:,:) - this%relsat_target_col(:,:) = relsat_target(:,:) - - end subroutine InitForTesting - - !----------------------------------------------------------------------- - subroutine ReadNamelist(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the irrigation namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - class(irrigation_type) , intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - ! temporary variables corresponding to the components of irrigation_params_type - real(r8) :: irrig_min_lai - integer :: irrig_start_time - integer :: irrig_length - real(r8) :: irrig_target_smp - real(r8) :: irrig_depth - real(r8) :: irrig_threshold_fraction - real(r8) :: irrig_river_volume_threshold - logical :: limit_irrigation_if_rof_enabled - - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=*), parameter :: nmlname = 'irrigation_inparm' - - character(len=*), parameter :: subname = 'ReadNamelist' - !----------------------------------------------------------------------- - - namelist /irrigation_inparm/ irrig_min_lai, irrig_start_time, irrig_length, & - irrig_target_smp, irrig_depth, irrig_threshold_fraction, & - irrig_river_volume_threshold, limit_irrigation_if_rof_enabled - - ! Initialize options to garbage defaults, forcing all to be specified explicitly in - ! order to get reasonable results - irrig_min_lai = nan - irrig_start_time = 0 - irrig_length = 0 - irrig_target_smp = nan - irrig_depth = nan - irrig_threshold_fraction = nan - irrig_river_volume_threshold = nan - limit_irrigation_if_rof_enabled = .false. - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=irrigation_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast(irrig_min_lai, mpicom) - call shr_mpi_bcast(irrig_start_time, mpicom) - call shr_mpi_bcast(irrig_length, mpicom) - call shr_mpi_bcast(irrig_target_smp, mpicom) - call shr_mpi_bcast(irrig_depth, mpicom) - call shr_mpi_bcast(irrig_threshold_fraction, mpicom) - call shr_mpi_bcast(irrig_river_volume_threshold, mpicom) - call shr_mpi_bcast(limit_irrigation_if_rof_enabled, mpicom) - - this%params = irrigation_params_type( & - irrig_min_lai = irrig_min_lai, & - irrig_start_time = irrig_start_time, & - irrig_length = irrig_length, & - irrig_target_smp = irrig_target_smp, & - irrig_depth = irrig_depth, & - irrig_threshold_fraction = irrig_threshold_fraction, & - irrig_river_volume_threshold = irrig_river_volume_threshold, & - limit_irrigation_if_rof_enabled = limit_irrigation_if_rof_enabled) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - ! Write settings one-by-one rather than with a nml write because - ! irrig_river_volume_threshold may be NaN - write(iulog,*) 'irrig_min_lai = ', irrig_min_lai - write(iulog,*) 'irrig_start_time = ', irrig_start_time - write(iulog,*) 'irrig_length = ', irrig_length - write(iulog,*) 'irrig_target_smp = ', irrig_target_smp - write(iulog,*) 'irrig_depth = ', irrig_depth - write(iulog,*) 'irrig_threshold_fraction = ', irrig_threshold_fraction - write(iulog,*) 'limit_irrigation_if_rof_enabled = ', limit_irrigation_if_rof_enabled - if (limit_irrigation_if_rof_enabled) then - write(iulog,*) 'irrig_river_volume_threshold = ', irrig_river_volume_threshold - end if - write(iulog,*) ' ' - - call this%CheckNamelistValidity() - end if - - end subroutine ReadNamelist - - !----------------------------------------------------------------------- - subroutine CheckNamelistValidity(this) - ! - ! !DESCRIPTION: - ! Check for validity of input parameters. - ! - ! Assumes that the inputs have already been packed into 'this%params'. - ! - ! Only needs to be called by the master task, since parameters are the same for all - ! tasks. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(irrigation_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'CheckNamelistValidity' - !----------------------------------------------------------------------- - - associate( & - irrig_min_lai => this%params%irrig_min_lai, & - irrig_start_time => this%params%irrig_start_time, & - irrig_length => this%params%irrig_length, & - irrig_target_smp => this%params%irrig_target_smp, & - irrig_depth => this%params%irrig_depth, & - irrig_threshold_fraction => this%params%irrig_threshold_fraction, & - irrig_river_volume_threshold => this%params%irrig_river_volume_threshold, & - limit_irrigation_if_rof_enabled => this%params%limit_irrigation_if_rof_enabled) - - if (irrig_min_lai < 0._r8) then - write(iulog,*) ' ERROR: irrig_min_lai must be >= 0' - write(iulog,*) ' irrig_min_lai = ', irrig_min_lai - call endrun(msg=' ERROR: irrig_min_lai must be >= 0 ' // errMsg(sourcefile, __LINE__)) - end if - - if (irrig_start_time < 0 .or. irrig_start_time >= isecspday) then - write(iulog,*) ' ERROR: irrig_start_time must be >= 0 and < ', isecspday - write(iulog,*) ' irrig_start_time = ', irrig_start_time - call endrun(msg=' ERROR: irrig_start_time out of bounds ' // errMsg(sourcefile, __LINE__)) - end if - - if (irrig_length <= 0 .or. irrig_length > isecspday) then - write(iulog,*) ' ERROR: irrig_length must be > 0 and <= ', isecspday - write(iulog,*) ' irrig_length = ', irrig_length - call endrun(msg=' ERROR: irrig_length out of bounds ' // errMsg(sourcefile, __LINE__)) - end if - - if (irrig_target_smp >= 0._r8) then - write(iulog,*) ' ERROR: irrig_target_smp must be negative' - write(iulog,*) ' irrig_target_smp = ', irrig_target_smp - call endrun(msg=' ERROR: irrig_target_smp must be negative ' // errMsg(sourcefile, __LINE__)) - end if - - if (irrig_target_smp < wilting_point_smp) then - write(iulog,*) ' ERROR: irrig_target_smp must be >= wilting_point_smp' - write(iulog,*) ' irrig_target_smp (from namelist) = ', irrig_target_smp - write(iulog,*) ' wilting_point_smp (hard-coded) = ', wilting_point_smp - call endrun(msg=' ERROR: irrig_target_smp must be >= wilting_point_smp ' // errMsg(sourcefile, __LINE__)) - end if - - if (irrig_depth < 0._r8) then - write(iulog,*) ' ERROR: irrig_depth must be > 0' - write(iulog,*) ' irrig_depth = ', irrig_depth - call endrun(msg=' ERROR: irrig_depth must be > 0 ' // errMsg(sourcefile, __LINE__)) - end if - - if (irrig_threshold_fraction < 0._r8 .or. irrig_threshold_fraction > 1._r8) then - write(iulog,*) ' ERROR: irrig_threshold_fraction must be between 0 and 1' - write(iulog,*) ' irrig_threshold_fraction = ', irrig_threshold_fraction - call endrun(msg=' ERROR: irrig_threshold_fraction must be between 0 and 1 ' // & - errMsg(sourcefile, __LINE__)) - end if - - if (limit_irrigation_if_rof_enabled) then - if (irrig_river_volume_threshold < 0._r8 .or. irrig_river_volume_threshold > 1._r8) then - write(iulog,*) ' ERROR: irrig_river_volume_threshold must be between 0 and 1' - write(iulog,*) ' irrig_river_volume_threshold = ', irrig_river_volume_threshold - call endrun(msg=' ERROR: irrig_river_volume_threshold must be between 0 and 1 ' // & - errMsg(sourcefile, __LINE__)) - end if - end if - - end associate - - end subroutine CheckNamelistValidity - - - !----------------------------------------------------------------------- - subroutine IrrigationInitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize irrigation data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%qflx_irrig_patch (begp:endp)) ; this%qflx_irrig_patch (:) = nan - allocate(this%qflx_irrig_demand_patch (begp:endp)) ; this%qflx_irrig_demand_patch (:) = nan - allocate(this%qflx_irrig_col (begc:endc)) ; this%qflx_irrig_col (:) = nan - allocate(this%relsat_wilting_point_col (begc:endc,nlevsoi)) ; this%relsat_wilting_point_col (:,:) = nan - allocate(this%relsat_target_col (begc:endc,nlevsoi)) ; this%relsat_target_col (:,:) = nan - allocate(this%irrig_rate_patch (begp:endp)) ; this%irrig_rate_patch (:) = nan - allocate(this%irrig_rate_demand_patch (begp:endp)) ; this%irrig_rate_demand_patch (:) = nan - allocate(this%n_irrig_steps_left_patch (begp:endp)) ; this%n_irrig_steps_left_patch (:) = 0 - - end subroutine IrrigationInitAllocate - - !----------------------------------------------------------------------- - subroutine IrrigationInitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize irrigation history fields - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - - this%qflx_irrig_patch(begp:endp) = spval - call hist_addfld1d (fname='QIRRIG', units='mm/s', & - avgflag='A', long_name='water added through irrigation', & - ptr_patch=this%qflx_irrig_patch) - - this%qflx_irrig_demand_patch(begp:endp) = spval - call hist_addfld1d (fname='QIRRIG_DEMAND', units='mm/s', & - avgflag='A', long_name='irrigation demand', & - ptr_patch=this%qflx_irrig_demand_patch, default='inactive') - - end subroutine IrrigationInitHistory - - !----------------------------------------------------------------------- - subroutine IrrigationInitCold(this, bounds, soilstate_inst, soil_water_retention_curve) - ! - ! !DESCRIPTION: - ! Do cold-start initialization for irrigation data structure - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - type(soilstate_type) , intent(in) :: soilstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - ! - ! !LOCAL VARIABLES: - integer :: c ! col index - integer :: j ! level index - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - do j = 1, nlevsoi - do c = bounds%begc, bounds%endc - call soil_water_retention_curve%soil_suction_inverse( & - c = c, & - j = j, & - smp_target = wilting_point_smp, & - soilstate_inst = soilstate_inst, & - s_target = this%relsat_wilting_point_col(c,j)) - - call soil_water_retention_curve%soil_suction_inverse( & - c = c, & - j = j, & - smp_target = this%params%irrig_target_smp, & - soilstate_inst = soilstate_inst, & - s_target = this%relsat_target_col(c,j)) - - ! Make sure relative saturation targets are bounded by [0,1] - ! - ! NOTE(wjs, 2016-11-17) These targets can be > 1 if smp_target is too small of - ! a negative value; we want to force the target to a relative saturation of 1 - ! in that case. I don't see how these targets could end up negative, though I - ! had a note that I saw negative values at one point. In practice, for - ! reasonable parameter values, it seems that these min and max functions have - ! no effect. - this%relsat_wilting_point_col(c,j) = min(this%relsat_wilting_point_col(c,j), 1._r8) - this%relsat_wilting_point_col(c,j) = max(this%relsat_wilting_point_col(c,j), 0._r8) - this%relsat_target_col(c,j) = min(this%relsat_target_col(c,j), 1._r8) - this%relsat_target_col(c,j) = max(this%relsat_target_col(c,j), 0._r8) - end do - end do - - this%dtime = get_step_size() - this%irrig_nsteps_per_day = this%CalcIrrigNstepsPerDay(this%dtime) - - end subroutine IrrigationInitCold - - !----------------------------------------------------------------------- - pure function CalcIrrigNstepsPerDay(this, dtime) result(irrig_nsteps_per_day) - ! - ! !DESCRIPTION: - ! Given dtime (sec), determine number of irrigation steps per day - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: irrig_nsteps_per_day ! function result - class(irrigation_type) , intent(in) :: this - integer , intent(in) :: dtime ! model time step (sec) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'CalcIrrigNstepsPerDay' - !----------------------------------------------------------------------- - - irrig_nsteps_per_day = ((this%params%irrig_length + (dtime - 1))/dtime) ! round up - - end function CalcIrrigNstepsPerDay - - - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart of irrigation variables - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_inqvdlen, ncd_double, ncd_int - use restUtilMod - ! - ! !ARGUMENTS: - class(irrigation_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - ! - ! !LOCAL VARIABLES: - logical :: do_io - integer :: dimlen ! dimension length - integer :: nump_global ! total number of patchs, globally - integer :: err_code ! error code - logical :: readvar ! determine if variable is on initial file - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - ! Get expected total number of points, for later error checks - call get_proc_global(np=nump_global) - - do_io = .true. - readvar = .false. - if (flag == 'read') then - ! BACKWARDS_COMPATIBILITY - ! On a read, confirm that this variable has the expected size; if not, don't read - ! it (instead give it a default value). This is needed to support older initial - ! conditions for which this variable had a different size. - call ncd_inqvdlen(ncid, 'n_irrig_steps_left', 1, dimlen, err_code) - if (dimlen /= nump_global) then - do_io = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='n_irrig_steps_left', xtype=ncd_int, & - dim1name='pft', & - long_name='number of irrigation time steps left', units='#', & - interpinic_flag='interp', readvar=readvar, data=this%n_irrig_steps_left_patch) - end if - if (flag=='read' .and. .not. readvar) then - this%n_irrig_steps_left_patch = 0 - end if - - do_io = .true. - readvar = .false. - if (flag == 'read') then - ! BACKWARDS_COMPATIBILITY - ! On a read, confirm that this variable has the expected size; if not, don't read - ! it (instead give it a default value). This is needed to support older initial - ! conditions for which this variable had a different size. - call ncd_inqvdlen(ncid, 'irrig_rate', 1, dimlen, err_code) - if (dimlen /= nump_global) then - do_io = .false. - end if - end if - if (do_io) then - call restartvar(ncid=ncid, flag=flag, varname='irrig_rate', xtype=ncd_double, & - dim1name='pft', & - long_name='irrigation rate', units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%irrig_rate_patch) - end if - if (flag=='read' .and. .not. readvar) then - this%irrig_rate_patch = 0.0_r8 - end if - - ! BACKWARDS_COMPATIBILITY(wjs, 2016-11-23) To support older restart files without an - ! irrig_rate_demand field, get irrig_rate_demand from irrig_rate. I'm abusing the - ! capability to specify multiple variable names here (even though irrig_rate isn't - ! really an old version of irrig_rate_demand), rather than having code like 'if - ! (.not. readvar) then ...', because the latter doesn't work when using init_interp. - call restartvar(ncid=ncid, flag=flag, varname='irrig_rate_demand:irrig_rate', & - xtype=ncd_double, & - dim1name='pft', & - long_name='irrigation rate demand, neglecting surface water source limitation', & - units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%irrig_rate_demand_patch) - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine IrrigationClean(this) - ! - ! !DESCRIPTION: - ! Deallocate memory - ! - ! !ARGUMENTS: - class(irrigation_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate(this%qflx_irrig_patch) - deallocate(this%qflx_irrig_demand_patch) - deallocate(this%qflx_irrig_col) - deallocate(this%relsat_wilting_point_col) - deallocate(this%relsat_target_col) - deallocate(this%irrig_rate_patch) - deallocate(this%irrig_rate_demand_patch) - deallocate(this%n_irrig_steps_left_patch) - - end subroutine IrrigationClean - - - ! ======================================================================== - ! Science routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine ApplyIrrigation(this, bounds) - ! - ! !DESCRIPTION: - ! Apply the irrigation computed by CalcIrrigationNeeded to qflx_irrig. - ! - ! Should be called once, AND ONLY ONCE, per time step. After this is called, you may - ! access qflx_irrig_patch or qflx_irrig_col. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p ! patch index - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'ApplyIrrigation' - - !----------------------------------------------------------------------- - - ! This should be called exactly once per time step, so that this counter decrease - ! works correctly. - - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - - if (this%n_irrig_steps_left_patch(p) > 0) then - this%qflx_irrig_patch(p) = this%irrig_rate_patch(p) - this%qflx_irrig_demand_patch(p) = this%irrig_rate_demand_patch(p) - this%n_irrig_steps_left_patch(p) = this%n_irrig_steps_left_patch(p) - 1 - else - this%qflx_irrig_patch(p) = 0._r8 - this%qflx_irrig_demand_patch(p) = 0._r8 - end if - - end do - - call p2c (bounds = bounds, & - parr = this%qflx_irrig_patch(bounds%begp:bounds%endp), & - carr = this%qflx_irrig_col(bounds%begc:bounds%endc), & - p2c_scale_type = 'unity') - - end subroutine ApplyIrrigation - - - !----------------------------------------------------------------------- - subroutine CalcIrrigationNeeded(this, bounds, num_exposedvegp, filter_exposedvegp, & - time_prev, elai, t_soisno, eff_porosity, h2osoi_liq, volr, rof_prognostic) - ! - ! !DESCRIPTION: - ! Calculate whether and how much irrigation is needed for each column. However, this - ! does NOT actually set the irrigation flux. - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - ! time of day (in seconds since 0Z) at start of timestep - integer, intent(in) :: time_prev - - ! number of points in filter_exposedvegp - integer, intent(in) :: num_exposedvegp - - ! patch filter for non-snow-covered veg - integer, intent(in) :: filter_exposedvegp(:) - - ! one-sided leaf area index with burying by snow [patch] - real(r8), intent(in) :: elai( bounds%begp: ) - - ! col soil temperature (K) [col, nlevgrnd] (note that this does NOT contain the snow levels) - real(r8), intent(in) :: t_soisno( bounds%begc: , 1: ) - - ! effective porosity (0 to 1) [col, nlevgrnd] - real(r8), intent(in) :: eff_porosity( bounds%begc: , 1: ) - - ! column liquid water (kg/m2) [col, nlevgrnd] (note that this does NOT contain the snow levels) - real(r8), intent(in) :: h2osoi_liq( bounds%begc: , 1: ) - - ! river water volume (m3) (ignored if rof_prognostic is .false.) - real(r8), intent(in) :: volr( bounds%begg: ) - - ! whether we're running with a prognostic ROF component; this is needed to determine - ! whether we can limit irrigation based on river volume. - logical, intent(in) :: rof_prognostic - - ! - ! !LOCAL VARIABLES: - integer :: fp ! patch filter index - integer :: fc ! column filter index - integer :: p ! patch index - integer :: c ! column index - integer :: g ! gridcell index - integer :: j ! level - - ! Filter for columns where we need to check for irrigation - type(filter_col_type) :: check_for_irrig_col_filter - - ! target soil moisture for this layer [kg/m2] - real(r8) :: h2osoi_liq_target - - ! soil moisture at wilting point for this layer [kg/m2] - real(r8) :: h2osoi_liq_wilting_point - - ! Total of h2osoi down to the depth of irrigation in each column [kg/m2] - real(r8) :: h2osoi_liq_tot(bounds%begc:bounds%endc) - - ! Total of h2osoi_liq_target down to the depth of irrigation in each column [kg/m2] - real(r8) :: h2osoi_liq_target_tot(bounds%begc:bounds%endc) - - ! Total of h2osoi_liq at wilting point down to the depth of irrigation in each column - ! [kg/m2] - real(r8) :: h2osoi_liq_wilting_point_tot(bounds%begc:bounds%endc) - - ! h2osoi_liq at the threshold for irrigation in this column [kg/m2] - real(r8) :: h2osoi_liq_at_threshold - - ! difference between desired soil moisture level for each column and current soil - ! moisture level [kg/m2] [i.e., mm] - real(r8) :: deficit(bounds%begc:bounds%endc) - - ! deficit limited by river volume [kg/m2] [i.e., mm] - real(r8) :: deficit_volr_limited(bounds%begc:bounds%endc) - - ! where do we need to check soil moisture to see if we need to irrigate? - logical :: check_for_irrig_patch(bounds%begp:bounds%endp) - logical :: check_for_irrig_col(bounds%begc:bounds%endc) - - ! set to true once we have reached the max allowable depth for irrigation in a given - ! column - logical :: reached_max_depth(bounds%begc:bounds%endc) - - ! Whether we should limit deficits by available volr - logical :: limit_irrigation - - character(len=*), parameter :: subname = 'CalcIrrigationNeeded' - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(elai) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eff_porosity) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_liq) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(volr) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - - ! Determine if irrigation is needed (over irrigated soil columns) - - ! First, determine in what grid cells we need to bother 'measuring' soil water, to see - ! if we need irrigation - check_for_irrig_col(bounds%begc:bounds%endc) = .false. - do fp = 1, num_exposedvegp - p = filter_exposedvegp(fp) - g = patch%gridcell(p) - - check_for_irrig_patch(p) = this%PointNeedsCheckForIrrig( & - pft_type=patch%itype(p), elai=elai(p), & - time_prev=time_prev, londeg=grc%londeg(g)) - if (check_for_irrig_patch(p)) then - c = patch%column(p) - check_for_irrig_col(c) = .true. - end if - end do - - check_for_irrig_col_filter = col_filter_from_logical_array(bounds, & - check_for_irrig_col(bounds%begc:bounds%endc)) - - ! Initialize some variables - do fc = 1, check_for_irrig_col_filter%num - c = check_for_irrig_col_filter%indices(fc) - - reached_max_depth(c) = .false. - h2osoi_liq_tot(c) = 0._r8 - h2osoi_liq_target_tot(c) = 0._r8 - h2osoi_liq_wilting_point_tot(c) = 0._r8 - end do - - ! Now 'measure' soil water for the grid cells identified above and see if the soil is - ! dry enough to warrant irrigation - do j = 1,nlevsoi - do fc = 1, check_for_irrig_col_filter%num - c = check_for_irrig_col_filter%indices(fc) - - if (.not. reached_max_depth(c)) then - if (col%z(c,j) > this%params%irrig_depth) then - reached_max_depth(c) = .true. - else if (j > col%nbedrock(c)) then - reached_max_depth(c) = .true. - else if (t_soisno(c,j) <= SHR_CONST_TKFRZ) then - ! if level L was frozen, then we don't look at any levels below L - reached_max_depth(c) = .true. - else - h2osoi_liq_tot(c) = h2osoi_liq_tot(c) + h2osoi_liq(c,j) - - h2osoi_liq_target = this%RelsatToH2osoi( & - relsat = this%relsat_target_col(c,j), & - eff_porosity = eff_porosity(c,j), & - dz = col%dz(c,j)) - h2osoi_liq_target_tot(c) = h2osoi_liq_target_tot(c) + & - h2osoi_liq_target - - h2osoi_liq_wilting_point = this%RelsatToH2osoi( & - relsat = this%relsat_wilting_point_col(c,j), & - eff_porosity = eff_porosity(c,j), & - dz = col%dz(c,j)) - h2osoi_liq_wilting_point_tot(c) = h2osoi_liq_wilting_point_tot(c) + & - h2osoi_liq_wilting_point - end if - end if ! if (.not. reached_max_depth(c)) - end do ! do fc - end do ! do j - - ! Compute deficits - ! First initialize deficits to 0 everywhere; this is needed for later averaging up to gridcell - deficit(bounds%begc:bounds%endc) = 0._r8 - do fc = 1, check_for_irrig_col_filter%num - c = check_for_irrig_col_filter%indices(fc) - - h2osoi_liq_at_threshold = h2osoi_liq_wilting_point_tot(c) + & - this%params%irrig_threshold_fraction * & - (h2osoi_liq_target_tot(c) - h2osoi_liq_wilting_point_tot(c)) - if (h2osoi_liq_tot(c) < h2osoi_liq_at_threshold) then - deficit(c) = h2osoi_liq_target_tot(c) - h2osoi_liq_tot(c) - ! deficit shouldn't be less than 0: if it is, that implies that the - ! irrigation target is less than the irrigation threshold, which is not - ! supposed to happen - if (deficit(c) < 0._r8) then - write(iulog,*) subname//' ERROR: deficit < 0' - write(iulog,*) 'This implies that irrigation target is less than irrigatio& - &n threshold, which should never happen' - call endrun(decomp_index=c, clmlevel=namec, msg='deficit < 0 '// & - errMsg(sourcefile, __LINE__)) - end if - else - ! We're above the threshold - so don't irrigate - deficit(c) = 0._r8 - end if - end do - - ! Limit deficits by available volr, if desired. Note that we cannot do this limiting - ! if running without a prognostic river model, since we need river volume for this - ! limiting. - ! - ! NOTE(wjs, 2016-11-22) In principle we could base this on rof_present rather than - ! rof_prognostic, but that would depend on the data runoff (drof) model sending river - ! volume, which it currently does not. - limit_irrigation = (this%params%limit_irrigation_if_rof_enabled .and. rof_prognostic) - if (limit_irrigation) then - call this%CalcDeficitVolrLimited( & - bounds = bounds, & - check_for_irrig_col_filter = check_for_irrig_col_filter, & - deficit = deficit(bounds%begc:bounds%endc), & - volr = volr(bounds%begg:bounds%endg), & - deficit_volr_limited = deficit_volr_limited(bounds%begc:bounds%endc)) - else - deficit_volr_limited(bounds%begc:bounds%endc) = deficit(bounds%begc:bounds%endc) - end if - - ! Convert deficits to irrigation rate - do fp = 1, num_exposedvegp - p = filter_exposedvegp(fp) - c = patch%column(p) - - if (check_for_irrig_patch(p)) then - ! Convert units from mm to mm/sec - this%irrig_rate_patch(p) = deficit_volr_limited(c) / & - (this%dtime*this%irrig_nsteps_per_day) - this%irrig_rate_demand_patch(p) = deficit(c) / & - (this%dtime*this%irrig_nsteps_per_day) - - ! n_irrig_steps_left(p) > 0 is ok even if irrig_rate(p) ends up = 0 - ! in this case, we'll irrigate by 0 for the given number of time steps - this%n_irrig_steps_left_patch(p) = this%irrig_nsteps_per_day - end if - end do - - end subroutine CalcIrrigationNeeded - - !----------------------------------------------------------------------- - function PointNeedsCheckForIrrig(this, pft_type, elai, time_prev, londeg) & - result(check_for_irrig) - ! - ! !DESCRIPTION: - ! Determine whether a given patch needs to be checked for irrigation now. - ! - ! !USES: - use pftconMod, only : pftcon - ! - ! !ARGUMENTS: - logical :: check_for_irrig ! function result - class(irrigation_type), intent(in) :: this - integer , intent(in) :: pft_type ! type of pft in this patch - real(r8), intent(in) :: elai ! one-sided leaf area index with burying by snow - integer , intent(in) :: time_prev ! time of day (in seconds since 0Z) at start of timestep - real(r8), intent(in) :: londeg ! longitude (degrees) - ! - ! !LOCAL VARIABLES: - ! local time at start of time step (seconds after solar midnight) - integer :: local_time - - ! number of seconds since the prescribed irrigation start time - integer :: seconds_since_irrig_start_time - - character(len=*), parameter :: subname = 'PointNeedsCheckForIrrig' - !----------------------------------------------------------------------- - - if (pftcon%irrigated(pft_type) == 1._r8 .and. & - elai > this%params%irrig_min_lai) then - ! see if it's the right time of day to start irrigating: - local_time = modulo(time_prev + nint(londeg/degpsec), isecspday) - seconds_since_irrig_start_time = modulo(local_time - this%params%irrig_start_time, isecspday) - if (seconds_since_irrig_start_time < this%dtime) then - check_for_irrig = .true. - else - check_for_irrig = .false. - end if - else - check_for_irrig = .false. - end if - - end function PointNeedsCheckForIrrig - - !----------------------------------------------------------------------- - subroutine CalcDeficitVolrLimited(this, bounds, check_for_irrig_col_filter, & - deficit, volr, deficit_volr_limited) - ! - ! !DESCRIPTION: - ! Calculates deficit limited by river volume for each column. - ! - ! The output array (deficit_volr_limited) is set to 0 outside the given filter. - ! - ! If the deficit is lower than the volr-based threshold for a given gridcell, then the - ! volr-limited deficit is simply the original deficit; if the deficit is higher than - ! the volr-based threshold for a gridcell, then the volr-limited deficit for each - ! column in the gridcell is equal to: - ! (original deficit in the column) * (volr-based threshold)/(gridcell-level deficit) - ! - ! The logic here relies on the fact that all irrigated columns in a given grid cell - ! will be irrigated at the same time of day. (As opposed to, say, some being irrigated - ! at 4 AM and others being irrigated at 6 AM: in that case we couldn't just average - ! this time step's column-level deficits to the gridcell to get the total daily - ! irrigation deficit: we'd need to account for the fact that we have some irrigation - ! commitment from earlier deficits, etc.) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(irrigation_type) , intent(in) :: this - type(bounds_type) , intent(in) :: bounds - - ! filter of columns where we need to check for irrigation - type(filter_col_type) , intent(in) :: check_for_irrig_col_filter - - ! original deficit: the amount by which we would irrigate if there were no volr - ! limitation [kg/m2] [i.e., mm] - ! - ! Should be set for all columns, even those outside the filter, so that averaging to - ! grid cell happens properly - real(r8), intent(in) :: deficit( bounds%begc: ) - - ! river water volume [m3] - real(r8), intent(in) :: volr( bounds%begg: ) - - ! deficit limited by river volume [kg/m2] [i.e., mm] - real(r8), intent(out) :: deficit_volr_limited( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: fc ! column filter index - integer :: c ! column index - integer :: g ! gridcell index - - ! Deficit averaged up to gridcell level [kg/m2] [i.e., mm] - real(r8) :: deficit_grc(bounds%begg:bounds%endg) - - real(r8) :: available_volr ! volr available for withdrawal [m3] - - real(r8) :: max_deficit_supported_by_volr ! [kg/m2] [i.e., mm] - - ! ratio of deficit_volr_limited to deficit for each grid cell - real(r8) :: deficit_limited_ratio_grc(bounds%begg:bounds%endg) - - character(len=*), parameter :: subname = 'CalcDeficitVolrLimited' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(deficit) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(volr) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(deficit_volr_limited) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - call c2g(bounds, & - carr = deficit(bounds%begc:bounds%endc), & - garr = deficit_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - - do g = bounds%begg, bounds%endg - if (volr(g) > 0._r8) then - available_volr = volr(g) * (1._r8 - this%params%irrig_river_volume_threshold) - max_deficit_supported_by_volr = available_volr / grc%area(g) * m3_over_km2_to_mm - else - ! Ensure that negative volr is treated the same as 0 volr - max_deficit_supported_by_volr = 0._r8 - end if - - if (deficit_grc(g) > max_deficit_supported_by_volr) then - ! inadequate river storage, adjust irrigation demand - deficit_limited_ratio_grc(g) = max_deficit_supported_by_volr / deficit_grc(g) - else - ! adequate river storage, no adjustment to irrigation demand - deficit_limited_ratio_grc(g) = 1._r8 - end if - end do - - deficit_volr_limited(bounds%begc:bounds%endc) = 0._r8 - do fc = 1, check_for_irrig_col_filter%num - c = check_for_irrig_col_filter%indices(fc) - - g = col%gridcell(c) - deficit_volr_limited(c) = deficit(c) * deficit_limited_ratio_grc(g) - end do - - end subroutine CalcDeficitVolrLimited - - - !----------------------------------------------------------------------- - pure function RelsatToH2osoi(this, relsat, eff_porosity, dz) result(h2osoi_liq) - ! - ! !DESCRIPTION: - ! For a given column and layer, convert relative saturation to kg/m2 water - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) :: h2osoi_liq ! function result (kg/m2) - class(irrigation_type), intent(in) :: this - real(r8), intent(in) :: relsat ! relative saturation (0 to 1) - real(r8), intent(in) :: eff_porosity ! effective porosity (0 to 1) - real(r8), intent(in) :: dz ! level thickness (m) - ! - ! !LOCAL VARIABLES: - real(r8) :: vol_liq ! partial volume of liquid water in layer [0 to 1] - - character(len=*), parameter :: subname = 'RelsatToH2osoi' - !----------------------------------------------------------------------- - - vol_liq = eff_porosity * relsat - h2osoi_liq = vol_liq * denh2o * dz - - end function RelsatToH2osoi - -end module IrrigationMod diff --git a/src/biogeophys/LakeCon.F90 b/src/biogeophys/LakeCon.F90 deleted file mode 100644 index a42a3d0137..0000000000 --- a/src/biogeophys/LakeCon.F90 +++ /dev/null @@ -1,178 +0,0 @@ -module LakeCon - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing constants and parameters for the Lake code - ! (CLM4-LISSS, documented in Subin et al. 2011, JAMES) - ! Also contains time constant variables for Lake code - ! Created by Zack Subin, 2011 - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varctl , only : iulog - use spmdMod , only : masterproc - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: LakeConInit - !----------------------------------------------------------------------- - - !------------------------------------------------------------------ - ! Lake Model non-tuneable constants - !------------------------------------------------------------------ - - ! temperature of maximum water density (K) - ! This is from Hostetler and Bartlein (1990); more updated sources suggest 277.13 K. - real(r8), parameter :: tdmax = 277._r8 - - !------------------------------------------------------------------ - ! Lake Model tuneable constants - !------------------------------------------------------------------ - - ! lake emissivity. This is used for both frozen and unfrozen lakes. - ! This is pulled in from CLM4 and the reference is unclear. - real(r8), parameter :: emg_lake = 0.97_r8 - - ! The fraction of the visible (e.g. vis not nir from atm) sunlight - ! absorbed in ~1 m of water (the surface layer za_lake). - ! This is roughly the fraction over 700 nm but may depend on the details - ! of atmospheric radiative transfer. As long as NIR = 700 nm and up, this can be zero. - real(r8) :: betavis = 0.0_r8 - - ! Momentum Roughness length over frozen lakes without snow (m) - ! Typical value found in the literature, and consistent with Mironov expressions. - ! See e.g. Morris EM 1989, Andreas EL 1987, Guest & Davidson 1991 (as cited in Vavrus 1996) - real(r8), parameter :: z0frzlake = 0.001_r8 - - ! Base of surface light absorption layer for lakes (m) - real(r8), parameter :: za_lake = 0.6_r8 - - ! For calculating prognostic roughness length - real(r8), parameter :: cur0 = 0.01_r8 ! min. Charnock parameter - real(r8), parameter :: cus = 0.1_r8 ! empirical constant for roughness under smooth flow - real(r8), parameter :: curm = 0.1_r8 ! maximum Charnock parameter - - ! The following will be set in initLake based on namelists. !TODO - fix this commend - real(r8) :: fcrit ! critical dimensionless fetch for Charnock parameter. - real(r8) :: minz0lake ! (m) Minimum allowed roughness length for unfrozen lakes. - - ! For calculating enhanced diffusivity - real(r8), parameter :: n2min = 7.5e-5_r8 ! (s^-2) (yields diffusivity about 6 times km) ! Fang & Stefan 1996 - - ! Note, this will be adjusted in initLake if the timestep is not 1800 s. - ! Lake top numerics can oscillate with 0.01m top layer and 1800 s timestep. - ! The problem is that the surface flux is fixed during the calculation of the top - ! layer temperature in the diffusion and not corrected for the tendency of the top layer. - ! This thickness will be added to all minimum and maximum snow layer thicknesses compared to that used over non-lakes. - ! Analysis of the CFL condition suggests that the minimum snow layer thickness for 1800 s needs - ! to be at least ~1.2 cm for the bulk snow values of conductivity and heat capacity - ! and as much as 2.3 cm for pure ice. - ! Alternatively, a check could be done in LakeTemperature in case - ! t_grnd(c) - t_soisno(c,snl(c)+1) changed sign after the Crank-Nicholson step. - ! Such an approach, while perhaps allowing additional snow layer resolution, has not been tested. - ! The approach used over non-lakes is to have a first-order surface flux correction. - ! We choose not to do that here because t_grnd can vary independently of the top model - ! layer temperature, while it is fixed to the top layer temperature if tbot > tfrz and - ! the lake is frozen, or if there is an unstable density gradient in the top unfrozen lake layer. - real(r8) :: lsadz = 0.03_r8 ! m - - !! The following will be set in initLake based on namelists. - real(r8) :: pudz ! (m) Optional minimum total ice thickness required to allow lake puddling. - ! Currently used for sensitivity tests only. - real(r8) :: depthcrit ! (m) Depth beneath which to increase mixing. See discussion in Subin et al. 2011 - real(r8) :: mixfact ! Mixing increase factor. - - !!!!!!!!!!! - ! Namelists (some of these have not been extensively tested and are hardwired to default values currently). - !!!!!!!!!!! - - ! used in LakeFluxes - ! true => use old fcrit & minz0 as per Subin et al 2011 form - ! See initLakeMod for details. Difference is very small for - ! small lakes and negligible for large lakes. Currently hardwired off. - logical, public :: lake_use_old_fcrit_minz0 = .false. - - ! used in LakeTemperature - ! Increase mixing by a large factor for deep lakes - ! Crude but enhanced performance at all 4 deep lakes tested. - ! See Subin et al 2011 (JAMES) for details - - ! (m) minimum lake depth to invoke deepmixing - real(r8), public :: deepmixing_depthcrit = 25._r8 - - ! factor to increase mixing by - real(r8), public :: deepmixing_mixfact = 10._r8 - - ! true => Suppress enhanced diffusion. Small differences. - ! Currently hardwired .false. - ! See Subin et al 2011 for details. - ! Enhanced diffusion is intended for under ice and at large depths. - ! It is a much smaller change on its own than the "deepmixing" - ! above, but it increases the effect of deepmixing under ice and for large depths. - logical, public :: lake_no_ed = .false. - - ! puddling (not extensively tested and currently hardwired off) - ! used in LakeTemperature and SurfaceAlbedo - - ! true => suppress convection when greater than minimum amount - ! of ice is present. This also effectively sets lake_no_melt_icealb. - logical, public :: lakepuddling = .false. - - ! (m) minimum amount of total ice nominal thickness before - ! convection is suppressed - real(r8), public :: lake_puddle_thick = 0.2_r8 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine LakeConInit() - ! - ! !DESCRIPTION: - ! Initialize time invariant variables for S Lake code - !------------------------------------------------------------------------ - - if (masterproc) write (iulog,*) 'Attempting to initialize time invariant variables for lakes' - - ! Set LakeCon constants according to namelist fields - if (lake_use_old_fcrit_minz0) then - ! critical dimensionless fetch for Charnock parameter. From Vickers & Mahrt 1997 - ! but converted to use u instead of u* (Form used in Subin et al. 2011) - fcrit = 22._r8 - - ! (m) Minimum allowed roughness length for unfrozen lakes. - ! (Used in Subin et al. 2011) - minz0lake = 1.e-5_r8 - else - ! Vickers & Mahrt 1997 - fcrit = 100._r8 - - ! (m) Minimum allowed roughness length for unfrozen lakes. - ! Now set low so it is only to avoid floating point exceptions. - minz0lake = 1.e-10_r8 - end if - - if (lakepuddling) then - ! (m) Minimum total ice thickness required to allow lake puddling. Default is 0.2m. - ! This option has not been extensively tested. - ! This option turns on lake_no_melt_icealb, as the decrease in albedo will be based - ! on whether there is water over nice, not purely a function of ice top temperature. - pudz = lake_puddle_thick - end if - - ! (m) Depth beneath which to increase mixing. See discussion in Subin et al. 2011 - depthcrit = deepmixing_depthcrit - - ! Mixing increase factor. ! Defaults are 25 m, increase by 10. - ! Note some other namelists will be used directly in lake physics during model integration. - mixfact = deepmixing_mixfact - - if (masterproc) write (iulog,*) 'Successfully initialized time invariant variables for lakes' - - end subroutine LakeConInit - -end module LakeCon diff --git a/src/biogeophys/LakeFluxesMod.F90 b/src/biogeophys/LakeFluxesMod.F90 deleted file mode 100644 index 3d447ec111..0000000000 --- a/src/biogeophys/LakeFluxesMod.F90 +++ /dev/null @@ -1,668 +0,0 @@ -module LakeFluxesMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates surface fluxes and temperature for lakes. - ! Created by Zack Subin, 2009 - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use LakeStateType , only : lakestate_type - use SolarAbsorbedType , only : solarabs_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use HumanIndexMod , only : humanindex_type - use GridcellType , only : grc - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: LakeFluxes - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine LakeFluxes(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, & - atm2lnd_inst, solarabs_inst, frictionvel_inst, temperature_inst, & - energyflux_inst, waterstate_inst, waterflux_inst, lakestate_inst, & - humanindex_inst) - ! - ! !DESCRIPTION: - ! Calculates lake temperatures and surface fluxes. - ! Lakes have variable depth, possible snow layers above, freezing & thawing of lake water, - ! and soil layers with active temperature and gas diffusion below. - ! WARNING: This subroutine assumes lake columns have one and only one pft. - ! - ! !USES: - use clm_varpar , only : nlevlak - use clm_varcon , only : hvap, hsub, hfus, cpair, cpliq, tkwat, tkice, tkair - use clm_varcon , only : sb, vkc, grav, denh2o, tfrz, spval, zsno - use clm_varctl , only : use_lch4 - use LakeCon , only : betavis, z0frzlake, tdmax, emg_lake - use LakeCon , only : lake_use_old_fcrit_minz0 - use LakeCon , only : minz0lake, cur0, cus, curm, fcrit - use QSatMod , only : QSat - use FrictionVelocityMod , only : FrictionVelocity, MoninObukIni, frictionvel_parms_inst - use HumanIndexMod , only : calc_human_stress_indices, Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & - swbgt, hmdex, dis_coi, dis_coiS, THIndex, & - SwampCoolEff, KtoC, VaporPres - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for non-lake points - integer , intent(in) :: num_lakep ! number of column non-lake points in pft filter - integer , intent(in) :: filter_lakep(:) ! patch filter for non-lake points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(lakestate_type) , intent(inout) :: lakestate_inst - type(humanindex_type) , intent(inout) :: humanindex_inst - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: z0mg_col(:) ! roughness length over ground, momentum [m] - real(r8), pointer :: z0hg_col(:) ! roughness length over ground, sensible heat [m] - real(r8), pointer :: z0qg_col(:) ! roughness length over ground, latent heat [m] - integer , parameter :: niters = 4 ! maximum number of iterations for surface temperature - real(r8), parameter :: beta1 = 1._r8 ! coefficient of convective velocity (in computing W_*) [-] - real(r8), parameter :: zii = 1000._r8 ! convective boundary height [m] - integer :: i,fc,fp,g,c,p ! do loop or array index - integer :: fncopy ! number of values in pft filter copy - integer :: fnold ! previous number of pft filter values - integer :: fpcopy(num_lakep) ! patch filter copy for iteration loop - integer :: iter ! iteration index - integer :: nmozsgn(bounds%begp:bounds%endp) ! number of times moz changes sign - integer :: jtop(bounds%begc:bounds%endc) ! top level for each column (no longer all 1) - real(r8) :: ax ! used in iteration loop for calculating t_grnd (numerator of NR solution) - real(r8) :: bx ! used in iteration loop for calculating t_grnd (denomin. of NR solution) - real(r8) :: degdT ! d(eg)/dT - real(r8) :: dqh(bounds%begp:bounds%endp) ! diff of humidity between ref. height and surface - real(r8) :: dth(bounds%begp:bounds%endp) ! diff of virtual temp. between ref. height and surface - real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: dzsur(bounds%begc:bounds%endc) ! 1/2 the top layer thickness (m) - real(r8) :: eg ! water vapor pressure at temperature T [pa] - real(r8) :: htvp(bounds%begc:bounds%endc) ! latent heat of vapor of water (or sublimation) [j/kg] - real(r8) :: obu(bounds%begp:bounds%endp) ! monin-obukhov length (m) - real(r8) :: obuold(bounds%begp:bounds%endp) ! monin-obukhov length of previous iteration - real(r8) :: qsatg(bounds%begc:bounds%endc) ! saturated humidity [kg/kg] - real(r8) :: qsatgdT(bounds%begc:bounds%endc) ! d(qsatg)/dT - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: ram(bounds%begp:bounds%endp) ! aerodynamical resistance [s/m] - real(r8) :: rah(bounds%begp:bounds%endp) ! thermal resistance [s/m] - real(r8) :: raw(bounds%begp:bounds%endp) ! moisture resistance [s/m] - real(r8) :: stftg3(bounds%begp:bounds%endp) ! derivative of fluxes w.r.t ground temperature - real(r8) :: temp1(bounds%begp:bounds%endp) ! relation for potential temperature profile - real(r8) :: temp12m(bounds%begp:bounds%endp) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(bounds%begp:bounds%endp) ! relation for specific humidity profile - real(r8) :: temp22m(bounds%begp:bounds%endp) ! relation for specific humidity profile applied at 2-m - real(r8) :: tgbef(bounds%begc:bounds%endc) ! initial ground temperature - real(r8) :: thm(bounds%begp:bounds%endp) ! intermediate variable (forc_t+0.0098*forc_hgt_t_patch) - real(r8) :: thv(bounds%begc:bounds%endc) ! virtual potential temperature (kelvin) - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: tksur(bounds%begc:bounds%endc) ! thermal conductivity of snow/soil (w/m/kelvin) - real(r8) :: tsur(bounds%begc:bounds%endc) ! top layer temperature - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: um(bounds%begp:bounds%endp) ! wind speed including the stablity effect [m/s] - real(r8) :: ur(bounds%begp:bounds%endp) ! wind speed at reference height [m/s] - real(r8) :: ustar(bounds%begp:bounds%endp) ! friction velocity [m/s] - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: zldis(bounds%begp:bounds%endp) ! reference height "minus" zero displacement height [m] - real(r8) :: displa(bounds%begp:bounds%endp) ! displacement (always zero) [m] - real(r8) :: z0mg(bounds%begp:bounds%endp) ! roughness length over ground, momentum [m] - real(r8) :: z0hg(bounds%begp:bounds%endp) ! roughness length over ground, sensible heat [m] - real(r8) :: z0qg(bounds%begp:bounds%endp) ! roughness length over ground, latent heat [m] - real(r8) :: u2m ! 2 m wind speed (m/s) - real(r8) :: fm(bounds%begp:bounds%endp) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: bw ! partial density of water (ice + liquid) - real(r8) :: t_grnd_temp ! Used in surface flux correction over frozen ground - real(r8) :: betaprime(bounds%begc:bounds%endc) ! Effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - real(r8) :: sabg_nir ! NIR that is absorbed (W/m^2) - - ! For calculating roughness lengths - real(r8) :: cur ! Charnock parameter (-) - real(r8) :: fetch(bounds%begc:bounds%endc) ! Fetch (m) - real(r8) :: sqre0 ! root of roughness Reynolds number - real(r8), parameter :: kva0 = 1.51e-5_r8 ! kinematic viscosity of air (m^2/s) at 20C and 1.013e5 Pa - real(r8) :: kva0temp ! (K) temperature for kva0; will be set below - real(r8), parameter :: kva0pres = 1.013e5_r8 ! (Pa) pressure for kva0 - real(r8) :: kva ! kinematic viscosity of air at ground temperature and forcing pressure - real(r8), parameter :: prn = 0.713 ! Prandtl # for air at neutral stability - real(r8), parameter :: sch = 0.66 ! Schmidt # for water in air at neutral stability - - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness for soil or snow (m) - dz_lake => col%dz_lake , & ! Input: [real(r8) (:,:) ] layer thickness for lake (m) - lakedepth => col%lakedepth , & ! Input: [real(r8) (:) ] variable lake depth (m) - - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_th => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric potential temperature (Kelvin) - forc_q => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] snow rate [mm/s] - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] rain rate [mm/s] - forc_u => atm2lnd_inst%forc_u_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in east direction (m/s) - forc_v => atm2lnd_inst%forc_v_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in north direction (m/s) - - fsds_nir_d => solarabs_inst%fsds_nir_d_patch , & ! Input: [real(r8) (:) ] incident direct beam nir solar radiation (W/m**2) - fsds_nir_i => solarabs_inst%fsds_nir_i_patch , & ! Input: [real(r8) (:) ] incident diffuse nir solar radiation (W/m**2) - fsr_nir_d => solarabs_inst%fsr_nir_d_patch , & ! Input: [real(r8) (:) ] reflected direct beam nir solar radiation (W/m**2) - fsr_nir_i => solarabs_inst%fsr_nir_i_patch , & ! Input: [real(r8) (:) ] reflected diffuse nir solar radiation (W/m**2) - sabg_lyr => solarabs_inst%sabg_lyr_patch , & ! Input: [real(r8) (:,:) ] absorbed solar radiation (pft,lyr) [W/m2] - sabg_chk => solarabs_inst%sabg_chk_patch , & ! Output: [real(r8) (:) ] sum of soil/snow using current fsno, for balance check - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - - savedtke1 => lakestate_inst%savedtke1_col , & ! Input: [real(r8) (:) ] top level eddy conductivity from previous timestep (W/mK) - lakefetch => lakestate_inst%lakefetch_col , & ! Input: [real(r8) (:) ] lake fetch from surface data (m) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - t_skin_patch => temperature_inst%t_skin_patch , & ! Output: [real(r8) (:) ] patch skin temperature (K) - - t_lake => temperature_inst%t_lake_col , & ! Input: [real(r8) (:,:) ] lake temperature (Kelvin) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil (or snow) temperature (Kelvin) - - u10_clm => frictionvel_inst%u10_clm_patch , & ! Input: [real(r8) (:)] 10 m height winds (m/s) - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at pft level [m] - forc_hgt_t_patch => frictionvel_inst%forc_hgt_t_patch , & ! Input: [real(r8) (:) ] observational height of temperature at pft level [m] - forc_hgt_q_patch => frictionvel_inst%forc_hgt_q_patch , & ! Input: [real(r8) (:) ] observational height of specific humidity at pft level [m] - zetamax => frictionvel_parms_inst%zetamaxstable , & ! Input: [real(r8) ] max zeta value under stable conditions - ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) - - q_ref2m => waterstate_inst%q_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface specific humidity (kg/kg) - rh_ref2m => waterstate_inst%rh_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface relative humidity (%) - - tc_ref2m => humanindex_inst%tc_ref2m_patch , & ! Output: [real(r8) (:)] 2 m height surface air temperature (C) - vap_ref2m => humanindex_inst%vap_ref2m_patch , & ! Output: [real(r8) (:)] 2 m height vapor pressure (Pa) - appar_temp_ref2m => humanindex_inst%appar_temp_ref2m_patch , & ! Output: [real(r8) (:)] 2 m apparent temperature (C) - swbgt_ref2m => humanindex_inst%swbgt_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Simplified Wetbulb Globe temperature (C) - humidex_ref2m => humanindex_inst%humidex_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Humidex (C) - wbt_ref2m => humanindex_inst%wbt_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Stull Wet Bulb temperature (C) - wb_ref2m => humanindex_inst%wb_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Wet Bulb temperature (C) - teq_ref2m => humanindex_inst%teq_ref2m_patch , & ! Output: [real(r8) (:)] 2 m height Equivalent temperature (K) - ept_ref2m => humanindex_inst%ept_ref2m_patch , & ! Output: [real(r8) (:)] 2 m height Equivalent Potential temperature (K) - discomf_index_ref2m => humanindex_inst%discomf_index_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Discomfort Index temperature (C) - discomf_index_ref2mS => humanindex_inst%discomf_index_ref2mS_patch, & ! Output: [real(r8) (:)] 2 m height Discomfort Index Stull temperature (C) - nws_hi_ref2m => humanindex_inst%nws_hi_ref2m_patch , & ! Output: [real(r8) (:)] 2 m NWS Heat Index (C) - thip_ref2m => humanindex_inst%thip_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Temperature Humidity Index Physiology (C) - thic_ref2m => humanindex_inst%thic_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Temperature Humidity Index Comfort (C) - swmp65_ref2m => humanindex_inst%swmp65_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Swamp Cooler temperature 65% effi (C) - swmp80_ref2m => humanindex_inst%swmp80_ref2m_patch , & ! Output: [real(r8) (:)] 2 m Swamp Cooler temperature 80% effi (C) - - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - qflx_prec_grnd => waterflux_inst%qflx_prec_grnd_patch , & ! Output: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)] - - t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (Kelvin) - t_ref2m => temperature_inst%t_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (Kelvin) - t_grnd => temperature_inst%t_grnd_col , & ! Output: [real(r8) (:) ] ground temperature (Kelvin) - - eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Output: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Output: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Output: [real(r8) (:) ] soil heat flux (W/m**2) [+ = into soil] - eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch , & ! Output: [real(r8) (:) ] total latent heat flux (W/m**2) [+ to atm] - eflx_lh_grnd => energyflux_inst%eflx_lh_grnd_patch , & ! Output: [real(r8) (:) ] ground evaporation heat flux (W/m**2) [+ to atm] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_gnet => energyflux_inst%eflx_gnet_patch , & ! Output: [real(r8) (:) ] net heat flux into ground (W/m**2) - taux => energyflux_inst%taux_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: e-w (kg/m/s**2) - tauy => energyflux_inst%tauy_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: n-s (kg/m/s**2) - - ks => lakestate_inst%ks_col , & ! Output: [real(r8) (:) ] coefficient passed to LakeTemperature - ws => lakestate_inst%ws_col , & ! Output: [real(r8) (:) ] surface friction velocity (m/s) - betaprime => lakestate_inst%betaprime_col , & ! Output: [real(r8) (:) ] fraction of solar rad absorbed at surface: equal to NIR fraction - ram1_lake => lakestate_inst%ram1_lake_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) - ust_lake => lakestate_inst%ust_lake_col , & ! Output: [real(r8) (:) ] friction velocity (m/s) - lake_raw => lakestate_inst%lake_raw_col , & ! Output: [real(r8) (:) ] aerodynamic resistance for moisture (s/m) - - begp => bounds%begp , & - endp => bounds%endp & - ) - - ! the following cause a crash if they are set as associated - z0mg_col => frictionvel_inst%z0mg_col - z0hg_col => frictionvel_inst%z0hg_col - z0qg_col => frictionvel_inst%z0qg_col - - kva0temp = 20._r8 + tfrz - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - g = col%gridcell(c) - - ! Set fetch for prognostic roughness length-- if not found in surface data. - ! This is poorly constrained, and should eventually be based on global lake data - ! For now, base on lake depth, assuming that small lakes are likely to be shallower - ! The dependence will be weak, especially for large fetch - ! http://www.chebucto.ns.ca/ccn/info/Science/SWCS/DATA/morphology.html#zr, based on - ! Hutchinson, G.E. 1957 A treatise on limnology v.1. Geography, Physics and Chemistry, - ! and Wetzel, R.G., and Likens, G.E.. 1991. Limnological Analyses, suggests lakes usually have - ! depths less than 2% of their diameter. - - if (lakefetch(c) > 0._r8) then ! fetch available in surface data - fetch(c) = lakefetch(c) - else ! Estimate crudely based on lake depth - if (lakedepth(c) < 4._r8) then - fetch(c) = 100._r8 ! Roughly the smallest lakes resolveable in the GLWD - else - fetch(c) = 25._r8*lakedepth(c) - end if - end if - - ! Initialize roughness lengths - - if (t_grnd(c) > tfrz) then ! for unfrozen lake - z0mg(p) = z0mg_col(c) - kva = kva0 * (t_grnd(c)/kva0temp)**1.5_r8 * kva0pres/forc_pbot(c) ! kinematic viscosity of air - sqre0 = (max(z0mg(p)*ust_lake(c)/kva,0.1_r8))**0.5_r8 ! Square root of roughness Reynolds number - z0hg(p) = z0mg(p) * exp( -vkc/prn*( 4._r8*sqre0 - 3.2_r8) ) ! SH roughness length - z0qg(p) = z0mg(p) * exp( -vkc/sch*( 4._r8*sqre0 - 4.2_r8) ) ! LH roughness length - z0qg(p) = max(z0qg(p), minz0lake) - z0hg(p) = max(z0hg(p), minz0lake) - else if (snl(c) == 0) then ! frozen lake with ice - z0mg(p) = z0frzlake - z0hg(p) = z0mg(p)/exp(0.13_r8 * (ust_lake(c)*z0mg(p)/1.5e-5_r8)**0.45_r8) ! Consistent with BareGroundFluxes - z0qg(p) = z0hg(p) - else ! use roughness over snow as in Biogeophysics1 - z0mg(p) = zsno - z0hg(p) = z0mg(p)/exp(0.13_r8 * (ust_lake(c)*z0mg(p)/1.5e-5_r8)**0.45_r8) ! Consistent with BareGroundFluxes - z0qg(p) = z0hg(p) - end if - - ! Surface temperature and fluxes - - forc_hgt_u_patch(p) = forc_hgt_u_patch(p) + z0mg(p) - forc_hgt_t_patch(p) = forc_hgt_t_patch(p) + z0mg(p) - forc_hgt_q_patch(p) = forc_hgt_q_patch(p) + z0mg(p) - - ! Find top layer - jtop(c) = snl(c) + 1 - - if (snl(c) < 0) then - betaprime(c) = sabg_lyr(p,jtop(c))/max(1.e-5_r8,sabg(p)) ! Assuming one pft - dzsur(c) = dz(c,jtop(c))/2._r8 - else ! no snow layers - ! Calculate the NIR fraction of absorbed solar. - sabg_nir = fsds_nir_d(p) + fsds_nir_i(p) - fsr_nir_d(p) - fsr_nir_i(p) - sabg_nir = min(sabg_nir, sabg(p)) - betaprime(c) = sabg_nir/max(1.e-5_r8,sabg(p)) - ! Some fraction of the "visible" may be absorbed in the surface layer. - betaprime(c) = betaprime(c) + (1._r8-betaprime(c))*betavis - dzsur(c) = dz_lake(c,1)/2._r8 - end if - - sabg_chk(p) = sabg(p) - ! Originally dzsur was 1*dz, but it should it be 1/2 dz. - - ! Saturated vapor pressure, specific humidity and their derivatives - ! at lake surface - - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg(c), qsatgdT(c)) - - ! Potential, virtual potential temperature, and wind speed at the - ! reference height - - thm(p) = forc_t(c) + 0.0098_r8*forc_hgt_t_patch(p) ! intermediate variable - thv(c) = forc_th(c)*(1._r8+0.61_r8*forc_q(c)) ! virtual potential T - end do - - - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - g = patch%gridcell(p) - - nmozsgn(p) = 0 - obuold(p) = 0._r8 - displa(p) = 0._r8 - - ! Latent heat - - if (t_grnd(c) > tfrz) then - htvp(c) = hvap - else - htvp(c) = hsub - end if - ! Zack Subin, 3/26/09: Changed to ground temperature rather than the air temperature above. - - ! Initialize stability variables - - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - dth(p) = thm(p)-t_grnd(c) - dqh(p) = forc_q(c)-qsatg(c) - dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p) - zldis(p) = forc_hgt_u_patch(p) - 0._r8 - - ! Initialize Monin-Obukhov length and wind speed - - call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg(p), um(p), obu(p)) - - end do - - iter = 1 - fncopy = num_lakep - fpcopy(1:num_lakep) = filter_lakep(1:num_lakep) - - ! Begin stability iteration - - ITERATION : do while (iter <= niters .and. fncopy > 0) - - ! Determine friction velocity, and potential temperature and humidity - ! profiles of the surface boundary layer - - call FrictionVelocity(begp, endp, fncopy, fpcopy, & - displa(begp:endp), z0mg(begp:endp), z0hg(begp:endp), z0qg(begp:endp), & - obu(begp:endp), iter, ur(begp:endp), um(begp:endp), ustar(begp:endp), & - temp1(begp:endp), temp2(begp:endp), temp12m(begp:endp), temp22m(begp:endp), fm(begp:endp), & - frictionvel_inst) - - do fp = 1, fncopy - p = fpcopy(fp) - c = patch%column(p) - g = patch%gridcell(p) - - tgbef(c) = t_grnd(c) - if (t_grnd(c) > tfrz .and. t_lake(c,1) > tfrz .and. snl(c) == 0) then - tksur(c) = savedtke1(c) - ! Set this to the eddy conductivity from the last - ! timestep, as the molecular conductivity will be orders of magnitude too small. - ! It will be initialized in initLakeMod to the molecular conductivity for the first timestep if arbinit. - tsur(c) = t_lake(c,1) - else if (snl(c) == 0) then !frozen but no snow layers - tksur(c) = tkice ! This is an approximation because the whole layer may not be frozen, and it is not - ! accounting for the physical (but not nominal) expansion of the frozen layer. - tsur(c) = t_lake(c,1) - else - !Need to calculate thermal conductivity of the top snow layer - bw = (h2osoi_ice(c,jtop(c))+h2osoi_liq(c,jtop(c)))/dz(c,jtop(c)) - tksur(c) = tkair + (7.75e-5_r8 *bw + 1.105e-6_r8*bw*bw)*(tkice-tkair) - tsur(c) = t_soisno(c,jtop(c)) - end if - - ! Determine aerodynamic resistances - - ram(p) = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah(p) = 1._r8/(temp1(p)*ustar(p)) - raw(p) = 1._r8/(temp2(p)*ustar(p)) - - if (use_lch4) then - lake_raw(c) = raw(p) ! Pass out for calculating ground ch4 conductance - end if - ram1(p) = ram(p) ! pass value to global variable - ram1_lake(p) = ram1(p) ! for history - - ! Get derivative of fluxes with respect to ground temperature - - stftg3(p) = emg_lake*sb*tgbef(c)*tgbef(c)*tgbef(c) - - ! Changed surface temperature from t_lake(c,1) to tsur(c). - ! Also adjusted so that if there are snow layers present, the top layer absorption - ! from SNICAR is assigned to the surface skin. - ax = betaprime(c)*sabg(p) + emg_lake*forc_lwrad(c) + 3._r8*stftg3(p)*tgbef(c) & - + forc_rho(c)*cpair/rah(p)*thm(p) & - - htvp(c)*forc_rho(c)/raw(p)*(qsatg(c)-qsatgdT(c)*tgbef(c) - forc_q(c)) & - + tksur(c)*tsur(c)/dzsur(c) - !Changed sabg(p) to betaprime(c)*sabg(p). - bx = 4._r8*stftg3(p) + forc_rho(c)*cpair/rah(p) & - + htvp(c)*forc_rho(c)/raw(p)*qsatgdT(c) + tksur(c)/dzsur(c) - - t_grnd(c) = ax/bx - - ! Update htvp - if (t_grnd(c) > tfrz) then - htvp(c) = hvap - else - htvp(c) = hsub - end if - - ! Surface fluxes of momentum, sensible and latent heat - ! using ground temperatures from previous time step - - eflx_sh_grnd(p) = forc_rho(c)*cpair*(t_grnd(c)-thm(p))/rah(p) - qflx_evap_soi(p) = forc_rho(c)*(qsatg(c)+qsatgdT(c)*(t_grnd(c)-tgbef(c))-forc_q(c))/raw(p) - - ! Re-calculate saturated vapor pressure, specific humidity and their - ! derivatives at lake surface - - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg(c), qsatgdT(c)) - - dth(p)=thm(p)-t_grnd(c) - dqh(p)=forc_q(c)-qsatg(c) - - tstar = temp1(p)*dth(p) - qstar = temp2(p)*dqh(p) - - thvstar=tstar*(1._r8+0.61_r8*forc_q(c)) + 0.61_r8*forc_th(c)*qstar - zeta=zldis(p)*vkc * grav*thvstar/(ustar(p)**2*thv(c)) - - if (zeta >= 0._r8) then !stable - zeta = min(zetamax,max(zeta,0.01_r8)) - um(p) = max(ur(p),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta1*(-grav*ustar(p)*thvstar*zii/thv(c))**0.333_r8 - um(p) = sqrt(ur(p)*ur(p)+wc*wc) - end if - obu(p) = zldis(p)/zeta - - if (obuold(p)*obu(p) < 0._r8) nmozsgn(p) = nmozsgn(p)+1 - - obuold(p) = obu(p) - - if (t_grnd(c) > tfrz .and. snl(c) == 0) then ! t_grnd hasn't been corrected yet if snow layers but above frz - ! Update roughness lengths using approach in Subin et al. 2011 - ! Also allow wave development (phase speed) to be depth-limited as well as fetch-limited - if (lake_use_old_fcrit_minz0) then - ! Original formulation in Subin et al. 2011; converted Vickers & Mahrt 1997 to use u instead of u* - ! assuming u = 0.1 u*. - ! That probably slightly overestimates the dimensionless fetch as u* is often smaller than 0.1 u - cur = cur0 + curm* exp( max( -(fetch(c)*grav/ur(p)/ur(p))**(1._r8/3._r8)/fcrit, & ! Fetch-limited - -(lakedepth(c)*grav/ur(p)/ur(p))**0.5_r8 ) ) ! depth-limited - ! In this case fcrit is 22, not 100 in clm_varcon - else - ! Fetch relationship from Vickers & Mahrt 1997 - cur = cur0 + curm* exp( max( -(fetch(c)*grav/ustar(p)/ustar(p))**(1._r8/3._r8)/fcrit, & ! Fetch-limited - -(lakedepth(c)*grav/ur(p)/ur(p))**0.5_r8 ) ) ! depth-limited - end if - - - kva = kva0 * (t_grnd(c)/kva0temp)**1.5_r8 * kva0pres/forc_pbot(c) ! kinematic viscosity of air - z0mg(p) = max(cus*kva/max(ustar(p),1.e-4_r8), cur*ustar(p)*ustar(p)/grav) ! momentum roughness length - ! This lower limit on ustar is just to prevent floating point exceptions and - ! should not be important - z0mg(p) = max(z0mg(p), minz0lake) ! This limit is redundant with current values. - sqre0 = (max(z0mg(p)*ustar(p)/kva,0.1_r8))**0.5_r8 ! Square root of roughness Reynolds number - z0hg(p) = z0mg(p) * exp( -vkc/prn*( 4._r8*sqre0 - 3.2_r8) ) ! SH roughness length - z0qg(p) = z0mg(p) * exp( -vkc/sch*( 4._r8*sqre0 - 4.2_r8) ) ! LH roughness length - z0qg(p) = max(z0qg(p), minz0lake) - z0hg(p) = max(z0hg(p), minz0lake) - else if (snl(c) == 0) then - ! in case it was above freezing and now below freezing - z0mg(p) = z0frzlake - z0hg(p) = z0mg(p)/exp(0.13_r8 * (ustar(p)*z0mg(p)/1.5e-5_r8)**0.45_r8) ! Consistent with BareGroundFluxes - z0qg(p) = z0hg(p) - else ! Snow layers - ! z0mg won't have changed - z0hg(p) = z0mg(p)/exp(0.13_r8 * (ustar(p)*z0mg(p)/1.5e-5_r8)**0.45_r8) ! Consistent with BareGroundFluxes - z0qg(p) = z0hg(p) - end if - - end do ! end of filtered pft loop - - iter = iter + 1 - if (iter <= niters ) then - ! Rebuild copy of pft filter for next pass through the ITERATION loop - - fnold = fncopy - fncopy = 0 - do fp = 1, fnold - p = fpcopy(fp) - if (nmozsgn(p) < 3) then - fncopy = fncopy + 1 - fpcopy(fncopy) = p - end if - end do ! end of filtered pft loop - end if - - end do ITERATION ! end of stability iteration - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - g = patch%gridcell(p) - - ! If there is snow on the ground or lake is frozen and t_grnd > tfrz: reset t_grnd = tfrz. - ! Re-evaluate ground fluxes. - ! [ZMS 1/7/11] Only for resolved snow layers, as unresolved snow does not have a temperature state and - ! can accumulate on unfrozen lakes in LakeHydrology; will be melted in LakeTemperature or bring lake top - ! to freezing. - ! note that qsatg and qsatgdT should be f(tgbef) (PET: not sure what this - ! comment means) - ! Zack Subin, 3/27/09: Since they are now a function of whatever t_grnd was before cooling - ! to freezing temperature, then this value should be used in the derivative correction term. - ! Allow convection if ground temp is colder than lake but warmer than 4C, or warmer than - ! lake which is warmer than freezing but less than 4C. - if ( (snl(c) < 0 .or. t_lake(c,1) <= tfrz) .and. t_grnd(c) > tfrz) then - t_grnd_temp = t_grnd(c) - t_grnd(c) = tfrz - eflx_sh_grnd(p) = forc_rho(c)*cpair*(t_grnd(c)-thm(p))/rah(p) - qflx_evap_soi(p) = forc_rho(c)*(qsatg(c)+qsatgdT(c)*(t_grnd(c)-t_grnd_temp) - forc_q(c))/raw(p) - else if ( (t_lake(c,1) > t_grnd(c) .and. t_grnd(c) > tdmax) .or. & - (t_lake(c,1) < t_grnd(c) .and. t_lake(c,1) > tfrz .and. t_grnd(c) < tdmax) ) then - ! Convective mixing will occur at surface - t_grnd_temp = t_grnd(c) - t_grnd(c) = t_lake(c,1) - eflx_sh_grnd(p) = forc_rho(c)*cpair*(t_grnd(c)-thm(p))/rah(p) - qflx_evap_soi(p) = forc_rho(c)*(qsatg(c)+qsatgdT(c)*(t_grnd(c)-t_grnd_temp) - forc_q(c))/raw(p) - end if - - ! Update htvp - if (t_grnd(c) > tfrz) then - htvp(c) = hvap - else - htvp(c) = hsub - end if - - ! Net longwave from ground to atmosphere - ! eflx_lwrad_out(p) = (1._r8-emg_lake)*forc_lwrad(c) + stftg3(p)*(-3._r8*tgbef(c)+4._r8*t_grnd(c)) - ! What is tgbef doing in this equation? Can't it be exact now? --Zack Subin, 4/14/09 - - eflx_lwrad_out(p) = (1._r8-emg_lake)*forc_lwrad(c) + emg_lake*sb*t_grnd(c)**4._r8 - - ! Ground heat flux - - eflx_soil_grnd(p) = sabg(p) + forc_lwrad(c) - eflx_lwrad_out(p) - & - eflx_sh_grnd(p) - htvp(c)*qflx_evap_soi(p) - ! The original code in Biogeophysiclake had a bug that calculated incorrect fluxes but conserved energy. - ! This is kept as the full sabg (not just that absorbed at surface) so that the energy balance check will be correct. - !This is the effective energy flux into the ground including the lake [and now snow in CLM 4] solar absorption - !below the surface. This also keeps the output FGR similar to non-lakes by including the light & heat flux. - ! The variable eflx_gnet will be used to pass the actual heat flux - !from the ground interface into the lake. - - taux(p) = -forc_rho(c)*forc_u(g)/ram(p) - tauy(p) = -forc_rho(c)*forc_v(g)/ram(p) - - eflx_sh_tot(p) = eflx_sh_grnd(p) - qflx_evap_tot(p) = qflx_evap_soi(p) - eflx_lh_tot(p) = htvp(c)*qflx_evap_soi(p) - eflx_lh_grnd(p) = htvp(c)*qflx_evap_soi(p) - - ! 2 m height air temperature - t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) - - ! 2 m height specific humidity - q_ref2m(p) = forc_q(c) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - - ! Human Heat Stress - - if ( calc_human_stress_indices )then - call KtoC(t_ref2m(p), tc_ref2m(p)) - call VaporPres(rh_ref2m(p), e_ref2m, vap_ref2m(p)) - call Wet_Bulb(t_ref2m(p), vap_ref2m(p), forc_pbot(c), rh_ref2m(p), & - q_ref2m(p), teq_ref2m(p), ept_ref2m(p), wb_ref2m(p)) - call Wet_BulbS(tc_ref2m(p), rh_ref2m(p), wbt_ref2m(p)) - call HeatIndex(tc_ref2m(p), rh_ref2m(p), nws_hi_ref2m(p)) - call AppTemp(tc_ref2m(p), vap_ref2m(p), u10_clm(p), appar_temp_ref2m(p)) - call swbgt(tc_ref2m(p), vap_ref2m(p), swbgt_ref2m(p)) - call hmdex(tc_ref2m(p), vap_ref2m(p), humidex_ref2m(p)) - call dis_coi(tc_ref2m(p), wb_ref2m(p), discomf_index_ref2m(p)) - call dis_coiS(tc_ref2m(p), rh_ref2m(p), wbt_ref2m(p), discomf_index_ref2mS(p)) - call THIndex(tc_ref2m(p), wb_ref2m(p), thic_ref2m(p), thip_ref2m(p)) - call SwampCoolEff(tc_ref2m(p), wb_ref2m(p), swmp80_ref2m(p), swmp65_ref2m(p)) - end if - - - ! Energy residual used for melting snow - ! Effectively moved to LakeTemp - - eflx_gnet(p) = betaprime(c) * sabg(p) + forc_lwrad(c) - (eflx_lwrad_out(p) + & - eflx_sh_tot(p) + eflx_lh_tot(p)) - ! This is the actual heat flux from the ground interface into the lake, not including - ! the light that penetrates the surface. - - !u2m = max(1.0_r8,ustar(p)/vkc*log(2._r8/z0mg(p))) - ! u2 often goes below 1 m/s; it seems like the only reason for this minimum is to - ! keep it from being zero in the ks equation below; 0.1 m/s is a better limit for - ! stable conditions --ZS - u2m = max(0.1_r8,ustar(p)/vkc*log(2._r8/z0mg(p))) - - ws(c) = 1.2e-03_r8 * u2m - ks(c) = 6.6_r8*sqrt(abs(sin(grc%lat(g))))*(u2m**(-1.84_r8)) - - ! Update column roughness lengths and friction velocity - z0mg_col(c) = z0mg(p) - z0hg_col(c) = z0hg(p) - z0qg_col(c) = z0qg(p) - ust_lake(c) = ustar(p) - - end do - - ! The following are needed for global average on history tape. - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - t_veg(p) = forc_t(c) - eflx_lwrad_net(p) = eflx_lwrad_out(p) - forc_lwrad(c) - qflx_prec_grnd(p) = forc_rain(c) + forc_snow(c) - t_skin_patch(p) = t_veg(p) - end do - - end associate - - end subroutine LakeFluxes - -end module LakeFluxesMod diff --git a/src/biogeophys/LakeHydrologyMod.F90 b/src/biogeophys/LakeHydrologyMod.F90 deleted file mode 100644 index b7e91a4fc3..0000000000 --- a/src/biogeophys/LakeHydrologyMod.F90 +++ /dev/null @@ -1,684 +0,0 @@ -module LakeHydrologyMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculation of Lake Hydrology. Full hydrology, aerosol deposition, etc. of snow layers is - ! done. However, there is no infiltration, and the water budget is balanced with - ! qflx_qrgwl. Lake water mass is kept constant. The soil is simply maintained at - ! volumetric saturation if ice melting frees up pore space. Likewise, if the water - ! portion alone at some point exceeds pore capacity, it is reduced. This is consistent - ! with the possibility of initializing the soil layer with excess ice. - ! - ! If snow layers are present over an unfrozen lake, and the top layer of the lake - ! is capable of absorbing the latent heat without going below freezing, - ! the snow-water is runoff and the latent heat is subtracted from the lake. - ! - ! Minimum snow layer thickness for lakes has been increased to avoid instabilities with 30 min timestep. - ! Also frost / dew is prevented from being added to top snow layers that have already melted during the phase change step. - ! - ! ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use ColumnType , only : col - use PatchType , only : patch - use atm2lndType , only : atm2lnd_type - use AerosolMod , only : aerosol_type - use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use LakeStateType , only : lakestate_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use TotalWaterAndHeatMod , only : ComputeWaterMassLake - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: LakeHydrology ! Calculates soil/snow hydrology - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine LakeHydrology(bounds, & - num_lakec, filter_lakec, num_lakep, filter_lakep, & - num_shlakesnowc, filter_shlakesnowc, num_shlakenosnowc, filter_shlakenosnowc, & - atm2lnd_inst, temperature_inst, soilstate_inst, waterstate_inst, waterflux_inst, & - energyflux_inst, aerosol_inst, lakestate_inst, topo_inst) - ! - ! !DESCRIPTION: - ! WARNING: This subroutine assumes lake columns have one and only one pft. - ! - ! Sequence is: - ! LakeHydrology: - ! Do needed tasks from CanopyHydrology, Biogeophysics2, & top of SoilHydrology. - ! -> SnowWater: change of snow mass and snow water onto soil - ! -> SnowCompaction: compaction of snow layers - ! -> CombineSnowLayers: combine snow layers that are thinner than minimum - ! -> DivideSnowLayers: subdivide snow layers that are thicker than maximum - ! - ! Add water to soil if melting has left it with open pore space. - ! If snow layers are found above a lake with unfrozen top layer, whose top - ! layer has enough heat to melt all the snow ice without freezing, do so - ! and eliminate the snow layers. - ! Cleanup and do water balance. - ! - ! !USES: - use clm_varcon , only : denh2o, denice, spval, hfus, tfrz, cpliq, cpice - use clm_varpar , only : nlevsno, nlevgrnd, nlevsoi - use clm_varctl , only : iulog - use clm_time_manager, only : get_step_size - use SnowHydrologyMod, only : SnowCompaction, CombineSnowLayers, SnowWater, BuildSnowFilter, SnowCapping - use SnowHydrologyMod, only : DivideSnowLayers, NewSnowBulkDensity - use LakeCon , only : lsadz - use TopoMod, only : topo_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - integer , intent(in) :: num_lakep ! number of pft lake points in column filter - integer , intent(in) :: filter_lakep(:) ! patch filter for lake points - integer , intent(out) :: num_shlakesnowc ! number of column snow points - integer , intent(out) :: filter_shlakesnowc(:) ! column filter for snow points - integer , intent(out) :: num_shlakenosnowc ! number of column non-snow points - integer , intent(out) :: filter_shlakenosnowc(:) ! column filter for non-snow points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(aerosol_type) , intent(inout) :: aerosol_inst - type(lakestate_type) , intent(inout) :: lakestate_inst - class(topo_type) , intent(in) :: topo_inst - ! - ! !LOCAL VARIABLES: - integer :: p,fp,g,l,c,j,fc,jtop ! indices - real(r8) :: dtime ! land model time step (sec) - integer :: newnode ! flag when new snow node is set, (1=yes, 0=no) - real(r8) :: dz_snowf ! layer thickness rate change due to precipitation [mm/s] - real(r8) :: bifall(bounds%begc:bounds%endc) ! bulk density of newly fallen dry snow [kg/m3] - real(r8) :: fracsnow(bounds%begp:bounds%endp) ! frac of precipitation that is snow - real(r8) :: fracrain(bounds%begp:bounds%endp) ! frac of precipitation that is rain - real(r8) :: qflx_prec_grnd_snow(bounds%begp:bounds%endp) ! snow precipitation incident on ground [mm/s] - real(r8) :: qflx_prec_grnd_rain(bounds%begp:bounds%endp) ! rain precipitation incident on ground [mm/s] - real(r8) :: qflx_evap_soi_lim ! temporary evap_soi limited by top snow layer content [mm/s] - real(r8) :: h2osno_temp ! temporary h2osno [kg/m^2] - real(r8) :: sumsnowice(bounds%begc:bounds%endc) ! sum of snow ice if snow layers found above unfrozen lake [kg/m&2] - logical :: unfrozen(bounds%begc:bounds%endc) ! true if top lake layer is unfrozen with snow layers above - real(r8) :: heatrem ! used in case above [J/m^2] - real(r8) :: heatsum(bounds%begc:bounds%endc) ! used in case above [J/m^2] - real(r8) :: snowmass ! liquid+ice snow mass in a layer [kg/m2] - real(r8) :: snowcap_scl_fct ! temporary factor used to correct for snow capping - real(r8), parameter :: snow_bd = 250._r8 ! assumed snow bulk density (for lakes w/out resolved snow layers) [kg/m^3] - ! Should only be used for frost below. - !----------------------------------------------------------------------- - - associate( & - pcolumn => patch%column , & ! Input: [integer (:) ] pft's column index - pgridcell => patch%gridcell , & ! Input: [integer (:) ] pft's gridcell index - cgridcell => col%gridcell , & ! Input: [integer (:) ] column's gridcell - clandunit => col%landunit , & ! Input: [integer (:) ] column's landunit - dz_lake => col%dz_lake , & ! Input: [real(r8) (:,:) ] layer thickness for lake (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface depth (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - forc_rain => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:) ] rain rate [mm/s] - forc_snow => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:) ] snow rate [mm/s] - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - qflx_floodg => atm2lnd_inst%forc_flood_grc , & ! Input: [real(r8) (:) ] gridcell flux of flood water from RTM - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - - t_lake => temperature_inst%t_lake_col , & ! Input: [real(r8) (:,:) ] lake temperature (Kelvin) - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] snow temperature (Kelvin) - dTdz_top => temperature_inst%dTdz_top_col , & ! Output: [real(r8) (:) ] temperature gradient in top layer K m-1] !TOD - snot_top => temperature_inst%snot_top_col , & ! Output: [real(r8) (:) ] snow temperature in top layer [K] !TODO - t_sno_mul_mss => temperature_inst%t_sno_mul_mss_col , & ! Output: [real(r8) (:) ] col snow temperature multiplied by layer mass, layer sum (K * kg/m2) - - begwb => waterstate_inst%begwb_col , & ! Input: [real(r8) (:) ] water mass begining of the time step - endwb => waterstate_inst%endwb_col , & ! Output: [real(r8) (:) ] water mass end of the time step - snw_rds => waterstate_inst%snw_rds_col , & ! Output: [real(r8) (:,:) ] effective snow grain radius (col,lyr) [microns, m^-6] - snw_rds_top => waterstate_inst%snw_rds_top_col , & ! Output: [real(r8) (:) ] effective snow grain size, top layer [microns] - h2osno_top => waterstate_inst%h2osno_top_col , & ! Output: [real(r8) (:) ] mass of snow in top layer [kg] - sno_liq_top => waterstate_inst%sno_liq_top_col , & ! Output: [real(r8) (:) ] liquid water fraction in top snow layer [frc] - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Output: [real(r8) (:) ] needed for snicar code - frac_iceold => waterstate_inst%frac_iceold_col , & ! Output: [real(r8) (:,:) ] fraction of ice relative to the tot water - snow_depth => waterstate_inst%snow_depth_col , & ! Output: [real(r8) (:) ] snow height (m) - h2osno => waterstate_inst%h2osno_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) - snowice => waterstate_inst%snowice_col , & ! Output: [real(r8) (:) ] average snow ice lens - snowliq => waterstate_inst%snowliq_col , & ! Output: [real(r8) (:) ] average snow liquid water - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] volumetric soil water [m3/m3] - - qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Output: [real(r8) (:) ] column flux of flood water from RTM - qflx_prec_grnd => waterflux_inst%qflx_prec_grnd_patch , & ! Output: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)] - qflx_snow_grnd_patch => waterflux_inst%qflx_snow_grnd_patch , & ! Output: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] - qflx_rain_grnd => waterflux_inst%qflx_rain_grnd_patch , & ! Output: [real(r8) (:) ] rain on ground after interception (mm H2O/s) [+] - qflx_rain_grnd_col => waterflux_inst%qflx_rain_grnd_col , & ! Output: [real(r8) (:) ] rain on ground after interception (mm H2O/s) [+] - qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_sub_snow => waterflux_inst%qflx_sub_snow_patch , & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_evap_grnd => waterflux_inst%qflx_evap_grnd_patch , & ! Output: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_patch , & ! Output: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_patch , & ! Output: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_snomelt => waterflux_inst%qflx_snomelt_col , & ! Output: [real(r8) (:) ] snow melt (mm H2O /s) - qflx_snomelt_lyr => waterflux_inst%qflx_snomelt_lyr_col , & ! Output: [real(r8) (:) ] snow melt in each layer (mm H2O /s) - qflx_prec_grnd_col => waterflux_inst%qflx_prec_grnd_col , & ! Output: [real(r8) (:) ] water onto ground including canopy runoff [kg/(m2 s)] - qflx_evap_grnd_col => waterflux_inst%qflx_evap_grnd_col , & ! Output: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_dew_grnd_col => waterflux_inst%qflx_dew_grnd_col , & ! Output: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_dew_snow_col => waterflux_inst%qflx_dew_snow_col , & ! Output: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_sub_snow_col => waterflux_inst%qflx_sub_snow_col , & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_snow_grnd_col => waterflux_inst%qflx_snow_grnd_col , & ! Output: [real(r8) (:) ] snow on ground after interception (mm H2O/s) [+] - qflx_evap_tot_col => waterflux_inst%qflx_evap_tot_col , & ! Output: [real(r8) (:) ] pft quantity averaged to the column (assuming one pft) - qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col , & ! Output: [real(r8) (:) ] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+] - qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Input: [real(r8) (:) ] excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] - qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Input: [real(r8) (:) ] excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Output: [real(r8) (:) ] perched wt sub-surface runoff (mm H2O /s) !TODO - move this to somewhere else - qflx_h2osfc_surf => waterflux_inst%qflx_h2osfc_surf_col , & ! Output: [real(r8) (:) ] surface water runoff (mm H2O /s) - qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Output: [real(r8) (:) ] drainage from snow pack - qflx_rsub_sat => waterflux_inst%qflx_rsub_sat_col , & ! Output: [real(r8) (:) ] soil saturation excess [mm h2o/s] - qflx_surf => waterflux_inst%qflx_surf_col , & ! Output: [real(r8) (:) ] surface runoff (mm H2O /s) - qflx_drain => waterflux_inst%qflx_drain_col , & ! Output: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_infl => waterflux_inst%qflx_infl_col , & ! Output: [real(r8) (:) ] infiltration (mm H2O /s) - qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Output: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes - qflx_runoff => waterflux_inst%qflx_runoff_col , & ! Output: [real(r8) (:) ] total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - qflx_ice_runoff_snwcp => waterflux_inst%qflx_ice_runoff_snwcp_col, & ! Output: [real(r8) (:)] solid runoff from snow capping (mm H2O /s) - qflx_top_soil => waterflux_inst%qflx_top_soil_col , & ! Output: [real(r8) (:) ] net water input into soil from top (mm/s) - - eflx_snomelt => energyflux_inst%eflx_snomelt_col , & ! Output: [real(r8) (:) ] snow melt heat flux (W/m**2) - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Output: [real(r8) (:) ] heat flux into snow / lake (W/m**2) [+ = into soil] - eflx_gnet => energyflux_inst%eflx_gnet_patch , & ! Output: [reay(r8) (:) ] net heat flux into ground (W/m**2) - eflx_grnd_lake => energyflux_inst%eflx_grnd_lake_patch , & ! Output: [real(r8) (:) ] net heat flux into lake / snow surface, excluding light transmission (W/m**2) - - lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Output: [real(r8) (:,:) ] mass fraction of lake layer that is frozen - - begc => bounds%begc, & - endc => bounds%endc & - ) - - ! Determine step size - dtime = get_step_size() - - !!!!!!!!!!!!!!!!!!!!!!!!!!! - ! Do precipitation onto ground, etc., from CanopyHydrology - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - - qflx_prec_grnd_snow(p) = forc_snow(c) - qflx_prec_grnd_rain(p) = forc_rain(c) - qflx_prec_grnd(p) = qflx_prec_grnd_snow(p) + qflx_prec_grnd_rain(p) - - qflx_snow_grnd_patch(p) = qflx_prec_grnd_snow(p) ! ice onto ground (mm/s) - qflx_rain_grnd(p) = qflx_prec_grnd_rain(p) ! liquid water onto ground (mm/s) - - ! Assuming one PFT; needed for below - qflx_snow_grnd_col(c) = qflx_snow_grnd_patch(p) - qflx_rain_grnd_col(c) = qflx_rain_grnd(p) - - end do ! (end pft loop) - - ! Determine snow height and snow water - - call NewSnowBulkDensity(bounds, num_lakec, filter_lakec, & - atm2lnd_inst, bifall(bounds%begc:bounds%endc)) - - do fc = 1, num_lakec - c = filter_lakec(fc) - - ! Use Alta relationship, Anderson(1976); LaChapelle(1961), - ! U.S.Department of Agriculture Forest Service, Project F, - ! Progress Rep. 1, Alta Avalanche Study Center:Snow Layer Densification. - - dz_snowf = qflx_snow_grnd_col(c)/bifall(c) - snow_depth(c) = snow_depth(c) + dz_snowf*dtime - h2osno(c) = h2osno(c) + qflx_snow_grnd_col(c)*dtime ! snow water equivalent (mm) - - ! When the snow accumulation exceeds 40 mm, initialize snow layer - ! Currently, the water temperature for the precipitation is simply set - ! as the surface air temperature - - newnode = 0 ! flag for when snow node will be initialized - if (snl(c) == 0 .and. qflx_snow_grnd_col(c) > 0.0_r8 .and. snow_depth(c) >= 0.01_r8 + lsadz) then - newnode = 1 - snl(c) = -1 - dz(c,0) = snow_depth(c) ! meter - z(c,0) = -0.5_r8*dz(c,0) - zi(c,-1) = -dz(c,0) - t_soisno(c,0) = min(tfrz, forc_t(c)) ! K - h2osoi_ice(c,0) = h2osno(c) ! kg/m2 - h2osoi_liq(c,0) = 0._r8 ! kg/m2 - frac_iceold(c,0) = 1._r8 - - ! intitialize SNICAR variables for fresh snow: - call aerosol_inst%Reset(column=c) - call waterstate_inst%Reset(column=c) - - end if - - ! The change of ice partial density of surface node due to precipitation. - ! Only ice part of snowfall is added here, the liquid part will be added - ! later. - - if (snl(c) < 0 .and. newnode == 0) then - h2osoi_ice(c,snl(c)+1) = h2osoi_ice(c,snl(c)+1)+dtime*qflx_snow_grnd_col(c) - dz(c,snl(c)+1) = dz(c,snl(c)+1)+dz_snowf*dtime - end if - - end do - - ! Calculate sublimation and dew, adapted from HydrologyLake and Biogeophysics2. - - do fp = 1,num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - jtop = snl(c)+1 - - qflx_evap_grnd(p) = 0._r8 - qflx_sub_snow(p) = 0._r8 - qflx_dew_snow(p) = 0._r8 - qflx_dew_grnd(p) = 0._r8 - - if (jtop <= 0) then ! snow layers - j = jtop - ! Assign ground evaporation to sublimation from soil ice or to dew - ! on snow or ground - - if (qflx_evap_soi(p) >= 0._r8) then - ! for evaporation partitioning between liquid evap and ice sublimation, - ! use the ratio of liquid to (liquid+ice) in the top layer to determine split - ! Since we're not limiting evap over lakes, but still can't remove more from top - ! snow layer than there is there, create temp. limited evap_soi. - qflx_evap_soi_lim = min(qflx_evap_soi(p), (h2osoi_liq(c,j)+h2osoi_ice(c,j))/dtime) - if ((h2osoi_liq(c,j)+h2osoi_ice(c,j)) > 0._r8) then - qflx_evap_grnd(p) = max(qflx_evap_soi_lim*(h2osoi_liq(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) - else - qflx_evap_grnd(p) = 0._r8 - end if - qflx_sub_snow(p) = qflx_evap_soi_lim - qflx_evap_grnd(p) - else - ! if (t_grnd(c) < tfrz) then - ! Causes rare blowup when thin snow layer should completely melt and has a high temp after thermal physics, - ! but then is not eliminated in SnowHydrology because of this added frost. Also see below removal of - ! completely melted single snow layer. - if (t_grnd(c) < tfrz .and. t_soisno(c,j) < tfrz) then - qflx_dew_snow(p) = abs(qflx_evap_soi(p)) - ! If top layer is only snow layer, SnowHydrology won't eliminate it if dew is added. - else if (j < 0 .or. (t_grnd(c) == tfrz .and. t_soisno(c,j) == tfrz)) then - qflx_dew_grnd(p) = abs(qflx_evap_soi(p)) - end if - end if - - else ! No snow layers - if (qflx_evap_soi(p) >= 0._r8) then - ! Sublimation: do not allow for more sublimation than there is snow - ! after melt. Remaining surface evaporation used for infiltration. - qflx_sub_snow(p) = min(qflx_evap_soi(p), h2osno(c)/dtime) - qflx_evap_grnd(p) = qflx_evap_soi(p) - qflx_sub_snow(p) - else - if (t_grnd(c) < tfrz-0.1_r8) then - qflx_dew_snow(p) = abs(qflx_evap_soi(p)) - else - qflx_dew_grnd(p) = abs(qflx_evap_soi(p)) - end if - end if - - ! Update snow pack for dew & sub. - - h2osno_temp = h2osno(c) - h2osno(c) = h2osno(c) + (-qflx_sub_snow(p)+qflx_dew_snow(p))*dtime - if (h2osno_temp > 0._r8) then - snow_depth(c) = snow_depth(c) * h2osno(c) / h2osno_temp - else - snow_depth(c) = h2osno(c)/snow_bd !Assume a constant snow bulk density = 250. - end if - - h2osno(c) = max(h2osno(c), 0._r8) - end if - end do - - ! patch averages must be done here -- BEFORE SNOW CALCULATIONS AS THEY USE IT. - ! for output to history tape and other uses - ! (note that pft2col is called before LakeHydrology, so we can't use that routine - ! to do these column -> pft averages) - do fp = 1,num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - - qflx_evap_tot_col(c) = qflx_evap_tot(p) - qflx_prec_grnd_col(c) = qflx_prec_grnd(p) - qflx_evap_grnd_col(c) = qflx_evap_grnd(p) - qflx_dew_grnd_col(c) = qflx_dew_grnd(p) - qflx_dew_snow_col(c) = qflx_dew_snow(p) - qflx_sub_snow_col(c) = qflx_sub_snow(p) - enddo - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ! Determine initial snow/no-snow filters (will be modified possibly by - ! routines CombineSnowLayers and DivideSnowLayers below) - - call BuildSnowFilter(bounds, num_lakec, filter_lakec, & - num_shlakesnowc, filter_shlakesnowc, num_shlakenosnowc, filter_shlakenosnowc) - - ! specify snow fraction - do fc = 1, num_lakec - c = filter_lakec(fc) - if (h2osno(c) > 0.0_r8) then - frac_sno_eff(c) = 1._r8 - else - frac_sno_eff(c) = 0._r8 - endif - enddo - - ! Determine the change of snow mass and the snow water onto soil - - call SnowWater(bounds, & - num_shlakesnowc, filter_shlakesnowc, num_shlakenosnowc, filter_shlakenosnowc, & - atm2lnd_inst, waterflux_inst, waterstate_inst, aerosol_inst) - - call SnowCapping(bounds, num_lakec, filter_lakec, num_shlakesnowc, filter_shlakesnowc, & - aerosol_inst, waterflux_inst, waterstate_inst, topo_inst) - - ! Determine soil hydrology - ! Here this consists only of making sure that soil is saturated even as it melts and - ! pore space opens up. Conversely, if excess ice is melting and the liquid water exceeds the - ! saturation value, then remove water. - - do j = 1,nlevsoi !nlevgrnd - ! changed to nlevsoi on 8/11/10 to make consistent with non-lake bedrock - do fc = 1, num_lakec - c = filter_lakec(fc) - - h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) - ! Could have changed during phase change! (Added 8/11/10) - - if (h2osoi_vol(c,j) < watsat(c,j)) then - h2osoi_liq(c,j) = (watsat(c,j)*dz(c,j) - h2osoi_ice(c,j)/denice)*denh2o - ! h2osoi_vol will be updated below, and this water addition will come from qflx_qrgwl - else if (h2osoi_liq(c,j) > watsat(c,j)*denh2o*dz(c,j)) then - h2osoi_liq(c,j) = watsat(c,j)*denh2o*dz(c,j) - ! Another way to do this would be: if h2osoi_vol > watsat then remove min(h2osoi_liq, - !(h2osoi_vol-watsat)*dz*denh2o) from h2osoi_liq. The question is whether the excess ice - ! melts first or last (or simultaneously) to the pore ice. Because excess ice is often in chunks, - ! requiring greater convergence of heat to melt, assume it melts last. - ! This will also improve the initialization behavior or in an occasionally warm year, the excess ice - ! won't start going away if a layer is briefly at freezing. - - ! Allow up to 10% excess ice over watsat in refreezing soil, - ! e.g. heaving soil. (As with > 10% excess ice modeling, and for the lake water, - ! the thermal conductivity will be adjusted down to compensate for the fact that the nominal dz is smaller - ! than the real soil volume.) The current solution is consistent but perhaps unrealistic in real soils, - ! where slow drainage may occur during freezing; drainage is only assumed to occur here when >10% excess - ! ice melts. The latter is more likely to be permanent rather than seasonal anyway. Attempting to remove the - ! ice volume after some has already frozen during the timestep would not conserve energy unless this were - ! incorporated into the ice stream. - - end if - - end do - end do - !!!!!!!!!! - - ! Natural compaction and metamorphosis. - - call SnowCompaction(bounds, num_shlakesnowc, filter_shlakesnowc, & - temperature_inst, waterstate_inst, atm2lnd_inst) - - ! Combine thin snow elements - - call CombineSnowLayers(bounds, num_shlakesnowc, filter_shlakesnowc, & - aerosol_inst, temperature_inst, waterflux_inst, waterstate_inst) - - ! Divide thick snow elements - - call DivideSnowLayers(bounds, num_shlakesnowc, filter_shlakesnowc, & - aerosol_inst, temperature_inst, waterstate_inst, is_lake=.true.) - - ! Check for single completely unfrozen snow layer over lake. Modeling this ponding is unnecessary and - ! can cause instability after the timestep when melt is completed, as the temperature after melt can be - ! excessive because the fluxes were calculated with a fixed ground temperature of freezing, but the - ! phase change was unable to restore the temperature to freezing. - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - - j = 0 - - if (snl(c) == -1) then - if (h2osoi_ice(c,j) > 0._r8 .and. t_soisno(c,j) > tfrz) then - - ! Take extra heat of layer and release to sensible heat in order - ! to maintain energy conservation. - heatrem = (cpliq*h2osoi_liq(c,j))*(t_soisno(c,j) - tfrz) - t_soisno(c,j) = tfrz - eflx_sh_tot(p) = eflx_sh_tot(p) + heatrem/dtime - eflx_sh_grnd(p) = eflx_sh_grnd(p) + heatrem/dtime - eflx_soil_grnd(p) = eflx_soil_grnd(p) - heatrem/dtime - eflx_gnet(p) = eflx_gnet(p) - heatrem/dtime - eflx_grnd_lake(p) = eflx_grnd_lake(p) - heatrem/dtime - else if (h2osoi_ice(c,j) == 0._r8) then - ! Remove layer - ! Take extra heat of layer and release to sensible heat in order - ! to maintain energy conservation. - heatrem = cpliq*h2osoi_liq(c,j)*(t_soisno(c,j) - tfrz) - eflx_sh_tot(p) = eflx_sh_tot(p) + heatrem/dtime - eflx_sh_grnd(p) = eflx_sh_grnd(p) + heatrem/dtime - eflx_soil_grnd(p) = eflx_soil_grnd(p) - heatrem/dtime - eflx_gnet(p) = eflx_gnet(p) - heatrem/dtime - eflx_grnd_lake(p) = eflx_grnd_lake(p) - heatrem/dtime - qflx_snow_drain(c) = qflx_snow_drain(c) + h2osno(c)/dtime - snl(c) = 0 - h2osno(c) = 0._r8 - snow_depth(c) = 0._r8 - ! Rest of snow layer book-keeping will be done below. - else - eflx_grnd_lake(p) = eflx_gnet(p) - end if - else - eflx_grnd_lake(p) = eflx_gnet(p) - end if - end do - - ! Check for snow layers above lake with unfrozen top layer. Mechanically, - ! the snow will fall into the lake and melt or turn to ice. If the top layer has - ! sufficient heat to melt the snow without freezing, then that will be done. - ! Otherwise, the top layer will undergo freezing, but only if the top layer will - ! not freeze completely. Otherwise, let the snow layers persist and melt by diffusion. - - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (t_lake(c,1) > tfrz .and. lake_icefrac(c,1) == 0._r8 .and. snl(c) < 0) then - unfrozen(c) = .true. - else - unfrozen(c) = .false. - end if - end do - - do j = -nlevsno+1,0 - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (unfrozen(c)) then - if (j == -nlevsno+1) then - sumsnowice(c) = 0._r8 - heatsum(c) = 0._r8 - end if - if (j >= snl(c)+1) then - sumsnowice(c) = sumsnowice(c) + h2osoi_ice(c,j) - heatsum(c) = heatsum(c) + h2osoi_ice(c,j)*cpice*(tfrz - t_soisno(c,j)) & - + h2osoi_liq(c,j)*cpliq*(tfrz - t_soisno(c,j)) - end if - end if - end do - end do - - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (unfrozen(c)) then - heatsum(c) = heatsum(c) + sumsnowice(c)*hfus - heatrem = (t_lake(c,1) - tfrz)*cpliq*denh2o*dz_lake(c,1) - heatsum(c) - - if (heatrem + denh2o*dz_lake(c,1)*hfus > 0._r8) then - ! Remove snow and subtract the latent heat from the top layer. - qflx_snomelt(c) = qflx_snomelt(c) + sumsnowice(c)/dtime - eflx_snomelt(c) = eflx_snomelt(c) + sumsnowice(c)*hfus/dtime - - ! Update melt per layer. Note that sumsnowice = sum(h2osoi_ice), where the - ! sum is taken over layers snl(c)+1 to 0. Thus, this code partitions the - ! above addition to qflx_snomelt (which is based on sumsnowice). - do j = snl(c)+1,0 - qflx_snomelt_lyr(c,j) = qflx_snomelt_lyr(c,j) + h2osoi_ice(c,j) / dtime - end do - - ! update incidental drainage from snow pack for this case - qflx_snow_drain(c) = qflx_snow_drain(c) + h2osno(c)/dtime - - h2osno(c) = 0._r8 - snow_depth(c) = 0._r8 - snl(c) = 0 - ! The rest of the bookkeeping for the removed snow will be done below. - if (heatrem > 0._r8) then ! simply subtract the heat from the layer - t_lake(c,1) = t_lake(c,1) - heatrem/(cpliq*denh2o*dz_lake(c,1)) - else !freeze part of the layer - t_lake(c,1) = tfrz - lake_icefrac(c,1) = -heatrem/(denh2o*dz_lake(c,1)*hfus) - end if - end if - end if - end do - - ! Set empty snow layers to zero - - do j = -nlevsno+1,0 - do fc = 1, num_shlakesnowc - c = filter_shlakesnowc(fc) - if (j <= snl(c) .and. snl(c) > -nlevsno) then - h2osoi_ice(c,j) = 0._r8 - h2osoi_liq(c,j) = 0._r8 - t_soisno(c,j) = 0._r8 - dz(c,j) = 0._r8 - z(c,j) = 0._r8 - zi(c,j-1) = 0._r8 - end if - end do - end do - - ! Build new snow filter - - call BuildSnowFilter(bounds, num_lakec, filter_lakec, & - num_shlakesnowc, filter_shlakesnowc, num_shlakenosnowc, filter_shlakenosnowc) - - ! Vertically average t_soisno and sum of h2osoi_liq and h2osoi_ice - ! over all snow layers for history output - - do fc = 1, num_lakec - c = filter_lakec(fc) - snowice(c) = 0._r8 - snowliq(c) = 0._r8 - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_shlakesnowc - c = filter_shlakesnowc(fc) - if (j >= snl(c)+1) then - snowice(c) = snowice(c) + h2osoi_ice(c,j) - snowliq(c) = snowliq(c) + h2osoi_liq(c,j) - end if - end do - end do - - ! Snow internal temperature - ! See description in HydrologyNoDrainageMod - - do fc = 1, num_lakec - c = filter_lakec(fc) - t_sno_mul_mss(c) = 0._r8 - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_shlakesnowc - c = filter_shlakesnowc(fc) - if (j >= snl(c)+1) then - t_sno_mul_mss(c) = t_sno_mul_mss(c) + h2osoi_ice(c,j) * t_soisno(c,j) - t_sno_mul_mss(c) = t_sno_mul_mss(c) + h2osoi_liq(c,j) * tfrz - end if - end do - end do - - ! Determine ending water balance and volumetric soil water - - call ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, endwb(bounds%begc:bounds%endc)) - - do j = 1, nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) - end do - end do - - do fp = 1,num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - g = pgridcell(p) - - qflx_drain_perched(c) = 0._r8 - qflx_h2osfc_surf(c) = 0._r8 - qflx_rsub_sat(c) = 0._r8 - qflx_infl(c) = 0._r8 - qflx_surf(c) = 0._r8 - qflx_drain(c) = 0._r8 - - ! Insure water balance using qflx_qrgwl - ! qflx_snwcp_ice(c) has been computed in routine SnowCapping - qflx_qrgwl(c) = forc_rain(c) + forc_snow(c) - qflx_evap_tot(p) - qflx_snwcp_ice(c) - & - qflx_snwcp_discarded_ice(c) - qflx_snwcp_discarded_liq(c) - & - (endwb(c)-begwb(c))/dtime + qflx_floodg(g) - qflx_floodc(c) = qflx_floodg(g) - qflx_runoff(c) = qflx_drain(c) + qflx_qrgwl(c) - qflx_top_soil(c) = qflx_prec_grnd_rain(p) + qflx_snow_drain(c) - qflx_ice_runoff_snwcp(c) = qflx_snwcp_ice(c) - - enddo - - ! top-layer diagnostics - do fc = 1, num_shlakesnowc - c = filter_shlakesnowc(fc) - h2osno_top(c) = h2osoi_ice(c,snl(c)+1) + h2osoi_liq(c,snl(c)+1) - end do - - ! Zero variables in columns without snow - do fc = 1, num_shlakenosnowc - c = filter_shlakenosnowc(fc) - - h2osno_top(c) = 0._r8 - snw_rds(c,:) = 0._r8 - - ! top-layer diagnostics (spval is not averaged when computing history fields) - snot_top(c) = spval - dTdz_top(c) = spval - snw_rds_top(c) = spval - sno_liq_top(c) = spval - end do - - end associate - - end subroutine LakeHydrology - -end module LakeHydrologyMod diff --git a/src/biogeophys/LakeStateType.F90 b/src/biogeophys/LakeStateType.F90 deleted file mode 100644 index 11074aaae1..0000000000 --- a/src/biogeophys/LakeStateType.F90 +++ /dev/null @@ -1,296 +0,0 @@ -module LakeStateType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Lake data types and associated procesures - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : spval, grlnd - use decompMod , only : bounds_type - use spmdMod , only : masterproc - use abortUtils , only : endrun - use LandunitType , only : lun - use ColumnType , only : col - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: lakestate_type - ! Time constant variables - real(r8), pointer :: lakefetch_col (:) ! col lake fetch from surface data (m) - real(r8), pointer :: etal_col (:) ! col lake extinction coefficient from surface data (1/m) - - ! Time varying variables - real(r8), pointer :: lake_raw_col (:) ! col aerodynamic resistance for moisture (s/m) - real(r8), pointer :: ks_col (:) ! col coefficient for calculation of decay of eddy diffusivity with depth - real(r8), pointer :: ws_col (:) ! col surface friction velocity (m/s) - real(r8), pointer :: ust_lake_col (:) ! col friction velocity (m/s) - real(r8), pointer :: betaprime_col (:) ! col effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise - real(r8), pointer :: savedtke1_col (:) ! col top level eddy conductivity from previous timestep (W/mK) - real(r8), pointer :: lake_icefrac_col (:,:) ! col mass fraction of lake layer that is frozen - real(r8), pointer :: lake_icefracsurf_col(:) ! col mass fraction of surface lake layer that is frozen - real(r8), pointer :: lake_icethick_col (:) ! col ice thickness (m) (integrated if lakepuddling) - real(r8), pointer :: lakeresist_col (:) ! col [s/m] (Needed for calc. of grnd_ch4_cond) - real(r8), pointer :: ram1_lake_patch (:) ! patch aerodynamical resistance (s/m) - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type lakestate_type - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds ) - call this%InitCold ( bounds ) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varpar , only: nlevlak, nlevsno - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - ! Initialize savedtke1 to spval so that c->g averaging will be done correctly - ! TODO: can this be now be set to nan??? - ! Initialize ust_lake to spval to detect input from restart file if not arbinit - ! TODO: can this be removed now??? - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc = bounds%endc - - allocate(this%etal_col (begc:endc)) ; this%etal_col (:) = nan - allocate(this%lakefetch_col (begc:endc)) ; this%lakefetch_col (:) = nan - allocate(this%lakeresist_col (begc:endc)) ; this%lakeresist_col (:) = nan - allocate(this%savedtke1_col (begc:endc)) ; this%savedtke1_col (:) = spval - allocate(this%lake_icefrac_col (begc:endc,1:nlevlak)) ; this%lake_icefrac_col (:,:) = nan - allocate(this%lake_icefracsurf_col (begc:endc)) ; this%lake_icefracsurf_col (:) = nan - allocate(this%lake_icethick_col (begc:endc)) ; this%lake_icethick_col (:) = nan - allocate(this%ust_lake_col (begc:endc)) ; this%ust_lake_col (:) = spval - allocate(this%ram1_lake_patch (begp:endp)) ; this%ram1_lake_patch (:) = nan - allocate(this%lake_raw_col (begc:endc)) ; this%lake_raw_col (:) = nan - allocate(this%ks_col (begc:endc)) ; this%ks_col (:) = nan - allocate(this%ws_col (begc:endc)) ; this%ws_col (:) = nan - allocate(this%betaprime_col (begc:endc)) ; this%betaprime_col (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%lake_icefrac_col(begc:endc,:) = spval - call hist_addfld2d (fname='LAKEICEFRAC', units='unitless', type2d='levlak', & - avgflag='A', long_name='lake layer ice mass fraction', & - ptr_col=this%lake_icefrac_col, default='inactive') - - this%lake_icefracsurf_col(begc:endc) = spval - call hist_addfld1d (fname='LAKEICEFRAC_SURF', units='unitless', & - avgflag='A', long_name='surface lake layer ice mass fraction', & - ptr_col=this%lake_icefracsurf_col, set_nolake=spval) - - this%lake_icethick_col(begc:endc) = spval ! This will be more useful than LAKEICEFRAC for many users. - call hist_addfld1d (fname='LAKEICETHICK', units='m', & - avgflag='A', long_name='thickness of lake ice (including physical expansion on freezing)', & - ptr_col=this%lake_icethick_col, set_nolake=spval) - - this%savedtke1_col(begc:endc) = spval - call hist_addfld1d (fname='TKE1', units='W/(mK)', & - avgflag='A', long_name='top lake level eddy thermal conductivity', & - ptr_col=this%savedtke1_col) - - this%ram1_lake_patch(begp:endp) = spval - call hist_addfld1d (fname='RAM_LAKE', units='s/m', & - avgflag='A', long_name='aerodynamic resistance for momentum (lakes only)', & - ptr_patch=this%ram1_lake_patch, set_nolake=spval, default='inactive') - - this%ust_lake_col(begc:endc) = spval - call hist_addfld1d (fname='UST_LAKE', units='m/s', & - avgflag='A', long_name='friction velocity (lakes only)', & - ptr_col=this%ust_lake_col, set_nolake=spval, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize time constant and time varying module variables - ! - ! !USES: - use clm_varctl , only : fsurdat - use clm_varctl , only : iulog - use clm_varpar , only : nlevlak - use clm_varcon , only : tkwat - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use ncdio_pio , only : ncd_pio_openfile, ncd_inqfdims, ncd_pio_closefile, ncd_inqdid, ncd_inqdlen - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,g,i,j,l,lev - logical :: readvar - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: locfn ! local filename - real(r8) :: depthratio ! ratio of lake depth to standard deep lake depth - real(r8) ,pointer :: lakefetch_in (:) ! read in - lakefetch - real(r8) ,pointer :: etal_in (:) ! read in - etal - !----------------------------------------------------------------------- - - !------------------------------------------------- - ! Initialize time constant variables - !------------------------------------------------- - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! Read lake eta - allocate(etal_in(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='ETALAKE', flag='read', data=etal_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - write(iulog,*) 'WARNING:: ETALAKE not found on surface data set. All lake columns will have eta', & - ' set equal to default value as a function of depth.' - end if - etal_in(:) = -1._r8 - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%etal_col(c) = etal_in(g) - end do - deallocate(etal_in) - - ! Read lake fetch - allocate(lakefetch_in(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='LAKEFETCH', flag='read', data=lakefetch_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - write(iulog,*) 'WARNING:: LAKEFETCH not found on surface data set. All lake columns will have fetch', & - ' set equal to default value as a function of depth.' - end if - lakefetch_in(:) = -1._r8 - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - this%lakefetch_col(c) = lakefetch_in(g) - end do - deallocate(lakefetch_in) - - call ncd_pio_closefile(ncid) - - !------------------------------------------------- - ! Initialize time varying variables - !------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%lakpoi(l)) then - - ! Set lake ice fraction and top eddy conductivity from previous timestep - ! Always initialize with no ice to prevent excessive ice sheets from forming when - ! starting with old lake model that has unrealistically cold lake conseratures. - ! Keep lake temperature as is, and the energy deficit below freezing (which is no smaller - ! than it would have been with prognostic ice, as the temperature would then have been higher - ! and more heat would have flowed out of the lake) will be converted to ice in the first timestep. - this%lake_icefrac_col(c,1:nlevlak) = 0._r8 - - ! Set lake top eddy conductivity from previous timestep - this%savedtke1_col(c) = tkwat - - ! Set column friction vlocity - this%ust_lake_col(c) = 0.1_r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(lakestate_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='LAKE_ICEFRAC', xtype=ncd_double, & - dim1name='column', dim2name='levlak', switchdim=.true., & - long_name='lake layer ice fraction', units='kg/kg', & - interpinic_flag='interp', readvar=readvar, data=this%lake_icefrac_col) - - call restartvar(ncid=ncid, flag=flag, varname='SAVEDTKE1', xtype=ncd_double, & - dim1name='column', & - long_name='top lake layer eddy conductivity', units='W/(m K)', & - interpinic_flag='interp', readvar=readvar, data=this%savedtke1_col) - - call restartvar(ncid=ncid, flag=flag, varname='USTLAKE', xtype=ncd_double, & - dim1name='column', & - long_name='friction velocity for lakes', units='m/s', & - interpinic_flag='interp', readvar=readvar, data=this%ust_lake_col) - - end subroutine Restart - -end module LakeStateType - diff --git a/src/biogeophys/LakeTemperatureMod.F90 b/src/biogeophys/LakeTemperatureMod.F90 deleted file mode 100644 index bcb2965afa..0000000000 --- a/src/biogeophys/LakeTemperatureMod.F90 +++ /dev/null @@ -1,1466 +0,0 @@ -module LakeTemperatureMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates surface fluxes and temperature for lakes. - ! Created by Zack Subin, 2009 - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use ch4Mod , only : ch4_type - use EnergyFluxType , only : energyflux_type - use LakeStateType , only : lakestate_type - use SoilStateType , only : soilstate_type - use SolarAbsorbedType , only : solarabs_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: LakeTemperature ! Calculates Lake related temperature - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: SoilThermProp_Lake ! Set therm conductivities and heat cap of snow/soil layers - private :: PhaseChange_Lake ! Calculation of the phase change within snow/soil/lake layers - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine LakeTemperature(bounds, num_lakec, filter_lakec, num_lakep, filter_lakep, & - solarabs_inst, soilstate_inst, waterstate_inst, waterflux_inst, ch4_inst, & - energyflux_inst, temperature_inst, lakestate_inst) - ! - ! !DESCRIPTION: - ! Calculates temperatures in the 25-45 layer column of (possible) snow, - ! lake water, soil, and bedrock beneath lake. - ! Snow and soil temperatures are determined as in Laketemperature, except - ! for appropriate boundary conditions at the top of the snow (the flux is fixed - ! to be the ground heat flux calculated in LakeFluxes), the bottom of the snow - ! (adjacent to top lake layer), and the top of the soil (adjacent to the bottom - ! lake layer). Also, the soil is kept fully saturated. - ! The whole column is solved simultaneously as one tridiagonal matrix. - ! Major changes from CLM4: - ! i) Lake water layers can freeze by any fraction and release latent heat; thermal - ! and mechanical properties are adjusted for ice fraction. - ! ii) Convective mixing (though not eddy diffusion) still occurs for frozen lakes. - ! iii) No sunlight is absorbed in the lake if there are snow layers (except for that allowed through - ! to the top "soil" layer by SNICAR) - ! iv) Light is allowed to reach the top soil layer (where it is assumed to be completely absorbed). - ! v) Lakes have variable depth, set ultimately in surface data set but now in initLakeMod. - ! vi) The extinction coefficient is now variable with depth. - ! vii) The fraction of shortwave absorbed at the surface is now the NIR fraction, rather than a fixed parameter. - ! viii) Enhanced background diffusion and option for increased mixing for deep lakes is added. - ! See discussion in Subin et al. 2011 - ! - ! Lakes are allowed to have variable depth, set in initLakeMod. - ! - ! Use the Crank-Nicholson method to set up tridiagonal system of equations to - ! solve for ts at time n+1, where the temperature equation for layer i is - ! r_i = a_i [ts_i-1] n+1 + b_i [ts_i] n+1 + c_i [ts_i+1] n+1 - ! - ! The solution conserves energy as: - ! - ! - ! cv*([ts(top soisno layer)] n+1 - [ts(top soisno layer)] n)*dz(top soisno layer)/dt + ... + - ! cv*([ts(nlevlak+nlevgrnd)] n+1 - [ts(nlevlak+nlevgrnd)] n)*dz(nlevlak+nlevgrnd)/dt = eflx_soil_grnd - ! cv is not constant. - ! ts is with respect to freezing temperature, as there is a discontinuity in cv at this temperature. - ! - ! where: - ! [ts] n = old temperature (kelvin) - ! [ts] n+1 = new temperature (kelvin) - ! eflx_soil_grnd = energy flux into lake (w/m**2) - ! = betaprime*sabg + forc_lwrad - eflx_lwrad_out - eflx_sh_tot - eflx_lh_tot - ! (This is now the same as the ground heat flux.) - ! + phi(1) + ... + phi(nlevlak) + phi(top soil level) - ! betaprime = beta (NIR fraction) for no snow layers, and sabg_lyr(p,jtop)/sabg(p) for snow layers. - ! - ! WARNING: This subroutine assumes lake columns have one and only one pft. - ! - ! Outline: - ! 1 ) Initialization - ! 2 ) Lake density - ! 3 ) Diffusivity - ! 4 ) Heat source term from solar radiation penetrating lake - ! 5 ) Set thermal props and find initial energy content - ! 6 ) Set up vectors for tridiagonal matrix solution - ! 7 ) Solve tridiagonal and back-substitute - ! 8 ) (Optional) Do first energy check using temperature change at constant heat capacity. - ! 9 ) Phase change - ! 9.5) (Optional) Do second energy check using temperature change and latent heat, - ! considering changed heat capacity. Also do soil water balance check. - ! 10 ) Convective mixing - ! 11 ) Do final energy check to detect small numerical errors (especially from convection) - ! and dump small imbalance into sensible heat, or pass large errors to BalanceCheckMod for abort. - ! - ! !USES: - use LakeCon , only : betavis, za_lake, n2min, tdmax, pudz, depthcrit, mixfact - use LakeCon , only : lakepuddling, lake_no_ed - use QSatMod , only : QSat - use TridiagonalMod , only : Tridiagonal - use clm_varpar , only : nlevlak, nlevgrnd, nlevsno - use clm_time_manager , only : get_step_size - use clm_varcon , only : hfus, cpliq, cpice, tkwat, tkice, denice - use clm_varcon , only : vkc, grav, denh2o, tfrz, cnfac - use clm_varctl , only : iulog, use_lch4 - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for non-lake points - integer , intent(in) :: num_lakep ! number of column non-lake points in pft filter - integer , intent(in) :: filter_lakep(:) ! patch filter for non-lake points - type(solarabs_type) , intent(in) :: solarabs_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(lakestate_type) , intent(inout) :: lakestate_inst - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: p0 = 1._r8 ! neutral value of turbulent prandtl number - integer :: i,j,fc,fp,g,c,p ! do loop or array index - real(r8) :: dtime ! land model time step (sec) - real(r8) :: beta(bounds%begc:bounds%endc) ! fraction of solar rad absorbed at surface: equal to NIR fraction - ! of surface absorbed shortwave - real(r8) :: eta ! light extinction coefficient (/m): depends on lake type - real(r8) :: cwat ! specific heat capacity of water (j/m**3/kelvin) - real(r8) :: cice_eff ! effective heat capacity of ice (using density of - ! water because layer depth is not adjusted when freezing - real(r8) :: cfus ! effective heat of fusion per unit volume - ! using water density as above - real(r8) :: km ! molecular diffusion coefficient (m**2/s) - real(r8) :: tkice_eff ! effective conductivity since layer depth is constant - real(r8) :: a(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! "a" vector for tridiagonal matrix - real(r8) :: b(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! "b" vector for tridiagonal matrix - real(r8) :: c1(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! "c" vector for tridiagonal matrix - real(r8) :: r(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! "r" vector for tridiagonal solution - real(r8) :: rhow(bounds%begc:bounds%endc,nlevlak) ! density of water (kg/m**3) - real(r8) :: phi(bounds%begc:bounds%endc,nlevlak) ! solar radiation absorbed by layer (w/m**2) - real(r8) :: kme(bounds%begc:bounds%endc,nlevlak) ! molecular + eddy diffusion coefficient (m**2/s) - real(r8) :: rsfin ! relative flux of solar radiation into layer - real(r8) :: rsfout ! relative flux of solar radiation out of layer - real(r8) :: phi_soil(bounds%begc:bounds%endc) ! solar radiation into top soil layer (W/m**2) - real(r8) :: ri ! richardson number - real(r8) :: fin(bounds%begc:bounds%endc) ! net heat flux into lake at ground interface (w/m**2) - real(r8) :: ocvts(bounds%begc:bounds%endc) ! (cwat*(t_lake[n ])*dz - real(r8) :: ncvts(bounds%begc:bounds%endc) ! (cwat*(t_lake[n+1])*dz - real(r8) :: ke ! eddy diffusion coefficient (m**2/s) - real(r8) :: zin ! depth at top of layer (m) - real(r8) :: zout ! depth at bottom of layer (m) - real(r8) :: drhodz ! d [rhow] /dz (kg/m**4) - real(r8) :: n2 ! brunt-vaisala frequency (/s**2) - real(r8) :: num ! used in calculating ri - real(r8) :: den ! used in calculating ri - real(r8) :: tav_froz(bounds%begc:bounds%endc) ! used in aver temp for convectively mixed layers (C) - real(r8) :: tav_unfr(bounds%begc:bounds%endc) ! " - real(r8) :: nav(bounds%begc:bounds%endc) ! used in aver temp for convectively mixed layers - real(r8) :: phidum ! temporary value of phi - real(r8) :: iceav(bounds%begc:bounds%endc) ! used in calc aver ice for convectively mixed layers - real(r8) :: qav(bounds%begc:bounds%endc) ! used in calc aver heat content for conv. mixed layers - integer :: jtop(bounds%begc:bounds%endc) ! top level for each column (no longer all 1) - real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat capacity of soil/snow [J/(m2 K)] - real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! thermal conductivity of soil/snow [W/(m K)] - ! (at interface below, except for j=0) - real(r8) :: cv_lake (bounds%begc:bounds%endc,1:nlevlak) ! heat capacity [J/(m2 K)] - real(r8) :: tk_lake (bounds%begc:bounds%endc,1:nlevlak) ! thermal conductivity at layer node [W/(m K)] - real(r8) :: cvx (bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! heat capacity for whole column [J/(m2 K)] - real(r8) :: tkix(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! thermal conductivity at layer interfaces - ! for whole column [W/(m K)] - real(r8) :: tx(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! temperature of whole column [K] - real(r8) :: tktopsoillay(bounds%begc:bounds%endc) ! thermal conductivity [W/(m K)] - real(r8) :: fnx(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! heat diffusion through the layer interface below [W/m2] - real(r8) :: phix(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! solar source term for whole column [W/m**2] - real(r8) :: zx(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! interface depth (+ below surface) for whole column [m] - real(r8) :: dzm ! used in computing tridiagonal matrix [m] - real(r8) :: dzp ! used in computing tridiagonal matrix [m] - integer :: jprime ! j - nlevlak - real(r8) :: factx(bounds%begc:bounds%endc,-nlevsno+1:nlevlak+nlevgrnd) ! coefficient used in computing tridiagonal matrix - real(r8) :: t_lake_bef(bounds%begc:bounds%endc,1:nlevlak) ! beginning lake temp for energy conservation check [K] - real(r8) :: t_soisno_bef(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! beginning soil temp for E cons. check [K] - real(r8) :: lhabs(bounds%begc:bounds%endc) ! total per-column latent heat abs. from phase change (J/m^2) - real(r8) :: esum1(bounds%begc:bounds%endc) ! temp for checking energy (J/m^2) - real(r8) :: esum2(bounds%begc:bounds%endc) ! "" - real(r8) :: zsum(bounds%begc:bounds%endc) ! temp for putting ice at the top during convection (m) - real(r8) :: wsum(bounds%begc:bounds%endc) ! temp for checking water (kg/m^2) - real(r8) :: wsum_end(bounds%begc:bounds%endc) ! temp for checking water (kg/m^2) - real(r8) :: sabg_col(bounds%begc:bounds%endc) ! absorbed ground solar for column (W/m^2) - real(r8) :: sabg_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:1) ! absorbed ground solar in layer for column (W/m^2) - real(r8) :: sabg_nir ! NIR that is absorbed (W/m^2) - integer :: jconvect(bounds%begc:bounds%endc) ! Lowest level where convection occurs - integer :: jconvectbot(bounds%begc:bounds%endc) ! Hightest level where bottom-originating convection occurs - logical :: bottomconvect(bounds%begc:bounds%endc) ! Convection originating in bottom layer of lake triggers special convection loop - real(r8) :: fangkm ! (m^2/s) extra diffusivity based on Fang & Stefan 1996, citing Ellis, 1991 - - ! They think that mixing energy will generally get into lake to make - ! diffusivity exceed molecular; the energy is damped out according to the Brunt-Vaisala - ! frequency, yielding a maximum diffusivity for neutral stability of about 6 times molecular - ! For puddling - logical :: puddle(bounds%begc:bounds%endc) - real(r8) :: icesum(bounds%begc:bounds%endc) ! m - logical :: frzn(bounds%begc:bounds%endc) - !----------------------------------------------------------------------- - - associate( & - dz_lake => col%dz_lake , & ! Input: [real(r8) (:,:) ] layer thickness for lake (m) - z_lake => col%z_lake , & ! Input: [real(r8) (:,:) ] layer depth for lake (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness for snow & soil (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth for snow & soil (m) - snl => col%snl , & ! Input: [integer (:) ] negative of number of snow layers - lakedepth => col%lakedepth , & ! Input: [real(r8) (:) ] column lake depth (m) - - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - sabg_lyr => solarabs_inst%sabg_lyr_patch , & ! Input: [real(r8) (:,:) ] absorbed solar radiation (pft,lyr) [W/m2] - fsds_nir_d => solarabs_inst%fsds_nir_d_patch , & ! Input: [real(r8) (:) ] incident direct beam nir solar radiation (W/m**2) - fsds_nir_i => solarabs_inst%fsds_nir_i_patch , & ! Input: [real(r8) (:) ] incident diffuse nir solar radiation (W/m**2) - fsr_nir_d => solarabs_inst%fsr_nir_d_patch , & ! Input: [real(r8) (:) ] reflected direct beam nir solar radiation (W/m**2) - fsr_nir_i => solarabs_inst%fsr_nir_i_patch , & ! Input: [real(r8) (:) ] reflected diffuse nir solar radiation (W/m**2) - - etal => lakestate_inst%etal_col , & ! Input: [real(r8) (:) ] extinction coefficient from surface data (1/m) - ks => lakestate_inst%ks_col , & ! Input: [real(r8) (:) ] coefficient passed to LakeTemperature - ws => lakestate_inst%ws_col , & ! Input: [real(r8) (:) ] surface friction velocity (m/s) - lake_raw => lakestate_inst%lake_raw_col , & ! Input: [real(r8) (:) ] aerodynamic resistance for moisture (s/m) - - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) [for snow & soil layers] - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) [for snow & soil layers] - frac_iceold => waterstate_inst%frac_iceold_col , & ! Output: [real(r8) (:,:) ] fraction of ice relative to the tot water - - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil (or snow) temperature (Kelvin) - t_lake => temperature_inst%t_lake_col , & ! Output: [real(r8) (:,:) ] col lake temperature (Kelvin) - - beta => lakestate_inst%betaprime_col , & ! Output: [real(r8) (:) ] col effective beta: sabg_lyr(p,jtop) for snow layers, beta otherwise - lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Output: [real(r8) (:,:) ] col mass fraction of lake layer that is frozen - lake_icefracsurf => lakestate_inst%lake_icefracsurf_col , & ! Output: [real(r8) (:,:) ] col mass fraction of surface lake layer that is frozen - lake_icethick => lakestate_inst%lake_icethick_col , & ! Output: [real(r8) (:) ] col ice thickness (m) (integrated if lakepuddling) - savedtke1 => lakestate_inst%savedtke1_col , & ! Output: [real(r8) (:) ] col top level eddy conductivity (W/mK) - lakeresist => lakestate_inst%lakeresist_col , & ! Output: [real(r8) (:) ] col (Needed for calc. of grnd_ch4_cond) (s/m) - - grnd_ch4_cond => ch4_inst%grnd_ch4_cond_col , & ! Output: [real(r8) (:) ] tracer conductance for boundary layer [m/s] (only over lake points) - - eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Output: [real(r8) (:) ] heat flux into snow / lake (W/m**2) [+ = into soil] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_gnet => energyflux_inst%eflx_gnet_patch , & ! Output: [real(r8) ( :) ] net heat flux into ground (W/m**2) at the surface interface - errsoi => energyflux_inst%errsoi_col & ! Output: [real(r8) (:) ] soil/lake energy conservation error (W/m**2) - ) - - ! 1!) Initialization - ! Determine step size - - dtime = get_step_size() - - ! Initialize constants - cwat = cpliq*denh2o ! water heat capacity per unit volume - cice_eff = cpice*denh2o !use water density because layer depth is not adjusted - !for freezing - cfus = hfus*denh2o ! latent heat per unit volume - tkice_eff = tkice * denice/denh2o !effective conductivity since layer depth is constant - km = tkwat/cwat ! a constant (molecular diffusivity) - - ! Needed for Lahey compiler which doesn't seem to allow shortcircuit logic for undefined variables. - puddle(bounds%begc:bounds%endc) = .false. - frzn(bounds%begc:bounds%endc) = .false. - - ! Begin calculations - - do fc = 1, num_lakec - c = filter_lakec(fc) - - ! Initialize quantities needed below - - ocvts(c) = 0._r8 - ncvts(c) = 0._r8 - esum1(c) = 0._r8 - esum2(c) = 0._r8 - if (use_lch4) then - jconvect(c) = 0 - jconvectbot(c) = nlevlak+1 - lakeresist(c) = 0._r8 - end if - bottomconvect(bounds%begc:bounds%endc) = .false. - - end do - - ! Initialize set of previous time-step variables as in DriverInit, - ! which is currently not called over lakes. This has to be done - ! here because phase change will occur in this routine. - ! Ice fraction of snow at previous time step - - do j = -nlevsno+1,0 - do fc = 1, num_lakec - c = filter_lakec(fc) - if (j >= snl(c) + 1) then - frac_iceold(c,j) = h2osoi_ice(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j)) - end if - end do - end do - - ! Prepare for lake layer temperature calculations below - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - - ! fin(c) = betaprime * sabg(p) + forc_lwrad(c) - (eflx_lwrad_out(p) + & - ! eflx_sh_tot(p) + eflx_lh_tot(p)) - ! fin(c) now passed from LakeFluxes as eflx_gnet - fin(c) = eflx_gnet(p) - - ! Calculate the NIR fraction of absorbed solar. This will now be the "beta" parameter. - ! Total NIR absorbed: - sabg_nir = fsds_nir_d(p) + fsds_nir_i(p) - fsr_nir_d(p) - fsr_nir_i(p) - sabg_nir = min(sabg_nir, sabg(p)) - beta(c) = sabg_nir/max(1.e-5_r8,sabg(p)) - beta(c) = beta(c) + (1._r8-beta(c))*betavis - - end do - - ! 2!) Lake density - - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - rhow(c,j) = (1._r8 - lake_icefrac(c,j)) * & - 1000._r8*( 1.0_r8 - 1.9549e-05_r8*(abs(t_lake(c,j)-tdmax))**1.68_r8 ) & - + lake_icefrac(c,j)*denice - ! Allow for ice fraction; assume constant ice density. - ! This is not the correct average-weighting but that's OK because the density will only - ! be used for convection for lakes with ice, and the ice fraction will dominate the - ! density differences between layers. - ! Using this average will make sure that surface ice is treated properly during - ! convective mixing. - end do - end do - - ! 3!) Diffusivity and implied thermal "conductivity" = diffusivity * cwat - do j = 1, nlevlak-1 - do fc = 1, num_lakec - c = filter_lakec(fc) - drhodz = (rhow(c,j+1)-rhow(c,j)) / (z_lake(c,j+1)-z_lake(c,j)) - n2 = grav / rhow(c,j) * drhodz - - ! Fixed sign error here: our z goes up going down into the lake, so no negative - ! sign is needed to make this positive unlike in Hostetler. --ZS - num = 40._r8 * n2 * (vkc*z_lake(c,j))**2._r8 - den = max( (ws(c)**2._r8) * exp(-2._r8*ks(c)*z_lake(c,j)), 1.e-10_r8 ) - ri = ( -1._r8 + sqrt( max(1._r8+num/den, 0._r8) ) ) / 20._r8 - - if (lakepuddling .and. j == 1) frzn(c) = .false. - - if (t_grnd(c) > tfrz .and. t_lake(c,1) > tfrz .and. snl(c) == 0 .and. & - (.not. lakepuddling .or. (lake_icefrac(c,j) == 0._r8 .and. .not. frzn(c))) ) then - ke = vkc*ws(c)*z_lake(c,j)/p0 * exp(-ks(c)*z_lake(c,j)) / (1._r8+37._r8*ri*ri) - kme(c,j) = km + ke - - if (.not. lake_no_ed) then - fangkm = 1.039e-8_r8 * max(n2,n2min)**(-0.43_r8) ! Fang & Stefan 1996, citing Ellis et al 1991 - kme(c,j) = kme(c,j) + fangkm - end if - if (lakedepth(c) >= depthcrit) then - kme(c,j) = kme(c,j) * mixfact - end if - - tk_lake(c,j) = kme(c,j)*cwat - else - kme(c,j) = km - if (.not. lake_no_ed) then - fangkm = 1.039e-8_r8 * max(n2,n2min)**(-0.43_r8) - kme(c,j) = kme(c,j) + fangkm - if (lakedepth(c) >= depthcrit) then - kme(c,j) = kme(c,j) * mixfact - end if - tk_lake(c,j) = kme(c,j)*cwat*tkice_eff / ( (1._r8-lake_icefrac(c,j))*tkice_eff & - + kme(c,j)*cwat*lake_icefrac(c,j) ) - else - tk_lake(c,j) = tkwat*tkice_eff / ( (1._r8-lake_icefrac(c,j))*tkice_eff & - + tkwat*lake_icefrac(c,j) ) - ! Assume the resistances add as for the calculation of conductivities at layer interfaces. - end if - if (lakepuddling) frzn(c) = .true. - ! Prevent eddy mixing beneath frozen layers even when surface is unfrozen. - end if - end do - end do - - do fc = 1, num_lakec - c = filter_lakec(fc) - - j = nlevlak - kme(c,nlevlak) = kme(c,nlevlak-1) - - if (t_grnd(c) > tfrz .and. t_lake(c,1) > tfrz .and. snl(c) == 0 .and. & - (.not. lakepuddling .or. (lake_icefrac(c,j) == 0._r8 .and. .not. frzn(c)) ) ) then - tk_lake(c,j) = tk_lake(c,j-1) - else - if (.not. lake_no_ed) then - tk_lake(c,j) = kme(c,j)*cwat*tkice_eff / ( (1._r8-lake_icefrac(c,j))*tkice_eff & - + kme(c,j)*cwat*lake_icefrac(c,j) ) - else - tk_lake(c,j) = tkwat*tkice_eff / ( (1._r8-lake_icefrac(c,j))*tkice_eff & - + tkwat*lake_icefrac(c,j) ) - end if - end if - - ! Use in surface flux calculation for next timestep. - savedtke1(c) = kme(c,1)*cwat ! Will only be used if unfrozen - ! set number of column levels for use by Tridiagonal below - jtop(c) = snl(c) + 1 - end do - - ! 4!) Heat source term - do j = 1, nlevlak - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - - ! If no eta from surface data, - ! Set eta, the extinction coefficient, according to L Hakanson, Aquatic Sciences, 1995 - ! (regression of Secchi Depth with lake depth for small glacial basin lakes), and the - ! Poole & Atkins expression for extinction coeffient of 1.7 / Secchi Depth (m). - if (etal(c) > 0._r8) then ! use eta from surface data - eta = etal(c) - else - eta = 1.1925_r8*max(lakedepth(c),1._r8)**(-0.424_r8) - end if - - zin = z_lake(c,j) - 0.5_r8*dz_lake(c,j) - zout = z_lake(c,j) + 0.5_r8*dz_lake(c,j) - rsfin = exp( -eta*max( zin-za_lake,0._r8 ) ) - rsfout = exp( -eta*max( zout-za_lake,0._r8 ) ) - - ! Let rsfout for bottom layer go into soil. - ! This looks like it should be robust even for pathological cases, - ! like lakes thinner than za_lake. - - if (t_grnd(c) > tfrz .and. t_lake(c,1) > tfrz .and. snl(c) == 0) then - phidum = (rsfin-rsfout) * sabg(p) * (1._r8-beta(c)) - if (j == nlevlak) then - phi_soil(c) = rsfout * sabg(p) * (1._r8-beta(c)) - end if - else if (j == 1 .and. snl(c) == 0) then !if frozen but no snow layers - phidum = sabg(p) * (1._r8-beta(c)) - ! This should be improved upon; Mironov 2002 suggests that SW can penetrate thin ice and may - ! cause spring convection. - else if (j == 1) then - phidum = sabg_lyr(p,j) - !some radiation absorbed in snow layers, the rest in the top layer of lake - !radiation absorbed in snow layers will be applied below - else - phidum = 0._r8 - if (j == nlevlak) phi_soil(c) = 0._r8 - end if - phi(c,j) = phidum - - end do - end do - - ! 5!) Set thermal properties and check initial energy content. - - ! For lake - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - cv_lake(c,j) = dz_lake(c,j) * (cwat*(1._r8-lake_icefrac(c,j)) + cice_eff*lake_icefrac(c,j)) - end do - end do - - ! For snow / soil - call SoilThermProp_Lake(bounds, num_lakec, filter_lakec, & - tk(bounds%begc:bounds%endc, :), & - cv(bounds%begc:bounds%endc, :), & - tktopsoillay(bounds%begc:bounds%endc), & - soilstate_inst, waterstate_inst, temperature_inst) - - ! Sum cv*t_lake for energy check - ! Include latent heat term, and use tfrz as reference temperature - ! to prevent abrupt change in heat content due to changing heat capacity with phase change. - - ! This will need to be over all soil / lake / snow layers. Lake is below. - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - ocvts(c) = ocvts(c) + cv_lake(c,j)*(t_lake(c,j)-tfrz) & - + cfus*dz_lake(c,j)*(1._r8-lake_icefrac(c,j)) - t_lake_bef(c,j) = t_lake(c,j) - end do - end do - - ! Now do for soil / snow layers - do j = -nlevsno + 1, nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (j >= jtop(c)) then - ocvts(c) = ocvts(c) + cv(c,j)*(t_soisno(c,j)-tfrz) & - + hfus*h2osoi_liq(c,j) - if (j == 1 .and. h2osno(c) > 0._r8 .and. j == jtop(c)) then - ocvts(c) = ocvts(c) - h2osno(c)*hfus - end if - t_soisno_bef(c,j) = t_soisno(c,j) - end if - end do - end do - - !!!!!!!!!!!!!!!!!!! - ! 6!) Set up vector r and vectors a, b, c1 that define tridiagonal matrix - - ! Heat capacity and resistance of snow without snow layers (<1cm) is ignored during diffusion, - ! but its capacity to absorb latent heat may be used during phase change. - - ! Transfer sabg and sabg_lyr to column level - do j = -nlevsno+1,1 - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - - if (j >= jtop(c)) then - if (j == jtop(c)) sabg_col(c) = sabg(p) - sabg_lyr_col(c,j) = sabg_lyr(p,j) - end if - end do - end do - - ! Set up interface depths, zx, heat capacities, cvx, solar source terms, phix, and temperatures, tx. - do j = -nlevsno+1, nlevlak+nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - - jprime = j - nlevlak - - if (j >= jtop(c)) then - if (j < 1) then !snow layer - zx(c,j) = z(c,j) - cvx(c,j) = cv(c,j) - if (j == jtop(c)) then ! no absorption because it has already been assigned to the surface - ! interface - phix(c,j) = 0._r8 - else - phix(c,j) = sabg_lyr_col(c,j) !New for SNICAR - end if - tx(c,j) = t_soisno(c,j) - else if (j <= nlevlak) then !lake layer - zx(c,j) = z_lake(c,j) - cvx(c,j) = cv_lake(c,j) - phix(c,j) = phi(c,j) - tx(c,j) = t_lake(c,j) - else !soil layer - zx(c,j) = zx(c,nlevlak) + dz_lake(c,nlevlak)/2._r8 + z(c,jprime) - cvx(c,j) = cv(c,jprime) - if (j == nlevlak + 1) then !top soil layer - phix(c,j) = phi_soil(c) - else !middle or bottom soil layer - phix(c,j) = 0._r8 - end if - tx(c,j) = t_soisno(c,jprime) - end if - end if - - end do - end do - - ! Determine interface thermal conductivities, tkix - - do j = -nlevsno+1, nlevlak+nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - - jprime = j - nlevlak - - if (j >= jtop(c)) then - if (j < 0) then !non-bottom snow layer - tkix(c,j) = tk(c,j) - else if (j == 0) then !bottom snow layer - dzp = zx(c,j+1) - zx(c,j) - tkix(c,j) = tk_lake(c,1)*tk(c,j)*dzp / & - (tk(c,j)*z_lake(c,1) + tk_lake(c,1)*(-z(c,j)) ) - ! tk(c,0) is the conductivity at the middle of that layer, as defined in SoilThermProp_Lake - else if (j < nlevlak) then !non-bottom lake layer - tkix(c,j) = ( tk_lake(c,j)*tk_lake(c,j+1) * (dz_lake(c,j+1)+dz_lake(c,j)) ) & - / ( tk_lake(c,j)*dz_lake(c,j+1) + tk_lake(c,j+1)*dz_lake(c,j) ) - else if (j == nlevlak) then !bottom lake layer - dzp = zx(c,j+1) - zx(c,j) - tkix(c,j) = (tktopsoillay(c)*tk_lake(c,j)*dzp / & - (tktopsoillay(c)*dz_lake(c,j)/2._r8 + tk_lake(c,j)*z(c,1) ) ) - ! tktopsoillay is the conductivity at the middle of that layer, as defined in SoilThermProp_Lake - else !soil layer - tkix(c,j) = tk(c,jprime) - end if - end if - - end do - end do - - - ! Determine heat diffusion through the layer interface and factor used in computing - ! tridiagonal matrix and set up vector r and vectors a, b, c1 that define tridiagonal - ! matrix and solve system - - do j = -nlevsno+1, nlevlak+nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - if (j >= jtop(c)) then - if (j < nlevlak+nlevgrnd) then !top or interior layer - factx(c,j) = dtime/cvx(c,j) - fnx(c,j) = tkix(c,j)*(tx(c,j+1)-tx(c,j))/(zx(c,j+1)-zx(c,j)) - else !bottom soil layer - factx(c,j) = dtime/cvx(c,j) - fnx(c,j) = 0._r8 !not used - end if - end if - enddo - end do - - do j = -nlevsno+1,nlevlak+nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - if (j >= jtop(c)) then - if (j == jtop(c)) then !top layer - dzp = zx(c,j+1)-zx(c,j) - a(c,j) = 0._r8 - b(c,j) = 1+(1._r8-cnfac)*factx(c,j)*tkix(c,j)/dzp - c1(c,j) = -(1._r8-cnfac)*factx(c,j)*tkix(c,j)/dzp - r(c,j) = tx(c,j) + factx(c,j)*( fin(c) + phix(c,j) + cnfac*fnx(c,j) ) - else if (j < nlevlak+nlevgrnd) then !middle layer - dzm = (zx(c,j)-zx(c,j-1)) - dzp = (zx(c,j+1)-zx(c,j)) - a(c,j) = - (1._r8-cnfac)*factx(c,j)* tkix(c,j-1)/dzm - b(c,j) = 1._r8+ (1._r8-cnfac)*factx(c,j)*(tkix(c,j)/dzp + tkix(c,j-1)/dzm) - c1(c,j) = - (1._r8-cnfac)*factx(c,j)* tkix(c,j)/dzp - r(c,j) = tx(c,j) + cnfac*factx(c,j)*( fnx(c,j) - fnx(c,j-1) ) + factx(c,j)*phix(c,j) - else !bottom soil layer - dzm = (zx(c,j)-zx(c,j-1)) - a(c,j) = - (1._r8-cnfac)*factx(c,j)*tkix(c,j-1)/dzm - b(c,j) = 1._r8+ (1._r8-cnfac)*factx(c,j)*tkix(c,j-1)/dzm - c1(c,j) = 0._r8 - r(c,j) = tx(c,j) - cnfac*factx(c,j)*fnx(c,j-1) - end if - end if - enddo - end do - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - - ! 7!) Solve for tdsolution - - call Tridiagonal(bounds, -nlevsno + 1, nlevlak + nlevgrnd, & - jtop(bounds%begc:bounds%endc), & - num_lakec, filter_lakec, & - a(bounds%begc:bounds%endc, :), & - b(bounds%begc:bounds%endc, :), & - c1(bounds%begc:bounds%endc, :), & - r(bounds%begc:bounds%endc, :), & - tx(bounds%begc:bounds%endc, :)) - - ! Set t_soisno and t_lake - do j = -nlevsno+1, nlevlak + nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - - jprime = j - nlevlak - - ! Don't do anything with invalid snow layers. - if (j >= jtop(c)) then - if (j < 1) then !snow layer - t_soisno(c,j) = tx(c,j) - else if (j <= nlevlak) then !lake layer - t_lake(c,j) = tx(c,j) - else !soil layer - t_soisno(c,jprime) = tx(c,j) - end if - end if - end do - end do - - !!!!!!!!!!!!!!!!!!!!!!! - - ! 8!) Sum energy content and total energy into lake for energy check. Any errors will be from the - ! Tridiagonal solution. - ! This section was for debugging only and has been removed. See original "ch4" branch code. - - !!!!!!!!!!!!!!!!!!!!!!! - - ! 9!) Phase change - call PhaseChange_Lake(bounds, num_lakec, filter_lakec, & - cv(bounds%begc:bounds%endc, :), & - cv_lake(bounds%begc:bounds%endc, :), & - lhabs(bounds%begc:bounds%endc), & - waterstate_inst, waterflux_inst, temperature_inst, & - energyflux_inst, lakestate_inst) - - !!!!!!!!!!!!!!!!!!!!!!! - - ! 9.5!) Second energy check and water check. Now check energy balance before and after phase - ! change, considering the possibility of changed heat capacity during phase change, by - ! using initial heat capacity in the first step, final heat capacity in the second step, - ! and differences from tfrz only to avoid enthalpy correction for (cpliq-cpice)*melt*tfrz. - ! Also check soil water sum. - ! This section was for debugging only and has been removed. See original "ch4" branch code. - - !!!!!!!!!!!!!!!!!!!!!!!!!! - ! 10!) Convective mixing: make sure fracice*dz is conserved, heat content c*dz*T is conserved, and - ! all ice ends up at the top. Done over all lakes even if frozen. - ! Either an unstable density profile or ice in a layer below an incompletely frozen layer will trigger. - - !Recalculate density - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - rhow(c,j) = (1._r8 - lake_icefrac(c,j)) * & - 1000._r8*( 1.0_r8 - 1.9549e-05_r8*(abs(t_lake(c,j)-tdmax))**1.68_r8 ) & - + lake_icefrac(c,j)*denice - end do - end do - - if (lakepuddling) then - ! For sensitivity tests - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (j == 1) then - icesum(c) = 0._r8 - puddle(c) = .false. - end if - - icesum(c) = icesum(c) + lake_icefrac(c,j)*dz(c,j) - - if (j == nlevlak) then - if (icesum(c) >= pudz) puddle(c) = .true. - end if - end do - end do - end if - - ! ZMS: The algorithm here, from CLM2-4 and presumably Hostetler, starts at the top and proceeds down; - ! each time it finds an unstable density profile the lake is mixed from this point to the top fully. - ! Occasionally in deep temperate lakes, the unstable profile can originate at the bottom because of small amounts of - ! heat coming from the sediments. To prevent an unrealistic complete overturning, convection starting in the bottom - ! layer is treated separately, mixing from the bottom up only one level at a time until - ! a stable density profile is attained, rather than mixing all the way to the top immediately. - - ! First examine top nlevlak-1 layers. - do j = 1, nlevlak-2 - do fc = 1, num_lakec - c = filter_lakec(fc) - qav(c) = 0._r8 - nav(c) = 0._r8 - iceav(c) = 0._r8 - end do - - do i = 1, j+1 - do fc = 1, num_lakec - c = filter_lakec(fc) - if ( (.not. lakepuddling .or. .not. puddle(c) ) .and. (rhow(c,j) > rhow(c,j+1) .or. & - (lake_icefrac(c,j) < 1._r8 .and. lake_icefrac(c,j+1) > 0._r8) ) ) then - qav(c) = qav(c) + dz_lake(c,i)*(t_lake(c,i)-tfrz) * & - ((1._r8 - lake_icefrac(c,i))*cwat + lake_icefrac(c,i)*cice_eff) - !tav(c) = tav(c) + t_lake(c,i)*dz_lake(c,i) - iceav(c) = iceav(c) + lake_icefrac(c,i)*dz_lake(c,i) - nav(c) = nav(c) + dz_lake(c,i) - if (use_lch4) then - jconvect(c) = j+1 - end if - end if - end do - end do - - do fc = 1, num_lakec - c = filter_lakec(fc) - - if ( (.not. lakepuddling .or. .not. puddle(c) ) .and. (rhow(c,j) > rhow(c,j+1) .or. & - (lake_icefrac(c,j) < 1._r8 .and. lake_icefrac(c,j+1) > 0._r8) ) ) then - qav(c) = qav(c)/nav(c) - iceav(c) = iceav(c)/nav(c) - !If the average temperature is above freezing, put the extra energy into the water. - !If it is below freezing, take it away from the ice. - if (qav(c) > 0._r8) then - tav_froz(c) = 0._r8 !Celsius - tav_unfr(c) = qav(c) / ((1._r8 - iceav(c))*cwat) - else if (qav(c) < 0._r8) then - tav_froz(c) = qav(c) / (iceav(c)*cice_eff) - tav_unfr(c) = 0._r8 !Celsius - else - tav_froz(c) = 0._r8 - tav_unfr(c) = 0._r8 - end if - end if - end do - - do i = 1, j+1 - do fc = 1, num_lakec - c = filter_lakec(fc) - if (nav(c) > 0._r8) then - - !Put all the ice at the top.! - !If the average temperature is above freezing, put the extra energy into the water. - !If it is below freezing, take it away from the ice. - !For the layer with both ice & water, be careful to use the average temperature - !that preserves the correct total heat content given what the heat capacity of that - !layer will actually be. - if (i == 1) zsum(c) = 0._r8 - if ((zsum(c)+dz_lake(c,i))/nav(c) <= iceav(c)) then - lake_icefrac(c,i) = 1._r8 - t_lake(c,i) = tav_froz(c) + tfrz - else if (zsum(c)/nav(c) < iceav(c)) then - lake_icefrac(c,i) = (iceav(c)*nav(c) - zsum(c)) / dz_lake(c,i) - ! Find average value that preserves correct heat content. - t_lake(c,i) = ( lake_icefrac(c,i)*tav_froz(c)*cice_eff & - + (1._r8 - lake_icefrac(c,i))*tav_unfr(c)*cwat ) & - / ( lake_icefrac(c,i)*cice_eff + (1-lake_icefrac(c,i))*cwat ) + tfrz - else - lake_icefrac(c,i) = 0._r8 - t_lake(c,i) = tav_unfr(c) + tfrz - end if - zsum(c) = zsum(c) + dz_lake(c,i) - - rhow(c,i) = (1._r8 - lake_icefrac(c,i)) * & - 1000._r8*( 1.0_r8 - 1.9549e-05_r8*(abs(t_lake(c,i)-tdmax))**1.68_r8 ) & - + lake_icefrac(c,i)*denice - end if - end do - end do - end do - - ! Now check bottom layer - j = nlevlak-1 - do fc = 1, num_lakec - c = filter_lakec(fc) - - if ( (.not. lakepuddling .or. .not. puddle(c) ) .and. (rhow(c,j) > rhow(c,j+1) .or. & - (lake_icefrac(c,j) < 1._r8 .and. lake_icefrac(c,j+1) > 0._r8) ) ) then - ! convection originating in bottom layer. Could be coming from sediments-- be careful not to - ! unnecessarily mix all the way to the top of the lake - bottomconvect(c) = .true. - end if - end do - - ! Start mixing from bottom up. Only mix as high as the unstable density profile persists. - do j = nlevlak-1, 1, -1 - do fc = 1, num_lakec - c = filter_lakec(fc) - qav(c) = 0._r8 - nav(c) = 0._r8 - iceav(c) = 0._r8 - end do - - do i = j, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - if ( bottomconvect(c) .and. & - (.not. lakepuddling .or. .not. puddle(c) ) .and. (rhow(c,j) > rhow(c,j+1) .or. & - (lake_icefrac(c,j) < 1._r8 .and. lake_icefrac(c,j+1) > 0._r8) ) ) then - qav(c) = qav(c) + dz_lake(c,i)*(t_lake(c,i)-tfrz) * & - ((1._r8 - lake_icefrac(c,i))*cwat + lake_icefrac(c,i)*cice_eff) - !tav(c) = tav(c) + t_lake(c,i)*dz_lake(c,i) - iceav(c) = iceav(c) + lake_icefrac(c,i)*dz_lake(c,i) - nav(c) = nav(c) + dz_lake(c,i) - if (use_lch4) then - jconvectbot(c) = j - end if - end if - end do - end do - - do fc = 1, num_lakec - c = filter_lakec(fc) - - if ( bottomconvect(c) .and. & - (.not. lakepuddling .or. .not. puddle(c) ) .and. (rhow(c,j) > rhow(c,j+1) .or. & - (lake_icefrac(c,j) < 1._r8 .and. lake_icefrac(c,j+1) > 0._r8) ) ) then - qav(c) = qav(c)/nav(c) - iceav(c) = iceav(c)/nav(c) - !If the average temperature is above freezing, put the extra energy into the water. - !If it is below freezing, take it away from the ice. - if (qav(c) > 0._r8) then - tav_froz(c) = 0._r8 !Celsius - tav_unfr(c) = qav(c) / ((1._r8 - iceav(c))*cwat) - else if (qav(c) < 0._r8) then - tav_froz(c) = qav(c) / (iceav(c)*cice_eff) - tav_unfr(c) = 0._r8 !Celsius - else - tav_froz(c) = 0._r8 - tav_unfr(c) = 0._r8 - end if - end if - end do - - do i = j, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - if (bottomconvect(c) .and. nav(c) > 0._r8) then - - !Put all the ice at the top.! - !If the average temperature is above freezing, put the extra energy into the water. - !If it is below freezing, take it away from the ice. - !For the layer with both ice & water, be careful to use the average temperature - !that preserves the correct total heat content given what the heat capacity of that - !layer will actually be. - - if (i == j) zsum(c) = 0._r8 - if ((zsum(c)+dz_lake(c,i))/nav(c) <= iceav(c)) then - lake_icefrac(c,i) = 1._r8 - t_lake(c,i) = tav_froz(c) + tfrz - else if (zsum(c)/nav(c) < iceav(c)) then - lake_icefrac(c,i) = (iceav(c)*nav(c) - zsum(c)) / dz_lake(c,i) - ! Find average value that preserves correct heat content. - t_lake(c,i) = ( lake_icefrac(c,i)*tav_froz(c)*cice_eff & - + (1._r8 - lake_icefrac(c,i))*tav_unfr(c)*cwat ) & - / ( lake_icefrac(c,i)*cice_eff + (1-lake_icefrac(c,i))*cwat ) + tfrz - else - lake_icefrac(c,i) = 0._r8 - t_lake(c,i) = tav_unfr(c) + tfrz - end if - - zsum(c) = zsum(c) + dz_lake(c,i) - - rhow(c,i) = (1._r8 - lake_icefrac(c,i)) * & - 1000._r8*( 1.0_r8 - 1.9549e-05_r8*(abs(t_lake(c,i)-tdmax))**1.68_r8 ) & - + lake_icefrac(c,i)*denice - end if - end do - end do - end do - - ! Calculate lakeresist and grnd_ch4_cond for CH4 Module - ! The CH4 will diffuse directly from the top soil layer to the atmosphere, so - ! the whole lake resistance is included. - - if (use_lch4) then - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (j > jconvect(c) .and. j < jconvectbot(c)) then ! Assume resistance is zero for levels that convect - lakeresist(c) = lakeresist(c) + dz(c,j)/kme(c,j) ! dz/eddy or molecular diffusivity - end if - - if (j == nlevlak) then ! Calculate grnd_ch4_cond - grnd_ch4_cond(c) = 1._r8 / (lakeresist(c) + lake_raw(c)) - - ! Lake water R + aerodynamic R - ! Snow will be considered in methane routine - ! No methane conduction through frozen lake - if (lake_icefrac(c,1) > 0.1_r8) grnd_ch4_cond(c) = 0._r8 - end if - - end do - end do - end if - - !!!!!!!!!!!!!!!!!!!!!!! - ! 11!) Re-evaluate thermal properties and sum energy content. - ! For lake - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - cv_lake(c,j) = dz_lake(c,j) * (cwat*(1._r8-lake_icefrac(c,j)) + cice_eff*lake_icefrac(c,j)) - end do - end do - - ! For snow / soil - call SoilThermProp_Lake(bounds, num_lakec, filter_lakec, & - tk(bounds%begc:bounds%endc, :), & - cv(bounds%begc:bounds%endc, :), & - tktopsoillay(bounds%begc:bounds%endc), & - soilstate_inst, waterstate_inst, temperature_inst) - - - ! Do as above to sum energy content - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - ncvts(c) = ncvts(c) + cv_lake(c,j)*(t_lake(c,j)-tfrz) & - + cfus*dz_lake(c,j)*(1._r8-lake_icefrac(c,j)) - fin(c) = fin(c) + phi(c,j) - end do - end do - - do j = -nlevsno + 1, nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (j >= jtop(c)) then - ncvts(c) = ncvts(c) + cv(c,j)*(t_soisno(c,j)-tfrz) & - + hfus*h2osoi_liq(c,j) - if (j < 1) fin(c) = fin(c) + phix(c,j) !For SNICAR - if (j == 1 .and. h2osno(c) > 0._r8 .and. j == jtop(c)) then - ncvts(c) = ncvts(c) - h2osno(c)*hfus - end if - end if - if (j == 1) fin(c) = fin(c) + phi_soil(c) - end do - end do - - - ! Check energy conservation. - do fp = 1, num_lakep - p = filter_lakep(fp) - c = patch%column(p) - errsoi(c) = (ncvts(c)-ocvts(c)) / dtime - fin(c) - if (abs(errsoi(c)) < 0.10_r8) then ! else send to Balance Check and abort - eflx_sh_tot(p) = eflx_sh_tot(p) - errsoi(c) - eflx_sh_grnd(p) = eflx_sh_grnd(p) - errsoi(c) - eflx_soil_grnd(p) = eflx_soil_grnd(p) + errsoi(c) - eflx_gnet(p) = eflx_gnet(p) + errsoi(c) - if (abs(errsoi(c)) > 1.e-3_r8) then - write(iulog,*)'errsoi incorporated into sensible heat in LakeTemperature: c, (W/m^2):', c, errsoi(c) - end if - errsoi(c) = 0._r8 - end if - - end do - ! This loop assumes only one point per column. - - ! lake_icethickness and lake_icefraction at surface diagnostic. - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - if (j == 1) lake_icethick(c) = 0._r8 - if (j == 1) lake_icefracsurf(c) = lake_icefrac(c,1) - - lake_icethick(c) = lake_icethick(c) + lake_icefrac(c,j)*dz_lake(c,j)*denh2o/denice - ! Convert from nominal to physical thickness - end do - end do - - end associate - end subroutine LakeTemperature - - !----------------------------------------------------------------------- - subroutine SoilThermProp_Lake (bounds, num_lakec, filter_lakec, tk, cv, tktopsoillay, & - soilstate_inst, waterstate_inst, temperature_inst) - ! - ! !DESCRIPTION: - ! Calculation of thermal conductivities and heat capacities of - ! snow/soil layers - ! (1) The volumetric heat capacity is calculated as a linear combination - ! in terms of the volumetric fraction of the constituent phases. - ! - ! (2) The thermal conductivity of soil is computed from the algorithm of - ! Johansen (as reported by Farouki 1981), and of snow is from the - ! formulation used in SNTHERM (Jordan 1991). - ! The thermal conductivities at the interfaces between two neighboring - ! layers (j, j+1) are derived from an assumption that the flux across - ! the interface is equal to that from the node j to the interface and the - ! flux from the interface to the node j+1. - ! - ! For lakes, the proper soil layers (not snow) should always be saturated. - ! - ! !USES: - use clm_varcon , only : denh2o, denice, tfrz, tkwat, tkice, tkair - use clm_varcon , only : cpice, cpliq, thk_bedrock, csol_bedrock - use clm_varpar , only : nlevsno, nlevsoi, nlevgrnd - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - real(r8) , intent(out) :: cv( bounds%begc: , -nlevsno+1: ) ! heat capacity [J/(m2 K)] [col, lev] - real(r8) , intent(out) :: tk( bounds%begc: , -nlevsno+1: ) ! thermal conductivity [W/(m K)] [col, lev] - real(r8) , intent(out) :: tktopsoillay( bounds%begc: ) ! thermal conductivity [W/(m K)] [col] - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - - ! - ! !LOCAL VARIABLES: - integer :: l,c,j ! indices - integer :: fc ! lake filtered column indices - real(r8) :: bw ! partial density of water (ice + liquid) - real(r8) :: dksat ! thermal conductivity for saturated soil (j/(k s m)) - real(r8) :: dke ! kersten number - real(r8) :: fl ! fraction of liquid or unfrozen water to total water - real(r8) :: satw ! relative total water content of soil. - real(r8) :: thk(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! thermal conductivity of layer - real(r8) :: xicevol ! (virtual excess ice volume per nominal soil volume) - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tktopsoillay) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl , & ! Input: [integer (:)] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:)] layer thickness (m) - zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:)] layer depth (m) - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:)] volumetric soil water at saturation (porosity) - tksatu => soilstate_inst%tksatu_col , & ! Input: [real(r8) (:,:)] thermal conductivity, saturated soil [W/m-K] - tkmg => soilstate_inst%tkmg_col , & ! Input: [real(r8) (:,:)] thermal conductivity, soil minerals [W/m-K] - tkdry => soilstate_inst%tkdry_col , & ! Input: [real(r8) (:,:)] thermal conductivity, dry soil (W/m/Kelvin) - csol => soilstate_inst%csol_col , & ! Input: [real(r8) (:,:)] heat capacity, soil solids (J/m**3/Kelvin) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:)] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:)] ice lens (kg/m2) - - t_soisno => temperature_inst%t_soisno_col & ! Input: [real(r8) (:,:)] soil temperature (Kelvin) - ) - - ! Thermal conductivity of soil from Farouki (1981) - - do j = -nlevsno+1,nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - - ! Only examine levels from 1->nlevsoi - if (j >= 1 .and. j <= nlevsoi) then - ! l = clandunit(c) - ! if (ityplun(l) /= istwet .AND. ityplun(l) /= istice) then - ! This could be altered later for allowing this to be over glaciers. - - ! Soil should be saturated in LakeHydrology - satw = 1._r8 - ! ZMS: Note the following needs to be updated for the corrections to be merged into SoilTemperature. - ! They are especially important here because of no supercooled water. - fl = h2osoi_liq(c,j)/(h2osoi_ice(c,j)+h2osoi_liq(c,j)) - if (t_soisno(c,j) >= tfrz) then ! Unfrozen soil - dke = max(0._r8, log10(satw) + 1.0_r8) - dksat = tksatu(c,j) - else ! Frozen soil - dke = satw - dksat = tkmg(c,j)*0.249_r8**(fl*watsat(c,j))*2.29_r8**watsat(c,j) - endif - thk(c,j) = dke*dksat + (1._r8-dke)*tkdry(c,j) - satw = (h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice)/(dz(c,j)*watsat(c,j)) - ! Hydrology routine won't let the excess be liquid. - if (satw > 1._r8) then - xicevol = (satw-1._r8)*watsat(c,j) - thk(c,j) = (thk(c,j) + xicevol*tkice)/(1._r8 + xicevol)/(1._r8 + xicevol) - ! Use simple mean because excess ice is likely to be in chunks, thus conductivities add - ! rather than the usual addition of resistances. - ! Conductivity is reduced by the extra virtual volume fraction, as dz is not changing. - end if - ! See discussion in LakeHydrology. This is the simplest way to treat thermal cycling near - ! freezing even if not modeling excess ice, to assume up to 10% excess ice over watsat after refreezing. - ! Assume some ground heaving rather than drainage of the water while it's freezing. - ! This allows for energy conservation and for the final allowed ice volume to be independent - ! of the timestep or precise freezing trajectory. - ! Does real sediment under lakes heave or drain? Could revisit later. - elseif (j > nlevsoi) then - thk(c,j) = thk_bedrock - endif - - ! Thermal conductivity of snow, which from Jordan (1991) pp. 18 - ! Only examine levels from snl(c)+1 -> 0 where snl(c) < 1 - if (snl(c)+1 < 1 .AND. (j >= snl(c)+1) .AND. (j <= 0)) then - bw = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/dz(c,j) - thk(c,j) = tkair + (7.75e-5_r8 *bw + 1.105e-6_r8*bw*bw)*(tkice-tkair) - end if - - end do - end do - - ! Thermal conductivity at the layer interface - - ! Have to correct for the fact that bottom snow layer and top soil layer border lake. - ! For the first case, the snow layer conductivity for the middle of the layer will be returned. - ! Because the interfaces are below the soil layers, the conductivity for the top soil layer - ! will have to be returned separately. - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - if (j >= snl(c)+1 .AND. j <= nlevgrnd-1 .AND. j /= 0) then - tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & - /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) - else if (j == 0 .and. j >= snl(c)+1) then - tk(c,j) = thk(c,j) - else if (j == nlevgrnd) then - tk(c,j) = 0._r8 - end if - ! For top soil layer. - if (j == 1) tktopsoillay(c) = thk(c,j) - end do - end do - - ! Soil heat capacity, from de Vires (1963) - - do j = 1, nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - cv(c,j) = csol(c,j)*(1-watsat(c,j))*dz(c,j) + & - (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - ! if (j == 1) then - ! if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8) then - ! cv(c,j) = cv(c,j) + cpice*h2osno(c) - ! end if - ! end if - ! Won't worry about heat capacity for thin snow on lake with no snow layers. - ! Its temperature will be assigned based on air temperature anyway if a new node is formed. - if (j > nlevsoi) then - cv(c,j) = csol_bedrock*dz(c,j) - endif - enddo - end do - - ! Snow heat capacity - - do j = -nlevsno+1,0 - do fc = 1,num_lakec - c = filter_lakec(fc) - if (snl(c)+1 < 1 .and. j >= snl(c)+1) then - cv(c,j) = cpliq*h2osoi_liq(c,j) + cpice*h2osoi_ice(c,j) - end if - end do - end do - - end associate - - end subroutine SoilThermProp_Lake - - !----------------------------------------------------------------------- - subroutine PhaseChange_Lake (bounds, num_lakec, filter_lakec, cv, cv_lake, lhabs, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst, lakestate_inst) - ! - ! !DESCRIPTION: - ! Calculation of the phase change within snow, soil, & lake layers: - ! (1) Check the conditions for which the phase change may take place, - ! i.e., the layer temperature is great than the freezing point - ! and the ice mass is not equal to zero (i.e. melting), - ! or the layer temperature is less than the freezing point - ! and the liquid water mass is greater than zero (i.e. melting). No supercooling. - ! (2) Assess the amount of phase change from the energy excess (or deficit) - ! after setting the layer temperature to freezing point, depending on - ! how much water or ice is available. - ! (3) Re-adjust the ice and liquid mass, and the layer temperature: either to - ! the freezing point if enough water or ice is available to fully compensate, - ! or to a remaining temperature. - ! The specific heats are adjusted during phase change for precise energy conservation. - ! Errors will be trapped at the end of LakeTemperature. - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varcon , only : tfrz, hfus, denh2o, denice, cpliq, cpice - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of lake columns - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - real(r8) , intent(inout) :: cv( bounds%begc: , -nlevsno+1: ) ! heat capacity [J/(m2 K)] [col, lev] - real(r8) , intent(inout) :: cv_lake( bounds%begc: , 1: ) ! heat capacity [J/(m2 K)] [col, levlak] - real(r8) , intent(out) :: lhabs( bounds%begc: ) ! total per-column latent heat abs. (J/m^2) [col] - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(lakestate_type) , intent(inout) :: lakestate_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,g ! do loop index - integer :: fc ! lake filtered column indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: heatavail ! available energy for melting or freezing (J/m^2) - real(r8) :: heatrem ! energy residual or loss after melting or freezing - real(r8) :: melt ! actual melting (+) or freezing (-) [kg/m2] - !real(r8), parameter :: smallnumber = 1.e-7_r8 ! to prevent tiny residuals from rounding error - real(r8), parameter :: smallnumber = 1.e-12_r8 ! The above actually was enough to cause a 0.1 W/m^2 energy imbalance - ! when the bottom lake layer started freezing in a 50m Arctic lake - logical :: dophasechangeflag - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv_lake) == (/bounds%endc, nlevlak/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lhabs) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - dz_lake => col%dz_lake , & ! Input: [real(r8) (:,:) ] lake layer thickness (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - snow_depth => waterstate_inst%snow_depth_col , & ! Output: [real(r8) (:) ] snow height (m) - h2osno => waterstate_inst%h2osno_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - - lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Input: [real(r8) (:,:) ] mass fraction of lake layer that is frozen - - qflx_snofrz_lyr => waterflux_inst%qflx_snofrz_lyr_col , & ! Output: [real(r8) (:,:) ] snow freezing rate (positive definite) (col,lyr) [kg m-2 s-1] - qflx_snomelt_lyr => waterflux_inst%qflx_snomelt_lyr_col, & ! Output: [real(r8) (:) ] snow melt in each layer (mm H2O /s) - qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Output: [real(r8) (:) ] drainage from snow column - qflx_snomelt => waterflux_inst%qflx_snomelt_col , & ! Output: [real(r8) (:) ] snow melt (mm H2O /s) - qflx_snofrz => waterflux_inst%qflx_snofrz_col , & ! Output: [real(r8) (:) ] column-integrated snow freezing rate (kg m-2 s-1) [+] - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - t_lake => temperature_inst%t_lake_col , & ! Input: [real(r8) (:,:) ] lake temperature (Kelvin) - imelt => temperature_inst%imelt_col , & ! Output: [integer (:,:) ] flag for melting (=1), freezing (=2), Not=0 (new) - - eflx_snomelt => energyflux_inst%eflx_snomelt_col & ! Output: [real(r8) (:) ] snow melt heat flux (W/m**2) - ) - - ! Get step size - - dtime = get_step_size() - - ! Initialization - - do fc = 1,num_lakec - c = filter_lakec(fc) - - qflx_snomelt(c) = 0._r8 - qflx_snofrz(c) = 0._r8 - eflx_snomelt(c) = 0._r8 - lhabs(c) = 0._r8 - qflx_snow_drain(c) = 0._r8 - end do - - do j = -nlevsno+1,0 - do fc = 1,num_lakec - c = filter_lakec(fc) - - ! Do for all possible snow layers in case snl changes over timestep. - qflx_snomelt_lyr(c,j) = 0._r8 - qflx_snofrz_lyr(c,j) = 0._r8 - imelt(c,j) = 0 - end do - end do - - ! Check for case of snow without snow layers and top lake layer temp above freezing. - - do fc = 1,num_lakec - c = filter_lakec(fc) - - if (snl(c) == 0 .and. h2osno(c) > 0._r8 .and. t_lake(c,1) > tfrz) then - heatavail = (t_lake(c,1) - tfrz) * cv_lake(c,1) - melt = min(h2osno(c), heatavail/hfus) - heatrem = max(heatavail - melt*hfus, 0._r8) - !catch small negative value to keep t at tfrz - t_lake(c,1) = tfrz + heatrem/(cv_lake(c,1)) - snow_depth(c) = snow_depth(c)*(1._r8 - melt/h2osno(c)) - h2osno(c) = h2osno(c) - melt - lhabs(c) = lhabs(c) + melt*hfus - qflx_snomelt(c) = qflx_snomelt(c) + melt/dtime - ! no snow layers, so qflx_snomelt_lyr is not set - qflx_snow_drain(c) = qflx_snow_drain(c) + melt/dtime - ! Prevent tiny residuals - if (h2osno(c) < smallnumber) h2osno(c) = 0._r8 - if (snow_depth(c) < smallnumber) snow_depth(c) = 0._r8 - end if - end do - - ! Lake phase change - - do j = 1,nlevlak - do fc = 1,num_lakec - c = filter_lakec(fc) - - dophasechangeflag = .false. - if (t_lake(c,j) > tfrz .and. lake_icefrac(c,j) > 0._r8) then ! melting - dophasechangeflag = .true. - heatavail = (t_lake(c,j) - tfrz) * cv_lake(c,j) - melt = min(lake_icefrac(c,j)*denh2o*dz_lake(c,j), heatavail/hfus) - !denh2o is used because layer thickness is not adjusted for freezing - heatrem = max(heatavail - melt*hfus, 0._r8) - !catch small negative value to keep t at tfrz - else if (t_lake(c,j) < tfrz .and. lake_icefrac(c,j) < 1._r8) then !freezing - dophasechangeflag = .true. - heatavail = (t_lake(c,j) - tfrz) * cv_lake(c,j) - melt = max(-(1._r8-lake_icefrac(c,j))*denh2o*dz_lake(c,j), heatavail/hfus) - !denh2o is used because layer thickness is not adjusted for freezing - heatrem = min(heatavail - melt*hfus, 0._r8) - !catch small positive value to keep t at tfrz - end if - ! Update temperature and ice fraction. - if (dophasechangeflag) then - lake_icefrac(c,j) = lake_icefrac(c,j) - melt/(denh2o*dz_lake(c,j)) - lhabs(c) = lhabs(c) + melt*hfus - ! Update heat capacity - cv_lake(c,j) = cv_lake(c,j) + melt*(cpliq-cpice) - t_lake(c,j) = tfrz + heatrem/cv_lake(c,j) - ! Prevent tiny residuals - if (lake_icefrac(c,j) > 1._r8 - smallnumber) lake_icefrac(c,j) = 1._r8 - if (lake_icefrac(c,j) < smallnumber) lake_icefrac(c,j) = 0._r8 - end if - end do - end do - - ! Snow & soil phase change - ! Currently, does not do freezing point depression. - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_lakec - c = filter_lakec(fc) - dophasechangeflag = .false. - - if (j >= snl(c) + 1) then - - if (t_soisno(c,j) > tfrz .and. h2osoi_ice(c,j) > 0._r8) then ! melting - dophasechangeflag = .true. - heatavail = (t_soisno(c,j) - tfrz) * cv(c,j) - melt = min(h2osoi_ice(c,j), heatavail/hfus) - heatrem = max(heatavail - melt*hfus, 0._r8) - !catch small negative value to keep t at tfrz - if (j <= 0) then !snow - imelt(c,j) = 1 - qflx_snomelt_lyr(c,j) = melt/dtime - qflx_snomelt(c) = qflx_snomelt(c) + qflx_snomelt_lyr(c,j) - end if - else if (t_soisno(c,j) < tfrz .and. h2osoi_liq(c,j) > 0._r8) then !freezing - dophasechangeflag = .true. - heatavail = (t_soisno(c,j) - tfrz) * cv(c,j) - melt = max(-h2osoi_liq(c,j), heatavail/hfus) - heatrem = min(heatavail - melt*hfus, 0._r8) - !catch small positive value to keep t at tfrz - if (j <= 0) then !snow - imelt(c,j) = 2 - ! layer freezing mass flux (positive): - qflx_snofrz_lyr(c,j) = -melt/dtime - qflx_snofrz(c) = qflx_snofrz(c) + qflx_snofrz_lyr(c,j) - end if - end if - - ! Update temperature and soil components. - if (dophasechangeflag) then - h2osoi_ice(c,j) = h2osoi_ice(c,j) - melt - h2osoi_liq(c,j) = h2osoi_liq(c,j) + melt - lhabs(c) = lhabs(c) + melt*hfus - ! Update heat capacity - cv(c,j) = cv(c,j) + melt*(cpliq-cpice) - t_soisno(c,j) = tfrz + heatrem/cv(c,j) - ! Prevent tiny residuals - if (h2osoi_ice(c,j) < smallnumber) h2osoi_ice(c,j) = 0._r8 - if (h2osoi_liq(c,j) < smallnumber) h2osoi_liq(c,j) = 0._r8 - end if - - end if - end do - end do - - ! Update eflx_snomelt(c) - do fc = 1,num_lakec - c = filter_lakec(fc) - eflx_snomelt(c) = qflx_snomelt(c)*hfus - end do - - end associate - - end subroutine PhaseChange_Lake - - end module LakeTemperatureMod - diff --git a/src/biogeophys/LunaMod.F90 b/src/biogeophys/LunaMod.F90 deleted file mode 100644 index 66b608022e..0000000000 --- a/src/biogeophys/LunaMod.F90 +++ /dev/null @@ -1,1358 +0,0 @@ -module LunaMod - -#include "shr_assert.h" - - !********************************************************************************************************************************************************************** - ! !DESCRIPTION: - ! Calculates the photosynthetic capacities based on a prescribed leaf nitrogen content, using the LUNA model, developed by Chonggang Xu, Ashehad Ali and Rosie Fisher - ! Currently only works for C3 plants. See Xu et al 2012; Ali et al 2015a. Ecological Applications. http://dx.doi.org/10.1890/14-2111.1. and Ali et al 2015b.In Review. - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : rgas, tfrz,spval - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : namep - use clm_varpar , only : nlevcan - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use FrictionvelocityMod , only : frictionvel_type - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use PhotosynthesisMod , only : photosyns_type - use TemperatureType , only : temperature_type - use PatchType , only : patch - use GridcellType , only : grc - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use WaterstateType , only : waterstate_type - !use EDPhotosynthesisMod , only : vcmaxc, jmaxc - - - implicit none - save - - !------------------------------------------------------------------------------ - ! PRIVATE MEMBER FUNCTIONS: - public :: LunaReadNML !subroutine to read in the Luna namelist - public :: Update_Photosynthesis_Capacity !subroutine to update the canopy nitrogen profile - public :: NitrogenAllocation !subroutine to update the Vcmax25 and Jmax25 at the leaf level - public :: Acc24_Climate_LUNA !subroutine to accumulate 24 hr climates - public :: Acc240_Climate_LUNA !subroutine to accumulate 10 day climates - public :: Clear24_Climate_LUNA !subroutine to clear 24 hr climates - private :: NUEref !Calculate the Nitrogen use effieciency based on reference CO2 and leaf temperature - private :: NUE !Calculate the Nitrogen use effieciency based on current CO2 and leaf temperature - private :: JmxTLeuning !Calculate the temperature response for Jmax, based on Leunning 2002 Plant, Cell & Environment - private :: JmxTKattge !Calculate the temperature response for Jmax, based on Kattge and Knorr 2007 - private :: VcmxTLeuning !Calculate the temperature response for Vcmax, based on Leunning 2002 Plant, Cell & Environment - private :: VcmxTKattge !Calculate the temperature response for Vcmax, based on Kattge and Knorr 2007 - private :: RespTBernacchi !Calculate the temperature response for respiration, following Bernacchi PCE 2001 - private :: Photosynthesis_luna !calculate the photosynthetic rate for nitrogen allocation - private :: Quadratic !Calculate the soultion using the quadratic formula - - !------------------------------------------------------------------------------ - !Constants - real(r8), parameter :: Cv = 1.2e-5_r8 * 3600.0 ! conversion factor from umol CO2 to g carbon - real(r8), parameter :: Kc25 = 40.49_r8 ! Mechanis constant of CO2 for rubisco(Pa), Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - real(r8), parameter :: Ko25 = 27840_r8 ! Mechanis constant of O2 for rubisco(Pa), Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - real(r8), parameter :: Cp25 = 4.275_r8 ! CO2 compensation point at 25C (Pa), Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - real(r8), parameter :: Fc25 = 294.2_r8 ! Fc25 = 6.22*47.3 #see Rogers (2014) Photosynthesis Research - real(r8), parameter :: Fj25 = 1257.0_r8 ! Fj25 = 8.06*156 # #see COSTE 2005 and Xu et al 2012 - real(r8), parameter :: NUEr25 = 33.69_r8 ! nitrogen use efficiency for respiration, see Xu et al 2012 - real(r8), parameter :: Cb = 1.78_r8 ! nitrogen use effiency for choloraphyll for light capture, see Evans 1989 - real(r8), parameter :: O2ref = 209460.0_r8 ! ppm of O2 in the air - real(r8), parameter :: CO2ref = 380.0_r8 ! reference CO2 concentration for calculation of reference NUE. - real(r8), parameter :: forc_pbot_ref = 101325.0_r8 ! reference air pressure for calculation of reference NUE - real(r8), parameter :: Q10Enz = 2.0_r8 ! Q10 value for enzyme decay rate - real(r8), parameter :: Jmaxb0 = 0.0311_r8 ! the baseline proportion of nitrogen allocated for electron transport (J) - real(r8) :: Jmaxb1 = 0.1_r8 ! the baseline proportion of nitrogen allocated for electron transport (J) - real(r8), parameter :: Wc2Wjb0 = 0.8054_r8 ! the baseline ratio of rubisco limited rate vs light limited photosynthetic rate (Wc:Wj) - real(r8), parameter :: relhExp = 6.0999_r8 ! electron transport parameters related to relative humidity - real(r8), parameter :: Enzyme_turnover_daily = 0.1_r8 ! the daily turnover rate for photosynthetic enzyme at 25oC in view of ~7 days of half-life time for Rubisco (Suzuki et al. 2001) - real(r8), parameter :: NMCp25 = 0.715_r8 ! estimated by assuming 80% maintenance respiration is used for photosynthesis enzyme maintenance - real(r8), parameter :: Trange1 = 5.0_r8 ! lower temperature limit (oC) for nitrogen optimization - real(r8), parameter :: Trange2 = 42.0_r8 ! upper temperature limit (oC) for nitrogen optimization - real(r8), parameter :: SNC = 0.004_r8 ! structural nitrogen concentration (g N g-1 dry mass carbon) - real(r8), parameter :: mp = 9.0_r8 ! slope of stomatal conductance; this is used to estimate model parameter, but may need to be updated from the physiology file, - real(r8), parameter :: PARLowLim = 200.0_r8 ! minimum photosynthetically active radiation for nitrogen optimization - real(r8), parameter :: minrelh = 0.25_r8 ! minimum relative humdity for nitrogen optimization - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------------ - - contains - - !********************************************************************************************************************************************************************** - ! Read in LUNA namelist - subroutine LunaReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for LUNA - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'lunaReadNML' - character(len=*), parameter :: nmlname = 'luna' - !----------------------------------------------------------------------- - namelist /luna/ Jmaxb1 - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=luna, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (Jmaxb1, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=luna) - write(iulog,*) ' ' - end if - - end subroutine lunaReadNML - - !********************************************************************************************************************************************************************** - ! this subroutine updates the photosynthetic capacity as determined by Vcmax25 and Jmax25 - subroutine Update_Photosynthesis_Capacity(bounds, fn, filterp, & - dayl_factor, atm2lnd_inst, temperature_inst, canopystate_inst, photosyns_inst, & - surfalb_inst, solarabs_inst, waterstate_inst, frictionvel_inst) - ! - ! !DESCRIPTION: - ! Calculates Nitrogen fractionation within the leaf, based on optimum calculated fractions in rubisco, cholorophyll, - ! Respiration and Storage. Based on Xu et al. 2012 and Ali et al 2015.In Review - - ! - ! !REVISION HISTORY: - ! version 1.0, by Chonggang Xu, Ashehad Ali and Rosie Fisher. July 14 2015. - ! version 0.1, by Chonggang Xu, Ashehad Ali and Rosie Fisher. October 30 2014. - - ! CALLED FROM: - ! subroutine CanopyFluxes - - ! !USES: - use clm_time_manager , only : get_step_size, is_end_curr_day - use clm_varpar , only : nlevsoi, mxpft - use perf_mod , only : t_startf, t_stopf - use clm_varctl , only : use_cn - use quadraticMod , only : quadratic - use CNSharedParamsMod , only : CNParamsShareInst - use shr_infnan_mod, only : isnan => shr_infnan_isnan - - implicit none - - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - real(r8) , intent(in) :: dayl_factor( bounds%begp: ) ! scalar (0-1) for daylength - - - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - - ! !LOCAL VARIABLES: - ! - ! local pointers to implicit in variables - - integer :: c,CL,f,g,iv,j,p,ps ! indices - integer :: NCL_p ! number of canopy layers in patch - integer :: ft ! plant functional type - integer :: z ! the index across leaf layers - real (r8) :: PNstoreopt,PNlcopt,PNetopt,PNrespopt,PNcbopt ! the optimal nitrogen allocations - real (r8) :: PNstoreold,PNlcold,PNetold,PNrespold,PNcbold ! the previous time step nitrogen allocations - real (r8) :: delta_fn ! daily change in nitrogen investiment - real (r8) :: relCLNCa ! the relative factor for LNCa due to canopy location and seasonal growth - real (r8) :: relSLNCa ! the relative factor for LNCa due to seasonal growth - real (r8) :: relRad ! the realtive radiation to the top of the canopy - real (r8) :: FNCmtar ! target functional nitrogen content (g N/g leaf c) - real (r8) :: LMA ! leaf mass per unit area (g leaf c/m2 leaf) - real (r8) :: PARTop ! photosynthetic active radiation on the top of canopy (umol/m2/s) - real (r8) :: RadTop ! short-wave radiation on the top of canopy (w/m2) - real (r8) :: TRad ! total short-wave radiation on the top of canopy (w/m2) - real (r8) :: PARi10 ! 10-day mean photosynthetic active radiation on in the canopy (umol/m2/s) - real (r8) :: PARimx10 ! 10-day mean maximum photosynthetic active radiation on in the canopy (umol/m2/s) - real (r8) :: tleaf10 ! 10-day mean leaf temperature (oC) - real (r8) :: tleafd10 ! 10-day mean daytime leaf temperature (oC) - real (r8) :: tleafn10 ! 10-day mean nighttime leaf temperature (oC) - real (r8) :: hourpd ! hours per day (hours) - real (r8) :: CO2a10 ! 10-day mean air co2 concentration (pa) - real (r8) :: O2a10 ! 10-day mean air o2 concentration (pa) - real (r8) :: max_daily_pchg ! maximum daily percentrage change for nitrogen allocation - real (r8) :: max_daily_decay ! maximum daily decay for nitrogen allocation - real (r8) :: radk ! light extintion factor - real (r8) :: FNCa ! leaf functional nitrogen content (g/m2) - real (r8) :: FNCa_z(1:nlevcan) ! profile of leaf functional nitrogen content (g/m2) - real (r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real (r8) :: radmax2mean ! ratio of max radiation to mean - real (r8) :: qabs ! PAR absorbed by PS II (umol photons/m**2/s) - real (r8) :: EnzTurnoverTFactor ! temperature adjust factor for enzyme decay - real (r8) :: vcmax25 ! Predicted vcmax25 from EDN model umol CO2/m**2/s - real (r8) :: jmax25 ! Predicted jmax25 from EDN model umol electrons/m**2/s - real (r8) :: dtime ! stepsize in seconds - real (r8) :: rb10v ! 10-day mean boundary layer resistance - real (r8) :: relh10 ! 10-day mean relative humidity (unitless) - real (r8) :: tair10 ! 10-day running mean of the 2m temperature (oC) - real (r8) :: rabsorb ! ratio of absorbed raditation to the total incident radiation - real (r8) :: tlaii ! total leaf area index for a certain canopy layer - real (r8) :: SNCa ! structural leaf nitrogen content (g N/m2 leaf) - real (r8) :: vcmx25_opt ! optimal Vc,max25 (umol CO2/m**2/s) - real (r8) :: jmx25_opt ! optimal Jmax25 (umol electron/m**2/s) - real (r8) :: chg ! change in Vcmax25 or Jmax25 - real (r8) :: chg_constrn ! constrained change in Vcmax25 or Jmax25 - logical :: is_end_day ! is end of current day - !------------------------------------------------------------------------------------------------------------------------------------------------- - associate( & - c3psn => pftcon%c3psn , & ! photosynthetic pathway: 0. = c4, 1. = c3 - slatop => pftcon%slatop , & ! specific leaf area at top of canopy, projected area basis [m^2/gC] - leafcn => pftcon%leafcn , & ! leaf C:N (gC/gN) - forc_pbot10 => atm2lnd_inst%forc_pbot240_downscaled_patch , & ! Input: [real(r8) (:) ] 10 day mean atmospheric pressure(Pa) - CO2_p240 => atm2lnd_inst%forc_pco2_240_patch , & ! Input: [real(r8) (:) ] 10-day mean CO2 partial pressure (Pa) - O2_p240 => atm2lnd_inst%forc_po2_240_patch , & ! Input: [real(r8) (:) ] 10-day mean O2 partial pressure (Pa) - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index - tlai_z => surfalb_inst%tlai_z_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index - dayl => grc%dayl , & ! Input: [real(r8) (:) ] daylength (s) - sabv => solarabs_inst%sabv_patch , & ! Input: [real(r8) (:) ] patch solar radiation absorbed by vegetation (W/m**2) - t_veg => temperature_inst%t_veg_patch , & ! Input: [real(r8) (:) ] vegetation temperature (Kelvin) - rhol => pftcon%rhol , & ! Input: [real(r8) (:) ] leaf reflectance: 1=vis, 2=nir - taul => pftcon%taul , & ! Input: [real(r8) (:) ] leaf transmittance: 1=vis, 2=nir - par240d_z => solarabs_inst%par240d_z_patch , & ! Input: [real(r8) (:,:) ] 10-day running mean of daytime patch absorbed PAR for leaves in canopy layer (W/m**2) - par24d_z => solarabs_inst%par24d_z_patch , & ! Input: [real(r8) (:,:) ] daily accumulated absorbed PAR for leaves in canopy layer (W/m**2) - par240x_z => solarabs_inst%par240x_z_patch , & ! Input: [real(r8) (:,:) ] 10-day running mean of maximum patch absorbed PAR for leaves in canopy layer (W/m**2) - par24x_z => solarabs_inst%par24x_z_patch , & ! Input: [real(r8) (:,:) ] daily maximum of patch absorbed PAR for leaves in canopy layer (W/m**2) - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer - lnc => photosyns_inst%lnca_patch , & ! Input: [real(r8) (:) ] top leaf layer leaf N concentration (gN leaf/m^2) - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - t_veg_day => temperature_inst%t_veg_day_patch , & ! Input: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin) - t_veg_night => temperature_inst%t_veg_night_patch , & ! Input: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin) - t_veg10_day => temperature_inst%t_veg10_day_patch , & ! Input: [real(r8) (:) ] 10-day mean daytime vegetation temperature (Kelvin) - t_veg10_night => temperature_inst%t_veg10_night_patch , & ! Input: [real(r8) (:) ] 10-day mean nighttime vegetation temperature (Kelvin) - rh10_p => waterstate_inst%rh10_af_patch , & ! Input: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (unitless) - rb10_p => frictionvel_inst%rb10_patch , & ! Input: [real(r8) (:) ] 10-day mean boundary layer resistance at the pacth (s/m) - gpp_day => photosyns_inst%fpsn24_patch , & ! Input: [real(r8) (:) ] patch 24 hours mean gpp(umol CO2/m**2 ground/day) for canopy layer - vcmx25_z => photosyns_inst%vcmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Vc,max25 (umol/m2 leaf/s) for canopy layer - jmx25_z => photosyns_inst%jmx25_z_patch , & ! Output: [real(r8) (:,:) ] patch leaf Jmax25 (umol electron/m**2/s) for canopy layer - pnlc_z => photosyns_inst%pnlc_z_patch , & ! Output: [real(r8) (:,:) ] patch proportion of leaf nitrogen allocated for light capture for canopy layer - enzs_z => photosyns_inst%enzs_z_patch & ! Output: [real(r8) (:,:) ] enzyme decay status 1.0-fully active; 0-all decayed during stress - ) - !---------------------------------------------------------------------------------------------------------------------------------------------------------- - !set timestep - - !Initialize enzyme decay Q10 - dtime = get_step_size() - - is_end_day = is_end_curr_day() - fnps = 0.15_r8 - call t_startf('LUNA') - do f = 1,fn - p = filterp(f) - ft = patch%itype(p) - g = patch%gridcell(p) - c = patch%column(p) - !---------------------------------------------------- - !store the daily mean climate conditions - if(t_veg_day(p).ne.spval) then !check whether it is the first day - !------------------------------------------ - !get the climate driver - CO2a10 = CO2_p240(p) - O2a10 = O2_p240(p) - hourpd = dayl(g) / 3600._r8 - tleafd10 = t_veg10_day(p) - tfrz - tleafn10 = t_veg10_night(p) - tfrz - tleaf10 = (dayl(g)*tleafd10 +(86400._r8-dayl(g)) * tleafd10)/86400._r8 - tair10 = t10(p)- tfrz - relh10 = min(1.0_r8, rh10_p(p)) - rb10v = rb10_p(p) - !-------------------------------------------------------------------- - !calculate the enzyme ternover rate - EnzTurnoverTFactor = Q10Enz**(0.1_r8*(min(40.0_r8, tleaf10) - 25.0_r8)) - max_daily_pchg = EnzTurnoverTFactor * Enzyme_turnover_daily - !----------------------------------------------------------------- - rabsorb = 1.0_r8-rhol(ft,1)-taul(ft,1) - !Implemented the nitrogen allocation model - if(tlai(p) > 0.0_r8 .and. lnc(p) > 0._r8)then - RadTop = par240d_z(p,1)/rabsorb - PARTop = RadTop*4.6 !conversion from w/m2 to umol/m2/s. PAR is still in umol photons, not electrons. Also the par240d_z is only for radiation at visible range. Hence 4.6 not 2.3 multiplier. - !------------------------------------------------------------- - !the nitrogen allocation model, may need to be feed from the parameter file in CLM - if (nint(c3psn(ft)) == 1)then - if(gpp_day(p)>0.0 )then !only optimize if there is growth and it is C3 plants - !------------------------------------------------------------- - do z = 1, nrad(p) - if(tlai_z(p,z)>0.0_r8)then - qabs = par240d_z(p,z)/rabsorb - PARi10 = qabs * 4.6_r8 - else - PARi10 = 0.01_r8 - endif - !----------------------------------------------------------------------- - relRad = PARi10/PARTop - relCLNCa = 0.1802_r8*log(relRad)+1.0_r8 !see Ali et al 2015. - relCLNCa = max(0.2_r8,relCLNCa) - relCLNCa = min(1.0_r8,relCLNCa) - relSLNCa = 1.0_r8 - !------------------------------------------------------------------ - SNCa = 1.0_r8/slatop(ft) * SNC - if(0.9_r8 * lnc(p)> SNCa)then - FNCa_z(z)= relCLNCa*(lnc(p)-SNCa) - else - FNCa_z(z)= relCLNCa*0.1_r8*lnc(p) - endif - enddo - - !---------------------------------------------------------------------- - !nitrogen allocation model - do z = 1 , nrad(p) - - !------------------------------------------------------------------------------------------- - !for different layers of leaves - FNCa = FNCa_z(z) - if(FNCa>15.0_r8) then !boundary condition check for unrealistically high leaf nitrogen content - FNCa = 15.0_r8 - write(iulog, *) 'Warning: leaf nitrogen content become unrealistically high (>15.0 g N/m2 leaf) ', & - 'for patch=', p, 'z=', z, "pft=", ft - endif - radmax2mean = par240x_z(p,z) / par240d_z(p,z) - if(tlai_z(p,z)>0.0_r8)then - qabs = par240d_z(p,z)/rabsorb - PARi10 = qabs * 4.6_r8 - else - PARi10 = 0.01_r8 - endif - PARimx10 = PARi10*radmax2mean - !----------------------------------------------------------------------------------------------------- - - !nitrogen allocastion model-start - PNlcold = PNlc_z(p,z) - PNetold = 0.0_r8 - PNrespold = 0.0_r8 - PNcbold = 0.0_r8 - call NitrogenAllocation(FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, hourpd, & - tair10, tleafd10, tleafn10, & - Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp, PNstoreold, PNlcold, PNetold, PNrespold, & - PNcbold, PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) - vcmx25_opt= PNcbopt * FNCa * Fc25 - jmx25_opt= PNetopt * FNCa * Fj25 - - chg = vcmx25_opt-vcmx25_z(p, z) - chg_constrn = min(abs(chg),vcmx25_z(p, z)*max_daily_pchg) - vcmx25_z(p, z) = vcmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - - chg = jmx25_opt-jmx25_z(p, z) - chg_constrn = min(abs(chg),jmx25_z(p, z)*max_daily_pchg) - jmx25_z(p, z) = jmx25_z(p, z)+sign(1.0_r8,chg)*chg_constrn - - PNlc_z(p, z)= PNlcopt - - if(enzs_z(p,z)<1.0) then - enzs_z(p,z) = enzs_z(p,z)* (1.0_r8 + max_daily_pchg) - endif - !nitrogen allocastion model-end - -!DML turn off endrun and instead modify vcmx25_z(p,z) and jmx25_z(p,z) to a reasonable value - !----------------------------------------------------------------------------------------------------- - if(isnan(vcmx25_z(p, z)))then - write(iulog, *) 'Error: Vc,mx25 is NaN for patch=', & - p, 'z=', z, "pft=", ft - write(iulog, *) 'LUNA env:',FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, & - hourpd, tair10, tleafd10, tleafn10 - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - if(vcmx25_z(p, z)>1000._r8 .or. vcmx25_z(p, z)<0._r8)then - write(iulog, *) 'Warning: Vc,mx25 become unrealistic (>1000 or negative) for patch=', & - p, 'z=', z, "pft=", ft - write(iulog, *) 'LUNA env:',vcmx25_z(p,z),FNCa,forc_pbot10(p), relh10, CO2a10, & - O2a10, PARi10, PARimx10, rb10v, hourpd, tair10, tleafd10, tleafn10 - vcmx25_z(p,z) = 50._r8 - endif - if(isnan(jmx25_z(p, z)))then - write(iulog, *) 'Error: Jmx25 is NaN for patch=', & - p, 'z=', z, "pft=", ft - write(iulog, *) 'LUNA env:', FNCa,forc_pbot10(p), relh10, CO2a10, O2a10, PARi10, PARimx10, rb10v, & - hourpd, tair10, tleafd10, tleafn10 - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - if(jmx25_z(p, z)>2000._r8 .or. jmx25_z(p, z)<0._r8)then - write(iulog, *) 'Warning: Jmx25 become unrealistic (>2000, or negative) for patch=', & - p, 'z=', z, "pft=", ft - write(iulog, *) 'LUNA env:', jmx25_z(p,z),FNCa,forc_pbot10(p), relh10, CO2a10, & - O2a10, PARi10, PARimx10, rb10v, hourpd, tair10, tleafd10, tleafn10 - jmx25_z(p,z) = 85._r8 - endif - - enddo ! finished loop of leaf layers - else !decay during drought or winter - max_daily_decay = min(0.5_r8, 0.1_r8 * max_daily_pchg) - !assume enzyme turnover under maintenance is 10 - !times lower than enzyme change under growth - do z = 1 , nrad(p) - if(enzs_z(p,z)>0.5_r8) then - !decay is set at only 50% of original - !enzyme in view that plant will need to - !maintain their basic functionality - enzs_z(p,z) = enzs_z(p,z)* (1.0_r8 - max_daily_decay) - jmx25_z(p, z) = jmx25_z(p, z)* (1.0_r8 - max_daily_decay) - vcmx25_z(p, z) = vcmx25_z(p, z)* (1.0_r8 - max_daily_decay) - endif - end do - endif !checking for growth - endif !if not C3 plants - else - do z = 1 , nrad(p) - jmx25_z(p, z) = 85._r8 - vcmx25_z(p, z) = 50._r8 - end do - endif !checking for LAI and LNC - endif !the first daycheck - end do !fn loop - call t_stopf('LUNA') - end associate - -end subroutine Update_Photosynthesis_Capacity - - - -subroutine Acc240_Climate_LUNA(bounds, fn, filterp, oair, cair, & - rb,rh, temperature_inst, photosyns_inst, & - surfalb_inst, solarabs_inst, waterstate_inst, frictionvel_inst) - ! - ! !DESCRIPTION: - ! Accumulate the 10-day running mean climates for LUNA model - - ! - ! !REVISION HISTORY: - ! version 1.0, by Chonggang Xu July 14 2015. - - ! CALLED FROM: - ! subroutine CanopyFluxes - - ! !USES: - use clm_time_manager , only : get_step_size, is_end_curr_day - implicit none - - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - real(r8) , intent(in) :: oair( bounds%begp: ) ! Atmospheric O2 partial pressure (Pa) - real(r8) , intent(in) :: cair( bounds%begp: ) ! Atmospheric CO2 partial pressure (Pa) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: rh( bounds%begp: ) ! canopy air relative humidity - - type(temperature_type) , intent(inout) :: temperature_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - ! !LOCAL VARIABLES: - ! - ! local pointers to implicit in variables - - integer :: c,f,g,iv,j,p ! indices - integer :: ft ! plant functional type - integer :: z ! the index across leaf layers - real (r8) :: dtime ! stepsize in seconds - real (r8) :: TRad ! total short-wave radiation on the top of canopy (w/m2) - real (r8) :: tlaii ! total leaf area index for a certain canopy layer - real (r8) :: t_veg_dayi ! daytime mean vegetation temperature (Kelvin) - real (r8) :: t_veg_nighti ! nighttime mean vegetation temperature (Kelvin) - real (r8) :: par24d_z_i(1:nlevcan) ! daytime mean radiation (w/m**2) - logical :: is_end_day ! is end of current day - !------------------------------------------------------------------------------------------------------------------------------------------------- - associate( & - par24d_z => solarabs_inst%par24d_z_patch , & ! Input: [real(r8) (:,:) ] daily accumulated absorbed PAR for leaves in canopy layer (W/m**2) - par24x_z => solarabs_inst%par24x_z_patch , & ! Input: [real(r8) (:,:) ] daily maximum of patch absorbed PAR for leaves in canopy layer (W/m**2) - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer - t_veg_day => temperature_inst%t_veg_day_patch , & ! Input: [real(r8) (:) ] daytime accumulative vegetation temperature (Kelvin*nsteps) - t_veg_night => temperature_inst%t_veg_night_patch , & ! Input: [real(r8) (:) ] nighttime accumulative vegetation temperature (Kelvin*nsteps) - nnightsteps => temperature_inst%nnightsteps_patch , & ! Input: [integer (:) ] number of nighttime steps in 24 hours from mid-night, LUNA specific - ndaysteps => temperature_inst%ndaysteps_patch , & ! Input: [integer (:) ] number of daytime steps in 24 hours from mid-night, LUNA specific - t_veg10_day => temperature_inst%t_veg10_day_patch , & ! Output: [real(r8) (:) ] 10-day mean vegetation temperature (Kelvin) - t_veg10_night => temperature_inst%t_veg10_night_patch , & ! Output: [real(r8) (:) ] 10-day mean vegetation temperature (Kelvin) - rh10_p => waterstate_inst%rh10_af_patch , & ! Output: [real(r8) (:) ] 10-day mean canopy air relative humidity at the pacth (s/m) - rb10_p => frictionvel_inst%rb10_patch , & ! Output: [real(r8) (:) ] 10-day mean boundary layer resistance at the pacth (s/m) - par240d_z => solarabs_inst%par240d_z_patch , & ! Output: [real(r8) (:,:) ] 10-day running mean of daytime patch absorbed PAR for leaves in canopy layer (W/m**2) - par240x_z => solarabs_inst%par240x_z_patch & ! Output: [real(r8) (:,:) ] 10-day running mean of maximum patch absorbed PAR for leaves in canopy layer (W/m**2) - - ) - !---------------------------------------------------------------------------------------------------------------------------------------------------------- - !set timestep - - !Initialize enzyme decay Q10 - dtime = get_step_size() - is_end_day = is_end_curr_day() - do f = 1,fn - p = filterp(f) - ft = patch%itype(p) - g = patch%gridcell(p) - c = patch%column(p) - if(t_veg_day(p).ne.spval) then !check whether it is the first day - !--------------------------------------------------------- - !calculate the 10 day running mean radiations - if(ndaysteps(p)>0.0) then - par24d_z_i=par24d_z(p,:)/(dtime * ndaysteps(p)) - else - par24d_z_i = 0._r8 - endif - if(par240d_z(p,1).eq. spval)then !first day set as the same of first day environmental conditions - par240x_z(p,:)= par24x_z(p,:) - par240d_z(p,:)= par24d_z_i - else - par240x_z(p,:)= 0.9_r8 * par240x_z(p,:) + 0.1_r8 * par24x_z(p,:) - par240d_z(p,:)= 0.9_r8 * par240d_z(p,:) + 0.1_r8 * par24d_z_i - endif - !------------------------------------------------------- - !calculate the 10 day running mean daytime temperature - if(ndaysteps(p)>0.0)then - t_veg_dayi = t_veg_day(p) / ndaysteps(p) - else - t_veg_dayi = t_veg_night(p) / nnightsteps(p) - endif - if(t_veg10_day(p).eq. spval)then - t_veg10_day(p) = t_veg_dayi - endif - t_veg10_day(p) = 0.9_r8 * t_veg10_day(p)+ 0.1_r8 * t_veg_dayi - !------------------------------------------------------- - !calculate the 10 day running mean nighttime temperature - if(nnightsteps(p)>0)then - t_veg_nighti = t_veg_night(p) / nnightsteps(p) - else - t_veg_nighti = t_veg_day(p) / ndaysteps(p) - endif - if(t_veg10_night(p).eq. spval)then - t_veg10_night(p) = t_veg_nighti - endif - t_veg10_night(p) = 0.9_r8 * t_veg10_night(p) + 0.1_r8 * t_veg_nighti - !-------------------------------------------------------------------- - if(rh10_p(p).eq. spval)then - rh10_p(p) = rh(p) - endif - rh10_p(p) = 0.9_r8 * rh10_p(p) + 0.1_r8 * min(1.0_r8, rh(p)) - - if(rb10_p(p).eq. spval)then - rb10_p(p) = rb(p) - endif - rb10_p(p) = 0.9_r8 * rb10_p(p) + 0.1_r8 * rb(p) - endif !the first day check - end do !fn loop - end associate -end subroutine Acc240_Climate_LUNA - - -subroutine Acc24_Climate_LUNA(bounds, fn, filterp, canopystate_inst, photosyns_inst, & - surfalb_inst, solarabs_inst,temperature_inst) - ! - ! !DESCRIPTION: - ! Accumulate the 24 hr climates for LUNA model - - ! - ! !REVISION HISTORY: - ! version 1.0, by Chonggang Xu July 14 2015. - - ! CALLED FROM: - ! subroutine CanopyFluxes - - ! !USES: - use clm_time_manager , only : get_step_size - implicit none - - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - - - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(temperature_type) , intent(inout) :: temperature_inst - - ! !LOCAL VARIABLES: - ! - ! local pointers to implicit in variables - - integer :: c,f,g,iv,j,p ! indices - integer :: ft ! plant functional type - integer :: z ! the index across leaf layers - real (r8) :: dtime ! stepsize in seconds - real (r8) :: TRad ! total short-wave radiation on the top of canopy (w/m2) - real (r8) :: tlaii ! total leaf area index for a certain canopy layer - - !------------------------------------------------------------------------------------------------------------------------------------------------- - associate( & - sabv => solarabs_inst%sabv_patch , & ! Input: [real(r8) (:) ] patch solar radiation absorbed by vegetation (W/m**2) - t_veg => temperature_inst%t_veg_patch , & ! Input: [real(r8) (:) ] vegetation temperature (Kelvin) - par_sun_z => solarabs_inst%parsun_z_patch , & ! Input: [real(r8) (:,:) ] par absorbed per unit lai for sunlit canopy layer (w/m**2) - par_sha_z => solarabs_inst%parsha_z_patch , & ! Input: [real(r8) (:,:) ] par absorbed per unit lai for shaded canopy layer (w/m**2) - lai_sun_z => canopystate_inst%laisun_z_patch , & ! Input: [real(r8) (:,:) ] leaf area index for sunlit canopy layer - lai_sha_z => canopystate_inst%laisha_z_patch , & ! Input: [real(r8) (:,:) ] leaf area index for canopy shaded layer - par24d_z => solarabs_inst%par24d_z_patch , & ! Input: [real(r8) (:,:) ] daily accumulated absorbed PAR for leaves in canopy layer (W/m**2) - par24x_z => solarabs_inst%par24x_z_patch , & ! Input: [real(r8) (:,:) ] daily maximum of patch absorbed PAR for leaves in canopy layer (W/m**2) - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer - gpp => photosyns_inst%fpsn_patch , & ! Input: [real(r8) (:) ] patch instaneous gpp (umol CO2/m**2 ground/s) for canopy layer - gpp_day => photosyns_inst%fpsn24_patch , & ! Output: [real(r8) (:) ] patch 24 hours acculative gpp(umol CO2/m**2 ground/day) from mid-night - t_veg_day => temperature_inst%t_veg_day_patch , & ! Output: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin) - t_veg_night => temperature_inst%t_veg_night_patch , & ! Output: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin) - nnightsteps => temperature_inst%nnightsteps_patch , & ! Output: [integer (:) ] number of nighttime steps in 24 hours from mid-night, LUNA specific - ndaysteps => temperature_inst%ndaysteps_patch & ! Output: [integer (:) ] number of daytime steps in 24 hours from mid-night, LUNA specific - ) - !---------------------------------------------------------------------------------------------------------------------------------------------------------- - !set timestep - - !Initialize enzyme decay Q10 - dtime = get_step_size() - do f = 1,fn - p = filterp(f) - ft = patch%itype(p) - g = patch%gridcell(p) - c = patch%column(p) - !---------------------------------------------------- - !store the daily mean climate conditions - if(t_veg_day(p).ne.spval) then !check whether it is the first day - if(sabv(p)>0)then - t_veg_day(p) = t_veg_day(p) + t_veg(p) - ndaysteps(p) = ndaysteps(p) + 1 - else - t_veg_night(p) = t_veg_night(p) + t_veg(p) - nnightsteps(p) = nnightsteps(p) + 1 - endif - do z = 1, nrad(p) - !average of sunlit and shaded leaves - tlaii = lai_sun_z(p,z) + lai_sha_z(p,z) - if(tlaii > 0._r8)then - TRad = (par_sun_z(p,z)*lai_sun_z(p,z)+par_sha_z(p,z)*lai_sha_z(p,z))/tlaii - TRad = par_sun_z(p,z) !RF & GBB. Make LUNA predict sunlit fraction N fractionation, scale in PhotosynthesisMod. - par24d_z(p,z)= par24d_z(p,z)+ dtime * TRad - if(TRad > par24x_z(p,z))then - par24x_z(p,z) = TRad - endif - endif - enddo - gpp_day(p) = gpp_day(p) + dtime * gpp(p) - endif !first day check - end do !fn loop - end associate -end subroutine Acc24_Climate_LUNA - - - - -subroutine Clear24_Climate_LUNA(bounds, fn, filterp, canopystate_inst, photosyns_inst, & - surfalb_inst, solarabs_inst,temperature_inst) - ! - ! !DESCRIPTION: - ! Zero out the 24 hr climates for LUNA model - - ! - ! !REVISION HISTORY: - ! version 1.0, by Chonggang Xu July 14 2015. - - ! CALLED FROM: - ! subroutine CanopyFluxes - - ! !USES: - use clm_time_manager , only : get_step_size, is_end_curr_day - implicit none - - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - - - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(temperature_type) , intent(inout) :: temperature_inst - - ! !LOCAL VARIABLES: - ! - ! local pointers to implicit in variables - - integer :: c,f,g,iv,j,p ! indices - integer :: ft ! plant functional type - integer :: z ! the index across leaf layers - real (r8) :: dtime ! stepsize in seconds - logical :: is_end_day ! is end of current day - !------------------------------------------------------------------------------------------------------------------------------------------------- - associate( & - par24d_z => solarabs_inst%par24d_z_patch , & ! Output: [real(r8) (:,:) ] daily accumulated absorbed PAR for leaves in canopy layer (W/m**2) - par24x_z => solarabs_inst%par24x_z_patch , & ! Output: [real(r8) (:,:) ] daily maximum of patch absorbed PAR for leaves in canopy layer (W/m**2) - gpp_day => photosyns_inst%fpsn24_patch , & ! Output: [real(r8) (:) ] patch 24 hours acculative gpp(umol CO2/m**2 ground/day) from mid-night - t_veg_day => temperature_inst%t_veg_day_patch , & ! Output: [real(r8) (:) ] daytime mean vegetation temperature (Kelvin) - t_veg_night => temperature_inst%t_veg_night_patch , & ! Output: [real(r8) (:) ] nighttime mean vegetation temperature (Kelvin) - nnightsteps => temperature_inst%nnightsteps_patch , & ! Output: [integer (:) ] number of nighttime steps in 24 hours from mid-night, LUNA specific - ndaysteps => temperature_inst%ndaysteps_patch & ! Output: [integer (:) ] number of daytime steps in 24 hours from mid-night, LUNA specific - ) - !---------------------------------------------------------------------------------------------------------------------------------------------------------- - !set timestep - - !Initialize enzyme decay Q10 - dtime = get_step_size() - is_end_day = is_end_curr_day() - do f = 1,fn - p = filterp(f) - ft = patch%itype(p) - g = patch%gridcell(p) - c = patch%column(p) - !------------------------------------------------------------------------------ - !clear out the daily state variables at the begining of simulations - t_veg_day(p) = 0.0_r8 - t_veg_night(p) = 0.0_r8 - par24d_z(p,:) = 0.0_r8 - par24x_z(p,:) = 0.0_r8 - gpp_day(p) = 0.0_r8 - nnightsteps(p) = 0.0_r8 - ndaysteps(p) = 0.0_r8 - - end do !fn loop - end associate -end subroutine Clear24_Climate_LUNA - - -!************************************************************************************************************************************************ -!Use the LUNA model to calculate the Nitrogen partioning -subroutine NitrogenAllocation(FNCa,forc_pbot10, relh10, CO2a10,O2a10, PARi10,PARimx10,rb10, hourpd, tair10, tleafd10, tleafn10, & - Jmaxb0, Jmaxb1, Wc2Wjb0, relhExp,& - PNstoreold, PNlcold, PNetold, PNrespold, PNcbold, & - PNstoreopt, PNlcopt, PNetopt, PNrespopt, PNcbopt) - implicit none - real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf) - real(r8), intent (in) :: forc_pbot10 !10-day mean air pressure (Pa) - real(r8), intent (in) :: relh10 !10-day mean relative humidity (unitless) - real(r8), intent (in) :: CO2a10 !10-day meanCO2 concentration in the air (Pa) - real(r8), intent (in) :: O2a10 !10-day mean O2 concentration in the air (Pa) - real(r8), intent (in) :: PARi10 !10-day mean photosynthetic active radiation on in a canopy (umol/m2/s) - real(r8), intent (in) :: PARimx10 !10-day mean 24hr maximum photosynthetic active radiation on in a canopy (umol/m2/s) - real(r8), intent (in) :: rb10 !10-day mean boundary layer resistance - real(r8), intent (in) :: hourpd !hours of light in a the day (hrs) - real(r8), intent (in) :: tair10 !10-day running mean of the 2m temperature (oC) - real(r8), intent (in) :: tleafd10 !10-day running mean of daytime leaf temperature (oC) - real(r8), intent (in) :: tleafn10 !10-day running mean of nighttime leaf temperature (oC) - real(r8), intent (in) :: Jmaxb0 !baseline proportion of nitrogen allocated for electron transport rate (unitless) - real(r8), intent (in) :: Jmaxb1 !coefficient determining the response of electron transport rate to light availability (unitless) - real(r8), intent (in) :: Wc2Wjb0 !the baseline ratio of rubisco-limited rate vs light-limited photosynthetic rate (Wc:Wj) - real(r8), intent (in) :: relhExp !specifies the impact of relative humidity on electron transport rate (unitless) - real(r8), intent (in) :: PNstoreold !old value of the proportion of nitrogen allocated to storage (unitless) - real(r8), intent (in) :: PNlcold !old value of the proportion of nitrogen allocated to light capture (unitless) - real(r8), intent (in) :: PNetold !old value of the proportion of nitrogen allocated to electron transport (unitless) - real(r8), intent (in) :: PNrespold !old value of the proportion of nitrogen allocated to respiration (unitless) - real(r8), intent (in) :: PNcbold !old value of the proportion of nitrogen allocated to carboxylation (unitless) - real(r8), intent (out):: PNstoreopt !optimal proportion of nitrogen for storage - real(r8), intent (out):: PNlcopt !optimal proportion of nitrogen for light capture - real(r8), intent (out):: PNetopt !optimal proportion of nitrogen for electron transport - real(r8), intent (out):: PNrespopt !optimal proportion of nitrogen for respiration - real(r8), intent (out):: PNcbopt !optial proportion of nitrogen for carboxyaltion - - !------------------------------------------------------------------------------------------------------------------------------- - !intermediate variables - real(r8) :: Carboncost1 !absolute amount of carbon cost associated with maintenance respiration due to deccrease in light capture nitrogen(g dry mass per day) - real(r8) :: Carboncost2 !absolute amount of carbon cost associated with maintenance respiration due to increase in light capture nitrogen(g dry mass per day) - real(r8) :: Carbongain1 !absolute amount of carbon gain associated with maintenance respiration due to deccrease in light capture nitrogen(g dry mass per day) - real(r8) :: Carbongain2 !absolute amount of carbon gain associated with maintenance respiration due to increase in light capture nitrogen(g dry mass per day) - real(r8) :: Fc !the temperature adjustment factor for Vcmax - real(r8) :: Fj !the temperature adjustment factor for Jmax - real(r8) :: PNlc !the current nitrogen allocation proportion for light capture - real(r8) :: Jmax !the maximum electron transport rate (umol/m2/s) - real(r8) :: JmaxCoef !coefficient determining the response of electron transport rate to light availability (unitless) and humidity - real(r8) :: Jmaxb0act !base value of Jmax (umol/m2/s) - real(r8) :: JmaxL !the electron transport rate with maximum daily radiation (umol/m2/s) - real(r8) :: JmeanL !the electron transport rate with mean radiation (umol/m2/s) - real(r8) :: Nstore !absolute amount of nitrogen allocated to storage (gN/m2 leaf) - real(r8) :: Nresp !absolute amount of nitrogen allocated to respiration (gN/m2 leaf) - real(r8) :: Nlc !absolute amount of nitrogen allocated to light capture (gN/m2 leaf) - real(r8) :: Net !absolute amount of nitrogen allocated to electron transport (gN/m2 leaf) - real(r8) :: Ncb !absolute amount of nitrogen allocated to carboxylation (gN/m2 leaf) - real(r8) :: Nresp1 !absolute amount of nitrogen allocated to respiration due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: Nlc1 !absolute amount of nitrogen allocated to light capture due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: Net1 !absolute amount of nitrogen allocated to electron transport due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: Ncb1 !absolute amount of nitrogen allocated to carboyxlation due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: Nresp2 !absolute amount of nitrogen allocated to respiration due to decrease in light capture nitrogen(gN/m2 leaf) - real(r8) :: Nlc2 !absolute amount of nitrogen allocated to light capture due to decrease in light capture nitrogen(gN/m2 leaf) - real(r8) :: Net2 !absolute amount of nitrogen allocated to electron transport due to decrease in light capture nitrogen(gN/m2 leaf) - real(r8) :: Ncb2 !absolute amount of nitrogen allocated to carboxylation due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: PSN !g carbon photosynthesized per day per unit(m2) of leaf - real(r8) :: RESP !g carbon respired per day per unit(m2) of leaf due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: PSN1 !g carbon photosynthesized per day per unit(m2) of leaf due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: RESP1 !g carbon respired per day per unit(m2) of leaf due to decrease in light capture nitrogen(gN/m2 leaf) - real(r8) :: PSN2 !g carbon photosynthesized per day per unit(m2) of leaf due to decrease in light capture nitrogen(gN/m2 leaf) - real(r8) :: RESP2 !g carbon respired per day per unit(m2) of leaf - real(r8) :: Npsntarget !absolute amount of target nitrogen for photosynthesis(gN/m2 leaf) - real(r8) :: Npsntarget1 !absolute amount of target nitrogen for photosynthesis due to increase in light capture nitrogen(gN/m2 leaf) - real(r8) :: Npsntarget2 !absolute amount of target nitrogen for photosynthesis due to decrease in light capture nitrogen(gN/m2 leaf) - real(r8) :: NUEj !nitrogen use efficiency for electron transport under current environmental conditions - real(r8) :: NUEc !nitrogen use efficiency for carboxylation under current environmental conditions - real(r8) :: NUEjref !nitrogen use efficiency for electron transport under reference environmental conditions (25oC and 385ppm Co2) - real(r8) :: NUEcref !nitrogen use efficiency for carboxylation under reference environmental conditions (25oC and 385ppm Co2) - real(r8) :: NUEr !nitrogen use efficiency for respiration - real(r8) :: PARi10c !10-day mean constrained photosynthetic active radiation on in a canopy (umol/m2/s) - real(r8) :: PARimx10c !10-day mean constrained 24hr maximum photosynthetic active radiation on in a canopy (umol/m2/s) - real(r8) :: Kj2Kcref !the ratio of rubisco-limited photosynthetic rate (Wc) to light limited photosynthetic rate (Wj) - real(r8) :: PNlcoldi !old value of the proportion of nitrogen allocated to light capture (unitless) - real(r8) :: Kj2Kc !the ratio of Wc to Wj under changed conditions - real(r8) :: Kc !conversion factors for Vc,max to Wc - real(r8) :: Kj !conversion factor for electron transport rate to Wj - real(r8) :: theta !efficiency of light energy conversion (unitless) - real(r8) :: chg_per_step !the nitrogen change per interation - real(r8) :: Vcmaxnight !Vcmax during night (umol/m2/s) - real(r8) :: ci !inter-cellular CO2 concentration (Pa) - real(r8) :: theta_cj !interpolation coefficient - real(r8) :: tleafd10c !10-day mean daytime leaf temperature, contrained for physiological range (oC) - real(r8) :: tleafn10c !10-day mean leaf temperature for night, constrained for physiological range (oC) - real(r8) :: Vcmax !the maximum carboxyaltion rate (umol/m2/s) - integer :: KcKjFlag !flag to indicate whether to update the Kc and Kj using the photosynthesis subroutine; 0--Kc and Kj need to be calculated; 1--Kc and Kj is prescribed. - integer :: jj !index record fo the number of iterations - integer :: increase_flag !whether to increase or decrease - - call NUEref(NUEjref, NUEcref, Kj2Kcref) - theta_cj = 0.95_r8 - Nstore = PNstoreold * FNCa !proportion of storage nitrogen in functional nitrogen - Nlc = PNlcold * FNCa !proportion of light capturing nitrogen in functional nitrogen - Net = PNetold * FNCa !proportion of light harvesting (electron transport) nitrogen in functional nitrogen - Nresp = PNrespold * FNCa !proportion of respirational nitrogen in functional nitrogen - Ncb = PNcbold * FNCa !proportion of carboxylation nitrogen in functional nitrogen - if (Nlc > FNCa * 0.5_r8) Nlc = 0.5_r8 * FNCa - chg_per_step = 0.02* FNCa - PNlc = PNlcold - PNlcoldi = PNlcold - 0.001_r8 - PARi10c = max(PARLowLim, PARi10) - PARimx10c = max(PARLowLim, PARimx10) - increase_flag = 0 - jj = 1 - tleafd10c = min(max(tleafd10, Trange1), Trange2) !constrain the physiological range - tleafn10c = min(max(tleafn10, Trange1), Trange2) !constrain the physiological range - ci = 0.7_r8 * CO2a10 - JmaxCoef = Jmaxb1 * ((hourpd / 12.0_r8)**2.0_r8) * (1.0_r8 - exp(-relhExp * max(relh10 - minrelh, 0.0_r8) / & - (1.0_r8 - minrelh))) - do while (PNlcoldi .NE. PNlc .and. jj < 100) - Fc = VcmxTKattge(tair10, tleafd10c) * Fc25 - Fj = JmxTKattge(tair10, tleafd10c) * Fj25 - NUEr = Cv * NUEr25 * (RespTBernacchi(tleafd10c) * hourpd + RespTBernacchi(tleafn10c) * (24.0_r8 - hourpd)) !nitrogen use efficiency for respiration (g biomass/m2/day/g N) - !**************************************************** - !Nitrogen Allocation Scheme: store the initial value - !**************************************************** - KcKjFlag = 0 - call NUE(O2a10, ci, tair10, tleafd10c, NUEj, NUEc, Kj2Kc) - call Nitrogen_investments (KcKjFlag,FNCa, Nlc, forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, tair10, & - tleafd10c,tleafn10c, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, Kc, Kj, ci, & - Vcmax, Jmax,JmeanL,JmaxL, Net, Ncb, Nresp, PSN, RESP) - - Npsntarget = Nlc + Ncb + Net !target nitrogen allocated to photosynthesis, which may be lower or higher than Npsn_avail - PNlcoldi = Nlc / FNCa - Nstore = FNCa - Npsntarget - Nresp - !------------------------------------------------------------------------------------ - !test the increase of light capture nitrogen - if (Nstore > 0.0_r8 .and.(increase_flag .eq. 1 .or. jj .eq. 1)) then - Nlc2 = Nlc + chg_per_step - if (Nlc2 / FNCa > 0.95_r8) Nlc2 = 0.95_r8 * FNCa - KcKjFlag = 1 - call Nitrogen_investments (KcKjFlag,FNCa, Nlc2, forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, & - tair10, tleafd10c,tleafn10c, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, Kc, Kj, ci, & - Vcmax, Jmax,JmeanL,JmaxL, Net2, Ncb2, Nresp2, PSN2, RESP2) - - Npsntarget2 = Nlc2 + Ncb2 + Net2 - !update the nitrogen change - Carboncost2 = (Npsntarget2 - Npsntarget) * NMCp25 * Cv * (RespTBernacchi(tleafd10c) * hourpd + & - RespTBernacchi(tleafn10c) * (24.0_r8 - hourpd)) - Carbongain2 = PSN2 - PSN - if(Carbongain2 > Carboncost2 .and. (Npsntarget2 + Nresp2 < 0.95_r8 * FNCa))then - Nlc = Nlc2 - Net = Net2 - Ncb = Ncb2 - Nstore = FNCa - Npsntarget2 - Nresp2 - if (jj == 1) increase_flag = 1 - end if - end if - !------------------------------------------------------------------------------------ - !test the decrease of light capture nitrogen - if (increase_flag == 0) then - if (Nstore < 0.0_r8) then - Nlc1 = Nlc * 0.8_r8 !bigger step of decrease if it is negative - else - Nlc1 = Nlc - chg_per_step - end if - if (Nlc1 < 0.05_r8) Nlc1 = 0.05_r8 - KcKjFlag = 1 - call Nitrogen_investments (KcKjFlag,FNCa, Nlc1,forc_pbot10, relh10, CO2a10,O2a10, PARi10c, PARimx10c,rb10, hourpd, & - tair10, tleafd10c,tleafn10c, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc,Fj, NUEc, NUEj, NUEcref, NUEjref,NUEr, Kc, Kj, ci,& - Vcmax, Jmax,JmeanL,JmaxL, Net1, Ncb1, Nresp1, PSN1, RESP1) - Npsntarget1 = Nlc1 + Ncb1 + Net1 - Carboncost1 = (Npsntarget - Npsntarget1) * NMCp25 * Cv * (RespTBernacchi(tleafd10c) * hourpd + & - RespTBernacchi(tleafn10c) * (24.0_r8 - hourpd)) - Carbongain1 = PSN - PSN1 - if((Carbongain1 < Carboncost1 .and. Nlc1 > 0.05_r8) .or. (Npsntarget + Nresp) > 0.95_r8 * FNCa)then - Nlc = Nlc1 - Net = Net1 - Ncb = Ncb1 - Nstore = FNCa - Npsntarget1 - Nresp1 - end if - end if - PNlc = Nlc / FNCa - jj = jj + 1 - end do - PNlcopt = Nlc / FNCa - PNstoreopt = Nstore / FNCa - PNcbopt = Ncb / FNCa - PNetopt = Net / FNCa - PNrespopt = Nresp / FNCa - -end subroutine NitrogenAllocation - -!***************************************************************************************************************** -!calcualte the nitrogen investment for electron transport, carb10oxylation, respiration given a specified value -!of nitrogen allocation in light capture [Nlc]. This equation are based on Ali et al 2015b. - -subroutine Nitrogen_investments (KcKjFlag, FNCa, Nlc, forc_pbot10, relh10, & - CO2a10, O2a10, PARi10, PARimx10, rb10, hourpd, tair10, tleafd10, tleafn10, & - Kj2Kc, Wc2Wjb0, JmaxCoef, Fc, Fj, NUEc, NUEj, NUEcref, NUEjref, NUEr, Kc, & - Kj, ci, Vcmax, Jmax, JmeanL, JmaxL, Net, Ncb, Nresp, PSN, RESP) - implicit none - integer, intent (in) :: KcKjFlag !flag to indicate whether to update the Kc and Kj using the photosynthesis subroutine; 0--Kc and Kj need to be calculated; 1--Kc and Kj is prescribed. - real(r8), intent (in) :: FNCa !Area based functional nitrogen content (g N/m2 leaf) - real(r8), intent (in) :: Nlc !nitrogen content for light capture(g N/m2 leaf) - real(r8), intent (in) :: forc_pbot10 !10-day mean air pressure (Pa) - real(r8), intent (in) :: relh10 !10-day mean relative humidity (unitless) - real(r8), intent (in) :: CO2a10 !10-day mean CO2 concentration in the air (Pa) - real(r8), intent (in) :: O2a10 !10-day mean O2 concentration in the air (Pa) - real(r8), intent (in) :: PARi10 !10-day mean photosynthetic active radiation on in a canopy (umol/m2/s) - real(r8), intent (in) :: PARimx10 !10-day mean 24hr maximum photosynthetic active radiation on in a canopy (umol/m2/s) - real(r8), intent (in) :: rb10 !10-day mean boundary layer resistance (s/m) - real(r8), intent (in) :: hourpd !hours of light in a the day (hrs) - real(r8), intent (in) :: tair10 !10-day running mean of the 2m temperature (oC) - real(r8), intent (in) :: tleafd10 !10-day mean daytime leaf temperature (oC) - real(r8), intent (in) :: tleafn10 !10-day mean nighttime leaf temperature (oC) - real(r8), intent (in) :: Kj2Kc !ratio: Kj / Kc - real(r8), intent (in) :: Wc2Wjb0 !the baseline ratio of rubisco-limited rate vs light-limited photosynthetic rate (Wc:Wj) - real(r8), intent (in) :: JmaxCoef !coefficient determining the response of electron transport rate to light availability (unitless) and humidity - real(r8), intent (in) :: Fc !the temperature adjustment factor for Vcmax - real(r8), intent (in) :: Fj !the temperature adjustment factor for Jmax - real(r8), intent (in) :: NUEc !nitrogen use efficiency for carboxylation - real(r8), intent (in) :: NUEj !nitrogen use efficiency for electron transport - real(r8), intent (in) :: NUEcref !nitrogen use efficiency for carboxylation under reference climates - real(r8), intent (in) :: NUEjref !nitrogen use efficiency for electron transport under reference climates - real(r8), intent (in) :: NUEr !nitrogen use efficiency for respiration - real(r8), intent (inout) :: Kc !conversion factors from Vc,max to Wc - real(r8), intent (inout) :: Kj !conversion factor from electron transport rate to Wj - real(r8), intent (inout) :: ci !inter-cellular CO2 concentration (Pa) - real(r8), intent (out) :: Vcmax !the maximum carboxyaltion rate (umol/m2/s) - real(r8), intent (out) :: Jmax !the maximum electron transport rate (umol/m2/s) - real(r8), intent (out) :: JmaxL !the electron transport rate with maximum daily radiation (umol/m2/s) - real(r8), intent (out) :: JmeanL !the electron transport rate with mean radiation (umol/m2/s) - real(r8), intent (out) :: Net !nitrogen content for electron transport(g N/m2 leaf) - real(r8), intent (out) :: Ncb !nitrogen content for carboxylation(g N/m2 leaf) - real(r8), intent (out) :: Nresp !nitrogen content for respiration(g N/m2 leaf) - real(r8), intent (out) :: PSN !daily photosynthetic rate(g C/day/m2 leaf) - real(r8), intent (out) :: RESP !daily respiration rate(g C/day/m2 leaf) - !------------------------------------------------------------------------------------------------------------------------------- - !intermediate variables - real(r8) :: A !Gross photosynthetic rate (umol CO2/m2/s) - real(r8) :: Wc2Wj !ratio: Wc/Wj - real(r8) :: ELTRNabsorb !absorbed electron rate, umol electron/m2 leaf /s - real(r8) :: Jmaxb0act !base value of Jmax (umol/m2/s) - real(r8) :: theta_cj !interpolation coefficient - real(r8) :: theta !light absorption rate (0-1) - real(r8) :: Vcmaxnight !Vcmax during night (umol/m2/s) - real(r8) :: Wc !rubisco-limited photosynthetic rate (umol/m2/s) - real(r8) :: Wj !light limited photosynthetic rate (umol/m2/s) - real(r8) :: NUECHG !the nitrogen use efficiency change under current conidtions compared to reference climate conditions (25oC and 385 ppm ) - real(r8), parameter :: leaf_mr_vcm = 0.015_r8 !Scalar constant of leaf respiration with Vcmax (should use parameter in CanopyStateMod) - - theta_cj = 0.95_r8 - theta = 0.292_r8 / (1.0_r8 + 0.076_r8 / (Nlc * Cb)) - ELTRNabsorb = theta * PARi10 - Jmaxb0act = Jmaxb0 * FNCa * Fj - Jmax = Jmaxb0act + JmaxCoef * ELTRNabsorb - JmaxL = theta * PARimx10 / (sqrt(1.0_r8 + (theta * PARimx10 / Jmax)**2.0_r8)) - NUEchg = (NUEc / NUEcref) * (NUEjref / NUEj) - Wc2Wj = Wc2Wjb0 * (NUEchg**0.5_r8) - Wc2Wj = min(1.0_r8, Wc2Wj) - Vcmax = Wc2Wj * JmaxL * Kj2Kc - JmeanL = theta * PARi10 / (sqrt(1.0_r8 + (ELTRNabsorb / Jmax)**2.0_r8)) - if(KcKjFlag.eq.0)then !update the Kc,Kj, anc ci information - call Photosynthesis_luna(forc_pbot10, tleafd10, relh10, CO2a10, O2a10,rb10, Vcmax, JmeanL, ci, Kc, Kj, A) - else - Wc = Kc * Vcmax - Wj = Kj * JmeanL - A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) - endif - PSN = Cv * A * hourpd - Vcmaxnight = VcmxTKattge(tair10, tleafn10) / VcmxTKattge(tair10, tleafd10) * Vcmax - RESP = Cv * leaf_mr_vcm * (Vcmax * hourpd + Vcmaxnight * (24.0_r8 - hourpd)) - Net = Jmax / Fj - Ncb = Vcmax / Fc - Nresp = RESP / NUEr - -end subroutine Nitrogen_investments - - - -!******************************************************************************************************************** -! Calculate the photosynthesis by solving the following 3 equations for 3 unknowns (A, gs, Ci): Farquahr's non-linear equation (A versus Ci), -! Ball-Berry equation (gs versus A) and the diffusion equation (A = gs * (Ca - Ci). The approach taken is the following; Solve the 3 equations for -! two phases. First phase is where Rubisco is limiting (Wc <= Wj) and second phase is where light is limiting (Wj > Wc). - -subroutine Photosynthesis_luna(forc_pbot, tleafd, relh, CO2a,O2a, rb, Vcmax, JmeanL, ci, Kc, Kj, A) - implicit none - real(r8), intent (in) :: forc_pbot !air presure (Pa) - real(r8), intent (in) :: tleafd !daytime leaf temperature (oC) - real(r8), intent (in) :: relh !relative humidity (unitless) - real(r8), intent (in) :: CO2a !atmospheric CO2 partial pressure(Pa) - real(r8), intent (in) :: O2a !atmospheric O2 partial pressure(Pa) - real(r8), intent (in) :: rb !boundary layer resistance (s/m) - real(r8), intent (in) :: Vcmax !maximum carboxylation rate (umol/m2/s) - real(r8), intent (in) :: JmeanL !average electron transport rate (umol/m2/s) - real(r8), intent (out):: ci !inter-cellular CO2 concentration (ppm) - real(r8), intent (out):: Kc !conversion factors for Vc,max to Wc - real(r8), intent (out):: Kj !conversion factors for Jmax to Wj - real(r8), intent (out):: A !g dry mass photosynthesized per day - - !------------------------------------------------------------------------------------------------------------------------------- - !intermediate variables - real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model - real(r8) :: cf !conversion factor of resistance: m**2/umol -> s/m - real(r8) :: bp !maximum stomatal resistance - real(r8) :: mpe !plant functional type dependent parameter for stomatal conductance - real(r8) :: rs !stomatal resistance (s/m) - real(r8) :: r1 !root1 of quadratic equations - real(r8) :: r2 !root2 of quadratic equations - real(r8) :: Wc !rubisco-limited photosynthetic rate (umol/m2/s) - real(r8) :: Wj !light-limited photosynthetic rate (umol/m2/s) - real(r8) :: k_o !Michaelis-menten constant for O2 in Farquhar's model - real(r8) :: k_c !Michaelis-menten constant for CO2 in Farquhar's model - real(r8) :: CO2c !partial pressure of CO2 (Pa) - real(r8) :: O2c !partial pressure of oxygen (Pa) - real(r8) :: c_p !Michaelis-menten constant for Farquhar's model related to rubisco specificity factor - real(r8) :: tdayk !daytime temperature in Kelvin - real(r8) :: ciold !old value of inter-cellular CO2 concentration for convergence check - real(r8) :: bbb !Ball-Berry minimum leaf conductance (umol H20/m2/s) - real(r8) :: mbb !Ball-Berry slope of conductance photosynthesis relationship (stressed) - real(r8) :: gs_mol !leaf stomatal conductance (umol H20/m2/s) - real(r8) :: gb_mol !leaf boundary layer conductance (umol H20/m2/s) - real(r8) :: aquad !terms of quadratic equations - real(r8) :: bquad !terms of quadratic equations - real(r8) :: cquad !terms of quadratic equations - real(r8) :: phi !terms of quadratic equations - real(r8) :: rsmax0 !maximum stomata conductance (s/m) - real(r8) :: tleaf !daytime leaf temperature (oC) - real(r8) :: tleafk !the temperature of the leaf in Kelvin - real(r8) :: theta_cj !the interpolation coefficient for Wj and Wc - real(r8) :: relhc !constrained relative humidity (unitless) - integer :: i !index record the number of iterations - - theta_cj = 0.95_r8 - rsmax0 = 2.0_r8 * 1.0e4_r8 - bp = 2000.0_r8 - tleaf = tleafd - tleafk = tleaf + tfrz - aquad = 1.0_r8 - relhc = max(minrelh, relh) - bbb = 1.0_r8 / bp - mbb = mp - CO2c = CO2a - O2c = O2a - ci = 0.7_r8 * CO2c - ciold = ci - 0.02_r8 - cf = forc_pbot / (8.314_r8 * tleafk) * 1.0e6_r8 - gb_mol = cf / rb - k_c = kc25 * exp((79430.0_r8 / (8.314_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - k_o = ko25 * exp((36380.0_r8 / (8.314_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - c_p = Cp25 * exp((37830.0_r8 / (8.314_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25_r8) / (tfrz + tleaf))) - awc = k_c * (1.0_r8 + O2c / k_o) - i = 1 - do while (abs(ci - ciold) > 0.01_r8 .and. i < 100) ! for RUBISCO limitation - i = i + 1 - ciold = ci - Kc = max(ci - c_p, 0.0_r8) / (ci + awc) - Wc = Kc * Vcmax - gs_mol = bbb + mbb * Wc / CO2c * forc_pbot * relhc - phi = forc_pbot * (1.37_r8 * gs_mol + 1.6_r8 * gb_mol) / (gb_mol * gs_mol) - bquad = awc - CO2c + phi * Vcmax - cquad = -(c_p * phi * Vcmax + awc * CO2c) - call Quadratic(aquad, bquad, cquad, r1, r2) - ci = max(r1, r2) - if (ci < 0.0_r8) ci = c_p + 0.5_r8 * ciold - end do - Kj = max(ci - c_p, 0.0_r8) / (4.0_r8 * ci + 8.0_r8 * c_p) - Kc = max(ci - c_p, 0.0_r8) / (ci + awc) - Wc = Kc * Vcmax - Wj = Kj * JmeanL - ciold = ci - 0.02_r8 - if (Wj < Wc) then !light limitation - i = 1 - do while (abs(ci - ciold) > 0.01_r8 .and. i < 100) - i = i + 1 - ciold = ci - gs_mol = bbb + mbb * Wj / CO2c * forc_pbot * relhc - phi = forc_pbot * (1.37_r8 * gs_mol + 1.6_r8 * gb_mol) / (gb_mol * gs_mol) - bquad = 2.0_r8 * c_p - CO2c + phi * JmeanL / 4.0_r8 - cquad = -(c_p * phi * JmeanL / 4.0_r8 + 2.0_r8 * c_p * CO2c) - call Quadratic(aquad, bquad, cquad, r1, r2) - ci = max(r1, r2) - if (ci < 0.0_r8) ci = c_p + 0.5_r8 * ciold - Kj = max(ci - c_p, 0.0_r8) / (4.0_r8 * ci + 8.0_r8 * c_p) - Wj = Kj * JmeanL - end do - Kj = max(ci - c_p, 0.0_r8) / (4.0_r8 * ci + 8.0_r8 * c_p) - Kc = max(ci - c_p, 0.0_r8) / (ci + awc) - Wc = Kc * Vcmax - Wj = Kj * JmeanL - end if - A = (1.0_r8 - theta_cj) * max(Wc, Wj) + theta_cj * min(Wc, Wj) !use this instead of the quadratic to avoid values not in the range of wc and wj - rs = cf / gs_mol - rs = min(rsmax0, rs) - -end subroutine Photosynthesis_luna - - - -!********************************************************************************************************************************************************************** -!Calculate the reference nitrogen use effieciency dependence on CO2 and leaf temperature - -subroutine NUEref(NUEjref,NUEcref,Kj2Kcref) - implicit none - real(r8), intent (out):: NUEjref !nitrogen use efficiency for electron transport under refernce environmental conditions (25oC and 385 ppm co2) - real(r8), intent (out):: NUEcref !nitrogen use efficiency for carboxylation under reference environmental conditions (25oC and 385 ppm co2) - real(r8), intent (out):: Kj2Kcref !the ratio of Wc to Wj under reference (25oC and 385 ppm co2) conditions - !--------------------------------------------- - !intermediate variables - real(r8) :: Fj !the temperature adjust factor for Jmax - real(r8) :: Fc !the temperatuer adjust factor for Vcmax - real(r8) :: tgrow !10 day mean growth temperature (oC), 24 hour mean temperature - real(r8) :: tleaf !leaf temperature (oC) - real(r8) :: CO2c !CO2 concentration (ppm) - real(r8) :: O2c !O2 concentration (ppm) - real(r8) :: k_o !Rubsico O2 specifity - real(r8) :: k_c !Rubsico CO2 specifity - real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model - real(r8) :: c_p !CO2 compenstation point (Pa) - real(r8) :: ci !leaf internal [CO2] (Pa) - real(r8) :: Kc !converstion factor from Vcmax to Wc - real(r8) :: Kj !converstion factor from J to Wc - - tgrow = 25.0_r8 - tleaf = 25.0_r8 - Fc = VcmxTKattge(tgrow, tleaf) * Fc25 - Fj = JmxTKattge(tgrow, tleaf) * Fj25 - CO2c = co2ref * forc_pbot_ref * 1.0e-6_r8 !pa - O2c = O2ref * forc_pbot_ref * 1.0e-6_r8 !pa - k_c = Kc25 * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - k_o = Ko25 * exp((36380.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - c_p = Cp25 * exp((37830.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - awc = k_c * (1.0_r8+O2c/k_o) - ci = 0.7_r8 * CO2c - Kj = max( ci-c_p,0.0_r8 ) / ( 4.0_r8*ci + 8.0_r8*c_p ) - Kc = max( ci-c_p,0.0_r8 ) / (ci+awc) - NUEjref = Kj * Fj - NUEcref = Kc * Fc - Kj2Kcref = Kj / Kc - -end subroutine NUEref - - -!******************************************************************************************************************** -!Calculate the Nitrogen use effieciency dependence on CO2 and leaf temperature - -subroutine NUE(O2a, ci, tgrow, tleaf, NUEj,NUEc,Kj2Kc) - implicit none - real(r8), intent (in) :: o2a !air O2 partial presuure (Pa) - real(r8), intent (in) :: ci !leaf inter-cellular [CO2] (PPM) - real(r8), intent (in) :: tgrow !10 day growth temperature (oC), 24 hour mean temperature - real(r8), intent (in) :: tleaf !leaf temperature (oC) - real(r8), intent (out):: NUEj !nitrogen use efficiency for electron transport under refernce environmental conditions (25oC and 385 ppm co2) - real(r8), intent (out):: NUEc !nitrogen use efficiency for carboxylation under reference environmental conditions (25oC and 385 ppm co2) - real(r8), intent (out):: Kj2Kc !the ratio of Kj to Kc - !------------------------------------------------ - !intermediate variables - real(r8) :: Fj !the temperatuer adjust factor for Jmax - real(r8) :: Fc !the temperatuer adjust factor for Vcmax - real(r8) :: Kc !conversion factor from Vcmax to Wc - real(r8) :: Kj !conversion factor from J to W - real(r8) :: k_o !Rubsico O2 specifity - real(r8) :: k_c !Rubsico CO2 specifity - real(r8) :: awc !second deminator term for rubsico limited carboxylation rate based on Farquhar model - real(r8) :: c_p !CO2 compenstation point (Pa) - - Fc = VcmxTKattge(tgrow, tleaf) * Fc25 - Fj = JmxTKattge(tgrow, tleaf) * Fj25 - k_c = Kc25 * exp((79430.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - k_o = Ko25 * exp((36380.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - c_p = Cp25 * exp((37830.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - awc = k_c * ( 1.0_r8 + O2a/k_o ) - Kj = max( ci-c_p,0.0_r8 ) / ( 4.0_r8*ci + 8.0_r8*c_p ) - Kc = max( ci-c_p,0.0_r8 ) / ( ci+awc ) - NUEj = Kj * Fj - NUEc = Kc * Fc - Kj2Kc = Kj / Kc -end subroutine NUE - -!************************************************************************************************************************************************ -!Calculate the temperature response for Vcmax; assuming temperature acclimation as in CLM4.5, based on Kattge and Knorr 2007 - -real(r8) function VcmxTKattge(tgrow, tleaf) - implicit none - real(r8), intent(in):: tgrow !daytime and nightime growth temperature (oC) - real(r8), intent(in):: tleaf !leaf temperature (oC) - real(r8) :: TlimVcmx !Vcmax activation energy - real(r8) :: Vcmxf1 !Vcmax coef1 - real(r8) :: Vcmxf2 !Vcmax coef2 - real(r8) :: Vcmxf3 !Vcmax coef3 - - TlimVcmx = 668.39_r8- 1.07_r8 * (min(max(tgrow, 11.0_r8), 35.0_r8)) - Vcmxf1 = 1.0_r8 + exp((TlimVcmx * (25.0_r8 + tfrz) - 200000.0_r8) / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) - Vcmxf2 = exp((72000.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1.0_r8 - (tfrz+ 25.0_r8) / (tfrz + tleaf))) - Vcmxf3 = 1.0_r8 + exp((TlimVcmx * (tleaf + tfrz) - 200000.0_r8) / (rgas*1.e-3_r8 * (tleaf + tfrz))) - VcmxTKattge = Vcmxf1 * Vcmxf2 / Vcmxf3 - -end function VcmxTKattge - -!************************************************************************************************************************************************ -!Calculate the temperature response for Jmax; assuming temperature acclimation as in CLM4.5, based on Kattge and Knorr 2007 - -real(r8) function JmxTKattge(tgrow, tleaf) - implicit none - real(r8), intent(in):: tgrow !daytime and nightime growth temperature (oC) - real(r8), intent(in):: tleaf !leaf temperature (oC) - real(r8) :: TlimJmx !Jmax activation energy - real(r8) :: Jmxf1 !Jmax coef1 - real(r8) :: Jmxf2 !Jmax coef2 - real(r8) :: Jmxf3 !Jmax coef3 - - TlimJmx = 659.7_r8 - 0.75_r8 * (min(max(tgrow, 11.0_r8), 35.0_r8)) - Jmxf1 = 1.0_r8 + exp((TlimJmx * (25.0_r8 + tfrz) - 200000.0_r8) / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) - Jmxf2 = exp((50000.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1._r8 - (tfrz + 25.0_r8) / (tleaf+tfrz))) - Jmxf3 = 1.0_r8 + exp((TlimJmx * (tleaf + tfrz) - 200000.0_r8) / (rgas*1.e-3_r8 * (tleaf + tfrz))) - JmxTKattge = Jmxf1 * Jmxf2 / Jmxf3 - -end function JmxTKattge - -!******************************************************************************************************************** -!Calculate the temperature response for Vcmax; without assuming temperature acclimation and following Leunning 2002 Plant, Cell & Environment - -real(r8) function VcmxTLeuning(tgrow, tleaf) - implicit none - real(r8), intent(in) :: tgrow !daytime and nightime growth temperature (oC) - real(r8), intent(in) :: tleaf !leaf temperature (oC) - real(r8) :: TlimVcmx !Vcmax activation energy - real(r8) :: Vcmxf1 !Vcmax coef1 - real(r8) :: Vcmxf2 !Vcmax coef2 - real(r8) :: Vcmxf3 !Vcmax coef3 - - TlimVcmx = 486.0_r8 - Vcmxf1 = 1.0_r8 + exp((TlimVcmx * (25.0_r8 + tfrz) - 149252.0_r8) / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) - Vcmxf2 = exp((73637.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1._r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - Vcmxf3 = 1.0_r8 + exp((TlimVcmx * (tleaf + tfrz) - 149252.0_r8) / (rgas*1.e-3_r8 * (tleaf + tfrz))) - VcmxTLeuning = Vcmxf1 * Vcmxf2 / Vcmxf3 - -end function VcmxTLeuning - -!******************************************************************************************************************** -!Calculate the temperature response for Jmax; without assuming temperature acclimation and following Leunning 2002 Plant, Cell & Environment -real(r8) function JmxTLeuning(tgrow, tleaf) - implicit none - real(r8), intent(in):: tgrow !daytime and nightime growth temperature (oC) - real(r8), intent(in):: tleaf !leaf temperature (oC) - real(r8) :: TlimJmx !Jmax activation energy - real(r8) :: Jmxf1 !Jmax coef1 - real(r8) :: Jmxf2 !Jmax coef2 - real(r8) :: Jmxf3 !Jmax coef3 - - TlimJmx = 495.0_r8 - Jmxf1 = 1.0_r8 + exp((TlimJmx * (25.0_r8 + tfrz) - 152044.0_r8) / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) - Jmxf2 = exp((50300.0_r8 / (rgas*1.e-3_r8 * (25.0_r8 + tfrz))) * (1._r8 - (tfrz + 25.0_r8) / (tfrz + tleaf))) - Jmxf3 = 1.0_r8 + exp((TlimJmx * (tleaf + tfrz) - 152044.0_r8) / (rgas*1.e-3_r8 * (tleaf + tfrz))) - JmxTLeuning = Jmxf1 * Jmxf2 / Jmxf3 - -end function JmxTLeuning - -!******************************************************************************************************************** -!Calculate the temperature response for respiration, following Bernacchi PCE 2001 - -real(r8) function RespTBernacchi(tleaf) - implicit none - real(r8), intent(in):: tleaf !leaf temperature (oC) - RespTBernacchi= exp(18.72_r8-46.39_r8/(rgas*1.e-6_r8 *(tleaf+tfrz))) - -end function RespTBernacchi - - -!******************************************************************************************************************** -!Calculate the soultion using the quadratic formula - -subroutine Quadratic(a,b,c,r1,r2) - implicit none - real(r8), intent(in) :: a !coefficient a - real(r8), intent(in) :: b !coefficient b - real(r8), intent(in) :: c !coefficient c - real(r8), intent(out) :: r1 !root one - real(r8), intent(out) :: r2 !root one - real(r8) :: q ! temporary term for quadratic solution - - r1 = 1.0e36_r8 - r2 = 1.0e36_r8 - - if (a == 0.0_r8) return - - if (b .GE. 0.0_r8) then - q = -0.5_r8 * (b + sqrt(b*b - 4.0_r8*a*c)) - else - q = -0.5_r8 * (b - sqrt(b*b - 4.0_r8*a*c)) - end if - - r1 = q / a - - if (q .NE. 0.0_r8)then - r2 = c / q - else - r2 = 1.0e36_r8 - end if - -end subroutine Quadratic - - -end module LunaMod - diff --git a/src/biogeophys/OzoneBaseMod.F90 b/src/biogeophys/OzoneBaseMod.F90 deleted file mode 100644 index c50818f380..0000000000 --- a/src/biogeophys/OzoneBaseMod.F90 +++ /dev/null @@ -1,146 +0,0 @@ -module OzoneBaseMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Define the interface for ozone_type, which calculates ozone-induced stress. The type - ! defined here is abstract; it will get instantiated as a concrete type that extends - ! this base type (e.g., an ozone-off or ozone-on version). - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - - implicit none - save - private - - ! !PUBLIC TYPES: - type, abstract, public :: ozone_base_type - private - - ! Public data members - ! These should be treated as read-only by other modules (except that they can be - ! modified by extensions of the ozone_base_type) - real(r8), pointer, public :: o3coefvsha_patch(:) ! ozone coefficient for photosynthesis, shaded leaves (0 - 1) - real(r8), pointer, public :: o3coefvsun_patch(:) ! ozone coefficient for photosynthesis, sunlit leaves (0 - 1) - real(r8), pointer, public :: o3coefgsha_patch(:) ! ozone coefficient for conductance, shaded leaves (0 - 1) - real(r8), pointer, public :: o3coefgsun_patch(:) ! ozone coefficient for conductance, sunlit leaves (0 - 1) - - - contains - ! The following routines need to be implemented by all type extensions - procedure(Init_interface) , public, deferred :: Init - procedure(Restart_interface) , public, deferred :: Restart - procedure(CalcOzoneStress_interface) , public, deferred :: CalcOzoneStress - - ! The following routines should only be called by extensions of the ozone_base_type - procedure, public :: InitAllocateBase - procedure, public :: InitColdBase - - end type ozone_base_type - - abstract interface - - subroutine Init_interface(this, bounds) - use decompMod, only : bounds_type - import :: ozone_base_type - - class(ozone_base_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - end subroutine Init_interface - - subroutine Restart_interface(this, bounds, ncid, flag) - use decompMod , only : bounds_type - use ncdio_pio , only : file_desc_t - import :: ozone_base_type - - class(ozone_base_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - end subroutine Restart_interface - - subroutine CalcOzoneStress_interface(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - import :: ozone_base_type - - class(ozone_base_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - real(r8) , intent(in) :: forc_pbot( bounds%begc: ) ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th( bounds%begc: ) ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rssun( bounds%begp: ) ! leaf stomatal resistance, sunlit leaves (s/m) - real(r8) , intent(in) :: rssha( bounds%begp: ) ! leaf stomatal resistance, shaded leaves (s/m) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - end subroutine CalcOzoneStress_interface - - end interface - -contains - - !----------------------------------------------------------------------- - subroutine InitAllocateBase(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate variables in the base class - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(ozone_base_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitAllocateBase' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - allocate(this%o3coefvsha_patch(begp:endp)) ; this%o3coefvsha_patch(:) = nan - allocate(this%o3coefvsun_patch(begp:endp)) ; this%o3coefvsun_patch(:) = nan - allocate(this%o3coefgsha_patch(begp:endp)) ; this%o3coefgsha_patch(:) = nan - allocate(this%o3coefgsun_patch(begp:endp)) ; this%o3coefgsun_patch(:) = nan - - end subroutine InitAllocateBase - - - !----------------------------------------------------------------------- - subroutine InitColdBase(this, bounds) - ! - ! !DESCRIPTION: - ! Do cold start initialization for variables in the base class. Note that this - ! initialization will be the same for all ozone implementations, including the - ! ozone-off implementation. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(ozone_base_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitColdBase' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - this%o3coefvsha_patch(begp:endp) = 1._r8 - this%o3coefvsun_patch(begp:endp) = 1._r8 - this%o3coefgsha_patch(begp:endp) = 1._r8 - this%o3coefgsun_patch(begp:endp) = 1._r8 - - end subroutine InitColdBase - -end module OzoneBaseMod diff --git a/src/biogeophys/OzoneFactoryMod.F90 b/src/biogeophys/OzoneFactoryMod.F90 deleted file mode 100644 index 2b28587a99..0000000000 --- a/src/biogeophys/OzoneFactoryMod.F90 +++ /dev/null @@ -1,53 +0,0 @@ -module OzoneFactoryMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Factory to create an instance of ozone_base_type. This module figures out the - ! particular type to return. - ! - ! !USES: - use decompMod , only : bounds_type - - implicit none - save - private - - ! - ! !PUBLIC ROUTINES: - public :: create_and_init_ozone_type ! create an object of class ozone_base_type - -contains - - !----------------------------------------------------------------------- - function create_and_init_ozone_type(bounds) result(ozone) - ! - ! !DESCRIPTION: - ! Create and initialize an object of ozone_base_type, and return this object. The - ! particular type is determined based on the use_ozone namelist parameter. - ! - ! !USES: - use clm_varctl , only : use_ozone - use OzoneBaseMod , only : ozone_base_type - use OzoneOffMod , only : ozone_off_type - use OzoneMod , only : ozone_type - ! - ! !ARGUMENTS: - class(ozone_base_type), allocatable :: ozone ! function result - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'create_and_init_ozone_type' - !----------------------------------------------------------------------- - - if (use_ozone) then - allocate(ozone, source = ozone_type()) - else - allocate(ozone, source = ozone_off_type()) - end if - - call ozone%Init(bounds) - - end function create_and_init_ozone_type - -end module OzoneFactoryMod diff --git a/src/biogeophys/OzoneMod.F90 b/src/biogeophys/OzoneMod.F90 deleted file mode 100644 index 29b94fa34f..0000000000 --- a/src/biogeophys/OzoneMod.F90 +++ /dev/null @@ -1,543 +0,0 @@ -module OzoneMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates ozone-induced stress. - ! - ! Note that the ozone calculations need to happen AFTER rssun and rsshade are computed - ! by the Photosynthesis routine. However, Photosynthesis also uses the ozone stress - ! computed here. Thus, the ozone stress computed in timestep i is applied in timestep - ! (i+1), requiring these stresses to be saved on the restart file. - ! - ! Developed by Danica Lombardozzi. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod, only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varcon , only : spval - use shr_log_mod , only : errMsg => shr_log_errMsg - use OzoneBaseMod, only : ozone_base_type - use abortutils , only : endrun - - implicit none - save - private - - ! !PUBLIC TYPES: - type, extends(ozone_base_type), public :: ozone_type - private - ! Private data members - real(r8), pointer :: o3uptakesha_patch(:) ! ozone dose, shaded leaves (mmol O3/m^2) - real(r8), pointer :: o3uptakesun_patch(:) ! ozone dose, sunlit leaves (mmol O3/m^2) - - ! NOTE(wjs, 2014-09-29) tlai_old_patch really belongs alongside tlai_patch in - ! CanopyStateType. But there are problems with any way I can think to implement - ! that: - ! - ! - Updating tlai_old from a call in clm_driver, just before tlai is updated: This - ! is problematic to do correctly because tlai is updated in different places - ! depending on whether you're using SP, CN or ED. - ! - ! - Updating tlai_old within each routine that updates tlai: This feels fragile, - ! since it depends on each scheme remembering to do this update at the correct - ! time. - ! - ! - Making tlai a private member of CanopyFluxes, with getter and setter methods. - ! Then the setter method would also set tlai_old. This feels like the most robust - ! solution, but we don't have any precedent for using getters and setters for data - ! arrays. - real(r8), pointer :: tlai_old_patch(:) ! tlai from last time step - - contains - ! Public routines - procedure, public :: Init - procedure, public :: Restart - procedure, public :: CalcOzoneStress - - ! Private routines - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - ! Calculate ozone stress for a single point, for just sunlit or shaded leaves - procedure, private, nopass :: CalcOzoneStressOnePoint - end type ozone_type - - interface ozone_type - module procedure constructor - end interface ozone_type - - ! !PRIVATE TYPES: - - ! TODO(wjs, 2014-09-29) This parameter will eventually become a spatially-varying - ! value, obtained from ATM - real(r8), parameter :: forc_ozone = 100._r8 * 1.e-9_r8 ! ozone partial pressure [mol/mol] - - ! TODO(wjs, 2014-09-29) The following parameters should eventually be moved to the - ! params file. Parameters differentiated on veg type should be put on the params file - ! with a pft dimension. - - ! o3:h2o resistance ratio defined by Sitch et al. 2007 - real(r8), parameter :: ko3 = 1.67_r8 - - ! LAI threshold for LAIs that asymptote and don't reach 0 - real(r8), parameter :: lai_thresh = 0.5_r8 - - ! threshold below which o3flux is set to 0 (nmol m^-2 s^-1) - real(r8), parameter :: o3_flux_threshold = 0.8_r8 - - ! o3 intercepts and slopes for photosynthesis - real(r8), parameter :: needleleafPhotoInt = 0.8390_r8 ! units = unitless - real(r8), parameter :: needleleafPhotoSlope = 0._r8 ! units = per mmol m^-2 - real(r8), parameter :: broadleafPhotoInt = 0.8752_r8 ! units = unitless - real(r8), parameter :: broadleafPhotoSlope = 0._r8 ! units = per mmol m^-2 - real(r8), parameter :: nonwoodyPhotoInt = 0.8021_r8 ! units = unitless - real(r8), parameter :: nonwoodyPhotoSlope = -0.0009_r8 ! units = per mmol m^-2 - - ! o3 intercepts and slopes for conductance - real(r8), parameter :: needleleafCondInt = 0.7823_r8 ! units = unitless - real(r8), parameter :: needleleafCondSlope = 0.0048_r8 ! units = per mmol m^-2 - real(r8), parameter :: broadleafCondInt = 0.9125_r8 ! units = unitless - real(r8), parameter :: broadleafCondSlope = 0._r8 ! units = per mmol m^-2 - real(r8), parameter :: nonwoodyCondInt = 0.7511_r8 ! units = unitless - real(r8), parameter :: nonwoodyCondSlope = 0._r8 ! units = per mmol m^-2 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Infrastructure routines (initialization, restart, etc.) - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor() result(ozone) - ! - ! !DESCRIPTION: - ! Return an instance of ozone_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(ozone_type) :: ozone ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - ! DO NOTHING (simply return a variable of the appropriate type) - - ! Eventually this should call the Init routine (or replace the Init routine - ! entirely). But I think it would be confusing to do that until we switch everything - ! to use a constructor rather than the init routine. - - end function constructor - - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize ozone data structure - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate memory for ozone data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - call this%InitAllocateBase(bounds) - - allocate(this%o3uptakesha_patch(begp:endp)) ; this%o3uptakesha_patch(:) = nan - allocate(this%o3uptakesun_patch(begp:endp)) ; this%o3uptakesun_patch(:) = nan - allocate(this%tlai_old_patch(begp:endp)) ; this%tlai_old_patch(:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize ozone history variables - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - this%o3uptakesun_patch(begp:endp) = spval - call hist_addfld1d (fname='O3UPTAKESUN', units='mmol/m^2', & - avgflag='A', long_name='total ozone flux into sunlit leaves', & - ptr_patch=this%o3uptakesun_patch) - - this%o3uptakesha_patch(begp:endp) = spval - call hist_addfld1d (fname='O3UPTAKESHA', units='mmol/m^2', & - avgflag='A', long_name='total ozone flux into shaded leaves', & - ptr_patch=this%o3uptakesha_patch) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Perform cold-start initialization for ozone - ! - ! !ARGUMENTS: - class(ozone_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - begp = bounds%begp - endp = bounds%endp - - call this%InitColdBase(bounds) - - this%o3uptakesha_patch(begp:endp) = 0._r8 - this%o3uptakesun_patch(begp:endp) = 0._r8 - this%tlai_old_patch(begp:endp) = 0._r8 - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart of ozone variables. - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_inqvdlen, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(ozone_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - ! - ! !LOCAL VARIABLES: - logical :: readvar - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='o3_tlaiold', xtype=ncd_double, & - dim1name='pft', & - long_name='one-sided leaf area index, from previous timestep, for ozone calculations', units='', & - readvar=readvar, interpinic_flag='interp', data=this%tlai_old_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3uptakesha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone uptake for shaded leaves', units='mmol m^-3', & - readvar=readvar, interpinic_flag='interp', data=this%o3uptakesha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3uptakesun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone uptake for sunlit leaves', units='mmol m^-3', & - readvar=readvar, interpinic_flag='interp', data=this%o3uptakesun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefvsun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for photosynthesis for sunlit leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefvsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefgsun', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for stomatal conductance for sunlit leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefgsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefvsha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for photosynthesis for shaded leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefvsha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='o3coefgsha', xtype=ncd_double, & - dim1name='pft', & - long_name='ozone coefficient for stomatal conductance for shaded leaves', units='unitless', & - readvar=readvar, interpinic_flag='interp', data=this%o3coefgsha_patch) - - end subroutine Restart - - ! ======================================================================== - ! Science routines - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) - ! - ! !DESCRIPTION: - ! Calculate ozone stress. - ! - ! !USES: - use PatchType , only : patch - ! - ! !ARGUMENTS: - class(ozone_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - real(r8) , intent(in) :: forc_pbot( bounds%begc: ) ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th( bounds%begc: ) ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rssun( bounds%begp: ) ! leaf stomatal resistance, sunlit leaves (s/m) - real(r8) , intent(in) :: rssha( bounds%begp: ) ! leaf stomatal resistance, shaded leaves (s/m) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - ! - ! !LOCAL VARIABLES: - integer :: fp ! filter index - integer :: p ! patch index - integer :: c ! column index - - character(len=*), parameter :: subname = 'CalcOzoneStress' - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(forc_pbot) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(forc_th) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssun) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssha) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rb) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ram) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tlai) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - o3coefvsha => this%o3coefvsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefvsun => this%o3coefvsun_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsha => this%o3coefgsha_patch , & ! Output: [real(r8) (:)] ozone coef - o3coefgsun => this%o3coefgsun_patch , & ! Output: [real(r8) (:)] ozone coef - o3uptakesha => this%o3uptakesha_patch , & ! Output: [real(r8) (:)] ozone dose - o3uptakesun => this%o3uptakesun_patch , & ! Output: [real(r8) (:)] ozone dose - tlai_old => this%tlai_old_patch & ! Output: [real(r8) (:)] tlai from last time step - ) - - do fp = 1, num_exposedvegp - p = filter_exposedvegp(fp) - c = patch%column(p) - -! if (.not.patch%is_fates(p)) then ! When FATES coexists with other vegetation, - ! or when it has an ozone compatible module, this - ! logic will likely come into play - - ! Ozone stress for shaded leaves - call CalcOzoneStressOnePoint( & - forc_ozone=forc_ozone, forc_pbot=forc_pbot(c), forc_th=forc_th(c), & - rs=rssha(p), rb=rb(p), ram=ram(p), & - tlai=tlai(p), tlai_old=tlai_old(p), pft_type=patch%itype(p), & - o3uptake=o3uptakesha(p), o3coefv=o3coefvsha(p), o3coefg=o3coefgsha(p)) - - ! Ozone stress for sunlit leaves - call CalcOzoneStressOnePoint( & - forc_ozone=forc_ozone, forc_pbot=forc_pbot(c), forc_th=forc_th(c), & - rs=rssun(p), rb=rb(p), ram=ram(p), & - tlai=tlai(p), tlai_old=tlai_old(p), pft_type=patch%itype(p), & - o3uptake=o3uptakesun(p), o3coefv=o3coefvsun(p), o3coefg=o3coefgsun(p)) - - tlai_old(p) = tlai(p) - -! else -! ! FATES is fundamentlaly incompatible with this type of patch-level -! ! association with plant functional type, so for the time -! ! being, fates patches will just push these values to invalid -! o3uptakesha(p) = spval -! o3coefvsha(p) = spval -! o3coefgsha(p) = spval -! o3uptakesun(p) = spval -! o3coefvsun(p) = spval -! o3coefgsun(p) = spval -! -! end if - -! else -! ! FATES is fundamentlaly incompatible with this type of patch-level -! ! association with plant functional type, so for the time -! ! being, fates patches will just push these values to invalid -! o3uptakesha(p) = spval -! o3coefvsha(p) = spval -! o3coefgsha(p) = spval -! o3uptakesun(p) = spval -! o3coefvsun(p) = spval -! o3coefgsun(p) = spval -! -! end if - - end do - - end associate - - end subroutine CalcOzoneStress - - !----------------------------------------------------------------------- - subroutine CalcOzoneStressOnePoint( & - forc_ozone, forc_pbot, forc_th, & - rs, rb, ram, & - tlai, tlai_old, pft_type, & - o3uptake, o3coefv, o3coefg) - ! - ! !DESCRIPTION: - ! Calculates ozone stress for a single point, for just sunlit or shaded leaves - ! - ! !USES: - use shr_const_mod , only : SHR_CONST_RGAS - use pftconMod , only : pftcon - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - real(r8) , intent(in) :: forc_ozone ! ozone partial pressure (mol/mol) - real(r8) , intent(in) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rs ! leaf stomatal resistance (s/m) - real(r8) , intent(in) :: rb ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai ! one-sided leaf area index, no burying by snow - real(r8) , intent(in) :: tlai_old ! tlai from last time step - integer , intent(in) :: pft_type ! vegetation type, for indexing into pftvarcon arrays - real(r8) , intent(inout) :: o3uptake ! ozone entering the leaf - real(r8) , intent(out) :: o3coefv ! ozone coefficient for photosynthesis (0 - 1) - real(r8) , intent(out) :: o3coefg ! ozone coefficient for conductance (0 - 1) - ! - ! !LOCAL VARIABLES: - integer :: dtime ! land model time step (sec) - real(r8) :: dtimeh ! time step in hours - real(r8) :: o3concnmolm3 ! o3 concentration (nmol/m^3) - real(r8) :: o3flux ! instantaneous o3 flux (nmol m^-2 s^-1) - real(r8) :: o3fluxcrit ! instantaneous o3 flux beyond threshold (nmol m^-2 s^-1) - real(r8) :: o3fluxperdt ! o3 flux per timestep (mmol m^-2) - real(r8) :: heal ! o3uptake healing rate based on % of new leaves growing (mmol m^-2) - real(r8) :: leafturn ! leaf turnover time / mortality rate (per hour) - real(r8) :: decay ! o3uptake decay rate based on leaf lifetime (mmol m^-2) - real(r8) :: photoInt ! intercept for photosynthesis - real(r8) :: photoSlope ! slope for photosynthesis - real(r8) :: condInt ! intercept for conductance - real(r8) :: condSlope ! slope for conductance - - character(len=*), parameter :: subname = 'CalcOzoneStressOnePoint' - !----------------------------------------------------------------------- - - ! convert o3 from mol/mol to nmol m^-3 - o3concnmolm3 = forc_ozone * 1.e9_r8 * (forc_pbot/(forc_th*SHR_CONST_RGAS*0.001_r8)) - - ! calculate instantaneous flux - o3flux = o3concnmolm3/ (ko3*rs+ rb + ram) - - ! apply o3 flux threshold - if (o3flux < o3_flux_threshold) then - o3fluxcrit = 0._r8 - else - o3fluxcrit = o3flux - o3_flux_threshold - endif - - dtime = get_step_size() - dtimeh = dtime / 3600._r8 - - ! calculate o3 flux per timestep - o3fluxperdt = o3fluxcrit * dtime * 0.000001_r8 - - if (tlai > lai_thresh) then - ! checking if new leaf area was added - if (tlai - tlai_old > 0) then - ! minimizing o3 damage to new leaves - heal = max(0._r8,(((tlai-tlai_old)/tlai)*o3fluxperdt)) - else - heal = 0._r8 - endif - - if (pftcon%evergreen(pft_type) == 1) then - leafturn = 1._r8/(pftcon%leaf_long(pft_type)*365._r8*24._r8) - else - leafturn = 0._r8 - endif - - ! o3 uptake decay based on leaf lifetime for evergreen plants - decay = o3uptake * leafturn * dtimeh - !cumulative uptake (mmol m^-2) - o3uptake = max(0._r8, o3uptake + o3fluxperdt - decay - heal) - - else - o3uptake = 0._r8 - end if - - - if (o3uptake == 0._r8) then - ! No o3 damage if no o3 uptake - o3coefv = 1._r8 - o3coefg = 1._r8 - else - ! Determine parameter values for this pft - ! TODO(wjs, 2014-10-01) Once these parameters are moved into the params file, this - ! logic can be removed. - if (pft_type>3) then - if (pftcon%woody(pft_type)==0) then - photoInt = nonwoodyPhotoInt - photoSlope = nonwoodyPhotoSlope - condInt = nonwoodyCondInt - condSlope = nonwoodyCondSlope - else - photoInt = broadleafPhotoInt - photoSlope = broadleafPhotoSlope - condInt = broadleafCondInt - condSlope = broadleafCondSlope - end if - else - photoInt = needleleafPhotoInt - photoSlope = needleleafPhotoSlope - condInt = needleleafCondInt - condSlope = needleleafCondSlope - end if - - ! Apply parameter values to compute o3 coefficients - o3coefv = max(0._r8, min(1._r8, photoInt + photoSlope * o3uptake)) - o3coefg = max(0._r8, min(1._r8, condInt + condSlope * o3uptake)) - - end if - - end subroutine CalcOzoneStressOnePoint - - -end module OzoneMod diff --git a/src/biogeophys/OzoneOffMod.F90 b/src/biogeophys/OzoneOffMod.F90 deleted file mode 100644 index 8d0df71fd3..0000000000 --- a/src/biogeophys/OzoneOffMod.F90 +++ /dev/null @@ -1,118 +0,0 @@ -module OzoneOffMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Provides an implementatio of ozone_base_type for the ozone-off case. Note that very - ! little needs to be done in this case, so this module mainly provides empty - ! implementations to satisfy the interface. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use OzoneBaseMod, only : ozone_base_type - - implicit none - save - private - - ! !PUBLIC TYPES: - type, extends(ozone_base_type), public :: ozone_off_type - private - contains - procedure, public :: Init - procedure, public :: Restart - procedure, public :: CalcOzoneStress - end type ozone_off_type - - interface ozone_off_type - module procedure constructor - end interface ozone_off_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - function constructor() result(ozone_off) - ! - ! !DESCRIPTION: - ! Return an instance of ozone_off_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(ozone_off_type) :: ozone_off ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - ! DO NOTHING (simply return a variable of the appropriate type) - - ! Eventually this should call the Init routine (or replace the Init routine - ! entirely). But I think it would be confusing to do that until we switch everything - ! to use a constructor rather than the init routine. - - end function constructor - - - subroutine Init(this, bounds) - class(ozone_off_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - call this%InitAllocateBase(bounds) - call this%InitColdBase(bounds) - end subroutine Init - - subroutine Restart(this, bounds, ncid, flag) - use ncdio_pio , only : file_desc_t - - class(ozone_off_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - - ! DO NOTHING - - end subroutine Restart - - subroutine CalcOzoneStress(this, bounds, num_exposedvegp, filter_exposedvegp, & - forc_pbot, forc_th, rssun, rssha, rb, ram, tlai) - - class(ozone_off_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_exposedvegp ! number of points in filter_exposedvegp - integer , intent(in) :: filter_exposedvegp(:) ! patch filter for non-snow-covered veg - real(r8) , intent(in) :: forc_pbot( bounds%begc: ) ! atmospheric pressure (Pa) - real(r8) , intent(in) :: forc_th( bounds%begc: ) ! atmospheric potential temperature (K) - real(r8) , intent(in) :: rssun( bounds%begp: ) ! leaf stomatal resistance, sunlit leaves (s/m) - real(r8) , intent(in) :: rssha( bounds%begp: ) ! leaf stomatal resistance, shaded leaves (s/m) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: ram( bounds%begp: ) ! aerodynamical resistance (s/m) - real(r8) , intent(in) :: tlai( bounds%begp: ) ! one-sided leaf area index, no burying by snow - - ! Enforce expected array sizes (mainly so that a debug-mode threaded test with - ! ozone-off can pick up problems with the call to this routine) - SHR_ASSERT_ALL((ubound(forc_pbot) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(forc_th) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssun) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rssha) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rb) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ram) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tlai) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - ! Explicitly set outputs to 1. This isn't really needed, because they should still be - ! at 1 from cold-start initialization, but do this for clarity here. - - this%o3coefvsha_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefvsun_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefgsha_patch(bounds%begp:bounds%endp) = 1._r8 - this%o3coefgsun_patch(bounds%begp:bounds%endp) = 1._r8 - - end subroutine CalcOzoneStress - -end module OzoneOffMod diff --git a/src/biogeophys/PhotosynthesisMod.F90 b/src/biogeophys/PhotosynthesisMod.F90 deleted file mode 100644 index e735d74ce0..0000000000 --- a/src/biogeophys/PhotosynthesisMod.F90 +++ /dev/null @@ -1,4948 +0,0 @@ -module PhotosynthesisMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Leaf photosynthesis and stomatal conductance calculation as described by - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to - ! a multi-layer canopy - ! - ! !USES: - use shr_sys_mod , only : shr_sys_flush - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use abortutils , only : endrun - use clm_varctl , only : use_c13, use_c14, use_cn, use_cndv, use_fates, use_luna, use_hydrstress - use clm_varctl , only : iulog - use clm_varpar , only : nlevcan, nvegwcs, mxpft - use clm_varcon , only : namep, c14ratio, spval - use decompMod , only : bounds_type - use QuadraticMod , only : quadratic - use pftconMod , only : pftcon - use CIsoAtmTimeseriesMod, only : C14BombSpike, use_c14_bombspike, C13TimeSeries, use_c13_timeseries, nsectors_c14 - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use WaterStateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use OzoneBaseMod , only : ozone_base_type - use LandunitType , only : lun - use PatchType , only : patch - use GridcellType , only : grc - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: Photosynthesis ! Leaf stomatal resistance and leaf photosynthesis - public :: PhotosynthesisTotal ! Determine of total photosynthesis - public :: Fractionation ! C13 fractionation during photosynthesis - ! For plant hydraulics approach - public :: PhotosynthesisHydraulicStress ! Leaf stomatal resistance and leaf photosynthesis - ! Simultaneous solution of sunlit/shaded per Pierre - ! Gentine/Daniel Kennedy plant hydraulic stress method - public :: plc ! Return value of vulnerability curve at x - - ! !PRIVATE MEMBER FUNCTIONS: - private :: hybrid ! hybrid solver for ci - private :: ci_func ! ci function - private :: brent ! brent solver for root of a single variable function - private :: ft ! photosynthesis temperature response - private :: fth ! photosynthesis temperature inhibition - private :: fth25 ! scaling factor for photosynthesis temperature inhibition - ! For plant hydraulics approach - private :: hybrid_PHS ! hybrid solver for ci - private :: ci_func_PHS ! ci function - private :: brent_PHS ! brent solver for root of a single variable function - private :: calcstress ! compute the root water stress - private :: getvegwp ! calculate vegetation water potential (sun, sha, xylem, root) - private :: getqflx ! calculate sunlit and shaded transpiration - private :: spacF ! flux divergence across each vegetation segment - private :: spacA ! the inverse Jacobian matrix relating delta(vegwp) to f, d(vegwp)=A*f - private :: d1plc ! compute 1st deriv of conductance attenuation for each segment - - ! !PRIVATE DATA: - integer, parameter, private :: leafresp_mtd_ryan1991 = 1 ! Ryan 1991 method for lmr25top - integer, parameter, private :: leafresp_mtd_atkin2015 = 2 ! Atkin 2015 method for lmr25top - integer, parameter, private :: sun=1 ! index for sunlit - integer, parameter, private :: sha=2 ! index for shaded - integer, parameter, private :: xyl=3 ! index for xylem - integer, parameter, private :: root=4 ! index for root - integer, parameter, private :: veg=0 ! index for vegetation - integer, parameter, private :: soil=1 ! index for soil - integer, parameter, private :: stomatalcond_mtd_bb1987 = 1 ! Ball-Berry 1987 method for photosynthesis - integer, parameter, private :: stomatalcond_mtd_medlyn2011 = 2 ! Medlyn 2011 method for photosynthesis - ! !PUBLIC VARIABLES: - - type :: photo_params_type - real(r8), allocatable, public :: krmax (:) - real(r8), allocatable, private :: kmax (:,:) - real(r8), allocatable, private :: psi50 (:,:) - real(r8), allocatable, private :: ck (:,:) - real(r8), allocatable, public :: psi_soil_ref (:) - real(r8), allocatable, private :: lmr_intercept_atkin(:) - contains - procedure, private :: allocParams - end type photo_params_type - ! - type(photo_params_type), public, protected :: params_inst ! params_inst is populated in readParamsMod - - type, public :: photosyns_type - - logical , pointer, private :: c3flag_patch (:) ! patch true if C3 and false if C4 - ! Plant hydraulic stress specific variables - real(r8), pointer, private :: ac_phs_patch (:,:,:) ! patch Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: aj_phs_patch (:,:,:) ! patch RuBP-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ap_phs_patch (:,:,:) ! patch product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ag_phs_patch (:,:,:) ! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: an_sun_patch (:,:) ! patch sunlit net leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: an_sha_patch (:,:) ! patch shaded net leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: vcmax_z_phs_patch (:,:,:) ! patch maximum rate of carboxylation (umol co2/m**2/s) - real(r8), pointer, private :: kp_z_phs_patch (:,:,:) ! patch initial slope of CO2 response curve (C4 plants) - real(r8), pointer, private :: tpu_z_phs_patch (:,:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s) - real(r8), pointer, private :: gs_mol_sun_patch (:,:) ! patch sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8), pointer, private :: gs_mol_sha_patch (:,:) ! patch shaded leaf stomatal conductance (umol H2O/m**2/s) - real(r8), pointer, private :: gs_mol_sun_ln_patch (:,:) ! patch sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s) - real(r8), pointer, private :: gs_mol_sha_ln_patch (:,:) ! patch shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s) - real(r8), pointer, private :: ac_patch (:,:) ! patch Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: aj_patch (:,:) ! patch RuBP-limited gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ap_patch (:,:) ! patch product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: ag_patch (:,:) ! patch co-limited gross leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: an_patch (:,:) ! patch net leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: vcmax_z_patch (:,:) ! patch maximum rate of carboxylation (umol co2/m**2/s) - real(r8), pointer, private :: cp_patch (:) ! patch CO2 compensation point (Pa) - real(r8), pointer, private :: kc_patch (:) ! patch Michaelis-Menten constant for CO2 (Pa) - real(r8), pointer, private :: ko_patch (:) ! patch Michaelis-Menten constant for O2 (Pa) - real(r8), pointer, private :: qe_patch (:) ! patch quantum efficiency, used only for C4 (mol CO2 / mol photons) - real(r8), pointer, private :: tpu_z_patch (:,:) ! patch triose phosphate utilization rate (umol CO2/m**2/s) - real(r8), pointer, private :: kp_z_patch (:,:) ! patch initial slope of CO2 response curve (C4 plants) - real(r8), pointer, private :: theta_cj_patch (:) ! patch empirical curvature parameter for ac, aj photosynthesis co-limitation - real(r8), pointer, private :: bbb_patch (:) ! patch Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - real(r8), pointer, private :: mbb_patch (:) ! patch Ball-Berry slope of conductance-photosynthesis relationship - real(r8), pointer, private :: gs_mol_patch (:,:) ! patch leaf stomatal conductance (umol H2O/m**2/s) - real(r8), pointer, private :: gb_mol_patch (:) ! patch leaf boundary layer conductance (umol H2O/m**2/s) - real(r8), pointer, private :: rh_leaf_patch (:) ! patch fractional humidity at leaf surface (dimensionless) - - real(r8), pointer, private :: alphapsnsun_patch (:) ! patch sunlit 13c fractionation ([]) - real(r8), pointer, private :: alphapsnsha_patch (:) ! patch shaded 13c fractionation ([]) - - real(r8), pointer, public :: rc13_canair_patch (:) ! patch C13O2/C12O2 in canopy air - real(r8), pointer, public :: rc13_psnsun_patch (:) ! patch C13O2/C12O2 in sunlit canopy psn flux - real(r8), pointer, public :: rc13_psnsha_patch (:) ! patch C13O2/C12O2 in shaded canopy psn flux - - real(r8), pointer, public :: psnsun_patch (:) ! patch sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, public :: psnsha_patch (:) ! patch shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, public :: c13_psnsun_patch (:) ! patch c13 sunlit leaf photosynthesis (umol 13CO2/m**2/s) - real(r8), pointer, public :: c13_psnsha_patch (:) ! patch c13 shaded leaf photosynthesis (umol 13CO2/m**2/s) - real(r8), pointer, public :: c14_psnsun_patch (:) ! patch c14 sunlit leaf photosynthesis (umol 14CO2/m**2/s) - real(r8), pointer, public :: c14_psnsha_patch (:) ! patch c14 shaded leaf photosynthesis (umol 14CO2/m**2/s) - - real(r8), pointer, private :: psnsun_z_patch (:,:) ! patch canopy layer: sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_z_patch (:,:) ! patch canopy layer: shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsun_wc_patch (:) ! patch Rubsico-limited sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_wc_patch (:) ! patch Rubsico-limited shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsun_wj_patch (:) ! patch RuBP-limited sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_wj_patch (:) ! patch RuBP-limited shaded leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsun_wp_patch (:) ! patch product-limited sunlit leaf photosynthesis (umol CO2/m**2/s) - real(r8), pointer, private :: psnsha_wp_patch (:) ! patch product-limited shaded leaf photosynthesis (umol CO2/m**2/s) - - real(r8), pointer, public :: fpsn_patch (:) ! patch photosynthesis (umol CO2/m**2 ground/s) - real(r8), pointer, private :: fpsn_wc_patch (:) ! patch Rubisco-limited photosynthesis (umol CO2/m**2 ground/s) - real(r8), pointer, private :: fpsn_wj_patch (:) ! patch RuBP-limited photosynthesis (umol CO2/m**2 ground/s) - real(r8), pointer, private :: fpsn_wp_patch (:) ! patch product-limited photosynthesis (umol CO2/m**2 ground/s) - - real(r8), pointer, public :: lnca_patch (:) ! top leaf layer leaf N concentration (gN leaf/m^2) - - real(r8), pointer, public :: lmrsun_patch (:) ! patch sunlit leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), pointer, public :: lmrsha_patch (:) ! patch shaded leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), pointer, private :: lmrsun_z_patch (:,:) ! patch canopy layer: sunlit leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), pointer, private :: lmrsha_z_patch (:,:) ! patch canopy layer: shaded leaf maintenance respiration rate (umol CO2/m**2/s) - - real(r8), pointer, public :: cisun_z_patch (:,:) ! patch intracellular sunlit leaf CO2 (Pa) - real(r8), pointer, public :: cisha_z_patch (:,:) ! patch intracellular shaded leaf CO2 (Pa) - - real(r8), pointer, private :: rssun_z_patch (:,:) ! patch canopy layer: sunlit leaf stomatal resistance (s/m) - real(r8), pointer, private :: rssha_z_patch (:,:) ! patch canopy layer: shaded leaf stomatal resistance (s/m) - real(r8), pointer, public :: rssun_patch (:) ! patch sunlit stomatal resistance (s/m) - real(r8), pointer, public :: rssha_patch (:) ! patch shaded stomatal resistance (s/m) - real(r8), pointer, public :: luvcmax25top_patch (:) ! vcmax25 ! (umol/m2/s) - real(r8), pointer, public :: lujmax25top_patch (:) ! vcmax25 (umol/m2/s) - real(r8), pointer, public :: lutpu25top_patch (:) ! vcmax25 (umol/m2/s) -!! - - - ! LUNA specific variables - real(r8), pointer, public :: vcmx25_z_patch (:,:) ! patch leaf Vc,max25 (umol CO2/m**2/s) for canopy layer - real(r8), pointer, public :: jmx25_z_patch (:,:) ! patch leaf Jmax25 (umol electron/m**2/s) for canopy layer - real(r8), pointer, public :: pnlc_z_patch (:,:) ! patch proportion of leaf nitrogen allocated for light capture for canopy layer - real(r8), pointer, public :: enzs_z_patch (:,:) ! enzyme decay status 1.0-fully active; 0-all decayed during stress - real(r8), pointer, public :: fpsn24_patch (:) ! 24 hour mean patch photosynthesis (umol CO2/m**2 ground/day) - - ! Logical switches for different options - logical, public :: rootstem_acc ! Respiratory acclimation for roots and stems - logical, private :: light_inhibit ! If light should inhibit respiration - integer, private :: leafresp_method ! leaf maintencence respiration at 25C for canopy top method to use - integer, private :: stomatalcond_mtd ! Stomatal conduction method type - logical, private :: modifyphoto_and_lmr_forcrop ! Modify photosynthesis and LMR for crop - contains - - ! Public procedures - procedure, public :: Init - procedure, public :: Restart - procedure, public :: ReadNML - procedure, public :: ReadParams - procedure, public :: TimeStepInit - procedure, public :: NewPatchInit - - ! Private procedures - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type photosyns_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%c3flag_patch (begp:endp)) ; this%c3flag_patch (:) =.false. - allocate(this%ac_phs_patch (begp:endp,2,1:nlevcan)) ; this%ac_phs_patch (:,:,:) = nan - allocate(this%aj_phs_patch (begp:endp,2,1:nlevcan)) ; this%aj_phs_patch (:,:,:) = nan - allocate(this%ap_phs_patch (begp:endp,2,1:nlevcan)) ; this%ap_phs_patch (:,:,:) = nan - allocate(this%ag_phs_patch (begp:endp,2,1:nlevcan)) ; this%ag_phs_patch (:,:,:) = nan - allocate(this%an_sun_patch (begp:endp,1:nlevcan)) ; this%an_sun_patch (:,:) = nan - allocate(this%an_sha_patch (begp:endp,1:nlevcan)) ; this%an_sha_patch (:,:) = nan - allocate(this%vcmax_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%vcmax_z_phs_patch (:,:,:) = nan - allocate(this%tpu_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%tpu_z_phs_patch (:,:,:) = nan - allocate(this%kp_z_phs_patch (begp:endp,2,1:nlevcan)) ; this%kp_z_phs_patch (:,:,:) = nan - allocate(this%gs_mol_sun_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sun_patch (:,:) = nan - allocate(this%gs_mol_sha_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sha_patch (:,:) = nan - allocate(this%gs_mol_sun_ln_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sun_ln_patch (:,:) = nan - allocate(this%gs_mol_sha_ln_patch (begp:endp,1:nlevcan)) ; this%gs_mol_sha_ln_patch (:,:) = nan - allocate(this%ac_patch (begp:endp,1:nlevcan)) ; this%ac_patch (:,:) = nan - allocate(this%aj_patch (begp:endp,1:nlevcan)) ; this%aj_patch (:,:) = nan - allocate(this%ap_patch (begp:endp,1:nlevcan)) ; this%ap_patch (:,:) = nan - allocate(this%ag_patch (begp:endp,1:nlevcan)) ; this%ag_patch (:,:) = nan - allocate(this%an_patch (begp:endp,1:nlevcan)) ; this%an_patch (:,:) = nan - allocate(this%vcmax_z_patch (begp:endp,1:nlevcan)) ; this%vcmax_z_patch (:,:) = nan - allocate(this%tpu_z_patch (begp:endp,1:nlevcan)) ; this%tpu_z_patch (:,:) = nan - allocate(this%kp_z_patch (begp:endp,1:nlevcan)) ; this%kp_z_patch (:,:) = nan - allocate(this%gs_mol_patch (begp:endp,1:nlevcan)) ; this%gs_mol_patch (:,:) = nan - allocate(this%cp_patch (begp:endp)) ; this%cp_patch (:) = nan - allocate(this%kc_patch (begp:endp)) ; this%kc_patch (:) = nan - allocate(this%ko_patch (begp:endp)) ; this%ko_patch (:) = nan - allocate(this%qe_patch (begp:endp)) ; this%qe_patch (:) = nan - allocate(this%theta_cj_patch (begp:endp)) ; this%theta_cj_patch (:) = nan - allocate(this%bbb_patch (begp:endp)) ; this%bbb_patch (:) = nan - allocate(this%mbb_patch (begp:endp)) ; this%mbb_patch (:) = nan - allocate(this%gb_mol_patch (begp:endp)) ; this%gb_mol_patch (:) = nan - allocate(this%rh_leaf_patch (begp:endp)) ; this%rh_leaf_patch (:) = nan - - allocate(this%psnsun_patch (begp:endp)) ; this%psnsun_patch (:) = nan - allocate(this%psnsha_patch (begp:endp)) ; this%psnsha_patch (:) = nan - allocate(this%c13_psnsun_patch (begp:endp)) ; this%c13_psnsun_patch (:) = nan - allocate(this%c13_psnsha_patch (begp:endp)) ; this%c13_psnsha_patch (:) = nan - allocate(this%c14_psnsun_patch (begp:endp)) ; this%c14_psnsun_patch (:) = nan - allocate(this%c14_psnsha_patch (begp:endp)) ; this%c14_psnsha_patch (:) = nan - - allocate(this%psnsun_z_patch (begp:endp,1:nlevcan)) ; this%psnsun_z_patch (:,:) = nan - allocate(this%psnsha_z_patch (begp:endp,1:nlevcan)) ; this%psnsha_z_patch (:,:) = nan - allocate(this%psnsun_wc_patch (begp:endp)) ; this%psnsun_wc_patch (:) = nan - allocate(this%psnsha_wc_patch (begp:endp)) ; this%psnsha_wc_patch (:) = nan - allocate(this%psnsun_wj_patch (begp:endp)) ; this%psnsun_wj_patch (:) = nan - allocate(this%psnsha_wj_patch (begp:endp)) ; this%psnsha_wj_patch (:) = nan - allocate(this%psnsun_wp_patch (begp:endp)) ; this%psnsun_wp_patch (:) = nan - allocate(this%psnsha_wp_patch (begp:endp)) ; this%psnsha_wp_patch (:) = nan - allocate(this%fpsn_patch (begp:endp)) ; this%fpsn_patch (:) = nan - allocate(this%fpsn_wc_patch (begp:endp)) ; this%fpsn_wc_patch (:) = nan - allocate(this%fpsn_wj_patch (begp:endp)) ; this%fpsn_wj_patch (:) = nan - allocate(this%fpsn_wp_patch (begp:endp)) ; this%fpsn_wp_patch (:) = nan - - allocate(this%lnca_patch (begp:endp)) ; this%lnca_patch (:) = nan - - allocate(this%lmrsun_z_patch (begp:endp,1:nlevcan)) ; this%lmrsun_z_patch (:,:) = nan - allocate(this%lmrsha_z_patch (begp:endp,1:nlevcan)) ; this%lmrsha_z_patch (:,:) = nan - allocate(this%lmrsun_patch (begp:endp)) ; this%lmrsun_patch (:) = nan - allocate(this%lmrsha_patch (begp:endp)) ; this%lmrsha_patch (:) = nan - - allocate(this%alphapsnsun_patch (begp:endp)) ; this%alphapsnsun_patch (:) = nan - allocate(this%alphapsnsha_patch (begp:endp)) ; this%alphapsnsha_patch (:) = nan - allocate(this%rc13_canair_patch (begp:endp)) ; this%rc13_canair_patch (:) = nan - allocate(this%rc13_psnsun_patch (begp:endp)) ; this%rc13_psnsun_patch (:) = nan - allocate(this%rc13_psnsha_patch (begp:endp)) ; this%rc13_psnsha_patch (:) = nan - - allocate(this%cisun_z_patch (begp:endp,1:nlevcan)) ; this%cisun_z_patch (:,:) = nan - allocate(this%cisha_z_patch (begp:endp,1:nlevcan)) ; this%cisha_z_patch (:,:) = nan - - allocate(this%rssun_z_patch (begp:endp,1:nlevcan)) ; this%rssun_z_patch (:,:) = nan - allocate(this%rssha_z_patch (begp:endp,1:nlevcan)) ; this%rssha_z_patch (:,:) = nan - allocate(this%rssun_patch (begp:endp)) ; this%rssun_patch (:) = nan - allocate(this%rssha_patch (begp:endp)) ; this%rssha_patch (:) = nan - allocate(this%luvcmax25top_patch(begp:endp)) ; this%luvcmax25top_patch(:) = nan - allocate(this%lujmax25top_patch (begp:endp)) ; this%lujmax25top_patch(:) = nan - allocate(this%lutpu25top_patch (begp:endp)) ; this%lutpu25top_patch(:) = nan -!! -! allocate(this%psncanopy_patch (begp:endp)) ; this%psncanopy_patch (:) = nan -! allocate(this%lmrcanopy_patch (begp:endp)) ; this%lmrcanopy_patch (:) = nan - if(use_luna)then - ! NOTE(bja, 2015-09) because these variables are only allocated - ! when luna is turned on, they can not be placed into associate - ! statements. - allocate(this%vcmx25_z_patch (begp:endp,1:nlevcan)) ; this%vcmx25_z_patch (:,:) = 30._r8 - allocate(this%jmx25_z_patch (begp:endp,1:nlevcan)) ; this%jmx25_z_patch (:,:) = 60._r8 - allocate(this%pnlc_z_patch (begp:endp,1:nlevcan)) ; this%pnlc_z_patch (:,:) = 0.01_r8 - allocate(this%fpsn24_patch (begp:endp)) ; this%fpsn24_patch (:) = nan - allocate(this%enzs_z_patch (begp:endp,1:nlevcan)) ; this%enzs_z_patch (:,:) = 1._r8 - endif - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - - this%rh_leaf_patch(begp:endp) = spval - call hist_addfld1d (fname='RH_LEAF', units='fraction', & - avgflag='A', long_name='fractional humidity at leaf surface', & - ptr_patch=this%rh_leaf_patch, set_spec=spval, default='inactive') - this%lnca_patch(begp:endp) = spval - call hist_addfld1d (fname='LNC', units='gN leaf/m^2', & - avgflag='A', long_name='leaf N concentration', & - ptr_patch=this%lnca_patch, set_spec=spval) - - ! Don't output photosynthesis variables when FATES is on as they aren't calculated - if (.not. use_fates) then - this%fpsn_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN', units='umol/m2s', & - avgflag='A', long_name='photosynthesis', & - ptr_patch=this%fpsn_patch, set_lake=0._r8, set_urb=0._r8) - - ! Don't by default output this rate limiting step as only makes sense if you are outputing - ! the others each time-step - this%fpsn_wc_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WC', units='umol/m2s', & - avgflag='I', long_name='Rubisco-limited photosynthesis', & - ptr_patch=this%fpsn_wc_patch, set_lake=0._r8, set_urb=0._r8, & - default='inactive') - - ! Don't by default output this rate limiting step as only makes sense if you are outputing - ! the others each time-step - this%fpsn_wj_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WJ', units='umol/m2s', & - avgflag='I', long_name='RuBP-limited photosynthesis', & - ptr_patch=this%fpsn_wj_patch, set_lake=0._r8, set_urb=0._r8, & - default='inactive') - - ! Don't by default output this rate limiting step as only makes sense if you are outputing - ! the others each time-step - this%fpsn_wp_patch(begp:endp) = spval - call hist_addfld1d (fname='FPSN_WP', units='umol/m2s', & - avgflag='I', long_name='Product-limited photosynthesis', & - ptr_patch=this%fpsn_wp_patch, set_lake=0._r8, set_urb=0._r8, & - default='inactive') - end if - - if (use_cn) then - this%psnsun_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='sunlit leaf photosynthesis', & - ptr_patch=this%psnsun_patch) - - this%psnsha_patch(begp:endp) = spval - call hist_addfld1d (fname='PSNSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='shaded leaf photosynthesis', & - ptr_patch=this%psnsha_patch) - end if - - if ( use_c13 ) then - this%c13_psnsun_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PSNSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='C13 sunlit leaf photosynthesis', & - ptr_patch=this%c13_psnsun_patch) - - this%c13_psnsha_patch(begp:endp) = spval - call hist_addfld1d (fname='C13_PSNSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='C13 shaded leaf photosynthesis', & - ptr_patch=this%c13_psnsha_patch) - end if - - if ( use_c14 ) then - this%c14_psnsun_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PSNSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='C14 sunlit leaf photosynthesis', & - ptr_patch=this%c14_psnsun_patch) - - this%c14_psnsha_patch(begp:endp) = spval - call hist_addfld1d (fname='C14_PSNSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='C14 shaded leaf photosynthesis', & - ptr_patch=this%c14_psnsha_patch) - end if - - if ( use_c13 ) then - this%rc13_canair_patch(begp:endp) = spval - call hist_addfld1d (fname='RC13_CANAIR', units='proportion', & - avgflag='A', long_name='C13/C(12+13) for canopy air', & - ptr_patch=this%rc13_canair_patch) - - this%rc13_psnsun_patch(begp:endp) = spval - call hist_addfld1d (fname='RC13_PSNSUN', units='proportion', & - avgflag='A', long_name='C13/C(12+13) for sunlit photosynthesis', & - ptr_patch=this%rc13_psnsun_patch) - - this%rc13_psnsha_patch(begp:endp) = spval - call hist_addfld1d (fname='RC13_PSNSHA', units='proportion', & - avgflag='A', long_name='C13/C(12+13) for shaded photosynthesis', & - ptr_patch=this%rc13_psnsha_patch) - endif - - ! Canopy physiology - - if ( use_c13 ) then - this%alphapsnsun_patch(begp:endp) = spval - call hist_addfld1d (fname='ALPHAPSNSUN', units='proportion', & - avgflag='A', long_name='sunlit c13 fractionation', & - ptr_patch=this%alphapsnsun_patch, default='inactive') - - this%alphapsnsha_patch(begp:endp) = spval - call hist_addfld1d (fname='ALPHAPSNSHA', units='proportion', & - avgflag='A', long_name='shaded c13 fractionation', & - ptr_patch=this%alphapsnsha_patch, default='inactive') - endif - - this%rssun_patch(begp:endp) = spval - call hist_addfld1d (fname='RSSUN', units='s/m', & - avgflag='M', long_name='sunlit leaf stomatal resistance', & - ptr_patch=this%rssun_patch, set_lake=spval, set_urb=spval) - - this%rssha_patch(begp:endp) = spval - call hist_addfld1d (fname='RSSHA', units='s/m', & - avgflag='M', long_name='shaded leaf stomatal resistance', & - ptr_patch=this%rssha_patch, set_lake=spval, set_urb=spval) - - this%gs_mol_sun_patch(begp:endp,:) = spval - this%gs_mol_sha_patch(begp:endp,:) = spval - if (nlevcan>1) then - call hist_addfld2d (fname='GSSUN', units='umol H20/m2/s', type2d='nlevcan', & - avgflag='A', long_name='sunlit leaf stomatal conductance', & - ptr_patch=this%gs_mol_sun_patch, set_lake=spval, set_urb=spval) - - call hist_addfld2d (fname='GSSHA', units='umol H20/m2/s', type2d='nlevcan', & - avgflag='A', long_name='shaded leaf stomatal conductance', & - ptr_patch=this%gs_mol_sha_patch, set_lake=spval, set_urb=spval) - else - ptr_1d => this%gs_mol_sun_patch(begp:endp,1) - call hist_addfld1d (fname='GSSUN', units='umol H20/m2/s', & - avgflag='A', long_name='sunlit leaf stomatal conductance', & - ptr_patch=ptr_1d) - - ptr_1d => this%gs_mol_sha_patch(begp:endp,1) - call hist_addfld1d (fname='GSSHA', units='umol H20/m2/s', & - avgflag='A', long_name='shaded leaf stomatal conductance', & - ptr_patch=ptr_1d) - - endif - this%gs_mol_sun_ln_patch(begp:endp,:) = spval - this%gs_mol_sha_ln_patch(begp:endp,:) = spval - if (nlevcan>1) then - call hist_addfld2d (fname='GSSUNLN', units='umol H20/m2/s', type2d='nlevcan', & - avgflag='A', long_name='sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', & - ptr_patch=this%gs_mol_sun_ln_patch, set_lake=spval, set_urb=spval) - - call hist_addfld2d (fname='GSSHALN', units='umol H20/m2/s', type2d='nlevcan', & - avgflag='A', long_name='shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', & - ptr_patch=this%gs_mol_sha_ln_patch, set_lake=spval, set_urb=spval) - else - ptr_1d => this%gs_mol_sun_ln_patch(begp:endp,1) - call hist_addfld1d (fname='GSSUNLN', units='umol H20/m2/s', & - avgflag='A', long_name='sunlit leaf stomatal conductance at local noon', & - ptr_patch=ptr_1d) - - ptr_1d => this%gs_mol_sha_ln_patch(begp:endp,1) - call hist_addfld1d (fname='GSSHALN', units='umol H20/m2/s', & - avgflag='A', long_name='shaded leaf stomatal conductance at local noon', & - ptr_patch=ptr_1d) - - endif - if(use_luna)then - if(nlevcan>1)then - call hist_addfld2d (fname='Vcmx25Z', units='umol/m2/s', type2d='nlevcan', & - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=this%vcmx25_z_patch) - - call hist_addfld2d (fname='Jmx25Z', units='umol/m2/s', type2d='nlevcan', & - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=this%jmx25_z_patch) - - call hist_addfld2d (fname='PNLCZ', units='unitless', type2d='nlevcan', & - avgflag='A', long_name='Proportion of nitrogen allocated for light capture', & - ptr_patch=this%pnlc_z_patch,default='inactive') - else - ptr_1d => this%vcmx25_z_patch(:,1) - call hist_addfld1d (fname='Vcmx25Z', units='umol/m2/s',& - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=ptr_1d) - ptr_1d => this%jmx25_z_patch(:,1) - call hist_addfld1d (fname='Jmx25Z', units='umol/m2/s',& - avgflag='A', long_name='canopy profile of vcmax25 predicted by LUNA model', & - ptr_patch=ptr_1d) - ptr_1d => this%pnlc_z_patch(:,1) - call hist_addfld1d (fname='PNLCZ', units='unitless', & - avgflag='A', long_name='Proportion of nitrogen allocated for light capture', & - ptr_patch=ptr_1d,default='inactive') - - this%luvcmax25top_patch(begp:endp) = spval - call hist_addfld1d (fname='VCMX25T', units='umol/m2/s', & - avgflag='M', long_name='canopy profile of vcmax25', & - ptr_patch=this%luvcmax25top_patch, set_lake=spval, set_urb=spval) - - this%lujmax25top_patch(begp:endp) = spval - call hist_addfld1d (fname='JMX25T', units='umol/m2/s', & - avgflag='M', long_name='canopy profile of jmax', & - ptr_patch=this%lujmax25top_patch, set_lake=spval, set_urb=spval) - - this%lutpu25top_patch(begp:endp) = spval - call hist_addfld1d (fname='TPU25T', units='umol/m2/s', & - avgflag='M', long_name='canopy profile of tpu', & - ptr_patch=this%lutpu25top_patch, set_lake=spval, set_urb=spval) - - endif - this%fpsn24_patch = spval - call hist_addfld1d (fname='FPSN24', units='umol CO2/m**2 ground/day',& - avgflag='A', long_name='24 hour accumulative patch photosynthesis starting from mid-night', & - ptr_patch=this%fpsn24_patch, default='inactive') - - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l ! indices - !----------------------------------------------------------------------- - - do p = bounds%begp,bounds%endp - l = patch%landunit(p) - - this%alphapsnsun_patch(p) = spval - this%alphapsnsha_patch(p) = spval - - if (lun%ifspecial(l)) then - this%psnsun_patch(p) = 0._r8 - this%psnsha_patch(p) = 0._r8 - if ( use_c13 ) then - this%c13_psnsun_patch(p) = 0._r8 - this%c13_psnsha_patch(p) = 0._r8 - endif - if ( use_c14 ) then - this%c14_psnsun_patch(p) = 0._r8 - this%c14_psnsha_patch(p) = 0._r8 - endif - end if - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine allocParams ( this ) - ! - implicit none - - ! !ARGUMENTS: - class(photo_params_type) :: this - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'allocParams' - !----------------------------------------------------------------------- - - ! allocate parameters - - allocate( this%krmax (0:mxpft) ) ; this%krmax(:) = nan - allocate( this%kmax (0:mxpft,nvegwcs) ) ; this%kmax(:,:) = nan - allocate( this%psi50 (0:mxpft,nvegwcs) ) ; this%psi50(:,:) = nan - allocate( this%ck (0:mxpft,nvegwcs) ) ; this%ck(:,:) = nan - allocate( this%psi_soil_ref(0:mxpft) ) ; this%psi_soil_ref(:) = nan - - if ( use_hydrstress .and. nvegwcs /= 4 )then - call endrun(msg='Error:: the Plant Hydraulics Stress methodology is for the spacA function is hardcoded for nvegwcs==4' & - //errMsg(__FILE__, __LINE__)) - end if - - end subroutine allocParams - - !----------------------------------------------------------------------- - subroutine readParams ( this, ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - implicit none - - ! !ARGUMENTS: - class(photosyns_type) :: this - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'readParams' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: temp1d(0:mxpft) ! temporary to read in parameter - real(r8) :: temp2d(0:mxpft,nvegwcs) ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! read in parameters - - - call params_inst%allocParams() - - tString = "krmax" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%krmax=temp1d - tString = "psi_soil_ref" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%psi_soil_ref=temp1d - tString = "lmr_intercept_atkin" - call ncd_io(varname=trim(tString),data=temp1d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%lmr_intercept_atkin=temp1d - tString = "kmax" - call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%kmax=temp2d - tString = "psi50" - call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%psi50=temp2d - tString = "ck" - call ncd_io(varname=trim(tString),data=temp2d, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%ck=temp2d - - end subroutine readParams - - - !------------------------------------------------------------------------ - subroutine ReadNML(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the namelist for Photosynthesis - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'Photosyn::ReadNML' - character(len=*), parameter :: nmlname = 'photosyns_inparm' - logical :: rootstem_acc = .false. ! Respiratory acclimation for roots and stems - logical :: light_inhibit = .false. ! If light should inhibit respiration - integer :: leafresp_method = leafresp_mtd_ryan1991 ! leaf maintencence respiration at 25C for canopy top method to use - logical :: modifyphoto_and_lmr_forcrop = .false. ! Modify photosynthesis and LMR for crop - character(len=50) :: stomatalcond_method = 'Ball-Berry1987' ! Photosynthesis method string - !----------------------------------------------------------------------- - - namelist /photosyns_inparm/ leafresp_method, light_inhibit, & - rootstem_acc, stomatalcond_method, modifyphoto_and_lmr_forcrop - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=photosyns_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - this%rootstem_acc = rootstem_acc - this%leafresp_method = leafresp_method - this%light_inhibit = light_inhibit - this%modifyphoto_and_lmr_forcrop = modifyphoto_and_lmr_forcrop - if ( trim(stomatalcond_method) == 'Ball-Berry1987' ) then - this%stomatalcond_mtd = stomatalcond_mtd_bb1987 - else if ( trim(stomatalcond_method) == 'Medlyn2011' ) then - this%stomatalcond_mtd = stomatalcond_mtd_medlyn2011 - else - call endrun(msg="ERROR bad value for stomtalcond_method in "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - end if - - call shr_mpi_bcast (this%rootstem_acc , mpicom) - call shr_mpi_bcast (this%leafresp_method, mpicom) - call shr_mpi_bcast (this%light_inhibit , mpicom) - call shr_mpi_bcast (this%stomatalcond_mtd, mpicom) - call shr_mpi_bcast (this%modifyphoto_and_lmr_forcrop, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=photosyns_inparm) - write(iulog,*) ' ' - end if - - end subroutine ReadNML - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - if ( use_c13 ) then - call restartvar(ncid=ncid, flag=flag, varname='rc13_canair', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%rc13_canair_patch) - - call restartvar(ncid=ncid, flag=flag, varname='rc13_psnsun', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%rc13_psnsun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='rc13_psnsha', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%rc13_psnsha_patch) - endif - - call restartvar(ncid=ncid, flag=flag, varname='GSSUN', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='sunlit leaf stomatal conductance', units='umol H20/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sun_patch) - - call restartvar(ncid=ncid, flag=flag, varname='GSSHA', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='shaded leaf stomatal conductance', units='umol H20/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sha_patch) - - call restartvar(ncid=ncid, flag=flag, varname='GSSUNLN', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', & - units='umol H20/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sun_ln_patch) - - call restartvar(ncid=ncid, flag=flag, varname='GSSHALN', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon', & - units='umol H20/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%gs_mol_sha_ln_patch) - - call restartvar(ncid=ncid, flag=flag, varname='lnca', xtype=ncd_double, & - dim1name='pft', long_name='leaf N concentration', units='gN leaf/m^2', & - interpinic_flag='interp', readvar=readvar, data=this%lnca_patch) - - if(use_luna) then - call restartvar(ncid=ncid, flag=flag, varname='vcmx25_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & - interpinic_flag='interp', readvar=readvar, data=this%vcmx25_z_patch) - call restartvar(ncid=ncid, flag=flag, varname='jmx25_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum carboxylation rate at 25 celcius for canopy layers', units='umol CO2/m**2/s', & - interpinic_flag='interp', readvar=readvar, data=this%jmx25_z_patch) - call restartvar(ncid=ncid, flag=flag, varname='pnlc_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='proportion of leaf nitrogen allocated for light capture', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%pnlc_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='enzs_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='enzyme decay status during stress: 1.0-fully active; 0.0-all decayed', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%enzs_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='gpp24', xtype=ncd_double, & - dim1name='pft', long_name='accumulative gross primary production', units='umol CO2/m**2 ground/day', & - interpinic_flag='interp', readvar=readvar, data=this%fpsn24_patch) - endif - call restartvar(ncid=ncid, flag=flag, varname='vcmx25t', xtype=ncd_double, & - dim1name='pft', long_name='canopy profile of vcmax25', & - units='umol/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%luvcmax25top_patch) - - call restartvar(ncid=ncid, flag=flag, varname='jmx25t', xtype=ncd_double, & - dim1name='pft', long_name='canopy profile of jmax', & - units='umol/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%lujmax25top_patch) - - call restartvar(ncid=ncid, flag=flag, varname='tpu25t', xtype=ncd_double, & - dim1name='pft', long_name='canopy profile of tpu', & - units='umol/m2/s', & - interpinic_flag='interp', readvar=readvar, data=this%lutpu25top_patch) - - end subroutine Restart - - !------------------------------------------------------------------------------ - subroutine TimeStepInit (this, bounds) - ! - ! Time step initialization - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop, istice_mec, istwet - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l ! indices - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - if (.not. lun%lakpoi(l)) then - this%psnsun_patch(p) = 0._r8 - this%psnsun_wc_patch(p) = 0._r8 - this%psnsun_wj_patch(p) = 0._r8 - this%psnsun_wp_patch(p) = 0._r8 - - this%psnsha_patch(p) = 0._r8 - this%psnsha_wc_patch(p) = 0._r8 - this%psnsha_wj_patch(p) = 0._r8 - this%psnsha_wp_patch(p) = 0._r8 - - this%fpsn_patch(p) = 0._r8 - this%fpsn_wc_patch(p) = 0._r8 - this%fpsn_wj_patch(p) = 0._r8 - this%fpsn_wp_patch(p) = 0._r8 - - if ( use_c13 ) then - this%alphapsnsun_patch(p) = 0._r8 - this%alphapsnsha_patch(p) = 0._r8 - this%c13_psnsun_patch(p) = 0._r8 - this%c13_psnsha_patch(p) = 0._r8 - endif - if ( use_c14 ) then - this%c14_psnsun_patch(p) = 0._r8 - this%c14_psnsha_patch(p) = 0._r8 - endif - end if - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop & - .or. lun%itype(l) == istice_mec & - .or. lun%itype(l) == istwet) then - if (use_c13) then - this%rc13_canair_patch(p) = 0._r8 - this%rc13_psnsun_patch(p) = 0._r8 - this%rc13_psnsha_patch(p) = 0._r8 - end if - end if - end do - - end subroutine TimeStepInit - - !------------------------------------------------------------------------------ - subroutine NewPatchInit (this, p) - ! - ! For new run-time pft, modify state and flux variables to maintain - ! carbon and nitrogen balance with dynamic pft-weights. - ! Called from dyn_cnbal_patch - ! - ! !ARGUMENTS: - class(photosyns_type) :: this - integer, intent(in) :: p - !----------------------------------------------------------------------- - - if ( use_c13 ) then - this%alphapsnsun_patch(p) = 0._r8 - this%alphapsnsha_patch(p) = 0._r8 - this%rc13_canair_patch(p) = 0._r8 - this%rc13_psnsun_patch(p) = 0._r8 - this%rc13_psnsha_patch(p) = 0._r8 - endif - - this%psnsun_patch(p) = 0._r8 - this%psnsha_patch(p) = 0._r8 - - if (use_c13) then - this%c13_psnsun_patch(p) = 0._r8 - this%c13_psnsha_patch(p) = 0._r8 - end if - if ( use_c14 ) then - this%c14_psnsun_patch(p) = 0._r8 - this%c14_psnsha_patch(p) = 0._r8 - end if - - end subroutine NewPatchInit - - !------------------------------------------------------------------------------ - !------------------------------------------------------------------------------ - subroutine Photosynthesis ( bounds, fn, filterp, & - esat_tv, eair, oair, cair, rb, btran, & - dayl_factor, leafn, & - atm2lnd_inst, temperature_inst, surfalb_inst, solarabs_inst, & - canopystate_inst, ozone_inst, photosyns_inst, phase) - ! - ! !DESCRIPTION: - ! Leaf photosynthesis and stomatal conductance calculation as described by - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to - ! a multi-layer canopy - ! - ! !USES: - use clm_varcon , only : rgas, tfrz, spval, degpsec, isecspday - use GridcellType , only : grc - use clm_time_manager , only : get_curr_date, get_step_size - use clm_varctl , only : cnallocate_carbon_only - use clm_varctl , only : lnc_opt, reduce_dayl_factor, vcmax_opt - use pftconMod , only : nbrdlf_dcd_tmp_shrub, npcropmin - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! patch filter - real(r8) , intent(in) :: esat_tv( bounds%begp: ) ! saturation vapor pressure at t_veg (Pa) [pft] - real(r8) , intent(in) :: eair( bounds%begp: ) ! vapor pressure of canopy air (Pa) [pft] - real(r8) , intent(in) :: oair( bounds%begp: ) ! Atmospheric O2 partial pressure (Pa) [pft] - real(r8) , intent(in) :: cair( bounds%begp: ) ! Atmospheric CO2 partial pressure (Pa) [pft] - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) [pft] - real(r8) , intent(in) :: btran( bounds%begp: ) ! transpiration wetness factor (0 to 1) [pft] - real(r8) , intent(in) :: dayl_factor( bounds%begp: ) ! scalar (0-1) for daylength - real(r8) , intent(in) :: leafn( bounds%begp: ) ! leaf N (gN/m2) - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(temperature_type) , intent(in) :: temperature_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(canopystate_type) , intent(in) :: canopystate_inst - class(ozone_base_type) , intent(in) :: ozone_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - character(len=*) , intent(in) :: phase ! 'sun' or 'sha' - - ! - ! !LOCAL VARIABLES: - ! - ! Leaf photosynthesis parameters - real(r8) :: jmax_z(bounds%begp:bounds%endp,nlevcan) ! maximum electron transport rate (umol electrons/m**2/s) - !real(r8) :: lnc(bounds%begp:bounds%endp) ! leaf N concentration (gN leaf/m^2) - real(r8) :: bbbopt(bounds%begp:bounds%endp)! Ball-Berry minimum leaf conductance, unstressed (umol H2O/m**2/s) - real(r8) :: kn(bounds%begp:bounds%endp) ! leaf nitrogen decay coefficient - real(r8) :: vcmax25top ! canopy top: maximum rate of carboxylation at 25C (umol CO2/m**2/s) - real(r8) :: jmax25top ! canopy top: maximum electron transport rate at 25C (umol electrons/m**2/s) - real(r8) :: tpu25top ! canopy top: triose phosphate utilization rate at 25C (umol CO2/m**2/s) - real(r8) :: lmr25top ! canopy top: leaf maintenance respiration rate at 25C (umol CO2/m**2/s) - real(r8) :: kp25top ! canopy top: initial slope of CO2 response curve (C4 plants) at 25C - - real(r8) :: vcmax25 ! leaf layer: maximum rate of carboxylation at 25C (umol CO2/m**2/s) - real(r8) :: jmax25 ! leaf layer: maximum electron transport rate at 25C (umol electrons/m**2/s) - real(r8) :: tpu25 ! leaf layer: triose phosphate utilization rate at 25C (umol CO2/m**2/s) - real(r8) :: lmr25 ! leaf layer: leaf maintenance respiration rate at 25C (umol CO2/m**2/s) - real(r8) :: kp25 ! leaf layer: Initial slope of CO2 response curve (C4 plants) at 25C - real(r8) :: kc25 ! Michaelis-Menten constant for CO2 at 25C (Pa) - real(r8) :: ko25 ! Michaelis-Menten constant for O2 at 25C (Pa) - real(r8) :: cp25 ! CO2 compensation point at 25C (Pa) - - real(r8) :: vcmaxha ! activation energy for vcmax (J/mol) - real(r8) :: jmaxha ! activation energy for jmax (J/mol) - real(r8) :: tpuha ! activation energy for tpu (J/mol) - real(r8) :: lmrha ! activation energy for lmr (J/mol) - real(r8) :: kcha ! activation energy for kc (J/mol) - real(r8) :: koha ! activation energy for ko (J/mol) - real(r8) :: cpha ! activation energy for cp (J/mol) - - real(r8) :: vcmaxhd ! deactivation energy for vcmax (J/mol) - real(r8) :: jmaxhd ! deactivation energy for jmax (J/mol) - real(r8) :: tpuhd ! deactivation energy for tpu (J/mol) - real(r8) :: lmrhd ! deactivation energy for lmr (J/mol) - - real(r8) :: vcmaxse ! entropy term for vcmax (J/mol/K) - real(r8) :: jmaxse ! entropy term for jmax (J/mol/K) - real(r8) :: tpuse ! entropy term for tpu (J/mol/K) - real(r8) :: lmrse ! entropy term for lmr (J/mol/K) - - real(r8) :: vcmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: jmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: tpuc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: lmrc ! scaling factor for high temperature inhibition (25 C = 1.0) - - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation - - ! Other - integer :: f,p,c,iv ! indices - real(r8) :: cf ! s m**2/umol -> s/m - real(r8) :: rsmax0 ! maximum stomatal resistance [s/m] - real(r8) :: gb ! leaf boundary layer conductance (m/s) - real(r8) :: cs ! CO2 partial pressure at leaf surface (Pa) - real(r8) :: gs ! leaf stomatal conductance (m/s) - real(r8) :: hs ! fractional humidity at leaf surface (dimensionless) - real(r8) :: sco ! relative specificity of rubisco - real(r8) :: ft ! photosynthesis temperature response (statement function) - real(r8) :: fth ! photosynthesis temperature inhibition (statement function) - real(r8) :: fth25 ! ccaling factor for photosynthesis temperature inhibition (statement function) - real(r8) :: tl ! leaf temperature in photosynthesis temperature function (K) - real(r8) :: ha ! activation energy in photosynthesis temperature function (J/mol) - real(r8) :: hd ! deactivation energy in photosynthesis temperature function (J/mol) - real(r8) :: se ! entropy term in photosynthesis temperature function (J/mol/K) - real(r8) :: scaleFactor ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: ciold ! previous value of Ci for convergence check - real(r8) :: gs_mol_err ! gs_mol for error check - real(r8) :: je ! electron transport rate (umol electrons/m**2/s) - real(r8) :: qabs ! PAR absorbed by PS II (umol photons/m**2/s) - real(r8) :: aquad,bquad,cquad ! terms for quadratic equations - real(r8) :: r1,r2 ! roots of quadratic equation - real(r8) :: ceair ! vapor pressure of air, constrained (Pa) - real(r8) :: fnr ! (gRubisco/gN in Rubisco) - real(r8) :: act25 ! (umol/mgRubisco/min) Rubisco activity at 25 C - integer :: niter ! iteration loop index - real(r8) :: nscaler ! leaf nitrogen scaling coefficient - - real(r8) :: ai ! intermediate co-limited photosynthesis (umol CO2/m**2/s) - - real(r8) :: psn_wc_z(bounds%begp:bounds%endp,nlevcan) ! Rubisco-limited contribution to psn_z (umol CO2/m**2/s) - real(r8) :: psn_wj_z(bounds%begp:bounds%endp,nlevcan) ! RuBP-limited contribution to psn_z (umol CO2/m**2/s) - real(r8) :: psn_wp_z(bounds%begp:bounds%endp,nlevcan) ! product-limited contribution to psn_z (umol CO2/m**2/s) - - real(r8) :: psncan ! canopy sum of psn_z - real(r8) :: psncan_wc ! canopy sum of psn_wc_z - real(r8) :: psncan_wj ! canopy sum of psn_wj_z - real(r8) :: psncan_wp ! canopy sum of psn_wp_z - real(r8) :: lmrcan ! canopy sum of lmr_z - real(r8) :: gscan ! canopy sum of leaf conductance - real(r8) :: laican ! canopy sum of lai_z - real(r8) :: rh_can - real(r8) , pointer :: lai_z (:,:) - real(r8) , pointer :: par_z (:,:) - real(r8) , pointer :: vcmaxcint (:) - real(r8) , pointer :: alphapsn (:) - real(r8) , pointer :: psn (:) - real(r8) , pointer :: psn_wc (:) - real(r8) , pointer :: psn_wj (:) - real(r8) , pointer :: psn_wp (:) - real(r8) , pointer :: psn_z (:,:) - real(r8) , pointer :: lmr (:) - real(r8) , pointer :: lmr_z (:,:) - real(r8) , pointer :: rs (:) - real(r8) , pointer :: rs_z (:,:) - real(r8) , pointer :: ci_z (:,:) - real(r8) , pointer :: o3coefv (:) ! o3 coefficient used in photo calculation - real(r8) , pointer :: o3coefg (:) ! o3 coefficient used in rs calculation - real(r8) , pointer :: alphapsnsun (:) - real(r8) , pointer :: alphapsnsha (:) - - real(r8) :: sum_nscaler - real(r8) :: total_lai - integer :: nptreemax - - integer :: local_secp1 ! seconds into current date in local time - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day,secs ! calendar info for current time step - integer :: g ! index - integer, parameter :: noonsec = isecspday / 2 ! seconds at local noon - !------------------------------------------------------------------------------ - - ! Temperature and soil water response functions - - ft(tl,ha) = exp( ha / (rgas*1.e-3_r8*(tfrz+25._r8)) * (1._r8 - (tfrz+25._r8)/tl) ) - fth(tl,hd,se,scaleFactor) = scaleFactor / ( 1._r8 + exp( (-hd+se*tl) / (rgas*1.e-3_r8*tl) ) ) - fth25(hd,se) = 1._r8 + exp( (-hd+se*(tfrz+25._r8)) / (rgas*1.e-3_r8*(tfrz+25._r8)) ) - - ! Enforce expected array sizes - - SHR_ASSERT_ALL((ubound(esat_tv) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eair) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(oair) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cair) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rb) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(btran) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dayl_factor) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(leafn) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - c3psn => pftcon%c3psn , & ! Input: photosynthetic pathway: 0. = c4, 1. = c3 - crop => pftcon%crop , & ! Input: crop or not (0 =not crop and 1 = crop) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - flnr => pftcon%flnr , & ! Input: fraction of leaf N in the Rubisco enzyme (gN Rubisco / gN leaf) - fnitr => pftcon%fnitr , & ! Input: foliage nitrogen limitation factor (-) - slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis [m^2/gC] - dsladlai => pftcon%dsladlai , & ! Input: change in sla per unit lai - i_vcad => pftcon%i_vcad , & ! Input: [real(r8) (:) ] - s_vcad => pftcon%s_vcad , & ! Input: [real(r8) (:) ] - i_flnr => pftcon%i_flnr , & ! Input: [real(r8) (:) ] - s_flnr => pftcon%s_flnr , & ! Input: [real(r8) (:) ] - mbbopt => pftcon%mbbopt , & ! Input: [real(r8) (:) ] Ball-Berry slope of conduct/photosyn (umol H2O/umol CO2) - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - - t_veg => temperature_inst%t_veg_patch , & ! Input: [real(r8) (:) ] vegetation temperature (Kelvin) - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - tgcm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] air temperature at agcm reference height (kelvin) - - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer - tlai_z => surfalb_inst%tlai_z_patch , & ! Input: [real(r8) (:,:) ] pft total leaf area index for canopy layer - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8)(:) ] one-sided leaf area index, no burying by snow - c3flag => photosyns_inst%c3flag_patch , & ! Output: [logical (:) ] true if C3 and false if C4 - ac => photosyns_inst%ac_patch , & ! Output: [real(r8) (:,:) ] Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - aj => photosyns_inst%aj_patch , & ! Output: [real(r8) (:,:) ] RuBP-limited gross photosynthesis (umol CO2/m**2/s) - ap => photosyns_inst%ap_patch , & ! Output: [real(r8) (:,:) ] product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - ag => photosyns_inst%ag_patch , & ! Output: [real(r8) (:,:) ] co-limited gross leaf photosynthesis (umol CO2/m**2/s) - an => photosyns_inst%an_patch , & ! Output: [real(r8) (:,:) ] net leaf photosynthesis (umol CO2/m**2/s) - gb_mol => photosyns_inst%gb_mol_patch , & ! Output: [real(r8) (:) ] leaf boundary layer conductance (umol H2O/m**2/s) - gs_mol => photosyns_inst%gs_mol_patch , & ! Output: [real(r8) (:,:) ] leaf stomatal conductance (umol H2O/m**2/s) - gs_mol_sun_ln => photosyns_inst%gs_mol_sun_ln_patch , & ! Output: [real(r8) (:,:) ] sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s) - gs_mol_sha_ln => photosyns_inst%gs_mol_sha_ln_patch , & ! Output: [real(r8) (:,:) ] shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s) - vcmax_z => photosyns_inst%vcmax_z_patch , & ! Output: [real(r8) (:,:) ] maximum rate of carboxylation (umol co2/m**2/s) - cp => photosyns_inst%cp_patch , & ! Output: [real(r8) (:) ] CO2 compensation point (Pa) - kc => photosyns_inst%kc_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for CO2 (Pa) - ko => photosyns_inst%ko_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for O2 (Pa) - qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) - tpu_z => photosyns_inst%tpu_z_patch , & ! Output: [real(r8) (:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) - kp_z => photosyns_inst%kp_z_patch , & ! Output: [real(r8) (:,:) ] initial slope of CO2 response curve (C4 plants) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation - bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship - rh_leaf => photosyns_inst%rh_leaf_patch , & ! Output: [real(r8) (:) ] fractional humidity at leaf surface (dimensionless) - lnc => photosyns_inst%lnca_patch , & ! Output: [real(r8) (:) ] top leaf layer leaf N concentration (gN leaf/m^2) - light_inhibit=> photosyns_inst%light_inhibit , & ! Input: [logical ] flag if light should inhibit respiration - leafresp_method=> photosyns_inst%leafresp_method , & ! Input: [integer ] method type to use for leaf-maint.-respiration at 25C canopy top - stomatalcond_mtd=> photosyns_inst%stomatalcond_mtd , & ! Input: [integer ] method type to use for stomatal conductance.GC.fnlprmsn15_r22845 - leaf_mr_vcm => canopystate_inst%leaf_mr_vcm & ! Input: [real(r8) ] scalar constant of leaf respiration with Vcmax - ) - - if (phase == 'sun') then - par_z => solarabs_inst%parsun_z_patch ! Input: [real(r8) (:,:) ] par absorbed per unit lai for canopy layer (w/m**2) - lai_z => canopystate_inst%laisun_z_patch ! Input: [real(r8) (:,:) ] leaf area index for canopy layer, sunlit or shaded - vcmaxcint => surfalb_inst%vcmaxcintsun_patch ! Input: [real(r8) (:) ] leaf to canopy scaling coefficient - alphapsn => photosyns_inst%alphapsnsun_patch ! Input: [real(r8) (:) ] 13C fractionation factor for PSN () - o3coefv => ozone_inst%o3coefvsun_patch ! Input: [real(r8) (:) ] O3 coefficient used in photosynthesis calculation - o3coefg => ozone_inst%o3coefgsun_patch ! Input: [real(r8) (:) ] O3 coefficient used in rs calculation - ci_z => photosyns_inst%cisun_z_patch ! Output: [real(r8) (:,:) ] intracellular leaf CO2 (Pa) - rs => photosyns_inst%rssun_patch ! Output: [real(r8) (:) ] leaf stomatal resistance (s/m) - rs_z => photosyns_inst%rssun_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf stomatal resistance (s/m) - lmr => photosyns_inst%lmrsun_patch ! Output: [real(r8) (:) ] leaf maintenance respiration rate (umol CO2/m**2/s) - lmr_z => photosyns_inst%lmrsun_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - psn => photosyns_inst%psnsun_patch ! Output: [real(r8) (:) ] foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_z => photosyns_inst%psnsun_z_patch ! Output: [real(r8) (:,:) ] canopy layer: foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wc => photosyns_inst%psnsun_wc_patch ! Output: [real(r8) (:) ] Rubisco-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wj => photosyns_inst%psnsun_wj_patch ! Output: [real(r8) (:) ] RuBP-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wp => photosyns_inst%psnsun_wp_patch ! Output: [real(r8) (:) ] product-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - else if (phase == 'sha') then - par_z => solarabs_inst%parsha_z_patch ! Input: [real(r8) (:,:) ] par absorbed per unit lai for canopy layer (w/m**2) - lai_z => canopystate_inst%laisha_z_patch ! Input: [real(r8) (:,:) ] leaf area index for canopy layer, sunlit or shaded - vcmaxcint => surfalb_inst%vcmaxcintsha_patch ! Input: [real(r8) (:) ] leaf to canopy scaling coefficient - alphapsn => photosyns_inst%alphapsnsha_patch ! Input: [real(r8) (:) ] 13C fractionation factor for PSN () - o3coefv => ozone_inst%o3coefvsha_patch ! Input: [real(r8) (:) ] O3 coefficient used in photosynthesis calculation - o3coefg => ozone_inst%o3coefgsha_patch ! Input: [real(r8) (:) ] O3 coefficient used in rs calculation - ci_z => photosyns_inst%cisha_z_patch ! Output: [real(r8) (:,:) ] intracellular leaf CO2 (Pa) - rs => photosyns_inst%rssha_patch ! Output: [real(r8) (:) ] leaf stomatal resistance (s/m) - rs_z => photosyns_inst%rssha_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf stomatal resistance (s/m) - lmr => photosyns_inst%lmrsha_patch ! Output: [real(r8) (:) ] leaf maintenance respiration rate (umol CO2/m**2/s) - lmr_z => photosyns_inst%lmrsha_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - psn => photosyns_inst%psnsha_patch ! Output: [real(r8) (:) ] foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_z => photosyns_inst%psnsha_z_patch ! Output: [real(r8) (:,:) ] canopy layer: foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wc => photosyns_inst%psnsha_wc_patch ! Output: [real(r8) (:) ] Rubisco-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wj => photosyns_inst%psnsha_wj_patch ! Output: [real(r8) (:) ] RuBP-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wp => photosyns_inst%psnsha_wp_patch ! Output: [real(r8) (:) ] product-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - end if - - !==============================================================================! - ! Photosynthesis and stomatal conductance parameters, from: - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - !==============================================================================! - - ! Determine seconds of current time step - - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! vcmax25 parameters, from CN - - fnr = 7.16_r8 - act25 = 3.6_r8 !umol/mgRubisco/min - ! Convert rubisco activity units from umol/mgRubisco/min -> umol/gRubisco/s - act25 = act25 * 1000.0_r8 / 60.0_r8 - - ! Activation energy, from: - ! Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - ! Bernacchi et al (2003) Plant, Cell and Environment 26:1419-1430 - ! except TPU from: Harley et al (1992) Plant, Cell and Environment 15:271-282 - - kcha = 79430._r8 - koha = 36380._r8 - cpha = 37830._r8 - vcmaxha = 72000._r8 - jmaxha = 50000._r8 - tpuha = 72000._r8 - lmrha = 46390._r8 - - ! High temperature deactivation, from: - ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 - ! The factor "c" scales the deactivation to a value of 1.0 at 25C - - vcmaxhd = 200000._r8 - jmaxhd = 200000._r8 - tpuhd = 200000._r8 - lmrhd = 150650._r8 - lmrse = 490._r8 - lmrc = fth25 (lmrhd, lmrse) - - ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - ! C3 or C4 photosynthesis logical variable - - if (nint(c3psn(patch%itype(p))) == 1) then - c3flag(p) = .true. - else if (nint(c3psn(patch%itype(p))) == 0) then - c3flag(p) = .false. - end if - - ! C3 and C4 dependent parameters - - if (c3flag(p)) then - qe(p) = 0._r8 - theta_cj(p) = 0.98_r8 - bbbopt(p) = 10000._r8 - else - qe(p) = 0.05_r8 - theta_cj(p) = 0.80_r8 - bbbopt(p) = 40000._r8 - end if - - ! Soil water stress applied to Ball-Berry parameters - - bbb(p) = max (bbbopt(p)*btran(p), 1._r8) - mbb(p) = mbbopt(patch%itype(p)) - - ! kc, ko, cp, from: Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - ! - ! kc25 = 404.9 umol/mol - ! ko25 = 278.4 mmol/mol - ! cp25 = 42.75 umol/mol - ! - ! Derive sco from cp and O2 using present-day O2 (0.209 mol/mol) and re-calculate - ! cp to account for variation in O2 using cp = 0.5 O2 / sco - ! - - kc25 = (404.9_r8 / 1.e06_r8) * forc_pbot(c) - ko25 = (278.4_r8 / 1.e03_r8) * forc_pbot(c) - sco = 0.5_r8 * 0.209_r8 / (42.75_r8 / 1.e06_r8) - cp25 = 0.5_r8 * oair(p) / sco - - kc(p) = kc25 * ft(t_veg(p), kcha) - ko(p) = ko25 * ft(t_veg(p), koha) - cp(p) = cp25 * ft(t_veg(p), cpha) - - end do - - ! Multi-layer parameters scaled by leaf nitrogen profile. - ! Loop through each canopy layer to calculate nitrogen profile using - ! cumulative lai at the midpoint of the layer - - do f = 1, fn - p = filterp(f) - - if (lnc_opt .eqv. .false.) then - ! Leaf nitrogen concentration at the top of the canopy (g N leaf / m**2 leaf) - - if ( (slatop(patch%itype(p)) *leafcn(patch%itype(p))) .le. 0.0_r8)then - call endrun( "ERROR: slatop or leafcn is zero" ) - end if - lnc(p) = 1._r8 / (slatop(patch%itype(p)) * leafcn(patch%itype(p))) - end if - - ! Using the actual nitrogen allocated to the leaf after - ! uptake rather than fixing leaf nitrogen based on SLA and CN - ! ratio - if (lnc_opt .eqv. .true.) then - ! nlevcan and nrad(p) look like the same variable ?? check this later - sum_nscaler = 0.0_r8 - laican = 0.0_r8 - total_lai = 0.0_r8 - - do iv = 1, nrad(p) - - if (iv == 1) then - laican = 0.5_r8 * tlai_z(p,iv) - total_lai = tlai_z(p,iv) - else - laican = laican + 0.5_r8 * (tlai_z(p,iv-1)+tlai_z(p,iv)) - total_lai = total_lai + tlai_z(p,iv) - end if - - ! Scale for leaf nitrogen profile. If multi-layer code, use explicit - ! profile. If sun/shade big leaf code, use canopy integrated factor. - if (nlevcan == 1) then - nscaler = 1.0_r8 - else if (nlevcan > 1) then - nscaler = exp(-kn(p) * laican) - end if - - sum_nscaler = sum_nscaler + nscaler - - end do - - if (tlai(p) > 0.0_r8 .AND. sum_nscaler > 0.0_r8) then - ! dividing by LAI to convert total leaf nitrogen - ! from m2 ground to m2 leaf; dividing by sum_nscaler to - ! convert total leaf N to leaf N at canopy top - lnc(p) = leafn(p) / (tlai(p) * sum_nscaler) - else - lnc(p) = 0.0_r8 - end if - - end if - - - ! reduce_dayl_factor .eqv. .false. - if (reduce_dayl_factor .eqv. .true.) then - if (dayl_factor(p) > 0.25_r8) then - ! dayl_factor(p) = 1.0_r8 - end if - end if - - - ! Default - if (vcmax_opt == 0) then - ! vcmax25 at canopy top, as in CN but using lnc at top of the canopy - vcmax25top = lnc(p) * flnr(patch%itype(p)) * fnr * act25 * dayl_factor(p) - if (.not. use_cn) then - vcmax25top = vcmax25top * fnitr(patch%itype(p)) - else - if ( CNAllocate_Carbon_only() ) vcmax25top = vcmax25top * fnitr(patch%itype(p)) - end if - else if (vcmax_opt == 3) then - vcmax25top = ( i_vcad(patch%itype(p)) + s_vcad(patch%itype(p)) * lnc(p) ) * dayl_factor(p) - else if (vcmax_opt == 4) then - nptreemax = 9 ! is this number correct? check later - if (patch%itype(p) >= nptreemax) then ! if not tree - ! for shrubs and herbs - vcmax25top = lnc(p) * ( i_flnr(patch%itype(p)) + s_flnr(patch%itype(p)) * lnc(p) ) * fnr * act25 * & - dayl_factor(p) - else - ! if tree - vcmax25top = lnc(p) * ( i_flnr(patch%itype(p)) * exp(s_flnr(patch%itype(p)) * lnc(p)) ) * fnr * act25 * & - dayl_factor(p) - ! for trees - end if - end if - - - ! Parameters derived from vcmax25top. Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - ! used jmax25 = 1.97 vcmax25, from Wullschleger (1993) Journal of Experimental Botany 44:907-920. - - jmax25top = (2.59_r8 - 0.035_r8*min(max((t10(p)-tfrz),11._r8),35._r8)) * vcmax25top - tpu25top = 0.167_r8 * vcmax25top - kp25top = 20000._r8 * vcmax25top - - ! Nitrogen scaling factor. Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 used - ! kn = 0.11. Here, derive kn from vcmax25 as in Lloyd et al (2010) Biogeosciences, 7, 1833-1859 - ! Remove daylength factor from vcmax25 so that kn is based on maximum vcmax25 - ! But not used as defined here if using sun/shade big leaf code. Instead, - ! will use canopy integrated scaling factors from SurfaceAlbedo. - - if (dayl_factor(p) < 1.0e-12_r8) then - kn(p) = 0._r8 - else - kn(p) = exp(0.00963_r8 * vcmax25top/dayl_factor(p) - 2.43_r8) - end if - - if (use_cn) then - if ( leafresp_method == leafresp_mtd_ryan1991 ) then - ! Leaf maintenance respiration to match the base rate used in CN - ! but with the new temperature functions for C3 and C4 plants. - ! - ! Base rate for maintenance respiration is from: - ! M. Ryan, 1991. Effects of climate change on plant respiration. - ! Ecological Applications, 1(2), 157-167. - ! Original expression is br = 0.0106 molC/(molN h) - ! Conversion by molecular weights of C and N gives 2.525e-6 gC/(gN s) - ! - ! Base rate is at 20C. Adjust to 25C using the CN Q10 = 1.5 - ! - ! CN respiration has units: g C / g N [leaf] / s. This needs to be - ! converted from g C / g N [leaf] / s to umol CO2 / m**2 [leaf] / s - ! - ! Then scale this value at the top of the canopy for canopy depth - - lmr25top = 2.525e-6_r8 * (1.5_r8 ** ((25._r8 - 20._r8)/10._r8)) - lmr25top = lmr25top * lnc(p) / 12.e-06_r8 - - else if ( leafresp_method == leafresp_mtd_atkin2015 ) then - !using new form for respiration base rate from Atkin - !communication. - if ( lnc(p) > 0.0_r8 ) then - lmr25top = params_inst%lmr_intercept_atkin(ivt(p)) + (lnc(p) * 0.2061_r8) - (0.0402_r8 * (t10(p)-tfrz)) - else - lmr25top = 0.0_r8 - end if - end if - - else - ! Leaf maintenance respiration in proportion to vcmax25top - - if (c3flag(p)) then - lmr25top = vcmax25top * leaf_mr_vcm - else - lmr25top = vcmax25top * 0.025_r8 - end if - end if - - ! Loop through canopy layers (above snow). Respiration needs to be - ! calculated every timestep. Others are calculated only if daytime - - laican = 0._r8 - do iv = 1, nrad(p) - - ! Cumulative lai at middle of layer - - if (iv == 1) then - laican = 0.5_r8 * tlai_z(p,iv) - else - laican = laican + 0.5_r8 * (tlai_z(p,iv-1)+tlai_z(p,iv)) - end if - - ! Scale for leaf nitrogen profile. If multi-layer code, use explicit - ! profile. If sun/shade big leaf code, use canopy integrated factor. - - if (nlevcan == 1) then - nscaler = vcmaxcint(p) - else if (nlevcan > 1) then - nscaler = exp(-kn(p) * laican) - end if - - ! Maintenance respiration - - lmr25 = lmr25top * nscaler - - if(use_luna.and.c3flag(p).and.crop(patch%itype(p))== 0) then - if(.not.use_cn)then ! If CN is on, use leaf N to predict respiration (above). Otherwise, use Vcmax term from LUNA. RF - lmr25 = leaf_mr_vcm * photosyns_inst%vcmx25_z_patch(p,iv) - endif - endif - - if (c3flag(p)) then - lmr_z(p,iv) = lmr25 * ft(t_veg(p), lmrha) * fth(t_veg(p), lmrhd, lmrse, lmrc) - else - lmr_z(p,iv) = lmr25 * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - lmr_z(p,iv) = lmr_z(p,iv) / (1._r8 + exp( 1.3_r8*(t_veg(p)-(tfrz+55._r8)) )) - end if - - if (par_z(p,iv) <= 0._r8) then ! night time - - vcmax_z(p,iv) = 0._r8 - jmax_z(p,iv) = 0._r8 - tpu_z(p,iv) = 0._r8 - kp_z(p,iv) = 0._r8 - - if ( use_c13 ) then - alphapsn(p) = 1._r8 - end if - - else ! day time - - if(use_luna.and.c3flag(p).and.crop(patch%itype(p))== 0)then - vcmax25 = photosyns_inst%vcmx25_z_patch(p,iv) - jmax25 = photosyns_inst%jmx25_z_patch(p,iv) - tpu25 = 0.167_r8 * vcmax25 - !Implement scaling of Vcmax25 from sunlit average to shaded canopy average value. RF & GBB. 1 July 2016 - if(phase == 'sha'.and.surfalb_inst%vcmaxcintsun_patch(p).gt.0._r8.and.nlevcan==1) then - vcmax25 = vcmax25 * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) - jmax25 = jmax25 * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) - tpu25 = tpu25 * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) - end if - - else - vcmax25 = vcmax25top * nscaler - jmax25 = jmax25top * nscaler - tpu25 = tpu25top * nscaler - endif - kp25 = kp25top * nscaler - - ! Adjust for temperature - - vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - tpuse = vcmaxse - vcmaxc = fth25 (vcmaxhd, vcmaxse) - jmaxc = fth25 (jmaxhd, jmaxse) - tpuc = fth25 (tpuhd, tpuse) - vcmax_z(p,iv) = vcmax25 * ft(t_veg(p), vcmaxha) * fth(t_veg(p), vcmaxhd, vcmaxse, vcmaxc) - jmax_z(p,iv) = jmax25 * ft(t_veg(p), jmaxha) * fth(t_veg(p), jmaxhd, jmaxse, jmaxc) - tpu_z(p,iv) = tpu25 * ft(t_veg(p), tpuha) * fth(t_veg(p), tpuhd, tpuse, tpuc) - - if (.not. c3flag(p)) then - vcmax_z(p,iv) = vcmax25 * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - vcmax_z(p,iv) = vcmax_z(p,iv) / (1._r8 + exp( 0.2_r8*((tfrz+15._r8)-t_veg(p)) )) - vcmax_z(p,iv) = vcmax_z(p,iv) / (1._r8 + exp( 0.3_r8*(t_veg(p)-(tfrz+40._r8)) )) - end if - - kp_z(p,iv) = kp25 * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - - end if - - ! Adjust for soil water - - vcmax_z(p,iv) = vcmax_z(p,iv) * btran(p) - lmr_z(p,iv) = lmr_z(p,iv) * btran(p) - - ! Change to add in light inhibition of respiration. 0.67 from Lloyd et al. 2010, & Metcalfe et al. 2012 - ! Also pers. comm from Peter Reich (Nov 2015). Might potentially be updated pending findings of Atkin et al. (in prep) - ! review of light inhibition database. - if ( light_inhibit .and. par_z(p,1) > 0._r8) then ! are the lights on? - lmr_z(p,iv) = lmr_z(p,iv) * 0.67_r8 ! inhibit respiration accordingly. - end if - - end do ! canopy layer loop - end do ! patch loop - - !==============================================================================! - ! Leaf-level photosynthesis and stomatal conductance - !==============================================================================! - - rsmax0 = 2.e4_r8 - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - g = patch%gridcell(p) - - ! Leaf boundary layer conductance, umol/m**2/s - - cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e06_r8 - gb = 1._r8/rb(p) - gb_mol(p) = gb * cf - - ! Loop through canopy layers (above snow). Only do calculations if daytime - - do iv = 1, nrad(p) - - if (par_z(p,iv) <= 0._r8) then ! night time - - ac(p,iv) = 0._r8 - aj(p,iv) = 0._r8 - ap(p,iv) = 0._r8 - ag(p,iv) = 0._r8 - an(p,iv) = ag(p,iv) - lmr_z(p,iv) - psn_z(p,iv) = 0._r8 - psn_wc_z(p,iv) = 0._r8 - psn_wj_z(p,iv) = 0._r8 - psn_wp_z(p,iv) = 0._r8 - rs_z(p,iv) = min(rsmax0, 1._r8/bbb(p) * cf) - ci_z(p,iv) = 0._r8 - rh_leaf(p) = 0._r8 - - else ! day time - - !now the constraint is no longer needed, Jinyun Tang - ceair = min( eair(p), esat_tv(p) ) - if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - rh_can = ceair / esat_tv(p) - else if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - ! Put some constraints on RH in the canopy when Medlyn stomatal conductance is being used - rh_can = max((esat_tv(p) - ceair), 50._r8) * 0.001_r8 - end if - - ! Electron transport rate for C3 plants. Convert par from W/m2 to - ! umol photons/m**2/s using the factor 4.6 - - qabs = 0.5_r8 * (1._r8 - fnps) * par_z(p,iv) * 4.6_r8 - aquad = theta_psii - bquad = -(qabs + jmax_z(p,iv)) - cquad = qabs * jmax_z(p,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - je = min(r1,r2) - - ! Iterative loop for ci beginning with initial guess - - if (c3flag(p)) then - ci_z(p,iv) = 0.7_r8 * cair(p) - else - ci_z(p,iv) = 0.4_r8 * cair(p) - end if - - niter = 0 - - ! Increment iteration counter. Stop if too many iterations - - niter = niter + 1 - - ! Save old ci - - ciold = ci_z(p,iv) - - !find ci and stomatal conductance - call hybrid(ciold, p, iv, c, gb_mol(p), je, cair(p), oair(p), & - lmr_z(p,iv), par_z(p,iv), rh_can, gs_mol(p,iv), niter, & - atm2lnd_inst, photosyns_inst) - - ! End of ci iteration. Check for an < 0, in which case gs_mol = bbb - - if (an(p,iv) < 0._r8) gs_mol(p,iv) = bbb(p) - - ! Get local noon sunlit and shaded stomatal conductance - local_secp1 = secs + nint((grc%londeg(g)/degpsec)/dtime)*dtime - local_secp1 = mod(local_secp1,isecspday) - - ! Use time period 1 hour before and 1 hour after local noon inclusive (11AM-1PM) - if (local_secp1 >= (isecspday/2 - 3600) .and. local_secp1 <= (isecspday/2 + 3600)) then - if (phase == 'sun') then - gs_mol_sun_ln(p,iv) = gs_mol(p,iv) - else if (phase == 'sha') then - gs_mol_sha_ln(p,iv) = gs_mol(p,iv) - end if - else - if (phase == 'sun') then - gs_mol_sun_ln(p,iv) = spval - else if (phase == 'sha') then - gs_mol_sha_ln(p,iv) = spval - end if - end if - - ! Final estimates for cs and ci (needed for early exit of ci iteration when an < 0) - - cs = cair(p) - 1.4_r8/gb_mol(p) * an(p,iv) * forc_pbot(c) - cs = max(cs,1.e-06_r8) - ci_z(p,iv) = cair(p) - an(p,iv) * forc_pbot(c) * (1.4_r8*gs_mol(p,iv)+1.6_r8*gb_mol(p)) / (gb_mol(p)*gs_mol(p,iv)) - - ! Trap for values of ci_z less than 1.e-06. This is needed for - ! Megan (which can crash with negative values) - ci_z(p,iv) = max( ci_z(p,iv), 1.e-06_r8 ) - - ! Convert gs_mol (umol H2O/m**2/s) to gs (m/s) and then to rs (s/m) - - gs = gs_mol(p,iv) / cf - rs_z(p,iv) = min(1._r8/gs, rsmax0) - rs_z(p,iv) = rs_z(p,iv) / o3coefg(p) - - ! Photosynthesis. Save rate-limiting photosynthesis - - psn_z(p,iv) = ag(p,iv) - psn_z(p,iv) = psn_z(p,iv) * o3coefv(p) - - psn_wc_z(p,iv) = 0._r8 - psn_wj_z(p,iv) = 0._r8 - psn_wp_z(p,iv) = 0._r8 - - if (ac(p,iv) <= aj(p,iv) .and. ac(p,iv) <= ap(p,iv)) then - psn_wc_z(p,iv) = psn_z(p,iv) - else if (aj(p,iv) < ac(p,iv) .and. aj(p,iv) <= ap(p,iv)) then - psn_wj_z(p,iv) = psn_z(p,iv) - else if (ap(p,iv) < ac(p,iv) .and. ap(p,iv) < aj(p,iv)) then - psn_wp_z(p,iv) = psn_z(p,iv) - end if - - ! Make sure iterative solution is correct - - if (gs_mol(p,iv) < 0._r8) then - write (iulog,*)'Negative stomatal conductance:' - write (iulog,*)'p,iv,gs_mol= ',p,iv,gs_mol(p,iv) - call endrun(decomp_index=p, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - - ! Compare with Ball-Berry model: gs_mol = m * an * hs/cs p + b - - hs = (gb_mol(p)*ceair + gs_mol(p,iv)*esat_tv(p)) / ((gb_mol(p)+gs_mol(p,iv))*esat_tv(p)) - rh_leaf(p) = hs - gs_mol_err = mbb(p)*max(an(p,iv), 0._r8)*hs/cs*forc_pbot(c) + bbb(p) - - if (abs(gs_mol(p,iv)-gs_mol_err) > 1.e-01_r8) then - write (iulog,*) 'Ball-Berry error check - stomatal conductance error:' - write (iulog,*) gs_mol(p,iv), gs_mol_err - end if - - end if ! night or day if branch - end do ! canopy layer loop - end do ! patch loop - - !==============================================================================! - ! Canopy photosynthesis and stomatal conductance - !==============================================================================! - - ! Sum canopy layer fluxes and then derive effective leaf-level fluxes (per - ! unit leaf area), which are used in other parts of the model. Here, laican - ! sums to either laisun or laisha. - - do f = 1, fn - p = filterp(f) - - psncan = 0._r8 - psncan_wc = 0._r8 - psncan_wj = 0._r8 - psncan_wp = 0._r8 - lmrcan = 0._r8 - gscan = 0._r8 - laican = 0._r8 - do iv = 1, nrad(p) - psncan = psncan + psn_z(p,iv) * lai_z(p,iv) - psncan_wc = psncan_wc + psn_wc_z(p,iv) * lai_z(p,iv) - psncan_wj = psncan_wj + psn_wj_z(p,iv) * lai_z(p,iv) - psncan_wp = psncan_wp + psn_wp_z(p,iv) * lai_z(p,iv) - lmrcan = lmrcan + lmr_z(p,iv) * lai_z(p,iv) - gscan = gscan + lai_z(p,iv) / (rb(p)+rs_z(p,iv)) - laican = laican + lai_z(p,iv) - end do - if (laican > 0._r8) then - psn(p) = psncan / laican - psn_wc(p) = psncan_wc / laican - psn_wj(p) = psncan_wj / laican - psn_wp(p) = psncan_wp / laican - lmr(p) = lmrcan / laican - rs(p) = laican / gscan - rb(p) - else - psn(p) = 0._r8 - psn_wc(p) = 0._r8 - psn_wj(p) = 0._r8 - psn_wp(p) = 0._r8 - lmr(p) = 0._r8 - rs(p) = 0._r8 - end if - end do - - end associate - - end subroutine Photosynthesis - - !------------------------------------------------------------------------------ - subroutine PhotosynthesisTotal (fn, filterp, & - atm2lnd_inst, canopystate_inst, photosyns_inst) - ! - ! Determine total photosynthesis - ! - ! !ARGUMENTS: - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! patch filter - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - ! - ! !LOCAL VARIABLES: - integer :: f,fp,p,l,g ! indices - - real(r8) :: rc14_atm(nsectors_c14), rc13_atm - integer :: sector_c14 - !----------------------------------------------------------------------- - - associate( & - forc_pco2 => atm2lnd_inst%forc_pco2_grc , & ! Input: [real(r8) (:) ] partial pressure co2 (Pa) - forc_pc13o2 => atm2lnd_inst%forc_pc13o2_grc , & ! Input: [real(r8) (:) ] partial pressure c13o2 (Pa) - forc_po2 => atm2lnd_inst%forc_po2_grc , & ! Input: [real(r8) (:) ] partial pressure o2 (Pa) - - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - - psnsun => photosyns_inst%psnsun_patch , & ! Input: [real(r8) (:) ] sunlit leaf photosynthesis (umol CO2 /m**2/ s) - psnsha => photosyns_inst%psnsha_patch , & ! Input: [real(r8) (:) ] shaded leaf photosynthesis (umol CO2 /m**2/ s) - rc13_canair => photosyns_inst%rc13_canair_patch , & ! Output: [real(r8) (:) ] C13O2/C12O2 in canopy air - rc13_psnsun => photosyns_inst%rc13_psnsun_patch , & ! Output: [real(r8) (:) ] C13O2/C12O2 in sunlit canopy psn flux - rc13_psnsha => photosyns_inst%rc13_psnsha_patch , & ! Output: [real(r8) (:) ] C13O2/C12O2 in shaded canopy psn flux - alphapsnsun => photosyns_inst%alphapsnsun_patch , & ! Output: [real(r8) (:) ] fractionation factor in sunlit canopy psn flux - alphapsnsha => photosyns_inst%alphapsnsha_patch , & ! Output: [real(r8) (:) ] fractionation factor in shaded canopy psn flux - psnsun_wc => photosyns_inst%psnsun_wc_patch , & ! Output: [real(r8) (:) ] Rubsico-limited sunlit leaf photosynthesis (umol CO2 /m**2/ s) - psnsun_wj => photosyns_inst%psnsun_wj_patch , & ! Output: [real(r8) (:) ] RuBP-limited sunlit leaf photosynthesis (umol CO2 /m**2/ s) - psnsun_wp => photosyns_inst%psnsun_wp_patch , & ! Output: [real(r8) (:) ] product-limited sunlit leaf photosynthesis (umol CO2 /m**2/ s) - psnsha_wc => photosyns_inst%psnsha_wc_patch , & ! Output: [real(r8) (:) ] Rubsico-limited shaded leaf photosynthesis (umol CO2 /m**2/ s) - psnsha_wj => photosyns_inst%psnsha_wj_patch , & ! Output: [real(r8) (:) ] RuBP-limited shaded leaf photosynthesis (umol CO2 /m**2/ s) - psnsha_wp => photosyns_inst%psnsha_wp_patch , & ! Output: [real(r8) (:) ] product-limited shaded leaf photosynthesis (umol CO2 /m**2/ s) - c13_psnsun => photosyns_inst%c13_psnsun_patch , & ! Output: [real(r8) (:) ] sunlit leaf photosynthesis (umol 13CO2 /m**2/ s) - c13_psnsha => photosyns_inst%c13_psnsha_patch , & ! Output: [real(r8) (:) ] shaded leaf photosynthesis (umol 13CO2 /m**2/ s) - c14_psnsun => photosyns_inst%c14_psnsun_patch , & ! Output: [real(r8) (:) ] sunlit leaf photosynthesis (umol 14CO2 /m**2/ s) - c14_psnsha => photosyns_inst%c14_psnsha_patch , & ! Output: [real(r8) (:) ] shaded leaf photosynthesis (umol 14CO2 /m**2/ s) - fpsn => photosyns_inst%fpsn_patch , & ! Output: [real(r8) (:) ] photosynthesis (umol CO2 /m**2 /s) - fpsn_wc => photosyns_inst%fpsn_wc_patch , & ! Output: [real(r8) (:) ] Rubisco-limited photosynthesis (umol CO2 /m**2 /s) - fpsn_wj => photosyns_inst%fpsn_wj_patch , & ! Output: [real(r8) (:) ] RuBP-limited photosynthesis (umol CO2 /m**2 /s) - fpsn_wp => photosyns_inst%fpsn_wp_patch & ! Output: [real(r8) (:) ] product-limited photosynthesis (umol CO2 /m**2 /s) - ) - - if ( use_c14 ) then - if (use_c14_bombspike) then - call C14BombSpike(rc14_atm) - else - rc14_atm(:) = c14ratio - end if - end if - - if ( use_c13 ) then - if (use_c13_timeseries) then - call C13TimeSeries(rc13_atm) - end if - end if - - do f = 1, fn - p = filterp(f) - g = patch%gridcell(p) - - if (.not. use_fates) then - fpsn(p) = psnsun(p) *laisun(p) + psnsha(p) *laisha(p) - fpsn_wc(p) = psnsun_wc(p)*laisun(p) + psnsha_wc(p)*laisha(p) - fpsn_wj(p) = psnsun_wj(p)*laisun(p) + psnsha_wj(p)*laisha(p) - fpsn_wp(p) = psnsun_wp(p)*laisun(p) + psnsha_wp(p)*laisha(p) - end if - - if (use_cn) then - if ( use_c13 ) then - if (use_c13_timeseries) then - rc13_canair(p) = rc13_atm - else - rc13_canair(p) = forc_pc13o2(g)/(forc_pco2(g) - forc_pc13o2(g)) - endif - rc13_psnsun(p) = rc13_canair(p)/alphapsnsun(p) - rc13_psnsha(p) = rc13_canair(p)/alphapsnsha(p) - c13_psnsun(p) = psnsun(p) * (rc13_psnsun(p)/(1._r8+rc13_psnsun(p))) - c13_psnsha(p) = psnsha(p) * (rc13_psnsha(p)/(1._r8+rc13_psnsha(p))) - - ! use fixed c13 ratio with del13C of -25 to test the overall c13 structure - ! c13_psnsun(p) = 0.01095627 * psnsun(p) - ! c13_psnsha(p) = 0.01095627 * psnsha(p) - endif - if ( use_c14 ) then - - ! determine latitute sector for radiocarbon bomb spike inputs - if ( grc%latdeg(g) .ge. 30._r8 ) then - sector_c14 = 1 - else if ( grc%latdeg(g) .ge. -30._r8 ) then - sector_c14 = 2 - else - sector_c14 = 3 - endif - - c14_psnsun(p) = rc14_atm(sector_c14) * psnsun(p) - c14_psnsha(p) = rc14_atm(sector_c14) * psnsha(p) - endif - end if - - end do - - end associate - - end subroutine PhotosynthesisTotal - - !------------------------------------------------------------------------------ - subroutine Fractionation(bounds, fn, filterp, downreg, & - atm2lnd_inst, canopystate_inst, solarabs_inst, surfalb_inst, photosyns_inst, & - phase) - ! - ! !DESCRIPTION: - ! C13 fractionation during photosynthesis is calculated here after the nitrogen - ! limitation is taken into account in the CNAllocation module. - ! - ! As of CLM5, nutrient downregulation occurs prior to photosynthesis via leafcn, so we may - ! ignore the downregulation term in this and assume that the Ci/Ca used in the photosynthesis - ! calculation is consistent with that in the isotope calculation - ! - !!USES: - use clm_varctl , only : use_hydrstress - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! patch filter - real(r8) , intent(in) :: downreg( bounds%begp: ) ! fractional reduction in GPP due to N limitation (dimensionless) - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(photosyns_type) , intent(in) :: photosyns_inst - character(len=*) , intent(in) :: phase ! 'sun' or 'sha' - ! - ! !LOCAL VARIABLES: - real(r8) , pointer :: par_z (:,:) ! needed for backwards compatiblity - real(r8) , pointer :: alphapsn (:) ! needed for backwards compatiblity - real(r8) , pointer :: gs_mol(:,:) ! leaf stomatal conductance (umol H2O/m**2/s) - real(r8) , pointer :: an(:,:) ! net leaf photosynthesis (umol CO2/m**2/s) - integer :: f,p,c,g,iv ! indices - real(r8) :: co2(bounds%begp:bounds%endp) ! atmospheric co2 partial pressure (pa) - real(r8) :: ci - !------------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(downreg) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_pco2 => atm2lnd_inst%forc_pco2_grc , & ! Input: [real(r8) (:) ] partial pressure co2 (Pa) - - c3psn => pftcon%c3psn , & ! Input: photosynthetic pathway: 0. = c4, 1. = c3 - - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] number of canopy layers, above snow for radiative transfer - - gb_mol => photosyns_inst%gb_mol_patch & ! Input: [real(r8) (:) ] leaf boundary layer conductance (umol H2O/m**2/s) - ) - - if (phase == 'sun') then - par_z => solarabs_inst%parsun_z_patch ! Input : [real(r8) (:,:)] par absorbed per unit lai for canopy layer (w/m**2) - alphapsn => photosyns_inst%alphapsnsun_patch ! Output: [real(r8) (:)] - if (use_hydrstress) then - gs_mol => photosyns_inst%gs_mol_sun_patch ! Input: [real(r8) (:,:) ] sunlit leaf stomatal conductance (umol H2O/m**2/s) - an => photosyns_inst%an_sun_patch ! Input: [real(r8) (:,:) ] net sunlit leaf photosynthesis (umol CO2/m**2/s) - else - gs_mol => photosyns_inst%gs_mol_patch ! Input: [real(r8) (:,:) ] leaf stomatal conductance (umol H2O/m**2/s) - an => photosyns_inst%an_patch ! Input: [real(r8) (:,:) ] net leaf photosynthesis (umol CO2/m**2/s) - end if - else if (phase == 'sha') then - par_z => solarabs_inst%parsha_z_patch ! Input : [real(r8) (:,:)] par absorbed per unit lai for canopy layer (w/m**2) - alphapsn => photosyns_inst%alphapsnsha_patch ! Output: [real(r8) (:)] - if (use_hydrstress) then - gs_mol => photosyns_inst%gs_mol_sha_patch ! Input: [real(r8) (:,:) ] shaded leaf stomatal conductance (umol H2O/m**2/s) - an => photosyns_inst%an_sha_patch ! Input: [real(r8) (:,:) ] net shaded leaf photosynthesis (umol CO2/m**2/s) - else - gs_mol => photosyns_inst%gs_mol_patch ! Input: [real(r8) (:,:) ] leaf stomatal conductance (umol H2O/m**2/s) - an => photosyns_inst%an_patch ! Input: [real(r8) (:,:) ] net leaf photosynthesis (umol CO2/m**2/s) - end if - end if - - do f = 1, fn - p = filterp(f) - c= patch%column(p) - g= patch%gridcell(p) - - co2(p) = forc_pco2(g) - do iv = 1,nrad(p) - if (par_z(p,iv) <= 0._r8) then ! night time - alphapsn(p) = 1._r8 - else ! day time - ci = co2(p) - (an(p,iv) * & - forc_pbot(c) * & - (1.4_r8*gs_mol(p,iv)+1.6_r8*gb_mol(p)) / (gb_mol(p)*gs_mol(p,iv))) - alphapsn(p) = 1._r8 + (((c3psn(patch%itype(p)) * & - (4.4_r8 + (22.6_r8*(ci/co2(p))))) + & - ((1._r8 - c3psn(patch%itype(p))) * 4.4_r8))/1000._r8) - end if - end do - end do - - end associate - - end subroutine Fractionation - - !------------------------------------------------------------------------------- - subroutine hybrid(x0, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& - rh_can, gs_mol,iter, & - atm2lnd_inst, photosyns_inst) - ! - !! DESCRIPTION: - ! use a hybrid solver to find the root of equation - ! f(x) = x- h(x), - !we want to find x, s.t. f(x) = 0. - !the hybrid approach combines the strength of the newton secant approach (find the solution domain) - !and the bisection approach implemented with the Brent's method to guarrantee convergence. - - ! - !! REVISION HISTORY: - !Dec 14/2012: created by Jinyun Tang - ! - !!USES: - ! - !! ARGUMENTS: - implicit none - real(r8), intent(inout) :: x0 !initial guess and final value of the solution - real(r8), intent(in) :: lmr_z ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), intent(in) :: par_z ! par absorbed per unit lai for canopy layer (w/m**2) - real(r8), intent(in) :: rh_can ! canopy air relative humidity - real(r8), intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8), intent(in) :: je ! electron transport rate (umol electrons/m**2/s) - real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) - real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) - integer, intent(in) :: p, iv, c ! pft, c3/c4, and column index - real(r8), intent(out) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) - integer, intent(out) :: iter !number of iterations used, for record only - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(photosyns_type), intent(inout) :: photosyns_inst - ! - !! LOCAL VARIABLES - real(r8) :: a, b - real(r8) :: fa, fb - real(r8) :: x1, f0, f1 - real(r8) :: x, dx - real(r8), parameter :: eps = 1.e-2_r8 !relative accuracy - real(r8), parameter :: eps1= 1.e-4_r8 - integer, parameter :: itmax = 40 !maximum number of iterations - real(r8) :: tol,minx,minf - - call ci_func(x0, f0, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z, rh_can, gs_mol, & - atm2lnd_inst, photosyns_inst) - - if(f0 == 0._r8)return - - minx=x0 - minf=f0 - x1 = x0 * 0.99_r8 - - call ci_func(x1,f1, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z, rh_can, gs_mol, & - atm2lnd_inst, photosyns_inst) - - if(f1==0._r8)then - x0 = x1 - return - endif - if(f1itmax)then - !in case of failing to converge within itmax iterations - !stop at the minimum function - !this happens because of some other issues besides the stomatal conductance calculation - !and it happens usually in very dry places and more likely with c4 plants. - - call ci_func(minx,f1, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z, rh_can, gs_mol, & - atm2lnd_inst, photosyns_inst) - - exit - endif - enddo - - end subroutine hybrid - - !------------------------------------------------------------------------------ - subroutine brent(x, x1,x2,f1, f2, tol, ip, iv, ic, gb_mol, je, cair, oair,& - lmr_z, par_z, rh_can, gs_mol, & - atm2lnd_inst, photosyns_inst) - ! - !!DESCRIPTION: - !Use Brent's method to find the root of a single variable function ci_func, which is known to exist between x1 and x2. - !The found root will be updated until its accuracy is tol. - - !!REVISION HISTORY: - !Dec 14/2012: Jinyun Tang, modified from numerical recipes in F90 by press et al. 1188-1189 - ! - !!ARGUMENTS: - real(r8), intent(out) :: x ! indepedent variable of the single value function ci_func(x) - real(r8), intent(in) :: x1, x2, f1, f2 ! minimum and maximum of the variable domain to search for the solution ci_func(x1) = f1, ci_func(x2)=f2 - real(r8), intent(in) :: tol ! the error tolerance - real(r8), intent(in) :: lmr_z ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), intent(in) :: par_z ! par absorbed per unit lai for canopy layer (w/m**2) - real(r8), intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8), intent(in) :: je ! electron transport rate (umol electrons/m**2/s) - real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) - real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) - real(r8), intent(in) :: rh_can ! inside canopy relative humidity - integer, intent(in) :: ip, iv, ic ! pft, c3/c4, and column index - real(r8), intent(out) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(photosyns_type), intent(inout) :: photosyns_inst - ! - !!LOCAL VARIABLES: - integer, parameter :: itmax=20 !maximum number of iterations - real(r8), parameter :: eps=1.e-2_r8 !relative error tolerance - integer :: iter - real(r8) :: a,b,c,d,e,fa,fb,fc,p,q,r,s,tol1,xm - !------------------------------------------------------------------------------ - - a=x1 - b=x2 - fa=f1 - fb=f2 - if((fa > 0._r8 .and. fb > 0._r8).or.(fa < 0._r8 .and. fb < 0._r8))then - write(iulog,*) 'root must be bracketed for brent' - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - c=b - fc=fb - iter = 0 - do - if(iter==itmax)exit - iter=iter+1 - if((fb > 0._r8 .and. fc > 0._r8) .or. (fb < 0._r8 .and. fc < 0._r8))then - c=a !Rename a, b, c and adjust bounding interval d. - fc=fa - d=b-a - e=d - endif - if( abs(fc) < abs(fb)) then - a=b - b=c - c=a - fa=fb - fb=fc - fc=fa - endif - tol1=2._r8*eps*abs(b)+0.5_r8*tol !Convergence check. - xm=0.5_r8*(c-b) - if(abs(xm) <= tol1 .or. fb == 0.)then - x=b - return - endif - if(abs(e) >= tol1 .and. abs(fa) > abs(fb)) then - s=fb/fa !Attempt inverse quadratic interpolation. - if(a == c) then - p=2._r8*xm*s - q=1._r8-s - else - q=fa/fc - r=fb/fc - p=s*(2._r8*xm*q*(q-r)-(b-a)*(r-1._r8)) - q=(q-1._r8)*(r-1._r8)*(s-1._r8) - endif - if(p > 0._r8) q=-q !Check whether in bounds. - p=abs(p) - if(2._r8*p < min(3._r8*xm*q-abs(tol1*q),abs(e*q))) then - e=d !Accept interpolation. - d=p/q - else - d=xm !Interpolation failed, use bisection. - e=d - endif - else !Bounds decreasing too slowly, use bisection. - d=xm - e=d - endif - a=b !Move last best guess to a. - fa=fb - if(abs(d) > tol1) then !Evaluate new trial root. - b=b+d - else - b=b+sign(tol1,xm) - endif - - call ci_func(b, fb, ip, iv, ic, gb_mol, je, cair, oair, lmr_z, par_z, rh_can, gs_mol, & - atm2lnd_inst, photosyns_inst) - - if(fb==0._r8)exit - - enddo - - if(iter==itmax)write(iulog,*) 'brent exceeding maximum iterations', b, fb - x=b - - return - end subroutine brent - - !------------------------------------------------------------------------------- - function ft(tl, ha) result(ans) - ! - !!DESCRIPTION: - ! photosynthesis temperature response - ! - ! !REVISION HISTORY - ! Jinyun Tang separated it out from Photosynthesis, Feb. 07/2013 - ! - !!USES - use clm_varcon , only : rgas, tfrz - ! - ! !ARGUMENTS: - real(r8), intent(in) :: tl ! leaf temperature in photosynthesis temperature function (K) - real(r8), intent(in) :: ha ! activation energy in photosynthesis temperature function (J/mol) - ! - ! !LOCAL VARIABLES: - real(r8) :: ans - !------------------------------------------------------------------------------- - - ans = exp( ha / (rgas*1.e-3_r8*(tfrz+25._r8)) * (1._r8 - (tfrz+25._r8)/tl) ) - - return - end function ft - - !------------------------------------------------------------------------------- - function fth(tl,hd,se,scaleFactor) result(ans) - ! - !!DESCRIPTION: - !photosynthesis temperature inhibition - ! - ! !REVISION HISTORY - ! Jinyun Tang separated it out from Photosynthesis, Feb. 07/2013 - ! - use clm_varcon , only : rgas, tfrz - ! - ! !ARGUMENTS: - real(r8), intent(in) :: tl ! leaf temperature in photosynthesis temperature function (K) - real(r8), intent(in) :: hd ! deactivation energy in photosynthesis temperature function (J/mol) - real(r8), intent(in) :: se ! entropy term in photosynthesis temperature function (J/mol/K) - real(r8), intent(in) :: scaleFactor ! scaling factor for high temperature inhibition (25 C = 1.0) - ! - ! !LOCAL VARIABLES: - real(r8) :: ans - !------------------------------------------------------------------------------- - - ans = scaleFactor / ( 1._r8 + exp( (-hd+se*tl) / (rgas*1.e-3_r8*tl) ) ) - - return - end function fth - - !------------------------------------------------------------------------------- - function fth25(hd,se)result(ans) - ! - !!DESCRIPTION: - ! scaling factor for photosynthesis temperature inhibition - ! - ! !REVISION HISTORY: - ! Jinyun Tang separated it out from Photosynthesis, Feb. 07/2013 - ! - !!USES - use clm_varcon , only : rgas, tfrz - ! - ! !ARGUMENTS: - real(r8), intent(in) :: hd ! deactivation energy in photosynthesis temperature function (J/mol) - real(r8), intent(in) :: se ! entropy term in photosynthesis temperature function (J/mol/K) - ! - ! !LOCAL VARIABLES: - real(r8) :: ans - !------------------------------------------------------------------------------- - - ans = 1._r8 + exp( (-hd+se*(tfrz+25._r8)) / (rgas*1.e-3_r8*(tfrz+25._r8)) ) - - return - end function fth25 - - !------------------------------------------------------------------------------ - subroutine ci_func(ci, fval, p, iv, c, gb_mol, je, cair, oair, lmr_z, par_z,& - rh_can, gs_mol, atm2lnd_inst, photosyns_inst) - ! - !! DESCRIPTION: - ! evaluate the function - ! f(ci)=ci - (ca - (1.37rb+1.65rs))*patm*an - ! - ! remark: I am attempting to maintain the original code structure, also - ! considering one may be interested to output relevant variables for the - ! photosynthesis model, I have decided to add these relevant variables to - ! the relevant data types. - ! - !!ARGUMENTS: - real(r8) , intent(in) :: ci ! intracellular leaf CO2 (Pa) - real(r8) , intent(in) :: lmr_z ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8) , intent(in) :: par_z ! par absorbed per unit lai for canopy layer (w/m**2) - real(r8) , intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8) , intent(in) :: je ! electron transport rate (umol electrons/m**2/s) - real(r8) , intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) - real(r8) , intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) - real(r8) , intent(in) :: rh_can ! canopy air realtive humidity - integer , intent(in) :: p, iv, c ! pft, vegetation type and column indexes - real(r8) , intent(out) :: fval ! return function of the value f(ci) - real(r8) , intent(out) :: gs_mol ! leaf stomatal conductance (umol H2O/m**2/s) - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - ! - !local variables - real(r8) :: ai ! intermediate co-limited photosynthesis (umol CO2/m**2/s) - real(r8) :: cs ! CO2 partial pressure at leaf surface (Pa) - - real(r8) :: aquad, bquad, cquad ! terms for quadratic equations - real(r8) :: r1, r2 ! roots of quadratic equation - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation - !------------------------------------------------------------------------------ - - associate(& - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Output: [real(r8) (:) ] atmospheric pressure (Pa) - c3flag => photosyns_inst%c3flag_patch , & ! Output: [logical (:) ] true if C3 and false if C4 - ac => photosyns_inst%ac_patch , & ! Output: [real(r8) (:,:) ] Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - aj => photosyns_inst%aj_patch , & ! Output: [real(r8) (:,:) ] RuBP-limited gross photosynthesis (umol CO2/m**2/s) - ap => photosyns_inst%ap_patch , & ! Output: [real(r8) (:,:) ] product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - ag => photosyns_inst%ag_patch , & ! Output: [real(r8) (:,:) ] co-limited gross leaf photosynthesis (umol CO2/m**2/s) - an => photosyns_inst%an_patch , & ! Output: [real(r8) (:,:) ] net leaf photosynthesis (umol CO2/m**2/s) - vcmax_z => photosyns_inst%vcmax_z_patch , & ! Input: [real(r8) (:,:) ] maximum rate of carboxylation (umol co2/m**2/s) - cp => photosyns_inst%cp_patch , & ! Output: [real(r8) (:) ] CO2 compensation point (Pa) - kc => photosyns_inst%kc_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for CO2 (Pa) - ko => photosyns_inst%ko_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for O2 (Pa) - qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) - tpu_z => photosyns_inst%tpu_z_patch , & ! Output: [real(r8) (:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) - kp_z => photosyns_inst%kp_z_patch , & ! Output: [real(r8) (:,:) ] initial slope of CO2 response curve (C4 plants) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation - bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - mbb => photosyns_inst%mbb_patch & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship - ) - - ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - - if (c3flag(p)) then - ! C3: Rubisco-limited photosynthesis - ac(p,iv) = vcmax_z(p,iv) * max(ci-cp(p), 0._r8) / (ci+kc(p)*(1._r8+oair/ko(p))) - - ! C3: RuBP-limited photosynthesis - aj(p,iv) = je * max(ci-cp(p), 0._r8) / (4._r8*ci+8._r8*cp(p)) - - ! C3: Product-limited photosynthesis - ap(p,iv) = 3._r8 * tpu_z(p,iv) - - else - - ! C4: Rubisco-limited photosynthesis - ac(p,iv) = vcmax_z(p,iv) - - ! C4: RuBP-limited photosynthesis - aj(p,iv) = qe(p) * par_z * 4.6_r8 - - ! C4: PEP carboxylase-limited (CO2-limited) - ap(p,iv) = kp_z(p,iv) * max(ci, 0._r8) / forc_pbot(c) - - end if - - ! Gross photosynthesis. First co-limit ac and aj. Then co-limit ap - - aquad = theta_cj(p) - bquad = -(ac(p,iv) + aj(p,iv)) - cquad = ac(p,iv) * aj(p,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - ai = min(r1,r2) - - aquad = theta_ip - bquad = -(ai + ap(p,iv)) - cquad = ai * ap(p,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - ag(p,iv) = max(0._r8,min(r1,r2)) - - ! Net photosynthesis. Exit iteration if an < 0 - - an(p,iv) = ag(p,iv) - lmr_z - if (an(p,iv) < 0._r8) then - fval = 0._r8 - return - endif - ! Quadratic gs_mol calculation with an known. Valid for an >= 0. - ! With an <= 0, then gs_mol = bbb - - cs = cair - 1.4_r8/gb_mol * an(p,iv) * forc_pbot(c) - cs = max(cs,1.e-06_r8) - aquad = cs - bquad = cs*(gb_mol - bbb(p)) - mbb(p)*an(p,iv)*forc_pbot(c) - cquad = -gb_mol*(cs*bbb(p) + mbb(p)*an(p,iv)*forc_pbot(c)*rh_can) - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol = max(r1,r2) - - ! Derive new estimate for ci - - fval =ci - cair + an(p,iv) * forc_pbot(c) * (1.4_r8*gs_mol+1.6_r8*gb_mol) / (gb_mol*gs_mol) - - end associate - - end subroutine ci_func - - !------------------------------------------------------------------------------ - subroutine PhotosynthesisHydraulicStress ( bounds, fn, filterp, & - esat_tv, eair, oair, cair, rb, bsun, bsha, btran, dayl_factor, leafn, & - qsatl, qaf, & - atm2lnd_inst, temperature_inst, soilstate_inst, waterstate_inst, & - surfalb_inst, solarabs_inst, canopystate_inst, ozone_inst, & - photosyns_inst, waterflux_inst, froot_carbon, croot_carbon) - ! - ! !DESCRIPTION: - ! Leaf photosynthesis and stomatal conductance calculation as described by - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to - ! a multi-layer canopy - ! Here, sunlit and shaded photosynthesis and stomatal conductance are solved - ! simultaneously per Pierre Gentine/Daniel Kennedy plant hydraulic stress - ! method - ! - ! !USES: - use clm_varcon , only : rgas, tfrz, rpi, spval, degpsec, isecspday - use GridcellType , only : grc - use clm_time_manager , only : get_curr_date, get_step_size - use clm_varctl , only : cnallocate_carbon_only - use clm_varctl , only : lnc_opt, reduce_dayl_factor, vcmax_opt - use clm_varpar , only : nlevsoi - use pftconMod , only : nbrdlf_dcd_tmp_shrub, npcropmin - use ColumnType , only : col - use shr_infnan_mod , only : shr_infnan_isnan - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! patch filter - real(r8) , intent(in) :: esat_tv( bounds%begp: ) ! saturation vapor pressure at t_veg (Pa) [pft] - real(r8) , intent(in) :: eair( bounds%begp: ) ! vapor pressure of canopy air (Pa) [pft] - real(r8) , intent(in) :: oair( bounds%begp: ) ! Atmospheric O2 partial pressure (Pa) [pft] - real(r8) , intent(in) :: cair( bounds%begp: ) ! Atmospheric CO2 partial pressure (Pa) [pft] - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) [pft] - real(r8) , intent(in) :: dayl_factor( bounds%begp: ) ! scalar (0-1) for daylength - real(r8) , intent(in) :: qsatl ( bounds%begp: ) ! leaf specific humidity [kg/kg] - real(r8) , intent(in) :: qaf ( bounds%begp: ) ! humidity of canopy air [kg/kg] - real(r8) , intent(in) :: leafn( bounds%begp: ) ! leaf N (gN/m2) - real(r8) , intent(out) :: bsun( bounds%begp: ) ! sunlit canopy transpiration wetness factor (0 to 1) - real(r8) , intent(out) :: bsha( bounds%begp: ) ! shaded canopy transpiration wetness factor (0 to 1) - real(r8) , intent(out) :: btran( bounds%begp: ) ! transpiration wetness factor (0 to 1) [pft] - real(r8) , intent(in) :: froot_carbon( bounds%begp: ) ! fine root carbon (gC/m2) [pft] - real(r8) , intent(in) :: croot_carbon( bounds%begp: ) ! live coarse root carbon (gC/m2) [pft] - - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(temperature_type) , intent(in) :: temperature_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - class(ozone_base_type) , intent(in) :: ozone_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - ! - ! !LOCAL VARIABLES: - ! - ! Leaf photosynthesis parameters - real(r8) :: jmax_z(bounds%begp:bounds%endp,2,nlevcan) ! maximum electron transport rate (umol electrons/m**2/s) - real(r8) :: bbbopt(bounds%begp:bounds%endp) ! Ball-Berry minimum leaf conductance, unstressed (umol H2O/m**2/s) - real(r8) :: kn(bounds%begp:bounds%endp) ! leaf nitrogen decay coefficient - real(r8) :: vcmax25top ! canopy top: maximum rate of carboxylation at 25C (umol CO2/m**2/s) - real(r8) :: jmax25top ! canopy top: maximum electron transport rate at 25C (umol electrons/m**2/s) - real(r8) :: tpu25top ! canopy top: triose phosphate utilization rate at 25C (umol CO2/m**2/s) - real(r8) :: lmr25top ! canopy top: leaf maintenance respiration rate at 25C (umol CO2/m**2/s) - real(r8) :: kp25top ! canopy top: initial slope of CO2 response curve (C4 plants) at 25C - - real(r8) :: vcmax25_sun ! sunlit leaf layer: maximum rate of carboxylation at 25C (umol CO2/m**2/s) - real(r8) :: vcmax25_sha ! shaded leaf layer: maximum rate of carboxylation at 25C (umol CO2/m**2/s) - real(r8) :: jmax25_sun ! sunlit leaf layer: maximum electron transport rate at 25C (umol electrons/m**2/s) - real(r8) :: jmax25_sha ! shaded leaf layer: maximum electron transport rate at 25C (umol electrons/m**2/s) - real(r8) :: tpu25_sun ! sunlit leaf layer: triose phosphate utilization rate at 25C (umol CO2/m**2/s) - real(r8) :: tpu25_sha ! shaded leaf layer: triose phosphate utilization rate at 25C (umol CO2/m**2/s) - real(r8) :: lmr25_sun ! sunlit leaf layer: leaf maintenance respiration rate at 25C (umol CO2/m**2/s) - real(r8) :: lmr25_sha ! shaded leaf layer: leaf maintenance respiration rate at 25C (umol CO2/m**2/s) - real(r8) :: kp25_sun ! sunlit leaf layer: Initial slope of CO2 response curve (C4 plants) at 25C - real(r8) :: kp25_sha ! shaded leaf layer: Initial slope of CO2 response curve (C4 plants) at 25C - real(r8) :: kc25 ! Michaelis-Menten constant for CO2 at 25C (Pa) - real(r8) :: ko25 ! Michaelis-Menten constant for O2 at 25C (Pa) - real(r8) :: cp25 ! CO2 compensation point at 25C (Pa) - - real(r8) :: vcmaxha ! activation energy for vcmax (J/mol) - real(r8) :: jmaxha ! activation energy for jmax (J/mol) - real(r8) :: tpuha ! activation energy for tpu (J/mol) - real(r8) :: lmrha ! activation energy for lmr (J/mol) - real(r8) :: kcha ! activation energy for kc (J/mol) - real(r8) :: koha ! activation energy for ko (J/mol) - real(r8) :: cpha ! activation energy for cp (J/mol) - - real(r8) :: vcmaxhd ! deactivation energy for vcmax (J/mol) - real(r8) :: jmaxhd ! deactivation energy for jmax (J/mol) - real(r8) :: tpuhd ! deactivation energy for tpu (J/mol) - real(r8) :: lmrhd ! deactivation energy for lmr (J/mol) - - real(r8) :: vcmaxse ! entropy term for vcmax (J/mol/K) - real(r8) :: jmaxse ! entropy term for jmax (J/mol/K) - real(r8) :: tpuse ! entropy term for tpu (J/mol/K) - real(r8) :: lmrse ! entropy term for lmr (J/mol/K) - - real(r8) :: vcmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: jmaxc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: tpuc ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: lmrc ! scaling factor for high temperature inhibition (25 C = 1.0) - - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation - - ! Other - integer :: f,p,c,iv ! indices - real(r8) :: cf ! s m**2/umol -> s/m - real(r8) :: rsmax0 ! maximum stomatal resistance [s/m] - real(r8) :: gb ! leaf boundary layer conductance (m/s) - real(r8) :: cs_sun ! CO2 partial pressure at sunlit leaf surface (Pa) - real(r8) :: cs_sha ! CO2 partial pressure at shaded leaf surface (Pa) - real(r8) :: gs ! leaf stomatal conductance (m/s) - real(r8) :: hs ! fractional humidity at leaf surface (dimensionless) - real(r8) :: sco ! relative specificity of rubisco - real(r8) :: ft ! photosynthesis temperature response (statement function) - real(r8) :: fth ! photosynthesis temperature inhibition (statement function) - real(r8) :: fth25 ! ccaling factor for photosynthesis temperature inhibition (statement function) - real(r8) :: tl ! leaf temperature in photosynthesis temperature function (K) - real(r8) :: ha ! activation energy in photosynthesis temperature function (J/mol) - real(r8) :: hd ! deactivation energy in photosynthesis temperature function (J/mol) - real(r8) :: se ! entropy term in photosynthesis temperature function (J/mol/K) - real(r8) :: scaleFactor ! scaling factor for high temperature inhibition (25 C = 1.0) - real(r8) :: ciold ! previous value of Ci for convergence check - real(r8) :: gs_mol_err ! gs_mol for error check - real(r8) :: je_sun ! sunlit leaf electron transport rate (umol electrons/m**2/s) - real(r8) :: je_sha ! shaded leaf electron transport rate (umol electrons/m**2/s) - real(r8) :: qabs ! PAR absorbed by PS II (umol photons/m**2/s) - real(r8) :: aquad,bquad,cquad ! terms for quadratic equations - real(r8) :: r1,r2 ! roots of quadratic equation - real(r8) :: ceair ! vapor pressure of air, constrained (Pa) - real(r8) :: fnr ! (gRubisco/gN in Rubisco) - real(r8) :: act25 ! (umol/mgRubisco/min) Rubisco activity at 25 C - integer :: iter1 ! number of iterations used, for record only - integer :: iter2 ! number of iterations used, for record only - real(r8) :: nscaler ! leaf nitrogen scaling coefficient - real(r8) :: nscaler_sun ! sunlit leaf nitrogen scaling coefficient - real(r8) :: nscaler_sha ! shaded leaf nitrogen scaling coefficient - - real(r8) :: ai ! intermediate co-limited photosynthesis (umol CO2/m**2/s) - - real(r8) :: psn_wc_z_sun(bounds%begp:bounds%endp,nlevcan) ! Rubisco-limited contribution to sunlit psn_z (umol CO2/m**2/s) - real(r8) :: psn_wj_z_sun(bounds%begp:bounds%endp,nlevcan) ! RuBP-limited contribution to sunlit psn_z (umol CO2/m**2/s) - real(r8) :: psn_wp_z_sun(bounds%begp:bounds%endp,nlevcan) ! product-limited contribution to sunlit psn_z (umol CO2/m**2/s) - real(r8) :: psn_wc_z_sha(bounds%begp:bounds%endp,nlevcan) ! Rubisco-limited contribution to shaded psn_z (umol CO2/m**2/s) - real(r8) :: psn_wj_z_sha(bounds%begp:bounds%endp,nlevcan) ! RuBP-limited contribution to shaded psn_z (umol CO2/m**2/s) - real(r8) :: psn_wp_z_sha(bounds%begp:bounds%endp,nlevcan) ! product-limited contribution to shaded psn_z (umol CO2/m**2/s) - real(r8) :: rh_leaf_sun(bounds%begp:bounds%endp) ! fractional humidity at sunlit leaf surface (dimensionless) - real(r8) :: rh_leaf_sha(bounds%begp:bounds%endp) ! fractional humidity at shaded leaf surface (dimensionless) - - real(r8) :: psncan_sun ! canopy sum of sunlit psn_z - real(r8) :: psncan_wc_sun ! canopy sum of sunlit psn_wc_z - real(r8) :: psncan_wj_sun ! canopy sum of sunlit psn_wj_z - real(r8) :: psncan_wp_sun ! canopy sum of sunlit psn_wp_z - real(r8) :: lmrcan_sun ! canopy sum of sunlit lmr_z - real(r8) :: gscan_sun ! canopy sum of sunlit leaf conductance - real(r8) :: laican_sun ! canopy sum of sunlit lai_z - real(r8) :: psncan_sha ! canopy sum of shaded psn_z - real(r8) :: psncan_wc_sha ! canopy sum of shaded psn_wc_z - real(r8) :: psncan_wj_sha ! canopy sum of shaded psn_wj_z - real(r8) :: psncan_wp_sha ! canopy sum of shaded psn_wp_z - real(r8) :: lmrcan_sha ! canopy sum of shaded lmr_z - real(r8) :: gscan_sha ! canopy sum of shaded leaf conductance - real(r8) :: laican_sha ! canopy sum of shaded lai_z - real(r8) :: laican ! canopy sum of lai_z - real(r8) :: rh_can ! canopy air relative humidity - - real(r8) , pointer :: lai_z_sun (:,:) ! leaf area index for canopy layer, sunlit - real(r8) , pointer :: par_z_sun (:,:) ! par absorbed per unit lai for canopy layer, sunlit (w/m**2) - real(r8) , pointer :: vcmaxcint_sun (:) ! leaf to canopy scaling coefficient, sunlit - real(r8) , pointer :: alphapsn_sun (:) ! 13C fractionation factor for PSN, sunlit () - real(r8) , pointer :: psn_sun (:) ! foliage photosynthesis, sunlit (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_wc_sun (:) ! Rubisco-limited foliage photosynthesis, sunlit (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_wj_sun (:) ! RuBP-limited foliage photosynthesis, sunlit (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_wp_sun (:) ! product-limited foliage photosynthesis, sunlit (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_z_sun (:,:) ! canopy layer: foliage photosynthesis, sunlit (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: lmr_sun (:) ! leaf maintenance respiration rate, sunlit (umol CO2/m**2/s) - real(r8) , pointer :: lmr_z_sun (:,:) ! canopy layer: leaf maintenance respiration rate, sunlit (umol CO2/m**2/s) - real(r8) , pointer :: rs_sun (:) ! leaf stomatal resistance, sunlit (s/m) - real(r8) , pointer :: rs_z_sun (:,:) ! canopy layer: leaf stomatal resistance, sunlit (s/m) - real(r8) , pointer :: ci_z_sun (:,:) ! intracellular leaf CO2, sunlit (Pa) - real(r8) , pointer :: o3coefv_sun (:) ! o3 coefficient used in photo calculation, sunlit - real(r8) , pointer :: o3coefg_sun (:) ! o3 coefficient used in rs calculation, sunlit - real(r8) , pointer :: lai_z_sha (:,:) ! leaf area index for canopy layer, shaded - real(r8) , pointer :: par_z_sha (:,:) ! par absorbed per unit lai for canopy layer, shaded (w/m**2) - real(r8) , pointer :: vcmaxcint_sha (:) ! leaf to canopy scaling coefficient, shaded - real(r8) , pointer :: alphapsn_sha (:) ! 13C fractionation factor for PSN, shaded () - real(r8) , pointer :: psn_sha (:) ! foliage photosynthesis, shaded (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_wc_sha (:) ! Rubisco-limited foliage photosynthesis, shaded (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_wj_sha (:) ! RuBP-limited foliage photosynthesis, shaded (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_wp_sha (:) ! product-limited foliage photosynthesis, shaded (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: psn_z_sha (:,:) ! canopy layer: foliage photosynthesis, shaded (umol co2 /m**2/ s) [always +] - real(r8) , pointer :: lmr_sha (:) ! leaf maintenance respiration rate, shaded (umol CO2/m**2/s) - real(r8) , pointer :: lmr_z_sha (:,:) ! canopy layer: leaf maintenance respiration rate, shaded (umol CO2/m**2/s) - real(r8) , pointer :: rs_sha (:) ! leaf stomatal resistance, shaded (s/m) - real(r8) , pointer :: rs_z_sha (:,:) ! canopy layer: leaf stomatal resistance, shaded (s/m) - real(r8) , pointer :: ci_z_sha (:,:) ! intracellular leaf CO2, shaded (Pa) - real(r8) , pointer :: o3coefv_sha (:) ! o3 coefficient used in photo calculation, shaded - real(r8) , pointer :: o3coefg_sha (:) ! o3 coefficient used in rs calculation, shaded - real(r8) :: sum_nscaler - real(r8) :: total_lai - integer :: nptreemax - integer :: local_secp1 ! seconds into current date in local time - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day,secs ! calendar info for current time step - integer :: j,g ! index - real(r8) :: rs_resis ! combined soil-root resistance [s] - real(r8) :: r_soil ! root spacing [m] - real(r8) :: root_biomass_density ! root biomass density [g/m3] - real(r8) :: root_cross_sec_area ! root cross sectional area [m2] - real(r8) :: root_length_density ! root length density [m/m3] - real(r8) :: froot_average_length ! average coarse root length [m] - real(r8) :: croot_average_length ! average coarse root length [m] - real(r8) :: soil_conductance ! soil to root hydraulic conductance [1/s] - real(r8) :: root_conductance ! root hydraulic conductance [1/s] - real(r8) :: rai(nlevsoi) ! root area index [m2/m2] - real(r8) :: fs(nlevsoi) ! root conductance scale factor (reduction in conductance due to decreasing (more negative) root water potential) - real(r8) :: gsminsun ! Minimum stomatal conductance sunlit - real(r8) :: gsminsha ! Minimum stomatal conductance shaded - real(r8) :: gs_slope_sun ! Slope stomatal conductance sunlit - real(r8) :: gs_slope_sha ! Slope stomatal conductance shaded - real(r8), parameter :: croot_lateral_length = 0.25_r8 ! specified lateral coarse root length [m] - real(r8), parameter :: c_to_b = 2.0_r8 !(g biomass /g C) -!Note that root density is for dry biomass not carbon. CLM provides root biomass as carbon. The conversion is 0.5 g C / g biomass - integer, parameter :: noonsec = isecspday / 2 ! seconds at local noon - - !------------------------------------------------------------------------------ - - ! Temperature and soil water response functions - - ft(tl,ha) = exp( ha / (rgas*1.e-3_r8*(tfrz+25._r8)) * (1._r8 - (tfrz+25._r8)/tl) ) - fth(tl,hd,se,scaleFactor) = scaleFactor / ( 1._r8 + exp( (-hd+se*tl) / (rgas*1.e-3_r8*tl) ) ) - fth25(hd,se) = 1._r8 + exp( (-hd+se*(tfrz+25._r8)) / (rgas*1.e-3_r8*(tfrz+25._r8)) ) - - ! Enforce expected array sizes - - SHR_ASSERT_ALL((ubound(esat_tv) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eair) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(oair) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cair) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rb) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsun) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsha) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(btran) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dayl_factor) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(qsatl) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(qaf) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - associate( & - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] soil-root interface conductance (mm/s) - hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - - froot_leaf => pftcon%froot_leaf , & ! fine root to leaf ratio - root_conductance_patch => soilstate_inst%root_conductance_patch , & ! Output: [real(r8) (:,:)] root conductance - soil_conductance_patch => soilstate_inst%soil_conductance_patch , & ! Output: [real(r8) (:,:)] soil conductance - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:)] - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - root_radius => pftcon%root_radius , & ! Input: 0.29e-03_r8 !(m) - root_density => pftcon%root_density , & ! Input: 0.31e06_r8 !(g biomass / m3 root) - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] patch canopy one-sided stem area index, no burying by snow - c3psn => pftcon%c3psn , & ! Input: photosynthetic pathway: 0. = c4, 1. = c3 - crop => pftcon%crop , & ! Input: crop or not (0 =not crop and 1 = crop) - leafcn => pftcon%leafcn , & ! Input: leaf C:N (gC/gN) - flnr => pftcon%flnr , & ! Input: fraction of leaf N in the Rubisco enzyme (gN Rubisco / gN leaf) - fnitr => pftcon%fnitr , & ! Input: foliage nitrogen limitation factor (-) - slatop => pftcon%slatop , & ! Input: specific leaf area at top of canopy, projected area basis [m^2/gC] - dsladlai => pftcon%dsladlai , & ! Input: change in sla per unit lai - i_vcad => pftcon%i_vcad , & ! Input: [real(r8) (:) ] - s_vcad => pftcon%s_vcad , & ! Input: [real(r8) (:) ] - i_flnr => pftcon%i_flnr , & ! Input: [real(r8) (:) ] - s_flnr => pftcon%s_flnr , & ! Input: [real(r8) (:) ] - mbbopt => pftcon%mbbopt , & - medlynintercept=> pftcon%medlynintercept , & ! Input: [real(r8) (:) ] Intercept for Medlyn stomatal conductance model method - medlynslope=> pftcon%medlynslope , & ! Input: [real(r8) (:) ] Slope for Medlyn stomatal conductance model method - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - - t_veg => temperature_inst%t_veg_patch , & ! Input: [real(r8) (:) ] vegetation temperature (Kelvin) - t10 => temperature_inst%t_a10_patch , & ! Input: [real(r8) (:) ] 10-day running mean of the 2 m temperature (K) - tgcm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] air temperature at agcm reference height (kelvin) - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] pft number of canopy layers, above snow for radiative transfer - tlai_z => surfalb_inst%tlai_z_patch , & ! Input: [real(r8) (:,:) ] pft total leaf area index for canopy layer - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8)(:) ] one-sided leaf area index, no burying by snow - c3flag => photosyns_inst%c3flag_patch , & ! Output: [logical (:) ] true if C3 and false if C4 - ac => photosyns_inst%ac_phs_patch , & ! Output: [real(r8) (:,:,:) ] Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - aj => photosyns_inst%aj_phs_patch , & ! Output: [real(r8) (:,:,:) ] RuBP-limited gross photosynthesis (umol CO2/m**2/s) - ap => photosyns_inst%ap_phs_patch , & ! Output: [real(r8) (:,:,:) ] product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - ag => photosyns_inst%ag_phs_patch , & ! Output: [real(r8) (:,:,:) ] co-limited gross leaf photosynthesis (umol CO2/m**2/s) - vcmax_z => photosyns_inst%vcmax_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] maximum rate of carboxylation (umol co2/m**2/s) - luvcmax25top => photosyns_inst%luvcmax25top_patch , & ! Output: [real(r8) (:) ] maximum rate of carboxylation (umol co2/m**2/s) - lujmax25top => photosyns_inst%lujmax25top_patch , & ! Output: [real(r8) (:) ] maximum rate of carboxylation (umol co2/m**2/s) - lutpu25top => photosyns_inst%lutpu25top_patch , & ! Output: [real(r8) (:) ] maximum rate of carboxylation (umol co2/m**2/s) -!!! - tpu_z => photosyns_inst%tpu_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) - kp_z => photosyns_inst%kp_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] initial slope of CO2 response curve (C4 plants) - gb_mol => photosyns_inst%gb_mol_patch , & ! Output: [real(r8) (:) ] leaf boundary layer conductance (umol H2O/m**2/s) - cp => photosyns_inst%cp_patch , & ! Output: [real(r8) (:) ] CO2 compensation point (Pa) - kc => photosyns_inst%kc_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for CO2 (Pa) - ko => photosyns_inst%ko_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for O2 (Pa) - qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation - bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship - rh_leaf => photosyns_inst%rh_leaf_patch , & ! Output: [real(r8) (:) ] fractional humidity at leaf surface (dimensionless) - lnc => photosyns_inst%lnca_patch , & ! Output: [real(r8) (:) ] top leaf layer leaf N concentration (gN leaf/m^2) - light_inhibit=> photosyns_inst%light_inhibit , & ! Input: [logical ] flag if light should inhibit respiration - leafresp_method=> photosyns_inst%leafresp_method , & ! Input: [integer ] method type to use for leaf-maint.-respiration at 25C canopy top - stomatalcond_mtd=> photosyns_inst%stomatalcond_mtd , & ! Input: [integer ] method type to use for stomatal conductance - modifyphoto_and_lmr_forcrop=> photosyns_inst%modifyphoto_and_lmr_forcrop, & ! Input: [logical ] modifyphoto_and_lmr_forcrop - leaf_mr_vcm => canopystate_inst%leaf_mr_vcm , & ! Input: [real(r8) ] scalar constant of leaf respiration with Vcmax - vegwp => canopystate_inst%vegwp_patch , & ! Input/Output: [real(r8) (:,:) ] vegetation water matric potential (mm) - an_sun => photosyns_inst%an_sun_patch , & ! Output: [real(r8) (:,:) ] net sunlit leaf photosynthesis (umol CO2/m**2/s) - an_sha => photosyns_inst%an_sha_patch , & ! Output: [real(r8) (:,:) ] net shaded leaf photosynthesis (umol CO2/m**2/s) - gs_mol_sun => photosyns_inst%gs_mol_sun_patch , & ! Output: [real(r8) (:,:) ] sunlit leaf stomatal conductance (umol H2O/m**2/s) - gs_mol_sha => photosyns_inst%gs_mol_sha_patch , & ! Output: [real(r8) (:,:) ] shaded leaf stomatal conductance (umol H2O/m**2/s) - gs_mol_sun_ln => photosyns_inst%gs_mol_sun_ln_patch , & ! Output: [real(r8) (:,:) ] sunlit leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s) - gs_mol_sha_ln => photosyns_inst%gs_mol_sha_ln_patch & ! Output: [real(r8) (:,:) ] shaded leaf stomatal conductance averaged over 1 hour before to 1 hour after local noon (umol H2O/m**2/s) - ) - - par_z_sun => solarabs_inst%parsun_z_patch ! Input: [real(r8) (:,:) ] par absorbed per unit lai for canopy layer (w/m**2) - lai_z_sun => canopystate_inst%laisun_z_patch ! Input: [real(r8) (:,:) ] leaf area index for canopy layer, sunlit or shaded - vcmaxcint_sun => surfalb_inst%vcmaxcintsun_patch ! Input: [real(r8) (:) ] leaf to canopy scaling coefficient - alphapsn_sun => photosyns_inst%alphapsnsun_patch ! Input: [real(r8) (:) ] 13C fractionation factor for PSN () - o3coefv_sun => ozone_inst%o3coefvsun_patch ! Input: [real(r8) (:) ] O3 coefficient used in photosynthesis calculation - o3coefg_sun => ozone_inst%o3coefgsun_patch ! Input: [real(r8) (:) ] O3 coefficient used in rs calculation - ci_z_sun => photosyns_inst%cisun_z_patch ! Output: [real(r8) (:,:) ] intracellular leaf CO2 (Pa) - rs_sun => photosyns_inst%rssun_patch ! Output: [real(r8) (:) ] leaf stomatal resistance (s/m) - rs_z_sun => photosyns_inst%rssun_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf stomatal resistance (s/m) - lmr_sun => photosyns_inst%lmrsun_patch ! Output: [real(r8) (:) ] leaf maintenance respiration rate (umol CO2/m**2/s) - lmr_z_sun => photosyns_inst%lmrsun_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - psn_sun => photosyns_inst%psnsun_patch ! Output: [real(r8) (:) ] foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_z_sun => photosyns_inst%psnsun_z_patch ! Output: [real(r8) (:,:) ] canopy layer: foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wc_sun => photosyns_inst%psnsun_wc_patch ! Output: [real(r8) (:) ] Rubisco-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wj_sun => photosyns_inst%psnsun_wj_patch ! Output: [real(r8) (:) ] RuBP-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wp_sun => photosyns_inst%psnsun_wp_patch ! Output: [real(r8) (:) ] product-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - par_z_sha => solarabs_inst%parsha_z_patch ! Input: [real(r8) (:,:) ] par absorbed per unit lai for canopy layer (w/m**2) - lai_z_sha => canopystate_inst%laisha_z_patch ! Input: [real(r8) (:,:) ] leaf area index for canopy layer, sunlit or shaded - vcmaxcint_sha => surfalb_inst%vcmaxcintsha_patch ! Input: [real(r8) (:) ] leaf to canopy scaling coefficient - alphapsn_sha => photosyns_inst%alphapsnsha_patch ! Input: [real(r8) (:) ] 13C fractionation factor for PSN () - o3coefv_sha => ozone_inst%o3coefvsha_patch ! Input: [real(r8) (:) ] O3 coefficient used in photosynthesis calculation - o3coefg_sha => ozone_inst%o3coefgsha_patch ! Input: [real(r8) (:) ] O3 coefficient used in rs calculation - ci_z_sha => photosyns_inst%cisha_z_patch ! Output: [real(r8) (:,:) ] intracellular leaf CO2 (Pa) - rs_sha => photosyns_inst%rssha_patch ! Output: [real(r8) (:) ] leaf stomatal resistance (s/m) - rs_z_sha => photosyns_inst%rssha_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf stomatal resistance (s/m) - lmr_sha => photosyns_inst%lmrsha_patch ! Output: [real(r8) (:) ] leaf maintenance respiration rate (umol CO2/m**2/s) - lmr_z_sha => photosyns_inst%lmrsha_z_patch ! Output: [real(r8) (:,:) ] canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - psn_sha => photosyns_inst%psnsha_patch ! Output: [real(r8) (:) ] foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_z_sha => photosyns_inst%psnsha_z_patch ! Output: [real(r8) (:,:) ] canopy layer: foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wc_sha => photosyns_inst%psnsha_wc_patch ! Output: [real(r8) (:) ] Rubisco-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wj_sha => photosyns_inst%psnsha_wj_patch ! Output: [real(r8) (:) ] RuBP-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - psn_wp_sha => photosyns_inst%psnsha_wp_patch ! Output: [real(r8) (:) ] product-limited foliage photosynthesis (umol co2 /m**2/ s) [always +] - !==============================================================================! - ! Photosynthesis and stomatal conductance parameters, from: - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - !==============================================================================! - - ! Determine seconds off current time step - - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! vcmax25 parameters, from CN - - fnr = 7.16_r8 - act25 = 3.6_r8 !umol/mgRubisco/min - ! Convert rubisco activity units from umol/mgRubisco/min -> umol/gRubisco/s - act25 = act25 * 1000.0_r8 / 60.0_r8 - - ! Activation energy, from: - ! Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - ! Bernacchi et al (2003) Plant, Cell and Environment 26:1419-1430 - ! except TPU from: Harley et al (1992) Plant, Cell and Environment 15:271-282 - - kcha = 79430._r8 - koha = 36380._r8 - cpha = 37830._r8 - vcmaxha = 72000._r8 - jmaxha = 50000._r8 - tpuha = 72000._r8 - lmrha = 46390._r8 - - ! High temperature deactivation, from: - ! Leuning (2002) Plant, Cell and Environment 25:1205-1210 - ! The factor "c" scales the deactivation to a value of 1.0 at 25C - - vcmaxhd = 200000._r8 - jmaxhd = 200000._r8 - tpuhd = 200000._r8 - lmrhd = 150650._r8 - lmrse = 490._r8 - lmrc = fth25 (lmrhd, lmrse) - -! calculate root-soil interface conductance - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - do j = 1,nlevsoi - -! calculate conversion from conductivity to conductance - root_biomass_density = c_to_b * froot_carbon(p) * rootfr(p,j) / dz(c,j) -! ensure minimum root biomass (using 1gC/m2) - root_biomass_density = max(c_to_b*1._r8,root_biomass_density) - - ! Root length density: m root per m3 soil - root_cross_sec_area = rpi*root_radius(ivt(p))**2 - root_length_density = root_biomass_density / (root_density(ivt(p)) * root_cross_sec_area) - - ! Root-area index (RAI) - rai(j) = (tsai(p)+tlai(p)) * froot_leaf(ivt(p)) * rootfr(p,j) - -! fix coarse root_average_length to specified length - croot_average_length = croot_lateral_length - -! calculate r_soil using Gardner/spa equation (Bonan, GMD, 2014) - r_soil = sqrt(1./(rpi*root_length_density)) - - ! length scale approach - soil_conductance = min(hksat(c,j),hk_l(c,j))/(1.e3*r_soil) - -! use vegetation plc function to adjust root conductance - fs(j)= plc(smp(c,j),p,c,root,veg) - -! krmax is root conductance per area per length - root_conductance = (fs(j)*rai(j)*params_inst%krmax(ivt(p)))/(croot_average_length + z(c,j)) - - soil_conductance = max(soil_conductance, 1.e-16_r8) - root_conductance = max(root_conductance, 1.e-16_r8) - - root_conductance_patch(p,j) = root_conductance - soil_conductance_patch(p,j) = soil_conductance - -! sum resistances in soil and root - rs_resis = 1._r8/soil_conductance + 1._r8/root_conductance - -! conductance is inverse resistance -! explicitly set conductance to zero for top soil layer - if(rai(j)*rootfr(p,j) > 0._r8 .and. j > 1) then - k_soil_root(p,j) = 1._r8/rs_resis - else - k_soil_root(p,j) = 0. - endif - - end do - enddo - - ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - ! C3 or C4 photosynthesis logical variable - - if (nint(c3psn(patch%itype(p))) == 1) then - c3flag(p) = .true. - else if (nint(c3psn(patch%itype(p))) == 0) then - c3flag(p) = .false. - end if - - ! C3 and C4 dependent parameters - - if (c3flag(p)) then - qe(p) = 0._r8 - theta_cj(p) = 0.98_r8 - bbbopt(p) = 10000._r8 - else - qe(p) = 0.05_r8 - theta_cj(p) = 0.80_r8 - bbbopt(p) = 40000._r8 - end if - - if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - ! Soil water stress applied to Ball-Berry parameters later in ci_func_PHS - bbb(p) = bbbopt(p) - mbb(p) = mbbopt(patch%itype(p)) - end if - ! kc, ko, cp, from: Bernacchi et al (2001) Plant, Cell and Environment 24:253-259 - ! - ! kc25 = 404.9 umol/mol - ! ko25 = 278.4 mmol/mol - ! cp25 = 42.75 umol/mol - ! - ! Derive sco from cp and O2 using present-day O2 (0.209 mol/mol) and re-calculate - ! cp to account for variation in O2 using cp = 0.5 O2 / sco - ! - - kc25 = (404.9_r8 / 1.e06_r8) * forc_pbot(c) - ko25 = (278.4_r8 / 1.e03_r8) * forc_pbot(c) - sco = 0.5_r8 * 0.209_r8 / (42.75_r8 / 1.e06_r8) - cp25 = 0.5_r8 * oair(p) / sco - - kc(p) = kc25 * ft(t_veg(p), kcha) - ko(p) = ko25 * ft(t_veg(p), koha) - cp(p) = cp25 * ft(t_veg(p), cpha) - - end do - - ! Multi-layer parameters scaled by leaf nitrogen profile. - ! Loop through each canopy layer to calculate nitrogen profile using - ! cumulative lai at the midpoint of the layer - - do f = 1, fn - p = filterp(f) - - if (lnc_opt .eqv. .false.) then - ! Leaf nitrogen concentration at the top of the canopy (g N leaf / m**2 leaf) - lnc(p) = 1._r8 / (slatop(patch%itype(p)) * leafcn(patch%itype(p))) - end if - - ! Using the actual nitrogen allocated to the leaf after - ! uptake rather than fixing leaf nitrogen based on SLA and CN - ! ratio - if (lnc_opt .eqv. .true.) then - ! nlevcan and nrad(p) look like the same variable ?? check this later - sum_nscaler = 0.0_r8 - laican = 0.0_r8 - total_lai = 0.0_r8 - - do iv = 1, nrad(p) - - if (iv == 1) then - laican = 0.5_r8 * tlai_z(p,iv) - total_lai = tlai_z(p,iv) - else - laican = laican + 0.5_r8 * (tlai_z(p,iv-1)+tlai_z(p,iv)) - total_lai = total_lai + tlai_z(p,iv) - end if - - ! Scale for leaf nitrogen profile. If multi-layer code, use explicit - ! profile. If sun/shade big leaf code, use canopy integrated factor. - if (nlevcan == 1) then - nscaler = 1.0_r8 - else if (nlevcan > 1) then - nscaler = exp(-kn(p) * laican) - end if - - sum_nscaler = sum_nscaler + nscaler - - end do - - if (tlai(p) > 0.0_r8 .AND. sum_nscaler > 0.0_r8) then - ! dividing by LAI to convert total leaf nitrogen - ! from m2 ground to m2 leaf; dividing by sum_nscaler to - ! convert total leaf N to leaf N at canopy top - lnc(p) = leafn(p) / (tlai(p) * sum_nscaler) - else - lnc(p) = 0.0_r8 - end if - - end if - lnc(p) = min(lnc(p),10._r8) - - ! reduce_dayl_factor .eqv. .false. - if (reduce_dayl_factor .eqv. .true.) then - if (dayl_factor(p) > 0.25_r8) then - ! dayl_factor(p) = 1.0_r8 - end if - end if - - - ! Default - if (vcmax_opt == 0) then - ! vcmax25 at canopy top, as in CN but using lnc at top of the canopy - vcmax25top = lnc(p) * flnr(patch%itype(p)) * fnr * act25 * dayl_factor(p) - if (.not. use_cn) then - vcmax25top = vcmax25top * fnitr(patch%itype(p)) - else - if ( CNAllocate_Carbon_only() ) vcmax25top = vcmax25top * fnitr(patch%itype(p)) - end if - else if (vcmax_opt == 3) then - vcmax25top = ( i_vcad(patch%itype(p)) + s_vcad(patch%itype(p)) * lnc(p) ) * dayl_factor(p) - else if (vcmax_opt == 4) then - nptreemax = 9 ! is this number correct? check later - if (patch%itype(p) >= nptreemax) then ! if not tree - ! for shrubs and herbs - vcmax25top = lnc(p) * ( i_flnr(patch%itype(p)) + s_flnr(patch%itype(p)) * lnc(p) ) * fnr * act25 * & - dayl_factor(p) - else - ! if tree - vcmax25top = lnc(p) * ( i_flnr(patch%itype(p)) * exp(s_flnr(patch%itype(p)) * lnc(p)) ) * fnr * act25 * & - dayl_factor(p) - ! for trees - end if - end if - - ! Parameters derived from vcmax25top. Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - ! used jmax25 = 1.97 vcmax25, from Wullschleger (1993) Journal of Experimental Botany 44:907-920. - - jmax25top = (2.59_r8 - 0.035_r8*min(max((t10(p)-tfrz),11._r8),35._r8)) * vcmax25top - tpu25top = 0.167_r8 * vcmax25top - kp25top = 20000._r8 * vcmax25top - luvcmax25top(p) = vcmax25top - lujmax25top(p) = jmax25top - lutpu25top(p)=tpu25top - - ! Nitrogen scaling factor. Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 used - ! kn = 0.11. Here, derive kn from vcmax25 as in Lloyd et al (2010) Biogeosciences, 7, 1833-1859 - ! Remove daylength factor from vcmax25 so that kn is based on maximum vcmax25 - ! But not used as defined here if using sun/shade big leaf code. Instead, - ! will use canopy integrated scaling factors from SurfaceAlbedo. - - if (dayl_factor(p) .eq. 0._r8) then - kn(p) = 0._r8 - else - kn(p) = exp(0.00963_r8 * vcmax25top/dayl_factor(p) - 2.43_r8) - end if - - if (use_cn) then - if ( leafresp_method == leafresp_mtd_ryan1991 ) then - ! Leaf maintenance respiration to match the base rate used in CN - ! but with the new temperature functions for C3 and C4 plants. - ! - ! Base rate for maintenance respiration is from: - ! M. Ryan, 1991. Effects of climate change on plant respiration. - ! Ecological Applications, 1(2), 157-167. - ! Original expression is br = 0.0106 molC/(molN h) - ! Conversion by molecular weights of C and N gives 2.525e-6 gC/(gN s) - ! - ! Base rate is at 20C. Adjust to 25C using the CN Q10 = 1.5 - ! - ! CN respiration has units: g C / g N [leaf] / s. This needs to be - ! converted from g C / g N [leaf] / s to umol CO2 / m**2 [leaf] / s - ! - ! Then scale this value at the top of the canopy for canopy depth - - lmr25top = 2.525e-6_r8 * (1.5_r8 ** ((25._r8 - 20._r8)/10._r8)) - lmr25top = lmr25top * lnc(p) / 12.e-06_r8 - - else if ( leafresp_method == leafresp_mtd_atkin2015 ) then - !using new form for respiration base rate from Atkin - !communication. - if ( lnc(p) > 0.0_r8 ) then - lmr25top = params_inst%lmr_intercept_atkin(ivt(p)) + (lnc(p) * 0.2061_r8) - (0.0402_r8 * (t10(p)-tfrz)) - else - lmr25top = 0.0_r8 - end if - end if - - else - ! Leaf maintenance respiration in proportion to vcmax25top - - if (c3flag(p)) then - lmr25top = vcmax25top * leaf_mr_vcm - else - lmr25top = vcmax25top * 0.025_r8 - end if - end if - - ! Loop through canopy layers (above snow). Respiration needs to be - ! calculated every timestep. Others are calculated only if daytime - - laican = 0._r8 - do iv = 1, nrad(p) - - ! Cumulative lai at middle of layer - - if (iv == 1) then - laican = 0.5_r8 * tlai_z(p,iv) - else - laican = laican + 0.5_r8 * (tlai_z(p,iv-1)+tlai_z(p,iv)) - end if - - ! Scale for leaf nitrogen profile. If multi-layer code, use explicit - ! profile. If sun/shade big leaf code, use canopy integrated factor. - - if (nlevcan == 1) then - nscaler_sun = vcmaxcint_sun(p) - nscaler_sha = vcmaxcint_sha(p) - else if (nlevcan > 1) then - nscaler_sun = exp(-kn(p) * laican) - nscaler_sha = exp(-kn(p) * laican) - end if - - ! Maintenance respiration - - lmr25_sun = lmr25top * nscaler_sun - lmr25_sha = lmr25top * nscaler_sha - - if(use_luna.and.c3flag(p).and.crop(patch%itype(p))== 0)then - if(.not.use_cn)then ! If CN is on, use leaf N to predict respiration (above). Otherwise, use Vcmax term from LUNA. RF - lmr25_sun = leaf_mr_vcm * photosyns_inst%vcmx25_z_patch(p,iv) - lmr25_sha = leaf_mr_vcm * photosyns_inst%vcmx25_z_patch(p,iv) - endif - endif - - if (c3flag(p)) then - lmr_z_sun(p,iv) = lmr25_sun * ft(t_veg(p), lmrha) * fth(t_veg(p), lmrhd, lmrse, lmrc) - lmr_z_sha(p,iv) = lmr25_sha * ft(t_veg(p), lmrha) * fth(t_veg(p), lmrhd, lmrse, lmrc) - else - lmr_z_sun(p,iv) = lmr25_sun * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - lmr_z_sun(p,iv) = lmr_z_sun(p,iv) / (1._r8 + exp( 1.3_r8*(t_veg(p)-(tfrz+55._r8)) )) - lmr_z_sha(p,iv) = lmr25_sha * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - lmr_z_sha(p,iv) = lmr_z_sha(p,iv) / (1._r8 + exp( 1.3_r8*(t_veg(p)-(tfrz+55._r8)) )) - end if - - ! Reduce lmr w/ low lai - lmr_z_sun(p,iv) = lmr_z_sun(p,iv)*min((0.2_r8*exp(3.218_r8*tlai_z(p,iv))),1._r8) - lmr_z_sha(p,iv) = lmr_z_sha(p,iv)*min((0.2_r8*exp(3.218_r8*tlai_z(p,iv))),1._r8) - - if (par_z_sun(p,iv) <= 0._r8) then ! night time - - vcmax_z(p,sun,iv) = 0._r8 - jmax_z(p,sun,iv) = 0._r8 - tpu_z(p,sun,iv) = 0._r8 - kp_z(p,sun,iv) = 0._r8 - - vcmax_z(p,sha,iv) = 0._r8 - jmax_z(p,sha,iv) = 0._r8 - tpu_z(p,sha,iv) = 0._r8 - kp_z(p,sha,iv) = 0._r8 - - if ( use_c13 ) then - alphapsn_sun(p) = 1._r8 - alphapsn_sha(p) = 1._r8 - end if - - else ! day time - - if(use_luna.and.c3flag(p).and.crop(patch%itype(p))== 0)then - vcmax25_sun = photosyns_inst%vcmx25_z_patch(p,iv) - vcmax25_sha = photosyns_inst%vcmx25_z_patch(p,iv) - jmax25_sun = photosyns_inst%jmx25_z_patch(p,iv) - jmax25_sha = photosyns_inst%jmx25_z_patch(p,iv) - tpu25_sun = 0.167_r8 * vcmax25_sun - tpu25_sha = 0.167_r8 * vcmax25_sha - if(surfalb_inst%vcmaxcintsun_patch(p).gt.0._r8.and.nlevcan==1) then - vcmax25_sha = vcmax25_sun * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) - jmax25_sha = jmax25_sun * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) - tpu25_sha = tpu25_sun * surfalb_inst%vcmaxcintsha_patch(p)/surfalb_inst%vcmaxcintsun_patch(p) - end if - else - vcmax25_sun = vcmax25top * nscaler_sun - jmax25_sun = jmax25top * nscaler_sun - tpu25_sun = tpu25top * nscaler_sun - vcmax25_sha = vcmax25top * nscaler_sha - jmax25_sha = jmax25top * nscaler_sha - tpu25_sha = tpu25top * nscaler_sha - endif - kp25_sun = kp25top * nscaler_sun - kp25_sha = kp25top * nscaler_sha - - ! Adjust for temperature - - vcmaxse = 668.39_r8 - 1.07_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - jmaxse = 659.70_r8 - 0.75_r8 * min(max((t10(p)-tfrz),11._r8),35._r8) - tpuse = vcmaxse - vcmaxc = fth25 (vcmaxhd, vcmaxse) - jmaxc = fth25 (jmaxhd, jmaxse) - tpuc = fth25 (tpuhd, tpuse) - vcmax_z(p,sun,iv) = vcmax25_sun * ft(t_veg(p), vcmaxha) * fth(t_veg(p), vcmaxhd, vcmaxse, vcmaxc) - jmax_z(p,sun,iv) = jmax25_sun * ft(t_veg(p), jmaxha) * fth(t_veg(p), jmaxhd, jmaxse, jmaxc) - tpu_z(p,sun,iv) = tpu25_sun * ft(t_veg(p), tpuha) * fth(t_veg(p), tpuhd, tpuse, tpuc) - vcmax_z(p,sha,iv) = vcmax25_sha * ft(t_veg(p), vcmaxha) * fth(t_veg(p), vcmaxhd, vcmaxse, vcmaxc) - jmax_z(p,sha,iv) = jmax25_sha * ft(t_veg(p), jmaxha) * fth(t_veg(p), jmaxhd, jmaxse, jmaxc) - tpu_z(p,sha,iv) = tpu25_sha * ft(t_veg(p), tpuha) * fth(t_veg(p), tpuhd, tpuse, tpuc) - - if (.not. c3flag(p)) then - vcmax_z(p,sun,iv) = vcmax25_sun * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - vcmax_z(p,sun,iv) = vcmax_z(p,sun,iv) / (1._r8 + exp( 0.2_r8*((tfrz+15._r8)-t_veg(p)) )) - vcmax_z(p,sun,iv) = vcmax_z(p,sun,iv) / (1._r8 + exp( 0.3_r8*(t_veg(p)-(tfrz+40._r8)) )) - vcmax_z(p,sha,iv) = vcmax25_sha * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - vcmax_z(p,sha,iv) = vcmax_z(p,sha,iv) / (1._r8 + exp( 0.2_r8*((tfrz+15._r8)-t_veg(p)) )) - vcmax_z(p,sha,iv) = vcmax_z(p,sha,iv) / (1._r8 + exp( 0.3_r8*(t_veg(p)-(tfrz+40._r8)) )) - end if - - kp_z(p,sun,iv) = kp25_sun * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - kp_z(p,sha,iv) = kp25_sha * 2._r8**((t_veg(p)-(tfrz+25._r8))/10._r8) - - end if - - ! Change to add in light inhibition of respiration. 0.67 from Lloyd et al. 2010, & Metcalfe et al. 2012 - ! Also pers. comm from Peter Reich (Nov 2015). Might potentially be updated pending findings of Atkin et al. (in prep) - ! review of light inhibition database. - if ( light_inhibit .and. par_z_sun(p,1) > 0._r8) then ! are the lights on? - lmr_z_sun(p,iv) = lmr_z_sun(p,iv) * 0.67_r8 ! inhibit respiration accordingly. - end if - if ( light_inhibit .and. par_z_sha(p,1) > 0._r8) then ! are the lights on? - lmr_z_sha(p,iv) = lmr_z_sha(p,iv) * 0.67_r8 ! inhibit respiration accordingly. - end if - - end do ! canopy layer loop - end do ! patch loop - - !==============================================================================! - ! Leaf-level photosynthesis and stomatal conductance - !==============================================================================! - - rsmax0 = 2.e4_r8 - - do f = 1, fn - p = filterp(f) - c = patch%column(p) - g = patch%gridcell(p) - - ! Leaf boundary layer conductance, umol/m**2/s - - cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e06_r8 - gb = 1._r8/rb(p) - gb_mol(p) = gb * cf - - ! Loop through canopy layers (above snow). Only do calculations if daytime - - do iv = 1, nrad(p) - - if (par_z_sun(p,iv) <= 0._r8) then ! night time - - !zqz temporary signal for night time - vegwp(p,sun)=1._r8 - - if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - gsminsun = bbb(p) - gsminsha = bbb(p) - else if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - gsminsun = medlynintercept(patch%itype(p)) - gsminsha = medlynintercept(patch%itype(p)) - else - gsminsun = nan - gsminsha = nan - end if - call calcstress(p,c,vegwp(p,:),bsun(p),bsha(p),gb_mol(p),gsminsun, gsminsha, & - qsatl(p),qaf(p), atm2lnd_inst,canopystate_inst,waterstate_inst, & - soilstate_inst,temperature_inst, waterflux_inst) - - ac(p,sun,iv) = 0._r8 - aj(p,sun,iv) = 0._r8 - ap(p,sun,iv) = 0._r8 - ag(p,sun,iv) = 0._r8 - if(crop(patch%itype(p))== 0 .or. .not. modifyphoto_and_lmr_forcrop) then - an_sun(p,iv) = ag(p,sun,iv) - bsun(p) * lmr_z_sun(p,iv) - else - an_sun(p,iv) = ag(p,sun,iv) - lmr_z_sun(p,iv) - endif - psn_z_sun(p,iv) = 0._r8 - psn_wc_z_sun(p,iv) = 0._r8 - psn_wj_z_sun(p,iv) = 0._r8 - psn_wp_z_sun(p,iv) = 0._r8 - rs_z_sun(p,iv) = min(rsmax0, 1._r8/(max( bsun(p)*gsminsun, 1._r8 )) * cf) - ci_z_sun(p,iv) = 0._r8 - rh_leaf_sun(p) = 0._r8 - - ac(p,sha,iv) = 0._r8 - aj(p,sha,iv) = 0._r8 - ap(p,sha,iv) = 0._r8 - ag(p,sha,iv) = 0._r8 - if(crop(patch%itype(p))== 0 .or. .not. modifyphoto_and_lmr_forcrop) then - an_sha(p,iv) = ag(p,sha,iv) - bsha(p) * lmr_z_sha(p,iv) - else - an_sha(p,iv) = ag(p,sha,iv) - lmr_z_sha(p,iv) - endif - psn_z_sha(p,iv) = 0._r8 - psn_wc_z_sha(p,iv) = 0._r8 - psn_wj_z_sha(p,iv) = 0._r8 - psn_wp_z_sha(p,iv) = 0._r8 - rs_z_sha(p,iv) = min(rsmax0, 1._r8/(max( bsha(p)*gsminsha, 1._r8 )) * cf) - ci_z_sha(p,iv) = 0._r8 - rh_leaf_sha(p) = 0._r8 - - else ! day time - - !now the constraint is no longer needed, Jinyun Tang - ceair = min( eair(p), esat_tv(p) ) - if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - rh_can = ceair / esat_tv(p) - else if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - ! Put some constraints on RH in the canopy when Medlyn stomatal conductance is being used - rh_can = max((esat_tv(p) - ceair), 50._r8) * 0.001_r8 - end if - - ! Electron transport rate for C3 plants. Convert par from W/m2 to - ! umol photons/m**2/s using the factor 4.6 - - ! sun - qabs = 0.5_r8 * (1._r8 - fnps) * par_z_sun(p,iv) * 4.6_r8 - aquad = theta_psii - bquad = -(qabs + jmax_z(p,sun,iv)) - cquad = qabs * jmax_z(p,sun,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - je_sun = min(r1,r2) - - ! sha - qabs = 0.5_r8 * (1._r8 - fnps) * par_z_sha(p,iv) * 4.6_r8 - aquad = theta_psii - bquad = -(qabs + jmax_z(p,sha,iv)) - cquad = qabs * jmax_z(p,sha,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - je_sha = min(r1,r2) - - ! Iterative loop for ci beginning with initial guess - - if (c3flag(p)) then - ci_z_sun(p,iv) = 0.7_r8 * cair(p) - ci_z_sha(p,iv) = 0.7_r8 * cair(p) - else - ci_z_sun(p,iv) = 0.4_r8 * cair(p) - ci_z_sha(p,iv) = 0.4_r8 * cair(p) - end if - - !find ci and stomatal conductance - call hybrid_PHS(ci_z_sun(p,iv), ci_z_sha(p,iv), p, iv, c, gb_mol(p), bsun(p),bsha(p), je_sun, & - je_sha, cair(p), oair(p), lmr_z_sun(p,iv), lmr_z_sha(p,iv), & - par_z_sun(p,iv), par_z_sha(p,iv), rh_can, gs_mol_sun(p,iv), gs_mol_sha(p,iv), & - qsatl(p), qaf(p), iter1, iter2, atm2lnd_inst, photosyns_inst, & - canopystate_inst, waterstate_inst, soilstate_inst, temperature_inst, waterflux_inst) - if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - gsminsun = medlynintercept(patch%itype(p)) - gsminsha = medlynintercept(patch%itype(p)) - gs_slope_sun = medlynslope(patch%itype(p)) - gs_slope_sha = medlynslope(patch%itype(p)) - else if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - gsminsun = bbb(p) - gsminsha = bbb(p) - gs_slope_sun = mbb(p) - gs_slope_sha = mbb(p) - end if - - ! End of ci iteration. Check for an < 0, in which case gs_mol = bbb - - if (an_sun(p,iv) < 0._r8) gs_mol_sun(p,iv) = max( bsun(p)*gsminsun, 1._r8 ) - if (an_sha(p,iv) < 0._r8) gs_mol_sha(p,iv) = max( bsha(p)*gsminsha, 1._r8 ) - ! Get local noon sunlit and shaded stomatal conductance - local_secp1 = secs + nint((grc%londeg(g)/degpsec)/dtime)*dtime - local_secp1 = mod(local_secp1,isecspday) - ! Use time period 1 hour before and 1 hour after local noon inclusive (11AM-1PM) - if (local_secp1 >= (isecspday/2 - 3600) .and. local_secp1 <= (isecspday/2 + 3600)) then - gs_mol_sun_ln(p,iv) = gs_mol_sun(p,iv) - gs_mol_sha_ln(p,iv) = gs_mol_sha(p,iv) - else - gs_mol_sun_ln(p,iv) = spval - gs_mol_sha_ln(p,iv) = spval - end if - - ! Final estimates for cs and ci (needed for early exit of ci iteration when an < 0) - - cs_sun = cair(p) - 1.4_r8/gb_mol(p) * an_sun(p,iv) * forc_pbot(c) - cs_sun = max(cs_sun,1.e-06_r8) - ci_z_sun(p,iv) = cair(p) - an_sun(p,iv) * forc_pbot(c) * & - (1.4_r8*gs_mol_sun(p,iv)+1.6_r8*gb_mol(p)) / & - (gb_mol(p)*gs_mol_sun(p,iv)) - - ! Trap for values of ci_z_sun less than 1.e-06. This is needed for - ! Megan (which can crash with negative values) - ci_z_sun(p,iv) = max( ci_z_sun(p,iv), 1.e-06_r8 ) - - cs_sha = cair(p) - 1.4_r8/gb_mol(p) * an_sha(p,iv) * forc_pbot(c) - cs_sha = max(cs_sha,1.e-06_r8) - ci_z_sha(p,iv) = cair(p) - an_sha(p,iv) * forc_pbot(c) * & - (1.4_r8*gs_mol_sha(p,iv)+1.6_r8*gb_mol(p)) / & - (gb_mol(p)*gs_mol_sha(p,iv)) - - ! Trap for values of ci_z_sha less than 1.e-06. This is needed for - ! Megan (which can crash with negative values) - ci_z_sha(p,iv) = max( ci_z_sha(p,iv), 1.e-06_r8 ) - - ! Convert gs_mol (umol H2O/m**2/s) to gs (m/s) and then to rs (s/m) - - gs = gs_mol_sun(p,iv) / cf - rs_z_sun(p,iv) = min(1._r8/gs, rsmax0) - rs_z_sun(p,iv) = rs_z_sun(p,iv) / o3coefg_sun(p) - gs = gs_mol_sha(p,iv) / cf - rs_z_sha(p,iv) = min(1._r8/gs, rsmax0) - rs_z_sha(p,iv) = rs_z_sha(p,iv) / o3coefg_sha(p) - - ! Photosynthesis. Save rate-limiting photosynthesis - - psn_z_sun(p,iv) = ag(p,sun,iv) - psn_z_sun(p,iv) = psn_z_sun(p,iv) * o3coefv_sun(p) - - psn_wc_z_sun(p,iv) = 0._r8 - psn_wj_z_sun(p,iv) = 0._r8 - psn_wp_z_sun(p,iv) = 0._r8 - - if (ac(p,sun,iv) <= aj(p,sun,iv) .and. ac(p,sun,iv) <= ap(p,sun,iv)) then - psn_wc_z_sun(p,iv) = psn_z_sun(p,iv) - else if (aj(p,sun,iv) < ac(p,sun,iv) .and. aj(p,sun,iv) <= ap(p,sun,iv)) then - psn_wj_z_sun(p,iv) = psn_z_sun(p,iv) - else if (ap(p,sun,iv) < ac(p,sun,iv) .and. ap(p,sun,iv) < aj(p,sun,iv)) then - psn_wp_z_sun(p,iv) = psn_z_sun(p,iv) - end if - - psn_z_sha(p,iv) = ag(p,sha,iv) - psn_z_sha(p,iv) = psn_z_sha(p,iv) * o3coefv_sha(p) - - psn_wc_z_sha(p,iv) = 0._r8 - psn_wj_z_sha(p,iv) = 0._r8 - psn_wp_z_sha(p,iv) = 0._r8 - - if (ac(p,sha,iv) <= aj(p,sha,iv) .and. ac(p,sha,iv) <= ap(p,sha,iv)) then - psn_wc_z_sha(p,iv) = psn_z_sha(p,iv) - else if (aj(p,sha,iv) < ac(p,sha,iv) .and. aj(p,sha,iv) <= ap(p,sha,iv)) then - psn_wj_z_sha(p,iv) = psn_z_sha(p,iv) - else if (ap(p,sha,iv) < ac(p,sha,iv) .and. ap(p,sha,iv) < aj(p,sha,iv)) then - psn_wp_z_sha(p,iv) = psn_z_sha(p,iv) - end if - - ! Make sure iterative solution is correct - - if (gs_mol_sun(p,iv) < 0._r8 .or. gs_mol_sha(p,iv) < 0._r8) then - write (iulog,*)'Negative stomatal conductance:' - write (iulog,*)'p,iv,gs_mol_sun,gs_mol_sha= ',p,iv,gs_mol_sun(p,iv),gs_mol_sha(p,iv) - call endrun(decomp_index=p, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - - ! Compare with Ball-Berry model: gs_mol = m * an * hs/cs p + b - - hs = (gb_mol(p)*ceair + gs_mol_sun(p,iv)*esat_tv(p)) / ((gb_mol(p)+gs_mol_sun(p,iv))*esat_tv(p)) - rh_leaf_sun(p) = hs - gs_mol_err = gs_slope_sun*max(an_sun(p,iv), 0._r8)*hs/cs_sun*forc_pbot(c) + max( bsun(p)*gsminsun, 1._r8 ) - - if (abs(gs_mol_sun(p,iv)-gs_mol_err) > 1.e-01_r8 .and. (stomatalcond_mtd == stomatalcond_mtd_bb1987) ) then - write (iulog,*) 'Ball-Berry error check - sunlit stomatal conductance error:' - write (iulog,*) gs_mol_sun(p,iv), gs_mol_err - end if - - hs = (gb_mol(p)*ceair + gs_mol_sha(p,iv)*esat_tv(p)) / ((gb_mol(p)+gs_mol_sha(p,iv))*esat_tv(p)) - rh_leaf_sha(p) = hs - gs_mol_err = gs_slope_sha*max(an_sha(p,iv), 0._r8)*hs/cs_sha*forc_pbot(c) + max( bsha(p)*gsminsha, 1._r8) - - if (abs(gs_mol_sha(p,iv)-gs_mol_err) > 1.e-01_r8 .and. (stomatalcond_mtd == stomatalcond_mtd_bb1987) ) then - write (iulog,*) 'Ball-Berry error check - shaded stomatal conductance error:' - write (iulog,*) gs_mol_sha(p,iv), gs_mol_err - end if - - end if ! night or day if branch - end do ! canopy layer loop - end do ! patch loop - - !==============================================================================! - ! Canopy photosynthesis and stomatal conductance - !==============================================================================! - - ! Sum canopy layer fluxes and then derive effective leaf-level fluxes (per - ! unit leaf area), which are used in other parts of the model. Here, laican - ! sums to either laisun or laisha. - - do f = 1, fn - p = filterp(f) - - psncan_sun = 0._r8 - psncan_wc_sun = 0._r8 - psncan_wj_sun = 0._r8 - psncan_wp_sun = 0._r8 - lmrcan_sun = 0._r8 - gscan_sun = 0._r8 - laican_sun = 0._r8 - do iv = 1, nrad(p) - psncan_sun = psncan_sun + psn_z_sun(p,iv) * lai_z_sun(p,iv) - psncan_wc_sun = psncan_wc_sun + psn_wc_z_sun(p,iv) * lai_z_sun(p,iv) - psncan_wj_sun = psncan_wj_sun + psn_wj_z_sun(p,iv) * lai_z_sun(p,iv) - psncan_wp_sun = psncan_wp_sun + psn_wp_z_sun(p,iv) * lai_z_sun(p,iv) - if(crop(patch%itype(p))== 0 .and. modifyphoto_and_lmr_forcrop) then - lmrcan_sun = lmrcan_sun + lmr_z_sun(p,iv) * lai_z_sun(p,iv) * bsun(p) - else - lmrcan_sun = lmrcan_sun + lmr_z_sun(p,iv) * lai_z_sun(p,iv) - endif - gscan_sun = gscan_sun + lai_z_sun(p,iv) / (rb(p)+rs_z_sun(p,iv)) - laican_sun = laican_sun + lai_z_sun(p,iv) - end do - if (laican_sun > 0._r8) then - psn_sun(p) = psncan_sun / laican_sun - psn_wc_sun(p) = psncan_wc_sun / laican_sun - psn_wj_sun(p) = psncan_wj_sun / laican_sun - psn_wp_sun(p) = psncan_wp_sun / laican_sun - lmr_sun(p) = lmrcan_sun / laican_sun - rs_sun(p) = laican_sun / gscan_sun - rb(p) - else - psn_sun(p) = 0._r8 - psn_wc_sun(p) = 0._r8 - psn_wj_sun(p) = 0._r8 - psn_wp_sun(p) = 0._r8 - lmr_sun(p) = 0._r8 - rs_sun(p) = 0._r8 - end if - psncan_sha = 0._r8 - psncan_wc_sha = 0._r8 - psncan_wj_sha = 0._r8 - psncan_wp_sha = 0._r8 - lmrcan_sha = 0._r8 - gscan_sha = 0._r8 - laican_sha = 0._r8 - do iv = 1, nrad(p) - psncan_sha = psncan_sha + psn_z_sha(p,iv) * lai_z_sha(p,iv) - psncan_wc_sha = psncan_wc_sha + psn_wc_z_sha(p,iv) * lai_z_sha(p,iv) - psncan_wj_sha = psncan_wj_sha + psn_wj_z_sha(p,iv) * lai_z_sha(p,iv) - psncan_wp_sha = psncan_wp_sha + psn_wp_z_sha(p,iv) * lai_z_sha(p,iv) - if(crop(patch%itype(p))== 0 .and. modifyphoto_and_lmr_forcrop) then - lmrcan_sha = lmrcan_sha + lmr_z_sha(p,iv) * lai_z_sha(p,iv) * bsha(p) - else - lmrcan_sha = lmrcan_sha + lmr_z_sha(p,iv) * lai_z_sha(p,iv) - endif - gscan_sha = gscan_sha + lai_z_sha(p,iv) / (rb(p)+rs_z_sha(p,iv)) - laican_sha = laican_sha + lai_z_sha(p,iv) - end do - if (laican_sha > 0._r8) then - psn_sha(p) = psncan_sha / laican_sha - psn_wc_sha(p) = psncan_wc_sha / laican_sha - psn_wj_sha(p) = psncan_wj_sha / laican_sha - psn_wp_sha(p) = psncan_wp_sha / laican_sha - lmr_sha(p) = lmrcan_sha / laican_sha - rs_sha(p) = laican_sha / gscan_sha - rb(p) - else - psn_sha(p) = 0._r8 - psn_wc_sha(p) = 0._r8 - psn_wj_sha(p) = 0._r8 - psn_wp_sha(p) = 0._r8 - lmr_sha(p) = 0._r8 - rs_sha(p) = 0._r8 - end if - - if ( laican_sha+laican_sun > 0._r8 ) then - btran(p) = bsun(p) * (laican_sun / (laican_sun + laican_sha)) + & - bsha(p) * (laican_sha / (laican_sun + laican_sha)) - else - ! In this case, bsun and bsha should have the same value and btran - ! can be set to either bsun or bsha. - btran(p) = bsun(p) - end if - - end do - - end associate - - end subroutine PhotosynthesisHydraulicStress - !------------------------------------------------------------------------------ - - !-------------------------------------------------------------------------------- - subroutine hybrid_PHS(x0sun, x0sha, p, iv, c, gb_mol, bsun, bsha, jesun, jesha, & - cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - gs_mol_sun, gs_mol_sha, qsatl, qaf, iter1, iter2, atm2lnd_inst, photosyns_inst, & - canopystate_inst, waterstate_inst, soilstate_inst, temperature_inst, waterflux_inst) - ! - !! DESCRIPTION: - !use a hybrid solver to find the root of the ci_func equation for sunlit and shaded leaves - ! f(x) = x- h(x) - !we want to find x, s.t. f(x) = 0. - !outside loop iterates for bsun/bsha, which are functions of stomatal conductance - !the hybrid approach combines the strength of the newton secant approach (find the solution domain) - !and the bisection approach implemented with the Brent's method to guarantee convergence. - ! - !! REVISION HISTORY: - ! - ! - !!USES: - ! - !! ARGUMENTS: - implicit none - real(r8), intent(inout) :: x0sun,x0sha ! initial guess and final value of the solution for cisun/cisha - integer , intent(in) :: p ! pft index - integer , intent(in) :: iv ! radiation canopy layer index - integer , intent(in) :: c ! column index - real(r8), intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8), intent(out) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) - real(r8), intent(out) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) - real(r8), intent(in) :: jesun ! sunlit leaf electron transport rate (umol electrons/m**2/s) - real(r8), intent(in) :: jesha ! shaded leaf electron transport rate (umol electrons/m**2/s) - real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) - real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) - real(r8), intent(in) :: lmr_z_sun ! sunlit canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), intent(in) :: lmr_z_sha ! shaded canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), intent(in) :: par_z_sun ! par absorbed per unit lai for sunlit canopy layer (w/m**2) - real(r8), intent(in) :: par_z_sha ! par absorbed per unit lai for shaded canopy layer (w/m**2) - real(r8), intent(in) :: rh_can ! canopy air relative humidity - real(r8), intent(out) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8), intent(out) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) - real(r8), intent(in) :: qsatl ! leaf specific humidity [kg/kg] - real(r8), intent(in) :: qaf ! humidity of canopy air [kg/kg] - integer, intent(out) :: iter1 ! number of iterations used to find appropriate bsun/bsha - integer, intent(out) :: iter2 ! number of iterations used to find cisun/cisha - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - ! - !! LOCAL VARIABLES - real(r8) :: x(nvegwcs) ! working copy of vegwp(p,:) - real(r8) :: gs0sun ! unstressed sunlit stomatal conductance - real(r8) :: gs0sha ! unstressed shaded stomatal conductance - logical :: havegs ! signals direction of calculation gs->qflx or qflx->gs - real(r8) :: soilflux ! total soil column transpiration [mm/s] - real(r8) :: x1sun ! second guess for cisun - real(r8) :: f0sun ! error of cifunc(x0sun) - real(r8) :: f1sun ! error of cifunc(x1sun) - real(r8) :: xsun ! open variable for brent to return cisun solution - real(r8) :: dxsun ! delta cisun from iter_i to iter_i+1 - real(r8) :: x1sha ! second guess for cisha - real(r8) :: f0sha ! error of cifunc(x0sha) - real(r8) :: f1sha ! error of cifunc(x1sha) - real(r8) :: xsha ! open variable for brent to return cisha solution - real(r8) :: dxsha ! delta cisha from iter_i to iter_i+1 - real(r8) :: b0sun ! bsun from previous iter - real(r8) :: b0sha ! bsha from previous iter - real(r8) :: dbsun ! delta(bsun) from iter_i to iter_i+1 - real(r8) :: dbsha ! delta(bsun) from iter_i to iter_i+1 - logical :: bflag ! signals to call calcstress to recalc bsun/bsha (or not) - real(r8) :: tolsun ! error tolerance for cisun solution [Pa] - real(r8) :: tolsha ! error tolerance for cisun solution [Pa] - real(r8) :: minf ! storage spot for best cisun/cisha solution - real(r8) :: minxsun ! cisun associated with minf - real(r8) :: minxsha ! cisha associated with minf - real(r8), parameter :: toldb = 1.e-2_r8 ! tolerance for satisfactory bsun/bsha solution - real(r8), parameter :: eps = 1.e-2_r8 ! relative accuracy - real(r8), parameter :: eps1= 1.e-4_r8 ! absolute accuracy threshold for fsun/fsha - integer , parameter :: itmax = 3 ! maximum number of iterations zqz (increase later) - !------------------------------------------------------------------------------ - - associate( & - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - vegwp => canopystate_inst%vegwp_patch & ! Input/Output: [real(r8) (:,:) ] vegetation water matric potential (mm) - ) - - - x1sun = x0sun - x1sha = x0sha - bflag = .false. - b0sun = -1._r8 - b0sha = -1._r8 - gs0sun = 0._r8 ! Initialize to zero as good form, not used on first itteration below because of bflag - gs0sha = 0._r8 ! Initialize to zero as good form, not used on first itteration below because of bflag - bsun = 1._r8 - bsha = 1._r8 - iter1 = 0 - - do !outer loop updates bsun/bsha and makes two ci_func calls for interpolation - x=vegwp(p,:) - iter1=iter1+1 - iter2=0 - x0sun=max(0.1_r8,x1sun) !need to make sure x0 .neq. x1 - x1sun=0.99_r8*x1sun - x0sha=max(0.1_r8,x1sha) - x1sha=0.99_r8*x1sha - tolsun = abs(x1sun) * eps - tolsha = abs(x1sha) * eps - - ! this ci_func_PHS call updates bsun/bsha (except on first iter) - call ci_func_PHS(x,x0sun, x0sha, f0sun, f0sha, p, iv, c, bsun, bsha, bflag, gb_mol, gs0sun, gs0sha,& - gs_mol_sun, gs_mol_sha, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - qsatl, qaf, atm2lnd_inst, photosyns_inst, canopystate_inst, waterstate_inst, soilstate_inst, & - temperature_inst, waterflux_inst) - - ! update bsun/bsha convergence vars - dbsun=b0sun-bsun - dbsha=b0sha-bsha - b0sun=bsun - b0sha=bsha - bflag=.false. - - ! this ci_func_PHS call creates second point for ci interpolation - call ci_func_PHS(x,x1sun, x1sha, f1sun, f1sha, p, iv, c, bsun, bsha, bflag, gb_mol, gs0sun, gs0sha,& - gs_mol_sun, gs_mol_sha, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - qsatl, qaf, atm2lnd_inst, photosyns_inst, canopystate_inst, waterstate_inst, soilstate_inst, & - temperature_inst, waterflux_inst) - - do !inner loop finds ci - if ( (abs(f0sun) < eps1) .and. (abs(f0sha) < eps1) ) then - x1sun=x0sun - x1sha=x0sha - exit - endif - if ( (abs(f1sun) < eps1) .and. (abs(f1sha) < eps1) ) then - exit - endif - iter2=iter2+1 - - if ( (f1sun - f0sun) == 0._r8) then - !makes next x1sun the midpt between current x1 & x0 - dxsun = 0.5_r8*(x1sun+x0sun)-x1sun - else - dxsun=-f1sun*(x1sun-x0sun)/(f1sun-f0sun) - end if - if ( (f1sha - f0sha) == 0._r8) then - dxsha = 0.5_r8*(x1sha+x0sha)-x1sha - else - dxsha=-f1sha*(x1sha-x0sha)/(f1sha-f0sha) - end if - x0sun=x1sun - x1sun=x1sun+dxsun - x0sha=x1sha - x1sha=x1sha+dxsha - - call ci_func_PHS(x,x1sun, x1sha, f1sun, f1sha, p, iv, c, bsun, bsha, bflag, gb_mol, gs0sun, gs0sha,& - gs_mol_sun, gs_mol_sha, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - qsatl, qaf, atm2lnd_inst, photosyns_inst, canopystate_inst, waterstate_inst, soilstate_inst, & - temperature_inst, waterflux_inst) - - if ( (abs(dxsun) < tolsun ) .and. (abs(dxsha) itmax) then - x1sun=minxsun - x1sha=minxsha - call ci_func_PHS(x,x1sun, x1sha, f1sun, f1sha, p, iv, c, bsun, bsha, bflag, gb_mol, gs0sun, gs0sha,& - gs_mol_sun, gs_mol_sha, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - qsatl, qaf, atm2lnd_inst, photosyns_inst, canopystate_inst, waterstate_inst, soilstate_inst, & - temperature_inst, waterflux_inst) - exit - endif - - enddo - - !update unstressed stomatal conductance - if (bsun>0.01_r8) then - gs0sun=gs_mol_sun/bsun - endif - if (bsha>0.01_r8) then - gs0sha=gs_mol_sha/bsha - endif - - bflag=.true. - - if ( (abs(dbsun) < toldb) .and. (abs(dbsha) < toldb) ) then - exit - endif - - if (iter1 > itmax) then - exit - endif - - enddo - x0sun=x1sun - x0sha=x1sha - - !set vegwp for the final gs_mol solution - call getvegwp(p, c, x, gb_mol, gs_mol_sun, gs_mol_sha, qsatl, qaf, soilflux, & - atm2lnd_inst, canopystate_inst, waterstate_inst, soilstate_inst, temperature_inst) - vegwp(p,:)=x - if (soilflux<0._r8) soilflux = 0._r8 - qflx_tran_veg(p) = soilflux - - end associate - - end subroutine hybrid_PHS - !-------------------------------------------------------------------------------- - - !------------------------------------------------------------------------------ - subroutine brent_PHS(xsun, x1sun, x2sun, f1sun, f2sun, xsha, x1sha, x2sha, f1sha, f2sha, & - tol, ip, iv, ic, gb_mol, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha,& - rh_can, gs_mol_sun, gs_mol_sha, bsun, bsha, qsatl, qaf, atm2lnd_inst, photosyns_inst, & - canopystate_inst, waterstate_inst, soilstate_inst, temperature_inst, waterflux_inst) - !------------------------------------------------------------------------------ - implicit none - ! - !!DESCRIPTION: - !Use Brent's method to find the root of a single variable function ci_func, which is known to exist between x1 and x2. - !The found root will be updated until its accuracy is tol. Performed for cisun and cisha. - ! - !!REVISION HISTORY: - ! - !!ARGUMENTS: - real(r8), intent(out) :: xsun ! independent variable of the single value function ci_func(x) - real(r8), intent(in) :: x1sun, x2sun ! minimum and maximum of the variable domain to search for the solution ci_func(x1) = f1, ci_func(x2)=f2 - real(r8), intent(in) :: f1sun, f2sun ! minimum and maximum of the variable domain to search for the solution ci_func(x1) = f1, ci_func(x2)=f2 - real(r8), intent(out) :: xsha ! independent variable of the single value function ci_func(x) - real(r8), intent(in) :: x1sha, x2sha ! minimum and maximum of the variable domain to search for the solution ci_func(x1) = f1, ci_func(x2)=f2 - real(r8), intent(in) :: f1sha, f2sha ! minimum and maximum of the variable domain to search for the solution ci_func(x1) = f1, ci_func(x2)=f2 - real(r8), intent(in) :: tol ! the error tolerance - integer , intent(in) :: ip, iv, ic ! pft, c3/c4, and column index - real(r8), intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8), intent(in) :: jesun,jesha ! electron transport rate (umol electrons/m**2/s) - real(r8), intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) - real(r8), intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) - real(r8), intent(in) :: lmr_z_sun, lmr_z_sha ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8), intent(in) :: par_z_sun, par_z_sha ! par absorbed per unit lai for canopy layer (w/m**2) - real(r8), intent(in) :: rh_can ! inside canopy relative humidity - real(r8), intent(out) :: gs_mol_sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8), intent(out) :: gs_mol_sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) - real(r8), intent(inout) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) - real(r8), intent(inout) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) - real(r8), intent(in) :: qsatl ! leaf specific humidity [kg/kg] - real(r8), intent(in) :: qaf ! humidity of canopy air [kg/kg] - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - !------------------------------------------------------------------------------ - ! !LOCAL VARIABLES: - real(r8) :: gs0sun ! sunlit leaf stomatal conductance (umol H2O/m**2/s) - real(r8) :: gs0sha ! shaded leaf stomatal conductance (umol H2O/m**2/s) - integer :: phase ! sun==1, sha==2 - integer , parameter :: nphs = 2 ! number of phases for sun/shade - integer , parameter :: itmax = 20 ! maximum number of iterations - real(r8), parameter :: eps = 1.e-4_r8 ! relative error tolerance - integer :: iter ! - real(r8) :: a(nphs),b(nphs),c(nphs),d(nphs),e(nphs),fa(nphs),fb(nphs),fc(nphs) - real(r8) :: p(nphs),q(nphs),r(nphs),s(nphs),tol1(nphs),xm(nphs) - real(r8) :: x(nvegwcs) !dummy variable passed to cifunc - logical , parameter :: bflag = .false. !indicates the cifunc should not call calcstress - !------------------------------------------------------------------------------ - - a(:)=(/x1sun,x1sha/) - b(:)=(/x2sun,x2sha/) - fa(:)=(/f1sun,f1sha/) - fb(:)=(/f2sun,f2sha/) - - do phase=1, nphs - if ( (fa(phase) > 0._r8 .and. fb(phase) > 0._r8) .or. (fa(phase) < 0._r8 .and. fb(phase) < 0._r8) ) then - write(iulog,*) 'root must be bracketed for brent' - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - enddo - - c=b - fc=fb - iter = 0 - do - if( iter == itmax ) exit - iter=iter+1 - - do phase=1, nphs - if( (fb(phase) > 0._r8 .and. fc(phase) > 0._r8) .or. (fb(phase) < 0._r8 .and. fc(phase) < 0._r8)) then - c(phase)=a(phase) !Rename a, b, c and adjust bounding interval d. - fc(phase)=fa(phase) - d(phase)=b(phase)-a(phase) - e(phase)=d(phase) - endif - if( abs(fc(phase)) < abs(fb(phase)) ) then - a(phase)=b(phase) - b(phase)=c(phase) - c(phase)=a(phase) - fa(phase)=fb(phase) - fb(phase)=fc(phase) - fc(phase)=fa(phase) - endif - enddo - tol1=2._r8*eps*abs(b)+0.5_r8*tol !Convergence check. - xm=0.5_r8*(c-b) - - if( abs(xm(sun)) <= tol1(sun) .or. fb(sun) == 0._r8 ) then - if( abs(xm(sha)) <= tol1(sha) .or. fb(sha) == 0._r8 ) then - xsun=b(sun) - xsha=b(sha) - return - endif - endif - - do phase=1, nphs - if( abs(e(phase)) >= tol1(phase) .and. abs(fa(phase)) > abs(fb(phase)) ) then - s(phase)=fb(phase)/fa(phase) !Attempt inverse quadratic interpolation. - if(a(phase) == c(phase)) then - p(phase)=2._r8*xm(phase)*s(phase) - q(phase)=1._r8-s(phase) - else - q(phase)=fa(phase)/fc(phase) - r(phase)=fb(phase)/fc(phase) - p(phase)=s(phase)*(2._r8*xm(phase)*q(phase)*(q(phase)-r(phase))-(b(phase)-a(phase))*(r(phase)-1._r8)) - q(phase)=(q(phase)-1._r8)*(r(phase)-1._r8)*(s(phase)-1._r8) - endif - if( p(phase) > 0._r8 ) q(phase)=-q(phase) !Check whether in bounds. - p(phase)=abs(p(phase)) - if( 2._r8*p(phase) < min(3._r8*xm(phase)*q(phase)-abs(tol1(phase)*q(phase)),abs(e(phase)*q(phase))) ) then - e(phase)=d(phase) !Accept interpolation. - d(phase)=p(phase)/q(phase) - else - d(phase)=xm(phase) !Interpolation failed, use bisection. - e(phase)=d(phase) - endif - else !Bounds decreasing too slowly, use bisection. - d(phase)=xm(phase) - e(phase)=d(phase) - endif - a(phase)=b(phase) !Move last best guess to a. - fa(phase)=fb(phase) - if( abs(d(phase)) > tol1(phase) ) then !Evaluate new trial root. - b(phase)=b(phase)+d(phase) - else - b(phase)=b(phase)+sign(tol1(phase),xm(phase)) - endif - enddo - - gs0sun = gs_mol_sun - gs0sha = gs_mol_sha - call ci_func_PHS(x,b(sun), b(sha), fb(sun), fb(sha), ip, iv, ic, bsun, bsha, bflag, gb_mol, gs0sun, gs0sha, & - gs_mol_sun, gs_mol_sha, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - qsatl, qaf, atm2lnd_inst, photosyns_inst, canopystate_inst, waterstate_inst, soilstate_inst, & - temperature_inst, waterflux_inst) - - if( (fb(sun) == 0._r8) .and. (fb(sha) == 0._r8) ) exit - enddo - if( iter == itmax) write(iulog,*) 'brent exceeding maximum iterations', b, fb - xsun=b(sun) - xsha=b(sha) - - return - - end subroutine brent_PHS - !-------------------------------------------------------------------------------- - - !------------------------------------------------------------------------------ - subroutine ci_func_PHS(x,cisun, cisha, fvalsun, fvalsha, p, iv, c, bsun, bsha, bflag, gb_mol, gs0sun, gs0sha,& - gs_mol_sun, gs_mol_sha, jesun, jesha, cair, oair, lmr_z_sun, lmr_z_sha, par_z_sun, par_z_sha, rh_can, & - qsatl, qaf, atm2lnd_inst, photosyns_inst, canopystate_inst, waterstate_inst, soilstate_inst, & - temperature_inst, waterflux_inst) - !------------------------------------------------------------------------------ - ! - ! !DESCRIPTION: - ! evaluate the function - ! f(ci)=ci - (ca - (1.37rb+1.65rs))*patm*an for sunlit and shaded leaves - ! - ! !REVISION HISTORY: - ! - ! - ! !USES: - use clm_varpar , only : nlevsoi - implicit none - ! - ! !ARGUMENTS: - real(r8) , intent(inout) :: x(nvegwcs) ! working copy of vegwp(p,:) - real(r8) , intent(in) :: cisun,cisha ! intracellular leaf CO2 (Pa) - real(r8) , intent(out) :: fvalsun,fvalsha ! return function of the value f(ci) - integer , intent(in) :: p,c,iv ! pft, column, and radiation indexes - real(r8) , intent(inout) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) - real(r8) , intent(inout) :: bsha ! shaded canopy transpiration wetness factor (0 to 1) - logical , intent(in) :: bflag ! signals to call calcstress to recalc bsun/bsha (or not) - real(r8) , intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8) , intent(in) :: gs0sun,gs0sha ! local gs_mol copies - real(r8) , intent(inout) :: gs_mol_sun,gs_mol_sha !leaf stomatal conductance (umol H2O/m**2/s) - real(r8) , intent(in) :: jesun, jesha ! electron transport rate (umol electrons/m**2/s) - real(r8) , intent(in) :: cair ! Atmospheric CO2 partial pressure (Pa) - real(r8) , intent(in) :: oair ! Atmospheric O2 partial pressure (Pa) - real(r8) , intent(in) :: lmr_z_sun, lmr_z_sha ! canopy layer: leaf maintenance respiration rate (umol CO2/m**2/s) - real(r8) , intent(in) :: par_z_sun, par_z_sha ! par absorbed per unit lai for canopy layer (w/m**2) - real(r8) , intent(in) :: rh_can ! canopy air relative humidity - real(r8) , intent(in) :: qsatl ! leaf specific humidity [kg/kg] - real(r8) , intent(in) :: qaf ! humidity of canopy air [kg/kg] - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - - ! !LOCAL VARIABLES: - real(r8) :: ai ! intermediate co-limited photosynthesis (umol CO2/m**2/s) - real(r8) :: cs_sun,cs_sha ! CO2 partial pressure at leaf surface (Pa) - real(r8) :: aquad, bquad, cquad ! terms for quadratic equations - real(r8) :: r1, r2 ! roots of quadratic equation - real(r8) :: fnps ! fraction of light absorbed by non-photosynthetic pigments - real(r8) :: theta_psii ! empirical curvature parameter for electron transport rate - real(r8) :: theta_ip ! empirical curvature parameter for ap photosynthesis co-limitation - real(r8) :: term ! intermediate in Medlyn stomatal model - ! - !------------------------------------------------------------------------------ - - associate( & - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - c3flag => photosyns_inst%c3flag_patch , & ! Input: [logical (:) ] true if C3 and false if C4 - medlynslope=> pftcon%medlynslope , & ! Input: [real(r8) (:) ] Slope for Medlyn stomatal conductance model method - medlynintercept=> pftcon%medlynintercept , & ! Input: [real(r8) (:) ] Intercept for Medlyn stomatal conductance model method - stomatalcond_mtd=> photosyns_inst%stomatalcond_mtd , & ! Input: [integer ] method type to use for stomatal conductance.GC.fnlprmsn15_r22845 - ac => photosyns_inst%ac_phs_patch , & ! Output: [real(r8) (:,:,:) ] Rubisco-limited gross photosynthesis (umol CO2/m**2/s) - aj => photosyns_inst%aj_phs_patch , & ! Output: [real(r8) (:,:,:) ] RuBP-limited gross photosynthesis (umol CO2/m**2/s) - ap => photosyns_inst%ap_phs_patch , & ! Output: [real(r8) (:,:,:) ] product-limited (C3) or CO2-limited (C4) gross photosynthesis (umol CO2/m**2/s) - ag => photosyns_inst%ag_phs_patch , & ! Output: [real(r8) (:,:,:) ] co-limited gross leaf photosynthesis (umol CO2/m**2/s) - vcmax_z => photosyns_inst%vcmax_z_phs_patch , & ! Input: [real(r8) (:,:,:) ] maximum rate of carboxylation (umol co2/m**2/s) - cp => photosyns_inst%cp_patch , & ! Output: [real(r8) (:) ] CO2 compensation point (Pa) - kc => photosyns_inst%kc_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for CO2 (Pa) - ko => photosyns_inst%ko_patch , & ! Output: [real(r8) (:) ] Michaelis-Menten constant for O2 (Pa) - qe => photosyns_inst%qe_patch , & ! Output: [real(r8) (:) ] quantum efficiency, used only for C4 (mol CO2 / mol photons) - tpu_z => photosyns_inst%tpu_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] triose phosphate utilization rate (umol CO2/m**2/s) - kp_z => photosyns_inst%kp_z_phs_patch , & ! Output: [real(r8) (:,:,:) ] initial slope of CO2 response curve (C4 plants) - theta_cj => photosyns_inst%theta_cj_patch , & ! Output: [real(r8) (:) ] empirical curvature parameter for ac, aj photosynthesis co-limitation - bbb => photosyns_inst%bbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - mbb => photosyns_inst%mbb_patch , & ! Output: [real(r8) (:) ] Ball-Berry slope of conductance-photosynthesis relationship - an_sun => photosyns_inst%an_sun_patch , & ! Output: [real(r8) (:,:) ] net sunlit leaf photosynthesis (umol CO2/m**2/s) - an_sha => photosyns_inst%an_sha_patch & ! Output: [real(r8) (:,:) ] net shaded leaf photosynthesis (umol CO2/m**2/s) - ) - - !------------------------------------------------------------------------------ - ! Miscellaneous parameters, from Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 - fnps = 0.15_r8 - theta_psii = 0.7_r8 - theta_ip = 0.95_r8 - - if (bflag) then !zqz what if bsun==0 ... doesn't break... but follow up - - call calcstress(p,c,x,bsun,bsha,gb_mol,gs0sun,gs0sha,qsatl,qaf, & - atm2lnd_inst,canopystate_inst,waterstate_inst,soilstate_inst, & - temperature_inst, waterflux_inst) - endif - - if (c3flag(p)) then - ! C3: Rubisco-limited photosynthesis - ac(p,sun,iv) = bsun * vcmax_z(p,sun,iv) * max(cisun-cp(p), 0._r8) / (cisun+kc(p)*(1._r8+oair/ko(p))) - ac(p,sha,iv) = bsha * vcmax_z(p,sha,iv) * max(cisha-cp(p), 0._r8) / (cisha+kc(p)*(1._r8+oair/ko(p))) - - ! C3: RuBP-limited photosynthesis - aj(p,sun,iv) = jesun * max(cisun-cp(p), 0._r8) / (4._r8*cisun+8._r8*cp(p)) - aj(p,sha,iv) = jesha * max(cisha-cp(p), 0._r8) / (4._r8*cisha+8._r8*cp(p)) - - ! C3: Product-limited photosynthesis - ap(p,sun,iv) = 3._r8 * tpu_z(p,sun,iv) - ap(p,sha,iv) = 3._r8 * tpu_z(p,sha,iv) - - else - ! C4: Rubisco-limited photosynthesis - ac(p,sun,iv) = bsun * vcmax_z(p,sun,iv) - ac(p,sha,iv) = bsha * vcmax_z(p,sha,iv) - - ! C4: RuBP-limited photosynthesis - aj(p,sun,iv) = qe(p) * par_z_sun * 4.6_r8 - aj(p,sha,iv) = qe(p) * par_z_sha * 4.6_r8 - - ! C4: PEP carboxylase-limited (CO2-limited) - ap(p,sun,iv) = kp_z(p,sun,iv) * max(cisun, 0._r8) / forc_pbot(c) - ap(p,sha,iv) = kp_z(p,sha,iv) * max(cisha, 0._r8) / forc_pbot(c) - - end if - - ! Gross photosynthesis. First co-limit ac and aj. Then co-limit ap - - ! Sunlit - aquad = theta_cj(p) - bquad = -(ac(p,sun,iv) + aj(p,sun,iv)) - cquad = ac(p,sun,iv) * aj(p,sun,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - ai = min(r1,r2) - - aquad = theta_ip - bquad = -(ai + ap(p,sun,iv)) - cquad = ai * ap(p,sun,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - ag(p,sun,iv) = max(0._r8,min(r1,r2)) - - ! Shaded - aquad = theta_cj(p) - bquad = -(ac(p,sha,iv) + aj(p,sha,iv)) - cquad = ac(p,sha,iv) * aj(p,sha,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - ai = min(r1,r2) - - aquad = theta_ip - bquad = -(ai + ap(p,sha,iv)) - cquad = ai * ap(p,sha,iv) - call quadratic (aquad, bquad, cquad, r1, r2) - ag(p,sha,iv) = max(0._r8,min(r1,r2)) - - ! Net photosynthesis. Exit iteration if an < 0 - an_sun(p,iv) = ag(p,sun,iv) - bsun * lmr_z_sun - an_sha(p,iv) = ag(p,sha,iv) - bsha * lmr_z_sha - - if (an_sun(p,iv) < 0._r8) then - if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - gs_mol_sun = medlynintercept(patch%itype(p)) - else if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - gs_mol_sun = bbb(p) - else - gs_mol_sun = nan - end if - gs_mol_sun = max( bsun*gs_mol_sun, 1._r8) - fvalsun = 0._r8 ! really tho? zqz - endif - if (an_sha(p,iv) < 0._r8) then - if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - gs_mol_sha = medlynintercept(patch%itype(p)) - else if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - gs_mol_sha = bbb(p) - else - gs_mol_sha = nan - end if - gs_mol_sha = max( bsha*gs_mol_sha, 1._r8) - fvalsha = 0._r8 - endif - if ((an_sun(p,iv) < 0._r8) .AND. (an_sha(p,iv) < 0._r8)) then - return - endif - - ! Quadratic gs_mol calculation with an known. Valid for an >= 0. - ! With an <= 0, then gs_mol = bbb - - ! Sunlit - cs_sun = cair - 1.4_r8/gb_mol * an_sun(p,iv) * forc_pbot(c) - cs_sun = max(cs_sun,10.e-06_r8) - - if ( stomatalcond_mtd == stomatalcond_mtd_medlyn2011 )then - term = 1.6_r8 * an_sun(p,iv) / (cs_sun / forc_pbot(c) * 1.e06_r8) - aquad = 1.0_r8 - bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & - (gb_mol*1.e-06_r8 * rh_can)) - cquad = medlynintercept(patch%itype(p))*medlynintercept(patch%itype(p))*1.e-12_r8 + & - (2.0*medlynintercept(patch%itype(p))*1.e-06_r8 + term * & - (1.0 - medlynslope(patch%itype(p))* medlynslope(patch%itype(p)) / rh_can)) * term - - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sun = max(r1,r2) * 1.e06_r8 - - ! Shaded - cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) - cs_sha = max(cs_sha,10.e-06_r8) - - term = 1.6_r8 * an_sha(p,iv) / (cs_sha / forc_pbot(c) * 1.e06_r8) - aquad = 1.0_r8 - bquad = -(2.0 * (medlynintercept(patch%itype(p))*1.e-06_r8 + term) + (medlynslope(patch%itype(p)) * term)**2 / & - (gb_mol*1.e-06_r8 * rh_can)) - cquad = medlynintercept(patch%itype(p))*medlynintercept(patch%itype(p))*1.e-12_r8 + & - (2.0*medlynintercept(patch%itype(p))*1.e-06_r8 + term * (1.0 - medlynslope(patch%itype(p))* & - medlynslope(patch%itype(p)) / rh_can)) * term - - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sha = max(r1,r2)* 1.e06_r8 - else if ( stomatalcond_mtd == stomatalcond_mtd_bb1987 )then - aquad = cs_sun - bquad = cs_sun*(gb_mol - max(bsun*bbb(p),1._r8)) - mbb(p)*an_sun(p,iv)*forc_pbot(c) - cquad = -gb_mol*(cs_sun*max(bsun*bbb(p),1._r8) + mbb(p)*an_sun(p,iv)*forc_pbot(c)*rh_can) - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sun = max(r1,r2) - - ! Shaded - cs_sha = cair - 1.4_r8/gb_mol * an_sha(p,iv) * forc_pbot(c) - cs_sha = max(cs_sha,10.e-06_r8) - - aquad = cs_sha - bquad = cs_sha*(gb_mol - max(bsha*bbb(p),1._r8)) - mbb(p)*an_sha(p,iv)*forc_pbot(c) - cquad = -gb_mol*(cs_sha*max(bsha*bbb(p),1._r8) + mbb(p)*an_sha(p,iv)*forc_pbot(c)*rh_can) - call quadratic (aquad, bquad, cquad, r1, r2) - gs_mol_sha = max(r1,r2) - end if - - ! Derive new estimate for cisun,cisha - if (an_sun(p,iv) >= 0._r8) then - if (gs_mol_sun > 0._r8) then - fvalsun =cisun - cair + an_sun(p,iv) * forc_pbot(c) * (1.4_r8*gs_mol_sun+1.6_r8*gb_mol) / (gb_mol*gs_mol_sun) - else - fvalsun =cisun - cair - endif - endif - if (an_sha(p,iv) >= 0._r8) then - if (gs_mol_sha > 0._r8) then - fvalsha =cisha - cair + an_sha(p,iv) * forc_pbot(c) * (1.4_r8*gs_mol_sha+1.6_r8*gb_mol) / (gb_mol*gs_mol_sha) - else - fvalsha =cisha - cair - endif - endif - end associate - end subroutine ci_func_PHS - !-------------------------------------------------------------------------------- - - !------------------------------------------------------------------------------ - subroutine calcstress(p,c,x,bsun,bsha,gb_mol,gs_mol_sun,gs_mol_sha,qsatl,qaf, & - atm2lnd_inst,canopystate_inst,waterstate_inst,soilstate_inst, & - temperature_inst, waterflux_inst) - ! - ! DESCRIPTIONS - ! compute the transpiration stress using a plant hydraulics approach - ! calls spacF, spacA, and getvegwp - ! - ! USES - use clm_varpar , only : nlevsoi - use clm_varcon , only : rgas - !! - ! !ARGUMENTS: - integer , intent(in) :: p ! pft index - integer , intent(in) :: c ! column index - real(r8) , intent(inout) :: x(nvegwcs) ! working copy of vegwp(p,:) - real(r8) , intent(out) :: bsun ! sunlit canopy transpiration wetness factor (0 to 1) - real(r8) , intent(out) :: bsha ! shaded sunlit canopy transpiration wetness factor (0 to 1) - real(r8) , intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8) , intent(in) :: gs_mol_sun ! Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - real(r8) , intent(in) :: gs_mol_sha ! Ball-Berry minimum leaf conductance (umol H2O/m**2/s) - real(r8) , intent(in) :: qsatl ! leaf specific humidity [kg/kg] - real(r8) , intent(in) :: qaf ! humidity of canopy air [kg/kg] - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterflux_type) , intent(in) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: wtl ! heat conductance for leaf [m/s] - real(r8) :: A(nvegwcs,nvegwcs) ! matrix relating d(vegwp) and f: d(vegwp)=A*f - real(r8) :: f(nvegwcs) ! flux divergence (mm/s) - real(r8) :: dx(nvegwcs) ! change in vegwp from one iter to the next [mm] - real(r8) :: efpot ! potential latent energy flux [kg/m2/s] - real(r8) :: rppdry_sun ! fraction of potential evaporation through transp - sunlit [-] - real(r8) :: rppdry_sha ! fraction of potential evaporation through transp - shaded [-] - real(r8) :: qflx_sun ! [kg/m2/s] - real(r8) :: qflx_sha ! [kg/m2/s] - real(r8) :: gs0sun,gs0sha ! local gs_mol copies - real(r8) :: qsun,qsha ! attenuated transpiration fluxes - integer :: j ! index - real(r8) :: cf ! s m**2/umol -> s/m - integer :: iter ! newton's method iteration number - logical :: flag ! signal that matrix was not invertible - logical :: night ! signal to store vegwp within this routine, b/c it is night-time and full suite won't be called - integer, parameter :: itmax=50 ! exit newton's method if iters>itmax - real(r8), parameter :: tolf=1.e-6,toldx=1.e-9 !tolerances for a satisfactory solution - logical :: havegs ! signals direction of calculation gs->qflx or qflx->gs - real(r8) :: soilflux ! total soil column transpiration [mm/s] - real(r8), parameter :: tol_lai=.001_r8 ! minimum lai where transpiration is calc'd - !------------------------------------------------------------------------------ - - associate( & - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] patch canopy one-sided stem area index, no burying by snow - fdry => waterstate_inst%fdry_patch , & ! Input: [real(r8) (:) ] fraction of foliage that is green and dry [-] - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - tgcm => temperature_inst%thm_patch , & ! Input: [real(r8) (:) ] air temperature at agcm reference height (kelvin) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - sucsat => soilstate_inst%sucsat_col & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - !temporary flag for night time vegwp(sun)>0 - if (x(sun)>0._r8) then - night=.TRUE. - x(sun)=x(sha) - else - night=.FALSE. - endif - - !copy to avoid rewriting gs_mol_sun - gs0sun=gs_mol_sun - gs0sha=gs_mol_sha - - !compute transpiration demand - havegs=.true. - call getqflx(p,c,gb_mol,gs0sun,gs0sha,qflx_sun,qflx_sha,qsatl,qaf,havegs, & - atm2lnd_inst, canopystate_inst, waterstate_inst, temperature_inst) - - if ((laisun(p)>tol_lai .or. laisha(p)>tol_lai).and.& - (qflx_sun>0._r8 .or. qflx_sha>0._r8))then - - !newton's method solves for matching fluxes through the spac - iter=0 - do - - iter=iter+1 - - call spacF(p,c,x,f,qflx_sun,qflx_sha, & - atm2lnd_inst,canopystate_inst,waterstate_inst,soilstate_inst,temperature_inst,waterflux_inst) - - if ( sqrt(sum(f*f)) < tolf*(qflx_sun+qflx_sha) ) then !fluxes balanced -> exit - flag = .false. - exit - end if - if ( iter>itmax ) then !exceeds max iters -> exit - flag = .false. - exit - end if - - call spacA(p,c,x,A,qflx_sun,qflx_sha,flag, & - atm2lnd_inst,canopystate_inst,waterstate_inst,soilstate_inst,temperature_inst,waterflux_inst) - - if (flag) then - ! cannot invert the matrix, solve for x algebraically assuming no flux - exit - end if - - if (laisun(p)>tol_lai.and.laisha(p)>tol_lai)then - dx = matmul(A,f) - else - !reduces to 3x3 system - !in this case, dx is not always [sun,sha,xyl,root] - !sun and sha flip depending on which is lai==0 - dx(sun)=0._r8 - dx(sha:root)=matmul(A(sha:root,sha:root),f(sha:root)) - endif - - - if ( maxval(abs(dx)) > 50000._r8) then - dx = 50000._r8 * dx / maxval(abs(dx)) !rescale step to max of 50000 - end if - - - if (laisun(p)>tol_lai.and.laisha(p)>tol_lai)then - x=x+dx - elseif (laisha(p)>tol_lai) then - x=x+dx - x(sun)=x(xyl) ! psi_sun = psi_xyl because laisun==0 - else - x(xyl:root)=x(xyl:root)+dx(xyl:root) - x(sun)=x(sun)+dx(sha) ! implementation ugly bit, chose to flip dx(sun) and dx(sha) for laisha==0 case - x(sha)=x(xyl) ! psi_sha = psi_xyl because laisha==0 - - endif - - - if ( sqrt(sum(dx*dx)) < toldx) then - !step in vegwp small -> exit - exit - end if - - ! this is a catch to force spac gradient to atmosphere - if ( x(xyl) > x(root) ) x(xyl) = x(root) - if ( x(sun) > x(xyl) ) x(sun) = x(xyl) - if ( x(sha) > x(xyl) ) x(sha) = x(xyl) - - end do - - else - ! both qflxsun and qflxsha==0 - flag=.true. - end if - - if (flag) then - ! solve algebraically - call getvegwp(p, c, x, gb_mol, gs0sun, gs0sha, qsatl, qaf, soilflux, & - atm2lnd_inst, canopystate_inst, waterstate_inst, soilstate_inst, temperature_inst) - bsun = plc(x(sun),p,c,sun,veg) - bsha = plc(x(sha),p,c,sha,veg) - else - ! compute attenuated flux - qsun=qflx_sun*plc(x(sun),p,c,sun,veg) - qsha=qflx_sha*plc(x(sha),p,c,sha,veg) - - ! retrieve stressed stomatal conductance - havegs=.FALSE. - call getqflx(p,c,gb_mol,gs0sun,gs0sha,qsun,qsha,qsatl,qaf,havegs, & - atm2lnd_inst, canopystate_inst, waterstate_inst, temperature_inst) - - ! compute water stress - ! .. generally -> B= gs_stressed / gs_unstressed - ! .. when gs=0 -> B= plc( x ) - if (qflx_sun>0._r8) then - bsun = gs0sun/gs_mol_sun - else - bsun = plc(x(sun),p,c,sun,veg) - endif - if (qflx_sha>0._r8) then - bsha = gs0sha/gs_mol_sha - else - bsha = plc(x(sha),p,c,sha,veg) - endif - endif - if ( bsun < 0.01_r8 ) bsun = 0._r8 - if ( bsha < 0.01_r8 ) bsha = 0._r8 - - !zqz is this the best place to do this? - ! was looking like qflx_tran_veg/vegwp was not being set at night time - ! set vegwp for the final gs_mol solution - if (night) then - gs0sun=bsun*gs_mol_sun - gs0sha=bsha*gs_mol_sha - call getvegwp(p, c, x, gb_mol, gs0sun, gs0sha, qsatl, qaf, soilflux, & - atm2lnd_inst, canopystate_inst, waterstate_inst, soilstate_inst, temperature_inst) - if (soilflux<0._r8) soilflux = 0._r8 - qflx_tran_veg(p) = soilflux - endif - - - end associate - - end subroutine calcstress - - !------------------------------------------------------------------------------ - - !------------------------------------------------------------------------------ - subroutine spacA(p,c,x,invA,qflx_sun,qflx_sha,flag, & - atm2lnd_inst,canopystate_inst,waterstate_inst,soilstate_inst, & - temperature_inst, waterflux_inst) - - ! - ! DESCRIPTION - ! Returns invA, the inverse matrix relating delta(vegwp) to f - ! d(vegwp)=invA*f - ! evaluated at vegwp(p) - ! - ! The methodology is currently hardcoded for linear algebra assuming the - ! number of vegetation segments is four. Thus the matrix A and it's inverse - ! invA are both 4x4 matrices. A more general method could be done using for - ! example a LINPACK linear algebra solver. - ! - ! USES - use clm_varpar , only : nlevsoi - use clm_varcon , only : rgas - ! - ! !ARGUMENTS: - integer , intent(in) :: p ! pft index - integer , intent(in) :: c ! column index - real(r8) , intent(in) :: x(nvegwcs) ! working copy of veg water potential for patch p [mm H2O] - real(r8) , intent(out) :: invA(nvegwcs,nvegwcs) ! matrix relating d(vegwp) and f: d(vegwp)=invA*f - real(r8) , intent(in) :: qflx_sun ! Sunlit leaf transpiration [kg/m2/s] - real(r8) , intent(in) :: qflx_sha ! Shaded leaf transpiration [kg/m2/s] - logical , intent(out) :: flag ! tells calling function that the matrix is not invertible - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterflux_type) , intent(in) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: wtl ! heat conductance for leaf [m/s] - real(r8) :: fsto1 ! sunlit transpiration reduction function [-] - real(r8) :: fsto2 ! shaded transpiration reduction function [-] - real(r8) :: fx ! fraction of maximum conductance, xylem-to-leaf [-] - real(r8) :: fr ! fraction of maximum conductance, root-to-xylem [-] - real(r8) :: dfsto1 ! 1st derivative of fsto1 w.r.t. change in vegwp - real(r8) :: dfsto2 ! 1st derivative of fsto2 w.r.t. change in vegwp - real(r8) :: dfx ! 1st derivative of fx w.r.t. change in vegwp - real(r8) :: dfr ! 1st derivative of fr w.r.t. change in vegwp - real(r8) :: A(nvegwcs,nvegwcs) ! matrix relating vegwp to flux divergence f=A*d(vegwp) - real(r8) :: leading ! inverse of determiniant - real(r8) :: determ ! determinant of matrix - real(r8) :: grav1 ! gravitational potential surface to canopy top (mm H2O) - real(r8) :: invfactor ! - real(r8), parameter :: tol_lai=.001_r8 ! minimum lai where transpiration is calc'd - integer :: j ! index - !------------------------------------------------------------------------------ -#ifndef NDEBUG - ! Only execute this code if DEBUG=TRUE - if ( nvegwcs /= 4 )then - call endrun(msg='Error:: this function is hardcoded for 4x4 matrices with nvegwcs==4'//errMsg(__FILE__, __LINE__)) - end if -#endif - - associate( & - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] soil-root interface conductance (mm/s) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - htop => canopystate_inst%htop_patch , & ! Input: [real(r8) (:) ] patch canopy top (m) - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] patch canopy one-sided stem area index, no burying by snow - ivt => patch%itype & ! Input: [integer (:) ] patch vegetation type - ) - - ! initialize all elements to zero - A = 0._r8 - invA = 0._r8 - - grav1 = htop(p)*1000._r8 - - !compute conductance attentuation for each segment - fsto1= plc(x(sun),p,c,sun,veg) - fsto2= plc(x(sha),p,c,sha,veg) - fx= plc(x(xyl),p,c,xyl,veg) - fr= plc(x(root),p,c,root,veg) - - !compute 1st deriv of conductance attenuation for each segment - dfsto1= d1plc(x(sun),p,c,sun,veg) - dfsto2= d1plc(x(sha),p,c,sha,veg) - dfx= d1plc(x(xyl),p,c,xyl,veg) - dfr= d1plc(x(root),p,c,root,veg) - - !A - f=A*d(vegwp) - A(1,1)= - laisun(p) * params_inst%kmax(ivt(p),sun) * fx& - - qflx_sun * dfsto1 - A(1,3)= laisun(p) * params_inst%kmax(ivt(p),sun) * dfx * (x(xyl)-x(sun))& - + laisun(p) * params_inst%kmax(ivt(p),sun) * fx - A(2,2)= - laisha(p) * params_inst%kmax(ivt(p),sha) * fx& - - qflx_sha * dfsto2 - A(2,3)= laisha(p) * params_inst%kmax(ivt(p),sha) * dfx * (x(xyl)-x(sha))& - + laisha(p) * params_inst%kmax(ivt(p),sha) * fx - A(3,1)= laisun(p) * params_inst%kmax(ivt(p),sun) * fx - A(3,2)= laisha(p) * params_inst%kmax(ivt(p),sha) * fx - A(3,3)= - laisun(p) * params_inst%kmax(ivt(p),sun) * dfx * (x(xyl)-x(sun))& - - laisun(p) * params_inst%kmax(ivt(p),sun) * fx& - - laisha(p) * params_inst%kmax(ivt(p),sha) * dfx * (x(xyl)-x(sha))& - - laisha(p) * params_inst%kmax(ivt(p),sha) * fx& - - tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * fr - A(3,4)= tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * dfr * (x(root)-x(xyl)-grav1)& - + tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * fr - A(4,3)= tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * fr - A(4,4)= - tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * fr& - - tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * dfr * (x(root)-x(xyl)-grav1)& - - sum(k_soil_root(p,1:nlevsoi)) - - invfactor=1._r8 - A=invfactor*A - - !matrix inversion - if (laisun(p)>tol_lai .and. laisha(p)>tol_lai) then - ! general case - - determ=A(4,4)*A(2,2)*A(3,3)*A(1,1) - A(4,4)*A(2,2)*A(3,1)*A(1,3)& - - A(4,4)*A(3,2)*A(2,3)*A(1,1) - A(4,3)*A(1,1)*A(2,2)*A(3,4) - if ( abs(determ) <= 1.e-50_r8 ) then - flag = .true. !tells calling function that the matrix is not invertible - return - else - flag = .false. - end if - - leading = 1._r8/determ - - !algebraic inversion of the matrix - invA(1,1)=leading*A(4,4)*A(2,2)*A(3,3) - leading*A(4,4)*A(3,2)*A(2,3) - leading*A(4,3)*A(2,2)*A(3,4) - invA(2,1)=leading*A(2,3)*A(4,4)*A(3,1) - invA(3,1)=-leading*A(4,4)*A(2,2)*A(3,1) - invA(4,1)=leading*A(4,3)*A(2,2)*A(3,1) - invA(1,2)=leading*A(1,3)*A(4,4)*A(3,2) - invA(2,2)=leading*A(4,4)*A(3,3)*A(1,1)-leading*A(4,4)*A(3,1)*A(1,3)-leading*A(4,3)*A(1,1)*A(3,4) - invA(3,2)=-leading*A(1,1)*A(4,4)*A(3,2) - invA(4,2)=leading*A(4,3)*A(1,1)*A(3,2) - invA(1,3)=-leading*A(1,3)*A(2,2)*A(4,4) - invA(2,3)=-leading*A(2,3)*A(1,1)*A(4,4) - invA(3,3)=leading*A(2,2)*A(1,1)*A(4,4) - invA(4,3)=-leading*A(4,3)*A(1,1)*A(2,2) - invA(1,4)=leading*A(1,3)*A(3,4)*A(2,2) - invA(2,4)=leading*A(2,3)*A(3,4)*A(1,1) - invA(3,4)=-leading*A(3,4)*A(1,1)*A(2,2) - invA(4,4)=leading*A(2,2)*A(3,3)*A(1,1)-leading*A(2,2)*A(3,1)*A(1,3)-leading*A(3,2)*A(2,3)*A(1,1) - invA=invfactor*invA !undo inversion scaling - else - ! if laisun or laisha ==0 invert the corresponding 3x3 matrix - ! if both are zero, this routine is not called - if (laisha(p)<=tol_lai) then - ! shift nonzero matrix values so that both 3x3 cases can be inverted with the same code - A(2,2)=A(1,1) - A(3,2)=A(3,1) - A(2,3)=A(1,3) - endif - determ=A(2,2)*A(3,3)*A(4,4)-A(3,4)*A(2,2)*A(4,3)-A(2,3)*A(3,2)*A(4,4) - if ( abs(determ) <= 1.e-50_r8 ) then - flag = .true. !tells calling function that the matrix is not invertible - return - else - flag = .false. - end if - - !algebraic inversion of the 3x3 matrix stored in A(2:4,2:4) - invA(2,2)=A(3,3)*A(4,4)-A(3,4)*A(4,3) - invA(2,3)=-A(2,3)*A(4,4) - invA(2,4)=A(3,4)*A(2,3) - invA(3,2)=-A(3,2)*A(4,4) - invA(3,3)=A(2,2)*A(4,4) - invA(3,4)=-A(3,4)*A(2,2) - invA(4,2)=A(3,2)*A(4,3) - invA(4,3)=-A(2,2)*A(4,3) - invA(4,4)=A(2,2)*A(3,3)-A(2,3)*A(3,2) - invA=1._r8/determ*invA - - endif - - end associate - - end subroutine spacA - - !-------------------------------------------------------------------------------- - - !------------------------------------------------------------------------------ - subroutine spacF(p,c,x,f,qflx_sun,qflx_sha, & - atm2lnd_inst,canopystate_inst,waterstate_inst,soilstate_inst, & - temperature_inst, waterflux_inst) - ! - ! DESCRIPTION - ! Returns f, the flux divergence across each vegetation segment - ! calculated for vegwp(p,:) as passed in via x - ! - ! USES - use clm_varpar , only : nlevsoi - use clm_varcon , only : rgas - use ColumnType , only : col - ! - ! !ARGUMENTS: - integer , intent(in) :: p ! pft index - integer , intent(in) :: c ! column index - real(r8) , intent(in) :: x(nvegwcs) ! working copy of veg water potential for patch p [mm H2O] - real(r8) , intent(out) :: f(nvegwcs) ! water flux divergence [mm/s] - real(r8) , intent(in) :: qflx_sun ! Sunlit leaf transpiration [kg/m2/s] - real(r8) , intent(in) :: qflx_sha ! Shaded leaf transpiration [kg/m2/s] - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterflux_type) , intent(in) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: wtl ! heat conductance for leaf [m/s] - real(r8) :: fsto1 ! sunlit transpiration reduction function [-] - real(r8) :: fsto2 ! shaded transpiration reduction function [-] - real(r8) :: fx ! fraction of maximum conductance, xylem-to-leaf [-] - real(r8) :: fr ! fraction of maximum conductance, root-to-xylem [-] - real(r8) :: grav1 ! gravitational potential surface to canopy top (mm H2O) - real(r8) :: grav2(nlevsoi) ! soil layer gravitational potential relative to surface (mm H2O) - real(r8) :: temp ! used to copy f(sun) to f(sha) for special case - real(r8), parameter :: tol_lai=.001_r8 ! needs to be the same as in calcstress and spacA (poor form, refactor)< - integer :: j ! index - !------------------------------------------------------------------------------ - - associate( & - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] soil-root interface conductance (mm/s) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - htop => canopystate_inst%htop_patch , & ! Input: [real(r8) (:) ] patch canopy top (m) - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] patch canopy one-sided stem area index, no burying by snow - smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - z => col%z & ! Input: [real(r8) (:,:) ] layer node depth (m) - ) - - grav1 = htop(p) * 1000._r8 - grav2(1:nlevsoi) = z(c,1:nlevsoi) * 1000._r8 - - fsto1= plc(x(sun),p,c,sun,veg) - fsto2= plc(x(sha),p,c,sha,veg) - fx= plc(x(xyl),p,c,xyl,veg) - fr= plc(x(root),p,c,root,veg) - - !compute flux divergence across each plant segment - f(sun)= qflx_sun * fsto1 - laisun(p) * params_inst%kmax(ivt(p),sun) * fx * (x(xyl)-x(sun)) - f(sha)= qflx_sha * fsto2 - laisha(p) * params_inst%kmax(ivt(p),sha) * fx * (x(xyl)-x(sha)) - f(xyl)= laisun(p) * params_inst%kmax(ivt(p),sun) * fx * (x(xyl)-x(sun))& - + laisha(p) * params_inst%kmax(ivt(p),sha) * fx * (x(xyl)-x(sha)) & - - tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * fr * (x(root)-x(xyl)-grav1) - f(root)= tsai(p) * params_inst%kmax(ivt(p),xyl) / htop(p) * fr * (x(root)-x(xyl)-grav1) & - + sum( k_soil_root(p,1:nlevsoi) * (x(root)+grav2(1:nlevsoi)) ) & - - sum( k_soil_root(p,1:nlevsoi) * smp(c,1:nlevsoi) ) - - if (laisha(p)qflx or qflx->gs - !---------------------------------------------------------------------- - associate( & - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] soil-root interface conductance (mm/s) - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - htop => canopystate_inst%htop_patch , & ! Input: [real(r8) (:) ] patch canopy top (m) - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] patch canopy one-sided stem area index, no burying by snow - smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - ivt => patch%itype , & ! Input: [integer (:) ] patch vegetation type - hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - z => col%z & ! Input: [real(r8) (:,:) ] layer node depth (m) - ) - - grav1 = 1000._r8 *htop(p) - grav2(1:nlevsoi) = 1000._r8 * z(c,1:nlevsoi) - - !compute transpiration demand - havegs=.true. - call getqflx(p,c,gb_mol,gs_mol_sun,gs_mol_sha,qflx_sun,qflx_sha,qsatl,qaf,havegs, & - atm2lnd_inst, canopystate_inst, waterstate_inst, temperature_inst) - - !calculate root water potential - if ( abs(sum(k_soil_root(p,1:nlevsoi))) == 0._r8 ) then - x(root) = sum(smp(c,1:nlevsoi) - grav2)/nlevsoi - else - x(root) = (sum(k_soil_root(p,1:nlevsoi)*(smp(c,1:nlevsoi)-grav2))-qflx_sun-qflx_sha) & - /sum(k_soil_root(p,1:nlevsoi)) - endif - - !calculate xylem water potential - fr = plc(x(root),p,c,root,veg) - if ( (tsai(p) > 0._r8) .and. (fr > 0._r8) ) then - x(xyl) = x(root) - grav1 - (qflx_sun+qflx_sha)/(fr*params_inst%kmax(ivt(p),root)/htop(p)*tsai(p))!removed htop conversion - else - x(xyl) = x(root) - grav1 - endif - - !calculate sun/sha leaf water potential - fx = plc(x(xyl),p,c,xyl,veg) - if ( (laisha(p) > 0._r8) .and. (fx > 0._r8) ) then - x(sha) = x(xyl) - (qflx_sha/(fx*params_inst%kmax(ivt(p),xyl)*laisha(p))) - else - x(sha) = x(xyl) - endif - if ( (laisun(p) > 0._r8) .and. (fx > 0._r8) ) then - x(sun) = x(xyl) - (qflx_sun/(fx*params_inst%kmax(ivt(p),xyl)*laisun(p))) - else - x(sun) = x(xyl) - endif - - !calculate soil flux - soilflux = 0._r8 - do j = 1,nlevsoi - soilflux = soilflux + k_soil_root(p,j)*(smp(c,j)-x(root)-grav2(j)) - enddo - - end associate - - end subroutine getvegwp - - !-------------------------------------------------------------------------------- - subroutine getqflx(p,c,gb_mol,gs_mol_sun,gs_mol_sha,qflx_sun,qflx_sha,qsatl,qaf,havegs, & - atm2lnd_inst, canopystate_inst, waterstate_inst, temperature_inst) - ! !DESCRIPTION: - ! calculate sunlit and shaded transpiration using gb_MOL and gs_MOL - ! !USES: - ! - use clm_varcon , only : rgas - implicit none - ! - ! !ARGUMENTS: - integer , intent(in) :: p ! pft index - integer , intent(in) :: c ! column index - real(r8) , intent(in) :: gb_mol ! leaf boundary layer conductance (umol H2O/m**2/s) - real(r8) , intent(inout) :: gs_mol_sun ! Ball-Berry leaf conductance (umol H2O/m**2/s) - real(r8) , intent(inout) :: gs_mol_sha ! Ball-Berry leaf conductance (umol H2O/m**2/s) - real(r8) , intent(inout) :: qflx_sun ! Sunlit leaf transpiration [kg/m2/s] - real(r8) , intent(inout) :: qflx_sha ! Shaded leaf transpiration [kg/m2/s] - real(r8) , intent(in) :: qsatl ! leaf specific humidity [kg/kg] - real(r8) , intent(in) :: qaf ! humidity of canopy air [kg/kg] - logical , intent(in) :: havegs ! signals direction of calculation gs->qflx or qflx->gs - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: wtl ! heat conductance for leaf [m/s] - real(r8) :: efpot ! potential latent energy flux [kg/m2/s] - real(r8) :: rppdry_sun ! fraction of potential evaporation through transp - sunlit [-] - real(r8) :: rppdry_sha ! fraction of potential evaporation through transp - shaded [-] - real(r8) :: cf ! s m**2/umol -> s/m - !---------------------------------------------------------------------- - - associate( & - laisun => canopystate_inst%laisun_patch , & ! Input: [real(r8) (:) ] sunlit leaf area - laisha => canopystate_inst%laisha_patch , & ! Input: [real(r8) (:) ] shaded leaf area - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - fdry => waterstate_inst%fdry_patch , & ! Input: [real(r8) (:) ] fraction of foliage that is green and dry [-] - forc_rho => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:) ] density (kg/m**3) - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - tgcm => temperature_inst%thm_patch & ! Input: [real(r8) (:) ] air temperature at agcm reference height (kelvin) - ) - - - cf = forc_pbot(c)/(rgas*1.e-3_r8*tgcm(p))*1.e6_r8 ! gb->gbmol conversion factor - wtl = (elai(p)+esai(p))*gb_mol - efpot = forc_rho(c)*wtl*(qsatl-qaf) - if (havegs) then - - if ( (efpot > 0._r8) .and. (elai(p) > 0._r8) ) then - if ( gs_mol_sun > 0._r8 ) then - rppdry_sun = fdry(p)/gb_mol*(laisun(p)/(1._r8/gb_mol+1._r8/gs_mol_sun))/elai(p) - qflx_sun = efpot*rppdry_sun/cf - else - qflx_sun = 0._r8 - end if - if ( gs_mol_sha > 0._r8 ) then - rppdry_sha = fdry(p)/gb_mol*(laisha(p)/(1._r8/gb_mol+1._r8/gs_mol_sha))/elai(p) - qflx_sha = efpot*rppdry_sha/cf - else - qflx_sha = 0._r8 - end if - else - qflx_sun = 0._r8 - qflx_sha = 0._r8 - end if - - else - if (qflx_sun > 0._r8) then - gs_mol_sun=gb_mol*qflx_sun*cf*elai(p)/(efpot*fdry(p)*laisun(p)-qflx_sun*cf*elai(p)) - else - gs_mol_sun=0._r8 - endif - if (qflx_sha > 0._r8) then - gs_mol_sha=gb_mol*qflx_sha*cf*elai(p)/(efpot*fdry(p)*laisha(p)-qflx_sha*cf*elai(p)) - else - gs_mol_sha=0._r8 - endif - - endif - - end associate - - end subroutine getqflx - - !-------------------------------------------------------------------------------- - function plc(x,p,c,level,plc_method) - ! !DESCRIPTION - ! Return value of vulnerability curve at x - ! - ! !ARGUMENTS - real(r8) , intent(in) :: x ! water potential input - integer , intent(in) :: p ! index for pft - integer , intent(in) :: c ! index for column - integer , intent(in) :: level ! veg segment lvl (1:nvegwcs) - integer , intent(in) :: plc_method ! - real(r8) :: plc ! attenuated conductance [0:1] 0=no flow - ! - ! !PARAMETERS - integer , parameter :: vegetation_weibull=0 ! case number - !------------------------------------------------------------------------------ - associate( & - ivt => patch%itype & ! Input: [integer (:) ] patch vegetation type - ) - - select case (plc_method) - !possible to add other methods later - case (vegetation_weibull) - plc=2._r8**(-(x/params_inst%psi50(ivt(p),level))**params_inst%ck(ivt(p),level)) - if ( plc < 0.005_r8) plc = 0._r8 - case default - print *,'must choose plc method' - end select - - end associate - - end function plc - !-------------------------------------------------------------------------------- - - !-------------------------------------------------------------------------------- - function d1plc(x,p,c,level,plc_method) - ! !DESCRIPTION - ! Return 1st derivative of vulnerability curve at x - ! - ! !ARGUMENTS - real(r8) , intent(in) :: x ! water potential input - integer , intent(in) :: p ! index for pft - integer , intent(in) :: c ! index for column - integer , intent(in) :: level ! veg segment lvl (1:nvegwcs) - integer , intent(in) :: plc_method ! 0 for vegetation, 1 for soil - real(r8) :: d1plc ! first deriv of plc curve at x - ! - ! !PARAMETERS - integer , parameter :: vegetation_weibull=0 ! case number - !------------------------------------------------------------------------------ - associate( & - ivt => patch%itype & ! Input: [integer (:) ] patch vegetation type - ) - - select case (plc_method) - !possible to add other methods later - case (vegetation_weibull) - d1plc= -params_inst%ck(ivt(p),level) * log(2._r8) * (2._r8**(-(x/params_inst%psi50(ivt(p),level)) & - **params_inst%ck(ivt(p),level))) & - * ((x/params_inst%psi50(ivt(p),level))**params_inst%ck(ivt(p),level)) / x - case default - print *,'must choose plc method' - end select - - end associate - - end function d1plc - -end module PhotosynthesisMod diff --git a/src/biogeophys/QSatMod.F90 b/src/biogeophys/QSatMod.F90 deleted file mode 100644 index 0b1819e467..0000000000 --- a/src/biogeophys/QSatMod.F90 +++ /dev/null @@ -1,167 +0,0 @@ -module QSatMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Computes saturation mixing ratio and the change in saturation - ! - ! !PUBLIC TYPES: - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: QSat - public :: rhoSat - !----------------------------------------------------------------------- - - ! For water vapor (temperature range 0C-100C) - real(r8), parameter :: a0 = 6.11213476_r8 - real(r8), parameter :: a1 = 0.444007856_r8 - real(r8), parameter :: a2 = 0.143064234e-01_r8 - real(r8), parameter :: a3 = 0.264461437e-03_r8 - real(r8), parameter :: a4 = 0.305903558e-05_r8 - real(r8), parameter :: a5 = 0.196237241e-07_r8 - real(r8), parameter :: a6 = 0.892344772e-10_r8 - real(r8), parameter :: a7 = -0.373208410e-12_r8 - real(r8), parameter :: a8 = 0.209339997e-15_r8 - ! For derivative:water vapor - real(r8), parameter :: b0 = 0.444017302_r8 - real(r8), parameter :: b1 = 0.286064092e-01_r8 - real(r8), parameter :: b2 = 0.794683137e-03_r8 - real(r8), parameter :: b3 = 0.121211669e-04_r8 - real(r8), parameter :: b4 = 0.103354611e-06_r8 - real(r8), parameter :: b5 = 0.404125005e-09_r8 - real(r8), parameter :: b6 = -0.788037859e-12_r8 - real(r8), parameter :: b7 = -0.114596802e-13_r8 - real(r8), parameter :: b8 = 0.381294516e-16_r8 - ! For ice (temperature range -75C-0C) - real(r8), parameter :: c0 = 6.11123516_r8 - real(r8), parameter :: c1 = 0.503109514_r8 - real(r8), parameter :: c2 = 0.188369801e-01_r8 - real(r8), parameter :: c3 = 0.420547422e-03_r8 - real(r8), parameter :: c4 = 0.614396778e-05_r8 - real(r8), parameter :: c5 = 0.602780717e-07_r8 - real(r8), parameter :: c6 = 0.387940929e-09_r8 - real(r8), parameter :: c7 = 0.149436277e-11_r8 - real(r8), parameter :: c8 = 0.262655803e-14_r8 - ! For derivative:ice - real(r8), parameter :: d0 = 0.503277922_r8 - real(r8), parameter :: d1 = 0.377289173e-01_r8 - real(r8), parameter :: d2 = 0.126801703e-02_r8 - real(r8), parameter :: d3 = 0.249468427e-04_r8 - real(r8), parameter :: d4 = 0.313703411e-06_r8 - real(r8), parameter :: d5 = 0.257180651e-08_r8 - real(r8), parameter :: d6 = 0.133268878e-10_r8 - real(r8), parameter :: d7 = 0.394116744e-13_r8 - real(r8), parameter :: d8 = 0.498070196e-16_r8 -contains - - - - !----------------------------------------------------------------------- - subroutine QSat (T, p, es, esdT, qs, qsdT) - ! - ! !DESCRIPTION: - ! Computes saturation mixing ratio and the change in saturation - ! mixing ratio with respect to temperature. - ! Reference: Polynomial approximations from: - ! Piotr J. Flatau, et al.,1992: Polynomial fits to saturation - ! vapor pressure. Journal of Applied Meteorology, 31, 1507-1513. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: T ! temperature (K) - real(r8), intent(in) :: p ! surface atmospheric pressure (pa) - real(r8), intent(out) :: es ! vapor pressure (pa) - real(r8), intent(out) :: esdT ! d(es)/d(T) - real(r8), intent(out) :: qs ! humidity (kg/kg) - real(r8), intent(out) :: qsdT ! d(qs)/d(T) - ! - ! !LOCAL VARIABLES: - real(r8) :: T_limit - real(r8) :: td,vp,vp1,vp2 - !----------------------------------------------------------------------- - - T_limit = T - SHR_CONST_TKFRZ - if (T_limit > 100.0_r8) T_limit=100.0_r8 - if (T_limit < -75.0_r8) T_limit=-75.0_r8 - - td = T_limit - if (td >= 0.0_r8) then - es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & - + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - - else - es = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & - + td*(c5 + td*(c6 + td*(c7 + td*c8))))))) - - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - - endif - - es = es * 100._r8 ! pa - - esdT = esdT * 100._r8 ! pa/K - - - vp = 1.0_r8 / (p - 0.378_r8*es) - vp1 = 0.622_r8 * vp - vp2 = vp1 * vp - - qs = es * vp1 ! kg/kg - qsdT = esdT * vp2 * p ! 1 / K - - - end subroutine QSat - - - -!------------------------------------------------------------------------------- - subroutine rhoSat(T, rho, rhodT) - ! compute the saturated vapor pressure density and its derivative against the temperature - ! jyt - use clm_varcon, only: rwat - use shr_const_mod, only: SHR_CONST_TKFRZ - - implicit none - real(r8), intent(in) :: T - real(r8), intent(out) :: rho - real(r8), optional, intent(out) :: rhodT - - - !------------------ - - real(r8) :: T_limit - real(r8) :: td, es, esdT - - T_limit = T - SHR_CONST_TKFRZ - if (T_limit > 100.0_r8) T_limit=100.0_r8 - if (T_limit < -75.0_r8) T_limit=-75.0_r8 - - td = T_limit - if (td >= 0.0_r8) then - es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & - + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - else - es = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & - + td*(c5 + td*(c6 + td*(c7 + td*c8))))))) - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - endif - - es = es * 100._r8 ! pa - rho = es/(rwat*T) !kg m^-3 - if(present(rhodT))rhodT= esdT/(rwat*T)-rho/T !kg m^-3 K^-1 - end subroutine rhoSat -end module QSatMod diff --git a/src/biogeophys/RootBiophysMod.F90 b/src/biogeophys/RootBiophysMod.F90 deleted file mode 100644 index ba05705614..0000000000 --- a/src/biogeophys/RootBiophysMod.F90 +++ /dev/null @@ -1,332 +0,0 @@ -module RootBiophysMod - -#include "shr_assert.h" - - !-------------------------------------------------------------------------------------- - ! DESCRIPTION: - ! module contains subroutine for root biophysics - ! - ! HISTORY - ! created by Jinyun Tang, Mar 1st, 2014 - implicit none - private - ! - public :: init_vegrootfr - public :: init_rootprof - - integer, private, parameter :: zeng_2001_root = 0 !the zeng 2001 root profile function - integer, private, parameter :: jackson_1996_root = 1 !the jackson 1996 root profile function - integer, private, parameter :: koven_exp_root = 2 !the koven exponential root profile function - - integer, public :: rooting_profile_method_water !select the type of rooting profile parameterization for water - integer, public :: rooting_profile_method_carbon !select the type of rooting profile parameterization for carbon - integer, public :: rooting_profile_varindex_water !select the variant number of rooting profile parameterization for water - integer, public :: rooting_profile_varindex_carbon !select the variant number of rooting profile parameterization for carbon - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !-------------------------------------------------------------------------------------- - -contains - - !-------------------------------------------------------------------------------------- - subroutine init_rootprof(NLFilename) - ! - !DESCRIPTION - ! initialize methods for root profile calculation - - ! !USES: - use abortutils , only : endrun - use fileutils , only : getavu, relavu - use spmdMod , only : mpicom, masterproc - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use clm_nlUtilsMod , only : find_nlgroup_name - - ! !ARGUMENTS: - !------------------------------------------------------------------------------ - implicit none - character(len=*), intent(in) :: NLFilename - - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - character(*), parameter :: subName = "('init_rootprof')" - - !----------------------------------------------------------------------- - -! MUST agree with name in namelist and read statement - namelist /rooting_profile_inparm/ rooting_profile_method_water, rooting_profile_method_carbon, & - rooting_profile_varindex_water, rooting_profile_varindex_carbon - - ! Default values for namelist - - rooting_profile_method_water = zeng_2001_root - rooting_profile_method_carbon = zeng_2001_root - rooting_profile_varindex_water = 1 - rooting_profile_varindex_carbon = 2 - - ! Read rooting_profile namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'rooting_profile_inparm', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=rooting_profile_inparm,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading rooting_profile namelist') - end if - else - call endrun(subname // ':: ERROR finding rooting_profile namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - - endif - - call shr_mpi_bcast(rooting_profile_method_water, mpicom) - call shr_mpi_bcast(rooting_profile_method_carbon, mpicom) - call shr_mpi_bcast(rooting_profile_varindex_water, mpicom) - call shr_mpi_bcast(rooting_profile_varindex_carbon, mpicom) - - if (masterproc) then - - write(iulog,*) ' ' - write(iulog,*) 'rooting_profile settings:' - write(iulog,*) ' rooting_profile_method_water = ',rooting_profile_method_water - if ( rooting_profile_method_water == jackson_1996_root )then - write(iulog,*) ' (rooting_profile_varindex_water = ',rooting_profile_varindex_water, ')' - end if - write(iulog,*) ' rooting_profile_method_carbon = ',rooting_profile_method_carbon - if ( rooting_profile_method_carbon == jackson_1996_root )then - write(iulog,*) ' (rooting_profile_varindex_carbon = ',rooting_profile_varindex_carbon, ')' - end if - - endif - - end subroutine init_rootprof - - !-------------------------------------------------------------------------------------- - subroutine init_vegrootfr(bounds, nlevsoi, nlevgrnd, rootfr, water_carbon) - ! - !DESCRIPTION - !initialize plant root profiles - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer, intent(in) :: nlevsoi ! number of hydactive layers - integer, intent(in) :: nlevgrnd ! number of soil layers - real(r8), intent(out):: rootfr(bounds%begp: , 1: ) ! root fraction by layer - character(len=*), intent(in) :: water_carbon ! roots for water or carbon - - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'init_vegrootfr' ! subroutine name - integer :: c,p - integer :: rooting_profile_method ! Rooting profile method to use - integer :: rooting_profile_varidx ! Rooting profile variant index to use - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(rootfr) == (/bounds%endp, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - if ( water_carbon == 'water' ) then - rooting_profile_method = rooting_profile_method_water - rooting_profile_varidx = rooting_profile_varindex_water - else if (water_carbon == 'carbon') then - rooting_profile_method = rooting_profile_method_carbon - rooting_profile_varidx = rooting_profile_varindex_carbon - else - call endrun(subname // ':: input type can only be water or carbon = '//water_carbon ) - end if - - select case( rooting_profile_method ) - - case (zeng_2001_root) - rootfr(bounds%begp:bounds%endp, 1 : nlevsoi) = zeng2001_rootfr(bounds, nlevsoi) - case (jackson_1996_root) - rootfr(bounds%begp:bounds%endp, 1 : nlevsoi) = jackson1996_rootfr(bounds, nlevsoi, rooting_profile_varidx, water_carbon) - case (koven_exp_root) - rootfr(bounds%begp:bounds%endp, 1 : nlevsoi) = exponential_rootfr(bounds, nlevsoi) - case default - call endrun(subname // ':: a root fraction function must be specified!') - end select - rootfr(bounds%begp:bounds%endp,nlevsoi+1:nlevgrnd)=0._r8 - - ! shift roots up above bedrock boundary (distribute equally to each layer) - ! may not matter if normalized later - do p = bounds%begp,bounds%endp - c = patch%column(p) - rootfr(p,1:col%nbedrock(c)) = rootfr(p,1:col%nbedrock(c)) & - + sum(rootfr(p,col%nbedrock(c)+1:nlevsoi))/real(col%nbedrock(c)) - rootfr(p,col%nbedrock(c)+1:nlevsoi) = 0._r8 - enddo - end subroutine init_vegrootfr - - !------------------------------------------------------------------------- - function zeng2001_rootfr(bounds, ubj) result(rootfr) - ! - ! DESCRIPTION - ! compute root profile for soil water uptake - ! using equation from Zeng 2001, J. Hydrometeorology - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! ubnd - ! - ! !RESULT - real(r8) :: rootfr(bounds%begp:bounds%endp , 1:ubj ) ! - ! - ! !LOCAL VARIABLES: - integer :: p, lev, c - !------------------------------------------------------------------------ - - !(computing from surface, d is depth in meter): - ! Y = 1 -1/2 (exp(-ad)+exp(-bd) under the constraint that - ! Y(d =0.1m) = 1-beta^(10 cm) and Y(d=d_obs)=0.99 with - ! beta & d_obs given in Zeng et al. (1998). - - do p = bounds%begp,bounds%endp - - if (.not. patch%is_fates(p)) then - c = patch%column(p) - do lev = 1, ubj-1 - rootfr(p,lev) = .5_r8*( & - exp(-pftcon%roota_par(patch%itype(p)) * col%zi(c,lev-1)) & - + exp(-pftcon%rootb_par(patch%itype(p)) * col%zi(c,lev-1)) & - - exp(-pftcon%roota_par(patch%itype(p)) * col%zi(c,lev )) & - - exp(-pftcon%rootb_par(patch%itype(p)) * col%zi(c,lev )) ) - end do - rootfr(p,ubj) = .5_r8*( & - exp(-pftcon%roota_par(patch%itype(p)) * col%zi(c,ubj-1)) & - + exp(-pftcon%rootb_par(patch%itype(p)) * col%zi(c,ubj-1)) ) - - else - rootfr(p,1:ubj) = 0._r8 - endif - - enddo - return - - end function zeng2001_rootfr - - !------------------------------------------------------------------------- - function jackson1996_rootfr(bounds, ubj, varindx, water_carbon) result(rootfr) - ! - ! DESCRIPTION - ! compute root profile for soil water uptake - ! using equation from Jackson et al. 1996, Oec. - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! ubnd - integer , intent(in) :: varindx ! variant index - character(len=*) , intent(in) :: water_carbon ! roots for water or carbon - ! - ! !RESULT - real(r8) :: rootfr(bounds%begp:bounds%endp , 1:ubj ) ! - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: m_to_cm = 1.e2_r8 - real(r8) :: beta !patch specific shape parameter - integer :: p, lev, c - !------------------------------------------------------------------------ - - !(computing from surface, d is depth in centimeters): - ! Y = (1 - beta^d); beta given in Jackson et al. (1996). - - rootfr(bounds%begp:bounds%endp, :) = 0._r8 - do p = bounds%begp,bounds%endp - c = patch%column(p) - if (.not.patch%is_fates(p)) then - beta = pftcon%rootprof_beta(patch%itype(p),varindx) - do lev = 1, ubj - rootfr(p,lev) = ( & - beta ** (col%zi(c,lev-1)*m_to_cm) - & - beta ** (col%zi(c,lev)*m_to_cm) ) - end do - else - rootfr(p,:) = 0. - endif - - enddo - return - - end function jackson1996_rootfr - - !------------------------------------------------------------------------- - function exponential_rootfr(bounds, ubj) result(rootfr) - ! - ! DESCRIPTION - ! compute root profile for soil water uptake - ! using equation from Koven - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use pftconMod , only : pftcon - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! ubnd - ! - ! !RESULT - real(r8) :: rootfr(bounds%begp:bounds%endp , 1:ubj ) ! - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: rootprof_exp = 3. ! how steep profile is for root C inputs (1/ e-folding depth) (1/m) - real(r8) :: norm - integer :: p, lev, c - - !------------------------------------------------------------------------ - - rootfr(bounds%begp:bounds%endp, :) = 0._r8 - do p = bounds%begp,bounds%endp - c = patch%column(p) - if (.not.patch%is_fates(p)) then - do lev = 1, ubj - rootfr(p,lev) = exp(-rootprof_exp * col%z(c,lev)) * col%dz(c,lev) - end do - else - rootfr(p,1) = 0. - endif - norm = -1./rootprof_exp * (exp(-rootprof_exp * col%z(c,ubj)) - 1._r8) - rootfr(p,:) = rootfr(p,:) / norm - - enddo - - return - - end function exponential_rootfr - -end module RootBiophysMod diff --git a/src/biogeophys/SnowHydrologyMod.F90 b/src/biogeophys/SnowHydrologyMod.F90 deleted file mode 100644 index 15f3f57674..0000000000 --- a/src/biogeophys/SnowHydrologyMod.F90 +++ /dev/null @@ -1,2143 +0,0 @@ -! -*- mode: f90; indent-tabs-mode: nil; f90-do-indent:3; f90-if-indent:3; f90-type-indent:3; f90-program-indent:2; f90-associate-indent:0; f90-continuation-indent:5 -*- -module SnowHydrologyMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate snow hydrology. - ! - Using as input aerosol deposition from atmosphere model calculate - ! aerosol fluxes and masses in each layer - need for surface albedo calculation - ! - Change of snow mass and the snow water onto soil - ! - Change in snow layer thickness due to compaction - ! - Combine snow layers less than a min thickness - ! - Subdivide snow layers if they exceed maximum thickness - ! - Construct snow/no-snow filters - - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varpar , only : nlevsno - use clm_varctl , only : iulog - use clm_varcon , only : namec, h2osno_max - use atm2lndType , only : atm2lnd_type - use AerosolMod , only : aerosol_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use LandunitType , only : lun - use TopoMod, only : topo_type - use ColumnType , only : col - use landunit_varcon , only : istsoil, istdlak, istsoil, istwet, istice_mec, istcrop - use clm_time_manager, only : get_step_size, get_nstep - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SnowHydrology_readnl ! Read namelist - public :: SnowWater ! Change of snow mass and the snow water onto soil - public :: SnowCompaction ! Change in snow layer thickness due to compaction - public :: CombineSnowLayers ! Combine snow layers less than a min thickness - public :: DivideSnowLayers ! Subdivide snow layers if they exceed maximum thickness - public :: InitSnowLayers ! Initialize cold-start snow layer thickness - public :: BuildSnowFilter ! Construct snow/no-snow filters - public :: SnowCapping ! Remove snow mass for capped columns - public :: NewSnowBulkDensity ! Compute bulk density of any newly-fallen snow - - ! The following are public just for the sake of unit testing: - public :: SnowCappingExcess ! Determine the excess snow that needs to be capped - public :: SnowHydrologySetControlForTesting ! Set some of the control settings - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: Combo ! Returns the combined variables: dz, t, wliq, wice. - private :: MassWeightedSnowRadius ! Mass weighted snow grain size - ! - ! !PUBLIC DATA MEMBERS: - ! Aerosol species indices: - ! 1= hydrophillic black carbon - ! 2= hydrophobic black carbon - ! 3= hydrophilic organic carbon - ! 4= hydrophobic organic carbon - ! 5= dust species 1 - ! 6= dust species 2 - ! 7= dust species 3 - ! 8= dust species 4 - ! - real(r8), public, parameter :: scvng_fct_mlt_bcphi = 0.20_r8 ! scavenging factor for hydrophillic BC inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_bcpho = 0.03_r8 ! scavenging factor for hydrophobic BC inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_ocphi = 0.20_r8 ! scavenging factor for hydrophillic OC inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_ocpho = 0.03_r8 ! scavenging factor for hydrophobic OC inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst1 = 0.02_r8 ! scavenging factor for dust species 1 inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst2 = 0.02_r8 ! scavenging factor for dust species 2 inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst3 = 0.01_r8 ! scavenging factor for dust species 3 inclusion in meltwater [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst4 = 0.01_r8 ! scavenging factor for dust species 4 inclusion in meltwater [frc] - - ! The following are public for the sake of unit testing - integer, parameter, public :: LoTmpDnsSlater2017 = 2 ! For temperature below -15C use equation from Slater 2017 - integer, parameter, public :: LoTmpDnsTruncatedAnderson1976 = 1 ! Truncate low temp. snow density from the Anderson-1976 version at -15C - - ! Definition of snow pack vertical structure - ! Hardcoded maximum of 12 snowlayers, this is checked elsewhere (controlMod.F90) - ! The bottom layer has no limit on thickness, hence the last element of the dzmax_* - ! arrays is 'huge'. - real(r8), parameter :: dzmin(12) = & ! minimum of top snow layer - (/ 0.010_r8, 0.015_r8, 0.025_r8, 0.055_r8, 0.115_r8, 0.235_r8, & - 0.475_r8, 0.955_r8, 1.915_r8, 3.835_r8, 7.675_r8, 15.355_r8 /) - real(r8), parameter :: dzmax_l(12) = & ! maximum thickness of layer when no layers beneath - (/ 0.03_r8, 0.07_r8, 0.18_r8, 0.41_r8, 0.88_r8, 1.83_r8, & - 3.74_r8, 7.57_r8, 15.24_r8, 30.59_r8, 61.3_r8, huge(1._r8) /) - real(r8), parameter :: dzmax_u(12) = & ! maximum thickness of layer when layers beneath - (/ 0.02_r8, 0.05_r8, 0.11_r8, 0.23_r8, 0.47_r8, 0.95_r8, & - 1.91_r8, 3.83_r8, 7.67_r8, 15.35_r8, 30.71_r8, huge(1._r8) /) - - ! - ! !PRIVATE DATA MEMBERS: - - integer, parameter :: OverburdenCompactionMethodAnderson1976 = 1 - integer, parameter :: OverburdenCompactionMethodVionnet2012 = 2 - - ! If true, the density of new snow depends on wind speed, and there is also - ! wind-dependent snow compaction - logical :: wind_dependent_snow_density ! If snow density depends on wind or not - integer :: overburden_compaction_method = -1 - integer :: new_snow_density = LoTmpDnsSlater2017 ! Snow density type - real(r8) :: upplim_destruct_metamorph = 100.0_r8 ! Upper Limit on Destructive Metamorphism Compaction [kg/m3] - real(r8) :: overburden_compress_Tfactor = 0.08_r8 ! snow compaction overburden exponential factor (1/K) - real(r8) :: min_wind_snowcompact = 5._r8 ! minimum wind speed tht results in compaction (m/s) - - ! ------------------------------------------------------------------------ - ! Parameters controlling the resetting of the snow pack - ! ------------------------------------------------------------------------ - - logical :: reset_snow = .false. ! If set to true, we reset the non-glc snow pack, based on the following parameters - logical :: reset_snow_glc = .false. ! If set to true, we reset the glc snow pack, based reset_snow_glc_ela - - ! Default for reset_snow_glc_ela implies that snow will be reset for all glacier columns if reset_snow_glc = .true. - real(r8) :: reset_snow_glc_ela = 1.e9_r8 ! equilibrium line altitude (m); snow is reset for glacier columns below this elevation if reset_snow_glc = .true. (ignored if reset_snow_glc = .false.) - - ! The following are public simply to support unit testing - - ! 35 mm was chosen by Raymond Sellevold, based on finding the location in Greenland - ! with the least amount of snowfall from Sept. 1 (roughly the end of the melt season) - ! and Jan. 1 (when we typically start simulations). This location with the least amount - ! of snowfall had an average of 35 mm snow fall over this 4-month period. - real(r8), parameter, public :: reset_snow_h2osno = 35._r8 ! mm SWE to reset the snow pack to - - ! We scale the number of reset time steps with the number of snow layers, since we can - ! remove up to one layer per time step. In the absence of snow accumulation, we might - ! be able to get away with 1 reset time step per layer. However, we specify a larger - ! number to be more robust. - real(r8), parameter, public :: reset_snow_timesteps_per_layer = 4 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SnowHydrology_readnl( NLFilename) - ! - ! !DESCRIPTION: - ! Read the namelist for SnowHydrology - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=64) :: snow_overburden_compaction_method - character(len=25) :: lotmp_snowdensity_method - - character(len=*), parameter :: subname = 'SnowHydrology_readnl' - !----------------------------------------------------------------------- - - namelist /clm_snowhydrology_inparm/ & - wind_dependent_snow_density, snow_overburden_compaction_method, & - lotmp_snowdensity_method, upplim_destruct_metamorph, & - overburden_compress_Tfactor, min_wind_snowcompact, & - reset_snow, reset_snow_glc, reset_snow_glc_ela - - ! Initialize options to default values, in case they are not specified in the namelist - wind_dependent_snow_density = .false. - snow_overburden_compaction_method = ' ' - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in clm_SnowHydrology_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_SnowHydrology_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_snowhydrology_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_snowhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_snowhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (wind_dependent_snow_density, mpicom) - call shr_mpi_bcast (snow_overburden_compaction_method, mpicom) - call shr_mpi_bcast (lotmp_snowdensity_method , mpicom) - call shr_mpi_bcast (upplim_destruct_metamorph , mpicom) - call shr_mpi_bcast (overburden_compress_Tfactor, mpicom) - call shr_mpi_bcast (min_wind_snowcompact , mpicom) - call shr_mpi_bcast (reset_snow , mpicom) - call shr_mpi_bcast (reset_snow_glc , mpicom) - call shr_mpi_bcast (reset_snow_glc_ela , mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'SnowHydrology settings:' - write(iulog,nml=clm_snowhydrology_inparm) - write(iulog,*) ' ' - end if - - if ( trim(lotmp_snowdensity_method) == 'Slater2017' ) then - new_snow_density = LoTmpDnsSlater2017 - else if ( trim(lotmp_snowdensity_method) == 'TruncatedAnderson1976' ) then - new_snow_density = LoTmpDnsTruncatedAnderson1976 - else - call endrun(msg="ERROR bad lotmp_snowdensity_method name"//errmsg(sourcefile, __LINE__)) - end if - - if (trim(snow_overburden_compaction_method) == 'Anderson1976') then - overburden_compaction_method = OverburdenCompactionMethodAnderson1976 - else if (trim(snow_overburden_compaction_method) == 'Vionnet2012') then - overburden_compaction_method = OverburdenCompactionMethodVionnet2012 - else - call endrun(msg="ERROR bad snow_overburden_compaction_method name"// & - errMsg(sourcefile, __LINE__)) - end if - - end subroutine SnowHydrology_readnl - - - !----------------------------------------------------------------------- - subroutine SnowWater(bounds, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc, & - atm2lnd_inst, waterflux_inst, waterstate_inst, aerosol_inst) - ! - ! !DESCRIPTION: - ! Evaluate the change of snow mass and the snow water onto soil. - ! Water flow within snow is computed by an explicit and non-physical - ! based scheme, which permits a part of liquid water over the holding - ! capacity (a tentative value is used, i.e. equal to 0.033*porosity) to - ! percolate into the underlying layer. Except for cases where the - ! porosity of one of the two neighboring layers is less than 0.05, zero - ! flow is assumed. The water flow out of the bottom of the snow pack will - ! participate as the input of the soil water and runoff. This subroutine - ! uses a filter for columns containing snow which must be constructed prior - ! to being called. - ! - ! !USES: - use clm_varcon , only : denh2o, denice, wimp, ssi - use AerosolMod , only : AerosolFluxes - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_snowc ! number of snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - integer , intent(in) :: num_nosnowc ! number of non-snow points in column filter - integer , intent(in) :: filter_nosnowc(:) ! column filter for non-snow points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(aerosol_type) , intent(inout) :: aerosol_inst - ! - ! !LOCAL VARIABLES: - integer :: g ! gridcell loop index - integer :: c, j, fc, l ! do loop/array indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: qin(bounds%begc:bounds%endc) ! water flow into the element (mm/s) - real(r8) :: qout(bounds%begc:bounds%endc) ! water flow out of the elmement (mm/s) - real(r8) :: qin_bc_phi (bounds%begc:bounds%endc) ! flux of hydrophilic BC into layer [kg] - real(r8) :: qout_bc_phi (bounds%begc:bounds%endc) ! flux of hydrophilic BC out of layer [kg] - real(r8) :: qin_bc_pho (bounds%begc:bounds%endc) ! flux of hydrophobic BC into layer [kg] - real(r8) :: qout_bc_pho (bounds%begc:bounds%endc) ! flux of hydrophobic BC out of layer [kg] - real(r8) :: qin_oc_phi (bounds%begc:bounds%endc) ! flux of hydrophilic OC into layer [kg] - real(r8) :: qout_oc_phi (bounds%begc:bounds%endc) ! flux of hydrophilic OC out of layer [kg] - real(r8) :: qin_oc_pho (bounds%begc:bounds%endc) ! flux of hydrophobic OC into layer [kg] - real(r8) :: qout_oc_pho (bounds%begc:bounds%endc) ! flux of hydrophobic OC out of layer [kg] - real(r8) :: qin_dst1 (bounds%begc:bounds%endc) ! flux of dust species 1 into layer [kg] - real(r8) :: qout_dst1 (bounds%begc:bounds%endc) ! flux of dust species 1 out of layer [kg] - real(r8) :: qin_dst2 (bounds%begc:bounds%endc) ! flux of dust species 2 into layer [kg] - real(r8) :: qout_dst2 (bounds%begc:bounds%endc) ! flux of dust species 2 out of layer [kg] - real(r8) :: qin_dst3 (bounds%begc:bounds%endc) ! flux of dust species 3 into layer [kg] - real(r8) :: qout_dst3 (bounds%begc:bounds%endc) ! flux of dust species 3 out of layer [kg] - real(r8) :: qin_dst4 (bounds%begc:bounds%endc) ! flux of dust species 4 into layer [kg] - real(r8) :: qout_dst4 (bounds%begc:bounds%endc) ! flux of dust species 4 out of layer [kg] - real(r8) :: wgdif ! ice mass after minus sublimation - real(r8) :: vol_liq(bounds%begc:bounds%endc,-nlevsno+1:0) ! partial volume of liquid water in layer - real(r8) :: vol_ice(bounds%begc:bounds%endc,-nlevsno+1:0) ! partial volume of ice lens in layer - real(r8) :: eff_porosity(bounds%begc:bounds%endc,-nlevsno+1:0) ! effective porosity = porosity - vol_ice - real(r8) :: mss_liqice(bounds%begc:bounds%endc,-nlevsno+1:0) ! mass of liquid+ice in a layer - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - int_snow => waterstate_inst%int_snow_col , & ! Output: [real(r8) (:) ] integrated snowfall [mm] - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - - qflx_snomelt => waterflux_inst%qflx_snomelt_col , & ! Input: [real(r8) (:) ] snow melt (mm H2O /s) - qflx_rain_grnd => waterflux_inst%qflx_rain_grnd_col , & ! Input: [real(r8) (:) ] rain on ground after interception (mm H2O/s) [+] - qflx_sub_snow => waterflux_inst%qflx_sub_snow_col , & ! Input: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_col , & ! Input: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_evap_grnd => waterflux_inst%qflx_evap_grnd_col , & ! Input: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_col , & ! Input: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_snow_drain => waterflux_inst%qflx_snow_drain_col,& ! Output: [real(r8) (:) ] net snow melt - qflx_top_soil => waterflux_inst%qflx_top_soil_col , & ! Output: [real(r8) (:) ] net water input into soil from top (mm/s) - snow_depth => waterstate_inst%snow_depth_col , & ! Output: [real(r8) (:) ] snow height (m) - - mss_bcphi => aerosol_inst%mss_bcphi_col , & ! Output: [real(r8) (:,:) ] hydrophillic BC mass in snow (col,lyr) [kg] - mss_bcpho => aerosol_inst%mss_bcpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic BC mass in snow (col,lyr) [kg] - mss_ocphi => aerosol_inst%mss_ocphi_col , & ! Output: [real(r8) (:,:) ] hydrophillic OC mass in snow (col,lyr) [kg] - mss_ocpho => aerosol_inst%mss_ocpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic OC mass in snow (col,lyr) [kg] - mss_dst1 => aerosol_inst%mss_dst1_col , & ! Output: [real(r8) (:,:) ] mass of dust species 1 in snow (col,lyr) [kg] - mss_dst2 => aerosol_inst%mss_dst2_col , & ! Output: [real(r8) (:,:) ] mass of dust species 2 in snow (col,lyr) [kg] - mss_dst3 => aerosol_inst%mss_dst3_col , & ! Output: [real(r8) (:,:) ] mass of dust species 3 in snow (col,lyr) [kg] - mss_dst4 => aerosol_inst%mss_dst4_col , & ! Output: [real(r8) (:,:) ] mass of dust species 4 in snow (col,lyr) [kg] - - begc => bounds%begc , & - endc => bounds%endc & - ) - - ! Determine model time step - - dtime = get_step_size() - - ! Renew the mass of ice lens (h2osoi_ice) and liquid (h2osoi_liq) in the - ! surface snow layer resulting from sublimation (frost) / evaporation (condense) - - do fc = 1,num_snowc - c = filter_snowc(fc) - l=col%landunit(c) - - wgdif = h2osoi_ice(c,snl(c)+1) & - + frac_sno_eff(c) * (qflx_dew_snow(c) - qflx_sub_snow(c)) * dtime - h2osoi_ice(c,snl(c)+1) = wgdif - if (wgdif < 0._r8) then - h2osoi_ice(c,snl(c)+1) = 0._r8 - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + wgdif - end if - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + & - frac_sno_eff(c) * (qflx_rain_grnd(c) + qflx_dew_grnd(c) & - - qflx_evap_grnd(c)) * dtime - - ! if negative, reduce deeper layer's liquid water content sequentially - if(h2osoi_liq(c,snl(c)+1) < 0._r8) then - do j = snl(c)+1, 1 - wgdif=h2osoi_liq(c,j) - if (wgdif >= 0._r8) exit - h2osoi_liq(c,j) = 0._r8 - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) + wgdif - enddo - end if - end do - - ! Porosity and partial volume - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - ! need to scale dz by frac_sno to convert to grid cell average depth - vol_ice(c,j) = min(1._r8, h2osoi_ice(c,j)/(dz(c,j)*frac_sno_eff(c)*denice)) - eff_porosity(c,j) = 1._r8 - vol_ice(c,j) - vol_liq(c,j) = min(eff_porosity(c,j),h2osoi_liq(c,j)/(dz(c,j)*frac_sno_eff(c)*denh2o)) - end if - end do - end do - - ! Capillary forces within snow are usually two or more orders of magnitude - ! less than those of gravity. Only gravity terms are considered. - ! the genernal expression for water flow is "K * ss**3", however, - ! no effective parameterization for "K". Thus, a very simple consideration - ! (not physically based) is introduced: - ! when the liquid water of layer exceeds the layer's holding - ! capacity, the excess meltwater adds to the underlying neighbor layer. - - ! Also compute aerosol fluxes through snowpack in this loop: - ! 1) compute aerosol mass in each layer - ! 2) add aerosol mass flux from above layer to mass of this layer - ! 3) qout_xxx is mass flux of aerosol species xxx out bottom of - ! layer in water flow, proportional to (current) concentration - ! of aerosol in layer multiplied by a scavenging ratio. - ! 4) update mass of aerosol in top layer, accordingly - ! 5) update mass concentration of aerosol accordingly - - do c = bounds%begc,bounds%endc - qin(c) = 0._r8 - qin_bc_phi (c) = 0._r8 - qin_bc_pho (c) = 0._r8 - qin_oc_phi (c) = 0._r8 - qin_oc_pho (c) = 0._r8 - qin_dst1 (c) = 0._r8 - qin_dst2 (c) = 0._r8 - qin_dst3 (c) = 0._r8 - qin_dst4 (c) = 0._r8 - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - - h2osoi_liq(c,j) = h2osoi_liq(c,j) + qin(c) - - mss_bcphi(c,j) = mss_bcphi(c,j) + qin_bc_phi(c) - mss_bcpho(c,j) = mss_bcpho(c,j) + qin_bc_pho(c) - mss_ocphi(c,j) = mss_ocphi(c,j) + qin_oc_phi(c) - mss_ocpho(c,j) = mss_ocpho(c,j) + qin_oc_pho(c) - - mss_dst1(c,j) = mss_dst1(c,j) + qin_dst1(c) - mss_dst2(c,j) = mss_dst2(c,j) + qin_dst2(c) - mss_dst3(c,j) = mss_dst3(c,j) + qin_dst3(c) - mss_dst4(c,j) = mss_dst4(c,j) + qin_dst4(c) - - if (j <= -1) then - ! No runoff over snow surface, just ponding on surface - if (eff_porosity(c,j) < wimp .OR. eff_porosity(c,j+1) < wimp) then - qout(c) = 0._r8 - else - ! dz must be scaled by frac_sno to obtain gridcell average value - qout(c) = max(0._r8,(vol_liq(c,j) & - - ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) - qout(c) = min(qout(c),(1._r8-vol_ice(c,j+1) & - - vol_liq(c,j+1))*dz(c,j+1)*frac_sno_eff(c)) - end if - else - qout(c) = max(0._r8,(vol_liq(c,j) & - - ssi*eff_porosity(c,j))*dz(c,j)*frac_sno_eff(c)) - end if - qout(c) = qout(c)*1000._r8 - h2osoi_liq(c,j) = h2osoi_liq(c,j) - qout(c) - qin(c) = qout(c) - - ! mass of ice+water: in extremely rare circumstances, this can - ! be zero, even though there is a snow layer defined. In - ! this case, set the mass to a very small value to - ! prevent division by zero. - - mss_liqice(c,j) = h2osoi_liq(c,j)+h2osoi_ice(c,j) - if (mss_liqice(c,j) < 1E-30_r8) then - mss_liqice(c,j) = 1E-30_r8 - endif - - ! BCPHI: - ! 1. flux with meltwater: - qout_bc_phi(c) = qout(c)*scvng_fct_mlt_bcphi*(mss_bcphi(c,j)/mss_liqice(c,j)) - if (qout_bc_phi(c) > mss_bcphi(c,j)) then - qout_bc_phi(c) = mss_bcphi(c,j) - endif - mss_bcphi(c,j) = mss_bcphi(c,j) - qout_bc_phi(c) - qin_bc_phi(c) = qout_bc_phi(c) - - ! BCPHO: - ! 1. flux with meltwater: - qout_bc_pho(c) = qout(c)*scvng_fct_mlt_bcpho*(mss_bcpho(c,j)/mss_liqice(c,j)) - if (qout_bc_pho(c) > mss_bcpho(c,j)) then - qout_bc_pho(c) = mss_bcpho(c,j) - endif - mss_bcpho(c,j) = mss_bcpho(c,j) - qout_bc_pho(c) - qin_bc_pho(c) = qout_bc_pho(c) - - ! OCPHI: - ! 1. flux with meltwater: - qout_oc_phi(c) = qout(c)*scvng_fct_mlt_ocphi*(mss_ocphi(c,j)/mss_liqice(c,j)) - if (qout_oc_phi(c) > mss_ocphi(c,j)) then - qout_oc_phi(c) = mss_ocphi(c,j) - endif - mss_ocphi(c,j) = mss_ocphi(c,j) - qout_oc_phi(c) - qin_oc_phi(c) = qout_oc_phi(c) - - ! OCPHO: - ! 1. flux with meltwater: - qout_oc_pho(c) = qout(c)*scvng_fct_mlt_ocpho*(mss_ocpho(c,j)/mss_liqice(c,j)) - if (qout_oc_pho(c) > mss_ocpho(c,j)) then - qout_oc_pho(c) = mss_ocpho(c,j) - endif - mss_ocpho(c,j) = mss_ocpho(c,j) - qout_oc_pho(c) - qin_oc_pho(c) = qout_oc_pho(c) - - ! DUST 1: - ! 1. flux with meltwater: - qout_dst1(c) = qout(c)*scvng_fct_mlt_dst1*(mss_dst1(c,j)/mss_liqice(c,j)) - if (qout_dst1(c) > mss_dst1(c,j)) then - qout_dst1(c) = mss_dst1(c,j) - endif - mss_dst1(c,j) = mss_dst1(c,j) - qout_dst1(c) - qin_dst1(c) = qout_dst1(c) - - ! DUST 2: - ! 1. flux with meltwater: - qout_dst2(c) = qout(c)*scvng_fct_mlt_dst2*(mss_dst2(c,j)/mss_liqice(c,j)) - if (qout_dst2(c) > mss_dst2(c,j)) then - qout_dst2(c) = mss_dst2(c,j) - endif - mss_dst2(c,j) = mss_dst2(c,j) - qout_dst2(c) - qin_dst2(c) = qout_dst2(c) - - ! DUST 3: - ! 1. flux with meltwater: - qout_dst3(c) = qout(c)*scvng_fct_mlt_dst3*(mss_dst3(c,j)/mss_liqice(c,j)) - if (qout_dst3(c) > mss_dst3(c,j)) then - qout_dst3(c) = mss_dst3(c,j) - endif - mss_dst3(c,j) = mss_dst3(c,j) - qout_dst3(c) - qin_dst3(c) = qout_dst3(c) - - ! DUST 4: - ! 1. flux with meltwater: - qout_dst4(c) = qout(c)*scvng_fct_mlt_dst4*(mss_dst4(c,j)/mss_liqice(c,j)) - if (qout_dst4(c) > mss_dst4(c,j)) then - qout_dst4(c) = mss_dst4(c,j) - endif - mss_dst4(c,j) = mss_dst4(c,j) - qout_dst4(c) - qin_dst4(c) = qout_dst4(c) - - end if - end do - end do - - ! Compute aerosol fluxes through snowpack and aerosol deposition fluxes into top layere - - call AerosolFluxes(bounds, num_snowc, filter_snowc, & - atm2lnd_inst, aerosol_inst) - - ! Adjust layer thickness for any water+ice content changes in excess of previous - ! layer thickness. Strictly speaking, only necessary for top snow layer, but doing - ! it for all snow layers will catch problems with older initial files. - ! Layer interfaces (zi) and node depths (z) do not need adjustment here because they - ! are adjusted in CombineSnowLayers and are not used up to that point. - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - dz(c,j) = max(dz(c,j),h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice) - end if - end do - end do - - do fc = 1, num_snowc - c = filter_snowc(fc) - ! Qout from snow bottom - qflx_snow_drain(c) = qflx_snow_drain(c) + (qout(c) / dtime) - - qflx_top_soil(c) = (qout(c) / dtime) & - + (1.0_r8 - frac_sno_eff(c)) * qflx_rain_grnd(c) - int_snow(c) = int_snow(c) + frac_sno_eff(c) & - * (qflx_dew_snow(c) + qflx_dew_grnd(c) + qflx_rain_grnd(c)) * dtime - end do - - do fc = 1, num_nosnowc - c = filter_nosnowc(fc) - qflx_snow_drain(c) = qflx_snomelt(c) - - qflx_top_soil(c) = qflx_rain_grnd(c) + qflx_snomelt(c) - ! reset accumulated snow when no snow present - if (h2osno(c) <= 0._r8) then - int_snow(c) = 0._r8 - frac_sno(c) = 0._r8 - snow_depth(c) = 0._r8 - end if - end do - - end associate - end subroutine SnowWater - - !----------------------------------------------------------------------- - subroutine SnowCompaction(bounds, num_snowc, filter_snowc, & - temperature_inst, waterstate_inst, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Determine the change in snow layer thickness due to compaction and - ! settling. - ! Three metamorphisms of changing snow characteristics are implemented, - ! i.e., destructive, overburden, and melt. The treatments of the former - ! two are from SNTHERM.89 and SNTHERM.99 (1991, 1999). The contribution - ! due to melt metamorphism is simply taken as a ratio of snow ice - ! fraction after the melting versus before the melting. - ! - ! !USES: - use clm_varcon , only : denice, denh2o, tfrz, rpi, int_snow_max - use clm_varctl , only : subgridflag - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_snowc ! number of column snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: j, l, c, fc ! indices - integer :: g ! gridcell index - real(r8):: dtime ! land model time step (sec) - ! parameters - real(r8), parameter :: c3 = 2.777e-6_r8 ! [1/s] - real(r8), parameter :: c4 = 0.04_r8 ! [1/K] - real(r8), parameter :: c5 = 2.0_r8 ! - ! - real(r8) :: burden(bounds%begc:bounds%endc) ! pressure of overlying snow [kg/m2] - real(r8) :: zpseudo(bounds%begc:bounds%endc) ! wind drift compaction / pseudo depth (only valid if wind_dependent_snow_density is .true.) - logical :: mobile(bounds%begc:bounds%endc) ! current snow layer is mobile, i.e. susceptible to wind drift (only valid if wind_dependent_snow_density is .true.) - real(r8) :: ddz1 ! Rate of settling of snowpack due to destructive metamorphism. - real(r8) :: ddz2 ! Rate of compaction of snowpack due to overburden. - real(r8) :: ddz3 ! Rate of compaction of snowpack due to melt [1/s] - real(r8) :: dexpf ! expf=exp(-c4*(273.15-t_soisno)). - real(r8) :: fi ! Fraction of ice relative to the total water content at current time step - real(r8) :: td ! t_soisno - tfrz [K] - real(r8) :: pdzdtc ! Nodal rate of change in fractional-thickness due to compaction [fraction/s] - real(r8) :: void ! void (1 - vol_ice - vol_liq) - real(r8) :: wx ! water mass (ice+liquid) [kg/m2] - real(r8) :: bi ! partial density of ice [kg/m3] - real(r8) :: wsum ! snowpack total water mass (ice+liquid) [kg/m2] - real(r8) :: fsno_melt - real(r8) :: ddz4 ! Rate of compaction of snowpack due to wind drift. - real(r8) :: int_snow_limited ! integrated snowfall, limited to be no greater than int_snow_max [mm] - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - n_melt => col%n_melt , & ! Input: [real(r8) (:) ] SCA shape parameter - lakpoi => lun%lakpoi , & ! Input: [logical (:) ] true => landunit is a lake point - urbpoi => lun%urbpoi , & ! Input: [logical (:) ] true => landunit is an urban point - forc_wind => atm2lnd_inst%forc_wind_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - imelt => temperature_inst%imelt_col , & ! Input: [integer (:,:) ] flag for melting (=1), freezing (=2), Not=0 - - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] snow covered fraction - swe_old => waterstate_inst%swe_old_col , & ! Input: [real(r8) (:,:) ] initial swe values - int_snow => waterstate_inst%int_snow_col , & ! Input: [real(r8) (:) ] integrated snowfall [mm] - frac_iceold => waterstate_inst%frac_iceold_col , & ! Input: [real(r8) (:,:) ] fraction of ice relative to the tot water - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - - dz => col%dz & ! Output: [real(r8) (: ,:) ] layer depth (m) - ) - - ! Get time step - - dtime = get_step_size() - - ! Begin calculation - note that the following column loops are only invoked if snl(c) < 0 - - do fc = 1, num_snowc - c = filter_snowc(fc) - - burden(c) = 0._r8 - zpseudo(c) = 0._r8 - mobile(c) = .true. - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - g = col%gridcell(c) - if (j >= snl(c)+1) then - - wx = (h2osoi_ice(c,j) + h2osoi_liq(c,j)) - void = 1._r8 - (h2osoi_ice(c,j)/denice + h2osoi_liq(c,j)/denh2o)& - /(frac_sno(c) * dz(c,j)) - - ! Allow compaction only for non-saturated node and higher ice lens node. - if (void > 0.001_r8 .and. h2osoi_ice(c,j) > .1_r8) then - - bi = h2osoi_ice(c,j) / (frac_sno(c) * dz(c,j)) - fi = h2osoi_ice(c,j) / wx - td = tfrz-t_soisno(c,j) - dexpf = exp(-c4*td) - - ! Settling as a result of destructive metamorphism - - ddz1 = -c3*dexpf - if (bi > upplim_destruct_metamorph) ddz1 = ddz1*exp(-46.0e-3_r8*(bi-upplim_destruct_metamorph)) - - ! Liquid water term - - if (h2osoi_liq(c,j) > 0.01_r8*dz(c,j)*frac_sno(c)) ddz1=ddz1*c5 - - select case (overburden_compaction_method) - case (OverburdenCompactionMethodAnderson1976) - ddz2 = OverburdenCompactionAnderson1976( & - burden = burden(c), & - wx = wx, & - td = td, & - bi = bi) - - case (OverburdenCompactionMethodVionnet2012) - ddz2 = OverburdenCompactionVionnet2012( & - h2osoi_liq = h2osoi_liq(c,j), & - dz = dz(c,j), & - burden = burden(c), & - wx = wx, & - td = td, & - bi = bi) - - case default - call endrun(msg="Unknown overburden_compaction_method") - end select - - ! Compaction occurring during melt - - if (imelt(c,j) == 1) then - l = col%landunit(c) - ! For consistency with other uses of subgridflag==1 (e.g., in - ! CanopyHydrologyMod), we apply this code over all landunits other - ! than lake and urban. (In CanopyHydrologyMod, the uses of subgridflag - ! are in a nolake filter, and check .not. urbpoi.) - if(subgridflag==1 .and. (.not. lakpoi(l) .and. .not. urbpoi(l))) then - ! first term is delta mass over mass - ddz3 = max(0._r8,min(1._r8,(swe_old(c,j) - wx)/wx)) - - ! 2nd term is delta fsno over fsno, allowing for negative values for ddz3 - if((swe_old(c,j) - wx) > 0._r8) then - wsum = sum(h2osoi_liq(c,snl(c)+1:0)+h2osoi_ice(c,snl(c)+1:0)) - int_snow_limited = min(int_snow(c), int_snow_max) - fsno_melt = 1. - (acos(2.*min(1._r8,wsum/int_snow_limited) - 1._r8)/rpi)**(n_melt(c)) - - ddz3 = ddz3 - max(0._r8,(fsno_melt - frac_sno(c))/frac_sno(c)) - endif - ddz3 = -1._r8/dtime * ddz3 - else - ddz3 = - 1._r8/dtime * max(0._r8,(frac_iceold(c,j) - fi)/frac_iceold(c,j)) - endif - else - ddz3 = 0._r8 - end if - - ! Compaction occurring due to wind drift - if (wind_dependent_snow_density) then - call WindDriftCompaction( & - bi = bi, & - forc_wind = forc_wind(g), & - dz = dz(c,j), & - zpseudo = zpseudo(c), & - mobile = mobile(c), & - compaction_rate = ddz4) - else - ddz4 = 0.0_r8 - end if - - ! Time rate of fractional change in dz (units of s-1) - pdzdtc = ddz1 + ddz2 + ddz3 + ddz4 - - ! The change in dz due to compaction - ! Limit compaction to be no greater than fully saturated layer thickness - dz(c,j) = max(dz(c,j) * (1._r8+pdzdtc*dtime),(h2osoi_ice(c,j)/denice+ h2osoi_liq(c,j)/denh2o)/frac_sno(c)) - - else - ! saturated node is immobile - ! - ! This is only needed if wind_dependent_snow_density is true, but it's - ! simplest just to update mobile always - mobile(c) = .false. - end if - - ! Pressure of overlying snow - - burden(c) = burden(c) + wx - - end if - end do - end do - - end associate - end subroutine SnowCompaction - - !----------------------------------------------------------------------- - subroutine CombineSnowLayers(bounds, num_snowc, filter_snowc, & - aerosol_inst, temperature_inst, waterflux_inst, waterstate_inst) - ! - ! !DESCRIPTION: - ! Combine snow layers that are less than a minimum thickness or mass - ! If the snow element thickness or mass is less than a prescribed minimum, - ! then it is combined with a neighboring element. The subroutine - ! clm\_combo.f90 then executes the combination of mass and energy. - ! - ! !USES: - use LakeCon , only : lsadz - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(inout) :: num_snowc ! number of column snow points in column filter - integer , intent(inout) :: filter_snowc(:) ! column filter for snow points - type(aerosol_type) , intent(inout) :: aerosol_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c, fc ! column indices - integer :: i,k ! loop indices - integer :: j,l ! node indices - integer :: msn_old(bounds%begc:bounds%endc) ! number of top snow layer - integer :: mssi(bounds%begc:bounds%endc) ! node index - integer :: neibor ! adjacent node selected for combination - real(r8):: zwice(bounds%begc:bounds%endc) ! total ice mass in snow - real(r8):: zwliq (bounds%begc:bounds%endc) ! total liquid water in snow - real(r8):: dzminloc(size(dzmin)) ! minimum of top snow layer (local) - real(r8):: dtime !land model time step (sec) - - !----------------------------------------------------------------------- - - associate( & - ltype => lun%itype , & ! Input: [integer (:) ] landunit type - urbpoi => lun%urbpoi , & ! Input: [logical (:) ] true => landunit is an urban point - - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - - mss_bcphi => aerosol_inst%mss_bcphi_col , & ! Output: [real(r8) (:,:) ] hydrophilic BC mass in snow (col,lyr) [kg] - mss_bcpho => aerosol_inst%mss_bcpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic BC mass in snow (col,lyr) [kg] - mss_ocphi => aerosol_inst%mss_ocphi_col , & ! Output: [real(r8) (:,:) ] hydrophilic OC mass in snow (col,lyr) [kg] - mss_ocpho => aerosol_inst%mss_ocpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic OC mass in snow (col,lyr) [kg] - mss_dst1 => aerosol_inst%mss_dst1_col , & ! Output: [real(r8) (:,:) ] dust species 1 mass in snow (col,lyr) [kg] - mss_dst2 => aerosol_inst%mss_dst2_col , & ! Output: [real(r8) (:,:) ] dust species 2 mass in snow (col,lyr) [kg] - mss_dst3 => aerosol_inst%mss_dst3_col , & ! Output: [real(r8) (:,:) ] dust species 3 mass in snow (col,lyr) [kg] - mss_dst4 => aerosol_inst%mss_dst4_col , & ! Output: [real(r8) (:,:) ] dust species 4 mass in snow (col,lyr) [kg] - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Output: [real(r8) (:) ] snow height (m) - int_snow => waterstate_inst%int_snow_col , & ! Output: [real(r8) (:) ] integrated snowfall [mm] - h2osno => waterstate_inst%h2osno_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - snw_rds => waterstate_inst%snw_rds_col , & ! Output: [real(r8) (:,:) ] effective snow grain radius (col,lyr) [microns, m^-6] - - qflx_sl_top_soil => waterflux_inst%qflx_sl_top_soil_col , & ! Output: [real(r8) (:) ] liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - - snl => col%snl , & ! Output: [integer (:) ] number of snow layers - dz => col%dz , & ! Output: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Output: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z & ! Output: [real(r8) (:,:) ] layer thickness (m) - ) - - ! Determine model time step - - dtime = get_step_size() - - ! Check the mass of ice lens of snow, when the total is less than a small value, - ! combine it with the underlying neighbor. - - dzminloc(:) = dzmin(:) ! dzmin will stay constant between timesteps - - ! Add lsadz to dzmin for lakes - ! Determine whether called from LakeHydrology - ! Note: this assumes that this function is called separately with the lake-snow and non-lake-snow filters. - if (num_snowc > 0) then - c = filter_snowc(1) - l = col%landunit(c) - if (ltype(l) == istdlak) then ! Called from LakeHydrology - dzminloc(:) = dzmin(:) + lsadz - end if - end if - - do fc = 1, num_snowc - c = filter_snowc(fc) - - msn_old(c) = snl(c) - qflx_sl_top_soil(c) = 0._r8 - end do - - ! The following loop is NOT VECTORIZED - - do fc = 1, num_snowc - c = filter_snowc(fc) - l = col%landunit(c) - do j = msn_old(c)+1,0 - ! use 0.01 to avoid runaway ice buildup - if (h2osoi_ice(c,j) <= .01_r8) then - if (ltype(l) == istsoil .or. urbpoi(l) .or. ltype(l) == istcrop) then - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) + h2osoi_liq(c,j) - h2osoi_ice(c,j+1) = h2osoi_ice(c,j+1) + h2osoi_ice(c,j) - - if (j == 0) then - qflx_sl_top_soil(c) = (h2osoi_liq(c,j) + h2osoi_ice(c,j))/dtime - end if - - if (j /= 0) dz(c,j+1) = dz(c,j+1) + dz(c,j) - - ! NOTE: Temperature, and similarly snw_rds, of the - ! underlying snow layer are NOT adjusted in this case. - ! Because the layer being eliminated has a small mass, - ! this should not make a large difference, but it - ! would be more thorough to do so. - if (j /= 0) then - mss_bcphi(c,j+1) = mss_bcphi(c,j+1) + mss_bcphi(c,j) - mss_bcpho(c,j+1) = mss_bcpho(c,j+1) + mss_bcpho(c,j) - mss_ocphi(c,j+1) = mss_ocphi(c,j+1) + mss_ocphi(c,j) - mss_ocpho(c,j+1) = mss_ocpho(c,j+1) + mss_ocpho(c,j) - mss_dst1(c,j+1) = mss_dst1(c,j+1) + mss_dst1(c,j) - mss_dst2(c,j+1) = mss_dst2(c,j+1) + mss_dst2(c,j) - mss_dst3(c,j+1) = mss_dst3(c,j+1) + mss_dst3(c,j) - mss_dst4(c,j+1) = mss_dst4(c,j+1) + mss_dst4(c,j) - end if - - else if (ltype(l) /= istsoil .and. .not. urbpoi(l) .and. ltype(l) /= istcrop .and. j /= 0) then - - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) + h2osoi_liq(c,j) - h2osoi_ice(c,j+1) = h2osoi_ice(c,j+1) + h2osoi_ice(c,j) - dz(c,j+1) = dz(c,j+1) + dz(c,j) - - mss_bcphi(c,j+1) = mss_bcphi(c,j+1) + mss_bcphi(c,j) - mss_bcpho(c,j+1) = mss_bcpho(c,j+1) + mss_bcpho(c,j) - mss_ocphi(c,j+1) = mss_ocphi(c,j+1) + mss_ocphi(c,j) - mss_ocpho(c,j+1) = mss_ocpho(c,j+1) + mss_ocpho(c,j) - mss_dst1(c,j+1) = mss_dst1(c,j+1) + mss_dst1(c,j) - mss_dst2(c,j+1) = mss_dst2(c,j+1) + mss_dst2(c,j) - mss_dst3(c,j+1) = mss_dst3(c,j+1) + mss_dst3(c,j) - mss_dst4(c,j+1) = mss_dst4(c,j+1) + mss_dst4(c,j) - - end if - - ! shift all elements above this down one. - if (j > snl(c)+1 .and. snl(c) < -1) then - do i = j, snl(c)+2, -1 - ! If the layer closest to the surface is less than 0.1 mm and the ltype is not - ! urban, soil or crop, the h2osoi_liq and h2osoi_ice associated with this layer is sent - ! to qflx_qrgwl later on in the code. To keep track of this for the snow balance - ! error check, we add this to qflx_sl_top_soil here - if (ltype(l) /= istsoil .and. ltype(l) /= istcrop .and. .not. urbpoi(l) .and. i == 0) then - qflx_sl_top_soil(c) = (h2osoi_liq(c,i) + h2osoi_ice(c,i))/dtime - end if - - t_soisno(c,i) = t_soisno(c,i-1) - h2osoi_liq(c,i) = h2osoi_liq(c,i-1) - h2osoi_ice(c,i) = h2osoi_ice(c,i-1) - - mss_bcphi(c,i) = mss_bcphi(c,i-1) - mss_bcpho(c,i) = mss_bcpho(c,i-1) - mss_ocphi(c,i) = mss_ocphi(c,i-1) - mss_ocpho(c,i) = mss_ocpho(c,i-1) - mss_dst1(c,i) = mss_dst1(c,i-1) - mss_dst2(c,i) = mss_dst2(c,i-1) - mss_dst3(c,i) = mss_dst3(c,i-1) - mss_dst4(c,i) = mss_dst4(c,i-1) - snw_rds(c,i) = snw_rds(c,i-1) - - dz(c,i) = dz(c,i-1) - end do - end if - snl(c) = snl(c) + 1 - end if - end do - end do - - do fc = 1, num_snowc - c = filter_snowc(fc) - h2osno(c) = 0._r8 - snow_depth(c) = 0._r8 - zwice(c) = 0._r8 - zwliq(c) = 0._r8 - end do - - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - h2osno(c) = h2osno(c) + h2osoi_ice(c,j) + h2osoi_liq(c,j) - snow_depth(c) = snow_depth(c) + dz(c,j) - zwice(c) = zwice(c) + h2osoi_ice(c,j) - zwliq(c) = zwliq(c) + h2osoi_liq(c,j) - end if - end do - end do - - ! Check the snow depth - all snow gone - ! The liquid water assumes ponding on soil surface. - - do fc = 1, num_snowc - c = filter_snowc(fc) - l = col%landunit(c) - if (snow_depth(c) > 0._r8) then - if ((ltype(l) == istdlak .and. snow_depth(c) < 0.01_r8 + lsadz ) .or. & - ((ltype(l) /= istdlak) .and. ((frac_sno_eff(c)*snow_depth(c) < 0.01_r8) & - .or. (h2osno(c)/(frac_sno_eff(c)*snow_depth(c)) < 50._r8)))) then - - snl(c) = 0 - h2osno(c) = zwice(c) - - mss_bcphi(c,:) = 0._r8 - mss_bcpho(c,:) = 0._r8 - mss_ocphi(c,:) = 0._r8 - mss_ocpho(c,:) = 0._r8 - mss_dst1(c,:) = 0._r8 - mss_dst2(c,:) = 0._r8 - mss_dst3(c,:) = 0._r8 - mss_dst4(c,:) = 0._r8 - - if (h2osno(c) <= 0._r8) snow_depth(c) = 0._r8 - ! this is where water is transfered from layer 0 (snow) to layer 1 (soil) - if (ltype(l) == istsoil .or. urbpoi(l) .or. ltype(l) == istcrop) then - h2osoi_liq(c,0) = 0.0_r8 - h2osoi_liq(c,1) = h2osoi_liq(c,1) + zwliq(c) - end if - if (ltype(l) == istwet) then - h2osoi_liq(c,0) = 0.0_r8 - endif - if (ltype(l)==istice_mec) then - h2osoi_liq(c,0) = 0.0_r8 - endif - endif - end if - if (h2osno(c) <= 0._r8) then - snow_depth(c) = 0._r8 - frac_sno(c) = 0._r8 - frac_sno_eff(c) = 0._r8 - int_snow(c) = 0._r8 - endif - end do - - ! Check the snow depth - snow layers combined - ! The following loop IS NOT VECTORIZED - - do fc = 1, num_snowc - c = filter_snowc(fc) - - ! Two or more layers - - if (snl(c) < -1) then - - msn_old(c) = snl(c) - mssi(c) = 1 - - do i = msn_old(c)+1,0 - if ((frac_sno_eff(c)*dz(c,i) < dzminloc(mssi(c))) .or. & - ((h2osoi_ice(c,i) + h2osoi_liq(c,i))/(frac_sno_eff(c)*dz(c,i)) < 50._r8)) then - if (i == snl(c)+1) then - ! If top node is removed, combine with bottom neighbor. - neibor = i + 1 - else if (i == 0) then - ! If the bottom neighbor is not snow, combine with the top neighbor. - neibor = i - 1 - else - ! If none of the above special cases apply, combine with the thinnest neighbor - neibor = i + 1 - if ((dz(c,i-1)+dz(c,i)) < (dz(c,i+1)+dz(c,i))) neibor = i-1 - end if - - ! Node l and j are combined and stored as node j. - if (neibor > i) then - j = neibor - l = i - else - j = i - l = neibor - end if - - ! this should be included in 'Combo' for consistency, - ! but functionally it is the same to do it here - mss_bcphi(c,j)=mss_bcphi(c,j)+mss_bcphi(c,l) - mss_bcpho(c,j)=mss_bcpho(c,j)+mss_bcpho(c,l) - mss_ocphi(c,j)=mss_ocphi(c,j)+mss_ocphi(c,l) - mss_ocpho(c,j)=mss_ocpho(c,j)+mss_ocpho(c,l) - mss_dst1(c,j)=mss_dst1(c,j)+mss_dst1(c,l) - mss_dst2(c,j)=mss_dst2(c,j)+mss_dst2(c,l) - mss_dst3(c,j)=mss_dst3(c,j)+mss_dst3(c,l) - mss_dst4(c,j)=mss_dst4(c,j)+mss_dst4(c,l) - - ! mass-weighted combination of effective grain size: - snw_rds(c,j) = (snw_rds(c,j)*(h2osoi_liq(c,j)+h2osoi_ice(c,j)) + & - snw_rds(c,l)*(h2osoi_liq(c,l)+h2osoi_ice(c,l))) / & - (h2osoi_liq(c,j)+h2osoi_ice(c,j)+h2osoi_liq(c,l)+h2osoi_ice(c,l)) - - call Combo (dz(c,j), h2osoi_liq(c,j), h2osoi_ice(c,j), & - t_soisno(c,j), dz(c,l), h2osoi_liq(c,l), h2osoi_ice(c,l), t_soisno(c,l) ) - - ! Now shift all elements above this down one. - if (j-1 > snl(c)+1) then - - do k = j-1, snl(c)+2, -1 - t_soisno(c,k) = t_soisno(c,k-1) - h2osoi_ice(c,k) = h2osoi_ice(c,k-1) - h2osoi_liq(c,k) = h2osoi_liq(c,k-1) - - mss_bcphi(c,k) = mss_bcphi(c,k-1) - mss_bcpho(c,k) = mss_bcpho(c,k-1) - mss_ocphi(c,k) = mss_ocphi(c,k-1) - mss_ocpho(c,k) = mss_ocpho(c,k-1) - mss_dst1(c,k) = mss_dst1(c,k-1) - mss_dst2(c,k) = mss_dst2(c,k-1) - mss_dst3(c,k) = mss_dst3(c,k-1) - mss_dst4(c,k) = mss_dst4(c,k-1) - snw_rds(c,k) = snw_rds(c,k-1) - - dz(c,k) = dz(c,k-1) - end do - end if - - ! Decrease the number of snow layers - snl(c) = snl(c) + 1 - if (snl(c) >= -1) EXIT - - else - - ! The layer thickness is greater than the prescribed minimum value - mssi(c) = mssi(c) + 1 - - end if - end do - - end if - - end do - - ! Reset the node depth and the depth of layer interface - - do j = 0, -nlevsno+1, -1 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c) + 1) then - z(c,j) = zi(c,j) - 0.5_r8*dz(c,j) - zi(c,j-1) = zi(c,j) - dz(c,j) - end if - end do - end do - - end associate - end subroutine CombineSnowLayers - - !----------------------------------------------------------------------- - subroutine DivideSnowLayers(bounds, num_snowc, filter_snowc, & - aerosol_inst, temperature_inst, waterstate_inst, is_lake) - ! - ! !DESCRIPTION: - ! Subdivides snow layers if they exceed their prescribed maximum thickness. - ! - ! !USES: - use clm_varcon, only : tfrz - use LakeCon , only : lsadz - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_snowc ! number of column snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - type(aerosol_type) , intent(inout) :: aerosol_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - logical , intent(in) :: is_lake !TODO - this should be examined and removed in the future - ! - ! !LOCAL VARIABLES: - integer :: j, c, fc, k ! indices - real(r8) :: drr ! thickness of the combined [m] - integer :: msno ! number of snow layer 1 (top) to msno (bottom) - real(r8) :: dzsno(bounds%begc:bounds%endc,nlevsno) ! Snow layer thickness [m] - real(r8) :: swice(bounds%begc:bounds%endc,nlevsno) ! Partial volume of ice [m3/m3] - real(r8) :: swliq(bounds%begc:bounds%endc,nlevsno) ! Partial volume of liquid water [m3/m3] - real(r8) :: tsno(bounds%begc:bounds%endc ,nlevsno) ! Nodel temperature [K] - real(r8) :: zwice ! temporary - real(r8) :: zwliq ! temporary - real(r8) :: propor ! temporary - real(r8) :: dtdz ! temporary - ! temporary variables mimicking the structure of other layer division variables - real(r8) :: mbc_phi(bounds%begc:bounds%endc,nlevsno) ! mass of BC in each snow layer - real(r8) :: zmbc_phi ! temporary - real(r8) :: mbc_pho(bounds%begc:bounds%endc,nlevsno) ! mass of BC in each snow layer - real(r8) :: zmbc_pho ! temporary - real(r8) :: moc_phi(bounds%begc:bounds%endc,nlevsno) ! mass of OC in each snow layer - real(r8) :: zmoc_phi ! temporary - real(r8) :: moc_pho(bounds%begc:bounds%endc,nlevsno) ! mass of OC in each snow layer - real(r8) :: zmoc_pho ! temporary - real(r8) :: mdst1(bounds%begc:bounds%endc,nlevsno) ! mass of dust 1 in each snow layer - real(r8) :: zmdst1 ! temporary - real(r8) :: mdst2(bounds%begc:bounds%endc,nlevsno) ! mass of dust 2 in each snow layer - real(r8) :: zmdst2 ! temporary - real(r8) :: mdst3(bounds%begc:bounds%endc,nlevsno) ! mass of dust 3 in each snow layer - real(r8) :: zmdst3 ! temporary - real(r8) :: mdst4(bounds%begc:bounds%endc,nlevsno) ! mass of dust 4 in each snow layer - real(r8) :: zmdst4 ! temporary - real(r8) :: rds(bounds%begc:bounds%endc,nlevsno) - ! Variables for consistency check - real(r8) :: dztot(bounds%begc:bounds%endc) - real(r8) :: snwicetot(bounds%begc:bounds%endc) - real(r8) :: snwliqtot(bounds%begc:bounds%endc) - real(r8) :: offset ! temporary - !----------------------------------------------------------------------- - - associate( & - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Output: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snw_rds => waterstate_inst%snw_rds_col , & ! Output: [real(r8) (:,:) ] effective snow grain radius (col,lyr) [microns, m^-6] - - mss_bcphi => aerosol_inst%mss_bcphi_col , & ! Output: [real(r8) (:,:) ] hydrophilic BC mass in snow (col,lyr) [kg] - mss_bcpho => aerosol_inst%mss_bcpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic BC mass in snow (col,lyr) [kg] - mss_ocphi => aerosol_inst%mss_ocphi_col , & ! Output: [real(r8) (:,:) ] hydrophilic OC mass in snow (col,lyr) [kg] - mss_ocpho => aerosol_inst%mss_ocpho_col , & ! Output: [real(r8) (:,:) ] hydrophobic OC mass in snow (col,lyr) [kg] - mss_dst1 => aerosol_inst%mss_dst1_col , & ! Output: [real(r8) (:,:) ] dust species 1 mass in snow (col,lyr) [kg] - mss_dst2 => aerosol_inst%mss_dst2_col , & ! Output: [real(r8) (:,:) ] dust species 2 mass in snow (col,lyr) [kg] - mss_dst3 => aerosol_inst%mss_dst3_col , & ! Output: [real(r8) (:,:) ] dust species 3 mass in snow (col,lyr) [kg] - mss_dst4 => aerosol_inst%mss_dst4_col , & ! Output: [real(r8) (:,:) ] dust species 4 mass in snow (col,lyr) [kg] - - snl => col%snl , & ! Output: [integer (:) ] number of snow layers - dz => col%dz , & ! Output: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Output: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z & ! Output: [real(r8) (:,:) ] layer thickness (m) - ) - - if ( is_lake ) then - ! Initialize for consistency check - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - - if (j == -nlevsno+1) then - dztot(c) = 0._r8 - snwicetot(c) = 0._r8 - snwliqtot(c) = 0._r8 - end if - - if (j >= snl(c)+1) then - dztot(c) = dztot(c) + dz(c,j) - snwicetot(c) = snwicetot(c) + h2osoi_ice(c,j) - snwliqtot(c) = snwliqtot(c) + h2osoi_liq(c,j) - end if - end do - end do - end if - - ! Begin calculation - note that the following column loops are only invoked - ! for snow-covered columns - - do j = 1,nlevsno - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j <= abs(snl(c))) then - if (is_lake) then - dzsno(c,j) = dz(c,j+snl(c)) - else - dzsno(c,j) = frac_sno(c)*dz(c,j+snl(c)) - end if - swice(c,j) = h2osoi_ice(c,j+snl(c)) - swliq(c,j) = h2osoi_liq(c,j+snl(c)) - tsno(c,j) = t_soisno(c,j+snl(c)) - - mbc_phi(c,j) = mss_bcphi(c,j+snl(c)) - mbc_pho(c,j) = mss_bcpho(c,j+snl(c)) - moc_phi(c,j) = mss_ocphi(c,j+snl(c)) - moc_pho(c,j) = mss_ocpho(c,j+snl(c)) - mdst1(c,j) = mss_dst1(c,j+snl(c)) - mdst2(c,j) = mss_dst2(c,j+snl(c)) - mdst3(c,j) = mss_dst3(c,j+snl(c)) - mdst4(c,j) = mss_dst4(c,j+snl(c)) - rds(c,j) = snw_rds(c,j+snl(c)) - end if - end do - end do - - loop_snowcolumns: do fc = 1, num_snowc - c = filter_snowc(fc) - - msno = abs(snl(c)) - - ! Now traverse layers from top to bottom in a dynamic way, as the total - ! number of layers (msno) may increase during the loop. - ! Impose k < nlevsno; the special case 'k == nlevsno' is not relevant, - ! as it is neither allowed to subdivide nor does it have layers below. - k = 1 - loop_layers: do while( k <= msno .and. k < nlevsno ) - - ! Current layer is bottom layer - if (k == msno) then - - if (is_lake) then - offset = 2._r8 * lsadz - else - offset = 0._r8 - end if - - if (dzsno(c,k) > dzmax_l(k) + offset) then - ! Subdivide layer into two layers with equal thickness, water - ! content, ice content and temperature - msno = msno + 1 - dzsno(c,k) = dzsno(c,k) / 2.0_r8 - dzsno(c,k+1) = dzsno(c,k) - swice(c,k) = swice(c,k) / 2.0_r8 - swice(c,k+1) = swice(c,k) - swliq(c,k) = swliq(c,k) / 2.0_r8 - swliq(c,k+1) = swliq(c,k) - - if (k == 1) then - ! special case - tsno(c,k+1) = tsno(c,k) - else - ! use temperature gradient - dtdz = (tsno(c,k-1) - tsno(c,k))/((dzsno(c,k-1)+2*dzsno(c,k))/2.0_r8) - tsno(c,k+1) = tsno(c,k) - dtdz*dzsno(c,k)/2.0_r8 - if (tsno(c,k+1) >= tfrz) then - tsno(c,k+1) = tsno(c,k) - else - tsno(c,k) = tsno(c,k) + dtdz*dzsno(c,k)/2.0_r8 - endif - end if - - mbc_phi(c,k) = mbc_phi(c,k) / 2.0_r8 - mbc_phi(c,k+1) = mbc_phi(c,k) - mbc_pho(c,k) = mbc_pho(c,k) / 2.0_r8 - mbc_pho(c,k+1) = mbc_pho(c,k) - moc_phi(c,k) = moc_phi(c,k) / 2.0_r8 - moc_phi(c,k+1) = moc_phi(c,k) - moc_pho(c,k) = moc_pho(c,k) / 2.0_r8 - moc_pho(c,k+1) = moc_pho(c,k) - mdst1(c,k) = mdst1(c,k) / 2.0_r8 - mdst1(c,k+1) = mdst1(c,k) - mdst2(c,k) = mdst2(c,k) / 2.0_r8 - mdst2(c,k+1) = mdst2(c,k) - mdst3(c,k) = mdst3(c,k) / 2.0_r8 - mdst3(c,k+1) = mdst3(c,k) - mdst4(c,k) = mdst4(c,k) / 2.0_r8 - mdst4(c,k+1) = mdst4(c,k) - - rds(c,k+1) = rds(c,k) - end if - end if - - ! There are layers below (note this is not exclusive with previous - ! if-statement, since msno may have increased in the previous if-statement) - if (k < msno) then - - if (is_lake) then - offset = lsadz - else - offset = 0._r8 - end if - - if (dzsno(c,k) > dzmax_u(k) + offset ) then - ! Only dump excess snow to underlying layer in a conservative fashion. - ! Other quantities will depend on the height of the excess snow: a ratio is used for this. - drr = dzsno(c,k) - dzmax_u(k) - offset - - propor = drr/dzsno(c,k) - zwice = propor*swice(c,k) - zwliq = propor*swliq(c,k) - zmbc_phi = propor*mbc_phi(c,k) - zmbc_pho = propor*mbc_pho(c,k) - zmoc_phi = propor*moc_phi(c,k) - zmoc_pho = propor*moc_pho(c,k) - zmdst1 = propor*mdst1(c,k) - zmdst2 = propor*mdst2(c,k) - zmdst3 = propor*mdst3(c,k) - zmdst4 = propor*mdst4(c,k) - - propor = (dzmax_u(k)+offset)/dzsno(c,k) - swice(c,k) = propor*swice(c,k) - swliq(c,k) = propor*swliq(c,k) - mbc_phi(c,k) = propor*mbc_phi(c,k) - mbc_pho(c,k) = propor*mbc_pho(c,k) - moc_phi(c,k) = propor*moc_phi(c,k) - moc_pho(c,k) = propor*moc_pho(c,k) - mdst1(c,k) = propor*mdst1(c,k) - mdst2(c,k) = propor*mdst2(c,k) - mdst3(c,k) = propor*mdst3(c,k) - mdst4(c,k) = propor*mdst4(c,k) - - ! Set depth layer k to maximum allowed value - dzsno(c,k) = dzmax_u(k) + offset - - mbc_phi(c,k+1) = mbc_phi(c,k+1)+zmbc_phi ! (combo) - mbc_pho(c,k+1) = mbc_pho(c,k+1)+zmbc_pho ! (combo) - moc_phi(c,k+1) = moc_phi(c,k+1)+zmoc_phi ! (combo) - moc_pho(c,k+1) = moc_pho(c,k+1)+zmoc_pho ! (combo) - mdst1(c,k+1) = mdst1(c,k+1)+zmdst1 ! (combo) - mdst2(c,k+1) = mdst2(c,k+1)+zmdst2 ! (combo) - mdst3(c,k+1) = mdst3(c,k+1)+zmdst3 ! (combo) - mdst4(c,k+1) = mdst4(c,k+1)+zmdst4 ! (combo) - - ! Mass-weighted combination of radius - rds(c,k+1) = MassWeightedSnowRadius( rds(c,k), rds(c,k+1), & - (swliq(c,k+1)+swice(c,k+1)), (zwliq+zwice) ) - - call Combo (dzsno(c,k+1), swliq(c,k+1), swice(c,k+1), tsno(c,k+1), drr, & - zwliq, zwice, tsno(c,k)) - end if - end if - k = k+1 - end do loop_layers - - snl(c) = -msno - - end do loop_snowcolumns - - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - if (is_lake) then - dz(c,j) = dzsno(c,j-snl(c)) - else - dz(c,j) = dzsno(c,j-snl(c))/frac_sno(c) - end if - h2osoi_ice(c,j) = swice(c,j-snl(c)) - h2osoi_liq(c,j) = swliq(c,j-snl(c)) - t_soisno(c,j) = tsno(c,j-snl(c)) - mss_bcphi(c,j) = mbc_phi(c,j-snl(c)) - mss_bcpho(c,j) = mbc_pho(c,j-snl(c)) - mss_ocphi(c,j) = moc_phi(c,j-snl(c)) - mss_ocpho(c,j) = moc_pho(c,j-snl(c)) - mss_dst1(c,j) = mdst1(c,j-snl(c)) - mss_dst2(c,j) = mdst2(c,j-snl(c)) - mss_dst3(c,j) = mdst3(c,j-snl(c)) - mss_dst4(c,j) = mdst4(c,j-snl(c)) - snw_rds(c,j) = rds(c,j-snl(c)) - - end if - end do - end do - - ! Consistency check - if (is_lake) then - do j = -nlevsno + 1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - - if (j >= snl(c)+1) then - dztot(c) = dztot(c) - dz(c,j) - snwicetot(c) = snwicetot(c) - h2osoi_ice(c,j) - snwliqtot(c) = snwliqtot(c) - h2osoi_liq(c,j) - end if - - if (j == 0) then - if ( abs(dztot(c)) > 1.e-10_r8 .or. abs(snwicetot(c)) > 1.e-7_r8 .or. & - abs(snwliqtot(c)) > 1.e-7_r8 ) then - write(iulog,*)'Inconsistency in SnowDivision_Lake! c, remainders', & - 'dztot, snwicetot, snwliqtot = ',c,dztot(c),snwicetot(c),snwliqtot(c) - call endrun(decomp_index=c, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if - end if - end do - end do - end if - - ! Reset the node depth and the depth of layer interface - - do j = 0, -nlevsno+1, -1 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - z(c,j) = zi(c,j) - 0.5_r8*dz(c,j) - zi(c,j-1) = zi(c,j) - dz(c,j) - end if - end do - end do - - end associate - end subroutine DivideSnowLayers - - !----------------------------------------------------------------------- - subroutine InitSnowLayers (bounds, snow_depth) - ! - ! !DESCRIPTION: - ! Initialize snow layer depth from specified total depth. - ! - ! !USES: - use clm_varcon , only : spval - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: snow_depth(bounds%begc:) - ! - ! - ! LOCAL VARAIBLES: - integer :: c,l,j ! indices - real(r8) :: minbound, maxbound ! helper variables - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(snow_depth) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl, & ! Output: [integer (:) ] number of snow layers - dz => col%dz, & ! Output: [real(r8) (:,:) ] layer thickness (m) (-nlevsno+1:nlevgrnd) - z => col%z, & ! Output: [real(r8) (:,:) ] layer depth (m) (-nlevsno+1:nlevgrnd) - zi => col%zi & ! Output: [real(r8) (:,:) ] interface level below a "z" level (m) (-nlevsno+0:nlevgrnd) - ) - - loop_columns: do c = bounds%begc,bounds%endc - l = col%landunit(c) - - dz(c,-nlevsno+1: 0) = spval - z (c,-nlevsno+1: 0) = spval - zi(c,-nlevsno :-1) = spval - - ! Special case: lake - if (lun%lakpoi(l)) then - snl(c) = 0 - dz(c,-nlevsno+1:0) = 0._r8 - z(c,-nlevsno+1:0) = 0._r8 - zi(c,-nlevsno+0:0) = 0._r8 - cycle - end if - - ! LvK 9-JUN-2015: in CanopyHydrologyMod , snow_depth is scaled with frac_sno - ! Here we do not apply scaling to snow_depth, so inconsistent? TODO - - ! Special case: too little snow for snowpack existence - if (snow_depth(c) < dzmin(1)) then - snl(c) = 0 - dz(c,-nlevsno+1:0) = 0._r8 - z(c,-nlevsno+1:0) = 0._r8 - zi(c,-nlevsno+0:0) = 0._r8 - cycle - end if - - ! There has to be at least one snow layer - snl(c) = -1 - minbound = dzmin(1) - maxbound = dzmax_l(1) - - if (snow_depth(c) >= minbound .and. snow_depth(c) <= maxbound) then - ! Special case: single layer - dz(c,0) = snow_depth(c) - - else - ! Search for appropriate number of layers (snl) by increasing the number - ! the number of layers and check for matching bounds. - snl(c) = snl(c) - 1 - minbound = maxbound - maxbound = sum(dzmax_u(1:-snl(c))) - - do while(snow_depth(c) > maxbound .and. -snl(c) < nlevsno ) - snl(c) = snl(c) - 1 - minbound = maxbound - maxbound = sum(dzmax_u(1:-snl(c))) - end do - - ! Set thickness of all layers except bottom two - do j = 1, -snl(c)-2 - dz(c,j+snl(c)) = dzmax_u(j) - enddo - - ! Determine whether the two bottom layers should be equal in size, - ! or not. The rule here is: always create equal size when possible. - if (snow_depth(c) <= sum(dzmax_u(1:-snl(c)-2)) + 2 * dzmax_u(-snl(c)-1)) then - dz(c,-1) = (snow_depth(c) - sum(dzmax_u(1:-snl(c)-2))) / 2._r8 - dz(c,0) = dz(c,-1) - else - dz(c,-1) = dzmax_u(-snl(c)-1) - dz(c,0) = snow_depth(c) - sum(dzmax_u(1:-snl(c)-1)) - endif - endif - - ! Initialize the node depth and the depth of layer interface - do j = 0, snl(c)+1, -1 - z(c,j) = zi(c,j) - 0.5_r8*dz(c,j) - zi(c,j-1) = zi(c,j) - dz(c,j) - end do - - end do loop_columns - - end associate - end subroutine InitSnowLayers - - !----------------------------------------------------------------------- - subroutine SnowCapping(bounds, num_initc, filter_initc, num_snowc, filter_snowc, & - aerosol_inst, waterflux_inst, waterstate_inst, topo_inst ) - ! - ! !DESCRIPTION: - ! Removes mass from bottom snow layer for columns that exceed the maximum snow depth. - ! This routine is called twice: once for non-lake columns and once for lake columns. - ! The initialization of the snow capping fluxes should only be done ONCE for each group, - ! therefore they are a passed as an extra argument (filter_initc). - ! Density and temperature of the layer are conserved (density needs some work, temperature is a state - ! variable) - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_initc ! number of column points that need to be initialized - integer , intent(in) :: filter_initc(:) ! column filter for points that need to be initialized - integer , intent(in) :: num_snowc ! number of column snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - type(aerosol_type) , intent(inout) :: aerosol_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - class(topo_type) , intent(in) :: topo_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime ! land model time step (sec) - real(r8) :: mss_snwcp_tot ! total snow capping mass [kg/m2] - real(r8) :: mss_snow_bottom_lyr ! total snow mass (ice+liquid) in bottom layer [kg/m2] - real(r8) :: snwcp_flux_ice ! snow capping flux (ice) [kg/m2] - real(r8) :: snwcp_flux_liq ! snow capping flux (liquid) [kg/m2] - real(r8) :: icefrac ! fraction of ice mass w.r.t. total mass [unitless] - real(r8) :: frac_adjust ! fraction of mass remaining after capping - real(r8) :: rho ! partial density of ice (not scaled with frac_sno) [kg/m3] - integer :: fc, c ! counters - real(r8) :: h2osno_excess(bounds%begc:bounds%endc) ! excess snow that needs to be capped [mm H2O] - logical :: apply_runoff(bounds%begc:bounds%endc) ! for columns with capping, whether the capping flux should be sent to runoff - ! Always keep at least this fraction of the bottom snow layer when doing snow capping - ! This needs to be slightly greater than 0 to avoid roundoff problems - real(r8), parameter :: min_snow_to_keep = 1.e-9 ! fraction of bottom snow layer to keep with capping - - !----------------------------------------------------------------------- - associate( & - qflx_snwcp_ice => waterflux_inst%qflx_snwcp_ice_col , & ! Output: [real(r8) (:) ] excess solid h2o due to snow capping (outgoing) (mm H2O /s) [+] - qflx_snwcp_liq => waterflux_inst%qflx_snwcp_liq_col , & ! Output: [real(r8) (:) ] excess liquid h2o due to snow capping (outgoing) (mm H2O /s) [+] - qflx_snwcp_discarded_ice => waterflux_inst%qflx_snwcp_discarded_ice_col, & ! Output: [real(r8) (:) ] excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] - qflx_snwcp_discarded_liq => waterflux_inst%qflx_snwcp_discarded_liq_col, & ! Output: [real(r8) (:) ] excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) [+] - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! In/Out: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! In/Out: [real(r8) (:,:) ] liquid water (kg/m2) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - mss_bcphi => aerosol_inst%mss_bcphi_col , & ! In/Out: [real(r8) (:,:) ] hydrophilic BC mass in snow (col,lyr) [kg] - mss_bcpho => aerosol_inst%mss_bcpho_col , & ! In/Out: [real(r8) (:,:) ] hydrophobic BC mass in snow (col,lyr) [kg] - mss_ocphi => aerosol_inst%mss_ocphi_col , & ! In/Out: [real(r8) (:,:) ] hydrophilic OC mass in snow (col,lyr) [kg] - mss_ocpho => aerosol_inst%mss_ocpho_col , & ! In/Out: [real(r8) (:,:) ] hydrophobic OC mass in snow (col,lyr) [kg] - mss_dst1 => aerosol_inst%mss_dst1_col , & ! In/Out: [real(r8) (:,:) ] dust species 1 mass in snow (col,lyr) [kg] - mss_dst2 => aerosol_inst%mss_dst2_col , & ! In/Out: [real(r8) (:,:) ] dust species 2 mass in snow (col,lyr) [kg] - mss_dst3 => aerosol_inst%mss_dst3_col , & ! In/Out: [real(r8) (:,:) ] dust species 3 mass in snow (col,lyr) [kg] - mss_dst4 => aerosol_inst%mss_dst4_col , & ! In/Out: [real(r8) (:,:) ] dust species 4 mass in snow (col,lyr) [kg] - topo => topo_inst%topo_col , & ! Input : [real(r8) (:) ] column surface height (m) - dz => col%dz & ! In/Out: [real(r8) (:,:) ] layer depth (m) - ) - - ! Determine model time step - dtime = get_step_size() - - ! Initialize capping fluxes for all columns in domain (lake or non-lake) - do fc = 1, num_initc - c = filter_initc(fc) - qflx_snwcp_ice(c) = 0.0_r8 - qflx_snwcp_liq(c) = 0.0_r8 - qflx_snwcp_discarded_ice(c) = 0.0_r8 - qflx_snwcp_discarded_liq(c) = 0.0_r8 - end do - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno = h2osno(bounds%begc:bounds%endc), & - topo = topo(bounds%begc:bounds%endc), & - h2osno_excess = h2osno_excess(bounds%begc:bounds%endc), & - apply_runoff = apply_runoff(bounds%begc:bounds%endc)) - - loop_columns: do fc = 1, num_snowc - c = filter_snowc(fc) - - if (h2osno_excess(c) > 0._r8) then - mss_snow_bottom_lyr = h2osoi_ice(c,0) + h2osoi_liq(c,0) - mss_snwcp_tot = min(h2osno_excess(c), mss_snow_bottom_lyr * (1._r8 - min_snow_to_keep)) ! Can't remove more mass than available - - ! Ratio of snow/liquid in bottom layer determines partitioning of runoff fluxes - icefrac = h2osoi_ice(c,0) / mss_snow_bottom_lyr - snwcp_flux_ice = mss_snwcp_tot/dtime * icefrac - snwcp_flux_liq = mss_snwcp_tot/dtime * (1._r8 - icefrac) - if (apply_runoff(c)) then - qflx_snwcp_ice(c) = snwcp_flux_ice - qflx_snwcp_liq(c) = snwcp_flux_liq - else - qflx_snwcp_discarded_ice(c) = snwcp_flux_ice - qflx_snwcp_discarded_liq(c) = snwcp_flux_liq - end if - - rho = h2osoi_ice(c,0) / dz(c,0) ! ice only - - ! Adjust water content - h2osoi_ice(c,0) = h2osoi_ice(c,0) - snwcp_flux_ice*dtime - h2osoi_liq(c,0) = h2osoi_liq(c,0) - snwcp_flux_liq*dtime - - ! Scale dz such that ice density (or: pore space) is conserved - ! - ! Avoid scaling dz for very low ice densities. This can occur, in principle, if - ! the layer is mostly liquid water. Furthermore, this check is critical in the - ! unlikely event that rho is 0, which can happen if the layer is entirely liquid - ! water. - if (rho > 1.0_r8) then - dz(c,0) = h2osoi_ice(c,0) / rho - end if - - ! Check that water capacity is still positive - if (h2osoi_ice(c,0) < 0._r8 .or. h2osoi_liq(c,0) < 0._r8 ) then - write(iulog,*)'ERROR: capping procedure failed (negative mass remaining) c = ',c - write(iulog,*)'h2osoi_ice = ', h2osoi_ice(c,0), ' h2osoi_liq = ', h2osoi_liq(c,0) - call endrun(decomp_index=c, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - end if - - ! Correct the top layer aerosol mass to account for snow capping. - ! This approach conserves the aerosol mass concentration but not aerosol mass. - frac_adjust = (mss_snow_bottom_lyr - mss_snwcp_tot) / mss_snow_bottom_lyr - mss_bcphi(c,0) = mss_bcphi(c,0) * frac_adjust - mss_bcpho(c,0) = mss_bcpho(c,0) * frac_adjust - mss_ocphi(c,0) = mss_ocphi(c,0) * frac_adjust - mss_ocpho(c,0) = mss_ocpho(c,0) * frac_adjust - mss_dst1(c,0) = mss_dst1(c,0) * frac_adjust - mss_dst2(c,0) = mss_dst2(c,0) * frac_adjust - mss_dst3(c,0) = mss_dst3(c,0) * frac_adjust - mss_dst4(c,0) = mss_dst4(c,0) * frac_adjust - end if - - end do loop_columns - - end associate - end subroutine SnowCapping - - !----------------------------------------------------------------------- - subroutine SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno, topo, h2osno_excess, apply_runoff) - ! - ! !DESCRIPTION: - ! Determine the amount of excess snow that needs to be capped - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num_snowc ! number of column snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - real(r8) , intent(in) :: h2osno( bounds%begc: ) ! snow water (mm H2O) - real(r8) , intent(in) :: topo( bounds%begc: ) ! column surface height (m) - real(r8) , intent(out) :: h2osno_excess( bounds%begc: ) ! excess snow that needs to be capped (mm H2O) - logical , intent(out) :: apply_runoff( bounds%begc: ) ! whether capped snow should be sent to runoff; only valid where h2osno_excess > 0 - ! - ! !LOCAL VARIABLES: - integer :: fc, c, l - integer :: reset_snow_timesteps - logical :: is_reset_snow_active ! whether snow resetting is active in this time step for at least some points - - character(len=*), parameter :: subname = 'SnowCappingExcess' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(h2osno) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(topo) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osno_excess) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(apply_runoff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do fc = 1, num_snowc - c = filter_snowc(fc) - h2osno_excess(c) = 0._r8 - if (h2osno(c) > h2osno_max) then - h2osno_excess(c) = h2osno(c) - h2osno_max - apply_runoff(c) = .true. - end if - end do - - ! Implement snow resetting (i.e., resetting points that have h2osno greater than some - ! value) by applying the snow capping scheme to a value that's smaller than - ! h2osno_max, but NOT sending the resulting capping flux to the coupler. It is easier - ! to implement the resetting this way than to try to manually reset the snow pack, - ! because there are so many snow pack variables that need to be kept consistent if - ! doing this resetting manually. Note that we need to continue to apply the resetting - ! for some number of time steps, because we can remove at most one snow layer per - ! time step. - - ! It is important that this snow resetting comes after the standard check (h2osno(c) > - ! h2osno_max), so that we override any standard capping. - is_reset_snow_active = .false. - if (reset_snow .or. reset_snow_glc) then - reset_snow_timesteps = reset_snow_timesteps_per_layer * nlevsno - if (get_nstep() <= reset_snow_timesteps) then - is_reset_snow_active = .true. - end if - end if - - if (is_reset_snow_active) then - do fc = 1, num_snowc - c = filter_snowc(fc) - l = col%landunit(c) - if ((lun%itype(l) /= istice_mec) .and. & - reset_snow .and. & - (h2osno(c) > reset_snow_h2osno)) then - h2osno_excess(c) = h2osno(c) - reset_snow_h2osno - apply_runoff(c) = .false. - else if ((lun%itype(l) == istice_mec) .and. & - reset_snow_glc .and. & - (h2osno(c) > reset_snow_h2osno) .and. & - (topo(c) <= reset_snow_glc_ela)) then - h2osno_excess(c) = h2osno(c) - reset_snow_h2osno - apply_runoff(c) = .false. - end if - end do - end if - - end subroutine SnowCappingExcess - - !----------------------------------------------------------------------- - subroutine NewSnowBulkDensity(bounds, num_c, filter_c, atm2lnd_inst, bifall) - ! - ! !DESCRIPTION: - ! Compute the bulk density of any newly-fallen snow. - ! - ! The return value is placed in bifall. Only columns within the given filter are set: - ! all other columns remain at their original values. - ! - ! !USES: - use clm_varcon, only : tfrz - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_c ! number of columns in filterc - integer , intent(in) :: filter_c(:) ! column-level filter to operate on - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - real(r8) , intent(inout) :: bifall(bounds%begc:) ! bulk density of newly fallen dry snow [kg/m3] - ! - ! !LOCAL VARIABLES: - integer :: fc, c, g - real(r8) :: t_for_bifall_degC ! temperature to use in bifall equation (deg C) - - character(len=*), parameter :: subname = 'NewSnowBulkDensity' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(bifall) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - forc_t => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - forc_wind => atm2lnd_inst%forc_wind_grc & ! Input: [real(r8) (:) ] atmospheric wind speed (m/s) - ) - - do fc = 1, num_c - c = filter_c(fc) - g = col%gridcell(c) - - if (forc_t(c) > tfrz + 2._r8) then - bifall(c) = 50._r8 + 1.7_r8*(17.0_r8)**1.5_r8 - else if (forc_t(c) > tfrz - 15._r8) then - bifall(c) = 50._r8 + 1.7_r8*(forc_t(c) - tfrz + 15._r8)**1.5_r8 - else if ( new_snow_density == LoTmpDnsTruncatedAnderson1976 ) then - bifall(c) = 50._r8 - else if (new_snow_density == LoTmpDnsSlater2017) then - ! Andrew Slater: A temp of about -15C gives the nicest - ! "blower" powder, but as you get colder the flake size decreases so - ! density goes up. e.g. the smaller snow crystals from the Arctic and Antarctic - ! winters - if (forc_t(c) > tfrz - 57.55_r8) then - t_for_bifall_degC = (forc_t(c)-tfrz) - else - ! Below -57.55 deg C, the following function starts to decrease with - ! decreasing temperatures. Limit the function to avoid this turning over. - t_for_bifall_degC = -57.55_r8 - end if - bifall(c) = -(50._r8/15._r8 + 0.0333_r8*15_r8)*t_for_bifall_degC - 0.0333_r8*t_for_bifall_degC**2 - end if - - if (wind_dependent_snow_density .and. forc_wind(g) > 0.1_r8 ) then - ! Density offset for wind-driven compaction, initial ideas based on Liston et. al (2007) J. Glaciology, - ! 53(181), 241-255. Modified for a continuous wind impact and slightly more sensitive - ! to wind - Andrew Slater, 2016 - bifall(c) = bifall(c) + (266.861_r8 * ((1._r8 + TANH(forc_wind(g)/5.0_r8))/2._r8)**8.8_r8) - end if - - end do - - end associate - - end subroutine NewSnowBulkDensity - - !----------------------------------------------------------------------- - pure function OverburdenCompactionAnderson1976(burden, wx, td, bi) & - result(compaction_rate) - ! - ! !DESCRIPTION: - ! Compute snow overburden compaction for a single column and level using the Anderson - ! 1976 formula - ! - ! From Anderson 1976: A point energy and mass balance model of a snow cover, NOAA - ! Technical Report NWS 19 - ! - ! !ARGUMENTS: - real(r8) :: compaction_rate ! function result - real(r8) , intent(in) :: burden ! pressure of overlying snow in this column [kg/m2] - real(r8) , intent(in) :: wx ! water mass (ice+liquid) [kg/m2] - real(r8) , intent(in) :: td ! t_soisno - tfrz [K] - real(r8) , intent(in) :: bi ! partial density of ice [kg/m3] - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: c2 = 23.e-3_r8 ! [m3/kg] - real(r8), parameter :: eta0 = 9.e+5_r8 ! The Viscosity Coefficient Eta0 [kg-s/m2] - - character(len=*), parameter :: subname = 'OverburdenCompactionAnderson1976' - !----------------------------------------------------------------------- - - compaction_rate = -(burden+wx/2._r8)*exp(-overburden_compress_Tfactor*td - c2*bi)/eta0 - - end function OverburdenCompactionAnderson1976 - - !----------------------------------------------------------------------- - function OverburdenCompactionVionnet2012(h2osoi_liq, dz, burden, wx, td, bi) & - result(compaction_rate) - ! - ! !DESCRIPTION: - ! Compute snow overburden compaction for a single column and level using the Vionnet - ! et al. 2012 formula - ! - ! From Vionnet V et al. 2012, "The detailed snowpack scheme Crocus and its - ! implementation in SURFEX v7.2", Geosci. Model Dev. 5, 773–791. - ! - ! Preconditions (required to avoid divide by 0): - ! - dz > 0 - ! - bi > 0 - ! - ! !USES: - use clm_varcon, only : denh2o - ! - ! !ARGUMENTS: - real(r8) :: compaction_rate ! function result - real(r8) , intent(in) :: h2osoi_liq ! liquid water in this column and level [kg/m2] - real(r8) , intent(in) :: dz ! layer depth for this column and level [m] - real(r8) , intent(in) :: burden ! pressure of overlying snow in this column [kg/m2] - real(r8) , intent(in) :: wx ! water mass (ice+liquid) [kg/m2] - real(r8) , intent(in) :: td ! t_soisno - tfrz [K] - real(r8) , intent(in) :: bi ! partial density of ice [kg/m3] - ! - ! !LOCAL VARIABLES: - real(r8) :: f1, f2 ! overburden compaction modifiers to viscosity - real(r8) :: eta ! Viscosity - - real(r8), parameter :: ceta = 450._r8 ! overburden compaction constant [kg/m3] - real(r8), parameter :: aeta = 0.1_r8 ! overburden compaction constant [1/K] - real(r8), parameter :: beta = 0.023_r8 ! overburden compaction constant [m3/kg] - real(r8), parameter :: eta0 = 7.62237e6_r8 ! The Viscosity Coefficient Eta0 [kg-s/m2] - - character(len=*), parameter :: subname = 'OverburdenCompactionVionnet2012' - !----------------------------------------------------------------------- - - f1 = 1._r8 / (1._r8 + 60._r8 * h2osoi_liq / (denh2o * dz)) - f2 = 4.0_r8 ! currently fixed to maximum value, holds in absence of angular grains - eta = f1*f2*(bi/ceta)*exp(aeta*td + beta*bi)*eta0 - compaction_rate = -(burden+wx/2._r8) / eta - - end function OverburdenCompactionVionnet2012 - - !----------------------------------------------------------------------- - subroutine WindDriftCompaction(bi, forc_wind, dz, & - zpseudo, mobile, compaction_rate) - ! - ! !DESCRIPTION: - ! - ! Compute wind drift compaction for a single column and level. - ! - ! Also updates zpseudo and mobile for this column. However, zpseudo remains unchanged - ! if mobile is already false or becomes false within this subroutine. - ! - ! The structure of the updates done here for zpseudo and mobile requires that this - ! subroutine be called first for the top layer of snow, then for the 2nd layer down, - ! etc. - and finally for the bottom layer. Before beginning the loops over layers, - ! mobile should be initialized to .true. and zpseudo should be initialized to 0. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) , intent(in) :: bi ! partial density of ice [kg/m3] - real(r8) , intent(in) :: forc_wind ! atmospheric wind speed [m/s] - real(r8) , intent(in) :: dz ! layer depth for this column and level [m] - real(r8) , intent(inout) :: zpseudo ! wind drift compaction / pseudo depth for this column at this layer - logical , intent(inout) :: mobile ! whether this snow column is still mobile at this layer (i.e., susceptible to wind drift) - real(r8) , intent(out) :: compaction_rate ! rate of compaction of snowpack due to wind drift, for the current column and layer - ! - ! !LOCAL VARIABLES: - real(r8) :: Frho ! Mobility density factor [-] - real(r8) :: MO ! Mobility index [-] - real(r8) :: SI ! Driftability index [-] - real(r8) :: gamma_drift ! Scaling factor for wind drift time scale [-] - real(r8) :: tau_inverse ! Inverse of the effective time scale [1/s] - - real(r8), parameter :: rho_min = 50._r8 ! wind drift compaction / minimum density [kg/m3] - real(r8), parameter :: rho_max = 350._r8 ! wind drift compaction / maximum density [kg/m3] - real(r8), parameter :: drift_gs = 0.35e-3_r8 ! wind drift compaction / grain size (fixed value for now) - real(r8), parameter :: drift_sph = 1.0_r8 ! wind drift compaction / sphericity - real(r8), parameter :: tau_ref = 48._r8 * 3600._r8 ! wind drift compaction / reference time [s] - - character(len=*), parameter :: subname = 'WindDriftCompaction' - !----------------------------------------------------------------------- - - if (mobile) then - Frho = 1.25_r8 - 0.0042_r8*(max(rho_min, bi)-rho_min) - ! assuming dendricity = 0, sphericity = 1, grain size = 0.35 mm Non-dendritic snow - MO = 0.34_r8 * (-0.583_r8*drift_gs - 0.833_r8*drift_sph + 0.833_r8) + 0.66_r8*Frho - SI = -2.868_r8 * exp(-0.085_r8*forc_wind) + 1._r8 + MO - - if (SI > 0.0_r8) then - SI = min(SI, 3.25_r8) - ! Increase zpseudo (wind drift / pseudo depth) to the middle of - ! the pseudo-node for the sake of the following calculation - zpseudo = zpseudo + 0.5_r8 * dz * (3.25_r8 - SI) - gamma_drift = SI*exp(-zpseudo/0.1_r8) - tau_inverse = gamma_drift / tau_ref - compaction_rate = -max(0.0_r8, rho_max-bi) * tau_inverse - ! Further increase zpseudo to the bottom of the pseudo-node for - ! the sake of calculations done on the underlying layer (i.e., - ! the next time through the j loop). - zpseudo = zpseudo + 0.5_r8 * dz * (3.25_r8 - SI) - else ! SI <= 0 - mobile = .false. - compaction_rate = 0._r8 - end if - else ! .not. mobile - compaction_rate = 0._r8 - end if - - end subroutine WindDriftCompaction - - - !----------------------------------------------------------------------- - subroutine Combo(dz, wliq, wice, t, dz2, wliq2, wice2, t2) - ! - ! !DESCRIPTION: - ! Combines two elements and returns the following combined - ! variables: dz, t, wliq, wice. - ! The combined temperature is based on the equation: - ! the sum of the enthalpies of the two elements = - ! that of the combined element. - ! - ! !USES: - use clm_varcon, only : cpice, cpliq, tfrz, hfus - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: dz2 ! nodal thickness of 2 elements being combined [m] - real(r8), intent(in) :: wliq2 ! liquid water of element 2 [kg/m2] - real(r8), intent(in) :: wice2 ! ice of element 2 [kg/m2] - real(r8), intent(in) :: t2 ! nodal temperature of element 2 [K] - real(r8), intent(inout) :: dz ! nodal thickness of 1 elements being combined [m] - real(r8), intent(inout) :: wliq ! liquid water of element 1 - real(r8), intent(inout) :: wice ! ice of element 1 [kg/m2] - real(r8), intent(inout) :: t ! nodel temperature of element 1 [K] - ! - ! !LOCAL VARIABLES: - real(r8) :: dzc ! Total thickness of nodes 1 and 2 (dzc=dz+dz2). - real(r8) :: wliqc ! Combined liquid water [kg/m2] - real(r8) :: wicec ! Combined ice [kg/m2] - real(r8) :: tc ! Combined node temperature [K] - real(r8) :: h ! enthalpy of element 1 [J/m2] - real(r8) :: h2 ! enthalpy of element 2 [J/m2] - real(r8) :: hc ! temporary - !----------------------------------------------------------------------- - - dzc = dz+dz2 - wicec = (wice+wice2) - wliqc = (wliq+wliq2) - h = (cpice*wice+cpliq*wliq) * (t-tfrz)+hfus*wliq - h2= (cpice*wice2+cpliq*wliq2) * (t2-tfrz)+hfus*wliq2 - - hc = h + h2 - tc = tfrz + (hc - hfus*wliqc) / (cpice*wicec + cpliq*wliqc) - - dz = dzc - wice = wicec - wliq = wliqc - t = tc - - end subroutine Combo - - !----------------------------------------------------------------------- - function MassWeightedSnowRadius( rds1, rds2, swtot, zwtot ) result(mass_weighted_snowradius) - ! - ! !DESCRIPTION: - ! Calculate the mass weighted snow radius when two layers are combined - ! - ! !USES: - use AerosolMod , only : snw_rds_min - use SnowSnicarMod, only : snw_rds_max - implicit none - ! !ARGUMENTS: - real(r8), intent(IN) :: rds1 ! Layer 1 radius - real(r8), intent(IN) :: rds2 ! Layer 2 radius - real(r8), intent(IN) :: swtot ! snow water total layer 2 - real(r8), intent(IN) :: zwtot ! snow water total layer 1 - real(r8) :: mass_weighted_snowradius ! resulting bounded mass weighted snow radius - - SHR_ASSERT( (swtot+zwtot > 0.0_r8), errMsg(sourcefile, __LINE__)) - mass_weighted_snowradius = (rds2*swtot + rds1*zwtot)/(swtot+zwtot) - - if ( mass_weighted_snowradius > snw_rds_max ) then - mass_weighted_snowradius = snw_rds_max - else if ( mass_weighted_snowradius < snw_rds_min ) then - mass_weighted_snowradius = snw_rds_min - end if - end function MassWeightedSnowRadius - - !----------------------------------------------------------------------- - subroutine BuildSnowFilter(bounds, num_nolakec, filter_nolakec, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - ! - ! !DESCRIPTION: - ! Constructs snow filter for use in vectorized loops for snow hydrology. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(out) :: num_snowc ! number of column snow points in column filter - integer , intent(out) :: filter_snowc(:) ! column filter for snow points - integer , intent(out) :: num_nosnowc ! number of column non-snow points in column filter - integer , intent(out) :: filter_nosnowc(:) ! column filter for non-snow points - ! - ! !LOCAL VARIABLES: - integer :: fc, c - !----------------------------------------------------------------------- - - ! Build snow/no-snow filters for other subroutines - - num_snowc = 0 - num_nosnowc = 0 - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if (col%snl(c) < 0) then - num_snowc = num_snowc + 1 - filter_snowc(num_snowc) = c - else - num_nosnowc = num_nosnowc + 1 - filter_nosnowc(num_nosnowc) = c - end if - end do - end subroutine BuildSnowFilter - - subroutine SnowHydrologySetControlForTesting( set_winddep_snowdensity, set_new_snow_density, & - set_reset_snow, set_reset_snow_glc, set_reset_snow_glc_ela) - ! - ! !DESCRIPTION: - ! Sets some of the control settings for SnowHydrologyMod - ! NOTE: THIS IS JUST HERE AS AN INTERFACE FOR UNIT TESTING. - ! - ! !USES: - ! - ! !ARGUMENTS: - logical, intent(in), optional :: set_winddep_snowdensity ! Set wind dependent snow density - integer, intent(in), optional :: set_new_snow_density ! snow density method - logical, intent(in), optional :: set_reset_snow ! whether to reset the snow pack, non-glc_mec points - logical, intent(in), optional :: set_reset_snow_glc ! whether to reset the snow pack, glc_mec points - real(r8), intent(in), optional :: set_reset_snow_glc_ela ! elevation below which to reset the snow pack if set_reset_snow_glc is true (m) - !----------------------------------------------------------------------- - if (present(set_winddep_snowdensity)) then - wind_dependent_snow_density = set_winddep_snowdensity - end if - if (present(set_new_snow_density)) then - new_snow_density = set_new_snow_density - end if - if (present(set_reset_snow)) then - reset_snow = set_reset_snow - end if - if (present(set_reset_snow_glc)) then - reset_snow_glc = set_reset_snow_glc - end if - if (present(set_reset_snow_glc_ela)) then - reset_snow_glc_ela = set_reset_snow_glc_ela - end if - - end subroutine SnowHydrologySetControlForTesting - -end module SnowHydrologyMod diff --git a/src/biogeophys/SnowSnicarMod.F90 b/src/biogeophys/SnowSnicarMod.F90 deleted file mode 100644 index d8a4ebdabb..0000000000 --- a/src/biogeophys/SnowSnicarMod.F90 +++ /dev/null @@ -1,1480 +0,0 @@ -module SnowSnicarMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate albedo of snow containing impurities - ! and the evolution of snow effective radius - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use clm_varcon , only : namec , tfrz - use shr_const_mod , only : SHR_CONST_RHOICE - use abortutils , only : endrun - use decompMod , only : bounds_type - use AerosolMod , only : snw_rds_min - use atm2lndType , only : atm2lnd_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use TemperatureType , only : temperature_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - ! - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SNICAR_RT ! Snow albedo and vertically-resolved solar absorption - public :: SnowAge_grain ! Snow effective grain size evolution - public :: SnowAge_init ! Initial read in of snow-aging file - public :: SnowOptics_init ! Initial read in of snow-optics file - ! - ! !PUBLIC DATA MEMBERS: - integer, public, parameter :: sno_nbr_aer = 8 ! number of aerosol species in snowpack - ! (indices described above) [nbr] - logical, public, parameter :: DO_SNO_OC = .false. ! parameter to include organic carbon (OC) - ! in snowpack radiative calculations - logical, public, parameter :: DO_SNO_AER = .true. ! parameter to include aerosols in snowpack radiative calculations - - ! !PRIVATE DATA MEMBERS: - integer, parameter :: numrad_snw = 5 ! number of spectral bands used in snow model [nbr] - integer, parameter :: nir_bnd_bgn = 2 ! first band index in near-IR spectrum [idx] - integer, parameter :: nir_bnd_end = 5 ! ending near-IR band index [idx] - - integer, parameter :: idx_Mie_snw_mx = 1471 ! number of effective radius indices used in Mie lookup table [idx] - integer, parameter :: idx_T_max = 11 ! maxiumum temperature index used in aging lookup table [idx] - integer, parameter :: idx_T_min = 1 ! minimum temperature index used in aging lookup table [idx] - integer, parameter :: idx_Tgrd_max = 31 ! maxiumum temperature gradient index used in aging lookup table [idx] - integer, parameter :: idx_Tgrd_min = 1 ! minimum temperature gradient index used in aging lookup table [idx] - integer, parameter :: idx_rhos_max = 8 ! maxiumum snow density index used in aging lookup table [idx] - integer, parameter :: idx_rhos_min = 1 ! minimum snow density index used in aging lookup table [idx] - - integer, parameter :: snw_rds_max_tbl = 1500 ! maximum effective radius defined in Mie lookup table [microns] - integer, parameter :: snw_rds_min_tbl = 30 ! minimium effective radius defined in Mie lookup table [microns] - integer, parameter :: snw_rds_min_int = nint(snw_rds_min) ! minimum allowed snow effective radius as integer [microns] - real(r8), parameter :: snw_rds_max = 1500._r8 ! maximum allowed snow effective radius [microns] - real(r8), parameter :: snw_rds_refrz = 1000._r8 ! effective radius of re-frozen snow [microns] - - real(r8), parameter :: min_snw = 1.0E-30_r8 ! minimum snow mass required for SNICAR RT calculation [kg m-2] - - !real(r8), parameter :: C1_liq_Brun89 = 1.28E-17_r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89 - real(r8), parameter :: C1_liq_Brun89 = 0._r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89: zeroed to accomodate dry snow aging - real(r8), parameter :: C2_liq_Brun89 = 4.22E-13_r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89: corrected for LWC in units of percent - - real(r8), parameter :: tim_cns_bc_rmv = 2.2E-8_r8 ! time constant for removal of BC in snow on sea-ice - ! [s-1] (50% mass removal/year) - real(r8), parameter :: tim_cns_oc_rmv = 2.2E-8_r8 ! time constant for removal of OC in snow on sea-ice - ! [s-1] (50% mass removal/year) - real(r8), parameter :: tim_cns_dst_rmv = 2.2E-8_r8 ! time constant for removal of dust in snow on sea-ice - ! [s-1] (50% mass removal/year) - - ! scaling of the snow aging rate (tuning option): - logical :: flg_snoage_scl = .false. ! flag for scaling the snow aging rate by some arbitrary factor - real(r8), parameter :: xdrdt = 1.0_r8 ! arbitrary factor applied to snow aging rate - - ! snow and aerosol Mie parameters: - ! (arrays declared here, but are set in iniTimeConst) - ! (idx_Mie_snw_mx is number of snow radii with defined parameters (i.e. from 30um to 1500um)) - - ! direct-beam weighted ice optical properties - real(r8) :: ss_alb_snw_drc(idx_Mie_snw_mx,numrad_snw) - real(r8) :: asm_prm_snw_drc(idx_Mie_snw_mx,numrad_snw) - real(r8) :: ext_cff_mss_snw_drc(idx_Mie_snw_mx,numrad_snw) - - ! diffuse radiation weighted ice optical properties - real(r8) :: ss_alb_snw_dfs(idx_Mie_snw_mx,numrad_snw) - real(r8) :: asm_prm_snw_dfs(idx_Mie_snw_mx,numrad_snw) - real(r8) :: ext_cff_mss_snw_dfs(idx_Mie_snw_mx,numrad_snw) - - ! hydrophiliic BC - real(r8) :: ss_alb_bc1(numrad_snw) - real(r8) :: asm_prm_bc1(numrad_snw) - real(r8) :: ext_cff_mss_bc1(numrad_snw) - - ! hydrophobic BC - real(r8) :: ss_alb_bc2(numrad_snw) - real(r8) :: asm_prm_bc2(numrad_snw) - real(r8) :: ext_cff_mss_bc2(numrad_snw) - - ! hydrophobic OC - real(r8) :: ss_alb_oc1(numrad_snw) - real(r8) :: asm_prm_oc1(numrad_snw) - real(r8) :: ext_cff_mss_oc1(numrad_snw) - - ! hydrophilic OC - real(r8) :: ss_alb_oc2(numrad_snw) - real(r8) :: asm_prm_oc2(numrad_snw) - real(r8) :: ext_cff_mss_oc2(numrad_snw) - - ! dust species 1: - real(r8) :: ss_alb_dst1(numrad_snw) - real(r8) :: asm_prm_dst1(numrad_snw) - real(r8) :: ext_cff_mss_dst1(numrad_snw) - - ! dust species 2: - real(r8) :: ss_alb_dst2(numrad_snw) - real(r8) :: asm_prm_dst2(numrad_snw) - real(r8) :: ext_cff_mss_dst2(numrad_snw) - - ! dust species 3: - real(r8) :: ss_alb_dst3(numrad_snw) - real(r8) :: asm_prm_dst3(numrad_snw) - real(r8) :: ext_cff_mss_dst3(numrad_snw) - - ! dust species 4: - real(r8) :: ss_alb_dst4(numrad_snw) - real(r8) :: asm_prm_dst4(numrad_snw) - real(r8) :: ext_cff_mss_dst4(numrad_snw) - - ! best-fit parameters for snow aging defined over: - ! 11 temperatures from 225 to 273 K - ! 31 temperature gradients from 0 to 300 K/m - ! 8 snow densities from 0 to 350 kg/m3 - ! (arrays declared here, but are set in iniTimeConst) - real(r8), pointer :: snowage_tau(:,:,:) ! (idx_rhos_max,idx_Tgrd_max,idx_T_max) - real(r8), pointer :: snowage_kappa(:,:,:) ! (idx_rhos_max,idx_Tgrd_max,idx_T_max) - real(r8), pointer :: snowage_drdt0(:,:,:) ! idx_rhos_max,idx_Tgrd_max,idx_T_max) - ! - ! !REVISION HISTORY: - ! Created by Mark Flanner - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SNICAR_RT (flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen, flg_slr_in, h2osno_liq, h2osno_ice, snw_rds, & - mss_cnc_aer_in, albsfc, albout, flx_abs, waterstate_inst) - ! - ! !DESCRIPTION: - ! Determine reflectance of, and vertically-resolved solar absorption in, - ! snow with impurities. - ! - ! Original references on physical models of snow reflectance include: - ! Wiscombe and Warren [1980] and Warren and Wiscombe [1980], - ! Journal of Atmospheric Sciences, 37, - ! - ! The multi-layer solution for multiple-scattering used here is from: - ! Toon et al. [1989], Rapid calculation of radiative heating rates - ! and photodissociation rates in inhomogeneous multiple scattering atmospheres, - ! J. Geophys. Res., 94, D13, 16287-16301 - ! - ! The implementation of the SNICAR model in CLM/CSIM is described in: - ! Flanner, M., C. Zender, J. Randerson, and P. Rasch [2007], - ! Present-day climate forcing and response from black carbon in snow, - ! J. Geophys. Res., 112, D11202, doi: 10.1029/2006JD008003 - ! - ! !USES: - use clm_varpar , only : nlevsno, numrad - use clm_time_manager , only : get_nstep - use shr_const_mod , only : SHR_CONST_PI - ! - ! !ARGUMENTS: - integer , intent(in) :: flg_snw_ice ! flag: =1 when called from CLM, =2 when called from CSIM - type (bounds_type), intent(in) :: bounds - integer , intent(in) :: num_nourbanc ! number of columns in non-urban filter - integer , intent(in) :: filter_nourbanc(:) ! column filter for non-urban points - real(r8) , intent(in) :: coszen ( bounds%begc: ) ! cosine of solar zenith angle for next time step (col) [unitless] - integer , intent(in) :: flg_slr_in ! flag: =1 for direct-beam incident flux,=2 for diffuse incident flux - real(r8) , intent(in) :: h2osno_liq ( bounds%begc: , -nlevsno+1: ) ! liquid water content (col,lyr) [kg/m2] - real(r8) , intent(in) :: h2osno_ice ( bounds%begc: , -nlevsno+1: ) ! ice content (col,lyr) [kg/m2] - integer , intent(in) :: snw_rds ( bounds%begc: , -nlevsno+1: ) ! snow effective radius (col,lyr) [microns, m^-6] - real(r8) , intent(in) :: mss_cnc_aer_in ( bounds%begc: , -nlevsno+1: , 1: ) ! mass concentration of all aerosol species (col,lyr,aer) [kg/kg] - real(r8) , intent(in) :: albsfc ( bounds%begc: , 1: ) ! albedo of surface underlying snow (col,bnd) [frc] - real(r8) , intent(out) :: albout ( bounds%begc: , 1: ) ! snow albedo, averaged into 2 bands (=0 if no sun or no snow) (col,bnd) [frc] - real(r8) , intent(out) :: flx_abs ( bounds%begc: , -nlevsno+1: , 1: ) ! absorbed flux in each layer per unit flux incident (col, lyr, bnd) - type(waterstate_type) , intent(in) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - ! - ! variables for snow radiative transfer calculations - - ! Local variables representing single-column values of arrays: - integer :: snl_lcl ! negative number of snow layers [nbr] - integer :: snw_rds_lcl(-nlevsno+1:0) ! snow effective radius [m^-6] - real(r8):: flx_slrd_lcl(1:numrad_snw) ! direct beam incident irradiance [W/m2] (set to 1) - real(r8):: flx_slri_lcl(1:numrad_snw) ! diffuse incident irradiance [W/m2] (set to 1) - real(r8):: mss_cnc_aer_lcl(-nlevsno+1:0,1:sno_nbr_aer) ! aerosol mass concentration (lyr,aer_nbr) [kg/kg] - real(r8):: h2osno_lcl ! total column snow mass [kg/m2] - real(r8):: h2osno_liq_lcl(-nlevsno+1:0) ! liquid water mass [kg/m2] - real(r8):: h2osno_ice_lcl(-nlevsno+1:0) ! ice mass [kg/m2] - real(r8):: albsfc_lcl(1:numrad_snw) ! albedo of underlying surface [frc] - real(r8):: ss_alb_snw_lcl(-nlevsno+1:0) ! single-scatter albedo of ice grains (lyr) [frc] - real(r8):: asm_prm_snw_lcl(-nlevsno+1:0) ! asymmetry parameter of ice grains (lyr) [frc] - real(r8):: ext_cff_mss_snw_lcl(-nlevsno+1:0) ! mass extinction coefficient of ice grains (lyr) [m2/kg] - real(r8):: ss_alb_aer_lcl(sno_nbr_aer) ! single-scatter albedo of aerosol species (aer_nbr) [frc] - real(r8):: asm_prm_aer_lcl(sno_nbr_aer) ! asymmetry parameter of aerosol species (aer_nbr) [frc] - real(r8):: ext_cff_mss_aer_lcl(sno_nbr_aer) ! mass extinction coefficient of aerosol species (aer_nbr) [m2/kg] - - - ! Other local variables - integer :: APRX_TYP ! two-stream approximation type - ! (1=Eddington, 2=Quadrature, 3=Hemispheric Mean) [nbr] - integer :: DELTA ! flag to use Delta approximation (Joseph, 1976) - ! (1= use, 0= don't use) - real(r8):: flx_wgt(1:numrad_snw) ! weights applied to spectral bands, - ! specific to direct and diffuse cases (bnd) [frc] - - integer :: flg_nosnl ! flag: =1 if there is snow, but zero snow layers, - ! =0 if at least 1 snow layer [flg] - integer :: trip ! flag: =1 to redo RT calculation if result is unrealistic - integer :: flg_dover ! defines conditions for RT redo (explained below) - - real(r8):: albedo ! temporary snow albedo [frc] - real(r8):: flx_sum ! temporary summation variable for NIR weighting - real(r8):: albout_lcl(numrad_snw) ! snow albedo by band [frc] - real(r8):: flx_abs_lcl(-nlevsno+1:1,numrad_snw)! absorbed flux per unit incident flux at top of snowpack (lyr,bnd) [frc] - - real(r8):: L_snw(-nlevsno+1:0) ! h2o mass (liquid+solid) in snow layer (lyr) [kg/m2] - real(r8):: tau_snw(-nlevsno+1:0) ! snow optical depth (lyr) [unitless] - real(r8):: L_aer(-nlevsno+1:0,sno_nbr_aer) ! aerosol mass in snow layer (lyr,nbr_aer) [kg/m2] - real(r8):: tau_aer(-nlevsno+1:0,sno_nbr_aer) ! aerosol optical depth (lyr,nbr_aer) [unitless] - real(r8):: tau_sum ! cumulative (snow+aerosol) optical depth [unitless] - real(r8):: tau_clm(-nlevsno+1:0) ! column optical depth from layer bottom to snowpack top (lyr) [unitless] - real(r8):: omega_sum ! temporary summation of single-scatter albedo of all aerosols [frc] - real(r8):: g_sum ! temporary summation of asymmetry parameter of all aerosols [frc] - - real(r8):: tau(-nlevsno+1:0) ! weighted optical depth of snow+aerosol layer (lyr) [unitless] - real(r8):: omega(-nlevsno+1:0) ! weighted single-scatter albedo of snow+aerosol layer (lyr) [frc] - real(r8):: g(-nlevsno+1:0) ! weighted asymmetry parameter of snow+aerosol layer (lyr) [frc] - real(r8):: tau_star(-nlevsno+1:0) ! transformed (i.e. Delta-Eddington) optical depth of snow+aerosol layer - ! (lyr) [unitless] - real(r8):: omega_star(-nlevsno+1:0) ! transformed (i.e. Delta-Eddington) SSA of snow+aerosol layer (lyr) [frc] - real(r8):: g_star(-nlevsno+1:0) ! transformed (i.e. Delta-Eddington) asymmetry paramater of snow+aerosol layer - ! (lyr) [frc] - - integer :: nstep ! current timestep [nbr] (debugging only) - integer :: g_idx, c_idx, l_idx ! gridcell, column, and landunit indices [idx] - integer :: bnd_idx ! spectral band index (1 <= bnd_idx <= numrad_snw) [idx] - integer :: rds_idx ! snow effective radius index for retrieving - ! Mie parameters from lookup table [idx] - integer :: snl_btm ! index of bottom snow layer (0) [idx] - integer :: snl_top ! index of top snow layer (-4 to 0) [idx] - integer :: fc ! column filter index - integer :: i ! layer index [idx] - integer :: j ! aerosol number index [idx] - integer :: n ! tridiagonal matrix index [idx] - integer :: m ! secondary layer index [idx] - - real(r8):: F_direct(-nlevsno+1:0) ! direct-beam radiation at bottom of layer interface (lyr) [W/m^2] - real(r8):: F_net(-nlevsno+1:0) ! net radiative flux at bottom of layer interface (lyr) [W/m^2] - real(r8):: F_abs(-nlevsno+1:0) ! net absorbed radiative energy (lyr) [W/m^2] - real(r8):: F_abs_sum ! total absorbed energy in column [W/m^2] - real(r8):: F_sfc_pls ! upward radiative flux at snowpack top [W/m^2] - real(r8):: F_btm_net ! net flux at bottom of snowpack [W/m^2] - real(r8):: F_sfc_net ! net flux at top of snowpack [W/m^2] - real(r8):: energy_sum ! sum of all energy terms; should be 0.0 [W/m^2] - real(r8):: F_direct_btm ! direct-beam radiation at bottom of snowpack [W/m^2] - real(r8):: mu_not ! cosine of solar zenith angle (used locally) [frc] - - integer :: err_idx ! counter for number of times through error loop [nbr] - real(r8):: lat_coord ! gridcell latitude (debugging only) - real(r8):: lon_coord ! gridcell longitude (debugging only) - integer :: sfctype ! underlying surface type (debugging only) - real(r8):: pi ! 3.1415... - - ! intermediate variables for radiative transfer approximation: - real(r8):: gamma1(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: gamma2(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: gamma3(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: gamma4(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: lambda(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: GAMMA(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: mu_one ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: e1(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: e2(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: e3(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: e4(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: C_pls_btm(-nlevsno+1:0) ! intermediate variable: upward flux at bottom interface (lyr) [W/m2] - real(r8):: C_mns_btm(-nlevsno+1:0) ! intermediate variable: downward flux at bottom interface (lyr) [W/m2] - real(r8):: C_pls_top(-nlevsno+1:0) ! intermediate variable: upward flux at top interface (lyr) [W/m2] - real(r8):: C_mns_top(-nlevsno+1:0) ! intermediate variable: downward flux at top interface (lyr) [W/m2] - real(r8):: A(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: B(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: D(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: E(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: AS(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: DS(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: X(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: Y(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(coszen) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osno_liq) == (/bounds%endc, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osno_ice) == (/bounds%endc, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(snw_rds) == (/bounds%endc, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(mss_cnc_aer_in) == (/bounds%endc, 0, sno_nbr_aer/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albsfc) == (/bounds%endc, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albout) == (/bounds%endc, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(flx_abs) == (/bounds%endc, 1, numrad/)), errMsg(sourcefile, __LINE__)) - - associate(& - snl => col%snl , & ! Input: [integer (:)] negative number of snow layers (col) [nbr] - - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:)] snow liquid water equivalent (col) [kg/m2] - frac_sno => waterstate_inst%frac_sno_eff_col & ! Input: [real(r8) (:)] fraction of ground covered by snow (0 to 1) - ) - - ! Define constants - pi = SHR_CONST_PI - - ! always use Delta approximation for snow - DELTA = 1 - - ! Get current timestep - nstep = get_nstep() - - ! Loop over all non-urban columns - ! (when called from CSIM, there is only one column) - do fc = 1,num_nourbanc - c_idx = filter_nourbanc(fc) - - - ! Zero absorbed radiative fluxes: - do i=-nlevsno+1,1,1 - flx_abs_lcl(:,:) = 0._r8 - flx_abs(c_idx,i,:) = 0._r8 - enddo - - ! set snow/ice mass to be used for RT: - if (flg_snw_ice == 1) then - h2osno_lcl = h2osno(c_idx) - else - h2osno_lcl = h2osno_ice(c_idx,0) - endif - - - ! Qualifier for computing snow RT: - ! 1) sunlight from atmosphere model - ! 2) minimum amount of snow on ground. - ! Otherwise, set snow albedo to zero - if ((coszen(c_idx) > 0._r8) .and. (h2osno_lcl > min_snw)) then - - ! Set variables specific to CLM - if (flg_snw_ice == 1) then - ! If there is snow, but zero snow layers, we must create a layer locally. - ! This layer is presumed to have the fresh snow effective radius. - if (snl(c_idx) > -1) then - flg_nosnl = 1 - snl_lcl = -1 - h2osno_ice_lcl(0) = h2osno_lcl - h2osno_liq_lcl(0) = 0._r8 - snw_rds_lcl(0) = snw_rds_min_int - else - flg_nosnl = 0 - snl_lcl = snl(c_idx) - h2osno_liq_lcl(:) = h2osno_liq(c_idx,:) - h2osno_ice_lcl(:) = h2osno_ice(c_idx,:) - snw_rds_lcl(:) = snw_rds(c_idx,:) - endif - - snl_btm = 0 - snl_top = snl_lcl+1 - - ! for debugging only - l_idx = col%landunit(c_idx) - g_idx = col%gridcell(c_idx) - sfctype = lun%itype(l_idx) - lat_coord = grc%latdeg(g_idx) - lon_coord = grc%londeg(g_idx) - - - ! Set variables specific to CSIM - else - flg_nosnl = 0 - snl_lcl = -1 - h2osno_liq_lcl(:) = h2osno_liq(c_idx,:) - h2osno_ice_lcl(:) = h2osno_ice(c_idx,:) - snw_rds_lcl(:) = snw_rds(c_idx,:) - snl_btm = 0 - snl_top = 0 - sfctype = -1 - lat_coord = -90 - lon_coord = 0 - endif - - ! Set local aerosol array - do j=1,sno_nbr_aer - mss_cnc_aer_lcl(:,j) = mss_cnc_aer_in(c_idx,:,j) - enddo - - - ! Set spectral underlying surface albedos to their corresponding VIS or NIR albedos - albsfc_lcl(1) = albsfc(c_idx,1) - albsfc_lcl(nir_bnd_bgn:nir_bnd_end) = albsfc(c_idx,2) - - - ! Error check for snow grain size: - do i=snl_top,snl_btm,1 - if ((snw_rds_lcl(i) < snw_rds_min_tbl) .or. (snw_rds_lcl(i) > snw_rds_max_tbl)) then - write (iulog,*) "SNICAR ERROR: snow grain radius of ", snw_rds_lcl(i), " out of bounds." - write (iulog,*) "NSTEP= ", nstep - write (iulog,*) "flg_snw_ice= ", flg_snw_ice - write (iulog,*) "column: ", c_idx, " level: ", i, " snl(c)= ", snl_lcl - write (iulog,*) "lat= ", lat_coord, " lon= ", lon_coord - write (iulog,*) "h2osno(c)= ", h2osno_lcl - call endrun(decomp_index=c_idx, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - endif - enddo - - ! Incident flux weighting parameters - ! - sum of all VIS bands must equal 1 - ! - sum of all NIR bands must equal 1 - ! - ! Spectral bands (5-band case) - ! Band 1: 0.3-0.7um (VIS) - ! Band 2: 0.7-1.0um (NIR) - ! Band 3: 1.0-1.2um (NIR) - ! Band 4: 1.2-1.5um (NIR) - ! Band 5: 1.5-5.0um (NIR) - ! - ! The following weights are appropriate for surface-incident flux in a mid-latitude winter atmosphere - ! - ! 3-band weights - if (numrad_snw==3) then - ! Direct: - if (flg_slr_in == 1) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.66628670195247_r8 - flx_wgt(3) = 0.33371329804753_r8 - ! Diffuse: - elseif (flg_slr_in == 2) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.77887652162877_r8 - flx_wgt(3) = 0.22112347837123_r8 - endif - - ! 5-band weights - elseif(numrad_snw==5) then - ! Direct: - if (flg_slr_in == 1) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.49352158521175_r8 - flx_wgt(3) = 0.18099494230665_r8 - flx_wgt(4) = 0.12094898498813_r8 - flx_wgt(5) = 0.20453448749347_r8 - ! Diffuse: - elseif (flg_slr_in == 2) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.58581507618433_r8 - flx_wgt(3) = 0.20156903770812_r8 - flx_wgt(4) = 0.10917889346386_r8 - flx_wgt(5) = 0.10343699264369_r8 - endif - endif - - ! Loop over snow spectral bands - do bnd_idx = 1,numrad_snw - - mu_not = coszen(c_idx) ! must set here, because of error handling - flg_dover = 1 ! default is to redo - err_idx = 0 ! number of times through loop - - do while (flg_dover > 0) - - ! DEFAULT APPROXIMATIONS: - ! VIS: Delta-Eddington - ! NIR (all): Delta-Hemispheric Mean - ! WARNING: DO NOT USE DELTA-EDDINGTON FOR NIR DIFFUSE - this sometimes results in negative albedo - ! - ! ERROR CONDITIONS: - ! Conditions which cause "trip", resulting in redo of RT approximation: - ! 1. negative absorbed flux - ! 2. total absorbed flux greater than incident flux - ! 3. negative albedo - ! NOTE: These errors have only been encountered in spectral bands 4 and 5 - ! - ! ERROR HANDLING - ! 1st error (flg_dover=2): switch approximation (Edd->HM or HM->Edd) - ! 2nd error (flg_dover=3): change zenith angle by 0.02 (this happens about 1 in 10^6 cases) - ! 3rd error (flg_dover=4): switch approximation with new zenith - ! Subsequent errors: repeatedly change zenith and approximations... - - if (bnd_idx == 1) then - if (flg_dover == 2) then - APRX_TYP = 3 - elseif (flg_dover == 3) then - APRX_TYP = 1 - if (coszen(c_idx) > 0.5_r8) then - mu_not = mu_not - 0.02_r8 - else - mu_not = mu_not + 0.02_r8 - endif - elseif (flg_dover == 4) then - APRX_TYP = 3 - else - APRX_TYP = 1 - endif - - else - if (flg_dover == 2) then - APRX_TYP = 1 - elseif (flg_dover == 3) then - APRX_TYP = 3 - if (coszen(c_idx) > 0.5_r8) then - mu_not = mu_not - 0.02_r8 - else - mu_not = mu_not + 0.02_r8 - endif - elseif (flg_dover == 4) then - APRX_TYP = 1 - else - APRX_TYP = 3 - endif - - endif - - ! Set direct or diffuse incident irradiance to 1 - ! (This has to be within the bnd loop because mu_not is adjusted in rare cases) - if (flg_slr_in == 1) then - flx_slrd_lcl(bnd_idx) = 1._r8/(mu_not*pi) ! this corresponds to incident irradiance of 1.0 - flx_slri_lcl(bnd_idx) = 0._r8 - else - flx_slrd_lcl(bnd_idx) = 0._r8 - flx_slri_lcl(bnd_idx) = 1._r8 - endif - - ! Pre-emptive error handling: aerosols can reap havoc on these absorptive bands. - ! Since extremely high soot concentrations have a negligible effect on these bands, zero them. - if ( (numrad_snw == 5).and.((bnd_idx == 5).or.(bnd_idx == 4)) ) then - mss_cnc_aer_lcl(:,:) = 0._r8 - endif - - if ( (numrad_snw == 3).and.(bnd_idx == 3) ) then - mss_cnc_aer_lcl(:,:) = 0._r8 - endif - - ! Define local Mie parameters based on snow grain size and aerosol species, - ! retrieved from a lookup table. - if (flg_slr_in == 1) then - do i=snl_top,snl_btm,1 - rds_idx = snw_rds_lcl(i) - snw_rds_min_tbl + 1 - ! snow optical properties (direct radiation) - ss_alb_snw_lcl(i) = ss_alb_snw_drc(rds_idx,bnd_idx) - asm_prm_snw_lcl(i) = asm_prm_snw_drc(rds_idx,bnd_idx) - ext_cff_mss_snw_lcl(i) = ext_cff_mss_snw_drc(rds_idx,bnd_idx) - enddo - elseif (flg_slr_in == 2) then - do i=snl_top,snl_btm,1 - rds_idx = snw_rds_lcl(i) - snw_rds_min_tbl + 1 - ! snow optical properties (diffuse radiation) - ss_alb_snw_lcl(i) = ss_alb_snw_dfs(rds_idx,bnd_idx) - asm_prm_snw_lcl(i) = asm_prm_snw_dfs(rds_idx,bnd_idx) - ext_cff_mss_snw_lcl(i) = ext_cff_mss_snw_dfs(rds_idx,bnd_idx) - enddo - endif - - ! aerosol species 1 optical properties - ss_alb_aer_lcl(1) = ss_alb_bc1(bnd_idx) - asm_prm_aer_lcl(1) = asm_prm_bc1(bnd_idx) - ext_cff_mss_aer_lcl(1) = ext_cff_mss_bc1(bnd_idx) - - ! aerosol species 2 optical properties - ss_alb_aer_lcl(2) = ss_alb_bc2(bnd_idx) - asm_prm_aer_lcl(2) = asm_prm_bc2(bnd_idx) - ext_cff_mss_aer_lcl(2) = ext_cff_mss_bc2(bnd_idx) - - ! aerosol species 3 optical properties - ss_alb_aer_lcl(3) = ss_alb_oc1(bnd_idx) - asm_prm_aer_lcl(3) = asm_prm_oc1(bnd_idx) - ext_cff_mss_aer_lcl(3) = ext_cff_mss_oc1(bnd_idx) - - ! aerosol species 4 optical properties - ss_alb_aer_lcl(4) = ss_alb_oc2(bnd_idx) - asm_prm_aer_lcl(4) = asm_prm_oc2(bnd_idx) - ext_cff_mss_aer_lcl(4) = ext_cff_mss_oc2(bnd_idx) - - ! aerosol species 5 optical properties - ss_alb_aer_lcl(5) = ss_alb_dst1(bnd_idx) - asm_prm_aer_lcl(5) = asm_prm_dst1(bnd_idx) - ext_cff_mss_aer_lcl(5) = ext_cff_mss_dst1(bnd_idx) - - ! aerosol species 6 optical properties - ss_alb_aer_lcl(6) = ss_alb_dst2(bnd_idx) - asm_prm_aer_lcl(6) = asm_prm_dst2(bnd_idx) - ext_cff_mss_aer_lcl(6) = ext_cff_mss_dst2(bnd_idx) - - ! aerosol species 7 optical properties - ss_alb_aer_lcl(7) = ss_alb_dst3(bnd_idx) - asm_prm_aer_lcl(7) = asm_prm_dst3(bnd_idx) - ext_cff_mss_aer_lcl(7) = ext_cff_mss_dst3(bnd_idx) - - ! aerosol species 8 optical properties - ss_alb_aer_lcl(8) = ss_alb_dst4(bnd_idx) - asm_prm_aer_lcl(8) = asm_prm_dst4(bnd_idx) - ext_cff_mss_aer_lcl(8) = ext_cff_mss_dst4(bnd_idx) - - - ! 1. snow and aerosol layer column mass (L_snw, L_aer [kg/m^2]) - ! 2. optical Depths (tau_snw, tau_aer) - ! 3. weighted Mie properties (tau, omega, g) - - ! Weighted Mie parameters of each layer - do i=snl_top,snl_btm,1 - L_snw(i) = h2osno_ice_lcl(i)+h2osno_liq_lcl(i) - tau_snw(i) = L_snw(i)*ext_cff_mss_snw_lcl(i) - - do j=1,sno_nbr_aer - L_aer(i,j) = L_snw(i)*mss_cnc_aer_lcl(i,j) - tau_aer(i,j) = L_aer(i,j)*ext_cff_mss_aer_lcl(j) - enddo - - tau_sum = 0._r8 - omega_sum = 0._r8 - g_sum = 0._r8 - - do j=1,sno_nbr_aer - tau_sum = tau_sum + tau_aer(i,j) - omega_sum = omega_sum + (tau_aer(i,j)*ss_alb_aer_lcl(j)) - g_sum = g_sum + (tau_aer(i,j)*ss_alb_aer_lcl(j)*asm_prm_aer_lcl(j)) - enddo - - tau(i) = tau_sum + tau_snw(i) - omega(i) = (1/tau(i))*(omega_sum+(ss_alb_snw_lcl(i)*tau_snw(i))) - g(i) = (1/(tau(i)*omega(i)))*(g_sum+ (asm_prm_snw_lcl(i)*ss_alb_snw_lcl(i)*tau_snw(i))) - enddo - - ! DELTA transformations, if requested - if (DELTA == 1) then - do i=snl_top,snl_btm,1 - g_star(i) = g(i)/(1+g(i)) - omega_star(i) = ((1-(g(i)**2))*omega(i)) / (1-(omega(i)*(g(i)**2))) - tau_star(i) = (1-(omega(i)*(g(i)**2)))*tau(i) - enddo - else - do i=snl_top,snl_btm,1 - g_star(i) = g(i) - omega_star(i) = omega(i) - tau_star(i) = tau(i) - enddo - endif - - ! Total column optical depth: - ! tau_clm(i) = total optical depth above the bottom of layer i - tau_clm(snl_top) = 0._r8 - do i=snl_top+1,snl_btm,1 - tau_clm(i) = tau_clm(i-1)+tau_star(i-1) - enddo - - ! Direct radiation at bottom of snowpack: - F_direct_btm = albsfc_lcl(bnd_idx)*mu_not * & - exp(-(tau_clm(snl_btm)+tau_star(snl_btm))/mu_not)*pi*flx_slrd_lcl(bnd_idx) - - ! Intermediates - ! Gamma values are approximation-specific. - - ! Eddington - if (APRX_TYP==1) then - do i=snl_top,snl_btm,1 - gamma1(i) = (7-(omega_star(i)*(4+(3*g_star(i)))))/4 - gamma2(i) = -(1-(omega_star(i)*(4-(3*g_star(i)))))/4 - gamma3(i) = (2-(3*g_star(i)*mu_not))/4 - gamma4(i) = 1-gamma3(i) - mu_one = 0.5 - enddo - - ! Quadrature - elseif (APRX_TYP==2) then - do i=snl_top,snl_btm,1 - gamma1(i) = (3**0.5)*(2-(omega_star(i)*(1+g_star(i))))/2 - gamma2(i) = omega_star(i)*(3**0.5)*(1-g_star(i))/2 - gamma3(i) = (1-((3**0.5)*g_star(i)*mu_not))/2 - gamma4(i) = 1-gamma3(i) - mu_one = 1/(3**0.5) - enddo - - ! Hemispheric Mean - elseif (APRX_TYP==3) then - do i=snl_top,snl_btm,1 - gamma1(i) = 2 - (omega_star(i)*(1+g_star(i))) - gamma2(i) = omega_star(i)*(1-g_star(i)) - gamma3(i) = (1-((3**0.5)*g_star(i)*mu_not))/2 - gamma4(i) = 1-gamma3(i) - mu_one = 0.5 - enddo - endif - - ! Intermediates for tri-diagonal solution - do i=snl_top,snl_btm,1 - lambda(i) = sqrt(abs((gamma1(i)**2) - (gamma2(i)**2))) - GAMMA(i) = gamma2(i)/(gamma1(i)+lambda(i)) - - e1(i) = 1+(GAMMA(i)*exp(-lambda(i)*tau_star(i))) - e2(i) = 1-(GAMMA(i)*exp(-lambda(i)*tau_star(i))) - e3(i) = GAMMA(i) + exp(-lambda(i)*tau_star(i)) - e4(i) = GAMMA(i) - exp(-lambda(i)*tau_star(i)) - enddo !enddo over snow layers - - - ! Intermediates for tri-diagonal solution - do i=snl_top,snl_btm,1 - if (flg_slr_in == 1) then - - C_pls_btm(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-(tau_clm(i)+tau_star(i))/mu_not)* & - (((gamma1(i)-(1/mu_not))*gamma3(i))+ & - (gamma4(i)*gamma2(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - C_mns_btm(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-(tau_clm(i)+tau_star(i))/mu_not)* & - (((gamma1(i)+(1/mu_not))*gamma4(i))+ & - (gamma2(i)*gamma3(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - C_pls_top(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-tau_clm(i)/mu_not)*(((gamma1(i)-(1/mu_not))* & - gamma3(i))+(gamma4(i)*gamma2(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - C_mns_top(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-tau_clm(i)/mu_not)*(((gamma1(i)+(1/mu_not))* & - gamma4(i))+(gamma2(i)*gamma3(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - else - C_pls_btm(i) = 0._r8 - C_mns_btm(i) = 0._r8 - C_pls_top(i) = 0._r8 - C_mns_top(i) = 0._r8 - endif - enddo - - ! Coefficients for tridiaganol matrix solution - do i=2*snl_lcl+1,0,1 - - !Boundary values for i=1 and i=2*snl_lcl, specifics for i=odd and i=even - if (i==(2*snl_lcl+1)) then - A(i) = 0 - B(i) = e1(snl_top) - D(i) = -e2(snl_top) - E(i) = flx_slri_lcl(bnd_idx)-C_mns_top(snl_top) - - elseif(i==0) then - A(i) = e1(snl_btm)-(albsfc_lcl(bnd_idx)*e3(snl_btm)) - B(i) = e2(snl_btm)-(albsfc_lcl(bnd_idx)*e4(snl_btm)) - D(i) = 0 - E(i) = F_direct_btm-C_pls_btm(snl_btm)+(albsfc_lcl(bnd_idx)*C_mns_btm(snl_btm)) - - elseif(mod(i,2)==-1) then ! If odd and i>=3 (n=1 for i=3) - n=floor(i/2.0) - A(i) = (e2(n)*e3(n))-(e4(n)*e1(n)) - B(i) = (e1(n)*e1(n+1))-(e3(n)*e3(n+1)) - D(i) = (e3(n)*e4(n+1))-(e1(n)*e2(n+1)) - E(i) = (e3(n)*(C_pls_top(n+1)-C_pls_btm(n)))+(e1(n)*(C_mns_btm(n)-C_mns_top(n+1))) - - elseif(mod(i,2)==0) then ! If even and i<=2*snl_lcl - n=(i/2) - A(i) = (e2(n+1)*e1(n))-(e3(n)*e4(n+1)) - B(i) = (e2(n)*e2(n+1))-(e4(n)*e4(n+1)) - D(i) = (e1(n+1)*e4(n+1))-(e2(n+1)*e3(n+1)) - E(i) = (e2(n+1)*(C_pls_top(n+1)-C_pls_btm(n)))+(e4(n+1)*(C_mns_top(n+1)-C_mns_btm(n))) - endif - enddo - - AS(0) = A(0)/B(0) - DS(0) = E(0)/B(0) - - do i=-1,(2*snl_lcl+1),-1 - X(i) = 1/(B(i)-(D(i)*AS(i+1))) - AS(i) = A(i)*X(i) - DS(i) = (E(i)-(D(i)*DS(i+1)))*X(i) - enddo - - Y(2*snl_lcl+1) = DS(2*snl_lcl+1) - do i=(2*snl_lcl+2),0,1 - Y(i) = DS(i)-(AS(i)*Y(i-1)) - enddo - - ! Downward direct-beam and net flux (F_net) at the base of each layer: - do i=snl_top,snl_btm,1 - F_direct(i) = mu_not*pi*flx_slrd_lcl(bnd_idx)*exp(-(tau_clm(i)+tau_star(i))/mu_not) - F_net(i) = (Y(2*i-1)*(e1(i)-e3(i))) + (Y(2*i)*(e2(i)-e4(i))) + & - C_pls_btm(i) - C_mns_btm(i) - F_direct(i) - enddo - - ! Upward flux at snowpack top: - F_sfc_pls = (Y(2*snl_lcl+1)*(exp(-lambda(snl_top)*tau_star(snl_top))+ & - GAMMA(snl_top))) + (Y(2*snl_lcl+2)*(exp(-lambda(snl_top)* & - tau_star(snl_top))-GAMMA(snl_top))) + C_pls_top(snl_top) - - ! Net flux at bottom = absorbed radiation by underlying surface: - F_btm_net = -F_net(snl_btm) - - - ! Bulk column albedo and surface net flux - albedo = F_sfc_pls/((mu_not*pi*flx_slrd_lcl(bnd_idx))+flx_slri_lcl(bnd_idx)) - F_sfc_net = F_sfc_pls - ((mu_not*pi*flx_slrd_lcl(bnd_idx))+flx_slri_lcl(bnd_idx)) - - trip = 0 - ! Absorbed flux in each layer - do i=snl_top,snl_btm,1 - if(i==snl_top) then - F_abs(i) = F_net(i)-F_sfc_net - else - F_abs(i) = F_net(i)-F_net(i-1) - endif - flx_abs_lcl(i,bnd_idx) = F_abs(i) - - - ! ERROR check: negative absorption - if (flx_abs_lcl(i,bnd_idx) < -0.00001) then - trip = 1 - endif - enddo - - flx_abs_lcl(1,bnd_idx) = F_btm_net - - if (flg_nosnl == 1) then - ! If there are no snow layers (but still snow), all absorbed energy must be in top soil layer - !flx_abs_lcl(:,bnd_idx) = 0._r8 - !flx_abs_lcl(1,bnd_idx) = F_abs(0) + F_btm_net - - ! changed on 20070408: - ! OK to put absorbed energy in the fictitous snow layer because routine SurfaceRadiation - ! handles the case of no snow layers. Then, if a snow layer is addded between now and - ! SurfaceRadiation (called in CanopyHydrology), absorbed energy will be properly distributed. - flx_abs_lcl(0,bnd_idx) = F_abs(0) - flx_abs_lcl(1,bnd_idx) = F_btm_net - - endif - - !Underflow check (we've already tripped the error condition above) - do i=snl_top,1,1 - if (flx_abs_lcl(i,bnd_idx) < 0._r8) then - flx_abs_lcl(i,bnd_idx) = 0._r8 - endif - enddo - - F_abs_sum = 0._r8 - do i=snl_top,snl_btm,1 - F_abs_sum = F_abs_sum + F_abs(i) - enddo - - - !ERROR check: absorption greater than incident flux - ! (should make condition more generic than "1._r8") - if (F_abs_sum > 1._r8) then - trip = 1 - endif - - !ERROR check: - if ((albedo < 0._r8).and.(trip==0)) then - trip = 1 - endif - - ! Set conditions for redoing RT calculation - if ((trip == 1).and.(flg_dover == 1)) then - flg_dover = 2 - elseif ((trip == 1).and.(flg_dover == 2)) then - flg_dover = 3 - elseif ((trip == 1).and.(flg_dover == 3)) then - flg_dover = 4 - elseif((trip == 1).and.(flg_dover == 4).and.(err_idx < 20)) then - flg_dover = 3 - err_idx = err_idx + 1 - elseif((trip == 1).and.(flg_dover == 4).and.(err_idx >= 20)) then - flg_dover = 0 - write(iulog,*) "SNICAR ERROR: FOUND A WORMHOLE. STUCK IN INFINITE LOOP! Called from: ", flg_snw_ice - write(iulog,*) "SNICAR STATS: snw_rds(0)= ", snw_rds(c_idx,0) - write(iulog,*) "SNICAR STATS: L_snw(0)= ", L_snw(0) - write(iulog,*) "SNICAR STATS: h2osno= ", h2osno_lcl, " snl= ", snl_lcl - write(iulog,*) "SNICAR STATS: soot1(0)= ", mss_cnc_aer_lcl(0,1) - write(iulog,*) "SNICAR STATS: soot2(0)= ", mss_cnc_aer_lcl(0,2) - write(iulog,*) "SNICAR STATS: dust1(0)= ", mss_cnc_aer_lcl(0,3) - write(iulog,*) "SNICAR STATS: dust2(0)= ", mss_cnc_aer_lcl(0,4) - write(iulog,*) "SNICAR STATS: dust3(0)= ", mss_cnc_aer_lcl(0,5) - write(iulog,*) "SNICAR STATS: dust4(0)= ", mss_cnc_aer_lcl(0,6) - l_idx = col%landunit(c_idx) - write(iulog,*) "column index: ", c_idx - write(iulog,*) "landunit type", lun%itype(l_idx) - write(iulog,*) "frac_sno: ", frac_sno(c_idx) - call endrun(decomp_index=c_idx, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - else - flg_dover = 0 - endif - - enddo !enddo while (flg_dover > 0) - - ! Energy conservation check: - ! Incident direct+diffuse radiation equals (absorbed+bulk_transmitted+bulk_reflected) - energy_sum = (mu_not*pi*flx_slrd_lcl(bnd_idx)) + flx_slri_lcl(bnd_idx) - (F_abs_sum + F_btm_net + F_sfc_pls) - if (abs(energy_sum) > 0.00001_r8) then - write (iulog,"(a,e12.6,a,i6,a,i6)") "SNICAR ERROR: Energy conservation error of : ", energy_sum, & - " at timestep: ", nstep, " at column: ", c_idx - call endrun(decomp_index=c_idx, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - endif - - albout_lcl(bnd_idx) = albedo - - ! Check that albedo is less than 1 - if (albout_lcl(bnd_idx) > 1.0) then - - write (iulog,*) "SNICAR ERROR: Albedo > 1.0 at c: ", c_idx, " NSTEP= ",nstep - write (iulog,*) "SNICAR STATS: bnd_idx= ",bnd_idx - write (iulog,*) "SNICAR STATS: albout_lcl(bnd)= ",albout_lcl(bnd_idx), & - " albsfc_lcl(bnd_idx)= ",albsfc_lcl(bnd_idx) - write (iulog,*) "SNICAR STATS: landtype= ", sfctype - write (iulog,*) "SNICAR STATS: h2osno= ", h2osno_lcl, " snl= ", snl_lcl - write (iulog,*) "SNICAR STATS: coszen= ", coszen(c_idx), " flg_slr= ", flg_slr_in - - write (iulog,*) "SNICAR STATS: soot(-4)= ", mss_cnc_aer_lcl(-4,1) - write (iulog,*) "SNICAR STATS: soot(-3)= ", mss_cnc_aer_lcl(-3,1) - write (iulog,*) "SNICAR STATS: soot(-2)= ", mss_cnc_aer_lcl(-2,1) - write (iulog,*) "SNICAR STATS: soot(-1)= ", mss_cnc_aer_lcl(-1,1) - write (iulog,*) "SNICAR STATS: soot(0)= ", mss_cnc_aer_lcl(0,1) - - write (iulog,*) "SNICAR STATS: L_snw(-4)= ", L_snw(-4) - write (iulog,*) "SNICAR STATS: L_snw(-3)= ", L_snw(-3) - write (iulog,*) "SNICAR STATS: L_snw(-2)= ", L_snw(-2) - write (iulog,*) "SNICAR STATS: L_snw(-1)= ", L_snw(-1) - write (iulog,*) "SNICAR STATS: L_snw(0)= ", L_snw(0) - - write (iulog,*) "SNICAR STATS: snw_rds(-4)= ", snw_rds(c_idx,-4) - write (iulog,*) "SNICAR STATS: snw_rds(-3)= ", snw_rds(c_idx,-3) - write (iulog,*) "SNICAR STATS: snw_rds(-2)= ", snw_rds(c_idx,-2) - write (iulog,*) "SNICAR STATS: snw_rds(-1)= ", snw_rds(c_idx,-1) - write (iulog,*) "SNICAR STATS: snw_rds(0)= ", snw_rds(c_idx,0) - - call endrun(decomp_index=c_idx, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - endif - - enddo ! loop over wvl bands - - - ! Weight output NIR albedo appropriately - albout(c_idx,1) = albout_lcl(1) - flx_sum = 0._r8 - do bnd_idx= nir_bnd_bgn,nir_bnd_end - flx_sum = flx_sum + flx_wgt(bnd_idx)*albout_lcl(bnd_idx) - end do - albout(c_idx,2) = flx_sum / sum(flx_wgt(nir_bnd_bgn:nir_bnd_end)) - - ! Weight output NIR absorbed layer fluxes (flx_abs) appropriately - flx_abs(c_idx,:,1) = flx_abs_lcl(:,1) - do i=snl_top,1,1 - flx_sum = 0._r8 - do bnd_idx= nir_bnd_bgn,nir_bnd_end - flx_sum = flx_sum + flx_wgt(bnd_idx)*flx_abs_lcl(i,bnd_idx) - enddo - flx_abs(c_idx,i,2) = flx_sum / sum(flx_wgt(nir_bnd_bgn:nir_bnd_end)) - end do - - ! If snow < minimum_snow, but > 0, and there is sun, set albedo to underlying surface albedo - elseif ( (coszen(c_idx) > 0._r8) .and. (h2osno_lcl < min_snw) .and. (h2osno_lcl > 0._r8) ) then - albout(c_idx,1) = albsfc(c_idx,1) - albout(c_idx,2) = albsfc(c_idx,2) - - ! There is either zero snow, or no sun - else - albout(c_idx,1) = 0._r8 - albout(c_idx,2) = 0._r8 - endif ! if column has snow and coszen > 0 - - enddo ! loop over all columns - - end associate - - end subroutine SNICAR_RT - - !----------------------------------------------------------------------- - subroutine SnowAge_grain(bounds, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc, & - waterflux_inst, waterstate_inst, temperature_inst, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Updates the snow effective grain size (radius). - ! Contributions to grain size evolution are from: - ! 1. vapor redistribution (dry snow) - ! 2. liquid water redistribution (wet snow) - ! 3. re-freezing of liquid water - ! - ! Vapor redistribution: Method is to retrieve 3 best-bit parameters that - ! depend on snow temperature, temperature gradient, and density, - ! that are derived from the microphysical model described in: - ! Flanner and Zender (2006), Linking snowpack microphysics and albedo - ! evolution, J. Geophys. Res., 111, D12208, doi:10.1029/2005JD006834. - ! The parametric equation has the form: - ! dr/dt = drdt_0*(tau/(dr_fresh+tau))^(1/kappa), where: - ! r is the effective radius, - ! tau and kappa are best-fit parameters, - ! drdt_0 is the initial rate of change of effective radius, and - ! dr_fresh is the difference between the current and fresh snow states - ! (r_current - r_fresh). - ! - ! Liquid water redistribution: Apply the grain growth function from: - ! Brun, E. (1989), Investigation of wet-snow metamorphism in respect of - ! liquid-water content, Annals of Glaciology, 13, 22-26. - ! There are two parameters that describe the grain growth rate as - ! a function of snow liquid water content (LWC). The "LWC=0" parameter - ! is zeroed here because we are accounting for dry snowing with a - ! different representation - ! - ! Re-freezing of liquid water: Assume that re-frozen liquid water clumps - ! into an arbitrarily large effective grain size (snw_rds_refrz). - ! The phenomenon is observed (Grenfell), but so far unquantified, as far as - ! I am aware. - ! - ! !USES: - use clm_time_manager , only : get_step_size, get_nstep - use clm_varpar , only : nlevsno - use clm_varcon , only : spval - use shr_const_mod , only : SHR_CONST_RHOICE, SHR_CONST_PI - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_snowc ! number of column snow points in column filter - integer , intent(in) :: filter_snowc(:) ! column filter for snow points - integer , intent(in) :: num_nosnowc ! number of column non-snow points in column filter - integer , intent(in) :: filter_nosnowc(:) ! column filter for non-snow points - type(waterflux_type) , intent(in) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: snl_top ! top snow layer index [idx] - integer :: snl_btm ! bottom snow layer index [idx] - integer :: i ! layer index [idx] - integer :: c_idx ! column index [idx] - integer :: fc ! snow column filter index [idx] - integer :: T_idx ! snow aging lookup table temperature index [idx] - integer :: Tgrd_idx ! snow aging lookup table temperature gradient index [idx] - integer :: rhos_idx ! snow aging lookup table snow density index [idx] - real(r8) :: t_snotop ! temperature at upper layer boundary [K] - real(r8) :: t_snobtm ! temperature at lower layer boundary [K] - real(r8) :: dTdz(bounds%begc:bounds%endc,-nlevsno:0) ! snow temperature gradient (col,lyr) [K m-1] - real(r8) :: bst_tau ! snow aging parameter retrieved from lookup table [hour] - real(r8) :: bst_kappa ! snow aging parameter retrieved from lookup table [unitless] - real(r8) :: bst_drdt0 ! snow aging parameter retrieved from lookup table [um hr-1] - real(r8) :: dr ! incremental change in snow effective radius [um] - real(r8) :: dr_wet ! incremental change in snow effective radius from wet growth [um] - real(r8) :: dr_fresh ! difference between fresh snow r_e and current r_e [um] - real(r8) :: newsnow ! fresh snowfall [kg m-2] - real(r8) :: refrzsnow ! re-frozen snow [kg m-2] - real(r8) :: frc_newsnow ! fraction of layer mass that is new snow [frc] - real(r8) :: frc_oldsnow ! fraction of layer mass that is old snow [frc] - real(r8) :: frc_refrz ! fraction of layer mass that is re-frozen snow [frc] - real(r8) :: frc_liq ! fraction of layer mass that is liquid water[frc] - real(r8) :: dtime ! land model time step [sec] - real(r8) :: rhos ! snow density [kg m-3] - real(r8) :: h2osno_lyr ! liquid + solid H2O in snow layer [kg m-2] - real(r8) :: cdz(-nlevsno+1:0) ! column average layer thickness [m] - real(r8) :: snw_rds_fresh ! fresh snow radius [microns] - !--------------------------------------------------------------------------! - - associate( & - snl => col%snl , & ! Input: [integer (:) ] negative number of snow layers (col) [nbr] - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (col,lyr) [m] - - qflx_snow_grnd_col => waterflux_inst%qflx_snow_grnd_col , & ! Input: [real(r8) (:) ] snow on ground after interception (col) [kg m-2 s-1] - qflx_snofrz_lyr => waterflux_inst%qflx_snofrz_lyr_col , & ! Input: [real(r8) (:,:) ] snow freezing rate (col,lyr) [kg m-2 s-1] - - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (col) [mm H2O] - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water content (col,lyr) [kg m-2] - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice content (col,lyr) [kg m-2] - snw_rds => waterstate_inst%snw_rds_col , & ! Output: [real(r8) (:,:) ] effective grain radius (col,lyr) [microns, m-6] - snw_rds_top => waterstate_inst%snw_rds_top_col , & ! Output: [real(r8) (:) ] effective grain radius, top layer (col) [microns, m-6] - sno_liq_top => waterstate_inst%sno_liq_top_col , & ! Output: [real(r8) (:) ] liquid water fraction (mass) in top snow layer (col) [frc] - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil and snow temperature (col,lyr) [K] - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (col) [K] - snot_top => temperature_inst%snot_top_col , & ! Output: [real(r8) (:) ] temperature in top snow layer (col) [K] - dTdz_top => temperature_inst%dTdz_top_col & ! Output: [real(r8) (:) ] temperature gradient in top layer (col) [K m-1] - ) - - - ! set timestep and step interval - dtime = get_step_size() - - ! loop over columns that have at least one snow layer - do fc = 1, num_snowc - c_idx = filter_snowc(fc) - - snl_btm = 0 - snl_top = snl(c_idx) + 1 - - cdz(snl_top:snl_btm)=frac_sno(c_idx)*dz(c_idx,snl_top:snl_btm) - - ! loop over snow layers - do i=snl_top,snl_btm,1 - ! - !********** 1. DRY SNOW AGING *********** - ! - h2osno_lyr = h2osoi_liq(c_idx,i) + h2osoi_ice(c_idx,i) - - ! temperature gradient - if (i == snl_top) then - ! top layer - t_snotop = t_soisno(c_idx,snl_top) - t_snobtm = (t_soisno(c_idx,i+1)*dz(c_idx,i) & - + t_soisno(c_idx,i)*dz(c_idx,i+1)) & - / (dz(c_idx,i)+dz(c_idx,i+1)) - else - t_snotop = (t_soisno(c_idx,i-1)*dz(c_idx,i) & - + t_soisno(c_idx,i)*dz(c_idx,i-1)) & - / (dz(c_idx,i)+dz(c_idx,i-1)) - t_snobtm = (t_soisno(c_idx,i+1)*dz(c_idx,i) & - + t_soisno(c_idx,i)*dz(c_idx,i+1)) & - / (dz(c_idx,i)+dz(c_idx,i+1)) - endif - - dTdz(c_idx,i) = abs((t_snotop - t_snobtm) / cdz(i)) - - ! snow density - rhos = (h2osoi_liq(c_idx,i)+h2osoi_ice(c_idx,i)) / cdz(i) - - ! make sure rhos doesn't drop below 50 (see rhos_idx below) - rhos=max(50._r8,rhos) - - ! best-fit table indecies - T_idx = nint((t_soisno(c_idx,i)-223) / 5) + 1 - Tgrd_idx = nint(dTdz(c_idx,i) / 10) + 1 - rhos_idx = nint((rhos-50) / 50) + 1 - - ! boundary check: - if (T_idx < idx_T_min) then - T_idx = idx_T_min - endif - if (T_idx > idx_T_max) then - T_idx = idx_T_max - endif - if (Tgrd_idx < idx_Tgrd_min) then - Tgrd_idx = idx_Tgrd_min - endif - if (Tgrd_idx > idx_Tgrd_max) then - Tgrd_idx = idx_Tgrd_max - endif - if (rhos_idx < idx_rhos_min) then - rhos_idx = idx_rhos_min - endif - if (rhos_idx > idx_rhos_max) then - rhos_idx = idx_rhos_max - endif - - ! best-fit parameters - bst_tau = snowage_tau(rhos_idx,Tgrd_idx,T_idx) - bst_kappa = snowage_kappa(rhos_idx,Tgrd_idx,T_idx) - bst_drdt0 = snowage_drdt0(rhos_idx,Tgrd_idx,T_idx) - - - !LvK extra boundary check, to prevent when using old restart file with lower snw_rds_min than current run - if (snw_rds(c_idx,i) < snw_rds_min) then - snw_rds(c_idx,i) = snw_rds_min - endif - - ! change in snow effective radius, using best-fit parameters - dr_fresh = snw_rds(c_idx,i)-snw_rds_min - dr = (bst_drdt0*(bst_tau/(dr_fresh+bst_tau))**(1/bst_kappa)) * (dtime/3600) - - ! - !********** 2. WET SNOW AGING *********** - ! - ! We are assuming wet and dry evolution occur simultaneously, and - ! the contributions from both can be summed. - ! This is justified by setting the linear offset constant C1_liq_Brun89 to zero [Brun, 1989] - - ! liquid water faction - frc_liq = min(0.1_r8, (h2osoi_liq(c_idx,i) / (h2osoi_liq(c_idx,i)+h2osoi_ice(c_idx,i)))) - - !dr_wet = 1E6_r8*(dtime*(C1_liq_Brun89 + C2_liq_Brun89*(frc_liq**(3))) / (4*SHR_CONST_PI*(snw_rds(c_idx,i)/1E6)**(2))) - !simplified, units of microns: - dr_wet = 1E18_r8*(dtime*(C2_liq_Brun89*(frc_liq**(3))) / (4*SHR_CONST_PI*snw_rds(c_idx,i)**(2))) - - dr = dr + dr_wet - - ! - !********** 3. SNOWAGE SCALING (TURNED OFF BY DEFAULT) ************* - ! - ! Multiply rate of change of effective radius by some constant, xdrdt - if (flg_snoage_scl) then - dr = dr*xdrdt - endif - - - ! - !********** 4. INCREMENT EFFECTIVE RADIUS, ACCOUNTING FOR: *********** - ! DRY AGING - ! WET AGING - ! FRESH SNOW - ! RE-FREEZING - ! - ! new snowfall [kg/m2] - newsnow = max(0._r8, (qflx_snow_grnd_col(c_idx)*dtime)) - - ! snow that has re-frozen [kg/m2] - refrzsnow = max(0._r8, (qflx_snofrz_lyr(c_idx,i)*dtime)) - - ! fraction of layer mass that is re-frozen - frc_refrz = refrzsnow / h2osno_lyr - - ! fraction of layer mass that is new snow - if (i == snl_top) then - frc_newsnow = newsnow / h2osno_lyr - else - frc_newsnow = 0._r8 - endif - - if ((frc_refrz + frc_newsnow) > 1._r8) then - frc_refrz = frc_refrz / (frc_refrz + frc_newsnow) - frc_newsnow = 1._r8 - frc_refrz - frc_oldsnow = 0._r8 - else - frc_oldsnow = 1._r8 - frc_refrz - frc_newsnow - endif - - ! temperature dependent fresh grain size - snw_rds_fresh = FreshSnowRadius(c_idx, atm2lnd_inst) - - ! mass-weighted mean of fresh snow, old snow, and re-frozen snow effective radius - snw_rds(c_idx,i) = (snw_rds(c_idx,i)+dr)*frc_oldsnow + snw_rds_fresh*frc_newsnow + snw_rds_refrz*frc_refrz - ! - !********** 5. CHECK BOUNDARIES *********** - ! - ! boundary check - if (snw_rds(c_idx,i) < snw_rds_min) then - snw_rds(c_idx,i) = snw_rds_min - endif - - if (snw_rds(c_idx,i) > snw_rds_max) then - snw_rds(c_idx,i) = snw_rds_max - end if - - ! set top layer variables for history files - if (i == snl_top) then - snot_top(c_idx) = t_soisno(c_idx,i) - dTdz_top(c_idx) = dTdz(c_idx,i) - snw_rds_top(c_idx) = snw_rds(c_idx,i) - sno_liq_top(c_idx) = h2osoi_liq(c_idx,i) / (h2osoi_liq(c_idx,i)+h2osoi_ice(c_idx,i)) - endif - - enddo - enddo - - ! Special case: snow on ground, but not enough to have defined a snow layer: - ! set snw_rds to fresh snow grain size: - do fc = 1, num_nosnowc - c_idx = filter_nosnowc(fc) - if (h2osno(c_idx) > 0._r8) then - snw_rds(c_idx,0) = snw_rds_min - endif - enddo - - end associate - - end subroutine SnowAge_grain - - - !----------------------------------------------------------------------- - real(r8) function FreshSnowRadius(c_idx, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Returns fresh snow grain radius, which is linearly dependent on temperature. - ! This is implemented to remedy an outstanding bias that SNICAR has in initial - ! grain size. See e.g. Sandells et al, 2017 for a discussion (10.5194/tc-11-229-2017). - ! - ! Yang et al. (2017), 10.1016/j.jqsrt.2016.03.033 - ! discusses grain size observations, which suggest a temperature dependence. - ! - ! !REVISION HISTORY: - ! Author: Leo VanKampenhout - ! - ! !USES: - use AerosolMod , only : fresh_snw_rds_max - ! !ARGUMENTS: - integer, intent(in) :: c_idx ! column index - type(atm2lnd_type) , intent(in) :: atm2lnd_inst ! Forcing from atmosphere - ! - ! !LOCAL VARIABLES: - !----------------------------------------------------------------------- - real(r8), parameter :: tmin = tfrz - 30._r8 ! start of linear ramp - real(r8), parameter :: tmax = tfrz - 0._r8 ! end of linear ramp - real(r8), parameter :: gs_min = snw_rds_min ! minimum value - real(r8) :: gs_max ! maximum value - - associate( & - forc_t => atm2lnd_inst%forc_t_downscaled_col & ! Input: [real(r8) (:) ] atmospheric temperature (Kelvin) - ) - if ( fresh_snw_rds_max <= snw_rds_min )then - FreshSnowRadius = snw_rds_min - else - gs_max = fresh_snw_rds_max - - if (forc_t(c_idx) < tmin) then - FreshSnowRadius = gs_min - else if (forc_t(c_idx) > tmax) then - FreshSnowRadius = gs_max - else - FreshSnowRadius = (tmax-forc_t(c_idx))/(tmax-tmin)*gs_min + & - (forc_t(c_idx)-tmin)/(tmax-tmin)*gs_max - end if - end if - - end associate - - end function FreshSnowRadius - - - - !----------------------------------------------------------------------- - subroutine SnowOptics_init( ) - - use fileutils , only : getfil - use CLM_varctl , only : fsnowoptics - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - - type(file_desc_t) :: ncid ! netCDF file id - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'SnowOptics_init' ! subroutine name - integer :: ier ! error status - - ! - ! Open optics file: - if(masterproc) write(iulog,*) 'Attempting to read snow optical properties .....' - call getfil (fsnowoptics, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - if(masterproc) write(iulog,*) subname,trim(fsnowoptics) - - ! direct-beam snow Mie parameters: - call ncd_io('ss_alb_ice_drc', ss_alb_snw_drc, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ice_drc',asm_prm_snw_drc, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ice_drc', ext_cff_mss_snw_drc, 'read', ncid, posNOTonfile=.true.) - - ! diffuse snow Mie parameters - call ncd_io( 'ss_alb_ice_dfs', ss_alb_snw_dfs, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ice_dfs', asm_prm_snw_dfs, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ice_dfs', ext_cff_mss_snw_dfs, 'read', ncid, posNOTonfile=.true.) - - ! BC species 1 Mie parameters - call ncd_io( 'ss_alb_bcphil', ss_alb_bc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_bcphil', asm_prm_bc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_bcphil', ext_cff_mss_bc1, 'read', ncid, posNOTonfile=.true.) - - ! BC species 2 Mie parameters - call ncd_io( 'ss_alb_bcphob', ss_alb_bc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_bcphob', asm_prm_bc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_bcphob', ext_cff_mss_bc2, 'read', ncid, posNOTonfile=.true.) - - ! OC species 1 Mie parameters - call ncd_io( 'ss_alb_ocphil', ss_alb_oc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ocphil', asm_prm_oc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ocphil', ext_cff_mss_oc1, 'read', ncid, posNOTonfile=.true.) - - ! OC species 2 Mie parameters - call ncd_io( 'ss_alb_ocphob', ss_alb_oc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ocphob', asm_prm_oc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ocphob', ext_cff_mss_oc2, 'read', ncid, posNOTonfile=.true.) - - ! dust species 1 Mie parameters - call ncd_io( 'ss_alb_dust01', ss_alb_dst1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust01', asm_prm_dst1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust01', ext_cff_mss_dst1, 'read', ncid, posNOTonfile=.true.) - - ! dust species 2 Mie parameters - call ncd_io( 'ss_alb_dust02', ss_alb_dst2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust02', asm_prm_dst2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust02', ext_cff_mss_dst2, 'read', ncid, posNOTonfile=.true.) - - ! dust species 3 Mie parameters - call ncd_io( 'ss_alb_dust03', ss_alb_dst3, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust03', asm_prm_dst3, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust03', ext_cff_mss_dst3, 'read', ncid, posNOTonfile=.true.) - - ! dust species 4 Mie parameters - call ncd_io( 'ss_alb_dust04', ss_alb_dst4, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust04', asm_prm_dst4, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust04', ext_cff_mss_dst4, 'read', ncid, posNOTonfile=.true.) - - - call ncd_pio_closefile(ncid) - if (masterproc) then - - write(iulog,*) 'Successfully read snow optical properties' - ! print some diagnostics: - write (iulog,*) 'SNICAR: Mie single scatter albedos for direct-beam ice, rds=100um: ', & - ss_alb_snw_drc(71,1), ss_alb_snw_drc(71,2), ss_alb_snw_drc(71,3), & - ss_alb_snw_drc(71,4), ss_alb_snw_drc(71,5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for diffuse ice, rds=100um: ', & - ss_alb_snw_dfs(71,1), ss_alb_snw_dfs(71,2), ss_alb_snw_dfs(71,3), & - ss_alb_snw_dfs(71,4), ss_alb_snw_dfs(71,5) - if (DO_SNO_OC) then - write (iulog,*) 'SNICAR: Including OC aerosols from snow radiative transfer calculations' - else - write (iulog,*) 'SNICAR: Excluding OC aerosols from snow radiative transfer calculations' - endif - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophillic BC: ', & - ss_alb_bc1(1), ss_alb_bc1(2), ss_alb_bc1(3), ss_alb_bc1(4), ss_alb_bc1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophobic BC: ', & - ss_alb_bc2(1), ss_alb_bc2(2), ss_alb_bc2(3), ss_alb_bc2(4), ss_alb_bc2(5) - if (DO_SNO_OC) then - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophillic OC: ', & - ss_alb_oc1(1), ss_alb_oc1(2), ss_alb_oc1(3), ss_alb_oc1(4), ss_alb_oc1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophobic OC: ', & - ss_alb_oc2(1), ss_alb_oc2(2), ss_alb_oc2(3), ss_alb_oc2(4), ss_alb_oc2(5) - endif - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 1: ', & - ss_alb_dst1(1), ss_alb_dst1(2), ss_alb_dst1(3), ss_alb_dst1(4), ss_alb_dst1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 2: ', & - ss_alb_dst2(1), ss_alb_dst2(2), ss_alb_dst2(3), ss_alb_dst2(4), ss_alb_dst2(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 3: ', & - ss_alb_dst3(1), ss_alb_dst3(2), ss_alb_dst3(3), ss_alb_dst3(4), ss_alb_dst3(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 4: ', & - ss_alb_dst4(1), ss_alb_dst4(2), ss_alb_dst4(3), ss_alb_dst4(4), ss_alb_dst4(5) - write(iulog,*) - end if - - end subroutine SnowOptics_init - - !----------------------------------------------------------------------- - subroutine SnowAge_init( ) - use CLM_varctl , only : fsnowaging - use fileutils , only : getfil - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - - type(file_desc_t) :: ncid ! netCDF file id - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'SnowOptics_init' ! subroutine name - integer :: varid ! netCDF id's - integer :: ier ! error status - - ! Open snow aging (effective radius evolution) file: - allocate(snowage_tau(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - allocate(snowage_kappa(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - allocate(snowage_drdt0(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - - if(masterproc) write(iulog,*) 'Attempting to read snow aging parameters .....' - call getfil (fsnowaging, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - if(masterproc) write(iulog,*) subname,trim(fsnowaging) - - ! snow aging parameters - - call ncd_io('tau', snowage_tau, 'read', ncid, posNOTonfile=.true.) - call ncd_io('kappa', snowage_kappa, 'read', ncid, posNOTonfile=.true.) - call ncd_io('drdsdt0', snowage_drdt0, 'read', ncid, posNOTonfile=.true.) - - call ncd_pio_closefile(ncid) - if (masterproc) then - - write(iulog,*) 'Successfully read snow aging properties' - - ! print some diagnostics: - write (iulog,*) 'SNICAR: snowage tau for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_tau(3,11,9) - write (iulog,*) 'SNICAR: snowage kappa for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_kappa(3,11,9) - write (iulog,*) 'SNICAR: snowage dr/dt_0 for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_drdt0(3,11,9) - endif - - end subroutine SnowAge_init - - end module SnowSnicarMod diff --git a/src/biogeophys/SoilFluxesMod.F90 b/src/biogeophys/SoilFluxesMod.F90 deleted file mode 100644 index fefb8e617f..0000000000 --- a/src/biogeophys/SoilFluxesMod.F90 +++ /dev/null @@ -1,461 +0,0 @@ -module SoilFluxesMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Updates surface fluxes based on the new ground temperature. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use perf_mod , only : t_startf, t_stopf - use clm_varctl , only : iulog - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, max_patch_per_col - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use SolarAbsorbedType , only : solarabs_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilFluxes ! Calculate soil/snow and ground temperatures - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilFluxes (bounds, num_urbanl, filter_urbanl, & - num_urbanp, filter_urbanp, & - num_nolakec, filter_nolakec, num_nolakep, filter_nolakep, & - atm2lnd_inst, solarabs_inst, temperature_inst, canopystate_inst, & - waterstate_inst, energyflux_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Update surface fluxes based on the new ground temperature - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varcon , only : hvap, cpair, grav, vkc, tfrz, sb - use landunit_varcon , only : istsoil, istcrop - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv - use subgridAveMod , only : p2c - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - integer , intent(in) :: num_urbanp ! number of urban pfts in clump - integer , intent(in) :: filter_urbanp(:) ! urban pft filter - integer , intent(in) :: num_nolakep ! number of column non-lake points in pft filter - integer , intent(in) :: filter_nolakep(:) ! patch filter for non-lake points - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(temperature_type) , intent(in) :: temperature_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,g,j,pi,l ! indices - integer :: fc,fp ! lake filtered column and pft indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: egsmax(bounds%begc:bounds%endc) ! max. evaporation which soil can provide at one time step - real(r8) :: egirat(bounds%begc:bounds%endc) ! ratio of topsoil_evap_tot : egsmax - real(r8) :: tinc(bounds%begc:bounds%endc) ! temperature difference of two time step - real(r8) :: sumwt(bounds%begc:bounds%endc) ! temporary - real(r8) :: evaprat(bounds%begp:bounds%endp) ! ratio of qflx_evap_soi/topsoil_evap_tot - real(r8) :: save_qflx_evap_soi ! temporary storage for qflx_evap_soi - real(r8) :: topsoil_evap_tot(bounds%begc:bounds%endc) ! column-level total evaporation from top soil layer - real(r8) :: eflx_lwrad_del(bounds%begp:bounds%endp) ! update due to eflx_lwrad - real(r8) :: t_grnd0(bounds%begc:bounds%endc) ! t_grnd of previous time step - real(r8) :: lw_grnd - real(r8) :: fsno_eff - !----------------------------------------------------------------------- - - associate( & - eflx_h2osfc_to_snow_col => energyflux_inst%eflx_h2osfc_to_snow_col , & ! Input: [real(r8) (:) ] col snow melt to h2osfc heat flux (W/m**2) - - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of veg not covered by snow (0/1 now) [-] - - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) (new) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) (new) - - sabg_soil => solarabs_inst%sabg_soil_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) - sabg_snow => solarabs_inst%sabg_snow_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - - emg => temperature_inst%emg_col , & ! Input: [real(r8) (:) ] ground emissivity -! emv => temperature_inst%emv_patch , & ! Input: [real(r8) (:) ] vegetation emissivity -! t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (Kelvin) - t_skin_patch => temperature_inst%t_skin_patch , & ! Output: [real(r8) (:) ] patch skin temperature (K) - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - tssbef => temperature_inst%t_ssbef_col , & ! Input: [real(r8) (:,:) ] soil/snow temperature before update - t_h2osfc_bef => temperature_inst%t_h2osfc_bef_col , & ! Input: [real(r8) (:) ] saved surface water temperature - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - xmf => temperature_inst%xmf_col , & ! Input: [real(r8) (:) ] - xmf_h2osfc => temperature_inst%xmf_h2osfc_col , & ! Input: [real(r8) (:) ] - fact => temperature_inst%fact_col , & ! Input: [real(r8) (:) ] - c_h2osfc => temperature_inst%c_h2osfc_col , & ! Input: [real(r8) (:) ] - - htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of vapor of water (or sublimation) [j/kg] - eflx_building_heat_errsoi=> energyflux_inst%eflx_building_heat_errsoi_col , & ! Input: [real(r8) (:)] heat flux to interior surface of walls and roof for errsoi check (W m-2) - eflx_wasteheat_patch => energyflux_inst%eflx_wasteheat_patch , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_heat_from_ac_patch => energyflux_inst%eflx_heat_from_ac_patch , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_traffic_patch => energyflux_inst%eflx_traffic_patch , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - dlrad => energyflux_inst%dlrad_patch , & ! Input: [real(r8) (:) ] downward longwave radiation below the canopy [W/m2] - ulrad => energyflux_inst%ulrad_patch , & ! Input: [real(r8) (:) ] upward longwave radiation above the canopy [W/m2] - cgrnds => energyflux_inst%cgrnds_patch , & ! Input: [real(r8) (:) ] deriv, of soil sensible heat flux wrt soil temp [w/m2/k] - cgrndl => energyflux_inst%cgrndl_patch , & ! Input: [real(r8) (:) ] deriv of soil latent heat flux wrt soil temp [w/m**2/k] - - qflx_evap_can => waterflux_inst%qflx_evap_can_patch , & ! Output: [real(r8) (:) ] evaporation from leaves and stems (mm H2O/s) (+ = to atm) - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_evap_veg => waterflux_inst%qflx_evap_veg_patch , & ! Output: [real(r8) (:) ] vegetation evaporation (mm H2O/s) (+ = to atm) - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_veg + qflx_tran_veg - qflx_evap_grnd => waterflux_inst%qflx_evap_grnd_patch , & ! Output: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_sub_snow => waterflux_inst%qflx_sub_snow_patch , & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_patch , & ! Output: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_patch , & ! Output: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_ev_snow => waterflux_inst%qflx_ev_snow_patch , & ! In/Out: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] - qflx_ev_soil => waterflux_inst%qflx_ev_soil_patch , & ! In/Out: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - qflx_ev_h2osfc => waterflux_inst%qflx_ev_h2osfc_patch , & ! In/Out: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_sh_veg => energyflux_inst%eflx_sh_veg_patch , & ! Output: [real(r8) (:) ] sensible heat flux from leaves (W/m**2) [+ to atm] - eflx_soil_grnd => energyflux_inst%eflx_soil_grnd_patch , & ! Output: [real(r8) (:) ] soil heat flux (W/m**2) [+ = into soil] - eflx_soil_grnd_u => energyflux_inst%eflx_soil_grnd_u_patch , & ! Output: [real(r8) (:) ] urban soil heat flux (W/m**2) [+ = into soil] - eflx_soil_grnd_r => energyflux_inst%eflx_soil_grnd_r_patch , & ! Output: [real(r8) (:) ] rural soil heat flux (W/m**2) [+ = into soil] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_tot_u => energyflux_inst%eflx_sh_tot_u_patch , & ! Output: [real(r8) (:) ] urban total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_tot_r => energyflux_inst%eflx_sh_tot_r_patch , & ! Output: [real(r8) (:) ] rural total sensible heat flux (W/m**2) [+ to atm] - eflx_lh_tot => energyflux_inst%eflx_lh_tot_patch , & ! Output: [real(r8) (:) ] total latent heat flux (W/m**2) [+ to atm] - eflx_lh_tot_u => energyflux_inst%eflx_lh_tot_u_patch , & ! Output: [real(r8) (:) ] urban total latent heat flux (W/m**2) [+ to atm] - eflx_lh_tot_r => energyflux_inst%eflx_lh_tot_r_patch , & ! Output: [real(r8) (:) ] rural total latent heat flux (W/m**2) [+ to atm] - eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Output: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Output: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_lwrad_net_r => energyflux_inst%eflx_lwrad_net_r_patch , & ! Output: [real(r8) (:) ] rural net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_lwrad_out_r => energyflux_inst%eflx_lwrad_out_r_patch , & ! Output: [real(r8) (:) ] rural emitted infrared (longwave) rad (W/m**2) - eflx_lwrad_net_u => energyflux_inst%eflx_lwrad_net_u_patch , & ! Output: [real(r8) (:) ] urban net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_lwrad_out_u => energyflux_inst%eflx_lwrad_out_u_patch , & ! Output: [real(r8) (:) ] urban emitted infrared (longwave) rad (W/m**2) - eflx_lh_vege => energyflux_inst%eflx_lh_vege_patch , & ! Output: [real(r8) (:) ] veg evaporation heat flux (W/m**2) [+ to atm] - eflx_lh_vegt => energyflux_inst%eflx_lh_vegt_patch , & ! Output: [real(r8) (:) ] veg transpiration heat flux (W/m**2) [+ to atm] - eflx_lh_grnd => energyflux_inst%eflx_lh_grnd_patch , & ! Output: [real(r8) (:) ] ground evaporation heat flux (W/m**2) [+ to atm] - errsoi_col => energyflux_inst%errsoi_col , & ! Output: [real(r8) (:) ] column-level soil/lake energy conservation error (W/m**2) - errsoi_patch => energyflux_inst%errsoi_patch & ! Output: [real(r8) (:) ] patch-level soil/lake energy conservation error (W/m**2) - ) - - ! Get step size - - dtime = get_step_size() - - call t_startf('bgp2_loop_1') - do fc = 1,num_nolakec - c = filter_nolakec(fc) - j = col%snl(c)+1 - - ! Calculate difference in soil temperature from last time step, for - ! flux corrections - - if (col%snl(c) < 0) then - t_grnd0(c) = frac_sno_eff(c) * tssbef(c,col%snl(c)+1) & - + (1 - frac_sno_eff(c) - frac_h2osfc(c)) * tssbef(c,1) & - + frac_h2osfc(c) * t_h2osfc_bef(c) - else - t_grnd0(c) = (1 - frac_h2osfc(c)) * tssbef(c,1) + frac_h2osfc(c) * t_h2osfc_bef(c) - endif - - tinc(c) = t_grnd(c) - t_grnd0(c) - - ! Determine ratio of topsoil_evap_tot - - egsmax(c) = (h2osoi_ice(c,j)+h2osoi_liq(c,j)) / dtime - - ! added to trap very small negative soil water,ice - - if (egsmax(c) < 0._r8) then - egsmax(c) = 0._r8 - end if - end do - - ! A preliminary pft loop to determine if corrections are required for - ! excess evaporation from the top soil layer... Includes new logic - ! to distribute the corrections between patches on the basis of their - ! evaporative demands. - ! egirat holds the ratio of demand to availability if demand is - ! greater than availability, or 1.0 otherwise. - ! Correct fluxes to present soil temperature - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - eflx_sh_grnd(p) = eflx_sh_grnd(p) + tinc(c)*cgrnds(p) - qflx_evap_soi(p) = qflx_evap_soi(p) + tinc(c)*cgrndl(p) - - ! set ev_snow, ev_soil for urban landunits here - l = patch%landunit(p) - if (lun%urbpoi(l)) then - qflx_ev_snow(p) = qflx_evap_soi(p) - qflx_ev_soil(p) = 0._r8 - qflx_ev_h2osfc(p) = 0._r8 - else - qflx_ev_snow(p) = qflx_ev_snow(p) + tinc(c)*cgrndl(p) - qflx_ev_soil(p) = qflx_ev_soil(p) + tinc(c)*cgrndl(p) - qflx_ev_h2osfc(p) = qflx_ev_h2osfc(p) + tinc(c)*cgrndl(p) - endif - end do - - ! Set the column-average qflx_evap_soi as the weighted average over all patches - ! but only count the patches that are evaporating - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - topsoil_evap_tot(c) = 0._r8 - sumwt(c) = 0._r8 - end do - - do pi = 1,max_patch_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - topsoil_evap_tot(c) = topsoil_evap_tot(c) + qflx_evap_soi(p) * patch%wtcol(p) - end if - end if - end do - end do - call t_stopf('bgp2_loop_1') - call t_startf('bgp2_loop_2') - - ! Calculate ratio for rescaling patch-level fluxes to meet availability - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (topsoil_evap_tot(c) > egsmax(c)) then - egirat(c) = (egsmax(c)/topsoil_evap_tot(c)) - else - egirat(c) = 1.0_r8 - end if - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - j = col%snl(c)+1 - - ! Correct soil fluxes for possible evaporation in excess of top layer water - ! excess energy is added to the sensible heat flux from soil - - if (egirat(c) < 1.0_r8) then - save_qflx_evap_soi = qflx_evap_soi(p) - qflx_evap_soi(p) = qflx_evap_soi(p) * egirat(c) - eflx_sh_grnd(p) = eflx_sh_grnd(p) + (save_qflx_evap_soi - qflx_evap_soi(p))*htvp(c) - qflx_ev_snow(p) = qflx_ev_snow(p) * egirat(c) - qflx_ev_soil(p) = qflx_ev_soil(p) * egirat(c) - qflx_ev_h2osfc(p) = qflx_ev_h2osfc(p) * egirat(c) - end if - - ! Ground heat flux - - if (.not. lun%urbpoi(l)) then - lw_grnd=(frac_sno_eff(c)*tssbef(c,col%snl(c)+1)**4 & - +(1._r8-frac_sno_eff(c)-frac_h2osfc(c))*tssbef(c,1)**4 & - +frac_h2osfc(c)*t_h2osfc_bef(c)**4) - - eflx_soil_grnd(p) = ((1._r8- frac_sno_eff(c))*sabg_soil(p) + frac_sno_eff(c)*sabg_snow(p)) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) & - - emg(c)*sb*lw_grnd - emg(c)*sb*t_grnd0(c)**3*(4._r8*tinc(c)) & - - (eflx_sh_grnd(p)+qflx_evap_soi(p)*htvp(c)) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - eflx_soil_grnd_r(p) = eflx_soil_grnd(p) - end if - else - ! For all urban columns we use the net longwave radiation (eflx_lwrad_net) since - ! the term (emg*sb*tssbef(col%snl+1)**4) is not the upward longwave flux because of - ! interactions between urban columns. - - eflx_lwrad_del(p) = 4._r8*emg(c)*sb*t_grnd0(c)**3*tinc(c) - - ! Include transpiration term because needed for pervious road - ! and wasteheat and traffic flux - eflx_soil_grnd(p) = sabg(p) + dlrad(p) & - - eflx_lwrad_net(p) - eflx_lwrad_del(p) & - - (eflx_sh_grnd(p) + qflx_evap_soi(p)*htvp(c) + qflx_tran_veg(p)*hvap) & - + eflx_wasteheat_patch(p) + eflx_heat_from_ac_patch(p) + eflx_traffic_patch(p) - eflx_soil_grnd_u(p) = eflx_soil_grnd(p) - end if - - ! Total fluxes (vegetation + ground) - - eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) - qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) - eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - eflx_lh_tot_r(p)= eflx_lh_tot(p) - eflx_sh_tot_r(p)= eflx_sh_tot(p) - else if (lun%urbpoi(l)) then - eflx_lh_tot_u(p)= eflx_lh_tot(p) - eflx_sh_tot_u(p)= eflx_sh_tot(p) - end if - - ! Assign ground evaporation to sublimation from soil ice or to dew - ! on snow or ground - - qflx_evap_grnd(p) = 0._r8 - qflx_sub_snow(p) = 0._r8 - qflx_dew_snow(p) = 0._r8 - qflx_dew_grnd(p) = 0._r8 - - if (qflx_ev_snow(p) >= 0._r8) then - ! for evaporation partitioning between liquid evap and ice sublimation, - ! use the ratio of liquid to (liquid+ice) in the top layer to determine split - if ((h2osoi_liq(c,j)+h2osoi_ice(c,j)) > 0.) then - qflx_evap_grnd(p) = max(qflx_ev_snow(p)*(h2osoi_liq(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) - else - qflx_evap_grnd(p) = 0. - end if - qflx_sub_snow(p) = qflx_ev_snow(p) - qflx_evap_grnd(p) - else - if (t_grnd(c) < tfrz) then - qflx_dew_snow(p) = abs(qflx_ev_snow(p)) - else - qflx_dew_grnd(p) = abs(qflx_ev_snow(p)) - end if - end if - - ! Variables needed by history tape - - qflx_evap_can(p) = qflx_evap_veg(p) - qflx_tran_veg(p) - eflx_lh_vege(p) = (qflx_evap_veg(p) - qflx_tran_veg(p)) * hvap - eflx_lh_vegt(p) = qflx_tran_veg(p) * hvap - eflx_lh_grnd(p) = qflx_evap_soi(p) * htvp(c) - - end do - call t_stopf('bgp2_loop_2') - call t_startf('bgp2_loop_3') - - ! Soil Energy balance check - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - errsoi_patch(p) = eflx_soil_grnd(p) - xmf(c) - xmf_h2osfc(c) & - - frac_h2osfc(c)*(t_h2osfc(c)-t_h2osfc_bef(c)) & - *(c_h2osfc(c)/dtime) - errsoi_patch(p) = errsoi_patch(p)+eflx_h2osfc_to_snow_col(c) - ! For urban sunwall, shadewall, and roof columns, the "soil" energy balance check - ! must include the heat flux from the interior of the building. - if (col%itype(c)==icol_sunwall .or. col%itype(c)==icol_shadewall .or. col%itype(c)==icol_roof) then - errsoi_patch(p) = errsoi_patch(p) + eflx_building_heat_errsoi(c) - end if - end do - do j = -nlevsno+1,nlevgrnd - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - - if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then - ! area weight heat absorbed by snow layers - if (j >= col%snl(c)+1 .and. j < 1) errsoi_patch(p) = errsoi_patch(p) & - - frac_sno_eff(c)*(t_soisno(c,j)-tssbef(c,j))/fact(c,j) - if (j >= 1) errsoi_patch(p) = errsoi_patch(p) & - - (t_soisno(c,j)-tssbef(c,j))/fact(c,j) - end if - end do - end do - call t_stopf('bgp2_loop_3') - call t_startf('bgp2_loop_4') - - ! Outgoing long-wave radiation from vegetation + ground - ! For conservation we put the increase of ground longwave to outgoing - ! For urban patches, ulrad=0 and (1-fracveg_nosno)=1, and eflx_lwrad_out and eflx_lwrad_net - ! are calculated in UrbanRadiation. The increase of ground longwave is added directly - ! to the outgoing longwave and the net longwave. - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - j = col%snl(c)+1 - - if (.not. lun%urbpoi(l)) then - lw_grnd=(frac_sno_eff(c)*tssbef(c,col%snl(c)+1)**4 & - +(1._r8-frac_sno_eff(c)-frac_h2osfc(c))*tssbef(c,1)**4 & - +frac_h2osfc(c)*t_h2osfc_bef(c)**4) - - eflx_lwrad_out(p) = ulrad(p) & - + (1-frac_veg_nosno(p))*(1.-emg(c))*forc_lwrad(c) & - + (1-frac_veg_nosno(p))*emg(c)*sb*lw_grnd & - + 4._r8*emg(c)*sb*t_grnd0(c)**3*tinc(c) - - - ! Calculate the skin temperature as a weighted sum of all the surface contributions (surface water table, snow, etc...) - ! Note: This is the bare ground calculation of skin temperature - ! The Urban and Vegetation are done in other place. Urban=Later in this function Veg=CanopyFluxMod -! t_skin_patch(p) = ((1._r8 - emv(p))*(1-frac_veg_nosno(p)) * sqrt(sqrt(lw_grnd))) + emv(p)*t_veg(p) -! if( frac_veg_nosno(p).eq.0 ) then -! t_skin_patch(p) = ((1._r8 - emv(p))*(1-frac_veg_nosno(p)) * sqrt(sqrt(lw_grnd))) + & -! emv(p) * frac_veg_nosno(p) * t_veg(p) -! end if - if(frac_veg_nosno(p).eq.0) t_skin_patch(p) = sqrt(sqrt(lw_grnd)) - - eflx_lwrad_net(p) = eflx_lwrad_out(p) - forc_lwrad(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - eflx_lwrad_net_r(p) = eflx_lwrad_out(p) - forc_lwrad(c) - eflx_lwrad_out_r(p) = eflx_lwrad_out(p) - end if - else - eflx_lwrad_out(p) = eflx_lwrad_out(p) + eflx_lwrad_del(p) - eflx_lwrad_net(p) = eflx_lwrad_net(p) + eflx_lwrad_del(p) - eflx_lwrad_net_u(p) = eflx_lwrad_net_u(p) + eflx_lwrad_del(p) - eflx_lwrad_out_u(p) = eflx_lwrad_out(p) - end if - end do - - ! lake balance for errsoi is not over pft - ! therefore obtain column-level radiative temperature - - call p2c(bounds, num_nolakec, filter_nolakec, & - errsoi_patch(bounds%begp:bounds%endp), & - errsoi_col(bounds%begc:bounds%endc)) - - ! Assign column-level t_soisno(snl+1) to t_skin for each urban pft - do fp = 1, num_urbanp - p = filter_urbanp(fp) - c = patch%column(p) - - t_skin_patch(p) = t_soisno(c,col%snl(c)+1) - - end do - - call t_stopf('bgp2_loop_4') - - end associate - - end subroutine SoilFluxes - -end module SoilFluxesMod - diff --git a/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 b/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 deleted file mode 100644 index 101059da4e..0000000000 --- a/src/biogeophys/SoilHydrologyInitTimeConstMod.F90 +++ /dev/null @@ -1,568 +0,0 @@ -module SoilHydrologyInitTimeConstMod - - !------------------------------------------------------------------------------ - ! DESCRIPTION: - ! Initialize time constant variables for SoilHydrologyType - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use SoilHydrologyType , only : soilhydrology_type - use LandunitType , only : lun - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilHydrologyInitTimeConst - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: initSoilParVIC ! Convert default CLM soil properties to VIC parameters - private :: initCLMVICMap ! Initialize map from VIC to CLM layers - private :: linear_interp ! function for linear interperation - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - ! -contains - - !----------------------------------------------------------------------- - subroutine SoilHydrologyInitTimeConst(bounds, soilhydrology_inst) - ! - ! !USES: - use shr_const_mod , only : shr_const_pi - use shr_spfn_mod , only : shr_spfn_erf - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varctl , only : fsurdat, paramfile, iulog, use_vichydro, soil_layerstruct - use clm_varpar , only : nlevsoifl, toplev_equalspace - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb, nlayer, nlayert - use clm_varcon , only : zsoi, dzsoi, zisoi, spval, nlvic, dzvic, pc, grlnd - use clm_varcon , only : aquifer_water_baseline - use landunit_varcon , only : istwet, istsoil, istdlak, istcrop, istice_mec - use column_varcon , only : icol_shadewall, icol_road_perv, icol_road_imperv, icol_roof, icol_sunwall - use fileutils , only : getfil - use organicFileMod , only : organicrd - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,j,l,g,lev,nlevs - integer :: ivic,ivicstrt,ivicend - real(r8) :: maxslope, slopemax, minslope - real(r8) :: d, fd, dfdd, slope0,slopebeta - real(r8) ,pointer :: tslope(:) - logical :: readvar - type(file_desc_t) :: ncid - character(len=256) :: locfn - real(r8) :: clay,sand ! temporaries - real(r8) :: om_frac ! organic matter fraction - real(r8) :: organic_max ! organic matter (kg/m3) where soil is assumed to act like peat - real(r8) ,pointer :: b2d (:) ! read in - VIC b - real(r8) ,pointer :: ds2d (:) ! read in - VIC Ds - real(r8) ,pointer :: dsmax2d (:) ! read in - VIC Dsmax - real(r8) ,pointer :: ws2d (:) ! read in - VIC Ws - real(r8), pointer :: sandcol (:,:) ! column level sand fraction for calculating VIC parameters - real(r8), pointer :: claycol (:,:) ! column level clay fraction for calculating VIC parameters - real(r8), pointer :: om_fraccol (:,:) ! column level organic matter fraction for calculating VIC parameters - real(r8) ,pointer :: sand3d (:,:) ! read in - soil texture: percent sand - real(r8) ,pointer :: clay3d (:,:) ! read in - soil texture: percent clay - real(r8) ,pointer :: organic3d (:,:) ! read in - organic matter: kg/m3 - real(r8) ,pointer :: zisoifl (:) ! original soil interface depth - real(r8) ,pointer :: zsoifl (:) ! original soil midpoint - real(r8) ,pointer :: dzsoifl (:) ! original soil thickness - !----------------------------------------------------------------------- - ! ----------------------------------------------------------------- - ! Initialize frost table - ! ----------------------------------------------------------------- - - soilhydrology_inst%wa_col(bounds%begc:bounds%endc) = aquifer_water_baseline - soilhydrology_inst%zwt_col(bounds%begc:bounds%endc) = 0._r8 - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (.not. lun%lakpoi(l)) then !not lake - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_perv) then - ! Note that the following hard-coded constants (on the next two lines) - ! seem implicitly related to aquifer_water_baseline - soilhydrology_inst%wa_col(c) = 4800._r8 - soilhydrology_inst%zwt_col(c) = (25._r8 + col%zi(c,nlevsoi)) - soilhydrology_inst%wa_col(c)/0.2_r8 /1000._r8 ! One meter below soil column - else - soilhydrology_inst%wa_col(c) = spval - soilhydrology_inst%zwt_col(c) = spval - end if - ! initialize frost_table, zwt_perched - soilhydrology_inst%zwt_perched_col(c) = spval - soilhydrology_inst%frost_table_col(c) = spval - else - ! Note that the following hard-coded constants (on the next two lines) seem - ! implicitly related to aquifer_water_baseline - soilhydrology_inst%wa_col(c) = 4000._r8 - soilhydrology_inst%zwt_col(c) = (25._r8 + col%zi(c,nlevsoi)) - soilhydrology_inst%wa_col(c)/0.2_r8 /1000._r8 ! One meter below soil column - ! initialize frost_table, zwt_perched to bottom of soil column - soilhydrology_inst%zwt_perched_col(c) = col%zi(c,nlevsoi) - soilhydrology_inst%frost_table_col(c) = col%zi(c,nlevsoi) - end if - end if - end do - - ! Initialize VIC variables - - if (use_vichydro) then - - allocate(b2d (bounds%begg:bounds%endg)) - allocate(ds2d (bounds%begg:bounds%endg)) - allocate(dsmax2d (bounds%begg:bounds%endg)) - allocate(ws2d (bounds%begg:bounds%endg)) - allocate(sandcol (bounds%begc:bounds%endc,1:nlevgrnd )) - allocate(claycol (bounds%begc:bounds%endc,1:nlevgrnd )) - allocate(om_fraccol (bounds%begc:bounds%endc,1:nlevgrnd )) - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - call ncd_io(ncid=ncid, varname='binfl', flag='read', data=b2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: binfl NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='Ds', flag='read', data=ds2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Ds NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='Dsmax', flag='read', data=dsmax2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Dsmax NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='Ws', flag='read', data=ws2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: Ws NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - - !define the depth of VIC soil layers here - nlvic(1) = 3 - nlvic(2) = toplev_equalspace - nlvic(1) - nlvic(3) = nlevsoi - (nlvic(1) + nlvic(2)) - - dzvic(:) = 0._r8 - ivicstrt = 1 - - do ivic = 1,nlayer - ivicend = ivicstrt+nlvic(ivic)-1 - do j = ivicstrt,ivicend - dzvic(ivic) = dzvic(ivic)+dzsoi(j) - end do - ivicstrt = ivicend+1 - end do - - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - soilhydrology_inst%b_infil_col(c) = b2d(g) - soilhydrology_inst%ds_col(c) = ds2d(g) - soilhydrology_inst%dsmax_col(c) = dsmax2d(g) - soilhydrology_inst%Wsvic_col(c) = ws2d(g) - end do - - do c = bounds%begc, bounds%endc - soilhydrology_inst%max_infil_col(c) = spval - soilhydrology_inst%i_0_col(c) = spval - do lev = 1, nlayer - soilhydrology_inst%ice_col(c,lev) = spval - soilhydrology_inst%moist_col(c,lev) = spval - soilhydrology_inst%moist_vol_col(c,lev) = spval - soilhydrology_inst%max_moist_col(c,lev) = spval - soilhydrology_inst%porosity_col(c,lev) = spval - soilhydrology_inst%expt_col(c,lev) = spval - soilhydrology_inst%ksat_col(c,lev) = spval - soilhydrology_inst%phi_s_col(c,lev) = spval - soilhydrology_inst%depth_col(c,lev) = spval - sandcol(c,lev) = spval - claycol(c,lev) = spval - om_fraccol(c,lev) = spval - end do - end do - - allocate(sand3d(bounds%begg:bounds%endg,nlevsoifl)) - allocate(clay3d(bounds%begg:bounds%endg,nlevsoifl)) - allocate(organic3d(bounds%begg:bounds%endg,nlevsoifl)) - - call organicrd(organic3d) - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - call ncd_io(ncid=ncid, varname='PCT_SAND', flag='read', data=sand3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_SAND NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='PCT_CLAY', flag='read', data=clay3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_CLAY NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - - ! Determine organic_max - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='organic_max', flag='read', data=organic_max, readvar=readvar) - if ( .not. readvar ) then - call endrun(msg=' ERROR: organic_max not on param file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - - ! get original soil depths to be used in interpolation of sand and clay - allocate(zsoifl(1:nlevsoifl), zisoifl(0:nlevsoifl), dzsoifl(1:nlevsoifl)) - do j = 1, nlevsoifl - zsoifl(j) = 0.025*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - dzsoifl(1) = 0.5_r8*(zsoifl(1)+zsoifl(2)) !thickness b/n two interfaces - do j = 2,nlevsoifl-1 - dzsoifl(j)= 0.5_r8*(zsoifl(j+1)-zsoifl(j-1)) - enddo - dzsoifl(nlevsoifl) = zsoifl(nlevsoifl)-zsoifl(nlevsoifl-1) - - zisoifl(0) = 0._r8 - do j = 1, nlevsoifl-1 - zisoifl(j) = 0.5_r8*(zsoifl(j)+zsoifl(j+1)) !interface depths - enddo - zisoifl(nlevsoifl) = zsoifl(nlevsoifl) + 0.5_r8*dzsoifl(nlevsoifl) - - if ( masterproc )then - if ( soil_layerstruct /= '10SL_3.5m' ) write(iulog,*) 'Setting clay, sand, organic, in Soil Hydrology for VIC' - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - l = col%landunit(c) - - if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - if (lun%itype(l)==istwet .or. lun%itype(l)==istice_mec) then - ! do nothing - else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then - ! do nothing - else - do lev = 1,nlevgrnd - if ( soil_layerstruct /= '10SL_3.5m' )then - if (lev .eq. 1) then - clay = clay3d(g,1) - sand = sand3d(g,1) - om_frac = organic3d(g,1)/organic_max - else if (lev <= nlevsoi) then - do j = 1,nlevsoifl-1 - if (zisoi(lev) >= zisoifl(j) .AND. zisoi(lev) < zisoifl(j+1)) then - clay = clay3d(g,j+1) - sand = sand3d(g,j+1) - om_frac = organic3d(g,j+1)/organic_max - endif - end do - else - clay = clay3d(g,nlevsoifl) - sand = sand3d(g,nlevsoifl) - om_frac = 0._r8 - endif - else - ! duplicate clay and sand values from 10th soil layer - if (lev <= nlevsoi) then - clay = clay3d(g,lev) - sand = sand3d(g,lev) - om_frac = (organic3d(g,lev)/organic_max)**2._r8 - else - clay = clay3d(g,nlevsoi) - sand = sand3d(g,nlevsoi) - om_frac = 0._r8 - endif - end if - - if (lun%urbpoi(l)) om_frac = 0._r8 - claycol(c,lev) = clay - sandcol(c,lev) = sand - om_fraccol(c,lev) = om_frac - end do - end if - end if ! end of if not lake - - if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - if (lun%urbpoi(l)) then - if (col%itype(c)==icol_sunwall .or. col%itype(c)==icol_shadewall .or. col%itype(c)==icol_roof) then - ! do nothing - else - soilhydrology_inst%depth_col(c, 1:nlayer) = dzvic - soilhydrology_inst%depth_col(c, nlayer+1:nlayert) = col%dz(c, nlevsoi+1:nlevgrnd) - - ! create weights to map soil moisture profiles (10 layer) to 3 layers for VIC hydrology, M.Huang - call initCLMVICMap(c, soilhydrology_inst) - call initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - end if - else - soilhydrology_inst%depth_col(c, 1:nlayer) = dzvic - soilhydrology_inst%depth_col(c, nlayer+1:nlayert) = col%dz(c, nlevsoi+1:nlevgrnd) - - ! create weights to map soil moisture profiles (10 layer) to 3 layers for VIC hydrology, M.Huang - call initCLMVICMap(c, soilhydrology_inst) - call initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - end if - end if ! end of if not lake - - end do ! end of loop over columns - - deallocate(b2d, ds2d, dsmax2d, ws2d) - deallocate(sandcol, claycol, om_fraccol) - deallocate(sand3d, clay3d, organic3d) - deallocate(zisoifl, zsoifl, dzsoifl) - - end if ! end of if use_vichydro - - associate(micro_sigma => col%micro_sigma) - do c = bounds%begc, bounds%endc - - ! determine h2osfc threshold ("fill & spill" concept) - ! set to zero for no h2osfc (w/frac_infclust =large) - - soilhydrology_inst%h2osfc_thresh_col(c) = 0._r8 - if (micro_sigma(c) > 1.e-6_r8 .and. (soilhydrology_inst%h2osfcflag /= 0)) then - d = 0.0 - do p = 1,4 - fd = 0.5*(1.0_r8+shr_spfn_erf(d/(micro_sigma(c)*sqrt(2.0)))) - pc - dfdd = exp(-d**2/(2.0*micro_sigma(c)**2))/(micro_sigma(c)*sqrt(2.0*shr_const_pi)) - d = d - fd/dfdd - enddo - soilhydrology_inst%h2osfc_thresh_col(c) = 0.5*d*(1.0_r8+shr_spfn_erf(d/(micro_sigma(c)*sqrt(2.0)))) + & - micro_sigma(c)/sqrt(2.0*shr_const_pi)*exp(-d**2/(2.0*micro_sigma(c)**2)) - soilhydrology_inst%h2osfc_thresh_col(c) = 1.e3_r8 * soilhydrology_inst%h2osfc_thresh_col(c) !convert to mm from meters - else - soilhydrology_inst%h2osfc_thresh_col(c) = 0._r8 - endif - - if (soilhydrology_inst%h2osfcflag == 0) then - soilhydrology_inst%h2osfc_thresh_col(c) = 0._r8 ! set to zero for no h2osfc (w/frac_infclust =large) - endif - - ! set decay factor - soilhydrology_inst%hkdepth_col(c) = 1._r8/2.5_r8 - - end do - end associate - - end subroutine SoilhydrologyInitTimeConst - - !----------------------------------------------------------------------- - subroutine initSoilParVIC(c, claycol, sandcol, om_fraccol, soilhydrology_inst) - ! - ! !DESCRIPTION: - ! Convert default CLM soil properties to VIC parameters - ! to be used for runoff simulations (added by M. Huang) - ! - ! !USES: - use clm_varpar, only : nlevsoi, nlayert, nlayer - ! - ! !ARGUMENTS: - integer , intent(in) :: c ! column index - real(r8) , pointer :: sandcol(:,:) ! read in - soil texture: percent sand - real(r8) , pointer :: claycol(:,:) ! read in - soil texture: percent clay - real(r8) , pointer :: om_fraccol(:,:) ! read in - organic matter: kg/m3 - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - - ! !LOCAL VARIABLES: - real(r8) :: om_watsat = 0.9_r8 ! porosity of organic soil - real(r8) :: om_hksat = 0.1_r8 ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_tkm = 0.25_r8 ! thermal conductivity of organic soil (Farouki, 1986) [W/m/K] - real(r8) :: om_sucsat = 10.3_r8 ! saturated suction for organic matter (Letts, 2000) - real(r8) :: om_csol = 2.5_r8 ! heat capacity of peat soil *10^6 (J/K m3) (Farouki, 1986) - real(r8) :: om_tkd = 0.05_r8 ! thermal conductivity of dry organic soil (Farouki, 1981) - real(r8) :: om_b = 2.7_r8 ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) - real(r8) :: om_expt = 3._r8+2._r8*2.7_r8 ! soil expt for VIC - real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) - real(r8) :: pc = 0.5_r8 ! percolation threshold - real(r8) :: pcbeta = 0.139_r8 ! percolation exponent - real(r8) :: xksat ! maximum hydraulic conductivity of soil [mm/s] - real(r8) :: perc_frac ! "percolating" fraction of organic soil - real(r8) :: perc_norm ! normalize to 1 when 100% organic soil - real(r8) :: uncon_hksat ! series conductivity of mineral/organic soil - real(r8) :: uncon_frac ! fraction of "unconnected" soil - real(r8) :: temp_sum_frac ! sum of node fractions in each VIC layer - real(r8) :: sandvic(1:nlayert) ! temporary, weighted averaged sand% for VIC layers - real(r8) :: clayvic(1:nlayert) ! temporary, weighted averaged clay% for VIC layers - real(r8) :: om_fracvic(1:nlayert) ! temporary, weighted averaged organic matter fract for VIC layers - integer :: i, j ! indices - !------------------------------------------------------------------------------------------- - - ! soilhydrology_inst%depth_col(:,:) Output: layer depth of upper layer(m) - ! soilhydrology_inst%vic_clm_fract_col(:,:,:) Output: fraction of VIC layers in CLM layers - ! soilhydrology_inst%c_param_col(:) Output: baseflow exponent (Qb) - ! soilhydrology_inst%expt_col(:,:) Output: pore-size distribution related paramter(Q12) - ! soilhydrology_inst%ksat_col(:,:) Output: Saturated hydrologic conductivity (mm/s) - ! soilhydrology_inst%phi_s_col(:,:) Output: soil moisture dissusion parameter - ! soilhydrology_inst%porosity_col(:,:) Output: soil porosity - ! soilhydrology_inst%max_moist_col(:,:) Output: maximum soil moisture (ice + liq) - - ! map parameters between VIC layers and CLM layers - soilhydrology_inst%c_param_col(c) = 2._r8 - - ! map the CLM layers to VIC layers - do i = 1, nlayer - - sandvic(i) = 0._r8 - clayvic(i) = 0._r8 - om_fracvic(i) = 0._r8 - temp_sum_frac = 0._r8 - do j = 1, nlevsoi - sandvic(i) = sandvic(i) + sandcol(c,j) * soilhydrology_inst%vic_clm_fract_col(c,i,j) - clayvic(i) = clayvic(i) + claycol(c,j) * soilhydrology_inst%vic_clm_fract_col(c,i,j) - om_fracvic(i) = om_fracvic(i) + om_fraccol(c,j) * soilhydrology_inst%vic_clm_fract_col(c,i,j) - temp_sum_frac = temp_sum_frac + soilhydrology_inst%vic_clm_fract_col(c,i,j) - end do - - !average soil properties, M.Huang, 08/11/2010 - sandvic(i) = sandvic(i)/temp_sum_frac - clayvic(i) = clayvic(i)/temp_sum_frac - om_fracvic(i) = om_fracvic(i)/temp_sum_frac - - !make sure sand, clay and om fractions are between 0 and 100% - sandvic(i) = min(100._r8 , sandvic(i)) - clayvic(i) = min(100._r8 , clayvic(i)) - om_fracvic(i) = min(100._r8 , om_fracvic(i)) - sandvic(i) = max(0._r8 , sandvic(i)) - clayvic(i) = max(0._r8 , clayvic(i)) - om_fracvic(i) = max(0._r8 , om_fracvic(i)) - - !calculate other parameters based on teh percentages - soilhydrology_inst%porosity_col(c, i) = 0.489_r8 - 0.00126_r8*sandvic(i) - soilhydrology_inst%expt_col(c, i) = 3._r8+ 2._r8*(2.91_r8 + 0.159_r8*clayvic(i)) - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sandvic(i)) ) - - !consider organic matter, M.Huang - soilhydrology_inst%expt_col(c, i) = & - (1._r8 - om_fracvic(i))*soilhydrology_inst%expt_col(c, i) + om_fracvic(i)*om_expt - soilhydrology_inst%porosity_col(c,i) = & - (1._r8 - om_fracvic(i))*soilhydrology_inst%porosity_col(c,i) + om_watsat*om_fracvic(i) - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_fracvic(i) > pc) then - perc_norm=(1._r8 - pc)**(-pcbeta) - perc_frac=perc_norm*(om_fracvic(i) - pc)**pcbeta - else - perc_frac=0._r8 - endif - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac=(1._r8-om_fracvic(i))+(1._r8-perc_frac)*om_fracvic(i) - - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_fracvic(i) < 1._r8) then - uncon_hksat=uncon_frac/((1._r8-om_fracvic(i))/xksat & - +((1._r8-perc_frac)*om_fracvic(i))/om_hksat) - else - uncon_hksat = 0._r8 - end if - - soilhydrology_inst%ksat_col(c,i) = & - uncon_frac*uncon_hksat + (perc_frac*om_fracvic(i))*om_hksat - - soilhydrology_inst%max_moist_col(c,i) = & - soilhydrology_inst%porosity_col(c,i) * soilhydrology_inst%depth_col(c,i) * 1000._r8 !in mm! - - soilhydrology_inst%phi_s_col(c,i) = & - -(exp((1.54_r8 - 0.0095_r8*sandvic(i) + & - 0.0063_r8*(100.0_r8-sandvic(i)-clayvic(i)))*log(10.0_r8))*9.8e-5_r8) - - end do ! end of loop over layers - - end subroutine initSoilParVIC - - !----------------------------------------------------------------------- - subroutine initCLMVICMap(c, soilhydrology_inst) - ! - ! !DESCRIPTION: - ! Calculates mapping between CLM and VIC layers - ! added by AWang, modified by M.Huang for CLM4 - ! NOTE: in CLM h2osoil_liq unit is kg/m2, in VIC moist is mm - ! h2osoi_ice is actually water equavlent ice content. - ! - ! !USES: - use clm_varpar , only : nlevsoi, nlayer - ! - ! !ARGUMENTS: - integer , intent(in) :: c - type(soilhydrology_type), intent(inout) :: soilhydrology_inst - ! - ! !REVISION HISTORY: - ! Created by Maoyi Huang - ! 11/13/2012, Maoyi Huang: rewrite the mapping modules in CLM4VIC - ! - ! !LOCAL VARIABLES - real(r8) :: sum_frac(1:nlayer) ! sum of fraction for each layer - real(r8) :: deltal(1:nlayer+1) ! temporary - real(r8) :: zsum ! temporary - real(r8) :: lsum ! temporary - real(r8) :: temp ! temporary - integer :: i, j, fc - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - depth => soilhydrology_inst%depth_col , & ! Input: [real(r8) (:,:) ] layer depth of VIC (m) - vic_clm_fract => soilhydrology_inst%vic_clm_fract_col & ! Output: [real(r8) (:,:,:) ] fraction of VIC layers in clm layers - ) - - ! set fraction of VIC layer in each CLM layer - - lsum = 0._r8 - do i = 1, nlayer - deltal(i) = depth(c,i) - end do - do i = 1, nlayer - zsum = 0._r8 - sum_frac(i) = 0._r8 - do j = 1, nlevsoi - if( (zsum < lsum) .and. (zsum + dz(c,j) >= lsum )) then - call linear_interp(lsum, temp, zsum, zsum + dz(c,j), 0._r8, 1._r8) - vic_clm_fract(c,i,j) = 1._r8 - temp - if(lsum + deltal(i) < zsum + dz(c,j)) then - call linear_interp(lsum + deltal(i), temp, zsum, zsum + dz(c,j), 1._r8, 0._r8) - vic_clm_fract(c,i,j) = vic_clm_fract(c,i,j) - temp - end if - else if( (zsum < lsum + deltal(i)) .and. (zsum + dz(c,j) >= lsum + deltal(i)) ) then - call linear_interp(lsum + deltal(i), temp, zsum, zsum + dz(c,j), 0._r8, 1._r8) - vic_clm_fract(c,i,j) = temp - if(zsum<=lsum) then - call linear_interp(lsum, temp, zsum, zsum + dz(c,j), 0._r8, 1._r8) - vic_clm_fract(c,i,j) = vic_clm_fract(c,i,j) - temp - end if - else if( (zsum >= lsum .and. zsum + dz(c,j) <= lsum + deltal(i)) ) then - vic_clm_fract(c,i,j) = 1._r8 - else - vic_clm_fract(c,i,j) = 0._r8 - end if - zsum = zsum + dz(c,j) - sum_frac(i) = sum_frac(i) + vic_clm_fract(c,i,j) - end do ! end CLM layer calculation - lsum = lsum + deltal(i) - end do ! end VIC layer calcultion - - end associate - - end subroutine initCLMVICMap - - !------------------------------------------------------------------- - subroutine linear_interp(x,y, x0, x1, y0, y1) - ! - ! !DESCRIPTION: - ! Provides linear interpolation - ! - ! !ARGUMENTS: - real(r8), intent(in) :: x, x0, y0, x1, y1 - real(r8), intent(out) :: y - !------------------------------------------------------------------- - - y = y0 + (x - x0) * (y1 - y0) / (x1 - x0) - - end subroutine linear_interp - -end module SoilHydrologyInitTimeConstMod diff --git a/src/biogeophys/SoilHydrologyMod.F90 b/src/biogeophys/SoilHydrologyMod.F90 deleted file mode 100644 index 7f9b4ed08a..0000000000 --- a/src/biogeophys/SoilHydrologyMod.F90 +++ /dev/null @@ -1,2337 +0,0 @@ -module SoilHydrologyMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate soil hydrology - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varctl , only : iulog, use_vichydro - use clm_varcon , only : e_ice, denh2o, denice, rpi, aquifer_water_baseline - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use TemperatureType , only : temperature_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilHydReadNML ! Read in the Soil hydrology namelist - public :: SurfaceRunoff ! Calculate surface runoff - public :: Infiltration ! Calculate infiltration into surface soil layer - public :: WaterTable ! Calculate water table before imposing drainage - public :: Drainage ! Calculate subsurface drainage - public :: CLMVICMap - public :: PerchedWaterTable ! Calculate perched water table - public :: PerchedLateralFlow ! Calculate lateral flow from perched saturated zone - public :: ThetaBasedWaterTable ! Calculate water table from soil moisture state - public :: LateralFlowPowerLaw ! Calculate lateral flow based on power law drainage function - public :: RenewCondensation ! Misc. corrections - - !----------------------------------------------------------------------- - real(r8), private :: baseflow_scalar = 1.e-2_r8 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine soilHydReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for soil hydrology - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'soilHydReadNML' - character(len=*), parameter :: nmlname = 'soilhydrology_inparm' - !----------------------------------------------------------------------- - namelist /soilhydrology_inparm/ baseflow_scalar - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=soilhydrology_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (baseflow_scalar, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=soilhydrology_inparm) - write(iulog,*) ' ' - end if - - end subroutine soilhydReadNML - - !----------------------------------------------------------------------- - subroutine SurfaceRunoff (bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, waterflux_inst, & - waterstate_inst) - ! - ! !DESCRIPTION: - ! Calculate surface runoff - ! - ! !USES: - use clm_varcon , only : denice, denh2o, wimp, pondmx_urban - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_imperv, icol_road_perv - use clm_varpar , only : nlevsoi, maxpatch_pft - use clm_time_manager, only : get_step_size - use clm_varpar , only : nlayer, nlayert - use abortutils , only : endrun - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,fc,g,l,i !indices - real(r8) :: dtime !land model time step (sec) - real(r8) :: xs(bounds%begc:bounds%endc) !excess soil water above urban ponding limit - real(r8) :: vol_ice(bounds%begc:bounds%endc,1:nlevsoi) !partial volume of ice lens in layer - real(r8) :: fff(bounds%begc:bounds%endc) !decay factor (m-1) - real(r8) :: s1 !variable to calculate qinmax - real(r8) :: su !variable to calculate qinmax - real(r8) :: v !variable to calculate qinmax - real(r8) :: qinmax !maximum infiltration capacity (mm/s) - real(r8) :: A(bounds%begc:bounds%endc) !fraction of the saturated area - real(r8) :: ex(bounds%begc:bounds%endc) !temporary variable (exponent) - real(r8) :: top_moist(bounds%begc:bounds%endc) !temporary, soil moisture in top VIC layers - real(r8) :: top_max_moist(bounds%begc:bounds%endc) !temporary, maximum soil moisture in top VIC layers - real(r8) :: top_ice(bounds%begc:bounds%endc) !temporary, ice len in top VIC layers - character(len=32) :: subname = 'SurfaceRunoff' !subroutine name - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] minus number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - wtfact => soilstate_inst%wtfact_col , & ! Input: [real(r8) (:) ] maximum saturated fraction for a gridcell - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - - qflx_snow_h2osfc => waterflux_inst%qflx_snow_h2osfc_col , & ! Input: [real(r8) (:) ] snow falling on surface water (mm/s) - qflx_floodc => waterflux_inst%qflx_floodc_col , & ! Input: [real(r8) (:) ] column flux of flood water from RTM - qflx_evap_grnd => waterflux_inst%qflx_evap_grnd_col , & ! Input: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_top_soil => waterflux_inst%qflx_top_soil_col , & ! Output: [real(r8) (:) ] net water input into soil from top (mm/s) - qflx_surf => waterflux_inst%qflx_surf_col , & ! Output: [real(r8) (:) ] surface runoff (mm H2O /s) - - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - max_moist => soilhydrology_inst%max_moist_col , & ! Input: [real(r8) (:,:) ] maximum soil moisture (ice + liq, mm) - frost_table => soilhydrology_inst%frost_table_col , & ! Input: [real(r8) (:) ] frost table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Input: [real(r8) (:) ] perched water table depth (m) - b_infil => soilhydrology_inst%b_infil_col , & ! Input: [real(r8) (:) ] VIC b infiltration parameter - moist => soilhydrology_inst%moist_col , & ! Input: [real(r8) (:,:) ] soil moisture in each VIC layers (liq, mm) - hkdepth => soilhydrology_inst%hkdepth_col , & ! Input: [real(r8) (:) ] decay factor (m) - origflag => soilhydrology_inst%origflag , & ! Input: logical - fcov => soilhydrology_inst%fcov_col , & ! Output: [real(r8) (:) ] fractional impermeable area - fsat => soilhydrology_inst%fsat_col , & ! Output: [real(r8) (:) ] fractional area with water table at surface - fracice => soilhydrology_inst%fracice_col , & ! Output: [real(r8) (:,:) ] fractional impermeability (-) - icefrac => soilhydrology_inst%icefrac_col , & ! Output: [real(r8) (:,:) ] - ice => soilhydrology_inst%ice_col , & ! Output: [real(r8) (:,:) ] ice len in each VIC layers(ice, mm) - max_infil => soilhydrology_inst%max_infil_col , & ! Output: [real(r8) (:) ] maximum infiltration capacity in VIC (mm) - i_0 => soilhydrology_inst%i_0_col & ! Output: [real(r8) (:) ] column average soil moisture in top VIC layers (mm) - ) - - ! Get time step - - dtime = get_step_size() - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Porosity of soil, partial volume of ice and liquid, fraction of ice in each layer, - ! fractional impermeability - - vol_ice(c,j) = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - if (origflag == 1) then - icefrac(c,j) = min(1._r8,h2osoi_ice(c,j)/(h2osoi_ice(c,j)+h2osoi_liq(c,j))) - else - icefrac(c,j) = min(1._r8,vol_ice(c,j)/watsat(c,j)) - endif - - fracice(c,j) = max(0._r8,exp(-3._r8*(1._r8-icefrac(c,j)))- exp(-3._r8))/(1.0_r8-exp(-3._r8)) - end do - end do - - ! Saturated fraction - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - fff(c) = 0.5_r8 - if (use_vichydro) then - top_moist(c) = 0._r8 - top_ice(c) = 0._r8 - top_max_moist(c) = 0._r8 - do j = 1, nlayer - 1 - top_ice(c) = top_ice(c) + ice(c,j) - top_moist(c) = top_moist(c) + moist(c,j) + ice(c,j) - top_max_moist(c) = top_max_moist(c) + max_moist(c,j) - end do - if(top_moist(c)> top_max_moist(c)) top_moist(c)= top_max_moist(c) - top_ice(c) = max(0._r8,top_ice(c)) - max_infil(c) = (1._r8+b_infil(c)) * top_max_moist(c) - ex(c) = b_infil(c) / (1._r8 + b_infil(c)) - A(c) = 1._r8 - (1._r8 - top_moist(c) / top_max_moist(c))**ex(c) - i_0(c) = max_infil(c) * (1._r8 - (1._r8 - A(c))**(1._r8/b_infil(c))) - fsat(c) = A(c) !for output - else - fsat(c) = wtfact(c) * exp(-0.5_r8*fff(c)*zwt(c)) - end if - - ! use perched water table to determine fsat (if present) - if ( frost_table(c) > zwt(c)) then - if (use_vichydro) then - fsat(c) = A(c) - else - fsat(c) = wtfact(c) * exp(-0.5_r8*fff(c)*zwt(c)) - end if - else - if ( frost_table(c) > zwt_perched(c)) then - fsat(c) = wtfact(c) * exp(-0.5_r8*fff(c)*zwt_perched(c))!*( frost_table(c) - zwt_perched(c))/4.0 - endif - endif - if (origflag == 1) then - if (use_vichydro) then - call endrun(msg="VICHYDRO is not available for origflag=1"//errmsg(sourcefile, __LINE__)) - else - fcov(c) = (1._r8 - fracice(c,1)) * fsat(c) + fracice(c,1) - end if - else - fcov(c) = fsat(c) - endif - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! assume qinmax large relative to qflx_top_soil in control - if (origflag == 1) then - qflx_surf(c) = fcov(c) * qflx_top_soil(c) - else - ! only send fast runoff directly to streams - qflx_surf(c) = fsat(c) * qflx_top_soil(c) - endif - end do - - ! Determine water in excess of ponding limit for urban roof and impervious road. - ! Excess goes to surface runoff. No surface runoff for sunwall and shadewall. - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - - ! If there are snow layers then all qflx_top_soil goes to surface runoff - if (snl(c) < 0) then - qflx_surf(c) = max(0._r8,qflx_top_soil(c)) - else - xs(c) = max(0._r8, & - h2osoi_liq(c,1)/dtime + qflx_top_soil(c) - qflx_evap_grnd(c) - & - pondmx_urban/dtime) - if (xs(c) > 0.) then - h2osoi_liq(c,1) = pondmx_urban - else - h2osoi_liq(c,1) = max(0._r8,h2osoi_liq(c,1)+ & - (qflx_top_soil(c)-qflx_evap_grnd(c))*dtime) - end if - qflx_surf(c) = xs(c) - end if - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - qflx_surf(c) = 0._r8 - end if - ! send flood water flux to runoff for all urban columns - qflx_surf(c) = qflx_surf(c) + qflx_floodc(c) - - end do - - ! remove stormflow and snow on h2osfc from qflx_top_soil - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - ! add flood water flux to qflx_top_soil - qflx_top_soil(c) = qflx_top_soil(c) + qflx_snow_h2osfc(c) + qflx_floodc(c) - end do - - end associate - - end subroutine SurfaceRunoff - - !----------------------------------------------------------------------- - subroutine Infiltration(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - energyflux_inst, soilhydrology_inst, soilstate_inst, temperature_inst, & - waterflux_inst, waterstate_inst) - ! - ! !DESCRIPTION: - ! Calculate infiltration into surface soil layer (minus the evaporation) - ! - ! !USES: - use shr_const_mod , only : shr_const_pi - use clm_varpar , only : nlayer, nlayert - use clm_varpar , only : nlevsoi - use clm_varcon , only : denh2o, denice, roverg, wimp, pc, mu, tfrz - use column_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, icol_road_perv - use landunit_varcon , only : istsoil, istcrop - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - type(energyflux_type) , intent(in) :: energyflux_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,l,fc ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: s1,su,v ! variable to calculate qinmax - real(r8) :: qinmax ! maximum infiltration capacity (mm/s) - real(r8) :: vol_ice(bounds%begc:bounds%endc,1:nlevsoi) ! partial volume of ice lens in layer - real(r8) :: alpha_evap(bounds%begc:bounds%endc) ! fraction of total evap from h2osfc - real(r8) :: qflx_evap(bounds%begc:bounds%endc) ! local evaporation array - real(r8) :: qflx_h2osfc_drain(bounds%begc:bounds%endc) ! bottom drainage from h2osfc - real(r8) :: qflx_in_h2osfc(bounds%begc:bounds%endc) ! surface input to h2osfc - real(r8) :: qflx_in_soil(bounds%begc:bounds%endc) ! surface input to soil - real(r8) :: qflx_infl_excess(bounds%begc:bounds%endc) ! infiltration excess runoff -> h2osfc - real(r8) :: frac_infclust ! fraction of submerged area that is connected - real(r8) :: fsno ! copy of frac_sno - real(r8) :: k_wet ! linear reservoir coefficient for h2osfc - real(r8) :: fac ! soil wetness of surface layer - real(r8) :: psit ! negative potential of soil - real(r8) :: hr ! relative humidity - real(r8) :: wx ! partial volume of ice and water of surface layer - real(r8) :: z_avg - real(r8) :: rho_avg - real(r8) :: fmelt - real(r8) :: f_sno - real(r8) :: imped - real(r8) :: d - real(r8) :: h2osoi_vol - real(r8) :: basis ! temporary, variable soil moisture holding capacity - ! in top VIC layers for runoff calculation - real(r8) :: rsurf_vic ! temp VIC surface runoff - real(r8) :: top_moist(bounds%begc:bounds%endc) ! temporary, soil moisture in top VIC layers - real(r8) :: top_max_moist(bounds%begc:bounds%endc) ! temporary, maximum soil moisture in top VIC layers - real(r8) :: top_ice(bounds%begc:bounds%endc) ! temporary, ice len in top VIC layers - real(r8) :: top_icefrac ! temporary, ice fraction in top VIC layers - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] minus number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - frac_h2osfc_nosnow => waterstate_inst%frac_h2osfc_nosnow_col, & ! Output: [real(r8) (:) ] col fractional area with surface water greater than zero (if no snow present) - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osfc => waterstate_inst%h2osfc_col , & ! Output: [real(r8) (:) ] surface water (mm) - - qflx_ev_soil => waterflux_inst%qflx_ev_soil_col , & ! Input: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - qflx_evap_soi => waterflux_inst%qflx_evap_soi_col , & ! Input: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_evap_grnd => waterflux_inst%qflx_evap_grnd_col , & ! Input: [real(r8) (:) ] ground surface evaporation rate (mm H2O/s) [+] - qflx_top_soil => waterflux_inst%qflx_top_soil_col , & ! Input: [real(r8) (:) ] net water input into soil from top (mm/s) - qflx_ev_h2osfc => waterflux_inst%qflx_ev_h2osfc_col , & ! Input: [real(r8) (:) ] evaporation flux from h2osfc (mm H2O/s) [+ to atm] - qflx_surf => waterflux_inst%qflx_surf_col , & ! Output: [real(r8) (:) ] surface runoff (mm H2O /s) - qflx_h2osfc_surf => waterflux_inst%qflx_h2osfc_surf_col , & ! Output: [real(r8) (:) ] surface water runoff (mm/s) - qflx_infl => waterflux_inst%qflx_infl_col , & ! Output: [real(r8) (:) ] infiltration (mm H2O /s) - - smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Output: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - - h2osfc_thresh => soilhydrology_inst%h2osfc_thresh_col, & ! Input: [real(r8) (:) ] level at which h2osfc "percolates" - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Input: [real(r8) (:) ] perched water table depth (m) - fcov => soilhydrology_inst%fcov_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface - b_infil => soilhydrology_inst%b_infil_col , & ! Input: [real(r8) (:) ] VIC b infiltration parameter - frost_table => soilhydrology_inst%frost_table_col , & ! Input: [real(r8) (:) ] frost table depth (m) - fsat => soilhydrology_inst%fsat_col , & ! Input: [real(r8) (:) ] fractional area with water table at surface - moist => soilhydrology_inst%moist_col , & ! Input: [real(r8) (:,:) ] soil moisture in each VIC layers (liq, mm) - max_moist => soilhydrology_inst%max_moist_col , & ! Input: [real(r8) (:,:) ] maximum soil moisture (ice + liq, mm) - max_infil => soilhydrology_inst%max_infil_col , & ! Input: [real(r8) (:) ] maximum infiltration capacity in VIC (mm) - ice => soilhydrology_inst%ice_col , & ! Input: [real(r8) (:,:) ] ice len in each VIC layers(ice, mm) - i_0 => soilhydrology_inst%i_0_col , & ! Input: [real(r8) (:) ] column average soil moisture in top VIC layers (mm) - h2osfcflag => soilhydrology_inst%h2osfcflag , & ! Input: logical - icefrac => soilhydrology_inst%icefrac_col & ! Output: [real(r8) (:,:) ] fraction of ice - ) - - dtime = get_step_size() - - ! Infiltration into surface soil layer (minus the evaporation) - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - ! Porosity of soil, partial volume of ice and liquid - vol_ice(c,j) = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - eff_porosity(c,j) = max(0.01_r8,watsat(c,j)-vol_ice(c,j)) - icefrac(c,j) = min(1._r8,vol_ice(c,j)/watsat(c,j)) - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - ! partition moisture fluxes between soil and h2osfc - if (lun%itype(col%landunit(c)) == istsoil .or. lun%itype(col%landunit(c))==istcrop) then - - ! explicitly use frac_sno=0 if snl=0 - if (snl(c) >= 0) then - fsno=0._r8 - ! if no snow layers, sublimation is removed from h2osoi_ice in drainage - qflx_evap(c)=qflx_evap_grnd(c) - else - fsno=frac_sno(c) - qflx_evap(c)=qflx_ev_soil(c) - endif - - !1. partition surface inputs between soil and h2osfc - qflx_in_soil(c) = (1._r8 - frac_h2osfc(c)) * (qflx_top_soil(c) - qflx_surf(c)) - qflx_in_h2osfc(c) = frac_h2osfc(c) * (qflx_top_soil(c) - qflx_surf(c)) - - !2. remove evaporation (snow treated in SnowHydrology) - qflx_in_soil(c) = qflx_in_soil(c) - (1.0_r8 - fsno - frac_h2osfc(c))*qflx_evap(c) - qflx_in_h2osfc(c) = qflx_in_h2osfc(c) - frac_h2osfc(c) * qflx_ev_h2osfc(c) - - !3. determine maximum infiltration rate - if (use_vichydro) then - top_moist(c)= 0._r8 - top_ice(c)=0._r8 - top_max_moist(c)= 0._r8 - do j = 1, nlayer - 1 - top_ice(c) = top_ice(c) + ice(c,j) - top_moist(c) = top_moist(c) + moist(c,j) + ice(c,j) - top_max_moist(c) = top_max_moist(c) + max_moist(c,j) - end do - top_icefrac = min(1._r8,top_ice(c)/top_max_moist(c)) - if(qflx_in_soil(c) <= 0._r8) then - rsurf_vic = 0._r8 - else if(max_infil(c) <= 0._r8) then - rsurf_vic = qflx_in_soil(c) - else if((i_0(c) + qflx_in_soil(c)*dtime) > max_infil(c)) then !(Eq.(3a) Wood et al. 1992) - rsurf_vic = (qflx_in_soil(c)*dtime - top_max_moist(c) + top_moist(c))/dtime - else !(Eq.(3b) Wood et al. 1992) - basis = 1._r8 - (i_0(c) + qflx_in_soil(c)*dtime)/max_infil(c) - rsurf_vic = (qflx_in_soil(c)*dtime - top_max_moist(c) + top_moist(c) & - + top_max_moist(c) * basis**(1._r8 + b_infil(c)))/dtime - end if - rsurf_vic = min(qflx_in_soil(c), rsurf_vic) - qinmax = (1._r8 - fsat(c)) * 10._r8**(-e_ice*top_icefrac)*(qflx_in_soil(c) - rsurf_vic) - else - qinmax=(1._r8 - fsat(c)) * minval(10._r8**(-e_ice*(icefrac(c,1:3)))*hksat(c,1:3)) - end if - qflx_infl_excess(c) = max(0._r8,qflx_in_soil(c) - (1.0_r8 - frac_h2osfc(c))*qinmax) - - !4. soil infiltration and h2osfc "run-on" - qflx_infl(c) = qflx_in_soil(c) - qflx_infl_excess(c) - qflx_in_h2osfc(c) = qflx_in_h2osfc(c) + qflx_infl_excess(c) - - !5. surface runoff from h2osfc - if (h2osfcflag==1) then - ! calculate runoff from h2osfc ------------------------------------- - if (frac_h2osfc_nosnow(c) <= pc) then - frac_infclust=0.0_r8 - else - frac_infclust=(frac_h2osfc_nosnow(c)-pc)**mu - endif - endif - - ! limit runoff to value of storage above S(pc) - if(h2osfc(c) >= h2osfc_thresh(c) .and. h2osfcflag/=0) then - ! spatially variable k_wet - k_wet=1.0e-4_r8 * sin((rpi/180.) * col%topo_slope(c)) - qflx_h2osfc_surf(c) = k_wet * frac_infclust * (h2osfc(c) - h2osfc_thresh(c)) - - qflx_h2osfc_surf(c)=min(qflx_h2osfc_surf(c),(h2osfc(c) - h2osfc_thresh(c))/dtime) - else - qflx_h2osfc_surf(c)= 0._r8 - endif - - ! cutoff lower limit - if ( qflx_h2osfc_surf(c) < 1.0e-8) qflx_h2osfc_surf(c) = 0._r8 - - ! use this for non-h2osfc code - if(h2osfcflag==0) then - qflx_h2osfc_surf(c)= 0._r8 - ! shift infiltration excess from h2osfc input to surface runoff - qflx_in_h2osfc(c) = qflx_in_h2osfc(c) - qflx_infl_excess(c) - qflx_surf(c)= qflx_surf(c) + qflx_infl_excess(c) - qflx_infl_excess(c) = 0._r8 - endif - - qflx_in_h2osfc(c) = qflx_in_h2osfc(c) - qflx_h2osfc_surf(c) - - !6. update h2osfc prior to calculating bottom drainage from h2osfc - h2osfc(c) = h2osfc(c) + qflx_in_h2osfc(c) * dtime - - !-- if all water evaporates, there will be no bottom drainage - if (h2osfc(c) < 0.0) then - qflx_infl(c) = qflx_infl(c) + h2osfc(c)/dtime - h2osfc(c) = 0.0 - qflx_h2osfc_drain(c)= 0._r8 - else - qflx_h2osfc_drain(c)=min(frac_h2osfc(c)*qinmax,h2osfc(c)/dtime) - endif - - if(h2osfcflag==0) then - qflx_h2osfc_drain(c)= max(0._r8,h2osfc(c)/dtime) !ensure no h2osfc - endif - - !7. remove drainage from h2osfc and add to qflx_infl - h2osfc(c) = h2osfc(c) - qflx_h2osfc_drain(c) * dtime - qflx_infl(c) = qflx_infl(c) + qflx_h2osfc_drain(c) - else - ! non-vegetated landunits (i.e. urban) use original CLM4 code - if (snl(c) >= 0) then - ! when no snow present, sublimation is removed in Drainage - qflx_infl(c) = qflx_top_soil(c) - qflx_surf(c) - qflx_evap_grnd(c) - else - qflx_infl(c) = qflx_top_soil(c) - qflx_surf(c) & - - (1.0_r8 - frac_sno(c)) * qflx_ev_soil(c) - end if - qflx_h2osfc_surf(c) = 0._r8 - endif - - enddo - - ! No infiltration for impervious urban surfaces - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (col%itype(c) /= icol_road_perv) then - qflx_infl(c) = 0._r8 - end if - end do - - end associate - - end subroutine Infiltration - - !----------------------------------------------------------------------- - subroutine WaterTable(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - soilhydrology_inst, soilstate_inst, temperature_inst, waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate watertable, considering aquifer recharge but no drainage. - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varcon , only : pondmx, tfrz, watmin,denice,denh2o - use clm_varpar , only : nlevsoi - use column_varcon , only : icol_roof, icol_road_imperv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,fc,i ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: xs(bounds%begc:bounds%endc) ! water needed to bring soil moisture to watmin (mm) - real(r8) :: dzmm(bounds%begc:bounds%endc,1:nlevsoi) ! layer thickness (mm) - integer :: jwt(bounds%begc:bounds%endc) ! index of the soil layer right above the water table (-) - real(r8) :: rsub_bot(bounds%begc:bounds%endc) ! subsurface runoff - bottom drainage (mm/s) - real(r8) :: rsub_top(bounds%begc:bounds%endc) ! subsurface runoff - topographic control (mm/s) - real(r8) :: fff(bounds%begc:bounds%endc) ! decay factor (m-1) - real(r8) :: xsi(bounds%begc:bounds%endc) ! excess soil water above saturation at layer i (mm) - real(r8) :: rous ! aquifer yield (-) - real(r8) :: wh ! smpfz(jwt)-z(jwt) (mm) - real(r8) :: ws ! summation of pore space of layers below water table (mm) - real(r8) :: s_node ! soil wetness (-) - real(r8) :: dzsum ! summation of dzmm of layers below water table (mm) - real(r8) :: icefracsum ! summation of icefrac*dzmm of layers below water table (-) - real(r8) :: fracice_rsub(bounds%begc:bounds%endc) ! fractional impermeability of soil layers (-) - real(r8) :: ka ! hydraulic conductivity of the aquifer (mm/s) - real(r8) :: dza ! fff*(zwt-z(jwt)) (-) - real(r8) :: available_h2osoi_liq ! available soil liquid water in a layer - real(r8) :: imped - real(r8) :: rsub_top_tot - real(r8) :: rsub_top_layer - real(r8) :: qcharge_tot - real(r8) :: qcharge_layer - real(r8) :: theta_unsat - real(r8) :: f_unsat - real(r8) :: s_y - integer :: k,k_frz,k_perch - real(r8) :: sat_lev - real(r8) :: s1 - real(r8) :: s2 - real(r8) :: m - real(r8) :: b - real(r8) :: q_perch - real(r8) :: q_perch_max - real(r8) :: dflag=0._r8 - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] - - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_col , & ! Input: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_col , & ! Input: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - - zwt => soilhydrology_inst%zwt_col , & ! Output: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Output: [real(r8) (:) ] perched water table depth (m) - frost_table => soilhydrology_inst%frost_table_col , & ! Output: [real(r8) (:) ] frost table depth (m) - wa => soilhydrology_inst%wa_col , & ! Output: [real(r8) (:) ] water in the unconfined aquifer (mm) - qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) - origflag => soilhydrology_inst%origflag , & ! Input: logical - - qflx_sub_snow => waterflux_inst%qflx_sub_snow_col , & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_drain => waterflux_inst%qflx_drain_col , & ! Output: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Output: [real(r8) (:) ] perched wt sub-surface runoff (mm H2O /s) - qflx_rsub_sat => waterflux_inst%qflx_rsub_sat_col & ! Output: [real(r8) (:) ] soil saturation excess [mm h2o/s] - ) - - ! Get time step - - dtime = get_step_size() - - ! Convert layer thicknesses from m to mm - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - dzmm(c,j) = dz(c,j)*1.e3_r8 - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qflx_drain(c) = 0._r8 - qflx_rsub_sat(c) = 0._r8 - qflx_drain_perched(c) = 0._r8 - end do - - ! The layer index of the first unsaturated layer, i.e., the layer right above - ! the water table - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - jwt(c) = nlevsoi - ! allow jwt to equal zero when zwt is in top layer - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - end do - - !============================== QCHARGE ========================================= - ! Water table changes due to qcharge - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! use analytical expression for aquifer specific yield - rous = watsat(c,nlevsoi) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,nlevsoi))**(-1./bsw(c,nlevsoi))) - rous=max(rous,0.02_r8) - - !-- water table is below the soil column -------------------------------------- - if(jwt(c) == nlevsoi) then - wa(c) = wa(c) + qcharge(c) * dtime - zwt(c) = zwt(c) - (qcharge(c) * dtime)/1000._r8/rous - else - !-- water table within soil layers 1-9 ------------------------------------- - ! try to raise water table to account for qcharge - qcharge_tot = qcharge(c) * dtime - if(qcharge_tot > 0.) then !rising water table - do j = jwt(c)+1, 1,-1 - ! use analytical expression for specific yield - s_y = watsat(c,j) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,j))**(-1./bsw(c,j))) - s_y=max(s_y,0.02_r8) - - qcharge_layer=min(qcharge_tot,(s_y*(zwt(c) - zi(c,j-1))*1.e3)) - qcharge_layer=max(qcharge_layer,0._r8) - - if(s_y > 0._r8) zwt(c) = zwt(c) - qcharge_layer/s_y/1000._r8 - - qcharge_tot = qcharge_tot - qcharge_layer - if (qcharge_tot <= 0.) exit - enddo - else ! deepening water table (negative qcharge) - do j = jwt(c)+1, nlevsoi - ! use analytical expression for specific yield - s_y = watsat(c,j) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,j))**(-1./bsw(c,j))) - s_y=max(s_y,0.02_r8) - - qcharge_layer=max(qcharge_tot,-(s_y*(zi(c,j) - zwt(c))*1.e3)) - qcharge_layer=min(qcharge_layer,0._r8) - qcharge_tot = qcharge_tot - qcharge_layer - if (qcharge_tot >= 0.) then - zwt(c) = zwt(c) - qcharge_layer/s_y/1000._r8 - exit - else - zwt(c) = zi(c,j) - endif - - enddo - if (qcharge_tot > 0.) zwt(c) = zwt(c) - qcharge_tot/1000._r8/rous - endif - - !-- recompute jwt for following calculations --------------------------------- - ! allow jwt to equal zero when zwt is in top layer - jwt(c) = nlevsoi - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - endif - enddo - - - !== BASEFLOW ================================================== - ! perched water table code - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! define frost table as first frozen layer with unfrozen layer above it - if(t_soisno(c,1) > tfrz) then - k_frz=nlevsoi - else - k_frz=1 - endif - - do k=2, nlevsoi - if (t_soisno(c,k-1) > tfrz .and. t_soisno(c,k) <= tfrz) then - k_frz=k - exit - endif - enddo - - frost_table(c)=z(c,k_frz) - - ! initialize perched water table to frost table, and qflx_drain_perched(c) to zero - zwt_perched(c)=frost_table(c) - - !=================== water table above frost table ============================= - ! if water table is above frost table, do not use topmodel baseflow formulation - if (zwt(c) < frost_table(c) .and. t_soisno(c,k_frz) <= tfrz & - .and. origflag == 0) then - else - !=================== water table below frost table ============================= - !-- compute possible perched water table *and* groundwater table afterwards - ! locate perched water table from bottom up starting at frost table - ! sat_lev is an arbitrary saturation level used to determine perched water table - sat_lev=0.9 - - k_perch=1 - do k=k_frz,1,-1 - h2osoi_vol(c,k) = h2osoi_liq(c,k)/(dz(c,k)*denh2o) & - + h2osoi_ice(c,k)/(dz(c,k)*denice) - - if (h2osoi_vol(c,k)/watsat(c,k) <= sat_lev) then - k_perch=k - exit - endif - enddo - - ! if frost_table = nlevsoi, only compute perched water table if frozen - if (t_soisno(c,k_frz) > tfrz) k_perch=k_frz - - ! if perched water table exists - if (k_frz > k_perch) then - ! interpolate between k_perch and k_perch+1 to find perched water table height - s1 = (h2osoi_liq(c,k_perch)/(dz(c,k_perch)*denh2o) & - + h2osoi_ice(c,k_perch)/(dz(c,k_perch)*denice))/watsat(c,k_perch) - s2 = (h2osoi_liq(c,k_perch+1)/(dz(c,k_perch+1)*denh2o) & - + h2osoi_ice(c,k_perch+1)/(dz(c,k_perch+1)*denice))/watsat(c,k_perch+1) - - m=(z(c,k_perch+1)-z(c,k_perch))/(s2-s1) - b=z(c,k_perch+1)-m*s2 - zwt_perched(c)=max(0._r8,m*sat_lev+b) - - endif !k_frz > k_perch - endif - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Renew the ice and liquid mass due to condensation - - if (snl(c)+1 >= 1) then - - ! make consistent with how evap_grnd removed in infiltration - h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_dew_grnd(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_dew_snow(c) * dtime - if (qflx_sub_snow(c)*dtime > h2osoi_ice(c,1)) then - qflx_sub_snow(c) = h2osoi_ice(c,1)/dtime - h2osoi_ice(c,1) = 0._r8 - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_sub_snow(c) * dtime - end if - end if - end do - - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - ! Renew the ice and liquid mass due to condensation for urban roof and impervious road - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - if (snl(c)+1 >= 1) then - h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_dew_grnd(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_dew_snow(c) * dtime) - if (qflx_sub_snow(c)*dtime > h2osoi_ice(c,1)) then - qflx_sub_snow(c) = h2osoi_ice(c,1)/dtime - h2osoi_ice(c,1) = 0._r8 - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_sub_snow(c) * dtime) - end if - end if - end if - - end do - - end associate - - end subroutine WaterTable - - !----------------------------------------------------------------------- - subroutine Drainage(bounds, num_hydrologyc, filter_hydrologyc, num_urbanc, filter_urbanc, & - temperature_inst, soilhydrology_inst, soilstate_inst, waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate subsurface drainage - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi, nlevgrnd, nlayer, nlayert - use clm_varcon , only : pondmx, tfrz, watmin,rpi, secspday, nlvic - use column_varcon , only : icol_roof, icol_road_imperv, icol_road_perv - use abortutils , only : endrun - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(temperature_type) , intent(in) :: temperature_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'Drainage' ! subroutine name - integer :: c,j,fc,i ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: xs(bounds%begc:bounds%endc) ! water needed to bring soil moisture to watmin (mm) - real(r8) :: dzmm(bounds%begc:bounds%endc,1:nlevsoi) ! layer thickness (mm) - integer :: jwt(bounds%begc:bounds%endc) ! index of the soil layer right above the water table (-) - real(r8) :: rsub_bot(bounds%begc:bounds%endc) ! subsurface runoff - bottom drainage (mm/s) - real(r8) :: rsub_top(bounds%begc:bounds%endc) ! subsurface runoff - topographic control (mm/s) - real(r8) :: fff(bounds%begc:bounds%endc) ! decay factor (m-1) - real(r8) :: xsi(bounds%begc:bounds%endc) ! excess soil water above saturation at layer i (mm) - real(r8) :: xsia(bounds%begc:bounds%endc) ! available pore space at layer i (mm) - real(r8) :: xs1(bounds%begc:bounds%endc) ! excess soil water above saturation at layer 1 (mm) - real(r8) :: smpfz(1:nlevsoi) ! matric potential of layer right above water table (mm) - real(r8) :: wtsub ! summation of hk*dzmm for layers below water table (mm**2/s) - real(r8) :: rous ! aquifer yield (-) - real(r8) :: wh ! smpfz(jwt)-z(jwt) (mm) - real(r8) :: wh_zwt ! water head at the water table depth (mm) - real(r8) :: ws ! summation of pore space of layers below water table (mm) - real(r8) :: s_node ! soil wetness (-) - real(r8) :: dzsum ! summation of dzmm of layers below water table (mm) - real(r8) :: icefracsum ! summation of icefrac*dzmm of layers below water table (-) - real(r8) :: fracice_rsub(bounds%begc:bounds%endc) ! fractional impermeability of soil layers (-) - real(r8) :: ka ! hydraulic conductivity of the aquifer (mm/s) - real(r8) :: dza ! fff*(zwt-z(jwt)) (-) - real(r8) :: available_h2osoi_liq ! available soil liquid water in a layer - real(r8) :: rsub_top_max - real(r8) :: h2osoi_vol - real(r8) :: imped - real(r8) :: rsub_top_tot - real(r8) :: rsub_top_layer - real(r8) :: qcharge_tot - real(r8) :: qcharge_layer - real(r8) :: theta_unsat - real(r8) :: f_unsat - real(r8) :: s_y - integer :: k,k_frz,k_perch - real(r8) :: sat_lev - real(r8) :: s1 - real(r8) :: s2 - real(r8) :: m - real(r8) :: b - real(r8) :: q_perch - real(r8) :: q_perch_max - real(r8) :: vol_ice - real(r8) :: dsmax_tmp(bounds%begc:bounds%endc) ! temporary variable for ARNO subsurface runoff calculation - real(r8) :: rsub_tmp ! temporary variable for ARNO subsurface runoff calculation - real(r8) :: frac ! temporary variable for ARNO subsurface runoff calculation - real(r8) :: rel_moist ! relative moisture, temporary variable - real(r8) :: wtsub_vic ! summation of hk*dzmm for layers in the third VIC layer - !----------------------------------------------------------------------- - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - - depth => soilhydrology_inst%depth_col , & ! Input: [real(r8) (:,:) ] VIC soil depth - c_param => soilhydrology_inst%c_param_col , & ! Input: [real(r8) (:) ] baseflow exponent (Qb) - Dsmax => soilhydrology_inst%dsmax_col , & ! Input: [real(r8) (:) ] max. velocity of baseflow (mm/day) - max_moist => soilhydrology_inst%max_moist_col , & ! Input: [real(r8) (:,:) ] maximum soil moisture (ice + liq) - moist => soilhydrology_inst%moist_col , & ! Input: [real(r8) (:,:) ] soil layer moisture (mm) - Ds => soilhydrology_inst%ds_col , & ! Input: [real(r8) (:) ] fracton of Dsmax where non-linear baseflow begins - Wsvic => soilhydrology_inst%Wsvic_col , & ! Input: [real(r8) (:) ] fraction of maximum soil moisutre where non-liear base flow occurs - icefrac => soilhydrology_inst%icefrac_col , & ! Output: [real(r8) (:,:) ] fraction of ice in layer - hkdepth => soilhydrology_inst%hkdepth_col , & ! Input: [real(r8) (:) ] decay factor (m) - frost_table => soilhydrology_inst%frost_table_col , & ! Input: [real(r8) (:) ] frost table depth (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Input: [real(r8) (:) ] perched water table depth (m) - wa => soilhydrology_inst%wa_col , & ! Input: [real(r8) (:) ] water in the unconfined aquifer (mm) - ice => soilhydrology_inst%ice_col , & ! Input: [real(r8) (:,:) ] soil layer moisture (mm) - qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) - origflag => soilhydrology_inst%origflag , & ! Input: logical - h2osfcflag => soilhydrology_inst%h2osfcflag , & ! Input: logical - - qflx_snwcp_liq => waterflux_inst%qflx_snwcp_liq_col , & ! Output: [real(r8) (:) ] excess liquid h2o due to snow capping (outgoing) (mm H2O /s) [+] - qflx_ice_runoff_xs => waterflux_inst%qflx_ice_runoff_xs_col , & ! Output: [real(r8) (:) ] solid runoff from excess ice in soil (mm H2O /s) [+] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_col , & ! Output: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_col , & ! Output: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_sub_snow => waterflux_inst%qflx_sub_snow_col , & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_drain => waterflux_inst%qflx_drain_col , & ! Output: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Output: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes (mm H2O /s) - qflx_rsub_sat => waterflux_inst%qflx_rsub_sat_col , & ! Output: [real(r8) (:) ] soil saturation excess [mm h2o/s] - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Output: [real(r8) (:) ] perched wt sub-surface runoff (mm H2O /s) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - ) - - ! Get time step - - dtime = get_step_size() - - ! Convert layer thicknesses from m to mm - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - dzmm(c,j) = dz(c,j)*1.e3_r8 - - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - icefrac(c,j) = min(1._r8,vol_ice/watsat(c,j)) - end do - end do - - ! Initial set - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qflx_drain(c) = 0._r8 - rsub_bot(c) = 0._r8 - qflx_rsub_sat(c) = 0._r8 - rsub_top(c) = 0._r8 - fracice_rsub(c) = 0._r8 - - end do - - ! The layer index of the first unsaturated layer, i.e., the layer right above - ! the water table - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - jwt(c) = nlevsoi - ! allow jwt to equal zero when zwt is in top layer - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - end do - - rous = 0.2_r8 - - !== BASEFLOW ================================================== - ! perched water table code - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! specify maximum drainage rate - q_perch_max = 1.e-5_r8 * sin(col%topo_slope(c) * (rpi/180._r8)) - - ! if layer containing water table is frozen, compute the following: - ! frost table, perched water table, and drainage from perched saturated layer - - ! define frost table as first frozen layer with unfrozen layer above it - if(t_soisno(c,1) > tfrz) then - k_frz=nlevsoi - else - k_frz=1 - endif - - do k=2, nlevsoi - if (t_soisno(c,k-1) > tfrz .and. t_soisno(c,k) <= tfrz) then - k_frz=k - exit - endif - enddo - - frost_table(c)=z(c,k_frz) - - ! initialize perched water table to frost table, and qflx_drain_perched(c) to zero - zwt_perched(c)=frost_table(c) - qflx_drain_perched(c) = 0._r8 - - !=================== water table above frost table ============================= - ! if water table is above frost table, do not use topmodel baseflow formulation - - if (zwt(c) < frost_table(c) .and. t_soisno(c,k_frz) <= tfrz & - .and. origflag == 0) then - ! compute drainage from perched saturated region - wtsub = 0._r8 - q_perch = 0._r8 - do k = jwt(c)+1, k_frz - imped=10._r8**(-e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) - q_perch = q_perch + imped*hksat(c,k)*dzmm(c,k) - wtsub = wtsub + dzmm(c,k) - end do - if (wtsub > 0._r8) q_perch = q_perch/wtsub - - qflx_drain_perched(c) = q_perch_max * q_perch & - *(frost_table(c) - zwt(c)) - - ! remove drainage from perched saturated layers - rsub_top_tot = - qflx_drain_perched(c) * dtime - do k = jwt(c)+1, k_frz - rsub_top_layer=max(rsub_top_tot,-(h2osoi_liq(c,k)-watmin)) - rsub_top_layer=min(rsub_top_layer,0._r8) - rsub_top_tot = rsub_top_tot - rsub_top_layer - - h2osoi_liq(c,k) = h2osoi_liq(c,k) + rsub_top_layer - - if (rsub_top_tot >= 0.) then - zwt(c) = zwt(c) - rsub_top_layer/eff_porosity(c,k)/1000._r8 - exit - else - zwt(c) = zi(c,k) - endif - enddo - - ! if rsub_top_tot is greater than available water (above frost table), - ! then decrease qflx_drain_perched by residual amount for water balance - qflx_drain_perched(c) = qflx_drain_perched(c) + rsub_top_tot/dtime - - !-- recompute jwt --------------------------------------------------------- - ! allow jwt to equal zero when zwt is in top layer - jwt(c) = nlevsoi - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - else - !=================== water table below frost table ============================= - !-- compute possible perched water table *and* groundwater table afterwards - ! locate perched water table from bottom up starting at frost table - ! sat_lev is an arbitrary saturation level used to determine perched water table - sat_lev=0.9 - - k_perch=1 - do k=k_frz,1,-1 - h2osoi_vol = h2osoi_liq(c,k)/(dz(c,k)*denh2o) & - + h2osoi_ice(c,k)/(dz(c,k)*denice) - - if (h2osoi_vol/watsat(c,k) <= sat_lev) then - k_perch=k - exit - endif - enddo - - ! if frost_table = nlevsoi, only compute perched water table if frozen - if (t_soisno(c,k_frz) > tfrz) k_perch=k_frz - - ! if perched water table exists - if (k_frz > k_perch) then - ! interpolate between k_perch and k_perch+1 to find perched water table height - s1 = (h2osoi_liq(c,k_perch)/(dz(c,k_perch)*denh2o) & - + h2osoi_ice(c,k_perch)/(dz(c,k_perch)*denice))/watsat(c,k_perch) - s2 = (h2osoi_liq(c,k_perch+1)/(dz(c,k_perch+1)*denh2o) & - + h2osoi_ice(c,k_perch+1)/(dz(c,k_perch+1)*denice))/watsat(c,k_perch+1) - - m=(z(c,k_perch+1)-z(c,k_perch))/(s2-s1) - b=z(c,k_perch+1)-m*s2 - zwt_perched(c)=max(0._r8,m*sat_lev+b) - - ! compute drainage from perched saturated region - wtsub = 0._r8 - q_perch = 0._r8 - do k = k_perch, k_frz - imped=10._r8**(-e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) - q_perch = q_perch + imped*hksat(c,k)*dzmm(c,k) - wtsub = wtsub + dzmm(c,k) - end do - if (wtsub > 0._r8) q_perch = q_perch/wtsub - - qflx_drain_perched(c) = q_perch_max * q_perch & - *(frost_table(c) - zwt_perched(c)) - - ! no perched water table drainage if using original formulation - if(origflag == 1) qflx_drain_perched(c) = 0._r8 - - ! remove drainage from perched saturated layers - rsub_top_tot = - qflx_drain_perched(c) * dtime - do k = k_perch+1, k_frz - rsub_top_layer=max(rsub_top_tot,-(h2osoi_liq(c,k)-watmin)) - rsub_top_layer=min(rsub_top_layer,0._r8) - rsub_top_tot = rsub_top_tot - rsub_top_layer - - h2osoi_liq(c,k) = h2osoi_liq(c,k) + rsub_top_layer - - if (rsub_top_tot >= 0.) then - zwt_perched(c) = zwt_perched(c) - rsub_top_layer/eff_porosity(c,k)/1000._r8 - exit - else - zwt_perched(c) = zi(c,k) - endif - - enddo - - ! if rsub_top_tot is greater than available water (above frost table), - ! then decrease qflx_drain_perched by residual amount for water balance - qflx_drain_perched(c) = qflx_drain_perched(c) + rsub_top_tot/dtime - - else - qflx_drain_perched(c) = 0._r8 - endif !k_frz > k_perch - - !-- Topographic runoff ---------------------------------------------------------------------- - fff(c) = 1._r8/ hkdepth(c) - dzsum = 0._r8 - icefracsum = 0._r8 - do j = max(jwt(c),1), nlevsoi - dzsum = dzsum + dzmm(c,j) - icefracsum = icefracsum + icefrac(c,j) * dzmm(c,j) - end do - ! add ice impedance factor to baseflow - if(origflag == 1) then - if (use_vichydro) then - call endrun(msg="VICHYDRO is not available for origflag=1"//errmsg(sourcefile, __LINE__)) - else - fracice_rsub(c) = max(0._r8,exp(-3._r8*(1._r8-(icefracsum/dzsum))) & - - exp(-3._r8))/(1.0_r8-exp(-3._r8)) - imped=(1._r8 - fracice_rsub(c)) - rsub_top_max = 5.5e-3_r8 - end if - else - if (use_vichydro) then - imped=10._r8**(-e_ice*min(1.0_r8,ice(c,nlayer)/max_moist(c,nlayer))) - dsmax_tmp(c) = Dsmax(c) * dtime/ secspday !mm/day->mm/dtime - rsub_top_max = dsmax_tmp(c) - else - imped=10._r8**(-e_ice*(icefracsum/dzsum)) - rsub_top_max = 10._r8 * sin((rpi/180.) * col%topo_slope(c)) - end if - endif - if (use_vichydro) then - ! ARNO model for the bottom soil layer (based on bottom soil layer - ! moisture from previous time step - ! use watmin instead for resid_moist to be consistent with default hydrology - rel_moist = (moist(c,nlayer) - watmin)/(max_moist(c,nlayer)-watmin) - frac = (Ds(c) * rsub_top_max )/Wsvic(c) - rsub_tmp = (frac * rel_moist)/dtime - if(rel_moist > Wsvic(c))then - frac = (rel_moist - Wsvic(c))/(1.0_r8 - Wsvic(c)) - rsub_tmp = rsub_tmp + (rsub_top_max * (1.0_r8 - Ds(c)/Wsvic(c)) *frac**c_param(c))/dtime - end if - rsub_top(c) = imped * rsub_tmp - ! make sure baseflow isn't negative - rsub_top(c) = max(0._r8, rsub_top(c)) - else - rsub_top(c) = imped * rsub_top_max* exp(-fff(c)*zwt(c)) - end if - - ! use analytical expression for aquifer specific yield - rous = watsat(c,nlevsoi) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,nlevsoi))**(-1./bsw(c,nlevsoi))) - rous=max(rous,0.02_r8) - - !-- water table is below the soil column -------------------------------------- - if(jwt(c) == nlevsoi) then - wa(c) = wa(c) - rsub_top(c) * dtime - zwt(c) = zwt(c) + (rsub_top(c) * dtime)/1000._r8/rous - h2osoi_liq(c,nlevsoi) = h2osoi_liq(c,nlevsoi) + max(0._r8,(wa(c)-aquifer_water_baseline)) - wa(c) = min(wa(c), aquifer_water_baseline) - else - !-- water table within soil layers 1-9 ------------------------------------- - !============================== RSUB_TOP ========================================= - !-- Now remove water via rsub_top - rsub_top_tot = - rsub_top(c) * dtime - !should never be positive... but include for completeness - if(rsub_top_tot > 0.) then !rising water table - - call endrun(msg="RSUB_TOP IS POSITIVE in Drainage!"//errmsg(sourcefile, __LINE__)) - - else ! deepening water table - if (use_vichydro) then - wtsub_vic = 0._r8 - do j = (nlvic(1)+nlvic(2)+1), nlevsoi - wtsub_vic = wtsub_vic + hk_l(c,j)*dzmm(c,j) - end do - - do j = (nlvic(1)+nlvic(2)+1), nlevsoi - rsub_top_layer=max(rsub_top_tot, rsub_top_tot*hk_l(c,j)*dzmm(c,j)/wtsub_vic) - rsub_top_layer=min(rsub_top_layer,0._r8) - h2osoi_liq(c,j) = h2osoi_liq(c,j) + rsub_top_layer - rsub_top_tot = rsub_top_tot - rsub_top_layer - end do - else - do j = jwt(c)+1, nlevsoi - ! use analytical expression for specific yield - s_y = watsat(c,j) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,j))**(-1./bsw(c,j))) - s_y=max(s_y,0.02_r8) - - rsub_top_layer=max(rsub_top_tot,-(s_y*(zi(c,j) - zwt(c))*1.e3)) - rsub_top_layer=min(rsub_top_layer,0._r8) - h2osoi_liq(c,j) = h2osoi_liq(c,j) + rsub_top_layer - - rsub_top_tot = rsub_top_tot - rsub_top_layer - - if (rsub_top_tot >= 0.) then - zwt(c) = zwt(c) - rsub_top_layer/s_y/1000._r8 - - exit - else - zwt(c) = zi(c,j) - endif - enddo - end if - - !-- remove residual rsub_top --------------------------------------------- - zwt(c) = zwt(c) - rsub_top_tot/1000._r8/rous - wa(c) = wa(c) + rsub_top_tot - endif - - !-- recompute jwt --------------------------------------------------------- - ! allow jwt to equal zero when zwt is in top layer - jwt(c) = nlevsoi - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - end if! end of jwt if construct - - zwt(c) = max(0.0_r8,zwt(c)) - zwt(c) = min(80._r8,zwt(c)) - - endif - - end do - - ! excessive water above saturation added to the above unsaturated layer like a bucket - ! if column fully saturated, excess water goes to runoff - - do j = nlevsoi,2,-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - xsi(c) = max(h2osoi_liq(c,j)-eff_porosity(c,j)*dzmm(c,j),0._r8) - h2osoi_liq(c,j) = min(eff_porosity(c,j)*dzmm(c,j), h2osoi_liq(c,j)) - h2osoi_liq(c,j-1) = h2osoi_liq(c,j-1) + xsi(c) - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! watmin addition to fix water balance errors - xs1(c) = max(max(h2osoi_liq(c,1)-watmin,0._r8)- & - max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1)-watmin)),0._r8) - h2osoi_liq(c,1) = h2osoi_liq(c,1) - xs1(c) - - if (lun%urbpoi(col%landunit(c))) then - qflx_rsub_sat(c) = xs1(c) / dtime - else - if(h2osfcflag == 1) then - ! send this water up to h2osfc rather than sending to drainage - h2osfc(c) = h2osfc(c) + xs1(c) - qflx_rsub_sat(c) = 0._r8 - else - ! use original code to send water to drainage (non-h2osfc case) - qflx_rsub_sat(c) = xs1(c) / dtime - endif - endif - ! add in ice check - xs1(c) = max(max(h2osoi_ice(c,1),0._r8)-max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_liq(c,1))),0._r8) - h2osoi_ice(c,1) = min(max(0._r8,pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_liq(c,1)), h2osoi_ice(c,1)) - qflx_ice_runoff_xs(c) = xs1(c) / dtime - end do - - ! Limit h2osoi_liq to be greater than or equal to watmin. - ! Get water needed to bring h2osoi_liq equal watmin from lower layer. - ! If insufficient water in soil layers, get from aquifer water - - do j = 1, nlevsoi-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin - h2osoi_liq(c,j) - ! deepen water table if water is passed from below zwt layer - if(j == jwt(c)) then - zwt(c) = zwt(c) + xs(c)/eff_porosity(c,j)/1000._r8 - endif - else - xs(c) = 0._r8 - end if - h2osoi_liq(c,j ) = h2osoi_liq(c,j ) + xs(c) - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) - xs(c) - end do - end do - - ! Get water for bottom layer from layers above if possible - j = nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin-h2osoi_liq(c,j) - searchforwater: do i = nlevsoi-1, 1, -1 - available_h2osoi_liq = max(h2osoi_liq(c,i)-watmin-xs(c),0._r8) - if (available_h2osoi_liq >= xs(c)) then - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - h2osoi_liq(c,i) = h2osoi_liq(c,i) - xs(c) - xs(c) = 0._r8 - exit searchforwater - else - h2osoi_liq(c,j) = h2osoi_liq(c,j) + available_h2osoi_liq - h2osoi_liq(c,i) = h2osoi_liq(c,i) - available_h2osoi_liq - xs(c) = xs(c) - available_h2osoi_liq - end if - end do searchforwater - else - xs(c) = 0._r8 - end if - ! Needed in case there is no water to be found - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - ! Instead of removing water from aquifer where it eventually - ! shows up as excess drainage to the ocean, take it back out of - ! drainage - rsub_top(c) = rsub_top(c) - xs(c)/dtime - - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Sub-surface runoff and drainage - - qflx_drain(c) = qflx_rsub_sat(c) + rsub_top(c) - - ! Set imbalance for snow capping - - qflx_qrgwl(c) = qflx_snwcp_liq(c) - - end do - - ! No drainage for urban columns (except for pervious road as computed above) - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (col%itype(c) /= icol_road_perv) then - qflx_drain(c) = 0._r8 - ! This must be done for roofs and impervious road (walls will be zero) - qflx_qrgwl(c) = qflx_snwcp_liq(c) - end if - end do - - end associate - - end subroutine Drainage - - !----------------------------------------------------------------------- - subroutine CLMVICMap(bounds, numf, filter, & - soilhydrology_inst, waterstate_inst) - ! - ! !DESCRIPTION: - ! Performs the mapping from CLM layers to VIC layers - ! CLM hydrologically active soil layers are mapped to three VIC layers - ! by assigning the first nlvic(1) layers to VIC layer 1 - ! the next nlvic(2) layers to VIC alyer 2 - ! and the remaining to VIC layer 3 - ! mapping from VIC to CLM layers, M.Huang - ! - ! !USES: - use clm_varcon , only : denh2o, denice, watmin - use clm_varpar , only : nlevsoi, nlayer, nlayert, nlevgrnd - use decompMod , only : bounds_type - ! - ! !REVISION HISTORY: - ! Created by Maoyi Huang - ! 11/13/2012, Maoyi Huang: rewrite the mapping modules in CLM4VIC - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: numf ! number of column soil points in column filter - integer , intent(in) :: filter(:) ! column filter for soil points - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - ! - ! !LOCAL VARIABLES - real(r8) :: ice0(1:nlayer) ! last step ice lens (mm) (new) - real(r8) :: moist0(1:nlayer) ! last step soil water (mm) (new) - integer :: i, j, c, fc - ! note: in CLM4 h2osoil_liq unit is kg/m2, in VIC moist is mm - ! h2osoi_ice is actually water equivalent ice content. - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - - depth => soilhydrology_inst%depth_col , & ! Input: [real(r8) (:,:) ] layer depth of upper layer (m) - porosity => soilhydrology_inst%porosity_col , & ! Input: [real(r8) (:,:) ] soil porisity (1-bulk_density/soil_density) - max_moist => soilhydrology_inst%max_moist_col , & ! Input: [real(r8) (:,:) ] max layer moist + ice (mm) - vic_clm_fract => soilhydrology_inst%vic_clm_fract_col , & ! Input: [real(r8) (:,:,:) ] fraction of VIC layers in each CLM layer - moist => soilhydrology_inst%moist_col , & ! Output: [real(r8) (:,:) ] liquid water (mm) - ice => soilhydrology_inst%ice_col , & ! Output: [real(r8) (:,:) ] ice lens (mm) - moist_vol => soilhydrology_inst%moist_vol_col & ! Output: [real(r8) (:,:) ] volumetric soil moisture for VIC soil layers - ) - - ! map CLM to VIC - do fc = 1, numf - c = filter(fc) - do i = 1, nlayer - ice0(i) = ice(c,i) - moist0(i) = moist(c,i) - ice(c,i) = 0._r8 - moist(c,i) = 0._r8 - do j = 1, nlevsoi - ice(c,i) = ice(c,i) + h2osoi_ice(c,j) * vic_clm_fract(c,i,j) - moist(c,i) = moist(c,i) + h2osoi_liq(c,j) * vic_clm_fract(c,i,j) - end do - ice(c,i) = min((moist0(i) + ice0(i)), ice(c,i)) - ice(c,i) = max(0._r8, ice(c,i)) - moist(c,i) = max(watmin, moist(c,i)) - moist(c,i) = min(max_moist(c,i)-ice(c,i), moist(c,i)) - moist_vol(c,i) = moist(c,i)/(depth(c,i)*denice) + ice(c,i)/(depth(c,i)*denh2o) - moist_vol(c,i) = min(porosity(c,i), moist_vol(c,i)) - moist_vol(c,i) = max(0.01_r8, moist_vol(c,i)) - end do - - ! hydrologic inactive layers - ice(c, nlayer+1:nlayert) = h2osoi_ice(c, nlevsoi+1:nlevgrnd) - moist(c, nlayer+1:nlayert) = h2osoi_liq(c, nlevsoi+1:nlevgrnd) - moist_vol(c, nlayer+1:nlayert) = h2osoi_vol(c, nlevsoi+1:nlevgrnd) - end do - - end associate - - end subroutine CLMVICMap - -!#3 - !----------------------------------------------------------------------- - subroutine PerchedWaterTable(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - temperature_inst, waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate watertable, considering aquifer recharge but no drainage. - ! - ! !USES: - use clm_varcon , only : pondmx, tfrz, watmin,denice,denh2o - use clm_varpar , only : nlevsoi - use column_varcon , only : icol_roof, icol_road_imperv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,fc,i ! indices - real(r8) :: s_y - integer :: k,k_frz,k_perch,k_zwt - real(r8) :: sat_lev - real(r8) :: s1 - real(r8) :: s2 - real(r8) :: m - real(r8) :: b - integer :: sat_flag - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - zwt => soilhydrology_inst%zwt_col , & ! Output: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Output: [real(r8) (:) ] perched water table depth (m) - frost_table => soilhydrology_inst%frost_table_col , & ! Output: [real(r8) (:) ] frost table depth (m) - origflag => soilhydrology_inst%origflag & ! Input: logical - ) - - ! calculate perched water table location - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! define frost table as first frozen layer with unfrozen layer above it - if(t_soisno(c,1) > tfrz) then - k_frz=nlevsoi - else - k_frz=1 - endif - - do k=2, nlevsoi - if (t_soisno(c,k-1) > tfrz .and. t_soisno(c,k) <= tfrz) then - k_frz=k - exit - endif - enddo - - frost_table(c)=z(c,k_frz) - - ! initialize perched water table to frost table, and qflx_drain_perched(c) to zero - zwt_perched(c)=frost_table(c) - - !======= water table above frost table =================== - ! if water table is above frost table, do nothing - if (zwt(c) < frost_table(c) .and. t_soisno(c,k_frz) <= tfrz & - .and. origflag == 0) then - else - !========== water table below frost table ============ - ! locate perched water table from bottom up starting at - ! frost table sat_lev is an arbitrary saturation level - ! used to determine perched water table - - sat_lev=0.9 - - k_perch=1 - do k=k_frz,1,-1 - h2osoi_vol(c,k) = h2osoi_liq(c,k)/(dz(c,k)*denh2o) & - + h2osoi_ice(c,k)/(dz(c,k)*denice) - - if (h2osoi_vol(c,k)/watsat(c,k) <= sat_lev) then - k_perch=k - exit - endif - enddo - - ! if frost_table = nlevsoi, only compute perched water table if frozen - if (t_soisno(c,k_frz) > tfrz) k_perch=k_frz - - ! if perched water table exists - ! interpolate between k_perch and k_perch+1 to find - ! perched water table height - if (k_frz > k_perch) then - s1 = (h2osoi_liq(c,k_perch)/(dz(c,k_perch)*denh2o) & - + h2osoi_ice(c,k_perch)/(dz(c,k_perch)*denice))/watsat(c,k_perch) - s2 = (h2osoi_liq(c,k_perch+1)/(dz(c,k_perch+1)*denh2o) & - + h2osoi_ice(c,k_perch+1)/(dz(c,k_perch+1)*denice))/watsat(c,k_perch+1) - - m=(z(c,k_perch+1)-z(c,k_perch))/(s2-s1) - b=z(c,k_perch+1)-m*s2 - zwt_perched(c)=max(0._r8,m*sat_lev+b) - - endif !k_frz > k_perch - endif - end do - - end associate - - end subroutine PerchedWaterTable - -!#4 - !----------------------------------------------------------------------- - subroutine PerchedLateralFlow(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate subsurface drainage from perched saturated zone - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi, nlevgrnd, nlayer, nlayert - use clm_varcon , only : pondmx, tfrz, watmin,rpi, secspday, nlvic - use column_varcon , only : icol_roof, icol_road_imperv, icol_road_perv - use abortutils , only : endrun - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'PerchedLateralFlow' ! subroutine name - integer :: c,j,fc,i ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: dzmm(bounds%begc:bounds%endc,1:nlevsoi) ! layer thickness (mm) - real(r8) :: wtsub ! summation of hk*dzmm for layers below water table (mm**2/s) - real(r8) :: icefracsum ! summation of icefrac*dzmm of layers below water table (-) - real(r8) :: fracice_rsub(bounds%begc:bounds%endc) ! fractional impermeability of soil layers (-) - real(r8) :: h2osoi_vol - real(r8) :: imped - real(r8) :: drainage_tot - real(r8) :: drainage_layer - real(r8) :: s_y - integer :: k,k_frz,k_perch - real(r8) :: sat_lev - real(r8) :: s1, s2, m, b - real(r8) :: q_perch - real(r8) :: q_perch_max - real(r8) :: vol_ice - !----------------------------------------------------------------------- - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - - icefrac => soilhydrology_inst%icefrac_col , & ! Output: [real(r8) (:,:) ] fraction of ice in layer - frost_table => soilhydrology_inst%frost_table_col , & ! Input: [real(r8) (:) ] frost table depth (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - zwt_perched => soilhydrology_inst%zwt_perched_col , & ! Input: [real(r8) (:) ] perched water table depth (m) - origflag => soilhydrology_inst%origflag , & ! Input: logical - - qflx_drain_perched => waterflux_inst%qflx_drain_perched_col , & ! Output: [real(r8) (:) ] perched wt sub-surface runoff (mm H2O /s) - - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - ) - - ! Get time step - - dtime = get_step_size() - - ! Compute ice fraction in each layer - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - dzmm(c,j) = dz(c,j)*1.e3_r8 - - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - icefrac(c,j) = min(1._r8,vol_ice/watsat(c,j)) - end do - end do - - ! compute drainage from perched saturated region - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - qflx_drain_perched(c) = 0._r8 - - if ((frost_table(c) > zwt_perched(c)) .and. origflag == 0) then - - ! specify maximum drainage rate - q_perch_max = 1.e-5_r8 * sin(col%topo_slope(c) * (rpi/180._r8)) - - ! calculate frost table and perched water table locations - do k=1, nlevsoi - if (frost_table(c) >= zi(c,k-1) .and. frost_table(c) <= zi(c,k)) then - k_frz=k - exit - endif - enddo - - do k=1, nlevsoi - if (zwt_perched(c) >= zi(c,k-1) .and. zwt_perched(c) <= zi(c,k)) then - k_perch=k - exit - endif - enddo - - wtsub = 0._r8 - q_perch = 0._r8 - do k = k_perch, k_frz - imped=10._r8**(-e_ice*(0.5_r8*(icefrac(c,k)+icefrac(c,min(nlevsoi, k+1))))) - q_perch = q_perch + imped*hksat(c,k)*dzmm(c,k) - wtsub = wtsub + dzmm(c,k) - end do - if (wtsub > 0._r8) q_perch = q_perch/wtsub - - qflx_drain_perched(c) = q_perch_max * q_perch & - *(frost_table(c) - zwt_perched(c)) - - ! no perched water table drainage if using original formulation - if(origflag == 1) qflx_drain_perched(c) = 0._r8 - - ! if perched water table exists - if (k_frz > k_perch) then - ! remove drainage from perched saturated layers - drainage_tot = - qflx_drain_perched(c) * dtime - do k = k_perch+1, k_frz - drainage_layer=max(drainage_tot,-(h2osoi_liq(c,k)-watmin)) - drainage_layer=min(drainage_layer,0._r8) - drainage_tot = drainage_tot - drainage_layer - - h2osoi_liq(c,k) = h2osoi_liq(c,k) + drainage_layer - - s_y = watsat(c,k) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,k))**(-1./bsw(c,k))) - s_y=max(s_y,0.02_r8) - if (drainage_tot >= 0.) then - zwt_perched(c) = zwt_perched(c) - drainage_layer/s_y/1000._r8 - exit - else - zwt_perched(c) = zi(c,k) - endif - enddo - - ! if drainage_tot is greater than available water - ! (above frost table), then decrease qflx_drain_perched - ! by residual amount for water balance - qflx_drain_perched(c) = qflx_drain_perched(c) + drainage_tot/dtime - else - qflx_drain_perched(c) = 0._r8 - endif !k_frz > k_perch - endif - enddo - - end associate - - end subroutine PerchedLateralFlow - -!#5 - !----------------------------------------------------------------------- - subroutine ThetaBasedWaterTable(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate watertable, considering aquifer recharge but no drainage. - ! - ! !USES: - use clm_varcon , only : denice,denh2o - use clm_varpar , only : nlevsoi - use column_varcon , only : icol_roof, icol_road_imperv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,fc,i ! indices - integer :: k,k_zwt - real(r8) :: sat_lev - real(r8) :: s1,s2,m,b ! temporary variables used to interpolate theta - integer :: sat_flag - !----------------------------------------------------------------------- - - associate( & - nbedrock => col%nbedrock , & ! Input: [real(r8) (:,:) ] depth to bedrock (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - zwt => soilhydrology_inst%zwt_col & ! Output: [real(r8) (:) ] water table depth (m) - ) - - ! calculate water table based on soil moisture state - ! this is a simple search for 1st layer with soil moisture - ! less than specified threshold (sat_lev) - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - -! initialize to depth of bottom of lowest layer - zwt(c)=zi(c,nlevsoi) - - ! locate water table from bottom up starting at bottom of soil column - ! sat_lev is an arbitrary saturation level used to determine water table - sat_lev=0.9 - - k_zwt=nbedrock(c) - sat_flag=1 !will remain unchanged if all layers at saturation - do k=nbedrock(c),1,-1 - h2osoi_vol(c,k) = h2osoi_liq(c,k)/(dz(c,k)*denh2o) & - + h2osoi_ice(c,k)/(dz(c,k)*denice) - - if (h2osoi_vol(c,k)/watsat(c,k) <= sat_lev) then - k_zwt=k - sat_flag=0 - exit - endif - enddo - if (sat_flag == 1) k_zwt=1 - - ! if soil column above sat_lev, set water table to lower - ! interface of first layer - if (k_zwt == 1) then - zwt(c)=zi(c,1) - else if (k_zwt < nbedrock(c)) then - ! interpolate between k_zwt and k_zwt+1 to find water table height - s1 = (h2osoi_liq(c,k_zwt)/(dz(c,k_zwt)*denh2o) & - + h2osoi_ice(c,k_zwt)/(dz(c,k_zwt)*denice))/watsat(c,k_zwt) - s2 = (h2osoi_liq(c,k_zwt+1)/(dz(c,k_zwt+1)*denh2o) & - + h2osoi_ice(c,k_zwt+1)/(dz(c,k_zwt+1)*denice))/watsat(c,k_zwt+1) - - m=(z(c,k_zwt+1)-z(c,k_zwt))/(s2-s1) - b=z(c,k_zwt+1)-m*s2 - zwt(c)=max(0._r8,m*sat_lev+b) - else - zwt(c)=zi(c,nbedrock(c)) - endif - - end do - - end associate - - end subroutine ThetaBasedWaterTable - - -!#6 - !----------------------------------------------------------------------- - subroutine LateralFlowPowerLaw(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc,soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate subsurface drainage - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi, nlevgrnd, nlayer, nlayert - use clm_varcon , only : pondmx, watmin,rpi, secspday, nlvic - use column_varcon , only : icol_roof, icol_road_imperv, icol_road_perv - use abortutils , only : endrun - use GridcellType , only : grc - - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'Drainage' ! subroutine name - integer :: c,j,fc,i ! indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: xs(bounds%begc:bounds%endc) ! water needed to bring soil moisture to watmin (mm) - real(r8) :: dzmm(bounds%begc:bounds%endc,1:nlevsoi) ! layer thickness (mm) - integer :: jwt(bounds%begc:bounds%endc) ! index of the soil layer right above the water table (-) - real(r8) :: rsub_bot(bounds%begc:bounds%endc) ! subsurface runoff - bottom drainage (mm/s) - real(r8) :: rsub_top(bounds%begc:bounds%endc) ! subsurface runoff - topographic control (mm/s) - real(r8) :: fff(bounds%begc:bounds%endc) ! decay factor (m-1) - real(r8) :: xsi(bounds%begc:bounds%endc) ! excess soil water above saturation at layer i (mm) - real(r8) :: xsia(bounds%begc:bounds%endc) ! available pore space at layer i (mm) - real(r8) :: xs1(bounds%begc:bounds%endc) ! excess soil water above saturation at layer 1 (mm) - real(r8) :: smpfz(1:nlevsoi) ! matric potential of layer right above water table (mm) - real(r8) :: wtsub ! summation of hk*dzmm for layers below water table (mm**2/s) - real(r8) :: dzsum ! summation of dzmm of layers below water table (mm) - real(r8) :: icefracsum ! summation of icefrac*dzmm of layers below water table (-) - real(r8) :: fracice_rsub(bounds%begc:bounds%endc) ! fractional impermeability of soil layers (-) - real(r8) :: available_h2osoi_liq ! available soil liquid water in a layer - real(r8) :: h2osoi_vol - real(r8) :: imped - real(r8) :: rsub_top_tot - real(r8) :: rsub_top_layer - real(r8) :: theta_unsat - real(r8) :: f_unsat - real(r8) :: s_y - integer :: k - real(r8) :: s1 - real(r8) :: s2 - real(r8) :: m - real(r8) :: b - real(r8) :: vol_ice - real(r8) :: dsmax_tmp(bounds%begc:bounds%endc) ! temporary variable for ARNO subsurface runoff calculation - real(r8) :: rsub_tmp ! temporary variable for ARNO subsurface runoff calculation - real(r8) :: frac ! temporary variable for ARNO subsurface runoff calculation - real(r8) :: rel_moist ! relative moisture, temporary variable - real(r8) :: wtsub_vic ! summation of hk*dzmm for layers in the third VIC layer - integer :: g - real(r8), parameter :: n_baseflow = 1 !drainage power law exponent - !----------------------------------------------------------------------- - - associate( & - nbedrock => col%nbedrock , & ! Input: [real(r8) (:,:) ] depth to bedrock (m) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] surface water (mm) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - - depth => soilhydrology_inst%depth_col , & ! Input: [real(r8) (:,:) ] VIC soil depth - c_param => soilhydrology_inst%c_param_col , & ! Input: [real(r8) (:) ] baseflow exponent (Qb) - Dsmax => soilhydrology_inst%dsmax_col , & ! Input: [real(r8) (:) ] max. velocity of baseflow (mm/day) - max_moist => soilhydrology_inst%max_moist_col , & ! Input: [real(r8) (:,:) ] maximum soil moisture (ice + liq) - moist => soilhydrology_inst%moist_col , & ! Input: [real(r8) (:,:) ] soil layer moisture (mm) - Ds => soilhydrology_inst%ds_col , & ! Input: [real(r8) (:) ] fracton of Dsmax where non-linear baseflow begins - Wsvic => soilhydrology_inst%Wsvic_col , & ! Input: [real(r8) (:) ] fraction of maximum soil moisutre where non-liear base flow occurs - icefrac => soilhydrology_inst%icefrac_col , & ! Output: [real(r8) (:,:) ] fraction of ice in layer - hkdepth => soilhydrology_inst%hkdepth_col , & ! Input: [real(r8) (:) ] decay factor (m) - frost_table => soilhydrology_inst%frost_table_col , & ! Input: [real(r8) (:) ] frost table depth (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - wa => soilhydrology_inst%wa_col , & ! Input: [real(r8) (:) ] water in the unconfined aquifer (mm) - ice => soilhydrology_inst%ice_col , & ! Input: [real(r8) (:,:) ] soil layer moisture (mm) - qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) - origflag => soilhydrology_inst%origflag , & ! Input: logical - h2osfcflag => soilhydrology_inst%h2osfcflag , & ! Input: logical - - qflx_snwcp_liq => waterflux_inst%qflx_snwcp_liq_col , & ! Output: [real(r8) (:) ] excess rainfall due to snow capping (mm H2O /s) [+] - qflx_ice_runoff_xs => waterflux_inst%qflx_ice_runoff_xs_col , & ! Output: [real(r8) (:) ] solid runoff from excess ice in soil (mm H2O /s) [+] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_col , & ! Output: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_col , & ! Output: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_sub_snow => waterflux_inst%qflx_sub_snow_col , & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - qflx_drain => waterflux_inst%qflx_drain_col , & ! Output: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_qrgwl => waterflux_inst%qflx_qrgwl_col , & ! Output: [real(r8) (:) ] qflx_surf at glaciers, wetlands, lakes (mm H2O /s) - qflx_rsub_sat => waterflux_inst%qflx_rsub_sat_col , & ! Output: [real(r8) (:) ] soil saturation excess [mm h2o/s] - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - ) - - ! Get time step - - dtime = get_step_size() - - ! Convert layer thicknesses from m to mm - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - dzmm(c,j) = dz(c,j)*1.e3_r8 - - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - icefrac(c,j) = min(1._r8,vol_ice/watsat(c,j)) - end do - end do - - ! Initial set - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qflx_drain(c) = 0._r8 - rsub_bot(c) = 0._r8 - qflx_rsub_sat(c) = 0._r8 - rsub_top(c) = 0._r8 - fracice_rsub(c) = 0._r8 - end do - - ! The layer index of the first unsaturated layer, - ! i.e., the layer right above the water table - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - jwt(c) = nlevsoi - ! allow jwt to equal zero when zwt is in top layer - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - end do - - !-- Topographic runoff ------------------------- - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - fff(c) = 1._r8/ hkdepth(c) - - dzsum = 0._r8 - icefracsum = 0._r8 - do j = max(jwt(c),1), nlevsoi - dzsum = dzsum + dzmm(c,j) - icefracsum = icefracsum + icefrac(c,j) * dzmm(c,j) - end do - imped=10._r8**(-e_ice*(icefracsum/dzsum)) - !@@ - ! baseflow is power law expression relative to bedrock layer - if(zwt(c) <= zi(c,nbedrock(c))) then - rsub_top(c) = imped * baseflow_scalar * tan(rpi/180._r8*col%topo_slope(c))* & - (zi(c,nbedrock(c)) - zwt(c))**(n_baseflow) - else - rsub_top(c) = 0._r8 - endif - - !-- Now remove water via rsub_top - rsub_top_tot = - rsub_top(c) * dtime - !should never be positive... but include for completeness - if(rsub_top_tot > 0.) then !rising water table - - call endrun(msg="RSUB_TOP IS POSITIVE in Drainage!"//errmsg(sourcefile, __LINE__)) - - else ! deepening water table - do j = jwt(c)+1, nbedrock(c) - ! use analytical expression for specific yield - s_y = watsat(c,j) & - * ( 1. - (1.+1.e3*zwt(c)/sucsat(c,j))**(-1./bsw(c,j))) - s_y=max(s_y,0.02_r8) - - rsub_top_layer=max(rsub_top_tot,-(s_y*(zi(c,j) - zwt(c))*1.e3)) - rsub_top_layer=min(rsub_top_layer,0._r8) - h2osoi_liq(c,j) = h2osoi_liq(c,j) + rsub_top_layer - - rsub_top_tot = rsub_top_tot - rsub_top_layer - - if (rsub_top_tot >= 0.) then - zwt(c) = zwt(c) - rsub_top_layer/s_y/1000._r8 - - exit - else - zwt(c) = zi(c,j) - endif - enddo - - !-- remove residual rsub_top --------------------------------------------- - ! make sure no extra water removed from soil column - rsub_top(c) = rsub_top(c) - rsub_top_tot/dtime - endif - - zwt(c) = max(0.0_r8,zwt(c)) - zwt(c) = min(80._r8,zwt(c)) - - end do - - ! excessive water above saturation added to the above unsaturated layer like a bucket - ! if column fully saturated, excess water goes to runoff - - do j = nlevsoi,2,-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - xsi(c) = max(h2osoi_liq(c,j)-eff_porosity(c,j)*dzmm(c,j),0._r8) - h2osoi_liq(c,j) = min(eff_porosity(c,j)*dzmm(c,j), h2osoi_liq(c,j)) - h2osoi_liq(c,j-1) = h2osoi_liq(c,j-1) + xsi(c) - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! watmin addition to fix water balance errors - xs1(c) = max(max(h2osoi_liq(c,1)-watmin,0._r8)- & - max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1)-watmin)),0._r8) - h2osoi_liq(c,1) = h2osoi_liq(c,1) - xs1(c) - - if (lun%urbpoi(col%landunit(c))) then - qflx_rsub_sat(c) = xs1(c) / dtime - else - ! send this water up to h2osfc rather than sending to drainage - h2osfc(c) = h2osfc(c) + xs1(c) - qflx_rsub_sat(c) = 0._r8 - endif - ! add in ice check - xs1(c) = max(max(h2osoi_ice(c,1),0._r8)-max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_liq(c,1))),0._r8) - h2osoi_ice(c,1) = min(max(0._r8,pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_liq(c,1)), h2osoi_ice(c,1)) - qflx_ice_runoff_xs(c) = xs1(c) / dtime - end do - - ! Limit h2osoi_liq to be greater than or equal to watmin. - ! Get water needed to bring h2osoi_liq equal watmin from lower layer. - ! If insufficient water in soil layers, get from aquifer water - - do j = 1, nlevsoi-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin - h2osoi_liq(c,j) - ! deepen water table if water is passed from below zwt layer - if(j == jwt(c)) then - zwt(c) = zwt(c) + xs(c)/eff_porosity(c,j)/1000._r8 - endif - else - xs(c) = 0._r8 - end if - h2osoi_liq(c,j ) = h2osoi_liq(c,j ) + xs(c) - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) - xs(c) - end do - end do - - ! Get water for bottom layer from layers above if possible - j = nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin-h2osoi_liq(c,j) - searchforwater: do i = nlevsoi-1, 1, -1 - available_h2osoi_liq = max(h2osoi_liq(c,i)-watmin-xs(c),0._r8) - if (available_h2osoi_liq >= xs(c)) then - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - h2osoi_liq(c,i) = h2osoi_liq(c,i) - xs(c) - xs(c) = 0._r8 - exit searchforwater - else - h2osoi_liq(c,j) = h2osoi_liq(c,j) + available_h2osoi_liq - h2osoi_liq(c,i) = h2osoi_liq(c,i) - available_h2osoi_liq - xs(c) = xs(c) - available_h2osoi_liq - end if - end do searchforwater - else - xs(c) = 0._r8 - end if - ! Needed in case there is no water to be found - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - ! Instead of removing water from aquifer where it eventually - ! shows up as excess drainage to the ocean, take it back out of - ! drainage - qflx_rsub_sat(c) = qflx_rsub_sat(c) - xs(c)/dtime - - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Sub-surface runoff and drainage - - qflx_drain(c) = qflx_rsub_sat(c) + rsub_top(c) - - ! Set imbalance for snow capping - - qflx_qrgwl(c) = qflx_snwcp_liq(c) - - end do - - ! No drainage for urban columns (except for pervious road as computed above) - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (col%itype(c) /= icol_road_perv) then - qflx_drain(c) = 0._r8 - ! This must be done for roofs and impervious road (walls will be zero) - qflx_qrgwl(c) = qflx_snwcp_liq(c) - end if - end do - - end associate - - end subroutine LateralFlowPowerLaw - -!#7 - !----------------------------------------------------------------------- - subroutine RenewCondensation(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterstate_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Calculate watertable, considering aquifer recharge but no drainage. - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi - use column_varcon , only : icol_roof, icol_road_imperv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,fc,i ! indices - real(r8) :: dtime ! land model time step (sec) - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] - qflx_dew_grnd => waterflux_inst%qflx_dew_grnd_col , & ! Input: [real(r8) (:) ] ground surface dew formation (mm H2O /s) [+] - qflx_dew_snow => waterflux_inst%qflx_dew_snow_col , & ! Input: [real(r8) (:) ] surface dew added to snow pack (mm H2O /s) [+] - qflx_sub_snow => waterflux_inst%qflx_sub_snow_col & ! Output: [real(r8) (:) ] sublimation rate from snow pack (mm H2O /s) [+] - ) - - ! Get time step - - dtime = get_step_size() - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Renew the ice and liquid mass due to condensation - - if (snl(c)+1 >= 1) then - - ! make consistent with how evap_grnd removed in infiltration - h2osoi_liq(c,1) = h2osoi_liq(c,1) + (1._r8 - frac_h2osfc(c))*qflx_dew_grnd(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (1._r8 - frac_h2osfc(c))*qflx_dew_snow(c) * dtime - if (qflx_sub_snow(c)*dtime > h2osoi_ice(c,1)) then - qflx_sub_snow(c) = h2osoi_ice(c,1)/dtime - h2osoi_ice(c,1) = 0._r8 - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (1._r8 - frac_h2osfc(c)) * qflx_sub_snow(c) * dtime - end if - end if - - end do - - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - ! Renew the ice and liquid mass due to condensation for urban roof and impervious road - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - if (snl(c)+1 >= 1) then - h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_dew_grnd(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_dew_snow(c) * dtime) - if (qflx_sub_snow(c)*dtime > h2osoi_ice(c,1)) then - qflx_sub_snow(c) = h2osoi_ice(c,1)/dtime - h2osoi_ice(c,1) = 0._r8 - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_sub_snow(c) * dtime) - end if - end if - end if - - end do - - end associate - - end subroutine RenewCondensation - -!#0 -end module SoilHydrologyMod diff --git a/src/biogeophys/SoilHydrologyType.F90 b/src/biogeophys/SoilHydrologyType.F90 deleted file mode 100644 index 33aee7efda..0000000000 --- a/src/biogeophys/SoilHydrologyType.F90 +++ /dev/null @@ -1,338 +0,0 @@ -Module SoilHydrologyType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varpar , only : nlevgrnd, nlayer, nlayert, nlevsoi - use clm_varcon , only : spval - use clm_varctl , only : iulog - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - save - ! - type, public :: soilhydrology_type - - integer :: h2osfcflag ! true => surface water is active (namelist) - integer :: origflag ! used to control soil hydrology properties (namelist) - - real(r8), pointer :: num_substeps_col (:) ! col adaptive timestep counter - ! NON-VIC - real(r8), pointer :: frost_table_col (:) ! col frost table depth - real(r8), pointer :: zwt_col (:) ! col water table depth - real(r8), pointer :: zwts_col (:) ! col water table depth, the shallower of the two water depths - real(r8), pointer :: zwt_perched_col (:) ! col perched water table depth - real(r8), pointer :: wa_col (:) ! col water in the unconfined aquifer (mm) - real(r8), pointer :: qcharge_col (:) ! col aquifer recharge rate (mm/s) - real(r8), pointer :: fracice_col (:,:) ! col fractional impermeability (-) - real(r8), pointer :: icefrac_col (:,:) ! col fraction of ice - real(r8), pointer :: fcov_col (:) ! col fractional impermeable area - real(r8), pointer :: fsat_col (:) ! col fractional area with water table at surface - real(r8), pointer :: h2osfc_thresh_col (:) ! col level at which h2osfc "percolates" (time constant) - - ! VIC - real(r8), pointer :: hkdepth_col (:) ! col VIC decay factor (m) (time constant) - real(r8), pointer :: b_infil_col (:) ! col VIC b infiltration parameter (time constant) - real(r8), pointer :: ds_col (:) ! col VIC fracton of Dsmax where non-linear baseflow begins (time constant) - real(r8), pointer :: dsmax_col (:) ! col VIC max. velocity of baseflow (mm/day) (time constant) - real(r8), pointer :: Wsvic_col (:) ! col VIC fraction of maximum soil moisutre where non-liear base flow occurs (time constant) - real(r8), pointer :: porosity_col (:,:) ! col VIC porosity (1-bulk_density/soil_density) - real(r8), pointer :: vic_clm_fract_col (:,:,:) ! col VIC fraction of VIC layers in CLM layers - real(r8), pointer :: depth_col (:,:) ! col VIC layer depth of upper layer - real(r8), pointer :: c_param_col (:) ! col VIC baseflow exponent (Qb) - real(r8), pointer :: expt_col (:,:) ! col VIC pore-size distribution related paramter(Q12) - real(r8), pointer :: ksat_col (:,:) ! col VIC Saturated hydrologic conductivity - real(r8), pointer :: phi_s_col (:,:) ! col VIC soil moisture dissusion parameter - real(r8), pointer :: moist_col (:,:) ! col VIC soil moisture (kg/m2) for VIC soil layers - real(r8), pointer :: moist_vol_col (:,:) ! col VIC volumetric soil moisture for VIC soil layers - real(r8), pointer :: max_moist_col (:,:) ! col VIC max layer moist + ice (mm) - real(r8), pointer :: max_infil_col (:) ! col VIC maximum infiltration rate calculated in VIC - real(r8), pointer :: i_0_col (:) ! col VIC average saturation in top soil layers - real(r8), pointer :: ice_col (:,:) ! col VIC soil ice (kg/m2) for VIC soil layers - - contains - - ! Public routines - procedure, public :: Init - procedure, public :: Restart - - ! Private routines - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, private :: ReadNL - - end type soilhydrology_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) - - class(soilhydrology_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename - - call this%ReadNL(NLFilename) - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%num_substeps_col (begc:endc)) ; this%num_substeps_col (:) = nan - allocate(this%frost_table_col (begc:endc)) ; this%frost_table_col (:) = nan - allocate(this%zwt_col (begc:endc)) ; this%zwt_col (:) = nan - allocate(this%zwt_perched_col (begc:endc)) ; this%zwt_perched_col (:) = nan - allocate(this%zwts_col (begc:endc)) ; this%zwts_col (:) = nan - - allocate(this%wa_col (begc:endc)) ; this%wa_col (:) = nan - allocate(this%qcharge_col (begc:endc)) ; this%qcharge_col (:) = nan - allocate(this%fracice_col (begc:endc,nlevgrnd)) ; this%fracice_col (:,:) = nan - allocate(this%icefrac_col (begc:endc,nlevgrnd)) ; this%icefrac_col (:,:) = nan - allocate(this%fcov_col (begc:endc)) ; this%fcov_col (:) = nan - allocate(this%fsat_col (begc:endc)) ; this%fsat_col (:) = nan - allocate(this%h2osfc_thresh_col (begc:endc)) ; this%h2osfc_thresh_col (:) = nan - - allocate(this%hkdepth_col (begc:endc)) ; this%hkdepth_col (:) = nan - allocate(this%b_infil_col (begc:endc)) ; this%b_infil_col (:) = nan - allocate(this%ds_col (begc:endc)) ; this%ds_col (:) = nan - allocate(this%dsmax_col (begc:endc)) ; this%dsmax_col (:) = nan - allocate(this%Wsvic_col (begc:endc)) ; this%Wsvic_col (:) = nan - allocate(this%depth_col (begc:endc,nlayert)) ; this%depth_col (:,:) = nan - allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = nan - allocate(this%vic_clm_fract_col (begc:endc,nlayer, nlevsoi)) ; this%vic_clm_fract_col (:,:,:) = nan - allocate(this%c_param_col (begc:endc)) ; this%c_param_col (:) = nan - allocate(this%expt_col (begc:endc,nlayer)) ; this%expt_col (:,:) = nan - allocate(this%ksat_col (begc:endc,nlayer)) ; this%ksat_col (:,:) = nan - allocate(this%phi_s_col (begc:endc,nlayer)) ; this%phi_s_col (:,:) = nan - allocate(this%moist_col (begc:endc,nlayert)) ; this%moist_col (:,:) = nan - allocate(this%moist_vol_col (begc:endc,nlayert)) ; this%moist_vol_col (:,:) = nan - allocate(this%max_moist_col (begc:endc,nlayer)) ; this%max_moist_col (:,:) = nan - allocate(this%max_infil_col (begc:endc)) ; this%max_infil_col (:) = nan - allocate(this%i_0_col (begc:endc)) ; this%i_0_col (:) = nan - allocate(this%ice_col (begc:endc,nlayert)) ; this%ice_col (:,:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - this%wa_col(begc:endc) = spval - call hist_addfld1d (fname='WA', units='mm', & - avgflag='A', long_name='water in the unconfined aquifer (vegetated landunits only)', & - ptr_col=this%wa_col, l2g_scale_type='veg') - - this%qcharge_col(begc:endc) = spval - call hist_addfld1d (fname='QCHARGE', units='mm/s', & - avgflag='A', long_name='aquifer recharge rate (vegetated landunits only)', & - ptr_col=this%qcharge_col, l2g_scale_type='veg') - - this%fcov_col(begc:endc) = spval - call hist_addfld1d (fname='FCOV', units='unitless', & - avgflag='A', long_name='fractional impermeable area', & - ptr_col=this%fcov_col, l2g_scale_type='veg') - - this%fsat_col(begc:endc) = spval - call hist_addfld1d (fname='FSAT', units='unitless', & - avgflag='A', long_name='fractional area with water table at surface', & - ptr_col=this%fsat_col, l2g_scale_type='veg') - - this%num_substeps_col(begc:endc) = spval - call hist_addfld1d (fname='NSUBSTEPS', units='unitless', & - avgflag='A', long_name='number of adaptive timesteps in CLM timestep', & - ptr_col=this%num_substeps_col, l2g_scale_type='veg', & - default='inactive') - - this%frost_table_col(begc:endc) = spval - call hist_addfld1d (fname='FROST_TABLE', units='m', & - avgflag='A', long_name='frost table depth (vegetated landunits only)', & - ptr_col=this%frost_table_col, l2g_scale_type='veg', default='inactive') - - this%zwt_col(begc:endc) = spval - call hist_addfld1d (fname='ZWT', units='m', & - avgflag='A', long_name='water table depth (vegetated landunits only)', & - ptr_col=this%zwt_col, l2g_scale_type='veg') - - this%zwt_perched_col(begc:endc) = spval - call hist_addfld1d (fname='ZWT_PERCH', units='m', & - avgflag='A', long_name='perched water table depth (vegetated landunits only)', & - ptr_col=this%zwt_perched_col, l2g_scale_type='veg') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type) , intent(in) :: bounds - ! !LOCAL VARIABLES: - integer :: c ! indices - - !----------------------------------------------------------------------- - - ! Nothing for now - - ! needs to be initialized to spval to avoid problems when - ! averaging for the accum field - do c = bounds%begc, bounds%endc - this%num_substeps_col(c) = spval - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='FROST_TABLE', xtype=ncd_double, & - dim1name='column', & - long_name='frost table depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%frost_table_col) - if (flag == 'read' .and. .not. readvar) then - this%frost_table_col(bounds%begc:bounds%endc) = col%zi(bounds%begc:bounds%endc,nlevsoi) - end if - - call restartvar(ncid=ncid, flag=flag, varname='WA', xtype=ncd_double, & - dim1name='column', & - long_name='water in the unconfined aquifer', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%wa_col) - - call restartvar(ncid=ncid, flag=flag, varname='ZWT', xtype=ncd_double, & - dim1name='column', & - long_name='water table depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%zwt_col) - - call restartvar(ncid=ncid, flag=flag, varname='ZWT_PERCH', xtype=ncd_double, & - dim1name='column', & - long_name='perched water table depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%zwt_perched_col) - if (flag == 'read' .and. .not. readvar) then - this%zwt_perched_col(bounds%begc:bounds%endc) = col%zi(bounds%begc:bounds%endc,nlevsoi) - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine ReadNL( this, NLFilename ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilHydrology - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(soilhydrology_type) :: this - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - integer :: origflag=0 !use to control soil hydraulic properties - integer :: h2osfcflag=1 !If surface water is active or not - character(len=32) :: subname = 'SoilHydrology_readnl' ! subroutine name - !----------------------------------------------------------------------- - - namelist / clm_soilhydrology_inparm / h2osfcflag, origflag - - ! preset values - - origflag = 0 - h2osfcflag = 1 - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clm_soilhydrology_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call find_nlgroup_name(unitn, 'clm_soilhydrology_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_soilhydrology_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_soilhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_soilhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(h2osfcflag, mpicom) - call shr_mpi_bcast(origflag, mpicom) - - this%h2osfcflag = h2osfcflag - this%origflag = origflag - - end subroutine ReadNL - -end Module SoilHydrologyType diff --git a/src/biogeophys/SoilMoistStressMod.F90 b/src/biogeophys/SoilMoistStressMod.F90 deleted file mode 100644 index c472d66dbf..0000000000 --- a/src/biogeophys/SoilMoistStressMod.F90 +++ /dev/null @@ -1,520 +0,0 @@ -module SoilMoistStressMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Calculates soil moisture stress for plant gpp and transpiration - ! - ! After discussion with other developers, I have now removed all functions that - ! return array, and decalared all variables that will be modified as intent(inout). - ! The initialization will be done whenever the variable is initialized. This avoids - ! code crash when initialization is not done appropriately, and make the code safer - ! during the long-term maintenance - ! - ! Created by Jinyun Tang, Feb., 2014 - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: calc_root_moist_stress - public :: calc_effective_soilporosity - public :: calc_effective_snowporosity - public :: calc_volumetric_h2oliq - public :: set_perchroot_opt - public :: init_root_moist_stress - ! - ! !PRIVATE DATA MEMBERS: - integer :: root_moist_stress_method - integer, parameter :: moist_stress_clm_default = 0 !default method for calculating root moisture stress - logical, private :: perchroot = .false. ! true => btran is based only on unfrozen soil levels - logical, private :: perchroot_alt = .false. ! true => btran is based on active layer (defined over two years); - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !-------------------------------------------------------------------------------- - -contains - - !-------------------------------------------------------------------------------- - subroutine init_root_moist_stress() - ! - !DESCRIPTION - !specify the method to compute root soil moisture stress - ! - implicit none - - root_moist_stress_method = moist_stress_clm_default - end subroutine init_root_moist_stress - - !-------------------------------------------------------------------------------- - subroutine set_perchroot_opt(perchroot_global, perchroot_alt_global) - ! - !DESCRIPTIONS - !set up local perchroot logical switches, in the future, this wil be - !read in as namelist - ! - ! !ARGUMENTS: - implicit none - logical, intent(in) :: perchroot_global - logical, intent(in) :: perchroot_alt_global - !------------------------------------------------------------------------------ - - perchroot = perchroot_global - perchroot_alt = perchroot_alt_global - - end subroutine set_perchroot_opt - - !-------------------------------------------------------------------------------- - subroutine calc_effective_soilporosity(bounds, ubj, numf, filter, & - watsat, h2osoi_ice, denice, eff_por) - ! - ! !DESCRIPTIONS - ! compute the effective soil porosity - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: ubj ! lbinning level indices - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: filter(:) ! filter - real(r8) , intent(in) :: watsat( bounds%begc: , 1: ) ! soil porosity - real(r8) , intent(in) :: h2osoi_ice( bounds%begc: , 1: ) ! ice water content, kg H2o/m2 - real(r8) , intent(in) :: denice ! ice density, kg/m3 - real(r8) , intent(inout) :: eff_por( bounds%begc: ,1: ) ! effective porosity - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc !indices - real(r8):: vol_ice !volumetric ice - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(watsat) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_ice) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eff_por) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - - !main calculation loop - !it assumes the soil layers start from 1 - do j = 1, ubj - do fc = 1, numf - c = filter(fc) - !compute the volumetric ice content - vol_ice=min(watsat(c,j), h2osoi_ice(c,j)/(denice*col%dz(c,j))) - - !compute the maximum soil space to fill liquid water and air - eff_por(c,j) = watsat(c,j) - vol_ice - enddo - enddo - end subroutine calc_effective_soilporosity - - !-------------------------------------------------------------------------------- - subroutine calc_effective_snowporosity(bounds, lbj, jtop, numf, filter, & - h2osoi_ice, denice, eff_por) - ! - ! !DESCRIPTIONS - ! compute the effective porosity snow - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use shr_log_mod , only : errMsg => shr_log_errMsg - use ColumnType , only : col - implicit none - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: lbj !ubing level indices - integer , intent(in) :: jtop( bounds%begc: ) !top level for each column [col] - integer , intent(in) :: numf !filter dimension - integer , intent(in) :: filter(:) !filter - real(r8) , intent(in) :: h2osoi_ice( bounds%begc: , lbj: ) !ice water content, kg H2o/m2 - real(r8) , intent(in) :: denice !ice density, kg/m3 - real(r8) , intent(inout) :: eff_por( bounds%begc: ,lbj: ) !returning effective porosity - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc !indices - integer :: ubj - real(r8) :: vol_ice !volumetric ice - !------------------------------------------------------------------------------ - - ubj = 0 - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jtop) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_ice) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eff_por) == (/bounds%endc,0/)) , errMsg(sourcefile, __LINE__)) - - !main calculation loop - - !it assumes snow layer ends at 0 - do j = lbj,0 - do fc = 1, numf - c = filter(fc) - if (j>=jtop(c)) then - !compute the volumetric ice content - vol_ice=min(1._r8, h2osoi_ice(c,j)/(denice*col%dz(c,j))) - - !compute the maximum snow void space to fill liquid water and air - eff_por(c,j) = 1._r8 - vol_ice - endif - enddo - enddo - - end subroutine calc_effective_snowporosity - - !-------------------------------------------------------------------------------- - subroutine calc_volumetric_h2oliq(bounds, jtop, lbj, ubj, numf, filter,& - eff_porosity, h2osoi_liq, denh2o, vol_liq) - ! - ! !DESCRIPTIONS - ! compute the volumetric liquid water content - ! - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: filter(:) ! filter - real(r8) , intent(in) :: eff_porosity(bounds%begc: , lbj: ) ! effective soil porosity - real(r8) , intent(in) :: h2osoi_liq(bounds%begc: , lbj: ) ! liquid water content [kg H2o/m2] - real(r8) , intent(in) :: denh2o ! water density [kg/m3] - real(r8) , intent(inout) :: vol_liq(bounds%begc: , lbj: ) ! volumetric liquid water content - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jtop) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(h2osoi_liq) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eff_porosity) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(vol_liq) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - - !main calculation loop - do j = lbj, ubj - do fc = 1, numf - c = filter(fc) - if(j>=jtop(c))then - - !volume of liquid is no greater than effective void space - vol_liq(c,j) = min(eff_porosity(c,j), h2osoi_liq(c,j)/(col%dz(c,j)*denh2o)) - endif - enddo - enddo - - end subroutine calc_volumetric_h2oliq - - !-------------------------------------------------------------------------------- - subroutine normalize_unfrozen_rootfr(bounds, ubj, fn, filterp, & - canopystate_inst, soilstate_inst, temperature_inst, rootfr_unf) - ! - ! !DESCRIPTIONS - ! normalize root fraction for total unfrozen depth - ! - ! !USES - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : tfrz !temperature where water freezes [K], this is taken as constant at the moment - use decompMod , only : bounds_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use TemperatureType , only : temperature_type - use SoilStateType , only : soilstate_type - use WaterSTateType , only : waterstate_type - use SimpleMathMod , only : array_normalization - use PatchType , only : patch - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: ubj !ubinning level indices - integer , intent(in) :: fn !filter dimension - integer , intent(in) :: filterp(:) !filter - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - real(r8) , intent(inout) :: rootfr_unf(bounds%begp:bounds%endp, 1:ubj) !normalized root fraction in unfrozen layers - ! - ! !LOCAL VARIABLES: - !real(r8) :: rootsum(bounds%begp:bounds%endp) - integer :: p, c, j, f !indices - !------------------------------------------------------------------------------ - - associate( & - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col , & ! Input: [real(r8) (:) ] prior year maximum annual depth of thaw - altmax_indx => canopystate_inst%altmax_indx_col & ! Input: [real(r8) (:) ] maximum annual depth of thaw - ) - - ! main calculation loop - ! Initialize rootfr_unf to zero. - ! I found it necessary to ensure the pgi compiler not - ! to complain with float point exception. However, it raises a question how - ! to make sure those values that are initialized with nan or spval are not reset - ! to zero within similar coding style. Jinyun Tang, May 23, 2014. - - ! Define rootfraction for unfrozen soil only - if (perchroot .or. perchroot_alt) then - if (perchroot_alt) then - ! use total active layer (defined ass max thaw depth for current and prior year) - do j = 1, ubj - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - if ( j <= max(altmax_lastyear_indx(c), altmax_indx(c), 1) )then - rootfr_unf(p,j) = rootfr(p,j) - else - rootfr_unf(p,j) = 0._r8 - end if - end do - end do - else - ! use instantaneous temperature - do j = 1, ubj - do f = 1, fn - p = filterp(f) - c = patch%column(p) - - if (t_soisno(c,j) >= tfrz) then - rootfr_unf(p,j) = rootfr(p,j) - else - rootfr_unf(p,j) = 0._r8 - end if - end do - end do - - end if ! perchroot_alt - end if ! perchroot - - !normalize the root fraction for each pft - call array_normalization(bounds%begp, bounds%endp, 1, ubj, & - fn, filterp, rootfr_unf(bounds%begp:bounds%endp, 1:ubj)) - - end associate - - end subroutine normalize_unfrozen_rootfr - - !-------------------------------------------------------------------------------- - subroutine calc_root_moist_stress_clm45default(bounds, & - nlevgrnd, fn, filterp, rootfr_unf, & - temperature_inst, soilstate_inst, energyflux_inst, waterstate_inst, & - soil_water_retention_curve) - ! - ! DESCRIPTIONS - ! compute the root water stress using the default clm45 approach - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varcon , only : tfrz !temperature where water freezes [K], this is taken as constant at the moment - use pftconMod , only : pftcon - use TemperatureType , only : temperature_type - use SoilStateType , only : soilstate_type - use EnergyFluxType , only : energyflux_type - use WaterSTateType , only : waterstate_type - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use PatchType , only : patch - use clm_varctl , only : iulog, use_hydrstress - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd !number of vertical layers - integer , intent(in) :: fn !number of filters - integer , intent(in) :: filterp(:) !filter array - real(r8) , intent(in) :: rootfr_unf(bounds%begp: , 1: ) - type(energyflux_type) , intent(inout) :: energyflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: btran0 = 0.0_r8 ! initial value - real(r8) :: smp_node, s_node !temporary variables - real(r8) :: smp_node_lf !temporary variable - integer :: p, f, j, c, l !indices - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(rootfr_unf) == (/bounds%endp, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - smpso => pftcon%smpso , & ! Input: soil water potential at full stomatal opening (mm) - smpsc => pftcon%smpsc , & ! Input: soil water potential at full stomatal closure (mm) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) (constant) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) (constant) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" (constant) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - rootfr => soilstate_inst%rootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer - rootr => soilstate_inst%rootr_patch , & ! Output: [real(r8) (:,:) ] effective fraction of roots in each soil layer - - btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) (integrated soil water stress) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] integrated soil water stress square - rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root soil water stress (resistance) by layer (0-1) (nlevgrnd) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - h2osoi_liqvol => waterstate_inst%h2osoi_liqvol_col & ! Output: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR - ) - - do j = 1,nlevgrnd - do f = 1, fn - p = filterp(f) - c = patch%column(p) - l = patch%landunit(p) - - ! Root resistance factors - ! rootr effectively defines the active root fraction in each layer - if (h2osoi_liqvol(c,j) .le. 0._r8 .or. t_soisno(c,j) .le. tfrz-2._r8) then - rootr(p,j) = 0._r8 - else - s_node = max(h2osoi_liqvol(c,j)/eff_porosity(c,j),0.01_r8) - - !smp_node = max(smpsc(patch%itype(p)), -sucsat(c,j)*s_node**(-bsw(c,j))) -! call soil_water_retention_curve%soil_suction(sucsat(c,j), s_node, bsw(c,j), smp_node) -!scs - call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node) -!scs - smp_node = max(smpsc(patch%itype(p)), smp_node) - - rresis(p,j) = min( (eff_porosity(c,j)/watsat(c,j))* & - (smp_node - smpsc(patch%itype(p))) / (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8) - - - if (.not. (perchroot .or. perchroot_alt) ) then - rootr(p,j) = rootfr(p,j)*rresis(p,j) - else - rootr(p,j) = rootfr_unf(p,j)*rresis(p,j) - end if - - !it is possible to further separate out a btran function, but I will leave it for the moment, jyt - if ( .not.(use_hydrstress) ) then - btran(p) = btran(p) + max(rootr(p,j),0._r8) - end if - end if - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - - call soil_water_retention_curve%soil_suction(c, j, s_node, soilstate_inst, smp_node_lf) - - smp_node_lf = max(smpsc(patch%itype(p)), smp_node_lf) - btran2(p) = btran2(p) +rootfr(p,j)*max(0._r8,min((smp_node_lf - smpsc(patch%itype(p))) / & - (smpso(patch%itype(p)) - smpsc(patch%itype(p))), 1._r8)) - end do - end do - - ! Normalize root resistances to get layer contribution to ET - do j = 1,nlevgrnd - do f = 1, fn - p = filterp(f) - if (btran(p) > btran0) then - rootr(p,j) = rootr(p,j)/btran(p) - else - rootr(p,j) = 0._r8 - end if - end do - end do - end associate - - end subroutine calc_root_moist_stress_clm45default - - !-------------------------------------------------------------------------------- - subroutine calc_root_moist_stress(bounds, nlevgrnd, fn, filterp, & - canopystate_inst, energyflux_inst, soilstate_inst, temperature_inst, & - waterstate_inst, soil_water_retention_curve) - ! - ! DESCRIPTIONS - ! compute the root water stress using different approaches - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : tfrz !temperature where water freezes [K], this is taken as constant at the moment - use decompMod , only : bounds_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use TemperatureType , only : temperature_type - use SoilStateType , only : soilstate_type - use WaterSTateType , only : waterstate_type - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use abortutils , only : endrun - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds !bounds - integer , intent(in) :: nlevgrnd - integer , intent(in) :: fn - integer , intent(in) :: filterp(:) - type(canopystate_type) , intent(in) :: canopystate_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - ! - ! !LOCAL VARIABLES: - integer :: p, f, j, c, l ! indices - real(r8) :: smp_node, s_node ! temporary variables - real(r8) :: rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd) ! Rootfraction defined for unfrozen layers only. - character(len=32) :: subname = 'calc_root_moist_stress' ! subroutine name - !------------------------------------------------------------------------------ - - !define normalized rootfraction for unfrozen soil - !define normalized rootfraction for unfrozen soil - rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd) = 0._r8 - - call normalize_unfrozen_rootfr(bounds, & - ubj = nlevgrnd, & - fn = fn, & - filterp = filterp, & - canopystate_inst=canopystate_inst, & - soilstate_inst=soilstate_inst, & - temperature_inst=temperature_inst, & - rootfr_unf=rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd)) - - !suppose h2osoi_liq, eff_porosity are already computed somewhere else - - select case (root_moist_stress_method) - !add other methods later - case (moist_stress_clm_default) - - call calc_root_moist_stress_clm45default(bounds, & - nlevgrnd = nlevgrnd, & - fn = fn, & - filterp = filterp, & - energyflux_inst=energyflux_inst, & - temperature_inst=temperature_inst, & - soilstate_inst=soilstate_inst, & - waterstate_inst=waterstate_inst, & - rootfr_unf=rootfr_unf(bounds%begp:bounds%endp,1:nlevgrnd), & - soil_water_retention_curve=soil_water_retention_curve) - - case default - call endrun(subname // ':: a root moisture stress function must be specified!') - end select - - end subroutine calc_root_moist_stress - -end module SoilMoistStressMod diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 deleted file mode 100644 index a157e16bb6..0000000000 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ /dev/null @@ -1,630 +0,0 @@ -module SoilStateInitTimeConstMod - - !------------------------------------------------------------------------------ - ! DESCRIPTION: - ! Set hydraulic and thermal properties - ! - ! !USES - use SoilStateType , only : soilstate_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilStateInitTimeConst - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: ReadNL - ! - ! !PRIVATE DATA: - ! Control variables (from namelist) - logical, private :: organic_frac_squared ! If organic fraction should be squared (as in CLM4.5) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - ! -contains - - !----------------------------------------------------------------------- - subroutine ReadNL( nlfilename ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilStateType - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use spmdMod , only : mpicom, masterproc - use abortUtils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: nlfilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'SoilState_readnl' ! subroutine name - !----------------------------------------------------------------------- - - character(len=*), parameter :: nl_name = 'clm_soilstate_inparm' ! Namelist name - ! MUST agree with name in namelist and read - namelist / clm_soilstate_inparm / organic_frac_squared - - ! preset values - - organic_frac_squared = .false. - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in '//nl_name//' namelist' - call opnfil (nlfilename, unitn, 'F') - call find_nlgroup_name(unitn, nl_name, status=ierr) - if (ierr == 0) then - read(unit=unitn, nml=clm_soilstate_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(organic_frac_squared, mpicom) - - end subroutine ReadNL - - !----------------------------------------------------------------------- - subroutine SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, ncd_inqdlen - use clm_varpar , only : numpft, numrad - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlevsoifl, nlayer, nlayert, nlevurb, nlevsno - use clm_varcon , only : zsoi, dzsoi, zisoi, spval - use clm_varcon , only : secspday, pc, mu, denh2o, denice, grlnd - use clm_varctl , only : use_cn, use_lch4, use_fates - use clm_varctl , only : iulog, fsurdat, paramfile, soil_layerstruct - use landunit_varcon , only : istdlak, istwet, istsoil, istcrop, istice_mec - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv - use fileutils , only : getfil - use organicFileMod , only : organicrd - use FuncPedotransferMod , only : pedotransf, get_ipedof - use RootBiophysMod , only : init_vegrootfr - use GridcellType , only : grc - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilstate_type) , intent(inout) :: soilstate_inst - character(len=*) , intent(in) :: nlfilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: p, lev, c, l, g, j ! indices - real(r8) :: om_frac ! organic matter fraction - real(r8) :: om_tkm = 0.25_r8 ! thermal conductivity of organic soil (Farouki, 1986) [W/m/K] - real(r8) :: om_watsat_lake = 0.9_r8 ! porosity of organic soil - real(r8) :: om_hksat_lake = 0.1_r8 ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_sucsat_lake = 10.3_r8 ! saturated suction for organic matter (Letts, 2000) - real(r8) :: om_b_lake = 2.7_r8 ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) (lake) - real(r8) :: om_watsat ! porosity of organic soil - real(r8) :: om_hksat ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_sucsat ! saturated suction for organic matter (mm)(Letts, 2000) - real(r8) :: om_csol = 2.5_r8 ! heat capacity of peat soil *10^6 (J/K m3) (Farouki, 1986) - real(r8) :: om_tkd = 0.05_r8 ! thermal conductivity of dry organic soil (Farouki, 1981) - real(r8) :: om_b ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) - real(r8) :: zsapric = 0.5_r8 ! depth (m) that organic matter takes on characteristics of sapric peat - real(r8) :: pcalpha = 0.5_r8 ! percolation threshold - real(r8) :: pcbeta = 0.139_r8 ! percolation exponent - real(r8) :: pc_lake = 0.5_r8 ! percolation threshold - real(r8) :: perc_frac ! "percolating" fraction of organic soil - real(r8) :: perc_norm ! normalize to 1 when 100% organic soil - real(r8) :: uncon_hksat ! series conductivity of mineral/organic soil - real(r8) :: uncon_frac ! fraction of "unconnected" soil - real(r8) :: bd ! bulk density of dry soil material [kg/m^3] - real(r8) :: tkm ! mineral conductivity - real(r8) :: xksat ! maximum hydraulic conductivity of soil [mm/s] - real(r8) :: clay,sand ! temporaries - real(r8) :: organic_max ! organic matter (kg/m3) where soil is assumed to act like peat - integer :: dimid ! dimension id - logical :: readvar - type(file_desc_t) :: ncid ! netcdf id - real(r8) ,pointer :: zsoifl (:) ! Output: [real(r8) (:)] original soil midpoint - real(r8) ,pointer :: zisoifl (:) ! Output: [real(r8) (:)] original soil interface depth - real(r8) ,pointer :: dzsoifl (:) ! Output: [real(r8) (:)] original soil thickness - real(r8) ,pointer :: gti (:) ! read in - fmax - real(r8) ,pointer :: sand3d (:,:) ! read in - soil texture: percent sand (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: clay3d (:,:) ! read in - soil texture: percent clay (needs to be a pointer for use in ncdio) - real(r8) ,pointer :: organic3d (:,:) ! read in - organic matter: kg/m3 (needs to be a pointer for use in ncdio) - character(len=256) :: locfn ! local filename - integer :: ipedof - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - do c = begc,endc - soilstate_inst%smpmin_col(c) = -1.e8_r8 - end do - - ! -------------------------------------------------------------------- - ! Read namelist - ! -------------------------------------------------------------------- - - call ReadNL( nlfilename ) - - ! -------------------------------------------------------------------- - ! Initialize root fraction (computing from surface, d is depth in meter): - ! -------------------------------------------------------------------- - - ! Currently pervious road has same properties as soil - do c = begc,endc - l = col%landunit(c) - - if (lun%urbpoi(l) .and. col%itype(c) == icol_road_perv) then - do lev = 1, nlevgrnd - soilstate_inst%rootfr_road_perv_col(c,lev) = 0._r8 - enddo - do lev = 1,nlevsoi - soilstate_inst%rootfr_road_perv_col(c,lev) = 1.0_r8/real(nlevsoi,r8) - end do -! remove roots below bedrock layer - soilstate_inst%rootfr_road_perv_col(c,1:col%nbedrock(c)) = & - soilstate_inst%rootfr_road_perv_col(c,1:col%nbedrock(c)) & - + sum(soilstate_inst%rootfr_road_perv_col(c,col%nbedrock(c)+1:nlevsoi)) & - /real(col%nbedrock(c)) - soilstate_inst%rootfr_road_perv_col(c,col%nbedrock(c)+1:nlevsoi) = 0._r8 - end if - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - soilstate_inst%rootfr_col (c,nlevsoi+1:nlevgrnd) = 0._r8 - else - ! Inactive CH4 columns - ! (Also includes (lun%itype(l)==istdlak .and. allowlakeprod), which used to be - ! in a separate branch of the conditional) - soilstate_inst%rootfr_col (c,:) = spval - end if - end do - - ! Initialize root fraction - ! Note that fates has its own root fraction root fraction routine and should not - ! use the following since it depends on patch%itype - which fates should not use - - if (.not. use_fates) then - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - soilstate_inst%rootfr_patch(begp:endp,1:nlevgrnd),'water') - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - soilstate_inst%crootfr_patch(begp:endp,1:nlevgrnd),'carbon') - end if - - ! -------------------------------------------------------------------- - ! dynamic memory allocation - ! -------------------------------------------------------------------- - - allocate(sand3d(begg:endg,nlevsoifl)) - allocate(clay3d(begg:endg,nlevsoifl)) - - ! Determine organic_max from parameter file - - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_io(ncid=ncid, varname='organic_max', flag='read', data=organic_max, readvar=readvar) - if ( .not. readvar ) call endrun(msg=' ERROR: organic_max not on param file'//errMsg(sourcefile, __LINE__)) - call ncd_pio_closefile(ncid) - - ! -------------------------------------------------------------------- - ! Read surface dataset - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to read soil color, sand and clay boundary data .....' - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! Read in organic matter dataset - - allocate(organic3d(begg:endg,nlevsoifl)) - call organicrd(organic3d) - - ! Read in sand and clay data - - call ncd_io(ncid=ncid, varname='PCT_SAND', flag='read', data=sand3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_SAND NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='PCT_CLAY', flag='read', data=clay3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: PCT_CLAY NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - - do p = begp,endp - g = patch%gridcell(p) - if ( sand3d(g,1)+clay3d(g,1) == 0.0_r8 )then - if ( any( sand3d(g,:)+clay3d(g,:) /= 0.0_r8 ) )then - call endrun(msg='found depth points that do NOT sum to zero when surface does'//& - errMsg(sourcefile, __LINE__)) - end if - sand3d(g,:) = 1.0_r8 - clay3d(g,:) = 1.0_r8 - end if - if ( any( sand3d(g,:)+clay3d(g,:) == 0.0_r8 ) )then - call endrun(msg='after setting, found points sum to zero'//errMsg(sourcefile, __LINE__)) - end if - - soilstate_inst%sandfrac_patch(p) = sand3d(g,1)/100.0_r8 - soilstate_inst%clayfrac_patch(p) = clay3d(g,1)/100.0_r8 - end do - - ! Read fmax - - allocate(gti(begg:endg)) - call ncd_io(ncid=ncid, varname='FMAX', flag='read', data=gti, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: FMAX NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = begc, endc - g = col%gridcell(c) - soilstate_inst%wtfact_col(c) = gti(g) - end do - deallocate(gti) - - ! Close file - - call ncd_pio_closefile(ncid) - - ! -------------------------------------------------------------------- - ! get original soil depths to be used in interpolation of sand and clay - ! -------------------------------------------------------------------- - - allocate(zsoifl(1:nlevsoifl), zisoifl(0:nlevsoifl), dzsoifl(1:nlevsoifl)) - do j = 1, nlevsoifl - zsoifl(j) = 0.025*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - dzsoifl(1) = 0.5_r8*(zsoifl(1)+zsoifl(2)) !thickness b/n two interfaces - do j = 2,nlevsoifl-1 - dzsoifl(j)= 0.5_r8*(zsoifl(j+1)-zsoifl(j-1)) - enddo - dzsoifl(nlevsoifl) = zsoifl(nlevsoifl)-zsoifl(nlevsoifl-1) - - zisoifl(0) = 0._r8 - do j = 1, nlevsoifl-1 - zisoifl(j) = 0.5_r8*(zsoifl(j)+zsoifl(j+1)) !interface depths - enddo - zisoifl(nlevsoifl) = zsoifl(nlevsoifl) + 0.5_r8*dzsoifl(nlevsoifl) - - ! -------------------------------------------------------------------- - ! Set soil hydraulic and thermal properties: non-lake - ! -------------------------------------------------------------------- - - ! urban roof, sunwall and shadewall thermal properties used to - ! derive thermal conductivity and heat capacity are set to special - ! value because thermal conductivity and heat capacity for urban - ! roof, sunwall and shadewall are prescribed in SoilThermProp.F90 - ! in SoilPhysicsMod.F90 - - - do c = begc, endc - g = col%gridcell(c) - l = col%landunit(c) - - if (lun%itype(l)==istwet .or. lun%itype(l)==istice_mec) then - - do lev = 1,nlevgrnd - soilstate_inst%bsw_col(c,lev) = spval - soilstate_inst%watsat_col(c,lev) = spval - soilstate_inst%watfc_col(c,lev) = spval - soilstate_inst%hksat_col(c,lev) = spval - soilstate_inst%sucsat_col(c,lev) = spval - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - soilstate_inst%bd_col(c,lev) = spval - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = spval - soilstate_inst%cellclay_col(c,lev) = spval - soilstate_inst%cellorg_col(c,lev) = spval - end if - end do - - do lev = 1,nlevgrnd - soilstate_inst%tkmg_col(c,lev) = spval - soilstate_inst%tksatu_col(c,lev) = spval - soilstate_inst%tkdry_col(c,lev) = spval - soilstate_inst%csol_col(c,lev)= spval - end do - - else if (lun%urbpoi(l) .and. (col%itype(c) /= icol_road_perv) .and. (col%itype(c) /= icol_road_imperv) )then - - ! Urban Roof, sunwall, shadewall properties set to special value - do lev = 1,nlevgrnd - soilstate_inst%watsat_col(c,lev) = spval - soilstate_inst%watfc_col(c,lev) = spval - soilstate_inst%bsw_col(c,lev) = spval - soilstate_inst%hksat_col(c,lev) = spval - soilstate_inst%sucsat_col(c,lev) = spval - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - soilstate_inst%bd_col(c,lev) = spval - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = spval - soilstate_inst%cellclay_col(c,lev) = spval - soilstate_inst%cellorg_col(c,lev) = spval - end if - end do - - do lev = 1,nlevgrnd - soilstate_inst%tkmg_col(c,lev) = spval - soilstate_inst%tksatu_col(c,lev) = spval - soilstate_inst%tkdry_col(c,lev) = spval - soilstate_inst%csol_col(c,lev) = spval - end do - - else - - do lev = 1,nlevgrnd - ! DML - this if statement could probably be removed and just the - ! top part used for all soil layer structures - if ( soil_layerstruct /= '10SL_3.5m' )then ! apply soil texture from 10 layer input dataset - if (lev .eq. 1) then - clay = clay3d(g,1) - sand = sand3d(g,1) - om_frac = organic3d(g,1)/organic_max - else if (lev <= nlevsoi) then - do j = 1,nlevsoifl-1 - if (zisoi(lev) >= zisoifl(j) .AND. zisoi(lev) < zisoifl(j+1)) then - clay = clay3d(g,j+1) - sand = sand3d(g,j+1) - om_frac = organic3d(g,j+1)/organic_max - endif - end do - else - clay = clay3d(g,nlevsoifl) - sand = sand3d(g,nlevsoifl) - om_frac = 0._r8 - endif - else - if (lev <= nlevsoi) then ! duplicate clay and sand values from 10th soil layer - clay = clay3d(g,lev) - sand = sand3d(g,lev) - if ( organic_frac_squared )then - om_frac = (organic3d(g,lev)/organic_max)**2._r8 - else - om_frac = organic3d(g,lev)/organic_max - end if - else - clay = clay3d(g,nlevsoi) - sand = sand3d(g,nlevsoi) - om_frac = 0._r8 - endif - end if - - if (lun%itype(l) == istdlak) then - - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = sand - soilstate_inst%cellclay_col(c,lev) = clay - soilstate_inst%cellorg_col(c,lev) = om_frac*organic_max - end if - - else if (lun%itype(l) /= istdlak) then ! soil columns of both urban and non-urban types - - if (lun%urbpoi(l)) then - om_frac = 0._r8 ! No organic matter for urban - end if - - if (lev <= nlevsoi) then - soilstate_inst%cellsand_col(c,lev) = sand - soilstate_inst%cellclay_col(c,lev) = clay - soilstate_inst%cellorg_col(c,lev) = om_frac*organic_max - end if - - ! Note that the following properties are overwritten for urban impervious road - ! layers that are not soil in SoilThermProp.F90 within SoilTemperatureMod.F90 - - !determine the type of pedotransfer function to be used based on soil order - !I will use the following implementation to further explore the ET problem, now - !I set soil order to 0 for all soils. Jinyun Tang, Mar 20, 2014 - - ipedof=get_ipedof(0) - call pedotransf(ipedof, sand, clay, & - soilstate_inst%watsat_col(c,lev), soilstate_inst%bsw_col(c,lev), soilstate_inst%sucsat_col(c,lev), xksat) - - om_watsat = max(0.93_r8 - 0.1_r8 *(zsoi(lev)/zsapric), 0.83_r8) - om_b = min(2.7_r8 + 9.3_r8 *(zsoi(lev)/zsapric), 12.0_r8) - om_sucsat = min(10.3_r8 - 0.2_r8 *(zsoi(lev)/zsapric), 10.1_r8) - om_hksat = max(0.28_r8 - 0.2799_r8*(zsoi(lev)/zsapric), xksat) - - soilstate_inst%bd_col(c,lev) = (1._r8 - soilstate_inst%watsat_col(c,lev))*2.7e3_r8 - soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac) * soilstate_inst%watsat_col(c,lev) + om_watsat*om_frac - tkm = (1._r8-om_frac) * (8.80_r8*sand+2.92_r8*clay)/(sand+clay)+om_tkm*om_frac ! W/(m K) - soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac) * (2.91_r8 + 0.159_r8*clay) + om_frac*om_b - soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac) * soilstate_inst%sucsat_col(c,lev) + om_sucsat*om_frac - soilstate_inst%hksat_min_col(c,lev) = xksat - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_frac > pcalpha) then - perc_norm=(1._r8 - pcalpha)**(-pcbeta) - perc_frac=perc_norm*(om_frac - pcalpha)**pcbeta - else - perc_frac=0._r8 - endif - - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac=(1._r8-om_frac)+(1._r8-perc_frac)*om_frac - - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_frac < 1._r8) then - uncon_hksat=uncon_frac/((1._r8-om_frac)/xksat & - +((1._r8-perc_frac)*om_frac)/om_hksat) - else - uncon_hksat = 0._r8 - end if - soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat - - soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) - - soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) - - soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*soilstate_inst%bd_col(c,lev) + 64.7_r8) / & - (2.7e3_r8 - 0.947_r8*soilstate_inst%bd_col(c,lev)))*(1._r8-om_frac) + om_tkd*om_frac - - soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol*om_frac)*1.e6_r8 ! J/(m3 K) - - soilstate_inst%watdry_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & - (316230._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - soilstate_inst%watopt_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & - (158490._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - - !! added by K.Sakaguchi for beta from Lee and Pielke, 1992 - ! water content at field capacity, defined as hk = 0.1 mm/day - ! used eqn (7.70) in CLM3 technote with k = 0.1 (mm/day) / secspday (day/sec) - soilstate_inst%watfc_col(c,lev) = soilstate_inst%watsat_col(c,lev) * & - (0.1_r8 / (soilstate_inst%hksat_col(c,lev)*secspday))**(1._r8/(2._r8*soilstate_inst%bsw_col(c,lev)+3._r8)) - end if - end do - - ! Urban pervious and impervious road - if (col%itype(c) == icol_road_imperv) then - ! Impervious road layers -- same as above except set watdry and watopt as missing - do lev = 1,nlevgrnd - soilstate_inst%watdry_col(c,lev) = spval - soilstate_inst%watopt_col(c,lev) = spval - end do - else if (col%itype(c) == icol_road_perv) then - ! pervious road layers - set in UrbanInitTimeConst - end if - - end if - end do - - ! -------------------------------------------------------------------- - ! Set soil hydraulic and thermal properties: lake - ! -------------------------------------------------------------------- - - do c = begc, endc - g = col%gridcell(c) - l = col%landunit(c) - - if (lun%itype(l)==istdlak) then - - do lev = 1,nlevgrnd - if ( lev <= nlevsoi )then - clay = soilstate_inst%cellclay_col(c,lev) - sand = soilstate_inst%cellsand_col(c,lev) - if ( organic_frac_squared )then - om_frac = (soilstate_inst%cellorg_col(c,lev)/organic_max)**2._r8 - else - om_frac = soilstate_inst%cellorg_col(c,lev)/organic_max - end if - else - clay = soilstate_inst%cellclay_col(c,nlevsoi) - sand = soilstate_inst%cellsand_col(c,nlevsoi) - om_frac = 0.0_r8 - end if - - soilstate_inst%watsat_col(c,lev) = 0.489_r8 - 0.00126_r8*sand - - soilstate_inst%bsw_col(c,lev) = 2.91 + 0.159*clay - - soilstate_inst%sucsat_col(c,lev) = 10._r8 * ( 10._r8**(1.88_r8-0.0131_r8*sand) ) - - bd = (1._r8-soilstate_inst%watsat_col(c,lev))*2.7e3_r8 - - soilstate_inst%watsat_col(c,lev) = (1._r8 - om_frac)*soilstate_inst%watsat_col(c,lev) + om_watsat_lake * om_frac - - tkm = (1._r8-om_frac)*(8.80_r8*sand+2.92_r8*clay)/(sand+clay) + om_tkm * om_frac ! W/(m K) - - soilstate_inst%bsw_col(c,lev) = (1._r8-om_frac)*(2.91_r8 + 0.159_r8*clay) + om_frac * om_b_lake - - soilstate_inst%sucsat_col(c,lev) = (1._r8-om_frac)*soilstate_inst%sucsat_col(c,lev) + om_sucsat_lake * om_frac - - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_frac > pc_lake) then - perc_norm = (1._r8 - pc_lake)**(-pcbeta) - perc_frac = perc_norm*(om_frac - pc_lake)**pcbeta - else - perc_frac = 0._r8 - endif - - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac = (1._r8-om_frac) + (1._r8-perc_frac)*om_frac - - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_frac < 1._r8) then - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s - uncon_hksat = uncon_frac/((1._r8-om_frac)/xksat + ((1._r8-perc_frac)*om_frac)/om_hksat_lake) - else - uncon_hksat = 0._r8 - end if - - soilstate_inst%hksat_col(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat_lake - soilstate_inst%tkmg_col(c,lev) = tkm ** (1._r8- soilstate_inst%watsat_col(c,lev)) - soilstate_inst%tksatu_col(c,lev) = soilstate_inst%tkmg_col(c,lev)*0.57_r8**soilstate_inst%watsat_col(c,lev) - soilstate_inst%tkdry_col(c,lev) = ((0.135_r8*bd + 64.7_r8) / (2.7e3_r8 - 0.947_r8*bd))*(1._r8-om_frac) + & - om_tkd * om_frac - soilstate_inst%csol_col(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol * om_frac)*1.e6_r8 ! J/(m3 K) - soilstate_inst%watdry_col(c,lev) = soilstate_inst%watsat_col(c,lev) & - * (316230._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - soilstate_inst%watopt_col(c,lev) = soilstate_inst%watsat_col(c,lev) & - * (158490._r8/soilstate_inst%sucsat_col(c,lev)) ** (-1._r8/soilstate_inst%bsw_col(c,lev)) - - !! added by K.Sakaguchi for beta from Lee and Pielke, 1992 - ! water content at field capacity, defined as hk = 0.1 mm/day - ! used eqn (7.70) in CLM3 technote with k = 0.1 (mm/day) / (# seconds/day) - soilstate_inst%watfc_col(c,lev) = soilstate_inst%watsat_col(c,lev) * (0.1_r8 / & - (soilstate_inst%hksat_col(c,lev)*secspday))**(1._r8/(2._r8*soilstate_inst%bsw_col(c,lev)+3._r8)) - end do - endif - - end do - - ! -------------------------------------------------------------------- - ! Initialize threshold soil moisture and mass fracion of clay limited to 0.20 - ! -------------------------------------------------------------------- - - do c = begc,endc - g = col%gridcell(c) - - soilstate_inst%gwc_thr_col(c) = 0.17_r8 + 0.14_r8 * clay3d(g,1) * 0.01_r8 - soilstate_inst%mss_frc_cly_vld_col(c) = min(clay3d(g,1) * 0.01_r8, 0.20_r8) - end do - - ! -------------------------------------------------------------------- - ! Deallocate memory - ! -------------------------------------------------------------------- - - deallocate(sand3d, clay3d, organic3d) - deallocate(zisoifl, zsoifl, dzsoifl) - - end subroutine SoilStateInitTimeConst - -end module SoilStateInitTimeConstMod diff --git a/src/biogeophys/SoilStateType.F90 b/src/biogeophys/SoilStateType.F90 deleted file mode 100644 index 18baac4976..0000000000 --- a/src/biogeophys/SoilStateType.F90 +++ /dev/null @@ -1,417 +0,0 @@ -module SoilStateType - - !------------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, nlayer, nlevsno - use clm_varcon , only : spval - use clm_varctl , only : use_hydrstress, use_cn, use_lch4, use_dynroot - use clm_varctl , only : iulog, hist_wrtch4diag - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: soilstate_type - - ! sand/ clay/ organic matter - real(r8), pointer :: sandfrac_patch (:) ! patch sand fraction - real(r8), pointer :: clayfrac_patch (:) ! patch clay fraction - real(r8), pointer :: mss_frc_cly_vld_col (:) ! col mass fraction clay limited to 0.20 - real(r8), pointer :: cellorg_col (:,:) ! col organic matter for gridcell containing column (1:nlevsoi) - real(r8), pointer :: cellsand_col (:,:) ! sand value for gridcell containing column (1:nlevsoi) - real(r8), pointer :: cellclay_col (:,:) ! clay value for gridcell containing column (1:nlevsoi) - real(r8), pointer :: bd_col (:,:) ! col bulk density of dry soil material [kg/m^3] (CN) - - ! hydraulic properties - real(r8), pointer :: hksat_col (:,:) ! col hydraulic conductivity at saturation (mm H2O /s) - real(r8), pointer :: hksat_min_col (:,:) ! col mineral hydraulic conductivity at saturation (hksat) (mm/s) - real(r8), pointer :: hk_l_col (:,:) ! col hydraulic conductivity (mm/s) - real(r8), pointer :: smp_l_col (:,:) ! col soil matric potential (mm) - real(r8), pointer :: smpmin_col (:) ! col restriction for min of soil potential (mm) - real(r8), pointer :: bsw_col (:,:) ! col Clapp and Hornberger "b" (nlevgrnd) - real(r8), pointer :: watsat_col (:,:) ! col volumetric soil water at saturation (porosity) - real(r8), pointer :: watdry_col (:,:) ! col btran parameter for btran = 0 - real(r8), pointer :: watopt_col (:,:) ! col btran parameter for btran = 1 - real(r8), pointer :: watfc_col (:,:) ! col volumetric soil water at field capacity (nlevsoi) - real(r8), pointer :: sucsat_col (:,:) ! col minimum soil suction (mm) (nlevgrnd) - real(r8), pointer :: dsl_col (:) ! col dry surface layer thickness (mm) - real(r8), pointer :: soilresis_col (:) ! col soil evaporative resistance S&L14 (s/m) - real(r8), pointer :: soilbeta_col (:) ! col factor that reduces ground evaporation L&P1992(-) - real(r8), pointer :: soilalpha_col (:) ! col factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: soilalpha_u_col (:) ! col urban factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: soilpsi_col (:,:) ! col soil water potential in each soil layer (MPa) (CN) - real(r8), pointer :: wtfact_col (:) ! col maximum saturated fraction for a gridcell - real(r8), pointer :: porosity_col (:,:) ! col soil porisity (1-bulk_density/soil_density) (VIC) - real(r8), pointer :: eff_porosity_col (:,:) ! col effective porosity = porosity - vol_ice (nlevgrnd) - real(r8), pointer :: gwc_thr_col (:) ! col threshold soil moisture based on clay content -!scs: vangenuchten - real(r8), pointer :: msw_col (:,:) ! col vanGenuchtenClapp "m" - real(r8), pointer :: nsw_col (:,:) ! col vanGenuchtenClapp "n" - real(r8), pointer :: alphasw_col (:,:) ! col vanGenuchtenClapp "nalpha" - real(r8), pointer :: watres_col (:,:) ! residual soil water content - ! thermal conductivity / heat capacity - real(r8), pointer :: thk_col (:,:) ! col thermal conductivity of each layer [W/m-K] - real(r8), pointer :: tkmg_col (:,:) ! col thermal conductivity, soil minerals [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: tkdry_col (:,:) ! col thermal conductivity, dry soil (W/m/Kelvin) (nlevgrnd) - real(r8), pointer :: tksatu_col (:,:) ! col thermal conductivity, saturated soil [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: csol_col (:,:) ! col heat capacity, soil solids (J/m**3/Kelvin) (nlevgrnd) - - ! roots - real(r8), pointer :: rootr_patch (:,:) ! patch effective fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootr_col (:,:) ! col effective fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootfr_col (:,:) ! col fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootfr_patch (:,:) ! patch fraction of roots for water in each soil layer (nlevgrnd) - real(r8), pointer :: crootfr_patch (:,:) ! patch fraction of roots for carbon in each soil layer (nlevgrnd) - real(r8), pointer :: root_depth_patch (:) ! root depth - real(r8), pointer :: rootr_road_perv_col (:,:) ! col effective fraction of roots in each soil layer of urban pervious road - real(r8), pointer :: rootfr_road_perv_col (:,:) ! col effective fraction of roots in each soil layer of urban pervious road - real(r8), pointer :: k_soil_root_patch (:,:) ! patch soil-root interface conductance [mm/s] - real(r8), pointer :: root_conductance_patch(:,:) ! patch root conductance [mm/s] - real(r8), pointer :: soil_conductance_patch(:,:) ! patch soil conductance [mm/s] - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type soilstate_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%mss_frc_cly_vld_col (begc:endc)) ; this%mss_frc_cly_vld_col (:) = nan - allocate(this%sandfrac_patch (begp:endp)) ; this%sandfrac_patch (:) = nan - allocate(this%clayfrac_patch (begp:endp)) ; this%clayfrac_patch (:) = nan - allocate(this%cellorg_col (begc:endc,nlevsoi)) ; this%cellorg_col (:,:) = nan - allocate(this%cellsand_col (begc:endc,nlevsoi)) ; this%cellsand_col (:,:) = nan - allocate(this%cellclay_col (begc:endc,nlevsoi)) ; this%cellclay_col (:,:) = nan - allocate(this%bd_col (begc:endc,nlevgrnd)) ; this%bd_col (:,:) = nan - - allocate(this%hksat_col (begc:endc,nlevgrnd)) ; this%hksat_col (:,:) = spval - allocate(this%hksat_min_col (begc:endc,nlevgrnd)) ; this%hksat_min_col (:,:) = spval - allocate(this%hk_l_col (begc:endc,nlevgrnd)) ; this%hk_l_col (:,:) = nan - allocate(this%smp_l_col (begc:endc,nlevgrnd)) ; this%smp_l_col (:,:) = nan - allocate(this%smpmin_col (begc:endc)) ; this%smpmin_col (:) = nan - - allocate(this%bsw_col (begc:endc,nlevgrnd)) ; this%bsw_col (:,:) = nan - allocate(this%watsat_col (begc:endc,nlevgrnd)) ; this%watsat_col (:,:) = nan - allocate(this%watdry_col (begc:endc,nlevgrnd)) ; this%watdry_col (:,:) = spval - allocate(this%watopt_col (begc:endc,nlevgrnd)) ; this%watopt_col (:,:) = spval - allocate(this%watfc_col (begc:endc,nlevgrnd)) ; this%watfc_col (:,:) = nan - allocate(this%sucsat_col (begc:endc,nlevgrnd)) ; this%sucsat_col (:,:) = spval - allocate(this%dsl_col (begc:endc)) ; this%dsl_col (:) = spval!nan - allocate(this%soilresis_col (begc:endc)) ; this%soilresis_col (:) = spval!nan - allocate(this%soilbeta_col (begc:endc)) ; this%soilbeta_col (:) = nan - allocate(this%soilalpha_col (begc:endc)) ; this%soilalpha_col (:) = nan - allocate(this%soilalpha_u_col (begc:endc)) ; this%soilalpha_u_col (:) = nan - allocate(this%soilpsi_col (begc:endc,nlevgrnd)) ; this%soilpsi_col (:,:) = nan - allocate(this%wtfact_col (begc:endc)) ; this%wtfact_col (:) = nan - allocate(this%porosity_col (begc:endc,nlayer)) ; this%porosity_col (:,:) = spval - allocate(this%eff_porosity_col (begc:endc,nlevgrnd)) ; this%eff_porosity_col (:,:) = spval - allocate(this%gwc_thr_col (begc:endc)) ; this%gwc_thr_col (:) = nan - - allocate(this%thk_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%thk_col (:,:) = nan - allocate(this%tkmg_col (begc:endc,nlevgrnd)) ; this%tkmg_col (:,:) = nan - allocate(this%tkdry_col (begc:endc,nlevgrnd)) ; this%tkdry_col (:,:) = nan - allocate(this%tksatu_col (begc:endc,nlevgrnd)) ; this%tksatu_col (:,:) = nan - allocate(this%csol_col (begc:endc,nlevgrnd)) ; this%csol_col (:,:) = nan - - allocate(this%rootr_patch (begp:endp,1:nlevgrnd)) ; this%rootr_patch (:,:) = nan - allocate(this%root_depth_patch (begp:endp)) ; this%root_depth_patch (:) = nan - allocate(this%rootr_col (begc:endc,nlevgrnd)) ; this%rootr_col (:,:) = nan - allocate(this%rootr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootr_road_perv_col (:,:) = nan - allocate(this%rootfr_patch (begp:endp,1:nlevgrnd)) ; this%rootfr_patch (:,:) = nan - allocate(this%crootfr_patch (begp:endp,1:nlevgrnd)) ; this%crootfr_patch (:,:) = nan - allocate(this%rootfr_col (begc:endc,1:nlevgrnd)) ; this%rootfr_col (:,:) = nan - allocate(this%rootfr_road_perv_col (begc:endc,1:nlevgrnd)) ; this%rootfr_road_perv_col (:,:) = nan - allocate(this%k_soil_root_patch (begp:endp,1:nlevsoi)) ; this%k_soil_root_patch (:,:) = nan - allocate(this%root_conductance_patch(begp:endp,1:nlevsoi)) ; this%root_conductance_patch (:,:) = nan - allocate(this%soil_conductance_patch(begp:endp,1:nlevsoi)) ; this%soil_conductance_patch (:,:) = nan - allocate(this%msw_col (begc:endc,1:nlevgrnd)) ; this%msw_col (:,:) = nan - allocate(this%nsw_col (begc:endc,1:nlevgrnd)) ; this%nsw_col (:,:) = nan - allocate(this%alphasw_col (begc:endc,1:nlevgrnd)) ; this%alphasw_col (:,:) = nan - allocate(this%watres_col (begc:endc,1:nlevgrnd)) ; this%watres_col (:,:) = nan - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use histFileMod , only: hist_addfld1d, hist_addfld2d, no_snow_normal - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - - if (use_lch4) then - if (hist_wrtch4diag) then - active = "active" - else - active = "inactive" - end if - else - active = "inactive" - end if - - call hist_addfld2d (fname='SMP', units='mm', type2d='levgrnd', & - avgflag='A', long_name='soil matric potential (vegetated landunits only)', & - ptr_col=this%smp_l_col, set_spec=spval, l2g_scale_type='veg') - - this%root_conductance_patch(begp:endp,:) = spval - call hist_addfld2d (fname='KROOT', units='1/s', type2d='levsoi', & - avgflag='A', long_name='root conductance each soil layer', & - ptr_patch=this%root_conductance_patch, default='inactive') - - this%soil_conductance_patch(begp:endp,:) = spval - call hist_addfld2d (fname='KSOIL', units='1/s', type2d='levsoi', & - avgflag='A', long_name='soil conductance in each soil layer', & - ptr_patch=this%soil_conductance_patch, default='inactive') - - if (use_cn) then - this%bsw_col(begc:endc,:) = spval - call hist_addfld2d (fname='bsw', units='unitless', type2d='levgrnd', & - avgflag='A', long_name='clap and hornberger B', & - ptr_col=this%bsw_col, default='inactive') - end if - - if (use_dynroot) then - this%rootfr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ROOTFR', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='fraction of roots in each soil layer', & - ptr_patch=this%rootfr_patch, default='active') - end if - - if ( use_dynroot ) then - this%root_depth_patch(begp:endp) = spval - call hist_addfld1d (fname='ROOT_DEPTH', units="m", & - avgflag='A', long_name='rooting depth', & - ptr_patch=this%root_depth_patch ) - end if - - if (use_cn) then - this%rootr_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ROOTR', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective fraction of roots in each soil layer', & - ptr_patch=this%rootr_patch, default='inactive') - end if - - if (use_cn) then - this%rootr_col(begc:endc,:) = spval - call hist_addfld2d (fname='ROOTR_COLUMN', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective fraction of roots in each soil layer', & - ptr_col=this%rootr_col, default='inactive') - - end if - - if (use_cn) then - this%soilpsi_col(begc:endc,:) = spval - call hist_addfld2d (fname='SOILPSI', units='MPa', type2d='levgrnd', & - avgflag='A', long_name='soil water potential in each soil layer', & - ptr_col=this%soilpsi_col, default='inactive') - end if - - this%thk_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%thk_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_TK', units='W/m-K', type2d='levsno', & - avgflag='A', long_name='Thermal conductivity', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_TK_ICE', units='W/m-K', type2d='levsno', & - avgflag='A', long_name='Thermal conductivity (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%hk_l_col(begc:endc,:) = spval - call hist_addfld2d (fname='HK', units='mm/s', type2d='levgrnd', & - avgflag='A', long_name='hydraulic conductivity (vegetated landunits only)', & - ptr_col=this%hk_l_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - - this%soilalpha_col(begc:endc) = spval - call hist_addfld1d (fname='SoilAlpha', units='unitless', & - avgflag='A', long_name='factor limiting ground evap', & - ptr_col=this%soilalpha_col, set_urb=spval, default='inactive' ) - - this%soilalpha_u_col(begc:endc) = spval - call hist_addfld1d (fname='SoilAlpha_U', units='unitless', & - avgflag='A', long_name='urban factor limiting ground evap', & - ptr_col=this%soilalpha_u_col, set_nourb=spval, default='inactive') - - if (use_cn) then - this%watsat_col(begc:endc,:) = spval - call hist_addfld2d (fname='watsat', units='m^3/m^3', type2d='levgrnd', & - avgflag='A', long_name='water saturated', & - ptr_col=this%watsat_col, default='inactive') - end if - - if (use_cn) then - this%eff_porosity_col(begc:endc,:) = spval - call hist_addfld2d (fname='EFF_POROSITY', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective porosity = porosity - vol_ice', & - ptr_col=this%eff_porosity_col, default='inactive') - end if - - if (use_cn) then - this%watfc_col(begc:endc,:) = spval - call hist_addfld2d (fname='watfc', units='m^3/m^3', type2d='levgrnd', & - avgflag='A', long_name='water field capacity', & - ptr_col=this%watfc_col, default='inactive') - end if - - this%soilresis_col(begc:endc) = spval - call hist_addfld1d (fname='SOILRESIS', units='s/m', & - avgflag='A', long_name='soil resistance to evaporation', & - ptr_col=this%soilresis_col) - - this%dsl_col(begc:endc) = spval - call hist_addfld1d (fname='DSL', units='mm', & - avgflag='A', long_name='dry surface layer thickness', & - ptr_col=this%dsl_col) - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! Initialize module soil state variables to reasonable values - ! - ! !USES: - use clm_varpar , only : nlevgrnd - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - !----------------------------------------------------------------------- - - this%smp_l_col(bounds%begc:bounds%endc,1:nlevgrnd) = -1000._r8 - this%hk_l_col(bounds%begc:bounds%endc,1:nlevgrnd) = 0._r8 - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double - use restUtilMod - use spmdMod , only : masterproc - use RootBiophysMod , only : init_vegrootfr - ! - ! !ARGUMENTS: - class(soilstate_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: c - logical :: readvar - logical :: readrootfr = .false. - !------------------------------------------------------------------------ - - call restartvar(ncid=ncid, flag=flag, varname='DSL', xtype=ncd_double, & - dim1name='column', long_name='dsl thickness', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%dsl_col) - - call restartvar(ncid=ncid, flag=flag, varname='SOILRESIS', xtype=ncd_double, & - dim1name='column', long_name='soil resistance', units='s/m', & - interpinic_flag='interp', readvar=readvar, data=this%soilresis_col) - - call restartvar(ncid=ncid, flag=flag, varname='SMP', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='soil matric potential', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%smp_l_col) - - call restartvar(ncid=ncid, flag=flag, varname='HK', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='hydraulic conductivity', units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%hk_l_col) - - if( use_dynroot ) then - call restartvar(ncid=ncid, flag=flag, varname='root_depth', xtype=ncd_double, & - dim1name='pft', & - long_name='root depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%root_depth_patch) - - call restartvar(ncid=ncid, flag=flag, varname='rootfr', xtype=ncd_double, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & - long_name='root fraction', units='', & - interpinic_flag='interp', readvar=readrootfr, data=this%rootfr_patch) - else - readrootfr = .false. - end if - if (flag=='read' .and. .not. readrootfr ) then - if (masterproc) then - write(iulog,*) "can't find rootfr in restart (or initial) file..." - write(iulog,*) "Initialize rootfr to default" - end if - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - this%rootfr_patch(bounds%begp:bounds%endp,1:nlevgrnd), 'water') - call init_vegrootfr(bounds, nlevsoi, nlevgrnd, & - this%crootfr_patch(bounds%begp:bounds%endp,1:nlevgrnd), 'carbon') - end if - - end subroutine Restart - -end module SoilStateType diff --git a/src/biogeophys/SoilTemperatureMod.F90 b/src/biogeophys/SoilTemperatureMod.F90 deleted file mode 100644 index 8f4a9760fd..0000000000 --- a/src/biogeophys/SoilTemperatureMod.F90 +++ /dev/null @@ -1,4763 +0,0 @@ -module SoilTemperatureMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates snow and soil temperatures including phase change - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use perf_mod , only : t_startf, t_stopf - use clm_varctl , only : iulog - use UrbanParamsType , only : urbanparams_type - use UrbanTimeVarType , only : urbantv_type - use atm2lndType , only : atm2lnd_type - use CanopyStateType , only : canopystate_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use SolarAbsorbedType , only : solarabs_type - use SoilStateType , only : soilstate_type - use EnergyFluxType , only : energyflux_type - use TemperatureType , only : temperature_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilTemperature - ! - ! -> SoilTemperature: soil/snow and ground temperatures - ! -> SoilTermProp thermal conductivities and heat capacities - ! -> Tridiagonal tridiagonal matrix solution - ! -> PhaseChange phase change of liquid/ice contents - ! - ! (1) Snow and soil temperatures - ! o The volumetric heat capacity is calculated as a linear combination - ! in terms of the volumetric fraction of the constituent phases. - ! o The thermal conductivity of soil is computed from - ! the algorithm of Johansen (as reported by Farouki 1981), and the - ! conductivity of snow is from the formulation used in - ! SNTHERM (Jordan 1991). - ! o Boundary conditions: - ! F = Rnet - Hg - LEg (top), F= 0 (base of the soil column). - ! o Soil / snow temperature is predicted from heat conduction - ! in 10 soil layers and up to nlevsno snow layers. - ! The thermal conductivities at the interfaces between two - ! neighboring layers (j, j+1) are derived from an assumption that - ! the flux across the interface is equal to that from the node j - ! to the interface and the flux from the interface to the node j+1. - ! The equation is solved using the Crank-Nicholson method and - ! results in a tridiagonal system equation. - ! (2) Phase change - ! - ! The following is only public for the sake of unit testing; it should not be called - ! directly by CLM code outside this module - public :: ComputeGroundHeatFluxAndDeriv ! Computes G and dG/dT on surface of standing water, snow and soil - public :: ComputeHeatDiffFluxAndFactor ! Heat diffusion at layer interface and factor used in setting up of banded matrix - public :: SetRHSVec ! Sets up the RHS vector for the numerical solution of temperature for snow/standing-water/soil - public :: SetRHSVec_Snow ! Sets up the RHS vector corresponding to snow layers for Urban+Non-Urban columns - public :: SetRHSVec_SnowUrban ! Sets up the RHS vector corresponding to snow layers for Urban columns - public :: SetRHSVec_SnowUrbanNonRoad ! Sets up the RHS vector corresponding to snow layers for Urban columns that are sunwall, shadewall, and roof columns - public :: SetRHSVec_SnowUrbanRoad ! Sets up the RHS vector corresponding to snow layers for Urban columns that are pervious, and impervious columns - public :: SetRHSVec_SnowNonUrban ! Sets up the RHS vector corresponding to snow layers for Non-Urban columns - public :: SetRHSVec_StandingSurfaceWater ! Sets up the RHS vector corresponding to standing water layers for Urban+Non-Urban columns - public :: SetRHSVec_Soil ! Sets up the RHS vector corresponding to soil layers for Urban+Non-Urban columns - public :: SetRHSVec_SoilUrban ! Sets up the RHS vector corresponding to soil layers for Urban columns - public :: SetRHSVec_SoilUrbanNonRoad ! Sets up the RHS vector corresponding to soil layers for Urban columns that are pervious, and impervious columns - public :: SetRHSVec_SoilUrbanRoad ! Sets up the RHS vector corresponding to soil layers for Urban columns that are pervious, and impervious columns - public :: SetRHSVec_SoilNonUrban ! Sets up the RHS vector corresponding to soil layers for Non-Urban columns - public :: SetRHSVec_Soil_StandingSurfaceWater ! Adds contribution from standing water in the RHS vector corresponding to soil layers - public :: SetMatrix ! Sets up the matrix for the numerical solution of temperature for snow/standing-water/soil - public :: AssembleMatrixFromSubmatrices ! Assemble the full matrix from submatrices. - public :: SetMatrix_Snow ! Set up the matrix entries corresponding to snow layers for Urban+Non-Urban columns - public :: SetMatrix_SnowUrban ! Set up the matrix entries corresponding to snow layers for Urban column - public :: SetMatrix_SnowUrbanNonRoad ! Set up the matrix entries corresponding to snow layers for Urban column that are sunwall, shadewall, and roof columns - public :: SetMatrix_SnowUrbanRoad ! Set up the matrix entries corresponding to snow layers for Urban column that are pervious, and impervious columns - public :: SetMatrix_SnowNonUrban ! Set up the matrix entries corresponding to snow layers for Non-Urban column - public :: SetMatrix_Snow_Soil ! Set up the matrix entries corresponding to snow-soil interaction - public :: SetMatrix_Snow_SoilUrban ! Set up the matrix entries corresponding to snow-soil interaction for Urban column - public :: SetMatrix_Snow_SoilUrbanNonRoad ! Set up the matrix entries corresponding to snow-soil interaction for Urban column that are sunwall, shadewall, and roof columns - public :: SetMatrix_Snow_SoilUrbanRoad ! Set up the matrix entries corresponding to snow-soil interaction for Urban column that are pervious, and impervious columns - public :: SetMatrix_Snow_SoilNonUrban ! Set up the matrix entries corresponding to snow-soil interaction for Non-Urban column - public :: SetMatrix_Soil ! Set up the matrix entries corresponding to soil layers for Urban+Non-Urban columns - public :: SetMatrix_SoilUrban ! Set up the matrix entries corresponding to soil layers for Urban column - public :: SetMatrix_SoilUrbanNonRoad ! Set up the matrix entries corresponding to soil layers for Urban column that are sunwall, shadewall, and roof columns - public :: SetMatrix_SoilUrbanRoad ! Set up the matrix entries corresponding to soil layers for Urban column that are pervious, and impervious columns - public :: SetMatrix_SoilNonUrban ! Set up the matrix entries corresponding to soil layers for Non-Urban column - public :: SetMatrix_Soil_Snow ! Set up the matrix entries corresponding to soil-snow interction for Urban+Non-Urban columns - public :: SetMatrix_Soil_SnowUrban ! Set up the matrix entries corresponding to soil-snow interction for Urban column - public :: SetMatrix_Soil_SnowUrbanNonRoad ! Set up the matrix entries corresponding to soil-snow interction for Urban column that are sunwall, shadewall, and roof columns - public :: SetMatrix_Soil_SnowUrbanRoad ! Set up the matrix entries corresponding to soil-snow interction for Urban column that are pervious, and impervious columns - public :: SetMatrix_Soil_SnowNonUrban ! Set up the matrix entries corresponding to soil-snow interction for Non-Urban column - public :: SetMatrix_StandingSurfaceWater ! Set up the matrix entries corresponding to standing surface water - public :: SetMatrix_StandingSurfaceWater_Soil ! Set up the matrix entries corresponding to standing surface water-soil interaction - public :: SetMatrix_Soil_StandingSurfaceWater ! Set up the matrix entries corresponding to soil-standing surface water interction - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: SoilThermProp ! Set therm conduct. and heat cap of snow/soil layers - private :: PhaseChangeH2osfc ! When surface water freezes move ice to bottom snow layer - private :: PhaseChange_beta ! Calculation of the phase change within snow and soil layers - private :: BuildingHAC ! Building Heating and Cooling for simpler method (introduced in CLM4.5) - - real(r8), private, parameter :: thin_sfclayer = 1.0e-6_r8 ! Threshold for thin surface layer - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filter_nolakec, & - atm2lnd_inst, urbanparams_inst, canopystate_inst, waterstate_inst, waterflux_inst,& - solarabs_inst, soilstate_inst, energyflux_inst, temperature_inst, urbantv_inst) - ! - ! !DESCRIPTION: - ! Snow and soil temperatures including phase change - ! o The volumetric heat capacity is calculated as a linear combination - ! in terms of the volumetric fraction of the constituent phases. - ! o The thermal conductivity of soil is computed from - ! the algorithm of Johansen (as reported by Farouki 1981), and the - ! conductivity of snow is from the formulation used in - ! SNTHERM (Jordan 1991). - ! o Boundary conditions: - ! F = Rnet - Hg - LEg (top), F= 0 (base of the soil column). - ! o Soil / snow temperature is predicted from heat conduction - ! in 10 soil layers and up to nlevsno snow layers. - ! The thermal conductivities at the interfaces between two - ! neighboring layers (j, j+1) are derived from an assumption that - ! the flux across the interface is equal to that from the node j - ! to the interface and the flux from the interface to the node j+1. - ! The equation is solved using the Crank-Nicholson method and - ! results in a tridiagonal system equation. - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - use clm_varctl , only : iulog - use clm_varcon , only : cnfac, cpice, cpliq, denh2o - use landunit_varcon , only : istsoil, istcrop - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv - use BandDiagonalMod , only : BandDiagonal - use UrbanParamsType , only : IsSimpleBuildTemp, IsProgBuildTemp - use UrbBuildTempOleson2015Mod, only : BuildingTemperature - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(urbantv_type) , intent(in) :: urbantv_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,l,g,pi ! indices - integer :: fc ! lake filtered column indices - integer :: fl ! urban filtered landunit indices - integer :: jtop(bounds%begc:bounds%endc) ! top level at each column - real(r8) :: dtime ! land model time step (sec) - real(r8) :: cv (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat capacity [J/(m2 K)] - real(r8) :: tk (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! thermal conductivity [W/(m K)] - real(r8) :: fn (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] - real(r8) :: fn1(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - real(r8) :: sabg_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:1) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8) :: eflx_gnet_top ! net energy flux into surface layer, patch-level [W/m2] - real(r8) :: hs_top(bounds%begc:bounds%endc) ! net energy flux into surface layer (col) [W/m2] - logical :: cool_on(bounds%begl:bounds%endl) ! is urban air conditioning on? - logical :: heat_on(bounds%begl:bounds%endl) ! is urban heating on? - real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8) :: dz_h2osfc(bounds%begc:bounds%endc) ! height of standing surface water [m] - integer, parameter :: nband=5 - real(r8) :: bmatrix(bounds%begc:bounds%endc,nband,-nlevsno:nlevgrnd) ! banded matrix for numerical solution of temperature - real(r8) :: tvector(bounds%begc:bounds%endc,-nlevsno:nlevgrnd) ! initial temperature solution [Kelvin] - real(r8) :: rvector(bounds%begc:bounds%endc,-nlevsno:nlevgrnd) ! RHS vector for numerical solution of temperature - real(r8) :: tk_h2osfc(bounds%begc:bounds%endc) ! thermal conductivity of h2osfc [W/(m K)] [col] - real(r8) :: dhsdT(bounds%begc:bounds%endc) ! temperature derivative of "hs" [col] - real(r8) :: hs_soil(bounds%begc:bounds%endc) ! heat flux on soil [W/m2] - real(r8) :: hs_top_snow(bounds%begc:bounds%endc) ! heat flux on top snow layer [W/m2] - real(r8) :: hs_h2osfc(bounds%begc:bounds%endc) ! heat flux on standing water [W/m2] - integer :: jbot(bounds%begc:bounds%endc) ! bottom level at each column - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - ctype => col%itype , & ! Input: [integer (:) ] column type - - - t_building_max => urbantv_inst%t_building_max , & ! Input: [real(r8) (:) ] maximum internal building air temperature (K) - t_building_min => urbanparams_inst%t_building_min , & ! Input: [real(r8) (:) ] minimum internal building air temperature (K) - - - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - - - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - - - sabg_soil => solarabs_inst%sabg_soil_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) - sabg_snow => solarabs_inst%sabg_snow_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) - sabg_chk => solarabs_inst%sabg_chk_patch , & ! Output: [real(r8) (:) ] sum of soil/snow using current fsno, for balance check - sabg_lyr => solarabs_inst%sabg_lyr_patch , & ! Input: [real(r8) (:,:) ] absorbed solar radiation (pft,lyr) [W/m2] - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - - - htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of vapor of water (or sublimation) [j/kg] - cgrnd => energyflux_inst%cgrnd_patch , & ! Input: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] - dlrad => energyflux_inst%dlrad_patch , & ! Input: [real(r8) (:) ] downward longwave radiation blow the canopy [W/m2] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Input: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Input: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Input: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Input: [real(r8) (:) ] sensible heat flux from surface water (W/m**2) [+ to atm] - eflx_bot => energyflux_inst%eflx_bot_col , & ! Input: [real(r8) (:) ] heat flux from beneath column (W/m**2) [+ = upward] - eflx_fgr12 => energyflux_inst%eflx_fgr12_col , & ! Output: [real(r8) (:) ] heat flux between soil layer 1 and 2 (W/m2) - eflx_fgr => energyflux_inst%eflx_fgr_col , & ! Output: [real(r8) (:,:) ] (rural) soil downward heat flux (W/m2) (1:nlevgrnd) - eflx_traffic => energyflux_inst%eflx_traffic_lun , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_traffic_patch => energyflux_inst%eflx_traffic_patch , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_wasteheat => energyflux_inst%eflx_wasteheat_lun , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_wasteheat_patch => energyflux_inst%eflx_wasteheat_patch , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_heat_from_ac => energyflux_inst%eflx_heat_from_ac_lun , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_heat_from_ac_patch => energyflux_inst%eflx_heat_from_ac_patch , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_anthro => energyflux_inst%eflx_anthro_patch , & ! Input: [real(r8) (:) ] total anthropogenic heat flux (W/m**2) - dgnetdT => energyflux_inst%dgnetdT_patch , & ! Output: [real(r8) (:) ] temperature derivative of ground net heat flux - eflx_gnet => energyflux_inst%eflx_gnet_patch , & ! Output: [real(r8) (:) ] net ground heat flux into the surface (W/m**2) - eflx_building_heat_errsoi => energyflux_inst%eflx_building_heat_errsoi_col, & ! Output: [real(r8) (:)] heat flux from urban building interior to walls, roof (W/m**2) - eflx_urban_ac_col => energyflux_inst%eflx_urban_ac_col , & ! Output: [real(r8) (:) ] urban air conditioning flux (W/m**2) - eflx_urban_heat_col => energyflux_inst%eflx_urban_heat_col , & ! Output: [real(r8) (:) ] urban heating flux (W/m**2) - - emg => temperature_inst%emg_col , & ! Input: [real(r8) (:) ] ground emissivity - tssbef => temperature_inst%t_ssbef_col , & ! Input: [real(r8) (:,:) ] temperature at previous time step [K] - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Output: [real(r8) (:) ] surface water temperature - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - t_grnd => temperature_inst%t_grnd_col , & ! Output: [real(r8) (:) ] ground surface temperature [K] - t_building => temperature_inst%t_building_lun , & ! Output: [real(r8) (:) ] internal building air temperature (K) - t_roof_inner => temperature_inst%t_roof_inner_lun , & ! Input: [real(r8) (:) ] roof inside surface temperature (K) - t_sunw_inner => temperature_inst%t_sunw_inner_lun , & ! Input: [real(r8) (:) ] sunwall inside surface temperature (K) - t_shdw_inner => temperature_inst%t_shdw_inner_lun , & ! Input: [real(r8) (:) ] shadewall inside surface temperature (K) - xmf => temperature_inst%xmf_col , & ! Output: [real(r8) (:) ] melting or freezing within a time step [kg/m2] - xmf_h2osfc => temperature_inst%xmf_h2osfc_col , & ! Output: [real(r8) (:) ] latent heat of phase change of surface water [col] - fact => temperature_inst%fact_col , & ! Output: [real(r8) (:) ] used in computing tridiagonal matrix [col, lev] - c_h2osfc => temperature_inst%c_h2osfc_col , & ! Output: [real(r8) (:) ] heat capacity of surface water [col] - - begc => bounds%begc , & - endc => bounds%endc & - ) - - ! Get step size - - dtime = get_step_size() - - if ( IsSimpleBuildTemp() ) call BuildingHAC( bounds, num_urbanl, & - filter_urbanl, temperature_inst, & - urbanparams_inst, urbantv_inst, & - cool_on, heat_on ) - - - ! set up compact matrix for band diagonal solver, requires additional - ! sub/super diagonals (1 each), and one additional row for t_h2osfc - jtop = -9999 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - jtop(c) = snl(c) - ! compute jbot - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) ) then - jbot(c) = nlevurb - else - jbot(c) = nlevgrnd - endif - end do - - !------------------------------------------------------ - ! Compute ground surface and soil temperatures - !------------------------------------------------------ - - ! Thermal conductivity and Heat capacity - - tk_h2osfc(begc:endc) = nan - call SoilThermProp(bounds, num_nolakec, filter_nolakec, & - tk(begc:endc, :), & - cv(begc:endc, :), & - tk_h2osfc(begc:endc), & - urbanparams_inst, temperature_inst, waterstate_inst, soilstate_inst) - - ! Net ground heat flux into the surface and its temperature derivative - ! Added a patches loop here to get the average of hs and dhsdT over - ! all Patches on the column. Precalculate the terms that do not depend on PFT. - - call ComputeGroundHeatFluxAndDeriv(bounds, num_nolakec, filter_nolakec, & - hs_h2osfc( begc:endc ), & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col( begc:endc, -nlevsno+1: ), & - atm2lnd_inst, urbanparams_inst, canopystate_inst, waterstate_inst, & - waterflux_inst, solarabs_inst, energyflux_inst, temperature_inst) - - ! Determine heat diffusion through the layer interface and factor used in computing - ! banded diagonal matrix and set up vector r and vectors a, b, c that define banded - ! diagonal matrix and solve system - - call ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, & - dtime, & - tk( begc:endc, -nlevsno+1: ), & - cv( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - energyflux_inst, temperature_inst) - - ! compute thermal properties of h2osfc - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ( (h2osfc(c) > thin_sfclayer) .and. (frac_h2osfc(c) > thin_sfclayer) ) then - c_h2osfc(c) = max(thin_sfclayer, cpliq*h2osfc(c)/frac_h2osfc(c) ) - dz_h2osfc(c) = max(thin_sfclayer, 1.0e-3*h2osfc(c)/frac_h2osfc(c) ) - else - c_h2osfc(c) = thin_sfclayer - dz_h2osfc(c) = thin_sfclayer - endif - enddo - - - ! Set up vector r and vectors a, b, c that define tridiagonal - - call SetRHSVec(bounds, num_nolakec, filter_nolakec, & - dtime, & - hs_h2osfc( begc:endc ), & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - c_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - temperature_inst, & - waterstate_inst, & - rvector( begc:endc, -nlevsno: )) - - ! Set up the banded diagonal matrix - - call SetMatrix(bounds, num_nolakec, filter_nolakec, & - dtime, & - nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - c_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - waterstate_inst, & - bmatrix( begc:endc, 1:, -nlevsno: )) - - ! initialize initial temperature vector - - tvector(begc:endc, :) = nan - do fc = 1,num_nolakec - c = filter_nolakec(fc) - do j = snl(c)+1, 0 - tvector(c,j-1) = t_soisno(c,j) - end do - - ! surface water layer has two coefficients - tvector(c,0) = t_h2osfc(c) - - ! soil layers; top layer will have one offset and one extra coefficient - tvector(c,1:nlevgrnd) = t_soisno(c,1:nlevgrnd) - - enddo - - call t_startf( 'SoilTempBandDiag') - - ! Solve the system - - call BandDiagonal(bounds, -nlevsno, nlevgrnd, jtop(begc:endc), jbot(begc:endc), & - num_nolakec, filter_nolakec, nband, bmatrix(begc:endc, :, :), & - rvector(begc:endc, :), tvector(begc:endc, :)) - call t_stopf( 'SoilTempBandDiag') - - ! return temperatures to original array - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - do j = snl(c)+1, 0 - t_soisno(c,j) = tvector(c,j-1) !snow layers - end do - t_soisno(c,1:nlevgrnd) = tvector(c,1:nlevgrnd) !soil layers - - if (frac_h2osfc(c) == 0._r8) then - t_h2osfc(c)=t_soisno(c,1) - else - t_h2osfc(c) = tvector(c,0) !surface water - endif - enddo - - ! Melting or Freezing - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then - if (j >= snl(c)+1) then - if (j <= nlevurb-1) then - fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j == nlevurb) then - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - if ( IsSimpleBuildTemp() )then - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - ! Note new formulation for fn, this will be used below in net energey flux computations - fn1(c,j) = tk(c,j) * (t_building(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) - fn(c,j) = tk(c,j) * (t_building(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) - - else - ! the bottom "soil" layer and the equations are derived assuming a prognostic inner - ! surface temperature. - if (ctype(c) == icol_sunwall) then - fn1(c,j) = tk(c,j) * (t_sunw_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) - fn(c,j) = tk(c,j) * (t_sunw_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) - else if (ctype(c) == icol_shadewall) then - fn1(c,j) = tk(c,j) * (t_shdw_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) - fn(c,j) = tk(c,j) * (t_shdw_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) - else if (ctype(c) == icol_roof) then - fn1(c,j) = tk(c,j) * (t_roof_inner(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) - fn(c,j) = tk(c,j) * (t_roof_inner(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) - end if - end if - end if - end if - else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= snl(c)+1) then - if (j <= nlevgrnd-1) then - fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j == nlevgrnd) then - fn1(c,j) = 0._r8 - end if - end if - end if - end do - end do - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof) then - eflx_building_heat_errsoi(c) = cnfac*fn(c,nlevurb) + (1._r8-cnfac)*fn1(c,nlevurb) - else - eflx_building_heat_errsoi(c) = 0._r8 - end if - if ( IsSimpleBuildTemp() )then - if (cool_on(l)) then - eflx_urban_ac_col(c) = abs(eflx_building_heat_errsoi(c)) - eflx_urban_heat_col(c) = 0._r8 - else if (heat_on(l)) then - eflx_urban_ac_col(c) = 0._r8 - eflx_urban_heat_col(c) = abs(eflx_building_heat_errsoi(c)) - else - eflx_urban_ac_col(c) = 0._r8 - eflx_urban_heat_col(c) = 0._r8 - end if - end if - end if - end do - - ! compute phase change of h2osfc - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - xmf_h2osfc(c) = 0. - end do - - call PhaseChangeH2osfc (bounds, num_nolakec, filter_nolakec, & - dhsdT(bounds%begc:bounds%endc), & - waterstate_inst, waterflux_inst, temperature_inst,energyflux_inst) - - call Phasechange_beta (bounds, num_nolakec, filter_nolakec, & - dhsdT(bounds%begc:bounds%endc), & - soilstate_inst, waterstate_inst, waterflux_inst, energyflux_inst, temperature_inst) - - if ( IsProgBuildTemp() )then - call BuildingTemperature(bounds, num_urbanl, filter_urbanl, num_nolakec, filter_nolakec, & - tk(bounds%begc:bounds%endc, :), urbanparams_inst, & - temperature_inst, energyflux_inst, urbantv_inst) - end if - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - ! this expression will (should) work whether there is snow or not - if (snl(c) < 0) then - if(frac_h2osfc(c) /= 0._r8) then - t_grnd(c) = frac_sno_eff(c) * t_soisno(c,snl(c)+1) & - + (1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c)) * t_soisno(c,1) & - + frac_h2osfc(c) * t_h2osfc(c) - else - t_grnd(c) = frac_sno_eff(c) * t_soisno(c,snl(c)+1) & - + (1.0_r8 - frac_sno_eff(c)) * t_soisno(c,1) - end if - - else - if(frac_h2osfc(c) /= 0._r8) then - t_grnd(c) = (1 - frac_h2osfc(c)) * t_soisno(c,1) + frac_h2osfc(c) * t_h2osfc(c) - else - t_grnd(c) = t_soisno(c,1) - end if - endif - end do - - ! Initialize soil heat content - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - eflx_fgr12(c)= 0._r8 - end do - - ! Calculate soil heat content and soil plus snow heat content - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - - if (j == 1) then ! this only needs to be done once - eflx_fgr12(c) = -cnfac*fn(c,1) - (1._r8-cnfac)*fn1(c,1) - end if - if (j > 0 .and. j < nlevgrnd .and. (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop)) then - eflx_fgr(c,j) = -cnfac*fn(c,j) - (1._r8-cnfac)*fn1(c,j) - else if (j == nlevgrnd .and. (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop)) then - eflx_fgr(c,j) = 0._r8 - end if - - end do - end do - - end associate - - end subroutine SoilTemperature - - !----------------------------------------------------------------------- - subroutine SoilThermProp (bounds, num_nolakec, filter_nolakec, & - tk, cv, tk_h2osfc, & - urbanparams_inst, temperature_inst, waterstate_inst, soilstate_inst) - - ! - ! !DESCRIPTION: - ! Calculation of thermal conductivities and heat capacities of - ! snow/soil layers - ! (1) The volumetric heat capacity is calculated as a linear combination - ! in terms of the volumetric fraction of the constituent phases. - ! - ! (2) The thermal conductivity of soil is computed from the algorithm of - ! Johansen (as reported by Farouki 1981), and of snow is from the - ! formulation used in SNTHERM (Jordan 1991). - ! The thermal conductivities at the interfaces between two neighboring - ! layers (j, j+1) are derived from an assumption that the flux across - ! the interface is equal to that from the node j to the interface and the - ! flux from the interface to the node j+1. - ! - ! !USES: - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevsoi - use clm_varcon , only : denh2o, denice, tfrz, tkwat, tkice, tkair, cpice, cpliq, thk_bedrock, csol_bedrock - use landunit_varcon , only : istice_mec, istwet - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8) , intent(out) :: cv( bounds%begc: , -nlevsno+1: ) ! heat capacity [J/(m2 K) ] [col, lev] - real(r8) , intent(out) :: tk( bounds%begc: , -nlevsno+1: ) ! thermal conductivity at the layer interface [W/(m K) ] [col, lev] - real(r8) , intent(out) :: tk_h2osfc( bounds%begc: ) ! thermal conductivity of h2osfc [W/(m K) ] [col] - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - ! - ! !LOCAL VARIABLES: - integer :: l,c,j ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dksat ! thermal conductivity for saturated soil (j/(k s m)) - real(r8) :: dke ! kersten number - real(r8) :: fl ! volume fraction of liquid or unfrozen water to total water - real(r8) :: satw ! relative total water content of soil. - real(r8) :: zh2osfc - !----------------------------------------------------------------------- - - call t_startf( 'SoilThermProp' ) - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - nbedrock => col%nbedrock , & ! Input: [real(r8) (:,:) ] depth to bedrock (m) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - nlev_improad => urbanparams_inst%nlev_improad , & ! Input: [integer (:) ] number of impervious road layers - tk_wall => urbanparams_inst%tk_wall , & ! Input: [real(r8) (:,:) ] thermal conductivity of urban wall - tk_roof => urbanparams_inst%tk_roof , & ! Input: [real(r8) (:,:) ] thermal conductivity of urban roof - tk_improad => urbanparams_inst%tk_improad , & ! Input: [real(r8) (:,:) ] thermal conductivity of urban impervious road - cv_wall => urbanparams_inst%cv_wall , & ! Input: [real(r8) (:,:) ] thermal conductivity of urban wall - cv_roof => urbanparams_inst%cv_roof , & ! Input: [real(r8) (:,:) ] thermal conductivity of urban roof - cv_improad => urbanparams_inst%cv_improad , & ! Input: [real(r8) (:,:) ] thermal conductivity of urban impervious road - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fractional snow covered area - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface (mm H2O) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - bw => waterstate_inst%bw_col , & ! Output: [real(r8) (:,:) ] partial density of water in the snow pack (ice + liquid) [kg/m3] - - tkmg => soilstate_inst%tkmg_col , & ! Input: [real(r8) (:,:) ] thermal conductivity, soil minerals [W/m-K] - tkdry => soilstate_inst%tkdry_col , & ! Input: [real(r8) (:,:) ] thermal conductivity, dry soil (W/m/Kelvin) - csol => soilstate_inst%csol_col , & ! Input: [real(r8) (:,:) ] heat capacity, soil solids (J/m**3/Kelvin) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - tksatu => soilstate_inst%tksatu_col , & ! Input: [real(r8) (:,:) ] thermal conductivity, saturated soil [W/m-K] - thk => soilstate_inst%thk_col & ! Output: [real(r8) (:,:) ] thermal conductivity of each layer [W/m-K] - ) - - ! Thermal conductivity of soil from Farouki (1981) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. - - do j = -nlevsno+1,nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - - ! Only examine levels from 1->nlevgrnd - if (j >= 1) then - l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then - thk(c,j) = tk_wall(l,j) - else if (col%itype(c) == icol_roof .and. j <= nlevurb) then - thk(c,j) = tk_roof(l,j) - else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - thk(c,j) = tk_improad(l,j) - else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & - .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & - col%itype(c) /= icol_roof) then - - satw = (h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice)/(dz(c,j)*watsat(c,j)) - satw = min(1._r8, satw) - if (satw > .1e-6_r8) then - if (t_soisno(c,j) >= tfrz) then ! Unfrozen soil - dke = max(0._r8, log10(satw) + 1.0_r8) - else ! Frozen soil - dke = satw - end if - fl = (h2osoi_liq(c,j)/(denh2o*dz(c,j))) / (h2osoi_liq(c,j)/(denh2o*dz(c,j)) + & - h2osoi_ice(c,j)/(denice*dz(c,j))) - dksat = tkmg(c,j)*tkwat**(fl*watsat(c,j))*tkice**((1._r8-fl)*watsat(c,j)) - thk(c,j) = dke*dksat + (1._r8-dke)*tkdry(c,j) - else - thk(c,j) = tkdry(c,j) - endif - if (j > nbedrock(c)) thk(c,j) = thk_bedrock - else if (lun%itype(l) == istice_mec) then - thk(c,j) = tkwat - if (t_soisno(c,j) < tfrz) thk(c,j) = tkice - else if (lun%itype(l) == istwet) then - if (j > nlevsoi) then - thk(c,j) = thk_bedrock - else - thk(c,j) = tkwat - if (t_soisno(c,j) < tfrz) thk(c,j) = tkice - endif - endif - endif - - ! Thermal conductivity of snow, which from Jordan (1991) pp. 18 - ! Only examine levels from snl(c)+1 -> 0 where snl(c) < 1 - if (snl(c)+1 < 1 .AND. (j >= snl(c)+1) .AND. (j <= 0)) then - bw(c,j) = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/(frac_sno(c)*dz(c,j)) - thk(c,j) = tkair + (7.75e-5_r8 *bw(c,j) + 1.105e-6_r8*bw(c,j)*bw(c,j))*(tkice-tkair) - end if - - end do - end do - - ! Thermal conductivity at the layer interface - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then - if (j >= snl(c)+1 .AND. j <= nlevurb-1) then - tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & - /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) - else if (j == nlevurb) then - - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - tk(c,j) = thk(c,j) - end if - else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then - tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & - /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) - else if (j == nlevgrnd) then - tk(c,j) = 0._r8 - end if - end if - end do - end do - - ! calculate thermal conductivity of h2osfc - do fc = 1, num_nolakec - c = filter_nolakec(fc) - zh2osfc=1.0e-3*(0.5*h2osfc(c)) !convert to [m] from [mm] - tk_h2osfc(c)= tkwat*thk(c,1)*(z(c,1)+zh2osfc) & - /(tkwat*z(c,1)+thk(c,1)*zh2osfc) - enddo - - ! Soil heat capacity, from de Vires (1963) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. - - do j = 1, nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .OR. col%itype(c) == icol_shadewall) .and. j <= nlevurb) then - cv(c,j) = cv_wall(l,j) * dz(c,j) - else if (col%itype(c) == icol_roof .and. j <= nlevurb) then - cv(c,j) = cv_roof(l,j) * dz(c,j) - else if (col%itype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - cv(c,j) = cv_improad(l,j) * dz(c,j) - else if (lun%itype(l) /= istwet .AND. lun%itype(l) /= istice_mec & - .AND. col%itype(c) /= icol_sunwall .AND. col%itype(c) /= icol_shadewall .AND. & - col%itype(c) /= icol_roof) then - cv(c,j) = csol(c,j)*(1-watsat(c,j))*dz(c,j) + (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - if (j > nbedrock(c)) cv(c,j) = csol_bedrock*dz(c,j) - else if (lun%itype(l) == istwet) then - cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - if (j > nbedrock(c)) cv(c,j) = csol_bedrock*dz(c,j) - else if (lun%itype(l) == istice_mec) then - cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - endif - if (j == 1) then - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8) then - cv(c,j) = cv(c,j) + cpice*h2osno(c) - end if - end if - enddo - end do - - ! Snow heat capacity - - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (snl(c)+1 < 1 .and. j >= snl(c)+1) then - if (frac_sno(c) > 0._r8) then - cv(c,j) = max(thin_sfclayer,(cpliq*h2osoi_liq(c,j) + cpice*h2osoi_ice(c,j))/frac_sno(c)) - else - cv(c,j) = thin_sfclayer - endif - end if - end do - end do - call t_stopf( 'SoilThermProp' ) - - end associate - - end subroutine SoilThermProp - - !----------------------------------------------------------------------- - subroutine PhaseChangeH2osfc (bounds, num_nolakec, filter_nolakec, & - dhsdT, waterstate_inst, waterflux_inst, temperature_inst,energyflux_inst) - ! - ! !DESCRIPTION: - ! Only freezing is considered. When water freezes, move ice to bottom snow layer. - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varcon , only : tfrz, hfus, grav, denice, cnfac, cpice, cpliq - use clm_varpar , only : nlevsno, nlevgrnd - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8) , intent(in) :: dhsdT ( bounds%begc: ) ! temperature derivative of "hs" [col ] - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,g !do loop index - integer :: fc !lake filtered column indices - real(r8) :: dtime !land model time step (sec) - real(r8) :: temp1 !temporary variables [kg/m2 ] - real(r8) :: hm(bounds%begc:bounds%endc) !energy residual [W/m2 ] - real(r8) :: xm(bounds%begc:bounds%endc) !melting or freezing within a time step [kg/m2 ] - real(r8) :: tinc !t(n+1)-t(n) (K) - real(r8) :: smp !frozen water potential (mm) - real(r8) :: rho_avg !average density - real(r8) :: z_avg !average of snow depth - real(r8) :: c1 !weight to use for lowest snow layer - real(r8) :: c2 !weight to use for surface water layer - !----------------------------------------------------------------------- - - call t_startf( 'PhaseChangeH2osfc' ) - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - eflx_h2osfc_to_snow_col => energyflux_inst%eflx_h2osfc_to_snow_col , & ! Output: [real(r8) (:) ] col snow melt to h2osfc heat flux (W/m**2) - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - frac_sno => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) (new) - h2osfc => waterstate_inst%h2osfc_col , & ! Output: [real(r8) (:) ] surface water (mm) - int_snow => waterstate_inst%int_snow_col , & ! Output: [real(r8) (:) ] integrated snowfall [mm] - snow_depth => waterstate_inst%snow_depth_col , & ! Output: [real(r8) (:) ] snow height (m) - - qflx_h2osfc_to_ice => waterflux_inst%qflx_h2osfc_to_ice_col , & ! Output: [real(r8) (:) ] conversion of h2osfc to ice - - fact => temperature_inst%fact_col , & - c_h2osfc => temperature_inst%c_h2osfc_col , & - xmf_h2osfc => temperature_inst%xmf_h2osfc_col, & - t_soisno => temperature_inst%t_soisno_col , & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - t_h2osfc => temperature_inst%t_h2osfc_col & ! Output: [real(r8) (:) ] surface water temperature - ) - - ! Get step size - - dtime = get_step_size() - - ! Initialization - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - xmf_h2osfc(c) = 0._r8 - hm(c) = 0._r8 - xm(c) = 0._r8 - qflx_h2osfc_to_ice(c) = 0._r8 - eflx_h2osfc_to_snow_col(c) = 0._r8 - end do - - ! Freezing identification - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! If liquid exists below melt point, freeze some to ice. - if ( frac_h2osfc(c) > 0._r8 .AND. t_h2osfc(c) <= tfrz) then - tinc = tfrz - t_h2osfc(c) - t_h2osfc(c) = tfrz - - ! energy absorbed beyond freezing temperature - hm(c) = frac_h2osfc(c)*(dhsdT(c)*tinc - tinc*c_h2osfc(c)/dtime) - - ! mass of water converted from liquid to ice - xm(c) = hm(c)*dtime/hfus - temp1 = h2osfc(c) + xm(c) - - z_avg=frac_sno(c)*snow_depth(c) - if (z_avg > 0._r8) then - rho_avg=min(800._r8,h2osno(c)/z_avg) - else - rho_avg=200._r8 - endif - - !===================== xm < h2osfc ==================================== - if(temp1 >= 0._r8) then ! add some frozen water to snow column - - ! add ice to snow column - h2osno(c) = h2osno(c) - xm(c) - int_snow(c) = int_snow(c) - xm(c) - if(snl(c) < 0) h2osoi_ice(c,0) = h2osoi_ice(c,0) - xm(c) - - - ! remove ice from h2osfc - h2osfc(c) = h2osfc(c) + xm(c) - - xmf_h2osfc(c) = hm(c) - qflx_h2osfc_to_ice(c) = -xm(c)/dtime - - - ! update snow depth - if (frac_sno(c) > 0 .and. snl(c) < 0) then - snow_depth(c)=h2osno(c)/(rho_avg*frac_sno(c)) - else - snow_depth(c)=h2osno(c)/denice - endif - - ! adjust temperature of lowest snow layer to account for addition of ice - if (snl(c) == 0) then - !initialize for next time step - t_soisno(c,0) = t_h2osfc(c) - eflx_h2osfc_to_snow_col(c) = 0. - else - if (snl(c) == -1)then - c1=frac_sno(c)*(dtime/fact(c,0) - dhsdT(c)*dtime) - else - c1=frac_sno(c)/fact(c,0)*dtime - end if - if ( frac_h2osfc(c) /= 0.0_r8 )then - c2=(-cpliq*xm(c) - frac_h2osfc(c)*dhsdT(c)*dtime) - else - c2=0.0_r8 - end if - t_soisno(c,0) = (c1*t_soisno(c,0)+ c2*t_h2osfc(c)) & - /(c1 + c2) - eflx_h2osfc_to_snow_col(c) =(t_h2osfc(c)-t_soisno(c,0))*c2/dtime - - endif - - !========================= xm > h2osfc ============================= - else !all h2osfc converted to ice - - rho_avg=(h2osno(c)*rho_avg + h2osfc(c)*denice)/(h2osno(c) + h2osfc(c)) - h2osno(c) = h2osno(c) + h2osfc(c) - int_snow(c) = int_snow(c) + h2osfc(c) - - qflx_h2osfc_to_ice(c) = h2osfc(c)/dtime - - ! excess energy is used to cool ice layer - if(snl(c) < 0) h2osoi_ice(c,0) = h2osoi_ice(c,0) + h2osfc(c) - - ! NOTE: should compute and then use the heat capacity of frozen h2osfc layer - ! rather than using heat capacity of the liquid layer. But this causes - ! balance check errors as it doesn't know about it. - - ! cool frozen h2osfc layer with extra heat - t_h2osfc(c) = t_h2osfc(c) - temp1*hfus/(dtime*dhsdT(c) - c_h2osfc(c)) - - xmf_h2osfc(c) = (hm(c) - frac_h2osfc(c)*temp1*hfus/dtime) - - ! next, determine equilibrium temperature of combined ice/snow layer - if (snl(c) == 0) then - !initialize for next time step - t_soisno(c,0) = t_h2osfc(c) - else if (snl(c) == -1) then - c1=frac_sno(c)*(dtime/fact(c,0) - dhsdT(c)*dtime) - if ( frac_h2osfc(c) /= 0.0_r8 )then - c2=frac_h2osfc(c)*(c_h2osfc(c) - dtime*dhsdT(c)) - - else - c2=0.0_r8 - end if - t_soisno(c,0) = (c1*t_soisno(c,0)+ c2*t_h2osfc(c)) & - /(c1 + c2) - t_h2osfc(c) = t_soisno(c,0) - - else - c1=frac_sno(c)/fact(c,0)*dtime - if ( frac_h2osfc(c) /= 0.0_r8 )then - c2=frac_h2osfc(c)*(c_h2osfc(c) - dtime*dhsdT(c)) - else - c2=0.0_r8 - end if - t_soisno(c,0) = (c1*t_soisno(c,0)+ c2*t_h2osfc(c)) & - /(c1 + c2) - t_h2osfc(c) = t_soisno(c,0) - endif - - ! set h2osfc to zero (all liquid converted to ice) - h2osfc(c) = 0._r8 - - ! update snow depth - if (frac_sno(c) > 0 .and. snl(c) < 0) then - snow_depth(c)=h2osno(c)/(rho_avg*frac_sno(c)) - else - snow_depth(c)=h2osno(c)/denice - endif - - endif - endif - enddo - call t_stopf( 'PhaseChangeH2osfc' ) - - end associate - - end subroutine PhaseChangeH2osfc - - !----------------------------------------------------------------------- - subroutine Phasechange_beta (bounds, num_nolakec, filter_nolakec, dhsdT, & - soilstate_inst, waterstate_inst, waterflux_inst, energyflux_inst, temperature_inst) - ! - ! !DESCRIPTION: - ! Calculation of the phase change within snow and soil layers: - ! (1) Check the conditions for which the phase change may take place, - ! i.e., the layer temperature is great than the freezing point - ! and the ice mass is not equal to zero (i.e. melting), - ! or the layer temperature is less than the freezing point - ! and the liquid water mass is greater than the allowable supercooled - ! liquid water calculated from freezing point depression (i.e. freezing). - ! (2) Assess the rate of phase change from the energy excess (or deficit) - ! after setting the layer temperature to freezing point. - ! (3) Re-adjust the ice and liquid mass, and the layer temperature - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsno, nlevgrnd,nlevurb - use clm_varctl , only : iulog - use clm_varcon , only : tfrz, hfus, grav - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv - use landunit_varcon , only : istsoil, istcrop, istice_mec - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8) , intent(in) :: dhsdT ( bounds%begc: ) ! temperature derivative of "hs" [col] - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,g,l !do loop index - integer :: fc !lake filtered column indices - real(r8) :: dtime !land model time step (sec) - real(r8) :: heatr !energy residual or loss after melting or freezing - real(r8) :: temp1 !temporary variables [kg/m2] - real(r8) :: hm(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !energy residual [W/m2] - real(r8) :: xm(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !melting or freezing within a time step [kg/m2] - real(r8) :: wmass0(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of ice and liquid (kg/m2) - real(r8) :: wice0 (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of ice (kg/m2) - real(r8) :: wliq0 (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd)!initial mass of liquid (kg/m2) - real(r8) :: supercool(bounds%begc:bounds%endc,nlevgrnd) !supercooled water in soil (kg/m2) - real(r8) :: propor !proportionality constant (-) - real(r8) :: tinc(bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) !t(n+1)-t(n) (K) - real(r8) :: smp !frozen water potential (mm) - !----------------------------------------------------------------------- - - call t_startf( 'PhaseChangebeta' ) - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - h2osno => waterstate_inst%h2osno_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) (new) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] ice lens (kg/m2) (new) - - qflx_snow_drain => waterflux_inst%qflx_snow_drain_col , & ! Output: [real(r8) (:) ] drainage from snow pack - qflx_snofrz_lyr => waterflux_inst%qflx_snofrz_lyr_col , & ! Output: [real(r8) (:,:) ] snow freezing rate (positive definite) (col,lyr) [kg m-2 s-1] - qflx_snofrz => waterflux_inst%qflx_snofrz_col , & ! Output: [real(r8) (:) ] column-integrated snow freezing rate (positive definite) [kg m-2 s-1] - qflx_snomelt => waterflux_inst%qflx_snomelt_col , & ! Output: [real(r8) (:) ] snow melt (mm H2O /s) - qflx_snomelt_lyr => waterflux_inst%qflx_snomelt_lyr_col , & ! Output: [real(r8) (:) ] snow melt in each layer (mm H2O /s) - - eflx_snomelt => energyflux_inst%eflx_snomelt_col , & ! Output: [real(r8) (:) ] snow melt heat flux (W/m**2) - eflx_snomelt_r => energyflux_inst%eflx_snomelt_r_col , & ! Output: [real(r8) (:) ] rural snow melt heat flux (W/m**2) - eflx_snomelt_u => energyflux_inst%eflx_snomelt_u_col , & ! Output: [real(r8) (:) ] urban snow melt heat flux (W/m**2) - - xmf => temperature_inst%xmf_col , & - fact => temperature_inst%fact_col , & - - imelt => temperature_inst%imelt_col , & ! Output: [integer (:,:) ] flag for melting (=1), freezing (=2), Not=0 (new) - t_soisno => temperature_inst%t_soisno_col & ! Output: [real(r8) (:,:) ] soil temperature (Kelvin) - ) - - ! Get step size - - dtime = get_step_size() - - ! Initialization - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - - xmf(c) = 0._r8 - qflx_snomelt(c) = 0._r8 - qflx_snofrz(c) = 0._r8 - qflx_snow_drain(c) = 0._r8 - end do - - do j = -nlevsno+1,nlevgrnd ! all layers - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (j >= snl(c)+1) then - - ! Initialization - imelt(c,j) = 0 - hm(c,j) = 0._r8 - xm(c,j) = 0._r8 - wice0(c,j) = h2osoi_ice(c,j) - wliq0(c,j) = h2osoi_liq(c,j) - wmass0(c,j) = h2osoi_ice(c,j) + h2osoi_liq(c,j) - endif ! end of snow layer if-block - - if (j <= 0) then - ! Do for all possible snow layers in case snl changes over timestep. - qflx_snomelt_lyr(c,j) = 0._r8 - qflx_snofrz_lyr(c,j) = 0._r8 - end if - end do ! end of column-loop - enddo ! end of level-loop - - !-- snow layers --------------------------------------------------- - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (j >= snl(c)+1) then - - ! Melting identification - ! If ice exists above melt point, melt some to liquid. - if (h2osoi_ice(c,j) > 0._r8 .AND. t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - - ! Freezing identification - ! If liquid exists below melt point, freeze some to ice. - if (h2osoi_liq(c,j) > 0._r8 .AND. t_soisno(c,j) < tfrz) then - imelt(c,j) = 2 - ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - endif ! end of snow layer if-block - end do ! end of column-loop - enddo ! end of level-loop - - !-- soil layers --------------------------------------------------- - do j = 1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - supercool(c,j) = 0.0_r8 - ! add in urban condition if-block - if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then - - - - if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - - ! from Zhao (1997) and Koren (1999) - supercool(c,j) = 0.0_r8 - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop .or. col%itype(c) == icol_road_perv) then - if(t_soisno(c,j) < tfrz) then - smp = hfus*(tfrz-t_soisno(c,j))/(grav*t_soisno(c,j)) * 1000._r8 !(mm) - supercool(c,j) = watsat(c,j)*(smp/sucsat(c,j))**(-1._r8/bsw(c,j)) - supercool(c,j) = supercool(c,j)*dz(c,j)*1000._r8 ! (mm) - endif - endif - - if (h2osoi_liq(c,j) > supercool(c,j) .AND. t_soisno(c,j) < tfrz) then - imelt(c,j) = 2 - ! tinc(c,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - - ! If snow exists, but its thickness is less than the critical value (0.01 m) - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. j == 1) then - if (t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - ! tincc,j) = t_soisno(c,j) - tfrz - tinc(c,j) = tfrz - t_soisno(c,j) - t_soisno(c,j) = tfrz - endif - endif - - endif - - end do - enddo - - - do j = -nlevsno+1,nlevgrnd ! all layers - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - if ((col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) .or. ( j <= nlevurb)) then - - if (j >= snl(c)+1) then - - ! Calculate the energy surplus and loss for melting and freezing - if (imelt(c,j) > 0) then - - ! added unique cases for this calculation, - ! to account for absorbed solar radiation in each layer - - !================================================================== - if (j == snl(c)+1) then ! top layer - if(j > 0) then - hm(c,j) = dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j) - else - hm(c,j) = frac_sno_eff(c)*(dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j)) - endif - - if ( j==1 .and. frac_h2osfc(c) /= 0.0_r8 ) then - hm(c,j) = hm(c,j) - frac_h2osfc(c)*(dhsdT(c)*tinc(c,j)) - end if - else if (j == 1) then - hm(c,j) = (1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c)) & - *dhsdT(c)*tinc(c,j) - tinc(c,j)/fact(c,j) - else ! non-interfacial snow/soil layers - if(j < 1) then - hm(c,j) = - frac_sno_eff(c)*(tinc(c,j)/fact(c,j)) - else - hm(c,j) = - tinc(c,j)/fact(c,j) - endif - endif - endif - - ! These two errors were checked carefully (Y. Dai). They result from the - ! computed error of "Tridiagonal-Matrix" in subroutine "thermal". - if (imelt(c,j) == 1 .AND. hm(c,j) < 0._r8) then - hm(c,j) = 0._r8 - imelt(c,j) = 0 - endif - if (imelt(c,j) == 2 .AND. hm(c,j) > 0._r8) then - hm(c,j) = 0._r8 - imelt(c,j) = 0 - endif - - ! The rate of melting and freezing - - if (imelt(c,j) > 0 .and. abs(hm(c,j)) > 0._r8) then - xm(c,j) = hm(c,j)*dtime/hfus ! kg/m2 - - ! If snow exists, but its thickness is less than the critical value - ! (1 cm). Note: more work is needed to determine how to tune the - ! snow depth for this case - if (j == 1) then - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. xm(c,j) > 0._r8) then - temp1 = h2osno(c) ! kg/m2 - h2osno(c) = max(0._r8,temp1-xm(c,j)) - propor = h2osno(c)/temp1 - snow_depth(c) = propor * snow_depth(c) - heatr = hm(c,j) - hfus*(temp1-h2osno(c))/dtime ! W/m2 - if (heatr > 0._r8) then - xm(c,j) = heatr*dtime/hfus ! kg/m2 - hm(c,j) = heatr ! W/m2 - else - xm(c,j) = 0._r8 - hm(c,j) = 0._r8 - endif - qflx_snomelt(c) = max(0._r8,(temp1-h2osno(c)))/dtime ! kg/(m2 s) - ! no snow layers, so qflx_snomelt_lyr is not set - xmf(c) = hfus*qflx_snomelt(c) - qflx_snow_drain(c) = qflx_snomelt(c) - endif - endif - - heatr = 0._r8 - if (xm(c,j) > 0._r8) then - h2osoi_ice(c,j) = max(0._r8, wice0(c,j)-xm(c,j)) - heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - else if (xm(c,j) < 0._r8) then - if (j <= 0) then - h2osoi_ice(c,j) = min(wmass0(c,j), wice0(c,j)-xm(c,j)) ! snow - else - if (wmass0(c,j) < supercool(c,j)) then - h2osoi_ice(c,j) = 0._r8 - else - h2osoi_ice(c,j) = min(wmass0(c,j) - supercool(c,j),wice0(c,j)-xm(c,j)) - endif - endif - heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - endif - - h2osoi_liq(c,j) = max(0._r8,wmass0(c,j)-h2osoi_ice(c,j)) - - if (abs(heatr) > 0._r8) then - if (j == snl(c)+1) then - - if(j==1) then - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr & - /(1._r8-(1.0_r8 - frac_h2osfc(c))*fact(c,j)*dhsdT(c)) - else - t_soisno(c,j) = t_soisno(c,j) + (fact(c,j)/frac_sno_eff(c))*heatr & - /(1._r8-fact(c,j)*dhsdT(c)) - - endif - - else if (j == 1) then - - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr & - /(1._r8-(1.0_r8 - frac_sno_eff(c) - frac_h2osfc(c))*fact(c,j)*dhsdT(c)) - else - if(j > 0) then - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr - else - if(frac_sno_eff(c) > 0._r8) t_soisno(c,j) = t_soisno(c,j) + (fact(c,j)/frac_sno_eff(c))*heatr - endif - endif - - if (j <= 0) then ! snow - if (h2osoi_liq(c,j)*h2osoi_ice(c,j)>0._r8) t_soisno(c,j) = tfrz - end if - endif ! end of heatr > 0 if-block - - if (j >= 1) then - xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - else - xmf(c) = xmf(c) + hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - endif - - if (imelt(c,j) == 1 .AND. j < 1) then - qflx_snomelt_lyr(c,j) = max(0._r8,(wice0(c,j)-h2osoi_ice(c,j)))/dtime - qflx_snomelt(c) = qflx_snomelt(c) + qflx_snomelt_lyr(c,j) - endif - - ! layer freezing mass flux (positive): - if (imelt(c,j) == 2 .AND. j < 1) then - qflx_snofrz_lyr(c,j) = max(0._r8,(h2osoi_ice(c,j)-wice0(c,j)))/dtime - qflx_snofrz(c) = qflx_snofrz(c) + qflx_snofrz_lyr(c,j) - endif - - endif - - endif ! end of snow layer if-block - - endif - - end do ! end of column-loop - enddo ! end of level-loop - - ! Needed for history file output - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - eflx_snomelt(c) = qflx_snomelt(c) * hfus - l = col%landunit(c) - if (lun%urbpoi(l)) then - eflx_snomelt_u(c) = eflx_snomelt(c) - else if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - eflx_snomelt_r(c) = eflx_snomelt(c) - end if - end do - - call t_stopf( 'PhaseChangebeta' ) - end associate - - end subroutine Phasechange_beta - - !----------------------------------------------------------------------- - subroutine ComputeGroundHeatFluxAndDeriv(bounds, num_nolakec, filter_nolakec, & - hs_h2osfc, hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, & - atm2lnd_inst, urbanparams_inst, canopystate_inst, waterstate_inst, & - waterflux_inst, solarabs_inst, energyflux_inst, temperature_inst) - ! - ! !DESCRIPTION: - ! Computes ground heat flux on: - ! (1) The surface of standing water, - ! (2) The surface of snow, - ! (3) The surface of soil, and - ! (4) Net energy flux into soil surface. - ! Additionally, derivative of ground heat flux w.r.t to temeprature - ! - ! !USES: - use clm_varcon , only : sb, hvap - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, max_patch_per_col - use UrbanParamsType, only : IsSimpleBuildTemp - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec( : ) ! column filter for non-lake points - real(r8) , intent(out) :: hs_h2osfc( bounds%begc: ) ! heat flux on standing water [W/m2] - real(r8) , intent(out) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8) , intent(out) :: hs_soil( bounds%begc: ) ! heat flux on soil [W/m2] - real(r8) , intent(out) :: hs_top (bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8) , intent(out) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8) , intent(out) :: sabg_lyr_col( bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(temperature_type) , intent(in) :: temperature_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,p,l,g,pi ! indices - integer :: fc ! lake filtered column indices - real(r8) :: hs(bounds%begc:bounds%endc) ! net energy flux into the surface (w/m2) - real(r8) :: lwrad_emit(bounds%begc:bounds%endc) ! emitted longwave radiation - real(r8) :: dlwrad_emit(bounds%begc:bounds%endc) ! time derivative of emitted longwave radiation - integer :: lyr_top ! index of top layer of snowpack (-4 to 0) [idx] - real(r8) :: eflx_gnet_top ! net energy flux into surface layer, patch-level [W/m2] - real(r8) :: lwrad_emit_snow(bounds%begc:bounds%endc) ! - real(r8) :: lwrad_emit_soil(bounds%begc:bounds%endc) ! - real(r8) :: lwrad_emit_h2osfc(bounds%begc:bounds%endc) ! - real(r8) :: eflx_gnet_snow ! - real(r8) :: eflx_gnet_soil ! - real(r8) :: eflx_gnet_h2osfc ! - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc,1/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - forc_lwrad => atm2lnd_inst%forc_lwrad_downscaled_col , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - - qflx_ev_snow => waterflux_inst%qflx_ev_snow_patch , & ! Input: [real(r8) (:) ] evaporation flux from snow (mm H2O/s) [+ to atm] - qflx_ev_soil => waterflux_inst%qflx_ev_soil_patch , & ! Input: [real(r8) (:) ] evaporation flux from soil (mm H2O/s) [+ to atm] - qflx_ev_h2osfc => waterflux_inst%qflx_ev_h2osfc_patch , & ! Input: [real(r8) (:) ] evaporation flux from h2osfc (mm H2O/s) [+ to atm] - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Input: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - - emg => temperature_inst%emg_col , & ! Input: [real(r8) (:) ] ground emissivity - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground surface temperature [K] - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of vapor of water (or sublimation) [j/kg] - cgrnd => energyflux_inst%cgrnd_patch , & ! Input: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp [w/m2/k] - dlrad => energyflux_inst%dlrad_patch , & ! Input: [real(r8) (:) ] downward longwave radiation blow the canopy [W/m2] - eflx_traffic => energyflux_inst%eflx_traffic_lun , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_wasteheat => energyflux_inst%eflx_wasteheat_lun , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_heat_from_ac => energyflux_inst%eflx_heat_from_ac_lun , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Input: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Input: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Input: [real(r8) (:) ] sensible heat flux from surface water (W/m**2) [+ to atm] - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Input: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Input: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_wasteheat_patch => energyflux_inst%eflx_wasteheat_patch , & ! Input: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_heat_from_ac_patch => energyflux_inst%eflx_heat_from_ac_patch , & ! Input: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_traffic_patch => energyflux_inst%eflx_traffic_patch , & ! Input: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_anthro => energyflux_inst%eflx_anthro_patch , & ! Input: [real(r8) (:) ] total anthropogenic heat flux (W/m**2) - eflx_gnet => energyflux_inst%eflx_gnet_patch , & ! Output: [real(r8) (:) ] net ground heat flux into the surface (W/m**2) - dgnetdT => energyflux_inst%dgnetdT_patch , & ! Output: [real(r8) (:) ] temperature derivative of ground net heat flux - - sabg => solarabs_inst%sabg_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - sabg_soil => solarabs_inst%sabg_soil_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) - sabg_snow => solarabs_inst%sabg_snow_patch , & ! Input: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) - sabg_chk => solarabs_inst%sabg_chk_patch , & ! Output: [real(r8) (:) ] sum of soil/snow using current fsno, for balance check - sabg_lyr => solarabs_inst%sabg_lyr_patch , & ! Output: [real(r8) (:,:) ] absorbed solar radiation (pft,lyr) [W/m2] - - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Net ground heat flux into the surface and its temperature derivative - ! Added a pfts loop here to get the average of hs and dhsdT over - ! all PFTs on the column. Precalculate the terms that do not depend on PFT. - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - lwrad_emit(c) = emg(c) * sb * t_grnd(c)**4 - dlwrad_emit(c) = 4._r8*emg(c) * sb * t_grnd(c)**3 - - ! fractionate lwrad_emit; balanced in CanopyFluxes & Biogeophysics2 - lwrad_emit_snow(c) = emg(c) * sb * t_soisno(c,snl(c)+1)**4 - lwrad_emit_soil(c) = emg(c) * sb * t_soisno(c,1)**4 - lwrad_emit_h2osfc(c) = emg(c) * sb * t_h2osfc(c)**4 - end do - - hs_soil(begc:endc) = 0._r8 - hs_h2osfc(begc:endc) = 0._r8 - hs(begc:endc) = 0._r8 - dhsdT(begc:endc) = 0._r8 - do pi = 1,max_patch_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - l = patch%landunit(p) - g = patch%gridcell(p) - - if (patch%active(p)) then - if (.not. lun%urbpoi(l)) then - eflx_gnet(p) = sabg(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) - lwrad_emit(c) & - - (eflx_sh_grnd(p)+qflx_evap_soi(p)*htvp(c)) - ! save sabg for balancecheck, in case frac_sno is set to zero later - sabg_chk(p) = frac_sno_eff(c) * sabg_snow(p) + (1._r8 - frac_sno_eff(c) ) * sabg_soil(p) - - eflx_gnet_snow = sabg_snow(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) - lwrad_emit_snow(c) & - - (eflx_sh_snow(p)+qflx_ev_snow(p)*htvp(c)) - - eflx_gnet_soil = sabg_soil(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) - lwrad_emit_soil(c) & - - (eflx_sh_soil(p)+qflx_ev_soil(p)*htvp(c)) - - eflx_gnet_h2osfc = sabg_soil(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) - lwrad_emit_h2osfc(c) & - - (eflx_sh_h2osfc(p)+qflx_ev_h2osfc(p)*htvp(c)) - else - ! For urban columns we use the net longwave radiation (eflx_lwrad_net) because of - ! interactions between urban columns. - - ! All wasteheat and traffic flux goes into canyon floor - if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - eflx_wasteheat_patch(p) = eflx_wasteheat(l)/(1._r8-lun%wtlunit_roof(l)) - eflx_heat_from_ac_patch(p) = eflx_heat_from_ac(l)/(1._r8-lun%wtlunit_roof(l)) - eflx_traffic_patch(p) = eflx_traffic(l)/(1._r8-lun%wtlunit_roof(l)) - else - eflx_wasteheat_patch(p) = 0._r8 - eflx_heat_from_ac_patch(p) = 0._r8 - eflx_traffic_patch(p) = 0._r8 - end if - ! Include transpiration term because needed for previous road - ! and include wasteheat and traffic flux - eflx_gnet(p) = sabg(p) + dlrad(p) & - - eflx_lwrad_net(p) & - - (eflx_sh_grnd(p) + qflx_evap_soi(p)*htvp(c) + qflx_tran_veg(p)*hvap) & - + eflx_wasteheat_patch(p) + eflx_heat_from_ac_patch(p) + eflx_traffic_patch(p) - if ( IsSimpleBuildTemp() ) then - eflx_anthro(p) = eflx_wasteheat_patch(p) + eflx_traffic_patch(p) - end if - eflx_gnet_snow = eflx_gnet(p) - eflx_gnet_soil = eflx_gnet(p) - eflx_gnet_h2osfc = eflx_gnet(p) - end if - dgnetdT(p) = - cgrnd(p) - dlwrad_emit(c) - hs(c) = hs(c) + eflx_gnet(p) * patch%wtcol(p) - dhsdT(c) = dhsdT(c) + dgnetdT(p) * patch%wtcol(p) - ! separate surface fluxes for soil/snow - hs_soil(c) = hs_soil(c) + eflx_gnet_soil * patch%wtcol(p) - hs_h2osfc(c) = hs_h2osfc(c) + eflx_gnet_h2osfc * patch%wtcol(p) - - end if - end if - end do - end do - - ! Additional calculations with SNICAR: - ! Set up tridiagonal matrix in a new manner. There is now - ! absorbed solar radiation in each snow layer, instead of - ! only the surface. Following the current implementation, - ! absorbed solar flux should be: S + ((delS/delT)*dT), - ! where S is absorbed radiation, and T is temperature. Now, - ! assume delS/delT is zero, then it is OK to just add S - ! to each layer - - ! Initialize: - sabg_lyr_col(begc:endc,-nlevsno+1:1) = 0._r8 - hs_top(begc:endc) = 0._r8 - hs_top_snow(begc:endc) = 0._r8 - - do pi = 1,max_patch_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - lyr_top = snl(c) + 1 - if ( pi <= col%npatches(c) ) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - g = patch%gridcell(p) - l = patch%landunit(p) - if (.not. lun%urbpoi(l)) then - - eflx_gnet_top = sabg_lyr(p,lyr_top) + dlrad(p) + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) & - - lwrad_emit(c) - (eflx_sh_grnd(p)+qflx_evap_soi(p)*htvp(c)) - - hs_top(c) = hs_top(c) + eflx_gnet_top*patch%wtcol(p) - - eflx_gnet_snow = sabg_lyr(p,lyr_top) + dlrad(p) + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) & - - lwrad_emit_snow(c) - (eflx_sh_snow(p)+qflx_ev_snow(p)*htvp(c)) - - eflx_gnet_soil = sabg_lyr(p,lyr_top) + dlrad(p) + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(c) & - - lwrad_emit_soil(c) - (eflx_sh_soil(p)+qflx_ev_soil(p)*htvp(c)) - - hs_top_snow(c) = hs_top_snow(c) + eflx_gnet_snow*patch%wtcol(p) - - do j = lyr_top,1,1 - sabg_lyr_col(c,j) = sabg_lyr_col(c,j) + sabg_lyr(p,j) * patch%wtcol(p) - enddo - else - - hs_top(c) = hs_top(c) + eflx_gnet(p)*patch%wtcol(p) - hs_top_snow(c) = hs_top_snow(c) + eflx_gnet(p)*patch%wtcol(p) - sabg_lyr_col(c,lyr_top) = sabg_lyr_col(c,lyr_top) + sabg(p) * patch%wtcol(p) - - endif - endif - - endif - enddo - enddo - - end associate - - end subroutine ComputeGroundHeatFluxAndDeriv - - !----------------------------------------------------------------------- - subroutine ComputeHeatDiffFluxAndFactor(bounds, num_nolakec, filter_nolakec, dtime, & - tk, cv, fn, fact, & - energyflux_inst, temperature_inst) - ! - ! !DESCRIPTION: - ! Computes: - ! (1) Heat diffusion at the interface of layers. - ! (2) Factor used in computing tridiagonal matrix - ! - ! !USES: - use clm_varcon , only : capr, cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - use UrbanParamsType, only : IsSimpleBuildTemp - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8) , intent(in) :: dtime ! land model time step (sec) - real(r8) , intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8) , intent(in) :: cv (bounds%begc: ,-nlevsno+1: ) ! heat capacity [J/(m2 K)] - real(r8) , intent(out) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8) , intent(out) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - type(energyflux_type) , intent(in) :: energyflux_inst - type(temperature_type) , intent(in) :: temperature_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate(& - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer depth (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - ctype => col%itype , & ! Input: [integer (:) ] column type - t_building => temperature_inst%t_building_lun , & ! Input: [real(r8) (:) ] internal building temperature (K) - t_roof_inner => temperature_inst%t_roof_inner_lun , & ! Input: [real(r8) (:) ] roof inside surface temperature (K) - t_sunw_inner => temperature_inst%t_sunw_inner_lun , & ! Input: [real(r8) (:) ] sunwall inside surface temperature (K) - t_shdw_inner => temperature_inst%t_shdw_inner_lun , & ! Input: [real(r8) (:) ] shadewall inside surface temperature (K) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - eflx_bot => energyflux_inst%eflx_bot_col & ! Input: [real(r8) (:) ] heat flux from beneath column (W/m**2) [+ = upward] - ) - - ! Determine heat diffusion through the layer interface and factor used in computing - ! tridiagonal matrix and set up vector r and vectors a, b, c that define tridiagonal - ! matrix and solve system - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) .and. j <= nlevurb) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j <= nlevurb-1) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - dzm = (z(c,j)-z(c,j-1)) - else if (j == nlevurb) then - fact(c,j) = dtime/cv(c,j) - if ( IsSimpleBuildTemp() )then - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - fn(c,j) = tk(c,j) * (t_building(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) - else - ! the bottom "soil" layer and the equations are derived assuming a prognostic inner - ! surface temperature. - if (ctype(c) == icol_sunwall) then - fn(c,j) = tk(c,j) * (t_sunw_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) - else if (ctype(c) == icol_shadewall) then - fn(c,j) = tk(c,j) * (t_shdw_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) - else if (ctype(c) == icol_roof) then - fn(c,j) = tk(c,j) * (t_roof_inner(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) - end if - end if - end if - end if - else if (col%itype(c) /= icol_sunwall .and. col%itype(c) /= icol_shadewall & - .and. col%itype(c) /= icol_roof) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j <= nlevgrnd-1) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - dzm = (z(c,j)-z(c,j-1)) - else if (j == nlevgrnd) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = eflx_bot(c) - end if - end if - end if - end do - end do - - end associate - - end subroutine ComputeHeatDiffFluxAndFactor - - !----------------------------------------------------------------------- - subroutine SetRHSVec(bounds, num_nolakec, filter_nolakec, dtime, & - hs_h2osfc, hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, tk, & - tk_h2osfc, fact, fn, c_h2osfc, dz_h2osfc, & - temperature_inst, waterstate_inst, rvector) - - ! - ! !DESCRIPTION: - ! Setup the RHS-Vector for the numerical solution of temperature for snow, - ! standing surface water and soil layers. - ! - ! |===========| - ! | Snow | - ! !===========| - ! rvector = | SSW | - ! !===========| - ! ! Soil | - ! !===========| - ! - ! !USES: - use clm_varcon , only : cnfac, cpliq - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8) , intent(in) :: dtime ! land model time step (sec) - real(r8) , intent(in) :: hs_h2osfc( bounds%begc: ) ! heat flux on standing water [W/m2] - real(r8) , intent(in) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8) , intent(in) :: hs_soil( bounds%begc: ) ! heat flux on soil [W/m2] - real(r8) , intent(in) :: hs_top( bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8) , intent(in) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8) , intent(in) :: sabg_lyr_col( bounds%begc: , -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8) , intent(in) :: tk( bounds%begc: , -nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8) , intent(in) :: tk_h2osfc( bounds%begc: ) ! thermal conductivity of h2osfc [W/(m K)] [col] - real(r8) , intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8) , intent(in) :: fn( bounds%begc: , -nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8) , intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8) , intent(in) :: dz_h2osfc( bounds%begc: ) ! Thickness of standing water [m] - real(r8) , intent(out) :: rvector( bounds%begc: , -nlevsno: ) ! RHS vector used in numerical solution of temperature - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - integer :: fc ! lake filtered column indices - real(r8) :: rt (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "r" vector for tridiagonal solution - real(r8) :: fn_h2osfc(bounds%begc:bounds%endc) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8) :: rt_snow(bounds%begc:bounds%endc,-nlevsno:-1) ! RHS vector corresponding to snow layers - real(r8) :: rt_ssw(bounds%begc:bounds%endc,1) ! RHS vector corresponding to standing surface water - real(r8) :: rt_soil(bounds%begc:bounds%endc,1:nlevgrnd) ! RHS vector corresponding to soil layer - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rvector) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - t_h2osfc => temperature_inst%t_h2osfc_col , & ! Input: [real(r8) (:) ] surface water temperature - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] eff. fraction of ground covered by snow (0 to 1) - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - rvector(begc:endc, :) = nan - - ! Set entries in RHS vector for snow layers - call SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - t_soisno ( begc:endc, -nlevsno+1: ), & - t_h2osfc ( begc:endc ), & - rt_snow( begc:endc, -nlevsno:)) - - ! Set entries in RHS vector for surface water layer - call SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, & - dtime, & - hs_h2osfc( begc:endc ), & - dhsdT( begc:endc ), & - tk_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fn_h2osfc( begc:endc ), & - t_soisno ( begc:endc, -nlevsno+1: ), & - t_h2osfc ( begc:endc), & - rt_ssw( begc:endc, 1:1)) - - ! Set entries in RHS vector for soil layers - call SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fn_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - frac_h2osfc ( begc:endc), & - frac_sno_eff( begc:endc), & - t_soisno ( begc:endc, -nlevsno+1: ), & - rt_soil( begc:endc, 1: )) - - ! Combine the RHS vector - do fc = 1,num_nolakec - c = filter_nolakec(fc) - rvector(c, -nlevsno:-1) = rt_snow(c, -nlevsno:-1) - rvector(c, 0 ) = rt_ssw(c, 1 ) - rvector(c, 1:nlevgrnd) = rt_soil(c, 1:nlevgrnd ) - end do - - end associate - - end subroutine SetRHSVec - - !----------------------------------------------------------------------- - subroutine SetRHSVec_Snow(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_top, dhsdT, sabg_lyr_col, & - fact, fn, t_soisno, t_h2osfc, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to snow layers. - ! - ! !USES: - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_top( bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col( bounds%begc: , -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: , -nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(in) :: t_h2osfc(bounds%begc:) ! surface water temperature (Kelvin) - real(r8), intent(out) :: rt(bounds%begc: , -nlevsno: ) ! rhs vector entries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) - - associate( & - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - rt(begc:endc, : ) = nan - - call SetRHSVec_SnowUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - t_soisno ( begc:endc, -nlevsno+1: ), & - t_h2osfc ( begc:endc ), & - rt( begc:endc, -nlevsno:)) - - call SetRHSVec_SnowNonUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - t_soisno ( begc:endc, -nlevsno+1: ), & - rt( begc:endc, -nlevsno:)) - - end associate - - end subroutine SetRHSVec_Snow - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SnowUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_top, dhsdT, sabg_lyr_col, & - fact, fn, t_soisno, t_h2osfc, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to snow layers for urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_top( bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col( bounds%begc: , -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: , -nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(in) :: t_h2osfc(bounds%begc:) ! surface water temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: , -nlevsno: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) - - associate( & - begc => bounds%begc, & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - call SetRHSVec_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - t_soisno( begc:endc, -nlevsno+1: ), & - rt( begc:endc, -nlevsno:)) - - call SetRHSVec_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - t_soisno( begc:endc, -nlevsno+1: ), & - t_h2osfc( begc:endc), & - rt( begc:endc, -nlevsno:)) - - end associate - - end subroutine SetRHSVec_SnowUrban - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_top, dhsdT, sabg_lyr_col, & - fact, fn, t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to snow layers for urban sunwall/shadewall/roof columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8) , intent(in) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8) , intent(in) :: hs_top( bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8) , intent(in) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8) , intent(in) :: sabg_lyr_col( bounds%begc: , -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8) , intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8) , intent(in) :: fn (bounds%begc: , -nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8) , intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8) , intent(inout) :: rt(bounds%begc: , -nlevsno: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - real(r8) :: rt_snow_urban(bounds%begc:bounds%endc,-nlevsno:-1) ! rhs vector entries for urban columns - real(r8) :: rt_snow_nonurban(bounds%begc:bounds%endc,-nlevsno:-1) ! rhs vector entries for non-urban columns - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) - ) - - ! - ! urban columns ------------------------------------------------------------------ - ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - ! changed hs to hs_top - rt(c,j-1) = t_soisno(c,j) + fact(c,j)*( hs_top(c) - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - rt(c,j-1) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - rt(c,j-1) = rt(c,j-1) + (fact(c,j)*sabg_lyr_col(c,j)) - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetRHSVec_SnowUrbanNonRoad - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_top, dhsdT, sabg_lyr_col, & - fact, fn, t_soisno, t_h2osfc, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to snow layers for urban road - ! (impervious + pervious) columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_top( bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col( bounds%begc: , -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: , -nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(in) :: t_h2osfc(bounds%begc: ) ! surface water temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: , -nlevsno: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - real(r8) :: rt_snow_urban(bounds%begc:bounds%endc,-nlevsno:-1) ! - real(r8) :: rt_snow_nonurban(bounds%begc:bounds%endc,-nlevsno:-1) ! - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) - ) - - ! - ! urban road columns ------------------------------------------------------------- - ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - rt(c,j-1) = t_soisno(c,j) + fact(c,j)*( hs_top_snow(c) & - - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - - rt(c,j-1) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - rt(c,j-1) = rt(c,j-1) + fact(c,j)*sabg_lyr_col(c,j) - - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetRHSVec_SnowUrbanRoad - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SnowNonUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_top, dhsdT, sabg_lyr_col, & - fact, fn, t_soisno, rt) - - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to snow layers for non-urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow( bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_top( bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT( bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col( bounds%begc: , -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: , -nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: , -nlevsno: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_top_snow) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hs_top) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, -1/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) - ) - - ! - ! non-urban columns -------------------------------------------------------------- - ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - rt(c,j-1) = t_soisno(c,j) + fact(c,j)*( hs_top_snow(c) & - - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - - else - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - - rt(c,j-1) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - rt(c,j-1) = rt(c,j-1) + fact(c,j)*sabg_lyr_col(c,j) - - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetRHSVec_SnowNonUrban - - !----------------------------------------------------------------------- - subroutine SetRHSVec_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, dtime, & - hs_h2osfc, dhsdT, tk_h2osfc, c_h2osfc, dz_h2osfc, fn_h2osfc, & - t_soisno, t_h2osfc, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to standing surface water - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: dtime ! land model time step (sec) - real(r8), intent(in) :: hs_h2osfc(bounds%begc: ) ! - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(out) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(in) :: t_h2osfc(bounds%begc:) ! surface water temperature temperature (Kelvin) - real(r8), intent(out) :: rt(bounds%begc: , 1: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc,1/)), errMsg(sourcefile, __LINE__)) - - ! Initialize - rt(bounds%begc:bounds%endc, : ) = nan - - ! - ! surface water ------------------------------------------------------------------ - ! - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! surface water layer has two coefficients - dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) - - fn_h2osfc(c)=tk_h2osfc(c)*(t_soisno(c,1)-t_h2osfc(c))/dzm - rt(c,1)= t_h2osfc(c) + (dtime/c_h2osfc(c)) & - *( hs_h2osfc(c) - dhsdT(c)*t_h2osfc(c) + cnfac*fn_h2osfc(c) )!rhs for h2osfc - - enddo - - end subroutine SetRHSVec_StandingSurfaceWater - - !----------------------------------------------------------------------- - subroutine SetRHSVec_Soil(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, fact, fn, fn_h2osfc, c_h2osfc, & - frac_h2osfc, frac_sno_eff, t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to soil layers - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow(bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_soil(bounds%begc: ) ! heat flux on soil [W/m2] - real(r8), intent(in) :: hs_top(bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col(bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: frac_h2osfc(bounds%begc: ) ! fractional area with surface water greater than zero - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(out) :: rt(bounds%begc: ,1: ) ! rhs vector entries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - rt(begc:endc, : ) = nan - - call SetRHSVec_SoilUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fn_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - frac_sno_eff( begc:endc ), & - t_soisno( begc:endc, -nlevsno+1: ), & - rt( begc:endc, 1: )) - - call SetRHSVec_SoilNonUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fn_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - frac_sno_eff(begc:endc), & - t_soisno( begc:endc, -nlevsno+1: ), & - rt( begc:endc, 1: )) - - call SetRHSVec_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fn_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - frac_h2osfc(begc:endc), & - t_soisno( begc:endc, -nlevsno+1: ), & - rt( begc:endc, 1: )) - - end associate - - end subroutine SetRHSVec_Soil - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SoilUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, fact, fn, fn_h2osfc, c_h2osfc, & - frac_sno_eff, t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to soil layers for urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow(bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_soil(bounds%begc: ) ! heat flux on soil [W/m2] - real(r8), intent(in) :: hs_top(bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col(bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: ,1: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - call SetRHSVec_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fn_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - t_soisno( begc:endc, -nlevsno+1: ), & - rt( begc:endc, 1: )) - - call SetRHSVec_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow( begc:endc ), & - hs_soil( begc:endc ), & - hs_top( begc:endc ), & - dhsdT( begc:endc ), & - sabg_lyr_col (begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - fn( begc:endc, -nlevsno+1: ), & - fn_h2osfc( begc:endc ), & - c_h2osfc( begc:endc ), & - frac_sno_eff( begc:endc ), & - t_soisno( begc:endc, -nlevsno+1: ), & - rt( begc:endc, 1: )) - - end associate - - end subroutine SetRHSVec_SoilUrban - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, fact, fn, fn_h2osfc, c_h2osfc, & - t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to soil layers for urban sunwall/shadewall/roof columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow(bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_soil(bounds%begc: ) ! heat flux on soil [W/m2] - real(r8), intent(in) :: hs_top(bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col(bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: ,1: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) - ) - - ! - ! urban columns ------------------------------------------------------------------ - ! - do j = 1,nlevurb - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - ! changed hs to hs_top - rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top(c) - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else if (j <= nlevurb-1) then - ! if this is a snow layer or the top soil layer, - ! add absorbed solar flux to factor 'rt' - if (j == 1) then - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - rt(c,j) = rt(c,j) + (fact(c,j)*sabg_lyr_col(c,j)) - else - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - endif - - else if (j == nlevurb) then - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - rt(c,j) = t_soisno(c,j) + fact(c,j)*( fn(c,j) - cnfac*fn(c,j-1) ) - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetRHSVec_SoilUrbanNonRoad - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, fact, fn, fn_h2osfc, c_h2osfc, & - frac_sno_eff, t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to soil layers for urban road - ! (impervious + pervious) columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow(bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_soil(bounds%begc: ) ! heat flux on soil [W/m2] - real(r8), intent(in) :: hs_top(bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col(bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: ,1: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:) ] layer thickness (m) - ) - - ! - ! urban road columns ------------------------------------------------------------- - ! - do j = 1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then - if (j == col%snl(c)+1) then - rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top_snow(c) & - - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else if (j == 1) then - ! this is the snow/soil interface layer - rt(c,j) = t_soisno(c,j) + fact(c,j) & - *((1._r8-frac_sno_eff(c))*(hs_soil(c) - dhsdT(c)*t_soisno(c,j)) & - + cnfac*(fn(c,j) - frac_sno_eff(c) * fn(c,j-1))) - - rt(c,j) = rt(c,j) + frac_sno_eff(c)*fact(c,j)*sabg_lyr_col(c,j) - - else if (j <= nlevgrnd-1) then - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - - else if (j == nlevgrnd) then - rt(c,j) = t_soisno(c,j) - cnfac*fact(c,j)*fn(c,j-1) + fact(c,j)*fn(c,j) - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetRHSVec_SoilUrbanRoad - - !----------------------------------------------------------------------- - subroutine SetRHSVec_SoilNonUrban(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, fact, fn, fn_h2osfc, c_h2osfc, & - frac_sno_eff, t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to soil layers. - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow(bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_soil(bounds%begc: ) ! heat flux on soil [W/m2] - real(r8), intent(in) :: hs_top(bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col(bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fractional area with surface water greater than zero - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: ,1: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! non-urban columns -------------------------------------------------------------- - ! - do j = 1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j == col%snl(c)+1) then - rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top_snow(c) & - - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else if (j == 1) then - ! this is the snow/soil interface layer - rt(c,j) = t_soisno(c,j) + fact(c,j) & - *((1._r8-frac_sno_eff(c))*(hs_soil(c) - dhsdT(c)*t_soisno(c,j)) & - + cnfac*(fn(c,j) - frac_sno_eff(c) * fn(c,j-1))) - - rt(c,j) = rt(c,j) + frac_sno_eff(c)*fact(c,j)*sabg_lyr_col(c,j) - - else if (j <= nlevgrnd-1) then - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - - else if (j == nlevgrnd) then - rt(c,j) = t_soisno(c,j) - cnfac*fact(c,j)*fn(c,j-1) + fact(c,j)*fn(c,j) - end if - end if - enddo - end do - - end associate - - end subroutine SetRHSVec_SoilNonUrban - - !----------------------------------------------------------------------- - subroutine SetRHSVec_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, & - hs_top_snow, hs_soil, hs_top, dhsdT, sabg_lyr_col, fact, fn, fn_h2osfc, c_h2osfc, & - frac_h2osfc, t_soisno, rt) - ! - ! !DESCRIPTION: - ! Sets up RHS vector corresponding to soil layers. - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: hs_top_snow(bounds%begc: ) ! heat flux on top snow layer [W/m2] - real(r8), intent(in) :: hs_soil(bounds%begc: ) ! heat flux on soil [W/m2] - real(r8), intent(in) :: hs_top(bounds%begc: ) ! net energy flux into surface layer (col) [W/m2] - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: sabg_lyr_col(bounds%begc:, -nlevsno+1: ) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: fn (bounds%begc: ,-nlevsno+1: ) ! heat diffusion through the layer interface [W/m2] - real(r8), intent(in) :: fn_h2osfc (bounds%begc: ) ! heat diffusion through standing-water/soil interface [W/m2] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: frac_h2osfc(bounds%begc: ) ! fractional area with surface water greater than zero - real(r8), intent(in) :: t_soisno(bounds%begc:, -nlevsno+1:) ! soil temperature (Kelvin) - real(r8), intent(inout) :: rt(bounds%begc: ,1: ) ! rhs vector entries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(hs_soil) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sabg_lyr_col) == (/bounds%endc, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fn_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rt) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - ! - ! surface water ----------------------------------------------------------------- - ! - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ( frac_h2osfc(c) /= 0.0_r8 )then - rt(c,1)=rt(c,1) & - -frac_h2osfc(c)*fact(c,1)*((hs_soil(c) - dhsdT(c)*t_soisno(c,1)) & - +cnfac*fn_h2osfc(c)) - end if - end do - - end subroutine SetRHSVec_Soil_StandingSurfaceWater - - !----------------------------------------------------------------------- - subroutine SetMatrix(bounds, num_nolakec, filter_nolakec, dtime, nband, & - dhsdT, tk, tk_h2osfc, fact, c_h2osfc, dz_h2osfc, waterstate_inst, bmatrix) - ! - ! !DESCRIPTION: - ! Setup the matrix for the numerical solution of temperature for snow, - ! standing surface water and soil layers. - ! - ! - ! |===========|===========|===========| - ! | Snow | | Snow-Soil | - ! !===========|===========|===========| - ! bmatrix = | | SSW | SSW-Soil | - ! !===========|===========|===========| - ! ! Soil-Snow | Soil-SSW | Soil | - ! !===========|===========|===========| - ! - ! - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: dtime ! land model time step (sec) - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(out) :: bmatrix(bounds%begc: , 1:,-nlevsno: ) ! matrix for numerical solution of temperature - type(waterstate_type), intent(in) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - integer :: fc ! lake filtered column indices - real(r8) :: at (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "a" vector for tridiagonal matrix - real(r8) :: bt (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "b" vector for tridiagonal matrix - real(r8) :: ct (bounds%begc:bounds%endc,-nlevsno+1:nlevgrnd) ! "c" vector for tridiagonal matrix - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - real(r8) :: bmatrix_snow(bounds%begc:bounds%endc,nband,-nlevsno:-1 ) ! block-diagonal matrix for snow layers - real(r8) :: bmatrix_ssw(bounds%begc:bounds%endc,nband, 0:0 ) ! block-diagonal matrix for standing surface water - real(r8) :: bmatrix_soil(bounds%begc:bounds%endc,nband, 1:nlevgrnd) ! block-diagonal matrix for soil layers - real(r8) :: bmatrix_snow_soil(bounds%begc:bounds%endc,nband,-1:-1) ! off-diagonal matrix for snow-soil interaction - real(r8) :: bmatrix_ssw_soil(bounds%begc:bounds%endc,nband, 0:0 ) ! off-diagonal matrix for standing surface water-soil interaction - real(r8) :: bmatrix_soil_snow(bounds%begc:bounds%endc,nband, 1:1 ) ! off-diagonal matrix for soil-snow interaction - real(r8) :: bmatrix_soil_ssw(bounds%begc:bounds%endc,nband, 1:1 ) ! off-diagonal matrix for soil-standing surface water interaction - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z , & ! Input: [real(r8) (:,:) ] layer thickness (m) - frac_h2osfc => waterstate_inst%frac_h2osfc_col , & ! Input: [real(r8) (:) ] fraction of ground covered by surface water (0 to 1) - frac_sno_eff => waterstate_inst%frac_sno_eff_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Assemble smaller matrices - - call SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) - - call SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow_soil( begc:endc, 1:, -1: )) - - call SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - frac_h2osfc(begc:endc), & - frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) - - call SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil_snow( begc:endc, 1:, 1: )) - - call SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, dtime, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - c_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - bmatrix_ssw( begc:endc, 1:, 0: )) - - call SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolakec, dtime, nband, & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - c_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - bmatrix_ssw_soil( begc:endc, 1:, 0: )) - - call SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, nband, & - tk_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - dz_h2osfc( begc:endc ), & - frac_h2osfc(begc:endc), & - bmatrix_soil_ssw( begc:endc, 1:, 1: )) - - call AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nband, & - bmatrix_snow( begc:endc, 1:, -nlevsno: ), & - bmatrix_ssw( begc:endc, 1:, 0: ), & - bmatrix_soil( begc:endc, 1:, 1: ), & - bmatrix_snow_soil( begc:endc, 1:, -1: ), & - bmatrix_ssw_soil( begc:endc, 1:, 0: ), & - bmatrix_soil_snow( begc:endc, 1:, 1: ), & - bmatrix_soil_ssw( begc:endc, 1:, 1: ), & - bmatrix( begc:endc, 1:, -nlevsno: )) - - end associate - - end subroutine SetMatrix - - !----------------------------------------------------------------------- - subroutine AssembleMatrixFromSubmatrices(bounds, num_nolakec, filter_nolakec, nband, & - bmatrix_snow, bmatrix_ssw, bmatrix_soil, bmatrix_snow_soil, & - bmatrix_ssw_soil, bmatrix_soil_snow, bmatrix_soil_ssw, bmatrix) - - ! - ! !DESCRIPTION: - ! Assemble the full matrix from submatrices. - ! - ! Non-zero pattern of bmatrix (assuming 5 snow layers): - ! - ! SNOW-LAYERS - ! | - ! | STANDING-SURFACE-WATER - ! | | - ! | | SOIL-LAYERS - ! | | | - ! v v v - ! - ! -5 -4 -3 -2 -1| 0| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - ! ============================================================== - ! -5 | x x | | | - ! -4 | x x x | | | - ! -3 | x x x | | | - ! -2 | x x x| | | - ! -1 | x x| | x | - ! ============================================================== - ! 0 | | x| x | - ! ============================================================== - ! 1 | x| x| x x | - ! 2 | | | x x x | - ! 3 | | | x x x | - ! 4 | | | x x x | - ! 5 | | | x x x | - ! 6 | | | x x x | - ! 7 | | | x x x | - ! 8 | | | x x x | - ! 9 | | | x x x | - ! 10 | | | x x x | - ! 11 | | | x x x | - ! 12 | | | x x x | - ! 13 | | | x x x | - ! 14 | | | x x x| - ! 15 | | | x x| - ! ============================================================== - ! - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: bmatrix_snow(bounds%begc: , 1: , -nlevsno: ) ! block-diagonal matrix for snow layers [col, nband, nlevsno] - real(r8), intent(in) :: bmatrix_ssw(bounds%begc: , 1: , 0: ) ! block-diagonal matrix for standing surface water [col, nband, 0:0] - real(r8), intent(in) :: bmatrix_soil(bounds%begc: , 1: , 1: ) ! block-diagonal matrix for soil layers [col, nband, nlevgrnd] - real(r8), intent(in) :: bmatrix_snow_soil(bounds%begc: , 1: , -1: ) ! off-diagonal matrix for snow-soil interaction [col, nband, -1:-1] - real(r8), intent(in) :: bmatrix_ssw_soil(bounds%begc: , 1: , 0: ) ! off-diagonal matrix for standing surface water-soil interaction [col, nband, 0:0] - real(r8), intent(in) :: bmatrix_soil_snow(bounds%begc: , 1: , 1: ) ! off-diagonal matrix for soil-snow interaction [col, nband, 1:1] - real(r8), intent(in) :: bmatrix_soil_ssw(bounds%begc: , 1: , 1: ) ! off-diagonal matrix for soil-standing surface water interaction [col, nband, 1:1] - real(r8), intent(out) :: bmatrix(bounds%begc: , 1: , -nlevsno: ) ! full matrix used in numerical solution of temperature [col, nband, -nlevsno:nlevgrnd] - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - integer :: fc ! lake filtered column indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - ! Assemble the full matrix - - bmatrix(bounds%begc:bounds%endc, :, :) = 0.0_r8 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! Snow - bmatrix(c,2:3,-nlevsno ) = bmatrix_snow(c,2:3,-nlevsno ) - bmatrix(c,2:4,-nlevsno+1:-2) = bmatrix_snow(c,2:4,-nlevsno+1:-2) - bmatrix(c,3:4,-1 ) = bmatrix_snow(c,3:4,-1 ) - - ! Snow-Soil - bmatrix(c,1,-1) = bmatrix_snow_soil(c,1,-1) - - ! StandingSurfaceWater - bmatrix(c,3,0) = bmatrix_ssw(c,3,0) - - ! StandingSurfaceWater-Soil - bmatrix(c,2,0) = bmatrix_ssw_soil(c,2,0) - - ! Soil - bmatrix(c,2:3,1 ) = bmatrix_soil(c,2:3,1 ) - bmatrix(c,2:4,2:nlevgrnd-1) = bmatrix_soil(c,2:4,2:nlevgrnd-1) - bmatrix(c,3:4,nlevgrnd ) = bmatrix_soil(c,3:4,nlevgrnd ) - - ! Soil-Snow - bmatrix(c,5,1) = bmatrix_soil_snow(c,5,1) - - ! Soil-StandingSurfaceWater - bmatrix(c,4,1) = bmatrix_soil_ssw(c,4,1) - - end do - - end subroutine AssembleMatrixFromSubmatrices - - !----------------------------------------------------------------------- - subroutine SetMatrix_Snow(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, fact, frac_sno_eff, bmatrix_snow) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal snow layers - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(out) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - bmatrix_snow(begc:endc, :, :) = 0.0_r8 - - call SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) - - call SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) - - end associate - - end subroutine SetMatrix_Snow - - !----------------------------------------------------------------------- - subroutine SetMatrix_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, fact, bmatrix_snow) - - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal snow layers for - ! urban soil columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - call SetMatrix_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) - - call SetMatrix_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow( begc:endc, 1:, -nlevsno: )) - - end associate - - end subroutine SetMatrix_SnowUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, fact, bmatrix_snow) - - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal snow layers for - ! urban sunwall/shadewall/roof columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! urban non-road columns --------------------------------------------------------- - ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow(c,4,j-1) = 0._r8 - bmatrix_snow(c,3,j-1) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - end if - else if (j <= nlevurb-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - if (j /= 0) then - bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_SnowUrbanNonRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, fact, bmatrix_snow) - - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal snow layers for - ! urban road (impervious + pervious) columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! urban road columns ------------------------------------------------------------- - ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow(c,4,j-1) = 0._r8 - bmatrix_snow(c,3,j-1) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - end if - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_SnowUrbanRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, fact, bmatrix_snow) - - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal snow layers for non-urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow(bounds%begc: , 1:, -nlevsno: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! non-urban landunits ------------------------------------------------------------ - ! - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow(c,4,j-1) = 0._r8 - bmatrix_snow(c,3,j-1) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - end if - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow(c,4,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_snow(c,3,j-1) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - if ( j /= 0) then - bmatrix_snow(c,2,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_SnowNonUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_Snow_Soil(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, bmatrix_snow_soil) - - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to snow-soil interaction - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(out) :: bmatrix_snow_soil(bounds%begc: , 1:,-1: ) ! matrix enteries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - bmatrix_snow_soil(begc:endc, :, :) = 0.0_r8 - - call SetMatrix_Snow_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow_soil( begc:endc, 1:, -1: )) - - call SetMatrix_Snow_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow_soil( begc:endc, 1:, -1: )) - - end associate - - end subroutine SetMatrix_Snow_Soil - - !----------------------------------------------------------------------- - subroutine SetMatrix_Snow_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, bmatrix_snow_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to snow-soil interaction for urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow_soil(bounds%begc: , 1:,-1: ) ! matrix enteries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - call SetMatrix_Snow_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow_soil( begc:endc, 1:, -1: )) - - call SetMatrix_Snow_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_snow_soil( begc:endc, 1:, -1: )) - - end associate - - end subroutine SetMatrix_Snow_SoilUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_Snow_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, bmatrix_snow_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to snow-soil interaction for - ! urban sunwall/shadewall/roof columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow_soil(bounds%begc: , 1:,-1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - ! - ! urban non-road columns --------------------------------------------------------- - ! - do j = 0,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevurb-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_Snow_SoilUrbanNonRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_Snow_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, bmatrix_snow_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to snow-soil interaction for - ! urban road (impervious + pervious) columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow_soil(bounds%begc: , 1:,-1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! urban road columns ------------------------------------------------------------- - ! - do j = 0,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_Snow_SoilUrbanRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_Snow_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, bmatrix_snow_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to snow-soil interaction for - ! non-urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_snow_soil(bounds%begc: , 1:,-1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_snow_soil) == (/bounds%endc, nband, -1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! non-urban columns -------------------------------------------------------------- - ! - do j = 0,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_snow_soil(c,1,j-1) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_snow_soil(c,1,j-1) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_Snow_SoilNonUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, frac_h2osfc, frac_sno_eff, bmatrix_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal soil layers. - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_h2osfc(bounds%begc: ) ! fractional area with surface water greater than zero - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(out) :: bmatrix_soil(bounds%begc: , 1:, 1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - bmatrix_soil(begc:endc, :, :) = 0.0_r8 - - call SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) - - call SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) - - ! the solution will be organized as (snow:h2osfc:soil) to minimize - ! bandwidth; this requires a 5-element band instead of 3 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! surface water layer has two coefficients - dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) - - ! diagonal element correction for presence of h2osfc - if ( frac_h2osfc(c) /= 0.0_r8 ) then - bmatrix_soil(c,3,1)=bmatrix_soil(c,3,1)+ frac_h2osfc(c) & - *((1._r8-cnfac)*fact(c,1)*tk_h2osfc(c)/dzm + fact(c,1)*dhsdT(c)) - end if - - enddo - - end associate - - end subroutine SetMatrix_Soil - - !----------------------------------------------------------------------- - subroutine SetMatrix_SoilUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, frac_sno_eff, bmatrix_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal soil layers for - ! urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(inout) :: bmatrix_soil(bounds%begc: , 1:, 1: ) ! matrix enteries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - call SetMatrix_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_soil( begc:endc, 1:, 1: )) - - call SetMatrix_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT( begc:endc ), & - tk( begc:endc, -nlevsno+1: ), & - tk_h2osfc( begc:endc ), & - dz_h2osfc( begc:endc ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil( begc:endc, 1:, 1: )) - - end associate - - end subroutine SetMatrix_SoilUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_SoilUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, bmatrix_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal soil layers for - ! urban sunwall/shadewall/roof columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_soil(bounds%begc: , 1:, 1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! urban non-road columns --------------------------------------------------------- - ! - do j = 1,nlevurb - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - end if - bmatrix_soil(c,3,j) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevurb-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - end if - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - else if (j == nlevurb) then - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prognostic inner - ! surface temperature. - dzm = ( z(c,j)-z(c,j-1)) - dzp = (zi(c,j)-z(c,j)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) - bmatrix_soil(c,2,j) = 0._r8 - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_SoilUrbanNonRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_SoilUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, frac_sno_eff, bmatrix_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal soil layers for - ! urban road (impervious + pervious) columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(inout) :: bmatrix_soil(bounds%begc: , 1:, 1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! urban road columns ------------------------------------------------------------- - ! - do j = 1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - end if - bmatrix_soil(c,3,j) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j == 1) then - ! this is the snow/soil interface layer - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - end if - bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & - + frac_sno_eff(c) * tk(c,j-1)/dzm) & - - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - else if (j == nlevgrnd) then - dzm = (z(c,j)-z(c,j-1)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,2,j) = 0._r8 - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_SoilUrbanRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_SoilNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - dhsdT, tk, tk_h2osfc, dz_h2osfc, fact, frac_sno_eff, bmatrix_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal soil layers. - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(inout) :: bmatrix_soil(bounds%begc: , 1:, 1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil) == (/bounds%endc, nband, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! non-urban columns -------------------------------------------------------------- - ! - do j = 1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - if (j /= 1) then - bmatrix_soil(c,4,j) = 0._r8 - end if - bmatrix_soil(c,3,j) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j == 1) then - ! this is the snow/soil interface layer - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - if (j /= 1) then - bmatrix_soil(c,4,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - end if - bmatrix_soil(c,3,j) = 1._r8 + (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp & - + frac_sno_eff(c) * tk(c,j-1)/dzm) & - - (1._r8 - frac_sno_eff(c))*fact(c,j)*dhsdT(c) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - bmatrix_soil(c,2,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - else if (j == nlevgrnd) then - dzm = (z(c,j)-z(c,j-1)) - bmatrix_soil(c,4,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,3,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bmatrix_soil(c,2,j) = 0._r8 - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_SoilNonUrban - - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil_Snow(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, frac_sno_eff, bmatrix_soil_snow) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to soil-snow interaction - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(out) :: bmatrix_soil_snow(bounds%begc: , 1: ,1: ) ! matrix enteries - !------------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - - associate( & - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - ! Initialize - bmatrix_soil_snow(begc:endc, :, :) = 0.0_r8 - - call SetMatrix_Soil_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil_snow( begc:endc, 1:, 1: )) - - call SetMatrix_Soil_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil_snow( begc:endc, 1:, 1: )) - - end associate - - end subroutine SetMatrix_Soil_Snow - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil_SnowUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, frac_sno_eff, bmatrix_soil_snow) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to soil-snow interaction for - ! urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(inout) :: bmatrix_soil_snow(bounds%begc: , 1: ,1: ) ! matrix enteries - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - - associate(& - begc => bounds%begc , & ! Input: [integer ] beginning column index - endc => bounds%endc & ! Input: [integer ] ending column index - ) - - call SetMatrix_Soil_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - bmatrix_soil_snow( begc:endc, 1:, 1: )) - - call SetMatrix_Soil_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk( begc:endc, -nlevsno+1: ), & - fact( begc:endc, -nlevsno+1: ), & - frac_sno_eff(begc:endc), & - bmatrix_soil_snow( begc:endc, 1:, 1: )) - - end associate - - endsubroutine SetMatrix_Soil_SnowUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil_SnowUrbanNonRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, bmatrix_soil_snow) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to soil-snow interaction for - ! urban sunwall/shadewall/roof columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(inout) :: bmatrix_soil_snow(bounds%begc: , 1: ,1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - - associate( & - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - ! - ! - do j = 1,1 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if ((col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_soil_snow(c,5,j) = 0._r8 - else if (j <= nlevurb-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - bmatrix_soil_snow(c,5,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - end if - end if - end if - end if - enddo - end do - - end associate - - end subroutine SetMatrix_Soil_SnowUrbanNonRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil_SnowUrbanRoad(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, frac_sno_eff, bmatrix_soil_snow) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to soil-snow interaction for - ! urban road (impervious + pervious) columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_road_imperv, icol_road_perv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(inout) :: bmatrix_soil_snow(bounds%begc: , 1: ,1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! urban road columns ------------------------------------------------------------- - ! - do j = 1,1 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_imperv .or. col%itype(c) == icol_road_perv) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_soil_snow(c,5,j) = 0._r8 - else if (j == 1) then - ! this is the snow/soil interface layer - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - - bmatrix_soil_snow(c,5,j) = - frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - end if - end if - end if - end if - end do - end do - - end associate - - end subroutine SetMatrix_Soil_SnowUrbanRoad - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil_SnowNonUrban(bounds, num_nolakec, filter_nolakec, nband, & - tk, fact, frac_sno_eff, bmatrix_soil_snow) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to soil-snow interaction for - ! non urban columns - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: frac_sno_eff(bounds%begc: ) ! fraction of ground covered by snow (0 to 1) - real(r8), intent(inout) :: bmatrix_soil_snow(bounds%begc: , 1: ,1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: j,c,l ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_sno_eff) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_snow) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - - associate(& - z => col%z & ! Input: [real(r8) (:,:)] layer thickness (m) - ) - - ! - ! non-urban columns -------------------------------------------------------------- - ! - do j = 1,1 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (.not. lun%urbpoi(l)) then - if (j >= col%snl(c)+1) then - if (j == col%snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - bmatrix_soil_snow(c,5,j) = 0._r8 - else if (j == 1) then - ! this is the snow/soil interface layer - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - - bmatrix_soil_snow(c,5,j) = -frac_sno_eff(c) * (1._r8-cnfac) * fact(c,j) & - * tk(c,j-1)/dzm - end if - end if - end if - end do - end do - - end associate - - end subroutine SetMatrix_Soil_SnowNonUrban - - !----------------------------------------------------------------------- - subroutine SetMatrix_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, dtime, nband, & - dhsdT, tk, tk_h2osfc, fact, c_h2osfc, dz_h2osfc, bmatrix_ssw) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to internal standing water layer - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: dtime ! land model time step (sec) - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: dhsdT(bounds%begc: ) ! temperature derivative of "hs" [col] - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(out) :: bmatrix_ssw(bounds%begc: , 1:, 0: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: c ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(dhsdT) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_ssw) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) - - ! Initialize - bmatrix_ssw(bounds%begc:bounds%endc, :, :) = 0.0_r8 - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! surface water layer has two coefficients - dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) - - bmatrix_ssw(c,3,0)= 1+(1._r8-cnfac)*(dtime/c_h2osfc(c)) & - *tk_h2osfc(c)/dzm -(dtime/c_h2osfc(c))*dhsdT(c) !interaction from atm - - enddo - - end subroutine SetMatrix_StandingSurfaceWater - - !----------------------------------------------------------------------- - subroutine SetMatrix_StandingSurfaceWater_Soil(bounds, num_nolakec, filter_nolakec, dtime, nband, & - tk, tk_h2osfc, fact, c_h2osfc, dz_h2osfc, bmatrix_ssw_soil) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to standing surface water-soil layer interaction - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - real(r8), intent(in) :: dtime ! land model time step (sec) - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk(bounds%begc: ,-nlevsno+1: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: c_h2osfc( bounds%begc: ) ! heat capacity of surface water [col] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(out) :: bmatrix_ssw_soil(bounds%begc: , 1: ,0: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: c ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_ssw_soil) == (/bounds%endc, nband, 0/)), errMsg(sourcefile, __LINE__)) - - ! Initialize - bmatrix_ssw_soil(bounds%begc:bounds%endc, :, :) = 0.0_r8 - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! surface water layer has two coefficients - dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) - - bmatrix_ssw_soil(c,2,0)= -(1._r8-cnfac)*(dtime/c_h2osfc(c))*tk_h2osfc(c)/dzm !flux to top soil layer - - enddo - - end subroutine SetMatrix_StandingSurfaceWater_Soil - - !----------------------------------------------------------------------- - subroutine SetMatrix_Soil_StandingSurfaceWater(bounds, num_nolakec, filter_nolakec, nband, & - tk_h2osfc, fact, dz_h2osfc, frac_h2osfc, bmatrix_soil_ssw) - ! - ! !DESCRIPTION: - ! Setup the matrix entries corresponding to soil layer-standing surface water interaction - ! - ! !USES: - use clm_varcon , only : cnfac - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varpar , only : nlevsno, nlevgrnd - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: nband ! number of bands of the tridigonal matrix - real(r8), intent(in) :: tk_h2osfc(bounds%begc: ) ! thermal conductivity [W/(m K)] - real(r8), intent(in) :: fact( bounds%begc: , -nlevsno+1: ) ! used in computing tridiagonal matrix [col, lev] - real(r8), intent(in) :: dz_h2osfc(bounds%begc: ) ! Thickness of standing water [m] - real(r8), intent(in) :: frac_h2osfc(bounds%begc: ) ! fractional area with surface water greater than zero - real(r8), intent(out) :: bmatrix_soil_ssw(bounds%begc: , 1:, 1: ) ! matrix enteries - ! - ! !LOCAL VARIABLES: - integer :: c ! indices - integer :: fc ! lake filtered column indices - real(r8) :: dzm ! used in computing tridiagonal matrix - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fact) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(dz_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_h2osfc) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bmatrix_soil_ssw) == (/bounds%endc, nband, 1/)), errMsg(sourcefile, __LINE__)) - - ! Initialize - bmatrix_soil_ssw(bounds%begc:bounds%endc, :, :) = 0.0_r8 - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - ! surface water layer has two coefficients - dzm=(0.5*dz_h2osfc(c)+col%z(c,1)) - - ! top soil layer has sub coef shifted to 2nd super diagonal - if ( frac_h2osfc(c) /= 0.0_r8 )then - bmatrix_soil_ssw(c,4,1)= - frac_h2osfc(c) * (1._r8-cnfac) * fact(c,1) & - * tk_h2osfc(c)/dzm !flux from h2osfc - end if - enddo - - end subroutine SetMatrix_Soil_StandingSurfaceWater - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: BuildingHAC - ! - ! !INTERFACE: - subroutine BuildingHAC( bounds, num_urbanl, filter_urbanl, temperature_inst, urbanparams_inst, urbantv_inst, & - cool_on, heat_on ) - ! !DESCRIPTION: - ! Simpler method to manage building temperature (first introduced in CLM4.5). Restricts building - ! temperature to within bounds, and determine's if heating or cooling is on. - ! !USES: - implicit none - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - type(temperature_type) , intent(inout) :: temperature_inst ! Temperature variables - type(urbanparams_type) , intent(in) :: urbanparams_inst ! urban parameters - type(urbantv_type) , intent(in) :: urbantv_inst ! urban parameters - logical, intent(out) :: cool_on(bounds%begl:) ! is urban air conditioning on? - logical, intent(out) :: heat_on(bounds%begl:) ! is urban heating on? - !----------------------------------------------------------------------- - ! !LOCAL VARIABLES: - integer :: fl,l ! indices - !EOP - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(cool_on) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(heat_on) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - associate(& - urbpoi => lun%urbpoi , & ! Input: [logical (:)] true => landunit is an urban point - - t_building => temperature_inst%t_building_lun , & ! Input: [real(r8) (:)] internal building air temperature (K) - - t_building_max => urbantv_inst%t_building_max , & ! Input: [real(r8) (:)] maximum internal building air temperature (K) - t_building_min => urbanparams_inst%t_building_min & ! Input: [real(r8) (:)] minimum internal building air temperature (K) - ) - ! Restrict internal building temperature to between min and max - ! and determine if heating or air conditioning is on - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - cool_on(l) = .false. - heat_on(l) = .false. - if (t_building(l) > t_building_max(l)) then - t_building(l) = t_building_max(l) - cool_on(l) = .true. - heat_on(l) = .false. - else if (t_building(l) < t_building_min(l)) then - t_building(l) = t_building_min(l) - cool_on(l) = .false. - heat_on(l) = .true. - end if - end if - end do - - end associate - - end subroutine BuildingHAC - - !----------------------------------------------------------------------- - -end module SoilTemperatureMod - diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 deleted file mode 100644 index e471118dcf..0000000000 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ /dev/null @@ -1,2233 +0,0 @@ -module SoilWaterMovementMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! DESCRIPTION - ! module contains different subroutines to couple soil and root water interactions - ! - ! created by Jinyun Tang, Mar 12, 2014 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use clm_instMod , only : clm_fates - - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilWater ! Calculate soil hydrology - public :: init_soilwater_movement - private :: soilwater_zengdecker2009 - private :: soilwater_moisture_form -! private :: soilwater_mixed_form -! private :: soilwater_head_form - private :: compute_hydraulic_properties - private :: compute_moisture_fluxes_and_derivs - private :: compute_RHS_moisture_form - private :: compute_LHS_moisture_form - private :: compute_qcharge - private :: IceImpedance - private :: TridiagonalCol - ! - ! The following is only public for the sake of unit testing; it should not be called - ! directly by CLM code outside this module - public :: BaseflowSink - public :: use_aquifer_layer - ! - ! !PUBLIC DATA MEMBERS: -! logical, public :: use_bedrock = .false. ! true => run with spatially variable soil depth - - ! !PRIVATE DATA MEMBERS: - - ! Solution method - integer, parameter :: zengdecker_2009 = 0 - integer, parameter :: moisture_form = 1 - integer, parameter :: mixed_form = 2 - integer, parameter :: head_form = 3 - - ! Boundary conditions - integer, parameter :: bc_head = 0 - integer, parameter :: bc_flux = 1 - integer, parameter :: bc_zero_flux = 2 - integer, parameter :: bc_waterTable = 3 - integer, parameter :: bc_aquifer = 4 - - ! Soil hydraulic properties - integer, parameter :: soil_hp_clapphornberg_1978=0 - integer, parameter :: soil_hp_vanGenuchten_1980=1 - - real(r8),parameter :: m_to_mm = 1.e3_r8 !convert meters to mm - - integer :: soilwater_movement_method ! method for solving richards equation - integer :: upper_boundary_condition ! named variable for the boundary condition - integer :: lower_boundary_condition ! named variable for the boundary condition - - ! Adaptive time stepping algorithmic control parameters - real(r8) :: dtmin ! minimum time step length (seconds) - real(r8) :: verySmall ! a very small number: used to check for sub step completion - real(r8) :: xTolerUpper ! tolerance to halve length of substep - real(r8) :: xTolerLower ! tolerance to double length of substep - integer :: expensive - integer :: inexpensive - integer :: flux_calculation - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - -!#1 - !----------------------------------------------------------------------- - subroutine init_soilwater_movement() - ! - !DESCRIPTION - !specify method for doing soil&root water interactions - ! - ! !USES: - use abortutils , only : endrun - use fileutils , only : getavu, relavu - use spmdMod , only : mpicom, masterproc - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog, use_bedrock - use controlMod , only : NLFilename - use clm_nlUtilsMod , only : find_nlgroup_name - - ! !ARGUMENTS: - !------------------------------------------------------------------------------ - implicit none - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - character(*), parameter :: subName = "('init_soilwater_movement')" - - !----------------------------------------------------------------------- - -! MUST agree with name in namelist and read statement - namelist /soilwater_movement_inparm/ & - soilwater_movement_method, & - upper_boundary_condition, & - lower_boundary_condition, & - dtmin, & - verySmall, & - xTolerUpper, & - xTolerLower, & - expensive, & - inexpensive, & - flux_calculation - - ! Default values for namelist - - soilwater_movement_method = zengdecker_2009 - upper_boundary_condition = bc_flux - lower_boundary_condition = bc_aquifer - - dtmin=60._r8 - verySmall=1.e-8_r8 - xTolerUpper=1.e-1_r8 - xTolerLower=1.e-2_r8 - expensive=42 - inexpensive=1 - flux_calculation=inexpensive - - ! Read soilwater_movement namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'soilwater_movement_inparm', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=soilwater_movement_inparm,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading soilwater_movement namelist') - end if - else - call endrun(subname // ':: ERROR reading soilwater_movement namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - -! test for namelist consistency - if((soilwater_movement_method == zengdecker_2009) .and. & - (lower_boundary_condition /= bc_aquifer)) then - call endrun(subname // ':: ERROR inconsistent soilwater_movement namelist: ZD09 must use bc_aquifer lbc') - endif - if((use_bedrock) .and. (lower_boundary_condition /= bc_zero_flux)) then - call endrun(subname // ':: ERROR inconsistent soilwater_movement namelist: use_bedrock requires bc_zero_flux lbc') - endif - endif - - call shr_mpi_bcast(soilwater_movement_method, mpicom) - call shr_mpi_bcast(upper_boundary_condition, mpicom) - call shr_mpi_bcast(lower_boundary_condition, mpicom) - call shr_mpi_bcast(dtmin, mpicom) - call shr_mpi_bcast(verySmall, mpicom) - call shr_mpi_bcast(xTolerUpper, mpicom) - call shr_mpi_bcast(xTolerLower, mpicom) - call shr_mpi_bcast(expensive, mpicom) - call shr_mpi_bcast(inexpensive, mpicom) - call shr_mpi_bcast(flux_calculation, mpicom) - - - if (masterproc) then - - write(iulog,*) ' ' - write(iulog,*) 'soilwater_movement settings:' - write(iulog,*) ' soilwater_movement_method = ',soilwater_movement_method - write(iulog,*) ' upper_boundary_condition = ',upper_boundary_condition - write(iulog,*) ' lower_boundary_condition = ',lower_boundary_condition - - write(iulog,*) ' use_bedrock = ',use_bedrock - write(iulog,*) ' dtmin = ',dtmin - write(iulog,*) ' verySmall = ',verySmall - write(iulog,*) ' xTolerUpper = ',xTolerUpper - write(iulog,*) ' xTolerLower = ',xTolerLower - write(iulog,*) ' expensive = ',expensive - write(iulog,*) ' inexpensive = ',inexpensive - write(iulog,*) ' flux_calculation = ',flux_calculation - endif - - end subroutine init_soilwater_movement - - -!#2 - !------------------------------------------------------------------------------ - function use_aquifer_layer() result(lres) - ! - !DESCRIPTION - ! return true if an aquifer layer is used - ! otherwise false - implicit none - logical :: lres - - if(lower_boundary_condition == bc_aquifer .or. lower_boundary_condition == bc_watertable)then - lres=.true. - else - lres=.false. - endif - return - - end function use_aquifer_layer - -!#3 - !----------------------------------------------------------------------- - subroutine SoilWater(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterflux_inst, waterstate_inst, temperature_inst, & - canopystate_inst, energyflux_inst, soil_water_retention_curve) - ! - ! DESCRIPTION - ! select one subroutine to do the soil and root water coupling - ! - !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : nlevsoi - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varpar , only : nlevsoi - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use EnergyFluxType , only : energyflux_type - use WaterStateType , only : waterstate_type - use CanopyStateType , only : canopystate_type - use ColumnType , only : col - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use clm_varcon , only : denh2o, denice - use clm_varctl, only : use_flexibleCN - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(temperature_type) , intent(in) :: temperature_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'SoilWater' ! subroutine name - real(r8) :: xs(bounds%begc:bounds%endc) !excess soil water above urban ponding limit - real(r8) :: watmin - integer :: fc, c, j - - !------------------------------------------------------------------------------ - - associate( & - wa => soilhydrology_inst%wa_col , & ! Input: [real(r8) (:) ] water in the unconfined aquifer (mm) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Output: [real(r8) (:,:) ] liquid water (kg/m2) - ) - - select case(soilwater_movement_method) - - case (zengdecker_2009) - - call soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterflux_inst, waterstate_inst, temperature_inst, & - canopystate_inst, energyflux_inst, soil_water_retention_curve) - - case (moisture_form) - - call soilwater_moisture_form(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterflux_inst, waterstate_inst, temperature_inst, & - canopystate_inst, energyflux_inst, soil_water_retention_curve) - - case (mixed_form) - -!!$ call soilwater_mixed_form(bounds, num_hydrologyc, filter_hydrologyc, & -!!$ num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & -!!$ waterflux_inst, waterstate_inst, temperature_inst) - - case (head_form) - -!!$ call soilwater_head_form(bounds, num_hydrologyc, filter_hydrologyc, & -!!$ num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & -!!$ waterflux_inst, waterstate_inst, temperature_inst) - - case default - - call endrun(subname // ':: a SoilWater implementation must be specified!') - - end select - - if (use_flexibleCN) then - !a work around of the negative liquid water. Jinyun Tang, Jan 14, 2015 - watmin = 0.001_r8 - - do j = 1, nlevsoi-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < 0._r8) then - xs(c) = watmin - h2osoi_liq(c,j) - else - xs(c) = 0._r8 - end if - h2osoi_liq(c,j ) = h2osoi_liq(c,j ) + xs(c) - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) - xs(c) - end do - end do - - j = nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin-h2osoi_liq(c,j) - else - xs(c) = 0._r8 - end if - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - wa(c) = wa(c) - xs(c) - end do - - !update volumetric soil moisture for bgc calculation - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) & - + h2osoi_ice(c,j)/(dz(c,j)*denice) - enddo - enddo - end if - end associate - end subroutine SoilWater - -!#5 - !----------------------------------------------------------------------- - subroutine BaseflowSink(bounds, num_hydrologyc, & - filter_hydrologyc, baseflow_sink, waterflux_inst, soilstate_inst) - ! - ! Generic routine to apply baseflow as a sink condition that - ! is vertically distributed over the soil column. - ! - !USES: - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : nlevsoi, max_patch_per_col - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - real(r8) , intent(out) :: baseflow_sink(bounds%begc:,1:) ! vertically distributed baseflow sink (mm H2O/s) (+ = to rof) - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,fc,j ! do loop indices - integer :: pi ! patch index - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(baseflow_sink) == (/bounds%endc, nlevsoi/)), errMsg(sourcefile, __LINE__)) - -!this is just a placeholder for now - baseflow_sink = 0. - - end subroutine BaseflowSink - - -!#6 - !----------------------------------------------------------------------- - subroutine soilwater_zengdecker2009(bounds, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, soilhydrology_inst, soilstate_inst, & - waterflux_inst, waterstate_inst, temperature_inst, & - canopystate_inst, energyflux_inst, soil_water_retention_curve) - ! - ! !DESCRIPTION: - ! Soil hydrology - ! Soil moisture is predicted from a 10-layer model (as with soil - ! temperature), in which the vertical soil moisture transport is governed - ! by infiltration, runoff, gradient diffusion, gravity, and root - ! extraction through canopy transpiration. The net water applied to the - ! surface layer is the snowmelt plus precipitation plus the throughfall - ! of canopy dew minus surface runoff and evaporation. - ! CLM3.5 uses a zero-flow bottom boundary condition. - ! - ! The vertical water flow in an unsaturated porous media is described by - ! Darcy's law, and the hydraulic conductivity and the soil negative - ! potential vary with soil water content and soil texture based on the work - ! of Clapp and Hornberger (1978) and Cosby et al. (1984). The equation is - ! integrated over the layer thickness, in which the time rate of change in - ! water mass must equal the net flow across the bounding interface, plus the - ! rate of internal source or sink. The terms of water flow across the layer - ! interfaces are linearly expanded by using first-order Taylor expansion. - ! The equations result in a tridiagonal system equation. - ! - ! Note: length units here are all millimeter - ! (in temperature subroutine uses same soil layer - ! structure required but lengths are m) - ! - ! Richards equation: - ! - ! d wat d d wat d psi - ! ----- = - -- [ k(----- ----- - 1) ] + S - ! dt dz dz d wat - ! - ! where: wat = volume of water per volume of soil (mm**3/mm**3) - ! psi = soil matrix potential (mm) - ! dt = time step (s) - ! z = depth (mm) - ! dz = thickness (mm) - ! qin = inflow at top (mm h2o /s) - ! qout= outflow at bottom (mm h2o /s) - ! s = source/sink flux (mm h2o /s) - ! k = hydraulic conductivity (mm h2o /s) - ! - ! d qin d qin - ! qin[n+1] = qin[n] + -------- d wat(j-1) + --------- d wat(j) - ! d wat(j-1) d wat(j) - ! ==================|================= - ! < qin - ! - ! d wat(j)/dt * dz = qin[n+1] - qout[n+1] + S(j) - ! - ! > qout - ! ==================|================= - ! d qout d qout - ! qout[n+1] = qout[n] + --------- d wat(j) + --------- d wat(j+1) - ! d wat(j) d wat(j+1) - ! - ! - ! Solution: linearize k and psi about d wat and use tridiagonal - ! system of equations to solve for d wat, - ! where for layer j - ! - ! - ! r_j = a_j [d wat_j-1] + b_j [d wat_j] + c_j [d wat_j+1] - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use decompMod , only : bounds_type - use clm_varcon , only : wimp,grav,hfus,tfrz - use clm_varcon , only : e_ice,denh2o, denice - use clm_varpar , only : nlevsoi, max_patch_per_col, nlevgrnd - use clm_time_manager , only : get_step_size, get_nstep - use column_varcon , only : icol_roof, icol_road_imperv - use clm_varctl , only : use_flexibleCN, use_hydrstress - use TridiagonalMod , only : Tridiagonal - use abortutils , only : endrun - use SoilStateType , only : soilstate_type - use SoilHydrologyType , only : soilhydrology_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use EnergyFluxType , only : energyflux_type - use WaterStateType , only : waterstate_type - use CanopyStateType , only : canopystate_type - use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type - use PatchType , only : patch - use ColumnType , only : col - use clm_varctl , only : iulog - use SoilWaterPlantSinkMod , only : COmpute_EffecRootFrac_And_VertTranSink - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - type(soilhydrology_type), intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(energyflux_type) , intent(in) :: energyflux_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'soilwater_zengdecker2009' ! subroutine name - integer :: p,c,fc,j ! do loop indices - integer :: jtop(bounds%begc:bounds%endc) ! top level at each column - real(r8) :: dtime ! land model time step (sec) - real(r8) :: hk(bounds%begc:bounds%endc,1:nlevsoi) ! hydraulic conductivity [mm h2o/s] - real(r8) :: dhkdw(bounds%begc:bounds%endc,1:nlevsoi) ! d(hk)/d(vol_liq) - real(r8) :: amx(bounds%begc:bounds%endc,1:nlevsoi+1) ! "a" left off diagonal of tridiagonal matrix - real(r8) :: bmx(bounds%begc:bounds%endc,1:nlevsoi+1) ! "b" diagonal column for tridiagonal matrix - real(r8) :: cmx(bounds%begc:bounds%endc,1:nlevsoi+1) ! "c" right off diagonal tridiagonal matrix - real(r8) :: rmx(bounds%begc:bounds%endc,1:nlevsoi+1) ! "r" forcing term of tridiagonal matrix - real(r8) :: zmm(bounds%begc:bounds%endc,1:nlevsoi+1) ! layer depth [mm] - real(r8) :: dzmm(bounds%begc:bounds%endc,1:nlevsoi+1) ! layer thickness [mm] - real(r8) :: den ! used in calculating qin, qout - real(r8) :: dqidw0(bounds%begc:bounds%endc,1:nlevsoi+1) ! d(qin)/d(vol_liq(i-1)) - real(r8) :: dqidw1(bounds%begc:bounds%endc,1:nlevsoi+1) ! d(qin)/d(vol_liq(i)) - real(r8) :: dqodw1(bounds%begc:bounds%endc,1:nlevsoi+1) ! d(qout)/d(vol_liq(i)) - real(r8) :: dqodw2(bounds%begc:bounds%endc,1:nlevsoi+1) ! d(qout)/d(vol_liq(i+1)) - real(r8) :: dsmpdw(bounds%begc:bounds%endc,1:nlevsoi+1) ! d(smp)/d(vol_liq) - real(r8) :: num ! used in calculating qin, qout - real(r8) :: qin(bounds%begc:bounds%endc,1:nlevsoi+1) ! flux of water into soil layer [mm h2o/s] - real(r8) :: qout(bounds%begc:bounds%endc,1:nlevsoi+1) ! flux of water out of soil layer [mm h2o/s] - real(r8) :: s_node ! soil wetness - real(r8) :: s1 ! "s" at interface of layer - real(r8) :: s2 ! k*s**(2b+2) - real(r8) :: smp(bounds%begc:bounds%endc,1:nlevsoi) ! soil matrix potential [mm] - real(r8) :: sdamp ! extrapolates soiwat dependence of evaporation - integer :: pi ! patch index - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - integer :: jwt(bounds%begc:bounds%endc) ! index of the soil layer right above the water table (-) - real(r8) :: smp1,dsmpdw1,wh,wh_zwt,ka - real(r8) :: dwat2(bounds%begc:bounds%endc,1:nlevsoi+1) - real(r8) :: dzq ! used in calculating qin, qout (difference in equilbirium matric potential) - real(r8) :: zimm(bounds%begc:bounds%endc,0:nlevsoi) ! layer interface depth [mm] - real(r8) :: zq(bounds%begc:bounds%endc,1:nlevsoi+1) ! equilibrium matric potential for each layer [mm] - real(r8) :: vol_eq(bounds%begc:bounds%endc,1:nlevsoi+1) ! equilibrium volumetric water content - real(r8) :: tempi ! temp variable for calculating vol_eq - real(r8) :: temp0 ! temp variable for calculating vol_eq - real(r8) :: voleq1 ! temp variable for calculating vol_eq - real(r8) :: zwtmm(bounds%begc:bounds%endc) ! water table depth [mm] - real(r8) :: imped(bounds%begc:bounds%endc,1:nlevsoi) - real(r8) :: vol_ice(bounds%begc:bounds%endc,1:nlevsoi) - real(r8) :: z_mid - real(r8) :: vwc_zwt(bounds%begc:bounds%endc) - real(r8) :: vwc_liq(bounds%begc:bounds%endc,1:nlevsoi+1) ! liquid volumetric water content - real(r8) :: smp_grad(bounds%begc:bounds%endc,1:nlevsoi+1) - real(r8) :: dsmpds !temporary variable - real(r8) :: dhkds !temporary variable - real(r8) :: hktmp !temporary variable - integer :: nstep - !----------------------------------------------------------------------- - - associate(& - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - origflag => soilhydrology_inst%origflag , & ! Input: constant - qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - fracice => soilhydrology_inst%fracice_col , & ! Input: [real(r8) (:,:) ] fractional impermeability (-) - icefrac => soilhydrology_inst%icefrac_col , & ! Input: [real(r8) (:,:) ] fraction of ice - hkdepth => soilhydrology_inst%hkdepth_col , & ! Input: [real(r8) (:) ] decay factor (m) - - smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - hksat => soilstate_inst%hksat_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice water (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - - qflx_deficit => waterflux_inst%qflx_deficit_col , & ! Input: [real(r8) (:) ] water deficit to keep non-negative liquid water content - qflx_infl => waterflux_inst%qflx_infl_col , & ! Input: [real(r8) (:) ] infiltration (mm H2O /s) - - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:,:) ] vegetation/soil water exchange (mm H2O/s) (+ = to atm) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - rootr_col => soilstate_inst%rootr_col , & ! Input: [real(r8) (:,:) ] effective fraction of roots in each soil layer - t_soisno => temperature_inst%t_soisno_col & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - ) - - ! Get time step - - nstep = get_nstep() - dtime = get_step_size() - - - ! Because the depths in this routine are in mm, use local - ! variable arrays instead of pointers - - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - zmm(c,j) = z(c,j)*1.e3_r8 - dzmm(c,j) = dz(c,j)*1.e3_r8 - zimm(c,j) = zi(c,j)*1.e3_r8 - - ! calculate icefrac up here - vol_ice(c,j) = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - icefrac(c,j) = min(1._r8,vol_ice(c,j)/watsat(c,j)) - vwc_liq(c,j) = max(h2osoi_liq(c,j),1.0e-6_r8)/(dz(c,j)*denh2o) - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - zimm(c,0) = 0.0_r8 - zwtmm(c) = zwt(c)*1.e3_r8 - end do - - ! compute jwt index - ! The layer index of the first unsaturated layer, i.e., the layer right above - ! the water table - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - jwt(c) = nlevsoi - ! allow jwt to equal zero when zwt is in top layer - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - - ! compute vwc at water table depth (mainly for case when t < tfrz) - ! this will only be used when zwt is below the soil column - vwc_zwt(c) = watsat(c,nlevsoi) - if(t_soisno(c,jwt(c)+1) < tfrz) then - vwc_zwt(c) = vwc_liq(c,nlevsoi) - do j = nlevsoi,nlevgrnd - if(zwt(c) <= zi(c,j)) then - smp1 = hfus*(tfrz-t_soisno(c,j))/(grav*t_soisno(c,j)) * 1000._r8 !(mm) - !smp1 = max(0._r8,smp1) - smp1 = max(sucsat(c,nlevsoi),smp1) - vwc_zwt(c) = watsat(c,nlevsoi)*(smp1/sucsat(c,nlevsoi))**(-1._r8/bsw(c,nlevsoi)) - ! for temperatures close to tfrz, limit vwc to total water content - vwc_zwt(c) = min(vwc_zwt(c), 0.5*(watsat(c,nlevsoi) + h2osoi_vol(c,nlevsoi)) ) - exit - endif - enddo - endif - end do - - ! calculate the equilibrium water content based on the water table depth - - do j=1,nlevsoi - do fc=1, num_hydrologyc - c = filter_hydrologyc(fc) - if ((zwtmm(c) <= zimm(c,j-1))) then - vol_eq(c,j) = watsat(c,j) - - ! use the weighted average from the saturated part (depth > wtd) and the equilibrium solution for the - ! rest of the layer, the equilibrium solution is based on Clapp-Hornberg parameterization - ! and no extension to full range swrc is needed - - else if ((zwtmm(c) .lt. zimm(c,j)) .and. (zwtmm(c) .gt. zimm(c,j-1))) then - tempi = 1.0_r8 - temp0 = (((sucsat(c,j)+zwtmm(c)-zimm(c,j-1))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - voleq1 = -sucsat(c,j)*watsat(c,j)/(1._r8-1._r8/bsw(c,j))/(zwtmm(c)-zimm(c,j-1))*(tempi-temp0) - vol_eq(c,j) = (voleq1*(zwtmm(c)-zimm(c,j-1)) + watsat(c,j)*(zimm(c,j)-zwtmm(c)))/(zimm(c,j)-zimm(c,j-1)) - vol_eq(c,j) = min(watsat(c,j),vol_eq(c,j)) - vol_eq(c,j) = max(vol_eq(c,j),0.0_r8) - else - tempi = (((sucsat(c,j)+zwtmm(c)-zimm(c,j))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - temp0 = (((sucsat(c,j)+zwtmm(c)-zimm(c,j-1))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - vol_eq(c,j) = -sucsat(c,j)*watsat(c,j)/(1._r8-1._r8/bsw(c,j))/(zimm(c,j)-zimm(c,j-1))*(tempi-temp0) - vol_eq(c,j) = max(vol_eq(c,j),0.0_r8) - vol_eq(c,j) = min(watsat(c,j),vol_eq(c,j)) - endif - zq(c,j) = -sucsat(c,j)*(max(vol_eq(c,j)/watsat(c,j),0.01_r8))**(-bsw(c,j)) - zq(c,j) = max(smpmin(c), zq(c,j)) - end do - end do - - ! If water table is below soil column calculate zq for the 11th layer - j = nlevsoi - do fc=1, num_hydrologyc - c = filter_hydrologyc(fc) - if(jwt(c) == nlevsoi) then - tempi = 1._r8 - temp0 = (((sucsat(c,j)+zwtmm(c)-zimm(c,j))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - vol_eq(c,j+1) = -sucsat(c,j)*watsat(c,j)/(1._r8-1._r8/bsw(c,j))/(zwtmm(c)-zimm(c,j))*(tempi-temp0) - vol_eq(c,j+1) = max(vol_eq(c,j+1),0.0_r8) - vol_eq(c,j+1) = min(watsat(c,j),vol_eq(c,j+1)) - zq(c,j+1) = -sucsat(c,j)*(max(vol_eq(c,j+1)/watsat(c,j),0.01_r8))**(-bsw(c,j)) - zq(c,j+1) = max(smpmin(c), zq(c,j+1)) - end if - end do - - ! Hydraulic conductivity and soil matric potential and their derivatives - - sdamp = 0._r8 - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - ! compute hydraulic conductivity based on liquid water content only - - if (origflag == 1) then - s1 = 0.5_r8*(h2osoi_vol(c,j) + h2osoi_vol(c,min(nlevsoi, j+1))) / & - (0.5_r8*(watsat(c,j)+watsat(c,min(nlevsoi, j+1)))) - else - s1 = 0.5_r8*(vwc_liq(c,j) + vwc_liq(c,min(nlevsoi, j+1))) / & - (0.5_r8*(watsat(c,j)+watsat(c,min(nlevsoi, j+1)))) - endif - s1 = min(1._r8, s1) - s2 = hksat(c,j)*s1**(2._r8*bsw(c,j)+2._r8) - - ! replace fracice with impedance factor, as in zhao 97,99 - if (origflag == 1) then - imped(c,j)=(1._r8-0.5_r8*(fracice(c,j)+fracice(c,min(nlevsoi, j+1)))) - else - imped(c,j)=10._r8**(-e_ice*(0.5_r8*(icefrac(c,j)+icefrac(c,min(nlevsoi, j+1))))) - endif - hk(c,j) = imped(c,j)*s1*s2 - dhkdw(c,j) = imped(c,j)*(2._r8*bsw(c,j)+3._r8)*s2* & - (1._r8/(watsat(c,j)+watsat(c,min(nlevsoi, j+1)))) - - !compute un-restricted hydraulic conductivity - !call soil_water_retention_curve%soil_hk(hksat(c,j), imped(c,j), s1, bsw(c,j), hktmp, dhkds) - !if(hktmp/=hk(c,j))write(10,*)'diff',hktmp,hk(c,j) - ! call endrun('bad in hk') - !endif - !apply ice impedance - !hk(c,j) = imped(c,j)*hk(c,j) - !dhkdw(c,j) = imped(c,j) * dhkds * (1._r8/(watsat(c,j)+watsat(c,min(nlevsoi, j+1)))) - - - ! compute matric potential and derivative based on liquid water content only - if (origflag == 1) then - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - else - s_node = max(vwc_liq(c,j)/watsat(c,j), 0.01_r8) - endif - s_node = min(1.0_r8, s_node) - - !call soil_water_retention_curve%soil_suction(sucsat(c,j), s_node, bsw(c,j), smp(c,j), dsmpds) - - smp(c,j) = -sucsat(c,j)*s_node**(-bsw(c,j)) - smp(c,j) = max(smpmin(c), smp(c,j)) - !do not turn on the line below, which will cause bit to bit error, jyt, 2014 Mar 6 - !dsmpdw(c,j) = dsmpds/watsat(c,j) - - if (origflag == 1) then - dsmpdw(c,j) = -bsw(c,j)*smp(c,j)/(s_node*watsat(c,j)) - else - dsmpdw(c,j) = -bsw(c,j)*smp(c,j)/vwc_liq(c,j) - endif - - smp_l(c,j) = smp(c,j) - hk_l(c,j) = hk(c,j) - - end do - end do - - ! aquifer (11th) layer - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - zmm(c,nlevsoi+1) = 0.5*(1.e3_r8*zwt(c) + zmm(c,nlevsoi)) - if(jwt(c) < nlevsoi) then - dzmm(c,nlevsoi+1) = dzmm(c,nlevsoi) - else - dzmm(c,nlevsoi+1) = (1.e3_r8*zwt(c) - zmm(c,nlevsoi)) - end if - end do - - ! Set up r, a, b, and c vectors for tridiagonal solution - - ! Node j=1 (top) - - j = 1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qin(c,j) = qflx_infl(c) - den = (zmm(c,j+1)-zmm(c,j)) - dzq = (zq(c,j+1)-zq(c,j)) - num = (smp(c,j+1)-smp(c,j)) - dzq - qout(c,j) = -hk(c,j)*num/den - dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) - amx(c,j) = 0._r8 - bmx(c,j) = dzmm(c,j)*(sdamp+1._r8/dtime) + dqodw1(c,j) - cmx(c,j) = dqodw2(c,j) - - end do - - ! Nodes j=2 to j=nlevsoi-1 - - do j = 2, nlevsoi - 1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - den = (zmm(c,j) - zmm(c,j-1)) - dzq = (zq(c,j)-zq(c,j-1)) - num = (smp(c,j)-smp(c,j-1)) - dzq - qin(c,j) = -hk(c,j-1)*num/den - dqidw0(c,j) = -(-hk(c,j-1)*dsmpdw(c,j-1) + num*dhkdw(c,j-1))/den - dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den - den = (zmm(c,j+1)-zmm(c,j)) - dzq = (zq(c,j+1)-zq(c,j)) - num = (smp(c,j+1)-smp(c,j)) - dzq - qout(c,j) = -hk(c,j)*num/den - dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) - amx(c,j) = -dqidw0(c,j) - bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) - cmx(c,j) = dqodw2(c,j) - - end do - end do - - ! Node j=nlevsoi (bottom) - - j = nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if(j > jwt(c)) then !water table is in soil column - den = (zmm(c,j) - zmm(c,j-1)) - dzq = (zq(c,j)-zq(c,j-1)) - num = (smp(c,j)-smp(c,j-1)) - dzq - qin(c,j) = -hk(c,j-1)*num/den - dqidw0(c,j) = -(-hk(c,j-1)*dsmpdw(c,j-1) + num*dhkdw(c,j-1))/den - dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den - qout(c,j) = 0._r8 - dqodw1(c,j) = 0._r8 - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) - amx(c,j) = -dqidw0(c,j) - bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) - cmx(c,j) = 0._r8 - - ! next set up aquifer layer; hydrologically inactive - rmx(c,j+1) = 0._r8 - amx(c,j+1) = 0._r8 - bmx(c,j+1) = dzmm(c,j+1)/dtime - cmx(c,j+1) = 0._r8 - else ! water table is below soil column - - ! compute aquifer soil moisture as average of layer 10 and saturation - if(origflag == 1) then - s_node = max(0.5*(1.0_r8+h2osoi_vol(c,j)/watsat(c,j)), 0.01_r8) - else - s_node = max(0.5*((vwc_zwt(c)+vwc_liq(c,j))/watsat(c,j)), 0.01_r8) - endif - s_node = min(1.0_r8, s_node) - - ! compute smp for aquifer layer - !call soil_water_retention_curve%soil_suction(sucsat(c,j), s_node, bsw(c,j), smp1, dsmpds) - smp1 = -sucsat(c,j)*s_node**(-bsw(c,j)) - smp1 = max(smpmin(c), smp1) - - ! compute dsmpdw for aquifer layer - !dsmpdw1 = dsmpds/watsat(c,j) - dsmpdw1 = -bsw(c,j)*smp1/(s_node*watsat(c,j)) - - ! first set up bottom layer of soil column - den = (zmm(c,j) - zmm(c,j-1)) - dzq = (zq(c,j)-zq(c,j-1)) - num = (smp(c,j)-smp(c,j-1)) - dzq - qin(c,j) = -hk(c,j-1)*num/den - dqidw0(c,j) = -(-hk(c,j-1)*dsmpdw(c,j-1) + num*dhkdw(c,j-1))/den - dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den - den = (zmm(c,j+1)-zmm(c,j)) - dzq = (zq(c,j+1)-zq(c,j)) - num = (smp1-smp(c,j)) - dzq - qout(c,j) = -hk(c,j)*num/den - dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqodw2(c,j) = -( hk(c,j)*dsmpdw1 + num*dhkdw(c,j))/den - - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) - amx(c,j) = -dqidw0(c,j) - bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) - cmx(c,j) = dqodw2(c,j) - - ! next set up aquifer layer; den/num unchanged, qin=qout - qin(c,j+1) = qout(c,j) - dqidw0(c,j+1) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqidw1(c,j+1) = -( hk(c,j)*dsmpdw1 + num*dhkdw(c,j))/den - qout(c,j+1) = 0._r8 ! zero-flow bottom boundary condition - dqodw1(c,j+1) = 0._r8 ! zero-flow bottom boundary condition - rmx(c,j+1) = qin(c,j+1) - qout(c,j+1) - amx(c,j+1) = -dqidw0(c,j+1) - bmx(c,j+1) = dzmm(c,j+1)/dtime - dqidw1(c,j+1) + dqodw1(c,j+1) - cmx(c,j+1) = 0._r8 - endif - end do - - ! Solve for dwat - - jtop(bounds%begc : bounds%endc) = 1 - call Tridiagonal(bounds, 1, nlevsoi+1, & - jtop(bounds%begc:bounds%endc), & - num_hydrologyc, filter_hydrologyc, & - amx(bounds%begc:bounds%endc, :), & - bmx(bounds%begc:bounds%endc, :), & - cmx(bounds%begc:bounds%endc, :), & - rmx(bounds%begc:bounds%endc, :), & - dwat2(bounds%begc:bounds%endc, :) ) - - ! Renew the mass of liquid water - ! also compute qcharge from dwat in aquifer layer - ! update in drainage for case jwt < nlevsoi - - do fc = 1,num_hydrologyc - c = filter_hydrologyc(fc) - - do j = 1, nlevsoi - h2osoi_liq(c,j) = h2osoi_liq(c,j) + dwat2(c,j)*dzmm(c,j) - end do - - ! calculate qcharge for case jwt < nlevsoi - if(jwt(c) < nlevsoi) then - wh_zwt = 0._r8 !since wh_zwt = -sucsat - zq_zwt, where zq_zwt = -sucsat - - ! Recharge rate qcharge to groundwater (positive to aquifer) - s_node = max(h2osoi_vol(c,jwt(c)+1)/watsat(c,jwt(c)+1), 0.01_r8) - s1 = min(1._r8, s_node) - - !scs: this is the expression for unsaturated hk - ka = imped(c,jwt(c)+1)*hksat(c,jwt(c)+1) & - *s1**(2._r8*bsw(c,jwt(c)+1)+3._r8) - - !compute unsaturated hk, this shall be tested later, because it - !is not bit for bit - !call soil_water_retention_curve%soil_hk(hksat(c,jwt(c)+1), s1, bsw(c,jwt(c)+1), ka) - !apply ice impedance - !ka = imped(c,jwt(c)+1) * ka - ! Recharge rate qcharge to groundwater (positive to aquifer) - smp1 = max(smpmin(c), smp(c,max(1,jwt(c)))) - wh = smp1 - zq(c,max(1,jwt(c))) - - !scs: original formulation - if(jwt(c) == 0) then - qcharge(c) = -ka * (wh_zwt-wh) /((zwt(c)+1.e-3)*1000._r8) - else - ! qcharge(c) = -ka * (wh_zwt-wh)/((zwt(c)-z(c,jwt(c)))*1000._r8) - !scs: 1/2, assuming flux is at zwt interface, saturation deeper than zwt - qcharge(c) = -ka * (wh_zwt-wh)/((zwt(c)-z(c,jwt(c)))*1000._r8*2.0) - endif - - ! To limit qcharge (for the first several timesteps) - qcharge(c) = max(-10.0_r8/dtime,qcharge(c)) - qcharge(c) = min( 10.0_r8/dtime,qcharge(c)) - else - ! if water table is below soil column, compute qcharge from dwat2(11) - qcharge(c) = dwat2(c,nlevsoi+1)*dzmm(c,nlevsoi+1)/dtime - endif - end do - - ! compute the water deficit and reset negative liquid water content - ! Jinyun Tang - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qflx_deficit(c) = 0._r8 - do j = 1, nlevsoi - if(h2osoi_liq(c,j)<0._r8)then - qflx_deficit(c) = qflx_deficit(c) - h2osoi_liq(c,j) - endif - enddo - enddo - - end associate - - end subroutine soilwater_zengdecker2009 - -!#7 -!----------------------------------------------------------------------- - subroutine soilwater_moisture_form(bounds, num_hydrologyc, & - filter_hydrologyc, num_urbanc, filter_urbanc, soilhydrology_inst, & - soilstate_inst, waterflux_inst, waterstate_inst, temperature_inst, & - canopystate_inst, energyflux_inst, soil_water_retention_curve) - ! - ! !DESCRIPTION: - ! Soil hydrology - ! Soil moisture is predicted from a n-layer model (as with soil - ! temperature), in which the vertical soil moisture transport is governed - ! by infiltration, runoff, gradient diffusion, gravity, and root - ! extraction through canopy transpiration. The net water applied to the - ! surface layer is the snowmelt plus precipitation plus the throughfall - ! of canopy dew minus surface runoff and evaporation. - ! - ! Options are included for head conditions at the upper and lower boundary, - ! a flux boundary condition at the upper boundary, and a free drainage - ! condition - ! at the lower boundary - ! - ! The vertical water flow in an unsaturated porous media is described by - ! Darcy's law, and the hydraulic conductivity and the soil negative - ! potential vary with soil water content and soil texture based on the work - ! of van Genuchten (1980). The equation is integrated over the layer - ! thickness, - ! in which the time rate of change in water mass must equal the net flow - ! across - ! the bounding interface, plus the rate of internal source or sink. The - ! terms of - ! water flow across the layer interfaces are linearly expanded by using - ! first-order Taylor expansion. The equations result in a tridiagonal system - ! equation. - ! - ! Note: length units here are all millimeter - ! (in temperature subroutine uses same soil layer - ! structure required but lengths are m) - ! - ! Richards equation: - ! - ! d wat d d wat d psi - ! ----- = - -- [ k(----- ----- - 1) ] + S - ! dt dz dz d wat - ! - ! where: wat = volume of water per volume of soil (mm**3/mm**3) - ! psi = soil matrix potential (mm) - ! dt = time step (s) - ! z = depth (mm) - ! dz = thickness (mm) - ! qin = inflow at top (mm h2o /s) - ! qout= outflow at bottom (mm h2o /s) - ! s = source/sink flux (mm h2o /s) - ! k = hydraulic conductivity (mm h2o /s) - ! - ! d qin d qin - ! qin[n+1] = qin[n] + -------- d wat(j-1) + --------- d wat(j) - ! d wat(j-1) d wat(j) - ! ==================|================= - ! < qin - ! - ! d wat(j)/dt * dz = qin[n+1] - qout[n+1] + S(j) - ! - ! > qout - ! ==================|================= - ! d qout d qout - ! qout[n+1] = qout[n] + --------- d wat(j) + --------- d wat(j+1) - ! d wat(j) d wat(j+1) - ! - ! - ! Solution: linearize k and psi about d wat and use tridiagonal - ! system of equations to solve for d wat, - ! system of equations to solve for d wat, - ! where for layer j - ! - ! - ! r_j = a_j [d wat_j-1] + b_j [d wat_j] + c_j [d wat_j+1] - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE,SHR_CONST_G - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varctl , only : iulog, use_hydrstress - use clm_varcon , only : denh2o, denice - use clm_varpar , only : nlevsoi - use clm_time_manager , only : get_step_size, get_nstep - use SoilStateType , only : soilstate_type - use SoilHydrologyType , only : soilhydrology_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use WaterStateType , only : waterstate_type - use EnergyFluxType , only : energyflux_type - use CanopyStateType , only : canopystate_type - use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type - use PatchType , only : patch - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - type(soilhydrology_type), intent(inout) :: soilhydrology_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - - ! !LOCAL VARIABLES: - integer :: nstep - integer :: nlayers - integer :: p,c,fc,j ! do loop indices - integer :: jtop ! top level at each column - real(r8) :: dtime ! land model time step (sec) - real(r8) :: hk(bounds%begc:bounds%endc,1:nlevsoi) ! hydraulic conductivity [mm h2o/s] - real(r8) :: smp(bounds%begc:bounds%endc,1:nlevsoi) ! soil matrix potential [mm] - real(r8) :: dhkdw(bounds%begc:bounds%endc,1:nlevsoi) ! d(hk)/d(vol_liq) - real(r8) :: dsmpdw(bounds%begc:bounds%endc,1:nlevsoi) ! d(smp)/d(vol_liq) - real(r8) :: imped(bounds%begc:bounds%endc,1:nlevsoi) - real(r8) :: rmx_save(bounds%begc:bounds%endc,1:nlevsoi) ! residual vector - real(r8) :: vwc_save(bounds%begc:bounds%endc,1:nlevsoi) ! liquid volumetric water content - real(r8) :: rhs(1:nlevsoi) ! RHS vector for input to lapack - - real(r8) :: vwc_liq(bounds%begc:bounds%endc,1:nlevsoi) ! liquid volumetric water content - real(r8) :: dt_dz(bounds%begc:bounds%endc,1:nlevsoi) !temporary variable - real(r8) :: qin(bounds%begc:bounds%endc,1:nlevsoi) ! flux of water into soil layer [mm h2o/s] - real(r8) :: qout(bounds%begc:bounds%endc,1:nlevsoi) ! flux of water out of soil layer [mm h2o/s] - real(r8) :: dqidw0(bounds%begc:bounds%endc,1:nlevsoi) ! d(qin)/d(vol_liq(i-1)) - real(r8) :: dqidw1(bounds%begc:bounds%endc,1:nlevsoi) ! d(qin)/d(vol_liq(i)) - real(r8) :: dqodw1(bounds%begc:bounds%endc,1:nlevsoi) ! d(qout)/d(vol_liq(i)) - real(r8) :: dqodw2(bounds%begc:bounds%endc,1:nlevsoi) ! d(qout)/d(vol_liq(i+1)) - real(r8) :: dwat(bounds%begc:bounds%endc,1:nlevsoi) - real(r8) :: amx(bounds%begc:bounds%endc,1:nlevsoi) ! "a" left off diagonal of tridiagonal matrix - real(r8) :: bmx(bounds%begc:bounds%endc,1:nlevsoi) ! "b" diagonal column for tridiagonal matrix - real(r8) :: cmx(bounds%begc:bounds%endc,1:nlevsoi) ! "c" right off diagonal tridiagonal matrix - real(r8) :: rmx(bounds%begc:bounds%endc,1:nlevsoi) ! "r" forcing term of tridiagonal matrix - real(r8) :: dLow(1:nlevsoi-1) ! lower diagonal vector - real(r8) :: dUpp(1:nlevsoi-1) ! upper diagonal vector - real(r8) :: diag(1:nlevsoi) ! diagonal vector - integer :: err ! error code from the lapack routines - character(len=32) :: subname = 'soilwater_moisture_form' ! subroutine name - integer,parameter :: soil_hydraulic_properties_method = 0 ! 0 for CH78 - integer,parameter :: ice_impedance_method = 1 ! 1 for power form - integer,parameter :: lapack=1 - integer,parameter :: clmOrig=2 -! integer,parameter :: tridiagSolution=clmOrig - integer,parameter :: tridiagSolution=lapack - - integer :: nSubstep ! substep index - real(r8) :: dtsub ! length of the substep (seconds) - real(r8) :: dtdone ! substep completed (seconds) -!!$ real(r8),parameter :: dtmin=60._r8 ! minimum time step length (seconds) -!!$ real(r8),parameter :: verySmall=1.e-8_r8 ! a very small number: used to check for sub step completion -!!$ real(r8),parameter :: xTolerUpper=1.e-1_r8 ! tolerance to halve length of substep -!!$ real(r8),parameter :: xTolerLower=1.e-2_r8 ! tolerance to double length of substep -!!$ integer,parameter :: expensive=42 -!!$ integer,parameter :: inexpensive=1 -!!$ integer,parameter :: flux_calculation=inexpensive ! used to calculate first order taylor series approximation of the net flux - real(r8) :: qin_test,qout_test ! fluxes into and out of each layer - real(r8) :: fluxNet0(1:nlevsoi) ! net flux in each layer based on the first order taylor series approximation - real(r8) :: fluxNet1(1:nlevsoi) ! net flux in each layer based on the flux at the start of the substep - real(r8) :: errorVec(1:nlevsoi) ! error vector - real(r8) :: errorMax(1) ! max error - real(r8) :: qcTemp ! drainage flux for a given substep - -! temporarily use local variables for the following - real(r8) :: vwc_liq_ub(bounds%begc:bounds%endc) ! liquid volumetric water content at upper boundary - real(r8) :: vwc_liq_lb(bounds%begc:bounds%endc) ! liquid volumetric water content at lower boundary - real(r8) :: vLiqIter(bounds%begc:bounds%endc,1:nlevsoi) ! iteration increment for the volumetric liquid water content (v/v) - real(r8) :: vLiqRes(bounds%begc:bounds%endc,1:nlevsoi) ! residual for the volumetric liquid water content (v/v) - - real(r8) :: dwat_temp - !----------------------------------------------------------------------- - - associate(& - nbedrock => col%nbedrock , & ! Input: [real(r8) (:,:) ] depth to bedrock (m) - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - - nsubsteps => soilhydrology_inst%num_substeps_col, & ! Input: [real(r8) (:) ] adaptive timestep counter - - qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - hk_l => soilstate_inst%hk_l_col , & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice water (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col & - ) ! end associate statement - - ! Get time step - - nstep = get_nstep() - dtime = get_step_size() - - ! main spatial loop - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! set number of layers over which to solve soilwater movement - nlayers = nbedrock(c) - - dwat_temp = 0. - - ! initialize the number of substeps - nsubstep=0 - - ! initialize substeps - dtsub = dtime ! length of the substep - dtdone = 0._r8 ! substep completed - - ! initialize qcharge - qcharge(c) = 0._r8 - - ! adaptive sub-step loop - do ! continuous do loop with exit clause - - ! keep track of the number of trials - nsubstep=nsubstep+1 - - ! calculate commonly used variables - do j = 1, nlayers - vwc_liq(c,j) = max(h2osoi_liq(c,j),1.0e-6_r8)/(dz(c,j)*denh2o) - dt_dz(c,j) = dtsub/(m_to_mm * dz(c,j)) - end do - - ! Hydraulic conductivity and soil matric potential and their derivatives - call compute_hydraulic_properties(c, nlayers, & - soilhydrology_inst, soilstate_inst, & - soil_water_retention_curve, vwc_liq(c,1:nlayers), & - hk(c,1:nlayers) ,smp(c,1:nlayers), & - dhkdw(c,1:nlayers), dsmpdw(c,1:nlayers), & - imped(c,1:nlayers)) - - ! Soil moisture fluxes and their derivatives - call compute_moisture_fluxes_and_derivs(c, nlayers, & - soilhydrology_inst, soilstate_inst, & - temperature_inst, waterflux_inst, & - soil_water_retention_curve, & - vwc_liq(c,1:nlayers), & - hk(c,1:nlayers), & - smp(c,1:nlayers), & - dhkdw(c,1:nlayers), & - dsmpdw(c,1:nlayers), & - imped(c,1:nlayers), & - qin(c,1:nlayers), & - qout(c,1:nlayers), & - dqidw0(c,1:nlayers), & - dqidw1(c,1:nlayers), & - dqodw1(c,1:nlayers), & - dqodw2(c,1:nlayers)) - - ! RHS of system of equations - call compute_RHS_moisture_form(c, nlayers, & - qflx_rootsoi_col(c,1:nlayers), & - vwc_liq(c,1:nlayers), & - qin(c,1:nlayers), & - qout(c,1:nlayers), & - dt_dz(c,1:nlayers), & - rmx(c,1:nlayers)) - - ! LHS of system of equations - call compute_LHS_moisture_form(c, nlayers, & - soilhydrology_inst, & - dt_dz(c,1:nlayers), & - dqidw0(c,1:nlayers), & - dqidw1(c,1:nlayers), & - dqodw1(c,1:nlayers), & - dqodw2(c,1:nlayers), & - amx(c,1:nlayers), & - bmx(c,1:nlayers), & - cmx(c,1:nlayers)) - - ! solve A.X=B (done above, but using lapack as a test) - - ! solve tridiagonal matrix using the original clm solution - if(tridiagSolution==clmOrig)then - - ! Solve for dwat - - jtop = 1 - call TridiagonalCol(c, 1, nlayers, & - jtop, & - !num_hydrologyc, filter_hydrologyc, & - amx(c, 1:nlayers), & - bmx(c, 1:nlayers), & - cmx(c, 1:nlayers), & - rmx(c, 1:nlayers), & - dwat(c, 1:nlayers) ) - - ! solve tridiagonal matrix using the lapack solution - else - - ! NOTE: check for efficiency gains by passing vectors directly (no - ! copy); however, intent(inout) - - ! get a copy of the input vectors - dLow(1:nlayers-1) = amx(filter_hydrologyc(fc),2:nlayers) - diag(1:nlayers) = bmx(filter_hydrologyc(fc),1:nlayers) - dUpp(1:nlayers-1) = cmx(filter_hydrologyc(fc),1:nlayers-1) - - ! get a copy of the residual vector - rhs(1:nlayers) = rmx(filter_hydrologyc(fc),1:nlayers) - - ! call the lapack tri-diagonal solver - call dgtsv(nlayers, & ! intent(in): [integer] number of state variables - 1, & ! intent(in): [integer] number of columns of the matrix B - dLow, & ! intent(inout): [r8(nlayers-1)] sub-diagonal elements of A - diag, & ! intent(inout): [r8(nlayers )] diagonal elements of A - dUpp, & ! intent(inout): [r8(nlayers-1)] super-diagonal elements of A - rhs, & ! intent(inout): [r8(nlayers )] RHS vector; becomes the solution vector on output - nlayers, & ! intent(in): [integer] the leading dimension of matrix rhs - err) - if(err/=0) call endrun(subname // ':: problem with the lapack solver') - - ! save the iteration increment - dwat(filter_hydrologyc(fc),1:nlayers) = rhs(1:nlayers) - - endif ! solution method for the tridiagonal solution - - ! ********** - ! error estimation segment - ! (could be a separate subroutine) - - fluxNet1(1:nlevsoi) = 0._r8 - fluxNet0(1:nlevsoi) = 0._r8 - - ! estimate errors for each layer - do j = 1, nLayers - - ! compute the net flux using the first order taylor series approximation - - ! different options just for clarity - ! NOTE: we would never use the expensive option; just helps clarify what is happenning - if(flux_calculation==expensive)then - - ! compute influx (mm s-1) - if(j==1) then; qin_test = qin(c,j) + dqidw1(c,j)*dwat(c,j) ! upper layer - else; qin_test = qin(c,j) + dqidw0(c,j)*dwat(c,j-1) + dqidw1(c,j)*dwat(c,j) - endif - - ! compute outflux (mm s-1) - if(j==nLayers)then; qout_test = qout(c,j) + dqodw1(c,j)*dwat(c,j) ! lower layer - else; qout_test = qout(c,j) + dqodw1(c,j)*dwat(c,j) + dqodw2(c,j)*dwat(c,j+1) - endif - - ! compute the net flux - fluxNet0(j) = qin_test - qout_test - qflx_rootsoi_col(c,j) - - ! flux calculation is inexpensive - else - - ! convert iteration increment to a net flux (mm s-1) - fluxNet0(j) = dwat(c,j)/dt_dz(c,j) - - endif ! switch between the expensive and inexpensive fluxcalculations - - ! compute the net flux at the start of the sub-step - fluxNet1(j) = qin(c,j) - qout(c,j) - qflx_rootsoi_col(c,j) - - end do ! looping through layers - - ! compute absolute errors - errorVec(:nlayers) = abs(fluxNet1(:nlayers) - fluxNet0(:nlayers))*dtsub*0.5_r8 - errorMax = maxval(errorVec(:nlayers)) - - ! check if the error is above the upper tolerance - if(errorMax(1) > xTolerUpper .and. dtsub > dtmin)then - dtsub = max(dtsub/2._r8, dtmin) ! halve the length of the sub-step - cycle ! sub-step rejected; try again - endif - - - ! end of error estimation segment - ! ********** - - ! Renew the mass of liquid water - do j = 1, nlayers - h2osoi_liq(c,j) = h2osoi_liq(c,j) + dwat(c,j) * (m_to_mm * dz(c,j)) - end do - - ! compute drainage from the bottom of the soil column - select case(lower_boundary_condition) - - ! flux boundary condition - case(bc_flux) - qcTemp = hk(c,nlayers) + dhkdw(c,nlayers)*dwat(c,nlayers) - - ! zero flux lower boundary - case(bc_zero_flux) - qcTemp = 0._r8 - - ! coupling with a water table - case(bc_waterTable) - qcTemp = qout(c,nlayers) + dqodw1(c,nlayers)*dwat(c,nlayers) - - case default - call endrun(subname // ':: the lower boundary condition must be specified!') - - end select ! case for the lower boundary condition - - ! increment the qcharge flux - qcharge(c) = qcharge(c) + qcTemp *(dtsub / dtime) - - ! increment substep and check for completion of the substep - dtdone = dtdone + dtsub - if(abs(dtime - dtdone) < verySmall) exit ! time step completed so exit the do loop - - ! check if the error is below the lower tolerance - if(errorMax(1) < xTolerLower)then - dtsub = dtsub*2._r8 - endif - - ! ensure that the substep does not exceed the time remaining - dtsub = min(dtsub, dtime - dtdone) - - end do ! substep loop - -! save number of adaptive substeps used during time step - nsubsteps(c) = nsubstep - -! check for negative moisture values - do j = 2, nlayers - if(h2osoi_liq(c,j) < -1e-6_r8) then - write(*,*) 'layer, h2osoi_liq: ', c,j,h2osoi_liq(c,j) - ! call endrun(subname // ':: negative soil moisture values found!') - endif - end do - - end do ! spatial loop - - -! calculate qcharge when water table is in soil column and bc_watertable - if(use_aquifer_layer()) then - ! compute flux of water to aquifer - - call compute_qcharge(bounds, & - num_hydrologyc, filter_hydrologyc, soilhydrology_inst, & - soilstate_inst, waterstate_inst, & - soil_water_retention_curve, & - dwat(bounds%begc:bounds%endc,1:nlevsoi), & - smp(bounds%begc:bounds%endc,1:nlevsoi), & - imped(bounds%begc:bounds%endc,1:nlevsoi), & - vwc_liq(bounds%begc:bounds%endc,1:nlevsoi)) - - endif - - end associate - - end subroutine soilwater_moisture_form - -!#8 -!----------------------------------------------------------------------- - subroutine compute_hydraulic_properties(c, nlayers, & - soilhydrology_inst, soilstate_inst, & - soil_water_retention_curve, vwc_liq, hk ,smp, & - dhkdw, dsmpdw, imped) - ! - ! !DESCRIPTION: - - ! Calculate soil hydraulic conductivity and matric potential - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varcon , only : e_ice - use clm_varpar , only : nlevsoi - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use SoilStateType , only : soilstate_type - use SoilHydrologyType , only : soilhydrology_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: c ! column index - integer , intent(in) :: nlayers ! lower boundary index - - type(soilhydrology_type), intent(in) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - real(r8), intent(in) :: vwc_liq(1:nlayers) - - real(r8), intent(out) :: hk(1:nlayers) - real(r8), intent(out) :: smp(1:nlayers) - real(r8), intent(out) :: dhkdw(1:nlayers) - real(r8), intent(out) :: dsmpdw(1:nlayers) - real(r8), intent(out) :: imped(1:nlayers) - ! - ! !LOCAL VARIABLES: - integer :: j ! do loop indices - real(r8) :: s1 ! "s" at interface of layer - real(r8) :: s2(1:nlayers) ! "s" at layer node - real(r8) :: dsmpds !temporary variable - real(r8) :: dhkds !temporary variable - character(len=32) :: subname = 'calculate_hydraulic_properties' ! subroutine name - !----------------------------------------------------------------------- - -!scs: originally, associate statements selected sections rather than -! entire arrays, but due to pgi bug, removed array section selections -! using array sections allowed consistent 1d indexing throughout - associate(& - icefrac => soilhydrology_inst%icefrac_col , & ! Input: [real(r8) (:,:) ] fraction of ice - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - smp_l => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix potential [mm] - hk_l => soilstate_inst%hk_l_col & ! Input: [real(r8) (:,:) ] hydraulic conductivity (mm/s) - ) ! end associate statement - - hk = 0._r8 - smp = 0._r8 - dhkdw = 0._r8 - dsmpdw = 0._r8 - imped = 0._r8 - - ! Hydraulic conductivity and soil matric potential and their derivatives - - ! compute the relative saturation at each layer first b/c - ! it is used later in calculation of s1 - do j = 1, nlayers - s2(j) = vwc_liq(j)/watsat(c,j) - ! impose constraints on relative saturation at the layer node - s2(j) = min(s2(j), 1._r8) - s2(j) = max(0.01_r8, s2(j)) - enddo - - do j = 1, nlayers - ! s1 is interface value, s2 is node value - if(j==nlayers)then - s1 = s2(j) - call IceImpedance(icefrac(c,j), e_ice, imped(j) ) - else - s1 = 0.5_r8 * (s2(j) + s2(j+1)) - call IceImpedance(0.5_r8*(icefrac(c,j) + icefrac(c,j+1)), e_ice, imped(j) ) - endif - - ! impose constraints on relative saturation at the layer interface - s1 = min(s1, 1._r8) - s1 = max(0.01_r8, s1) - - call soil_water_retention_curve%soil_hk(c, j, s1, & - imped(j), soilstate_inst, hk(j), dhkds=dhkds) - - call soil_water_retention_curve%soil_suction(c, j, s2(j), & - soilstate_inst,smp(j), dsmpds=dsmpds) - - - ! NOTE: here just save derivative in hydraulic conductivity - ! w.r.t relative raturation at the layer interface - ! --> the derivatives at the nodes are calculated - ! in compute_moisture_fluxes_and_derivs - dhkdw(j) = dhkds ! NOTE: the variable name does not make sense - - ! compute derivative w.r.t. volumetric liquid water content - ! NOTE: derivative for the layer - dsmpdw(j) = dsmpds / watsat(c,j) - - ! save for the output - smp_l(c,j) = smp(j) - hk_l(c,j) = hk(j) - - end do - - end associate - - end subroutine compute_hydraulic_properties - -!#9 -!----------------------------------------------------------------------- - subroutine compute_moisture_fluxes_and_derivs(c, nlayers, & - soilhydrology_inst, soilstate_inst, temperature_inst, waterflux_inst, & - soil_water_retention_curve, vwc_liq, hk ,smp, dhkdw, dsmpdw, & - imped, qin, qout, dqidw0, dqidw1, dqodw1, dqodw2) - ! - ! !DESCRIPTION: - - ! Calculate fluxes at the boundary of each layer and derivatives w.r.t. - ! relevant state variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varpar , only : nlevsoi - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use SoilStateType , only : soilstate_type - use SoilHydrologyType , only : soilhydrology_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: c ! column index - integer , intent(in) :: nlayers ! lower boundary index - - type(soilhydrology_type), intent(in) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterflux_type) , intent(in) :: waterflux_inst - - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - real(r8), intent(in) :: vwc_liq(1:nlayers) - real(r8), intent(in) :: hk(1:nlayers) - real(r8), intent(in) :: smp(1:nlayers) - real(r8), intent(in) :: dhkdw(1:nlayers) - real(r8), intent(in) :: dsmpdw(1:nlayers) - real(r8), intent(in) :: imped(1:nlayers) - - real(r8), intent(out) :: qin(1:nlayers) - real(r8), intent(out) :: qout(1:nlayers) - real(r8), intent(out) :: dqidw0(1:nlayers) - real(r8), intent(out) :: dqidw1(1:nlayers) - real(r8), intent(out) :: dqodw1(1:nlayers) - real(r8), intent(out) :: dqodw2(1:nlayers) - ! - ! !LOCAL VARIABLES: - integer :: j ! do loop indices - real(r8) :: s1 ! "s" at interface of layer - real(r8) :: s2 ! "s" at layer node - real(r8) :: smp1 !temporary variable - real(r8) :: hk1 !temporary variable - real(r8) :: num, den ! used in calculating qin, qout - real(r8) :: dhkds1, dhkds2 !temporary variable - real(r8),parameter :: m_to_mm = 1.e3_r8 !convert meters to mm -!scs: temporarily use local variables for the following - real(r8) :: vwc_liq_ub ! liquid volumetric water content at upper boundary - real(r8) :: vwc_liq_lb ! liquid volumetric water content at lower boundary - character(len=32) :: subname = 'calculate_moisture_fluxes_and_derivs' ! subroutine name - integer :: jwt !index of layer above water table - real(r8) :: dhkdw1, dsmpdw1, dsmpds1 - integer,parameter :: zdflag = 0 - !----------------------------------------------------------------------- - - associate(& - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi , & ! Input: [real(r8) (:,:) ] interface level below a "z" level (m) - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - qflx_infl => waterflux_inst%qflx_infl_col , & ! Input: [real(r8) (:) ] infiltration (mm H2O /s) - watsat => soilstate_inst%watsat_col & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - ) ! end associate statement - - qin = 0._r8 - qout = 0._r8 - dqidw0 = 0._r8 - dqidw1 = 0._r8 - dqodw1 = 0._r8 - dqodw2 = 0._r8 - - ! Soil moisture fluxes and their derivatives - - j = 1 - - ! select type of boundary condition - select case(upper_boundary_condition) - - ! head boundary conditions - case(bc_head) - - ! compute the relative saturation at the upper boundary - s1 = vwc_liq_ub / watsat(c,j) - ! s1 = (vwc_liq_ub - watres(c,j)) / (watsat(c,j) - watres(c,j)) - s1 = min(s1, 1._r8) - s1 = max(0.01_r8, s1) - - ! compute the hydraulic conductivity and matric potential at the boundary - call soil_water_retention_curve%soil_hk(c, j, s1, & - imped(j), soilstate_inst, hk1) - - call soil_water_retention_curve%soil_suction(c, j, s1, & - soilstate_inst,smp1) - - ! compute the infiltration to the top of the layer - den = z(c,j)* m_to_mm * 0.5_r8 - qin(j) = -hk1*(smp(j) - smp1)/den + hk1 - - ! compute the flux derivative w.r.t influx - dqidw1(j) = -hk1*dsmpdw(j)/den - - ! flux boundary condition - case(bc_flux) - - ! specify infiltration - qin(j) = qflx_infl(c) - - ! compute the flux derivative w.r.t influx - dqidw1(j) = 0._r8 - - ! check the case is specified correctly - case default - - call endrun(subname // ':: the upper boundary condition must be specified!') - - end select - - ! NOTE: the rest of the code for j=1 is identical to the code for - ! the interior nodes (j=2,...,nlevsoi-1) - ! Not sure why this is split out in this way.... - - ! compute derivatives in hydraulic conductivity at the interface w.r.t. - ! volumetric liquid water content in the layer above and the layer below - ! NOTE: dhkdw(j) is the derivative in hydrualic conductivity at the - ! layer interface w.r.t relative saturation at the interface - dhkds1 = 0.5_r8 * dhkdw(j) / watsat(c,j) ! derivative w.r.t. volumetric liquid water in the upper layer - dhkds2 = 0.5_r8 * dhkdw(j) / watsat(c,j+1) ! derivative w.r.t. volumetric liquid water in the lower layer - -!scs: this is how zd is done - if (zdflag == 1) then - dhkds1 = dhkdw(j)/(watsat(c,j)+watsat(c,min(nlevsoi, j+1))) - dhkds2 = dhkds1 - endif -!scs - - ! compute flux at the bottom of the j-th layer - ! NOTE: hk(j) is hydraulic conductivity at the bottom of the j-th - ! layer - num = (smp(j+1)-smp(j)) - den = m_to_mm * (z(c,j+1)-z(c,j)) - qout(j) = -hk(j)*num/den + hk(j) - - ! compute flux derivatives - dqodw1(j) = (hk(j)*dsmpdw(j) - dhkds1*num)/den + dhkds1 - dqodw2(j) = (-hk(j)*dsmpdw(j+1) - dhkds2*num)/den + dhkds2 - - ! Interior nodes - - do j = 2, nlayers - 1 - - ! get the flux from above - qin(j) = qout(j-1) - - ! get the derivatives from above - dqidw0(j) = dqodw1(j-1) - dqidw1(j) = dqodw2(j-1) - - ! compute derivatives in hydraulic conductivity at the interface w.r.t. - ! volumetric liquid water content in the layer above and the layer below - ! NOTE: dhkdw(j) is the derivative in hydrualic conductivity at the - ! layer interface w.r.t relative saturation at the interface - dhkds1 = 0.5_r8 * dhkdw(j) / watsat(c,j) ! derivative w.r.t. volumetric liquid water in the upper layer - dhkds2 = 0.5_r8 * dhkdw(j) / watsat(c,j+1) ! derivative w.r.t. volumetric liquid water in the lower layer -!scs: this is how zd is done - if (zdflag == 1) then - dhkds1 = dhkdw(j)/(watsat(c,j)+watsat(c,min(nlevsoi, j+1))) - dhkds2 = dhkds1 - endif -!scs - - ! compute flux at the bottom of the j-th layer - ! NOTE: hk(j) is hydraulic conductivity at the bottom of the j-th layer - num = (smp(j+1)-smp(j)) - den = m_to_mm * (z(c,j+1)-z(c,j)) - qout(j) = -hk(j)*num/den + hk(j) - - ! compute flux derivatives - dqodw1(j) = (hk(j)*dsmpdw(j) - dhkds1*num)/den + dhkds1 - dqodw2(j) = (-hk(j)*dsmpdw(j+1) - dhkds2*num)/den + dhkds2 - - end do - - ! Node j=nlevsoi (bottom) - - j = nlayers - - ! get the flux from above - qin(j) = qout(j-1) - - ! get the derivatives from above - dqidw0(j) = dqodw1(j-1) - dqidw1(j) = dqodw2(j-1) - - ! select type of boundary condition - select case(lower_boundary_condition) - - ! water table boundary conditions (moving lower boundary) - case(bc_waterTable) - - jwt = nlevsoi - ! Locate index of layer above water table - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt = j-1 - exit - end if - enddo - - ! water table within soil column - j=nlevsoi - if(j > jwt) then - - ! no drainage - qout(j) = 0. - dqodw1(j) = 0. - dqodw2(j) = 0. - - ! water table below soil column - else - - ! following Niu et al. (JGR 2007), assume hydraulic conductivity at the bottom of the soil column - ! is equal to hydraulic conductivty at the lowest node. This provides a free-drainage lower boundary - ! condition when the water table is a long way below the soil column - dhkds1 = dhkdw(j) / watsat(c,j) - -!scs: this is how zd is done - if (zdflag == 1) then - dhkds1 = dhkdw(j)/(watsat(c,j)+watsat(c,min(nlevsoi, j+1))) - dhkds2 = dhkds1 - endif -!scs - ! compute flux - num = -smp(j) ! NOTE: assume saturation at water table depth (smp=0) - den = m_to_mm * (zwt(c) - z(c,j)) - qout(j) = -hk(j)*num/den + hk(j) ! using hydraulic conductivity at the midpoint of the two nodes - - ! compute derivatives - dqodw1(j) = (hk(j)*dsmpdw(j) - dhkds1*num)/den + dhkds1 - dqodw2(j) = 0._r8 ! no layer below - - endif ! switch between water table above/below soil column - - - ! head boundary conditions - case(bc_head) - - ! compute the relative saturation at the lower boundary - s1 = vwc_liq_lb / watsat(c,j) -!scs: mc's original expression s1 = (vwc_liq_lb - watres(c,j)) / (watsat(c,j) - watres(c,j)) - s1 = min(s1, 1._r8) - s1 = max(0.01_r8, s1) - - ! compute the hydraulic conductivity and matric potential at the boundary - call soil_water_retention_curve%soil_hk(c, j, s1, & - imped(j), soilstate_inst, hk1) - - call soil_water_retention_curve%soil_suction(c, j, s1, & - soilstate_inst,smp1) - - ! compute the flux at the bottom of the layer - den = m_to_mm * z(c,j) * 0.5_r8 - qout(j) = -hk1*(smp1 - smp(j))/den + hk1 - - ! compute the flux derivative - dqodw1(j) = hk1*dsmpdw(j)/den - - ! stop, because not tested yet - call endrun(subname // ':: the specified lower boundary condition is not fully implemented/tested yet') - - ! flux boundary condition - case(bc_flux) - - ! free drainage - qout(j) = hk(j) - - ! compute the flux derivative - dqodw1(j) = dhkdw(j) / watsat(c,j) - - case(bc_zero_flux) - - ! no drainage - qout(j) = 0. - - ! compute the flux derivative - dqodw1(j) = 0. - - ! check the case is specified correctly - case default - - call endrun(subname // ':: the lower boundary condition must be specified!') - - end select - - - end associate - - end subroutine compute_moisture_fluxes_and_derivs - - -!#10 -!----------------------------------------------------------------------- - subroutine compute_RHS_moisture_form(c, nlayers, vert_trans_sink, & - vwc_liq, qin, qout, dt_dz, rmx) - ! - ! !DESCRIPTION: - - ! Calculate RHS of moisture-based form of Richards equation - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varpar , only : nlevsoi - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: c ! column index - integer , intent(in) :: nlayers ! lower boundary index - - real(r8), intent(in) :: vert_trans_sink(1:nlayers) ! vertically distributed transpiration sink (mm H2O/s) (+ = to atm) - real(r8), intent(in) :: vwc_liq(1:nlayers) - real(r8), intent(in) :: qin(1:nlayers) - real(r8), intent(in) :: qout(1:nlayers) - real(r8), intent(in) :: dt_dz(1:nlayers) - real(r8), intent(out) :: rmx(1:nlayers) ! "r" forcing term of tridiagonal matrix - ! - ! !LOCAL VARIABLES: - integer :: j ! do loop indices - real(r8) :: fluxNet !temporary variable - integer,parameter :: ixIterate=1 - integer,parameter :: ixNonIterate=2 - integer :: iterateOption=ixNonIterate - character(len=32) :: subname = 'compute_RHS_moisture_form' ! subroutine name - !----------------------------------------------------------------------- - - associate(& - dz => col%dz & ! Input: [real(r8) (:,:) ] layer depth (m) - ) ! end associate statement - - rmx = 0._r8 - -! Compute RHS of moisture-based form of Richards equation - do j = 1, nlayers - - fluxNet = qin(j) - qout(j) - vert_trans_sink(j) -! rmx(j) = vwc_liq(j) - (vwc_liq(j) + fluxNet*dt_dz(j)) - - ! different options for iterative and non-iterative solutions - select case(iterateOption) - case(ixIterate) - ! for iterative solution entire soil hydrology routine should be - ! called multiple times using updated versions of vwc_trial - ! vwc_trial = wwc_liq for iteration=1 - !rmx(j) = vwc_trial(j) - (vwc_liq(j) + fluxNet*dt_dz(j)) - call endrun(subname // ':: ERROR iterative option not yet implemented') - case(ixNonIterate) - rmx(j) = -fluxNet*dt_dz(j) - case default - call endrun(subname // ':: ERROR unknown iterate option') - end select - - end do - - end associate - - end subroutine compute_RHS_moisture_form - -!#11 -!----------------------------------------------------------------------- - subroutine compute_LHS_moisture_form(c, nlayers, & - soilhydrology_inst, dt_dz, dqidw0, dqidw1, dqodw1, dqodw2, & - amx, bmx, cmx) - ! - ! !DESCRIPTION: - - ! Calculate LHS of moisture-based form of Richards equation - ! LHS is a tridiagonal matrix - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varpar , only : nlevsoi - use ColumnType , only : col - use SoilHydrologyType , only : soilhydrology_type - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: c ! column index - integer , intent(in) :: nlayers ! lower boundary index - type(soilhydrology_type), intent(in) :: soilhydrology_inst - - real(r8), intent(in) :: dt_dz(1:nlayers) - real(r8), intent(in) :: dqidw0(1:nlayers) - real(r8), intent(in) :: dqidw1(1:nlayers) - real(r8), intent(in) :: dqodw1(1:nlayers) - real(r8), intent(in) :: dqodw2(1:nlayers) - real(r8), intent(out) :: amx(1:nlayers) ! "a" left off diagonal of tridiagonal matrix - real(r8), intent(out) :: bmx(1:nlayers) ! "b" diagonal column for tridiagonal matrix - real(r8), intent(out) :: cmx(1:nlayers) ! "c" right off diagonal tridiagonal matrix - - ! - ! !LOCAL VARIABLES: - integer :: j ! do loop indices - character(len=32) :: subname = 'compute_LHS_moisture_form' ! subroutine name - integer :: jwt !index of layer above water table - !----------------------------------------------------------------------- - - associate(& - zi => col%zi , & ! Input: [real(r8) (:,:) ] layer interface depth (m) - zwt => soilhydrology_inst%zwt_col & ! Input: [real(r8) (:) ] water table depth (m) - ) ! end associate statement - - - amx = 0._r8 - bmx = 0._r8 - cmx = 0._r8 - -! Compute LHS of moisture-based form of Richards equation -! Top soil layer - j=1 - amx(j) = 0._r8 - bmx(j) = -1._r8 - (-dqidw1(j) + dqodw1(j))*dt_dz(j) - cmx(j) = -dqodw2(j)*dt_dz(j) - -! Interior soil layers - do j = 2, nlayers-1 - amx(j) = dqidw0(j)*dt_dz(j) - bmx(j) = -1._r8 - (-dqidw1(j) + dqodw1(j))*dt_dz(j) - cmx(j) = -dqodw2(j)*dt_dz(j) - enddo - - j=nlayers - amx(j) = dqidw0(j)*dt_dz(j) - bmx(j) = -1._r8 - (-dqidw1(j) + dqodw1(j))*dt_dz(j) - cmx(j) = 0._r8 - - end associate - - end subroutine compute_LHS_moisture_form - -!#12 -!----------------------------------------------------------------------- - subroutine compute_qcharge(bounds, num_hydrologyc, & - filter_hydrologyc, soilhydrology_inst, soilstate_inst, & - waterstate_inst, soil_water_retention_curve, & - dwat, smp, imped, vwc_liq) - ! - ! !DESCRIPTION: - - ! Calculate additional terms due to presence of aquifer layer - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevsoi - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use SoilStateType , only : soilstate_type - use SoilHydrologyType , only : soilhydrology_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use WaterStateType , only : waterstate_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(:) ! column filter for soil points - - type(soilhydrology_type), intent(in) :: soilhydrology_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - -! integer, intent(in) :: soil_hydraulic_properties_method - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - real(r8), intent(in) :: dwat(bounds%begc:bounds%endc,1:nlevsoi) - real(r8), intent(in) :: imped(bounds%begc:bounds%endc,1:nlevsoi) - real(r8), intent(in) :: smp(bounds%begc:bounds%endc,1:nlevsoi) - real(r8), intent(in) :: vwc_liq(bounds%begc:bounds%endc,1:nlevsoi) -! real(r8), intent(in) :: hksat(bounds%begc:bounds%endc,1:nlevsoi) - - ! - ! !LOCAL VARIABLES: - integer :: c,fc,j ! do loop indices - integer :: jwt - real(r8) :: ka - real(r8) :: wh_zwt - real(r8) :: wh - real(r8) :: dtime ! land model time step (sec) - real(r8) :: smp1 !temporary variable - real(r8) :: s1 !temporary variable - real(r8) :: dz_aquifer !temporary variable - - character(len=32) :: subname = 'compute_qcharge' ! subroutine name - !----------------------------------------------------------------------- - - associate(& - qcharge => soilhydrology_inst%qcharge_col , & ! Input: [real(r8) (:) ] aquifer recharge rate (mm/s) - wa => soilhydrology_inst%wa_col , & ! Input: [real(r8) (:) ] water in the unconfined aquifer (mm) - zwt => soilhydrology_inst%zwt_col , & ! Input: [real(r8) (:) ] water table depth (m) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - smpmin => soilstate_inst%smpmin_col , & ! Input: [real(r8) (:) ] restriction for min of soil potential (mm) - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - z => col%z , & ! Input: [real(r8) (:,:) ] layer depth (m) - zi => col%zi & ! Input: [real(r8) (:,:) ] layer interface depth (m) - ) ! end associate statement - - ! Get time step - - dtime = get_step_size() - - ! compute flux of water to aquifer - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) -! Locate index of layer above water table - jwt = nlevsoi - do j = 1,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt = j-1 - exit - end if - enddo - ! calculate qcharge for case jwt < nlevsoi - if(jwt < nlevsoi) then - wh_zwt = - sucsat(c,jwt+1) - zwt(c)*m_to_mm - - ! Recharge rate qcharge to groundwater (positive to aquifer) -! s1 = max(h2osoi_vol(c,jwt+1)/watsat(c,jwt+1), 0.01_r8) - s1 = max(vwc_liq(c,jwt+1)/watsat(c,jwt+1), 0.01_r8) - s1 = min(1._r8, s1) - - !this is the expression for unsaturated hk - call soil_water_retention_curve%soil_hk(c, jwt+1, s1, & - imped(c,jwt+1), soilstate_inst, ka) - - ! Recharge rate qcharge to groundwater (positive to aquifer) - smp1 = max(smpmin(c), smp(c,max(1,jwt))) - wh = smp1 - z(c,max(1,jwt))*m_to_mm - - ! original formulation - if(jwt == 0) then - qcharge(c) = -ka * (wh_zwt-wh) /((zwt(c)+1.e-3)*m_to_mm) - else - ! qcharge(c) = -ka * (wh_zwt-wh)/((zwt(c)-z(c,jwt))*1000._r8) - ! 1/2, assuming flux is at zwt interface, saturation deeper than zwt - qcharge(c) = -ka * (wh_zwt-wh)/((zwt(c)-z(c,jwt))*m_to_mm*2.0) - endif - - ! To limit qcharge (for the first several timesteps) - qcharge(c) = max(-10.0_r8/dtime,qcharge(c)) - qcharge(c) = min( 10.0_r8/dtime,qcharge(c)) - endif - - end do - - end associate - - end subroutine compute_qcharge - -!#13 - !----------------------------------------------------------------------- - subroutine IceImpedance(icefrac, e_ice, imped) - ! - !DESCRIPTION - ! compute soil suction potential - ! - ! !USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use abortutils , only : endrun - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: icefrac !fraction of pore space filled with ice - real(r8), intent(in) :: e_ice !shape parameter - - real(r8), intent(out) :: imped !hydraulic conductivity reduction due to the presence of ice in pore space - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'IceImpedance' ! subroutine name - !------------------------------------------------------------------------------ - - imped = 10._r8**(-e_ice*icefrac) - - end subroutine IceImpedance - -!#14 - !----------------------------------------------------------------------- - subroutine TridiagonalCol (ci, lbj, ubj, jtop, a, b, c, r, u) - ! - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevurb - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varctl , only : iulog - use decompMod , only : bounds_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: ci ! lbinning and ubing level indices - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: jtop ! top level for each column [col] - real(r8), intent(in) :: a( lbj: ) ! "a" left off diagonal of tridiagonal matrix [col, j] - real(r8), intent(in) :: b( lbj: ) ! "b" diagonal column for tridiagonal matrix [col, j] - real(r8), intent(in) :: c( lbj: ) ! "c" right off diagonal tridiagonal matrix [col, j] - real(r8), intent(in) :: r( lbj: ) ! "r" forcing term of tridiagonal matrix [col, j] - real(r8), intent(inout) :: u( lbj: ) ! solution [col, j] - ! - integer :: j,fc !indices - real(r8) :: gam(lbj:ubj) !temporary - real(r8) :: bet !temporary - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(a) == (/ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(b) == (/ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c) == (/ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(r) == (/ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(u) == (/ubj/)), errMsg(sourcefile, __LINE__)) - - ! Solve the matrix - - bet = b(jtop) - - do j = lbj, ubj - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then - if (j >= jtop) then - if (j == jtop) then - u(j) = r(j) / bet - else - gam(j) = c(j-1) / bet - bet = b(j) - a(j) * gam(j) - u(j) = (r(j) - a(j)*u(j-1)) / bet - end if - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop) then - if (j == jtop) then - u(j) = r(j) / bet - else - gam(j) = c(j-1) / bet - bet = b(j) - a(j) * gam(j) - u(j) = (r(j) - a(j)*u(j-1)) / bet - end if - end if - end if - end do - - do j = ubj-1,lbj,-1 - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then - if (j >= jtop) then - u(j) = u(j) - gam(j+1) * u(j+1) - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop) then - u(j) = u(j) - gam(j+1) * u(j+1) - end if - end if - end do - - end subroutine TridiagonalCol - - end module SoilWaterMovementMod diff --git a/src/biogeophys/SoilWaterPlantSinkMod.F90 b/src/biogeophys/SoilWaterPlantSinkMod.F90 deleted file mode 100644 index 90624ae70c..0000000000 --- a/src/biogeophys/SoilWaterPlantSinkMod.F90 +++ /dev/null @@ -1,444 +0,0 @@ -module SoilWaterPlantSinkMod - - use clm_varctl , only : use_hydrstress - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use landunit_varcon , only : istsoil,istcrop - use column_varcon , only : icol_road_perv - implicit none - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - subroutine Compute_EffecRootFrac_And_VertTranSink(bounds, num_hydrologyc, & - filter_hydrologyc, soilstate_inst, canopystate_inst, waterflux_inst, energyflux_inst) - - ! --------------------------------------------------------------------------------- - ! This is a wrapper for calculating the effective root fraction and soil - ! water sink due to plant transpiration. - ! Calculate Soil Water Sink to Roots over different types - ! of columns and for different process modules - ! The super-set of all columns that should have a root water sink - ! is filter_hydrologyc - ! There are three groups of columns: - ! 1) impervious roads, 2) non-natural vegetation and 3) natural vegetation - ! There are several methods available. - ! 1) the default version, 2) hydstress version and 3) fates boundary conditions - ! - ! There are only two quantities that are the result of this routine, and its - ! children: - ! waterflux_inst%qflx_rootsoi_col(c,j) - ! soilstate_inst%rootr_col(c,j) - ! - ! - ! --------------------------------------------------------------------------------- - - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use CanopyStateType , only : canopystate_type - use EnergyFluxType , only : energyflux_type - use ColumnType , only : col - use LandunitType , only : lun - - ! Arguments - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(num_hydrologyc) ! column filter for soil points - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(energyflux_type) , intent(in) :: energyflux_inst - - ! Local Variables - integer :: filterc(bounds%endc-bounds%begc+1) !column filter - integer :: num_filterc - integer :: num_filterc_tot - integer :: fc - integer :: c - integer :: l - - num_filterc_tot = 0 - - ! 1) pervious roads - num_filterc = 0 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (col%itype(c) == icol_road_perv) then - num_filterc = num_filterc + 1 - filterc(num_filterc) = c - end if - end do - num_filterc_tot = num_filterc_tot+num_filterc - if(use_hydrstress) then - call Compute_EffecRootFrac_And_VertTranSink_HydStress_Roads(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - else - call Compute_EffecRootFrac_And_VertTranSink_Default(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - end if - - - ! Note: 2 and 3 really don't need to be split. But I am leaving - ! it split in case someone wants to calculate uptake in a special - ! way for a specific LU or coverage type (RGK 04/2017). Feel - ! free to consolidate if there are no plans to do such a thing. - - - ! 2) not ( pervious road or natural vegetation) , everything else - num_filterc = 0 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - l = col%landunit(c) - if ( (col%itype(c) /= icol_road_perv) .and. (lun%itype(l) /= istsoil) ) then - num_filterc = num_filterc + 1 - filterc(num_filterc) = c - end if - end do - num_filterc_tot = num_filterc_tot+num_filterc - if(use_hydrstress) then - call Compute_EffecRootFrac_And_VertTranSink_HydStress(bounds, & - num_filterc, filterc, waterflux_inst, soilstate_inst, & - canopystate_inst, energyflux_inst) - else - call Compute_EffecRootFrac_And_VertTranSink_Default(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - end if - - - ! 3) Natural vegetation - num_filterc = 0 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - l = col%landunit(c) - if ( (lun%itype(l) == istsoil) ) then - num_filterc = num_filterc + 1 - filterc(num_filterc) = c - end if - end do - num_filterc_tot = num_filterc_tot+num_filterc - if (use_hydrstress) then - call Compute_EffecRootFrac_And_VertTranSink_HydStress(bounds, & - num_filterc, filterc, waterflux_inst, soilstate_inst, & - canopystate_inst,energyflux_inst) - else - call Compute_EffecRootFrac_And_VertTranSink_Default(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - end if - - if (num_hydrologyc /= num_filterc_tot) then - write(iulog,*) 'The total number of columns flagged to root water uptake' - write(iulog,*) 'did not match the total number calculated' - write(iulog,*) 'This is likely a problem with the interpretation of column/lu filters.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - - return - end subroutine Compute_EffecRootFrac_And_VertTranSink - - ! ==================================================================================== - - subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress_Roads(bounds, & - num_filterc,filterc, soilstate_inst, waterflux_inst) - - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use clm_varpar , only : nlevsoi - use clm_varpar , only : max_patch_per_col - use PatchType , only : patch - use ColumnType , only : col - - ! Arguments - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_filterc - integer , intent(in) :: filterc(:) - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - - ! Locals - integer :: j - integer :: c - integer :: fc - integer :: pi - integer :: p - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - - - associate(& - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:,:) ] - ! vegetation/soil water exchange (mm H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - rootr_patch => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - rootr_col => soilstate_inst%rootr_col & ! Output: [real(r8) (:,:) ] - !effective fraction of roots in each soil layer - ) - - ! First step is to calculate the column-level effective rooting - ! fraction in each soil layer. This is done outside the usual - ! PATCH-to-column averaging routines because it is not a simple - ! weighted average of the PATCH level rootr arrays. Instead, the - ! weighting depends on both the per-unit-area transpiration - ! of the PATCH and the PATCHEs area relative to all PATCHES. - - temp(bounds%begc : bounds%endc) = 0._r8 - - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - rootr_col(c,j) = 0._r8 - end do - end do - - do pi = 1,max_patch_per_col - do j = 1,nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - rootr_col(c,j) = rootr_col(c,j) + rootr_patch(p,j) * & - qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - temp(c) = temp(c) + qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (temp(c) /= 0._r8) then - rootr_col(c,j) = rootr_col(c,j)/temp(c) - end if - qflx_rootsoi_col(c,j) = rootr_col(c,j)*qflx_tran_veg_col(c) - end do - end do - end associate - return - end subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress_Roads - - ! ================================================================================== - - subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress( bounds, & - num_filterc, filterc, waterflux_inst, soilstate_inst, & - canopystate_inst, energyflux_inst) - - - ! - !USES: - use decompMod , only : bounds_type - use clm_varpar , only : nlevsoi - use clm_varpar , only : max_patch_per_col - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use CanopyStateType , only : canopystate_type - use PatchType , only : patch - use ColumnType , only : col - use clm_varctl , only : iulog - use PhotosynthesisMod, only : plc, params_inst - use column_varcon , only : icol_road_perv - use shr_infnan_mod , only : isnan => shr_infnan_isnan - use EnergyFluxType , only : energyflux_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_filterc ! number of column soil points in column filter - integer , intent(in) :: filterc(:) ! column filter for soil points - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(energyflux_type), intent(in) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,fc,j ! do loop indices - integer :: pi ! patch index - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - real(r8) :: grav2 ! soil layer gravitational potential relative to surface (mm H2O) - integer , parameter :: soil=1,root=4 ! index values - !----------------------------------------------------------------------- - - associate(& - k_soil_root => soilstate_inst%k_soil_root_patch , & ! Input: [real(r8) (:,:) ] - ! soil-root interface conductance (mm/s) - qflx_phs_neg_col => waterflux_inst%qflx_phs_neg_col , & ! Input: [real(r8) (:) ] n - ! net neg hydraulic redistribution flux(mm H2O/s) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:) ] - ! col root and soil water - ! exchange [mm H2O/s] [+ into root] - rootr_col => soilstate_inst%rootr_col , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - rootr_patch => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - smp => soilstate_inst%smp_l_col , & ! Input: [real(r8) (:,:) ] soil matrix pot. [mm] - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Input: [integer (:) ] - ! fraction of vegetation not - ! covered by snow (0 OR 1) [-] - z => col%z , & ! Input: [real(r8) (:,:) ] layer node depth (m) - vegwp => canopystate_inst%vegwp_patch & ! Input: [real(r8) (:,:) ] vegetation water - ! matric potential (mm) - ) - - do fc = 1, num_filterc - c = filterc(fc) - qflx_phs_neg_col(c) = 0._r8 - - do j = 1, nlevsoi - grav2 = z(c,j) * 1000._r8 - temp(c) = 0._r8 - do pi = 1,max_patch_per_col - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p).and.frac_veg_nosno(p)>0) then - if (patch%wtcol(p) > 0._r8) then - temp(c) = temp(c) + k_soil_root(p,j) & - * (smp(c,j) - vegwp(p,4) - grav2)* patch%wtcol(p) - endif - end if - end if - end do - qflx_rootsoi_col(c,j)= temp(c) - - if (temp(c) < 0._r8) qflx_phs_neg_col(c) = qflx_phs_neg_col(c) + temp(c) - end do - - ! Back out the effective root density - if( sum(qflx_rootsoi_col(c,:))>0.0_r8 ) then - do j = 1, nlevsoi - rootr_col(c,j) = qflx_rootsoi_col(c,j)/sum( qflx_rootsoi_col(c,:)) - end do - else - rootr_col(c,:) = 0.0_r8 - end if - end do - - end associate - - return - end subroutine Compute_EffecRootFrac_And_VertTranSink_HydStress - - ! ================================================================================== - - subroutine Compute_EffecRootFrac_And_VertTranSink_Default(bounds, num_filterc, & - filterc, soilstate_inst, waterflux_inst) - - ! - ! Generic routine to apply transpiration as a sink condition that - ! is vertically distributed over the soil column. Should be - ! applicable to any Richards solver that is not coupled to plant - ! hydraulics. - ! - !USES: - use decompMod , only : bounds_type - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : nlevsoi, max_patch_per_col - use SoilStateType , only : soilstate_type - use WaterFluxType , only : waterflux_type - use PatchType , only : patch - use ColumnType , only : col - use clm_varctl , only : use_hydrstress - use column_varcon , only : icol_road_perv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_filterc ! number of column soil points in column filter - integer , intent(in) :: filterc(num_filterc) ! column filter for soil points - type(waterflux_type) , intent(inout) :: waterflux_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,fc,j ! do loop indices - integer :: pi ! patch index - real(r8) :: temp(bounds%begc:bounds%endc) ! accumulator for rootr weighting - associate(& - qflx_rootsoi_col => waterflux_inst%qflx_rootsoi_col , & ! Output: [real(r8) (:,:) ] - ! vegetation/soil water exchange (m H2O/s) (+ = to atm) - qflx_tran_veg_patch => waterflux_inst%qflx_tran_veg_patch , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_tran_veg_col => waterflux_inst%qflx_tran_veg_col , & ! Input: [real(r8) (:) ] - ! vegetation transpiration (mm H2O/s) (+ = to atm) - rootr_patch => soilstate_inst%rootr_patch , & ! Input: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - rootr_col => soilstate_inst%rootr_col & ! Output: [real(r8) (:,:) ] - ! effective fraction of roots in each soil layer - ) - - ! First step is to calculate the column-level effective rooting - ! fraction in each soil layer. This is done outside the usual - ! PATCH-to-column averaging routines because it is not a simple - ! weighted average of the PATCH level rootr arrays. Instead, the - ! weighting depends on both the per-unit-area transpiration - ! of the PATCH and the PATCHEs area relative to all PATCHES. - - temp(bounds%begc : bounds%endc) = 0._r8 - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - rootr_col(c,j) = 0._r8 - end do - end do - - do pi = 1,max_patch_per_col - do j = 1,nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - rootr_col(c,j) = rootr_col(c,j) + rootr_patch(p,j) * & - qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - do fc = 1, num_filterc - c = filterc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - if (patch%active(p)) then - temp(c) = temp(c) + qflx_tran_veg_patch(p) * patch%wtcol(p) - end if - end if - end do - end do - - do j = 1, nlevsoi - do fc = 1, num_filterc - c = filterc(fc) - if (temp(c) /= 0._r8) then - rootr_col(c,j) = rootr_col(c,j)/temp(c) - end if - qflx_rootsoi_col(c,j) = rootr_col(c,j)*qflx_tran_veg_col(c) - - end do - end do - end associate - return - end subroutine Compute_EffecRootFrac_And_VertTranSink_Default - -end module SoilWaterPlantSinkMod - diff --git a/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 b/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 deleted file mode 100644 index c82e27d851..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveClappHornberg1978Mod.F90 +++ /dev/null @@ -1,162 +0,0 @@ -module SoilWaterRetentionCurveClappHornberg1978Mod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Implementation of soil_water_retention_curve_type using the Clapp-Hornberg 1978 - ! parameterizations. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - implicit none - save - private - ! - ! !PUBLIC TYPES: - public :: soil_water_retention_curve_clapp_hornberg_1978_type - - type, extends(soil_water_retention_curve_type) :: & - soil_water_retention_curve_clapp_hornberg_1978_type - private - contains - procedure :: soil_hk ! compute hydraulic conductivity - procedure :: soil_suction ! compute soil suction potential - procedure :: soil_suction_inverse ! compute relative saturation at which soil suction is equal to a target value - end type soil_water_retention_curve_clapp_hornberg_1978_type - - interface soil_water_retention_curve_clapp_hornberg_1978_type - ! initialize a new soil_water_retention_curve_clapp_hornberg_1978_type object - module procedure constructor - end interface soil_water_retention_curve_clapp_hornberg_1978_type - -contains - - !----------------------------------------------------------------------- - type(soil_water_retention_curve_clapp_hornberg_1978_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type soil_water_retention_curve_clapp_hornberg_1978_type. - ! For now, this is simply a place-holder. - !----------------------------------------------------------------------- - - end function constructor - - !----------------------------------------------------------------------- - subroutine soil_hk(this, c, j, s, imped, soilstate_inst, hk, dhkds) - ! - ! !DESCRIPTION: - ! Compute hydraulic conductivity - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_clapp_hornberg_1978_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - real(r8), intent(in) :: imped !ice impedance - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: hk !hydraulic conductivity [mm/s] - real(r8), optional, intent(out) :: dhkds !d[hk]/ds [mm/s] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_hk' - !----------------------------------------------------------------------- - - associate(& - hksat => soilstate_inst%hksat_col(c,j) , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - bsw => soilstate_inst%bsw_col(c,j) & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - ) - - - !compute hydraulic conductivity - hk=imped*hksat*s**(2._r8*bsw+3._r8) - - !compute the derivative - if(present(dhkds))then - dhkds=(2._r8*bsw+3._r8)*hk/s - endif - - end associate - - end subroutine soil_hk - - !----------------------------------------------------------------------- - subroutine soil_suction(this, c, j, s, soilstate_inst, smp, dsmpds) - ! - ! !DESCRIPTION: - ! Compute soil suction potential - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_clapp_hornberg_1978_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: smp !soil suction, negative, [mm] - real(r8), optional, intent(out) :: dsmpds !d[smp]/ds, [mm] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - !compute soil suction potential, negative - smp = -sucsat*s**(-bsw) - - !compute derivative - if(present(dsmpds))then - dsmpds=-bsw*smp/s - endif - - end associate - - end subroutine soil_suction - - !----------------------------------------------------------------------- - subroutine soil_suction_inverse(this, c, j, smp_target, soilstate_inst, & - s_target) - ! - ! !DESCRIPTION: - ! Compute relative saturation at which soil suction is equal to a target value. - ! This is done by inverting the soil_suction equation to solve for s. - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_clapp_hornberg_1978_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - type(soilstate_type), intent(in) :: soilstate_inst - real(r8) , intent(in) :: smp_target ! target soil suction, negative [mm] - real(r8) , intent(out) :: s_target ! relative saturation at which smp = smp_target [0,1] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction_inverse' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - s_target = (-smp_target/sucsat)**(-1._r8/bsw) - - end associate - - end subroutine soil_suction_inverse - -end module SoilWaterRetentionCurveClappHornberg1978Mod - diff --git a/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 b/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 deleted file mode 100644 index 61e579dd43..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveFactoryMod.F90 +++ /dev/null @@ -1,71 +0,0 @@ -module SoilWaterRetentionCurveFactoryMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Factory to create an instance of soil_water_retention_curve_type. This module figures - ! out the particular type to return. - ! - ! !USES: - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - implicit none - save - private - ! - ! !PUBLIC ROUTINES: - public :: create_soil_water_retention_curve ! create an object of class soil_water_retention_curve_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - function create_soil_water_retention_curve() result(soil_water_retention_curve) - ! - ! !DESCRIPTION: - ! Create and return an object of soil_water_retention_curve_type. The particular type - ! is determined based on a namelist parameter. - ! - ! !USES: - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - use SoilWaterRetentionCurveClappHornberg1978Mod, only : soil_water_retention_curve_clapp_hornberg_1978_type - use SoilWaterRetentionCurveVanGenuchten1980Mod, only : soil_water_retention_curve_vangenuchten_1980_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), allocatable :: soil_water_retention_curve ! function result - ! - ! !LOCAL VARIABLES: - - ! For now, hard-code the method. Eventually this will be set from namelist, either by - ! this routine (appropriate if the 'method' is in its own namelist group), or do the - ! namelist read outside this module and pass the method in as a parameter (appropriate - ! if the 'method' is part of a larger namelist group). -!scs character(len=*), parameter :: method = "clapphornberg_1978" - character(len=256) :: method - - character(len=*), parameter :: subname = 'create_soil_water_retention_curve' - !----------------------------------------------------------------------- - - method = "clapphornberg_1978" !scs: placeholder until bld scripts changed - - select case (trim(method)) - - case ("clapphornberg_1978") - allocate(soil_water_retention_curve, & - source=soil_water_retention_curve_clapp_hornberg_1978_type()) - - case ("vangenuchten_1980") - allocate(soil_water_retention_curve, & - source=soil_water_retention_curve_vangenuchten_1980_type()) - - case default - write(iulog,*) subname//' ERROR: unknown method: ', method - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end select - - end function create_soil_water_retention_curve - -end module SoilWaterRetentionCurveFactoryMod diff --git a/src/biogeophys/SoilWaterRetentionCurveMod.F90 b/src/biogeophys/SoilWaterRetentionCurveMod.F90 deleted file mode 100644 index 74f8299d54..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveMod.F90 +++ /dev/null @@ -1,111 +0,0 @@ -module SoilWaterRetentionCurveMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Abstract base class for functions to compute soil water retention curve - ! - ! !USES: - implicit none - save - private - ! - ! !PUBLIC TYPES: - public :: soil_water_retention_curve_type - - type, abstract :: soil_water_retention_curve_type - private - contains - ! compute hydraulic conductivity - procedure(soil_hk_interface), deferred :: soil_hk - - ! compute soil suction potential - procedure(soil_suction_interface), deferred :: soil_suction - - ! compute relative saturation at which soil suction is equal to a target value - procedure(soil_suction_inverse_interface), deferred :: soil_suction_inverse - end type soil_water_retention_curve_type - - abstract interface - - ! Note: The following interfaces are set up based on the arguments needed for the - ! clapphornberg1978 implementations. It's likely that these interfaces are not - ! totally general for all desired implementations. In that case, we'll need to think - ! about how to support different interfaces. Some possible solutions are: - ! - ! - Make the interfaces contain all possible inputs that are needed by any - ! implementation; each implementation will then ignore the inputs it doesn't need. - ! - ! - For inputs that are needed only by particular implementations - and particularly - ! for inputs that are constant in time (e.g., this is the case for bsw, I think): - ! pass these into the constructor, and save pointers to these inputs as components - ! of the child type that needs them. Then they aren't needed as inputs to the - ! individual routines, allowing the interfaces for these routines to remain more - ! consistent between different implementations. - - subroutine soil_hk_interface(this, c, j, s, imped, soilstate_inst, & - hk, dhkds) - - ! !DESCRIPTION: - ! Compute hydraulic conductivity - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilStateType , only : soilstate_type - import :: soil_water_retention_curve_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - real(r8), intent(in) :: imped !ice impedance - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out):: hk !hydraulic conductivity [mm/s] - real(r8), optional, intent(out):: dhkds !d[hk]/ds [mm/s] - end subroutine soil_hk_interface - - - subroutine soil_suction_interface(this, c, j, s, soilstate_inst, & - smp, dsmpds) - - ! !DESCRIPTION: - ! Compute soil suction potential - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilStateType , only : soilstate_type - import :: soil_water_retention_curve_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: smp !soil suction, negative, [mm] - real(r8), optional, intent(out) :: dsmpds !d[smp]/ds, [mm] - end subroutine soil_suction_interface - - subroutine soil_suction_inverse_interface(this, c, j, smp_target, & - soilstate_inst, s_target) - ! !DESCRIPTION: - ! Compute relative saturation at which soil suction is equal to a target value. - ! This is done by inverting the soil_suction equation to solve for s. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilStateType , only : soilstate_type - import :: soil_water_retention_curve_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: smp_target ! target soil suction, negative [mm] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8) , intent(out) :: s_target ! relative saturation at which smp = smp_target [0,1] - end subroutine soil_suction_inverse_interface - - end interface - -end module SoilWaterRetentionCurveMod diff --git a/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 b/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 deleted file mode 100644 index c8dacccb81..0000000000 --- a/src/biogeophys/SoilWaterRetentionCurveVanGenuchten1980Mod.F90 +++ /dev/null @@ -1,162 +0,0 @@ -module SoilWaterRetentionCurveVanGenuchten1980Mod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Implementation of soil_water_retention_curve_type using the Clapp-Hornberg 1978 - ! parameterizations. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - implicit none - save - private - ! - ! !PUBLIC TYPES: - public :: soil_water_retention_curve_vangenuchten_1980_type - - type, extends(soil_water_retention_curve_type) :: & - soil_water_retention_curve_vangenuchten_1980_type - private - contains - procedure :: soil_hk ! compute hydraulic conductivity - procedure :: soil_suction ! compute soil suction potential - procedure :: soil_suction_inverse ! compute relative saturation at which soil suction is equal to a target value - end type soil_water_retention_curve_vangenuchten_1980_type - - interface soil_water_retention_curve_vangenuchten_1980_type - ! initialize a new soil_water_retention_curve_vangenuchten_1980_type object - module procedure constructor - end interface soil_water_retention_curve_vangenuchten_1980_type - -contains - - !----------------------------------------------------------------------- - type(soil_water_retention_curve_vangenuchten_1980_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates an object of type soil_water_retention_curve_vangenuchten_1980_type. - ! For now, this is simply a place-holder. - !----------------------------------------------------------------------- - - end function constructor - - !----------------------------------------------------------------------- - subroutine soil_hk(this, c, j, s, imped, soilstate_inst, hk, dhkds) - ! - ! !DESCRIPTION: - ! Compute hydraulic conductivity - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_vangenuchten_1980_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - real(r8), intent(in) :: imped !ice impedance - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: hk !hydraulic conductivity [mm/s] - real(r8), optional, intent(out) :: dhkds !d[hk]/ds [mm/s] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_hk' - !----------------------------------------------------------------------- - - associate(& - hksat => soilstate_inst%hksat_col(c,j) , & ! Input: [real(r8) (:,:) ] hydraulic conductivity at saturation (mm H2O /s) - bsw => soilstate_inst%bsw_col(c,j) & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - ) - - - !compute hydraulic conductivity - hk=imped*hksat*s**(2._r8*bsw+3._r8) - - !compute the derivative - if(present(dhkds))then - dhkds=(2._r8*bsw+3._r8)*hk/s - endif - - end associate - - end subroutine soil_hk - - !----------------------------------------------------------------------- - subroutine soil_suction(this, c, j, s, soilstate_inst, smp, dsmpds) - !j, - ! !DESCRIPTION: - ! Compute soil suction potential - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_vangenuchten_1980_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - real(r8), intent(in) :: s !relative saturation, [0, 1] - type(soilstate_type), intent(in) :: soilstate_inst - real(r8), intent(out) :: smp !soil suction, negative, [mm] - real(r8), optional, intent(out) :: dsmpds !d[smp]/ds, [mm] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - !compute soil suction potential, negative - smp = -sucsat*s**(-bsw) - - !compute derivative - if(present(dsmpds))then - dsmpds=-bsw*smp/s - endif - - end associate - - end subroutine soil_suction - - !----------------------------------------------------------------------- - subroutine soil_suction_inverse(this, c, j, smp_target, soilstate_inst, s_target) - ! - ! !DESCRIPTION: - ! Compute relative saturation at which soil suction is equal to a target value. - ! This is done by inverting the soil_suction equation to solve for s. - ! - ! !USES: - use SoilStateType , only : soilstate_type - ! - ! !ARGUMENTS: - class(soil_water_retention_curve_vangenuchten_1980_type), intent(in) :: this - integer, intent(in) :: c !column index - integer, intent(in) :: j !level index - type(soilstate_type), intent(in) :: soilstate_inst - real(r8) , intent(in) :: smp_target ! target soil suction, negative [mm] - real(r8) , intent(out) :: s_target ! relative saturation at which smp = smp_target [0,1] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'soil_suction_inverse' - !----------------------------------------------------------------------- - - associate(& - bsw => soilstate_inst%bsw_col(c,j) , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col(c,j) & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - ) - - s_target = (-smp_target/sucsat)**(-1._r8/bsw) - - end associate - - end subroutine soil_suction_inverse - -end module SoilWaterRetentionCurveVanGenuchten1980Mod - - diff --git a/src/biogeophys/SolarAbsorbedType.F90 b/src/biogeophys/SolarAbsorbedType.F90 deleted file mode 100644 index cff8cf9956..0000000000 --- a/src/biogeophys/SolarAbsorbedType.F90 +++ /dev/null @@ -1,423 +0,0 @@ -module SolarAbsorbedType - - !------------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_log_mod , only: errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varcon , only : spval - use clm_varctl , only : use_luna - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC DATA MEMBERS: - type, public :: solarabs_type - - ! Solar reflected - real(r8), pointer :: fsr_patch (:) ! patch solar radiation reflected (W/m**2) - - ! Solar Absorbed - real(r8), pointer :: fsa_patch (:) ! patch solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_u_patch (:) ! patch urban solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_r_patch (:) ! patch rural solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: parsun_z_patch (:,:) ! patch absorbed PAR for sunlit leaves in canopy layer (W/m**2) - real(r8), pointer :: parsha_z_patch (:,:) ! patch absorbed PAR for shaded leaves in canopy layer (W/m**2) - real(r8), pointer :: par240d_z_patch (:,:) ! 10-day running mean of daytime patch absorbed PAR for leaves in canopy layer (W/m**2) - real(r8), pointer :: par240x_z_patch (:,:) ! 10-day running mean of maximum patch absorbed PAR for leaves in canopy layer (W/m**2) - real(r8), pointer :: par24d_z_patch (:,:) ! daily accumulated absorbed PAR for leaves in canopy layer from midnight to current step(J/m**2) - real(r8), pointer :: par24x_z_patch (:,:) ! daily max of patch absorbed PAR for leaves in canopy layer from midnight to current step(W/m**2) - real(r8), pointer :: sabg_soil_patch (:) ! patch solar radiation absorbed by soil (W/m**2) - real(r8), pointer :: sabg_snow_patch (:) ! patch solar radiation absorbed by snow (W/m**2) - real(r8), pointer :: sabg_patch (:) ! patch solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: sabg_chk_patch (:) ! patch fsno weighted sum (W/m**2) - real(r8), pointer :: sabg_lyr_patch (:,:) ! patch absorbed radiation in each snow layer and top soil layer (pft,lyr) [W/m2] - real(r8), pointer :: sabg_pen_patch (:) ! patch (rural) shortwave radiation penetrating top soisno layer [W/m2] - - real(r8), pointer :: sub_surf_abs_SW_patch (:) ! patch fraction of solar radiation absorbed below first snow layer - real(r8), pointer :: sabv_patch (:) ! patch solar radiation absorbed by vegetation (W/m**2) - - real(r8), pointer :: sabs_roof_dir_lun (:,:) ! lun direct solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_roof_dif_lun (:,:) ! lun diffuse solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_sunwall_dir_lun (:,:) ! lun direct solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_sunwall_dif_lun (:,:) ! lun diffuse solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dir_lun (:,:) ! lun direct solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dif_lun (:,:) ! lun diffuse solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_improad_dir_lun (:,:) ! lun direct solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_improad_dif_lun (:,:) ! lun diffuse solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dir_lun (:,:) ! lun direct solar absorbed by pervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dif_lun (:,:) ! lun diffuse solar absorbed by pervious road per unit ground area per unit incident flux - - ! Currently needed by lake code - ! TODO (MV 8/20/2014) should be moved in the future - real(r8), pointer :: fsds_nir_d_patch (:) ! patch incident direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_i_patch (:) ! patch incident diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_d_ln_patch (:) ! patch incident direct beam nir solar radiation at local noon (W/m**2) - real(r8), pointer :: fsr_nir_d_patch (:) ! patch reflected direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_i_patch (:) ! patch reflected diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_d_ln_patch (:) ! patch reflected direct beam nir solar radiation at local noon (W/m**2) - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: Restart - - end type solarabs_type - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevcan, nlevcan, numrad, nlevsno - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begl = bounds%begl; endl = bounds%endl - - allocate(this%fsa_patch (begp:endp)) ; this%fsa_patch (:) = nan - allocate(this%fsa_u_patch (begp:endp)) ; this%fsa_u_patch (:) = nan - allocate(this%fsa_r_patch (begp:endp)) ; this%fsa_r_patch (:) = nan - allocate(this%parsun_z_patch (begp:endp,1:nlevcan)) ; this%parsun_z_patch (:,:) = nan - allocate(this%parsha_z_patch (begp:endp,1:nlevcan)) ; this%parsha_z_patch (:,:) = nan - if(use_luna)then - allocate(this%par240d_z_patch (begp:endp,1:nlevcan)) ; this%par240d_z_patch (:,:) = spval - allocate(this%par240x_z_patch (begp:endp,1:nlevcan)) ; this%par240x_z_patch (:,:) = spval - allocate(this%par24d_z_patch (begp:endp,1:nlevcan)) ; this%par24d_z_patch (:,:) = spval - allocate(this%par24x_z_patch (begp:endp,1:nlevcan)) ; this%par24x_z_patch (:,:) = spval - endif - allocate(this%sabv_patch (begp:endp)) ; this%sabv_patch (:) = nan - allocate(this%sabg_patch (begp:endp)) ; this%sabg_patch (:) = nan - allocate(this%sabg_lyr_patch (begp:endp,-nlevsno+1:1)) ; this%sabg_lyr_patch (:,:) = nan - allocate(this%sabg_pen_patch (begp:endp)) ; this%sabg_pen_patch (:) = nan - allocate(this%sabg_soil_patch (begp:endp)) ; this%sabg_soil_patch (:) = nan - allocate(this%sabg_snow_patch (begp:endp)) ; this%sabg_snow_patch (:) = nan - allocate(this%sabg_chk_patch (begp:endp)) ; this%sabg_chk_patch (:) = nan - allocate(this%sabs_roof_dir_lun (begl:endl,1:numrad)) ; this%sabs_roof_dir_lun (:,:) = nan - allocate(this%sabs_roof_dif_lun (begl:endl,1:numrad)) ; this%sabs_roof_dif_lun (:,:) = nan - allocate(this%sabs_sunwall_dir_lun (begl:endl,1:numrad)) ; this%sabs_sunwall_dir_lun (:,:) = nan - allocate(this%sabs_sunwall_dif_lun (begl:endl,1:numrad)) ; this%sabs_sunwall_dif_lun (:,:) = nan - allocate(this%sabs_shadewall_dir_lun (begl:endl,1:numrad)) ; this%sabs_shadewall_dir_lun (:,:) = nan - allocate(this%sabs_shadewall_dif_lun (begl:endl,1:numrad)) ; this%sabs_shadewall_dif_lun (:,:) = nan - allocate(this%sabs_improad_dir_lun (begl:endl,1:numrad)) ; this%sabs_improad_dir_lun (:,:) = nan - allocate(this%sabs_improad_dif_lun (begl:endl,1:numrad)) ; this%sabs_improad_dif_lun (:,:) = nan - allocate(this%sabs_perroad_dir_lun (begl:endl,1:numrad)) ; this%sabs_perroad_dir_lun (:,:) = nan - allocate(this%sabs_perroad_dif_lun (begl:endl,1:numrad)) ; this%sabs_perroad_dif_lun (:,:) = nan - allocate(this%sub_surf_abs_SW_patch (begp:endp)) ; this%sub_surf_abs_SW_patch (:) = nan - allocate(this%fsr_patch (begp:endp)) ; this%fsr_patch (:) = nan - allocate(this%fsr_nir_d_patch (begp:endp)) ; this%fsr_nir_d_patch (:) = nan - allocate(this%fsr_nir_i_patch (begp:endp)) ; this%fsr_nir_i_patch (:) = nan - allocate(this%fsr_nir_d_ln_patch (begp:endp)) ; this%fsr_nir_d_ln_patch (:) = nan - allocate(this%fsds_nir_d_patch (begp:endp)) ; this%fsds_nir_d_patch (:) = nan - allocate(this%fsds_nir_i_patch (begp:endp)) ; this%fsds_nir_i_patch (:) = nan - allocate(this%fsds_nir_d_ln_patch (begp:endp)) ; this%fsds_nir_d_ln_patch (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_snicar_frc - use clm_varpar , only : nlevsno - use histFileMod , only : hist_addfld1d, hist_addfld2d - use histFileMod , only : no_snow_normal - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr_1d(:) ! pointer to 1d patch array - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - this%fsa_patch(begp:endp) = spval - call hist_addfld1d (fname='FSA', units='W/m^2', & - avgflag='A', long_name='absorbed solar radiation', & - ptr_patch=this%fsa_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSA_ICE', units='W/m^2', & - avgflag='A', long_name='absorbed solar radiation (ice landunits only)', & - ptr_patch=this%fsa_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%fsa_r_patch(begp:endp) = spval - call hist_addfld1d (fname='FSA_R', units='W/m^2', & - avgflag='A', long_name='Rural absorbed solar radiation', & - ptr_patch=this%fsa_r_patch, set_spec=spval, default='inactive') - - this%fsa_u_patch(begp:endp) = spval - call hist_addfld1d (fname='FSA_U', units='W/m^2', & - avgflag='A', long_name='Urban absorbed solar radiation', & - ptr_patch=this%fsa_u_patch, c2l_scale_type='urbanf', set_nourb=spval, default='inactive') - - this%fsr_patch(begp:endp) = spval - call hist_addfld1d (fname='FSR', units='W/m^2', & - avgflag='A', long_name='reflected solar radiation', & - ptr_patch=this%fsr_patch, c2l_scale_type='urbanf') - ! Rename of FSR for Urban intercomparision project - call hist_addfld1d (fname='SWup', units='W/m^2', & - avgflag='A', long_name='upwelling shortwave radiation', & - ptr_patch=this%fsr_patch, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FSR_ICE', units='W/m^2', & - avgflag='A', long_name='reflected solar radiation (ice landunits only)', & - ptr_patch=this%fsr_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%sabg_lyr_patch(begp:endp,-nlevsno+1:0) = spval - data2dptr => this%sabg_lyr_patch(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_ABS', units='W/m^2', type2d='levsno', & - avgflag='A', long_name='Absorbed solar radiation in each snow layer', & - ptr_patch=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_ABS_ICE', units='W/m^2', type2d='levsno', & - avgflag='A', long_name='Absorbed solar radiation in each snow layer (ice landunits only)', & - ptr_patch=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%sabv_patch(begp:endp) = spval - call hist_addfld1d (fname='SABV', units='W/m^2', & - avgflag='A', long_name='solar rad absorbed by veg', & - ptr_patch=this%sabv_patch, c2l_scale_type='urbanf') - - this%sabg_patch(begp:endp) = spval - call hist_addfld1d (fname='SABG', units='W/m^2', & - avgflag='A', long_name='solar rad absorbed by ground', & - ptr_patch=this%sabg_patch, c2l_scale_type='urbanf') - - this%sabg_pen_patch(begp:endp) = spval - call hist_addfld1d (fname='SABG_PEN', units='watt/m^2', & - avgflag='A', long_name='Rural solar rad penetrating top soil or snow layer', & - ptr_patch=this%sabg_pen_patch, set_spec=spval) - - ! Currently needed by lake code - TODO should not be here - this%fsds_nir_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSND', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation', & - ptr_patch=this%fsds_nir_d_patch) - - this%fsds_nir_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir incident solar radiation', & - ptr_patch=this%fsds_nir_i_patch) - - this%fsds_nir_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSNDLN', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation at local noon', & - ptr_patch=this%fsds_nir_d_ln_patch) - - this%fsr_nir_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRND', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation', & - ptr_patch=this%fsr_nir_d_patch, c2l_scale_type='urbanf') - - this%fsr_nir_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir reflected solar radiation', & - ptr_patch=this%fsr_nir_i_patch, c2l_scale_type='urbanf') - - this%fsr_nir_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRNDLN', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation at local noon', & - ptr_patch=this%fsr_nir_d_ln_patch, c2l_scale_type='urbanf') - - this%sub_surf_abs_SW_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOINTABS', units='-', & - avgflag='A', long_name='Fraction of incoming solar absorbed by lower snow layers', & - ptr_patch=this%sub_surf_abs_SW_patch, set_lake=spval, set_urb=spval) - - if(use_luna)then - ptr_1d => this%par240d_z_patch(:,1) - call hist_addfld1d (fname='PAR240DZ', units='W/m^2', & - avgflag='A', long_name='10-day running mean of daytime patch absorbed PAR for leaves for top canopy layer', & - ptr_patch=ptr_1d, default='inactive') - ptr_1d => this%par240x_z_patch(:,1) - call hist_addfld1d (fname='PAR240XZ', units='W/m^2', & - avgflag='A', long_name='10-day running mean of maximum patch absorbed PAR for leaves for top canopy layer', & - ptr_patch=ptr_1d, default='inactive') - - endif - - end subroutine InitHistory - - !------------------------------------------------------------------------ - subroutine InitCold(this, bounds) - ! - ! Initialize module surface albedos to reasonable values - ! - use landunit_varcon, only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begl, endl - !----------------------------------------------------------------------- - - begl = bounds%begl; endl = bounds%endl - - this%sabs_roof_dir_lun (begl:endl, :) = 0._r8 - this%sabs_roof_dif_lun (begl:endl, :) = 0._r8 - this%sabs_sunwall_dir_lun (begl:endl, :) = 0._r8 - this%sabs_sunwall_dif_lun (begl:endl, :) = 0._r8 - this%sabs_shadewall_dir_lun (begl:endl, :) = 0._r8 - this%sabs_shadewall_dif_lun (begl:endl, :) = 0._r8 - this%sabs_improad_dir_lun (begl:endl, :) = 0._r8 - this%sabs_improad_dif_lun (begl:endl, :) = 0._r8 - this%sabs_perroad_dir_lun (begl:endl, :) = 0._r8 - this%sabs_perroad_dif_lun (begl:endl, :) = 0._r8 - - end subroutine InitCold - - !--------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use shr_infnan_mod , only : shr_infnan_isnan - use clm_varctl , only : use_snicar_frc, iulog - use spmdMod , only : masterproc - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(solarabs_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - logical :: readvar ! determine if variable is on initial file - integer :: p - !--------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='sabs_roof_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by roof per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_roof_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_roof_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by roof per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_roof_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_sunwall_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by sunwall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_sunwall_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_sunwall_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by sunwall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_sunwall_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_shadewall_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by shadewall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_shadewall_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_shadewall_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by shadewall per unit wall area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_shadewall_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_improad_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by impervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_improad_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_improad_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by impervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_improad_dif_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_perroad_dir', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by pervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_perroad_dir_lun) - - call restartvar(ncid=ncid, flag=flag, varname='sabs_perroad_dif', xtype=ncd_double, dim1name='landunit', & - dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by pervious road per unit ground area per unit incident flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%sabs_perroad_dif_lun) - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='par240d', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='10-day running mean of daytime absorbed PAR for leaves in canopy layer', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par240d_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='par24d', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Accumulative daytime absorbed PAR for leaves in canopy layer for 24 hours', units='J/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par24d_z_patch ) - - call restartvar(ncid=ncid, flag=flag, varname='par240x', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='10-day running mean of maximum absorbed PAR for leaves in canopy layers', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par240x_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='par24x', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Maximum absorbed PAR for leaves in canopy layer in 24 hours', units='J/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%par24x_z_patch ) - - call restartvar(ncid=ncid, flag=flag, varname='parsun', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Instaneous absorbed PAR for sunlit leaves in canopy layer', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%parsun_z_patch ) - call restartvar(ncid=ncid, flag=flag, varname='parsha', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='Instaneous absorbed PAR for shaded leaves in canopy layer', units='W/m**2 leaf', & - interpinic_flag='interp', readvar=readvar, data=this%parsha_z_patch ) - - endif - - end subroutine Restart - -end module SolarAbsorbedType diff --git a/src/biogeophys/SurfaceAlbedoMod.F90 b/src/biogeophys/SurfaceAlbedoMod.F90 deleted file mode 100644 index 9ad3229543..0000000000 --- a/src/biogeophys/SurfaceAlbedoMod.F90 +++ /dev/null @@ -1,1602 +0,0 @@ -module SurfaceAlbedoMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Performs surface albedo calculations - ! - ! !PUBLIC TYPES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use landunit_varcon , only : istsoil, istcrop, istdlak - use clm_varcon , only : grlnd, namep - use clm_varpar , only : numrad, nlevcan, nlevsno, nlevcan - use clm_varctl , only : fsurdat, iulog, use_snicar_frc - use pftconMod , only : pftcon - use SnowSnicarMod , only : sno_nbr_aer, SNICAR_RT, DO_SNO_AER, DO_SNO_OC - use AerosolMod , only : aerosol_type - use CanopyStateType , only : canopystate_type - use LakeStateType , only : lakestate_type - use SurfaceAlbedoType , only : surfalb_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - - use CanopyHydrologyMod, only : IsSnowvegFlagOn, IsSnowvegFlagOnRad - ! - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SurfaceAlbedoInitTimeConst - public :: SurfaceAlbedo ! Surface albedo and two-stream fluxes - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: SoilAlbedo ! Determine ground surface albedo - private :: TwoStream ! Two-stream fluxes for canopy radiative transfer - ! - ! !PUBLIC DATA MEMBERS: - ! The CLM default albice values are too high. - ! Full-spectral albedo for land ice is ~0.5 (Paterson, Physics of Glaciers, 1994, p. 59) - ! This is the value used in CAM3 by Pritchard et al., GRL, 35, 2008. - - ! albedo land ice by waveband (1=vis, 2=nir) - real(r8), public :: albice(numrad) = (/ 0.80_r8, 0.55_r8 /) - - ! namelist default setting for inputting alblakwi - real(r8), public :: lake_melt_icealb(numrad) = (/ 0.10_r8, 0.10_r8/) - - ! albedo frozen lakes by waveband (1=vis, 2=nir) - ! unclear what the reference is for this - real(r8), private :: alblak(numrad) = (/0.60_r8, 0.40_r8/) - - ! albedo of melting lakes due to puddling, open water, or white ice - ! From D. Mironov (2010) Boreal Env. Research - ! To revert albedo of melting lakes to the cold snow-free value, set - ! lake_melt_icealb namelist to 0.60, 0.40 like alblak above. - real(r8), private :: alblakwi(numrad) - - ! Coefficient for calculating ice "fraction" for lake surface albedo - ! From D. Mironov (2010) Boreal Env. Research - real(r8), parameter :: calb = 95.6_r8 - - ! - ! !PRIVATE DATA MEMBERS: - ! Snow in vegetation canopy namelist options. - logical, private :: snowveg_onrad = .true. ! snowveg_flag = 'ON_RAD' - - ! - ! !PRIVATE DATA FUNCTIONS: - real(r8), allocatable, private :: albsat(:,:) ! wet soil albedo by color class and waveband (1=vis,2=nir) - real(r8), allocatable, private :: albdry(:,:) ! dry soil albedo by color class and waveband (1=vis,2=nir) - integer , allocatable, private :: isoicol(:) ! column soil color class - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SurfaceAlbedoInitTimeConst(bounds) - ! - ! !DESCRIPTION: - ! Initialize module time constant variables - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use fileutils , only : getfil - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_pio_openfile, ncd_pio_closefile - use spmdMod , only : masterproc - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,g ! indices - integer :: mxsoil_color ! maximum number of soil color classes - type(file_desc_t) :: ncid ! netcdf id - character(len=256) :: locfn ! local filename - integer :: ier ! error status - logical :: readvar - integer ,pointer :: soic2d (:) ! read in - soil color - !--------------------------------------------------------------------- - - ! Allocate module variable for soil color - - allocate(isoicol(bounds%begc:bounds%endc)) - - ! Determine soil color and number of soil color classes - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - call ncd_io(ncid=ncid, varname='mxsoil_color', flag='read', data=mxsoil_color, readvar=readvar) - if ( .not. readvar ) then - call endrun(msg=' ERROR: mxsoil_color NOT on surfdata file '//errMsg(sourcefile, __LINE__)) - end if - - allocate(soic2d(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='SOIL_COLOR', flag='read', data=soic2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: SOIL_COLOR NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - isoicol(c) = soic2d(g) - end do - deallocate(soic2d) - - call ncd_pio_closefile(ncid) - - ! Determine saturated and dry soil albedos for n color classes and - ! numrad wavebands (1=vis, 2=nir) - - allocate(albsat(mxsoil_color,numrad), albdry(mxsoil_color,numrad), stat=ier) - if (ier /= 0) then - write(iulog,*)'allocation error for albsat, albdry' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (masterproc) then - write(iulog,*) 'Attempting to read soil colo data .....' - end if - - if (mxsoil_color == 8) then - albsat(1:8,1) = (/0.12_r8,0.11_r8,0.10_r8,0.09_r8,0.08_r8,0.07_r8,0.06_r8,0.05_r8/) - albsat(1:8,2) = (/0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8/) - albdry(1:8,1) = (/0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8/) - albdry(1:8,2) = (/0.48_r8,0.44_r8,0.40_r8,0.36_r8,0.32_r8,0.28_r8,0.24_r8,0.20_r8/) - else if (mxsoil_color == 20) then - albsat(1:20,1) = (/0.25_r8,0.23_r8,0.21_r8,0.20_r8,0.19_r8,0.18_r8,0.17_r8,0.16_r8,& - 0.15_r8,0.14_r8,0.13_r8,0.12_r8,0.11_r8,0.10_r8,0.09_r8,0.08_r8,0.07_r8,0.06_r8,0.05_r8,0.04_r8/) - albsat(1:20,2) = (/0.50_r8,0.46_r8,0.42_r8,0.40_r8,0.38_r8,0.36_r8,0.34_r8,0.32_r8,& - 0.30_r8,0.28_r8,0.26_r8,0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8,0.08_r8/) - albdry(1:20,1) = (/0.36_r8,0.34_r8,0.32_r8,0.31_r8,0.30_r8,0.29_r8,0.28_r8,0.27_r8,& - 0.26_r8,0.25_r8,0.24_r8,0.23_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8,0.08_r8/) - albdry(1:20,2) = (/0.61_r8,0.57_r8,0.53_r8,0.51_r8,0.49_r8,0.48_r8,0.45_r8,0.43_r8,& - 0.41_r8,0.39_r8,0.37_r8,0.35_r8,0.33_r8,0.31_r8,0.29_r8,0.27_r8,0.25_r8,0.23_r8,0.21_r8,0.16_r8/) - else - write(iulog,*)'maximum color class = ',mxsoil_color,' is not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Set alblakwi - alblakwi(:) = lake_melt_icealb(:) - - end subroutine SurfaceAlbedoInitTimeConst - - !----------------------------------------------------------------------- - subroutine SurfaceAlbedo(bounds,nc, & - num_nourbanc, filter_nourbanc, & - num_nourbanp, filter_nourbanp, & - num_urbanc , filter_urbanc, & - num_urbanp , filter_urbanp, & - nextsw_cday , declinp1, & - clm_fates, & - aerosol_inst, canopystate_inst, waterstate_inst, & - lakestate_inst, temperature_inst, surfalb_inst) - ! - ! !DESCRIPTION: - ! Surface albedo and two-stream fluxes - ! Surface albedos. Also fluxes (per unit incoming direct and diffuse - ! radiation) reflected, transmitted, and absorbed by vegetation. - ! Calculate sunlit and shaded fluxes as described by - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to - ! a multi-layer canopy to calculate APAR profile - ! - ! The calling sequence is: - ! -> SurfaceAlbedo: albedos for next time step - ! -> SoilAlbedo: soil/lake/glacier/wetland albedos - ! -> SNICAR_RT: snow albedos: direct beam (SNICAR) - ! -> SNICAR_RT: snow albedos: diffuse (SNICAR) - ! -> TwoStream: absorbed, reflected, transmitted solar fluxes (vis dir,vis dif, nir dir, nir dif) - ! - ! Note that this is called with the "inactive_and_active" version of the filters, because - ! the variables computed here are needed over inactive points that might later become - ! active (due to landuse change). Thus, this routine cannot depend on variables that are - ! only computed over active points. - ! - ! !USES: - use shr_orb_mod - use clm_time_manager , only : get_nstep - use abortutils , only : endrun - use clm_varctl , only : subgridflag, use_snicar_frc, use_fates - use CLMFatesInterfaceMod, only : hlm_fates_interface_type - - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: nc ! clump index - integer , intent(in) :: num_nourbanc ! number of columns in non-urban filter - integer , intent(in) :: filter_nourbanc(:) ! column filter for non-urban points - integer , intent(in) :: num_nourbanp ! number of patches in non-urban filter - integer , intent(in) :: filter_nourbanp(:) ! patch filter for non-urban points - integer , intent(in) :: num_urbanc ! number of columns in urban filter - integer , intent(in) :: filter_urbanc(:) ! column filter for urban points - integer , intent(in) :: num_urbanp ! number of patches in urban filter - integer , intent(in) :: filter_urbanp(:) ! patch filter for rban points - real(r8) , intent(in) :: nextsw_cday ! calendar day at Greenwich (1.00, ..., days/year) - real(r8) , intent(in) :: declinp1 ! declination angle (radians) for next time step - type(hlm_fates_interface_type), intent(inout) :: clm_fates - type(aerosol_type) , intent(in) :: aerosol_inst - type(canopystate_type) , intent(in) :: canopystate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(lakestate_type) , intent(in) :: lakestate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(surfalb_type) , intent(inout) :: surfalb_inst - ! - ! !LOCAL VARIABLES: - integer :: i ! index for layers [idx] - integer :: aer ! index for sno_nbr_aer - real(r8) :: extkn ! nitrogen allocation coefficient - integer :: fp,fc,g,c,p,iv ! indices - integer :: ib ! band index - integer :: ic ! 0=unit incoming direct; 1=unit incoming diffuse - real(r8) :: dinc ! lai+sai increment for canopy layer - real(r8) :: dincmax ! maximum lai+sai increment for canopy layer - real(r8) :: dincmax_sum ! cumulative sum of maximum lai+sai increment for canopy layer - real(r8) :: laisum ! sum of canopy layer lai for error check - real(r8) :: saisum ! sum of canopy layer sai for error check - integer :: flg_slr ! flag for SNICAR (=1 if direct, =2 if diffuse) - integer :: flg_snw_ice ! flag for SNICAR (=1 when called from CLM, =2 when called from sea-ice) - integer :: num_vegsol ! number of vegetated patches where coszen>0 - integer :: num_novegsol ! number of vegetated patches where coszen>0 - integer :: filter_vegsol (bounds%endp-bounds%begp+1) ! patch filter where vegetated and coszen>0 - integer :: filter_novegsol (bounds%endp-bounds%begp+1) ! patch filter where vegetated and coszen>0 - real(r8) :: wl (bounds%begp:bounds%endp) ! fraction of LAI+SAI that is LAI - real(r8) :: ws (bounds%begp:bounds%endp) ! fraction of LAI+SAI that is SAI - real(r8) :: blai(bounds%begp:bounds%endp) ! lai buried by snow: tlai - elai - real(r8) :: bsai(bounds%begp:bounds%endp) ! sai buried by snow: tsai - esai - real(r8) :: coszen_gcell (bounds%begg:bounds%endg) ! cosine solar zenith angle for next time step (grc) - real(r8) :: coszen_patch (bounds%begp:bounds%endp) ! cosine solar zenith angle for next time step (patch) - real(r8) :: rho(bounds%begp:bounds%endp,numrad) ! leaf/stem refl weighted by fraction LAI and SAI - real(r8) :: tau(bounds%begp:bounds%endp,numrad) ! leaf/stem tran weighted by fraction LAI and SAI - real(r8) :: albsfc (bounds%begc:bounds%endc,numrad) ! albedo of surface underneath snow (col,bnd) - real(r8) :: albsnd(bounds%begc:bounds%endc,numrad) ! snow albedo (direct) - real(r8) :: albsni(bounds%begc:bounds%endc,numrad) ! snow albedo (diffuse) - real(r8) :: albsnd_pur (bounds%begc:bounds%endc,numrad) ! direct pure snow albedo (radiative forcing) - real(r8) :: albsni_pur (bounds%begc:bounds%endc,numrad) ! diffuse pure snow albedo (radiative forcing) - real(r8) :: albsnd_bc (bounds%begc:bounds%endc,numrad) ! direct snow albedo without BC (radiative forcing) - real(r8) :: albsni_bc (bounds%begc:bounds%endc,numrad) ! diffuse snow albedo without BC (radiative forcing) - real(r8) :: albsnd_oc (bounds%begc:bounds%endc,numrad) ! direct snow albedo without OC (radiative forcing) - real(r8) :: albsni_oc (bounds%begc:bounds%endc,numrad) ! diffuse snow albedo without OC (radiative forcing) - real(r8) :: albsnd_dst (bounds%begc:bounds%endc,numrad) ! direct snow albedo without dust (radiative forcing) - real(r8) :: albsni_dst (bounds%begc:bounds%endc,numrad) ! diffuse snow albedo without dust (radiative forcing) - real(r8) :: flx_absd_snw (bounds%begc:bounds%endc,-nlevsno+1:1,numrad) ! flux absorption factor for just snow (direct) [frc] - real(r8) :: flx_absi_snw (bounds%begc:bounds%endc,-nlevsno+1:1,numrad) ! flux absorption factor for just snow (diffuse) [frc] - real(r8) :: foo_snw (bounds%begc:bounds%endc,-nlevsno+1:1,numrad) ! dummy array for forcing calls - real(r8) :: h2osno_liq (bounds%begc:bounds%endc,-nlevsno+1:0) ! liquid snow content (col,lyr) [kg m-2] - real(r8) :: h2osno_ice (bounds%begc:bounds%endc,-nlevsno+1:0) ! ice content in snow (col,lyr) [kg m-2] - integer :: snw_rds_in (bounds%begc:bounds%endc,-nlevsno+1:0) ! snow grain size sent to SNICAR (col,lyr) [microns] - real(r8) :: mss_cnc_aer_in_frc_pur (bounds%begc:bounds%endc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for forcing calculation (zero) (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_frc_bc (bounds%begc:bounds%endc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for BC forcing (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_frc_oc (bounds%begc:bounds%endc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for OC forcing (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_frc_dst (bounds%begc:bounds%endc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for dust forcing (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_fdb (bounds%begc:bounds%endc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of all aerosol species for feedback calculation (col,lyr,aer) [kg kg-1] - real(r8), parameter :: mpe = 1.e-06_r8 ! prevents overflow for division by zero - integer , parameter :: nband =numrad ! number of solar radiation waveband classes - !----------------------------------------------------------------------- - - associate(& - rhol => pftcon%rhol , & ! Input: leaf reflectance: 1=vis, 2=nir - rhos => pftcon%rhos , & ! Input: stem reflectance: 1=vis, 2=nir - taul => pftcon%taul , & ! Input: leaf transmittance: 1=vis, 2=nir - taus => pftcon%taus , & ! Input: stem transmittance: 1=vis, 2=nir - - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index, no burying by snow - tsai => canopystate_inst%tsai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index, no burying by snow - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water content (col,lyr) [kg/m2] - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens content (col,lyr) [kg/m2] - snw_rds => waterstate_inst%snw_rds_col , & ! Input: [real(r8) (:,:) ] snow grain radius (col,lyr) [microns] - - mss_cnc_bcphi => aerosol_inst%mss_cnc_bcphi_col , & ! Input: [real(r8) (:,:) ] mass concentration of hydrophilic BC (col,lyr) [kg/kg] - mss_cnc_bcpho => aerosol_inst%mss_cnc_bcpho_col , & ! Input: [real(r8) (:,:) ] mass concentration of hydrophobic BC (col,lyr) [kg/kg] - mss_cnc_ocphi => aerosol_inst%mss_cnc_ocphi_col , & ! Input: [real(r8) (:,:) ] mass concentration of hydrophilic OC (col,lyr) [kg/kg] - mss_cnc_ocpho => aerosol_inst%mss_cnc_ocpho_col , & ! Input: [real(r8) (:,:) ] mass concentration of hydrophobic OC (col,lyr) [kg/kg] - mss_cnc_dst1 => aerosol_inst%mss_cnc_dst1_col , & ! Input: [real(r8) (:,:) ] mass concentration of dust aerosol species 1 (col,lyr) [kg/kg] - mss_cnc_dst2 => aerosol_inst%mss_cnc_dst2_col , & ! Input: [real(r8) (:,:) ] mass concentration of dust aerosol species 2 (col,lyr) [kg/kg] - mss_cnc_dst3 => aerosol_inst%mss_cnc_dst3_col , & ! Input: [real(r8) (:,:) ] mass concentration of dust aerosol species 3 (col,lyr) [kg/kg] - mss_cnc_dst4 => aerosol_inst%mss_cnc_dst4_col , & ! Input: [real(r8) (:,:) ] mass concentration of dust aerosol species 4 (col,lyr) [kg/kg] - - fsun_z => surfalb_inst%fsun_z_patch , & ! Output: [real(r8) (:,:) ] sunlit fraction of canopy layer - tlai_z => surfalb_inst%tlai_z_patch , & ! Output: [real(r8) (:,:) ] tlai increment for canopy layer - tsai_z => surfalb_inst%tsai_z_patch , & ! Output: [real(r8) (:,:) ] tsai increment for canopy layer - vcmaxcintsun => surfalb_inst%vcmaxcintsun_patch , & ! Output: [real(r8) (:) ] leaf to canopy scaling coefficient, sunlit leaf vcmax - vcmaxcintsha => surfalb_inst%vcmaxcintsha_patch , & ! Output: [real(r8) (:) ] leaf to canopy scaling coefficient, shaded leaf vcmax - ncan => surfalb_inst%ncan_patch , & ! Output: [integer (:) ] number of canopy layers - nrad => surfalb_inst%nrad_patch , & ! Output: [integer (:) ] number of canopy layers, above snow for radiative transfer - coszen_col => surfalb_inst%coszen_col , & ! Output: [real(r8) (:) ] cosine of solar zenith angle - albgrd => surfalb_inst%albgrd_col , & ! Output: [real(r8) (:,:) ] ground albedo (direct) - albgri => surfalb_inst%albgri_col , & ! Output: [real(r8) (:,:) ] ground albedo (diffuse) - albsod => surfalb_inst%albsod_col , & ! Output: [real(r8) (:,:) ] direct-beam soil albedo (col,bnd) [frc] - albsoi => surfalb_inst%albsoi_col , & ! Output: [real(r8) (:,:) ] diffuse soil albedo (col,bnd) [frc] - albgrd_pur => surfalb_inst%albgrd_pur_col , & ! Output: [real(r8) (:,:) ] pure snow ground albedo (direct) - albgri_pur => surfalb_inst%albgri_pur_col , & ! Output: [real(r8) (:,:) ] pure snow ground albedo (diffuse) - albgrd_bc => surfalb_inst%albgrd_bc_col , & ! Output: [real(r8) (:,:) ] ground albedo without BC (direct) - albgri_bc => surfalb_inst%albgri_bc_col , & ! Output: [real(r8) (:,:) ] ground albedo without BC (diffuse) - albgrd_oc => surfalb_inst%albgrd_oc_col , & ! Output: [real(r8) (:,:) ] ground albedo without OC (direct) - albgri_oc => surfalb_inst%albgri_oc_col , & ! Output: [real(r8) (:,:) ] ground albedo without OC (diffuse) - albgrd_dst => surfalb_inst%albgrd_dst_col , & ! Output: [real(r8) (:,:) ] ground albedo without dust (direct) - albgri_dst => surfalb_inst%albgri_dst_col , & ! Output: [real(r8) (:,:) ] ground albedo without dust (diffuse) - albsnd_hst => surfalb_inst%albsnd_hst_col , & ! Output: [real(r8) (:,:) ] snow albedo, direct, for history files (col,bnd) [frc] - albsni_hst => surfalb_inst%albsni_hst_col , & ! Output: [real(r8) (:,:) ] snow ground albedo, diffuse, for history files (col,bnd) [frc] - albd => surfalb_inst%albd_patch , & ! Output: [real(r8) (:,:) ] surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Output: [real(r8) (:,:) ] surface albedo (diffuse) - fabd => surfalb_inst%fabd_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by canopy per unit direct flux - fabd_sun => surfalb_inst%fabd_sun_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit direct flux - fabd_sha => surfalb_inst%fabd_sha_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit direct flux - fabi => surfalb_inst%fabi_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by canopy per unit diffuse flux - fabi_sun => surfalb_inst%fabi_sun_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit diffuse flux - fabi_sha => surfalb_inst%fabi_sha_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit diffuse flux - ftdd => surfalb_inst%ftdd_patch , & ! Output: [real(r8) (:,:) ] down direct flux below canopy per unit direct flux - ftid => surfalb_inst%ftid_patch , & ! Output: [real(r8) (:,:) ] down diffuse flux below canopy per unit direct flux - ftii => surfalb_inst%ftii_patch , & ! Output: [real(r8) (:,:) ] down diffuse flux below canopy per unit diffuse flux - flx_absdv => surfalb_inst%flx_absdv_col , & ! Output: [real(r8) (:,:) ] direct flux absorption factor (col,lyr): VIS [frc] - flx_absdn => surfalb_inst%flx_absdn_col , & ! Output: [real(r8) (:,:) ] direct flux absorption factor (col,lyr): NIR [frc] - flx_absiv => surfalb_inst%flx_absiv_col , & ! Output: [real(r8) (:,:) ] diffuse flux absorption factor (col,lyr): VIS [frc] - flx_absin => surfalb_inst%flx_absin_col , & ! Output: [real(r8) (:,:) ] diffuse flux absorption factor (col,lyr): NIR [frc] - fabd_sun_z => surfalb_inst%fabd_sun_z_patch , & ! Output: [real(r8) (:,:) ] absorbed sunlit leaf direct PAR (per unit lai+sai) for each canopy layer - fabd_sha_z => surfalb_inst%fabd_sha_z_patch , & ! Output: [real(r8) (:,:) ] absorbed shaded leaf direct PAR (per unit lai+sai) for each canopy layer - fabi_sun_z => surfalb_inst%fabi_sun_z_patch , & ! Output: [real(r8) (:,:) ] absorbed sunlit leaf diffuse PAR (per unit lai+sai) for each canopy layer - fabi_sha_z => surfalb_inst%fabi_sha_z_patch & ! Output: [real(r8) (:,:) ] absorbed shaded leaf diffuse PAR (per unit lai+sai) for each canopy layer - ) - - ! Cosine solar zenith angle for next time step - - do g = bounds%begg,bounds%endg - coszen_gcell(g) = shr_orb_cosz (nextsw_cday, grc%lat(g), grc%lon(g), declinp1) - end do - do c = bounds%begc,bounds%endc - g = col%gridcell(c) - coszen_col(c) = coszen_gcell(g) - end do - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - g = patch%gridcell(p) - coszen_patch(p) = coszen_gcell(g) - end do - - ! Initialize output because solar radiation only done if coszen > 0 - - do ib = 1, numrad - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - albsod(c,ib) = 0._r8 - albsoi(c,ib) = 0._r8 - albgrd(c,ib) = 0._r8 - albgri(c,ib) = 0._r8 - albgrd_pur(c,ib) = 0._r8 - albgri_pur(c,ib) = 0._r8 - albgrd_bc(c,ib) = 0._r8 - albgri_bc(c,ib) = 0._r8 - albgrd_oc(c,ib) = 0._r8 - albgri_oc(c,ib) = 0._r8 - albgrd_dst(c,ib) = 0._r8 - albgri_dst(c,ib) = 0._r8 - do i=-nlevsno+1,1,1 - flx_absdv(c,i) = 0._r8 - flx_absdn(c,i) = 0._r8 - flx_absiv(c,i) = 0._r8 - flx_absin(c,i) = 0._r8 - enddo - end do - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - albd(p,ib) = 1._r8 - albi(p,ib) = 1._r8 - fabd(p,ib) = 0._r8 - fabd_sun(p,ib) = 0._r8 - fabd_sha(p,ib) = 0._r8 - fabi(p,ib) = 0._r8 - fabi_sun(p,ib) = 0._r8 - fabi_sha(p,ib) = 0._r8 - ftdd(p,ib) = 0._r8 - ftid(p,ib) = 0._r8 - ftii(p,ib) = 0._r8 - end do - - end do ! end of numrad loop - - ! SoilAlbedo called before SNICAR_RT - ! so that reflectance of soil beneath snow column is known - ! ahead of time for snow RT calculation. - - ! Snow albedos - ! Note that snow albedo routine will only compute nonzero snow albedos - ! where h2osno> 0 and coszen > 0 - - ! Ground surface albedos - ! Note that ground albedo routine will only compute nonzero snow albedos - ! where coszen > 0 - - call SoilAlbedo(bounds, & - num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - albsnd(bounds%begc:bounds%endc, :), & - albsni(bounds%begc:bounds%endc, :), & - lakestate_inst, temperature_inst, waterstate_inst, surfalb_inst) - - ! set variables to pass to SNICAR. - - flg_snw_ice = 1 ! calling from CLM, not CSIM - do c=bounds%begc,bounds%endc - albsfc(c,:) = albsoi(c,:) - h2osno_liq(c,:) = h2osoi_liq(c,-nlevsno+1:0) - h2osno_ice(c,:) = h2osoi_ice(c,-nlevsno+1:0) - snw_rds_in(c,:) = nint(snw_rds(c,:)) - end do - - ! zero aerosol input arrays - do aer = 1, sno_nbr_aer - do i = -nlevsno+1, 0 - do c = bounds%begc, bounds%endc - mss_cnc_aer_in_frc_pur(c,i,aer) = 0._r8 - mss_cnc_aer_in_frc_bc(c,i,aer) = 0._r8 - mss_cnc_aer_in_frc_oc(c,i,aer) = 0._r8 - mss_cnc_aer_in_frc_dst(c,i,aer) = 0._r8 - mss_cnc_aer_in_fdb(c,i,aer) = 0._r8 - end do - end do - end do - - ! Set aerosol input arrays - ! feedback input arrays have been zeroed - ! set soot and dust aerosol concentrations: - if (DO_SNO_AER) then - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,1) = mss_cnc_bcphi(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,2) = mss_cnc_bcpho(bounds%begc:bounds%endc,:) - - ! DO_SNO_OC is set in SNICAR_varpar. Default case is to ignore OC concentrations because: - ! 1) Knowledge of their optical properties is primitive - ! 2) When 'water-soluble' OPAC optical properties are applied to OC in snow, - ! it has a negligible darkening effect. - if (DO_SNO_OC) then - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,3) = mss_cnc_ocphi(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,4) = mss_cnc_ocpho(bounds%begc:bounds%endc,:) - endif - - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,5) = mss_cnc_dst1(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,6) = mss_cnc_dst2(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,7) = mss_cnc_dst3(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc,:,8) = mss_cnc_dst4(bounds%begc:bounds%endc,:) - endif - - ! If radiative forcing is being calculated, first estimate clean-snow albedo - - if (use_snicar_frc) then - ! 1. BC input array: - ! set dust and (optionally) OC concentrations, so BC_FRC=[(BC+OC+dust)-(OC+dust)] - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc,:,5) = mss_cnc_dst1(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc,:,6) = mss_cnc_dst2(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc,:,7) = mss_cnc_dst3(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc,:,8) = mss_cnc_dst4(bounds%begc:bounds%endc,:) - if (DO_SNO_OC) then - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc,:,3) = mss_cnc_ocphi(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc,:,4) = mss_cnc_ocpho(bounds%begc:bounds%endc,:) - endif - - ! BC FORCING CALCULATIONS - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsnd_bc(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_bc(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsni_bc(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - ! 2. OC input array: - ! set BC and dust concentrations, so OC_FRC=[(BC+OC+dust)-(BC+dust)] - if (DO_SNO_OC) then - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc,:,1) = mss_cnc_bcphi(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc,:,2) = mss_cnc_bcpho(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc,:,5) = mss_cnc_dst1(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc,:,6) = mss_cnc_dst2(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc,:,7) = mss_cnc_dst3(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc,:,8) = mss_cnc_dst4(bounds%begc:bounds%endc,:) - - ! OC FORCING CALCULATIONS - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsnd_oc(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_oc(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsni_oc(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - endif - - ! 3. DUST input array: - ! set BC and OC concentrations, so DST_FRC=[(BC+OC+dust)-(BC+OC)] - mss_cnc_aer_in_frc_dst(bounds%begc:bounds%endc,:,1) = mss_cnc_bcphi(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_dst(bounds%begc:bounds%endc,:,2) = mss_cnc_bcpho(bounds%begc:bounds%endc,:) - if (DO_SNO_OC) then - mss_cnc_aer_in_frc_dst(bounds%begc:bounds%endc,:,3) = mss_cnc_ocphi(bounds%begc:bounds%endc,:) - mss_cnc_aer_in_frc_dst(bounds%begc:bounds%endc,:,4) = mss_cnc_ocpho(bounds%begc:bounds%endc,:) - endif - - ! DUST FORCING CALCULATIONS - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_dst(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsnd_dst(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_dst(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsni_dst(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - ! 4. ALL AEROSOL FORCING CALCULATION - ! (pure snow albedo) - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_pur(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsnd_pur(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_frc_pur(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsni_pur(bounds%begc:bounds%endc, :), & - foo_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - end if - - ! CLIMATE FEEDBACK CALCULATIONS, ALL AEROSOLS: - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsnd(bounds%begc:bounds%endc, :), & - flx_absd_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, bounds, num_nourbanc, filter_nourbanc, & - coszen_col(bounds%begc:bounds%endc), & - flg_slr, & - h2osno_liq(bounds%begc:bounds%endc, :), & - h2osno_ice(bounds%begc:bounds%endc, :), & - snw_rds_in(bounds%begc:bounds%endc, :), & - mss_cnc_aer_in_fdb(bounds%begc:bounds%endc, :, :), & - albsfc(bounds%begc:bounds%endc, :), & - albsni(bounds%begc:bounds%endc, :), & - flx_absi_snw(bounds%begc:bounds%endc, :, :), & - waterstate_inst) - - ! ground albedos and snow-fraction weighting of snow absorption factors - do ib = 1, nband - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - if (coszen_col(c) > 0._r8) then - ! ground albedo was originally computed in SoilAlbedo, but is now computed here - ! because the order of SoilAlbedo and SNICAR_RT was switched for SNICAR. - albgrd(c,ib) = albsod(c,ib)*(1._r8-frac_sno(c)) + albsnd(c,ib)*frac_sno(c) - albgri(c,ib) = albsoi(c,ib)*(1._r8-frac_sno(c)) + albsni(c,ib)*frac_sno(c) - - ! albedos for radiative forcing calculations: - if (use_snicar_frc) then - ! BC forcing albedo - albgrd_bc(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_bc(c,ib)*frac_sno(c) - albgri_bc(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_bc(c,ib)*frac_sno(c) - - if (DO_SNO_OC) then - ! OC forcing albedo - albgrd_oc(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_oc(c,ib)*frac_sno(c) - albgri_oc(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_oc(c,ib)*frac_sno(c) - endif - - ! dust forcing albedo - albgrd_dst(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_dst(c,ib)*frac_sno(c) - albgri_dst(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_dst(c,ib)*frac_sno(c) - - ! pure snow albedo for all-aerosol radiative forcing - albgrd_pur(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_pur(c,ib)*frac_sno(c) - albgri_pur(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_pur(c,ib)*frac_sno(c) - end if - - ! also in this loop (but optionally in a different loop for vectorized code) - ! weight snow layer radiative absorption factors based on snow fraction and soil albedo - ! (NEEDED FOR ENERGY CONSERVATION) - do i = -nlevsno+1,1,1 - if (subgridflag == 0 .or. lun%itype(col%landunit(c)) == istdlak) then - if (ib == 1) then - flx_absdv(c,i) = flx_absd_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsod(c,ib))*(flx_absd_snw(c,i,ib)/(1.-albsnd(c,ib)))) - flx_absiv(c,i) = flx_absi_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsoi(c,ib))*(flx_absi_snw(c,i,ib)/(1.-albsni(c,ib)))) - elseif (ib == 2) then - flx_absdn(c,i) = flx_absd_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsod(c,ib))*(flx_absd_snw(c,i,ib)/(1.-albsnd(c,ib)))) - flx_absin(c,i) = flx_absi_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsoi(c,ib))*(flx_absi_snw(c,i,ib)/(1.-albsni(c,ib)))) - endif - else - if (ib == 1) then - flx_absdv(c,i) = flx_absd_snw(c,i,ib) - flx_absiv(c,i) = flx_absi_snw(c,i,ib) - elseif (ib == 2) then - flx_absdn(c,i) = flx_absd_snw(c,i,ib) - flx_absin(c,i) = flx_absi_snw(c,i,ib) - endif - endif - enddo - endif - enddo - enddo - - ! For diagnostics, set snow albedo to spval over non-snow non-urban points - ! so that it is not averaged in history buffer (OPTIONAL) - ! TODO - this is set to 0 not spval - seems wrong since it will be averaged in - - do ib = 1, nband - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - if ((coszen_col(c) > 0._r8) .and. (h2osno(c) > 0._r8)) then - albsnd_hst(c,ib) = albsnd(c,ib) - albsni_hst(c,ib) = albsni(c,ib) - else - albsnd_hst(c,ib) = 0._r8 - albsni_hst(c,ib) = 0._r8 - endif - enddo - enddo - - ! Create solar-vegetated filter for the following calculations - - num_vegsol = 0 - num_novegsol = 0 - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - if (coszen_patch(p) > 0._r8) then - if ((lun%itype(patch%landunit(p)) == istsoil .or. & - lun%itype(patch%landunit(p)) == istcrop ) & - .and. (elai(p) + esai(p)) > 0._r8) then - num_vegsol = num_vegsol + 1 - filter_vegsol(num_vegsol) = p - else - num_novegsol = num_novegsol + 1 - filter_novegsol(num_novegsol) = p - end if - end if - end do - - ! Weight reflectance/transmittance by lai and sai - ! Only perform on vegetated patches where coszen > 0 - - do fp = 1,num_vegsol - p = filter_vegsol(fp) - wl(p) = elai(p) / max( elai(p)+esai(p), mpe ) - ws(p) = esai(p) / max( elai(p)+esai(p), mpe ) - end do - - do ib = 1, numrad - do fp = 1,num_vegsol - p = filter_vegsol(fp) - rho(p,ib) = max( rhol(patch%itype(p),ib)*wl(p) + rhos(patch%itype(p),ib)*ws(p), mpe ) - tau(p,ib) = max( taul(patch%itype(p),ib)*wl(p) + taus(patch%itype(p),ib)*ws(p), mpe ) - end do - end do - - ! Diagnose number of canopy layers for radiative transfer, in increments of dincmax. - ! Add to number of layers so long as cumulative leaf+stem area does not exceed total - ! leaf+stem area. Then add any remaining leaf+stem area to next layer and exit the loop. - ! Do this first for elai and esai (not buried by snow) and then for the part of the - ! canopy that is buried by snow. - ! ------------------ - ! tlai_z = leaf area increment for a layer - ! tsai_z = stem area increment for a layer - ! nrad = number of canopy layers above snow - ! ncan = total number of canopy layers - ! - ! tlai_z summed from 1 to nrad = elai - ! tlai_z summed from 1 to ncan = tlai - - ! tsai_z summed from 1 to nrad = esai - ! tsai_z summed from 1 to ncan = tsai - ! ------------------ - ! - ! Canopy layering needs to be done for all "num_nourbanp" not "num_vegsol" - ! because layering is needed for all time steps regardless of radiation - ! - ! Sun/shade big leaf code uses only one layer (nrad = ncan = 1), triggered by - ! nlevcan = 1 - - dincmax = 0.25_r8 - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - - if (nlevcan == 1) then - nrad(p) = 1 - ncan(p) = 1 - tlai_z(p,1) = elai(p) - tsai_z(p,1) = esai(p) - else if (nlevcan > 1) then - if (elai(p)+esai(p) == 0._r8) then - nrad(p) = 0 - else - dincmax_sum = 0._r8 - do iv = 1, nlevcan - dincmax_sum = dincmax_sum + dincmax - if (((elai(p)+esai(p))-dincmax_sum) > 1.e-06_r8) then - nrad(p) = iv - dinc = dincmax - tlai_z(p,iv) = dinc * elai(p) / max(elai(p)+esai(p), mpe) - tsai_z(p,iv) = dinc * esai(p) / max(elai(p)+esai(p), mpe) - else - nrad(p) = iv - dinc = dincmax - (dincmax_sum - (elai(p)+esai(p))) - tlai_z(p,iv) = dinc * elai(p) / max(elai(p)+esai(p), mpe) - tsai_z(p,iv) = dinc * esai(p) / max(elai(p)+esai(p), mpe) - exit - end if - end do - - ! Mimumum of 4 canopy layers - - if (nrad(p) < 4) then - nrad(p) = 4 - do iv = 1, nrad(p) - tlai_z(p,iv) = elai(p) / nrad(p) - tsai_z(p,iv) = esai(p) / nrad(p) - end do - end if - end if - end if - - ! Error check: make sure cumulative of increments does not exceed total - - laisum = 0._r8 - saisum = 0._r8 - do iv = 1, nrad(p) - laisum = laisum + tlai_z(p,iv) - saisum = saisum + tsai_z(p,iv) - end do - if (abs(laisum-elai(p)) > 1.e-06_r8 .or. abs(saisum-esai(p)) > 1.e-06_r8) then - write (iulog,*) 'multi-layer canopy error 01 in SurfaceAlbedo: ',& - nrad(p),elai(p),laisum,esai(p),saisum - call endrun(decomp_index=p, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - - ! Repeat to find canopy layers buried by snow - - if (nlevcan > 1) then - blai(p) = tlai(p) - elai(p) - bsai(p) = tsai(p) - esai(p) - if (blai(p)+bsai(p) == 0._r8) then - ncan(p) = nrad(p) - else - dincmax_sum = 0._r8 - do iv = nrad(p)+1, nlevcan - dincmax_sum = dincmax_sum + dincmax - if (((blai(p)+bsai(p))-dincmax_sum) > 1.e-06_r8) then - ncan(p) = iv - dinc = dincmax - tlai_z(p,iv) = dinc * blai(p) / max(blai(p)+bsai(p), mpe) - tsai_z(p,iv) = dinc * bsai(p) / max(blai(p)+bsai(p), mpe) - else - ncan(p) = iv - dinc = dincmax - (dincmax_sum - (blai(p)+bsai(p))) - tlai_z(p,iv) = dinc * blai(p) / max(blai(p)+bsai(p), mpe) - tsai_z(p,iv) = dinc * bsai(p) / max(blai(p)+bsai(p), mpe) - exit - end if - end do - end if - - ! Error check: make sure cumulative of increments does not exceed total - - laisum = 0._r8 - saisum = 0._r8 - do iv = 1, ncan(p) - laisum = laisum + tlai_z(p,iv) - saisum = saisum + tsai_z(p,iv) - end do - if (abs(laisum-tlai(p)) > 1.e-06_r8 .or. abs(saisum-tsai(p)) > 1.e-06_r8) then - write (iulog,*) 'multi-layer canopy error 02 in SurfaceAlbedo: ',nrad(p),ncan(p) - write (iulog,*) tlai(p),elai(p),blai(p),laisum,tsai(p),esai(p),bsai(p),saisum - call endrun(decomp_index=p, clmlevel=namep, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - end do - - ! Zero fluxes for active canopy layers - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - do iv = 1, nrad(p) - fabd_sun_z(p,iv) = 0._r8 - fabd_sha_z(p,iv) = 0._r8 - fabi_sun_z(p,iv) = 0._r8 - fabi_sha_z(p,iv) = 0._r8 - fsun_z(p,iv) = 0._r8 - end do - end do - - ! Default leaf to canopy scaling coefficients, used when coszen <= 0. - ! This is the leaf nitrogen profile integrated over the full canopy. - ! Integrate exp(-kn*x) over x=0 to x=elai and assign to shaded canopy, - ! because sunlit fraction is 0. Canopy scaling coefficients are set in - ! TwoStream for coszen > 0. So kn must be set here and in TwoStream. - - extkn = 0.30_r8 - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - if (nlevcan == 1) then - vcmaxcintsun(p) = 0._r8 - vcmaxcintsha(p) = (1._r8 - exp(-extkn*elai(p))) / extkn - if (elai(p) > 0._r8) then - vcmaxcintsha(p) = vcmaxcintsha(p) / elai(p) - else - vcmaxcintsha(p) = 0._r8 - end if - else if (nlevcan > 1) then - vcmaxcintsun(p) = 0._r8 - vcmaxcintsha(p) = 0._r8 - end if - end do - - ! Calculate surface albedos and fluxes - ! Only perform on vegetated pfts where coszen > 0 - - if (use_fates) then - - call clm_fates%wrap_canopy_radiation(bounds, nc, & - num_vegsol, filter_vegsol, & - coszen_patch(bounds%begp:bounds%endp), surfalb_inst) - - else - - call TwoStream (bounds, filter_vegsol, num_vegsol, & - coszen_patch(bounds%begp:bounds%endp), & - rho(bounds%begp:bounds%endp, :), & - tau(bounds%begp:bounds%endp, :), & - canopystate_inst, temperature_inst, waterstate_inst, surfalb_inst) - - endif - - ! Determine values for non-vegetated patches where coszen > 0 - - do ib = 1,numrad - do fp = 1,num_novegsol - p = filter_novegsol(fp) - c = patch%column(p) - fabd(p,ib) = 0._r8 - fabd_sun(p,ib) = 0._r8 - fabd_sha(p,ib) = 0._r8 - fabi(p,ib) = 0._r8 - fabi_sun(p,ib) = 0._r8 - fabi_sha(p,ib) = 0._r8 - ftdd(p,ib) = 1._r8 - ftid(p,ib) = 0._r8 - ftii(p,ib) = 1._r8 - albd(p,ib) = albgrd(c,ib) - albi(p,ib) = albgri(c,ib) - end do - end do - - end associate - - end subroutine SurfaceAlbedo - - !----------------------------------------------------------------------- - subroutine SoilAlbedo (bounds, & - num_nourbanc, filter_nourbanc, & - coszen, albsnd, albsni, & - lakestate_inst, temperature_inst, waterstate_inst, surfalb_inst) - ! - ! !DESCRIPTION: - ! Determine ground surface albedo, accounting for snow - ! - ! !USES: - use clm_varpar , only : numrad - use clm_varcon , only : tfrz - use landunit_varcon , only : istice_mec, istdlak - use LakeCon , only : lakepuddling - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nourbanc ! number of columns in non-urban points in column filter - integer , intent(in) :: filter_nourbanc(:) ! column filter for non-urban points - real(r8), intent(in) :: coszen( bounds%begc: ) ! cos solar zenith angle next time step [col] - real(r8), intent(in) :: albsnd( bounds%begc: , 1: ) ! snow albedo (direct) [col, numrad] - real(r8), intent(in) :: albsni( bounds%begc: , 1: ) ! snow albedo (diffuse) [col, numrad] - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(lakestate_type) , intent(in) :: lakestate_inst - type(surfalb_type) , intent(inout) :: surfalb_inst - ! - ! !LOCAL VARIABLES: - ! - integer, parameter :: nband =numrad ! number of solar radiation waveband classes - integer :: fc ! non-urban filter column index - integer :: c,l ! indices - integer :: ib ! waveband number (1=vis, 2=nir) - real(r8) :: inc ! soil water correction factor for soil albedo - integer :: soilcol ! soilcolor - real(r8) :: sicefr ! Lake surface ice fraction (based on D. Mironov 2010) - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(coszen) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albsnd) == (/bounds%endc, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albsni) == (/bounds%endc, numrad/)), errMsg(sourcefile, __LINE__)) - - associate(& - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (Kelvin) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water [m3/m3] - - lake_icefrac => lakestate_inst%lake_icefrac_col , & ! Input: [real(r8) (:,:) ] mass fraction of lake layer that is frozen - - albgrd => surfalb_inst%albgrd_col , & ! Output: [real(r8) (:,:) ] ground albedo (direct) - albgri => surfalb_inst%albgri_col , & ! Output: [real(r8) (:,:) ] ground albedo (diffuse) - albsod => surfalb_inst%albsod_col , & ! Output: [real(r8) (:,:) ] soil albedo (direct) - albsoi => surfalb_inst%albsoi_col & ! Output: [real(r8) (:,:) ] soil albedo (diffuse) - ) - - ! Compute soil albedos - - do ib = 1, nband - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - if (coszen(c) > 0._r8) then - l = col%landunit(c) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then ! soil - inc = max(0.11_r8-0.40_r8*h2osoi_vol(c,1), 0._r8) - soilcol = isoicol(c) - ! changed from local variable to clm_type: - !albsod = min(albsat(soilcol,ib)+inc, albdry(soilcol,ib)) - !albsoi = albsod - albsod(c,ib) = min(albsat(soilcol,ib)+inc, albdry(soilcol,ib)) - albsoi(c,ib) = albsod(c,ib) - else if (lun%itype(l) == istice_mec) then ! land ice - ! changed from local variable to clm_type: - !albsod = albice(ib) - !albsoi = albsod - albsod(c,ib) = albice(ib) - albsoi(c,ib) = albsod(c,ib) - ! unfrozen lake, wetland - else if (t_grnd(c) > tfrz .or. (lakepuddling .and. lun%itype(l) == istdlak .and. t_grnd(c) == tfrz .and. & - lake_icefrac(c,1) < 1._r8 .and. lake_icefrac(c,2) > 0._r8) ) then - - albsod(c,ib) = 0.05_r8/(max(0.001_r8,coszen(c)) + 0.15_r8) - ! This expression is apparently from BATS according to Yongjiu Dai. - - ! The diffuse albedo should be an average over the whole sky of an angular-dependent direct expression. - ! The expression above may have been derived to encompass both (e.g. Henderson-Sellers 1986), - ! but I'll assume it applies more appropriately to the direct form for now. - - ! ZMS: Attn EK, currently restoring this for wetlands even though it is wrong in order to try to get - ! bfb baseline comparison when no lakes are present. I'm assuming wetlands will be phased out anyway. - if (lun%itype(l) == istdlak) then - albsoi(c,ib) = 0.10_r8 - else - albsoi(c,ib) = albsod(c,ib) - end if - - else ! frozen lake, wetland - ! Introduce crude surface frozen fraction according to D. Mironov (2010) - ! Attn EK: This formulation is probably just as good for "wetlands" if they are not phased out. - ! Tenatively I'm restricting this to lakes because I haven't tested it for wetlands. But if anything - ! the albedo should be lower when melting over frozen ground than a solid frozen lake. - ! - if (lun%itype(l) == istdlak .and. .not. lakepuddling .and. snl(c) == 0) then - ! Need to reference snow layers here because t_grnd could be over snow or ice - ! but we really want the ice surface temperature with no snow - sicefr = 1._r8 - exp(-calb * (tfrz - t_grnd(c))/tfrz) - albsod(c,ib) = sicefr*alblak(ib) + (1._r8-sicefr)*max(alblakwi(ib), & - 0.05_r8/(max(0.001_r8,coszen(c)) + 0.15_r8)) - albsoi(c,ib) = sicefr*alblak(ib) + (1._r8-sicefr)*max(alblakwi(ib), 0.10_r8) - ! Make sure this is no less than the open water albedo above. - ! Setting lake_melt_icealb(:) = alblak(:) in namelist reverts the melting albedo to the cold - ! snow-free value. - else - albsod(c,ib) = alblak(ib) - albsoi(c,ib) = albsod(c,ib) - end if - end if - - ! Weighting is done in SurfaceAlbedo, after the call to SNICAR_RT - ! This had to be done, because SoilAlbedo is called before SNICAR_RT, so at - ! this point, snow albedo is not yet known. - end if - end do - end do - - end associate - end subroutine SoilAlbedo - - !----------------------------------------------------------------------- - subroutine TwoStream (bounds, & - filter_vegsol, num_vegsol, & - coszen, rho, tau, & - canopystate_inst, temperature_inst, waterstate_inst, surfalb_inst) - ! - ! !DESCRIPTION: - ! Two-stream fluxes for canopy radiative transfer - ! Use two-stream approximation of Dickinson (1983) Adv Geophysics - ! 25:305-353 and Sellers (1985) Int J Remote Sensing 6:1335-1372 - ! to calculate fluxes absorbed by vegetation, reflected by vegetation, - ! and transmitted through vegetation for unit incoming direct or diffuse - ! flux given an underlying surface with known albedo. - ! Calculate sunlit and shaded fluxes as described by - ! Bonan et al (2011) JGR, 116, doi:10.1029/2010JG001593 and extended to - ! a multi-layer canopy to calculate APAR profile - ! - ! !USES: - use clm_varpar, only : numrad, nlevcan - use clm_varcon, only : omegas, tfrz, betads, betais - use clm_varctl, only : iulog - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: filter_vegsol (:) ! filter for vegetated patches with coszen>0 - integer , intent(in) :: num_vegsol ! number of vegetated patches where coszen>0 - real(r8), intent(in) :: coszen( bounds%begp: ) ! cosine solar zenith angle for next time step [pft] - real(r8), intent(in) :: rho( bounds%begp: , 1: ) ! leaf/stem refl weighted by fraction LAI and SAI [pft, numrad] - real(r8), intent(in) :: tau( bounds%begp: , 1: ) ! leaf/stem tran weighted by fraction LAI and SAI [pft, numrad] - type(canopystate_type) , intent(in) :: canopystate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(surfalb_type) , intent(inout) :: surfalb_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,p,c,iv ! array indices - integer :: ib ! waveband number - real(r8) :: cosz ! 0.001 <= coszen <= 1.000 - real(r8) :: asu ! single scattering albedo - real(r8) :: chil(bounds%begp:bounds%endp) ! -0.4 <= xl <= 0.6 - real(r8) :: gdir(bounds%begp:bounds%endp) ! leaf projection in solar direction (0 to 1) - real(r8) :: twostext(bounds%begp:bounds%endp)! optical depth of direct beam per unit leaf area - real(r8) :: avmu(bounds%begp:bounds%endp) ! average diffuse optical depth - real(r8) :: omega(bounds%begp:bounds%endp,numrad) ! fraction of intercepted radiation that is scattered (0 to 1) - real(r8) :: omegal ! omega for leaves - real(r8) :: betai ! upscatter parameter for diffuse radiation - real(r8) :: betail ! betai for leaves - real(r8) :: betad ! upscatter parameter for direct beam radiation - real(r8) :: betadl ! betad for leaves - real(r8) :: tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9 ! temporary - real(r8) :: p1,p2,p3,p4,s1,s2,u1,u2,u3 ! temporary - real(r8) :: b,c1,d,d1,d2,f,h,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10 ! temporary - real(r8) :: phi1,phi2,sigma ! temporary - real(r8) :: temp1 ! temporary - real(r8) :: temp0 (bounds%begp:bounds%endp) ! temporary - real(r8) :: temp2(bounds%begp:bounds%endp) ! temporary - real(r8) :: t1 ! temporary - real(r8) :: a1,a2 ! parameter for sunlit/shaded leaf radiation absorption - real(r8) :: v,dv,u,du ! temporary for flux derivatives - real(r8) :: dh2,dh3,dh5,dh6,dh7,dh8,dh9,dh10 ! temporary for flux derivatives - real(r8) :: da1,da2 ! temporary for flux derivatives - real(r8) :: d_ftid,d_ftii ! ftid, ftii derivative with respect to lai+sai - real(r8) :: d_fabd,d_fabi ! fabd, fabi derivative with respect to lai+sai - real(r8) :: d_fabd_sun,d_fabd_sha ! fabd_sun, fabd_sha derivative with respect to lai+sai - real(r8) :: d_fabi_sun,d_fabi_sha ! fabi_sun, fabi_sha derivative with respect to lai+sai - real(r8) :: laisum ! cumulative lai+sai for canopy layer (at middle of layer) - real(r8) :: extkb ! direct beam extinction coefficient - real(r8) :: extkn ! nitrogen allocation coefficient - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(coszen) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(rho) == (/bounds%endp, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tau) == (/bounds%endp, numrad/)), errMsg(sourcefile, __LINE__)) - - associate(& - xl => pftcon%xl , & ! Input: ecophys const - leaf/stem orientation index - - t_veg => temperature_inst%t_veg_patch , & ! Input: [real(r8) (:) ] vegetation temperature (Kelvin) - - fwet => waterstate_inst%fwet_patch , & ! Input: [real(r8) (:) ] fraction of canopy that is wet (0 to 1) - fcansno => waterstate_inst%fcansno_patch , & ! Input: [real(r8) (:) ] fraction of canopy that is snow-covered (0 to 1) - - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - - tlai_z => surfalb_inst%tlai_z_patch , & ! Input: [real(r8) (:,:) ] tlai increment for canopy layer - tsai_z => surfalb_inst%tsai_z_patch , & ! Input: [real(r8) (:,:) ] tsai increment for canopy layer - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] number of canopy layers, above snow for radiative transfer - albgrd => surfalb_inst%albgrd_col , & ! Input: [real(r8) (:,:) ] ground albedo (direct) (column-level) - albgri => surfalb_inst%albgri_col , & ! Input: [real(r8) (:,:) ] ground albedo (diffuse)(column-level) - fsun_z => surfalb_inst%fsun_z_patch , & ! Output: [real(r8) (:,:) ] sunlit fraction of canopy layer - vcmaxcintsun => surfalb_inst%vcmaxcintsun_patch , & ! Output: [real(r8) (:) ] leaf to canopy scaling coefficient, sunlit leaf vcmax - vcmaxcintsha => surfalb_inst%vcmaxcintsha_patch , & ! Output: [real(r8) (:) ] leaf to canopy scaling coefficient, shaded leaf vcmax - fabd_sun_z => surfalb_inst%fabd_sun_z_patch , & ! Output: [real(r8) (:,:) ] absorbed sunlit leaf direct PAR (per unit lai+sai) for each canopy layer - fabd_sha_z => surfalb_inst%fabd_sha_z_patch , & ! Output: [real(r8) (:,:) ] absorbed shaded leaf direct PAR (per unit lai+sai) for each canopy layer - fabi_sun_z => surfalb_inst%fabi_sun_z_patch , & ! Output: [real(r8) (:,:) ] absorbed sunlit leaf diffuse PAR (per unit lai+sai) for each canopy layer - fabi_sha_z => surfalb_inst%fabi_sha_z_patch , & ! Output: [real(r8) (:,:) ] absorbed shaded leaf diffuse PAR (per unit lai+sai) for each canopy layer - albd => surfalb_inst%albd_patch , & ! Output: [real(r8) (:,:) ] surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Output: [real(r8) (:,:) ] surface albedo (diffuse) - fabd => surfalb_inst%fabd_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by canopy per unit direct flux - fabd_sun => surfalb_inst%fabd_sun_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit direct flux - fabd_sha => surfalb_inst%fabd_sha_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit direct flux - fabi => surfalb_inst%fabi_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by canopy per unit diffuse flux - fabi_sun => surfalb_inst%fabi_sun_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit diffuse flux - fabi_sha => surfalb_inst%fabi_sha_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit diffuse flux - ftdd => surfalb_inst%ftdd_patch , & ! Output: [real(r8) (:,:) ] down direct flux below canopy per unit direct flx - ftid => surfalb_inst%ftid_patch , & ! Output: [real(r8) (:,:) ] down diffuse flux below canopy per unit direct flx - ftii => surfalb_inst%ftii_patch & ! Output: [real(r8) (:,:) ] down diffuse flux below canopy per unit diffuse flx - ) - - ! Calculate two-stream parameters that are independent of waveband: - ! chil, gdir, twostext, avmu, and temp0 and temp2 (used for asu) - - do fp = 1,num_vegsol - p = filter_vegsol(fp) - - ! note that the following limit only acts on cosz values > 0 and less than - ! 0.001, not on values cosz = 0, since these zero have already been filtered - ! out in filter_vegsol - cosz = max(0.001_r8, coszen(p)) - - chil(p) = min( max(xl(patch%itype(p)), -0.4_r8), 0.6_r8 ) - if (abs(chil(p)) <= 0.01_r8) chil(p) = 0.01_r8 - phi1 = 0.5_r8 - 0.633_r8*chil(p) - 0.330_r8*chil(p)*chil(p) - phi2 = 0.877_r8 * (1._r8-2._r8*phi1) - gdir(p) = phi1 + phi2*cosz - twostext(p) = gdir(p)/cosz - avmu(p) = ( 1._r8 - phi1/phi2 * log((phi1+phi2)/phi1) ) / phi2 - ! Restrict this calculation of temp0. We have seen cases where small temp0 - ! can cause unrealistic single scattering albedo (asu) associated with the - ! log calculation in temp2 below, thereby eventually causing a negative soil albedo - ! See bugzilla bug 2431: http://bugs.cgd.ucar.edu/show_bug.cgi?id=2431 - temp0(p) = max(gdir(p) + phi2*cosz,1.e-6_r8) - temp1 = phi1*cosz - temp2(p) = ( 1._r8 - temp1/temp0(p) * log((temp1+temp0(p))/temp1) ) - end do - - ! Loop over all wavebands to calculate for the full canopy the scattered fluxes - ! reflected upward and transmitted downward by the canopy and the flux absorbed by the - ! canopy for a unit incoming direct beam and diffuse flux at the top of the canopy given - ! an underlying surface of known albedo. - ! - ! Output: - ! ------------------ - ! Direct beam fluxes - ! ------------------ - ! albd - Upward scattered flux above canopy (per unit direct beam flux) - ! ftid - Downward scattered flux below canopy (per unit direct beam flux) - ! ftdd - Transmitted direct beam flux below canopy (per unit direct beam flux) - ! fabd - Flux absorbed by canopy (per unit direct beam flux) - ! fabd_sun - Sunlit portion of fabd - ! fabd_sha - Shaded portion of fabd - ! fabd_sun_z - absorbed sunlit leaf direct PAR (per unit sunlit lai+sai) for each canopy layer - ! fabd_sha_z - absorbed shaded leaf direct PAR (per unit shaded lai+sai) for each canopy layer - ! ------------------ - ! Diffuse fluxes - ! ------------------ - ! albi - Upward scattered flux above canopy (per unit diffuse flux) - ! ftii - Downward scattered flux below canopy (per unit diffuse flux) - ! fabi - Flux absorbed by canopy (per unit diffuse flux) - ! fabi_sun - Sunlit portion of fabi - ! fabi_sha - Shaded portion of fabi - ! fabi_sun_z - absorbed sunlit leaf diffuse PAR (per unit sunlit lai+sai) for each canopy layer - ! fabi_sha_z - absorbed shaded leaf diffuse PAR (per unit shaded lai+sai) for each canopy layer - - ! Set status of snowveg_flag - snowveg_onrad = IsSnowvegFlagOnRad() - - do ib = 1, numrad - do fp = 1,num_vegsol - p = filter_vegsol(fp) - c = patch%column(p) - - ! Calculate two-stream parameters omega, betad, and betai. - ! Omega, betad, betai are adjusted for snow. Values for omega*betad - ! and omega*betai are calculated and then divided by the new omega - ! because the product omega*betai, omega*betad is used in solution. - ! Also, the transmittances and reflectances (tau, rho) are linear - ! weights of leaf and stem values. - - omegal = rho(p,ib) + tau(p,ib) - asu = 0.5_r8*omegal*gdir(p)/temp0(p) *temp2(p) - betadl = (1._r8+avmu(p)*twostext(p))/(omegal*avmu(p)*twostext(p))*asu - betail = 0.5_r8 * ((rho(p,ib)+tau(p,ib)) + (rho(p,ib)-tau(p,ib)) & - * ((1._r8+chil(p))/2._r8)**2) / omegal - - ! Adjust omega, betad, and betai for intercepted snow - - if (snowveg_onrad) then - tmp0 = (1._r8-fcansno(p))*omegal + fcansno(p)*omegas(ib) - tmp1 = ( (1._r8-fcansno(p))*omegal*betadl + fcansno(p)*omegas(ib)*betads ) / tmp0 - tmp2 = ( (1._r8-fcansno(p))*omegal*betail + fcansno(p)*omegas(ib)*betais ) / tmp0 - else - if (t_veg(p) > tfrz) then !no snow - tmp0 = omegal - tmp1 = betadl - tmp2 = betail - else - tmp0 = (1._r8-fwet(p))*omegal + fwet(p)*omegas(ib) - tmp1 = ( (1._r8-fwet(p))*omegal*betadl + fwet(p)*omegas(ib)*betads ) / tmp0 - tmp2 = ( (1._r8-fwet(p))*omegal*betail + fwet(p)*omegas(ib)*betais ) / tmp0 - end if - end if - - omega(p,ib) = tmp0 - betad = tmp1 - betai = tmp2 - - ! Common terms - - b = 1._r8 - omega(p,ib) + omega(p,ib)*betai - c1 = omega(p,ib)*betai - tmp0 = avmu(p)*twostext(p) - d = tmp0 * omega(p,ib)*betad - f = tmp0 * omega(p,ib)*(1._r8-betad) - tmp1 = b*b - c1*c1 - h = sqrt(tmp1) / avmu(p) - sigma = tmp0*tmp0 - tmp1 - p1 = b + avmu(p)*h - p2 = b - avmu(p)*h - p3 = b + tmp0 - p4 = b - tmp0 - - ! Absorbed, reflected, transmitted fluxes per unit incoming radiation - ! for full canopy - - t1 = min(h*(elai(p)+esai(p)), 40._r8) - s1 = exp(-t1) - t1 = min(twostext(p)*(elai(p)+esai(p)), 40._r8) - s2 = exp(-t1) - - ! Direct beam - - u1 = b - c1/albgrd(c,ib) - u2 = b - c1*albgrd(c,ib) - u3 = f + c1*albgrd(c,ib) - tmp2 = u1 - avmu(p)*h - tmp3 = u1 + avmu(p)*h - d1 = p1*tmp2/s1 - p2*tmp3*s1 - tmp4 = u2 + avmu(p)*h - tmp5 = u2 - avmu(p)*h - d2 = tmp4/s1 - tmp5*s1 - h1 = -d*p4 - c1*f - tmp6 = d - h1*p3/sigma - tmp7 = ( d - c1 - h1/sigma*(u1+tmp0) ) * s2 - h2 = ( tmp6*tmp2/s1 - p2*tmp7 ) / d1 - h3 = - ( tmp6*tmp3*s1 - p1*tmp7 ) / d1 - h4 = -f*p3 - c1*d - tmp8 = h4/sigma - tmp9 = ( u3 - tmp8*(u2-tmp0) ) * s2 - h5 = - ( tmp8*tmp4/s1 + tmp9 ) / d2 - h6 = ( tmp8*tmp5*s1 + tmp9 ) / d2 - - albd(p,ib) = h1/sigma + h2 + h3 - ftid(p,ib) = h4*s2/sigma + h5*s1 + h6/s1 - ftdd(p,ib) = s2 - fabd(p,ib) = 1._r8 - albd(p,ib) - (1._r8-albgrd(c,ib))*ftdd(p,ib) - (1._r8-albgri(c,ib))*ftid(p,ib) - - a1 = h1 / sigma * (1._r8 - s2*s2) / (2._r8 * twostext(p)) & - + h2 * (1._r8 - s2*s1) / (twostext(p) + h) & - + h3 * (1._r8 - s2/s1) / (twostext(p) - h) - - a2 = h4 / sigma * (1._r8 - s2*s2) / (2._r8 * twostext(p)) & - + h5 * (1._r8 - s2*s1) / (twostext(p) + h) & - + h6 * (1._r8 - s2/s1) / (twostext(p) - h) - - fabd_sun(p,ib) = (1._r8 - omega(p,ib)) * ( 1._r8 - s2 + 1._r8 / avmu(p) * (a1 + a2) ) - fabd_sha(p,ib) = fabd(p,ib) - fabd_sun(p,ib) - - ! Diffuse - - u1 = b - c1/albgri(c,ib) - u2 = b - c1*albgri(c,ib) - tmp2 = u1 - avmu(p)*h - tmp3 = u1 + avmu(p)*h - d1 = p1*tmp2/s1 - p2*tmp3*s1 - tmp4 = u2 + avmu(p)*h - tmp5 = u2 - avmu(p)*h - d2 = tmp4/s1 - tmp5*s1 - h7 = (c1*tmp2) / (d1*s1) - h8 = (-c1*tmp3*s1) / d1 - h9 = tmp4 / (d2*s1) - h10 = (-tmp5*s1) / d2 - - albi(p,ib) = h7 + h8 - ftii(p,ib) = h9*s1 + h10/s1 - fabi(p,ib) = 1._r8 - albi(p,ib) - (1._r8-albgri(c,ib))*ftii(p,ib) - - a1 = h7 * (1._r8 - s2*s1) / (twostext(p) + h) + h8 * (1._r8 - s2/s1) / (twostext(p) - h) - a2 = h9 * (1._r8 - s2*s1) / (twostext(p) + h) + h10 * (1._r8 - s2/s1) / (twostext(p) - h) - - fabi_sun(p,ib) = (1._r8 - omega(p,ib)) / avmu(p) * (a1 + a2) - fabi_sha(p,ib) = fabi(p,ib) - fabi_sun(p,ib) - - ! Repeat two-stream calculations for each canopy layer to calculate derivatives. - ! tlai_z and tsai_z are the leaf+stem area increment for a layer. Derivatives are - ! calculated at the center of the layer. Derivatives are needed only for the - ! visible waveband to calculate absorbed PAR (per unit lai+sai) for each canopy layer. - ! Derivatives are calculated first per unit lai+sai and then normalized for sunlit - ! or shaded fraction of canopy layer. - - ! Sun/shade big leaf code uses only one layer, with canopy integrated values from above - ! and also canopy-integrated scaling coefficients - - if (ib == 1) then - if (nlevcan == 1) then - - ! sunlit fraction of canopy - fsun_z(p,1) = (1._r8 - s2) / t1 - - ! absorbed PAR (per unit sun/shade lai+sai) - laisum = elai(p)+esai(p) - fabd_sun_z(p,1) = fabd_sun(p,ib) / (fsun_z(p,1)*laisum) - fabi_sun_z(p,1) = fabi_sun(p,ib) / (fsun_z(p,1)*laisum) - fabd_sha_z(p,1) = fabd_sha(p,ib) / ((1._r8 - fsun_z(p,1))*laisum) - fabi_sha_z(p,1) = fabi_sha(p,ib) / ((1._r8 - fsun_z(p,1))*laisum) - - ! leaf to canopy scaling coefficients - extkn = 0.30_r8 - extkb = twostext(p) - vcmaxcintsun(p) = (1._r8 - exp(-(extkn+extkb)*elai(p))) / (extkn + extkb) - vcmaxcintsha(p) = (1._r8 - exp(-extkn*elai(p))) / extkn - vcmaxcintsun(p) - if (elai(p) > 0._r8) then - vcmaxcintsun(p) = vcmaxcintsun(p) / (fsun_z(p,1)*elai(p)) - vcmaxcintsha(p) = vcmaxcintsha(p) / ((1._r8 - fsun_z(p,1))*elai(p)) - else - vcmaxcintsun(p) = 0._r8 - vcmaxcintsha(p) = 0._r8 - end if - - else if (nlevcan > 1) then - do iv = 1, nrad(p) - - ! Cumulative lai+sai at center of layer - - if (iv == 1) then - laisum = 0.5_r8 * (tlai_z(p,iv)+tsai_z(p,iv)) - else - laisum = laisum + 0.5_r8 * ((tlai_z(p,iv-1)+tsai_z(p,iv-1))+(tlai_z(p,iv)+tsai_z(p,iv))) - end if - - ! Coefficients s1 and s2 depend on cumulative lai+sai. s2 is the sunlit fraction - - t1 = min(h*laisum, 40._r8) - s1 = exp(-t1) - t1 = min(twostext(p)*laisum, 40._r8) - s2 = exp(-t1) - fsun_z(p,iv) = s2 - - ! =============== - ! Direct beam - ! =============== - - ! Coefficients h1-h6 and a1,a2 depend of cumulative lai+sai - - u1 = b - c1/albgrd(c,ib) - u2 = b - c1*albgrd(c,ib) - u3 = f + c1*albgrd(c,ib) - tmp2 = u1 - avmu(p)*h - tmp3 = u1 + avmu(p)*h - d1 = p1*tmp2/s1 - p2*tmp3*s1 - tmp4 = u2 + avmu(p)*h - tmp5 = u2 - avmu(p)*h - d2 = tmp4/s1 - tmp5*s1 - h1 = -d*p4 - c1*f - tmp6 = d - h1*p3/sigma - tmp7 = ( d - c1 - h1/sigma*(u1+tmp0) ) * s2 - h2 = ( tmp6*tmp2/s1 - p2*tmp7 ) / d1 - h3 = - ( tmp6*tmp3*s1 - p1*tmp7 ) / d1 - h4 = -f*p3 - c1*d - tmp8 = h4/sigma - tmp9 = ( u3 - tmp8*(u2-tmp0) ) * s2 - h5 = - ( tmp8*tmp4/s1 + tmp9 ) / d2 - h6 = ( tmp8*tmp5*s1 + tmp9 ) / d2 - - a1 = h1 / sigma * (1._r8 - s2*s2) / (2._r8 * twostext(p)) & - + h2 * (1._r8 - s2*s1) / (twostext(p) + h) & - + h3 * (1._r8 - s2/s1) / (twostext(p) - h) - - a2 = h4 / sigma * (1._r8 - s2*s2) / (2._r8 * twostext(p)) & - + h5 * (1._r8 - s2*s1) / (twostext(p) + h) & - + h6 * (1._r8 - s2/s1) / (twostext(p) - h) - - ! Derivatives for h2, h3, h5, h6 and a1, a2 - - v = d1 - dv = h * p1 * tmp2 / s1 + h * p2 * tmp3 * s1 - - u = tmp6 * tmp2 / s1 - p2 * tmp7 - du = h * tmp6 * tmp2 / s1 + twostext(p) * p2 * tmp7 - dh2 = (v * du - u * dv) / (v * v) - - u = -tmp6 * tmp3 * s1 + p1 * tmp7 - du = h * tmp6 * tmp3 * s1 - twostext(p) * p1 * tmp7 - dh3 = (v * du - u * dv) / (v * v) - - v = d2 - dv = h * tmp4 / s1 + h * tmp5 * s1 - - u = -h4/sigma * tmp4 / s1 - tmp9 - du = -h * h4/sigma * tmp4 / s1 + twostext(p) * tmp9 - dh5 = (v * du - u * dv) / (v * v) - - u = h4/sigma * tmp5 * s1 + tmp9 - du = -h * h4/sigma * tmp5 * s1 - twostext(p) * tmp9 - dh6 = (v * du - u * dv) / (v * v) - - da1 = h1/sigma * s2*s2 + h2 * s2*s1 + h3 * s2/s1 & - + (1._r8 - s2*s1) / (twostext(p) + h) * dh2 & - + (1._r8 - s2/s1) / (twostext(p) - h) * dh3 - da2 = h4/sigma * s2*s2 + h5 * s2*s1 + h6 * s2/s1 & - + (1._r8 - s2*s1) / (twostext(p) + h) * dh5 & - + (1._r8 - s2/s1) / (twostext(p) - h) * dh6 - - ! Flux derivatives - - d_ftid = -twostext(p)*h4/sigma*s2 - h*h5*s1 + h*h6/s1 + dh5*s1 + dh6/s1 - d_fabd = -(dh2+dh3) + (1._r8-albgrd(c,ib))*twostext(p)*s2 - (1._r8-albgri(c,ib))*d_ftid - d_fabd_sun = (1._r8 - omega(p,ib)) * (twostext(p)*s2 + 1._r8 / avmu(p) * (da1 + da2)) - d_fabd_sha = d_fabd - d_fabd_sun - - fabd_sun_z(p,iv) = max(d_fabd_sun, 0._r8) - fabd_sha_z(p,iv) = max(d_fabd_sha, 0._r8) - - ! Flux derivatives are APARsun and APARsha per unit (LAI+SAI). Need - ! to normalize derivatives by sunlit or shaded fraction to get - ! APARsun per unit (LAI+SAI)sun and APARsha per unit (LAI+SAI)sha - - fabd_sun_z(p,iv) = fabd_sun_z(p,iv) / fsun_z(p,iv) - fabd_sha_z(p,iv) = fabd_sha_z(p,iv) / (1._r8 - fsun_z(p,iv)) - - ! =============== - ! Diffuse - ! =============== - - ! Coefficients h7-h10 and a1,a2 depend of cumulative lai+sai - - u1 = b - c1/albgri(c,ib) - u2 = b - c1*albgri(c,ib) - tmp2 = u1 - avmu(p)*h - tmp3 = u1 + avmu(p)*h - d1 = p1*tmp2/s1 - p2*tmp3*s1 - tmp4 = u2 + avmu(p)*h - tmp5 = u2 - avmu(p)*h - d2 = tmp4/s1 - tmp5*s1 - h7 = (c1*tmp2) / (d1*s1) - h8 = (-c1*tmp3*s1) / d1 - h9 = tmp4 / (d2*s1) - h10 = (-tmp5*s1) / d2 - - a1 = h7 * (1._r8 - s2*s1) / (twostext(p) + h) + h8 * (1._r8 - s2/s1) / (twostext(p) - h) - a2 = h9 * (1._r8 - s2*s1) / (twostext(p) + h) + h10 * (1._r8 - s2/s1) / (twostext(p) - h) - - ! Derivatives for h7, h8, h9, h10 and a1, a2 - - v = d1 - dv = h * p1 * tmp2 / s1 + h * p2 * tmp3 * s1 - - u = c1 * tmp2 / s1 - du = h * c1 * tmp2 / s1 - dh7 = (v * du - u * dv) / (v * v) - - u = -c1 * tmp3 * s1 - du = h * c1 * tmp3 * s1 - dh8 = (v * du - u * dv) / (v * v) - - v = d2 - dv = h * tmp4 / s1 + h * tmp5 * s1 - - u = tmp4 / s1 - du = h * tmp4 / s1 - dh9 = (v * du - u * dv) / (v * v) - - u = -tmp5 * s1 - du = h * tmp5 * s1 - dh10 = (v * du - u * dv) / (v * v) - - da1 = h7*s2*s1 + h8*s2/s1 + (1._r8-s2*s1)/(twostext(p)+h)*dh7 + (1._r8-s2/s1)/(twostext(p)-h)*dh8 - da2 = h9*s2*s1 + h10*s2/s1 + (1._r8-s2*s1)/(twostext(p)+h)*dh9 + (1._r8-s2/s1)/(twostext(p)-h)*dh10 - - ! Flux derivatives - - d_ftii = -h * h9 * s1 + h * h10 / s1 + dh9 * s1 + dh10 / s1 - d_fabi = -(dh7+dh8) - (1._r8-albgri(c,ib))*d_ftii - d_fabi_sun = (1._r8 - omega(p,ib)) / avmu(p) * (da1 + da2) - d_fabi_sha = d_fabi - d_fabi_sun - - fabi_sun_z(p,iv) = max(d_fabi_sun, 0._r8) - fabi_sha_z(p,iv) = max(d_fabi_sha, 0._r8) - - ! Flux derivatives are APARsun and APARsha per unit (LAI+SAI). Need - ! to normalize derivatives by sunlit or shaded fraction to get - ! APARsun per unit (LAI+SAI)sun and APARsha per unit (LAI+SAI)sha - - fabi_sun_z(p,iv) = fabi_sun_z(p,iv) / fsun_z(p,iv) - fabi_sha_z(p,iv) = fabi_sha_z(p,iv) / (1._r8 - fsun_z(p,iv)) - - end do ! end of canopy layer loop - end if - end if - - end do ! end of pft loop - end do ! end of radiation band loop - - end associate - -end subroutine TwoStream - -end module SurfaceAlbedoMod diff --git a/src/biogeophys/SurfaceAlbedoType.F90 b/src/biogeophys/SurfaceAlbedoType.F90 deleted file mode 100644 index 1540d9f991..0000000000 --- a/src/biogeophys/SurfaceAlbedoType.F90 +++ /dev/null @@ -1,636 +0,0 @@ -module SurfaceAlbedoType - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : numrad, nlevcan, nlevsno - use abortutils , only : endrun - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC DATA MEMBERS: - type, public :: surfalb_type - - real(r8), pointer :: coszen_col (:) ! col cosine of solar zenith angle - real(r8), pointer :: albd_patch (:,:) ! patch surface albedo (direct) (numrad) - real(r8), pointer :: albi_patch (:,:) ! patch surface albedo (diffuse) (numrad) - real(r8), pointer :: albgrd_pur_col (:,:) ! col pure snow ground direct albedo (numrad) - real(r8), pointer :: albgri_pur_col (:,:) ! col pure snow ground diffuse albedo (numrad) - real(r8), pointer :: albgrd_bc_col (:,:) ! col ground direct albedo without BC (numrad) - real(r8), pointer :: albgri_bc_col (:,:) ! col ground diffuse albedo without BC (numrad) - real(r8), pointer :: albgrd_oc_col (:,:) ! col ground direct albedo without OC (numrad) - real(r8), pointer :: albgri_oc_col (:,:) ! col ground diffuse albedo without OC (numrad) - real(r8), pointer :: albgrd_dst_col (:,:) ! col ground direct albedo without dust (numrad) - real(r8), pointer :: albgri_dst_col (:,:) ! col ground diffuse albedo without dust (numrad) - real(r8), pointer :: albgrd_col (:,:) ! col ground albedo (direct) (numrad) - real(r8), pointer :: albgri_col (:,:) ! col ground albedo (diffuse) (numrad) - real(r8), pointer :: albsod_col (:,:) ! col soil albedo: direct (col,bnd) [frc] - real(r8), pointer :: albsoi_col (:,:) ! col soil albedo: diffuse (col,bnd) [frc] - real(r8), pointer :: albsnd_hst_col (:,:) ! col snow albedo, direct , for history files (col,bnd) [frc] - real(r8), pointer :: albsni_hst_col (:,:) ! col snow albedo, diffuse, for history files (col,bnd) [frc] - - real(r8), pointer :: ftdd_patch (:,:) ! patch down direct flux below canopy per unit direct flx (numrad) - real(r8), pointer :: ftid_patch (:,:) ! patch down diffuse flux below canopy per unit direct flx (numrad) - real(r8), pointer :: ftii_patch (:,:) ! patch down diffuse flux below canopy per unit diffuse flx (numrad) - real(r8), pointer :: fabd_patch (:,:) ! patch flux absorbed by canopy per unit direct flux (numrad) - real(r8), pointer :: fabd_sun_patch (:,:) ! patch flux absorbed by sunlit canopy per unit direct flux (numrad) - real(r8), pointer :: fabd_sha_patch (:,:) ! patch flux absorbed by shaded canopy per unit direct flux (numrad) - real(r8), pointer :: fabi_patch (:,:) ! patch flux absorbed by canopy per unit diffuse flux (numrad) - real(r8), pointer :: fabi_sun_patch (:,:) ! patch flux absorbed by sunlit canopy per unit diffuse flux (numrad) - real(r8), pointer :: fabi_sha_patch (:,:) ! patch flux absorbed by shaded canopy per unit diffuse flux (numrad) - real(r8), pointer :: fabd_sun_z_patch (:,:) ! patch absorbed sunlit leaf direct PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: fabd_sha_z_patch (:,:) ! patch absorbed shaded leaf direct PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: fabi_sun_z_patch (:,:) ! patch absorbed sunlit leaf diffuse PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: fabi_sha_z_patch (:,:) ! patch absorbed shaded leaf diffuse PAR (per unit lai+sai) for each canopy layer - real(r8), pointer :: flx_absdv_col (:,:) ! col absorbed flux per unit incident direct flux: VIS (col,lyr) [frc] - real(r8), pointer :: flx_absdn_col (:,:) ! col absorbed flux per unit incident direct flux: NIR (col,lyr) [frc] - real(r8), pointer :: flx_absiv_col (:,:) ! col absorbed flux per unit incident diffuse flux: VIS (col,lyr) [frc] - real(r8), pointer :: flx_absin_col (:,:) ! col absorbed flux per unit incident diffuse flux: NIR (col,lyr) [frc] - - real(r8) , pointer :: fsun_z_patch (:,:) ! patch patch sunlit fraction of canopy layer - real(r8) , pointer :: tlai_z_patch (:,:) ! patch tlai increment for canopy layer - real(r8) , pointer :: tsai_z_patch (:,:) ! patch tsai increment for canopy layer - integer , pointer :: ncan_patch (:) ! patch number of canopy layers - integer , pointer :: nrad_patch (:) ! patch number of canopy layers, above snow for radiative transfer - real(r8) , pointer :: vcmaxcintsun_patch (:) ! patch leaf to canopy scaling coefficient, sunlit leaf vcmax - real(r8) , pointer :: vcmaxcintsha_patch (:) ! patch leaf to canopy scaling coefficient, shaded leaf vcmax - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: Restart - - end type surfalb_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(surfalb_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varcon , only: spval, ispval - ! - ! !ARGUMENTS: - class(surfalb_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - allocate(this%coszen_col (begc:endc)) ; this%coszen_col (:) = nan - allocate(this%albgrd_col (begc:endc,numrad)) ; this%albgrd_col (:,:) = nan - allocate(this%albgri_col (begc:endc,numrad)) ; this%albgri_col (:,:) = nan - allocate(this%albsnd_hst_col (begc:endc,numrad)) ; this%albsnd_hst_col (:,:) = spval - allocate(this%albsni_hst_col (begc:endc,numrad)) ; this%albsni_hst_col (:,:) = spval - allocate(this%albsod_col (begc:endc,numrad)) ; this%albsod_col (:,:) = spval - allocate(this%albsoi_col (begc:endc,numrad)) ; this%albsoi_col (:,:) = spval - allocate(this%albgrd_pur_col (begc:endc,numrad)) ; this%albgrd_pur_col (:,:) = nan - allocate(this%albgri_pur_col (begc:endc,numrad)) ; this%albgri_pur_col (:,:) = nan - allocate(this%albgrd_bc_col (begc:endc,numrad)) ; this%albgrd_bc_col (:,:) = nan - allocate(this%albgri_bc_col (begc:endc,numrad)) ; this%albgri_bc_col (:,:) = nan - allocate(this%albgrd_oc_col (begc:endc,numrad)) ; this%albgrd_oc_col (:,:) = nan - allocate(this%albgri_oc_col (begc:endc,numrad)) ; this%albgri_oc_col (:,:) = nan - allocate(this%albgrd_dst_col (begc:endc,numrad)) ; this%albgrd_dst_col (:,:) = nan - allocate(this%albgri_dst_col (begc:endc,numrad)) ; this%albgri_dst_col (:,:) = nan - allocate(this%albd_patch (begp:endp,numrad)) ; this%albd_patch (:,:) = nan - allocate(this%albi_patch (begp:endp,numrad)) ; this%albi_patch (:,:) = nan - - allocate(this%ftdd_patch (begp:endp,numrad)) ; this%ftdd_patch (:,:) = nan - allocate(this%ftid_patch (begp:endp,numrad)) ; this%ftid_patch (:,:) = nan - allocate(this%ftii_patch (begp:endp,numrad)) ; this%ftii_patch (:,:) = nan - allocate(this%fabd_patch (begp:endp,numrad)) ; this%fabd_patch (:,:) = nan - allocate(this%fabd_sun_patch (begp:endp,numrad)) ; this%fabd_sun_patch (:,:) = nan - allocate(this%fabd_sha_patch (begp:endp,numrad)) ; this%fabd_sha_patch (:,:) = nan - allocate(this%fabi_patch (begp:endp,numrad)) ; this%fabi_patch (:,:) = nan - allocate(this%fabi_sun_patch (begp:endp,numrad)) ; this%fabi_sun_patch (:,:) = nan - allocate(this%fabi_sha_patch (begp:endp,numrad)) ; this%fabi_sha_patch (:,:) = nan - allocate(this%fabd_sun_z_patch (begp:endp,nlevcan)) ; this%fabd_sun_z_patch (:,:) = 0._r8 - allocate(this%fabd_sha_z_patch (begp:endp,nlevcan)) ; this%fabd_sha_z_patch (:,:) = 0._r8 - allocate(this%fabi_sun_z_patch (begp:endp,nlevcan)) ; this%fabi_sun_z_patch (:,:) = 0._r8 - allocate(this%fabi_sha_z_patch (begp:endp,nlevcan)) ; this%fabi_sha_z_patch (:,:) = 0._r8 - allocate(this%flx_absdv_col (begc:endc,-nlevsno+1:1)) ; this%flx_absdv_col (:,:) = spval - allocate(this%flx_absdn_col (begc:endc,-nlevsno+1:1)) ; this%flx_absdn_col (:,:) = spval - allocate(this%flx_absiv_col (begc:endc,-nlevsno+1:1)) ; this%flx_absiv_col (:,:) = spval - allocate(this%flx_absin_col (begc:endc,-nlevsno+1:1)) ; this%flx_absin_col (:,:) = spval - - allocate(this%fsun_z_patch (begp:endp,nlevcan)) ; this%fsun_z_patch (:,:) = 0._r8 - allocate(this%tlai_z_patch (begp:endp,nlevcan)) ; this%tlai_z_patch (:,:) = 0._r8 - allocate(this%tsai_z_patch (begp:endp,nlevcan)) ; this%tsai_z_patch (:,:) = 0._r8 - allocate(this%ncan_patch (begp:endp)) ; this%ncan_patch (:) = 0 - allocate(this%nrad_patch (begp:endp)) ; this%nrad_patch (:) = 0 - allocate(this%vcmaxcintsun_patch (begp:endp)) ; this%vcmaxcintsun_patch (:) = nan - allocate(this%vcmaxcintsha_patch (begp:endp)) ; this%vcmaxcintsha_patch (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only: nan => shr_infnan_nan, assignment(=) - use clm_varcon , only: spval - use histFileMod , only: hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(surfalb_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - this%coszen_col(begc:endc) = spval - call hist_addfld1d (fname='COSZEN', units='none', & - avgflag='A', long_name='cosine of solar zenith angle', & - ptr_col=this%coszen_col, default='inactive') - - this%albgri_col(begc:endc,:) = spval - call hist_addfld2d (fname='ALBGRD', units='proportion', type2d='numrad', & - avgflag='A', long_name='ground albedo (direct)', & - ptr_col=this%albgrd_col, default='inactive') - - this%albgri_col(begc:endc,:) = spval - call hist_addfld2d (fname='ALBGRI', units='proportion', type2d='numrad', & - avgflag='A', long_name='ground albedo (indirect)', & - ptr_col=this%albgri_col, default='inactive') - - this%albd_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ALBD', units='proportion', type2d='numrad', & - avgflag='A', long_name='surface albedo (direct)', & - ptr_patch=this%albd_patch, default='inactive', c2l_scale_type='urbanf') - - this%albi_patch(begp:endp,:) = spval - call hist_addfld2d (fname='ALBI', units='proportion', type2d='numrad', & - avgflag='A', long_name='surface albedo (indirect)', & - ptr_patch=this%albi_patch, default='inactive', c2l_scale_type='urbanf') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! Initialize module surface albedos to reasonable values - ! - ! !ARGUMENTS: - class(surfalb_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begp, endp - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%albgrd_col (begc:endc, :) = 0.2_r8 - this%albgri_col (begc:endc, :) = 0.2_r8 - this%albsod_col (begc:endc, :) = 0.2_r8 - this%albsoi_col (begc:endc, :) = 0.2_r8 - this%albsnd_hst_col (begc:endc, :) = 0.6_r8 - this%albsni_hst_col (begc:endc, :) = 0.6_r8 - this%albd_patch (begp:endp, :) = 0.2_r8 - this%albi_patch (begp:endp, :) = 0.2_r8 - - this%albgrd_pur_col (begc:endc, :) = 0.2_r8 - this%albgri_pur_col (begc:endc, :) = 0.2_r8 - this%albgrd_bc_col (begc:endc, :) = 0.2_r8 - this%albgri_bc_col (begc:endc, :) = 0.2_r8 - this%albgrd_oc_col (begc:endc, :) = 0.2_r8 - this%albgri_oc_col (begc:endc, :) = 0.2_r8 - this%albgrd_dst_col (begc:endc, :) = 0.2_r8 - this%albgri_dst_col (begc:endc, :) = 0.2_r8 - - this%fabi_patch (begp:endp, :) = 0.0_r8 - this%fabd_patch (begp:endp, :) = 0.0_r8 - this%fabi_sun_patch (begp:endp, :) = 0.0_r8 - this%fabd_sun_patch (begp:endp, :) = 0.0_r8 - this%fabd_sha_patch (begp:endp, :) = 0.0_r8 - this%fabi_sha_patch (begp:endp, :) = 0.0_r8 - this%ftdd_patch (begp:endp, :) = 1.0_r8 - this%ftid_patch (begp:endp, :) = 0.0_r8 - this%ftii_patch (begp:endp, :) = 1.0_r8 - - end subroutine InitCold - - !--------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag, & - tlai_patch, tsai_patch) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use clm_varctl , only : use_snicar_frc, iulog - use spmdMod , only : masterproc - use decompMod , only : bounds_type - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int, ncd_inqvdlen - use restUtilMod - ! - ! !ARGUMENTS: - class(surfalb_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - real(r8) , intent(in) :: tlai_patch(bounds%begp:) - real(r8) , intent(in) :: tsai_patch(bounds%begp:) - ! - ! !LOCAL VARIABLES: - logical :: readvar ! determine if variable is on initial file - integer :: iv - integer :: begp, endp - integer :: begc, endc - !--------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(tlai_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(tsai_patch) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - call restartvar(ncid=ncid, flag=flag, varname='coszen', xtype=ncd_double, & - dim1name='column', & - long_name='cosine of solar zenith angle', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%coszen_col) - - call restartvar(ncid=ncid, flag=flag, varname='albd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='surface albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='albi', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='surface albedo (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='albgrd', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_col) - - call restartvar(ncid=ncid, flag=flag, varname='albgri', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo (indirect) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsod', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='soil albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albsod_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsoi', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='soil albedo (indirect) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albsoi_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsnd_hst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='snow albedo (direct) (0 to 1)', units='proportion', & - interpinic_flag='interp', readvar=readvar, data=this%albsnd_hst_col) - - call restartvar(ncid=ncid, flag=flag, varname='albsni_hst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='snow albedo (diffuse) (0 to 1)', units='proportion', & - interpinic_flag='interp', readvar=readvar, data=this%albsni_hst_col) - - call restartvar(ncid=ncid, flag=flag, varname='tlai_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='tlai increment for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tlai_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) then - write(iulog,*) "can't find tlai_z in restart (or initial) file..." - write(iulog,*) "Initialize tlai_z to tlai/nlevcan" - end if - do iv=1,nlevcan - this%tlai_z_patch(begp:endp,iv) = tlai_patch(begp:endp) / nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='tsai_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='tsai increment for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%tsai_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) then - write(iulog,*) "can't find tsai_z in restart (or initial) file..." - write(iulog,*) "Initialize tsai_z to tsai/nlevcan" - end if - do iv=1,nlevcan - this%tsai_z_patch(begp:endp,iv) = tsai_patch(begp:endp) / nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='ncan', xtype=ncd_int, & - dim1name='pft', long_name='number of canopy layers', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ncan_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find ncan in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize ncan to nlevcan" - this%ncan_patch(begp:endp) = nlevcan - end if - - call restartvar(ncid=ncid, flag=flag, varname='nrad', xtype=ncd_int, & - dim1name='pft', long_name='number of canopy layers, above snow for radiative transfer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%nrad_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find nrad in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize nrad to nlevcan" - this%nrad_patch(begp:endp) = nlevcan - end if - - call restartvar(ncid=ncid, flag=flag, varname='fsun_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='sunlit fraction for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fsun_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fsun_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fsun_z to 0" - do iv=1,nlevcan - this%fsun_z_patch(begp:endp,iv) = 0._r8 - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='vcmaxcintsun', xtype=ncd_double, & - dim1name='pft', long_name='sunlit canopy scaling coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%vcmaxcintsun_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find vcmaxcintsun in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize vcmaxcintsun to 1" - this%vcmaxcintsun_patch(begp:endp) = 1._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='vcmaxcintsha', xtype=ncd_double, & - dim1name='pft', long_name='shaded canopy scaling coefficient', units='', & - interpinic_flag='interp', readvar=readvar, data=this%vcmaxcintsha_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find vcmaxcintsha in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize vcmaxcintsha to 1" - this%vcmaxcintsha_patch(begp:endp) = 1._r8 - end if - - if (use_snicar_frc) then - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_bc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without BC (direct) (0 to 1)', units='', & - interpinic_flag='interp',readvar=readvar, data=this%albgrd_bc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_bc in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_bc to albgrd" - this%albgrd_bc_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_bc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without BC (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_bc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_bc in initial file..." - if (masterproc) write(iulog,*) "Initialize albgri_bc to albgri" - this%albgri_bc_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_pur', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='pure snow ground albedo (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_pur_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_pur in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_pur to albgrd" - this%albgrd_pur_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_pur', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='pure snow ground albedo (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_pur_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_pur in initial file..." - if (masterproc) write(iulog,*) "Initialize albgri_pur to albgri" - this%albgri_pur_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_oc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without OC (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_oc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_oc in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_oc to albgrd" - this%albgrd_oc_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_oc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without OC (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_oc_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_oc in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgri_oc to albgri" - this%albgri_oc_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgrd_dst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without dust (direct) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgrd_dst_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_dst in initial file..." - if (masterproc) write(iulog,*) "Initialize albgrd_dst to albgrd" - this%albgrd_dst_col(begc:endc,:) = this%albgrd_col(begc:endc,:) - end if - - call restartvar(ncid=ncid, flag=flag, varname='albgri_dst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without dust (diffuse) (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%albgri_dst_col) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_dst in initial file..." - if (masterproc) write(iulog,*) "Initialize albgri_dst to albgri" - this%albgri_dst_col(begc:endc,:) = this%albgri_col(begc:endc,:) - end if - - end if ! end of if-use_snicar_frc - - ! patch type physical state variable - fabd - call restartvar(ncid=ncid, flag=flag, varname='fabd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by veg per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fabi', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by veg per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_patch) - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sun', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by sunlit leaf per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sun_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sun in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sun to fabd/2" - this%fabd_sun_patch(begp:endp,:) = this%fabd_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sha', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by shaded leaf per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sha_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sha in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sha to fabd/2" - this%fabd_sha_patch(begp:endp,:) = this%fabd_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sun', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by sunlit leaf per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sun_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sun in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sun to fabi/2" - this%fabi_sun_patch(begp:endp,:) = this%fabi_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sha', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by shaded leaf per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sha_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sha in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sha to fabi/2" - this%fabi_sha_patch(begp:endp,:) = this%fabi_patch(begp:endp,:)/2._r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sun_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed sunlit leaf direct PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sun_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sun_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sun_z to (fabd/2)/nlevcan" - do iv=1,nlevcan - this%fabd_sun_z_patch(begp:endp,iv) = (this%fabd_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabd_sha_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed shaded leaf direct PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabd_sha_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabd_sha_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabd_sha_z to (fabd/2)/nlevcan" - do iv=1,nlevcan - this%fabd_sha_z_patch(begp:endp,iv) = (this%fabd_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sun_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed sunlit leaf diffuse PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sun_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sun_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sun_z to (fabi/2)/nlevcan" - do iv=1,nlevcan - this%fabi_sun_z_patch(begp:endp,iv) = (this%fabi_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='fabi_sha_z', xtype=ncd_double, & - dim1name='pft', dim2name='levcan', switchdim=.true., & - long_name='absorbed shaded leaf diffuse PAR (per unit lai+sai) for canopy layer', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fabi_sha_z_patch) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find fabi_sha_z in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize fabi_sha_z to (fabi/2)/nlevcan" - do iv=1,nlevcan - this%fabi_sha_z_patch(begp:endp,iv) = & - (this%fabi_patch(begp:endp,1)/2._r8)/nlevcan - end do - end if - - call restartvar(ncid=ncid, flag=flag, varname='ftdd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down direct flux below veg per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ftdd_patch) - - call restartvar(ncid=ncid, flag=flag, varname='ftid', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down diffuse flux below veg per unit direct flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ftid_patch) - - call restartvar(ncid=ncid, flag=flag, varname='ftii', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down diffuse flux below veg per unit diffuse flux', units='', & - interpinic_flag='interp', readvar=readvar, data=this%ftii_patch) - - !-------------------------------- - ! variables needed for SNICAR - !-------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='flx_absdv', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (direct, VIS)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absdv_col) - - call restartvar(ncid=ncid, flag=flag, varname='flx_absdn', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (direct, NIR)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absdn_col) - - call restartvar(ncid=ncid, flag=flag, varname='flx_absiv', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (diffuse, VIS)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absiv_col) - - call restartvar(ncid=ncid, flag=flag, varname='flx_absin', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., lowerb2=-nlevsno+1, upperb2=1, & - long_name='snow layer flux absorption factors (diffuse, NIR)', units='fraction', & - interpinic_flag='interp', readvar=readvar, data=this%flx_absin_col) - - end subroutine Restart - -end module SurfaceAlbedoType diff --git a/src/biogeophys/SurfaceRadiationMod.F90 b/src/biogeophys/SurfaceRadiationMod.F90 deleted file mode 100644 index d0b56f6a27..0000000000 --- a/src/biogeophys/SurfaceRadiationMod.F90 +++ /dev/null @@ -1,953 +0,0 @@ -module SurfaceRadiationMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Calculate solar fluxes absorbed by vegetation and ground surface - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : use_snicar_frc, use_fates - use decompMod , only : bounds_type - use clm_varcon , only : namec - use atm2lndType , only : atm2lnd_type - use WaterstateType , only : waterstate_type - use CanopyStateType , only : canopystate_type - use SurfaceAlbedoType , only : surfalb_type - use SolarAbsorbedType , only : solarabs_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use landunit_varcon , only : istdlak - - ! !PRIVATE TYPES: - implicit none - private - - logical :: DEBUG = .false. ! for debugging this module - - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SurfaceRadiation ! Solar fluxes absorbed by veg and ground surface - public :: CanopySunShadeFracs ! Sun/Shade fractions and some area indices computations - - ! - ! !PRIVATE DATA: - type, public :: surfrad_type - real(r8), pointer, private :: sfc_frc_aer_patch (:) ! patch surface forcing of snow with all aerosols (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_bc_patch (:) ! patch surface forcing of snow with BC (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_oc_patch (:) ! patch surface forcing of snow with OC (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_dst_patch (:) ! patch surface forcing of snow with dust (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_aer_sno_patch (:) ! patch surface forcing of snow with all aerosols, averaged only when snow is present (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_bc_sno_patch (:) ! patch surface forcing of snow with BC, averaged only when snow is present (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_oc_sno_patch (:) ! patch surface forcing of snow with OC, averaged only when snow is present (patch) [W/m2] - real(r8), pointer, private :: sfc_frc_dst_sno_patch (:) ! patch surface forcing of snow with dust, averaged only when snow is present (patch) [W/m2] - - real(r8), pointer, private :: parveg_ln_patch (:) ! patch absorbed par by vegetation at local noon (W/m**2) - - real(r8), pointer, private :: fsr_sno_vd_patch (:) ! patch reflected direct beam vis solar radiation from snow (W/m**2) - real(r8), pointer, private :: fsr_sno_nd_patch (:) ! patch reflected direct beam NIR solar radiation from snow (W/m**2) - real(r8), pointer, private :: fsr_sno_vi_patch (:) ! patch reflected diffuse vis solar radiation from snow (W/m**2) - real(r8), pointer, private :: fsr_sno_ni_patch (:) ! patch reflected diffuse NIR solar radiation from snow (W/m**2) - - real(r8), pointer, private :: fsr_vis_d_patch (:) ! patch reflected direct beam vis solar radiation (W/m**2) - real(r8), pointer, private :: fsr_vis_i_patch (:) ! patch reflected diffuse vis solar radiation (W/m**2) - real(r8), pointer, private :: fsr_vis_d_ln_patch (:) ! patch reflected direct beam vis solar radiation at local noon (W/m**2) - - real(r8), pointer, private :: fsds_sno_vd_patch (:) ! patch incident visible, direct radiation on snow (for history files) [W/m2] - real(r8), pointer, private :: fsds_sno_nd_patch (:) ! patch incident near-IR, direct radiation on snow (for history files) [W/m2] - real(r8), pointer, private :: fsds_sno_vi_patch (:) ! patch incident visible, diffuse radiation on snow (for history files) [W/m2] - real(r8), pointer, private :: fsds_sno_ni_patch (:) ! patch incident near-IR, diffuse radiation on snow (for history files) [W/m2] - - real(r8), pointer, private :: fsds_vis_d_patch (:) ! patch incident direct beam vis solar radiation (W/m**2) - real(r8), pointer, private :: fsds_vis_i_patch (:) ! patch incident diffuse vis solar radiation (W/m**2) - real(r8), pointer, private :: fsds_vis_d_ln_patch (:) ! patch incident direct beam vis solar radiation at local noon (W/m**2) - real(r8), pointer, private :: fsds_vis_i_ln_patch (:) ! patch incident diffuse beam vis solar radiation at local noon (W/m**2) - - contains - - procedure, public :: Init - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type surfrad_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - allocate(this%sfc_frc_aer_patch (begp:endp)) ; this%sfc_frc_aer_patch (:) = nan - allocate(this%sfc_frc_bc_patch (begp:endp)) ; this%sfc_frc_bc_patch (:) = nan - allocate(this%sfc_frc_oc_patch (begp:endp)) ; this%sfc_frc_oc_patch (:) = nan - allocate(this%sfc_frc_dst_patch (begp:endp)) ; this%sfc_frc_dst_patch (:) = nan - allocate(this%sfc_frc_aer_sno_patch (begp:endp)) ; this%sfc_frc_aer_sno_patch (:) = nan - allocate(this%sfc_frc_bc_sno_patch (begp:endp)) ; this%sfc_frc_bc_sno_patch (:) = nan - allocate(this%sfc_frc_oc_sno_patch (begp:endp)) ; this%sfc_frc_oc_sno_patch (:) = nan - allocate(this%sfc_frc_dst_sno_patch (begp:endp)) ; this%sfc_frc_dst_sno_patch (:) = nan - - allocate(this%parveg_ln_patch (begp:endp)) ; this%parveg_ln_patch (:) = nan - - allocate(this%fsr_vis_d_patch (begp:endp)) ; this%fsr_vis_d_patch (:) = nan - allocate(this%fsr_vis_d_ln_patch (begp:endp)) ; this%fsr_vis_d_ln_patch (:) = nan - allocate(this%fsr_vis_i_patch (begp:endp)) ; this%fsr_vis_i_patch (:) = nan - allocate(this%fsr_sno_vd_patch (begp:endp)) ; this%fsr_sno_vd_patch (:) = nan - allocate(this%fsr_sno_nd_patch (begp:endp)) ; this%fsr_sno_nd_patch (:) = nan - allocate(this%fsr_sno_vi_patch (begp:endp)) ; this%fsr_sno_vi_patch (:) = nan - allocate(this%fsr_sno_ni_patch (begp:endp)) ; this%fsr_sno_ni_patch (:) = nan - - allocate(this%fsds_vis_d_patch (begp:endp)) ; this%fsds_vis_d_patch (:) = nan - allocate(this%fsds_vis_i_patch (begp:endp)) ; this%fsds_vis_i_patch (:) = nan - allocate(this%fsds_vis_d_ln_patch (begp:endp)) ; this%fsds_vis_d_ln_patch (:) = nan - allocate(this%fsds_vis_i_ln_patch (begp:endp)) ; this%fsds_vis_i_ln_patch (:) = nan - allocate(this%fsds_sno_vd_patch (begp:endp)) ; this%fsds_sno_vd_patch (:) = nan - allocate(this%fsds_sno_nd_patch (begp:endp)) ; this%fsds_sno_nd_patch (:) = nan - allocate(this%fsds_sno_vi_patch (begp:endp)) ; this%fsds_sno_vi_patch (:) = nan - allocate(this%fsds_sno_ni_patch (begp:endp)) ; this%fsds_sno_ni_patch (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! History fields initialization - ! - ! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : spval - use histFileMod , only : hist_addfld1d, hist_addfld2d - ! - ! !ARGUMENTS: - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - if (use_snicar_frc) then - this%sfc_frc_aer_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOAERFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of all aerosols in snow (land) ', & - ptr_patch=this%sfc_frc_aer_patch, set_urb=spval) - - this%sfc_frc_aer_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOAERFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of all aerosols in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_aer_sno_patch, set_urb=spval) - - this%sfc_frc_bc_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOBCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of BC in snow (land) ', & - ptr_patch=this%sfc_frc_bc_patch, set_urb=spval) - - this%sfc_frc_bc_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOBCFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of BC in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_bc_sno_patch, set_urb=spval) - - this%sfc_frc_oc_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOOCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow (land) ', & - ptr_patch=this%sfc_frc_oc_patch, set_urb=spval) - - this%sfc_frc_oc_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOOCFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_oc_sno_patch, set_urb=spval) - - this%sfc_frc_dst_patch(begp:endp) = spval - call hist_addfld1d (fname='SNODSTFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of dust in snow (land) ', & - ptr_patch=this%sfc_frc_dst_patch, set_urb=spval) - - this%sfc_frc_dst_sno_patch(begp:endp) = spval - call hist_addfld1d (fname='SNODSTFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of dust in snow, averaged only when snow is present (land)', & - ptr_patch=this%sfc_frc_dst_sno_patch, set_urb=spval) - end if - - this%fsds_vis_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVD', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation', & - ptr_patch=this%fsds_vis_d_patch) - - this%fsds_vis_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation', & - ptr_patch=this%fsds_vis_i_patch) - - this%fsr_vis_d_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRVD', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation', & - ptr_patch=this%fsr_vis_d_patch, c2l_scale_type='urbanf') - - this%fsr_vis_i_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis reflected solar radiation', & - ptr_patch=this%fsr_vis_i_patch, c2l_scale_type='urbanf') - - this%fsds_vis_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVDLN', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation at local noon', & - ptr_patch=this%fsds_vis_d_ln_patch) - - this%fsds_vis_i_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSDSVILN', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation at local noon', & - ptr_patch=this%fsds_vis_i_ln_patch) - - this%parveg_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='PARVEGLN', units='W/m^2', & - avgflag='A', long_name='absorbed par by vegetation at local noon', & - ptr_patch=this%parveg_ln_patch) - - this%fsr_vis_d_ln_patch(begp:endp) = spval - call hist_addfld1d (fname='FSRVDLN', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation at local noon', & - ptr_patch=this%fsr_vis_d_ln_patch, c2l_scale_type='urbanf') - - this%fsds_sno_vd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSVD', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation on snow', & - ptr_patch=this%fsds_sno_vd_patch, default='inactive') - - this%fsds_sno_nd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSND', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation on snow', & - ptr_patch=this%fsds_sno_nd_patch, default='inactive') - - this%fsds_sno_vi_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation on snow', & - ptr_patch=this%fsds_sno_vi_patch, default='inactive') - - this%fsds_sno_ni_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSDSNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir incident solar radiation on snow', & - ptr_patch=this%fsds_sno_ni_patch, default='inactive') - - this%fsr_sno_vd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRVD', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_vd_patch) - - this%fsr_sno_nd_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRND', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_nd_patch) - - this%fsr_sno_vi_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_vi_patch) - - this%fsr_sno_ni_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOFSRNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir reflected solar radiation from snow', & - ptr_patch=this%fsr_sno_ni_patch) - - - end subroutine InitHistory - - !------------------------------------------------------------------------ - subroutine InitCold(this, bounds) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(surfrad_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l - !----------------------------------------------------------------------- - - ! nothing for now - - end subroutine InitCold - - - subroutine CanopySunShadeFracs(filter_nourbanp, num_nourbanp, & - atm2lnd_inst, surfalb_inst, & - canopystate_inst, solarabs_inst) - - ! ------------------------------------------------------------------------------------ - ! This subroutine calculates and returns patch vectors of - ! - ! 1) absorbed PAR for sunlit leaves in canopy layer - ! 2) absorbed PAR for shaded leaves in canopy layer - ! 3) sunlit leaf area - ! 4) shaded leaf area - ! 5) sunlit leaf area for canopy layer - ! 6) shaded leaf area for canopy layer - ! 7) sunlit fraction of canopy - ! - ! This routine has a counterpart when the fates model is turned on. - ! CLMEDInterf_CanopySunShadeFracs() - ! If changes are applied to this routine, please take a moment to review that - ! subroutine as well and consider if any new information related to these types of - ! variables also needs to be augmented in that routine as well. - ! ------------------------------------------------------------------------------------ - - - implicit none - - ! Arguments (in) - - integer, intent(in),dimension(:) :: filter_nourbanp ! patch filter for non-urban points - integer, intent(in) :: num_nourbanp ! size of the nonurban filter - type(atm2lnd_type), intent(in) :: atm2lnd_inst - type(surfalb_type), intent(in) :: surfalb_inst - - ! Arguments (inout) - type(canopystate_type), intent(inout) :: canopystate_inst - type(solarabs_type), intent(inout) :: solarabs_inst - - ! local variables - integer :: fp ! non-urban filter patch index - integer :: p ! patch index - integer :: g ! gridcell index - integer :: iv ! canopy layer index - integer,parameter :: ipar = 1 ! The band index for PAR - - associate( tlai_z => surfalb_inst%tlai_z_patch, & ! tlai increment for canopy layer - fsun_z => surfalb_inst%fsun_z_patch, & ! sunlit fraction of canopy layer - elai => canopystate_inst%elai_patch, & ! one-sided leaf area index - forc_solad => atm2lnd_inst%forc_solad_grc, & ! direct beam radiation (W/m**2) - forc_solai => atm2lnd_inst%forc_solai_grc, & ! diffuse radiation (W/m**2) - fabd_sun_z => surfalb_inst%fabd_sun_z_patch, & ! absorbed sunlit leaf direct PAR - fabd_sha_z => surfalb_inst%fabd_sha_z_patch, & ! absorbed shaded leaf direct PAR - fabi_sun_z => surfalb_inst%fabi_sun_z_patch, & ! absorbed sunlit leaf diffuse PAR - fabi_sha_z => surfalb_inst%fabi_sha_z_patch, & ! absorbed shaded leaf diffuse PAR - nrad => surfalb_inst%nrad_patch, & ! number of canopy layers - parsun_z => solarabs_inst%parsun_z_patch, & ! absorbed PAR for sunlit leaves - parsha_z => solarabs_inst%parsha_z_patch, & ! absorbed PAR for shaded leaves - laisun => canopystate_inst%laisun_patch, & ! sunlit leaf area - laisha => canopystate_inst%laisha_patch, & ! shaded leaf area - laisun_z => canopystate_inst%laisun_z_patch, & ! sunlit leaf area for canopy layer - laisha_z => canopystate_inst%laisha_z_patch, & ! shaded leaf area for canopy layer - fsun => canopystate_inst%fsun_patch) ! sunlit fraction of canopy - - do fp = 1,num_nourbanp - - p = filter_nourbanp(fp) - - do iv = 1, nrad(p) - parsun_z(p,iv) = 0._r8 - parsha_z(p,iv) = 0._r8 - laisun_z(p,iv) = 0._r8 - laisha_z(p,iv) = 0._r8 - end do - - ! Loop over patches to calculate laisun_z and laisha_z for each layer. - ! Derive canopy laisun, laisha, and fsun from layer sums. - ! If sun/shade big leaf code, nrad=1 and fsun_z(p,1) and tlai_z(p,1) from - ! SurfaceAlbedo is canopy integrated so that layer value equals canopy value. - - laisun(p) = 0._r8 - laisha(p) = 0._r8 - do iv = 1, nrad(p) - laisun_z(p,iv) = tlai_z(p,iv) * fsun_z(p,iv) - laisha_z(p,iv) = tlai_z(p,iv) * (1._r8 - fsun_z(p,iv)) - laisun(p) = laisun(p) + laisun_z(p,iv) - laisha(p) = laisha(p) + laisha_z(p,iv) - end do - if (elai(p) > 0._r8) then - fsun(p) = laisun(p) / elai(p) - else - fsun(p) = 0._r8 - end if - - ! Absorbed PAR profile through canopy - ! If sun/shade big leaf code, nrad=1 and fluxes from SurfaceAlbedo - ! are canopy integrated so that layer values equal big leaf values. - - g = patch%gridcell(p) - - do iv = 1, nrad(p) - parsun_z(p,iv) = forc_solad(g,ipar)*fabd_sun_z(p,iv) + forc_solai(g,ipar)*fabi_sun_z(p,iv) - parsha_z(p,iv) = forc_solad(g,ipar)*fabd_sha_z(p,iv) + forc_solai(g,ipar)*fabi_sha_z(p,iv) - end do - - end do ! end of fp = 1,num_nourbanp loop - end associate - return - end subroutine CanopySunShadeFracs - - !------------------------------------------------------------------------------ - subroutine SurfaceRadiation(bounds, num_nourbanp, filter_nourbanp, & - num_urbanp, filter_urbanp, num_urbanc, filter_urbanc, & - atm2lnd_inst, waterstate_inst, canopystate_inst, & - surfalb_inst, solarabs_inst, surfrad_inst) - ! - ! !DESCRIPTION: - ! Solar fluxes absorbed by vegetation and ground surface - ! Note possible problem when land is on different grid than atmosphere. - ! Land may have sun above the horizon (coszen > 0) but atmosphere may - ! have sun below the horizon (forc_solad = 0 and forc_solai = 0). This is okay - ! because all fluxes (absorbed, reflected, transmitted) are multiplied - ! by the incoming flux and all will equal zero. - ! Atmosphere may have sun above horizon (forc_solad > 0 and forc_solai > 0) but - ! land may have sun below horizon. This is okay because fabd, fabi, - ! ftdd, ftid, and ftii all equal zero so that sabv=sabg=fsa=0. Also, - ! albd and albi equal one so that fsr=forc_solad+forc_solai. In other words, all - ! the radiation is reflected. NDVI should equal zero in this case. - ! However, the way the code is currently implemented this is only true - ! if (forc_solad+forc_solai)|vis = (forc_solad+forc_solai)|nir. - ! Output variables are parsun,parsha,sabv,sabg,fsa,fsr,ndvi - ! - ! !USES: - use clm_varpar , only : numrad, nlevsno - use clm_varcon , only : spval, degpsec, isecspday - use landunit_varcon , only : istsoil, istcrop - use clm_varctl , only : subgridflag, use_snicar_frc, iulog - use clm_time_manager , only : get_curr_date, get_step_size - use SnowSnicarMod , only : DO_SNO_OC - use abortutils , only : endrun - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nourbanp ! number of patches in non-urban points in patch filter - integer , intent(in) :: filter_nourbanp(:) ! patch filter for non-urban points - integer , intent(in) :: num_urbanp ! number of patches in non-urban points in patch filter - integer , intent(in) :: filter_urbanp(:) ! patch filter for non-urban points - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(:) ! urban column filter - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(surfrad_type) , intent(inout) :: surfrad_inst - ! - ! !LOCAL VARIABLES: - integer , parameter :: nband = numrad ! number of solar radiation waveband classes - real(r8), parameter :: mpe = 1.e-06_r8 ! prevents overflow for division by zero - integer :: fp ! non-urban filter patch index - integer :: p ! patch index - integer :: c ! column index - integer :: l ! landunit index - integer :: g ! grid cell index - integer :: ib ! waveband number (1=vis, 2=nir) - integer :: iv ! canopy layer - real(r8) :: absrad ! absorbed solar radiation (W/m**2) - integer :: i ! layer index [idx] - real(r8) :: rnir ! reflected solar radiation [nir] (W/m**2) - real(r8) :: rvis ! reflected solar radiation [vis] (W/m**2) - real(r8) :: trd(bounds%begp:bounds%endp,numrad) ! transmitted solar radiation: direct (W/m**2) - real(r8) :: tri(bounds%begp:bounds%endp,numrad) ! transmitted solar radiation: diffuse (W/m**2) - real(r8) :: cad(bounds%begp:bounds%endp,numrad) ! direct beam absorbed by canopy (W/m**2) - real(r8) :: cai(bounds%begp:bounds%endp,numrad) ! diffuse radiation absorbed by canopy (W/m**2) - integer :: local_secp1 ! seconds into current date in local time - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day,secs ! calendar info for current time step - real(r8) :: sabg_snl_sum ! temporary, absorbed energy in all active snow layers [W/m2] - real(r8) :: absrad_pur ! temp: absorbed solar radiation by pure snow [W/m2] - real(r8) :: absrad_bc ! temp: absorbed solar radiation without BC [W/m2] - real(r8) :: absrad_oc ! temp: absorbed solar radiation without OC [W/m2] - real(r8) :: absrad_dst ! temp: absorbed solar radiation without dust [W/m2] - real(r8) :: sabg_pur(bounds%begp:bounds%endp) ! solar radiation absorbed by ground with pure snow [W/m2] - real(r8) :: sabg_bc(bounds%begp:bounds%endp) ! solar radiation absorbed by ground without BC [W/m2] - real(r8) :: sabg_oc(bounds%begp:bounds%endp) ! solar radiation absorbed by ground without OC [W/m2] - real(r8) :: sabg_dst(bounds%begp:bounds%endp) ! solar radiation absorbed by ground without dust [W/m2] - real(r8) :: parveg(bounds%begp:bounds%endp) ! absorbed par by vegetation (W/m**2) - ! - integer, parameter :: noonsec = isecspday / 2 ! seconds at local noon - ! - !------------------------------------------------------------------------------ - - associate( & - snl => col%snl , & ! Input: [integer (:) ] negative number of snow layers [nbr] - - forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (W/m**2) - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse radiation (W/m**2) - - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - - nrad => surfalb_inst%nrad_patch , & ! Input: [integer (:) ] number of canopy layers, above snow for radiative transfer - coszen => surfalb_inst%coszen_col , & ! Input: [real(r8) (:) ] column cosine of solar zenith angle - albgrd => surfalb_inst%albgrd_col , & ! Input: [real(r8) (:,:) ] ground albedo (direct) - albgri => surfalb_inst%albgri_col , & ! Input: [real(r8) (:,:) ] ground albedo (diffuse) - albsod => surfalb_inst%albsod_col , & ! Input: [real(r8) (:,:) ] direct-beam soil albedo (col,bnd) [frc] - albgrd_oc => surfalb_inst%albgrd_oc_col , & ! Input: [real(r8) (:,:) ] ground albedo without OC (direct) (col,bnd) - albgri_oc => surfalb_inst%albgri_oc_col , & ! Input: [real(r8) (:,:) ] ground albedo without OC (diffuse) (col,bnd) - albgrd_dst => surfalb_inst%albgrd_dst_col , & ! Input: [real(r8) (:,:) ] ground albedo without dust (direct) (col,bnd) - albgri_dst => surfalb_inst%albgri_dst_col , & ! Input: [real(r8) (:,:) ] ground albedo without dust (diffuse) (col,bnd) - albsnd_hst => surfalb_inst%albsnd_hst_col , & ! Input: [real(r8) (:,:) ] snow albedo, direct, for history files (col,bnd) [frc] - albsni_hst => surfalb_inst%albsni_hst_col , & ! Input: [real(r8) (:,:) ] snow ground albedo, diffuse, for history files (col,bnd - flx_absdv => surfalb_inst%flx_absdv_col , & ! Input: [real(r8) (:,:) ] direct flux absorption factor (col,lyr): VIS [frc] - flx_absdn => surfalb_inst%flx_absdn_col , & ! Input: [real(r8) (:,:) ] direct flux absorption factor (col,lyr): NIR [frc] - flx_absiv => surfalb_inst%flx_absiv_col , & ! Input: [real(r8) (:,:) ] diffuse flux absorption factor (col,lyr): VIS [frc] - flx_absin => surfalb_inst%flx_absin_col , & ! Input: [real(r8) (:,:) ] diffuse flux absorption factor (col,lyr): NIR [frc] - albsoi => surfalb_inst%albsoi_col , & ! Input: [real(r8) (:,:) ] diffuse soil albedo (col,bnd) [frc] - albd => surfalb_inst%albd_patch , & ! Input: [real(r8) (:,:) ] surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Input: [real(r8) (:,:) ] surface albedo (diffuse) - fabd => surfalb_inst%fabd_patch , & ! Input: [real(r8) (:,:) ] flux absorbed by canopy per unit direct flux - fabd_sun => surfalb_inst%fabd_sun_patch , & ! Input: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit direct flux - fabd_sha => surfalb_inst%fabd_sha_patch , & ! Input: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit direct flux - fabi => surfalb_inst%fabi_patch , & ! Input: [real(r8) (:,:) ] flux absorbed by canopy per unit diffuse flux - fabi_sun => surfalb_inst%fabi_sun_patch , & ! Input: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit diffuse flux - fabi_sha => surfalb_inst%fabi_sha_patch , & ! Input: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit diffuse flux - ftdd => surfalb_inst%ftdd_patch , & ! Input: [real(r8) (:,:) ] down direct flux below canopy per unit direct flux - ftid => surfalb_inst%ftid_patch , & ! Input: [real(r8) (:,:) ] down diffuse flux below canopy per unit direct flux - ftii => surfalb_inst%ftii_patch , & ! Input: [real(r8) (:,:) ] down diffuse flux below canopy per unit diffuse flux - fabd_sun_z => surfalb_inst%fabd_sun_z_patch , & ! Input: [real(r8) (:,:) ] absorbed sunlit leaf direct PAR (per unit lai+sai) for each canopy layer - fabd_sha_z => surfalb_inst%fabd_sha_z_patch , & ! Input: [real(r8) (:,:) ] absorbed shaded leaf direct PAR (per unit lai+sai) for each canopy layer - fabi_sun_z => surfalb_inst%fabi_sun_z_patch , & ! Input: [real(r8) (:,:) ] absorbed sunlit leaf diffuse PAR (per unit lai+sai) for each canopy layer - fabi_sha_z => surfalb_inst%fabi_sha_z_patch , & ! Input: [real(r8) (:,:) ] absorbed shaded leaf diffuse PAR (per unit lai+sai) for each canopy layer - albgrd_pur => surfalb_inst%albgrd_pur_col , & ! Input: [real(r8) (:,:) ] pure snow ground albedo (direct) - albgri_pur => surfalb_inst%albgri_pur_col , & ! Input: [real(r8) (:,:) ] pure snow ground albedo (diffuse) - albgrd_bc => surfalb_inst%albgrd_bc_col , & ! Input: [real(r8) (:,:) ] ground albedo without BC (direct) (col,bnd) - albgri_bc => surfalb_inst%albgri_bc_col , & ! Input: [real(r8) (:,:) ] ground albedo without BC (diffuse) (col,bnd) - tlai => canopystate_inst%tlai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - fsun => canopystate_inst%fsun_patch , & ! Output: [real(r8) (:) ] sunlit fraction of canopy - fsa => solarabs_inst%fsa_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed (total) (W/m**2) - fsr => solarabs_inst%fsr_patch , & ! Output: [real(r8) (:) ] solar radiation reflected (W/m**2) - sabv => solarabs_inst%sabv_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed by vegetation (W/m**2) - sabg => solarabs_inst%sabg_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - sabg_pen => solarabs_inst%sabg_pen_patch , & ! Output: [real(r8) (:) ] solar (rural) radiation penetrating top soisno layer (W/m**2) - sabg_soil => solarabs_inst%sabg_soil_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed by soil (W/m**2) - sabg_snow => solarabs_inst%sabg_snow_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed by snow (W/m**2) - sabg_lyr => solarabs_inst%sabg_lyr_patch , & ! Output: [real(r8) (:,:) ] absorbed radiative flux (patch,lyr) [W/m2] - fsr_nir_d => solarabs_inst%fsr_nir_d_patch , & ! Output: [real(r8) (:) ] reflected direct beam nir solar radiation (W/m**2) - fsr_nir_i => solarabs_inst%fsr_nir_i_patch , & ! Output: [real(r8) (:) ] reflected diffuse nir solar radiation (W/m**2) - fsr_nir_d_ln => solarabs_inst%fsr_nir_d_ln_patch , & ! Output: [real(r8) (:) ] reflected direct beam nir solar rad at local noon (W/m**2) - fsds_nir_d => solarabs_inst%fsds_nir_d_patch , & ! Output: [real(r8) (:) ] incident direct beam nir solar radiation (W/m**2) - fsds_nir_d_ln => solarabs_inst%fsds_nir_d_ln_patch , & ! Output: [real(r8) (:) ] incident direct beam nir solar rad at local noon (W/m**2) - fsds_nir_i => solarabs_inst%fsds_nir_i_patch , & ! Output: [real(r8) (:) ] incident diffuse nir solar radiation (W/m**2) - fsa_r => solarabs_inst%fsa_r_patch , & ! Output: [real(r8) (:) ] rural solar radiation absorbed (total) (W/m**2) - sub_surf_abs_SW => solarabs_inst%sub_surf_abs_SW_patch , & ! Output: [real(r8) (:) ] fraction of solar radiation absorbed below first snow layer (W/M**2) - - parveg_ln => surfrad_inst%parveg_ln_patch , & ! Output: [real(r8) (:) ] absorbed par by vegetation at local noon (W/m**2) - fsr_vis_d => surfrad_inst%fsr_vis_d_patch , & ! Output: [real(r8) (:) ] reflected direct beam vis solar radiation (W/m**2) - fsr_vis_i => surfrad_inst%fsr_vis_i_patch , & ! Output: [real(r8) (:) ] reflected diffuse vis solar radiation (W/m**2) - fsds_vis_i_ln => surfrad_inst%fsds_vis_i_ln_patch , & ! Output: [real(r8) (:) ] incident diffuse beam vis solar rad at local noon (W/m**2) - fsr_vis_d_ln => surfrad_inst%fsr_vis_d_ln_patch , & ! Output: [real(r8) (:) ] reflected direct beam vis solar rad at local noon (W/m**2) - fsds_vis_d => surfrad_inst%fsds_vis_d_patch , & ! Output: [real(r8) (:) ] incident direct beam vis solar radiation (W/m**2) - fsds_vis_i => surfrad_inst%fsds_vis_i_patch , & ! Output: [real(r8) (:) ] incident diffuse vis solar radiation (W/m**2) - fsds_vis_d_ln => surfrad_inst%fsds_vis_d_ln_patch , & ! Output: [real(r8) (:) ] incident direct beam vis solar rad at local noon (W/m**2) - sfc_frc_aer => surfrad_inst%sfc_frc_aer_patch , & ! Output: [real(r8) (:) ] surface forcing of snow with all aerosols (patch) [W/m2] - sfc_frc_aer_sno => surfrad_inst%sfc_frc_aer_sno_patch, & ! Output: [real(r8) (:) ] surface forcing of snow with all aerosols, averaged only when snow is present (patch) [W/m2] - sfc_frc_bc => surfrad_inst%sfc_frc_bc_patch , & ! Output: [real(r8) (:) ] surface forcing of snow with BC (patch) [W/m2] - sfc_frc_bc_sno => surfrad_inst%sfc_frc_bc_sno_patch , & ! Output: [real(r8) (:) ] surface forcing of snow with BC, averaged only when snow is present (patch) [W/m2] - sfc_frc_oc => surfrad_inst%sfc_frc_oc_patch , & ! Output: [real(r8) (:) ] surface forcing of snow with OC (patch) [W/m2] - sfc_frc_oc_sno => surfrad_inst%sfc_frc_oc_sno_patch , & ! Output: [real(r8) (:) ] surface forcing of snow with OC, averaged only when snow is present (patch) [W/m2] - sfc_frc_dst => surfrad_inst%sfc_frc_dst_patch , & ! Output: [real(r8) (:) ] surface forcing of snow with dust (patch) [W/m2] - sfc_frc_dst_sno => surfrad_inst%sfc_frc_dst_sno_patch, & ! Output: [real(r8) (:) ] surface forcing of snow with dust, averaged only when snow is present (patch) [W/m2] - fsr_sno_vd => surfrad_inst%fsr_sno_vd_patch , & ! Output: [real(r8) (:) ] reflected visible, direct radiation from snow (for history files) (patch) [W/m2] - fsr_sno_nd => surfrad_inst%fsr_sno_nd_patch , & ! Output: [real(r8) (:) ] reflected near-IR, direct radiation from snow (for history files) (patch) [W/m2] - fsr_sno_vi => surfrad_inst%fsr_sno_vi_patch , & ! Output: [real(r8) (:) ] reflected visible, diffuse radiation from snow (for history files) (patch) [W/m2] - fsr_sno_ni => surfrad_inst%fsr_sno_ni_patch , & ! Output: [real(r8) (:) ] reflected near-IR, diffuse radiation from snow (for history files) (patch) [W/m2] - fsds_sno_vd => surfrad_inst%fsds_sno_vd_patch , & ! Output: [real(r8) (:) ] incident visible, direct radiation on snow (for history files) (patch) [W/m2] - fsds_sno_nd => surfrad_inst%fsds_sno_nd_patch , & ! Output: [real(r8) (:) ] incident near-IR, direct radiation on snow (for history files) (patch) [W/m2] - fsds_sno_vi => surfrad_inst%fsds_sno_vi_patch , & ! Output: [real(r8) (:) ] incident visible, diffuse radiation on snow (for history files) (patch) [W/m2] - fsds_sno_ni => surfrad_inst%fsds_sno_ni_patch , & ! Output: [real(r8) (:) ] incident near-IR, diffuse radiation on snow (for history files) (patch) [W/m2] - frac_sno_eff => waterstate_inst%frac_sno_eff_col & !Input: - - ) - - ! Determine seconds off current time step - - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! Initialize fluxes - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - l = patch%landunit(p) - g = patch%gridcell(p) - - sabg_soil(p) = 0._r8 - sabg_snow(p) = 0._r8 - sabg(p) = 0._r8 - sabv(p) = 0._r8 - fsa(p) = 0._r8 - if (lun%itype(l)==istsoil .or. lun%itype(l)==istcrop) then - fsa_r(p) = 0._r8 - end if - sabg_lyr(p,:) = 0._r8 - sabg_pur(p) = 0._r8 - sabg_bc(p) = 0._r8 - sabg_oc(p) = 0._r8 - sabg_dst(p) = 0._r8 - - end do - - ! zero-out fsun for the urban patches - ! the non-urban patches were set prior to this call - ! and split into fates and non-fates specific functions - do fp = 1,num_urbanp - p = filter_urbanp(fp) - fsun(p) = 0._r8 - end do - - ! Loop over nband wavebands - do ib = 1, nband - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - - ! Absorbed by canopy - - cad(p,ib) = forc_solad(g,ib)*fabd(p,ib) - cai(p,ib) = forc_solai(g,ib)*fabi(p,ib) - sabv(p) = sabv(p) + cad(p,ib) + cai(p,ib) - fsa(p) = fsa(p) + cad(p,ib) + cai(p,ib) - if (ib == 1) then - parveg(p) = cad(p,ib) + cai(p,ib) - end if - if (lun%itype(l)==istsoil .or. lun%itype(l)==istcrop) then - fsa_r(p) = fsa_r(p) + cad(p,ib) + cai(p,ib) - end if - - ! Transmitted = solar fluxes incident on ground - - trd(p,ib) = forc_solad(g,ib)*ftdd(p,ib) - tri(p,ib) = forc_solad(g,ib)*ftid(p,ib) + forc_solai(g,ib)*ftii(p,ib) - ! Solar radiation absorbed by ground surface - ! calculate absorbed solar by soil/snow separately - absrad = trd(p,ib)*(1._r8-albsod(c,ib)) + tri(p,ib)*(1._r8-albsoi(c,ib)) - sabg_soil(p) = sabg_soil(p) + absrad - absrad = trd(p,ib)*(1._r8-albsnd_hst(c,ib)) + tri(p,ib)*(1._r8-albsni_hst(c,ib)) - sabg_snow(p) = sabg_snow(p) + absrad - absrad = trd(p,ib)*(1._r8-albgrd(c,ib)) + tri(p,ib)*(1._r8-albgri(c,ib)) - sabg(p) = sabg(p) + absrad - fsa(p) = fsa(p) + absrad - if (lun%itype(l)==istsoil .or. lun%itype(l)==istcrop) then - fsa_r(p) = fsa_r(p) + absrad - end if - if (snl(c) == 0) then - sabg_snow(p) = sabg(p) - sabg_soil(p) = sabg(p) - endif - ! if no subgrid fluxes, make sure to set both components equal to weighted average - if (subgridflag == 0 .or. lun%itype(l) == istdlak) then - sabg_snow(p) = sabg(p) - sabg_soil(p) = sabg(p) - endif - - if (use_snicar_frc) then - ! Solar radiation absorbed by ground surface without BC - absrad_bc = trd(p,ib)*(1._r8-albgrd_bc(c,ib)) + tri(p,ib)*(1._r8-albgri_bc(c,ib)) - sabg_bc(p) = sabg_bc(p) + absrad_bc - - ! Solar radiation absorbed by ground surface without OC - absrad_oc = trd(p,ib)*(1._r8-albgrd_oc(c,ib)) + tri(p,ib)*(1._r8-albgri_oc(c,ib)) - sabg_oc(p) = sabg_oc(p) + absrad_oc - - ! Solar radiation absorbed by ground surface without dust - absrad_dst = trd(p,ib)*(1._r8-albgrd_dst(c,ib)) + tri(p,ib)*(1._r8-albgri_dst(c,ib)) - sabg_dst(p) = sabg_dst(p) + absrad_dst - - ! Solar radiation absorbed by ground surface without any aerosols - absrad_pur = trd(p,ib)*(1._r8-albgrd_pur(c,ib)) + tri(p,ib)*(1._r8-albgri_pur(c,ib)) - sabg_pur(p) = sabg_pur(p) + absrad_pur - end if - - end do ! end of patch loop - end do ! end nbands loop - - ! compute absorbed flux in each snow layer and top soil layer, - ! based on flux factors computed in the radiative transfer portion of SNICAR. - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - c = patch%column(p) - l = patch%landunit(p) - sabg_snl_sum = 0._r8 - - sub_surf_abs_SW(p) = 0._r8 - - ! CASE1: No snow layers: all energy is absorbed in top soil layer - if (snl(c) == 0) then - sabg_lyr(p,:) = 0._r8 - sabg_lyr(p,1) = sabg(p) - sabg_snl_sum = sabg_lyr(p,1) - - ! CASE 2: Snow layers present: absorbed radiation is scaled according to - ! flux factors computed by SNICAR - else - do i = -nlevsno+1,1,1 - sabg_lyr(p,i) = flx_absdv(c,i)*trd(p,1) + flx_absdn(c,i)*trd(p,2) + & - flx_absiv(c,i)*tri(p,1) + flx_absin(c,i)*tri(p,2) - ! summed radiation in active snow layers: - if (i >= snl(c)+1) then - sabg_snl_sum = sabg_snl_sum + sabg_lyr(p,i) - endif - if (i > snl(c)+1) then ! if snow layer is below surface snow layer - !accumulate subsurface flux as a diagnostic for history file - sub_surf_abs_SW(p) = sub_surf_abs_SW(p) + sabg_lyr(p,i) - endif - enddo - - ! Divide absorbed by total, to get fraction absorbed in subsurface - if (sabg_snl_sum /= 0._r8) then - sub_surf_abs_SW(p) = sub_surf_abs_SW(p)/sabg_snl_sum - else - sub_surf_abs_SW(p) = 0._r8 - endif - - ! Error handling: The situation below can occur when solar radiation is - ! NOT computed every timestep. - ! When the number of snow layers has changed in between computations of the - ! absorbed solar energy in each layer, we must redistribute the absorbed energy - ! to avoid physically unrealistic conditions. The assumptions made below are - ! somewhat arbitrary, but this situation does not arise very frequently. - ! This error handling is implemented to accomodate any value of the - ! radiation frequency. - ! change condition to match sabg_snow isntead of sabg - if (abs(sabg_snl_sum-sabg_snow(p)) > 0.00001_r8) then - if (snl(c) == 0) then - sabg_lyr(p,-nlevsno+1:0) = 0._r8 - sabg_lyr(p,1) = sabg(p) - elseif (snl(c) == -1) then - sabg_lyr(p,-nlevsno+1:-1) = 0._r8 - sabg_lyr(p,0) = sabg_snow(p)*0.6_r8 - sabg_lyr(p,1) = sabg_snow(p)*0.4_r8 - else - sabg_lyr(p,:) = 0._r8 - sabg_lyr(p,snl(c)+1) = sabg_snow(p)*0.75_r8 - sabg_lyr(p,snl(c)+2) = sabg_snow(p)*0.25_r8 - endif - endif - - ! If shallow snow depth, all solar radiation absorbed in top or top two snow layers - ! to prevent unrealistic timestep soil warming - if (subgridflag == 0 .or. lun%itype(l) == istdlak) then - if (snow_depth(c) < 0.10_r8) then - if (snl(c) == 0) then - sabg_lyr(p,-nlevsno+1:0) = 0._r8 - sabg_lyr(p,1) = sabg(p) - elseif (snl(c) == -1) then - sabg_lyr(p,-nlevsno+1:-1) = 0._r8 - sabg_lyr(p,0) = sabg(p) - sabg_lyr(p,1) = 0._r8 - else - sabg_lyr(p,:) = 0._r8 - sabg_lyr(p,snl(c)+1) = sabg(p)*0.75_r8 - sabg_lyr(p,snl(c)+2) = sabg(p)*0.25_r8 - endif - endif - endif - endif - - ! This situation should not happen: - if (abs(sum(sabg_lyr(p,:))-sabg_snow(p)) > 0.00001_r8) then - write(iulog,*)"SNICAR ERROR: Absorbed ground radiation not equal to summed snow layer radiation" - write(iulog,*)"Diff = ",sum(sabg_lyr(p,:))-sabg_snow(p) - write(iulog,*)"sabg_snow(p)= ",sabg_snow(p) - write(iulog,*)"sabg_sum(p) = ",sum(sabg_lyr(p,:)) - write(iulog,*)"snl(c) = ",snl(c) - write(iulog,*)"flx_absdv1 = ",trd(p,1)*(1.-albgrd(c,1)) - write(iulog,*)"flx_absdv2 = ",sum(flx_absdv(c,:))*trd(p,1) - write(iulog,*)"flx_absiv1 = ",tri(p,1)*(1.-albgri(c,1)) - write(iulog,*)"flx_absiv2 = ",sum(flx_absiv(c,:))*tri(p,1) - write(iulog,*)"flx_absdn1 = ",trd(p,2)*(1.-albgrd(c,2)) - write(iulog,*)"flx_absdn2 = ",sum(flx_absdn(c,:))*trd(p,2) - write(iulog,*)"flx_absin1 = ",tri(p,2)*(1.-albgri(c,2)) - write(iulog,*)"flx_absin2 = ",sum(flx_absin(c,:))*tri(p,2) - write(iulog,*)"albgrd_nir = ",albgrd(c,2) - write(iulog,*)"coszen = ",coszen(c) - call endrun(decomp_index=c, clmlevel=namec, msg=errmsg(sourcefile, __LINE__)) - endif - - ! Diagnostic: shortwave penetrating ground (e.g. top layer) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - sabg_pen(p) = sabg(p) - sabg_lyr(p, snl(c)+1) - end if - - if (use_snicar_frc) then - - ! BC aerosol forcing (patch-level): - sfc_frc_bc(p) = sabg(p) - sabg_bc(p) - - ! OC aerosol forcing (patch-level): - if (DO_SNO_OC) then - sfc_frc_oc(p) = sabg(p) - sabg_oc(p) - else - sfc_frc_oc(p) = 0._r8 - endif - - ! dust aerosol forcing (patch-level): - sfc_frc_dst(p) = sabg(p) - sabg_dst(p) - - ! all-aerosol forcing (patch-level): - sfc_frc_aer(p) = sabg(p) - sabg_pur(p) - - ! forcings averaged only over snow: - if (frac_sno(c) > 0._r8) then - sfc_frc_bc_sno(p) = sfc_frc_bc(p)/frac_sno(c) - sfc_frc_oc_sno(p) = sfc_frc_oc(p)/frac_sno(c) - sfc_frc_dst_sno(p) = sfc_frc_dst(p)/frac_sno(c) - sfc_frc_aer_sno(p) = sfc_frc_aer(p)/frac_sno(c) - else - sfc_frc_bc_sno(p) = spval - sfc_frc_oc_sno(p) = spval - sfc_frc_dst_sno(p) = spval - sfc_frc_aer_sno(p) = spval - endif - end if - enddo - - ! Radiation diagnostics - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - g = patch%gridcell(p) - - ! NDVI and reflected solar radiation - - rvis = albd(p,1)*forc_solad(g,1) + albi(p,1)*forc_solai(g,1) - rnir = albd(p,2)*forc_solad(g,2) + albi(p,2)*forc_solai(g,2) - fsr(p) = rvis + rnir - - fsds_vis_d(p) = forc_solad(g,1) - fsds_nir_d(p) = forc_solad(g,2) - fsds_vis_i(p) = forc_solai(g,1) - fsds_nir_i(p) = forc_solai(g,2) - fsr_vis_d(p) = albd(p,1)*forc_solad(g,1) - fsr_nir_d(p) = albd(p,2)*forc_solad(g,2) - fsr_vis_i(p) = albi(p,1)*forc_solai(g,1) - fsr_nir_i(p) = albi(p,2)*forc_solai(g,2) - - local_secp1 = secs + nint((grc%londeg(g)/degpsec)/dtime)*dtime - local_secp1 = mod(local_secp1,isecspday) - if (local_secp1 == isecspday/2) then - fsds_vis_d_ln(p) = forc_solad(g,1) - fsds_nir_d_ln(p) = forc_solad(g,2) - fsr_vis_d_ln(p) = albd(p,1)*forc_solad(g,1) - fsr_nir_d_ln(p) = albd(p,2)*forc_solad(g,2) - fsds_vis_i_ln(p) = forc_solai(g,1) - parveg_ln(p) = parveg(p) - else - fsds_vis_d_ln(p) = spval - fsds_nir_d_ln(p) = spval - fsr_vis_d_ln(p) = spval - fsr_nir_d_ln(p) = spval - fsds_vis_i_ln(p) = spval - parveg_ln(p) = spval - end if - - ! diagnostic variables (downwelling and absorbed radiation partitioning) for history files - ! (OPTIONAL) - c = patch%column(p) - if (snl(c) < 0) then - fsds_sno_vd(p) = forc_solad(g,1) - fsds_sno_nd(p) = forc_solad(g,2) - fsds_sno_vi(p) = forc_solai(g,1) - fsds_sno_ni(p) = forc_solai(g,2) - - fsr_sno_vd(p) = fsds_vis_d(p)*albsnd_hst(c,1) - fsr_sno_nd(p) = fsds_nir_d(p)*albsnd_hst(c,2) - fsr_sno_vi(p) = fsds_vis_i(p)*albsni_hst(c,1) - fsr_sno_ni(p) = fsds_nir_i(p)*albsni_hst(c,2) - else - fsds_sno_vd(p) = spval - fsds_sno_nd(p) = spval - fsds_sno_vi(p) = spval - fsds_sno_ni(p) = spval - - fsr_sno_vd(p) = spval - fsr_sno_nd(p) = spval - fsr_sno_vi(p) = spval - fsr_sno_ni(p) = spval - endif - end do - - do fp = 1,num_urbanp - p = filter_urbanp(fp) - g = patch%gridcell(p) - - local_secp1 = secs + nint((grc%londeg(g)/degpsec)/dtime)*dtime - local_secp1 = mod(local_secp1,isecspday) - - if(elai(p)==0.0_r8.and.fabd(p,1)>0._r8)then - if ( DEBUG ) write(iulog,*) 'absorption without LAI',elai(p),tlai(p),fabd(p,1),p - endif - ! Solar incident - - fsds_vis_d(p) = forc_solad(g,1) - fsds_nir_d(p) = forc_solad(g,2) - fsds_vis_i(p) = forc_solai(g,1) - fsds_nir_i(p) = forc_solai(g,2) - - ! Determine local noon incident solar - if (local_secp1 == noonsec) then - fsds_vis_d_ln(p) = forc_solad(g,1) - fsds_nir_d_ln(p) = forc_solad(g,2) - fsds_vis_i_ln(p) = forc_solai(g,1) - parveg_ln(p) = 0._r8 - else - fsds_vis_d_ln(p) = spval - fsds_nir_d_ln(p) = spval - fsds_vis_i_ln(p) = spval - parveg_ln(p) = spval - endif - - ! Solar reflected - ! per unit ground area (roof, road) and per unit wall area (sunwall, shadewall) - - fsr_vis_d(p) = albd(p,1) * forc_solad(g,1) - fsr_nir_d(p) = albd(p,2) * forc_solad(g,2) - fsr_vis_i(p) = albi(p,1) * forc_solai(g,1) - fsr_nir_i(p) = albi(p,2) * forc_solai(g,2) - - ! Determine local noon reflected solar - if (local_secp1 == noonsec) then - fsr_vis_d_ln(p) = fsr_vis_d(p) - fsr_nir_d_ln(p) = fsr_nir_d(p) - else - fsr_vis_d_ln(p) = spval - fsr_nir_d_ln(p) = spval - endif - fsr(p) = fsr_vis_d(p) + fsr_nir_d(p) + fsr_vis_i(p) + fsr_nir_i(p) - end do - - end associate - - end subroutine SurfaceRadiation - -end module SurfaceRadiationMod diff --git a/src/biogeophys/SurfaceResistanceMod.F90 b/src/biogeophys/SurfaceResistanceMod.F90 deleted file mode 100644 index 55e41a1106..0000000000 --- a/src/biogeophys/SurfaceResistanceMod.F90 +++ /dev/null @@ -1,416 +0,0 @@ -module SurfaceResistanceMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines for calculation of surface resistances of the different tracers - ! transported with BeTR. The surface here refers to water and soil, not including canopy - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod , only: SHR_CONST_TKFRZ - use clm_varctl , only: iulog - use SoilStateType , only: soilstate_type - use WaterStateType, only: waterstate_type - use TemperatureType , only : temperature_type - implicit none - save - private - integer :: soil_resis_method !choose the method for soil resistance calculation - - integer, parameter :: leepielke_1992 = 0 ! - integer, parameter :: sl_14 = 1 - - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: calc_soilevap_resis - public :: do_soilevap_beta, do_soil_resistance_sl14 -! public :: init_soil_resistance - public :: soil_resistance_readNL - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - ! - ! !REVISION HISTORY: - ! 6/25/2013 Created by Jinyun Tang - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- -!!$ subroutine init_soil_resistance() -!!$ ! -!!$ !DESCRIPTIONS -!!$ ! initialize method for soil resis calculation -!!$ ! -!!$ ! !USES: -!!$ use abortutils , only : endrun -!!$ use fileutils , only : getavu, relavu -!!$ use spmdMod , only : mpicom, masterproc -!!$ use shr_mpi_mod , only : shr_mpi_bcast -!!$ use clm_varctl , only : iulog, use_bedrock -!!$ use controlMod , only : NLFilename -!!$ use clm_nlUtilsMod , only : find_nlgroup_name -!!$ -!!$ ! !ARGUMENTS: -!!$ !------------------------------------------------------------------------------ -!!$ implicit none -!!$ integer :: nu_nml ! unit for namelist file -!!$ integer :: nml_error ! namelist i/o error flag -!!$ character(*), parameter :: subName = "('init_soil_resistance')" -!!$ -!!$ !----------------------------------------------------------------------- -!!$ -!!$! MUST agree with name in namelist and read statement -!!$ namelist /soil_resis_inparm/ soil_resis_method -!!$ -!!$ ! Default values for namelist -!!$ -!!$ soil_resis_method = sl_14 -!!$ -!!$ ! Read soil_resis namelist -!!$ if (masterproc) then -!!$ nu_nml = getavu() -!!$ open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) -!!$ call find_nlgroup_name(nu_nml, 'soil_resis_inparm', status=nml_error) -!!$ if (nml_error == 0) then -!!$ read(nu_nml, nml=soil_resis_inparm,iostat=nml_error) -!!$ if (nml_error /= 0) then -!!$ call endrun(subname // ':: ERROR reading soil_resis namelist') -!!$ end if -!!$ end if -!!$ close(nu_nml) -!!$ call relavu( nu_nml ) -!!$ -!!$ endif -!!$ -!!$ call shr_mpi_bcast(soil_resis_method, mpicom) -!!$ -!!$ if (masterproc) then -!!$ write(iulog,*) ' ' -!!$ write(iulog,*) 'soil_resis settings:' -!!$ write(iulog,*) ' soil_resis_method = ',soil_resis_method -!!$ endif -!!$!scs -!!$! soil_resis_method = leepielke_1992 -!!$! soil_resis_method = sl_14 -!!$!scs -!!$ -!!$ end subroutine init_soil_resistance - - !----------------------------------------------------------------------- - subroutine soil_resistance_readNL(NLFilename) - ! - !DESCRIPTIONS - ! Read the namelist for soil resistance method - ! - ! !USES: - use abortutils , only : endrun - use fileutils , only : getavu, relavu - use spmdMod , only : mpicom, masterproc - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use clm_nlUtilsMod , only : find_nlgroup_name - - ! !ARGUMENTS: - !------------------------------------------------------------------------------ - implicit none - character(len=*), intent(IN) :: NLFilename ! Namelist filename - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - character(*), parameter :: subName = "('init_soil_resistance')" - - !----------------------------------------------------------------------- - -! MUST agree with name in namelist and read statement - namelist /soil_resis_inparm/ soil_resis_method - - ! Default values for namelist - - soil_resis_method = sl_14 - - ! Read soil_resis namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'soil_resis_inparm', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=soil_resis_inparm,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading soil_resis namelist') - end if - else - call endrun(subname // ':: ERROR reading soil_resis namelist') - end if - close(nu_nml) - call relavu( nu_nml ) - - endif - - call shr_mpi_bcast(soil_resis_method, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'soil_resis settings:' - write(iulog,*) ' soil_resis_method = ',soil_resis_method - endif - - end subroutine soil_resistance_readNL - - !------------------------------------------------------------------------------ - subroutine calc_soilevap_resis(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, temperature_inst) - ! - ! DESCRIPTIONS - ! compute the resis factor for soil evaporation calculation - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use decompMod , only : bounds_type - use ColumnType , only : col - use LandunitType , only : lun - use abortutils , only : endrun - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type), intent(in) :: temperature_inst - character(len=32) :: subname = 'calc_soilevap_resis' ! subroutine name - associate( & - soilbeta => soilstate_inst%soilbeta_col , & ! Output: [real(r8) (:)] factor that reduces ground evaporation - dsl => soilstate_inst%dsl_col , & ! Output: [real(r8) (:)] soil dry surface layer thickness - soilresis => soilstate_inst%soilresis_col & ! Output: [real(r8) (:)] soil evaporative resistance - ) - - !select the right method and do the calculation - select case (soil_resis_method) - - case (leepielke_1992) - call calc_beta_leepielke1992(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, soilbeta(bounds%begc:bounds%endc)) - - case (sl_14) - call calc_soil_resistance_sl14(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst,temperature_inst, & - dsl(bounds%begc:bounds%endc), soilresis(bounds%begc:bounds%endc)) - case default - call endrun(subname // ':: a soilevap resis function must be specified!') - end select - - end associate - - end subroutine calc_soilevap_resis - - !------------------------------------------------------------------------------ - subroutine calc_beta_leepielke1992(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, soilbeta) - ! - ! DESCRIPTION - ! compute the lee-pielke beta factor to scal actual soil evaporation from potential evaporation - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varcon , only : denh2o, denice - use landunit_varcon , only : istice_mec, istwet, istsoil, istcrop - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_imperv, icol_road_perv - use ColumnType , only : col - use LandunitType , only : lun - ! - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(inout) :: soilbeta(bounds%begc:bounds%endc) - - !local variables - real(r8) :: fac, fac_fc, wx !temporary variables - integer :: c, l, fc !indices - - SHR_ASSERT_ALL((ubound(soilbeta) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:)] volumetric soil water at saturation (porosity) - watfc => soilstate_inst%watfc_col , & ! Input: [real(r8) (:,:)] volumetric soil water at field capacity - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:)] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:)] liquid water (kg/m2) - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:)] fraction of ground covered by snow (0 to 1) - frac_h2osfc => waterstate_inst%frac_h2osfc_col & ! Input: [real(r8) (:)] fraction of ground covered by surface water (0 to 1) - ) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%itype(l)/=istwet .AND. lun%itype(l)/=istice_mec) then - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - wx = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/col%dz(c,1) - fac = min(1._r8, wx/watsat(c,1)) - fac = max( fac, 0.01_r8 ) - !! Lee and Pielke 1992 beta, added by K.Sakaguchi - if (wx < watfc(c,1) ) then !when water content of ths top layer is less than that at F.C. - fac_fc = min(1._r8, wx/watfc(c,1)) !eqn5.66 but divided by theta at field capacity - fac_fc = max( fac_fc, 0.01_r8 ) - ! modify soil beta by snow cover. soilbeta for snow surface is one - soilbeta(c) = (1._r8-frac_sno(c)-frac_h2osfc(c)) & - *0.25_r8*(1._r8 - cos(SHR_CONST_PI*fac_fc))**2._r8 & - + frac_sno(c)+ frac_h2osfc(c) - else !when water content of ths top layer is more than that at F.C. - soilbeta(c) = 1._r8 - end if - else if (col%itype(c) == icol_road_perv) then - soilbeta(c) = 0._r8 - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - soilbeta(c) = 0._r8 - else if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - soilbeta(c) = 0._r8 - endif - else - soilbeta(c) = 1._r8 - endif - enddo - - end associate - - end subroutine calc_beta_leepielke1992 - - !------------------------------------------------------------------------------ - function do_soilevap_beta()result(lres) - ! - !DESCRIPTION - ! return true if the moisture stress for soil evaporation is computed as beta factor - ! otherwise false - implicit none - logical :: lres - - if(soil_resis_method==leepielke_1992)then - lres=.true. - else - lres=.false. - endif - return - - end function do_soilevap_beta - - !------------------------------------------------------------------------------ - subroutine calc_soil_resistance_sl14(bounds, num_nolakec, filter_nolakec, & - soilstate_inst, waterstate_inst, temperature_inst, dsl, soilresis) - ! - ! DESCRIPTION - ! compute the lee-pielke beta factor to scal actual soil evaporation from potential evaporation - ! - ! USES - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_PI - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varcon , only : denh2o, denice - use landunit_varcon , only : istice_mec, istwet, istsoil, istcrop - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_imperv, icol_road_perv - use ColumnType , only : col - use LandunitType , only : lun - ! - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type), intent(in) :: temperature_inst - real(r8) , intent(inout) :: dsl(bounds%begc:bounds%endc) - real(r8) , intent(inout) :: soilresis(bounds%begc:bounds%endc) - - !local variables - real(r8) :: aird, eps, dg, d0, vwc_liq - real(r8) :: eff_por_top - integer :: c, l, fc !indices - - SHR_ASSERT_ALL((ubound(dsl) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(soilresis) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] layer thickness (m) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:)] volumetric soil water at saturation (porosity) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) -! eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:)] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Input: [real(r8) (:,:)] liquid water (kg/m2) - ) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - if (lun%itype(l)/=istwet .AND. lun%itype(l)/=istice_mec) then - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - vwc_liq = max(h2osoi_liq(c,1),1.0e-6_r8)/(dz(c,1)*denh2o) -! eff_porosity not calculated til SoilHydrology - eff_por_top = max(0.01_r8,watsat(c,1)-min(watsat(c,1), h2osoi_ice(c,1)/(dz(c,1)*denice))) - -! calculate diffusivity and air free pore space - aird = watsat(c,1)*(sucsat(c,1)/1.e7_r8)**(1./bsw(c,1)) - d0 = 2.12e-5*(t_soisno(c,1)/273.15)**1.75 ![Bitelli et al., JH, 08] - eps = watsat(c,1) - aird - dg = eps*d0*(eps/watsat(c,1))**(3._r8/max(3._r8,bsw(c,1))) - -! dsl(c) = dzmm(c,1)*max(0.001_r8,(0.8*eff_porosity(c,1) - vwc_liq)) & -! try arbitrary scaling (not top layer thickness) -! dsl(c) = 15._r8*max(0.001_r8,(0.8*eff_porosity(c,1) - vwc_liq)) & - dsl(c) = 15._r8*max(0.001_r8,(0.8*eff_por_top - vwc_liq)) & - ! /max(0.001_r8,(watsat(c,1)- aird)) - /max(0.001_r8,(0.8*watsat(c,1)- aird)) - - dsl(c)=max(dsl(c),0._r8) - dsl(c)=min(dsl(c),200._r8) - - soilresis(c) = dsl(c)/(dg*eps*1.e3) + 20._r8 - soilresis(c) = min(1.e6_r8,soilresis(c)) - - else if (col%itype(c) == icol_road_perv) then - soilresis(c) = 1.e6_r8 - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - soilresis(c) = 1.e6_r8 - else if (col%itype(c) == icol_roof .or. col%itype(c) == icol_road_imperv) then - soilresis(c) = 1.e6_r8 - endif - else - soilresis(c) = 0._r8 - endif - enddo - end associate - end subroutine calc_soil_resistance_sl14 - - !------------------------------------------------------------------------------ - function do_soil_resistance_sl14()result(lres) - ! - !DESCRIPTION - ! return true if the soil evaporative resistance is computed using a DSL - ! otherwise false - implicit none - logical :: lres - - if(soil_resis_method==sl_14)then - lres=.true. - else - lres=.false. - endif - return - - end function do_soil_resistance_sl14 - -end module SurfaceResistanceMod diff --git a/src/biogeophys/TemperatureType.F90 b/src/biogeophys/TemperatureType.F90 deleted file mode 100644 index 5dfc3bc704..0000000000 --- a/src/biogeophys/TemperatureType.F90 +++ /dev/null @@ -1,1502 +0,0 @@ -module TemperatureType - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : use_cndv, iulog, use_luna, use_crop - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevlak, nlevurb - use clm_varcon , only : spval, ispval - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - save - private - ! - type, public :: temperature_type - - ! Temperatures - real(r8), pointer :: t_veg_patch (:) ! patch vegetation temperature (Kelvin) - real(r8), pointer :: t_skin_patch (:) ! patch skin temperature (Kelvin) - real(r8), pointer :: t_veg_day_patch (:) ! patch daytime accumulative vegetation temperature (Kelvinx*nsteps), LUNA specific, from midnight to current step - real(r8), pointer :: t_veg_night_patch (:) ! patch night-time accumulative vegetation temperature (Kelvin*nsteps), LUNA specific, from midnight to current step - real(r8), pointer :: t_veg10_day_patch (:) ! 10 day running mean of patch daytime time vegetation temperature (Kelvin), LUNA specific, but can be reused - real(r8), pointer :: t_veg10_night_patch (:) ! 10 day running mean of patch night time vegetation temperature (Kelvin), LUNA specific, but can be reused - integer, pointer :: ndaysteps_patch (:) ! number of daytime steps accumulated from mid-night, LUNA specific - integer, pointer :: nnightsteps_patch (:) ! number of nighttime steps accumulated from mid-night, LUNA specific - real(r8), pointer :: t_h2osfc_col (:) ! col surface water temperature - real(r8), pointer :: t_h2osfc_bef_col (:) ! col surface water temperature from time-step before - real(r8), pointer :: t_ssbef_col (:,:) ! col soil/snow temperature before update (-nlevsno+1:nlevgrnd) - real(r8), pointer :: t_soisno_col (:,:) ! col soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: tsl_col (:) ! col temperature of near-surface soil layer (Kelvin) - real(r8), pointer :: t_soi10cm_col (:) ! col soil temperature in top 10cm of soil (Kelvin) - real(r8), pointer :: t_soi17cm_col (:) ! col soil temperature in top 17cm of soil (Kelvin) - real(r8), pointer :: t_sno_mul_mss_col (:) ! col snow temperature multiplied by layer mass, layer sum (K * kg/m2) - real(r8), pointer :: t_lake_col (:,:) ! col lake temperature (Kelvin) (1:nlevlak) - real(r8), pointer :: t_grnd_col (:) ! col ground temperature (Kelvin) - real(r8), pointer :: t_grnd_r_col (:) ! col rural ground temperature (Kelvin) - real(r8), pointer :: t_grnd_u_col (:) ! col urban ground temperature (Kelvin) (needed by Hydrology2Mod) - real(r8), pointer :: t_building_lun (:) ! lun internal building air temperature (K) - real(r8), pointer :: t_roof_inner_lun (:) ! lun roof inside surface temperature (K) - real(r8), pointer :: t_sunw_inner_lun (:) ! lun sunwall inside surface temperature (K) - real(r8), pointer :: t_shdw_inner_lun (:) ! lun shadewall inside surface temperature (K) - real(r8), pointer :: t_floor_lun (:) ! lun floor temperature (K) - real(r8), pointer :: snot_top_col (:) ! col temperature of top snow layer [K] - real(r8), pointer :: dTdz_top_col (:) ! col temperature gradient in top layer [K m-1] - real(r8), pointer :: dt_veg_patch (:) ! patch change in t_veg, last iteration (Kelvin) - - real(r8), pointer :: dt_grnd_col (:) ! col change in t_grnd, last iteration (Kelvin) - real(r8), pointer :: thv_col (:) ! col virtual potential temperature (kelvin) - real(r8), pointer :: thm_patch (:) ! patch intermediate variable (forc_t+0.0098*forc_hgt_t_patch) - real(r8), pointer :: t_a10_patch (:) ! patch 10-day running mean of the 2 m temperature (K) - real(r8), pointer :: t_a10min_patch (:) ! patch 10-day running mean of min 2-m temperature - real(r8), pointer :: t_a5min_patch (:) ! patch 5-day running mean of min 2-m temperature - - real(r8), pointer :: taf_lun (:) ! lun urban canopy air temperature (K) - - real(r8), pointer :: t_ref2m_patch (:) ! patch 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_r_patch (:) ! patch rural 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_u_patch (:) ! patch urban 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_min_patch (:) ! patch daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_r_patch (:) ! patch daily minimum of average 2 m height surface air temperature - rural(K) - real(r8), pointer :: t_ref2m_min_u_patch (:) ! patch daily minimum of average 2 m height surface air temperature - urban (K) - real(r8), pointer :: t_ref2m_max_patch (:) ! patch daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_r_patch (:) ! patch daily maximum of average 2 m height surface air temperature - rural(K) - real(r8), pointer :: t_ref2m_max_u_patch (:) ! patch daily maximum of average 2 m height surface air temperature - urban (K) - real(r8), pointer :: t_ref2m_min_inst_patch (:) ! patch instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_inst_r_patch (:) ! patch instantaneous daily min of average 2 m height surface air temp - rural (K) - real(r8), pointer :: t_ref2m_min_inst_u_patch (:) ! patch instantaneous daily min of average 2 m height surface air temp - urban (K) - real(r8), pointer :: t_ref2m_max_inst_patch (:) ! patch instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_r_patch (:) ! patch instantaneous daily max of average 2 m height surface air temp - rural (K) - real(r8), pointer :: t_ref2m_max_inst_u_patch (:) ! patch instantaneous daily max of average 2 m height surface air temp - urban (K) - - ! Accumulated quantities - ! - ! TODO(wjs, 2014-08-05) Move these to the module(s) where they are used, to improve - ! modularity. In cases where they are used by two completely different modules, - ! which only use the same variable out of convenience, introduce a duplicate (point - ! being: that way one parameterization is free to change the exact meaning of its - ! accumulator without affecting the other). - ! - real(r8), pointer :: t_veg24_patch (:) ! patch 24hr average vegetation temperature (K) - real(r8), pointer :: t_veg240_patch (:) ! patch 240hr average vegetation temperature (Kelvin) - real(r8), pointer :: gdd0_patch (:) ! patch growing degree-days base 0C from planting (ddays) - real(r8), pointer :: gdd8_patch (:) ! patch growing degree-days base 8C from planting (ddays) - real(r8), pointer :: gdd10_patch (:) ! patch growing degree-days base 10C from planting (ddays) - real(r8), pointer :: gdd020_patch (:) ! patch 20-year average of gdd0 (ddays) - real(r8), pointer :: gdd820_patch (:) ! patch 20-year average of gdd8 (ddays) - real(r8), pointer :: gdd1020_patch (:) ! patch 20-year average of gdd10 (ddays) - - ! Heat content - real(r8), pointer :: beta_col (:) ! coefficient of convective velocity [-] - real(r8), pointer :: heat1_grc (:) ! grc initial gridcell total heat content - real(r8), pointer :: heat2_grc (:) ! grc post land cover change total heat content - real(r8), pointer :: liquid_water_temp1_grc (:) ! grc initial weighted average liquid water temperature (K) - real(r8), pointer :: liquid_water_temp2_grc (:) ! grc post land cover change weighted average liquid water temperature (K) - - ! Flags - integer , pointer :: imelt_col (:,:) ! flag for melting (=1), freezing (=2), Not=0 (-nlevsno+1:nlevgrnd) - - ! Emissivities - real(r8), pointer :: emv_patch (:) ! patch vegetation emissivity - real(r8), pointer :: emg_col (:) ! col ground emissivity - - ! Misc - real(r8), pointer :: xmf_col (:) ! total latent heat of phase change of ground water - real(r8), pointer :: xmf_h2osfc_col (:) ! latent heat of phase change of surface water - real(r8), pointer :: fact_col (:,:) ! used in computing tridiagonal matrix - real(r8), pointer :: c_h2osfc_col (:) ! heat capacity of surface water - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - - end type temperature_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - em_roof_lun, em_wall_lun, em_improad_lun, em_perroad_lun, & - is_simple_buildtemp, is_prog_buildtemp) - ! - ! !DESCRIPTION: - ! - ! Initialization of the data type. Allocate data, setup variables - ! for history output, and initialize values needed for a cold-start. - ! - class(temperature_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: em_roof_lun(bounds%begl:) - real(r8) , intent(in) :: em_wall_lun(bounds%begl:) - real(r8) , intent(in) :: em_improad_lun(bounds%begl:) - real(r8) , intent(in) :: em_perroad_lun(bounds%begl:) - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used - - call this%InitAllocate ( bounds ) - call this%InitHistory ( bounds, is_simple_buildtemp, is_prog_buildtemp ) - call this%InitCold ( bounds, & - em_roof_lun(bounds%begl:bounds%endl), & - em_wall_lun(bounds%begl:bounds%endl), & - em_improad_lun(bounds%begl:bounds%endl), & - em_perroad_lun(bounds%begl:bounds%endl), & - is_simple_buildtemp, is_prog_buildtemp) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize and allocate data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - ! Temperatures - allocate(this%t_veg_patch (begp:endp)) ; this%t_veg_patch (:) = nan - allocate(this%t_skin_patch (begp:endp)) ; this%t_skin_patch (:) = nan - if(use_luna) then - allocate(this%t_veg_day_patch (begp:endp)) ; this%t_veg_day_patch (:) = spval - allocate(this%t_veg_night_patch (begp:endp)) ; this%t_veg_night_patch (:) = spval - allocate(this%t_veg10_day_patch (begp:endp)) ; this%t_veg10_day_patch (:) = spval - allocate(this%t_veg10_night_patch (begp:endp)) ; this%t_veg10_night_patch (:) = spval - allocate(this%ndaysteps_patch (begp:endp)) ; this%ndaysteps_patch (:) = ispval - allocate(this%nnightsteps_patch (begp:endp)) ; this%nnightsteps_patch (:) = ispval - endif - allocate(this%t_h2osfc_col (begc:endc)) ; this%t_h2osfc_col (:) = nan - allocate(this%t_h2osfc_bef_col (begc:endc)) ; this%t_h2osfc_bef_col (:) = nan - allocate(this%t_ssbef_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_ssbef_col (:,:) = nan - allocate(this%t_soisno_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%t_soisno_col (:,:) = nan - allocate(this%t_lake_col (begc:endc,1:nlevlak)) ; this%t_lake_col (:,:) = nan - allocate(this%t_grnd_col (begc:endc)) ; this%t_grnd_col (:) = nan - allocate(this%t_grnd_r_col (begc:endc)) ; this%t_grnd_r_col (:) = nan - allocate(this%t_grnd_u_col (begc:endc)) ; this%t_grnd_u_col (:) = nan - allocate(this%t_building_lun (begl:endl)) ; this%t_building_lun (:) = nan - allocate(this%t_roof_inner_lun (begl:endl)) ; this%t_roof_inner_lun (:) = nan - allocate(this%t_sunw_inner_lun (begl:endl)) ; this%t_sunw_inner_lun (:) = nan - allocate(this%t_shdw_inner_lun (begl:endl)) ; this%t_shdw_inner_lun (:) = nan - allocate(this%t_floor_lun (begl:endl)) ; this%t_floor_lun (:) = nan - allocate(this%snot_top_col (begc:endc)) ; this%snot_top_col (:) = nan - allocate(this%dTdz_top_col (begc:endc)) ; this%dTdz_top_col (:) = nan - allocate(this%dt_veg_patch (begp:endp)) ; this%dt_veg_patch (:) = nan - - allocate(this%tsl_col (begc:endc)) ; this%tsl_col (:) = nan - allocate(this%t_sno_mul_mss_col (begc:endc)) ; this%t_sno_mul_mss_col (:) = nan - allocate(this%tsl_col (begc:endc)) ; this%tsl_col (:) = nan - allocate(this%t_soi10cm_col (begc:endc)) ; this%t_soi10cm_col (:) = nan - allocate(this%t_soi17cm_col (begc:endc)) ; this%t_soi17cm_col (:) = spval - allocate(this%dt_grnd_col (begc:endc)) ; this%dt_grnd_col (:) = nan - allocate(this%thv_col (begc:endc)) ; this%thv_col (:) = nan - allocate(this%thm_patch (begp:endp)) ; this%thm_patch (:) = nan - allocate(this%t_a10_patch (begp:endp)) ; this%t_a10_patch (:) = nan - allocate(this%t_a10min_patch (begp:endp)) ; this%t_a10min_patch (:) = nan - allocate(this%t_a5min_patch (begp:endp)) ; this%t_a5min_patch (:) = nan - - allocate(this%taf_lun (begl:endl)) ; this%taf_lun (:) = nan - - allocate(this%t_ref2m_patch (begp:endp)) ; this%t_ref2m_patch (:) = nan - allocate(this%t_ref2m_r_patch (begp:endp)) ; this%t_ref2m_r_patch (:) = nan - allocate(this%t_ref2m_u_patch (begp:endp)) ; this%t_ref2m_u_patch (:) = nan - allocate(this%t_ref2m_min_patch (begp:endp)) ; this%t_ref2m_min_patch (:) = nan - allocate(this%t_ref2m_min_r_patch (begp:endp)) ; this%t_ref2m_min_r_patch (:) = nan - allocate(this%t_ref2m_min_u_patch (begp:endp)) ; this%t_ref2m_min_u_patch (:) = nan - allocate(this%t_ref2m_max_patch (begp:endp)) ; this%t_ref2m_max_patch (:) = nan - allocate(this%t_ref2m_max_r_patch (begp:endp)) ; this%t_ref2m_max_r_patch (:) = nan - allocate(this%t_ref2m_max_u_patch (begp:endp)) ; this%t_ref2m_max_u_patch (:) = nan - allocate(this%t_ref2m_max_inst_patch (begp:endp)) ; this%t_ref2m_max_inst_patch (:) = nan - allocate(this%t_ref2m_max_inst_r_patch (begp:endp)) ; this%t_ref2m_max_inst_r_patch (:) = nan - allocate(this%t_ref2m_max_inst_u_patch (begp:endp)) ; this%t_ref2m_max_inst_u_patch (:) = nan - allocate(this%t_ref2m_min_inst_patch (begp:endp)) ; this%t_ref2m_min_inst_patch (:) = nan - allocate(this%t_ref2m_min_inst_r_patch (begp:endp)) ; this%t_ref2m_min_inst_r_patch (:) = nan - allocate(this%t_ref2m_min_inst_u_patch (begp:endp)) ; this%t_ref2m_min_inst_u_patch (:) = nan - - ! Accumulated fields - allocate(this%t_veg24_patch (begp:endp)) ; this%t_veg24_patch (:) = nan - allocate(this%t_veg240_patch (begp:endp)) ; this%t_veg240_patch (:) = nan - allocate(this%gdd0_patch (begp:endp)) ; this%gdd0_patch (:) = spval - allocate(this%gdd8_patch (begp:endp)) ; this%gdd8_patch (:) = spval - allocate(this%gdd10_patch (begp:endp)) ; this%gdd10_patch (:) = spval - allocate(this%gdd020_patch (begp:endp)) ; this%gdd020_patch (:) = spval - allocate(this%gdd820_patch (begp:endp)) ; this%gdd820_patch (:) = spval - allocate(this%gdd1020_patch (begp:endp)) ; this%gdd1020_patch (:) = spval - - ! Heat content - allocate(this%beta_col (begc:endc)) ; this%beta_col (:) = nan - allocate(this%heat1_grc (begg:endg)) ; this%heat1_grc (:) = nan - allocate(this%heat2_grc (begg:endg)) ; this%heat2_grc (:) = nan - allocate(this%liquid_water_temp1_grc (begg:endg)) ; this%liquid_water_temp1_grc (:) = nan - allocate(this%liquid_water_temp2_grc (begg:endg)) ; this%liquid_water_temp2_grc (:) = nan - - ! flags - allocate(this%imelt_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%imelt_col (:,:) = huge(1) - - ! emissivities - allocate(this%emv_patch (begp:endp)) ; this%emv_patch (:) = nan - allocate(this%emg_col (begc:endc)) ; this%emg_col (:) = nan - - allocate(this%xmf_col (begc:endc)) ; this%xmf_col (:) = nan - allocate(this%xmf_h2osfc_col (begc:endc)) ; this%xmf_h2osfc_col (:) = nan - allocate(this%fact_col (begc:endc, -nlevsno+1:nlevgrnd)) ; this%fact_col (:,:) = nan - allocate(this%c_h2osfc_col (begc:endc)) ; this%c_h2osfc_col (:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, is_simple_buildtemp, is_prog_buildtemp ) - ! - ! !DESCRIPTION: - ! Setup the fields that can be output on history files. - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_cn, use_cndv - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - character(10) :: active - character(100) :: lname - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - this%t_h2osfc_col(begc:endc) = spval - call hist_addfld1d (fname='TH2OSFC', units='K', & - avgflag='A', long_name='surface water temperature', & - ptr_col=this%t_h2osfc_col) - - this%t_grnd_u_col(begc:endc) = spval - call hist_addfld1d (fname='TG_U', units='K', & - avgflag='A', long_name='Urban ground temperature', & - ptr_col=this%t_grnd_u_col, set_nourb=spval, c2l_scale_type='urbans', default='inactive') - - this%t_lake_col(begc:endc,:) = spval - call hist_addfld2d (fname='TLAKE', units='K', type2d='levlak', & - avgflag='A', long_name='lake temperature', & - ptr_col=this%t_lake_col) - - this%t_soisno_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%t_soisno_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_T', units='K', type2d='levsno', & - avgflag='A', long_name='Snow temperatures', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_T_ICE', units='K', type2d='levsno', & - avgflag='A', long_name='Snow temperatures (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%t_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='TSA', units='K', & - avgflag='A', long_name='2m air temperature', & - ptr_patch=this%t_ref2m_patch) - - call hist_addfld1d (fname='TSA_ICE', units='K', & - avgflag='A', long_name='2m air temperature (ice landunits only)', & - ptr_patch=this%t_ref2m_patch, l2g_scale_type='ice', default='inactive') - - this%t_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TSA_R', units='K', & - avgflag='A', long_name='Rural 2m air temperature', & - ptr_patch=this%t_ref2m_r_patch, set_spec=spval, default='inactive') - - this%t_ref2m_min_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMNAV', units='K', & - avgflag='A', long_name='daily minimum of average 2-m temperature', & - ptr_patch=this%t_ref2m_min_patch) - - this%t_ref2m_max_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMXAV', units='K', & - avgflag='A', long_name='daily maximum of average 2-m temperature', & - ptr_patch=this%t_ref2m_max_patch) - - this%t_ref2m_min_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMNAV_R', units='K', & - avgflag='A', long_name='Rural daily minimum of average 2-m temperature', & - ptr_patch=this%t_ref2m_min_r_patch, set_spec=spval, default='inactive') - - this%t_ref2m_max_r_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMXAV_R', units='K', & - avgflag='A', long_name='Rural daily maximum of average 2-m temperature', & - ptr_patch=this%t_ref2m_max_r_patch, set_spec=spval, default='inactive') - - this%t_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TSA_U', units='K', & - avgflag='A', long_name='Urban 2m air temperature', & - ptr_patch=this%t_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%t_ref2m_min_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMNAV_U', units='K', & - avgflag='A', long_name='Urban daily minimum of average 2-m temperature', & - ptr_patch=this%t_ref2m_min_u_patch, set_nourb=spval, default='inactive') - - this%t_ref2m_max_u_patch(begp:endp) = spval - call hist_addfld1d (fname='TREFMXAV_U', units='K', & - avgflag='A', long_name='Urban daily maximum of average 2-m temperature', & - ptr_patch=this%t_ref2m_max_u_patch, set_nourb=spval, default='inactive') - - this%t_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='TV', units='K', & - avgflag='A', long_name='vegetation temperature', & - ptr_patch=this%t_veg_patch) - - this%t_skin_patch(begp:endp) = spval - call hist_addfld1d(fname='TSKIN', units='K', & - avgflag='A', long_name='skin temperature', & - ptr_patch=this%t_skin_patch, c2l_scale_type='urbans') - - this%t_grnd_col(begc:endc) = spval - call hist_addfld1d (fname='TG', units='K', & - avgflag='A', long_name='ground temperature', & - ptr_col=this%t_grnd_col, c2l_scale_type='urbans') - - call hist_addfld1d (fname='TG_ICE', units='K', & - avgflag='A', long_name='ground temperature (ice landunits only)', & - ptr_col=this%t_grnd_col, c2l_scale_type='urbans', l2g_scale_type='ice', & - default='inactive') - - this%t_grnd_r_col(begc:endc) = spval - call hist_addfld1d (fname='TG_R', units='K', & - avgflag='A', long_name='Rural ground temperature', & - ptr_col=this%t_grnd_r_col, set_spec=spval, default='inactive') - - this%t_soisno_col(begc:endc,:) = spval - call hist_addfld2d (fname='TSOI', units='K', type2d='levgrnd', & - avgflag='A', long_name='soil temperature (vegetated landunits only)', & - ptr_col=this%t_soisno_col, l2g_scale_type='veg') - - call hist_addfld2d (fname='TSOI_ICE', units='K', type2d='levgrnd', & - avgflag='A', long_name='soil temperature (ice landunits only)', & - ptr_col=this%t_soisno_col, l2g_scale_type='ice') - - this%t_soi10cm_col(begc:endc) = spval - call hist_addfld1d (fname='TSOI_10CM', units='K', & - avgflag='A', long_name='soil temperature in top 10cm of soil', & - ptr_col=this%t_soi10cm_col, set_urb=spval) - - this%tsl_col(begc:endc) = spval - call hist_addfld1d (fname='TSL', units='K', & - avgflag='A', long_name='temperature of near-surface soil layer (vegetated landunits only)', & - ptr_col=this%tsl_col, l2g_scale_type='veg') - this%t_sno_mul_mss_col(begc:endc) = spval - call hist_addfld1d (fname='SNOTXMASS', units='K kg/m2', & - avgflag='A', long_name='snow temperature times layer mass, layer sum; '// & - 'to get mass-weighted temperature, divide by (SNOWICE+SNOWLIQ)', & - ptr_col=this%t_sno_mul_mss_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='SNOTXMASS_ICE', units='K kg/m2', & - avgflag='A', long_name='snow temperature times layer mass, layer sum (ice landunits only); ' // & - 'to get mass-weighted temperature, divide by (SNOWICE_ICE+SNOWLIQ_ICE)', & - ptr_col=this%t_sno_mul_mss_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - if (use_cndv .or. use_crop) then - active = "active" - else - active = "inactive" - end if - this%t_a10_patch(begp:endp) = spval - call hist_addfld1d (fname='T10', units='K', & - avgflag='A', long_name='10-day running mean of 2-m temperature', & - ptr_patch=this%t_a10_patch, default='inactive') - - if (use_cn .and. use_crop )then - this%t_a5min_patch(begp:endp) = spval - call hist_addfld1d (fname='A5TMIN', units='K', & - avgflag='A', long_name='5-day running mean of min 2-m temperature', & - ptr_patch=this%t_a5min_patch, default='inactive') - end if - - if (use_cn .and. use_crop )then - this%t_a10min_patch(begp:endp) = spval - call hist_addfld1d (fname='A10TMIN', units='K', & - avgflag='A', long_name='10-day running mean of min 2-m temperature', & - ptr_patch=this%t_a10min_patch, default='inactive') - end if - - this%t_building_lun(begl:endl) = spval - if ( is_simple_buildtemp )then - lname = 'internal urban building temperature' - else if ( is_prog_buildtemp )then - lname = 'internal urban building air temperature' - end if - call hist_addfld1d(fname='TBUILD', units='K', & - avgflag='A', long_name=lname, & - ptr_lunit=this%t_building_lun, set_nourb=spval, l2g_scale_type='unity') - - if ( is_prog_buildtemp )then - this%t_roof_inner_lun(begl:endl) = spval - call hist_addfld1d(fname='TROOF_INNER', units='K', & - avgflag='A', long_name='roof inside surface temperature', & - ptr_lunit=this%t_roof_inner_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - - this%t_sunw_inner_lun(begl:endl) = spval - call hist_addfld1d(fname='TSUNW_INNER', units='K', & - avgflag='A', long_name='sunwall inside surface temperature', & - ptr_lunit=this%t_sunw_inner_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - - this%t_shdw_inner_lun(begl:endl) = spval - call hist_addfld1d(fname='TSHDW_INNER', units='K', & - avgflag='A', long_name='shadewall inside surface temperature', & - ptr_lunit=this%t_shdw_inner_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - - this%t_floor_lun(begl:endl) = spval - call hist_addfld1d(fname='TFLOOR', units='K', & - avgflag='A', long_name='floor temperature', & - ptr_lunit=this%t_floor_lun, set_nourb=spval, l2g_scale_type='unity', & - default='inactive') - end if - - this%heat1_grc(begg:endg) = spval - call hist_addfld1d (fname='HEAT_CONTENT1', units='J/m^2', & - avgflag='A', long_name='initial gridcell total heat content', & - ptr_lnd=this%heat1_grc) - call hist_addfld1d (fname='HEAT_CONTENT1_VEG', units='J/m^2', & - avgflag='A', long_name='initial gridcell total heat content - vegetated landunits only', & - ptr_lnd=this%heat1_grc, l2g_scale_type='veg', default='inactive') - - this%heat2_grc(begg:endg) = spval - call hist_addfld1d (fname='HEAT_CONTENT2', units='J/m^2', & - avgflag='A', long_name='post land cover change total heat content', & - ptr_lnd=this%heat2_grc, default='inactive') - - this%liquid_water_temp1_grc(begg:endg) = spval - call hist_addfld1d (fname='LIQUID_WATER_TEMP1', units='K', & - avgflag='A', long_name='initial gridcell weighted average liquid water temperature', & - ptr_lnd=this%liquid_water_temp1_grc, default='inactive') - - this%snot_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOTTOPL', units='K', & - avgflag='A', long_name='snow temperature (top layer)', & - ptr_col=this%snot_top_col, set_urb=spval, default='inactive') - - call hist_addfld1d (fname='SNOTTOPL_ICE', units='K', & - avgflag='A', long_name='snow temperature (top layer, ice landunits only)', & - ptr_col=this%snot_top_col, set_urb=spval, l2g_scale_type='ice', default='inactive') - - this%dTdz_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOdTdzL', units='K/m', & - avgflag='A', long_name='top snow layer temperature gradient (land)', & - ptr_col=this%dTdz_top_col, set_urb=spval, default='inactive') - - if (use_cn) then - this%dt_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='DT_VEG', units='K', & - avgflag='A', long_name='change in t_veg, last iteration', & - ptr_patch=this%dt_veg_patch, default='inactive') - end if - - if (use_cn ) then - this%emv_patch(begp:endp) = spval - call hist_addfld1d (fname='EMV', units='proportion', & - avgflag='A', long_name='vegetation emissivity', & - ptr_patch=this%emv_patch, default='inactive') - end if - - if (use_cn) then - this%emg_col(begc:endc) = spval - call hist_addfld1d (fname='EMG', units='proportion', & - avgflag='A', long_name='ground emissivity', & - ptr_col=this%emg_col, default='inactive') - end if - - if (use_cn) then - this%beta_col(begc:endc) = spval - call hist_addfld1d (fname='BETA', units='none', & - avgflag='A', long_name='coefficient of convective velocity', & - ptr_col=this%beta_col, default='inactive') - end if - - ! Accumulated quantities - - this%t_veg24_patch(begp:endp) = spval - call hist_addfld1d (fname='TV24', units='K', & - avgflag='A', long_name='vegetation temperature (last 24hrs)', & - ptr_patch=this%t_veg24_patch, default='inactive') - - this%t_veg240_patch(begp:endp) = spval - call hist_addfld1d (fname='TV240', units='K', & - avgflag='A', long_name='vegetation temperature (last 240hrs)', & - ptr_patch=this%t_veg240_patch, default='inactive') - - if (use_crop) then - this%gdd0_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD0', units='ddays', & - avgflag='A', long_name='Growing degree days base 0C from planting', & - ptr_patch=this%gdd0_patch, default='inactive') - end if - - if (use_crop) then - this%gdd8_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD8', units='ddays', & - avgflag='A', long_name='Growing degree days base 8C from planting', & - ptr_patch=this%gdd8_patch, default='inactive') - - this%gdd10_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD10', units='ddays', & - avgflag='A', long_name='Growing degree days base 10C from planting', & - ptr_patch=this%gdd10_patch, default='inactive') - - this%gdd020_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD020', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 0C from planting', & - ptr_patch=this%gdd020_patch, default='inactive') - - this%gdd820_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD820', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 8C from planting', & - ptr_patch=this%gdd820_patch, default='inactive') - - this%gdd1020_patch(begp:endp) = spval - call hist_addfld1d (fname='GDD1020', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 10C from planting', & - ptr_patch=this%gdd1020_patch, default='inactive') - - end if - if(use_luna)then - call hist_addfld1d (fname='TVEGD10', units='Kelvin', & - avgflag='A', long_name='10 day running mean of patch daytime vegetation temperature', & - ptr_patch=this%t_veg10_day_patch, default='inactive') - call hist_addfld1d (fname='TVEGN10', units='Kelvin', & - avgflag='A', long_name='10 day running mean of patch night-time vegetation temperature', & - ptr_patch=this%t_veg10_night_patch, default='inactive') - endif - - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - em_roof_lun, em_wall_lun, em_improad_lun, em_perroad_lun, & - is_simple_buildtemp, is_prog_buildtemp) - ! - ! !DESCRIPTION: - ! Initialize cold start conditions for module variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varcon , only : denice, denh2o, sb - use landunit_varcon, only : istwet, istsoil, istdlak, istice_mec - use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall - use column_varcon , only : icol_shadewall, icol_road_perv - use clm_varctl , only : iulog, use_vancouver, use_mexicocity - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: em_roof_lun(bounds%begl:) - real(r8) , intent(in) :: em_wall_lun(bounds%begl:) - real(r8) , intent(in) :: em_improad_lun(bounds%begl:) - real(r8) , intent(in) :: em_perroad_lun(bounds%begl:) - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used - ! - ! !LOCAL VARIABLES: - integer :: j,l,c,p ! indices - integer :: nlevs ! number of levels - real(r8) :: snowbd ! temporary calculation of snow bulk density (kg/m3) - real(r8) :: fmelt ! snowbd/100 - integer :: lev - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(em_roof_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_wall_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_improad_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_perroad_lun) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - associate(snl => col%snl) ! Output: [integer (:) ] number of snow layers - - ! Set snow/soil temperature - ! t_lake only has valid values over non-lake - ! t_soisno, t_grnd and t_veg have valid values over all land - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - - this%t_soisno_col(c,-nlevsno+1:nlevgrnd) = spval - - ! Snow level temperatures - all land points - if (snl(c) < 0) then - do j = snl(c)+1, 0 - this%t_soisno_col(c,j) = 250._r8 - end do - end if - - ! Below snow temperatures - nonlake points (lake points are set below) - if (.not. lun%lakpoi(l)) then - - if (lun%itype(l)==istice_mec) then - this%t_soisno_col(c,1:nlevgrnd) = 250._r8 - - else if (lun%itype(l) == istwet) then - this%t_soisno_col(c,1:nlevgrnd) = 277._r8 - - else if (lun%urbpoi(l)) then - if (use_vancouver) then - if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - ! Set road top layer to initial air temperature and interpolate other - ! layers down to 20C in bottom layer - do j = 1, nlevgrnd - this%t_soisno_col(c,j) = 297.56 - (j-1) * ((297.56-293.16)/(nlevgrnd-1)) - end do - ! Set wall and roof layers to initial air temperature - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof) then - this%t_soisno_col(c,1:nlevurb) = 297.56 - else - this%t_soisno_col(c,1:nlevgrnd) = 283._r8 - end if - else if (use_mexicocity) then - if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - ! Set road top layer to initial air temperature and interpolate other - ! layers down to 22C in bottom layer - do j = 1, nlevgrnd - this%t_soisno_col(c,j) = 289.46 - (j-1) * ((289.46-295.16)/(nlevgrnd-1)) - end do - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_roof) then - ! Set wall and roof layers to initial air temperature - this%t_soisno_col(c,1:nlevurb) = 289.46 - else - this%t_soisno_col(c,1:nlevgrnd) = 283._r8 - end if - else - if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - this%t_soisno_col(c,1:nlevgrnd) = 274._r8 - else if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall & - .or. col%itype(c) == icol_roof) then - ! Set sunwall, shadewall, roof to fairly high temperature to avoid initialization - ! shock from large heating/air conditioning flux - this%t_soisno_col(c,1:nlevurb) = 292._r8 - end if - end if - else - this%t_soisno_col(c,1:nlevgrnd) = 274._r8 - - endif - endif - end do - - ! Initialize internal building temperature, inner temperatures of building - ! surfaces, and floor temperature - if ( is_prog_buildtemp )then - do l = bounds%begl, bounds%endl - do c = lun%coli(l),lun%colf(l) - if (col%itype(c) == icol_roof) then - this%t_roof_inner_lun(l) = this%t_soisno_col(c,nlevurb) - this%t_building_lun(l) = this%t_soisno_col(c,nlevurb) ! arbitrarily set to roof temperature - this%t_floor_lun(l) = this%t_soisno_col(c,nlevurb) ! arbitrarily set to roof temperature - else if (col%itype(c) == icol_sunwall) then - this%t_sunw_inner_lun(l) = this%t_soisno_col(c,nlevurb) - else if (col%itype(c) == icol_shadewall) then - this%t_shdw_inner_lun(l) = this%t_soisno_col(c,nlevurb) - end if - end do - end do - end if - - ! Set Ground temperatures - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - - if (lun%lakpoi(l)) then - this%t_grnd_col(c) = 277._r8 - else - this%t_grnd_col(c) = this%t_soisno_col(c,snl(c)+1) - end if - this%t_soi17cm_col(c) = this%t_grnd_col(c) - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%lakpoi(l)) then ! lake - this%t_lake_col(c,1:nlevlak) = this%t_grnd_col(c) - this%t_soisno_col(c,1:nlevgrnd) = this%t_grnd_col(c) - end if - end do - - ! Set t_h2osfc_col - - this%t_h2osfc_col(bounds%begc:bounds%endc) = 274._r8 - - ! Set t_veg, t_ref2m, t_ref2m_u and tref2m_r - - do p = bounds%begp, bounds%endp - c = patch%column(p) - l = patch%landunit(p) - - if (use_vancouver) then - this%t_veg_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_veg_patch(p) = 289.46 - else - this%t_veg_patch(p) = 283._r8 - end if - - if (use_vancouver) then - this%t_ref2m_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_ref2m_patch(p) = 289.46 - else - this%t_ref2m_patch(p) = 283._r8 - end if - - if (lun%urbpoi(l)) then - if (use_vancouver) then - this%t_ref2m_u_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_ref2m_u_patch(p) = 289.46 - else - this%t_ref2m_u_patch(p) = 283._r8 - end if - else - if (.not. lun%ifspecial(l)) then - if (use_vancouver) then - this%t_ref2m_r_patch(p) = 297.56 - else if (use_mexicocity) then - this%t_ref2m_r_patch(p) = 289.46 - else - this%t_ref2m_r_patch(p) = 283._r8 - end if - else - this%t_ref2m_r_patch(p) = spval - end if - end if - - end do - - end associate - - do l = bounds%begl, bounds%endl - if (lun%urbpoi(l)) then - if (use_vancouver) then - this%taf_lun(l) = 297.56_r8 - else if (use_mexicocity) then - this%taf_lun(l) = 289.46_r8 - else - this%taf_lun(l) = 283._r8 - end if - end if - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - - if (col%itype(c) == icol_roof ) this%emg_col(c) = em_roof_lun(l) - if (col%itype(c) == icol_sunwall ) this%emg_col(c) = em_wall_lun(l) - if (col%itype(c) == icol_shadewall ) this%emg_col(c) = em_wall_lun(l) - if (col%itype(c) == icol_road_imperv) this%emg_col(c) = em_improad_lun(l) - if (col%itype(c) == icol_road_perv ) this%emg_col(c) = em_perroad_lun(l) - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, is_simple_buildtemp, is_prog_buildtemp) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_double, ncd_int - use restUtilMod - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - logical , intent(in) :: is_simple_buildtemp ! Simple building temp is being used - logical , intent(in) :: is_prog_buildtemp ! Prognostic building temp is being used - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - call restartvar(ncid=ncid, flag=flag, varname='T_SOISNO', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='soil-snow temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_soisno_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_VEG', xtype=ncd_double, & - dim1name='pft', & - long_name='vegetation temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg_patch) - - call restartvar(ncid=ncid, flag=flag, varname='TH2OSFC', xtype=ncd_double, & - dim1name='column', & - long_name='surface water temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_h2osfc_col) - if (flag=='read' .and. .not. readvar) then - this%t_h2osfc_col(bounds%begc:bounds%endc) = 274.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='T_LAKE', xtype=ncd_double, & - dim1name='column', dim2name='levlak', switchdim=.true., & - long_name='lake temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_lake_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_GRND', xtype=ncd_double, & - dim1name='column', & - long_name='ground temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_grnd_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_GRND_R', xtype=ncd_double, & - dim1name='column', & - long_name='rural ground temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_grnd_r_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_GRND_U', xtype=ncd_double, & - dim1name='column', & - long_name='urban ground temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_grnd_u_col) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M', xtype=ncd_double, & - dim1name='pft', & - long_name='2m height surface air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_patch) - if (flag=='read' .and. .not. readvar) call endrun(msg=errMsg(sourcefile, __LINE__)) - - call restartvar(ncid=ncid, flag=flag, varname="T_REF2M_R", xtype=ncd_double, & - dim1name='pft', & - long_name='Rural 2m height surface air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname="T_REF2M_U", xtype=ncd_double, dim1name='pft', & - long_name='Urban 2m height surface air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_u_patch) - - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN', xtype=ncd_double, & - dim1name='pft', & - long_name='daily minimum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural daily minimum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_U', xtype=ncd_double, dim1name='pft', & - long_name='urban daily minimum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX', xtype=ncd_double, & - dim1name='pft', & - long_name='daily maximum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural daily maximum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_U', xtype=ncd_double, dim1name='pft', & - long_name='urban daily maximum of average 2 m height surface air temperature (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily min of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_inst_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_INST_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural instantaneous daily min of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_inst_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MIN_INST_U', xtype=ncd_double, dim1name='pft', & - long_name='urban instantaneous daily min of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_min_inst_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily max of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_inst_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_INST_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural instantaneous daily max of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_inst_r_patch) - - call restartvar(ncid=ncid, flag=flag, varname='T_REF2M_MAX_INST_U', xtype=ncd_double, dim1name='pft', & - long_name='urban instantaneous daily max of average 2 m height surface air temp (K)', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_ref2m_max_inst_u_patch) - - call restartvar(ncid=ncid, flag=flag, varname='taf', xtype=ncd_double, dim1name='landunit', & - long_name='urban canopy air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%taf_lun) - - if (use_crop) then - call restartvar(ncid=ncid, flag=flag, varname='gdd1020', xtype=ncd_double, & - dim1name='pft', long_name='20 year average of growing degree-days base 10C from planting', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gdd1020_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gdd820', xtype=ncd_double, & - dim1name='pft', long_name='20 year average of growing degree-days base 8C from planting', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gdd820_patch) - - call restartvar(ncid=ncid, flag=flag, varname='gdd020', xtype=ncd_double, & - dim1name='pft', long_name='20 year average of growing degree-days base 0C from planting', units='ddays', & - interpinic_flag='interp', readvar=readvar, data=this%gdd020_patch) - end if - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='tvegd10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean daytime vegetation temperature', units='Kelvin', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg10_day_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tvegd', xtype=ncd_double, & - dim1name='pft', long_name='accumulative daytime vegetation temperature', units='Kelvin*steps', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg_day_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tvegn10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean nighttime vegetation temperature', units='Kelvin', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg10_night_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tvegn', xtype=ncd_double, & - dim1name='pft', long_name='accumulative nighttime vegetation temperature', units='Kelvin*steps', & - interpinic_flag='interp', readvar=readvar, data=this%t_veg_night_patch ) - call restartvar(ncid=ncid, flag=flag, varname='tair10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean air temperature', units='Kelvin', & - interpinic_flag='interp', readvar=readvar, data=this%t_a10_patch ) - call restartvar(ncid=ncid, flag=flag, varname='ndaysteps', xtype=ncd_int, & - dim1name='pft', long_name='accumulative daytime steps', units='steps', & - interpinic_flag='interp', readvar=readvar, data=this%ndaysteps_patch ) - call restartvar(ncid=ncid, flag=flag, varname='nnightsteps', xtype=ncd_int, & - dim1name='pft', long_name='accumulative nighttime steps', units='steps', & - interpinic_flag='interp', readvar=readvar, data=this%nnightsteps_patch ) - endif - - if ( is_prog_buildtemp )then - ! landunit type physical state variable - t_building - call restartvar(ncid=ncid, flag=flag, varname='t_building', xtype=ncd_double, & - dim1name='landunit', & - long_name='internal building air temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_building_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_building in initial file..." - if (masterproc) write(iulog,*) "Initialize t_building to taf" - this%t_building_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_roof_inner - call restartvar(ncid=ncid, flag=flag, varname='t_roof_inner', xtype=ncd_double, & - dim1name='landunit', & - long_name='roof inside surface temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_roof_inner_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_roof_inner in initial file..." - if (masterproc) write(iulog,*) "Initialize t_roof_inner to taf" - this%t_roof_inner_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_sunw_inner - call restartvar(ncid=ncid, flag=flag, varname='t_sunw_inner', xtype=ncd_double, & - dim1name='landunit', & - long_name='sunwall inside surface temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_sunw_inner_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_sunw_inner in initial file..." - if (masterproc) write(iulog,*) "Initialize t_sunw_inner to taf" - this%t_sunw_inner_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_shdw_inner - call restartvar(ncid=ncid, flag=flag, varname='t_shdw_inner', xtype=ncd_double, & - dim1name='landunit', & - long_name='shadewall inside surface temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_shdw_inner_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_shdw_inner in initial file..." - if (masterproc) write(iulog,*) "Initialize t_shdw_inner to taf" - this%t_shdw_inner_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - - ! landunit type physical state variable - t_floor - call restartvar(ncid=ncid, flag=flag, varname='t_floor', xtype=ncd_double, & - dim1name='landunit', & - long_name='floor temperature', units='K', & - interpinic_flag='interp', readvar=readvar, data=this%t_floor_lun) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "can't find t_floor in initial file..." - if (masterproc) write(iulog,*) "Initialize t_floor to taf" - this%t_floor_lun(bounds%begl:bounds%endl) = this%taf_lun(bounds%begl:bounds%endl) - end if - end if - - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! Each interval and accumulation type is unique to each field processed. - ! Routine [initAccBuffer] defines the fields to be processed - ! and the type of accumulation. - ! Routine [updateAccVars] does the actual accumulation for a given field. - ! Fields are accumulated by calls to subroutine [update_accum_field]. - ! To accumulate a field, it must first be defined in subroutine [initAccVars] - ! and then accumulated by calls to [updateAccVars]. - ! Four types of accumulations are possible: - ! o average over time interval - ! o running mean over time interval - ! o running accumulation over time interval - ! Time average fields are only valid at the end of the averaging interval. - ! Running means are valid once the length of the simulation exceeds the - ! averaging interval. Accumulated fields are continuously accumulated. - ! The trigger value "-99999." resets the accumulation to zero. - ! - ! !USES - use accumulMod , only : init_accum_field - use clm_time_manager , only : get_step_size - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8) :: dtime - integer, parameter :: not_used = huge(1) - !--------------------------------------------------------------------- - - dtime = get_step_size() - - this%t_veg24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='T_VEG24', units='K', & - desc='24hr average of vegetation temperature', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%t_veg240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='T_VEG240', units='K', & - desc='240hr average of vegetation temperature', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field(name='TREFAV', units='K', & - desc='average over an hour of 2-m temperature', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field(name='TREFAV_U', units='K', & - desc='average over an hour of urban 2-m temperature', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field(name='TREFAV_R', units='K', & - desc='average over an hour of rural 2-m temperature', accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! The following is a running mean. The accumulation period is set to -10 for a 10-day running mean. - call init_accum_field (name='T10', units='K', & - desc='10-day running mean of 2-m temperature', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ+20._r8) - - if ( use_crop )then - call init_accum_field (name='TDM10', units='K', & - desc='10-day running mean of min 2-m temperature', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) - - call init_accum_field (name='TDM5', units='K', & - desc='5-day running mean of min 2-m temperature', accum_type='runmean', accum_period=-5, & - subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) - end if - - if ( use_crop )then - - ! All GDD summations are relative to the planting date (Kucharik & Brye 2003) - call init_accum_field (name='GDD0', units='K', & - desc='growing degree-days base 0C from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDD8', units='K', & - desc='growing degree-days base 8C from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDD10', units='K', & - desc='growing degree-days base 10C from planting', accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end if - - if (use_cndv) then - ! 30-day average of 2m temperature. - call init_accum_field (name='TDA', units='K', & - desc='30-day average of 2-m temperature', accum_type='timeavg', accum_period=-30, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - end if - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : init_accum_field, extract_accum_field - use clm_time_manager , only : get_nstep - use clm_varctl , only : nsrest, nsrStartup - use abortutils , only : endrun - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - ! Allocate needed dynamic memory for single level pft field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="extract_accum_hist allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - - ! Determine time step - nstep = get_nstep() - - call extract_accum_field ('T_VEG24', rbufslp, nstep) - this%t_veg24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('T_VEG240', rbufslp, nstep) - this%t_veg240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('T10', rbufslp, nstep) - this%t_a10_patch(begp:endp) = rbufslp(begp:endp) - - if (use_crop) then - call extract_accum_field ('TDM10', rbufslp, nstep) - this%t_a10min_patch(begp:endp)= rbufslp(begp:endp) - - call extract_accum_field ('TDM5', rbufslp, nstep) - this%t_a5min_patch(begp:endp) = rbufslp(begp:endp) - end if - - ! Initialize variables that are to be time accumulated - ! Initialize 2m ref temperature max and min values - - if (nsrest == nsrStartup) then - this%t_ref2m_max_patch(begp:endp) = spval - this%t_ref2m_max_r_patch(begp:endp) = spval - this%t_ref2m_max_u_patch(begp:endp) = spval - - this%t_ref2m_min_patch(begp:endp) = spval - this%t_ref2m_min_r_patch(begp:endp) = spval - this%t_ref2m_min_u_patch(begp:endp) = spval - - this%t_ref2m_max_inst_patch(begp:endp) = -spval - this%t_ref2m_max_inst_r_patch(begp:endp) = -spval - this%t_ref2m_max_inst_u_patch(begp:endp) = -spval - - this%t_ref2m_min_inst_patch(begp:endp) = spval - this%t_ref2m_min_inst_r_patch(begp:endp) = spval - this%t_ref2m_min_inst_u_patch(begp:endp) = spval - end if - - if ( use_crop ) then - - call extract_accum_field ('GDD0', rbufslp, nstep) - this%gdd0_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('GDD8', rbufslp, nstep) ; - this%gdd8_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('GDD10', rbufslp, nstep) - this%gdd10_patch(begp:endp) = rbufslp(begp:endp) - - end if - - deallocate(rbufslp) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use shr_const_mod , only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date - use accumulMod , only : update_accum_field, extract_accum_field, accumResetVal - ! - ! !ARGUMENTS: - class(temperature_type) :: this - type(bounds_type) , intent(in) :: bounds - - ! - ! !LOCAL VARIABLES: - integer :: m,g,l,c,p ! indices - integer :: ier ! error status - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - logical :: end_cd ! temporary for is_end_curr_day() value - integer :: begp, endp - real(r8), pointer :: rbufslp(:) ! temporary single level - pft level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Allocate needed dynamic memory for single level pft field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract T_VEG24 & T_VEG240 - do p = begp,endp - rbufslp(p) = this%t_veg_patch(p) - end do - call update_accum_field ('T_VEG24' , rbufslp , nstep) - call extract_accum_field ('T_VEG24' , this%t_veg24_patch , nstep) - call update_accum_field ('T_VEG240', rbufslp , nstep) - call extract_accum_field ('T_VEG240', this%t_veg240_patch , nstep) - - ! Accumulate and extract TREFAV - hourly average 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV', this%t_ref2m_patch, nstep) - call extract_accum_field ('TREFAV', rbufslp, nstep) - end_cd = is_end_curr_day() - do p = begp,endp - if (rbufslp(p) /= spval) then - this%t_ref2m_max_inst_patch(p) = max(rbufslp(p), this%t_ref2m_max_inst_patch(p)) - this%t_ref2m_min_inst_patch(p) = min(rbufslp(p), this%t_ref2m_min_inst_patch(p)) - endif - if (end_cd) then - this%t_ref2m_max_patch(p) = this%t_ref2m_max_inst_patch(p) - this%t_ref2m_min_patch(p) = this%t_ref2m_min_inst_patch(p) - this%t_ref2m_max_inst_patch(p) = -spval - this%t_ref2m_min_inst_patch(p) = spval - else if (secs == dtime) then - this%t_ref2m_max_patch(p) = spval - this%t_ref2m_min_patch(p) = spval - endif - end do - - ! Accumulate and extract TREFAV_U - hourly average urban 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV_U', this%t_ref2m_u_patch, nstep) - call extract_accum_field ('TREFAV_U', rbufslp, nstep) - do p = begp,endp - l = patch%landunit(p) - if (rbufslp(p) /= spval) then - this%t_ref2m_max_inst_u_patch(p) = max(rbufslp(p), this%t_ref2m_max_inst_u_patch(p)) - this%t_ref2m_min_inst_u_patch(p) = min(rbufslp(p), this%t_ref2m_min_inst_u_patch(p)) - endif - if (end_cd) then - if (lun%urbpoi(l)) then - this%t_ref2m_max_u_patch(p) = this%t_ref2m_max_inst_u_patch(p) - this%t_ref2m_min_u_patch(p) = this%t_ref2m_min_inst_u_patch(p) - this%t_ref2m_max_inst_u_patch(p) = -spval - this%t_ref2m_min_inst_u_patch(p) = spval - end if - else if (secs == dtime) then - this%t_ref2m_max_u_patch(p) = spval - this%t_ref2m_min_u_patch(p) = spval - endif - end do - - ! Accumulate and extract TREFAV_R - hourly average rural 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV_R', this%t_ref2m_r_patch, nstep) - call extract_accum_field ('TREFAV_R', rbufslp, nstep) - do p = begp,endp - l = patch%landunit(p) - if (rbufslp(p) /= spval) then - this%t_ref2m_max_inst_r_patch(p) = max(rbufslp(p), this%t_ref2m_max_inst_r_patch(p)) - this%t_ref2m_min_inst_r_patch(p) = min(rbufslp(p), this%t_ref2m_min_inst_r_patch(p)) - endif - if (end_cd) then - if (.not.(lun%ifspecial(l))) then - this%t_ref2m_max_r_patch(p) = this%t_ref2m_max_inst_r_patch(p) - this%t_ref2m_min_r_patch(p) = this%t_ref2m_min_inst_r_patch(p) - this%t_ref2m_max_inst_r_patch(p) = -spval - this%t_ref2m_min_inst_r_patch(p) = spval - end if - else if (secs == dtime) then - this%t_ref2m_max_r_patch(p) = spval - this%t_ref2m_min_r_patch(p) = spval - endif - end do - - ! Accumulate and extract T10 - !(acumulates TSA as 10-day running mean) - - call update_accum_field ('T10', this%t_ref2m_patch, nstep) - call extract_accum_field ('T10', this%t_a10_patch, nstep) - - if ( use_crop )then - ! Accumulate and extract TDM10 - - do p = begp,endp - rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM10', rbufslp, nstep) - call extract_accum_field ('TDM10', this%t_a10min_patch, nstep) - - ! Accumulate and extract TDM5 - - do p = begp,endp - rbufslp(p) = min(this%t_ref2m_min_patch(p),this%t_ref2m_min_inst_patch(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM5', rbufslp, nstep) - call extract_accum_field ('TDM5', this%t_a5min_patch, nstep) - - ! Accumulate and extract GDD0 - - do p = begp,endp - ! Avoid unnecessary calculations over inactive points - if (patch%active(p)) then - g = patch%gridcell(p) - if (month==1 .and. day==1 .and. secs==dtime) then - rbufslp(p) = accumResetVal ! reset gdd - else if (( month > 3 .and. month < 10 .and. grc%latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. grc%latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(26._r8, this%t_ref2m_patch(p)-SHR_CONST_TKFRZ)) * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end if - end do - call update_accum_field ('GDD0', rbufslp, nstep) - call extract_accum_field ('GDD0', this%gdd0_patch, nstep) - - ! Accumulate and extract GDD8 - - do p = begp,endp - ! Avoid unnecessary calculations over inactive points - if (patch%active(p)) then - g = patch%gridcell(p) - if (month==1 .and. day==1 .and. secs==dtime) then - rbufslp(p) = accumResetVal ! reset gdd - else if (( month > 3 .and. month < 10 .and. grc%latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. grc%latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(30._r8, & - this%t_ref2m_patch(p)-(SHR_CONST_TKFRZ + 8._r8))) * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end if - end do - call update_accum_field ('GDD8', rbufslp, nstep) - call extract_accum_field ('GDD8', this%gdd8_patch, nstep) - - ! Accumulate and extract GDD10 - - do p = begp,endp - ! Avoid unnecessary calculations over inactive points - if (patch%active(p)) then - g = patch%gridcell(p) - if (month==1 .and. day==1 .and. secs==dtime) then - rbufslp(p) = accumResetVal ! reset gdd - else if (( month > 3 .and. month < 10 .and. grc%latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. grc%latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(30._r8, & - this%t_ref2m_patch(p)-(SHR_CONST_TKFRZ + 10._r8))) * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end if - end do - call update_accum_field ('GDD10', rbufslp, nstep) - call extract_accum_field ('GDD10', this%gdd10_patch, nstep) - - end if - - deallocate(rbufslp) - - end subroutine UpdateAccVars - -end module TemperatureType diff --git a/src/biogeophys/TotalWaterAndHeatMod.F90 b/src/biogeophys/TotalWaterAndHeatMod.F90 deleted file mode 100644 index 7b9153a029..0000000000 --- a/src/biogeophys/TotalWaterAndHeatMod.F90 +++ /dev/null @@ -1,909 +0,0 @@ -module TotalWaterAndHeatMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Routines for computing total column water and heat contents - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varcon , only : cpice, cpliq, denh2o, tfrz, hfus, aquifer_water_baseline - use clm_varpar , only : nlevgrnd, nlevsoi, nlevurb - use ColumnType , only : col - use LandunitType , only : lun - use subgridAveMod , only : p2c - use SoilHydrologyType , only : soilhydrology_type - use WaterstateType , only : waterstate_type - use UrbanParamsType , only : urbanparams_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv, icol_road_imperv - use landunit_varcon , only : istdlak, istsoil,istcrop,istwet,istice_mec - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - - ! For water (ComputeWaterMass* / ComputeLiqIceMass*): We have separate routines for lake - ! vs. non-lake because parts of the code call just one or the other. - ! - ! For heat (ComputeHeat*): We use separate routines for lake vs. non-lake to keep these - ! routines parallel with the water routines. - public :: ComputeWaterMassNonLake ! Compute total water mass of non-lake columns - public :: ComputeWaterMassLake ! Compute total water mass of lake columns - public :: ComputeLiqIceMassNonLake ! Compute total water mass of non-lake columns, separated into liquid and ice - public :: ComputeLiqIceMassLake ! Compute total water mass of lake columns, separated into liquid and ice - public :: ComputeHeatNonLake ! Compute heat content of non-lake columns - public :: ComputeHeatLake ! Compute heat content of lake columns - public :: AdjustDeltaHeatForDeltaLiq ! Adjusts the change in gridcell heat content due to land cover change to account for the implicit heat flux associated with delta_liq - public :: LiquidWaterHeat ! Get the total heat content of some mass of liquid water at a given temperature - - ! - ! !PUBLIC MEMBER DATA: - - ! While some parts of the code work just fine with any heat_base_temp, other parts - ! currently wouldn't work right if we changed this value. This is all related to the - ! fact that we don't currently track temperature explicitly for all components of the - ! system. Specifically: - ! - ! (1) For liquid water pools that don't have an explicit temperature, we assume a - ! temperature of heat_base_temp. This is not a terrible assumption for - ! heat_base_temp = tfrz, but would be a terrible assumption for (e.g.) - ! heat_base_temp = 0. - ! - ! (2) In AdjustDeltaHeatForDeltaLiq, we currently don't account for the energy - ! associated with delta_ice (as we do for delta_liq). This amounts to implicitly - ! assuming that this ice runoff is at heat_base_temp (this is tied in with the fact - ! that we don't explicitly track the temperature of runoff). This makes sense for - ! heat_base_temp = tfrz, but wouldn't make sense for other values of heat_base_temp. - real(r8), parameter, public :: heat_base_temp = tfrz ! Base temperature for heat sums [K] - - ! ------------------------------------------------------------------------ - ! The following are public just to support unit testing; they shouldn't be used by other code - ! ------------------------------------------------------------------------ - - ! Minimum and maximum temperatures for the water temperature used by AdjustDeltaHeatForDeltaLiq - real(r8), parameter :: DeltaLiqMinTemp = tfrz ! [K] - real(r8), parameter :: DeltaLiqMaxTemp = tfrz + 35._r8 ! [K] - - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: AccumulateLiquidWaterHeat ! For use by ComputeHeat* routines: accumulate quantities that we need to count for liquid water, for a single column - private :: TempToHeat ! For use by ComputeHeat* routines: convert temperature to heat content - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine ComputeWaterMassNonLake(bounds, num_nolakec, filter_nolakec, & - soilhydrology_inst, waterstate_inst, water_mass) - ! - ! !DESCRIPTION: - ! Compute total water mass for all non-lake columns - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(inout) :: water_mass( bounds%begc: ) ! computed water mass (kg m-2) - ! - ! !LOCAL VARIABLES: - real(r8) :: liquid_mass(bounds%begc:bounds%endc) ! kg m-2 - real(r8) :: ice_mass(bounds%begc:bounds%endc) ! kg m-2 - integer :: fc, c - - character(len=*), parameter :: subname = 'ComputeWaterMassNonLake' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(water_mass) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - call ComputeLiqIceMassNonLake( & - bounds = bounds, & - num_nolakec = num_nolakec, & - filter_nolakec = filter_nolakec, & - soilhydrology_inst = soilhydrology_inst, & - waterstate_inst = waterstate_inst, & - liquid_mass = liquid_mass(bounds%begc:bounds%endc), & - ice_mass = ice_mass(bounds%begc:bounds%endc)) - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - water_mass(c) = liquid_mass(c) + ice_mass(c) - end do - - end subroutine ComputeWaterMassNonLake - - !----------------------------------------------------------------------- - subroutine ComputeWaterMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, water_mass) - ! - ! !DESCRIPTION: - ! Compute total water mass for all lake columns - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(inout) :: water_mass( bounds%begc: ) ! computed water mass (kg m-2) - ! - ! !LOCAL VARIABLES: - real(r8) :: liquid_mass(bounds%begc:bounds%endc) ! kg m-2 - real(r8) :: ice_mass(bounds%begc:bounds%endc) ! kg m-2 - integer :: fc, c - - character(len=*), parameter :: subname = 'ComputeWaterMassLake' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(water_mass) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - call ComputeLiqIceMassLake( & - bounds = bounds, & - num_lakec = num_lakec, & - filter_lakec = filter_lakec, & - waterstate_inst = waterstate_inst, & - liquid_mass = liquid_mass(bounds%begc:bounds%endc), & - ice_mass = ice_mass(bounds%begc:bounds%endc)) - - do fc = 1, num_lakec - c = filter_lakec(fc) - water_mass(c) = liquid_mass(c) + ice_mass(c) - end do - - end subroutine ComputeWaterMassLake - - - !----------------------------------------------------------------------- - subroutine ComputeLiqIceMassNonLake(bounds, num_nolakec, filter_nolakec, & - soilhydrology_inst, waterstate_inst, liquid_mass, ice_mass) - ! - ! !DESCRIPTION: - ! Compute total water mass for all non-lake columns, separated into liquid and ice - ! - ! Note: Changes to this routine should generally be accompanied by similar changes - ! to ComputeHeatNonLake - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! computed liquid water mass (kg m-2) - real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! computed ice mass (kg m-2) - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices - logical :: has_h2o ! whether this point potentially has water to add - real(r8) :: h2ocan_col(bounds%begc:bounds%endc) ! canopy water (mm H2O) - real(r8) :: snocan_col(bounds%begc:bounds%endc) ! canopy snow water (mm H2O) - real(r8) :: liqcan ! canopy liquid water (mm H2O) - - character(len=*), parameter :: subname = 'ComputeLiqIceMassNonLake' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(liquid_mass) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ice_mass) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl , & ! Input: [integer (:) ] negative number of snow layers - - h2osfc => waterstate_inst%h2osfc_col , & ! Input: [real(r8) (:) ] surface water (mm) - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2ocan_patch => waterstate_inst%h2ocan_patch , & ! Input: [real(r8) (:) ] canopy water (mm H2O) - snocan_patch => waterstate_inst%snocan_patch , & ! Input: [real(r8) (:) ] canopy snow water (mm H2O) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - total_plant_stored_h2o => waterstate_inst%total_plant_stored_h2o_col, & - ! Input: [real(r8) (:,:) ] plant internal stored water (mm H2O) - wa => soilhydrology_inst%wa_col & ! Input: [real(r8) (:) ] water in the unconfined aquifer (mm) - ) - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - liquid_mass(c) = 0._r8 - ice_mass(c) = 0._r8 - end do - - call p2c(bounds, num_nolakec, filter_nolakec, & - h2ocan_patch(bounds%begp:bounds%endp), & - h2ocan_col(bounds%begc:bounds%endc)) - - call p2c(bounds, num_nolakec, filter_nolakec, & - snocan_patch(bounds%begp:bounds%endp), & - snocan_col(bounds%begc:bounds%endc)) - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - - ! waterstate_inst%snocan_patch and waterstate_inst%liqcan_patch are only set if - ! we're using snow-on-veg; otherwise they are 0. However, we can rely on - ! h2ocan_patch being set in all cases, so we can always determine the liquid mass - ! as (h2ocan - snocan). - ! Note the difference between liqcan and total_plant_stored_h2o. The prior - ! is that which exists on the vegetation canopy surface, the latter is - ! that which exists within the plant xylems and tissues. In cases - ! where FATES hydraulics is not turned on, this total_plant_stored_h2o is - ! non-changing, and is set to 0 for a trivial solution. - - liqcan = h2ocan_col(c) - snocan_col(c) - liquid_mass(c) = liquid_mass(c) + liqcan + total_plant_stored_h2o(c) - ice_mass(c) = ice_mass(c) + snocan_col(c) - - if (snl(c) < 0) then - ! Loop over snow layers - do j = snl(c)+1,0 - liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) - ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) - end do - else if (h2osno(c) /= 0._r8) then - ! No explicit snow layers, but there may still be some ice in h2osno (there is - ! no liquid water in this case) - ice_mass(c) = ice_mass(c) + h2osno(c) - end if - - if (col%hydrologically_active(c)) then - ! It's important to exclude non-hydrologically-active points, because some of - ! them have wa set, but seemingly incorrectly (set to 4000). - - ! NOTE(wjs, 2017-03-23) We subtract aquifer_water_baseline because water in the - ! unconfined aquifer is in some senses a virtual water pool. For CLM45 physics, - ! it isn't clear to me if this subtraction is the "right" thing to do (it can - ! lead to a net negative value, though that's probably okay). But we definitely - ! want to do it for CLM5 physics: there, wa stays fixed at 5000 for - ! hydrologically-active columns, yet this apparently doesn't interact with the - ! system, so we don't want to count that water mass in the total column water. - liquid_mass(c) = liquid_mass(c) + (wa(c) - aquifer_water_baseline) - end if - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall & - .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_road_imperv) then - ! Nothing more to add in this case - else - liquid_mass(c) = liquid_mass(c) + h2osfc(c) - end if - end do - - ! Soil water content - do j = 1, nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if (col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall) then - has_h2o = .false. - else if (col%itype(c) == icol_roof) then - if (j <= nlevurb) then - has_h2o = .true. - else - has_h2o = .false. - end if - else - has_h2o = .true. - end if - - if (has_h2o) then - liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) - ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) - end if - end do - end do - - end associate - - end subroutine ComputeLiqIceMassNonLake - - !----------------------------------------------------------------------- - subroutine ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, liquid_mass, ice_mass) - ! - ! !DESCRIPTION: - ! Compute total water mass for all lake columns, separated into liquid and ice - ! - ! Note: Changes to this routine should generally be accompanied by similar changes - ! to ComputeHeatLake - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec ! number of column lake points in column filter - integer , intent(in) :: filter_lakec(:) ! column filter for lake points - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(inout) :: liquid_mass( bounds%begc: ) ! computed liquid water mass (kg m-2) - real(r8) , intent(inout) :: ice_mass( bounds%begc: ) ! computed ice mass (kg m-2) - ! - ! !LOCAL VARIABLES: - integer :: c, j, fc ! indices - - character(len=*), parameter :: subname = 'ComputeLiqIceMassLake' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(liquid_mass) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ice_mass) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl , & ! Input: [integer (:) ] negative number of snow layers - - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - ) - - do fc = 1, num_lakec - c = filter_lakec(fc) - liquid_mass(c) = 0._r8 - ice_mass(c) = 0._r8 - end do - - ! Snow water content - do fc = 1, num_lakec - c = filter_lakec(fc) - if (snl(c) < 0) then - ! Loop over snow layers - do j = snl(c)+1,0 - liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) - ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) - end do - else if (h2osno(c) /= 0._r8) then - ! No explicit snow layers, but there may still be some ice in h2osno (there is - ! no liquid water in this case) - ice_mass(c) = ice_mass(c) + h2osno(c) - end if - end do - - ! Soil water content of the soil under the lake - do j = 1, nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - liquid_mass(c) = liquid_mass(c) + h2osoi_liq(c,j) - ice_mass(c) = ice_mass(c) + h2osoi_ice(c,j) - end do - end do - - end associate - - end subroutine ComputeLiqIceMassLake - - !----------------------------------------------------------------------- - subroutine ComputeHeatNonLake(bounds, num_nolakec, filter_nolakec, & - urbanparams_inst, soilstate_inst, & - temperature_inst, waterstate_inst, soilhydrology_inst, & - heat, heat_liquid, cv_liquid) - ! - ! !DESCRIPTION: - ! Compute total heat content for all non-lake columns. - ! - ! Optionally, also return the total heat content just of liquid water for each column - ! (excluding latent heat), and/or the total heat capacity just of liquid water for - ! each column. Together, these can be used by the caller to compute the weighted - ! average liquid water temperature (with weightings done by the water mass). - ! - ! Note: Changes to this routine - for anything involving liquid or ice - should - ! generally be accompanied by similar changes to ComputeLiqIceMassNonLake - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - - real(r8) , intent(inout) :: heat( bounds%begc: ) ! sum of heat content for all columns [J/m^2] - real(r8) , intent(inout) :: heat_liquid( bounds%begc: ) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] - real(r8) , intent(inout) :: cv_liquid( bounds%begc: ) ! sum of liquid heat capacity for all columns [J/(m^2 K)] - ! - ! !LOCAL VARIABLES: - integer :: fc - integer :: l,c,j - - logical :: has_h2o ! whether this point potentially has water to add - - real(r8) :: h2ocan_col(bounds%begc:bounds%endc) ! canopy water (mm H2O) - real(r8) :: snocan_col(bounds%begc:bounds%endc) ! canopy snow water (mm H2O) - real(r8) :: liqcan ! canopy liquid water (mm H2O) - - real(r8) :: heat_dry_mass(bounds%begc:bounds%endc) ! sum of heat content: dry mass [J/m^2] - real(r8) :: heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice [J/m^2] - real(r8) :: latent_heat_liquid(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water [J/m^2] - - character(len=*), parameter :: subname = 'ComputeHeatNonLake' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(heat) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(heat_liquid) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv_liquid) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl, & ! number of snow layers - dz => col%dz, & ! layer depth (m) - nlev_improad => urbanparams_inst%nlev_improad, & ! number of impervious road layers - cv_wall => urbanparams_inst%cv_wall, & ! heat capacity of urban wall (J/m^3/K) - cv_roof => urbanparams_inst%cv_roof, & ! heat capacity of urban roof (J/m^3/K) - cv_improad => urbanparams_inst%cv_improad, & ! heat capacity of urban impervious road (J/m^3/K) - watsat => soilstate_inst%watsat_col, & ! volumetric soil water at saturation (porosity) - csol => soilstate_inst%csol_col, & ! heat capacity, soil solids (J/m**3/Kelvin) - t_soisno => temperature_inst%t_soisno_col, & ! soil temperature (Kelvin) - t_h2osfc => temperature_inst%t_h2osfc_col, & ! surface water temperature (Kelvin) - h2osoi_liq => waterstate_inst%h2osoi_liq_col, & ! liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col, & ! frozen water (kg/m2) - h2osno => waterstate_inst%h2osno_col, & ! snow water (mm H2O) - h2osfc => waterstate_inst%h2osfc_col, & ! surface water (mm H2O) - h2ocan_patch => waterstate_inst%h2ocan_patch, & ! canopy water (mm H2O) - snocan_patch => waterstate_inst%snocan_patch, & ! canopy snow water (mm H2O) - total_plant_stored_h2o_col => waterstate_inst%total_plant_stored_h2o_col, & ! Input: [real(r8) (:) ] water mass in plant tissues (kg m-2) - wa => soilhydrology_inst%wa_col & ! water in the unconfined aquifer (mm) - ) - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - - heat_liquid(c) = 0._r8 - cv_liquid(c) = 0._r8 - heat_dry_mass(c) = 0._r8 - heat_ice(c) = 0._r8 - latent_heat_liquid(c) = 0._r8 - end do - - call p2c(bounds, & - parr = h2ocan_patch(bounds%begp:bounds%endp), & - carr = h2ocan_col(bounds%begc:bounds%endc), & - p2c_scale_type = 'unity') - - call p2c(bounds, & - parr = snocan_patch(bounds%begp:bounds%endp), & - carr = snocan_col(bounds%begc:bounds%endc), & - p2c_scale_type = 'unity') - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - - !--- canopy water --- - ! - ! TODO(wjs, 2017-03-11) Canopy water currently doesn't have an explicit - ! temperature; thus, we only add its latent heat of fusion. Eventually, we should - ! probably track its temperature explicitly - or at least give it an implicit - ! temperature for the sake of these energy calculations (I think that's needed for - ! full conservation). - ! - ! However, we still call the standard AccumulateLiquidWaterHeat routine, so that we - ! average in a heat_base_temp value in heat_liquid. I think this will generally - ! lead to less of a sensible heat flux adjustment needed by the dynbal energy - ! conservation code. (But I went back and forth on whether to do this, so could - ! be convinced otherwise.) - - ! snocan and liqcan are only set if we're using snow-on-veg; otherwise they are 0. - ! However, we can rely on h2ocan being set in all cases, so we can always - ! determine the liquid mass as (h2ocan - snocan). - - ! Note (rgk 04-2017): added total_plant_stored_h2o_col(c), which is the - ! water inside the plant, which is zero for all non-dynamic models. FATES hydraulics - ! is the only one with dynamic storage atm. - ! Commentary (rgk 04-2017): water has moved from the soil to the plant tissues, - ! and the two pools have different temperatures associated with them. However, - ! we are not accounting for or conserving the flux of energy between the two - ! pools. The energy in the plant water should "bring with it" the internal - ! energy of the soil-to-root water flux. - - liqcan = h2ocan_col(c) - snocan_col(c) + total_plant_stored_h2o_col(c) - call AccumulateLiquidWaterHeat( & - temp = heat_base_temp, & - h2o = liqcan, & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - - !--- snow --- - if ( snl(c) < 0 ) then - ! Loop over snow layers - do j = snl(c)+1,0 - call AccumulateLiquidWaterHeat( & - temp = t_soisno(c,j), & - h2o = h2osoi_liq(c,j), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - heat_ice(c) = heat_ice(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (h2osoi_ice(c,j)*cpice)) - end do - else if (h2osno(c) /= 0._r8) then - ! No explicit snow layers, but there may still be some ice in h2osno (there is - ! no liquid water in this case) - j = 1 - heat_ice(c) = heat_ice(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (h2osno(c)*cpice)) - end if - - if (col%hydrologically_active(c)) then - ! NOTE(wjs, 2017-03-23) Water in the unconfined aquifer currently doesn't have - ! an explicit temperature; thus, we only add its latent heat of - ! fusion. However, we still call the standard AccumulateLiquidWaterHeat routine, so - ! that we average in a heat_base_temp value in heat_liquid. I think this will - ! generally lead to less of a sensible heat flux adjustment needed by the - ! dynbal energy conservation code. (But I went back and forth on whether to do - ! this, so could be convinced otherwise.) In the default CLM5 configuration, - ! this should all be irrelevant, because (wa(c) - aquifer_water_baseline) - ! should be fixed at 0 for all hydrologically-active points. - - call AccumulateLiquidWaterHeat( & - temp = heat_base_temp, & - h2o = (wa(c) - aquifer_water_baseline), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - end if - - if (col%itype(c) == icol_roof .or. col%itype(c) == icol_sunwall & - .or. col%itype(c) == icol_shadewall .or. col%itype(c) == icol_road_imperv) then - ! Nothing more to add in this case - else - !--- surface water --- - call AccumulateLiquidWaterHeat( & - temp = t_h2osfc(c), & - h2o = h2osfc(c), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - end if - - end do - - - !--- below ground (soil & soil water) and related urban columns - do j = 1, nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - l = col%landunit(c) - - if (col%itype(c)==icol_sunwall .or. col%itype(c)==icol_shadewall) then - has_h2o = .false. - if (j <= nlevurb) then - heat_dry_mass(c) = heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (cv_wall(l,j) * dz(c,j))) - end if - - else if (col%itype(c) == icol_roof) then - if (j <= nlevurb) then - has_h2o = .true. - heat_dry_mass(c) = heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (cv_roof(l,j) * dz(c,j))) - else - has_h2o = .false. - end if - - else - has_h2o = .true. - - if (col%itype(c) == icol_road_imperv .and. j <= nlev_improad(l)) then - heat_dry_mass(c) = heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (cv_improad(l,j) * dz(c,j))) - else if (lun%itype(l) /= istwet .and. lun%itype(l) /= istice_mec) then - ! Note that this also includes impervious roads below nlev_improad (where - ! we have soil) - heat_dry_mass(c) = heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (csol(c,j)*(1-watsat(c,j))*dz(c,j))) - end if - end if - - if (has_h2o) then - call AccumulateLiquidWaterHeat( & - temp = t_soisno(c,j), & - h2o = h2osoi_liq(c,j), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - heat_ice(c) = heat_ice(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (h2osoi_ice(c,j)*cpice)) - end if - end do - end do - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) - end do - - end associate - - end subroutine ComputeHeatNonLake - - !----------------------------------------------------------------------- - subroutine ComputeHeatLake(bounds, num_lakec, filter_lakec, & - soilstate_inst, temperature_inst, waterstate_inst, & - heat, heat_liquid, cv_liquid) - ! - ! !DESCRIPTION: - ! Compute total heat content for all lake columns - ! - ! Optionally, also return the total heat content just of liquid water for each column - ! (excluding latent heat), and/or the total heat capacity just of liquid water for - ! each column. Together, these can be used by the caller to compute the weighted - ! average liquid water temperature (with weightings done by the water mass). - ! - ! Note: Changes to this routine - for anything involving liquid or ice - should - ! generally be accompanied by similar changes to ComputeLiqIceMassLake - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_lakec - integer , intent(in) :: filter_lakec(:) - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - - real(r8) , intent(inout) :: heat( bounds%begc: ) ! sum of heat content for all columns [J/m^2] - real(r8) , intent(inout) :: heat_liquid( bounds%begc: ) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] - real(r8) , intent(inout) :: cv_liquid( bounds%begc: ) ! sum of liquid heat capacity for all columns [J/(m^2 K)] - ! - ! !LOCAL VARIABLES: - integer :: fc - integer :: c,j - - real(r8) :: heat_dry_mass(bounds%begc:bounds%endc) ! sum of heat content: dry mass [J/m^2] - real(r8) :: heat_ice(bounds%begc:bounds%endc) ! sum of heat content: ice [J/m^2] - real(r8) :: latent_heat_liquid(bounds%begc:bounds%endc) ! sum of latent heat content of liquid water [J/m^2] - - character(len=*), parameter :: subname = 'ComputeHeatLake' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(heat) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(heat_liquid) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(cv_liquid) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate( & - snl => col%snl, & ! number of snow layers - dz => col%dz, & ! layer depth (m) - watsat => soilstate_inst%watsat_col, & ! volumetric soil water at saturation (porosity) - csol => soilstate_inst%csol_col, & ! heat capacity, soil solids (J/m**3/Kelvin) - t_soisno => temperature_inst%t_soisno_col, & ! soil temperature (Kelvin) - h2osoi_liq => waterstate_inst%h2osoi_liq_col, & ! liquid water (kg/m2) - h2osoi_ice => waterstate_inst%h2osoi_ice_col, & ! frozen water (kg/m2) - h2osno => waterstate_inst%h2osno_col & ! snow water (mm H2O) - ) - - do fc = 1, num_lakec - c = filter_lakec(fc) - - heat_liquid(c) = 0._r8 - cv_liquid(c) = 0._r8 - heat_dry_mass(c) = 0._r8 - heat_ice(c) = 0._r8 - latent_heat_liquid(c) = 0._r8 - end do - - ! Snow heat content - do fc = 1, num_lakec - c = filter_lakec(fc) - if ( snl(c) < 0 ) then - ! Loop over snow layers - do j = snl(c)+1,0 - call AccumulateLiquidWaterHeat( & - temp = t_soisno(c,j), & - h2o = h2osoi_liq(c,j), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - heat_ice(c) = heat_ice(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (h2osoi_ice(c,j)*cpice)) - end do - else if (h2osno(c) /= 0._r8) then - ! TODO(wjs, 2017-03-16) (Copying this note from old code... I'm not positive - ! it's still true.) The heat capacity (not latent heat) of snow without snow - ! layers is currently ignored in LakeTemperature, so it should be ignored here. - ! Eventually we should consider this. - end if - end do - - ! Soil water content of the soil under the lake - do j = 1,nlevgrnd - do fc = 1, num_lakec - c = filter_lakec(fc) - - heat_dry_mass(c) = heat_dry_mass(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (csol(c,j)*(1-watsat(c,j))*dz(c,j))) - call AccumulateLiquidWaterHeat( & - temp = t_soisno(c,j), & - h2o = h2osoi_liq(c,j), & - cv_liquid = cv_liquid(c), & - heat_liquid = heat_liquid(c), & - latent_heat_liquid = latent_heat_liquid(c)) - heat_ice(c) = heat_ice(c) + & - TempToHeat(temp = t_soisno(c,j), cv = (h2osoi_ice(c,j)*cpice)) - end do - end do - - ! TODO(wjs, 2017-03-11) Include heat content of water in lakes, once we include - ! lake water as an explicit water state (https://github.com/NCAR/CLM/issues/2) - - do fc = 1, num_lakec - c = filter_lakec(fc) - heat(c) = heat_dry_mass(c) + heat_ice(c) + heat_liquid(c) + latent_heat_liquid(c) - end do - - end associate - - end subroutine ComputeHeatLake - - !----------------------------------------------------------------------- - subroutine AdjustDeltaHeatForDeltaLiq(bounds, delta_liq, & - liquid_water_temp1, liquid_water_temp2, & - delta_heat) - ! - ! !DESCRIPTION: - ! Adjusts delta_heat (the change in gridcell heat content due to land cover change - ! that needs to be accounted for via a heat flux) to account for the implicit heat - ! flux associated with delta_liq. - ! - ! Note that, throughout CLM, we don't explicitly track the temperature or heat content - ! of runoff. Furthermore, we currently cannot compute the exact heat content of - ! delta_liq (the dynamic landcover adjustment), because we aren't summing the liquid - ! water heat content on a pool-by-pool (and layer-by-layer) basis, but rather on a - ! bulk basis across each column. Thus, the formulation in this routine is currently - ! using a rough approximation of the temperature of delta_liq - assuming it is at the - ! average temperature of the liquid water in the grid cell. This can be a poor - ! assumption in some cases (e.g., if the grid cell is 90% glacier, 5% natural veg and - ! 5% crop, and the only transitions are between natural veg and crop - then the - ! glacier's liquid water temperature factors into the average liquid water - ! temperature, even though it doesn't contribute at all to delta_liq). - ! - ! Also note that we don't account for delta_ice here. This implicitly assumes that - ! ice runoff is at heat_base_temp (which is reasonable as long as heat_base_temp = - ! tfrz). - ! - ! Eventually, if we begin to explicitly account for the temperature / heat content of - ! liquid and ice runoff in CLM, then this routine should be reworked to use the true - ! heat contents of both liquid and ice runoff. - ! - ! Sign convention: delta_liq and delta_heat are positive if the post-landcover change - ! value is greater than the pre-landcover change value. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: delta_liq( bounds%begg: ) ! change in gridcell h2o liq content [kg/m^2] - real(r8), intent(in) :: liquid_water_temp1( bounds%begg: ) ! average liquid water temperature before land cover change [K] - real(r8), intent(in) :: liquid_water_temp2( bounds%begg: ) ! average liquid water temperature after land cover change [K] - real(r8), intent(inout) :: delta_heat( bounds%begg: ) ! change in gridcell heat content [J/m^2] - ! - ! !LOCAL VARIABLES: - integer :: g - real(r8) :: water_temperature ! [K] - real(r8) :: total_liquid_heat ! [J/m^2] - real(r8) :: heat_liquid ! [J/m^2] - real(r8) :: latent_heat_liquid ! [J/m^2] - real(r8) :: cv ! heat capacity [J/(m^2 K)] - - character(len=*), parameter :: subname = 'AdjustDeltaHeatForDeltaLiq' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(delta_liq) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(liquid_water_temp1) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(liquid_water_temp2) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(delta_heat) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - do g = bounds%begg, bounds%endg - if (delta_liq(g) /= 0._r8) then - if (delta_liq(g) < 0._r8) then - ! There was more water in the initial state than in the final state. We'll - ! generate a positive runoff. We assume that the runoff has a temperature equal - ! to the average temperature of liquid water in the initial state. - water_temperature = liquid_water_temp1(g) - else - ! There is more water in the final state than in the initial state. We'll - ! generate a negative runoff. We assume that we're sucking water out of the - ! ocean at a temperature equal to the average temperature of liquid water in - ! the final state. - water_temperature = liquid_water_temp2(g) - end if - - ! Since we're not trying to completely conserve energy here, it's better to - ! ensure that the estimated water temperature is in some reasonable bounds. - ! This protects against getting bad temperatures as a result of something like - ! catastrophic cancellation, or the weirdness that can arise from having - ! negative water volumes included in the averages. - water_temperature = max(water_temperature, DeltaLiqMinTemp) - water_temperature = min(water_temperature, DeltaLiqMaxTemp) - - total_liquid_heat = LiquidWaterHeat( & - temp = water_temperature, & - h2o = delta_liq(g)) - - ! For delta_liq < 0 (liq2 < liq1): We'll generate a positive runoff; we want to - ! effectively include some positive heat from that positive runoff in the heat2 - ! state, which means adding a positive term to delta_heat. Since the above heat - ! quantities will be negative, we need to subtract them. The reverse is true - ! for delta_liq > 0; again, we need to subtract the heat quantities. - delta_heat(g) = delta_heat(g) - total_liquid_heat - - end if - end do - - end subroutine AdjustDeltaHeatForDeltaLiq - - !----------------------------------------------------------------------- - function LiquidWaterHeat(temp, h2o) result(heat) - ! - ! !DESCRIPTION: - ! Get the total heat content (including latent heat) of some mass of liquid water at - ! a given temperature, using a base temperature of heat_base_temp. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) :: heat ! function result - real(r8), intent(in) :: temp ! temperature [K] - real(r8), intent(in) :: h2o ! water mass [kg/m^2] - ! - ! !LOCAL VARIABLES: - real(r8) :: heat_liquid ! heat content of liquid water, excluding latent heat [J/m^2] - real(r8) :: latent_heat_liquid ! latent heat content of liquid water [J/m^2] - - character(len=*), parameter :: subname = 'LiquidWaterHeat' - !----------------------------------------------------------------------- - - heat_liquid = 0._r8 - latent_heat_liquid = 0._r8 - call AccumulateLiquidWaterHeat(temp = temp, h2o = h2o, & - heat_liquid = heat_liquid, latent_heat_liquid = latent_heat_liquid) - - heat = heat_liquid + latent_heat_liquid - - end function LiquidWaterHeat - - - !----------------------------------------------------------------------- - subroutine AccumulateLiquidWaterHeat(temp, h2o, & - heat_liquid, latent_heat_liquid, cv_liquid) - ! - ! !DESCRIPTION: - ! In the course of accumulating heat contents: Accumulate quantities that we need to - ! count for liquid water, for a single column - ! - ! !ARGUMENTS: - real(r8), intent(in) :: temp ! temperature [K] - real(r8), intent(in) :: h2o ! water mass [kg/m^2] - - real(r8), intent(inout) :: heat_liquid ! accumulated total heat content of liquid water for this column, excluding latent heat [J/m^2] - real(r8), intent(inout) :: latent_heat_liquid ! accumulated total latent heat content of liquid water for this column [J/m^2] - real(r8), intent(inout), optional :: cv_liquid ! accumulated total liquid heat capacity for this column [J/(m^2 K)] - ! - ! !LOCAL VARIABLES: - real(r8) :: cv ! heat capacity [J/(m^2 K)] - - character(len=*), parameter :: subname = 'AccumulateLiquidWaterHeat' - !----------------------------------------------------------------------- - - cv = h2o*cpliq - if (present(cv_liquid)) then - cv_liquid = cv_liquid + cv - end if - heat_liquid = heat_liquid + TempToHeat(temp = temp, cv = cv) - latent_heat_liquid = latent_heat_liquid + h2o*hfus - end subroutine AccumulateLiquidWaterHeat - - !----------------------------------------------------------------------- - pure function TempToHeat(temp, cv) result(heat) - ! - ! !DESCRIPTION: - ! Convert temperature to heat content - ! - ! !ARGUMENTS: - real(r8) :: heat ! function result: heat in J/m^2 - real(r8), intent(in) :: temp ! temperature [K] - real(r8), intent(in) :: cv ! heat capacity [J/(m^2 K)] - !----------------------------------------------------------------------- - - heat = cv*(temp - heat_base_temp) - - end function TempToHeat - -end module TotalWaterAndHeatMod diff --git a/src/biogeophys/TridiagonalMod.F90 b/src/biogeophys/TridiagonalMod.F90 deleted file mode 100644 index 68dbd71cce..0000000000 --- a/src/biogeophys/TridiagonalMod.F90 +++ /dev/null @@ -1,118 +0,0 @@ -module TridiagonalMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: Tridiagonal - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Tridiagonal (bounds, lbj, ubj, jtop, numf, filter, a, b, c, r, u) - ! - ! !DESCRIPTION: - ! Tridiagonal matrix solution - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevurb - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varctl , only : iulog - use decompMod , only : bounds_type - use ColumnType , only : col - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: jtop( bounds%begc: ) ! top level for each column [col] - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: filter(:) ! filter - real(r8), intent(in) :: a( bounds%begc: , lbj: ) ! "a" left off diagonal of tridiagonal matrix [col, j] - real(r8), intent(in) :: b( bounds%begc: , lbj: ) ! "b" diagonal column for tridiagonal matrix [col, j] - real(r8), intent(in) :: c( bounds%begc: , lbj: ) ! "c" right off diagonal tridiagonal matrix [col, j] - real(r8), intent(in) :: r( bounds%begc: , lbj: ) ! "r" forcing term of tridiagonal matrix [col, j] - real(r8), intent(inout) :: u( bounds%begc: , lbj: ) ! solution [col, j] - ! - integer :: j,ci,fc !indices - real(r8) :: gam(bounds%begc:bounds%endc,lbj:ubj) !temporary - real(r8) :: bet(bounds%begc:bounds%endc) !temporary - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(jtop) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(a) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(b) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(r) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(u) == (/bounds%endc, ubj/)), errMsg(sourcefile, __LINE__)) - - ! Solve the matrix - - do fc = 1,numf - ci = filter(fc) - bet(ci) = b(ci,jtop(ci)) - end do - - do j = lbj, ubj - do fc = 1,numf - ci = filter(fc) - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb) then - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if - end if - end if - end do - end do - - do j = ubj-1,lbj,-1 - do fc = 1,numf - ci = filter(fc) - if ((col%itype(ci) == icol_sunwall .or. col%itype(ci) == icol_shadewall & - .or. col%itype(ci) == icol_roof) .and. j <= nlevurb-1) then - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if - else if (col%itype(ci) /= icol_sunwall .and. col%itype(ci) /= icol_shadewall & - .and. col%itype(ci) /= icol_roof) then - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if - end if - end do - end do - - end subroutine Tridiagonal - -end module TridiagonalMod diff --git a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 b/src/biogeophys/UrbBuildTempOleson2015Mod.F90 deleted file mode 100644 index eaf1c14c36..0000000000 --- a/src/biogeophys/UrbBuildTempOleson2015Mod.F90 +++ /dev/null @@ -1,938 +0,0 @@ -module UrbBuildTempOleson2015Mod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculates internal building air temperature - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use perf_mod , only : t_startf, t_stopf - use clm_varctl , only : iulog - use UrbanParamsType , only : urbanparams_type - use UrbanTimeVarType , only : urbantv_type - use EnergyFluxType , only : energyflux_type - use TemperatureType , only : temperature_type - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: BuildingTemperature ! Calculation of interior building air temperature, inner - ! surface temperatures of walls and roof, and floor temperature - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BuildingTemperature -! -! !INTERFACE: - subroutine BuildingTemperature (bounds, num_urbanl, filter_urbanl, num_nolakec, & - filter_nolakec, tk, urbanparams_inst, temperature_inst, & - energyflux_inst, urbantv_inst) -! -! !DESCRIPTION: -! Solve for t_building, inner surface temperatures of roof, sunw, shdw, and floor temperature -! Five equations, five unknowns (t_roof_inner,t_sunw_inner,t_shdw_inner,t_floor,t_building at n+1) -! Derived from energy balance equations at each surface and building air -! rd (radiation), cd (conduction), cv (convection) -! qrd_roof + qcd_roof + qcv_roof = 0 -! qrd_sunw + qcd_sunw + qcv_sunw = 0 -! qrd_shdw + qcd_shdw + qcv_shdw = 0 -! qrd_floor + qcd_floor + qcv_floor = 0 -! Vbld*rho_dair*cpair*(dt_building/dt) = sum(Asfc*hcv_sfc*(t_sfc - t_building) -! + Vvent*rho_dair*cpair*(taf - t_building) -! where Vlbd is volume of building air, -! rho_dair is density of dry air at t_building (kg m-3), -! cpair is specific heat of dry air (J kg-1 K-1), -! dt_building is change in interior building temperature (K), -! dt is timestep (s), -! Asfc is surface area of roof, sunw, shdw, floor (m2) -! hcv_sfc is convective heat transfer coefficient for roof, sunw, shdw, floor (W m-2 K-1) -! t_sfc is inner surface temperature of roof, sunw, shdw, floor (K) -! t_building is interior building temperature (K) -! Vvent is ventilation airflow rate (m3 s-1) -! taf is urban canyon air temperature (K) -! -! This methodology was introduced as part of CLM5.0. -! -! Conduction fluxes are obtained from terms of soil temperature equations -! Radiation fluxes are obtained from linearizing the longwave radiation equations taking into -! account view factors for each surface. - -! qrd is positive away from the surface toward room air, so qrd = emitted - absorbed, -! so positive qrd will result in a decrease in temperature -! qcd_floor is positive away from surface toward room air, so positive -! qcd will result in a decrease in temperature -! qcv is positive toward room air, so positive qcv (t_surface > t_room) will -! result in a decrease in temperature - -! The LAPACK routine DGESV is used to compute the solution to the real system of linear equations -! a * x = b, -! where a is an n-by-n matrix and x and b are n-by-nrhs matrices. -! -! The LU decomposition with partial pivoting and row interchanges is -! used to factor a as -! a = P * L * U, -! where P is a permutation matrix, L is unit lower triangular, and U is -! upper triangular. The factored form of a is then used to solve the -! system of equations a * x = b. - -! The following is from LAPACK documentation -! DGESV computes the solution to system of linear equations A * X = B for GE matrices -! -! =========== DOCUMENTATION =========== -! -! Online html documentation available at -! http://www.netlib.org/lapack/explore-html/ -! -! Download DGESV + dependencies -! -! [TGZ] -! -! [ZIP] -! -! [TXT] -! -! Definition: -! =========== -! -! SUBROUTINE DGESV( N, NRHS, A, LDA, IPIV, B, LDB, INFO ) -! -! .. Scalar Arguments .. -! INTEGER INFO, LDA, LDB, N, NRHS -! .. -! .. Array Arguments .. -! INTEGER IPIV( * ) -! DOUBLE PRECISION A( LDA, * ), B( LDB, * ) -! .. -! -! -! ============= -! -! -! DGESV computes the solution to a real system of linear equations -! A * X = B, -! where A is an N-by-N matrix and X and B are N-by-NRHS matrices. -! -! The LU decomposition with partial pivoting and row interchanges is -! used to factor A as -! A = P * L * U, -! where P is a permutation matrix, L is unit lower triangular, and U is -! upper triangular. The factored form of A is then used to solve the -! system of equations A * X = B. -! -! Arguments: -! ========== -! -! \param[in] N -! N is INTEGER -! The number of linear equations, i.e., the order of the -! matrix A. N >= 0. -! -! \param[in] NRHS -! NRHS is INTEGER -! The number of right hand sides, i.e., the number of columns -! of the matrix B. NRHS >= 0. -! -! \param[in,out] A -! A is DOUBLE PRECISION array, dimension (LDA,N) -! On entry, the N-by-N coefficient matrix A. -! On exit, the factors L and U from the factorization -! A = P*L*U; the unit diagonal elements of L are not stored. -! -! \param[in] LDA -! LDA is INTEGER -! The leading dimension of the array A. LDA >= max(1,N). -! -! \param[out] IPIV -! IPIV is INTEGER array, dimension (N) -! The pivot indices that define the permutation matrix P; -! row i of the matrix was interchanged with row IPIV(i). -! -! \param[in,out] B -! B is DOUBLE PRECISION array, dimension (LDB,NRHS) -! On entry, the N-by-NRHS matrix of right hand side matrix B. -! On exit, if INFO = 0, the N-by-NRHS solution matrix X. -! -! \param[in] LDB -! LDB is INTEGER -! The leading dimension of the array B. LDB >= max(1,N). -! -! \param[out] INFO -! INFO is INTEGER -! = 0: successful exit -! < 0: if INFO = -i, the i-th argument had an illegal value -! > 0: if INFO = i, U(i,i) is exactly zero. The factorization -! has been completed, but the factor U is exactly -! singular, so the solution could not be computed. -! -! Authors: -! ======== -! -! \author Univ. of Tennessee -! \author Univ. of California Berkeley -! \author Univ. of Colorado Denver -! \author NAG Ltd. -! -! \date November 2011 -! -! \ingroup doubleGEsolve - -! !CALLED FROM: -! subroutine SoilTemperature in this module -! -! !REVISION HISTORY: -! 08/17/12 Keith Oleson: Initial code - -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_time_manager, only : get_step_size - use clm_varcon , only : rair, pstd, cpair, sb, hcv_roof, hcv_roof_enhanced, & - hcv_floor, hcv_floor_enhanced, hcv_sunw, hcv_shdw, & - em_roof_int, em_floor_int, em_sunw_int, em_shdw_int, & - dz_floor, dens_floor, cp_floor, vent_ach - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_varctl , only : iulog - use abortutils , only : endrun - use clm_varpar , only : nlevurb, nlevsno, nlevgrnd - use UrbanParamsType , only : urban_hac, urban_hac_off, urban_hac_on, urban_wasteheat_on -! -! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8), intent(in) :: tk(bounds%begc: , -nlevsno+1: ) ! thermal conductivity (W m-1 K-1) [col, j] - type(urbanparams_type), intent(in) :: urbanparams_inst ! urban parameters - type(temperature_type), intent(inout) :: temperature_inst ! temperature variables - type(energyflux_type) , intent(inout) :: energyflux_inst ! energy flux variables - type(urbantv_type) , intent(in) :: urbantv_inst ! urban time varying variables -! -! !LOCAL VARIABLES: - integer, parameter :: neq = 5 ! number of equation/unknowns - integer :: fc,fl,c,l ! indices - real(r8) :: dtime ! land model time step (s) - real(r8) :: t_roof_inner_bef(bounds%begl:bounds%endl) ! roof inside surface temperature at previous time step (K) - real(r8) :: t_sunw_inner_bef(bounds%begl:bounds%endl) ! sunwall inside surface temperature at previous time step (K) - real(r8) :: t_shdw_inner_bef(bounds%begl:bounds%endl) ! shadewall inside surface temperature at previous time step (K) - real(r8) :: t_floor_bef(bounds%begl:bounds%endl) ! floor temperature at previous time step (K) - real(r8) :: t_building_bef(bounds%begl:bounds%endl) ! internal building air temperature at previous time step [K] - real(r8) :: t_building_bef_hac(bounds%begl:bounds%endl)! internal building air temperature before applying HAC [K] - real(r8) :: hcv_roofi(bounds%begl:bounds%endl) ! roof convective heat transfer coefficient (W m-2 K-1) - real(r8) :: hcv_sunwi(bounds%begl:bounds%endl) ! sunwall convective heat transfer coefficient (W m-2 K-1) - real(r8) :: hcv_shdwi(bounds%begl:bounds%endl) ! shadewall convective heat transfer coefficient (W m-2 K-1) - real(r8) :: hcv_floori(bounds%begl:bounds%endl) ! floor convective heat transfer coefficient (W m-2 K-1) - real(r8) :: em_roofi(bounds%begl:bounds%endl) ! roof inside surface emissivity (-) - real(r8) :: em_sunwi(bounds%begl:bounds%endl) ! sunwall inside surface emissivity (-) - real(r8) :: em_shdwi(bounds%begl:bounds%endl) ! shadewall inside surface emissivity (-) - real(r8) :: em_floori(bounds%begl:bounds%endl) ! floor inside surface emissivity (-) - real(r8) :: dz_floori(bounds%begl:bounds%endl) ! concrete floor thickness (m) - real(r8) :: cp_floori(bounds%begl:bounds%endl) ! concrete floor volumetric heat capacity (J m-3 K-1) - real(r8) :: cv_floori(bounds%begl:bounds%endl) ! intermediate calculation for concrete floor (W m-2 K-1) - real(r8) :: rho_dair(bounds%begl:bounds%endl) ! density of dry air at standard pressure and t_building (kg m-3) - real(r8) :: vf_rf(bounds%begl:bounds%endl) ! view factor of roof for floor (-) - real(r8) :: vf_fr(bounds%begl:bounds%endl) ! view factor of floor for roof (-) - real(r8) :: vf_wf(bounds%begl:bounds%endl) ! view factor of wall for floor (-) - real(r8) :: vf_fw(bounds%begl:bounds%endl) ! view factor of floor for wall (-) - real(r8) :: vf_rw(bounds%begl:bounds%endl) ! view factor of roof for wall (-) - real(r8) :: vf_wr(bounds%begl:bounds%endl) ! view factor of wall for roof (-) - real(r8) :: vf_ww(bounds%begl:bounds%endl) ! view factor of wall for wall (-) - real(r8) :: zi_roof_innerl(bounds%begl:bounds%endl) ! interface depth of nlevurb roof (m) - real(r8) :: z_roof_innerl(bounds%begl:bounds%endl) ! node depth of nlevurb roof (m) - real(r8) :: zi_sunw_innerl(bounds%begl:bounds%endl) ! interface depth of nlevurb sunwall (m) - real(r8) :: z_sunw_innerl(bounds%begl:bounds%endl) ! node depth of nlevurb sunwall (m) - real(r8) :: zi_shdw_innerl(bounds%begl:bounds%endl) ! interface depth of nlevurb shadewall (m) - real(r8) :: z_shdw_innerl(bounds%begl:bounds%endl) ! node depth of nlevurb shadewall (m) - real(r8) :: t_roof_innerl_bef(bounds%begl:bounds%endl) ! roof temperature at nlevurb node depth at previous time step (K) - real(r8) :: t_sunw_innerl_bef(bounds%begl:bounds%endl) ! sunwall temperature at nlevurb node depth at previous time step (K) - real(r8) :: t_shdw_innerl_bef(bounds%begl:bounds%endl) ! shadewall temperature at nlevurb node depth at previous time step (K) - real(r8) :: t_roof_innerl(bounds%begl:bounds%endl) ! roof temperature at nlevurb node depth (K) - real(r8) :: t_sunw_innerl(bounds%begl:bounds%endl) ! sunwall temperature at nlevurb node depth (K) - real(r8) :: t_shdw_innerl(bounds%begl:bounds%endl) ! shadewall temperature at nlevurb node depth (K) - real(r8) :: tk_roof_innerl(bounds%begl:bounds%endl) ! roof thermal conductivity at nlevurb interface depth (W m-1 K-1) - real(r8) :: tk_sunw_innerl(bounds%begl:bounds%endl) ! sunwall thermal conductivity at nlevurb interface depth (W m-1 K-1) - real(r8) :: tk_shdw_innerl(bounds%begl:bounds%endl) ! shadewall thermal conductivity at nlevurb interface depth (W m-1 K-1) - real(r8) :: qrd_roof(bounds%begl:bounds%endl) ! roof inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_sunw(bounds%begl:bounds%endl) ! sunwall inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_shdw(bounds%begl:bounds%endl) ! shadewall inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_floor(bounds%begl:bounds%endl) ! floor inside net longwave for energy balance check (W m-2) - real(r8) :: qrd_building(bounds%begl:bounds%endl) ! building inside net longwave for energy balance check (W m-2) - real(r8) :: qcv_roof(bounds%begl:bounds%endl) ! roof inside convection flux for energy balance check (W m-2) - real(r8) :: qcv_sunw(bounds%begl:bounds%endl) ! sunwall inside convection flux for energy balance check (W m-2) - real(r8) :: qcv_shdw(bounds%begl:bounds%endl) ! shadewall inside convection flux for energy balance check (W m-2) - real(r8) :: qcv_floor(bounds%begl:bounds%endl) ! floor inside convection flux for energy balance check (W m-2) - real(r8) :: qcd_roof(bounds%begl:bounds%endl) ! roof inside conduction flux for energy balance check (W m-2) - real(r8) :: qcd_sunw(bounds%begl:bounds%endl) ! sunwall inside conduction flux for energy balance check (W m-2) - real(r8) :: qcd_shdw(bounds%begl:bounds%endl) ! shadewall inside conduction flux for energy balance check (W m-2) - real(r8) :: qcd_floor(bounds%begl:bounds%endl) ! floor inside conduction flux for energy balance check (W m-2) - real(r8) :: enrgy_bal_roof(bounds%begl:bounds%endl) ! roof inside energy balance (W m-2) - real(r8) :: enrgy_bal_sunw(bounds%begl:bounds%endl) ! sunwall inside energy balance (W m-2) - real(r8) :: enrgy_bal_shdw(bounds%begl:bounds%endl) ! shadewall inside energy balance (W m-2) - real(r8) :: enrgy_bal_floor(bounds%begl:bounds%endl) ! floor inside energy balance (W m-2) - real(r8) :: enrgy_bal_buildair(bounds%begl:bounds%endl)! building air energy balance (W m-2) - real(r8) :: sum ! sum of view factors for floor, wall, roof - integer :: n ! number of linear equations (= neq) - integer :: nrhs ! number of right hand sides (= 1) - real(r8) :: a(neq,neq) ! n-by-n coefficient matrix a - integer :: lda ! leading dimension of the matrix a - integer :: ldb ! leading dimension of the matrix b - real(r8) :: result(neq) ! on entry, the right hand side of matrix b - ! on exit, if info = 0, the n-by-nrhs solution matrix x - integer :: info ! exit information for LAPACK routine dgesv - integer :: ipiv(neq) ! the pivot indices that define the permutation matrix P -!EOP -!----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(tk) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - associate(& - clandunit => col%landunit , & ! Input: [integer (:)] column's landunit - ctype => col%itype , & ! Input: [integer (:)] column type - zi => col%zi , & ! Input: [real(r8) (:,:)] interface level below a "z" level (m) - z => col%z , & ! Input: [real(r8) (:,:)] layer thickness (m) - - ht_roof => lun%ht_roof , & ! Input: [real(r8) (:)] height of urban roof (m) - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:)] ratio of building height to street hwidth (-) - wtlunit_roof => lun%wtlunit_roof , & ! Input: [real(r8) (:)] weight of roof with respect to landunit - urbpoi => lun%urbpoi , & ! Input: [logical (:)] true => landunit is an urban point - - taf => temperature_inst%taf_lun , & ! Input: [real(r8) (:)] urban canopy air temperature (K) - tssbef => temperature_inst%t_ssbef_col , & ! Input: [real(r8) (:,:)] temperature at previous time step (K) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:)] soil temperature (K) - t_roof_inner => temperature_inst%t_roof_inner_lun , & ! InOut: [real(r8) (:)] roof inside surface temperature (K) - t_sunw_inner => temperature_inst%t_sunw_inner_lun , & ! InOut: [real(r8) (:)] sunwall inside surface temperature (K) - t_shdw_inner => temperature_inst%t_shdw_inner_lun , & ! InOut: [real(r8) (:)] shadewall inside surface temperature (K) - t_floor => temperature_inst%t_floor_lun , & ! InOut: [real(r8) (:)] floor temperature (K) - t_building => temperature_inst%t_building_lun , & ! InOut: [real(r8) (:)] internal building air temperature (K) - - t_building_max => urbantv_inst%t_building_max , & ! Input: [real(r8) (:)] maximum internal building air temperature (K) - t_building_min => urbanparams_inst%t_building_min , & ! Input: [real(r8) (:)] minimum internal building air temperature (K) - - eflx_building => energyflux_inst%eflx_building_lun , & ! Output: [real(r8) (:)] building heat flux from change in interior building air temperature (W/m**2) - eflx_urban_ac => energyflux_inst%eflx_urban_ac_lun , & ! Output: [real(r8) (:)] urban air conditioning flux (W/m**2) - eflx_urban_heat => energyflux_inst%eflx_urban_heat_lun & ! Output: [real(r8) (:)] urban heating flux (W/m**2) - ) - - ! Get step size - - dtime = get_step_size() - - ! 1. Save t_* at previous time step - ! 2. Set convective heat transfer coefficients (Bueno et al. 2012, GMD). - ! An alternative is Salamanca et al. 2010, TAC, where they are all set to 8 W m-2 K-1. - ! See clm_varcon.F90 - ! 3. Set inner surface emissivities (Bueno et al. 2012, GMD). - ! 4. Set concrete floor properties (Salamanca et al. 2010, TAC). - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - t_roof_inner_bef(l) = t_roof_inner(l) - t_sunw_inner_bef(l) = t_sunw_inner(l) - t_shdw_inner_bef(l) = t_shdw_inner(l) - t_floor_bef(l) = t_floor(l) - t_building_bef(l) = t_building(l) - if (t_roof_inner_bef(l) .le. t_building_bef(l)) then - hcv_roofi(l) = hcv_roof_enhanced - else - hcv_roofi(l) = hcv_roof - end if - if (t_floor_bef(l) .ge. t_building_bef(l)) then - hcv_floori(l) = hcv_floor_enhanced - else - hcv_floori(l) = hcv_floor - end if - hcv_sunwi(l) = hcv_sunw - hcv_shdwi(l) = hcv_shdw - em_roofi(l) = em_roof_int - em_sunwi(l) = em_sunw_int - em_shdwi(l) = em_shdw_int - em_floori(l) = em_floor_int - ! Concrete floor thickness (m) - dz_floori(l) = dz_floor - ! Concrete floor volumetric heat capacity (J m-3 K-1) - cp_floori(l) = cp_floor - ! Intermediate calculation for concrete floor (W m-2 K-1) - cv_floori(l) = (dz_floori(l) * cp_floori(l)) / dtime - ! Density of dry air at standard pressure and t_building (kg m-3) - rho_dair(l) = pstd / (rair*t_building_bef(l)) - end if - end do - - ! Get terms from soil temperature equations to compute conduction flux - ! Negative is toward surface - heat added - ! Note that the conduction flux here is in W m-2 wall area but for purposes of solving the set of - ! simultaneous equations this must be converted to W m-2 ground area. This is done below when - ! setting up the equation coefficients. - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (urbpoi(l)) then - if (ctype(c) == icol_roof) then - zi_roof_innerl(l) = zi(c,nlevurb) - z_roof_innerl(l) = z(c,nlevurb) - t_roof_innerl_bef(l) = tssbef(c,nlevurb) - t_roof_innerl(l) = t_soisno(c,nlevurb) - tk_roof_innerl(l) = tk(c,nlevurb) - else if (ctype(c) == icol_sunwall) then - zi_sunw_innerl(l) = zi(c,nlevurb) - z_sunw_innerl(l) = z(c,nlevurb) - t_sunw_innerl_bef(l) = tssbef(c,nlevurb) - t_sunw_innerl(l) = t_soisno(c,nlevurb) - tk_sunw_innerl(l) = tk(c,nlevurb) - else if (ctype(c) == icol_shadewall) then - zi_shdw_innerl(l) = zi(c,nlevurb) - z_shdw_innerl(l) = z(c,nlevurb) - t_shdw_innerl_bef(l) = tssbef(c,nlevurb) - t_shdw_innerl(l) = t_soisno(c,nlevurb) - tk_shdw_innerl(l) = tk(c,nlevurb) - end if - end if - end do - - ! Calculate view factors - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - - vf_rf(l) = sqrt(1._r8 + canyon_hwr(l)**2._r8) - canyon_hwr(l) - vf_fr(l) = vf_rf(l) - - ! This view factor implicitly converts from per unit wall area to per unit floor area - vf_wf(l) = 0.5_r8*(1._r8 - vf_rf(l)) - - ! This view factor implicitly converts from per unit floor area to per unit wall area - vf_fw(l) = vf_wf(l) / canyon_hwr(l) - - ! This view factor implicitly converts from per unit roof area to per unit wall area - vf_rw(l) = vf_fw(l) - - ! This view factor implicitly converts from per unit wall area to per unit roof area - vf_wr(l) = vf_wf(l) - - vf_ww(l) = 1._r8 - vf_rw(l) - vf_fw(l) - - end if - end do - - ! error check -- make sure view factor sums to one for floor, wall, and roof - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - - sum = vf_rf(l) + 2._r8*vf_wf(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban floor view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - sum = vf_rw(l) + vf_fw(l) + vf_ww(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban wall view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - sum = vf_fr(l) + vf_wr(l) + vf_wr(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban roof view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - - endif - end do - - n = neq - nrhs = 1 - lda = neq - ldb = neq - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - - ! ROOF - a(1,1) = 0.5_r8*hcv_roofi(l) & - + 0.5_r8*tk_roof_innerl(l)/(zi_roof_innerl(l) - z_roof_innerl(l)) & - + 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8 & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l) - - a(1,2) = - 4._r8*em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) - - a(1,3) = - 4._r8*em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) - - a(1,4) = - 4._r8*em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l) - - a(1,5) = - 0.5_r8*hcv_roofi(l) - - result(1) = 0.5_r8*tk_roof_innerl(l)*t_roof_innerl(l)/(zi_roof_innerl(l) - z_roof_innerl(l)) & - - 0.5_r8*tk_roof_innerl(l)*(t_roof_inner_bef(l)-t_roof_innerl_bef(l))/(zi_roof_innerl(l) & - - z_roof_innerl(l)) & - - 3._r8*em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l) & - - 3._r8*em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l) & - - 3._r8*em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l) & - + 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8 & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) - - ! SUNWALL - a(2,1) = - 4._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(2,2) = 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) & - + 0.5_r8*tk_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) & - + 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8 & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(2,3) = - 4._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) - - a(2,4) = - 4._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) - a(2,5) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) - - result(2) = 0.5_r8*tk_sunw_innerl(l)*t_sunw_innerl(l)/(zi_sunw_innerl(l) - z_sunw_innerl(l))*canyon_hwr(l) & - - 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l)-t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) & - - z_sunw_innerl(l))*canyon_hwr(l) & - - 3._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 3._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l) & - - 3._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - + 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8 & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) - - ! SHADEWALL - a(3,1) = - 4._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(3,2) = - 4._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) - - a(3,3) = 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) & - + 0.5_r8*tk_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) & - + 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8 & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) - - a(3,4) = - 4._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) - - a(3,5) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) - - result(3) = 0.5_r8*tk_shdw_innerl(l)*t_shdw_innerl(l)/(zi_shdw_innerl(l) - z_shdw_innerl(l))*canyon_hwr(l) & - - 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l)-t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) & - - z_shdw_innerl(l))*canyon_hwr(l) & - - 3._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 3._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l) & - - 3._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - + 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8 & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) - - ! FLOOR - a(4,1) = - 4._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l) - - a(4,2) = - 4._r8*em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) - - a(4,3) = - 4._r8*em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l) - - a(4,4) = (cv_floori(l) + 0.5_r8*hcv_floori(l)) & - + 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8 & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l) - - a(4,5) = - 0.5_r8*hcv_floori(l) - - result(4) = cv_floori(l)*t_floor_bef(l) & - - 3._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l) & - - 3._r8*em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l) & - - 3._r8*em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l) & - + 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8 & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 3._r8*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 3._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 3._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 3._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) - - ! Building air temperature - a(5,1) = - 0.5_r8*hcv_roofi(l) - a(5,2) = - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) - - a(5,3) = - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) - - a(5,4) = - 0.5_r8*hcv_floori(l) - - a(5,5) = ((ht_roof(l)*rho_dair(l)*cpair)/dtime) + & - ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair + & - 0.5_r8*hcv_roofi(l) + & - 0.5_r8*hcv_sunwi(l)*canyon_hwr(l) + & - 0.5_r8*hcv_shdwi(l)*canyon_hwr(l) + & - 0.5_r8*hcv_floori(l) - - result(5) = (ht_roof(l)*rho_dair(l)*cpair/dtime)*t_building_bef(l) & - + ((ht_roof(l)*vent_ach)/3600._r8)*rho_dair(l)*cpair*taf(l) & - + 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) & - + 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - + 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - + 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) - - ! Solve equations - call dgesv(n, nrhs, a, lda, ipiv, result, ldb, info) - - ! If dgesv fails, abort - if (info /= 0) then - write(iulog,*)'fl: ',fl - write(iulog,*)'l: ',l - write(iulog,*)'dgesv info: ',info - write (iulog,*) 'dgesv error' - write (iulog,*) 'clm model is stopping' - call endrun() - end if - ! Assign new temperatures - t_roof_inner(l) = result(1) - t_sunw_inner(l) = result(2) - t_shdw_inner(l) = result(3) - t_floor(l) = result(4) - t_building(l) = result(5) - end if - end do - - ! Energy balance checks - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - qrd_roof(l) = - em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wr(l) & - - 4._r8*em_roofi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wr(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wr(l) & - - 4._r8*em_roofi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wr(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fr(l) & - - 4._r8*em_roofi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fr(l)*(t_floor(l) - t_floor_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wr(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wr(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(1._r8-em_floori(l))*vf_fr(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wr(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wr(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(1._r8-em_floori(l))*vf_fr(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wr(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wr(l)*(t_floor(l) & - - t_floor_bef(l)) & - + em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8 & - + 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*(t_roof_inner(l) - t_roof_inner_bef(l)) - - qrd_sunw(l) = - em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 4._r8*em_sunwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_ww(l) & - - 4._r8*em_sunwi(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_ww(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - - 4._r8*em_sunwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(t_floor(l) - t_floor_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_shdwi(l))*vf_ww(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_shdwi(l))*vf_ww(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_shdwi(l))*vf_ww(l)*(t_floor(l) & - - t_floor_bef(l)) & - + em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8 & - + 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*(t_sunw_inner(l) - t_sunw_inner_bef(l)) - - qrd_shdw(l) = - em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rw(l) & - - 4._r8*em_shdwi(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_ww(l) & - - 4._r8*em_shdwi(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_ww(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**4._r8*vf_fw(l) & - - 4._r8*em_shdwi(l)*em_floori(l)*sb*t_floor_bef(l)**3._r8*vf_fw(l)*(t_floor(l) - t_floor_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_sunwi(l))*vf_ww(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_sunwi(l))*vf_ww(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rf(l)*(1._r8-em_floori(l))*vf_fw(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fr(l)*(1._r8-em_roofi(l))*vf_rw(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_sunwi(l))*vf_ww(l)*(t_floor(l) & - - t_floor_bef(l)) & - + em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8 & - + 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*(t_shdw_inner(l) - t_shdw_inner_bef(l)) - - qrd_floor(l) = - em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8*vf_rf(l) & - - 4._r8*em_floori(l)*em_roofi(l)*sb*t_roof_inner_bef(l)**3._r8*vf_rf(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8*vf_wf(l) & - - 4._r8*em_floori(l)*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3._r8*vf_wf(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8*vf_wf(l) & - - 4._r8*em_floori(l)*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3._r8*vf_wf(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fr(l)*(1._r8-em_roofi(l))*vf_rf(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_sunwi(l))*vf_wf(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_floori(l)*sb*t_floor_bef(l)**4._r8)*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*vf_fw(l)*(1._r8-em_shdwi(l))*vf_wf(l)*(t_floor(l) & - - t_floor_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_shdwi(l))*vf_wf(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_sunwi(l)*sb*t_sunw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_sunwi(l)*sb*t_sunw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l)*(t_sunw_inner(l) & - - t_sunw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_wr(l)*(1._r8-em_roofi(l))*vf_rf(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_shdwi(l)*sb*t_shdw_inner_bef(l)**4._r8)*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_shdwi(l)*sb*t_shdw_inner_bef(l)**3.*vf_ww(l)*(1._r8-em_sunwi(l))*vf_wf(l)*(t_shdw_inner(l) & - - t_shdw_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_sunwi(l))*vf_wf(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - - (em_roofi(l)*sb*t_roof_inner_bef(l)**4._r8)*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l) & - - 4._r8*em_roofi(l)*sb*t_roof_inner_bef(l)**3.*vf_rw(l)*(1._r8-em_shdwi(l))*vf_wf(l)*(t_roof_inner(l) & - - t_roof_inner_bef(l)) & - + em_floori(l)*sb*t_floor_bef(l)**4._r8 & - + 4._r8*em_floori(l)*sb*t_floor_bef(l)**3.*(t_floor(l) - t_floor_bef(l)) - - qrd_building(l) = qrd_roof(l) + canyon_hwr(l)*(qrd_sunw(l) + qrd_shdw(l)) + qrd_floor(l) - - if (abs(qrd_building(l)) > .10_r8 ) then - write (iulog,*) 'urban inside building net longwave radiation balance error ',qrd_building(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_roof(l) = 0.5_r8*hcv_roofi(l)*(t_roof_inner(l) - t_building(l)) + 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) & - - t_building_bef(l)) - qcd_roof(l) = 0.5_r8*tk_roof_innerl(l)*(t_roof_inner(l) - t_roof_innerl(l))/(zi_roof_innerl(l) - z_roof_innerl(l)) & - + 0.5_r8*tk_roof_innerl(l)*(t_roof_inner_bef(l) - t_roof_innerl_bef(l))/(zi_roof_innerl(l) & - - z_roof_innerl(l)) - enrgy_bal_roof(l) = qrd_roof(l) + qcv_roof(l) + qcd_roof(l) - if (abs(enrgy_bal_roof(l)) > .10_r8 ) then - write (iulog,*) 'urban inside roof energy balance error ',enrgy_bal_roof(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_sunw(l) = 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l)) + 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) & - - t_building_bef(l)) - qcd_sunw(l) = 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner(l) - t_sunw_innerl(l))/(zi_sunw_innerl(l) - z_sunw_innerl(l)) & - + 0.5_r8*tk_sunw_innerl(l)*(t_sunw_inner_bef(l) - t_sunw_innerl_bef(l))/(zi_sunw_innerl(l) & - - z_sunw_innerl(l)) - enrgy_bal_sunw(l) = qrd_sunw(l) + qcv_sunw(l)*canyon_hwr(l) + qcd_sunw(l)*canyon_hwr(l) - if (abs(enrgy_bal_sunw(l)) > .10_r8 ) then - write (iulog,*) 'urban inside sunwall energy balance error ',enrgy_bal_sunw(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_shdw(l) = 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l)) + 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) & - - t_building_bef(l)) - qcd_shdw(l) = 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner(l) - t_shdw_innerl(l))/(zi_shdw_innerl(l) - z_shdw_innerl(l)) & - + 0.5_r8*tk_shdw_innerl(l)*(t_shdw_inner_bef(l) - t_shdw_innerl_bef(l))/(zi_shdw_innerl(l) & - - z_shdw_innerl(l)) - enrgy_bal_shdw(l) = qrd_shdw(l) + qcv_shdw(l)*canyon_hwr(l) + qcd_shdw(l)*canyon_hwr(l) - if (abs(enrgy_bal_shdw(l)) > .10_r8 ) then - write (iulog,*) 'urban inside shadewall energy balance error ',enrgy_bal_shdw(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - qcv_floor(l) = 0.5_r8*hcv_floori(l)*(t_floor(l) - t_building(l)) + 0.5_r8*hcv_floori(l)*(t_floor_bef(l) & - - t_building_bef(l)) - qcd_floor(l) = cv_floori(l)*(t_floor(l) - t_floor_bef(l)) - enrgy_bal_floor(l) = qrd_floor(l) + qcv_floor(l) + qcd_floor(l) - if (abs(enrgy_bal_floor(l)) > .10_r8 ) then - write (iulog,*) 'urban inside floor energy balance error ',enrgy_bal_floor(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - enrgy_bal_buildair(l) = (ht_roof(l)*rho_dair(l)*cpair/dtime)*(t_building(l) - t_building_bef(l)) & - - ht_roof(l)*(vent_ach/3600._r8)*rho_dair(l)*cpair*(taf(l) - t_building(l)) & - - 0.5_r8*hcv_roofi(l)*(t_roof_inner(l) - t_building(l)) & - - 0.5_r8*hcv_roofi(l)*(t_roof_inner_bef(l) - t_building_bef(l)) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner(l) - t_building(l))*canyon_hwr(l) & - - 0.5_r8*hcv_sunwi(l)*(t_sunw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner(l) - t_building(l))*canyon_hwr(l) & - - 0.5_r8*hcv_shdwi(l)*(t_shdw_inner_bef(l) - t_building_bef(l))*canyon_hwr(l) & - - 0.5_r8*hcv_floori(l)*(t_floor(l) - t_building(l)) & - - 0.5_r8*hcv_floori(l)*(t_floor_bef(l) - t_building_bef(l)) - if (abs(enrgy_bal_buildair(l)) > .10_r8 ) then - write (iulog,*) 'urban building air energy balance error ',enrgy_bal_buildair(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - end if - end do - - ! Restrict internal building air temperature to between min and max - ! Calculate heating or air conditioning flux from energy required to change - ! internal building air temperature to t_building_min or t_building_max. - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (urbpoi(l)) then - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - t_building_bef_hac(l) = t_building(l) -! rho_dair(l) = pstd / (rair*t_building(l)) - - if (t_building_bef_hac(l) > t_building_max(l)) then - t_building(l) = t_building_max(l) - eflx_urban_ac(l) = wtlunit_roof(l) * abs( (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building(l) & - - (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building_bef_hac(l) ) - else if (t_building_bef_hac(l) < t_building_min(l)) then - t_building(l) = t_building_min(l) - eflx_urban_heat(l) = wtlunit_roof(l) * abs( (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building(l) & - - (ht_roof(l) * rho_dair(l) * cpair / dtime) * t_building_bef_hac(l) ) - else - eflx_urban_ac(l) = 0._r8 - eflx_urban_heat(l) = 0._r8 - end if - else - eflx_urban_ac(l) = 0._r8 - eflx_urban_heat(l) = 0._r8 - end if - eflx_building(l) = wtlunit_roof(l) * (ht_roof(l) * rho_dair(l)*cpair/dtime) * (t_building(l) - t_building_bef(l)) - end if - end do - - end associate - end subroutine BuildingTemperature - - !----------------------------------------------------------------------- - -end module UrbBuildTempOleson2015Mod diff --git a/src/biogeophys/UrbanAlbedoMod.F90 b/src/biogeophys/UrbanAlbedoMod.F90 deleted file mode 100644 index 06552ae1d0..0000000000 --- a/src/biogeophys/UrbanAlbedoMod.F90 +++ /dev/null @@ -1,1286 +0,0 @@ -module UrbanAlbedoMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate solar and longwave radiation, and turbulent fluxes for urban landunit - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : numrad - use clm_varcon , only : isecspday, degpsec, namel - use clm_varctl , only : iulog - use abortutils , only : endrun - use UrbanParamsType , only : urbanparams_type - use WaterstateType , only : waterstate_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanAlbedo ! Urban physics - albedos - ! - ! PRIVATE MEMBER FUNCTIONS - private :: SnowAlbedo ! Snow albedos - private :: incident_direct ! Direct beam solar rad incident on walls and road in urban canyon - private :: incident_diffuse ! Diffuse solar rad incident on walls and road in urban canyon - private :: net_solar ! Solar radiation absorbed by road and both walls in urban canyon - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine UrbanAlbedo (bounds, num_urbanl, filter_urbanl, & - num_urbanc, filter_urbanc, num_urbanp, filter_urbanp, & - waterstate_inst, urbanparams_inst, solarabs_inst, surfalb_inst) - ! - ! !DESCRIPTION: - ! Determine urban landunit component albedos - ! - ! Note that this is called with the "inactive_and_active" version of the filters, because - ! the variables computed here are needed over inactive points that might later become - ! active (due to landuse change). Thus, this routine cannot depend on variables that are - ! only computed over active points. - ! - ! !USES: - use shr_orb_mod , only : shr_orb_decl, shr_orb_cosz - use clm_varcon , only : sb - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv, icol_road_imperv - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(:) ! urban column filter - integer , intent(in) :: num_urbanp ! number of urban patches in clump - integer , intent(in) :: filter_urbanp(:) ! urban pft filter - type(waterstate_type) , intent(in) :: waterstate_inst - type(urbanparams_type) , intent(inout) :: urbanparams_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(surfalb_type) , intent(inout) :: surfalb_inst - ! - ! !LOCAL VARIABLES: - integer :: fl,fp,fc,g,l,p,c,ib ! indices - integer :: ic ! 0=unit incoming direct; 1=unit incoming diffuse - integer :: num_solar ! counter - real(r8) :: coszen (bounds%begl:bounds%endl) ! cosine solar zenith angle for next time step (landunit) - real(r8) :: zen (bounds%begl:bounds%endl) ! solar zenith angle (radians) - real(r8) :: sdir (bounds%begl:bounds%endl, numrad) ! direct beam solar radiation on horizontal surface - real(r8) :: sdif (bounds%begl:bounds%endl, numrad) ! diffuse solar radiation on horizontal surface - real(r8) :: sdir_road (bounds%begl:bounds%endl, numrad) ! direct beam solar radiation incident on road - real(r8) :: sdif_road (bounds%begl:bounds%endl, numrad) ! diffuse solar radiation incident on road - real(r8) :: sdir_sunwall (bounds%begl:bounds%endl, numrad) ! direct beam solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8) :: sdif_sunwall (bounds%begl:bounds%endl, numrad) ! diffuse solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8) :: sdir_shadewall (bounds%begl:bounds%endl, numrad) ! direct beam solar radiation (per unit wall area) incident on shaded wall per unit incident flux - real(r8) :: sdif_shadewall (bounds%begl:bounds%endl, numrad) ! diffuse solar radiation (per unit wall area) incident on shaded wall per unit incident flux - real(r8) :: albsnd_roof (bounds%begl:bounds%endl, numrad) ! snow albedo for roof (direct) - real(r8) :: albsni_roof (bounds%begl:bounds%endl, numrad) ! snow albedo for roof (diffuse) - real(r8) :: albsnd_improad (bounds%begl:bounds%endl, numrad) ! snow albedo for impervious road (direct) - real(r8) :: albsni_improad (bounds%begl:bounds%endl, numrad) ! snow albedo for impervious road (diffuse) - real(r8) :: albsnd_perroad (bounds%begl:bounds%endl, numrad) ! snow albedo for pervious road (direct) - real(r8) :: albsni_perroad (bounds%begl:bounds%endl, numrad) ! snow albedo for pervious road (diffuse) - real(r8) :: alb_roof_dir_s (bounds%begl:bounds%endl, numrad) ! direct roof albedo with snow effects - real(r8) :: alb_roof_dif_s (bounds%begl:bounds%endl, numrad) ! diffuse roof albedo with snow effects - real(r8) :: alb_improad_dir_s (bounds%begl:bounds%endl, numrad) ! direct impervious road albedo with snow effects - real(r8) :: alb_perroad_dir_s (bounds%begl:bounds%endl, numrad) ! direct pervious road albedo with snow effects - real(r8) :: alb_improad_dif_s (bounds%begl:bounds%endl, numrad) ! diffuse impervious road albedo with snow effects - real(r8) :: alb_perroad_dif_s (bounds%begl:bounds%endl, numrad) ! diffuse pervious road albedo with snow effects - real(r8) :: sref_roof_dir (bounds%begl:bounds%endl, numrad) ! direct solar reflected by roof per unit ground area per unit incident flux - real(r8) :: sref_roof_dif (bounds%begl:bounds%endl, numrad) ! diffuse solar reflected by roof per unit ground area per unit incident flux - real(r8) :: sref_sunwall_dir (bounds%begl:bounds%endl, numrad) ! direct solar reflected by sunwall per unit wall area per unit incident flux - real(r8) :: sref_sunwall_dif (bounds%begl:bounds%endl, numrad) ! diffuse solar reflected by sunwall per unit wall area per unit incident flux - real(r8) :: sref_shadewall_dir (bounds%begl:bounds%endl, numrad) ! direct solar reflected by shadewall per unit wall area per unit incident flux - real(r8) :: sref_shadewall_dif (bounds%begl:bounds%endl, numrad) ! diffuse solar reflected by shadewall per unit wall area per unit incident flux - real(r8) :: sref_improad_dir (bounds%begl:bounds%endl, numrad) ! direct solar reflected by impervious road per unit ground area per unit incident flux - real(r8) :: sref_improad_dif (bounds%begl:bounds%endl, numrad) ! diffuse solar reflected by impervious road per unit ground area per unit incident flux - real(r8) :: sref_perroad_dir (bounds%begl:bounds%endl, numrad) ! direct solar reflected by pervious road per unit ground area per unit incident flux - real(r8) :: sref_perroad_dif (bounds%begl:bounds%endl, numrad) ! diffuse solar reflected by pervious road per unit ground area per unit incident flux - !----------------------------------------------------------------------- - - associate( & - ctype => col%itype , & ! Input: [integer (:) ] column type - coli => lun%coli , & ! Input: [integer (:) ] beginning column index for landunit - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:) ] ratio of building height to street width - wtroad_perv => lun%wtroad_perv , & ! Input: [real(r8) (:) ] weight of pervious road wrt total road - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - - alb_roof_dir => urbanparams_inst%alb_roof_dir , & ! Output: [real(r8) (:,:) ] direct roof albedo - alb_roof_dif => urbanparams_inst%alb_roof_dif , & ! Output: [real(r8) (:,:) ] diffuse roof albedo - alb_improad_dir => urbanparams_inst%alb_improad_dir , & ! Output: [real(r8) (:,:) ] direct impervious road albedo - alb_improad_dif => urbanparams_inst%alb_improad_dif , & ! Output: [real(r8) (:,:) ] diffuse imprevious road albedo - alb_perroad_dir => urbanparams_inst%alb_perroad_dir , & ! Output: [real(r8) (:,:) ] direct pervious road albedo - alb_perroad_dif => urbanparams_inst%alb_perroad_dif , & ! Output: [real(r8) (:,:) ] diffuse pervious road albedo - alb_wall_dir => urbanparams_inst%alb_wall_dir , & ! Output: [real(r8) (:,:) ] direct wall albedo - alb_wall_dif => urbanparams_inst%alb_wall_dif , & ! Output: [real(r8) (:,:) ] diffuse wall albedo - - sabs_roof_dir => solarabs_inst%sabs_roof_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by roof per unit ground area per unit incident flux - sabs_roof_dif => solarabs_inst%sabs_roof_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by roof per unit ground area per unit incident flux - sabs_sunwall_dir => solarabs_inst%sabs_sunwall_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by sunwall per unit wall area per unit incident flux - sabs_sunwall_dif => solarabs_inst%sabs_sunwall_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by sunwall per unit wall area per unit incident flux - sabs_shadewall_dir => solarabs_inst%sabs_shadewall_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by shadewall per unit wall area per unit incident flux - sabs_shadewall_dif => solarabs_inst%sabs_shadewall_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by shadewall per unit wall area per unit incident flux - sabs_improad_dir => solarabs_inst%sabs_improad_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by impervious road per unit ground area per unit incident flux - sabs_improad_dif => solarabs_inst%sabs_improad_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by impervious road per unit ground area per unit incident flux - sabs_perroad_dir => solarabs_inst%sabs_perroad_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by pervious road per unit ground area per unit incident flux - sabs_perroad_dif => solarabs_inst%sabs_perroad_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by pervious road per unit ground area per unit incident flux - - fabd => surfalb_inst%fabd_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by canopy per unit direct flux - fabd_sun => surfalb_inst%fabd_sun_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit direct flux - fabd_sha => surfalb_inst%fabd_sha_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit direct flux - fabi => surfalb_inst%fabi_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by canopy per unit diffuse flux - fabi_sun => surfalb_inst%fabi_sun_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by sunlit canopy per unit diffuse flux - fabi_sha => surfalb_inst%fabi_sha_patch , & ! Output: [real(r8) (:,:) ] flux absorbed by shaded canopy per unit diffuse flux - ftdd => surfalb_inst%ftdd_patch , & ! Output: [real(r8) (:,:) ] down direct flux below canopy per unit direct flux - ftid => surfalb_inst%ftid_patch , & ! Output: [real(r8) (:,:) ] down diffuse flux below canopy per unit direct flux - ftii => surfalb_inst%ftii_patch , & ! Output: [real(r8) (:,:) ] down diffuse flux below canopy per unit diffuse flux - albgrd => surfalb_inst%albgrd_col , & ! Output: [real(r8) (:,:) ] urban col ground albedo (direct) - albgri => surfalb_inst%albgri_col , & ! Output: [real(r8) (:,:) ] urban col ground albedo (diffuse) - albd => surfalb_inst%albd_patch , & ! Output [real(r8) (:,:) ] urban pft surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Output: [real(r8) (:,:) ] urban pft surface albedo (diffuse) - - begl => bounds%begl , & - vf_sr => urbanparams_inst%vf_sr , & ! Input: [real(r8) (:) ] view factor of sky for road - vf_sw => urbanparams_inst%vf_sw , & ! Input: [real(r8) (:) ] view factor of sky for one wall - endl => bounds%endl & - ) - - ! ---------------------------------------------------------------------------- - ! Solar declination and cosine solar zenith angle and zenith angle for - ! next time step - ! ---------------------------------------------------------------------------- - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - coszen(l) = surfalb_inst%coszen_col(coli(l)) ! Assumes coszen for each column are the same - zen(l) = acos(coszen(l)) - end do - - ! Initialize output because solar radiation only done if coszen > 0 - - do ib = 1, numrad - do fc = 1,num_urbanc - c = filter_urbanc(fc) - albgrd(c,ib) = 0._r8 - albgri(c,ib) = 0._r8 - end do - - do fp = 1,num_urbanp - p = filter_urbanp(fp) - l = patch%landunit(p) - ! Setting albedos to wall and road view factors ensures that urban - ! albedo will scale up to 1.0 - c = patch%column(p) - if (col%itype(c) == icol_sunwall) then - albd(p,ib) = vf_sw(l) - albi(p,ib) = vf_sw(l) - else if (col%itype(c) == icol_shadewall) then - albd(p,ib) = vf_sw(l) - albi(p,ib) = vf_sw(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - albd(p,ib) = vf_sr(l) - albi(p,ib) = vf_sr(l) - else if (col%itype(c) == icol_roof) then - albd(p,ib) = 1._r8 - albi(p,ib) = 1._r8 - endif - fabd(p,ib) = 0._r8 - fabd_sun(p,ib) = 0._r8 - fabd_sha(p,ib) = 0._r8 - fabi(p,ib) = 0._r8 - fabi_sun(p,ib) = 0._r8 - fabi_sha(p,ib) = 0._r8 - if (coszen(l) > 0._r8) then - ftdd(p,ib) = 1._r8 - else - ftdd(p,ib) = 0._r8 - end if - ftid(p,ib) = 0._r8 - if (coszen(l) > 0._r8) then - ftii(p,ib) = 1._r8 - else - ftii(p,ib) = 0._r8 - end if - end do - end do - - ! ---------------------------------------------------------------------------- - ! Urban Code - ! ---------------------------------------------------------------------------- - - num_solar = 0 - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) num_solar = num_solar + 1 - end do - - do ib = 1,numrad - do fl = 1,num_urbanl - l = filter_urbanl(fl) - sabs_roof_dir(l,ib) = 0._r8 - sabs_roof_dif(l,ib) = 0._r8 - sabs_sunwall_dir(l,ib) = 0._r8 - sabs_sunwall_dif(l,ib) = 0._r8 - sabs_shadewall_dir(l,ib) = 0._r8 - sabs_shadewall_dif(l,ib) = 0._r8 - sabs_improad_dir(l,ib) = 0._r8 - sabs_improad_dif(l,ib) = 0._r8 - sabs_perroad_dir(l,ib) = 0._r8 - sabs_perroad_dif(l,ib) = 0._r8 - sref_roof_dir(l,ib) = 1._r8 - sref_roof_dif(l,ib) = 1._r8 - ! Setting sref to wall and road view factors ensures that urban - ! albedo will scale up to 1.0 - sref_sunwall_dir(l,ib) = vf_sw(l) - sref_sunwall_dif(l,ib) = vf_sw(l) - sref_shadewall_dir(l,ib) = vf_sw(l) - sref_shadewall_dif(l,ib) = vf_sw(l) - sref_improad_dir(l,ib) = vf_sr(l) - sref_improad_dif(l,ib) = vf_sr(l) - sref_perroad_dir(l,ib) = vf_sr(l) - sref_perroad_dif(l,ib) = vf_sr(l) - end do - end do - - ! ---------------------------------------------------------------------------- - ! Only do the rest if all coszen are positive - ! ---------------------------------------------------------------------------- - - if (num_solar > 0)then - - ! Set constants - solar fluxes are per unit incoming flux - - do ib = 1,numrad - do fl = 1,num_urbanl - l = filter_urbanl(fl) - sdir(l,ib) = 1._r8 - sdif(l,ib) = 1._r8 - end do - end do - - ! Incident direct beam radiation for - ! (a) roof and (b) road and both walls in urban canyon - - if (num_urbanl > 0) then - call incident_direct (bounds, & - num_urbanl, filter_urbanl, & - canyon_hwr(begl:endl), & - coszen(begl:endl), & - zen(begl:endl), & - sdir(begl:endl, :), & - sdir_road(begl:endl, :), & - sdir_sunwall(begl:endl, :), & - sdir_shadewall(begl:endl, :)) - end if - - ! Incident diffuse radiation for - ! (a) roof and (b) road and both walls in urban canyon. - - if (num_urbanl > 0) then - call incident_diffuse (bounds, & - num_urbanl, filter_urbanl, & - canyon_hwr(begl:endl), & - sdif(begl:endl, :), & - sdif_road(begl:endl, :), & - sdif_sunwall(begl:endl, :), & - sdif_shadewall(begl:endl, :), & - urbanparams_inst) - end if - - ! Get snow albedos for roof and impervious and pervious road - if (num_urbanl > 0) then - ic = 0 - call SnowAlbedo(bounds, & - num_urbanc, filter_urbanc, & - coszen(begl:endl), & - ic, & - albsnd_roof(begl:endl, :), & - albsnd_improad(begl:endl, :), & - albsnd_perroad(begl:endl, :), & - waterstate_inst) - - ic = 1 - call SnowAlbedo(bounds, & - num_urbanc, filter_urbanc, & - coszen(begl:endl), & - ic, & - albsni_roof(begl:endl, :), & - albsni_improad(begl:endl, :), & - albsni_perroad(begl:endl, :), & - waterstate_inst) - end if - - ! Combine snow-free and snow albedos - do ib = 1,numrad - do fc = 1,num_urbanc - c = filter_urbanc(fc) - l = col%landunit(c) - if (ctype(c) == icol_roof) then - alb_roof_dir_s(l,ib) = alb_roof_dir(l,ib)*(1._r8-frac_sno(c)) & - + albsnd_roof(l,ib)*frac_sno(c) - alb_roof_dif_s(l,ib) = alb_roof_dif(l,ib)*(1._r8-frac_sno(c)) & - + albsni_roof(l,ib)*frac_sno(c) - else if (ctype(c) == icol_road_imperv) then - alb_improad_dir_s(l,ib) = alb_improad_dir(l,ib)*(1._r8-frac_sno(c)) & - + albsnd_improad(l,ib)*frac_sno(c) - alb_improad_dif_s(l,ib) = alb_improad_dif(l,ib)*(1._r8-frac_sno(c)) & - + albsni_improad(l,ib)*frac_sno(c) - else if (ctype(c) == icol_road_perv) then - alb_perroad_dir_s(l,ib) = alb_perroad_dir(l,ib)*(1._r8-frac_sno(c)) & - + albsnd_perroad(l,ib)*frac_sno(c) - alb_perroad_dif_s(l,ib) = alb_perroad_dif(l,ib)*(1._r8-frac_sno(c)) & - + albsni_perroad(l,ib)*frac_sno(c) - end if - end do - end do - - ! Reflected and absorbed solar radiation per unit incident radiation - ! for road and both walls in urban canyon allowing for multiple reflection - ! Reflected and absorbed solar radiation per unit incident radiation for roof - - if (num_urbanl > 0) then - call net_solar (bounds, & - num_urbanl, filter_urbanl, & - coszen (begl:endl), & - canyon_hwr (begl:endl), & - wtroad_perv (begl:endl), & - sdir (begl:endl, :), & - sdif (begl:endl, :), & - alb_improad_dir_s (begl:endl, :), & - alb_perroad_dir_s (begl:endl, :), & - alb_wall_dir (begl:endl, :), & - alb_roof_dir_s (begl:endl, :), & - alb_improad_dif_s (begl:endl, :), & - alb_perroad_dif_s (begl:endl, :), & - alb_wall_dif (begl:endl, :), & - alb_roof_dif_s (begl:endl, :), & - sdir_road (begl:endl, :), & - sdir_sunwall (begl:endl, :), & - sdir_shadewall (begl:endl, :), & - sdif_road (begl:endl, :), & - sdif_sunwall (begl:endl, :), & - sdif_shadewall (begl:endl, :), & - sref_improad_dir (begl:endl, :), & - sref_perroad_dir (begl:endl, :), & - sref_sunwall_dir (begl:endl, :), & - sref_shadewall_dir (begl:endl, :), & - sref_roof_dir (begl:endl, :), & - sref_improad_dif (begl:endl, :), & - sref_perroad_dif (begl:endl, :), & - sref_sunwall_dif (begl:endl, :), & - sref_shadewall_dif (begl:endl, :), & - sref_roof_dif (begl:endl, :), & - urbanparams_inst, solarabs_inst) - end if - - ! ---------------------------------------------------------------------------- - ! Map urban output to surfalb_inst components - ! ---------------------------------------------------------------------------- - - ! Set albgrd and albgri (ground albedos) and albd and albi (surface albedos) - - do ib = 1,numrad - do fc = 1,num_urbanc - c = filter_urbanc(fc) - l = col%landunit(c) - if (ctype(c) == icol_roof) then - albgrd(c,ib) = sref_roof_dir(l,ib) - albgri(c,ib) = sref_roof_dif(l,ib) - else if (ctype(c) == icol_sunwall) then - albgrd(c,ib) = sref_sunwall_dir(l,ib) - albgri(c,ib) = sref_sunwall_dif(l,ib) - else if (ctype(c) == icol_shadewall) then - albgrd(c,ib) = sref_shadewall_dir(l,ib) - albgri(c,ib) = sref_shadewall_dif(l,ib) - else if (ctype(c) == icol_road_perv) then - albgrd(c,ib) = sref_perroad_dir(l,ib) - albgri(c,ib) = sref_perroad_dif(l,ib) - else if (ctype(c) == icol_road_imperv) then - albgrd(c,ib) = sref_improad_dir(l,ib) - albgri(c,ib) = sref_improad_dif(l,ib) - endif - end do - do fp = 1,num_urbanp - p = filter_urbanp(fp) - c = patch%column(p) - albd(p,ib) = albgrd(c,ib) - albi(p,ib) = albgri(c,ib) - end do - end do - end if - - end associate - - end subroutine UrbanAlbedo - - !----------------------------------------------------------------------- - subroutine SnowAlbedo (bounds , & - num_urbanc, filter_urbanc, coszen, ind , & - albsn_roof, albsn_improad, albsn_perroad, & - waterstate_inst) - ! - ! !DESCRIPTION: - ! Determine urban snow albedos - ! - ! !USES: - use column_varcon, only : icol_roof, icol_road_perv, icol_road_imperv - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(:) ! urban column filter - integer , intent(in) :: ind ! 0=direct beam, 1=diffuse radiation - real(r8), intent(in) :: coszen ( bounds%begl: ) ! cosine solar zenith angle [landunit] - real(r8), intent(out):: albsn_roof ( bounds%begl: , 1: ) ! roof snow albedo by waveband [landunit, numrad] - real(r8), intent(out):: albsn_improad ( bounds%begl: , 1: ) ! impervious road snow albedo by waveband [landunit, numrad] - real(r8), intent(out):: albsn_perroad ( bounds%begl: , 1: ) ! pervious road snow albedo by waveband [landunit, numrad] - type(waterstate_type), intent(in) :: waterstate_inst - ! - ! !LOCAL VARIABLES: - integer :: fc,c,l ! indices - ! - ! These values are derived from Marshall (1989) assuming soot content of 1.5e-5 - ! (three times what LSM uses globally). Note that snow age effects are ignored here. - real(r8), parameter :: snal0 = 0.66_r8 ! vis albedo of urban snow - real(r8), parameter :: snal1 = 0.56_r8 ! nir albedo of urban snow - !----------------------------------------------------------------------- - - ! this code assumes that numrad = 2 , with the following - ! index values: 1 = visible, 2 = NIR - SHR_ASSERT_ALL(numrad == 2, errMsg(sourcefile, __LINE__)) - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(coszen) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albsn_roof) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albsn_improad) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(albsn_perroad) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - - associate( & - h2osno => waterstate_inst%h2osno_col & ! Input: [real(r8) (:) ] snow water (mm H2O) - ) - - do fc = 1,num_urbanc - c = filter_urbanc(fc) - l = col%landunit(c) - if (coszen(l) > 0._r8 .and. h2osno(c) > 0._r8) then - if (col%itype(c) == icol_roof) then - albsn_roof(l,1) = snal0 - albsn_roof(l,2) = snal1 - else if (col%itype(c) == icol_road_imperv) then - albsn_improad(l,1) = snal0 - albsn_improad(l,2) = snal1 - else if (col%itype(c) == icol_road_perv) then - albsn_perroad(l,1) = snal0 - albsn_perroad(l,2) = snal1 - end if - else - if (col%itype(c) == icol_roof) then - albsn_roof(l,1) = 0._r8 - albsn_roof(l,2) = 0._r8 - else if (col%itype(c) == icol_road_imperv) then - albsn_improad(l,1) = 0._r8 - albsn_improad(l,2) = 0._r8 - else if (col%itype(c) == icol_road_perv) then - albsn_perroad(l,1) = 0._r8 - albsn_perroad(l,2) = 0._r8 - end if - end if - end do - - end associate - - end subroutine SnowAlbedo - - !----------------------------------------------------------------------- - subroutine incident_direct (bounds , & - num_urbanl, filter_urbanl, canyon_hwr, coszen, zen , & - sdir, sdir_road, sdir_sunwall, sdir_shadewall) - ! - ! !DESCRIPTION: - ! Direct beam solar radiation incident on walls and road in urban canyon - ! - ! Sun - ! / - ! roof / - ! ------ /--- - - ! | / | | - ! sunlit wall | / | shaded wall h - ! | / | | - ! -----/----- - - ! road - ! <--- w ---> - ! - ! Method: - ! Road = Horizontal surface. Account for shading by wall. Integrate over all canyon orientations - ! Wall (sunlit) = Adjust horizontal radiation for 90 degree surface. Account for shading by opposing wall. - ! Integrate over all canyon orientations - ! Wall (shaded) = 0 - ! - ! Conservation check: Total incoming direct beam (sdir) = sdir_road + (sdir_shadewall + sdir_sunwall)*canyon_hwr - ! Multiplication by canyon_hwr scales wall fluxes (per unit wall area) to per unit ground area - ! - ! Source: Masson, V. (2000) A physically-based scheme for the urban energy budget in - ! atmospheric models. Boundary-Layer Meteorology 94:357-397 - ! - ! This analytical solution from Masson (2000) agrees with the numerical solution to - ! within 0.6 W/m**2 for sdir = 1000 W/m**2 and for all H/W from 0.1 to 10 by 0.1 - ! and all solar zenith angles from 1 to 90 deg by 1 - ! - ! !USES: - use clm_varcon, only : rpi - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8), intent(in) :: canyon_hwr( bounds%begl: ) ! ratio of building height to street width [landunit] - real(r8), intent(in) :: coszen( bounds%begl: ) ! cosine solar zenith angle [landunit] - real(r8), intent(in) :: zen( bounds%begl: ) ! solar zenith angle (radians) [landunit] - real(r8), intent(in) :: sdir( bounds%begl: , 1: ) ! direct beam solar radiation incident on horizontal surface [landunit, numrad] - real(r8), intent(out) :: sdir_road( bounds%begl: , 1: ) ! direct beam solar radiation incident on road per unit incident flux [landunit, numrad] - real(r8), intent(out) :: sdir_sunwall( bounds%begl: , 1: ) ! direct beam solar radiation (per unit wall area) incident on sunlit wall per unit incident flux [landunit, numrad] - real(r8), intent(out) :: sdir_shadewall( bounds%begl: , 1: ) ! direct beam solar radiation (per unit wall area) incident on shaded wall per unit incident flux [landunit, numrad] - ! - ! !LOCAL VARIABLES: - integer :: fl,l,i,ib ! indices - logical :: numchk = .false. ! true => perform numerical check of analytical solution - real(r8) :: theta0(bounds%begl:bounds%endl) ! critical canyon orientation for which road is no longer illuminated - real(r8) :: tanzen(bounds%begl:bounds%endl) ! tan(zenith angle) - real(r8) :: swall_projected ! direct beam solar radiation (per unit ground area) incident on wall - real(r8) :: err1(bounds%begl:bounds%endl) ! energy conservation error - real(r8) :: err2(bounds%begl:bounds%endl) ! energy conservation error - real(r8) :: err3(bounds%begl:bounds%endl) ! energy conservation error - real(r8) :: sumr ! sum of sroad for each orientation (0 <= theta <= pi/2) - real(r8) :: sumw ! sum of swall for each orientation (0 <= theta <= pi/2) - real(r8) :: num ! number of orientations - real(r8) :: theta ! canyon orientation relative to sun (0 <= theta <= pi/2) - real(r8) :: zen0 ! critical solar zenith angle for which sun begins to illuminate road - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(canyon_hwr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(coszen) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(zen) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir_road) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir_sunwall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir_shadewall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - theta0(l) = asin(min( (1._r8/(canyon_hwr(l)*tan(max(zen(l),0.000001_r8)))), 1._r8 )) - tanzen(l) = tan(zen(l)) - end if - end do - - do ib = 1,numrad - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - sdir_shadewall(l,ib) = 0._r8 - - ! incident solar radiation on wall and road integrated over all canyon orientations (0 <= theta <= pi/2) - - sdir_road(l,ib) = sdir(l,ib) * & - (2._r8*theta0(l)/rpi - 2./rpi*canyon_hwr(l)*tanzen(l)*(1._r8-cos(theta0(l)))) - sdir_sunwall(l,ib) = 2._r8 * sdir(l,ib) * ((1._r8/canyon_hwr(l))* & - (0.5_r8-theta0(l)/rpi) + (1._r8/rpi)*tanzen(l)*(1._r8-cos(theta0(l)))) - - ! conservation check for road and wall. need to use wall fluxes converted to ground area - - swall_projected = (sdir_shadewall(l,ib) + sdir_sunwall(l,ib)) * canyon_hwr(l) - err1(l) = sdir(l,ib) - (sdir_road(l,ib) + swall_projected) - else - sdir_road(l,ib) = 0._r8 - sdir_sunwall(l,ib) = 0._r8 - sdir_shadewall(l,ib) = 0._r8 - endif - end do - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - if (abs(err1(l)) > 0.001_r8) then - write (iulog,*) 'urban direct beam solar radiation balance error',err1(l) - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - endif - end do - - ! numerical check of analytical solution - ! sum sroad and swall over all canyon orientations (0 <= theta <= pi/2) - - if (numchk) then - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - sumr = 0._r8 - sumw = 0._r8 - num = 0._r8 - do i = 1, 9000 - theta = i/100._r8 * rpi/180._r8 - zen0 = atan(1._r8/(canyon_hwr(l)*sin(theta))) - if (zen(l) >= zen0) then - sumr = sumr + 0._r8 - sumw = sumw + sdir(l,ib) / canyon_hwr(l) - else - sumr = sumr + sdir(l,ib) * (1._r8-canyon_hwr(l)*sin(theta)*tanzen(l)) - sumw = sumw + sdir(l,ib) * sin(theta)*tanzen(l) - end if - num = num + 1._r8 - end do - err2(l) = sumr/num - sdir_road(l,ib) - err3(l) = sumw/num - sdir_sunwall(l,ib) - endif - end do - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - if (abs(err2(l)) > 0.0006_r8 ) then - write (iulog,*) 'urban road incident direct beam solar radiation error',err2(l) - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - if (abs(err3(l)) > 0.0006_r8 ) then - write (iulog,*) 'urban wall incident direct beam solar radiation error',err3(l) - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - end if - end if - end do - end if - - end do - - end subroutine incident_direct - - !----------------------------------------------------------------------- - subroutine incident_diffuse (bounds, & - num_urbanl, filter_urbanl, canyon_hwr, & - sdif, sdif_road, sdif_sunwall, sdif_shadewall, & - urbanparams_inst) - ! - ! !DESCRIPTION: - ! Diffuse solar radiation incident on walls and road in urban canyon - ! Conservation check: Total incoming diffuse - ! (sdif) = sdif_road + (sdif_shadewall + sdif_sunwall)*canyon_hwr - ! Multiplication by canyon_hwr scales wall fluxes (per unit wall area) to per unit ground area - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8) , intent(in) :: canyon_hwr ( bounds%begl: ) ! ratio of building height to street width [landunit] - real(r8) , intent(in) :: sdif ( bounds%begl: , 1: ) ! diffuse solar radiation incident on horizontal surface [landunit, numrad] - real(r8) , intent(out) :: sdif_road ( bounds%begl: , 1: ) ! diffuse solar radiation incident on road [landunit, numrad] - real(r8) , intent(out) :: sdif_sunwall ( bounds%begl: , 1: ) ! diffuse solar radiation (per unit wall area) incident on sunlit wall [landunit, numrad] - real(r8) , intent(out) :: sdif_shadewall ( bounds%begl: , 1: ) ! diffuse solar radiation (per unit wall area) incident on shaded wall [landunit, numrad] - type(urbanparams_type), intent(in) :: urbanparams_inst - ! - ! !LOCAL VARIABLES: - integer :: l, fl, ib ! indices - real(r8) :: err(bounds%begl:bounds%endl) ! energy conservation error (W/m**2) - real(r8) :: swall_projected ! diffuse solar radiation (per unit ground area) incident on wall (W/m**2) - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(canyon_hwr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif_road) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif_sunwall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif_shadewall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - - associate( & - vf_sr => urbanparams_inst%vf_sr , & ! Input: [real(r8) (:) ] view factor of sky for road - vf_sw => urbanparams_inst%vf_sw & ! Input: [real(r8) (:) ] view factor of sky for one wall - ) - - do ib = 1, numrad - - ! diffuse solar and conservation check. need to convert wall fluxes to ground area - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - sdif_road(l,ib) = sdif(l,ib) * vf_sr(l) - sdif_sunwall(l,ib) = sdif(l,ib) * vf_sw(l) - sdif_shadewall(l,ib) = sdif(l,ib) * vf_sw(l) - - swall_projected = (sdif_shadewall(l,ib) + sdif_sunwall(l,ib)) * canyon_hwr(l) - err(l) = sdif(l,ib) - (sdif_road(l,ib) + swall_projected) - end do - - ! error check - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - if (abs(err(l)) > 0.001_r8) then - write (iulog,*) 'urban diffuse solar radiation balance error',err(l) - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - end do - - end do - - end associate - - end subroutine incident_diffuse - - !----------------------------------------------------------------------- - subroutine net_solar (bounds , & - num_urbanl, filter_urbanl, coszen, canyon_hwr, wtroad_perv, sdir, sdif , & - alb_improad_dir, alb_perroad_dir, alb_wall_dir, alb_roof_dir , & - alb_improad_dif, alb_perroad_dif, alb_wall_dif, alb_roof_dif , & - sdir_road, sdir_sunwall, sdir_shadewall, & - sdif_road, sdif_sunwall, sdif_shadewall, & - sref_improad_dir, sref_perroad_dir, sref_sunwall_dir, sref_shadewall_dir, sref_roof_dir , & - sref_improad_dif, sref_perroad_dif, sref_sunwall_dif, sref_shadewall_dif, sref_roof_dif , & - urbanparams_inst, solarabs_inst) - ! - ! !DESCRIPTION: - ! Solar radiation absorbed by road and both walls in urban canyon allowing - ! for multiple reflection. - ! - ! !ARGUMENTS: - type (bounds_type), intent(in) :: bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8), intent(in) :: coszen ( bounds%begl: ) ! cosine solar zenith angle [landunit] - real(r8), intent(in) :: canyon_hwr ( bounds%begl: ) ! ratio of building height to street width [landunit] - real(r8), intent(in) :: wtroad_perv ( bounds%begl: ) ! weight of pervious road wrt total road [landunit] - real(r8), intent(in) :: sdir ( bounds%begl: , 1: ) ! direct beam solar radiation incident on horizontal surface [landunit, numrad] - real(r8), intent(in) :: sdif ( bounds%begl: , 1: ) ! diffuse solar radiation on horizontal surface [landunit, numrad] - real(r8), intent(in) :: alb_improad_dir ( bounds%begl: , 1: ) ! direct impervious road albedo [landunit, numrad] - real(r8), intent(in) :: alb_perroad_dir ( bounds%begl: , 1: ) ! direct pervious road albedo [landunit, numrad] - real(r8), intent(in) :: alb_wall_dir ( bounds%begl: , 1: ) ! direct wall albedo [landunit, numrad] - real(r8), intent(in) :: alb_roof_dir ( bounds%begl: , 1: ) ! direct roof albedo [landunit, numrad] - real(r8), intent(in) :: alb_improad_dif ( bounds%begl: , 1: ) ! diffuse impervious road albedo [landunit, numrad] - real(r8), intent(in) :: alb_perroad_dif ( bounds%begl: , 1: ) ! diffuse pervious road albedo [landunit, numrad] - real(r8), intent(in) :: alb_wall_dif ( bounds%begl: , 1: ) ! diffuse wall albedo [landunit, numrad] - real(r8), intent(in) :: alb_roof_dif ( bounds%begl: , 1: ) ! diffuse roof albedo [landunit, numrad] - real(r8), intent(in) :: sdir_road ( bounds%begl: , 1: ) ! direct beam solar radiation incident on road per unit incident flux [landunit, numrad] - real(r8), intent(in) :: sdir_sunwall ( bounds%begl: , 1: ) ! direct beam solar radiation (per unit wall area) incident on sunlit wall per unit incident flux [landunit, numrad] - real(r8), intent(in) :: sdir_shadewall ( bounds%begl: , 1: ) ! direct beam solar radiation (per unit wall area) incident on shaded wall per unit incident flux [landunit, numrad] - real(r8), intent(in) :: sdif_road ( bounds%begl: , 1: ) ! diffuse solar radiation incident on road per unit incident flux [landunit, numrad] - real(r8), intent(in) :: sdif_sunwall ( bounds%begl: , 1: ) ! diffuse solar radiation (per unit wall area) incident on sunlit wall per unit incident flux [landunit, numrad] - real(r8), intent(in) :: sdif_shadewall ( bounds%begl: , 1: ) ! diffuse solar radiation (per unit wall area) incident on shaded wall per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_improad_dir ( bounds%begl: , 1: ) ! direct solar rad reflected by impervious road (per unit ground area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_perroad_dir ( bounds%begl: , 1: ) ! direct solar rad reflected by pervious road (per unit ground area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_improad_dif ( bounds%begl: , 1: ) ! diffuse solar rad reflected by impervious road (per unit ground area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_perroad_dif ( bounds%begl: , 1: ) ! diffuse solar rad reflected by pervious road (per unit ground area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_sunwall_dir ( bounds%begl: , 1: ) ! direct solar rad reflected by sunwall (per unit wall area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_sunwall_dif ( bounds%begl: , 1: ) ! diffuse solar rad reflected by sunwall (per unit wall area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_shadewall_dir ( bounds%begl: , 1: ) ! direct solar rad reflected by shadewall (per unit wall area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_shadewall_dif ( bounds%begl: , 1: ) ! diffuse solar rad reflected by shadewall (per unit wall area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_roof_dir ( bounds%begl: , 1: ) ! direct solar rad reflected by roof (per unit ground area) per unit incident flux [landunit, numrad] - real(r8), intent(inout) :: sref_roof_dif ( bounds%begl: , 1: ) ! diffuse solar rad reflected by roof (per unit ground area) per unit incident flux [landunit, numrad] - type(urbanparams_type), intent(in) :: urbanparams_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - ! - ! !LOCAL VARIABLES - real(r8) :: wtroad_imperv(bounds%begl:bounds%endl) ! weight of impervious road wrt total road - real(r8) :: sabs_canyon_dir(bounds%begl:bounds%endl) ! direct solar rad absorbed by canyon per unit incident flux - real(r8) :: sabs_canyon_dif(bounds%begl:bounds%endl) ! diffuse solar rad absorbed by canyon per unit incident flux - real(r8) :: sref_canyon_dir(bounds%begl:bounds%endl) ! direct solar reflected by canyon per unit incident flux - real(r8) :: sref_canyon_dif(bounds%begl:bounds%endl) ! diffuse solar reflected by canyon per unit incident flux - - real(r8) :: improad_a_dir(bounds%begl:bounds%endl) ! absorbed direct solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_a_dif(bounds%begl:bounds%endl) ! absorbed diffuse solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_r_dir(bounds%begl:bounds%endl) ! reflected direct solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_r_dif(bounds%begl:bounds%endl) ! reflected diffuse solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_r_sky_dir(bounds%begl:bounds%endl) ! improad_r_dir to sky per unit incident flux - real(r8) :: improad_r_sunwall_dir(bounds%begl:bounds%endl) ! improad_r_dir to sunlit wall per unit incident flux - real(r8) :: improad_r_shadewall_dir(bounds%begl:bounds%endl) ! improad_r_dir to shaded wall per unit incident flux - real(r8) :: improad_r_sky_dif(bounds%begl:bounds%endl) ! improad_r_dif to sky per unit incident flux - real(r8) :: improad_r_sunwall_dif(bounds%begl:bounds%endl) ! improad_r_dif to sunlit wall per unit incident flux - real(r8) :: improad_r_shadewall_dif(bounds%begl:bounds%endl) ! improad_r_dif to shaded wall per unit incident flux - - real(r8) :: perroad_a_dir(bounds%begl:bounds%endl) ! absorbed direct solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_a_dif(bounds%begl:bounds%endl) ! absorbed diffuse solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_r_dir(bounds%begl:bounds%endl) ! reflected direct solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_r_dif(bounds%begl:bounds%endl) ! reflected diffuse solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_r_sky_dir(bounds%begl:bounds%endl) ! perroad_r_dir to sky per unit incident flux - real(r8) :: perroad_r_sunwall_dir(bounds%begl:bounds%endl) ! perroad_r_dir to sunlit wall per unit incident flux - real(r8) :: perroad_r_shadewall_dir(bounds%begl:bounds%endl) ! perroad_r_dir to shaded wall per unit incident flux - real(r8) :: perroad_r_sky_dif(bounds%begl:bounds%endl) ! perroad_r_dif to sky per unit incident flux - real(r8) :: perroad_r_sunwall_dif(bounds%begl:bounds%endl) ! perroad_r_dif to sunlit wall per unit incident flux - real(r8) :: perroad_r_shadewall_dif(bounds%begl:bounds%endl) ! perroad_r_dif to shaded wall per unit incident flux - - real(r8) :: road_a_dir(bounds%begl:bounds%endl) ! absorbed direct solar for total road after "n" reflections per unit incident flux - real(r8) :: road_a_dif(bounds%begl:bounds%endl) ! absorbed diffuse solar for total road after "n" reflections per unit incident flux - real(r8) :: road_r_dir(bounds%begl:bounds%endl) ! reflected direct solar for total road after "n" reflections per unit incident flux - real(r8) :: road_r_dif(bounds%begl:bounds%endl) ! reflected diffuse solar for total road after "n" reflections per unit incident flux - real(r8) :: road_r_sky_dir(bounds%begl:bounds%endl) ! road_r_dir to sky per unit incident flux - real(r8) :: road_r_sunwall_dir(bounds%begl:bounds%endl) ! road_r_dir to sunlit wall per unit incident flux - real(r8) :: road_r_shadewall_dir(bounds%begl:bounds%endl) ! road_r_dir to shaded wall per unit incident flux - real(r8) :: road_r_sky_dif(bounds%begl:bounds%endl) ! road_r_dif to sky per unit incident flux - real(r8) :: road_r_sunwall_dif(bounds%begl:bounds%endl) ! road_r_dif to sunlit wall per unit incident flux - real(r8) :: road_r_shadewall_dif(bounds%begl:bounds%endl) ! road_r_dif to shaded wall per unit incident flux - - real(r8) :: sunwall_a_dir(bounds%begl:bounds%endl) ! absorbed direct solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_a_dif(bounds%begl:bounds%endl) ! absorbed diffuse solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_r_dir(bounds%begl:bounds%endl) ! reflected direct solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_r_dif(bounds%begl:bounds%endl) ! reflected diffuse solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_r_sky_dir(bounds%begl:bounds%endl) ! sunwall_r_dir to sky per unit incident flux - real(r8) :: sunwall_r_road_dir(bounds%begl:bounds%endl) ! sunwall_r_dir to road per unit incident flux - real(r8) :: sunwall_r_shadewall_dir(bounds%begl:bounds%endl) ! sunwall_r_dir to opposing (shaded) wall per unit incident flux - real(r8) :: sunwall_r_sky_dif(bounds%begl:bounds%endl) ! sunwall_r_dif to sky per unit incident flux - real(r8) :: sunwall_r_road_dif(bounds%begl:bounds%endl) ! sunwall_r_dif to road per unit incident flux - real(r8) :: sunwall_r_shadewall_dif(bounds%begl:bounds%endl) ! sunwall_r_dif to opposing (shaded) wall per unit incident flux - - real(r8) :: shadewall_a_dir(bounds%begl:bounds%endl) ! absorbed direct solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_a_dif(bounds%begl:bounds%endl) ! absorbed diffuse solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_r_dir(bounds%begl:bounds%endl) ! reflected direct solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_r_dif(bounds%begl:bounds%endl) ! reflected diffuse solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_r_sky_dir(bounds%begl:bounds%endl) ! shadewall_r_dir to sky per unit incident flux - real(r8) :: shadewall_r_road_dir(bounds%begl:bounds%endl) ! shadewall_r_dir to road per unit incident flux - real(r8) :: shadewall_r_sunwall_dir(bounds%begl:bounds%endl) ! shadewall_r_dir to opposing (sunlit) wall per unit incident flux - real(r8) :: shadewall_r_sky_dif(bounds%begl:bounds%endl) ! shadewall_r_dif to sky per unit incident flux - real(r8) :: shadewall_r_road_dif(bounds%begl:bounds%endl) ! shadewall_r_dif to road per unit incident flux - real(r8) :: shadewall_r_sunwall_dif(bounds%begl:bounds%endl) ! shadewall_r_dif to opposing (sunlit) wall per unit incident flux - - real(r8) :: canyon_alb_dir(bounds%begl:bounds%endl) ! direct canyon albedo - real(r8) :: canyon_alb_dif(bounds%begl:bounds%endl) ! diffuse canyon albedo - - real(r8) :: stot(bounds%begl:bounds%endl) ! sum of radiative terms - real(r8) :: stot_dir(bounds%begl:bounds%endl) ! sum of direct radiative terms - real(r8) :: stot_dif(bounds%begl:bounds%endl) ! sum of diffuse radiative terms - - integer :: l,fl,ib ! indices - integer :: iter_dir,iter_dif ! iteration counter - real(r8) :: crit ! convergence criterion - real(r8) :: err ! energy conservation error - integer :: pass - integer, parameter :: n = 50 ! number of interations - real(r8) :: sabs_road ! temporary for absorption over road - real(r8) :: sref_road ! temporary for reflected over road - real(r8), parameter :: errcrit = .00001_r8 ! error criteria - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(coszen) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(canyon_hwr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wtroad_perv) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_improad_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_perroad_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_wall_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_roof_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_improad_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_perroad_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_wall_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(alb_roof_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir_road) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir_sunwall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdir_shadewall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif_road) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif_sunwall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sdif_shadewall) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_improad_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_perroad_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_improad_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_perroad_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_sunwall_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_sunwall_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_shadewall_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_shadewall_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_roof_dir) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sref_roof_dif) == (/bounds%endl, numrad/)), errMsg(sourcefile, __LINE__)) - - associate( & - vf_sr => urbanparams_inst%vf_sr , & ! Input: [real(r8) (:) ] view factor of sky for road - vf_wr => urbanparams_inst%vf_wr , & ! Input: [real(r8) (:) ] view factor of one wall for road - vf_sw => urbanparams_inst%vf_sw , & ! Input: [real(r8) (:) ] view factor of sky for one wall - vf_rw => urbanparams_inst%vf_rw , & ! Input: [real(r8) (:) ] view factor of road for one wall - vf_ww => urbanparams_inst%vf_ww , & ! Input: [real(r8) (:) ] view factor of opposing wall for one wall - - sabs_roof_dir => solarabs_inst%sabs_roof_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by roof per unit ground area per unit incident flux - sabs_roof_dif => solarabs_inst%sabs_roof_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by roof per unit ground area per unit incident flux - sabs_sunwall_dir => solarabs_inst%sabs_sunwall_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by sunwall per unit wall area per unit incident flux - sabs_sunwall_dif => solarabs_inst%sabs_sunwall_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by sunwall per unit wall area per unit incident flux - sabs_shadewall_dir => solarabs_inst%sabs_shadewall_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by shadewall per unit wall area per unit incident flux - sabs_shadewall_dif => solarabs_inst%sabs_shadewall_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by shadewall per unit wall area per unit incident flux - sabs_improad_dir => solarabs_inst%sabs_improad_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by impervious road per unit ground area per unit incident flux - sabs_improad_dif => solarabs_inst%sabs_improad_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by impervious road per unit ground area per unit incident flux - sabs_perroad_dir => solarabs_inst%sabs_perroad_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by pervious road per unit ground area per unit incident flux - sabs_perroad_dif => solarabs_inst%sabs_perroad_dif_lun & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by pervious road per unit ground area per unit incident flux - ) - - ! Calculate impervious road - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - wtroad_imperv(l) = 1._r8 - wtroad_perv(l) - end do - - do ib = 1,numrad - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - - ! initial absorption and reflection for road and both walls. - ! distribute reflected radiation to sky, road, and walls - ! according to appropriate view factor. radiation reflected to - ! road and walls will undergo multiple reflections within the canyon. - ! do separately for direct beam and diffuse radiation. - - ! direct beam - - road_a_dir(l) = 0.0_r8 - road_r_dir(l) = 0.0_r8 - improad_a_dir(l) = (1._r8-alb_improad_dir(l,ib)) * sdir_road(l,ib) - improad_r_dir(l) = alb_improad_dir(l,ib) * sdir_road(l,ib) - improad_r_sky_dir(l) = improad_r_dir(l) * vf_sr(l) - improad_r_sunwall_dir(l) = improad_r_dir(l) * vf_wr(l) - improad_r_shadewall_dir(l) = improad_r_dir(l) * vf_wr(l) - road_a_dir(l) = road_a_dir(l) + improad_a_dir(l)*wtroad_imperv(l) - road_r_dir(l) = road_r_dir(l) + improad_r_dir(l)*wtroad_imperv(l) - - perroad_a_dir(l) = (1._r8-alb_perroad_dir(l,ib)) * sdir_road(l,ib) - perroad_r_dir(l) = alb_perroad_dir(l,ib) * sdir_road(l,ib) - perroad_r_sky_dir(l) = perroad_r_dir(l) * vf_sr(l) - perroad_r_sunwall_dir(l) = perroad_r_dir(l) * vf_wr(l) - perroad_r_shadewall_dir(l) = perroad_r_dir(l) * vf_wr(l) - road_a_dir(l) = road_a_dir(l) + perroad_a_dir(l)*wtroad_perv(l) - road_r_dir(l) = road_r_dir(l) + perroad_r_dir(l)*wtroad_perv(l) - - road_r_sky_dir(l) = road_r_dir(l) * vf_sr(l) - road_r_sunwall_dir(l) = road_r_dir(l) * vf_wr(l) - road_r_shadewall_dir(l) = road_r_dir(l) * vf_wr(l) - - sunwall_a_dir(l) = (1._r8-alb_wall_dir(l,ib)) * sdir_sunwall(l,ib) - sunwall_r_dir(l) = alb_wall_dir(l,ib) * sdir_sunwall(l,ib) - sunwall_r_sky_dir(l) = sunwall_r_dir(l) * vf_sw(l) - sunwall_r_road_dir(l) = sunwall_r_dir(l) * vf_rw(l) - sunwall_r_shadewall_dir(l) = sunwall_r_dir(l) * vf_ww(l) - - shadewall_a_dir(l) = (1._r8-alb_wall_dir(l,ib)) * sdir_shadewall(l,ib) - shadewall_r_dir(l) = alb_wall_dir(l,ib) * sdir_shadewall(l,ib) - shadewall_r_sky_dir(l) = shadewall_r_dir(l) * vf_sw(l) - shadewall_r_road_dir(l) = shadewall_r_dir(l) * vf_rw(l) - shadewall_r_sunwall_dir(l) = shadewall_r_dir(l) * vf_ww(l) - - ! diffuse - - road_a_dif(l) = 0.0_r8 - road_r_dif(l) = 0.0_r8 - improad_a_dif(l) = (1._r8-alb_improad_dif(l,ib)) * sdif_road(l,ib) - improad_r_dif(l) = alb_improad_dif(l,ib) * sdif_road(l,ib) - improad_r_sky_dif(l) = improad_r_dif(l) * vf_sr(l) - improad_r_sunwall_dif(l) = improad_r_dif(l) * vf_wr(l) - improad_r_shadewall_dif(l) = improad_r_dif(l) * vf_wr(l) - road_a_dif(l) = road_a_dif(l) + improad_a_dif(l)*wtroad_imperv(l) - road_r_dif(l) = road_r_dif(l) + improad_r_dif(l)*wtroad_imperv(l) - - perroad_a_dif(l) = (1._r8-alb_perroad_dif(l,ib)) * sdif_road(l,ib) - perroad_r_dif(l) = alb_perroad_dif(l,ib) * sdif_road(l,ib) - perroad_r_sky_dif(l) = perroad_r_dif(l) * vf_sr(l) - perroad_r_sunwall_dif(l) = perroad_r_dif(l) * vf_wr(l) - perroad_r_shadewall_dif(l) = perroad_r_dif(l) * vf_wr(l) - road_a_dif(l) = road_a_dif(l) + perroad_a_dif(l)*wtroad_perv(l) - road_r_dif(l) = road_r_dif(l) + perroad_r_dif(l)*wtroad_perv(l) - - road_r_sky_dif(l) = road_r_dif(l) * vf_sr(l) - road_r_sunwall_dif(l) = road_r_dif(l) * vf_wr(l) - road_r_shadewall_dif(l) = road_r_dif(l) * vf_wr(l) - - sunwall_a_dif(l) = (1._r8-alb_wall_dif(l,ib)) * sdif_sunwall(l,ib) - sunwall_r_dif(l) = alb_wall_dif(l,ib) * sdif_sunwall(l,ib) - sunwall_r_sky_dif(l) = sunwall_r_dif(l) * vf_sw(l) - sunwall_r_road_dif(l) = sunwall_r_dif(l) * vf_rw(l) - sunwall_r_shadewall_dif(l) = sunwall_r_dif(l) * vf_ww(l) - - shadewall_a_dif(l) = (1._r8-alb_wall_dif(l,ib)) * sdif_shadewall(l,ib) - shadewall_r_dif(l) = alb_wall_dif(l,ib) * sdif_shadewall(l,ib) - shadewall_r_sky_dif(l) = shadewall_r_dif(l) * vf_sw(l) - shadewall_r_road_dif(l) = shadewall_r_dif(l) * vf_rw(l) - shadewall_r_sunwall_dif(l) = shadewall_r_dif(l) * vf_ww(l) - - ! initialize sum of direct and diffuse solar absorption and reflection for road and both walls - - sabs_improad_dir(l,ib) = improad_a_dir(l) - sabs_perroad_dir(l,ib) = perroad_a_dir(l) - sabs_sunwall_dir(l,ib) = sunwall_a_dir(l) - sabs_shadewall_dir(l,ib) = shadewall_a_dir(l) - - sabs_improad_dif(l,ib) = improad_a_dif(l) - sabs_perroad_dif(l,ib) = perroad_a_dif(l) - sabs_sunwall_dif(l,ib) = sunwall_a_dif(l) - sabs_shadewall_dif(l,ib) = shadewall_a_dif(l) - - sref_improad_dir(l,ib) = improad_r_sky_dir(l) - sref_perroad_dir(l,ib) = perroad_r_sky_dir(l) - sref_sunwall_dir(l,ib) = sunwall_r_sky_dir(l) - sref_shadewall_dir(l,ib) = shadewall_r_sky_dir(l) - - sref_improad_dif(l,ib) = improad_r_sky_dif(l) - sref_perroad_dif(l,ib) = perroad_r_sky_dif(l) - sref_sunwall_dif(l,ib) = sunwall_r_sky_dif(l) - sref_shadewall_dif(l,ib) = shadewall_r_sky_dif(l) - endif - - end do - - ! absorption and reflection for walls and road with multiple reflections - ! (i.e., absorb and reflect initial reflection in canyon and allow for - ! subsequent scattering) - ! - ! (1) absorption and reflection of scattered solar radiation - ! road: reflected fluxes from walls need to be projected to ground area - ! wall: reflected flux from road needs to be projected to wall area - ! - ! (2) add absorbed radiation for ith reflection to total absorbed - ! - ! (3) distribute reflected radiation to sky, road, and walls according to view factors - ! - ! (4) add solar reflection to sky for ith reflection to total reflection - ! - ! (5) stop iteration when absorption for ith reflection is less than some nominal amount. - ! small convergence criteria is required to ensure solar radiation is conserved - ! - ! do separately for direct beam and diffuse - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - - ! reflected direct beam - - do iter_dir = 1, n - ! step (1) - - stot(l) = (sunwall_r_road_dir(l) + shadewall_r_road_dir(l))*canyon_hwr(l) - - road_a_dir(l) = 0.0_r8 - road_r_dir(l) = 0.0_r8 - improad_a_dir(l) = (1._r8-alb_improad_dir(l,ib)) * stot(l) - improad_r_dir(l) = alb_improad_dir(l,ib) * stot(l) - road_a_dir(l) = road_a_dir(l) + improad_a_dir(l)*wtroad_imperv(l) - road_r_dir(l) = road_r_dir(l) + improad_r_dir(l)*wtroad_imperv(l) - perroad_a_dir(l) = (1._r8-alb_perroad_dir(l,ib)) * stot(l) - perroad_r_dir(l) = alb_perroad_dir(l,ib) * stot(l) - road_a_dir(l) = road_a_dir(l) + perroad_a_dir(l)*wtroad_perv(l) - road_r_dir(l) = road_r_dir(l) + perroad_r_dir(l)*wtroad_perv(l) - - stot(l) = road_r_sunwall_dir(l)/canyon_hwr(l) + shadewall_r_sunwall_dir(l) - sunwall_a_dir(l) = (1._r8-alb_wall_dir(l,ib)) * stot(l) - sunwall_r_dir(l) = alb_wall_dir(l,ib) * stot(l) - - stot(l) = road_r_shadewall_dir(l)/canyon_hwr(l) + sunwall_r_shadewall_dir(l) - shadewall_a_dir(l) = (1._r8-alb_wall_dir(l,ib)) * stot(l) - shadewall_r_dir(l) = alb_wall_dir(l,ib) * stot(l) - - ! step (2) - - sabs_improad_dir(l,ib) = sabs_improad_dir(l,ib) + improad_a_dir(l) - sabs_perroad_dir(l,ib) = sabs_perroad_dir(l,ib) + perroad_a_dir(l) - sabs_sunwall_dir(l,ib) = sabs_sunwall_dir(l,ib) + sunwall_a_dir(l) - sabs_shadewall_dir(l,ib) = sabs_shadewall_dir(l,ib) + shadewall_a_dir(l) - - ! step (3) - - improad_r_sky_dir(l) = improad_r_dir(l) * vf_sr(l) - improad_r_sunwall_dir(l) = improad_r_dir(l) * vf_wr(l) - improad_r_shadewall_dir(l) = improad_r_dir(l) * vf_wr(l) - - perroad_r_sky_dir(l) = perroad_r_dir(l) * vf_sr(l) - perroad_r_sunwall_dir(l) = perroad_r_dir(l) * vf_wr(l) - perroad_r_shadewall_dir(l) = perroad_r_dir(l) * vf_wr(l) - - road_r_sky_dir(l) = road_r_dir(l) * vf_sr(l) - road_r_sunwall_dir(l) = road_r_dir(l) * vf_wr(l) - road_r_shadewall_dir(l) = road_r_dir(l) * vf_wr(l) - - sunwall_r_sky_dir(l) = sunwall_r_dir(l) * vf_sw(l) - sunwall_r_road_dir(l) = sunwall_r_dir(l) * vf_rw(l) - sunwall_r_shadewall_dir(l) = sunwall_r_dir(l) * vf_ww(l) - - shadewall_r_sky_dir(l) = shadewall_r_dir(l) * vf_sw(l) - shadewall_r_road_dir(l) = shadewall_r_dir(l) * vf_rw(l) - shadewall_r_sunwall_dir(l) = shadewall_r_dir(l) * vf_ww(l) - - ! step (4) - - sref_improad_dir(l,ib) = sref_improad_dir(l,ib) + improad_r_sky_dir(l) - sref_perroad_dir(l,ib) = sref_perroad_dir(l,ib) + perroad_r_sky_dir(l) - sref_sunwall_dir(l,ib) = sref_sunwall_dir(l,ib) + sunwall_r_sky_dir(l) - sref_shadewall_dir(l,ib) = sref_shadewall_dir(l,ib) + shadewall_r_sky_dir(l) - - ! step (5) - - crit = max(road_a_dir(l), sunwall_a_dir(l), shadewall_a_dir(l)) - if (crit < errcrit) exit - end do - if (iter_dir >= n) then - write (iulog,*) 'urban net solar radiation error: no convergence, direct beam' - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - - ! reflected diffuse - - do iter_dif = 1, n - ! step (1) - - stot(l) = (sunwall_r_road_dif(l) + shadewall_r_road_dif(l))*canyon_hwr(l) - road_a_dif(l) = 0.0_r8 - road_r_dif(l) = 0.0_r8 - improad_a_dif(l) = (1._r8-alb_improad_dif(l,ib)) * stot(l) - improad_r_dif(l) = alb_improad_dif(l,ib) * stot(l) - road_a_dif(l) = road_a_dif(l) + improad_a_dif(l)*wtroad_imperv(l) - road_r_dif(l) = road_r_dif(l) + improad_r_dif(l)*wtroad_imperv(l) - perroad_a_dif(l) = (1._r8-alb_perroad_dif(l,ib)) * stot(l) - perroad_r_dif(l) = alb_perroad_dif(l,ib) * stot(l) - road_a_dif(l) = road_a_dif(l) + perroad_a_dif(l)*wtroad_perv(l) - road_r_dif(l) = road_r_dif(l) + perroad_r_dif(l)*wtroad_perv(l) - - stot(l) = road_r_sunwall_dif(l)/canyon_hwr(l) + shadewall_r_sunwall_dif(l) - sunwall_a_dif(l) = (1._r8-alb_wall_dif(l,ib)) * stot(l) - sunwall_r_dif(l) = alb_wall_dif(l,ib) * stot(l) - - stot(l) = road_r_shadewall_dif(l)/canyon_hwr(l) + sunwall_r_shadewall_dif(l) - shadewall_a_dif(l) = (1._r8-alb_wall_dif(l,ib)) * stot(l) - shadewall_r_dif(l) = alb_wall_dif(l,ib) * stot(l) - - ! step (2) - - sabs_improad_dif(l,ib) = sabs_improad_dif(l,ib) + improad_a_dif(l) - sabs_perroad_dif(l,ib) = sabs_perroad_dif(l,ib) + perroad_a_dif(l) - sabs_sunwall_dif(l,ib) = sabs_sunwall_dif(l,ib) + sunwall_a_dif(l) - sabs_shadewall_dif(l,ib) = sabs_shadewall_dif(l,ib) + shadewall_a_dif(l) - - ! step (3) - - improad_r_sky_dif(l) = improad_r_dif(l) * vf_sr(l) - improad_r_sunwall_dif(l) = improad_r_dif(l) * vf_wr(l) - improad_r_shadewall_dif(l) = improad_r_dif(l) * vf_wr(l) - - perroad_r_sky_dif(l) = perroad_r_dif(l) * vf_sr(l) - perroad_r_sunwall_dif(l) = perroad_r_dif(l) * vf_wr(l) - perroad_r_shadewall_dif(l) = perroad_r_dif(l) * vf_wr(l) - - road_r_sky_dif(l) = road_r_dif(l) * vf_sr(l) - road_r_sunwall_dif(l) = road_r_dif(l) * vf_wr(l) - road_r_shadewall_dif(l) = road_r_dif(l) * vf_wr(l) - - sunwall_r_sky_dif(l) = sunwall_r_dif(l) * vf_sw(l) - sunwall_r_road_dif(l) = sunwall_r_dif(l) * vf_rw(l) - sunwall_r_shadewall_dif(l) = sunwall_r_dif(l) * vf_ww(l) - - shadewall_r_sky_dif(l) = shadewall_r_dif(l) * vf_sw(l) - shadewall_r_road_dif(l) = shadewall_r_dif(l) * vf_rw(l) - shadewall_r_sunwall_dif(l) = shadewall_r_dif(l) * vf_ww(l) - - ! step (4) - - sref_improad_dif(l,ib) = sref_improad_dif(l,ib) + improad_r_sky_dif(l) - sref_perroad_dif(l,ib) = sref_perroad_dif(l,ib) + perroad_r_sky_dif(l) - sref_sunwall_dif(l,ib) = sref_sunwall_dif(l,ib) + sunwall_r_sky_dif(l) - sref_shadewall_dif(l,ib) = sref_shadewall_dif(l,ib) + shadewall_r_sky_dif(l) - - ! step (5) - - crit = max(road_a_dif(l), sunwall_a_dif(l), shadewall_a_dif(l)) - if (crit < errcrit) exit - end do - if (iter_dif >= n) then - write (iulog,*) 'urban net solar radiation error: no convergence, diffuse' - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - - ! total reflected by canyon - sum of solar reflection to sky from canyon. - ! project wall fluxes to horizontal surface - - sref_canyon_dir(l) = 0.0_r8 - sref_canyon_dif(l) = 0.0_r8 - sref_canyon_dir(l) = sref_canyon_dir(l) + sref_improad_dir(l,ib)*wtroad_imperv(l) - sref_canyon_dif(l) = sref_canyon_dif(l) + sref_improad_dif(l,ib)*wtroad_imperv(l) - sref_canyon_dir(l) = sref_canyon_dir(l) + sref_perroad_dir(l,ib)*wtroad_perv(l) - sref_canyon_dif(l) = sref_canyon_dif(l) + sref_perroad_dif(l,ib)*wtroad_perv(l) - sref_canyon_dir(l) = sref_canyon_dir(l) + (sref_sunwall_dir(l,ib) + sref_shadewall_dir(l,ib))*canyon_hwr(l) - sref_canyon_dif(l) = sref_canyon_dif(l) + (sref_sunwall_dif(l,ib) + sref_shadewall_dif(l,ib))*canyon_hwr(l) - - ! total absorbed by canyon. project wall fluxes to horizontal surface - - sabs_canyon_dir(l) = 0.0_r8 - sabs_canyon_dif(l) = 0.0_r8 - sabs_canyon_dir(l) = sabs_canyon_dir(l) + sabs_improad_dir(l,ib)*wtroad_imperv(l) - sabs_canyon_dif(l) = sabs_canyon_dif(l) + sabs_improad_dif(l,ib)*wtroad_imperv(l) - sabs_canyon_dir(l) = sabs_canyon_dir(l) + sabs_perroad_dir(l,ib)*wtroad_perv(l) - sabs_canyon_dif(l) = sabs_canyon_dif(l) + sabs_perroad_dif(l,ib)*wtroad_perv(l) - sabs_canyon_dir(l) = sabs_canyon_dir(l) + (sabs_sunwall_dir(l,ib) + sabs_shadewall_dir(l,ib))*canyon_hwr(l) - sabs_canyon_dif(l) = sabs_canyon_dif(l) + (sabs_sunwall_dif(l,ib) + sabs_shadewall_dif(l,ib))*canyon_hwr(l) - - ! conservation check. note: previous conservation checks confirm partioning of total direct - ! beam and diffuse radiation from atmosphere to road and walls is conserved as - ! sdir (from atmosphere) = sdir_road + (sdir_sunwall + sdir_shadewall)*canyon_hwr - ! sdif (from atmosphere) = sdif_road + (sdif_sunwall + sdif_shadewall)*canyon_hwr - - stot_dir(l) = sdir_road(l,ib) + (sdir_sunwall(l,ib) + sdir_shadewall(l,ib))*canyon_hwr(l) - stot_dif(l) = sdif_road(l,ib) + (sdif_sunwall(l,ib) + sdif_shadewall(l,ib))*canyon_hwr(l) - - err = stot_dir(l) + stot_dif(l) & - - (sabs_canyon_dir(l) + sabs_canyon_dif(l) + sref_canyon_dir(l) + sref_canyon_dif(l)) - if (abs(err) > 0.001_r8 ) then - write(iulog,*)'urban net solar radiation balance error for ib=',ib,' err= ',err - write(iulog,*)' l= ',l,' ib= ',ib - write(iulog,*)' stot_dir = ',stot_dir(l) - write(iulog,*)' stot_dif = ',stot_dif(l) - write(iulog,*)' sabs_canyon_dir = ',sabs_canyon_dir(l) - write(iulog,*)' sabs_canyon_dif = ',sabs_canyon_dif(l) - write(iulog,*)' sref_canyon_dir = ',sref_canyon_dir(l) - write(iulog,*)' sref_canyon_dif = ',sref_canyon_dir(l) - write(iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - - ! canyon albedo - - canyon_alb_dif(l) = sref_canyon_dif(l) / max(stot_dif(l), 1.e-06_r8) - canyon_alb_dir(l) = sref_canyon_dir(l) / max(stot_dir(l), 1.e-06_r8) - end if - - end do ! end of landunit loop - - ! Refected and absorbed solar radiation per unit incident radiation for roof - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (coszen(l) > 0._r8) then - sref_roof_dir(l,ib) = alb_roof_dir(l,ib) * sdir(l,ib) - sref_roof_dif(l,ib) = alb_roof_dif(l,ib) * sdif(l,ib) - sabs_roof_dir(l,ib) = sdir(l,ib) - sref_roof_dir(l,ib) - sabs_roof_dif(l,ib) = sdif(l,ib) - sref_roof_dif(l,ib) - end if - end do - - end do ! end of radiation band loop - - end associate - - end subroutine net_solar - -end module UrbanAlbedoMod - diff --git a/src/biogeophys/UrbanFluxesMod.F90 b/src/biogeophys/UrbanFluxesMod.F90 deleted file mode 100644 index 0a9702f295..0000000000 --- a/src/biogeophys/UrbanFluxesMod.F90 +++ /dev/null @@ -1,1115 +0,0 @@ -module UrbanFluxesMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate solar and longwave radiation, and turbulent fluxes for urban landunit - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : numrad - use clm_varcon , only : isecspday, degpsec, namel - use clm_varctl , only : iulog - use abortutils , only : endrun - use UrbanParamsType , only : urbanparams_type - use UrbanParamsType , only : urban_wasteheat_on, urban_hac_on, urban_hac - use UrbanParamsType , only : IsSimpleBuildTemp - use atm2lndType , only : atm2lnd_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use FrictionVelocityMod , only : frictionvel_type - use EnergyFluxType , only : energyflux_type - use WaterfluxType , only : waterflux_type - use HumanIndexMod , only : humanindex_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanFluxes ! Urban physics - turbulent fluxes - !----------------------------------------------------------------------- - - ! !PRIVATE FUNCTIONS: - private :: wasteheat ! Figure out the energy flux from urban heating and cooling - private :: simple_wasteheatfromac ! Calculate waste heat from air-conditioning with the simpler method (CLM4.5) - private :: calc_simple_internal_building_temp ! Calculate internal building temperature by simpler method (CLM4.5) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine UrbanFluxes (bounds, num_nourbanl, filter_nourbanl, & - num_urbanl, filter_urbanl, num_urbanc, filter_urbanc, num_urbanp, filter_urbanp, & - atm2lnd_inst, urbanparams_inst, soilstate_inst, temperature_inst, & - waterstate_inst, frictionvel_inst, energyflux_inst, waterflux_inst, & - humanindex_inst) - ! - ! !DESCRIPTION: - ! Turbulent and momentum fluxes from urban canyon (consisting of roof, sunwall, - ! shadewall, pervious and impervious road). - - ! !USES: - use clm_varcon , only : cpair, vkc, spval, grav, pondmx_urban, rpi, rgas - use clm_varcon , only : ht_wasteheat_factor, ac_wasteheat_factor, wasteheat_limit - use column_varcon , only : icol_shadewall, icol_road_perv, icol_road_imperv - use column_varcon , only : icol_roof, icol_sunwall - use filterMod , only : filter - use FrictionVelocityMod , only : FrictionVelocity, MoninObukIni, frictionvel_parms_inst - use QSatMod , only : QSat - use clm_varpar , only : maxpatch_urb, nlevurb, nlevgrnd - use clm_time_manager , only : get_curr_date, get_step_size, get_nstep - use HumanIndexMod , only : calc_human_stress_indices, Wet_Bulb, Wet_BulbS, HeatIndex, AppTemp, & - swbgt, hmdex, dis_coi, dis_coiS, THIndex, & - SwampCoolEff, KtoC, VaporPres - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nourbanl ! number of non-urban landunits in clump - integer , intent(in) :: filter_nourbanl(:) ! non-urban landunit filter - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(:) ! urban column filter - integer , intent(in) :: num_urbanp ! number of urban patches in clump - integer , intent(in) :: filter_urbanp(:) ! urban pft filter - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(humanindex_type) , intent(inout) :: humanindex_inst - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: sub="UrbanFluxes" - integer :: fp,fc,fl,f,p,c,l,g,j,pi,i ! indices - - real(r8) :: canyontop_wind(bounds%begl:bounds%endl) ! wind at canyon top (m/s) - real(r8) :: canyon_u_wind(bounds%begl:bounds%endl) ! u-component of wind speed inside canyon (m/s) - real(r8) :: canyon_wind(bounds%begl:bounds%endl) ! net wind speed inside canyon (m/s) - real(r8) :: canyon_resistance(bounds%begl:bounds%endl) ! resistance to heat and moisture transfer from canyon road/walls to canyon air (s/m) - - real(r8) :: ur(bounds%begl:bounds%endl) ! wind speed at reference height (m/s) - real(r8) :: ustar(bounds%begl:bounds%endl) ! friction velocity (m/s) - real(r8) :: ramu(bounds%begl:bounds%endl) ! aerodynamic resistance (s/m) - real(r8) :: rahu(bounds%begl:bounds%endl) ! thermal resistance (s/m) - real(r8) :: rawu(bounds%begl:bounds%endl) ! moisture resistance (s/m) - real(r8) :: temp1(bounds%begl:bounds%endl) ! relation for potential temperature profile - real(r8) :: temp12m(bounds%begl:bounds%endl) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(bounds%begl:bounds%endl) ! relation for specific humidity profile - real(r8) :: temp22m(bounds%begl:bounds%endl) ! relation for specific humidity profile applied at 2-m - real(r8) :: thm_g(bounds%begl:bounds%endl) ! intermediate variable (forc_t+0.0098*forc_hgt_t) - real(r8) :: thv_g(bounds%begl:bounds%endl) ! virtual potential temperature (K) - real(r8) :: dth(bounds%begl:bounds%endl) ! diff of virtual temp. between ref. height and surface - real(r8) :: dqh(bounds%begl:bounds%endl) ! diff of humidity between ref. height and surface - real(r8) :: zldis(bounds%begl:bounds%endl) ! reference height "minus" zero displacement height (m) - real(r8) :: um(bounds%begl:bounds%endl) ! wind speed including the stablity effect (m/s) - real(r8) :: obu(bounds%begl:bounds%endl) ! Monin-Obukhov length (m) - real(r8) :: taf_numer(bounds%begl:bounds%endl) ! numerator of taf equation (K m/s) - real(r8) :: taf_denom(bounds%begl:bounds%endl) ! denominator of taf equation (m/s) - real(r8) :: qaf_numer(bounds%begl:bounds%endl) ! numerator of qaf equation (kg m/kg s) - real(r8) :: qaf_denom(bounds%begl:bounds%endl) ! denominator of qaf equation (m/s) - real(r8) :: wtas(bounds%begl:bounds%endl) ! sensible heat conductance for urban air to atmospheric air (m/s) - real(r8) :: wtaq(bounds%begl:bounds%endl) ! latent heat conductance for urban air to atmospheric air (m/s) - real(r8) :: wts_sum(bounds%begl:bounds%endl) ! sum of wtas, wtus_roof, wtus_road_perv, wtus_road_imperv, wtus_sunwall, wtus_shadewall - real(r8) :: wtq_sum(bounds%begl:bounds%endl) ! sum of wtaq, wtuq_roof, wtuq_road_perv, wtuq_road_imperv, wtuq_sunwall, wtuq_shadewall - real(r8) :: beta(bounds%begl:bounds%endl) ! coefficient of convective velocity - real(r8) :: zii(bounds%begl:bounds%endl) ! convective boundary layer height (m) - real(r8) :: fm(bounds%begl:bounds%endl) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: wtus(bounds%begc:bounds%endc) ! sensible heat conductance for urban columns (scaled) (m/s) - real(r8) :: wtuq(bounds%begc:bounds%endc) ! latent heat conductance for urban columns (scaled) (m/s) - integer :: iter ! iteration index - real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: wtus_roof(bounds%begl:bounds%endl) ! sensible heat conductance for roof (scaled) (m/s) - real(r8) :: wtuq_roof(bounds%begl:bounds%endl) ! latent heat conductance for roof (scaled) (m/s) - real(r8) :: wtus_road_perv(bounds%begl:bounds%endl) ! sensible heat conductance for pervious road (scaled) (m/s) - real(r8) :: wtuq_road_perv(bounds%begl:bounds%endl) ! latent heat conductance for pervious road (scaled) (m/s) - real(r8) :: wtus_road_imperv(bounds%begl:bounds%endl) ! sensible heat conductance for impervious road (scaled) (m/s) - real(r8) :: wtuq_road_imperv(bounds%begl:bounds%endl) ! latent heat conductance for impervious road (scaled) (m/s) - real(r8) :: wtus_sunwall(bounds%begl:bounds%endl) ! sensible heat conductance for sunwall (scaled) (m/s) - real(r8) :: wtuq_sunwall(bounds%begl:bounds%endl) ! latent heat conductance for sunwall (scaled) (m/s) - real(r8) :: wtus_shadewall(bounds%begl:bounds%endl) ! sensible heat conductance for shadewall (scaled) (m/s) - real(r8) :: wtuq_shadewall(bounds%begl:bounds%endl) ! latent heat conductance for shadewall (scaled) (m/s) - real(r8) :: wtus_roof_unscl(bounds%begl:bounds%endl) ! sensible heat conductance for roof (not scaled) (m/s) - real(r8) :: wtuq_roof_unscl(bounds%begl:bounds%endl) ! latent heat conductance for roof (not scaled) (m/s) - real(r8) :: wtus_road_perv_unscl(bounds%begl:bounds%endl) ! sensible heat conductance for pervious road (not scaled) (m/s) - real(r8) :: wtuq_road_perv_unscl(bounds%begl:bounds%endl) ! latent heat conductance for pervious road (not scaled) (m/s) - real(r8) :: wtus_road_imperv_unscl(bounds%begl:bounds%endl) ! sensible heat conductance for impervious road (not scaled) (m/s) - real(r8) :: wtuq_road_imperv_unscl(bounds%begl:bounds%endl) ! latent heat conductance for impervious road (not scaled) (m/s) - real(r8) :: wtus_sunwall_unscl(bounds%begl:bounds%endl) ! sensible heat conductance for sunwall (not scaled) (m/s) - real(r8) :: wtuq_sunwall_unscl(bounds%begl:bounds%endl) ! latent heat conductance for sunwall (not scaled) (m/s) - real(r8) :: wtus_shadewall_unscl(bounds%begl:bounds%endl) ! sensible heat conductance for shadewall (not scaled) (m/s) - real(r8) :: wtuq_shadewall_unscl(bounds%begl:bounds%endl) ! latent heat conductance for shadewall (not scaled) (m/s) - real(r8) :: wc ! convective velocity (m/s) - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: eflx_sh_grnd_scale(bounds%begp:bounds%endp) ! scaled sensible heat flux from ground (W/m**2) [+ to atm] - real(r8) :: qflx_evap_soi_scale(bounds%begp:bounds%endp) ! scaled soil evaporation (mm H2O/s) (+ = to atm) - real(r8) :: eflx_wasteheat_roof(bounds%begl:bounds%endl) ! sensible heat flux from urban heating/cooling sources of waste heat for roof (W/m**2) - real(r8) :: eflx_wasteheat_sunwall(bounds%begl:bounds%endl) ! sensible heat flux from urban heating/cooling sources of waste heat for sunwall (W/m**2) - real(r8) :: eflx_wasteheat_shadewall(bounds%begl:bounds%endl) ! sensible heat flux from urban heating/cooling sources of waste heat for shadewall (W/m**2) - real(r8) :: eflx_heat_from_ac_roof(bounds%begl:bounds%endl) ! sensible heat flux put back into canyon due to heat removal by AC for roof (W/m**2) - real(r8) :: eflx_heat_from_ac_sunwall(bounds%begl:bounds%endl) ! sensible heat flux put back into canyon due to heat removal by AC for sunwall (W/m**2) - real(r8) :: eflx_heat_from_ac_shadewall(bounds%begl:bounds%endl) ! sensible heat flux put back into canyon due to heat removal by AC for shadewall (W/m**2) - real(r8) :: eflx(bounds%begl:bounds%endl) ! total sensible heat flux for error check (W/m**2) - real(r8) :: qflx(bounds%begl:bounds%endl) ! total water vapor flux for error check (kg/m**2/s) - real(r8) :: eflx_scale(bounds%begl:bounds%endl) ! sum of scaled sensible heat fluxes for urban columns for error check (W/m**2) - real(r8) :: qflx_scale(bounds%begl:bounds%endl) ! sum of scaled water vapor fluxes for urban columns for error check (kg/m**2/s) - real(r8) :: eflx_err(bounds%begl:bounds%endl) ! sensible heat flux error (W/m**2) - real(r8) :: qflx_err(bounds%begl:bounds%endl) ! water vapor flux error (kg/m**2/s) - real(r8) :: fwet_roof ! fraction of roof surface that is wet (-) - real(r8) :: fwet_road_imperv ! fraction of impervious road surface that is wet (-) - integer :: local_secp1(bounds%begl:bounds%endl) ! seconds into current date in local time (sec) - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day,secs ! calendar info for current time step - logical :: found ! flag in search loop - integer :: indexl ! index of first found in search loop - integer :: nstep ! time step number - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - ! - real(r8), parameter :: lapse_rate = 0.0098_r8 ! Dry adiabatic lapse rate (K/m) - integer , parameter :: niters = 3 ! maximum number of iterations for surface temperature - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - ctype => col%itype , & ! Input: [integer (:) ] column type - z_0_town => lun%z_0_town , & ! Input: [real(r8) (:) ] momentum roughness length of urban landunit (m) - z_d_town => lun%z_d_town , & ! Input: [real(r8) (:) ] displacement height of urban landunit (m) - ht_roof => lun%ht_roof , & ! Input: [real(r8) (:) ] height of urban roof (m) - wtlunit_roof => lun%wtlunit_roof , & ! Input: [real(r8) (:) ] weight of roof with respect to landunit - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:) ] ratio of building height to street width - wtroad_perv => lun%wtroad_perv , & ! Input: [real(r8) (:) ] weight of pervious road wrt total road - - forc_t => atm2lnd_inst%forc_t_not_downscaled_grc , & ! Input: [real(r8) (:) ] atmospheric temperature (K) - forc_th => atm2lnd_inst%forc_th_not_downscaled_grc , & ! Input: [real(r8) (:) ] atmospheric potential temperature (K) - forc_rho => atm2lnd_inst%forc_rho_not_downscaled_grc , & ! Input: [real(r8) (:) ] density (kg/m**3) - forc_q => atm2lnd_inst%forc_q_not_downscaled_grc , & ! Input: [real(r8) (:) ] atmospheric specific humidity (kg/kg) - forc_pbot => atm2lnd_inst%forc_pbot_not_downscaled_grc , & ! Input: [real(r8) (:) ] atmospheric pressure (Pa) - forc_u => atm2lnd_inst%forc_u_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in east direction (m/s) - forc_v => atm2lnd_inst%forc_v_grc , & ! Input: [real(r8) (:) ] atmospheric wind speed in north direction (m/s) - - wind_hgt_canyon => urbanparams_inst%wind_hgt_canyon , & ! Input: [real(r8) (:) ] height above road at which wind in canyon is to be computed (m) - eflx_traffic_factor => urbanparams_inst%eflx_traffic_factor , & ! Input: [real(r8) (:) ] multiplicative urban traffic factor for sensible heat flux - - rootr_road_perv => soilstate_inst%rootr_road_perv_col , & ! Input: [real(r8) (:,:) ] effective fraction of roots in each soil layer for urban pervious road - soilalpha_u => soilstate_inst%soilalpha_u_col , & ! Input: [real(r8) (:) ] Urban factor that reduces ground saturated specific humidity (-) - rootr => soilstate_inst%rootr_patch , & ! Output: [real(r8) (:,:) ] effective fraction of roots in each soil layer - - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground surface temperature (K) - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (K) - t_ref2m => temperature_inst%t_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (K) - t_ref2m_u => temperature_inst%t_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m height surface air temperature (K) - t_veg => temperature_inst%t_veg_patch , & ! Output: [real(r8) (:) ] vegetation temperature (K) - taf => temperature_inst%taf_lun , & ! Output: [real(r8) (:) ] urban canopy air temperature (K) - - - tc_ref2m => humanindex_inst%tc_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface air temperature (C) - vap_ref2m => humanindex_inst%vap_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height vapor pressure (Pa) - appar_temp_ref2m => humanindex_inst%appar_temp_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m apparent temperature (C) - appar_temp_ref2m_u => humanindex_inst%appar_temp_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m apparent temperature (C) - swbgt_ref2m => humanindex_inst%swbgt_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Simplified Wetbulb Globe temperature (C) - swbgt_ref2m_u => humanindex_inst%swbgt_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Simplified Wetbulb Globe temperature (C) - humidex_ref2m => humanindex_inst%humidex_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Humidex (C) - humidex_ref2m_u => humanindex_inst%humidex_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Humidex (C) - wbt_ref2m => humanindex_inst%wbt_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Stull Wet Bulb temperature (C) - wbt_ref2m_u => humanindex_inst%wbt_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Stull Wet Bulb temperature (C) - wb_ref2m => humanindex_inst%wb_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Wet Bulb temperature (C) - wb_ref2m_u => humanindex_inst%wb_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Wet Bulb temperature (C) - teq_ref2m => humanindex_inst%teq_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height Equivalent temperature (K) - teq_ref2m_u => humanindex_inst%teq_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Equivalent temperature (K) - ept_ref2m => humanindex_inst%ept_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height Equivalent Potential temperature (K) - ept_ref2m_u => humanindex_inst%ept_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m height Equivalent Potential temperature (K) - discomf_index_ref2m => humanindex_inst%discomf_index_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Discomfort Index temperature (C) - discomf_index_ref2m_u => humanindex_inst%discomf_index_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Discomfort Index temperature (C) - discomf_index_ref2mS => humanindex_inst%discomf_index_ref2mS_patch , & ! Output: [real(r8) (:) ] 2 m height Discomfort Index Stull temperature (C) - discomf_index_ref2mS_u => humanindex_inst%discomf_index_ref2mS_u_patch, & ! Output: [real(r8) (:) ] Urban 2 m Discomfort Index Stull temperature (K) - nws_hi_ref2m => humanindex_inst%nws_hi_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m NWS Heat Index (C) - nws_hi_ref2m_u => humanindex_inst%nws_hi_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m NWS Heat Index (C) - thip_ref2m => humanindex_inst%thip_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Temperature Humidity Index Physiology (C) - thip_ref2m_u => humanindex_inst%thip_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Temperature Humidity Index Physiology (C) - thic_ref2m => humanindex_inst%thic_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Temperature Humidity Index Comfort (C) - thic_ref2m_u => humanindex_inst%thic_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Temperature Humidity Index Comfort (C) - swmp65_ref2m => humanindex_inst%swmp65_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Swamp Cooler temperature 65% effi (C) - swmp65_ref2m_u => humanindex_inst%swmp65_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Swamp Cooler temperature 65% effi (C) - swmp80_ref2m => humanindex_inst%swmp80_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m Swamp Cooler temperature 80% effi (C) - swmp80_ref2m_u => humanindex_inst%swmp80_ref2m_u_patch , & ! Output: [real(r8) (:) ] Urban 2 m Swamp Cooler temperature 80% effi (C) - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - snow_depth => waterstate_inst%snow_depth_col , & ! Input: [real(r8) (:) ] snow height (m) - dqgdT => waterstate_inst%dqgdT_col , & ! Input: [real(r8) (:) ] temperature derivative of "qg" - qg => waterstate_inst%qg_col , & ! Input: [real(r8) (:) ] specific humidity at ground surface (kg/kg) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - qaf => waterstate_inst%qaf_lun , & ! Output: [real(r8) (:) ] urban canopy air specific humidity (kg/kg) - q_ref2m => waterstate_inst%q_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface specific humidity (kg/kg) - rh_ref2m => waterstate_inst%rh_ref2m_patch , & ! Output: [real(r8) (:) ] 2 m height surface relative humidity (%) - rh_ref2m_u => waterstate_inst%rh_ref2m_u_patch , & ! Output: [real(r8) (:) ] 2 m height surface relative humidity (%) - - forc_hgt_u_patch => frictionvel_inst%forc_hgt_u_patch , & ! Input: [real(r8) (:) ] observational height of wind at patch-level (m) - forc_hgt_t_patch => frictionvel_inst%forc_hgt_t_patch , & ! Input: [real(r8) (:) ] observational height of temperature at patch-level (m) - zetamax => frictionvel_parms_inst%zetamaxstable , & ! Input: [real(r8) ] max zeta value under stable conditions - ram1 => frictionvel_inst%ram1_patch , & ! Output: [real(r8) (:) ] aerodynamical resistance (s/m) - u10_clm => frictionvel_inst%u10_clm_patch , & ! Input: [real(r8) (:) ] 10 m height winds (m/s) - - htvp => energyflux_inst%htvp_col , & ! Input: [real(r8) (:) ] latent heat of evaporation (/sublimation) (J/kg) - dlrad => energyflux_inst%dlrad_patch , & ! Output: [real(r8) (:) ] downward longwave radiation below the canopy (W/m**2) - ulrad => energyflux_inst%ulrad_patch , & ! Output: [real(r8) (:) ] upward longwave radiation above the canopy (W/m**2) - cgrnds => energyflux_inst%cgrnds_patch , & ! Output: [real(r8) (:) ] deriv, of soil sensible heat flux wrt soil temp (W/m**2/K) - cgrndl => energyflux_inst%cgrndl_patch , & ! Output: [real(r8) (:) ] deriv of soil latent heat flux wrt soil temp (W/m**2/K) - cgrnd => energyflux_inst%cgrnd_patch , & ! Output: [real(r8) (:) ] deriv. of soil energy flux wrt to soil temp (W/m**2/K) - eflx_sh_grnd => energyflux_inst%eflx_sh_grnd_patch , & ! Output: [real(r8) (:) ] sensible heat flux from ground (W/m**2) [+ to atm] - eflx_sh_tot => energyflux_inst%eflx_sh_tot_patch , & ! Output: [real(r8) (:) ] total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_tot_u => energyflux_inst%eflx_sh_tot_u_patch , & ! Output: [real(r8) (:) ] urban total sensible heat flux (W/m**2) [+ to atm] - eflx_sh_snow => energyflux_inst%eflx_sh_snow_patch , & ! Output: [real(r8) (:) ] sensible heat flux from snow (W/m**2) [+ to atm] - eflx_sh_soil => energyflux_inst%eflx_sh_soil_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_sh_h2osfc => energyflux_inst%eflx_sh_h2osfc_patch , & ! Output: [real(r8) (:) ] sensible heat flux from soil (W/m**2) [+ to atm] - eflx_traffic => energyflux_inst%eflx_traffic_lun , & ! Output: [real(r8) (:) ] traffic sensible heat flux (W/m**2) - eflx_wasteheat => energyflux_inst%eflx_wasteheat_lun , & ! Output: [real(r8) (:) ] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_urban_ac => energyflux_inst%eflx_urban_ac_lun , & ! Input: [real(r8) (:) ] urban air conditioning flux (W/m**2) - eflx_heat_from_ac => energyflux_inst%eflx_heat_from_ac_lun , & ! Output: [real(r8) (:) ] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_urban_heat => energyflux_inst%eflx_urban_heat_lun , & ! Input: [real(r8) (:) ] urban heating flux (W/m**2) - eflx_urban_ac_col => energyflux_inst%eflx_urban_ac_col , & ! Input: [real(r8) (:) ] urban air conditioning flux (W/m**2) - eflx_urban_heat_col => energyflux_inst%eflx_urban_heat_col , & ! Input: [real(r8) (:) ] urban heating flux (W/m**2) - taux => energyflux_inst%taux_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: e-w (kg/m/s**2) - tauy => energyflux_inst%tauy_patch , & ! Output: [real(r8) (:) ] wind (shear) stress: n-s (kg/m/s**2) - - qflx_evap_soi => waterflux_inst%qflx_evap_soi_patch , & ! Output: [real(r8) (:) ] soil evaporation (mm H2O/s) (+ = to atm) - qflx_tran_veg => waterflux_inst%qflx_tran_veg_patch , & ! Output: [real(r8) (:) ] vegetation transpiration (mm H2O/s) (+ = to atm) - qflx_evap_veg => waterflux_inst%qflx_evap_veg_patch , & ! Output: [real(r8) (:) ] vegetation evaporation (mm H2O/s) (+ = to atm) - qflx_evap_tot => waterflux_inst%qflx_evap_tot_patch , & ! Output: [real(r8) (:) ] qflx_evap_soi + qflx_evap_can + qflx_tran_veg - - begl => bounds%begl , & - endl => bounds%endl & - ) - - ! Define fields that appear on the restart file for non-urban landunits - - do fl = 1,num_nourbanl - l = filter_nourbanl(fl) - taf(l) = spval - qaf(l) = spval - end do - - ! Get time step - nstep = get_nstep() - - ! Set constants (same as in Biogeophysics1Mod) - beta(begl:endl) = 1._r8 ! Should be set to the same values as in Biogeophysics1Mod - zii(begl:endl) = 1000._r8 ! Should be set to the same values as in Biogeophysics1Mod - - ! Get current date - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! Compute canyontop wind using Masson (2000) - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - local_secp1(l) = secs + nint((grc%londeg(g)/degpsec)/dtime)*dtime - local_secp1(l) = mod(local_secp1(l),isecspday) - - ! Error checks - - if (ht_roof(l) - z_d_town(l) <= z_0_town(l)) then - write (iulog,*) 'aerodynamic parameter error in UrbanFluxes' - write (iulog,*) 'h_r - z_d <= z_0' - write (iulog,*) 'ht_roof, z_d_town, z_0_town: ', ht_roof(l), z_d_town(l), & - z_0_town(l) - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - end if - if (forc_hgt_u_patch(lun%patchi(l)) - z_d_town(l) <= z_0_town(l)) then - write (iulog,*) 'aerodynamic parameter error in UrbanFluxes' - write (iulog,*) 'h_u - z_d <= z_0' - write (iulog,*) 'forc_hgt_u_patch, z_d_town, z_0_town: ', forc_hgt_u_patch(lun%patchi(l)), z_d_town(l), & - z_0_town(l) - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - end if - - ! Magnitude of atmospheric wind - - ur(l) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - - ! Canyon top wind - - canyontop_wind(l) = ur(l) * & - log( (ht_roof(l)-z_d_town(l)) / z_0_town(l) ) / & - log( (forc_hgt_u_patch(lun%patchi(l))-z_d_town(l)) / z_0_town(l) ) - - ! U component of canyon wind - - if (canyon_hwr(l) < 0.5_r8) then ! isolated roughness flow - canyon_u_wind(l) = canyontop_wind(l) * exp( -0.5_r8*canyon_hwr(l)* & - (1._r8-(wind_hgt_canyon(l)/ht_roof(l))) ) - else if (canyon_hwr(l) < 1.0_r8) then ! wake interference flow - canyon_u_wind(l) = canyontop_wind(l) * (1._r8+2._r8*(2._r8/rpi - 1._r8)* & - (ht_roof(l)/(ht_roof(l)/canyon_hwr(l)) - 0.5_r8)) * & - exp(-0.5_r8*canyon_hwr(l)*(1._r8-(wind_hgt_canyon(l)/ht_roof(l)))) - else ! skimming flow - canyon_u_wind(l) = canyontop_wind(l) * (2._r8/rpi) * & - exp(-0.5_r8*canyon_hwr(l)*(1._r8-(wind_hgt_canyon(l)/ht_roof(l)))) - end if - - end do - - ! Compute fluxes - Follows CLM approach for bare soils (Oleson et al 2004) - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - thm_g(l) = forc_t(g) + lapse_rate*forc_hgt_t_patch(lun%patchi(l)) - thv_g(l) = forc_th(g)*(1._r8+0.61_r8*forc_q(g)) - dth(l) = thm_g(l)-taf(l) - dqh(l) = forc_q(g)-qaf(l) - dthv = dth(l)*(1._r8+0.61_r8*forc_q(g))+0.61_r8*forc_th(g)*dqh(l) - zldis(l) = forc_hgt_u_patch(lun%patchi(l)) - z_d_town(l) - - ! Initialize Monin-Obukhov length and wind speed including convective velocity - - call MoninObukIni(ur(l), thv_g(l), dthv, zldis(l), z_0_town(l), um(l), obu(l)) - - end do - - ! Initialize conductances - wtus_roof(begl:endl) = 0._r8 - wtus_road_perv(begl:endl) = 0._r8 - wtus_road_imperv(begl:endl) = 0._r8 - wtus_sunwall(begl:endl) = 0._r8 - wtus_shadewall(begl:endl) = 0._r8 - wtuq_roof(begl:endl) = 0._r8 - wtuq_road_perv(begl:endl) = 0._r8 - wtuq_road_imperv(begl:endl) = 0._r8 - wtuq_sunwall(begl:endl) = 0._r8 - wtuq_shadewall(begl:endl) = 0._r8 - wtus_roof_unscl(begl:endl) = 0._r8 - wtus_road_perv_unscl(begl:endl) = 0._r8 - wtus_road_imperv_unscl(begl:endl) = 0._r8 - wtus_sunwall_unscl(begl:endl) = 0._r8 - wtus_shadewall_unscl(begl:endl) = 0._r8 - wtuq_roof_unscl(begl:endl) = 0._r8 - wtuq_road_perv_unscl(begl:endl) = 0._r8 - wtuq_road_imperv_unscl(begl:endl) = 0._r8 - wtuq_sunwall_unscl(begl:endl) = 0._r8 - wtuq_shadewall_unscl(begl:endl) = 0._r8 - - ! Start stability iteration - - do iter = 1,niters - - ! Get friction velocity, relation for potential - ! temperature and humidity profiles of surface boundary layer. - - if (num_urbanl > 0) then - call FrictionVelocity(begl, endl, & - num_urbanl, filter_urbanl, & - z_d_town(begl:endl), z_0_town(begl:endl), z_0_town(begl:endl), z_0_town(begl:endl), & - obu(begl:endl), iter, ur(begl:endl), um(begl:endl), ustar(begl:endl), & - temp1(begl:endl), temp2(begl:endl), temp12m(begl:endl), temp22m(begl:endl), fm(begl:endl), & - frictionvel_inst, landunit_index=.true.) - end if - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - ! Determine aerodynamic resistance to fluxes from urban canopy air to - ! atmosphere - - ramu(l) = 1._r8/(ustar(l)*ustar(l)/um(l)) - rahu(l) = 1._r8/(temp1(l)*ustar(l)) - rawu(l) = 1._r8/(temp2(l)*ustar(l)) - - ! Determine magnitude of canyon wind by using horizontal wind determined - ! previously and vertical wind from friction velocity (Masson 2000) - - canyon_wind(l) = sqrt(canyon_u_wind(l)**2._r8 + ustar(l)**2._r8) - - ! Determine canyon_resistance (currently this single resistance determines the - ! resistance from urban surfaces (roof, pervious and impervious road, sunlit and - ! shaded walls) to urban canopy air, since it is only dependent on wind speed - ! Also from Masson 2000. - - canyon_resistance(l) = cpair * forc_rho(g) / (11.8_r8 + 4.2_r8*canyon_wind(l)) - - end do - - ! This is the first term in the equation solutions for urban canopy air temperature - ! and specific humidity (numerator) and is a landunit quantity - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - taf_numer(l) = thm_g(l)/rahu(l) - taf_denom(l) = 1._r8/rahu(l) - qaf_numer(l) = forc_q(g)/rawu(l) - qaf_denom(l) = 1._r8/rawu(l) - - ! First term needed for derivative of heat fluxes - wtas(l) = 1._r8/rahu(l) - wtaq(l) = 1._r8/rawu(l) - - end do - - - ! Gather other terms for other urban columns for numerator and denominator of - ! equations for urban canopy air temperature and specific humidity - - do fc = 1,num_urbanc - c = filter_urbanc(fc) - l = col%landunit(c) - - if (ctype(c) == icol_roof) then - - ! scaled sensible heat conductance - wtus(c) = wtlunit_roof(l)/canyon_resistance(l) - wtus_roof(l) = wtus(c) - ! unscaled sensible heat conductance - wtus_roof_unscl(l) = 1._r8/canyon_resistance(l) - - if (snow_depth(c) > 0._r8) then - fwet_roof = min(snow_depth(c)/0.05_r8, 1._r8) - else - fwet_roof = (max(0._r8, h2osoi_liq(c,1)+h2osoi_ice(c,1))/pondmx_urban)**0.666666666666_r8 - fwet_roof = min(fwet_roof,1._r8) - end if - if (qaf(l) > qg(c)) then - fwet_roof = 1._r8 - end if - ! scaled latent heat conductance - wtuq(c) = fwet_roof*(wtlunit_roof(l)/canyon_resistance(l)) - wtuq_roof(l) = wtuq(c) - ! unscaled latent heat conductance - wtuq_roof_unscl(l) = fwet_roof*(1._r8/canyon_resistance(l)) - if ( IsSimpleBuildTemp() ) call simple_wasteheatfromac( & - eflx_urban_ac_col(c), eflx_urban_heat_col(c), eflx_wasteheat_roof(l), & - eflx_heat_from_ac_roof(l) ) - - else if (ctype(c) == icol_road_perv) then - - ! scaled sensible heat conductance - wtus(c) = wtroad_perv(l)*(1._r8-wtlunit_roof(l))/canyon_resistance(l) - wtus_road_perv(l) = wtus(c) - ! unscaled sensible heat conductance - wtus_road_perv_unscl(l) = 1._r8/canyon_resistance(l) - - ! scaled latent heat conductance - wtuq(c) = wtroad_perv(l)*(1._r8-wtlunit_roof(l))/canyon_resistance(l) - wtuq_road_perv(l) = wtuq(c) - ! unscaled latent heat conductance - wtuq_road_perv_unscl(l) = 1._r8/canyon_resistance(l) - - else if (ctype(c) == icol_road_imperv) then - - ! scaled sensible heat conductance - wtus(c) = (1._r8-wtroad_perv(l))*(1._r8-wtlunit_roof(l))/canyon_resistance(l) - wtus_road_imperv(l) = wtus(c) - ! unscaled sensible heat conductance - wtus_road_imperv_unscl(l) = 1._r8/canyon_resistance(l) - - if (snow_depth(c) > 0._r8) then - fwet_road_imperv = min(snow_depth(c)/0.05_r8, 1._r8) - else - fwet_road_imperv = (max(0._r8, h2osoi_liq(c,1)+h2osoi_ice(c,1))/pondmx_urban)**0.666666666666_r8 - fwet_road_imperv = min(fwet_road_imperv,1._r8) - end if - if (qaf(l) > qg(c)) then - fwet_road_imperv = 1._r8 - end if - ! scaled latent heat conductance - wtuq(c) = fwet_road_imperv*(1._r8-wtroad_perv(l))*(1._r8-wtlunit_roof(l))/canyon_resistance(l) - wtuq_road_imperv(l) = wtuq(c) - ! unscaled latent heat conductance - wtuq_road_imperv_unscl(l) = fwet_road_imperv*(1._r8/canyon_resistance(l)) - - else if (ctype(c) == icol_sunwall) then - - ! scaled sensible heat conductance - wtus(c) = canyon_hwr(l)*(1._r8-wtlunit_roof(l))/canyon_resistance(l) - wtus_sunwall(l) = wtus(c) - ! unscaled sensible heat conductance - wtus_sunwall_unscl(l) = 1._r8/canyon_resistance(l) - - ! scaled latent heat conductance - wtuq(c) = 0._r8 - wtuq_sunwall(l) = wtuq(c) - ! unscaled latent heat conductance - wtuq_sunwall_unscl(l) = 0._r8 - if ( IsSimpleBuildTemp() ) call simple_wasteheatfromac( eflx_urban_ac_col(c), & - eflx_urban_heat_col(c), eflx_wasteheat_sunwall(l), & - eflx_heat_from_ac_sunwall(l) ) - - else if (ctype(c) == icol_shadewall) then - - ! scaled sensible heat conductance - wtus(c) = canyon_hwr(l)*(1._r8-wtlunit_roof(l))/canyon_resistance(l) - wtus_shadewall(l) = wtus(c) - ! unscaled sensible heat conductance - wtus_shadewall_unscl(l) = 1._r8/canyon_resistance(l) - - ! scaled latent heat conductance - wtuq(c) = 0._r8 - wtuq_shadewall(l) = wtuq(c) - ! unscaled latent heat conductance - wtuq_shadewall_unscl(l) = 0._r8 - if ( IsSimpleBuildTemp() ) call simple_wasteheatfromac( eflx_urban_ac_col(c), & - eflx_urban_heat_col(c), eflx_wasteheat_shadewall(l), & - eflx_heat_from_ac_shadewall(l) ) - - else - write(iulog,*) 'c, ctype, pi = ', c, ctype(c), pi - write(iulog,*) 'Column indices for: shadewall, sunwall, road_imperv, road_perv, roof: ' - write(iulog,*) icol_shadewall, icol_sunwall, icol_road_imperv, icol_road_perv, icol_roof - call endrun(decomp_index=l, clmlevel=namel, msg="ERROR, ctype out of range"//errmsg(sourcefile, __LINE__)) - end if - - taf_numer(l) = taf_numer(l) + t_grnd(c)*wtus(c) - taf_denom(l) = taf_denom(l) + wtus(c) - qaf_numer(l) = qaf_numer(l) + qg(c)*wtuq(c) - qaf_denom(l) = qaf_denom(l) + wtuq(c) - - end do - - ! Calculate new urban canopy air temperature and specific humidity - - call wasteheat( bounds, num_urbanl, filter_urbanl, eflx_wasteheat_roof, eflx_wasteheat_sunwall, & - eflx_wasteheat_shadewall, eflx_heat_from_ac_roof, eflx_heat_from_ac_sunwall, & - eflx_heat_from_ac_shadewall, energyflux_inst ) - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - ! Calculate traffic heat flux - ! Only comes from impervious road - eflx_traffic(l) = (1._r8-wtlunit_roof(l))*(1._r8-wtroad_perv(l))* & - eflx_traffic_factor(l) - - taf(l) = taf_numer(l)/taf_denom(l) - qaf(l) = qaf_numer(l)/qaf_denom(l) - - wts_sum(l) = wtas(l) + wtus_roof(l) + wtus_road_perv(l) + & - wtus_road_imperv(l) + wtus_sunwall(l) + wtus_shadewall(l) - - wtq_sum(l) = wtaq(l) + wtuq_roof(l) + wtuq_road_perv(l) + & - wtuq_road_imperv(l) + wtuq_sunwall(l) + wtuq_shadewall(l) - - end do - - ! This section of code is not required if niters = 1 - ! Determine stability using new taf and qaf - ! TODO: Some of these constants replicate what is in FrictionVelocity and BareGround fluxes should consildate. EBK - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - dth(l) = thm_g(l)-taf(l) - dqh(l) = forc_q(g)-qaf(l) - tstar = temp1(l)*dth(l) - qstar = temp2(l)*dqh(l) - thvstar = tstar*(1._r8+0.61_r8*forc_q(g)) + 0.61_r8*forc_th(g)*qstar - zeta = zldis(l)*vkc*grav*thvstar/(ustar(l)**2*thv_g(l)) - - if (zeta >= 0._r8) then !stable - zeta = min(zetamax,max(zeta,0.01_r8)) - um(l) = max(ur(l),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta(l)*(-grav*ustar(l)*thvstar*zii(l)/thv_g(l))**0.333_r8 - um(l) = sqrt(ur(l)*ur(l) + wc*wc) - end if - - obu(l) = zldis(l)/zeta - end do - - end do ! end iteration - - ! Determine fluxes from canyon surfaces - - ! the following initializations are needed to ensure that the values are 0 over non- - ! active urban Patches - eflx_sh_grnd_scale(bounds%begp : bounds%endp) = 0._r8 - qflx_evap_soi_scale(bounds%begp : bounds%endp) = 0._r8 - - do f = 1, num_urbanp - - p = filter_urbanp(f) - c = patch%column(p) - g = patch%gridcell(p) - l = patch%landunit(p) - - ram1(p) = ramu(l) !pass value to global variable - - ! Upward and downward canopy longwave are zero - - ulrad(p) = 0._r8 - dlrad(p) = 0._r8 - - ! Derivative of sensible and latent heat fluxes with respect to - ! ground temperature - - if (ctype(c) == icol_roof) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_road_perv(l) + & - wtus_road_imperv(l) + wtus_sunwall(l) + wtus_shadewall(l)) * & - (wtus_roof_unscl(l)/wts_sum(l)) - cgrndl(p) = forc_rho(g) * (wtaq(l) + wtuq_road_perv(l) + & - wtuq_road_imperv(l) + wtuq_sunwall(l) + wtuq_shadewall(l)) * & - (wtuq_roof_unscl(l)/wtq_sum(l))*dqgdT(c) - else if (ctype(c) == icol_road_perv) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_imperv(l) + wtus_sunwall(l) + wtus_shadewall(l)) * & - (wtus_road_perv_unscl(l)/wts_sum(l)) - cgrndl(p) = forc_rho(g) * (wtaq(l) + wtuq_roof(l) + & - wtuq_road_imperv(l) + wtuq_sunwall(l) + wtuq_shadewall(l)) * & - (wtuq_road_perv_unscl(l)/wtq_sum(l))*dqgdT(c) - else if (ctype(c) == icol_road_imperv) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_perv(l) + wtus_sunwall(l) + wtus_shadewall(l)) * & - (wtus_road_imperv_unscl(l)/wts_sum(l)) - cgrndl(p) = forc_rho(g) * (wtaq(l) + wtuq_roof(l) + & - wtuq_road_perv(l) + wtuq_sunwall(l) + wtuq_shadewall(l)) * & - (wtuq_road_imperv_unscl(l)/wtq_sum(l))*dqgdT(c) - else if (ctype(c) == icol_sunwall) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_perv(l) + wtus_road_imperv(l) + wtus_shadewall(l)) * & - (wtus_sunwall_unscl(l)/wts_sum(l)) - cgrndl(p) = 0._r8 - else if (ctype(c) == icol_shadewall) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_perv(l) + wtus_road_imperv(l) + wtus_sunwall(l)) * & - (wtus_shadewall_unscl(l)/wts_sum(l)) - cgrndl(p) = 0._r8 - end if - cgrnd(p) = cgrnds(p) + cgrndl(p)*htvp(c) - - ! Surface fluxes of momentum, sensible and latent heat - - taux(p) = -forc_rho(g)*forc_u(g)/ramu(l) - tauy(p) = -forc_rho(g)*forc_v(g)/ramu(l) - - ! Use new canopy air temperature - dth(l) = taf(l) - t_grnd(c) - - if (ctype(c) == icol_roof) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_roof_unscl(l)*dth(l) - eflx_sh_snow(p) = 0._r8 - eflx_sh_soil(p) = 0._r8 - eflx_sh_h2osfc(p)= 0._r8 - else if (ctype(c) == icol_road_perv) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_road_perv_unscl(l)*dth(l) - eflx_sh_snow(p) = 0._r8 - eflx_sh_soil(p) = 0._r8 - eflx_sh_h2osfc(p)= 0._r8 - else if (ctype(c) == icol_road_imperv) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_road_imperv_unscl(l)*dth(l) - eflx_sh_snow(p) = 0._r8 - eflx_sh_soil(p) = 0._r8 - eflx_sh_h2osfc(p)= 0._r8 - else if (ctype(c) == icol_sunwall) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_sunwall_unscl(l)*dth(l) - eflx_sh_snow(p) = 0._r8 - eflx_sh_soil(p) = 0._r8 - eflx_sh_h2osfc(p)= 0._r8 - else if (ctype(c) == icol_shadewall) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_shadewall_unscl(l)*dth(l) - eflx_sh_snow(p) = 0._r8 - eflx_sh_soil(p) = 0._r8 - eflx_sh_h2osfc(p)= 0._r8 - end if - - eflx_sh_tot(p) = eflx_sh_grnd(p) - eflx_sh_tot_u(p) = eflx_sh_tot(p) - - dqh(l) = qaf(l) - qg(c) - - if (ctype(c) == icol_roof) then - qflx_evap_soi(p) = -forc_rho(g)*wtuq_roof_unscl(l)*dqh(l) - else if (ctype(c) == icol_road_perv) then - ! Evaporation assigned to soil term if dew or snow - ! or if no liquid water available in soil column - if (dqh(l) > 0._r8 .or. frac_sno(c) > 0._r8 .or. soilalpha_u(c) <= 0._r8) then - qflx_evap_soi(p) = -forc_rho(g)*wtuq_road_perv_unscl(l)*dqh(l) - qflx_tran_veg(p) = 0._r8 - ! Otherwise, evaporation assigned to transpiration term - else - qflx_evap_soi(p) = 0._r8 - qflx_tran_veg(p) = -forc_rho(g)*wtuq_road_perv_unscl(l)*dqh(l) - end if - qflx_evap_veg(p) = qflx_tran_veg(p) - else if (ctype(c) == icol_road_imperv) then - qflx_evap_soi(p) = -forc_rho(g)*wtuq_road_imperv_unscl(l)*dqh(l) - else if (ctype(c) == icol_sunwall) then - qflx_evap_soi(p) = 0._r8 - else if (ctype(c) == icol_shadewall) then - qflx_evap_soi(p) = 0._r8 - end if - - ! SCALED sensible and latent heat flux for error check - eflx_sh_grnd_scale(p) = -forc_rho(g)*cpair*wtus(c)*dth(l) - qflx_evap_soi_scale(p) = -forc_rho(g)*wtuq(c)*dqh(l) - - end do - - ! Check to see that total sensible and latent heat equal the sum of - ! the scaled heat fluxes above - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - eflx(l) = -(forc_rho(g)*cpair/rahu(l))*(thm_g(l) - taf(l)) - qflx(l) = -(forc_rho(g)/rawu(l))*(forc_q(g) - qaf(l)) - eflx_scale(l) = sum(eflx_sh_grnd_scale(lun%patchi(l):lun%patchf(l))) - qflx_scale(l) = sum(qflx_evap_soi_scale(lun%patchi(l):lun%patchf(l))) - eflx_err(l) = eflx_scale(l) - eflx(l) - qflx_err(l) = qflx_scale(l) - qflx(l) - end do - - found = .false. - do fl = 1, num_urbanl - l = filter_urbanl(fl) - if (abs(eflx_err(l)) > 0.01_r8) then - found = .true. - indexl = l - exit - end if - end do - if ( found ) then - write(iulog,*)'WARNING: Total sensible heat does not equal sum of scaled heat fluxes for urban columns ',& - ' nstep = ',nstep,' indexl= ',indexl,' eflx_err= ',eflx_err(indexl) - if (abs(eflx_err(indexl)) > .01_r8) then - write(iulog,*)'clm model is stopping - error is greater than .01 W/m**2' - write(iulog,*)'eflx_scale = ',eflx_scale(indexl) - write(iulog,*)'eflx_sh_grnd_scale: ',eflx_sh_grnd_scale(lun%patchi(indexl):lun%patchf(indexl)) - write(iulog,*)'eflx = ',eflx(indexl) - call endrun(decomp_index=indexl, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - found = .false. - do fl = 1, num_urbanl - l = filter_urbanl(fl) - ! 4.e-9 kg/m**2/s = 0.01 W/m**2 - if (abs(qflx_err(l)) > 4.e-9_r8) then - found = .true. - indexl = l - exit - end if - end do - if ( found ) then - write(iulog,*)'WARNING: Total water vapor flux does not equal sum of scaled water vapor fluxes for urban columns ',& - ' nstep = ',nstep,' indexl= ',indexl,' qflx_err= ',qflx_err(indexl) - if (abs(qflx_err(indexl)) > 4.e-9_r8) then - write(iulog,*)'clm model is stopping - error is greater than 4.e-9 kg/m**2/s' - write(iulog,*)'qflx_scale = ',qflx_scale(indexl) - write(iulog,*)'qflx = ',qflx(indexl) - call endrun(decomp_index=indexl, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - end if - end if - - ! Gather terms required to determine internal building temperature - - if ( IsSimpleBuildTemp() ) call calc_simple_internal_building_temp( & - bounds, num_urbanc, filter_urbanc, num_urbanl, filter_urbanl, & - temperature_inst) - - ! No roots for urban except for pervious road - - do j = 1, nlevgrnd - do f = 1, num_urbanp - p = filter_urbanp(f) - c = patch%column(p) - if (ctype(c) == icol_road_perv) then - rootr(p,j) = rootr_road_perv(c,j) - else - rootr(p,j) = 0._r8 - end if - end do - end do - - do f = 1, num_urbanp - - p = filter_urbanp(f) - c = patch%column(p) - g = patch%gridcell(p) - l = patch%landunit(p) - - ! Use urban canopy air temperature and specific humidity to represent - ! 2-m temperature and humidity - - t_ref2m(p) = taf(l) - q_ref2m(p) = qaf(l) - t_ref2m_u(p) = taf(l) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(g), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - rh_ref2m_u(p) = rh_ref2m(p) - - ! Human Heat Stress - if ( calc_human_stress_indices )then - - call KtoC(t_ref2m(p), tc_ref2m(p)) - call VaporPres(rh_ref2m(p), e_ref2m, vap_ref2m(p)) - call Wet_Bulb(t_ref2m(p), vap_ref2m(p), forc_pbot(g), rh_ref2m(p), q_ref2m(p), & - teq_ref2m(p), ept_ref2m(p), wb_ref2m(p)) - call Wet_BulbS(tc_ref2m(p), rh_ref2m(p), wbt_ref2m(p)) - call HeatIndex(tc_ref2m(p), rh_ref2m(p), nws_hi_ref2m(p)) - call AppTemp(tc_ref2m(p), vap_ref2m(p), u10_clm(p), appar_temp_ref2m(p)) - call swbgt(tc_ref2m(p), vap_ref2m(p), swbgt_ref2m(p)) - call hmdex(tc_ref2m(p), vap_ref2m(p), humidex_ref2m(p)) - call dis_coi(tc_ref2m(p), wb_ref2m(p), discomf_index_ref2m(p)) - call dis_coiS(tc_ref2m(p), rh_ref2m(p), wbt_ref2m(p), discomf_index_ref2mS(p)) - call THIndex(tc_ref2m(p), wb_ref2m(p), thic_ref2m(p), thip_ref2m(p)) - call SwampCoolEff(tc_ref2m(p), wb_ref2m(p), swmp80_ref2m(p), swmp65_ref2m(p)) - - teq_ref2m_u(p) = teq_ref2m(p) - ept_ref2m_u(p) = ept_ref2m(p) - wb_ref2m_u(p) = wb_ref2m(p) - wbt_ref2m_u(p) = wbt_ref2m(p) - nws_hi_ref2m_u(p) = nws_hi_ref2m(p) - appar_temp_ref2m_u(p) = appar_temp_ref2m(p) - swbgt_ref2m_u(p) = swbgt_ref2m(p) - humidex_ref2m_u(p) = humidex_ref2m(p) - discomf_index_ref2m_u(p) = discomf_index_ref2m(p) - discomf_index_ref2mS_u(p) = discomf_index_ref2mS(p) - thic_ref2m_u(p) = thic_ref2m(p) - thip_ref2m_u(p) = thip_ref2m(p) - swmp80_ref2m_u(p) = swmp80_ref2m(p) - swmp65_ref2m_u(p) = swmp65_ref2m(p) - end if - - ! Variables needed by history tape - - t_veg(p) = forc_t(g) - - end do - - end associate - - end subroutine UrbanFluxes - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: wasteheat - ! - ! !INTERFACE: - subroutine wasteheat( bounds, num_urbanl, filter_urbanl, eflx_wasteheat_roof, eflx_wasteheat_sunwall, & - eflx_wasteheat_shadewall, eflx_heat_from_ac_roof, eflx_heat_from_ac_sunwall, & - eflx_heat_from_ac_shadewall, energyflux_inst ) - ! !DESCRIPTION: - ! - ! Calculate the wasteheat flux from urban heating or air-conditioning. - ! - ! !USES: - use clm_varcon , only : ht_wasteheat_factor, ac_wasteheat_factor, & - wasteheat_limit - use EnergyFluxType , only : energyflux_type - use UrbanParamsType , only : IsProgBuildTemp - implicit none - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8) , intent(in) :: eflx_wasteheat_roof(bounds%begl:bounds%endl) - real(r8) , intent(in) :: eflx_wasteheat_sunwall(bounds%begl:bounds%endl) - real(r8) , intent(in) :: eflx_wasteheat_shadewall(bounds%begl:bounds%endl) - real(r8) , intent(in) :: eflx_heat_from_ac_roof(bounds%begl:bounds%endl) - real(r8) , intent(in) :: eflx_heat_from_ac_sunwall(bounds%begl:bounds%endl) - real(r8) , intent(in) :: eflx_heat_from_ac_shadewall(bounds%begl:bounds%endl) - type(energyflux_type) , intent(inout) :: energyflux_inst ! data on landunit energy flux - - ! !LOCAL VARIABLES: - integer fl, l, g - !EOP - !----------------------------------------------------------------------- - - associate(& - lgridcell => lun%gridcell , & ! Input: [integer (:) ] gridcell of corresponding landunit - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:)] ratio of building height to street width - wtlunit_roof => lun%wtlunit_roof , & ! Input: [real(r8) (:)] weight of roof with respect to landunit - eflx_wasteheat => energyflux_inst%eflx_wasteheat_lun , & ! Output: [real(r8) (:)] sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - eflx_heat_from_ac=> energyflux_inst%eflx_heat_from_ac_lun , & ! Output: [real(r8) (:)] sensible heat flux put back into canyon due to removal by AC (W/m**2) - eflx_urban_ac => energyflux_inst%eflx_urban_ac_lun , & ! Input: [real(r8) (:)] urban air conditioning flux (W/m**2) - eflx_urban_heat => energyflux_inst%eflx_urban_heat_lun & ! Input: [real(r8) (:)] urban heating flux (W/m**2) - ) - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - if ( IsSimpleBuildTemp() )then - ! Total waste heat and heat from AC is sum of heat for walls and roofs - ! accounting for different surface areas - eflx_wasteheat(l) = wtlunit_roof(l)*eflx_wasteheat_roof(l) + & - (1._r8-wtlunit_roof(l))*(canyon_hwr(l)*(eflx_wasteheat_sunwall(l) + & - eflx_wasteheat_shadewall(l))) - - else if ( IsProgBuildTemp() )then - ! wasteheat from heating/cooling - if (trim(urban_hac) == urban_wasteheat_on) then - eflx_wasteheat(l) = ac_wasteheat_factor * eflx_urban_ac(l) + & - ht_wasteheat_factor * eflx_urban_heat(l) - else - eflx_wasteheat(l) = 0._r8 - end if - end if - - ! Limit wasteheat to ensure that we don't get any unrealistically strong - ! positive feedbacks due to AC in a warmer climate - eflx_wasteheat(l) = min(eflx_wasteheat(l),wasteheat_limit) - - if ( IsSimpleBuildTemp() )then - eflx_heat_from_ac(l) = wtlunit_roof(l)*eflx_heat_from_ac_roof(l) + & - (1._r8-wtlunit_roof(l))*(canyon_hwr(l)*(eflx_heat_from_ac_sunwall(l) + & - eflx_heat_from_ac_shadewall(l))) - - else if ( IsProgBuildTemp() )then - ! If air conditioning on, always replace heat removed with heat into canyon - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - eflx_heat_from_ac(l) = abs(eflx_urban_ac(l)) - else - eflx_heat_from_ac(l) = 0._r8 - end if - end if - end do - end associate - end subroutine wasteheat - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: simple_wasteheatfromac - ! - ! !INTERFACE: - subroutine simple_wasteheatfromac( eflx_urban_ac, eflx_urban_heat, eflx_wasteheat, & - eflx_heat_from_ac ) - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! - ! Calculate waste heat from Air conditioning with the simpler method introduced - ! in CLM4.5. - ! - ! !USES: - use clm_varcon , only : ht_wasteheat_factor, ac_wasteheat_factor - implicit none - ! !ARGUMENTS: - real(r8), intent(in) :: eflx_urban_ac - real(r8), intent(in) :: eflx_urban_heat - real(r8), intent(out) :: eflx_wasteheat - real(r8), intent(out) :: eflx_heat_from_ac - - ! wasteheat from heating/cooling - if (trim(urban_hac) == urban_wasteheat_on) then - eflx_wasteheat = ac_wasteheat_factor * eflx_urban_ac + & - ht_wasteheat_factor * eflx_urban_heat - else - eflx_wasteheat = 0._r8 - end if - - ! If air conditioning on, always replace heat removed with heat into canyon - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - eflx_heat_from_ac = abs(eflx_urban_ac) - else - eflx_heat_from_ac = 0._r8 - end if - - end subroutine simple_wasteheatfromac - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: calc_simple_internal_building_temp - ! - ! !INTERFACE: - subroutine calc_simple_internal_building_temp( bounds, num_urbanc, filter_urbanc, & - num_urbanl, filter_urbanl, temperature_inst ) - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! - ! Calculate the internal building temperature, based on the simpler method introduced - ! in CLM4.5. - ! - ! !USES: - use clm_varpar , only : nlevurb - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use LandunitType , only : landunit_type - use ColumnType , only : column_type - use TemperatureType, only : temperature_type - - implicit none - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(:) ! urban column filter - type(temperature_type), intent(inout) :: temperature_inst ! temperature variables - ! !LOCAL VARIABLES: - ! Gather terms required to determine internal building temperature - integer :: fl,fc,l,c ! indices - real(r8) :: t_sunwall_innerl(bounds%begl:bounds%endl) ! temp of inner layer of sunwall (K) - real(r8) :: t_shadewall_innerl(bounds%begl:bounds%endl) ! temp of inner layer of shadewall (K) - real(r8) :: t_roof_innerl(bounds%begl:bounds%endl) ! temp of inner layer of roof (K) - real(r8) :: lngth_roof ! length of roof (m) - !EOP - !----------------------------------------------------------------------- - - associate(& - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:)] soil temperature (K) - ht_roof => lun%ht_roof , & ! Input: [real(r8) (:)] height of urban roof (m) - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:)] ratio of building height to street width - wtlunit_roof => lun%wtlunit_roof , & ! Input: [real(r8) (:)] weight of roof with respect to landunit - t_building => temperature_inst%t_building_lun & ! Output: [real(r8) (:)] internal building temperature (K) - ) - - do fc = 1,num_urbanc - c = filter_urbanc(fc) - l = col%landunit(c) - - if (col%itype(c) == icol_roof ) then - t_roof_innerl(l) = t_soisno(c,nlevurb) - else if (col%itype(c) == icol_sunwall ) then - t_sunwall_innerl(l) = t_soisno(c,nlevurb) - else if (col%itype(c) == icol_shadewall) then - t_shadewall_innerl(l) = t_soisno(c,nlevurb) - end if - - end do - - ! Calculate internal building temperature - do fl = 1, num_urbanl - l = filter_urbanl(fl) - - lngth_roof = (ht_roof(l)/canyon_hwr(l))*wtlunit_roof(l)/(1._r8-wtlunit_roof(l)) - t_building(l) = (ht_roof(l)*(t_shadewall_innerl(l) + t_sunwall_innerl(l)) & - +lngth_roof*t_roof_innerl(l))/(2._r8*ht_roof(l)+lngth_roof) - end do - - end associate - - end subroutine calc_simple_internal_building_temp - - !----------------------------------------------------------------------- - -end module UrbanFluxesMod diff --git a/src/biogeophys/UrbanParamsType.F90 b/src/biogeophys/UrbanParamsType.F90 deleted file mode 100644 index 4b4187c3af..0000000000 --- a/src/biogeophys/UrbanParamsType.F90 +++ /dev/null @@ -1,961 +0,0 @@ -module UrbanParamsType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Urban Constants - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varctl , only : iulog, fsurdat - use clm_varcon , only : namel, grlnd, spval - use LandunitType , only : lun - ! - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanReadNML ! Read in the urban namelist items - public :: UrbanInput ! Read in urban input data - public :: CheckUrban ! Check validity of urban points - public :: IsSimpleBuildTemp ! If using the simple building temperature method - public :: IsProgBuildTemp ! If using the prognostic building temperature method - ! - ! !PRIVATE TYPE - type urbinp_type - real(r8), pointer :: canyon_hwr (:,:) - real(r8), pointer :: wtlunit_roof (:,:) - real(r8), pointer :: wtroad_perv (:,:) - real(r8), pointer :: em_roof (:,:) - real(r8), pointer :: em_improad (:,:) - real(r8), pointer :: em_perroad (:,:) - real(r8), pointer :: em_wall (:,:) - real(r8), pointer :: alb_roof_dir (:,:,:) - real(r8), pointer :: alb_roof_dif (:,:,:) - real(r8), pointer :: alb_improad_dir (:,:,:) - real(r8), pointer :: alb_improad_dif (:,:,:) - real(r8), pointer :: alb_perroad_dir (:,:,:) - real(r8), pointer :: alb_perroad_dif (:,:,:) - real(r8), pointer :: alb_wall_dir (:,:,:) - real(r8), pointer :: alb_wall_dif (:,:,:) - real(r8), pointer :: ht_roof (:,:) - real(r8), pointer :: wind_hgt_canyon (:,:) - real(r8), pointer :: tk_wall (:,:,:) - real(r8), pointer :: tk_roof (:,:,:) - real(r8), pointer :: tk_improad (:,:,:) - real(r8), pointer :: cv_wall (:,:,:) - real(r8), pointer :: cv_roof (:,:,:) - real(r8), pointer :: cv_improad (:,:,:) - real(r8), pointer :: thick_wall (:,:) - real(r8), pointer :: thick_roof (:,:) - integer, pointer :: nlev_improad (:,:) - real(r8), pointer :: t_building_min (:,:) - end type urbinp_type - type (urbinp_type), public :: urbinp ! urban input derived type - - ! !PUBLIC TYPE - type, public :: urbanparams_type - real(r8), allocatable :: wind_hgt_canyon (:) ! lun height above road at which wind in canyon is to be computed (m) - real(r8), allocatable :: em_roof (:) ! lun roof emissivity - real(r8), allocatable :: em_improad (:) ! lun impervious road emissivity - real(r8), allocatable :: em_perroad (:) ! lun pervious road emissivity - real(r8), allocatable :: em_wall (:) ! lun wall emissivity - real(r8), allocatable :: alb_roof_dir (:,:) ! lun direct roof albedo - real(r8), allocatable :: alb_roof_dif (:,:) ! lun diffuse roof albedo - real(r8), allocatable :: alb_improad_dir (:,:) ! lun direct impervious road albedo - real(r8), allocatable :: alb_improad_dif (:,:) ! lun diffuse impervious road albedo - real(r8), allocatable :: alb_perroad_dir (:,:) ! lun direct pervious road albedo - real(r8), allocatable :: alb_perroad_dif (:,:) ! lun diffuse pervious road albedo - real(r8), allocatable :: alb_wall_dir (:,:) ! lun direct wall albedo - real(r8), allocatable :: alb_wall_dif (:,:) ! lun diffuse wall albedo - - integer , pointer :: nlev_improad (:) ! lun number of impervious road layers (-) - real(r8), pointer :: tk_wall (:,:) ! lun thermal conductivity of urban wall (W/m/K) - real(r8), pointer :: tk_roof (:,:) ! lun thermal conductivity of urban roof (W/m/K) - real(r8), pointer :: tk_improad (:,:) ! lun thermal conductivity of urban impervious road (W/m/K) - real(r8), pointer :: cv_wall (:,:) ! lun heat capacity of urban wall (J/m^3/K) - real(r8), pointer :: cv_roof (:,:) ! lun heat capacity of urban roof (J/m^3/K) - real(r8), pointer :: cv_improad (:,:) ! lun heat capacity of urban impervious road (J/m^3/K) - real(r8), pointer :: thick_wall (:) ! lun total thickness of urban wall (m) - real(r8), pointer :: thick_roof (:) ! lun total thickness of urban roof (m) - - real(r8), pointer :: vf_sr (:) ! lun view factor of sky for road - real(r8), pointer :: vf_wr (:) ! lun view factor of one wall for road - real(r8), pointer :: vf_sw (:) ! lun view factor of sky for one wall - real(r8), pointer :: vf_rw (:) ! lun view factor of road for one wall - real(r8), pointer :: vf_ww (:) ! lun view factor of opposing wall for one wall - - real(r8), pointer :: t_building_min (:) ! lun minimum internal building air temperature (K) - real(r8), pointer :: eflx_traffic_factor (:) ! lun multiplicative traffic factor for sensible heat flux from urban traffic (-) - contains - - procedure, public :: Init - - end type urbanparams_type - ! - ! !Urban control variables - character(len= *), parameter, public :: urban_hac_off = 'OFF' - character(len= *), parameter, public :: urban_hac_on = 'ON' - character(len= *), parameter, public :: urban_wasteheat_on = 'ON_WASTEHEAT' - character(len= 16), public :: urban_hac = urban_hac_off - logical, public :: urban_traffic = .false. ! urban traffic fluxes - - ! !PRIVATE MEMBER DATA: - logical, private :: ReadNamelist = .false. ! If namelist was read yet or not - integer, parameter, private :: BUILDING_TEMP_METHOD_SIMPLE = 0 ! Simple method introduced in CLM4.5 - integer, parameter, private :: BUILDING_TEMP_METHOD_PROG = 1 ! Prognostic method introduced in CLM5.0 - integer, private :: building_temp_method = BUILDING_TEMP_METHOD_PROG ! Method to calculate the building temperature - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - ! - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevcan, nlevcan, numrad, nlevgrnd, nlevurb - use clm_varpar , only : nlevsoi, nlevgrnd - use clm_varctl , only : use_vancouver, use_mexicocity - use clm_varcon , only : vkc - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv, icol_road_imperv, icol_road_perv - use landunit_varcon , only : isturb_MIN - ! - ! !ARGUMENTS: - class(urbanparams_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: j,l,c,p,g ! indices - integer :: nc,fl,ib ! indices - integer :: dindx ! urban density type index - integer :: ier ! error status - real(r8) :: sumvf ! sum of view factors for wall or road - real(r8), parameter :: alpha = 4.43_r8 ! coefficient used to calculate z_d_town - real(r8), parameter :: beta = 1.0_r8 ! coefficient used to calculate z_d_town - real(r8), parameter :: C_d = 1.2_r8 ! drag coefficient as used in Grimmond and Oke (1999) - real(r8) :: plan_ai ! plan area index - ratio building area to plan area (-) - real(r8) :: frontal_ai ! frontal area index of buildings (-) - real(r8) :: build_lw_ratio ! building short/long side ratio (-) - integer :: begl, endl - integer :: begc, endc - integer :: begp, endp - integer :: begg, endg - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begl = bounds%begl; endl = bounds%endl - begg = bounds%begg; endg = bounds%endg - - ! Allocate urbanparams data structure - - if ( nlevurb > 0 )then - allocate(this%tk_wall (begl:endl,nlevurb)) ; this%tk_wall (:,:) = nan - allocate(this%tk_roof (begl:endl,nlevurb)) ; this%tk_roof (:,:) = nan - allocate(this%cv_wall (begl:endl,nlevurb)) ; this%cv_wall (:,:) = nan - allocate(this%cv_roof (begl:endl,nlevurb)) ; this%cv_roof (:,:) = nan - end if - allocate(this%t_building_min (begl:endl)) ; this%t_building_min (:) = nan - allocate(this%tk_improad (begl:endl,nlevurb)) ; this%tk_improad (:,:) = nan - allocate(this%cv_improad (begl:endl,nlevurb)) ; this%cv_improad (:,:) = nan - allocate(this%thick_wall (begl:endl)) ; this%thick_wall (:) = nan - allocate(this%thick_roof (begl:endl)) ; this%thick_roof (:) = nan - allocate(this%nlev_improad (begl:endl)) ; this%nlev_improad (:) = huge(1) - allocate(this%vf_sr (begl:endl)) ; this%vf_sr (:) = nan - allocate(this%vf_wr (begl:endl)) ; this%vf_wr (:) = nan - allocate(this%vf_sw (begl:endl)) ; this%vf_sw (:) = nan - allocate(this%vf_rw (begl:endl)) ; this%vf_rw (:) = nan - allocate(this%vf_ww (begl:endl)) ; this%vf_ww (:) = nan - allocate(this%wind_hgt_canyon (begl:endl)) ; this%wind_hgt_canyon (:) = nan - allocate(this%em_roof (begl:endl)) ; this%em_roof (:) = nan - allocate(this%em_improad (begl:endl)) ; this%em_improad (:) = nan - allocate(this%em_perroad (begl:endl)) ; this%em_perroad (:) = nan - allocate(this%em_wall (begl:endl)) ; this%em_wall (:) = nan - allocate(this%alb_roof_dir (begl:endl,numrad)) ; this%alb_roof_dir (:,:) = nan - allocate(this%alb_roof_dif (begl:endl,numrad)) ; this%alb_roof_dif (:,:) = nan - allocate(this%alb_improad_dir (begl:endl,numrad)) ; this%alb_improad_dir (:,:) = nan - allocate(this%alb_perroad_dir (begl:endl,numrad)) ; this%alb_perroad_dir (:,:) = nan - allocate(this%alb_improad_dif (begl:endl,numrad)) ; this%alb_improad_dif (:,:) = nan - allocate(this%alb_perroad_dif (begl:endl,numrad)) ; this%alb_perroad_dif (:,:) = nan - allocate(this%alb_wall_dir (begl:endl,numrad)) ; this%alb_wall_dir (:,:) = nan - allocate(this%alb_wall_dif (begl:endl,numrad)) ; this%alb_wall_dif (:,:) = nan - allocate(this%eflx_traffic_factor (begl:endl)) ; this%eflx_traffic_factor (:) = nan - - ! Initialize time constant urban variables - - do l = bounds%begl,bounds%endl - - ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom - if (lun%urbpoi(l)) then - - g = lun%gridcell(l) - dindx = lun%itype(l) - isturb_MIN + 1 - - this%wind_hgt_canyon(l) = urbinp%wind_hgt_canyon(g,dindx) - do ib = 1,numrad - this%alb_roof_dir (l,ib) = urbinp%alb_roof_dir (g,dindx,ib) - this%alb_roof_dif (l,ib) = urbinp%alb_roof_dif (g,dindx,ib) - this%alb_improad_dir(l,ib) = urbinp%alb_improad_dir(g,dindx,ib) - this%alb_perroad_dir(l,ib) = urbinp%alb_perroad_dir(g,dindx,ib) - this%alb_improad_dif(l,ib) = urbinp%alb_improad_dif(g,dindx,ib) - this%alb_perroad_dif(l,ib) = urbinp%alb_perroad_dif(g,dindx,ib) - this%alb_wall_dir (l,ib) = urbinp%alb_wall_dir (g,dindx,ib) - this%alb_wall_dif (l,ib) = urbinp%alb_wall_dif (g,dindx,ib) - end do - this%em_roof (l) = urbinp%em_roof (g,dindx) - this%em_improad(l) = urbinp%em_improad(g,dindx) - this%em_perroad(l) = urbinp%em_perroad(g,dindx) - this%em_wall (l) = urbinp%em_wall (g,dindx) - - ! Landunit level initialization for urban wall and roof layers and interfaces - - lun%canyon_hwr(l) = urbinp%canyon_hwr(g,dindx) - lun%wtroad_perv(l) = urbinp%wtroad_perv(g,dindx) - lun%ht_roof(l) = urbinp%ht_roof(g,dindx) - lun%wtlunit_roof(l) = urbinp%wtlunit_roof(g,dindx) - - this%tk_wall(l,:) = urbinp%tk_wall(g,dindx,:) - this%tk_roof(l,:) = urbinp%tk_roof(g,dindx,:) - this%tk_improad(l,:) = urbinp%tk_improad(g,dindx,:) - this%cv_wall(l,:) = urbinp%cv_wall(g,dindx,:) - this%cv_roof(l,:) = urbinp%cv_roof(g,dindx,:) - this%cv_improad(l,:) = urbinp%cv_improad(g,dindx,:) - this%thick_wall(l) = urbinp%thick_wall(g,dindx) - this%thick_roof(l) = urbinp%thick_roof(g,dindx) - this%nlev_improad(l) = urbinp%nlev_improad(g,dindx) - this%t_building_min(l) = urbinp%t_building_min(g,dindx) - - ! Inferred from Sailor and Lu 2004 - if (urban_traffic) then - this%eflx_traffic_factor(l) = 3.6_r8 * (lun%canyon_hwr(l)-0.5_r8) + 1.0_r8 - else - this%eflx_traffic_factor(l) = 0.0_r8 - end if - - if (use_vancouver .or. use_mexicocity) then - ! Freely evolving - this%t_building_min(l) = 200.00_r8 - else - if (urban_hac == urban_hac_off) then - ! Overwrite values read in from urbinp by freely evolving values - this%t_building_min(l) = 200.00_r8 - end if - end if - - !---------------------------------------------------------------------------------- - ! View factors for road and one wall in urban canyon (depends only on canyon_hwr) - ! --------------------------------------------------------------------------------------- - ! WALL | - ! ROAD | - ! wall | - ! -----\ /----- - - |\----------/ - ! | \ vsr / | | r | | \ vww / s - ! | \ / | h o w | \ / k - ! wall | \ / | wall | a | | \ / y - ! |vwr \ / vwr| | d | |vrw \ / vsw - ! ------\/------ - - |-----\/----- - ! road wall | - ! <----- w ----> | - ! <---- h --->| - ! - ! vsr = view factor of sky for road vrw = view factor of road for wall - ! vwr = view factor of one wall for road vww = view factor of opposing wall for wall - ! vsw = view factor of sky for wall - ! vsr + vwr + vwr = 1 vrw + vww + vsw = 1 - ! - ! Source: Masson, V. (2000) A physically-based scheme for the urban energy budget in - ! atmospheric models. Boundary-Layer Meteorology 94:357-397 - ! - ! - Calculate urban land unit aerodynamic constants using Macdonald (1998) as used in - ! Grimmond and Oke (1999) - ! --------------------------------------------------------------------------------------- - - ! road -- sky view factor -> 1 as building height -> 0 - ! and -> 0 as building height -> infinity - - this%vf_sr(l) = sqrt(lun%canyon_hwr(l)**2 + 1._r8) - lun%canyon_hwr(l) - this%vf_wr(l) = 0.5_r8 * (1._r8 - this%vf_sr(l)) - - ! one wall -- sky view factor -> 0.5 as building height -> 0 - ! and -> 0 as building height -> infinity - - this%vf_sw(l) = 0.5_r8 * (lun%canyon_hwr(l) + 1._r8 - sqrt(lun%canyon_hwr(l)**2+1._r8)) / lun%canyon_hwr(l) - this%vf_rw(l) = this%vf_sw(l) - this%vf_ww(l) = 1._r8 - this%vf_sw(l) - this%vf_rw(l) - - ! error check -- make sure view factor sums to one for road and wall - sumvf = this%vf_sr(l) + 2._r8*this%vf_wr(l) - if (abs(sumvf-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban road view factor error',sumvf - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - sumvf = this%vf_sw(l) + this%vf_rw(l) + this%vf_ww(l) - if (abs(sumvf-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban wall view factor error',sumvf - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - - !---------------------------------------------------------------------------------- - ! Calculate urban land unit aerodynamic constants using Macdonald (1998) as used in - ! Grimmond and Oke (1999) - !---------------------------------------------------------------------------------- - - ! Calculate plan area index - plan_ai = lun%canyon_hwr(l)/(lun%canyon_hwr(l) + 1._r8) - - ! Building shape shortside/longside ratio (e.g. 1 = square ) - ! This assumes the building occupies the entire canyon length - build_lw_ratio = plan_ai - - ! Calculate frontal area index - frontal_ai = (1._r8 - plan_ai) * lun%canyon_hwr(l) - - ! Adjust frontal area index for different building configuration - frontal_ai = frontal_ai * sqrt(1/build_lw_ratio) * sqrt(plan_ai) - - ! Calculate displacement height - if (use_vancouver) then - lun%z_d_town(l) = 3.5_r8 - else if (use_mexicocity) then - lun%z_d_town(l) = 10.9_r8 - else - lun%z_d_town(l) = (1._r8 + alpha**(-plan_ai) * (plan_ai - 1._r8)) * lun%ht_roof(l) - end if - - ! Calculate the roughness length - if (use_vancouver) then - lun%z_0_town(l) = 0.35_r8 - else if (use_mexicocity) then - lun%z_0_town(l) = 2.2_r8 - else - lun%z_0_town(l) = lun%ht_roof(l) * (1._r8 - lun%z_d_town(l) / lun%ht_roof(l)) * & - exp(-1.0_r8 * (0.5_r8 * beta * C_d / vkc**2 * & - (1 - lun%z_d_town(l) / lun%ht_roof(l)) * frontal_ai)**(-0.5_r8)) - end if - - else ! Not urban point - - this%eflx_traffic_factor(l) = spval - this%t_building_min(l) = spval - - this%vf_sr(l) = spval - this%vf_wr(l) = spval - this%vf_sw(l) = spval - this%vf_rw(l) = spval - this%vf_ww(l) = spval - - end if - end do - - ! Deallocate memory for urbinp datatype - - call UrbanInput(bounds%begg, bounds%endg, mode='finalize') - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine UrbanInput(begg, endg, mode) - ! - ! !DESCRIPTION: - ! Allocate memory and read in urban input data - ! - ! !USES: - use clm_varpar , only : numrad, nlevurb - use landunit_varcon , only : numurbl - use fileutils , only : getavu, relavu, getfil, opnfil - use spmdMod , only : masterproc - use domainMod , only : ldomain - use ncdio_pio , only : file_desc_t, ncd_io, ncd_inqvdlen, ncd_inqfdims - use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, ncd_inqdid, ncd_inqdlen - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: begg, endg - character(len=*), intent(in) :: mode - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: dimid ! netCDF id - integer :: nw,n,k,i,j,ni,nj,ns ! indices - integer :: nlevurb_i ! input grid: number of urban vertical levels - integer :: numrad_i ! input grid: number of solar bands (VIS/NIR) - integer :: numurbl_i ! input grid: number of urban landunits - integer :: ier,ret ! error status - logical :: isgrid2d ! true => file is 2d - logical :: readvar ! true => variable is on dataset - logical :: has_numurbl ! true => numurbl dimension is on dataset - character(len=32) :: subname = 'UrbanInput' ! subroutine name - !----------------------------------------------------------------------- - - if ( nlevurb == 0 ) return - - if (mode == 'initialize') then - - ! Read urban data - - if (masterproc) then - write(iulog,*)' Reading in urban input data from fsurdat file ...' - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - if (masterproc) then - write(iulog,*) subname,trim(fsurdat) - end if - - ! Check whether this file has new-format urban data - call ncd_inqdid(ncid, 'numurbl', dimid, dimexist=has_numurbl) - - ! If file doesn't have numurbl, then it is old-format urban; - ! in this case, set nlevurb to zero - if (.not. has_numurbl) then - nlevurb = 0 - if (masterproc) write(iulog,*)'PCT_URBAN is not multi-density, nlevurb set to 0' - end if - - if ( nlevurb == 0 ) return - - ! Allocate dynamic memory - allocate(urbinp%canyon_hwr(begg:endg, numurbl), & - urbinp%wtlunit_roof(begg:endg, numurbl), & - urbinp%wtroad_perv(begg:endg, numurbl), & - urbinp%em_roof(begg:endg, numurbl), & - urbinp%em_improad(begg:endg, numurbl), & - urbinp%em_perroad(begg:endg, numurbl), & - urbinp%em_wall(begg:endg, numurbl), & - urbinp%alb_roof_dir(begg:endg, numurbl, numrad), & - urbinp%alb_roof_dif(begg:endg, numurbl, numrad), & - urbinp%alb_improad_dir(begg:endg, numurbl, numrad), & - urbinp%alb_perroad_dir(begg:endg, numurbl, numrad), & - urbinp%alb_improad_dif(begg:endg, numurbl, numrad), & - urbinp%alb_perroad_dif(begg:endg, numurbl, numrad), & - urbinp%alb_wall_dir(begg:endg, numurbl, numrad), & - urbinp%alb_wall_dif(begg:endg, numurbl, numrad), & - urbinp%ht_roof(begg:endg, numurbl), & - urbinp%wind_hgt_canyon(begg:endg, numurbl), & - urbinp%tk_wall(begg:endg, numurbl,nlevurb), & - urbinp%tk_roof(begg:endg, numurbl,nlevurb), & - urbinp%tk_improad(begg:endg, numurbl,nlevurb), & - urbinp%cv_wall(begg:endg, numurbl,nlevurb), & - urbinp%cv_roof(begg:endg, numurbl,nlevurb), & - urbinp%cv_improad(begg:endg, numurbl,nlevurb), & - urbinp%thick_wall(begg:endg, numurbl), & - urbinp%thick_roof(begg:endg, numurbl), & - urbinp%nlev_improad(begg:endg, numurbl), & - urbinp%t_building_min(begg:endg, numurbl), & - stat=ier) - if (ier /= 0) then - call endrun(msg="Allocation error "//errmsg(sourcefile, __LINE__)) - endif - - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun(msg=errmsg(sourcefile, __LINE__)) - end if - - call ncd_inqdid(ncid, 'nlevurb', dimid) - call ncd_inqdlen(ncid, dimid, nlevurb_i) - if (nlevurb_i /= nlevurb) then - write(iulog,*)trim(subname)// ': parameter nlevurb= ',nlevurb, & - 'does not equal input dataset nlevurb= ',nlevurb_i - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - - call ncd_inqdid(ncid, 'numrad', dimid) - call ncd_inqdlen(ncid, dimid, numrad_i) - if (numrad_i /= numrad) then - write(iulog,*)trim(subname)// ': parameter numrad= ',numrad, & - 'does not equal input dataset numrad= ',numrad_i - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - call ncd_inqdid(ncid, 'numurbl', dimid) - call ncd_inqdlen(ncid, dimid, numurbl_i) - if (numurbl_i /= numurbl) then - write(iulog,*)trim(subname)// ': parameter numurbl= ',numurbl, & - 'does not equal input dataset numurbl= ',numurbl_i - call endrun(msg=errmsg(sourcefile, __LINE__)) - endif - call ncd_io(ncid=ncid, varname='CANYON_HWR', flag='read', data=urbinp%canyon_hwr,& - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg='ERROR: CANYON_HWR NOT on fsurdat file '//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='WTLUNIT_ROOF', flag='read', data=urbinp%wtlunit_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: WTLUNIT_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='WTROAD_PERV', flag='read', data=urbinp%wtroad_perv, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: WTROAD_PERV NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_ROOF', flag='read', data=urbinp%em_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_IMPROAD', flag='read', data=urbinp%em_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_PERROAD', flag='read', data=urbinp%em_perroad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_PERROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='EM_WALL', flag='read', data=urbinp%em_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: EM_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='HT_ROOF', flag='read', data=urbinp%ht_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: HT_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='WIND_HGT_CANYON', flag='read', data=urbinp%wind_hgt_canyon, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: WIND_HGT_CANYON NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='THICK_WALL', flag='read', data=urbinp%thick_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: THICK_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='THICK_ROOF', flag='read', data=urbinp%thick_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: THICK_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='NLEV_IMPROAD', flag='read', data=urbinp%nlev_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: NLEV_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='T_BUILDING_MIN', flag='read', data=urbinp%t_building_min, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: T_BUILDING_MIN NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_IMPROAD_DIR', flag='read', data=urbinp%alb_improad_dir, & - dim1name=grlnd, readvar=readvar) - if (.not.readvar) then - call endrun( msg=' ERROR: ALB_IMPROAD_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_IMPROAD_DIF', flag='read', data=urbinp%alb_improad_dif, & - dim1name=grlnd, readvar=readvar) - if (.not.readvar) then - call endrun( msg=' ERROR: ALB_IMPROAD_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__) ) - end if - - call ncd_io(ncid=ncid, varname='ALB_PERROAD_DIR', flag='read',data=urbinp%alb_perroad_dir, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_PERROAD_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_PERROAD_DIF', flag='read',data=urbinp%alb_perroad_dif, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_PERROAD_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_ROOF_DIR', flag='read', data=urbinp%alb_roof_dir, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_ROOF_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_ROOF_DIF', flag='read', data=urbinp%alb_roof_dif, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_ROOF_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_WALL_DIR', flag='read', data=urbinp%alb_wall_dir, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_WALL_DIR NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='ALB_WALL_DIF', flag='read', data=urbinp%alb_wall_dif, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: ALB_WALL_DIF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='TK_IMPROAD', flag='read', data=urbinp%tk_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: TK_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='TK_ROOF', flag='read', data=urbinp%tk_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: TK_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='TK_WALL', flag='read', data=urbinp%tk_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: TK_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='CV_IMPROAD', flag='read', data=urbinp%cv_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: CV_IMPROAD NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='CV_ROOF', flag='read', data=urbinp%cv_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: CV_ROOF NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid, varname='CV_WALL', flag='read', data=urbinp%cv_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: CV_WALL NOT on fsurdat file'//errmsg(sourcefile, __LINE__)) - end if - - call ncd_pio_closefile(ncid) - if (masterproc) then - write(iulog,*)' Sucessfully read urban input data' - write(iulog,*) - end if - - else if (mode == 'finalize') then - - if ( nlevurb == 0 ) return - - deallocate(urbinp%canyon_hwr, & - urbinp%wtlunit_roof, & - urbinp%wtroad_perv, & - urbinp%em_roof, & - urbinp%em_improad, & - urbinp%em_perroad, & - urbinp%em_wall, & - urbinp%alb_roof_dir, & - urbinp%alb_roof_dif, & - urbinp%alb_improad_dir, & - urbinp%alb_perroad_dir, & - urbinp%alb_improad_dif, & - urbinp%alb_perroad_dif, & - urbinp%alb_wall_dir, & - urbinp%alb_wall_dif, & - urbinp%ht_roof, & - urbinp%wind_hgt_canyon, & - urbinp%tk_wall, & - urbinp%tk_roof, & - urbinp%tk_improad, & - urbinp%cv_wall, & - urbinp%cv_roof, & - urbinp%cv_improad, & - urbinp%thick_wall, & - urbinp%thick_roof, & - urbinp%nlev_improad, & - urbinp%t_building_min, & - stat=ier) - if (ier /= 0) then - call endrun(msg='initUrbanInput: deallocation error '//errmsg(sourcefile, __LINE__)) - end if - else - write(iulog,*)'initUrbanInput error: mode ',trim(mode),' not supported ' - call endrun(msg=errmsg(sourcefile, __LINE__)) - end if - - end subroutine UrbanInput - - !----------------------------------------------------------------------- - subroutine CheckUrban(begg, endg, pcturb, caller) - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Confirm that we have valid urban data for all points with pct urban > 0. If this isn't - ! true, abort with a message. - ! - ! !USES: - use clm_instur , only : urban_valid - use landunit_varcon , only : numurbl - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: begg, endg ! beg & end grid cell indices - real(r8) , intent(in) :: pcturb(begg:,:) ! % urban - character(len=*), intent(in) :: caller ! identifier of caller, for more meaningful error messages - ! - ! !REVISION HISTORY: - ! Created by Bill Sacks 7/2013, mostly by moving code from surfrd_special - ! - ! !LOCAL VARIABLES: - logical :: found - integer :: nl, n - integer :: nindx, dindx - integer :: nlev - !----------------------------------------------------------------------- - - found = .false. - do nl = begg,endg - do n = 1, numurbl - if ( pcturb(nl,n) > 0.0_r8 ) then - if ( .not. urban_valid(nl) .or. & - urbinp%canyon_hwr(nl,n) <= 0._r8 .or. & - urbinp%em_improad(nl,n) <= 0._r8 .or. & - urbinp%em_perroad(nl,n) <= 0._r8 .or. & - urbinp%em_roof(nl,n) <= 0._r8 .or. & - urbinp%em_wall(nl,n) <= 0._r8 .or. & - urbinp%ht_roof(nl,n) <= 0._r8 .or. & - urbinp%thick_roof(nl,n) <= 0._r8 .or. & - urbinp%thick_wall(nl,n) <= 0._r8 .or. & - urbinp%t_building_min(nl,n) <= 0._r8 .or. & - urbinp%wind_hgt_canyon(nl,n) <= 0._r8 .or. & - urbinp%wtlunit_roof(nl,n) <= 0._r8 .or. & - urbinp%wtroad_perv(nl,n) <= 0._r8 .or. & - any(urbinp%alb_improad_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_improad_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_perroad_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_perroad_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_roof_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_roof_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_wall_dir(nl,n,:) <= 0._r8) .or. & - any(urbinp%alb_wall_dif(nl,n,:) <= 0._r8) .or. & - any(urbinp%tk_roof(nl,n,:) <= 0._r8) .or. & - any(urbinp%tk_wall(nl,n,:) <= 0._r8) .or. & - any(urbinp%cv_roof(nl,n,:) <= 0._r8) .or. & - any(urbinp%cv_wall(nl,n,:) <= 0._r8)) then - found = .true. - nindx = nl - dindx = n - exit - else - if (urbinp%nlev_improad(nl,n) > 0) then - nlev = urbinp%nlev_improad(nl,n) - if ( any(urbinp%tk_improad(nl,n,1:nlev) <= 0._r8) .or. & - any(urbinp%cv_improad(nl,n,1:nlev) <= 0._r8)) then - found = .true. - nindx = nl - dindx = n - exit - end if - end if - end if - if (found) exit - end if - end do - end do - if ( found ) then - write(iulog,*) trim(caller), ' ERROR: no valid urban data for nl=',nindx - write(iulog,*)'density type: ',dindx - write(iulog,*)'urban_valid: ',urban_valid(nindx) - write(iulog,*)'canyon_hwr: ',urbinp%canyon_hwr(nindx,dindx) - write(iulog,*)'em_improad: ',urbinp%em_improad(nindx,dindx) - write(iulog,*)'em_perroad: ',urbinp%em_perroad(nindx,dindx) - write(iulog,*)'em_roof: ',urbinp%em_roof(nindx,dindx) - write(iulog,*)'em_wall: ',urbinp%em_wall(nindx,dindx) - write(iulog,*)'ht_roof: ',urbinp%ht_roof(nindx,dindx) - write(iulog,*)'thick_roof: ',urbinp%thick_roof(nindx,dindx) - write(iulog,*)'thick_wall: ',urbinp%thick_wall(nindx,dindx) - write(iulog,*)'t_building_min: ',urbinp%t_building_min(nindx,dindx) - write(iulog,*)'wind_hgt_canyon: ',urbinp%wind_hgt_canyon(nindx,dindx) - write(iulog,*)'wtlunit_roof: ',urbinp%wtlunit_roof(nindx,dindx) - write(iulog,*)'wtroad_perv: ',urbinp%wtroad_perv(nindx,dindx) - write(iulog,*)'alb_improad_dir: ',urbinp%alb_improad_dir(nindx,dindx,:) - write(iulog,*)'alb_improad_dif: ',urbinp%alb_improad_dif(nindx,dindx,:) - write(iulog,*)'alb_perroad_dir: ',urbinp%alb_perroad_dir(nindx,dindx,:) - write(iulog,*)'alb_perroad_dif: ',urbinp%alb_perroad_dif(nindx,dindx,:) - write(iulog,*)'alb_roof_dir: ',urbinp%alb_roof_dir(nindx,dindx,:) - write(iulog,*)'alb_roof_dif: ',urbinp%alb_roof_dif(nindx,dindx,:) - write(iulog,*)'alb_wall_dir: ',urbinp%alb_wall_dir(nindx,dindx,:) - write(iulog,*)'alb_wall_dif: ',urbinp%alb_wall_dif(nindx,dindx,:) - write(iulog,*)'tk_roof: ',urbinp%tk_roof(nindx,dindx,:) - write(iulog,*)'tk_wall: ',urbinp%tk_wall(nindx,dindx,:) - write(iulog,*)'cv_roof: ',urbinp%cv_roof(nindx,dindx,:) - write(iulog,*)'cv_wall: ',urbinp%cv_wall(nindx,dindx,:) - if (urbinp%nlev_improad(nindx,dindx) > 0) then - nlev = urbinp%nlev_improad(nindx,dindx) - write(iulog,*)'tk_improad: ',urbinp%tk_improad(nindx,dindx,1:nlev) - write(iulog,*)'cv_improad: ',urbinp%cv_improad(nindx,dindx,1:nlev) - end if - call endrun(msg=errmsg(sourcefile, __LINE__)) - end if - - end subroutine CheckUrban - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: UrbanReadNML - ! - ! !INTERFACE: - ! - subroutine UrbanReadNML ( NLFilename ) - ! - ! !DESCRIPTION: - ! - ! Read in the urban namelist - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - implicit none - ! - ! !ARGUMENTS: - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'UrbanReadNML' ! subroutine name - - namelist / clmu_inparm / urban_hac, urban_traffic, building_temp_method - !EOP - !----------------------------------------------------------------------- - - ! ---------------------------------------------------------------------- - ! Read namelist from input namelist filename - ! ---------------------------------------------------------------------- - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in clmu_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clmu_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clmu_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clmu_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clmu_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - ! Broadcast namelist variables read in - call shr_mpi_bcast(urban_hac, mpicom) - call shr_mpi_bcast(urban_traffic, mpicom) - call shr_mpi_bcast(building_temp_method, mpicom) - - ! - if (urban_traffic) then - write(iulog,*)'Urban traffic fluxes are not implemented currently' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - ! - if ( masterproc )then - write(iulog,*) ' urban air conditioning/heating and wasteheat = ', urban_hac - write(iulog,*) ' urban traffic flux = ', urban_traffic - end if - - ReadNamelist = .true. - - end subroutine UrbanReadNML - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsSimpleBuildTemp - ! - ! !INTERFACE: - ! - logical function IsSimpleBuildTemp( ) - ! - ! !DESCRIPTION: - ! - ! If the simple building temperature method is being used - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - if ( .not. ReadNamelist )then - write(iulog,*)'Testing on building_temp_method before urban namelist was read in' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - IsSimpleBuildTemp = building_temp_method == BUILDING_TEMP_METHOD_SIMPLE - - end function IsSimpleBuildTemp - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - !BOP - ! - ! !IROUTINE: IsProgBuildTemp - ! - ! !INTERFACE: - ! - logical function IsProgBuildTemp( ) - ! - ! !DESCRIPTION: - ! - ! If the prognostic building temperature method is being used - ! - ! !USES: - implicit none - !EOP - !----------------------------------------------------------------------- - - if ( .not. ReadNamelist )then - write(iulog,*)'Testing on building_temp_method before urban namelist was read in' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - IsProgBuildTemp = building_temp_method == BUILDING_TEMP_METHOD_PROG - - end function IsProgBuildTemp - - !----------------------------------------------------------------------- - -end module UrbanParamsType - - - - diff --git a/src/biogeophys/UrbanRadiationMod.F90 b/src/biogeophys/UrbanRadiationMod.F90 deleted file mode 100644 index 102d2b6803..0000000000 --- a/src/biogeophys/UrbanRadiationMod.F90 +++ /dev/null @@ -1,720 +0,0 @@ -module UrbanRadiationMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate solar and longwave radiation, and turbulent fluxes for urban landunit - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : numrad - use clm_varcon , only : isecspday, degpsec, namel - use clm_varctl , only : iulog - use abortutils , only : endrun - use UrbanParamsType , only : urbanparams_type - use atm2lndType , only : atm2lnd_type - use WaterStateType , only : waterstate_type - use TemperatureType , only : temperature_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use UrbanParamsType , only : urbanparams_type - use EnergyFluxType , only : energyflux_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanRadiation ! Urban physics - radiative fluxes - ! - ! PRIVATE MEMBER FUNCTIONS - private :: net_longwave ! Net longwave radiation for road and both walls in urban canyon - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine UrbanRadiation (bounds , & - num_nourbanl, filter_nourbanl , & - num_urbanl, filter_urbanl , & - num_urbanc, filter_urbanc , & - num_urbanp, filter_urbanp , & - atm2lnd_inst, waterstate_inst, temperature_inst, urbanparams_inst, & - solarabs_inst, surfalb_inst, energyflux_inst) - ! - ! !DESCRIPTION: - ! Solar fluxes absorbed and reflected by roof and canyon (walls, road). - ! Also net and upward longwave fluxes. - - ! !USES: - use clm_varcon , only : spval, sb, tfrz - use column_varcon , only : icol_road_perv, icol_road_imperv - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_time_manager , only : get_curr_date, get_step_size - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nourbanl ! number of non-urban landunits in clump - integer , intent(in) :: filter_nourbanl(:) ! non-urban landunit filter - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(:) ! urban column filter - integer , intent(in) :: num_urbanp ! number of urban patches in clump - integer , intent(in) :: filter_urbanp(:) ! urban pft filter - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: fp,fl,p,c,l,g ! indices - integer :: local_secp1 ! seconds into current date in local time - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day ! temporaries (not used) - integer :: secs ! seconds into current date - - real(r8), parameter :: mpe = 1.e-06_r8 ! prevents overflow for division by zero - real(r8), parameter :: snoem = 0.97_r8 ! snow emissivity (should use value from Biogeophysics1) - - real(r8) :: lwnet_roof(bounds%begl:bounds%endl) ! net (outgoing-incoming) longwave radiation (per unit ground area), roof (W/m**2) - real(r8) :: lwnet_improad(bounds%begl:bounds%endl) ! net (outgoing-incoming) longwave radiation (per unit ground area), impervious road (W/m**2) - real(r8) :: lwnet_perroad(bounds%begl:bounds%endl) ! net (outgoing-incoming) longwave radiation (per unit ground area), pervious road (W/m**2) - real(r8) :: lwnet_sunwall(bounds%begl:bounds%endl) ! net (outgoing-incoming) longwave radiation (per unit wall area), sunlit wall (W/m**2) - real(r8) :: lwnet_shadewall(bounds%begl:bounds%endl)! net (outgoing-incoming) longwave radiation (per unit wall area), shaded wall (W/m**2) - real(r8) :: lwnet_canyon(bounds%begl:bounds%endl) ! net (outgoing-incoming) longwave radiation for canyon, per unit ground area (W/m**2) - real(r8) :: lwup_roof(bounds%begl:bounds%endl) ! upward longwave radiation (per unit ground area), roof (W/m**2) - real(r8) :: lwup_improad(bounds%begl:bounds%endl) ! upward longwave radiation (per unit ground area), impervious road (W/m**2) - real(r8) :: lwup_perroad(bounds%begl:bounds%endl) ! upward longwave radiation (per unit ground area), pervious road (W/m**2) - real(r8) :: lwup_sunwall(bounds%begl:bounds%endl) ! upward longwave radiation, (per unit wall area), sunlit wall (W/m**2) - real(r8) :: lwup_shadewall(bounds%begl:bounds%endl) ! upward longwave radiation, (per unit wall area), shaded wall (W/m**2) - real(r8) :: lwup_canyon(bounds%begl:bounds%endl) ! upward longwave radiation for canyon, per unit ground area (W/m**2) - real(r8) :: t_roof(bounds%begl:bounds%endl) ! roof temperature (K) - real(r8) :: t_improad(bounds%begl:bounds%endl) ! imppervious road temperature (K) - real(r8) :: t_perroad(bounds%begl:bounds%endl) ! pervious road temperature (K) - real(r8) :: t_sunwall(bounds%begl:bounds%endl) ! sunlit wall temperature (K) - real(r8) :: t_shadewall(bounds%begl:bounds%endl) ! shaded wall temperature (K) - real(r8) :: lwdown(bounds%begl:bounds%endl) ! atmospheric downward longwave radiation (W/m**2) - real(r8) :: em_roof_s(bounds%begl:bounds%endl) ! roof emissivity with snow effects - real(r8) :: em_improad_s(bounds%begl:bounds%endl) ! impervious road emissivity with snow effects - real(r8) :: em_perroad_s(bounds%begl:bounds%endl) ! pervious road emissivity with snow effects - !----------------------------------------------------------------------- - - associate( & - ctype => col%itype , & ! Input: [integer (:) ] column type - coli => lun%coli , & ! Input: [integer (:) ] beginning column index for landunit - colf => lun%colf , & ! Input: [integer (:) ] ending column index for landunit - canyon_hwr => lun%canyon_hwr , & ! Input: [real(r8) (:) ] ratio of building height to street width - wtroad_perv => lun%wtroad_perv , & ! Input: [real(r8) (:) ] weight of pervious road wrt total road - - forc_solad => atm2lnd_inst%forc_solad_grc , & ! Input: [real(r8) (:,:) ] direct beam radiation (vis=forc_sols , nir=forc_soll ) (W/m**2) - forc_solai => atm2lnd_inst%forc_solai_grc , & ! Input: [real(r8) (:,:) ] diffuse beam radiation (vis=forc_sols , nir=forc_soll ) (W/m**2) - forc_solar => atm2lnd_inst%forc_solar_grc , & ! Input: [real(r8) (:) ] incident solar radiation (W/m**2) - forc_lwrad => atm2lnd_inst%forc_lwrad_not_downscaled_grc , & ! Input: [real(r8) (:) ] downward infrared (longwave) radiation (W/m**2) - - frac_sno => waterstate_inst%frac_sno_col , & ! Input: [real(r8) (:) ] fraction of ground covered by snow (0 to 1) - - t_ref2m => temperature_inst%t_ref2m_patch , & ! Input: [real(r8) (:) ] 2 m height surface air temperature (K) - t_grnd => temperature_inst%t_grnd_col , & ! Input: [real(r8) (:) ] ground temperature (K) - - em_roof => urbanparams_inst%em_roof , & ! Input: [real(r8) (:) ] roof emissivity - em_improad => urbanparams_inst%em_improad , & ! Input: [real(r8) (:) ] impervious road emissivity - em_perroad => urbanparams_inst%em_perroad , & ! Input: [real(r8) (:) ] pervious road emissivity - em_wall => urbanparams_inst%em_wall , & ! Input: [real(r8) (:) ] wall emissivity - - albd => surfalb_inst%albd_patch , & ! Input: [real(r8) (:,:) ] pft surface albedo (direct) - albi => surfalb_inst%albi_patch , & ! Input: [real(r8) (:,:) ] pft surface albedo (diffuse) - - sabs_roof_dir => solarabs_inst%sabs_roof_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by roof per unit ground area per unit incident flux - sabs_roof_dif => solarabs_inst%sabs_roof_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by roof per unit ground area per unit incident flux - sabs_sunwall_dir => solarabs_inst%sabs_sunwall_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by sunwall per unit wall area per unit incident flux - sabs_sunwall_dif => solarabs_inst%sabs_sunwall_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by sunwall per unit wall area per unit incident flux - sabs_shadewall_dir => solarabs_inst%sabs_shadewall_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by shadewall per unit wall area per unit incident flux - sabs_shadewall_dif => solarabs_inst%sabs_shadewall_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by shadewall per unit wall area per unit incident flux - sabs_improad_dir => solarabs_inst%sabs_improad_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by impervious road per unit ground area per unit incident flux - sabs_improad_dif => solarabs_inst%sabs_improad_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by impervious road per unit ground area per unit incident flux - sabs_perroad_dir => solarabs_inst%sabs_perroad_dir_lun , & ! Output: [real(r8) (:,:) ] direct solar absorbed by pervious road per unit ground area per unit incident flux - sabs_perroad_dif => solarabs_inst%sabs_perroad_dif_lun , & ! Output: [real(r8) (:,:) ] diffuse solar absorbed by pervious road per unit ground area per unit incident flux - sabg => solarabs_inst%sabg_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed by ground (W/m**2) - sabv => solarabs_inst%sabv_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed by vegetation (W/m**2) - fsa => solarabs_inst%fsa_patch , & ! Output: [real(r8) (:) ] solar radiation absorbed (total) (W/m**2) - fsa_u => solarabs_inst%fsa_u_patch , & ! Output: [real(r8) (:) ] urban solar radiation absorbed (total) (W/m**2) - - eflx_lwrad_out => energyflux_inst%eflx_lwrad_out_patch , & ! Output: [real(r8) (:) ] emitted infrared (longwave) radiation (W/m**2) - eflx_lwrad_net => energyflux_inst%eflx_lwrad_net_patch , & ! Output: [real(r8) (:) ] net infrared (longwave) rad (W/m**2) [+ = to atm] - eflx_lwrad_net_u => energyflux_inst%eflx_lwrad_net_u_patch , & ! Output: [real(r8) (:) ] urban net infrared (longwave) rad (W/m**2) [+ = to atm] - - begl => bounds%begl , & - endl => bounds%endl & - ) - - ! Define fields that appear on the restart file for non-urban landunits - - do fl = 1,num_nourbanl - l = filter_nourbanl(fl) - sabs_roof_dir(l,:) = spval - sabs_roof_dif(l,:) = spval - sabs_sunwall_dir(l,:) = spval - sabs_sunwall_dif(l,:) = spval - sabs_shadewall_dir(l,:) = spval - sabs_shadewall_dif(l,:) = spval - sabs_improad_dir(l,:) = spval - sabs_improad_dif(l,:) = spval - sabs_perroad_dir(l,:) = spval - sabs_perroad_dif(l,:) = spval - end do - - ! Set input forcing fields - do fl = 1,num_urbanl - l = filter_urbanl(fl) - g = lun%gridcell(l) - - ! Need to set the following temperatures to some defined value even if it - ! does not appear in the urban landunit for the net_longwave computation - - t_roof(l) = 19._r8 + tfrz - t_sunwall(l) = 19._r8 + tfrz - t_shadewall(l) = 19._r8 + tfrz - t_improad(l) = 19._r8 + tfrz - t_perroad(l) = 19._r8 + tfrz - - ! Initial assignment of emissivity - em_roof_s(l) = em_roof(l) - em_improad_s(l) = em_improad(l) - em_perroad_s(l) = em_perroad(l) - - ! Set urban temperatures and emissivity including snow effects. - do c = coli(l),colf(l) - if (ctype(c) == icol_roof ) then - t_roof(l) = t_grnd(c) - em_roof_s(l) = em_roof(l)*(1._r8-frac_sno(c)) + snoem*frac_sno(c) - else if (ctype(c) == icol_road_imperv) then - t_improad(l) = t_grnd(c) - em_improad_s(l) = em_improad(l)*(1._r8-frac_sno(c)) + snoem*frac_sno(c) - else if (ctype(c) == icol_road_perv ) then - t_perroad(l) = t_grnd(c) - em_perroad_s(l) = em_perroad(l)*(1._r8-frac_sno(c)) + snoem*frac_sno(c) - else if (ctype(c) == icol_sunwall ) then - t_sunwall(l) = t_grnd(c) - else if (ctype(c) == icol_shadewall ) then - t_shadewall(l) = t_grnd(c) - end if - end do - lwdown(l) = forc_lwrad(g) - end do - - ! Net longwave radiation for road and both walls in urban canyon allowing for multiple re-emission - - if (num_urbanl > 0) then - call net_longwave (bounds, & - num_urbanl, filter_urbanl, & - canyon_hwr(begl:endl), & - wtroad_perv(begl:endl), & - lwdown(begl:endl), & - em_roof_s(begl:endl), & - em_improad_s(begl:endl), & - em_perroad_s(begl:endl), & - em_wall(begl:endl), & - t_roof(begl:endl), & - t_improad(begl:endl), & - t_perroad(begl:endl), & - t_sunwall(begl:endl), & - t_shadewall(begl:endl), & - lwnet_roof(begl:endl), & - lwnet_improad(begl:endl), & - lwnet_perroad(begl:endl), & - lwnet_sunwall(begl:endl), & - lwnet_shadewall(begl:endl), & - lwnet_canyon(begl:endl), & - lwup_roof(begl:endl), & - lwup_improad(begl:endl), & - lwup_perroad(begl:endl), & - lwup_sunwall(begl:endl), & - lwup_shadewall(begl:endl), & - lwup_canyon(begl:endl), & - urbanparams_inst) - end if - - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! Determine variables needed for history output and communication with atm - ! Loop over urban patches in clump - - do fp = 1,num_urbanp - p = filter_urbanp(fp) - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - - ! Solar absorbed and longwave out and net - ! per unit ground area (roof, road) and per unit wall area (sunwall, shadewall) - ! Each urban pft has its own column - this is used in the logic below - - if (ctype(c) == icol_roof) then - eflx_lwrad_out(p) = lwup_roof(l) - eflx_lwrad_net(p) = lwnet_roof(l) - eflx_lwrad_net_u(p) = lwnet_roof(l) - sabg(p) = sabs_roof_dir(l,1)*forc_solad(g,1) + & - sabs_roof_dif(l,1)*forc_solai(g,1) + & - sabs_roof_dir(l,2)*forc_solad(g,2) + & - sabs_roof_dif(l,2)*forc_solai(g,2) - - else if (ctype(c) == icol_sunwall) then - eflx_lwrad_out(p) = lwup_sunwall(l) - eflx_lwrad_net(p) = lwnet_sunwall(l) - eflx_lwrad_net_u(p) = lwnet_sunwall(l) - sabg(p) = sabs_sunwall_dir(l,1)*forc_solad(g,1) + & - sabs_sunwall_dif(l,1)*forc_solai(g,1) + & - sabs_sunwall_dir(l,2)*forc_solad(g,2) + & - sabs_sunwall_dif(l,2)*forc_solai(g,2) - - else if (ctype(c) == icol_shadewall) then - eflx_lwrad_out(p) = lwup_shadewall(l) - eflx_lwrad_net(p) = lwnet_shadewall(l) - eflx_lwrad_net_u(p) = lwnet_shadewall(l) - sabg(p) = sabs_shadewall_dir(l,1)*forc_solad(g,1) + & - sabs_shadewall_dif(l,1)*forc_solai(g,1) + & - sabs_shadewall_dir(l,2)*forc_solad(g,2) + & - sabs_shadewall_dif(l,2)*forc_solai(g,2) - - else if (ctype(c) == icol_road_perv) then - eflx_lwrad_out(p) = lwup_perroad(l) - eflx_lwrad_net(p) = lwnet_perroad(l) - eflx_lwrad_net_u(p) = lwnet_perroad(l) - sabg(p) = sabs_perroad_dir(l,1)*forc_solad(g,1) + & - sabs_perroad_dif(l,1)*forc_solai(g,1) + & - sabs_perroad_dir(l,2)*forc_solad(g,2) + & - sabs_perroad_dif(l,2)*forc_solai(g,2) - - else if (ctype(c) == icol_road_imperv) then - eflx_lwrad_out(p) = lwup_improad(l) - eflx_lwrad_net(p) = lwnet_improad(l) - eflx_lwrad_net_u(p) = lwnet_improad(l) - sabg(p) = sabs_improad_dir(l,1)*forc_solad(g,1) + & - sabs_improad_dif(l,1)*forc_solai(g,1) + & - sabs_improad_dir(l,2)*forc_solad(g,2) + & - sabs_improad_dif(l,2)*forc_solai(g,2) - end if - - sabv(p) = 0._r8 - fsa(p) = sabv(p) + sabg(p) - fsa_u(p) = fsa(p) - - end do ! end loop over urban patches - - end associate - - end subroutine UrbanRadiation - - !----------------------------------------------------------------------- - subroutine net_longwave (bounds , & - num_urbanl, filter_urbanl, canyon_hwr, wtroad_perv , & - lwdown, em_roof, em_improad, em_perroad, em_wall , & - t_roof, t_improad, t_perroad, t_sunwall, t_shadewall , & - lwnet_roof, lwnet_improad, lwnet_perroad, lwnet_sunwall, lwnet_shadewall, lwnet_canyon , & - lwup_roof, lwup_improad, lwup_perroad, lwup_sunwall, lwup_shadewall, lwup_canyon, & - urbanparams_inst) - ! - ! !DESCRIPTION: - ! Net longwave radiation for road and both walls in urban canyon allowing for - ! multiple reflection. Also net longwave radiation for urban roof. - ! - ! !USES: - use clm_varcon , only : sb - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(:) ! urban landunit filter - real(r8), intent(in) :: canyon_hwr( bounds%begl: ) ! ratio of building height to street width [landunit] - real(r8), intent(in) :: wtroad_perv( bounds%begl: ) ! weight of pervious road wrt total road [landunit] - - real(r8), intent(in) :: lwdown( bounds%begl: ) ! atmospheric longwave radiation (W/m**2) [landunit] - real(r8), intent(in) :: em_roof( bounds%begl: ) ! roof emissivity [landunit] - real(r8), intent(in) :: em_improad( bounds%begl: ) ! impervious road emissivity [landunit] - real(r8), intent(in) :: em_perroad( bounds%begl: ) ! pervious road emissivity [landunit] - real(r8), intent(in) :: em_wall( bounds%begl: ) ! wall emissivity [landunit] - - real(r8), intent(in) :: t_roof( bounds%begl: ) ! roof temperature (K) [landunit] - real(r8), intent(in) :: t_improad( bounds%begl: ) ! impervious road temperature (K) [landunit] - real(r8), intent(in) :: t_perroad( bounds%begl: ) ! ervious road temperature (K) [landunit] - real(r8), intent(in) :: t_sunwall( bounds%begl: ) ! sunlit wall temperature (K) [landunit] - real(r8), intent(in) :: t_shadewall( bounds%begl: ) ! shaded wall temperature (K) [landunit] - - real(r8), intent(out) :: lwnet_roof( bounds%begl: ) ! net (outgoing-incoming) longwave radiation, roof (W/m**2) [landunit] - real(r8), intent(out) :: lwnet_improad( bounds%begl: ) ! net (outgoing-incoming) longwave radiation, impervious road (W/m**2) [landunit] - real(r8), intent(out) :: lwnet_perroad( bounds%begl: ) ! net (outgoing-incoming) longwave radiation, pervious road (W/m**2) [landunit] - real(r8), intent(out) :: lwnet_sunwall( bounds%begl: ) ! net (outgoing-incoming) longwave radiation (per unit wall area), sunlit wall (W/m**2) [landunit] - real(r8), intent(out) :: lwnet_shadewall( bounds%begl: ) ! net (outgoing-incoming) longwave radiation (per unit wall area), shaded wall (W/m**2) [landunit] - real(r8), intent(out) :: lwnet_canyon( bounds%begl: ) ! net (outgoing-incoming) longwave radiation for canyon, per unit ground area (W/m**2) [landunit] - - real(r8), intent(out) :: lwup_roof( bounds%begl: ) ! upward longwave radiation, roof (W/m**2) [landunit] - real(r8), intent(out) :: lwup_improad( bounds%begl: ) ! upward longwave radiation, impervious road (W/m**2) [landunit] - real(r8), intent(out) :: lwup_perroad( bounds%begl: ) ! upward longwave radiation, pervious road (W/m**2) [landunit] - real(r8), intent(out) :: lwup_sunwall( bounds%begl: ) ! upward longwave radiation (per unit wall area), sunlit wall (W/m**2) [landunit] - real(r8), intent(out) :: lwup_shadewall( bounds%begl: ) ! upward longwave radiation (per unit wall area), shaded wall (W/m**2) [landunit] - real(r8), intent(out) :: lwup_canyon( bounds%begl: ) ! upward longwave radiation for canyon, per unit ground area (W/m**2) [landunit] - ! - type(urbanparams_type) , intent(in) :: urbanparams_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: lwdown_road(bounds%begl:bounds%endl) ! atmospheric longwave radiation for total road (W/m**2) - real(r8) :: lwdown_sunwall(bounds%begl:bounds%endl) ! atmospheric longwave radiation (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: lwdown_shadewall(bounds%begl:bounds%endl) ! atmospheric longwave radiation (per unit wall area) for shaded wall (W/m**2) - real(r8) :: lwtot(bounds%begl:bounds%endl) ! incoming longwave radiation (W/m**2) - - real(r8) :: improad_a(bounds%begl:bounds%endl) ! absorbed longwave for improad (W/m**2) - real(r8) :: improad_r(bounds%begl:bounds%endl) ! reflected longwave for improad (W/m**2) - real(r8) :: improad_r_sky(bounds%begl:bounds%endl) ! improad_r to sky (W/m**2) - real(r8) :: improad_r_sunwall(bounds%begl:bounds%endl) ! improad_r to sunlit wall (W/m**2) - real(r8) :: improad_r_shadewall(bounds%begl:bounds%endl) ! improad_r to shaded wall (W/m**2) - real(r8) :: improad_e(bounds%begl:bounds%endl) ! emitted longwave for improad (W/m**2) - real(r8) :: improad_e_sky(bounds%begl:bounds%endl) ! improad_e to sky (W/m**2) - real(r8) :: improad_e_sunwall(bounds%begl:bounds%endl) ! improad_e to sunlit wall (W/m**2) - real(r8) :: improad_e_shadewall(bounds%begl:bounds%endl) ! improad_e to shaded wall (W/m**2) - - real(r8) :: perroad_a(bounds%begl:bounds%endl) ! absorbed longwave for perroad (W/m**2) - real(r8) :: perroad_r(bounds%begl:bounds%endl) ! reflected longwave for perroad (W/m**2) - real(r8) :: perroad_r_sky(bounds%begl:bounds%endl) ! perroad_r to sky (W/m**2) - real(r8) :: perroad_r_sunwall(bounds%begl:bounds%endl) ! perroad_r to sunlit wall (W/m**2) - real(r8) :: perroad_r_shadewall(bounds%begl:bounds%endl) ! perroad_r to shaded wall (W/m**2) - real(r8) :: perroad_e(bounds%begl:bounds%endl) ! emitted longwave for perroad (W/m**2) - real(r8) :: perroad_e_sky(bounds%begl:bounds%endl) ! perroad_e to sky (W/m**2) - real(r8) :: perroad_e_sunwall(bounds%begl:bounds%endl) ! perroad_e to sunlit wall (W/m**2) - real(r8) :: perroad_e_shadewall(bounds%begl:bounds%endl) ! perroad_e to shaded wall (W/m**2) - - real(r8) :: road_a(bounds%begl:bounds%endl) ! absorbed longwave for total road (W/m**2) - real(r8) :: road_r(bounds%begl:bounds%endl) ! reflected longwave for total road (W/m**2) - real(r8) :: road_r_sky(bounds%begl:bounds%endl) ! total road_r to sky (W/m**2) - real(r8) :: road_r_sunwall(bounds%begl:bounds%endl) ! total road_r to sunlit wall (W/m**2) - real(r8) :: road_r_shadewall(bounds%begl:bounds%endl) ! total road_r to shaded wall (W/m**2) - real(r8) :: road_e(bounds%begl:bounds%endl) ! emitted longwave for total road (W/m**2) - real(r8) :: road_e_sky(bounds%begl:bounds%endl) ! total road_e to sky (W/m**2) - real(r8) :: road_e_sunwall(bounds%begl:bounds%endl) ! total road_e to sunlit wall (W/m**2) - real(r8) :: road_e_shadewall(bounds%begl:bounds%endl) ! total road_e to shaded wall (W/m**2) - - real(r8) :: sunwall_a(bounds%begl:bounds%endl) ! absorbed longwave (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: sunwall_r(bounds%begl:bounds%endl) ! reflected longwave (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: sunwall_r_sky(bounds%begl:bounds%endl) ! sunwall_r to sky (W/m**2) - real(r8) :: sunwall_r_road(bounds%begl:bounds%endl) ! sunwall_r to road (W/m**2) - real(r8) :: sunwall_r_shadewall(bounds%begl:bounds%endl) ! sunwall_r to opposing (shaded) wall (W/m**2) - real(r8) :: sunwall_e(bounds%begl:bounds%endl) ! emitted longwave (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: sunwall_e_sky(bounds%begl:bounds%endl) ! sunwall_e to sky (W/m**2) - real(r8) :: sunwall_e_road(bounds%begl:bounds%endl) ! sunwall_e to road (W/m**2) - real(r8) :: sunwall_e_shadewall(bounds%begl:bounds%endl) ! sunwall_e to opposing (shaded) wall (W/m**2) - - real(r8) :: shadewall_a(bounds%begl:bounds%endl) ! absorbed longwave (per unit wall area) for shaded wall (W/m**2) - real(r8) :: shadewall_r(bounds%begl:bounds%endl) ! reflected longwave (per unit wall area) for shaded wall (W/m**2) - real(r8) :: shadewall_r_sky(bounds%begl:bounds%endl) ! shadewall_r to sky (W/m**2) - real(r8) :: shadewall_r_road(bounds%begl:bounds%endl) ! shadewall_r to road (W/m**2) - real(r8) :: shadewall_r_sunwall(bounds%begl:bounds%endl) ! shadewall_r to opposing (sunlit) wall (W/m**2) - real(r8) :: shadewall_e(bounds%begl:bounds%endl) ! emitted longwave (per unit wall area) for shaded wall (W/m**2) - real(r8) :: shadewall_e_sky(bounds%begl:bounds%endl) ! shadewall_e to sky (W/m**2) - real(r8) :: shadewall_e_road(bounds%begl:bounds%endl) ! shadewall_e to road (W/m**2) - real(r8) :: shadewall_e_sunwall(bounds%begl:bounds%endl) ! shadewall_e to opposing (sunlit) wall (W/m**2) - integer :: l,fl,iter ! indices - integer, parameter :: n = 50 ! number of interations - real(r8) :: crit ! convergence criterion (W/m**2) - real(r8) :: err ! energy conservation error (W/m**2) - real(r8) :: wtroad_imperv(bounds%begl:bounds%endl) ! weight of impervious road wrt total road - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - - SHR_ASSERT_ALL((ubound(canyon_hwr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wtroad_perv) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwdown) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_roof) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_improad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_perroad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(em_wall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_roof) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_improad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_perroad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_sunwall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_shadewall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwnet_roof) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwnet_improad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwnet_perroad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwnet_sunwall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwnet_shadewall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwnet_canyon) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwup_roof) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwup_improad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwup_perroad) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwup_sunwall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwup_shadewall) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(lwup_canyon) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - associate( & - vf_sr => urbanparams_inst%vf_sr , & ! Input: [real(r8) (:)] view factor of sky for road - vf_wr => urbanparams_inst%vf_wr , & ! Input: [real(r8) (:)] view factor of one wall for road - vf_sw => urbanparams_inst%vf_sw , & ! Input: [real(r8) (:)] view factor of sky for one wall - vf_rw => urbanparams_inst%vf_rw , & ! Input: [real(r8) (:)] view factor of road for one wall - vf_ww => urbanparams_inst%vf_ww & ! Input: [real(r8) (:)] view factor of opposing wall for one wall - ) - - ! Calculate impervious road - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - wtroad_imperv(l) = 1._r8 - wtroad_perv(l) - end do - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - ! atmospheric longwave radiation incident on walls and road in urban canyon. - ! check for conservation (need to convert wall fluxes to ground area). - ! lwdown (from atmosphere) = lwdown_road + (lwdown_sunwall + lwdown_shadewall)*canyon_hwr - - lwdown_road(l) = lwdown(l) * vf_sr(l) - lwdown_sunwall(l) = lwdown(l) * vf_sw(l) - lwdown_shadewall(l) = lwdown(l) * vf_sw(l) - - err = lwdown(l) - (lwdown_road(l) + (lwdown_shadewall(l) + lwdown_sunwall(l))*canyon_hwr(l)) - if (abs(err) > 0.10_r8 ) then - write(iulog,*) 'urban incident atmospheric longwave radiation balance error',err - write(iulog,*) 'l = ',l - write(iulog,*) 'lwdown = ',lwdown(l) - write(iulog,*) 'vf_sr = ',vf_sr(l) - write(iulog,*) 'vf_sw = ',vf_sw(l) - write(iulog,*) 'canyon_hwr = ',canyon_hwr(l) - write(iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - end do - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - - ! initial absorption, reflection, and emission for road and both walls. - ! distribute reflected and emitted radiation to sky, road, and walls according - ! to appropriate view factor. radiation reflected to road and walls will - ! undergo multiple reflections within the canyon. - - road_a(l) = 0.0_r8 - road_r(l) = 0.0_r8 - road_e(l) = 0.0_r8 - improad_a(l) = em_improad(l) * lwdown_road(l) - improad_r(l) = (1._r8-em_improad(l)) * lwdown_road(l) - improad_r_sky(l) = improad_r(l) * vf_sr(l) - improad_r_sunwall(l) = improad_r(l) * vf_wr(l) - improad_r_shadewall(l) = improad_r(l) * vf_wr(l) - improad_e(l) = em_improad(l) * sb * (t_improad(l)**4) - improad_e_sky(l) = improad_e(l) * vf_sr(l) - improad_e_sunwall(l) = improad_e(l) * vf_wr(l) - improad_e_shadewall(l) = improad_e(l) * vf_wr(l) - road_a(l) = road_a(l) + improad_a(l)*wtroad_imperv(l) - road_r(l) = road_r(l) + improad_r(l)*wtroad_imperv(l) - road_e(l) = road_e(l) + improad_e(l)*wtroad_imperv(l) - - perroad_a(l) = em_perroad(l) * lwdown_road(l) - perroad_r(l) = (1._r8-em_perroad(l)) * lwdown_road(l) - perroad_r_sky(l) = perroad_r(l) * vf_sr(l) - perroad_r_sunwall(l) = perroad_r(l) * vf_wr(l) - perroad_r_shadewall(l) = perroad_r(l) * vf_wr(l) - perroad_e(l) = em_perroad(l) * sb * (t_perroad(l)**4) - perroad_e_sky(l) = perroad_e(l) * vf_sr(l) - perroad_e_sunwall(l) = perroad_e(l) * vf_wr(l) - perroad_e_shadewall(l) = perroad_e(l) * vf_wr(l) - road_a(l) = road_a(l) + perroad_a(l)*wtroad_perv(l) - road_r(l) = road_r(l) + perroad_r(l)*wtroad_perv(l) - road_e(l) = road_e(l) + perroad_e(l)*wtroad_perv(l) - - road_r_sky(l) = road_r(l) * vf_sr(l) - road_r_sunwall(l) = road_r(l) * vf_wr(l) - road_r_shadewall(l) = road_r(l) * vf_wr(l) - road_e_sky(l) = road_e(l) * vf_sr(l) - road_e_sunwall(l) = road_e(l) * vf_wr(l) - road_e_shadewall(l) = road_e(l) * vf_wr(l) - - sunwall_a(l) = em_wall(l) * lwdown_sunwall(l) - sunwall_r(l) = (1._r8-em_wall(l)) * lwdown_sunwall(l) - sunwall_r_sky(l) = sunwall_r(l) * vf_sw(l) - sunwall_r_road(l) = sunwall_r(l) * vf_rw(l) - sunwall_r_shadewall(l) = sunwall_r(l) * vf_ww(l) - sunwall_e(l) = em_wall(l) * sb * (t_sunwall(l)**4) - sunwall_e_sky(l) = sunwall_e(l) * vf_sw(l) - sunwall_e_road(l) = sunwall_e(l) * vf_rw(l) - sunwall_e_shadewall(l) = sunwall_e(l) * vf_ww(l) - - shadewall_a(l) = em_wall(l) * lwdown_shadewall(l) - shadewall_r(l) = (1._r8-em_wall(l)) * lwdown_shadewall(l) - shadewall_r_sky(l) = shadewall_r(l) * vf_sw(l) - shadewall_r_road(l) = shadewall_r(l) * vf_rw(l) - shadewall_r_sunwall(l) = shadewall_r(l) * vf_ww(l) - shadewall_e(l) = em_wall(l) * sb * (t_shadewall(l)**4) - shadewall_e_sky(l) = shadewall_e(l) * vf_sw(l) - shadewall_e_road(l) = shadewall_e(l) * vf_rw(l) - shadewall_e_sunwall(l) = shadewall_e(l) * vf_ww(l) - - ! initialize sum of net and upward longwave radiation for road and both walls - - lwnet_improad(l) = improad_e(l) - improad_a(l) - lwnet_perroad(l) = perroad_e(l) - perroad_a(l) - lwnet_sunwall(l) = sunwall_e(l) - sunwall_a(l) - lwnet_shadewall(l) = shadewall_e(l) - shadewall_a(l) - - lwup_improad(l) = improad_r_sky(l) + improad_e_sky(l) - lwup_perroad(l) = perroad_r_sky(l) + perroad_e_sky(l) - lwup_sunwall(l) = sunwall_r_sky(l) + sunwall_e_sky(l) - lwup_shadewall(l) = shadewall_r_sky(l) + shadewall_e_sky(l) - - end do - - ! now account for absorption and reflection within canyon of fluxes from road and walls - ! allowing for multiple reflections - ! - ! (1) absorption and reflection. note: emission from road and walls absorbed by walls and roads - ! only occurs in first iteration. zero out for later iterations. - ! - ! road: fluxes from walls need to be projected to ground area - ! wall: fluxes from road need to be projected to wall area - ! - ! (2) add net longwave for ith reflection to total net longwave - ! - ! (3) distribute reflected radiation to sky, road, and walls according to view factors - ! - ! (4) add upward longwave radiation to sky from road and walls for ith reflection to total - ! - ! (5) stop iteration when absorption for ith reflection is less than some nominal amount. - ! small convergence criteria is required to ensure radiation is conserved - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - - do iter = 1, n - ! step (1) - - lwtot(l) = (sunwall_r_road(l) + sunwall_e_road(l) & - + shadewall_r_road(l) + shadewall_e_road(l))*canyon_hwr(l) - road_a(l) = 0.0_r8 - road_r(l) = 0.0_r8 - improad_r(l) = (1._r8-em_improad(l)) * lwtot(l) - improad_a(l) = em_improad(l) * lwtot(l) - road_a(l) = road_a(l) + improad_a(l)*wtroad_imperv(l) - road_r(l) = road_r(l) + improad_r(l)*wtroad_imperv(l) - perroad_r(l) = (1._r8-em_perroad(l)) * lwtot(l) - perroad_a(l) = em_perroad(l) * lwtot(l) - road_a(l) = road_a(l) + perroad_a(l)*wtroad_perv(l) - road_r(l) = road_r(l) + perroad_r(l)*wtroad_perv(l) - - lwtot(l) = (road_r_sunwall(l) + road_e_sunwall(l))/canyon_hwr(l) & - + (shadewall_r_sunwall(l) + shadewall_e_sunwall(l)) - sunwall_a(l) = em_wall(l) * lwtot(l) - sunwall_r(l) = (1._r8-em_wall(l)) * lwtot(l) - - lwtot(l) = (road_r_shadewall(l) + road_e_shadewall(l))/canyon_hwr(l) & - + (sunwall_r_shadewall(l) + sunwall_e_shadewall(l)) - shadewall_a(l) = em_wall(l) * lwtot(l) - shadewall_r(l) = (1._r8-em_wall(l)) * lwtot(l) - - sunwall_e_road(l) = 0._r8 - shadewall_e_road(l) = 0._r8 - road_e_sunwall(l) = 0._r8 - shadewall_e_sunwall(l) = 0._r8 - road_e_shadewall(l) = 0._r8 - sunwall_e_shadewall(l) = 0._r8 - - ! step (2) - - lwnet_improad(l) = lwnet_improad(l) - improad_a(l) - lwnet_perroad(l) = lwnet_perroad(l) - perroad_a(l) - lwnet_sunwall(l) = lwnet_sunwall(l) - sunwall_a(l) - lwnet_shadewall(l) = lwnet_shadewall(l) - shadewall_a(l) - - ! step (3) - - improad_r_sky(l) = improad_r(l) * vf_sr(l) - improad_r_sunwall(l) = improad_r(l) * vf_wr(l) - improad_r_shadewall(l) = improad_r(l) * vf_wr(l) - - perroad_r_sky(l) = perroad_r(l) * vf_sr(l) - perroad_r_sunwall(l) = perroad_r(l) * vf_wr(l) - perroad_r_shadewall(l) = perroad_r(l) * vf_wr(l) - - road_r_sky(l) = road_r(l) * vf_sr(l) - road_r_sunwall(l) = road_r(l) * vf_wr(l) - road_r_shadewall(l) = road_r(l) * vf_wr(l) - - sunwall_r_sky(l) = sunwall_r(l) * vf_sw(l) - sunwall_r_road(l) = sunwall_r(l) * vf_rw(l) - sunwall_r_shadewall(l) = sunwall_r(l) * vf_ww(l) - - shadewall_r_sky(l) = shadewall_r(l) * vf_sw(l) - shadewall_r_road(l) = shadewall_r(l) * vf_rw(l) - shadewall_r_sunwall(l) = shadewall_r(l) * vf_ww(l) - - ! step (4) - - lwup_improad(l) = lwup_improad(l) + improad_r_sky(l) - lwup_perroad(l) = lwup_perroad(l) + perroad_r_sky(l) - lwup_sunwall(l) = lwup_sunwall(l) + sunwall_r_sky(l) - lwup_shadewall(l) = lwup_shadewall(l) + shadewall_r_sky(l) - - ! step (5) - - crit = max(road_a(l), sunwall_a(l), shadewall_a(l)) - if (crit < .001_r8) exit - end do - if (iter >= n) then - write (iulog,*) 'urban net longwave radiation error: no convergence' - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - endif - - ! total net longwave radiation for canyon. project wall fluxes to horizontal surface - - lwnet_canyon(l) = 0.0_r8 - lwnet_canyon(l) = lwnet_canyon(l) + lwnet_improad(l)*wtroad_imperv(l) - lwnet_canyon(l) = lwnet_canyon(l) + lwnet_perroad(l)*wtroad_perv(l) - lwnet_canyon(l) = lwnet_canyon(l) + (lwnet_sunwall(l) + lwnet_shadewall(l))*canyon_hwr(l) - - ! total emitted longwave for canyon. project wall fluxes to horizontal - - lwup_canyon(l) = 0.0_r8 - lwup_canyon(l) = lwup_canyon(l) + lwup_improad(l)*wtroad_imperv(l) - lwup_canyon(l) = lwup_canyon(l) + lwup_perroad(l)*wtroad_perv(l) - lwup_canyon(l) = lwup_canyon(l) + (lwup_sunwall(l) + lwup_shadewall(l))*canyon_hwr(l) - - ! conservation check. note: previous conservation check confirms partioning of incident - ! atmospheric longwave radiation to road and walls is conserved as - ! lwdown (from atmosphere) = lwdown_improad + lwdown_perroad + (lwdown_sunwall + lwdown_shadewall)*canyon_hwr - - err = lwnet_canyon(l) - (lwup_canyon(l) - lwdown(l)) - if (abs(err) > .10_r8 ) then - write (iulog,*) 'urban net longwave radiation balance error',err - write (iulog,*) 'clm model is stopping' - call endrun(decomp_index=l, clmlevel=namel, msg=errmsg(sourcefile, __LINE__)) - end if - - end do - - ! Net longwave radiation for roof - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - lwup_roof(l) = em_roof(l)*sb*(t_roof(l)**4) + (1._r8-em_roof(l))*lwdown(l) - lwnet_roof(l) = lwup_roof(l) - lwdown(l) - end do - - end associate - - end subroutine net_longwave - -end module UrbanRadiationMod diff --git a/src/biogeophys/UrbanTimeVarType.F90 b/src/biogeophys/UrbanTimeVarType.F90 deleted file mode 100644 index 81ceb9cf1e..0000000000 --- a/src/biogeophys/UrbanTimeVarType.F90 +++ /dev/null @@ -1,310 +0,0 @@ -module UrbanTimeVarType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Urban Time Varying Data - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_CL - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varctl , only : iulog - use landunit_varcon , only : isturb_MIN, isturb_MAX - use clm_varcon , only : spval - use LandunitType , only : lun - use GridcellType , only : grc - use mct_mod - use shr_strdata_mod , only : shr_strdata_type - ! - implicit none - save - private - ! - ! - - ! !PUBLIC TYPE - type, public :: urbantv_type - - real(r8), public, pointer :: t_building_max(:) ! lun maximum internal building air temperature (K) - type(shr_strdata_type) :: sdat_urbantv ! urban time varying input data stream - contains - - ! !PUBLIC MEMBER FUNCTIONS: - procedure, public :: Init ! Allocate and initialize urbantv - procedure, public :: urbantv_init ! Initialize urban time varying stream - procedure, public :: urbantv_interp ! Interpolate urban time varying stream - - end type urbantv_type - - !----------------------------------------------------------------------- - character(15), private :: stream_var_name(isturb_MIN:isturb_MAX) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds, NLFilename) - ! - ! Allocate module variables and data structures - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(urbantv_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: begl, endl - !--------------------------------------------------------------------- - - begl = bounds%begl; endl = bounds%endl - - ! Allocate urbantv data structure - - allocate(this%t_building_max (begl:endl)) ; this%t_building_max (:) = nan - - call this%urbantv_init(bounds, NLFilename) - call this%urbantv_interp(bounds) - - ! Add history fields - call hist_addfld1d (fname='TBUILD_MAX', units='K', & - avgflag='A', long_name='prescribed maximum interior building temperature', & - ptr_lunit=this%t_building_max, default='inactive', set_nourb=spval, & - l2g_scale_type='unity') - - - end subroutine Init - - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - subroutine urbantv_init(this, bounds, NLFilename) - ! - ! !DESCRIPTION: - ! Initialize data stream information for urban time varying data - ! - ! !USES: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use clm_nlUtilsMod , only : find_nlgroup_name - use ndepStreamMod , only : clm_domain_mct - use spmdMod , only : masterproc, mpicom, comp_id - use fileutils , only : getavu, relavu - use shr_mpi_mod , only : shr_mpi_bcast - use shr_string_mod , only : shr_string_listAppend - use shr_strdata_mod , only : shr_strdata_create, shr_strdata_print - use decompMod , only : gsmap_lnd_gdc2glo - use domainMod , only : ldomain - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use landunit_varcon , only : isturb_TBD, isturb_HD, isturb_MD - ! - ! !ARGUMENTS: - implicit none - class(urbantv_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: begl, endl ! landunits - integer :: ifield ! field index - integer :: stream_year_first_urbantv ! first year in urban tv stream to use - integer :: stream_year_last_urbantv ! last year in urban tv stream to use - integer :: model_year_align_urbantv ! align stream_year_first_urbantv - ! with this model year - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_urbantv ! urban tv streams filename - character(len=CL) :: urbantvmapalgo = 'nn' ! mapping alogrithm for urban ac - character(SHR_KIND_CL) :: fldList ! field string - character(*), parameter :: urbantvString = "tbuildmax_" ! base string for field string - character(*), parameter :: subName = "('urbantv_init')" - character(*), parameter :: F00 = "('(urbantv_init) ',4a)" - !----------------------------------------------------------------------- - namelist /urbantv_streams/ & - stream_year_first_urbantv, & - stream_year_last_urbantv, & - model_year_align_urbantv, & - urbantvmapalgo, & - stream_fldFileName_urbantv - !----------------------------------------------------------------------- - - begl = bounds%begl; endl = bounds%endl - - ! Default values for namelist - stream_year_first_urbantv = 1 ! first year in stream to use - stream_year_last_urbantv = 1 ! last year in stream to use - model_year_align_urbantv = 1 ! align stream_year_first_urbantv with this model year - stream_fldFileName_urbantv = ' ' - - ! Read urbantv_streams namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'urbantv_streams', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=urbantv_streams,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading urbantv_streams namelist'//errMsg(sourcefile, __LINE__)) - end if - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_urbantv, mpicom) - call shr_mpi_bcast(stream_year_last_urbantv, mpicom) - call shr_mpi_bcast(model_year_align_urbantv, mpicom) - call shr_mpi_bcast(stream_fldFileName_urbantv, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'urbantv_streams settings:' - write(iulog,*) ' stream_year_first_urbantv = ',stream_year_first_urbantv - write(iulog,*) ' stream_year_last_urbantv = ',stream_year_last_urbantv - write(iulog,*) ' model_year_align_urbantv = ',model_year_align_urbantv - write(iulog,*) ' stream_fldFileName_urbantv = ',stream_fldFileName_urbantv - write(iulog,*) ' ' - endif - - call clm_domain_mct (bounds, dom_clm) - - ! create the field list for these urbantv fields...use in shr_strdata_create - stream_var_name(:) = "NOT_SET" - stream_var_name(isturb_TBD) = urbantvString//"TBD" - stream_var_name(isturb_HD) = urbantvString//"HD" - stream_var_name(isturb_MD) = urbantvString//"MD" - fldList = "" - do ifield = isturb_MIN, isturb_MAX - call shr_string_listAppend( fldList, stream_var_name(ifield) ) - end do - - call shr_strdata_create(this%sdat_urbantv,name="clmurbantv", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_urbantv, & - yearLast=stream_year_last_urbantv, & - yearAlign=model_year_align_urbantv, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_urbantv), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='LANDMASK', & - filePath='', & - filename=(/trim(stream_fldFileName_urbantv)/) , & - fldListFile=fldList, & - fldListModel=fldList, & - fillalgo='none', & - mapalgo=urbantvmapalgo, & - calendar=get_calendar(), & - tintalgo='linear', & - taxmode='extend' ) - - if (masterproc) then - call shr_strdata_print(this%sdat_urbantv,'urban time varying data') - endif - - - end subroutine urbantv_init - - !----------------------------------------------------------------------- - subroutine urbantv_interp(this, bounds) - ! - ! !DESCRIPTION: - ! Interpolate data stream information for urban time varying data. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - use spmdMod , only : mpicom - use shr_strdata_mod , only : shr_strdata_advance - use clm_instur , only : urban_valid - ! - ! !ARGUMENTS: - class(urbantv_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - logical :: found - integer :: l, glun, ig, g, ip - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - integer :: lindx ! landunit index - integer :: gindx ! gridcell index - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(this%sdat_urbantv, mcdate, sec, mpicom, 'urbantvdyn') - - do l = bounds%begl,bounds%endl - if (lun%urbpoi(l)) then - glun = lun%gridcell(l) - ip = mct_aVect_indexRA(this%sdat_urbantv%avs(1),trim(stream_var_name(lun%itype(l)))) - ! - ! Determine vector index corresponding to glun - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == glun) exit - end do - - this%t_building_max(l) = this%sdat_urbantv%avs(1)%rAttr(ip,ig) - else - this%t_building_max(l) = spval - end if - end do - - found = .false. - do l = bounds%begl,bounds%endl - if (lun%urbpoi(l)) then - glun = lun%gridcell(l) - ! - ! Determine vector index corresponding to glun - ! - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - if (g == glun) exit - end do - - if ( .not. urban_valid(g) .or. (this%t_building_max(l) <= 0._r8)) then - found = .true. - gindx = g - lindx = l - exit - end if - end if - end do - if ( found ) then - write(iulog,*)'ERROR: no valid urban data for g= ',gindx - write(iulog,*)'landunit type: ',lun%itype(l) - write(iulog,*)'urban_valid: ',urban_valid(gindx) - write(iulog,*)'t_building_max: ',this%t_building_max(lindx) - call endrun(msg=errmsg(sourcefile, __LINE__)) - end if - - - end subroutine urbantv_interp - - !----------------------------------------------------------------------- - -end module UrbanTimeVarType diff --git a/src/biogeophys/WaterStateType.F90 b/src/biogeophys/WaterStateType.F90 deleted file mode 100644 index 9493a8a68a..0000000000 --- a/src/biogeophys/WaterStateType.F90 +++ /dev/null @@ -1,1137 +0,0 @@ -module WaterstateType - -#include "shr_assert.h" - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Module variables for hydrology - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varctl , only : use_vancouver, use_mexicocity, use_cn, iulog, use_luna - use clm_varpar , only : nlevgrnd, nlevurb, nlevsno - use clm_varcon , only : spval - use LandunitType , only : lun - use ColumnType , only : col - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - type, public :: waterstate_type - - real(r8), pointer :: snow_depth_col (:) ! col snow height of snow covered area (m) - real(r8), pointer :: snow_persistence_col (:) ! col length of time that ground has had non-zero snow thickness (sec) - real(r8), pointer :: snowdp_col (:) ! col area-averaged snow height (m) - real(r8), pointer :: snowice_col (:) ! col average snow ice lens - real(r8), pointer :: snowliq_col (:) ! col average snow liquid water - real(r8), pointer :: int_snow_col (:) ! col integrated snowfall (mm H2O) - real(r8), pointer :: snow_layer_unity_col (:,:) ! value 1 for each snow layer, used for history diagnostics - real(r8), pointer :: bw_col (:,:) ! col partial density of water in the snow pack (ice + liquid) [kg/m3] - - real(r8), pointer :: h2osno_col (:) ! col snow water (mm H2O) - real(r8), pointer :: h2osno_old_col (:) ! col snow mass for previous time step (kg/m2) (new) - real(r8), pointer :: h2osoi_liq_col (:,:) ! col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_ice_col (:,:) ! col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_liq_tot_col (:) ! vertically summed col liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_ice_tot_col (:) ! vertically summed col ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_liqice_10cm_col (:) ! col liquid water + ice lens in top 10cm of soil (kg/m2) - real(r8), pointer :: h2osoi_vol_col (:,:) ! col volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - real(r8), pointer :: air_vol_col (:,:) ! col air filled porosity - real(r8), pointer :: h2osoi_liqvol_col (:,:) ! col volumetric liquid water content (v/v) - real(r8), pointer :: h2ocan_patch (:) ! patch canopy water (mm H2O) - real(r8), pointer :: h2osfc_col (:) ! col surface water (mm H2O) - real(r8), pointer :: snocan_patch (:) ! patch canopy snow water (mm H2O) - real(r8), pointer :: liqcan_patch (:) ! patch canopy liquid water (mm H2O) - real(r8), pointer :: snounload_patch (:) ! Canopy snow unloading (mm H2O) - real(r8), pointer :: swe_old_col (:,:) ! col initial snow water - real(r8), pointer :: liq1_grc (:) ! grc initial gridcell total h2o liq content - real(r8), pointer :: liq2_grc (:) ! grc post land cover change total liq content - real(r8), pointer :: ice1_grc (:) ! grc initial gridcell total h2o ice content - real(r8), pointer :: ice2_grc (:) ! grc post land cover change total ice content - real(r8), pointer :: tws_grc (:) ! grc total water storage (mm H2O) - - real(r8), pointer :: total_plant_stored_h2o_col(:) ! col water that is bound in plants, including roots, sapwood, leaves, etc - ! in most cases, the vegetation scheme does not have a dynamic - ! water storage in plants, and thus 0.0 is a suitable for the trivial case. - ! When FATES is coupled in with plant hydraulics turned on, this storage - ! term is set to non-zero. (kg/m2 H2O) - - real(r8), pointer :: snw_rds_col (:,:) ! col snow grain radius (col,lyr) [m^-6, microns] - real(r8), pointer :: snw_rds_top_col (:) ! col snow grain radius (top layer) [m^-6, microns] - real(r8), pointer :: h2osno_top_col (:) ! col top-layer mass of snow [kg] - real(r8), pointer :: sno_liq_top_col (:) ! col snow liquid water fraction (mass), top layer [fraction] - - real(r8), pointer :: q_ref2m_patch (:) ! patch 2 m height surface specific humidity (kg/kg) - real(r8), pointer :: rh_ref2m_patch (:) ! patch 2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m_r_patch (:) ! patch 2 m height surface relative humidity - rural (%) - real(r8), pointer :: rh_ref2m_u_patch (:) ! patch 2 m height surface relative humidity - urban (%) - real(r8), pointer :: rh_af_patch (:) ! patch fractional humidity of canopy air (dimensionless) ! private - real(r8), pointer :: rh10_af_patch (:) ! 10-day mean patch fractional humidity of canopy air (dimensionless) - real(r8), pointer :: qg_snow_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: qg_soil_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: qg_h2osfc_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: qg_col (:) ! col ground specific humidity [kg/kg] - real(r8), pointer :: dqgdT_col (:) ! col d(qg)/dT - real(r8), pointer :: qaf_lun (:) ! lun urban canopy air specific humidity (kg/kg) - - ! Fractions - real(r8), pointer :: frac_sno_col (:) ! col fraction of ground covered by snow (0 to 1) - real(r8), pointer :: frac_sno_eff_col (:) ! col fraction of ground covered by snow (0 to 1) - real(r8), pointer :: frac_iceold_col (:,:) ! col fraction of ice relative to the tot water (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: frac_h2osfc_col (:) ! col fractional area with surface water greater than zero - real(r8), pointer :: frac_h2osfc_nosnow_col (:) ! col fractional area with surface water greater than zero (if no snow present) - real(r8), pointer :: wf_col (:) ! col soil water as frac. of whc for top 0.05 m (0-1) - real(r8), pointer :: wf2_col (:) ! col soil water as frac. of whc for top 0.17 m (0-1) - real(r8), pointer :: fwet_patch (:) ! patch canopy fraction that is wet (0 to 1) - real(r8), pointer :: fcansno_patch (:) ! patch canopy fraction that is snow covered (0 to 1) - real(r8), pointer :: fdry_patch (:) ! patch canopy fraction of foliage that is green and dry [-] (new) - - ! Balance Checks - - real(r8), pointer :: begwb_col (:) ! water mass begining of the time step - real(r8), pointer :: endwb_col (:) ! water mass end of the time step - real(r8), pointer :: errh2o_patch (:) ! water conservation error (mm H2O) - real(r8), pointer :: errh2o_col (:) ! water conservation error (mm H2O) - real(r8), pointer :: errh2osno_col (:) ! snow water conservation error(mm H2O) - - contains - - procedure :: Init - procedure :: Restart - procedure, public :: Reset - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type waterstate_type - - ! minimum allowed snow effective radius (also "fresh snow" value) [microns] - real(r8), public, parameter :: snw_rds_min = 54.526_r8 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - h2osno_input_col, snow_depth_input_col, watsat_col, t_soisno_col) - - class(waterstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(inout) :: h2osno_input_col(bounds%begc:) - real(r8) , intent(inout) :: snow_depth_input_col(bounds%begc:) - real(r8) , intent(inout) :: watsat_col(bounds%begc:, 1:) ! volumetric soil water at saturation (porosity) - real(r8) , intent(inout) :: t_soisno_col(bounds%begc:, -nlevsno+1:) ! col soil temperature (Kelvin) - -#ifdef __PGI -# if __PGIC__ == 14 && __PGIC_MINOR__ == 7 - ! COMPILER_BUG(bja, 2015-04, pgi 14.7-?) occurs at: call this%InitCold(...) - ! PGF90-F-0000-Internal compiler error. normalize_forall_array: non-conformable - ! not sure why this fixes things.... - real(r8), allocatable :: workaround_for_pgi_internal_compiler_error(:) -# endif -#endif - - call this%InitAllocate(bounds) - - call this%InitHistory(bounds) - - call this%InitCold(bounds, & - h2osno_input_col, snow_depth_input_col, watsat_col, t_soisno_col) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - begg = bounds%begg; endg= bounds%endg - - allocate(this%snow_depth_col (begc:endc)) ; this%snow_depth_col (:) = nan - allocate(this%snow_persistence_col (begc:endc)) ; this%snow_persistence_col (:) = nan - allocate(this%snowdp_col (begc:endc)) ; this%snowdp_col (:) = nan - allocate(this%snowice_col (begc:endc)) ; this%snowice_col (:) = nan - allocate(this%snowliq_col (begc:endc)) ; this%snowliq_col (:) = nan - allocate(this%int_snow_col (begc:endc)) ; this%int_snow_col (:) = nan - allocate(this%snow_layer_unity_col (begc:endc,-nlevsno+1:0)) ; this%snow_layer_unity_col (:,:) = nan - allocate(this%bw_col (begc:endc,-nlevsno+1:0)) ; this%bw_col (:,:) = nan - allocate(this%h2osno_col (begc:endc)) ; this%h2osno_col (:) = nan - allocate(this%h2osno_old_col (begc:endc)) ; this%h2osno_old_col (:) = nan - allocate(this%h2osoi_liqice_10cm_col (begc:endc)) ; this%h2osoi_liqice_10cm_col (:) = nan - allocate(this%h2osoi_vol_col (begc:endc, 1:nlevgrnd)) ; this%h2osoi_vol_col (:,:) = nan - allocate(this%air_vol_col (begc:endc, 1:nlevgrnd)) ; this%air_vol_col (:,:) = nan - allocate(this%h2osoi_liqvol_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liqvol_col (:,:) = nan - allocate(this%h2osoi_ice_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_ice_col (:,:) = nan - allocate(this%h2osoi_liq_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%h2osoi_liq_col (:,:) = nan - allocate(this%h2osoi_ice_tot_col (begc:endc)) ; this%h2osoi_ice_tot_col (:) = nan - allocate(this%h2osoi_liq_tot_col (begc:endc)) ; this%h2osoi_liq_tot_col (:) = nan - allocate(this%h2ocan_patch (begp:endp)) ; this%h2ocan_patch (:) = nan - allocate(this%snocan_patch (begp:endp)) ; this%snocan_patch (:) = nan - allocate(this%liqcan_patch (begp:endp)) ; this%liqcan_patch (:) = nan - allocate(this%snounload_patch (begp:endp)) ; this%snounload_patch (:) = nan - allocate(this%h2osfc_col (begc:endc)) ; this%h2osfc_col (:) = nan - allocate(this%swe_old_col (begc:endc,-nlevsno+1:0)) ; this%swe_old_col (:,:) = nan - allocate(this%liq1_grc (begg:endg)) ; this%liq1_grc (:) = nan - allocate(this%liq2_grc (begg:endg)) ; this%liq2_grc (:) = nan - allocate(this%ice1_grc (begg:endg)) ; this%ice1_grc (:) = nan - allocate(this%ice2_grc (begg:endg)) ; this%ice2_grc (:) = nan - allocate(this%tws_grc (begg:endg)) ; this%tws_grc (:) = nan - - allocate(this%total_plant_stored_h2o_col(begc:endc)) ; this%total_plant_stored_h2o_col(:) = nan - - allocate(this%snw_rds_col (begc:endc,-nlevsno+1:0)) ; this%snw_rds_col (:,:) = nan - allocate(this%snw_rds_top_col (begc:endc)) ; this%snw_rds_top_col (:) = nan - allocate(this%h2osno_top_col (begc:endc)) ; this%h2osno_top_col (:) = nan - allocate(this%sno_liq_top_col (begc:endc)) ; this%sno_liq_top_col (:) = nan - - allocate(this%qg_snow_col (begc:endc)) ; this%qg_snow_col (:) = nan - allocate(this%qg_soil_col (begc:endc)) ; this%qg_soil_col (:) = nan - allocate(this%qg_h2osfc_col (begc:endc)) ; this%qg_h2osfc_col (:) = nan - allocate(this%qg_col (begc:endc)) ; this%qg_col (:) = nan - allocate(this%dqgdT_col (begc:endc)) ; this%dqgdT_col (:) = nan - allocate(this%qaf_lun (begl:endl)) ; this%qaf_lun (:) = nan - allocate(this%q_ref2m_patch (begp:endp)) ; this%q_ref2m_patch (:) = nan - allocate(this%rh_ref2m_patch (begp:endp)) ; this%rh_ref2m_patch (:) = nan - allocate(this%rh_ref2m_u_patch (begp:endp)) ; this%rh_ref2m_u_patch (:) = nan - allocate(this%rh_ref2m_r_patch (begp:endp)) ; this%rh_ref2m_r_patch (:) = nan - allocate(this%rh_af_patch (begp:endp)) ; this%rh_af_patch (:) = nan - allocate(this%rh10_af_patch (begp:endp)) ; this%rh10_af_patch (:) = spval - - allocate(this%frac_sno_col (begc:endc)) ; this%frac_sno_col (:) = nan - allocate(this%frac_sno_eff_col (begc:endc)) ; this%frac_sno_eff_col (:) = nan - allocate(this%frac_iceold_col (begc:endc,-nlevsno+1:nlevgrnd)) ; this%frac_iceold_col (:,:) = nan - allocate(this%frac_h2osfc_col (begc:endc)) ; this%frac_h2osfc_col (:) = nan - allocate(this%frac_h2osfc_nosnow_col (begc:endc)) ; this%frac_h2osfc_nosnow_col (:) = nan - allocate(this%wf_col (begc:endc)) ; this%wf_col (:) = nan - allocate(this%wf2_col (begc:endc)) ; - allocate(this%fwet_patch (begp:endp)) ; this%fwet_patch (:) = nan - allocate(this%fcansno_patch (begp:endp)) ; this%fcansno_patch (:) = nan - allocate(this%fdry_patch (begp:endp)) ; this%fdry_patch (:) = nan - - allocate(this%begwb_col (begc:endc)) ; this%begwb_col (:) = nan - allocate(this%endwb_col (begc:endc)) ; this%endwb_col (:) = nan - allocate(this%errh2o_patch (begp:endp)) ; this%errh2o_patch (:) = nan - allocate(this%errh2o_col (begc:endc)) ; this%errh2o_col (:) = nan - allocate(this%errh2osno_col (begc:endc)) ; this%errh2osno_col (:) = nan - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varctl , only : use_cn, use_lch4 - use clm_varctl , only : hist_wrtch4diag - use clm_varpar , only : nlevsno, nlevsoi - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal, no_snow_zero - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - ! h2osno also includes snow that is part of the soil column (an - ! initial snow layer is only created if h2osno > 10mm). - - data2dptr => this%h2osoi_liq_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_LIQH2O', units='kg/m2', type2d='levsno', & - avgflag='A', long_name='Snow liquid water content', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - data2dptr => this%h2osoi_ice_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_ICE', units='kg/m2', type2d='levsno', & - avgflag='A', long_name='Snow ice content', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - data2dptr => this%h2osoi_vol_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='H2OSOI', units='mm3/mm3', type2d='levsoi', & - avgflag='A', long_name='volumetric soil water (vegetated landunits only)', & - ptr_col=this%h2osoi_vol_col, l2g_scale_type='veg') - -! this%h2osoi_liq_col(begc:endc,:) = spval -! call hist_addfld2d (fname='SOILLIQ', units='kg/m2', type2d='levgrnd', & -! avgflag='A', long_name='soil liquid water (vegetated landunits only)', & -! ptr_col=this%h2osoi_liq_col, l2g_scale_type='veg') - - data2dptr => this%h2osoi_liq_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='SOILLIQ', units='kg/m2', type2d='levsoi', & - avgflag='A', long_name='soil liquid water (vegetated landunits only)', & - ptr_col=data2dptr, l2g_scale_type='veg') - - data2dptr => this%h2osoi_ice_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='SOILICE', units='kg/m2', type2d='levsoi', & - avgflag='A', long_name='soil ice (vegetated landunits only)', & - ptr_col=data2dptr, l2g_scale_type='veg') - - this%h2osoi_liqice_10cm_col(begc:endc) = spval - call hist_addfld1d (fname='SOILWATER_10CM', units='kg/m2', & - avgflag='A', long_name='soil liquid water + ice in top 10cm of soil (veg landunits only)', & - ptr_col=this%h2osoi_liqice_10cm_col, set_urb=spval, set_lake=spval, l2g_scale_type='veg') - - this%h2osoi_liq_tot_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOILLIQ', units='kg/m2', & - avgflag='A', long_name='vertically summed soil liquid water (veg landunits only)', & - ptr_col=this%h2osoi_liq_tot_col, set_urb=spval, set_lake=spval, l2g_scale_type='veg') - - this%h2osoi_ice_tot_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOILICE', units='kg/m2', & - avgflag='A', long_name='vertically summed soil cie (veg landunits only)', & - ptr_col=this%h2osoi_ice_tot_col, set_urb=spval, set_lake=spval, l2g_scale_type='veg') - - this%h2ocan_patch(begp:endp) = spval - call hist_addfld1d (fname='H2OCAN', units='mm', & - avgflag='A', long_name='intercepted water', & - ptr_patch=this%h2ocan_patch, set_lake=0._r8) - - this%snocan_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOCAN', units='mm', & - avgflag='A', long_name='intercepted snow', & - ptr_patch=this%snocan_patch, set_lake=0._r8) - - this%liqcan_patch(begp:endp) = spval - call hist_addfld1d (fname='LIQCAN', units='mm', & - avgflag='A', long_name='intercepted liquid water', & - ptr_patch=this%liqcan_patch, set_lake=0._r8) - - this%snounload_patch(begp:endp) = spval - call hist_addfld1d (fname='SNOUNLOAD', units='mm', & - avgflag='A', long_name='Canopy snow unloading', & - ptr_patch=this%snounload_patch, set_lake=0._r8) - - call hist_addfld1d (fname='H2OSNO', units='mm', & - avgflag='A', long_name='snow depth (liquid water)', & - ptr_col=this%h2osno_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='H2OSNO_ICE', units='mm', & - avgflag='A', long_name='snow depth (liquid water, ice landunits only)', & - ptr_col=this%h2osno_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%liq1_grc(begg:endg) = spval - call hist_addfld1d (fname='LIQUID_CONTENT1', units='mm', & - avgflag='A', long_name='initial gridcell total liq content', & - ptr_lnd=this%liq1_grc) - - this%liq2_grc(begg:endg) = spval - call hist_addfld1d (fname='LIQUID_CONTENT2', units='mm', & - avgflag='A', long_name='post landuse change gridcell total liq content', & - ptr_lnd=this%liq2_grc, default='inactive') - - this%ice1_grc(begg:endg) = spval - call hist_addfld1d (fname='ICE_CONTENT1', units='mm', & - avgflag='A', long_name='initial gridcell total ice content', & - ptr_lnd=this%ice1_grc) - - this%ice2_grc(begg:endg) = spval - call hist_addfld1d (fname='ICE_CONTENT2', units='mm', & - avgflag='A', long_name='post land cover change total ice content', & - ptr_lnd=this%ice2_grc, default='inactive') - - this%h2osfc_col(begc:endc) = spval - call hist_addfld1d (fname='H2OSFC', units='mm', & - avgflag='A', long_name='surface water depth', & - ptr_col=this%h2osfc_col) - - this%tws_grc(begg:endg) = spval - call hist_addfld1d (fname='TWS', units='mm', & - avgflag='A', long_name='total water storage', & - ptr_lnd=this%tws_grc) - - ! (rgk 02-02-2017) There is intentionally no entry here for stored plant water - ! I think that since the value is zero in all cases except - ! for FATES plant hydraulics, it will be confusing for users - ! when they see their plants have no water in output files. - ! So it is not useful diagnostic information. The information - ! can be provided through FATES specific history diagnostics - ! if need be. - - ! Humidity - - this%q_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='Q2M', units='kg/kg', & - avgflag='A', long_name='2m specific humidity', & - ptr_patch=this%q_ref2m_patch) - - this%rh_ref2m_patch(begp:endp) = spval - call hist_addfld1d (fname='RH2M', units='%', & - avgflag='A', long_name='2m relative humidity', & - ptr_patch=this%rh_ref2m_patch) - - this%rh_ref2m_r_patch(begp:endp) = spval - call hist_addfld1d (fname='RH2M_R', units='%', & - avgflag='A', long_name='Rural 2m specific humidity', & - ptr_patch=this%rh_ref2m_r_patch, set_spec=spval, default='inactive') - - this%rh_ref2m_u_patch(begp:endp) = spval - call hist_addfld1d (fname='RH2M_U', units='%', & - avgflag='A', long_name='Urban 2m relative humidity', & - ptr_patch=this%rh_ref2m_u_patch, set_nourb=spval, default='inactive') - - this%rh_af_patch(begp:endp) = spval - call hist_addfld1d (fname='RHAF', units='fraction', & - avgflag='A', long_name='fractional humidity of canopy air', & - ptr_patch=this%rh_af_patch, set_spec=spval, default='inactive') - - if(use_luna)then - call hist_addfld1d (fname='RHAF10', units='fraction', & - avgflag='A', long_name='10 day running mean of fractional humidity of canopy air', & - ptr_patch=this%rh10_af_patch, set_spec=spval, default='inactive') - endif - - ! Fractions - - this%frac_h2osfc_col(begc:endc) = spval - call hist_addfld1d (fname='FH2OSFC', units='unitless', & - avgflag='A', long_name='fraction of ground covered by surface water', & - ptr_col=this%frac_h2osfc_col) - - this%frac_h2osfc_nosnow_col(begc:endc) = spval - call hist_addfld1d (fname='FH2OSFC_NOSNOW', units='unitless', & - avgflag='A', & - long_name='fraction of ground covered by surface water (if no snow present)', & - ptr_col=this%frac_h2osfc_nosnow_col, default='inactive') - - this%frac_sno_col(begc:endc) = spval - call hist_addfld1d (fname='FSNO', units='unitless', & - avgflag='A', long_name='fraction of ground covered by snow', & - ptr_col=this%frac_sno_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSNO_ICE', units='unitless', & - avgflag='A', long_name='fraction of ground covered by snow (ice landunits only)', & - ptr_col=this%frac_sno_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%frac_sno_eff_col(begc:endc) = spval - call hist_addfld1d (fname='FSNO_EFF', units='unitless', & - avgflag='A', long_name='effective fraction of ground covered by snow', & - ptr_col=this%frac_sno_eff_col, c2l_scale_type='urbanf')!, default='inactive') - - if (use_cn) then - this%fwet_patch(begp:endp) = spval - call hist_addfld1d (fname='FWET', units='proportion', & - avgflag='A', long_name='fraction of canopy that is wet', & - ptr_patch=this%fwet_patch, default='inactive') - end if - - if (use_cn) then - this%fcansno_patch(begp:endp) = spval - call hist_addfld1d (fname='FCANSNO', units='proportion', & - avgflag='A', long_name='fraction of canopy that is wet', & - ptr_patch=this%fcansno_patch, default='inactive') - end if - - if (use_cn) then - this%fdry_patch(begp:endp) = spval - call hist_addfld1d (fname='FDRY', units='proportion', & - avgflag='A', long_name='fraction of foliage that is green and dry', & - ptr_patch=this%fdry_patch, default='inactive') - end if - - if (use_cn)then - this%frac_iceold_col(begc:endc,:) = spval - call hist_addfld2d (fname='FRAC_ICEOLD', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='fraction of ice relative to the tot water', & - ptr_col=this%frac_iceold_col, default='inactive') - end if - - ! Snow properties - these will be vertically averaged over the snow profile - - this%snow_depth_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_DEPTH', units='m', & - avgflag='A', long_name='snow height of snow covered area', & - ptr_col=this%snow_depth_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='SNOW_DEPTH_ICE', units='m', & - avgflag='A', long_name='snow height of snow covered area (ice landunits only)', & - ptr_col=this%snow_depth_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%snowdp_col(begc:endc) = spval - call hist_addfld1d (fname='SNOWDP', units='m', & - avgflag='A', long_name='gridcell mean snow height', & - ptr_col=this%snowdp_col, c2l_scale_type='urbanf') - - this%snowliq_col(begc:endc) = spval - call hist_addfld1d (fname='SNOWLIQ', units='kg/m2', & - avgflag='A', long_name='snow liquid water', & - ptr_col=this%snowliq_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='SNOWLIQ_ICE', units='kg/m2', & - avgflag='A', long_name='snow liquid water (ice landunits only)', & - ptr_col=this%snowliq_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%snowice_col(begc:endc) = spval - call hist_addfld1d (fname='SNOWICE', units='kg/m2', & - avgflag='A', long_name='snow ice', & - ptr_col=this%snowice_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='SNOWICE_ICE', units='kg/m2', & - avgflag='A', long_name='snow ice (ice landunits only)', & - ptr_col=this%snowice_col, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%int_snow_col(begc:endc) = spval - call hist_addfld1d (fname='INT_SNOW', units='mm', & - avgflag='A', long_name='accumulated swe (vegetated landunits only)', & - ptr_col=this%int_snow_col, l2g_scale_type='veg', & - default='inactive') - - call hist_addfld1d (fname='INT_SNOW_ICE', units='mm', & - avgflag='A', long_name='accumulated swe (ice landunits only)', & - ptr_col=this%int_snow_col, l2g_scale_type='ice', & - default='inactive') - - this%snow_persistence_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_PERSISTENCE', units='seconds', & - avgflag='I', long_name='Length of time of continuous snow cover (nat. veg. landunits only)', & - ptr_col=this%snow_persistence_col, l2g_scale_type='natveg') - - if (use_cn) then - this%wf_col(begc:endc) = spval - call hist_addfld1d (fname='WF', units='proportion', & - avgflag='A', long_name='soil water as frac. of whc for top 0.05 m', & - ptr_col=this%wf_col, default='inactive') - end if - - this%h2osno_top_col(begc:endc) = spval - call hist_addfld1d (fname='H2OSNO_TOP', units='kg/m2', & - avgflag='A', long_name='mass of snow in top snow layer', & - ptr_col=this%h2osno_top_col, set_urb=spval) - - this%snw_rds_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNORDSL', units='m^-6', & - avgflag='A', long_name='top snow layer effective grain radius', & - ptr_col=this%snw_rds_top_col, set_urb=spval, default='inactive') - - this%sno_liq_top_col(begc:endc) = spval - call hist_addfld1d (fname='SNOLIQFL', units='fraction', & - avgflag='A', long_name='top snow layer liquid water fraction (land)', & - ptr_col=this%sno_liq_top_col, set_urb=spval, default='inactive') - - ! We determine the fractional time (and fraction of the grid cell) over which each - ! snow layer existed by running the snow averaging routine on a field whose value is 1 - ! everywhere - data2dptr => this%snow_layer_unity_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_EXISTENCE', units='unitless', type2d='levsno', & - avgflag='A', long_name='Fraction of averaging period for which each snow layer existed', & - ptr_col=data2dptr, no_snow_behavior=no_snow_zero, default='inactive') - - this%bw_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%bw_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_BW', units='kg/m3', type2d='levsno', & - avgflag='A', long_name='Partial density of water in the snow pack (ice + liquid)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_BW_ICE', units='kg/m3', type2d='levsno', & - avgflag='A', long_name='Partial density of water in the snow pack (ice + liquid, ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%snw_rds_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%snw_rds_col(:,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_GS', units='Microns', type2d='levsno', & - avgflag='A', long_name='Mean snow grain size', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_GS_ICE', units='Microns', type2d='levsno', & - avgflag='A', long_name='Mean snow grain size (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%errh2o_col(begc:endc) = spval - call hist_addfld1d (fname='ERRH2O', units='mm', & - avgflag='A', long_name='total water conservation error', & - ptr_col=this%errh2o_col) - - this%errh2osno_col(begc:endc) = spval - call hist_addfld1d (fname='ERRH2OSNO', units='mm', & - avgflag='A', long_name='imbalance in snow depth (liquid water)', & - ptr_col=this%errh2osno_col, c2l_scale_type='urbanf') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - h2osno_input_col, snow_depth_input_col, watsat_col, t_soisno_col) - ! - ! !DESCRIPTION: - ! Initialize time constant variables and cold start conditions - ! - ! !USES: - use shr_const_mod , only : shr_const_pi - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_spfn_mod , only : shr_spfn_erf - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb - use landunit_varcon , only : istwet, istsoil, istdlak, istcrop, istice_mec - use column_varcon , only : icol_shadewall, icol_road_perv - use column_varcon , only : icol_road_imperv, icol_roof, icol_sunwall - use clm_varcon , only : denice, denh2o, spval, sb, bdsno - use clm_varcon , only : zlnd, tfrz, spval, pc - use clm_varctl , only : fsurdat, iulog - use clm_varctl , only : use_bedrock - use spmdMod , only : masterproc - use abortutils , only : endrun - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_io - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: h2osno_input_col(bounds%begc:) - real(r8) , intent(in) :: snow_depth_input_col(bounds%begc:) - real(r8) , intent(in) :: watsat_col(bounds%begc:, 1:) ! volumetric soil water at saturation (porosity) - real(r8) , intent(in) :: t_soisno_col(bounds%begc:, -nlevsno+1:) ! col soil temperature (Kelvin) - ! - ! !LOCAL VARIABLES: - integer :: p,c,j,l,g,lev,nlevs - real(r8) :: maxslope, slopemax, minslope - real(r8) :: d, fd, dfdd, slope0,slopebeta - real(r8) ,pointer :: std (:) - logical :: readvar - type(file_desc_t) :: ncid - character(len=256) :: locfn - real(r8) :: snowbd ! temporary calculation of snow bulk density (kg/m3) - real(r8) :: fmelt ! snowbd/100 - integer :: nbedrock - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(h2osno_input_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(snow_depth_input_col) == (/bounds%endc/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(t_soisno_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - - ! The first three arrays are initialized from the input argument - do c = bounds%begc,bounds%endc - this%h2osno_col(c) = h2osno_input_col(c) - this%int_snow_col(c) = h2osno_input_col(c) - this%snow_depth_col(c) = snow_depth_input_col(c) - this%snow_persistence_col(c) = 0._r8 - this%snow_layer_unity_col(c,:) = 1._r8 - end do - - do c = bounds%begc,bounds%endc - this%wf_col(c) = spval - this%wf2_col(c) = spval - end do - - do l = bounds%begl, bounds%endl - if (lun%urbpoi(l)) then - if (use_vancouver) then - this%qaf_lun(l) = 0.0111_r8 - else if (use_mexicocity) then - this%qaf_lun(l) = 0.00248_r8 - else - this%qaf_lun(l) = 1.e-4_r8 ! Arbitrary set since forc_q is not yet available - end if - end if - end do - - ! Water Stored in plants is almost always a static entity, with the exception - ! of when FATES-hydraulics is used. As such, this is trivially set to 0.0 (rgk 03-2017) - this%total_plant_stored_h2o_col(bounds%begc:bounds%endc) = 0.0_r8 - - - associate(snl => col%snl) - - this%h2osfc_col(bounds%begc:bounds%endc) = 0._r8 - this%h2ocan_patch(bounds%begp:bounds%endp) = 0._r8 - this%snocan_patch(bounds%begp:bounds%endp) = 0._r8 - this%liqcan_patch(bounds%begp:bounds%endp) = 0._r8 - this%snounload_patch(bounds%begp:bounds%endp) = 0._r8 - this%frac_h2osfc_col(bounds%begc:bounds%endc) = 0._r8 - - this%fwet_patch(bounds%begp:bounds%endp) = 0._r8 - this%fdry_patch(bounds%begp:bounds%endp) = 0._r8 - this%fcansno_patch(bounds%begp:bounds%endp) = 0._r8 - !-------------------------------------------- - ! Set snow water - !-------------------------------------------- - - ! Note: Glacier_mec columns are initialized with half the maximum snow cover. - ! This gives more realistic values of qflx_glcice sooner in the simulation - ! for columns with net ablation, at the cost of delaying ice formation - ! in columns with net accumulation. - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - ! From Bonan 1996 (LSM technical note) - this%frac_sno_col(c) = min( this%snow_depth_col(c)/0.05_r8, 1._r8) - else - this%frac_sno_col(c) = 0._r8 - ! snow cover fraction as in Niu and Yang 2007 - if(this%snow_depth_col(c) > 0.0) then - snowbd = min(400._r8, this%h2osno_col(c)/this%snow_depth_col(c)) !bulk density of snow (kg/m3) - fmelt = (snowbd/100.)**1. - ! 100 is the assumed fresh snow density; 1 is a melting factor that could be - ! reconsidered, optimal value of 1.5 in Niu et al., 2007 - this%frac_sno_col(c) = tanh( this%snow_depth_col(c) /(2.5 * zlnd * fmelt) ) - endif - end if - end do - - do c = bounds%begc,bounds%endc - if (snl(c) < 0) then - this%snw_rds_col(c,snl(c)+1:0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:snl(c)) = 0._r8 - this%snw_rds_top_col(c) = snw_rds_min - elseif (this%h2osno_col(c) > 0._r8) then - this%snw_rds_col(c,0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:-1) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - else - this%snw_rds_col(c,:) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - endif - end do - - !-------------------------------------------- - ! Set soil water - !-------------------------------------------- - - ! volumetric water is set first and liquid content and ice lens are obtained - ! NOTE: h2osoi_vol, h2osoi_liq and h2osoi_ice only have valid values over soil - ! and urban pervious road (other urban columns have zero soil water) - - this%h2osoi_vol_col(bounds%begc:bounds%endc, 1:) = spval - this%h2osoi_liq_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval - this%h2osoi_ice_col(bounds%begc:bounds%endc,-nlevsno+1:) = spval - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (.not. lun%lakpoi(l)) then !not lake - - ! volumetric water - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - nlevs = nlevgrnd - do j = 1, nlevs - if (use_bedrock) then - nbedrock = col%nbedrock(c) - else - nbedrock = nlevsoi - endif - if (j > nbedrock) then - this%h2osoi_vol_col(c,j) = 0.0_r8 - else - this%h2osoi_vol_col(c,j) = 0.15_r8 - endif - end do - else if (lun%urbpoi(l)) then - if (col%itype(c) == icol_road_perv) then - nlevs = nlevgrnd - do j = 1, nlevs - if (j <= nlevsoi) then - this%h2osoi_vol_col(c,j) = 0.3_r8 - else - this%h2osoi_vol_col(c,j) = 0.0_r8 - end if - end do - else if (col%itype(c) == icol_road_imperv) then - nlevs = nlevgrnd - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = 0.0_r8 - end do - else - nlevs = nlevurb - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = 0.0_r8 - end do - end if - else if (lun%itype(l) == istwet) then - nlevs = nlevgrnd - do j = 1, nlevs - if (j > nlevsoi) then - this%h2osoi_vol_col(c,j) = 0.0_r8 - else - this%h2osoi_vol_col(c,j) = 1.0_r8 - endif - end do - else if (lun%itype(l) == istice_mec) then - nlevs = nlevgrnd - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = 1.0_r8 - end do - endif - do j = 1, nlevs - this%h2osoi_vol_col(c,j) = min(this%h2osoi_vol_col(c,j), watsat_col(c,j)) - if (t_soisno_col(c,j) <= SHR_CONST_TKFRZ) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*denice*this%h2osoi_vol_col(c,j) - this%h2osoi_liq_col(c,j) = 0._r8 - else - this%h2osoi_ice_col(c,j) = 0._r8 - this%h2osoi_liq_col(c,j) = col%dz(c,j)*denh2o*this%h2osoi_vol_col(c,j) - endif - end do - do j = -nlevsno+1, 0 - if (j > snl(c)) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*250._r8 - this%h2osoi_liq_col(c,j) = 0._r8 - end if - end do - end if - end do - - - !-------------------------------------------- - ! Set Lake water - !-------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%lakpoi(l)) then - do j = -nlevsno+1, 0 - if (j > snl(c)) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*bdsno - this%h2osoi_liq_col(c,j) = 0._r8 - end if - end do - do j = 1,nlevgrnd - if (j <= nlevsoi) then ! soil - this%h2osoi_vol_col(c,j) = watsat_col(c,j) - this%h2osoi_liq_col(c,j) = spval - this%h2osoi_ice_col(c,j) = spval - else ! bedrock - this%h2osoi_vol_col(c,j) = 0._r8 - end if - end do - end if - end do - - !-------------------------------------------- - ! For frozen layers !TODO - does the following make sense ???? it seems to overwrite everything - !-------------------------------------------- - - do c = bounds%begc, bounds%endc - do j = 1,nlevgrnd - if (this%h2osoi_vol_col(c,j) /= spval) then - if (t_soisno_col(c,j) <= tfrz) then - this%h2osoi_ice_col(c,j) = col%dz(c,j)*denice*this%h2osoi_vol_col(c,j) - this%h2osoi_liq_col(c,j) = 0._r8 - else - this%h2osoi_ice_col(c,j) = 0._r8 - this%h2osoi_liq_col(c,j) = col%dz(c,j)*denh2o*this%h2osoi_vol_col(c,j) - endif - end if - end do - end do - - end associate - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag, & - watsat_col) - ! - ! !DESCRIPTION: - ! Read/Write module information to/from restart file. - ! - ! !USES: - use spmdMod , only : masterproc - use clm_varcon , only : denice, denh2o, pondmx, watmin, spval, nameg - use landunit_varcon , only : istcrop, istdlak, istsoil - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use clm_time_manager , only : is_first_step - use clm_varctl , only : bound_h2osoi - use ncdio_pio , only : file_desc_t, ncd_io, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - real(r8) , intent(in) :: watsat_col (bounds%begc:, 1:) ! volumetric soil water at saturation (porosity) - ! - ! !LOCAL VARIABLES: - integer :: c,l,j,nlevs - logical :: readvar - real(r8) :: maxwatsat ! maximum porosity - real(r8) :: excess ! excess volumetric soil water - real(r8) :: totwat ! total soil water (mm) - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc,nlevgrnd/)) , errMsg(sourcefile, __LINE__)) - - call restartvar(ncid=ncid, flag=flag, varname='INT_SNOW', xtype=ncd_double, & - dim1name='column', & - long_name='accuumulated snow', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%int_snow_col) - if (flag=='read' .and. .not. readvar) then - this%int_snow_col(:) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='H2OSFC', xtype=ncd_double, & - dim1name='column', & - long_name='surface water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osfc_col) - if (flag=='read' .and. .not. readvar) then - this%h2osfc_col(bounds%begc:bounds%endc) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='H2OSNO', xtype=ncd_double, & - dim1name='column', & - long_name='snow water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osno_col) - - call restartvar(ncid=ncid, flag=flag, varname='H2OSOI_LIQ', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='liquid water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osoi_liq_col) - - call restartvar(ncid=ncid, flag=flag, varname='H2OSOI_ICE', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='ice lens', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2osoi_ice_col) - - call restartvar(ncid=ncid, flag=flag, varname='H2OCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%h2ocan_patch) - - call restartvar(ncid=ncid, flag=flag, varname='SNOCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy snow water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%snocan_patch) - - ! NOTE(wjs, 2015-07-01) In old restart files, there was no LIQCAN variable. However, - ! H2OCAN had similar meaning. So if we can't find LIQCAN, use H2OCAN to initialize - ! liqcan_patch. - call restartvar(ncid=ncid, flag=flag, varname='LIQCAN:H2OCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy liquid water', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%liqcan_patch) - - call restartvar(ncid=ncid, flag=flag, varname='SNOUNLOAD', xtype=ncd_double, & - dim1name='pft', & - long_name='Canopy snow unloading', units='kg/m2', & - interpinic_flag='interp', readvar=readvar, data=this%snounload_patch) - - ! TWS is needed when methane is on and the TWS_inversion is used to get exact - ! restart. - call restartvar(ncid=ncid, flag=flag, varname='TWS', xtype=ncd_double, & - dim1name=nameg, & - long_name='Total Water Storage', units='mm', & - interpinic_flag='interp', readvar=readvar, data=this%tws_grc) - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='rh10', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean boundary layer relatie humidity', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%rh10_af_patch) - endif - - ! Determine volumetric soil water (for read only) - if (flag == 'read' ) then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if ( col%itype(c) == icol_sunwall .or. & - col%itype(c) == icol_shadewall .or. & - col%itype(c) == icol_roof )then - nlevs = nlevurb - else - nlevs = nlevgrnd - end if - if ( lun%itype(l) /= istdlak ) then ! This calculation is now done for lakes in initLake. - do j = 1,nlevs - this%h2osoi_vol_col(c,j) = this%h2osoi_liq_col(c,j)/(col%dz(c,j)*denh2o) & - + this%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice) - end do - end if - end do - end if - - ! If initial run -- ensure that water is properly bounded (read only) - if (flag == 'read' ) then - if ( is_first_step() .and. bound_h2osoi) then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if ( col%itype(c) == icol_sunwall .or. col%itype(c) == icol_shadewall .or. & - col%itype(c) == icol_roof )then - nlevs = nlevurb - else - nlevs = nlevgrnd - end if - do j = 1,nlevs - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%h2osoi_liq_col(c,j) = max(0._r8,this%h2osoi_liq_col(c,j)) - this%h2osoi_ice_col(c,j) = max(0._r8,this%h2osoi_ice_col(c,j)) - this%h2osoi_vol_col(c,j) = this%h2osoi_liq_col(c,j)/(col%dz(c,j)*denh2o) & - + this%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice) - if (j == 1) then - maxwatsat = (watsat_col(c,j)*col%dz(c,j)*1000.0_r8 + pondmx) / (col%dz(c,j)*1000.0_r8) - else - maxwatsat = watsat_col(c,j) - end if - if (this%h2osoi_vol_col(c,j) > maxwatsat) then - excess = (this%h2osoi_vol_col(c,j) - maxwatsat)*col%dz(c,j)*1000.0_r8 - totwat = this%h2osoi_liq_col(c,j) + this%h2osoi_ice_col(c,j) - this%h2osoi_liq_col(c,j) = this%h2osoi_liq_col(c,j) - & - (this%h2osoi_liq_col(c,j)/totwat) * excess - this%h2osoi_ice_col(c,j) = this%h2osoi_ice_col(c,j) - & - (this%h2osoi_ice_col(c,j)/totwat) * excess - end if - this%h2osoi_liq_col(c,j) = max(watmin,this%h2osoi_liq_col(c,j)) - this%h2osoi_ice_col(c,j) = max(watmin,this%h2osoi_ice_col(c,j)) - this%h2osoi_vol_col(c,j) = this%h2osoi_liq_col(c,j)/(col%dz(c,j)*denh2o) & - + this%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice) - end if - end do - end do - end if - - endif ! end if if-read flag - - call restartvar(ncid=ncid, flag=flag, varname='FH2OSFC', xtype=ncd_double, & - dim1name='column',& - long_name='fraction of ground covered by h2osfc (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%frac_h2osfc_col) - if (flag == 'read' .and. .not. readvar) then - this%frac_h2osfc_col(bounds%begc:bounds%endc) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='SNOW_DEPTH', xtype=ncd_double, & - dim1name='column', & - long_name='snow depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=this%snow_depth_col) - - call restartvar(ncid=ncid, flag=flag, varname='SNOW_PERS', xtype=ncd_double, & - dim1name='column', & - long_name='continuous snow cover time', units='sec', & - interpinic_flag='interp', readvar=readvar, data=this%snow_persistence_col) - if (flag=='read' .and. .not. readvar) then - this%snow_persistence_col(:) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='frac_sno_eff', xtype=ncd_double, & - dim1name='column', & - long_name='fraction of ground covered by snow (0 to 1)',units='unitless', & - interpinic_flag='interp', readvar=readvar, data=this%frac_sno_eff_col) - if (flag == 'read' .and. .not. readvar) then - this%frac_sno_eff_col(bounds%begc:bounds%endc) = 0.0_r8 - end if - - call restartvar(ncid=ncid, flag=flag, varname='frac_sno', xtype=ncd_double, & - dim1name='column', & - long_name='fraction of ground covered by snow (0 to 1)',units='unitless',& - interpinic_flag='interp', readvar=readvar, data=this%frac_sno_col) - - call restartvar(ncid=ncid, flag=flag, varname='FWET', xtype=ncd_double, & - dim1name='pft', & - long_name='fraction of canopy that is wet (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fwet_patch) - - call restartvar(ncid=ncid, flag=flag, varname='FCANSNO', xtype=ncd_double, & - dim1name='pft', & - long_name='fraction of canopy that is snow covered (0 to 1)', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fcansno_patch) - - ! column type physical state variable - snw_rds - call restartvar(ncid=ncid, flag=flag, varname='snw_rds', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer effective radius', units='um', & - interpinic_flag='interp', readvar=readvar, data=this%snw_rds_col) - if (flag == 'read' .and. .not. readvar) then - - ! initial run, not restart: initialize snw_rds - if (masterproc) then - write(iulog,*) "SNICAR: This is an initial run (not a restart), and grain size/aerosol " // & - "mass data are not defined in initial condition file. Initialize snow " // & - "effective radius to fresh snow value, and snow/aerosol masses to zero." - endif - - do c= bounds%begc, bounds%endc - if (col%snl(c) < 0) then - this%snw_rds_col(c,col%snl(c)+1:0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:col%snl(c)) = 0._r8 - this%snw_rds_top_col(c) = snw_rds_min - this%sno_liq_top_col(c) = this%h2osoi_liq_col(c,col%snl(c)+1) / & - (this%h2osoi_liq_col(c,col%snl(c)+1)+this%h2osoi_ice_col(c,col%snl(c)+1)) - elseif (this%h2osno_col(c) > 0._r8) then - this%snw_rds_col(c,0) = snw_rds_min - this%snw_rds_col(c,-nlevsno+1:-1) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - else - this%snw_rds_col(c,:) = 0._r8 - this%snw_rds_top_col(c) = spval - this%sno_liq_top_col(c) = spval - endif - enddo - endif - - call restartvar(ncid=ncid, flag=flag, varname='qaf', xtype=ncd_double, dim1name='landunit', & - long_name='urban canopy specific humidity', units='kg/kg', & - interpinic_flag='interp', readvar=readvar, data=this%qaf_lun) - - if (use_cn) then - call restartvar(ncid=ncid, flag=flag, varname='wf', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%wf_col) - end if - - - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine Reset(this, column) - ! - ! !DESCRIPTION: - ! Intitialize SNICAR variables for fresh snow column - ! - ! !ARGUMENTS: - class(waterstate_type) :: this - integer , intent(in) :: column ! column index - !----------------------------------------------------------------------- - - this%snw_rds_col(column,0) = snw_rds_min - - end subroutine Reset - -end module WaterstateType diff --git a/src/biogeophys/WaterfluxType.F90 b/src/biogeophys/WaterfluxType.F90 deleted file mode 100644 index 905fe9471f..0000000000 --- a/src/biogeophys/WaterfluxType.F90 +++ /dev/null @@ -1,736 +0,0 @@ -module WaterfluxType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevsoi - use clm_varcon , only : spval - use decompMod , only : bounds_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use CNSharedParamsMod , only : use_fun - use AnnualFluxDribbler, only : annual_flux_dribbler_type, annual_flux_dribbler_gridcell - ! - implicit none - private - ! - ! !PUBLIC TYPES: - type, public :: waterflux_type - - ! water fluxes are in units or mm/s - - real(r8), pointer :: qflx_prec_grnd_patch (:) ! patch water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_prec_grnd_col (:) ! col water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_rain_grnd_patch (:) ! patch rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_rain_grnd_col (:) ! col rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_patch (:) ! patch snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_col (:) ! col snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_sub_snow_patch (:) ! patch sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_sub_snow_col (:) ! col sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_evap_soi_patch (:) ! patch soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_soi_col (:) ! col soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_veg_patch (:) ! patch vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_veg_col (:) ! col vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_can_patch (:) ! patch evaporation from leaves and stems (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_can_col (:) ! col evaporation from leaves and stems (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot_patch (:) ! patch pft_qflx_evap_soi + pft_qflx_evap_veg + qflx_tran_veg - real(r8), pointer :: qflx_evap_tot_col (:) ! col col_qflx_evap_soi + col_qflx_evap_veg + qflx_tran_veg - real(r8), pointer :: qflx_evap_grnd_patch (:) ! patch ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_evap_grnd_col (:) ! col ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_phs_neg_col (:) ! col sum of negative hydraulic redistribution fluxes (mm H2O/s) [+] - - ! In the snow capping parametrization excess mass above h2osno_max is removed. A breakdown of mass into liquid - ! and solid fluxes is done, these are represented by qflx_snwcp_liq_col and qflx_snwcp_ice_col. - real(r8), pointer :: qflx_snwcp_liq_col (:) ! col excess liquid h2o due to snow capping (outgoing) (mm H2O /s) - real(r8), pointer :: qflx_snwcp_ice_col (:) ! col excess solid h2o due to snow capping (outgoing) (mm H2O /s) - real(r8), pointer :: qflx_snwcp_discarded_liq_col(:) ! col excess liquid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) - real(r8), pointer :: qflx_snwcp_discarded_ice_col(:) ! col excess solid h2o due to snow capping, which we simply discard in order to reset the snow pack (mm H2O /s) - - real(r8), pointer :: qflx_tran_veg_patch (:) ! patch vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg_col (:) ! col vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_dew_snow_patch (:) ! patch surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow_col (:) ! col surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd_patch (:) ! patch ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd_col (:) ! col ground surface dew formation (mm H2O /s) [+] (+ = to atm); usually eflx_bot >= 0) - real(r8), pointer :: qflx_prec_intr_patch (:) ! patch interception of precipitation [mm/s] - real(r8), pointer :: qflx_prec_intr_col (:) ! col interception of precipitation [mm/s] - real(r8), pointer :: qflx_snowindunload_patch (:) ! patch canopy snow wind unloading (mm H2O /s) - real(r8), pointer :: qflx_snowindunload_col (:) ! col canopy snow wind unloading (mm H2O /s) - real(r8), pointer :: qflx_snotempunload_patch (:) ! patch canopy snow temp unloading (mm H2O /s) - real(r8), pointer :: qflx_snotempunload_col (:) ! col canopy snow temp unloading (mm H2O /s) - - real(r8), pointer :: qflx_ev_snow_patch (:) ! patch evaporation heat flux from snow (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_snow_col (:) ! col evaporation heat flux from snow (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_soil_patch (:) ! patch evaporation heat flux from soil (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_soil_col (:) ! col evaporation heat flux from soil (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_h2osfc_patch (:) ! patch evaporation heat flux from soil (mm H2O/s) [+ to atm] - real(r8), pointer :: qflx_ev_h2osfc_col (:) ! col evaporation heat flux from soil (mm H2O/s) [+ to atm] - - real(r8), pointer :: qflx_adv_col (:,:) ! col advective flux across different soil layer interfaces [mm H2O/s] [+ downward] - real(r8), pointer :: qflx_rootsoi_col (:,:) ! col root and soil water exchange [mm H2O/s] [+ into root] - real(r8), pointer :: qflx_infl_col (:) ! col infiltration (mm H2O /s) - real(r8), pointer :: qflx_surf_col (:) ! col surface runoff (mm H2O /s) - real(r8), pointer :: qflx_drain_col (:) ! col sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_top_soil_col (:) ! col net water input into soil from top (mm/s) - real(r8), pointer :: qflx_h2osfc_to_ice_col (:) ! col conversion of h2osfc to ice - real(r8), pointer :: qflx_h2osfc_surf_col (:) ! col surface water runoff - real(r8), pointer :: qflx_snow_h2osfc_col (:) ! col snow falling on surface water - real(r8), pointer :: qflx_drain_perched_col (:) ! col sub-surface runoff from perched wt (mm H2O /s) - real(r8), pointer :: qflx_deficit_col (:) ! col water deficit to keep non-negative liquid water content (mm H2O) - real(r8), pointer :: qflx_floodc_col (:) ! col flood water flux at column level - real(r8), pointer :: qflx_sl_top_soil_col (:) ! col liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - real(r8), pointer :: qflx_snomelt_col (:) ! col snow melt (mm H2O /s) - real(r8), pointer :: qflx_snomelt_lyr_col (:,:) ! col snow melt in each layer (mm H2O /s) - real(r8), pointer :: qflx_snow_drain_col (:) ! col drainage from snow pack - real(r8), pointer :: qflx_qrgwl_col (:) ! col qflx_surf at glaciers, wetlands, lakes - real(r8), pointer :: qflx_runoff_col (:) ! col total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_runoff_r_col (:) ! col Rural total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_runoff_u_col (:) ! col urban total runoff (qflx_drain+qflx_surf) (mm H2O /s) - real(r8), pointer :: qflx_ice_runoff_snwcp_col(:) ! col solid runoff from snow capping (mm H2O /s) - real(r8), pointer :: qflx_ice_runoff_xs_col (:) ! col solid runoff from excess ice in soil (mm H2O /s) - real(r8), pointer :: qflx_rsub_sat_col (:) ! col soil saturation excess [mm/s] - real(r8), pointer :: qflx_snofrz_lyr_col (:,:) ! col snow freezing rate (positive definite) (col,lyr) [kg m-2 s-1] - real(r8), pointer :: qflx_snofrz_col (:) ! col column-integrated snow freezing rate (positive definite) (col) [kg m-2 s-1] - real(r8), pointer :: qflx_drain_vr_col (:,:) ! col liquid water losted as drainage (m /time step) - real(r8), pointer :: snow_sources_col (:) ! col snow sources (mm H2O/s) - real(r8), pointer :: snow_sinks_col (:) ! col snow sinks (mm H2O/s) - - ! Dynamic land cover change - real(r8), pointer :: qflx_liq_dynbal_grc (:) ! grc liq dynamic land cover change conversion runoff flux - real(r8), pointer :: qflx_ice_dynbal_grc (:) ! grc ice dynamic land cover change conversion runoff flux - - ! Objects that help convert once-per-year dynamic land cover changes into fluxes - ! that are dribbled throughout the year - type(annual_flux_dribbler_type) :: qflx_liq_dynbal_dribbler - type(annual_flux_dribbler_type) :: qflx_ice_dynbal_dribbler - - ! ET accumulation - real(r8), pointer :: AnnEt (:) ! Annual average ET flux mmH20/s - - - contains - - - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - - end type waterflux_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) ! same as "call initAllocate_type(hydro, bounds)" - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - allocate(this%qflx_prec_intr_patch (begp:endp)) ; this%qflx_prec_intr_patch (:) = nan - allocate(this%qflx_prec_grnd_patch (begp:endp)) ; this%qflx_prec_grnd_patch (:) = nan - allocate(this%qflx_rain_grnd_patch (begp:endp)) ; this%qflx_rain_grnd_patch (:) = nan - allocate(this%qflx_snow_grnd_patch (begp:endp)) ; this%qflx_snow_grnd_patch (:) = nan - allocate(this%qflx_sub_snow_patch (begp:endp)) ; this%qflx_sub_snow_patch (:) = 0.0_r8 - allocate(this%qflx_tran_veg_patch (begp:endp)) ; this%qflx_tran_veg_patch (:) = nan - - allocate(this%qflx_snowindunload_patch (begp:endp)) ; this%qflx_snowindunload_patch (:) = nan - allocate(this%qflx_snowindunload_col (begp:endp)) ; this%qflx_snowindunload_col (:) = nan - allocate(this%qflx_snotempunload_patch (begp:endp)) ; this%qflx_snotempunload_patch (:) = nan - allocate(this%qflx_snotempunload_col (begp:endp)) ; this%qflx_snotempunload_col (:) = nan - - allocate(this%qflx_dew_grnd_patch (begp:endp)) ; this%qflx_dew_grnd_patch (:) = nan - allocate(this%qflx_dew_snow_patch (begp:endp)) ; this%qflx_dew_snow_patch (:) = nan - - allocate(this%qflx_prec_intr_col (begc:endc)) ; this%qflx_prec_intr_col (:) = nan - allocate(this%qflx_prec_grnd_col (begc:endc)) ; this%qflx_prec_grnd_col (:) = nan - allocate(this%qflx_rain_grnd_col (begc:endc)) ; this%qflx_rain_grnd_col (:) = nan - allocate(this%qflx_snow_grnd_col (begc:endc)) ; this%qflx_snow_grnd_col (:) = nan - allocate(this%qflx_sub_snow_col (begc:endc)) ; this%qflx_sub_snow_col (:) = 0.0_r8 - allocate(this%qflx_snwcp_liq_col (begc:endc)) ; this%qflx_snwcp_liq_col (:) = nan - allocate(this%qflx_snwcp_ice_col (begc:endc)) ; this%qflx_snwcp_ice_col (:) = nan - allocate(this%qflx_snwcp_discarded_liq_col(begc:endc)) ; this%qflx_snwcp_discarded_liq_col(:) = nan - allocate(this%qflx_snwcp_discarded_ice_col(begc:endc)) ; this%qflx_snwcp_discarded_ice_col(:) = nan - allocate(this%qflx_tran_veg_col (begc:endc)) ; this%qflx_tran_veg_col (:) = nan - allocate(this%qflx_evap_veg_col (begc:endc)) ; this%qflx_evap_veg_col (:) = nan - allocate(this%qflx_evap_can_col (begc:endc)) ; this%qflx_evap_can_col (:) = nan - allocate(this%qflx_evap_soi_col (begc:endc)) ; this%qflx_evap_soi_col (:) = nan - allocate(this%qflx_evap_tot_col (begc:endc)) ; this%qflx_evap_tot_col (:) = nan - allocate(this%qflx_evap_grnd_col (begc:endc)) ; this%qflx_evap_grnd_col (:) = nan - allocate(this%qflx_dew_grnd_col (begc:endc)) ; this%qflx_dew_grnd_col (:) = nan - allocate(this%qflx_dew_snow_col (begc:endc)) ; this%qflx_dew_snow_col (:) = nan - allocate(this%qflx_evap_veg_patch (begp:endp)) ; this%qflx_evap_veg_patch (:) = nan - allocate(this%qflx_evap_can_patch (begp:endp)) ; this%qflx_evap_can_patch (:) = nan - allocate(this%qflx_evap_soi_patch (begp:endp)) ; this%qflx_evap_soi_patch (:) = nan - allocate(this%qflx_evap_tot_patch (begp:endp)) ; this%qflx_evap_tot_patch (:) = nan - allocate(this%qflx_evap_grnd_patch (begp:endp)) ; this%qflx_evap_grnd_patch (:) = nan - allocate(this%qflx_phs_neg_col (begc:endc)) ; this%qflx_phs_neg_col (:) = nan - - allocate( this%qflx_ev_snow_patch (begp:endp)) ; this%qflx_ev_snow_patch (:) = nan - allocate( this%qflx_ev_snow_col (begc:endc)) ; this%qflx_ev_snow_col (:) = nan - allocate( this%qflx_ev_soil_patch (begp:endp)) ; this%qflx_ev_soil_patch (:) = nan - allocate( this%qflx_ev_soil_col (begc:endc)) ; this%qflx_ev_soil_col (:) = nan - allocate( this%qflx_ev_h2osfc_patch (begp:endp)) ; this%qflx_ev_h2osfc_patch (:) = nan - allocate( this%qflx_ev_h2osfc_col (begc:endc)) ; this%qflx_ev_h2osfc_col (:) = nan - - allocate(this%qflx_drain_vr_col (begc:endc,1:nlevsoi)) ; this%qflx_drain_vr_col (:,:) = nan - allocate(this%qflx_adv_col (begc:endc,0:nlevsoi)) ; this%qflx_adv_col (:,:) = nan - allocate(this%qflx_rootsoi_col (begc:endc,1:nlevsoi)) ; this%qflx_rootsoi_col (:,:) = nan - allocate(this%qflx_infl_col (begc:endc)) ; this%qflx_infl_col (:) = nan - allocate(this%qflx_surf_col (begc:endc)) ; this%qflx_surf_col (:) = nan - allocate(this%qflx_drain_col (begc:endc)) ; this%qflx_drain_col (:) = nan - allocate(this%qflx_top_soil_col (begc:endc)) ; this%qflx_top_soil_col (:) = nan - allocate(this%qflx_h2osfc_to_ice_col (begc:endc)) ; this%qflx_h2osfc_to_ice_col (:) = nan - allocate(this%qflx_h2osfc_surf_col (begc:endc)) ; this%qflx_h2osfc_surf_col (:) = nan - allocate(this%qflx_snow_h2osfc_col (begc:endc)) ; this%qflx_snow_h2osfc_col (:) = nan - allocate(this%qflx_snomelt_col (begc:endc)) ; this%qflx_snomelt_col (:) = nan - allocate(this%qflx_snomelt_lyr_col (begc:endc,-nlevsno+1:0)) ; this%qflx_snomelt_lyr_col (:,:) = nan - allocate(this%qflx_snow_drain_col (begc:endc)) ; this%qflx_snow_drain_col (:) = nan - allocate(this%qflx_snofrz_col (begc:endc)) ; this%qflx_snofrz_col (:) = nan - allocate(this%qflx_snofrz_lyr_col (begc:endc,-nlevsno+1:0)) ; this%qflx_snofrz_lyr_col (:,:) = nan - allocate(this%qflx_qrgwl_col (begc:endc)) ; this%qflx_qrgwl_col (:) = nan - allocate(this%qflx_drain_perched_col (begc:endc)) ; this%qflx_drain_perched_col (:) = nan - allocate(this%qflx_deficit_col (begc:endc)) ; this%qflx_deficit_col (:) = nan - allocate(this%qflx_floodc_col (begc:endc)) ; this%qflx_floodc_col (:) = nan - allocate(this%qflx_sl_top_soil_col (begc:endc)) ; this%qflx_sl_top_soil_col (:) = nan - allocate(this%qflx_runoff_col (begc:endc)) ; this%qflx_runoff_col (:) = nan - allocate(this%qflx_runoff_r_col (begc:endc)) ; this%qflx_runoff_r_col (:) = nan - allocate(this%qflx_runoff_u_col (begc:endc)) ; this%qflx_runoff_u_col (:) = nan - allocate(this%qflx_ice_runoff_snwcp_col(begc:endc)) ; this%qflx_ice_runoff_snwcp_col(:) = nan - allocate(this%qflx_ice_runoff_xs_col (begc:endc)) ; this%qflx_ice_runoff_xs_col (:) = nan - allocate(this%qflx_rsub_sat_col (begc:endc)) ; this%qflx_rsub_sat_col (:) = nan - allocate(this%snow_sources_col (begc:endc)) ; this%snow_sources_col (:) = nan - allocate(this%snow_sinks_col (begc:endc)) ; this%snow_sinks_col (:) = nan - - allocate(this%qflx_liq_dynbal_grc (begg:endg)) ; this%qflx_liq_dynbal_grc (:) = nan - allocate(this%qflx_ice_dynbal_grc (begg:endg)) ; this%qflx_ice_dynbal_grc (:) = nan - allocate(this%AnnET (begc:endc)) ; this%AnnET (:) = nan - - this%qflx_liq_dynbal_dribbler = annual_flux_dribbler_gridcell( & - bounds = bounds, & - name = 'qflx_liq_dynbal', & - units = 'mm H2O') - - this%qflx_ice_dynbal_dribbler = annual_flux_dribbler_gridcell( & - bounds = bounds, & - name = 'qflx_ice_dynbal', & - units = 'mm H2O') - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use clm_varctl , only : use_cn - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: begg, endg - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - begg = bounds%begg; endg= bounds%endg - - this%qflx_top_soil_col(begc:endc) = spval - call hist_addfld1d (fname='QTOPSOIL', units='mm/s', & - avgflag='A', long_name='water input to surface', & - ptr_col=this%qflx_top_soil_col, c2l_scale_type='urbanf', default='inactive') - - this%qflx_infl_col(begc:endc) = spval - call hist_addfld1d (fname='QINFL', units='mm/s', & - avgflag='A', long_name='infiltration', & - ptr_col=this%qflx_infl_col, c2l_scale_type='urbanf') - - this%qflx_surf_col(begc:endc) = spval - call hist_addfld1d (fname='QOVER', units='mm/s', & - avgflag='A', long_name='surface runoff', & - ptr_col=this%qflx_surf_col, c2l_scale_type='urbanf') - - this%qflx_qrgwl_col(begc:endc) = spval - call hist_addfld1d (fname='QRGWL', units='mm/s', & - avgflag='A', & - long_name='surface runoff at glaciers (liquid only), wetlands, lakes; also includes melted ice runoff from QSNWCPICE', & - ptr_col=this%qflx_qrgwl_col, c2l_scale_type='urbanf') - - this%qflx_drain_col(begc:endc) = spval - call hist_addfld1d (fname='QDRAI', units='mm/s', & - avgflag='A', long_name='sub-surface drainage', & - ptr_col=this%qflx_drain_col, c2l_scale_type='urbanf') - - this%qflx_liq_dynbal_grc(begg:endg) = spval - call hist_addfld1d (fname='QFLX_LIQ_DYNBAL', units='mm/s', & - avgflag='A', long_name='liq dynamic land cover change conversion runoff flux', & - ptr_lnd=this%qflx_liq_dynbal_grc) - - this%qflx_ice_dynbal_grc(begg:endg) = spval - call hist_addfld1d (fname='QFLX_ICE_DYNBAL', units='mm/s', & - avgflag='A', long_name='ice dynamic land cover change conversion runoff flux', & - ptr_lnd=this%qflx_ice_dynbal_grc) - - this%qflx_runoff_col(begc:endc) = spval - call hist_addfld1d (fname='QRUNOFF', units='mm/s', & - avgflag='A', & - long_name='total liquid runoff not including correction for land use change', & - ptr_col=this%qflx_runoff_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QRUNOFF_ICE', units='mm/s', avgflag='A', & - long_name='total liquid runoff not incl corret for LULCC (ice landunits only)', & - ptr_col=this%qflx_runoff_col, c2l_scale_type='urbanf', l2g_scale_type='ice') - - this%qflx_runoff_u_col(begc:endc) = spval - call hist_addfld1d (fname='QRUNOFF_U', units='mm/s', & - avgflag='A', long_name='Urban total runoff', & - ptr_col=this%qflx_runoff_u_col, set_nourb=spval, c2l_scale_type='urbanf', default='inactive') - - this%qflx_runoff_r_col(begc:endc) = spval - call hist_addfld1d (fname='QRUNOFF_R', units='mm/s', & - avgflag='A', long_name='Rural total runoff', & - ptr_col=this%qflx_runoff_r_col, set_spec=spval, default='inactive') - - this%qflx_snow_drain_col(begc:endc) = spval - call hist_addfld1d (fname='QFLX_SNOW_DRAIN', units='mm/s', & - avgflag='A', long_name='drainage from snow pack', & - ptr_col=this%qflx_snow_drain_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_SNOW_DRAIN_ICE', units='mm/s', & - avgflag='A', long_name='drainage from snow pack melt (ice landunits only)', & - ptr_col=this%qflx_snow_drain_col, c2l_scale_type='urbanf', l2g_scale_type='ice') - - this%qflx_snomelt_col(begc:endc) = spval - call hist_addfld1d (fname='QSNOMELT', units='mm/s', & - avgflag='A', long_name='snow melt rate', & - ptr_col=this%qflx_snomelt_col, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSNOMELT_ICE', units='mm/s', & - avgflag='A', long_name='snow melt (ice landunits only)', & - ptr_col=this%qflx_snomelt_col, c2l_scale_type='urbanf', l2g_scale_type='ice') - - this%qflx_snomelt_lyr_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%qflx_snomelt_lyr_col(begc:endc,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_MELT', units='mm/s', type2d='levsno', & - avgflag='A', long_name='snow melt rate in each snow layer', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_MELT_ICE', units='mm/s', type2d='levsno', & - avgflag='A', long_name='snow melt rate in each snow layer (ice landunits only)', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%qflx_snofrz_col(begc:endc) = spval - call hist_addfld1d (fname='QSNOFRZ', units='kg/m2/s', & - avgflag='A', long_name='column-integrated snow freezing rate', & - ptr_col=this%qflx_snofrz_col, set_lake=spval, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSNOFRZ_ICE', units='mm/s', & - avgflag='A', long_name='column-integrated snow freezing rate (ice landunits only)', & - ptr_col=this%qflx_snofrz_col, c2l_scale_type='urbanf', l2g_scale_type='ice') - - this%qflx_snofrz_lyr_col(begc:endc,-nlevsno+1:0) = spval - data2dptr => this%qflx_snofrz_lyr_col(begc:endc,-nlevsno+1:0) - call hist_addfld2d (fname='SNO_FRZ', units='kg/m2/s', type2d='levsno', & - avgflag='A', long_name='snow freezing rate in each snow layer', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_FRZ_ICE', units='mm/s', type2d='levsno', & - avgflag='A', long_name='snow freezing rate in each snow layer (ice landunits only)', & - ptr_col=data2dptr, c2l_scale_type='urbanf',no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - this%qflx_h2osfc_to_ice_col(begc:endc) = spval - call hist_addfld1d (fname='QH2OSFC_TO_ICE', units='mm/s', & - avgflag='A', long_name='surface water converted to ice', & - ptr_col=this%qflx_h2osfc_to_ice_col, default='inactive') - - this%qflx_prec_intr_patch(begp:endp) = spval - call hist_addfld1d (fname='QINTR', units='mm/s', & - avgflag='A', long_name='interception', & - ptr_patch=this%qflx_prec_intr_patch, set_lake=0._r8) - - this%qflx_prec_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QDRIP', units='mm/s', & - avgflag='A', long_name='throughfall', & - ptr_patch=this%qflx_prec_grnd_patch, c2l_scale_type='urbanf') - - this%qflx_evap_soi_patch(begp:endp) = spval - call hist_addfld1d (fname='QSOIL', units='mm/s', & - avgflag='A', long_name= 'Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew)', & - ptr_patch=this%qflx_evap_soi_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSOIL_ICE', units='mm/s', & - avgflag='A', long_name='Ground evaporation (ice landunits only)', & - ptr_patch=this%qflx_evap_soi_patch, c2l_scale_type='urbanf', l2g_scale_type='ice') - - call hist_addfld2d (fname='QROOTSINK', units='mm/s', type2d='levsoi', & - avgflag='A', long_name='water flux from soil to root in each soil-layer', & - ptr_col=this%qflx_rootsoi_col, set_spec=spval, l2g_scale_type='veg', default='inactive') - - this%qflx_evap_can_patch(begp:endp) = spval - call hist_addfld1d (fname='QVEGE', units='mm/s', & - avgflag='A', long_name='canopy evaporation', & - ptr_patch=this%qflx_evap_can_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%qflx_tran_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='QVEGT', units='mm/s', & - avgflag='A', long_name='canopy transpiration', & - ptr_patch=this%qflx_tran_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%qflx_ev_snow_patch(begp:endp) = spval - call hist_addfld1d (fname='QSNOEVAP', units='mm/s', & - avgflag='A', long_name='evaporation from snow', & - ptr_patch=this%qflx_tran_veg_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%qflx_snowindunload_patch(begp:endp) = spval - call hist_addfld1d (fname='QSNO_WINDUNLOAD', units='mm/s', & - avgflag='A', long_name='canopy snow wind unloading', & - ptr_patch=this%qflx_snowindunload_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%qflx_snotempunload_patch(begp:endp) = spval - call hist_addfld1d (fname='QSNO_TEMPUNLOAD', units='mm/s', & - avgflag='A', long_name='canopy snow temp unloading', & - ptr_patch=this%qflx_snotempunload_patch, set_lake=0._r8, c2l_scale_type='urbanf') - - this%qflx_snwcp_liq_col(begc:endc) = spval - call hist_addfld1d (fname='QSNOCPLIQ', units='mm H2O/s', & - avgflag='A', long_name='excess liquid h2o due to snow capping not including correction for land use change', & - ptr_col=this%qflx_snwcp_liq_col, c2l_scale_type='urbanf') - - this%qflx_snwcp_ice_col(begc:endc) = spval - call hist_addfld1d (fname='QSNWCPICE', units='mm H2O/s', & - avgflag='A', long_name='excess solid h2o due to snow capping not including correction for land use change', & - ptr_col=this%qflx_snwcp_ice_col, c2l_scale_type='urbanf') - - this%qflx_rain_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_RAIN_GRND', units='mm H2O/s', & - avgflag='A', long_name='rain on ground after interception', & - ptr_patch=this%qflx_rain_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_snow_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_SNOW_GRND', units='mm H2O/s', & - avgflag='A', long_name='snow on ground after interception', & - ptr_patch=this%qflx_snow_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_evap_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_EVAP_GRND', units='mm H2O/s', & - avgflag='A', long_name='ground surface evaporation', & - ptr_patch=this%qflx_evap_grnd_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_evap_veg_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_EVAP_VEG', units='mm H2O/s', & - avgflag='A', long_name='vegetation evaporation', & - ptr_patch=this%qflx_evap_veg_patch, default='inactive', c2l_scale_type='urbanf') - - this%qflx_evap_tot_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_EVAP_TOT', units='mm H2O/s', & - avgflag='A', long_name='qflx_evap_soi + qflx_evap_can + qflx_tran_veg', & - ptr_patch=this%qflx_evap_tot_patch, c2l_scale_type='urbanf') - - this%qflx_dew_grnd_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_DEW_GRND', units='mm H2O/s', & - avgflag='A', long_name='ground surface dew formation', & - ptr_patch=this%qflx_dew_grnd_patch, c2l_scale_type='urbanf') - - this%qflx_sub_snow_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_SUB_SNOW', units='mm H2O/s', & - avgflag='A', & - long_name='sublimation rate from snow pack (also includes bare ice sublimation from glacier columns)', & - ptr_patch=this%qflx_sub_snow_patch, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_SUB_SNOW_ICE', units='mm H2O/s', & - avgflag='A', & - long_name='sublimation rate from snow pack (also includes bare ice sublimation from glacier columns) '// & - '(ice landunits only)', & - ptr_patch=this%qflx_sub_snow_patch, c2l_scale_type='urbanf', l2g_scale_type='ice', & - default='inactive') - - this%qflx_dew_snow_patch(begp:endp) = spval - call hist_addfld1d (fname='QFLX_DEW_SNOW', units='mm H2O/s', & - avgflag='A', long_name='surface dew added to snow pacK', & - ptr_patch=this%qflx_dew_snow_patch, c2l_scale_type='urbanf') - - this%qflx_h2osfc_surf_col(begc:endc) = spval - call hist_addfld1d (fname='QH2OSFC', units='mm/s', & - avgflag='A', long_name='surface water runoff', & - ptr_col=this%qflx_h2osfc_surf_col) - - this%qflx_drain_perched_col(begc:endc) = spval - call hist_addfld1d (fname='QDRAI_PERCH', units='mm/s', & - avgflag='A', long_name='perched wt drainage', & - ptr_col=this%qflx_drain_perched_col, c2l_scale_type='urbanf') - - this%qflx_rsub_sat_col(begc:endc) = spval - call hist_addfld1d (fname='QDRAI_XS', units='mm/s', & - avgflag='A', long_name='saturation excess drainage', & - ptr_col=this%qflx_rsub_sat_col, c2l_scale_type='urbanf') - - this%qflx_phs_neg_col(begc:endc) = spval - call hist_addfld1d (fname='QPHSNEG', units='mm/s', & - avgflag='A', long_name='net negative hydraulic redistribution flux', & - ptr_col=this%qflx_phs_neg_col, default='inactive') - - ! As defined here, snow_sources - snow_sinks will equal the change in h2osno at any - ! given time step but only if there is at least one snow layer (for all landunits - ! except lakes). Also note that monthly average files of snow_sources and snow_sinks - ! sinks must be weighted by number of days in the month to diagnose, for example, an - ! annual value of the change in h2osno. - - this%snow_sources_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_SOURCES', units='mm/s', & - avgflag='A', long_name='snow sources (liquid water)', & - ptr_col=this%snow_sources_col, c2l_scale_type='urbanf') - - this%snow_sinks_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW_SINKS', units='mm/s', & - avgflag='A', long_name='snow sinks (liquid water)', & - ptr_col=this%snow_sinks_col, c2l_scale_type='urbanf') - - this%AnnET(begc:endc) = spval - call hist_addfld1d (fname='AnnET', units='mm/s', & - avgflag='A', long_name='Annual ET', & - ptr_col=this%AnnET, c2l_scale_type='urbanf', default='inactive') - - end subroutine InitHistory - - - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! - ! !USES - use clm_varcon , only : spval - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - !--------------------------------------------------------------------- - - if (use_fun) then - - call init_accum_field (name='AnnET', units='MM H2O/S', & - desc='365-day running mean of total ET', accum_type='runmean', accum_period=-365, & - subgrid_type='column', numlev=1, init_value=0._r8) - - end if - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - ! - subroutine InitAccVars (this, bounds) - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - !--------------------------------------------------------------------- - begc = bounds%begc; endc = bounds%endc - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begc:endc), stat=ier) - - ! Determine time step - nstep = get_nstep() - - if (use_fun) then - call extract_accum_field ('AnnET', rbufslp, nstep) - this%AnnET(begc:endc) = rbufslp(begc:endc) - end if - - deallocate(rbufslp) - - end subroutine InitAccVars - - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use clm_time_manager, only : get_nstep - use accumulMod , only : update_accum_field, extract_accum_field - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,c,p ! indices - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begc, endc - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - - allocate(rbufslp(begc:endc), stat=ier) - - do c = begc,endc - rbufslp(c) = this%qflx_evap_tot_col(c) - end do - if (use_fun) then - ! Accumulate and extract AnnET (accumulates total ET as 365-day running mean) - call update_accum_field ('AnnET', rbufslp, nstep) - call extract_accum_field ('AnnET', this%AnnET, nstep) - - end if - - deallocate(rbufslp) - - end subroutine UpdateAccVars - - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,c,l - !----------------------------------------------------------------------- - - this%qflx_evap_grnd_patch(bounds%begp:bounds%endp) = 0.0_r8 - this%qflx_dew_grnd_patch (bounds%begp:bounds%endp) = 0.0_r8 - this%qflx_dew_snow_patch (bounds%begp:bounds%endp) = 0.0_r8 - - this%qflx_evap_grnd_col(bounds%begc:bounds%endc) = 0.0_r8 - this%qflx_dew_grnd_col (bounds%begc:bounds%endc) = 0.0_r8 - this%qflx_dew_snow_col (bounds%begc:bounds%endc) = 0.0_r8 - - this%qflx_phs_neg_col(bounds%begc:bounds%endc) = 0.0_r8 - - this%qflx_h2osfc_surf_col(bounds%begc:bounds%endc) = 0._r8 - this%qflx_snow_drain_col(bounds%begc:bounds%endc) = 0._r8 - - ! This variable only gets set in the hydrology filter; need to initialize it to 0 for - ! the sake of columns outside this filter - this%qflx_ice_runoff_xs_col(bounds%begc:bounds%endc) = 0._r8 - - ! needed for CNNLeaching - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%qflx_drain_col(c) = 0._r8 - this%qflx_surf_col(c) = 0._r8 - end if - end do - - end subroutine InitCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio, only : file_desc_t, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(waterflux_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - logical :: readvar ! determine if variable is on initial file - !----------------------------------------------------------------------- - - ! needed for SNICAR - call restartvar(ncid=ncid, flag=flag, varname='qflx_snofrz_lyr', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer ice freezing rate', units='kg m-2 s-1', & - interpinic_flag='interp', readvar=readvar, data=this%qflx_snofrz_lyr_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize qflx_snofrz_lyr to zero - this%qflx_snofrz_lyr_col(bounds%begc:bounds%endc,-nlevsno+1:0) = 0._r8 - endif - - call restartvar(ncid=ncid, flag=flag, varname='qflx_snow_drain:qflx_snow_melt', xtype=ncd_double, & - dim1name='column', & - long_name='drainage from snow column', units='mm/s', & - interpinic_flag='interp', readvar=readvar, data=this%qflx_snow_drain_col) - if (flag == 'read' .and. .not. readvar) then - ! initial run, not restart: initialize qflx_snow_drain to zero - this%qflx_snow_drain_col(bounds%begc:bounds%endc) = 0._r8 - endif - - call this%qflx_liq_dynbal_dribbler%Restart(bounds, ncid, flag) - call this%qflx_ice_dynbal_dribbler%Restart(bounds, ncid, flag) - - end subroutine Restart - -end module WaterfluxType diff --git a/src/biogeophys/test/CMakeLists.txt b/src/biogeophys/test/CMakeLists.txt deleted file mode 100644 index 75b77d5391..0000000000 --- a/src/biogeophys/test/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_subdirectory(Daylength_test) -add_subdirectory(Irrigation_test) -add_subdirectory(HumanStress_test) -add_subdirectory(SnowHydrology_test) -add_subdirectory(TotalWaterAndHeat_test) diff --git a/src/biogeophys/test/Daylength_test/CMakeLists.txt b/src/biogeophys/test/Daylength_test/CMakeLists.txt deleted file mode 100644 index 6182551580..0000000000 --- a/src/biogeophys/test/Daylength_test/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -set (pfunit_sources - test_daylength.pf - test_compute_max_daylength.pf) - -create_pFUnit_test(Daylength test_Daylength_exe - "${pfunit_sources}" "") - -target_link_libraries(test_Daylength_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/biogeophys/test/Daylength_test/test_compute_max_daylength.pf b/src/biogeophys/test/Daylength_test/test_compute_max_daylength.pf deleted file mode 100644 index 3c8d080128..0000000000 --- a/src/biogeophys/test/Daylength_test/test_compute_max_daylength.pf +++ /dev/null @@ -1,100 +0,0 @@ -module test_compute_max_daylength - - ! Tests of DaylengthMod: ComputeMaxDaylength - - use pfunit_mod - use DaylengthMod, only: ComputeMaxDaylength, daylength - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod, only : unittest_subgrid_teardown, bounds - use unittestSimpleSubgridSetupsMod, only : setup_ncells_single_veg_patch - use GridcellType, only : grc - - implicit none - - @TestCase - type, extends(TestCase) :: TestMaxDaylength - contains - procedure :: setUp - procedure :: tearDown - end type TestMaxDaylength - - ! Note larger tolerance here than what we typically use: - real(r8), parameter :: tol = 1.e-3_r8 - -contains - - subroutine setUp(this) - class(TestMaxDaylength), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestMaxDaylength), intent(inout) :: this - - call unittest_subgrid_teardown - end subroutine tearDown - - @Test - subroutine computeMaxDaylength_basic(this) - ! Basic tests of ComputeMaxDaylength, for both negative and positive latitudes - class(TestMaxDaylength), intent(inout) :: this - real(r8), parameter :: lat1 = 0.1_r8 - real(r8), parameter :: lat2 = 0.2_r8 - real(r8), parameter :: obliquity = 0.3_r8 - real(r8) :: expected_lat1, expected_lat2 - real(r8) :: expected(4) - - call setup_ncells_single_veg_patch(ncells=4, pft_type=1) - ! Mix of negative and positive latitudes: - grc%lat(bounds%begg:bounds%endg) = [-lat1, lat1, -lat2, lat2] - - expected_lat1 = daylength(lat1, obliquity) - expected_lat2 = daylength(lat2, obliquity) - ! Expected max daylength is the same for lat1 and -lat1 - expected(:) = [expected_lat1, expected_lat1, expected_lat2, expected_lat2] - - call ComputeMaxDaylength(bounds, & - lat = grc%lat(bounds%begg:bounds%endg), & - obliquity = obliquity, & - max_daylength = grc%max_dayl(bounds%begg:bounds%endg)) - - @assertEqual(expected, grc%max_dayl(bounds%begg:bounds%endg), tolerance=tol) - end subroutine computeMaxDaylength_basic - - @Test - subroutine computeMaxDaylength_equator(this) - ! At the equator, max daylength should be 12 hours - class(TestMaxDaylength), intent(inout) :: this - real(r8), parameter :: twelve_hours = 12._r8 * 60._r8 * 60._r8 ! in seconds - - call setup_ncells_single_veg_patch(ncells=1, pft_type=1) - grc%lat(bounds%begg) = 0._r8 - - call ComputeMaxDaylength(bounds, & - lat = grc%lat(bounds%begg:bounds%endg), & - obliquity = 0.3_r8, & - max_daylength = grc%max_dayl(bounds%begg:bounds%endg)) - - @assertEqual(twelve_hours, grc%max_dayl(bounds%begg), tolerance=tol) - end subroutine computeMaxDaylength_equator - - @Test - subroutine computeMaxDaylength_nearPoles(this) - ! Near the poles, max daylength should be 24 hours - class(TestMaxDaylength), intent(inout) :: this - real(r8), parameter :: twentyfour_hours = 24._r8 * 60._r8 * 60._r8 ! in seconds - real(r8) :: expected(2) - - call setup_ncells_single_veg_patch(ncells=2, pft_type=1) - grc%lat(bounds%begg:bounds%endg) = [1.5_r8, -1.5_r8] - - expected(:) = [twentyfour_hours, twentyfour_hours] - - call ComputeMaxDaylength(bounds, & - lat = grc%lat(bounds%begg:bounds%endg), & - obliquity = 0.3_r8, & - max_daylength = grc%max_dayl(bounds%begg:bounds%endg)) - - @assertEqual(expected, grc%max_dayl(bounds%begg:bounds%endg), tolerance=tol) - end subroutine computeMaxDaylength_nearPoles - -end module test_compute_max_daylength diff --git a/src/biogeophys/test/Daylength_test/test_daylength.pf b/src/biogeophys/test/Daylength_test/test_daylength.pf deleted file mode 100644 index b326a1190a..0000000000 --- a/src/biogeophys/test/Daylength_test/test_daylength.pf +++ /dev/null @@ -1,76 +0,0 @@ -module test_daylength - - ! Tests of the daylength function in DaylengthMod - - use pfunit_mod - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod, only : SHR_CONST_PI - use DaylengthMod , only : daylength - - implicit none - save - - real(r8), parameter :: tol = 1.e-3_r8 - -contains - - @Test - subroutine test_standard_points() - ! Tests multiple points, not edge cases - - @assertEqual([26125.331269192659_r8, 33030.159082987258_r8], daylength([-1.4_r8, -1.3_r8], 0.1_r8), tolerance=tol) - end subroutine test_standard_points - - - @Test - subroutine test_near_poles() - ! Tests points near the north and south pole, which should result in full night and - ! full day - - @assertEqual([0.0_r8, 86400.0_r8], daylength([-1.5_r8, 1.5_r8], 0.1_r8), tolerance=tol) - end subroutine test_near_poles - - - @Test - subroutine test_north_pole() - ! Tests north pole point, including rounding error - - @assertEqual(86400._r8, daylength(SHR_CONST_PI/2.0_r8, 0.1_r8), tolerance=tol) - @assertEqual(86400._r8, daylength(SHR_CONST_PI/1.999999999999999_r8, 0.1_r8), tolerance=tol) - end subroutine test_north_pole - - - @Test - subroutine test_south_pole() - ! Tests north pole point, including rounding error - - @assertEqual(0._r8, daylength(-1.0_r8 * SHR_CONST_PI/2.0_r8, 0.1_r8), tolerance=tol) - @assertEqual(0._r8, daylength(-1.0_r8 * SHR_CONST_PI/1.999999999999999_r8, 0.1_r8), tolerance=tol) - end subroutine test_south_pole - - - @Test - subroutine test_error_in_decl() - - @assertIsNaN(daylength(-1.0_r8, -3.0_r8)) - end subroutine test_error_in_decl - - - @Test - subroutine test_error_in_lat_scalar() - - @assertIsNaN(daylength(3.0_r8, 0.1_r8)) - end subroutine test_error_in_lat_scalar - - @Test - subroutine test_error_in_lat_array() - real(r8) :: my_result(2) - - my_result = daylength([1.0_r8, 3.0_r8], 0.1_r8) - @assertIsFinite(my_result(1)) - @assertIsNaN(my_result(2)) - end subroutine test_error_in_lat_array - - -end module test_daylength diff --git a/src/biogeophys/test/HumanStress_test/CMakeLists.txt b/src/biogeophys/test/HumanStress_test/CMakeLists.txt deleted file mode 100644 index d2583a3a47..0000000000 --- a/src/biogeophys/test/HumanStress_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(humanstress test_humanstress_exe - "test_humanstress.pf" "") - -target_link_libraries(test_humanstress_exe clm csm_share) diff --git a/src/biogeophys/test/HumanStress_test/test_humanstress.pf b/src/biogeophys/test/HumanStress_test/test_humanstress.pf deleted file mode 100644 index 51b41cf8e4..0000000000 --- a/src/biogeophys/test/HumanStress_test/test_humanstress.pf +++ /dev/null @@ -1,139 +0,0 @@ -module test_humanstress - - ! Tests of the humanstress functions in HumanIndexMod - - use pfunit_mod - - use shr_kind_mod , only : r8 => shr_kind_r8 - use HumanIndexMod - use shr_infnan_mod, only : shr_infnan_isnan - use shr_const_mod , only: SHR_CONST_TKFRZ - - implicit none - save - - real(r8), parameter :: tol = 1.e-8_r8 - -contains - - @Test - subroutine test_standard_WetBulb() - real(r8) :: temp ! Temperature - real(r8) :: rh ! relative humidity - real(r8) :: wbt ! Wet bulb temp - - call Wet_BulbS( 0.0_r8, 0.0_r8, wbt ) - @assertEqual( -3.6531108341574_r8, wbt, tolerance=tol) - call Wet_BulbS( 0.0_r8, 100.0_r8, wbt ) - @assertEqual( -0.13165370616986_r8, wbt, tolerance=tol) - call Wet_BulbS( 50.0_r8, 100.0_r8, wbt ) - @assertTrue( .not. shr_infnan_isnan(wbt) ) - - temp = 100._r8 - rh = 100.0_r8 - do while ( temp > -50.0 ) - call Wet_BulbS( temp, rh, wbt ) - @assertTrue( .not. shr_infnan_isnan(wbt) ) - temp = temp - 0.1_r8 - end do - - end subroutine test_standard_WetBulb - - @Test - subroutine test_WetBulb() - use QSatMod, only : QSat - implicit none - real(r8) :: temp ! Temperature - real(r8) :: rh ! relative humidity - real(r8) :: wbt ! Wet bulb temp - real(r8) :: pres ! atmospheric pressure - real(r8) :: vapor ! vapor pressure - real(r8) :: shum ! specific humidity - - real(r8) :: Teq, epott, sat_vapor - real(r8) :: esdT, qsdT - real(r8) :: es_mb, de_mbdT, dlnes_mbdT, rs, rsdT, foftk, fdT - - pres = 100000._r8 - - temp = 50._r8 + SHR_CONST_TKFRZ - rh = 100.0_r8 - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) - call VaporPres( rh, sat_vapor, vapor ) - call VaporPres( rh, rs, shum ) - call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) - @assertEqual( 50._r8, wbt, tolerance=1.e-2_r8 ) - - temp = 59._r8 + SHR_CONST_TKFRZ - rh = 65.0_r8 - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) - call VaporPres( rh, sat_vapor, vapor ) - call VaporPres( rh, rs, shum ) - call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) - @assertTrue( .not. shr_infnan_isnan(wbt) ) - - rh = 100.0_r8 - do while ( rh > 0.0_r8 ) - pres = 120000.0_r8 - do while ( pres > 85000._r8 ) - temp = 53._r8 + SHR_CONST_TKFRZ - do while ( temp > SHR_CONST_TKFRZ-127.0 ) - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) - call VaporPres( rh, sat_vapor, vapor ) - call VaporPres( rh, rs, shum ) - call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) - if ( rh == 100._r8 )then - @assertEqual( temp-SHR_CONST_TKFRZ, wbt, tolerance=1.e-2_r8 ) - else - @assertLessThan( wbt-1.e-6_r8, temp-SHR_CONST_TKFRZ ) - end if - temp = temp - 10.0_r8 - end do - pres = pres - 5000.0_r8 - end do - rh = rh - 5.0_r8 - if ( rh == 90.0_r8 ) rh = 5.0_r8 - end do - - end subroutine test_WetBulb - - - @Test - subroutine test_WetBulb_extremeTemps() - use QSatMod, only : QSat - implicit none - real(r8) :: temp ! Temperature - real(r8) :: rh ! relative humidity - real(r8) :: wbt ! Wet bulb temp - real(r8) :: pres ! atmospheric pressure - real(r8) :: vapor ! vapor pressure - real(r8) :: shum ! specific humidity - - real(r8) :: Teq, epott, sat_vapor - real(r8) :: esdT, qsdT - real(r8) :: es_mb, de_mbdT, dlnes_mbdT, rs, rsdT, foftk, fdT - - rh = 1.0_r8 - do while ( rh < 95.0_r8 ) - pres = 95000.0_r8 - do while ( pres < 110000._r8 ) - temp = 53._r8 + SHR_CONST_TKFRZ - do while ( temp <= SHR_CONST_TKFRZ+58.0 ) - call QSat (temp, pres, sat_vapor, esdT, rs, qsdT) - call VaporPres( rh, sat_vapor, vapor ) - call VaporPres( rh, rs, shum ) - write(*,*) 'temp, pres, rh : ', temp-SHR_CONST_TKFRZ, pres, rh - call Wet_Bulb (temp,vapor,pres,rh,shum,Teq,epott,wbt) - write(*,*) 'wbt: ', wbt - @assertLessThan( wbt-1.e-6_r8, temp-SHR_CONST_TKFRZ ) - temp = temp + 1.5_r8 - end do - pres = pres + 2500.0_r8 - end do - rh = rh + 5.0_r8 - end do - - end subroutine test_WetBulb_extremeTemps - - -end module test_humanstress diff --git a/src/biogeophys/test/Irrigation_test/CMakeLists.txt b/src/biogeophys/test/Irrigation_test/CMakeLists.txt deleted file mode 100644 index 7a1b7cc5ee..0000000000 --- a/src/biogeophys/test/Irrigation_test/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set (pfunit_sources - test_irrigation.pf) - -# extra sources used for this test, which are not .pf files -# (currently none) -set (extra_sources - ) - -create_pFUnit_test(irrigation test_irrigation_exe - "${pfunit_sources}" "${extra_sources}") - -target_link_libraries(test_irrigation_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/biogeophys/test/Irrigation_test/README b/src/biogeophys/test/Irrigation_test/README deleted file mode 100644 index 3619bfddba..0000000000 --- a/src/biogeophys/test/Irrigation_test/README +++ /dev/null @@ -1,68 +0,0 @@ ---- Some design notes --- - -There are a couple of important points about IrrigationMod that motivated how I -set up these tests: - -(1) There are two main routines in the public interface: CalcIrrigationNeeded - and ApplyIrrigation. CalcIrrigationNeeded does not have any effects that are - directly visible; instead, it sets some variables that are later used by - ApplyIrrigation. (These two routines are separated because they need to be - called at different points in the driver.) - -(2) Within CalcIrrigationNeeded, there is a filter loop inside a loop over - levels. (The looping was done in this order for the sake of vectorization, - despite the fact that the code - and possibly the testing - would haven - simpler if the loop nesting were reversed. But this seems typical of - multi-level code throughout CLM.) Furthermore, there is some interaction - between levels (in that a frozen layer j prevents any irrigation demand from - being counted below level j). - -Because of these considerations, it was not straightforward to pull out routines -that could operate on a single point, and just do the testing on these -single-point routines. So instead, I am just testing the public, multi-point -routines. However, for simplicity, most of my tests just use a single point in -the arrays - and then I have just enough multi-point tests to ensure that the -routines truly do work with multiple points. - -Furthermore, I have been influenced lately by advice to "test behavior, not -methods", and to test through the public interface. And in this case, it -actually feels easier to convince myself that the code is doing the right thing -if I set up my tests to operate similarly to how CLM itself will interact with -IrrigationMod - that is, calling CalcIrrigationNeeded followed by -ApplyIrrigation, then examining the resulting qflx_irrig. Thus, that is what I -do in my tests - as opposed to, say, testing CalcIrrigationNeeded by itself and -viewing resulting variables that aren't usually available through the public -interface; or as opposed to breaking the current routines down into smaller -methods just for the sake of testability. Testing through the public interface -also feels like it will make the tests more robust (with fewer changes needed) -if the private implementation changes. - -However, in cases where it's easier to pull out a single-point implementation of -an algorithm, with a relatively trivial wrapper to handle the looping over -multiple points, I'd probably still come down in favor of just testing the -single-point implementation - since doing so is significantly simpler, even if -it means you're testing something that should be private. - - ---- Motivation for use of a testCase --- - -The main purpose of using a TestCase here is so that the tearDown is done -automatically, rather than having to call this teardown manually from each -test. This is important because, if an assertion fails, a test immediately -exits. That means that manual teardown is skipped, whereas this automatic -teardown still happens. This, in turn, is important so that the remaining tests -can still run properly. - ---- Notes about separation into multiple files --- - -I have separated tests based on what needs to be done for the setup and teardown -of each test. Tests that need identical setup and teardown (or lack thereof) are -grouped together. - -IrrigationWrapperMod contains routines that are used by both the singlepatch and -multipatch tests. In terms of setup and teardown: I have put setup stuff in here -that is in common for both the singlepatch and multipatch tests. I then do the -symmetrical teardown here, as well (e.g., if a variable foo is allocated in -IrrigationWrapperMod, I also deallocate it in the teardown routine in -IrrigationWrapperMod). The setup done in the .pf files themselves is stuff that -differs between singlepatch and multipatch (or between individual tests). diff --git a/src/biogeophys/test/Irrigation_test/test_irrigation.pf b/src/biogeophys/test/Irrigation_test/test_irrigation.pf deleted file mode 100644 index 3c599aac02..0000000000 --- a/src/biogeophys/test/Irrigation_test/test_irrigation.pf +++ /dev/null @@ -1,976 +0,0 @@ -module test_irrigation - - ! Tests of IrrigationMod - - use pfunit_mod - use unittestSubgridMod - use IrrigationMod, only : irrigation_type, irrigation_params_type - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_varpar, only : nlevsoi, nlevgrnd - use landunit_varcon, only : istsoil - use PatchType , only : patch - use ColumnType , only : col - use GridcellType , only : grc - use pftconMod , only : pftcon - use unittestSimpleSubgridSetupsMod, only : setup_single_veg_patch - use unittestFilterBuilderMod, only : filter_from_range - - implicit none - save - - real(r8), parameter :: tol = 1.e-13_r8 - integer , parameter :: dtime = 1800 ! model time step, seconds - - @TestCase - type, extends(TestCase) :: TestIrrigation - integer :: numf - integer, allocatable :: filter(:) - type(irrigation_type) :: irrigation - - ! Irrigation parameters - type(irrigation_params_type) :: irrigation_params - - ! Inputs to irrigation routines - real(r8), allocatable :: elai(:) - real(r8), allocatable :: t_soisno(:,:) - real(r8), allocatable :: eff_porosity(:,:) - real(r8), allocatable :: h2osoi_liq(:,:) - real(r8), allocatable :: relsat_wilting_point(:,:) - real(r8), allocatable :: relsat_target(:,:) - real(r8), allocatable :: volr(:) - - ! Previous model time - integer :: time_prev - contains - procedure :: setUp - procedure :: tearDown - procedure :: setupSinglePatch - procedure :: setupIrrigation - procedure :: setupEnvironment - procedure :: teardownEnvironment - - ! Computes irrigation deficit for every patch and level - procedure :: computeDeficits - - ! Wrapper that calls both CalcIrrigationNeeded and ApplyIrrigation - procedure :: calculateAndApplyIrrigation - end type TestIrrigation - - real(r8), parameter :: mm_times_km2_to_m3 = 1.e3_r8 - real(r8), parameter :: m3_over_km2_to_mm = 1.e-3_r8 - -contains - - ! ======================================================================== - ! Test helpers - ! ======================================================================== - - subroutine setUp(this) - class(TestIrrigation), intent(inout) :: this - - ! Need to set nlevgrnd before doing the subgrid setup (because it is needed when - ! allocating the col object). So we must do this before setupEnvironment, because - ! that assumes that the subgrid setup has already been done. - ! - ! Also set nlevsoi here for symmetry. - ! - ! Need nlevsoi at least 4 for some tests to be meaningful - nlevsoi = 4 - nlevgrnd = nlevsoi + 1 - - end subroutine setUp - - subroutine tearDown(this) - class(TestIrrigation), intent(inout) :: this - - call this%irrigation%Clean() - call this%teardownEnvironment() - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine setupSinglePatch(this) - ! Sets up grid with single veg patch; also sets up this%filter appropriately - class(TestIrrigation), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call filter_from_range(start=bounds%begp, end=bounds%endp, numf=this%numf, filter=this%filter) - end subroutine setupSinglePatch - - !----------------------------------------------------------------------- - subroutine setupIrrigation(this, maxpft, test_limit_irrigation, nlevirrig, & - irrig_river_volume_threshold) - ! - ! !DESCRIPTION: - ! Do the setup needed for most tests. - ! - ! Values are set up such that there is some irrigation deficit everywhere, and - ! irrigation would start in the following call to CalcIrrigationNeeded (followed by - ! ApplyIrrigation). Values are set the same for every patch/column, and are the same - ! at every level EXCEPT for relsat_wilting_point and relsat_target, which vary - ! linearly by level and col number. - ! - ! volr is set up to be non-limiting - ! - ! Assumes that nlevgrnd and nlevsoi have been set, and that all necessary subgrid - ! setup has been completed. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(TestIrrigation), intent(inout) :: this - - ! max pft type; if not given, set to 1 - integer, intent(in), optional :: maxpft - logical, intent(in), optional :: test_limit_irrigation - - ! number of levels to include in irrigation; if not given, defaults to nlevsoi; - ! irrig_depth is set using the column depths for the first column - integer, intent(in), optional :: nlevirrig - - ! Threshold for river water volume below which irrigation is shut off, if - ! limit_irrigation_if_rof_enabled is .true. (fraction of available river water). If - ! not given, defaults to 0.1 - real(r8), intent(in), optional :: irrig_river_volume_threshold - - ! - ! !LOCAL VARIABLES: - integer :: c,j - logical :: limit_irrigation_if_rof_enabled - integer :: l_maxpft - integer :: l_nlevirrig - real(r8) :: irrig_depth - real(r8) :: l_irrig_river_volume_threshold - !----------------------------------------------------------------------- - - limit_irrigation_if_rof_enabled = .false. - if (present(test_limit_irrigation)) then - limit_irrigation_if_rof_enabled = test_limit_irrigation - end if - - l_maxpft = 1 - if (present(maxpft)) then - l_maxpft = maxpft - end if - - l_nlevirrig = nlevsoi - if (present(nlevirrig)) then - l_nlevirrig = nlevirrig - end if - - l_irrig_river_volume_threshold = 0.1_r8 - if (present(irrig_river_volume_threshold)) then - l_irrig_river_volume_threshold = irrig_river_volume_threshold - end if - - call this%setupEnvironment(maxpft=l_maxpft) - - ! Set the irrigation depth to be just barely big enough to include the desired layers - irrig_depth = col%z(bounds%begc,l_nlevirrig) + 1.e-9_r8 - - ! Set parameters - this%irrigation_params = irrigation_params_type( & - irrig_min_lai = 0.0_r8, & - irrig_start_time = 21600, & - irrig_length = 14400, & - irrig_target_smp = -3400._r8, & - irrig_depth = irrig_depth, & - irrig_threshold_fraction = 0.5_r8, & - irrig_river_volume_threshold = l_irrig_river_volume_threshold, & - limit_irrigation_if_rof_enabled = limit_irrigation_if_rof_enabled) - - ! Set inputs to irrigation routines - allocate(this%elai(bounds%begp:bounds%endp), source=10._r8) - allocate(this%t_soisno(bounds%begc:bounds%endc, nlevgrnd), source=1000._r8) - allocate(this%eff_porosity(bounds%begc:bounds%endc, nlevgrnd), source=1._r8) - allocate(this%h2osoi_liq(bounds%begc:bounds%endc, nlevgrnd), source=0._r8) - allocate(this%relsat_wilting_point(bounds%begc:bounds%endc, nlevsoi)) - allocate(this%relsat_target(bounds%begc:bounds%endc, nlevsoi)) - ! By default, volr will be very limiting... but this should have no effect if - ! limit_irrigation_if_rof_enabled is false (the default) - allocate(this%volr(bounds%begg:bounds%endg), source=0._r8) - - do j = 1, nlevsoi - do c = bounds%begc, bounds%endc - this%relsat_wilting_point(c,j) = 0.07_r8 * j * (c - bounds%begc + 1) - this%relsat_target(c,j) = 0.1_r8 * j * (c - bounds%begc + 1) - end do - end do - - ! Set time_prev to the irrig_start_time minus 1 hour (since we're using a longitude - ! about 1 hour east of 0Z) - this%time_prev = this%irrigation_params%irrig_start_time - 3600 - - call this%irrigation%InitForTesting(bounds, this%irrigation_params, dtime, & - this%relsat_wilting_point, this%relsat_target) - - end subroutine setupIrrigation - - !----------------------------------------------------------------------- - subroutine setupEnvironment(this, maxpft) - ! - ! !DESCRIPTION: - ! Sets up the external environment used by Irrigation - i.e., things accessed via - ! 'use' statements. - ! - ! Assumes nlevgrnd and nlevsoi have been set, and that all necessary subgrid setup has - ! been completed. - ! - ! !ARGUMENTS: - class(TestIrrigation), intent(in) :: this - integer, intent(in) :: maxpft ! max pft type that needs to be supported - ! - integer :: c,j - - !----------------------------------------------------------------------- - - allocate(pftcon%irrigated(0:maxpft), source=1.0_r8) - - col%dz(:,1:nlevgrnd) = 1.0_r8 - do j = 1, nlevgrnd - do c = bounds%begc, bounds%endc - col%z(c,j) = sum(col%dz(c,1:j-1)) + 0.5_r8*col%dz(c,j) - end do - end do - - do c = bounds%begc, bounds%endc - ! Setting nbedrock to nlevsoi means that none of the layers from 1:nlevsoi are - ! considered bedrock - col%nbedrock(c) = nlevsoi - end do - - ! slightly greater than 1 hour offset - grc%londeg(:) = 15.1_r8 - - grc%area(:) = 10.0_r8 - - end subroutine setupEnvironment - - !----------------------------------------------------------------------- - subroutine teardownEnvironment(this) - ! - ! !DESCRIPTION: - ! Tears down the environment set up by setupEnvironment. Should be called after each - ! test. Note that this does NOT deallocate the subgrid variables - that cleanup - ! needs to be done separately. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(TestIrrigation), intent(in) :: this - ! - !----------------------------------------------------------------------- - - deallocate(pftcon%irrigated) - - end subroutine teardownEnvironment - - !----------------------------------------------------------------------- - subroutine computeDeficits(this, deficits) - ! - ! !DESCRIPTION: - ! Computes irrigation deficit for each patch and layer, from 1 to nlevsoi - ! - ! Allocates the 'deficits' variable, and gives it a lower bound of bounds%begp. - ! - ! The motivation for this function is: For most of the irrigation tests, we assume - ! that the RelsatToH2osoi function is working correctly, and we want to test the code - ! that builds on top of that function. By having this function, we can avoid having to - ! hard-code the deficits in each test. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(TestIrrigation), intent(in) :: this - real(r8), allocatable, intent(out) :: deficits(:,:) ! kg m-2 - ! - ! !LOCAL VARIABLES: - integer :: p, c, j - real(r8) :: h2osoi_liq_target - - character(len=*), parameter :: subname = 'computeDeficits' - !----------------------------------------------------------------------- - - allocate(deficits(bounds%begp:bounds%endp, nlevsoi)) - do j = 1, nlevsoi - do p = bounds%begp, bounds%endp - c = patch%column(p) - h2osoi_liq_target = this%irrigation%RelsatToH2osoi( & - relsat = this%relsat_target(c,j), & - eff_porosity = this%eff_porosity(c,j), & - dz = col%dz(c,j)) - deficits(p,j) = h2osoi_liq_target - this%h2osoi_liq(c,j) - end do - end do - - end subroutine computeDeficits - - !----------------------------------------------------------------------- - subroutine calculateAndApplyIrrigation(this) - ! - ! !DESCRIPTION: - ! Call CalculateIrrigationNeeded with the given irrigation parameters. Then call - ! ApplyIrrigation. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(TestIrrigation), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'calculateAndApplyIrrigation' - !----------------------------------------------------------------------- - - call this%irrigation%CalcIrrigationNeeded(& - bounds=bounds, & - num_exposedvegp = this%numf, & - filter_exposedvegp = this%filter, & - time_prev = this%time_prev, & - elai = this%elai, & - t_soisno = this%t_soisno, & - eff_porosity = this%eff_porosity, & - h2osoi_liq = this%h2osoi_liq, & - volr = this%volr, & - rof_prognostic = .true.) - - call this%irrigation%ApplyIrrigation(bounds) - - end subroutine calculateAndApplyIrrigation - - ! ======================================================================== - ! Begin actual tests - ! ======================================================================== - - ! ------------------------------------------------------------------------ - ! Tests on a single patch - ! ------------------------------------------------------------------------ - - @Test - subroutine irrigation_flux_is_correct(this) - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - expected = sum(deficits(bounds%begp,1:nlevsoi)) / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - - end subroutine irrigation_flux_is_correct - - @Test - subroutine no_irrigation_for_wet_soil(this) - class(TestIrrigation), intent(inout) :: this - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - this%h2osoi_liq(:,:) = 1.e15_r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - end subroutine no_irrigation_for_wet_soil - - @Test - subroutine surplus_offsets_deficit(this) - ! A surplus in one layer offsets a deficit in another - class(TestIrrigation), intent(inout) :: this - real(r8), parameter :: surplus = 1._r8 - real(r8) :: h2osoi_target_layer1 - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - h2osoi_target_layer1 = this%irrigation%RelsatToH2osoi( & - relsat = this%relsat_target(bounds%begc,1), & - eff_porosity = this%eff_porosity(bounds%begc,1), & - dz = col%dz(bounds%begc,1)) - this%h2osoi_liq(bounds%begc,1) = h2osoi_target_layer1 + surplus - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - expected = (sum(deficits(bounds%begp,2:nlevsoi)) - surplus) / this%irrigation_params%irrig_length - ! This first assertion makes sure the test has been set up reasonably - to give a net deficit - @assertLessThan(0._r8, expected) - ! Here is the main assertion: - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - end subroutine surplus_offsets_deficit - - @Test - subroutine no_irrigation_for_unirrigated_pfts(this) - use PatchType, only : patch - class(TestIrrigation), intent(inout) :: this - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation(maxpft=2) - patch%itype(bounds%begp) = 2 - pftcon%irrigated(1:2) = [1.0, 0.0] - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - - end subroutine no_irrigation_for_unirrigated_pfts - - @Test - subroutine no_irrigation_for_lai0(this) - class(TestIrrigation), intent(inout) :: this - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - this%elai(bounds%begp) = 0._r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - - end subroutine no_irrigation_for_lai0 - - @Test - subroutine no_irrigation_for_soil_moisture_above_threshold(this) - class(TestIrrigation), intent(inout) :: this - real(r8) :: h2osoi_target - integer :: j - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - ! Set h2osoi_liq to just a tiny bit below the target in each layer - with the - ! assumption that this will make it fall above the threshold for triggering irrigation - do j = 1, nlevsoi - h2osoi_target = this%irrigation%RelsatToH2osoi( & - relsat = this%relsat_target(bounds%begc,j), & - eff_porosity = this%eff_porosity(bounds%begc,j), & - dz = col%dz(bounds%begc,j)) - this%h2osoi_liq(bounds%begc,j) = h2osoi_target * 0.99_r8 - end do - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - end subroutine no_irrigation_for_soil_moisture_above_threshold - - @Test - subroutine no_irrigation_at_wrong_time(this) - class(TestIrrigation), intent(inout) :: this - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - ! Set previous time to be one time step before the time when we would start irrigating - this%time_prev = this%time_prev - dtime - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - - end subroutine no_irrigation_at_wrong_time - - @Test - subroutine unlimited_irrigation_for_non_limiting_volr(this) - use GridcellType, only : grc - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8), parameter :: irrig_river_volume_threshold = 0.1_r8 - real(r8) :: total_deficit ! kg m-2 (i.e., mm) - real(r8) :: volr_threshold ! m3 - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation(test_limit_irrigation=.true., & - irrig_river_volume_threshold=irrig_river_volume_threshold) - - call this%computeDeficits(deficits) - total_deficit = sum(deficits(bounds%begp,1:nlevsoi)) - - ! Set volr to be just above the limiting amount - volr_threshold = (total_deficit * grc%area(begg) * mm_times_km2_to_m3) / & - (1._r8 - irrig_river_volume_threshold) - this%volr(begg) = volr_threshold + 10._r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - expected = total_deficit / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - end subroutine unlimited_irrigation_for_non_limiting_volr - - @Test - subroutine limited_irrigation_for_limiting_volr(this) - use GridcellType, only : grc - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8), parameter :: irrig_river_volume_threshold = 0.1_r8 - real(r8) :: total_deficit ! kg m-2 (i.e., mm) - real(r8) :: volr_threshold ! m3 - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation(test_limit_irrigation=.true., & - irrig_river_volume_threshold=irrig_river_volume_threshold) - - call this%computeDeficits(deficits) - total_deficit = sum(deficits(bounds%begp,1:nlevsoi)) - - ! Set volr to be somewhat below the limiting amount - volr_threshold = (total_deficit * grc%area(begg) * mm_times_km2_to_m3) / & - (1._r8 - irrig_river_volume_threshold) - this%volr(begg) = volr_threshold - 10._r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - expected = ((this%volr(begg) * (1._r8 - irrig_river_volume_threshold)) & - / grc%area(begg) * m3_over_km2_to_mm) / & - this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - end subroutine limited_irrigation_for_limiting_volr - - @Test - subroutine irrigation_should_happen_for_big_longitude(this) - use GridcellType, only : grc - class(TestIrrigation), intent(inout) :: this - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - ! Use a big longitude and a time_prev that should lead to irrigation at that longitude - ! The main point of this is to test the modulo in the local_time calculation - grc%londeg(:) = 359.9_r8 - this%time_prev = this%irrigation_params%irrig_start_time + dtime - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertTrue(this%irrigation%qflx_irrig_patch(bounds%begp) > 0._r8) - - end subroutine irrigation_should_happen_for_big_longitude - - @Test - subroutine irrigation_continues_at_same_rate_for_multiple_time_steps(this) - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - - ! Call irrigation routines - ! First call the routines to get irrigation started. Then increment time, and also - ! adjust the soil water amount. Irrigation should continue at the original rate. - call this%calculateAndApplyIrrigation() - call this%computeDeficits(deficits) - expected = sum(deficits(bounds%begp,1:nlevsoi)) / this%irrigation_params%irrig_length - this%time_prev = this%time_prev + dtime - this%h2osoi_liq = 100._r8 - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - - end subroutine irrigation_continues_at_same_rate_for_multiple_time_steps - - @Test - subroutine irrigation_continues_for_correct_number_of_time_steps(this) - class(TestIrrigation), intent(inout) :: this - integer :: time - integer :: expected_num_time_steps - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - ! The following assumes that dtime divides evenly into to irrigation length; - ! if not, it will be off by one - expected_num_time_steps = this%irrigation_params%irrig_length / dtime - - ! Ensure that irrigation flux is still non-zero after the expected number of time - ! steps - do time = 1, expected_num_time_steps - call this%calculateAndApplyIrrigation() - this%time_prev = this%time_prev + dtime - end do - @assertTrue(this%irrigation%qflx_irrig_patch(bounds%begp) > 0._r8) - - ! Ensure that irrigation flux goes to 0 in the following time step - call this%calculateAndApplyIrrigation() - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - - end subroutine irrigation_continues_for_correct_number_of_time_steps - - @Test - subroutine irrigation_flux_is_correct_on_second_day(this) - ! Loops through to a point where irrigation gets to 0, then resets time to the irrig - ! start time and does another set of calls to the irrigation routines. Ensures that - ! we're back to the intended flux. - - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - integer :: time_prev_orig - integer :: time - integer :: expected_num_time_steps - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - time_prev_orig = this%time_prev - - ! Call irrigation routines for long enough that irrigation should go to 0 - expected_num_time_steps = this%irrigation_params%irrig_length / dtime - do time = 1, expected_num_time_steps + 1 - call this%calculateAndApplyIrrigation() - this%time_prev = this%time_prev + dtime - end do - ! The following assertion is mainly here to make sure the test is working as intended - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - - ! Now reset time, change soil moisture, and make sure that irrigation happens as expected - this%time_prev = time_prev_orig - this%h2osoi_liq(:,:) = 100._r8 - call this%calculateAndApplyIrrigation() - call this%computeDeficits(deficits) - expected = sum(deficits(bounds%begp,1:nlevsoi)) / this%irrigation_params%irrig_length - ! Make sure that the test has been set up reasonably - to give a net deficit - @assertLessThan(0._r8, expected) - ! Here's the main assertion: - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - - end subroutine irrigation_flux_is_correct_on_second_day - - @Test - subroutine irrigation_excludes_deep_layers(this) - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - integer :: nlevirrig - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - nlevirrig = nlevsoi - 1 - call this%setupIrrigation(nlevirrig=nlevirrig) - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - ! Now on to the real assertion - expected = sum(deficits(bounds%begp,1:nlevirrig)) / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - end subroutine irrigation_excludes_deep_layers - - @Test - subroutine irrigation_excludes_bedrock_layers(this) - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - ! Make the last layer a bedrock layer: - col%nbedrock(bounds%begc) = nlevsoi - 1 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - expected = sum(deficits(bounds%begp,1:(nlevsoi-1))) / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - end subroutine irrigation_excludes_bedrock_layers - - @Test - subroutine no_irrigation_for_frozen_soil(this) - class(TestIrrigation), intent(inout) :: this - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - this%t_soisno(bounds%begc, :) = 272._r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - - end subroutine no_irrigation_for_frozen_soil - - @Test - subroutine no_irrigation_below_frozen_soil_layer(this) - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - - ! Setup - call this%setupSinglePatch() - call this%setupIrrigation() - this%t_soisno(bounds%begc, 2) = 272._r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - ! Only include deficit from top layer, since 2nd layer is frozen - expected = deficits(bounds%begp, 1) / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp)) - - end subroutine no_irrigation_below_frozen_soil_layer - - ! ------------------------------------------------------------------------ - ! Tests on multiple patches - ! ------------------------------------------------------------------------ - - @Test - subroutine irrigation_flux_is_correct_for_multiple_cols(this) - use unittestFilterBuilderMod, only : filter_from_range - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected1, expected2 - real(r8), parameter :: wt1 = 0.75_r8 - real(r8), parameter :: wt2 = 0.25_r8 - - ! Setup grid - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=wt1) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1._r8) - call unittest_add_column(my_li=li, ctype=2, wtlunit=wt2) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1._r8) - call unittest_subgrid_setup_end() - call filter_from_range(start=bounds%begp, end=bounds%endp, numf=this%numf, filter=this%filter) - - ! Other setup - call this%setupIrrigation() - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - expected1 = sum(deficits(bounds%begp,1:nlevsoi)) / this%irrigation_params%irrig_length - @assertEqual(expected1, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - expected2 = sum(deficits(bounds%endp,1:nlevsoi)) / this%irrigation_params%irrig_length - @assertEqual(expected2, this%irrigation%qflx_irrig_patch(bounds%endp), tolerance=tol) - ! Make sure this test had some power, by ensuring that the two points differ: - @assertTrue(expected1 /= expected2) - - end subroutine irrigation_flux_is_correct_for_multiple_cols - - @Test - subroutine multiple_patches_per_column(this) - ! If we have multiple patches on a column, some with irrigation and some without, - ! make sure (a) irrigation still happens, and (b) the column-level average irrigation - ! flux is computed correctly - class(TestIrrigation), intent(inout) :: this - real(r8), parameter :: wt_unirrig_1 = 0.25_r8 - real(r8), parameter :: wt_irrig = 0.5_r8 - real(r8), parameter :: wt_unirrig_2 = 0.25_r8 - real(r8), allocatable :: deficits(:,:) - real(r8) :: total_deficit - real(r8) :: col_total_deficit - real(r8) :: expected_col_flux - - ! Setup grid - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1._r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1._r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=wt_unirrig_1) - call unittest_add_patch(my_ci=ci, ptype=2, wtcol=wt_irrig) - call unittest_add_patch(my_ci=ci, ptype=3, wtcol=wt_unirrig_2) - call unittest_subgrid_setup_end() - call filter_from_range(start=bounds%begp, end=bounds%endp, numf=this%numf, filter=this%filter) - - ! Other setup - call this%setupIrrigation(maxpft=3) - pftcon%irrigated(1:3) = [0.0, 1.0, 0.0] - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - ! Note that only the second patch contributes to the average, because it is the only - ! irrigated patch - total_deficit = sum(deficits(bounds%begp+1, 1:nlevsoi)) - col_total_deficit = total_deficit * wt_irrig - expected_col_flux = col_total_deficit / this%irrigation_params%irrig_length - @assertEqual(expected_col_flux, this%irrigation%qflx_irrig_col(bounds%begc), tolerance=tol) - end subroutine multiple_patches_per_column - - @Test - subroutine irrigation_only_happens_within_filter(this) - class(TestIrrigation), intent(inout) :: this - - ! Setup grid: 3 columns, each with one patch - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_subgrid_setup_end() - this%numf = 1 - allocate(this%filter(1)) - this%filter = [bounds%begp + 1] - - ! Other setup - call this%setupIrrigation() - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - ! Irrigation happens within filter - @assertTrue(this%irrigation%qflx_irrig_patch(bounds%begp + 1) > 0._r8) - ! Irrigation does NOT happen outside filter - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%endp)) - - end subroutine irrigation_only_happens_within_filter - - @Test - subroutine test_multiple_patches_with_different_frozen_soil(this) - ! The point of this test is to exercise the somewhat complex logic for determining - ! frozen soil across multiple patches, due to the nesting of the p loop inside the - ! nlevsoi loop (rather than the other way around). - - use unittestFilterBuilderMod, only : filter_from_range - class(TestIrrigation), intent(inout) :: this - real(r8), allocatable :: deficits(:,:) - real(r8) :: expected - - ! Setup grid: 3 columns, each with one patch - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_subgrid_setup_end() - call filter_from_range(start=bounds%begp, end=bounds%endp, numf=this%numf, filter=this%filter) - - ! Other setup - call this%setupIrrigation() - ! first column has frozen soil - this%t_soisno(bounds%begc, :) = 272._r8 - ! second column has layer 2 frozen - this%t_soisno(bounds%begc+1, 2) = 272._r8 - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - call this%computeDeficits(deficits) - ! First patch should have no irrigation, because soil is all frozen - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp)) - ! Second patch should have irrigation just based on top layer, because 2nd layer is frozen - expected = deficits(bounds%begp+1, 1) / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%begp+1), tolerance=tol) - ! Third patch should have irrigation from all layers - expected = sum(deficits(bounds%endp,1:nlevsoi)) / this%irrigation_params%irrig_length - @assertEqual(expected, this%irrigation%qflx_irrig_patch(bounds%endp), tolerance=tol) - - end subroutine test_multiple_patches_with_different_frozen_soil - - @Test - subroutine volr_limiting_with_multiple_columns(this) - ! Make sure that volr limiting is applied correctly when there are multiple columns - ! on the grid cell - including one that is unirrigated. - use unittestFilterBuilderMod, only : filter_from_range - use GridcellType, only : grc - class(TestIrrigation), intent(inout) :: this - real(r8), parameter :: wt1 = 0.1_r8 - real(r8), parameter :: wt2 = 0.4_r8 - real(r8), parameter :: wt3 = 0.5_r8 ! unirrigated - real(r8), allocatable :: deficits(:,:) - real(r8) :: total_deficit1, total_deficit2 ! kg m-2 (i.e., mm) - real(r8) :: gridcell_total_deficit ! kg m-2 (i.e., mm) - real(r8) :: gridcell_total_deficit_as_volr ! m3 - real(r8) :: expected1, expected2 - - ! Fraction of total gridcell deficit that can be accommodated by volr - real(r8), parameter :: volr_fraction = 0.75_r8 - - ! Setup grid - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=wt1) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1._r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=wt2) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1._r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=wt3) - call unittest_add_patch(my_ci=ci, ptype=2, wtcol=1._r8) - call unittest_subgrid_setup_end() - call filter_from_range(start=bounds%begp, end=bounds%endp, numf=this%numf, filter=this%filter) - - ! Other setup - ! Keep irrig_river_volume_threshold set to 0 to simplify the calculations here - call this%setupIrrigation(maxpft=2, test_limit_irrigation=.true., & - irrig_river_volume_threshold=0._r8) - ! The first 2 patches are irrigated, the 3rd is unirrigated - pftcon%irrigated(1:2) = [1.0, 0.0] - - call this%computeDeficits(deficits) - total_deficit1 = sum(deficits(bounds%begp, 1:nlevsoi)) - total_deficit2 = sum(deficits(bounds%begp+1, 1:nlevsoi)) - gridcell_total_deficit = total_deficit1 * wt1 + total_deficit2 * wt2 - gridcell_total_deficit_as_volr = gridcell_total_deficit * grc%area(begg) * mm_times_km2_to_m3 - this%volr(begg) = gridcell_total_deficit_as_volr * volr_fraction - - ! Call irrigation routines - call this%calculateAndApplyIrrigation() - - ! Check result - expected1 = total_deficit1*volr_fraction / this%irrigation_params%irrig_length - @assertEqual(expected1, this%irrigation%qflx_irrig_patch(bounds%begp), tolerance=tol) - expected2 = total_deficit2*volr_fraction / this%irrigation_params%irrig_length - @assertEqual(expected2, this%irrigation%qflx_irrig_patch(bounds%begp+1), tolerance=tol) - ! Check of unirrigated patch isn't central to this test, but we might as well check - ! it while we're at it: - @assertEqual(0._r8, this%irrigation%qflx_irrig_patch(bounds%begp+2)) - end subroutine volr_limiting_with_multiple_columns - -end module test_irrigation diff --git a/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt b/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt deleted file mode 100644 index cfd1e3a4bb..0000000000 --- a/src/biogeophys/test/SnowHydrology_test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set (pfunit_sources - test_SnowHydrology_initSnowLayers.pf - test_SnowHydrology_newSnowBulkDensity.pf - test_SnowHydrology_SnowCappingExcess.pf) - -create_pFUnit_test(SnowHydrology test_SnowHydrology_exe - "${pfunit_sources}" "") - -target_link_libraries(test_SnowHydrology_exe clm csm_share esmf_wrf_timemgr) diff --git a/src/biogeophys/test/SnowHydrology_test/README b/src/biogeophys/test/SnowHydrology_test/README deleted file mode 100644 index e43325dda6..0000000000 --- a/src/biogeophys/test/SnowHydrology_test/README +++ /dev/null @@ -1,4 +0,0 @@ -The unit tests of InitSnowLayers were put here largely for the sake of working -out some bugs in the initial implementation. Since this code is only used during -cold start (and thus is not critical), these unit tests can be removed if they -become a maintenance problem. diff --git a/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_SnowCappingExcess.pf b/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_SnowCappingExcess.pf deleted file mode 100644 index 7c67a69c9a..0000000000 --- a/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_SnowCappingExcess.pf +++ /dev/null @@ -1,230 +0,0 @@ -module test_SnowHydrology_SnowCappingExcess - - ! Tests of SnowHydrologyMod: SnowCappingExcess - - use pfunit_mod - use SnowHydrologyMod - use TopoMod, only : topo_type - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestFilterBuilderMod - use unittestTimeManagerMod - use unittestArrayMod, only : col_array - use clm_varcon, only : h2osno_max - use clm_varpar, only : nlevsno - use landunit_varcon, only : istsoil, istice_mec - - implicit none - - @TestCase - type, extends(TestCase) :: TestSCE - contains - procedure :: setUp - procedure :: tearDown - end type TestSCE - - real(r8), parameter :: tol = 1.e-13_r8 - - ! Make sure the h2osno_max value is substantially larger than the reset_snow_h2osno - ! value, so that tests make sense. - real(r8), parameter :: my_h2osno_max = reset_snow_h2osno + 1000._r8 - -contains - - subroutine setUp(this) - class(TestSCE), intent(inout) :: this - h2osno_max = my_h2osno_max - call SnowHydrologySetControlForTesting( & - set_reset_snow = .false., & - set_reset_snow_glc = .false., & - set_reset_snow_glc_ela = 1.e9_r8) - call unittest_timemgr_setup() - end subroutine setUp - - subroutine tearDown(this) - class(TestSCE), intent(inout) :: this - call unittest_subgrid_teardown() - call unittest_timemgr_teardown() - end subroutine tearDown - - @Test - subroutine SnowCappingExcess_OneExceeds(this) - ! Test with one column that exceeds the max, two that don't - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer, allocatable :: filter_snowc(:) - - call setup_landunit_ncols(ltype=istsoil, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [h2osno_max - 1._r8, h2osno_max + my_excess, h2osno_max - 1._r8] - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(0._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, my_excess, 0._r8], h2osno_excess, tolerance=tol) - @assertTrue(apply_runoff(2)) - end subroutine SnowCappingExcess_OneExceeds - - @Test - subroutine SnowCappingExcess_ResetNonGlacier(this) - ! With reset_snow = .true., should reset non-glacier points - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer, allocatable :: filter_snowc(:) - - call SnowHydrologySetControlForTesting(set_reset_snow = .true.) - call setup_landunit_ncols(ltype=istsoil, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [reset_snow_h2osno - 1._r8, reset_snow_h2osno + my_excess, reset_snow_h2osno - 1._r8] - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(0._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, my_excess, 0._r8], h2osno_excess, tolerance=tol) - @assertFalse(apply_runoff(2)) - end subroutine SnowCappingExcess_ResetNonGlacier - - @Test - subroutine SnowCappingExcess_DoNotResetGlacier(this) - ! With reset_snow = .true. but reset_snow_glc = .false., should not reset glacier - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer, allocatable :: filter_snowc(:) - - call SnowHydrologySetControlForTesting(set_reset_snow = .true., & - set_reset_snow_glc = .false., set_reset_snow_glc_ela = 1000._r8) - call setup_landunit_ncols(ltype=istice_mec, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [reset_snow_h2osno - 1._r8, reset_snow_h2osno + my_excess, reset_snow_h2osno - 1._r8] - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(0._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, 0._r8, 0._r8], h2osno_excess, tolerance=tol) - end subroutine SnowCappingExcess_DoNotResetGlacier - - @Test - subroutine SnowCappingExcess_ResetLowGlacier(this) - ! With reset_snow_glc = .true., should reset low glacier points - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8), parameter :: ela = 1000._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer, allocatable :: filter_snowc(:) - - call SnowHydrologySetControlForTesting(set_reset_snow_glc = .true., & - set_reset_snow_glc_ela = ela) - call setup_landunit_ncols(ltype=istice_mec, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [reset_snow_h2osno - 1._r8, reset_snow_h2osno + my_excess, reset_snow_h2osno - 1._r8] - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(ela - 1._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, my_excess, 0._r8], h2osno_excess, tolerance=tol) - @assertFalse(apply_runoff(2)) - end subroutine SnowCappingExcess_ResetLowGlacier - - @Test - subroutine SnowCappingExcess_DoNotResetHighGlacier(this) - ! With reset_snow_glc = .true., should not reset high glacier points - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8), parameter :: ela = 1000._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer, allocatable :: filter_snowc(:) - - call SnowHydrologySetControlForTesting(set_reset_snow_glc = .true., & - set_reset_snow_glc_ela = ela) - call setup_landunit_ncols(ltype=istice_mec, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [reset_snow_h2osno - 1._r8, reset_snow_h2osno + my_excess, reset_snow_h2osno - 1._r8] - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(ela + 1._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, 0._r8, 0._r8], h2osno_excess, tolerance=tol) - end subroutine SnowCappingExcess_DoNotResetHighGlacier - - @Test - subroutine SnowCappingExcess_DoNotResetNonGlacier(this) - ! With reset_snow_glc = .true. but reset_snow = .false., should not reset non-glacier - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer, allocatable :: filter_snowc(:) - - call SnowHydrologySetControlForTesting(set_reset_snow = .false., & - set_reset_snow_glc = .true., set_reset_snow_glc_ela = 1000._r8) - call setup_landunit_ncols(ltype=istsoil, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [reset_snow_h2osno - 1._r8, reset_snow_h2osno + my_excess, reset_snow_h2osno - 1._r8] - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(0._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, 0._r8, 0._r8], h2osno_excess, tolerance=tol) - end subroutine SnowCappingExcess_DoNotResetNonGlacier - - @Test - subroutine SnowCappingExcess_DoNotResetLater(this) - ! Make sure resetting doesn't happen after the given number of time steps - class(TestSCE), intent(inout) :: this - real(r8) :: h2osno(3) - real(r8), parameter :: my_excess = 1._r8 - real(r8) :: h2osno_excess(3) - logical :: apply_runoff(3) - integer :: num_snowc - integer :: nstep - integer, allocatable :: filter_snowc(:) - - call SnowHydrologySetControlForTesting(set_reset_snow = .true.) - call setup_landunit_ncols(ltype=istsoil, ctypes=[1,1,1], cweights=[0.5_r8, 0.25_r8, 0.25_r8]) - call filter_from_range(bounds%begc, bounds%endc, num_snowc, filter_snowc) - ! Column 2 exceeds the max, other columns don't - h2osno = [reset_snow_h2osno - 1._r8, reset_snow_h2osno + my_excess, reset_snow_h2osno - 1._r8] - nstep = nlevsno * reset_snow_timesteps_per_layer + 1 - call unittest_timemgr_set_nstep(nstep) - - call SnowCappingExcess(bounds, num_snowc, filter_snowc, & - h2osno=h2osno, topo=col_array(0._r8), & - h2osno_excess=h2osno_excess, apply_runoff=apply_runoff) - - @assertEqual([0._r8, 0._r8, 0._r8], h2osno_excess, tolerance=tol) - end subroutine SnowCappingExcess_DoNotResetLater - -end module test_SnowHydrology_SnowCappingExcess diff --git a/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_initSnowLayers.pf b/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_initSnowLayers.pf deleted file mode 100644 index 2d6dcee480..0000000000 --- a/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_initSnowLayers.pf +++ /dev/null @@ -1,73 +0,0 @@ -module test_SnowHydrology_initSnowLayers - - ! Tests of SnowHydrologyMod: initSnowLayers - - use pfunit_mod - use SnowHydrologyMod - use shr_kind_mod, only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use ColumnType, only : col - use clm_varpar, only : nlevsno - - implicit none - - @TestCase - type, extends(TestCase) :: TestSnowHydrology - contains - procedure :: setUp - procedure :: tearDown - end type TestSnowHydrology - -contains - - subroutine setUp(this) - class(TestSnowHydrology), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestSnowHydrology), intent(inout) :: this - call unittest_subgrid_teardown() - end subroutine tearDown - - @Test - subroutine test_initSnowLayers_depth0_snl(this) - class(TestSnowHydrology), intent(inout) :: this - real(r8), allocatable :: snow_depth(:) - - ! Setup - nlevsno = 5 - call setup_single_veg_patch(pft_type = 1) - allocate(snow_depth(bounds%begc:bounds%endc)) - snow_depth(:) = 0._r8 - col%zi(bounds%begc:bounds%endc,0) = 0._r8 ! Normally initialized elsewhere (initVerticalMod) - - ! Exercise - call InitSnowLayers(bounds, snow_depth) - - ! Verify - @assertEqual(0, col%snl(bounds%begc)) - - end subroutine test_initSnowLayers_depth0_snl - - @Test - subroutine test_initSnowLayers_depth1_snl(this) - class(TestSnowHydrology), intent(inout) :: this - real(r8), allocatable :: snow_depth(:) - - ! Setup - nlevsno = 5 - call setup_single_veg_patch(pft_type = 1) - allocate(snow_depth(bounds%begc:bounds%endc)) - snow_depth(:) = 1._r8 - col%zi(bounds%begc:bounds%endc,0) = 0._r8 ! Normally initialized elsewhere (initVerticalMod) - - ! Exercise - call InitSnowLayers(bounds, snow_depth) - - ! Verify - @assertEqual(-5, col%snl(bounds%begc)) - - end subroutine test_initSnowLayers_depth1_snl - -end module test_SnowHydrology_initSnowLayers diff --git a/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf b/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf deleted file mode 100644 index db8c7ba980..0000000000 --- a/src/biogeophys/test/SnowHydrology_test/test_SnowHydrology_newSnowBulkDensity.pf +++ /dev/null @@ -1,260 +0,0 @@ -module test_SnowHydrology_newSnowBulkDensity - - ! Tests of SnowHydrologyMod: newSnowBulkDensity - - use pfunit_mod - use unittestSubgridMod - use SnowHydrologyMod - use atm2lndType , only : atm2lnd_type - use clm_varcon , only : tfrz - use shr_kind_mod, only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestSnowHydrology - integer :: numf - integer, allocatable :: filter(:) - real(r8), allocatable :: bifall(:) - type(atm2lnd_type) :: atm2lnd_inst - real(r8) :: NEG15C - real(r8) :: TWOC - real(r8) :: MINSNOWDENSITY - real(r8) :: MAXSNOWDENSITY - real(r8) :: MAXWINDEDSNOWDENSITY - contains - procedure :: setUp - procedure :: tearDown - end type TestSnowHydrology - - - real(r8), parameter :: tol = 1.e-13 ! tolerance for error checks - -contains - - subroutine setUp(this) - use unittestSimpleSubgridSetupsMod, only : setup_single_veg_patch - use unittestFilterBuilderMod, only : filter_from_range - class(TestSnowHydrology), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call filter_from_range(start=bounds%begc, end=bounds%endc, numf=this%numf, filter=this%filter) - @assertEqual( this%numf, 1 ) - call this%atm2lnd_inst%InitForTesting( bounds ) - this%atm2lnd_inst%forc_wind_grc(bounds%begg) = 0.0_r8 - allocate( this%bifall(bounds%begc:bounds%endc) ) - this%NEG15C = tfrz - 15._r8 - this%TWOC = tfrz + 2._r8 - ! These constants agree with the hard-coded values in newSnowBulkDensity - this%MINSNOWDENSITY = 50.0_r8 - this%MAXSNOWDENSITY = 170.0_r8 - this%MAXWINDEDSNOWDENSITY = 270.0_r8 - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=LoTmpDnsTruncatedAnderson1976 ) - end subroutine setUp - - subroutine tearDown(this) - class(TestSnowHydrology), intent(inout) :: this - - call unittest_subgrid_teardown() - call this%atm2lnd_inst%Clean( ) - deallocate( this%filter ) - this%numf = -1 - deallocate( this%bifall ) - end subroutine tearDown - - @Test - subroutine newSnowBulkDensity_neg15_TruncatedMethod(this) - ! Test the input at negative 15 degrees C - class(TestSnowHydrology), intent(inout) :: this - real(r8) :: minsnowdensity - - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=LoTmpDnsTruncatedAnderson1976 ) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%NEG15C - epsilon(this%NEG15C) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - write(*,*) 'forc_t = ', this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) - write(*,*) 'min, max = ', this%MINSNOWDENSITY, this%MAXSNOWDENSITY - write(*,*) 'bifall = ', this%bifall(bounds%begc) - - @assertLessThanOrEqual( this%MINSNOWDENSITY, this%bifall(bounds%begc), message="at -15C" ) - minsnowdensity = this%bifall(bounds%begc) - - ! Test that below neg15 stays at the same value - do while( this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) > (tfrz - 100.0_r8) ) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) - 0.1_r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertEqual(this%bifall(bounds%begc), minsnowdensity, message="below -15C" ) - end do - - end subroutine newSnowBulkDensity_neg15_TruncatedMethod - - @Test - subroutine newSnowBulkDensity_neg15_SlaterDensity(this) - ! Test the input at negative 15 degrees C - class(TestSnowHydrology), intent(inout) :: this - real(r8) :: minsnowdensity - - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=LoTmpDnsSlater2017 ) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%NEG15C - epsilon(this%NEG15C) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - - @assertLessThanOrEqual( this%MINSNOWDENSITY, this%bifall(bounds%begc), message="at -15C SlaterDensity" ) - minsnowdensity = this%bifall(bounds%begc) - - ! Test that from -15 to -100, stays within bounds - do while( this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) > (tfrz - 100.0_r8) ) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) - 0.1_r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertLessThan( minsnowdensity, this%bifall(bounds%begc), message="below -15C Slater Density > min" ) - @assertGreaterThan( this%MAXSNOWDENSITY, this%bifall(bounds%begc), message="below -15C Slater Density < max" ) - end do - - end subroutine newSnowBulkDensity_neg15_SlaterDensity - - @Test - subroutine newSnowBulkDensity_lowT_SlaterDensity(this) - ! Test the input for very low temperatures: density should be no lower than at higher - ! temperatures - class(TestSnowHydrology), intent(inout) :: this - real(r8) :: density_at_neg_57_c(1) - - ! Setup - - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=LoTmpDnsSlater2017 ) - - ! Get density at -57 C. This is close to the highest density for the cold-temperature - ! regime. - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = tfrz - 57._r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, density_at_neg_57_c) - - ! Exercise: Get density at very cold temperature: just above absolute zero - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = 0.1_r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - - ! Make sure that (1) density at -57 C is greater than minsnowdensity, and (2) density - ! at really cold T is greater than or equal to than density at -57 C (which is close - ! to the maximum snow density for the cold-temperature regime). - @assertLessThan(this%MINSNOWDENSITY, density_at_neg_57_c(1), message="density at -57C > min") - @assertLessThanOrEqual(density_at_neg_57_c(1), this%bifall(bounds%begc), message="density at very cold > density at -57C") - - end subroutine newSnowBulkDensity_lowT_SlaterDensity - - - - @Test - subroutine checkWindDependentDensity(this) - ! Test the range of the wind denpendent density - class(TestSnowHydrology), intent(inout) :: this - real(r8) :: base_density, last_density, diff - - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = (this%NEG15C + this%TWOC)*0.5 - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=LoTmpDnsTruncatedAnderson1976 ) - this%atm2lnd_inst%forc_wind_grc(bounds%begg) = 0.0_r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - base_density = this%bifall(bounds%begc) - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.true., & - set_new_snow_density=LoTmpDnsTruncatedAnderson1976 ) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertEqual( base_density, this%bifall(bounds%begc), tolerance=1.0e-12_r8, message="Expect no change with zero wind" ) - write(*,*) 'without wind-depend = ', base_density, ' with wind@0=', this%bifall(bounds%begc) - base_density = this%bifall(bounds%begc) - - last_density = base_density - ! Check that monotone increasing with wind - do while ( this%atm2lnd_inst%forc_wind_grc(bounds%begg) < 30.0 ) - this%atm2lnd_inst%forc_wind_grc(bounds%begg) = this%atm2lnd_inst%forc_wind_grc(bounds%begg) + 0.1 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertLessThanOrEqual( base_density, this%bifall(bounds%begc), message="Density should increase with wind" ) - @assertLessThanOrEqual( last_density, this%bifall(bounds%begc), message="Density should increase with wind" ) - diff = this%bifall(bounds%begc)-base_density - @assertLessThanOrEqual( diff, this%MAXWINDEDSNOWDENSITY, message="density increase with wind < max" ) - @assertGreaterThanOrEqual(this%bifall(bounds%begc), this%MINSNOWDENSITY, message="density with wind > min" ) - last_density = this%bifall(bounds%begc) - end do - ! Check at certain values... - this%atm2lnd_inst%forc_wind_grc(bounds%begg) = 5.0_R8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - diff = this%bifall(bounds%begc)-base_density - @assertEqual( 90.0_r8, diff, message="at 5m/sec should be around 90", tolerance=10.0_r8 ) - this%atm2lnd_inst%forc_wind_grc(bounds%begg) = 10.0_R8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - diff = this%bifall(bounds%begc)-base_density - @assertEqual( 230.0_r8, diff, message="at 10m/sec should be around 230", tolerance=10.0_r8 ) - this%atm2lnd_inst%forc_wind_grc(bounds%begg) = 15.0_R8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - diff = this%bifall(bounds%begc)-base_density - @assertEqual( 258.0_r8, diff, message="at 10m/sec should be around 258", tolerance=8.0_r8 ) - - end subroutine checkWindDependentDensity - - @Test - subroutine newSnowBulkDensity_2C(this) - ! Test the input at 2 degrees C - class(TestSnowHydrology), intent(inout) :: this - real(r8) :: maxsnowdensity - integer :: density_type - - do density_type = 1, 2 - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=density_type ) - write(*,*) 'snow density type = ', density_type - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%TWOC + epsilon(this%TWOC) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - - @assertGreaterThan( this%MAXSNOWDENSITY, this%bifall(bounds%begc), message="at 2C" ) - maxsnowdensity = this%bifall(bounds%begc) - - ! Test that stays the same above 2C - do while( this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) < (tfrz + 100.0_r8) ) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) + 0.1_r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertEqual(this%bifall(bounds%begc), maxsnowdensity, message="above 2C" ) - end do - end do - end subroutine newSnowBulkDensity_2C - - @Test - subroutine newSnowBulkDensity_monotoneincreasing(this) - ! Test that between -15C and 2C is monotone increasing - class(TestSnowHydrology), intent(inout) :: this - real(r8) :: minsnowdensity, maxsnowdensity, lastsnowdensity - integer :: density_type - - do density_type = 1, 2 - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=density_type ) - write(*,*) 'snow density type = ', density_type - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%TWOC + epsilon(this%TWOC) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - maxsnowdensity = this%bifall(bounds%begc) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%NEG15C - epsilon(this%NEG15C) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - minsnowdensity = this%bifall(bounds%begc) - - lastsnowdensity = minsnowdensity - ! Test that between -15 and 2 C is between range and monotone increasing - do while( this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) < this%TWOC ) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) = this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc) + 0.1_r8 - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertLessThanOrEqual( this%bifall(bounds%begc), maxsnowdensity, message="< max" ) - @assertGreaterThanOrEqual(this%bifall(bounds%begc), minsnowdensity, message="> min" ) - @assertGreaterThanOrEqual(this%bifall(bounds%begc), lastsnowdensity, message="> last" ) - lastsnowdensity = this%bifall(bounds%begc) - ! Check that both density types give same answers - if ( density_type == 1 ) then - call SnowHydrologySetControlForTesting( set_winddep_snowdensity=.false., & - set_new_snow_density=LoTmpDnsSlater2017 ) - call NewSnowBulkDensity(bounds, this%numf, this%filter, this%atm2lnd_inst, this%bifall) - @assertEqual( this%bifall(bounds%begc), lastsnowdensity, message="Density methods same for mid temps" ) - end if - end do - end do - - end subroutine newSnowBulkDensity_monotoneincreasing - - -end module test_SnowHydrology_newSnowBulkDensity diff --git a/src/biogeophys/test/TotalWaterAndHeat_test/CMakeLists.txt b/src/biogeophys/test/TotalWaterAndHeat_test/CMakeLists.txt deleted file mode 100644 index 67f2a4812e..0000000000 --- a/src/biogeophys/test/TotalWaterAndHeat_test/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set (pfunit_sources - test_total_water_and_heat.pf) - -# extra sources used for this test, which are not .pf files -# (currently none) -set (extra_sources - ) - -create_pFUnit_test(total_water_and_heat test_total_water_and_heat_exe - "${pfunit_sources}" "${extra_sources}") - -target_link_libraries(test_total_water_and_heat_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/biogeophys/test/TotalWaterAndHeat_test/test_total_water_and_heat.pf b/src/biogeophys/test/TotalWaterAndHeat_test/test_total_water_and_heat.pf deleted file mode 100644 index 05cb5eed57..0000000000 --- a/src/biogeophys/test/TotalWaterAndHeat_test/test_total_water_and_heat.pf +++ /dev/null @@ -1,187 +0,0 @@ -module test_total_water_and_heat - - ! Tests of TotalWaterAndHeatMod - - use pfunit_mod - use TotalWaterAndHeatMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use clm_varcon, only : tfrz, cpliq, hfus - - implicit none - - @TestCase - type, extends(TestCase) :: TestTWAH - contains - procedure :: setUp - procedure :: tearDown - end type TestTWAH - - real(r8), parameter :: tol = 1.e-13_r8 - real(r8), parameter :: irrelevant_temp = tfrz + 9999._r8 - -contains - - subroutine setUp(this) - class(TestTWAH), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestTWAH), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - ! ------------------------------------------------------------------------ - ! Tests of LiquidWaterHeat - ! ------------------------------------------------------------------------ - - @Test - subroutine LiquidWaterHeatBasic(this) - class(TestTWAH), intent(inout) :: this - real(r8), parameter :: h2o = 3._r8 - real(r8), parameter :: temp_above_base = 4._r8 - real(r8), parameter :: temp = heat_base_temp + temp_above_base - real(r8) :: heat - real(r8) :: expected_heat, expected_latent_heat, expected_total - - heat = LiquidWaterHeat(temp = temp, h2o = h2o) - expected_latent_heat = h2o * hfus - expected_heat = h2o * cpliq * temp_above_base - expected_total = expected_latent_heat + expected_heat - - @assertEqual(expected_total, heat, tolerance=tol) - end subroutine LiquidWaterHeatBasic - - ! ------------------------------------------------------------------------ - ! Tests of AdjustDeltaHeatForDeltaLiq - ! ------------------------------------------------------------------------ - - @Test - subroutine AdjustDeltaHeatNoDeltaLiq(this) - class(TestTWAH), intent(inout) :: this - real(r8) :: delta_heat(1) - real(r8), parameter :: delta_liq = 0._r8 - real(r8), parameter :: delta_heat_init = 17._r8 - - call setup_single_veg_patch(pft_type = 1) - - delta_heat(1) = delta_heat_init - - call AdjustDeltaHeatForDeltaLiq(bounds, [delta_liq], & - [irrelevant_temp], [irrelevant_temp], & - delta_heat) - - @assertEqual(delta_heat(1), delta_heat_init) - end subroutine AdjustDeltaHeatNoDeltaLiq - - @Test - subroutine AdjustDeltaHeatNegativeDeltaLiq(this) - class(TestTWAH), intent(inout) :: this - real(r8) :: delta_heat(1) - real(r8) :: heat_diff - real(r8) :: expected_total_heat - real(r8), parameter :: liquid_water_temp1 = tfrz + 3._r8 - real(r8), parameter :: delta_heat_init = 17._r8 - real(r8), parameter :: delta_liq = -2._r8 - - call setup_single_veg_patch(pft_type = 1) - - delta_heat(1) = delta_heat_init - - call AdjustDeltaHeatForDeltaLiq(bounds, [delta_liq], & - [liquid_water_temp1], [irrelevant_temp], & - delta_heat) - heat_diff = delta_heat(1) - delta_heat_init - - expected_total_heat = LiquidWaterHeat( & - temp = liquid_water_temp1, & - h2o = -delta_liq) - - @assertLessThan(0._r8, heat_diff) - @assertEqual(expected_total_heat, heat_diff, tolerance=tol) - - end subroutine AdjustDeltaHeatNegativeDeltaLiq - - @Test - subroutine AdjustDeltaHeatPositiveDeltaLiq(this) - class(TestTWAH), intent(inout) :: this - real(r8) :: delta_heat(1) - real(r8) :: heat_diff - real(r8) :: expected_total_heat - real(r8), parameter :: liquid_water_temp2 = tfrz + 3._r8 - real(r8), parameter :: delta_heat_init = 17._r8 - real(r8), parameter :: delta_liq = 2._r8 - - call setup_single_veg_patch(pft_type = 1) - - delta_heat(1) = delta_heat_init - - call AdjustDeltaHeatForDeltaLiq(bounds, [delta_liq], & - [irrelevant_temp], [liquid_water_temp2], & - delta_heat) - heat_diff = delta_heat(1) - delta_heat_init - - expected_total_heat = LiquidWaterHeat( & - temp = liquid_water_temp2, & - h2o = -delta_liq) - - @assertGreaterThan(0._r8, heat_diff) - @assertEqual(expected_total_heat, heat_diff, tolerance=tol) - - end subroutine AdjustDeltaHeatPositiveDeltaLiq - - @Test - subroutine AdjustDeltaHeatVeryColdTemperature(this) - class(TestTWAH), intent(inout) :: this - real(r8) :: delta_heat(1) - real(r8) :: heat_diff - real(r8) :: expected_total_heat - real(r8), parameter :: liquid_water_temp2 = DeltaLiqMinTemp - 1._r8 - real(r8), parameter :: delta_heat_init = 17._r8 - real(r8), parameter :: delta_liq = 2._r8 - - call setup_single_veg_patch(pft_type = 1) - - delta_heat(1) = delta_heat_init - - call AdjustDeltaHeatForDeltaLiq(bounds, [delta_liq], & - [irrelevant_temp], [liquid_water_temp2], & - delta_heat) - heat_diff = delta_heat(1) - delta_heat_init - - expected_total_heat = LiquidWaterHeat( & - temp = DeltaLiqMinTemp, & - h2o = -delta_liq) - - @assertEqual(expected_total_heat, heat_diff, tolerance=tol) - end subroutine AdjustDeltaHeatVeryColdTemperature - - @Test - subroutine AdjustDeltaHeatVeryHotTemperature(this) - class(TestTWAH), intent(inout) :: this - real(r8) :: delta_heat(1) - real(r8) :: heat_diff - real(r8) :: expected_total_heat - real(r8), parameter :: liquid_water_temp2 = DeltaLiqMaxTemp + 1._r8 - real(r8), parameter :: delta_heat_init = 17._r8 - real(r8), parameter :: delta_liq = 2._r8 - - call setup_single_veg_patch(pft_type = 1) - - delta_heat(1) = delta_heat_init - - call AdjustDeltaHeatForDeltaLiq(bounds, [delta_liq], & - [irrelevant_temp], [liquid_water_temp2], & - delta_heat) - heat_diff = delta_heat(1) - delta_heat_init - - expected_total_heat = LiquidWaterHeat( & - temp = DeltaLiqMaxTemp, & - h2o = -delta_liq) - - @assertEqual(expected_total_heat, heat_diff, tolerance=tol) - end subroutine AdjustDeltaHeatVeryHotTemperature - -end module test_total_water_and_heat diff --git a/src/cpl/clm_cpl_indices.F90 b/src/cpl/clm_cpl_indices.F90 deleted file mode 100644 index 525b709cc6..0000000000 --- a/src/cpl/clm_cpl_indices.F90 +++ /dev/null @@ -1,330 +0,0 @@ -module clm_cpl_indices - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing the indices for the fields passed between CLM and - ! the driver. Includes the River Transport Model fields (RTM) and the - ! fields needed by the land-ice component (sno). - ! - ! !USES: - - use shr_sys_mod, only : shr_sys_abort - implicit none - - SAVE - private ! By default make data private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: clm_cpl_indices_set ! Set the coupler indices - ! - ! !PUBLIC DATA MEMBERS: - ! - integer , public :: glc_nec ! number of elevation classes for glacier_mec landunits - ! (from coupler) - must equal maxpatch_glcmec from namelist - - ! lnd -> drv (required) - - integer, public ::index_l2x_Flrl_rofsur ! lnd->rtm input liquid surface fluxes - integer, public ::index_l2x_Flrl_rofgwl ! lnd->rtm input liquid gwl fluxes - integer, public ::index_l2x_Flrl_rofsub ! lnd->rtm input liquid subsurface fluxes - integer, public ::index_l2x_Flrl_rofi ! lnd->rtm input frozen fluxes - integer, public ::index_l2x_Flrl_irrig ! irrigation withdrawal - - integer, public ::index_l2x_Sl_t ! temperature - integer, public ::index_l2x_Sl_tref ! 2m reference temperature - integer, public ::index_l2x_Sl_qref ! 2m reference specific humidity - integer, public ::index_l2x_Sl_avsdr ! albedo: direct , visible - integer, public ::index_l2x_Sl_anidr ! albedo: direct , near-ir - integer, public ::index_l2x_Sl_avsdf ! albedo: diffuse, visible - integer, public ::index_l2x_Sl_anidf ! albedo: diffuse, near-ir - integer, public ::index_l2x_Sl_snowh ! snow height - integer, public ::index_l2x_Sl_u10 ! 10m wind - integer, public ::index_l2x_Sl_ddvel ! dry deposition velocities (optional) - integer, public ::index_l2x_Sl_fv ! friction velocity - integer, public ::index_l2x_Sl_ram1 ! aerodynamical resistance - integer, public ::index_l2x_Sl_soilw ! volumetric soil water - integer, public ::index_l2x_Fall_taux ! wind stress, zonal - integer, public ::index_l2x_Fall_tauy ! wind stress, meridional - integer, public ::index_l2x_Fall_lat ! latent heat flux - integer, public ::index_l2x_Fall_sen ! sensible heat flux - integer, public ::index_l2x_Fall_lwup ! upward longwave heat flux - integer, public ::index_l2x_Fall_evap ! evaporation water flux - integer, public ::index_l2x_Fall_swnet ! heat flux shortwave net - integer, public ::index_l2x_Fall_fco2_lnd ! co2 flux **For testing set to 0 - integer, public ::index_l2x_Fall_flxdst1 ! dust flux size bin 1 - integer, public ::index_l2x_Fall_flxdst2 ! dust flux size bin 2 - integer, public ::index_l2x_Fall_flxdst3 ! dust flux size bin 3 - integer, public ::index_l2x_Fall_flxdst4 ! dust flux size bin 4 - integer, public ::index_l2x_Fall_flxvoc ! MEGAN fluxes - integer, public ::index_l2x_Fall_flxfire ! Fire fluxes - integer, public ::index_l2x_Sl_ztopfire ! Top of fire emissions (m) - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, allocatable, public ::index_l2x_Sl_tsrf(:) ! glc MEC temperature - integer, allocatable, public ::index_l2x_Sl_topo(:) ! glc MEC topo height - integer, allocatable, public ::index_l2x_Flgl_qice(:) ! glc MEC ice flux - - integer, public ::index_x2l_Sa_methane - integer, public ::index_l2x_Fall_methane - - integer, public :: nflds_l2x = 0 - - ! drv -> lnd (required) - - integer, public ::index_x2l_Sa_z ! bottom atm level height - integer, public ::index_x2l_Sa_topo ! atm surface height (m) - integer, public ::index_x2l_Sa_u ! bottom atm level zon wind - integer, public ::index_x2l_Sa_v ! bottom atm level mer wind - integer, public ::index_x2l_Sa_ptem ! bottom atm level pot temp - integer, public ::index_x2l_Sa_shum ! bottom atm level spec hum - integer, public ::index_x2l_Sa_pbot ! bottom atm level pressure - integer, public ::index_x2l_Sa_tbot ! bottom atm level temp - integer, public ::index_x2l_Faxa_lwdn ! downward lw heat flux - integer, public ::index_x2l_Faxa_rainc ! prec: liquid "convective" - integer, public ::index_x2l_Faxa_rainl ! prec: liquid "large scale" - integer, public ::index_x2l_Faxa_snowc ! prec: frozen "convective" - integer, public ::index_x2l_Faxa_snowl ! prec: frozen "large scale" - integer, public ::index_x2l_Faxa_swndr ! sw: nir direct downward - integer, public ::index_x2l_Faxa_swvdr ! sw: vis direct downward - integer, public ::index_x2l_Faxa_swndf ! sw: nir diffuse downward - integer, public ::index_x2l_Faxa_swvdf ! sw: vis diffuse downward - integer, public ::index_x2l_Sa_co2prog ! bottom atm level prognostic co2 - integer, public ::index_x2l_Sa_co2diag ! bottom atm level diagnostic co2 - integer, public ::index_x2l_Faxa_bcphidry ! flux: Black Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_bcphodry ! flux: Black Carbon hydrophobic dry deposition - integer, public ::index_x2l_Faxa_bcphiwet ! flux: Black Carbon hydrophilic wet deposition - integer, public ::index_x2l_Faxa_ocphidry ! flux: Organic Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_ocphodry ! flux: Organic Carbon hydrophobic dry deposition - integer, public ::index_x2l_Faxa_ocphiwet ! flux: Organic Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_dstwet1 ! flux: Size 1 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet2 ! flux: Size 2 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet3 ! flux: Size 3 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet4 ! flux: Size 4 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstdry1 ! flux: Size 1 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry2 ! flux: Size 2 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry3 ! flux: Size 3 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry4 ! flux: Size 4 dust -- dry deposition - - integer, public ::index_x2l_Faxa_nhx ! flux nhx from atm - integer, public ::index_x2l_Faxa_noy ! flux noy from atm - - integer, public ::index_x2l_Flrr_flood ! rtm->lnd rof flood flux - integer, public ::index_x2l_Flrr_volr ! rtm->lnd rof volr total volume - integer, public ::index_x2l_Flrr_volrmch ! rtm->lnd rof volr main channel volume - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, allocatable, public ::index_x2l_Sg_ice_covered(:) ! Fraction of glacier from glc model - integer, allocatable, public ::index_x2l_Sg_topo(:) ! Topo height from glc model - integer, allocatable, public ::index_x2l_Flgg_hflx(:) ! Heat flux from glc model - - integer, public ::index_x2l_Sg_icemask - integer, public ::index_x2l_Sg_icemask_coupled_fluxes - - integer, public :: nflds_x2l = 0 - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine clm_cpl_indices_set( ) - ! - ! !DESCRIPTION: - ! Set the coupler indices needed by the land model coupler - ! interface. - ! - ! !USES: - use seq_flds_mod , only: seq_flds_x2l_fields, seq_flds_l2x_fields - use mct_mod , only: mct_aVect, mct_aVect_init, mct_avect_indexra - use mct_mod , only: mct_aVect_clean, mct_avect_nRattr - use seq_drydep_mod , only: drydep_fields_token, lnd_drydep - use shr_megan_mod , only: shr_megan_fields_token, shr_megan_mechcomps_n - use shr_fire_emis_mod,only: shr_fire_emis_fields_token, shr_fire_emis_ztop_token, shr_fire_emis_mechcomps_n - use clm_varctl , only: ndep_from_cpl - use glc_elevclass_mod, only: glc_get_num_elevation_classes, glc_elevclass_as_string - ! - ! !ARGUMENTS: - implicit none - ! - ! !REVISION HISTORY: - ! Author: Mariana Vertenstein - ! 01/2011, Erik Kluzek: Added protex headers - ! - ! !LOCAL VARIABLES: - type(mct_aVect) :: l2x ! temporary, land to coupler - type(mct_aVect) :: x2l ! temporary, coupler to land - integer :: num - character(len=:), allocatable :: nec_str ! string version of glc elev. class number - character(len=64) :: name - character(len=32) :: subname = 'clm_cpl_indices_set' ! subroutine name - !----------------------------------------------------------------------- - - ! Determine attribute vector indices - - ! create temporary attribute vectors - call mct_aVect_init(x2l, rList=seq_flds_x2l_fields, lsize=1) - nflds_x2l = mct_avect_nRattr(x2l) - - call mct_aVect_init(l2x, rList=seq_flds_l2x_fields, lsize=1) - nflds_l2x = mct_avect_nRattr(l2x) - - !------------------------------------------------------------- - ! clm -> drv - !------------------------------------------------------------- - - index_l2x_Flrl_rofsur = mct_avect_indexra(l2x,'Flrl_rofsur') - index_l2x_Flrl_rofgwl = mct_avect_indexra(l2x,'Flrl_rofgwl') - index_l2x_Flrl_rofsub = mct_avect_indexra(l2x,'Flrl_rofsub') - index_l2x_Flrl_rofi = mct_avect_indexra(l2x,'Flrl_rofi') - index_l2x_Flrl_irrig = mct_avect_indexra(l2x,'Flrl_irrig') - - index_l2x_Sl_t = mct_avect_indexra(l2x,'Sl_t') - index_l2x_Sl_snowh = mct_avect_indexra(l2x,'Sl_snowh') - index_l2x_Sl_avsdr = mct_avect_indexra(l2x,'Sl_avsdr') - index_l2x_Sl_anidr = mct_avect_indexra(l2x,'Sl_anidr') - index_l2x_Sl_avsdf = mct_avect_indexra(l2x,'Sl_avsdf') - index_l2x_Sl_anidf = mct_avect_indexra(l2x,'Sl_anidf') - index_l2x_Sl_tref = mct_avect_indexra(l2x,'Sl_tref') - index_l2x_Sl_qref = mct_avect_indexra(l2x,'Sl_qref') - index_l2x_Sl_u10 = mct_avect_indexra(l2x,'Sl_u10') - index_l2x_Sl_ram1 = mct_avect_indexra(l2x,'Sl_ram1') - index_l2x_Sl_fv = mct_avect_indexra(l2x,'Sl_fv') - index_l2x_Sl_soilw = mct_avect_indexra(l2x,'Sl_soilw',perrwith='quiet') - - if ( lnd_drydep )then - index_l2x_Sl_ddvel = mct_avect_indexra(l2x, trim(drydep_fields_token)) - else - index_l2x_Sl_ddvel = 0 - end if - - index_l2x_Fall_taux = mct_avect_indexra(l2x,'Fall_taux') - index_l2x_Fall_tauy = mct_avect_indexra(l2x,'Fall_tauy') - index_l2x_Fall_lat = mct_avect_indexra(l2x,'Fall_lat') - index_l2x_Fall_sen = mct_avect_indexra(l2x,'Fall_sen') - index_l2x_Fall_lwup = mct_avect_indexra(l2x,'Fall_lwup') - index_l2x_Fall_evap = mct_avect_indexra(l2x,'Fall_evap') - index_l2x_Fall_swnet = mct_avect_indexra(l2x,'Fall_swnet') - index_l2x_Fall_flxdst1 = mct_avect_indexra(l2x,'Fall_flxdst1') - index_l2x_Fall_flxdst2 = mct_avect_indexra(l2x,'Fall_flxdst2') - index_l2x_Fall_flxdst3 = mct_avect_indexra(l2x,'Fall_flxdst3') - index_l2x_Fall_flxdst4 = mct_avect_indexra(l2x,'Fall_flxdst4') - - index_l2x_Fall_fco2_lnd = mct_avect_indexra(l2x,'Fall_fco2_lnd',perrwith='quiet') - - index_l2x_Fall_methane = mct_avect_indexra(l2x,'Fall_methane',perrWith='quiet') - - ! MEGAN fluxes - if (shr_megan_mechcomps_n>0) then - index_l2x_Fall_flxvoc = mct_avect_indexra(l2x,trim(shr_megan_fields_token)) - else - index_l2x_Fall_flxvoc = 0 - endif - - ! Fire fluxes - if (shr_fire_emis_mechcomps_n>0) then - index_l2x_Fall_flxfire = mct_avect_indexra(l2x,trim(shr_fire_emis_fields_token)) - index_l2x_Sl_ztopfire = mct_avect_indexra(l2x,trim(shr_fire_emis_ztop_token)) - else - index_l2x_Fall_flxfire = 0 - index_l2x_Sl_ztopfire = 0 - endif - - !------------------------------------------------------------- - ! drv -> clm - !------------------------------------------------------------- - - index_x2l_Sa_z = mct_avect_indexra(x2l,'Sa_z') - index_x2l_Sa_topo = mct_avect_indexra(x2l,'Sa_topo') - index_x2l_Sa_u = mct_avect_indexra(x2l,'Sa_u') - index_x2l_Sa_v = mct_avect_indexra(x2l,'Sa_v') - index_x2l_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') - index_x2l_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') - index_x2l_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') - index_x2l_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') - index_x2l_Sa_co2prog = mct_avect_indexra(x2l,'Sa_co2prog',perrwith='quiet') - index_x2l_Sa_co2diag = mct_avect_indexra(x2l,'Sa_co2diag',perrwith='quiet') - - index_x2l_Sa_methane = mct_avect_indexra(x2l,'Sa_methane',perrWith='quiet') - - index_x2l_Flrr_volr = mct_avect_indexra(x2l,'Flrr_volr') - index_x2l_Flrr_volrmch = mct_avect_indexra(x2l,'Flrr_volrmch') - - index_x2l_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') - index_x2l_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') - index_x2l_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') - index_x2l_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') - index_x2l_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') - index_x2l_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') - index_x2l_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') - index_x2l_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') - index_x2l_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') - index_x2l_Faxa_bcphidry = mct_avect_indexra(x2l,'Faxa_bcphidry') - index_x2l_Faxa_bcphodry = mct_avect_indexra(x2l,'Faxa_bcphodry') - index_x2l_Faxa_bcphiwet = mct_avect_indexra(x2l,'Faxa_bcphiwet') - index_x2l_Faxa_ocphidry = mct_avect_indexra(x2l,'Faxa_ocphidry') - index_x2l_Faxa_ocphodry = mct_avect_indexra(x2l,'Faxa_ocphodry') - index_x2l_Faxa_ocphiwet = mct_avect_indexra(x2l,'Faxa_ocphiwet') - index_x2l_Faxa_dstdry1 = mct_avect_indexra(x2l,'Faxa_dstdry1') - index_x2l_Faxa_dstdry2 = mct_avect_indexra(x2l,'Faxa_dstdry2') - index_x2l_Faxa_dstdry3 = mct_avect_indexra(x2l,'Faxa_dstdry3') - index_x2l_Faxa_dstdry4 = mct_avect_indexra(x2l,'Faxa_dstdry4') - index_x2l_Faxa_dstwet1 = mct_avect_indexra(x2l,'Faxa_dstwet1') - index_x2l_Faxa_dstwet2 = mct_avect_indexra(x2l,'Faxa_dstwet2') - index_x2l_Faxa_dstwet3 = mct_avect_indexra(x2l,'Faxa_dstwet3') - index_x2l_Faxa_dstwet4 = mct_avect_indexra(x2l,'Faxa_dstwet4') - - index_x2l_Faxa_nhx = mct_avect_indexra(x2l,'Faxa_nhx', perrWith='quiet') - index_x2l_Faxa_noy = mct_avect_indexra(x2l,'Faxa_noy', perrWith='quiet') - - if (index_x2l_Faxa_nhx > 0 .and. index_x2l_Faxa_noy > 0) then - ndep_from_cpl = .true. - end if - - index_x2l_Flrr_flood = mct_avect_indexra(x2l,'Flrr_flood') - - !------------------------------------------------------------- - ! glc coupling - !------------------------------------------------------------- - - index_x2l_Sg_icemask = mct_avect_indexra(x2l,'Sg_icemask') - index_x2l_Sg_icemask_coupled_fluxes = mct_avect_indexra(x2l,'Sg_icemask_coupled_fluxes') - - glc_nec = glc_get_num_elevation_classes() - if (glc_nec < 1) then - call shr_sys_abort('ERROR: In CLM4.5 and later, glc_nec must be at least 1.') - end if - - ! Create coupling fields for all glc elevation classes (1:glc_nec) plus bare land - ! (index 0). - allocate(index_l2x_Sl_tsrf(0:glc_nec)) - allocate(index_l2x_Sl_topo(0:glc_nec)) - allocate(index_l2x_Flgl_qice(0:glc_nec)) - allocate(index_x2l_Sg_ice_covered(0:glc_nec)) - allocate(index_x2l_Sg_topo(0:glc_nec)) - allocate(index_x2l_Flgg_hflx(0:glc_nec)) - - do num = 0,glc_nec - nec_str = glc_elevclass_as_string(num) - - name = 'Sg_ice_covered' // nec_str - index_x2l_Sg_ice_covered(num) = mct_avect_indexra(x2l,trim(name)) - name = 'Sg_topo' // nec_str - index_x2l_Sg_topo(num) = mct_avect_indexra(x2l,trim(name)) - name = 'Flgg_hflx' // nec_str - index_x2l_Flgg_hflx(num) = mct_avect_indexra(x2l,trim(name)) - - name = 'Sl_tsrf' // nec_str - index_l2x_Sl_tsrf(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Sl_topo' // nec_str - index_l2x_Sl_topo(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Flgl_qice' // nec_str - index_l2x_Flgl_qice(num) = mct_avect_indexra(l2x,trim(name)) - end do - - call mct_aVect_clean(x2l) - call mct_aVect_clean(l2x) - - end subroutine clm_cpl_indices_set - -!======================================================================= - -end module clm_cpl_indices diff --git a/src/cpl/lnd_comp_mct.F90 b/src/cpl/lnd_comp_mct.F90 deleted file mode 100644 index 923d6f6c34..0000000000 --- a/src/cpl/lnd_comp_mct.F90 +++ /dev/null @@ -1,697 +0,0 @@ -module lnd_comp_mct - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Interface of the active land model component of CESM the CLM (Community Land Model) - ! with the main CESM driver. This is a thin interface taking CESM driver information - ! in MCT (Model Coupling Toolkit) format and converting it to use by CLM. - ! - ! !uses: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use mct_mod , only : mct_avect, mct_gsmap, mct_gGrid - use decompmod , only : bounds_type, ldecomp - use lnd_import_export, only : lnd_import, lnd_export - ! - ! !public member functions: - implicit none - save - private ! by default make data private - ! - ! !public member functions: - public :: lnd_init_mct ! clm initialization - public :: lnd_run_mct ! clm run phase - public :: lnd_final_mct ! clm finalization/cleanup - ! - ! !private member functions: - private :: lnd_setgsmap_mct ! set the land model mct gs map - private :: lnd_domain_mct ! set the land model domain information - private :: lnd_handle_resume ! handle pause/resume signals from the coupler - !--------------------------------------------------------------------------- - -contains - - !==================================================================================== - - subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize land surface model and obtain relevant atmospheric model arrays - ! back from (i.e. albedos, surface temperature and snow cover over land). - ! - ! !USES: - use shr_kind_mod , only : shr_kind_cl - use abortutils , only : endrun - use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, set_nextsw_cday - use clm_initializeMod, only : initialize1, initialize2, lnd2atm_inst, lnd2glc_inst - use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland - use clm_varctl , only : inst_index, inst_suffix, inst_name - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use controlMod , only : control_setNL - use decompMod , only : get_proc_bounds - use domainMod , only : ldomain - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel - use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel - use shr_file_mod , only : shr_file_getUnit, shr_file_setIO - use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod , only : seq_timemgr_EClockGetData - use seq_infodata_mod , only : seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData, & - seq_infodata_start_type_start, seq_infodata_start_type_cont, & - seq_infodata_start_type_brnch - use seq_comm_mct , only : seq_comm_suffix, seq_comm_inst, seq_comm_name - use seq_flds_mod , only : seq_flds_x2l_fields, seq_flds_l2x_fields - use spmdMod , only : masterproc, spmd_init - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_cpl_indices , only : clm_cpl_indices_set - use mct_mod , only : mct_aVect_init, mct_aVect_zero, mct_gsMap_lsize - use ESMF - ! - ! !ARGUMENTS: - type(ESMF_Clock), intent(inout) :: EClock ! Input synchronization clock - type(seq_cdata), intent(inout) :: cdata_l ! Input land-model driver data - type(mct_aVect), intent(inout) :: x2l_l, l2x_l ! land model import and export states - character(len=*), optional, intent(in) :: NLFilename ! Namelist filename to read - ! - ! !LOCAL VARIABLES: - integer :: LNDID ! Land identifyer - integer :: mpicom_lnd ! MPI communicator - type(mct_gsMap), pointer :: GSMap_lnd ! Land model MCT GS map - type(mct_gGrid), pointer :: dom_l ! Land model domain - type(seq_infodata_type), pointer :: infodata ! CESM driver level info data - integer :: lsize ! size of attribute vector - integer :: g,i,j ! indices - integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! clm time-step - logical :: exists ! true if file exists - logical :: atm_aero ! Flag if aerosol data sent from atm model - real(r8) :: scmlat ! single-column latitude - real(r8) :: scmlon ! single-column longitude - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=SHR_KIND_CL) :: caseid ! case identifier name - character(len=SHR_KIND_CL) :: ctitle ! case description title - character(len=SHR_KIND_CL) :: starttype ! start-type (startup, continue, branch, hybrid) - character(len=SHR_KIND_CL) :: calendar ! calendar type name - character(len=SHR_KIND_CL) :: hostname ! hostname of machine running on - character(len=SHR_KIND_CL) :: version ! Model version - character(len=SHR_KIND_CL) :: username ! user running the model - integer :: nsrest ! clm restart type - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit,shrloglev ! old values for log unit and log level - type(bounds_type) :: bounds ! bounds - character(len=32), parameter :: sub = 'lnd_init_mct' - character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" - !----------------------------------------------------------------------- - - ! Set cdata data - - call seq_cdata_setptrs(cdata_l, ID=LNDID, mpicom=mpicom_lnd, & - gsMap=GSMap_lnd, dom=dom_l, infodata=infodata) - - ! Determine attriute vector indices - - call clm_cpl_indices_set() - - ! Initialize clm MPI communicator - - call spmd_init( mpicom_lnd, LNDID ) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_init_mct:start::',lbnum) - endif -#endif - - inst_name = seq_comm_name(LNDID) - inst_index = seq_comm_inst(LNDID) - inst_suffix = seq_comm_suffix(LNDID) - - ! Initialize io log unit - - call shr_file_getLogUnit (shrlogunit) - if (masterproc) then - inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) - if (exists) then - iulog = shr_file_getUnit() - call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) - end if - write(iulog,format) "CLM land model initialization" - else - iulog = shrlogunit - end if - - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) - - ! Use infodata to set orbital values - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - - ! Consistency check on namelist filename - - call control_setNL("lnd_in"//trim(inst_suffix)) - - ! Initialize clm - ! initialize1 reads namelist, grid and surface data (need this to initialize gsmap) - ! initialize2 performs rest of initialization - - call seq_timemgr_EClockGetData(EClock, & - start_ymd=start_ymd, & - start_tod=start_tod, ref_ymd=ref_ymd, & - ref_tod=ref_tod, stop_ymd=stop_ymd, & - stop_tod=stop_tod, & - calendar=calendar ) - call seq_infodata_GetData(infodata, case_name=caseid, & - case_desc=ctitle, single_column=single_column, & - scmlat=scmlat, scmlon=scmlon, & - brnch_retain_casename=brnch_retain_casename, & - start_type=starttype, model_version=version, & - hostname=hostname, username=username ) - call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) - if ( trim(starttype) == trim(seq_infodata_start_type_start)) then - nsrest = nsrStartup - else if (trim(starttype) == trim(seq_infodata_start_type_cont) ) then - nsrest = nsrContinue - else if (trim(starttype) == trim(seq_infodata_start_type_brnch)) then - nsrest = nsrBranch - else - call endrun( sub//' ERROR: unknown starttype' ) - end if - - call clm_varctl_set(caseid_in=caseid, ctitle_in=ctitle, & - brnch_retain_casename_in=brnch_retain_casename, & - single_column_in=single_column, scmlat_in=scmlat, & - scmlon_in=scmlon, nsrest_in=nsrest, version_in=version, & - hostname_in=hostname, username_in=username) - - ! Read namelist, grid and surface data - - call initialize1( ) - - ! If no land then exit out of initialization - - if ( noland ) then - call seq_infodata_PutData( infodata, lnd_present =.false.) - call seq_infodata_PutData( infodata, lnd_prognostic=.false.) - return - end if - - ! Determine if aerosol and dust deposition come from atmosphere component - - call seq_infodata_GetData(infodata, atm_aero=atm_aero ) - if ( .not. atm_aero )then - call endrun( sub//' ERROR: atmosphere model MUST send aerosols to CLM' ) - end if - - ! Initialize clm gsMap, clm domain and clm attribute vectors - - call get_proc_bounds( bounds ) - - call lnd_SetgsMap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - lsize = mct_gsMap_lsize(gsMap_lnd, mpicom_lnd) - - call lnd_domain_mct( bounds, lsize, gsMap_lnd, dom_l ) - - call mct_aVect_init(x2l_l, rList=seq_flds_x2l_fields, lsize=lsize) - call mct_aVect_zero(x2l_l) - - call mct_aVect_init(l2x_l, rList=seq_flds_l2x_fields, lsize=lsize) - call mct_aVect_zero(l2x_l) - - ! Finish initializing clm - - call initialize2() - - ! Check that clm internal dtime aligns with clm coupling interval - - call seq_timemgr_EClockGetData(EClock, dtime=dtime_sync ) - dtime_clm = get_step_size() - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,& - ' dtime_clm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'clm dtime ',dtime_clm,' and Eclock dtime ',& - dtime_sync,' never align' - call endrun( sub//' ERROR: time out of sync' ) - end if - - ! Create land export state - - call lnd_export(bounds, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) - - ! Fill in infodata settings - - call seq_infodata_PutData(infodata, lnd_prognostic=.true.) - call seq_infodata_PutData(infodata, lnd_nx=ldomain%ni, lnd_ny=ldomain%nj) - - ! Get infodata info - - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - call set_nextsw_cday(nextsw_cday) - call lnd_handle_resume( infodata ) - - ! Reset shr logging to original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - -#if (defined _MEMTRACE) - if(masterproc) then - write(iulog,*) TRIM(Sub) // ':end::' - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_int_mct:end::',lbnum) - call memmon_reset_addr() - endif -#endif - - end subroutine lnd_init_mct - - !==================================================================================== - - subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) - ! - ! !DESCRIPTION: - ! Run clm model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_initializeMod, only : lnd2atm_inst, atm2lnd_inst, lnd2glc_inst, glc2lnd_inst - use clm_driver , only : clm_drv - use clm_time_manager, only : get_curr_date, get_nstep, get_curr_calday, get_step_size - use clm_time_manager, only : advance_timestep, set_nextsw_cday,update_rad_dtime - use decompMod , only : get_proc_bounds - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel - use shr_file_mod , only : shr_file_getLogUnit, shr_file_getLogLevel - use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod , only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn - use seq_timemgr_mod , only : seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync - use seq_infodata_mod, only : seq_infodata_type, seq_infodata_GetData - use spmdMod , only : masterproc, mpicom - use perf_mod , only : t_startf, t_stopf, t_barrierf - use shr_orb_mod , only : shr_orb_decl - use ESMF - ! - ! !ARGUMENTS: - type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver - type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model - type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model - type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model - ! - ! !LOCAL VARIABLES: - integer :: ymd_sync ! Sync date (YYYYMMDD) - integer :: yr_sync ! Sync current year - integer :: mon_sync ! Sync current month - integer :: day_sync ! Sync current day - integer :: tod_sync ! Sync current time of day (sec) - integer :: ymd ! CLM current date (YYYYMMDD) - integer :: yr ! CLM current year - integer :: mon ! CLM current month - integer :: day ! CLM current day - integer :: tod ! CLM current time of day (sec) - integer :: dtime ! time step increment (sec) - integer :: nstep ! time step index - logical :: rstwr_sync ! .true. ==> write restart file before returning - logical :: rstwr ! .true. ==> write restart file before returning - logical :: nlend_sync ! Flag signaling last time-step - logical :: nlend ! .true. ==> last time-step - logical :: dosend ! true => send data back to driver - logical :: doalb ! .true. ==> do albedo calculation on this time step - logical :: rof_prognostic ! .true. => running with a prognostic ROF model - logical :: glc_present ! .true. => running with a non-stub GLC model - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - real(r8) :: caldayp1 ! clm calday plus dtime offset - integer :: shrlogunit,shrloglev ! old values for share log unit and log level - integer :: lbnum ! input to memory diagnostic - integer :: g,i,lsize ! counters - real(r8) :: calday ! calendar day for nstep - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 - real(r8) :: eccf ! earth orbit eccentricity factor - real(r8) :: recip ! reciprical - logical,save :: first_call = .true. ! first call work - type(seq_infodata_type),pointer :: infodata ! CESM information from the driver - type(mct_gGrid), pointer :: dom_l ! Land model domain data - type(bounds_type) :: bounds ! bounds - character(len=32) :: rdate ! date char string for restart file names - character(len=32), parameter :: sub = "lnd_run_mct" - !--------------------------------------------------------------------------- - - ! Determine processor bounds - - call get_proc_bounds(bounds) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_run_mct:start::',lbnum) - endif -#endif - - ! Reset shr logging to my log file - call shr_file_getLogUnit (shrlogunit) - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) - - ! Determine time of next atmospheric shortwave calculation - call seq_cdata_setptrs(cdata_l, infodata=infodata, dom=dom_l) - call seq_timemgr_EClockGetData(EClock, & - curr_ymd=ymd, curr_tod=tod_sync, & - curr_yr=yr_sync, curr_mon=mon_sync, curr_day=day_sync) - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - - call set_nextsw_cday( nextsw_cday ) - dtime = get_step_size() - - ! Handle pause/resume signals from coupler - call lnd_handle_resume( infodata ) - - write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync,mon_sync,day_sync,tod_sync - nlend_sync = seq_timemgr_StopAlarmIsOn( EClock ) - rstwr_sync = seq_timemgr_RestartAlarmIsOn( EClock ) - - ! Determine if we're running with a prognostic ROF model, and if we're running with a - ! non-stub GLC model. These won't change throughout the run, but we can't count on - ! their being set in initialization, so need to get them in the run method. - - call seq_infodata_GetData( infodata, & - rof_prognostic=rof_prognostic, & - glc_present=glc_present) - - ! Map MCT to land data type - ! Perform downscaling if appropriate - - - ! Map to clm (only when state and/or fluxes need to be updated) - - call t_startf ('lc_lnd_import') - call lnd_import( bounds, & - x2l = x2l_l%rattr, & - glc_present = glc_present, & - atm2lnd_inst = atm2lnd_inst, & - glc2lnd_inst = glc2lnd_inst) - call t_stopf ('lc_lnd_import') - - ! Use infodata to set orbital values if updated mid-run - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - - ! Loop over time steps in coupling interval - - dosend = .false. - do while(.not. dosend) - - ! Determine if dosend - ! When time is not updated at the beginning of the loop - then return only if - ! are in sync with clock before time is updated - - call get_curr_date( yr, mon, day, tod ) - ymd = yr*10000 + mon*100 + day - tod = tod - dosend = (seq_timemgr_EClockDateInSync( EClock, ymd, tod)) - - ! Determine doalb based on nextsw_cday sent from atm model - - nstep = get_nstep() - caldayp1 = get_curr_calday(offset=dtime) - if (nstep == 0) then - doalb = .false. - else if (nstep == 1) then - doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) - else - doalb = (nextsw_cday >= -0.5_r8) - end if - call update_rad_dtime(doalb) - - ! Determine if time to write cam restart and stop - - rstwr = .false. - if (rstwr_sync .and. dosend) rstwr = .true. - nlend = .false. - if (nlend_sync .and. dosend) nlend = .true. - - ! Run clm - - call t_barrierf('sync_clm_run1', mpicom) - call t_startf ('clm_run') - call t_startf ('shr_orb_decl') - calday = get_curr_calday() - call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) - call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) - call t_stopf ('shr_orb_decl') - call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) - call t_stopf ('clm_run') - - ! Create l2x_l export state - add river runoff input to l2x_l if appropriate - - call t_startf ('lc_lnd_export') - call lnd_export(bounds, lnd2atm_inst, lnd2glc_inst, l2x_l%rattr) - call t_stopf ('lc_lnd_export') - - ! Advance clm time step - - call t_startf ('lc_clm2_adv_timestep') - call advance_timestep() - call t_stopf ('lc_clm2_adv_timestep') - - end do - - ! Check that internal clock is in sync with master clock - - call get_curr_date( yr, mon, day, tod, offset=-dtime ) - ymd = yr*10000 + mon*100 + day - tod = tod - if ( .not. seq_timemgr_EClockDateInSync( EClock, ymd, tod ) )then - call seq_timemgr_EclockGetData( EClock, curr_ymd=ymd_sync, curr_tod=tod_sync ) - write(iulog,*)' clm ymd=',ymd ,' clm tod= ',tod - write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync - call endrun( sub//":: CLM clock not in sync with Master Sync clock" ) - end if - - ! Reset shr logging to my original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_run_mct:end::',lbnum) - call memmon_reset_addr() - endif -#endif - - first_call = .false. - - end subroutine lnd_run_mct - - !==================================================================================== - - subroutine lnd_final_mct( EClock, cdata_l, x2l_l, l2x_l) - ! - ! !DESCRIPTION: - ! Finalize land surface model - - use seq_cdata_mod ,only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod ,only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn - use seq_timemgr_mod ,only : seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync - use esmf - ! - ! !ARGUMENTS: - type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver - type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model - type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model - type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model - !--------------------------------------------------------------------------- - - ! fill this in - end subroutine lnd_final_mct - - !==================================================================================== - - subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - ! - ! !DESCRIPTION: - ! Set the MCT GS map for the land model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use domainMod , only : ldomain - use mct_mod , only : mct_gsMap, mct_gsMap_init - implicit none - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: mpicom_lnd ! MPI communicator for the clm land model - integer , intent(in) :: LNDID ! Land model identifyer number - type(mct_gsMap) , intent(out) :: gsMap_lnd ! Resulting MCT GS map for the land model - ! - ! !LOCAL VARIABLES: - integer,allocatable :: gindex(:) ! Number the local grid points - integer :: i, j, n, gi ! Indices - integer :: lsize,gsize ! GS Map size - integer :: ier ! Error code - !--------------------------------------------------------------------------- - - ! Build the land grid numbering for MCT - ! NOTE: Numbering scheme is: West to East and South to North - ! starting at south pole. Should be the same as what's used in SCRIP - - allocate(gindex(bounds%begg:bounds%endg),stat=ier) - - ! number the local grid - - do n = bounds%begg, bounds%endg - gindex(n) = ldecomp%gdc2glo(n) - end do - lsize = bounds%endg - bounds%begg + 1 - gsize = ldomain%ni * ldomain%nj - - call mct_gsMap_init( gsMap_lnd, gindex, mpicom_lnd, LNDID, lsize, gsize ) - - deallocate(gindex) - - end subroutine lnd_SetgsMap_mct - - !==================================================================================== - - subroutine lnd_domain_mct( bounds, lsize, gsMap_l, dom_l ) - ! - ! !DESCRIPTION: - ! Send the land model domain information to the coupler - ! - ! !USES: - use clm_varcon , only: re - use domainMod , only: ldomain - use spmdMod , only: iam - use mct_mod , only: mct_gGrid_importIAttr - use mct_mod , only: mct_gGrid_importRAttr, mct_gGrid_init, mct_gsMap_orderedPoints - use seq_flds_mod, only: seq_flds_dom_coord, seq_flds_dom_other - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: lsize ! land model domain data size - type(mct_gsMap), intent(inout) :: gsMap_l ! Output land model MCT GS map - type(mct_ggrid), intent(out) :: dom_l ! Output domain information for land model - ! - ! Local Variables - integer :: g,i,j ! index - real(r8), pointer :: data(:) ! temporary - integer , pointer :: idata(:) ! temporary - !--------------------------------------------------------------------------- - ! - ! Initialize mct domain type - ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) - ! Note that in addition land carries around landfrac for the purposes of domain checking - ! - call mct_gGrid_init( GGrid=dom_l, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) - ! - ! Allocate memory - ! - allocate(data(lsize)) - ! - ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT - ! - call mct_gsMap_orderedPoints(gsMap_l, iam, idata) - call mct_gGrid_importIAttr(dom_l,'GlobGridNum',idata,lsize) - ! - ! Determine domain (numbering scheme is: West to East and South to North to South pole) - ! Initialize attribute vector with special value - ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_l,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_l,"mask" ,data,lsize) - ! - ! Fill in correct values for domain components - ! Note aream will be filled in in the atm-lnd mapper - ! - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%lonc(g) - end do - call mct_gGrid_importRattr(dom_l,"lon",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%latc(g) - end do - call mct_gGrid_importRattr(dom_l,"lat",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%area(g)/(re*re) - end do - call mct_gGrid_importRattr(dom_l,"area",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%mask(g), r8) - end do - call mct_gGrid_importRattr(dom_l,"mask",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%frac(g), r8) - end do - call mct_gGrid_importRattr(dom_l,"frac",data,lsize) - - deallocate(data) - deallocate(idata) - - end subroutine lnd_domain_mct - - !==================================================================================== - - subroutine lnd_handle_resume( infodata ) - ! - ! !DESCRIPTION: - ! Handle resume signals for Data Assimilation (DA) - ! - ! !USES: - use shr_kind_mod , only : shr_kind_cl - use seq_infodata_mod , only : seq_infodata_type, seq_infodata_GetData - use clm_time_manager , only : update_DA_nstep - use seq_comm_mct , only : num_inst_lnd - use clm_varctl , only : iulog - use clm_varctl , only : inst_index - implicit none - ! !ARGUMENTS: - type(seq_infodata_type), intent(IN) :: infodata ! CESM driver level info data - ! !LOCAL VARIABLES: - character(len=SHR_KIND_CL) :: lnd_resume(num_inst_lnd) ! land resume file (for data assimulation) - logical :: resume_from_data_assim ! flag if we are resuming after data assimulation was done - !--------------------------------------------------------------------------- - - call seq_infodata_GetData(infodata, lnd_resume=lnd_resume ) - ! If lnd_resume is blank, restart file wasn't modified - if ( len_trim(lnd_resume(min(num_inst_lnd,inst_index))) == 0 )then - resume_from_data_assim = .false. - ! Otherwise restart was modified and we are resuming from data assimulation - else - resume_from_data_assim = .true. - write(iulog,*) 'resume_from_DA ', resume_from_data_assim - end if - if ( resume_from_data_assim ) call update_DA_nstep() - - end subroutine lnd_handle_resume - -end module lnd_comp_mct diff --git a/src/cpl/lnd_import_export.F90 b/src/cpl/lnd_import_export.F90 deleted file mode 100644 index 4923b721af..0000000000 --- a/src/cpl/lnd_import_export.F90 +++ /dev/null @@ -1,429 +0,0 @@ -module lnd_import_export - - use shr_kind_mod , only: r8 => shr_kind_r8, cl=>shr_kind_cl - use abortutils , only: endrun - use decompmod , only: bounds_type - use lnd2atmType , only: lnd2atm_type - use lnd2glcMod , only: lnd2glc_type - use atm2lndType , only: atm2lnd_type - use glc2lndMod , only: glc2lnd_type - use clm_cpl_indices - ! - implicit none - !=============================================================================== - -contains - - !=============================================================================== - subroutine lnd_import( bounds, x2l, glc_present, atm2lnd_inst, glc2lnd_inst) - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Convert the input data from the coupler to the land model - ! - ! !USES: - use seq_flds_mod , only: seq_flds_x2l_fields - use clm_varctl , only: co2_type, co2_ppmv, iulog, use_c13 - use clm_varctl , only: ndep_from_cpl - use clm_varcon , only: rair, o2_molar_const, c13ratio - use shr_const_mod , only: SHR_CONST_TKFRZ - use shr_string_mod , only: shr_string_listGetName - use domainMod , only: ldomain - use shr_infnan_mod , only : isnan => shr_infnan_isnan - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - real(r8) , intent(in) :: x2l(:,:) ! driver import state to land model - logical , intent(in) :: glc_present ! .true. => running with a non-stub GLC model - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst ! clm internal input data type - type(glc2lnd_type) , intent(inout) :: glc2lnd_inst ! clm internal input data type - ! - ! !LOCAL VARIABLES: - integer :: g,i,k,nstep,ier ! indices, number of steps, and error code - real(r8) :: forc_rainc ! rainxy Atm flux mm/s - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) - real(r8) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) :: forc_rainl ! rainxy Atm flux mm/s - real(r8) :: forc_snowc ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl ! snowfxl Atm flux mm/s - real(r8) :: co2_ppmv_diag ! temporary - real(r8) :: co2_ppmv_prog ! temporary - real(r8) :: co2_ppmv_val ! temporary - integer :: co2_type_idx ! integer flag for co2_type options - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input - character(len=32) :: fname ! name of field that is NaN - character(len=32), parameter :: sub = 'lnd_import' - - ! Constants to compute vapor pressure - parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & - a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & - a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & - a6=6.136820929e-11_r8) - - parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & - b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & - b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & - b6=1.838826904e-10_r8) - ! - ! function declarations - ! - tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) - esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) - esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) - !--------------------------------------------------------------------------- - - co2_type_idx = 0 - if (co2_type == 'prognostic') then - co2_type_idx = 1 - else if (co2_type == 'diagnostic') then - co2_type_idx = 2 - end if - if (co2_type == 'prognostic' .and. index_x2l_Sa_co2prog == 0) then - call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2prog for co2_type equal to prognostic' ) - else if (co2_type == 'diagnostic' .and. index_x2l_Sa_co2diag == 0) then - call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2diag for co2_type equal to diagnostic' ) - end if - - ! Note that the precipitation fluxes received from the coupler - ! are in units of kg/s/m^2. To convert these precipitation rates - ! in units of mm/sec, one must divide by 1000 kg/m^3 and multiply - ! by 1000 mm/m resulting in an overall factor of unity. - ! Below the units are therefore given in mm/s. - - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - - ! Determine flooding input, sign convention is positive downward and - ! hierarchy is atm/glc/lnd/rof/ice/ocn. so water sent from rof to land is negative, - ! change the sign to indicate addition of water to system. - - atm2lnd_inst%forc_flood_grc(g) = -x2l(index_x2l_Flrr_flood,i) - - atm2lnd_inst%volr_grc(g) = x2l(index_x2l_Flrr_volr,i) * (ldomain%area(g) * 1.e6_r8) - atm2lnd_inst%volrmch_grc(g)= x2l(index_x2l_Flrr_volrmch,i) * (ldomain%area(g) * 1.e6_r8) - - ! Determine required receive fields - - atm2lnd_inst%forc_hgt_grc(g) = x2l(index_x2l_Sa_z,i) ! zgcmxy Atm state m - atm2lnd_inst%forc_topo_grc(g) = x2l(index_x2l_Sa_topo,i) ! Atm surface height (m) - atm2lnd_inst%forc_u_grc(g) = x2l(index_x2l_Sa_u,i) ! forc_uxy Atm state m/s - atm2lnd_inst%forc_v_grc(g) = x2l(index_x2l_Sa_v,i) ! forc_vxy Atm state m/s - atm2lnd_inst%forc_solad_grc(g,2) = x2l(index_x2l_Faxa_swndr,i) ! forc_sollxy Atm flux W/m^2 - atm2lnd_inst%forc_solad_grc(g,1) = x2l(index_x2l_Faxa_swvdr,i) ! forc_solsxy Atm flux W/m^2 - atm2lnd_inst%forc_solai_grc(g,2) = x2l(index_x2l_Faxa_swndf,i) ! forc_solldxy Atm flux W/m^2 - atm2lnd_inst%forc_solai_grc(g,1) = x2l(index_x2l_Faxa_swvdf,i) ! forc_solsdxy Atm flux W/m^2 - - atm2lnd_inst%forc_th_not_downscaled_grc(g) = x2l(index_x2l_Sa_ptem,i) ! forc_thxy Atm state K - atm2lnd_inst%forc_q_not_downscaled_grc(g) = x2l(index_x2l_Sa_shum,i) ! forc_qxy Atm state kg/kg - atm2lnd_inst%forc_pbot_not_downscaled_grc(g) = x2l(index_x2l_Sa_pbot,i) ! ptcmxy Atm state Pa - atm2lnd_inst%forc_t_not_downscaled_grc(g) = x2l(index_x2l_Sa_tbot,i) ! forc_txy Atm state K - atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) = x2l(index_x2l_Faxa_lwdn,i) ! flwdsxy Atm flux W/m^2 - - forc_rainc = x2l(index_x2l_Faxa_rainc,i) ! mm/s - forc_rainl = x2l(index_x2l_Faxa_rainl,i) ! mm/s - forc_snowc = x2l(index_x2l_Faxa_snowc,i) ! mm/s - forc_snowl = x2l(index_x2l_Faxa_snowl,i) ! mm/s - - ! atmosphere coupling, for prognostic/prescribed aerosols - atm2lnd_inst%forc_aer_grc(g,1) = x2l(index_x2l_Faxa_bcphidry,i) - atm2lnd_inst%forc_aer_grc(g,2) = x2l(index_x2l_Faxa_bcphodry,i) - atm2lnd_inst%forc_aer_grc(g,3) = x2l(index_x2l_Faxa_bcphiwet,i) - atm2lnd_inst%forc_aer_grc(g,4) = x2l(index_x2l_Faxa_ocphidry,i) - atm2lnd_inst%forc_aer_grc(g,5) = x2l(index_x2l_Faxa_ocphodry,i) - atm2lnd_inst%forc_aer_grc(g,6) = x2l(index_x2l_Faxa_ocphiwet,i) - atm2lnd_inst%forc_aer_grc(g,7) = x2l(index_x2l_Faxa_dstwet1,i) - atm2lnd_inst%forc_aer_grc(g,8) = x2l(index_x2l_Faxa_dstdry1,i) - atm2lnd_inst%forc_aer_grc(g,9) = x2l(index_x2l_Faxa_dstwet2,i) - atm2lnd_inst%forc_aer_grc(g,10) = x2l(index_x2l_Faxa_dstdry2,i) - atm2lnd_inst%forc_aer_grc(g,11) = x2l(index_x2l_Faxa_dstwet3,i) - atm2lnd_inst%forc_aer_grc(g,12) = x2l(index_x2l_Faxa_dstdry3,i) - atm2lnd_inst%forc_aer_grc(g,13) = x2l(index_x2l_Faxa_dstwet4,i) - atm2lnd_inst%forc_aer_grc(g,14) = x2l(index_x2l_Faxa_dstdry4,i) - - ! Determine optional receive fields - - if (index_x2l_Sa_co2prog /= 0) then - co2_ppmv_prog = x2l(index_x2l_Sa_co2prog,i) ! co2 atm state prognostic - else - co2_ppmv_prog = co2_ppmv - end if - - if (index_x2l_Sa_co2diag /= 0) then - co2_ppmv_diag = x2l(index_x2l_Sa_co2diag,i) ! co2 atm state diagnostic - else - co2_ppmv_diag = co2_ppmv - end if - - if (index_x2l_Sa_methane /= 0) then - atm2lnd_inst%forc_pch4_grc(g) = x2l(index_x2l_Sa_methane,i) - endif - - ! Determine derived quantities for required fields - - forc_t = atm2lnd_inst%forc_t_not_downscaled_grc(g) - forc_q = atm2lnd_inst%forc_q_not_downscaled_grc(g) - forc_pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc(g) - - atm2lnd_inst%forc_hgt_u_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of wind [m] - atm2lnd_inst%forc_hgt_t_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of temperature [m] - atm2lnd_inst%forc_hgt_q_grc(g) = atm2lnd_inst%forc_hgt_grc(g) !observational height of humidity [m] - atm2lnd_inst%forc_vp_grc(g) = forc_q * forc_pbot / (0.622_r8 + 0.378_r8 * forc_q) - atm2lnd_inst%forc_rho_not_downscaled_grc(g) = & - (forc_pbot - 0.378_r8 * atm2lnd_inst%forc_vp_grc(g)) / (rair * forc_t) - atm2lnd_inst%forc_po2_grc(g) = o2_molar_const * forc_pbot - atm2lnd_inst%forc_wind_grc(g) = sqrt(atm2lnd_inst%forc_u_grc(g)**2 + atm2lnd_inst%forc_v_grc(g)**2) - atm2lnd_inst%forc_solar_grc(g) = atm2lnd_inst%forc_solad_grc(g,1) + atm2lnd_inst%forc_solai_grc(g,1) + & - atm2lnd_inst%forc_solad_grc(g,2) + atm2lnd_inst%forc_solai_grc(g,2) - - atm2lnd_inst%forc_rain_not_downscaled_grc(g) = forc_rainc + forc_rainl - atm2lnd_inst%forc_snow_not_downscaled_grc(g) = forc_snowc + forc_snowl - - if (forc_t > SHR_CONST_TKFRZ) then - e = esatw(tdc(forc_t)) - else - e = esati(tdc(forc_t)) - end if - qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) - - !modify specific humidity if precip occurs - if(1==2) then - if((forc_rainc+forc_rainl) > 0._r8) then - forc_q = 0.95_r8*qsat - ! forc_q = qsat - atm2lnd_inst%forc_q_not_downscaled_grc(g) = forc_q - endif - endif - - atm2lnd_inst%forc_rh_grc(g) = 100.0_r8*(forc_q / qsat) - - ! Check that solar, specific-humidity and LW downward aren't negative - if ( atm2lnd_inst%forc_lwrad_not_downscaled_grc(g) <= 0.0_r8 )then - call endrun( sub//' ERROR: Longwave down sent from the atmosphere model is negative or zero' ) - end if - if ( (atm2lnd_inst%forc_solad_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solad_grc(g,2) < 0.0_r8) & - .or. (atm2lnd_inst%forc_solai_grc(g,1) < 0.0_r8) .or. (atm2lnd_inst%forc_solai_grc(g,2) < 0.0_r8) ) then - call endrun( sub//' ERROR: One of the solar fields (indirect/diffuse, vis or near-IR)'// & - ' from the atmosphere model is negative or zero' ) - end if - if ( atm2lnd_inst%forc_q_not_downscaled_grc(g) < 0.0_r8 )then - call endrun( sub//' ERROR: Bottom layer specific humidty sent from the atmosphere model is less than zero' ) - end if - - ! Check if any input from the coupler is NaN - if ( any(isnan(x2l(:,i))) )then - write(iulog,*) '# of NaNs = ', count(isnan(x2l(:,i))) - write(iulog,*) 'Which are NaNs = ', isnan(x2l(:,i)) - do k = 1, size(x2l(:,i)) - if ( isnan(x2l(k,i)) )then - call shr_string_listGetName( seq_flds_x2l_fields, k, fname ) - write(iulog,*) trim(fname) - end if - end do - write(iulog,*) 'gridcell index = ', g - call endrun( sub//' ERROR: One or more of the input from the atmosphere model are NaN '// & - '(Not a Number from a bad floating point calculation)' ) - end if - - ! Make sure relative humidity is properly bounded - ! atm2lnd_inst%forc_rh_grc(g) = min( 100.0_r8, atm2lnd_inst%forc_rh_grc(g) ) - ! atm2lnd_inst%forc_rh_grc(g) = max( 0.0_r8, atm2lnd_inst%forc_rh_grc(g) ) - - ! Determine derived quantities for optional fields - ! Note that the following does unit conversions from ppmv to partial pressures (Pa) - ! Note that forc_pbot is in Pa - - if (co2_type_idx == 1) then - co2_ppmv_val = co2_ppmv_prog - else if (co2_type_idx == 2) then - co2_ppmv_val = co2_ppmv_diag - else - co2_ppmv_val = co2_ppmv - end if - if ( (co2_ppmv_val < 10.0_r8) .or. (co2_ppmv_val > 15000.0_r8) )then - call endrun( sub//' ERROR: CO2 is outside of an expected range' ) - end if - atm2lnd_inst%forc_pco2_grc(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot - if (use_c13) then - atm2lnd_inst%forc_pc13o2_grc(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot - end if - - if (ndep_from_cpl) then - ! The coupler is sending ndep in units if kgN/m2/s - and clm uses units of gN/m2/sec - so the - ! following conversion needs to happen - atm2lnd_inst%forc_ndep_grc(g) = (x2l(index_x2l_Faxa_nhx, i) + x2l(index_x2l_faxa_noy, i))*1000._r8 - end if - - end do - - call glc2lnd_inst%set_glc2lnd_fields( & - bounds = bounds, & - glc_present = glc_present, & - ! NOTE(wjs, 2017-12-13) the x2l argument doesn't have the typical bounds - ! subsetting (bounds%begg:bounds%endg). This mirrors the lack of these bounds in - ! the call to lnd_import from lnd_run_mct. This is okay as long as this code is - ! outside a clump loop. - x2l = x2l, & - index_x2l_Sg_ice_covered = index_x2l_Sg_ice_covered, & - index_x2l_Sg_topo = index_x2l_Sg_topo, & - index_x2l_Flgg_hflx = index_x2l_Flgg_hflx, & - index_x2l_Sg_icemask = index_x2l_Sg_icemask, & - index_x2l_Sg_icemask_coupled_fluxes = index_x2l_Sg_icemask_coupled_fluxes) - - end subroutine lnd_import - - !=============================================================================== - - subroutine lnd_export( bounds, lnd2atm_inst, lnd2glc_inst, l2x) - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Convert the data to be sent from the clm model to the coupler - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use seq_flds_mod , only : seq_flds_l2x_fields - use clm_varctl , only : iulog - use clm_time_manager , only : get_nstep, get_step_size - use seq_drydep_mod , only : n_drydep - use shr_megan_mod , only : shr_megan_mechcomps_n - use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n - use domainMod , only : ldomain - use shr_string_mod , only : shr_string_listGetName - use shr_infnan_mod , only : isnan => shr_infnan_isnan - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - type(lnd2atm_type), intent(inout) :: lnd2atm_inst ! clm land to atmosphere exchange data type - type(lnd2glc_type), intent(inout) :: lnd2glc_inst ! clm land to atmosphere exchange data type - real(r8) , intent(out) :: l2x(:,:)! land to coupler export state on land grid - ! - ! !LOCAL VARIABLES: - integer :: g,i,k ! indices - integer :: ier ! error status - integer :: nstep ! time step index - integer :: dtime ! time step - integer :: num ! counter - character(len=32) :: fname ! name of field that is NaN - character(len=32), parameter :: sub = 'lnd_export' - !--------------------------------------------------------------------------- - - ! cesm sign convention is that fluxes are positive downward - - l2x(:,:) = 0.0_r8 - - do g = bounds%begg,bounds%endg - i = 1 + (g-bounds%begg) - l2x(index_l2x_Sl_t,i) = lnd2atm_inst%t_rad_grc(g) - l2x(index_l2x_Sl_snowh,i) = lnd2atm_inst%h2osno_grc(g) - l2x(index_l2x_Sl_avsdr,i) = lnd2atm_inst%albd_grc(g,1) - l2x(index_l2x_Sl_anidr,i) = lnd2atm_inst%albd_grc(g,2) - l2x(index_l2x_Sl_avsdf,i) = lnd2atm_inst%albi_grc(g,1) - l2x(index_l2x_Sl_anidf,i) = lnd2atm_inst%albi_grc(g,2) - l2x(index_l2x_Sl_tref,i) = lnd2atm_inst%t_ref2m_grc(g) - l2x(index_l2x_Sl_qref,i) = lnd2atm_inst%q_ref2m_grc(g) - l2x(index_l2x_Sl_u10,i) = lnd2atm_inst%u_ref10m_grc(g) - l2x(index_l2x_Fall_taux,i) = -lnd2atm_inst%taux_grc(g) - l2x(index_l2x_Fall_tauy,i) = -lnd2atm_inst%tauy_grc(g) - l2x(index_l2x_Fall_lat,i) = -lnd2atm_inst%eflx_lh_tot_grc(g) - l2x(index_l2x_Fall_sen,i) = -lnd2atm_inst%eflx_sh_tot_grc(g) - l2x(index_l2x_Fall_lwup,i) = -lnd2atm_inst%eflx_lwrad_out_grc(g) - l2x(index_l2x_Fall_evap,i) = -lnd2atm_inst%qflx_evap_tot_grc(g) - l2x(index_l2x_Fall_swnet,i) = lnd2atm_inst%fsa_grc(g) - if (index_l2x_Fall_fco2_lnd /= 0) then - l2x(index_l2x_Fall_fco2_lnd,i) = -lnd2atm_inst%net_carbon_exchange_grc(g) - end if - - ! Additional fields for DUST, PROGSSLT, dry-deposition and VOC - ! These are now standard fields, but the check on the index makes sure the driver handles them - if (index_l2x_Sl_ram1 /= 0 ) l2x(index_l2x_Sl_ram1,i) = lnd2atm_inst%ram1_grc(g) - if (index_l2x_Sl_fv /= 0 ) l2x(index_l2x_Sl_fv,i) = lnd2atm_inst%fv_grc(g) - if (index_l2x_Sl_soilw /= 0 ) l2x(index_l2x_Sl_soilw,i) = lnd2atm_inst%h2osoi_vol_grc(g,1) - if (index_l2x_Fall_flxdst1 /= 0 ) l2x(index_l2x_Fall_flxdst1,i)= -lnd2atm_inst%flxdst_grc(g,1) - if (index_l2x_Fall_flxdst2 /= 0 ) l2x(index_l2x_Fall_flxdst2,i)= -lnd2atm_inst%flxdst_grc(g,2) - if (index_l2x_Fall_flxdst3 /= 0 ) l2x(index_l2x_Fall_flxdst3,i)= -lnd2atm_inst%flxdst_grc(g,3) - if (index_l2x_Fall_flxdst4 /= 0 ) l2x(index_l2x_Fall_flxdst4,i)= -lnd2atm_inst%flxdst_grc(g,4) - - - ! for dry dep velocities - if (index_l2x_Sl_ddvel /= 0 ) then - l2x(index_l2x_Sl_ddvel:index_l2x_Sl_ddvel+n_drydep-1,i) = & - lnd2atm_inst%ddvel_grc(g,:n_drydep) - end if - - ! for MEGAN VOC emis fluxes - if (index_l2x_Fall_flxvoc /= 0 ) then - l2x(index_l2x_Fall_flxvoc:index_l2x_Fall_flxvoc+shr_megan_mechcomps_n-1,i) = & - -lnd2atm_inst%flxvoc_grc(g,:shr_megan_mechcomps_n) - end if - - - ! for fire emis fluxes - if (index_l2x_Fall_flxfire /= 0 ) then - l2x(index_l2x_Fall_flxfire:index_l2x_Fall_flxfire+shr_fire_emis_mechcomps_n-1,i) = & - -lnd2atm_inst%fireflx_grc(g,:shr_fire_emis_mechcomps_n) - l2x(index_l2x_Sl_ztopfire,i) = lnd2atm_inst%fireztop_grc(g) - end if - - if (index_l2x_Fall_methane /= 0) then - l2x(index_l2x_Fall_methane,i) = -lnd2atm_inst%flux_ch4_grc(g) - endif - - ! sign convention is positive downward with - ! hierarchy of atm/glc/lnd/rof/ice/ocn. - ! I.e. water sent from land to rof is positive - - ! surface runoff is the sum of qflx_over, qflx_h2osfc_surf - l2x(index_l2x_Flrl_rofsur,i) = lnd2atm_inst%qflx_rofliq_qsur_grc(g) & - + lnd2atm_inst%qflx_rofliq_h2osfc_grc(g) - - ! subsurface runoff is the sum of qflx_drain and qflx_perched_drain - l2x(index_l2x_Flrl_rofsub,i) = lnd2atm_inst%qflx_rofliq_qsub_grc(g) & - + lnd2atm_inst%qflx_rofliq_drain_perched_grc(g) - - ! qgwl sent individually to coupler - l2x(index_l2x_Flrl_rofgwl,i) = lnd2atm_inst%qflx_rofliq_qgwl_grc(g) - - ! ice sent individually to coupler - l2x(index_l2x_Flrl_rofi,i) = lnd2atm_inst%qflx_rofice_grc(g) - - ! irrigation flux to be removed from main channel storage (negative) - l2x(index_l2x_Flrl_irrig,i) = - lnd2atm_inst%qirrig_grc(g) - - ! glc coupling - ! We could avoid setting these fields if glc_present is .false., if that would - ! help with performance. (The downside would be that we wouldn't have these fields - ! available for diagnostic purposes or to force a later T compset with dlnd.) - do num = 0,glc_nec - l2x(index_l2x_Sl_tsrf(num),i) = lnd2glc_inst%tsrf_grc(g,num) - l2x(index_l2x_Sl_topo(num),i) = lnd2glc_inst%topo_grc(g,num) - l2x(index_l2x_Flgl_qice(num),i) = lnd2glc_inst%qice_grc(g,num) - end do - - ! Check if any output sent to the coupler is NaN - if ( any(isnan(l2x(:,i))) )then - write(iulog,*) '# of NaNs = ', count(isnan(l2x(:,i))) - write(iulog,*) 'Which are NaNs = ', isnan(l2x(:,i)) - do k = 1, size(l2x(:,i)) - if ( isnan(l2x(k,i)) )then - call shr_string_listGetName( seq_flds_l2x_fields, k, fname ) - write(iulog,*) trim(fname) - end if - end do - write(iulog,*) 'gridcell index = ', g - call endrun( sub//' ERROR: One or more of the output from CLM to the coupler are NaN ' ) - end if - - end do - - end subroutine lnd_export - -end module lnd_import_export diff --git a/src/dyn_subgrid/CMakeLists.txt b/src/dyn_subgrid/CMakeLists.txt deleted file mode 100644 index 41ed645376..0000000000 --- a/src/dyn_subgrid/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -set(genf90_files - dynVarMod.F90.in - dynVarTimeInterpMod.F90.in - dynVarTimeUninterpMod.F90.in - ) - -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) - -sourcelist_to_parent(clm_genf90_sources) - -list(APPEND clm_sources "${clm_genf90_sources}") - -list(APPEND clm_sources - dynColumnStateUpdaterMod.F90 - dynColumnTemplateMod.F90 - dynPatchStateUpdaterMod.F90 - dynPriorWeightsMod.F90 - dynTimeInfoMod.F90 - dynLandunitAreaMod.F90 - dynInitColumnsMod.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 b/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 deleted file mode 100644 index f5e3763cdc..0000000000 --- a/src/dyn_subgrid/dynColumnStateUpdaterMod.F90 +++ /dev/null @@ -1,951 +0,0 @@ -module dynColumnStateUpdaterMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Class for adjusting column-level state variables due to transient column areas. - ! - ! In each time step, the object should be set up with: - ! - ! - call column_state_updater%set_old_weights (before dyn subgrid weight updates) - ! - ! - call column_state_updater%set_new_weights (after dyn subgrid weight updates) - ! - ! Then it can be used to update each state variable with a call to one of the variants of: - ! - ! - call column_state_updater%update_column_state_* - ! - ! All calls must be made from within a loop over clumps. - ! - ! The following methods are available for state updates: - ! - ! - update_column_state_no_special_handling - ! No special handling is done for any columns. This method is appropriate for - ! state variables that have valid values for all landunits. It is also - ! appropriate for state variables that are not typically handled for special - ! landunits, but when you want the behavior to be: When a special landunit takes - ! over some area from a standard landunit, you want the mass below the shrinking - ! column to remain in place, "frozen" beneath the growing special column - and - ! this mass can later be released again if the special landunit is eventually - ! taken back over by a standard landunit. - ! - ! - update_column_state_fill_special_using_natveg - ! Columns on any "special" landunit contribute mass-per-unit-area equal to the - ! current state on the first natural vegetation column on its grid cell. This - ! method is appropriate for state variables that are not tracked on special - ! landunits, when you want their value to remain unchanged when a vegetated - ! landunit takes over area from a special landunit. - ! - ! - update_column_state_fill_using_fixed_values - ! Each specially-treated landunit is given its own constant value for the state - ! variable, which is the mass-per-unit-area contributed when a column on that - ! landunit shrinks. This method is appropriate when you want to treat certain - ! landunits as contributing some fixed amount of mass-per-unit-area when they - ! shrink - this fixed amount can be 0 or some non-0 value. - ! - ! - update_column_state_fill_special_using_fixed_value - ! Convenience wrapper to the more general - ! update_column_state_fill_using_fixed_values. This method is appropriate when - ! all special landunits contribute the same fixed value. - ! - ! All update methods accept optional fractional areas. If provided, these give the - ! fraction of the column over which the state variable applies. For example, this can be - ! used if each column is split into an inundated and uninundated fraction; if the state - ! variable gives mass per unit area of the inundated portion of the column, then - ! fractional_area should specify the inundated fraction of each column. (If no - ! fractional areas are provided, then the state variable is assumed to apply to the - ! entire column, which is the typical case.) If fractional areas are provided, both - ! 'old' (before area updates) and 'new' (after area updates) versions must be provided. - ! The determination of the new fractional areas should be done via a call to - ! update_column_state_no_special_handling: the code for working with fractional areas - ! has no capability to do any special handling, and there could be inconsistencies if - ! the new fractional areas were determined using a method that has some special - ! handling. Thus, fractional_area must be valid for all columns, even if the state - ! variable itself is filled using one of the special-handling methods here. - ! - ! For methods other than update_column_state_no_special_handling, an additional inout - ! argument (non_conserved_mass_grc) accumulates the non-conserved mass due to shrinking - ! or growing specially-treated columns. Note that the methods here add to (or subtract - ! from) the existing value in this variable; thus, the caller must zero this out at the - ! appropriate time (typically before making any calls to the methods here - either once - ! per time step or once for an entire run). (This accumulation is done so that multiple - ! state variables can all contribute to the same non-conserved-mass variable, and so - ! that - if desired - this non-conserved mass can accumulate over the course of a run.) - ! - ! All methods accept an optional output argument (adjustment) which gives the apparent - ! state adjustment in each column - that is, the per-column-area value after area - ! changes minus the per-column-area value before area changes. This adjustment will be 0 - ! for shrinking columns, and can be either positive or negative for growing - ! columns. If there are fractional areas, then this adjustment is defined as (val_new * - ! fractional_area_new - val_old * fractional_area_old). - ! - ! NOTE(wjs, 2017-02-24) The implementation involves a few levels of calls to get to the - ! real work routine (update_column_state). This design made sense (in terms of removing - ! code duplication) when there were a number of "front-end" routines, with different - ! special handling. But now it seems we're moving towards having no special handling. - ! If we ditch all of the special handling, we could also ditch these extra levels. This - ! would make the code more straightforward, and would also improve performance. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : namec, spval - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC - use ColumnType , only : col - use LandunitType , only : lun - use landunit_varcon , only : max_lunit, landunit_is_special - use dynColumnTemplateMod , only : template_col_from_natveg_array, TEMPLATE_NONE_FOUND - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: column_state_updater_type - - type column_state_updater_type - private - real(r8), allocatable :: cwtgcell_old(:) ! old column weights on the grid cell - real(r8), allocatable :: cwtgcell_new(:) ! new column weights on the grid cell - - ! (cwtgcell_new - cwtgcell_old) from last call to set_new_weights - real(r8), allocatable :: area_gained_col(:) - - ! For each column, a 'template' column determined as: the first active column on the - ! natural veg landunit in the same grid cell as the target column. 'active' is - ! determined at the time of the call to set_old_weights, so that we consider whether - ! a column was active in the previous time step, rather than newly-active. - integer , allocatable :: natveg_template_col(:) - - ! Whether there have been any changes in this time step. This is indexed by clump so - ! that it is thread-safe (so the different clumps don't stomp on each other). This - ! implies that the methods on this object need to be called from a loop over - ! clumps. (In the future, we plan to rework threading so that there is a separate - ! object for each clump. In this case the indexing by clump will go away here - - ! instead, there will be a single scalar 'any_changes' logical for each object.) - logical, allocatable :: any_changes(:) - - contains - ! Public routines - procedure, public :: set_old_weights ! set weights before dyn subgrid updates - procedure, public :: set_new_weights ! set weights after dyn subgrid updates - - ! Various ways to update a column-level state variable based on changing column areas: - procedure, public :: update_column_state_no_special_handling - procedure, public :: update_column_state_fill_special_using_natveg - procedure, public :: update_column_state_fill_using_fixed_values - procedure, public :: update_column_state_fill_special_using_fixed_value - - ! Private routines - - ! intermediate routine between the public routines and the real work routine - ! (update_column_state); this routine determines the fractional_areas to use in - ! update_column_state - procedure, private :: update_column_state_with_optional_fractions - - ! do the work of updating a column state - procedure, private :: update_column_state - end type column_state_updater_type - - interface column_state_updater_type - module procedure constructor ! initialize a column_state_updater_type object - end interface column_state_updater_type - - ! !PUBLIC VARIABLES: - ! For update_column_state_fill_using_fixed_values, any landunit with - ! FILLVAL_USE_EXISTING_VALUE will use the existing value in the state variable - real(r8), parameter, public :: FILLVAL_USE_EXISTING_VALUE = spval - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor(bounds, nclumps) - ! - ! !DESCRIPTION: - ! Initialize a column_state_updater_type object - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - type(column_state_updater_type) :: constructor ! function result - type(bounds_type), intent(in) :: bounds ! processor bounds - integer , intent(in) :: nclumps ! number of clumps per proc - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, errMsg(sourcefile, __LINE__)) - - allocate(constructor%cwtgcell_old(bounds%begc:bounds%endc)) - constructor%cwtgcell_old(:) = nan - allocate(constructor%cwtgcell_new(bounds%begc:bounds%endc)) - constructor%cwtgcell_new(:) = nan - allocate(constructor%area_gained_col(bounds%begc:bounds%endc)) - constructor%area_gained_col(:) = nan - allocate(constructor%natveg_template_col(bounds%begc:bounds%endc)) - constructor%natveg_template_col(:) = TEMPLATE_NONE_FOUND - - allocate(constructor%any_changes(nclumps)) - constructor%any_changes(:) = .false. - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine set_old_weights(this, bounds) - ! - ! !DESCRIPTION: - ! Set subgrid weights before dyn subgrid updates - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c - - character(len=*), parameter :: subname = 'set_old_weights' - !----------------------------------------------------------------------- - - do c = bounds%begc, bounds%endc - this%cwtgcell_old(c) = col%wtgcell(c) - end do - - call template_col_from_natveg_array(bounds, col%active(bounds%begc:bounds%endc), & - this%natveg_template_col(bounds%begc:bounds%endc)) - - end subroutine set_old_weights - - !----------------------------------------------------------------------- - subroutine set_new_weights(this, bounds, clump_index) - ! - ! !DESCRIPTION: - ! Set subgrid weights after dyn subgrid updates - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer , intent(in) :: clump_index - - ! - ! !LOCAL VARIABLES: - integer :: c - - character(len=*), parameter :: subname = 'set_new_weights' - !----------------------------------------------------------------------- - - this%any_changes(clump_index) = .false. - do c = bounds%begc, bounds%endc - this%cwtgcell_new(c) = col%wtgcell(c) - this%area_gained_col(c) = this%cwtgcell_new(c) - this%cwtgcell_old(c) - if (this%area_gained_col(c) /= 0._r8) then - this%any_changes(clump_index) = .true. - end if - end do - - end subroutine set_new_weights - - !----------------------------------------------------------------------- - subroutine update_column_state_no_special_handling(this, bounds, clump_index, & - var, fractional_area_old, fractional_area_new, adjustment) - ! - ! !DESCRIPTION: - ! Adjust the values of a column-level state variable due to changes in subgrid - ! weights. - ! - ! This method does no special handling of any columns. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer, intent(in) :: clump_index - - real(r8), intent(inout) :: var( bounds%begc: ) ! column-level variable - - ! Fraction of each column over which the state variable applies. See module-level - ! documentation for details. You must provide both old & new fractional areas, or - ! neither: it is invalid to provide just one. Fractional areas should be valid for all - ! columns, and fractional_area_new should have been computed based on a call to - ! update_column_state_no_special_handling: code that works with these fractional areas - ! is not able to do any special handling. - real(r8), optional, intent(in) :: fractional_area_old( bounds%begc: ) - real(r8), optional, intent(in) :: fractional_area_new( bounds%begc: ) - - ! Apparent state adjustment in each column - real(r8), optional, intent(out) :: adjustment( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - real(r8) :: vals_input(bounds%begc:bounds%endc) - logical :: vals_input_valid(bounds%begc:bounds%endc) - logical :: has_prognostic_state(bounds%begc:bounds%endc) - real(r8) :: non_conserved_mass(bounds%begg:bounds%endg) - character(len=:), allocatable :: err_msg - real(r8), parameter :: conservation_tolerance = 1.e-12_r8 - - character(len=*), parameter :: subname = 'update_column_state_no_special_handling' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(var) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - ! Even if there's no work to be done, need to zero out adjustment, since it's - ! intent(out), and caller may expect it to return in a reasonable state. - if (present(adjustment)) then - SHR_ASSERT_ALL((ubound(adjustment) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - adjustment(bounds%begc:bounds%endc) = 0._r8 - end if - - if (this%any_changes(clump_index)) then - - vals_input(bounds%begc:bounds%endc) = var(bounds%begc:bounds%endc) - vals_input_valid(bounds%begc:bounds%endc) = .true. - has_prognostic_state(bounds%begc:bounds%endc) = .true. - non_conserved_mass(bounds%begg:bounds%endg) = 0._r8 - - ! explicit bounds not needed on any of these arguments - and specifying explicit - ! bounds defeats some later bounds checking (for fractional_area_old and - ! fractional_area_new) - call this%update_column_state_with_optional_fractions(& - bounds = bounds, & - vals_input = vals_input, & - vals_input_valid = vals_input_valid, & - has_prognostic_state = has_prognostic_state, & - var = var, & - non_conserved_mass = non_conserved_mass, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new, & - adjustment = adjustment) - - ! Since there is no special handling in this routine, the non_conserved_mass variable - ! should not have any accumulation. We allow for roundoff-level accumulation in case - ! non-conserved mass is determined in a way that is prone to roundoff-level errors. - err_msg = subname//': ERROR: failure to conserve mass when using no special handling' - SHR_ASSERT_ALL(abs(non_conserved_mass(bounds%begg:bounds%endg)) < conservation_tolerance, err_msg) - - end if - - end subroutine update_column_state_no_special_handling - - !----------------------------------------------------------------------- - subroutine update_column_state_fill_special_using_natveg(this, bounds, clump_index, & - var, non_conserved_mass_grc, fractional_area_old, fractional_area_new, adjustment) - ! - ! !DESCRIPTION: - ! Adjust the values of a column-level state variable due to changes in subgrid - ! weights. - ! - ! In this method, any shrinking column on a special landunit contributes state equal - ! to the first natural vegetation column on its grid cell. - ! - ! For the sake of determining non-conserved mass, special landunits are treated as - ! having a value of 0 - i.e., any non-zero quantity in var(c) (for c in a special - ! landunit) is ignored. Thus, even though a shrinking special column can contribute a - ! non-zero value, this non-zero state is treated as having been created out of thin - ! air for conservation-tracking purposes. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer, intent(in) :: clump_index - - real(r8) , intent(inout) :: var( bounds%begc: ) ! column-level variable - - ! Mass lost (per unit of grid cell area) from each grid cell due to changing area of - ! special landunits. When a special landunit grows, it throws away all mass that would - ! be added to it; when a special landunit shrinks, it pulls some virtual mass out of - ! thin air (as given by the quantity in the vegetated column in that grid cell); this - ! variable accounts for both of these cases. Positive denotes mass lost from the grid - ! cell, negative denotes mass gained by the grid cell. Note that this accumulates on - ! top of whatever value is already present in this array: the caller must zero this - ! out appropriately. - real(r8) , intent(inout) :: non_conserved_mass_grc( bounds%begg: ) - - ! Fraction of each column over which the state variable applies. See module-level - ! documentation for details. You must provide both old & new fractional areas, or - ! neither: it is invalid to provide just one. Fractional areas should be valid for all - ! columns, and fractional_area_new should have been computed based on a call to - ! update_column_state_no_special_handling: code that works with these fractional areas - ! is not able to do any special handling. - real(r8), optional, intent(in) :: fractional_area_old( bounds%begc: ) - real(r8), optional, intent(in) :: fractional_area_new( bounds%begc: ) - - ! Apparent state adjustment in each column - real(r8), optional, intent(out) :: adjustment( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: c, l - integer :: template_col - real(r8) :: vals_input(bounds%begc:bounds%endc) - logical :: vals_input_valid(bounds%begc:bounds%endc) - logical :: has_prognostic_state(bounds%begc:bounds%endc) - - character(len=*), parameter :: subname = 'update_column_state_fill_special_using_natveg' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(var) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(non_conserved_mass_grc) == (/bounds%begg/)), errMsg(sourcefile, __LINE__)) - - ! Even if there's no work to be done, need to zero out adjustment, since it's - ! intent(out), and caller may expect it to return in a reasonable state. - if (present(adjustment)) then - SHR_ASSERT_ALL((ubound(adjustment) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - adjustment(bounds%begc:bounds%endc) = 0._r8 - end if - - if (this%any_changes(clump_index)) then - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - has_prognostic_state(c) = .false. - - template_col = this%natveg_template_col(c) - if (template_col == TEMPLATE_NONE_FOUND) then - vals_input(c) = spval - vals_input_valid(c) = .false. - else - vals_input(c) = var(template_col) - vals_input_valid(c) = .true. - end if - else - has_prognostic_state(c) = .true. - vals_input(c) = var(c) - vals_input_valid(c) = .true. - end if - end do - - ! explicit bounds not needed on any of these arguments - and specifying explicit - ! bounds defeats some later bounds checking (for fractional_area_old and - ! fractional_area_new) - call this%update_column_state_with_optional_fractions(& - bounds = bounds, & - vals_input = vals_input, & - vals_input_valid = vals_input_valid, & - has_prognostic_state = has_prognostic_state, & - var = var, & - non_conserved_mass = non_conserved_mass_grc, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new, & - adjustment = adjustment) - - end if - - end subroutine update_column_state_fill_special_using_natveg - - !----------------------------------------------------------------------- - subroutine update_column_state_fill_using_fixed_values(this, bounds, clump_index, & - var, & - landunit_values, non_conserved_mass_grc, & - fractional_area_old, fractional_area_new, & - adjustment) - ! - ! !DESCRIPTION: - ! Adjust the values of a column-level state variable due to changes in subgrid - ! weights. - ! - ! In this method, any column in landunit type i is assumed to have state equal to - ! landunit_values(i). This is used when such a column is shrinking. However, if - ! landunit_values(i) is FILLVAL_USE_EXISTING_VALUE, then columns in landunit type i - ! keep their existing value in the state variable (var). - ! - ! Landunits with landunit_values(i) = FILLVAL_USE_EXISTING_VALUE can accept mass, - ! others cannot. - ! - ! For example: If landunit_values(istwet) = 30, then any shrinking wetland column - ! provides a mass-per-unit-area of 30 for this state variable, and growing wetland - ! columns cannot except mass. On the other hand, if landunit_values(istwet) = - ! FILLVAL_USE_EXISTING_VALUE, then shrinking wetland columns provide a - ! mass-per-unit-area equal to var for the given column, and growing wetland columns - ! can accept mass for this state variable. - ! - ! For the sake of determining non-conserved mass, specially-treated landunits (those - ! with landunit_values(i) /= FILLVAL_USE_EXISTING_VALUE) are treated as having a value - ! of 0 - i.e., any non-zero quantity in var(c) (for c in a specially-treated landunit) - ! is ignored. Thus, even though a shrinking special column can contribute a - ! non-zero value, this non-zero state is treated as having been created out of thin - ! air for conservation-tracking purposes. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer, intent(in) :: clump_index - - real(r8) , intent(inout) :: var( bounds%begc: ) ! column-level variable - real(r8) , intent(in) :: landunit_values(:) ! value to use as input for each landunit type - - ! Mass lost (per unit of grid cell area) from each grid cell due to changing area of - ! specially-treated landunits - any landunit with landunit_values(i) /= - ! FILLVAL_USE_EXISTING_VALUE. When a specially-treated landunit grows, it throws away - ! all mass that would be added to it; when a specially-treated landunit shrinks, it - ! pulls some virtual mass out of thin air (as given by landunit_values); this variable - ! accounts for both of these cases. Positive denotes mass lost from the grid cell, - ! negative denotes mass gained by the grid cell. Note that this accumulates on top of - ! whatever value is already present in this array: the caller must zero this out - ! appropriately. - real(r8) , intent(inout) :: non_conserved_mass_grc( bounds%begg: ) - - ! Fraction of each column over which the state variable applies. See module-level - ! documentation for details. You must provide both old & new fractional areas, or - ! neither: it is invalid to provide just one. Fractional areas should be valid for all - ! columns, and fractional_area_new should have been computed based on a call to - ! update_column_state_no_special_handling: code that works with these fractional areas - ! is not able to do any special handling. - real(r8), optional, intent(in) :: fractional_area_old( bounds%begc: ) - real(r8), optional, intent(in) :: fractional_area_new( bounds%begc: ) - - ! Apparent state adjustment in each column - real(r8), optional, intent(out) :: adjustment( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - character(len=:), allocatable :: err_msg - integer :: c, l - integer :: ltype - real(r8) :: my_fillval - real(r8) :: vals_input(bounds%begc:bounds%endc) - logical :: vals_input_valid(bounds%begc:bounds%endc) - logical :: has_prognostic_state(bounds%begc:bounds%endc) - - character(len=*), parameter :: subname = 'update_column_state_fill_using_fixed_values' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(var) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - err_msg = subname//': must provide values for all landunits' - SHR_ASSERT((size(landunit_values) == max_lunit), err_msg) - SHR_ASSERT_ALL((ubound(non_conserved_mass_grc) == (/bounds%begg/)), errMsg(sourcefile, __LINE__)) - - ! Even if there's no work to be done, need to zero out adjustment, since it's - ! intent(out), and caller may expect it to return in a reasonable state. - if (present(adjustment)) then - SHR_ASSERT_ALL((ubound(adjustment) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - adjustment(bounds%begc:bounds%endc) = 0._r8 - end if - - if (this%any_changes(clump_index)) then - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - ltype = lun%itype(l) - my_fillval = landunit_values(ltype) - - if (my_fillval == FILLVAL_USE_EXISTING_VALUE) then - vals_input(c) = var(c) - vals_input_valid(c) = .true. - has_prognostic_state(c) = .true. - else - vals_input(c) = my_fillval - vals_input_valid(c) = .true. - has_prognostic_state(c) = .false. - end if - end do - - ! explicit bounds not needed on any of these arguments - and specifying explicit - ! bounds defeats some later bounds checking (for fractional_area_old and - ! fractional_area_new) - call this%update_column_state_with_optional_fractions( & - bounds = bounds, & - vals_input = vals_input, & - vals_input_valid = vals_input_valid, & - has_prognostic_state = has_prognostic_state, & - var = var, & - non_conserved_mass = non_conserved_mass_grc, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new, & - adjustment = adjustment) - - end if - - end subroutine update_column_state_fill_using_fixed_values - - !----------------------------------------------------------------------- - subroutine update_column_state_fill_special_using_fixed_value(this, bounds, clump_index, & - var, & - special_value, non_conserved_mass_grc, & - fractional_area_old, fractional_area_new, & - adjustment) - ! - ! !DESCRIPTION: - ! Adjust the values of a column-level state variable due to changes in subgrid - ! weights. - ! - ! This method is a convenience wrapper to the more general - ! update_column_state_fill_using_fixed_values. In this method, vegetated (non-special) - ! landunits are handled normally (i.e., given FILLVAL_USE_EXISTING_VALUE), and all - ! special landunits contribute the same fixed value. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer, intent(in) :: clump_index - - real(r8) , intent(inout) :: var( bounds%begc: ) ! column-level variable - real(r8) , intent(in) :: special_value ! value to use as input for all special landunits - - ! Mass lost (per unit of grid cell area) from each grid cell due to changing area of - ! special landunits. When a special landunit grows, it throws away all mass that would - ! be added to it; when a special landunit shrinks, it pulls some virtual mass out of - ! thin air (as given by the quantity in the vegetated column in that grid cell); this - ! variable accounts for both of these cases. Positive denotes mass lost from the grid - ! cell, negative denotes mass gained by the grid cell. Note that this accumulates on - ! top of whatever value is already present in this array: the caller must zero this - ! out appropriately. - real(r8) , intent(inout) :: non_conserved_mass_grc( bounds%begg: ) - - ! Fraction of each column over which the state variable applies. See module-level - ! documentation for details. You must provide both old & new fractional areas, or - ! neither: it is invalid to provide just one. Fractional areas should be valid for all - ! columns, and fractional_area_new should have been computed based on a call to - ! update_column_state_no_special_handling: code that works with these fractional areas - ! is not able to do any special handling. - real(r8), optional, intent(in) :: fractional_area_old( bounds%begc: ) - real(r8), optional, intent(in) :: fractional_area_new( bounds%begc: ) - - ! Apparent state adjustment in each column - real(r8), optional, intent(out) :: adjustment( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - real(r8) :: landunit_values(max_lunit) - integer :: ltype - - character(len=*), parameter :: subname = 'update_column_state_fill_special_using_fixed_value' - !----------------------------------------------------------------------- - - do ltype = 1, max_lunit - if (landunit_is_special(ltype)) then - landunit_values(ltype) = special_value - else - landunit_values(ltype) = FILLVAL_USE_EXISTING_VALUE - end if - end do - - call this%update_column_state_fill_using_fixed_values( & - bounds = bounds, & - clump_index = clump_index, & - var = var, & - landunit_values = landunit_values, & - non_conserved_mass_grc = non_conserved_mass_grc, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new, & - adjustment = adjustment) - - end subroutine update_column_state_fill_special_using_fixed_value - - - - ! ======================================================================== - ! Private methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine update_column_state_with_optional_fractions(this, bounds, & - vals_input, vals_input_valid, has_prognostic_state, & - var, non_conserved_mass, & - fractional_area_old, fractional_area_new, & - adjustment) - ! - ! !DESCRIPTION: - ! Intermediate routine between the public routines and the real work routine - ! (update_column_state). This routine determines the fractional areas to use in the - ! call to update_column_state, and then does the call to update_column_state. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - - ! value used as input for each column, if that column is shrinking (can differ from - ! var if we're doing special handling of that column) - real(r8), intent(in) :: vals_input( bounds%begc: ) - - ! whether each item in vals_input_valid is valid. An entry can be invalid if there is - ! was no way to derive an input for that column. - logical, intent(in) :: vals_input_valid( bounds%begc: ) - - ! whether each column simulates the given variable (which, among other things, - ! determines whether it can accept mass of this variable) - logical, intent(in) :: has_prognostic_state( bounds%begc: ) - - ! column-level variable of interest, updated in-place - real(r8), intent(inout) :: var( bounds%begc: ) - - ! mass lost (per unit of grid cell area) from each grid cell, if doing special - ! handling that leads mass to not be conserved; this can happen due to growing columns - ! where has_prognostic_state is false, or due to shrinking columns where - ! has_prognostic_state is false but vals_input /= 0. Positive denotes mass lost from - ! the grid cell, negative denotes mass gained by the grid cell. - real(r8), intent(inout) :: non_conserved_mass( bounds%begg: ) - - ! Fraction of each column over which the state variable applies. See module-level - ! documentation for details. You must provide both old & new fractional areas, or - ! neither: it is invalid to provide just one. Fractional areas should be valid for all - ! columns, and fractional_area_new should have been computed based on a call to - ! update_column_state_no_special_handling: code that works with these fractional areas - ! is not able to do any special handling. - real(r8), optional, intent(in) :: fractional_area_old( bounds%begc: ) - real(r8), optional, intent(in) :: fractional_area_new( bounds%begc: ) - - ! Apparent state adjustment in each column - real(r8), optional, intent(inout) :: adjustment( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - real(r8) :: my_fractional_area_old(bounds%begc:bounds%endc) - real(r8) :: my_fractional_area_new(bounds%begc:bounds%endc) - - character(len=*), parameter :: subname = 'update_column_state_with_optional_fractions' - !----------------------------------------------------------------------- - - if (present(fractional_area_old) .and. .not. present(fractional_area_new)) then - call endrun(subname//' ERROR: If fractional_area_old is provided, then fractional_area_new must be provided, too') - end if - - if (present(fractional_area_new) .and. .not. present(fractional_area_old)) then - call endrun(subname//' ERROR: If fractional_area_new is provided, then fractional_area_old must be provided, too') - end if - - if (present(fractional_area_old)) then - SHR_ASSERT_ALL((ubound(fractional_area_old) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - my_fractional_area_old(bounds%begc:bounds%endc) = fractional_area_old(bounds%begc:bounds%endc) - else - my_fractional_area_old(bounds%begc:bounds%endc) = 1._r8 - end if - - if (present(fractional_area_new)) then - SHR_ASSERT_ALL((ubound(fractional_area_new) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - my_fractional_area_new(bounds%begc:bounds%endc) = fractional_area_new(bounds%begc:bounds%endc) - else - my_fractional_area_new(bounds%begc:bounds%endc) = 1._r8 - end if - - call this%update_column_state(& - bounds = bounds, & - vals_input = vals_input(bounds%begc:bounds%endc), & - vals_input_valid = vals_input_valid(bounds%begc:bounds%endc), & - has_prognostic_state = has_prognostic_state(bounds%begc:bounds%endc), & - fractional_area_old = my_fractional_area_old(bounds%begc:bounds%endc), & - fractional_area_new = my_fractional_area_new(bounds%begc:bounds%endc), & - var = var(bounds%begc:bounds%endc), & - non_conserved_mass = non_conserved_mass(bounds%begg:bounds%endg), & - adjustment = adjustment) - - end subroutine update_column_state_with_optional_fractions - - - !----------------------------------------------------------------------- - subroutine update_column_state(this, bounds, & - vals_input, vals_input_valid, has_prognostic_state, & - fractional_area_old, fractional_area_new, & - var, non_conserved_mass, adjustment) - ! - ! !DESCRIPTION: - ! Do the work of updating a column-level state variable due to changes in subgrid - ! weights. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(column_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - - ! value used as input for each column, if that column is shrinking (can differ from - ! var if we're doing special handling of that column) - real(r8), intent(in) :: vals_input( bounds%begc: ) - - ! whether each item in vals_input_valid is valid. An entry can be invalid if there is - ! was no way to derive an input for that column. - logical, intent(in) :: vals_input_valid( bounds%begc: ) - - ! whether each column simulates the given variable (which, among other things, - ! determines whether it can accept mass of this variable) - logical, intent(in) :: has_prognostic_state( bounds%begc: ) - - ! Fraction of each column over which the state variable applies, for both the old and - ! new subgrid weights - real(r8), intent(in) :: fractional_area_old( bounds%begc: ) - real(r8), intent(in) :: fractional_area_new( bounds%begc: ) - - ! column-level variable of interest, updated in-place - real(r8), intent(inout) :: var( bounds%begc: ) - - ! mass lost (per unit of grid cell area) from each grid cell, if doing special - ! handling that leads mass to not be conserved; this can happen due to growing columns - ! where has_prognostic_state is false, or due to shrinking columns where - ! has_prognostic_state is false but vals_input /= 0. Positive denotes mass lost from - ! the grid cell, negative denotes mass gained by the grid cell. - real(r8), intent(inout) :: non_conserved_mass( bounds%begg: ) - - ! Apparent state adjustment in each column - real(r8), optional, intent(inout) :: adjustment( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: c, g - - ! whether vals_input /= var in the columns where it should be equal - logical :: bad_vals_input(bounds%begc:bounds%endc) - - ! fractional area lost from this column - real(r8) :: area_lost - - ! area-weighted amount lost from a given column - real(r8) :: area_weighted_loss - - ! area-weighted amount lost from decreasing weights, in each grid cell - ! ((mass-per-unit-area) * (fractional area lost)) - real(r8) :: total_loss_grc(bounds%begg:bounds%endg) - - ! total area lost by columns decreasing in area (fractional area of grid cell) - ! Note that this should exactly equal the total area gained by columns increasing in area - real(r8) :: total_area_lost_grc(bounds%begg:bounds%endg) - - ! amount of state gain needed per unit area of area gained - real(r8) :: gain_per_unit_area_grc(bounds%begg:bounds%endg) - - ! mass gained by a given column ((mass-gained-per-unit-area) * (fractional area gained)) - real(r8) :: mass_gained - - ! value in a column before update - real(r8) :: val_old - - character(len=:), allocatable :: message - - character(len=*), parameter :: subname = 'update_column_state' - !----------------------------------------------------------------------- - - ! ------------------------------------------------------------------------ - ! Error-checking on inputs - ! ------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(var) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(vals_input) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(has_prognostic_state) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fractional_area_old) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(fractional_area_new) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(non_conserved_mass) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - if (present(adjustment)) then - SHR_ASSERT_ALL((ubound(adjustment) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - end if - - ! For the sake of conservation - including the calculation of non_conserved_mass - we - ! assume that vals_input == var wherever has_prognostic_state is .true. We ensure that - ! is the case here. - where(has_prognostic_state .and. vals_input_valid) - bad_vals_input = (vals_input /= var) - elsewhere - ! where has_prognostic_state is false, vals_input can be anything - bad_vals_input = .false. - end where - message = subname//': ERROR: where has_prognostic_state is true, vals_input must equal var' - SHR_ASSERT_ALL(.not. bad_vals_input, message) - - ! ------------------------------------------------------------------------ - ! Begin main work - ! ------------------------------------------------------------------------ - - ! Determine the total mass loss for each grid cell, along with the gross area loss - ! (which should match the gross area gain) - total_loss_grc(bounds%begg:bounds%endg) = 0._r8 - total_area_lost_grc(bounds%begg:bounds%endg) = 0._r8 - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - if (this%area_gained_col(c) < 0._r8) then - if (.not. vals_input_valid(c)) then - write(iulog,*) subname//' ERROR: shrinking column without valid input value' - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - area_lost = -1._r8 * this%area_gained_col(c) - total_area_lost_grc(g) = total_area_lost_grc(g) + area_lost - area_weighted_loss = area_lost * vals_input(c) * fractional_area_old(c) - total_loss_grc(g) = total_loss_grc(g) + area_weighted_loss - - if (.not. has_prognostic_state(c)) then - ! If a column doesn't model this state variable, then its vals_input value is - ! really some fictitious quantity. So we track how much of this fictitious - ! quantity we added to the system. - non_conserved_mass(g) = non_conserved_mass(g) - area_weighted_loss - end if - end if - end do - - ! Determine the mass loss per unit area for each grid cell. We essentially lump all of - ! the loss together in a "loss" pool in each grid cell, so that we can then - ! distribute that loss amongst the growing columns. - do g = bounds%begg, bounds%endg - if (total_area_lost_grc(g) > 0._r8) then - gain_per_unit_area_grc(g) = total_loss_grc(g) / total_area_lost_grc(g) - else - gain_per_unit_area_grc(g) = 0._r8 - end if - end do - - ! Distribute gain to growing columns - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - if (this%area_gained_col(c) > 0._r8) then - mass_gained = this%area_gained_col(c) * gain_per_unit_area_grc(g) - if (has_prognostic_state(c)) then - val_old = var(c) - - ! Need to make sure fractional_area_new /= 0 to avoid divide-by-zero. Note - ! that fractional_area_new == 0 can only happen if both - ! fractional_area_old(c) == 0 and the fractional_areas of the shrinking - ! columns were all 0 - in which case the value of var is irrelevant for - ! conservation purposes. - if (fractional_area_new(c) /= 0._r8) then - var(c) = (this%cwtgcell_old(c) * var(c) * fractional_area_old(c) + mass_gained) / & - (this%cwtgcell_new(c) * fractional_area_new(c)) - end if - - if (present(adjustment)) then - adjustment(c) = var(c) * fractional_area_new(c) - & - val_old * fractional_area_old(c) - end if - else - non_conserved_mass(g) = non_conserved_mass(g) + mass_gained - end if - end if - end do - - end subroutine update_column_state - -end module dynColumnStateUpdaterMod diff --git a/src/dyn_subgrid/dynColumnTemplateMod.F90 b/src/dyn_subgrid/dynColumnTemplateMod.F90 deleted file mode 100644 index 7ac2921e8b..0000000000 --- a/src/dyn_subgrid/dynColumnTemplateMod.F90 +++ /dev/null @@ -1,168 +0,0 @@ -module dynColumnTemplateMod - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Routines for finding a template column to use for the state variables on some other - ! column of interest. - ! - ! For example, if a glacier column (with no carbon/nitrogen information) shrinks, and we - ! want to assume that its carbon and nitrogen state implicitly matches the state of the - ! vegetated landunit in that grid cell, then we can use a routine in this module to find - ! that vegetated lanadunit. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use clm_varcon , only : ispval - - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - - ! ------------------------------------------------------------------------ - ! Functions that operate on a single column at a time - ! ------------------------------------------------------------------------ - - ! Find column to use as template by looking for an active column on a particular landunit - public :: template_col_from_landunit - - ! ------------------------------------------------------------------------ - ! Subroutines that operate on the whole column-level array at once - ! ------------------------------------------------------------------------ - - ! Find column to use as template by looking for an active column on the natural veg landunit - public :: template_col_from_natveg_array - - ! - ! !PUBLIC VARIABLES: - - ! if no template column was found, this value is returned - integer, parameter, public :: TEMPLATE_NONE_FOUND = ispval - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ------------------------------------------------------------------------ - ! Functions that operate on a single column at a time - ! ------------------------------------------------------------------------ - - !----------------------------------------------------------------------- - function template_col_from_landunit(bounds, c_target, landunit_type, cactive) result(c_template) - ! - ! !DESCRIPTION: - ! Finds a column to serve as a template for the state variables on the target column. - ! - ! Looks for a landunit of the type given by landunit_type (e.g., istsoil, - ! istcrop). Looks for the first active column on this landunit type, in the same grid - ! cell; order of columns within a landunit is arbitrary (given by their order in - ! memory). Returns the column index of the first such column found. If there are no - ! active columns in this landunit in this grid cell, returns TEMPLATE_NONE_FOUND. - ! - ! Note that it is often most appropriate for cactive to be the active flags from the - ! *prior* time step, so that we don't identify a point that just became active for the - ! first time in this time step. - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: c_template ! function return value - - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: c_target ! column index for which we want a template - integer , intent(in) :: landunit_type ! landunit type from which we want to find a template column (e.g., istsoil) - logical , intent(in) :: cactive( bounds%begc: ) ! column-level active flags (generally from prior time step) - ! - ! !LOCAL VARIABLES: - logical :: found ! whether a suitable template column has been found - integer :: g,l,c ! indices of grid cell, landunit, column - - character(len=*), parameter :: subname = 'template_col_from_landunit' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(cactive) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - found = .false. - g = col%gridcell(c_target) - l = grc%landunit_indices(landunit_type, g) - - ! If this landunit exists on this grid cell... - if (l /= ispval) then - - ! Loop through columns on this landunit; stop if as soon as we find an active - ! column: that will serve as the template - c = lun%coli(l) - do while (.not. found .and. c <= lun%colf(l)) - if (cactive(c)) then - found = .true. - else - c = c + 1 - end if - end do - end if - - if (found) then - c_template = c - else - c_template = TEMPLATE_NONE_FOUND - end if - - end function template_col_from_landunit - - ! ------------------------------------------------------------------------ - ! Subroutines that operate on the whole column-level array at once - ! ------------------------------------------------------------------------ - - !----------------------------------------------------------------------- - subroutine template_col_from_natveg_array(bounds, cactive, c_templates) - ! - ! !DESCRIPTION: - ! For each column, finds a column to serve as a template for the state variables on - ! the target column. - ! - ! For each column: Looks for the first active column on the natural veg landunit in - ! the same grid cell as the target column. If there are no active columns in the - ! natural veg landunit in this grid cell, assigns TEMPLATE_NONE_FOUND. - ! - ! Note: If there are multiple columns on the natural veg. landunit, then a given - ! natural veg column may have a template col that differs from itself! The caller is - ! responsible for determining when this template column should be used and when it - ! should not be used. - ! - ! See also the notes about cactive under 'template_col_from_landunit'. - ! - ! !USES: - use landunit_varcon, only : istsoil - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - logical , intent(in) :: cactive( bounds%begc: ) ! column-level active flags (generally from prior time step) - integer , intent(out) :: c_templates( bounds%begc: ) ! template column for each column - ! - ! !LOCAL VARIABLES: - integer :: c - - character(len=*), parameter :: subname = 'template_col_from_natveg_array' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(cactive) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(c_templates) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do c = bounds%begc, bounds%endc - c_templates(c) = template_col_from_landunit(bounds, c, istsoil, & - cactive(bounds%begc:bounds%endc)) - end do - - end subroutine template_col_from_natveg_array - - - -end module dynColumnTemplateMod diff --git a/src/dyn_subgrid/dynConsBiogeophysMod.F90 b/src/dyn_subgrid/dynConsBiogeophysMod.F90 deleted file mode 100644 index 540a3321ed..0000000000 --- a/src/dyn_subgrid/dynConsBiogeophysMod.F90 +++ /dev/null @@ -1,337 +0,0 @@ -module dynConsBiogeophysMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Handle conservation of biogeophysical quantities (water & energy) with dynamic land - ! cover. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use UrbanParamsType , only : urbanparams_type - use EnergyFluxType , only : energyflux_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use TemperatureType , only : temperature_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use TotalWaterAndHeatMod, only : ComputeLiqIceMassNonLake, ComputeLiqIceMassLake - use TotalWaterAndHeatMod, only : ComputeHeatNonLake, ComputeHeatLake - use TotalWaterAndHeatMod, only : AdjustDeltaHeatForDeltaLiq - use TotalWaterAndHeatMod, only : heat_base_temp - use subgridAveMod , only : p2c, c2g - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use clm_varcon , only : tfrz, cpliq, hfus - use dynSubgridControlMod, only : get_for_testing_zero_dynbal_fluxes - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - public :: dyn_hwcontent_init ! compute grid-level heat and water content, before land cover change - public :: dyn_hwcontent_final ! compute grid-level heat and water content, after land cover change; also compute dynbal fluxes - ! - ! !PRIVATE MEMBER FUNCTIONS - private :: dyn_water_content ! compute gridcell total liquid and ice water contents - private :: dyn_heat_content ! compute gridcell total heat contents - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !--------------------------------------------------------------------------- - -contains - - !--------------------------------------------------------------------------- - subroutine dyn_hwcontent_init(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst) - ! - ! !DESCRIPTION: - ! Initialize variables used for dyn_hwcontent, and compute grid cell-level heat - ! and water content before land cover change - ! - ! Should be called BEFORE any subgrid weight updates this time step - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - integer , intent(in) :: num_lakec - integer , intent(in) :: filter_lakec(:) - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - !------------------------------------------------------------------------------- - - call dyn_water_content(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - soilhydrology_inst, waterstate_inst, & - liquid_mass = waterstate_inst%liq1_grc(bounds%begg:bounds%endg), & - ice_mass = waterstate_inst%ice1_grc(bounds%begg:bounds%endg)) - - call dyn_heat_content( bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - temperature_inst, waterstate_inst, & - heat_grc = temperature_inst%heat1_grc(bounds%begg:bounds%endg), & - liquid_water_temp_grc = temperature_inst%liquid_water_temp1_grc(bounds%begg:bounds%endg)) - - end subroutine dyn_hwcontent_init - - !--------------------------------------------------------------------------- - subroutine dyn_hwcontent_final(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst) - ! - ! !DESCRIPTION: - ! Compute grid cell-level heat and water content after land cover change, and compute - ! the dynbal fluxes - ! - ! Should be called AFTER all subgrid weight updates this time step - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - integer , intent(in) :: num_lakec - integer , intent(in) :: filter_lakec(:) - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: begg, endg - integer :: g ! grid cell index - real(r8) :: delta_liq(bounds%begg:bounds%endg) ! change in gridcell h2o liq content - real(r8) :: delta_ice(bounds%begg:bounds%endg) ! change in gridcell h2o ice content - real(r8) :: delta_heat(bounds%begg:bounds%endg) ! change in gridcell heat content - !--------------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - call dyn_water_content(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - soilhydrology_inst, waterstate_inst, & - liquid_mass = waterstate_inst%liq2_grc(bounds%begg:bounds%endg), & - ice_mass = waterstate_inst%ice2_grc(bounds%begg:bounds%endg)) - - call dyn_heat_content( bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - temperature_inst, waterstate_inst, & - heat_grc = temperature_inst%heat2_grc(bounds%begg:bounds%endg), & - liquid_water_temp_grc = temperature_inst%liquid_water_temp2_grc(bounds%begg:bounds%endg)) - - if (get_for_testing_zero_dynbal_fluxes()) then - do g = begg, endg - delta_liq(g) = 0._r8 - delta_ice(g) = 0._r8 - delta_heat(g) = 0._r8 - end do - else - do g = begg, endg - delta_liq(g) = waterstate_inst%liq2_grc(g) - waterstate_inst%liq1_grc(g) - delta_ice(g) = waterstate_inst%ice2_grc(g) - waterstate_inst%ice1_grc(g) - delta_heat(g) = temperature_inst%heat2_grc(g) - temperature_inst%heat1_grc(g) - end do - end if - - call AdjustDeltaHeatForDeltaLiq( & - bounds, & - delta_liq = delta_liq(bounds%begg:bounds%endg), & - liquid_water_temp1 = temperature_inst%liquid_water_temp1_grc(bounds%begg:bounds%endg), & - liquid_water_temp2 = temperature_inst%liquid_water_temp2_grc(bounds%begg:bounds%endg), & - delta_heat = delta_heat(bounds%begg:bounds%endg)) - - call waterflux_inst%qflx_liq_dynbal_dribbler%set_curr_delta(bounds, & - delta_liq(begg:endg)) - call waterflux_inst%qflx_liq_dynbal_dribbler%get_curr_flux(bounds, & - waterflux_inst%qflx_liq_dynbal_grc(begg:endg)) - - call waterflux_inst%qflx_ice_dynbal_dribbler%set_curr_delta(bounds, & - delta_ice(begg:endg)) - call waterflux_inst%qflx_ice_dynbal_dribbler%get_curr_flux(bounds, & - waterflux_inst%qflx_ice_dynbal_grc(begg:endg)) - - call energyflux_inst%eflx_dynbal_dribbler%set_curr_delta(bounds, & - delta_heat(begg:endg)) - call energyflux_inst%eflx_dynbal_dribbler%get_curr_flux(bounds, & - energyflux_inst%eflx_dynbal_grc(begg:endg)) - - end subroutine dyn_hwcontent_final - - !----------------------------------------------------------------------- - subroutine dyn_water_content(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - soilhydrology_inst, waterstate_inst, & - liquid_mass, ice_mass) - ! - ! !DESCRIPTION: - ! Compute gridcell total liquid and ice water contents - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - integer , intent(in) :: num_lakec - integer , intent(in) :: filter_lakec(:) - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(waterstate_type) , intent(in) :: waterstate_inst - real(r8) , intent(out) :: liquid_mass( bounds%begg: ) ! kg m-2 - real(r8) , intent(out) :: ice_mass( bounds%begg: ) ! kg m-2 - ! - ! !LOCAL VARIABLES: - real(r8) :: liquid_mass_col(bounds%begc:bounds%endc) ! kg m-2 - real(r8) :: ice_mass_col(bounds%begc:bounds%endc) ! kg m-2 - - character(len=*), parameter :: subname = 'dyn_water_content' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(liquid_mass) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(ice_mass) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call ComputeLiqIceMassNonLake(bounds, num_nolakec, filter_nolakec, & - soilhydrology_inst, waterstate_inst, & - liquid_mass_col(bounds%begc:bounds%endc), & - ice_mass_col(bounds%begc:bounds%endc)) - - call ComputeLiqIceMassLake(bounds, num_lakec, filter_lakec, & - waterstate_inst, & - liquid_mass_col(bounds%begc:bounds%endc), & - ice_mass_col(bounds%begc:bounds%endc)) - - call c2g(bounds, & - carr = liquid_mass_col(bounds%begc:bounds%endc), & - garr = liquid_mass(bounds%begg:bounds%endg), & - c2l_scale_type = 'urbanf', & - l2g_scale_type = 'unity') - - call c2g(bounds, & - carr = ice_mass_col(bounds%begc:bounds%endc), & - garr = ice_mass(bounds%begg:bounds%endg), & - c2l_scale_type = 'urbanf', & - l2g_scale_type = 'unity') - - end subroutine dyn_water_content - - - !--------------------------------------------------------------------------- - subroutine dyn_heat_content(bounds, & - num_nolakec, filter_nolakec, & - num_lakec, filter_lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - temperature_inst, waterstate_inst, & - heat_grc, liquid_water_temp_grc) - - ! !DESCRIPTION: - ! Compute grid-level heat and water content to track conservation with respect to - ! dynamic land cover. - ! - ! Heat content is computed relative to a baseline of 0 C. So temperatures above 0 C - ! lead to a positive heat content, temperatures below 0 C lead to a negative heat - ! content. For water, the baseline is considered to be ice at 0 C, so for liquid water - ! we include the latent heat of fusion. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec - integer , intent(in) :: filter_nolakec(:) - integer , intent(in) :: num_lakec - integer , intent(in) :: filter_lakec(:) - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(in) :: soilhydrology_inst - type(temperature_type) , intent(in) :: temperature_inst - type(waterstate_type) , intent(in) :: waterstate_inst - - real(r8) , intent(out) :: heat_grc( bounds%begg: ) ! total heat content for each grid cell [J/m^2] - real(r8) , intent(out) :: liquid_water_temp_grc( bounds%begg: ) ! weighted average liquid water temperature for each grid cell (K) - - ! - ! !LOCAL VARIABLES: - integer :: g - - real(r8) :: heat_col(bounds%begc:bounds%endc) ! sum of heat content for all columns [J/m^2] - real(r8) :: heat_liquid_col(bounds%begc:bounds%endc) ! sum of heat content for all columns: liquid water, excluding latent heat [J/m^2] - real(r8) :: cv_liquid_col(bounds%begc:bounds%endc) ! sum of liquid heat capacity for all columns [J/(m^2 K)] - - real(r8) :: heat_liquid_grc(bounds%begg:bounds%endg) ! heat_liquid_col averaged to grid cell [J/m^2] - real(r8) :: cv_liquid_grc(bounds%begg:bounds%endg) ! cv_liquid_col averaged to grid cell [J/(m^2 K)] - !------------------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(heat_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(liquid_water_temp_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call ComputeHeatNonLake(bounds, num_nolakec, filter_nolakec, & - urbanparams_inst, soilstate_inst, & - temperature_inst, waterstate_inst, soilhydrology_inst, & - heat = heat_col(bounds%begc:bounds%endc), & - heat_liquid = heat_liquid_col(bounds%begc:bounds%endc), & - cv_liquid = cv_liquid_col(bounds%begc:bounds%endc)) - - call ComputeHeatLake(bounds, num_lakec, filter_lakec, & - soilstate_inst, temperature_inst, waterstate_inst, & - heat = heat_col(bounds%begc:bounds%endc), & - heat_liquid = heat_liquid_col(bounds%begc:bounds%endc), & - cv_liquid = cv_liquid_col(bounds%begc:bounds%endc)) - - call c2g(bounds, & - carr = heat_col(bounds%begc:bounds%endc), & - garr = heat_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'urbanf', & - l2g_scale_type = 'unity') - - call c2g(bounds, & - carr = heat_liquid_col(bounds%begc:bounds%endc), & - garr = heat_liquid_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'urbanf', & - l2g_scale_type = 'unity') - - call c2g(bounds, & - carr = cv_liquid_col(bounds%begc:bounds%endc), & - garr = cv_liquid_grc(bounds%begg:bounds%endg), & - c2l_scale_type = 'urbanf', & - l2g_scale_type = 'unity') - - do g = bounds%begg, bounds%endg - if (cv_liquid_grc(g) > 0._r8) then - liquid_water_temp_grc(g) = & - (heat_liquid_grc(g) / cv_liquid_grc(g)) + heat_base_temp - else - ! 0 or negative water mass in this grid cell: set an arbitrary temperature - liquid_water_temp_grc(g) = tfrz - end if - end do - - end subroutine dyn_heat_content - -end module dynConsBiogeophysMod diff --git a/src/dyn_subgrid/dynEDMod.F90 b/src/dyn_subgrid/dynEDMod.F90 deleted file mode 100644 index e1cb1ccb42..0000000000 --- a/src/dyn_subgrid/dynEDMod.F90 +++ /dev/null @@ -1,43 +0,0 @@ -module dynEDMod - - !----------------------------------------------------------------------- - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use landunit_varcon, only : istsoil - use PatchType , only : patch - use ColumnType , only : col - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - public :: dyn_ED ! transfers weights calculated internally by fates into wtcol. - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine dyn_ED( bounds ) - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - - ! !LOCAL VARIABLES: - integer :: p,c ! indices - !------------------------------------------------------------------------ - - do p = bounds%begp,bounds%endp - c = patch%column(p) - if (col%itype(c) == istsoil) then - if (patch%is_veg(p) .or. patch%is_bareground(p)) then - patch%wtcol(p) = patch%wt_ed(p) - else - patch%wtcol(p) = 0.0_r8 - end if - end if - end do - - end subroutine dyn_ED - -end module dynEDMod diff --git a/src/dyn_subgrid/dynFileMod.F90 b/src/dyn_subgrid/dynFileMod.F90 deleted file mode 100644 index d7f22f9dcd..0000000000 --- a/src/dyn_subgrid/dynFileMod.F90 +++ /dev/null @@ -1,91 +0,0 @@ -module dynFileMod - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains a derived type that is essentially a file_desc_t, but also adds a - ! time_info_type object. This is used for tracking time information for a single - ! dynamic landuse file. - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use dynTimeInfoMod , only : time_info_type, year_position_type - use ncdio_pio , only : file_desc_t, ncd_pio_openfile, ncd_inqdid, ncd_inqdlen, ncd_io - use abortutils , only : endrun - implicit none - private - ! - ! !PUBLIC TYPES: - public :: dyn_file_type - - type, extends(file_desc_t) :: dyn_file_type - type(time_info_type) :: time_info ! time information for this file - end type dyn_file_type - - interface dyn_file_type - module procedure constructor ! initialize a new dyn_file_type object - end interface dyn_file_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - !----------------------------------------------------------------------- - type(dyn_file_type) function constructor(filename, year_position) - ! - ! !DESCRIPTION: - ! Initialize a dyn_file_type object - ! - ! Opens the file associated with filename for reading, reads the 'YEAR' variable from - ! this file (assumed to have dimension 'time'), and initializes a dyn_time_info object - ! based on this YEAR variable and the current model year. - ! - ! year_position is a flag saying how to obtain the model year relative to the current - ! timestep; it must be one of the parameters defined in dynTimeInfoMod (e.g., - ! YEAR_POSITION_START_OF_TIMESTEP or YEAR_POSITION_END_OF_TIMESTEP) - ! - ! !USES: - use fileutils , only : getfil - ! - ! !ARGUMENTS: - character(len=*) , intent(in) :: filename - type(year_position_type) , intent(in) :: year_position - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - integer :: ier ! error code - integer :: ntimes ! number of time samples - integer :: varid ! netcdf variable ID - integer, allocatable :: years(:) ! years in the file - - character(len=*), parameter :: subname = 'dyn_file_type constructor' - !----------------------------------------------------------------------- - - ! Obtain file - - call getfil(filename, locfn, 0) - call ncd_pio_openfile(constructor, locfn, 0) - - ! Obtain years - - call ncd_inqdid(constructor, 'time', varid) - call ncd_inqdlen(constructor, varid, ntimes) - allocate(years(ntimes), stat=ier) - if (ier /= 0) then - call endrun(msg=' allocation error for years'//errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=constructor, varname='YEAR', flag='read', data=years) - - ! Initialize object containing time information for the file - - constructor%time_info = time_info_type(years, year_position) - - deallocate(years) - - end function constructor - -end module dynFileMod diff --git a/src/dyn_subgrid/dynInitColumnsMod.F90 b/src/dyn_subgrid/dynInitColumnsMod.F90 deleted file mode 100644 index a7713f0c80..0000000000 --- a/src/dyn_subgrid/dynInitColumnsMod.F90 +++ /dev/null @@ -1,263 +0,0 @@ -module dynInitColumnsMod - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Handle initialization of columns that just switched from inactive to active - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : namec - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use SoilHydrologyType , only : soilhydrology_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use dynColumnTemplateMod , only : template_col_from_landunit, TEMPLATE_NONE_FOUND - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - ! The following is the public interface to the routines in this module: - public :: initialize_new_columns ! Do initialization for all columns that are newly-active in this time step - - ! The following are public only for unit testing purposes, and should not be called - ! directly by application code: - public :: initial_template_col_crop ! Find column to use as a template for a crop column that has newly become active - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: initial_template_col_dispatcher ! Find column to use as a template; dispatcher to the appropriate routine based on landunit type - private :: initial_template_col_soil ! Find column to use as a template for a vegetated column that has newly become active - private :: copy_state ! Copy a subset of state variables from template column to newly-active column - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !--------------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine initialize_new_columns(bounds, cactive_prior, & - temperature_inst, waterstate_inst, soilhydrology_inst) - ! - ! !DESCRIPTION: - ! Do initialization for all columns that are newly-active in this time step - ! - ! !USES: - use GetGlobalValuesMod , only : GetGlobalWrite - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - logical , intent(in) :: cactive_prior( bounds%begc: ) ! column-level active flags from prior time step - type(temperature_type) , intent(inout) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - ! - ! !LOCAL VARIABLES: - integer :: c ! column index - integer :: c_template ! index of template column - - character(len=*), parameter :: subname = 'initialize_new_columns' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(cactive_prior) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do c = bounds%begc, bounds%endc - ! If this column is newly-active, then we need to initialize it using the routines in this module - if (col%active(c) .and. .not. cactive_prior(c)) then - c_template = initial_template_col_dispatcher(bounds, c, cactive_prior(bounds%begc:bounds%endc)) - if (c_template /= TEMPLATE_NONE_FOUND) then - call copy_state(c, c_template, & - temperature_inst, waterstate_inst, soilhydrology_inst) - else - write(iulog,*) subname// ' WARNING: No template column found to initialize newly-active column' - write(iulog,*) '-- keeping the state that was already in memory, possibly from arbitrary initialization' - call GetGlobalWrite(decomp_index=c, clmlevel=namec) - end if - end if - end do - - end subroutine initialize_new_columns - - - !----------------------------------------------------------------------- - function initial_template_col_dispatcher(bounds, c_new, cactive_prior) result(c_template) - ! - ! !DESCRIPTION: - ! Find column to use as a template for the given column that has newly become active; - ! this is a dispatcher that calls the appropriate routine based on the landunit type of c_new. - ! - ! Returns TEMPLATE_NONE_FOUND if there is no column to use for initialization - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop, istice_mec, istdlak, istwet, isturb_MIN, isturb_MAX - ! - ! !ARGUMENTS: - integer :: c_template ! function result - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: c_new ! column index that needs initialization - logical , intent(in) :: cactive_prior( bounds%begc: ) ! column-level active flags from prior time step - ! - ! !LOCAL VARIABLES: - integer :: l ! landunit index - integer :: ltype ! landunit type - - character(len=*), parameter :: subname = 'initial_template_col_dispatcher' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(cactive_prior) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - l = col%landunit(c_new) - ltype = lun%itype(l) - select case(ltype) - case(istsoil) - c_template = initial_template_col_soil(c_new) - case(istcrop) - c_template = initial_template_col_crop(bounds, c_new, cactive_prior(bounds%begc:bounds%endc)) - case(istice_mec) - write(iulog,*) subname// ' ERROR: Ability to initialize a newly-active glacier mec column not yet implemented' - write(iulog,*) 'Expectation is that glacier mec columns should be active from the start of the run wherever they can grow' - call endrun(decomp_index=c_new, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - case(istdlak) - write(iulog,*) subname// ' ERROR: Ability to initialize a newly-active lake column not yet implemented' - call endrun(decomp_index=c_new, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - case(istwet) - write(iulog,*) subname// ' ERROR: Ability to initialize a newly-active wetland column not yet implemented' - call endrun(decomp_index=c_new, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - case(isturb_MIN:isturb_MAX) - write(iulog,*) subname// ' ERROR: Ability to initialize a newly-active urban column not yet implemented' - call endrun(decomp_index=c_new, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - case default - write(iulog,*) subname// ' ERROR: Unknown landunit type: ', ltype - call endrun(decomp_index=c_new, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end select - - end function initial_template_col_dispatcher - - - !----------------------------------------------------------------------- - function initial_template_col_soil(c_new) result(c_template) - ! - ! !DESCRIPTION: - ! Find column to use as a template for a vegetated column that has newly become active. - ! - ! For now, we assume that the only vegetated columns that can newly become active are - ! ones with 0 weight on the grid cell (i.e., virtual columns). For these, we simply - ! keep the state at the current value (likely arbitrary initial conditions), and so - ! return TEMPLATE_NONE_FOUND from this function. Within this function, we check this assumption. - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: c_template ! function result - integer , intent(in) :: c_new ! column index that needs initialization - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'initial_template_col_soil' - !----------------------------------------------------------------------- - - if (col%wtgcell(c_new) > 0._r8) then - write(iulog,*) subname// ' ERROR: Expectation is that the only vegetated columns that& - & can newly become active are ones with 0 weight on the grid cell' - call endrun(decomp_index=c_new, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - - c_template = TEMPLATE_NONE_FOUND - - end function initial_template_col_soil - - !----------------------------------------------------------------------- - function initial_template_col_crop(bounds, c_new, cactive_prior) result(c_template) - ! - ! !DESCRIPTION: - ! Find column to use as a template for a crop column that has newly become active - ! - ! Returns TEMPLATE_NONE_FOUND if there is no column to use for initialization - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop - ! - ! !ARGUMENTS: - integer :: c_template ! function result - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: c_new ! column index that needs initialization - logical , intent(in) :: cactive_prior( bounds%begc: ) ! column-level active flags from prior time step - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'initial_template_col_crop' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(cactive_prior) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - ! First try to find an active column on the vegetated landunit; if there is none, then - ! find the first active column on the crop landunit; if there is none, then - ! template_col will be TEMPLATE_NONE_FOUND - c_template = template_col_from_landunit(bounds, c_new, istsoil, cactive_prior(bounds%begc:bounds%endc)) - if (c_template == TEMPLATE_NONE_FOUND) then - c_template = template_col_from_landunit(bounds, c_new, istcrop, cactive_prior(bounds%begc:bounds%endc)) - end if - - end function initial_template_col_crop - - - !----------------------------------------------------------------------- - subroutine copy_state(c_new, c_template, & - temperature_inst, waterstate_inst, soilhydrology_inst) - ! - ! !DESCRIPTION: - ! Copy a subset of state variables from a template column (c_template) to a newly- - ! active column (c_new) - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: c_new ! index of newly-active column - integer, intent(in) :: c_template ! index of column to use as a template - type(temperature_type) , intent(inout) :: temperature_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(soilhydrology_type), intent(inout) :: soilhydrology_inst - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'copy_state' - !----------------------------------------------------------------------- - - ! For now, just copy a few key variables - ! TODO(wjs, 2016-08-31) Figure out what else should be copied here - - ! We only copy the below-ground portion of these multi-level variables, not the - ! above-ground (snow) portion. This is because it is challenging to initialize the - ! snow pack in a consistent state, requiring copying many more state variables - and - ! if you initialize it in a partly-inconsistent state, you get balance errors. So, for - ! now at least, we (Dave Lawrence, Keith Oleson, Bill Sacks) have decided that it's - ! safest to just let the snow pack in the new column start at cold start conditions. - - temperature_inst%t_soisno_col(c_new,1:) = temperature_inst%t_soisno_col(c_template,1:) - - ! TODO(wjs, 2016-08-31) If we had more general uses of this initial template col - ! infrastructure (copying state between very different landunits), then we might need - ! to handle bedrock layers - e.g., zeroing out any water that would be added to a - ! bedrock layer(?). But for now we just use this initial template col infrastructure - ! for nat veg -> crop, for which the bedrock will be the same, so we're not dealing - ! with that complexity for now. - waterstate_inst%h2osoi_liq_col(c_new,1:) = waterstate_inst%h2osoi_liq_col(c_template,1:) - waterstate_inst%h2osoi_ice_col(c_new,1:) = waterstate_inst%h2osoi_ice_col(c_template,1:) - waterstate_inst%h2osoi_vol_col(c_new,1:) = waterstate_inst%h2osoi_vol_col(c_template,1:) - - soilhydrology_inst%wa_col(c_new) = soilhydrology_inst%wa_col(c_template) - - end subroutine copy_state - - - -end module dynInitColumnsMod diff --git a/src/dyn_subgrid/dynLandunitAreaMod.F90 b/src/dyn_subgrid/dynLandunitAreaMod.F90 deleted file mode 100644 index 1d13efa8f0..0000000000 --- a/src/dyn_subgrid/dynLandunitAreaMod.F90 +++ /dev/null @@ -1,166 +0,0 @@ -module dynLandunitAreaMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Handle dynamic landunit weights - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use clm_varcon , only : ispval, namel - use landunit_varcon, only : isturb_hd, isturb_md, isturb_tbd - use landunit_varcon, only : istsoil, istcrop, istdlak, istwet, max_lunit - use decompMod , only : bounds_type - use abortutils , only : endrun - use GridcellType , only : grc - use LandunitType , only : lun - ! - implicit none - private - ! - public :: update_landunit_weights ! update landunit weights for all grid cells - - ! The following is only public for the sake of unit testing; it should not be called - ! directly by CLM code outside this module - public :: update_landunit_weights_one_gcell - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - - !----------------------------------------------------------------------- - subroutine update_landunit_weights(bounds) - ! - ! !DESCRIPTION: - ! Update landunit weights for all grid cells. - ! - ! Assumes lun%wtgcell has been updated for all landunits whose areas are specified by - ! the dynamic subgrid code. Update lun%wtgcell for all other landunits (including - ! possibly changing some values of lun%wtgcell for landunits whose areas are - ! specified, e.g., if there are conflicts between glacier area and crop area). - ! - ! !USES: - use subgridWeightsMod, only : get_landunit_weight, set_landunit_weight - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - integer :: ltype ! landunit type - real(r8) :: landunit_weights(max_lunit) ! weight of each landunit on a single grid cell - - character(len=*), parameter :: subname = 'update_landunit_weights' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - ! Determine current landunit weights. Landunits that don't exist on this grid cell - ! get a weight of 0 - do ltype = 1, max_lunit - landunit_weights(ltype) = get_landunit_weight(g, ltype) - end do - - ! Adjust weights so they sum to 100% - call update_landunit_weights_one_gcell(landunit_weights) - - ! Put the new landunit weights back into lun%wtgcell - do ltype = 1, max_lunit - call set_landunit_weight(g, ltype, landunit_weights(ltype)) - end do - - end do - - end subroutine update_landunit_weights - - - !----------------------------------------------------------------------- - subroutine update_landunit_weights_one_gcell(landunit_weights) - ! - ! !DESCRIPTION: - ! Update landunit weights for a single grid cell. - ! - ! This should be called with a vector of landunit weights for this grid cell, which is - ! updated in-place. Element #1 in this vector is the weight of landunit #1 (e.g., - ! istsoil, assuming istsoil==1), element #2 is the weight of landunit #2 (e.g., - ! istcrop, assuming istcrop==2), etc. Landunits that do not exist in this grid cell - ! should be given a weight of 0 in the vector. - ! - ! After the execution of this routine, sum(landunit_weights) will be 1 within a small - ! roundoff-level tolerance. This is achieved by growing or shrinking landunits as - ! needed. - ! - ! !ARGUMENTS: - real(r8), intent(inout) :: landunit_weights(:) ! weight of each landunit; this is updated in-place - ! - ! !LOCAL VARIABLES: - real(r8) :: landunit_sum ! sum of all landunit weights on this grid cell - real(r8) :: excess ! excess landunit weight that needs to be removed - integer :: decrease_index ! the current index into decrease_order - integer :: cur_landunit ! the current element of decrease_order that we're dealing with - - ! This parameter specifies the order in which landunit areas are decreased when the - ! specified areas add to greater than 100%. Landunits not listed here can never be - ! decreased unless the forcings say they should be decreased. In particular, note - ! that istice_mec doesn't appear here, so that the istice_mec area always will match - ! the areas specified by GLC. In general, the code will NOT be robust if more than - ! one landunit is excluded from this list. Meaning: since istice_mec is excluded from - ! this list, all other landunits should appear in this list! - integer, parameter :: decrease_order(7) = & - (/istsoil, istcrop, isturb_md, isturb_hd, isturb_tbd, istwet, istdlak/) - - real(r8), parameter :: tol = 1.e-14 ! tolerance for making sure sum of landunit weights equals 1 - - character(len=*), parameter :: subname = 'update_landunit_weights_one_gcell' - !----------------------------------------------------------------------- - - SHR_ASSERT((size(landunit_weights) == max_lunit), errMsg(sourcefile, __LINE__)) - - landunit_sum = sum(landunit_weights) - - ! If landunits sum to ~ 100% already, we're done - if (abs(landunit_sum - 1._r8) <= tol) then - ! Do nothing - - ! If landunits sum to < 100%, increase natural vegetation so sum is 100% - else if (landunit_sum < 1._r8) then - landunit_weights(istsoil) = landunit_weights(istsoil) + (1._r8 - landunit_sum) - - ! If landunits sum to > 100%, decrease areas in priority order - else - decrease_index = 1 - excess = landunit_sum - 1._r8 - do while ((excess > tol) .and. decrease_index <= size(decrease_order)) - ! Decrease weight of the next landunit, but not below 0 - cur_landunit = decrease_order(decrease_index) - landunit_weights(cur_landunit) = landunit_weights(cur_landunit) - excess - if (landunit_weights(cur_landunit) < 0._r8) then - landunit_weights(cur_landunit) = 0._r8 - end if - - ! Update variables for next loop iteration - landunit_sum = sum(landunit_weights) - excess = landunit_sum - 1._r8 - decrease_index = decrease_index + 1 - end do - end if - - ! Confirm that landunit sum is now equal to 100%, within tolerance - landunit_sum = sum(landunit_weights) - if (abs(landunit_sum - 1._r8) > tol) then - write(iulog,*) subname//' ERROR: After all landunit adjustments, landunit weights still do not equal 100%' - write(iulog,*) 'landunit_sum = ', landunit_sum - write(iulog,*) 'landunit_weights = ', landunit_weights - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine update_landunit_weights_one_gcell - -end module dynLandunitAreaMod diff --git a/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 b/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 deleted file mode 100644 index a02eb15981..0000000000 --- a/src/dyn_subgrid/dynPatchStateUpdaterMod.F90 +++ /dev/null @@ -1,455 +0,0 @@ -module dynPatchStateUpdaterMod - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Class for adjusting patch-level (aboveground) state variables due to transient patch - ! areas. - ! - ! In each time step, the object should be set up with: - ! - ! - call patch_state_updater%set_old_weights (before dyn subgrid weight updates) - ! - ! - call patch_state_updater%set_new_weights (after dyn subgrid weight updates) - ! - ! Then it can be used to update each state variable with a call to: - ! - ! - call patch_state_updater%update_patch_state - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC - use PatchType , only : patch - use ColumnType , only : col - use clm_varpar , only : mxpft - use abortutils , only : endrun - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: patch_state_updater_type - - type patch_state_updater_type - private - real(r8), allocatable :: pwtgcell_old(:) ! old patch weights on the gridcell - real(r8), allocatable :: pwtgcell_new(:) ! new patch weights on the gridcell - - real(r8), allocatable :: cwtgcell_old(:) ! old column weights on the gridcell - - ! (pwtgcell_new - pwtgcell_old) from last call to set_new_weights - real(r8), allocatable :: dwt(:) - - ! (pwtgcell_old / pwtgcell_new) from last call to set_new_weights; only valid for - ! growing patches - real(r8), allocatable :: growing_old_fraction(:) - - ! (dwt / pwtgcell_new) from last call to set_new_weights; only valid for growing - ! patches - real(r8), allocatable :: growing_new_fraction(:) - - contains - ! Public routines - procedure, public :: set_old_weights ! set weights before dyn subgrid updates - procedure, public :: set_new_weights ! set weights after dyn subgrid updates - - ! Update a patch-level state variable and compute associated fluxes based on changing - ! patch areas - procedure, public :: update_patch_state - - ! Update a patch-level state variable and compute associated fluxes based on - ! changing patch areas, with flux out partitioned into two fluxes. Partitioning is - ! based on pft type. - procedure, public :: update_patch_state_partition_flux_by_type - - ! returns a patch-level logical array that is true wherever the patch weight was zero - ! prior to weight updates - procedure, public :: old_weight_was_zero - - ! returns a patch-level logical array that is true wherever the patch grew in this - ! time step - procedure, public :: patch_grew - - ! returns a patch-level logical array that is true wherever a patch newly has - ! non-zero weight in this time step - procedure, public :: patch_initiating - - end type patch_state_updater_type - - interface patch_state_updater_type - module procedure constructor - end interface patch_state_updater_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor(bounds) result(this) - ! - ! !DESCRIPTION: - ! Initialize a patch_state_updater_type object - ! - ! !USES: - ! - ! !ARGUMENTS: - type(patch_state_updater_type) :: this ! function result - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, errMsg(sourcefile, __LINE__)) - - begp = bounds%begp - endp = bounds%endp - begc = bounds%begc - endc = bounds%endc - - allocate(this%pwtgcell_old(begp:endp)) - this%pwtgcell_old(:) = nan - allocate(this%pwtgcell_new(begp:endp)) - this%pwtgcell_new(:) = nan - allocate(this%cwtgcell_old(begc:endc)) - this%cwtgcell_old(:) = nan - allocate(this%dwt(begp:endp)) - this%dwt(:) = nan - allocate(this%growing_old_fraction(begp:endp)) - this%growing_old_fraction(:) = nan - allocate(this%growing_new_fraction(begp:endp)) - this%growing_new_fraction(:) = nan - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine set_old_weights(this, bounds) - ! - ! !DESCRIPTION: - ! Set subgrid weights before dyn subgrid updates - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p - integer :: c - - character(len=*), parameter :: subname = 'set_old_weights' - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - c = patch%column(p) - this%pwtgcell_old(p) = patch%wtgcell(p) - this%cwtgcell_old(c) = col%wtgcell(c) - end do - - end subroutine set_old_weights - - !----------------------------------------------------------------------- - subroutine set_new_weights(this, bounds) - ! - ! !DESCRIPTION: - ! Set subgrid weights after dyn subgrid updates - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p - - character(len=*), parameter :: subname = 'set_new_weights' - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - this%pwtgcell_new(p) = patch%wtgcell(p) - this%dwt(p) = this%pwtgcell_new(p) - this%pwtgcell_old(p) - if (this%dwt(p) > 0._r8) then - this%growing_old_fraction(p) = this%pwtgcell_old(p) / this%pwtgcell_new(p) - this%growing_new_fraction(p) = this%dwt(p) / this%pwtgcell_new(p) - else - ! These values are unused in this case, but set them to something reasonable for - ! safety. (We could set them to NaN, but that requires a more expensive - ! subroutine call, using the shr_infnan_mod infrastructure.) - this%growing_old_fraction(p) = 1._r8 - this%growing_new_fraction(p) = 0._r8 - end if - end do - - end subroutine set_new_weights - - !----------------------------------------------------------------------- - subroutine update_patch_state(this, bounds, & - num_filterp_with_inactive, filterp_with_inactive, & - var, flux_out_col_area, flux_out_grc_area, & - seed, seed_addition) - ! - ! !DESCRIPTION: - ! Update a patch-level state variable and compute associated fluxes based on changing - ! patch areas - ! - ! For growing patches, this subroutine adjusts var. For shrinking patches, this - ! subroutine accumulates flux in flux_out_col_area. - ! - ! Changes are only made within the given filter. Note that this filter should include - ! inactive as well as active patches, so that it includes patches that just became - ! inactive. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_filterp_with_inactive ! number of points in filterp_with_inactive - integer, intent(in) :: filterp_with_inactive(:) ! patch filter that includes inactive points - real(r8), intent(inout) :: var( bounds%begp: ) ! patch-level state variable - - ! Accumulated flux from shrinking areas, expressed as mass per unit area COLUMN, using - ! the OLD column weight. (The use of the old column weight is appropriate if the - ! fluxes from shrinking patches are applied to column-level state variables BEFORE - ! doing column-level state adjustments via the column_state_updater). For shrinking - ! areas, this is given as a NEGATIVE quantity. Often you will provide one of - ! flux_out_col_area or flux_out_grc_area, but it is okay to provide both, or to - ! provide neither if you don't need to track the flux out from this state variable. - real(r8), intent(inout), optional :: flux_out_col_area( bounds%begp: ) - - ! Accumulated flux from shrinking areas, expressed as mass per unit area GRIDCELL. For - ! shrinking areas, this is given as a NEGATIVE quantity. Often you will provide one of - ! flux_out_col_area or flux_out_grc_area, but it is okay to provide both, or to - ! provide neither if you don't need to track the flux out from this state variable. - real(r8), intent(inout), optional :: flux_out_grc_area( bounds%begp: ) - - ! If provided, this gives some 'seed' amount added to the state in the area into - ! which each growing patch grows. The value is ignored for patches that are either - ! constant or shrinking in area. - real(r8), intent(in), optional :: seed( bounds%begp: ) - - ! If provided, this accumulates the amount of seed added to each patch. This gives - ! seed(p) * dwt(p). This can only be provided if seed is provided. Even though this is - ! a patch-level array, it is expressed as mass per unit area GRIDCELL. - real(r8), intent(inout), optional :: seed_addition( bounds%begp: ) - ! - ! - ! !LOCAL VARIABLES: - integer :: fp, p, c - - character(len=*), parameter :: subname = 'update_patch_state' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(var) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - if (present(flux_out_col_area)) then - SHR_ASSERT_ALL((ubound(flux_out_col_area) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - - if (present(flux_out_grc_area)) then - SHR_ASSERT_ALL((ubound(flux_out_grc_area) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - - if (present(seed)) then - SHR_ASSERT_ALL((ubound(seed) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - - if (present(seed_addition)) then - if (.not. present(seed)) then - call endrun(subname//' ERROR: seed_addition can only be provided if seed is provided') - end if - SHR_ASSERT_ALL((ubound(seed_addition) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - end if - - do fp = 1, num_filterp_with_inactive - p = filterp_with_inactive(fp) - c = patch%column(p) - - if (this%dwt(p) > 0._r8) then - var(p) = var(p) * this%growing_old_fraction(p) - if (present(seed)) then - var(p) = var(p) + seed(p) * this%growing_new_fraction(p) - if (present(seed_addition)) then - seed_addition(p) = seed_addition(p) + seed(p) * this%dwt(p) - end if - end if - - else if (this%dwt(p) < 0._r8) then - if (present(flux_out_grc_area)) then - flux_out_grc_area(p) = flux_out_grc_area(p) + var(p) * this%dwt(p) - end if - if (present(flux_out_col_area)) then - ! No need to check for divide by 0 here: If dwt < 0 then we must have had - ! cwtgcell_old > 0. - flux_out_col_area(p) = flux_out_col_area(p) + & - var(p) * (this%dwt(p) / this%cwtgcell_old(c)) - end if - end if - end do - - end subroutine update_patch_state - - !----------------------------------------------------------------------- - subroutine update_patch_state_partition_flux_by_type(this, bounds, & - num_filterp_with_inactive, filterp_with_inactive, & - flux1_fraction_by_pft_type, & - var, flux1_out, flux2_out, & - seed, seed_addition) - ! - ! !DESCRIPTION: - ! Update a patch-level state variable and compute associated fluxes based on - ! changing patch areas, with flux out partitioned into two fluxes. Partitioning is - ! based on pft type. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_filterp_with_inactive ! number of points in filterp_with_inactive - integer, intent(in) :: filterp_with_inactive(:) ! patch filter that includes inactive points - real(r8), intent(in) :: flux1_fraction_by_pft_type( 0: ) ! fraction of flux that goes into flux1_out, indexed by pft type - real(r8), intent(inout) :: var( bounds%begp: ) ! patch-level state variable - - ! Accumulated fluxes from shrinking areas. For shrinking areas, these are given as - ! NEGATIVE quantities. Even though these are patch-level arrays, they are expressed - ! as mass per unit area GRIDCELL (so these are equivalent to the flux_out_grc_area - ! argument in the main update_patch_state routine). - real(r8), intent(inout) :: flux1_out( bounds%begp: ) - real(r8), intent(inout) :: flux2_out( bounds%begp: ) - - ! If provided, this gives some 'seed' amount added to the state in the area into - ! which each growing patch grows. The value is ignored for patches that are either - ! constant or shrinking in area. - real(r8), intent(in), optional :: seed( bounds%begp: ) - - ! If provided, this accumulates the amount of seed added to each patch. This gives - ! seed(p) * dwt(p). This can only be provided if seed is provided. Even though this is - ! a patch-level array, it is expressed as mass per unit area GRIDCELL. - real(r8), intent(inout), optional :: seed_addition( bounds%begp: ) - ! - ! !LOCAL VARIABLES: - integer :: fp, p - real(r8) :: total_flux_out(bounds%begp:bounds%endp) - real(r8) :: my_flux1_fraction - - character(len=*), parameter :: subname = 'update_patch_state_partition_flux_by_type' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(flux1_fraction_by_pft_type) == (/mxpft/)), errMsg(sourcefile, __LINE__)) - - total_flux_out(bounds%begp:bounds%endp) = 0._r8 - call this%update_patch_state(bounds, & - num_filterp_with_inactive, filterp_with_inactive, & - var, flux_out_grc_area = total_flux_out, & - seed = seed, seed_addition = seed_addition) - - do fp = 1, num_filterp_with_inactive - p = filterp_with_inactive(fp) - my_flux1_fraction = flux1_fraction_by_pft_type(patch%itype(p)) - flux1_out(p) = flux1_out(p) + total_flux_out(p) * my_flux1_fraction - flux2_out(p) = flux2_out(p) + total_flux_out(p) * (1._r8 - my_flux1_fraction) - end do - - end subroutine update_patch_state_partition_flux_by_type - - - !----------------------------------------------------------------------- - function old_weight_was_zero(this, bounds) - ! - ! !DESCRIPTION: - ! Returns a patch-level logical array that is true wherever the patch weight was zero - ! prior to weight updates - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - logical :: old_weight_was_zero(bounds%begp:bounds%endp) ! function result - ! - ! !LOCAL VARIABLES: - integer :: p - - character(len=*), parameter :: subname = 'old_weight_was_zero' - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - old_weight_was_zero(p) = (this%pwtgcell_old(p) == 0._r8) - end do - - end function old_weight_was_zero - - !----------------------------------------------------------------------- - function patch_grew(this, bounds) - ! - ! !DESCRIPTION: - ! Returns a patch-level logical array that is true wherever the patch grew in this - ! time step - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - logical :: patch_grew(bounds%begp:bounds%endp) ! function result - ! - ! !LOCAL VARIABLES: - integer :: p - - character(len=*), parameter :: subname = 'patch_grew' - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - patch_grew(p) = (this%dwt(p) > 0._r8) - end do - - end function patch_grew - - !----------------------------------------------------------------------- - function patch_initiating(this, bounds) - ! - ! !DESCRIPTION: - ! Returns a patch-level logical array wherever the patch is initiating - i.e., growing - ! from zero area to non-zero area - in this time step - ! - ! !USES: - ! - ! !ARGUMENTS: - class(patch_state_updater_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - logical :: patch_initiating(bounds%begp:bounds%endp) ! function result - ! - ! !LOCAL VARIABLES: - integer :: p - - character(len=*), parameter :: subname = 'patch_initiating' - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - patch_initiating(p) = ( & - this%pwtgcell_old(p) == 0._r8 .and. & - this%pwtgcell_new(p) > 0._r8) - end do - - end function patch_initiating - - -end module dynPatchStateUpdaterMod diff --git a/src/dyn_subgrid/dynPriorWeightsMod.F90 b/src/dyn_subgrid/dynPriorWeightsMod.F90 deleted file mode 100644 index 577676f217..0000000000 --- a/src/dyn_subgrid/dynPriorWeightsMod.F90 +++ /dev/null @@ -1,95 +0,0 @@ -module dynPriorWeightsMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a derived type and associated methods for working with prior subgrid weights - ! (i.e., before the weight updates of this time step) - ! - ! TODO(wjs, 2015-07-04) See if I can combine some functionality here with - ! dynColumnStateUpdaterMod, and/or change some of this to be more similar to the - ! implementation of dynColumnStateUpdaterMod (i.e., an active class rather than a - ! passive data-holder). - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC - use ColumnType , only : col - use PatchType , only : patch - ! - implicit none - private - ! - ! !PUBLIC TYPES: - public :: prior_weights_type - - type prior_weights_type - ! Components are public for ease-of-use and efficiency. However, these components - ! should be treated as read-only! - real(r8), allocatable, public :: pwtgcell(:) ! prior pft weight on the gridcell - logical , allocatable, public :: cactive(:) ! prior col%active flags - contains - procedure :: set_prior_weights ! set prior weights to current weights - end type prior_weights_type - - interface prior_weights_type - module procedure constructor ! initialize a prior_weights_type object - end interface prior_weights_type - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - ! ---------------------------------------------------------------------- - type(prior_weights_type) function constructor(bounds) - ! - ! !DESCRIPTION: - ! Initialize a prior_weights_type object - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! processor bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'prior_weights_type constructor' - ! ---------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - allocate(constructor%pwtgcell(bounds%begp:bounds%endp)) - allocate(constructor%cactive(bounds%begc:bounds%endc)) - end function constructor - - - ! ====================================================================== - ! Public methods - ! ====================================================================== - - ! ---------------------------------------------------------------------- - subroutine set_prior_weights(this, bounds) - ! - ! !DESCRIPTION: - ! Set prior weights to current weights - ! - ! !ARGUMENTS: - class(prior_weights_type) , intent(inout) :: this ! this object - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p, c ! patch & col indices - ! ---------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - this%pwtgcell(p) = patch%wtgcell(p) - end do - - do c = bounds%begc, bounds%endc - this%cactive(c) = col%active(c) - end do - end subroutine set_prior_weights - -end module dynPriorWeightsMod diff --git a/src/dyn_subgrid/dynSubgridControlMod.F90 b/src/dyn_subgrid/dynSubgridControlMod.F90 deleted file mode 100644 index 58e3a40359..0000000000 --- a/src/dyn_subgrid/dynSubgridControlMod.F90 +++ /dev/null @@ -1,348 +0,0 @@ -module dynSubgridControlMod - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! Defines a class for storing and querying control flags related to dynamic subgrid - ! operation. - ! - ! Note that this is implemented (essentially) as a singleton, so the only instance of - ! this class is stored in this module. This is done for convenience, to avoid having to - ! pass around the single instance just to query these control flags. - ! - ! !USES: -#include "shr_assert.h" - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : fname_len - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: dynSubgridControl_init - public :: get_flanduse_timeseries ! return the value of the flanduse_timeseries file name - public :: get_do_transient_pfts ! return the value of the do_transient_pfts control flag - public :: get_do_transient_crops ! return the value of the do_transient_crops control flag - public :: run_has_transient_landcover ! returns true if any aspects of prescribed transient landcover are enabled - public :: get_do_harvest ! return the value of the do_harvest control flag - public :: get_for_testing_allow_non_annual_changes ! return true if user has requested to allow area changes at times other than the year boundary, for testing purposes - public :: get_for_testing_zero_dynbal_fluxes ! return true if user has requested to set the dynbal water and energy fluxes to zero, for testing purposes - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: read_namelist ! read namelist variables - private :: check_namelist_consistency ! check consistency of namelist settings - ! - ! !PRIVATE TYPES: - type dyn_subgrid_control_type - private - character(len=fname_len) :: flanduse_timeseries = ' ' ! transient landuse dataset - logical :: do_transient_pfts = .false. ! whether to apply transient natural PFTs from dataset - logical :: do_transient_crops = .false. ! whether to apply transient crops from dataset - logical :: do_harvest = .false. ! whether to apply harvest from dataset - - ! The following is only meant for testing: Whether area changes are allowed at times - ! other than the year boundary. This should only arise in some test configurations - ! where we artificially create changes more frequently so that we can run short - ! tests. This flag is only used for error-checking, not controlling any model - ! behavior. - logical :: for_testing_allow_non_annual_changes = .false. - - ! The following is only meant for testing: If .true., set the dynbal water and - ! energy fluxes to zero. This is needed in some tests where we have daily rather - ! than annual glacier dynamics: if we allow the true dynbal adjustment fluxes in - ! those tests, we end up with sensible heat fluxes of thousands of W m-2 or more, - ! which causes CAM to blow up. However, note that setting it to true will break - ! water and energy conservation! - logical :: for_testing_zero_dynbal_fluxes = .false. - - logical :: initialized = .false. ! whether this object has been initialized - end type dyn_subgrid_control_type - - type(dyn_subgrid_control_type) :: dyn_subgrid_control_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine dynSubgridControl_init( NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize the dyn_subgrid_control settings. - ! - ! !USES: - use spmdMod , only : masterproc - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'dynSubgridControl_init' - !----------------------------------------------------------------------- - - call read_namelist( NLFilename ) - if (masterproc) then - call check_namelist_consistency - end if - - dyn_subgrid_control_inst%initialized = .true. - - end subroutine dynSubgridControl_init - - !----------------------------------------------------------------------- - subroutine read_namelist( NLFilename ) - ! - ! !DESCRIPTION: - ! Read dyn_subgrid_control namelist variables - ! - ! !USES: - use fileutils , only : getavu, relavu - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - ! temporary variables corresponding to the components of dyn_subgrid_control_type: - character(len=fname_len) :: flanduse_timeseries - logical :: do_transient_pfts - logical :: do_transient_crops - logical :: do_harvest - logical :: for_testing_allow_non_annual_changes - logical :: for_testing_zero_dynbal_fluxes - ! other local variables: - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - - character(len=*), parameter :: subname = 'read_namelist' - !----------------------------------------------------------------------- - - namelist /dynamic_subgrid/ & - flanduse_timeseries, & - do_transient_pfts, & - do_transient_crops, & - do_harvest, & - for_testing_allow_non_annual_changes, & - for_testing_zero_dynbal_fluxes - - ! Initialize options to default values, in case they are not specified in the namelist - flanduse_timeseries = ' ' - do_transient_pfts = .false. - do_transient_crops = .false. - do_harvest = .false. - for_testing_allow_non_annual_changes = .false. - for_testing_zero_dynbal_fluxes = .false. - - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'dynamic_subgrid', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=dynamic_subgrid, iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading dynamic_subgrid namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding dynamic_subgrid namelist'//errMsg(sourcefile, __LINE__)) - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast (flanduse_timeseries, mpicom) - call shr_mpi_bcast (do_transient_pfts, mpicom) - call shr_mpi_bcast (do_transient_crops, mpicom) - call shr_mpi_bcast (do_harvest, mpicom) - call shr_mpi_bcast (for_testing_allow_non_annual_changes, mpicom) - call shr_mpi_bcast (for_testing_zero_dynbal_fluxes, mpicom) - - dyn_subgrid_control_inst = dyn_subgrid_control_type( & - flanduse_timeseries = flanduse_timeseries, & - do_transient_pfts = do_transient_pfts, & - do_transient_crops = do_transient_crops, & - do_harvest = do_harvest, & - for_testing_allow_non_annual_changes = for_testing_allow_non_annual_changes, & - for_testing_zero_dynbal_fluxes = for_testing_zero_dynbal_fluxes) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'dynamic_subgrid settings:' - write(iulog,nml=dynamic_subgrid) - write(iulog,*) ' ' - end if - - end subroutine read_namelist - - !----------------------------------------------------------------------- - subroutine check_namelist_consistency - ! - ! !DESCRIPTION: - ! Check consistency of namelist settingsn - ! - ! !USES: - use clm_varctl , only : iulog, use_cndv, use_fates, use_cn, use_crop - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'check_namelist_consistency' - !----------------------------------------------------------------------- - - if (dyn_subgrid_control_inst%flanduse_timeseries == ' ') then - if (dyn_subgrid_control_inst%do_transient_pfts) then - write(iulog,*) 'ERROR: do_transient_pfts can only be true if you are running with' - write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (dyn_subgrid_control_inst%do_transient_crops) then - write(iulog,*) 'ERROR: do_transient_crops can only be true if you are running with' - write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (dyn_subgrid_control_inst%do_harvest) then - write(iulog,*) 'ERROR: do_harvest can only be true if you are running with' - write(iulog,*) 'a flanduse_timeseries file (currently flanduse_timeseries is blank)' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - if (dyn_subgrid_control_inst%do_transient_pfts) then - if (use_cndv) then - write(iulog,*) 'ERROR: do_transient_pfts is incompatible with use_cndv' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (use_fates) then - write(iulog,*) 'ERROR: do_transient_pfts is incompatible with use_fates' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - if (dyn_subgrid_control_inst%do_transient_crops) then - if (.not. use_crop) then - write(iulog,*) 'ERROR: do_transient_crops can only be true if use_crop is true' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (use_fates) then - ! NOTE(wjs, 2017-01-13) ED / FATES does not currently have a mechanism for - ! changing its column areas, with the consequent changes in aboveground biomass - ! per unit area. See https://github.com/NGEET/ed-clm/issues/173 - write(iulog,*) 'ERROR: do_transient_crops does not currently work with use_fates' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - if (dyn_subgrid_control_inst%do_harvest) then - if (.not. use_cn) then - write(iulog,*) 'ERROR: do_harvest can only be true if use_cn is true' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (use_fates) then - write(iulog,*) 'ERROR: do_harvest currently does not work with use_fates' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine check_namelist_consistency - - !----------------------------------------------------------------------- - character(len=fname_len) function get_flanduse_timeseries() - ! !DESCRIPTION: - ! Return the value of the flanduse_timeseries file name - - character(len=*), parameter :: subname = 'get_flanduse_timeseries' - !----------------------------------------------------------------------- - - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) - - get_flanduse_timeseries = dyn_subgrid_control_inst%flanduse_timeseries - - end function get_flanduse_timeseries - - !----------------------------------------------------------------------- - logical function get_do_transient_pfts() - ! !DESCRIPTION: - ! Return the value of the do_transient_pfts control flag - !----------------------------------------------------------------------- - - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) - - get_do_transient_pfts = dyn_subgrid_control_inst%do_transient_pfts - - end function get_do_transient_pfts - - !----------------------------------------------------------------------- - logical function get_do_transient_crops() - ! !DESCRIPTION: - ! Return the value of the do_transient_crops control flag - !----------------------------------------------------------------------- - - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) - - get_do_transient_crops = dyn_subgrid_control_inst%do_transient_crops - - end function get_do_transient_crops - - !----------------------------------------------------------------------- - logical function run_has_transient_landcover() - ! !DESCRIPTION: - ! Returns true if any aspects of prescribed transient landcover are enabled - !----------------------------------------------------------------------- - - run_has_transient_landcover = & - (get_do_transient_pfts() .or. & - get_do_transient_crops()) - end function run_has_transient_landcover - - !----------------------------------------------------------------------- - logical function get_do_harvest() - ! !DESCRIPTION: - ! Return the value of the do_harvest control flag - !----------------------------------------------------------------------- - - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) - - get_do_harvest = dyn_subgrid_control_inst%do_harvest - - end function get_do_harvest - - !----------------------------------------------------------------------- - logical function get_for_testing_allow_non_annual_changes() - ! - ! !DESCRIPTION: - ! Return true if the user has requested to allow area changes at times other than the - ! year boundary. (This should typically only be true for testing.) (This only - ! controls error-checking, not any operation of the code.) - !----------------------------------------------------------------------- - - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) - - get_for_testing_allow_non_annual_changes = dyn_subgrid_control_inst%for_testing_allow_non_annual_changes - - end function get_for_testing_allow_non_annual_changes - - !----------------------------------------------------------------------- - logical function get_for_testing_zero_dynbal_fluxes() - ! - ! !DESCRIPTION: - ! Return true if the user has requested to set the dynbal water and energy fluxes to - ! zero. This should typically only be true for testing: This is needed in some tests - ! where we have daily rather than annual glacier dynamics: if we allow the true dynbal - ! adjustment fluxes in those tests, we end up with sensible heat fluxes of thousands - ! of W m-2 or more, which causes CAM to blow up. However, note that setting it to - ! true will break water and energy conservation! - ! ----------------------------------------------------------------------- - - SHR_ASSERT(dyn_subgrid_control_inst%initialized, errMsg(sourcefile, __LINE__)) - - get_for_testing_zero_dynbal_fluxes = dyn_subgrid_control_inst%for_testing_zero_dynbal_fluxes - - end function get_for_testing_zero_dynbal_fluxes - -end module dynSubgridControlMod diff --git a/src/dyn_subgrid/dynSubgridDriverMod.F90 b/src/dyn_subgrid/dynSubgridDriverMod.F90 deleted file mode 100644 index 8703fcb2d9..0000000000 --- a/src/dyn_subgrid/dynSubgridDriverMod.F90 +++ /dev/null @@ -1,347 +0,0 @@ -module dynSubgridDriverMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! - ! !DESCRIPTION: - ! High-level routines for dynamic subgrid areas (prescribed transient Patches, CNDV, and - ! dynamic landunits). - ! - ! !USES: - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC, BOUNDS_LEVEL_CLUMP - use decompMod , only : get_proc_clumps, get_clump_bounds - use dynSubgridControlMod , only : get_flanduse_timeseries - use dynSubgridControlMod , only : get_do_transient_pfts, get_do_transient_crops - use dynSubgridControlMod , only : get_do_harvest - use dynPriorWeightsMod , only : prior_weights_type - use dynPatchStateUpdaterMod , only : patch_state_updater_type - use dynColumnStateUpdaterMod , only : column_state_updater_type - use dynpftFileMod , only : dynpft_init, dynpft_interp - use dyncropFileMod , only : dyncrop_init, dyncrop_interp - use dynHarvestMod , only : dynHarvest_init, dynHarvest_interp - use dynLandunitAreaMod , only : update_landunit_weights - use subgridWeightsMod , only : compute_higher_order_weights, set_subgrid_diagnostic_fields - use reweightMod , only : reweight_wrapup - use glcBehaviorMod , only : glc_behavior_type - use UrbanParamsType , only : urbanparams_type - use CanopyStateType , only : canopystate_type - use CNVegetationFacade , only : cn_vegetation_type - use SoilBiogeochemStateType , only : soilBiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilBiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType, only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenStateType, only : soilbiogeochem_nitrogenstate_type - use ch4Mod, only : ch4_type - use EnergyFluxType , only : energyflux_type - use PhotosynthesisMod , only : photosyns_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use WaterfluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use TemperatureType , only : temperature_type - use CropType , only : crop_type - use glc2lndMod , only : glc2lnd_type - use filterMod , only : filter, filter_inactive_and_active - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - ! - public :: dynSubgrid_init ! initialize transient land cover - public :: dynSubgrid_driver ! top-level driver for transient land cover - public :: dynSubgrid_wrapup_weight_changes ! reconcile various variables after subgrid weights change - - ! - ! !PRIVATE TYPES: - - ! saved weights from before the subgrid weight updates - type(prior_weights_type), target :: prior_weights - - ! object used to update patch-level states after subgrid weight updates - type(patch_state_updater_type), target :: patch_state_updater - - ! object used to update column-level states after subgrid weight updates - type(column_state_updater_type), target :: column_state_updater - !--------------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) - ! - ! !DESCRIPTION: - ! Initialize objects needed for prescribed transient PFTs, CNDV, and/or dynamic - ! landunits. - ! - ! Also sets initial subgrid weight for aspects prescribed from file (transient PFTs - ! and transient crops). These initial weights will be overwritten in a restart run, - ! or any other run that starts up from initial conditions (except startup runs that - ! use init_interp). - ! - ! This should be called from initialization, after dynSubgridControl is initialized. - ! - ! Note that dynpft_init needs to be called from outside any loops over clumps - so - ! this routine needs to be called from outside any loops over clumps. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds_proc ! processor-level bounds - type(glc_behavior_type) , intent(in) :: glc_behavior - type(crop_type) , intent(inout) :: crop_inst - ! - ! !LOCAL VARIABLES: - integer :: nclumps ! number of clumps on this processor - integer :: nc ! clump index - type(bounds_type) :: bounds_clump ! clump-level bounds - character(len=*), parameter :: subname = 'dynSubgrid_init' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds_proc%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - nclumps = get_proc_clumps() - - prior_weights = prior_weights_type(bounds_proc) - patch_state_updater = patch_state_updater_type(bounds_proc) - column_state_updater = column_state_updater_type(bounds_proc, nclumps) - - ! Initialize stuff for prescribed transient Patches - if (get_do_transient_pfts()) then - call dynpft_init(bounds_proc, dynpft_filename=get_flanduse_timeseries()) - end if - - ! Initialize stuff for prescribed transient crops - if (get_do_transient_crops()) then - call dyncrop_init(bounds_proc, dyncrop_filename=get_flanduse_timeseries()) - end if - - ! Initialize stuff for harvest. Note that, currently, the harvest data are on the - ! flanduse_timeseries file. However, this could theoretically be changed so that the - ! harvest data were separated from the pftdyn data, allowing them to differ in the - ! years over which they apply. - if (get_do_harvest()) then - call dynHarvest_init(bounds_proc, harvest_filename=get_flanduse_timeseries()) - end if - - ! ------------------------------------------------------------------------ - ! Set initial subgrid weights for aspects that are read from file. This is relevant - ! for cold start and use_init_interp-based initialization. - ! ------------------------------------------------------------------------ - - if (get_do_transient_pfts()) then - call dynpft_interp(bounds_proc) - end if - - if (get_do_transient_crops()) then - call dyncrop_interp(bounds_proc, crop_inst) - end if - - ! (We don't bother calling dynHarvest_interp, because the harvest information isn't - ! needed until the run loop. Harvest has nothing to do with subgrid weights, and in - ! some respects doesn't even really belong in this module at all.) - - ! The following is only needed if there were actually weight changes due to the above - ! interp calls, but it doesn't hurt to always run this code: - - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds_clump) - - call dynSubgrid_wrapup_weight_changes(bounds_clump, glc_behavior) - end do - !$OMP END PARALLEL DO - - end subroutine dynSubgrid_init - - !----------------------------------------------------------------------- - subroutine dynSubgrid_driver(bounds_proc, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst, & - canopystate_inst, photosyns_inst, crop_inst, glc2lnd_inst, bgc_vegetation_inst, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_carbonflux_inst, ch4_inst, & - glc_behavior) - ! - ! !DESCRIPTION: - ! Update subgrid weights for prescribed transient PFTs, CNDV, and/or dynamic - ! landunits. Also do related adjustments (water & energy, carbon & nitrogen). - ! - ! This should be called every time step in CLM's run loop. - ! - ! Note that this routine operates partly at the proc-level (outside an OMP region), - ! and partly at the clump level (inside OMP regions). Thus, this must be called from - ! OUTSIDE any loops over clumps in the driver. - ! - ! !USES: - use clm_varctl , only : use_cn, use_fates - use dynInitColumnsMod , only : initialize_new_columns - use dynConsBiogeophysMod , only : dyn_hwcontent_init, dyn_hwcontent_final - use dynEDMod , only : dyn_ED - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds_proc ! processor-level bounds - type(urbanparams_type) , intent(in) :: urbanparams_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilhydrology_type) , intent(inout) :: soilhydrology_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(temperature_type) , intent(inout) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - type(crop_type) , intent(inout) :: crop_inst - type(glc2lnd_type) , intent(inout) :: glc2lnd_inst - type(cn_vegetation_type) , intent(inout) :: bgc_vegetation_inst - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type), intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type), intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type), intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type), intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(ch4_type) , intent(inout) :: ch4_inst - type(glc_behavior_type) , intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: nclumps ! number of clumps on this processor - integer :: nc ! clump index - type(bounds_type) :: bounds_clump ! clump-level bounds - - character(len=*), parameter :: subname = 'dynSubgrid_driver' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds_proc%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - nclumps = get_proc_clumps() - - ! ========================================================================== - ! Do initialization, prior to land cover change - ! ========================================================================== - - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds_clump) - - call dyn_hwcontent_init(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_lakec, filter(nc)%lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst) - - call prior_weights%set_prior_weights(bounds_clump) - call patch_state_updater%set_old_weights(bounds_clump) - call column_state_updater%set_old_weights(bounds_clump) - end do - !$OMP END PARALLEL DO - - ! ========================================================================== - ! Do land cover change that requires I/O, and thus must be outside a threaded region - ! ========================================================================== - - if (get_do_transient_pfts()) then - call dynpft_interp(bounds_proc) - end if - - if (get_do_transient_crops()) then - call dyncrop_interp(bounds_proc,crop_inst) - end if - - if (get_do_harvest()) then - call dynHarvest_interp(bounds_proc) - end if - - ! ========================================================================== - ! Do land cover change that does not require I/O - ! ========================================================================== - - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds_clump) - - call bgc_vegetation_inst%UpdateSubgridWeights(bounds_clump) - - if (use_fates) then - call dyn_ED(bounds_clump) - end if - - call glc2lnd_inst%update_glc2lnd_fracs( & - bounds = bounds_clump) - - ! ======================================================================== - ! Do wrapup stuff after land cover change - ! - ! Everything following this point in this loop only needs to be called if we have - ! actually changed some weights in this time step. However, it doesn't do any harm - ! (other than a small performance hit) to call this stuff all the time, so we do so - ! for simplicity and safety. - ! - ! NOTE(wjs, 2017-02-24) I'm not positive that the above paragraph is 100% true. It - ! is at least *mostly* true, but there may be some subtleties, like resetting of - ! some variables, that are needed even in (some) time steps where we haven't - ! changed weights. - ! ======================================================================== - - call dynSubgrid_wrapup_weight_changes(bounds_clump, glc_behavior) - - call patch_state_updater%set_new_weights(bounds_clump) - call column_state_updater%set_new_weights(bounds_clump, nc) - - call set_subgrid_diagnostic_fields(bounds_clump) - - call initialize_new_columns(bounds_clump, & - prior_weights%cactive(bounds_clump%begc:bounds_clump%endc), & - temperature_inst, waterstate_inst, soilhydrology_inst) - - call dyn_hwcontent_final(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_lakec, filter(nc)%lakec, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst) - - if (use_cn) then - call bgc_vegetation_inst%DynamicAreaConservation(bounds_clump, nc, & - filter_inactive_and_active(nc)%num_soilp, filter_inactive_and_active(nc)%soilp, & - filter_inactive_and_active(nc)%num_soilc, filter_inactive_and_active(nc)%soilc, & - prior_weights, patch_state_updater, column_state_updater, & - canopystate_inst, photosyns_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst, ch4_inst, soilbiogeochem_state_inst) - end if - - end do - !$OMP END PARALLEL DO - - end subroutine dynSubgrid_driver - - !----------------------------------------------------------------------- - subroutine dynSubgrid_wrapup_weight_changes(bounds_clump, glc_behavior) - ! - ! !DESCRIPTION: - ! Reconcile various variables after subgrid weights change - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds_clump ! clump-level bounds - type(glc_behavior_type) , intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'dynSubgrid_wrapup_weight_changes' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds_clump%level == BOUNDS_LEVEL_CLUMP, subname // ': argument must be CLUMP-level bounds') - - call update_landunit_weights(bounds_clump) - - call compute_higher_order_weights(bounds_clump) - - ! Here: filters are re-made - ! - ! This call requires clump-level bounds, which is why we need to ensure that the - ! argument to this routine is clump-level bounds - call reweight_wrapup(bounds_clump, glc_behavior) - - end subroutine dynSubgrid_wrapup_weight_changes - - -end module dynSubgridDriverMod diff --git a/src/dyn_subgrid/dynTimeInfoMod.F90 b/src/dyn_subgrid/dynTimeInfoMod.F90 deleted file mode 100644 index 7a5b6fe014..0000000000 --- a/src/dyn_subgrid/dynTimeInfoMod.F90 +++ /dev/null @@ -1,375 +0,0 @@ -module dynTimeInfoMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains a derived type and associated methods for storing and working with time - ! information for a single dynamic landuse file. The assumption is that there is a - ! single time sample per year. - ! - ! !USES: - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use shr_kind_mod, only: r8 => shr_kind_r8 - ! - implicit none - private - ! - ! !PUBLIC TYPES: - - ! The following provides an enumeration that defines possible values for one of the - ! components of time_info_type. The public instances of the type (defined below) - ! effectively define the enumeration. - type, public :: year_position_type - private - integer :: flag - end type year_position_type - type(year_position_type), parameter, public :: & - YEAR_POSITION_START_OF_TIMESTEP = year_position_type(1), & - YEAR_POSITION_END_OF_TIMESTEP = year_position_type(2) - - type, public :: time_info_type - private - ! Static information about the file: - integer :: nyears ! number of years in the file - integer, allocatable :: years(:) ! all years in this file - - ! Other static information: - type(year_position_type) :: year_position ! how to obtain the model year relative to the current timestep - - ! Information that potentially changes each time step: - integer :: time_index_lower ! lower bound index of the current interval - integer :: time_index_upper ! upper bound index of the current interval - - contains - procedure :: set_current_year ! should be called every time step to update info with the current model year - procedure :: get_time_index_lower ! get lower bound index of current interval - procedure :: get_time_index_upper ! get upper bound index of current interval - procedure :: get_yearfrac ! get the fractional position in the current year - procedure :: get_year ! get the year associated with a given time index - procedure :: is_within_bounds ! return true if we are currently within the bounds of this file - procedure :: is_before_time_series ! returns true if we are currently prior to the bounds of this file - procedure :: is_after_time_series ! returns true if we are currently after the bounds of this file - ! (if the last year of the file is (e.g.) 2005, then this is TRUE if the current year is 2005) - - procedure, private :: set_info_from_year ! given the current model year, sets object data appropriately - procedure, private :: year_in_current_interval ! returns true if the current year is in the current interval - end type time_info_type - - interface time_info_type - module procedure constructor ! initialize a time_info_type object - end interface time_info_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - !----------------------------------------------------------------------- - type(time_info_type) function constructor(my_years, year_position) - ! - ! !DESCRIPTION: - ! Initialize a time_info_type object - ! - ! !ARGUMENTS: - - ! all years in this file: - integer, intent(in) :: my_years(:) - - ! how to obtain the model year relative to the current timestep; must be one of: - ! - YEAR_POSITION_START_OF_TIMESTEP: use the year at the start of the timestep - ! - YEAR_POSITION_END_OF_TIMESTEP: use the year at the end of the timestep - type(year_position_type), intent(in) :: year_position - !----------------------------------------------------------------------- - - constructor%nyears = size(my_years) - allocate(constructor%years(constructor%nyears)) - constructor%years = my_years - constructor%year_position = year_position - - ! Set time_index_lower and time_index_upper arbitrarily; they'll get set correctly by set_current_year - constructor%time_index_lower = 1 - constructor%time_index_upper = 1 - - ! Set time_index_lower and time_index_upper to their correct values - call constructor%set_current_year() - - end function constructor - - - ! ====================================================================== - ! Public methods - ! ====================================================================== - - !----------------------------------------------------------------------- - subroutine set_current_year(this) - ! - ! !DESCRIPTION: - ! Update time information (time_index_lower and time_index_upper), based on the - ! current model year. - ! - ! Should be called every time step - ! - ! !USES: - use clm_time_manager , only : get_curr_date, get_prev_date - ! - ! !ARGUMENTS: - class(time_info_type), intent(inout) :: this ! this object - ! - ! !LOCAL VARIABLES: - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - - character(len=*), parameter :: subname = 'set_current_year' - !----------------------------------------------------------------------- - - select case (this%year_position%flag) - case (YEAR_POSITION_START_OF_TIMESTEP%flag) - call get_prev_date(year, mon, day, sec) - case (YEAR_POSITION_END_OF_TIMESTEP%flag) - call get_curr_date(year, mon, day, sec) - case default - write(iulog,*) subname, ': unknown year position: ', this%year_position%flag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - call this%set_info_from_year(year) - - end subroutine set_current_year - - - ! ---------------------------------------------------------------------- - ! Various getter routines - ! ---------------------------------------------------------------------- - - !----------------------------------------------------------------------- - pure integer function get_time_index_lower(this) - ! !DESCRIPTION: Get lower bound index of current interval - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - !----------------------------------------------------------------------- - - get_time_index_lower = this%time_index_lower - end function get_time_index_lower - - !----------------------------------------------------------------------- - pure integer function get_time_index_upper(this) - ! !DESCRIPTION: Get upper bound index of current interval - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - !----------------------------------------------------------------------- - - get_time_index_upper = this%time_index_upper - end function get_time_index_upper - - !----------------------------------------------------------------------- - real(r8) function get_yearfrac(this) - ! - ! !DESCRIPTION: - ! Get the fractional position in the current year (0 at midnight on Jan 1, and 1 at - ! the end of Dec 31). - ! - ! This function uses the year_position metadata of this object to determine whether - ! the fractional position in the year should be determined based on the start or end - ! of the current timestep. - ! - ! !USES: - use clm_time_manager, only : get_curr_yearfrac, get_prev_yearfrac - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_yearfrac' - !----------------------------------------------------------------------- - - select case (this%year_position%flag) - case (YEAR_POSITION_START_OF_TIMESTEP%flag) - get_yearfrac = get_prev_yearfrac() - case (YEAR_POSITION_END_OF_TIMESTEP%flag) - get_yearfrac = get_curr_yearfrac() - case default - write(iulog,*) subname, ': unknown year position: ', this%year_position%flag - call endrun(errMsg(sourcefile, __LINE__)) - end select - - end function get_yearfrac - - - !----------------------------------------------------------------------- - integer function get_year(this, nt) - ! !DESCRIPTION: Get the year associated with time index nt - ! - ! Note this can't be a pure function because of the call to shr_assert - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - integer , intent(in) :: nt ! time index - - character(len=*), parameter :: subname = 'get_year' - !----------------------------------------------------------------------- - - SHR_ASSERT(1 <= nt .and. nt <= this%nyears, subname // ': nt out of bounds') - get_year = this%years(nt) - end function get_year - - !----------------------------------------------------------------------- - pure logical function is_within_bounds(this) - ! !DESCRIPTION: Returns true if we are currently within the bounds of this file - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - !----------------------------------------------------------------------- - - is_within_bounds = ((.not. this%is_before_time_series()) .and. & - (.not. this%is_after_time_series())) - - end function is_within_bounds - - !----------------------------------------------------------------------- - pure logical function is_before_time_series(this) - ! !DESCRIPTION: Returns true if we are currently prior to the bounds of this file - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - !----------------------------------------------------------------------- - - if (this%time_index_upper == 1) then - is_before_time_series = .true. - else - is_before_time_series = .false. - end if - end function is_before_time_series - - !----------------------------------------------------------------------- - pure logical function is_after_time_series(this) - ! !DESCRIPTION: Returns true if we are currently after the bounds of this file - ! - ! If the last year of the file is (e.g.) 2005, then this is TRUE if the current year - ! is 2005 - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this - !----------------------------------------------------------------------- - - if (this%time_index_lower == this%nyears) then - is_after_time_series = .true. - else - is_after_time_series = .false. - end if - end function is_after_time_series - - ! ====================================================================== - ! Private methods - ! ====================================================================== - - !----------------------------------------------------------------------- - pure logical function year_in_current_interval(this, cur_year) - ! !DESCRIPTION: - ! Returns true if the current year is in the current interval - ! - ! !ARGUMENTS: - class(time_info_type), intent(in) :: this ! this object - integer, intent(in) :: cur_year ! current model year - !----------------------------------------------------------------------- - - if (this%years(this%time_index_lower) == cur_year .and. this%years(this%time_index_upper) == (cur_year + 1)) then - ! Normal case: we're within the time series, in the same interval as before - year_in_current_interval = .true. - else if (this%is_before_time_series() .and. cur_year < this%years(1)) then - ! We were and still are before the time series - year_in_current_interval = .true. - else if (this%is_after_time_series() .and. cur_year >= this%years(this%nyears)) then - ! We were and still are after the time series - year_in_current_interval = .true. - else - year_in_current_interval = .false. - end if - - end function year_in_current_interval - - !----------------------------------------------------------------------- - subroutine set_info_from_year(this, cur_year) - ! - ! !DESCRIPTION: - ! Given the current model year, sets time information (time_index_lower and - ! time_index_upper) appropriately. - ! - ! !ARGUMENTS: - class(time_info_type), intent(inout) :: this ! this object - integer, intent(in) :: cur_year ! current model year - ! - ! !LOCAL VARIABLES: - logical :: found ! has the correct interval been found? - integer :: n ! interval index - - character(len=*), parameter :: subname = 'set_info_from_year' - !----------------------------------------------------------------------- - - ! Determine if current date spans the years - ! - ! If current year is less than first timeseries year, then use the first year from - ! dynamic land cover file for both time_index_lower and time_index_upper, forcing constant weights until the - ! model year enters the dynamic land cover dataset timeseries range. - ! - ! If current year is equal to or greater than the last timeseries year, then use the - ! last year for both time_index_lower and time_index_upper, forcing constant weights for the remainder of the - ! simulation. - ! - ! This mechanism permits the introduction of a dynamic pft period in the middle of a - ! simulation, with constant weights before and after the dynamic period. - - associate( & - nyears => this%nyears, & - years => this%years, & - time_index_lower => this%time_index_lower, & - time_index_upper => this%time_index_upper) - - if (year_in_current_interval(this, cur_year)) then - ! DO NOTHING - NT1 AND NT2 ARE ALREADY CORRECT - else - if (cur_year < years(1)) then - ! prior to the first interval - time_index_lower = 1 - time_index_upper = 1 - else if (cur_year >= years(nyears)) then - ! past the last interval - time_index_lower = nyears - time_index_upper = nyears - else - ! within the time bounds of the file - found = .false. - do n = 1, nyears-1 - if (cur_year == years(n)) then - time_index_lower = n - time_index_upper = n + 1 - found = .true. - exit - end if - end do - if (.not. found) then - write(iulog,*) subname//' ERROR: model year not found in pftdyn timeseries' - write(iulog,*)'model year = ',cur_year - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - end if - - SHR_ASSERT(time_index_upper <= nyears, subname // ': time_index_upper should not be greater than nyears') - - end associate - - end subroutine set_info_from_year - -end module dynTimeInfoMod diff --git a/src/dyn_subgrid/dynVarMod.F90.in b/src/dyn_subgrid/dynVarMod.F90.in deleted file mode 100644 index 2cc14e669c..0000000000 --- a/src/dyn_subgrid/dynVarMod.F90.in +++ /dev/null @@ -1,375 +0,0 @@ -module dynVarMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains a derived type and associated methods for working with a single dynamic - ! subgrid variable, which may or may not need time interpolation. - ! - ! This is an abstract type that needs to be extended by a specific derived type - ! (dyn_var_time_uninterp_type or dyn_var_time_interp_type). Besides the lack of - ! definition of some methods, also note that it does NOT define the data - ! themselves. This is because different type extensions have different needs for what - ! data are stored - and particularly whether they need data at just time_index_lower, or data at both - ! time_index_lower and time_index_upper. - ! - ! The use of this class (or its extensions) is: - ! In initialization: - ! - create a new object using the appropriate constructor (a constructor for one of - ! the children of dyn_var_type) - ! - call get_current_data to get the initial data - ! - ! Each time through the run loop: - ! - call get_current_data to get the current value of the data - ! - ! Note that, because of the reads that are done here, the methods of this class should - ! NOT be called from inside threaded regions or loops over clumps - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : iulog - use dynFileMod , only : dyn_file_type - use dynTimeInfoMod , only : time_info_type - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - implicit none - private - ! - ! !PUBLIC TYPES: - - ! maximum number of real dimensions allowed for the underlying variables stored in - ! dyn_var_type - integer, parameter, public :: dyn_var_max_dims = 2 - - public :: dyn_var_type - - ! This is an abstract base class that should be extended. - ! - ! Any type extension needs to define the following methods: - ! - get_current_data_1d - ! - get_current_data_2d - ! - get_current_att - ! - read_data_if_needed - ! - ! In addition, a type extension needs to define the data field(s); these are not defined - ! in the base class because different type extensions have different needs for what data - ! are stored - and particularly whether they need data at just time_index_lower, or data at both time_index_lower - ! and time_index_upper. - ! - ! Although this base class doesn't define the data themselves, note that the - ! implementation here assumes that the data will be stored as a 1-d vector, even if the - ! data are truly 2-d. i.e., the type extension should define its data as: - ! real(r8), allocatable :: data_at_tlower(:) - type, abstract :: dyn_var_type - private - type(dyn_file_type), pointer :: dyn_file ! pointer to the file containing this variable - character(len=256) :: varname ! variable name on file - character(len=256) :: dim1name ! dim1name on file - real(r8) :: conversion_factor ! data are DIVIDED by conversion_factor immediately after reading them - - ! Only relevant for 2-d variables: should we check to make sure that all sums equal 1? - logical :: do_check_sums_equal_1 - - ! Shape of data; max number of dimensions is given by dyn_var_max_dims in dynVarMod. - ! First dimension is the spatial dimension. - ! This is a pointer rather than an allocatable to work around a pgi compiler bug - ! (pgi 13.9) - integer, pointer :: data_shape(:) - - logical :: allow_nodata ! Flag to allow no data on the file or if should die - - logical :: data_on_file ! Flag to indicate if the data is on the file or not - contains - ! Public methods: - - ! The following are public only for the sake of type extensions of this base class; - ! they should not be used outside of these type extensions - procedure :: set_metadata ! Set metadata that are common to all type extensions of this base class - procedure :: get_dyn_file ! Get the dyn_file component - procedure :: get_data_shape ! Get the data_shape component - procedure :: get_att ! Get the variable attribute - procedure :: read_variable ! Wrapper to read a time slice of the variable - - ! The following need to be defined by any type extensions; they need to be public so - ! they can be overridden, but they should not be used outside of type extensions - procedure(get_current_data_1d_interface), deferred :: get_current_data_1d ! Get the current value of the data, for a 1-d variable - procedure(get_current_data_2d_interface), deferred :: get_current_data_2d ! Get the current value of the daat, for a 2-d variable - procedure(read_data_if_needed_interface), deferred :: read_data_if_needed ! Read the next time slice of data, if necessary - - ! Private methods: - procedure, private :: read_variable_1d ! Read a time slice of a 1-d variable - procedure, private :: read_variable_2d ! Read a time slice of a 2-d variable - end type dyn_var_type - - abstract interface - - subroutine read_data_if_needed_interface(this) - ! !DESCRIPTION: - ! Determine if new data need to be read from the file; if so, read them. - ! - ! !USES: - import :: dyn_var_type - ! - ! !ARGUMENTS: - class(dyn_var_type), intent(inout) :: this ! this object - end subroutine read_data_if_needed_interface - - ! DIMS 1,2 - subroutine get_current_data_{DIMS}d_interface(this, cur_data) - ! !DESCRIPTION: - ! Get the current (possibly interpolated) value of the data, in cur_data. cur_data - ! should have the same dimensionality as the underlying data, as given by the - ! data_shape argument that was passed to the constructor. - ! - ! If necessary, new data are read from the file. - ! - ! Should be called once per time step, AFTER calling set_current_year on the - ! underlying dyn_file variable - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - import :: dyn_var_type - ! - ! !ARGUMENTS: - class(dyn_var_type) , intent(inout) :: this ! this object - real(r8) , intent(out) :: cur_data{DIMSTR} ! current value of data - end subroutine get_current_data_{DIMS}d_interface - - end interface - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - -contains - - ! ====================================================================== - ! Public methods - ! - ! The following are public only for the sake of type extensions of this base class. - ! They should not be used outside these type extensions. - ! ====================================================================== - - !----------------------------------------------------------------------- - subroutine set_metadata(this, dyn_file, varname, dim1name, conversion_factor, & - do_check_sums_equal_1, data_shape, allow_nodata) - ! - ! !DESCRIPTION: - ! Set metadata that are common to all type extensions of this base class - ! - ! !USES: - ! - ! !ARGUMENTS: - class(dyn_var_type) , intent(inout) :: this ! this object - type(dyn_file_type) , target, intent(in) :: dyn_file ! file containing this variable - character(len=*) , intent(in) :: varname ! variable name on file - character(len=*) , intent(in) :: dim1name ! dim1name on file - real(r8) , intent(in) :: conversion_factor ! data are DIVIDED by conversion_factor immediately after reading them - logical, optional , intent(in) :: allow_nodata ! Flag to indicate if it's allowed to NOT have data on the file - - ! Only relevant for 2-d variables: should we check to make sure that all sums equal 1? - logical, intent(in) :: do_check_sums_equal_1 - - ! Shape of data; max number of dimensions is given by dyn_var_max_dims in dynVarMod. - ! First dimension is the spatial dimension. - integer, intent(in) :: data_shape(:) - - ! - ! !LOCAL VARIABLES: - integer :: ndims ! number of dimensions in data - - character(len=*), parameter :: subname = 'set_metadata' - !----------------------------------------------------------------------- - - ndims = size(data_shape) - - ! Do some error checking on the inputs - SHR_ASSERT(ndims <= dyn_var_max_dims, subname//' ERROR: ndims must be <= dyn_var_max_dims') - if (do_check_sums_equal_1) then - SHR_ASSERT(ndims == 2, subname//' ERROR: do_check_sums_equal_1 only valid for ndims==2') - end if - - ! Set metadata for this variable - this%dyn_file => dyn_file - this%varname = varname - this%dim1name = dim1name - this%conversion_factor = conversion_factor - this%do_check_sums_equal_1 = do_check_sums_equal_1 - allocate(this%data_shape(ndims)) - this%data_shape = data_shape - - if ( present(allow_nodata) )then - this%allow_nodata = allow_nodata - else - this%allow_nodata = .false. - end if - this%data_on_file = .false. - - end subroutine set_metadata - - - !----------------------------------------------------------------------- - function get_dyn_file(this) - ! - ! !DESCRIPTION: - ! Get the dyn_file component of this object - ! - ! !ARGUMENTS: - type(dyn_file_type) , pointer :: get_dyn_file - class(dyn_var_type) , intent(in) :: this ! this object - !----------------------------------------------------------------------- - get_dyn_file => this%dyn_file - end function get_dyn_file - - !----------------------------------------------------------------------- - function get_data_shape(this) - ! - ! !DESCRIPTION: - ! Get the data_shape component of this object - ! - ! !ARGUMENTS: - integer , allocatable :: get_data_shape(:) - class(dyn_var_type) , intent(in) :: this ! this object - !----------------------------------------------------------------------- - allocate(get_data_shape(size(this%data_shape))) - get_data_shape = this%data_shape - end function get_data_shape - - !----------------------------------------------------------------------- - subroutine get_att(this,attname,attvalue) - ! - ! !DESCRIPTION: - ! Get the the value of an attribute on the file - ! - ! !USES: - use ncdio_pio , only : ncd_inqvid, ncd_getatt, var_desc_t - ! !ARGUMENTS: - class(dyn_var_type) , intent(inout):: this ! this object - character(len=*) , intent(in) :: attname ! name of the attribute - character(len=*) , intent(out) :: attvalue ! value of the attribute - ! !LOCAL VARIABLES: - integer :: varid ! variable id - type(var_desc_t) :: vardesc ! variable descriptor - character(len=*), parameter :: subname = 'get_att' - !----------------------------------------------------------------------- - call ncd_inqvid(this%dyn_file, this%varname, varid, vardesc) - call ncd_getatt(this%dyn_file, varid, attname, attvalue) - end subroutine get_att - - !----------------------------------------------------------------------- - subroutine read_variable(this, nt, data) - ! - ! !DESCRIPTION: - ! Wrapper to read a time slice of the variable; result goes in the data argument. - ! - ! !USES: - use spmdMod , only : masterproc - ! - ! !ARGUMENTS: - class(dyn_var_type) , intent(inout) :: this ! this object - integer , intent(in) :: nt ! time index to read - real(r8) , intent(out) :: data(:) ! variable holding data read from file - ! - ! !LOCAL VARIABLES: - integer :: ndims ! number of dimensions of the underlying variable - - character(len=*), parameter :: subname = 'read_variable' - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Get data for variable ', trim(this%varname), ' for year ', & - this%dyn_file%time_info%get_year(nt) - end if - - ndims = size(this%data_shape) - if (ndims == 1) then - call read_variable_1d(this, nt, data) - else if (ndims == 2) then - call read_variable_2d(this, nt, data) - else - call endrun(msg='ERROR: read_variable can only handle 1 or 2 dimensions'//& - errMsg(sourcefile, __LINE__)) - end if - - end subroutine read_variable - - - ! ====================================================================== - ! Private methods - ! ====================================================================== - - ! DIMS 1,2 - !----------------------------------------------------------------------- - subroutine read_variable_{DIMS}d(this, nt, data) - ! - ! !DESCRIPTION: - ! Read a time slice of a {DIMS}-d variable - ! This routine applies the conversion given by conversion_factor. - ! - ! !USES: - use spmdMod , only : masterproc - use ncdio_pio , only : ncd_io - use surfrdUtilsMod , only : check_sums_equal_1 - ! - ! !ARGUMENTS: - class(dyn_var_type) , intent(inout) :: this ! this object (needs to be intent(inout) because this%dynfile is intent(inout) in the ncd_io call) - integer , intent(in) :: nt ! time index to read - ! variable holding data read from file (note that this is 1-d regardless of the - ! dimensionality of the underlying data) - real(r8) , intent(out) :: data(:) - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: arrayl{DIMSTR} ! temporary array to hold data (needs to be a pointer) - logical :: readvar ! whether variable was read - logical :: die_on_error ! Flag if should die on error or just give a warning - - character(len=*), parameter :: subname = 'read_variable_{DIMS}d' - !----------------------------------------------------------------------- - die_on_error = .true. - if ( this%allow_nodata ) then - die_on_error = .false. - end if - - ! The following doesn't seem to be allowed: - ! allocate(arrayl(this%data_shape)) - ! So instead we have to do this in a more ugly way: -#if ({DIMS}==1) - allocate(arrayl(this%data_shape(1))) -#elif ({DIMS}==2) - allocate(arrayl(this%data_shape(1), this%data_shape(2))) -#endif - - call ncd_io(ncid=this%dyn_file, varname=this%varname, flag='read', data=arrayl, & - dim1name=this%dim1name, nt=nt, readvar=readvar) - if (.not. readvar) then - if ( die_on_error ) then - call endrun(msg=' ERROR: ' // trim(this%varname) // ' NOT on file'//& - errMsg(sourcefile, __LINE__)) - else - if ( masterproc ) & - write(iulog,*) ' WARNING: ' // trim(this%varname) // ' NOT on file set to zero' - data = 0.0_r8 - end if - this%data_on_file = .false. - end if - - if ( readvar )then - this%data_on_file = .true. - arrayl = arrayl / this%conversion_factor - - ! The following needs to be in an ifdef because the check_sums_equal_1 interface - ! requires a 2-d array -#if ({DIMS}==2) - if (this%do_check_sums_equal_1) then - call check_sums_equal_1(arrayl, 1, this%varname, subname) - end if -#endif - - data = reshape(arrayl, shape(data)) - end if - - deallocate(arrayl) - end subroutine read_variable_{DIMS}d - -end module dynVarMod diff --git a/src/dyn_subgrid/dynVarTimeInterpMod.F90.in b/src/dyn_subgrid/dynVarTimeInterpMod.F90.in deleted file mode 100644 index 614b3d4d33..0000000000 --- a/src/dyn_subgrid/dynVarTimeInterpMod.F90.in +++ /dev/null @@ -1,219 +0,0 @@ -module dynVarTimeInterpMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains a derived type and associated methods that extend the base class, - ! dyn_var_type. The type defined here is for variables that SHOULD be interpolated in - ! time. For variables of this type, the data have the value given on year Y of the file - ! at midnight on Jan. 1 at the start of year Y. The value then gets linearly - ! interpolated over the year, so that by Dec. 31 of year Y, the value is close to the - ! file's value at year Y+1. Before the start of the time series, the data are fixed at - ! their value from the first year in the file; after the end of the time series, the - ! data are fixed at their value from the last year in the file. If the last year on the - ! file is X, then the data are fixed at this last value (and thus do not vary) - ! throughout year X. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use dynVarMod , only : dyn_var_type - - implicit none - private - ! - ! !PUBLIC TYPES: - public :: dyn_var_time_interp_type - - type, extends(dyn_var_type) :: dyn_var_time_interp_type - private - ! Note that data are stored as 1-d, then converted to the appropriate dimensionality - ! as needed - real(r8), allocatable :: data_at_tlower(:) ! data at time time_index_lower - real(r8), allocatable :: data_at_tupper(:) ! data at time time_index_upper - - integer :: time_index_lower ! current time_index_lower curresponding to data_at_tlower - integer :: time_index_upper ! current time_index_upper curresponding to data_at_tupper - contains - generic :: get_current_data => & ! Get the current value of the data - get_current_data_1d, get_current_data_2d - procedure :: get_current_data_1d ! Get the current value of the data, for a 1-d variable - procedure :: get_current_data_2d ! Get the current value of the data, for a 2-d variable - procedure :: read_data_if_needed ! Read the next time slice of data, if necessary - end type dyn_var_time_interp_type - - interface dyn_var_time_interp_type - module procedure constructor ! initialize a new dyn_var_time_interp object - end interface dyn_var_time_interp_type - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - !----------------------------------------------------------------------- - type(dyn_var_time_interp_type) function constructor( & - dyn_file, varname, dim1name, conversion_factor, & - do_check_sums_equal_1, data_shape) - ! - ! !DESCRIPTION: - ! Creates an object of type dyn_var_time_interp_type. This also reads the first - ! set of data. - ! - ! Assumes that dyn_file has already been initialized. - ! - ! !USES: - use dynFileMod , only : dyn_file_type - use dynTimeInfoMod , only : time_info_type - ! - ! !ARGUMENTS: - type(dyn_file_type), target, intent(in) :: dyn_file ! file containing this variable - character(len=*), intent(in) :: varname ! variable name on file - character(len=*), intent(in) :: dim1name ! dim1name on file - real(r8), intent(in) :: conversion_factor ! data are DIVIDED by conversion_factor immediately after reading them - - ! Only relevant for 2-d variables: should we check to make sure that all sums equal 1? - logical, intent(in) :: do_check_sums_equal_1 - - ! Shape of data; max number of dimensions is given by dyn_var_max_dims in dynVarMod. - ! First dimension is the spatial dimension. - integer, intent(in) :: data_shape(:) - !----------------------------------------------------------------------- - - ! Set metadata common to all dyn_var_type objects - call constructor%set_metadata( & - dyn_file=dyn_file, & - varname=varname, & - dim1name=dim1name, & - conversion_factor=conversion_factor, & - do_check_sums_equal_1=do_check_sums_equal_1, & - data_shape=data_shape) - - ! Allocate space for data - allocate(constructor%data_at_tlower(product(data_shape))) - allocate(constructor%data_at_tupper(product(data_shape))) - - ! Read first set of data - constructor%time_index_lower = dyn_file%time_info%get_time_index_lower() - constructor%time_index_upper = dyn_file%time_info%get_time_index_upper() - call constructor%read_variable(constructor%time_index_lower, constructor%data_at_tlower) - call constructor%read_variable(constructor%time_index_upper, constructor%data_at_tupper) - end function constructor - - ! ====================================================================== - ! Public methods - ! ====================================================================== - - ! The following specific procedures are NOT actually public, but they can be accessed - ! via the generic type-bound procedure, get_current_data - - ! DIMS 1,2 - !----------------------------------------------------------------------- - subroutine get_current_data_{DIMS}d(this, cur_data) - ! - ! !DESCRIPTION: - ! Get the current, interpolated value of the data, in cur_data. cur_data should have - ! the same dimensionality as the underlying data, as given by the data_shape argument - ! that was passed to the constructor. - ! - ! If necessary, new data are read from the file. - ! - ! Should be called once per time step, AFTER calling set_current_year on the - ! underlying dyn_file variable - ! - ! !USES: - use dynFileMod , only : dyn_file_type - ! - ! !ARGUMENTS: - class(dyn_var_time_interp_type) , intent(inout) :: this ! this object - real(r8) , intent(out) :: cur_data{DIMSTR} ! current value of data - ! - ! !LOCAL VARIABLES: - type(dyn_file_type), pointer :: dyn_file ! the dyn_file of this object - integer :: ndims ! ndims of data in 'this' - real(r8) :: wt1 ! weight of time1 (the left-hand time point) - real(r8), allocatable :: cur_data_1d(:) ! 1-d version of data at the current time - character(len=*), parameter :: subname = 'get_current_data_{DIMS}d' - !----------------------------------------------------------------------- - - ! Do some error checking - ndims = size(this%get_data_shape()) - SHR_ASSERT({DIMS} == ndims, subname//' ERROR: # dims of output argument must match ndims') - SHR_ASSERT_ALL((shape(cur_data) == this%get_data_shape()), subname//' ERROR: shape of cur_data must match shape of data') - - ! Get current data, using a temporal weighting of the data at time 1 and the data at - ! time 2 - call this%read_data_if_needed() - allocate(cur_data_1d(size(this%data_at_tlower))) - - dyn_file => this%get_dyn_file() - wt1 = 1.0_r8 - dyn_file%time_info%get_yearfrac() - - cur_data_1d(:) = this%data_at_tupper(:) + wt1*(this%data_at_tlower(:) - this%data_at_tupper(:)) - cur_data = reshape(cur_data_1d, shape(cur_data)) - deallocate(cur_data_1d) - - end subroutine get_current_data_{DIMS}d - - ! ====================================================================== - ! Private methods - ! ====================================================================== - - !----------------------------------------------------------------------- - subroutine read_data_if_needed(this) - ! - ! !DESCRIPTION: - ! Determine if new data need to be read from the file; if so, read them. - ! - ! We need to read new data (or at least copy them) if the current time on dyn_file - ! disagrees with the time for which we currently have stored data, for either time time_index_lower - ! or time time_index_upper - ! - ! !USES: - use dynFileMod , only : dyn_file_type - use dynTimeInfoMod , only : time_info_type - ! - ! !ARGUMENTS: - class(dyn_var_time_interp_type), intent(inout) :: this ! this object - ! - ! !LOCAL VARIABLES: - type(dyn_file_type), pointer :: dyn_file ! the dyn_file of this object - integer :: time_index_lower_cur ! current value of time_index_lower on dyn_fileb - integer :: time_index_upper_cur ! current value of time_index_upper on dyn_fileb - - character(len=*), parameter :: subname = 'read_data_if_needed' - !----------------------------------------------------------------------- - - dyn_file => this%get_dyn_file() - time_index_lower_cur = dyn_file%time_info%get_time_index_lower() - time_index_upper_cur = dyn_file%time_info%get_time_index_upper() - - ! If time_index_lower time has changed, get a new set of data for time time_index_lower - if (time_index_lower_cur /= this%time_index_lower) then - - ! The typical case is that we have moved forward by a single time; thus we can - ! avoid an extra read by simply setting the new data at time_index_lower equal to the old data - ! at time_index_upper - if (time_index_lower_cur == this%time_index_upper) then - this%data_at_tlower(:) = this%data_at_tupper(:) - - ! Otherwise, handle the general (but atypical) case where we have not moved - ! forward by a single time - else - call this%read_variable(time_index_lower_cur, this%data_at_tlower) - end if - - this%time_index_lower = time_index_lower_cur - end if - - ! If time_index_upper time has changed, read a new set of data for time time_index_upper - if (time_index_upper_cur /= this%time_index_upper) then - call this%read_variable(time_index_upper_cur, this%data_at_tupper) - this%time_index_upper = time_index_upper_cur - end if - - end subroutine read_data_if_needed - - -end module dynVarTimeInterpMod diff --git a/src/dyn_subgrid/dynVarTimeUninterpMod.F90.in b/src/dyn_subgrid/dynVarTimeUninterpMod.F90.in deleted file mode 100644 index b992fb2955..0000000000 --- a/src/dyn_subgrid/dynVarTimeUninterpMod.F90.in +++ /dev/null @@ -1,181 +0,0 @@ -module dynVarTimeUninterpMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains a derived type and associated methods that extend the base class, - ! dyn_var_type. The type defined here is for variables that should NOT be interpolated - ! in time. For variables of this type, the data will snap to their new value at the - ! beginning of each year, and then stay fixed throughout the year. Before the start of - ! the time series, the data are fixed at their value from the first year in the file; - ! after the end of the time series, the data are fixed at their value from the last year - ! in the file. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use dynVarMod , only : dyn_var_type - - implicit none - private - save - - ! !PUBLIC TYPES: - public :: dyn_var_time_uninterp_type - - type, extends(dyn_var_type) :: dyn_var_time_uninterp_type - private - ! Note that data are stored as 1-d, then converted to the appropriate dimensionality - ! as needed - real(r8), allocatable :: data_at_tlower(:) ! data at time time_index_lower - integer :: time_index_lower ! current time_index_lower corresponding to the data - contains - generic :: get_current_data => & ! Get the current value of the data - get_current_data_1d, get_current_data_2d - procedure :: get_current_data_1d ! Get the current value of the data, for a 1-d variable - procedure :: get_current_data_2d ! Get the current value of the data, for a 2-d variable - procedure :: read_data_if_needed ! Read the next time slice of data, if necessary - end type dyn_var_time_uninterp_type - - interface dyn_var_time_uninterp_type - module procedure constructor ! initialize a new dyn_var_time_uninterp_type object - end interface dyn_var_time_uninterp_type - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - !----------------------------------------------------------------------- - type(dyn_var_time_uninterp_type) function constructor( & - dyn_file, varname, dim1name, conversion_factor, & - do_check_sums_equal_1, data_shape, allow_nodata) - ! - ! !DESCRIPTION: - ! Creates an object of type dyn_var_time_uninterp_type. This also reads the first - ! set of data. - ! - ! Assumes that dyn_file has already been initialized. - ! - ! !USES: - use dynFileMod , only : dyn_file_type - use dynTimeInfoMod , only : time_info_type - ! - ! !ARGUMENTS: - type(dyn_file_type), target, intent(in) :: dyn_file ! file containing this variable - character(len=*), intent(in) :: varname ! variable name on file - character(len=*), intent(in) :: dim1name ! dim1name on file - real(r8), intent(in) :: conversion_factor ! data are DIVIDED by conversion_factor immediately after reading them - logical, optional, intent(in) :: allow_nodata ! Flag to allow there to be no data if the field doesn't exist on the dataset - - ! Only relevant for 2-d variables: should we check to make sure that all sums equal 1? - logical, intent(in) :: do_check_sums_equal_1 - - ! Shape of data; max number of dimensions is given by dyn_var_max_dims in dynVarMod. - ! First dimension is the spatial dimension. - integer, intent(in) :: data_shape(:) - - logical :: lallow_nodata ! Local version of allow_nodata which is by default FALSE - !----------------------------------------------------------------------- - - lallow_nodata = .false. - if ( present(allow_nodata) )then - lallow_nodata = allow_nodata - end if - ! Set metadata common to all dyn_var_type objects - call constructor%set_metadata( & - dyn_file=dyn_file, & - varname=varname, & - dim1name=dim1name, & - conversion_factor=conversion_factor, & - do_check_sums_equal_1=do_check_sums_equal_1, & - data_shape=data_shape, allow_nodata=lallow_nodata) - - ! Allocate space for data - allocate(constructor%data_at_tlower(product(data_shape))) - - ! Read first set of data - constructor%time_index_lower = dyn_file%time_info%get_time_index_lower() - call constructor%read_variable(constructor%time_index_lower, constructor%data_at_tlower) - end function constructor - - ! ====================================================================== - ! Public methods - ! ====================================================================== - - ! The following specific procedures are NOT actually public, but they can be accessed - ! via the generic type-bound procedure, get_current_data - - ! DIMS 1,2 - !----------------------------------------------------------------------- - subroutine get_current_data_{DIMS}d(this, cur_data) - ! - ! !DESCRIPTION: - ! Get the current value of the data, in cur_data. cur_data should have the same - ! dimensionality as the underlying data, as given by the data_shape argument that was - ! passed to the constructor. - ! - ! If necessary, new data are read from the file. - ! - ! Should be called once per time step, AFTER calling set_current_year on the - ! underlying dyn_file variable - ! - ! !ARGUMENTS: - class(dyn_var_time_uninterp_type) , intent(inout) :: this ! this object - real(r8) , intent(out) :: cur_data{DIMSTR} ! current value of data - ! - ! !LOCAL VARIABLES: - integer :: ndims ! ndims of data in 'this' - - character(len=*), parameter :: subname = 'get_current_data_{DIMS}d' - !----------------------------------------------------------------------- - - ! Do some error checking - ndims = size(this%get_data_shape()) - SHR_ASSERT({DIMS} == ndims, subname//' ERROR: # dims of output argument must match ndims') - SHR_ASSERT_ALL((shape(cur_data) == this%get_data_shape()), subname//' ERROR: shape of cur_data must match shape of data') - - ! Get current data - call this%read_data_if_needed() - cur_data = reshape(this%data_at_tlower, shape(cur_data)) - - end subroutine get_current_data_{DIMS}d - - ! ====================================================================== - ! Private methods - ! ====================================================================== - - !----------------------------------------------------------------------- - subroutine read_data_if_needed(this) - ! - ! !DESCRIPTION: - ! Determine if new data need to be read from the file; if so, read them. - ! - ! We need to read new data if the current time on dyn_file disagrees with the time - ! for which we currently have stored data. - ! - ! !USES: - use dynFileMod , only : dyn_file_type - use dynTimeInfoMod , only : time_info_type - ! - ! !ARGUMENTS: - class(dyn_var_time_uninterp_type), intent(inout) :: this ! this object - ! - ! !LOCAL VARIABLES: - type(dyn_file_type), pointer :: dyn_file ! the dyn_file of this object - integer :: time_index_lower_cur ! current value of time_index_lower on dyn_file - - character(len=*), parameter :: subname = 'read_data_if_needed' - !----------------------------------------------------------------------- - - dyn_file => this%get_dyn_file() - time_index_lower_cur = dyn_file%time_info%get_time_index_lower() - if (time_index_lower_cur /= this%time_index_lower) then - call this%read_variable(time_index_lower_cur, this%data_at_tlower) - this%time_index_lower = time_index_lower_cur - end if - end subroutine read_data_if_needed - - -end module dynVarTimeUninterpMod diff --git a/src/dyn_subgrid/dyncropFileMod.F90 b/src/dyn_subgrid/dyncropFileMod.F90 deleted file mode 100644 index 9921ab5954..0000000000 --- a/src/dyn_subgrid/dyncropFileMod.F90 +++ /dev/null @@ -1,201 +0,0 @@ -module dyncropFileMod - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle reading of the dataset that specifies transient areas the crop landunit as - ! well as the breakdown of each crop. - ! - ! !USES: -#include "shr_assert.h" - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC - use dynFileMod , only : dyn_file_type - use dynVarTimeUninterpMod , only : dyn_var_time_uninterp_type - use clm_varctl , only : iulog - use clm_varcon , only : grlnd, namec - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - save - public :: dyncrop_init ! initialize information read from landuse.timeseries dataset - public :: dyncrop_interp ! get crop data for the current time step, if needed - ! - ! ! PRIVATE TYPES - type(dyn_file_type), target :: dyncrop_file ! information for the file containing transient crop data - type(dyn_var_time_uninterp_type) :: wtcrop ! weight of the crop landunit - type(dyn_var_time_uninterp_type) :: wtcft ! weight of each CFT relative to the crop landunit - type(dyn_var_time_uninterp_type) :: fertcft ! fertilizer of each CFT - - ! Names of variables on file - character(len=*), parameter :: crop_varname = 'PCT_CROP' - character(len=*), parameter :: cft_varname = 'PCT_CFT' - character(len=*), parameter :: fert_varname = 'FERTNITRO_CFT' - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !--------------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine dyncrop_init(bounds, dyncrop_filename) - ! - ! !DESCRIPTION: - ! Initialize dataset containing transient crop info (position it to the right time - ! samples that bound the initial model date) - ! - ! !USES: - use clm_varpar , only : cft_size - use ncdio_pio , only : check_dim - use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! proc-level bounds - character(len=*) , intent(in) :: dyncrop_filename ! name of file containing transient crop information - ! - ! !LOCAL VARIABLES: - integer :: num_points ! number of spatial points - integer :: wtcft_shape(2) ! shape of the wtcft data - integer :: fertcft_shape(2) ! shape of the fertcft data - - character(len=*), parameter :: subname = 'dyncrop_init' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - if (masterproc) then - write(iulog,*) 'Attempting to read crop dynamic landuse data .....' - end if - - ! Get the year from the START of the timestep; this way, we'll update crop areas - ! starting after the year boundary. This is consistent with the timing of glacier - ! updates, and will likely be consistent with the timing of crop updates determined - ! prognostically, if crop areas are ever determined prognostically rather than - ! prescribed ahead of time. - dyncrop_file = dyn_file_type(dyncrop_filename, YEAR_POSITION_START_OF_TIMESTEP) - call check_dim(dyncrop_file, 'cft', cft_size) - - ! read data PCT_CROP and PCT_CFT corresponding to correct year - ! - ! Note: if you want to change transient crops so that they are interpolated, rather - ! than jumping to each year's value on Jan 1 of that year, simply change wtcrop and - ! wtcft to be of type dyn_var_time_interp_type (rather than - ! dyn_var_time_uninterp_type), and change the following constructors to construct - ! variables of dyn_var_time_interp_type. That's all you need to do. - num_points = (bounds%endg - bounds%begg + 1) - wtcrop = dyn_var_time_uninterp_type( & - dyn_file = dyncrop_file, varname=crop_varname, & - dim1name=grlnd, conversion_factor=100._r8, & - do_check_sums_equal_1=.false., data_shape=[num_points]) - wtcft_shape = [num_points, cft_size] - wtcft = dyn_var_time_uninterp_type( & - dyn_file = dyncrop_file, varname=cft_varname, & - dim1name=grlnd, conversion_factor=100._r8, & - do_check_sums_equal_1=.true., data_shape=wtcft_shape) - fertcft_shape = [num_points, cft_size] - fertcft = dyn_var_time_uninterp_type( & - dyn_file = dyncrop_file, varname=fert_varname, & - dim1name=grlnd, conversion_factor=1._r8, & - do_check_sums_equal_1=.false., data_shape=fertcft_shape, & - allow_nodata=.true.) - - end subroutine dyncrop_init - - !----------------------------------------------------------------------- - subroutine dyncrop_interp(bounds,crop_inst) - ! - ! !DESCRIPTION: - ! Get crop cover for model time, when needed. - ! - ! Sets col%wtlunit and lun%wtgcell for crop landunits. - ! - ! Note that crop cover currently jumps to its new value at the start of the year. - ! However, as mentioned above, this behavior can be changed to time interpolation - ! simply by making wtcrop and wtcft dyn_var_time_interp_type variables rather than - ! dyn_var_time_uninterp_type. - ! - ! !USES: - use CropType , only : crop_type - use landunit_varcon , only : istcrop - use clm_varpar , only : cft_lb, cft_ub - use surfrdUtilsMod , only : collapse_crop_types - use subgridWeightsMod , only : set_landunit_weight - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! proc-level bounds - type(crop_type), intent(in) :: crop_inst ! crop instance for updating annual fertilizer - ! - ! !LOCAL VARIABLES: - integer :: m,p,c,l,g ! indices - real(r8), allocatable :: wtcrop_cur(:) ! current weight of the crop landunit - real(r8), allocatable :: wtcft_cur(:,:) ! current cft weights - real(r8), allocatable :: fertcft_cur(:,:) ! current cft fertilizer - logical , allocatable :: col_set(:) ! whether we have set the weight for each column - - character(len=*), parameter :: subname = 'dyncrop_interp' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - call dyncrop_file%time_info%set_current_year() - - ! Set new landunit area - allocate(wtcrop_cur(bounds%begg:bounds%endg)) - call wtcrop%get_current_data(wtcrop_cur) - do g = bounds%begg, bounds%endg - call set_landunit_weight(g, istcrop, wtcrop_cur(g)) - end do - deallocate(wtcrop_cur) - - ! Set new CFT weights - ! - ! Assumes that memory has been allocated for all CFTs on the crop landunit, and that - ! each crop is on its own column. - allocate(wtcft_cur(bounds%begg:bounds%endg, cft_lb:cft_ub)) - call wtcft%get_current_data(wtcft_cur) - - allocate(fertcft_cur(bounds%begg:bounds%endg, cft_lb:cft_ub)) - call fertcft%get_current_data(fertcft_cur) - - call collapse_crop_types(wtcft_cur, fertcft_cur, bounds%begg, bounds%endg, verbose = .false.) - - allocate(col_set(bounds%begc:bounds%endc)) - col_set(:) = .false. - - do p = bounds%begp, bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - c = patch%column(p) - - if (lun%itype(l) == istcrop) then - m = patch%itype(p) - - ! The following assumes there is a single CFT on each crop column. The - ! error-check with col_set helps ensure this is the case. - - if (col_set(c)) then - write(iulog,*) subname//' ERROR: attempt to set a column that has already been set.' - write(iulog,*) 'This may happen if there are multiple crops on a single column.' - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - - col%wtlunit(c) = wtcft_cur(g,m) - crop_inst%fertnitro_patch(p) = fertcft_cur(g,m) - col_set(c) = .true. - end if - end do - - deallocate(wtcft_cur) - deallocate(fertcft_cur) - deallocate(col_set) - - end subroutine dyncrop_interp - -end module dyncropFileMod diff --git a/src/dyn_subgrid/dynpftFileMod.F90 b/src/dyn_subgrid/dynpftFileMod.F90 deleted file mode 100644 index 9280d70157..0000000000 --- a/src/dyn_subgrid/dynpftFileMod.F90 +++ /dev/null @@ -1,295 +0,0 @@ -module dynpftFileMod - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle reading of the pftdyn dataset, which specifies transient areas of natural Patches - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC - use dynFileMod , only : dyn_file_type - use dynVarTimeUninterpMod , only : dyn_var_time_uninterp_type - use clm_varctl , only : iulog - use abortutils , only : endrun - use spmdMod , only : masterproc, mpicom - use clm_varcon , only : grlnd, nameg - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - private - save - public :: dynpft_init ! initialize information read from pftdyn dataset - public :: dynpft_interp ! interpolate pftdyn information to current time step - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: dynpft_check_consistency ! check consistency with surface dataset - private :: dynpft_read_consistency_nl ! read namelist associated with consistency checks - ! - ! ! PRIVATE TYPES - type(dyn_file_type), target :: dynpft_file ! information for the pftdyn file - type(dyn_var_time_uninterp_type) :: wtpatch ! weight of each patch relative to the natural veg landunit - - character(len=*), parameter :: varname = 'PCT_NAT_PFT' ! name of variable on file - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !--------------------------------------------------------------------------- - -contains - - - !----------------------------------------------------------------------- - subroutine dynpft_init(bounds, dynpft_filename) - ! - ! !DESCRIPTION: - ! Initialize dynamic pft dataset (position it to the right time samples - ! that bound the initial model date) - ! - ! !USES: - use clm_varpar , only : numpft, maxpatch_pft, natpft_size - use ncdio_pio - use dynTimeInfoMod , only : YEAR_POSITION_START_OF_TIMESTEP - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! proc-level bounds - character(len=*) , intent(in) :: dynpft_filename ! name of file containing transient pft information - ! - ! !LOCAL VARIABLES: - integer :: wtpatch_shape(2) ! shape of the wtpatch data - - character(len= 32) :: subname='dynpft_init'! subroutine name - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - ! Error check - - if ( maxpatch_pft /= numpft+1 )then - call endrun(msg=' maxpatch_pft does NOT equal numpft+1 -- this is invalid for dynamic PFT case'//& - errMsg(sourcefile, __LINE__) ) - end if - - if (masterproc) then - write(iulog,*) 'Attempting to read pft dynamic landuse data .....' - end if - - ! Get the year from the START of the timestep; this way, we'll update PFT areas - ! starting after the year boundary. This is consistent with the timing of other area - ! updates. - dynpft_file = dyn_file_type(dynpft_filename, YEAR_POSITION_START_OF_TIMESTEP) - - ! Consistency checks - call check_dim(dynpft_file, 'natpft', natpft_size) - call dynpft_check_consistency(bounds) - - ! read data PCT_NAT_PFT corresponding to correct year - ! - ! Note: if you want to change PCT_NAT_PFT so that it is interpolated, rather than - ! jumping to each year's value on Jan 1 of that year, simply change wtpatch to be of type - ! dyn_var_time_interp_type (rather than dyn_var_time_uninterp_type), and change the - ! following constructor to construct a variable of dyn_var_time_interp_type. That's - ! all you need to do. - - wtpatch_shape = [(bounds%endg-bounds%begg+1), natpft_size] - wtpatch = dyn_var_time_uninterp_type( & - dyn_file=dynpft_file, varname=varname, & - dim1name=grlnd, conversion_factor=100._r8, & - do_check_sums_equal_1=.true., data_shape=wtpatch_shape) - - end subroutine dynpft_init - - !----------------------------------------------------------------------- - subroutine dynpft_check_consistency(bounds) - ! - ! !DESCRIPTION: - ! Check consistency between dynpft file and surface dataset. - ! - ! This is done by assuming that PCT_NAT_PFT at time 1 in the pftdyn file agrees with - ! PCT_NAT_PFT on the surface dataset. - ! - ! !USES: - use clm_instur, only : wt_nat_patch - use clm_varpar, only : natpft_size - use ncdio_pio - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! proc-level bounds - ! - ! !LOCAL VARIABLES: - logical :: check_dynpft_consistency ! whether to do the consistency check in this routine - integer :: g ! index - real(r8), pointer :: wtpatch_time1(:,:) ! weight of each pft in each grid cell at first time - logical :: readvar ! whether variable was read - real(r8), parameter :: tol = 1.e-6_r8 ! tolerance for checking equality - - character(len=*), parameter :: subname = 'dynpft_check_consistency' - !----------------------------------------------------------------------- - - call dynpft_read_consistency_nl(check_dynpft_consistency) - - if (check_dynpft_consistency) then - - ! Read first time slice of PCT_NAT_PFT - - allocate(wtpatch_time1(bounds%begg:bounds%endg, natpft_size)) - call ncd_io(ncid=dynpft_file, varname=varname, flag='read', data=wtpatch_time1, & - dim1name=grlnd, nt=1, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: ' // trim(varname) // ' NOT on landuse_timeseries file'//& - errMsg(sourcefile, __LINE__)) - end if - - ! Convert from PCT to weight on grid cell - wtpatch_time1(bounds%begg:bounds%endg,:) = wtpatch_time1(bounds%begg:bounds%endg,:) / 100._r8 - - ! Compare with values read from surface dataset - do g = bounds%begg, bounds%endg - if (any(abs(wtpatch_time1(g,:) - wt_nat_patch(g,:)) > tol)) then - write(iulog,*) subname//' mismatch between PCT_NAT_PFT at initial time and that obtained from surface dataset' - write(iulog,*) 'On landuse_timeseries file: ', wtpatch_time1(g,:) - write(iulog,*) 'On surface dataset: ', wt_nat_patch(g,:) - write(iulog,*) ' ' - write(iulog,*) 'Confirm that the year of your surface dataset' - write(iulog,*) 'corresponds to the first year of your landuse_timeseries file' - write(iulog,*) '(e.g., for a landuse_timeseries file starting at year 1850, which is typical,' - write(iulog,*) 'you should be using an 1850 surface dataset),' - write(iulog,*) 'and that your landuse_timeseries file is compatible with the surface dataset.' - write(iulog,*) ' ' - write(iulog,*) 'If you are confident that you are using the correct landuse_timeseries file' - write(iulog,*) 'and the correct surface dataset, then you can bypass this check by setting:' - write(iulog,*) ' check_dynpft_consistency = .false.' - write(iulog,*) 'in user_nl_clm' - write(iulog,*) ' ' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - deallocate(wtpatch_time1) - - end if - - end subroutine dynpft_check_consistency - - !----------------------------------------------------------------------- - subroutine dynpft_read_consistency_nl(check_dynpft_consistency) - ! - ! !DESCRIPTION: - ! Read namelist settings related to pftdyn consistency checks - ! - ! !USES: - use fileutils , only : getavu, relavu - use clm_nlUtilsMod , only : find_nlgroup_name - use controlMod , only : NLFilename - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - logical, intent(out) :: check_dynpft_consistency ! whether to do the consistency check - ! - ! !LOCAL VARIABLES: - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - - character(len=*), parameter :: subname = 'dynpft_read_consistency_nl' - !----------------------------------------------------------------------- - - namelist /dynpft_consistency_checks/ & - check_dynpft_consistency - - ! Set default namelist values - check_dynpft_consistency = .true. - - ! Read namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'dynpft_consistency_checks', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=dynpft_consistency_checks,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading dynpft_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding dynpft_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast (check_dynpft_consistency, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'dynpft_consistency_checks settings:' - write(iulog,nml=dynpft_consistency_checks) - write(iulog,*) ' ' - end if - - end subroutine dynpft_read_consistency_nl - - - - !----------------------------------------------------------------------- - subroutine dynpft_interp(bounds) - ! - ! !DESCRIPTION: - ! Get pft weights for current model time - ! - ! Sets pft%wtcol - ! - ! Note that PFT weights currently jump to their new value at the start of the year. - ! However, as mentioned above, this behavior can be changed to time interpolation - ! simply by making wtpatch a dyn_var_time_interp_type variable rather than - ! dyn_var_time_uninterp_type. - ! - ! !USES: - use landunit_varcon , only : istsoil - use clm_varpar , only : natpft_lb, natpft_ub - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! proc-level bounds - ! - ! !LOCAL VARIABLES: - integer :: m,p,l,g ! indices - real(r8), allocatable :: wtpatch_cur(:,:) ! current pft weights - character(len=32) :: subname='dynpft_interp' ! subroutine name - !----------------------------------------------------------------------- - - ! assumes that maxpatch_pft = numpft + 1, that each landunit has only 1 column, - ! and SCAM and CNDV have not been defined - ! - ! NOTE(wjs, 2014-12-10) I'm not sure if there is still the requirement that SCAM - ! hasn't been defined - - SHR_ASSERT_ALL(bounds%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - ! Get pft weights for this time step - - call dynpft_file%time_info%set_current_year() - - allocate(wtpatch_cur(bounds%begg:bounds%endg, natpft_lb:natpft_ub)) - call wtpatch%get_current_data(wtpatch_cur) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - - if (lun%itype(l) == istsoil) then - m = patch%itype(p) - - ! Note that the following assignment assumes that all Patches share a single column - patch%wtcol(p) = wtpatch_cur(g,m) - end if - - end do - - deallocate(wtpatch_cur) - - end subroutine dynpft_interp - -end module dynpftFileMod diff --git a/src/dyn_subgrid/test/CMakeLists.txt b/src/dyn_subgrid/test/CMakeLists.txt deleted file mode 100644 index 2cb9be01bf..0000000000 --- a/src/dyn_subgrid/test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_subdirectory(dynColumnTemplate_test) -add_subdirectory(dynColumnStateUpdater_test) -add_subdirectory(dynPatchStateUpdater_test) -add_subdirectory(dynInitColumns_test) -add_subdirectory(dynLandunitArea_test) -add_subdirectory(dynVar_test) -add_subdirectory(dynTimeInfo_test) diff --git a/src/dyn_subgrid/test/dynColumnStateUpdater_test/CMakeLists.txt b/src/dyn_subgrid/test/dynColumnStateUpdater_test/CMakeLists.txt deleted file mode 100644 index 8384506601..0000000000 --- a/src/dyn_subgrid/test/dynColumnStateUpdater_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(ColumnStateUpdater test_ColumnStateUpdater_exe - "test_column_state_updater.pf" "") - -target_link_libraries(test_ColumnStateUpdater_exe clm csm_share) \ No newline at end of file diff --git a/src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf b/src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf deleted file mode 100644 index a9c456ab04..0000000000 --- a/src/dyn_subgrid/test/dynColumnStateUpdater_test/test_column_state_updater.pf +++ /dev/null @@ -1,1213 +0,0 @@ -module test_column_state_updater - - ! Tests of dynColumnStateUpdaterMod - - use pfunit_mod - use dynColumnStateUpdaterMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use landunit_varcon, only : istsoil, max_lunit - use pftconMod, only : noveg - use ColumnType - use LandunitType - use subgridWeightsMod, only : compute_higher_order_weights - - implicit none - - @TestCase - type, extends(TestCase) :: TestColumnStateUpdater - ! The following arrays have lower bound 1, rather than bounds%begc - real(r8), allocatable :: cwtgcell_old(:) - real(r8), allocatable :: cwtgcell_new(:) - real(r8), allocatable :: cwtgcell_new_minus_old(:) - contains - procedure :: setUp - procedure :: tearDown - procedure :: setup_gridcell_with_four_vegetated_columns - procedure :: setup_gridcell_with_two_vegetated_columns_and_special - procedure :: setup_three_gridcells_with_two_columns_each - procedure :: setup_grid_end ! do stuff at the end of setting up the grid - procedure :: set_new_cwtlunit - procedure :: set_new_lwtgcell - procedure :: set_new_weights_end ! do stuff at the end of setting new weights - procedure :: do_all_setup_with_four_vegetated_columns - procedure :: do_all_setup_with_two_vegetated_columns_and_special - procedure :: do_all_setup_two_veg_and_special_specialShrinks - procedure :: do_all_setup_two_veg_and_special_specialGrows - procedure :: assertConservation - end type TestColumnStateUpdater - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Helper routines - ! ======================================================================== - - subroutine setUp(this) - class(TestColumnStateUpdater), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestColumnStateUpdater), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine setup_gridcell_with_four_vegetated_columns(this, cwtlunit) - ! Sets up a grid with one gridcell, with a single vegetated landunit, with four - ! vegetated columns (each with one patch) - class(TestColumnStateUpdater), intent(inout) :: this - real(r8), intent(in) :: cwtlunit(:) ! weight of each column on the landunit (must be size 4) - - @assertEqual(4, size(cwtlunit)) - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit(1)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit(2)) - call unittest_add_patch(my_ci=ci, ptype=2, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit(3)) - call unittest_add_patch(my_ci=ci, ptype=3, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit(4)) - call unittest_add_patch(my_ci=ci, ptype=4, wtcol=1.0_r8) - call unittest_subgrid_setup_end() - - call this%setup_grid_end() - end subroutine setup_gridcell_with_four_vegetated_columns - - subroutine setup_gridcell_with_two_vegetated_columns_and_special(this, & - lwtgcell, cwtlunit_veg, special_type) - ! Sets up a grid with one gridcell, with (1) a vegetated landunit with two columns, - ! and (2) a special landunit with one column. (Each column has one patch) - class(TestColumnStateUpdater), intent(inout) :: this - - ! weight of each landunit on the gridcell; must be size 2 - ! index 1: natural veg; index 2: special - real(r8), intent(in) :: lwtgcell(:) - - ! weight of each column on the natural veg landunit; must be size 2 - real(r8), intent(in) :: cwtlunit_veg(:) - - ! landunit type of the special landunit - integer, intent(out) :: special_type - - @assertEqual(2, size(lwtgcell)) - @assertEqual(sum(lwtgcell), 1.0_r8, tolerance=tol) - @assertEqual(2, size(cwtlunit_veg)) - @assertEqual(sum(cwtlunit_veg), 1.0_r8, tolerance=tol) - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=lwtgcell(1)) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_veg(1)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_veg(2)) - call unittest_add_patch(my_ci=ci, ptype=2, wtcol=1.0_r8) - - special_type = get_ltype_special() - call unittest_add_landunit(my_gi=gi, ltype=special_type, wtgcell=lwtgcell(2)) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1.0_r8) - call unittest_add_patch(my_ci=ci, ptype=noveg, wtcol=1.0_r8) - - call unittest_subgrid_setup_end() - - call this%setup_grid_end() - end subroutine setup_gridcell_with_two_vegetated_columns_and_special - - subroutine setup_three_gridcells_with_two_columns_each(this, & - cwtlunit_grc1, cwtlunit_grc2, cwtlunit_grc3) - ! Sets up a grid with three grid cells, each with a single vegetated landunit with two - ! vegetated columns (each with one patch) - class(TestColumnStateUpdater), intent(inout) :: this - ! weight of each column on the vegetated landunit, in each grid cell (each must be size 2) - real(r8), intent(in) :: cwtlunit_grc1(:) - real(r8), intent(in) :: cwtlunit_grc2(:) - real(r8), intent(in) :: cwtlunit_grc3(:) - - @assertEqual(2, size(cwtlunit_grc1)) - @assertEqual(2, size(cwtlunit_grc2)) - - call unittest_subgrid_setup_start() - - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_grc1(1)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_grc1(2)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_grc2(1)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_grc2(2)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_grc3(1)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=cwtlunit_grc3(2)) - call unittest_add_patch(my_ci=ci, ptype=1, wtcol=1.0_r8) - - call unittest_subgrid_setup_end() - - call this%setup_grid_end() - end subroutine setup_three_gridcells_with_two_columns_each - - subroutine setup_grid_end(this) - ! Does necessary stuff at the end of setting up the subgrid structure - class(TestColumnStateUpdater), intent(inout) :: this - - this%cwtgcell_old = col%wtgcell(bounds%begc:bounds%endc) - end subroutine setup_grid_end - - subroutine set_new_cwtlunit(this, cwtlunit) - ! Sets new subgrid weights based on new cwtlunit values - class(TestColumnStateUpdater), intent(inout) :: this - real(r8), intent(in) :: cwtlunit(bounds%begc:) ! weight of each column on the landunit - - integer :: c - - @assertEqual(bounds%endc, ubound(cwtlunit, 1)) - - do c = bounds%begc, bounds%endc - col%wtlunit(c) = cwtlunit(c) - end do - - call this%set_new_weights_end() - end subroutine set_new_cwtlunit - - subroutine set_new_lwtgcell(this, lwtgcell) - ! Sets new subgrid weights based on new lwtgcell values - class(TestColumnStateUpdater), intent(inout) :: this - real(r8), intent(in) :: lwtgcell(bounds%begl:) ! weight of each landunit on the gridcell - - integer :: l - - @assertEqual(bounds%endl, ubound(lwtgcell, 1)) - - do l = bounds%begl, bounds%endl - lun%wtgcell(l) = lwtgcell(l) - end do - - call this%set_new_weights_end() - end subroutine set_new_lwtgcell - - subroutine set_new_weights_end(this) - ! Does necessary stuff at the end of setting new subgrid weights - class(TestColumnStateUpdater), intent(inout) :: this - - call compute_higher_order_weights(bounds) - this%cwtgcell_new = col%wtgcell(bounds%begc:bounds%endc) - this%cwtgcell_new_minus_old = this%cwtgcell_new - this%cwtgcell_old - end subroutine set_new_weights_end - - subroutine do_all_setup_with_two_vegetated_columns_and_special( & - this, cs_updater, lwtgcell_old, lwtgcell_new, cwtlunit_veg, special_type) - ! Does all setup needed when setting up one grid cell with two vegetated columns and - ! a special landunit - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type), intent(out) :: cs_updater - real(r8), intent(in) :: lwtgcell_old(:) - real(r8), intent(in) :: lwtgcell_new(:) - real(r8), intent(in) :: cwtlunit_veg(:) ! assumed not to change - - integer, intent(out), optional :: special_type ! type of the special landunit - - integer :: l_special_type - - call this%setup_gridcell_with_two_vegetated_columns_and_special( & - lwtgcell = lwtgcell_old, & - cwtlunit_veg = cwtlunit_veg, & - special_type = l_special_type) - if (present(special_type)) then - special_type = l_special_type - end if - cs_updater = column_state_updater_type(bounds, nclumps=1) - call cs_updater%set_old_weights(bounds) - - call this%set_new_lwtgcell(lwtgcell = lwtgcell_new) - call cs_updater%set_new_weights(bounds, clump_index=1) - end subroutine do_all_setup_with_two_vegetated_columns_and_special - - subroutine do_all_setup_two_veg_and_special_specialShrinks( & - this, cs_updater, special_type) - ! Does all setup needed when setting up one grid cell with two vegetated columns and - ! a special landunit, with the special landunit shrinking, and the vegetated landunit - ! growing (with the two vegetated columns growing in equal proportion). - ! - ! There are three columns: the first two are vegetated, the last is special. - ! - ! This hard-codes the old and new weights for convenience. Relevant weights can be - ! accessed via the class's cwtgcell_old and cwtgcell_new variables. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type), intent(out) :: cs_updater - integer, intent(out), optional :: special_type ! type of the special landunit - - ! weight of veg & special landunits - real(r8), parameter :: lwtgcell_old(2) = [0.4_r8, 0.6_r8] - real(r8), parameter :: lwtgcell_new(2) = [0.7_r8, 0.3_r8] - - ! weight of each veg column (constant in time) - real(r8), parameter :: cwtlunit_veg(2) = [0.2_r8, 0.8_r8] - - call this%do_all_setup_with_two_vegetated_columns_and_special( & - cs_updater, & - lwtgcell_old = lwtgcell_old, & - lwtgcell_new = lwtgcell_new, & - cwtlunit_veg = cwtlunit_veg, & - special_type = special_type) - end subroutine do_all_setup_two_veg_and_special_specialShrinks - - subroutine do_all_setup_two_veg_and_special_specialGrows( & - this, cs_updater, special_type) - ! Does all setup needed when setting up one grid cell with two vegetated columns and - ! a special landunit, with the special landunit growing, and the vegetated landunit - ! shrinking (with the two vegetated columns shrinking in equal proportion). - ! - ! There are three columns: the first two are vegetated, the last is special. - ! - ! This hard-codes the old and new weights for convenience. Relevant weights can be - ! accessed via the class's cwtgcell_old and cwtgcell_new variables. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type), intent(out) :: cs_updater - integer, intent(out), optional :: special_type ! type of the special landunit - - ! weight of veg & special landunits - real(r8), parameter :: lwtgcell_old(2) = [0.4_r8, 0.6_r8] - real(r8), parameter :: lwtgcell_new(2) = [0.1_r8, 0.9_r8] - - ! weight of each veg column (constant in time) - real(r8), parameter :: cwtlunit_veg(2) = [0.2_r8, 0.8_r8] - - call this%do_all_setup_with_two_vegetated_columns_and_special( & - cs_updater, & - lwtgcell_old = lwtgcell_old, & - lwtgcell_new = lwtgcell_new, & - cwtlunit_veg = cwtlunit_veg, & - special_type = special_type) - end subroutine do_all_setup_two_veg_and_special_specialGrows - - subroutine do_all_setup_with_four_vegetated_columns( & - this, cs_updater, cwtlunit_old, cwtlunit_new) - ! Does all setup needed when setting up one grid cell with four vegetated columns - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type), intent(out) :: cs_updater - real(r8), intent(in) :: cwtlunit_old(:) - real(r8), intent(in) :: cwtlunit_new(:) - - call this%setup_gridcell_with_four_vegetated_columns(cwtlunit_old) - cs_updater = column_state_updater_type(bounds, nclumps=1) - call cs_updater%set_old_weights(bounds) - - call this%set_new_cwtlunit(cwtlunit_new) - call cs_updater%set_new_weights(bounds, clump_index=1) - end subroutine do_all_setup_with_four_vegetated_columns - - - subroutine assertConservation(this, var_old, var_new, msg, & - begc, endc, non_conserved_mass) - ! Asserts that the transformation for a given grid cell was conservative - class(TestColumnStateUpdater), intent(in) :: this - real(r8), intent(in) :: var_old(:) - real(r8), intent(in) :: var_new(:) - character(len=*), intent(in) :: msg - - ! Provide these optional arguments if you just want to check a subset of columns. - ! - ! This is useful if there are multiple grid cells: in this case, provide the begc & - ! endc of the grid cell of interest. - ! - ! This is also useful if the conservation check should exclude certain columns (e.g., - ! if special columns should be excluded from the conservation check). - ! - ! These assume 1-indexing - i.e., the index of the first column is 1 - integer, intent(in), optional :: begc - integer, intent(in), optional :: endc - - ! Non-conserved mass in this grid cell: we make sure that conservation occurs once - ! you account for this known non-conserved mass - real(r8), intent(in), optional :: non_conserved_mass - - character(len=:), allocatable :: full_msg - integer :: my_begc, my_endc - real(r8) :: sum_old, sum_new - - if (present(begc)) then - my_begc = begc - else - my_begc = 1 - end if - - if (present(endc)) then - my_endc = endc - else - my_endc = bounds%endc - bounds%begc + 1 - end if - - full_msg = trim(msg)//': conservation' - - sum_old = sum(this%cwtgcell_old(my_begc:my_endc) * var_old(my_begc:my_endc)) - sum_new = sum(this%cwtgcell_new(my_begc:my_endc) * var_new(my_begc:my_endc)) - if (present(non_conserved_mass)) then - sum_new = sum_new + non_conserved_mass - end if - @assertEqual(sum_old, sum_new, tolerance=tol, message=full_msg) - end subroutine assertConservation - - ! ======================================================================== - ! Begin actual unit tests - ! ======================================================================== - - @Test - subroutine noSpecialHandling_noAreaChange(this) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8) :: myvar(4) - real(r8) :: expected(4) - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8], & - cwtlunit_new = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8]) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - expected = myvar - - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar) - - @assertEqual(expected, myvar) - end subroutine noSpecialHandling_noAreaChange - - @Test - subroutine noSpecialHandling_oneShrinksOneGrows(this) - ! This tests one column shrinking, one growing, and two staying the same in area - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.05_r8, 0.2_r8, 0.35_r8, 0.4_r8] - real(r8) :: myvar(4), myvar_orig(4), expected(4) - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - myvar_orig = myvar - expected = myvar - expected(3) = (cwtlunit_old(3)*myvar(3) + this%cwtgcell_new_minus_old(3)*myvar(1)) / & - cwtlunit_new(3) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar) - - ! Verify - ! First make sure that the transformation is conservative; note that this looks at the - ! expected values, rather than the actual result, so this is mainly about making sure - ! that we set things up correctly - but it also confirms that the routine conserves - ! mass as long as the actual result matches the expected result - call this%assertConservation(myvar_orig, expected, 'noSpecialHandling_oneShrinksOneGrows') - ! Now make sure that we got the right answer - @assertEqual(expected, myvar, tolerance=tol) - end subroutine noSpecialHandling_oneShrinksOneGrows - - @Test - subroutine noSpecialHandling_twoShrinkTwoGrow(this) - ! This tests one column shrinking to 0 area, one shrinking to non-zero area, one - ! growing from 0 area, and one growing from non-zero area - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0._r8, 0.7_r8] - real(r8), parameter :: cwtlunit_new(4) = [0._r8 , 0.15_r8, 0.08_r8, 0.77_r8] - real(r8), parameter :: new_minus_old(4) = cwtlunit_new - cwtlunit_old - real(r8) :: mass_gain_per_unit_area - real(r8) :: myvar(4), myvar_orig(4), expected(4) - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - myvar_orig = myvar - expected(1:2) = myvar(1:2) - mass_gain_per_unit_area = (new_minus_old(1) * myvar(1) + new_minus_old(2) * myvar(2)) / & - (new_minus_old(1) + new_minus_old(2)) - expected(3) = mass_gain_per_unit_area - expected(4) = (cwtlunit_old(4)*myvar(4) + new_minus_old(4)*mass_gain_per_unit_area) / & - cwtlunit_new(4) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar) - - ! Verify - ! First make sure that the transformation is conservative; note that this looks at the - ! expected values, rather than the actual result, so this is mainly about making sure - ! that we set things up correctly - but it also confirms that the routine conserves - ! mass as long as the actual result matches the expected result - call this%assertConservation(myvar_orig, expected, 'noSpecialHandling_twoShrinkTwoGrow') - ! Now make sure that we got the right answer - @assertEqual(expected, myvar, tolerance=tol) - end subroutine noSpecialHandling_twoShrinkTwoGrow - - @Test - subroutine noSpecialHandling_multipleGridCells(this) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - ! Grid cell 1: c1 shrinks, c2 grows - real(r8), parameter :: cwtlunit_grc1_old(2) = [0.4_r8, 0.6_r8] - real(r8), parameter :: cwtlunit_grc1_new(2) = [0.35_r8, 0.65_r8] - ! Grid cell 2: constant areas - real(r8), parameter :: cwtlunit_grc2_old(2) = [0.3_r8, 0.7_r8] - real(r8), parameter :: cwtlunit_grc2_new(2) = cwtlunit_grc2_old - ! Grid cell 3: c1 grows, c2 shrinks - real(r8), parameter :: cwtlunit_grc3_old(2) = [0.2_r8, 0.8_r8] - real(r8), parameter :: cwtlunit_grc3_new(2) = [0.9_r8, 0.1_r8] - - real(r8) :: g1_weight_change, g3_weight_change - real(r8) :: myvar(6), myvar_orig(6), expected(6) - - ! Setup - - call this%setup_three_gridcells_with_two_columns_each( & - cwtlunit_grc1_old, cwtlunit_grc2_old, cwtlunit_grc3_old) - cs_updater = column_state_updater_type(bounds, nclumps=1) - call cs_updater%set_old_weights(bounds) - - call this%set_new_cwtlunit(cwtlunit = & - [cwtlunit_grc1_new, cwtlunit_grc2_new, cwtlunit_grc3_new]) - call cs_updater%set_new_weights(bounds, clump_index=1) - - myvar = [1._r8, 2._r8, 3._r8, 4._r8, 5._r8, 6._r8] - myvar_orig = myvar - expected = myvar - - ! c2 in grid cell 1: - g1_weight_change = cwtlunit_grc1_new(2) - cwtlunit_grc1_old(2) - expected(2) = (cwtlunit_grc1_old(2)*myvar(2) + g1_weight_change*myvar(1)) / & - (cwtlunit_grc1_old(2) + g1_weight_change) - - ! c1 in grid cell 3: - g3_weight_change = cwtlunit_grc3_new(1) - cwtlunit_grc3_old(1) - expected(5) = (cwtlunit_grc3_old(1)*myvar(5) + g3_weight_change*myvar(6)) / & - (cwtlunit_grc3_old(1) + g3_weight_change) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar) - - ! Verify - ! First make sure that the transformation is conservative; note that this looks at the - ! expected values, rather than the actual result, so this is mainly about making sure - ! that we set things up correctly - but it also confirms that the routine conserves - ! mass as long as the actual result matches the expected result - call this%assertConservation(myvar_orig, expected, & - 'noSpecialHandling_multipleGridCells: grc1', begc=1, endc=2) - call this%assertConservation(myvar_orig, expected, & - 'noSpecialHandling_multipleGridCells: grc2', begc=3, endc=4) - call this%assertConservation(myvar_orig, expected, & - 'noSpecialHandling_multipleGridCells: grc3', begc=5, endc=6) - ! Now make sure that we got the right answer - @assertEqual(expected, myvar, tolerance=tol) - end subroutine noSpecialHandling_multipleGridCells - - @Test - subroutine fillSpecialUsingNatveg_specialShrinks(this) - ! This tests a special column shrinking when using the routine that fills special - ! points using natural veg as a template. In order to test that the template is - ! applied correctly, we use two natural veg columns. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - - real(r8) :: input_from_glacier - real(r8) :: myvar(3), myvar_orig(3), expected_var(3) - real(r8) :: expected_non_conserved_mass - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialShrinks(cs_updater) - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - expected_var(3) = myvar(3) - ! glacier uses column 1 as a template: - input_from_glacier = myvar(1) - ! column 1 doesn't change because the glacier input is the same as what's already there: - expected_var(1) = myvar(1) - expected_var(2) = (this%cwtgcell_old(2)*myvar(2) + & - this%cwtgcell_new_minus_old(2)*input_from_glacier) / & - this%cwtgcell_new(2) - expected_non_conserved_mass = this%cwtgcell_new_minus_old(3) * input_from_glacier - - ! Exercise - call cs_updater%update_column_state_fill_special_using_natveg(bounds, clump_index=1, var=myvar, & - non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - @assertEqual(expected_var, myvar, tolerance=tol) - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - call this%assertConservation(myvar_orig, myvar, & - 'fillSpecialUsingNatveg_specialShrinks', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine fillSpecialUsingNatveg_specialShrinks - - @Test - subroutine fillSpecialUsingNatveg_specialGrows(this) - ! This tests a special column growing when using the routine that fills special - ! points using natural veg as a template. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - - real(r8) :: myvar(3), myvar_orig(3), expected_var(3) - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - real(r8) :: expected_non_conserved_mass - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialGrows(cs_updater) - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - ! the growing special point should not accept any mass, so should keep its original - ! value - expected_var = myvar - expected_non_conserved_mass = -1._r8 * & - (myvar(1) * this%cwtgcell_new_minus_old(1) + & - myvar(2) * this%cwtgcell_new_minus_old(2)) - - ! Exercise - call cs_updater%update_column_state_fill_special_using_natveg(bounds, clump_index=1, var=myvar, & - non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - @assertEqual(expected_var, myvar, tolerance=tol) - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - call this%assertConservation(myvar_orig, myvar, & - 'fillSpecialUsingNatveg_specialGrows', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine fillSpecialUsingNatveg_specialGrows - - @Test - subroutine fillSpecialUsingNatveg_nonSpecial(this) - ! This tests non-special columns growing and shrinking when using the routine that - ! fills special points using natural veg as a template. This makes sure that - ! non-special columns are treated normally by this routine. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.05_r8, 0.2_r8, 0.35_r8, 0.4_r8] - real(r8) :: myvar(4), myvar_orig(4), expected(4) - real(r8), parameter :: non_conserved_mass_orig = 2._r8 - real(r8) :: non_conserved_mass_grc(1) = non_conserved_mass_orig - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - myvar_orig = myvar - expected = myvar - expected(3) = (cwtlunit_old(3)*myvar(3) + this%cwtgcell_new_minus_old(3)*myvar(1)) / & - cwtlunit_new(3) - - ! Exercise - call cs_updater%update_column_state_fill_special_using_natveg(bounds, clump_index=1, var=myvar, & - non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - ! First make sure that the transformation is conservative; note that this looks at the - ! expected values, rather than the actual result, so this is mainly about making sure - ! that we set things up correctly - but it also confirms that the routine conserves - ! mass as long as the actual result matches the expected result - call this%assertConservation(myvar_orig, expected, 'fillSpecialUsingNatveg_nonSpecial') - ! Now make sure that we got the right answer - @assertEqual(expected, myvar, tolerance=tol) - @assertEqual(non_conserved_mass_orig, non_conserved_mass_grc(1)) - end subroutine fillSpecialUsingNatveg_nonSpecial - - @Test - subroutine fillUsingFixedValues_specialShrinks(this) - ! This tests a specially-handled column shrinking when using the routine that fills - ! points using fixed values - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - - integer :: special_type ! landunit type of the special type - real(r8), parameter :: input_from_special = 14._r8 - real(r8) :: landunit_values(max_lunit) - real(r8) :: myvar(3), myvar_orig(3), expected_var(3) - real(r8) :: expected_non_conserved_mass - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - integer :: i - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialShrinks( & - cs_updater, & - special_type = special_type) - - landunit_values(:) = FILLVAL_USE_EXISTING_VALUE - landunit_values(special_type) = input_from_special - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - expected_var(3) = myvar(3) - do i = 1, 2 - expected_var(i) = (this%cwtgcell_old(i)*myvar(i) + & - this%cwtgcell_new_minus_old(i)*input_from_special) / & - this%cwtgcell_new(i) - end do - expected_non_conserved_mass = this%cwtgcell_new_minus_old(3) * input_from_special - - ! Exercise - call cs_updater%update_column_state_fill_using_fixed_values(bounds, clump_index=1, var=myvar, & - landunit_values=landunit_values, non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - @assertEqual(expected_var, myvar, tolerance=tol) - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - call this%assertConservation(myvar_orig, myvar, & - 'fillUsingFixedValues_specialShrinks', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine fillUsingFixedValues_specialShrinks - - @Test - subroutine fillUsingFixedValues_specialGrows(this) - ! This tests a specially-handled column growing when using the routine that fills - ! points using fixed values - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - - integer :: special_type ! landunit type of the special type - real(r8), parameter :: input_from_special = 14._r8 ! irrelevant - real(r8) :: landunit_values(max_lunit) - real(r8) :: myvar(3), myvar_orig(3), expected_var(3) - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - real(r8) :: expected_non_conserved_mass - integer :: i - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialGrows( & - cs_updater, & - special_type = special_type) - - landunit_values(:) = FILLVAL_USE_EXISTING_VALUE - landunit_values(special_type) = input_from_special - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - ! the growing special point should not accept any mass, so should keep its original - ! value - expected_var = myvar - expected_non_conserved_mass = -1._r8 * & - (myvar(1) * this%cwtgcell_new_minus_old(1) + & - myvar(2) * this%cwtgcell_new_minus_old(2)) - - ! Exercise - call cs_updater%update_column_state_fill_using_fixed_values(bounds, clump_index=1, var=myvar, & - landunit_values=landunit_values, non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - @assertEqual(expected_var, myvar, tolerance=tol) - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - call this%assertConservation(myvar_orig, myvar, & - 'fillUsingFixedValues_specialGrows', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine fillUsingFixedValues_specialGrows - - @Test - subroutine fillUsingFixedValues_nonSpecial(this) - ! This tests non-special columns growing and shrinking when using the routine that - ! fills special points using fixed values. This makes sure that non-special columns - ! are treated normally by this routine. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.05_r8, 0.2_r8, 0.35_r8, 0.4_r8] - real(r8) :: landunit_values(max_lunit) - real(r8) :: myvar(4), myvar_orig(4), expected(4) - real(r8), parameter :: non_conserved_mass_orig = 2._r8 - real(r8) :: non_conserved_mass_grc(1) = non_conserved_mass_orig - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - landunit_values(:) = FILLVAL_USE_EXISTING_VALUE - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - myvar_orig = myvar - expected = myvar - expected(3) = (cwtlunit_old(3)*myvar(3) + this%cwtgcell_new_minus_old(3)*myvar(1)) / & - cwtlunit_new(3) - - ! Exercise - call cs_updater%update_column_state_fill_using_fixed_values(bounds, clump_index=1, var=myvar, & - landunit_values=landunit_values, non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - ! First make sure that the transformation is conservative; note that this looks at the - ! expected values, rather than the actual result, so this is mainly about making sure - ! that we set things up correctly - but it also confirms that the routine conserves - ! mass as long as the actual result matches the expected result - call this%assertConservation(myvar_orig, expected, 'fillUsingFixedValues_nonSpecial') - ! Now make sure that we got the right answer - @assertEqual(expected, myvar, tolerance=tol) - @assertEqual(non_conserved_mass_orig, non_conserved_mass_grc(1)) - end subroutine fillUsingFixedValues_nonSpecial - - @Test - subroutine fillSpecialUsingFixedValue_specialShrinks(this) - ! This tests a specially-handled column shrinking when using the routine that fills - ! all special points using a single fixed value. (No need to have multiple tests of - ! this update_column_state_fill_special_using_fixed_value routine, since it is merely - ! a lightweight wrapper to a different routine.) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - - integer :: special_type ! landunit type of the special type - real(r8), parameter :: input_from_special = 14._r8 - real(r8) :: myvar(3), myvar_orig(3), expected_var(3) - real(r8) :: expected_non_conserved_mass - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - integer :: i - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialShrinks( & - cs_updater, & - special_type = special_type) - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - expected_var(3) = myvar(3) - do i = 1, 2 - expected_var(i) = (this%cwtgcell_old(i)*myvar(i) + & - this%cwtgcell_new_minus_old(i)*input_from_special) / & - this%cwtgcell_new(i) - end do - expected_non_conserved_mass = this%cwtgcell_new_minus_old(3) * input_from_special - - ! Exercise - call cs_updater%update_column_state_fill_special_using_fixed_value(bounds, clump_index=1, var=myvar, & - special_value=input_from_special, non_conserved_mass_grc=non_conserved_mass_grc) - - ! Verify - @assertEqual(expected_var, myvar, tolerance=tol) - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - call this%assertConservation(myvar_orig, myvar, & - 'fillSpecialUsingFixedValue_specialShrinks', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine fillSpecialUsingFixedValue_specialShrinks - - - ! ------------------------------------------------------------------------ - ! Tests with fractional_areas - ! ------------------------------------------------------------------------ - - @Test - subroutine withFractionalAreas_oneShrinksOneGrows(this) - ! This tests the updating of a variable with fractional area terms, with one column - ! shrinking, one growing, and two staying the same in area - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.1_r8, 0.3_r8, 0.2_r8, 0.4_r8] - real(r8), parameter :: fractional_area_old(4) = [0.0_r8, 0.1_r8, 0.7_r8, 0.5_r8] - real(r8) :: myvar(4), myvar_orig(4), expected(4), fractional_area_new(4) - real(r8) :: myvar_orig_weighted(4), myvar_weighted(4) - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 7._r8, 8._r8] - myvar_orig = myvar - expected = myvar - expected(2) = (this%cwtgcell_old(2) * fractional_area_old(2) * myvar(2) + & - this%cwtgcell_new_minus_old(2) * fractional_area_old(3) * myvar(3)) / & - (this%cwtgcell_old(2)*fractional_area_old(2) + & - this%cwtgcell_new_minus_old(2) * fractional_area_old(3)) - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new) - - ! Verify - @assertEqual(expected, myvar, tolerance=tol) - myvar_orig_weighted = myvar_orig*fractional_area_old - myvar_weighted = myvar*fractional_area_new - call this%assertConservation(myvar_orig_weighted, myvar_weighted, 'withFractionalAreas_oneShrinksOneGrows') - end subroutine withFractionalAreas_oneShrinksOneGrows - - @Test - subroutine withFractionalAreas_fraction0_oneShrinksOneGrows(this) - ! This tests the updating of a variable with fractional area terms, with one column - ! shrinking, one growing, and two staying the same in area. Here the growing column - ! has a new fractional area of 0. - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.1_r8, 0.3_r8, 0.2_r8, 0.4_r8] - real(r8), parameter :: fractional_area_old(4) = [0.0_r8, 0.0_r8, 0.0_r8, 0.5_r8] - real(r8) :: myvar(4), myvar_orig(4), expected(4), fractional_area_new(4) - real(r8) :: myvar_orig_weighted(4), myvar_weighted(4) - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 7._r8, 8._r8] - myvar_orig = myvar - ! If the growing column has a new fractional area of 0, then we expect no change in - ! my_var. - expected = myvar - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new) - - ! Verify - @assertEqual(expected, myvar, tolerance=tol) - end subroutine withFractionalAreas_fraction0_oneShrinksOneGrows - - @Test - subroutine withFractionalAreas_twoShrinkTwoGrow(this) - ! This tests the updating of a variable with fractional area terms, with one column - ! shrinking to 0 area, one shrinking to non-zero area, one growing from 0 area, and - ! one growing from non-zero area - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0._r8, 0.7_r8] - real(r8), parameter :: cwtlunit_new(4) = [0._r8 , 0.15_r8, 0.08_r8, 0.77_r8] - real(r8), parameter :: fractional_area_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: new_minus_old(4) = cwtlunit_new - cwtlunit_old - real(r8) :: mass_gain_per_unit_area - real(r8) :: myvar(4), myvar_orig(4), expected(4), fractional_area_new(4) - real(r8) :: myvar_orig_weighted(4), myvar_weighted(4) - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - myvar_orig = myvar - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new) - - ! Verify - expected(1:2) = myvar_orig(1:2) - mass_gain_per_unit_area = ( & - new_minus_old(1) * fractional_area_old(1) * myvar_orig(1) + & - new_minus_old(2) * fractional_area_old(2) * myvar_orig(2)) / & - (new_minus_old(1) + new_minus_old(2)) - expected(3) = mass_gain_per_unit_area / fractional_area_new(3) - expected(4) = (cwtlunit_old(4) * fractional_area_old(4) * myvar_orig(4) + & - new_minus_old(4) * mass_gain_per_unit_area) / & - (cwtlunit_new(4) * fractional_area_new(4)) - @assertEqual(expected, myvar, tolerance=tol) - - myvar_orig_weighted = myvar_orig*fractional_area_old - myvar_weighted = myvar*fractional_area_new - call this%assertConservation(myvar_orig_weighted, myvar_weighted, 'withFractionalAreas_twoShrinkTwoGrow') - end subroutine withFractionalAreas_twoShrinkTwoGrow - - @Test - subroutine nonConservedMass_withFractionalAreas_specialShrinks(this) - ! This tests the computation of non_conserved_mass with fractional area terms, when - ! a special column shrinks - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: input_from_special = 11._r8 - real(r8), parameter :: fractional_area_old(3) = [0.1_r8, 0.2_r8, 0.3_r8] - real(r8) :: fractional_area_new(3) - real(r8) :: myvar(3), myvar_orig(3) - real(r8) :: expected_non_conserved_mass - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - real(r8) :: myvar_orig_weighted(3), myvar_weighted(3) - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialShrinks(cs_updater) - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - expected_non_conserved_mass = this%cwtgcell_new_minus_old(3) * fractional_area_old(3) & - * input_from_special - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_fill_special_using_fixed_value(bounds, clump_index=1, var=myvar, & - special_value=input_from_special, non_conserved_mass_grc=non_conserved_mass_grc, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new) - - ! Verify - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - myvar_orig_weighted = myvar_orig * fractional_area_old - myvar_weighted = myvar * fractional_area_new - call this%assertConservation(myvar_orig_weighted, myvar_weighted, & - 'nonConservedMass_withFractionalAreas_specialShrinks', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine nonConservedMass_withFractionalAreas_specialShrinks - - @Test - subroutine nonConservedMass_withFractionalAreas_specialGrows(this) - ! This tests the computation of non_conserved_mass with fractional area terms, when - ! a special column grows - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: input_from_special = 11._r8 ! irrelevant - real(r8), parameter :: fractional_area_old(3) = [0.1_r8, 0.2_r8, 0.3_r8] - real(r8) :: fractional_area_new(3) - real(r8) :: myvar(3), myvar_orig(3) - real(r8) :: expected_non_conserved_mass - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - real(r8) :: myvar_orig_weighted(3), myvar_weighted(3) - - ! Setup - - call this%do_all_setup_two_veg_and_special_specialGrows(cs_updater) - - myvar = [2._r8, 3._r8, 4._r8] - myvar_orig = myvar - expected_non_conserved_mass = -1._r8 * & - (myvar(1) * this%cwtgcell_new_minus_old(1) * fractional_area_old(1) + & - myvar(2) * this%cwtgcell_new_minus_old(2) * fractional_area_old(2)) - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_fill_special_using_fixed_value(bounds, clump_index=1, var=myvar, & - special_value=input_from_special, non_conserved_mass_grc=non_conserved_mass_grc, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new) - - ! Verify - @assertEqual(expected_non_conserved_mass, non_conserved_mass_grc(1), tolerance=tol) - - ! Note that the specially-treated column is excluded from the conservation check: the - ! value in that column is ignored for conservation. - myvar_orig_weighted = myvar_orig * fractional_area_old - myvar_weighted = myvar * fractional_area_new - call this%assertConservation(myvar_orig_weighted, myvar_weighted, & - 'nonConservedMass_withFractionalAreas_specialGrows', & - begc = 1, endc = 2, non_conserved_mass = non_conserved_mass_grc(1)) - - end subroutine nonConservedMass_withFractionalAreas_specialGrows - - ! ------------------------------------------------------------------------ - ! Tests of the optional adjustment output - ! ------------------------------------------------------------------------ - - @Test - subroutine adjustment_withNoAreaChange_isUnchanged(this) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8) :: myvar(4) - real(r8) :: adjustment(4) - real(r8) :: adjustment_expected(4) - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8], & - cwtlunit_new = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8]) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - adjustment = adjustment) - - adjustment_expected(:) = 0._r8 - @assertEqual(adjustment_expected, adjustment) - end subroutine adjustment_withNoAreaChange_isUnchanged - - @Test - subroutine adjustment_withOneShrinksOneGrows(this) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.05_r8, 0.2_r8, 0.35_r8, 0.4_r8] - real(r8) :: myvar(4), myvar_orig(4) - real(r8) :: adjustment(4) - real(r8) :: adjustment_expected(4) - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 4._r8, 5._r8] - myvar_orig = myvar - - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - adjustment = adjustment) - - adjustment_expected(:) = 0._r8 - adjustment_expected(3) = myvar(3) - myvar_orig(3) - @assertEqual(adjustment_expected, adjustment) - end subroutine adjustment_withOneShrinksOneGrows - - @Test - subroutine adjustment_withSpecialGrowing_isUnchanged(this) - ! The 'adjustment' variable shouldn't be changed for a special landunit - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8) :: non_conserved_mass_grc(1) = 0._r8 - real(r8) :: myvar(3) - real(r8) :: adjustment(3) - real(r8) :: adjustment_expected(3) - - call this%do_all_setup_two_veg_and_special_specialGrows(cs_updater) - - myvar = [2._r8, 3._r8, 4._r8] - - call cs_updater%update_column_state_fill_special_using_natveg(bounds, clump_index=1, var=myvar, & - non_conserved_mass_grc = non_conserved_mass_grc, adjustment = adjustment) - - adjustment_expected(:) = 0._r8 - @assertEqual(adjustment_expected, adjustment) - end subroutine adjustment_withSpecialGrowing_isUnchanged - - @Test - subroutine adjustment_withFractionalAreas(this) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.1_r8, 0.3_r8, 0.2_r8, 0.4_r8] - real(r8), parameter :: fractional_area_old(4) = [0.0_r8, 0.1_r8, 0.7_r8, 0.5_r8] - real(r8) :: myvar(4), myvar_orig(4), fractional_area_new(4) - real(r8) :: myvar_orig_weighted(4), myvar_weighted(4) - real(r8) :: adjustment(4) - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 7._r8, 8._r8] - myvar_orig = myvar - adjustment(:) = 0._r8 - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new, & - adjustment = adjustment) - - ! Verify - myvar_orig_weighted = myvar_orig*fractional_area_old - myvar_weighted = myvar*fractional_area_new - @assertEqual(myvar_orig_weighted, myvar_weighted - adjustment) - end subroutine adjustment_withFractionalAreas - - @Test - subroutine adjustment_withFractionalAreas_newFrac0(this) - ! If the new fractional area is 0, then the adjustment should be equal to - ! -(myvar_orig * fractional_area_old) - class(TestColumnStateUpdater), intent(inout) :: this - type(column_state_updater_type) :: cs_updater - ! col #2 grows from 0, taking over some of col #3; col #2's new fractional area - ! should be 0 because col #3 had a fractional area of 0 - real(r8), parameter :: cwtlunit_old(4) = [0.1_r8, 0.0_r8, 0.5_r8, 0.4_r8] - real(r8), parameter :: cwtlunit_new(4) = [0.1_r8, 0.2_r8, 0.3_r8, 0.4_r8] - real(r8), parameter :: fractional_area_old(4) = [0.0_r8, 0.1_r8, 0.0_r8, 0.5_r8] - real(r8) :: myvar(4), myvar_orig(4), fractional_area_new(4) - real(r8) :: myvar_orig_weighted(4), myvar_weighted(4) - real(r8) :: adjustment(4) - real(r8) :: expected_adjustment - - ! Setup - - call this%do_all_setup_with_four_vegetated_columns( & - cs_updater, & - cwtlunit_old = cwtlunit_old, & - cwtlunit_new = cwtlunit_new) - - myvar = [2._r8, 3._r8, 7._r8, 8._r8] - myvar_orig = myvar - adjustment(:) = 0._r8 - - fractional_area_new(:) = fractional_area_old(:) - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=fractional_area_new) - - ! Exercise - call cs_updater%update_column_state_no_special_handling(bounds, clump_index=1, var=myvar, & - fractional_area_old = fractional_area_old, & - fractional_area_new = fractional_area_new, & - adjustment = adjustment) - - ! Verify - expected_adjustment = -1._r8 * (myvar_orig(2) * fractional_area_old(2)) - @assertEqual(expected_adjustment, adjustment(2)) - end subroutine adjustment_withFractionalAreas_newFrac0 - -end module test_column_state_updater diff --git a/src/dyn_subgrid/test/dynColumnTemplate_test/CMakeLists.txt b/src/dyn_subgrid/test/dynColumnTemplate_test/CMakeLists.txt deleted file mode 100644 index 0f6ad1c753..0000000000 --- a/src/dyn_subgrid/test/dynColumnTemplate_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(ColumnTemplate test_ColumnTemplate_exe - "test_column_template.pf" "") - -target_link_libraries(test_ColumnTemplate_exe clm csm_share) \ No newline at end of file diff --git a/src/dyn_subgrid/test/dynColumnTemplate_test/test_column_template.pf b/src/dyn_subgrid/test/dynColumnTemplate_test/test_column_template.pf deleted file mode 100644 index e5ab68fe29..0000000000 --- a/src/dyn_subgrid/test/dynColumnTemplate_test/test_column_template.pf +++ /dev/null @@ -1,179 +0,0 @@ -module test_column_template - - ! Tests of dynColumnTemplateMod - - use pfunit_mod - use dynColumnTemplateMod - use unittestSubgridMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon , only : ispval - use ColumnType , only : col - use LandunitType , only : lun - use GridcellType , only : grc - - implicit none - - @TestCase - type, extends(TestCase) :: TestColumnTemplate - contains - procedure :: setUp - procedure :: tearDown - procedure :: setup_gridcells_with_three_landunits - end type TestColumnTemplate - -contains - - subroutine setUp(this) - class(TestColumnTemplate), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestColumnTemplate), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - ! ------------------------------------------------------------------------ - ! Helper routines - ! ------------------------------------------------------------------------ - - subroutine setup_gridcells_with_three_landunits(this, n_gridcells, c_target) - ! Sets up a grid with n_gridcells grid cells, each with three landunits (types 1, 2 - ! and 3). Each landunit has multiple columns, all active. - ! - ! There is a total of 9 columns on each grid cell. - - class(TestColumnTemplate), intent(inout) :: this - - ! number of gridcells - integer, intent(in) :: n_gridcells - - ! column index of "target column" for some tests, which is the second column on the - ! landunit with ltype = 1, in the first grid cell - integer, intent(out) :: c_target - - integer :: g - - ! The weights (of both landunits and columns) and column types in the following are - ! arbitrary, since they are not important for these tests - - call unittest_subgrid_setup_start() - - do g = 1, n_gridcells - call unittest_add_gridcell() - - call unittest_add_landunit(my_gi=gi, ltype=3, wtgcell=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - - call unittest_add_landunit(my_gi=gi, ltype=1, wtgcell=0.5_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - if (g == 1) then - c_target = ci - end if - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - - call unittest_add_landunit(my_gi=gi, ltype=2, wtgcell=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - end do - - call unittest_subgrid_setup_end() - - col%active(bounds%begc:bounds%endc) = .true. - end subroutine setup_gridcells_with_three_landunits - - - ! ------------------------------------------------------------------------ - ! Begin actual unit tests - ! ------------------------------------------------------------------------ - - @Test - subroutine template_col_with_no_landunit(this) - ! no landunit of the given landunit_type on this grid cell - class(TestColumnTemplate), intent(inout) :: this - integer :: c_target ! column index of "target column": 2nd col on landunit with ltype=1 - integer :: template_col - - call this%setup_gridcells_with_three_landunits(1, c_target) - grc%landunit_indices(2,gi) = ispval - template_col = template_col_from_landunit(bounds, c_target, 2, & - col%active(bounds%begc:bounds%endc)) - @assertEqual(TEMPLATE_NONE_FOUND, template_col) - end subroutine template_col_with_no_landunit - - @Test - subroutine template_col_with_no_active(this) - ! no active columns on the given landunit_type - class(TestColumnTemplate), intent(inout) :: this - integer :: l2 ! landunit index of landunit with ltype = 2 - integer :: c_target ! column index of "target column": 2nd col on landunit with ltype=1 - integer :: template_col - - call this%setup_gridcells_with_three_landunits(1, c_target) - l2 = grc%landunit_indices(2,gi) - col%active(lun%coli(l2):lun%colf(l2)) = .false. - template_col = template_col_from_landunit(bounds, c_target, 2, & - col%active(bounds%begc:bounds%endc)) - @assertEqual(TEMPLATE_NONE_FOUND, template_col) - end subroutine template_col_with_no_active - - @Test - subroutine template_col_with_all_active(this) - ! all active columns on the given landunit type; should take the first - class(TestColumnTemplate), intent(inout) :: this - integer :: l2 ! landunit index of landunit with ltype = 2 - integer :: c_target ! column index of "target column": 2nd col on landunit with ltype=1 - integer :: template_col - - call this%setup_gridcells_with_three_landunits(1, c_target) - template_col = template_col_from_landunit(bounds, c_target, 2, & - col%active(bounds%begc:bounds%endc)) - l2 = grc%landunit_indices(2,gi) - @assertEqual(lun%coli(l2), template_col) - end subroutine template_col_with_all_active - - @Test - subroutine template_col_with_second_active(this) - ! first col on the given landunit is inactive, second is active; should take the - ! second (ignoring the inactive column) - class(TestColumnTemplate), intent(inout) :: this - integer :: l2 ! landunit index of landunit with ltype = 2 - integer :: c_target ! column index of "target column": 2nd col on landunit with ltype=1 - integer :: template_col - - call this%setup_gridcells_with_three_landunits(1, c_target) - l2 = grc%landunit_indices(2,gi) - col%active(lun%coli(l2)) = .false. - template_col = template_col_from_landunit(bounds, c_target, 2, & - col%active(bounds%begc:bounds%endc)) - @assertEqual(lun%coli(l2)+1, template_col) - end subroutine template_col_with_second_active - - @Test - subroutine template_col_from_natveg_array_with_two_gridcells(this) - class(TestColumnTemplate), intent(inout) :: this - integer :: c_target ! ignored for this test - integer :: l1_g1, l1_g2 ! landunit indices of landunit type 1 in grid cell 1 & 2 - integer, allocatable :: c_templates(:) - integer, allocatable :: expected_templates(:) - - call this%setup_gridcells_with_three_landunits(n_gridcells=2, c_target=c_target) - allocate(c_templates(bounds%begc:bounds%endc)) - call template_col_from_natveg_array(bounds, & - col%active(bounds%begc:bounds%endc), & - c_templates) - - allocate(expected_templates(bounds%begc:bounds%endc)) - l1_g1 = grc%landunit_indices(1, bounds%begg) - l1_g2 = grc%landunit_indices(1, bounds%begg+1) - ! In the following, note that there are 9 columns per grid cell - expected_templates(bounds%begc:(bounds%begc+8)) = lun%coli(l1_g1) - expected_templates((bounds%begc+9):(bounds%endc)) = lun%coli(l1_g2) - @assertEqual(expected_templates, c_templates) - end subroutine template_col_from_natveg_array_with_two_gridcells - -end module test_column_template diff --git a/src/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt b/src/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt deleted file mode 100644 index 59e6d13bb3..0000000000 --- a/src/dyn_subgrid/test/dynInitColumns_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(dynInitColumns test_dynInitColumns_exe - "test_init_columns.pf" "") - -target_link_libraries(test_dynInitColumns_exe clm csm_share) diff --git a/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf b/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf deleted file mode 100644 index 88e916ffa1..0000000000 --- a/src/dyn_subgrid/test/dynInitColumns_test/test_init_columns.pf +++ /dev/null @@ -1,219 +0,0 @@ -module test_init_columns - - ! Tests of the dynInitColumns module - - use pfunit_mod - use unittestSubgridMod - use dynInitColumnsMod - use ColumnType , only : col - use LandunitType , only : lun - use GridcellType , only : grc - use decompMod , only : bounds_type - use clm_varcon , only : ispval - use clm_varpar , only : nlevsno, nlevgrnd - use shr_kind_mod , only : r8 => shr_kind_r8 - use TemperatureType , only : temperature_type - use WaterstateType , only : waterstate_type - use SoilHydrologyType, only : soilhydrology_type - use dynColumnTemplateMod, only : TEMPLATE_NONE_FOUND - - implicit none - save - - logical, allocatable, private :: cactive_prior(:) - integer :: c_new ! column index of the new column to initialize in some tests - integer :: l1 ! index of the landunit with landunit type 1 - integer :: l2 ! index of the landunit with landunit type 2 - - ! TODO(wjs, 2016-09-01) This test should be changed to use a class, with these being - ! instances of the class. Then the setup and cleanup routines here should be turned - ! into setup & teardown methods of the class. - type(temperature_type) :: temperature_vars - type(waterstate_type) :: waterstate_vars - type(soilhydrology_type) :: soilhydrology_vars - -contains - - subroutine setup() - ! Set up variables needed for tests: various subgrid type variables, along with - ! bounds and cactive_prior. - ! - ! col%active and cactive_prior need to be set by specific tests - integer :: c, lev - - ! Set up subgrid structure - ! The weights (of both landunits and columns) and column types in the following are - ! arbitrary, since they are not important for these tests - - call unittest_subgrid_setup_start() - - call unittest_add_gridcell() - - call unittest_add_landunit(my_gi=gi, ltype=3, wtgcell=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - - call unittest_add_landunit(my_gi=gi, ltype=1, wtgcell=0.5_r8) - l1 = li - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - ! This column (the second column on the landunit with ltype=1) will be the target for - ! some tests of initialization of a new column - c_new = ci - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - - call unittest_add_landunit(my_gi=gi, ltype=2, wtgcell=0.25_r8) - l2 = li - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.25_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=0.5_r8) - - call unittest_subgrid_setup_end() - - col%active(begc:endc) = .false. - allocate(cactive_prior(bounds%begc:bounds%endc), source=.false.) - - nlevgrnd=10 - allocate(temperature_vars%t_soisno_col(bounds%begc:bounds%endc, -nlevsno+1:nlevgrnd)) - allocate(waterstate_vars%h2osoi_liq_col(bounds%begc:bounds%endc, -nlevsno+1:nlevgrnd)) - allocate(waterstate_vars%h2osoi_ice_col(bounds%begc:bounds%endc, -nlevsno+1:nlevgrnd)) - allocate(waterstate_vars%h2osoi_vol_col(bounds%begc:bounds%endc, -nlevsno+1:nlevgrnd)) - allocate(soilhydrology_vars%wa_col(bounds%begc:bounds%endc)) - do lev = -nlevsno+1, nlevgrnd - do c = bounds%begc, bounds%endc - temperature_vars%t_soisno_col(c, lev) = c*1000 + lev - - ! Also need to initialize some waterstate_type variables, but we don't have any - ! assertions on them in this test - waterstate_vars%h2osoi_liq_col(c, lev) = 0._r8 - waterstate_vars%h2osoi_ice_col(c, lev) = 0._r8 - waterstate_vars%h2osoi_vol_col(c, lev) = 0._r8 - end do - end do - - ! Also need to initialize some other variables for which we don't have any assertions - do c = bounds%begc, bounds%endc - soilhydrology_vars%wa_col(c) = 0._r8 - end do - end subroutine setup - - subroutine cleanup() - ! clean up stuff set up in setup() - - call unittest_subgrid_teardown() - - deallocate(cactive_prior) - deallocate(temperature_vars%t_soisno_col) - deallocate(waterstate_vars%h2osoi_liq_col) - deallocate(waterstate_vars%h2osoi_ice_col) - deallocate(waterstate_vars%h2osoi_vol_col) - deallocate(soilhydrology_vars%wa_col) - - end subroutine cleanup - - ! ------------------------------------------------------------------------ - ! Tests of initial_template_col_crop - ! ------------------------------------------------------------------------ - - @Test - subroutine test_crop_active_in_soil_and_crop() - ! there are active columns both on the soil & crop landunits; should take the soil one - call setup() - cactive_prior(:) = .true. - @assertEqual(lun%coli(l1), initial_template_col_crop(bounds, c_new, cactive_prior)) - call cleanup() - end subroutine test_crop_active_in_soil_and_crop - - @Test - subroutine test_crop_no_soil() - ! no soil landunit, should take a crop column - call setup() - cactive_prior(:) = .true. - grc%landunit_indices(1,gi) = ispval - @assertEqual(lun%coli(l2), initial_template_col_crop(bounds, c_new, cactive_prior)) - call cleanup() - end subroutine test_crop_no_soil - - @Test - subroutine test_crop_no_soil_or_crop() - ! no soil or crop landunits, should give TEMPLATE_NONE_FOUND - call setup() - cactive_prior(:) = .true. - grc%landunit_indices(1:2,gi) = ispval - @assertEqual(TEMPLATE_NONE_FOUND, initial_template_col_crop(bounds, c_new, cactive_prior)) - call cleanup() - end subroutine test_crop_no_soil_or_crop - - ! ------------------------------------------------------------------------ - ! Tests of initialize_new_columns - ! - ! Note that, although we don't have any explicit tests of copy_state, its behavior is - ! implicitly tested through these tests - ! ------------------------------------------------------------------------ - - @Test - subroutine test_initialize_new_columns_none() - ! Nothing to initialize - real(r8), allocatable :: t_soisno_expected(:,:) - call setup() - ! col%active and cactive_prior are a mix of true/true, false/false and false/true, so - ! there's nothing to initialize - col%active(:) = .true. - cactive_prior(:) = .true. - col%active(lun%coli(l2)+1) = .false. - cactive_prior(lun%coli(l2)+1) = .false. - col%active(lun%coli(l2)+2) = .false. - t_soisno_expected = temperature_vars%t_soisno_col - call initialize_new_columns(bounds, cactive_prior, & - temperature_vars, waterstate_vars, soilhydrology_vars) - @assertEqual(t_soisno_expected, temperature_vars%t_soisno_col) - call cleanup() - end subroutine test_initialize_new_columns_none - - @Test - subroutine test_initialize_new_columns_TEMPLATE_NONE_FOUND() - ! Something to initialize, but template_col results in TEMPLATE_NONE_FOUND: state should remain - ! the same as before - real(r8), allocatable :: t_soisno_expected(:,:) - call setup() - col%active(:) = .false. - col%active(lun%coli(l2)+1) = .true. - ! all cactive_prior points were false, so there's nothing to use as a template: - cactive_prior(:) = .false. - t_soisno_expected = temperature_vars%t_soisno_col - call initialize_new_columns(bounds, cactive_prior, & - temperature_vars, waterstate_vars, soilhydrology_vars) - @assertEqual(t_soisno_expected, temperature_vars%t_soisno_col) - call cleanup() - end subroutine test_initialize_new_columns_TEMPLATE_NONE_FOUND - - @Test - subroutine test_initialize_new_columns_copy_state() - ! Something to initialize, which results in a state copy - real(r8), allocatable :: t_soisno_expected(:,:) - integer :: source_col, dest_col - - call setup() - - col%active(:) = .false. - dest_col = lun%coli(l2) + 1 - col%active(dest_col) = .true. - - cactive_prior(:) = .false. - source_col = lun%coli(l1) + 1 - cactive_prior(source_col) = .true. - - t_soisno_expected = temperature_vars%t_soisno_col - ! In the following, note that only the belowground portion (starting with level 1) is - ! copied: - t_soisno_expected(dest_col,1:) = temperature_vars%t_soisno_col(source_col,1:) - - call initialize_new_columns(bounds, cactive_prior, & - temperature_vars, waterstate_vars, soilhydrology_vars) - - @assertEqual(t_soisno_expected, temperature_vars%t_soisno_col) - call cleanup() - end subroutine test_initialize_new_columns_copy_state - -end module test_init_columns diff --git a/src/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt b/src/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt deleted file mode 100644 index 2547dc4a17..0000000000 --- a/src/dyn_subgrid/test/dynLandunitArea_test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(pfunit_sources - test_update_landunit_weights_one_gcell.pf - test_update_landunit_weights.pf) - -create_pFUnit_test(dynLandunitArea test_dynLandunitArea_exe - "${pfunit_sources}" "") - -target_link_libraries(test_dynLandunitArea_exe clm csm_share) - diff --git a/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf b/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf deleted file mode 100644 index 4cc250320b..0000000000 --- a/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights.pf +++ /dev/null @@ -1,147 +0,0 @@ -module test_update_landunit_weights - - ! Tests of the update_landunit_weights routine in the dynLandunitArea module - - use pfunit_mod - use unittestSubgridMod - use dynLandunitAreaMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use landunit_varcon , only : istsoil, istcrop, istice_mec, istdlak, istwet - use landunit_varcon , only : isturb_tbd, isturb_hd, isturb_md - use GridcellType , only : grc - use LandunitType , only : lun - use decompMod , only : bounds_type - - implicit none - save - - real(r8), parameter :: tol = 1.e-14_r8 - -contains - - subroutine setup_start() - call unittest_subgrid_setup_start() - end subroutine setup_start - - subroutine setup_end() - call unittest_subgrid_setup_end() - end subroutine setup_end - - subroutine teardown() - call unittest_subgrid_teardown() - end subroutine teardown - - - @Test - subroutine test_one_gcell_all_lunits() - ! Test update_landunit_weights with a single grid cell, which has all landunits - ! present - - integer :: index_soil, index_crop, index_icemec, index_urbmd - real(r8) :: expected(begl:endl) - - call setup_start() - call unittest_add_gridcell() - ! Add all landunits, deliberately out of order; the weights sum to 1: - call unittest_add_landunit(my_gi=gi, ltype=5, wtgcell=0.16_r8) - call unittest_add_landunit(my_gi=gi, ltype=1, wtgcell=0.14_r8) - call unittest_add_landunit(my_gi=gi, ltype=6, wtgcell=0.08_r8) - call unittest_add_landunit(my_gi=gi, ltype=2, wtgcell=0.25_r8) - call unittest_add_landunit(my_gi=gi, ltype=7, wtgcell=0.06_r8) - call unittest_add_landunit(my_gi=gi, ltype=3, wtgcell=0.05_r8) - call unittest_add_landunit(my_gi=gi, ltype=8, wtgcell=0.04_r8) - call unittest_add_landunit(my_gi=gi, ltype=4, wtgcell=0.20_r8) - call unittest_add_landunit(my_gi=gi, ltype=9, wtgcell=0.02_r8) - call setup_end() - - ! In the following, we assume that the first few elements of decrease_order are: - ! istsoil, istcrop, isturb_md - - ! First increase the area of istice_mec: weights of istice_mec + istsoil + istcrop + 0.01 - index_soil = grc%landunit_indices(istsoil,gi) - index_crop = grc%landunit_indices(istcrop,gi) - index_icemec = grc%landunit_indices(istice_mec,gi) - index_urbmd = grc%landunit_indices(isturb_md,gi) - lun%wtgcell(index_icemec) = lun%wtgcell(index_icemec) + lun%wtgcell(index_soil) + lun%wtgcell(index_crop) + 0.01_r8 - - ! Now set the expected outcome - expected = lun%wtgcell - expected(index_soil) = 0._r8 - expected(index_crop) = 0._r8 - expected(index_urbmd) = expected(index_urbmd) - 0.01_r8 - - call update_landunit_weights(bounds) - @assertEqual(expected(bounds%begl:bounds%endl), lun%wtgcell(bounds%begl:bounds%endl), tolerance=tol) - - call teardown() - end subroutine test_one_gcell_all_lunits - - @Test - subroutine test_one_gcell_some_lunits() - ! Test update_landunit_weights with a single grid cell, which has only some landunits - ! present - - integer :: index_wet, index_icemec, index_crop - real(r8) :: expected(begl:endl) - - call setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istwet, wtgcell=0.3_r8) - index_wet = li - call unittest_add_landunit(my_gi=gi, ltype=istice_mec, wtgcell=0.8_r8) - index_icemec = li - call unittest_add_landunit(my_gi=gi, ltype=istcrop, wtgcell=0.5_r8) - index_crop = li - call setup_end() - - ! In the following, we assume that crop is decreased before wetland: - expected(index_icemec) = 0.8_r8 - expected(index_crop) = 0.0_r8 - expected(index_wet) = 0.2_r8 - - call update_landunit_weights(bounds) - @assertEqual(expected(bounds%begl:bounds%endl), lun%wtgcell(bounds%begl:bounds%endl), tolerance=tol) - - call teardown() - end subroutine test_one_gcell_some_lunits - - @Test - subroutine test_multiple_gcells() - ! Test update_landunit_weights with multiple grid cells - - integer :: g1, g2, g3 - real(r8) :: expected(begl:endl) - - call setup_start() - - call unittest_add_gridcell() - g1 = gi - call unittest_add_gridcell() - g2 = gi - call unittest_add_gridcell() - g3 = gi - - ! Deliberately add landunits out-of-order - call unittest_add_landunit(my_gi=g2, ltype=istice_mec, wtgcell=0.8_r8) - call unittest_add_landunit(my_gi=g3, ltype=istcrop, wtgcell=0.6_r8) - call unittest_add_landunit(my_gi=g1, ltype=isturb_md, wtgcell=0.45_r8) - call unittest_add_landunit(my_gi=g3, ltype=istice_mec, wtgcell=0.4_r8) - call unittest_add_landunit(my_gi=g1, ltype=istcrop, wtgcell=0.7_r8) - call unittest_add_landunit(my_gi=g2, ltype=istsoil, wtgcell=0.1_r8) - - call setup_end() - - ! grid cell 1 needs decrease in crop - ! grid cell 2 needs increase in soil - ! grid cell 3 stays the same - expected = lun%wtgcell - expected(grc%landunit_indices(istcrop,g1)) = 0.55_r8 - expected(grc%landunit_indices(istsoil,g2)) = 0.2_r8 - - call update_landunit_weights(bounds) - @assertEqual(expected(bounds%begl:bounds%endl), lun%wtgcell(bounds%begl:bounds%endl), tolerance=tol) - - call teardown() - end subroutine test_multiple_gcells - -end module test_update_landunit_weights diff --git a/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf b/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf deleted file mode 100644 index f0563130f3..0000000000 --- a/src/dyn_subgrid/test/dynLandunitArea_test/test_update_landunit_weights_one_gcell.pf +++ /dev/null @@ -1,135 +0,0 @@ -module test_update_landunit_weights_one_gcell - - ! Tests of the update_landunit_weights_one_gcell routine in the dynLandunitArea module - - use pfunit_mod - use dynLandunitAreaMod - use landunit_varcon, only : istsoil, istcrop, isturb_md, istice_mec, istdlak, max_lunit - use shr_kind_mod , only : r8 => shr_kind_r8 - - - implicit none - save - - real(r8), parameter :: tol = 1.e-14_r8 - -contains - - function create_landunit_weights() - ! Create default version of the landunit weights - real(r8), dimension(max_lunit), allocatable :: create_landunit_weights(:) - - ! Landunit 3 (previously istice) is currently unused, so set its area to 0. - create_landunit_weights = [.25_r8, .2_r8, 0._r8, .3_r8, .08_r8, .06_r8, .05_r8, .04_r8, .02_r8] - end function create_landunit_weights - - @Test - subroutine test_no_change() - ! Test with no changes needed in landunit areas, because they already add to 100% - - real(r8) :: landunit_weights(max_lunit) - real(r8) :: expected(max_lunit) - - landunit_weights = create_landunit_weights() - expected = landunit_weights - - call update_landunit_weights_one_gcell(landunit_weights) - @assertEqual(expected, landunit_weights) - end subroutine test_no_change - - @Test - subroutine test_less_than_1() - ! Test with the input summing to less than 1, which should result in an increase in - ! the natural vegetated area - - real(r8) :: landunit_weights(max_lunit) - real(r8) :: expected(max_lunit) - - landunit_weights = create_landunit_weights() - landunit_weights(istice_mec) = landunit_weights(istice_mec) - 0.01_r8 - expected = landunit_weights - expected(istsoil) = landunit_weights(istsoil) + 0.01_r8 - - call update_landunit_weights_one_gcell(landunit_weights) - @assertEqual(expected, landunit_weights, tolerance=tol) - end subroutine test_less_than_1 - - @Test - subroutine test_greater_than_1_one_change() - ! Test with the input summing to greater than 1, resulting in a change in a single - ! landunit - - real(r8) :: landunit_weights(max_lunit) - real(r8) :: expected(max_lunit) - - landunit_weights = create_landunit_weights() - landunit_weights(istice_mec) = landunit_weights(istice_mec) + 0.01_r8 - expected = landunit_weights - expected(istsoil) = landunit_weights(istsoil) - 0.01_r8 - - call update_landunit_weights_one_gcell(landunit_weights) - @assertEqual(expected, landunit_weights, tolerance=tol) - end subroutine test_greater_than_1_one_change - - @Test - subroutine test_greater_than_1_multiple_changes() - ! Test with the input summing to greater than 1, resulting in a change in multiple - ! landunits (but not all landunits) - - real(r8) :: landunit_weights(max_lunit) - real(r8) :: expected(max_lunit) - - landunit_weights = create_landunit_weights() - - ! In the following, we assume that the first few elements of decrease_order are: - ! istsoil, istcrop, isturb_md - landunit_weights(istice_mec) = landunit_weights(istice_mec) + & - landunit_weights(istsoil) + landunit_weights(istcrop) + 0.01_r8 - expected = landunit_weights - expected(istsoil) = 0._r8 - expected(istcrop) = 0._r8 - expected(isturb_md) = expected(isturb_md) - 0.01_r8 - - call update_landunit_weights_one_gcell(landunit_weights) - @assertEqual(expected, landunit_weights, tolerance=tol) - end subroutine test_greater_than_1_multiple_changes - - @Test - subroutine test_greater_than_1_all_changes() - ! Test with the input summing to greater than 1, resulting in a change in ALL - ! landunits (except istice_mec, which is the one set manually here, and which can - ! never change) - - real(r8) :: landunit_weights(max_lunit) - real(r8) :: expected(max_lunit) - - landunit_weights = create_landunit_weights() - landunit_weights(istice_mec) = 0.99_r8 - - ! In the following, we assume that the last element of decrease_order is istdlak - expected(:) = 0._r8 - expected(istice_mec) = 0.99_r8 - expected(istdlak) = 0.01_r8 - - call update_landunit_weights_one_gcell(landunit_weights) - @assertEqual(expected, landunit_weights, tolerance=tol) - end subroutine test_greater_than_1_all_changes - - @Test - subroutine test_greater_than_1_all_changes_to_0() - ! Similar to test_greater_than_1_all_changes, but now all landunits except istice_mec - ! are reduced to 0 - - real(r8) :: landunit_weights(max_lunit) - real(r8) :: expected(max_lunit) - - landunit_weights = create_landunit_weights() - landunit_weights(istice_mec) = 1.0_r8 - expected(:) = 0._r8 - expected(istice_mec) = 1.0_r8 - - call update_landunit_weights_one_gcell(landunit_weights) - @assertEqual(expected, landunit_weights, tolerance=tol) - end subroutine test_greater_than_1_all_changes_to_0 - -end module test_update_landunit_weights_one_gcell diff --git a/src/dyn_subgrid/test/dynPatchStateUpdater_test/CMakeLists.txt b/src/dyn_subgrid/test/dynPatchStateUpdater_test/CMakeLists.txt deleted file mode 100644 index 932fa98ea2..0000000000 --- a/src/dyn_subgrid/test/dynPatchStateUpdater_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(PatchStateUpdater test_PatchStateUpdater_exe - "test_patch_state_updater.pf" "") - -target_link_libraries(test_PatchStateUpdater_exe clm csm_share) \ No newline at end of file diff --git a/src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf b/src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf deleted file mode 100644 index 6e0cd9fc10..0000000000 --- a/src/dyn_subgrid/test/dynPatchStateUpdater_test/test_patch_state_updater.pf +++ /dev/null @@ -1,510 +0,0 @@ -module test_patch_state_updater - - ! Tests of dynPatchStateUpdaterMod - - use pfunit_mod - use dynPatchStateUpdaterMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestFilterBuilderMod - use PatchType - use LandunitType - use subgridWeightsMod, only : compute_higher_order_weights - use clm_varpar, only : mxpft - use landunit_varcon, only : istwet - - implicit none - - @TestCase - type, extends(TestCase) :: TestPSUpdater - ! filter - integer :: numf - integer, allocatable :: filter(:) - - contains - procedure :: setUp - procedure :: tearDown - procedure :: do_all_setup_with_n_vegetated_patches - end type TestPSUpdater - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Test helpers - ! ======================================================================== - - subroutine setUp(this) - class(TestPSUpdater), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestPSUpdater), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - !----------------------------------------------------------------------- - subroutine do_all_setup_with_n_vegetated_patches(this, ps_updater, & - pwtcol_old, pwtcol_new, pft_types, natveg_weight_old, natveg_weight_new) - ! - ! !DESCRIPTION: - ! Does all setup needed when setting up one grid cell that contains (1) a vegetated - ! column containing n patches, and (2) a wetland landunit with a single column and a - ! single patch. The old weight of the vegetated column is given by natveg_weight_old, - ! if provided; if not provided, it defaults to 0.5. The new weight of the vegetated - ! column is given by natveg_weight_new, if provided; if not provided, it defaults to - ! natveg_weight_old. - ! - ! !ARGUMENTS: - class(TestPSUpdater), intent(inout) :: this - type(patch_state_updater_type), intent(out) :: ps_updater - real(r8), intent(in) :: pwtcol_old(begp:) ! old weights of vegetated patches - real(r8), intent(in) :: pwtcol_new(begp:) ! new weights of vegetated patches - integer, intent(in), optional :: pft_types(:) - real(r8), intent(in), optional :: natveg_weight_old - real(r8), intent(in), optional :: natveg_weight_new - ! - ! !LOCAL VARIABLES: - integer :: p - integer :: li_natveg ! index of natural veg landunit - integer :: li_special ! index of special landunit - real(r8) :: l_natveg_weight_old - real(r8) :: l_natveg_weight_new - - character(len=*), parameter :: subname = 'do_all_setup_with_n_vegetated_patches' - !----------------------------------------------------------------------- - - if (present(natveg_weight_old)) then - l_natveg_weight_old = natveg_weight_old - else - l_natveg_weight_old = 0.5_r8 - end if - - if (present(natveg_weight_new)) then - l_natveg_weight_new = natveg_weight_new - else - l_natveg_weight_new = l_natveg_weight_old - end if - - ! Setup grid - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_vegetated_landunit_n_patches(lweight = l_natveg_weight_old, & - pwtcol = pwtcol_old, pft_types = pft_types) - li_natveg = li - call create_landunit_ncols(ltype = istwet, lweight = (1._r8 - l_natveg_weight_old), & - ctypes = [istwet], cweights = [1._r8]) - li_special = li - call unittest_subgrid_setup_end() - call filter_from_range(bounds%begp, bounds%endp, this%numf, this%filter) - - ! Setup ps_updater - ps_updater = patch_state_updater_type(bounds) - call ps_updater%set_old_weights(bounds) - - ! Change areas - ! Just include the vegetated patches in the loop - so skip the last patch - do p = bounds%begp, (bounds%endp - 1) - patch%wtcol(p) = pwtcol_new(p) - end do - lun%wtgcell(li_natveg) = l_natveg_weight_new - lun%wtgcell(li_special) = 1._r8 - l_natveg_weight_new - call compute_higher_order_weights(bounds) - - call ps_updater%set_new_weights(bounds) - - end subroutine do_all_setup_with_n_vegetated_patches - - - ! ======================================================================== - ! Actual tests - ! - ! Note: in most tests, there are 3 vegetated patches plus a wetland patch; the 2nd patch - ! is the patch of interest - ! ======================================================================== - - @Test - subroutine noAreaChange(this) - ! no area change => no change in value, flux stays the same - class(TestPSUpdater), intent(inout) :: this - real(r8), parameter :: pwtcol_old(3) = [0.25_r8, 0.5_r8, 0.25_r8] - real(r8), parameter :: pwtcol_new(3) = pwtcol_old - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4), expected_var(4) - real(r8) :: flux_col_area(4), expected_flux_col_area(4) - real(r8) :: flux_grc_area(4), expected_flux_grc_area(4) - - ! Setup - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - expected_var = var - flux_col_area = [12._r8, 13._r8, 14._r8, 15._r8] - expected_flux_col_area = flux_col_area - flux_grc_area = [22._r8, 23._r8, 24._r8, 25._r8] - expected_flux_grc_area = flux_grc_area - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - flux_out_col_area = flux_col_area, & - flux_out_grc_area = flux_grc_area) - - ! Verify - @assertEqual(expected_var, var) - @assertEqual(expected_flux_col_area, flux_col_area) - @assertEqual(expected_flux_grc_area, flux_grc_area) - end subroutine noAreaChange - - @Test - subroutine areaIncreases(this) - ! if area increases from non-zero, then value is decreased appropriately; there - ! should be no change in flux - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol_old(3) = [0.3_r8, 0.2_r8, 0.5_r8] - real(r8), parameter :: pwtcol_new(3) = [0.2_r8, 0.3_r8, 0.5_r8] - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: flux_col_area(4) - real(r8) :: flux_grc_area(4) - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - flux_col_area = [12._r8, 13._r8, 14._r8, 15._r8] - flux_grc_area = [22._r8, 23._r8, 24._r8, 25._r8] - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - flux_out_col_area = flux_col_area, & - flux_out_grc_area = flux_grc_area) - - ! Verify - @assertEqual(2._r8, var(2), tolerance=tol) - ! same as starting flux: - @assertEqual(13._r8, flux_col_area(2), tolerance=tol) - @assertEqual(23._r8, flux_grc_area(2), tolerance=tol) - end subroutine areaIncreases - - @Test - subroutine colAreaIncreases(this) - ! Column area increases with no change in pwtcol; value should be decreased - ! appropriately; there should be no change in flux - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol(3) = [0.3_r8, 0.2_r8, 0.5_r8] - real(r8), parameter :: natveg_weight_old = 0.6_r8 - real(r8), parameter :: natveg_weight_new = 0.7_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: flux_col_area(4) - real(r8) :: flux_grc_area(4) - real(r8) :: expected_var2 - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol, & - pwtcol_new = pwtcol, & - natveg_weight_old = natveg_weight_old, & - natveg_weight_new = natveg_weight_new) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - flux_col_area = [12._r8, 13._r8, 14._r8, 15._r8] - flux_grc_area = [22._r8, 23._r8, 24._r8, 25._r8] - expected_var2 = var(2) * natveg_weight_old / natveg_weight_new - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - flux_out_col_area = flux_col_area, & - flux_out_grc_area = flux_grc_area) - - ! Verify - @assertEqual(expected_var2, var(2), tolerance=tol) - ! same as starting flux: - @assertEqual(13._r8, flux_col_area(2), tolerance=tol) - @assertEqual(23._r8, flux_grc_area(2), tolerance=tol) - end subroutine colAreaIncreases - - @Test - subroutine areaIncreasesFromZero(this) - ! if area increases from zero, var should be set to 0 - class(TestPSUpdater), intent(inout) :: this - real(r8), parameter :: pwtcol_old(3) = [0.5_r8, 0.0_r8, 0.5_r8] - real(r8), parameter :: pwtcol_new(3) = [0.4_r8, 0.1_r8, 0.5_r8] - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - - ! Setup - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var) - - ! Verify - @assertEqual(0._r8, var(2)) - end subroutine areaIncreasesFromZero - - @Test - subroutine areaIncreases_withSeed(this) - ! area increases from non-zero with an additional seed amount - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol_old(3) = [0.3_r8, 0.2_r8, 0.5_r8] - real(r8), parameter :: pwtcol_new(3) = [0.2_r8, 0.3_r8, 0.5_r8] - real(r8), parameter :: natveg_weight = 0.5_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: seed(4) - real(r8) :: seed_addition(4) - real(r8) :: expected_seed_addition - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new, & - natveg_weight_old = natveg_weight) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - seed = [0._r8, 9._r8, 0._r8, 0._r8] - seed_addition = [22._r8, 23._r8, 24._r8, 25._r8] - expected_seed_addition = seed_addition(2) + seed(2) * 0.1_r8 * natveg_weight - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - seed = seed, & - seed_addition = seed_addition) - - ! Verify - ! Expected value of var(2) is: - ! 3 * (pwtcol_old(2)/pwtcol_new(2)) + - ! seed(2) * (pwtcol_new(2) - pwtcol_old(2))/pwtcol_new(2) - ! = 3 * 2/3 + 9 * 1/3 - ! = 5 - @assertEqual(5._r8, var(2), tolerance=tol) - @assertEqual(expected_seed_addition, seed_addition(2), tolerance=tol) - end subroutine areaIncreases_withSeed - - @Test - subroutine colAreaIncreases_withSeed(this) - ! Column area increases with no change in pwtcol, with an additional seed amount - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol(3) = [0.3_r8, 0.2_r8, 0.5_r8] - real(r8), parameter :: natveg_weight_old = 0.6_r8 - real(r8), parameter :: natveg_weight_new = 0.7_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: seed(4) - real(r8) :: seed_addition(4) - real(r8) :: expected_var2 - real(r8) :: expected_seed_addition - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol, & - pwtcol_new = pwtcol, & - natveg_weight_old = natveg_weight_old, & - natveg_weight_new = natveg_weight_new) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - seed = [0._r8, 9._r8, 0._r8, 0._r8] - seed_addition = [22._r8, 23._r8, 24._r8, 25._r8] - ! In the calculation of expected_var2, we don't need pwtcol(2) because it doesn't - ! change. - expected_var2 = var(2) * natveg_weight_old / natveg_weight_new + & - seed(2) * (natveg_weight_new - natveg_weight_old) / natveg_weight_new - expected_seed_addition = seed_addition(2) + & - seed(2) * pwtcol(2) * (natveg_weight_new - natveg_weight_old) - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - seed = seed, & - seed_addition = seed_addition) - - ! Verify - @assertEqual(expected_var2, var(2), tolerance=tol) - @assertEqual(expected_seed_addition, seed_addition(2), tolerance=tol) - end subroutine colAreaIncreases_withSeed - - @Test - subroutine areaDecreases(this) - ! if area decreases, var should stay the same, and there should be a flux out - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol_old(3) = [0.2_r8, 0.3_r8, 0.5_r8] - real(r8), parameter :: pwtcol_new(3) = [0.3_r8, 0.2_r8, 0.5_r8] - real(r8), parameter :: natveg_weight = 0.5_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: flux_col_area(4) - real(r8) :: flux_grc_area(4) - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new, & - natveg_weight_old = natveg_weight) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - flux_col_area = [12._r8, 13._r8, 14._r8, 15._r8] - flux_grc_area = [22._r8, 23._r8, 24._r8, 25._r8] - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - flux_out_col_area = flux_col_area, & - flux_out_grc_area = flux_grc_area) - - ! Verify - ! flux_col_area(2) changes by (pwtcol_new(2) - pwtcol_old(2)) * var(2) - @assertEqual(13._r8 - 0.3_r8, flux_col_area(2), tolerance=tol) - ! flux_grc_area(2) changes by (pwtgcell_new(2) - pwtgcell_old(2)) * var(2) - @assertEqual(23._r8 - 0.15_r8, flux_grc_area(2), tolerance=tol) - ! same as starting state: - @assertEqual(3._r8, var(2)) - end subroutine areaDecreases - - @Test - subroutine colAreaDecreases(this) - ! Column area decreases; var should stay the same, and there should be a flux out - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol(3) = [0.2_r8, 0.3_r8, 0.5_r8] - real(r8), parameter :: natveg_weight_old = 0.9_r8 - real(r8), parameter :: natveg_weight_new = 0.8_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: flux_col_area(4) - real(r8) :: flux_grc_area(4) - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol, & - pwtcol_new = pwtcol, & - natveg_weight_old = natveg_weight_old, & - natveg_weight_new = natveg_weight_new) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - flux_col_area = [12._r8, 13._r8, 14._r8, 15._r8] - flux_grc_area = [22._r8, 23._r8, 24._r8, 25._r8] - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - flux_out_col_area = flux_col_area, & - flux_out_grc_area = flux_grc_area) - - ! Verify - ! flux_grc_area(2) changes by (pwtgcell_new(2) - pwtgcell_old(2)) * var(2) - @assertEqual(23._r8 - 0.09_r8, flux_grc_area(2), tolerance=tol) - ! flux_col_area(2) changes by: - ! ((pwtgcell_new(2) - pwtgcell_old(2)) / cwtgcell_old(2)) * var(2) - @assertEqual(13._r8 - 0.1_r8, flux_col_area(2), tolerance=tol) - ! same as starting state: - @assertEqual(3._r8, var(2)) - end subroutine colAreaDecreases - - @Test - subroutine multiplePatches_increase_zero_decrease(this) - ! Test multiple patches: one that increases, one with zero change, and one that - ! decreases. Make sure that new var and flux are correct in all of them - class(TestPSUpdater), intent(inout) :: this - real(r8), parameter :: pwtcol_old(3) = [0.2_r8, 0.5_r8, 0.3_r8] - real(r8), parameter :: pwtcol_new(3) = [0.3_r8, 0.5_r8, 0.2_r8] - real(r8), parameter :: natveg_weight = 0.5_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4), expected_var(4) - real(r8) :: flux_col_area(4), expected_flux_col_area(4) - real(r8) :: flux_grc_area(4), expected_flux_grc_area(4) - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new, & - natveg_weight_old = natveg_weight) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - expected_var = var - expected_var(1) = 4._r8 / 3._r8 - flux_col_area = [12._r8, 13._r8, 14._r8, 15._r8] - expected_flux_col_area = flux_col_area - expected_flux_col_area(3) = flux_col_area(3) - 0.4_r8 - flux_grc_area = [22._r8, 23._r8, 24._r8, 25._r8] - expected_flux_grc_area = flux_grc_area - ! flux_grc_area(3) changes by (pwtgcell_new(3) - pwtgcell_old(3)) * var(3) - expected_flux_grc_area(3) = flux_grc_area(3) - 0.2_r8 - - ! Exercise - call ps_updater%update_patch_state(bounds, & - this%numf, this%filter, var, & - flux_out_col_area = flux_col_area, & - flux_out_grc_area = flux_grc_area) - - ! Verify - @assertEqual(expected_var, var, tolerance=tol) - @assertEqual(expected_flux_col_area, flux_col_area, tolerance=tol) - @assertEqual(expected_flux_grc_area, flux_grc_area, tolerance=tol) - end subroutine multiplePatches_increase_zero_decrease - - @Test - subroutine areaDecreases_partitionFluxByType(this) - ! Test decrease in area with flux out partitioned into two pieces based on a variable - ! indexed by pft type - class(TestPSUpdater), intent(inout) :: this - ! The second patch is the patch of interest - real(r8), parameter :: pwtcol_old(3) = [0.2_r8, 0.3_r8, 0.5_r8] - real(r8), parameter :: pwtcol_new(3) = [0.3_r8, 0.2_r8, 0.5_r8] - real(r8), parameter :: natveg_weight = 0.5_r8 - integer, parameter :: patch2_type = 4 - integer, parameter :: pft_types(3) = [1, patch2_type, 1] - real(r8) :: flux1_fraction(0:mxpft) - real(r8), parameter :: patch2_flux_fraction = 0.6_r8 - type(patch_state_updater_type) :: ps_updater - real(r8) :: var(4) - real(r8) :: expected_total_flux, expected_flux1, expected_flux2 - real(r8) :: flux1(4), flux2(4) - - call this%do_all_setup_with_n_vegetated_patches(ps_updater, & - pwtcol_old = pwtcol_old, & - pwtcol_new = pwtcol_new, & - natveg_weight_old = natveg_weight, & - pft_types = pft_types) - - var = [2._r8, 3._r8, 4._r8, 5._r8] - flux1 = [12._r8, 13._r8, 14._r8, 15._r8] - flux2 = [22._r8, 23._r8, 24._r8, 25._r8] - - flux1_fraction(:) = 0._r8 - flux1_fraction(patch2_type) = patch2_flux_fraction - - ! Exercise - call ps_updater%update_patch_state_partition_flux_by_type(bounds, & - this%numf, this%filter, flux1_fraction, & - var, flux1, flux2) - - ! Verify - ! Note that fluxes in this routine are expressed as per-unit-area-gridcell - ! (equivalent to flux_grc_area in the main update_patch_state routine), - ! so total flux is (pwtgcell_old(2) - pwtgcell_new(2)) * var(2) - expected_total_flux = -0.15_r8 - expected_flux1 = expected_total_flux * patch2_flux_fraction - expected_flux2 = expected_total_flux * (1._r8 - patch2_flux_fraction) - ! For these assertions, we add the expected new flux to the original value of the flux: - @assertEqual(13._r8 + expected_flux1, flux1(2), tolerance=tol) - @assertEqual(23._r8 + expected_flux2, flux2(2), tolerance=tol) - end subroutine areaDecreases_partitionFluxByType - -end module test_patch_state_updater diff --git a/src/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt b/src/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt deleted file mode 100644 index 3e2e20e756..0000000000 --- a/src/dyn_subgrid/test/dynTimeInfo_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(dynTimeInfo test_dynTimeInfo_exe - "test_dynTimeInfo.pf" "") - -target_link_libraries(test_dynTimeInfo_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf b/src/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf deleted file mode 100644 index cdb1e394ec..0000000000 --- a/src/dyn_subgrid/test/dynTimeInfo_test/test_dynTimeInfo.pf +++ /dev/null @@ -1,559 +0,0 @@ -module test_dynTimeInfo - - ! Tests of the dynTimeInfo class - - use pfunit_mod - use dynTimeInfoMod - use shr_kind_mod, only: r8 => shr_kind_r8 - use unittestTimeManagerMod, only : unittest_timemgr_setup, unittest_timemgr_teardown - use unittestTimeManagerMod, only : set_date => unittest_timemgr_set_curr_date - use unittestTimeManagerMod, only : set_year => unittest_timemgr_set_curr_year - - implicit none - save - - integer, parameter :: dtime = 1800 - - @TestCase - type, extends(TestCase) :: TestDynTimeInfo - contains - procedure :: setUp - procedure :: tearDown - end type TestDynTimeInfo - -contains - - subroutine setUp(this) - class(TestDynTimeInfo), intent(inout) :: this - - call unittest_timemgr_setup(dtime=dtime) - - ! Make sure the date is set to the start of the year (such that the year differs - ! between the start and end of the timestep), to make sure that the appropriate - ! year_position is being used. - call set_date(yr=1, mon=1, day=1, tod=0) - end subroutine setUp - - subroutine tearDown(this) - class(TestDynTimeInfo), intent(inout) :: this - - call unittest_timemgr_teardown() - end subroutine tearDown - - ! ---------------------------------------------------------------------- - ! Tests of the constructor - ! ---------------------------------------------------------------------- - - @Test - subroutine test_constructor_normal_a(this) - ! test constructor in the normal case that cur_year is within the time bounds - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11, 12, 13, 14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(2, my_info%get_time_index_upper()) - @assertTrue(my_info%is_within_bounds()) - end subroutine test_constructor_normal_a - - @Test - subroutine test_constructor_normal_b(this) - ! another test of the constructor in the normal case that cur_year is within the time - ! bounds; this one tests the last interval - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(13) - my_info = time_info_type([11, 12, 13, 14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(3, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - @assertTrue(my_info%is_within_bounds()) - end subroutine test_constructor_normal_b - - @Test - subroutine test_constructor_early(this) - ! test constructor in the case when cur_year is prior to the first interval - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(10) - my_info = time_info_type([11, 12, 13], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(1, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_constructor_early - - @Test - subroutine test_constructor_late_a(this) - ! test constructor in the case when cur_year is just barely past the last interval - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(13) - my_info = time_info_type([11, 12, 13], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(3, my_info%get_time_index_lower()) - @assertEqual(3, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_constructor_late_a - - @Test - subroutine test_constructor_late_b(this) - ! test constructor in the case when cur_year is more than a year past the last interval - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(14) - my_info = time_info_type([11, 12, 13], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(3, my_info%get_time_index_lower()) - @assertEqual(3, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_constructor_late_b - - @Test - subroutine test_constructor_single_interval(this) - ! test constructor with a single interval (2 years) - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11, 12], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(2, my_info%get_time_index_upper()) - @assertTrue(my_info%is_within_bounds()) - end subroutine test_constructor_single_interval - - @Test - subroutine test_constructor_single_year(this) - ! test constructor with a single year - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(1, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_constructor_single_year - - - ! ---------------------------------------------------------------------- - ! Tests of get_yearfrac - ! ---------------------------------------------------------------------- - - @Test - subroutine test_getYearfrac_positionEnd_returnsCorrectValue(this) - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_date(yr=11, mon=1, day=1, tod=0) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(0._r8, my_info%get_yearfrac()) - end subroutine test_getYearfrac_positionEnd_returnsCorrectValue - - @Test - subroutine test_getYearfrac_positionStart_returnsCorrectValue(this) - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_date(yr=11, mon=1, day=1, tod=dtime) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_START_OF_TIMESTEP) - - @assertEqual(0._r8, my_info%get_yearfrac()) - end subroutine test_getYearfrac_positionStart_returnsCorrectValue - - ! ---------------------------------------------------------------------- - ! Tests of get_year - ! ---------------------------------------------------------------------- - - @Test - subroutine test_get_year(this) - ! Test the get_year routine - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertEqual(11, my_info%get_year(1)) - @assertEqual(12, my_info%get_year(2)) - @assertEqual(14, my_info%get_year(4)) - end subroutine test_get_year - - - ! ---------------------------------------------------------------------- - ! Tests of is_before_time_series and is_after_time_series - ! ---------------------------------------------------------------------- - - @Test - subroutine test_is_before_after_early(this) - ! Test is_before_time_series and is_after_time_series, when year is before the time - ! series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(10) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertTrue(my_info%is_before_time_series()) - @assertFalse(my_info%is_after_time_series()) - end subroutine test_is_before_after_early - - @Test - subroutine test_is_before_after_first(this) - ! Test is_before_time_series and is_after_time_series, when year is the first year in - ! the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertFalse(my_info%is_before_time_series()) - @assertFalse(my_info%is_after_time_series()) - end subroutine test_is_before_after_first - - @Test - subroutine test_is_before_after_mid(this) - ! Test is_before_time_series and is_after_time_series, when year is in the middle of - ! the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(12) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertFalse(my_info%is_before_time_series()) - @assertFalse(my_info%is_after_time_series()) - end subroutine test_is_before_after_mid - - @Test - subroutine test_is_before_after_last(this) - ! Test is_before_time_series and is_after_time_series, when year is in the last - ! interval of the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(13) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertFalse(my_info%is_before_time_series()) - @assertFalse(my_info%is_after_time_series()) - end subroutine test_is_before_after_last - - @Test - subroutine test_is_before_after_late(this) - ! Test is_before_time_series and is_after_time_series, when year is just past the end - ! of the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(14) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertFalse(my_info%is_before_time_series()) - @assertTrue(my_info%is_after_time_series()) - end subroutine test_is_before_after_late - - @Test - subroutine test_is_before_after_very_late(this) - ! Test is_before_time_series and is_after_time_series, when year is far past the end - ! of the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(15) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - - @assertFalse(my_info%is_before_time_series()) - @assertTrue(my_info%is_after_time_series()) - end subroutine test_is_before_after_very_late - - - - ! ---------------------------------------------------------------------- - ! Tests of set_current_year - typical scenarios - ! ---------------------------------------------------------------------- - - - @Test - subroutine test_update_no_change_early(this) - ! Test an update with no change in years, prior to start of time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(10) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call my_info%set_current_year() - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(1, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_no_change_early - - @Test - subroutine test_update_no_change_normal(this) - ! Test a normal update, no change in years - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call my_info%set_current_year() - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(2, my_info%get_time_index_upper()) - @assertTrue(my_info%is_within_bounds()) - end subroutine test_update_no_change_normal - - @Test - subroutine test_update_no_change_late(this) - ! Test an update with no change in years, just past the end of the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(14) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call my_info%set_current_year() - - @assertEqual(4, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_no_change_late - - @Test - subroutine test_update_no_change_very_late(this) - ! Test an update with no change in years, significantly past the end of the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(15) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call my_info%set_current_year() - - @assertEqual(4, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_no_change_very_late - - @Test - subroutine test_update_early(this) - ! Test an update, with a change in years, both before the start of the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(9) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(10) - call my_info%set_current_year() - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(1, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_early - - @Test - subroutine test_update_early_to_normal(this) - ! Test an update, with a change in years, from before the time series to inside it - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(10) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(11) - call my_info%set_current_year() - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(2, my_info%get_time_index_upper()) - @assertTrue(my_info%is_within_bounds()) - end subroutine test_update_early_to_normal - - @Test - subroutine test_update_normal(this) - ! Test an update, with a change in years, both within the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(12) - call my_info%set_current_year() - - @assertEqual(2, my_info%get_time_index_lower()) - @assertEqual(3, my_info%get_time_index_upper()) - @assertTrue(my_info%is_within_bounds()) - end subroutine test_update_normal - - @Test - subroutine test_update_normal_to_late(this) - ! Test an update, with a change in years, from within the time series to after it - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(13) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(14) - call my_info%set_current_year() - - @assertEqual(4, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_normal_to_late - - @Test - subroutine test_update_late(this) - ! Test an update, with a change in years, starting just after the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(14) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(15) - call my_info%set_current_year() - - @assertEqual(4, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_late - - @Test - subroutine test_update_very_late(this) - ! Test an update, with a change in years, both significantly after the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(15) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(16) - call my_info%set_current_year() - - @assertEqual(4, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - @assertFalse(my_info%is_within_bounds()) - end subroutine test_update_very_late - - ! ---------------------------------------------------------------------- - ! Tests of set_current_year - year decreasing - ! ---------------------------------------------------------------------- - - @Test - subroutine test_update_decreasing_early(this) - ! Test an update with decreasing years, starting before the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(10) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(9) - call my_info%set_current_year() - - @assertEqual(1, my_info%get_time_index_lower()) - @assertEqual(1, my_info%get_time_index_upper()) - end subroutine test_update_decreasing_early - - @Test - subroutine test_update_decreasing_normal(this) - ! Test an update with decreasing years, starting within the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(13) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(12) - call my_info%set_current_year() - - @assertEqual(2, my_info%get_time_index_lower()) - @assertEqual(3, my_info%get_time_index_upper()) - end subroutine test_update_decreasing_normal - - @Test - subroutine test_update_decreasing_late(this) - ! Test an update with decreasing years, starting after the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(14) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(13) - call my_info%set_current_year() - - @assertEqual(3, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - end subroutine test_update_decreasing_late - - ! ---------------------------------------------------------------------- - ! Tests of set_current_year - year increasing by more than 1 - ! ---------------------------------------------------------------------- - - @Test - subroutine test_update_by2_early(this) - ! Test an update by 2 years, starting before the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(10) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(12) - call my_info%set_current_year() - - @assertEqual(2, my_info%get_time_index_lower()) - @assertEqual(3, my_info%get_time_index_upper()) - end subroutine test_update_by2_early - - @Test - subroutine test_update_by2_normal(this) - ! Test an update by 2 years, starting within the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(11) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(13) - call my_info%set_current_year() - - @assertEqual(3, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - end subroutine test_update_by2_normal - - @Test - subroutine test_update_by2_late(this) - ! Test an update by 2 years, starting after the time series - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(14) - my_info = time_info_type([11,12,13,14], YEAR_POSITION_END_OF_TIMESTEP) - call set_year(16) - call my_info%set_current_year() - - @assertEqual(4, my_info%get_time_index_lower()) - @assertEqual(4, my_info%get_time_index_upper()) - end subroutine test_update_by2_late - - ! ---------------------------------------------------------------------- - ! Tests of alternative values of year_position - ! ---------------------------------------------------------------------- - - @Test - subroutine test_year_position_start_of_timestep(this) - ! make sure that, for year_position = YEAR_POSITION_START_OF_TIMESTEP, we truly get - ! the year from the start of the timestep - class(TestDynTimeInfo), intent(inout) :: this - type(time_info_type) :: my_info - - call set_year(13) - my_info = time_info_type([11, 12, 13, 14], YEAR_POSITION_START_OF_TIMESTEP) - - @assertEqual(2, my_info%get_time_index_lower()) - @assertEqual(3, my_info%get_time_index_upper()) - end subroutine test_year_position_start_of_timestep - -end module test_dynTimeInfo diff --git a/src/dyn_subgrid/test/dynVar_test/CMakeLists.txt b/src/dyn_subgrid/test/dynVar_test/CMakeLists.txt deleted file mode 100644 index 2fadf5d844..0000000000 --- a/src/dyn_subgrid/test/dynVar_test/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set (pfunit_sources - test_dynVarTimeUninterp.pf - test_dynVarTimeInterp.pf) - -# extra sources used for this test, which are not .pf files -set (extra_sources - test_dynVarShared.F90) - -create_pfUnit_test(dynVar test_dynVar_exe - "${pfunit_sources}" "${extra_sources}") - -target_link_libraries(test_dynVar_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 b/src/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 deleted file mode 100644 index be793ee8cb..0000000000 --- a/src/dyn_subgrid/test/dynVar_test/test_dynVarShared.F90 +++ /dev/null @@ -1,49 +0,0 @@ -module test_dynVarShared - ! Shared code to set up tests of dyn_var_type and its extensions - - use shr_kind_mod, only : r8 => shr_kind_r8 - use dynFileMod, only : dyn_file_type - use ncdio_pio, only : ncd_set_var - - implicit none - private - save - - public :: create_dyn_file - -contains - - function create_dyn_file() result(dyn_file) - ! Set up a dyn_file variable for tests. Assumes we're using the mock version of - ! dynFileMod. - ! - ! The years in the mock "file" go from 11 - 14. - - ! The "file" contains two variables: foo_1d, which is a 1-d variable (i.e., just space - ! & time, no level dimension); and foo_2d, which is a 2-d variable (i.e., includes a - ! level dimension) - - type(dyn_file_type) :: dyn_file - - real(r8) :: data1d(3,4) ! space & time only - real(r8) :: data2d(6,4) ! space & level & time; first two dimensions are [2,3] - - dyn_file = dyn_file_type([11,12,13,14]) - - data1d = reshape([1._r8, 2._r8, 3._r8, & ! year 11 - 4._r8, 5._r8, 6._r8, & ! year 12 - 7._r8, 8._r8, 9._r8, & ! year 13 - 10._r8,11._r8,12._r8], & ! year 14 - [3, 4]) - call ncd_set_var(dyn_file, 'foo_1d', data1d, [3]) - - data2d = reshape([ 1._r8, 2._r8, 3._r8, 4._r8, 5._r8, 6._r8, & ! year 11 - 7._r8, 8._r8, 9._r8, 10._r8, 11._r8, 12._r8, & ! year 12 - 13._r8, 14._r8, 15._r8, 16._r8, 17._r8, 18._r8, & ! year 13 - 19._r8, 20._r8, 21._r8, 22._r8, 23._r8, 24._r8],& ! year 14 - [6, 4]) - call ncd_set_var(dyn_file, 'foo_2d', data2d, [2, 3]) - - end function create_dyn_file - -end module test_dynVarShared diff --git a/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf b/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf deleted file mode 100644 index e50acf09a4..0000000000 --- a/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeInterp.pf +++ /dev/null @@ -1,356 +0,0 @@ -module test_dynVarTimeInterp - - ! Tests of dyn_var_time_interp - - use pfunit_mod - use shr_kind_mod, only : r8 => shr_kind_r8 - use dynVarTimeInterpMod, only : dyn_var_time_interp_type - use test_dynVarShared - use dynFileMod, only : dyn_file_type - use ncdio_pio, only : ncd_get_read_times, ncd_reset_read_times - use unittestTimeManagerMod, only : unittest_timemgr_setup, unittest_timemgr_teardown - use unittestTimeManagerMod, only : set_date => unittest_timemgr_set_curr_date - use unittestTimeManagerMod, only : set_year => unittest_timemgr_set_curr_year - - implicit none - save - - real(r8), parameter :: tol = 1.e-13_r8 - - @TestCase - type, extends(TestCase) :: TestDynVarTimeInterp - contains - procedure :: setUp - procedure :: tearDown - end type TestDynVarTimeInterp - -contains - - subroutine setUp(this) - class(TestDynVarTimeInterp), intent(inout) :: this - - ! Set the date to be 3/4 of the way into the year, so that interpolated values will - ! truly need to interpolate between the two years' values (rather than using, say, - ! Jan 1 at 0Z). - integer, parameter :: curr_yr = 1 - integer, parameter :: curr_mon = 10 - integer, parameter :: curr_day = 1 - integer, parameter :: curr_tod = 64800 - - call unittest_timemgr_setup() - call set_date(yr=curr_yr, mon=curr_mon, day=curr_day, tod=curr_tod) - end subroutine setUp - - subroutine tearDown(this) - class(TestDynVarTimeInterp), intent(inout) :: this - - call unittest_timemgr_teardown() - end subroutine tearDown - - @Test - subroutine test_get_current_data_1d_noReads(this) - ! Test get_current_data_1d with no reads after initialization - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - call var%get_current_data(data) - expected = [4.0_r8, 5.0_r8, 6.0_r8]*0.25_r8 + & - [7.0_r8, 8.0_r8, 9.0_r8]*0.75_r8 - @assertEqual(expected, data, tolerance=tol) - - ! Make sure that the above get_current_data call didn't trigger i/o: - @assertFalse(any(ncd_get_read_times(dyn_file, 'foo_1d'))) - - end subroutine test_get_current_data_1d_noReads - - @Test - subroutine test_get_current_data_1d_noReads_update(this) - ! Test get_current_data_1d with no reads after initialization, although it has an - ! set_current_year call that shouldn't do anything - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! make sure that a call to set_current_year with an unchanged year doesn't affect things at all - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - expected = [4.0_r8, 5.0_r8, 6.0_r8]*0.25_r8 + & - [7.0_r8, 8.0_r8, 9.0_r8]*0.75_r8 - @assertEqual(expected, data, tolerance=tol) - - ! Make sure that the above get_current_data call didn't trigger i/o: - @assertFalse(any(ncd_get_read_times(dyn_file, 'foo_1d'))) - - end subroutine test_get_current_data_1d_noReads_update - - - @Test - subroutine test_get_current_data_1d_noReads_conversion(this) - ! Test get_current_data_1d with no reads after initialization, with a conversion - ! factor - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=2.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - call var%get_current_data(data) - expected = [4.0_r8, 5.0_r8, 6.0_r8]*0.25_r8 + & - [7.0_r8, 8.0_r8, 9.0_r8]*0.75_r8 - expected = expected / 2.0_r8 - @assertEqual(expected, data, tolerance=tol) - - end subroutine test_get_current_data_1d_noReads_conversion - - - @Test - subroutine test_get_current_data_1d_yearsIncreaseBy1(this) - ! Test get_current_data_1d, where we move into the next interval so that both year - ! endpoints increase by 1. This should cause a read of new year 2's data, but - ! shouldn't need to read new year's 1 data - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - logical, allocatable :: read_times(:) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! advance to the next year, which should force a read - call set_year(13) - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - expected = [7.0_r8, 8.0_r8, 9.0_r8]*0.25_r8 + & - [10.0_r8, 11.0_r8, 12.0_r8]*0.75_r8 - @assertEqual(expected, data, tolerance=tol) - - ! Make sure that the above get_current_data call DID trigger i/o in this case. - ! However, it should only have triggered i/o for year 4, since year 3 should already - ! have been stored - read_times = ncd_get_read_times(dyn_file, 'foo_1d') - @assertTrue(read_times(4)) - @assertFalse(any(read_times(1:3))) - - end subroutine test_get_current_data_1d_yearsIncreaseBy1 - - @Test - subroutine test_get_current_data_1d_yearsIncreaseBy2(this) - ! Test get_current_data_1d, where we move forward by two intervals, so that both year - ! endpoints increase by 2. This should cause a read for both new end points. - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - logical, allocatable :: read_times(:) - - ! Set up test data - call set_year(11) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! advance by two years, which should force a read - call set_year(13) - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - expected = [7.0_r8, 8.0_r8, 9.0_r8]*0.25_r8 + & - [10.0_r8, 11.0_r8, 12.0_r8]*0.75_r8 - @assertEqual(expected, data, tolerance=tol) - - ! Make sure that the above get_current_data call DID trigger i/o in this case, for - ! both years 3 and 4. - read_times = ncd_get_read_times(dyn_file, 'foo_1d') - @assertTrue(read_times(3)) - @assertTrue(read_times(4)) - @assertFalse(any(read_times(1:2))) - - end subroutine test_get_current_data_1d_yearsIncreaseBy2 - - @Test - subroutine test_get_current_data_1d_year2Changes(this) - ! Test get_current_data_1d, where year 2 changes but not year 1. This would be the - ! case when we start prior to the time series, then enter the time series. In this - ! case, we should read year 2, but not year 1 data. - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - logical, allocatable :: read_times(:) - - ! Set up test data - call set_year(10) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! advance by a year, into the time series - call set_year(11) - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - expected = [1.0_r8, 2.0_r8, 3.0_r8]*0.25_r8 + & - [4.0_r8, 5.0_r8, 6.0_r8]*0.75_r8 - @assertEqual(expected, data, tolerance=tol) - - ! Make sure that the above get_current_data call DID trigger i/o in this case, but - ! just for year 2 - read_times = ncd_get_read_times(dyn_file, 'foo_1d') - @assertFalse(read_times(1)) - @assertTrue(read_times(2)) - @assertFalse(any(read_times(3:4))) - - end subroutine test_get_current_data_1d_year2Changes - - - @Test - subroutine test_get_current_data_1d_year1Changes(this) - ! Test get_current_data_1d, where year 1 changes but not year 2. This would be the - ! case when we start in the last interval of the time series, then exit the time - ! series. - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(3) - real(r8) :: expected(3) - logical, allocatable :: read_times(:) - - ! Set up test data - call set_year(13) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! advance by a year, past the end of the time series - call set_year(14) - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - expected = [10._r8, 11._r8, 12._r8] - @assertEqual(expected, data, tolerance=tol) - - ! Make sure that the above get_current_data call did NOT trigger i/o in this case - ! (year 2 is the same as before; year 1 should have gotten its data from the old year 2) - @assertFalse(any(ncd_get_read_times(dyn_file, 'foo_1d'))) - - end subroutine test_get_current_data_1d_year1Changes - - @Test - subroutine test_get_current_data_2d(this) - ! Test get_current_data_2d - class(TestDynVarTimeInterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_interp_type) :: var - real(r8) :: data(2,3) - real(r8) :: expected_time1(2,3), expected_time2(2,3), expected(2,3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_interp_type( & - dyn_file=dyn_file, & - varname='foo_2d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & ! setting this to false to avoid needing to set up the test data carefully - data_shape = shape(data)) - - call var%get_current_data(data) - expected_time1 = reshape([ 7._r8, 8._r8, 9._r8, 10._r8, 11._r8, 12._r8], [2,3]) - expected_time2 = reshape([13._r8, 14._r8, 15._r8, 16._r8, 17._r8, 18._r8], [2,3]) - expected = expected_time1 * 0.25_r8 + expected_time2 * 0.75_r8 - @assertEqual(expected, data, tolerance=tol) - - end subroutine test_get_current_data_2d - - -end module test_dynVarTimeInterp diff --git a/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf b/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf deleted file mode 100644 index 9f41a8c1ac..0000000000 --- a/src/dyn_subgrid/test/dynVar_test/test_dynVarTimeUninterp.pf +++ /dev/null @@ -1,198 +0,0 @@ -module test_dynVarTimeUninterp - - ! Tests of dyn_var_time_uninterp - - use pfunit_mod - use shr_kind_mod, only : r8 => shr_kind_r8 - use dynVarTimeUninterpMod, only : dyn_var_time_uninterp_type - use test_dynVarShared - use dynFileMod, only : dyn_file_type - use ncdio_pio, only : ncd_get_read_times, ncd_reset_read_times - use unittestTimeManagerMod, only : unittest_timemgr_setup, unittest_timemgr_teardown - use unittestTimeManagerMod, only : set_year => unittest_timemgr_set_curr_year - - implicit none - save - - real(r8), parameter :: tol = 1.e-13_r8 - - @TestCase - type, extends(TestCase) :: TestDynVarTimeUninterp - contains - procedure :: setUp - procedure :: tearDown - end type TestDynVarTimeUninterp - -contains - - subroutine setUp(this) - class(TestDynVarTimeUninterp), intent(inout) :: this - - call unittest_timemgr_setup() - end subroutine setUp - - subroutine tearDown(this) - class(TestDynVarTimeUninterp), intent(inout) :: this - - call unittest_timemgr_teardown() - end subroutine tearDown - - @Test - subroutine test_get_current_data_1d_noReads(this) - ! Test get_current_data_1d with no reads after initialization - class(TestDynVarTimeUninterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_uninterp_type) :: var - real(r8) :: data(3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_uninterp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - call var%get_current_data(data) - @assertEqual([4.0_r8, 5.0_r8, 6.0_r8], data) - - ! Make sure that the above get_current_data call didn't trigger i/o: - @assertFalse(any(ncd_get_read_times(dyn_file, 'foo_1d'))) - - end subroutine test_get_current_data_1d_noReads - - - @Test - subroutine test_get_current_data_1d_noReads_update(this) - ! Test get_current_data_1d with no reads after initialization, although it has an - ! set_current_year call that shouldn't do anything - class(TestDynVarTimeUninterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_uninterp_type) :: var - real(r8) :: data(3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_uninterp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! make sure that a call to set_current_year with an unchanged year doesn't affect things at all - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - @assertEqual([4.0_r8, 5.0_r8, 6.0_r8], data) - - ! Make sure that the above get_current_data call didn't trigger i/o: - @assertFalse(any(ncd_get_read_times(dyn_file, 'foo_1d'))) - - end subroutine test_get_current_data_1d_noReads_update - - - @Test - subroutine test_get_current_data_1d_noReads_conversion(this) - ! Test get_current_data_1d with no reads after initialization, with a conversion - ! factor - class(TestDynVarTimeUninterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_uninterp_type) :: var - real(r8) :: data(3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_uninterp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=2.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call var%get_current_data(data) - @assertEqual([2.0_r8, 2.5_r8, 3.0_r8], data, tolerance=tol) - - end subroutine test_get_current_data_1d_noReads_conversion - - - @Test - subroutine test_get_current_data_1d_doRead(this) - ! Test get_current_data_1d with an extra read after initialization - class(TestDynVarTimeUninterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_uninterp_type) :: var - real(r8) :: data(3) - logical, allocatable :: read_times(:) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_uninterp_type( & - dyn_file=dyn_file, & - varname='foo_1d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & - data_shape = shape(data)) - - call ncd_reset_read_times(dyn_file, 'foo_1d') - - ! advance to the next year, which should force a read - call set_year(13) - call dyn_file%time_info%set_current_year() - - call var%get_current_data(data) - @assertEqual([7.0_r8, 8.0_r8, 9.0_r8], data) - - ! Make sure that the get_current_data call DID trigger i/o in this case: - read_times = ncd_get_read_times(dyn_file, 'foo_1d') - @assertTrue(read_times(3)) - @assertFalse(any(read_times([1,2,4]))) - - end subroutine test_get_current_data_1d_doRead - - - @Test - subroutine test_get_current_data_2d(this) - ! Test get_current_data_2d - class(TestDynVarTimeUninterp), intent(inout) :: this - - type(dyn_file_type), target :: dyn_file - type(dyn_var_time_uninterp_type) :: var - real(r8) :: data(2,3) - real(r8) :: expected(2,3) - - ! Set up test data - call set_year(12) - dyn_file = create_dyn_file() - var = dyn_var_time_uninterp_type( & - dyn_file=dyn_file, & - varname='foo_2d', & - dim1name='grlnd', & - conversion_factor=1.0_r8, & - do_check_sums_equal_1 = .false., & ! setting this to false to avoid needing to set up the test data carefully - data_shape = shape(data)) - - call var%get_current_data(data) - expected = reshape([7._r8, 8._r8, 9._r8, 10._r8, 11._r8, 12._r8], [2,3]) - @assertEqual(expected, data) - - end subroutine test_get_current_data_2d - -end module test_dynVarTimeUninterp diff --git a/src/init_interp/CMakeLists.txt b/src/init_interp/CMakeLists.txt deleted file mode 100644 index 3baa8a8991..0000000000 --- a/src/init_interp/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -list(APPEND clm_sources - initInterpMindist.F90 - initInterpMultilevelBase.F90 - initInterpMultilevelCopy.F90 - initInterpMultilevelInterp.F90 - initInterpMultilevelSnow.F90 - initInterpMultilevelSplit.F90 - initInterpUtils.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 deleted file mode 100644 index a5f31584bc..0000000000 --- a/src/init_interp/initInterp.F90 +++ /dev/null @@ -1,1261 +0,0 @@ -module initInterpMod - - !----------------------------------------------------------------------- - ! Interpolate initial conditions file from one resolution and/or landmask - ! to another resolution and/or landmask - !----------------------------------------------------------------------- - -#include "shr_assert.h" - use initInterpBounds, only : interp_bounds_type - use initInterpMindist, only: set_mindist, set_single_match - use initInterpMindist, only: subgrid_type, subgrid_special_indices_type - use initInterp1dData, only : interp_1d_data - use initInterp2dvar, only: interp_2dvar_type - use initInterpMultilevelBase, only : interp_multilevel_type - use initInterpMultilevelContainer, only : interp_multilevel_container_type - use initInterpUtils, only: glc_elevclasses_are_same - use shr_kind_mod , only: r8 => shr_kind_r8, r4 => shr_kind_r4 - use shr_const_mod , only: SHR_CONST_PI, SHR_CONST_REARTH - use shr_sys_mod , only: shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_string_mod , only: shr_string_listGetName - use clm_varctl , only: iulog - use abortutils , only: endrun - use spmdMod , only: masterproc - use restUtilMod , only: iflag_interp, iflag_copy, iflag_skip, iflag_area - use glcBehaviorMod , only: glc_behavior_type - use ncdio_utils , only: find_var_on_file - use ncdio_pio - use pio - - implicit none - private - save - - ! Public methods - - public :: initInterp_readnl ! Read namelist - public :: initInterp - - ! Private methods - - private :: check_dim_subgrid - private :: check_dim_level - private :: skip_var - private :: findMinDist - private :: set_subgrid_info - private :: interp_0d_copy - private :: interp_1d_double - private :: interp_1d_int - private :: interp_2d_double - private :: limit_snlsno - - ! Private data - - character(len=8) :: created_glacier_mec_landunits - - ! Allowable interpolation methods - ! - interp_method_general: The general-purpose method - ! - interp_method_finidat_areas: Take areas and other related fields from the finidat - ! file, rather than maintaining them at the values from the surface dataset. This - ! only works for interpolation from one resolution to the same resolution, and with - ! basically the same configuration. This also triggers different logic for finding - ! matching points, assuring that we find exactly one match in the input for each - ! output point. - integer, parameter :: interp_method_general = 1 - integer, parameter :: interp_method_finidat_areas = 2 - - ! One of the above methods - integer :: interp_method - - ! If true, fill missing types with closest natural veg column (using bare soil for - ! patch-level variables) - logical :: init_interp_fill_missing_with_natveg - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !======================================================================= - - !----------------------------------------------------------------------- - subroutine initInterp_readnl(NLFilename) - ! - ! !DESCRIPTION: - ! Read the namelist for initInterp - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=64) :: init_interp_method - - character(len=*), parameter :: subname = 'initInterp_readnl' - !----------------------------------------------------------------------- - - namelist /clm_initinterp_inparm/ & - init_interp_method, init_interp_fill_missing_with_natveg - - ! Initialize options to default values, in case they are not specified in the namelist - init_interp_method = ' ' - init_interp_fill_missing_with_natveg = .false. - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in clm_initinterp_inparm namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_initinterp_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_initinterp_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading clm_initinterp_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding clm_initinterp_inparm namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (init_interp_method, mpicom) - call shr_mpi_bcast (init_interp_fill_missing_with_natveg, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'initInterp settings:' - write(iulog,nml=clm_initinterp_inparm) - write(iulog,*) ' ' - end if - - call translate_options(init_interp_method) - call check_nl_consistency() - - contains - subroutine translate_options(init_interp_method) - ! Translate string options into integer parameters - character(len=*), intent(in) :: init_interp_method - - select case (init_interp_method) - case ('general') - interp_method = interp_method_general - case ('use_finidat_areas') - interp_method = interp_method_finidat_areas - case default - write(iulog,*) 'Unknown value for init_interp_method: ', trim(init_interp_method) - call endrun('Unknown value for init_interp_method') - end select - end subroutine translate_options - - subroutine check_nl_consistency() - if (interp_method == interp_method_finidat_areas .and. & - init_interp_fill_missing_with_natveg) then - call endrun(msg='init_interp_method = use_finidat_areas is incompatible with init_interp_fill_missing_with_natveg') - end if - end subroutine check_nl_consistency - - end subroutine initInterp_readnl - - - subroutine initInterp (filei, fileo, bounds, glc_behavior) - - !----------------------------------------------------------------------- - ! Read initial data from netCDF instantaneous initial data history file - !----------------------------------------------------------------------- - - use decompMod, only: bounds_type - - ! -------------------------------------------------------------------- - ! arguments - character(len=*) , intent(in) :: filei !input initial dataset - character(len=*) , intent(in) :: fileo !output initial dataset - type(bounds_type) , intent(in) :: bounds - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! local variables - integer :: i,j,k,l,m,n ! loop indices - integer :: begi, endi ! beginning/ending indices - integer :: bego, endo ! beginning/ending indices - type(interp_bounds_type) :: bounds_i ! input file bounds - type(interp_bounds_type) :: bounds_o ! output file bounds - integer :: nlevi,nlevo ! input/output number of levels - type(file_desc_t), target :: ncidi, ncido ! input/output pio fileids - integer :: dimleni,dimleno ! input/output dimension length - integer :: nvars ! number of variables - character(len=256) :: varname ! variable name - character(len=256) :: varname_i_options ! possible variable names on input file - character(len=256) :: varname_i ! variable name on input file - character(len=16) :: vec_dimname ! subgrid dimension name - type(Var_desc_t) :: vardesc ! pio variable descriptor - integer :: xtypeo ! netCDF variable type - integer :: varido ! netCDF variable id - integer :: ndimso ! netCDF number of dimensions - integer :: dimidso(3) = -1 ! netCDF dimension ids - integer :: status ! return code - integer :: iflag_interpinic - real(r8) :: rvalue - integer :: ivalue - integer :: spinup_state_i, spinup_state_o - integer :: decomp_cascade_state_i, decomp_cascade_state_o - integer :: npftsi, ncolsi, nlunsi, ngrcsi - integer :: npftso, ncolso, nlunso, ngrcso - logical :: glc_elevclasses_same - integer , pointer :: pftindx(:) - integer , pointer :: colindx(:) - integer , pointer :: lunindx(:) - integer , pointer :: grcindx(:) - logical , pointer :: pft_activei(:), pft_activeo(:) - logical , pointer :: col_activei(:), col_activeo(:) - logical , pointer :: lun_activei(:), lun_activeo(:) - logical , pointer :: grc_activei(:), grc_activeo(:) - integer , pointer :: sgridindex(:) - type(subgrid_special_indices_type) :: subgrid_special_indices - type(interp_multilevel_container_type) :: interp_multilevel_container - type(interp_2dvar_type) :: var2d_i, var2d_o ! holds metadata for 2-d variables - !-------------------------------------------------------------------- - - if (masterproc) then - write (iulog,*) '**** Mapping clm initial data from input ',trim(filei),& - ' to output ',trim(fileo),' ****' - end if - - ! -------------------------------------------- - ! Open input and output initial conditions files (both just for reading now) - ! -------------------------------------------- - - call ncd_pio_openfile (ncidi, trim(filei) , 0) - call ncd_pio_openfile (ncido, trim(fileo), ncd_write) - - ! -------------------------------------------- - ! Determine dimensions and error checks on dimensions - ! -------------------------------------------- - - call check_dim_subgrid(ncidi, ncido, dimname ='pft' , dimleni=npftsi, dimleno=npftso) - call check_dim_subgrid(ncidi, ncido, dimname ='column' , dimleni=ncolsi, dimleno=ncolso) - call check_dim_subgrid(ncidi, ncido, dimname ='landunit', dimleni=nlunsi, dimleno=nlunso) - call check_dim_subgrid(ncidi, ncido, dimname ='gridcell', dimleni=ngrcsi, dimleno=ngrcso) - - if (masterproc) then - write (iulog,*) 'input gridcells = ',ngrcsi,' output gridcells = ',ngrcso - write (iulog,*) 'input landuntis = ',nlunsi,' output landunits = ',nlunso - write (iulog,*) 'input columns = ',ncolsi,' output columns = ',ncolso - write (iulog,*) 'input pfts = ',npftsi,' output pfts = ',npftso - end if - - ! NOTE(wjs, 2015-10-31) The inclusion of must_be_same in these checks essentially - ! duplicates checks done elsewhere - specifically, if the interpolator for a given - ! level dimension is the copy interpolator, then that will do its own checks to - ! ensure that the dimension sizes match. So we may want to remove the must_be_same - ! argument, and make check_dim_level purely informational, in order to remove this - ! maintenance problem - or maybe even remove check_dim_level entirely. - call check_dim_level(ncidi, ncido, dimname='levsno' , must_be_same=.false.) - call check_dim_level(ncidi, ncido, dimname='levsno1', must_be_same=.false.) - call check_dim_level(ncidi, ncido, dimname='levcan' , must_be_same=.true.) - call check_dim_level(ncidi, ncido, dimname='levlak' , must_be_same=.true.) - call check_dim_level(ncidi, ncido, dimname='levtot' , must_be_same=.false.) - call check_dim_level(ncidi, ncido, dimname='levgrnd', must_be_same=.false.) - call check_dim_level(ncidi, ncido, dimname='numrad' , must_be_same=.true.) - - glc_elevclasses_same = glc_elevclasses_are_same(ncidi, ncido) - if (masterproc) then - write(iulog,*) 'Glacier elevation classes same in input and output?: ', & - glc_elevclasses_same - end if - - ! -------------------------------------------- - ! Determine input file global attributes that are needed - ! -------------------------------------------- - - status = pio_get_att(ncidi, pio_global, & - 'ipft_not_vegetated', & - subgrid_special_indices%ipft_not_vegetated) - status = pio_get_att(ncidi, pio_global, & - 'icol_vegetated_or_bare_soil', & - subgrid_special_indices%icol_vegetated_or_bare_soil) - status = pio_get_att(ncidi, pio_global, & - 'ilun_vegetated_or_bare_soil', & - subgrid_special_indices%ilun_vegetated_or_bare_soil) - status = pio_get_att(ncidi, pio_global, & - 'ilun_crop', & - subgrid_special_indices%ilun_crop) - status = pio_get_att(ncidi, pio_global, & - 'ilun_landice_multiple_elevation_classes', & - subgrid_special_indices%ilun_landice_multiple_elevation_classes) - status = pio_get_att(ncidi, pio_global, & - 'created_glacier_mec_landunits', & - created_glacier_mec_landunits) - - if (masterproc) then - write(iulog,*)'ipft_not_vegetated = ' , & - subgrid_special_indices%ipft_not_vegetated - write(iulog,*)'icol_vegetated_or_bare_soil = ' , & - subgrid_special_indices%icol_vegetated_or_bare_soil - write(iulog,*)'ilun_vegetated_or_bare_soil = ' , & - subgrid_special_indices%ilun_vegetated_or_bare_soil - write(iulog,*)'ilun_crop = ' , & - subgrid_special_indices%ilun_crop - write(iulog,*)'ilun_landice_multiple_elevation_classes = ' , & - subgrid_special_indices%ilun_landice_multiple_elevation_classes - write(iulog,*)'create_glacier_mec_landunits = ', & - trim(created_glacier_mec_landunits) - end if - - ! -------------------------------------------- - ! Find closest values for pfts, cols, landunits, gridcells - ! -------------------------------------------- - - bounds_i = interp_bounds_type( & - begp = 1, endp = npftsi, & - begc = 1, endc = ncolsi, & - begl = 1, endl = nlunsi, & - begg = 1, endg = ngrcsi) - - ! It is important for bounds_o to match the passed-in bounds - i.e., for the - ! decomposition within init_interp to match the model's decomposition. This way we - ! can access other information for the output configuration that is not contained in - ! the restart file. - bounds_o = interp_bounds_type( & - begp = bounds%begp, endp = bounds%endp, & - begc = bounds%begc, endc = bounds%endc, & - begl = bounds%begl, endl = bounds%endl, & - begg = bounds%begg, endg = bounds%endg) - - allocate(pft_activei(bounds_i%get_begp():bounds_i%get_endp())) - allocate(col_activei(bounds_i%get_begc():bounds_i%get_endc())) - allocate(lun_activei(bounds_i%get_begl():bounds_i%get_endl())) - allocate(grc_activei(bounds_i%get_begg():bounds_i%get_endg())) - - allocate(pft_activeo(bounds_o%get_begp():bounds_o%get_endp())) - allocate(col_activeo(bounds_o%get_begc():bounds_o%get_endc())) - allocate(lun_activeo(bounds_o%get_begl():bounds_o%get_endl())) - allocate(grc_activeo(bounds_o%get_begg():bounds_o%get_endg())) - - allocate(pftindx(bounds_o%get_begp():bounds_o%get_endp())) - allocate(colindx(bounds_o%get_begc():bounds_o%get_endc())) - allocate(lunindx(bounds_o%get_begl():bounds_o%get_endl())) - allocate(grcindx(bounds_o%get_begg():bounds_o%get_endg())) - - ! For each output pft, find the input pft, pftindx, that is closest - - if (masterproc) then - write(iulog,*)'finding minimum distance for pfts' - end if - vec_dimname = 'pft' - call findMinDist(vec_dimname, bounds_i%get_begp(), bounds_i%get_endp(), & - bounds_o%get_begp(), bounds_o%get_endp(), ncidi, ncido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - pft_activei, pft_activeo, pftindx ) - - ! For each output column, find the input column, colindx, that is closest - - if (masterproc) then - write(iulog,*)'finding minimum distance for columns' - end if - vec_dimname = 'column' - call findMinDist(vec_dimname, bounds_i%get_begc(), bounds_i%get_endc(), & - bounds_o%get_begc(), bounds_o%get_endc(), ncidi, ncido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - col_activei, col_activeo, colindx ) - - ! For each output landunit, find the input landunit, lunindx, that is closest - - if (masterproc) then - write(iulog,*)'finding minimum distance for landunits' - end if - vec_dimname = 'landunit' - call findMinDist(vec_dimname, bounds_i%get_begl(), bounds_i%get_endl(), & - bounds_o%get_begl(), bounds_o%get_endl(), ncidi, ncido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - lun_activei, lun_activeo, lunindx ) - - ! For each output gridcell, find the input gridcell, grcindx, that is closest - - if (masterproc) then - write(iulog,*)'finding minimum distance for gridcells' - end if - vec_dimname = 'gridcell' - call findMinDist(vec_dimname, bounds_i%get_begg(), bounds_i%get_endg(), & - bounds_o%get_begg(), bounds_o%get_endg(), ncidi, ncido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - grc_activei, grc_activeo, grcindx) - - ! ------------------------------------------------------------------------ - ! Set up interpolators for multi-level variables - ! ------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*)'setting up interpolators for multi-level variables' - end if - interp_multilevel_container = interp_multilevel_container_type( & - ncid_source = ncidi, ncid_dest = ncido, & - bounds_source = bounds_i, bounds_dest = bounds_o, & - pftindex = pftindx, colindex = colindx) - - !------------------------------------------------------------------------ - ! Read input initial data and write output initial data - !------------------------------------------------------------------------ - - ! Only examing the snow interfaces above zi=0 => zisno and zsno have - ! the same level dimension below - - ! Read input initial data and write output initial data - ! Only examing the snow interfaces above zi=0 => zisno and zsno have - ! the same level dimension below - - if (masterproc) then - write(iulog,*)'reading in initial dataset' - end if - ! Get number of output variables and loop over them - status = pio_inquire(ncido, nVariables=nvars) - do varido = 1, nvars - - !--------------------------------------------------- - ! Given varido, get out variable data - !--------------------------------------------------- - - status = pio_inquire_variable(ncido, varid=varido, name=varname, & - xtype=xtypeo, ndims=ndimso, dimids=dimidso) - - !--------------------------------------------------- - ! If variable is zsoi, SKIP this variable - !--------------------------------------------------- - - if ( trim(varname) == 'zsoi' ) then - if (masterproc) then - write(iulog,*) 'Skipping : ',trim(varname) - end if - CYCLE - end if - - !--------------------------------------------------- - ! If interpinic flag is set to skip on output file - ! SKIP this variable - !--------------------------------------------------- - - status = pio_inq_varid (ncido, trim(varname), vardesc) - status = pio_get_att(ncido, vardesc, 'interpinic_flag', iflag_interpinic) - if (skip_var(iflag_interpinic)) then - if (masterproc) then - write (iulog,*) 'Skipping : ', trim(varname) - end if - CYCLE - end if - - !--------------------------------------------------- - ! Read metadata telling us possible variable names on input file; - ! determine which of these is present on the input file - !--------------------------------------------------- - - ! 'varnames_on_old_files' is a colon-delimited list of possible variable names, - ! enabling backwards compatibility with old input files - status = pio_get_att(ncido, vardesc, 'varnames_on_old_files', varname_i_options) - - ! We expect the first name in the list to match the current variable name. If that - ! isn't true, abort. This check is mainly to catch behavior changes in the code to - ! write this attribute in restUtilMod: Significant changes in behavior there need - ! to be matched by corresponding changes in this module. For example, if - ! restUtilMod changes this attribute to exclude the first name (which, after all, - ! is available via the variable name itself), then code in this module should - ! change accordingly. - call shr_string_listGetName(varname_i_options, 1, varname_i) - if (varname_i /= varname) then - if (masterproc) then - write(iulog,*) 'ERROR: expect first element in varnames_on_old_files to match varname' - write(iulog,*) 'varname = ', trim(varname) - write(iulog,*) 'varnames_on_old_files = ', trim(varname_i_options) - write(iulog,*) 'This likely indicates that the code to write the' - write(iulog,*) 'varnames_on_old_files attribute list has changed behavior.' - end if - call endrun(msg='ERROR: expect first element in varnames_on_old_files to match varname'// & - errMsg(sourcefile, __LINE__)) - end if - - ! Find which of the list of possible variables actually exists on the input file. - call find_var_on_file(ncidi, varname_i_options, varname_i) - - ! Note that, if none of the options are found, varname_i will be set to the first - ! variable in the list, in which case the following code will determine that we - ! should skip this variable. - - !--------------------------------------------------- - ! If variable is on output file - but not on input file - ! SKIP this variable - !--------------------------------------------------- - - call pio_seterrorhandling(ncidi, PIO_BCAST_ERROR) - status = pio_inq_varid(ncidi, name=varname_i, vardesc=vardesc) - call pio_seterrorhandling(ncidi, PIO_INTERNAL_ERROR) - if (status /= PIO_noerr) then - if (masterproc) then - write (iulog,*) 'Skipping : ', trim(varname), ' variable is NOT on input file' - end if - CYCLE - end if - - !--------------------------------------------------- - ! For scalar outut variables - !--------------------------------------------------- - - if ( ndimso == 0 ) then - - if ( trim(varname) .eq. 'spinup_state' ) then - - ! since we are copying soil variables, need to also copy spinup state - ! since otherwise if they are different then it will break the spinup procedure - status = pio_inq_varid(ncidi, trim(varname_i), vardesc) - status = pio_get_var(ncidi, vardesc, spinup_state_i) - status = pio_inq_varid(ncido, trim(varname), vardesc) - status = pio_get_var(ncido, vardesc, spinup_state_o) - if ( spinup_state_i /= spinup_state_o ) then - if (masterproc) then - write (iulog,*) 'Spinup states are different: Copying: ', & - trim(varname_i), ' => ', trim(varname) - end if - status = pio_put_var(ncido, vardesc, spinup_state_i) - else - if (masterproc) then - write (iulog,*) 'Spinup states match: Skipping: ', & - trim(varname_i), ' => ', trim(varname) - end if - endif - - else if ( trim(varname) .eq. 'decomp_cascade_state' ) then - - ! ditto for the decomposition cascade - status = pio_inq_varid(ncidi, trim(varname_i), vardesc) - status = pio_get_var(ncidi, vardesc, decomp_cascade_state_i) - status = pio_inq_varid(ncido, trim(varname), vardesc) - status = pio_get_var(ncido, vardesc, decomp_cascade_state_o) - if ( decomp_cascade_state_i /= decomp_cascade_state_o ) then - call endrun(msg='ERROR: Decomposition cascade states are different'//errMsg(sourcefile, __LINE__)) - else - if (masterproc) then - write (iulog,*) 'Decomposition cascade states match: Skipping: ', & - trim(varname_i), ' => ', trim(varname) - end if - endif - - else if (iflag_interpinic == iflag_copy) then - - call interp_0d_copy(varname, varname_i, xtypeo, ncidi, ncido) - - else if (iflag_interpinic == iflag_skip) then - - if (masterproc) then - write(iulog,*) 'Skipping : ',trim(varname) - end if - - else - - if (masterproc) then - write(iulog,*) 'Bad interpinic flag for scalar variable ', trim(varname), & - ': ', iflag_interpinic - call endrun(msg='Bad interpinic flag for scalar variable'//errMsg(sourcefile, __LINE__)) - end if - - end if - - !--------------------------------------------------- - ! For 1D output variables - !--------------------------------------------------- - - else if ( ndimso == 1 ) then - - status = pio_inq_dimname(ncido, dimidso(1), vec_dimname) - begi = bounds_i%get_beg(vec_dimname) - endi = bounds_i%get_end(vec_dimname) - bego = bounds_o%get_beg(vec_dimname) - endo = bounds_o%get_end(vec_dimname) - if ( vec_dimname == 'pft' )then - sgridindex => pftindx - else if ( vec_dimname == 'column' )then - sgridindex => colindx - else if ( vec_dimname == 'landunit' )then - sgridindex => lunindx - else if ( vec_dimname == 'gridcell' )then - sgridindex => grcindx - else - call endrun(msg='ERROR interpinic: 1D variable '//trim(varname)//& - 'with unknown subgrid dimension: '//trim(vec_dimname)//& - errMsg(sourcefile, __LINE__)) - end if - - if ( xtypeo == pio_int )then - call interp_1d_int ( varname, varname_i, vec_dimname, begi, endi, bego, endo, & - ncidi, ncido, sgridindex ) - else if ( xtypeo == pio_double )then - call interp_1d_double( varname, varname_i, vec_dimname, begi, endi, bego, endo, & - ncidi, ncido, sgridindex ) - else - call endrun(msg='ERROR interpinic: 1D variable with unknown type: '//& - trim(varname)//errMsg(sourcefile, __LINE__)) - end if - - !--------------------------------------------------- - ! For 2D output variables - !--------------------------------------------------- - - else if ( ndimso == 2 )then - - if ( xtypeo /= pio_double )then - call endrun(msg='ERROR interpinic: 2D variable with unknown type: '//& - trim(varname)//errMsg(sourcefile, __LINE__)) - end if - - var2d_i = interp_2dvar_type( & - varname = varname_i, & - ncid = ncidi, & - file_is_dest = .false., & - bounds = bounds_i) - - var2d_o = interp_2dvar_type( & - varname = varname, & - ncid = ncido, & - file_is_dest = .true., & - bounds = bounds_o) - - vec_dimname = var2d_o%get_vec_dimname() - begi = bounds_i%get_beg(vec_dimname) - endi = bounds_i%get_end(vec_dimname) - bego = bounds_o%get_beg(vec_dimname) - endo = bounds_o%get_end(vec_dimname) - if ( vec_dimname == 'pft' )then - sgridindex => pftindx - else if ( vec_dimname == 'column' )then - sgridindex => colindx - else if ( vec_dimname == 'landunit' )then - sgridindex => lunindx - else if ( vec_dimname == 'gridcell' )then - sgridindex => grcindx - else - call endrun(msg='ERROR interpinic: 2D variable with unknown subgrid dimension: '//& - trim(varname)//errMsg(sourcefile, __LINE__)) - end if - call interp_2d_double(var2d_i, var2d_o, & - begi, endi, bego, endo, & - sgridindex, & - interp_multilevel_container) - - else - - call endrun(msg='ERROR interpinic: variable NOT scalar, 1D or 2D: '//& - trim(varname)//errMsg(sourcefile, __LINE__)) - - end if - call shr_sys_flush(iulog) - - end do - ! Close input file - - call pio_closefile(ncidi) - - ! Do some final cleanup of specific variables - ! - ! NOTE(wjs, 2015-10-31) I really don't like having this variable-specific logic here, - ! but I can't see a great way around this. (One alternative would be to do this - ! cleanup when reading the restart file, e.g., in subgridRestMod. But (1) that feels - ! like a hidden way to accomplish this, and (2) that would apply for *any* restart - ! read, as opposed to just restart reads following init_interp, which could mask - ! problems with other restart files.) - - ! Need to first sync the file so the previous writes complete before we try to re-read - ! variables - call pio_syncfile(ncido) - - ! BUG: (EBK, 2016-1-6, bugz: 2261) PIO2 in cime4.3.9 has a bug where you can't do - ! two writes of the same variable to a file. So we have to close and reopen the file. - ! When PIO2 is robust enough to handle that we can remove the following two lines. - call pio_closefile(ncido) - call ncd_pio_openfile (ncido, trim(fileo), ncd_write) - ! ENDBUG: - - if (masterproc) then - write(iulog,*) 'Cleaning up / adjusting variables' - end if - - call limit_snlsno(ncido, bounds_o) - - - ! Close output file - - call pio_closefile(ncido) - - if (masterproc) then - write (iulog,*) ' Successfully created initial condition file mapped from input IC file' - end if - - end subroutine initInterp - - !----------------------------------------------------------------------- - function skip_var(iflag_interpinic) - ! - ! !DESCRIPTION: - ! Logical function saying whether we should skip a given variable given - ! iflag_interpinic and interp_method - ! - ! !ARGUMENTS: - logical :: skip_var ! function result - integer, intent(in) :: iflag_interpinic - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'skip_var' - !----------------------------------------------------------------------- - - if (iflag_interpinic == iflag_skip) then - skip_var = .true. - else if (iflag_interpinic == iflag_area) then - select case (interp_method) - case (interp_method_general) - skip_var = .true. - case (interp_method_finidat_areas) - skip_var = .false. - case default - call endrun(msg='Unhandled interp_method'//errMsg(sourcefile, __LINE__)) - end select - else - skip_var = .false. - end if - - end function skip_var - - - !======================================================================= - - subroutine findMinDist( dimname, begi, endi, bego, endo, ncidi, ncido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - activei, activeo, minindx) - - ! -------------------------------------------------------------------- - ! - ! Find the PATCH distances based on the column distances already calculated - ! - ! arguments - character(len=*) , intent(inout) :: dimname - integer , intent(in) :: begi, endi - integer , intent(in) :: bego, endo - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - type(subgrid_special_indices_type), intent(in) :: subgrid_special_indices - type(glc_behavior_type), intent(in) :: glc_behavior - logical , intent(in) :: glc_elevclasses_same - logical , intent(out) :: activei(begi:endi) - logical , intent(out) :: activeo(bego:endo) - integer , intent(out) :: minindx(bego:endo) - ! - ! local variables - type(subgrid_type) :: subgridi - type(subgrid_type) :: subgrido - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*)'calling set_subgrid_info for ',trim(dimname), ' for input' - end if - call set_subgrid_info(beg=begi, end=endi, dimname=dimname, use_glob=.true., & - ncid=ncidi, active=activei, subgrid=subgridi) - - if (masterproc) then - write(iulog,*)'calling set_subgrid_info for ',trim(dimname), ' for output' - end if - call set_subgrid_info(beg=bego, end=endo, dimname=dimname, use_glob=.false., & - ncid=ncido, active=activeo, subgrid=subgrido) - - select case (interp_method) - case (interp_method_general) - if (masterproc) then - write(iulog,*) 'calling set_mindist for ',trim(dimname) - end if - call set_mindist(begi=begi, endi=endi, bego=bego, endo=endo, & - activei=activei, activeo=activeo, subgridi=subgridi, subgrido=subgrido, & - subgrid_special_indices=subgrid_special_indices, & - glc_behavior=glc_behavior, & - glc_elevclasses_same=glc_elevclasses_same, & - fill_missing_with_natveg=init_interp_fill_missing_with_natveg, & - mindist_index=minindx) - case (interp_method_finidat_areas) - if (masterproc) then - write(iulog,*) 'calling set_single_match for ',trim(dimname) - end if - call set_single_match(begi=begi, endi=endi, bego=bego, endo=endo, & - activeo=activeo, subgridi=subgridi, subgrido=subgrido, & - subgrid_special_indices=subgrid_special_indices, & - glc_behavior=glc_behavior, & - glc_elevclasses_same=glc_elevclasses_same, & - mindist_index=minindx) - case default - write(iulog,*) 'findMinDist: unhandled interp_method: ', interp_method - call endrun('Unhandled interp_method'//errMsg(sourcefile, __LINE__)) - end select - - deallocate(subgridi%lat, subgridi%lon, subgridi%coslat) - deallocate(subgrido%lat, subgrido%lon, subgrido%coslat) - - end subroutine findMinDist - - !======================================================================= - - subroutine set_subgrid_info(beg, end, dimname, use_glob, ncid, active, subgrid) - - ! -------------------------------------------------------------------- - ! arguments - integer , intent(in) :: beg, end - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: dimname - logical , intent(in) :: use_glob ! if .true., use the 'glob' form of ncd_io - logical , intent(out) :: active(beg:end) - type(subgrid_type) , intent(inout) :: subgrid - ! - ! local variables - integer :: n - integer, pointer :: itemp(:) - real(r8), parameter :: deg2rad = SHR_CONST_PI/180._r8 - !----------------------------------------------------------------------- - - subgrid%name = dimname - - allocate(itemp(beg:end)) - allocate(subgrid%lat(beg:end), subgrid%lon(beg:end), subgrid%coslat(beg:end)) - if (dimname == 'pft') then - allocate(subgrid%ptype(beg:end), subgrid%ctype(beg:end), subgrid%ltype(beg:end)) - else if (dimname == 'column') then - allocate(subgrid%ctype(beg:end), subgrid%ltype(beg:end)) - else if (dimname == 'landunit') then - allocate(subgrid%ltype(beg:end)) - end if - - ! determine if is_glcmec from global attributes - if (trim(created_glacier_mec_landunits) == 'true') then - if (dimname == 'pft' .or. dimname == 'column') then - allocate(subgrid%topoglc(beg:end)) - end if - end if - - if (dimname == 'pft') then - call read_var_double(ncid=ncid, varname='pfts1d_lon' , data=subgrid%lon , dim1name='pft', use_glob=use_glob) - call read_var_double(ncid=ncid, varname='pfts1d_lat' , data=subgrid%lat , dim1name='pft', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='pfts1d_itypveg', data=subgrid%ptype, dim1name='pft', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='pfts1d_itypcol', data=subgrid%ctype, dim1name='pft', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='pfts1d_ityplun', data=subgrid%ltype, dim1name='pft', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='pfts1d_active' , data=itemp , dim1name='pft', use_glob=use_glob) - if (associated(subgrid%topoglc)) then - call read_var_double(ncid=ncid, varname='pfts1d_topoglc', data=subgrid%topoglc, dim1name='pft', use_glob=use_glob) - end if - else if (dimname == 'column') then - call read_var_double(ncid=ncid, varname='cols1d_lon' , data=subgrid%lon , dim1name='column', use_glob=use_glob) - call read_var_double(ncid=ncid, varname='cols1d_lat' , data=subgrid%lat , dim1name='column', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='cols1d_ityp' , data=subgrid%ctype, dim1name='column', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='cols1d_ityplun', data=subgrid%ltype, dim1name='column', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='cols1d_active' , data=itemp , dim1name='column', use_glob=use_glob) - if (associated(subgrid%topoglc)) then - call read_var_double(ncid=ncid, varname='cols1d_topoglc', data=subgrid%topoglc, dim1name='column', use_glob=use_glob) - end if - else if (dimname == 'landunit') then - call read_var_double(ncid=ncid, varname='land1d_lon' , data=subgrid%lon , dim1name='landunit', use_glob=use_glob) - call read_var_double(ncid=ncid, varname='land1d_lat' , data=subgrid%lat , dim1name='landunit', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='land1d_ityplun', data=subgrid%ltype, dim1name='landunit', use_glob=use_glob) - call read_var_int(ncid=ncid, varname='land1d_active' , data=itemp , dim1name='landunit', use_glob=use_glob) - else if (dimname == 'gridcell') then - call read_var_double(ncid=ncid, varname='grid1d_lon' , data=subgrid%lon , dim1name='gridcell', use_glob=use_glob) - call read_var_double(ncid=ncid, varname='grid1d_lat' , data=subgrid%lat , dim1name='gridcell', use_glob=use_glob) - - ! All gridcells in the restart file are active - itemp(beg:end) = 1 - end if - - do n = beg,end - if (itemp(n) > 0) then - active(n) = .true. - else - active(n) = .false. - end if - subgrid%lat(n) = subgrid%lat(n)*deg2rad - subgrid%lon(n) = subgrid%lon(n)*deg2rad - subgrid%coslat(n) = cos(subgrid%lat(n)) - end do - - deallocate(itemp) - - contains - - subroutine read_var_double(ncid, varname, data, dim1name, use_glob) - ! Wraps the ncd_io call, providing logic related to whether we're using the 'glob' - ! form of ncd_io - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: varname - real(r8), pointer , intent(inout) :: data(:) - character(len=*) , intent(in) :: dim1name - logical , intent(in) :: use_glob ! if .true., use the 'glob' form of ncd_io - - if (use_glob) then - call ncd_io(ncid=ncid, varname=varname, flag='read', data=data) - else - call ncd_io(ncid=ncid, varname=varname, flag='read', data=data, dim1name=dim1name) - end if - end subroutine read_var_double - - subroutine read_var_int(ncid, varname, data, dim1name, use_glob) - ! Wraps the ncd_io call, providing logic related to whether we're using the 'glob' - ! form of ncd_io - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: varname - integer, pointer , intent(inout) :: data(:) - character(len=*) , intent(in) :: dim1name - logical , intent(in) :: use_glob ! if .true., use the 'glob' form of ncd_io - - if (use_glob) then - call ncd_io(ncid=ncid, varname=varname, flag='read', data=data) - else - call ncd_io(ncid=ncid, varname=varname, flag='read', data=data, dim1name=dim1name) - end if - end subroutine read_var_int - - end subroutine set_subgrid_info - - !======================================================================= - - subroutine interp_0d_copy (varname, varname_i, xtype, ncidi, ncido) - - ! -------------------------------------------------------------------- - ! arguments - character(len=*) , intent(inout) :: varname ! variable name on output file - character(len=*) , intent(in) :: varname_i ! variable name on input file - integer , intent(in) :: xtype - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - ! - ! local variables - integer :: ivalue - real(r8):: rvalue - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Copying : ',trim(varname_i), ' => ', trim(varname) - end if - - if (xtype == pio_int) then - call ncd_io(ncid=ncidi, varname=trim(varname_i), flag='read' , data=ivalue) - call ncd_io(ncid=ncido, varname=trim(varname), flag='write', data=ivalue) - else if (xtype == pio_double) then - call ncd_io(ncid=ncidi, varname=trim(varname_i), flag='read' , data=rvalue) - call ncd_io(ncid=ncido, varname=trim(varname), flag='write', data=rvalue) - else - if (masterproc) then - write(iulog,*)'ERROR interpinic: unhandled case for var ',trim(varname),' stopping' - end if - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine interp_0d_copy - - !======================================================================= - - subroutine interp_1d_double (varname, varname_i, dimname, begi, endi, bego, endo, ncidi, ncido, & - sgridindex) - - ! ------------------------ arguments --------------------------------- - character(len=*) , intent(inout) :: varname ! variable name on output file - character(len=*) , intent(in) :: varname_i ! variable name on input file - character(len=*) , intent(inout) :: dimname - integer , intent(in) :: begi, endi - integer , intent(in) :: bego, endo - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - integer , intent(in) :: sgridindex(bego:endo) - ! -------------------------------------------------------------------- - - ! ------------------------ local variables -------------------------- - real(r8), pointer :: rbufsli(:) ! input array - real(r8), pointer :: rbufslo(:) ! output array - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Interpolating: ',trim(varname_i), ' => ', trim(varname) - end if - - allocate (rbufsli(begi:endi), rbufslo(bego:endo)) - call ncd_io(ncid=ncidi, varname=trim(varname_i), flag='read', data=rbufsli) - call ncd_io(ncid=ncido, varname=trim(varname), flag='read', data=rbufslo, & - dim1name=dimname) - - call interp_1d_data(begi=begi, endi=endi, bego=bego, endo=endo, & - sgridindex=sgridindex, keep_existing=.true., & - data_in=rbufsli, data_out=rbufslo) - - call ncd_io(ncid=ncido, varname=trim(varname), flag='write', data=rbufslo, & - dim1name=dimname) - - deallocate(rbufsli, rbufslo) - - end subroutine interp_1d_double - - !======================================================================= - - subroutine interp_1d_int (varname, varname_i, dimname, begi, endi, bego, endo, ncidi, ncido, & - sgridindex) - - ! ------------------------ arguments --------------------------------- - character(len=*) , intent(inout) :: varname ! variable name on output file - character(len=*) , intent(in) :: varname_i ! variable name on input file - character(len=*) , intent(inout) :: dimname - integer , intent(in) :: begi, endi - integer , intent(in) :: bego, endo - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - integer , intent(in) :: sgridindex(bego:endo) - ! -------------------------------------------------------------------- - - ! ------------------------ local variables -------------------------- - integer , pointer :: ibufsli(:) !input array - integer , pointer :: ibufslo(:) !output array - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Interpolating: ',trim(varname_i), ' => ', trim(varname) - end if - - allocate (ibufsli(begi:endi), ibufslo(bego:endo)) - - call ncd_io(ncid=ncidi, varname=trim(varname_i), flag='read', & - data=ibufsli) - call ncd_io(ncid=ncido, varname=trim(varname), flag='read', & - data=ibufslo, dim1name=dimname) - - call interp_1d_data(begi=begi, endi=endi, bego=bego, endo=endo, & - sgridindex=sgridindex, keep_existing=.true., & - data_in=ibufsli, data_out=ibufslo) - - call ncd_io(ncid=ncido, varname=trim(varname), flag='write', & - data=ibufslo, dim1name=dimname) - - deallocate (ibufsli, ibufslo) - - end subroutine interp_1d_int - - !======================================================================= - - subroutine interp_2d_double (var2di, var2do, & - begi, endi, bego, endo, sgridindex, & - interp_multilevel_container) - - ! -------------------------------------------------------------------- - ! arguments - class(interp_2dvar_type), intent(inout) :: var2di ! variable on input file - class(interp_2dvar_type), intent(inout) :: var2do ! variable on output file - integer , intent(in) :: begi, endi - integer , intent(in) :: bego, endo - integer , intent(in) :: sgridindex(bego:) - type(interp_multilevel_container_type), intent(in) :: interp_multilevel_container - ! - ! local variables - class(interp_multilevel_type), pointer :: multilevel_interpolator - integer :: no ! index - integer :: level ! level index - integer :: nlevi ! number of input levels - real(r8), pointer :: rbuf2do(:,:) ! output array - real(r8), pointer :: rbuf1di(:) ! one level of input array - real(r8), pointer :: rbuf2do_levelsi(:,:) ! array on output horiz grid, but input levels - ! -------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(sgridindex) == (/endo/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT(var2di%get_vec_beg() == begi, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(var2di%get_vec_end() == endi, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(var2do%get_vec_beg() == bego, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(var2do%get_vec_end() == endo, errMsg(sourcefile, __LINE__)) - - multilevel_interpolator => interp_multilevel_container%find_interpolator( & - lev_dimname = var2do%get_lev_dimname(), & - vec_dimname = var2do%get_vec_dimname()) - - if (masterproc) then - write(iulog,*) 'Interpolating: ', & - trim(var2di%get_varname()), ' => ', & - trim(var2do%get_varname()), ': ', & - multilevel_interpolator%get_description() - end if - - call multilevel_interpolator%check_npts( & - npts = var2do%get_vec_npts(), & - varname = var2do%get_varname()) - - ! First do a horizontal interpolation. We need to separate the horizontal and vertical - ! interpolation steps to avoid storing all levels of the source grid in memory at - ! once: that is problematic in terms of memory requirements since the full source grid - ! is stored in memory on every processor (in contrast to the destination grid, which - ! is decomposed across processors). - nlevi = var2di%get_nlev() - allocate(rbuf2do_levelsi(bego:endo, nlevi)) - allocate(rbuf1di(begi:endi)) - do level = 1, nlevi - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "READLEVEL"'. So we - ! explicitly call the specific routine, rather than calling readlevel. - call var2di%readlevel_double(rbuf1di, level) - call interp_1d_data(begi=begi, endi=endi, bego=bego, endo=endo, & - sgridindex=sgridindex, keep_existing=.false., & - data_in=rbuf1di, data_out=rbuf2do_levelsi(:,level)) - end do - deallocate(rbuf1di) - - ! Now do the vertical interpolation - - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "READVAR"'. So we - ! explicitly call the specific routine, rather than calling readvar. - call var2do%readvar_double(rbuf2do) - do no = bego,endo - ! Only do the interpolation for output points that have a corresponding input - ! point. Other output points will remain at their original value. - if (sgridindex(no) > 0) then - call multilevel_interpolator%interp_multilevel( & - data_dest = rbuf2do(no,:), & - data_source = rbuf2do_levelsi(no,:), & - index_dest = no - bego + 1) - end if - end do - - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "WRITEVAR"'. So we - ! explicitly call the specific routine, rather than calling writevar. - call var2do%writevar_double(rbuf2do) - - deallocate(rbuf2do, rbuf2do_levelsi) - - end subroutine interp_2d_double - - !======================================================================= - - subroutine check_dim_subgrid(ncidi, ncido, dimname, dimleni, dimleno) - - ! -------------------------------------------------------------------- - ! arguments - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - character(len=*) , intent(in) :: dimname - integer , intent(out) :: dimleni - integer , intent(out) :: dimleno - ! - ! local variables - integer :: status - integer :: dimid - ! -------------------------------------------------------------------- - - status = pio_inq_dimid (ncidi, dimname, dimid) - status = pio_inq_dimlen(ncidi, dimid , dimleni) - status = pio_inq_dimid (ncido, dimname, dimid) - status = pio_inq_dimlen(ncido, dimid , dimleno) - - end subroutine check_dim_subgrid - - !======================================================================= - - subroutine check_dim_level(ncidi, ncido, dimname, must_be_same) - ! Checks whether dimension size is the same for input and output. If 'must_be_same' - ! is true, aborts if they disagree; otherwise, simply prints an informative message. - - ! -------------------------------------------------------------------- - ! arguments - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - character(len=*) , intent(in) :: dimname - logical , intent(in) :: must_be_same - ! - ! local variables - integer :: status - integer :: dimid - integer :: dimleni, dimleno - ! -------------------------------------------------------------------- - - status = pio_inq_dimid (ncidi, dimname, dimid) - status = pio_inq_dimlen(ncidi, dimid , dimleni) - status = pio_inq_dimid (ncido, dimname, dimid) - status = pio_inq_dimlen(ncido, dimid , dimleno) - - if (dimleni /= dimleno) then - if (must_be_same) then - write (iulog,*) 'ERROR interpinic: input and output ',trim(dimname),' values disagree' - write (iulog,*) 'input dimlen = ',dimleni,' output dimlen = ',dimleno - call endrun(msg=errMsg(sourcefile, __LINE__)) - else - if (masterproc) then - write (iulog,*) 'input and output ',trim(dimname),' values disagree' - write (iulog,*) 'input nlevgrnd = ',dimleni,' output nlevgrnd = ',dimleno - write (iulog,*) 'This is okay: vertical levels will be interpolated' - end if - end if - end if - - end subroutine check_dim_level - - !----------------------------------------------------------------------- - subroutine limit_snlsno(ncido, bounds_o) - ! - ! !DESCRIPTION: - ! Apply a limit to SNLSNO in the output file so that it doesn't exceed the number of - ! snow layers. - ! - ! This is needed if the output file has fewer snow layers than the input file. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(file_desc_t) , intent(inout) :: ncido - type(interp_bounds_type), intent(in) :: bounds_o - ! - ! !LOCAL VARIABLES: - character(len=16) :: vec_dimname - integer :: bego, endo - integer, pointer :: snlsno(:) - integer :: snlsno_dids(1) ! dimension ID - integer :: levsno_dimid - integer :: levsno - integer :: i - integer :: err_code - - character(len=*), parameter :: levsno_dimname = 'levsno' - character(len=*), parameter :: snlsno_varname = 'SNLSNO' - - character(len=*), parameter :: subname = 'limit_snlsno' - !----------------------------------------------------------------------- - - ! Determine levsno size - call ncd_inqdlen(ncid=ncido, dimid=levsno_dimid, len=levsno, name=levsno_dimname) - - ! Read SNLSNO - ! - ! TODO(wjs, 2015-11-01) This is a lot of code for simply reading in a 1-d variable. - ! It would be nice if there was a routine that did all of this for you, similarly to - ! what initInterp2dvar does for 2-d variables. - call ncd_inqvdname(ncid=ncido, varname=snlsno_varname, dimnum=1, dname=vec_dimname, & - err_code=err_code) - if (err_code /= 0) then - call endrun(subname//' ERROR getting vec_dimname') - end if - bego = bounds_o%get_beg(vec_dimname) - endo = bounds_o%get_end(vec_dimname) - allocate(snlsno(bego:endo)) - call ncd_io(ncid=ncido, varname=snlsno_varname, flag='read', data=snlsno, & - dim1name=trim(vec_dimname)) - - ! Limit SNLSNO - do i = bego, endo - ! Note that snlsno is negative - snlsno(i) = max(snlsno(i), -1*levsno) - end do - - ! Write out limited SNLSNO - call ncd_io(ncid=ncido, varname=snlsno_varname, flag='write', data=snlsno, & - dim1name=trim(vec_dimname)) - deallocate(snlsno) - end subroutine limit_snlsno - -end module initInterpMod diff --git a/src/init_interp/initInterp1dData.F90 b/src/init_interp/initInterp1dData.F90 deleted file mode 100644 index 7455ddd01f..0000000000 --- a/src/init_interp/initInterp1dData.F90 +++ /dev/null @@ -1,126 +0,0 @@ -module initInterp1dData - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module contains routines for interpolating 1-d data fields. These routines do - ! not do any i/o. - ! ------------------------------------------------------------------------ - -#include "shr_assert.h" - use shr_log_mod , only: errMsg => shr_log_errMsg - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_infnan_mod , only: shr_infnan_isnan - use clm_varcon , only: spval, ispval - - implicit none - private - save - - ! Public methods - - public :: interp_1d_data - interface interp_1d_data - module procedure interp_1d_data_double - module procedure interp_1d_data_int - end interface interp_1d_data - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine interp_1d_data_double(begi, endi, bego, endo, sgridindex, keep_existing, & - data_in, data_out) - ! - ! !DESCRIPTION: - ! Interpolate a 1-d double field. - ! - ! If keep_existing = .true., then points with sgridindex <= 0 are kept at their - ! original value; if .false., they are set to spval. - ! - ! !USES: - ! - ! !ARGUMENTS: - integer , intent(in) :: begi ! beginning index for input array - integer , intent(in) :: endi ! ending index for input array - integer , intent(in) :: bego ! beginning index for output array - integer , intent(in) :: endo ! ending index for output array - integer , intent(in) :: sgridindex(bego:) ! input index mapping to each outputpoint - logical , intent(in) :: keep_existing ! whether to keep existing values for points with sgridindex <= 0 - real(r8) , intent(in) :: data_in(begi:) ! input data - real(r8) , intent(inout) :: data_out(bego:) ! output data - ! - ! !LOCAL VARIABLES: - integer :: no,ni ! indices - - character(len=*), parameter :: subname = 'interp_1d_data_double' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(sgridindex) == (/endo/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(data_in) == (/endi/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(data_out) == (/endo/)), errMsg(sourcefile, __LINE__)) - - if (.not. keep_existing) then - data_out(bego:endo) = spval - end if - - do no = bego,endo - ni = sgridindex(no) - if (ni > 0) then - if ( shr_infnan_isnan(data_in(ni)) ) then - data_out(no) = spval - else - data_out(no) = data_in(ni) - end if - end if - end do - - end subroutine interp_1d_data_double - - !----------------------------------------------------------------------- - subroutine interp_1d_data_int(begi, endi, bego, endo, sgridindex, keep_existing, & - data_in, data_out) - ! - ! !DESCRIPTION: - ! Interpolate a 1-d int field - ! - ! If keep_existing = .true., then points with sgridindex <= 0 are kept at their - ! original value; if .false., they are set to ispval. - ! - ! !USES: - ! - ! !ARGUMENTS: - integer , intent(in) :: begi ! beginning index for input array - integer , intent(in) :: endi ! ending index for input array - integer , intent(in) :: bego ! beginning index for output array - integer , intent(in) :: endo ! ending index for output array - integer , intent(in) :: sgridindex(bego:) ! input index mapping to each outputpoint - logical , intent(in) :: keep_existing ! whether to keep existing values for points with sgridindex <= 0 - integer , intent(in) :: data_in(begi:) ! input data - integer , intent(inout) :: data_out(bego:) ! output data - ! - ! !LOCAL VARIABLES: - integer :: no,ni !indices - - character(len=*), parameter :: subname = 'interp_1d_data_int' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(sgridindex) == (/endo/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(data_in) == (/endi/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(data_out) == (/endo/)), errMsg(sourcefile, __LINE__)) - - if (.not. keep_existing) then - data_out(bego:endo) = ispval - end if - - do no = bego,endo - ni = sgridindex(no) - if (ni > 0) then - data_out(no) = data_in(ni) - end if - end do - - end subroutine interp_1d_data_int - -end module initInterp1dData diff --git a/src/init_interp/initInterp2dvar.F90.in b/src/init_interp/initInterp2dvar.F90.in deleted file mode 100644 index f6e13375f8..0000000000 --- a/src/init_interp/initInterp2dvar.F90.in +++ /dev/null @@ -1,383 +0,0 @@ -module initInterp2dvar - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class that holds information about a 2-d variable, to - ! facilitate reading & writing - ! - ! !USES: -#include "shr_assert.h" - use abortutils , only: endrun - use shr_log_mod , only: errMsg => shr_log_errMsg - use shr_kind_mod , only: r8 => shr_kind_r8, i4=>shr_kind_i4 - use clm_varctl , only: iulog - use ncdio_pio , only: file_desc_t, var_desc_t, ncd_inqvid, ncd_inqvdids - use ncdio_pio , only: ncd_inqdlen, ncd_inqdname, ncd_io, ncd_getatt - use pio , only: pio_inq_varid, pio_get_var - - implicit none - private - save - - ! Public types - - public :: interp_2dvar_type - - type :: interp_2dvar_type - private - character(len=:), allocatable :: varname ! variable name - type(var_desc_t) :: vardesc ! variable descriptor on file - integer :: varid ! variable ID on file - type(file_desc_t), pointer :: ncid ! pointer to netcdf ID corresponding to this variable - logical :: file_is_dest ! true if this is on the dest file, false if on the source file - character(len=16) :: vec_dimname ! dimension name of vector dimension (e.g., 'col') - character(len=16) :: lev_dimname ! dimension name of level dimension - integer :: vec_beg ! beginning index of vector dimension - integer :: vec_end ! ending index of vector dimension - integer :: nlev ! size of level dimension - logical :: switchdim ! true if dimensions are 'switched' for this variable - contains - ! Public routines - generic :: readvar => readvar_int, readvar_double - !TYPE int,double - procedure :: readvar_{TYPE} - - generic :: writevar => writevar_int, writevar_double - !TYPE int,double - procedure :: writevar_{TYPE} - - generic :: readlevel => readlevel_int, readlevel_double ! read one level - !TYPE int,double - procedure :: readlevel_{TYPE} - - procedure :: get_varname ! get variable name - procedure :: get_vec_dimname ! get dimension name of vector dimension (e.g., 'col') - procedure :: get_lev_dimname ! get dimension name of level dimension - procedure :: get_vec_beg ! get beginning index of vector dimension - procedure :: get_vec_end ! get ending index of vector dimension - procedure :: get_vec_npts ! get number of points in vector dimension - procedure :: get_nlev ! get number of levels - - ! Private routines - procedure, private :: set_switchdim - end type interp_2dvar_type - - interface interp_2dvar_type - module procedure constructor - end interface interp_2dvar_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor(varname, ncid, file_is_dest, bounds) & - result(this) - ! - ! !DESCRIPTION: - ! Creates an interp_2dvar_type object - ! - ! !USES: - use initInterpBounds, only : interp_bounds_type - ! - ! !ARGUMENTS: - type(interp_2dvar_type) :: this ! function result - character(len=*) , intent(in) :: varname ! variable name - type(file_desc_t) , target, intent(inout) :: ncid ! netcdf id - logical , intent(in) :: file_is_dest ! true if this is the dest file, false if the source file - type(interp_bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: vec_dimnum ! dimension number of the vector dimension (e.g., 'col') - integer :: lev_dimnum ! dimension number of the level dimension - integer :: dimids(2) ! dimension IDs - - character(len=*), parameter :: subname = 'interp_2dvar_type constructor' - !----------------------------------------------------------------------- - - this%varname = varname - this%ncid => ncid - this%file_is_dest = file_is_dest - - call ncd_inqvid(this%ncid, trim(varname), this%varid, this%vardesc) - call this%set_switchdim() - - ! ------------------------------------------------------------------------ - ! Get information related to dimensions - ! ------------------------------------------------------------------------ - - if (this%switchdim) then - lev_dimnum = 1 - vec_dimnum = 2 - else - lev_dimnum = 2 - vec_dimnum = 1 - end if - - call ncd_inqvdids(this%ncid, dimids, this%vardesc) - - ! Get size of level dimension - call ncd_inqdlen(this%ncid, dimids(lev_dimnum), this%nlev) - - ! Get name of level dimension - call ncd_inqdname(this%ncid, dimids(lev_dimnum), this%lev_dimname) - - ! Get name of vector dimension - call ncd_inqdname(this%ncid, dimids(vec_dimnum), this%vec_dimname) - - this%vec_beg = bounds%get_beg(this%vec_dimname) - this%vec_end = bounds%get_end(this%vec_dimname) - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - !TYPE int,double - subroutine readvar_{TYPE}(this, data) - ! - ! !DESCRIPTION: - ! Reads variable from file. - ! - ! The 'data' variable is allocated here, and must be deallocated by the caller. - ! - ! !USES: - ! - ! !ARGUMENTS: - ! 'this' is intent(inout) for the sake of ncid - class(interp_2dvar_type), intent(inout) :: this - {VTYPE}, pointer, intent(out) :: data(:,:) ! [vec, lev] - ! - ! !LOCAL VARIABLES: - {VTYPE}, pointer :: data_transpose(:,:) ! transpose of data array if switchdim is true - - character(len=*), parameter :: subname = 'readvar' - !----------------------------------------------------------------------- - - if (.not. this%file_is_dest) then - ! NOTE(wjs, 2015-11-22) The code is set up to be able to read properly from the - ! source file, and this has been tested. However, for relatively high resolution - ! source files (f09 or higher, and/or higher-than-standard number of vertical - ! levels) it can cause out-of-memory problems on yellowstone that bring the whole - ! system to a temporary stand-still. So, to be safe, we currently abort if this is - ! attempted. - write(iulog,*) subname//' ERROR: Attempt to read all levels at once from source file.' - write(iulog,*) 'Although this is possible in theory, it is generally a bad idea' - write(iulog,*) 'because it can result in extreme memory usage.' - write(iulog,*) 'In some cases, this can cause system hangs that affect all users.' - write(iulog,*) 'If you want to try anyway, you can remove this endrun call.' - call endrun(msg='Attempt to read all levels at once from source file '// & - errMsg(sourcefile, __LINE__)) - end if - - allocate(data(this%vec_beg:this%vec_end, this%nlev)) - - ! The destination file uses the model's decomposition, whereas the source file does - ! not. Thus, we need to handle the reads differently. - if (this%file_is_dest) then - call ncd_io(ncid=this%ncid, varname=trim(this%varname), flag='read', data=data, & - dim1name=trim(this%vec_dimname), switchdim=this%switchdim) - else - if (this%switchdim) then - allocate(data_transpose(this%nlev, this%vec_beg:this%vec_end)) - call ncd_io(ncid=this%ncid, varname=trim(this%varname), flag='read', & - data=data_transpose) - data = transpose(data_transpose) - deallocate(data_transpose) - else - call ncd_io(ncid=this%ncid, varname=trim(this%varname), flag='read', & - data=data) - end if - end if - - end subroutine readvar_{TYPE} - - !----------------------------------------------------------------------- - !TYPE int,double - subroutine writevar_{TYPE}(this, data) - ! - ! !DESCRIPTION: - ! Writes variable to file. - ! - ! Currently only works for the destination file, not the source file. - ! - ! !USES: - ! - ! !ARGUMENTS: - ! 'this' is intent(inout) for the sake of ncid - class(interp_2dvar_type), intent(inout) :: this - {VTYPE}, pointer, intent(in) :: data(:,:) ! [vec, lev] - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'writevar' - !----------------------------------------------------------------------- - - if (this%file_is_dest) then - call ncd_io(ncid=this%ncid, varname=trim(this%varname), flag='write', data=data, & - dim1name=trim(this%vec_dimname), switchdim=this%switchdim) - else - ! NOTE(wjs, 2015-10-13) In principle, we could probably handle writes to the - ! source file the same way as we handle reads. But since this is untested, I'm - ! currently aborting in this case. - call endrun(msg='ERROR: unhandled attempt to write variable to source file '// & - errMsg(sourcefile, __LINE__)) - end if - - end subroutine writevar_{TYPE} - - !----------------------------------------------------------------------- - !TYPE int,double - subroutine readlevel_{TYPE}(this, data, level) - ! - ! !DESCRIPTION: - ! Reads one level of variable from file. - ! - ! In contrast to readvar, this routine does NOT allocate the data: it expects data to - ! already be allocated of the correct size. (This is to avoid requiring repeated - ! allocations and deallocations when reading one level at a time.) - ! - ! !USES: - ! - ! !ARGUMENTS: - ! 'this' is intent(inout) for the sake of ncid - class(interp_2dvar_type), intent(inout) :: this - {VTYPE}, pointer :: data(:) - integer, intent(in) :: level ! level index to read - ! - ! !LOCAL VARIABLES: - integer :: status ! netCDF return code - type(Var_desc_t) :: vardesc ! pio variable descriptor - integer :: starts(2) - integer :: counts(2) - - character(len=*), parameter :: subname = 'readlevel' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((lbound(data) == (/this%vec_beg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(data) == (/this%vec_end/)), errMsg(sourcefile, __LINE__)) - - if (this%file_is_dest) then - ! NOTE(wjs, 2015-11-22) As far as I can tell, ncdio_pio currently doesn't provide - ! a robust mechanism for reading in a single level. Since we don't actually need - ! this functionality right now, I am aborting rather than trying to either (a) add - ! the functionality to ncdio_pio, or (b) handle it here with direct calls to pio. - call endrun(msg='ERROR: unhandled attempt to read one level from dest file '//& - errMsg(sourcefile, __LINE__)) - else - ! TODO(wjs, 2015-11-22) I don't like that we're making direct pio calls here. - ! Ideally we'd go through ncdio_pio, but currently that module doesn't provide the - ! necessary functionality. - status = pio_inq_varid(this%ncid, trim(this%varname), vardesc) - if (this%switchdim) then - starts(1) = level - counts(1) = 1 - starts(2) = 1 - counts(2) = this%get_vec_npts() - else - starts(1) = 1 - counts(1) = this%get_vec_npts() - starts(2) = level - counts(2) = 1 - end if - status = pio_get_var(this%ncid, vardesc, starts, counts, data) - end if - - end subroutine readlevel_{TYPE} - - function get_varname(this) result(varname) - ! Get variable name - character(len=:), allocatable :: varname ! function result - class(interp_2dvar_type), intent(in) :: this - - varname = this%varname - end function get_varname - - function get_vec_dimname(this) result(vec_dimname) - ! Get name of vector dimension (e.g., 'col') - character(len=:), allocatable :: vec_dimname ! function result - class(interp_2dvar_type), intent(in) :: this - - vec_dimname = this%vec_dimname - end function get_vec_dimname - - function get_lev_dimname(this) result(lev_dimname) - ! Get name of level dimension - character(len=:), allocatable :: lev_dimname ! function result - class(interp_2dvar_type), intent(in) :: this - - lev_dimname = this%lev_dimname - end function get_lev_dimname - - integer function get_vec_beg(this) - ! Get beginning index of vector dimension - class(interp_2dvar_type), intent(in) :: this - - get_vec_beg = this%vec_beg - end function get_vec_beg - - integer function get_vec_end(this) - ! Get ending index of vector dimension - class(interp_2dvar_type), intent(in) :: this - - get_vec_end = this%vec_end - end function get_vec_end - - integer function get_vec_npts(this) - ! Get number of points in vector dimension - class(interp_2dvar_type), intent(in) :: this - - get_vec_npts = (this%vec_end - this%vec_beg + 1) - end function get_vec_npts - - integer function get_nlev(this) - ! Get number of levels - class(interp_2dvar_type), intent(in) :: this - - get_nlev = this%nlev - end function get_nlev - - ! ======================================================================== - ! Private methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine set_switchdim(this) - ! - ! !DESCRIPTION: - ! Sets the switchdim attribute by reading the appropriate metadata from the file - ! - ! !USES: - use restUtilMod , only: iflag_noswitchdim, iflag_switchdim - ! - ! !ARGUMENTS: - class(interp_2dvar_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - integer :: switchdim_flag - - character(len=*), parameter :: subname = 'set_switchdim' - !----------------------------------------------------------------------- - - call ncd_getatt(this%ncid, this%varid, 'switchdim_flag', switchdim_flag) - select case (switchdim_flag) - case (iflag_switchdim) - this%switchdim = .true. - case (iflag_noswitchdim) - this%switchdim = .false. - case default - write(iulog,*) subname//' ERROR: unknown switchdim_flag: ', switchdim_flag - call endrun('ERROR: unknown switchdim flag '//errMsg(sourcefile, __LINE__)) - end select - - end subroutine set_switchdim - - -end module initInterp2dvar diff --git a/src/init_interp/initInterpBounds.F90 b/src/init_interp/initInterpBounds.F90 deleted file mode 100644 index ff3704e462..0000000000 --- a/src/init_interp/initInterpBounds.F90 +++ /dev/null @@ -1,198 +0,0 @@ -module initInterpBounds - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class for storing and querying bounds information for initInterp - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - - implicit none - private - save - - ! Public types - - public :: interp_bounds_type - - type :: interp_bounds_type - private - integer :: begp ! beginning patch-level index - integer :: endp ! ending patch-level index - integer :: begc ! beginning col-level index - integer :: endc ! ending col-level index - integer :: begl ! beginning landunit-level index - integer :: endl ! ending landunit-level index - integer :: begg ! beginning gridcell-level index - integer :: endg ! ending gridcell-level index - contains - procedure :: get_begp - procedure :: get_endp - procedure :: get_begc - procedure :: get_endc - procedure :: get_begl - procedure :: get_endl - procedure :: get_begg - procedure :: get_endg - procedure :: get_beg ! get beginning index for a given subgrid level - procedure :: get_end ! get ending index for a given subgrid level - end type interp_bounds_type - - interface interp_bounds_type - module procedure constructor - end interface interp_bounds_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor(begp, endp, begc, endc, begl, endl, begg, endg) result(this) - ! - ! !DESCRIPTION: - ! Create an interp_bounds_type instance - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_bounds_type) :: this ! function result - integer, intent(in) :: begp, endp - integer, intent(in) :: begc, endc - integer, intent(in) :: begl, endl - integer, intent(in) :: begg, endg - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - this%begp = begp - this%endp = endp - this%begc = begc - this%endc = endc - this%begl = begl - this%endl = endl - this%begg = begg - this%endg = endg - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - integer function get_begp(this) - class(interp_bounds_type), intent(in) :: this - get_begp = this%begp - end function get_begp - - integer function get_endp(this) - class(interp_bounds_type), intent(in) :: this - get_endp = this%endp - end function get_endp - - integer function get_begc(this) - class(interp_bounds_type), intent(in) :: this - get_begc = this%begc - end function get_begc - - integer function get_endc(this) - class(interp_bounds_type), intent(in) :: this - get_endc = this%endc - end function get_endc - - integer function get_begl(this) - class(interp_bounds_type), intent(in) :: this - get_begl = this%begl - end function get_begl - - integer function get_endl(this) - class(interp_bounds_type), intent(in) :: this - get_endl = this%endl - end function get_endl - - integer function get_begg(this) - class(interp_bounds_type), intent(in) :: this - get_begg = this%begg - end function get_begg - - integer function get_endg(this) - class(interp_bounds_type), intent(in) :: this - get_endg = this%endg - end function get_endg - - !----------------------------------------------------------------------- - function get_beg(this, subgrid_level) result(beg_index) - ! - ! !DESCRIPTION: - ! Get beginning index for a given subgrid level - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: beg_index ! function result - class(interp_bounds_type), intent(in) :: this - character(len=*), intent(in) :: subgrid_level ! 'pft', 'column', 'landunit' or 'gridcell' - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_beg' - !----------------------------------------------------------------------- - - select case (subgrid_level) - case('pft') - beg_index = this%begp - case('column') - beg_index = this%begc - case('landunit') - beg_index = this%begl - case('gridcell') - beg_index = this%begg - case default - call endrun(msg=subname//' ERROR: Unknown subgrid level: '//trim(subgrid_level)// & - errMsg(sourcefile, __LINE__)) - end select - - end function get_beg - - !----------------------------------------------------------------------- - function get_end(this, subgrid_level) result(end_index) - ! - ! !DESCRIPTION: - ! Get ending index for a given subgrid level - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: end_index ! function result - class(interp_bounds_type), intent(in) :: this - character(len=*), intent(in) :: subgrid_level ! 'pft', 'column', 'landunit' or 'gridcell' - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_end' - !----------------------------------------------------------------------- - - select case (subgrid_level) - case('pft') - end_index = this%endp - case('column') - end_index = this%endc - case('landunit') - end_index = this%endl - case('gridcell') - end_index = this%endg - case default - call endrun(msg=subname//' ERROR: Unknown subgrid level: '//trim(subgrid_level)// & - errMsg(sourcefile, __LINE__)) - end select - - end function get_end - -end module initInterpBounds diff --git a/src/init_interp/initInterpMindist.F90 b/src/init_interp/initInterpMindist.F90 deleted file mode 100644 index 4f4dba1194..0000000000 --- a/src/init_interp/initInterpMindist.F90 +++ /dev/null @@ -1,699 +0,0 @@ -module initInterpMindist - - ! ------------------------------------------------------------------------ - ! This module contains most of the "interesting" logic of initInterp, in terms of - ! finding the input column (or landunit, patch, etc.) to use as a template for each - ! output column (etc.). - ! - ! This is in a separate module to facilitate unit testing, since the full initInterp - ! involves some awkward dependencies. - ! ------------------------------------------------------------------------ - -#include "shr_assert.h" - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only: iulog - use abortutils , only: endrun - use spmdMod , only: masterproc - use clm_varcon , only: spval, re - use glcBehaviorMod , only: glc_behavior_type - - implicit none - private - save - - ! Public methods - - public :: set_mindist - public :: set_single_match - - ! Public types - - type, public :: subgrid_special_indices_type - integer :: ipft_not_vegetated - integer :: icol_vegetated_or_bare_soil - integer :: ilun_vegetated_or_bare_soil - integer :: ilun_crop - integer :: ilun_landice_multiple_elevation_classes - contains - procedure :: is_vegetated_landunit ! returns true if the given landunit type is natural veg or crop - end type subgrid_special_indices_type - - type, public :: subgrid_type - character(len=16) :: name ! pft, column, landunit, gridcell - integer , pointer :: ptype(:) => null() ! used for patch type - integer , pointer :: ctype(:) => null() ! used for patch or col type - integer , pointer :: ltype(:) => null() ! used for pft, col or lun type - real(r8), pointer :: topoglc(:) => null() - real(r8), pointer :: lat(:) - real(r8), pointer :: lon(:) - real(r8), pointer :: coslat(:) - contains - procedure :: print_point ! print info about one point - end type subgrid_type - - ! Private methods - - private :: set_glcmec_must_be_same_type - private :: set_icemec_adjustable_type - private :: do_fill_missing_with_natveg - private :: is_sametype - private :: is_baresoil - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine print_point(this, index, unit) - ! - ! !DESCRIPTION: - ! Print info about one point in a subgrid_type object - ! - ! !USES: - ! - ! !ARGUMENTS: - class(subgrid_type), intent(in) :: this - integer , intent(in) :: index - integer , intent(in) :: unit ! unit to which we should write the info - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'print_point' - !----------------------------------------------------------------------- - - write(unit,*) 'subgrid level, index = ',& - this%name, index - write(unit,*) 'lat, lon = ', this%lat(index), ', ', this%lon(index) - if (associated(this%ltype)) then - write(unit,*) 'ltype: ', this%ltype(index) - end if - if (associated(this%ctype)) then - write(unit,*) 'ctype: ', this%ctype(index) - end if - if (associated(this%ptype)) then - write(unit,*) 'ptype: ', this%ptype(index) - end if - - end subroutine print_point - - - !======================================================================= - - subroutine set_mindist(begi, endi, bego, endo, activei, activeo, subgridi, subgrido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - fill_missing_with_natveg, mindist_index) - - ! -------------------------------------------------------------------- - ! arguments - integer , intent(in) :: begi, endi - integer , intent(in) :: bego, endo - logical , intent(in) :: activei(begi:endi) - logical , intent(in) :: activeo(bego:endo) - type(subgrid_type) , intent(in) :: subgridi - type(subgrid_type) , intent(in) :: subgrido - type(subgrid_special_indices_type), intent(in) :: subgrid_special_indices - type(glc_behavior_type), intent(in) :: glc_behavior - - ! True if the number and bounds of glacier elevation classes are the same in the - ! input and output; false otherwise. - logical , intent(in) :: glc_elevclasses_same - - ! If false: if an output type cannot be found in the input, code aborts - ! If true: if an output type cannot be found in the input, fill with closest natural - ! veg column (using bare soil for patch-level variables) - ! - ! NOTE: always treated as true for natural veg and crop landunits/columns/patches in - ! the output - e.g., if we can't find the right column type to fill crop, we always - ! use the closest natural veg column, regardless of the value of this flag. - logical , intent(in) :: fill_missing_with_natveg - - integer , intent(out) :: mindist_index(bego:endo) - ! - ! local variables - real(r8) :: dx,dy - real(r8) :: distmin,dist,hgtdiffmin,hgtdiff - integer :: nsizei, nsizeo - integer :: ni,no,nmin,ier,n,noloc - logical :: topoglc_present - logical :: closest - - ! Whether two glcmec columns/patches must be the same column/patch type to be - ! considered the same type. This is only valid for glcmec points, and is only valid - ! for subgrid name = 'pft' or 'column'. - logical :: glcmec_must_be_same_type_o(bego:endo) - ! -------------------------------------------------------------------- - - if (associated(subgridi%topoglc) .and. associated(subgrido%topoglc)) then - topoglc_present = .true. - else - topoglc_present = .false. - end if - - mindist_index(bego:endo) = 0 - distmin = spval - - call set_glcmec_must_be_same_type(bego=bego, endo=endo, dimname=subgrido%name, & - glc_elevclasses_same = glc_elevclasses_same, glc_behavior=glc_behavior, & - glcmec_must_be_same_type_o=glcmec_must_be_same_type_o) - -!$OMP PARALLEL DO PRIVATE (ni,no,n,nmin,distmin,dx,dy,dist,closest,hgtdiffmin,hgtdiff) - do no = bego,endo - - ! Only interpolate onto active points. Otherwise, the mere act of running - ! init_interp (e.g., of a file onto itself) would lead to changes in a bunch of - ! inactive points - e.g., going from their cold start initial conditions to some - ! spunup initial conditions (from the closest active point of that type). This - ! could potentially lead to different behavior in a transient run, if those points - ! later became active; that's undesirable. - if (activeo(no)) then - nmin = 0 - distmin = spval - hgtdiffmin = spval - do ni = begi,endi - if (activei(ni)) then - if (is_sametype(ni = ni, no = no, & - subgridi = subgridi, subgrido = subgrido, & - subgrid_special_indices = subgrid_special_indices, & - glcmec_must_be_same_type = glcmec_must_be_same_type_o(no), & - veg_patch_just_considers_ptype = .true.)) then - dy = abs(subgrido%lat(no)-subgridi%lat(ni))*re - dx = abs(subgrido%lon(no)-subgridi%lon(ni))*re * & - 0.5_r8*(subgrido%coslat(no)+subgridi%coslat(ni)) - dist = dx*dx + dy*dy - if (topoglc_present) then - hgtdiff = abs(subgridi%topoglc(ni) - subgrido%topoglc(no)) - end if - closest = .false. - if ( dist < distmin ) then - closest = .true. - distmin = dist - nmin = ni - if (topoglc_present) then - hgtdiffmin = hgtdiff - end if - end if - if (.not. closest) then - ! In *some* cases: For glc_mec points, we first find the closest - ! point in lat-lon space, without consideration for column or patch - ! type (above). Then, within that closest point, we find the closest - ! column in topographic space; this second piece is done here. Note - ! that this ordering means that we could choose a column with a very - ! different topographic height from the target column, if it is - ! closer in lat-lon space than any similar-height columns. - if (topoglc_present) then - hgtdiff = abs(subgridi%topoglc(ni) - subgrido%topoglc(no)) - if ((dist == distmin) .and. (hgtdiff < hgtdiffmin)) then - closest = .true. - hgtdiffmin = hgtdiff - distmin = dist - nmin = ni - end if - end if - end if - end if - end if - end do - - ! If output type is not contained in input dataset, then use closest bare soil, - ! if this point is one for which we fill missing with natveg. - if ( distmin == spval .and. & - do_fill_missing_with_natveg( & - fill_missing_with_natveg, no, subgrido, subgrid_special_indices)) then - do ni = begi, endi - if (activei(ni)) then - if ( is_baresoil(ni, subgridi, subgrid_special_indices)) then - dy = abs(subgrido%lat(no)-subgridi%lat(ni))*re - dx = abs(subgrido%lon(no)-subgridi%lon(ni))*re * & - 0.5_r8*(subgrido%coslat(no)+subgridi%coslat(ni)) - dist = dx*dx + dy*dy - if ( dist < distmin )then - distmin = dist - nmin = ni - end if - end if - end if - end do - end if - - ! Error conditions - if ( distmin == spval )then - write(iulog,*) 'ERROR initInterp set_mindist: & - &Cannot find any input points matching output point:' - call subgrido%print_point(no, iulog) - write(iulog,*) ' ' - write(iulog,*) 'Consider rerunning with the following in user_nl_clm:' - write(iulog,*) 'init_interp_fill_missing_with_natveg = .true.' - write(iulog,*) 'However, note that this will fill all missing types in the output' - write(iulog,*) 'with the closest natural veg column in the input' - write(iulog,*) '(using bare soil for patch-level variables).' - write(iulog,*) 'So, you should consider whether that is what you want.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - mindist_index(no) = nmin - - end if ! end if activeo block - end do -!$OMP END PARALLEL DO - - end subroutine set_mindist - - !----------------------------------------------------------------------- - subroutine set_single_match(begi, endi, bego, endo, activeo, subgridi, subgrido, & - subgrid_special_indices, glc_behavior, glc_elevclasses_same, & - mindist_index) - ! - ! !DESCRIPTION: - ! This is an alternative to set_mindist that can work when there is a single matching - ! input point for each output point (or possibly 0 matching inputs for an inactive - ! output point). In this method, we only look for points that share the same lat/lon - ! as the output point. - ! - ! This method is intended to be used for the case where we want to copy areas from the - ! input file to the output file (rather than maintaining areas from the surface - ! dataset); some of the logic here is set up the way it is in order to support this - ! copying of areas. - ! - ! !ARGUMENTS: - integer , intent(in) :: begi, endi - integer , intent(in) :: bego, endo - logical , intent(in) :: activeo(bego:endo) - type(subgrid_type) , intent(in) :: subgridi - type(subgrid_type) , intent(in) :: subgrido - type(subgrid_special_indices_type), intent(in) :: subgrid_special_indices - type(glc_behavior_type), intent(in) :: glc_behavior - - ! True if the number and bounds of glacier elevation classes are the same in the - ! input and output; false otherwise. - ! - ! Must be true for this method! (Otherwise we may not be able to find a single unique - ! input point for each output point.) - logical , intent(in) :: glc_elevclasses_same - - integer , intent(out) :: mindist_index(bego:endo) - ! - ! !LOCAL VARIABLES: - integer :: ni, no, ni_match - logical :: found - real(r8) :: dx, dy - logical :: ni_sametype - - ! Whether two glcmec columns/patches must be the same column/patch type to be - ! considered the same type. This is only valid for glcmec points, and is only valid - ! for subgrid name = 'pft' or 'column'. - logical :: glcmec_must_be_same_type_o(bego:endo) - - ! Tolerance in lat/lon for considering a point to be at the same location - real(r8) :: same_point_tol = 1.e-14_r8 - - character(len=*), parameter :: subname = 'set_single_match' - !----------------------------------------------------------------------- - - if (.not. glc_elevclasses_same) then - write(iulog,*) subname// & - ' ERROR: For this init_interp method, the number and bounds of' - write(iulog,*) 'glacier elevation classes must be the same in input and output' - call endrun(msg=subname//' ERROR: glc_elevclasses_same must be true for this method') - end if - - call set_glcmec_must_be_same_type(bego=bego, endo=endo, dimname=subgrido%name, & - glc_elevclasses_same = glc_elevclasses_same, glc_behavior=glc_behavior, & - glcmec_must_be_same_type_o=glcmec_must_be_same_type_o) - -!$OMP PARALLEL DO PRIVATE (ni,no,ni_match,found,dx,dy,ni_sametype) - do no = bego, endo - ni_match = 0 - found = .false. - do ni = begi, endi - dx = abs(subgrido%lon(no)-subgridi%lon(ni)) - dy = abs(subgrido%lat(no)-subgridi%lat(ni)) - if (dx < same_point_tol .and. dy < same_point_tol) then - ni_sametype = is_sametype(ni = ni, no = no, & - subgridi = subgridi, subgrido = subgrido, & - subgrid_special_indices = subgrid_special_indices, & - glcmec_must_be_same_type = glcmec_must_be_same_type_o(no), & - veg_patch_just_considers_ptype = .false.) - if (ni_sametype) then - if (found) then - write(iulog,*) subname// & - ' ERROR: found multiple input points matching output point' - call subgrido%print_point(no, iulog) - write(iulog,*) ' ' - write(iulog,*) 'For this init_interp_method: for a given output point,' - write(iulog,*) 'we expect to find exactly one input point at the same' - write(iulog,*) 'location with the same type.' - write(iulog,*) '(This most likely indicates a problem in CTSM, such as' - write(iulog,*) 'having multiple columns with the same column type on a' - write(iulog,*) 'given gridcell.)' - call endrun(msg=subname// & - ' ERROR: found multiple input points matching output point') - else - found = .true. - ni_match = ni - end if - end if - end if - end do - - if (found) then - mindist_index(no) = ni_match - else - mindist_index(no) = 0 - - if (activeo(no)) then - write(iulog,*) subname// & - ' ERROR: cannot find any input points matching output point' - call subgrido%print_point(no, iulog) - write(iulog,*) ' ' - write(iulog,*) 'For this init_interp_method: for a given active output point,' - write(iulog,*) 'we expect to find exactly one input point at the same' - write(iulog,*) 'location with the same type.' - write(iulog,*) 'Note that this requires the input and output grids to be identical.' - write(iulog,*) '(If you need to interpolate to a different resolution, then' - write(iulog,*) 'you need to use a different init_interp_method.)' - call endrun(msg=subname//' ERROR: cannot find any input points matching output point') - end if - end if - end do -!$OMP END PARALLEL DO - - end subroutine set_single_match - - !----------------------------------------------------------------------- - subroutine set_glcmec_must_be_same_type(bego, endo, dimname, & - glc_elevclasses_same, glc_behavior, & - glcmec_must_be_same_type_o) - ! - ! !DESCRIPTION: - ! Sets the glcmec_must_be_same_type_o array for each output icemec point - ! - ! This array will be set to true for icemec output columns/patches for which the - ! column/patch type must match the input column/patch type to be considered the same - ! type. This is only valid for icemec points, and is only valid for dimname = 'pft' or - ! 'column' - for others, the value is undefined. - ! - ! This assumes that bego and endo match the bounds that are used elsewhere in the - ! model - i.e., for the decomposition within init_interp to match the model's - ! decomposition. - ! - ! !ARGUMENTS: - integer , intent(in) :: bego ! beginning index for output points - integer , intent(in) :: endo ! ending index for output points - character(len=*) , intent(in) :: dimname ! 'pft', 'column', etc. - - ! True if the number and bounds of glacier elevation classes are the same in the - ! input and output; false otherwise. - logical, intent(in) :: glc_elevclasses_same - - type(glc_behavior_type), intent(in) :: glc_behavior - - logical, intent(out) :: glcmec_must_be_same_type_o( bego: ) ! see description above - - ! - ! !LOCAL VARIABLES: - integer :: no - - ! Whether each output icemec point has adjustable column type; only valid for icemec - ! points, and only valid for subgrid name = pft or column - logical :: icemec_adjustable_type_o(bego:endo) - - character(len=*), parameter :: subname = 'set_glcmec_must_be_same_type' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(glcmec_must_be_same_type_o) == (/endo/)), errMsg(sourcefile, __LINE__)) - - if (.not. glc_elevclasses_same) then - ! If the number or bounds of the elevation classes differ between input and - ! output, then we ignore the column and patch types of glcmec points when - ! looking for the same type - instead using closest topographic height as a - ! tie-breaker between equidistant columns/patches. - glcmec_must_be_same_type_o(bego:endo) = .false. - else - call set_icemec_adjustable_type(bego=bego, endo=endo, dimname=dimname, & - glc_behavior=glc_behavior, icemec_adjustable_type_o=icemec_adjustable_type_o) - do no = bego, endo - if (icemec_adjustable_type_o(no)) then - ! If glcmec points in this output cell have adjustable type, then we ignore - ! the column and patch types of glcmec points when looking for the same - ! type: we want to find the closest glcmec point in lat-lon space without - ! regards for column/patch type, because the column/patch types may change - ! at runtime. - glcmec_must_be_same_type_o(no) = .false. - else - ! Otherwise, we require the column and patch types to be the same between - ! input and output for this glcmec output point, as is the case for most - ! other landunits. This is important for a case with interpolation to give - ! bit-for-bit answers with a case without interpolation (since glcmec - ! topographic heights can change after initialization, so we can't always - ! rely on the point with closest topographic height to be the "right" one to - ! pick as the source for interpolation). - glcmec_must_be_same_type_o(no) = .true. - end if - end do - end if - - end subroutine set_glcmec_must_be_same_type - - !----------------------------------------------------------------------- - subroutine set_icemec_adjustable_type(bego, endo, dimname, glc_behavior, & - icemec_adjustable_type_o) - ! - ! !DESCRIPTION: - ! Sets the icemec_adjustable_type_o array for each output icemec point - ! - ! This array will be set to true for icemec points that have adjustable column type - ! and false for icemec points that do not. The value will be undefined for non-icemec - ! points. - ! - ! This can only be called for the output, not the input! - ! - ! The output array is only valid for dimname = pft or column; for others, the output - ! values are undefined. - ! - ! This assumes that bego and endo match the bounds that are used elsewhere in the - ! model - i.e., for the decomposition within init_interp to match the model's - ! decomposition. - ! - ! !ARGUMENTS: - integer , intent(in) :: bego ! beginning index for output points - integer , intent(in) :: endo ! ending index for output points - character(len=*) , intent(in) :: dimname ! 'pft', 'column', etc. - type(glc_behavior_type) , intent(in) :: glc_behavior - logical , intent(out) :: icemec_adjustable_type_o( bego: ) ! see documentation above - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'set_icemec_adjustable_type' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(icemec_adjustable_type_o) == (/endo/)), errMsg(sourcefile, __LINE__)) - - select case (dimname) - case ('pft') - call glc_behavior%patches_have_dynamic_type_array(bego, endo, & - icemec_adjustable_type_o(bego:endo)) - case ('column') - call glc_behavior%cols_have_dynamic_type_array(bego, endo, & - icemec_adjustable_type_o(bego:endo)) - case ('landunit', 'gridcell') - ! Do nothing: icemec_adjustable_type_o will be left undefined - case default - call endrun(subname//' ERROR: unexpected dimname: '//trim(dimname)//& - errMsg(sourcefile, __LINE__)) - end select - - end subroutine set_icemec_adjustable_type - - !----------------------------------------------------------------------- - function do_fill_missing_with_natveg(fill_missing_with_natveg, & - no, subgrido, subgrid_special_indices) - ! - ! !DESCRIPTION: - ! Returns true if the given output point, if missing, should be filled with the - ! closest natural veg point. - ! - ! !ARGUMENTS: - logical :: do_fill_missing_with_natveg ! function result - - ! whether we should fill ALL missing points with natveg - logical, intent(in) :: fill_missing_with_natveg - - integer , intent(in) :: no - type(subgrid_type), intent(in) :: subgrido - type(subgrid_special_indices_type), intent(in) :: subgrid_special_indices - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'do_fill_missing_with_natveg' - !----------------------------------------------------------------------- - - if (subgrido%name == 'gridcell') then - ! It makes no sense to try to fill missing with natveg for gridcell-level values - do_fill_missing_with_natveg = .false. - else if (fill_missing_with_natveg) then - ! User has asked for all missing points to be filled with natveg - do_fill_missing_with_natveg = .true. - else if (subgrid_special_indices%is_vegetated_landunit(subgrido%ltype(no))) then - ! Even if user hasn't asked for it, we fill missing vegetated points (natural veg - ! and crop) with the closest natveg point. This is mainly to support the common - ! use case of interpolating non-crop to crop, but also supports adding a new PFT - ! type. - do_fill_missing_with_natveg = .true. - else - do_fill_missing_with_natveg = .false. - end if - - end function do_fill_missing_with_natveg - - - !======================================================================= - - logical function is_sametype (ni, no, subgridi, subgrido, subgrid_special_indices, & - glcmec_must_be_same_type, veg_patch_just_considers_ptype) - - ! -------------------------------------------------------------------- - ! arguments - integer , intent(in) :: ni - integer , intent(in) :: no - type(subgrid_type), intent(in) :: subgridi - type(subgrid_type), intent(in) :: subgrido - type(subgrid_special_indices_type), intent(in) :: subgrid_special_indices - - ! Whether two glcmec columns/patches must be the same column/patch type to be - ! considered the same type. This is only valid for glcmec points, and is only valid - ! for subgrid name = 'pft' or 'column'. - logical, intent(in) :: glcmec_must_be_same_type - - ! For vegetated patches (natural veg or crop): if veg_patch_just_considers_ptype is - ! true, then we consider two vegetated patches to be the same type if they have the - ! same ptype, without regard to their column and landunit types (as long as both the - ! input and the output are on either the natural veg or crop landunit). This is - ! needed to handle the generic crop properly when interpolating from non-crop to - ! crop, or vice versa. - ! - ! If false, then they need to have the same column and landunit types, too (as is the - ! general case). - logical, intent(in) :: veg_patch_just_considers_ptype - ! -------------------------------------------------------------------- - - is_sametype = .false. - - if (trim(subgridi%name) == 'pft' .and. trim(subgrido%name) == 'pft') then - if ( .not. glcmec_must_be_same_type .and. & - subgridi%ltype(ni) == subgrid_special_indices%ilun_landice_multiple_elevation_classes .and. & - subgrido%ltype(no) == subgrid_special_indices%ilun_landice_multiple_elevation_classes) then - is_sametype = .true. - else if (veg_patch_just_considers_ptype .and. & - subgrid_special_indices%is_vegetated_landunit(subgrido%ltype(no))) then - ! See comment attached to the declaration of veg_patch_just_considers_ptype for - ! rationale for this logic. - ! - ! TODO(wjs, 2015-09-15) If we ever allow the same PFT to appear on multiple - ! columns within a given grid cell, then this logic will need to be made - ! somewhat more complex: e.g., preferably take something from the same column - ! type, but if we can't find anything from the same column type, then ignore - ! column type. - - if (subgrid_special_indices%is_vegetated_landunit(subgridi%ltype(ni)) .and. & - subgridi%ptype(ni) == subgrido%ptype(no)) then - is_sametype = .true. - end if - else if (subgridi%ptype(ni) == subgrido%ptype(no) .and. & - subgridi%ctype(ni) == subgrido%ctype(no) .and. & - subgridi%ltype(ni) == subgrido%ltype(no)) then - is_sametype = .true. - end if - else if (trim(subgridi%name) == 'column' .and. trim(subgrido%name) == 'column') then - if ( .not. glcmec_must_be_same_type .and. & - subgridi%ltype(ni) == subgrid_special_indices%ilun_landice_multiple_elevation_classes .and. & - subgrido%ltype(no) == subgrid_special_indices%ilun_landice_multiple_elevation_classes ) then - is_sametype = .true. - else if (subgridi%ctype(ni) == subgrido%ctype(no) .and. & - subgridi%ltype(ni) == subgrido%ltype(no)) then - is_sametype = .true. - end if - else if (trim(subgridi%name) == 'landunit' .and. trim(subgrido%name) == 'landunit') then - if (subgridi%ltype(ni) == subgrido%ltype(no)) then - is_sametype = .true. - end if - else if (trim(subgridi%name) == 'gridcell' .and. trim(subgrido%name) == 'gridcell') then - is_sametype = .true. - else - if (masterproc) then - write(iulog,*)'ERROR interpinic: is_sametype check on input and output type not supported' - write(iulog,*)'typei = ',trim(subgridi%name) - write(iulog,*)'typeo = ',trim(subgrido%name) - end if - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end function is_sametype - - !======================================================================= - - logical function is_baresoil (n, subgrid, subgrid_special_indices) - - ! -------------------------------------------------------------------- - ! arguments - integer , intent(in) :: n - type(subgrid_type), intent(in) :: subgrid - type(subgrid_special_indices_type), intent(in) :: subgrid_special_indices - ! -------------------------------------------------------------------- - - is_baresoil = .false. - - if (subgrid%name == 'pft') then - if (subgrid%ptype(n) == subgrid_special_indices%ipft_not_vegetated .and. & - subgrid%ctype(n) == subgrid_special_indices%icol_vegetated_or_bare_soil .and. & - subgrid%ltype(n) == subgrid_special_indices%ilun_vegetated_or_bare_soil) then - is_baresoil = .true. - end if - else if (subgrid%name == 'column') then - if (subgrid%ctype(n) == subgrid_special_indices%icol_vegetated_or_bare_soil .and. & - subgrid%ltype(n) == subgrid_special_indices%ilun_vegetated_or_bare_soil) then - is_baresoil = .true. - end if - else if (subgrid%name == 'landunit') then - if (subgrid%ltype(n) == subgrid_special_indices%ilun_vegetated_or_bare_soil) then - is_baresoil = .true. - end if - else - if (masterproc) then - write(iulog,*)'ERROR interpinic: is_baresoil subgrid type ',subgrid%name,' not supported' - end if - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end function is_baresoil - - !----------------------------------------------------------------------- - function is_vegetated_landunit(this, ltype) - ! - ! !DESCRIPTION: - ! Returns true if the given landunit type is vegetated: either natural veg or crop - ! - ! !USES: - ! - ! !ARGUMENTS: - logical :: is_vegetated_landunit ! function result - class(subgrid_special_indices_type), intent(in) :: this - integer, intent(in) :: ltype ! landunit type of interest - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'is_vegetated_landunit' - !----------------------------------------------------------------------- - - if (ltype == this%ilun_vegetated_or_bare_soil .or. & - ltype == this%ilun_crop) then - is_vegetated_landunit = .true. - else - is_vegetated_landunit = .false. - end if - - end function is_vegetated_landunit - - -end module initInterpMindist diff --git a/src/init_interp/initInterpMultilevelBase.F90 b/src/init_interp/initInterpMultilevelBase.F90 deleted file mode 100644 index ae15b263eb..0000000000 --- a/src/init_interp/initInterpMultilevelBase.F90 +++ /dev/null @@ -1,91 +0,0 @@ -module initInterpMultilevelBase - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a base class for handling multi-level fields - ! - ! Usage: For a given variable: - ! - ! First call check_npts with the number of destination points, to ensure that this - ! interpolator is appropriate for this variable. - ! - ! Then call interp_multilevel once for each destination point - ! - ! Note that these interpolators only care about the destination point, not the source - ! point. Any information on the source grid is expected to have already been - ! interpolated to the destination grid. (This is needed for the sake of memory - ! scalability: Information on the source grid is not decomposed across processors, so - ! results in large amounts of memory usage.) - ! - ! !USES: - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_type - - type, abstract :: interp_multilevel_type - contains - procedure(check_npts_interface), deferred :: check_npts - procedure(interp_multilevel_interface), deferred :: interp_multilevel - procedure(get_description_interface), deferred :: get_description ! get text description of interpolator - end type interp_multilevel_type - - abstract interface - - subroutine check_npts_interface(this, npts, varname) - ! !DESCRIPTION: - ! Checks the number of destination points, to ensure that this interpolator is - ! appropriate for this variable. This should be called once for each variable. - ! - ! Aborts if there is a mismatch. - ! - ! !USES: - import:: interp_multilevel_type - ! - ! !ARGUMENTS: - class(interp_multilevel_type), intent(in) :: this - integer, intent(in) :: npts ! number of dest points (on this processor) - character(len=*), intent(in) :: varname ! variable name (for diagnostic output) - end subroutine check_npts_interface - - subroutine interp_multilevel_interface(this, & - data_dest, data_source, index_dest) - ! !DESCRIPTION: - ! Interpolates a multi-level field from source to dest, for a single point. - ! - ! data_dest and data_source give values for all levels, for one destination or - ! source point. index_dest gives the spatial index (e.g., column index) of the dest - ! point; this is needed for some types of interpolation (to find the appropriate - ! metadata), but is ignored by others. This index should be 1-based (i.e., if the - ! lower bounds in the caller are not 1, they should be adjusted so that the first - ! index is 1). - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - import :: interp_multilevel_type - ! - ! !ARGUMENTS: - class(interp_multilevel_type), intent(in) :: this - real(r8) , intent(inout) :: data_dest(:) - real(r8) , intent(in) :: data_source(:) - integer , intent(in) :: index_dest - end subroutine interp_multilevel_interface - - pure function get_description_interface(this) result(description) - ! !DESCRIPTION - ! Returns a text description of this interpolator - ! - ! !USES: - import :: interp_multilevel_type - ! - ! !ARGUMENTS: - character(len=:), allocatable :: description ! function result - class(interp_multilevel_type), intent(in) :: this - end function get_description_interface - end interface - -end module initInterpMultilevelBase diff --git a/src/init_interp/initInterpMultilevelContainer.F90 b/src/init_interp/initInterpMultilevelContainer.F90 deleted file mode 100644 index 1c16518117..0000000000 --- a/src/init_interp/initInterpMultilevelContainer.F90 +++ /dev/null @@ -1,494 +0,0 @@ -module initInterpMultilevelContainer - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class that contains one instance of each interp_multilevel - ! type. This class is responsible for: - ! - ! (1) Constructing each interp_multilevel object - ! - ! (2) Determining which interp_multilevel object should be used for each multi-level - ! field (based on the field's level dimension) - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use initInterpBounds , only : interp_bounds_type - use initInterpMultilevelBase , only : interp_multilevel_type - use initInterpMultilevelCopy , only : interp_multilevel_copy_type - use initInterpMultilevelInterp , only : interp_multilevel_interp_type - use initInterpMultilevelSnow , only : interp_multilevel_snow_type - use initInterpMultilevelSplit , only : interp_multilevel_split_type, create_interp_multilevel_split_type - use initInterp2dvar , only : interp_2dvar_type - use initInterp1dData , only : interp_1d_data - use ncdio_pio , only : file_desc_t, var_desc_t, check_var, ncd_io - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use array_utils , only : transpose_wrapper - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_container_type - - type :: interp_multilevel_container_type - private - ! Components need to be pointers so that we can return pointers to them. - ! - ! (Components of a derived type cannot have the target attribute, but rather take on - ! the target attribute from their parent object. So the alternative to making these - ! pointers would be to require all instances of this derived type to have the target - ! attribute.) - type(interp_multilevel_copy_type), pointer :: interp_multilevel_copy - type(interp_multilevel_interp_type), pointer :: interp_multilevel_levgrnd_col - type(interp_multilevel_interp_type), pointer :: interp_multilevel_levgrnd_pft - type(interp_multilevel_snow_type), pointer :: interp_multilevel_levsno - type(interp_multilevel_snow_type), pointer :: interp_multilevel_levsno1 - type(interp_multilevel_split_type), pointer :: interp_multilevel_levtot_col - contains - procedure :: find_interpolator - end type interp_multilevel_container_type - - interface interp_multilevel_container_type - module procedure constructor - end interface interp_multilevel_container_type - - ! Private routines - - private :: create_interp_multilevel_levgrnd - private :: interp_levgrnd_check_source_file - private :: create_snow_interpolators - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor(ncid_source, ncid_dest, bounds_source, bounds_dest, & - pftindex, colindex) result(this) - ! - ! !DESCRIPTION: - ! Create an interp_multilevel_container_type instance. - ! - ! !USES: - use ncdio_pio, only : file_desc_t - ! - ! !ARGUMENTS: - type(interp_multilevel_container_type) :: this ! function result - type(file_desc_t), target, intent(inout) :: ncid_source ! netcdf ID for source file - type(file_desc_t), target, intent(inout) :: ncid_dest ! netcdf ID for dest file - type(interp_bounds_type), intent(in) :: bounds_source - type(interp_bounds_type), intent(in) :: bounds_dest - - ! The following give mappings from source to dest for pft and col-level variables. - ! e.g., colindex(i) gives source col corresponding to dest col i. - integer, intent(in) :: pftindex(:) - integer, intent(in) :: colindex(:) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - allocate(this%interp_multilevel_copy) - this%interp_multilevel_copy = interp_multilevel_copy_type() - - allocate(this%interp_multilevel_levgrnd_col) - this%interp_multilevel_levgrnd_col = create_interp_multilevel_levgrnd( & - ncid_source = ncid_source, & - ncid_dest = ncid_dest, & - bounds_source = bounds_source, & - bounds_dest = bounds_dest, & - coord_varname = 'COL_Z', & - level_class_varname = 'LEVGRND_CLASS', & - sgridindex = colindex) - - allocate(this%interp_multilevel_levgrnd_pft) - this%interp_multilevel_levgrnd_pft = create_interp_multilevel_levgrnd( & - ncid_source = ncid_source, & - ncid_dest = ncid_dest, & - bounds_source = bounds_source, & - bounds_dest = bounds_dest, & - coord_varname = 'COL_Z_p', & - level_class_varname = 'LEVGRND_CLASS_p', & - sgridindex = pftindex) - - allocate(this%interp_multilevel_levsno) - allocate(this%interp_multilevel_levsno1) - call create_snow_interpolators( & - interp_multilevel_levsno = this%interp_multilevel_levsno, & - interp_multilevel_levsno1 = this%interp_multilevel_levsno1, & - ncid_source = ncid_source, & - bounds_source = bounds_source, & - bounds_dest = bounds_dest, & - colindex = colindex) - - ! levtot is two sets of levels: first snow, then levgrnd - allocate(this%interp_multilevel_levtot_col) - this%interp_multilevel_levtot_col = create_interp_multilevel_split_type( & - interpolator_first_levels = this%find_interpolator('levsno', 'column'), & - interpolator_second_levels = this%interp_multilevel_levgrnd_col, & - num_second_levels_source = this%interp_multilevel_levgrnd_col%get_nlev_source(), & - num_second_levels_dest = this%interp_multilevel_levgrnd_col%get_nlev_dest()) - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - function find_interpolator(this, lev_dimname, vec_dimname) result(interpolator) - ! - ! !DESCRIPTION: - ! Given the name of the level dimension and the vector dimension, return a pointer to - ! an interpolator that is appropriate for this multi-level variable. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_type), pointer :: interpolator ! function result - - class(interp_multilevel_container_type), intent(in) :: this - character(len=*), intent(in) :: lev_dimname ! name of level dimension - character(len=*), intent(in) :: vec_dimname ! name of vector dimension - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'find_interpolator' - !----------------------------------------------------------------------- - - select case (lev_dimname) - case ('levgrnd') - select case (vec_dimname) - case ('column') - interpolator => this%interp_multilevel_levgrnd_col - case ('pft') - interpolator => this%interp_multilevel_levgrnd_pft - case default - call error_not_found(subname, lev_dimname, vec_dimname) - end select - case ('levtot') - select case (vec_dimname) - case ('column') - interpolator => this%interp_multilevel_levtot_col - case default - call error_not_found(subname, lev_dimname, vec_dimname) - end select - case ('levsno') - interpolator => this%interp_multilevel_levsno - case ('levsno1') - interpolator => this%interp_multilevel_levsno1 - case default - interpolator => this%interp_multilevel_copy - end select - - contains - subroutine error_not_found(subname, lev_dimname, vec_dimname) - ! Write an error message and abort - character(len=*), intent(in) :: subname - character(len=*), intent(in) :: lev_dimname - character(len=*), intent(in) :: vec_dimname - - write(iulog,*) subname//' ERROR: no multi-level interpolator found for:' - write(iulog,*) 'lev_dimname = ', trim(lev_dimname) - write(iulog,*) 'vec_dimname = ', trim(vec_dimname) - call endrun(msg='ERROR: no multi-level interpolator found '//errMsg(sourcefile, __LINE__)) - end subroutine error_not_found - - end function find_interpolator - - ! ======================================================================== - ! Private methods and routines - ! ======================================================================== - - !----------------------------------------------------------------------- - function create_interp_multilevel_levgrnd(ncid_source, ncid_dest, & - bounds_source, bounds_dest, & - coord_varname, level_class_varname, & - sgridindex) & - result(interpolator) - ! - ! !DESCRIPTION: - ! Create the interpolator used to interpolate variables dimensioned by levgrnd - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_multilevel_interp_type) :: interpolator ! function result - type(file_desc_t), target, intent(inout) :: ncid_source - type(file_desc_t), target, intent(inout) :: ncid_dest - type(interp_bounds_type), intent(in) :: bounds_source - type(interp_bounds_type), intent(in) :: bounds_dest - character(len=*), intent(in) :: coord_varname - character(len=*), intent(in) :: level_class_varname - integer, intent(in) :: sgridindex(:) ! mappings from source to dest points for the appropriate subgrid level (e.g., column-level mappings if this interpolator is for column-level data) - ! - ! !LOCAL VARIABLES: - type(interp_2dvar_type) :: coord_source - type(interp_2dvar_type) :: coord_dest - type(interp_2dvar_type) :: level_class_source - type(interp_2dvar_type) :: level_class_dest - real(r8), pointer :: coord_data_source_sgrid_1d(:) ! [vec] On the source grid - real(r8), allocatable :: coord_data_source(:,:) ! [vec, lev] Interpolated to the dest grid, but source vertical grid - real(r8), pointer :: coord_data_dest(:,:) ! [vec, lev] Dest horiz & vertical grid - integer , pointer :: level_class_data_source_sgrid_1d(:) ! [vec] On the source grid - integer , allocatable :: level_class_data_source(:,:) ! [vec, lev] Interpolated to the dest grid, but source vertical grid - integer , pointer :: level_class_data_dest(:,:) ! [vec, lev] Dest horiz & vertical grid - real(r8), allocatable :: coord_data_source_transpose(:,:) ! [lev, vec] - real(r8), allocatable :: coord_data_dest_transpose(:,:) ! [lev, vec] - integer , allocatable :: level_class_data_source_transpose(:,:) ! [lev, vec] - integer , allocatable :: level_class_data_dest_transpose(:,:) ! [lev, vec] - - integer :: beg_dest - integer :: end_dest - integer :: beg_source - integer :: end_source - - integer :: level - integer :: nlev_source - - character(len=*), parameter :: subname = 'create_interp_multilevel_levgrnd' - !----------------------------------------------------------------------- - - ! Set coord_data_dest - coord_dest = interp_2dvar_type( & - varname = coord_varname, & - ncid = ncid_dest, & - file_is_dest = .true., & - bounds = bounds_dest) - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "READVAR"'. So we - ! explicitly call the specific routine, rather than calling readvar. - call coord_dest%readvar_double(coord_data_dest) - beg_dest = coord_dest%get_vec_beg() - end_dest = coord_dest%get_vec_end() - - ! Set level_class_data_dest - level_class_dest = interp_2dvar_type( & - varname = level_class_varname, & - ncid = ncid_dest, & - file_is_dest = .true., & - bounds = bounds_dest) - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "READVAR"'. So we - ! explicitly call the specific routine, rather than calling readvar. - call level_class_dest%readvar_int(level_class_data_dest) - SHR_ASSERT(level_class_dest%get_vec_beg() == beg_dest, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(level_class_dest%get_vec_end() == end_dest, errMsg(sourcefile, __LINE__)) - - ! NOTE(wjs, 2015-10-18) The following check is helpful while we still have old initial - ! conditions files that do not have the necessary metadata. Once these old initial - ! conditions files have been phased out, we can remove this check. (Without this - ! check, the run will still abort if it can't find the necessary variables - it just - ! won't have a very helpful error message.) - call interp_levgrnd_check_source_file(ncid_source, coord_varname, level_class_varname) - - ! Set coord_data_source - coord_source = interp_2dvar_type( & - varname = coord_varname, & - ncid = ncid_source, & - file_is_dest = .false., & - bounds = bounds_source) - nlev_source = coord_source%get_nlev() - beg_source = coord_source%get_vec_beg() - end_source = coord_source%get_vec_end() - allocate(coord_data_source(beg_dest:end_dest, nlev_source)) - allocate(coord_data_source_sgrid_1d(beg_source:end_source)) - do level = 1, nlev_source - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "READLEVEL"'. So we - ! explicitly call the specific routine, rather than calling readlevel. - call coord_source%readlevel_double(coord_data_source_sgrid_1d, level) - call interp_1d_data( & - begi = beg_source, endi = end_source, & - bego = beg_dest, endo = end_dest, & - sgridindex = sgridindex, & - keep_existing = .false., & - data_in = coord_data_source_sgrid_1d, & - data_out = coord_data_source(:,level)) - end do - deallocate(coord_data_source_sgrid_1d) - - ! Set level_class_data_source - level_class_source = interp_2dvar_type( & - varname = level_class_varname, & - ncid = ncid_source, & - file_is_dest = .false., & - bounds = bounds_source) - SHR_ASSERT(level_class_source%get_nlev() == nlev_source, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(level_class_source%get_vec_beg() == beg_source, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(level_class_source%get_vec_end() == end_source, errMsg(sourcefile, __LINE__)) - allocate(level_class_data_source(beg_dest:end_dest, nlev_source)) - allocate(level_class_data_source_sgrid_1d(beg_source:end_source)) - do level = 1, nlev_source - ! COMPILER_BUG(wjs, 2015-11-25, cray8.4.0) The cray compiler has trouble - ! resolving the generic reference here, giving the message: 'No specific - ! match can be found for the generic subprogram call "READLEVEL"'. So we - ! explicitly call the specific routine, rather than calling readlevel. - call level_class_source%readlevel_int(level_class_data_source_sgrid_1d, level) - call interp_1d_data( & - begi = beg_source, endi = end_source, & - bego = beg_dest, endo = end_dest, & - sgridindex = sgridindex, & - keep_existing = .false., & - data_in = level_class_data_source_sgrid_1d, & - data_out = level_class_data_source(:,level)) - end do - deallocate(level_class_data_source_sgrid_1d) - - ! Create interpolator - call transpose_wrapper(coord_data_source_transpose, coord_data_source) - call transpose_wrapper(coord_data_dest_transpose, coord_data_dest) - call transpose_wrapper(level_class_data_source_transpose, level_class_data_source) - call transpose_wrapper(level_class_data_dest_transpose, level_class_data_dest) - interpolator = interp_multilevel_interp_type( & - coordinates_source = coord_data_source_transpose, & - coordinates_dest = coord_data_dest_transpose, & - level_classes_source = level_class_data_source_transpose, & - level_classes_dest = level_class_data_dest_transpose, & - coord_varname = coord_varname) - - ! Deallocate pointers (allocatables are automatically deallocated) - deallocate(coord_data_dest) - deallocate(level_class_data_dest) - - end function create_interp_multilevel_levgrnd - - !----------------------------------------------------------------------- - subroutine interp_levgrnd_check_source_file(ncid_source, coord_varname, level_class_varname) - ! - ! !DESCRIPTION: - ! Ensure that the necessary variables are present on the source file for the levgrnd - ! interpolator. - ! - ! Aborts the run with a useful error message if either variable is missing - ! - ! !USES: - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid_source - character(len=*) , intent(in) :: coord_varname - character(len=*) , intent(in) :: level_class_varname - ! - ! !LOCAL VARIABLES: - logical :: coord_on_source - logical :: level_class_on_source - type(var_desc_t) :: coord_source_vardesc ! unused, but needed for check_var interface - type(var_desc_t) :: level_class_source_vardesc ! unused, but needed for check_var interface - character(len=:), allocatable :: variables_missing - - character(len=*), parameter :: subname = 'interp_levgrnd_check_source_file' - !----------------------------------------------------------------------- - - variables_missing = ' ' - call check_var(ncid_source, coord_varname, coord_source_vardesc, coord_on_source) - if (.not. coord_on_source) then - variables_missing = variables_missing // coord_varname // ' ' - end if - call check_var(ncid_source, level_class_varname, level_class_source_vardesc, level_class_on_source) - if (.not. level_class_on_source) then - variables_missing = variables_missing // level_class_varname // ' ' - end if - if (variables_missing /= ' ') then - if (masterproc) then - write(iulog,*) subname//& - ' ERROR: source file for init_interp is missing the necessary variable(s):' - write(iulog,*) variables_missing - write(iulog,*) 'To solve this problem, run the model for a short time using this tag,' - write(iulog,*) 'with a configuration that matches the source file, using the source' - write(iulog,*) 'file as finidat (with use_init_interp = .false.), in order to' - write(iulog,*) 'produce a new restart file with the necessary metadata.' - write(iulog,*) 'Then use that new file as the finidat file for init_interp.' - write(iulog,*) ' ' - write(iulog,*) 'If that is not possible, then an alternative is to run the model for' - write(iulog,*) 'a short time using this tag, with cold start initial conditions' - write(iulog,*) '(finidat = " "). Then use a tool like ncks to copy the misssing fields' - write(iulog,*) 'onto the original source finidat file. Then use that patched file' - write(iulog,*) 'as the finidat file for init_interp.' - end if - - call endrun(subname//' ERROR: source file for init_interp is missing '// & - variables_missing) - end if - - end subroutine interp_levgrnd_check_source_file - - !----------------------------------------------------------------------- - subroutine create_snow_interpolators(interp_multilevel_levsno, interp_multilevel_levsno1, & - ncid_source, bounds_source, bounds_dest, colindex) - ! - ! !DESCRIPTION: - ! Create multi-level interpolators for snow variables - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_multilevel_snow_type), intent(out) :: interp_multilevel_levsno - type(interp_multilevel_snow_type), intent(out) :: interp_multilevel_levsno1 - type(file_desc_t), intent(inout) :: ncid_source ! netcdf ID for source file - type(interp_bounds_type), intent(in) :: bounds_source - type(interp_bounds_type), intent(in) :: bounds_dest - integer, intent(in) :: colindex(:) ! mappings from source to dest for column-level arrays - ! - ! !LOCAL VARIABLES: - ! snlsno_source needs to be a pointer to satisfy the interface of ncd_io - integer, pointer :: snlsno_source_sgrid(:) ! snlsno in source, on source grid - integer, allocatable :: snlsno_source(:) ! snlsno_source interpolated to dest - integer, allocatable :: snlsno_source_plus_1(:) ! snlsno_source+1 interpolated to dest - - character(len=*), parameter :: subname = 'create_snow_interpolators' - !----------------------------------------------------------------------- - - ! Read snlsno_source_sgrid - allocate(snlsno_source_sgrid(bounds_source%get_begc() : bounds_source%get_endc())) - call ncd_io(ncid=ncid_source, varname='SNLSNO', flag='read', & - data=snlsno_source_sgrid) - snlsno_source_sgrid(:) = abs(snlsno_source_sgrid(:)) - - ! Interpolate to dest - allocate(snlsno_source(bounds_dest%get_begc() : bounds_dest%get_endc())) - call interp_1d_data( & - begi = bounds_source%get_begc(), endi = bounds_source%get_endc(), & - bego = bounds_dest%get_begc(), endo = bounds_dest%get_endc(), & - sgridindex = colindex, & - keep_existing = .false., & - data_in = snlsno_source_sgrid, data_out = snlsno_source) - deallocate(snlsno_source_sgrid) - - ! Set up interp_multilevel_levsno - interp_multilevel_levsno = interp_multilevel_snow_type( & - num_snow_layers_source = snlsno_source, & - num_layers_name = 'SNLSNO') - - ! Set up interp_multilevel_levsno1 - ! - ! For variables dimensioned (levsno+1), we assume they have (snlsno+1) active layers. - ! Thus, if there are 0 active layers in the source, the bottom layer's value will - ! still get copied for these (levsno+1) variables. - allocate(snlsno_source_plus_1(bounds_dest%get_begc() : bounds_dest%get_endc())) - snlsno_source_plus_1(:) = snlsno_source(:) + 1 - interp_multilevel_levsno1 = interp_multilevel_snow_type( & - num_snow_layers_source = snlsno_source_plus_1, & - num_layers_name = 'SNLSNO+1') - - deallocate(snlsno_source) - deallocate(snlsno_source_plus_1) - - end subroutine create_snow_interpolators - - -end module initInterpMultilevelContainer diff --git a/src/init_interp/initInterpMultilevelCopy.F90 b/src/init_interp/initInterpMultilevelCopy.F90 deleted file mode 100644 index 5cfd47d247..0000000000 --- a/src/init_interp/initInterpMultilevelCopy.F90 +++ /dev/null @@ -1,139 +0,0 @@ -module initInterpMultilevelCopy - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class for handling multi-level fields by simply copying the - ! source to the destination, assuming the same number of levels in each. - ! - ! !USES: -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use initInterpMultilevelBase , only : interp_multilevel_type - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_copy_type - - type, extends(interp_multilevel_type) :: interp_multilevel_copy_type - ! COMPILER_BUG(wjs, 2015-10-20, intel15.0.1) intel has problems creating a pointer to - ! a class without any data components. Thus, including this unused dummy_var to make - ! intel happy. - integer :: dummy_var - contains - procedure :: check_npts - procedure :: interp_multilevel - procedure :: get_description - end type interp_multilevel_copy_type - - interface interp_multilevel_copy_type - module procedure constructor - end interface interp_multilevel_copy_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - type(interp_multilevel_copy_type) function constructor() - ! - ! !DESCRIPTION: - ! Creates a new interp_multilevel_copy_type object - !----------------------------------------------------------------------- - - ! Nothing needs to be done - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine check_npts(this, npts, varname) - ! - ! !DESCRIPTION: - ! Checks the number of destination points, to ensure that this interpolator is - ! appropriate for this variable. This should be called once for each variable. - ! - ! This version accepts any number of points, because it has no point-based metadata. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_copy_type), intent(in) :: this - integer, intent(in) :: npts ! number of dest points (on this processor) - character(len=*), intent(in) :: varname ! variable name (for diagnostic output) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'check_npts' - !----------------------------------------------------------------------- - - return - - end subroutine check_npts - - - !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) - ! - ! !DESCRIPTION: - ! Interpolates a multi-level field from source to dest, for a single point. - ! - ! This version requires that data_dest and data_source be the same size, and it simply - ! copies source to dest. - ! - ! !ARGUMENTS: - class(interp_multilevel_copy_type), intent(in) :: this - real(r8) , intent(inout) :: data_dest(:) - real(r8) , intent(in) :: data_source(:) - integer , intent(in) :: index_dest - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'interp_multilevel' - !----------------------------------------------------------------------- - - SHR_ASSERT((size(data_source) == size(data_dest)), errMsg(sourcefile, __LINE__)) - - ! Note that it's safe to do whole-array assignment here because we never decompose - ! along the level dimension (in contrast to the spatial dimension, where you need to - ! specify explicit bounds). - data_dest(:) = data_source(:) - - end subroutine interp_multilevel - - !----------------------------------------------------------------------- - pure function get_description(this) result(description) - ! - ! !DESCRIPTION: - ! Returns a text description of this interpolator - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=:), allocatable :: description ! function result - class(interp_multilevel_copy_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_description' - !----------------------------------------------------------------------- - - description = 'Copy levels' - - end function get_description - -end module initInterpMultilevelCopy - diff --git a/src/init_interp/initInterpMultilevelInterp.F90 b/src/init_interp/initInterpMultilevelInterp.F90 deleted file mode 100644 index 4057d63e25..0000000000 --- a/src/init_interp/initInterpMultilevelInterp.F90 +++ /dev/null @@ -1,599 +0,0 @@ -module initInterpMultilevelInterp - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class for handling multi-level fields by interpolating based on - ! a coordinate variable. This interpolation scheme also allows different levels to - ! belong to different level_classes; the interpolation for a level belonging to - ! level_class N only considers source levels that also belong to level_class N. - ! - ! - ! ------------------------------------------------------------------------ - ! NOTE(wjs, 2015-10-22) Note about handling of spval (and NaN) values in the source and - ! destination data (i.e., the data themselves, as opposed to the coordinate or - ! level_class arrays): It feels like there are two different possible uses for spval in - ! multi-level arrays; this class assumes the "static" use of spval (#1 below): - ! - ! (1) A "static" spval, e.g., based on depth for a given variable: e.g., "given this - ! vertical discretization, this variable only applies to a depth of 5 m, and so should - ! always remain spval below 5 m". For this case, if the destination is spval, then it - ! should remain spval - because spval is more about the grid (vertical discretization, - ! surface dataset, etc.) than about anything dynamic in time. A spval in the source - ! data should be ignored (rather than being used in the interpolation), so that the - ! destination array gets filled for all levels where it was not originally spval, using - ! extrapolation if necessary (e.g., if the source array had spvals at some levels where - ! the destination array needs valid data). - ! - ! (2) A "dynamic" spval, e.g., signaling that this layer should be treated specially - ! right now, but that may change in time. For this case, an spval in the destination - ! should be treated no differently from any other value: it should be replaced by - ! values from the source grid. An spval in the source would need to be handled - ! specially (e.g.: if both sides of the interpolation are spval then the result is - ! spval; if one side is spval, then use the other point). (We can't simply ignore / - ! exclude source levels with spval in this case, because an spval has true meaning that - ! should be transferred to the nearby levels in the destination array.) - ! - ! These two uses are fundamentally incompatible: Either we keep spvals in the - ! destination array as spval (the "static" case), or we replace spvals in the - ! destination array (the "dynamic" case). The only way we could handle both - ! possibilities is if variables had metadata saying whether they were using a "dynamic" - ! or "static" treatment of spvals - but that feels confusing. - ! - ! Looking through current multi-level variables, it looked like there were a number of - ! uses of "static" spvals, and one use of "dynamic" spvals (in the ch4 code). I have now - ! removed the "dynamic" spval. - ! - ! This class assumes the "static" use of spval - i.e., case (1) above. This is partly to - ! reflect the current usage in the code, and partly because it's easier to detect - ! improper use of a "dynamic" spval when we assume "static" spval (through an LII test) - ! than it is to detect improper use of a "static" spval when we assume "dynamic" spval. - ! (The latter would tend to just show up as a problem when interpolating from one - ! vertical grid to another, and it's hard to confirm correctness of that interpolation - ! in an automated test.) - ! - ! Thus, multi-level arrays (at least those that are potentially interpolated vertically) - ! should NOT use the "dynamic" use of spval (case (2)). That is, spval should only be - ! used in places where that spval will remain spval throughout the run. - ! ------------------------------------------------------------------------ - ! - ! !USES: -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : spval, ispval - use initInterpMultilevelBase , only : interp_multilevel_type - use array_utils , only : pack_wrapper - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_interp_type - - type, extends(interp_multilevel_type) :: interp_multilevel_interp_type - private - character(len=:), allocatable :: coord_varname ! name of coordinate variable (just used for identification purposes) - - ! The following 'source' arrays store information about the source grid, but - ! regridded to the destination grid. e.g., coordinates_source(n,i) gives the - ! coordinate value for level n on the source grid, for the source grid point that - ! maps to destination point i. - real(r8), allocatable :: coordinates_source(:,:) ! coordinate values on source grid [lev, pt] - real(r8), allocatable :: coordinates_dest(:,:) ! coordinate values on dest grid [lev, pt] - integer , allocatable :: level_classes_source(:,:) ! class indices on source grid [lev, pt] - integer , allocatable :: level_classes_dest(:,:) ! class indices on dest grid [lev, pt] - - integer :: npts ! number of spatial points on dest grid - integer :: nlev_source ! number of levels on source grid - integer :: nlev_dest ! number of levels on dest grid - contains - ! Public methods from base class - procedure :: check_npts - procedure :: interp_multilevel - procedure :: get_description - - ! Public methods specific to this class - procedure :: get_nlev_source ! get number of levels on source grid - procedure :: get_nlev_dest ! get number of levels on dest grid - - ! Private methods - procedure, private :: check_coordinate_array - procedure, private, nopass :: confirm_monotonically_increasing - procedure, private, nopass :: interp_onelevel ! do the interpolation for a single dest level - procedure, private, nopass :: is_missing ! true if a value is considered missing - end type interp_multilevel_interp_type - - interface interp_multilevel_interp_type - module procedure constructor_with_levclasses - module procedure constructor_no_levclasses - end interface interp_multilevel_interp_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor_no_levclasses(coordinates_source, coordinates_dest, coord_varname) & - result(this) - ! - ! !DESCRIPTION: - ! Construct an interp_multilevel_interp_type object, where all levels have the same - ! level_class. - ! - ! Coordinates must be monotonically increasing. - ! - ! coordinates_source gives information about the source grid, but regridded to the - ! destination grid. So coordinates_source(n,i) gives the coordinate value for level - ! n on the source grid, for the source grid point that maps to destination point i. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_multilevel_interp_type) :: this ! function result - real(r8), intent(in) :: coordinates_source(:,:) ! coordinate values on source grid [lev, pt] - real(r8), intent(in) :: coordinates_dest(:,:) ! coordinate values on dest grid [lev, pt] - character(len=*), intent(in) :: coord_varname ! name of coordinate variable (just used for identification purposes) - ! - ! !LOCAL VARIABLES: - integer :: npts - integer :: nlev_source, nlev_dest - integer, allocatable :: level_classes_source(:,:) - integer, allocatable :: level_classes_dest(:,:) - - character(len=*), parameter :: subname = 'constructor_no_levclasses' - !----------------------------------------------------------------------- - - npts = size(coordinates_source, 2) - SHR_ASSERT((size(coordinates_dest, 2) == npts), errMsg(sourcefile, __LINE__)) - - nlev_source = size(coordinates_source, 1) - nlev_dest = size(coordinates_dest, 1) - - allocate(level_classes_source(nlev_source, npts), source = 1) - allocate(level_classes_dest(nlev_dest, npts), source = 1) - - this = interp_multilevel_interp_type( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - level_classes_source = level_classes_source, & - level_classes_dest = level_classes_dest, & - coord_varname = coord_varname) - - end function constructor_no_levclasses - - - !----------------------------------------------------------------------- - function constructor_with_levclasses(coordinates_source, coordinates_dest, & - level_classes_source, level_classes_dest, & - coord_varname) & - result(this) - ! - ! !DESCRIPTION: - ! Construct an interp_multilevel_interp_type object, where classes are specified for - ! each level. - ! - ! Coordinates must be monotonically increasing. - ! - ! coordinates_source and level_classes_source give information about the source grid, - ! but regridded to the destination grid. e.g., coordinates_source(n,i) gives the - ! coordinate value for level n on the source grid, for the source grid point that maps - ! to destination point i. - ! - ! For the 'level_classes': The particular values are not important; the important - ! thing is that, for a given column, levels that are fundamentally different should - ! have different values. This ensures that data are not copied from one class of - ! levels to another (e.g., between soil and bedrock). - ! - ! However, a level whose class is ispval is treated specially: This is treated as a - ! non-existent level: In the destination data, its value is left unchanged; in the - ! source data, its value is never used in the interpolation. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_multilevel_interp_type) :: this ! function result - real(r8), intent(in) :: coordinates_source(:,:) ! coordinate values on source grid [lev, pt] - real(r8), intent(in) :: coordinates_dest(:,:) ! coordinate values on dest grid [lev, pt] - integer , intent(in) :: level_classes_source(:,:) ! class indices on source grid [lev, pt] - integer , intent(in) :: level_classes_dest(:,:) ! class indices on dest grid [lev, pt] - character(len=*), intent(in) :: coord_varname ! name of coordinate variable (just used for identification purposes) - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'constructor_with_levclasses' - !----------------------------------------------------------------------- - - this%coord_varname = trim(coord_varname) - - this%npts = size(coordinates_source, 2) - SHR_ASSERT((size(coordinates_dest, 2) == this%npts), errMsg(sourcefile, __LINE__)) - - this%nlev_source = size(coordinates_source, 1) - this%nlev_dest = size(coordinates_dest, 1) - - SHR_ASSERT_ALL((shape(level_classes_source) == [this%nlev_source, this%npts]), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((shape(level_classes_dest) == [this%nlev_dest, this%npts]), errMsg(sourcefile, __LINE__)) - - do i = 1, this%npts - call this%check_coordinate_array(coordinates_source(:,i), level_classes_source(:,i)) - end do - do i = 1, this%npts - call this%check_coordinate_array(coordinates_dest(:,i), level_classes_dest(:,i)) - end do - - this%coordinates_source = coordinates_source - this%coordinates_dest = coordinates_dest - this%level_classes_source = level_classes_source - this%level_classes_dest = level_classes_dest - - end function constructor_with_levclasses - - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine check_npts(this, npts, varname) - ! - ! !DESCRIPTION: - ! Checks the number of destination points, to ensure that this interpolator is - ! appropriate for this variable. This should be called once for each variable. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_interp_type), intent(in) :: this - integer, intent(in) :: npts ! number of dest points (on this processor) - character(len=*), intent(in) :: varname ! variable name (for diagnostic output) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'check_npts' - !----------------------------------------------------------------------- - - if (npts /= this%npts) then - write(iulog,*) subname//' ERROR: mismatch in number of dest points for ', & - trim(varname) - write(iulog,*) 'Number of dest points: ', npts - write(iulog,*) 'Expected number of dest points: ', this%npts - call endrun(msg=subname//' ERROR: mismatch in number of points for '//& - trim(varname) // ' ' // errMsg(sourcefile, __LINE__)) - end if - - end subroutine check_npts - - !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) - ! - ! !DESCRIPTION: - ! Interpolates a multi-level field from source to dest, for a single point. - ! - ! This version does a true interpolation, using a coordinate variable. The coordinate - ! variable (along with the group to which each level belongs) can vary for each - ! spatial point. Thus, index_dest is used in this version, and is must be within the - ! bounds of the metadata. This index should be 1-based. - ! - ! If level_classes were provided for this object (i.e., level_classes_source and - ! level_classes_dest), then: For a given destination level, the interpolation is done - ! only over source levels whose class matches the destination level's class. In - ! addition, if the destination level's class is ispval, then the destination data is - ! left unchanged for that level. - ! - ! Levels whose data value is spval are treated the same as levels whose class is - ! ispval: If the destination data begins as spval, then it is left as spval (with the - ! assumption that this is truly meant to remain as missing data in the destination). - ! And any source level that has data = spval is ignored. NaN values are treated the - ! same as spval in this respect. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_interp_type), intent(in) :: this - real(r8) , intent(inout) :: data_dest(:) - real(r8) , intent(in) :: data_source(:) - integer , intent(in) :: index_dest - ! - ! !LOCAL VARIABLES: - integer :: lev_dest - integer :: level_class_dest - integer :: lev_source - - ! source information for this index_dest - real(r8) :: my_level_classes_source(this%nlev_source) - real(r8) :: my_coordinates_source(this%nlev_source) - - ! whether each source level is in the destination level_class - logical :: source_levels_in_class(this%nlev_source) - - ! data and coordinates packed to just contain levels in the destination level_class: - real(r8), allocatable :: data_source_in_class(:) - real(r8), allocatable :: coordinates_source_in_class(:) - - character(len=*), parameter :: subname = 'interp_multilevel' - !----------------------------------------------------------------------- - - SHR_ASSERT((size(data_dest) == this%nlev_dest), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((size(data_source) == this%nlev_source), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((index_dest >= 1 .and. index_dest <= this%npts), errMsg(sourcefile, __LINE__)) - - my_level_classes_source(:) = this%level_classes_source(:, index_dest) - my_coordinates_source(:) = this%coordinates_source(:, index_dest) - - do lev_dest = 1, this%nlev_dest - level_class_dest = this%level_classes_dest(lev_dest, index_dest) - if (level_class_dest /= ispval) then - if (.not. is_missing(data_dest(lev_dest))) then - do lev_source = 1, this%nlev_source - if (my_level_classes_source(lev_source) /= level_class_dest) then - source_levels_in_class(lev_source) = .false. - else if (is_missing(data_source(lev_source))) then - source_levels_in_class(lev_source) = .false. - else - source_levels_in_class(lev_source) = .true. - end if - end do - call pack_wrapper(data_source_in_class, data_source, source_levels_in_class) - call pack_wrapper(coordinates_source_in_class, my_coordinates_source, source_levels_in_class) - call this%interp_onelevel( & - data_dest = data_dest(lev_dest), & - coordinate_dest = this%coordinates_dest(lev_dest, index_dest), & - data_source = data_source_in_class, & - coordinates_source = coordinates_source_in_class) - end if - end if - end do - - end subroutine interp_multilevel - - !----------------------------------------------------------------------- - pure function get_description(this) result(description) - ! - ! !DESCRIPTION: - ! Returns a text description of this interpolator - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=:), allocatable :: description ! function result - class(interp_multilevel_interp_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_description' - !----------------------------------------------------------------------- - - description = 'Interpolate using '//this%coord_varname - - end function get_description - - !----------------------------------------------------------------------- - pure integer function get_nlev_source(this) - ! Get number of levels on source grid - class(interp_multilevel_interp_type), intent(in) :: this - - get_nlev_source = this%nlev_source - end function get_nlev_source - - !----------------------------------------------------------------------- - pure integer function get_nlev_dest(this) - ! Get number of levels on dest grid - class(interp_multilevel_interp_type), intent(in) :: this - - get_nlev_dest = this%nlev_dest - end function get_nlev_dest - - - ! ======================================================================== - ! Private methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine check_coordinate_array(this, coordinates, level_classes) - ! - ! !DESCRIPTION: - ! Check validity of a coordinate array - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_interp_type), intent(in) :: this - real(r8), intent(in) :: coordinates(:) ! coordinates at all levels, for one point - integer , intent(in) :: level_classes(:) ! classes corresponding to coordinates - ! - ! !LOCAL VARIABLES: - integer :: nlevs - - ! subset of coordinates just in levels that exist (with existence defined based on - ! level_classes) - real(r8), allocatable :: coordinates_in_existing_levels(:) - - character(len=*), parameter :: subname = 'check_coordinate_array' - !----------------------------------------------------------------------- - - nlevs = size(coordinates) - SHR_ASSERT((size(level_classes) == nlevs), errMsg(sourcefile, __LINE__)) - - call pack_wrapper(coordinates_in_existing_levels, coordinates, level_classes /= ispval) - - if (any(is_missing(coordinates_in_existing_levels))) then - ! In principle we could handle spvals in coordinate arrays just like we handle - ! ispval in the level_class or spval in data. However, this likely indicates an - ! error, so for now we look out for that and abort if it is found. - call endrun(msg='spvals or NaNs found in coordinate array where level_class /= ispval; ' // & - 'this is currently unhandled ' // errMsg(sourcefile, __LINE__)) - end if - - call this%confirm_monotonically_increasing(coordinates_in_existing_levels) - - end subroutine check_coordinate_array - - - !----------------------------------------------------------------------- - subroutine confirm_monotonically_increasing(data) - ! - ! !DESCRIPTION: - ! Confirms that an array is monotonically increasing. Dies if not. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), intent(in) :: data(:) - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'confirm_monotonically_increasing' - !----------------------------------------------------------------------- - - do i = 2, size(data) - if (data(i-1) >= data(i)) then - write(iulog,*) subname//' ERROR: array not monotonically increasing: ' - write(iulog,*) data(i-1), data(i) - call endrun(msg=subname//" ERROR: array not monotonically increasing"// & - errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine confirm_monotonically_increasing - - !----------------------------------------------------------------------- - subroutine interp_onelevel(data_dest, coordinate_dest, data_source, coordinates_source) - ! - ! !DESCRIPTION: - ! Do the interpolation for a single destination level - ! - ! !ARGUMENTS: - real(r8), intent(inout) :: data_dest - real(r8), intent(in) :: coordinate_dest - real(r8), intent(in) :: data_source(:) - real(r8), intent(in) :: coordinates_source(:) - ! - ! !LOCAL VARIABLES: - logical :: copylevel - logical :: found - integer :: nlev_source - integer :: lev - integer :: index_lower - - real(r8), parameter :: eps = 1.e-13_r8 - character(len=*), parameter :: subname = 'interp_onelevel' - !----------------------------------------------------------------------- - - nlev_source = size(coordinates_source) - - if (nlev_source == 0) then - ! If there is no source information, then leave the destination data at its - ! original value - return - end if - - ! ------------------------------------------------------------------------ - ! Find level(s) to use for interpolation - ! ------------------------------------------------------------------------ - - found = .false. - - if (coordinate_dest < coordinates_source(1)) then - found = .true. - copylevel = .true. - index_lower = 1 - - else if (coordinate_dest > coordinates_source(nlev_source)) then - found = .true. - copylevel = .true. - index_lower = nlev_source - - else - ! See if coordinate_dest matches one of the source coordinates (within roundoff) - do lev = 1, nlev_source - if ((abs(coordinate_dest - coordinates_source(lev)) < eps)) then - found = .true. - copylevel = .true. - index_lower = lev - exit - end if - end do - - if (.not. found) then - ! Find the interval in which coordinate_dest falls - do lev = 1, nlev_source - if ( (coordinate_dest > coordinates_source(lev)) & - .and. (coordinate_dest < coordinates_source(lev+1)) ) then - found = .true. - copylevel = .false. - index_lower = lev - exit - end if - end do - end if - - end if - - if (.not. found) then - call endrun(subname//' ERROR: Could not find levels to use for interpolation' // & - errMsg(sourcefile, __LINE__)) - end if - - ! ------------------------------------------------------------------------ - ! Do the interpolation - ! ------------------------------------------------------------------------ - - if ( copylevel) then - data_dest = data_source(index_lower) - else - data_dest = & - data_source(index_lower+1) & - * (coordinate_dest - coordinates_source(index_lower)) & - / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) + & - data_source(index_lower) & - * (coordinates_source(index_lower+1) - coordinate_dest ) & - / (coordinates_source(index_lower+1) - coordinates_source(index_lower)) - end if - - end subroutine interp_onelevel - - !----------------------------------------------------------------------- - elemental logical function is_missing(val) - ! - ! !DESCRIPTION: - ! Returns true if the given value is considered missing. - ! - ! spval is treated as missing. NaNs are treated the same as spval. Considering the - ! destination data, the assumption here is that, if a value was uninitialized before - ! (so is NaN), then it shouldn't be set in init_interp. - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan - ! - ! !ARGUMENTS: - real(r8), intent(in) :: val - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'is_missing' - !----------------------------------------------------------------------- - - if (isnan(val)) then - is_missing = .true. - else if (val == spval) then - is_missing = .true. - else - is_missing = .false. - end if - - end function is_missing - - -end module initInterpMultilevelInterp diff --git a/src/init_interp/initInterpMultilevelSnow.F90 b/src/init_interp/initInterpMultilevelSnow.F90 deleted file mode 100644 index a41598f988..0000000000 --- a/src/init_interp/initInterpMultilevelSnow.F90 +++ /dev/null @@ -1,227 +0,0 @@ -module initInterpMultilevelSnow - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class for handling multi-level snow fields. - ! - ! !USES: -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use initInterpMultilevelBase , only : interp_multilevel_type - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_snow_type - - type, extends(interp_multilevel_type) :: interp_multilevel_snow_type - private - character(len=:), allocatable :: num_layers_name - - ! Number of active snow layers on the source grid, regridded to the destination grid - ! - ! Thus, num_snow_layers_source(i) gives the number of active snow layers on the source - ! grid for the source grid point that maps to destination point i. - integer, allocatable :: num_snow_layers_source(:) - contains - procedure :: check_npts - procedure :: interp_multilevel - procedure :: get_description - end type interp_multilevel_snow_type - - interface interp_multilevel_snow_type - module procedure constructor - end interface interp_multilevel_snow_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - type(interp_multilevel_snow_type) function constructor(num_snow_layers_source, & - num_layers_name) - ! - ! !DESCRIPTION: - ! Creates a new interp_multilevel_snow_type object - ! - ! !USES: - ! - ! !ARGUMENTS: - - ! Number of active snow layers on the source grid, regridded to the destination grid - ! - ! Thus, num_snow_layers_source(i) gives the number of active snow layers on the source - ! grid for the source grid point that maps to destination point i. - integer, intent(in) :: num_snow_layers_source(:) - - ! name of variable giving number of snow layers (just used for identification purposes) - character(len=*), intent(in) :: num_layers_name - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - ! We do not check validity of num_snow_layers_source here (i.e., confirming that it - ! is >= 0 everywhere) because it's okay for it to be invalid for points that are - ! never invoked. This is the case for destination points with no corresponding source - ! point (e.g., inactive destination points). - - allocate(constructor%num_snow_layers_source(size(num_snow_layers_source))) - constructor%num_snow_layers_source(:) = num_snow_layers_source(:) - - constructor%num_layers_name = trim(num_layers_name) - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine check_npts(this, npts, varname) - ! - ! !DESCRIPTION: - ! Checks the number of destination points, to ensure that this interpolator is - ! appropriate for this variable. This should be called once for each variable. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_snow_type), intent(in) :: this - integer, intent(in) :: npts ! number of dest points (on this processor) - character(len=*), intent(in) :: varname ! variable name (for diagnostic output) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'check_npts' - !----------------------------------------------------------------------- - - if (npts /= size(this%num_snow_layers_source)) then - write(iulog,*) subname//' ERROR: mismatch in number of dest points for ', & - trim(varname) - write(iulog,*) 'Number of dest points: ', npts - write(iulog,*) 'Expected number of dest points: ', & - size(this%num_snow_layers_source) - call endrun(msg=subname//' ERROR: mismatch in number of points for '//& - trim(varname) // ' ' // errMsg(sourcefile, __LINE__)) - end if - - end subroutine check_npts - - !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) - ! - ! !DESCRIPTION: - ! Interpolates a multi-level field from source to dest, for a single point. - ! - ! This version does an "interpolation" (really a copy with offsets) appropriate for - ! snow variables. - ! - ! For most snow variables, we only need to copy data from EXISTING snow layers. - ! However, there are a few variables (specifically, absorbed radiation fluxes) where - ! we need to copy data even from non-existing snow layers in order to get bit-for-bit - ! behavior upon interpolation. Thus, to be safe, we copy as many levels as possible. - ! The algorithm is as follows: - ! - ! - If (number of destination levels) >= (number of source levels), then copy all - ! source levels to the destination. If there are more destination levels than - ! source levels, then the lowest-index destination levels will be set to 0. - ! - ! - If (number of destination levels) < (number of source levels), but (number of - ! destination levels) >= (number of EXISTING snow levels in source), then copy all - ! existing snow levels to the destination, plus as many non-existing levels as will - ! fit. - ! - ! - If (number of destination levels) < (number of EXISTING snow levels in source), - ! then copy the top N existing snow levels to the destination, where N is the - ! number of destination levels. - ! - ! index_dest is used in this version, in order to match each point with its number - ! of existing snow layers; index_dest should be 1-based. - ! - ! !ARGUMENTS: - class(interp_multilevel_snow_type), intent(in) :: this - real(r8) , intent(inout) :: data_dest(:) - real(r8) , intent(in) :: data_source(:) - integer , intent(in) :: index_dest - ! - ! !LOCAL VARIABLES: - integer :: num_source ! total number of source layers - integer :: num_dest ! total number of dest layers - integer :: num_snow_layers_source ! number of EXISTING snow layers at this source point - integer :: top_layer_source ! top source layer copied to dest - integer :: top_layer_dest ! top dest layer receiving data from source - integer :: source_layer ! current source layer in copy - integer :: dest_layer ! current dest layer in copy - - character(len=*), parameter :: subname = 'interp_multilevel' - !----------------------------------------------------------------------- - - num_source = size(data_source) - num_dest = size(data_dest) - num_snow_layers_source = this%num_snow_layers_source(index_dest) - SHR_ASSERT(num_snow_layers_source >= 0, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(num_snow_layers_source <= num_source, errMsg(sourcefile, __LINE__)) - - if (num_dest >= num_source) then - ! Copy all source layers to dest (even non-existent snow layers) - top_layer_source = 1 - top_layer_dest = 1 + (num_dest - num_source) - else if (num_dest >= num_snow_layers_source) then - ! Copy all existing source layers to dest, plus as many non-existing layers as will fit - top_layer_dest = 1 - top_layer_source = 1 + (num_source - num_dest) - else - ! num_dest < num_snow_layers_source. Copy as many existing layers from source as - ! will fit in dest, starting at the top of the snow pack. - top_layer_dest = 1 - top_layer_source = num_source - num_snow_layers_source + 1 - end if - - do dest_layer = 1, (top_layer_dest - 1) - data_dest(dest_layer) = 0._r8 - end do - - source_layer = top_layer_source - do dest_layer = top_layer_dest, num_dest - data_dest(dest_layer) = data_source(source_layer) - source_layer = source_layer + 1 - end do - - end subroutine interp_multilevel - - !----------------------------------------------------------------------- - pure function get_description(this) result(description) - ! - ! !DESCRIPTION: - ! Returns a text description of this interpolator - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=:), allocatable :: description ! function result - class(interp_multilevel_snow_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_description' - !----------------------------------------------------------------------- - - description = 'Copy snow-covered levels using '//this%num_layers_name - - end function get_description - -end module initInterpMultilevelSnow diff --git a/src/init_interp/initInterpMultilevelSplit.F90 b/src/init_interp/initInterpMultilevelSplit.F90 deleted file mode 100644 index fa082b85f4..0000000000 --- a/src/init_interp/initInterpMultilevelSplit.F90 +++ /dev/null @@ -1,209 +0,0 @@ -module initInterpMultilevelSplit - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a class for handling multi-level fields by doing two different - ! interpolations: One for some first set of levels, and a different one for some second - ! set of levels. - ! - ! !USES: -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use initInterpMultilevelBase , only : interp_multilevel_type - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_split_type - - type, extends(interp_multilevel_type) :: interp_multilevel_split_type - private - class(interp_multilevel_type), pointer :: interpolator_first_levels => null() - class(interp_multilevel_type), pointer :: interpolator_second_levels => null() - integer :: num_second_levels_source - integer :: num_second_levels_dest - contains - ! Public methods - procedure :: check_npts - procedure :: interp_multilevel - procedure :: get_description - end type interp_multilevel_split_type - - ! Constructor - ! NOTE(wjs, 2015-10-23) This is given a different name from - ! interp_multilevel_split_type because some compilers (in particular intel 15.0.1) had - ! trouble distinguishing between the user-defined constructor and the default structure - ! constructor. I'm not sure if this is a compiler bug or not. - public :: create_interp_multilevel_split_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function create_interp_multilevel_split_type( & - interpolator_first_levels, interpolator_second_levels, & - num_second_levels_source, num_second_levels_dest) & - result(this) - ! - ! !DESCRIPTION: - ! Construct an interp_multilevel_split_type object. - ! - ! interpolator_first_levels gives the interpolator for the first set of levels (1:nsrc - ! and 1:ndst); interpolator_second_levels gives the interpolator for the second set of - ! levels (nsrc+1:msrc and ndst+1:mdst). - ! - ! You must specify the number of levels in the *second* set of levels for the source - ! and dest (i.e., the number of levels that are used by interpolator_second_levels). - ! (In principle, the number of levels in the *first* set of levels can then vary from - ! one call to interp_multilevel to another.) - ! - ! NOTE(wjs, 2015-10-23) This is given a different name from - ! interp_multilevel_split_type because some compilers (in particular intel 15.0.1) had - ! trouble distinguishing between the user-defined constructor and the default structure - ! constructor. I'm not sure if this is a compiler bug or not. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_multilevel_split_type) :: this ! function result - class(interp_multilevel_type), target, intent(in) :: interpolator_first_levels - class(interp_multilevel_type), target, intent(in) :: interpolator_second_levels - integer, intent(in) :: num_second_levels_source - integer, intent(in) :: num_second_levels_dest - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'create_interp_multilevel_split_type' - !----------------------------------------------------------------------- - - if (num_second_levels_source <= 0) then - write(iulog,*) "For interp_multilevel_split_type, num_second_levels_source must be > 0" - write(iulog,*) "num_second_levels_source = ", num_second_levels_source - call endrun(msg="num_second_levels_source must be > 0 "//errMsg(sourcefile, __LINE__)) - end if - if (num_second_levels_dest <= 0) then - write(iulog,*) "For interp_multilevel_split_type, num_second_levels_dest must be > 0" - write(iulog,*) "num_second_levels_dest = ", num_second_levels_dest - call endrun(msg="num_second_levels_dest must be > 0 "//errMsg(sourcefile, __LINE__)) - end if - - this%interpolator_first_levels => interpolator_first_levels - this%interpolator_second_levels => interpolator_second_levels - this%num_second_levels_source = num_second_levels_source - this%num_second_levels_dest = num_second_levels_dest - - end function create_interp_multilevel_split_type - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine check_npts(this, npts, varname) - ! - ! !DESCRIPTION: - ! Checks the number of destination points, to ensure that this interpolator is - ! appropriate for this variable. This should be called once for each variable. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_split_type), intent(in) :: this - integer, intent(in) :: npts ! number of dest points (on this processor) - character(len=*), intent(in) :: varname ! variable name (for diagnostic output) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'check_npts' - !----------------------------------------------------------------------- - - call this%interpolator_first_levels%check_npts(npts, varname) - call this%interpolator_second_levels%check_npts(npts, varname) - end subroutine check_npts - - !----------------------------------------------------------------------- - pure function get_description(this) result(description) - ! - ! !DESCRIPTION: - ! Returns a text description of this interpolator - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=:), allocatable :: description ! function result - class(interp_multilevel_split_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_description' - !----------------------------------------------------------------------- - - description = 'Split levels: ' // & - trim(this%interpolator_first_levels%get_description()) // & - ' + ' // & - trim(this%interpolator_second_levels%get_description()) - - end function get_description - - !----------------------------------------------------------------------- - subroutine interp_multilevel(this, data_dest, data_source, index_dest) - ! - ! !DESCRIPTION: - ! Interpolates a multi-level field from source to dest, for a single point. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(interp_multilevel_split_type), intent(in) :: this - real(r8) , intent(inout) :: data_dest(:) - real(r8) , intent(in) :: data_source(:) - integer , intent(in) :: index_dest - ! - ! !LOCAL VARIABLES: - integer :: num_first_levels_dest - integer :: num_first_levels_source - - character(len=*), parameter :: subname = 'interp_multilevel' - !----------------------------------------------------------------------- - - num_first_levels_dest = size(data_dest) - this%num_second_levels_dest - num_first_levels_source = size(data_source) - this%num_second_levels_source - - if (num_first_levels_source <= 0) then - write(iulog,*) "For interp_multilevel_split_type, num_first_levels_source must be > 0" - write(iulog,*) "num_first_levels_source = ", num_first_levels_source - call endrun(msg="num_first_levels_source must be > 0 "//errMsg(sourcefile, __LINE__)) - end if - if (num_first_levels_dest <= 0) then - write(iulog,*) "For interp_multilevel_split_type, num_first_levels_dest must be > 0" - write(iulog,*) "num_first_levels_dest = ", num_first_levels_dest - call endrun(msg="num_first_levels_dest must be > 0 "//errMsg(sourcefile, __LINE__)) - end if - - call this%interpolator_first_levels%interp_multilevel( & - data_dest = data_dest(1:num_first_levels_dest), & - data_source = data_source(1:num_first_levels_source), & - index_dest = index_dest) - - call this%interpolator_second_levels%interp_multilevel( & - data_dest = data_dest((num_first_levels_dest+1):size(data_dest)), & - data_source = data_source((num_first_levels_source+1):size(data_source)), & - index_dest = index_dest) - - end subroutine interp_multilevel - - -end module initInterpMultilevelSplit diff --git a/src/init_interp/initInterpUtils.F90 b/src/init_interp/initInterpUtils.F90 deleted file mode 100644 index 13fa17f28a..0000000000 --- a/src/init_interp/initInterpUtils.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module initInterpUtils - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module contains various utilities used by initInterp - ! - ! !USES: - - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use ncdio_pio , only: file_desc_t, ncd_inqdlen, ncd_inqdid, ncd_io - use abortutils , only: endrun - - implicit none - private - save - - ! Public methods - - public :: glc_elevclasses_are_same ! Function that determines whether the glacier elevation classes are the same in the input and output files - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - logical function glc_elevclasses_are_same(ncidi, ncido) - ! - ! !DESCRIPTION: - ! Determines if the glacier elevation classes are the same in ncidi and ncido - ! - ! Returns .true. if they are the same (i.e., same number and bounds of elevation - ! classes, within roundoff), false if not. - ! - ! !ARGUMENTS: - type(file_desc_t) , intent(inout) :: ncidi - type(file_desc_t) , intent(inout) :: ncido - ! - ! !LOCAL VARIABLES: - integer :: dimid_dummy - logical :: dimexist - integer :: glc_nec_input - integer :: glc_nec_output - logical :: readvar - real(r8), pointer :: elevclass_bounds_input(:) - real(r8), pointer :: elevclass_bounds_output(:) - integer :: elevclass - - real(r8), parameter :: bounds_tol = 1.e-4_r8 ! tolerance for checking equality of elevclass bounds - - character(len=*), parameter :: subname = 'glc_elevclasses_are_same' - !----------------------------------------------------------------------- - - ! BACKWARDS_COMPATIBILITY(wjs, 2018-03-19) Old restart files generated from - ! configurations with istice rather than istice_mec don't have a 'glc_nec' dimension. - ! Users may still be using files generated like that. The value of this function - ! should be irrelevant in that case. We can remove this code once we can rely on all - ! users' finidat files having been generated from configurations with istice_mec. - call ncd_inqdid(ncidi, 'glc_nec', dimid_dummy, dimexist=dimexist) - if (.not. dimexist) then - glc_elevclasses_are_same = .false. - return - end if - - call ncd_inqdlen(ncido, dimid_dummy, glc_nec_output, name='glc_nec') - call ncd_inqdlen(ncidi, dimid_dummy, glc_nec_input, name='glc_nec') - - if (glc_nec_input == glc_nec_output) then - allocate(elevclass_bounds_input(0:glc_nec_input)) - allocate(elevclass_bounds_output(0:glc_nec_output)) - call ncd_io(ncid=ncido, varname='glc_elevclass_bounds', & - data=elevclass_bounds_output, flag='read', readvar=readvar) - if (.not. readvar) then - call endrun('glc_elevclass_bounds not found on output file ' // & - errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncidi, varname='glc_elevclass_bounds', & - data=elevclass_bounds_input, flag='read', readvar=readvar) - if (.not. readvar) then - ! BACKWARDS_COMPATIBILITY(wjs, 2018-03-19) Older restart files don't have this - ! variable, but it's safe to assume that any old restart file was generated - ! with the current elevation class bounds, as given below. Once we can rely on - ! old restart files having the glc_elevclass_bounds variable, we should replace - ! this hard-coded setting with a call to endrun, as we have for ncido. - if (glc_nec_input == 10) then - elevclass_bounds_input = [0._r8, 200._r8, 400._r8, 700._r8, 1000._r8, & - 1300._r8, 1600._r8, 2000._r8, 2500._r8, 3000._r8, 10000._r8] - else - call endrun('glc_elevclass_bounds not found on input file ' // & - errMsg(sourcefile, __LINE__)) - end if - end if - - glc_elevclasses_are_same = .true. - do elevclass = 0, glc_nec_input - if (abs(elevclass_bounds_input(elevclass) - elevclass_bounds_output(elevclass)) & - > bounds_tol) then - glc_elevclasses_are_same = .false. - end if - end do - - deallocate(elevclass_bounds_input) - deallocate(elevclass_bounds_output) - - else ! glc_nec_input /= glc_nec_output - glc_elevclasses_are_same = .false. - end if - - end function glc_elevclasses_are_same - -end module initInterpUtils diff --git a/src/init_interp/test/CMakeLists.txt b/src/init_interp/test/CMakeLists.txt deleted file mode 100644 index e7724fadf2..0000000000 --- a/src/init_interp/test/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(initInterpMindist_test) -add_subdirectory(initInterpMultilevel_test) -add_subdirectory(initInterpUtils_test) diff --git a/src/init_interp/test/initInterpMindist_test/CMakeLists.txt b/src/init_interp/test/initInterpMindist_test/CMakeLists.txt deleted file mode 100644 index 03d669ef34..0000000000 --- a/src/init_interp/test/initInterpMindist_test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set (pfunit_sources - test_set_mindist.pf - test_set_single_match.pf - initInterpMindistTestUtils.pf) - -create_pFUnit_test(initInterpMindist test_initInterpMindist_exe - "${pfunit_sources}" "") - -target_link_libraries(test_initInterpMindist_exe clm csm_share) \ No newline at end of file diff --git a/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf b/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf deleted file mode 100644 index 009f4438bc..0000000000 --- a/src/init_interp/test/initInterpMindist_test/initInterpMindistTestUtils.pf +++ /dev/null @@ -1,136 +0,0 @@ -module initInterpMindistTestUtils - - ! Utilities to aid the testing of initInterpMindist - - use pfunit_mod - use shr_kind_mod , only : r8 => shr_kind_r8 - use initInterpMindist, only : subgrid_type, subgrid_special_indices_type - use glcBehaviorMod, only: glc_behavior_type - use unittestSubgridMod, only : bounds - use unittestArrayMod, only: grc_array - - implicit none - private - - public :: create_subgrid_info - public :: create_glc_behavior - - type(subgrid_special_indices_type), parameter, public :: subgrid_special_indices = & - subgrid_special_indices_type( & - ipft_not_vegetated = 0, & - icol_vegetated_or_bare_soil = 10, & - ilun_vegetated_or_bare_soil = 3, & - ilun_crop = 4, & - ilun_landice_multiple_elevation_classes = 5) - - ! value we can use for a special landunit; note that this just needs to differ from - ! ilun_vegetated_or_bare_soil and from ilun_crop - integer, parameter, public :: ilun_special = 6 - -contains - - !----------------------------------------------------------------------- - function create_subgrid_info(npts, name, lat, lon, & - beg, ptype, ctype, ltype, topoglc) & - result(subgrid_info) - ! - ! !ARGUMENTS: - type(subgrid_type) :: subgrid_info ! function result - integer, intent(in) :: npts - character(len=*), intent(in) :: name - real(r8), intent(in) :: lat(:) - real(r8), intent(in) :: lon(:) - integer, intent(in), optional :: beg ! beginning index; if not provided, assumed to be 1 (should be provided for output, not needed for input) - integer, intent(in), optional :: ptype(:) - integer, intent(in), optional :: ctype(:) - integer, intent(in), optional :: ltype(:) - real(r8), intent(in), optional :: topoglc(:) - ! - ! !LOCAL VARIABLES: - integer :: l_beg ! local version of beg - integer :: l_end ! ending index - - character(len=*), parameter :: subname = 'create_subgrid_info' - !----------------------------------------------------------------------- - - if (present(beg)) then - l_beg = beg - else - l_beg = 1 - end if - l_end = l_beg + npts - 1 - - ! Check array lengths - @assertEqual(npts, size(lat)) - @assertEqual(npts, size(lon)) - if (present(ptype)) then - @assertEqual(npts, size(ptype)) - end if - if (present(ctype)) then - @assertEqual(npts, size(ctype)) - end if - if (present(ltype)) then - @assertEqual(npts, size(ltype)) - end if - if (present(topoglc)) then - @assertEqual(npts, size(topoglc)) - end if - - ! Set subgrid_info components - - subgrid_info%name = name - - allocate(subgrid_info%lat(l_beg:l_end)) - subgrid_info%lat = lat - allocate(subgrid_info%lon(l_beg:l_end)) - subgrid_info%lon = lon - allocate(subgrid_info%coslat(l_beg:l_end)) - subgrid_info%coslat = cos(subgrid_info%lat) - - if (present(ptype)) then - allocate(subgrid_info%ptype(l_beg:l_end)) - subgrid_info%ptype = ptype - end if - if (present(ctype)) then - allocate(subgrid_info%ctype(l_beg:l_end)) - subgrid_info%ctype = ctype - end if - if (present(ltype)) then - allocate(subgrid_info%ltype(l_beg:l_end)) - subgrid_info%ltype = ltype - end if - if (present(topoglc)) then - allocate(subgrid_info%topoglc(l_beg:l_end)) - subgrid_info%topoglc = topoglc - end if - - end function create_subgrid_info - - !----------------------------------------------------------------------- - function create_glc_behavior(collapse_to_atm_topo) result(glc_behavior) - ! - ! !DESCRIPTION: - ! Creates a glc_behavior instance with the given collapse_to_atm_topo behavior set - ! for all grid cells. - ! - ! Must be called *after* setting up the subgrid structure. - ! - ! Note that collapse_to_atm_topo is the only aspect of glc_behavior that is relevant - ! for the unit tests in this module. - ! - ! !ARGUMENTS: - type(glc_behavior_type) :: glc_behavior ! function result - logical, intent(in) :: collapse_to_atm_topo - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'create_glc_behavior' - !----------------------------------------------------------------------- - - call glc_behavior%InitSetDirectly(bounds%begg, bounds%endg, & - has_virtual_columns = grc_array(.false.), & - collapse_to_atm_topo = grc_array(collapse_to_atm_topo)) - - end function create_glc_behavior - -end module initInterpMindistTestUtils diff --git a/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf b/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf deleted file mode 100644 index 9b291a8994..0000000000 --- a/src/init_interp/test/initInterpMindist_test/test_set_mindist.pf +++ /dev/null @@ -1,849 +0,0 @@ -module test_set_mindist - - ! Tests of initInterpMindist: set_mindist - - use pfunit_mod - use initInterpMindist - use initInterpMindistTestUtils, only : create_subgrid_info, create_glc_behavior - use initInterpMindistTestUtils, only : subgrid_special_indices, ilun_special - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon , only: spval - use unittestSimpleSubgridSetupsMod - use unittestSubgridMod - use glcBehaviorMod, only: glc_behavior_type - - implicit none - - @TestCase - type, extends(TestCase) :: TestSetMindist - contains - procedure :: setUp - procedure :: tearDown - end type TestSetMindist - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Utility routines - ! ======================================================================== - - - subroutine setUp(this) - class(TestSetMindist), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestSetMindist), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine wrap_set_mindist(subgridi, subgrido, mindist_index, activei, activeo, & - glc_behavior, glc_elevclasses_same, fill_missing_with_natveg) - ! Wrap the call to set_mindist. - ! - ! If activei / activeo are not provided, they are assumed to be .true. for all points. - ! - ! If glc_behavior is not present, it is assumed to have collapse_to_atm_topo false - ! for all grid cells. - ! - ! If glc_elevclasses_same is not present, it is assumed to be true. - ! - ! If fill_missing_with_natveg is not provided, it is assumed to be false - - ! Arguments: - type(subgrid_type), intent(in) :: subgridi - type(subgrid_type), intent(in) :: subgrido - integer, intent(out) :: mindist_index(:) - logical, intent(in), optional :: activei(:) - logical, intent(in), optional :: activeo(:) - type(glc_behavior_type), intent(in), optional :: glc_behavior - logical, intent(in), optional :: glc_elevclasses_same - logical, intent(in), optional :: fill_missing_with_natveg - - ! Local variables: - integer :: npts_i, npts_o - integer :: bego, endo - logical, allocatable :: l_activei(:) - logical, allocatable :: l_activeo(:) - type(glc_behavior_type) :: l_glc_behavior - logical :: l_glc_elevclasses_same - logical :: l_fill_missing_with_natveg - - !----------------------------------------------------------------------- - - npts_i = size(subgridi%lon) - npts_o = size(subgrido%lon) - bego = lbound(subgrido%lon, 1) - endo = ubound(subgrido%lon, 1) - - @assertEqual(npts_o, size(mindist_index)) - - if (present(activei)) then - @assertEqual(npts_i, size(activei)) - l_activei = activei - else - allocate(l_activei(npts_i)) - l_activei = .true. - end if - - if (present(activeo)) then - @assertEqual(npts_o, size(activeo)) - l_activeo = activeo - else - allocate(l_activeo(npts_o)) - l_activeo = .true. - end if - - if (present(glc_behavior)) then - l_glc_behavior = glc_behavior - else - l_glc_behavior = create_glc_behavior(collapse_to_atm_topo = .false.) - end if - - if (present(glc_elevclasses_same)) then - l_glc_elevclasses_same = glc_elevclasses_same - else - l_glc_elevclasses_same = .true. - end if - - if (present(fill_missing_with_natveg)) then - l_fill_missing_with_natveg = fill_missing_with_natveg - else - l_fill_missing_with_natveg = .false. - end if - - call set_mindist(begi = 1, endi = npts_i, bego = bego, endo = endo, & - activei = l_activei, activeo = l_activeo, subgridi = subgridi, subgrido = subgrido, & - subgrid_special_indices = subgrid_special_indices, & - glc_behavior = l_glc_behavior, & - glc_elevclasses_same = l_glc_elevclasses_same, & - fill_missing_with_natveg = l_fill_missing_with_natveg, & - mindist_index = mindist_index) - - end subroutine wrap_set_mindist - - !----------------------------------------------------------------------- - subroutine setup_and_run_glcmec(ptype_o, ctype_o, topoglc_o, & - ptype_i, ctype_i, topoglc_i, & - collapse_to_atm_topo, glc_elevclasses_same, & - mindist_index_p, mindist_index_c, & - ltype_diff_i) - ! - ! !DESCRIPTION: - ! Does all the work needed to setup and run wrap_set_mindist for a single glcmec - ! output point. - ! - ! Gives both the mindist patch and column for that output point. - ! - ! Some assumptions: - ! - All input points are from the same gridcell, with the same lat/lon as the output - ! point - ! - There is one patch for each column - ! - ! !ARGUMENTS: - integer, intent(in) :: ptype_o ! patch type of the output point - integer, intent(in) :: ctype_o ! col type of the output point - real(r8), intent(in) :: topoglc_o ! topographic height of the output point - integer, intent(in) :: ptype_i(:) ! patch type of each input point - integer, intent(in) :: ctype_i(:) ! col type of each input point - real(r8), intent(in) :: topoglc_i(:) ! topographic height of each input point - logical, intent(in) :: collapse_to_atm_topo - logical, intent(in) :: glc_elevclasses_same - integer, intent(out) :: mindist_index_p - integer, intent(out) :: mindist_index_c - - ! If present, this gives the difference in ltype from ltype_glcmec for each input - ! point. So, for example, if this is an array [-1, 0, 1] then the input ltypes will - ! be [ltype_glcmec-1, ltype_glcmec, ltype_glcmec+1]. If absent, all input points have - ! type ltype_glcmec. - integer, intent(in), optional :: ltype_diff_i(:) - - ! - ! !LOCAL VARIABLES: - integer, parameter :: ltype_glcmec = subgrid_special_indices%ilun_landice_multiple_elevation_classes - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: num_i - integer, allocatable :: ltype_i(:) - real(r8), allocatable :: lat_i(:) - real(r8), allocatable :: lon_i(:) - type(subgrid_type) :: subgridi_c, subgrido_c, subgridi_p, subgrido_p - type(glc_behavior_type) :: glc_behavior - integer :: mindist_index_p_arr(1) - integer :: mindist_index_c_arr(1) - - character(len=*), parameter :: subname = 'setup_and_run_glcmec' - !----------------------------------------------------------------------- - - ! Note that we assume the same number of patches as columns (i.e., one patch per - ! column) - num_i = size(ptype_i) - @assertEqual(num_i, size(ctype_i)) - @assertEqual(num_i, size(topoglc_i)) - if (present(ltype_diff_i)) then - @assertEqual(num_i, size(ltype_diff_i)) - end if - - call setup_landunit_ncols(ltype=ltype_glcmec, & - ctypes=[ctype_o], & - cweights=[1._r8], & - ptype=ptype_o) - - subgrido_c = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [ctype_o], & - ltype = [ltype_glcmec], & - lat = [my_lat], & - lon = [my_lon], & - topoglc = [topoglc_o]) - subgrido_p = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [ptype_o], & - ctype = [ctype_o], & - ltype = [ltype_glcmec], & - lat = [my_lat], & - lon = [my_lon], & - topoglc = [topoglc_o]) - - allocate(ltype_i(num_i)) - allocate(lat_i(num_i)) - allocate(lon_i(num_i)) - if (present(ltype_diff_i)) then - ltype_i(:) = ltype_glcmec + ltype_diff_i(:) - else - ltype_i(:) = ltype_glcmec - end if - lat_i(:) = my_lat - lon_i(:) = my_lon - - subgridi_c = create_subgrid_info( & - npts = num_i, & - name = 'column', & - ctype = ctype_i, & - ltype = ltype_i, & - lat = lat_i, & - lon = lon_i, & - topoglc = topoglc_i) - subgridi_p = create_subgrid_info( & - npts = num_i, & - name = 'pft', & - ptype = ptype_i, & - ctype = ctype_i, & - ltype = ltype_i, & - lat = lat_i, & - lon = lon_i, & - topoglc = topoglc_i) - - glc_behavior = create_glc_behavior(collapse_to_atm_topo) - - call wrap_set_mindist(subgridi_c, subgrido_c, mindist_index_c_arr, & - glc_behavior = glc_behavior, glc_elevclasses_same = glc_elevclasses_same) - call wrap_set_mindist(subgridi_p, subgrido_p, mindist_index_p_arr, & - glc_behavior = glc_behavior, glc_elevclasses_same = glc_elevclasses_same) - - mindist_index_c = mindist_index_c_arr(1) - mindist_index_p = mindist_index_p_arr(1) - - end subroutine setup_and_run_glcmec - - - ! ======================================================================== - ! Tests - ! ======================================================================== - - - @Test - subroutine multipleTypes_findsSameType(this) - ! If there are multiple types in the input, all equidistant from the target point, - ! then make sure we find the point with the same type. - ! - ! This tests a column-level point - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = 8 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - call setup_landunit_ncols(ltype=my_ltype, & - ctypes=[my_ctype], & - cweights=[1._r8]) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - ! Input points differ in either column type or landunit type - subgridi = create_subgrid_info( & - npts = 5, & - name = 'column', & - ctype = [my_ctype-1, my_ctype, my_ctype, my_ctype, my_ctype + 1], & - ltype = [my_ltype, my_ltype-1, my_ltype, my_ltype+1, my_ltype], & - lat = [(my_lat, i=1,5)], & - lon = [(my_lon, i=1,5)]) - - call wrap_set_mindist(subgridi, subgrido, mindist_index) - - @assertEqual(3, mindist_index(1)) - - end subroutine multipleTypes_findsSameType - - @Test - subroutine glcmec_elevclassesSame_findsSameColType(this) - ! When glc elevation classes are the same between input and output: Choose - ! column/patch from the same column type, even if it isn't the one with the closest - ! topographic height. - ! - ! This tests both column-level and patch-level - class(TestSetMindist), intent(inout) :: this - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ptype = 25 - real(r8), parameter :: my_topo = 1000._r8 - integer :: i - integer :: mindist_index_c, mindist_index_p - - ! Note that: - ! - all input ptypes are the same as output ptype - ! - all input ctypes are different, with one of them matching the output ctype - ! - the matching input ctype has the most different topographic height - call setup_and_run_glcmec( & - ptype_o = my_ptype, & - ctype_o = my_ctype, & - topoglc_o = my_topo, & - ptype_i = [my_ptype, my_ptype, my_ptype, my_ptype], & - ctype_i = [my_ctype-2, my_ctype-1, my_ctype, my_ctype+1], & - topoglc_i = [my_topo - 10._r8, my_topo - 1._r8, my_topo + 100._r8, my_topo], & - collapse_to_atm_topo = .false., & - glc_elevclasses_same = .true., & - mindist_index_p = mindist_index_p, & - mindist_index_c = mindist_index_c) - - @assertEqual(3, mindist_index_c) - @assertEqual(3, mindist_index_p) - end subroutine glcmec_elevclassesSame_findsSameColType - - @Test - subroutine glcmec_elevclassesSame_findsSamePatchType(this) - ! When glc elevation classes are the same between input and output: Choose patch from - ! the same patch type, even if it isn't the one with the closest topographic height. - ! - ! This tests just patch-level - class(TestSetMindist), intent(inout) :: this - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ptype = 25 - real(r8), parameter :: my_topo = 1000._r8 - integer :: i - integer :: mindist_index_c, mindist_index_p - - ! Note that: - ! - all input ptypes are different, with one of them matching the output ptype - ! - all input ctypes are the same as output ctype (this probably shouldn't happen in - ! practice, but is useful for testing the code logic) - ! - the matching input ptype has the most different topographic height - call setup_and_run_glcmec( & - ptype_o = my_ptype, & - ctype_o = my_ctype, & - topoglc_o = my_topo, & - ptype_i = [my_ptype-2, my_ptype-1, my_ptype, my_ptype+1], & - ctype_i = [my_ctype, my_ctype, my_ctype, my_ctype], & - topoglc_i = [my_topo - 10._r8, my_topo - 1._r8, my_topo + 100._r8, my_topo], & - collapse_to_atm_topo = .false., & - glc_elevclasses_same = .true., & - mindist_index_p = mindist_index_p, & - mindist_index_c = mindist_index_c) - - ! Note that we don't assert anything about mindist_index_c in this case: the behavior - ! of mindist_index_c is not defined, since there are multiple input columns with the - ! same type. (We don't expect this situation of having multiple input columns with - ! the same type to arise in practice, so we haven't defined the behavior of this - ! case.) - @assertEqual(3, mindist_index_p) - end subroutine glcmec_elevclassesSame_findsSamePatchType - - @Test - subroutine glcmec_elevclassesDiffer_findsClosestHeight(this) - ! When glc elevation classes differ between input and output: Ignore column and pft - ! types; if there are multiple glc_mec points that are equidistant in space, pick the - ! one with the closest height - ! - ! This tests both column-level and patch-level - class(TestSetMindist), intent(inout) :: this - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ptype = 25 - real(r8), parameter :: my_topo = 1000._r8 - integer :: i - integer :: mindist_index_c, mindist_index_p - - ! Note that we use different ptype and ctype values for the target point: these should - ! be ignored in this case. However, ltype should *not* be ignored (and thus we should - ! *not* pick the third point). - call setup_and_run_glcmec( & - ptype_o = my_ptype, & - ctype_o = my_ctype, & - topoglc_o = my_topo, & - ptype_i = [my_ptype, my_ptype-1, my_ptype, my_ptype], & - ctype_i = [my_ctype, my_ctype-1, my_ctype, my_ctype], & - ltype_diff_i = [0, 0, -1, 0], & - topoglc_i = [my_topo - 10._r8, my_topo - 1._r8, my_topo, my_topo + 100._r8], & - collapse_to_atm_topo = .false., & - glc_elevclasses_same = .false., & - mindist_index_p = mindist_index_p, & - mindist_index_c = mindist_index_c) - - @assertEqual(2, mindist_index_c) - @assertEqual(2, mindist_index_p) - end subroutine glcmec_elevclassesDiffer_findsClosestHeight - - @Test - subroutine glcmec_collapseToAtmTopo_findsClosestHeight(this) - ! For an output glcmec point with the collapse_to_atm_topo behavior: Ignore column and - ! pft types; if there are multiple glc_mec points that are equidistant in space, pick - ! the one with the closest height - ! - ! This tests both column-level and patch-level - class(TestSetMindist), intent(inout) :: this - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ptype = 25 - real(r8), parameter :: my_topo = 1000._r8 - integer :: i - integer :: mindist_index_c, mindist_index_p - - ! Note that we use different ptype and ctype values for the target point: these should - ! be ignored in this case. However, ltype should *not* be ignored (and thus we should - ! *not* pick the third point). - call setup_and_run_glcmec( & - ptype_o = my_ptype, & - ctype_o = my_ctype, & - topoglc_o = my_topo, & - ptype_i = [my_ptype, my_ptype-1, my_ptype, my_ptype], & - ctype_i = [my_ctype, my_ctype-1, my_ctype, my_ctype], & - ltype_diff_i = [0, 0, -1, 0], & - topoglc_i = [my_topo - 10._r8, my_topo - 1._r8, my_topo, my_topo + 100._r8], & - collapse_to_atm_topo = .true., & - glc_elevclasses_same = .true., & - mindist_index_p = mindist_index_p, & - mindist_index_c = mindist_index_c) - - @assertEqual(2, mindist_index_c) - @assertEqual(2, mindist_index_p) - end subroutine glcmec_collapseToAtmTopo_findsClosestHeight - - @Test - subroutine glcmec_elevclassesDiffer_findsClosestLatlon(this) - ! For glc_mec, if we have some points closer in topographic height, but others closer - ! in x-y space, pick the closer point in x-y space - - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - type(glc_behavior_type) :: glc_behavior - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = subgrid_special_indices%ilun_landice_multiple_elevation_classes - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - real(r8), parameter :: my_topo = 1000._r8 - integer :: i - integer :: mindist_index(1) - - call setup_landunit_ncols(ltype=my_ltype, & - ctypes=[my_ctype], & - cweights=[1._r8]) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon], & - topoglc = [my_topo]) - - subgridi = create_subgrid_info( & - npts = 3, & - name = 'column', & - ctype = [my_ctype, my_ctype, my_ctype], & - ltype = [my_ltype, my_ltype, my_ltype], & - lat = [my_lat - 10._r8, my_lat - 1._r8, my_lat + 10._r8], & - lon = [(my_lon, i=1,3)], & - topoglc = [my_topo, my_topo - 100._r8, my_topo]) - - glc_behavior = create_glc_behavior(collapse_to_atm_topo = .false.) - - call wrap_set_mindist(subgridi, subgrido, mindist_index, & - glc_behavior = glc_behavior, glc_elevclasses_same = .false.) - - @assertEqual(2, mindist_index(1)) - end subroutine glcmec_elevclassesDiffer_findsClosestLatlon - - @Test - subroutine noncropToCrop_patchVariable_usesCorrectPft(this) - ! For interpolation from a non-crop case to a crop case, ensure that a patch-level - ! variable takes its input from the correct pft. This simulates what happens to the - ! generic crop type in this case. - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ptype = 5 - integer :: my_ctype - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - associate( & - icol_natveg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_natveg => subgrid_special_indices%ilun_vegetated_or_bare_soil, & - ilun_crop => subgrid_special_indices%ilun_crop & - ) - - my_ctype = icol_natveg + 1 ! arbitrary; we just want this to differ from icol_natveg - - call setup_landunit_ncols(ltype=ilun_crop, & - ctypes=[my_ctype], & - cweights=[1._r8], & - ptype=my_ptype) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [my_ptype], & - ctype = [my_ctype], & - ltype = [ilun_crop], & - lat = [my_lat], & - lon = [my_lon]) - - ! Input point #2 has the same ptype, but a different ctype and ltype. This one should - ! be chosen. Other input points differ in ptype. - subgridi = create_subgrid_info( & - npts = 3, & - name = 'pft', & - ptype = [my_ptype - 1, my_ptype, my_ptype + 1], & - ctype = [icol_natveg, icol_natveg, icol_natveg], & - ltype = [ilun_natveg, ilun_natveg, ilun_natveg], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_mindist(subgridi, subgrido, mindist_index) - - @assertEqual(2, mindist_index(1)) - - end associate - end subroutine noncropToCrop_patchVariable_usesCorrectPft - - @Test - subroutine cropToNoncrop_patchVariable_usesCorrectPft(this) - ! For interpolation from a crop case to a non-crop case, ensure that a patch-level - ! variable takes its input from the correct pft. This simulates what happens to the - ! generic crop type in this case. - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ptype = 5 - integer :: input_ctype - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - associate( & - icol_natveg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_natveg => subgrid_special_indices%ilun_vegetated_or_bare_soil, & - ilun_crop => subgrid_special_indices%ilun_crop & - ) - - call setup_landunit_ncols(ltype=ilun_natveg, & - ctypes=[icol_natveg], & - cweights=[1._r8], & - ptype=my_ptype) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [my_ptype], & - ctype = [icol_natveg], & - ltype = [ilun_natveg], & - lat = [my_lat], & - lon = [my_lon]) - - input_ctype = icol_natveg + 1 ! arbitrary; we just want this to differ from icol_natveg - - ! Input point #2 has the same ptype, but a different ctype and ltype. This one should - ! be chosen. Other input points differ in ptype. - subgridi = create_subgrid_info( & - npts = 3, & - name = 'pft', & - ptype = [my_ptype - 1, my_ptype, my_ptype + 1], & - ctype = [input_ctype, input_ctype, input_ctype], & - ltype = [ilun_crop, ilun_crop, ilun_crop], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_mindist(subgridi, subgrido, mindist_index) - - @assertEqual(2, mindist_index(1)) - - end associate - end subroutine cropToNoncrop_patchVariable_usesCorrectPft - - @Test - subroutine noncropToCrop_specificCropFromNatveg(this) - ! For interpolation from a non-crop case to a crop case, ensure that crop columns - ! take their info from the natural veg column in the input. - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer :: my_ctype - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - associate( & - icol_natveg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_natveg => subgrid_special_indices%ilun_vegetated_or_bare_soil, & - ilun_crop => subgrid_special_indices%ilun_crop & - ) - - my_ctype = icol_natveg + 1 ! arbitrary; we just want this to differ from icol_natveg - - call setup_landunit_ncols(ltype=ilun_crop, & - ctypes=[my_ctype], & - cweights=[1._r8]) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [ilun_crop], & - lat = [my_lat], & - lon = [my_lon]) - - subgridi = create_subgrid_info( & - npts = 3, & - name = 'column', & - ctype = [icol_natveg - 2, icol_natveg, icol_natveg - 1], & - ltype = [ilun_natveg - 2, ilun_natveg, ilun_natveg - 1], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - ! For most landunits, we would need to set fill_missing_with_natveg to accomplish - ! this. However, it should be done for a crop output point even with - ! fill_missing_with_natveg .false. - call wrap_set_mindist(subgridi, subgrido, mindist_index, & - fill_missing_with_natveg = .false.) - - @assertEqual(2, mindist_index(1)) - - end associate - end subroutine noncropToCrop_specificCropFromNatveg - - @Test - subroutine newveg_usesBaresoil(this) - ! If there's a new vegetation (patch) type, this should take inputs from the closest - ! bare soil point. - ! - ! In terms of code coverage, this is largely redundant with - ! noncropToCrop_specificCropFromNatveg. But I'm keeping it for now since it tests a - ! different use case. - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ptype = 5 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - associate( & - ipft_bare => subgrid_special_indices%ipft_not_vegetated, & - icol_natveg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_natveg => subgrid_special_indices%ilun_vegetated_or_bare_soil & - ) - - call setup_landunit_ncols(ltype=ilun_natveg, & - ctypes=[icol_natveg], & - cweights=[1._r8], & - ptype=my_ptype) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [my_ptype], & - ctype = [icol_natveg], & - ltype = [ilun_natveg], & - lat = [my_lat], & - lon = [my_lon]) - - subgridi = create_subgrid_info( & - npts = 3, & - name = 'pft', & - ptype = [ipft_bare + 1, ipft_bare, ipft_bare + 2], & - ctype = [(icol_natveg, i=1,3)], & - ltype = [(ilun_natveg, i=1,3)], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - ! For most landunits, we would need to set fill_missing_with_natveg to accomplish - ! this. However, it should be done for a natural veg output point even with - ! fill_missing_with_natveg .false. - call wrap_set_mindist(subgridi, subgrido, mindist_index, & - fill_missing_with_natveg = .false.) - - @assertEqual(2, mindist_index(1)) - - end associate - end subroutine newveg_usesBaresoil - - @Test - subroutine baresoil_ignoresSpecialLandunits(this) - ! This test ensures that, when finding a match for a bare soil patch, we ignore - ! special landunits. This is important because special landunits also have pft type = - ! noveg. - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - associate( & - ipft_bare => subgrid_special_indices%ipft_not_vegetated, & - icol_veg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_veg => subgrid_special_indices%ilun_vegetated_or_bare_soil & - ) - - call setup_landunit_ncols(ltype=ilun_veg, & - ctypes=[icol_veg], & - cweights=[1._r8], & - ptype=ipft_bare) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [ipft_bare], & - ctype = [icol_veg], & - ltype = [ilun_veg], & - lat = [my_lat], & - lon = [my_lon]) - - ! In the inputs, we use icol_veg even for special landunits, to make sure that even a - ! patch whose pft and column type indicate natural veg is ignored if its landunit - ! type is wrong. - subgridi = create_subgrid_info( & - npts = 3, & - name = 'pft', & - ptype = [ipft_bare, ipft_bare, ipft_bare], & - ctype = [icol_veg, icol_veg, icol_veg], & - ltype = [ilun_special, ilun_veg, ilun_special], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_mindist(subgridi, subgrido, mindist_index) - - @assertEqual(2, mindist_index(1)) - - end associate - end subroutine baresoil_ignoresSpecialLandunits - - @Test - subroutine fillMissing_usesNatveg(this) - ! This test ensures that, when using fill_missing_with_natveg, the code finds a point - ! from the natural veg landunit. This is especially important to check for - ! patch-level variables, for which special landunits also use the noveg (0) pft type. - ! So here we just check a patch-level variable. - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ptype = 5 - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = ilun_special - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: i - integer :: mindist_index(1) - - associate( & - ipft_bare => subgrid_special_indices%ipft_not_vegetated, & - icol_veg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_veg => subgrid_special_indices%ilun_vegetated_or_bare_soil & - ) - - call setup_landunit_ncols(ltype=my_ltype, & - ctypes=[my_ctype], & - cweights=[1._r8], & - ptype=my_ptype) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [my_ptype], & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - ! None of the input points match the output (in ptype, ctype or ltype). The 2nd point - ! is a bare ground point, though, and so should be used as the template if we specify - ! fill_missing_with_natveg. - subgridi = create_subgrid_info( & - npts = 3, & - name = 'pft', & - ptype = [ipft_bare, ipft_bare, ipft_bare], & - ctype = [icol_veg, icol_veg, icol_veg], & - ltype = [my_ltype + 1, ilun_veg, my_ltype + 1], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_mindist(subgridi, subgrido, mindist_index, fill_missing_with_natveg = .true.) - - @assertEqual(2, mindist_index(1)) - - end associate - end subroutine fillMissing_usesNatveg - - @Test - subroutine gridcell_findsClosestLatlon(this) - ! For gridcell-level variables, should find closest gridcell in lat-lon space - class(TestSetMindist), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer :: i - integer :: mindist_index(1) - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - - call setup_single_veg_patch(pft_type=1) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begg, & - name = 'gridcell', & - lat = [my_lat], & - lon = [my_lon]) - - subgridi = create_subgrid_info( & - npts = 3, & - name = 'gridcell', & - lat = [my_lat - 10._r8, my_lat - 1._r8, my_lat + 10._r8], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_mindist(subgridi, subgrido, mindist_index) - - @assertEqual(2, mindist_index(1)) - end subroutine gridcell_findsClosestLatlon - -end module test_set_mindist diff --git a/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf b/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf deleted file mode 100644 index f951a49432..0000000000 --- a/src/init_interp/test/initInterpMindist_test/test_set_single_match.pf +++ /dev/null @@ -1,359 +0,0 @@ -module test_set_single_match - - ! Tests of initInterpMindist: set_single_match - - use pfunit_mod - use initInterpMindist - use initInterpMindistTestUtils, only : create_subgrid_info, create_glc_behavior - use initInterpMindistTestUtils, only : subgrid_special_indices, ilun_special - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSimpleSubgridSetupsMod - use unittestSubgridMod - use unittestUtils, only : endrun_msg - use glcBehaviorMod, only: glc_behavior_type - - implicit none - - @TestCase - type, extends(TestCase) :: TestSetSingleMatch - contains - procedure :: setUp - procedure :: tearDown - end type TestSetSingleMatch - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Utility routines - ! ======================================================================== - - subroutine setUp(this) - class(TestSetSingleMatch), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestSetSingleMatch), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine wrap_set_single_match(subgridi, subgrido, mindist_index, activeo, & - glc_behavior) - ! Wrap the call to set_single_match - ! - ! If activeo is not provided, it is assumed to be .true. for all points - ! - ! If glc_behavior is not present, it is assumed to have collapse_to_atm_topo false - ! for all grid cells. - - ! Arguments: - type(subgrid_type), intent(in) :: subgridi - type(subgrid_type), intent(in) :: subgrido - integer, intent(out) :: mindist_index(:) - logical, intent(in), optional :: activeo(:) - type(glc_behavior_type), intent(in), optional :: glc_behavior - - ! Local variables: - integer :: npts_i, npts_o - integer :: bego, endo - logical, allocatable :: l_activeo(:) - type(glc_behavior_type) :: l_glc_behavior - - !----------------------------------------------------------------------- - - npts_i = size(subgridi%lon) - npts_o = size(subgrido%lon) - bego = lbound(subgrido%lon, 1) - endo = ubound(subgrido%lon, 1) - - @assertEqual(npts_o, size(mindist_index)) - - if (present(activeo)) then - @assertEqual(npts_o, size(activeo)) - l_activeo = activeo - else - allocate(l_activeo(npts_o)) - l_activeo = .true. - end if - - if (present(glc_behavior)) then - l_glc_behavior = glc_behavior - else - l_glc_behavior = create_glc_behavior(collapse_to_atm_topo = .false.) - end if - - call set_single_match(begi = 1, endi = npts_i, bego = bego, endo = endo, & - activeo = l_activeo, subgridi = subgridi, subgrido = subgrido, & - subgrid_special_indices = subgrid_special_indices, & - glc_behavior = l_glc_behavior, & - glc_elevclasses_same = .true., & - mindist_index = mindist_index) - - end subroutine wrap_set_single_match - - ! ======================================================================== - ! Tests - ! ======================================================================== - - @Test - subroutine singleMatch_findsMatch(this) - class(TestSetSingleMatch), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = 8 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: mindist_index(1) - integer :: i - - call setup_single_veg_patch(pft_type=1) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - ! The target point is point 3. Both before and after the target point there are - ! points with (1) same type but different location, and (2) same location but - ! different type. - subgridi = create_subgrid_info( & - npts = 5, & - name = 'column', & - ctype = [my_ctype-1, my_ctype, my_ctype, my_ctype, my_ctype+1], & - ltype = [(my_ltype, i=1,5)], & - lat = [my_lat, my_lat+1, my_lat, my_lat-1, my_lat], & - lon = [(my_lon, i=1,5)]) - - call wrap_set_single_match(subgridi, subgrido, mindist_index) - - @assertEqual(3, mindist_index(1)) - end subroutine singleMatch_findsMatch - - @Test - subroutine singleMatch_inactive_findsMatch(this) - ! Even if the output point is inactive, it still finds a match for this point. (This - ! is in contrast to set_mindist). - class(TestSetSingleMatch), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = 8 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: mindist_index(1) - integer :: i - - call setup_single_veg_patch(pft_type=1) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - subgridi = create_subgrid_info( & - npts = 3, & - name = 'column', & - ctype = [my_ctype-1, my_ctype, my_ctype+1], & - ltype = [(my_ltype, i=1,3)], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_single_match(subgridi, subgrido, mindist_index, & - activeo = [.false.]) - - @assertEqual(2, mindist_index(1)) - end subroutine singleMatch_inactive_findsMatch - - @Test - subroutine noMatches_inactive_returns0(this) - ! For an inactive point: it's okay if there are no candidate source points - class(TestSetSingleMatch), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = 8 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: mindist_index(1) - - call setup_single_veg_patch(pft_type=1) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - subgridi = create_subgrid_info( & - npts = 1, & - name = 'column', & - ctype = [my_ctype+1], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - call wrap_set_single_match(subgridi, subgrido, mindist_index, & - activeo = [.false.]) - - @assertEqual(0, mindist_index(1)) - end subroutine noMatches_inactive_returns0 - - @Test - subroutine twoMatches_aborts(this) - ! If there are two matches for the given output point, aborts - class(TestSetSingleMatch), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = 8 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: mindist_index(1) - integer :: i - character(len=:), allocatable :: expected_msg - - call setup_single_veg_patch(pft_type=1) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - subgridi = create_subgrid_info( & - npts = 2, & - name = 'column', & - ctype = [(my_ctype, i=1,2)], & - ltype = [(my_ltype, i=1,2)], & - lat = [(my_lat, i=1,2)], & - lon = [(my_lon, i=1,2)]) - - call wrap_set_single_match(subgridi, subgrido, mindist_index) - - expected_msg = endrun_msg( & - 'set_single_match ERROR: found multiple input points matching output point') - @assertExceptionRaised(expected_msg) - end subroutine twoMatches_aborts - - @Test - subroutine noMatches_aborts(this) - ! For an active point: aborts if there are no candidate source points - ! - ! Note for the future: We could probably relax this requirement if we added code that - ! set subgrid areas to zero for any active point in the output for which there are no - ! matching input points. - class(TestSetSingleMatch), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ctype = 15 - integer, parameter :: my_ltype = 8 - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: mindist_index(1) - character(len=:), allocatable :: expected_msg - - call setup_single_veg_patch(pft_type=1) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begc, & - name = 'column', & - ctype = [my_ctype], & - ltype = [my_ltype], & - lat = [my_lat], & - lon = [my_lon]) - - ! One point differs in lat, one point differs in lon, one point differs in ctype - subgridi = create_subgrid_info( & - npts = 3, & - name = 'column', & - ctype = [my_ctype, my_ctype, my_ctype+1], & - ltype = [my_ltype, my_ltype, my_ltype], & - lat = [my_lat+1, my_lat , my_lat], & - lon = [my_lon , my_lon+1, my_lon]) - - call wrap_set_single_match(subgridi, subgrido, mindist_index) - - expected_msg = endrun_msg( & - 'set_single_match ERROR: cannot find any input points matching output point') - @assertExceptionRaised(expected_msg) - - end subroutine noMatches_aborts - - @Test - subroutine noncropToCrop_patchVariable_aborts(this) - ! This test provides a contrast with the analogous test of set_mindist, - ! noncropToCrop_patchVariable_usesCorrectPft. For set_single_patch, in contrast to - ! set_mindist, it is an error if we try to go from a non-crop case to a crop case. - ! This is because areas won't add to 1 properly if we try to copy a crop patch from - ! the natural veg column onto a crop patch from its own crop column. - ! - ! This test also covers similar use cases, such as going from a crop case to a - ! non-crop case. - class(TestSetSingleMatch), intent(inout) :: this - type(subgrid_type) :: subgridi, subgrido - integer, parameter :: my_ptype = 5 - integer :: my_ctype - real(r8), parameter :: my_lat = 31._r8 - real(r8), parameter :: my_lon = 41._r8 - integer :: mindist_index(1) - integer :: i - character(len=:), allocatable :: expected_msg - - associate( & - icol_natveg => subgrid_special_indices%icol_vegetated_or_bare_soil, & - ilun_natveg => subgrid_special_indices%ilun_vegetated_or_bare_soil, & - ilun_crop => subgrid_special_indices%ilun_crop & - ) - - my_ctype = icol_natveg + 1 ! arbitrary; we just want this to differ from icol_natveg - - call setup_landunit_ncols(ltype=ilun_crop, & - ctypes=[my_ctype], & - cweights=[1._r8], & - ptype=my_ptype) - - subgrido = create_subgrid_info( & - npts = 1, & - beg = bounds%begp, & - name = 'pft', & - ptype = [my_ptype], & - ctype = [my_ctype], & - ltype = [ilun_crop], & - lat = [my_lat], & - lon = [my_lon]) - - ! Input point #2 has the same ptype, but a different ctype and ltype. Other input - ! points differ in ptype. With set_mindist, we would choose #2, but with - ! set_single_match we should abort. - subgridi = create_subgrid_info( & - npts = 3, & - name = 'pft', & - ptype = [my_ptype - 1, my_ptype, my_ptype + 1], & - ctype = [icol_natveg, icol_natveg, icol_natveg], & - ltype = [ilun_natveg, ilun_natveg, ilun_natveg], & - lat = [(my_lat, i=1,3)], & - lon = [(my_lon, i=1,3)]) - - call wrap_set_single_match(subgridi, subgrido, mindist_index) - - expected_msg = endrun_msg( & - 'set_single_match ERROR: cannot find any input points matching output point') - @assertExceptionRaised(expected_msg) - - end associate - end subroutine noncropToCrop_patchVariable_aborts - -end module test_set_single_match diff --git a/src/init_interp/test/initInterpMultilevel_test/CMakeLists.txt b/src/init_interp/test/initInterpMultilevel_test/CMakeLists.txt deleted file mode 100644 index d87d37529c..0000000000 --- a/src/init_interp/test/initInterpMultilevel_test/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set (pfunit_sources - initInterpMultilevelMock.pf - test_init_interp_multilevel_interp.pf - test_init_interp_multilevel_snow.pf - test_init_interp_multilevel_split.pf) - -# extra sources used for this test, which are not .pf files -set (extra_sources - multilevel_interp_factory.F90) - -create_pFUnit_test(initInterpMultilevel test_initInterpMultilevel_exe - "${pfunit_sources}" "${extra_sources}") - -target_link_libraries(test_initInterpMultilevel_exe clm csm_share) \ No newline at end of file diff --git a/src/init_interp/test/initInterpMultilevel_test/initInterpMultilevelMock.pf b/src/init_interp/test/initInterpMultilevel_test/initInterpMultilevelMock.pf deleted file mode 100644 index 34345e445d..0000000000 --- a/src/init_interp/test/initInterpMultilevel_test/initInterpMultilevelMock.pf +++ /dev/null @@ -1,112 +0,0 @@ -module initInterpMultilevelMock - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module defines a "mock" interpolator. All it does is assert that the - ! interp_multilevel routine is called correctly. - ! - ! !USES: - use pfunit_mod - use shr_kind_mod , only : r8 => shr_kind_r8 - use initInterpMultilevelBase , only : interp_multilevel_type - - implicit none - private - save - - ! Public types - - public :: interp_multilevel_mock_type - - type, extends(interp_multilevel_type) :: interp_multilevel_mock_type - private - character(len=:), allocatable :: name - - ! Expected arguments to interp_multilevel - real(r8), allocatable :: expected_data_dest(:) ! original values in data_dest - real(r8), allocatable :: expected_data_source(:) - integer :: expected_index_dest - contains - ! Public methods from base class - procedure :: interp_multilevel - procedure :: check_npts - procedure :: get_description - end type interp_multilevel_mock_type - - interface interp_multilevel_mock_type - module procedure constructor - end interface interp_multilevel_mock_type - -contains - - ! ======================================================================== - ! Constructors - ! ======================================================================== - - !----------------------------------------------------------------------- - function constructor(name, expected_data_dest, expected_data_source, & - expected_index_dest) result(this) - ! - ! !DESCRIPTION: - ! Creates an interp_multilevel_mock_type object - ! - ! !USES: - ! - ! !ARGUMENTS: - type(interp_multilevel_mock_type) :: this ! function result - character(len=*), intent(in) :: name ! name of this mock - real(r8) , intent(in) :: expected_data_dest(:) ! original values in data_dest - real(r8) , intent(in) :: expected_data_source(:) - integer , intent(in) :: expected_index_dest - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'constructor' - !----------------------------------------------------------------------- - - this%name = name - allocate(this%expected_data_dest(size(expected_data_dest))) - this%expected_data_dest = expected_data_dest - allocate(this%expected_data_source(size(expected_data_source))) - this%expected_data_source = expected_data_source - this%expected_index_dest = expected_index_dest - - end function constructor - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - subroutine interp_multilevel(this, data_dest, data_source, index_dest) - ! Mock version: Asserts that it is called with correct arguments - class(interp_multilevel_mock_type), intent(in) :: this - real(r8) , intent(inout) :: data_dest(:) ! not modified here, but intent(inout) to match interface - real(r8) , intent(in) :: data_source(:) - integer , intent(in) :: index_dest - - @assertEqual(size(this%expected_data_dest), size(data_dest), message=this%name//': data_dest size') - @assertEqual(this%expected_data_dest, data_dest, message=this%name//': data_dest') - @assertEqual(size(this%expected_data_source), size(data_source), message=this%name//': data_source size') - @assertEqual(this%expected_data_source, data_source, message=this%name//': data_source') - @assertEqual(this%expected_index_dest, index_dest, message=this%name//': index_dest') - - end subroutine interp_multilevel - - subroutine check_npts(this, npts, varname) - ! Stub - class(interp_multilevel_mock_type), intent(in) :: this - integer, intent(in) :: npts ! number of dest points (on this processor) - character(len=*), intent(in) :: varname ! variable name (for diagnostic output) - - ! Do nothing - end subroutine check_npts - - pure function get_description(this) result(description) - ! Stub - character(len=:), allocatable :: description ! function result - class(interp_multilevel_mock_type), intent(in) :: this - - description = ' ' - end function get_description - -end module initInterpMultilevelMock diff --git a/src/init_interp/test/initInterpMultilevel_test/multilevel_interp_factory.F90 b/src/init_interp/test/initInterpMultilevel_test/multilevel_interp_factory.F90 deleted file mode 100644 index 718b433fec..0000000000 --- a/src/init_interp/test/initInterpMultilevel_test/multilevel_interp_factory.F90 +++ /dev/null @@ -1,179 +0,0 @@ -module multilevel_interp_factory - ! Factory module for creating instances of interp_multilevel_type - - use initInterpMultilevelInterp, only : interp_multilevel_interp_type - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - private - save - - public :: create_multilevel_interp_no_levclasses - public :: create_multilevel_interp_with_levclasses - -contains - - ! ======================================================================== - ! Public routines - ! ======================================================================== - - function create_multilevel_interp_no_levclasses(coordinates_source, coordinates_dest, & - index_dest, npts_dest) & - result(interpolator) - ! Arguments: - type(interp_multilevel_interp_type) :: interpolator ! function result - real(r8), intent(in) :: coordinates_source(:) ! coordinates in source data for index_dest - real(r8), intent(in) :: coordinates_dest(:) ! coordinates in dest data for index_dest - - integer, intent(in) :: index_dest ! dest index of interest in tests - integer, intent(in) :: npts_dest ! total number of points wanted in dest - - ! Local variables: - real(r8), allocatable :: coordinates_source_all(:,:) - real(r8), allocatable :: coordinates_dest_all(:,:) - - character(len=*), parameter :: coord_varname = 'COORD' - !----------------------------------------------------------------------- - - call create_coordinate_arrays( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - coordinates_source_all = coordinates_source_all, & - coordinates_dest_all = coordinates_dest_all, & - index_dest = index_dest, & - npts_dest = npts_dest) - - interpolator = interp_multilevel_interp_type( & - coordinates_source = coordinates_source_all, & - coordinates_dest = coordinates_dest_all, & - coord_varname = coord_varname) - - end function create_multilevel_interp_no_levclasses - - function create_multilevel_interp_with_levclasses(coordinates_source, coordinates_dest, & - level_classes_source, level_classes_dest, & - index_dest, npts_dest) & - result(interpolator) - ! Arguments: - type(interp_multilevel_interp_type) :: interpolator ! function result - real(r8), intent(in) :: coordinates_source(:) ! coordinates in source data for index_dest - real(r8), intent(in) :: coordinates_dest(:) ! coordinates in dest data for index_dest - integer , intent(in) :: level_classes_source(:) ! class indices in source data for index_dest - integer , intent(in) :: level_classes_dest(:) ! class indices in dest data for index_dest - - integer, intent(in) :: index_dest ! dest index of interest in tests - integer, intent(in) :: npts_dest ! total number of points wanted in dest - - ! Local variables: - real(r8), allocatable :: coordinates_source_all(:,:) - real(r8), allocatable :: coordinates_dest_all(:,:) - integer , allocatable :: level_classes_source_all(:,:) - integer , allocatable :: level_classes_dest_all(:,:) - - character(len=*), parameter :: coord_varname = 'COORD' - !----------------------------------------------------------------------- - - call create_coordinate_arrays( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - coordinates_source_all = coordinates_source_all, & - coordinates_dest_all = coordinates_dest_all, & - index_dest = index_dest, & - npts_dest = npts_dest) - - call create_class_arrays( & - level_classes_source = level_classes_source, & - level_classes_dest = level_classes_dest, & - level_classes_source_all = level_classes_source_all, & - level_classes_dest_all = level_classes_dest_all, & - index_dest = index_dest, & - npts_dest = npts_dest) - - interpolator = interp_multilevel_interp_type( & - coordinates_source = coordinates_source_all, & - coordinates_dest = coordinates_dest_all, & - level_classes_source = level_classes_source_all, & - level_classes_dest = level_classes_dest_all, & - coord_varname = coord_varname) - - end function create_multilevel_interp_with_levclasses - - ! ======================================================================== - ! Private routines - ! ======================================================================== - - subroutine create_coordinate_arrays(coordinates_source, coordinates_dest, & - coordinates_source_all, coordinates_dest_all, & - index_dest, npts_dest) - ! Arguments: - real(r8), intent(in) :: coordinates_source(:) ! coordinates in source data for index_dest - real(r8), intent(in) :: coordinates_dest(:) ! coordinates in dest data for index_dest - real(r8), allocatable, intent(out) :: coordinates_source_all(:,:) - real(r8), allocatable, intent(out) :: coordinates_dest_all(:,:) - - integer, intent(in) :: index_dest ! dest index of interest in tests - integer, intent(in) :: npts_dest ! total number of points wanted in dest - - ! Local variables: - integer :: nlevels_source - integer :: nlevels_dest - - integer :: point, level - !----------------------------------------------------------------------- - - nlevels_source = size(coordinates_source) - nlevels_dest = size(coordinates_dest) - - allocate(coordinates_source_all(nlevels_source, npts_dest)) - allocate(coordinates_dest_all(nlevels_dest, npts_dest)) - - ! Fill coordinates with garbage - do point = 1, npts_dest - do level = 1, nlevels_source - coordinates_source_all(level, point) = 1000._r8 * level - end do - end do - - do point = 1, npts_dest - do level = 1, nlevels_dest - coordinates_dest_all(level, point) = 100000._r8 * level - end do - end do - - ! But put the passed-in coordinates in index_dest: - coordinates_source_all(:, index_dest) = coordinates_source(:) - coordinates_dest_all(:, index_dest) = coordinates_dest(:) - - end subroutine create_coordinate_arrays - - subroutine create_class_arrays(level_classes_source, level_classes_dest, & - level_classes_source_all, level_classes_dest_all, & - index_dest, npts_dest) - ! Arguments: - integer, intent(in) :: level_classes_source(:) ! classes in source data for index_dest - integer, intent(in) :: level_classes_dest(:) ! classes in dest data for index_dest - integer, allocatable, intent(out) :: level_classes_source_all(:,:) - integer, allocatable, intent(out) :: level_classes_dest_all(:,:) - - integer, intent(in) :: index_dest ! dest index of interest in tests - integer, intent(in) :: npts_dest ! total number of points wanted in dest - - ! Local variables: - integer :: nlevels_source - integer :: nlevels_dest - - integer, parameter :: default_class = 1 - !----------------------------------------------------------------------- - - nlevels_source = size(level_classes_source) - nlevels_dest = size(level_classes_dest) - - allocate(level_classes_source_all(nlevels_source, npts_dest), source = default_class) - allocate(level_classes_dest_all(nlevels_dest, npts_dest), source = default_class) - - level_classes_source_all(:, index_dest) = level_classes_source(:) - level_classes_dest_all(:, index_dest) = level_classes_dest(:) - - end subroutine create_class_arrays - -end module multilevel_interp_factory diff --git a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf deleted file mode 100644 index 32404e6d0b..0000000000 --- a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_interp.pf +++ /dev/null @@ -1,352 +0,0 @@ -module test_init_interp_multilevel_interp - - ! Tests of initInterpMultilevelInterp - - use pfunit_mod - use initInterpMultilevelInterp - use multilevel_interp_factory - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon, only : spval, ispval - - implicit none - - @TestCase - type, extends(TestCase) :: TestInitInterpMultilevelInterp - contains - procedure :: setUp - procedure :: tearDown - end type TestInitInterpMultilevelInterp - - real(r8), parameter :: tol = 1.e-13_r8 - - ! Tests use this destination index. Some other indices get filled with garbage values to - ! make sure we're accessing the correct points. - integer, parameter :: index_dest = 3 - - integer, parameter :: npts_dest = index_dest + 1 - -contains - - ! ------------------------------------------------------------------------ - ! Helper methods - ! ------------------------------------------------------------------------ - - subroutine setUp(this) - class(TestInitInterpMultilevelInterp), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestInitInterpMultilevelInterp), intent(inout) :: this - end subroutine tearDown - - function create_interpolator_no_levclasses(coordinates_source, coordinates_dest) & - result(interpolator) - ! Arguments: - type(interp_multilevel_interp_type) :: interpolator ! function result - real(r8), intent(in) :: coordinates_source(:) ! coordinates in source data for index_dest - real(r8), intent(in) :: coordinates_dest(:) ! coordinates in dest data for index_dest - !----------------------------------------------------------------------- - - interpolator = create_multilevel_interp_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - index_dest = index_dest, & - npts_dest = npts_dest) - - end function create_interpolator_no_levclasses - - function create_interpolator_with_levclasses(coordinates_source, coordinates_dest, & - level_classes_source, level_classes_dest) & - result(interpolator) - ! Arguments: - type(interp_multilevel_interp_type) :: interpolator ! function result - real(r8), intent(in) :: coordinates_source(:) ! coordinates in source data for index_dest - real(r8), intent(in) :: coordinates_dest(:) ! coordinates in dest data for index_dest - integer , intent(in) :: level_classes_source(:) ! class indices in source data for index_dest - integer , intent(in) :: level_classes_dest(:) ! class indices in dest data for index_dest - !----------------------------------------------------------------------- - - interpolator = create_multilevel_interp_with_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - level_classes_source = level_classes_source, & - level_classes_dest = level_classes_dest, & - index_dest = index_dest, & - npts_dest = npts_dest) - - end function create_interpolator_with_levclasses - - ! ------------------------------------------------------------------------ - ! Tests: no level classes - ! ------------------------------------------------------------------------ - - @Test - subroutine sameLevels_copies(this) - ! If the destination levels exactly match the source levels, the source data should - ! be copied to the destination data - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(3) = 0._r8 - real(r8), parameter :: data_source(3) = [11._r8, 12._r8, 13._r8] - real(r8), parameter :: coordinates(3) = [1._r8, 2._r8, 3._r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates, & - coordinates_dest = coordinates) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(data_source, data_dest) - - end subroutine sameLevels_copies - - @Test - subroutine allWithinBounds_interpolates(this) - ! If the destination has different levels, but all levels are within the bounds of - ! the source, the destination data should simply be interpolated from the source data. - ! - ! This tests interpolation to multiple destination levels at once. - - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(3) = 0._r8 - real(r8) :: data_dest_expected(3) - real(r8), parameter :: data_source(5) = [11._r8, 12._r8, 13._r8, 14._r8, 15._r8] - real(r8), parameter :: coordinates_source(5) = [21._r8, 22._r8, 23._r8, 24._r8, 25._r8] - real(r8), parameter :: coordinates_dest(3) = [21.5_r8, 22.75_r8, 24.5_r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected = [11.5_r8, 12.75_r8, 14.5_r8] - - @assertEqual(data_dest_expected, data_dest, tolerance=tol) - - end subroutine allWithinBounds_interpolates - - @Test - subroutine greaterThanLastLevel_copiesLastLevel(this) - ! If the destination level is greater than the last source level, it should copy data - ! from the last source level - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(1) = 0._r8 - real(r8), parameter :: data_source(3) = [11._r8, 12._r8, 13._r8] - real(r8), parameter :: coordinates_source(3) = [21._r8, 22._r8, 23._r8] - real(r8), parameter :: coordinates_dest(1) = [24._r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(data_source(3), data_dest) - - end subroutine greaterThanLastLevel_copiesLastLevel - - @Test - subroutine lessThanFirstLevel_copiesFirstLevel(this) - ! If the destination level is less than the first source level, it should copy data - ! from the first source level - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(1) = 0._r8 - real(r8), parameter :: data_source(3) = [11._r8, 12._r8, 13._r8] - real(r8), parameter :: coordinates_source(3) = [21._r8, 22._r8, 23._r8] - real(r8), parameter :: coordinates_dest(1) = [20._r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(data_source(1), data_dest) - - end subroutine lessThanFirstLevel_copiesFirstLevel - - @Test - subroutine noSourceLevels_leavesDestinationUnchanged(this) - ! If there are no source levels, then the destination should be left at its original - ! value - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8), parameter :: data_orig = 17._r8 - real(r8) :: data_dest(1) - real(r8) :: data_source(0) - real(r8) :: coordinates_source(0) - real(r8), parameter :: coordinates_dest(1) = [20._r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest) - - data_dest(1) = data_orig - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(data_orig, data_dest) - end subroutine noSourceLevels_leavesDestinationUnchanged - - ! ------------------------------------------------------------------------ - ! Tests: with level classes - ! ------------------------------------------------------------------------ - - @Test - subroutine noSourceLevelsInClass_leavesDestinationUnchanged(this) - ! If there are no source levels in the destination's class, then the destination - ! should be left at its original value - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8), parameter :: data_orig = 17._r8 - real(r8) :: data_dest(1) - real(r8), parameter :: data_source(3) = [11._r8, 12._r8, 13._r8] - real(r8), parameter :: coordinates_source(3) = [21._r8, 22._r8, 23._r8] - real(r8), parameter :: coordinates_dest(1) = [22._r8] - integer, parameter :: level_classes_source(3) = [2, 2, 2] - integer, parameter :: level_classes_dest(1) = [1] - - interpolator = create_interpolator_with_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - level_classes_source = level_classes_source, & - level_classes_dest = level_classes_dest) - - data_dest(1) = data_orig - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(data_orig, data_dest) - - end subroutine noSourceLevelsInClass_leavesDestinationUnchanged - - @Test - subroutine destLevelIsSpval_leavesDestinationUnchanged(this) - ! If the destination level class is ispval, then the destination should be left at - ! its original value - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8), parameter :: data_orig = 17._r8 - real(r8) :: data_dest(1) - real(r8), parameter :: data_source(3) = [11._r8, 12._r8, 13._r8] - real(r8), parameter :: coordinates_source(3) = [21._r8, 22._r8, 23._r8] - real(r8), parameter :: coordinates_dest(1) = [22._r8] - ! Note that some source classes are 1, some are ispval (so that there is at least one - ! level whose class is the same as the destination class: both are ispval) - integer, parameter :: level_classes_source(3) = [1, ispval, 1] - integer, parameter :: level_classes_dest(1) = [ispval] - - interpolator = create_interpolator_with_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - level_classes_source = level_classes_source, & - level_classes_dest = level_classes_dest) - - data_dest(1) = data_orig - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(data_orig, data_dest) - end subroutine destLevelIsSpval_leavesDestinationUnchanged - - @Test - subroutine dataInDifferentClasses_subsetsSourceLevelsByClass(this) - ! For data points in two different classes: Each data level's interpolation should - ! just consider the source points in that class - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(2) = 0._r8 - real(r8) :: data_dest_expected(2) - real(r8), parameter :: data_source(4) = [11._r8, 62._r8, 13._r8, 64._r8] - real(r8), parameter :: coordinates_source(4) = [21._r8, 22._r8, 23._r8, 24._r8] - integer , parameter :: level_classes_source(4) = [1 , 2 , 1 , 2] - ! The destination points are constructed so that the points fall exactly at one of - ! the source coordinates, but from the wrong class. So, if classes were not - ! considered, the destination data would be equal to the source data from the level - ! matching coordinates_dest; with classes, however, we need to interpolate from the - ! two adjacent points. - real(r8), parameter :: coordinates_dest(2) = [22._r8, 23._r8] - integer , parameter :: level_classes_dest(2) = [1 , 2] - - interpolator = create_interpolator_with_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest, & - level_classes_source = level_classes_source, & - level_classes_dest = level_classes_dest) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected = [12._r8, 63._r8] - - @assertEqual(data_dest_expected, data_dest) - end subroutine dataInDifferentClasses_subsetsSourceLevelsByClass - - @Test - subroutine monotonicCheck_ignoresNonExistentLevels(this) - ! Make sure that the test for monotonicity correctly ignores levels whose class is - ! ispval - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - - ! Exercise - interpolator = create_interpolator_with_levclasses( & - coordinates_source = [1._r8, 2._r8, 1.5_r8, 3._r8], & - coordinates_dest = [1._r8], & - level_classes_source = [1,1,ispval,1], & - level_classes_dest = [1]) - - ! No assertion: The test passes as long as the constructor doesn't abort - end subroutine monotonicCheck_ignoresNonExistentLevels - - ! ------------------------------------------------------------------------ - ! Tests: no level classes, but spval in source and/or destination data - ! ------------------------------------------------------------------------ - - @Test - subroutine destIsSpval_leavesDestinationUnchanged(this) - ! If the destination data is spval, then the destination should be left at spval - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(1) - real(r8), parameter :: data_source(3) = [11._r8, 12._r8, 13._r8] - real(r8), parameter :: coordinates_source(3) = [21._r8, 22._r8, 23._r8] - real(r8), parameter :: coordinates_dest(1) = [22._r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest) - - data_dest(1) = spval - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - @assertEqual(spval, data_dest) - end subroutine destIsSpval_leavesDestinationUnchanged - - @Test - subroutine sourceSpvalPoints_areIgnored(this) - ! If the source contains spval values in data, those levels should be ignored - class(TestInitInterpMultilevelInterp), intent(inout) :: this - type(interp_multilevel_interp_type) :: interpolator - real(r8) :: data_dest(1) = 0._r8 - real(r8) :: data_dest_expected(1) - real(r8), parameter :: data_source(4) = [11._r8, spval, spval, 14._r8] - ! coordinates_source are unevenly spaced to make sure we don't accidentally use - ! coordinates corresponding to the spval points: - real(r8), parameter :: coordinates_source(4) = [21._r8, 22.4_r8, 23.9_r8, 24._r8] - ! Note that the destination level falls in between the two source levels that have - ! spval - these should be ignored and the interpolation should instead use the other - ! points: - real(r8), parameter :: coordinates_dest(1) = [22.5_r8] - - interpolator = create_interpolator_no_levclasses( & - coordinates_source = coordinates_source, & - coordinates_dest = coordinates_dest) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected(1) = 12.5_r8 - @assertEqual(data_dest_expected, data_dest, tolerance=tol) - end subroutine sourceSpvalPoints_areIgnored - -end module test_init_interp_multilevel_interp diff --git a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_snow.pf b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_snow.pf deleted file mode 100644 index 439542a3bb..0000000000 --- a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_snow.pf +++ /dev/null @@ -1,172 +0,0 @@ -module test_init_interp_multilevel_snow - - ! Tests of initInterpMultilevelSnow - - use pfunit_mod - use initInterpMultilevelSnow - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestInitInterpMultilevelSnow - contains - procedure :: setUp - procedure :: tearDown - end type TestInitInterpMultilevelSnow - - real(r8), parameter :: tol = 1.e-13_r8 - - ! Tests use this destination index. Some other indices get filled with garbage values to - ! make sure we're accessing the correct points. - integer, parameter :: index_dest = 3 - - integer, parameter :: npts_dest = index_dest + 1 - -contains - - ! ------------------------------------------------------------------------ - ! Helper methods - ! ------------------------------------------------------------------------ - - subroutine setUp(this) - class(TestInitInterpMultilevelSnow), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestInitInterpMultilevelSnow), intent(inout) :: this - end subroutine tearDown - - function create_interpolator(num_snow_layers_source) result(interpolator) - ! Arguments: - type(interp_multilevel_snow_type) :: interpolator ! function result - integer, intent(in) :: num_snow_layers_source ! number of existing snow layers for index_dest - - ! Local variables: - integer, allocatable :: num_snow_layers_source_all(:) - character(len=*), parameter :: num_layers_name = 'NUM_LAYERS' - !----------------------------------------------------------------------- - - allocate(num_snow_layers_source_all(npts_dest)) - - num_snow_layers_source_all(:) = 0 - num_snow_layers_source_all(index_dest) = num_snow_layers_source - - interpolator = interp_multilevel_snow_type( & - num_snow_layers_source = num_snow_layers_source_all, & - num_layers_name = num_layers_name) - - end function create_interpolator - - ! ------------------------------------------------------------------------ - ! Begin tests - ! ------------------------------------------------------------------------ - - @Test - subroutine moreDestLevels_twoSourceLevels(this) - ! More dest levels than source levels; only some source levels have snow present - class(TestInitInterpMultilevelSnow), intent(inout) :: this - type(interp_multilevel_snow_type) :: interpolator - real(r8) :: data_dest(5) = 1000._r8 - real(r8) :: data_dest_expected(5) - real(r8) :: data_source(3) = [11._r8, 12._r8, 13._r8] - - interpolator = create_interpolator(num_snow_layers_source = 2) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected(1:2) = 0._r8 - data_dest_expected(3:5) = data_source(:) - @assertEqual(data_dest_expected, data_dest) - end subroutine moreDestLevels_twoSourceLevels - - @Test - subroutine sameDestLevels(this) - ! Same number of levels in dest as source; only some source levels have snow present - class(TestInitInterpMultilevelSnow), intent(inout) :: this - type(interp_multilevel_snow_type) :: interpolator - real(r8) :: data_dest(5) = 1000._r8 - real(r8) :: data_dest_expected(5) - integer :: i - real(r8) :: data_source(5) = [ (i, i=11,15) ] - - interpolator = create_interpolator(num_snow_layers_source = 3) - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected(:) = data_source(:) - @assertEqual(data_dest_expected, data_dest) - end subroutine sameDestLevels - - @Test - subroutine fewerDestLevels_moreThanExist(this) - ! Fewer snow levels in dest than source, but dest has more levels than the number of - ! existing snow layers in source - class(TestInitInterpMultilevelSnow), intent(inout) :: this - type(interp_multilevel_snow_type) :: interpolator - real(r8) :: data_dest(5) = 1000._r8 - real(r8) :: data_dest_expected(5) - integer :: i - real(r8) :: data_source(9) = [ (i, i=11,19) ] - - interpolator = create_interpolator(num_snow_layers_source = 3) - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected(:) = data_source(5:9) - @assertEqual(data_dest_expected, data_dest) - end subroutine fewerDestLevels_moreThanExist - - @Test - subroutine fewerDestLevels_sameAsExist(this) - ! Fewer snow levels in dest than source; dest has the same number of levels as the - ! number of existing snow layers in source - class(TestInitInterpMultilevelSnow), intent(inout) :: this - type(interp_multilevel_snow_type) :: interpolator - real(r8) :: data_dest(5) = 1000._r8 - real(r8) :: data_dest_expected(5) - integer :: i - real(r8) :: data_source(9) = [ (i, i=11,19) ] - - interpolator = create_interpolator(num_snow_layers_source = 5) - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected(:) = data_source(5:9) - @assertEqual(data_dest_expected, data_dest) - end subroutine fewerDestLevels_sameAsExist - - @Test - subroutine fewerDestLevels_fewerThanExist(this) - ! Fewer snow levels in dest than source; dest has fewer levels than the number of - ! existing snow layers in source - class(TestInitInterpMultilevelSnow), intent(inout) :: this - type(interp_multilevel_snow_type) :: interpolator - real(r8) :: data_dest(5) = 1000._r8 - real(r8) :: data_dest_expected(5) - integer :: i - real(r8) :: data_source(9) = [ (i, i=11,19) ] - - interpolator = create_interpolator(num_snow_layers_source = 7) - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - ! Note that the top level of source where snow exists is level 3 - data_dest_expected(:) = data_source(3:7) - @assertEqual(data_dest_expected, data_dest) - end subroutine fewerDestLevels_fewerThanExist - - @Test - subroutine fewerDestLevels_allExist(this) - ! Fewer snow levels in dest than source; all snow levels exist in source - class(TestInitInterpMultilevelSnow), intent(inout) :: this - type(interp_multilevel_snow_type) :: interpolator - real(r8) :: data_dest(5) = 1000._r8 - real(r8) :: data_dest_expected(5) - integer :: i - real(r8) :: data_source(9) = [ (i, i=11,19) ] - - interpolator = create_interpolator(num_snow_layers_source = 9) - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - data_dest_expected(:) = data_source(1:5) - @assertEqual(data_dest_expected, data_dest) - end subroutine fewerDestLevels_allExist - -end module test_init_interp_multilevel_snow diff --git a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_split.pf b/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_split.pf deleted file mode 100644 index 7932cdb7d6..0000000000 --- a/src/init_interp/test/initInterpMultilevel_test/test_init_interp_multilevel_split.pf +++ /dev/null @@ -1,140 +0,0 @@ -module test_init_interp_multilevel_split - - ! Tests of initInterpMultilevelSplit - - use pfunit_mod - use initInterpMultilevelSplit - use initInterpMultilevelInterp, only : interp_multilevel_interp_type - use initInterpMultilevelCopy, only : interp_multilevel_copy_type - use initInterpMultilevelMock, only : interp_multilevel_mock_type - use multilevel_interp_factory - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestInitInterpMultilevelSplit - contains - procedure :: setUp - procedure :: tearDown - end type TestInitInterpMultilevelSplit - - real(r8), parameter :: tol = 1.e-13_r8 - - ! Tests use this destination index. Some other indices get filled with garbage values to - ! make sure we're accessing the correct points. - integer, parameter :: index_dest = 3 - - integer, parameter :: npts_dest = index_dest + 1 - -contains - - subroutine setUp(this) - class(TestInitInterpMultilevelSplit), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestInitInterpMultilevelSplit), intent(inout) :: this - end subroutine tearDown - - @Test - subroutine interpsCalledCorrectly(this) - ! Test split interpolation with a "mock" to make sure the interpolators are called - ! correctly. - class(TestInitInterpMultilevelSplit), intent(inout) :: this - type(interp_multilevel_split_type) :: interpolator - type(interp_multilevel_mock_type), pointer :: interp_first, interp_second - integer, parameter :: nlev_source_first = 2 - integer, parameter :: nlev_dest_first = 3 - integer, parameter :: start_source_second = nlev_source_first + 1 - integer, parameter :: start_dest_second = nlev_dest_first + 1 - integer, parameter :: nlev_source_second = 5 - integer, parameter :: nlev_dest_second = 7 - real(r8) :: data_source(nlev_source_first + nlev_source_second) - real(r8) :: data_dest(nlev_dest_first + nlev_dest_second) - integer :: i - - do i = 1, size(data_source) - data_source(i) = 100._r8 + i - end do - do i = 1, size(data_dest) - data_dest(i) = 200._r8 + i - end do - - allocate(interp_first) - interp_first = interp_multilevel_mock_type("interp_first", & - expected_data_dest = data_dest(1:nlev_dest_first), & - expected_data_source = data_source(1:nlev_source_first), & - expected_index_dest = index_dest) - - allocate(interp_second) - interp_second = interp_multilevel_mock_type("interp_second", & - expected_data_dest = data_dest(start_dest_second:size(data_dest)), & - expected_data_source = data_source(start_source_second:size(data_source)), & - expected_index_dest = index_dest) - - interpolator = create_interp_multilevel_split_type( & - interpolator_first_levels = interp_first, & - interpolator_second_levels = interp_second, & - num_second_levels_source = nlev_source_second, & - num_second_levels_dest = nlev_dest_second) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - ! No assert section: mocks do the asserts for us - - end subroutine interpsCalledCorrectly - - @Test - subroutine differentInterpolatorTypes(this) - ! Test split interpolation with two different interpolator types, and with different - ! numbers of levels in source and dest. - class(TestInitInterpMultilevelSplit), intent(inout) :: this - type(interp_multilevel_split_type) :: interpolator - type(interp_multilevel_copy_type), pointer :: interp_first - type(interp_multilevel_interp_type), pointer :: interp_second - integer, parameter :: nlev_source_first = 4 - integer, parameter :: nlev_dest_first = 4 - integer, parameter :: nlev_source_second = 3 - integer, parameter :: nlev_dest_second = 2 - - real(r8), parameter :: coordinates_source_second(nlev_source_second) = & - [21._r8, 22._r8, 23._r8] - real(r8), parameter :: coordinates_dest_second(nlev_dest_second) = & - [21.5_r8, 22.5_r8] - - real(r8) :: data_dest(nlev_dest_first + nlev_dest_second) = 0._r8 - real(r8) :: data_dest_expected(nlev_dest_first + nlev_dest_second) = 0._r8 - real(r8), parameter :: data_source(nlev_source_first + nlev_source_second) = & - [11._r8, 12._r8, 13._r8, 14._r8, 15._r8, 16._r8, 17._r8] - - - allocate(interp_first) - allocate(interp_second) - - interp_second = create_multilevel_interp_no_levclasses( & - coordinates_source = coordinates_source_second, & - coordinates_dest = coordinates_dest_second, & - index_dest = index_dest, & - npts_dest = npts_dest) - - interpolator = create_interp_multilevel_split_type( & - interpolator_first_levels = interp_first, & - interpolator_second_levels = interp_second, & - num_second_levels_source = nlev_source_second, & - num_second_levels_dest = nlev_dest_second) - - call interpolator%interp_multilevel(data_dest, data_source, index_dest) - - ! Determine expected result - ! The first set of levels involves a simple copy: - data_dest_expected(1:nlev_dest_first) = data_source(1:nlev_source_first) - ! The second set of levels involves an interpolation: - data_dest_expected((nlev_dest_first+1):(nlev_dest_first+nlev_dest_second)) = & - [15.5_r8, 16.5_r8] - - @assertEqual(data_dest_expected, data_dest) - - end subroutine differentInterpolatorTypes - -end module test_init_interp_multilevel_split diff --git a/src/init_interp/test/initInterpUtils_test/CMakeLists.txt b/src/init_interp/test/initInterpUtils_test/CMakeLists.txt deleted file mode 100644 index 099120472c..0000000000 --- a/src/init_interp/test/initInterpUtils_test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set (pfunit_sources - test_glc_elevclasses_are_same.pf) - -create_pFUnit_test(initInterpUtils test_initInterpUtils_exe - "${pfunit_sources}" "") - -target_link_libraries(test_initInterpUtils_exe clm csm_share) \ No newline at end of file diff --git a/src/init_interp/test/initInterpUtils_test/test_glc_elevclasses_are_same.pf b/src/init_interp/test/initInterpUtils_test/test_glc_elevclasses_are_same.pf deleted file mode 100644 index 987429cf5d..0000000000 --- a/src/init_interp/test/initInterpUtils_test/test_glc_elevclasses_are_same.pf +++ /dev/null @@ -1,103 +0,0 @@ -module test_glc_elevclasses_are_same - - ! Tests of initInterpUtils: glc_elevclasses_are_same - - use pfunit_mod - use initInterpUtils - use shr_kind_mod , only : r8 => shr_kind_r8 - use ncdio_pio, only : file_desc_t, ncd_set_dim, ncd_set_var - - implicit none - - @TestCase - type, extends(TestCase) :: TestGlcECSame - type(file_desc_t) :: ncidi ! input file to use for test - type(file_desc_t) :: ncido ! output file to use for test - contains - procedure :: setUp - procedure :: tearDown - procedure :: createFiles - end type TestGlcECSame - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - subroutine setUp(this) - class(TestGlcECSame), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestGlcECSame), intent(inout) :: this - end subroutine tearDown - - subroutine createFiles(this, ec_bounds_ncidi, ec_bounds_ncido) - ! Creates this%ncidi and this%ncido, filled with correct glc_nec and glc_nec1 - ! dimensions and glc_elevclass_bounds data. - class(TestGlcECSame), intent(inout) :: this - real(r8), intent(in) :: ec_bounds_ncidi(:) - real(r8), intent(in) :: ec_bounds_ncido(:) - - this%ncidi = file_desc_t() - this%ncido = file_desc_t() - - call ncd_set_dim(this%ncidi, 'glc_nec', size(ec_bounds_ncidi)-1) - call ncd_set_dim(this%ncidi, 'glc_nec1', size(ec_bounds_ncidi)) - call ncd_set_var(ncid = this%ncidi, & - varname = 'glc_elevclass_bounds', & - data = reshape(ec_bounds_ncidi, [size(ec_bounds_ncidi), 1]), & - data_shape = [size(ec_bounds_ncidi)]) - - call ncd_set_dim(this%ncido, 'glc_nec', size(ec_bounds_ncido)-1) - call ncd_set_dim(this%ncido, 'glc_nec1', size(ec_bounds_ncido)) - call ncd_set_var(ncid = this%ncido, & - varname = 'glc_elevclass_bounds', & - data = reshape(ec_bounds_ncido, [size(ec_bounds_ncido), 1]), & - data_shape = [size(ec_bounds_ncido)]) - end subroutine createFiles - - @Test - subroutine different_num_ec(this) - class(TestGlcECSame), intent(inout) :: this - logical :: my_result - - call this%createFiles( & - ec_bounds_ncidi = [0._r8, 1._r8, 2._r8], & - ec_bounds_ncido = [0._r8, 1._r8, 2._r8, 3._r8]) - - my_result = glc_elevclasses_are_same(this%ncidi, this%ncido) - - @assertFalse(my_result) - end subroutine different_num_ec - - @Test - subroutine different_bounds(this) - class(TestGlcECSame), intent(inout) :: this - logical :: my_result - - call this%createFiles( & - ec_bounds_ncidi = [0._r8, 1._r8, 2._r8], & - ec_bounds_ncido = [0._r8, 1._r8, 4._r8]) - - my_result = glc_elevclasses_are_same(this%ncidi, this%ncido) - - @assertFalse(my_result) - end subroutine different_bounds - - @Test - subroutine same(this) - class(TestGlcECSame), intent(inout) :: this - real(r8), parameter :: diff = 1.e-12 - logical :: my_result - - ! Should be robust to differences within roundoff - call this%createFiles( & - ec_bounds_ncidi = [0._r8, 1._r8, 2._r8], & - ec_bounds_ncido = [0._r8, 1._r8, 2._r8+diff]) - - my_result = glc_elevclasses_are_same(this%ncidi, this%ncido) - - @assertTrue(my_result) - end subroutine same - -end module test_glc_elevclasses_are_same diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt deleted file mode 100644 index 971b364641..0000000000 --- a/src/main/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -list(APPEND clm_sources - ColumnType.F90 - pftconMod.F90 - FuncPedotransferMod.F90 - GridcellType.F90 - LandunitType.F90 - PatchType.F90 - TopoMod.F90 - abortutils.F90 - atm2lndMod.F90 - atm2lndType.F90 - accumulMod.F90 - clm_varcon.F90 - clm_varctl.F90 - clm_varpar.F90 - clm_varsur.F90 - column_varcon.F90 - decompMod.F90 - filterColMod.F90 - glc2lndMod.F90 - glcBehaviorMod.F90 - initSubgridMod.F90 - landunit_varcon.F90 - lnd2glcMod.F90 - ncdio_utils.F90 - organicFileMod.F90 - subgridAveMod.F90 - subgridWeightsMod.F90 - surfrdUtilsMod.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/main/ColumnType.F90 b/src/main/ColumnType.F90 deleted file mode 100644 index e7d355a59c..0000000000 --- a/src/main/ColumnType.F90 +++ /dev/null @@ -1,208 +0,0 @@ -module ColumnType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Column data type allocation and initialization - ! -------------------------------------------------------- - ! column types can have values of - ! -------------------------------------------------------- - ! 1 => (istsoil) soil (vegetated or bare soil) - ! 2 => (istcrop) crop (only for crop configuration) - ! 3 => (UNUSED) (formerly non-multiple elevation class land ice; currently unused) - ! 4 => (istice_mec) land ice (multiple elevation classes) - ! 5 => (istdlak) deep lake - ! 6 => (istwet) wetland - ! 71 => (icol_roof) urban roof - ! 72 => (icol_sunwall) urban sunwall - ! 73 => (icol_shadewall) urban shadewall - ! 74 => (icol_road_imperv) urban impervious road - ! 75 => (icol_road_perv) urban pervious road - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - use clm_varcon , only : spval, ispval - use shr_sys_mod , only : shr_sys_abort - use clm_varctl , only : iulog - use column_varcon , only : is_hydrologically_active - use LandunitType , only : lun - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - type, public :: column_type - ! g/l/c/p hierarchy, local g/l/c/p cells only - integer , pointer :: landunit (:) ! index into landunit level quantities - real(r8), pointer :: wtlunit (:) ! weight (relative to landunit) - integer , pointer :: gridcell (:) ! index into gridcell level quantities - real(r8), pointer :: wtgcell (:) ! weight (relative to gridcell) - integer , pointer :: patchi (:) ! beginning patch index for each column - integer , pointer :: patchf (:) ! ending patch index for each column - integer , pointer :: npatches (:) ! number of patches for each column - - ! topological mapping functionality - integer , pointer :: itype (:) ! column type (after init, should only be modified via update_itype routine) - logical , pointer :: active (:) ! true=>do computations on this column - logical , pointer :: type_is_dynamic (:) ! true=>itype can change throughout the run - - ! topography - ! TODO(wjs, 2016-04-05) Probably move these things into topoMod - real(r8), pointer :: micro_sigma (:) ! microtopography pdf sigma (m) - real(r8), pointer :: n_melt (:) ! SCA shape parameter - real(r8), pointer :: topo_slope (:) ! gridcell topographic slope - real(r8), pointer :: topo_std (:) ! gridcell elevation standard deviation - - ! vertical levels - integer , pointer :: snl (:) ! number of snow layers - real(r8), pointer :: dz (:,:) ! layer thickness (m) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: z (:,:) ! layer depth (m) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: zi (:,:) ! interface level below a "z" level (m) (-nlevsno+0:nlevgrnd) - real(r8), pointer :: zii (:) ! convective boundary height [m] - real(r8), pointer :: dz_lake (:,:) ! lake layer thickness (m) (1:nlevlak) - real(r8), pointer :: z_lake (:,:) ! layer depth for lake (m) - real(r8), pointer :: lakedepth (:) ! variable lake depth (m) - integer , pointer :: nbedrock (:) ! variable depth to bedrock index - - ! other column characteristics - logical , pointer :: hydrologically_active(:) ! true if this column is a hydrologically active type - - ! levgrnd_class gives the class in which each layer falls. This is relevant for - ! columns where there are 2 or more fundamentally different layer types. For - ! example, this distinguishes between soil and bedrock layers. The particular value - ! assigned to each class is irrelevant; the important thing is that different - ! classes (e.g., soil vs. bedrock) have different values of levgrnd_class. - ! - ! levgrnd_class = ispval indicates that the given layer is completely unused for - ! this column (i.e., this column doesn't use the full nlevgrnd layers). - integer , pointer :: levgrnd_class (:,:) ! class in which each layer falls (1:nlevgrnd) - contains - - procedure, public :: Init - procedure, public :: Clean - - ! Update the column type for one column. Any updates to col%itype after - ! initialization should be made via this routine. - procedure, public :: update_itype - - end type column_type - - type(column_type), public, target :: col !column data structure (soil/snow/canopy columns) - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, begc, endc) - ! - ! !ARGUMENTS: - class(column_type) :: this - integer, intent(in) :: begc,endc - !------------------------------------------------------------------------ - - ! The following is set in initGridCellsMod - allocate(this%gridcell (begc:endc)) ; this%gridcell (:) = ispval - allocate(this%wtgcell (begc:endc)) ; this%wtgcell (:) = nan - allocate(this%landunit (begc:endc)) ; this%landunit (:) = ispval - allocate(this%wtlunit (begc:endc)) ; this%wtlunit (:) = nan - allocate(this%patchi (begc:endc)) ; this%patchi (:) = ispval - allocate(this%patchf (begc:endc)) ; this%patchf (:) = ispval - allocate(this%npatches (begc:endc)) ; this%npatches (:) = ispval - allocate(this%itype (begc:endc)) ; this%itype (:) = ispval - allocate(this%active (begc:endc)) ; this%active (:) = .false. - allocate(this%type_is_dynamic(begc:endc)) ; this%type_is_dynamic(:) = .false. - - ! The following is set in initVerticalMod - allocate(this%snl (begc:endc)) ; this%snl (:) = ispval !* cannot be averaged up - allocate(this%dz (begc:endc,-nlevsno+1:nlevgrnd)) ; this%dz (:,:) = nan - allocate(this%z (begc:endc,-nlevsno+1:nlevgrnd)) ; this%z (:,:) = nan - allocate(this%zi (begc:endc,-nlevsno+0:nlevgrnd)) ; this%zi (:,:) = nan - allocate(this%zii (begc:endc)) ; this%zii (:) = nan - allocate(this%lakedepth (begc:endc)) ; this%lakedepth (:) = spval - allocate(this%dz_lake (begc:endc,nlevlak)) ; this%dz_lake (:,:) = nan - allocate(this%z_lake (begc:endc,nlevlak)) ; this%z_lake (:,:) = nan - - allocate(this%nbedrock (begc:endc)) ; this%nbedrock (:) = ispval - allocate(this%levgrnd_class(begc:endc,nlevgrnd)) ; this%levgrnd_class(:,:) = ispval - allocate(this%micro_sigma (begc:endc)) ; this%micro_sigma (:) = nan - allocate(this%n_melt (begc:endc)) ; this%n_melt (:) = nan - allocate(this%topo_slope (begc:endc)) ; this%topo_slope (:) = nan - allocate(this%topo_std (begc:endc)) ; this%topo_std (:) = nan - - allocate(this%hydrologically_active(begc:endc)) ; this%hydrologically_active(:) = .false. - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine Clean(this) - ! - ! !ARGUMENTS: - class(column_type) :: this - !------------------------------------------------------------------------ - - deallocate(this%gridcell ) - deallocate(this%wtgcell ) - deallocate(this%landunit ) - deallocate(this%wtlunit ) - deallocate(this%patchi ) - deallocate(this%patchf ) - deallocate(this%npatches ) - deallocate(this%itype ) - deallocate(this%active ) - deallocate(this%type_is_dynamic) - deallocate(this%snl ) - deallocate(this%dz ) - deallocate(this%z ) - deallocate(this%zi ) - deallocate(this%zii ) - deallocate(this%lakedepth ) - deallocate(this%dz_lake ) - deallocate(this%z_lake ) - deallocate(this%micro_sigma) - deallocate(this%n_melt ) - deallocate(this%topo_slope ) - deallocate(this%topo_std ) - deallocate(this%nbedrock ) - deallocate(this%levgrnd_class) - deallocate(this%hydrologically_active) - - end subroutine Clean - - !----------------------------------------------------------------------- - subroutine update_itype(this, c, itype) - ! - ! !DESCRIPTION: - ! Update the column type for one column. Any updates to col%itype after - ! initialization should be made via this routine. - ! - ! !ARGUMENTS: - class(column_type), intent(inout) :: this - integer, intent(in) :: c - integer, intent(in) :: itype - ! - ! !LOCAL VARIABLES: - integer :: l - - character(len=*), parameter :: subname = 'update_itype' - !----------------------------------------------------------------------- - - l = col%landunit(c) - - if (col%type_is_dynamic(c)) then - col%itype(c) = itype - col%hydrologically_active(c) = is_hydrologically_active( & - col_itype = itype, & - lun_itype = lun%itype(l)) - else - write(iulog,*) subname//' ERROR: attempt to update itype when type_is_dynamic is false' - write(iulog,*) 'c, col%itype(c), itype = ', c, col%itype(c), itype - ! Need to use shr_sys_abort rather than endrun, because using endrun would cause - ! circular dependencies - call shr_sys_abort(subname//' ERROR: attempt to update itype when type_is_dynamic is false') - end if - end subroutine update_itype - - - -end module ColumnType diff --git a/src/main/FuncPedotransferMod.F90 b/src/main/FuncPedotransferMod.F90 deleted file mode 100644 index 41e751344e..0000000000 --- a/src/main/FuncPedotransferMod.F90 +++ /dev/null @@ -1,141 +0,0 @@ -module FuncPedotransferMod -! -!DESCRIPTIONS: -!module contains different pedotransfer functions to -!compute the mineral soil hydraulic properties. -!currenty, only the Clapp-Hornberg formulation is used. -!HISTORY: -!created by Jinyun Tang, Mar.1st, 2014 -implicit none - private - public :: pedotransf - public :: get_ipedof - public :: init_pedof - - integer, parameter :: cosby_1984_table5 = 0 !by default uses this form - integer, parameter :: cosby_1984_table4 = 1 - integer, parameter :: noilhan_lacarrere_1995 = 2 - integer :: ipedof0 -contains - - subroutine init_pedof() - ! - !DESCRIPTIONS - !initialize the default pedotransfer function - implicit none - - - ipedof0 = cosby_1984_table5 !the default pedotransfer function - end subroutine init_pedof - - subroutine pedotransf(ipedof, sand, clay, watsat, bsw, sucsat, xksat) - !pedotransfer function to compute hydraulic properties of mineral soil - !based on input soil texture - - use shr_kind_mod , only : r8 => shr_kind_r8 - use abortutils , only : endrun - implicit none - integer, intent(in) :: ipedof !type of pedotransfer function, use the default pedotransfer function - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - character(len=32) :: subname = 'pedotransf' ! subroutine name - select case (ipedof) - case (cosby_1984_table4) - call pedotransf_cosby1984_table4(sand, clay, watsat, bsw, sucsat, xksat) - case (noilhan_lacarrere_1995) - call pedotransf_noilhan_lacarrere1995(sand, clay, watsat, bsw, sucsat, xksat) - case (cosby_1984_table5) - call pedotransf_cosby1984_table5(sand, clay, watsat, bsw, sucsat, xksat) - case default - call endrun(subname // ':: a pedotransfer function must be specified!') - end select - - end subroutine pedotransf - -!------------------------------------------------------------------------------------------ - subroutine pedotransf_cosby1984_table4(sand, clay, watsat, bsw, sucsat, xksat) - ! - !DESCRIPTIONS - !compute hydraulic properties based on functions derived from Table 4 in cosby et al, 1984 - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - !Cosby et al. Table 4 - watsat = 0.505_r8-0.00142_r8*sand-0.00037*clay - bsw = 3.10+0.157*clay-0.003*sand - sucsat = 10._r8 * ( 10._r8**(1.54_r8-0.0095_r8*sand+0.0063*(100._r8-sand-clay))) - xksat = 0.0070556 *(10.**(-0.60+0.0126*sand-0.0064*clay) ) !mm/s now use table 4. - - end subroutine pedotransf_cosby1984_table4 - -!------------------------------------------------------------------------------------------ - subroutine pedotransf_cosby1984_table5(sand, clay, watsat, bsw, sucsat, xksat) - ! - !DESCRIPTIONS - !compute hydraulic properties based on functions derived from Table 5 in cosby et al, 1984 - - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - !Cosby et al. Table 5 - watsat = 0.489_r8 - 0.00126_r8*sand - bsw = 2.91 + 0.159*clay - sucsat = 10._r8 * ( 10._r8**(1.88_r8-0.0131_r8*sand) ) - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s, from table 5 - - end subroutine pedotransf_cosby1984_table5 - -!------------------------------------------------------------------------------------------ - subroutine pedotransf_noilhan_lacarrere1995(sand, clay, watsat, bsw, sucsat, xksat) - ! - !DESCRIPTIONS - !compute hydraulic properties based on functions derived from Noilhan and Lacarrere, 1995 - - use shr_kind_mod , only : r8 => shr_kind_r8 - implicit none - real(r8), intent(in) :: sand !% sand - real(r8), intent(in) :: clay !% clay - real(r8), intent(out):: watsat !v/v saturate moisture - real(r8), intent(out):: bsw !b shape parameter - real(r8), intent(out):: sucsat !mm, soil matric potential - real(r8), intent(out):: xksat !mm/s, saturated hydraulic conductivity - - !Noilhan and Lacarrere, 1995 - watsat = -0.00108*sand+0.494305 - bsw = 0.137*clay + 3.501 - sucsat = 10._r8**(-0.0088*sand+2.85) - xksat = 10._r8**(-0.0582*clay-0.00091*sand+0.000529*clay**2._r8-0.0001203*sand**2._r8-1.38) - end subroutine pedotransf_noilhan_lacarrere1995 -!------------------------------------------------------------------------------------------ - function get_ipedof(soil_order)result(ipedof) - ! - ! DESCRIPTION - ! select the pedotransfer function to be used - implicit none - integer, intent(in) :: soil_order - - integer :: ipedof - - if(soil_order==0)then - ipedof=ipedof0 - endif - - end function get_ipedof -end module FuncpedotransferMod diff --git a/src/main/GetGlobalValuesMod.F90 b/src/main/GetGlobalValuesMod.F90 deleted file mode 100644 index 3cd1f9a306..0000000000 --- a/src/main/GetGlobalValuesMod.F90 +++ /dev/null @@ -1,153 +0,0 @@ -module GetGlobalValuesMod - - !----------------------------------------------------------------------- - ! Obtain and Write Global Index information - !----------------------------------------------------------------------- - implicit none - private - - ! PUBLIC MEMBER FUNCTIONS: - - public :: GetGlobalIndex - public :: GetGlobalWrite - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - integer function GetGlobalIndex(decomp_index, clmlevel) - - !---------------------------------------------------------------- - ! Description - ! Determine global index space value for target point at given clmlevel - ! - ! Uses: - use shr_log_mod, only: errMsg => shr_log_errMsg - use decompMod , only: bounds_type, get_clmlevel_gsmap, get_proc_bounds - use spmdMod , only: iam - use clm_varcon , only: nameg, namel, namec, namep - use clm_varctl , only: iulog - use mct_mod , only: mct_gsMap, mct_gsMap_orderedPoints - use shr_sys_mod, only: shr_sys_abort - ! - ! Arguments - integer , intent(in) :: decomp_index - character(len=*) , intent(in) :: clmlevel - ! - ! Local Variables: - type(bounds_type) :: bounds_proc ! processor bounds - type(mct_gsMap),pointer :: gsmap ! global seg map - integer, pointer,dimension(:) :: gsmap_ordered ! gsmap ordered points - integer :: beg_index ! beginning proc index for clmlevel - !---------------------------------------------------------------- - - call get_proc_bounds(bounds_proc) - - if (trim(clmlevel) == nameg) then - beg_index = bounds_proc%begg - else if (trim(clmlevel) == namel) then - beg_index = bounds_proc%begl - else if (trim(clmlevel) == namec) then - beg_index = bounds_proc%begc - else if (trim(clmlevel) == namep) then - beg_index = bounds_proc%begp - else - call shr_sys_abort('clmlevel of '//trim(clmlevel)//' not supported' // & - errmsg(sourcefile, __LINE__)) - end if - - call get_clmlevel_gsmap(clmlevel=trim(clmlevel), gsmap=gsmap) - call mct_gsMap_orderedPoints(gsmap, iam, gsmap_ordered) - GetGlobalIndex = gsmap_ordered(decomp_index - beg_index + 1) - deallocate(gsmap_ordered) - - end function GetGlobalIndex - - !----------------------------------------------------------------------- - subroutine GetGlobalWrite(decomp_index, clmlevel) - - !----------------------------------------------------------------------- - ! Description: - ! Write global index information for input local indices - ! - use shr_sys_mod , only : shr_sys_flush - use shr_sys_mod , only : shr_sys_abort - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog - use clm_varcon , only : nameg, namel, namec, namep - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! Arguments: - integer , intent(in) :: decomp_index - character(len=*) , intent(in) :: clmlevel - ! - ! Local Variables: - integer :: igrc, ilun, icol, ipft - !----------------------------------------------------------------------- - - if (trim(clmlevel) == nameg) then - - igrc = decomp_index - write(iulog,*)'local gridcell index = ',igrc - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - - else if (trim(clmlevel) == namel) then - - ilun = decomp_index - igrc = lun%gridcell(ilun) - write(iulog,*)'local landunit index = ',ilun - write(iulog,*)'global landunit index = ',GetGlobalIndex(decomp_index=ilun, clmlevel=namel) - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - write(iulog,*)'landunit type = ',lun%itype(decomp_index) - - else if (trim(clmlevel) == namec) then - - icol = decomp_index - ilun = col%landunit(icol) - igrc = col%gridcell(icol) - write(iulog,*)'local column index = ',icol - write(iulog,*)'global column index = ',GetGlobalIndex(decomp_index=icol, clmlevel=namec) - write(iulog,*)'global landunit index = ',GetGlobalIndex(decomp_index=ilun, clmlevel=namel) - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - write(iulog,*)'column type = ',col%itype(icol) - write(iulog,*)'landunit type = ',lun%itype(ilun) - - else if (trim(clmlevel) == namep) then - - ipft = decomp_index - icol = patch%column(ipft) - ilun = patch%landunit(ipft) - igrc = patch%gridcell(ipft) - write(iulog,*)'local patch index = ',ipft - write(iulog,*)'global patch index = ',GetGlobalIndex(decomp_index=ipft, clmlevel=namep) - write(iulog,*)'global column index = ',GetGlobalIndex(decomp_index=icol, clmlevel=namec) - write(iulog,*)'global landunit index = ',GetGlobalIndex(decomp_index=ilun, clmlevel=namel) - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - write(iulog,*)'pft type = ',patch%itype(ipft) - write(iulog,*)'column type = ',col%itype(icol) - write(iulog,*)'landunit type = ',lun%itype(ilun) - - else - call shr_sys_abort('clmlevel '//trim(clmlevel)//'not supported '//errmsg(sourcefile, __LINE__)) - - end if - - call shr_sys_flush(iulog) - - end subroutine GetGlobalWrite - -end module GetGlobalValuesMod diff --git a/src/main/GridcellType.F90 b/src/main/GridcellType.F90 deleted file mode 100644 index 30fe988eff..0000000000 --- a/src/main/GridcellType.F90 +++ /dev/null @@ -1,106 +0,0 @@ -module GridcellType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Gridcell data type allocation - ! -------------------------------------------------------- - ! gridcell types can have values of - ! -------------------------------------------------------- - ! 1 => default - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use landunit_varcon, only : max_lunit - use clm_varcon , only : ispval - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - type, public :: gridcell_type - - ! topological mapping functionality, local 1d gdc arrays - integer , pointer :: gindex (:) ! global index - real(r8), pointer :: area (:) ! total land area, gridcell (km^2) - real(r8), pointer :: lat (:) ! latitude (radians) - real(r8), pointer :: lon (:) ! longitude (radians) - real(r8), pointer :: latdeg (:) ! latitude (degrees) - real(r8), pointer :: londeg (:) ! longitude (degrees) - logical , pointer :: active (:) ! just needed for symmetry with other subgrid types - - integer, pointer :: nbedrock (:) ! index of uppermost bedrock layer - - ! Daylength - real(r8) , pointer :: max_dayl (:) ! maximum daylength for this grid cell (s) - real(r8) , pointer :: dayl (:) ! daylength (seconds) - real(r8) , pointer :: prev_dayl (:) ! daylength from previous timestep (seconds) - - ! indices into landunit-level arrays for landunits in this grid cell (ispval implies - ! this landunit doesn't exist on this grid cell) [1:max_lunit, begg:endg] - ! (note that the spatial dimension is last here, in contrast to most 2-d variables; - ! this is for efficiency, since most loops will go over g in the outer loop, and - ! landunit type in the inner loop) - integer , pointer :: landunit_indices (:,:) - - contains - - procedure, public :: Init - procedure, public :: Clean - - end type gridcell_type - type(gridcell_type), public, target :: grc !gridcell data structure - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, begg, endg) - ! - ! !ARGUMENTS: - class(gridcell_type) :: this - integer, intent(in) :: begg, endg - !------------------------------------------------------------------------ - - ! The following is set in InitGridCells - allocate(this%gindex (begg:endg)) ; this%gindex (:) = ispval - allocate(this%area (begg:endg)) ; this%area (:) = nan - allocate(this%lat (begg:endg)) ; this%lat (:) = nan - allocate(this%lon (begg:endg)) ; this%lon (:) = nan - allocate(this%latdeg (begg:endg)) ; this%latdeg (:) = nan - allocate(this%londeg (begg:endg)) ; this%londeg (:) = nan - allocate(this%active (begg:endg)) ; this%active (:) = .true. - allocate(this%nbedrock (begg:endg)) ; this%nbedrock (:) = ispval - - ! This is initiailized in module DayLength - allocate(this%max_dayl (begg:endg)) ; this%max_dayl (:) = nan - allocate(this%dayl (begg:endg)) ; this%dayl (:) = nan - allocate(this%prev_dayl (begg:endg)) ; this%prev_dayl (:) = nan - - allocate(this%landunit_indices(1:max_lunit, begg:endg)); this%landunit_indices(:,:) = ispval - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine Clean(this) - ! - ! !ARGUMENTS: - class(gridcell_type) :: this - !------------------------------------------------------------------------ - - deallocate(this%gindex ) - deallocate(this%area ) - deallocate(this%lat ) - deallocate(this%lon ) - deallocate(this%latdeg ) - deallocate(this%londeg ) - deallocate(this%active ) - deallocate(this%nbedrock ) - deallocate(this%max_dayl ) - deallocate(this%dayl ) - deallocate(this%prev_dayl ) - deallocate(this%landunit_indices ) - - end subroutine Clean - -end module GridcellType diff --git a/src/main/LandunitType.F90 b/src/main/LandunitType.F90 deleted file mode 100644 index 2236ca2780..0000000000 --- a/src/main/LandunitType.F90 +++ /dev/null @@ -1,140 +0,0 @@ -module LandunitType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Landunit data type allocation - ! -------------------------------------------------------- - ! landunits types can have values of (see landunit_varcon.F90) - ! -------------------------------------------------------- - ! 1 => (istsoil) soil (vegetated or bare soil landunit) - ! 2 => (istcrop) crop (only for crop configuration) - ! 3 => (UNUSED) (formerly non-multiple elevation class land ice; currently unused) - ! 4 => (istice_mec) land ice (multiple elevation classes) - ! 5 => (istdlak) deep lake - ! 6 => (istwet) wetland - ! 7 => (isturb_tbd) urban tbd - ! 8 => (isturb_hd) urban hd - ! 9 => (isturb_md) urban md - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : ispval - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - type, public :: landunit_type - ! g/l/c/p hierarchy, local g/l/c/p cells only - integer , pointer :: gridcell (:) ! index into gridcell level quantities - real(r8), pointer :: wtgcell (:) ! weight (relative to gridcell) - integer , pointer :: coli (:) ! beginning column index per landunit - integer , pointer :: colf (:) ! ending column index for each landunit - integer , pointer :: ncolumns (:) ! number of columns for each landunit - integer , pointer :: patchi (:) ! beginning patch index for each landunit - integer , pointer :: patchf (:) ! ending patch index for each landunit - integer , pointer :: npatches (:) ! number of patches for each landunit - - ! topological mapping functionality - integer , pointer :: itype (:) ! landunit type - logical , pointer :: ifspecial (:) ! true=>landunit is not vegetated - logical , pointer :: lakpoi (:) ! true=>lake point - logical , pointer :: urbpoi (:) ! true=>urban point - logical , pointer :: glcmecpoi (:) ! true=>glacier_mec point - logical , pointer :: active (:) ! true=>do computations on this landunit - - ! urban properties - real(r8), pointer :: canyon_hwr (:) ! urban landunit canyon height to width ratio (-) - real(r8), pointer :: wtroad_perv (:) ! urban landunit weight of pervious road column to total road (-) - real(r8), pointer :: wtlunit_roof (:) ! weight of roof with respect to urban landunit (-) - real(r8), pointer :: ht_roof (:) ! height of urban roof (m) - real(r8), pointer :: z_0_town (:) ! urban landunit momentum roughness length (m) - real(r8), pointer :: z_d_town (:) ! urban landunit displacement height (m) - - contains - - procedure, public :: Init ! Allocate and initialize - procedure, public :: Clean ! Clean up memory - - end type landunit_type - ! Singleton instance of the landunitType - type(landunit_type), public, target :: lun !geomorphological landunits - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, begl, endl) - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Allocate memory and initialize to signalling NaN to require - ! data be properly initialized somewhere else. - ! - ! !ARGUMENTS: - class(landunit_type) :: this - integer, intent(in) :: begl,endl - !------------------------------------------------------------------------ - - ! The following is set in InitGridCellsMod - allocate(this%gridcell (begl:endl)); this%gridcell (:) = ispval - allocate(this%wtgcell (begl:endl)); this%wtgcell (:) = nan - allocate(this%coli (begl:endl)); this%coli (:) = ispval - allocate(this%colf (begl:endl)); this%colf (:) = ispval - allocate(this%ncolumns (begl:endl)); this%ncolumns (:) = ispval - allocate(this%patchi (begl:endl)); this%patchi (:) = ispval - allocate(this%patchf (begl:endl)); this%patchf (:) = ispval - allocate(this%npatches (begl:endl)); this%npatches (:) = ispval - allocate(this%itype (begl:endl)); this%itype (:) = ispval - allocate(this%ifspecial (begl:endl)); this%ifspecial (:) = .false. - allocate(this%lakpoi (begl:endl)); this%lakpoi (:) = .false. - allocate(this%urbpoi (begl:endl)); this%urbpoi (:) = .false. - allocate(this%glcmecpoi (begl:endl)); this%glcmecpoi (:) = .false. - - ! The following is initialized in routine setActive in module reweightMod - allocate(this%active (begl:endl)) - - ! The following is set in routine urbanparams_inst%Init in module UrbanParamsType - allocate(this%canyon_hwr (begl:endl)); this%canyon_hwr (:) = nan - allocate(this%wtroad_perv (begl:endl)); this%wtroad_perv (:) = nan - allocate(this%ht_roof (begl:endl)); this%ht_roof (:) = nan - allocate(this%wtlunit_roof (begl:endl)); this%wtlunit_roof (:) = nan - allocate(this%z_0_town (begl:endl)); this%z_0_town (:) = nan - allocate(this%z_d_town (begl:endl)); this%z_d_town (:) = nan - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine Clean(this) - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Clean up memory use - ! - ! !ARGUMENTS: - class(landunit_type) :: this - !------------------------------------------------------------------------ - - deallocate(this%gridcell ) - deallocate(this%wtgcell ) - deallocate(this%coli ) - deallocate(this%colf ) - deallocate(this%ncolumns ) - deallocate(this%patchi ) - deallocate(this%patchf ) - deallocate(this%npatches ) - deallocate(this%itype ) - deallocate(this%ifspecial ) - deallocate(this%lakpoi ) - deallocate(this%urbpoi ) - deallocate(this%glcmecpoi ) - deallocate(this%active ) - deallocate(this%canyon_hwr ) - deallocate(this%wtroad_perv ) - deallocate(this%ht_roof ) - deallocate(this%wtlunit_roof ) - deallocate(this%z_0_town ) - deallocate(this%z_d_town ) - - end subroutine Clean - -end module LandunitType diff --git a/src/main/PatchType.F90 b/src/main/PatchType.F90 deleted file mode 100644 index d00f5588b0..0000000000 --- a/src/main/PatchType.F90 +++ /dev/null @@ -1,207 +0,0 @@ -module PatchType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Patch data type allocation - ! -------------------------------------------------------- - ! patch types can have values of - ! -------------------------------------------------------- - ! 0 => not_vegetated - ! 1 => needleleaf_evergreen_temperate_tree - ! 2 => needleleaf_evergreen_boreal_tree - ! 3 => needleleaf_deciduous_boreal_tree - ! 4 => broadleaf_evergreen_tropical_tree - ! 5 => broadleaf_evergreen_temperate_tree - ! 6 => broadleaf_deciduous_tropical_tree - ! 7 => broadleaf_deciduous_temperate_tree - ! 8 => broadleaf_deciduous_boreal_tree - ! 9 => broadleaf_evergreen_shrub - ! 10 => broadleaf_deciduous_temperate_shrub - ! 11 => broadleaf_deciduous_boreal_shrub - ! 12 => c3_arctic_grass - ! 13 => c3_non-arctic_grass - ! 14 => c4_grass - ! 15 => c3_crop - ! 16 => c3_irrigated - ! 17 => temperate_corn - ! 18 => irrigated_temperate_corn - ! 19 => spring_wheat - ! 20 => irrigated_spring_wheat - ! 21 => winter_wheat - ! 22 => irrigated_winter_wheat - ! 23 => temperate_soybean - ! 24 => irrigated_temperate_soybean - ! 25 => barley - ! 26 => irrigated_barley - ! 27 => winter_barley - ! 28 => irrigated_winter_barley - ! 29 => rye - ! 30 => irrigated_rye - ! 31 => winter_rye - ! 32 => irrigated_winter_rye - ! 33 => cassava - ! 34 => irrigated_cassava - ! 35 => citrus - ! 36 => irrigated_citrus - ! 37 => cocoa - ! 38 => irrigated_cocoa - ! 39 => coffee - ! 40 => irrigated_coffee - ! 41 => cotton - ! 42 => irrigated_cotton - ! 43 => datepalm - ! 44 => irrigated_datepalm - ! 45 => foddergrass - ! 46 => irrigated_foddergrass - ! 47 => grapes - ! 48 => irrigated_grapes - ! 49 => groundnuts - ! 50 => irrigated_groundnuts - ! 51 => millet - ! 52 => irrigated_millet - ! 53 => oilpalm - ! 54 => irrigated_oilpalm - ! 55 => potatoes - ! 56 => irrigated_potatoes - ! 57 => pulses - ! 58 => irrigated_pulses - ! 59 => rapeseed - ! 60 => irrigated_rapeseed - ! 61 => rice - ! 62 => irrigated_rice - ! 63 => sorghum - ! 64 => irrigated_sorghum - ! 65 => sugarbeet - ! 66 => irrigated_sugarbeet - ! 67 => sugarcane - ! 68 => irrigated_sugarcane - ! 69 => sunflower - ! 70 => irrigated_sunflower - ! 71 => miscanthus - ! 72 => irrigated_miscanthus - ! 73 => switchgrass - ! 74 => irrigated_switchgrass - ! 75 => tropical_corn - ! 76 => irrigated_tropical_corn - ! 77 => tropical_soybean - ! 78 => irrigated_tropical_soybean - ! -------------------------------------------------------- - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varcon , only : ispval - use clm_varctl , only : use_fates - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - type, public :: patch_type - - ! g/l/c/p hierarchy, local g/l/c/p cells only - integer , pointer :: column (:) ! index into column level quantities - real(r8), pointer :: wtcol (:) ! weight (relative to column) - integer , pointer :: landunit (:) ! index into landunit level quantities - real(r8), pointer :: wtlunit (:) ! weight (relative to landunit) - integer , pointer :: gridcell (:) ! index into gridcell level quantities - real(r8), pointer :: wtgcell (:) ! weight (relative to gridcell) - - ! Non-ED only - integer , pointer :: itype (:) ! patch vegetation - integer , pointer :: mxy (:) ! m index for laixy(i,j,m),etc. (undefined for special landunits) - logical , pointer :: active (:) ! true=>do computations on this patch - - ! fates only - logical , pointer :: is_veg (:) ! This is an ACTIVE fates patch - logical , pointer :: is_bareground (:) - real(r8), pointer :: wt_ed (:) !TODO mv ? can this be removed - - - logical, pointer :: is_fates (:) ! true for patch vector space reserved - ! for FATES. - ! this is static and is true for all - ! patches within fates jurisdiction - ! including patches which are not currently - ! associated with a FATES linked-list patch - - - contains - - procedure, public :: Init - procedure, public :: Clean - - end type patch_type - type(patch_type), public, target :: patch ! patch type data structure - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, begp, endp) - ! - ! !ARGUMENTS: - class(patch_type) :: this - integer, intent(in) :: begp,endp - ! - ! LOCAL VARAIBLES: - !------------------------------------------------------------------------ - - ! The following is set in InitGridCells - - allocate(this%gridcell (begp:endp)); this%gridcell (:) = ispval - allocate(this%wtgcell (begp:endp)); this%wtgcell (:) = nan - - allocate(this%landunit (begp:endp)); this%landunit (:) = ispval - allocate(this%wtlunit (begp:endp)); this%wtlunit (:) = nan - - allocate(this%column (begp:endp)); this%column (:) = ispval - allocate(this%wtcol (begp:endp)); this%wtcol (:) = nan - - allocate(this%mxy (begp:endp)); this%mxy (:) = ispval - allocate(this%active (begp:endp)); this%active (:) = .false. - - ! TODO (MV, 10-17-14): The following must be commented out because - ! currently the logic checking if patch%itype(p) is not equal to noveg - ! is used in RootBiogeophysMod in zeng2001_rootfr- a filter is not used - ! in that routine - which would elimate this problem - - allocate(this%itype (begp:endp)); this%itype (:) = ispval - - allocate(this%is_fates (begp:endp)); this%is_fates (:) = .false. - - if (use_fates) then - allocate(this%is_veg (begp:endp)); this%is_veg (:) = .false. - allocate(this%is_bareground (begp:endp)); this%is_bareground (:) = .false. - allocate(this%wt_ed (begp:endp)); this%wt_ed (:) = nan - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine Clean(this) - ! - ! !ARGUMENTS: - class(patch_type) :: this - !------------------------------------------------------------------------ - - deallocate(this%gridcell) - deallocate(this%wtgcell ) - deallocate(this%landunit) - deallocate(this%wtlunit ) - deallocate(this%column ) - deallocate(this%wtcol ) - deallocate(this%itype ) - deallocate(this%mxy ) - deallocate(this%active ) - deallocate(this%is_fates) - - if (use_fates) then - deallocate(this%is_veg) - deallocate(this%is_bareground) - deallocate(this%wt_ed) - end if - - end subroutine Clean - -end module PatchType diff --git a/src/main/TopoMod.F90 b/src/main/TopoMod.F90 deleted file mode 100644 index 43b935bed0..0000000000 --- a/src/main/TopoMod.F90 +++ /dev/null @@ -1,321 +0,0 @@ -module TopoMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handles topographic height of each column - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use PatchType , only : patch - use ColumnType , only : col - use LandunitType , only : lun - use glc2lndMod , only : glc2lnd_type - use glcBehaviorMod , only : glc_behavior_type - use landunit_varcon, only : istice_mec - use filterColMod , only : filter_col_type, col_filter_from_logical_array_active_only - ! - ! !PUBLIC TYPES: - implicit none - save - private - - type, public :: topo_type - private - - ! Public member data - - real(r8), pointer, public :: topo_col(:) ! surface elevation (m) - - ! Private member data - - logical, pointer :: needs_downscaling_col(:) ! whether a column needs to be downscaled - contains - procedure, public :: Init - procedure, public :: Restart - procedure, public :: Clean - procedure, public :: UpdateTopo ! Update topographic height each time step - procedure, public :: DownscaleFilterc ! Returns column-level filter: which columns need downscaling - - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - end type topo_type - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, bounds) - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, bounds) - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - begc = bounds%begc - endc = bounds%endc - - allocate(this%topo_col(begc:endc)) - this%topo_col(:) = nan - - allocate(this%needs_downscaling_col(begc:endc)) - this%needs_downscaling_col(:) = .false. - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! !USES: - use histFileMod , only : hist_addfld1d - ! - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - call hist_addfld1d(fname='TOPO_COL', units='m', & - avgflag='A', long_name='column-level topographic height', & - ptr_col=this%topo_col, default='inactive') - - call hist_addfld1d(fname='TOPO_COL_ICE', units='m', & - avgflag='A', long_name='column-level topographic height (ice landunits only)', & - ptr_col=this%topo_col, l2g_scale_type='ice', default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! !USES: - use column_varcon , only: col_itype_to_icemec_class - use clm_instur, only : topo_glc_mec - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c, l, g - integer :: icemec_class ! current icemec class (1..maxpatch_glcmec) - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - g = col%gridcell(c) - - if (lun%itype(l) == istice_mec) then - ! For ice_mec landunits, initialize topo_col based on surface dataset; this - ! will get overwritten in the run loop by values sent from CISM - icemec_class = col_itype_to_icemec_class(col%itype(c)) - this%topo_col(c) = topo_glc_mec(g, icemec_class) - this%needs_downscaling_col(c) = .true. - else - ! For other landunits, arbitrarily initialize topo_col to 0 m; for landunits - ! where this matters, this will get overwritten in the run loop by values sent - ! from CISM - this%topo_col(c) = 0._r8 - this%needs_downscaling_col(c) = .false. - end if - end do - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! !USES: - use ncdio_pio, only : file_desc_t, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read', 'write' or 'define' - ! - ! !LOCAL VARIABLES: - integer :: p, c - real(r8), pointer :: rparr(:) - logical :: readvar - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - allocate(rparr(bounds%begp:bounds%endp)) - - ! TODO(wjs, 2016-04-05) Rename these restart variables to get rid of 'glc' in their - ! names. However, this will require some changes to init_interp, too. - - ! This one is not actually an area, but has interpinic_flag='area' because we want to - ! interpolate it under the same conditions under which we interpolate areas. - call restartvar(ncid=ncid, flag=flag, varname='cols1d_topoglc', xtype=ncd_double, & - dim1name='column', & - long_name='mean elevation on glacier elevation classes', units='m', & - interpinic_flag='area', readvar=readvar, data=this%topo_col) - - if (flag /= 'read') then - do p=bounds%begp,bounds%endp - c = patch%column(p) - rparr(p) = this%topo_col(c) - enddo - ! This one has interpinic_flag = 'skip' because it isn't read back in - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_topoglc', xtype=ncd_double, & - dim1name='pft', & - long_name='mean elevation on glacier elevation classes', units='m', & - interpinic_flag='skip', readvar=readvar, data=rparr) - end if - - deallocate(rparr) - - end subroutine Restart - - - !----------------------------------------------------------------------- - subroutine UpdateTopo(this, bounds, num_icemecc, filter_icemecc, & - glc2lnd_inst, glc_behavior, atm_topo) - ! - ! !DESCRIPTION: - ! Update topographic heights - ! - ! Should be called each time step. - ! - ! Should be called after glc2lndMod:update_glc2lnd_fracs, and before - ! atm2lndMod:downscale_forcings - ! - ! !ARGUMENTS: - class(topo_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_icemecc ! number of points in filter_icemecc - integer , intent(in) :: filter_icemecc(:) ! col filter for ice_mec - type(glc2lnd_type) , intent(in) :: glc2lnd_inst - type(glc_behavior_type) , intent(in) :: glc_behavior - real(r8) , intent(in) :: atm_topo( bounds%begg: ) ! atmosphere topographic height [m] - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: c, g - - character(len=*), parameter :: subname = 'UpdateTopo' - !----------------------------------------------------------------------- - - begc = bounds%begc - endc = bounds%endc - - ! Reset needs_downscaling_col each time step, because this is potentially - ! time-varying for some columns. It's simplest just to reset it everywhere, rather - ! than trying to figure out where it does and does not need to be reset. - this%needs_downscaling_col(begc:endc) = .false. - - call glc_behavior%icemec_cols_need_downscaling(bounds, num_icemecc, filter_icemecc, & - this%needs_downscaling_col(begc:endc)) - - ! In addition to updating topo_col, this also sets some additional elements of - ! needs_downscaling_col to .true. (but leaves the already-.true. values as is.) - call glc2lnd_inst%update_glc2lnd_topo(bounds, & - this%topo_col(begc:endc), & - this%needs_downscaling_col(begc:endc)) - - ! For any point that isn't downscaled, set its topo value to the atmosphere's - ! topographic height. This shouldn't matter, but is useful if topo_col is written to - ! the history file. - ! - ! This could operate over a filter like 'allc' in order to just operate over active - ! points, but I'm not sure that would speed things up much, and would require passing - ! in this additional filter. - do c = bounds%begc, bounds%endc - if (.not. this%needs_downscaling_col(c)) then - g = col%gridcell(c) - this%topo_col(c) = atm_topo(g) - end if - end do - - call glc_behavior%update_glc_classes(bounds, this%topo_col(begc:endc)) - - end subroutine UpdateTopo - - !----------------------------------------------------------------------- - function DownscaleFilterc(this, bounds) result(filter) - ! - ! !DESCRIPTION: - ! Returns a column-level filter: which columns need downscaling. - ! - ! This filter only contains active points. - ! - ! The main reason it's important to have this filter (as opposed to just doing the - ! downscaling for all columns) is because of downscaled fields that are normalized - ! (like longwave radiation): Consider a gridcell with a glc_mec column and a - ! vegetated column (outside of the icemask, so the vegetated column doesn't have its - ! topographic height explicitly set). If we called the downscaling code for all - ! columns, the longwave radiation would get adjusted over the vegetated column. This - ! is undesirable, because it means that adding a downscaled column in a gridcell can - ! change answers for all other columns in that gridcell. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - class(topo_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'DownscaleFilterc' - !----------------------------------------------------------------------- - - ! Currently this creates the filter on the fly, recreating it every time this function - ! is called. In principle, we should be able to compute and save this filter when - ! UpdateTopo is called, returning the already-computed filter when this function is - ! called. However, the problem with that is the need to have a different filter for - ! each clump (and potentially another filter for calls from outside a clump - ! loop). This will become easier to handle if we rework CLM's threading so that there - ! is a separate instance of each object for each clump: in that case, we'll have - ! multiple instances of topo_type, each corresponding to one clump, each with its own - ! filter. - - filter = col_filter_from_logical_array_active_only(bounds, & - this%needs_downscaling_col(bounds%begc:bounds%endc)) - - end function DownscaleFilterc - - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! !ARGUMENTS: - class(topo_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate(this%topo_col) - deallocate(this%needs_downscaling_col) - - end subroutine Clean - -end module TopoMod diff --git a/src/main/abortutils.F90 b/src/main/abortutils.F90 deleted file mode 100644 index 9f9ce56272..0000000000 --- a/src/main/abortutils.F90 +++ /dev/null @@ -1,95 +0,0 @@ -module abortutils - - !----------------------------------------------------------------------- - ! !MODULE: abortutils - ! - ! !DESCRIPTION: - ! Abort the model for abnormal termination - !----------------------------------------------------------------------- - - private - save - - public :: endrun - - interface endrun - module procedure endrun_vanilla - module procedure endrun_globalindex - end interface - -CONTAINS - - !----------------------------------------------------------------------- - subroutine endrun_vanilla(msg, additional_msg) - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Abort the model for abnormal termination - ! - use shr_sys_mod , only: shr_sys_abort - use clm_varctl , only: iulog - ! - ! !ARGUMENTS: - implicit none - - ! Generally you want to at least provide msg. The main reason to separate msg from - ! additional_msg is to supported expected-exception unit testing: you can put - ! volatile stuff in additional_msg, as in: - ! call endrun(msg='Informative message', additional_msg=errmsg(__FILE__, __LINE__)) - ! and then just assert against msg. - character(len=*), intent(in), optional :: msg ! string to be passed to shr_sys_abort - character(len=*), intent(in), optional :: additional_msg ! string to be printed, but not passed to shr_sys_abort - !----------------------------------------------------------------------- - - if (present (additional_msg)) then - write(iulog,*)'ENDRUN: ', additional_msg - else - write(iulog,*)'ENDRUN:' - end if - - call shr_sys_abort(msg) - - end subroutine endrun_vanilla - - !----------------------------------------------------------------------- - subroutine endrun_globalindex(decomp_index, clmlevel, msg, additional_msg) - - !----------------------------------------------------------------------- - ! Description: - ! Abort the model for abnormal termination - ! - use shr_sys_mod , only: shr_sys_abort - use clm_varctl , only: iulog - use GetGlobalValuesMod, only: GetGlobalWrite - ! - ! Arguments: - implicit none - integer , intent(in) :: decomp_index - character(len=*) , intent(in) :: clmlevel - - ! Generally you want to at least provide msg. The main reason to separate msg from - ! additional_msg is to supported expected-exception unit testing: you can put - ! volatile stuff in additional_msg, as in: - ! call endrun(msg='Informative message', additional_msg=errmsg(__FILE__, __LINE__)) - ! and then just assert against msg. - character(len=*), intent(in), optional :: msg ! string to be passed to shr_sys_abort - character(len=*), intent(in), optional :: additional_msg ! string to be printed, but not passed to shr_sys_abort - ! - ! Local Variables: - integer :: igrc, ilun, icol - !----------------------------------------------------------------------- - - write(6,*)'calling getglobalwrite with decomp_index= ',decomp_index,' and clmlevel= ',trim(clmlevel) - call GetGlobalWrite(decomp_index, clmlevel) - - if (present (additional_msg)) then - write(iulog,*)'ENDRUN: ', additional_msg - else - write(iulog,*)'ENDRUN:' - end if - - call shr_sys_abort(msg) - - end subroutine endrun_globalindex - -end module abortutils diff --git a/src/main/accumulMod.F90 b/src/main/accumulMod.F90 deleted file mode 100644 index 29a52ceb52..0000000000 --- a/src/main/accumulMod.F90 +++ /dev/null @@ -1,827 +0,0 @@ -module accumulMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! This module contains generic subroutines that can be used to - ! define, accumulate and extract user-specified fields over - ! user-defined intervals. Each interval and accumulation type is - ! unique to each field processed. - ! Subroutine [init_accumulator] defines the values of the accumulated - ! field data structure. Subroutine [update_accum_field] does - ! the actual accumulation for a given field. - ! Three types of accumulations are possible: - ! - Average over time interval. Time average fields are only - ! valid at the end of the averaging interval. - ! - Running mean over time interval. Running means are valid once the - ! length of the simulation exceeds the - ! - Running accumulation over time interval. Accumulated fields are - ! continuously accumulated. The trigger value "-99999." resets - ! the accumulation to zero. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_sys_mod , only: shr_sys_abort - use shr_log_mod , only: errMsg => shr_log_errMsg - use abortutils , only: endrun - use clm_varctl , only: iulog, nsrest, nsrStartup - use clm_varcon , only: spval, ispval - use PatchType , only : patch - use ColumnType , only : col - use LandunitType, only : lun - use GridcellType, only : grc - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: accumulRest ! Write/read restart of accumulation fields - public :: init_accum_field ! Initialize an accumulator field - public :: print_accum_fields ! Print info about accumulator fields - public :: extract_accum_field ! Extracts the current value of an accumulator field - public :: update_accum_field ! Update the current value of an accumulator field - public :: clean_accum_fields ! Deallocate space and reset accum fields list - - interface extract_accum_field - module procedure extract_accum_field_sl ! Extract current val of single-level accumulator field - module procedure extract_accum_field_ml ! Extract current val of multi-level accumulator field - end interface - interface update_accum_field ! Updates the current value of an accumulator field - module procedure update_accum_field_sl ! Update single-level accumulator field - module procedure update_accum_field_ml ! Update multi-level accumulator field - end interface - private - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: extract_accum_field_basic ! Extract values for one level of the given field - private :: extract_accum_field_timeavg ! Extract values for one level of the given timeavg field - private :: update_accum_field_timeavg ! Update values for one level of the given timeavg field - private :: update_accum_field_runmean ! Update values for one level of the given runmean field - private :: update_accum_field_runaccum ! Update values for one level of the given runaccum field - private :: find_field ! Find field index given field name - private :: acctype_to_string ! Return a string representation of an ACCTYPE parameter - ! - ! !PRIVATE TYPES: - - type accum_field - character(len= 8) :: name !field name - character(len=128) :: desc !field description - character(len= 8) :: units !field units - integer :: acctype !accumulation type (see ACCTYPE parameters below) - character(len= 8) :: type1d !subgrid type: ["gridcell","landunit","column" or "pft"] - character(len= 8) :: type2d !type2d ('','levsoi','numrad',..etc. ) - integer :: beg1d !subgrid type beginning index - integer :: end1d !subgrid type ending index - integer :: numlev !number of vertical levels in field - logical, pointer :: active(:)!whether each point (patch, column, etc.) is active - real(r8) :: initval !initial value of accumulated field - real(r8), pointer :: val(:,:) !accumulated field - integer :: period !field accumulation period (in model time steps) - - ! In most cases, we could use a 1-d nsteps variable. However, that's awkward within - ! nested loops (with level as the outer loop); also, runaccum can theoretically have - ! different reset points for different levels. - integer, pointer :: nsteps(:,:)!number of steps each point has accumulated, since last reset time - - ! NOTE(wjs, 2017-12-03) We should convert this to fully object-oriented (with - ! inheritance / polymorphism). For now, in the interest of time, I'm going with a - ! semi-object-oriented solution of using procedure pointers. - procedure(extract_accum_field_interface), pointer :: extract_accum_field_func - procedure(update_accum_field_interface) , pointer :: update_accum_field_func - end type accum_field - - abstract interface - subroutine extract_accum_field_interface(this, level, nstep, field) - use shr_kind_mod, only: r8 => shr_kind_r8 - import :: accum_field - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to extract (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(inout) :: field(:) ! field values for current time step - end subroutine extract_accum_field_interface - - subroutine update_accum_field_interface(this, level, nstep, field) - use shr_kind_mod, only: r8 => shr_kind_r8 - import :: accum_field - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to update (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(in) :: field(:) ! field values for current time step - end subroutine update_accum_field_interface - end interface - - real(r8), parameter, public :: accumResetVal = -99999._r8 ! used to do an annual reset ( put in for bug 1858) - - integer, parameter :: ACCTYPE_TIMEAVG = 1 - integer, parameter :: ACCTYPE_RUNMEAN = 2 - integer, parameter :: ACCTYPE_RUNACCUM = 3 - - integer, parameter :: max_accum = 100 !maximum number of accumulated fields - type (accum_field) :: accum(max_accum) !array accumulated fields - integer :: naccflds = 0 !accumulator field counter - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine init_accum_field (name, units, desc, & - accum_type, accum_period, numlev, subgrid_type, init_value, type2d) - ! - ! !DESCRIPTION: - ! Initialize accumulation fields. This subroutine sets: - ! o name of accumulated field - ! o units of accumulated field - ! o accumulation type of accumulated field - ! o description of accumulated fields: accdes - ! o accumulation period for accumulated field (in iterations) - ! o initial value of accumulated field - ! - ! Note about initial value: This must be 0 for a timeavg or runaccum field. For a - ! runmean field, initializing to a non-zero value often won't accomplish anything, but - ! can be used to start with a reasonable value in situations such as: (1) the field is - ! extracted before the first update call; (2) edge case situations such as doing a - ! branch run from a restart file that did not contain this field (though it's - ! possible that init_value doesn't matter even in this case). - ! - ! !USES: - use shr_const_mod, only: SHR_CONST_CDAY - use clm_time_manager, only : get_step_size - use decompMod, only : get_proc_bounds - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - character(len=*), intent(in) :: units !field units - character(len=*), intent(in) :: desc !field description - character(len=*), intent(in) :: accum_type !field type: timeavg, runmean, runaccum - integer , intent(in) :: accum_period !field accumulation period - character(len=*), intent(in) :: subgrid_type !["gridcell","landunit","column" or "patch"] - integer , intent(in) :: numlev !number of vertical levels - real(r8), intent(in) :: init_value !field initial or reset value - character(len=*), intent(in), optional :: type2d !level type (optional) - needed if numlev > 1 - ! - ! !LOCAL VARIABLES: - integer :: nf ! field index - integer :: beg1d,end1d ! beggining and end subgrid indices - integer :: begp, endp ! per-proc beginning and ending patch indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: begCohort, endCohort ! per-proc beg end cohort indices - !------------------------------------------------------------------------ - - ! Determine necessary indices - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp, & - begCohort, endCohort ) - - ! update field index - ! Consistency check that number of accumulated does not exceed maximum. - - naccflds = naccflds + 1 - if (naccflds > max_accum) then - write(iulog,*) 'ACCUMULINIT error: user-defined accumulation fields ', & - 'equal to ',naccflds,' exceeds max_accum' - call shr_sys_abort() - end if - nf = naccflds - - select case (trim(accum_type)) - case ('timeavg') - accum(nf)%acctype = ACCTYPE_TIMEAVG - accum(nf)%extract_accum_field_func => extract_accum_field_timeavg - accum(nf)%update_accum_field_func => update_accum_field_timeavg - case ('runmean') - accum(nf)%acctype = ACCTYPE_RUNMEAN - accum(nf)%extract_accum_field_func => extract_accum_field_basic - accum(nf)%update_accum_field_func => update_accum_field_runmean - case ('runaccum') - accum(nf)%acctype = ACCTYPE_RUNACCUM - accum(nf)%extract_accum_field_func => extract_accum_field_basic - accum(nf)%update_accum_field_func => update_accum_field_runaccum - case default - write(iulog,*) 'init_accum_field ERROR: unknown accum_type ', accum_type - call shr_sys_abort('init_accum_field: unknown accum_type') - end select - - accum(nf)%name = trim(name) - accum(nf)%units = trim(units) - accum(nf)%desc = trim(desc) - accum(nf)%initval = init_value - - ! Note accumulation period must be converted from days - ! to number of iterations - accum(nf)%period = accum_period - if (accum(nf)%period < 0) then - accum(nf)%period = -accum(nf)%period * nint(SHR_CONST_CDAY) / get_step_size() - end if - - select case (trim(subgrid_type)) - case ('gridcell') - beg1d = begg - end1d = endg - accum(nf)%active => grc%active - case ('landunit') - beg1d = begl - end1d = endl - accum(nf)%active => lun%active - case ('column') - beg1d = begc - end1d = endc - accum(nf)%active => col%active - case ('pft') - beg1d = begp - end1d = endp - accum(nf)%active => patch%active - case default - write(iulog,*)'init_accum_field: unknown subgrid type ',subgrid_type - call shr_sys_abort () - end select - - accum(nf)%type1d = trim(subgrid_type) - accum(nf)%beg1d = beg1d - accum(nf)%end1d = end1d - accum(nf)%numlev = numlev - - if (present(type2d)) then - accum(nf)%type2d = type2d - else - accum(nf)%type2d = ' ' - end if - - ! Allocate and initialize accumulation field - - allocate(accum(nf)%val(beg1d:end1d,numlev)) - if (accum(nf)%acctype == ACCTYPE_TIMEAVG .or. & - accum(nf)%acctype == ACCTYPE_RUNACCUM) then - if (init_value /= 0._r8) then - write(iulog,*) 'init_accum_field ERROR: for field ', trim(name) - write(iulog,*) 'init_value must be 0 for timeavg and runaccum fields' - call shr_sys_abort('init_accum_field: init_value must be 0 for timeavg and runaccum fields') - end if - end if - accum(nf)%val(beg1d:end1d,1:numlev) = init_value - - allocate(accum(nf)%nsteps(beg1d:end1d,numlev)) - accum(nf)%nsteps(beg1d:end1d,1:numlev) = 0 - - end subroutine init_accum_field - - !------------------------------------------------------------------------ - subroutine print_accum_fields() - ! - ! !DESCRIPTION: - ! Diagnostic printout of accumulated fields - ! - ! !USES: - use spmdMod, only : masterproc - ! - ! !ARGUMENTS: - implicit none - ! - integer :: i,nf !indices - !------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*) - write(iulog,*) 'Initializing variables for time accumulation .....' - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) 'Accumulated fields' - write(iulog,1002) - write(iulog,'(72a1)') ("_",i=1,71) - do nf = 1, naccflds - if (accum(nf)%period /= huge(1)) then - write(iulog,1003) nf,accum(nf)%name,accum(nf)%units,& - acctype_to_string(accum(nf)%acctype), & - accum(nf)%period, accum(nf)%initval, & - accum(nf)%desc - else - write(iulog,1004) nf,accum(nf)%name,accum(nf)%units,& - acctype_to_string(accum(nf)%acctype), & - accum(nf)%initval, accum(nf)%desc - endif - end do - write(iulog,'(72a1)') ("_",i=1,71) - write(iulog,*) - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) 'Successfully initialized variables for accumulation' - write(iulog,*) - endif - -1002 format(' No',' Name ',' Units ',' Type ','Period',' Inival',' Description') -1003 format((1x,i2),(1x,a8),(1x,a8),(1x,a8), (1x,i5),(1x,f4.0),(1x,a40)) -1004 format((1x,i2),(1x,a8),(1x,a8),(1x,a8),' N.A.',(1x,f4.0),(1x,a40)) - - end subroutine print_accum_fields - - !------------------------------------------------------------------------ - subroutine extract_accum_field_sl (name, field, nstep) - ! - ! !DESCRIPTION: - ! Extract single-level accumulated field. - ! This routine extracts the field values from the multi-level - ! accumulation field. It extracts the current value except if - ! the field type is a time average. In this case, an absurd value - ! is assigned to indicate the time average is not yet valid. - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:) :: field !field values for current time step - integer , intent(in) :: nstep !timestep index - ! - ! !LOCAL VARIABLES: - integer :: nf ! field index - integer :: numlev ! number of vertical levels - - character(len=*), parameter :: subname = 'extract_accum_field_sl' - !------------------------------------------------------------------------ - - call find_field(field_name=name, caller_name=subname, field_index=nf) - - numlev = accum(nf)%numlev - SHR_ASSERT(numlev == 1, errMsg(sourcefile, __LINE__)) - - call accum(nf)%extract_accum_field_func( & - level = 1, & - nstep = nstep, & - field = field) - - end subroutine extract_accum_field_sl - - !------------------------------------------------------------------------ - subroutine extract_accum_field_ml (name, field, nstep) - ! - ! !DESCRIPTION: - ! Extract mutli-level accumulated field. - ! This routine extracts the field values from the multi-level - ! accumulation field. It extracts the current value except if - ! the field type is a time average. In this case, an absurd value - ! is assigned to indicate the time average is not yet valid. - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:,:) :: field !field values for current time step - integer, intent(in) :: nstep !timestep index - ! - ! !LOCAL VARIABLES: - integer :: j,nf !indices - integer :: numlev !number of vertical levels - - character(len=*), parameter :: subname = 'extract_accum_field_ml' - !------------------------------------------------------------------------ - - call find_field(field_name=name, caller_name=subname, field_index=nf) - - numlev = accum(nf)%numlev - SHR_ASSERT((size(field, 2) == numlev), errMsg(sourcefile, __LINE__)) - - do j = 1,numlev - call accum(nf)%extract_accum_field_func( & - level = j, & - nstep = nstep, & - field = field(:,j)) - end do - - end subroutine extract_accum_field_ml - - !----------------------------------------------------------------------- - subroutine extract_accum_field_basic(this, level, nstep, field) - ! !DESCRIPTION: - ! Extract values for one level of the given field - ! - ! !ARGUMENTS: - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to extract (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(inout) :: field(:) ! field values for current time step - ! - ! !LOCAL VARIABLES: - integer :: begi,endi !subgrid beginning,ending indices - integer :: k, kf - - character(len=*), parameter :: subname = 'extract_accum_field_basic' - !----------------------------------------------------------------------- - - begi = this%beg1d - endi = this%end1d - SHR_ASSERT((size(field) == endi-begi+1), errMsg(sourcefile, __LINE__)) - - do k = begi, endi - kf = k - begi + 1 - field(kf) = this%val(k,level) - end do - - end subroutine extract_accum_field_basic - - !----------------------------------------------------------------------- - subroutine extract_accum_field_timeavg(this, level, nstep, field) - ! !DESCRIPTION: - ! Extract values for one level of the given timeavg field - ! - ! !ARGUMENTS: - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to extract (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(inout) :: field(:) ! field values for current time step - ! - ! !LOCAL VARIABLES: - integer :: begi,endi !subgrid beginning,ending indices - integer :: k, kf - - character(len=*), parameter :: subname = 'extract_accum_field_basic' - !----------------------------------------------------------------------- - - begi = this%beg1d - endi = this%end1d - SHR_ASSERT((size(field) == endi-begi+1), errMsg(sourcefile, __LINE__)) - - if (mod(nstep,this%period) == 0) then - do k = begi, endi - kf = k - begi + 1 - field(kf) = this%val(k,level) - end do - else - do k = begi, endi - kf = k - begi + 1 - field(kf) = spval - end do - end if - - end subroutine extract_accum_field_timeavg - - !------------------------------------------------------------------------ - subroutine update_accum_field_sl (name, field, nstep) - ! - ! !DESCRIPTION: - ! Accumulate single level field over specified time interval. - ! The appropriate field is accumulated in the array [accval]. - ! - ! Values of 'field' are ignored in inactive points, so it's safe for 'field' to - ! contain garbage in inactive points. - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:) :: field !field values for current time step - integer , intent(in) :: nstep !time step index - ! - ! !LOCAL VARIABLES: - integer :: nf ! field index - integer :: numlev ! number of vertical levels - - character(len=*), parameter :: subname = 'update_accum_field_sl' - !------------------------------------------------------------------------ - - call find_field(field_name=name, caller_name=subname, field_index=nf) - - numlev = accum(nf)%numlev - SHR_ASSERT(numlev == 1, errMsg(sourcefile, __LINE__)) - - call accum(nf)%update_accum_field_func( & - level = 1, & - nstep = nstep, & - field = field) - - end subroutine update_accum_field_sl - - !------------------------------------------------------------------------ - subroutine update_accum_field_ml (name, field, nstep) - ! - ! !DESCRIPTION: - ! Accumulate multi level field over specified time interval. - ! - ! Values of 'field' are ignored in inactive points, so it's safe for 'field' to - ! contain garbage in inactive points. - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:,:) :: field !field values for current time step - integer , intent(in) :: nstep !time step index - ! - ! !LOCAL VARIABLES: - integer :: j,nf !indices - integer :: numlev !number of vertical levels - - character(len=*), parameter :: subname = 'update_accum_field_ml' - !------------------------------------------------------------------------ - - call find_field(field_name=name, caller_name=subname, field_index=nf) - - numlev = accum(nf)%numlev - SHR_ASSERT((size(field, 2) == numlev), errMsg(sourcefile, __LINE__)) - - do j = 1,numlev - call accum(nf)%update_accum_field_func( & - level = j, & - nstep = nstep, & - field = field(:,j)) - end do - - end subroutine update_accum_field_ml - - !----------------------------------------------------------------------- - subroutine update_accum_field_timeavg(this, level, nstep, field) - ! - ! !DESCRIPTION: - ! Update values for one level of the given timeavg field - ! - ! !ARGUMENTS: - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to update (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(in) :: field(:) ! field values for current time step - ! - ! !LOCAL VARIABLES: - integer :: begi,endi !subgrid beginning,ending indices - integer :: k, kf - - character(len=*), parameter :: subname = 'update_accum_field_timeavg' - !----------------------------------------------------------------------- - - begi = this%beg1d - endi = this%end1d - SHR_ASSERT((size(field) == endi-begi+1), errMsg(sourcefile, __LINE__)) - - ! time average field: reset every accumulation period; normalize at end of - ! accumulation period - - if ((mod(nstep,this%period) == 1 .or. this%period == 1) .and. (nstep /= 0))then - do k = begi,endi - if (this%active(k)) then - this%val(k,level) = 0._r8 - this%nsteps(k,level) = 0 - end if - end do - end if - - do k = begi,endi - if (this%active(k)) then - kf = k - begi + 1 - this%val(k,level) = this%val(k,level) + field(kf) - this%nsteps(k,level) = this%nsteps(k,level) + 1 - end if - end do - - if (mod(nstep,this%period) == 0) then - do k = begi,endi - if (this%active(k)) then - this%val(k,level) = this%val(k,level) / this%nsteps(k,level) - end if - end do - end if - - end subroutine update_accum_field_timeavg - - !----------------------------------------------------------------------- - subroutine update_accum_field_runmean(this, level, nstep, field) - ! - ! !DESCRIPTION: - ! Update values for one level of the given runmean field - ! - ! !ARGUMENTS: - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to update (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(in) :: field(:) ! field values for current time step - ! - ! !LOCAL VARIABLES: - integer :: begi,endi !subgrid beginning,ending indices - integer :: k, kf - integer :: accper ! accumulation period - - character(len=*), parameter :: subname = 'update_accum_field_runmean' - !----------------------------------------------------------------------- - - begi = this%beg1d - endi = this%end1d - SHR_ASSERT((size(field) == endi-begi+1), errMsg(sourcefile, __LINE__)) - - do k = begi,endi - if (this%active(k)) then - kf = k - begi + 1 - this%nsteps(k,level) = this%nsteps(k,level) + 1 - ! Cap nsteps at 'period' - partly to avoid overflow, but also because it doesn't - ! help us to accumulate nsteps beyond a value of 'period' (because nsteps is - ! just used to determine accper, and accper needs to be capped at 'period'). A - ! side-benefit of this capping of nsteps is that accper (the accumulation - ! period) is always equal to nsteps. - this%nsteps(k,level) = min(this%nsteps(k,level), this%period) - accper = this%nsteps(k,level) - this%val(k,level) = & - ((accper-1)*this%val(k,level) + field(kf)) / accper - end if - end do - - end subroutine update_accum_field_runmean - - !----------------------------------------------------------------------- - subroutine update_accum_field_runaccum(this, level, nstep, field) - ! - ! !DESCRIPTION: - ! Update values for one level of the given runaccum field - ! - ! !ARGUMENTS: - class(accum_field), intent(in) :: this - integer, intent(in) :: level ! level index to update (1 for a 1-d field) - integer, intent(in) :: nstep ! timestep index - real(r8), intent(in) :: field(:) ! field values for current time step - ! - ! !LOCAL VARIABLES: - integer :: begi,endi !subgrid beginning,ending indices - integer :: k, kf - - character(len=*), parameter :: subname = 'update_accum_field_runaccum' - !----------------------------------------------------------------------- - - begi = this%beg1d - endi = this%end1d - SHR_ASSERT((size(field) == endi-begi+1), errMsg(sourcefile, __LINE__)) - - !running accumulation field; reset at trigger -99999 - - do k = begi,endi - if (this%active(k)) then - kf = k - begi + 1 - if (nint(field(kf)) == -99999) then - this%val(k,level) = 0._r8 - this%nsteps(k,level) = 0 - else - this%val(k,level) = & - min(max(this%val(k,level) + field(kf), 0._r8), 99999._r8) - this%nsteps(k,level) = this%nsteps(k,level) + 1 - end if - end if - end do - - end subroutine update_accum_field_runaccum - - - !------------------------------------------------------------------------ - subroutine accumulRest( ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write accumulation restart data - ! - ! !USES: - use restUtilMod , only : restartvar - use ncdio_pio , only : file_desc_t, ncd_double, ncd_int - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid !netcdf unit - character(len=*) , intent(in) :: flag !'define','read', or 'write' - ! - ! !LOCAL VARIABLES: - integer :: nf ! indices - logical :: readvar ! determine if variable is on initial file - character(len=128) :: varname ! temporary - character(len= 32) :: subname='AccumRest' ! subroutine name - !------------------------------------------------------------------------ - - do nf = 1,naccflds - - varname = trim(accum(nf)%name) // '_VALUE' - if (accum(nf)%numlev == 1) then - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name=accum(nf)%type1d, & - long_name=accum(nf)%desc, units=accum(nf)%units, & - interpinic_flag='interp', & - data=accum(nf)%val, readvar=readvar) - else - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name=accum(nf)%type1d, dim2name=accum(nf)%type2d, & - long_name=accum(nf)%desc, units=accum(nf)%units, & - interpinic_flag='interp', & - data=accum(nf)%val, readvar=readvar) - end if - - varname = trim(accum(nf)%name) // '_NSTEPS' - if (accum(nf)%numlev == 1) then - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_int, & - dim1name=accum(nf)%type1d, & - long_name='number of accumulated steps for '//trim(accum(nf)%name), & - units='-', & - interpinic_flag='interp', & - data=accum(nf)%nsteps, readvar=readvar) - else - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_int, & - dim1name=accum(nf)%type1d, dim2name=accum(nf)%type2d, & - long_name='number of accumulated steps for '//trim(accum(nf)%name), & - units='-', & - interpinic_flag='interp', & - data=accum(nf)%nsteps, readvar=readvar) - end if - - varname = trim(accum(nf)%name) // '_PERIOD' - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_int, & - long_name='', units='time steps', & - imissing_value=ispval, ifill_value=huge(1), & - interpinic_flag='copy', & - data=accum(nf)%period, readvar=readvar) - - end do - - end subroutine accumulRest - - !----------------------------------------------------------------------- - subroutine clean_accum_fields - ! - ! !DESCRIPTION: - ! Deallocate space and reset accum fields list - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'clean_accum_fields' - !----------------------------------------------------------------------- - - do i = 1, naccflds - if (associated(accum(i)%val)) then - deallocate(accum(i)%val) - end if - if (associated(accum(i)%nsteps)) then - deallocate(accum(i)%nsteps) - end if - end do - - naccflds = 0 - - end subroutine clean_accum_fields - - - !----------------------------------------------------------------------- - subroutine find_field(field_name, caller_name, field_index) - ! - ! !DESCRIPTION: - ! Find field index given field name - ! - ! Aborts if the given field name isn't found - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: field_name ! field name to find - character(len=*), intent(in) :: caller_name ! name of calling routine (for more informative error messages) - integer , intent(out) :: field_index ! index of given field in accum array - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'find_field' - !----------------------------------------------------------------------- - - field_index = 0 - do i = 1, naccflds - if (field_name == accum(i)%name) then - field_index = i - exit - end if - end do - if (field_index == 0) then - write(iulog,*) trim(caller_name), 'ERROR: field name ',trim(field_name),' not found' - call endrun('Accumulation field not found') - end if - - end subroutine find_field - - - !----------------------------------------------------------------------- - pure function acctype_to_string(acctype) result(acctype_str) - ! - ! !DESCRIPTION: - ! Return a string representation of an ACCTYPE parameter - ! - ! !ARGUMENTS: - character(len=32) :: acctype_str ! function result - integer, intent(in) :: acctype - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'acctype_to_string' - !----------------------------------------------------------------------- - - select case (acctype) - case (ACCTYPE_TIMEAVG) - acctype_str = 'timeavg' - case (ACCTYPE_RUNMEAN) - acctype_str = 'runmean' - case (ACCTYPE_RUNACCUM) - acctype_str = 'runaccum' - case default - acctype_str = 'unknown' - end select - - end function acctype_to_string - - -end module accumulMod diff --git a/src/main/atm2lndMod.F90 b/src/main/atm2lndMod.F90 deleted file mode 100644 index c54ddcd12a..0000000000 --- a/src/main/atm2lndMod.F90 +++ /dev/null @@ -1,682 +0,0 @@ -module atm2lndMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle atm2lnd forcing - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. - use clm_varcon , only : rair, grav, cpair, hfus, tfrz, denh2o, spval - use clm_varcon , only : wv_to_dair_weight_ratio - use clm_varctl , only : iulog, use_c13, use_cn, use_lch4, iulog - use abortutils , only : endrun - use decompMod , only : bounds_type - use atm2lndType , only : atm2lnd_type - use TopoMod , only : topo_type - use filterColMod , only : filter_col_type - use LandunitType , only : lun - use ColumnType , only : col - use landunit_varcon, only : istice_mec - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: downscale_forcings ! Downscale atm forcing fields from gridcell to column - - ! The following routines are public for the sake of unit testing; they should not be - ! called by production code outside this module - public :: partition_precip ! Partition precipitation into rain/snow - public :: sens_heat_from_precip_conversion ! Compute sensible heat flux needed to compensate for rain-snow conversion - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: rhos ! calculate atmospheric density - private :: repartition_rain_snow_one_col ! Re-partition precipitation for a single column - private :: downscale_longwave ! Downscale longwave radiation from gridcell to column - private :: build_normalization ! Compute normalization factors so that downscaled fields are conservative - private :: check_downscale_consistency ! Check consistency of downscaling - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine downscale_forcings(bounds, & - topo_inst, atm2lnd_inst, eflx_sh_precip_conversion) - ! - ! !DESCRIPTION: - ! Downscale atmospheric forcing fields from gridcell to column. - ! - ! Downscaling is done based on the difference between each CLM column's elevation and - ! the atmosphere's surface elevation (which is the elevation at which the atmospheric - ! forcings are valid). - ! - ! Note that the downscaling procedure can result in changes in grid cell mean values - ! compared to what was provided by the atmosphere. We conserve fluxes of mass and - ! energy, but allow states such as temperature to differ. - ! - ! For most variables, downscaling is done over columns defined by - ! topo_inst%DownscaleFilterc. But we also do direct copies of gridcell-level forcings - ! into column-level forcings over all other active columns. In addition, precipitation - ! (rain vs. snow partitioning) is adjusted everywhere. - ! - ! !USES: - use clm_varcon , only : rair, cpair, grav - use QsatMod , only : Qsat - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - class(topo_type) , intent(in) :: topo_inst - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - real(r8) , intent(out) :: eflx_sh_precip_conversion(bounds%begc:) ! sensible heat flux from precipitation conversion (W/m**2) [+ to atm] - ! - ! !LOCAL VARIABLES: - integer :: g, l, c, fc ! indices - integer :: clo, cc - type(filter_col_type) :: downscale_filter_c - - ! temporaries for topo downscaling - real(r8) :: hsurf_g,hsurf_c - real(r8) :: Hbot, zbot - real(r8) :: tbot_g, pbot_g, thbot_g, qbot_g, qs_g, es_g, rhos_g - real(r8) :: tbot_c, pbot_c, thbot_c, qbot_c, qs_c, es_c, rhos_c - real(r8) :: rhos_c_estimate, rhos_g_estimate - real(r8) :: dum1, dum2 - - character(len=*), parameter :: subname = 'downscale_forcings' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(eflx_sh_precip_conversion) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate(& - ! Parameters: - lapse_rate => atm2lnd_inst%params%lapse_rate , & ! Input: [real(r8)] Surface temperature lapse rate (K m-1) - - ! Gridcell-level metadata: - forc_topo_g => atm2lnd_inst%forc_topo_grc , & ! Input: [real(r8) (:)] atmospheric surface height (m) - - ! Column-level metadata: - topo_c => topo_inst%topo_col , & ! Input: [real(r8) (:)] column surface height (m) - - ! Gridcell-level non-downscaled fields: - forc_t_g => atm2lnd_inst%forc_t_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_g => atm2lnd_inst%forc_th_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_g => atm2lnd_inst%forc_q_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_g => atm2lnd_inst%forc_pbot_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_g => atm2lnd_inst%forc_rho_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric density (kg/m**3) - - ! Column-level downscaled fields: - forc_t_c => atm2lnd_inst%forc_t_downscaled_col , & ! Output: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_c => atm2lnd_inst%forc_th_downscaled_col , & ! Output: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_c => atm2lnd_inst%forc_q_downscaled_col , & ! Output: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_c => atm2lnd_inst%forc_pbot_downscaled_col , & ! Output: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_c => atm2lnd_inst%forc_rho_downscaled_col & ! Output: [real(r8) (:)] atmospheric density (kg/m**3) - ) - - ! Initialize column forcing (needs to be done for ALL active columns) - do c = bounds%begc,bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - - forc_t_c(c) = forc_t_g(g) - forc_th_c(c) = forc_th_g(g) - forc_q_c(c) = forc_q_g(g) - forc_pbot_c(c) = forc_pbot_g(g) - forc_rho_c(c) = forc_rho_g(g) - end if - end do - - downscale_filter_c = topo_inst%DownscaleFilterc(bounds) - - ! Downscale forc_t, forc_th, forc_q, forc_pbot, and forc_rho to columns. - ! For glacier_mec columns the downscaling is based on surface elevation. - ! For other columns the downscaling is a simple copy (above). - do fc = 1, downscale_filter_c%num - c = downscale_filter_c%indices(fc) - l = col%landunit(c) - g = col%gridcell(c) - - ! This is a simple downscaling procedure - ! Note that forc_hgt, forc_u, and forc_v are not downscaled. - - hsurf_g = forc_topo_g(g) ! gridcell sfc elevation - hsurf_c = topo_c(c) ! column sfc elevation - tbot_g = forc_t_g(g) ! atm sfc temp - thbot_g = forc_th_g(g) ! atm sfc pot temp - qbot_g = forc_q_g(g) ! atm sfc spec humid - pbot_g = forc_pbot_g(g) ! atm sfc pressure - rhos_g = forc_rho_g(g) ! atm density - zbot = atm2lnd_inst%forc_hgt_grc(g) ! atm ref height - tbot_c = tbot_g-lapse_rate*(hsurf_c-hsurf_g) ! sfc temp for column - Hbot = rair*0.5_r8*(tbot_g+tbot_c)/grav ! scale ht at avg temp - pbot_c = pbot_g*exp(-(hsurf_c-hsurf_g)/Hbot) ! column sfc press - - ! Derivation of potential temperature calculation: - ! - ! The textbook definition would be: - ! thbot_c = tbot_c * (p0/pbot_c)^(rair/cpair) - ! - ! Note that pressure is related to scale height as: - ! pbot_c = p0 * exp(-zbot/H) - ! - ! Using Hbot in place of H, we get: - ! pbot_c = p0 * exp(-zbot/Hbot) - ! - ! Plugging this in to the textbook definition, then manipulating, we get: - ! thbot_c = tbot_c * (p0/(p0*exp(-zbot/Hbot)))^(rair/cpair) - ! = tbot_c * (1/exp(-zbot/Hbot))^(rair/cpair) - ! = tbot_c * (exp(zbot/Hbot))^(rair/cpair) - ! = tbot_c * exp((zbot/Hbot) * (rair/cpair)) - ! - ! But we want everything expressed in delta form, resulting in: - ! thbot_c = thbot_g + (tbot_c - tbot_g)*exp((zbot/Hbot)*(rair/cpair)) - - thbot_c= thbot_g + (tbot_c - tbot_g)*exp((zbot/Hbot)*(rair/cpair)) ! pot temp calc - - call Qsat(tbot_g,pbot_g,es_g,dum1,qs_g,dum2) - call Qsat(tbot_c,pbot_c,es_c,dum1,qs_c,dum2) - - qbot_c = qbot_g*(qs_c/qs_g) - - ! For forc_rho_c: We could simply set: - ! - ! rhos_c = rhos(pbot_c, egcm_c, tbot_c) - ! - ! However, we want forc_rho_c to be identical to forc_rho_g when topo_c equals - ! forc_topo_g. So we compute our own version of forc_rho_g using the rhos - ! function, and then multiply forc_rho_g by the ratio of (computed column-level - ! rho) to (computed gridcell-level rho). - rhos_c_estimate = rhos(qbot=qbot_c, pbot=pbot_c, tbot=tbot_c) - rhos_g_estimate = rhos(qbot=qbot_g, pbot=pbot_g, tbot=tbot_g) - rhos_c = rhos_g * (rhos_c_estimate / rhos_g_estimate) - - forc_t_c(c) = tbot_c - forc_th_c(c) = thbot_c - forc_q_c(c) = qbot_c - forc_pbot_c(c) = pbot_c - forc_rho_c(c) = rhos_c - - end do - - call partition_precip(bounds, atm2lnd_inst, & - eflx_sh_precip_conversion(bounds%begc:bounds%endc)) - - call downscale_longwave(bounds, downscale_filter_c, topo_inst, atm2lnd_inst) - - call check_downscale_consistency(bounds, atm2lnd_inst) - - end associate - - end subroutine downscale_forcings - - !----------------------------------------------------------------------- - pure function rhos(qbot, pbot, tbot) - ! - ! !DESCRIPTION: - ! Compute atmospheric density (kg/m**3) - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8) :: rhos ! function result: atmospheric density (kg/m**3) - real(r8), intent(in) :: qbot ! atmospheric specific humidity (kg/kg) - real(r8), intent(in) :: pbot ! atmospheric pressure (Pa) - real(r8), intent(in) :: tbot ! atmospheric temperature (K) - ! - ! !LOCAL VARIABLES: - real(r8) :: egcm - - character(len=*), parameter :: subname = 'rhos' - !----------------------------------------------------------------------- - - egcm = qbot*pbot / & - (wv_to_dair_weight_ratio + (1._r8 - wv_to_dair_weight_ratio)*qbot) - rhos = (pbot - (1._r8 - wv_to_dair_weight_ratio)*egcm) / (rair*tbot) - - end function rhos - - !----------------------------------------------------------------------- - subroutine partition_precip(bounds, atm2lnd_inst, eflx_sh_precip_conversion) - ! - ! !DESCRIPTION: - ! Partition precipitation into rain/snow based on temperature. - ! - ! Note that, unlike the other downscalings done here, this is currently applied over - ! all points - not just those within the downscale filter. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - real(r8), intent(inout) :: eflx_sh_precip_conversion(bounds%begc:) ! sensible heat flux from precipitation conversion (W/m**2) [+ to atm] - ! - ! !LOCAL VARIABLES: - integer :: c,l,g ! indices - real(r8) :: rain_old ! rain before conversion - real(r8) :: snow_old ! snow before conversion - real(r8) :: all_snow_t ! temperature at which all precip falls as snow (K) - real(r8) :: frac_rain_slope ! slope of the frac_rain vs. temperature relationship - - character(len=*), parameter :: subname = 'partition_precip' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(eflx_sh_precip_conversion) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - associate(& - ! Gridcell-level non-downscaled fields: - forc_rain_g => atm2lnd_inst%forc_rain_not_downscaled_grc , & ! Input: [real(r8) (:)] rain rate [mm/s] - forc_snow_g => atm2lnd_inst%forc_snow_not_downscaled_grc , & ! Input: [real(r8) (:)] snow rate [mm/s] - - ! Column-level downscaled fields: - forc_t_c => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_rain_c => atm2lnd_inst%forc_rain_downscaled_col , & ! Output: [real(r8) (:)] rain rate [mm/s] - forc_snow_c => atm2lnd_inst%forc_snow_downscaled_col & ! Output: [real(r8) (:)] snow rate [mm/s] - ) - - ! Initialize column forcing - do c = bounds%begc,bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - forc_rain_c(c) = forc_rain_g(g) - forc_snow_c(c) = forc_snow_g(g) - eflx_sh_precip_conversion(c) = 0._r8 - end if - end do - - ! Optionally, convert rain to snow or vice versa based on forc_t_c - if (atm2lnd_inst%params%repartition_rain_snow) then - do c = bounds%begc, bounds%endc - if (col%active(c)) then - l = col%landunit(c) - rain_old = forc_rain_c(c) - snow_old = forc_snow_c(c) - if (lun%itype(l) == istice_mec) then - all_snow_t = atm2lnd_inst%params%precip_repartition_glc_all_snow_t - frac_rain_slope = atm2lnd_inst%params%precip_repartition_glc_frac_rain_slope - else - all_snow_t = atm2lnd_inst%params%precip_repartition_nonglc_all_snow_t - frac_rain_slope = atm2lnd_inst%params%precip_repartition_nonglc_frac_rain_slope - end if - call repartition_rain_snow_one_col(& - temperature = forc_t_c(c), & - all_snow_t = all_snow_t, & - frac_rain_slope = frac_rain_slope, & - rain = forc_rain_c(c), & - snow = forc_snow_c(c)) - call sens_heat_from_precip_conversion(& - rain_old = rain_old, & - snow_old = snow_old, & - rain_new = forc_rain_c(c), & - snow_new = forc_snow_c(c), & - sens_heat_flux = eflx_sh_precip_conversion(c)) - end if - end do - end if - - end associate - - end subroutine partition_precip - - !----------------------------------------------------------------------- - subroutine repartition_rain_snow_one_col(temperature, all_snow_t, frac_rain_slope, & - rain, snow) - ! - ! !DESCRIPTION: - ! Re-partition precipitation into rain/snow for a single column. - ! - ! Rain and snow variables should be set initially, and are updated here - ! - ! !ARGUMENTS: - real(r8) , intent(in) :: temperature ! near-surface temperature (K) - real(r8) , intent(in) :: all_snow_t ! temperature at which precip falls entirely as snow (K) - real(r8) , intent(in) :: frac_rain_slope ! slope of the frac_rain vs. T relationship - real(r8) , intent(inout) :: rain ! atm rain rate [mm/s] - real(r8) , intent(inout) :: snow ! atm snow rate [(mm water equivalent)/s] - ! - ! !LOCAL VARIABLES: - real(r8) :: frac_rain ! fraction of precipitation that should become rain - real(r8) :: total_precip - - character(len=*), parameter :: subname = 'repartition_rain_snow_one_col' - !----------------------------------------------------------------------- - - frac_rain = (temperature - all_snow_t) * frac_rain_slope - - ! bound in [0,1] - frac_rain = min(1.0_r8,max(0.0_r8,frac_rain)) - - total_precip = rain + snow - rain = total_precip * frac_rain - snow = total_precip - rain - - end subroutine repartition_rain_snow_one_col - - !----------------------------------------------------------------------- - subroutine sens_heat_from_precip_conversion(rain_old, snow_old, rain_new, snow_new, & - sens_heat_flux) - ! - ! !DESCRIPTION: - ! Given old and new rain and snow amounts, compute the sensible heat flux needed to - ! compensate for the rain-snow conversion. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), intent(in) :: rain_old ! [mm/s] - real(r8), intent(in) :: snow_old ! [(mm water equivalent)/s] - real(r8), intent(in) :: rain_new ! [mm/s] - real(r8), intent(in) :: snow_new ! [(mm water equivalent)/s] - real(r8), intent(out) :: sens_heat_flux ! [W/m^2] - ! - ! !LOCAL VARIABLES: - real(r8) :: total_old - real(r8) :: total_new - real(r8) :: rain_to_snow ! net conversion of rain to snow - - real(r8), parameter :: mm_to_m = 1.e-3_r8 ! multiply by this to convert from mm to m - real(r8), parameter :: tol = 1.e-13_r8 ! relative tolerance for error checks - - character(len=*), parameter :: subname = 'sens_heat_from_precip_conversion' - !----------------------------------------------------------------------- - - total_old = rain_old + snow_old - total_new = rain_new + snow_new - SHR_ASSERT(abs(total_new - total_old) <= (tol * total_old), subname//' ERROR: mismatch between old and new totals') - - ! rain to snow releases energy, so results in a positive heat flux to atm - rain_to_snow = snow_new - snow_old - sens_heat_flux = rain_to_snow * mm_to_m * denh2o * hfus - - end subroutine sens_heat_from_precip_conversion - - - !----------------------------------------------------------------------- - subroutine downscale_longwave(bounds, downscale_filter_c, & - topo_inst, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Downscale longwave radiation from gridcell to column - ! Must be done AFTER temperature downscaling - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(filter_col_type) , intent(in) :: downscale_filter_c - class(topo_type) , intent(in) :: topo_inst - type(atm2lnd_type) , intent(inout) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: c,l,g,fc ! indices - real(r8) :: hsurf_c ! column-level elevation (m) - real(r8) :: hsurf_g ! gridcell-level elevation (m) - - real(r8), dimension(bounds%begg : bounds%endg) :: sum_lwrad_g ! weighted sum of column-level lwrad - real(r8), dimension(bounds%begg : bounds%endg) :: sum_wts_g ! sum of weights that contribute to sum_lwrad_g - real(r8), dimension(bounds%begg : bounds%endg) :: lwrad_norm_g ! normalization factors - real(r8), dimension(bounds%begg : bounds%endg) :: newsum_lwrad_g ! weighted sum of column-level lwrad after normalization - - character(len=*), parameter :: subname = 'downscale_longwave' - !----------------------------------------------------------------------- - - associate(& - ! Parameters: - lapse_rate_longwave => atm2lnd_inst%params%lapse_rate_longwave , & ! Input: [real(r8)] longwave radiation lapse rate (W m-2 m-1) - longwave_downscaling_limit => atm2lnd_inst%params%longwave_downscaling_limit, & ! Input: [real(r8)] Relative limit for how much longwave downscaling can be done (unitless) - - ! Gridcell-level metadata: - forc_topo_g => atm2lnd_inst%forc_topo_grc , & ! Input: [real(r8) (:)] atmospheric surface height (m) - - ! Column-level metadata: - topo_c => topo_inst%topo_col , & ! Input: [real(r8) (:)] column surface height (m) - - ! Gridcell-level fields: - forc_lwrad_g => atm2lnd_inst%forc_lwrad_not_downscaled_grc, & ! Input: [real(r8) (:)] downward longwave (W/m**2) - - ! Column-level (downscaled) fields: - forc_lwrad_c => atm2lnd_inst%forc_lwrad_downscaled_col & ! Output: [real(r8) (:)] downward longwave (W/m**2) - ) - - ! Initialize column forcing (needs to be done for ALL active columns) - do c = bounds%begc, bounds%endc - if (col%active(c)) then - g = col%gridcell(c) - forc_lwrad_c(c) = forc_lwrad_g(g) - end if - end do - - ! Optionally, downscale the longwave radiation, conserving energy - if (atm2lnd_inst%params%glcmec_downscale_longwave) then - - ! Initialize variables related to normalization - do g = bounds%begg, bounds%endg - sum_lwrad_g(g) = 0._r8 - sum_wts_g(g) = 0._r8 - newsum_lwrad_g(g) = 0._r8 - end do - - ! Do the downscaling - do fc = 1, downscale_filter_c%num - c = downscale_filter_c%indices(fc) - l = col%landunit(c) - g = col%gridcell(c) - - hsurf_g = forc_topo_g(g) - hsurf_c = topo_c(c) - - ! Assume a linear decrease in downwelling longwave radiation with increasing - ! elevation, based on Van Tricht et al. (2016, TC) Figure 6, - ! doi:10.5194/tc-10-2379-2016 - forc_lwrad_c(c) = forc_lwrad_g(g) - lapse_rate_longwave * (hsurf_c-hsurf_g) - ! But ensure that we don't depart too far from the atmospheric forcing value: - ! negative values of lwrad are certainly bad, but small positive values might - ! also be bad. We can especially run into trouble due to the normalization: a - ! small lwrad value in one column can lead to a big normalization factor, - ! leading to huge lwrad values in other columns. - forc_lwrad_c(c) = min(forc_lwrad_c(c), & - forc_lwrad_g(g) * (1._r8 + longwave_downscaling_limit)) - forc_lwrad_c(c) = max(forc_lwrad_c(c), & - forc_lwrad_g(g) * (1._r8 - longwave_downscaling_limit)) - - ! Keep track of the gridcell-level weighted sum for later normalization. - ! - ! This gridcell-level weighted sum just includes points for which we do the - ! downscaling (e.g., glc_mec points). Thus the contributing weights - ! generally do not add to 1. So to do the normalization properly, we also - ! need to keep track of the weights that have contributed to this sum. - sum_lwrad_g(g) = sum_lwrad_g(g) + col%wtgcell(c)*forc_lwrad_c(c) - sum_wts_g(g) = sum_wts_g(g) + col%wtgcell(c) - end do - - - ! Normalize forc_lwrad_c(c) to conserve energy - - call build_normalization(orig_field=forc_lwrad_g(bounds%begg:bounds%endg), & - sum_field=sum_lwrad_g(bounds%begg:bounds%endg), & - sum_wts=sum_wts_g(bounds%begg:bounds%endg), & - norms=lwrad_norm_g(bounds%begg:bounds%endg)) - - do fc = 1, downscale_filter_c%num - c = downscale_filter_c%indices(fc) - l = col%landunit(c) - g = col%gridcell(c) - - forc_lwrad_c(c) = forc_lwrad_c(c) * lwrad_norm_g(g) - newsum_lwrad_g(g) = newsum_lwrad_g(g) + col%wtgcell(c)*forc_lwrad_c(c) - end do - - - ! Make sure that, after normalization, the grid cell mean is conserved - - do g = bounds%begg, bounds%endg - if (sum_wts_g(g) > 0._r8) then - if (abs((newsum_lwrad_g(g) / sum_wts_g(g)) - forc_lwrad_g(g)) > 1.e-8_r8) then - write(iulog,*) 'g, newsum_lwrad_g, sum_wts_g, forc_lwrad_g: ', & - g, newsum_lwrad_g(g), sum_wts_g(g), forc_lwrad_g(g) - call endrun(msg=' ERROR: Energy conservation error downscaling longwave'//& - errMsg(sourcefile, __LINE__)) - end if - end if - end do - - end if ! glcmec_downscale_longwave - - end associate - - end subroutine downscale_longwave - - !----------------------------------------------------------------------- - subroutine build_normalization(orig_field, sum_field, sum_wts, norms) - ! - ! !DESCRIPTION: - ! Build an array of normalization factors that can be applied to a downscaled forcing - ! field, in order to force the mean of the new field to be the same as the mean of - ! the old field (for conservation). - ! - ! This allows for the possibility that only a subset of columns are downscaled. Only - ! the columns that are adjusted should be included in the weighted sum, sum_field; - ! sum_wts gives the sum of contributing weights on the grid cell level. - - ! For example, if a grid cell has an original forcing value of 1.0, and contains 4 - ! columns with the following weights on the gridcell, and the following values after - ! normalization: - ! - ! col #: 1 2 3 4 - ! weight: 0.1 0.2 0.3 0.4 - ! downscaled?: yes yes no no - ! value: 0.9 1.1 1.0 1.0 - ! - ! Then we would have: - ! orig_field(g) = 1.0 - ! sum_field(g) = 0.1*0.9 + 0.2*1.1 = 0.31 - ! sum_wts(g) = 0.1 + 0.2 = 0.3 - ! norms(g) = 1.0 / (0.31 / 0.3) = 0.9677 - ! - ! The field can then be normalized as: - ! forc_lwrad_c(c) = forc_lwrad_c(c) * lwrad_norm_g(g) - ! where lwrad_norm_g is the array of norms computed by this routine - - ! - ! !ARGUMENTS: - real(r8), intent(in) :: orig_field(:) ! the original field, at the grid cell level - real(r8), intent(in) :: sum_field(:) ! the new weighted sum across columns (dimensioned by grid cell) - real(r8), intent(in) :: sum_wts(:) ! sum of the weights used to create sum_field (dimensioned by grid cell) - real(r8), intent(out) :: norms(:) ! computed normalization factors - !----------------------------------------------------------------------- - - SHR_ASSERT((size(orig_field) == size(norms)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((size(sum_field) == size(norms)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT((size(sum_wts) == size(norms)), errMsg(sourcefile, __LINE__)) - - where (sum_wts == 0._r8) - ! Avoid divide by zero; if sum_wts is 0, then the normalization doesn't matter, - ! because the adjusted values won't affect the grid cell mean. - norms = 1.0_r8 - - elsewhere (sum_field == 0._r8) - ! Avoid divide by zero. If this is because both sum_field and orig_field are 0, - ! then the normalization doesn't matter. If sum_field == 0 while orig_field /= 0, - ! then we have a problem: no normalization will allow us to recover the original - ! gridcell mean. We should probably catch this and abort, but for now we're - ! relying on error checking in the caller (checking for conservation) to catch - ! this potential problem. - norms = 1.0_r8 - - elsewhere - ! The standard case - norms = orig_field / (sum_field / sum_wts) - - end where - - end subroutine build_normalization - - - !----------------------------------------------------------------------- - subroutine check_downscale_consistency(bounds, atm2lnd_inst) - ! - ! !DESCRIPTION: - ! Check consistency of downscaling - ! - ! Note that this operates over more than just the filter used for the downscaling, - ! because it checks some things outside that filter. - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type), intent(in) :: atm2lnd_inst - ! - ! !LOCAL VARIABLES: - integer :: g, l, c ! indices - character(len=*), parameter :: subname = 'check_downscale_consistency' - !----------------------------------------------------------------------- - - associate(& - ! Gridcell-level fields: - forc_t_g => atm2lnd_inst%forc_t_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_g => atm2lnd_inst%forc_th_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_g => atm2lnd_inst%forc_q_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_g => atm2lnd_inst%forc_pbot_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_g => atm2lnd_inst%forc_rho_not_downscaled_grc , & ! Input: [real(r8) (:)] atmospheric density (kg/m**3) - forc_rain_g => atm2lnd_inst%forc_rain_not_downscaled_grc , & ! Input: [real(r8) (:)] rain rate [mm/s] - forc_snow_g => atm2lnd_inst%forc_snow_not_downscaled_grc , & ! Input: [real(r8) (:)] snow rate [mm/s] - forc_lwrad_g => atm2lnd_inst%forc_lwrad_not_downscaled_grc , & ! Input: [real(r8) (:)] downward longwave (W/m**2) - - ! Column-level (downscaled) fields: - forc_t_c => atm2lnd_inst%forc_t_downscaled_col , & ! Input: [real(r8) (:)] atmospheric temperature (Kelvin) - forc_th_c => atm2lnd_inst%forc_th_downscaled_col , & ! Input: [real(r8) (:)] atmospheric potential temperature (Kelvin) - forc_q_c => atm2lnd_inst%forc_q_downscaled_col , & ! Input: [real(r8) (:)] atmospheric specific humidity (kg/kg) - forc_pbot_c => atm2lnd_inst%forc_pbot_downscaled_col , & ! Input: [real(r8) (:)] atmospheric pressure (Pa) - forc_rho_c => atm2lnd_inst%forc_rho_downscaled_col , & ! Input: [real(r8) (:)] atmospheric density (kg/m**3) - forc_rain_c => atm2lnd_inst%forc_rain_downscaled_col , & ! Input: [real(r8) (:)] rain rate [mm/s] - forc_snow_c => atm2lnd_inst%forc_snow_downscaled_col , & ! Input: [real(r8) (:)] snow rate [mm/s] - forc_lwrad_c => atm2lnd_inst%forc_lwrad_downscaled_col & ! Input: [real(r8) (:)] downward longwave (W/m**2) - ) - - ! BUG(wjs, 2016-11-15, bugz 2377) - ! - ! Make sure that, for urban points, the column-level forcing fields are identical to - ! the gridcell-level forcing fields. This is needed because the urban-specific code - ! sometimes uses the gridcell-level forcing fields (and it would take a large - ! refactor to change this to use column-level fields). - ! - ! However, do NOT check rain & snow: these ARE downscaled for urban points (as for - ! all other points), and the urban code does not refer to the gridcell-level versions - ! of these fields. - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - l = col%landunit(c) - g = col%gridcell(c) - - if (lun%urbpoi(l)) then - if (forc_t_c(c) /= forc_t_g(g) .or. & - forc_th_c(c) /= forc_th_g(g) .or. & - forc_q_c(c) /= forc_q_g(g) .or. & - forc_pbot_c(c) /= forc_pbot_g(g) .or. & - forc_rho_c(c) /= forc_rho_g(g) .or. & - forc_lwrad_c(c) /= forc_lwrad_g(g)) then - write(iulog,*) subname//' ERROR: column-level forcing differs from gridcell-level forcing for urban point' - write(iulog,*) 'c, g = ', c, g - write(iulog,*) 'forc_t_c, forc_t_g = ', forc_t_c(c), forc_t_g(g) - write(iulog,*) 'forc_th_c, forc_th_g = ', forc_th_c(c), forc_th_g(g) - write(iulog,*) 'forc_q_c, forc_q_g = ', forc_q_c(c), forc_q_g(g) - write(iulog,*) 'forc_pbot_c, forc_pbot_g = ', forc_pbot_c(c), forc_pbot_g(g) - write(iulog,*) 'forc_rho_c, forc_rho_g = ', forc_rho_c(c), forc_rho_g(g) - write(iulog,*) 'forc_lwrad_c, forc_lwrad_g = ', forc_lwrad_c(c), forc_lwrad_g(g) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if ! inequal - end if ! urbpoi - end if ! active - end do - - end associate - - end subroutine check_downscale_consistency - -end module atm2lndMod diff --git a/src/main/atm2lndType.F90 b/src/main/atm2lndType.F90 deleted file mode 100644 index 33452d5b2a..0000000000 --- a/src/main/atm2lndType.F90 +++ /dev/null @@ -1,1304 +0,0 @@ -module atm2lndType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle atm2lnd, lnd2atm mapping - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. - use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval - use clm_varctl , only : iulog, use_c13, use_cn, use_lch4, use_cndv, use_fates, use_luna - use decompMod , only : bounds_type - use abortutils , only : endrun - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC DATA TYPES: - - type, public :: atm2lnd_params_type - ! true => repartition rain/snow from atm based on temperature - logical :: repartition_rain_snow - - ! true => downscale longwave radiation - logical :: glcmec_downscale_longwave - - ! Surface temperature lapse rate (K m-1) - real(r8) :: lapse_rate - - ! longwave radiation lapse rate (W m-2 m-1) - real(r8) :: lapse_rate_longwave - - ! Relative limit for how much longwave downscaling can be done (unitless) - ! The pre-normalized, downscaled longwave is restricted to be in the range - ! [lwrad*(1-longwave_downscaling_limit), lwrad*(1+longwave_downscaling_limit)] - real(r8) :: longwave_downscaling_limit - - ! Rain-snow ramp for glacier landunits - ! frac_rain = (temp - all_snow_t) * frac_rain_slope - ! (all_snow_t is in K) - real(r8) :: precip_repartition_glc_all_snow_t - real(r8) :: precip_repartition_glc_frac_rain_slope - - ! Rain-snow ramp for non-glacier landunits - ! frac_rain = (temp - all_snow_t) * frac_rain_slope - ! (all_snow_t is in K) - real(r8) :: precip_repartition_nonglc_all_snow_t - real(r8) :: precip_repartition_nonglc_frac_rain_slope - end type atm2lnd_params_type - - !---------------------------------------------------- - ! atmosphere -> land variables structure - ! - ! NOTE: - ! IF there are forcing variables that are downscaled - then the - ! non-downscaled versions SHOULD NOT be used in the code. Currently - ! the non-downscaled versions are only used n a handful of places in - ! the code (and needs to be used in lnd_import_export and the - ! downscaling routines), but in general should NOT be used in new - ! code. Instead use the datatype variables that have a _col suffix - ! which gives the downscaled versions of these fields. - !---------------------------------------------------- - type, public :: atm2lnd_type - type(atm2lnd_params_type) :: params - - ! atm->lnd not downscaled - real(r8), pointer :: forc_u_grc (:) => null() ! atm wind speed, east direction (m/s) - real(r8), pointer :: forc_v_grc (:) => null() ! atm wind speed, north direction (m/s) - real(r8), pointer :: forc_wind_grc (:) => null() ! atmospheric wind speed - real(r8), pointer :: forc_hgt_grc (:) => null() ! atmospheric reference height (m) - real(r8), pointer :: forc_topo_grc (:) => null() ! atmospheric surface height (m) - real(r8), pointer :: forc_hgt_u_grc (:) => null() ! obs height of wind [m] (new) - real(r8), pointer :: forc_hgt_t_grc (:) => null() ! obs height of temperature [m] (new) - real(r8), pointer :: forc_hgt_q_grc (:) => null() ! obs height of humidity [m] (new) - real(r8), pointer :: forc_vp_grc (:) => null() ! atmospheric vapor pressure (Pa) - real(r8), pointer :: forc_rh_grc (:) => null() ! atmospheric relative humidity (%) - real(r8), pointer :: forc_psrf_grc (:) => null() ! surface pressure (Pa) - real(r8), pointer :: forc_pco2_grc (:) => null() ! CO2 partial pressure (Pa) - real(r8), pointer :: forc_pco2_240_patch (:) => null() ! 10-day mean CO2 partial pressure (Pa) - real(r8), pointer :: forc_solad_grc (:,:) => null() ! direct beam radiation (numrad) (vis=forc_sols , nir=forc_soll ) - real(r8), pointer :: forc_solai_grc (:,:) => null() ! diffuse radiation (numrad) (vis=forc_solsd, nir=forc_solld) - real(r8), pointer :: forc_solar_grc (:) => null() ! incident solar radiation - real(r8), pointer :: forc_ndep_grc (:) => null() ! nitrogen deposition rate (gN/m2/s) - real(r8), pointer :: forc_pc13o2_grc (:) => null() ! C13O2 partial pressure (Pa) - real(r8), pointer :: forc_po2_grc (:) => null() ! O2 partial pressure (Pa) - real(r8), pointer :: forc_po2_240_patch (:) => null() ! 10-day mean O2 partial pressure (Pa) - real(r8), pointer :: forc_aer_grc (:,:) => null() ! aerosol deposition array - real(r8), pointer :: forc_pch4_grc (:) => null() ! CH4 partial pressure (Pa) - - real(r8), pointer :: forc_t_not_downscaled_grc (:) => null() ! not downscaled atm temperature (Kelvin) - real(r8), pointer :: forc_th_not_downscaled_grc (:) => null() ! not downscaled atm potential temperature (Kelvin) - real(r8), pointer :: forc_q_not_downscaled_grc (:) => null() ! not downscaled atm specific humidity (kg/kg) - real(r8), pointer :: forc_pbot_not_downscaled_grc (:) => null() ! not downscaled atm pressure (Pa) - real(r8), pointer :: forc_pbot240_downscaled_patch (:) => null() ! 10-day mean downscaled atm pressure (Pa) - real(r8), pointer :: forc_rho_not_downscaled_grc (:) => null() ! not downscaled atm density (kg/m**3) - real(r8), pointer :: forc_rain_not_downscaled_grc (:) => null() ! not downscaled atm rain rate [mm/s] - real(r8), pointer :: forc_snow_not_downscaled_grc (:) => null() ! not downscaled atm snow rate [mm/s] - real(r8), pointer :: forc_lwrad_not_downscaled_grc (:) => null() ! not downscaled atm downwrd IR longwave radiation (W/m**2) - - ! atm->lnd downscaled - real(r8), pointer :: forc_t_downscaled_col (:) => null() ! downscaled atm temperature (Kelvin) - real(r8), pointer :: forc_th_downscaled_col (:) => null() ! downscaled atm potential temperature (Kelvin) - real(r8), pointer :: forc_q_downscaled_col (:) => null() ! downscaled atm specific humidity (kg/kg) - real(r8), pointer :: forc_pbot_downscaled_col (:) => null() ! downscaled atm pressure (Pa) - real(r8), pointer :: forc_rho_downscaled_col (:) => null() ! downscaled atm density (kg/m**3) - real(r8), pointer :: forc_rain_downscaled_col (:) => null() ! downscaled atm rain rate [mm/s] - real(r8), pointer :: forc_snow_downscaled_col (:) => null() ! downscaled atm snow rate [mm/s] - real(r8), pointer :: forc_lwrad_downscaled_col (:) => null() ! downscaled atm downwrd IR longwave radiation (W/m**2) - - ! rof->lnd - real(r8), pointer :: forc_flood_grc (:) => null() ! rof flood (mm/s) - real(r8), pointer :: volr_grc (:) => null() ! rof volr total volume (m3) - real(r8), pointer :: volrmch_grc (:) => null() ! rof volr main channel (m3) - - ! anomaly forcing - real(r8), pointer :: af_precip_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_uwind_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_vwind_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_tbot_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_pbot_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_shum_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_swdn_grc (:) => null() ! anomaly forcing - real(r8), pointer :: af_lwdn_grc (:) => null() ! anomaly forcing - real(r8), pointer :: bc_precip_grc (:) => null() ! anomaly forcing - add bias correction - - ! time averaged quantities - real(r8) , pointer :: fsd24_patch (:) => null() ! patch 24hr average of direct beam radiation - real(r8) , pointer :: fsd240_patch (:) => null() ! patch 240hr average of direct beam radiation - real(r8) , pointer :: fsi24_patch (:) => null() ! patch 24hr average of diffuse beam radiation - real(r8) , pointer :: fsi240_patch (:) => null() ! patch 240hr average of diffuse beam radiation - real(r8) , pointer :: prec365_col (:) => null() ! col 365-day running mean of tot. precipitation (see comment in UpdateAccVars regarding why this is col-level despite other prec accumulators being patch-level) - real(r8) , pointer :: prec60_patch (:) => null() ! patch 60-day running mean of tot. precipitation (mm/s) - real(r8) , pointer :: prec10_patch (:) => null() ! patch 10-day running mean of tot. precipitation (mm/s) - real(r8) , pointer :: rh30_patch (:) => null() ! patch 30-day running mean of relative humidity - real(r8) , pointer :: prec24_patch (:) => null() ! patch 24-hour running mean of tot. precipitation (mm/s) - real(r8) , pointer :: rh24_patch (:) => null() ! patch 24-hour running mean of relative humidity - real(r8) , pointer :: wind24_patch (:) => null() ! patch 24-hour running mean of wind - real(r8) , pointer :: t_mo_patch (:) => null() ! patch 30-day average temperature (Kelvin) - real(r8) , pointer :: t_mo_min_patch (:) => null() ! patch annual min of t_mo (Kelvin) - - contains - - procedure, public :: Init - procedure, public :: InitForTesting ! version of Init meant for unit testing - procedure, private :: ReadNamelist - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, public :: InitAccBuffer - procedure, public :: InitAccVars - procedure, public :: UpdateAccVars - procedure, public :: Restart - procedure, public :: Clean - - end type atm2lnd_type - - interface atm2lnd_params_type - module procedure atm2lnd_params_constructor - end interface atm2lnd_params_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !---------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - function atm2lnd_params_constructor(repartition_rain_snow, glcmec_downscale_longwave, & - lapse_rate, lapse_rate_longwave, longwave_downscaling_limit, & - precip_repartition_glc_all_snow_t, precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t, precip_repartition_nonglc_all_rain_t) & - result(params) - ! - ! !DESCRIPTION: - ! Creates a new instance of atm2lnd_params_type - ! - ! !USES: - ! - ! !ARGUMENTS: - type(atm2lnd_params_type) :: params ! function result - logical, intent(in) :: repartition_rain_snow - logical, intent(in) :: glcmec_downscale_longwave - - ! Surface temperature lapse rate (K m-1) - real(r8), intent(in) :: lapse_rate - - ! Longwave radiation lapse rate (W m-2 m-1) - ! Must be present if glcmec_downscale_longwave is true; ignored otherwise - real(r8), intent(in), optional :: lapse_rate_longwave - - ! Relative limit for how much longwave downscaling can be done (unitless) - ! Must be present if glcmec_downscale_longwave is true; ignored otherwise - real(r8), intent(in), optional :: longwave_downscaling_limit - - ! End-points of the rain-snow ramp for glacier landunits (degrees C) - ! Must be present if repartition_rain_snow is true; ignored otherwise - real(r8), intent(in), optional :: precip_repartition_glc_all_snow_t - real(r8), intent(in), optional :: precip_repartition_glc_all_rain_t - - ! End-points of the rain-snow ramp for non-glacier landunits (degrees C) - ! Must be present if repartition_rain_snow is true; ignored otherwise - real(r8), intent(in), optional :: precip_repartition_nonglc_all_snow_t - real(r8), intent(in), optional :: precip_repartition_nonglc_all_rain_t - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'atm2lnd_params_constructor' - !----------------------------------------------------------------------- - - params%repartition_rain_snow = repartition_rain_snow - params%glcmec_downscale_longwave = glcmec_downscale_longwave - - params%lapse_rate = lapse_rate - - if (glcmec_downscale_longwave) then - if (.not. present(lapse_rate_longwave)) then - call endrun(subname // & - ' ERROR: For glcmec_downscale_longwave true, lapse_rate_longwave must be provided') - end if - if (.not. present(longwave_downscaling_limit)) then - call endrun(subname // & - ' ERROR: For glcmec_downscale_longwave true, longwave_downscaling_limit must be provided') - end if - - if (longwave_downscaling_limit < 0._r8 .or. & - longwave_downscaling_limit > 1._r8) then - call endrun(subname // & - ' ERROR: longwave_downscaling_limit must be between 0 and 1') - end if - - params%lapse_rate_longwave = lapse_rate_longwave - params%longwave_downscaling_limit = longwave_downscaling_limit - else - params%lapse_rate_longwave = nan - params%longwave_downscaling_limit = nan - end if - - if (repartition_rain_snow) then - - ! Make sure all of the repartitioning-related parameters are present - - if (.not. present(precip_repartition_glc_all_snow_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_glc_all_snow_t must be provided') - end if - if (.not. present(precip_repartition_glc_all_rain_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_glc_all_rain_t must be provided') - end if - if (.not. present(precip_repartition_nonglc_all_snow_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_nonglc_all_snow_t must be provided') - end if - if (.not. present(precip_repartition_nonglc_all_rain_t)) then - call endrun(subname // & - ' ERROR: For repartition_rain_snow true, precip_repartition_nonglc_all_rain_t must be provided') - end if - - ! Do some other error checking - - if (precip_repartition_glc_all_rain_t <= precip_repartition_glc_all_snow_t) then - call endrun(subname // & - ' ERROR: Must have precip_repartition_glc_all_snow_t < precip_repartition_glc_all_rain_t') - end if - - if (precip_repartition_nonglc_all_rain_t <= precip_repartition_nonglc_all_snow_t) then - call endrun(subname // & - ' ERROR: Must have precip_repartition_nonglc_all_snow_t < precip_repartition_nonglc_all_rain_t') - end if - - ! Convert to the form of the parameters we want for the main code - - call compute_ramp_params( & - all_snow_t_c = precip_repartition_glc_all_snow_t, & - all_rain_t_c = precip_repartition_glc_all_rain_t, & - all_snow_t_k = params%precip_repartition_glc_all_snow_t, & - frac_rain_slope = params%precip_repartition_glc_frac_rain_slope) - - call compute_ramp_params( & - all_snow_t_c = precip_repartition_nonglc_all_snow_t, & - all_rain_t_c = precip_repartition_nonglc_all_rain_t, & - all_snow_t_k = params%precip_repartition_nonglc_all_snow_t, & - frac_rain_slope = params%precip_repartition_nonglc_frac_rain_slope) - - else ! .not. repartition_rain_snow - params%precip_repartition_glc_all_snow_t = nan - params%precip_repartition_glc_frac_rain_slope = nan - params%precip_repartition_nonglc_all_snow_t = nan - params%precip_repartition_nonglc_frac_rain_slope = nan - end if - - contains - subroutine compute_ramp_params(all_snow_t_c, all_rain_t_c, & - all_snow_t_k, frac_rain_slope) - real(r8), intent(in) :: all_snow_t_c ! Temperature at which precip falls entirely as rain (deg C) - real(r8), intent(in) :: all_rain_t_c ! Temperature at which precip falls entirely as snow (deg C) - real(r8), intent(out) :: all_snow_t_k ! Temperature at which precip falls entirely as snow (K) - real(r8), intent(out) :: frac_rain_slope ! Slope of the frac_rain vs. T relationship - - frac_rain_slope = 1._r8 / (all_rain_t_c - all_snow_t_c) - all_snow_t_k = all_snow_t_c + tfrz - end subroutine compute_ramp_params - - end function atm2lnd_params_constructor - - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) - - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! namelist filename - - call this%InitAllocate(bounds) - call this%ReadNamelist(NLFilename) - call this%InitHistory(bounds) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitForTesting(this, bounds, params) - ! - ! !DESCRIPTION: - ! Does initialization needed for unit testing. Allows caller to prescribe parameter - ! values (bypassing the namelist read) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - - ! If params isn't provided, we use default values - type(atm2lnd_params_type), intent(in), optional :: params - ! - ! !LOCAL VARIABLES: - type(atm2lnd_params_type) :: l_params - - character(len=*), parameter :: subname = 'InitForTesting' - !----------------------------------------------------------------------- - - if (present(params)) then - l_params = params - else - ! Use arbitrary values - l_params = atm2lnd_params_type( & - repartition_rain_snow = .false., & - glcmec_downscale_longwave = .false., & - lapse_rate = 0.01_r8) - end if - - call this%InitAllocate(bounds) - this%params = l_params - - end subroutine InitForTesting - - - !----------------------------------------------------------------------- - subroutine ReadNamelist(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the atm2lnd namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - class(atm2lnd_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - ! temporary variables corresponding to the components of atm2lnd_params_type - logical :: repartition_rain_snow - logical :: glcmec_downscale_longwave - real(r8) :: lapse_rate - real(r8) :: lapse_rate_longwave - real(r8) :: longwave_downscaling_limit - real(r8) :: precip_repartition_glc_all_snow_t - real(r8) :: precip_repartition_glc_all_rain_t - real(r8) :: precip_repartition_nonglc_all_snow_t - real(r8) :: precip_repartition_nonglc_all_rain_t - - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=*), parameter :: nmlname = 'atm2lnd_inparm' - - character(len=*), parameter :: subname = 'ReadNamelist' - !----------------------------------------------------------------------- - - namelist /atm2lnd_inparm/ repartition_rain_snow, glcmec_downscale_longwave, & - lapse_rate, lapse_rate_longwave, longwave_downscaling_limit, & - precip_repartition_glc_all_snow_t, precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t, precip_repartition_nonglc_all_rain_t - - ! Initialize namelist variables to defaults - repartition_rain_snow = .false. - glcmec_downscale_longwave = .false. - lapse_rate = nan - lapse_rate_longwave = nan - longwave_downscaling_limit = nan - precip_repartition_glc_all_snow_t = nan - precip_repartition_glc_all_rain_t = nan - precip_repartition_nonglc_all_snow_t = nan - precip_repartition_nonglc_all_rain_t = nan - - if (masterproc) then - unitn = getavu() - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=atm2lnd_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast(repartition_rain_snow, mpicom) - call shr_mpi_bcast(glcmec_downscale_longwave, mpicom) - call shr_mpi_bcast(lapse_rate, mpicom) - call shr_mpi_bcast(lapse_rate_longwave, mpicom) - call shr_mpi_bcast(longwave_downscaling_limit, mpicom) - call shr_mpi_bcast(precip_repartition_glc_all_snow_t, mpicom) - call shr_mpi_bcast(precip_repartition_glc_all_rain_t, mpicom) - call shr_mpi_bcast(precip_repartition_nonglc_all_snow_t, mpicom) - call shr_mpi_bcast(precip_repartition_nonglc_all_rain_t, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - ! Write settings one-by-one rather than with a nml write because some settings may - ! be NaN if certain options are turned off. - write(iulog,*) 'repartition_rain_snow = ', repartition_rain_snow - write(iulog,*) 'glcmec_downscale_longwave = ', glcmec_downscale_longwave - write(iulog,*) 'lapse_rate = ', lapse_rate - if (glcmec_downscale_longwave) then - write(iulog,*) 'lapse_rate_longwave = ', lapse_rate_longwave - write(iulog,*) 'longwave_downscaling_limit = ', longwave_downscaling_limit - end if - if (repartition_rain_snow) then - write(iulog,*) 'precip_repartition_glc_all_snow_t = ', precip_repartition_glc_all_snow_t - write(iulog,*) 'precip_repartition_glc_all_rain_t = ', precip_repartition_glc_all_rain_t - write(iulog,*) 'precip_repartition_nonglc_all_snow_t = ', precip_repartition_nonglc_all_snow_t - write(iulog,*) 'precip_repartition_nonglc_all_rain_t = ', precip_repartition_nonglc_all_rain_t - end if - write(iulog,*) ' ' - end if - - this%params = atm2lnd_params_type( & - repartition_rain_snow = repartition_rain_snow, & - glcmec_downscale_longwave = glcmec_downscale_longwave, & - lapse_rate = lapse_rate, & - lapse_rate_longwave = lapse_rate_longwave, & - longwave_downscaling_limit = longwave_downscaling_limit, & - precip_repartition_glc_all_snow_t = precip_repartition_glc_all_snow_t, & - precip_repartition_glc_all_rain_t = precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t = precip_repartition_nonglc_all_snow_t, & - precip_repartition_nonglc_all_rain_t = precip_repartition_nonglc_all_rain_t) - - end subroutine ReadNamelist - - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize atm2lnd derived type - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8) :: ival = 0.0_r8 ! initial value - integer :: begg, endg - integer :: begc, endc - integer :: begp, endp - !------------------------------------------------------------------------ - - begg = bounds%begg; endg= bounds%endg - begc = bounds%begc; endc= bounds%endc - begp = bounds%begp; endp= bounds%endp - - ! atm->lnd - allocate(this%forc_u_grc (begg:endg)) ; this%forc_u_grc (:) = ival - allocate(this%forc_v_grc (begg:endg)) ; this%forc_v_grc (:) = ival - allocate(this%forc_wind_grc (begg:endg)) ; this%forc_wind_grc (:) = ival - allocate(this%forc_rh_grc (begg:endg)) ; this%forc_rh_grc (:) = ival - allocate(this%forc_hgt_grc (begg:endg)) ; this%forc_hgt_grc (:) = ival - allocate(this%forc_topo_grc (begg:endg)) ; this%forc_topo_grc (:) = ival - allocate(this%forc_hgt_u_grc (begg:endg)) ; this%forc_hgt_u_grc (:) = ival - allocate(this%forc_hgt_t_grc (begg:endg)) ; this%forc_hgt_t_grc (:) = ival - allocate(this%forc_hgt_q_grc (begg:endg)) ; this%forc_hgt_q_grc (:) = ival - allocate(this%forc_vp_grc (begg:endg)) ; this%forc_vp_grc (:) = ival - allocate(this%forc_psrf_grc (begg:endg)) ; this%forc_psrf_grc (:) = ival - allocate(this%forc_pco2_grc (begg:endg)) ; this%forc_pco2_grc (:) = ival - allocate(this%forc_solad_grc (begg:endg,numrad)) ; this%forc_solad_grc (:,:) = ival - allocate(this%forc_solai_grc (begg:endg,numrad)) ; this%forc_solai_grc (:,:) = ival - allocate(this%forc_solar_grc (begg:endg)) ; this%forc_solar_grc (:) = ival - allocate(this%forc_ndep_grc (begg:endg)) ; this%forc_ndep_grc (:) = ival - allocate(this%forc_pc13o2_grc (begg:endg)) ; this%forc_pc13o2_grc (:) = ival - allocate(this%forc_po2_grc (begg:endg)) ; this%forc_po2_grc (:) = ival - allocate(this%forc_aer_grc (begg:endg,14)) ; this%forc_aer_grc (:,:) = ival - allocate(this%forc_pch4_grc (begg:endg)) ; this%forc_pch4_grc (:) = ival - if(use_luna)then - allocate(this%forc_pco2_240_patch (begp:endp)) ; this%forc_pco2_240_patch (:) = ival - allocate(this%forc_po2_240_patch (begp:endp)) ; this%forc_po2_240_patch (:) = ival - allocate(this%forc_pbot240_downscaled_patch(begp:endp)) ; this%forc_pbot240_downscaled_patch (:) = ival - endif - - ! atm->lnd not downscaled - allocate(this%forc_t_not_downscaled_grc (begg:endg)) ; this%forc_t_not_downscaled_grc (:) = ival - allocate(this%forc_q_not_downscaled_grc (begg:endg)) ; this%forc_q_not_downscaled_grc (:) = ival - allocate(this%forc_pbot_not_downscaled_grc (begg:endg)) ; this%forc_pbot_not_downscaled_grc (:) = ival - allocate(this%forc_th_not_downscaled_grc (begg:endg)) ; this%forc_th_not_downscaled_grc (:) = ival - allocate(this%forc_rho_not_downscaled_grc (begg:endg)) ; this%forc_rho_not_downscaled_grc (:) = ival - allocate(this%forc_lwrad_not_downscaled_grc (begg:endg)) ; this%forc_lwrad_not_downscaled_grc (:) = ival - allocate(this%forc_rain_not_downscaled_grc (begg:endg)) ; this%forc_rain_not_downscaled_grc (:) = ival - allocate(this%forc_snow_not_downscaled_grc (begg:endg)) ; this%forc_snow_not_downscaled_grc (:) = ival - - ! atm->lnd downscaled - allocate(this%forc_t_downscaled_col (begc:endc)) ; this%forc_t_downscaled_col (:) = ival - allocate(this%forc_q_downscaled_col (begc:endc)) ; this%forc_q_downscaled_col (:) = ival - allocate(this%forc_pbot_downscaled_col (begc:endc)) ; this%forc_pbot_downscaled_col (:) = ival - allocate(this%forc_th_downscaled_col (begc:endc)) ; this%forc_th_downscaled_col (:) = ival - allocate(this%forc_rho_downscaled_col (begc:endc)) ; this%forc_rho_downscaled_col (:) = ival - allocate(this%forc_lwrad_downscaled_col (begc:endc)) ; this%forc_lwrad_downscaled_col (:) = ival - allocate(this%forc_rain_downscaled_col (begc:endc)) ; this%forc_rain_downscaled_col (:) = ival - allocate(this%forc_snow_downscaled_col (begc:endc)) ; this%forc_snow_downscaled_col (:) = ival - - ! rof->lnd - allocate(this%forc_flood_grc (begg:endg)) ; this%forc_flood_grc (:) = ival - allocate(this%volr_grc (begg:endg)) ; this%volr_grc (:) = ival - allocate(this%volrmch_grc (begg:endg)) ; this%volrmch_grc (:) = ival - - ! anomaly forcing - allocate(this%bc_precip_grc (begg:endg)) ; this%bc_precip_grc (:) = ival - allocate(this%af_precip_grc (begg:endg)) ; this%af_precip_grc (:) = ival - allocate(this%af_uwind_grc (begg:endg)) ; this%af_uwind_grc (:) = ival - allocate(this%af_vwind_grc (begg:endg)) ; this%af_vwind_grc (:) = ival - allocate(this%af_tbot_grc (begg:endg)) ; this%af_tbot_grc (:) = ival - allocate(this%af_pbot_grc (begg:endg)) ; this%af_pbot_grc (:) = ival - allocate(this%af_shum_grc (begg:endg)) ; this%af_shum_grc (:) = ival - allocate(this%af_swdn_grc (begg:endg)) ; this%af_swdn_grc (:) = ival - allocate(this%af_lwdn_grc (begg:endg)) ; this%af_lwdn_grc (:) = ival - - allocate(this%fsd24_patch (begp:endp)) ; this%fsd24_patch (:) = nan - allocate(this%fsd240_patch (begp:endp)) ; this%fsd240_patch (:) = nan - allocate(this%fsi24_patch (begp:endp)) ; this%fsi24_patch (:) = nan - allocate(this%fsi240_patch (begp:endp)) ; this%fsi240_patch (:) = nan - allocate(this%prec10_patch (begp:endp)) ; this%prec10_patch (:) = nan - allocate(this%prec60_patch (begp:endp)) ; this%prec60_patch (:) = nan - allocate(this%rh30_patch (begp:endp)) ; this%rh30_patch (:) = nan - allocate(this%prec365_col (begc:endc)) ; this%prec365_col (:) = nan - if (use_fates) then - allocate(this%prec24_patch (begp:endp)) ; this%prec24_patch (:) = nan - allocate(this%rh24_patch (begp:endp)) ; this%rh24_patch (:) = nan - allocate(this%wind24_patch (begp:endp)) ; this%wind24_patch (:) = nan - end if - allocate(this%t_mo_patch (begp:endp)) ; this%t_mo_patch (:) = nan - allocate(this%t_mo_min_patch (begp:endp)) ; this%t_mo_min_patch (:) = spval ! TODO - initialize this elsewhere - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg, endg - integer :: begc, endc - integer :: begp, endp - !--------------------------------------------------------------------- - - begg = bounds%begg; endg= bounds%endg - begc = bounds%begc; endc= bounds%endc - begp = bounds%begp; endp= bounds%endp - - this%forc_flood_grc(begg:endg) = spval - call hist_addfld1d (fname='QFLOOD', units='mm/s', & - avgflag='A', long_name='runoff from river flooding', & - ptr_lnd=this%forc_flood_grc) - - this%volr_grc(begg:endg) = spval - call hist_addfld1d (fname='VOLR', units='m3', & - avgflag='A', long_name='river channel total water storage', & - ptr_lnd=this%volr_grc) - - this%volrmch_grc(begg:endg) = spval - call hist_addfld1d (fname='VOLRMCH', units='m3', & - avgflag='A', long_name='river channel main channel water storage', & - ptr_lnd=this%volrmch_grc) - - this%forc_wind_grc(begg:endg) = spval - call hist_addfld1d (fname='WIND', units='m/s', & - avgflag='A', long_name='atmospheric wind velocity magnitude', & - ptr_lnd=this%forc_wind_grc) - ! Rename of WIND for Urban intercomparision project - call hist_addfld1d (fname='Wind', units='m/s', & - avgflag='A', long_name='atmospheric wind velocity magnitude', & - ptr_gcell=this%forc_wind_grc, default = 'inactive') - - this%forc_hgt_grc(begg:endg) = spval - call hist_addfld1d (fname='ZBOT', units='m', & - avgflag='A', long_name='atmospheric reference height', & - ptr_lnd=this%forc_hgt_grc) - - this%forc_topo_grc(begg:endg) = spval - call hist_addfld1d (fname='ATM_TOPO', units='m', & - avgflag='A', long_name='atmospheric surface height', & - ptr_lnd=this%forc_topo_grc) - - this%forc_solar_grc(begg:endg) = spval - call hist_addfld1d (fname='FSDS', units='W/m^2', & - avgflag='A', long_name='atmospheric incident solar radiation', & - ptr_lnd=this%forc_solar_grc) - - this%forc_pco2_grc(begg:endg) = spval - call hist_addfld1d (fname='PCO2', units='Pa', & - avgflag='A', long_name='atmospheric partial pressure of CO2', & - ptr_lnd=this%forc_pco2_grc) - - this%forc_solar_grc(begg:endg) = spval - call hist_addfld1d (fname='SWdown', units='W/m^2', & - avgflag='A', long_name='atmospheric incident solar radiation', & - ptr_gcell=this%forc_solar_grc, default='inactive') - - this%forc_rh_grc(begg:endg) = spval - call hist_addfld1d (fname='RH', units='%', & - avgflag='A', long_name='atmospheric relative humidity', & - ptr_gcell=this%forc_rh_grc, default='inactive') - - if (use_lch4) then - this%forc_pch4_grc(begg:endg) = spval - call hist_addfld1d (fname='PCH4', units='Pa', & - avgflag='A', long_name='atmospheric partial pressure of CH4', & - ptr_lnd=this%forc_pch4_grc) - end if - - this%forc_t_not_downscaled_grc(begg:endg) = spval - call hist_addfld1d (fname='Tair_from_atm', units='K', & - avgflag='A', long_name='atmospheric air temperature received from atmosphere (pre-downscaling)', & - ptr_gcell=this%forc_t_not_downscaled_grc, default='inactive') - - this%forc_t_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='TBOT', units='K', & - avgflag='A', long_name='atmospheric air temperature (downscaled to columns in glacier regions)', & - ptr_col=this%forc_t_downscaled_col) - call hist_addfld1d (fname='Tair', units='K', & - avgflag='A', long_name='atmospheric air temperature (downscaled to columns in glacier regions)', & - ptr_col=this%forc_t_downscaled_col, default='inactive') - - this%forc_pbot_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='PBOT', units='Pa', & - avgflag='A', long_name='atmospheric pressure at surface (downscaled to columns in glacier regions)', & - ptr_col=this%forc_pbot_downscaled_col) - call hist_addfld1d (fname='PSurf', units='Pa', & - avgflag='A', long_name='atmospheric pressure at surface (downscaled to columns in glacier regions)', & - ptr_col=this%forc_pbot_downscaled_col, default='inactive') - - this%forc_lwrad_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='FLDS', units='W/m^2', & - avgflag='A', long_name='atmospheric longwave radiation (downscaled to columns in glacier regions)', & - ptr_col=this%forc_lwrad_downscaled_col) - call hist_addfld1d (fname='LWdown', units='W/m^2', & - avgflag='A', long_name='atmospheric longwave radiation (downscaled to columns in glacier regions)', & - ptr_col=this%forc_lwrad_downscaled_col, default='inactive') - - call hist_addfld1d (fname='FLDS_ICE', units='W/m^2', & - avgflag='A', & - long_name='atmospheric longwave radiation (downscaled to columns in glacier regions) (ice landunits only)', & - ptr_col=this%forc_lwrad_downscaled_col, l2g_scale_type='ice', & - default='inactive') - - this%forc_rain_not_downscaled_grc(begg:endg) = spval - call hist_addfld1d (fname='RAIN_FROM_ATM', units='mm/s', & - avgflag='A', long_name='atmospheric rain received from atmosphere (pre-repartitioning)', & - ptr_lnd=this%forc_rain_not_downscaled_grc) - - this%forc_snow_not_downscaled_grc(begg:endg) = spval - call hist_addfld1d (fname='SNOW_FROM_ATM', units='mm/s', & - avgflag='A', long_name='atmospheric snow received from atmosphere (pre-repartitioning)', & - ptr_lnd=this%forc_snow_not_downscaled_grc) - - this%forc_rain_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='RAIN', units='mm/s', & - avgflag='A', long_name='atmospheric rain, after rain/snow repartitioning based on temperature', & - ptr_col=this%forc_rain_downscaled_col) - call hist_addfld1d (fname='Rainf', units='mm/s', & - avgflag='A', long_name='atmospheric rain, after rain/snow repartitioning based on temperature', & - ptr_col=this%forc_rain_downscaled_col, default='inactive') - - call hist_addfld1d (fname='RAIN_ICE', units='mm/s', & - avgflag='A', & - long_name='atmospheric rain, after rain/snow repartitioning based on temperature (ice landunits only)', & - ptr_col=this%forc_rain_downscaled_col, l2g_scale_type='ice', & - default='inactive') - - this%forc_snow_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='SNOW', units='mm/s', & - avgflag='A', long_name='atmospheric snow, after rain/snow repartitioning based on temperature', & - ptr_col=this%forc_snow_downscaled_col) - - call hist_addfld1d (fname='SNOW_ICE', units='mm/s', & - avgflag='A', & - long_name='atmospheric snow, after rain/snow repartitioning based on temperature (ice landunits only)', & - ptr_col=this%forc_snow_downscaled_col, l2g_scale_type='ice', & - default='inactive') - - this%forc_th_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='THBOT', units='K', & - avgflag='A', long_name='atmospheric air potential temperature (downscaled to columns in glacier regions)', & - ptr_col=this%forc_th_downscaled_col) - - this%forc_q_downscaled_col(begc:endc) = spval - call hist_addfld1d (fname='QBOT', units='kg/kg', & - avgflag='A', long_name='atmospheric specific humidity (downscaled to columns in glacier regions)', & - ptr_col=this%forc_q_downscaled_col) - ! Rename of QBOT for Urban intercomparison project - call hist_addfld1d (fname='Qair', units='kg/kg', & - avgflag='A', long_name='atmospheric specific humidity (downscaled to columns in glacier regions)', & - ptr_col=this%forc_q_downscaled_col, default='inactive') - - ! Time averaged quantities - this%fsi24_patch(begp:endp) = spval - call hist_addfld1d (fname='FSI24', units='K', & - avgflag='A', long_name='indirect radiation (last 24hrs)', & - ptr_patch=this%fsi24_patch, default='inactive') - - this%fsi240_patch(begp:endp) = spval - call hist_addfld1d (fname='FSI240', units='K', & - avgflag='A', long_name='indirect radiation (last 240hrs)', & - ptr_patch=this%fsi240_patch, default='inactive') - - this%fsd24_patch(begp:endp) = spval - call hist_addfld1d (fname='FSD24', units='K', & - avgflag='A', long_name='direct radiation (last 24hrs)', & - ptr_patch=this%fsd24_patch, default='inactive') - - this%fsd240_patch(begp:endp) = spval - call hist_addfld1d (fname='FSD240', units='K', & - avgflag='A', long_name='direct radiation (last 240hrs)', & - ptr_patch=this%fsd240_patch, default='inactive') - - if (use_cn) then - this%rh30_patch(begp:endp) = spval - call hist_addfld1d (fname='RH30', units='%', & - avgflag='A', long_name='30-day running mean of relative humidity', & - ptr_patch=this%rh30_patch, default='inactive') - - this%prec10_patch(begp:endp) = spval - call hist_addfld1d (fname='PREC10', units='MM H2O/S', & - avgflag='A', long_name='10-day running mean of PREC', & - ptr_patch=this%prec10_patch, default='inactive') - - this%prec60_patch(begp:endp) = spval - call hist_addfld1d (fname='PREC60', units='MM H2O/S', & - avgflag='A', long_name='60-day running mean of PREC', & - ptr_patch=this%prec60_patch, default='inactive') - end if - - if (use_cndv) then - call hist_addfld1d (fname='TDA', units='K', & - avgflag='A', long_name='daily average 2-m temperature', & - ptr_patch=this%t_mo_patch) - end if - - if(use_luna)then - this%forc_pco2_240_patch = spval - call hist_addfld1d (fname='PCO2_240', units='Pa', & - avgflag='A', long_name='10 day running mean of CO2 pressure', & - ptr_patch=this%forc_pco2_240_patch, default='inactive') - this%forc_po2_240_patch = spval - call hist_addfld1d (fname='PO2_240', units='Pa', & - avgflag='A', long_name='10 day running mean of O2 pressure', & - ptr_patch=this%forc_po2_240_patch, default='inactive') - this%forc_pbot240_downscaled_patch = spval - call hist_addfld1d (fname='PBOT_240', units='Pa', & - avgflag='A', long_name='10 day running mean of air pressure', & - ptr_patch=this%forc_pbot240_downscaled_patch, default='inactive') - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitAccBuffer (this, bounds) - ! - ! !DESCRIPTION: - ! Initialize accumulation buffer for all required module accumulated fields - ! This routine set defaults values that are then overwritten by the - ! restart file for restart or branch runs - ! - ! !USES - use clm_varcon , only : spval - use accumulMod , only : init_accum_field - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - !--------------------------------------------------------------------- - - this%fsd24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSD24', units='W/m2', & - desc='24hr average of direct solar radiation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%fsd240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSD240', units='W/m2', & - desc='240hr average of direct solar radiation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%fsi24_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSI24', units='W/m2', & - desc='24hr average of diffuse solar radiation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - this%fsi240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='FSI240', units='W/m2', & - desc='240hr average of diffuse solar radiation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - if (use_cn) then - call init_accum_field (name='PREC10', units='MM H2O/S', & - desc='10-day running mean of total precipitation', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='PREC60', units='MM H2O/S', & - desc='60-day running mean of total precipitation', accum_type='runmean', accum_period=-60, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='RH30', units='%', & - desc='30-day running mean of relative humidity', accum_type='runmean', accum_period=-30, & - subgrid_type='pft', numlev=1, init_value=100._r8) - end if - - if (use_cndv) then - ! The following is a running mean with the accumulation period is set to -365 for a 365-day running mean. - call init_accum_field (name='PREC365', units='MM H2O/S', & - desc='365-day running mean of total precipitation', accum_type='runmean', accum_period=-365, & - subgrid_type='column', numlev=1, init_value=0._r8) - end if - - if ( use_fates ) then - call init_accum_field (name='PREC24', units='m', & - desc='24hr sum of precipitation', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! Fudge - this neds to be initialized from the restat file eventually. - call init_accum_field (name='RH24', units='m', & - desc='24hr average of RH', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=100._r8) - - call init_accum_field (name='WIND24', units='m', & - desc='24hr average of wind', accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - end if - - if(use_luna) then - this%forc_po2_240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='po2_240', units='Pa', & - desc='10-day running mean of parial O2 pressure', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=21223._r8) - - this%forc_pco2_240_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='pco2_240', units='Pa', & - desc='10-day running mean of parial CO2 pressure', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=28._r8) - - this%forc_pbot240_downscaled_patch(bounds%begp:bounds%endp) = spval - call init_accum_field (name='pbot240', units='Pa', & - desc='10-day running mean of air pressure', accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=101325._r8) - - endif - - end subroutine InitAccBuffer - - !----------------------------------------------------------------------- - subroutine InitAccVars(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module variables that are associated with - ! time accumulated fields. This routine is called for both an initial run - ! and a restart run (and must therefore must be called after the restart file - ! is read in and the accumulation buffer is obtained) - ! - ! !USES - use accumulMod , only : extract_accum_field - use clm_time_manager , only : get_nstep - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - integer :: nstep - integer :: ier - real(r8), pointer :: rbufslp(:) ! temporary - real(r8), pointer :: rbufslc(:) ! temporary - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="InitAccVars allocation error for rbufslp"//& - errMsg(sourcefile, __LINE__)) - endif - ! Allocate needed dynamic memory for single level col field - allocate(rbufslc(begc:endc), stat=ier) - if (ier/=0) then - write(iulog,*)' in ' - call endrun(msg="InitAccVars allocation error for rbufslc"//& - errMsg(sourcefile, __LINE__)) - endif - - ! Determine time step - nstep = get_nstep() - - call extract_accum_field ('FSD24', rbufslp, nstep) - this%fsd24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSD240', rbufslp, nstep) - this%fsd240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSI24', rbufslp, nstep) - this%fsi24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('FSI240', rbufslp, nstep) - this%fsi240_patch(begp:endp) = rbufslp(begp:endp) - - if (use_cn) then - call extract_accum_field ('PREC10', rbufslp, nstep) - this%prec10_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('PREC60', rbufslp, nstep) - this%prec60_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('RH30', rbufslp, nstep) - this%rh30_patch(begp:endp) = rbufslp(begp:endp) - end if - - if (use_cndv) then - call extract_accum_field ('PREC365' , rbufslc, nstep) - this%prec365_col(begc:endc) = rbufslc(begc:endc) - - call extract_accum_field ('TDA', rbufslp, nstep) - this%t_mo_patch(begp:endp) = rbufslp(begp:endp) - end if - - if (use_fates) then - call extract_accum_field ('PREC24', rbufslp, nstep) - this%prec24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('RH24', rbufslp, nstep) - this%rh24_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('WIND24', rbufslp, nstep) - this%wind24_patch(begp:endp) = rbufslp(begp:endp) - end if - - if(use_luna) then - call extract_accum_field ('po2_240', rbufslp, nstep) - this%forc_po2_240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('pco2_240', rbufslp, nstep) - this%forc_pco2_240_patch(begp:endp) = rbufslp(begp:endp) - - call extract_accum_field ('pbot240', rbufslp, nstep) - this%forc_pbot240_downscaled_patch(begp:endp) = rbufslp(begp:endp) - - endif - - deallocate(rbufslp) - deallocate(rbufslc) - - end subroutine InitAccVars - - !----------------------------------------------------------------------- - subroutine UpdateAccVars (this, bounds) - ! - ! USES - use clm_time_manager, only : get_nstep - use accumulMod , only : update_accum_field, extract_accum_field - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,c,p ! indices - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: ier ! error status - integer :: begp, endp - integer :: begc, endc - real(r8), pointer :: rbufslp(:) ! temporary single level - patch level - real(r8), pointer :: rbufslc(:) ! temporary single level - column level - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - nstep = get_nstep() - - ! Allocate needed dynamic memory for single level patch field - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'UpdateAccVars allocation error for rbufslp' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - ! Allocate needed dynamic memory for single level col field - allocate(rbufslc(begc:endc), stat=ier) - if (ier/=0) then - write(iulog,*)'UpdateAccVars allocation error for rbufslc' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - ! Accumulate and extract forc_solad24 & forc_solad240 - do p = begp,endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_solad_grc(g,1) - end do - call update_accum_field ('FSD240', rbufslp , nstep) - call extract_accum_field ('FSD240', this%fsd240_patch , nstep) - call update_accum_field ('FSD24' , rbufslp , nstep) - call extract_accum_field ('FSD24' , this%fsd24_patch , nstep) - - ! Accumulate and extract forc_solai24 & forc_solai240 - do p = begp,endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_solai_grc(g,1) - end do - call update_accum_field ('FSI24' , rbufslp , nstep) - call extract_accum_field ('FSI24' , this%fsi24_patch , nstep) - call update_accum_field ('FSI240', rbufslp , nstep) - call extract_accum_field ('FSI240', this%fsi240_patch , nstep) - - ! Precipitation accumulators - ! - ! For CNDV, we use a column-level accumulator. We cannot use a patch-level - ! accumulator for CNDV because this is used for establishment, so must be available - ! for inactive patches. In principle, we could/should switch to column-level for the - ! other precip accumulators, too; we'd just need to be careful about backwards - ! compatibility with old restart files. - - do p = begp,endp - c = patch%column(p) - rbufslp(p) = this%forc_rain_downscaled_col(c) + this%forc_snow_downscaled_col(c) - rbufslc(c) = this%forc_rain_downscaled_col(c) + this%forc_snow_downscaled_col(c) - end do - - if (use_cn) then - ! Accumulate and extract PREC60 (accumulates total precipitation as 60-day running mean) - call update_accum_field ('PREC60', rbufslp, nstep) - call extract_accum_field ('PREC60', this%prec60_patch, nstep) - - ! Accumulate and extract PREC10 (accumulates total precipitation as 10-day running mean) - call update_accum_field ('PREC10', rbufslp, nstep) - call extract_accum_field ('PREC10', this%prec10_patch, nstep) - end if - - if (use_cndv) then - ! Accumulate and extract PREC365 (accumulates total precipitation as 365-day running mean) - ! See above comment regarding why this is at the column-level despite other prec - ! accumulators being at the patch level. - call update_accum_field ('PREC365', rbufslc, nstep) - call extract_accum_field ('PREC365', this%prec365_col, nstep) - - ! Accumulate and extract TDA (accumulates TBOT as 30-day average) and - ! also determines t_mo_min - - do p = begp,endp - c = patch%column(p) - rbufslp(p) = this%forc_t_downscaled_col(c) - end do - call update_accum_field ('TDA', rbufslp, nstep) - call extract_accum_field ('TDA', rbufslp, nstep) - do p = begp,endp - this%t_mo_patch(p) = rbufslp(p) - this%t_mo_min_patch(p) = min(this%t_mo_min_patch(p), rbufslp(p)) - end do - - end if - - if (use_fates) then - call update_accum_field ('PREC24', rbufslp, nstep) - call extract_accum_field ('PREC24', this%prec24_patch, nstep) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_wind_grc(g) - end do - call update_accum_field ('WIND24', rbufslp, nstep) - call extract_accum_field ('WIND24', this%wind24_patch, nstep) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_rh_grc(g) - end do - call update_accum_field ('RH24', rbufslp, nstep) - call extract_accum_field ('RH24', this%rh24_patch, nstep) - end if - - if(use_luna) then - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_pco2_grc(g) - enddo - call update_accum_field ('pco2_240', rbufslp, nstep) - call extract_accum_field ('pco2_240', this%forc_pco2_240_patch, nstep) - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_po2_grc(g) - enddo - call update_accum_field ('po2_240', rbufslp, nstep) - call extract_accum_field ('po2_240', this%forc_po2_240_patch, nstep) - - do p = bounds%begp,bounds%endp - c = patch%column(p) - rbufslp(p) = this%forc_pbot_downscaled_col(c) - enddo - call update_accum_field ('pbot240', rbufslp, nstep) - call extract_accum_field ('pbot240', this%forc_pbot240_downscaled_patch, nstep) - - endif - - if (use_cn) then - do p = begp,endp - g = patch%gridcell(p) - rbufslp(p) = this%forc_rh_grc(g) - end do - ! Accumulate and extract RH30 (accumulates RH as 30-day running mean) - call update_accum_field ('RH30', rbufslp, nstep) - call extract_accum_field ('RH30', this%rh30_patch, nstep) - endif - - deallocate(rbufslp) - deallocate(rbufslc) - - end subroutine UpdateAccVars - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class(atm2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - ! - ! !LOCAL VARIABLES: - logical :: readvar - !------------------------------------------------------------------------ - - call restartvar(ncid=ncid, flag=flag, varname='qflx_floodg', xtype=ncd_double, & - dim1name='gridcell', & - long_name='flood water flux', units='mm/s', & - interpinic_flag='skip', readvar=readvar, data=this%forc_flood_grc) - if (flag == 'read' .and. .not. readvar) then - ! initial run, readvar=readvar, not restart: initialize flood to zero - this%forc_flood_grc = 0._r8 - endif - - if (use_cndv) then - call restartvar(ncid=ncid, flag=flag, varname='T_MO_MIN', xtype=ncd_double, & - dim1name='pft', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%t_mo_min_patch) - end if - - if(use_luna)then - call restartvar(ncid=ncid, flag=flag, varname='pco2_240', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean CO2 partial pressure', units='Pa', & - interpinic_flag='interp', readvar=readvar, data=this%forc_pco2_240_patch ) - call restartvar(ncid=ncid, flag=flag, varname='po2_240', xtype=ncd_double, & - dim1name='pft', long_name='10-day mean O2 partial pressure', units='Pa', & - interpinic_flag='interp', readvar=readvar, data=this%forc_po2_240_patch ) - call restartvar(ncid=ncid, flag=flag, varname='pbot240', xtype=ncd_double, & - dim1name='pft', long_name='10 day mean atmospheric pressure(Pa)', units='Pa', & - interpinic_flag='interp', readvar=readvar, data=this%forc_pbot240_downscaled_patch ) - endif - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! - ! !DESCRIPTION: - ! Finalize this instance - ! - ! !USES: - ! - ! !ARGUMENTS: - class(atm2lnd_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - ! atm->lnd - deallocate(this%forc_u_grc) - deallocate(this%forc_v_grc) - deallocate(this%forc_wind_grc) - deallocate(this%forc_rh_grc) - deallocate(this%forc_hgt_grc) - deallocate(this%forc_topo_grc) - deallocate(this%forc_hgt_u_grc) - deallocate(this%forc_hgt_t_grc) - deallocate(this%forc_hgt_q_grc) - deallocate(this%forc_vp_grc) - deallocate(this%forc_psrf_grc) - deallocate(this%forc_pco2_grc) - deallocate(this%forc_solad_grc) - deallocate(this%forc_solai_grc) - deallocate(this%forc_solar_grc) - deallocate(this%forc_ndep_grc) - deallocate(this%forc_pc13o2_grc) - deallocate(this%forc_po2_grc) - deallocate(this%forc_aer_grc) - deallocate(this%forc_pch4_grc) - - ! atm->lnd not downscaled - deallocate(this%forc_t_not_downscaled_grc) - deallocate(this%forc_q_not_downscaled_grc) - deallocate(this%forc_pbot_not_downscaled_grc) - deallocate(this%forc_th_not_downscaled_grc) - deallocate(this%forc_rho_not_downscaled_grc) - deallocate(this%forc_lwrad_not_downscaled_grc) - deallocate(this%forc_rain_not_downscaled_grc) - deallocate(this%forc_snow_not_downscaled_grc) - - ! atm->lnd downscaled - deallocate(this%forc_t_downscaled_col) - deallocate(this%forc_q_downscaled_col) - deallocate(this%forc_pbot_downscaled_col) - deallocate(this%forc_th_downscaled_col) - deallocate(this%forc_rho_downscaled_col) - deallocate(this%forc_lwrad_downscaled_col) - deallocate(this%forc_rain_downscaled_col) - deallocate(this%forc_snow_downscaled_col) - - ! rof->lnd - deallocate(this%forc_flood_grc) - deallocate(this%volr_grc) - deallocate(this%volrmch_grc) - - ! anomaly forcing - deallocate(this%bc_precip_grc) - deallocate(this%af_precip_grc) - deallocate(this%af_uwind_grc) - deallocate(this%af_vwind_grc) - deallocate(this%af_tbot_grc) - deallocate(this%af_pbot_grc) - deallocate(this%af_shum_grc) - deallocate(this%af_swdn_grc) - deallocate(this%af_lwdn_grc) - - deallocate(this%fsd24_patch) - deallocate(this%fsd240_patch) - deallocate(this%fsi24_patch) - deallocate(this%fsi240_patch) - deallocate(this%prec10_patch) - deallocate(this%prec60_patch) - deallocate(this%prec365_col) - if (use_fates) then - deallocate(this%prec24_patch) - deallocate(this%rh24_patch) - deallocate(this%wind24_patch) - end if - deallocate(this%t_mo_patch) - deallocate(this%t_mo_min_patch) - - end subroutine Clean - - -end module atm2lndType diff --git a/src/main/clm_driver.F90 b/src/main/clm_driver.F90 deleted file mode 100644 index b1a4a9beb8..0000000000 --- a/src/main/clm_driver.F90 +++ /dev/null @@ -1,1446 +0,0 @@ -module clm_driver - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! This module provides the main CLM driver physics calling sequence. Most - ! computations occurs over ``clumps'' of gridcells (and associated subgrid - ! scale entities) assigned to each MPI process. Computation is further - ! parallelized by looping over clumps on each process using shared memory OpenMP. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : wrtdia, iulog, use_fates - use clm_varctl , only : use_cn, use_lch4, use_noio, use_c13, use_c14 - use clm_varctl , only : use_crop, ndep_from_cpl - use clm_time_manager , only : get_nstep, is_beg_curr_day - use clm_time_manager , only : get_prev_date, is_first_step - use clm_varpar , only : nlevsno, nlevgrnd - use clm_varorb , only : obliqr - use spmdMod , only : masterproc, mpicom - use decompMod , only : get_proc_clumps, get_clump_bounds, get_proc_bounds, bounds_type - use filterMod , only : filter, filter_inactive_and_active - use filterMod , only : setExposedvegpFilter - use histFileMod , only : hist_update_hbuf, hist_htapes_wrapup - use restFileMod , only : restFile_write, restFile_filename - use abortutils , only : endrun - ! - use dynSubgridDriverMod , only : dynSubgrid_driver, dynSubgrid_wrapup_weight_changes - use BalanceCheckMod , only : BeginWaterBalance, BalanceCheck - ! - use CanopyTemperatureMod , only : CanopyTemperature ! (formerly Biogeophysics1Mod) - use UrbanTimeVarType , only : urbantv_type - use SoilTemperatureMod , only : SoilTemperature - use LakeTemperatureMod , only : LakeTemperature - ! - use BareGroundFluxesMod , only : BareGroundFluxes - use CanopyFluxesMod , only : CanopyFluxes - use SoilFluxesMod , only : SoilFluxes ! (formerly Biogeophysics2Mod) - use UrbanFluxesMod , only : UrbanFluxes - use LakeFluxesMod , only : LakeFluxes - ! - use HydrologyNoDrainageMod , only : HydrologyNoDrainage ! (formerly Hydrology2Mod) - use HydrologyDrainageMod , only : HydrologyDrainage ! (formerly Hydrology2Mod) - use CanopyHydrologyMod , only : CanopyHydrology ! (formerly Hydrology1Mod) - use LakeHydrologyMod , only : LakeHydrology - ! - use AerosolMod , only : AerosolMasses - use SnowSnicarMod , only : SnowAge_grain - use SurfaceAlbedoMod , only : SurfaceAlbedo - use UrbanAlbedoMod , only : UrbanAlbedo - ! - use SurfaceRadiationMod , only : SurfaceRadiation, CanopySunShadeFracs - use UrbanRadiationMod , only : UrbanRadiation - ! - use SoilBiogeochemVerticalProfileMod , only : SoilBiogeochemVerticalProfile - use SatellitePhenologyMod , only : SatellitePhenology, interpMonthlyVeg - use ndepStreamMod , only : ndep_interp - use ActiveLayerMod , only : alt_calc - use ch4Mod , only : ch4, ch4_init_balance_check - use DUSTMod , only : DustDryDep, DustEmission - use VOCEmissionMod , only : VOCEmission - ! - use filterMod , only : setFilters - ! - use atm2lndMod , only : downscale_forcings - use lnd2atmMod , only : lnd2atm - use lnd2glcMod , only : lnd2glc_type - ! - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use DryDepVelocity , only : depvel_compute - ! - use DaylengthMod , only : UpdateDaylength - use perf_mod - ! - use clm_initializeMod , only : nutrient_competition_method - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use clm_instMod - use clm_initializeMod , only : soil_water_retention_curve - use EDBGCDynMod , only : EDBGCDyn, EDBGCDynSummary - ! - ! !PUBLIC TYPES: - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: clm_drv ! Main clm driver - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: clm_drv_patch2col - private :: clm_drv_init ! Initialization of variables needed from previous timestep - private :: write_diagnostic ! Write diagnostic information to log file - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate, rof_prognostic) - ! - ! !DESCRIPTION: - ! - ! First phase of the clm driver calling the clm physics. An outline of - ! the calling tree is given in the description of this module. - ! - ! !USES: - use clm_time_manager, only : get_curr_date - ! - ! !ARGUMENTS: - implicit none - logical , intent(in) :: doalb ! true if time for surface albedo calc - real(r8), intent(in) :: nextsw_cday ! calendar day for nstep+1 - real(r8), intent(in) :: declinp1 ! declination angle for next time step - real(r8), intent(in) :: declin ! declination angle for current time step - logical, intent(in) :: rstwr ! true => write restart file this step - logical, intent(in) :: nlend ! true => end of run on this step - character(len=*),intent(in) :: rdate ! restart file time stamp for name - - ! Whether we're running with a prognostic ROF component. This shouldn't change from - ! timestep to timestep, but we pass it into the driver loop because it isn't available - ! in initialization. - logical, intent(in) :: rof_prognostic ! whether we're running with a prognostic ROF component - ! - ! !LOCAL VARIABLES: - integer :: nstep ! time step number - integer :: nc, c, p, l, g ! indices - integer :: nclumps ! number of clumps on this processor - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day - integer :: yr_prev ! year (0, ...) at start of timestep - integer :: mon_prev ! month (1, ..., 12) at start of timestep - integer :: day_prev ! day of month (1, ..., 31) at start of timestep - integer :: sec_prev ! seconds of the day at start of timestep - character(len=256) :: filer ! restart file name - integer :: ier ! error code - logical :: need_glacier_initialization ! true if we need to initialize glacier areas in this time step - type(bounds_type) :: bounds_clump - type(bounds_type) :: bounds_proc - - ! COMPILER_BUG(wjs, 2016-02-24, pgi 15.10) These temporary allocatable arrays are - ! needed to work around pgi compiler bugs, as noted below - real(r8), allocatable :: downreg_patch(:) - real(r8), allocatable :: leafn_patch(:) - real(r8), allocatable :: agnpp_patch(:) - real(r8), allocatable :: bgnpp_patch(:) - real(r8), allocatable :: annsum_npp_patch(:) - real(r8), allocatable :: rr_patch(:) - real(r8), allocatable :: net_carbon_exchange_grc(:) - real(r8), allocatable :: froot_carbon(:) - real(r8), allocatable :: croot_carbon(:) - - ! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) Workaround for internal compiler error with - ! pgi 14.7 ('normalize_forall_array: non-conformable'), which appears in the call to - ! CalcIrrigationNeeded. Simply declaring this variable makes the ICE go away. - real(r8), allocatable :: dummy1_to_make_pgi_happy(:) - !----------------------------------------------------------------------- - - ! Determine processor bounds and clumps for this processor - - call get_proc_bounds(bounds_proc) - nclumps = get_proc_clumps() - - ! ======================================================================== - ! In the first time step of a startup or hybrid run, we want to update CLM's glacier - ! areas to match those given by GLC. This is because, in initialization, we do not yet - ! know GLC's glacier areas, so CLM's glacier areas are based on the surface dataset - ! (for a cold start or init_interp run) or the initial conditions file (in a - ! non-init_interp, non-cold start run) - which may not match GLC's glacier areas for - ! this configuration. (Coupling fields from GLC aren't received until the run loop.) - ! Thus, CLM will see a potentially large, fictitious glacier area change in the first - ! time step. We don't want this fictitious area change to result in any state or flux - ! adjustments. Thus, we apply this area change here, at the start of the driver loop, - ! so that in dynSubgrid_driver, it will look like there is no glacier area change in - ! the first time step. (See - ! https://github.com/ESCOMP/ctsm/issues/340#issuecomment-410483131 for more - ! discussion on this.) - ! - ! This needs to happen very early in the run loop, before any balance checks are - ! initialized, because - by design - this doesn't conserve mass at the grid cell - ! level. (The whole point of this code block is that we adjust areas without doing - ! the typical state or flux adjustments that need to accompany those area changes for - ! conservation.) - ! - ! This accomplishes approximately the same effect that we would get if we were able to - ! update glacier areas in initialization. The one difference - and minor, theoretical - ! problem - that could arise from this start-of-run-loop update is: If the first time - ! step of the CESM run loop looked like: (1) GLC runs and updates glacier area (i.e., - ! glacier area changes in the first time step compared with what was set in - ! initialization); (2) coupler passes new glacier area to CLM; (3) CLM runs. Then the - ! code here would mean that the true change in glacier area between initialization and - ! the first time step would be ignored as far as state and flux adjustments are - ! concerned. But this is unlikely to be an issue in practice: Currently GLC doesn't - ! update this frequently, and even if it did, the change in glacier area in a single - ! time step would typically be very small. - ! - ! If we are ever able to change the CESM initialization sequence so that GLC fields - ! are passed to CLM in initialization, then this code block can be removed. - ! ======================================================================== - - need_glacier_initialization = is_first_step() - - if (need_glacier_initialization) then - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds_clump) - - call glc2lnd_inst%update_glc2lnd_fracs( & - bounds = bounds_clump) - - call dynSubgrid_wrapup_weight_changes(bounds_clump, glc_behavior) - - end do - !$OMP END PARALLEL DO - end if - - ! ============================================================================ - ! Specified phenology - ! ============================================================================ - - if (use_cn) then - ! For dry-deposition need to call CLMSP so that mlaidiff is obtained - if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then - call t_startf('interpMonthlyVeg') - call interpMonthlyVeg(bounds_proc, canopystate_inst) - call t_stopf('interpMonthlyVeg') - endif - - 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. - if (doalb .or. ( n_drydep > 0 .and. drydep_method == DD_XLND )) then - call t_startf('interpMonthlyVeg') - call interpMonthlyVeg(bounds_proc, canopystate_inst) - call t_stopf('interpMonthlyVeg') - end if - - end if - - ! ================================================================================== - ! Determine decomp vertical profiles - ! - ! These routines (alt_calc & decomp_vertprofiles) need to be called before - ! pftdyn_cnbal, and it appears that they need to be called before pftdyn_interp and - ! the associated filter updates, too (otherwise we get a carbon balance error) - ! ================================================================================== - - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - ! BUG(wjs, 2014-12-15, bugz 2107) Because of the placement of the following - ! routines (alt_calc and SoilBiogeochemVerticalProfile) in the driver sequence - - ! they are called very early in each timestep, before weights are adjusted and - ! filters are updated - it may be necessary for these routines to compute values - ! over inactive as well as active points (since some inactive points may soon - ! become active) - so that's what is done now. Currently, it seems to be okay to do - ! this, because the variables computed here seem to only depend on quantities that - ! are valid over inactive as well as active points. - - call t_startf("decomp_vert") - call alt_calc(filter_inactive_and_active(nc)%num_soilc, filter_inactive_and_active(nc)%soilc, & - temperature_inst, canopystate_inst) - - if (use_cn) then - call SoilBiogeochemVerticalProfile(bounds_clump , & - filter_inactive_and_active(nc)%num_soilc, filter_inactive_and_active(nc)%soilc , & - filter_inactive_and_active(nc)%num_soilp, filter_inactive_and_active(nc)%soilp , & - canopystate_inst, soilstate_inst, soilbiogeochem_state_inst) - end if - - call t_stopf("decomp_vert") - end do - !$OMP END PARALLEL DO - - ! ============================================================================ - ! Initialize the mass balance checks for carbon and nitrogen, and zero fluxes for - ! transient land cover - ! ============================================================================ - - if (use_cn) then - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call t_startf('cninit') - - call bgc_vegetation_inst%InitEachTimeStep(bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc) - - call t_stopf('cninit') - end do - !$OMP END PARALLEL DO - end if - - ! ============================================================================ - ! Update subgrid weights with dynamic landcover (prescribed transient patches, - ! CNDV, and or dynamic landunits), and do related adjustments. Note that this - ! call needs to happen outside loops over nclumps. - ! ============================================================================ - - call t_startf('dyn_subgrid') - call dynSubgrid_driver(bounds_proc, & - urbanparams_inst, soilstate_inst, soilhydrology_inst, & - waterstate_inst, waterflux_inst, temperature_inst, energyflux_inst, & - canopystate_inst, photosyns_inst, crop_inst, glc2lnd_inst, bgc_vegetation_inst, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_carbonflux_inst, ch4_inst, & - glc_behavior) - call t_stopf('dyn_subgrid') - - ! ============================================================================ - ! Initialize the column-level mass balance checks for water, carbon & nitrogen. - ! - ! For water: Currently, I believe this needs to be done after weights are updated for - ! prescribed transient patches or CNDV, because column-level water is not generally - ! conserved when weights change (instead the difference is put in the grid cell-level - ! terms, qflx_liq_dynbal, etc.). In the future, we may want to change the balance - ! checks to ensure that the grid cell-level water is conserved, considering - ! qflx_liq_dynbal; in this case, the call to BeginWaterBalance should be moved to - ! before the weight updates. - ! - ! For carbon & nitrogen: This needs to be done after dynSubgrid_driver, because the - ! changes due to dynamic area adjustments can break column-level conservation - ! ============================================================================ - - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call t_startf('begwbal') - call BeginWaterBalance(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_lakec, filter(nc)%lakec, & - soilhydrology_inst, waterstate_inst) - - call t_stopf('begwbal') - - call t_startf('begcnbal_col') - if (use_cn) then - call bgc_vegetation_inst%InitColumnBalance(bounds_clump, & - filter(nc)%num_allc, filter(nc)%allc, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenstate_inst) - end if - - if (use_lch4) then - call ch4_init_balance_check(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_lakec, filter(nc)%lakec, & - ch4_inst) - end if - call t_stopf('begcnbal_col') - - end do - !$OMP END PARALLEL DO - - ! ============================================================================ - ! Update dynamic N deposition field, on albedo timestep - ! currently being done outside clumps loop, but no reason why it couldn't be - ! re-written to go inside. - ! ============================================================================ - - if (use_cn) then - call t_startf('bgc_interp') - if (.not. ndep_from_cpl) then - call ndep_interp(bounds_proc, atm2lnd_inst) - end if - call bgc_vegetation_inst%InterpFileInputs(bounds_proc) - call t_stopf('bgc_interp') - end if - - ! Get time varying urban data - call urbantv_inst%urbantv_interp(bounds_proc) - - ! ============================================================================ - ! Initialize variables from previous time step, downscale atm forcings, and - ! Determine canopy interception and precipitation onto ground surface. - ! Determine the fraction of foliage covered by water and the fraction - ! of foliage that is dry and transpiring. Initialize snow layer if the - ! snow accumulation exceeds 10 mm. - ! ============================================================================ - - ! Get time as of beginning of time step - call get_prev_date(yr_prev, mon_prev, day_prev, sec_prev) - - !$OMP PARALLEL DO PRIVATE (nc,l,c, bounds_clump, downreg_patch, leafn_patch, agnpp_patch, bgnpp_patch, annsum_npp_patch, rr_patch, froot_carbon, croot_carbon) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call t_startf('drvinit') - - call UpdateDaylength(bounds_clump, declin=declin, obliquity=obliqr) - - ! Initialze variables needed for new driver time step - call clm_drv_init(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep, & - filter(nc)%num_soilp , filter(nc)%soilp, & - canopystate_inst, waterstate_inst, waterflux_inst, energyflux_inst) - - call topo_inst%UpdateTopo(bounds_clump, & - filter(nc)%num_icemecc, filter(nc)%icemecc, & - glc2lnd_inst, glc_behavior, & - atm_topo = atm2lnd_inst%forc_topo_grc(bounds_clump%begg:bounds_clump%endg)) - - call downscale_forcings(bounds_clump, & - topo_inst, atm2lnd_inst, & - eflx_sh_precip_conversion = energyflux_inst%eflx_sh_precip_conversion_col(bounds_clump%begc:bounds_clump%endc)) - - ! Update filters that depend on variables set in clm_drv_init - - call setExposedvegpFilter(bounds_clump, & - canopystate_inst%frac_veg_nosno_patch(bounds_clump%begp:bounds_clump%endp)) - - ! Irrigation flux - ! input is main channel storage - call irrigation_inst%ApplyIrrigation(bounds_clump) - call t_stopf('drvinit') - - ! ============================================================================ - ! Canopy Hydrology - ! (1) water storage of intercepted precipitation - ! (2) direct throughfall and canopy drainage of precipitation - ! (3) fraction of foliage covered by water and the fraction is dry and transpiring - ! (4) snow layer initialization if the snow accumulation exceeds 10 mm. - ! ============================================================================ - - call t_startf('canhydro') - call CanopyHydrology(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep, & - atm2lnd_inst, canopystate_inst, temperature_inst, & - aerosol_inst, waterstate_inst, waterflux_inst, & - irrigation_inst) - call t_stopf('canhydro') - - ! ============================================================================ - ! Surface Radiation - ! ============================================================================ - - call t_startf('surfrad') - - ! Surface Radiation primarily for non-urban columns - - ! Most of the surface radiation calculations are agnostic to the forest-model - ! but the calculations of the fractions of sunlit and shaded canopies - ! are specific, calculate them first. - ! The nourbanp filter is set in dySubgrid_driver (earlier in this call) - ! over the patch index range defined by bounds_clump%begp:bounds_proc%endp - - if(use_fates) then - call clm_fates%wrap_sunfrac(nc,atm2lnd_inst, canopystate_inst) - else - call CanopySunShadeFracs(filter(nc)%nourbanp,filter(nc)%num_nourbanp, & - atm2lnd_inst, surfalb_inst, canopystate_inst, & - solarabs_inst) - end if - - - - call SurfaceRadiation(bounds_clump, & - filter(nc)%num_nourbanp, filter(nc)%nourbanp, & - filter(nc)%num_urbanp, filter(nc)%urbanp, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - atm2lnd_inst, waterstate_inst, canopystate_inst, surfalb_inst, & - solarabs_inst, surfrad_inst) - - ! Surface Radiation for only urban columns - - call UrbanRadiation(bounds_clump, & - filter(nc)%num_nourbanl, filter(nc)%nourbanl, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_urbanp, filter(nc)%urbanp, & - atm2lnd_inst, waterstate_inst, temperature_inst, urbanparams_inst, & - solarabs_inst, surfalb_inst, energyflux_inst) - - call t_stopf('surfrad') - - ! ============================================================================ - ! Determine leaf temperature and surface fluxes based on ground - ! temperature from previous time step. - ! ============================================================================ - - call t_startf('bgp1') - call CanopyTemperature(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep, & - clm_fates, & - atm2lnd_inst, canopystate_inst, soilstate_inst, frictionvel_inst, & - waterstate_inst, waterflux_inst, energyflux_inst, temperature_inst) - call t_stopf('bgp1') - - ! ============================================================================ - ! Determine fluxes - ! ============================================================================ - - call t_startf('bgflux') - - ! Bareground fluxes for all patches except lakes and urban landunits - - call BareGroundFluxes(bounds_clump, & - filter(nc)%num_noexposedvegp, filter(nc)%noexposedvegp, & - atm2lnd_inst, soilstate_inst, & - frictionvel_inst, ch4_inst, energyflux_inst, temperature_inst, & - waterflux_inst, waterstate_inst, photosyns_inst, humanindex_inst) - call t_stopf('bgflux') - - ! non-bareground fluxes for all patches except lakes and urban landunits - ! Calculate canopy temperature, latent and sensible fluxes from the canopy, - ! and leaf water change by evapotranspiration - - call t_startf('canflux') - - ! COMPILER_BUG(wjs, 2016-02-24, pgi 15.10) In principle, we should be able to make - ! these function calls inline in the CanopyFluxes argument list. However, with pgi - ! 15.10, that results in the dummy arguments having the wrong size (I suspect size - ! 0, based on similar pgi compiler bugs that we have run into before). Also note - ! that I don't have explicit bounds on the left-hand-side of these assignments: - ! excluding these explicit bounds seemed to be needed to get around other compiler - ! bugs. - allocate(downreg_patch(bounds_clump%begp:bounds_clump%endp)) - allocate(leafn_patch(bounds_clump%begp:bounds_clump%endp)) - downreg_patch = bgc_vegetation_inst%get_downreg_patch(bounds_clump) - leafn_patch = bgc_vegetation_inst%get_leafn_patch(bounds_clump) - - allocate(froot_carbon(bounds_clump%begp:bounds_clump%endp)) - allocate(croot_carbon(bounds_clump%begp:bounds_clump%endp)) - froot_carbon = bgc_vegetation_inst%get_froot_carbon_patch( & - bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp)) - croot_carbon = bgc_vegetation_inst%get_croot_carbon_patch( & - bounds_clump, canopystate_inst%tlai_patch(bounds_clump%begp:bounds_clump%endp)) - - call CanopyFluxes(bounds_clump, & - filter(nc)%num_exposedvegp, filter(nc)%exposedvegp, & - clm_fates,nc, & - atm2lnd_inst, canopystate_inst, & - energyflux_inst, frictionvel_inst, soilstate_inst, solarabs_inst, surfalb_inst, & - temperature_inst, waterflux_inst, waterstate_inst, ch4_inst, ozone_inst, photosyns_inst, & - humanindex_inst, soil_water_retention_curve, & - 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)) - deallocate(downreg_patch, leafn_patch, froot_carbon, croot_carbon) - call t_stopf('canflux') - - ! Fluxes for all urban landunits - - call t_startf('uflux') - call UrbanFluxes(bounds_clump, & - filter(nc)%num_nourbanl, filter(nc)%nourbanl, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_urbanp, filter(nc)%urbanp, & - atm2lnd_inst, urbanparams_inst, soilstate_inst, temperature_inst, & - waterstate_inst, frictionvel_inst, energyflux_inst, waterflux_inst, & - humanindex_inst) - call t_stopf('uflux') - - ! Fluxes for all lake landunits - - call t_startf('bgplake') - call LakeFluxes(bounds_clump, & - filter(nc)%num_lakec, filter(nc)%lakec, & - filter(nc)%num_lakep, filter(nc)%lakep, & - atm2lnd_inst, solarabs_inst, frictionvel_inst, temperature_inst, & - energyflux_inst, waterstate_inst, waterflux_inst, lakestate_inst,& - humanindex_inst) - call t_stopf('bgplake') - - ! ============================================================================ - ! Determine irrigation needed for future time steps - ! ============================================================================ - - ! NOTE(wjs, 2016-09-08) The placement of this call in the driver is historical: it - ! used to be that it had to come after btran was computed. Now it no longer depends - ! on btran, so it could be moved earlier in the driver loop - possibly even - ! immediately before ApplyIrrigation, which would be a more clear place to put it. - - call t_startf('irrigationneeded') - call irrigation_inst%CalcIrrigationNeeded( & - bounds = bounds_clump, & - num_exposedvegp = filter(nc)%num_exposedvegp, & - filter_exposedvegp = filter(nc)%exposedvegp, & - time_prev = sec_prev, & - elai = canopystate_inst%elai_patch(bounds_clump%begp:bounds_clump%endp), & - t_soisno = temperature_inst%t_soisno_col(bounds_clump%begc:bounds_clump%endc , 1:nlevgrnd), & - eff_porosity = soilstate_inst%eff_porosity_col(bounds_clump%begc:bounds_clump%endc, 1:nlevgrnd), & - h2osoi_liq = waterstate_inst%h2osoi_liq_col(bounds_clump%begc:bounds_clump%endc , 1:nlevgrnd), & - volr = atm2lnd_inst%volrmch_grc(bounds_clump%begg:bounds_clump%endg), & - rof_prognostic = rof_prognostic) - call t_stopf('irrigationneeded') - - ! ============================================================================ - ! DUST and VOC emissions - ! ============================================================================ - - call t_startf('bgc') - - ! Dust mobilization (C. Zender's modified codes) - call DustEmission(bounds_clump, & - filter(nc)%num_nolakep, filter(nc)%nolakep, & - atm2lnd_inst, soilstate_inst, canopystate_inst, waterstate_inst, & - frictionvel_inst, dust_inst) - - ! Dust dry deposition (C. Zender's modified codes) - call DustDryDep(bounds_clump, & - atm2lnd_inst, frictionvel_inst, dust_inst) - - ! VOC emission (A. Guenther's MEGAN (2006) model) - call VOCEmission(bounds_clump, & - filter(nc)%num_soilp, filter(nc)%soilp, & - atm2lnd_inst, canopystate_inst, photosyns_inst, temperature_inst, & - vocemis_inst) - - call t_stopf('bgc') - - ! ============================================================================ - ! Determine temperatures - ! ============================================================================ - - ! Set lake temperature - - call t_startf('lakeTemp') - call LakeTemperature(bounds_clump, & - filter(nc)%num_lakec, filter(nc)%lakec, & - filter(nc)%num_lakep, filter(nc)%lakep, & - solarabs_inst, soilstate_inst, waterstate_inst, waterflux_inst, ch4_inst, & - energyflux_inst, temperature_inst, lakestate_inst) - call t_stopf('lakeTemp') - - ! Set soil/snow temperatures including ground temperature - - call t_startf('soiltemperature') - call SoilTemperature(bounds_clump, & - filter(nc)%num_urbanl , filter(nc)%urbanl, & - filter(nc)%num_nolakec , filter(nc)%nolakec, & - atm2lnd_inst, urbanparams_inst, canopystate_inst, waterstate_inst, waterflux_inst, & - solarabs_inst, soilstate_inst, energyflux_inst, temperature_inst, urbantv_inst) - - ! The following is called immediately after SoilTemperature so that melted ice is - ! converted back to solid ice as soon as possible - call glacier_smb_inst%HandleIceMelt(bounds_clump, & - filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, & - waterstate_inst) - call t_stopf('soiltemperature') - - ! ============================================================================ - ! update surface fluxes for new ground temperature. - ! ============================================================================ - - call t_startf('bgp2') - call SoilFluxes(bounds_clump, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanp, filter(nc)%urbanp, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep, & - atm2lnd_inst, solarabs_inst, temperature_inst, canopystate_inst, waterstate_inst, & - energyflux_inst, waterflux_inst) - call t_stopf('bgp2') - - ! ============================================================================ - ! Perform averaging from patch level to column level - ! ============================================================================ - - call t_startf('patch2col') - call clm_drv_patch2col(bounds_clump, & - filter(nc)%num_allc, filter(nc)%allc, filter(nc)%num_nolakec, filter(nc)%nolakec, & - energyflux_inst, waterflux_inst) - call t_stopf('patch2col') - - ! ============================================================================ - ! Vertical (column) soil and surface hydrology - ! ============================================================================ - - ! Note that filter_snowc and filter_nosnowc are returned by - ! LakeHydrology after the new snow filter is built - - call t_startf('hydro_without_drainage') - - call HydrologyNoDrainage(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_hydrologyc, filter(nc)%hydrologyc, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_snowc, filter(nc)%snowc, & - filter(nc)%num_nosnowc, filter(nc)%nosnowc, & - clm_fates, & - atm2lnd_inst, soilstate_inst, energyflux_inst, temperature_inst, & - waterflux_inst, waterstate_inst, soilhydrology_inst, aerosol_inst, & - canopystate_inst, soil_water_retention_curve, topo_inst) - - ! The following needs to be done after HydrologyNoDrainage (because it needs - ! waterflux_inst%qflx_snwcp_ice_col), but before HydrologyDrainage (because - ! HydrologyDrainage calls glacier_smb_inst%AdjustRunoffTerms, which depends on - ! ComputeSurfaceMassBalance having already been called). - call glacier_smb_inst%ComputeSurfaceMassBalance(bounds_clump, & - filter(nc)%num_allc, filter(nc)%allc, & - filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, & - glc2lnd_inst, waterstate_inst, waterflux_inst) - - ! Calculate column-integrated aerosol masses, and - ! mass concentrations for radiative calculations and output - ! (based on new snow level state, after SnowFilter is rebuilt. - ! NEEDS TO BE AFTER SnowFiler is rebuilt, otherwise there - ! can be zero snow layers but an active column in filter) - - call AerosolMasses( bounds_clump, & - num_on=filter(nc)%num_snowc, filter_on=filter(nc)%snowc, & - num_off=filter(nc)%num_nosnowc, filter_off=filter(nc)%nosnowc, & - waterflux_inst=waterflux_inst, & - waterstate_inst=waterstate_inst, & - aerosol_inst=aerosol_inst) - - call t_stopf('hydro_without_drainage') - - ! ============================================================================ - ! Lake hydrology - ! ============================================================================ - - ! Note that filter_lakesnowc and filter_lakenosnowc are returned by - ! LakeHydrology after the new snow filter is built - - call t_startf('hylake') - call LakeHydrology(bounds_clump, & - filter(nc)%num_lakec, filter(nc)%lakec, & - filter(nc)%num_lakep, filter(nc)%lakep, & - filter(nc)%num_lakesnowc, filter(nc)%lakesnowc, & - filter(nc)%num_lakenosnowc, filter(nc)%lakenosnowc, & - atm2lnd_inst, temperature_inst, soilstate_inst, waterstate_inst, waterflux_inst, & - energyflux_inst, aerosol_inst, lakestate_inst, topo_inst) - - ! Calculate column-integrated aerosol masses, and - ! mass concentrations for radiative calculations and output - ! (based on new snow level state, after SnowFilter is rebuilt. - ! NEEDS TO BE AFTER SnowFiler is rebuilt, otherwise there - ! can be zero snow layers but an active column in filter) - - call AerosolMasses(bounds_clump, & - num_on=filter(nc)%num_lakesnowc, filter_on=filter(nc)%lakesnowc, & - num_off=filter(nc)%num_lakenosnowc, filter_off=filter(nc)%lakenosnowc, & - waterflux_inst=waterflux_inst, & - waterstate_inst=waterstate_inst, & - aerosol_inst=aerosol_inst) - - ! Must be done here because must use a snow filter for lake columns - - call SnowAge_grain(bounds_clump, & - filter(nc)%num_lakesnowc, filter(nc)%lakesnowc, & - filter(nc)%num_lakenosnowc, filter(nc)%lakenosnowc, & - waterflux_inst, waterstate_inst, temperature_inst, & - atm2lnd_inst) - - call t_stopf('hylake') - - ! ============================================================================ - ! ! Fraction of soil covered by snow (Z.-L. Yang U. Texas) - ! ============================================================================ - call t_startf('snow_init') - - do c = bounds_clump%begc,bounds_clump%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - ! Urban landunit use Bonan 1996 (LSM Technical Note) - waterstate_inst%frac_sno_col(c) = min( waterstate_inst%snow_depth_col(c)/0.05_r8, 1._r8) - end if - end do - - ! ============================================================================ - ! Snow aging routine based on Flanner and Zender (2006), Linking snowpack - ! microphysics and albedo evolution, JGR, and Brun (1989), Investigation of - ! wet-snow metamorphism in respect of liquid-water content, Ann. Glaciol. - ! ============================================================================ - ! Note the snow filters here do not include lakes - ! TODO: move this up - - call SnowAge_grain(bounds_clump, & - filter(nc)%num_snowc, filter(nc)%snowc, & - filter(nc)%num_nosnowc, filter(nc)%nosnowc, & - waterflux_inst, waterstate_inst, temperature_inst, & - atm2lnd_inst) - call t_stopf('snow_init') - - ! ============================================================================ - ! Ecosystem dynamics: Uses CN, CNDV, or static parameterizations - ! ============================================================================ - - ! FIX(SPM,032414) push these checks into the routines below and/or make this consistent. - - ! fully prognostic canopy structure and C-N biogeochemistry - ! - CNDV defined: prognostic biogeography; else prescribed - ! - crop model: crop algorithms called from within CNDriver - - if (use_cn) then - call t_startf('ecosysdyn') - 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, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst, & - photosyns_inst, soilhydrology_inst, energyflux_inst, & - nutrient_competition_method, fireemis_inst) - - call t_stopf('ecosysdyn') - - end if - - ! Prescribed biogeography - prescribed canopy structure, some prognostic carbon fluxes - - if ((.not. use_cn) .and. (.not. use_fates) .and. (doalb)) then - call t_startf('SatellitePhenology') - call SatellitePhenology(bounds_clump, filter(nc)%num_nolakep, filter(nc)%nolakep, & - waterstate_inst, canopystate_inst) - call t_stopf('SatellitePhenology') - end if - - ! Dry Deposition of chemical tracers (Wesely (1998) parameterizaion) - - call t_startf('depvel') - call depvel_compute(bounds_clump, & - atm2lnd_inst, canopystate_inst, waterstate_inst, frictionvel_inst, & - photosyns_inst, drydepvel_inst) - call t_stopf('depvel') - - ! ============================================================================ - ! Calculate soil/snow hydrology with drainage (subsurface runoff) - ! ============================================================================ - - call t_startf('hydro2_drainage') - - call HydrologyDrainage(bounds_clump, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_hydrologyc, filter(nc)%hydrologyc, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, & - atm2lnd_inst, glc2lnd_inst, temperature_inst, & - soilhydrology_inst, soilstate_inst, waterstate_inst, waterflux_inst, & - irrigation_inst, glacier_smb_inst) - - call t_stopf('hydro2_drainage') - - if (use_cn) then - - call t_startf('EcosysDynPostDrainage') - call bgc_vegetation_inst%EcosystemDynamicsPostDrainage(bounds_clump, & - filter(nc)%num_allc, filter(nc)%allc, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - doalb, crop_inst, & - waterstate_inst, waterflux_inst, frictionvel_inst, canopystate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - call t_stopf('EcosysDynPostDrainage') - - end if - - if ( use_fates .and. is_beg_curr_day() ) then ! run fates at the start of each day - - if ( masterproc ) then - write(iulog,*) 'clm: calling FATES model ', get_nstep() - end if - - call clm_fates%dynamics_driv( nc, bounds_clump, & - atm2lnd_inst, soilstate_inst, temperature_inst, & - waterstate_inst, canopystate_inst, soilbiogeochem_carbonflux_inst,& - frictionvel_inst) - - ! TODO(wjs, 2016-04-01) I think this setFilters call should be replaced by a - ! call to reweight_wrapup, if it's needed at all. - call setFilters( bounds_clump, glc_behavior ) - - end if ! use_fates branch - - - if ( use_fates ) then - - call EDBGCDyn(bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - filter(nc)%num_pcropp, filter(nc)%pcropp, doalb, & - bgc_vegetation_inst%cnveg_carbonflux_inst, & - bgc_vegetation_inst%cnveg_carbonstate_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - soilbiogeochem_state_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - atm2lnd_inst, waterstate_inst, waterflux_inst, & - canopystate_inst, soilstate_inst, temperature_inst, crop_inst, ch4_inst) - - call EDBGCDynSummary(bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_carbonstate_inst, & - c13_soilbiogeochem_carbonflux_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonflux_inst, c14_soilbiogeochem_carbonstate_inst, & - soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst, & - clm_fates, nc) - end if - - - - ! ============================================================================ - ! Check the energy and water balance and also carbon and nitrogen balance - ! ============================================================================ - - call t_startf('balchk') - call BalanceCheck(bounds_clump, & - atm2lnd_inst, solarabs_inst, waterflux_inst, & - waterstate_inst, irrigation_inst, glacier_smb_inst, & - energyflux_inst, canopystate_inst) - call t_stopf('balchk') - - ! ============================================================================ - ! Check the carbon and nitrogen balance - ! ============================================================================ - - if (use_cn) then - call t_startf('cnbalchk') - call bgc_vegetation_inst%BalanceCheck( & - bounds_clump, filter(nc)%num_soilc, filter(nc)%soilc, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenflux_inst) - call t_stopf('cnbalchk') - end if - - ! Calculation of methane fluxes - - if (use_lch4) then - call t_startf('ch4') - ! COMPILER_BUG(wjs, 2016-02-24, pgi 15.10) In principle, we should be able to - ! make these function calls inline in the CanopyFluxes argument list. However, - ! with pgi 15.10, that results in the dummy arguments having the wrong size (I - ! suspect size 0, based on similar pgi compiler bugs that we have run into - ! before). Also note that I don't have explicit bounds on the left-hand-side of - ! these assignments: excluding these explicit bounds seemed to be needed to get - ! around other compiler bugs. - allocate(agnpp_patch(bounds_clump%begp:bounds_clump%endp)) - allocate(bgnpp_patch(bounds_clump%begp:bounds_clump%endp)) - allocate(annsum_npp_patch(bounds_clump%begp:bounds_clump%endp)) - allocate(rr_patch(bounds_clump%begp:bounds_clump%endp)) - agnpp_patch = bgc_vegetation_inst%get_agnpp_patch(bounds_clump) - bgnpp_patch = bgc_vegetation_inst%get_bgnpp_patch(bounds_clump) - annsum_npp_patch = bgc_vegetation_inst%get_annsum_npp_patch(bounds_clump) - rr_patch = bgc_vegetation_inst%get_root_respiration_patch(bounds_clump) - - call ch4 (bounds_clump, & - filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_lakec, filter(nc)%lakec, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_soilp, filter(nc)%soilp, & - atm2lnd_inst, lakestate_inst, canopystate_inst, soilstate_inst, soilhydrology_inst, & - temperature_inst, energyflux_inst, waterstate_inst, waterflux_inst, & - soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenflux_inst, ch4_inst, lnd2atm_inst, & - agnpp = agnpp_patch(bounds_clump%begp:bounds_clump%endp), & - bgnpp = bgnpp_patch(bounds_clump%begp:bounds_clump%endp), & - annsum_npp = annsum_npp_patch(bounds_clump%begp:bounds_clump%endp), & - rr = rr_patch(bounds_clump%begp:bounds_clump%endp)) - deallocate(agnpp_patch, bgnpp_patch, annsum_npp_patch, rr_patch) - call t_stopf('ch4') - end if - - ! ============================================================================ - ! Determine albedos for next time step - ! ============================================================================ - - if (doalb) then - - ! Albedos for non-urban columns - call t_startf('surfalb') - call SurfaceAlbedo(bounds_clump, & - nc, & - filter_inactive_and_active(nc)%num_nourbanc, & - filter_inactive_and_active(nc)%nourbanc, & - filter_inactive_and_active(nc)%num_nourbanp, & - filter_inactive_and_active(nc)%nourbanp, & - filter_inactive_and_active(nc)%num_urbanc, & - filter_inactive_and_active(nc)%urbanc, & - filter_inactive_and_active(nc)%num_urbanp, & - filter_inactive_and_active(nc)%urbanp, & - nextsw_cday, declinp1, & - clm_fates, & - aerosol_inst, canopystate_inst, waterstate_inst, & - lakestate_inst, temperature_inst, surfalb_inst) - - call t_stopf('surfalb') - - ! Albedos for urban columns - if (filter_inactive_and_active(nc)%num_urbanl > 0) then - call t_startf('urbalb') - call UrbanAlbedo(bounds_clump, & - filter_inactive_and_active(nc)%num_urbanl, & - filter_inactive_and_active(nc)%urbanl, & - filter_inactive_and_active(nc)%num_urbanc, & - filter_inactive_and_active(nc)%urbanc, & - filter_inactive_and_active(nc)%num_urbanp, & - filter_inactive_and_active(nc)%urbanp, & - waterstate_inst, urbanparams_inst, & - solarabs_inst, surfalb_inst) - call t_stopf('urbalb') - end if - - end if - - end do - !$OMP END PARALLEL DO - - ! ============================================================================ - ! Determine gridcell averaged properties to send to atm - ! ============================================================================ - - call t_startf('lnd2atm') - ! COMPILER_BUG(wjs, 2016-02-24, pgi 15.10) In principle, we should be able to make - ! this function call inline in the CanopyFluxes argument list. However, with pgi - ! 15.10, that results in the dummy argument having the wrong size (I suspect size 0, - ! based on similar pgi compiler bugs that we have run into before). Also note that I - ! don't have explicit bounds on the left-hand-side of this assignment: excluding these - ! explicit bounds seemed to be needed to get around other compiler bugs. - allocate(net_carbon_exchange_grc(bounds_proc%begg:bounds_proc%endg)) - net_carbon_exchange_grc = bgc_vegetation_inst%get_net_carbon_exchange_grc(bounds_proc) - - call lnd2atm(bounds_proc, & - atm2lnd_inst, surfalb_inst, temperature_inst, frictionvel_inst, & - waterstate_inst, waterflux_inst, irrigation_inst, energyflux_inst, & - solarabs_inst, drydepvel_inst, & - vocemis_inst, fireemis_inst, dust_inst, ch4_inst, glc_behavior, & - lnd2atm_inst, & - net_carbon_exchange_grc = net_carbon_exchange_grc(bounds_proc%begg:bounds_proc%endg)) - deallocate(net_carbon_exchange_grc) - call t_stopf('lnd2atm') - - ! ============================================================================ - ! Determine gridcell averaged properties to send to glc - ! ============================================================================ - - call t_startf('lnd2glc') - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - call lnd2glc_inst%update_lnd2glc(bounds_clump, & - filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, & - temperature_inst, glacier_smb_inst, topo_inst, & - init=.false.) - end do - !$OMP END PARALLEL DO - call t_stopf('lnd2glc') - - ! ============================================================================ - ! Write global average diagnostics to standard output - ! ============================================================================ - - nstep = get_nstep() - if (wrtdia) call mpi_barrier(mpicom,ier) - call t_startf('wrtdiag') - call write_diagnostic(bounds_proc, wrtdia, nstep, lnd2atm_inst) - call t_stopf('wrtdiag') - - ! ============================================================================ - ! Update accumulators - ! ============================================================================ - - ! FIX(SPM,032414) double check why this isn't called for ED - ! FIX(SPM, 082814) - in the fates branch RF and I commented out the if(.not. - ! use_fates) then statement ... double check if this is required and why - - if (nstep > 0) then - call t_startf('accum') - - call atm2lnd_inst%UpdateAccVars(bounds_proc) - - call temperature_inst%UpdateAccVars(bounds_proc) - - call canopystate_inst%UpdateAccVars(bounds_proc) - - call waterflux_inst%UpdateAccVars(bounds_proc) - - call energyflux_inst%UpdateAccVars(bounds_proc) - - ! COMPILER_BUG(wjs, 2014-11-30, pgi 14.7) For pgi 14.7 to be happy when - ! compiling this threaded, I needed to change the dummy arguments to be - ! pointers, and get rid of the explicit bounds in the subroutine call. - ! call bgc_vegetation_inst%UpdateAccVars(bounds_proc, & - ! t_a10_patch=temperature_inst%t_a10_patch(bounds_proc%begp:bounds_proc%endp), & - ! t_ref2m_patch=temperature_inst%t_ref2m_patch(bounds_proc%begp:bounds_proc%endp)) - call bgc_vegetation_inst%UpdateAccVars(bounds_proc, & - t_a10_patch=temperature_inst%t_a10_patch, & - t_ref2m_patch=temperature_inst%t_ref2m_patch) - - if (use_crop) then - call crop_inst%CropUpdateAccVars(bounds_proc, & - temperature_inst%t_ref2m_patch, temperature_inst%t_soisno_col) - end if - - call t_stopf('accum') - end if - - ! ============================================================================ - ! Update history buffer - ! ============================================================================ - - - call t_startf('hbuf') - call hist_update_hbuf(bounds_proc) - call t_stopf('hbuf') - - ! ============================================================================ - ! Call dv (dynamic vegetation) - ! ============================================================================ - - if (use_cn) then - call t_startf('endTSdynveg') - nclumps = get_proc_clumps() - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - call bgc_vegetation_inst%EndOfTimeStepVegDynamics(bounds_clump, & - filter(nc)%num_natvegp, filter(nc)%natvegp, & - atm2lnd_inst) - end do - !$OMP END PARALLEL DO - call t_stopf('endTSdynveg') - end if - - ! ============================================================================ - ! History/Restart output - ! ============================================================================ - - if (.not. use_noio) then - - call t_startf('clm_drv_io') - - ! Create history and write history tapes if appropriate - call t_startf('clm_drv_io_htapes') - - call hist_htapes_wrapup( rstwr, nlend, bounds_proc, & - soilstate_inst%watsat_col(bounds_proc%begc:bounds_proc%endc, 1:), & - soilstate_inst%sucsat_col(bounds_proc%begc:bounds_proc%endc, 1:), & - soilstate_inst%bsw_col(bounds_proc%begc:bounds_proc%endc, 1:), & - soilstate_inst%hksat_col(bounds_proc%begc:bounds_proc%endc, 1:)) - - call t_stopf('clm_drv_io_htapes') - - if (use_cn) then - call bgc_vegetation_inst%WriteHistory(bounds_proc) - end if - - ! Write restart/initial files if appropriate - if (rstwr) then - call t_startf('clm_drv_io_wrest') - filer = restFile_filename(rdate=rdate) - - call restFile_write( bounds_proc, filer, rdate=rdate ) - - call t_stopf('clm_drv_io_wrest') - end if - call t_stopf('clm_drv_io') - - end if - - end subroutine clm_drv - - !----------------------------------------------------------------------- - subroutine clm_drv_init(bounds, & - num_nolakec, filter_nolakec, & - num_nolakep, filter_nolakep, & - num_soilp , filter_soilp, & - canopystate_inst, waterstate_inst, waterflux_inst, energyflux_inst) - ! - ! !DESCRIPTION: - ! Initialization of clm driver variables needed from previous timestep - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : nlevsno - use CanopyStateType , only : canopystate_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use EnergyFluxType , only : energyflux_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_nolakec ! number of non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - integer , intent(in) :: num_nolakep ! number of non-lake points in patch filter - integer , intent(in) :: filter_nolakep(:) ! patch filter for non-lake points - integer , intent(in) :: num_soilp ! number of soil points in patch filter - integer , intent(in) :: filter_soilp(:) ! patch filter for soil points - type(canopystate_type), intent(inout) :: canopystate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c, p, f, j ! indices - integer :: fp, fc ! filter indices - !----------------------------------------------------------------------- - - associate( & - snl => col%snl , & ! Input: [integer (:) ] number of snow layers - - h2osno => waterstate_inst%h2osno_col , & ! Input: [real(r8) (:) ] snow water (mm H2O) - h2osoi_ice => waterstate_inst%h2osoi_ice_col , & ! Input: [real(r8) (:,:) ] ice lens (kg/m2) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) - h2osno_old => waterstate_inst%h2osno_old_col , & ! Output: [real(r8) (:) ] snow water (mm H2O) at previous time step - frac_iceold => waterstate_inst%frac_iceold_col , & ! Output: [real(r8) (:,:) ] fraction of ice relative to the tot water - - elai => canopystate_inst%elai_patch , & ! Input: [real(r8) (:) ] one-sided leaf area index with burying by snow - esai => canopystate_inst%esai_patch , & ! Input: [real(r8) (:) ] one-sided stem area index with burying by snow - frac_veg_nosno => canopystate_inst%frac_veg_nosno_patch , & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch , & ! Output: [integer (:) ] fraction of vegetation not covered by snow (0 OR 1) [-] - - eflx_bot => energyflux_inst%eflx_bot_col , & ! Output: [real(r8) (:) ] heat flux from beneath soil/ice column (W/m**2) - - cisun_z => photosyns_inst%cisun_z_patch , & ! Output: [real(r8) (:) ] intracellular sunlit leaf CO2 (Pa) - cisha_z => photosyns_inst%cisha_z_patch & ! Output: [real(r8) (:) ] intracellular shaded leaf CO2 (Pa) - ) - - ! Initialize intracellular CO2 (Pa) parameters each timestep for use in VOCEmission - do p = bounds%begp,bounds%endp - cisun_z(p,:) = -999._r8 - cisha_z(p,:) = -999._r8 - end do - - do c = bounds%begc,bounds%endc - ! Save snow mass at previous time step - h2osno_old(c) = h2osno(c) - - ! Reset flux from beneath soil/ice column - eflx_bot(c) = 0._r8 - end do - - ! Initialize fraction of vegetation not covered by snow - - do p = bounds%begp,bounds%endp - if (patch%active(p)) then - frac_veg_nosno(p) = frac_veg_nosno_alb(p) - else - frac_veg_nosno(p) = 0._r8 - end if - end do - - ! Initialize set of previous time-step variables - ! Ice fraction of snow at previous time step - - do j = -nlevsno+1,0 - do f = 1, num_nolakec - c = filter_nolakec(f) - if (j >= snl(c) + 1) then - frac_iceold(c,j) = h2osoi_ice(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j)) - end if - end do - end do - - end associate - - end subroutine clm_drv_init - - !----------------------------------------------------------------------- - subroutine clm_drv_patch2col (bounds, & - num_allc, filter_allc, num_nolakec, filter_nolakec, & - energyflux_inst, waterflux_inst) - ! - ! !DESCRIPTION: - ! Averages over all patches for variables defined over both soil and lake to provide - ! the column-level averages of flux variables defined at the patch level. - ! - ! !USES: - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use EnergyFluxType , only : energyflux_type - use subgridAveMod , only : p2c - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of column points in allc filter - integer , intent(in) :: filter_allc(:) ! column filter for all active points - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(:) ! column filter for non-lake points - type(waterflux_type) , intent(inout) :: waterflux_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c,fc ! indices - ! ----------------------------------------------------------------- - - ! Note: lake points are excluded from many of the following - ! averages. For some fields, this is because the field doesn't - ! apply over lakes. However, for many others, this is because the - ! field is computed in LakeHydrologyMod, which is called after - ! this routine; thus, for lakes, the column-level values of these - ! fields are explicitly set in LakeHydrologyMod. (The fields that - ! are included here for lakes are computed elsewhere, e.g., in - ! LakeFluxesMod.) - - ! Averaging for patch evaporative flux variables - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_ev_snow_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_ev_snow_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_ev_soil_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_ev_soil_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_ev_h2osfc_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_ev_h2osfc_col(bounds%begc:bounds%endc)) - - ! Averaging for patch water flux variables - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_evap_soi_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_evap_soi_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_evap_tot_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_evap_tot_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_rain_grnd_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_rain_grnd_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_snow_grnd_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_snow_grnd_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_tran_veg_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_tran_veg_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_evap_grnd_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_evap_grnd_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_allc, filter_allc, & - waterflux_inst%qflx_evap_soi_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_evap_soi_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_prec_grnd_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_prec_grnd_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_dew_grnd_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_dew_grnd_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_sub_snow_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_sub_snow_col(bounds%begc:bounds%endc)) - - call p2c (bounds, num_nolakec, filter_nolakec, & - waterflux_inst%qflx_dew_snow_patch(bounds%begp:bounds%endp), & - waterflux_inst%qflx_dew_snow_col(bounds%begc:bounds%endc)) - - end subroutine clm_drv_patch2col - - !------------------------------------------------------------------------ - subroutine write_diagnostic (bounds, wrtdia, nstep, lnd2atm_inst) - ! - ! !DESCRIPTION: - ! Write diagnostic surface temperature output each timestep. Written to - ! be fast but not bit-for-bit because order of summations can change each - ! timestep. - ! - ! !USES: - use decompMod , only : get_proc_global - use spmdMod , only : masterproc, npes, MPI_REAL8 - use spmdMod , only : MPI_STATUS_SIZE, mpicom, MPI_SUM - use shr_sys_mod, only : shr_sys_flush - use abortutils , only : endrun - use shr_log_mod, only : errMsg => shr_log_errMsg - use lnd2atmType, only : lnd2atm_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - logical , intent(in) :: wrtdia !true => write diagnostic - integer , intent(in) :: nstep !model time step - type(lnd2atm_type) , intent(in) :: lnd2atm_inst - ! - ! !REVISION HISTORY: - ! Created by Mariana Vertenstein - ! - ! !LOCAL VARIABLES: - integer :: p ! loop index - integer :: numg ! total number of gridcells across all processors - integer :: ier ! error status - real(r8):: psum ! partial sum of ts - real(r8):: tsum ! sum of ts - real(r8):: tsxyav ! average ts for diagnostic output - integer :: status(MPI_STATUS_SIZE) ! mpi status - !------------------------------------------------------------------------ - - call get_proc_global(ng=numg) - - if (wrtdia) then - - call t_barrierf('sync_write_diag', mpicom) - psum = sum(lnd2atm_inst%t_rad_grc(bounds%begg:bounds%endg)) - call mpi_reduce(psum, tsum, 1, MPI_REAL8, MPI_SUM, 0, mpicom, ier) - if (ier/=0) then - write(iulog,*) 'write_diagnostic: Error in mpi_reduce()' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (masterproc) then - tsxyav = tsum / numg - write(iulog,1000) nstep, tsxyav - call shr_sys_flush(iulog) - end if - - else - - if (masterproc) then - write(iulog,*)'clm: completed timestep ',nstep - call shr_sys_flush(iulog) - end if - - endif - -1000 format (1x,'nstep = ',i10,' TS = ',f21.15) - - end subroutine write_diagnostic - -end module clm_driver diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 deleted file mode 100644 index 42f71ec526..0000000000 --- a/src/main/clm_initializeMod.F90 +++ /dev/null @@ -1,691 +0,0 @@ -module clm_initializeMod - - !----------------------------------------------------------------------- - ! Performs land model initialization - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use decompMod , only : bounds_type, get_proc_bounds, get_proc_clumps, get_clump_bounds - use abortutils , only : endrun - use clm_varctl , only : nsrest, nsrStartup, nsrContinue, nsrBranch - use clm_varctl , only : is_cold_start, is_interpolated_start - use clm_varctl , only : iulog - use clm_varctl , only : use_lch4, use_cn, use_cndv, use_c13, use_c14, use_fates - use clm_instur , only : wt_lunit, urban_valid, wt_nat_patch, wt_cft, fert_cft, wt_glc_mec, topo_glc_mec - use perf_mod , only : t_startf, t_stopf - use readParamsMod , only : readParameters - use ncdio_pio , only : file_desc_t - use GridcellType , only : grc ! instance - use LandunitType , only : lun ! instance - use ColumnType , only : col ! instance - use PatchType , only : patch ! instance - use reweightMod , only : reweight_wrapup - use filterMod , only : allocFilters, filter - use FatesInterfaceMod, only : set_fates_global_elements - - use clm_instMod - ! - implicit none - public ! By default everything is public - ! - public :: initialize1 ! Phase one initialization - public :: initialize2 ! Phase two initialization - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine initialize1( ) - ! - ! !DESCRIPTION: - ! CLM initialization first phase - ! - ! !USES: - use clm_varpar , only: clm_varpar_init, natpft_lb, natpft_ub, cft_lb, cft_ub, maxpatch_glcmec - use clm_varcon , only: clm_varcon_init - use landunit_varcon , only: landunit_varcon_init, max_lunit - use clm_varctl , only: fsurdat, fatmlndfrc, noland, version - use pftconMod , only: pftcon - use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp - use domainMod , only: domain_check, ldomain, domain_init - use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data - use controlMod , only: control_init, control_print, NLFilename - use ncdio_pio , only: ncd_pio_init - use initGridCellsMod , only: initGridCells - use ch4varcon , only: ch4conrd - use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp - use dynSubgridControlMod, only: dynSubgridControl_init - ! - ! !LOCAL VARIABLES: - integer :: ier ! error status - integer :: i,j,n,k,c,l,g ! indices - integer :: nl ! gdc and glo lnd indices - integer :: ns, ni, nj ! global grid sizes - integer :: begg, endg ! processor bounds - type(bounds_type) :: bounds_proc - type(bounds_type) :: bounds_clump - integer :: nclumps ! number of clumps on this processor - integer :: nc ! clump index - integer ,pointer :: amask(:) ! global land mask - character(len=32) :: subname = 'initialize1' ! subroutine name - !----------------------------------------------------------------------- - - call t_startf('clm_init1') - - ! ------------------------------------------------------------------------ - ! Initialize run control variables, timestep - ! ------------------------------------------------------------------------ - - if ( masterproc )then - write(iulog,*) trim(version) - write(iulog,*) - write(iulog,*) 'Attempting to initialize the land model .....' - write(iulog,*) - call shr_sys_flush(iulog) - endif - - call control_init() - call clm_varpar_init() - call clm_varcon_init( IsSimpleBuildTemp() ) - call landunit_varcon_init() - call ncd_pio_init() - - if (masterproc) call control_print() - - call dynSubgridControl_init(NLFilename) - - ! ------------------------------------------------------------------------ - ! Read in global land grid and land mask (amask)- needed to set decomposition - ! ------------------------------------------------------------------------ - - ! global memory for amask is allocate in surfrd_get_glomask - must be - ! deallocated below - if (masterproc) then - write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) - call shr_sys_flush(iulog) - endif - call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) - - ! Exit early if no valid land points - if ( all(amask == 0) )then - if (masterproc) write(iulog,*) trim(subname)//': no valid land points do NOT run clm' - noland = .true. - return - end if - - ! ------------------------------------------------------------------------ - ! Determine clm gridcell decomposition and processor bounds for gridcells - ! ------------------------------------------------------------------------ - - call decompInit_lnd(ni, nj, amask) - deallocate(amask) - - ! *** Get JUST gridcell processor bounds *** - ! Remaining bounds (landunits, columns, patches) will be determined - ! after the call to decompInit_glcp - so get_proc_bounds is called - ! twice and the gridcell information is just filled in twice - - call get_proc_bounds(begg, endg) - - ! ------------------------------------------------------------------------ - ! Get grid and land fraction (set ldomain) - ! ------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*) 'Attempting to read ldomain from ',trim(fatmlndfrc) - call shr_sys_flush(iulog) - endif - call surfrd_get_grid(begg, endg, ldomain, fatmlndfrc) - if (masterproc) then - call domain_check(ldomain) - endif - ldomain%mask = 1 !!! TODO - is this needed? - - ! Initialize glc behavior - call glc_behavior%Init(begg, endg, NLFilename) - - ! Initialize urban model input (initialize urbinp data structure) - ! This needs to be called BEFORE the call to surfrd_get_data since - ! that will call surfrd_get_special which in turn calls check_urban - - call UrbanInput(begg, endg, mode='initialize') - - ! Allocate surface grid dynamic memory (just gridcell bounds dependent) - - allocate (wt_lunit (begg:endg, max_lunit )) - allocate (urban_valid (begg:endg )) - allocate (wt_nat_patch (begg:endg, natpft_lb:natpft_ub )) - allocate (wt_cft (begg:endg, cft_lb:cft_ub )) - allocate (fert_cft (begg:endg, cft_lb:cft_ub )) - allocate (wt_glc_mec (begg:endg, maxpatch_glcmec)) - allocate (topo_glc_mec(begg:endg, maxpatch_glcmec)) - - ! Read list of Patches and their corresponding parameter values - ! Independent of model resolution, Needs to stay before surfrd_get_data - - call pftcon%Init() - - ! Read surface dataset and set up subgrid weight arrays - - call surfrd_get_data(begg, endg, ldomain, fsurdat) - - ! ------------------------------------------------------------------------ - ! Ask Fates to evaluate its own dimensioning needs. - ! This determines the total amount of space it requires in its largest - ! dimension. We are currently calling that the "cohort" dimension, but - ! it is really a utility dimension that captures the models largest - ! size need. - ! Sets: - ! fates_maxElementsPerPatch - ! fates_maxElementsPerSite (where a site is roughly equivalent to a column) - ! - ! (Note: fates_maxELementsPerSite is the critical variable used by CLM - ! to allocate space) - ! ------------------------------------------------------------------------ - - call set_fates_global_elements(use_fates) - - ! ------------------------------------------------------------------------ - ! Determine decomposition of subgrid scale landunits, columns, patches - ! ------------------------------------------------------------------------ - - call decompInit_clumps(ns, ni, nj, glc_behavior) - - ! *** Get ALL processor bounds - for gridcells, landunit, columns and patches *** - - call get_proc_bounds(bounds_proc) - - ! Allocate memory for subgrid data structures - ! This is needed here BEFORE the following call to initGridcells - ! Note that the assumption is made that none of the subgrid initialization - ! can depend on other elements of the subgrid in the calls below - - call grc%Init (bounds_proc%begg, bounds_proc%endg) - call lun%Init (bounds_proc%begl, bounds_proc%endl) - call col%Init (bounds_proc%begc, bounds_proc%endc) - call patch%Init(bounds_proc%begp, bounds_proc%endp) - - ! Build hierarchy and topological info for derived types - ! This is needed here for the following call to decompInit_glcp - - call initGridCells(glc_behavior) - - ! Set global seg maps for gridcells, landlunits, columns and patches - - call decompInit_glcp(ns, ni, nj, glc_behavior) - - ! Set filters - - call allocFilters() - - nclumps = get_proc_clumps() - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds_clump) - call reweight_wrapup(bounds_clump, glc_behavior) - end do - !$OMP END PARALLEL DO - - ! ------------------------------------------------------------------------ - ! Remainder of initialization1 - ! ------------------------------------------------------------------------ - - ! Set CH4 Model Parameters from namelist. - ! Need to do before initTimeConst so that it knows whether to - ! look for several optional parameters on surfdata file. - - if (use_lch4) then - call ch4conrd() - end if - - ! Deallocate surface grid dynamic memory for variables that aren't needed elsewhere. - ! Some things are kept until the end of initialize2; urban_valid is kept through the - ! end of the run for error checking. - - deallocate (wt_lunit, wt_cft, wt_glc_mec) - - call t_stopf('clm_init1') - - end subroutine initialize1 - - - !----------------------------------------------------------------------- - subroutine initialize2( ) - ! - ! !DESCRIPTION: - ! CLM initialization - second phase - ! - ! !USES: - use shr_orb_mod , only : shr_orb_decl - use shr_scam_mod , only : shr_scam_getCloseLatLon - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use accumulMod , only : print_accum_fields - use clm_varpar , only : nlevsno - use clm_varcon , only : spval - use clm_varctl , only : finidat, finidat_interp_source, finidat_interp_dest, fsurdat - use clm_varctl , only : use_century_decomp, single_column, scmlat, scmlon, use_cn, use_fates - use clm_varctl , only : use_crop, ndep_from_cpl - use clm_varorb , only : eccen, mvelpp, lambm0, obliqr - use clm_time_manager , only : get_step_size, get_curr_calday - use clm_time_manager , only : get_curr_date, get_nstep, advance_timestep - use clm_time_manager , only : timemgr_init, timemgr_restart_io, timemgr_restart, is_restart - use CIsoAtmTimeseriesMod , only : C14_init_BombSpike, use_c14_bombspike, C13_init_TimeSeries, use_c13_timeseries - use DaylengthMod , only : InitDaylength - use dynSubgridDriverMod , only : dynSubgrid_init - use fileutils , only : getfil - use initInterpMod , only : initInterp - use subgridWeightsMod , only : init_subgrid_weights_mod - use histFileMod , only : hist_htapes_build, htapes_fieldlist, hist_printflds - use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal - use restFileMod , only : restFile_getfile, restFile_open, restFile_close - use restFileMod , only : restFile_read, restFile_write - use ndepStreamMod , only : ndep_init, ndep_interp - use LakeCon , only : LakeConInit - use SatellitePhenologyMod , only : SatellitePhenologyInit, readAnnualVegetation, interpMonthlyVeg - use SnowSnicarMod , only : SnowAge_init, SnowOptics_init - use lnd2atmMod , only : lnd2atm_minimal - use NutrientCompetitionFactoryMod, only : create_nutrient_competition_method - use controlMod , only : NLFilename - use clm_instMod , only : clm_fates - ! - ! !ARGUMENTS - ! - ! !LOCAL VARIABLES: - integer :: c,i,j,k,l,p! indices - integer :: yr ! current year (0, ...) - integer :: mon ! current month (1 -> 12) - integer :: day ! current day (1 -> 31) - integer :: ncsec ! current time of day [seconds] - integer :: nc ! clump index - integer :: nclumps ! number of clumps on this processor - character(len=256) :: fnamer ! name of netcdf restart file - character(len=256) :: pnamer ! full pathname of netcdf restart file - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - real(r8) :: dtime ! time step increment (sec) - integer :: nstep ! model time step - real(r8) :: calday ! calendar day for nstep - real(r8) :: caldaym1 ! calendar day for nstep-1 - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinm1 ! solar declination angle in radians for nstep-1 - real(r8) :: eccf ! earth orbit eccentricity factor - type(bounds_type) :: bounds_proc ! processor bounds - type(bounds_type) :: bounds_clump ! clump bounds - logical :: lexist - integer :: closelatidx,closelonidx - real(r8) :: closelat,closelon - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - real(r8), pointer :: data2dptr(:,:) ! temp. pointers for slicing larger arrays - character(len=32) :: subname = 'initialize2' - !---------------------------------------------------------------------- - - call t_startf('clm_init2') - - ! ------------------------------------------------------------------------ - ! Determine processor bounds and clumps for this processor - ! ------------------------------------------------------------------------ - - call get_proc_bounds(bounds_proc) - nclumps = get_proc_clumps() - - ! ------------------------------------------------------------------------ - ! Read in parameters files - ! ------------------------------------------------------------------------ - - call clm_instReadNML( NLFilename ) - allocate(nutrient_competition_method, & - source=create_nutrient_competition_method(bounds_proc)) - - call readParameters(nutrient_competition_method, photosyns_inst) - - ! ------------------------------------------------------------------------ - ! Initialize time manager - ! ------------------------------------------------------------------------ - - if (nsrest == nsrStartup) then - call timemgr_init() - else - call restFile_getfile(file=fnamer, path=pnamer) - call restFile_open( flag='read', file=fnamer, ncid=ncid ) - call timemgr_restart_io( ncid=ncid, flag='read' ) - call restFile_close( ncid=ncid ) - call timemgr_restart() - end if - - ! ------------------------------------------------------------------------ - ! Initialize daylength from the previous time step (needed so prev_dayl can be set correctly) - ! ------------------------------------------------------------------------ - - call t_startf('init_orbd') - - calday = get_curr_calday() - call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) - - dtime = get_step_size() - caldaym1 = get_curr_calday(offset=-int(dtime)) - call shr_orb_decl( caldaym1, eccen, mvelpp, lambm0, obliqr, declinm1, eccf ) - - call t_stopf('init_orbd') - - call InitDaylength(bounds_proc, declin=declin, declinm1=declinm1, obliquity=obliqr) - - ! History file variables - - if (use_cn) then - call hist_addfld1d (fname='DAYL', units='s', & - avgflag='A', long_name='daylength', & - ptr_gcell=grc%dayl, default='inactive') - - call hist_addfld1d (fname='PREV_DAYL', units='s', & - avgflag='A', long_name='daylength from previous timestep', & - ptr_gcell=grc%prev_dayl, default='inactive') - end if - - ! ------------------------------------------------------------------------ - ! Initialize component data structures - ! ------------------------------------------------------------------------ - - ! Note: new logic is in place that sets all the history fields to spval so - ! there is no guesswork in the initialization to nans of the allocated variables - - ! First put in history calls for subgrid data structures - these cannot appear in the - ! module for the subgrid data definition due to circular dependencies that are introduced - - data2dptr => col%dz(:,-nlevsno+1:0) - col%dz(bounds_proc%begc:bounds_proc%endc,:) = spval - call hist_addfld2d (fname='SNO_Z', units='m', type2d='levsno', & - avgflag='A', long_name='Snow layer thicknesses', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, default='inactive') - - call hist_addfld2d (fname='SNO_Z_ICE', units='m', type2d='levsno', & - avgflag='A', long_name='Snow layer thicknesses (ice landunits only)', & - ptr_col=data2dptr, no_snow_behavior=no_snow_normal, & - l2g_scale_type='ice', default='inactive') - - col%zii(bounds_proc%begc:bounds_proc%endc) = spval - call hist_addfld1d (fname='ZII', units='m', & - avgflag='A', long_name='convective boundary height', & - ptr_col=col%zii, default='inactive') - - ! If single-column determine closest latitude and longitude - - if (single_column) then - call getfil (fsurdat, locfn, 0) - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - end if - - ! Initialize instances of all derived types as well as time constant variables - - call clm_instInit(bounds_proc) - - ! Initialize SNICAR optical and aging parameters - - call SnowOptics_init( ) ! SNICAR optical parameters: - call SnowAge_init( ) ! SNICAR aging parameters: - - call hist_printflds() - - ! ------------------------------------------------------------------------ - ! Initializate dynamic subgrid weights (for prescribed transient Patches, CNDV - ! and/or dynamic landunits); note that these will be overwritten in a - ! restart run - ! ------------------------------------------------------------------------ - - call t_startf('init_dyn_subgrid') - call init_subgrid_weights_mod(bounds_proc) - call dynSubgrid_init(bounds_proc, glc_behavior, crop_inst) - call t_stopf('init_dyn_subgrid') - - ! ------------------------------------------------------------------------ - ! Initialize modules (after time-manager initialization in most cases) - ! ------------------------------------------------------------------------ - - if (use_cn) then - call bgc_vegetation_inst%Init2(bounds_proc, NLFilename) - - ! NOTE(wjs, 2016-02-23) Maybe the rest of the body of this conditional should also - ! be moved into bgc_vegetation_inst%Init2 - - 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 - call SatellitePhenologyInit(bounds_proc) - end if - - if ( use_c14 .and. use_c14_bombspike ) then - call C14_init_BombSpike() - end if - - if ( use_c13 .and. use_c13_timeseries ) then - call C13_init_TimeSeries() - end if - else - call SatellitePhenologyInit(bounds_proc) - end if - - - - - ! ------------------------------------------------------------------------ - ! On restart only - process the history namelist. - ! ------------------------------------------------------------------------ - - ! Later the namelist from the restart file will be used. This allows basic - ! checking to make sure you didn't try to change the history namelist on restart. - - if (nsrest == nsrContinue ) then - call htapes_fieldlist() - end if - - ! ------------------------------------------------------------------------ - ! Read restart/initial info - ! ------------------------------------------------------------------------ - - is_cold_start = .false. - is_interpolated_start = .false. - - if (nsrest == nsrStartup) then - - if (finidat == ' ') then - if (finidat_interp_source == ' ') then - is_cold_start = .true. - if (masterproc) then - write(iulog,*)'Using cold start initial conditions ' - end if - else - if (masterproc) then - write(iulog,*)'Interpolating initial conditions from ',trim(finidat_interp_source),& - ' and creating new initial conditions ', trim(finidat_interp_dest) - end if - end if - else - if (masterproc) then - write(iulog,*)'Reading initial conditions from ',trim(finidat) - end if - call getfil( finidat, fnamer, 0 ) - call restFile_read(bounds_proc, fnamer, glc_behavior) - end if - - else if ((nsrest == nsrContinue) .or. (nsrest == nsrBranch)) then - - if (masterproc) then - write(iulog,*)'Reading restart file ',trim(fnamer) - end if - call restFile_read(bounds_proc, fnamer, glc_behavior) - - end if - - ! ------------------------------------------------------------------------ - ! If appropriate, create interpolated initial conditions - ! ------------------------------------------------------------------------ - - if (nsrest == nsrStartup .and. finidat_interp_source /= ' ') then - - is_interpolated_start = .true. - - ! Check that finidat is not cold start - abort if it is - if (finidat /= ' ') then - call endrun(msg='ERROR clm_initializeMod: '//& - 'finidat and finidat_interp_source cannot both be non-blank') - end if - - ! Create new template file using cold start - call restFile_write(bounds_proc, finidat_interp_dest) - - ! Interpolate finidat onto new template file - call getfil( finidat_interp_source, fnamer, 0 ) - call initInterp(filei=fnamer, fileo=finidat_interp_dest, bounds=bounds_proc, & - glc_behavior=glc_behavior) - - ! Read new interpolated conditions file back in - call restFile_read(bounds_proc, finidat_interp_dest, glc_behavior) - - ! Reset finidat to now be finidat_interp_dest - ! (to be compatible with routines still using finidat) - finidat = trim(finidat_interp_dest) - - end if - - ! ------------------------------------------------------------------------ - ! Initialize nitrogen deposition - ! ------------------------------------------------------------------------ - - if (use_cn) then - call t_startf('init_ndep') - if (.not. ndep_from_cpl) then - call ndep_init(bounds_proc, NLFilename) - call ndep_interp(bounds_proc, atm2lnd_inst) - end if - call t_stopf('init_ndep') - end if - - ! ------------------------------------------------------------------------ - ! Initialize active history fields. - ! ------------------------------------------------------------------------ - - ! This is only done if not a restart run. If a restart run, then this - ! information has already been obtained from the restart data read above. - ! Note that routine hist_htapes_build needs time manager information, - ! so this call must be made after the restart information has been read. - - if (nsrest /= nsrContinue) then - call hist_htapes_build() - end if - - ! ------------------------------------------------------------------------ - ! Initialize variables that are associated with accumulated fields. - ! ------------------------------------------------------------------------ - - ! The following is called for both initial and restart runs and must - ! must be called after the restart file is read - - call atm2lnd_inst%initAccVars(bounds_proc) - call temperature_inst%initAccVars(bounds_proc) - call waterflux_inst%initAccVars(bounds_proc) - call energyflux_inst%initAccVars(bounds_proc) - call canopystate_inst%initAccVars(bounds_proc) - - call bgc_vegetation_inst%initAccVars(bounds_proc) - - if (use_crop) then - call crop_inst%initAccVars(bounds_proc) - end if - - !------------------------------------------------------------ - ! Read monthly vegetation - !------------------------------------------------------------ - - ! Even if CN 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 )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 - end if - - !------------------------------------------------------------ - ! Determine gridcell averaged properties to send to atm - !------------------------------------------------------------ - - if (nsrest == nsrStartup) then - call t_startf('init_map2gc') - call lnd2atm_minimal(bounds_proc, & - waterstate_inst, surfalb_inst, energyflux_inst, lnd2atm_inst) - call t_stopf('init_map2gc') - end if - - !------------------------------------------------------------ - ! Initialize sno export state to send to glc - !------------------------------------------------------------ - - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - call t_startf('init_lnd2glc') - call lnd2glc_inst%update_lnd2glc(bounds_clump, & - filter(nc)%num_do_smb_c, filter(nc)%do_smb_c, & - temperature_inst, glacier_smb_inst, topo_inst, & - init=.true.) - call t_stopf('init_lnd2glc') - end do - !$OMP END PARALLEL DO - - !------------------------------------------------------------ - ! Deallocate wt_nat_patch - !------------------------------------------------------------ - - ! wt_nat_patch was allocated in initialize1, but needed to be kept around through - ! initialize2 for some consistency checking; now it can be deallocated - - deallocate(wt_nat_patch) - - ! -------------------------------------------------------------- - ! Initialise the fates model state structure - ! -------------------------------------------------------------- - - if ( use_fates .and. .not.is_restart() .and. finidat == ' ') then - call clm_fates%init_coldstart(waterstate_inst,canopystate_inst,soilstate_inst, frictionvel_inst) - end if - - ! topo_glc_mec was allocated in initialize1, but needed to be kept around through - ! initialize2 because it is used to initialize other variables; now it can be - ! deallocated - - deallocate(topo_glc_mec, fert_cft) - - !------------------------------------------------------------ - ! Write log output for end of initialization - !------------------------------------------------------------ - - call t_startf('init_wlog') - if (masterproc) then - write(iulog,*) 'Successfully initialized the land model' - if (nsrest == nsrStartup) then - write(iulog,*) 'begin initial run at: ' - else - write(iulog,*) 'begin continuation run at:' - end if - call get_curr_date(yr, mon, day, ncsec) - write(iulog,*) ' nstep= ',get_nstep(), ' year= ',yr,' month= ',mon,& - ' day= ',day,' seconds= ',ncsec - write(iulog,*) - write(iulog,'(72a1)') ("*",i=1,60) - write(iulog,*) - endif - call t_stopf('init_wlog') - - call t_stopf('clm_init2') - - end subroutine initialize2 - -end module clm_initializeMod diff --git a/src/main/clm_instMod.F90 b/src/main/clm_instMod.F90 deleted file mode 100644 index 1b1b44adba..0000000000 --- a/src/main/clm_instMod.F90 +++ /dev/null @@ -1,553 +0,0 @@ -module clm_instMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Instances and definitions of all data types - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varpar , only : ndecomp_pools, nlevdecomp_full - use clm_varctl , only : use_cn, use_c13, use_c14, use_lch4, use_cndv, use_fates - use clm_varctl , only : use_century_decomp, use_crop - use clm_varcon , only : bdsno, c13ratio, c14ratio - use landunit_varcon , only : istice_mec, istsoil - use perf_mod , only : t_startf, t_stopf - use controlMod , only : NLFilename - - !----------------------------------------- - ! Constants - !----------------------------------------- - - use UrbanParamsType , only : urbanparams_type ! Constants - use UrbanParamsType , only : IsSimpleBuildTemp, IsProgBuildTemp - use UrbanTimeVarType , only : urbantv_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use CNDVType , only : dgv_ecophyscon ! Constants - - !----------------------------------------- - ! Definition of component types - !----------------------------------------- - - use AerosolMod , only : aerosol_type - use CanopyStateType , only : canopystate_type - use ch4Mod , only : ch4_type - use CNVegetationFacade , only : cn_vegetation_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use CropType , only : crop_type - use DryDepVelocity , only : drydepvel_type - use DUSTMod , only : dust_type - use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use GlacierSurfaceMassBalanceMod , only : glacier_smb_type - use IrrigationMod , only : irrigation_type - use LakeStateType , only : lakestate_type - use OzoneBaseMod , only : ozone_base_type - use OzoneFactoryMod , only : create_and_init_ozone_type - use PhotosynthesisMod , only : photosyns_type - use SoilHydrologyType , only : soilhydrology_type - use SoilStateType , only : soilstate_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceRadiationMod , only : surfrad_type - use SurfaceAlbedoType , only : surfalb_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use WaterStateType , only : waterstate_type - use UrbanParamsType , only : urbanparams_type - use UrbanTimeVarType , only : urbantv_type - use HumanIndexMod , only : humanindex_type - use VOCEmissionMod , only : vocemis_type - use CNFireEmissionsMod , only : fireemis_type - use atm2lndType , only : atm2lnd_type - use lnd2atmType , only : lnd2atm_type - use lnd2glcMod , only : lnd2glc_type - use glc2lndMod , only : glc2lnd_type - use glcBehaviorMod , only : glc_behavior_type - use TopoMod , only : topo_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use CLMFatesInterfaceMod , only : hlm_fates_interface_type - use SoilWaterRetentionCurveMod , only : soil_water_retention_curve_type - use NutrientCompetitionMethodMod , only : nutrient_competition_method_type - ! - use SoilStateInitTimeConstMod , only : SoilStateInitTimeConst - use SoilHydrologyInitTimeConstMod , only : SoilHydrologyInitTimeConst - use SurfaceAlbedoMod , only : SurfaceAlbedoInitTimeConst - use LakeCon , only : LakeConInit - use SoilBiogeochemPrecisionControlMod, only: SoilBiogeochemPrecisionControlInit - ! - implicit none - public ! By default everything is public - ! - !----------------------------------------- - ! Instances of component types - !----------------------------------------- - - ! Physics types - type(aerosol_type) :: aerosol_inst - type(canopystate_type) :: canopystate_inst - type(energyflux_type) :: energyflux_inst - type(frictionvel_type) :: frictionvel_inst - type(glacier_smb_type) :: glacier_smb_inst - type(irrigation_type) :: irrigation_inst - type(lakestate_type) :: lakestate_inst - class(ozone_base_type), allocatable :: ozone_inst - type(photosyns_type) :: photosyns_inst - type(soilstate_type) :: soilstate_inst - type(soilhydrology_type) :: soilhydrology_inst - type(solarabs_type) :: solarabs_inst - type(surfalb_type) :: surfalb_inst - type(surfrad_type) :: surfrad_inst - type(temperature_type) :: temperature_inst - type(urbanparams_type) :: urbanparams_inst - type(urbantv_type) :: urbantv_inst - type(humanindex_type) :: humanindex_inst - type(waterflux_type) :: waterflux_inst - type(waterstate_type) :: waterstate_inst - type(atm2lnd_type) :: atm2lnd_inst - type(glc2lnd_type) :: glc2lnd_inst - type(lnd2atm_type) :: lnd2atm_inst - type(lnd2glc_type) :: lnd2glc_inst - type(glc_behavior_type), target :: glc_behavior - type(topo_type) :: topo_inst - class(soil_water_retention_curve_type) , allocatable :: soil_water_retention_curve - - ! CN vegetation types - ! Eventually bgc_vegetation_inst will be an allocatable instance of an abstract - ! interface - type(cn_vegetation_type) :: bgc_vegetation_inst - - class(nutrient_competition_method_type), allocatable :: nutrient_competition_method - - ! Soil biogeochem types - type(soilbiogeochem_state_type) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonflux_type) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonflux_type) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) :: soilbiogeochem_nitrogenflux_inst - - ! General biogeochem types - type(ch4_type) :: ch4_inst - type(crop_type) :: crop_inst - type(dust_type) :: dust_inst - type(vocemis_type) :: vocemis_inst - type(fireemis_type) :: fireemis_inst - type(drydepvel_type) :: drydepvel_inst - - ! FATES - type(hlm_fates_interface_type) :: clm_fates - - ! - public :: clm_instInit ! Initialize - public :: clm_instReadNML ! Read in namelist - public :: clm_instRest ! Setup restart - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine clm_instReadNML( NLFilename ) - ! - ! !ARGUMENTS - implicit none - character(len=*), intent(IN) :: NLFilename ! Namelist filename - ! Read in any namelists that must be read for any clm object instances that need it - call canopystate_inst%ReadNML( NLFilename ) - call photosyns_inst%ReadNML( NLFilename ) - if (use_cn .or. use_fates) then - call crop_inst%ReadNML( NLFilename ) - end if - - end subroutine clm_instReadNML - - !----------------------------------------------------------------------- - subroutine clm_instInit(bounds) - ! - ! !USES: - use clm_varpar , only : nlevsno, numpft - use controlMod , only : nlfilename, fsurdat - use domainMod , only : ldomain - use SoilBiogeochemDecompCascadeBGCMod , only : init_decompcascade_bgc - use SoilBiogeochemDecompCascadeCNMod , only : init_decompcascade_cn - use SoilBiogeochemDecompCascadeContype , only : init_decomp_cascade_constants - use SoilBiogeochemCompetitionMod , only : SoilBiogeochemCompetitionInit - - use initVerticalMod , only : initVertical - use accumulMod , only : print_accum_fields - use SoilWaterRetentionCurveFactoryMod , only : create_soil_water_retention_curve - use decompMod , only : get_proc_bounds - ! - ! !ARGUMENTS - type(bounds_type), intent(in) :: bounds ! processor bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l,g - integer :: nclumps,nc - integer :: begp, endp - integer :: begc, endc - integer :: begl, endl - type(bounds_type) :: bounds_clump - real(r8), allocatable :: h2osno_col(:) - real(r8), allocatable :: snow_depth_col(:) - - integer :: dummy_to_make_pgi_happy - !---------------------------------------------------------------------- - - ! Note: h2osno_col and snow_depth_col are initialized as local variable - ! since they are needed to initialize vertical data structures - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - begl = bounds%begl; endl = bounds%endl - - allocate (h2osno_col(begc:endc)) - allocate (snow_depth_col(begc:endc)) - - ! snow water - do c = begc,endc - l = col%landunit(c) - g = col%gridcell(c) - - ! In areas that should be snow-covered, it can be problematic to start with 0 snow - ! cover, because this can affect the long-term state through soil heating, albedo - ! feedback, etc. On the other hand, we would introduce hysteresis by putting too - ! much snow in places that are in a net melt regime, because the melt-albedo - ! feedback may not activate on time (or at all). So, as a compromise, we start with - ! a small amount of snow in places that are likely to be snow-covered for much or - ! all of the year. - if (lun%itype(l)==istice_mec) then - h2osno_col(c) = 100._r8 - else if (lun%itype(l)==istsoil .and. abs(grc%latdeg(g)) >= 60._r8) then - h2osno_col(c) = 100._r8 - else - h2osno_col(c) = 0._r8 - endif - snow_depth_col(c) = h2osno_col(c) / bdsno - end do - - ! Initialize urban constants - - call urbanparams_inst%Init(bounds) - call humanindex_inst%Init(bounds) - - ! Initialize urban time varying data - call urbantv_inst%Init(bounds, NLFilename) - - ! Initialize vertical data components - - call initVertical(bounds, & - glc_behavior, & - snow_depth_col(begc:endc), & - urbanparams_inst%thick_wall(begl:endl), & - urbanparams_inst%thick_roof(begl:endl)) - - ! Initialize clm->drv and drv->clm data structures - - call atm2lnd_inst%Init( bounds, NLFilename ) - call lnd2atm_inst%Init( bounds, NLFilename ) - - call glc2lnd_inst%Init( bounds, glc_behavior ) - call lnd2glc_inst%Init( bounds ) - - ! Initialization of public data types - - call temperature_inst%Init(bounds, & - urbanparams_inst%em_roof(begl:endl), & - urbanparams_inst%em_wall(begl:endl), & - urbanparams_inst%em_improad(begl:endl), & - urbanparams_inst%em_perroad(begl:endl), & - IsSimpleBuildTemp(), IsProgBuildTemp() ) - - call canopystate_inst%Init(bounds) - - call soilstate_inst%Init(bounds) - call SoilStateInitTimeConst(bounds, soilstate_inst, nlfilename) ! sets hydraulic and thermal soil properties - - call waterstate_inst%Init(bounds, & - h2osno_col(begc:endc), & - snow_depth_col(begc:endc), & - soilstate_inst%watsat_col(begc:endc, 1:), & - temperature_inst%t_soisno_col(begc:endc, -nlevsno+1:) ) - - call waterflux_inst%Init(bounds) - - call glacier_smb_inst%Init(bounds) - - ! COMPILER_BUG(wjs, 2014-11-29, pgi 14.7) Without the following assignment, the - ! assertion in energyflux_inst%Init fails with pgi 14.7 on yellowstone, presumably due - ! to a compiler bug. - dummy_to_make_pgi_happy = ubound(temperature_inst%t_grnd_col, 1) - call energyflux_inst%Init(bounds, temperature_inst%t_grnd_col(begc:endc), & - IsSimpleBuildTemp(), IsProgBuildTemp() ) - - call aerosol_inst%Init(bounds, NLFilename) - - call frictionvel_inst%Init(bounds) - - call lakestate_inst%Init(bounds) - call LakeConInit() - - allocate(ozone_inst, source = create_and_init_ozone_type(bounds)) - - call photosyns_inst%Init(bounds) - - call soilhydrology_inst%Init(bounds, nlfilename) - call SoilHydrologyInitTimeConst(bounds, soilhydrology_inst) ! sets time constant properties - - call solarabs_inst%Init(bounds) - - call surfalb_inst%Init(bounds) - call SurfaceAlbedoInitTimeConst(bounds) - - call surfrad_inst%Init(bounds) - - call dust_inst%Init(bounds) - - ! Once namelist options are added to control the soil water retention curve method, - ! we'll need to either pass the namelist file as an argument to this routine, or pass - ! the namelist value itself (if the namelist is read elsewhere). - - allocate(soil_water_retention_curve, & - source=create_soil_water_retention_curve()) - - call irrigation_inst%init(bounds, nlfilename, soilstate_inst, soil_water_retention_curve) - - call topo_inst%Init(bounds) - - ! Note - always initialize the memory for ch4_inst - call ch4_inst%Init(bounds, soilstate_inst%cellorg_col(begc:endc, 1:), fsurdat, nlfilename) - - call vocemis_inst%Init(bounds) - - call fireemis_inst%Init(bounds) - - call drydepvel_inst%Init(bounds) - - if (use_cn .or. use_fates ) then - - ! Initialize soilbiogeochem_state_inst - - call soilbiogeochem_state_inst%Init(bounds) - - ! Initialize decompcascade constants - ! Note that init_decompcascade_bgc and init_decompcascade_cn need - ! soilbiogeochem_state_inst to be initialized - - call init_decomp_cascade_constants() - if (use_century_decomp) then - call init_decompcascade_bgc(bounds, soilbiogeochem_state_inst, & - soilstate_inst ) - else - call init_decompcascade_cn(bounds, soilbiogeochem_state_inst) - end if - - ! Initalize soilbiogeochem carbon types - - call soilbiogeochem_carbonstate_inst%Init(bounds, carbon_type='c12', ratio=1._r8) - if (use_c13) then - call c13_soilbiogeochem_carbonstate_inst%Init(bounds, carbon_type='c13', ratio=c13ratio, & - c12_soilbiogeochem_carbonstate_inst=soilbiogeochem_carbonstate_inst) - end if - if (use_c14) then - call c14_soilbiogeochem_carbonstate_inst%Init(bounds, carbon_type='c14', ratio=c14ratio, & - c12_soilbiogeochem_carbonstate_inst=soilbiogeochem_carbonstate_inst) - end if - - call soilbiogeochem_carbonflux_inst%Init(bounds, carbon_type='c12') - if (use_c13) then - call c13_soilbiogeochem_carbonflux_inst%Init(bounds, carbon_type='c13') - end if - if (use_c14) then - call c14_soilbiogeochem_carbonflux_inst%Init(bounds, carbon_type='c14') - end if - - end if - - if ( use_cn .or. use_fates) then - - ! Initalize soilbiogeochem nitrogen types - - call soilbiogeochem_nitrogenstate_inst%Init(bounds, & - soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools), & - soilbiogeochem_carbonstate_inst%decomp_cpools_col(begc:endc,1:ndecomp_pools), & - soilbiogeochem_carbonstate_inst%decomp_cpools_1m_col(begc:endc, 1:ndecomp_pools)) - - call soilbiogeochem_nitrogenflux_inst%Init(bounds) - - ! Initialize precision control for soil biogeochemistry - call SoilBiogeochemPrecisionControlInit( soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst) - - end if ! end of if use_cn - - ! Note - always call Init for bgc_vegetation_inst: some pieces need to be initialized always - call bgc_vegetation_inst%Init(bounds, nlfilename) - - if (use_cn .or. use_fates) then - call crop_inst%Init(bounds) - end if - - - ! Initialize the Functionaly Assembled Terrestrial Ecosystem Simulator (FATES) - ! - if (use_fates) then - call clm_fates%Init(bounds) - end if - - deallocate (h2osno_col) - deallocate (snow_depth_col) - - ! ------------------------------------------------------------------------ - ! Initialize accumulated fields - ! ------------------------------------------------------------------------ - - ! The time manager needs to be initialized before this called is made, since - ! the step size is needed. - - call t_startf('init_accflds') - - call atm2lnd_inst%InitAccBuffer(bounds) - - call temperature_inst%InitAccBuffer(bounds) - - call waterflux_inst%InitAccBuffer(bounds) - - call energyflux_inst%InitAccBuffer(bounds) - - call canopystate_inst%InitAccBuffer(bounds) - - call bgc_vegetation_inst%InitAccBuffer(bounds) - - if (use_crop) then - call crop_inst%InitAccBuffer(bounds) - end if - - call print_accum_fields() - - call t_stopf('init_accflds') - - end subroutine clm_instInit - - !----------------------------------------------------------------------- - subroutine clm_instRest(bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio , only : file_desc_t - use UrbanParamsType , only : IsSimpleBuildTemp, IsProgBuildTemp - use decompMod , only : get_proc_bounds, get_proc_clumps, get_clump_bounds - - ! - ! !DESCRIPTION: - ! Define/write/read CLM restart file. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'define', 'write', 'read' - - ! Local variables - integer :: nc, nclumps - type(bounds_type) :: bounds_clump - - !----------------------------------------------------------------------- - - call atm2lnd_inst%restart (bounds, ncid, flag=flag) - - call canopystate_inst%restart (bounds, ncid, flag=flag) - - call energyflux_inst%restart (bounds, ncid, flag=flag, & - is_simple_buildtemp=IsSimpleBuildTemp(), is_prog_buildtemp=IsProgBuildTemp()) - - call frictionvel_inst% restart (bounds, ncid, flag=flag) - - call lakestate_inst%restart (bounds, ncid, flag=flag) - - call ozone_inst%restart (bounds, ncid, flag=flag) - - call photosyns_inst%restart (bounds, ncid, flag=flag) - - call soilhydrology_inst%restart (bounds, ncid, flag=flag) - - call solarabs_inst%restart (bounds, ncid, flag=flag) - - call temperature_inst%restart (bounds, ncid, flag=flag, & - is_simple_buildtemp=IsSimpleBuildTemp(), is_prog_buildtemp=IsProgBuildTemp()) - - call soilstate_inst%restart (bounds, ncid, flag=flag) - - call waterflux_inst%restart (bounds, ncid, flag=flag) - - call waterstate_inst%restart (bounds, ncid, flag=flag, & - watsat_col=soilstate_inst%watsat_col(bounds%begc:bounds%endc,:)) - - call irrigation_inst%restart (bounds, ncid, flag=flag) - - call aerosol_inst%restart (bounds, ncid, flag=flag, & - h2osoi_ice_col=waterstate_inst%h2osoi_ice_col(bounds%begc:bounds%endc,:), & - h2osoi_liq_col=waterstate_inst%h2osoi_liq_col(bounds%begc:bounds%endc,:)) - - call surfalb_inst%restart (bounds, ncid, flag=flag, & - tlai_patch=canopystate_inst%tlai_patch(bounds%begp:bounds%endp), & - tsai_patch=canopystate_inst%tsai_patch(bounds%begp:bounds%endp)) - - call topo_inst%restart (bounds, ncid, flag=flag) - - if (use_lch4) then - call ch4_inst%restart(bounds, ncid, flag=flag) - end if - - if ( use_cn ) then - ! Need to do vegetation restart before soil bgc restart to get totvegc_col for purpose - ! of resetting soil carbon at exit spinup when no vegetation is growing. - call bgc_vegetation_inst%restart(bounds, ncid, flag=flag) - - call soilbiogeochem_nitrogenstate_inst%restart(bounds, ncid, flag=flag, & - totvegc_col=bgc_vegetation_inst%get_totvegc_col(bounds)) - call soilbiogeochem_nitrogenflux_inst%restart(bounds, ncid, flag=flag) - - call crop_inst%restart(bounds, ncid, flag=flag) - end if - - if (use_cn .or. use_fates) then - - call soilbiogeochem_state_inst%restart(bounds, ncid, flag=flag) - call soilbiogeochem_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c12', & - totvegc_col=bgc_vegetation_inst%get_totvegc_col(bounds)) - - if (use_c13) then - call c13_soilbiogeochem_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c13', & - totvegc_col=bgc_vegetation_inst%get_totvegc_col(bounds), & - c12_soilbiogeochem_carbonstate_inst=soilbiogeochem_carbonstate_inst) - end if - if (use_c14) then - call c14_soilbiogeochem_carbonstate_inst%restart(bounds, ncid, flag=flag, carbon_type='c14', & - totvegc_col=bgc_vegetation_inst%get_totvegc_col(bounds), & - c12_soilbiogeochem_carbonstate_inst=soilbiogeochem_carbonstate_inst) - end if - call soilbiogeochem_carbonflux_inst%restart(bounds, ncid, flag=flag) - endif - - if (use_fates) then - - call clm_fates%restart(bounds, ncid, flag=flag, & - waterstate_inst=waterstate_inst, & - canopystate_inst=canopystate_inst, & - frictionvel_inst=frictionvel_inst) - - end if - - end subroutine clm_instRest - -end module clm_instMod - diff --git a/src/main/clm_varcon.F90 b/src/main/clm_varcon.F90 deleted file mode 100644 index d0a2053568..0000000000 --- a/src/main/clm_varcon.F90 +++ /dev/null @@ -1,304 +0,0 @@ -module clm_varcon - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing various model constants. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_G,SHR_CONST_STEBOL,SHR_CONST_KARMAN, & - SHR_CONST_RWV,SHR_CONST_RDAIR,SHR_CONST_CPFW, & - SHR_CONST_CPICE,SHR_CONST_CPDAIR,SHR_CONST_LATVAP, & - SHR_CONST_LATSUB,SHR_CONST_LATICE,SHR_CONST_RHOFW, & - SHR_CONST_RHOICE,SHR_CONST_TKFRZ,SHR_CONST_REARTH, & - SHR_CONST_PDB, SHR_CONST_PI, SHR_CONST_CDAY, & - SHR_CONST_RGAS, SHR_CONST_PSTD, & - SHR_CONST_MWDAIR, SHR_CONST_MWWV - use clm_varpar , only: numrad, nlevgrnd, nlevlak, nlevdecomp_full - use clm_varpar , only: ngases - use clm_varpar , only: nlayer - - ! - ! !PUBLIC TYPES: - implicit none - save - !----------------------------------------------------------------------- - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: clm_varcon_init ! initialize constants in clm_varcon - ! - ! !REVISION HISTORY: - ! Created by Mariana Vertenstein - ! 27 February 2008: Keith Oleson; Add forcing height and aerodynamic parameters - !----------------------------------------------------------------------- - - !------------------------------------------------------------------ - ! Initialize mathmatical constants - !------------------------------------------------------------------ - - real(r8) :: rpi = SHR_CONST_PI - - !------------------------------------------------------------------ - ! Initialize physical constants - !------------------------------------------------------------------ - - real(r8), parameter :: n_melt=0.7 ! fsca shape parameter - real(r8), parameter :: e_ice=6.0 ! soil ice impedance factor - real(r8), parameter :: pc = 0.4 ! threshold probability - real(r8), parameter :: mu = 0.13889 ! connectivity exponent - real(r8), parameter :: secsphr = 3600._r8 ! Seconds in an hour - integer, parameter :: isecsphr = int(secsphr) ! Integer seconds in an hour - integer, parameter :: isecspmin= 60 ! Integer seconds in a minute - real(r8) :: grav = SHR_CONST_G ! gravity constant [m/s2] - real(r8) :: sb = SHR_CONST_STEBOL ! stefan-boltzmann constant [W/m2/K4] - real(r8) :: vkc = SHR_CONST_KARMAN ! von Karman constant [-] - real(r8) :: rwat = SHR_CONST_RWV ! gas constant for water vapor [J/(kg K)] - real(r8) :: rair = SHR_CONST_RDAIR ! gas constant for dry air [J/kg/K] - real(r8) :: roverg = SHR_CONST_RWV/SHR_CONST_G*1000._r8 ! Rw/g constant = (8.3144/0.018)/(9.80616)*1000. mm/K - real(r8) :: cpliq = SHR_CONST_CPFW ! Specific heat of water [J/kg-K] - real(r8) :: cpice = SHR_CONST_CPICE ! Specific heat of ice [J/kg-K] - real(r8) :: cpair = SHR_CONST_CPDAIR ! specific heat of dry air [J/kg/K] - real(r8) :: hvap = SHR_CONST_LATVAP ! Latent heat of evap for water [J/kg] - real(r8) :: hsub = SHR_CONST_LATSUB ! Latent heat of sublimation [J/kg] - real(r8) :: hfus = SHR_CONST_LATICE ! Latent heat of fusion for ice [J/kg] - real(r8) :: denh2o = SHR_CONST_RHOFW ! density of liquid water [kg/m3] - real(r8) :: denice = SHR_CONST_RHOICE ! density of ice [kg/m3] - real(r8) :: rgas = SHR_CONST_RGAS ! universal gas constant [J/K/kmole] - real(r8) :: pstd = SHR_CONST_PSTD ! standard pressure [Pa] - - ! TODO(wjs, 2016-04-08) The following should be used in place of hard-coded constants - ! of 0.622 and 0.378 (which is 1 - 0.622) in various places in the code: - real(r8), parameter :: wv_to_dair_weight_ratio = SHR_CONST_MWWV/SHR_CONST_MWDAIR ! ratio of molecular weight of water vapor to that of dry air [-] - - real(r8) :: tkair = 0.023_r8 ! thermal conductivity of air [W/m/K] - real(r8) :: tkice = 2.290_r8 ! thermal conductivity of ice [W/m/K] - real(r8) :: tkwat = 0.57_r8 ! thermal conductivity of water [W/m/K] - real(r8), parameter :: tfrz = SHR_CONST_TKFRZ ! freezing temperature [K] - real(r8), parameter :: tcrit = 2.5_r8 ! critical temperature to determine rain or snow - real(r8) :: o2_molar_const = 0.209_r8 ! constant atmospheric O2 molar ratio (mol/mol) - real(r8) :: oneatm = 1.01325e5_r8 ! one standard atmospheric pressure [Pa] - real(r8) :: bdsno = 250._r8 ! bulk density snow (kg/m**3) - real(r8) :: alpha_aero = 1.0_r8 ! constant for aerodynamic parameter weighting - real(r8) :: tlsai_crit = 2.0_r8 ! critical value of elai+esai for which aerodynamic parameters are maximum - real(r8) :: watmin = 0.01_r8 ! minimum soil moisture (mm) - - real(r8) :: re = SHR_CONST_REARTH*0.001_r8 ! radius of earth (km) - - real(r8), public, parameter :: degpsec = 15._r8/3600.0_r8 ! Degree's earth rotates per second - real(r8), public, parameter :: secspday= SHR_CONST_CDAY ! Seconds per day - integer, public, parameter :: isecspday= secspday ! Integer seconds per day - - integer, public, parameter :: fun_period = 1 ! A FUN parameter, and probably needs to be changed for testing - real(r8),public, parameter :: smallValue = 1.e-12_r8 ! A small values used by FUN - - ! ------------------------------------------------------------------------ - ! Special value flags - ! ------------------------------------------------------------------------ - - ! NOTE(wjs, 2015-11-23) The presence / absence of spval should be static in time for - ! multi-level fields. i.e., if a given level & column has spval at initialization, it - ! should remain spval throughout the run (e.g., indicating that this level is not valid - ! for this column type); similarly, if it starts as a valid value, it should never - ! become spval. This is needed for init_interp to work correctly on multi-level fields. - ! For more details, see the note near the top of initInterpMultilevelInterp. - real(r8), public, parameter :: spval = 1.e36_r8 ! special value for real data - - ! Keep this negative to avoid conflicts with possible valid values - integer , public, parameter :: ispval = -9999 ! special value for int data - - ! ------------------------------------------------------------------------ - ! These are tunable constants from clm2_3 - ! ------------------------------------------------------------------------ - - real(r8) :: zlnd = 0.01_r8 ! Roughness length for soil [m] - real(r8) :: zsno = 0.0024_r8 ! Roughness length for snow [m] - real(r8) :: csoilc = 0.004_r8 ! Drag coefficient for soil under canopy [-] - real(r8) :: capr = 0.34_r8 ! Tuning factor to turn first layer T into surface T - real(r8) :: cnfac = 0.5_r8 ! Crank Nicholson factor between 0 and 1 - real(r8) :: ssi = 0.033_r8 ! Irreducible water saturation of snow - real(r8) :: wimp = 0.05_r8 ! Water impremeable if porosity less than wimp - real(r8) :: pondmx = 0.0_r8 ! Ponding depth (mm) - real(r8) :: pondmx_urban = 1.0_r8 ! Ponding depth for urban roof and impervious road (mm) - - real(r8) :: thk_bedrock = 3.0_r8 ! thermal conductivity of 'typical' saturated granitic rock - ! (Clauser and Huenges, 1995)(W/m/K) - real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) !scs - real(r8), parameter :: zmin_bedrock = 0.4_r8 ! minimum soil depth [m] - - real(r8), parameter :: aquifer_water_baseline = 5000._r8 ! baseline value for water in the unconfined aquifer [mm] - - !!! C13 - real(r8), parameter :: preind_atm_del13c = -6.0 ! preindustrial value for atmospheric del13C - real(r8), parameter :: preind_atm_ratio = SHR_CONST_PDB + (preind_atm_del13c * SHR_CONST_PDB)/1000.0 ! 13C/12C - real(r8) :: c13ratio = preind_atm_ratio/(1.0+preind_atm_ratio) ! 13C/(12+13)C preind atmosphere - - ! typical del13C for C3 photosynthesis (permil, relative to PDB) - real(r8), parameter :: c3_del13c = -28._r8 - - ! typical del13C for C4 photosynthesis (permil, relative to PDB) - real(r8), parameter :: c4_del13c = -13._r8 - - ! isotope ratio (13c/12c) for C3 photosynthesis - real(r8), parameter :: c3_r1 = SHR_CONST_PDB + ((c3_del13c*SHR_CONST_PDB)/1000._r8) - - ! isotope ratio (13c/[12c+13c]) for C3 photosynthesis - real(r8), parameter :: c3_r2 = c3_r1/(1._r8 + c3_r1) - - ! isotope ratio (13c/12c) for C4 photosynthesis - real(r8), parameter :: c4_r1 = SHR_CONST_PDB + ((c4_del13c*SHR_CONST_PDB)/1000._r8) - - ! isotope ratio (13c/[12c+13c]) for C4 photosynthesis - real(r8), parameter :: c4_r2 = c4_r1/(1._r8 + c4_r1) - - !!! C14 - real(r8) :: c14ratio = 1.e-12_r8 - ! real(r8) :: c14ratio = 1._r8 ! debug lets set to 1 to try to avoid numerical errors - - !------------------------------------------------------------------ - ! Urban building temperature constants - !------------------------------------------------------------------ - real(r8) :: ht_wasteheat_factor = 0.2_r8 ! wasteheat factor for urban heating (-) - real(r8) :: ac_wasteheat_factor = 0.6_r8 ! wasteheat factor for urban air conditioning (-) - real(r8) :: em_roof_int = 0.9_r8 ! emissivity of interior surface of roof (Bueno et al. 2012, GMD) - real(r8) :: em_sunw_int = 0.9_r8 ! emissivity of interior surface of sunwall (Bueno et al. 2012, GMD) - real(r8) :: em_shdw_int = 0.9_r8 ! emissivity of interior surface of shadewall Bueno et al. 2012, GMD) - real(r8) :: em_floor_int = 0.9_r8 ! emissivity of interior surface of floor (Bueno et al. 2012, GMD) - real(r8) :: hcv_roof = 0.948_r8 ! interior convective heat transfer coefficient for roof (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: hcv_roof_enhanced = 4.040_r8 ! enhanced (t_roof_int <= t_room) interior convective heat transfer coefficient for roof (Bueno et al. 2012, GMD) !(W m-2 K-1) - real(r8) :: hcv_floor = 0.948_r8 ! interior convective heat transfer coefficient for floor (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: hcv_floor_enhanced = 4.040_r8 ! enhanced (t_floor_int >= t_room) interior convective heat transfer coefficient for floor (Bueno et al. !2012, GMD) (W m-2 K-1) - real(r8) :: hcv_sunw = 3.076_r8 ! interior convective heat transfer coefficient for sunwall (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: hcv_shdw = 3.076_r8 ! interior convective heat transfer coefficient for shadewall (Bueno et al. 2012, GMD) (W m-2 K-1) - real(r8) :: dz_floor = 0.1_r8 ! floor thickness - concrete (Salmanca et al. 2010, TAC) (m) - real(r8), parameter :: dens_floor = 2.35e3_r8 ! density of floor - concrete (Salmanca et al. 2010, TAC) (kg m-3) - real(r8), parameter :: sh_floor = 880._r8 ! specific heat of floor - concrete (Salmanca et al. 2010, TAC) (J kg-1 K-1) - real(r8) :: cp_floor = dens_floor*sh_floor ! volumetric heat capacity of floor - concrete (Salmanca et al. 2010, TAC) (J m-3 K-1) - real(r8) :: vent_ach = 0.3 ! ventilation rate (air exchanges per hour) - - real(r8) :: wasteheat_limit = 100._r8 ! limit on wasteheat (W/m2) - - !------------------------------------------------------------------ - - real(r8) :: h2osno_max = -999.0_r8 ! max allowed snow thickness (mm H2O) - real(r8) :: int_snow_max = -999.0_r8 ! limit applied to integrated snowfall when determining changes in snow-covered fraction during melt (mm H2O) - real(r8) :: n_melt_glcmec = -999.0_r8 ! SCA shape parameter for glc_mec columns - - integer, private :: i ! loop index - - !real(r8), parameter :: nitrif_n2o_loss_frac = 0.02_r8 ! fraction of N lost as N2O in nitrification (Parton et al., 2001) - real(r8), parameter :: nitrif_n2o_loss_frac = 6.e-4_r8 ! fraction of N lost as N2O in nitrification (Li et al., 2000) - real(r8), parameter :: frac_minrlztn_to_no3 = 0.2_r8 ! fraction of N mineralized that is dieverted to the nitrification stream (Parton et al., 2001) - - !------------------------------------------------------------------ - ! Set subgrid names - !------------------------------------------------------------------ - - character(len=16), parameter :: grlnd = 'lndgrid' ! name of lndgrid - character(len=16), parameter :: namea = 'gridcellatm' ! name of atmgrid - character(len=16), parameter :: nameg = 'gridcell' ! name of gridcells - character(len=16), parameter :: namel = 'landunit' ! name of landunits - character(len=16), parameter :: namec = 'column' ! name of columns - character(len=16), parameter :: namep = 'pft' ! name of patches - character(len=16), parameter :: nameCohort = 'cohort' ! name of cohorts (ED specific) - - !------------------------------------------------------------------ - ! Initialize miscellaneous radiation constants - !------------------------------------------------------------------ - - real(r8) :: betads = 0.5_r8 ! two-stream parameter betad for snow - real(r8) :: betais = 0.5_r8 ! two-stream parameter betai for snow - real(r8) :: omegas(numrad) ! two-stream parameter omega for snow by band - data (omegas(i),i=1,numrad) /0.8_r8, 0.4_r8/ - - ! Lake Model Constants will be defined in LakeCon. - - !------------------------------------------------------------------ - ! Soil depths are constants for now; lake depths can vary by gridcell - ! zlak and dzlak correspond to the default 50 m lake depth. - ! The values for the following arrays are set in routine iniTimeConst - !------------------------------------------------------------------ - - real(r8), allocatable :: zlak(:) !lake z (layers) - real(r8), allocatable :: dzlak(:) !lake dz (thickness) - real(r8), allocatable :: zsoi(:) !soil z (layers) - real(r8), allocatable :: dzsoi(:) !soil dz (thickness) - real(r8), allocatable :: zisoi(:) !soil zi (interfaces) - real(r8), allocatable :: dzsoi_decomp(:) !soil dz (thickness) - integer , allocatable :: nlvic(:) !number of CLM layers in each VIC layer (#) - real(r8), allocatable :: dzvic(:) !soil dz (thickness) of each VIC layer - real(r8) ,allocatable :: zsoifl(:) !original soil midpoint (used in interpolation of sand and clay) - real(r8) ,allocatable :: zisoifl(:) !original soil interface depth (used in interpolation of sand and clay) - real(r8) ,allocatable :: dzsoifl(:) !original soil thickness (used in interpolation of sand and clay) - - !------------------------------------------------------------------ - ! (Non-tunable) Constants for the CH4 submodel (Tuneable constants in ch4varcon) - !------------------------------------------------------------------ - ! Note some of these constants are also used in CNNitrifDenitrifMod - - real(r8), parameter :: catomw = 12.011_r8 ! molar mass of C atoms (g/mol) - - real(r8) :: s_con(ngases,4) ! Schmidt # calculation constants (spp, #) - data (s_con(1,i),i=1,4) /1898_r8, -110.1_r8, 2.834_r8, -0.02791_r8/ ! CH4 - data (s_con(2,i),i=1,4) /1801_r8, -120.1_r8, 3.7818_r8, -0.047608_r8/ ! O2 - data (s_con(3,i),i=1,4) /1911_r8, -113.7_r8, 2.967_r8, -0.02943_r8/ ! CO2 - - real(r8) :: d_con_w(ngases,3) ! water diffusivity constants (spp, #) (mult. by 10^-4) - data (d_con_w(1,i),i=1,3) /0.9798_r8, 0.02986_r8, 0.0004381_r8/ ! CH4 - data (d_con_w(2,i),i=1,3) /1.172_r8, 0.03443_r8, 0.0005048_r8/ ! O2 - data (d_con_w(3,i),i=1,3) /0.939_r8, 0.02671_r8, 0.0004095_r8/ ! CO2 - - real(r8) :: d_con_g(ngases,2) ! gas diffusivity constants (spp, #) (cm^2/s) (mult. by 10^-9) - data (d_con_g(1,i),i=1,2) /0.1875_r8, 0.0013_r8/ ! CH4 - data (d_con_g(2,i),i=1,2) /0.1759_r8, 0.00117_r8/ ! O2 - data (d_con_g(3,i),i=1,2) /0.1325_r8, 0.0009_r8/ ! CO2 - - real(r8) :: c_h_inv(ngases) ! constant (K) for Henry's law (4.12, Wania) - data c_h_inv(1:3) /1600._r8, 1500._r8, 2400._r8/ ! CH4, O2, CO2 - - real(r8) :: kh_theta(ngases) ! Henry's constant (L.atm/mol) at standard temperature (298K) - data kh_theta(1:3) /714.29_r8, 769.23_r8, 29.4_r8/ ! CH4, O2, CO2 - - real(r8) :: kh_tbase = 298._r8 ! base temperature for calculation of Henry's constant (K) - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------------ - subroutine clm_varcon_init( is_simple_buildtemp ) - ! - ! !DESCRIPTION: - ! This subroutine initializes constant arrays in clm_varcon. - ! MUST be called after clm_varpar_init. - ! - ! !USES: - use clm_varpar, only: nlevgrnd, nlevlak, nlevdecomp_full, nlevsoifl, nlayer - ! - ! !ARGUMENTS: - implicit none - logical, intent(in) :: is_simple_buildtemp ! If simple building temp method is being used - ! - ! !REVISION HISTORY: - ! Created by E. Kluzek -!------------------------------------------------------------------------------ - - allocate( zlak(1:nlevlak )) - allocate( dzlak(1:nlevlak )) - allocate( zsoi(1:nlevgrnd )) - allocate( dzsoi(1:nlevgrnd )) - allocate( zisoi(0:nlevgrnd )) - allocate( dzsoi_decomp(1:nlevdecomp_full )) - allocate( nlvic(1:nlayer )) - allocate( dzvic(1:nlayer )) - allocate( zsoifl(1:nlevsoifl )) - allocate( zisoifl(0:nlevsoifl )) - allocate( dzsoifl(1:nlevsoifl )) - - ! Zero out wastheat factors for simpler building temperature method (introduced in CLM4.5) - if ( is_simple_buildtemp )then - ht_wasteheat_factor = 0.0_r8 - ac_wasteheat_factor = 0.0_r8 - end if - - end subroutine clm_varcon_init - -end module clm_varcon diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 deleted file mode 100644 index 938155c5dd..0000000000 --- a/src/main/clm_varctl.F90 +++ /dev/null @@ -1,394 +0,0 @@ -module clm_varctl - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing run control variables - ! - ! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8, SHR_KIND_CL - use shr_sys_mod , only: shr_sys_abort ! cannot use endrun here due to circular dependency - ! - ! !PUBLIC MEMBER FUNCTIONS: - implicit none - public :: clm_varctl_set ! Set variables - public :: cnallocate_carbon_only_set - public :: cnallocate_carbon_only - ! - private - save - ! - ! !PUBLIC TYPES: - ! - integer , parameter, public :: iundef = -9999999 - real(r8), parameter, public :: rundef = -9999999._r8 - integer , parameter, public :: fname_len = SHR_KIND_CL ! max length of file names in this module - !---------------------------------------------------------- - ! - ! Run control variables - ! - ! case id - character(len=256), public :: caseid = ' ' - - ! case title - character(len=256), public :: ctitle = ' ' - - ! Type of run - integer, public :: nsrest = iundef - logical, public :: is_cold_start = .false. - logical, public :: is_interpolated_start = .false. ! True if we're starting from initial conditions that have been run through init_interp - - ! Startup from initial conditions - integer, public, parameter :: nsrStartup = 0 - - ! Continue from restart files - integer, public, parameter :: nsrContinue = 1 - - ! Branch from restart files - integer, public, parameter :: nsrBranch = 2 - - ! true => allow case name to remain the same for branch run - ! by default this is not allowed - logical, public :: brnch_retain_casename = .false. - - !true => no valid land points -- do NOT run - logical, public :: noland = .false. - - ! Hostname of machine running on - character(len=256), public :: hostname = ' ' - - ! username of user running program - character(len=256), public :: username = ' ' - - ! description of this source - character(len=256), public :: source = "Community Land Model CLM4.0" - - ! version of program - character(len=256), public :: version = " " - - ! dataset conventions - character(len=256), public :: conventions = "CF-1.0" - - !---------------------------------------------------------- - ! Unit Numbers - !---------------------------------------------------------- - ! - integer, public :: iulog = 6 ! "stdout" log file unit number, default is 6 - - !---------------------------------------------------------- - ! Output NetCDF files - !---------------------------------------------------------- - - logical, public :: outnc_large_files = .true. ! large file support for output NetCDF files - - !---------------------------------------------------------- - ! Run input files - !---------------------------------------------------------- - - character(len=fname_len), public :: finidat = ' ' ! initial conditions file name - character(len=fname_len), public :: fsurdat = ' ' ! surface data file name - character(len=fname_len), public :: fatmgrid = ' ' ! atm grid file name - character(len=fname_len), public :: fatmlndfrc = ' ' ! lnd frac file on atm grid - character(len=fname_len), public :: paramfile = ' ' ! ASCII data file with PFT physiological constants - character(len=fname_len), public :: nrevsn = ' ' ! restart data file name for branch run - character(len=fname_len), public :: fsnowoptics = ' ' ! snow optical properties file name - character(len=fname_len), public :: fsnowaging = ' ' ! snow aging parameters file name - - !---------------------------------------------------------- - ! Flag to read ndep rather than obtain it from coupler - !---------------------------------------------------------- - - logical, public :: ndep_from_cpl = .false. - - !---------------------------------------------------------- - ! Interpolation of finidat if requested - !---------------------------------------------------------- - - logical, public :: bound_h2osoi = .true. ! for debugging - - ! If finidat_interp_source is non-blank and finidat is blank then interpolation will be - ! done from finidat_interp_source to finidat_interp_dest. Note that - ! finidat_interp_source is not read in directly from the namelist - rather, it is set - ! from finidat if use_init_interp is .true. - - character(len=fname_len), public :: finidat_interp_source = ' ' - character(len=fname_len), public :: finidat_interp_dest = '' - - !---------------------------------------------------------- - ! Crop & Irrigation logic - !---------------------------------------------------------- - - ! If prognostic crops are turned on - logical, public :: use_crop = .false. - - ! true => separate crop landunit is not created by default - logical, public :: create_crop_landunit = .false. - - ! do not irrigate by default - logical, public :: irrigate = .false. - - !---------------------------------------------------------- - ! Other subgrid logic - !---------------------------------------------------------- - - ! true => allocate and run urban landunits everywhere where we have valid urban data - logical, public :: run_zero_weight_urban = .false. - - ! true => make ALL patches, cols & landunits active (even if weight is 0) - logical, public :: all_active = .false. - - !---------------------------------------------------------- - ! BGC logic and datasets - !---------------------------------------------------------- - - ! values of 'prognostic','diagnostic','constant' - character(len=16), public :: co2_type = 'constant' - - ! State of the model for the accelerated decomposition (AD) spinup. - ! 0 (default) = normal model; 1 = AD SPINUP - integer, public :: spinup_state = 0 - - ! true => anoxia is applied to heterotrophic respiration also considered in CH4 model - ! default value reset in controlMod - logical, public :: anoxia = .true. - - ! used to override an error check on reading in restart files - logical, public :: override_bgc_restart_mismatch_dump = .false. - - ! Set in CNAllocationInit (TODO - had to move it here to avoid circular dependency) - logical, private:: carbon_only - - ! Set in CNNDynamicsInit - ! NOTE (mvertens, 2014-9 had to move it here to avoid confusion when carbon data types - ! wehre split - TODO - should move it our of this module) - ! NOTE(bandre, 2013-10) according to Charlie Koven, nfix_timeconst - ! is currently used as a flag and rate constant. - ! Rate constant: time over which to exponentially relax the npp flux for N fixation term - ! (days) time over which to exponentially relax the npp flux for N fixation term - ! flag: (if <= 0. or >= 365; use old annual method). - ! Default value is junk that should always be overwritten by the namelist or init function! - ! - real(r8), public :: nfix_timeconst = -1.2345_r8 - - !---------------------------------------------------------- - ! Physics - !---------------------------------------------------------- - - ! use subgrid fluxes - integer, public :: subgridflag = 1 - - ! true => write global average diagnostics to std out - logical, public :: wrtdia = .false. - - ! atmospheric CO2 molar ratio (by volume) (umol/mol) - real(r8), public :: co2_ppmv = 355._r8 ! - - !---------------------------------------------------------- - ! C isotopes - !---------------------------------------------------------- - - logical, public :: use_c13 = .false. ! true => use C-13 model - logical, public :: use_c14 = .false. ! true => use C-14 model - - !---------------------------------------------------------- - ! FATES switches - !---------------------------------------------------------- - - logical, public :: use_fates = .false. ! true => use fates - - ! These are INTERNAL to the FATES module - logical, public :: use_fates_spitfire = .false. ! true => use spitfire model - logical, public :: use_fates_logging = .false. ! true => turn on logging module - logical, public :: use_fates_planthydro = .false. ! true => turn on fates hydro - logical, public :: use_fates_ed_st3 = .false. ! true => static stand structure - logical, public :: use_fates_ed_prescribed_phys = .false. ! true => prescribed physiology - logical, public :: use_fates_inventory_init = .false. ! true => initialize fates from inventory - character(len=256), public :: fates_inventory_ctrl_filename = '' ! filename for inventory control - - !---------------------------------------------------------- - ! LUNA switches - !---------------------------------------------------------- - - logical, public :: use_luna = .false. ! true => use LUNA - - !---------------------------------------------------------- - ! flexibleCN - !---------------------------------------------------------- - ! TODO(bja, 2015-08) some of these need to be moved into the - ! appropriate module. - logical, public :: use_flexibleCN = .false. - logical, public :: MM_Nuptake_opt = .false. - logical, public :: downreg_opt = .true. - integer, public :: plant_ndemand_opt = 0 - logical, public :: substrate_term_opt = .true. - logical, public :: nscalar_opt = .true. - logical, public :: temp_scalar_opt = .true. - logical, public :: CNratio_floating = .false. - logical, public :: lnc_opt = .false. - logical, public :: reduce_dayl_factor = .false. - integer, public :: vcmax_opt = 0 - integer, public :: CN_residual_opt = 0 - integer, public :: CN_partition_opt = 0 - integer, public :: CN_evergreen_phenology_opt = 0 - integer, public :: carbon_resp_opt = 0 - - !---------------------------------------------------------- - ! lai streams switch for Sat. Phenology - !---------------------------------------------------------- - - logical, public :: use_lai_streams = .false. ! true => use lai streams in SatellitePhenologyMod.F90 - - !---------------------------------------------------------- - ! bedrock / soil depth switch - !---------------------------------------------------------- - - logical, public :: use_bedrock = .false. ! true => use spatially variable soil depth - character(len=16), public :: soil_layerstruct = '10SL_3.5m' - - !---------------------------------------------------------- - ! plant hydraulic stress switch - !---------------------------------------------------------- - - logical, public :: use_hydrstress = .false. ! true => use plant hydraulic stress calculation - - !---------------------------------------------------------- - ! dynamic root switch - !---------------------------------------------------------- - - logical, public :: use_dynroot = .false. ! true => use dynamic root module - - !---------------------------------------------------------- - ! glacier_mec control variables: default values (may be overwritten by namelist) - !---------------------------------------------------------- - - ! true => CLM glacier area & topography changes dynamically - logical , public :: glc_do_dynglacier = .false. - - ! number of days before one considers the perennially snow-covered point 'land ice' - integer , public :: glc_snow_persistence_max_days = 7300 - - ! - !---------------------------------------------------------- - ! single column control variables - !---------------------------------------------------------- - - logical, public :: single_column = .false. ! true => single column mode - real(r8), public :: scmlat = rundef ! single column lat - real(r8), public :: scmlon = rundef ! single column lon - - !---------------------------------------------------------- - ! instance control - !---------------------------------------------------------- - - integer, public :: inst_index - character(len=16), public :: inst_name - character(len=16), public :: inst_suffix - - !---------------------------------------------------------- - ! Decomp control variables - !---------------------------------------------------------- - - ! number of segments per clump for decomp - integer, public :: nsegspc = 20 - - !---------------------------------------------------------- - ! Derived variables (run, history and restart file) - !---------------------------------------------------------- - - ! directory name for local restart pointer file - character(len=256), public :: rpntdir = '.' - - ! file name for local restart pointer file - character(len=256), public :: rpntfil = 'rpointer.lnd' - - ! moved hist_wrtch4diag from histFileMod.F90 to here - caused compiler error with intel - ! namelist: write CH4 extra diagnostic output - logical, public :: hist_wrtch4diag = .false. - - !---------------------------------------------------------- - ! FATES - !---------------------------------------------------------- - character(len=fname_len), public :: fates_paramfile = ' ' - - !---------------------------------------------------------- - ! Migration of CPP variables - !---------------------------------------------------------- - - logical, public :: use_lch4 = .false. - logical, public :: use_nitrif_denitrif = .false. - logical, public :: use_vertsoilc = .false. - logical, public :: use_extralakelayers = .false. - logical, public :: use_vichydro = .false. - logical, public :: use_century_decomp = .false. - logical, public :: use_cn = .false. - logical, public :: use_cndv = .false. - logical, public :: use_grainproduct = .false. - logical, public :: use_fertilizer = .false. - logical, public :: use_ozone = .false. - logical, public :: use_snicar_frc = .false. - logical, public :: use_vancouver = .false. - logical, public :: use_mexicocity = .false. - logical, public :: use_noio = .false. - - logical, public :: use_nguardrail = .false. - - !---------------------------------------------------------- - ! To retrieve namelist - !---------------------------------------------------------- - character(len=SHR_KIND_CL), public :: NLFilename_in ! Namelist filename - ! - logical, private :: clmvarctl_isset = .false. - !----------------------------------------------------------------------- - -contains - - !--------------------------------------------------------------------------- - subroutine clm_varctl_set( caseid_in, ctitle_in, brnch_retain_casename_in, & - single_column_in, scmlat_in, scmlon_in, nsrest_in, & - version_in, hostname_in, username_in) - ! - ! !DESCRIPTION: - ! Set input control variables. - ! - ! !ARGUMENTS: - character(len=256), optional, intent(IN) :: caseid_in ! case id - character(len=256), optional, intent(IN) :: ctitle_in ! case title - logical, optional, intent(IN) :: brnch_retain_casename_in ! true => allow case name to remain the - ! same for branch run - logical, optional, intent(IN) :: single_column_in ! true => single column mode - real(r8), optional, intent(IN) :: scmlat_in ! single column lat - real(r8), optional, intent(IN) :: scmlon_in ! single column lon - integer, optional, intent(IN) :: nsrest_in ! 0: initial run. 1: restart: 3: branch - character(len=256), optional, intent(IN) :: version_in ! model version - character(len=256), optional, intent(IN) :: hostname_in ! hostname running on - character(len=256), optional, intent(IN) :: username_in ! username running job - !----------------------------------------------------------------------- - - if ( clmvarctl_isset )then - call shr_sys_abort(' ERROR:: control variables already set, cannot call this routine') - end if - - if ( present(caseid_in ) ) caseid = caseid_in - if ( present(ctitle_in ) ) ctitle = ctitle_in - if ( present(single_column_in) ) single_column = single_column_in - if ( present(scmlat_in ) ) scmlat = scmlat_in - if ( present(scmlon_in ) ) scmlon = scmlon_in - if ( present(nsrest_in ) ) nsrest = nsrest_in - if ( present(brnch_retain_casename_in) ) brnch_retain_casename = brnch_retain_casename_in - if ( present(version_in ) ) version = version_in - if ( present(username_in ) ) username = username_in - if ( present(hostname_in ) ) hostname = hostname_in - - end subroutine clm_varctl_set - - ! Set module carbon_only flag - subroutine cnallocate_carbon_only_set(carbon_only_in) - logical, intent(in) :: carbon_only_in - carbon_only = carbon_only_in - end subroutine cnallocate_carbon_only_set - - ! Get module carbon_only flag - logical function CNAllocate_Carbon_only() - cnallocate_carbon_only = carbon_only - end function CNAllocate_Carbon_only - -end module clm_varctl diff --git a/src/main/clm_varpar.F90 b/src/main/clm_varpar.F90 deleted file mode 100644 index d2011dcae4..0000000000 --- a/src/main/clm_varpar.F90 +++ /dev/null @@ -1,215 +0,0 @@ -module clm_varpar - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing CLM parameters - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use spmdMod , only: masterproc - use clm_varctl , only: use_extralakelayers, use_vertsoilc - use clm_varctl , only: use_century_decomp, use_c13, use_c14 - use clm_varctl , only: iulog, use_crop, create_crop_landunit, irrigate - use clm_varctl , only: use_vichydro, soil_layerstruct - use clm_varctl , only: use_fates - - ! - ! !PUBLIC TYPES: - implicit none - save - - ! Note - model resolution is read in from the surface dataset - - integer, parameter :: nlev_equalspace = 15 - integer, parameter :: toplev_equalspace = 6 - integer :: nlevsoi ! number of hydrologically active soil layers - integer :: nlevsoifl ! number of soil layers on input file - integer :: nlevgrnd ! number of ground layers - ! (includes lower layers that are hydrologically inactive) - integer :: nlevurb ! number of urban layers - integer :: nlevlak ! number of lake layers - integer :: nlevdecomp ! number of biogeochemically active soil layers - integer :: nlevdecomp_full ! number of biogeochemical layers - ! (includes lower layers that are biogeochemically inactive) - integer :: nlevsno = -1 ! maximum number of snow layers - integer, parameter :: ngases = 3 ! CH4, O2, & CO2 - integer, parameter :: nlevcan = 1 ! number of leaf layers in canopy layer - integer, parameter :: nvegwcs = 4 ! number of vegetation water conductance segments - !ED variables - integer, parameter :: numwat = 5 ! number of water types (soil, ice, 2 lakes, wetland) - integer, parameter :: numrad = 2 ! number of solar radiation bands: vis, nir - integer, parameter :: ivis = 1 ! index for visible band - integer, parameter :: inir = 2 ! index for near-infrared band - integer, parameter :: numsolar = 2 ! number of solar type bands: direct, diffuse - integer, parameter :: ndst = 4 ! number of dust size classes (BGC only) - integer, parameter :: dst_src_nbr = 3 ! number of size distns in src soil (BGC only) - integer, parameter :: sz_nbr = 200 ! number of sub-grid bins in large bin of dust size distribution (BGC only) - integer, parameter :: mxpft = 78 ! maximum number of PFT's for any mode; - ! FIX(RF,032414) might we set some of these automatically from reading pft-physiology? - integer, parameter :: numveg = 16 ! number of veg types (without specific crop) - integer, parameter :: nlayer = 3 ! number of VIC soil layer --Added by AWang - integer :: nlayert ! number of VIC soil layer + 3 lower thermal layers - integer, parameter :: nvariants = 2 ! number of variants of PFT constants - - integer :: numpft = mxpft ! actual # of pfts (without bare) - integer :: numcft = 64 ! actual # of crops (includes unused CFTs that are merged into other CFTs) - integer :: maxpatch_urb= 5 ! max number of urban patches (columns) in urban landunit - - integer :: maxpatch_pft ! max number of plant functional types in naturally vegetated landunit (namelist setting) - - ! constants for decomposition cascade - - integer, parameter :: i_met_lit = 1 - integer, parameter :: i_cel_lit = i_met_lit + 1 - integer, parameter :: i_lig_lit = i_cel_lit + 1 - integer :: i_cwd - - integer :: ndecomp_pools - integer :: ndecomp_cascade_transitions - - ! Indices used in surface file read and set in clm_varpar_init - - integer :: natpft_lb ! In PATCH arrays, lower bound of Patches on the natural veg landunit (i.e., bare ground index) - integer :: natpft_ub ! In PATCH arrays, upper bound of Patches on the natural veg landunit - integer :: natpft_size ! Number of Patches on natural veg landunit (including bare ground) - - ! The following variables pertain to arrays of all PFTs - e.g., those dimensioned (g, - ! pft_index). These include unused CFTs that are merged into other CFTs. Thus, these - ! variables do NOT give the actual number of CFTs on the crop landunit - that number - ! will generally be less because CLM does not simulate all crop types (some crop types - ! are merged into other types). - integer :: cft_lb ! In arrays of PFTs, lower bound of PFTs on the crop landunit - integer :: cft_ub ! In arrays of PFTs, upper bound of PFTs on the crop landunit - integer :: cft_size ! Number of PFTs on crop landunit in arrays of PFTs - - integer :: maxpatch_glcmec ! max number of elevation classes - integer :: max_patch_per_col - ! - ! !PUBLIC MEMBER FUNCTIONS: - public clm_varpar_init ! set parameters - ! - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------------ - subroutine clm_varpar_init() - ! - ! !DESCRIPTION: - ! Initialize module variables - ! - ! !ARGUMENTS: - implicit none - ! - ! !LOCAL VARIABLES: - ! - character(len=32) :: subname = 'clm_varpar_init' ! subroutine name - !------------------------------------------------------------------------------ - - ! Crop settings and consistency checks - - if (use_crop) then - numpft = mxpft ! actual # of patches (without bare) - numcft = 64 ! actual # of crops - else - numpft = numveg ! actual # of patches (without bare) - numcft = 2 ! actual # of crops - end if - - ! For arrays containing all Patches (natural veg & crop), determine lower and upper bounds - ! for (1) Patches on the natural vegetation landunit (includes bare ground, and includes - ! crops if create_crop_landunit=false), and (2) CFTs on the crop landunit (no elements - ! if create_crop_landunit=false) - - if (create_crop_landunit) then - natpft_size = (numpft + 1) - numcft ! note that numpft doesn't include bare ground -- thus we add 1 - cft_size = numcft - else - natpft_size = numpft + 1 ! note that numpft doesn't include bare ground -- thus we add 1 - cft_size = 0 - end if - - natpft_lb = 0 - natpft_ub = natpft_lb + natpft_size - 1 - cft_lb = natpft_ub + 1 - cft_ub = cft_lb + cft_size - 1 - - ! TODO(wjs, 2015-10-04, bugz 2227) Using numcft in this 'max' gives a significant - ! overestimate of max_patch_per_col when use_crop is true. This should be reworked - - ! or, better, removed from the code entirely (because it is a maintenance problem, and - ! I can't imagine that looping idioms that use it help performance that much, and - ! likely they hurt performance.) - max_patch_per_col= max(numpft+1, numcft, maxpatch_urb) - - nlevsoifl = 10 - nlevurb = 5 - if ( masterproc ) write(iulog, *) 'soil_layerstruct varpar ',soil_layerstruct - if ( soil_layerstruct == '10SL_3.5m' ) then - nlevsoi = nlevsoifl - nlevgrnd = 15 - else if ( soil_layerstruct == '23SL_3.5m' ) then - nlevsoi = 8 + nlev_equalspace - nlevgrnd = 15 + nlev_equalspace - else if ( soil_layerstruct == '49SL_10m' ) then - nlevsoi = 49 ! 10x10 + 9x100 + 30x300 = 1e4mm = 10m -! nlevsoi = 29 ! 10x10 + 9x100 + 10x300 = 4e3mm = 4m - nlevgrnd = nlevsoi+5 - else if ( soil_layerstruct == '20SL_8.5m' ) then - nlevsoi = 20 - nlevgrnd = nlevsoi+5 - endif - if ( masterproc ) write(iulog, *) 'soil_layerstruct varpar ',soil_layerstruct,nlevsoi,nlevgrnd - - if (use_vichydro) then - nlayert = nlayer + (nlevgrnd -nlevsoi) - endif - - ! here is a switch to set the number of soil levels for the biogeochemistry calculations. - ! currently it works on either a single level or on nlevsoi and nlevgrnd levels - if (use_vertsoilc) then - nlevdecomp = nlevsoi - nlevdecomp_full = nlevgrnd - else - nlevdecomp = 1 - nlevdecomp_full = 1 - end if - - if (.not. use_extralakelayers) then - nlevlak = 10 ! number of lake layers - else - nlevlak = 25 ! number of lake layers (Yields better results for site simulations) - end if - - if ( masterproc )then - write(iulog, *) 'CLM varpar subsurface discretization levels ' - write(iulog, '(a, i3)') ' nlevsoi = ', nlevsoi - write(iulog, '(a, i3)') ' nlevgrnd = ', nlevgrnd - write(iulog, '(a, i3)') ' nlevdecomp = ', nlevdecomp - write(iulog, '(a, i3)') ' nlevdecomp_full = ', nlevdecomp_full - write(iulog, '(a, i3)') ' nlevlak = ', nlevlak - write(iulog, *) - end if - - if ( use_fates ) then - i_cwd = 0 - if (use_century_decomp) then - ndecomp_pools = 6 - ndecomp_cascade_transitions = 8 - else - ndecomp_pools = 7 - ndecomp_cascade_transitions = 7 - end if - else - i_cwd = 4 - if (use_century_decomp) then - ndecomp_pools = 7 - ndecomp_cascade_transitions = 10 - else - ndecomp_pools = 8 - ndecomp_cascade_transitions = 9 - end if - endif - - end subroutine clm_varpar_init - -end module clm_varpar diff --git a/src/main/clm_varsur.F90 b/src/main/clm_varsur.F90 deleted file mode 100644 index a9b32dab30..0000000000 --- a/src/main/clm_varsur.F90 +++ /dev/null @@ -1,45 +0,0 @@ -module clm_instur - - !----------------------------------------------------------------------- - ! Module containing 2-d surface boundary data information - ! surface boundary data, these are all "gdc" local - ! Note that some of these need to be pointers (as opposed to just allocatable arrays) to - ! match the ncd_io interface; for consistency, we make them all pointers - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! weight of each landunit on the grid cell - real(r8), pointer :: wt_lunit(:,:) - - ! whether we have valid urban data in each grid cell - logical , pointer :: urban_valid(:) - - ! for natural veg landunit, weight of each patch on the landunit (adds to 1.0 on the - ! landunit for all grid cells, even those without any natural pft) - ! (second dimension goes natpft_lb:natpft_ub) - real(r8), pointer :: wt_nat_patch(:,:) - - ! for crop landunit, weight of each cft on the landunit (adds to 1.0 on the - ! landunit for all all grid cells, even those without any crop) - ! (second dimension goes cft_lb:cft_ub) - real(r8), pointer :: wt_cft(:,:) - - ! for each cft on the crop landunit prescribe annual fertilizer - ! landunit for all all grid cells, even those without any crop) - ! (second dimension goes cft_lb:cft_ub) - real(r8), pointer :: fert_cft(:,:) - - ! for glc_mec landunits, weight of glacier in each elevation class (adds to 1.0 on the - ! landunit for all grid cells, even those without any glacier) - real(r8), pointer :: wt_glc_mec(:,:) - - ! subgrid glacier_mec sfc elevation - real(r8), pointer :: topo_glc_mec(:,:) - !----------------------------------------------------------------------- - -end module clm_instur diff --git a/src/main/column_varcon.F90 b/src/main/column_varcon.F90 deleted file mode 100644 index 287df93b72..0000000000 --- a/src/main/column_varcon.F90 +++ /dev/null @@ -1,171 +0,0 @@ -module column_varcon - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing column indices and associated variables and routines. - ! - ! !USES: -#include "shr_assert.h" - use shr_log_mod , only : errMsg => shr_log_errMsg - use landunit_varcon, only : isturb_MIN - ! - ! !PUBLIC TYPES: - implicit none - save - private - - !------------------------------------------------------------------ - ! Initialize column type constants - !------------------------------------------------------------------ - - ! urban column types - - integer, parameter, public :: icol_roof = isturb_MIN*10 + 1 - integer, parameter, public :: icol_sunwall = isturb_MIN*10 + 2 - integer, parameter, public :: icol_shadewall = isturb_MIN*10 + 3 - integer, parameter, public :: icol_road_imperv = isturb_MIN*10 + 4 - integer, parameter, public :: icol_road_perv = isturb_MIN*10 + 5 - - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: is_hydrologically_active ! returns true if the given column type is hydrologically active - public :: icemec_class_to_col_itype ! convert an icemec class (1..maxpatch_glcmec) into col%itype - public :: col_itype_to_icemec_class ! convert col%itype into an icemec class (1..maxpatch_glcmec) - public :: write_coltype_metadata ! write column type metadata to a netcdf file - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - function is_hydrologically_active(col_itype, lun_itype) & - result(hydrologically_active) - ! - ! !DESCRIPTION: - ! Returns a logical value saying whether the given column type is hydrologically - ! active - ! - ! Note that calling this can be bad for performance, because it operates on a single - ! point rather than a loop. So in performance-critical parts of the code (or just - ! about anywhere, really), you should use the pre-set col%hydrologically_active(c). - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop - ! - ! !ARGUMENTS: - logical :: hydrologically_active ! function result - integer, intent(in) :: col_itype ! col%itype value - integer, intent(in) :: lun_itype ! lun%itype value for the landunit on which this column sits - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'is_hydrologically_active' - !----------------------------------------------------------------------- - - ! If we had an easy way to figure out which landunit a column was on based on - ! col_itype (which would be very helpful!), then we wouldn't need lun_itype. - - if (lun_itype == istsoil .or. lun_itype == istcrop) then - hydrologically_active = .true. - else if (col_itype == icol_road_perv) then - hydrologically_active = .true. - else - hydrologically_active = .false. - end if - - end function is_hydrologically_active - - - !----------------------------------------------------------------------- - function icemec_class_to_col_itype(icemec_class) result(col_itype) - ! - ! !DESCRIPTION: - ! Convert an icemec class (1..maxpatch_glcmec) into col%itype - ! - ! !USES: - use clm_varpar, only : maxpatch_glcmec - use landunit_varcon, only : istice_mec - ! - ! !ARGUMENTS: - integer :: col_itype ! function result - integer, intent(in) :: icemec_class ! icemec class, between 1 and maxpatch_glcmec - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'icemec_class_to_col_itype' - !----------------------------------------------------------------------- - - SHR_ASSERT((1 <= icemec_class .and. icemec_class <= maxpatch_glcmec), errMsg(sourcefile, __LINE__)) - - col_itype = istice_mec*100 + icemec_class - - end function icemec_class_to_col_itype - - !----------------------------------------------------------------------- - function col_itype_to_icemec_class(col_itype) result(icemec_class) - ! - ! !DESCRIPTION: - ! Convert a col%itype value (for an icemec landunit) into an icemec class (1..maxpatch_glcmec) - ! - ! !USES: - use clm_varpar, only : maxpatch_glcmec - use landunit_varcon, only : istice_mec - ! - ! !ARGUMENTS: - integer :: icemec_class ! function result - integer, intent(in) :: col_itype ! col%itype value for an icemec landunit - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'col_itype_to_icemec_class' - !----------------------------------------------------------------------- - - icemec_class = col_itype - istice_mec*100 - - ! The following assertion is here to ensure that col_itype is really from an - ! istice_mec landunit - SHR_ASSERT((1 <= icemec_class .and. icemec_class <= maxpatch_glcmec), errMsg(sourcefile, __LINE__)) - - end function col_itype_to_icemec_class - - !----------------------------------------------------------------------- - subroutine write_coltype_metadata(att_prefix, ncid) - ! - ! !DESCRIPTION: - ! Writes column type metadata to a netcdf file. - ! - ! Note that, unlike pft and landunit metadata, this column type metadata is NOT - ! stored in an array. This is because of the trickiness of encoding column values for - ! crop & icemec. So instead, other code must call this routine to do the work of - ! adding the appropriate metadata directly to a netcdf file. - ! - ! !USES: - use ncdio_pio, only : file_desc_t, ncd_global, ncd_putatt - ! - ! !ARGUMENTS: - character(len=*) , intent(in) :: att_prefix ! prefix for attributes (e.g., 'icol_') - type(file_desc_t) , intent(inout) :: ncid ! local file id - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'write_coltype_metadata' - !----------------------------------------------------------------------- - - call ncd_putatt(ncid, ncd_global, att_prefix // 'vegetated_or_bare_soil', 1) - call ncd_putatt(ncid, ncd_global, att_prefix // 'crop' , 2) - call ncd_putatt(ncid, ncd_global, att_prefix // 'crop_noncompete' , '2*100+m, m=cft_lb,cft_ub') - call ncd_putatt(ncid, ncd_global, att_prefix // 'landice' , 3) - call ncd_putatt(ncid, ncd_global, att_prefix // 'landice_multiple_elevation_classes', '4*100+m, m=1,glcnec') - call ncd_putatt(ncid, ncd_global, att_prefix // 'deep_lake' , 5) - call ncd_putatt(ncid, ncd_global, att_prefix // 'wetland' , 6) - call ncd_putatt(ncid, ncd_global, att_prefix // 'urban_roof' , icol_roof) - call ncd_putatt(ncid, ncd_global, att_prefix // 'urban_sunwall' , icol_sunwall) - call ncd_putatt(ncid, ncd_global, att_prefix // 'urban_shadewall' , icol_shadewall) - call ncd_putatt(ncid, ncd_global, att_prefix // 'urban_impervious_road' , icol_road_imperv) - call ncd_putatt(ncid, ncd_global, att_prefix // 'urban_pervious_road' , icol_road_perv) - - end subroutine write_coltype_metadata - - -end module column_varcon diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 deleted file mode 100644 index ae9c2fcafe..0000000000 --- a/src/main/controlMod.F90 +++ /dev/null @@ -1,1019 +0,0 @@ -module controlMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module which initializes run control variables. The following possible - ! namelist variables are set default values and possibly read in on startup - ! - ! Note: For definitions of namelist variables see - ! ../../bld/namelist_files/namelist_definition.xml - ! Display the file in a browser to see it neatly formatted in html. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8, SHR_KIND_CL - use shr_nl_mod , only: shr_nl_find_group_name - use shr_const_mod , only: SHR_CONST_CDAY - use shr_log_mod , only: errMsg => shr_log_errMsg - use abortutils , only: endrun - use spmdMod , only: masterproc, mpicom - use spmdMod , only: MPI_CHARACTER, MPI_INTEGER, MPI_LOGICAL, MPI_REAL8 - use decompMod , only: clump_pproc - use clm_varcon , only: h2osno_max, int_snow_max, n_melt_glcmec - use clm_varpar , only: maxpatch_pft, maxpatch_glcmec, numrad, nlevsno - use histFileMod , only: max_tapes, max_namlen - use histFileMod , only: hist_empty_htapes, hist_dov2xy, hist_avgflag_pertape, hist_type1d_pertape - use histFileMod , only: hist_nhtfrq, hist_ndens, hist_mfilt, hist_fincl1, hist_fincl2, hist_fincl3 - use histFileMod , only: hist_fincl4, hist_fincl5, hist_fincl6, hist_fincl7, hist_fincl8 - use histFileMod , only: hist_fincl9, hist_fincl10 - use histFileMod , only: hist_fexcl1, hist_fexcl2, hist_fexcl3, hist_fexcl4, hist_fexcl5, hist_fexcl6 - use histFileMod , only: hist_fexcl7, hist_fexcl8, hist_fexcl9, hist_fexcl10 - use initInterpMod , only: initInterp_readnl - use LakeCon , only: deepmixing_depthcrit, deepmixing_mixfact - use CanopyfluxesMod , only: perchroot, perchroot_alt - use CanopyHydrologyMod , only: CanopyHydrology_readnl - use SurfaceResistanceMod , only: soil_resistance_readNL - use SnowHydrologyMod , only: SnowHydrology_readnl - use SurfaceAlbedoMod , only: albice, lake_melt_icealb - use UrbanParamsType , only: UrbanReadNML - use HumanIndexMod , only: HumanIndexReadNML - use CNPrecisionControlMod , only: CNPrecisionControlReadNML - use CNSharedParamsMod , only: anoxia_wtsat, use_fun - use CIsoAtmTimeseriesMod , only: use_c14_bombspike, atm_c14_filename, use_c13_timeseries, atm_c13_filename - use SoilBiogeochemCompetitionMod , only: suplnitro, suplnNon - use SoilBiogeochemLittVertTranspMod , only: som_adv_flux, max_depth_cryoturb - use SoilBiogeochemVerticalProfileMod , only: surfprof_exp - use SoilBiogeochemNitrifDenitrifMod , only: no_frozen_nitrif_denitrif, nitrifReadNML - use SoilHydrologyMod , only: soilHydReadNML - use CNFireFactoryMod , only: CNFireReadNML - use CanopyFluxesMod , only: CanopyFluxesReadNML - use seq_drydep_mod , only: drydep_method, DD_XLND, n_drydep - use clm_varctl - ! - ! !PUBLIC TYPES: - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: control_setNL ! Set namelist filename - public :: control_init ! initial run control information - public :: control_print ! print run control information - ! - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: apply_use_init_interp ! apply the use_init_interp namelist option, if set - ! - ! !PRIVATE TYPES: - character(len= 7) :: runtyp(4) ! run type - character(len=SHR_KIND_CL) :: NLFilename = 'lnd.stdin' ! Namelist filename - -#if (defined _OPENMP) - integer, external :: omp_get_max_threads ! max number of threads that can execute concurrently in a single parallel region -#endif - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine control_setNL( NLfile ) - ! - ! !DESCRIPTION: - ! Set the namelist filename to use - ! - ! !ARGUMENTS: - character(len=*), intent(IN) :: NLFile ! Namelist filename - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'control_setNL' ! subroutine name - logical :: lexist ! File exists - !------------------------------------------------------------------------ - - ! Error checking... - if ( len_trim(NLFile) == 0 )then - call endrun(msg=' error: nlfilename entered is not set'//errMsg(sourcefile, __LINE__)) - end if - inquire (file = trim(NLFile), exist = lexist) - if ( .not. lexist )then - call endrun(msg=' error: NLfilename entered does NOT exist:'//& - trim(NLFile)//errMsg(sourcefile, __LINE__)) - end if - if ( len_trim(NLFile) > len(NLFilename) )then - call endrun(msg=' error: entered NLFile is too long'//errMsg(sourcefile, __LINE__)) - end if - ! Set the filename - NLFilename = NLFile - NLFilename_in = NLFilename ! For use in external namelists and to avoid creating dependencies on controlMod - end subroutine control_setNL - - !------------------------------------------------------------------------ - subroutine control_init( ) - ! - ! !DESCRIPTION: - ! Initialize CLM run control information - ! - ! !USES: - use clm_time_manager , only : set_timemgr_init - use fileutils , only : getavu, relavu - use CNMRespMod , only : CNMRespReadNML - use LunaMod , only : LunaReadNML - use FrictionVelocityMod , only : FrictionVelReadNML - use CNNDynamicsMod , only : CNNDynamicsReadNML - use SoilBiogeochemDecompCascadeBGCMod, only : DecompCascadeBGCreadNML - use CNPhenologyMod , only : CNPhenologyReadNML - ! - ! !LOCAL VARIABLES: - integer :: i ! loop indices - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - integer :: dtime ! Integer time-step - integer :: override_nsrest ! If want to override the startup type sent from driver - logical :: use_init_interp ! Apply initInterp to the file given by finidat - !------------------------------------------------------------------------ - - ! ---------------------------------------------------------------------- - ! Namelist Variables - ! ---------------------------------------------------------------------- - - ! Time step - namelist / clm_inparm/ & - dtime - - ! CLM namelist settings - - namelist /clm_inparm / & - fatmlndfrc, finidat, nrevsn, & - finidat_interp_dest, & - use_init_interp - - ! Input datasets - - namelist /clm_inparm/ & - fsurdat, & - paramfile, fsnowoptics, fsnowaging - - ! History, restart options - - namelist /clm_inparm/ & - hist_empty_htapes, hist_dov2xy, & - hist_avgflag_pertape, hist_type1d_pertape, & - hist_nhtfrq, hist_ndens, hist_mfilt, & - hist_fincl1, hist_fincl2, hist_fincl3, & - hist_fincl4, hist_fincl5, hist_fincl6, & - hist_fincl7, hist_fincl8, & - hist_fincl9, hist_fincl10, & - hist_fexcl1, hist_fexcl2, hist_fexcl3, & - hist_fexcl4, hist_fexcl5, hist_fexcl6, & - hist_fexcl7, hist_fexcl8, & - hist_fexcl9, hist_fexcl10 - namelist /clm_inparm/ hist_wrtch4diag - - ! BGC info - - namelist /clm_inparm/ & - suplnitro - namelist /clm_inparm/ & - nfix_timeconst - namelist /clm_inparm/ & - spinup_state, override_bgc_restart_mismatch_dump - - namelist /clm_inparm / & - co2_type - - namelist /clm_inparm / & - perchroot, perchroot_alt - - namelist /clm_inparm / & - anoxia, anoxia_wtsat, use_fun - - namelist /clm_inparm / & - deepmixing_depthcrit, deepmixing_mixfact, lake_melt_icealb - ! lake_melt_icealb is of dimension numrad - - ! Glacier_mec info - namelist /clm_inparm/ & - maxpatch_glcmec, glc_do_dynglacier, & - glc_snow_persistence_max_days, & - nlevsno, h2osno_max, int_snow_max, n_melt_glcmec - - ! Other options - - namelist /clm_inparm/ & - clump_pproc, wrtdia, & - create_crop_landunit, nsegspc, co2_ppmv, override_nsrest, & - albice, soil_layerstruct, subgridflag, & - irrigate, run_zero_weight_urban, all_active - - ! vertical soil mixing variables - namelist /clm_inparm/ & - som_adv_flux, max_depth_cryoturb - - ! C and N input vertical profiles - namelist /clm_inparm/ & - surfprof_exp - - namelist /clm_inparm/ no_frozen_nitrif_denitrif - - namelist /clm_inparm/ use_c13, use_c14 - - - ! FATES Flags - namelist /clm_inparm/ fates_paramfile, use_fates, & - use_fates_spitfire, use_fates_logging, & - use_fates_planthydro, use_fates_ed_st3, & - use_fates_ed_prescribed_phys, & - use_fates_inventory_init, & - fates_inventory_ctrl_filename - - - ! CLM 5.0 nitrogen flags - namelist /clm_inparm/ use_flexibleCN, use_luna - - namelist /clm_nitrogen/ MM_Nuptake_opt, downreg_opt, & - plant_ndemand_opt, substrate_term_opt, nscalar_opt, temp_scalar_opt, & - CNratio_floating, lnc_opt, reduce_dayl_factor, vcmax_opt, CN_residual_opt, & - CN_partition_opt, CN_evergreen_phenology_opt, carbon_resp_opt - - namelist /clm_inparm/ use_lai_streams - - namelist /clm_inparm/ use_bedrock - - namelist /clm_inparm/ use_hydrstress - - namelist /clm_inparm/ use_dynroot - - namelist /clm_inparm/ & - use_c14_bombspike, atm_c14_filename, use_c13_timeseries, atm_c13_filename - - ! All old cpp-ifdefs are below and have been converted to namelist variables - - ! max number of plant functional types in naturally vegetated landunit - namelist /clm_inparm/ maxpatch_pft - - namelist /clm_inparm/ & - use_lch4, use_nitrif_denitrif, use_vertsoilc, use_extralakelayers, & - use_vichydro, use_century_decomp, use_cn, use_cndv, use_crop, use_fertilizer, use_ozone, & - use_grainproduct, use_snicar_frc, use_vancouver, use_mexicocity, use_noio, & - use_nguardrail - - - ! ---------------------------------------------------------------------- - ! Default values - ! ---------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to initialize run control settings .....' - endif - - finidat_interp_dest = 'finidat_interp_dest'//trim(inst_suffix)//'.nc' - runtyp(:) = 'missing' - runtyp(nsrStartup + 1) = 'initial' - runtyp(nsrContinue + 1) = 'restart' - runtyp(nsrBranch + 1) = 'branch ' - - ! Set clumps per procoessor - -#if (defined _OPENMP) - clump_pproc = omp_get_max_threads() -#else - clump_pproc = 1 -#endif - - override_nsrest = nsrest - - use_init_interp = .false. - - if (masterproc) then - - ! ---------------------------------------------------------------------- - ! Read namelist from standard input. - ! ---------------------------------------------------------------------- - - if ( len_trim(NLFilename) == 0 )then - call endrun(msg=' error: nlfilename not set'//errMsg(sourcefile, __LINE__)) - end if - unitn = getavu() - write(iulog,*) 'Read in clm_inparm namelist from: ', trim(NLFilename) - open( unitn, file=trim(NLFilename), status='old' ) - call shr_nl_find_group_name(unitn, 'clm_inparm', status=ierr) - if (ierr == 0) then - read(unitn, clm_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg='ERROR reading clm_inparm namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding clm_inparm namelist'//errMsg(sourcefile, __LINE__)) - end if - call shr_nl_find_group_name(unitn, 'clm_nitrogen', status=ierr) - if (ierr == 0) then - read(unitn, clm_nitrogen, iostat=ierr) - if (ierr /= 0) then - call endrun(msg='ERROR reading clm_nitrogen namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding clm_nitrogen namelist'//errMsg(sourcefile, __LINE__)) - end if - - call relavu( unitn ) - - ! ---------------------------------------------------------------------- - ! Process some namelist variables, and perform consistency checks - ! ---------------------------------------------------------------------- - - call set_timemgr_init( dtime_in=dtime ) - - if (use_init_interp) then - call apply_use_init_interp(finidat, finidat_interp_source) - end if - - ! History and restart files - - do i = 1, max_tapes - if (hist_nhtfrq(i) < 0) then - hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) - endif - end do - - ! Override start-type (can only override to branch (3) and only - ! if the driver is a startup type - if ( override_nsrest /= nsrest )then - if ( override_nsrest /= nsrBranch .and. nsrest /= nsrStartup )then - call endrun(msg= ' ERROR: can ONLY override clm start-type ' // & - 'to branch type and ONLY if driver is a startup type'// & - errMsg(sourcefile, __LINE__)) - end if - call clm_varctl_set( nsrest_in=override_nsrest ) - end if - - if (maxpatch_glcmec <= 0) then - call endrun(msg=' ERROR: maxpatch_glcmec must be at least 1 ' // & - errMsg(sourcefile, __LINE__)) - end if - - if (use_crop .and. .not. create_crop_landunit) then - call endrun(msg=' ERROR: prognostic crop Patches require create_crop_landunit=.true.'//& - errMsg(sourcefile, __LINE__)) - end if - - if (use_lch4 .and. use_vertsoilc) then - anoxia = .true. - else - anoxia = .false. - end if - - ! ---------------------------------------------------------------------- - ! Check compatibility with the FATES model - if ( use_fates ) then - - if ( use_cn) then - call endrun(msg=' ERROR: use_cn and use_fates cannot both be set to true.'//& - errMsg(sourcefile, __LINE__)) - end if - - if ( use_hydrstress) then - call endrun(msg=' ERROR: use_hydrstress and use_fates cannot both be set to true.'//& - errMsg(sourcefile, __LINE__)) - end if - - if ( use_crop ) then - call endrun(msg=' ERROR: use_crop and use_fates cannot both be set to true.'//& - errMsg(sourcefile, __LINE__)) - end if - - if( use_lch4 ) then - call endrun(msg=' ERROR: use_lch4 (methane) and use_fates cannot both be set to true.'//& - errMsg(sourcefile, __LINE__)) - end if - - if ( n_drydep > 0 .and. drydep_method /= DD_XLND ) then - call endrun(msg=' ERROR: dry deposition via ML Welsey is not compatible with FATES.'//& - errMsg(sourcefile, __LINE__)) - end if - - if( use_luna ) then - call endrun(msg=' ERROR: luna is not compatible with FATES.'//& - errMsg(sourcefile, __LINE__)) - end if - - if (use_ozone ) then - call endrun(msg=' ERROR: ozone is not compatible with FATES.'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - ! If nfix_timeconst is equal to the junk default value, then it was not specified - ! by the user namelist and we need to assign it the correct default value. If the - ! user specified it in the namelist, we leave it alone. - - if (nfix_timeconst == -1.2345_r8) then - if (use_nitrif_denitrif) then - nfix_timeconst = 10._r8 - else - nfix_timeconst = 0._r8 - end if - end if - - ! If nlevsno, h2osno_max, int_snow_max or n_melt_glcmec are equal to their junk - ! default value, then they were not specified by the user namelist and we generate - ! an error message. Also check nlevsno for bounds. - if (nlevsno < 3 .or. nlevsno > 12) then - write(iulog,*)'ERROR: nlevsno = ',nlevsno,' is not supported, must be in range 3-12.' - call endrun(msg=' ERROR: invalid value for nlevsno in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - if (h2osno_max <= 0.0_r8) then - write(iulog,*)'ERROR: h2osno_max = ',h2osno_max,' is not supported, must be greater than 0.0.' - call endrun(msg=' ERROR: invalid value for h2osno_max in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - if (int_snow_max <= 0.0_r8) then - write(iulog,*)'ERROR: int_snow_max = ',int_snow_max,' is not supported, must be greater than 0.0.' - call endrun(msg=' ERROR: invalid value for int_snow_max in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - if (n_melt_glcmec <= 0.0_r8) then - write(iulog,*)'ERROR: n_melt_glcmec = ',n_melt_glcmec,' is not supported, must be greater than 0.0.' - call endrun(msg=' ERROR: invalid value for n_melt_glcmec in CLM namelist. '//& - errMsg(sourcefile, __LINE__)) - endif - - endif ! end of if-masterproc if-block - - ! ---------------------------------------------------------------------- - ! Read in other namelists for other modules - ! ---------------------------------------------------------------------- - - call mpi_bcast (use_init_interp, 1, MPI_LOGICAL, 0, mpicom, ierr) - if (use_init_interp) then - call initInterp_readnl( NLFilename ) - end if - - !I call init_hydrology to set up default hydrology sub-module methods. - !For future version, I suggest to put the following two calls inside their - !own modules, which are called from their own initializing methods - call init_hydrology( NLFilename ) - - call soil_resistance_readnl ( NLFilename ) - call CanopyFluxesReadNML ( NLFilename ) - call CanopyHydrology_readnl ( NLFilename ) - call SnowHydrology_readnl ( NLFilename ) - call UrbanReadNML ( NLFilename ) - call HumanIndexReadNML ( NLFilename ) - call LunaReadNML ( NLFilename ) - call FrictionVelReadNML ( NLFilename ) - - ! ---------------------------------------------------------------------- - ! Broadcast all control information if appropriate - ! ---------------------------------------------------------------------- - - call control_spmd() - - ! ---------------------------------------------------------------------- - ! Read in other namelists that are dependent on other namelist setttings - ! ---------------------------------------------------------------------- - - if ( use_fun ) then - call CNMRespReadNML( NLFilename ) - end if - - call soilHydReadNML( NLFilename ) - if ( use_cn ) then - call nitrifReadNML( NLFilename ) - call CNFireReadNML( NLFilename ) - call CNPrecisionControlReadNML( NLFilename ) - call CNNDynamicsReadNML ( NLFilename ) - call CNPhenologyReadNML ( NLFilename ) - end if - if ( use_century_decomp ) then - call DecompCascadeBGCreadNML( NLFilename ) - end if - - ! ---------------------------------------------------------------------- - ! consistency checks - ! ---------------------------------------------------------------------- - - ! Consistency settings for co2 type - if (co2_type /= 'constant' .and. co2_type /= 'prognostic' .and. co2_type /= 'diagnostic') then - write(iulog,*)'co2_type = ',co2_type,' is not supported' - call endrun(msg=' ERROR:: choices are constant, prognostic or diagnostic'//& - errMsg(sourcefile, __LINE__)) - end if - - if ( use_dynroot .and. use_hydrstress ) then - call endrun(msg=' ERROR:: dynroot and hydrstress can NOT be on at the same time'//& - errMsg(sourcefile, __LINE__)) - end if - - ! Check on run type - if (nsrest == iundef) then - call endrun(msg=' ERROR:: must set nsrest'//& - errMsg(sourcefile, __LINE__)) - end if - if (nsrest == nsrBranch .and. nrevsn == ' ') then - call endrun(msg=' ERROR: need to set restart data file name'//& - errMsg(sourcefile, __LINE__)) - end if - - ! Consistency settings for co2_ppvm - if ( (co2_ppmv <= 0.0_r8) .or. (co2_ppmv > 3000.0_r8) ) then - call endrun(msg=' ERROR: co2_ppmv is out of a reasonable range'//& - errMsg(sourcefile, __LINE__)) - end if - - ! Consistency settings for nrevsn - - if (nsrest == nsrStartup ) nrevsn = ' ' - if (nsrest == nsrContinue) nrevsn = 'set by restart pointer file file' - if (nsrest /= nsrStartup .and. nsrest /= nsrContinue .and. nsrest /= nsrBranch ) then - call endrun(msg=' ERROR: nsrest NOT set to a valid value'//& - errMsg(sourcefile, __LINE__)) - end if - - ! Single Column - if ( single_column .and. (scmlat == rundef .or. scmlon == rundef ) ) then - call endrun(msg=' ERROR:: single column mode on -- but scmlat and scmlon are NOT set'//& - errMsg(sourcefile, __LINE__)) - if (.not. use_lch4 .and. anoxia) then - call endrun(msg='ERROR:: anoxia is turned on, but this currently requires turning on the CH4 submodel'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - if (masterproc) then - write(iulog,*) 'Successfully initialized run control settings' - write(iulog,*) - endif - - end subroutine control_init - - !------------------------------------------------------------------------ - subroutine control_spmd() - ! - ! !DESCRIPTION: - ! Distribute namelist data all processors. All program i/o is - ! funnelled through the master processor. Processor 0 either - ! reads restart/history data from the disk and distributes - ! it to all processors, or collects data from - ! all processors and writes it to disk. - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer ier !error code - !----------------------------------------------------------------------- - - ! run control variables - call mpi_bcast (caseid, len(caseid), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (ctitle, len(ctitle), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (version, len(version), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hostname, len(hostname), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (username, len(username), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (nsrest, 1, MPI_INTEGER, 0, mpicom, ier) - - call mpi_bcast (use_lch4, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_nitrif_denitrif, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_vertsoilc, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_extralakelayers, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_vichydro, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_century_decomp, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_cn, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_cndv, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_nguardrail, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_crop, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fertilizer, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_grainproduct, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_ozone, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_snicar_frc, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_vancouver, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_mexicocity, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_noio, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! initial file variables - call mpi_bcast (nrevsn, len(nrevsn), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat, len(finidat), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat_interp_source, len(finidat_interp_source), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat_interp_dest, len(finidat_interp_dest), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fsurdat, len(fsurdat), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (paramfile, len(paramfile) , MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fsnowoptics, len(fsnowoptics), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fsnowaging, len(fsnowaging), MPI_CHARACTER, 0, mpicom, ier) - - ! Irrigation - call mpi_bcast(irrigate, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! Landunit generation - call mpi_bcast(create_crop_landunit, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! Other subgrid logic - call mpi_bcast(run_zero_weight_urban, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast(all_active, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! max number of plant functional types in naturally vegetated landunit - call mpi_bcast(maxpatch_pft, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! BGC - call mpi_bcast (co2_type, len(co2_type), MPI_CHARACTER, 0, mpicom, ier) - if (use_cn) then - call mpi_bcast (suplnitro, len(suplnitro), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (nfix_timeconst, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (spinup_state, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (override_bgc_restart_mismatch_dump, 1, MPI_LOGICAL, 0, mpicom, ier) - end if - - ! isotopes - call mpi_bcast (use_c13, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_c14, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_fates, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_fates_spitfire, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_logging, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_planthydro, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_ed_st3, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_ed_prescribed_phys, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_fates_inventory_init, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (fates_inventory_ctrl_filename, len(fates_inventory_ctrl_filename), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fates_paramfile, len(fates_paramfile) , MPI_CHARACTER, 0, mpicom, ier) - - ! flexibleCN nitrogen model - call mpi_bcast (use_flexibleCN, 1, MPI_LOGICAL, 0, mpicom, ier) - ! TODO(bja, 2015-08) need to move some of these into a module with limited scope. - call mpi_bcast (MM_Nuptake_opt, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (downreg_opt, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (plant_ndemand_opt, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (substrate_term_opt, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (nscalar_opt, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (temp_scalar_opt, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (CNratio_floating, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (lnc_opt, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (reduce_dayl_factor, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (vcmax_opt, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (CN_residual_opt, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (CN_partition_opt, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (CN_evergreen_phenology_opt, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (carbon_resp_opt, 1, MPI_INTEGER, 0, mpicom, ier) - - call mpi_bcast (use_luna, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_lai_streams, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_bedrock, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_hydrstress, 1, MPI_LOGICAL, 0, mpicom, ier) - - call mpi_bcast (use_dynroot, 1, MPI_LOGICAL, 0, mpicom, ier) - - if (use_cn .and. use_vertsoilc) then - ! vertical soil mixing variables - call mpi_bcast (som_adv_flux, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (max_depth_cryoturb, 1, MPI_REAL8, 0, mpicom, ier) - - ! C and N input vertical profiles - call mpi_bcast (surfprof_exp, 1, MPI_REAL8, 0, mpicom, ier) - end if - - if (use_cn .and. use_nitrif_denitrif) then - call mpi_bcast (no_frozen_nitrif_denitrif, 1, MPI_LOGICAL, 0, mpicom, ier) - end if - - if (use_cn) then - call mpi_bcast (use_c14_bombspike, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (atm_c14_filename, len(atm_c14_filename), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (use_c13_timeseries, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (atm_c13_filename, len(atm_c13_filename), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (use_fun, 1, MPI_LOGICAL, 0, mpicom, ier) - end if - - call mpi_bcast (perchroot, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (perchroot_alt, 1, MPI_LOGICAL, 0, mpicom, ier) - if (use_lch4) then - call mpi_bcast (anoxia, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (anoxia_wtsat, 1, MPI_LOGICAL, 0, mpicom, ier) - end if - - ! lakes - call mpi_bcast (deepmixing_depthcrit, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (deepmixing_mixfact, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (lake_melt_icealb, numrad, MPI_REAL8, 0, mpicom, ier) - - ! physics variables - call mpi_bcast (nsegspc, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (subgridflag , 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (wrtdia, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (single_column,1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (scmlat, 1, MPI_REAL8,0, mpicom, ier) - call mpi_bcast (scmlon, 1, MPI_REAL8,0, mpicom, ier) - call mpi_bcast (co2_ppmv, 1, MPI_REAL8,0, mpicom, ier) - call mpi_bcast (albice, 2, MPI_REAL8,0, mpicom, ier) - call mpi_bcast (soil_layerstruct,len(soil_layerstruct), MPI_CHARACTER, 0, mpicom, ier) - - ! snow pack variables - call mpi_bcast (nlevsno, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (h2osno_max, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (int_snow_max, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (n_melt_glcmec, 1, MPI_REAL8, 0, mpicom, ier) - - ! glacier_mec variables - call mpi_bcast (maxpatch_glcmec, 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (glc_do_dynglacier, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (glc_snow_persistence_max_days, 1, MPI_INTEGER, 0, mpicom, ier) - - ! history file variables - call mpi_bcast (hist_empty_htapes, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (hist_dov2xy, size(hist_dov2xy), MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (hist_nhtfrq, size(hist_nhtfrq), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_mfilt, size(hist_mfilt), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_ndens, size(hist_ndens), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_avgflag_pertape, size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_type1d_pertape, max_namlen*size(hist_type1d_pertape), MPI_CHARACTER, 0, mpicom, ier) - if (use_lch4) then - call mpi_bcast (hist_wrtch4diag, 1, MPI_LOGICAL, 0, mpicom, ier) - end if - call mpi_bcast (hist_fexcl1, max_namlen*size(hist_fexcl1), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl2, max_namlen*size(hist_fexcl2), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl3, max_namlen*size(hist_fexcl3), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl4, max_namlen*size(hist_fexcl4), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl5, max_namlen*size(hist_fexcl5), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl6, max_namlen*size(hist_fexcl6), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl7, max_namlen*size(hist_fexcl7), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl8, max_namlen*size(hist_fexcl8), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl9, max_namlen*size(hist_fexcl9), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl10,max_namlen*size(hist_fexcl10),MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl1, (max_namlen+2)*size(hist_fincl1), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl2, (max_namlen+2)*size(hist_fincl2), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl3, (max_namlen+2)*size(hist_fincl3), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl4, (max_namlen+2)*size(hist_fincl4), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl5, (max_namlen+2)*size(hist_fincl5), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl6, (max_namlen+2)*size(hist_fincl6), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl7, (max_namlen+2)*size(hist_fincl7), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl8, (max_namlen+2)*size(hist_fincl8), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl9, (max_namlen+2)*size(hist_fincl9), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl10,(max_namlen+2)*size(hist_fincl10),MPI_CHARACTER, 0, mpicom, ier) - - ! restart file variables - - call mpi_bcast (rpntfil, len(rpntfil), MPI_CHARACTER, 0, mpicom, ier) - - ! clump decomposition variables - - call mpi_bcast (clump_pproc, 1, MPI_INTEGER, 0, mpicom, ier) - - end subroutine control_spmd - - !------------------------------------------------------------------------ - subroutine control_print () - ! - ! !DESCRIPTION: - ! Write out the clm namelist run control variables - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer i !loop index - !------------------------------------------------------------------------ - - write(iulog,*) 'define run:' - write(iulog,*) ' source = ',trim(source) - write(iulog,*) ' model_version = ',trim(version) - write(iulog,*) ' run type = ',runtyp(nsrest+1) - write(iulog,*) ' case title = ',trim(ctitle) - write(iulog,*) ' username = ',trim(username) - write(iulog,*) ' hostname = ',trim(hostname) - write(iulog,*) 'process control parameters:' - write(iulog,*) ' use_lch4 = ', use_lch4 - write(iulog,*) ' use_nitrif_denitrif = ', use_nitrif_denitrif - write(iulog,*) ' use_vertsoilc = ', use_vertsoilc - write(iulog,*) ' use_extralakelayers = ', use_extralakelayers - write(iulog,*) ' use_vichydro = ', use_vichydro - write(iulog,*) ' use_century_decomp = ', use_century_decomp - write(iulog,*) ' use_cn = ', use_cn - write(iulog,*) ' use_cndv = ', use_cndv - write(iulog,*) ' use_crop = ', use_crop - write(iulog,*) ' use_fertilizer = ', use_fertilizer - write(iulog,*) ' use_grainproduct = ', use_grainproduct - write(iulog,*) ' use_ozone = ', use_ozone - write(iulog,*) ' use_snicar_frc = ', use_snicar_frc - write(iulog,*) ' use_vancouver = ', use_vancouver - write(iulog,*) ' use_mexicocity = ', use_mexicocity - write(iulog,*) ' use_noio = ', use_noio - - write(iulog,*) 'input data files:' - write(iulog,*) ' PFT physiology and parameters file = ',trim(paramfile) - if (fsurdat == ' ') then - write(iulog,*) ' fsurdat, surface dataset not set' - else - write(iulog,*) ' surface data = ',trim(fsurdat) - end if - if (fatmlndfrc == ' ') then - write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' - else - write(iulog,*) ' land frac data = ',trim(fatmlndfrc) - end if - if (use_cn) then - if (suplnitro /= suplnNon)then - write(iulog,*) ' Supplemental Nitrogen mode is set to run over Patches: ', & - trim(suplnitro) - end if - - if (nfix_timeconst /= 0._r8) then - write(iulog,*) ' nfix_timeconst, timescale for smoothing npp in N fixation term: ', nfix_timeconst - else - write(iulog,*) ' nfix_timeconst == zero, use standard N fixation scheme. ' - end if - - write(iulog,*) ' spinup_state, (0 = normal mode; 1 = AD spinup; 2 AAD) : ', spinup_state - if ( spinup_state .eq. 0 ) then - write(iulog,*) ' model is currently NOT in AD spinup mode.' - else if ( spinup_state .eq. 1 ) then - write(iulog,*) ' model is currently in AD spinup mode.' - else if ( spinup_state .eq. 2 ) then - write(iulog,*) ' model is currently in accelerated AD spinup mode.' - else - call endrun(msg=' error: spinup_state can only have integer value of 0 or 1 or 2'//& - errMsg(sourcefile, __LINE__)) - end if - - if ( use_fun ) then - write(iulog,*) ' Fixation and Uptake of Nitrogen Model Version 2 (FUN2) is turned on for Nitrogen Competition' - end if - - write(iulog,*) ' override_bgc_restart_mismatch_dump : ', override_bgc_restart_mismatch_dump - end if - - if (use_cn .and. use_vertsoilc) then - write(iulog, *) ' som_adv_flux, the advection term in soil mixing (m/s) : ', som_adv_flux - write(iulog, *) ' max_depth_cryoturb (m) : ', max_depth_cryoturb - write(iulog, *) ' surfprof_exp : ', surfprof_exp - end if - - if (use_cn .and. .not. use_nitrif_denitrif) then - write(iulog, *) ' no_frozen_nitrif_denitrif : ', no_frozen_nitrif_denitrif - end if - - if (use_cn) then - write(iulog, *) ' use_c13 : ', use_c13 - write(iulog, *) ' use_c13_timeseries : ', use_c13_timeseries - write(iulog, *) ' atm_c13_filename : ', atm_c13_filename - write(iulog, *) ' use_c14 : ', use_c14 - write(iulog, *) ' use_c14_bombspike : ', use_c14_bombspike - write(iulog, *) ' atm_c14_filename : ', atm_c14_filename - end if - - if (fsnowoptics == ' ') then - write(iulog,*) ' snow optical properties file NOT set' - else - write(iulog,*) ' snow optical properties file = ',trim(fsnowoptics) - endif - if (fsnowaging == ' ') then - write(iulog,*) ' snow aging parameters file NOT set' - else - write(iulog,*) ' snow aging parameters file = ',trim(fsnowaging) - endif - - write(iulog,*) ' Number of snow layers =', nlevsno - write(iulog,*) ' Max snow depth (mm) =', h2osno_max - write(iulog,*) ' Limit applied to integrated snowfall when determining changes in' - write(iulog,*) ' snow-covered fraction during melt (mm) =', int_snow_max - write(iulog,*) ' SCA shape parameter for glc_mec columns (n_melt_glcmec) =', n_melt_glcmec - - write(iulog,*) ' glc number of elevation classes =', maxpatch_glcmec - if (glc_do_dynglacier) then - write(iulog,*) ' glc CLM glacier areas and topography WILL evolve dynamically' - else - write(iulog,*) ' glc CLM glacier areas and topography will NOT evolve dynamically' - end if - write(iulog,*) ' glc snow persistence max days = ', glc_snow_persistence_max_days - - if (nsrest == nsrStartup) then - if (finidat /= ' ') then - write(iulog,*) ' initial data: ', trim(finidat) - else if (finidat_interp_source /= ' ') then - write(iulog,*) ' initial data interpolated from: ', trim(finidat_interp_source) - else - write(iulog,*) ' initial data created by model (cold start)' - end if - else - write(iulog,*) ' restart data = ',trim(nrevsn) - end if - - write(iulog,*) ' atmospheric forcing data is from cesm atm model' - write(iulog,*) 'Restart parameters:' - write(iulog,*)' restart pointer file directory = ',trim(rpntdir) - write(iulog,*)' restart pointer file name = ',trim(rpntfil) - write(iulog,*) 'model physics parameters:' - - if ( trim(co2_type) == 'constant' )then - write(iulog,*) ' CO2 volume mixing ratio (umol/mol) = ', co2_ppmv - else - write(iulog,*) ' CO2 volume mixing ratio = ', co2_type - end if - - write(iulog,*) ' land-ice albedos (unitless 0-1) = ', albice - write(iulog,*) ' soil layer structure = ', soil_layerstruct - write(iulog,*) ' plant hydraulic stress = ', use_hydrstress - write(iulog,*) ' dynamic roots = ', use_dynroot - if (nsrest == nsrContinue) then - write(iulog,*) 'restart warning:' - write(iulog,*) ' Namelist not checked for agreement with initial run.' - write(iulog,*) ' Namelist should not differ except for ending time step and run type' - end if - if (nsrest == nsrBranch) then - write(iulog,*) 'branch warning:' - write(iulog,*) ' Namelist not checked for agreement with initial run.' - write(iulog,*) ' Surface data set and reference date should not differ from initial run' - end if - write(iulog,*) ' maxpatch_pft = ',maxpatch_pft - write(iulog,*) ' nsegspc = ',nsegspc - ! New fields - write(iulog,*) ' perchroot (plant water stress based on unfrozen layers only) = ',perchroot - write(iulog,*) ' perchroot (plant water stress based on time-integrated active layer only) = ',perchroot - if (use_lch4) then - write(iulog,*) ' anoxia (applied to soil decomposition) = ',anoxia - write(iulog,*) ' anoxia_wtsat (weight anoxia by inundated fraction) = ',anoxia_wtsat - end if - ! Lakes - write(iulog,*) - write(iulog,*) 'Lake Model Namelists:' - write(iulog,*) 'Increased mixing relative to Hostetler wind-driven eddy expression ',& - 'will be used for deep lakes exceeding depth ', deepmixing_depthcrit,& - ' by a factor of ', deepmixing_mixfact, '.' - write(iulog,*) 'Albedo over melting lakes will approach values (visible, NIR):', lake_melt_icealb, & - 'as compared with 0.60, 0.40 for cold frozen lakes with no snow.' - - write(iulog, *) 'plant nitrogen model namelists:' - write(iulog, *) ' use_flexibleCN = ', use_flexibleCN - if (use_flexibleCN) then - write(iulog, *) ' MM_Nuptake_opt = ', MM_Nuptake_opt - write(iulog, *) ' downreg_opt = ', downreg_opt - write(iulog, *) ' plant_ndemand_opt = ', plant_ndemand_opt - write(iulog, *) ' substrate_term_opt = ', substrate_term_opt - write(iulog, *) ' nscalar_opt = ', nscalar_opt - write(iulog, *) ' temp_scalar_opt = ', temp_scalar_opt - write(iulog, *) ' CNratio_floating = ', CNratio_floating - write(iulog, *) ' lnc_opt = ', lnc_opt - write(iulog, *) ' reduce_dayl_factor = ', reduce_dayl_factor - write(iulog, *) ' vcmax_opt = ', vcmax_opt - write(iulog, *) ' CN_residual_opt = ', CN_residual_opt - write(iulog, *) ' CN_partition_opt = ', CN_partition_opt - write(iulog, *) ' CN_evergreen_phenology_opt = ', CN_evergreen_phenology_opt - write(iulog, *) ' carbon_resp_opt = ', carbon_resp_opt - end if - write(iulog, *) ' use_luna = ', use_luna - - write(iulog, *) ' ED/FATES: ' - write(iulog, *) ' use_fates = ', use_fates - if (use_fates) then - write(iulog, *) ' use_fates_spitfire = ', use_fates_spitfire - write(iulog, *) ' use_fates_logging = ', use_fates_logging - write(iulog, *) ' fates_paramfile = ', fates_paramfile - write(iulog, *) ' use_fates_planthydro = ', use_fates_planthydro - write(iulog, *) ' use_fates_ed_st3 = ',use_fates_ed_st3 - write(iulog, *) ' use_fates_ed_prescribed_phys = ',use_fates_ed_prescribed_phys - write(iulog, *) ' use_fates_inventory_init = ',use_fates_inventory_init - write(iulog, *) ' fates_inventory_ctrl_filename = ',fates_inventory_ctrl_filename - end if - end subroutine control_print - - - !----------------------------------------------------------------------- - subroutine apply_use_init_interp(finidat, finidat_interp_source) - ! - ! !DESCRIPTION: - ! Applies the use_init_interp option, setting finidat_interp_source to finidat - ! - ! Should be called if use_init_interp is true. - ! - ! Does error checking to ensure that it is valid to set use_init_interp to true, - ! given the values of finidat and finidat_interp_source. - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=*), intent(inout) :: finidat - character(len=*), intent(inout) :: finidat_interp_source - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'apply_use_init_interp' - !----------------------------------------------------------------------- - - if (finidat == ' ') then - call endrun(msg=' ERROR: Can only set use_init_interp if finidat is set') - end if - - if (finidat_interp_source /= ' ') then - call endrun(msg=' ERROR: Cannot set use_init_interp if finidat_interp_source is & - &already set') - end if - - finidat_interp_source = finidat - finidat = ' ' - - end subroutine apply_use_init_interp - - - -end module controlMod diff --git a/src/main/decompInitMod.F90 b/src/main/decompInitMod.F90 deleted file mode 100644 index 709c0b5e36..0000000000 --- a/src/main/decompInitMod.F90 +++ /dev/null @@ -1,888 +0,0 @@ -module decompInitMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Module provides a descomposition into a clumped data structure which can - ! be mapped back to atmosphere physics chunks. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc, iam, npes, mpicom, comp_id - use abortutils , only : endrun - use clm_varctl , only : iulog, use_fates - use clm_varcon , only : grlnd - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use glcBehaviorMod , only : glc_behavior_type - use decompMod - use mct_mod , only : mct_gsMap_init, mct_gsMap_ngseg, mct_gsMap_nlseg, mct_gsmap_gsize - use FatesInterfaceMod, only : fates_maxElementsPerSite - ! - ! !PUBLIC TYPES: - implicit none - ! - ! !PUBLIC MEMBER FUNCTIONS: - public decompInit_lnd ! initializes lnd grid decomposition into clumps and processors - public decompInit_clumps ! initializes atm grid decomposition into clumps - public decompInit_glcp ! initializes g,l,c,p decomp info - ! - ! !PRIVATE TYPES: - private - integer, pointer :: lcid(:) ! temporary for setting ldecomp - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------------ - subroutine decompInit_lnd(lni,lnj,amask) - ! - ! !DESCRIPTION: - ! This subroutine initializes the land surface decomposition into a clump - ! data structure. This assumes each pe has the same number of clumps - ! set by clump_pproc - ! - ! !USES: - use clm_varctl, only : nsegspc - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: amask(:) - integer , intent(in) :: lni,lnj ! domain global size - ! - ! !LOCAL VARIABLES: - integer :: lns ! global domain size - integer :: ln,lj ! indices - integer :: ag,an,ai,aj ! indices - integer :: numg ! number of land gridcells - logical :: seglen1 ! is segment length one - real(r8):: seglen ! average segment length - real(r8):: rcid ! real value of cid - integer :: cid,pid ! indices - integer :: n,m,ng ! indices - integer :: ier ! error code - integer :: beg,end,lsize,gsize ! used for gsmap init - integer, pointer :: gindex(:) ! global index for gsmap init - integer, pointer :: clumpcnt(:) ! clump index counter - !------------------------------------------------------------------------------ - - lns = lni * lnj - - !--- set and verify nclumps --- - if (clump_pproc > 0) then - nclumps = clump_pproc * npes - if (nclumps < npes) then - write(iulog,*) 'decompInit_lnd(): Number of gridcell clumps= ',nclumps, & - ' is less than the number of processes = ', npes - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - else - write(iulog,*)'clump_pproc= ',clump_pproc,' must be greater than 0' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! allocate and initialize procinfo and clumps - ! beg and end indices initialized for simple addition of cells later - - allocate(procinfo%cid(clump_pproc), stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error for procinfo%cid' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - procinfo%nclumps = clump_pproc - procinfo%cid(:) = -1 - procinfo%ncells = 0 - procinfo%nlunits = 0 - procinfo%ncols = 0 - procinfo%npatches = 0 - procinfo%nCohorts = 0 - procinfo%begg = 1 - procinfo%begl = 1 - procinfo%begc = 1 - procinfo%begp = 1 - procinfo%begCohort = 1 - procinfo%endg = 0 - procinfo%endl = 0 - procinfo%endc = 0 - procinfo%endp = 0 - procinfo%endCohort = 0 - - allocate(clumps(nclumps), stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error for clumps' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - clumps(:)%owner = -1 - clumps(:)%ncells = 0 - clumps(:)%nlunits = 0 - clumps(:)%ncols = 0 - clumps(:)%npatches = 0 - clumps(:)%nCohorts = 0 - clumps(:)%begg = 1 - clumps(:)%begl = 1 - clumps(:)%begc = 1 - clumps(:)%begp = 1 - clumps(:)%begCohort = 1 - clumps(:)%endg = 0 - clumps(:)%endl = 0 - clumps(:)%endc = 0 - clumps(:)%endp = 0 - clumps(:)%endCohort = 0 - - ! assign clumps to proc round robin - cid = 0 - do n = 1,nclumps - pid = mod(n-1,npes) - if (pid < 0 .or. pid > npes-1) then - write(iulog,*) 'decompInit_lnd(): round robin pid error ',n,pid,npes - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - clumps(n)%owner = pid - if (iam == pid) then - cid = cid + 1 - if (cid < 1 .or. cid > clump_pproc) then - write(iulog,*) 'decompInit_lnd(): round robin pid error ',n,pid,npes - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - procinfo%cid(cid) = n - endif - enddo - - ! count total land gridcells - numg = 0 - do ln = 1,lns - if (amask(ln) == 1) then - numg = numg + 1 - endif - enddo - - if (npes > numg) then - write(iulog,*) 'decompInit_lnd(): Number of processes exceeds number ', & - 'of land grid cells',npes,numg - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (nclumps > numg) then - write(iulog,*) 'decompInit_lnd(): Number of clumps exceeds number ', & - 'of land grid cells',nclumps,numg - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (float(numg)/float(nclumps) < float(nsegspc)) then - seglen1 = .true. - seglen = 1.0_r8 - else - seglen1 = .false. - seglen = dble(numg)/(dble(nsegspc)*dble(nclumps)) - endif - - if (masterproc) then - write(iulog,*) ' decomp precompute numg,nclumps,seglen1,avg_seglen,nsegspc=', & - numg,nclumps,seglen1,& - sngl(seglen),sngl(dble(numg)/(seglen*dble(nclumps))) - end if - - ! Assign gridcells to clumps (and thus pes) --- - - allocate(lcid(lns)) - lcid(:) = 0 - ng = 0 - do ln = 1,lns - if (amask(ln) == 1) then - ng = ng + 1 - - !--- give to clumps in order based on nsegspc - if (seglen1) then - cid = mod(ng-1,nclumps) + 1 - else - rcid = (dble(ng-1)/dble(numg))*dble(nsegspc)*dble(nclumps) - cid = mod(int(rcid),nclumps) + 1 - endif - lcid(ln) = cid - - !--- give gridcell cell to pe that owns cid --- - !--- this needs to be done to subsequently use function - !--- get_proc_bounds(begg,endg) - if (iam == clumps(cid)%owner) then - procinfo%ncells = procinfo%ncells + 1 - endif - if (iam > clumps(cid)%owner) then - procinfo%begg = procinfo%begg + 1 - endif - if (iam >= clumps(cid)%owner) then - procinfo%endg = procinfo%endg + 1 - endif - - !--- give gridcell to cid --- - !--- increment the beg and end indices --- - clumps(cid)%ncells = clumps(cid)%ncells + 1 - do m = 1,nclumps - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m > cid)) then - clumps(m)%begg = clumps(m)%begg + 1 - endif - - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m >= cid)) then - clumps(m)%endg = clumps(m)%endg + 1 - endif - enddo - - end if - enddo - - ! Set ldecomp - - allocate(ldecomp%gdc2glo(numg), stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error1 for ldecomp, etc' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - allocate(clumpcnt(nclumps),stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error1 for clumpcnt' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ldecomp%gdc2glo(:) = 0 - ag = 0 - - ! clumpcnt is the start gdc index of each clump - - clumpcnt = 0 - ag = 1 - do pid = 0,npes-1 - do cid = 1,nclumps - if (clumps(cid)%owner == pid) then - clumpcnt(cid) = ag - ag = ag + clumps(cid)%ncells - endif - enddo - enddo - - ! now go through gridcells one at a time and increment clumpcnt - ! in order to set gdc2glo - - do aj = 1,lnj - do ai = 1,lni - an = (aj-1)*lni + ai - cid = lcid(an) - if (cid > 0) then - ag = clumpcnt(cid) - ldecomp%gdc2glo(ag) = an - clumpcnt(cid) = clumpcnt(cid) + 1 - end if - end do - end do - - deallocate(clumpcnt) - - ! Set gsMap_lnd_gdc2glo (the global index here includes mask=0 or ocean points) - - call get_proc_bounds(beg, end) - allocate(gindex(beg:end)) - do n = beg,end - gindex(n) = ldecomp%gdc2glo(n) - enddo - lsize = end-beg+1 - gsize = lni * lnj - call mct_gsMap_init(gsMap_lnd_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) - deallocate(gindex) - - ! Diagnostic output - - if (masterproc) then - write(iulog,*)' Surface Grid Characteristics' - write(iulog,*)' longitude points = ',lni - write(iulog,*)' latitude points = ',lnj - write(iulog,*)' total number of land gridcells = ',numg - write(iulog,*)' Decomposition Characteristics' - write(iulog,*)' clumps per process = ',clump_pproc - write(iulog,*)' gsMap Characteristics' - write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd_gdc2glo) - write(iulog,*) - end if - - call shr_sys_flush(iulog) - - end subroutine decompInit_lnd - - !------------------------------------------------------------------------------ - subroutine decompInit_clumps(lns,lni,lnj,glc_behavior) - ! - ! !DESCRIPTION: - ! This subroutine initializes the land surface decomposition into a clump - ! data structure. This assumes each pe has the same number of clumps - ! set by clump_pproc - ! - ! !USES: - use subgridMod, only : subgrid_get_gcellinfo - use spmdMod - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: lns,lni,lnj ! land domain global size - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: ln,an ! indices - integer :: i,g,l,k ! indices - integer :: cid,pid ! indices - integer :: n,m,np ! indices - integer :: anumg ! lnd num gridcells - integer :: icells ! temporary - integer :: begg, endg ! temporary - integer :: ilunits ! temporary - integer :: icols ! temporary - integer :: ipatches ! temporary - integer :: icohorts ! temporary - integer :: ier ! error code - integer, allocatable :: allvecg(:,:) ! temporary vector "global" - integer, allocatable :: allvecl(:,:) ! temporary vector "local" - integer :: ntest - character(len=32), parameter :: subname = 'decompInit_clumps' - !------------------------------------------------------------------------------ - - !--- assign gridcells to clumps (and thus pes) --- - call get_proc_bounds(begg, endg) - - allocate(allvecl(nclumps,5)) ! local clumps [gcells,lunit,cols,patches,coh] - allocate(allvecg(nclumps,5)) ! global clumps [gcells,lunit,cols,patches,coh] - - ! Determine the number of gridcells, landunits, columns, and patches, cohorts - ! on this processor - ! Determine number of landunits, columns and patches for each global - ! gridcell index (an) that is associated with the local gridcell index (ln) - - ilunits=0 - icols=0 - ipatches=0 - icohorts=0 - - allvecg= 0 - allvecl= 0 - do anumg = begg,endg - an = ldecomp%gdc2glo(anumg) - cid = lcid(an) - ln = anumg - call subgrid_get_gcellinfo (ln, nlunits=ilunits, ncols=icols, npatches=ipatches, & - ncohorts=icohorts, glc_behavior=glc_behavior) - allvecl(cid,1) = allvecl(cid,1) + 1 - allvecl(cid,2) = allvecl(cid,2) + ilunits ! number of landunits for local clump cid - allvecl(cid,3) = allvecl(cid,3) + icols ! number of columns for local clump cid - allvecl(cid,4) = allvecl(cid,4) + ipatches ! number of patches for local clump cid - allvecl(cid,5) = allvecl(cid,5) + icohorts ! number of cohorts for local clump cid - enddo - call mpi_allreduce(allvecl,allvecg,size(allvecg),MPI_INTEGER,MPI_SUM,mpicom,ier) - - ! Determine overall total gridcells, landunits, columns and patches and distribute - ! gridcells over clumps - - numg = 0 - numl = 0 - numc = 0 - nump = 0 - numCohort = 0 - - do cid = 1,nclumps - icells = allvecg(cid,1) ! number of all clump cid gridcells (over all processors) - ilunits = allvecg(cid,2) ! number of all clump cid landunits (over all processors) - icols = allvecg(cid,3) ! number of all clump cid columns (over all processors) - ipatches = allvecg(cid,4) ! number of all clump cid patches (over all processors) - icohorts = allvecg(cid,5) ! number of all clump cid cohorts (over all processors) - - !--- overall total --- - numg = numg + icells ! total number of gridcells - numl = numl + ilunits ! total number of landunits - numc = numc + icols ! total number of columns - nump = nump + ipatches ! total number of patches - numCohort = numCohort + icohorts ! total number of cohorts - - !--- give gridcell to cid --- - !--- increment the beg and end indices --- - clumps(cid)%nlunits = clumps(cid)%nlunits + ilunits - clumps(cid)%ncols = clumps(cid)%ncols + icols - clumps(cid)%npatches = clumps(cid)%npatches + ipatches - clumps(cid)%nCohorts = clumps(cid)%nCohorts + icohorts - - do m = 1,nclumps - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m > cid)) then - clumps(m)%begl = clumps(m)%begl + ilunits - clumps(m)%begc = clumps(m)%begc + icols - clumps(m)%begp = clumps(m)%begp + ipatches - clumps(m)%begCohort = clumps(m)%begCohort + icohorts - endif - - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m >= cid)) then - clumps(m)%endl = clumps(m)%endl + ilunits - clumps(m)%endc = clumps(m)%endc + icols - clumps(m)%endp = clumps(m)%endp + ipatches - clumps(m)%endCohort = clumps(m)%endCohort + icohorts - endif - enddo - - !--- give gridcell to the proc that owns the cid --- - !--- increment the beg and end indices --- - if (iam == clumps(cid)%owner) then - procinfo%nlunits = procinfo%nlunits + ilunits - procinfo%ncols = procinfo%ncols + icols - procinfo%npatches = procinfo%npatches + ipatches - procinfo%nCohorts = procinfo%nCohorts + icohorts - endif - - if (iam > clumps(cid)%owner) then - procinfo%begl = procinfo%begl + ilunits - procinfo%begc = procinfo%begc + icols - procinfo%begp = procinfo%begp + ipatches - procinfo%begCohort = procinfo%begCohort + icohorts - endif - - if (iam >= clumps(cid)%owner) then - procinfo%endl = procinfo%endl + ilunits - procinfo%endc = procinfo%endc + icols - procinfo%endp = procinfo%endp + ipatches - procinfo%endCohort = procinfo%endCohort + icohorts - endif - enddo - - do n = 1,nclumps - if (clumps(n)%ncells /= allvecg(n,1) .or. & - clumps(n)%nlunits /= allvecg(n,2) .or. & - clumps(n)%ncols /= allvecg(n,3) .or. & - clumps(n)%npatches /= allvecg(n,4) .or. & - clumps(n)%nCohorts /= allvecg(n,5)) then - - write(iulog ,*) 'decompInit_glcp(): allvecg error ncells ',iam,n,clumps(n)%ncells ,allvecg(n,1) - write(iulog ,*) 'decompInit_glcp(): allvecg error lunits ',iam,n,clumps(n)%nlunits ,allvecg(n,2) - write(iulog ,*) 'decompInit_glcp(): allvecg error ncols ',iam,n,clumps(n)%ncols ,allvecg(n,3) - write(iulog ,*) 'decompInit_glcp(): allvecg error patches',iam,n,clumps(n)%npatches ,allvecg(n,4) - write(iulog ,*) 'decompInit_glcp(): allvecg error cohorts',iam,n,clumps(n)%nCohorts ,allvecg(n,5) - - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - enddo - - deallocate(allvecg,allvecl) - deallocate(lcid) - - end subroutine decompInit_clumps - - !------------------------------------------------------------------------------ - subroutine decompInit_glcp(lns,lni,lnj,glc_behavior) - ! - ! !DESCRIPTION: - ! Determine gsMaps for landunits, columns, patches and cohorts - ! - ! !USES: - use spmdMod - use spmdGathScatMod - use subgridMod, only : subgrid_get_gcellinfo - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: lns,lni,lnj ! land domain global size - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: gi,li,ci,pi,coi ! indices - integer :: i,g,k,l,n,np ! indices - integer :: cid,pid ! indices - integer :: begg,endg ! beg,end gridcells - integer :: begl,endl ! beg,end landunits - integer :: begc,endc ! beg,end columns - integer :: begp,endp ! beg,end patches - integer :: begCohort,endCohort! beg,end cohorts - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of patches across all processors - integer :: numCohort ! fates cohorts - integer :: icells ! temporary - integer :: ilunits ! temporary - integer :: icols ! temporary - integer :: ipatches ! temporary - integer :: icohorts ! temporary - integer :: ier ! error code - integer :: npmin,npmax,npint ! do loop values for printing - integer :: clmin,clmax ! do loop values for printing - integer :: locsize,globsize ! used for gsMap init - integer :: ng ! number of gridcells in gsMap_lnd_gdc2glo - integer :: val1, val2 ! temporaries - integer, pointer :: gindex(:) ! global index for gsMap init - integer, pointer :: arrayglob(:) ! temporaroy - integer, pointer :: gstart(:), gcount(:) - integer, pointer :: lstart(:), lcount(:) - integer, pointer :: cstart(:), ccount(:) - integer, pointer :: pstart(:), pcount(:) - integer, pointer :: coStart(:), coCount(:) - integer, pointer :: ioff(:) - integer, parameter :: dbug=1 ! 0 = min, 1=normal, 2=much, 3=max - character(len=32), parameter :: subname = 'decompInit_glcp' - !------------------------------------------------------------------------------ - - !init - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp, & - begCohort, endCohort) - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump, nCohorts=numCohort) - - ! Determine global seg megs - - allocate(gstart(begg:endg)) - gstart(:) = 0 - allocate(gcount(begg:endg)) - gcount(:) = 0 - allocate(lstart(begg:endg)) - lstart(:) = 0 - allocate(lcount(begg:endg)) - lcount(:) = 0 - allocate(cstart(begg:endg)) - cstart(:) = 0 - allocate(ccount(begg:endg)) - ccount(:) = 0 - allocate(pstart(begg:endg)) - pstart(:) = 0 - allocate(pcount(begg:endg)) - pcount(:) = 0 - if ( use_fates ) then - allocate(coStart(begg:endg)) - coStart(:) = 0 - endif - allocate(coCount(begg:endg)) - coCount(:) = 0 - allocate(ioff(begg:endg)) - ioff(:) = 0 - - ! Determine gcount, lcount, ccount and pcount - - do gi = begg,endg - call subgrid_get_gcellinfo (gi, nlunits=ilunits, ncols=icols, npatches=ipatches, & - ncohorts=icohorts, glc_behavior=glc_behavior) - gcount(gi) = 1 ! number of gridcells for local gridcell index gi - lcount(gi) = ilunits ! number of landunits for local gridcell index gi - ccount(gi) = icols ! number of columns for local gridcell index gi - pcount(gi) = ipatches ! number of patches for local gridcell index gi - coCount(gi) = icohorts ! number of fates cohorts for local gricell index gi - enddo - - ! Determine gstart, lstart, cstart, pstart, coStart for the OUTPUT 1d data structures - - ! gather the gdc subgrid counts to masterproc in glo order - ! compute glo ordered start indices from the counts - ! scatter the subgrid start indices back out to the gdc gridcells - ! set the local gindex array for the subgrid from the subgrid start and count arrays - - ng = mct_gsmap_gsize(gsmap_lnd_gdc2glo) - allocate(arrayglob(ng)) - - arrayglob(:) = 0 - call gather_data_to_master(gcount, arrayglob, grlnd) - if (masterproc) then - val1 = arrayglob(1) - arrayglob(1) = 1 - do n = 2,ng - val2 = arrayglob(n) - arrayglob(n) = arrayglob(n-1) + val1 - val1 = val2 - enddo - endif - call scatter_data_from_master(gstart, arrayglob, grlnd) - - ! lstart for gridcell (n) is the total number of the landunits - ! over gridcells 1->n-1 - - arrayglob(:) = 0 - call gather_data_to_master(lcount, arrayglob, grlnd) - if (masterproc) then - val1 = arrayglob(1) - arrayglob(1) = 1 - do n = 2,ng - val2 = arrayglob(n) - arrayglob(n) = arrayglob(n-1) + val1 - val1 = val2 - enddo - endif - call scatter_data_from_master(lstart, arrayglob, grlnd) - - arrayglob(:) = 0 - call gather_data_to_master(ccount, arrayglob, grlnd) - if (masterproc) then - val1 = arrayglob(1) - arrayglob(1) = 1 - do n = 2,ng - val2 = arrayglob(n) - arrayglob(n) = arrayglob(n-1) + val1 - val1 = val2 - enddo - endif - call scatter_data_from_master(cstart, arrayglob, grlnd) - - arrayglob(:) = 0 - call gather_data_to_master(pcount, arrayglob, grlnd) - if (masterproc) then - val1 = arrayglob(1) - arrayglob(1) = 1 - do n = 2,ng - val2 = arrayglob(n) - arrayglob(n) = arrayglob(n-1) + val1 - val1 = val2 - enddo - endif - call scatter_data_from_master(pstart, arrayglob, grlnd) - - if ( use_fates ) then - arrayglob(:) = 0 - call gather_data_to_master(coCount, arrayglob, grlnd) - if (masterproc) then - val1 = arrayglob(1) - arrayglob(1) = 1 - do n = 2,ng - val2 = arrayglob(n) - arrayglob(n) = arrayglob(n-1) + val1 - val1 = val2 - enddo - endif - call scatter_data_from_master(coStart, arrayglob, grlnd) - endif - - deallocate(arrayglob) - - ! Gridcell gsmap (compressed, no ocean points) - - allocate(gindex(begg:endg)) - i = begg-1 - do gi = begg,endg - if (gcount(gi) < 1) then - write(iulog,*) 'decompInit_glcp warning count g ',k,iam,g,gcount(g) - endif - do l = 1,gcount(gi) - i = i + 1 - if (i < begg .or. i > endg) then - write(iulog,*) 'decompInit_glcp error i ',i,begg,endg - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - gindex(i) = gstart(gi) + l - 1 - enddo - enddo - if (i /= endg) then - write(iulog,*) 'decompInit_glcp error size ',i,begg,endg - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - locsize = endg-begg+1 - globsize = numg - call mct_gsMap_init(gsmap_gce_gdc2glo, gindex, mpicom, comp_id, locsize, globsize) - deallocate(gindex) - - ! Landunit gsmap - - allocate(gindex(begl:endl)) - ioff(:) = 0 - do li = begl,endl - gi = lun%gridcell(li) !===this is determined internally from how landunits are spread out in memory - gindex(li) = lstart(gi) + ioff(gi) !=== the output gindex is ALWAYS the same regardless of how landuntis are spread out in memory - ioff(gi) = ioff(gi) + 1 - ! check that this is less than [lstart(gi) + lcount(gi)] - enddo - locsize = endl-begl+1 - globsize = numl - call mct_gsMap_init(gsmap_lun_gdc2glo, gindex, mpicom, comp_id, locsize, globsize) - deallocate(gindex) - - ! Column gsmap - - allocate(gindex(begc:endc)) - ioff(:) = 0 - do ci = begc,endc - gi = col%gridcell(ci) - gindex(ci) = cstart(gi) + ioff(gi) - ioff(gi) = ioff(gi) + 1 - ! check that this is less than [cstart(gi) + ccount(gi)] - enddo - locsize = endc-begc+1 - globsize = numc - call mct_gsMap_init(gsmap_col_gdc2glo, gindex, mpicom, comp_id, locsize, globsize) - deallocate(gindex) - - ! PATCH gsmap - - allocate(gindex(begp:endp)) - ioff(:) = 0 - do pi = begp,endp - gi = patch%gridcell(pi) - gindex(pi) = pstart(gi) + ioff(gi) - ioff(gi) = ioff(gi) + 1 - ! check that this is less than [pstart(gi) + pcount(gi)] - enddo - locsize = endp-begp+1 - globsize = nump - call mct_gsMap_init(gsmap_patch_gdc2glo, gindex, mpicom, comp_id, locsize, globsize) - deallocate(gindex) - - ! FATES gsmap for the cohort/element vector - - if ( use_fates ) then - allocate(gindex(begCohort:endCohort)) - ioff(:) = 0 - gi = begg - do coi = begCohort,endCohort - gindex(coi) = coStart(gi) + ioff(gi) - ioff(gi) = ioff(gi) + 1 - if ( mod(coi, fates_maxElementsPerSite ) == 0 ) gi = gi + 1 - enddo - locsize = endCohort-begCohort+1 - globsize = numCohort - call mct_gsMap_init(gsMap_cohort_gdc2glo, gindex, mpicom, comp_id, locsize, globsize) - deallocate(gindex) - endif - - ! Deallocate start/count arrays - deallocate(gstart, gcount) - deallocate(lstart, lcount) - deallocate(cstart, ccount) - deallocate(pstart, pcount) - if ( use_fates ) then - deallocate(coStart,coCount) - endif - deallocate(ioff) - - ! Diagnostic output - - if (masterproc) then - write(iulog,*)' Surface Grid Characteristics' - write(iulog,*)' longitude points = ',lni - write(iulog,*)' latitude points = ',lnj - write(iulog,*)' total number of gridcells = ',numg - write(iulog,*)' total number of landunits = ',numl - write(iulog,*)' total number of columns = ',numc - write(iulog,*)' total number of patches = ',nump - write(iulog,*)' total number of cohorts = ',numCohort - write(iulog,*)' Decomposition Characteristics' - write(iulog,*)' clumps per process = ',clump_pproc - write(iulog,*)' gsMap Characteristics' - write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd_gdc2glo) - write(iulog,*) ' gce gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_gce_gdc2glo) - write(iulog,*) ' lun gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lun_gdc2glo) - write(iulog,*) ' col gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_col_gdc2glo) - write(iulog,*) ' patch gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_patch_gdc2glo) - write(iulog,*) ' coh gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_cohort_gdc2glo) - write(iulog,*) - end if - - ! Write out clump and proc info, one pe at a time, - ! barrier to control pes overwriting each other on stdout - - call shr_sys_flush(iulog) - call mpi_barrier(mpicom,ier) - npmin = 0 - npmax = npes-1 - npint = 1 - if (dbug == 0) then - npmax = 0 - elseif (dbug == 1) then - npmax = min(npes-1,4) - elseif (dbug == 2) then - npint = npes/8 - endif - do np = npmin,npmax,npint - pid = np - if (dbug == 1) then - if (np == 2) pid=npes/2-1 - if (np == 3) pid=npes-2 - if (np == 4) pid=npes-1 - endif - pid = max(pid,0) - pid = min(pid,npes-1) - - if (iam == pid) then - write(iulog,*) - write(iulog,*)'proc= ',pid,& - ' beg gridcell= ',procinfo%begg, & - ' end gridcell= ',procinfo%endg, & - ' total gridcells per proc= ',procinfo%ncells - write(iulog,*)'proc= ',pid,& - ' beg landunit= ',procinfo%begl, & - ' end landunit= ',procinfo%endl, & - ' total landunits per proc= ',procinfo%nlunits - write(iulog,*)'proc= ',pid,& - ' beg column = ',procinfo%begc, & - ' end column = ',procinfo%endc, & - ' total columns per proc = ',procinfo%ncols - write(iulog,*)'proc= ',pid,& - ' beg patch = ',procinfo%begp, & - ' end patch = ',procinfo%endp, & - ' total patches per proc = ',procinfo%npatches - write(iulog,*)'proc= ',pid,& - ' beg coh = ',procinfo%begCohort, & - ' end coh = ',procinfo%endCohort, & - ' total coh per proc = ',procinfo%nCohorts - write(iulog,*)'proc= ',pid,& - ' lnd ngseg = ',mct_gsMap_ngseg(gsMap_lnd_gdc2glo), & - ' lnd nlseg = ',mct_gsMap_nlseg(gsMap_lnd_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' gce ngseg = ',mct_gsMap_ngseg(gsMap_gce_gdc2glo), & - ' gce nlseg = ',mct_gsMap_nlseg(gsMap_gce_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' lun ngseg = ',mct_gsMap_ngseg(gsMap_lun_gdc2glo), & - ' lun nlseg = ',mct_gsMap_nlseg(gsMap_lun_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' col ngseg = ',mct_gsMap_ngseg(gsMap_col_gdc2glo), & - ' col nlseg = ',mct_gsMap_nlseg(gsMap_col_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' patch ngseg = ',mct_gsMap_ngseg(gsMap_patch_gdc2glo), & - ' patch nlseg = ',mct_gsMap_nlseg(gsMap_patch_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' coh ngseg = ',mct_gsMap_ngseg(gsMap_cohort_gdc2glo), & - ' coh nlseg = ',mct_gsMap_nlseg(gsMap_cohort_gdc2glo,iam) - write(iulog,*)'proc= ',pid,' nclumps = ',procinfo%nclumps - - clmin = 1 - clmax = procinfo%nclumps - if (dbug == 1) then - clmax = 1 - elseif (dbug == 0) then - clmax = -1 - endif - do n = clmin,clmax - cid = procinfo%cid(n) - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg gridcell= ',clumps(cid)%begg, & - ' end gridcell= ',clumps(cid)%endg, & - ' total gridcells per clump= ',clumps(cid)%ncells - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg landunit= ',clumps(cid)%begl, & - ' end landunit= ',clumps(cid)%endl, & - ' total landunits per clump = ',clumps(cid)%nlunits - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg column = ',clumps(cid)%begc, & - ' end column = ',clumps(cid)%endc, & - ' total columns per clump = ',clumps(cid)%ncols - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg patch = ',clumps(cid)%begp, & - ' end patch = ',clumps(cid)%endp, & - ' total patches per clump = ',clumps(cid)%npatches - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg cohort = ',clumps(cid)%begCohort, & - ' end cohort = ',clumps(cid)%endCohort, & - ' total cohorts per clump = ',clumps(cid)%nCohorts - end do - end if - call shr_sys_flush(iulog) - call mpi_barrier(mpicom,ier) - end do - call shr_sys_flush(iulog) - - end subroutine decompInit_glcp - -end module decompInitMod diff --git a/src/main/decompMod.F90 b/src/main/decompMod.F90 deleted file mode 100644 index 13204fabca..0000000000 --- a/src/main/decompMod.F90 +++ /dev/null @@ -1,483 +0,0 @@ -module decompMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Module provides a descomposition into a clumped data structure which can - ! be mapped back to atmosphere physics chunks. - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - ! Must use shr_sys_abort rather than endrun here to avoid circular dependency - use shr_sys_mod , only : shr_sys_abort - use clm_varctl , only : iulog - use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort - use mct_mod , only : mct_gsMap - ! - ! !PUBLIC TYPES: - implicit none - integer, public :: clump_pproc ! number of clumps per MPI process - - ! Define possible bounds subgrid levels - integer, parameter, public :: BOUNDS_SUBGRID_GRIDCELL = 1 - integer, parameter, public :: BOUNDS_SUBGRID_LANDUNIT = 2 - integer, parameter, public :: BOUNDS_SUBGRID_COLUMN = 3 - integer, parameter, public :: BOUNDS_SUBGRID_PATCH = 4 - integer, parameter, public :: BOUNDS_SUBGRID_COHORT = 5 - - ! Define possible bounds levels - integer, parameter, public :: BOUNDS_LEVEL_PROC = 1 - integer, parameter, public :: BOUNDS_LEVEL_CLUMP = 2 - ! - ! !PUBLIC MEMBER FUNCTIONS: - - public get_beg ! get beg bound for a given subgrid level - public get_end ! get end bound for a given subgrid level - public get_proc_clumps ! number of clumps for this processor - public get_proc_total ! total no. of gridcells, landunits, columns and patchs for any processor - public get_proc_global ! total gridcells, landunits, columns, patchs across all processors - public get_clmlevel_gsize ! get global size associated with clmlevel - public get_clmlevel_gsmap ! get gsmap associated with clmlevel - - interface get_clump_bounds - module procedure get_clump_bounds_old - module procedure get_clump_bounds_new - end interface - public get_clump_bounds ! clump beg and end gridcell,landunit,column,patch - - interface get_proc_bounds - module procedure get_proc_bounds_old - module procedure get_proc_bounds_new - end interface - public get_proc_bounds ! this processor beg and end gridcell,landunit,column,patch - - ! !PRIVATE MEMBER FUNCTIONS: - ! - ! !PRIVATE TYPES: - private ! (now mostly public for decompinitmod) - - integer,public :: nclumps ! total number of clumps across all processors - integer,public :: numg ! total number of gridcells on all procs - integer,public :: numl ! total number of landunits on all procs - integer,public :: numc ! total number of columns on all procs - integer,public :: nump ! total number of patchs on all procs - integer,public :: numCohort ! total number of fates cohorts on all procs - - type bounds_type - integer :: begg, endg ! beginning and ending gridcell index - integer :: begl, endl ! beginning and ending landunit index - integer :: begc, endc ! beginning and ending column index - integer :: begp, endp ! beginning and ending patch index - integer :: begCohort, endCohort ! beginning and ending cohort indices - - integer :: level ! whether defined on the proc or clump level - integer :: clump_index ! if defined on the clump level, this gives the clump index - end type bounds_type - public bounds_type - - !---global information on each pe - type processor_type - integer :: nclumps ! number of clumps for processor_type iam - integer,pointer :: cid(:) ! clump indices - integer :: ncells ! number of gridcells in proc - integer :: nlunits ! number of landunits in proc - integer :: ncols ! number of columns in proc - integer :: npatches ! number of patchs in proc - integer :: nCohorts ! number of cohorts in proc - integer :: begg, endg ! beginning and ending gridcell index - integer :: begl, endl ! beginning and ending landunit index - integer :: begc, endc ! beginning and ending column index - integer :: begp, endp ! beginning and ending patch index - integer :: begCohort, endCohort ! beginning and ending cohort indices - end type processor_type - public processor_type - type(processor_type),public :: procinfo - - !---global information on each pe - type clump_type - integer :: owner ! process id owning clump - integer :: ncells ! number of gridcells in clump - integer :: nlunits ! number of landunits in clump - integer :: ncols ! number of columns in clump - integer :: npatches ! number of patchs in clump - integer :: nCohorts ! number of cohorts in proc - integer :: begg, endg ! beginning and ending gridcell index - integer :: begl, endl ! beginning and ending landunit index - integer :: begc, endc ! beginning and ending column index - integer :: begp, endp ! beginning and ending patch index - integer :: begCohort, endCohort ! beginning and ending cohort indices - end type clump_type - public clump_type - type(clump_type),public, allocatable :: clumps(:) - - !---global information on each pe - !--- glo = 1d global sn ordered - !--- gdc = 1d global dc ordered compressed - type decomp_type - integer,pointer :: gdc2glo(:) ! 1d gdc to 1d glo - end type decomp_type - public decomp_type - type(decomp_type),public,target :: ldecomp - - type(mct_gsMap) ,public,target :: gsMap_lnd_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_gce_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_lun_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_col_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_patch_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_cohort_gdc2glo - !------------------------------------------------------------------------------ - -contains - - !----------------------------------------------------------------------- - pure function get_beg(bounds, subgrid_level) result(beg_index) - ! - ! !DESCRIPTION: - ! Get beginning bounds for a given subgrid level - ! - ! subgrid_level should be one of the constants defined in this module: - ! BOUNDS_SUBGRID_GRIDCELL, BOUNDS_SUBGRID_LANDUNIT, etc. - ! - ! Returns -1 for invalid subgrid_level (does not abort in this case, in order to keep - ! this function pure). - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: beg_index ! function result - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: subgrid_level - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_beg' - !----------------------------------------------------------------------- - - select case (subgrid_level) - case (BOUNDS_SUBGRID_GRIDCELL) - beg_index = bounds%begg - case (BOUNDS_SUBGRID_LANDUNIT) - beg_index = bounds%begl - case (BOUNDS_SUBGRID_COLUMN) - beg_index = bounds%begc - case (BOUNDS_SUBGRID_PATCH) - beg_index = bounds%begp - case (BOUNDS_SUBGRID_COHORT) - beg_index = bounds%begCohort - case default - beg_index = -1 - end select - - end function get_beg - - !----------------------------------------------------------------------- - pure function get_end(bounds, subgrid_level) result(end_index) - ! - ! !DESCRIPTION: - ! Get end bounds for a given subgrid level - ! - ! subgrid_level should be one of the constants defined in this module: - ! BOUNDS_SUBGRID_GRIDCELL, BOUNDS_SUBGRID_LANDUNIT, etc. - ! - ! Returns -1 for invalid subgrid_level (does not abort in this case, in order to keep - ! this function pure). - ! - ! !USES: - ! - ! !ARGUMENTS: - integer :: end_index ! function result - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: subgrid_level - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_end' - !----------------------------------------------------------------------- - - select case (subgrid_level) - case (BOUNDS_SUBGRID_GRIDCELL) - end_index = bounds%endg - case (BOUNDS_SUBGRID_LANDUNIT) - end_index = bounds%endl - case (BOUNDS_SUBGRID_COLUMN) - end_index = bounds%endc - case (BOUNDS_SUBGRID_PATCH) - end_index = bounds%endp - case (BOUNDS_SUBGRID_COHORT) - end_index = bounds%endCohort - case default - end_index = -1 - end select - - end function get_end - - !------------------------------------------------------------------------------ - subroutine get_clump_bounds_new (n, bounds) - ! - ! !DESCRIPTION: - ! Determine clump bounds - ! - ! !ARGUMENTS: - integer, intent(in) :: n ! processor clump index - type(bounds_type), intent(out) :: bounds ! clump bounds - ! - ! !LOCAL VARIABLES: - character(len=32), parameter :: subname = 'get_clump_bounds' ! Subroutine name - integer :: cid ! clump id -#ifdef _OPENMP - integer, external :: OMP_GET_MAX_THREADS - integer, external :: OMP_GET_NUM_THREADS - integer, external :: OMP_GET_THREAD_NUM -#endif - !------------------------------------------------------------------------------ - ! Make sure this IS being called from a threaded region -#ifdef _OPENMP - ! FIX(SPM, 090314) - for debugging fates and openMP - !write(iulog,*) 'SPM omp debug decompMod 1 ', & - !OMP_GET_NUM_THREADS(),OMP_GET_MAX_THREADS(),OMP_GET_THREAD_NUM() - - if ( OMP_GET_NUM_THREADS() == 1 .and. OMP_GET_MAX_THREADS() > 1 )then - call shr_sys_abort( trim(subname)//' ERROR: Calling from inside a non-threaded region)') - end if -#endif - - cid = procinfo%cid(n) - bounds%begp = clumps(cid)%begp - bounds%endp = clumps(cid)%endp - bounds%begc = clumps(cid)%begc - bounds%endc = clumps(cid)%endc - bounds%begl = clumps(cid)%begl - bounds%endl = clumps(cid)%endl - bounds%begg = clumps(cid)%begg - bounds%endg = clumps(cid)%endg - bounds%begCohort = clumps(cid)%begCohort - bounds%endCohort = clumps(cid)%endCohort - - bounds%level = BOUNDS_LEVEL_CLUMP - bounds%clump_index = n - - end subroutine get_clump_bounds_new - - !------------------------------------------------------------------------------ - subroutine get_clump_bounds_old (n, begg, endg, begl, endl, begc, endc, begp, endp, & - begCohort, endCohort) - integer, intent(in) :: n ! proc clump index - integer, intent(out) :: begp, endp ! clump beg and end patch indices - integer, intent(out) :: begc, endc ! clump beg and end column indices - integer, intent(out) :: begl, endl ! clump beg and end landunit indices - integer, intent(out) :: begg, endg ! clump beg and end gridcell indices - integer, intent(out) :: begCohort, endCohort ! cohort beg and end gridcell indices - integer :: cid ! clump id - !------------------------------------------------------------------------------ - - cid = procinfo%cid(n) - begp = clumps(cid)%begp - endp = clumps(cid)%endp - begc = clumps(cid)%begc - endc = clumps(cid)%endc - begl = clumps(cid)%begl - endl = clumps(cid)%endl - begg = clumps(cid)%begg - endg = clumps(cid)%endg - begCohort = clumps(cid)%begCohort - endCohort = clumps(cid)%endCohort - end subroutine get_clump_bounds_old - - !------------------------------------------------------------------------------ - subroutine get_proc_bounds_new (bounds) - ! - ! !DESCRIPTION: - ! Retrieve processor bounds - ! - ! !ARGUMENTS: - type(bounds_type), intent(out) :: bounds ! processor bounds bounds - ! - ! !LOCAL VARIABLES: -#ifdef _OPENMP - integer, external :: OMP_GET_NUM_THREADS - integer, external :: OMP_GET_MAX_THREADS - integer, external :: OMP_GET_THREAD_NUM -#endif - character(len=32), parameter :: subname = 'get_proc_bounds' ! Subroutine name - !------------------------------------------------------------------------------ - ! Make sure this is NOT being called from a threaded region -#ifdef _OPENMP - ! FIX(SPM, 090314) - for debugging fates and openMP - !write(*,*) 'SPM omp debug decompMod 2 ', & - !OMP_GET_NUM_THREADS(),OMP_GET_MAX_THREADS(),OMP_GET_THREAD_NUM() - - if ( OMP_GET_NUM_THREADS() > 1 )then - call shr_sys_abort( trim(subname)//' ERROR: Calling from inside a threaded region') - end if -#endif - - bounds%begp = procinfo%begp - bounds%endp = procinfo%endp - bounds%begc = procinfo%begc - bounds%endc = procinfo%endc - bounds%begl = procinfo%begl - bounds%endl = procinfo%endl - bounds%begg = procinfo%begg - bounds%endg = procinfo%endg - bounds%begCohort = procinfo%begCohort - bounds%endCohort = procinfo%endCohort - - bounds%level = BOUNDS_LEVEL_PROC - bounds%clump_index = -1 ! irrelevant for proc, so assigned a bogus value - - end subroutine get_proc_bounds_new - - !------------------------------------------------------------------------------ - subroutine get_proc_bounds_old (begg, endg, begl, endl, begc, endc, begp, endp, & - begCohort, endCohort) - - integer, optional, intent(out) :: begp, endp ! proc beg and end patch indices - integer, optional, intent(out) :: begc, endc ! proc beg and end column indices - integer, optional, intent(out) :: begl, endl ! proc beg and end landunit indices - integer, optional, intent(out) :: begg, endg ! proc beg and end gridcell indices - integer, optional, intent(out) :: begCohort, endCohort ! cohort beg and end gridcell indices - !------------------------------------------------------------------------------ - - if (present(begp)) begp = procinfo%begp - if (present(endp)) endp = procinfo%endp - if (present(begc)) begc = procinfo%begc - if (present(endc)) endc = procinfo%endc - if (present(begl)) begl = procinfo%begl - if (present(endl)) endl = procinfo%endl - if (present(begg)) begg = procinfo%begg - if (present(endg)) endg = procinfo%endg - if (present(begCohort)) begCohort = procinfo%begCohort - if (present(endCohort)) endCohort = procinfo%endCohort - end subroutine get_proc_bounds_old - - !------------------------------------------------------------------------------ - subroutine get_proc_total(pid, ncells, nlunits, ncols, npatches, nCohorts) - ! - ! !DESCRIPTION: - ! Count up gridcells, landunits, columns, and patchs on process. - ! - ! !ARGUMENTS: - integer, intent(in) :: pid ! proc id - integer, intent(out) :: ncells ! total number of gridcells on the processor - integer, intent(out) :: nlunits ! total number of landunits on the processor - integer, intent(out) :: ncols ! total number of columns on the processor - integer, intent(out) :: npatches ! total number of patchs on the processor - integer, intent(out) :: nCohorts! total number of cohorts on the processor - ! - ! !LOCAL VARIABLES: - integer :: cid ! clump index - !------------------------------------------------------------------------------ - - npatches = 0 - nlunits = 0 - ncols = 0 - ncells = 0 - nCohorts = 0 - do cid = 1,nclumps - if (clumps(cid)%owner == pid) then - ncells = ncells + clumps(cid)%ncells - nlunits = nlunits + clumps(cid)%nlunits - ncols = ncols + clumps(cid)%ncols - npatches = npatches + clumps(cid)%npatches - nCohorts = nCohorts + clumps(cid)%nCohorts - end if - end do - end subroutine get_proc_total - - !------------------------------------------------------------------------------ - subroutine get_proc_global(ng, nl, nc, np, nCohorts) - ! - ! !DESCRIPTION: - ! Return number of gridcells, landunits, columns, and patchs across all processes. - ! - ! !ARGUMENTS: - integer, optional, intent(out) :: ng ! total number of gridcells across all processors - integer, optional, intent(out) :: nl ! total number of landunits across all processors - integer, optional, intent(out) :: nc ! total number of columns across all processors - integer, optional, intent(out) :: np ! total number of patchs across all processors - integer, optional, intent(out) :: nCohorts ! total number fates cohorts - !------------------------------------------------------------------------------ - - if (present(np)) np = nump - if (present(nc)) nc = numc - if (present(nl)) nl = numl - if (present(ng)) ng = numg - if (present(nCohorts)) nCohorts = numCohort - - end subroutine get_proc_global - - !------------------------------------------------------------------------------ - integer function get_proc_clumps() - ! - ! !DESCRIPTION: - ! Return the number of clumps. - !------------------------------------------------------------------------------ - - get_proc_clumps = procinfo%nclumps - - end function get_proc_clumps - - !----------------------------------------------------------------------- - integer function get_clmlevel_gsize (clmlevel) - ! - ! !DESCRIPTION: - ! Determine 1d size from clmlevel - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: clmlevel !type of clm 1d array - !----------------------------------------------------------------------- - - select case (clmlevel) - case(grlnd) - get_clmlevel_gsize = ldomain%ns - case(nameg) - get_clmlevel_gsize = numg - case(namel) - get_clmlevel_gsize = numl - case(namec) - get_clmlevel_gsize = numc - case(namep) - get_clmlevel_gsize = nump - case(nameCohort) - get_clmlevel_gsize = numCohort - case default - write(iulog,*) 'get_clmlevel_gsize does not match clmlevel type: ', trim(clmlevel) - call shr_sys_abort() - end select - - end function get_clmlevel_gsize - - !----------------------------------------------------------------------- - subroutine get_clmlevel_gsmap (clmlevel, gsmap) - ! - ! !DESCRIPTION: - ! Compute arguments for gatherv, scatterv for vectors - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: clmlevel ! type of input data - type(mct_gsmap) , pointer :: gsmap - !---------------------------------------------------------------------- - - select case (clmlevel) - case(grlnd) - gsmap => gsmap_lnd_gdc2glo - case(nameg) - gsmap => gsmap_gce_gdc2glo - case(namel) - gsmap => gsmap_lun_gdc2glo - case(namec) - gsmap => gsmap_col_gdc2glo - case(namep) - gsmap => gsmap_patch_gdc2glo - case(nameCohort) - gsmap => gsMap_cohort_gdc2glo - case default - write(iulog,*) 'get_clmlevel_gsmap: Invalid expansion character: ',trim(clmlevel) - call shr_sys_abort() - end select - - end subroutine get_clmlevel_gsmap - -end module decompMod diff --git a/src/main/dtypes.h b/src/main/dtypes.h deleted file mode 100644 index aa1dc3bd0f..0000000000 --- a/src/main/dtypes.h +++ /dev/null @@ -1,6 +0,0 @@ -#define TYPETEXT 100 -#define TYPEREAL 101 -#define TYPEDOUBLE 102 -#define TYPEINT 103 -#define TYPELONG 104 -#define TYPELOGICAL 105 diff --git a/src/main/filterColMod.F90 b/src/main/filterColMod.F90 deleted file mode 100644 index 0c3e63ce85..0000000000 --- a/src/main/filterColMod.F90 +++ /dev/null @@ -1,444 +0,0 @@ -module filterColMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Defines a type to hold column-level filters, along with factory methods to help create - ! a column-level filter - ! - ! To loop over the filter, use code like this: - ! do fc = 1, myfilter%num - ! c = myfilter%indices(fc) - ! ... - ! end do - ! - ! !USES: -#include "shr_assert.h" - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use clm_varcon , only : ispval - use clm_varctl , only : iulog - - ! !PUBLIC TYPES: - implicit none - private - save - - type, public :: filter_col_type - integer :: num ! number of points in the filter - integer, allocatable :: indices(:) ! column indices included in the filter - contains - procedure :: equals_filter - generic :: operator(==) => equals_filter - end type filter_col_type - - ! !PUBLIC ROUTINES: - - ! Create an empty filter - public :: col_filter_empty - - ! Create a filter from an array of indices. This is mainly useful for unit testing. - public :: col_filter_from_index_array - - ! Create a filter from a column-level logical array - public :: col_filter_from_logical_array - - ! Create a filter from a column-level logical array, but including only active points - public :: col_filter_from_logical_array_active_only - - ! Create a filter that contains one or more landunit type(s) of interest - public :: col_filter_from_ltypes - - ! Create a filter from a landunit-level logical array - public :: col_filter_from_lunflags - - ! Create a filter from a gridcell-level logical array and an array of landunit type(s) - ! of interest - public :: col_filter_from_grcflags_ltypes - - ! Create a filter from another filter subset by a column-level logical array - public :: col_filter_from_filter_and_logical_array - - ! !PRIVATE ROUTINES: - - ! Whether a given column should be included in the filter based on the active flag - private :: include_based_on_active - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! TODO(wjs, 2016-04-07) If repeated reallocation of the indices arrays (every time a - ! filter is recreated - each time through the run loop) is a performance issue, then we - ! could rewrite the creation functions to instead be subroutines that act on an existing - ! filter object: I think this would involve replacing calls to col_filter_empty with - ! something like filter%reset_filter; this would only allocate the indices array if it - ! is not already allocated. - - !----------------------------------------------------------------------- - function col_filter_empty(bounds) result(filter) - ! - ! !DESCRIPTION: - ! Initialize a filter object - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'col_filter_empty' - !----------------------------------------------------------------------- - - filter%num = 0 - allocate(filter%indices(bounds%endc - bounds%begc + 1)) - - end function col_filter_empty - - !----------------------------------------------------------------------- - function col_filter_from_index_array(bounds, indices_col) result(filter) - ! - ! !DESCRIPTION: - ! Create a filter from an array of indices. - ! - ! This is mainly useful for unit testing. - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: indices_col(:) ! column-level array of indices to include in filter - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'col_filter_from_index_array' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL(indices_col >= bounds%begc, errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL(indices_col <= bounds%endc, errMsg(sourcefile, __LINE__)) - - filter = col_filter_empty(bounds) - - filter%num = size(indices_col) - filter%indices(1:filter%num) = indices_col - - end function col_filter_from_index_array - - - !----------------------------------------------------------------------- - function col_filter_from_logical_array(bounds, logical_col) result(filter) - ! - ! !DESCRIPTION: - ! Create a column-level filter from a column-level logical array. - ! - ! This version does not consider whether a column is active: it simply includes any - ! column 'c' for which logical_col(c) is .true. - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - logical, intent(in) :: logical_col(bounds%begc:) ! column-level logical array - ! - ! !LOCAL VARIABLES: - integer :: c - - character(len=*), parameter :: subname = 'col_filter_from_logical_array' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(logical_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - filter = col_filter_empty(bounds) - - do c = bounds%begc, bounds%endc - if (logical_col(c)) then - filter%num = filter%num + 1 - filter%indices(filter%num) = c - end if - end do - - end function col_filter_from_logical_array - - !----------------------------------------------------------------------- - function col_filter_from_logical_array_active_only(bounds, logical_col) result(filter) - ! - ! !DESCRIPTION: - ! Create a column-level filter from a column-level logical array. Only include active - ! points in the filter: even if the logical array is true for a given column, that - ! column is excluded if it is inactive. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - logical, intent(in) :: logical_col(bounds%begc:) ! column-level logical array - ! - ! !LOCAL VARIABLES: - integer :: c - - character(len=*), parameter :: subname = 'col_filter_from_logical_array_active_only' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(logical_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - filter = col_filter_empty(bounds) - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - if (logical_col(c)) then - filter%num = filter%num + 1 - filter%indices(filter%num) = c - end if - end if - end do - - end function col_filter_from_logical_array_active_only - - - !----------------------------------------------------------------------- - function col_filter_from_ltypes(bounds, ltypes, include_inactive) & - result(filter) - ! - ! !DESCRIPTION: - ! Create a column-level filter that includes one or more landunit type(s) of interest - ! - ! !USES: - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: ltypes(:) ! landunit type(s) of interest - logical, intent(in) :: include_inactive ! whether inactive points should be included in the filter - ! - ! !LOCAL VARIABLES: - integer :: c - integer :: l - - character(len=*), parameter :: subname = 'col_filter_from_ltypes' - !----------------------------------------------------------------------- - - filter = col_filter_empty(bounds) - - do c = bounds%begc, bounds%endc - if (include_based_on_active(c, include_inactive)) then - l = col%landunit(c) - if (any(ltypes(:) == lun%itype(l))) then - filter%num = filter%num + 1 - filter%indices(filter%num) = c - end if - end if - end do - - end function col_filter_from_ltypes - - !----------------------------------------------------------------------- - function col_filter_from_lunflags(bounds, lunflags, include_inactive) & - result(filter) - ! - ! !DESCRIPTION: - ! Create a column-level filter from a landunit-level logical array. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - logical, intent(in) :: lunflags(bounds%begl:) ! landunit-level logical array - logical, intent(in) :: include_inactive ! whether inactive points should be included in the filter - ! - ! !LOCAL VARIABLES: - integer :: c - integer :: l - - character(len=*), parameter :: subname = 'col_filter_from_lunflags' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(lunflags) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - filter = col_filter_empty(bounds) - - do c = bounds%begc, bounds%endc - if (include_based_on_active(c, include_inactive)) then - l = col%landunit(c) - if (lunflags(l)) then - filter%num = filter%num + 1 - filter%indices(filter%num) = c - end if - end if - end do - - end function col_filter_from_lunflags - - - !----------------------------------------------------------------------- - function col_filter_from_grcflags_ltypes(bounds, grcflags, ltypes, include_inactive) & - result(filter) - ! - ! !DESCRIPTION: - ! Create a column-level filter from a gridcell-level logical array and an array of - ! landunit type(s) of interest. The filter will contain all columns for which (a) - ! grcflags is true for the gridcell containing this column, and (b) the landunit type - ! for the landunit containing this column is one of the types in ltypes. - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - logical, intent(in) :: grcflags(bounds%begg:) ! gridcell-level logical array - integer, intent(in) :: ltypes(:) ! landunit type(s) of interest - logical, intent(in) :: include_inactive ! whether inactive points should be included in the filter - ! - ! !LOCAL VARIABLES: - integer :: g ! gridcell index - integer :: l ! landunit index - integer :: c ! column index - integer :: i ! array index - integer :: ltype ! landunit type - - character(len=*), parameter :: subname = 'col_filter_from_grcflags_ltypes' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(grcflags) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - filter = col_filter_empty(bounds) - - ! This loops over g then l then c rather than just looping over all columns, because - ! this is likely more efficient for sparse filters (e.g., sparse grcflags or uncommon - ! ltypes). - do g = bounds%begg, bounds%endg - if (grcflags(g)) then - do i = 1, size(ltypes) - ltype = ltypes(i) - l = grc%landunit_indices(ltype, g) - if (l == ispval) then - cycle - end if - - do c = lun%coli(l), lun%colf(l) - if (include_based_on_active(c, include_inactive)) then - filter%num = filter%num + 1 - filter%indices(filter%num) = c - end if - end do ! c - end do ! i = 1, size(ltypes) - end if ! grcflags(g) - end do ! g - - end function col_filter_from_grcflags_ltypes - - !----------------------------------------------------------------------- - function col_filter_from_filter_and_logical_array(bounds, num_orig, filter_orig, logical_col) & - result(filter) - ! - ! !DESCRIPTION: - ! Create a filter from another filter subset by a column-level logical array - ! - ! !ARGUMENTS: - type(filter_col_type) :: filter ! function result - - ! Accepts separate num & indices arguments rather than a filter of filter_col_type so - ! that this function can be called with old-style filters, where these were stored - ! separately rather than being bundled together. - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num_orig ! number of points in original filter - integer, intent(in) :: filter_orig(:) ! column indices in original filter - logical, intent(in) :: logical_col(bounds%begc:) ! column-level logical array - ! - ! !LOCAL VARIABLES: - integer :: fc, c - - character(len=*), parameter :: subname = 'col_filter_from_filter_and_logical_array' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(logical_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - filter = col_filter_empty(bounds) - - do fc = 1, num_orig - c = filter_orig(fc) - if (logical_col(c)) then - filter%num = filter%num + 1 - filter%indices(filter%num) = c - end if - end do - - end function col_filter_from_filter_and_logical_array - - - !----------------------------------------------------------------------- - pure function include_based_on_active(c, include_inactive) result(include_point) - ! - ! !DESCRIPTION: - ! Returns true if the given column should be included in a filter based on its active - ! flag - ! - ! !ARGUMENTS: - logical :: include_point ! function result - integer, intent(in) :: c ! column index - logical, intent(in) :: include_inactive ! whether inactive points are included in this filter - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'include_based_on_active' - !----------------------------------------------------------------------- - - ! This code is written to avoid the check of col%active if include_inactive is true. - ! This is needed in the case of filters that are created in initialization, before - ! the active flags are set. - if (include_inactive) then - include_point = .true. - else if (col%active(c)) then - include_point = .true. - else - include_point = .false. - end if - - end function include_based_on_active - - - !----------------------------------------------------------------------- - function equals_filter(this, other) result(equal) - ! - ! !DESCRIPTION: - ! Returns true if the two filters are equal. - ! - ! If they differ, prints some information about how they differ. - ! - ! !USES: - ! - ! !ARGUMENTS: - logical :: equal ! function result - class(filter_col_type), intent(in) :: this - class(filter_col_type), intent(in) :: other - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'equals_filter' - !----------------------------------------------------------------------- - - equal = .true. - - if (this%num /= other%num) then - equal = .false. - write(iulog,*) ' ' - write(iulog,'(a, i0, a, i0)') 'equals_filter false: Sizes differ: ', & - this%num, ' /= ', other%num - else - do i = 1, this%num - if (this%indices(i) /= other%indices(i)) then - equal = .false. - write(iulog,*) ' ' - write(iulog,'(a, i0, a, i0, a, i0)') & - 'equals_filter false: Values differ; first difference at ', & - i, ': ', this%indices(i), ' /= ', other%indices(i) - exit - end if - end do - end if - - end function equals_filter - - -end module filterColMod diff --git a/src/main/filterMod.F90 b/src/main/filterMod.F90 deleted file mode 100644 index 1201582af7..0000000000 --- a/src/main/filterMod.F90 +++ /dev/null @@ -1,584 +0,0 @@ -module filterMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module of filters used for processing columns and pfts of particular - ! types, including lake, non-lake, urban, soil, snow, non-snow, and - ! naturally-vegetated patches. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use glcBehaviorMod , only : glc_behavior_type - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - type clumpfilter - integer, pointer :: allc(:) ! all columns - integer :: num_allc ! number of points in allc filter - - integer, pointer :: natvegp(:) ! CNDV nat-vegetated (present) filter (pfts) - integer :: num_natvegp ! number of pfts in nat-vegetated filter - - integer, pointer :: pcropp(:) ! prognostic crop filter (pfts) - integer :: num_pcropp ! number of pfts in prognostic crop filter - integer, pointer :: soilnopcropp(:) ! soil w/o prog. crops (pfts) - integer :: num_soilnopcropp ! number of pfts in soil w/o prog crops - - integer, pointer :: lakep(:) ! lake filter (pfts) - integer :: num_lakep ! number of pfts in lake filter - integer, pointer :: nolakep(:) ! non-lake filter (pfts) - integer :: num_nolakep ! number of pfts in non-lake filter - integer, pointer :: lakec(:) ! lake filter (columns) - integer :: num_lakec ! number of columns in lake filter - integer, pointer :: nolakec(:) ! non-lake filter (columns) - integer :: num_nolakec ! number of columns in non-lake filter - - integer, pointer :: soilc(:) ! soil filter (columns) - integer :: num_soilc ! number of columns in soil filter - integer, pointer :: soilp(:) ! soil filter (pfts) - integer :: num_soilp ! number of pfts in soil filter - - integer, pointer :: snowc(:) ! snow filter (columns) - integer :: num_snowc ! number of columns in snow filter - integer, pointer :: nosnowc(:) ! non-snow filter (columns) - integer :: num_nosnowc ! number of columns in non-snow filter - - integer, pointer :: lakesnowc(:) ! snow filter (columns) - integer :: num_lakesnowc ! number of columns in snow filter - integer, pointer :: lakenosnowc(:) ! non-snow filter (columns) - integer :: num_lakenosnowc ! number of columns in non-snow filter - - integer, pointer :: exposedvegp(:) ! patches where frac_veg_nosno is non-zero - integer :: num_exposedvegp ! number of patches in exposedvegp filter - integer, pointer :: noexposedvegp(:)! patches where frac_veg_nosno is 0 (does NOT include lake or urban) - integer :: num_noexposedvegp ! number of patches in noexposedvegp filter - - integer, pointer :: hydrologyc(:) ! hydrology filter (columns) - integer :: num_hydrologyc ! number of columns in hydrology filter - - integer, pointer :: urbanl(:) ! urban filter (landunits) - integer :: num_urbanl ! number of landunits in urban filter - integer, pointer :: nourbanl(:) ! non-urban filter (landunits) - integer :: num_nourbanl ! number of landunits in non-urban filter - - integer, pointer :: urbanc(:) ! urban filter (columns) - integer :: num_urbanc ! number of columns in urban filter - integer, pointer :: nourbanc(:) ! non-urban filter (columns) - integer :: num_nourbanc ! number of columns in non-urban filter - - integer, pointer :: urbanp(:) ! urban filter (pfts) - integer :: num_urbanp ! number of pfts in urban filter - integer, pointer :: nourbanp(:) ! non-urban filter (pfts) - integer :: num_nourbanp ! number of pfts in non-urban filter - - integer, pointer :: nolakeurbanp(:) ! non-lake, non-urban filter (pfts) - integer :: num_nolakeurbanp ! number of pfts in non-lake, non-urban filter - - integer, pointer :: icemecc(:) ! glacier mec filter (cols) - integer :: num_icemecc ! number of columns in glacier mec filter - - integer, pointer :: do_smb_c(:) ! glacier+bareland SMB calculations-on filter (cols) - integer :: num_do_smb_c ! number of columns in glacier+bareland SMB mec filter - - end type clumpfilter - public clumpfilter - - ! This is the standard set of filters, which should be used in most places in the code. - ! These filters only include 'active' points. - type(clumpfilter), allocatable, public :: filter(:) - - ! --- DO NOT USING THE FOLLOWING VARIABLE UNLESS YOU KNOW WHAT YOU'RE DOING! --- - ! - ! This is a separate set of filters that contains both inactive and active points. It is - ! rarely appropriate to use these, but they are needed in a few places, e.g., where - ! quantities are computed before weights, active flags and filters are updated due to - ! landuse change. Note that, for the handful of filters that are computed outside of - ! setFiltersOneGroup (including the CNDV natvegp filter and the snow filters), these - ! filters are NOT included in this variable - so they can only be used from the main - ! 'filter' variable. - ! - ! Ideally, we would like to restructure the initialization code and driver ordering so - ! that this version of the filters is never needed. At that point, we could remove this - ! filter_inactive_and_active variable, and simplify filterMod to look the way it did - ! before this variable was added (i.e., when there was only a single group of filters). - ! - type(clumpfilter), allocatable, public :: filter_inactive_and_active(:) - ! - public allocFilters ! allocate memory for filters - public setFilters ! set filters - public setExposedvegpFilter ! set the exposedvegp and noexposedvegp filters - - private allocFiltersOneGroup ! allocate memory for one group of filters - private setFiltersOneGroup ! set one group of filters - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - ! - ! !REVISION HISTORY: - ! Created by Mariana Vertenstein - ! 11/13/03, Peter Thornton: Added soilp and num_soilp - ! Jan/08, S. Levis: Added crop-related filters - ! June/13, Bill Sacks: Change main filters to just work over 'active' points; - ! add filter_inactive_and_active - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine allocFilters() - ! - ! !DESCRIPTION: - ! Allocate CLM filters. - ! - ! !REVISION HISTORY: - ! Created by Bill Sacks - !------------------------------------------------------------------------ - - call allocFiltersOneGroup(filter) - call allocFiltersOneGroup(filter_inactive_and_active) - - end subroutine allocFilters - - !------------------------------------------------------------------------ - subroutine allocFiltersOneGroup(this_filter) - ! - ! !DESCRIPTION: - ! Allocate CLM filters, for one group of filters. - ! - ! !USES: - use decompMod , only : get_proc_clumps, get_clump_bounds - ! - ! !ARGUMENTS: - type(clumpfilter), intent(inout), allocatable :: this_filter(:) ! the filter to allocate - ! - ! LOCAL VARAIBLES: - integer :: nc ! clump index - integer :: nclumps ! total number of clumps on this processor - integer :: ier ! error status - type(bounds_type) :: bounds - !------------------------------------------------------------------------ - - ! Determine clump variables for this processor - - nclumps = get_proc_clumps() - - ier = 0 - if( .not. allocated(this_filter)) then - allocate(this_filter(nclumps), stat=ier) - end if - if (ier /= 0) then - write(iulog,*) 'allocFiltersOneGroup(): allocation error for clumpsfilters' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Loop over clumps on this processor - -!$OMP PARALLEL DO PRIVATE (nc,bounds) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds) - - allocate(this_filter(nc)%allc(bounds%endc-bounds%begc+1)) - - allocate(this_filter(nc)%lakep(bounds%endp-bounds%begp+1)) - allocate(this_filter(nc)%nolakep(bounds%endp-bounds%begp+1)) - allocate(this_filter(nc)%nolakeurbanp(bounds%endp-bounds%begp+1)) - - allocate(this_filter(nc)%lakec(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%nolakec(bounds%endc-bounds%begc+1)) - - allocate(this_filter(nc)%soilc(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%soilp(bounds%endp-bounds%begp+1)) - - allocate(this_filter(nc)%snowc(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%nosnowc(bounds%endc-bounds%begc+1)) - - allocate(this_filter(nc)%lakesnowc(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%lakenosnowc(bounds%endc-bounds%begc+1)) - - allocate(this_filter(nc)%exposedvegp(bounds%endp-bounds%begp+1)) - allocate(this_filter(nc)%noexposedvegp(bounds%endp-bounds%begp+1)) - - allocate(this_filter(nc)%natvegp(bounds%endp-bounds%begp+1)) - - allocate(this_filter(nc)%hydrologyc(bounds%endc-bounds%begc+1)) - - allocate(this_filter(nc)%urbanp(bounds%endp-bounds%begp+1)) - allocate(this_filter(nc)%nourbanp(bounds%endp-bounds%begp+1)) - - allocate(this_filter(nc)%urbanc(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%nourbanc(bounds%endc-bounds%begc+1)) - - allocate(this_filter(nc)%urbanl(bounds%endl-bounds%begl+1)) - allocate(this_filter(nc)%nourbanl(bounds%endl-bounds%begl+1)) - - allocate(this_filter(nc)%pcropp(bounds%endp-bounds%begp+1)) - allocate(this_filter(nc)%soilnopcropp(bounds%endp-bounds%begp+1)) - - allocate(this_filter(nc)%icemecc(bounds%endc-bounds%begc+1)) - allocate(this_filter(nc)%do_smb_c(bounds%endc-bounds%begc+1)) - - end do -!$OMP END PARALLEL DO - - end subroutine allocFiltersOneGroup - - !------------------------------------------------------------------------ - subroutine setFilters(bounds, glc_behavior) - ! - ! !DESCRIPTION: - ! Set CLM filters. - use decompMod , only : BOUNDS_LEVEL_CLUMP - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(glc_behavior_type) , intent(in) :: glc_behavior - !------------------------------------------------------------------------ - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(sourcefile, __LINE__)) - - call setFiltersOneGroup(bounds, & - filter, include_inactive = .false., & - glc_behavior = glc_behavior) - - ! At least as of June, 2013, the 'inactive_and_active' version of the filters is - ! static in time. Thus, we could have some logic saying whether we're in - ! initialization, and if so, skip this call. But this is problematic for two reasons: - ! (1) it requires that the caller of this routine (currently reweight_wrapup) know - ! whether it is in initialization; and (2) it assumes that the filter definitions - ! won't be changed in the future in a way that creates some variability in time. So - ! for now, it seems cleanest and safest to just update these filters whenever the main - ! filters are updated. But if this proves to be a performance problem, we could - ! introduce an argument saying whether we're in initialization, and if so, skip this - ! call. - - call setFiltersOneGroup(bounds, & - filter_inactive_and_active, include_inactive = .true., & - glc_behavior = glc_behavior) - - end subroutine setFilters - - - !------------------------------------------------------------------------ - subroutine setFiltersOneGroup(bounds, this_filter, include_inactive, glc_behavior) - ! - ! !DESCRIPTION: - ! Set CLM filters for one group of filters. - ! - ! "Standard" filters only include active points. However, this routine can be used to set - ! alternative filters that also apply over inactive points, by setting include_inactive = - ! .true. - ! - ! This routine sets filters that are determined by subgrid type, "active" status of - ! patch, col or landunit, and the like. Filters based on model state (e.g., snow - ! cover) should generally be set elsewhere, to ensure that the routine that sets them - ! is called at the right time in the driver loop. - ! - ! !USES: - use decompMod , only : BOUNDS_LEVEL_CLUMP - use pftconMod , only : npcropmin - use landunit_varcon , only : istsoil, istcrop, istice_mec - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(clumpfilter) , intent(inout) :: this_filter(:) ! the group of filters to set - logical , intent(in) :: include_inactive ! whether inactive points should be included in the filters - type(glc_behavior_type) , intent(in) :: glc_behavior - ! - ! LOCAL VARAIBLES: - integer :: nc ! clump index - integer :: c,l,p ! column, landunit, patch indices - integer :: fl ! lake filter index - integer :: fnl,fnlu ! non-lake filter index - integer :: fs ! soil filter index - integer :: f, fn ! general indices - integer :: g !gridcell index - !------------------------------------------------------------------------ - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(sourcefile, __LINE__)) - - nc = bounds%clump_index - - ! Create filter of all columns - fl = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - fl = fl + 1 - this_filter(nc)%allc(fl) = c - end if - end do - this_filter(nc)%num_allc = fl - - ! Create lake and non-lake filters at column-level - - fl = 0 - fnl = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - l =col%landunit(c) - if (lun%lakpoi(l)) then - fl = fl + 1 - this_filter(nc)%lakec(fl) = c - else - fnl = fnl + 1 - this_filter(nc)%nolakec(fnl) = c - end if - end if - end do - this_filter(nc)%num_lakec = fl - this_filter(nc)%num_nolakec = fnl - - ! Create lake and non-lake filters at patch-level - - fl = 0 - fnl = 0 - fnlu = 0 - do p = bounds%begp,bounds%endp - if (patch%active(p) .or. include_inactive) then - l =patch%landunit(p) - if (lun%lakpoi(l) ) then - fl = fl + 1 - this_filter(nc)%lakep(fl) = p - else - fnl = fnl + 1 - this_filter(nc)%nolakep(fnl) = p - if (.not. lun%urbpoi(l)) then - fnlu = fnlu + 1 - this_filter(nc)%nolakeurbanp(fnlu) = p - end if - end if - end if - end do - this_filter(nc)%num_lakep = fl - this_filter(nc)%num_nolakep = fnl - this_filter(nc)%num_nolakeurbanp = fnlu - - ! Create soil filter at column-level - - fs = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - l =col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fs = fs + 1 - this_filter(nc)%soilc(fs) = c - end if - end if - end do - this_filter(nc)%num_soilc = fs - - ! Create soil filter at patch-level - - fs = 0 - do p = bounds%begp,bounds%endp - if (patch%active(p) .or. include_inactive) then - l =patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fs = fs + 1 - this_filter(nc)%soilp(fs) = p - end if - end if - end do - this_filter(nc)%num_soilp = fs - - ! Create column-level hydrology filter (soil and Urban pervious road cols) - - f = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - if (col%hydrologically_active(c)) then - f = f + 1 - this_filter(nc)%hydrologyc(f) = c - end if - end if - end do - this_filter(nc)%num_hydrologyc = f - - ! Create prognostic crop and soil w/o prog. crop filters at patch-level - ! according to where the crop model should be used - - fl = 0 - fnl = 0 - do p = bounds%begp,bounds%endp - if (patch%active(p) .or. include_inactive) then - if (patch%itype(p) >= npcropmin) then !skips 2 generic crop types - fl = fl + 1 - this_filter(nc)%pcropp(fl) = p - else - l =patch%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fnl = fnl + 1 - this_filter(nc)%soilnopcropp(fnl) = p - end if - end if - end if - end do - this_filter(nc)%num_pcropp = fl - this_filter(nc)%num_soilnopcropp = fnl ! This wasn't being set before... - - ! Create landunit-level urban and non-urban filters - - f = 0 - fn = 0 - do l = bounds%begl,bounds%endl - if (lun%active(l) .or. include_inactive) then - if (lun%urbpoi(l)) then - f = f + 1 - this_filter(nc)%urbanl(f) = l - else - fn = fn + 1 - this_filter(nc)%nourbanl(fn) = l - end if - end if - end do - this_filter(nc)%num_urbanl = f - this_filter(nc)%num_nourbanl = fn - - ! Create column-level urban and non-urban filters - - f = 0 - fn = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - l = col%landunit(c) - if (lun%urbpoi(l)) then - f = f + 1 - this_filter(nc)%urbanc(f) = c - else - fn = fn + 1 - this_filter(nc)%nourbanc(fn) = c - end if - end if - end do - this_filter(nc)%num_urbanc = f - this_filter(nc)%num_nourbanc = fn - - ! Create patch-level urban and non-urban filters - - f = 0 - fn = 0 - do p = bounds%begp,bounds%endp - if (patch%active(p) .or. include_inactive) then - l = patch%landunit(p) - if (lun%urbpoi(l)) then - f = f + 1 - this_filter(nc)%urbanp(f) = p - else - fn = fn + 1 - this_filter(nc)%nourbanp(fn) = p - end if - end if - end do - this_filter(nc)%num_urbanp = f - this_filter(nc)%num_nourbanp = fn - - f = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - l = col%landunit(c) - if (lun%itype(l) == istice_mec) then - f = f + 1 - this_filter(nc)%icemecc(f) = c - end if - end if - end do - this_filter(nc)%num_icemecc = f - - f = 0 - do c = bounds%begc,bounds%endc - if (col%active(c) .or. include_inactive) then - l = col%landunit(c) - g = col%gridcell(c) - - ! Only compute SMB in regions where we replace ice melt with new ice: - ! Elsewhere (where ice melt remains in place), we cannot compute a sensible - ! negative SMB. - ! - ! In addition to istice_mec columns, we also compute SMB for any soil column in - ! this region, in order to provide SMB forcing for the bare ground elevation - ! class (elevation class 0). - if ( glc_behavior%melt_replaced_by_ice_grc(g) .and. & - (lun%itype(l) == istice_mec .or. lun%itype(l) == istsoil)) then - f = f + 1 - this_filter(nc)%do_smb_c(f) = c - end if - end if - end do - this_filter(nc)%num_do_smb_c = f - - ! Note: snow filters are reconstructed each time step in - ! LakeHydrology and SnowHydrology - ! Note: CNDV "pft present" filter is reconstructed each time CNDV is run - - end subroutine setFiltersOneGroup - - !----------------------------------------------------------------------- - subroutine setExposedvegpFilter(bounds, frac_veg_nosno) - ! - ! !DESCRIPTION: - ! Sets the exposedvegp and noexposedvegp filters for one clump. - ! - ! The exposedvegp filter includes points for which frac_veg_nosno > 0. noexposedvegp - ! includes points for which frac_veg_nosno <= 0. However, note that neither filter - ! includes urban or lake points! - ! - ! Should be called from within a loop over clumps. - ! - ! Only sets this filter in the main 'filter' variable, NOT in - ! filter_inactive_and_active. - ! - ! Note that this is done separately from the main setFilters routine, because it may - ! need to be called at a different time in the driver loop. - ! - ! !USES: - use decompMod , only : BOUNDS_LEVEL_CLUMP - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: frac_veg_nosno( bounds%begp: ) ! fraction of vegetation not covered by snow [patch] - ! - ! !LOCAL VARIABLES: - integer :: nc ! clump index - integer :: fp ! filter index - integer :: p ! patch index - integer :: fe, fn ! filter counts - - character(len=*), parameter :: subname = 'setExposedvegpFilter' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(frac_veg_nosno) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - - nc = bounds%clump_index - - fe = 0 - fn = 0 - do fp = 1, filter(nc)%num_nolakeurbanp - p = filter(nc)%nolakeurbanp(fp) - if (frac_veg_nosno(p) > 0) then - fe = fe + 1 - filter(nc)%exposedvegp(fe) = p - else - fn = fn + 1 - filter(nc)%noexposedvegp(fn) = p - end if - end do - filter(nc)%num_exposedvegp = fe - filter(nc)%num_noexposedvegp = fn - - end subroutine setExposedvegpFilter - - -end module filterMod diff --git a/src/main/findHistFields.pl b/src/main/findHistFields.pl deleted file mode 100755 index e9952e869d..0000000000 --- a/src/main/findHistFields.pl +++ /dev/null @@ -1,546 +0,0 @@ -#!/usr/bin/env perl -# -# This perl script reads in the histFldsMod.F90 file to find the total list of history -# fields that can be added for this model version, regardless of namelist options, or -# CPP processing. -# -use strict; -#use warnings; -#use diagnostics; - -use Cwd; -use English; -use Getopt::Long; -use IO::File; -use File::Glob ':glob'; - -# Set the directory that contains the CLM configuration scripts. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume -# the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $cmdline = "@ARGV"; # Command line arguments to script -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -my $nm = "${ProgName}::"; # name to use if script dies -if ($ProgDir) { - $cfgdir = $ProgDir; -} else { - $cfgdir = $cwd; -} -# The namelist definition file contains entries for all namelist variables that -# can be output by build-namelist. -my $nl_definition_file = "$cfgdir/../../bld/namelist_files/namelist_definition_clm4_5.xml"; -(-f "$nl_definition_file") or die <<"EOF"; -** $ProgName - Cannot find namelist definition file \"$nl_definition_file\" ** -EOF -print "Using namelist definition file $nl_definition_file\n"; - -# The Build::NamelistDefinition module provides utilities to get the list of -# megan compounds - -#The root directory to cesm utils Tools -my $cesm_tools = "$cfgdir/../../../../cime/utils/"; - -if ( ! -f "$cesm_tools/perl5lib/Build/NamelistDefinition.pm") { - $cesm_tools = "$cfgdir/../../cime/utils/"; - if ( ! -f "$cesm_tools/perl5lib/Build/NamelistDefinition.pm") { - die <<"EOF"; -** $ProgName - Cannot find perl module \"Build/NamelistDefinition.pm\" in directory - \"$cesm_tools/perl5lib\" ** -EOF - } -} -# Add $cfgdir/perl5lib to the list of paths that Perl searches for modules -my @dirs = ( $cfgdir, "$cesm_tools/perl5lib"); -unshift @INC, @dirs; -require Build::NamelistDefinition; -# Create a namelist definition object. This object provides a method for verifying that -# the -# output namelist variables are in the definition file, and are output in the correct -# namelist groups. -my $definition = Build::NamelistDefinition->new($nl_definition_file); - - -my $mxname = 0; -my $mxlongn = 0; -my %fields; -my $fldnamevar = "fieldname_var"; - -sub matchKeyword { -# -# Match a keyword -# - my $keyword = shift; - my $line = shift; - my $fh = shift; - - my $match = undef; - if ( $line =~ /$keyword/ ) { - if ( $line =~ /$keyword\s*=\s*['"]([^'"]+)(['"&])/ ) { - $match = $1; - if ( $2 eq "&" ) { - $line = <$fh>; - if ( $line =~ /&([^'"]+)['"]/ ) { - $match .= $1; - } - } - } elsif ( $line =~ /$keyword\s*=\s*&\s*$/ ) { - $line = <$fh>; - if ( $line =~ /^\s*['"]([^'"]+)['"]/ ) { - $match = $1; - } else { - die "ERROR: Trouble getting keyword string\n Line: $line"; - } - } else { - if ( $line =~ /fname\s*=\s*fieldname/ ) { - print STDERR "Found variable used for fieldname = $line\n"; - $match = $fldnamevar; - } elsif ( $line =~ /fname\s*=\s*trim\(fname\)/ ) { - $match = undef; - } elsif ( $line =~ /units\s*=\s*units/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*long_name/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*lname/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*longname/ ) { - print STDERR "Found variable used for longname = $line\n"; - $match = "longname_var"; - } else { - die "ERROR: Still have a match on $keyword\n Line: $line"; - } - } - } - return( $match ); -} - -sub getFieldInfo { -# -# Get field Information -# - my $fh = shift; - my $line = shift; - - my $fname = undef; - my $units = undef; - my $longn = undef; - my $endin = undef; - do { - if ( $line =~ /MEG_/ ) { - $line =~ s|'//'_'|_'|g; - $line =~ s|'//trim\(meg_cmp\%name\)|megancmpd'|gi; - if ( $line =~ /meg_cmp\%name/ ) { - die "ERROR: Still have meg_cmp in a line\n"; - } - } - if ( $line =~ /^(.+)this\%species\%hist_fname\(\s*['"]*([^'"]+)['"]\s*[,]*([^\)]*)\)(.*)/ ) { - my $suffix = ""; - my $beg = $1; - my $mid = $2; - my $suf = $3; - my $end = $4; - if ( $suf =~ /suffix\s*=\s*['"]([^'"]+)['"]/ ) { - $suffix=$1; - } - $line = "$beg 'ISO_${mid}ELEM_${suffix}' $end"; - } - $line -~ s|['"]\s*\/\/\s*this\%species\%get_species\(\)\s*\/\/\s*['"]|ELEM_|g; - if ( ! defined($fname) ) { - $fname = &matchKeyword( "fname", $line, $fh ); - } - if ( ! defined($units) ) { - $units = &matchKeyword( "units", $line, $fh ); - } - if ( ! defined($longn) ) { - $longn = &matchKeyword( "long_name", $line, $fh ); - } - if ( $line =~ /\)\s*$/ ) { - $endin = 1; - } - if ( ! defined($endin) ) { $line = <$fh>; } - - } until( (defined($fname) && defined($units) && defined($longn)) || - ! defined($line) || defined($endin) ); - if ( ! defined($fname) ) { - print "fname: $fname units: $units longn: $longn endin: $endin\n"; - die "ERROR: name undefined for field ending with: $line\n"; - } - return( $fname, $longn, $units ); -} - -sub setField { -# -# Set the field -# - my $name = shift; - my $longn = shift; - my $units = shift; - - if ( defined($name) && $name ne $fldnamevar ) { - if ( length($name) > $mxname ) { $mxname = length($name); } - if ( length($longn) > $mxlongn ) { $mxlongn = length($longn); } - my $len; - if ( length($longn) > 90 ) { - $len = 110; - } elsif ( length($longn) > 60 ) { - $len = 90; - } else { - $len = 60; - } - $fields{$name}{'field'} = sprintf( "%-${len}s\t(%s)", $longn, $units ); - $fields{$name}{'longn'} = $longn; - $fields{$name}{'units'} = $units; - } -} - -sub XML_Header { -# -# Write out header to history fields file -# - my $outfh = shift; - my $outfilename = shift; - - print STDERR " Write out header to history fields file to: $outfilename\n"; - my $svnurl = '$URL: https://svn-ccsm-models.cgd.ucar.edu/clm2/trunk_tags/clm4_0_40/models/lnd/clm/src/main/findHistFields.pl $'; - my $svnid = '$Id: findHistFields.pl 34757 2012-02-15 18:38:05Z erik $'; - print $outfh <<"EOF"; - - -\<\?xml-stylesheet type="text\/xsl" href="history_fields.xsl"\?\> - -\<\!-- - List of history file field names, long-names and units for all the fields output - by CLM. - SVN version information: - $svnurl - $svnid ---\> - -\ -EOF -} - -sub XML_Footer { -# -# Write out footer to history fields file -# - my $outfh = shift; - - print STDERR " Write out footer to history fields file\n"; - print $outfh "\n\n"; -} - -my $pwd = `pwd`; -chomp( $pwd ); -my @megcmpds = $definition->get_valid_values( "megan_cmpds", 'noquotes'=>1 ); -my @filenames = glob( "$pwd/*.F90" ); -push( @filenames, glob( "$pwd/../biogeochem/*.F90" ) ); -push( @filenames, glob( "$pwd/../biogeophys/*.F90" ) ); -push( @filenames, glob( "$pwd/../soilbiogeochem/*.F90" ) ); -push( @filenames, glob( "$pwd/../biogeophys/*.F90" ) ); -push( @filenames, glob( "$pwd/../fates/main/*.F90" ) ); - -# -# Loop over all files that have hist_addfld calls in them -# -foreach my $filename ( @filenames ) { - - if ( $filename =~ /histFileMod.F90$/ ) { - next; - } - my $fh = IO::File->new($filename, '<') or die "** $ProgName - can't open history Fields file: $filename\n"; - print( "Filename: $filename\n" ); - # - # Read in the list of fields from the source file - # - while (my $line = <$fh>) { - - # Comments - if ($line =~ /(.*)\!/) { - $line = $1; - } - #if ($line =~ /end subroutine/) { - # last; - #} - my $format = "\n\n"; - if ($line =~ /call\s*hist_addfld/i ) { - (my $name, my $longn, my $units) = &getFieldInfo( $fh, $line ); - if ( $name ne "MEG_megancmpd" && $name =~ /ISO_/ ) { - &setField( $name, $longn, $units ); - printf( , $format, $name, $units, $longn ); - } elsif ( $name =~ /ISO_/ ) { - foreach my $iso ( "C12", "C13", "C14", "N" ) { - my $elem = substr( $iso, 0, 1 ); - $name =~ s/ISO_/$iso/g; - $name =~ s/ELEM_/$elem/g; - $longn =~ s/ISO_/$elem/g; - $longn =~ s/ELEM_/$elem/g; - $units =~ s/ISO_/$iso/g; - $units =~ s/ELEM_/$elem/g; - &setField( $name, $longn, $units ); - printf( , $format, $name, $units, $longn ); - } - } elsif ( $name eq "MEG_megancmpd" ) { - foreach my $megcmpd ( @megcmpds ) { - my $name = "MEG_${megcmpd}"; - &setField( $name, $longn, $units ); - printf( , $format, $name, $units, $longn ); - } - } - } - } - close( $fh ); -} -print STDERR " mxname = $mxname\n"; -print STDERR " mxlongn = $mxlongn\n"; -my %pool_name = ( - L1=> { hist=>'LITR1', long=>'litter 1' }, - L2=> { hist=>'LITR2', long=>'litter 2' }, - L3=> { hist=>'LITR3', long=>'litter 3' }, - CWD=>{ hist=>'CWD', long=>'coarse woody debris' }, - S1=> { hist=>'SOIL1', long=>'soil 1' }, - S2=> { hist=>'SOIL2', long=>'soil 2' }, - S3=> { hist=>'SOIL3', long=>'soil 3' }, - S4=> { hist=>'SOIL4', long=>'soil 4' }, - atm=>{ hist=>'atmosphere', long=>'atmosphere' }, - ); - -my %vrt_suffix = ( C=>" C", "C_vr"=>" C (vertically resolved)", C_1m=>" C to 1 meter", - C_30cm=>" C to 30 cm", C_activelayer=>" C in active layer", - N=>" C", "N_vr"=>" N (vertically resolved)", N_1m=>" N to 1 meter", - N_30cm=>" N to 30 cm", N_activelayer=>" N in active layer", - ); -my %firelist = ( - C_TO_FIRE=>" C fire loss", C_TO_FIRE_vr=>" C fire loss", - N_TO_FIRE=>" N fire loss", N_TO_FIRE_vr=>" N fire loss", - ); -my %leechlist = ( - C_TO_LEACHING=>" C leaching loss", C_TNDNCY_VERT_TRANSPORT=>" C tendency due to vertical transport", - N_TO_LEACHING=>" N leaching loss", N_TNDNCY_VERT_TRANSPORT=>" N tendency due to vertical transport", - ); -# -# Add fields that are looped over -# -my $name, my $longn, my $units; -foreach my $pool ( keys(%pool_name) ) { - my $fname = $pool_name{$pool}{'hist'}; - foreach my $fld ( keys(%vrt_suffix) ) { - $name = $fname . $fld; - $longn = $pool_name{$pool}{'hist'} . $vrt_suffix{$fld}; - $units; - if ( $fld eq "C_vr" ) { - $units = "gC/m^3"; - } elsif ( $fld eq "N_vr" ) { - $units = "gN/m^3"; - } elsif ( $fld =~ /^N/) { - $units = "gN/m^2"; - } else { - $units = "gC/m^2"; - } - &setField( $name, $longn, $units ); - if ( $fld eq "C" || $fld eq "C_vr" ) { - foreach my $ciso ( "C13", "C14" ) { - $name = $ciso."_".$fname . $fld; - $longn = $ciso." ".$pool_name{$pool}{'long'} . $vrt_suffix{$fld}; - if ( $fld eq "C_vr" ) { - $units = "g${ciso}m^3"; - } else { - $units = "g${ciso}/m^2"; - } - &setField( $name, $longn, $units ); - } - } - if ( $fld =~ "C_1m" || $fld eq "C_30m" || $fld eq "C_activelayer" ) { - foreach my $ciso ( "C14" ) { - $name = $ciso."_".$fname . $fld; - $longn = $ciso." ".$pool_name{$pool}{'long'} . $vrt_suffix{$fld}; - $units = "g${ciso}/m^2"; - &setField( $name, $longn, $units ); - } - } - } - # Fire list - if ( $fname =~ /^CWD/ || $fname =~ /^LIT/ ) { - foreach my $fld ( keys(%firelist) ) { - $name = "M_".$fname . $fld; - $longn = $firelist{$fname}; - $units; - if ( $fld =~ /_vr$/ ) { - $units = "gC/m^3"; - } else { - $units = "gC/m^2"; - } - &setField( $name, $longn, $units ); - # Carbon isotopes (C13/C14) - if ( $fld =~ /^C/ ) { - foreach my $ciso ( "C13", "C14" ) { - $name = "${ciso}_M_".$fname . $fld; - $longn = $ciso.$firelist{$fname}; - if ( $fld =~ /_vr$/ ) { - $units = "g${ciso}/m^3"; - } else { - $units = "g${ciso}/m^2"; - } - &setField( $name, $longn, $units ); - } - } - } - } - # Potential loss coefficient - $name = "K_".$fname; - $longn = $pool_name{$pool}{'long'} . " potential loss coefficient"; - $units = "1/s"; - &setField( $name, $longn, $units ); - # - # Not CWD - # - if ( $fname !~ /^CWD/ ) { - foreach my $fld ( keys(%leechlist) ) { - $name = "M_".$fname . $fld; - $longn = $leechlist{$fname}; - my $elm; - if ( $fld =~ /^N/ ) { - $elm = "N"; - } else { - $elm = "C"; - } - if ( $fld =~ /VERT$/ ) { - $units = "g${elm}/m^3"; - } else { - $units = "g${elm}/m^2"; - } - &setField( $name, $longn, $units ); - } - } -} -my %translist = ( - # CN transitions - L1S1 =>{d=>"L1", r=>"S1"}, L2S2 =>{d=>"L2", r=>"S2"}, - L3S3 =>{d=>"L3", r=>"S3"}, S1S2 =>{d=>"S1", r=>"S2"}, - S2S3 =>{d=>"S2", r=>"S3"}, S3S4 =>{d=>"S3", r=>"S4"}, - S4 =>{d=>"S4", r=>"atm"}, - CWDL2=>{d=>"CWD", r=>"L2"}, CWDL3=>{d=>"CWD", r=>"L3"}, - # CENTURY transitions NOT already given above - L2S1 =>{d=>"L2", r=>"S1"}, L3S2 =>{d=>"L3", r=>"S2"}, - S1S3 =>{d=>"S1", r=>"S3"}, S2S1 =>{d=>"S2", r=>"S1"}, - S3S1 =>{d=>"S3", r=>"S1"}, - ); -# -# Transition list (NOT complete) -# -my $unitsvr; -foreach my $trans ( keys(%translist) ) { - my $donor = $translist{$trans}{'d'}; - my $rcvr = $translist{$trans}{'r'}; - if ( $trans ne "${donor}${rcvr}" && ($rcvr ne "atm" || $trans ne $donor) ) { - die "ERROR: Either bad transition name: $trans or bad donor: $donor or receiver: -$rcvr\n"; - } - # Carbon isotopes - foreach my $ciso ( "", "C13", "C14" ) { - if ( $ciso eq "" ) { - $units = "gC/m^2/s"; - $unitsvr = "gC/m^3/s"; - } else { - $units = "g${ciso}/m^2/s"; - $unitsvr = "g${ciso}/m^3/s"; - } - if ( $donor ne "CWD" ) { - my $ii = 0; - foreach my $trans2 ( keys(%translist) ) { - if ($donor eq $translist{$trans}{'d'} ) { $ii = $ii + 1; } - } - # HR - if ( $ii == 1 ) { - $name = $pool_name{$donor}{'hist'}."_HR"; - } else { - $name = $pool_name{$donor}{'hist'}."_HR_$rcvr"; - } - if ( $ciso ne "" ) { - $name = "${ciso}$name"; - } - $longn = 'Het. Resp. from '.$pool_name{$donor}{'long'}; - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved version - &setField( "${name}_vr", $longn, $unitsvr ); - } - if ( $rcvr ne "atm" ) { - # transfer - $name = $pool_name{$donor}{'hist'}. "C_TO_" . - $pool_name{$rcvr}{'hist'}. "C"; - $longn = "decomp of " . $pool_name{$donor}{'long'}. " C to " . - $pool_name{$rcvr}{'long'}. " C"; - if ( $ciso ne "" ) { - $name = "${ciso}$name"; - } - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved version - &setField( "${name}_vr", $longn, $unitsvr ); - } - } - - #-- mineralization/immobilization fluxes (none from CWD) - if ( $donor ne "CWD" ) { - $units = "gN/m^2/s"; - $unitsvr = "gN/m^3/s"; - if ( $rcvr ne "atm" ) { - $name = "SMINN_TO_".$pool_name{$rcvr}{'hist'}. "N_$donor"; - } else { - $name = $pool_name{$donor}{'hist'}. "N_TO_SMINN"; - } - $longn = "mineral N flux for decomp. of " . $pool_name{$donor}{'hist'}; - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved fluxes - &setField( "${name}_vr", $longn, $unitsvr ); - # transfer fluxes - if ( $rcvr ne "atm" ) { - $name = $pool_name{$donor}{'hist'}. "N_TO_" . - $pool_name{$rcvr}{'hist'}. "N"; - $longn = "decomp of " . $pool_name{$donor}{'long'}. " N to " . - $pool_name{$rcvr}{'long'}. " N"; - # vertically integrated fluxes - &setField( $name, $longn, $units ); - # vertically resolved fluxes - &setField( "${name}_vr", $longn, $unitsvr ); - } - # NITRIF_DENITRIF - $name = "SMINN_TO_DENIT_$trans"; - $longn = "denitrification for decomp. of " . $pool_name{$donor}{'long'} . - "to ". $pool_name{$rcvr}{'hist'}; - &setField( $name, $longn, "gN/m^2" ); - # vertically resolved fluxes - &setField( "${name}_vr", $longn, "gN/m^3" ); - } -} - -# -# List the fields in a neatly ordered list -# And Output to an XML file -# -my $outfilename = "$pwd/../../bld/namelist_files/history_fields_clm4_5.xml"; - -my $outfh = IO::File->new($outfilename, '>') or die "** $ProgName - can't open output history Fields XML file: $outfilename\n"; -&XML_Header( $outfh, $outfilename ); -foreach my $name ( sort(keys(%fields)) ) { - my $len; - if ( length($name) > 20 ) { - $len = 40; - } else { - $len = 20; - } - printf( "%-${len}s = %s\n", $name, $fields{$name}{'field'} ); - printf( $outfh "\n\n", - $name, $fields{$name}{'units'}, $fields{$name}{'longn'} ); -} - -&XML_Footer( $outfh ); -close( $outfh ); diff --git a/src/main/glc2lndMod.F90 b/src/main/glc2lndMod.F90 deleted file mode 100644 index c7e4402ac9..0000000000 --- a/src/main/glc2lndMod.F90 +++ /dev/null @@ -1,674 +0,0 @@ -module glc2lndMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle arrays used for exchanging data from glc to clm. - ! - ! !USES: -#include "shr_assert.h" - use decompMod , only : bounds_type - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : maxpatch_glcmec - use clm_varctl , only : iulog, glc_do_dynglacier - use clm_varcon , only : nameg, spval, ispval - use abortutils , only : endrun - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use landunit_varcon, only : istice_mec - use glcBehaviorMod , only : glc_behavior_type - ! - ! !REVISION HISTORY: - ! Created by William Lipscomb, Dec. 2007, based on clm_atmlnd.F90. - ! - ! !PUBLIC TYPES: - implicit none - private - save - - ! glc -> land variables structure - type, public :: glc2lnd_type - - ! ------------------------------------------------------------------------ - ! Public data - ! ------------------------------------------------------------------------ - - ! Where we should do runoff routing that is appropriate for having a dynamic icesheet underneath. - real(r8), pointer :: glc_dyn_runoff_routing_grc (:) => null() - - ! ------------------------------------------------------------------------ - ! Private data - ! ------------------------------------------------------------------------ - - type(glc_behavior_type), pointer, private :: glc_behavior ! reference to the glc_behavior instance - - real(r8), pointer, private :: frac_grc (:,:) => null() - real(r8), pointer, private :: topo_grc (:,:) => null() - real(r8), pointer, private :: hflx_grc (:,:) => null() - - ! Area in which GLC model can accept surface mass balance, received from glc (0-1) - real(r8), pointer, private :: icemask_grc (:) => null() - - ! icemask_coupled_fluxes_grc is like icemask_grc, but the mask only contains icesheet - ! points that potentially send non-zero fluxes to the coupler. i.e., it does not - ! contain icesheets that are diagnostic only, because for those diagnostic ice sheets - ! (which do not send calving fluxes to the coupler), we need to use the non-dynamic - ! form of runoff routing in CLM in order to conserve water properly. - ! - ! (However, note that this measure of "diagnostic-only" does not necessarily - ! correspond to whether CLM is updating its glacier areas there - for example, we - ! could theoretically have an icesheet whose areas are evolving, and CLM is updating - ! its glacier areas to match, but where we're zeroing out the fluxes sent to the - ! coupler, and so we're using the non-dynamic form of runoff routing in CLM.) - real(r8), pointer, private :: icemask_coupled_fluxes_grc (:) => null() - - contains - - ! ------------------------------------------------------------------------ - ! Public routines - ! ------------------------------------------------------------------------ - - procedure, public :: Init - procedure, public :: Clean - - ! In each timestep, these routines should be called in order (though they don't need - ! to be called all at once): - ! - set_glc2lnd_fields - ! - update_glc2lnd_fracs - ! - update_glc2lnd_topo - procedure, public :: set_glc2lnd_fields ! set coupling fields sent from glc to lnd - procedure, public :: update_glc2lnd_fracs ! update subgrid fractions based on input from GLC - procedure, public :: update_glc2lnd_topo ! update topographic heights - - ! For unit testing only: - procedure, public :: for_test_set_glc2lnd_fields_directly ! set glc2lnd fields directly in a unit testing context - - ! ------------------------------------------------------------------------ - ! Private routines - ! ------------------------------------------------------------------------ - - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - ! sanity-check icemask from GLC - procedure, private :: check_glc2lnd_icemask - - ! sanity-check icemask_coupled_fluxes from GLC - procedure, private :: check_glc2lnd_icemask_coupled_fluxes - - ! update glc_dyn_runoff_routing field based on input from GLC - procedure, private :: update_glc2lnd_dyn_runoff_routing - - end type glc2lnd_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, glc_behavior) - - class(glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - type(glc_behavior_type), intent(in), target :: glc_behavior - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - call this%InitCold(bounds, glc_behavior) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize glc variables required by the land - ! - ! !ARGUMENTS: - class (glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg,endg - !------------------------------------------------------------------------ - - begg = bounds%begg; endg = bounds%endg - - allocate(this%frac_grc (begg:endg,0:maxpatch_glcmec)) ; this%frac_grc (:,:) = nan - allocate(this%topo_grc (begg:endg,0:maxpatch_glcmec)) ; this%topo_grc (:,:) = nan - allocate(this%hflx_grc (begg:endg,0:maxpatch_glcmec)) ; this%hflx_grc (:,:) = nan - allocate(this%icemask_grc (begg:endg)) ; this%icemask_grc (:) = nan - allocate(this%icemask_coupled_fluxes_grc (begg:endg)) ; this%icemask_coupled_fluxes_grc (:) = nan - allocate(this%glc_dyn_runoff_routing_grc (begg:endg)) ; this%glc_dyn_runoff_routing_grc (:) = nan - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg, endg - - character(len=*), parameter :: subname = 'InitHistory' - !----------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - this%icemask_grc(begg:endg) = spval - call hist_addfld1d (fname='ICE_MODEL_FRACTION', units='unitless', & - avgflag='A', long_name='Ice sheet model fractional coverage', & - ptr_gcell=this%icemask_grc, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, glc_behavior) - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - class(glc2lnd_type) :: this - type(bounds_type), intent(in) :: bounds - type(glc_behavior_type), intent(in), target :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: begg, endg - - character(len=*), parameter :: subname = 'InitCold' - !----------------------------------------------------------------------- - - begg = bounds%begg - endg = bounds%endg - - this%glc_behavior => glc_behavior - - this%frac_grc(begg:endg, :) = 0.0_r8 - this%topo_grc(begg:endg, :) = 0.0_r8 - this%hflx_grc(begg:endg, :) = 0.0_r8 - - ! When running with a stub glc model, it's important that icemask_grc be initialized - ! to 0 everywhere. With an active glc model, icemask_grc will be updated in the first - ! time step, and it isn't needed before then, so it's safe to initialize it to 0. - ! Since icemask is 0, icemask_coupled_fluxes needs to be 0, too (and the latter is - ! safest in case we aren't coupled to CISM, to ensure that we use the uncoupled form - ! of runoff routing). - this%icemask_grc(begg:endg) = 0.0_r8 - this%icemask_coupled_fluxes_grc(begg:endg) = 0.0_r8 - - call this%update_glc2lnd_dyn_runoff_routing(bounds) - - end subroutine InitCold - - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! - ! !DESCRIPTION: - ! Deallocate memory in this object - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate(this%frac_grc) - deallocate(this%topo_grc) - deallocate(this%hflx_grc) - deallocate(this%icemask_grc) - deallocate(this%icemask_coupled_fluxes_grc) - deallocate(this%glc_dyn_runoff_routing_grc) - - end subroutine Clean - - !----------------------------------------------------------------------- - subroutine set_glc2lnd_fields(this, bounds, glc_present, x2l, & - index_x2l_Sg_ice_covered, index_x2l_Sg_topo, index_x2l_Flgg_hflx, & - index_x2l_Sg_icemask, index_x2l_Sg_icemask_coupled_fluxes) - ! - ! !DESCRIPTION: - ! Set coupling fields sent from glc to lnd - ! - ! If glc_present is true, then the given fields are all assumed to be valid; if - ! glc_present is false, then these fields are ignored. - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - logical , intent(in) :: glc_present ! true if running with a non-stub glc model - real(r8) , intent(in) :: x2l(:, bounds%begg: ) ! driver import state to land model [field, gridcell] - integer , intent(in) :: index_x2l_Sg_ice_covered( 0: ) ! indices of ice-covered field in x2l, for each elevation class - integer , intent(in) :: index_x2l_Sg_topo( 0: ) ! indices of topo field in x2l, for each elevation class - integer , intent(in) :: index_x2l_Flgg_hflx( 0: ) ! indices of heat flux field in x2l, for each elevation class - integer , intent(in) :: index_x2l_Sg_icemask ! index of icemask field in x2l - integer , intent(in) :: index_x2l_Sg_icemask_coupled_fluxes ! index of icemask_coupled_fluxes field in x2l - ! - ! !LOCAL VARIABLES: - integer :: g - integer :: icemec_class - - character(len=*), parameter :: subname = 'set_glc2lnd_fields' - !----------------------------------------------------------------------- - - SHR_ASSERT((ubound(x2l, 2) == bounds%endg), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(index_x2l_Sg_ice_covered) == (/maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(index_x2l_Sg_topo) == (/maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(index_x2l_Flgg_hflx) == (/maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - - if (glc_present) then - do g = bounds%begg, bounds%endg - do icemec_class = 0, maxpatch_glcmec - this%frac_grc(g,icemec_class) = x2l(index_x2l_Sg_ice_covered(icemec_class),g) - this%topo_grc(g,icemec_class) = x2l(index_x2l_Sg_topo(icemec_class),g) - this%hflx_grc(g,icemec_class) = x2l(index_x2l_Flgg_hflx(icemec_class),g) - end do - this%icemask_grc(g) = x2l(index_x2l_Sg_icemask,g) - this%icemask_coupled_fluxes_grc(g) = x2l(index_x2l_Sg_icemask_coupled_fluxes,g) - end do - - call this%check_glc2lnd_icemask(bounds) - call this%check_glc2lnd_icemask_coupled_fluxes(bounds) - call this%update_glc2lnd_dyn_runoff_routing(bounds) - else - if (glc_do_dynglacier) then - call endrun(' ERROR: With glc_present false (e.g., a stub glc model), glc_do_dynglacier must be false '// & - errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine set_glc2lnd_fields - - !----------------------------------------------------------------------- - subroutine for_test_set_glc2lnd_fields_directly(this, bounds, & - topo, icemask) - ! - ! !DESCRIPTION: - ! Set glc2lnd fields directly in a unit testing context - ! - ! This currently only provides a mechanism to set fields that are actually needed in - ! our unit tests. More could be added later. - ! - ! Also: In contrast to the production version (set_glc2lnd_fields), this does NOT - ! currently update glc2lnd_dyn_runoff_routing (because doing so would require having a - ! sensible glc_behavior, which we may not have; and also, we currently don't need this - ! field in a unit testing context). (Note: If we eventually want/need to update - ! glc2lnd_dyn_runoff_routing, and thus need a fully sensible glc_behavior, then we - ! should extract the self-calls at the end of set_glc2lnd_fields - ! (check_glc2lnd_icemask, check_glc2lnd_icemask_coupled_fluxes, - ! update_glc2lnd_dyn_runoff_routing) into a private routine like - ! set_glc2lnd_fields_wrapup, which could be called by both set_glc2lnd_fields and this - ! routine.) - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - real(r8), intent(in), optional :: topo( bounds%begg: , 0: ) ! topographic height [gridcell, elevclass] - real(r8), intent(in), optional :: icemask( bounds%begg: ) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'for_test_set_glc2lnd_fields_directly' - !----------------------------------------------------------------------- - - if (present(topo)) then - SHR_ASSERT_ALL((ubound(topo) == (/bounds%endg, maxpatch_glcmec/)), errMsg(sourcefile, __LINE__)) - this%topo_grc(bounds%begg:bounds%endg, 0:maxpatch_glcmec) = topo(bounds%begg:bounds%endg, 0:maxpatch_glcmec) - end if - - if (present(icemask)) then - SHR_ASSERT_ALL((ubound(icemask) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - this%icemask_grc(bounds%begg:bounds%endg) = icemask(bounds%begg:bounds%endg) - end if - - end subroutine for_test_set_glc2lnd_fields_directly - - !----------------------------------------------------------------------- - subroutine check_glc2lnd_icemask(this, bounds) - ! - ! !DESCRIPTION: - ! Do a sanity check on the icemask received from CISM via coupler. - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'check_glc2lnd_icemask' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - if (this%icemask_grc(g) > 0._r8) then - - ! Ensure that icemask is a subset of has_virtual_columns. This is needed because - ! we allocated memory based on has_virtual_columns, so it is a problem if the - ! ice sheet tries to expand beyond the area defined by has_virtual_columns. - if (.not. this%glc_behavior%has_virtual_columns_grc(g)) then - write(iulog,'(a)') subname//' ERROR: icemask must be a subset of has_virtual_columns.' - write(iulog,'(a)') 'Ensure that the glacier_region_behavior namelist item is set correctly.' - write(iulog,'(a)') '(It should specify "virtual" for the region corresponding to the GLC domain.)' - write(iulog,'(a)') 'If glacier_region_behavior is set correctly, then you can fix this problem' - write(iulog,'(a)') 'by modifying GLACIER_REGION on the surface dataset.' - write(iulog,'(a)') '(Expand the region that corresponds to the GLC domain' - write(iulog,'(a)') '- i.e., the region specified as "virtual" in glacier_region_behavior.)' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - ! Ensure that icemask is a subset of melt_replaced_by_ice. This is needed - ! because we only compute SMB in the region given by melt_replaced_by_ice - ! (according to the logic for building the do_smb filter), and we need SMB - ! everywhere inside the icemask. - if (.not. this%glc_behavior%melt_replaced_by_ice_grc(g)) then - write(iulog,'(a)') subname//' ERROR: icemask must be a subset of melt_replaced_by_ice.' - write(iulog,'(a)') 'Ensure that the glacier_region_melt_behavior namelist item is set correctly.' - write(iulog,'(a)') '(It should specify "replaced_by_ice" for the region corresponding to the GLC domain.)' - write(iulog,'(a)') 'If glacier_region_behavior is set correctly, then you can fix this problem' - write(iulog,'(a)') 'by modifying GLACIER_REGION on the surface dataset.' - write(iulog,'(a)') '(Expand the region that corresponds to the GLC domain' - write(iulog,'(a)') '- i.e., the region specified as "replaced_by_ice" in glacier_region_melt_behavior.)' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end if - end do - - end subroutine check_glc2lnd_icemask - - !----------------------------------------------------------------------- - subroutine check_glc2lnd_icemask_coupled_fluxes(this, bounds) - ! - ! !DESCRIPTION: - ! Do a sanity check on the icemask_coupled_fluxes field received from CISM via coupler. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'check_glc2lnd_icemask_coupled_fluxes' - !----------------------------------------------------------------------- - - do g = bounds%begg, bounds%endg - - ! Ensure that icemask_coupled_fluxes is a subset of icemask. Although there - ! currently is no code in CLM that depends on this relationship, it seems helpful - ! to ensure that this intuitive relationship holds, so that code developed in the - ! future can rely on it. - if (this%icemask_coupled_fluxes_grc(g) > 0._r8 .and. this%icemask_grc(g) == 0._r8) then - write(iulog,*) subname//' ERROR: icemask_coupled_fluxes must be a subset of icemask.' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end do - - end subroutine check_glc2lnd_icemask_coupled_fluxes - - !----------------------------------------------------------------------- - subroutine update_glc2lnd_dyn_runoff_routing(this, bounds) - ! - ! !DESCRIPTION: - ! Update glc_dyn_runoff_routing field based on updated icemask_coupled_fluxes field - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - - character(len=*), parameter :: subname = 'update_glc2lnd_dyn_runoff_routing' - !----------------------------------------------------------------------- - - ! Wherever we have an icesheet that is computing and sending fluxes to the coupler - - ! which particularly means it is computing a calving flux - we will use the - ! "glc_dyn_runoff_routing" scheme, with 0 < glc_dyn_runoff_routing <= 1. - ! In these places, all or part of the snowcap flux goes to CISM rather than the runoff model. - ! In other places - including places where CISM is not running at all, as well as places - ! where CISM is running in diagnostic-only mode and therefore is not sending a calving flux - - ! we have glc_dyn_runoff_routing = 0, and the snowcap flux goes to the runoff model. - ! This is needed to conserve water correctly in the absence of a calving flux. - - do g = bounds%begg, bounds%endg - - ! Set glc_dyn_runoff_routing_grc(g) to a value in the range [0,1]. - ! - ! This value gives the grid cell fraction that is deemed to be coupled to the - ! dynamic ice sheet model. For this fraction of the grid cell, snowcap fluxes are - ! sent to the ice sheet model. The remainder of the grid cell sends snowcap fluxes - ! to the runoff model. - ! - ! Note: The coupler (in prep_glc_mod.F90) assumes that the fraction coupled to the - ! dynamic ice sheet model is min(lfrac, Sg_icemask_l), where lfrac is the - ! "frac" component of fraction_lx, and Sg_icemask_l is obtained by mapping - ! Sg_icemask_g from the glc to the land grid. Here, ldomain%frac is - ! equivalent to lfrac, and this%icemask_grc is equivalent to Sg_icemask_l. - ! However, here we use icemask_coupled_fluxes_grc, so that we route all snow - ! capping to runoff in areas where the ice sheet is not generating calving - ! fluxes. In addition, here we need to divide by lfrac, because the coupler - ! multiplies by it later (and, for example, if lfrac = 0.1 and - ! icemask_coupled_fluxes = 1, we want all snow capping to go to the ice - ! sheet model, not to the runoff model). - ! - ! Note: In regions where CLM overlaps the CISM domain, this%icemask_grc(g) typically - ! is nearly equal to ldomain%frac(g). So an alternative would be to simply set - ! glc_dyn_runoff_routing_grc(g) = icemask_grc(g). - ! The reason to cap glc_dyn_runoff_routing at lfrac is to avoid sending the - ! ice sheet model a greater mass of water (in the form of snowcap fluxes) - ! than is allowed to fall on a CLM grid cell that is part ocean. - - ! TODO(wjs, 2017-05-08) Ideally, we wouldn't have this duplication in logic - ! between the coupler and CLM. The best solution would be to have the coupler - ! itself do the partitioning of the snow capping flux between the ice sheet model - ! and the runoff model. A next-best solution would be to have the coupler send a - ! field to CLM telling it what fraction of snow capping should go to the runoff - ! model in each grid cell. - - if (ldomain%frac(g) == 0._r8) then - ! Avoid divide by 0; note that, in this case, the amount going to runoff isn't - ! important for system-wide conservation, so we could really choose anything we - ! want. - this%glc_dyn_runoff_routing_grc(g) = this%icemask_coupled_fluxes_grc(g) - else - this%glc_dyn_runoff_routing_grc(g) = & - min(ldomain%frac(g), this%icemask_coupled_fluxes_grc(g)) / & - ldomain%frac(g) - end if - - if (this%glc_dyn_runoff_routing_grc(g) > 0.0_r8) then - - ! Ensure that glc_dyn_runoff_routing is a subset of melt_replaced_by_ice. This - ! is needed because glacial melt is only sent to the runoff stream in the region - ! given by melt_replaced_by_ice (because the latter is used to create the do_smb - ! filter, and the do_smb filter controls where glacial melt is computed). - if (.not. this%glc_behavior%melt_replaced_by_ice_grc(g)) then - write(iulog,'(a)') subname//' ERROR: icemask_coupled_fluxes must be a subset of melt_replaced_by_ice.' - write(iulog,'(a)') 'Ensure that the glacier_region_melt_behavior namelist item is set correctly.' - write(iulog,'(a)') '(It should specify "replaced_by_ice" for the region corresponding to the GLC domain.)' - write(iulog,'(a)') 'If glacier_region_behavior is set correctly, then you can fix this problem' - write(iulog,'(a)') 'by modifying GLACIER_REGION on the surface dataset.' - write(iulog,'(a)') '(Expand the region that corresponds to the GLC domain' - write(iulog,'(a)') '- i.e., the region specified as "replaced_by_ice" in glacier_region_melt_behavior.)' - call endrun(decomp_index=g, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - end if - end do - - end subroutine update_glc2lnd_dyn_runoff_routing - - - - !----------------------------------------------------------------------- - subroutine update_glc2lnd_fracs(this, bounds) - ! - ! !DESCRIPTION: - ! Update subgrid fractions based on input from GLC (via the coupler) - ! - ! The weights updated here are some col%wtlunit and lun%wtgcell values - ! - ! If glc_do_dynglacier is false, nothing is changed - ! - ! !USES: - use column_varcon , only : col_itype_to_icemec_class - use subgridWeightsMod , only : set_landunit_weight - ! - ! !ARGUMENTS: - class(glc2lnd_type), intent(in) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: g,c ! indices - real(r8):: area_ice_mec ! area of the ice_mec landunit - integer :: l_ice_mec ! index of the ice_mec landunit - integer :: icemec_class ! current icemec class (1..maxpatch_glcmec) - logical :: frac_assigned(1:maxpatch_glcmec) ! whether this%frac has been assigned for each elevation class - logical :: error ! if an error was found - - character(len=*), parameter :: subname = 'update_glc2lnd_fracs' - !----------------------------------------------------------------------- - - if (glc_do_dynglacier) then - do g = bounds%begg, bounds%endg - ! Values from GLC are only valid within the icemask, so we only update CLM's areas there - if (this%icemask_grc(g) > 0._r8) then - - ! Set total icemec landunit area - area_ice_mec = sum(this%frac_grc(g, 1:maxpatch_glcmec)) - call set_landunit_weight(g, istice_mec, area_ice_mec) - - ! If new landunit area is greater than 0, then update column areas - ! (If new landunit area is 0, col%wtlunit is arbitrary, so we might as well keep the existing values) - if (area_ice_mec > 0) then - ! Determine index of the glc_mec landunit - l_ice_mec = grc%landunit_indices(istice_mec, g) - if (l_ice_mec == ispval) then - write(iulog,*) subname//' ERROR: no ice_mec landunit found within the icemask, for g = ', g - call endrun() - end if - - frac_assigned(1:maxpatch_glcmec) = .false. - do c = lun%coli(l_ice_mec), lun%colf(l_ice_mec) - icemec_class = col_itype_to_icemec_class(col%itype(c)) - col%wtlunit(c) = this%frac_grc(g, icemec_class) / lun%wtgcell(l_ice_mec) - frac_assigned(icemec_class) = .true. - end do - - ! Confirm that all elevation classes that have non-zero area according to - ! this%frac have been assigned to a column in CLM's data structures - error = .false. - do icemec_class = 1, maxpatch_glcmec - if (this%frac_grc(g, icemec_class) > 0._r8 .and. & - .not. frac_assigned(icemec_class)) then - error = .true. - end if - end do - if (error) then - write(iulog,*) subname//' ERROR: at least one glc_mec column has non-zero area from the coupler,' - write(iulog,*) 'but there was no slot in memory for this column; g = ', g - write(iulog,*) 'this%frac_grc(g, 1:maxpatch_glcmec) = ', & - this%frac_grc(g, 1:maxpatch_glcmec) - write(iulog,*) 'frac_assigned(1:maxpatch_glcmec) = ', & - frac_assigned(1:maxpatch_glcmec) - call endrun() - end if ! error - end if ! area_ice_mec > 0 - end if ! this%icemask_grc(g) > 0 - end do ! g - end if ! glc_do_dynglacier - - end subroutine update_glc2lnd_fracs - - !----------------------------------------------------------------------- - subroutine update_glc2lnd_topo(this, bounds, topo_col, needs_downscaling_col) - ! - ! !DESCRIPTION: - ! Update column-level topographic heights based on input from GLC (via the coupler). - ! - ! Also updates the logical array, needs_downscaling_col: Sets this array to true - ! anywhere where topo_col is updated, because these points will need downscaling. - ! (Leaves other array elements in needs_downscaling_col untouched.) - ! - ! If glc_do_dynglacier is false, then both topographic heights and - ! needs_downscaling_col are left unchanged. - ! - ! !USES: - use landunit_varcon , only : istice_mec - use column_varcon , only : col_itype_to_icemec_class - ! - ! !ARGUMENTS: - class(glc2lnd_type) , intent(in) :: this - type(bounds_type) , intent(in) :: bounds ! bounds - real(r8) , intent(inout) :: topo_col( bounds%begc: ) ! topographic height (m) - logical , intent(inout) :: needs_downscaling_col( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: c, l, g ! indices - integer :: icemec_class ! current icemec class (1..maxpatch_glcmec) - - character(len=*), parameter :: subname = 'update_glc2lnd_topo' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(topo_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(needs_downscaling_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - if (glc_do_dynglacier) then - do c = bounds%begc, bounds%endc - l = col%landunit(c) - g = col%gridcell(c) - - ! Values from GLC are only valid within the icemask, so we only update CLM's topo values there - if (this%icemask_grc(g) > 0._r8) then - if (lun%itype(l) == istice_mec) then - icemec_class = col_itype_to_icemec_class(col%itype(c)) - else - ! If not on a glaciated column, assign topography to the bare-land value determined by GLC. - icemec_class = 0 - end if - - ! Note that we do downscaling over all column types. This is for consistency: - ! interpretation of results would be difficult if some non-glacier column types - ! were downscaled but others were not. - ! - ! BUG(wjs, 2016-11-15, bugz 2377) Actually, do not downscale over urban points: - ! this currently isn't allowed because the urban code references some - ! non-downscaled, gridcell-level atmospheric forcings - if (.not. lun%urbpoi(l)) then - topo_col(c) = this%topo_grc(g, icemec_class) - needs_downscaling_col(c) = .true. - end if - end if - end do - end if - - end subroutine update_glc2lnd_topo - -end module glc2lndMod - diff --git a/src/main/glcBehaviorMod.F90 b/src/main/glcBehaviorMod.F90 deleted file mode 100644 index 6240567937..0000000000 --- a/src/main/glcBehaviorMod.F90 +++ /dev/null @@ -1,1077 +0,0 @@ -module glcBehaviorMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Determines a number of aspects of the behavior of glacier_mec classes in each grid - ! cell. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog - use landunit_varcon, only : istice_mec - use clm_instur , only : wt_lunit, wt_glc_mec - use decompMod , only : bounds_type - use filterColMod , only : filter_col_type - use ColumnType , only : col - use PatchType , only : patch - - ! !PUBLIC TYPES: - implicit none - private - save - - type, public :: glc_behavior_type - private - - ! ------------------------------------------------------------------------ - ! Public data - ! ------------------------------------------------------------------------ - - ! If has_virtual_columns_grc(g) is true, then grid cell g has virtual columns for - ! all possible glc_mec columns. - ! - ! For the sake of coupling with CISM, this should only be needed within the icemask, - ! where we need virtual columns for the sake of coupling with CISM. This is needed in - ! order to (1) provide SMB in all elevation classes, in case it is being used with - ! 1-way coupling (or to force a later TG run); (2) even with two-way coupling, - ! provide SMB in the elevation classes above and below existing elevation classes, - ! for the sake of vertical interpolation; (3) provide place-holder columns (which are - ! already spun-up) for dynamic landunits; (4) ensure that all glacier columns are - ! given spun-up initial conditions by init_interp. - ! - ! More details on (4) (echoing the similar comment in subgridWeightsMod): We need all - ! glacier and vegetated points to be active in the icemask region for the sake of - ! init_interp - since we only interpolate onto active points, and we don't know which - ! points will have non-zero area until after initialization (as long as we can't send - ! information from glc to clm in initialization). (If we had an inactive glacier - ! point in the icemask region, according to the weights on the surface dataset, and - ! ran init_interp, this point would keep its cold start initialization values. Then, - ! in the first time step of the run loop, it's possible that this point would become - ! active because, according to glc, there is actually > 0% glacier in that grid - ! cell. We don't do any state / flux adjustments in the first time step after - ! init_interp due to glacier area changes, so this glacier column would remain at its - ! cold start initialization values, which would be a Bad Thing. Ensuring that all - ! glacier points within the icemask are active gets around this problem - as well as - ! having other benefits, as noted above.) - ! - ! However, by making this part of the user-modifiable "glc behavior", we make it easy - ! for the user to add virtual columns, if this is desired for diagnostic - ! purposes. One important reason why this may be desired is to produce coupler - ! history forcings to force a later TG run, with SMB forcings outside the original - ! CISM area. (Also, we cannot use icemask for all purposes, because it isn't known at - ! initialization.) - logical, allocatable, public :: has_virtual_columns_grc(:) - - ! If allow_multiple_columns_grc(g) is true, then grid cell g may have multiple - ! glacier columns, for the different elevation classes. If - ! allow_multiple_columns_grc(g) is false, then grid cell g is guaranteed to have at - ! most one glacier column. - logical, allocatable, public :: allow_multiple_columns_grc(:) - - ! If melt_replaced_by_ice_grc(g) is true, then any glacier ice melt in gridcell g - ! runs off and is replaced by ice. Note that SMB cannot be computed in gridcell g if - ! melt_replaced_by_ice_grc(g) is false, since we can't compute a sensible negative - ! smb in that case. - logical, allocatable, public :: melt_replaced_by_ice_grc(:) - - ! If ice_runoff_melted_grc(g) is true, then ice runoff generated by the - ! CLM physics over glacier columns in gridcell g is melted (generating a negative - ! sensible heat flux) and runs off as liquid. If it is false, then ice runoff is - ! sent to the river model as ice (a crude parameterization of iceberg calving). - logical, allocatable, public :: ice_runoff_melted_grc(:) - - ! ------------------------------------------------------------------------ - ! Private data - ! ------------------------------------------------------------------------ - - ! If collapse_to_atm_topo_grc(g) is true, then grid cell g has at most one glc_mec - ! column, whose topographic height exactly matches the atmosphere's topographic - ! height for that grid cell (so that there is no adjustment of atmospheric - ! forcings). - ! - ! Note that has_virtual_columns_grc(g) is guaranteed to be false if - ! collapse_to_atm_topo_grc(g) is true. - logical, allocatable :: collapse_to_atm_topo_grc(:) - - contains - - ! ------------------------------------------------------------------------ - ! Public routines - ! ------------------------------------------------------------------------ - - procedure, public :: Init ! version of Init meant for production use - procedure, public :: InitFromInputs ! version of Init meant for unit testing (and called by other code in this class) - procedure, public :: InitSetDirectly ! version of Init meant for unit testing - - ! get number of subgrid units in glc_mec landunit on one grid cell - procedure, public :: get_num_glc_mec_subgrid - - ! returns true if memory should be allocated for the given glc_mec column, and its - ! weight on the landunit - procedure, public :: glc_mec_col_exists - - ! returns true if glc_mec columns on the given grid cell have dynamic type (type - ! potentially changing at runtime) - procedure, public :: cols_have_dynamic_type - - ! Sets a column-level logical array to true for any ice_mec column that needs - ! downscaling, false for any ice_mec column that does not need downscaling - procedure, public :: icemec_cols_need_downscaling - - ! Sets a column-level logical array to true for any ice_mec column that has - ! dynamic type, false for any ice_mec column that does not have dynamic type - procedure, public :: cols_have_dynamic_type_array - - ! Sets a patch-level logical array to true for any ice_mec column that has - ! dynamic type, false for any ice_mec column that does not have dynamic type - procedure, public :: patches_have_dynamic_type_array - - ! update the column class types of any glc_mec columns that need to be updated - procedure, public :: update_glc_classes - - ! ------------------------------------------------------------------------ - ! Public routines, for unit tests only - ! ------------------------------------------------------------------------ - - ! get the value of collapse_to_atm_topo at a given grid cell - procedure, public :: get_collapse_to_atm_topo - - ! ------------------------------------------------------------------------ - ! Private routines - ! ------------------------------------------------------------------------ - - procedure, private :: InitAllocate - - ! reads GLACIER_REGION field from surface dataset - procedure, private, nopass :: read_surface_dataset - - ! reads local namelist items - procedure, private, nopass :: read_namelist - - ! returns a column-level filter of ice_mec columns with the collapse_to_atm_topo - ! behavior - procedure, private :: collapse_to_atm_topo_icemec_filterc - - ! update class of glc_mec columns in regions where these are collapsed to a single - ! column, given a filter - procedure, private :: update_collapsed_columns_classes - - end type glc_behavior_type - - ! !PRIVATE MEMBER DATA: - - ! Longest name allowed for glacier_region_behavior, glacier_region_melt_behavior and - ! glacier_region_ice_runoff_behavior - integer, parameter :: max_behavior_name_len = 32 - - ! Smallest and largest allowed values for a glacier region ID - integer, parameter :: min_glacier_region_id = 0 - integer, parameter :: max_glacier_region_id = 10 - - ! Value indicating that a namelist item has not been set - character(len=*), parameter :: behavior_str_unset = 'UNSET' - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine Init(this, begg, endg, NLFilename) - ! - ! !DESCRIPTION: - ! Initialize a glc_behavior_type object. - ! - ! This version of Init is the one intended for production code use. It reads the - ! information it needs from the surface dataset and namelist. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(inout) :: this - integer, intent(in) :: begg ! beginning gridcell index - integer, intent(in) :: endg ! ending gridcell index - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer, allocatable :: glacier_region_map(:) - character(len=max_behavior_name_len) :: glacier_region_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len) :: glacier_region_melt_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len) :: glacier_region_ice_runoff_behavior(min_glacier_region_id:max_glacier_region_id) - - character(len=*), parameter :: subname = 'Init' - !----------------------------------------------------------------------- - - allocate(glacier_region_map(begg:endg)) - call this%read_surface_dataset(begg, endg, glacier_region_map(begg:endg)) - call this%read_namelist(NLFilename, glacier_region_behavior, & - glacier_region_melt_behavior, glacier_region_ice_runoff_behavior) - - call this%InitFromInputs(begg, endg, & - glacier_region_map(begg:endg), glacier_region_behavior, & - glacier_region_melt_behavior, glacier_region_ice_runoff_behavior) - - end subroutine Init - - !----------------------------------------------------------------------- - subroutine InitFromInputs(this, begg, endg, & - glacier_region_map, glacier_region_behavior_str, glacier_region_melt_behavior_str, & - glacier_region_ice_runoff_behavior_str) - ! - ! !DESCRIPTION: - ! Initialize a glc_behavior_type object given a map of glacier region IDs and an - ! array of behavior specifications for each of these IDs. - ! - ! This version should generally only be called directly by tests, but it is also used - ! by the main production Init method. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(inout) :: this - integer, intent(in) :: begg ! beginning gridcell index - integer, intent(in) :: endg ! ending gridcell index - - ! map of glacier region IDs - integer, intent(in) :: glacier_region_map(begg:) - - ! string giving behavior for each glacier region ID - ! allowed values are: - ! - 'multiple': grid cells can potentially have multiple glacier elevation classes, - ! but no virtual columns - ! - 'virtual': grid cells have virtual columns: values are computed for every glacier - ! elevation class, even those with 0 area - ! - 'single_at_atm_topo': glacier landunits in these grid cells have a single column, - ! whose elevation matches the atmosphere's topographic height (so that there is no - ! adjustment due to downscaling) - character(len=*), intent(in) :: glacier_region_behavior_str(min_glacier_region_id:) - - ! string giving treatment of ice melt for each glacier region ID - ! allowed values are: - ! - 'replaced_by_ice' - ! - 'remains_in_place' - character(len=*), intent(in) :: glacier_region_melt_behavior_str(min_glacier_region_id:) - - ! string giving treatment of ice runoff for each glacier region ID - ! allowed values are: - ! - 'remains_ice' - ! - 'melted' - character(len=*), intent(in) :: glacier_region_ice_runoff_behavior_str(min_glacier_region_id:) - - ! - ! !LOCAL VARIABLES: - ! whether each glacier region ID is present in the glacier_region_map - logical :: glacier_region_present(min_glacier_region_id:max_glacier_region_id) - - ! integer codes corresponding to glacier_region_behavior_str - integer :: glacier_region_behavior(min_glacier_region_id:max_glacier_region_id) - - ! integer codes corresponding to glacier_region_melt_behavior_str - integer :: glacier_region_melt_behavior(min_glacier_region_id:max_glacier_region_id) - - ! integer codes corresponding to glacier_region_ice_runoff_behavior_str - integer :: glacier_region_ice_runoff_behavior(min_glacier_region_id:max_glacier_region_id) - - integer :: g - integer :: my_id - integer :: my_behavior - integer :: my_melt_behavior - integer :: my_ice_runoff_behavior - - ! possible glacier_region_behavior codes - integer, parameter :: BEHAVIOR_MULTIPLE = 1 - integer, parameter :: BEHAVIOR_VIRTUAL = 2 - integer, parameter :: BEHAVIOR_SINGLE_AT_ATM_TOPO = 3 - - ! possible glacier_region_melt_behavior codes - integer, parameter :: MELT_BEHAVIOR_REPLACED_BY_ICE = 1 - integer, parameter :: MELT_BEHAVIOR_REMAINS_IN_PLACE = 2 - - ! possible glacier_region_ice_runoff_behavior codes - integer, parameter :: ICE_RUNOFF_BEHAVIOR_REMAINS_ICE = 1 - integer, parameter :: ICE_RUNOFF_BEHAVIOR_MELTED = 2 - - ! value indicating that a behavior code has not been set (for glacier_region_behavior, - ! glacier_region_melt_behavior or glacier_region_ice_runoff_behavior) - integer, parameter :: BEHAVIOR_UNSET = -1 - - character(len=*), parameter :: subname = 'InitFromInputs' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(glacier_region_map) == (/endg/)), errMsg(sourcefile, __LINE__)) - - call check_glacier_region_map - - call determine_region_presence - - call translate_glacier_region_behavior - call translate_glacier_region_melt_behavior - call translate_glacier_region_ice_runoff_behavior - - call this%InitAllocate(begg, endg) - - do g = begg, endg - my_id = glacier_region_map(g) - my_behavior = glacier_region_behavior(my_id) - my_melt_behavior = glacier_region_melt_behavior(my_id) - my_ice_runoff_behavior = glacier_region_ice_runoff_behavior(my_id) - - ! This should only happen due to a programming error, not due to a user input error - SHR_ASSERT(my_behavior /= BEHAVIOR_UNSET, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(my_melt_behavior /= BEHAVIOR_UNSET, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(my_ice_runoff_behavior /= BEHAVIOR_UNSET, errMsg(sourcefile, __LINE__)) - - if (my_behavior == BEHAVIOR_VIRTUAL) then - this%has_virtual_columns_grc(g) = .true. - else - this%has_virtual_columns_grc(g) = .false. - end if - - if (my_melt_behavior == MELT_BEHAVIOR_REMAINS_IN_PLACE) then - this%melt_replaced_by_ice_grc(g) = .false. - else - this%melt_replaced_by_ice_grc(g) = .true. - end if - - if (my_ice_runoff_behavior == ICE_RUNOFF_BEHAVIOR_MELTED) then - this%ice_runoff_melted_grc(g) = .true. - else - this%ice_runoff_melted_grc(g) = .false. - end if - - ! For now, allow_multiple_columns_grc is simply the opposite of - ! collapse_to_atm_topo_grc. However, we maintain the separate - ! allow_multiple_columns_grc so that the public interface can stay the same if we - ! differentiate between the two in the future - e.g., allowing for the possibility - ! of a behavior where we have at most one glacier column, but not forced to the - ! atmosphere's elevation. - if (my_behavior == BEHAVIOR_SINGLE_AT_ATM_TOPO) then - this%collapse_to_atm_topo_grc(g) = .true. - this%allow_multiple_columns_grc(g) = .false. - else - this%collapse_to_atm_topo_grc(g) = .false. - this%allow_multiple_columns_grc(g) = .true. - end if - end do - - contains - subroutine check_glacier_region_map - if (minval(glacier_region_map) < min_glacier_region_id) then - write(iulog,*) subname//' ERROR: Expect GLACIER_REGION to be >= ', min_glacier_region_id - write(iulog,*) 'minval = ', minval(glacier_region_map) - call endrun(msg=' ERROR: GLACIER_REGION smaller than expected'// & - errMsg(sourcefile, __LINE__)) - end if - - if (maxval(glacier_region_map) > max_glacier_region_id) then - write(iulog,*) subname//' ERROR: Max GLACIER_REGION is ', & - maxval(glacier_region_map) - write(iulog,*) 'but max_glacier_region_id is only ', max_glacier_region_id - write(iulog,*) 'Try increasing max_glacier_region_id in ', sourcefile - call endrun(msg=' ERROR: GLACIER_REGION larger than expected'// & - errMsg(sourcefile, __LINE__)) - end if - end subroutine check_glacier_region_map - - subroutine determine_region_presence - integer :: g - integer :: my_id - - glacier_region_present(:) = .false. - do g = begg, endg - my_id = glacier_region_map(g) - glacier_region_present(my_id) = .true. - end do - end subroutine determine_region_presence - - subroutine translate_glacier_region_behavior - integer :: i - - do i = min_glacier_region_id, max_glacier_region_id - glacier_region_behavior(i) = BEHAVIOR_UNSET - - if (glacier_region_present(i)) then - SHR_ASSERT_ALL((ubound(glacier_region_behavior_str) >= (/i/)), errMsg(sourcefile, __LINE__)) - - select case (glacier_region_behavior_str(i)) - case ('multiple') - glacier_region_behavior(i) = BEHAVIOR_MULTIPLE - case ('virtual') - glacier_region_behavior(i) = BEHAVIOR_VIRTUAL - case ('single_at_atm_topo') - glacier_region_behavior(i) = BEHAVIOR_SINGLE_AT_ATM_TOPO - case (behavior_str_unset) - write(iulog,*) ' ERROR: glacier_region_behavior not specified for ID ', i - write(iulog,*) 'You probably need to extend the glacier_region_behavior namelist array' - call endrun(msg=' ERROR: glacier_region_behavior not specified for ID '// & - errMsg(sourcefile, __LINE__)) - case default - write(iulog,*) ' ERROR: Unknown glacier_region_behavior for ID ', i - write(iulog,*) glacier_region_behavior_str(i) - write(iulog,*) 'Allowable values are: multiple, virtual, single_at_atm_topo' - call endrun(msg=' ERROR: Unknown glacier_region_behavior'// & - errMsg(sourcefile, __LINE__)) - end select - - end if - end do - end subroutine translate_glacier_region_behavior - - subroutine translate_glacier_region_melt_behavior - integer :: i - - do i = min_glacier_region_id, max_glacier_region_id - glacier_region_melt_behavior(i) = BEHAVIOR_UNSET - - if (glacier_region_present(i)) then - SHR_ASSERT_ALL((ubound(glacier_region_melt_behavior_str) >= (/i/)), errMsg(sourcefile, __LINE__)) - - select case (glacier_region_melt_behavior_str(i)) - case ('replaced_by_ice') - glacier_region_melt_behavior(i) = MELT_BEHAVIOR_REPLACED_BY_ICE - case ('remains_in_place') - glacier_region_melt_behavior(i) = MELT_BEHAVIOR_REMAINS_IN_PLACE - case (behavior_str_unset) - write(iulog,*) ' ERROR: glacier_region_melt_behavior not specified for ID ', i - write(iulog,*) 'You probably need to extend the glacier_region_melt_behavior namelist array' - call endrun(msg=' ERROR: glacier_region_melt_behavior not specified for ID '// & - errMsg(sourcefile, __LINE__)) - case default - write(iulog,*) ' ERROR: Unknown glacier_region_melt_behavior for ID ', i - write(iulog,*) glacier_region_melt_behavior_str(i) - write(iulog,*) 'Allowable values are: replaced_by_ice, remains_in_place' - call endrun(msg=' ERROR: Unknown glacier_region_melt_behavior'// & - errMsg(sourcefile, __LINE__)) - end select - - end if - end do - end subroutine translate_glacier_region_melt_behavior - - subroutine translate_glacier_region_ice_runoff_behavior - integer :: i - - do i = min_glacier_region_id, max_glacier_region_id - glacier_region_ice_runoff_behavior(i) = BEHAVIOR_UNSET - - if (glacier_region_present(i)) then - SHR_ASSERT_ALL((ubound(glacier_region_ice_runoff_behavior_str) >= (/i/)), errMsg(sourcefile, __LINE__)) - - select case (glacier_region_ice_runoff_behavior_str(i)) - case ('remains_ice') - glacier_region_ice_runoff_behavior(i) = ICE_RUNOFF_BEHAVIOR_REMAINS_ICE - case('melted') - glacier_region_ice_runoff_behavior(i) = ICE_RUNOFF_BEHAVIOR_MELTED - case (behavior_str_unset) - write(iulog,*) ' ERROR: glacier_region_ice_runoff_behavior not specified for ID ', i - write(iulog,*) 'You probably need to extend the glacier_region_ice_runoff_behavior namelist array' - call endrun(msg=' ERROR: glacier_region_ice_runoff_behavior not specified for ID '// & - errMsg(sourcefile, __LINE__)) - case default - write(iulog,*) ' ERROR: Unknown glacier_region_ice_runoff_behavior for ID ', i - write(iulog,*) glacier_region_ice_runoff_behavior_str(i) - write(iulog,*) 'Allowable values are: remains_ice, melted' - call endrun(msg=' ERROR: Unknown glacier_region_ice_runoff_behavior'// & - errMsg(sourcefile, __LINE__)) - end select - end if - end do - end subroutine translate_glacier_region_ice_runoff_behavior - - end subroutine InitFromInputs - - - !----------------------------------------------------------------------- - subroutine InitSetDirectly(this, begg, endg, & - has_virtual_columns, collapse_to_atm_topo) - ! - ! !DESCRIPTION: - ! Initialize a glc_behavior_type object by directly setting has_virtual_columns and - ! collapse_to_atm_topo - ! - ! This version is meant for testing - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(inout) :: this - integer, intent(in) :: begg ! beginning gridcell index - integer, intent(in) :: endg ! ending gridcell index - logical, intent(in) :: has_virtual_columns(begg:) - logical, intent(in) :: collapse_to_atm_topo(begg:) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitForTesting' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(has_virtual_columns) == (/endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(collapse_to_atm_topo) == (/endg/)), errMsg(sourcefile, __LINE__)) - - call this%InitAllocate(begg, endg) - this%has_virtual_columns_grc(:) = has_virtual_columns(:) - this%collapse_to_atm_topo_grc(:) = collapse_to_atm_topo(:) - - end subroutine InitSetDirectly - - - !----------------------------------------------------------------------- - subroutine InitAllocate(this, begg, endg) - ! - ! !DESCRIPTION: - ! Allocate variables in this object - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(inout) :: this - integer, intent(in) :: begg ! beginning gridcell index - integer, intent(in) :: endg ! ending gridcell index - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'InitAllocate' - !----------------------------------------------------------------------- - - allocate(this%has_virtual_columns_grc (begg:endg)); this%has_virtual_columns_grc (:) = .false. - allocate(this%allow_multiple_columns_grc(begg:endg)); this%allow_multiple_columns_grc(:) = .false. - allocate(this%melt_replaced_by_ice_grc(begg:endg)); this%melt_replaced_by_ice_grc(:) = .false. - allocate(this%collapse_to_atm_topo_grc(begg:endg)); this%collapse_to_atm_topo_grc(:) = .false. - allocate(this%ice_runoff_melted_grc(begg:endg)); this%ice_runoff_melted_grc(:) = .false. - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine read_surface_dataset(begg, endg, glacier_region_map) - ! - ! !DESCRIPTION: - ! Reads GLACIER_REGION field from surface dataset, returns it in glacier_region_map - ! - ! !USES: - use clm_varctl , only : fsurdat - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - use spmdMod , only : masterproc - use clm_varcon , only : grlnd - ! - ! !ARGUMENTS: - integer, intent(in) :: begg ! beginning grid cell index - integer, intent(in) :: endg ! ending grid cell index - integer, intent(out) :: glacier_region_map(begg:) - ! - ! !LOCAL VARIABLES: - integer, pointer :: glacier_region_map_ptr(:) ! pointer version needed for ncd_io interface - character(len=256) :: locfn ! local filename - type(file_desc_t) :: ncid ! netcdf id - logical :: readvar - - character(len=*), parameter :: subname = 'read_surface_dataset' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(glacier_region_map) == (/endg/)), errMsg(sourcefile, __LINE__)) - - if (masterproc) then - write(iulog,*) 'Attempting to read GLACIER_REGION...' - end if - call getfil(fsurdat, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - allocate(glacier_region_map_ptr(begg:endg)) - call ncd_io(ncid=ncid, varname='GLACIER_REGION', flag='read', & - data=glacier_region_map_ptr, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun(msg=' ERROR: GLACIER_REGION NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile(ncid) - glacier_region_map(begg:endg) = glacier_region_map_ptr(begg:endg) - deallocate(glacier_region_map_ptr) - - end subroutine read_surface_dataset - - !----------------------------------------------------------------------- - subroutine read_namelist(NLFilename, glacier_region_behavior, & - glacier_region_melt_behavior, glacier_region_ice_runoff_behavior) - ! - ! !DESCRIPTION: - ! Read local namelist items - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use clm_nlUtilsMod , only : find_nlgroup_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - character(len=max_behavior_name_len), intent(out) :: & - glacier_region_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len), intent(out) :: & - glacier_region_melt_behavior(min_glacier_region_id:max_glacier_region_id) - character(len=max_behavior_name_len), intent(out) :: & - glacier_region_ice_runoff_behavior(min_glacier_region_id:max_glacier_region_id) - ! - ! !LOCAL VARIABLES: - integer :: unitn ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - - character(len=*), parameter :: subname = 'read_namelist' - !----------------------------------------------------------------------- - - namelist /clm_glacier_behavior/ & - glacier_region_behavior, glacier_region_melt_behavior, & - glacier_region_ice_runoff_behavior - - ! Initialize options to default values - glacier_region_behavior(:) = behavior_str_unset - glacier_region_melt_behavior(:) = behavior_str_unset - glacier_region_ice_runoff_behavior(:) = behavior_str_unset - - if (masterproc) then - unitn = getavu() - call opnfil(NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, 'clm_glacier_behavior', status=nml_error) - if (nml_error == 0) then - read(unitn, nml=clm_glacier_behavior, iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading clm_glacier_behavior namelist'// & - errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding clm_glacier_behavior namelist'// & - errMsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - endif - - call shr_mpi_bcast(glacier_region_behavior, mpicom) - call shr_mpi_bcast(glacier_region_melt_behavior, mpicom) - call shr_mpi_bcast(glacier_region_ice_runoff_behavior, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'clm_glacier_behavior settings:' - write(iulog,nml=clm_glacier_behavior) - write(iulog,*) ' ' - end if - - end subroutine read_namelist - - - !----------------------------------------------------------------------- - subroutine get_num_glc_mec_subgrid(this, gi, atm_topo, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Get number of subgrid units in glc_mec landunit on one grid cell - ! - ! !USES: - use clm_varpar , only : maxpatch_glcmec - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(in) :: this - integer , intent(in) :: gi ! grid cell index - real(r8), intent(in) :: atm_topo ! atmosphere's topographic height for this grid cell (m) - integer , intent(out) :: npatches ! number of glacier_mec patches in this grid cell - integer , intent(out) :: ncols ! number of glacier_mec columns in this grid cell - integer , intent(out) :: nlunits ! number of glacier_mec landunits in this grid cell - ! - ! !LOCAL VARIABLES: - integer :: m ! loop index - logical :: col_exists - real(r8) :: col_wt_lunit - - character(len=*), parameter :: subname = 'get_num_glc_mec_subgrid' - !----------------------------------------------------------------------- - - ncols = 0 - - do m = 1, maxpatch_glcmec - call this%glc_mec_col_exists(gi = gi, elev_class = m, atm_topo = atm_topo, & - exists = col_exists, col_wt_lunit = col_wt_lunit) - if (col_exists) then - ncols = ncols + 1 - end if - end do - - if (this%collapse_to_atm_topo_grc(gi) .and. & - wt_lunit(gi, istice_mec) > 0.0_r8) then - ! For grid cells with the collapse_to_atm_topo behavior, with a non-zero weight - ! ice_mec landunit, we expect exactly one column - SHR_ASSERT(ncols == 1, errMsg(sourcefile, __LINE__)) - end if - - if (ncols > 0) then - npatches = ncols - nlunits = 1 - else - npatches = 0 - nlunits = 0 - end if - - end subroutine get_num_glc_mec_subgrid - - !----------------------------------------------------------------------- - subroutine glc_mec_col_exists(this, gi, elev_class, atm_topo, exists, col_wt_lunit) - ! - ! !DESCRIPTION: - ! For the given glc_mec column, with elevation class index elev_class, in grid cell - ! gi: sets exists to true if memory should be allocated for this column, and sets - ! col_wt_lunit to the column's weight on the icemec landunit. - ! - ! If exists is false, then col_wt_lunit is arbitrary and should be ignored. - ! - ! !USES: - use glc_elevclass_mod, only : glc_get_elevation_class, GLC_ELEVCLASS_ERR_NONE - use glc_elevclass_mod, only : GLC_ELEVCLASS_ERR_TOO_LOW, GLC_ELEVCLASS_ERR_TOO_HIGH - use glc_elevclass_mod, only : glc_errcode_to_string - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(in) :: this - integer, intent(in) :: gi ! grid cell index - integer, intent(in) :: elev_class ! elevation class index - real(r8), intent(in) :: atm_topo ! atmosphere's topographic height for this grid cell (m) - logical, intent(out) :: exists ! whether memory should be allocated for this column - real(r8), intent(out) :: col_wt_lunit ! column's weight on the icemec landunit - ! - ! !LOCAL VARIABLES: - integer :: atm_elev_class ! elevation class corresponding to atmosphere topographic height - integer :: err_code - - character(len=*), parameter :: subname = 'glc_mec_col_exists' - !----------------------------------------------------------------------- - - ! Set default outputs - exists = .false. - col_wt_lunit = wt_glc_mec(gi, elev_class) - - if (this%collapse_to_atm_topo_grc(gi)) then - if (wt_lunit(gi, istice_mec) > 0.0_r8) then - call glc_get_elevation_class(atm_topo, atm_elev_class, err_code) - if ( err_code == GLC_ELEVCLASS_ERR_NONE .or. & - err_code == GLC_ELEVCLASS_ERR_TOO_LOW .or. & - err_code == GLC_ELEVCLASS_ERR_TOO_HIGH) then - ! These are all acceptable "errors" - it is even okay for these purposes if - ! the elevation is lower than the lower bound of elevation class 1, or - ! higher than the upper bound of the top elevation class. - - ! Do nothing - else - write(iulog,*) subname, ': ERROR getting elevation class for topo = ', atm_topo - write(iulog,*) glc_errcode_to_string(err_code) - call endrun(msg=subname//': ERROR getting elevation class') - end if - - if (elev_class == atm_elev_class) then - exists = .true. - col_wt_lunit = 1._r8 - else - exists = .false. - col_wt_lunit = 0._r8 - end if - end if - - else ! collapse_to_atm_topo_grc .false. - if (this%has_virtual_columns_grc(gi)) then - exists = .true. - else if (wt_lunit(gi, istice_mec) > 0.0_r8 .and. & - wt_glc_mec(gi, elev_class) > 0.0_r8) then - ! If the landunit has non-zero weight on the grid cell, and this column has - ! non-zero weight on the landunit... - exists = .true. - end if - end if - - end subroutine glc_mec_col_exists - - !----------------------------------------------------------------------- - function cols_have_dynamic_type(this, gi) - ! - ! !DESCRIPTION: - ! Returns true if glc_mec columns on the given grid cell have dynamic type (i.e., - ! type potentially changing at runtime) - ! - ! !USES: - ! - ! !ARGUMENTS: - logical :: cols_have_dynamic_type ! function result - class(glc_behavior_type), intent(in) :: this - integer, intent(in) :: gi ! grid cell index - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'cols_have_dynamic_type' - !----------------------------------------------------------------------- - - if (this%collapse_to_atm_topo_grc(gi)) then - cols_have_dynamic_type = .true. - else - cols_have_dynamic_type = .false. - end if - - end function cols_have_dynamic_type - - !----------------------------------------------------------------------- - subroutine icemec_cols_need_downscaling(this, bounds, num_icemecc, filter_icemecc, & - needs_downscaling_col) - ! - ! !DESCRIPTION: - ! Sets needs_downscaling_col to true for any ice_mec column that needs downscaling, - ! false for any ice_mec column that does not need downscaling. - ! - ! Outside of filter_icemecc, leaves needs_downscaling_col untouched. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc_behavior_type) , intent(in) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_icemecc ! number of points in filter_icemecc - integer , intent(in) :: filter_icemecc(:) ! col filter for ice_mec - logical , intent(inout) :: needs_downscaling_col( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: fc - integer :: c - integer :: g - - character(len=*), parameter :: subname = 'icemec_cols_need_downscaling' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(needs_downscaling_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do fc = 1, num_icemecc - c = filter_icemecc(fc) - g = col%gridcell(c) - - if (this%collapse_to_atm_topo_grc(g)) then - needs_downscaling_col(c) = .false. - else - needs_downscaling_col(c) = .true. - end if - end do - - end subroutine icemec_cols_need_downscaling - - !----------------------------------------------------------------------- - subroutine cols_have_dynamic_type_array(this, begc, endc, has_dynamic_type_col) - ! - ! !DESCRIPTION: - ! Sets a column-level logical array to true for any ice_mec column that has - ! dynamic type, false for any ice_mec column that does not have dynamic type. - ! - ! The value is undefined for non-ice_mec columns. - ! - ! !ARGUMENTS: - class(glc_behavior_type) , intent(in) :: this - integer, intent(in) :: begc ! beginning column index - integer, intent(in) :: endc ! ending column index - logical, intent(inout) :: has_dynamic_type_col( begc: ) - ! - ! !LOCAL VARIABLES: - integer :: c - integer :: g - - character(len=*), parameter :: subname = 'cols_have_dynamic_type_array' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(has_dynamic_type_col) == (/endc/)), errMsg(sourcefile, __LINE__)) - - do c = begc, endc - g = col%gridcell(c) - ! Users shouldn't rely on the values set for non-ice_mec columns, but it's simpler - ! just to set this for all column types. - if (this%collapse_to_atm_topo_grc(g)) then - has_dynamic_type_col(c) = .true. - else - has_dynamic_type_col(c) = .false. - end if - end do - - end subroutine cols_have_dynamic_type_array - - !----------------------------------------------------------------------- - subroutine patches_have_dynamic_type_array(this, begp, endp, has_dynamic_type_patch) - ! - ! !DESCRIPTION: - ! Sets a patch-level logical array to true for any ice_mec patch that has - ! dynamic type, false for any ice_mec patch that does not have dynamic type. - ! - ! The value is undefined for non-ice_mec patches. - ! - ! !ARGUMENTS: - class(glc_behavior_type) , intent(in) :: this - integer, intent(in) :: begp ! beginning patch index - integer, intent(in) :: endp ! ending patch index - logical, intent(inout) :: has_dynamic_type_patch( begp: ) - ! - ! !LOCAL VARIABLES: - integer :: p - integer :: g - - character(len=*), parameter :: subname = 'patches_have_dynamic_type_array' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(has_dynamic_type_patch) == (/endp/)), errMsg(sourcefile, __LINE__)) - - do p = begp, endp - g = patch%gridcell(p) - ! Users shouldn't rely on the values set for non-ice_mec patches, but it's simpler - ! just to set this for all patch types. - if (this%collapse_to_atm_topo_grc(g)) then - has_dynamic_type_patch(p) = .true. - else - has_dynamic_type_patch(p) = .false. - end if - end do - - end subroutine patches_have_dynamic_type_array - - !----------------------------------------------------------------------- - subroutine update_glc_classes(this, bounds, topo_col) - ! - ! !DESCRIPTION: - ! Update the column class types of any glc_mec columns that need to be updated. - ! - ! Assumes that topo_col has already been set appropriately. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: topo_col( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - type(filter_col_type) :: collapse_filterc - - character(len=*), parameter :: subname = 'update_glc_classes' - !----------------------------------------------------------------------- - - collapse_filterc = this%collapse_to_atm_topo_icemec_filterc(bounds) - call this%update_collapsed_columns_classes(bounds, collapse_filterc, topo_col) - - end subroutine update_glc_classes - - !----------------------------------------------------------------------- - subroutine update_collapsed_columns_classes(this, bounds, collapse_filterc, topo_col) - ! - ! !DESCRIPTION: - ! Update class of glc_mec columns in regions where these are collapsed to a single - ! column, given a filter. - ! - ! Assumes that topo_col has already been updated appropriately for these columns. - ! - ! !USES: - use glc_elevclass_mod, only : glc_get_elevation_class, GLC_ELEVCLASS_ERR_NONE - use glc_elevclass_mod, only : GLC_ELEVCLASS_ERR_TOO_LOW, GLC_ELEVCLASS_ERR_TOO_HIGH - use glc_elevclass_mod, only : glc_errcode_to_string - use column_varcon , only : icemec_class_to_col_itype - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - type(filter_col_type), intent(in) :: collapse_filterc - real(r8), intent(in) :: topo_col( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: fc ! filter index - integer :: c ! column index - integer :: elev_class ! elevation class of the single column on the ice_mec landunit - integer :: err_code - integer :: new_coltype - - character(len=*), parameter :: subname = 'update_collapsed_columns_classes' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(topo_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do fc = 1, collapse_filterc%num - c = collapse_filterc%indices(fc) - - call glc_get_elevation_class(topo_col(c), elev_class, err_code) - if ( err_code == GLC_ELEVCLASS_ERR_NONE .or. & - err_code == GLC_ELEVCLASS_ERR_TOO_LOW .or. & - err_code == GLC_ELEVCLASS_ERR_TOO_HIGH) then - ! These are all acceptable "errors" - it is even okay for these purposes if - ! the elevation is lower than the lower bound of elevation class 1, or - ! higher than the upper bound of the top elevation class. - - ! Do nothing - else - write(iulog,*) subname, ': ERROR getting elevation class for topo = ', & - topo_col(c) - write(iulog,*) glc_errcode_to_string(err_code) - call endrun(msg=subname//': ERROR getting elevation class') - end if - - new_coltype = icemec_class_to_col_itype(elev_class) - if (new_coltype /= col%itype(c)) then - call col%update_itype(c = c, itype = new_coltype) - end if - end do - - end subroutine update_collapsed_columns_classes - - !----------------------------------------------------------------------- - function collapse_to_atm_topo_icemec_filterc(this, bounds) result(filter) - ! - ! !DESCRIPTION: - ! Returns a column-level filter of ice_mec columns with the collapse_to_atm_topo behavior - ! - ! !USES: - use filterColMod, only : filter_col_type, col_filter_from_grcflags_ltypes - ! - ! !ARGUMENTS: - class(glc_behavior_type), intent(in) :: this - type(filter_col_type) :: filter ! function result - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'collapse_to_atm_topo_icemec_filterc' - !----------------------------------------------------------------------- - - ! Currently this creates the filter on the fly, recreating it every time this - ! function is called. Since this is a static filter, we could just compute it once - ! and save it, returning the already-computed filter when this function is called. - ! However, the problem with that is the need to have a different filter for each - ! clump (and potentially another filter for calls from outside a clump loop). This - ! will become easier to handle if we rework CLM's threading so that there is a - ! separate instance of each object for each clump: in that case, we'll have multiple - ! instances of glc_behavior_type, each corresponding to one clump, each with its own - ! filter. - - filter = col_filter_from_grcflags_ltypes( & - bounds = bounds, & - grcflags = this%collapse_to_atm_topo_grc(bounds%begg:bounds%endg), & - ltypes = [istice_mec], & - include_inactive = .true.) - - end function collapse_to_atm_topo_icemec_filterc - - !----------------------------------------------------------------------- - function get_collapse_to_atm_topo(this, gi) result(collapse_to_atm_topo) - ! - ! !DESCRIPTION: - ! Get the value of collapse_to_atm_topo at a given grid cell - ! - ! This function just exists to support unit testing, and should not be called from - ! production code. - ! - ! !USES: - ! - ! !ARGUMENTS: - logical :: collapse_to_atm_topo ! function result - class(glc_behavior_type), intent(in) :: this - integer, intent(in) :: gi ! grid cell index - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'get_collapse_to_atm_topo' - !----------------------------------------------------------------------- - - collapse_to_atm_topo = this%collapse_to_atm_topo_grc(gi) - - end function get_collapse_to_atm_topo - -end module glcBehaviorMod diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 deleted file mode 100644 index 8899917c5f..0000000000 --- a/src/main/histFileMod.F90 +++ /dev/null @@ -1,5201 +0,0 @@ -module histFileMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing methods to for CLM history file handling. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_flush - use spmdMod , only : masterproc - use abortutils , only : endrun - use clm_varctl , only : iulog, use_vertsoilc, use_fates - use clm_varcon , only : spval, ispval, dzsoi_decomp - use clm_varcon , only : grlnd, nameg, namel, namec, namep, nameCohort - use decompMod , only : get_proc_bounds, get_proc_global, bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use EDTypesMod , only : nclmax - use EDTypesMod , only : nlevleaf - use FatesInterfaceMod , only : nlevsclass, nlevage - use EDTypesMod , only : nfsc, ncwd - use FatesInterfaceMod , only : numpft_ed => numpft - use ncdio_pio - - ! - implicit none - save - private - ! - ! !PUBLIC TYPES: - ! - ! Constants - ! - integer , public, parameter :: max_tapes = 10 ! max number of history tapes - integer , public, parameter :: max_flds = 2500 ! max number of history fields - integer , public, parameter :: max_namlen = 64 ! maximum number of characters for field name - integer , public, parameter :: scale_type_strlen = 32 ! maximum number of characters for scale types - integer , private, parameter :: avgflag_strlen = 3 ! maximum number of characters for avgflag - integer , private, parameter :: hist_dim_name_length = 16 ! lenngth of character strings in dimension names - - ! Possible ways to treat multi-layer snow fields at times when no snow is present in a - ! given layer. Note that the public parameters are the only ones that can be used by - ! calls to hist_addfld2d; the private parameters are just used internally by the - ! histFile implementation. - integer , private, parameter :: no_snow_MIN = 1 ! minimum valid value for this flag - integer , public , parameter :: no_snow_normal = 1 ! normal treatment, which should be used for most fields (use spval when snow layer not present) - integer , public , parameter :: no_snow_zero = 2 ! average in a 0 value for times when the snow layer isn't present - integer , private, parameter :: no_snow_MAX = 2 ! maximum valid value for this flag - integer , private, parameter :: no_snow_unset = no_snow_MIN - 1 ! flag specifying that field is NOT a multi-layer snow field - ! - ! Counters - ! - integer , public :: ntapes = 0 ! index of max history file requested - ! - ! Namelist - ! - integer :: ni ! implicit index below - logical, public :: & - hist_empty_htapes = .false. ! namelist: flag indicates no default history fields - integer, public :: & - hist_ndens(max_tapes) = 2 ! namelist: output density of netcdf history files - integer, public :: & - hist_mfilt(max_tapes) = (/ 1, (30, ni=2, max_tapes)/) ! namelist: number of time samples per tape - logical, public :: & - hist_dov2xy(max_tapes) = (/.true.,(.true.,ni=2,max_tapes)/) ! namelist: true=> do grid averaging - integer, public :: & - hist_nhtfrq(max_tapes) = (/0, (-24, ni=2,max_tapes)/) ! namelist: history write freq(0=monthly) - character(len=avgflag_strlen), public :: & - hist_avgflag_pertape(max_tapes) = (/(' ',ni=1,max_tapes)/) ! namelist: per tape averaging flag - character(len=max_namlen), public :: & - hist_type1d_pertape(max_tapes) = (/(' ',ni=1,max_tapes)/) ! namelist: per tape type1d - - character(len=max_namlen+2), public :: & - fincl(max_flds,max_tapes) ! namelist-equivalence list of fields to add - - character(len=max_namlen+2), public :: & - hist_fincl1(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl2(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl3(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl4(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl5(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl6(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl7(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl8(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl9(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl10(max_flds) = ' ' ! namelist: list of fields to add - - character(len=max_namlen+2), public :: & - fexcl(max_flds,max_tapes) ! namelist-equivalence list of fields to remove - - character(len=max_namlen+2), public :: & - hist_fexcl1(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl2(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl3(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl4(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl5(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl6(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl7(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl8(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl9(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl10(max_flds) = ' ' ! namelist: list of fields to remove - - logical, private :: if_disphist(max_tapes) ! restart, true => save history file - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: hist_addfld1d ! Add a 1d single-level field to the master field list - public :: hist_addfld2d ! Add a 2d multi-level field to the master field list - public :: hist_addfld_decomp ! Add a 2d multi-level field to the master field list - public :: hist_add_subscript ! Add a 2d subscript dimension - public :: hist_printflds ! Print summary of master field list - public :: hist_htapes_build ! Initialize history file handler for initial or continue run - public :: hist_update_hbuf ! Updates history buffer for all fields and tapes - public :: hist_htapes_wrapup ! Write history tape(s) - public :: hist_restart_ncd ! Read/write history file restart data - public :: htapes_fieldlist ! Define the contents of each history file based on namelist - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: is_mapping_upto_subgrid ! Is this field being mapped up to a higher subgrid level? - private :: masterlist_make_active ! Add a field to a history file default "on" list - private :: masterlist_addfld ! Add a field to the master field list - private :: masterlist_change_timeavg ! Override default history tape contents for specific tape - private :: htape_addfld ! Add a field to the active list for a history tape - private :: htape_create ! Define contents of history file t - private :: htape_add_ltype_metadata ! Add global metadata defining landunit types - private :: htape_add_ctype_metadata ! Add global metadata defining column types - private :: htape_add_natpft_metadata ! Add global metadata defining natpft types - private :: htape_add_cft_metadata ! Add global metadata defining cft types - private :: htape_timeconst ! Write time constant values to history tape - private :: htape_timeconst3D ! Write time constant 3D values to primary history tape - private :: hfields_normalize ! Normalize history file fields by number of accumulations - private :: hfields_zero ! Zero out accumulation and hsitory buffers for a tape - private :: hfields_write ! Write a variable to a history tape - private :: hfields_1dinfo ! Define/output 1d subgrid info if appropriate - private :: hist_update_hbuf_field_1d ! Updates history buffer for specific field and tape - private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape - private :: hist_set_snow_field_2d ! Set values in history field dimensioned by levsno - private :: list_index ! Find index of field in exclude list - private :: set_hist_filename ! Determine history dataset filenames - private :: getname ! Retrieve name portion of input "inname" - private :: getflag ! Retrieve flag - private :: pointer_index ! Track data pointer indices - private :: max_nFields ! The max number of fields on any tape - private :: avgflag_valid ! Whether a given avgflag is a valid option - ! - ! !PRIVATE TYPES: - ! Constants - ! - integer, parameter :: max_length_filename = 199 ! max length of a filename. on most linux systems this - ! is 255. But this can't be increased until all hard - ! coded values throughout the i/o stack are updated. - integer, parameter :: max_chars = 199 ! max chars for char variables - integer, parameter :: max_subs = 100 ! max number of subscripts - integer :: num_subs = 0 ! actual number of subscripts - character(len=32) :: subs_name(max_subs) ! name of subscript - integer :: subs_dim(max_subs) ! dimension of subscript - ! - type field_info - character(len=max_namlen) :: name ! field name - character(len=max_chars) :: long_name ! long name - character(len=max_chars) :: units ! units - character(len=hist_dim_name_length) :: type1d ! pointer to first dimension type from data type (nameg, etc) - character(len=hist_dim_name_length) :: type1d_out ! hbuf first dimension type from data type (nameg, etc) - character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","glc_nec","elevclas","subname(n)"] - integer :: beg1d ! on-node 1d clm pointer start index - integer :: end1d ! on-node 1d clm pointer end index - integer :: num1d ! size of clm pointer first dimension (all nodes) - integer :: beg1d_out ! on-node 1d hbuf pointer start index - integer :: end1d_out ! on-node 1d hbuf pointer end index - integer :: num1d_out ! size of hbuf first dimension (all nodes) - integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) - integer :: hpindex ! history pointer index - character(len=scale_type_strlen) :: p2c_scale_type ! scale factor when averaging patch to column - character(len=scale_type_strlen) :: c2l_scale_type ! scale factor when averaging column to landunit - character(len=scale_type_strlen) :: l2g_scale_type ! scale factor when averaging landunit to gridcell - integer :: no_snow_behavior ! for multi-layer snow fields, flag saying how to treat times when a given snow layer is absent - end type field_info - - type master_entry - type (field_info) :: field ! field information - logical :: actflag(max_tapes) ! active/inactive flag - character(len=avgflag_strlen) :: avgflag(max_tapes) ! time averaging flag ("X","A","M","I","SUM") - end type master_entry - - type history_entry - type (field_info) :: field ! field information - character(len=avgflag_strlen) :: avgflag ! time averaging flag - real(r8), pointer :: hbuf(:,:) ! history buffer (dimensions: dim1d x num2d) - integer , pointer :: nacs(:,:) ! accumulation counter (dimensions: dim1d x num2d) - end type history_entry - - type history_tape - integer :: nflds ! number of active fields on tape - integer :: ntimes ! current number of time samples on tape - integer :: mfilt ! maximum number of time samples per tape - integer :: nhtfrq ! number of time samples per tape - integer :: ncprec ! netcdf output precision - logical :: dov2xy ! true => do xy average for all fields - logical :: is_endhist ! true => current time step is end of history interval - real(r8) :: begtime ! time at beginning of history averaging interval - type (history_entry) :: hlist(max_flds) ! array of active history tape entries - end type history_tape - - type clmpoint_rs ! Pointer to real scalar data (1D) - real(r8), pointer :: ptr(:) - end type clmpoint_rs - type clmpoint_ra ! Pointer to real array data (2D) - real(r8), pointer :: ptr(:,:) - end type clmpoint_ra - - ! Pointers into datatype arrays - integer, parameter :: max_mapflds = 2500 ! Maximum number of fields to track - type (clmpoint_rs) :: clmptr_rs(max_mapflds) ! Real scalar data (1D) - type (clmpoint_ra) :: clmptr_ra(max_mapflds) ! Real array data (2D) - ! - ! Master list: an array of master_entry entities - ! - type (master_entry) :: masterlist(max_flds) ! master field list - ! - ! History tape: an array of history_tape entities (only active fields) - ! - type (history_tape) :: tape(max_tapes) ! array history tapes - ! - ! Namelist input - ! - ! Counters - ! - integer :: nfmaster = 0 ! number of fields in master field list - ! - ! Other variables - ! - character(len=max_length_filename) :: locfnh(max_tapes) ! local history file names - character(len=max_length_filename) :: locfnhr(max_tapes) ! local history restart file names - logical :: htapes_defined = .false. ! flag indicates history contents have been defined - ! - ! NetCDF Id's - ! - type(file_desc_t), target :: nfid(max_tapes) ! file ids - type(file_desc_t), target :: ncid_hist(max_tapes) ! file ids for history restart files - integer :: time_dimid ! time dimension id - integer :: hist_interval_dimid ! time bounds dimension id - integer :: strlen_dimid ! string dimension id - ! - ! Time Constant variable names and filename - ! - character(len=max_chars) :: TimeConst3DVars_Filename = ' ' - ! - ! time_period_freq variable - ! - character(len=max_chars) :: time_period_freq = ' ' - - character(len=max_chars) :: TimeConst3DVars = ' ' - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine hist_printflds() - ! - ! !DESCRIPTION: - ! Print summary of master field list. - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer nf - character(len=*),parameter :: subname = 'CLM_hist_printflds' - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) trim(subname),' : number of master fields = ',nfmaster - write(iulog,*)' ******* MASTER FIELD LIST *******' - do nf = 1,nfmaster - write(iulog,9000)nf, masterlist(nf)%field%name, masterlist(nf)%field%units -9000 format (i5,1x,a32,1x,a16) - end do - call shr_sys_flush(iulog) - end if - - end subroutine hist_printflds - - !----------------------------------------------------------------------- - subroutine masterlist_addfld (fname, type1d, type1d_out, & - type2d, num2d, units, avgflag, long_name, hpindex, & - p2c_scale_type, c2l_scale_type, l2g_scale_type, & - no_snow_behavior) - ! - ! !DESCRIPTION: - ! Add a field to the master field list. Put input arguments of - ! field name, units, number of levels, averaging flag, and long name - ! into a type entry in the global master field list (masterlist). - ! - ! The optional argument no_snow_behavior should be given when this is a multi-layer - ! snow field, and should be absent otherwise. It should take on one of the no_snow_* - ! parameters defined above - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type1d ! 1d data type - character(len=*), intent(in) :: type1d_out ! 1d output type - character(len=*), intent(in) :: type2d ! 2d output type - integer , intent(in) :: num2d ! size of second dimension (e.g. number of vertical levels) - character(len=*), intent(in) :: units ! units of field - character(len=*), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - integer , intent(in) :: hpindex ! data type index for history buffer output - character(len=*), intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - integer, intent(in), optional :: no_snow_behavior ! if a multi-layer snow field, behavior to use for absent snow layers - ! - ! !LOCAL VARIABLES: - integer :: n ! loop index - integer :: f ! masterlist index - integer :: numa ! total number of atm cells across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - type(bounds_type) :: bounds - character(len=*),parameter :: subname = 'masterlist_addfld' - !------------------------------------------------------------------------ - - if (.not. avgflag_valid(avgflag, blank_valid=.true.)) then - write(iulog,*) trim(subname),' ERROR: unknown averaging flag=', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Determine bounds - - call get_proc_bounds(bounds) - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump) - - ! Ensure that new field is not all blanks - - if (fname == ' ') then - write(iulog,*) trim(subname),' ERROR: blank field name not allowed' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Ensure that new field name isn't too long - - if (len_trim(fname) > max_namlen ) then - write(iulog,*) trim(subname),' ERROR: field name too long: ', trim(fname) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - ! Ensure that new field doesn't already exist - - do n = 1,nfmaster - if (masterlist(n)%field%name == fname) then - write(iulog,*) trim(subname),' ERROR:', fname, ' already on list' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end do - - ! Increase number of fields on master field list - - nfmaster = nfmaster + 1 - f = nfmaster - - ! Check number of fields in master list against maximum number for master list - - if (nfmaster > max_flds) then - write(iulog,*) trim(subname),' ERROR: too many fields for primary history file ', & - '-- max_flds,nfmaster=', max_flds, nfmaster - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Add field to master list - - masterlist(f)%field%name = fname - masterlist(f)%field%long_name = long_name - masterlist(f)%field%units = units - masterlist(f)%field%type1d = type1d - masterlist(f)%field%type1d_out = type1d_out - masterlist(f)%field%type2d = type2d - masterlist(f)%field%num2d = num2d - masterlist(f)%field%hpindex = hpindex - masterlist(f)%field%p2c_scale_type = p2c_scale_type - masterlist(f)%field%c2l_scale_type = c2l_scale_type - masterlist(f)%field%l2g_scale_type = l2g_scale_type - - select case (type1d) - case (grlnd) - masterlist(f)%field%beg1d = bounds%begg - masterlist(f)%field%end1d = bounds%endg - masterlist(f)%field%num1d = numg - case (nameg) - masterlist(f)%field%beg1d = bounds%begg - masterlist(f)%field%end1d = bounds%endg - masterlist(f)%field%num1d = numg - case (namel) - masterlist(f)%field%beg1d = bounds%begl - masterlist(f)%field%end1d = bounds%endl - masterlist(f)%field%num1d = numl - case (namec) - masterlist(f)%field%beg1d = bounds%begc - masterlist(f)%field%end1d = bounds%endc - masterlist(f)%field%num1d = numc - case (namep) - masterlist(f)%field%beg1d = bounds%begp - masterlist(f)%field%end1d = bounds%endp - masterlist(f)%field%num1d = nump - case default - write(iulog,*) trim(subname),' ERROR: unknown 1d output type= ',type1d - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - if (present(no_snow_behavior)) then - masterlist(f)%field%no_snow_behavior = no_snow_behavior - else - masterlist(f)%field%no_snow_behavior = no_snow_unset - end if - - ! The following two fields are used only in master field list, - ! NOT in the runtime active field list - ! ALL FIELDS IN THE MASTER LIST ARE INITIALIZED WITH THE ACTIVE - ! FLAG SET TO FALSE - - masterlist(f)%avgflag(:) = avgflag - masterlist(f)%actflag(:) = .false. - - end subroutine masterlist_addfld - - !----------------------------------------------------------------------- - subroutine hist_htapes_build () - ! - ! !DESCRIPTION: - ! Initialize history file for initial or continuation run. For example, - ! on an initial run, this routine initializes ``ntapes'' history files. - ! On a restart run, this routine only initializes history files declared - ! beyond what existed on the previous run. Files which already existed on - ! the previous run have already been initialized (i.e. named and opened) - ! in routine restart\_history. Loop over tapes and fields per tape setting - ! appropriate variables and calling appropriate routines - ! - ! !USES: - use clm_time_manager, only: get_prev_time - use clm_varcon , only: secspday - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: i ! index - integer :: ier ! error code - integer :: t, f ! tape, field indices - integer :: day, sec ! day and seconds from base date - character(len=*),parameter :: subname = 'hist_htapes_build' - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) trim(subname),' Initializing clm2 history files' - write(iulog,'(72a1)') ("-",i=1,60) - call shr_sys_flush(iulog) - endif - - ! Define field list information for all history files. - ! Update ntapes to reflect number of active history files - ! Note - branch runs can have additional auxiliary history files - ! declared). - - call htapes_fieldlist() - - ! Determine if gridcell (xy) averaging is done for all fields on tape - - do t=1,ntapes - tape(t)%dov2xy = hist_dov2xy(t) - if (masterproc) then - write(iulog,*)trim(subname),' hist tape = ',t,& - ' written with dov2xy= ',tape(t)%dov2xy - end if - end do - - ! Set number of time samples in each history file and - ! Note - the following entries will be overwritten by history restart - ! Note - with netcdf, only 1 (ncd_double) and 2 (ncd_float) are allowed - - do t=1,ntapes - tape(t)%ntimes = 0 - tape(t)%dov2xy = hist_dov2xy(t) - tape(t)%nhtfrq = hist_nhtfrq(t) - tape(t)%mfilt = hist_mfilt(t) - if (hist_ndens(t) == 1) then - tape(t)%ncprec = ncd_double - else - tape(t)%ncprec = ncd_float - endif - end do - - ! Set time of beginning of current averaging interval - ! First etermine elapased time since reference date - - call get_prev_time(day, sec) - do t=1,ntapes - tape(t)%begtime = day + sec/secspday - end do - - if (masterproc) then - write(iulog,*) trim(subname),' Successfully initialized clm2 history files' - write(iulog,'(72a1)') ("-",i=1,60) - call shr_sys_flush(iulog) - endif - - end subroutine hist_htapes_build - - !----------------------------------------------------------------------- - subroutine masterlist_make_active (name, tape_index, avgflag) - ! - ! !DESCRIPTION: - ! Add a field to the default ``on'' list for a given history file. - ! Also change the default time averaging flag if requested. - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: name ! field name - integer, intent(in) :: tape_index ! history tape index - character(len=*), intent(in), optional :: avgflag ! time averaging flag - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - logical :: found ! flag indicates field found in masterlist - character(len=*),parameter :: subname = 'masterlist_make_active' - !----------------------------------------------------------------------- - - ! Check validity of input arguments - - if (tape_index > max_tapes) then - write(iulog,*) trim(subname),' ERROR: tape index=', tape_index, ' is too big' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (present(avgflag)) then - if (.not. avgflag_valid(avgflag, blank_valid=.true.)) then - write(iulog,*) trim(subname),' ERROR: unknown averaging flag=', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - ! Look through master list for input field name. - ! When found, set active flag for that tape to true. - ! Also reset averaging flag if told to use other than default. - - found = .false. - do f = 1,nfmaster - if (trim(name) == trim(masterlist(f)%field%name)) then - masterlist(f)%actflag(tape_index) = .true. - if (present(avgflag)) then - if (avgflag/= ' ') masterlist(f)%avgflag(tape_index) = avgflag - end if - found = .true. - exit - end if - end do - if (.not. found) then - write(iulog,*) trim(subname),' ERROR: field=', name, ' not found' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine masterlist_make_active - - !----------------------------------------------------------------------- - subroutine masterlist_change_timeavg (t) - ! - ! !DESCRIPTION: - ! Override default history tape contents for a specific tape. - ! Copy the flag into the master field list. - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! history tape index - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - character(len=avgflag_strlen) :: avgflag ! local equiv of hist_avgflag_pertape(t) - character(len=*),parameter :: subname = 'masterlist_change_timeavg' - !----------------------------------------------------------------------- - - avgflag = hist_avgflag_pertape(t) - if (.not. avgflag_valid(avgflag, blank_valid = .false.)) then - write(iulog,*) trim(subname),' ERROR: unknown avgflag=',avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - do f = 1,nfmaster - masterlist(f)%avgflag(t) = avgflag - end do - - end subroutine masterlist_change_timeavg - - !----------------------------------------------------------------------- - subroutine htapes_fieldlist() - ! - ! !DESCRIPTION: - ! Define the contents of each history file based on namelist - ! input for initial or branch run, and restart data if a restart run. - ! Use arrays fincl and fexcl to modify default history tape contents. - ! Then sort the result alphanumerically. - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: t, f ! tape, field indices - integer :: ff ! index into include, exclude and fprec list - character(len=max_namlen) :: name ! field name portion of fincl (i.e. no avgflag separator) - character(len=max_namlen) :: mastername ! name from masterlist field - character(len=avgflag_strlen) :: avgflag ! averaging flag - character(len=1) :: prec_acc ! history buffer precision flag - character(len=1) :: prec_wrt ! history buffer write precision flag - type (history_entry) :: tmp ! temporary used for swapping - character(len=*),parameter :: subname = 'htapes_fieldlist' - !----------------------------------------------------------------------- - - ! Override averaging flag for all fields on a particular tape - ! if namelist input so specifies - - do t=1,max_tapes - if (hist_avgflag_pertape(t) /= ' ') then - call masterlist_change_timeavg (t) - end if - end do - - fincl(:,1) = hist_fincl1(:) - fincl(:,2) = hist_fincl2(:) - fincl(:,3) = hist_fincl3(:) - fincl(:,4) = hist_fincl4(:) - fincl(:,5) = hist_fincl5(:) - fincl(:,6) = hist_fincl6(:) - fincl(:,7) = hist_fincl7(:) - fincl(:,8) = hist_fincl8(:) - fincl(:,9) = hist_fincl9(:) - fincl(:,10) = hist_fincl10(:) - - fexcl(:,1) = hist_fexcl1(:) - fexcl(:,2) = hist_fexcl2(:) - fexcl(:,3) = hist_fexcl3(:) - fexcl(:,4) = hist_fexcl4(:) - fexcl(:,5) = hist_fexcl5(:) - fexcl(:,6) = hist_fexcl6(:) - fexcl(:,7) = hist_fexcl7(:) - fexcl(:,8) = hist_fexcl8(:) - fexcl(:,9) = hist_fexcl9(:) - fexcl(:,10) = hist_fexcl10(:) - - - ! First ensure contents of fincl and fexcl are valid names - - do t = 1,max_tapes - f = 1 - do while (f < max_flds .and. fincl(f,t) /= ' ') - name = getname (fincl(f,t)) - do ff = 1,nfmaster - mastername = masterlist(ff)%field%name - if (name == mastername) exit - end do - if (name /= mastername) then - write(iulog,*) trim(subname),' ERROR: ', trim(name), ' in fincl(', f, ') ',& - 'for history tape ',t,' not found' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - f = f + 1 - end do - - f = 1 - do while (f < max_flds .and. fexcl(f,t) /= ' ') - do ff = 1,nfmaster - mastername = masterlist(ff)%field%name - if (fexcl(f,t) == mastername) exit - end do - if (fexcl(f,t) /= mastername) then - write(iulog,*) trim(subname),' ERROR: ', fexcl(f,t), ' in fexcl(', f, ') ', & - 'for history tape ',t,' not found' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - f = f + 1 - end do - end do - - tape(:)%nflds = 0 - do t = 1,max_tapes - - ! Loop through the masterlist set of field names and determine if any of those - ! are in the FINCL or FEXCL arrays - ! The call to list_index determines the index in the FINCL or FEXCL arrays - ! that the masterlist field corresponds to - ! Add the field to the tape if specified via namelist (FINCL[1-max_tapes]), - ! or if it is on by default and was not excluded via namelist (FEXCL[1-max_tapes]). - - do f = 1,nfmaster - mastername = masterlist(f)%field%name - call list_index (fincl(1,t), mastername, ff) - - if (ff > 0) then - - ! if field is in include list, ff > 0 and htape_addfld - ! will not be called for field - - avgflag = getflag (fincl(ff,t)) - call htape_addfld (t, f, avgflag) - - else if (.not. hist_empty_htapes) then - - ! find index of field in exclude list - - call list_index (fexcl(1,t), mastername, ff) - - ! if field is in exclude list, ff > 0 and htape_addfld - ! will not be called for field - ! if field is not in exclude list, ff =0 and htape_addfld - ! will be called for field (note that htape_addfld will be - ! called below only if field is not in exclude list OR in - ! include list - - if (ff == 0 .and. masterlist(f)%actflag(t)) then - call htape_addfld (t, f, ' ') - end if - - end if - end do - - ! Specification of tape contents now complete. - ! Sort each list of active entries - - do f = tape(t)%nflds-1,1,-1 - do ff = 1,f - if (tape(t)%hlist(ff)%field%name > tape(t)%hlist(ff+1)%field%name) then - - tmp = tape(t)%hlist(ff) - tape(t)%hlist(ff ) = tape(t)%hlist(ff+1) - tape(t)%hlist(ff+1) = tmp - - else if (tape(t)%hlist(ff)%field%name == tape(t)%hlist(ff+1)%field%name) then - - write(iulog,*) trim(subname),' ERROR: Duplicate field ', & - tape(t)%hlist(ff)%field%name, & - 't,ff,name=',t,ff,tape(t)%hlist(ff+1)%field%name - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end if - end do - end do - - if (masterproc) then - if (tape(t)%nflds > 0) then - write(iulog,*) trim(subname),' : Included fields tape ',t,'=',tape(t)%nflds - end if - do f = 1,tape(t)%nflds - write(iulog,*) f,' ',tape(t)%hlist(f)%field%name, & - tape(t)%hlist(f)%field%num2d,' ',tape(t)%hlist(f)%avgflag - end do - call shr_sys_flush(iulog) - end if - end do - - ! Determine total number of active history tapes - - ntapes = 0 - do t = max_tapes,1,-1 - if (tape(t)%nflds > 0) then - ntapes = t - exit - end if - end do - - ! Ensure there are no "holes" in tape specification, i.e. empty tapes. - ! Enabling holes should not be difficult if necessary. - - do t = 1,ntapes - if (tape(t)%nflds == 0) then - write(iulog,*) trim(subname),' ERROR: Tape ',t,' is empty' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end do - - ! Check that the number of history files declared does not exceed - ! the maximum allowed. - - if (ntapes > max_tapes) then - write(iulog,*) trim(subname),' ERROR: Too many history files declared, max_tapes=',max_tapes - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Change 1d output per tape output flag if requested - only for history - ! tapes where 2d xy averaging is not enabled - - do t = 1,ntapes - if (hist_type1d_pertape(t) /= ' ' .and. (.not. hist_dov2xy(t))) then - select case (trim(hist_type1d_pertape(t))) - case ('PFTS','COLS', 'LAND', 'GRID') - if ( masterproc ) & - write(iulog,*)'history tape ',t,' will have 1d output type of ',hist_type1d_pertape(t) - case default - write(iulog,*) trim(subname),' ERROR: unknown namelist type1d per tape=',hist_type1d_pertape(t) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - end if - end do - - if (masterproc) then - write(iulog,*) 'There will be a total of ',ntapes,' history tapes' - do t=1,ntapes - write(iulog,*) - if (hist_nhtfrq(t) == 0) then - write(iulog,*)'History tape ',t,' write frequency is MONTHLY' - else - write(iulog,*)'History tape ',t,' write frequency = ',hist_nhtfrq(t) - endif - if (hist_dov2xy(t)) then - write(iulog,*)'All fields on history tape ',t,' are grid averaged' - else - write(iulog,*)'All fields on history tape ',t,' are not grid averaged' - end if - write(iulog,*)'Number of time samples on history tape ',t,' is ',hist_mfilt(t) - write(iulog,*)'Output precision on history tape ',t,'=',hist_ndens(t) - write(iulog,*) - end do - call shr_sys_flush(iulog) - end if - - ! Set flag indicating h-tape contents are now defined (needed by masterlist_addfld) - - htapes_defined = .true. - - - end subroutine htapes_fieldlist - - !----------------------------------------------------------------------- - logical function is_mapping_upto_subgrid( type1d, type1d_out ) result ( mapping) - ! - ! !DESCRIPTION: - ! - ! Return true if this field will be mapped into a higher subgrid level - ! If false it will be output on it's native grid - ! - ! !ARGUMENTS: - implicit none - character(len=8), intent(in) :: type1d ! clm pointer 1d type - character(len=8), intent(in) :: type1d_out ! history buffer 1d type - ! - mapping = .false. - if (type1d_out == nameg .or. type1d_out == grlnd) then - if (type1d == namep) then - mapping = .true. - else if (type1d == namec) then - mapping = .true. - else if (type1d == namel) then - mapping = .true. - end if - else if (type1d_out == namel ) then - if (type1d == namep) then - mapping = .true. - else if (type1d == namec) then - mapping = .true. - end if - else if (type1d_out == namec ) then - if (type1d == namep) then - mapping = .true. - end if - end if - end function is_mapping_upto_subgrid - - !----------------------------------------------------------------------- - subroutine htape_addfld (t, f, avgflag) - ! - ! !DESCRIPTION: - ! Add a field to the active list for a history tape. Copy the data from - ! the master field list to the active list for the tape. - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! history tape index - integer, intent(in) :: f ! field index from master field list - character(len=*), intent(in) :: avgflag ! time averaging flag - ! - ! !LOCAL VARIABLES: - integer :: n ! field index on defined tape - character(len=hist_dim_name_length) :: type1d ! clm pointer 1d type - character(len=hist_dim_name_length) :: type1d_out ! history buffer 1d type - integer :: numa ! total number of atm cells across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: num2d ! size of second dimension (e.g. .number of vertical levels) - integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices - integer :: beg1d,end1d ! beginning and ending indices for this field (assume already set) - integer :: num1d_out ! history output 1d size - type(bounds_type) :: bounds - character(len=*),parameter :: subname = 'htape_addfld' - !----------------------------------------------------------------------- - - ! Ensure that it is not to late to add a field to the history tape - - if (htapes_defined) then - write(iulog,*) trim(subname),' ERROR: attempt to add field ', & - masterlist(f)%field%name, ' after history files are set' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - tape(t)%nflds = tape(t)%nflds + 1 - n = tape(t)%nflds - - ! Copy field information - - tape(t)%hlist(n)%field = masterlist(f)%field - - ! Determine bounds - - call get_proc_bounds(bounds) - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump) - - ! Modify type1d_out if necessary - - if (hist_dov2xy(t)) then - - ! If xy output averaging is requested, set output 1d type to grlnd - ! ***NOTE- the following logic is what permits non lat/lon grids to - ! be written to clm history file - - type1d = tape(t)%hlist(n)%field%type1d - - if (type1d == nameg .or. & - type1d == namel .or. & - type1d == namec .or. & - type1d == namep) then - tape(t)%hlist(n)%field%type1d_out = grlnd - end if - if (type1d == grlnd) then - tape(t)%hlist(n)%field%type1d_out = grlnd - end if - - else if (hist_type1d_pertape(t) /= ' ') then - - ! Set output 1d type based on namelist setting of hist_type1d_pertape - ! Only applies to tapes when xy output is not required - - type1d = tape(t)%hlist(n)%field%type1d - - select case (trim(hist_type1d_pertape(t))) - case('GRID') - tape(t)%hlist(n)%field%type1d_out = nameg - case('LAND') - tape(t)%hlist(n)%field%type1d_out = namel - case('COLS') - tape(t)%hlist(n)%field%type1d_out = namec - case ('PFTS') - tape(t)%hlist(n)%field%type1d_out = namep - case default - write(iulog,*) trim(subname),' ERROR: unknown input hist_type1d_pertape= ', hist_type1d_pertape(t) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - endif - - ! Determine output 1d dimensions - - type1d_out = tape(t)%hlist(n)%field%type1d_out - if (type1d_out == grlnd) then - beg1d_out = bounds%begg - end1d_out = bounds%endg - num1d_out = numg - else if (type1d_out == nameg) then - beg1d_out = bounds%begg - end1d_out = bounds%endg - num1d_out = numg - else if (type1d_out == namel) then - beg1d_out = bounds%begl - end1d_out = bounds%endl - num1d_out = numl - else if (type1d_out == namec) then - beg1d_out = bounds%begc - end1d_out = bounds%endc - num1d_out = numc - else if (type1d_out == namep) then - beg1d_out = bounds%begp - end1d_out = bounds%endp - num1d_out = nump - else - write(iulog,*) trim(subname),' ERROR: incorrect value of type1d_out= ',type1d_out - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Output bounds for the field - tape(t)%hlist(n)%field%beg1d_out = beg1d_out - tape(t)%hlist(n)%field%end1d_out = end1d_out - tape(t)%hlist(n)%field%num1d_out = num1d_out - - ! Fields native bounds - beg1d = masterlist(f)%field%beg1d - end1d = masterlist(f)%field%end1d - - ! Alloccate and initialize history buffer and related info - - num2d = tape(t)%hlist(n)%field%num2d - if ( is_mapping_upto_subgrid( type1d, type1d_out ) ) then - allocate (tape(t)%hlist(n)%hbuf(beg1d_out:end1d_out,num2d)) - allocate (tape(t)%hlist(n)%nacs(beg1d_out:end1d_out,num2d)) - else - allocate (tape(t)%hlist(n)%hbuf(beg1d:end1d,num2d)) - allocate (tape(t)%hlist(n)%nacs(beg1d:end1d,num2d)) - end if - tape(t)%hlist(n)%hbuf(:,:) = 0._r8 - tape(t)%hlist(n)%nacs(:,:) = 0 - - ! Set time averaging flag based on masterlist setting or - ! override the default averaging flag with namelist setting - - if (.not. avgflag_valid(avgflag, blank_valid=.true.)) then - write(iulog,*) trim(subname),' ERROR: unknown avgflag=', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (avgflag == ' ') then - tape(t)%hlist(n)%avgflag = masterlist(f)%avgflag(t) - else - tape(t)%hlist(n)%avgflag = avgflag - end if - - end subroutine htape_addfld - - !----------------------------------------------------------------------- - subroutine hist_update_hbuf(bounds) - ! - ! !DESCRIPTION: - ! Accumulate (or take min, max, etc. as appropriate) input field - ! into its history buffer for appropriate tapes. - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: t ! tape index - integer :: f ! field index - integer :: num2d ! size of second dimension (e.g. number of vertical levels) - character(len=*),parameter :: subname = 'hist_update_hbuf' - character(len=hist_dim_name_length) :: type2d ! hbuf second dimension type ["levgrnd","levlak","numrad","ltype","natpft","cft","glc_nec","elevclas","subname(n)"] - !----------------------------------------------------------------------- - - do t = 1,ntapes -!$OMP PARALLEL DO PRIVATE (f, num2d) - do f = 1,tape(t)%nflds - num2d = tape(t)%hlist(f)%field%num2d - if ( num2d == 1) then - call hist_update_hbuf_field_1d (t, f, bounds) - else - call hist_update_hbuf_field_2d (t, f, bounds, num2d) - end if - end do -!$OMP END PARALLEL DO - end do - - end subroutine hist_update_hbuf - - !----------------------------------------------------------------------- - subroutine hist_update_hbuf_field_1d (t, f, bounds) - ! - ! !DESCRIPTION: - ! Accumulate (or take min, max, etc. as appropriate) input field - ! into its history buffer for appropriate tapes. - ! - ! This canNOT be called from within a threaded region (see comment below regarding the - ! call to p2g, and the lack of explicit bounds on its arguments; see also bug 1786) - ! - ! !USES: - use subgridAveMod , only : p2g, c2g, l2g, p2l, c2l, p2c - use decompMod , only : BOUNDS_LEVEL_PROC - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: hpindex ! history pointer index - integer :: k ! gridcell, landunit, column or patch index - integer :: beg1d,end1d ! beginning and ending indices - integer :: beg1d_out,end1d_out ! beginning and ending indices on output grid - logical :: check_active ! true => check 'active' flag of each point (this refers to a point being active, NOT a history field being active) - logical :: valid ! true => history operation is valid - logical :: map2gcell ! true => map clm pointer field to gridcell - character(len=hist_dim_name_length) :: type1d ! 1d clm pointerr type ["gridcell","landunit","column","pft"] - character(len=hist_dim_name_length) :: type1d_out ! 1d history buffer type ["gridcell","landunit","column","pft"] - character(len=avgflag_strlen) :: avgflag ! time averaging flag - character(len=scale_type_strlen) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=scale_type_strlen) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=scale_type_strlen) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - real(r8), pointer :: hbuf(:,:) ! history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - real(r8), pointer :: field(:) ! clm 1d pointer field - logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) (this refers to a point being active, NOT a history field being active) - real(r8), allocatable :: field_gcell(:) ! gricell level field (used if mapping to gridcell is done) - integer j - character(len=*),parameter :: subname = 'hist_update_hbuf_field_1d' - integer k_offset ! offset for mapping sliced subarray pointers when outputting variables in PFT/col vector form - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, errMsg(sourcefile, __LINE__)) - - avgflag = tape(t)%hlist(f)%avgflag - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - type1d = tape(t)%hlist(f)%field%type1d - type1d_out = tape(t)%hlist(f)%field%type1d_out - p2c_scale_type = tape(t)%hlist(f)%field%p2c_scale_type - c2l_scale_type = tape(t)%hlist(f)%field%c2l_scale_type - l2g_scale_type = tape(t)%hlist(f)%field%l2g_scale_type - hpindex = tape(t)%hlist(f)%field%hpindex - field => clmptr_rs(hpindex)%ptr - - ! set variables to check weights when allocate all pfts - - map2gcell = .false. - if (type1d_out == nameg .or. type1d_out == grlnd) then - SHR_ASSERT(beg1d_out == bounds%begg, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(end1d_out == bounds%endg, errMsg(sourcefile, __LINE__)) - if (type1d == namep) then - ! In this and the following calls, we do NOT explicitly subset field using - ! bounds (e.g., we do NOT do field(bounds%begp:bounds%endp). This is because, - ! for some fields, the lower bound has been reset to 1 due to taking a pointer - ! to an array slice. Thus, this code will NOT work properly if done within a - ! threaded region! (See also bug 1786) - allocate( field_gcell(beg1d_out:end1d_out) ) - call p2g(bounds, & - field, & - field_gcell(bounds%begg:bounds%endg), & - p2c_scale_type, c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namec) then - allocate( field_gcell(beg1d_out:end1d_out) ) - call c2g(bounds, & - field, & - field_gcell(bounds%begg:bounds%endg), & - c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namel) then - allocate( field_gcell(beg1d_out:end1d_out) ) - call l2g(bounds, & - field, & - field_gcell(bounds%begg:bounds%endg), & - l2g_scale_type) - map2gcell = .true. - end if - end if - if (type1d_out == namel ) then - SHR_ASSERT(beg1d_out == bounds%begl, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(end1d_out == bounds%endl, errMsg(sourcefile, __LINE__)) - if (type1d == namep) then - ! In this and the following calls, we do NOT explicitly subset field using - ! bounds (e.g., we do NOT do field(bounds%begp:bounds%endp). This is because, - ! for some fields, the lower bound has been reset to 1 due to taking a pointer - ! to an array slice. Thus, this code will NOT work properly if done within a - ! threaded region! (See also bug 1786) - allocate( field_gcell(beg1d_out:end1d_out) ) - call p2l(bounds, & - field, & - field_gcell(beg1d_out:end1d_out), & - p2c_scale_type, c2l_scale_type) - map2gcell = .true. - else if (type1d == namec) then - allocate( field_gcell(beg1d_out:end1d_out) ) - call c2l(bounds, & - field, & - field_gcell(beg1d_out:end1d_out), & - c2l_scale_type) - map2gcell = .true. - end if - end if - if (type1d_out == namec ) then - SHR_ASSERT(beg1d_out == bounds%begc, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(end1d_out == bounds%endc, errMsg(sourcefile, __LINE__)) - if (type1d == namep) then - ! In this and the following calls, we do NOT explicitly subset field using - ! bounds (e.g., we do NOT do field(bounds%begp:bounds%endp). This is because, - ! for some fields, the lower bound has been reset to 1 due to taking a pointer - ! to an array slice. Thus, this code will NOT work properly if done within a - ! threaded region! (See also bug 1786) - allocate( field_gcell(beg1d_out:end1d_out) ) - call p2c(bounds, & - field, & - field_gcell(beg1d_out:end1d_out), & - p2c_scale_type) - map2gcell = .true. - end if - end if - if ( map2gcell .and. .not. is_mapping_upto_subgrid(type1d, type1d_out) )then - call endrun(msg=trim(subname)//' ERROR: mapping upto subgrid level is inconsistent'//errMsg(sourcefile, __LINE__)) - end if - if ( .not. map2gcell .and. is_mapping_upto_subgrid(type1d, type1d_out) )then - call endrun(msg=trim(subname)//' ERROR: mapping upto subgrid level is inconsistent'//errMsg(sourcefile, __LINE__)) - end if - - if (map2gcell) then ! Map to gridcell - - ! note that in this case beg1d = begg and end1d=endg - select case (avgflag) - case ('I') ! Instantaneous - do k = beg1d_out, end1d_out - if (field_gcell(k) /= spval) then - hbuf(k,1) = field_gcell(k) - else - hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case ('A', 'SUM') ! Time average / sum - do k = beg1d_out, end1d_out - if (field_gcell(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = 0._r8 - hbuf(k,1) = hbuf(k,1) + field_gcell(k) - nacs(k,1) = nacs(k,1) + 1 - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - end do - case ('X') ! Maximum over time - do k = beg1d_out, end1d_out - if (field_gcell(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = -1.e50_r8 - hbuf(k,1) = max( hbuf(k,1), field_gcell(k) ) - else - hbuf(k,1) = spval - endif - nacs(k,1) = 1 - end do - case ('M') ! Minimum over time - do k = beg1d_out, end1d_out - if (field_gcell(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = +1.e50_r8 - hbuf(k,1) = min( hbuf(k,1), field_gcell(k) ) - else - hbuf(k,1) = spval - endif - nacs(k,1) = 1 - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - deallocate( field_gcell ) - - else ! Do not map to gridcell - - ! For data defined on the pft, col or landunit, we need to check if a point is active - ! to determine whether that point should be assigned spval - if (type1d == namep) then - check_active = .true. - active => patch%active - else if (type1d == namec) then - check_active = .true. - active => col%active - else if (type1d == namel) then - check_active = .true. - active =>lun%active - else - check_active = .false. - end if - - select case (avgflag) - case ('I') ! Instantaneous - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - hbuf(k,1) = field(k) - else - hbuf(k,1) = spval - end if - else - hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case ('A', 'SUM') ! Time average / sum - ! create mappings for array slice pointers (which go from 1 to size(field) rather than beg1d to end1d) - if ( end1d .eq. ubound(field,1) ) then - k_offset = 0 - else - k_offset = 1 - beg1d - endif - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k+k_offset) /= spval) then ! add k_offset - if (nacs(k,1) == 0) hbuf(k,1) = 0._r8 - hbuf(k,1) = hbuf(k,1) + field(k+k_offset) ! add k_offset - nacs(k,1) = nacs(k,1) + 1 - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - end do - case ('X') ! Maximum over time - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = -1.e50_r8 - hbuf(k,1) = max( hbuf(k,1), field(k) ) - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case ('M') ! Minimum over time - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = +1.e50_r8 - hbuf(k,1) = min( hbuf(k,1), field(k) ) - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - end if - - end subroutine hist_update_hbuf_field_1d - - !----------------------------------------------------------------------- - subroutine hist_update_hbuf_field_2d (t, f, bounds, num2d) - ! - ! !DESCRIPTION: - ! Accumulate (or take min, max, etc. as appropriate) input field - ! into its history buffer for appropriate tapes. - ! - ! This canNOT be called from within a threaded region (see comment below regarding the - ! call to p2g, and the lack of explicit bounds on its arguments; see also bug 1786) - ! - ! !USES: - use subgridAveMod , only : p2g, c2g, l2g, p2l, c2l, p2c - use decompMod , only : BOUNDS_LEVEL_PROC - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - integer, intent(in) :: f ! field index - type(bounds_type), intent(in) :: bounds - integer, intent(in) :: num2d ! size of second dimension - ! - ! !LOCAL VARIABLES: - integer :: hpindex ! history pointer index - integer :: k ! gridcell, landunit, column or patch index - integer :: j ! level index - integer :: beg1d,end1d ! beginning and ending indices - integer :: beg1d_out,end1d_out ! beginning and ending indices for output level - logical :: check_active ! true => check 'active' flag of each point (this refers to a point being active, NOT a history field being active) - logical :: valid ! true => history operation is valid - logical :: map2gcell ! true => map clm pointer field to gridcell - character(len=hist_dim_name_length) :: type1d ! 1d clm pointerr type ["gridcell","landunit","column","pft"] - character(len=hist_dim_name_length) :: type1d_out ! 1d history buffer type ["gridcell","landunit","column","pft"] - character(len=avgflag_strlen) :: avgflag ! time averaging flag - character(len=scale_type_strlen) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=scale_type_strlen) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=scale_type_strlen) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - integer :: no_snow_behavior ! for multi-layer snow fields, behavior to use when a given layer is absent - real(r8), pointer :: hbuf(:,:) ! history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - real(r8), pointer :: field(:,:) ! clm 2d pointer field - logical :: field_allocated! whether 'field' was allocated here - logical , pointer :: active(:) ! flag saying whether each point is active (used for type1d = landunit/column/pft) - !(this refers to a point being active, NOT a history field being active) - real(r8), allocatable :: field_gcell(:,:) ! gridcell level field (used if mapping to gridcell is done) - character(len=*),parameter :: subname = 'hist_update_hbuf_field_2d' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, errMsg(sourcefile, __LINE__)) - - avgflag = tape(t)%hlist(f)%avgflag - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - type1d = tape(t)%hlist(f)%field%type1d - type1d_out = tape(t)%hlist(f)%field%type1d_out - p2c_scale_type = tape(t)%hlist(f)%field%p2c_scale_type - c2l_scale_type = tape(t)%hlist(f)%field%c2l_scale_type - l2g_scale_type = tape(t)%hlist(f)%field%l2g_scale_type - no_snow_behavior = tape(t)%hlist(f)%field%no_snow_behavior - hpindex = tape(t)%hlist(f)%field%hpindex - - if (no_snow_behavior /= no_snow_unset) then - ! For multi-layer snow fields, build a special output variable that handles - ! missing snow layers appropriately - - ! Note, regarding bug 1786: The following allocation is not what we would want if - ! this routine were operating in a threaded region (or, more generally, within a - ! loop over nclumps) - in that case we would want to use the bounds information for - ! this clump. But currently that's not possible because the bounds of some fields - ! have been reset to 1 - see also bug 1786. Similarly, if we wanted to allow - ! operation within a loop over clumps, we would need to pass 'bounds' to - ! hist_set_snow_field_2d rather than relying on beg1d & end1d (which give the proc, - ! bounds not the clump bounds) - - allocate(field(lbound(clmptr_ra(hpindex)%ptr, 1) : ubound(clmptr_ra(hpindex)%ptr, 1), 1:num2d)) - field_allocated = .true. - - call hist_set_snow_field_2d(field, clmptr_ra(hpindex)%ptr, no_snow_behavior, type1d, & - beg1d, end1d) - else - field => clmptr_ra(hpindex)%ptr(:,1:num2d) - field_allocated = .false. - end if - - ! set variables to check weights when allocate all pfts - - map2gcell = .false. - if (type1d_out == nameg .or. type1d_out == grlnd) then - SHR_ASSERT(beg1d_out == bounds%begg, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(end1d_out == bounds%endg, errMsg(sourcefile, __LINE__)) - if (type1d == namep) then - ! In this and the following calls, we do NOT explicitly subset field using - ! (e.g., we do NOT do field(bounds%begp:bounds%endp). This is because, - ! for some fields, the lower bound has been reset to 1 due to taking a pointer - ! to an array slice. Thus, this code will NOT work properly if done within a - ! threaded region! (See also bug 1786) - allocate(field_gcell(bounds%begg:bounds%endg,num2d) ) - call p2g(bounds, num2d, & - field, & - field_gcell(bounds%begg:bounds%endg, :), & - p2c_scale_type, c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namec) then - allocate(field_gcell(bounds%begg:bounds%endg,num2d) ) - call c2g(bounds, num2d, & - field, & - field_gcell(bounds%begg:bounds%endg, :), & - c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namel) then - allocate(field_gcell(bounds%begg:bounds%endg,num2d) ) - call l2g(bounds, num2d, & - field, & - field_gcell(bounds%begg:bounds%endg, :), & - l2g_scale_type) - map2gcell = .true. - end if - else if ( type1d_out == namel )then - SHR_ASSERT(beg1d_out == bounds%begl, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(end1d_out == bounds%endl, errMsg(sourcefile, __LINE__)) - if (type1d == namep) then - ! In this and the following calls, we do NOT explicitly subset field using - ! (e.g., we do NOT do field(bounds%begp:bounds%endp). This is because, - ! for some fields, the lower bound has been reset to 1 due to taking a pointer - ! to an array slice. Thus, this code will NOT work properly if done within a - ! threaded region! (See also bug 1786) - allocate(field_gcell(beg1d_out:end1d_out,num2d)) - call p2l(bounds, num2d, & - field, & - field_gcell(beg1d_out:end1d_out, :), & - p2c_scale_type, c2l_scale_type) - map2gcell = .true. - else if (type1d == namec) then - allocate(field_gcell(beg1d_out:end1d_out,num2d)) - call c2l(bounds, num2d, & - field, & - field_gcell(beg1d_out:end1d_out, :), & - c2l_scale_type) - map2gcell = .true. - end if - else if ( type1d_out == namec )then - SHR_ASSERT(beg1d_out == bounds%begc, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(end1d_out == bounds%endc, errMsg(sourcefile, __LINE__)) - if (type1d == namep) then - ! In this and the following calls, we do NOT explicitly subset field using - ! (e.g., we do NOT do field(bounds%begp:bounds%endp). This is because, - ! for some fields, the lower bound has been reset to 1 due to taking a pointer - ! to an array slice. Thus, this code will NOT work properly if done within a - ! threaded region! (See also bug 1786) - allocate(field_gcell(beg1d_out:end1d_out,num2d)) - call p2c(bounds, num2d, & - field, & - field_gcell(beg1d_out:end1d_out, :), & - p2c_scale_type) - map2gcell = .true. - end if - end if - if ( map2gcell .and. .not. is_mapping_upto_subgrid(type1d, type1d_out) )then - call endrun(msg=trim(subname)//' ERROR: mapping upto subgrid level is inconsistent'//errMsg(sourcefile, __LINE__)) - end if - if ( .not. map2gcell .and. is_mapping_upto_subgrid(type1d, type1d_out) )then - call endrun(msg=trim(subname)//' ERROR: mapping upto subgrid level is inconsistent'//errMsg(sourcefile, __LINE__)) - end if - - if (map2gcell) then ! Map to gridcell - - ! note that in this case beg1d = begg and end1d=endg - select case (avgflag) - case ('I') ! Instantaneous - do j = 1,num2d - do k = beg1d_out, end1d_out - if (field_gcell(k,j) /= spval) then - hbuf(k,j) = field_gcell(k,j) - else - hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case ('A', 'SUM') ! Time average / sum - do j = 1,num2d - do k = beg1d_out, end1d_out - if (field_gcell(k,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = 0._r8 - hbuf(k,j) = hbuf(k,j) + field_gcell(k,j) - nacs(k,j) = nacs(k,j) + 1 - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - endif - end do - end do - case ('X') ! Maximum over time - do j = 1,num2d - do k = beg1d_out, end1d_out - if (field_gcell(k,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = -1.e50_r8 - hbuf(k,j) = max( hbuf(k,j), field_gcell(k,j) ) - else - hbuf(k,j) = spval - endif - nacs(k,j) = 1 - end do - end do - case ('M') ! Minimum over time - do j = 1,num2d - do k = beg1d_out, end1d_out - if (field_gcell(k,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = +1.e50_r8 - hbuf(k,j) = min( hbuf(k,j), field_gcell(k,j) ) - else - hbuf(k,j) = spval - endif - nacs(k,j) = 1 - end do - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - deallocate( field_gcell ) - - else ! Do not map to gridcell - - ! For data defined on the pft, col or landunit, we need to check if a point is active - ! to determine whether that point should be assigned spval - if (type1d == namep) then - check_active = .true. - active => patch%active - else if (type1d == namec) then - check_active = .true. - active => col%active - else if (type1d == namel) then - check_active = .true. - active =>lun%active - else - check_active = .false. - end if - - ! Note that since field points to an array section the - ! bounds are field(1:end1d-beg1d+1, num2d) - therefore - ! need to do the shifting below - - select case (avgflag) - case ('I') ! Instantaneous - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - hbuf(k,j) = field(k-beg1d+1,j) - else - hbuf(k,j) = spval - end if - else - hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case ('A', 'SUM') ! Time average / sum - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = 0._r8 - hbuf(k,j) = hbuf(k,j) + field(k-beg1d+1,j) - nacs(k,j) = nacs(k,j) + 1 - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - end do - end do - case ('X') ! Maximum over time - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = -1.e50_r8 - hbuf(k,j) = max( hbuf(k,j), field(k-beg1d+1,j) ) - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case ('M') ! Minimum over time - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (check_active) then - if (.not. active(k)) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = +1.e50_r8 - hbuf(k,j) = min( hbuf(k,j), field(k-beg1d+1,j)) - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - end if - - if (field_allocated) then - deallocate(field) - end if - - end subroutine hist_update_hbuf_field_2d - - !----------------------------------------------------------------------- - subroutine hist_set_snow_field_2d (field_out, field_in, no_snow_behavior, type1d, beg1d, end1d) - ! - ! !DESCRIPTION: - ! Set values in history field dimensioned by levsno. - ! - ! This routine handles what to do when a given snow layer doesn't exist for a given - ! point, based on the no_snow_behavior argument. Options are: - ! - ! - no_snow_normal: This is the normal behavior, which applies to most snow fields: - ! Use spval (missing value flag). This means that temporal averages will just - ! consider times when a particular snow layer actually existed - ! - ! - no_snow_zero: Average in a 0 value for times when the snow layer isn't present - ! - ! Input and output fields can be defined at the patch or column level - ! - ! !ARGUMENTS: - integer , intent(in) :: beg1d ! beginning spatial index - integer , intent(in) :: end1d ! ending spatial index - real(r8) , intent(out) :: field_out( beg1d: , 1: ) ! output field [point, lev] - real(r8) , intent(in) :: field_in ( beg1d: , 1: ) ! input field [point, lev] - integer , intent(in) :: no_snow_behavior ! behavior to use when a snow layer is absent - character(len=*), intent(in) :: type1d ! 1d clm pointer type ("column" or "pft") - ! - ! !LOCAL VARIABLES: - integer :: num_levels ! total number of possible snow layers - integer :: point - integer :: level - integer :: num_snow_layers ! number of snow layers that exist at a point - integer :: num_nonexistent_layers - integer :: c ! column index - real(r8):: no_snow_val ! value to use when a snow layer is missing - character(len=*), parameter :: subname = 'hist_set_snow_field_2d' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(field_out, 1) == end1d), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(field_in , 1) == end1d), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(field_out, 2) == ubound(field_in, 2)), errMsg(sourcefile, __LINE__)) - - associate(& - snl => col%snl & ! Input: [integer (:)] number of snow layers (negative) - ) - - num_levels = ubound(field_in, 2) - - ! Determine no_snow_val - select case (no_snow_behavior) - case (no_snow_normal) - no_snow_val = spval - case (no_snow_zero) - no_snow_val = 0._r8 - case default - write(iulog,*) trim(subname), ' ERROR: unrecognized no_snow_behavior: ', & - no_snow_behavior - call endrun() - end select - - do point = beg1d, end1d - - ! Get number of snow layers at this point - - if (type1d == namec) then - c = point - else if (type1d == namep) then - c = patch%column(point) - else - write(iulog,*) trim(subname), ' ERROR: Only implemented for patch and col-level fields' - write(iulog,*) 'type1d = ', trim(type1d) - call endrun() - end if - - num_snow_layers = abs(snl(c)) - num_nonexistent_layers = num_levels - num_snow_layers - - ! Fill output field appropriately for each layer - ! When only a subset of snow layers exist, it is the LAST num_snow_layers that exist - ! Levels are rearranged such that the top snow layer (surface layer) becomes level 1, etc. - - do level = num_levels, (num_levels-num_nonexistent_layers+1), -1 - field_out(point, level) = no_snow_val - end do - do level = (num_levels-num_nonexistent_layers), 1, -1 - field_out(point, level) = field_in(point, level+num_nonexistent_layers) - end do - - end do - - end associate - - end subroutine hist_set_snow_field_2d - - - !----------------------------------------------------------------------- - subroutine hfields_normalize (t) - ! - ! !DESCRIPTION: - ! Normalize fields on a history file by the number of accumulations. - ! Loop over fields on the tape. Need averaging flag and number of - ! accumulations to perform normalization. - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - integer :: k ! 1d index - integer :: j ! 2d index - logical :: aflag ! averaging flag - integer :: beg1d,end1d ! hbuf 1d beginning and ending indices - integer :: num2d ! hbuf size of second dimension (e.g. number of vertical levels) - character(len=avgflag_strlen) :: avgflag ! averaging flag - real(r8), pointer :: hbuf(:,:) ! history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - character(len=*),parameter :: subname = 'hfields_normalize' - !----------------------------------------------------------------------- - - ! Normalize by number of accumulations for time averaged case - - do f = 1,tape(t)%nflds - avgflag = tape(t)%hlist(f)%avgflag - if ( is_mapping_upto_subgrid(tape(t)%hlist(f)%field%type1d, tape(t)%hlist(f)%field%type1d_out) )then - beg1d = tape(t)%hlist(f)%field%beg1d_out - end1d = tape(t)%hlist(f)%field%end1d_out - else - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - end if - num2d = tape(t)%hlist(f)%field%num2d - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (avgflag == 'A') then - aflag = .true. - else - aflag = .false. - end if - - do j = 1, num2d - do k = beg1d, end1d - if (aflag .and. nacs(k,j) /= 0) then - hbuf(k,j) = hbuf(k,j) / float(nacs(k,j)) - end if - end do - end do - end do - - end subroutine hfields_normalize - - !----------------------------------------------------------------------- - subroutine hfields_zero (t) - ! - ! !DESCRIPTION: - ! Zero out accumulation and history buffers for a given history tape. - ! Loop through fields on the tape. - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - character(len=*),parameter :: subname = 'hfields_zero' - !----------------------------------------------------------------------- - - do f = 1,tape(t)%nflds - tape(t)%hlist(f)%hbuf(:,:) = 0._r8 - tape(t)%hlist(f)%nacs(:,:) = 0 - end do - - end subroutine hfields_zero - - !----------------------------------------------------------------------- - subroutine htape_create (t, histrest) - ! - ! !DESCRIPTION: - ! Define contents of history file t. Issue the required netcdf - ! wrapper calls to define the history file contents. - ! - ! !USES: - use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, nlevurb, numrad, nlevcan, nvegwcs,nlevsoi - use clm_varpar , only : natpft_size, cft_size, maxpatch_glcmec, nlevdecomp_full - use landunit_varcon , only : max_lunit - use clm_varctl , only : caseid, ctitle, fsurdat, finidat, paramfile - use clm_varctl , only : version, hostname, username, conventions, source - use domainMod , only : ldomain - use fileutils , only : get_filename - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - logical, intent(in), optional :: histrest ! if creating the history restart file - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - integer :: p,c,l,n ! indices - integer :: ier ! error code - integer :: num2d ! size of second dimension (e.g. number of vertical levels) - integer :: dimid ! dimension id temporary - integer :: dim1id(1) ! netCDF dimension id - integer :: dim2id(2) ! netCDF dimension id - integer :: ndims ! dimension counter - integer :: omode ! returned mode from netCDF call - integer :: ncprec ! output netCDF write precision - integer :: ret ! netCDF error status - integer :: nump ! total number of pfts across all processors - integer :: numc ! total number of columns across all processors - integer :: numl ! total number of landunits across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numa ! total number of atm cells across all processors - logical :: avoid_pnetcdf ! whether we should avoid using pnetcdf - logical :: lhistrest ! local history restart flag - type(file_desc_t), pointer :: lnfid ! local file id - character(len= 8) :: curdate ! current date - character(len= 8) :: curtime ! current time - character(len=256) :: name ! name of attribute - character(len=256) :: units ! units of attribute - character(len=256) :: str ! global attribute string - character(len=*),parameter :: subname = 'htape_create' - !----------------------------------------------------------------------- - - if ( present(histrest) )then - lhistrest = histrest - else - lhistrest = .false. - end if - - ! Determine necessary indices - - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump) - - ! define output write precsion for tape - - ncprec = tape(t)%ncprec - if (lhistrest) then - lnfid => ncid_hist(t) - else - lnfid => nfid(t) - endif - - ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for - ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 - ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of - ! performance is to keep pnetcdf, but set PIO_BUFFER_SIZE_LIMIT=0, but that can't be - ! done on a per-file basis. - if (.not. tape(t)%dov2xy) then - avoid_pnetcdf = .true. - else - avoid_pnetcdf = .false. - end if - - ! Create new netCDF file. It will be in define mode - - if ( .not. lhistrest )then - if (masterproc) then - write(iulog,*) trim(subname),' : Opening netcdf htape ', & - trim(locfnh(t)) - call shr_sys_flush(iulog) - end if - call ncd_pio_createfile(lnfid, trim(locfnh(t)), avoid_pnetcdf=avoid_pnetcdf) - call ncd_putatt(lnfid, ncd_global, 'title', 'CLM History file information' ) - call ncd_putatt(lnfid, ncd_global, 'comment', & - "NOTE: None of the variables are weighted by land fraction!" ) - else - if (masterproc) then - write(iulog,*) trim(subname),' : Opening netcdf rhtape ', & - trim(locfnhr(t)) - call shr_sys_flush(iulog) - end if - call ncd_pio_createfile(lnfid, trim(locfnhr(t)), avoid_pnetcdf=avoid_pnetcdf) - call ncd_putatt(lnfid, ncd_global, 'title', & - 'CLM Restart History information, required to continue a simulation' ) - call ncd_putatt(lnfid, ncd_global, 'comment', & - "This entire file NOT needed for startup or branch simulations") - end if - - ! Create global attributes. Attributes are used to store information - ! about the data set. Global attributes are information about the - ! data set as a whole, as opposed to a single variable - - call ncd_putatt(lnfid, ncd_global, 'Conventions', trim(conventions)) - call getdatetime(curdate, curtime) - str = 'created on ' // curdate // ' ' // curtime - call ncd_putatt(lnfid, ncd_global, 'history' , trim(str)) - call ncd_putatt(lnfid, ncd_global, 'source' , trim(source)) - call ncd_putatt(lnfid, ncd_global, 'hostname', trim(hostname)) - call ncd_putatt(lnfid, ncd_global, 'username', trim(username)) - call ncd_putatt(lnfid, ncd_global, 'version' , trim(version)) - - str = & - '$Id: histFileMod.F90 42903 2012-12-21 15:32:10Z muszala $' - call ncd_putatt(lnfid, ncd_global, 'revision_id', trim(str)) - call ncd_putatt(lnfid, ncd_global, 'case_title', trim(ctitle)) - call ncd_putatt(lnfid, ncd_global, 'case_id', trim(caseid)) - str = get_filename(fsurdat) - call ncd_putatt(lnfid, ncd_global, 'Surface_dataset', trim(str)) - if (finidat == ' ') then - str = 'arbitrary initialization' - else - str = get_filename(finidat) - endif - call ncd_putatt(lnfid, ncd_global, 'Initial_conditions_dataset', trim(str)) - str = get_filename(paramfile) - call ncd_putatt(lnfid, ncd_global, 'PFT_physiological_constants_dataset', trim(str)) - - ! Define dimensions. - ! Time is an unlimited dimension. Character string is treated as an array of characters. - - ! Global uncompressed dimensions (including non-land points) - if (ldomain%isgrid2d) then - call ncd_defdim(lnfid, 'lon' , ldomain%ni, dimid) - call ncd_defdim(lnfid, 'lat' , ldomain%nj, dimid) - else - call ncd_defdim(lnfid, trim(grlnd), ldomain%ns, dimid) - end if - - ! Global compressed dimensions (not including non-land points) - call ncd_defdim(lnfid, trim(nameg), numg, dimid) - call ncd_defdim(lnfid, trim(namel), numl, dimid) - call ncd_defdim(lnfid, trim(namec), numc, dimid) - call ncd_defdim(lnfid, trim(namep), nump, dimid) - - ! "level" dimensions - call ncd_defdim(lnfid, 'levgrnd', nlevgrnd, dimid) - call ncd_defdim(lnfid, 'levsoi', nlevsoi, dimid) - if (nlevurb > 0) then - call ncd_defdim(lnfid, 'levurb' , nlevurb, dimid) - end if - call ncd_defdim(lnfid, 'levlak' , nlevlak, dimid) - call ncd_defdim(lnfid, 'numrad' , numrad , dimid) - call ncd_defdim(lnfid, 'levsno' , nlevsno , dimid) - call ncd_defdim(lnfid, 'ltype', max_lunit, dimid) - call ncd_defdim(lnfid, 'nlevcan',nlevcan, dimid) - call ncd_defdim(lnfid, 'nvegwcs',nvegwcs, dimid) - call htape_add_ltype_metadata(lnfid) - call htape_add_ctype_metadata(lnfid) - call ncd_defdim(lnfid, 'natpft', natpft_size, dimid) - if (cft_size > 0) then - call ncd_defdim(lnfid, 'cft', cft_size, dimid) - call htape_add_cft_metadata(lnfid) - end if - call ncd_defdim(lnfid, 'glc_nec' , maxpatch_glcmec , dimid) - ! elevclas (in contrast to glc_nec) includes elevation class 0 (bare land) - ! (although on the history file it will go 1:(nec+1) rather than 0:nec) - call ncd_defdim(lnfid, 'elevclas' , maxpatch_glcmec + 1, dimid) - - do n = 1,num_subs - call ncd_defdim(lnfid, subs_name(n), subs_dim(n), dimid) - end do - call ncd_defdim(lnfid, 'string_length', hist_dim_name_length, strlen_dimid) - call ncd_defdim(lnfid, 'scale_type_string_length', scale_type_strlen, dimid) - call ncd_defdim( lnfid, 'levdcmp', nlevdecomp_full, dimid) - - if(use_fates)then - call ncd_defdim(lnfid, 'fates_levscag', nlevsclass * nlevage, dimid) - call ncd_defdim(lnfid, 'fates_levscls', nlevsclass, dimid) - call ncd_defdim(lnfid, 'fates_levpft', numpft_ed, dimid) - call ncd_defdim(lnfid, 'fates_levage', nlevage, dimid) - call ncd_defdim(lnfid, 'fates_levfuel', nfsc, dimid) - call ncd_defdim(lnfid, 'fates_levcwdsc', ncwd, dimid) - call ncd_defdim(lnfid, 'fates_levscpf', nlevsclass*numpft_ed, dimid) - call ncd_defdim(lnfid, 'fates_levcan', nclmax, dimid) - call ncd_defdim(lnfid, 'fates_levcnlf', nlevleaf * nclmax, dimid) - call ncd_defdim(lnfid, 'fates_levcnlfpf', nlevleaf * nclmax * numpft_ed, dimid) - end if - - if ( .not. lhistrest )then - call ncd_defdim(lnfid, 'hist_interval', 2, hist_interval_dimid) - call ncd_defdim(lnfid, 'time', ncd_unlimited, time_dimid) - if (masterproc)then - write(iulog,*) trim(subname), & - ' : Successfully defined netcdf history file ',t - call shr_sys_flush(iulog) - end if - else - if (masterproc)then - write(iulog,*) trim(subname), & - ' : Successfully defined netcdf restart history file ',t - call shr_sys_flush(iulog) - end if - end if - - end subroutine htape_create - - !----------------------------------------------------------------------- - subroutine htape_add_ltype_metadata(lnfid) - ! - ! !DESCRIPTION: - ! Add global metadata defining landunit types - ! - ! !USES: - use landunit_varcon, only : max_lunit, landunit_names, landunit_name_length - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: lnfid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ltype ! landunit type - character(len=*), parameter :: att_prefix = 'ltype_' ! prefix for attributes - character(len=len(att_prefix)+landunit_name_length) :: attname ! attribute name - - character(len=*), parameter :: subname = 'htape_add_ltype_metadata' - !----------------------------------------------------------------------- - - do ltype = 1, max_lunit - attname = att_prefix // landunit_names(ltype) - call ncd_putatt(lnfid, ncd_global, attname, ltype) - end do - - end subroutine htape_add_ltype_metadata - - !----------------------------------------------------------------------- - subroutine htape_add_ctype_metadata(lnfid) - ! - ! !DESCRIPTION: - ! Add global metadata defining column types - ! - ! !USES: - use column_varcon, only : write_coltype_metadata - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: lnfid ! local file id - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: att_prefix = 'ctype_' ! prefix for attributes - - character(len=*), parameter :: subname = 'htape_add_ctype_metadata' - !----------------------------------------------------------------------- - - call write_coltype_metadata(att_prefix, lnfid) - - end subroutine htape_add_ctype_metadata - - !----------------------------------------------------------------------- - subroutine htape_add_natpft_metadata(lnfid) - ! - ! !DESCRIPTION: - ! Add global metadata defining natpft types - ! - ! !USES: - use clm_varpar, only : natpft_lb, natpft_ub - use pftconMod , only : pftname_len, pftname - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: lnfid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ptype ! patch type - integer :: ptype_1_indexing ! patch type, translated to 1 indexing - character(len=*), parameter :: att_prefix = 'natpft_' ! prefix for attributes - character(len=len(att_prefix)+pftname_len) :: attname ! attribute name - - character(len=*), parameter :: subname = 'htape_add_natpft_metadata' - !----------------------------------------------------------------------- - - do ptype = natpft_lb, natpft_ub - ptype_1_indexing = ptype + (1 - natpft_lb) - attname = att_prefix // pftname(ptype) - call ncd_putatt(lnfid, ncd_global, attname, ptype_1_indexing) - end do - - end subroutine htape_add_natpft_metadata - - !----------------------------------------------------------------------- - subroutine htape_add_cft_metadata(lnfid) - ! - ! !DESCRIPTION: - ! Add global metadata defining natpft types - ! - ! !USES: - use clm_varpar, only : cft_lb, cft_ub - use pftconMod , only : pftname_len, pftname - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: lnfid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ptype ! patch type - integer :: ptype_1_indexing ! patch type, translated to 1 indexing - character(len=*), parameter :: att_prefix = 'cft_' ! prefix for attributes - character(len=len(att_prefix)+pftname_len) :: attname ! attribute name - - character(len=*), parameter :: subname = 'htape_add_cft_metadata' - !----------------------------------------------------------------------- - - do ptype = cft_lb, cft_ub - ptype_1_indexing = ptype + (1 - cft_lb) - attname = att_prefix // pftname(ptype) - call ncd_putatt(lnfid, ncd_global, attname, ptype_1_indexing) - end do - - end subroutine htape_add_cft_metadata - - !----------------------------------------------------------------------- - subroutine htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode) - ! - ! !DESCRIPTION: - ! Write time constant 3D variables to history tapes. - ! Only write out when this subroutine is called (normally only for - ! primary history files at very first time-step, nstep=0). - ! Issue the required netcdf wrapper calls to define the history file - ! contents. - ! - ! !USES: - use subgridAveMod , only : c2g - use clm_varpar , only : nlevgrnd ,nlevlak - use shr_string_mod , only : shr_string_listAppend - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - integer , intent(in) :: t ! tape index - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) - character(len=*) , intent(in) :: mode ! 'define' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: c,l,lev,ifld ! indices - integer :: ier ! error status - character(len=max_chars) :: long_name ! variable long name - character(len=max_namlen):: varname ! variable name - character(len=max_namlen):: units ! variable units - character(len=scale_type_strlen) :: l2g_scale_type ! scale type for subgrid averaging of landunits to grid cells - ! - real(r8), pointer :: histi(:,:) ! temporary - real(r8), pointer :: histo(:,:) ! temporary - integer, parameter :: nflds = 6 ! Number of 3D time-constant fields - character(len=*),parameter :: subname = 'htape_timeconst3D' - character(len=*),parameter :: varnames(nflds) = (/ & - 'ZSOI ', & - 'DZSOI ', & - 'WATSAT', & - 'SUCSAT', & - 'BSW ', & - 'HKSAT ' & - /) - real(r8), pointer :: histil(:,:) ! temporary - real(r8), pointer :: histol(:,:) - integer, parameter :: nfldsl = 2 - character(len=*),parameter :: varnamesl(nfldsl) = (/ & - 'ZLAKE ', & - 'DZLAKE' & - /) - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - !------------------------------------------------------------------------------- - !*** Non-time varying 3D fields *** - !*** Only write out when this subroutine is called *** - !*** Normally only called once for primary tapes *** - !------------------------------------------------------------------------------- - - if (mode == 'define') then - - do ifld = 1,nflds - ! Field indices MUST match varnames array order above! - if (ifld == 1) then - long_name='soil depth'; units = 'm' - else if (ifld == 2) then - long_name='soil thickness'; units = 'm' - else if (ifld == 3) then - long_name='saturated soil water content (porosity)'; units = 'mm3/mm3' - else if (ifld == 4) then - long_name='saturated soil matric potential'; units = 'mm' - else if (ifld == 5) then - long_name='slope of soil water retention curve'; units = 'unitless' - else if (ifld == 6) then - long_name='saturated hydraulic conductivity'; units = 'mm s-1' - else - call endrun(msg=' ERROR: bad 3D time-constant field index'//errMsg(sourcefile, __LINE__)) - end if - if (tape(t)%dov2xy) then - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec,& - dim1name='lon', dim2name='lat', dim3name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec, & - dim1name=grlnd, dim2name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - end if - else - call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec, & - dim1name=namec, dim2name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - end if - call shr_string_listAppend(TimeConst3DVars,varnames(ifld)) - end do - - else if (mode == 'write') then - - allocate(histi(bounds%begc:bounds%endc,nlevgrnd), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for histi' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Write time constant fields - - if (tape(t)%dov2xy) then - allocate(histo(bounds%begg:bounds%endg,nlevgrnd), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for histo' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - do ifld = 1,nflds - - ! WJS (10-25-11): Note about l2g_scale_type in the following: ZSOI & DZSOI are - ! currently constant in space, except for urban points, so their scale type - ! doesn't matter at the moment as long as it excludes urban points. I am using - ! 'nonurb' so that the values are output everywhere where the fields are - ! constant (i.e., everywhere except urban points). For the other fields, I am - ! using 'veg' to be consistent with the l2g_scale_type that is now used for many - ! of the 3-d time-variant fields; in theory, though, one might want versions of - ! these variables output for different landunits. - - ! Field indices MUST match varnames array order above! - if (ifld == 1) then ! ZSOI - l2g_scale_type = 'nonurb' - else if (ifld == 2) then ! DZSOI - l2g_scale_type = 'nonurb' - else if (ifld == 3) then ! WATSAT - l2g_scale_type = 'veg' - else if (ifld == 4) then ! SUCSAT - l2g_scale_type = 'veg' - else if (ifld == 5) then ! BSW - l2g_scale_type = 'veg' - else if (ifld == 6) then ! HKSAT - l2g_scale_type = 'veg' - end if - - histi(:,:) = spval - do lev = 1,nlevgrnd - do c = bounds%begc,bounds%endc - l = col%landunit(c) - ! Field indices MUST match varnames array order above! - if (ifld ==1) histi(c,lev) = col%z(c,lev) - if (ifld ==2) histi(c,lev) = col%dz(c,lev) - if (ifld ==3) histi(c,lev) = watsat_col(c,lev) - if (ifld ==4) histi(c,lev) = sucsat_col(c,lev) - if (ifld ==5) histi(c,lev) = bsw_col(c,lev) - if (ifld ==6) histi(c,lev) = hksat_col(c,lev) - end do - end do - if (tape(t)%dov2xy) then - histo(:,:) = spval - - call c2g(bounds, nlevgrnd, & - histi(bounds%begc:bounds%endc, :), & - histo(bounds%begg:bounds%endg, :), & - c2l_scale_type='unity', l2g_scale_type=l2g_scale_type) - - if (ldomain%isgrid2d) then - call ncd_io(varname=trim(varnames(ifld)), dim1name=grlnd, & - data=histo, ncid=nfid(t), flag='write') - else - call ncd_io(varname=trim(varnames(ifld)), dim1name=grlnd, & - data=histo, ncid=nfid(t), flag='write') - end if - else - call ncd_io(varname=trim(varnames(ifld)), dim1name=namec, & - data=histi, ncid=nfid(t), flag='write') - end if - end do - - if (tape(t)%dov2xy) deallocate(histo) - deallocate(histi) - - end if ! (define/write mode - - if (mode == 'define') then - do ifld = 1,nfldsl - ! Field indices MUST match varnamesl array order above! - if (ifld == 1) then - long_name='lake layer node depth'; units = 'm' - else if (ifld == 2) then - long_name='lake layer thickness'; units = 'm' - else - call endrun(msg=' ERROR: bad 3D time-constant field index'//errMsg(sourcefile, __LINE__)) - end if - if (tape(t)%dov2xy) then - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=nfid(t), varname=trim(varnamesl(ifld)), xtype=tape(t)%ncprec,& - dim1name='lon', dim2name='lat', dim3name='levlak', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=trim(varnamesl(ifld)), xtype=tape(t)%ncprec, & - dim1name=grlnd, dim2name='levlak', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - end if - else - call ncd_defvar(ncid=nfid(t), varname=trim(varnamesl(ifld)), xtype=tape(t)%ncprec, & - dim1name=namec, dim2name='levlak', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - end if - call shr_string_listAppend(TimeConst3DVars,varnamesl(ifld)) - end do - - else if (mode == 'write') then - - allocate(histil(bounds%begc:bounds%endc,nlevlak), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for histil' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Write time constant fields - - if (tape(t)%dov2xy) then - allocate(histol(bounds%begg:bounds%endg,nlevlak), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for histol' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - do ifld = 1,nfldsl - histil(:,:) = spval - do lev = 1,nlevlak - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%lakpoi(l)) then - ! Field indices MUST match varnamesl array order above! - if (ifld ==1) histil(c,lev) = col%z_lake(c,lev) - if (ifld ==2) histil(c,lev) = col%dz_lake(c,lev) - end if - end do - end do - if (tape(t)%dov2xy) then - histol(:,:) = spval - call c2g(bounds, nlevlak, & - histil(bounds%begc:bounds%endc, :), & - histol(bounds%begg:bounds%endg, :), & - c2l_scale_type='unity', l2g_scale_type='lake') - if (ldomain%isgrid2d) then - call ncd_io(varname=trim(varnamesl(ifld)), dim1name=grlnd, & - data=histol, ncid=nfid(t), flag='write') - else - call ncd_io(varname=trim(varnamesl(ifld)), dim1name=grlnd, & - data=histol, ncid=nfid(t), flag='write') - end if - else - call ncd_io(varname=trim(varnamesl(ifld)), dim1name=namec, & - data=histil, ncid=nfid(t), flag='write') - end if - end do - - if (tape(t)%dov2xy) deallocate(histol) - deallocate(histil) - - end if ! (define/write mode - - end subroutine htape_timeconst3D - - !----------------------------------------------------------------------- - subroutine htape_timeconst(t, mode) - ! - ! !DESCRIPTION: - ! Write time constant values to primary history tape. - use clm_time_manager, only : get_step_size - ! Issue the required netcdf wrapper calls to define the history file - ! contents. - ! - ! !USES: - use clm_varcon , only : zsoi, zlak, secspday, isecspday, isecsphr, isecspmin - use domainMod , only : ldomain, lon1d, lat1d - use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time - use clm_time_manager, only : get_ref_date, get_calendar, NO_LEAP_C, GREGORIAN_C - use FatesInterfaceMod, only : fates_hdim_levsclass - use FatesInterfaceMod, only : fates_hdim_pfmap_levscpf - use FatesInterfaceMod, only : fates_hdim_scmap_levscpf - use FatesInterfaceMod, only : fates_hdim_levage - use FatesInterfaceMod, only : fates_hdim_levpft - use FatesInterfaceMod, only : fates_hdim_scmap_levscag - use FatesInterfaceMod, only : fates_hdim_agmap_levscag - use FatesInterfaceMod, only : fates_hdim_levfuel - use FatesInterfaceMod, only : fates_hdim_levcwdsc - use FatesInterfaceMod, only : fates_hdim_levcan - use FatesInterfaceMod, only : fates_hdim_canmap_levcnlf - use FatesInterfaceMod, only : fates_hdim_lfmap_levcnlf - use FatesInterfaceMod, only : fates_hdim_canmap_levcnlfpf - use FatesInterfaceMod, only : fates_hdim_lfmap_levcnlfpf - use FatesInterfaceMod, only : fates_hdim_pftmap_levcnlfpf - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - integer :: dtime ! timestep size - character(len=*), intent(in) :: mode ! 'define' or 'write' - ! - integer :: sec_hist_nhtfrq ! hist_nhtfrq converted to seconds - ! !LOCAL VARIABLES: - integer :: vid,n,i,j,m ! indices - integer :: nstep ! current step - integer :: mcsec ! seconds of current date - integer :: mdcur ! current day - integer :: mscur ! seconds of current day - integer :: mcdate ! current date - integer :: yr,mon,day,nbsec ! year,month,day,seconds components of a date - integer :: hours,minutes,secs ! hours,minutes,seconds of hh:mm:ss - character(len= 10) :: basedate ! base date (yyyymmdd) - character(len= 8) :: basesec ! base seconds - character(len= 8) :: cdate ! system date - character(len= 8) :: ctime ! system time - real(r8):: time ! current time - real(r8):: timedata(2) ! time interval boundaries - integer :: dim1id(1) ! netCDF dimension id - integer :: dim2id(2) ! netCDF dimension id - integer :: varid ! netCDF variable id - character(len=max_chars) :: long_name ! variable long name - character(len=max_namlen):: varname ! variable name - character(len=max_namlen):: units ! variable units - character(len=max_namlen):: cal ! calendar from the time-manager - character(len=max_namlen):: caldesc ! calendar description to put on file - character(len=256):: str ! global attribute string - real(r8), pointer :: histo(:,:) ! temporary - integer :: status - real(r8) :: zsoi_1d(1) - character(len=*),parameter :: subname = 'htape_timeconst' - !----------------------------------------------------------------------- - - !------------------------------------------------------------------------------- - !*** Time constant grid variables only on first time-sample of file *** - !------------------------------------------------------------------------------- - - if (tape(t)%ntimes == 1) then - if (mode == 'define') then - call ncd_defvar(varname='levgrnd', xtype=tape(t)%ncprec, & - dim1name='levgrnd', & - long_name='coordinate soil levels', units='m', ncid=nfid(t)) - call ncd_defvar(varname='levlak', xtype=tape(t)%ncprec, & - dim1name='levlak', & - long_name='coordinate lake levels', units='m', ncid=nfid(t)) - call ncd_defvar(varname='levdcmp', xtype=tape(t)%ncprec, dim1name='levdcmp', & - long_name='coordinate soil levels', units='m', ncid=nfid(t)) - - if(use_fates)then - - call ncd_defvar(varname='fates_levscls', xtype=tape(t)%ncprec, dim1name='fates_levscls', & - long_name='FATES diameter size class lower bound', units='cm', ncid=nfid(t)) - call ncd_defvar(varname='fates_scmap_levscag', xtype=ncd_int, dim1name='fates_levscag', & - long_name='FATES size-class map into size x patch age', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_agmap_levscag', xtype=ncd_int, dim1name='fates_levscag', & - long_name='FATES age-class map into size x patch age', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_pftmap_levscpf',xtype=ncd_int, dim1name='fates_levscpf', & - long_name='FATES pft index of the combined pft-size class dimension', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_scmap_levscpf',xtype=ncd_int, dim1name='fates_levscpf', & - long_name='FATES size index of the combined pft-size class dimension', units='-', ncid=nfid(t)) - call ncd_defvar(varname='fates_levage',xtype=tape(t)%ncprec, dim1name='fates_levage', & - long_name='FATES patch age (yr)', ncid=nfid(t)) - call ncd_defvar(varname='fates_levpft',xtype=ncd_int, dim1name='fates_levpft', & - long_name='FATES pft number', ncid=nfid(t)) - call ncd_defvar(varname='fates_levfuel',xtype=ncd_int, dim1name='fates_levfuel', & - long_name='FATES fuel index', ncid=nfid(t)) - call ncd_defvar(varname='fates_levcwdsc',xtype=ncd_int, dim1name='fates_levcwdsc', & - long_name='FATES cwd size class', ncid=nfid(t)) - call ncd_defvar(varname='fates_levcan',xtype=ncd_int, dim1name='fates_levcan', & - long_name='FATES canopy level', ncid=nfid(t)) - call ncd_defvar(varname='fates_canmap_levcnlf',xtype=ncd_int, dim1name='fates_levcnlf', & - long_name='FATES canopy level of combined canopy-leaf dimension', ncid=nfid(t)) - call ncd_defvar(varname='fates_lfmap_levcnlf',xtype=ncd_int, dim1name='fates_levcnlf', & - long_name='FATES leaf level of combined canopy-leaf dimension', ncid=nfid(t)) - call ncd_defvar(varname='fates_canmap_levcnlfpf',xtype=ncd_int, dim1name='fates_levcnlfpf', & - long_name='FATES canopy level of combined canopy x leaf x pft dimension', ncid=nfid(t)) - call ncd_defvar(varname='fates_lfmap_levcnlfpf',xtype=ncd_int, dim1name='fates_levcnlfpf', & - long_name='FATES leaf level of combined canopy x leaf x pft dimension', ncid=nfid(t)) - call ncd_defvar(varname='fates_pftmap_levcnlfpf',xtype=ncd_int, dim1name='fates_levcnlfpf', & - long_name='FATES PFT level of combined canopy x leaf x pft dimension', ncid=nfid(t)) - end if - - - elseif (mode == 'write') then - if ( masterproc ) write(iulog, *) ' zsoi:',zsoi - call ncd_io(varname='levgrnd', data=zsoi, ncid=nfid(t), flag='write') - call ncd_io(varname='levlak' , data=zlak, ncid=nfid(t), flag='write') - if (use_vertsoilc) then - call ncd_io(varname='levdcmp', data=zsoi, ncid=nfid(t), flag='write') - else - zsoi_1d(1) = 1._r8 - call ncd_io(varname='levdcmp', data=zsoi_1d, ncid=nfid(t), flag='write') - end if - if(use_fates)then - call ncd_io(varname='fates_scmap_levscag',data=fates_hdim_scmap_levscag, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_agmap_levscag',data=fates_hdim_agmap_levscag, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levscls',data=fates_hdim_levsclass, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_pftmap_levscpf',data=fates_hdim_pfmap_levscpf, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_scmap_levscpf',data=fates_hdim_scmap_levscpf, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levage',data=fates_hdim_levage, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levpft',data=fates_hdim_levpft, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levfuel',data=fates_hdim_levfuel, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levcwdsc',data=fates_hdim_levcwdsc, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_levcan',data=fates_hdim_levcan, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_canmap_levcnlf',data=fates_hdim_canmap_levcnlf, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_lfmap_levcnlf',data=fates_hdim_lfmap_levcnlf, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_canmap_levcnlfpf',data=fates_hdim_canmap_levcnlfpf, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_lfmap_levcnlfpf',data=fates_hdim_lfmap_levcnlfpf, ncid=nfid(t), flag='write') - call ncd_io(varname='fates_pftmap_levcnlfpf',data=fates_hdim_pftmap_levcnlfpf, ncid=nfid(t), flag='write') - end if - - endif - endif - - !------------------------------------------------------------------------------- - !*** Time definition variables *** - !------------------------------------------------------------------------------- - - ! For define mode -- only do this for first time-sample - if (mode == 'define' .and. tape(t)%ntimes == 1) then - call get_ref_date(yr, mon, day, nbsec) - nstep = get_nstep() - hours = nbsec / 3600 - minutes = (nbsec - hours*3600) / 60 - secs = (nbsec - hours*3600 - minutes*60) - write(basedate,80) yr,mon,day -80 format(i4.4,'-',i2.2,'-',i2.2) - write(basesec ,90) hours, minutes, secs -90 format(i2.2,':',i2.2,':',i2.2) - - dim1id(1) = time_dimid - str = 'days since ' // basedate // " " // basesec - call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & - long_name='time',units=str) - cal = get_calendar() - if ( trim(cal) == NO_LEAP_C )then - caldesc = "noleap" - else if ( trim(cal) == GREGORIAN_C )then - caldesc = "gregorian" - end if - call ncd_putatt(nfid(t), varid, 'calendar', caldesc) - call ncd_putatt(nfid(t), varid, 'bounds', 'time_bounds') - - dim1id(1) = time_dimid - call ncd_defvar(nfid(t) , 'mcdate', ncd_int, 1, dim1id , varid, & - long_name = 'current date (YYYYMMDD)') - ! - ! add global attribute time_period_freq - ! - if (hist_nhtfrq(t) < 0) then !hour need to convert to seconds - sec_hist_nhtfrq = abs(hist_nhtfrq(t))*3600 - else - sec_hist_nhtfrq = hist_nhtfrq(t) - end if - - dtime = get_step_size() - if (sec_hist_nhtfrq == 0) then !month - time_period_freq = 'month_1' - else if (mod(sec_hist_nhtfrq*dtime,isecspday) == 0) then ! day - write(time_period_freq,999) 'day_',sec_hist_nhtfrq*dtime/isecspday - else if (mod(sec_hist_nhtfrq*dtime,isecsphr) == 0) then ! hour - write(time_period_freq,999) 'hour_',(sec_hist_nhtfrq*dtime)/isecsphr - else if (mod(sec_hist_nhtfrq*dtime,isecspmin) == 0) then ! minute - write(time_period_freq,999) 'minute_',(sec_hist_nhtfrq*dtime)/isecspmin - else ! second - write(time_period_freq,999) 'second_',sec_hist_nhtfrq*dtime - end if -999 format(a,i0) - - call ncd_putatt(nfid(t), ncd_global, 'time_period_freq', & - trim(time_period_freq)) - - call ncd_defvar(nfid(t) , 'mcsec' , ncd_int, 1, dim1id , varid, & - long_name = 'current seconds of current date', units='s') - call ncd_defvar(nfid(t) , 'mdcur' , ncd_int, 1, dim1id , varid, & - long_name = 'current day (from base day)') - call ncd_defvar(nfid(t) , 'mscur' , ncd_int, 1, dim1id , varid, & - long_name = 'current seconds of current day') - call ncd_defvar(nfid(t) , 'nstep' , ncd_int, 1, dim1id , varid, & - long_name = 'time step') - - dim2id(1) = hist_interval_dimid; dim2id(2) = time_dimid - call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & - long_name = 'history time interval endpoints') - - dim2id(1) = strlen_dimid; dim2id(2) = time_dimid - call ncd_defvar(nfid(t), 'date_written', ncd_char, 2, dim2id, varid) - call ncd_defvar(nfid(t), 'time_written', ncd_char, 2, dim2id, varid) - - if ( len_trim(TimeConst3DVars_Filename) > 0 )then - call ncd_putatt(nfid(t), ncd_global, 'Time_constant_3Dvars_filename', & - trim(TimeConst3DVars_Filename)) - end if - if ( len_trim(TimeConst3DVars) > 0 )then - call ncd_putatt(nfid(t), ncd_global, 'Time_constant_3Dvars', & - trim(TimeConst3DVars)) - end if - - elseif (mode == 'write') then - - call get_curr_time (mdcur, mscur) - call get_curr_date (yr, mon, day, mcsec) - mcdate = yr*10000 + mon*100 + day - nstep = get_nstep() - - call ncd_io('mcdate', mcdate, 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('mcsec' , mcsec , 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('mdcur' , mdcur , 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('mscur' , mscur , 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('nstep' , nstep , 'write', nfid(t), nt=tape(t)%ntimes) - - time = mdcur + mscur/secspday - call ncd_io('time' , time , 'write', nfid(t), nt=tape(t)%ntimes) - - timedata(1) = tape(t)%begtime - timedata(2) = time - call ncd_io('time_bounds', timedata, 'write', nfid(t), nt=tape(t)%ntimes) - - call getdatetime (cdate, ctime) - call ncd_io('date_written', cdate, 'write', nfid(t), nt=tape(t)%ntimes) - - call ncd_io('time_written', ctime, 'write', nfid(t), nt=tape(t)%ntimes) - - endif - - !------------------------------------------------------------------------------- - !*** Grid definition variables *** - !------------------------------------------------------------------------------- - ! For define mode -- only do this for first time-sample - if (mode == 'define' .and. tape(t)%ntimes == 1) then - - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, dim1name='lon', & - long_name='coordinate longitude', units='degrees_east', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate longitude', units='degrees_east', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', & - long_name='coordinate latitude', units='degrees_north', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate latitude', units='degrees_north', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat',& - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat', & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name=grlnd, & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='nbedrock' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='index of shallowest bedrock layer', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - - else if (mode == 'write') then - - ! Most of this is constant and only needs to be done on tape(t)%ntimes=1 - ! But, some may change for dynamic PATCH mode for example - - if (ldomain%isgrid2d) then - call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') - else - call ncd_io(varname='lon', data=ldomain%lonc, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=ldomain%latc, dim1name=grlnd, ncid=nfid(t), flag='write') - end if - call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='nbedrock' , data=grc%nbedrock, dim1name=grlnd, ncid=nfid(t), flag='write') - - end if ! (define/write mode - - end subroutine htape_timeconst - - !----------------------------------------------------------------------- - subroutine hfields_write(t, mode) - ! - ! !DESCRIPTION: - ! Write history tape. Issue the call to write the variable. - ! - ! !USES: - use domainMod , only : ldomain - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - character(len=*), intent(in) :: mode ! 'define' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - integer :: k ! 1d index - integer :: c,l,p ! indices - integer :: beg1d ! on-node 1d field pointer start index - integer :: end1d ! on-node 1d field pointer end index - integer :: beg1d_out ! on-node 1d hbuf pointer start index - integer :: end1d_out ! on-node 1d hbuf pointer end index - integer :: num1d_out ! size of hbuf first dimension (overall all nodes) - integer :: num2d ! hbuf second dimension size - integer :: nt ! time index - integer :: ier ! error status - character(len=avgflag_strlen) :: avgflag ! time averaging flag - character(len=max_chars) :: long_name! long name - character(len=max_chars) :: units ! units - character(len=max_namlen):: varname ! variable name - character(len=32) :: avgstr ! time averaging type - character(len=hist_dim_name_length) :: type1d ! field 1d type - character(len=hist_dim_name_length) :: type1d_out ! history output 1d type - character(len=hist_dim_name_length) :: type2d ! history output 2d type - character(len=32) :: dim1name ! temporary - character(len=32) :: dim2name ! temporary - real(r8), pointer :: histo(:,:) ! temporary - real(r8), pointer :: hist1do(:) ! temporary - character(len=*),parameter :: subname = 'hfields_write' -!----------------------------------------------------------------------- - - ! Write/define 1d topological info - - if (.not. tape(t)%dov2xy) then - if (mode == 'define') then - call hfields_1dinfo(t, mode='define') - else if (mode == 'write') then - call hfields_1dinfo(t, mode='write') - end if - end if - - ! Define time-dependent variables create variables and attributes for field list - - do f = 1,tape(t)%nflds - - ! Set history field variables - - varname = tape(t)%hlist(f)%field%name - long_name = tape(t)%hlist(f)%field%long_name - units = tape(t)%hlist(f)%field%units - avgflag = tape(t)%hlist(f)%avgflag - type1d = tape(t)%hlist(f)%field%type1d - type1d_out = tape(t)%hlist(f)%field%type1d_out - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - num1d_out = tape(t)%hlist(f)%field%num1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - nt = tape(t)%ntimes - - if (mode == 'define') then - - select case (avgflag) - case ('A') - avgstr = 'mean' - case ('I') - avgstr = 'instantaneous' - case ('X') - avgstr = 'maximum' - case ('M') - avgstr = 'minimum' - case ('SUM') - avgstr = 'sum' - case default - write(iulog,*) trim(subname),' ERROR: unknown time averaging flag (avgflag)=',avgflag - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - if (type1d_out == grlnd) then - if (ldomain%isgrid2d) then - dim1name = 'lon' ; dim2name = 'lat' - else - dim1name = trim(grlnd); dim2name = 'undefined' - end if - else - dim1name = type1d_out ; dim2name = 'undefined' - endif - - if (dim2name == 'undefined') then - if (num2d == 1) then - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name=type2d, dim3name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - end if - else - if (num2d == 1) then - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name=dim2name, dim3name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name=dim2name, dim3name=type2d, dim4name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - end if - endif - - else if (mode == 'write') then - - ! Determine output buffer - - histo => tape(t)%hlist(f)%hbuf - - ! Allocate dynamic memory - - if (num2d == 1) then - allocate(hist1do(beg1d_out:end1d_out), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - hist1do(beg1d_out:end1d_out) = histo(beg1d_out:end1d_out,1) - end if - - ! Write history output. Always output land and ocean runoff on xy grid. - - if (num2d == 1) then - call ncd_io(flag='write', varname=varname, & - dim1name=type1d_out, data=hist1do, ncid=nfid(t), nt=nt) - else - call ncd_io(flag='write', varname=varname, & - dim1name=type1d_out, data=histo, ncid=nfid(t), nt=nt) - end if - - - ! Deallocate dynamic memory - - if (num2d == 1) then - deallocate(hist1do) - end if - - end if - - end do - - end subroutine hfields_write - - !----------------------------------------------------------------------- - subroutine hfields_1dinfo(t, mode) - ! - ! !DESCRIPTION: - ! Write/define 1d info for history tape. - ! - ! !USES: - use decompMod , only : ldecomp - use domainMod , only : ldomain, ldomain - ! - ! !ARGUMENTS: - integer, intent(in) :: t ! tape index - character(len=*), intent(in) :: mode ! 'define' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: f ! field index - integer :: k ! 1d index - integer :: g,c,l,p ! indices - integer :: ier ! errir status - real(r8), pointer :: rgarr(:) ! temporary - real(r8), pointer :: rcarr(:) ! temporary - real(r8), pointer :: rlarr(:) ! temporary - real(r8), pointer :: rparr(:) ! temporary - integer , pointer :: igarr(:) ! temporary - integer , pointer :: icarr(:) ! temporary - integer , pointer :: ilarr(:) ! temporary - integer , pointer :: iparr(:) ! temporary - type(file_desc_t), pointer :: ncid ! netcdf file - type(bounds_type) :: bounds - character(len=*),parameter :: subname = 'hfields_1dinfo' -!----------------------------------------------------------------------- - - call get_proc_bounds(bounds) - - ncid => nfid(t) - - if (mode == 'define') then - - ! Define gridcell info - - call ncd_defvar(varname='grid1d_lon', xtype=ncd_double, dim1name=nameg, & - long_name='gridcell longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='grid1d_lat', xtype=ncd_double, dim1name=nameg, & - long_name='gridcell latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='grid1d_ixy', xtype=ncd_int, dim1name=nameg, & - long_name='2d longitude index of corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='grid1d_jxy', xtype=ncd_int, dim1name=nameg, & - long_name='2d latitude index of corresponding gridcell', ncid=ncid) - - ! Define landunit info - - call ncd_defvar(varname='land1d_lon', xtype=ncd_double, dim1name=namel, & - long_name='landunit longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='land1d_lat', xtype=ncd_double, dim1name=namel, & - long_name='landunit latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='land1d_ixy', xtype=ncd_int, dim1name=namel, & - long_name='2d longitude index of corresponding landunit', ncid=ncid) - - call ncd_defvar(varname='land1d_jxy', xtype=ncd_int, dim1name=namel, & - long_name='2d latitude index of corresponding landunit', ncid=ncid) - - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(varname='land1d_gi', xtype=ncd_int, dim1name='landunit', & - ! long_name='1d grid index of corresponding landunit', ncid=ncid) - ! ---------------------------------------------------------------- - - call ncd_defvar(varname='land1d_wtgcell', xtype=ncd_double, dim1name=namel, & - long_name='landunit weight relative to corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='land1d_ityplunit', xtype=ncd_int, dim1name=namel, & - long_name='landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) - - call ncd_defvar(varname='land1d_active', xtype=ncd_log, dim1name=namel, & - long_name='true => do computations on this landunit', ncid=ncid) - - ! Define column info - - call ncd_defvar(varname='cols1d_lon', xtype=ncd_double, dim1name=namec, & - long_name='column longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='cols1d_lat', xtype=ncd_double, dim1name=namec, & - long_name='column latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='cols1d_ixy', xtype=ncd_int, dim1name=namec, & - long_name='2d longitude index of corresponding column', ncid=ncid) - - call ncd_defvar(varname='cols1d_jxy', xtype=ncd_int, dim1name=namec, & - long_name='2d latitude index of corresponding column', ncid=ncid) - - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(varname='cols1d_gi', xtype=ncd_int, dim1name='column', & - ! long_name='1d grid index of corresponding column', ncid=ncid) - - !call ncd_defvar(varname='cols1d_li', xtype=ncd_int, dim1name='column', & - ! long_name='1d landunit index of corresponding column', ncid=ncid) - ! ---------------------------------------------------------------- - - call ncd_defvar(varname='cols1d_wtgcell', xtype=ncd_double, dim1name=namec, & - long_name='column weight relative to corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='cols1d_wtlunit', xtype=ncd_double, dim1name=namec, & - long_name='column weight relative to corresponding landunit', ncid=ncid) - - call ncd_defvar(varname='cols1d_itype_col', xtype=ncd_int, dim1name=namec, & - long_name='column type (see global attributes)', ncid=ncid) - - call ncd_defvar(varname='cols1d_itype_lunit', xtype=ncd_int, dim1name=namec, & - long_name='column landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) - - call ncd_defvar(varname='cols1d_active', xtype=ncd_log, dim1name=namec, & - long_name='true => do computations on this column', ncid=ncid) - - ! Define patch info - - call ncd_defvar(varname='pfts1d_lon', xtype=ncd_double, dim1name=namep, & - long_name='pft longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='pfts1d_lat', xtype=ncd_double, dim1name=namep, & - long_name='pft latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='pfts1d_ixy', xtype=ncd_int, dim1name=namep, & - long_name='2d longitude index of corresponding pft', ncid=ncid) - - call ncd_defvar(varname='pfts1d_jxy', xtype=ncd_int, dim1name=namep, & - long_name='2d latitude index of corresponding pft', ncid=ncid) - - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(varname='pfts1d_gi', xtype=ncd_int, dim1name='pft', & - ! long_name='1d grid index of corresponding pft', ncid=ncid) - - !call ncd_defvar(varname='pfts1d_li', xtype=ncd_int, dim1name='pft', & - ! long_name='1d landunit index of corresponding pft', ncid=ncid) - - !call ncd_defvar(varname='pfts1d_ci', xtype=ncd_int, dim1name='pft', & - ! long_name='1d column index of corresponding pft', ncid=ncid) - ! ---------------------------------------------------------------- - - call ncd_defvar(varname='pfts1d_wtgcell', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='pfts1d_wtlunit', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding landunit', ncid=ncid) - - call ncd_defvar(varname='pfts1d_wtcol', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding column', ncid=ncid) - - call ncd_defvar(varname='pfts1d_itype_veg', xtype=ncd_int, dim1name=namep, & - long_name='pft vegetation type', ncid=ncid) - - call ncd_defvar(varname='pfts1d_itype_col', xtype=ncd_int, dim1name=namep, & - long_name='pft column type (see global attributes)', ncid=ncid) - - call ncd_defvar(varname='pfts1d_itype_lunit', xtype=ncd_int, dim1name=namep, & - long_name='pft landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) - - call ncd_defvar(varname='pfts1d_active', xtype=ncd_log, dim1name=namep, & - long_name='true => do computations on this pft', ncid=ncid) - - else if (mode == 'write') then - - ! Determine bounds - - allocate(& - rgarr(bounds%begg:bounds%endg),& - rlarr(bounds%begl:bounds%endl),& - rcarr(bounds%begc:bounds%endc),& - rparr(bounds%begp:bounds%endp),& - stat=ier) - if (ier /= 0) then - call endrun(msg=' hfields_1dinfo allocation error of rarrs'//errMsg(sourcefile, __LINE__)) - end if - - allocate(& - igarr(bounds%begg:bounds%endg),& - ilarr(bounds%begl:bounds%endl),& - icarr(bounds%begc:bounds%endc),& - iparr(bounds%begp:bounds%endp),stat=ier) - if (ier /= 0) then - call endrun(msg=' hfields_1dinfo allocation error of iarrs'//errMsg(sourcefile, __LINE__)) - end if - - ! Write gridcell info - - call ncd_io(varname='grid1d_lon', data=grc%londeg, dim1name=nameg, ncid=ncid, flag='write') - call ncd_io(varname='grid1d_lat', data=grc%latdeg, dim1name=nameg, ncid=ncid, flag='write') - do g = bounds%begg,bounds%endg - igarr(g)= mod(ldecomp%gdc2glo(g)-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='grid1d_ixy', data=igarr , dim1name=nameg, ncid=ncid, flag='write') - do g = bounds%begg,bounds%endg - igarr(g)= (ldecomp%gdc2glo(g) - 1)/ldomain%ni + 1 - enddo - call ncd_io(varname='grid1d_jxy', data=igarr , dim1name=nameg, ncid=ncid, flag='write') - - ! Write landunit info - - do l = bounds%begl,bounds%endl - rlarr(l) = grc%londeg(lun%gridcell(l)) - enddo - call ncd_io(varname='land1d_lon', data=rlarr, dim1name=namel, ncid=ncid, flag='write') - do l = bounds%begl,bounds%endl - rlarr(l) = grc%latdeg(lun%gridcell(l)) - enddo - call ncd_io(varname='land1d_lat', data=rlarr, dim1name=namel, ncid=ncid, flag='write') - do l= bounds%begl,bounds%endl - ilarr(l) = mod(ldecomp%gdc2glo(lun%gridcell(l))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='land1d_ixy', data=ilarr, dim1name=namel, ncid=ncid, flag='write') - do l = bounds%begl,bounds%endl - ilarr(l) = (ldecomp%gdc2glo(lun%gridcell(l))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='land1d_jxy' , data=ilarr , dim1name=namel, ncid=ncid, flag='write') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 Bug 1310 - !call ncd_io(varname='land1d_gi' , data=lun%gridcell, dim1name=namel, ncid=ncid, flag='write') - ! ---------------------------------------------------------------- - call ncd_io(varname='land1d_wtgcell' , data=lun%wtgcell , dim1name=namel, ncid=ncid, flag='write') - call ncd_io(varname='land1d_ityplunit', data=lun%itype , dim1name=namel, ncid=ncid, flag='write') - call ncd_io(varname='land1d_active' , data=lun%active , dim1name=namel, ncid=ncid, flag='write') - - ! Write column info - - do c = bounds%begc,bounds%endc - rcarr(c) = grc%londeg(col%gridcell(c)) - enddo - call ncd_io(varname='cols1d_lon', data=rcarr, dim1name=namec, ncid=ncid, flag='write') - do c = bounds%begc,bounds%endc - rcarr(c) = grc%latdeg(col%gridcell(c)) - enddo - call ncd_io(varname='cols1d_lat', data=rcarr, dim1name=namec, ncid=ncid, flag='write') - do c = bounds%begc,bounds%endc - icarr(c) = mod(ldecomp%gdc2glo(col%gridcell(c))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='cols1d_ixy', data=icarr, dim1name=namec, ncid=ncid, flag='write') - do c = bounds%begc,bounds%endc - icarr(c) = (ldecomp%gdc2glo(col%gridcell(c))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='cols1d_jxy' , data=icarr ,dim1name=namec, ncid=ncid, flag='write') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 Bug 1310 - !call ncd_io(varname='cols1d_gi' , data=col%gridcell, dim1name=namec, ncid=ncid, flag='write') - !call ncd_io(varname='cols1d_li' , data=col%landunit, dim1name=namec, ncid=ncid, flag='write') - ! ---------------------------------------------------------------- - call ncd_io(varname='cols1d_wtgcell', data=col%wtgcell , dim1name=namec, ncid=ncid, flag='write') - call ncd_io(varname='cols1d_wtlunit', data=col%wtlunit , dim1name=namec, ncid=ncid, flag='write') - call ncd_io(varname='cols1d_itype_col', data=col%itype , dim1name=namec, ncid=ncid, flag='write') - - do c = bounds%begc,bounds%endc - icarr(c) = lun%itype(col%landunit(c)) - enddo - call ncd_io(varname='cols1d_itype_lunit', data=icarr , dim1name=namec, ncid=ncid, flag='write') - - call ncd_io(varname='cols1d_active' , data=col%active , dim1name=namec, ncid=ncid, flag='write') - - ! Write patch info - - do p = bounds%begp,bounds%endp - rparr(p) = grc%londeg(patch%gridcell(p)) - enddo - call ncd_io(varname='pfts1d_lon', data=rparr, dim1name=namep, ncid=ncid, flag='write') - do p = bounds%begp,bounds%endp - rparr(p) = grc%latdeg(patch%gridcell(p)) - enddo - call ncd_io(varname='pfts1d_lat', data=rparr, dim1name=namep, ncid=ncid, flag='write') - do p = bounds%begp,bounds%endp - iparr(p) = mod(ldecomp%gdc2glo(patch%gridcell(p))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='pfts1d_ixy', data=iparr, dim1name=namep, ncid=ncid, flag='write') - do p = bounds%begp,bounds%endp - iparr(p) = (ldecomp%gdc2glo(patch%gridcell(p))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='pfts1d_jxy' , data=iparr , dim1name=namep, ncid=ncid, flag='write') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_io(varname='pfts1d_gi' , data=patch%gridcell, dim1name=namep, ncid=ncid, flag='write') - !call ncd_io(varname='pfts1d_li' , data=patch%landunit, dim1name=namep, ncid=ncid, flag='write') - !call ncd_io(varname='pfts1d_ci' , data=patch%column , dim1name=namep, ncid=ncid, flag='write') - ! ---------------------------------------------------------------- - call ncd_io(varname='pfts1d_wtgcell' , data=patch%wtgcell , dim1name=namep, ncid=ncid, flag='write') - call ncd_io(varname='pfts1d_wtlunit' , data=patch%wtlunit , dim1name=namep, ncid=ncid, flag='write') - call ncd_io(varname='pfts1d_wtcol' , data=patch%wtcol , dim1name=namep, ncid=ncid, flag='write') - call ncd_io(varname='pfts1d_itype_veg', data=patch%itype , dim1name=namep, ncid=ncid, flag='write') - - do p = bounds%begp,bounds%endp - iparr(p) = col%itype(patch%column(p)) - end do - call ncd_io(varname='pfts1d_itype_col', data=iparr , dim1name=namep, ncid=ncid, flag='write') - - do p = bounds%begp,bounds%endp - iparr(p) = lun%itype(patch%landunit(p)) - enddo - call ncd_io(varname='pfts1d_itype_lunit', data=iparr , dim1name=namep, ncid=ncid, flag='write') - - call ncd_io(varname='pfts1d_active' , data=patch%active , dim1name=namep, ncid=ncid, flag='write') - - deallocate(rgarr,rlarr,rcarr,rparr) - deallocate(igarr,ilarr,icarr,iparr) - - end if - - end subroutine hfields_1dinfo - - !----------------------------------------------------------------------- - subroutine hist_htapes_wrapup( rstwr, nlend, bounds, & - watsat_col, sucsat_col, bsw_col, hksat_col) - ! - ! !DESCRIPTION: - ! Write history tape(s) - ! Determine if next time step is beginning of history interval and if so: - ! increment the current time sample counter, open a new history file - ! and if needed (i.e., when ntim = 1), write history data to current - ! history file, reset field accumulation counters to zero. - ! If primary history file is full or at the last time step of the simulation, - ! write restart dataset and close all history fiels. - ! If history file is full or at the last time step of the simulation: - ! close history file - ! and reset time sample counter to zero if file is full. - ! Daily-averaged data for the first day in September are written on - ! date = 00/09/02 with mscur = 0. - ! Daily-averaged data for the first day in month mm are written on - ! date = yyyy/mm/02 with mscur = 0. - ! Daily-averaged data for the 30th day (last day in September) are written - ! on date = 0000/10/01 mscur = 0. - ! Daily-averaged data for the last day in month mm are written on - ! date = yyyy/mm+1/01 with mscur = 0. - ! - ! !USES: - use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time, get_prev_date - use clm_varcon , only : secspday - use perf_mod , only : t_startf, t_stopf - use clm_varpar , only : nlevgrnd - ! - ! !ARGUMENTS: - logical, intent(in) :: rstwr ! true => write restart file this step - logical, intent(in) :: nlend ! true => end of run on this step - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: watsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: sucsat_col( bounds%begc:,1: ) - real(r8) , intent(in) :: bsw_col( bounds%begc:,1: ) - real(r8) , intent(in) :: hksat_col( bounds%begc:,1: ) - ! - ! !LOCAL VARIABLES: - integer :: t ! tape index - integer :: f ! field index - integer :: ier ! error code - integer :: nstep ! current step - integer :: day ! current day (1 -> 31) - integer :: mon ! current month (1 -> 12) - integer :: yr ! current year (0 -> ...) - integer :: mdcur ! current day - integer :: mscur ! seconds of current day - integer :: mcsec ! current time of day [seconds] - integer :: daym1 ! nstep-1 day (1 -> 31) - integer :: monm1 ! nstep-1 month (1 -> 12) - integer :: yrm1 ! nstep-1 year (0 -> ...) - integer :: mcsecm1 ! nstep-1 time of day [seconds] - real(r8):: time ! current time - character(len=256) :: str ! global attribute string - logical :: if_stop ! true => last time step of run - logical, save :: do_3Dtconst = .true. ! true => write out 3D time-constant data - character(len=*),parameter :: subname = 'hist_htapes_wrapup' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(watsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sucsat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(bsw_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(hksat_col) == (/bounds%endc, nlevgrnd/)), errMsg(sourcefile, __LINE__)) - - ! get current step - - nstep = get_nstep() - - ! Set calendar for current time step - - call get_curr_date (yr, mon, day, mcsec) - call get_curr_time (mdcur, mscur) - time = mdcur + mscur/secspday - - ! Set calendar for current for previous time step - - call get_prev_date (yrm1, monm1, daym1, mcsecm1) - - ! Loop over active history tapes, create new history files if necessary - ! and write data to history files if end of history interval. - do t = 1, ntapes - - ! Skip nstep=0 if monthly average - - if (nstep==0 .and. tape(t)%nhtfrq==0) cycle - - ! Determine if end of history interval - tape(t)%is_endhist = .false. - if (tape(t)%nhtfrq==0) then !monthly average - if (mon /= monm1) tape(t)%is_endhist = .true. - else - if (mod(nstep,tape(t)%nhtfrq) == 0) tape(t)%is_endhist = .true. - end if - - ! If end of history interval - - if (tape(t)%is_endhist) then - - ! Normalize history buffer if time averaged - - call hfields_normalize(t) - - ! Increment current time sample counter. - - tape(t)%ntimes = tape(t)%ntimes + 1 - - ! Create history file if appropriate and build time comment - - ! If first time sample, generate unique history file name, open file, - ! define dims, vars, etc. - - - if (tape(t)%ntimes == 1) then - call t_startf('hist_htapes_wrapup_define') - locfnh(t) = set_hist_filename (hist_freq=tape(t)%nhtfrq, & - hist_mfilt=tape(t)%mfilt, hist_file=t) - if (masterproc) then - write(iulog,*) trim(subname),' : Creating history file ', trim(locfnh(t)), & - ' at nstep = ',get_nstep() - write(iulog,*)'calling htape_create for file t = ',t - endif - call htape_create (t) - - ! Define time-constant field variables - call htape_timeconst(t, mode='define') - - ! Define 3D time-constant field variables only to first primary tape - if ( do_3Dtconst .and. t == 1 ) then - call htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='define') - TimeConst3DVars_Filename = trim(locfnh(t)) - end if - - ! Define model field variables - call hfields_write(t, mode='define') - - ! Exit define model - call ncd_enddef(nfid(t)) - call t_stopf('hist_htapes_wrapup_define') - endif - - call t_startf('hist_htapes_wrapup_tconst') - ! Write time constant history variables - call htape_timeconst(t, mode='write') - - ! Write 3D time constant history variables only to first primary tape - if ( do_3Dtconst .and. t == 1 .and. tape(t)%ntimes == 1 )then - call htape_timeconst3D(t, & - bounds, watsat_col, sucsat_col, bsw_col, hksat_col, mode='write') - do_3Dtconst = .false. - end if - - if (masterproc) then - write(iulog,*) - write(iulog,*) trim(subname),' : Writing current time sample to local history file ', & - trim(locfnh(t)),' at nstep = ',get_nstep(), & - ' for history time interval beginning at ', tape(t)%begtime, & - ' and ending at ',time - write(iulog,*) - call shr_sys_flush(iulog) - endif - - ! Update beginning time of next interval - tape(t)%begtime = time - call t_stopf('hist_htapes_wrapup_tconst') - - ! Write history time samples - call t_startf('hist_htapes_wrapup_write') - call hfields_write(t, mode='write') - call t_stopf('hist_htapes_wrapup_write') - - ! Zero necessary history buffers - call hfields_zero(t) - - end if - - end do ! end loop over history tapes - - ! Determine if file needs to be closed - - call hist_do_disp (ntapes, tape(:)%ntimes, tape(:)%mfilt, if_stop, if_disphist, rstwr, nlend) - - ! Close open history file - ! Auxilary files may have been closed and saved off without being full, - ! must reopen the files - - do t = 1, ntapes - if (if_disphist(t)) then - if (tape(t)%ntimes /= 0) then - if (masterproc) then - write(iulog,*) - write(iulog,*) trim(subname),' : Closing local history file ',& - trim(locfnh(t)),' at nstep = ', get_nstep() - write(iulog,*) - endif - - call ncd_pio_closefile(nfid(t)) - - if (.not.if_stop .and. (tape(t)%ntimes/=tape(t)%mfilt)) then - call ncd_pio_openfile (nfid(t), trim(locfnh(t)), ncd_write) - end if - else - if (masterproc) then - write(iulog,*) trim(subname),' : history tape ',t,': no open file to close' - end if - endif - endif - end do - - ! Reset number of time samples to zero if file is full - - do t = 1, ntapes - if (if_disphist(t) .and. tape(t)%ntimes==tape(t)%mfilt) then - tape(t)%ntimes = 0 - end if - end do - - end subroutine hist_htapes_wrapup - - !----------------------------------------------------------------------- - subroutine hist_restart_ncd (bounds, ncid, flag, rdate) - ! - ! !DESCRIPTION: - ! Read/write history file restart data. - ! If the current history file(s) are not full, file(s) are opened - ! so that subsequent time samples are added until the file is full. - ! A new history file is used on a branch run. - ! - ! !USES: - use clm_varctl , only : nsrest, caseid, inst_suffix, nsrStartup, nsrBranch - use fileutils , only : getfil - use domainMod , only : ldomain - use clm_varpar , only : nlevgrnd, nlevlak, numrad, nlevdecomp_full - use clm_time_manager, only : is_restart - use restUtilMod , only : iflag_skip - use pio - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf file - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name - ! - ! !LOCAL VARIABLES: - integer :: max_nflds ! Max number of fields - integer :: num1d,beg1d,end1d ! 1d size, beginning and ending indices - integer :: num1d_out,beg1d_out,end1d_out ! 1d size, beginning and ending indices - integer :: num2d ! 2d size (e.g. number of vertical levels) - integer :: numa ! total number of atm cells across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - character(len=max_namlen) :: name ! variable name - character(len=max_namlen) :: name_acc ! accumulator variable name - character(len=max_namlen) :: long_name ! long name of variable - character(len=max_chars) :: long_name_acc ! long name for accumulator - character(len=max_chars) :: units ! units of variable - character(len=max_chars) :: units_acc ! accumulator units - character(len=max_chars) :: fname ! full name of history file - character(len=max_chars) :: locrest(max_tapes) ! local history restart file names - - character(len=max_namlen),allocatable :: tname(:) - character(len=max_chars), allocatable :: tunits(:),tlongname(:) - character(len=hist_dim_name_length), allocatable :: tmpstr(:,:) - character(len=scale_type_strlen), allocatable :: p2c_scale_type(:) - character(len=scale_type_strlen), allocatable :: c2l_scale_type(:) - character(len=scale_type_strlen), allocatable :: l2g_scale_type(:) - character(len=avgflag_strlen), allocatable :: tavgflag(:) - integer :: start(2) - - character(len=1) :: hnum ! history file index - character(len=hist_dim_name_length) :: type1d ! clm pointer 1d type - character(len=hist_dim_name_length) :: type1d_out ! history buffer 1d type - character(len=hist_dim_name_length) :: type2d ! history buffer 2d type - character(len=32) :: dim1name ! temporary - character(len=32) :: dim2name ! temporary - type(var_desc_t) :: name_desc ! variable descriptor for name - type(var_desc_t) :: longname_desc ! variable descriptor for long_name - type(var_desc_t) :: units_desc ! variable descriptor for units - type(var_desc_t) :: type1d_desc ! variable descriptor for type1d - type(var_desc_t) :: type1d_out_desc ! variable descriptor for type1d_out - type(var_desc_t) :: type2d_desc ! variable descriptor for type2d - type(var_desc_t) :: avgflag_desc ! variable descriptor for avgflag - type(var_desc_t) :: p2c_scale_type_desc ! variable descriptor for p2c_scale_type - type(var_desc_t) :: c2l_scale_type_desc ! variable descriptor for c2l_scale_type - type(var_desc_t) :: l2g_scale_type_desc ! variable descriptor for l2g_scale_type - integer :: status ! error status - integer :: dimid ! dimension ID - integer :: k ! 1d index - integer :: ntapes_onfile ! number of history tapes on the restart file - integer :: nflds_onfile ! number of history fields on the restart file - integer :: t ! tape index - integer :: f ! field index - integer :: varid ! variable id - integer, allocatable :: itemp(:) ! temporary - real(r8), pointer :: hbuf(:,:) ! history buffer - real(r8), pointer :: hbuf1d(:) ! 1d history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - integer , pointer :: nacs1d(:) ! 1d accumulation counter - integer :: ier ! error code - type(Var_desc_t) :: vardesc ! netCDF variable description - character(len=*),parameter :: subname = 'hist_restart_ncd' -!------------------------------------------------------------------------ - - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump) - - ! If branch run, initialize file times and return - - if (flag == 'read') then - if (nsrest == nsrBranch) then - do t = 1,ntapes - tape(t)%ntimes = 0 - end do - return - end if - ! If startup run just return - if (nsrest == nsrStartup) then - RETURN - end if - endif - - ! Read history file data only for restart run (not for branch run) - - ! - ! First when writing out and in define mode, create files and define all variables - ! - !================================================ - if (flag == 'define') then - !================================================ - - if (.not. present(rdate)) then - call endrun(msg=' variable rdate must be present for writing restart files'//& - errMsg(sourcefile, __LINE__)) - end if - - ! - ! On master restart file add ntapes/max_chars dimension - ! and then add the history and history restart filenames - ! - call ncd_defdim( ncid, 'ntapes' , ntapes , dimid) - call ncd_defdim( ncid, 'max_chars' , max_chars , dimid) - - call ncd_defvar(ncid=ncid, varname='locfnh', xtype=ncd_char, & - long_name="History filename", & - comment="This variable NOT needed for startup or branch simulations", & - dim1name='max_chars', dim2name="ntapes" ) - ier = PIO_inq_varid(ncid, 'locfnh', vardesc) - ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_skip) - - call ncd_defvar(ncid=ncid, varname='locfnhr', xtype=ncd_char, & - long_name="Restart history filename", & - comment="This variable NOT needed for startup or branch simulations", & - dim1name='max_chars', dim2name="ntapes" ) - ier = PIO_inq_varid(ncid, 'locfnhr', vardesc) - ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_skip) - - ! max_nflds is the maximum number of fields on any tape - ! max_flds is the maximum number possible number of fields - - max_nflds = max_nFields() - - ! Loop over tapes - write out namelist information to each restart-history tape - ! only read/write accumulators and counters if needed - - do t = 1,ntapes - - ! Create the restart history filename and open it - write(hnum,'(i1.1)') t-1 - locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) & - // ".rh" // hnum //"."// trim(rdate) //".nc" - - call htape_create( t, histrest=.true. ) - - ! Add read/write accumultators and counters if needed - if (.not. tape(t)%is_endhist) then - do f = 1,tape(t)%nflds - name = tape(t)%hlist(f)%field%name - long_name = tape(t)%hlist(f)%field%long_name - units = tape(t)%hlist(f)%field%units - name_acc = trim(name) // "_acc" - units_acc = "unitless positive integer" - long_name_acc = trim(long_name) // " accumulator number of samples" - type1d_out = tape(t)%hlist(f)%field%type1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (type1d_out == grlnd) then - if (ldomain%isgrid2d) then - dim1name = 'lon' ; dim2name = 'lat' - else - dim1name = trim(grlnd); dim2name = 'undefined' - end if - else - dim1name = type1d_out ; dim2name = 'undefined' - endif - - if (dim2name == 'undefined') then - if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, & - long_name=trim(long_name_acc), units=trim(units_acc)) - else - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, dim2name=type2d, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, dim2name=type2d, & - long_name=trim(long_name_acc), units=trim(units_acc)) - end if - else - if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, dim2name=dim2name, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, dim2name=dim2name, & - long_name=trim(long_name_acc), units=trim(units_acc)) - else - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, dim2name=dim2name, dim3name=type2d, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, dim2name=dim2name, dim3name=type2d, & - long_name=trim(long_name_acc), units=trim(units_acc)) - end if - endif - end do - endif - - ! - ! Add namelist information to each restart history tape - ! - call ncd_defdim( ncid_hist(t), 'fname_lenp2' , max_namlen+2, dimid) - call ncd_defdim( ncid_hist(t), 'fname_len' , max_namlen , dimid) - call ncd_defdim( ncid_hist(t), 'avgflag_len' , avgflag_strlen, dimid) - call ncd_defdim( ncid_hist(t), 'scalar' , 1 , dimid) - call ncd_defdim( ncid_hist(t), 'max_chars' , max_chars , dimid) - call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) - call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) - - call ncd_defvar(ncid=ncid_hist(t), varname='nhtfrq', xtype=ncd_int, & - long_name="Frequency of history writes", & - comment="Namelist item", & - units="absolute value of negative is in hours, 0=monthly, positive is time-steps", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='mfilt', xtype=ncd_int, & - long_name="Number of history time samples on a file", units="unitless", & - comment="Namelist item", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='ncprec', xtype=ncd_int, & - long_name="Flag for data precision", flag_values=(/1,2/), & - comment="Namelist item", & - nvalid_range=(/1,2/), & - flag_meanings=(/"single-precision", "double-precision"/), & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='dov2xy', xtype=ncd_log, & - long_name="Output on 2D grid format (TRUE) or vector format (FALSE)", & - comment="Namelist item", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='fincl', xtype=ncd_char, & - comment="Namelist item", & - long_name="Fieldnames to include", & - dim1name='fname_lenp2', dim2name='max_flds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='fexcl', xtype=ncd_char, & - comment="Namelist item", & - long_name="Fieldnames to exclude", & - dim1name='fname_lenp2', dim2name='max_flds' ) - - call ncd_defvar(ncid=ncid_hist(t), varname='nflds', xtype=ncd_int, & - long_name="Number of fields on file", units="unitless", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='ntimes', xtype=ncd_int, & - long_name="Number of time steps on file", units="time-step", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='is_endhist', xtype=ncd_log, & - long_name="End of history file", dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='begtime', xtype=ncd_double, & - long_name="Beginning time", units="time units", & - dim1name='scalar') - - call ncd_defvar(ncid=ncid_hist(t), varname='num2d', xtype=ncd_int, & - long_name="Size of second dimension", units="unitless", & - dim1name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='hpindex', xtype=ncd_int, & - long_name="History pointer index", units="unitless", & - dim1name='max_nflds' ) - - call ncd_defvar(ncid=ncid_hist(t), varname='avgflag', xtype=ncd_char, & - long_name="Averaging flag", & - units="A=Average, X=Maximum, M=Minimum, I=Instantaneous, SUM=Sum", & - dim1name='avgflag_len', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='name', xtype=ncd_char, & - long_name="Fieldnames", & - dim1name='fname_len', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='long_name', xtype=ncd_char, & - long_name="Long descriptive names for fields", & - dim1name='max_chars', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='units', xtype=ncd_char, & - long_name="Units for each history field output", & - dim1name='max_chars', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='type1d', xtype=ncd_char, & - long_name="1st dimension type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='type1d_out', xtype=ncd_char, & - long_name="1st output dimension type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='type2d', xtype=ncd_char, & - long_name="2nd dimension type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='p2c_scale_type', xtype=ncd_char, & - long_name="PFT to column scale type", & - dim1name='scale_type_string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='c2l_scale_type', xtype=ncd_char, & - long_name="column to landunit scale type", & - dim1name='scale_type_string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='l2g_scale_type', xtype=ncd_char, & - long_name="landunit to gridpoint scale type", & - dim1name='scale_type_string_length', dim2name='max_nflds' ) - - call ncd_enddef(ncid_hist(t)) - - end do ! end of ntapes loop - - RETURN - - ! - ! First write out namelist information to each restart history file - ! - !================================================ - else if (flag == 'write') then - !================================================ - - ! Add history filenames to master restart file - do t = 1,ntapes - call ncd_io('locfnh', locfnh(t), 'write', ncid, nt=t) - call ncd_io('locfnhr', locfnhr(t), 'write', ncid, nt=t) - end do - - fincl(:,1) = hist_fincl1(:) - fincl(:,2) = hist_fincl2(:) - fincl(:,3) = hist_fincl3(:) - fincl(:,4) = hist_fincl4(:) - fincl(:,5) = hist_fincl5(:) - fincl(:,6) = hist_fincl6(:) - fincl(:,7) = hist_fincl7(:) - fincl(:,8) = hist_fincl8(:) - fincl(:,9) = hist_fincl9(:) - fincl(:,10) = hist_fincl10(:) - - fexcl(:,1) = hist_fexcl1(:) - fexcl(:,2) = hist_fexcl2(:) - fexcl(:,3) = hist_fexcl3(:) - fexcl(:,4) = hist_fexcl4(:) - fexcl(:,5) = hist_fexcl5(:) - fexcl(:,6) = hist_fexcl6(:) - fexcl(:,7) = hist_fexcl7(:) - fexcl(:,8) = hist_fexcl8(:) - fexcl(:,9) = hist_fexcl9(:) - fexcl(:,10) = hist_fexcl10(:) - - max_nflds = max_nFields() - - start(1)=1 - - - ! - ! Add history namelist data to each history restart tape - ! - allocate(itemp(max_nflds)) - - do t = 1,ntapes - call ncd_io(varname='fincl', data=fincl(:,t), ncid=ncid_hist(t), flag='write') - - call ncd_io(varname='fexcl', data=fexcl(:,t), ncid=ncid_hist(t), flag='write') - - call ncd_io(varname='is_endhist', data=tape(t)%is_endhist, ncid=ncid_hist(t), flag='write') - - call ncd_io(varname='dov2xy', data=tape(t)%dov2xy, ncid=ncid_hist(t), flag='write') - - itemp(:) = 0 - do f=1,tape(t)%nflds - itemp(f) = tape(t)%hlist(f)%field%num2d - end do - call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='write') - - itemp(:) = 0 - do f=1,tape(t)%nflds - itemp(f) = tape(t)%hlist(f)%field%hpindex - end do - call ncd_io(varname='hpindex', data=itemp(:), ncid=ncid_hist(t), flag='write') - - call ncd_io('nflds', tape(t)%nflds, 'write', ncid_hist(t) ) - call ncd_io('ntimes', tape(t)%ntimes, 'write', ncid_hist(t) ) - call ncd_io('nhtfrq', tape(t)%nhtfrq, 'write', ncid_hist(t) ) - call ncd_io('mfilt', tape(t)%mfilt, 'write', ncid_hist(t) ) - call ncd_io('ncprec', tape(t)%ncprec, 'write', ncid_hist(t) ) - call ncd_io('begtime', tape(t)%begtime, 'write', ncid_hist(t) ) - allocate(tmpstr(tape(t)%nflds,3 ),tname(tape(t)%nflds), & - tavgflag(tape(t)%nflds),tunits(tape(t)%nflds),tlongname(tape(t)%nflds), & - p2c_scale_type(tape(t)%nflds), c2l_scale_type(tape(t)%nflds), & - l2g_scale_type(tape(t)%nflds)) - do f=1,tape(t)%nflds - tname(f) = tape(t)%hlist(f)%field%name - tunits(f) = tape(t)%hlist(f)%field%units - tlongname(f) = tape(t)%hlist(f)%field%long_name - tmpstr(f,1) = tape(t)%hlist(f)%field%type1d - tmpstr(f,2) = tape(t)%hlist(f)%field%type1d_out - tmpstr(f,3) = tape(t)%hlist(f)%field%type2d - tavgflag(f) = tape(t)%hlist(f)%avgflag - p2c_scale_type(f) = tape(t)%hlist(f)%field%p2c_scale_type - c2l_scale_type(f) = tape(t)%hlist(f)%field%c2l_scale_type - l2g_scale_type(f) = tape(t)%hlist(f)%field%l2g_scale_type - end do - call ncd_io( 'name', tname, 'write',ncid_hist(t)) - call ncd_io('long_name', tlongname, 'write', ncid_hist(t)) - call ncd_io('units', tunits, 'write',ncid_hist(t)) - call ncd_io('type1d', tmpstr(:,1), 'write', ncid_hist(t)) - call ncd_io('type1d_out', tmpstr(:,2), 'write', ncid_hist(t)) - call ncd_io('type2d', tmpstr(:,3), 'write', ncid_hist(t)) - call ncd_io('avgflag',tavgflag , 'write', ncid_hist(t)) - call ncd_io('p2c_scale_type', p2c_scale_type, 'write', ncid_hist(t)) - call ncd_io('c2l_scale_type', c2l_scale_type, 'write', ncid_hist(t)) - call ncd_io('l2g_scale_type', l2g_scale_type, 'write', ncid_hist(t)) - deallocate(tname,tlongname,tunits,tmpstr,tavgflag) - deallocate(p2c_scale_type, c2l_scale_type, l2g_scale_type) - enddo - deallocate(itemp) - - ! - ! Read in namelist information - ! - !================================================ - else if (flag == 'read') then - !================================================ - - call ncd_inqdlen(ncid,dimid,ntapes_onfile, name='ntapes') - if ( is_restart() .and. ntapes_onfile /= ntapes )then - write(iulog,*) 'ntapes = ', ntapes, ' ntapes_onfile = ', ntapes_onfile - call endrun(msg=' ERROR: number of ntapes different than on restart file!,'// & - ' you can NOT change history options on restart!' //& - errMsg(sourcefile, __LINE__)) - end if - if ( is_restart() .and. ntapes > 0 )then - call ncd_io('locfnh', locfnh(1:ntapes), 'read', ncid ) - call ncd_io('locfnhr', locrest(1:ntapes), 'read', ncid ) - do t = 1,ntapes - call strip_null(locrest(t)) - call strip_null(locfnh(t)) - end do - end if - - ! Determine necessary indices - the following is needed if model decomposition is different on restart - - start(1)=1 - - if ( is_restart() )then - do t = 1,ntapes - - call getfil( locrest(t), locfnhr(t), 0 ) - call ncd_pio_openfile (ncid_hist(t), trim(locfnhr(t)), ncd_nowrite) - - if ( t == 1 )then - - call ncd_inqdlen(ncid_hist(1),dimid,max_nflds,name='max_nflds') - - allocate(itemp(max_nflds)) - end if - - call ncd_inqvid(ncid_hist(t), 'name', varid, name_desc) - call ncd_inqvid(ncid_hist(t), 'long_name', varid, longname_desc) - call ncd_inqvid(ncid_hist(t), 'units', varid, units_desc) - call ncd_inqvid(ncid_hist(t), 'type1d', varid, type1d_desc) - call ncd_inqvid(ncid_hist(t), 'type1d_out', varid, type1d_out_desc) - call ncd_inqvid(ncid_hist(t), 'type2d', varid, type2d_desc) - call ncd_inqvid(ncid_hist(t), 'avgflag', varid, avgflag_desc) - call ncd_inqvid(ncid_hist(t), 'p2c_scale_type', varid, p2c_scale_type_desc) - call ncd_inqvid(ncid_hist(t), 'c2l_scale_type', varid, c2l_scale_type_desc) - call ncd_inqvid(ncid_hist(t), 'l2g_scale_type', varid, l2g_scale_type_desc) - - call ncd_io(varname='fincl', data=fincl(:,t), ncid=ncid_hist(t), flag='read') - - call ncd_io(varname='fexcl', data=fexcl(:,t), ncid=ncid_hist(t), flag='read') - - call ncd_io('nflds', nflds_onfile, 'read', ncid_hist(t) ) - if ( nflds_onfile /= tape(t)%nflds )then - write(iulog,*) 'nflds = ', tape(t)%nflds, ' nflds_onfile = ', nflds_onfile - call endrun(msg=' ERROR: number of fields different than on restart file!,'// & - ' you can NOT change history options on restart!' //& - errMsg(sourcefile, __LINE__)) - end if - call ncd_io('ntimes', tape(t)%ntimes, 'read', ncid_hist(t) ) - call ncd_io('nhtfrq', tape(t)%nhtfrq, 'read', ncid_hist(t) ) - call ncd_io('mfilt', tape(t)%mfilt, 'read', ncid_hist(t) ) - call ncd_io('ncprec', tape(t)%ncprec, 'read', ncid_hist(t) ) - call ncd_io('begtime', tape(t)%begtime, 'read', ncid_hist(t) ) - - call ncd_io(varname='is_endhist', data=tape(t)%is_endhist, ncid=ncid_hist(t), flag='read') - call ncd_io(varname='dov2xy', data=tape(t)%dov2xy, ncid=ncid_hist(t), flag='read') - call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='read') - do f=1,tape(t)%nflds - tape(t)%hlist(f)%field%num2d = itemp(f) - end do - - call ncd_io(varname='hpindex', data=itemp(:), ncid=ncid_hist(t), flag='read') - do f=1,tape(t)%nflds - tape(t)%hlist(f)%field%hpindex = itemp(f) - end do - - do f=1,tape(t)%nflds - start(2) = f - call ncd_io( name_desc, tape(t)%hlist(f)%field%name, & - 'read', ncid_hist(t), start ) - call ncd_io( longname_desc, tape(t)%hlist(f)%field%long_name, & - 'read', ncid_hist(t), start ) - call ncd_io( units_desc, tape(t)%hlist(f)%field%units, & - 'read', ncid_hist(t), start ) - call ncd_io( type1d_desc, tape(t)%hlist(f)%field%type1d, & - 'read', ncid_hist(t), start ) - call ncd_io( type1d_out_desc, tape(t)%hlist(f)%field%type1d_out, & - 'read', ncid_hist(t), start ) - call ncd_io( type2d_desc, tape(t)%hlist(f)%field%type2d, & - 'read', ncid_hist(t), start ) - call ncd_io( avgflag_desc, tape(t)%hlist(f)%avgflag, & - 'read', ncid_hist(t), start ) - call ncd_io( p2c_scale_type_desc, tape(t)%hlist(f)%field%p2c_scale_type, & - 'read', ncid_hist(t), start ) - call ncd_io( c2l_scale_type_desc, tape(t)%hlist(f)%field%c2l_scale_type, & - 'read', ncid_hist(t), start ) - call ncd_io( l2g_scale_type_desc, tape(t)%hlist(f)%field%l2g_scale_type, & - 'read', ncid_hist(t), start ) - call strip_null(tape(t)%hlist(f)%field%name) - call strip_null(tape(t)%hlist(f)%field%long_name) - call strip_null(tape(t)%hlist(f)%field%units) - call strip_null(tape(t)%hlist(f)%field%type1d) - call strip_null(tape(t)%hlist(f)%field%type1d_out) - call strip_null(tape(t)%hlist(f)%field%type2d) - call strip_null(tape(t)%hlist(f)%field%p2c_scale_type) - call strip_null(tape(t)%hlist(f)%field%c2l_scale_type) - call strip_null(tape(t)%hlist(f)%field%l2g_scale_type) - call strip_null(tape(t)%hlist(f)%avgflag) - - type1d_out = trim(tape(t)%hlist(f)%field%type1d_out) - select case (trim(type1d_out)) - case (grlnd) - num1d_out = numg - beg1d_out = bounds%begg - end1d_out = bounds%endg - case (nameg) - num1d_out = numg - beg1d_out = bounds%begg - end1d_out = bounds%endg - case (namel) - num1d_out = numl - beg1d_out = bounds%begl - end1d_out = bounds%endl - case (namec) - num1d_out = numc - beg1d_out = bounds%begc - end1d_out = bounds%endc - case (namep) - num1d_out = nump - beg1d_out = bounds%begp - end1d_out = bounds%endp - case default - write(iulog,*) trim(subname),' ERROR: read unknown 1d output type=',trim(type1d_out) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - tape(t)%hlist(f)%field%num1d_out = num1d_out - tape(t)%hlist(f)%field%beg1d_out = beg1d_out - tape(t)%hlist(f)%field%end1d_out = end1d_out - - num2d = tape(t)%hlist(f)%field%num2d - allocate (tape(t)%hlist(f)%hbuf(beg1d_out:end1d_out,num2d), & - tape(t)%hlist(f)%nacs(beg1d_out:end1d_out,num2d), & - stat=status) - if (status /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for hbuf,nacs at t,f=',t,f - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - tape(t)%hlist(f)%hbuf(:,:) = 0._r8 - tape(t)%hlist(f)%nacs(:,:) = 0 - - type1d = tape(t)%hlist(f)%field%type1d - select case (type1d) - case (grlnd) - num1d = numg - beg1d = bounds%begg - end1d = bounds%endg - case (nameg) - num1d = numg - beg1d = bounds%begg - end1d = bounds%endg - case (namel) - num1d = numl - beg1d = bounds%begl - end1d = bounds%endl - case (namec) - num1d = numc - beg1d = bounds%begc - end1d = bounds%endc - case (namep) - num1d = nump - beg1d = bounds%begp - end1d = bounds%endp - case default - write(iulog,*) trim(subname),' ERROR: read unknown 1d type=',type1d - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - tape(t)%hlist(f)%field%num1d = num1d - tape(t)%hlist(f)%field%beg1d = beg1d - tape(t)%hlist(f)%field%end1d = end1d - - end do ! end of flds loop - - ! If history file is not full, open it - - if (tape(t)%ntimes /= 0) then - call ncd_pio_openfile (nfid(t), trim(locfnh(t)), ncd_write) - end if - - end do ! end of tapes loop - - hist_fincl1(:) = fincl(:,1) - hist_fincl2(:) = fincl(:,2) - hist_fincl3(:) = fincl(:,3) - hist_fincl4(:) = fincl(:,4) - hist_fincl5(:) = fincl(:,5) - hist_fincl6(:) = fincl(:,6) - hist_fincl7(:) = fincl(:,7) - hist_fincl8(:) = fincl(:,8) - hist_fincl9(:) = fincl(:,9) - hist_fincl10(:) = fincl(:,10) - - hist_fexcl1(:) = fexcl(:,1) - hist_fexcl2(:) = fexcl(:,2) - hist_fexcl3(:) = fexcl(:,3) - hist_fexcl4(:) = fexcl(:,4) - hist_fexcl5(:) = fexcl(:,5) - hist_fexcl6(:) = fexcl(:,6) - hist_fexcl7(:) = fexcl(:,7) - hist_fexcl8(:) = fexcl(:,8) - hist_fexcl9(:) = fexcl(:,9) - hist_fexcl10(:) = fexcl(:,10) - - end if - - if ( allocated(itemp) ) deallocate(itemp) - - end if - - !====================================================================== - ! Read/write history file restart data. - ! If the current history file(s) are not full, file(s) are opened - ! so that subsequent time samples are added until the file is full. - ! A new history file is used on a branch run. - !====================================================================== - - if (flag == 'write') then - - do t = 1,ntapes - if (.not. tape(t)%is_endhist) then - - do f = 1,tape(t)%nflds - name = tape(t)%hlist(f)%field%name - name_acc = trim(name) // "_acc" - type1d_out = tape(t)%hlist(f)%field%type1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (num2d == 1) then - allocate(hbuf1d(beg1d_out:end1d_out), & - nacs1d(beg1d_out:end1d_out), stat=status) - if (status /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - hbuf1d(beg1d_out:end1d_out) = hbuf(beg1d_out:end1d_out,1) - nacs1d(beg1d_out:end1d_out) = nacs(beg1d_out:end1d_out,1) - - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name), & - dim1name=type1d_out, data=hbuf1d) - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs1d) - - deallocate(hbuf1d) - deallocate(nacs1d) - else - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name), & - dim1name=type1d_out, data=hbuf) - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs) - end if - - end do - - end if ! end of is_endhist block - - call ncd_pio_closefile(ncid_hist(t)) - - end do ! end of ntapes loop - - else if (flag == 'read') then - - ! Read history restart information if history files are not full - - do t = 1,ntapes - - if (.not. tape(t)%is_endhist) then - - do f = 1,tape(t)%nflds - name = tape(t)%hlist(f)%field%name - name_acc = trim(name) // "_acc" - type1d_out = tape(t)%hlist(f)%field%type1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (num2d == 1) then - allocate(hbuf1d(beg1d_out:end1d_out), & - nacs1d(beg1d_out:end1d_out), stat=status) - if (status /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & - dim1name=type1d_out, data=hbuf1d) - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs1d) - - hbuf(beg1d_out:end1d_out,1) = hbuf1d(beg1d_out:end1d_out) - nacs(beg1d_out:end1d_out,1) = nacs1d(beg1d_out:end1d_out) - - deallocate(hbuf1d) - deallocate(nacs1d) - else - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & - dim1name=type1d_out, data=hbuf) - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs) - end if - end do - - end if - - call ncd_pio_closefile(ncid_hist(t)) - - end do - - end if - - end subroutine hist_restart_ncd - - !----------------------------------------------------------------------- - integer function max_nFields() - ! - ! !DESCRIPTION: - ! Get the maximum number of fields on all tapes. - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: t ! index - character(len=*),parameter :: subname = 'max_nFields' - !----------------------------------------------------------------------- - - max_nFields = 0 - do t = 1,ntapes - max_nFields = max(max_nFields, tape(t)%nflds) - end do - return - end function max_nFields - - !----------------------------------------------------------------------- - character(len=max_namlen) function getname (inname) - ! - ! !DESCRIPTION: - ! Retrieve name portion of inname. If an averaging flag separater character - ! is present (:) in inname, lop it off. - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: inname - ! - ! !LOCAL VARIABLES: - integer :: length - integer :: i - character(len=*),parameter :: subname = 'getname' - !----------------------------------------------------------------------- - - length = len (inname) - - if (length < max_namlen .or. length > max_namlen+2) then - write(iulog,*) trim(subname),' ERROR: bad length=',length - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - getname = ' ' - do i = 1,max_namlen - if (inname(i:i) == ':') exit - getname(i:i) = inname(i:i) - end do - - end function getname - - !----------------------------------------------------------------------- - character(len=1) function getflag (inname) - ! - ! !DESCRIPTION: - ! Retrieve flag portion of inname. If an averaging flag separater character - ! is present (:) in inname, return the character after it as the flag - ! - ! !ARGUMENTS: - character(len=*) inname ! character string - ! - ! !LOCAL VARIABLES: - integer :: length ! length of inname - integer :: i ! loop index - character(len=*),parameter :: subname = 'getflag' - !----------------------------------------------------------------------- - - length = len (inname) - - if (length < max_namlen .or. length > max_namlen+2) then - write(iulog,*) trim(subname),' ERROR: bad length=',length - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - getflag = ' ' - do i = 1,length - if (inname(i:i) == ':') then - getflag = inname(i+1:i+1) - exit - end if - end do - - end function getflag - - !----------------------------------------------------------------------- - subroutine list_index (list, name, index) - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: list(max_flds) ! input list of names, possibly ":" delimited - character(len=max_namlen), intent(in) :: name ! name to be searched for - integer, intent(out) :: index ! index of "name" in "list" - ! - ! !LOCAL VARIABLES: - !EOP - character(len=max_namlen) :: listname ! input name with ":" stripped off. - integer f ! field index - character(len=*),parameter :: subname = 'list_index' - !----------------------------------------------------------------------- - - ! Only list items - - index = 0 - do f=1,max_flds - listname = getname (list(f)) - if (listname == ' ') exit - if (listname == name) then - index = f - exit - end if - end do - - end subroutine list_index - - !----------------------------------------------------------------------- - character(len=max_length_filename) function set_hist_filename (hist_freq, hist_mfilt, hist_file) - ! - ! !DESCRIPTION: - ! Determine history dataset filenames. - ! - ! !USES: - use clm_varctl, only : caseid, inst_suffix - use clm_time_manager, only : get_curr_date, get_prev_date - ! - ! !ARGUMENTS: - integer, intent(in) :: hist_freq !history file frequency - integer, intent(in) :: hist_mfilt !history file number of time-samples - integer, intent(in) :: hist_file !history file index - ! - ! !LOCAL VARIABLES: - !EOP - character(len=max_chars) :: cdate !date char string - character(len= 1) :: hist_index !p,1 or 2 (currently) - integer :: day !day (1 -> 31) - integer :: mon !month (1 -> 12) - integer :: yr !year (0 -> ...) - integer :: sec !seconds into current day - integer :: filename_length - character(len=*),parameter :: subname = 'set_hist_filename' - !----------------------------------------------------------------------- - - if (hist_freq == 0 .and. hist_mfilt == 1) then !monthly - call get_prev_date (yr, mon, day, sec) - write(cdate,'(i4.4,"-",i2.2)') yr,mon - else !other - call get_curr_date (yr, mon, day, sec) - write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec - endif - write(hist_index,'(i1.1)') hist_file - 1 - set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& - ".h"//hist_index//"."//trim(cdate)//".nc" - - ! check to see if the concatenated filename exceeded the - ! length. Simplest way to do this is ensure that the file - ! extension is '.nc'. - filename_length = len_trim(set_hist_filename) - if (set_hist_filename(filename_length-2:filename_length) /= '.nc') then - write(iulog, '(a,a,a,a,a)') 'ERROR: ', subname, & - ' : expected file extension ".nc", received extension "', & - set_hist_filename(filename_length-2:filename_length), '"' - write(iulog, '(a,a,a,a,a)') 'ERROR: ', subname, & - ' : filename : "', set_hist_filename, '"' - write(iulog, '(a,a,a,i3,a,i3)') 'ERROR: ', subname, & - ' Did the constructed filename exceed the maximum length? : filename length = ', & - filename_length, ', max length = ', max_length_filename - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end function set_hist_filename - - !----------------------------------------------------------------------- - subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & - ptr_gcell, ptr_lunit, ptr_col, ptr_patch, ptr_lnd, & - ptr_atm, p2c_scale_type, c2l_scale_type, & - l2g_scale_type, set_lake, set_nolake, set_urb, set_nourb, & - set_noglcmec, set_spec, default) - ! - ! !DESCRIPTION: - ! Initialize a single level history field. The pointer, ptrhist, - ! is a pointer to the data type array that the history buffer will use. - ! The value of type1d passed to masterlist\_add\_fld determines which of the - ! 1d type of the output and the beginning and ending indices the history - ! buffer field). Default history contents for given field on all tapes - ! are set by calling [masterlist\_make\_active] for the appropriate tape. - ! After the masterlist is built, routine [htapes\_build] is called for an - ! initial or branch run to initialize the actual history tapes. - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: units ! units of field - character(len=*), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - character(len=*), optional, intent(in) :: type1d_out ! output type (from data type) - real(r8) , optional, pointer :: ptr_gcell(:) ! pointer to gridcell array - real(r8) , optional, pointer :: ptr_lunit(:) ! pointer to landunit array - real(r8) , optional, pointer :: ptr_col(:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:) ! pointer to patch array - real(r8) , optional, pointer :: ptr_lnd(:) ! pointer to lnd array - real(r8) , optional, pointer :: ptr_atm(:) ! pointer to atm array - real(r8) , optional, intent(in) :: set_lake ! value to set lakes to - real(r8) , optional, intent(in) :: set_nolake ! value to set non-lakes to - real(r8) , optional, intent(in) :: set_urb ! value to set urban to - real(r8) , optional, intent(in) :: set_nourb ! value to set non-urban to - real(r8) , optional, intent(in) :: set_noglcmec ! value to set non-glacier_mec to - real(r8) , optional, intent(in) :: set_spec ! value to set special to - character(len=*), optional, intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), optional, intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g ! indices - integer :: hpindex ! history buffer pointer index - character(len=hist_dim_name_length) :: l_type1d ! 1d data type - character(len=hist_dim_name_length) :: l_type1d_out ! 1d output type - character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column - character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits - character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds ! boudns - character(len=16):: l_default ! local version of 'default' - character(len=*),parameter :: subname = 'hist_addfld1d' -!------------------------------------------------------------------------ - - ! Determine processor bounds - - call get_proc_bounds(bounds) - - ! History buffer pointer - - hpindex = pointer_index() - - if (present(ptr_lnd)) then - l_type1d = grlnd - l_type1d_out = grlnd - clmptr_rs(hpindex)%ptr => ptr_lnd - - else if (present(ptr_gcell)) then - l_type1d = nameg - l_type1d_out = nameg - clmptr_rs(hpindex)%ptr => ptr_gcell - - else if (present(ptr_lunit)) then - l_type1d = namel - l_type1d_out = namel - clmptr_rs(hpindex)%ptr => ptr_lunit - if (present(set_lake)) then - do l = bounds%begl,bounds%endl - if (lun%lakpoi(l)) ptr_lunit(l) = set_lake - end do - end if - if (present(set_nolake)) then - do l = bounds%begl,bounds%endl - if (.not.(lun%lakpoi(l))) ptr_lunit(l) = set_nolake - end do - end if - if (present(set_urb)) then - do l = bounds%begl,bounds%endl - if (lun%urbpoi(l)) ptr_lunit(l) = set_urb - end do - end if - if (present(set_nourb)) then - do l = bounds%begl,bounds%endl - if (.not.(lun%urbpoi(l))) ptr_lunit(l) = set_nourb - end do - end if - if (present(set_spec)) then - do l = bounds%begl,bounds%endl - if (lun%ifspecial(l)) ptr_lunit(l) = set_spec - end do - end if - - else if (present(ptr_col)) then - l_type1d = namec - l_type1d_out = namec - clmptr_rs(hpindex)%ptr => ptr_col - if (present(set_lake)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (lun%lakpoi(l)) ptr_col(c) = set_lake - end do - end if - if (present(set_nolake)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (.not.(lun%lakpoi(l))) ptr_col(c) = set_nolake - end do - end if - if (present(set_urb)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (lun%urbpoi(l)) ptr_col(c) = set_urb - end do - end if - if (present(set_nourb)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (.not.(lun%urbpoi(l))) ptr_col(c) = set_nourb - end do - end if - if (present(set_spec)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (lun%ifspecial(l)) ptr_col(c) = set_spec - end do - end if - if (present(set_noglcmec)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (.not.(lun%glcmecpoi(l))) ptr_col(c) = set_noglcmec - end do - endif - - else if (present(ptr_patch)) then - l_type1d = namep - l_type1d_out = namep - clmptr_rs(hpindex)%ptr => ptr_patch - if (present(set_lake)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (lun%lakpoi(l)) ptr_patch(p) = set_lake - end do - end if - if (present(set_nolake)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (.not.(lun%lakpoi(l))) ptr_patch(p) = set_nolake - end do - end if - if (present(set_urb)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (lun%urbpoi(l)) ptr_patch(p) = set_urb - end do - end if - if (present(set_nourb)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (.not.(lun%urbpoi(l))) ptr_patch(p) = set_nourb - end do - end if - if (present(set_spec)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (lun%ifspecial(l)) ptr_patch(p) = set_spec - end do - end if - if (present(set_noglcmec)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (.not.(lun%glcmecpoi(l))) ptr_patch(p) = set_noglcmec - end do - end if - else - write(iulog,*) trim(subname),' ERROR: must specify a valid pointer index,', & - ' choices are [ptr_atm, ptr_lnd, ptr_gcell, ptr_lunit, ptr_col, ptr_patch] ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end if - - ! Set scaling factor - - scale_type_p2c = 'unity' - scale_type_c2l = 'unity' - scale_type_l2g = 'unity' - - if (present(p2c_scale_type)) scale_type_p2c = p2c_scale_type - if (present(c2l_scale_type)) scale_type_c2l = c2l_scale_type - if (present(l2g_scale_type)) scale_type_l2g = l2g_scale_type - if (present(type1d_out)) l_type1d_out = type1d_out - - ! Add field to masterlist - - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d='unset', num2d=1, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g) - - l_default = 'active' - if (present(default)) then - l_default = default - end if - if (trim(l_default) == 'inactive') then - return - else - call masterlist_make_active (name=trim(fname), tape_index=1) - end if - - end subroutine hist_addfld1d - - !----------------------------------------------------------------------- - subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, & - ptr_gcell, ptr_lunit, ptr_col, ptr_patch, ptr_lnd, ptr_atm, & - p2c_scale_type, c2l_scale_type, l2g_scale_type, & - set_lake, set_nolake, set_urb, set_nourb, set_spec, & - no_snow_behavior, default) - ! - ! !DESCRIPTION: - ! Initialize a single level history field. The pointer, ptrhist, - ! is a pointer to the data type array that the history buffer will use. - ! The value of type1d passed to masterlist\_add\_fld determines which of the - ! 1d type of the output and the beginning and ending indices the history - ! buffer field). Default history contents for given field on all tapes - ! are set by calling [masterlist\_make\_active] for the appropriatae tape. - ! After the masterlist is built, routine [htapes\_build] is called for an - ! initial or branch run to initialize the actual history tapes. - ! - ! !USES: - use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, numrad, nlevdecomp_full, nlevcan, nvegwcs,nlevsoi - use clm_varpar , only : natpft_size, cft_size, maxpatch_glcmec - use landunit_varcon , only : max_lunit - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type2d ! 2d output type - character(len=*), intent(in) :: units ! units of field - character(len=*), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - character(len=*), optional, intent(in) :: type1d_out ! output type (from data type) - real(r8) , optional, pointer :: ptr_atm(:,:) ! pointer to atm array - real(r8) , optional, pointer :: ptr_lnd(:,:) ! pointer to lnd array - real(r8) , optional, pointer :: ptr_gcell(:,:) ! pointer to gridcell array - real(r8) , optional, pointer :: ptr_lunit(:,:) ! pointer to landunit array - real(r8) , optional, pointer :: ptr_col(:,:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:,:) ! pointer to patch array - real(r8) , optional, intent(in) :: set_lake ! value to set lakes to - real(r8) , optional, intent(in) :: set_nolake ! value to set non-lakes to - real(r8) , optional, intent(in) :: set_urb ! value to set urban to - real(r8) , optional, intent(in) :: set_nourb ! value to set non-urban to - real(r8) , optional, intent(in) :: set_spec ! value to set special to - integer , optional, intent(in) :: no_snow_behavior ! if a multi-layer snow field, behavior to use for absent snow layers (should be one of the public no_snow_* parameters defined above) - character(len=*), optional, intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), optional, intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g ! indices - integer :: num2d ! size of second dimension (e.g. number of vertical levels) - integer :: hpindex ! history buffer index - character(len=hist_dim_name_length) :: l_type1d ! 1d data type - character(len=hist_dim_name_length) :: l_type1d_out ! 1d output type - character(len=scale_type_strlen) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column - character(len=scale_type_strlen) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits - character(len=scale_type_strlen) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - type(bounds_type):: bounds - character(len=16):: l_default ! local version of 'default' - character(len=*),parameter :: subname = 'hist_addfld2d' -!------------------------------------------------------------------------ - - call get_proc_bounds(bounds) - - ! Error-check no_snow_behavior optional argument: It should be present if and only if - ! type2d is 'levsno', and its value should be one of the public no_snow_* parameters - ! defined above. - if (present(no_snow_behavior)) then - if (type2d /= 'levsno') then - write(iulog,*) trim(subname), & - ' ERROR: Only specify no_snow_behavior for fields with dimension levsno' - call endrun() - end if - - if (no_snow_behavior < no_snow_MIN .or. no_snow_behavior > no_snow_MAX) then - write(iulog,*) trim(subname), & - ' ERROR: Invalid value for no_snow_behavior: ', no_snow_behavior - call endrun() - end if - - else ! no_snow_behavior is absent - if (type2d == 'levsno') then - write(iulog,*) trim(subname), & - ' ERROR: must specify no_snow_behavior for fields with dimension levsno' - call endrun() - end if - end if - - ! Determine second dimension size - - select case (type2d) - case ('levgrnd') - num2d = nlevgrnd - case ('levsoi') - num2d = nlevsoi - case ('levlak') - num2d = nlevlak - case ('numrad') - num2d = numrad - case ('levdcmp') - num2d = nlevdecomp_full - case ('fates_levscls') - num2d = nlevsclass - case ('fates_levpft') - num2d = numpft_ed - case ('fates_levage') - num2d = nlevage - case ('fates_levfuel') - num2d = nfsc - case ('fates_levcwdsc') - num2d = ncwd - case ('fates_levscpf') - num2d = nlevsclass*numpft_ed - case ('fates_levscag') - num2d = nlevsclass*nlevage - case ('fates_levcan') - num2d = nclmax - case ('fates_levcnlf') - num2d = nlevleaf * nclmax - case ('fates_levcnlfpf') - num2d = nlevleaf * nclmax * numpft_ed - case ('ltype') - num2d = max_lunit - case ('natpft') - num2d = natpft_size - case('cft') - if (cft_size > 0) then - num2d = cft_size - else - write(iulog,*) trim(subname),' ERROR: 2d type =', trim(type2d), & - ' only valid for cft_size > 0' - call endrun() - end if - case ('glc_nec') - num2d = maxpatch_glcmec - case ('elevclas') - ! add one because indexing starts at 0 (elevclas, unlike glc_nec, includes the - ! bare ground "elevation class") - num2d = maxpatch_glcmec + 1 - case ('levsno') - num2d = nlevsno - case ('nlevcan') - num2d = nlevcan - case ('nvegwcs') - num2d = nvegwcs - case default - write(iulog,*) trim(subname),' ERROR: unsupported 2d type ',type2d, & - ' currently supported types for multi level fields are: ', & - '[levgrnd,levsoi,levlak,numrad,levdcmp,levtrc,ltype,natpft,cft,glc_nec,elevclas,levsno,nvegwcs]' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - ! History buffer pointer - - hpindex = pointer_index() - - if (present(ptr_lnd)) then - l_type1d = grlnd - l_type1d_out = grlnd - clmptr_ra(hpindex)%ptr => ptr_lnd - - else if (present(ptr_gcell)) then - l_type1d = nameg - l_type1d_out = nameg - clmptr_ra(hpindex)%ptr => ptr_gcell - - else if (present(ptr_lunit)) then - l_type1d = namel - l_type1d_out = namel - clmptr_ra(hpindex)%ptr => ptr_lunit - if (present(set_lake)) then - do l = bounds%begl,bounds%endl - if (lun%lakpoi(l)) ptr_lunit(l,:) = set_lake - end do - end if - if (present(set_nolake)) then - do l = bounds%begl,bounds%endl - if (.not.(lun%lakpoi(l))) ptr_lunit(l,:) = set_nolake - end do - end if - if (present(set_urb)) then - do l = bounds%begl,bounds%endl - if (lun%urbpoi(l)) ptr_lunit(l,:) = set_urb - end do - end if - if (present(set_nourb)) then - do l = bounds%begl,bounds%endl - if (.not.(lun%urbpoi(l))) ptr_lunit(l,:) = set_nourb - end do - end if - if (present(set_spec)) then - do l = bounds%begl,bounds%endl - if (lun%ifspecial(l)) ptr_lunit(l,:) = set_spec - end do - end if - - else if (present(ptr_col)) then - l_type1d = namec - l_type1d_out = namec - clmptr_ra(hpindex)%ptr => ptr_col - if (present(set_lake)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (lun%lakpoi(l)) ptr_col(c,:) = set_lake - end do - end if - if (present(set_nolake)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (.not.(lun%lakpoi(l))) ptr_col(c,:) = set_nolake - end do - end if - if (present(set_urb)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (lun%urbpoi(l)) ptr_col(c,:) = set_urb - end do - end if - if (present(set_nourb)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (.not.(lun%urbpoi(l))) ptr_col(c,:) = set_nourb - end do - end if - if (present(set_spec)) then - do c = bounds%begc,bounds%endc - l =col%landunit(c) - if (lun%ifspecial(l)) ptr_col(c,:) = set_spec - end do - end if - - else if (present(ptr_patch)) then - l_type1d = namep - l_type1d_out = namep - clmptr_ra(hpindex)%ptr => ptr_patch - if (present(set_lake)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (lun%lakpoi(l)) ptr_patch(p,:) = set_lake - end do - end if - if (present(set_nolake)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (.not.(lun%lakpoi(l))) ptr_patch(p,:) = set_nolake - end do - end if - if (present(set_urb)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (lun%urbpoi(l)) ptr_patch(p,:) = set_urb - end do - end if - if (present(set_nourb)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (.not.(lun%urbpoi(l))) ptr_patch(p,:) = set_nourb - end do - end if - if (present(set_spec)) then - do p = bounds%begp,bounds%endp - l =patch%landunit(p) - if (lun%ifspecial(l)) ptr_patch(p,:) = set_spec - end do - end if - - else - write(iulog,*) trim(subname),' ERROR: must specify a valid pointer index,', & - ' choices are ptr_atm, ptr_lnd, ptr_gcell, ptr_lunit, ptr_col, ptr_patch' - call endrun(msg=errMsg(sourcefile, __LINE__)) - - end if - - ! Set scaling factor - - scale_type_p2c = 'unity' - scale_type_c2l = 'unity' - scale_type_l2g = 'unity' - - if (present(p2c_scale_type)) scale_type_p2c = p2c_scale_type - if (present(c2l_scale_type)) scale_type_c2l = c2l_scale_type - if (present(l2g_scale_type)) scale_type_l2g = l2g_scale_type - if (present(type1d_out)) l_type1d_out = type1d_out - - ! Add field to masterlist - - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d=type2d, num2d=num2d, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g, & - no_snow_behavior=no_snow_behavior) - - l_default = 'active' - if (present(default)) then - l_default = default - end if - if (trim(l_default) == 'inactive') then - return - else - call masterlist_make_active (name=trim(fname), tape_index=1) - end if - - end subroutine hist_addfld2d - - !----------------------------------------------------------------------- - subroutine hist_addfld_decomp (fname, type2d, units, avgflag, long_name, ptr_col, & - ptr_patch, l2g_scale_type, default) - - ! - ! !USES: - use clm_varpar , only : nlevdecomp_full - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type2d ! 2d output type - character(len=*), intent(in) :: units ! units of field - character(len=*), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - real(r8) , optional, pointer :: ptr_col(:,:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:,:) ! pointer to patch array - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: ptr_1d(:) - !----------------------------------------------------------------------- - - if (present(ptr_col)) then - - ! column-level data - if (present(default)) then - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_col, l2g_scale_type=l2g_scale_type, default=default) - else - ptr_1d => ptr_col(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_1d, l2g_scale_type=l2g_scale_type, default=default) - endif - else - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_col, l2g_scale_type=l2g_scale_type) - else - ptr_1d => ptr_col(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_col=ptr_1d, l2g_scale_type=l2g_scale_type) - endif - endif - - else if (present(ptr_patch)) then - - ! patch-level data - if (present(default)) then - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_patch, l2g_scale_type=l2g_scale_type, default=default) - else - ptr_1d => ptr_patch(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_1d, l2g_scale_type=l2g_scale_type, default=default) - endif - else - if ( nlevdecomp_full > 1 ) then - call hist_addfld2d (fname=trim(fname), units=units, type2d=type2d, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_patch, l2g_scale_type=l2g_scale_type) - else - ptr_1d => ptr_patch(:,1) - call hist_addfld1d (fname=trim(fname), units=units, & - avgflag=avgflag, long_name=long_name, & - ptr_patch=ptr_1d, l2g_scale_type=l2g_scale_type) - endif - endif - - else - write(iulog, *) ' error: hist_addfld_decomp needs either patch or column level pointer' - write(iulog, *) fname - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - end subroutine hist_addfld_decomp - - !----------------------------------------------------------------------- - integer function pointer_index () - ! - ! !DESCRIPTION: - ! Set the current pointer index and increment the value of the index. - ! - ! !ARGUMENTS: - ! - integer, save :: lastindex = 1 - character(len=*),parameter :: subname = 'pointer_index' - !----------------------------------------------------------------------- - - pointer_index = lastindex - lastindex = lastindex + 1 - if (lastindex > max_mapflds) then - write(iulog,*) trim(subname),' ERROR: ',& - ' lastindex = ',lastindex,' greater than max_mapflds= ',max_mapflds - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - - end function pointer_index - - !----------------------------------------------------------------------- - subroutine hist_add_subscript(name, dim) - ! - ! !DESCRIPTION: - ! Add a history variable to the output history tape. - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: name ! name of subscript - integer , intent(in) :: dim ! dimension of subscript - ! - ! !LOCAL VARIABLES: - character(len=*),parameter :: subname = 'hist_add_subscript' - !----------------------------------------------------------------------- - - num_subs = num_subs + 1 - if (num_subs > max_subs) then - write(iulog,*) trim(subname),' ERROR: ',& - ' num_subs = ',num_subs,' greater than max_subs= ',max_subs - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - subs_name(num_subs) = name - subs_dim(num_subs) = dim - - end subroutine hist_add_subscript - - !----------------------------------------------------------------------- - - subroutine strip_null(str) - character(len=*), intent(inout) :: str - integer :: i - do i=1,len(str) - if(ichar(str(i:i))==0) str(i:i)=' ' - end do - end subroutine strip_null - - !------------------------------------------------------------------------ - subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rstwr, nlend) - ! - ! !DESCRIPTION: - ! Determine logic for closeing and/or disposing history file - ! Sets values for if_disphist, if_stop (arguments) - ! Remove history files unless this is end of run or - ! history file is not full. - ! - ! !USES: - use clm_time_manager, only : is_last_step - ! - ! !ARGUMENTS: - integer, intent(in) :: ntapes !actual number of history tapes - integer, intent(in) :: hist_ntimes(ntapes) !current numbers of time samples on history tape - integer, intent(in) :: hist_mfilt(ntapes) !maximum number of time samples per tape - logical, intent(out) :: if_stop !true => last time step of run - logical, intent(out) :: if_disphist(ntapes) !true => save and dispose history file - logical, intent(in) :: rstwr - logical, intent(in) :: nlend - ! - ! !LOCAL VARIABLES: - integer :: t ! history tape index - logical :: rest_now ! temporary - logical :: stop_now ! temporary - !------------------------------------------------------------------------ - - rest_now = .false. - stop_now = .false. - - if (nlend) stop_now = .true. - if (rstwr) rest_now = .true. - - if_stop = stop_now - - if (stop_now) then - ! End of run - dispose all history files - - if_disphist(1:ntapes) = .true. - - else if (rest_now) then - ! Restart - dispose all history files - - do t = 1,ntapes - if_disphist(t) = .true. - end do - else - ! Dispose - - if_disphist(1:ntapes) = .false. - do t = 1,ntapes - if (hist_ntimes(t) == hist_mfilt(t)) then - if_disphist(t) = .true. - endif - end do - endif - - end subroutine hist_do_disp - - !----------------------------------------------------------------------- - function avgflag_valid(avgflag, blank_valid) result(valid) - ! - ! !DESCRIPTION: - ! Returns true if the given avgflag is a valid option, false if not - ! - ! !USES: - ! - ! !ARGUMENTS: - logical :: valid ! function result - character(len=*), intent(in) :: avgflag - logical, intent(in) :: blank_valid ! whether ' ' is a valid avgflag in this context - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'avgflag_valid' - !----------------------------------------------------------------------- - - ! This initial check is mainly here to catch the possibility that someone has added a - ! new "valid" avgflag option that exceeds avgflag_strlen - if (len_trim(avgflag) > avgflag_strlen) then - valid = .false. - - else if (avgflag == ' ' .and. blank_valid) then - valid = .true. - else if (avgflag == 'A' .or. avgflag == 'I' .or. & - avgflag == 'X' .or. avgflag == 'M' .or. & - avgflag == 'SUM') then - valid = .true. - else - valid = .false. - end if - - end function avgflag_valid - - -end module histFileMod - diff --git a/src/main/initGridCellsMod.F90 b/src/main/initGridCellsMod.F90 deleted file mode 100644 index e7053130db..0000000000 --- a/src/main/initGridCellsMod.F90 +++ /dev/null @@ -1,600 +0,0 @@ -module initGridCellsMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Initializes sub-grid mapping for each land grid cell. This module handles the high- - ! level logic that determines how the subgrid structure is set up in a CLM run. It - ! makes use of lower-level routines in initSubgridMod. - ! - ! TODO(wjs, 2015-12-08) Much of the logic here duplicates (in some sense) logic in - ! subgridMod. The duplication should probably be extracted into routines shared between - ! these modules (or the two modules should be combined into one). - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc,iam - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_varcon , only : namep, namec, namel, nameg - use decompMod , only : bounds_type, ldecomp - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use initSubgridMod , only : clm_ptrs_compdown, clm_ptrs_check - use initSubgridMod , only : add_landunit, add_column, add_patch - use glcBehaviorMod , only : glc_behavior_type - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public initGridcells ! initialize sub-grid gridcell mapping - ! - ! !PRIVATE MEMBER FUNCTIONS: - private set_landunit_veg_compete - private set_landunit_wet_lake - private set_landunit_ice_mec - private set_landunit_crop_noncompete - private set_landunit_urban - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine initGridcells(glc_behavior) - ! - ! !DESCRIPTION: - ! Initialize sub-grid mapping and allocates space for derived type hierarchy. - ! For each land gridcell determine landunit, column and patch properties. - ! - ! !USES - use domainMod , only : ldomain - use decompMod , only : get_proc_bounds, get_clump_bounds, get_proc_clumps - use subgridWeightsMod , only : compute_higher_order_weights - use landunit_varcon , only : istsoil, istwet, istdlak, istice_mec - use landunit_varcon , only : isturb_tbd, isturb_hd, isturb_md, istcrop - use clm_varctl , only : use_fates - use shr_const_mod , only : SHR_CONST_PI - ! - ! !ARGUMENTS: - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: nc,li,ci,pi,gdc ! indices - integer :: nclumps ! number of clumps on this processor - type(bounds_type) :: bounds_proc - type(bounds_type) :: bounds_clump - !------------------------------------------------------------------------ - - ! Notes about how this routine is arranged, and its implications for the arrangement - ! of 1-d vectors in memory: - ! - ! (1) There is an outer loop over clumps; this results in all of a clump's points (at - ! the gridcell, landunit, column & patch level) being contiguous. This is important - ! for the use of begg:endg, etc., and also for performance. - ! - ! (2) Next, there is a section for each landunit, with the loop over grid cells - ! happening separately for each landunit. This means that, within a given clump, - ! points with the same landunit are grouped together (this is true at the - ! landunit, column and patch levels). Thus, different landunits for a given grid - ! cell are separated in memory. This improves performance in the many parts of - ! the code that operate over a single landunit, or two similar landunits. - ! - ! Example: landunit-level array: For a processor with 2 clumps, each of which has 2 - ! grid cells, each of which has 3 landunits, the layout of a landunit-level array - ! looks like the following: - ! - ! Array index: 1 2 3 4 5 6 7 8 9 10 11 12 - ! ------------------------------------------------------------ - ! Clump index: 1 1 1 1 1 1 2 2 2 2 2 2 - ! Gridcell: 1 2 1 2 1 2 3 4 3 4 3 4 - ! Landunit type: 1 1 2 2 3 3 1 1 2 2 3 3 - ! - ! Example: patch-level array: For a processor with 1 clump, which has 2 grid cells, each - ! of which has 2 landunits, each of which has 3 patchs, the layout of a patch-level array - ! looks like the following: - ! - ! Array index: 1 2 3 4 5 6 7 8 9 10 11 12 - ! ------------------------------------------------------------ - ! Gridcell: 1 1 1 2 2 2 1 1 1 2 2 2 - ! Landunit type: 1 1 1 1 1 1 2 2 2 2 2 2 - ! Patch type: 1 2 3 1 2 3 1 2 3 1 2 3 - ! - ! So note that clump index is most slowly varying, followed by landunit type, - ! followed by gridcell, followed by column and patch type. - ! - ! Cohort layout - ! Array index: 1 2 3 4 5 6 7 8 9 10 11 12 - ! ------------------------------------------------------------ - ! Gridcell: 1 1 1 1 2 2 2 2 3 3 3 3 - ! Column: 1 1 2 2 3 3 4 4 5 5 6 6 - ! Cohort: 1 2 1 2 1 2 1 2 1 2 1 2 - - nclumps = get_proc_clumps() - - ! FIX(SPM,032414) add private vars for cohort and perhaps patch dimension - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump, li, ci, pi, gdc) - do nc = 1, nclumps - - call get_clump_bounds(nc, bounds_clump) - - ! For each land gridcell on global grid determine landunit, column and patch properties - - li = bounds_clump%begl-1 - ci = bounds_clump%begc-1 - pi = bounds_clump%begp-1 - - ! Determine naturally vegetated landunit - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_veg_compete( & - ltype=istsoil, gi=gdc, li=li, ci=ci, pi=pi) - end do - - ! Determine crop landunit - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_crop_noncompete( & - ltype=istcrop, gi=gdc, li=li, ci=ci, pi=pi) - end do - - ! Determine urban tall building district landunit - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_urban( & - ltype=isturb_tbd, gi=gdc, li=li, ci=ci, pi=pi) - - end do - - ! Determine urban high density landunit - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_urban( & - ltype=isturb_hd, gi=gdc, li=li, ci=ci, pi=pi) - end do - - ! Determine urban medium density landunit - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_urban( & - ltype=isturb_md, gi=gdc, li=li, ci=ci, pi=pi) - end do - - ! Determine lake, wetland and glacier landunits - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_wet_lake( & - ltype=istdlak, gi=gdc, li=li, ci=ci, pi=pi) - end do - - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_wet_lake( & - ltype=istwet, gi=gdc, li=li, ci=ci, pi=pi) - end do - - do gdc = bounds_clump%begg,bounds_clump%endg - call set_landunit_ice_mec( & - glc_behavior = glc_behavior, & - ltype=istice_mec, gi=gdc, li=li, ci=ci, pi=pi) - end do - - ! Ensure that we have set the expected number of patchs, cols and landunits for this clump - SHR_ASSERT(li == bounds_clump%endl, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(ci == bounds_clump%endc, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(pi == bounds_clump%endp, errMsg(sourcefile, __LINE__)) - - ! Set some other gridcell-level variables - - do gdc = bounds_clump%begg,bounds_clump%endg - grc%gindex(gdc) = ldecomp%gdc2glo(gdc) - grc%area(gdc) = ldomain%area(gdc) - grc%latdeg(gdc) = ldomain%latc(gdc) - grc%londeg(gdc) = ldomain%lonc(gdc) - grc%lat(gdc) = grc%latdeg(gdc) * SHR_CONST_PI/180._r8 - grc%lon(gdc) = grc%londeg(gdc) * SHR_CONST_PI/180._r8 - enddo - - ! Fill in subgrid datatypes - - call clm_ptrs_compdown(bounds_clump) - - ! By putting this check within the loop over clumps, we ensure that (for example) - ! if a clump is responsible for landunit L, then that same clump is also - ! responsible for all columns and patchs in L. - call clm_ptrs_check(bounds_clump) - - ! Set patch%wtlunit, patch%wtgcell and col%wtgcell - call compute_higher_order_weights(bounds_clump) - - end do - !$OMP END PARALLEL DO - - end subroutine initGridcells - - !------------------------------------------------------------------------ - subroutine set_landunit_veg_compete (ltype, gi, li, ci, pi) - ! - ! !DESCRIPTION: - ! Initialize vegetated landunit with competition - ! - ! !USES - use clm_instur, only : wt_lunit, wt_nat_patch - use subgridMod, only : subgrid_get_info_natveg, natveg_patch_exists - use clm_varpar, only : numpft, maxpatch_pft, natpft_lb, natpft_ub - ! - ! !ARGUMENTS: - integer , intent(in) :: ltype ! landunit type - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! patch index - ! - ! !LOCAL VARIABLES: - integer :: m ! index - integer :: npatches ! number of patches in landunit - integer :: ncols - integer :: nlunits - integer :: npatches_added ! number of patches actually added - integer :: ncols_added ! number of columns actually added - integer :: nlunits_added ! number of landunits actually added - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - !------------------------------------------------------------------------ - - ! Set decomposition properties - - call subgrid_get_info_natveg(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - wtlunit2gcell = wt_lunit(gi, ltype) - - nlunits_added = 0 - ncols_added = 0 - npatches_added = 0 - - if (nlunits > 0) then - call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) - nlunits_added = nlunits_added + 1 - - ! Assume one column on the landunit - call add_column(ci=ci, li=li, ctype=1, wtlunit=1.0_r8) - ncols_added = ncols_added + 1 - - do m = natpft_lb,natpft_ub - if (natveg_patch_exists(gi, m)) then - call add_patch(pi=pi, ci=ci, ptype=m, wtcol=wt_nat_patch(gi,m)) - npatches_added = npatches_added + 1 - end if - end do - end if - - SHR_ASSERT(nlunits_added == nlunits, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(ncols_added == ncols, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(npatches_added == npatches, errMsg(sourcefile, __LINE__)) - - end subroutine set_landunit_veg_compete - - !------------------------------------------------------------------------ - subroutine set_landunit_wet_lake (ltype, gi, li, ci, pi) - ! - ! !DESCRIPTION: - ! Initialize wetland and lake landunits - ! - ! !USES - use clm_instur , only : wt_lunit - use landunit_varcon , only : istwet, istdlak - use subgridMod , only : subgrid_get_info_wetland, subgrid_get_info_lake - use pftconMod , only : noveg - - ! - ! !ARGUMENTS: - integer , intent(in) :: ltype ! landunit type - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! patch index - ! - ! !LOCAL VARIABLES: - integer :: npatches ! number of pfts in landunit - integer :: ncols - integer :: nlunits - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - !------------------------------------------------------------------------ - - ! Set decomposition properties - - if (ltype == istwet) then - call subgrid_get_info_wetland(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - else if (ltype == istdlak) then - call subgrid_get_info_lake(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - else - write(iulog,*)' set_landunit_wet_lake: ltype of ',ltype,' not valid' - write(iulog,*)' only istwet and istdlak ltypes are valid' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - wtlunit2gcell = wt_lunit(gi, ltype) - - if (npatches > 0) then - - if (npatches /= 1) then - write(iulog,*)' set_landunit_wet_lake: compete landunit must'// & - ' have one patch ' - write(iulog,*)' current value of npatches=',npatches - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Currently assume that each landunit only has only one column - ! and that each column has its own pft - - call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) - call add_column(ci=ci, li=li, ctype=ltype, wtlunit=1.0_r8) - call add_patch(pi=pi, ci=ci, ptype=noveg, wtcol=1.0_r8) - - endif ! npatches > 0 - - end subroutine set_landunit_wet_lake - - !----------------------------------------------------------------------- - subroutine set_landunit_ice_mec(glc_behavior, ltype, gi, li, ci, pi) - ! - ! !DESCRIPTION: - ! Initialize glacier_mec landunits - ! - ! !USES: - use clm_varpar , only : maxpatch_glcmec - use clm_instur , only : wt_lunit, wt_glc_mec - use landunit_varcon , only : istice_mec - use column_varcon , only : icemec_class_to_col_itype - use subgridMod , only : subgrid_get_info_glacier_mec - use pftconMod , only : noveg - ! - ! !ARGUMENTS: - type(glc_behavior_type), intent(in) :: glc_behavior - integer , intent(in) :: ltype ! landunit type - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! patch index - ! - ! !LOCAL VARIABLES: - integer :: m ! index - integer :: npatches ! number of patches in landunit - integer :: ncols - integer :: nlunits - logical :: col_exists - real(r8) :: wtlunit2gcell ! weight relative to gridcell of landunit - real(r8) :: wtcol2lunit ! col weight in landunit - logical :: type_is_dynamic - - ! We don't have a true atm_topo value at the point of this call, so arbitrarily use - ! 0. This will put glc_mec in elevation class 1 in some places where it should - ! actually be in a higher elevation class, but that will be adjusted in the run loop - ! (or upon reading the restart file). - real(r8), parameter :: atm_topo = 0._r8 - - character(len=*), parameter :: subname = 'set_landunit_ice_mec' - !----------------------------------------------------------------------- - - SHR_ASSERT(ltype == istice_mec, errMsg(sourcefile, __LINE__)) - - call subgrid_get_info_glacier_mec(gi, atm_topo, glc_behavior, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - - if (nlunits == 1) then - wtlunit2gcell = wt_lunit(gi, ltype) - call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) - - ! Determine column and properties - ! (Each column has its own pft) - ! - ! For grid cells where the glc behavior indicates a need for virtual columns - ! (i.e., zero-weight columns that are nevertheless active), make sure all the - ! elevations classes are populated, even if some have zero fractional area. - ! This ensures that the ice sheet component, glc, will receive a surface mass - ! balance in each elevation class wherever the SMB is needed. - - type_is_dynamic = glc_behavior%cols_have_dynamic_type(gi) - do m = 1, maxpatch_glcmec - call glc_behavior%glc_mec_col_exists(gi = gi, elev_class = m, atm_topo = atm_topo, & - exists = col_exists, col_wt_lunit = wtcol2lunit) - if (col_exists) then - call add_column(ci=ci, li=li, ctype=icemec_class_to_col_itype(m), & - wtlunit=wtcol2lunit, type_is_dynamic=type_is_dynamic) - call add_patch(pi=pi, ci=ci, ptype=noveg, wtcol=1.0_r8) - endif - enddo - - else if (nlunits /= 0) then - call endrun(msg=subname//' ERROR: expect 0 or 1 landunits') - end if - - end subroutine set_landunit_ice_mec - - !------------------------------------------------------------------------ - - subroutine set_landunit_crop_noncompete (ltype, gi, li, ci, pi) - ! - ! !DESCRIPTION: - ! Initialize crop landunit without competition - ! - ! Note about the ltype input argument: This provides the value for this landunit index - ! (i.e., the crop landunit index). This may differ from the landunit's 'itype' value, - ! since itype is istsoil if we are running with create_crop_landunit but for - ! an older surface dataset that - ! - ! !USES - use clm_instur , only : wt_lunit, wt_cft - use landunit_varcon , only : istcrop, istsoil - use subgridMod , only : subgrid_get_info_crop, crop_patch_exists - use clm_varpar , only : maxpatch_pft, cft_lb, cft_ub - use clm_varctl , only : create_crop_landunit - ! - ! !ARGUMENTS: - integer , intent(in) :: ltype ! landunit type - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! patch index - ! - ! !LOCAL VARIABLES: - integer :: my_ltype ! landunit type for crops - integer :: cft ! crop functional type index - integer :: npatches ! number of pfts in landunit - integer :: ncols - integer :: nlunits - integer :: npatches_added ! number of patches actually added - integer :: ncols_added ! number of columns actually added - integer :: nlunits_added ! number of landunits actually added - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - !------------------------------------------------------------------------ - - ! Set decomposition properties - - call subgrid_get_info_crop(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - wtlunit2gcell = wt_lunit(gi, ltype) - - nlunits_added = 0 - ncols_added = 0 - npatches_added = 0 - - if (nlunits > 0) then - - ! Note that we cannot simply use the 'ltype' argument to set itype here, - ! because ltype will always indicate istcrop - if ( create_crop_landunit )then - my_ltype = ltype ! Will always be istcrop - if ( ltype /= istcrop )then - write(iulog,*)' create_crop_landunit on and ltype is not istcrop: ', ltype - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - else - my_ltype = istsoil - end if - - call add_landunit(li=li, gi=gi, ltype=my_ltype, wtgcell=wtlunit2gcell) - nlunits_added = nlunits_added + 1 - - ! Set column and patch properties for this landunit - ! (each column has its own pft) - - do cft = cft_lb, cft_ub - if (crop_patch_exists(gi, cft)) then - call add_column(ci=ci, li=li, ctype=((istcrop*100) + cft), wtlunit=wt_cft(gi,cft)) - ncols_added = ncols_added + 1 - call add_patch(pi=pi, ci=ci, ptype=cft, wtcol=1.0_r8) - npatches_added = npatches_added + 1 - end if - end do - - end if - - SHR_ASSERT(nlunits_added == nlunits, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(ncols_added == ncols, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(npatches_added == npatches, errMsg(sourcefile, __LINE__)) - - end subroutine set_landunit_crop_noncompete - - !------------------------------------------------------------------------------ - - subroutine set_landunit_urban (ltype, gi, li, ci, pi) - ! - ! !DESCRIPTION: - ! Initialize urban landunits - ! - ! !USES - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv, icol_road_imperv - use landunit_varcon , only : isturb_tbd, isturb_hd, isturb_md, isturb_MIN - use clm_varpar , only : maxpatch_urb - use clm_instur , only : wt_lunit - use subgridMod , only : subgrid_get_info_urban_tbd, subgrid_get_info_urban_hd - use subgridMod , only : subgrid_get_info_urban_md - use UrbanParamsType , only : urbinp - use decompMod , only : ldecomp - use pftconMod , only : noveg - ! - ! !ARGUMENTS: - integer , intent(in) :: ltype ! landunit type - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! patch index - ! - ! !LOCAL VARIABLES: - integer :: m ! index - integer :: n ! urban density type index - integer :: ctype ! column type - integer :: npatches ! number of pfts in landunit - integer :: ncols - integer :: nlunits - real(r8) :: wtlunit2gcell ! weight relative to gridcell of landunit - real(r8) :: wtcol2lunit ! weight of column with respect to landunit - real(r8) :: wtlunit_roof ! weight of roof with respect to landunit - real(r8) :: wtroad_perv ! weight of pervious road column with respect to total road - integer :: ier ! error status - !------------------------------------------------------------------------ - - ! Set decomposition properties, and set variables specific to urban density type - - select case (ltype) - case (isturb_tbd) - call subgrid_get_info_urban_tbd(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - case (isturb_hd) - call subgrid_get_info_urban_hd(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - case (isturb_md) - call subgrid_get_info_urban_md(gi, & - npatches=npatches, ncols=ncols, nlunits=nlunits) - case default - write(iulog,*)' set_landunit_urban: unknown ltype: ', ltype - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - if (npatches > 0) then - - wtlunit2gcell = wt_lunit(gi, ltype) - - n = ltype - isturb_MIN + 1 - wtlunit_roof = urbinp%wtlunit_roof(gi,n) - wtroad_perv = urbinp%wtroad_perv(gi,n) - - call add_landunit(li=li, gi=gi, ltype=ltype, wtgcell=wtlunit2gcell) - - ! Loop through columns for this landunit and set the column and patch properties - ! For the urban landunits it is assumed that each column has its own pft - - do m = 1, maxpatch_urb - - if (m == 1) then - ctype = icol_roof - wtcol2lunit = wtlunit_roof - else if (m == 2) then - ctype = icol_sunwall - wtcol2lunit = (1. - wtlunit_roof)/3 - else if (m == 3) then - ctype = icol_shadewall - wtcol2lunit = (1. - wtlunit_roof)/3 - else if (m == 4) then - ctype = icol_road_imperv - wtcol2lunit = ((1. - wtlunit_roof)/3) * (1.-wtroad_perv) - else if (m == 5) then - ctype = icol_road_perv - wtcol2lunit = ((1. - wtlunit_roof)/3) * (wtroad_perv) - end if - - call add_column(ci=ci, li=li, ctype=ctype, wtlunit=wtcol2lunit) - - call add_patch(pi=pi, ci=ci, ptype=noveg, wtcol=1.0_r8) - - end do ! end of loop through urban columns-pfts - end if - - end subroutine set_landunit_urban - -end module initGridCellsMod diff --git a/src/main/initSubgridMod.F90 b/src/main/initSubgridMod.F90 deleted file mode 100644 index 57384dc461..0000000000 --- a/src/main/initSubgridMod.F90 +++ /dev/null @@ -1,475 +0,0 @@ -module initSubgridMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Lower-level routines for initializing the subgrid structure. This module is shared - ! between both the production code (via initGridCellsMod) and unit testing code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use clm_varctl , only : iulog, use_fates - use clm_varcon , only : namep, namec, namel - use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use column_varcon , only : is_hydrologically_active - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: clm_ptrs_compdown ! fill in data pointing down - public :: clm_ptrs_check ! checks and writes out a summary of subgrid data - public :: add_landunit ! add an entry in the landunit-level arrays - public :: add_column ! add an entry in the column-level arrays - public :: add_patch ! add an entry in the patch-level arrays - ! - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------------ - subroutine clm_ptrs_compdown(bounds) - ! - ! !DESCRIPTION: - ! Assumes the part of the subgrid pointing up has been set. Fills - ! in the data pointing down. Up is p_c, p_l, p_g, c_l, c_g, and l_g. - ! - ! This algorithm assumes all indices besides grid cell are monotonically - ! increasing. (Note that grid cell index is NOT monotonically increasing, - ! hence we cannot set initial & final indices at the grid cell level - - ! grc%luni, grc%lunf, etc.) - ! - ! Algorithm works as follows. The p, c, and l loops march through - ! the full arrays (nump, numc, and numl) checking the "up" indexes. - ! As soon as the "up" index of the current (p,c,l) cell changes relative - ! to the previous (p,c,l) cell, the *i array will be set to point down - ! to that cell. The *f array follows the same logic, so it's always the - ! last "up" index from the previous cell when an "up" index changes. - ! - ! For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This - ! subroutine will set c_pi(1) = 1, c_pf(1) = 4, c_pi(2) = 5, c_pf(2) = 12. - ! - ! !USES - use clm_varcon, only : ispval - ! - ! !ARGUMENTS - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: l,c,p ! loop counters - integer :: curg,curl,curc,curp ! tracks g,l,c,p indexes in arrays - integer :: ltype ! landunit type - !------------------------------------------------------------------------------ - - !--- Set the current c,l (curc, curl) to zero for initialization, - !--- these indices track the current "up" index. - !--- Take advantage of locality of l/c/p cells - !--- Loop p through full local begp:endp length - !--- Separately check the p_c, p_l, and p_g indexes for a change in - !--- the "up" index. - !--- If there is a change, verify that the current c,l,g is within the - !--- valid range, and set c_pi, l_pi, or g_pi to that current c,l,g - !--- Constantly update the c_pf, l_pf, and g_pf array. When the - !--- g, l, c index changes, the *_pf array will be set correctly - !--- Do the same for cols setting c_li, c_gi, c_lf, c_gf and - !--- lunits setting l_gi, l_gf. - - curc = 0 - curl = 0 - do p = bounds%begp,bounds%endp - if (patch%column(p) /= curc) then - curc = patch%column(p) - if (curc < bounds%begc .or. curc > bounds%endc) then - write(iulog,*) 'clm_ptrs_compdown ERROR: pcolumn ',p,curc,bounds%begc,bounds%endc - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) - endif - col%patchi(curc) = p - endif - col%patchf(curc) = p - col%npatches(curc) = col%patchf(curc) - col%patchi(curc) + 1 - if (patch%landunit(p) /= curl) then - curl = patch%landunit(p) - if (curl < bounds%begl .or. curl > bounds%endl) then - write(iulog,*) 'clm_ptrs_compdown ERROR: plandunit ',p,curl,bounds%begl,bounds%endl - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) - endif - lun%patchi(curl) = p - endif - lun%patchf(curl) = p - lun%npatches(curl) = lun%patchf(curl) - lun%patchi(curl) + 1 - enddo - - curl = 0 - do c = bounds%begc,bounds%endc - if (col%landunit(c) /= curl) then - curl = col%landunit(c) - if (curl < bounds%begl .or. curl > bounds%endl) then - write(iulog,*) 'clm_ptrs_compdown ERROR: clandunit ',c,curl,bounds%begl,bounds%endl - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - endif - lun%coli(curl) = c - endif - lun%colf(curl) = c - lun%ncolumns(curl) = lun%colf(curl) - lun%coli(curl) + 1 - enddo - - ! Determine landunit_indices: indices into landunit-level arrays for each grid cell. - ! Note that landunits not present in a given grid cell are set to ispval. - grc%landunit_indices(:,bounds%begg:bounds%endg) = ispval - do l = bounds%begl,bounds%endl - ltype = lun%itype(l) - curg = lun%gridcell(l) - if (curg < bounds%begg .or. curg > bounds%endg) then - write(iulog,*) 'clm_ptrs_compdown ERROR: landunit_indices ', l,curg,bounds%begg,bounds%endg - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - - if (grc%landunit_indices(ltype, curg) == ispval) then - grc%landunit_indices(ltype, curg) = l - else - write(iulog,*) 'clm_ptrs_compdown ERROR: This landunit type has already been set for this gridcell' - write(iulog,*) 'l, ltype, curg = ', l, ltype, curg - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine clm_ptrs_compdown - - !------------------------------------------------------------------------------ - subroutine clm_ptrs_check(bounds) - ! - ! !DESCRIPTION: - ! Checks and writes out a summary of subgrid data - ! - ! !USES - use clm_varcon, only : ispval - use landunit_varcon, only : max_lunit - ! - ! !ARGUMENTS - implicit none - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p ! loop counters - integer :: l_prev ! l value of previous point - integer :: ltype ! landunit type - logical :: error ! error flag - !------------------------------------------------------------------------------ - - associate( & - begg => bounds%begg, & - endg => bounds%endg, & - begl => bounds%begl, & - endl => bounds%endl, & - begc => bounds%begc, & - endc => bounds%endc, & - begp => bounds%begp, & - endp => bounds%endp & - ) - - if (masterproc) write(iulog,*) ' ' - if (masterproc) write(iulog,*) '---clm_ptrs_check:' - - !--- check index ranges --- - error = .false. - do g = begg, endg - do ltype = 1, max_lunit - l = grc%landunit_indices(ltype, g) - if (l /= ispval) then - if (l < begl .or. l > endl) error = .true. - end if - end do - end do - if (error) then - write(iulog,*) ' clm_ptrs_check: g index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - if (masterproc) write(iulog,*) ' clm_ptrs_check: g index ranges - OK' - - error = .false. - if (minval(lun%gridcell(begl:endl)) < begg .or. maxval(lun%gridcell(begl:endl)) > endg) error=.true. - if (minval(lun%coli(begl:endl)) < begc .or. maxval(lun%coli(begl:endl)) > endc) error=.true. - if (minval(lun%colf(begl:endl)) < begc .or. maxval(lun%colf(begl:endl)) > endc) error=.true. - if (minval(lun%patchi(begl:endl)) < begp .or. maxval(lun%patchi(begl:endl)) > endp) error=.true. - if (minval(lun%patchf(begl:endl)) < begp .or. maxval(lun%patchf(begl:endl)) > endp) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: l index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: l index ranges - OK' - - error = .false. - if (minval(col%gridcell(begc:endc)) < begg .or. maxval(col%gridcell(begc:endc)) > endg) error=.true. - if (minval(col%landunit(begc:endc)) < begl .or. maxval(col%landunit(begc:endc)) > endl) error=.true. - if (minval(col%patchi(begc:endc)) < begp .or. maxval(col%patchi(begc:endc)) > endp) error=.true. - if (minval(col%patchf(begc:endc)) < begp .or. maxval(col%patchf(begc:endc)) > endp) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: c index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: c index ranges - OK' - - error = .false. - if (minval(patch%gridcell(begp:endp)) < begg .or. maxval(patch%gridcell(begp:endp)) > endg) error=.true. - if (minval(patch%landunit(begp:endp)) < begl .or. maxval(patch%landunit(begp:endp)) > endl) error=.true. - if (minval(patch%column(begp:endp)) < begc .or. maxval(patch%column(begp:endp)) > endc) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: p index ranges - ERROR' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: p index ranges - OK' - - !--- check that indices in arrays are monotonically increasing --- - error = .false. - do l=begl+1,endl - if ((lun%itype(l) == lun%itype(l-1)) .and. & - lun%gridcell(l) < lun%gridcell(l-1)) then - ! grid cell indices should be monotonically increasing for a given landunit type - error = .true. - end if - if (lun%coli(l) < lun%coli(l-1)) error = .true. - if (lun%colf(l) < lun%colf(l-1)) error = .true. - if (lun%patchi(l) < lun%patchi(l-1)) error = .true. - if (lun%patchf(l) < lun%patchf(l-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: l mono increasing - ERROR' - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: l mono increasing - OK' - - error = .false. - do c=begc+1,endc - l = col%landunit(c) - l_prev = col%landunit(c-1) - if ((lun%itype(l) == lun%itype(l_prev)) .and. & - col%gridcell(c) < col%gridcell(c-1)) then - ! grid cell indices should be monotonically increasing for a given landunit type - error = .true. - end if - if (col%landunit(c) < col%landunit(c-1)) error = .true. - if (col%patchi(c) < col%patchi(c-1)) error = .true. - if (col%patchf(c) < col%patchf(c-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: c mono increasing - ERROR' - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: c mono increasing - OK' - - error = .false. - do p=begp+1,endp - l = patch%landunit(p) - l_prev = patch%landunit(p-1) - if ((lun%itype(l) == lun%itype(l_prev)) .and. & - patch%gridcell(p) < patch%gridcell(p-1)) then - ! grid cell indices should be monotonically increasing for a given landunit type - error = .true. - end if - if (patch%landunit(p) < patch%landunit(p-1)) error = .true. - if (patch%column (p) < patch%column (p-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: p mono increasing - ERROR' - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: p mono increasing - OK' - - !--- check that the tree is internally consistent --- - error = .false. - do g = begg, endg - do ltype = 1, max_lunit - l = grc%landunit_indices(ltype, g) - - ! skip l == ispval, which implies that this landunit type doesn't exist on this grid cell - if (l /= ispval) then - if (lun%itype(l) /= ltype) error = .true. - if (lun%gridcell(l) /= g) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - endif - do c = lun%coli(l),lun%colf(l) - if (col%gridcell(c) /= g) error = .true. - if (col%landunit(c) /= l) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - endif - do p = col%patchi(c),col%patchf(c) - if (patch%gridcell(p) /= g) error = .true. - if (patch%landunit(p) /= l) error = .true. - if (patch%column(p) /= c) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) - endif - enddo ! p - enddo ! c - end if ! l /= ispval - enddo ! ltype - enddo ! g - if (masterproc) write(iulog,*) ' clm_ptrs_check: tree consistent - OK' - if (masterproc) write(iulog,*) ' ' - - end associate - - end subroutine clm_ptrs_check - - !----------------------------------------------------------------------- - subroutine add_landunit(li, gi, ltype, wtgcell) - ! - ! !DESCRIPTION: - ! Add an entry in the landunit-level arrays. li gives the index of the last landunit - ! added; the new landunit is added at li+1, and the li argument is incremented - ! accordingly. - ! - ! !USES: - use landunit_varcon , only : istice_mec, istdlak, isturb_MIN, isturb_MAX, landunit_is_special - ! - ! !ARGUMENTS: - integer , intent(inout) :: li ! input value is index of last landunit added; output value is index of this newly-added landunit - integer , intent(in) :: gi ! grid cell index on which this landunit should be placed - integer , intent(in) :: ltype ! landunit type - real(r8) , intent(in) :: wtgcell ! weight of the landunit relative to the grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'add_landunit' - !----------------------------------------------------------------------- - - li = li + 1 - - lun%gridcell(li) = gi - lun%wtgcell(li) = wtgcell - lun%itype(li) = ltype - - lun%ifspecial(li) = landunit_is_special(ltype) - - if (ltype == istice_mec) then - lun%glcmecpoi(li) = .true. - else - lun%glcmecpoi(li) = .false. - end if - - if (ltype == istdlak) then - lun%lakpoi(li) = .true. - else - lun%lakpoi(li) = .false. - end if - - if (ltype >= isturb_MIN .and. ltype <= isturb_MAX) then - lun%urbpoi(li) = .true. - else - lun%urbpoi(li) = .false. - end if - - end subroutine add_landunit - - !----------------------------------------------------------------------- - subroutine add_column(ci, li, ctype, wtlunit, type_is_dynamic) - ! - ! !DESCRIPTION: - ! Add an entry in the column-level arrays. ci gives the index of the last column - ! added; the new column is added at ci+1, and the ci argument is incremented - ! accordingly. - ! - ! !ARGUMENTS: - integer , intent(inout) :: ci ! input value is index of last column added; output value is index of this newly-added column - integer , intent(in) :: li ! landunit index on which this column should be placed (assumes this landunit has already been created) - integer , intent(in) :: ctype ! column type - real(r8) , intent(in) :: wtlunit ! weight of the column relative to the landunit - - ! whether this column's type can change at runtime; if not provided, assumed to be false - logical , intent(in), optional :: type_is_dynamic - ! - ! !LOCAL VARIABLES: - logical :: l_type_is_dynamic ! local version of type_is_dynamic - - character(len=*), parameter :: subname = 'add_column' - !----------------------------------------------------------------------- - - l_type_is_dynamic = .false. - if (present(type_is_dynamic)) then - l_type_is_dynamic = type_is_dynamic - end if - - ci = ci + 1 - - col%landunit(ci) = li - col%gridcell(ci) = lun%gridcell(li) - col%wtlunit(ci) = wtlunit - col%itype(ci) = ctype - col%type_is_dynamic(ci) = l_type_is_dynamic - col%hydrologically_active(ci) = is_hydrologically_active( & - col_itype = ctype, & - lun_itype = lun%itype(li)) - - end subroutine add_column - - !----------------------------------------------------------------------- - subroutine add_patch(pi, ci, ptype, wtcol) - ! - ! !DESCRIPTION: - ! Add an entry in the patch-level arrays. pi gives the index of the last patch added; the - ! new patch is added at pi+1, and the pi argument is incremented accordingly. - ! - ! !USES: - use clm_varcon , only : ispval - use landunit_varcon , only : istsoil, istcrop - use clm_varpar , only : natpft_lb - ! - ! !ARGUMENTS: - integer , intent(inout) :: pi ! input value is index of last patch added; output value is index of this newly-added patch - integer , intent(in) :: ci ! column index on which this patch should be placed (assumes this column has already been created) - integer , intent(in) :: ptype ! patch type - real(r8) , intent(in) :: wtcol ! weight of the patch relative to the column - ! - ! !LOCAL VARIABLES: - integer :: li ! landunit index - integer :: lb_offset ! offset between natpft_lb and 1 - - character(len=*), parameter :: subname = 'add_patch' - !----------------------------------------------------------------------- - - pi = pi + 1 - - patch%column(pi) = ci - li = col%landunit(ci) - patch%landunit(pi) = li - patch%gridcell(pi) = col%gridcell(ci) - - patch%wtcol(pi) = wtcol - - ! TODO (MV, 10-17-14): The following must be commented out because - ! currently patch%itype is used in CanopyTemperatureMod to calculate - ! z0m(p) and displa(p) - and is still called even when fates is on - - !if (.not. use_fates) then - patch%itype(pi) = ptype - !end if - - if (lun%itype(li) == istsoil .or. lun%itype(li) == istcrop) then - lb_offset = 1 - natpft_lb - patch%mxy(pi) = ptype + lb_offset - else - patch%mxy(pi) = ispval - end if - - - end subroutine add_patch - - -end module initSubgridMod diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 deleted file mode 100644 index 9ba2f2711c..0000000000 --- a/src/main/initVerticalMod.F90 +++ /dev/null @@ -1,795 +0,0 @@ -module initVerticalMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Initialize vertical components of column datatype - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_sys_mod , only : shr_sys_abort - use decompMod , only : bounds_type - use spmdMod , only : masterproc - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - use clm_varpar , only : toplev_equalspace, nlev_equalspace - use clm_varpar , only : nlevsoi, nlevsoifl, nlevurb - use clm_varctl , only : fsurdat, iulog - use clm_varctl , only : use_vancouver, use_mexicocity, use_vertsoilc, use_extralakelayers - use clm_varctl , only : use_bedrock, soil_layerstruct - use clm_varctl , only : use_fates - use clm_varcon , only : zlak, dzlak, zsoi, dzsoi, zisoi, dzsoi_decomp, spval, ispval, grlnd - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall, is_hydrologically_active - use landunit_varcon , only : istdlak, istice_mec - use fileutils , only : getfil - use LandunitType , only : lun - use GridcellType , only : grc - use ColumnType , only : col - use glcBehaviorMod , only : glc_behavior_type - use SnowHydrologyMod , only : InitSnowLayers - use abortUtils , only : endrun - use ncdio_pio - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: initVertical - ! !PRIVATE MEMBER FUNCTIONS: - private :: ReadNL - private :: hasBedrock ! true if the given column type includes bedrock layers - ! - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - ! - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine ReadNL( ) - ! - ! !DESCRIPTION: - ! Read namelist for SoilStateType - ! - ! !USES: - use shr_mpi_mod , only : shr_mpi_bcast - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getavu, relavu, opnfil - use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : iulog - use spmdMod , only : mpicom, masterproc - use controlMod , only : NLFilename - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=32) :: subname = 'InitVertical_readnl' ! subroutine name - !----------------------------------------------------------------------- - - character(len=*), parameter :: nl_name = 'clm_inparm' ! Namelist name - - ! MUST agree with name in namelist and read - namelist /clm_inparm/ use_bedrock - - ! preset values - - use_bedrock = .false. - - if ( masterproc )then - - unitn = getavu() - write(iulog,*) 'Read in '//nl_name//' namelist' - call opnfil (NLFilename, unitn, 'F') - call find_nlgroup_name(unitn, nl_name, status=ierr) - if (ierr == 0) then - read(unit=unitn, nml=clm_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - - end if - - call shr_mpi_bcast(use_bedrock, mpicom) - - end subroutine ReadNL - - !------------------------------------------------------------------------ - subroutine initVertical(bounds, glc_behavior, snow_depth, thick_wall, thick_roof) - use clm_varcon, only : zmin_bedrock, n_melt_glcmec - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(glc_behavior_type), intent(in) :: glc_behavior - real(r8) , intent(in) :: snow_depth(bounds%begc:) - real(r8) , intent(in) :: thick_wall(bounds%begl:) - real(r8) , intent(in) :: thick_roof(bounds%begl:) - ! - ! LOCAL VARAIBLES: - integer :: c,l,g,i,j,lev ! indices - type(file_desc_t) :: ncid ! netcdf id - logical :: readvar - integer :: dimid ! dimension id - character(len=256) :: locfn ! local filename - real(r8) ,pointer :: std (:) ! read in - topo_std - real(r8) ,pointer :: tslope (:) ! read in - topo_slope - real(r8) :: slope0 ! temporary - real(r8) :: slopebeta ! temporary - real(r8) :: slopemax ! temporary - integer :: ier ! error status - real(r8) :: scalez = 0.025_r8 ! Soil layer thickness discretization (m) - real(r8) :: thick_equal = 0.2 - real(r8) ,pointer :: zbedrock_in(:) ! read in - z_bedrock - real(r8) ,pointer :: lakedepth_in(:) ! read in - lakedepth - real(r8), allocatable :: zurb_wall(:,:) ! wall (layer node depth) - real(r8), allocatable :: zurb_roof(:,:) ! roof (layer node depth) - real(r8), allocatable :: dzurb_wall(:,:) ! wall (layer thickness) - real(r8), allocatable :: dzurb_roof(:,:) ! roof (layer thickness) - real(r8), allocatable :: ziurb_wall(:,:) ! wall (layer interface) - real(r8), allocatable :: ziurb_roof(:,:) ! roof (layer interface) - real(r8) :: depthratio ! ratio of lake depth to standard deep lake depth - integer :: begc, endc - integer :: begl, endl - integer :: jmin_bedrock - - ! Possible values for levgrnd_class. The important thing is that, for a given column, - ! layers that are fundamentally different (e.g., soil vs bedrock) have different - ! values. This information is used in the vertical interpolation in init_interp. - ! - ! IMPORTANT: These values should not be changed lightly. e.g., try to avoid changing - ! the values assigned to LEVGRND_CLASS_STANDARD, LEVGRND_CLASS_DEEP_BEDROCK, etc. The - ! problem with changing these is that init_interp expects that layers with a value of - ! (e.g.) 1 on the source file correspond to layers with a value of 1 on the - ! destination file. So if you change the values of these constants, you either need to - ! adequately inform users of this change, or build in some translation mechanism in - ! init_interp (such as via adding more metadata to the restart file on the meaning of - ! these different values). - ! - ! The distinction between "shallow" and "deep" bedrock is not made explicitly - ! elsewhere. But, since these classes have somewhat different behavior, they are - ! distinguished explicitly here. - integer, parameter :: LEVGRND_CLASS_STANDARD = 1 - integer, parameter :: LEVGRND_CLASS_DEEP_BEDROCK = 2 - integer, parameter :: LEVGRND_CLASS_SHALLOW_BEDROCK = 3 - !------------------------------------------------------------------------ - - begc = bounds%begc; endc= bounds%endc - begl = bounds%begl; endl= bounds%endl - - SHR_ASSERT_ALL((ubound(snow_depth) == (/endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(thick_wall) == (/endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(thick_roof) == (/endl/)), errMsg(sourcefile, __LINE__)) - - ! Open surface dataset to read in data below - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! -------------------------------------------------------------------- - ! Define layer structure for soil, lakes, urban walls and roof - ! Vertical profile of snow is not initialized here - but below - ! -------------------------------------------------------------------- - - ! Soil layers and interfaces (assumed same for all non-lake patches) - ! "0" refers to soil surface and "nlevsoi" refers to the bottom of model soil - - if ( soil_layerstruct == '10SL_3.5m' ) then - do j = 1, nlevgrnd - zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - dzsoi(1) = 0.5_r8*(zsoi(1)+zsoi(2)) !thickness b/n two interfaces - do j = 2,nlevgrnd-1 - dzsoi(j)= 0.5_r8*(zsoi(j+1)-zsoi(j-1)) - enddo - dzsoi(nlevgrnd) = zsoi(nlevgrnd)-zsoi(nlevgrnd-1) - - zisoi(0) = 0._r8 - do j = 1, nlevgrnd-1 - zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1)) !interface depths - enddo - zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd) - - else if ( soil_layerstruct == '23SL_3.5m' )then - ! Soil layer structure that starts with standard exponential - ! and then has several evenly spaced layers, then finishes off exponential. - ! this allows the upper soil to behave as standard, but then continues - ! with higher resolution to a deeper depth, so that, for example, permafrost - ! dynamics are not lost due to an inability to resolve temperature, moisture, - ! and biogeochemical dynamics at the base of the active layer - do j = 1, toplev_equalspace - zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - do j = toplev_equalspace+1,toplev_equalspace + nlev_equalspace - zsoi(j) = zsoi(j-1) + thick_equal - enddo - - do j = toplev_equalspace + nlev_equalspace +1, nlevgrnd - zsoi(j) = scalez*(exp(0.5_r8*((j - nlev_equalspace)-0.5_r8))-1._r8) + nlev_equalspace * thick_equal - enddo - - dzsoi(1) = 0.5_r8*(zsoi(1)+zsoi(2)) !thickness b/n two interfaces - do j = 2,nlevgrnd-1 - dzsoi(j)= 0.5_r8*(zsoi(j+1)-zsoi(j-1)) - enddo - dzsoi(nlevgrnd) = zsoi(nlevgrnd)-zsoi(nlevgrnd-1) - - zisoi(0) = 0._r8 - do j = 1, nlevgrnd-1 - zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1)) !interface depths - enddo - zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd) - - else if ( soil_layerstruct == '49SL_10m' ) then - !scs: 10 meter soil column, nlevsoi set to 49 in clm_varpar - do j = 1,10 - dzsoi(j)= 1.e-2_r8 !10mm layers - enddo - do j = 11,19 - dzsoi(j)= 1.e-1_r8 !100 mm layers - enddo - do j = 20,nlevsoi+1 !300 mm layers - dzsoi(j)= 3.e-1_r8 - enddo - do j = nlevsoi+2,nlevgrnd !10 meter bedrock layers - dzsoi(j)= 10._r8 - enddo - - zisoi(0) = 0._r8 - do j = 1,nlevgrnd - zisoi(j)= sum(dzsoi(1:j)) - enddo - - do j = 1, nlevgrnd - zsoi(j) = 0.5*(zisoi(j-1) + zisoi(j)) - enddo - - else if ( soil_layerstruct == '20SL_8.5m' ) then - do j = 1,4 - dzsoi(j)= j*0.02_r8 ! linear increase in layer thickness of 2cm each layer - enddo - do j = 5,13 - dzsoi(j)= dzsoi(4)+(j-4)*0.04_r8 ! linear increase in layer thickness of 2cm each layer - enddo - do j = 14,nlevsoi - dzsoi(j)= dzsoi(13)+(j-13)*0.10_r8 ! linear increase in layer thickness of 2cm each layer - enddo - do j = nlevsoi+1,nlevgrnd !bedrock layers - dzsoi(j)= dzsoi(nlevsoi)+(((j-nlevsoi)*25._r8)**1.5_r8)/100._r8 ! bedrock layers - enddo - - zisoi(0) = 0._r8 - do j = 1,nlevgrnd - zisoi(j)= sum(dzsoi(1:j)) - enddo - - do j = 1, nlevgrnd - zsoi(j) = 0.5*(zisoi(j-1) + zisoi(j)) - enddo - end if - - ! define a vertical grid spacing such that it is the normal dzsoi if - ! nlevdecomp =nlevgrnd, or else 1 meter - if (use_vertsoilc) then - dzsoi_decomp = dzsoi !thickness b/n two interfaces - else - dzsoi_decomp(1) = 1. - end if - - if (masterproc) then - write(iulog, *) 'zsoi', zsoi(:) - write(iulog, *) 'zisoi: ', zisoi(:) - write(iulog, *) 'dzsoi: ', dzsoi(:) - write(iulog, *) 'dzsoi_decomp: ',dzsoi_decomp - end if - - if (nlevurb > 0) then - allocate(zurb_wall(bounds%begl:bounds%endl,nlevurb), & - zurb_roof(bounds%begl:bounds%endl,nlevurb), & - dzurb_wall(bounds%begl:bounds%endl,nlevurb), & - dzurb_roof(bounds%begl:bounds%endl,nlevurb), & - ziurb_wall(bounds%begl:bounds%endl,0:nlevurb), & - ziurb_roof(bounds%begl:bounds%endl,0:nlevurb), & - stat=ier) - if (ier /= 0) then - call shr_sys_abort(' ERROR allocation error for '//& - 'zurb_wall,zurb_roof,dzurb_wall,dzurb_roof,ziurb_wall,ziurb_roof'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - ! Column level initialization for urban wall and roof layers and interfaces - do l = bounds%begl,bounds%endl - - ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom - if (lun%urbpoi(l)) then - if (use_vancouver) then - zurb_wall(l,1) = 0.010_r8/2._r8 - zurb_wall(l,2) = zurb_wall(l,1) + 0.010_r8/2._r8 + 0.020_r8/2._r8 - zurb_wall(l,3) = zurb_wall(l,2) + 0.020_r8/2._r8 + 0.070_r8/2._r8 - zurb_wall(l,4) = zurb_wall(l,3) + 0.070_r8/2._r8 + 0.070_r8/2._r8 - zurb_wall(l,5) = zurb_wall(l,4) + 0.070_r8/2._r8 + 0.030_r8/2._r8 - - zurb_roof(l,1) = 0.010_r8/2._r8 - zurb_roof(l,2) = zurb_roof(l,1) + 0.010_r8/2._r8 + 0.010_r8/2._r8 - zurb_roof(l,3) = zurb_roof(l,2) + 0.010_r8/2._r8 + 0.010_r8/2._r8 - zurb_roof(l,4) = zurb_roof(l,3) + 0.010_r8/2._r8 + 0.010_r8/2._r8 - zurb_roof(l,5) = zurb_roof(l,4) + 0.010_r8/2._r8 + 0.030_r8/2._r8 - - dzurb_wall(l,1) = 0.010_r8 - dzurb_wall(l,2) = 0.020_r8 - dzurb_wall(l,3) = 0.070_r8 - dzurb_wall(l,4) = 0.070_r8 - dzurb_wall(l,5) = 0.030_r8 - write(iulog,*)'Total thickness of wall: ',sum(dzurb_wall(l,:)) - write(iulog,*)'Wall layer thicknesses: ',dzurb_wall(l,:) - - dzurb_roof(l,1) = 0.010_r8 - dzurb_roof(l,2) = 0.010_r8 - dzurb_roof(l,3) = 0.010_r8 - dzurb_roof(l,4) = 0.010_r8 - dzurb_roof(l,5) = 0.030_r8 - write(iulog,*)'Total thickness of roof: ',sum(dzurb_roof(l,:)) - write(iulog,*)'Roof layer thicknesses: ',dzurb_roof(l,:) - - ziurb_wall(l,0) = 0. - ziurb_wall(l,1) = dzurb_wall(l,1) - do j = 2,nlevurb - ziurb_wall(l,j) = sum(dzurb_wall(l,1:j)) - end do - write(iulog,*)'Wall layer interface depths: ',ziurb_wall(l,:) - - ziurb_roof(l,0) = 0. - ziurb_roof(l,1) = dzurb_roof(l,1) - do j = 2,nlevurb - ziurb_roof(l,j) = sum(dzurb_roof(l,1:j)) - end do - write(iulog,*)'Roof layer interface depths: ',ziurb_roof(l,:) - else if (use_mexicocity) then - zurb_wall(l,1) = 0.015_r8/2._r8 - zurb_wall(l,2) = zurb_wall(l,1) + 0.015_r8/2._r8 + 0.120_r8/2._r8 - zurb_wall(l,3) = zurb_wall(l,2) + 0.120_r8/2._r8 + 0.150_r8/2._r8 - zurb_wall(l,4) = zurb_wall(l,3) + 0.150_r8/2._r8 + 0.150_r8/2._r8 - zurb_wall(l,5) = zurb_wall(l,4) + 0.150_r8/2._r8 + 0.015_r8/2._r8 - - zurb_roof(l,1) = 0.010_r8/2._r8 - zurb_roof(l,2) = zurb_roof(l,1) + 0.010_r8/2._r8 + 0.050_r8/2._r8 - zurb_roof(l,3) = zurb_roof(l,2) + 0.050_r8/2._r8 + 0.050_r8/2._r8 - zurb_roof(l,4) = zurb_roof(l,3) + 0.050_r8/2._r8 + 0.050_r8/2._r8 - zurb_roof(l,5) = zurb_roof(l,4) + 0.050_r8/2._r8 + 0.025_r8/2._r8 - - dzurb_wall(l,1) = 0.015_r8 - dzurb_wall(l,2) = 0.120_r8 - dzurb_wall(l,3) = 0.150_r8 - dzurb_wall(l,4) = 0.150_r8 - dzurb_wall(l,5) = 0.015_r8 - write(iulog,*)'Total thickness of wall: ',sum(dzurb_wall(l,:)) - write(iulog,*)'Wall layer thicknesses: ',dzurb_wall(l,:) - - dzurb_roof(l,1) = 0.010_r8 - dzurb_roof(l,2) = 0.050_r8 - dzurb_roof(l,3) = 0.050_r8 - dzurb_roof(l,4) = 0.050_r8 - dzurb_roof(l,5) = 0.025_r8 - write(iulog,*)'Total thickness of roof: ',sum(dzurb_roof(l,:)) - write(iulog,*)'Roof layer thicknesses: ',dzurb_roof(l,:) - - ziurb_wall(l,0) = 0. - ziurb_wall(l,1) = dzurb_wall(l,1) - do j = 2,nlevurb - ziurb_wall(l,j) = sum(dzurb_wall(l,1:j)) - end do - write(iulog,*)'Wall layer interface depths: ',ziurb_wall(l,:) - - ziurb_roof(l,0) = 0. - ziurb_roof(l,1) = dzurb_roof(l,1) - do j = 2,nlevurb - ziurb_roof(l,j) = sum(dzurb_roof(l,1:j)) - end do - write(iulog,*)'Roof layer interface depths: ',ziurb_roof(l,:) - else - do j = 1, nlevurb - zurb_wall(l,j) = (j-0.5)*(thick_wall(l)/float(nlevurb)) !node depths - end do - do j = 1, nlevurb - zurb_roof(l,j) = (j-0.5)*(thick_roof(l)/float(nlevurb)) !node depths - end do - - dzurb_roof(l,1) = 0.5*(zurb_roof(l,1)+zurb_roof(l,2)) !thickness b/n two interfaces - do j = 2,nlevurb-1 - dzurb_roof(l,j)= 0.5*(zurb_roof(l,j+1)-zurb_roof(l,j-1)) - enddo - dzurb_roof(l,nlevurb) = zurb_roof(l,nlevurb)-zurb_roof(l,nlevurb-1) - - dzurb_wall(l,1) = 0.5*(zurb_wall(l,1)+zurb_wall(l,2)) !thickness b/n two interfaces - do j = 2,nlevurb-1 - dzurb_wall(l,j)= 0.5*(zurb_wall(l,j+1)-zurb_wall(l,j-1)) - enddo - dzurb_wall(l,nlevurb) = zurb_wall(l,nlevurb)-zurb_wall(l,nlevurb-1) - - ziurb_wall(l,0) = 0. - do j = 1, nlevurb-1 - ziurb_wall(l,j) = 0.5*(zurb_wall(l,j)+zurb_wall(l,j+1)) !interface depths - enddo - ziurb_wall(l,nlevurb) = zurb_wall(l,nlevurb) + 0.5*dzurb_wall(l,nlevurb) - - ziurb_roof(l,0) = 0. - do j = 1, nlevurb-1 - ziurb_roof(l,j) = 0.5*(zurb_roof(l,j)+zurb_roof(l,j+1)) !interface depths - enddo - ziurb_roof(l,nlevurb) = zurb_roof(l,nlevurb) + 0.5*dzurb_roof(l,nlevurb) - end if - end if - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - - if (lun%urbpoi(l)) then - if (col%itype(c)==icol_sunwall .or. col%itype(c)==icol_shadewall) then - col%z(c,1:nlevurb) = zurb_wall(l,1:nlevurb) - col%zi(c,0:nlevurb) = ziurb_wall(l,0:nlevurb) - col%dz(c,1:nlevurb) = dzurb_wall(l,1:nlevurb) - if (nlevurb < nlevgrnd) then - col%z(c,nlevurb+1:nlevgrnd) = spval - col%zi(c,nlevurb+1:nlevgrnd) = spval - col%dz(c,nlevurb+1:nlevgrnd) = spval - end if - else if (col%itype(c)==icol_roof) then - col%z(c,1:nlevurb) = zurb_roof(l,1:nlevurb) - col%zi(c,0:nlevurb) = ziurb_roof(l,0:nlevurb) - col%dz(c,1:nlevurb) = dzurb_roof(l,1:nlevurb) - if (nlevurb < nlevgrnd) then - col%z(c,nlevurb+1:nlevgrnd) = spval - col%zi(c,nlevurb+1:nlevgrnd) = spval - col%dz(c,nlevurb+1:nlevgrnd) = spval - end if - else - col%z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) - col%zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) - col%dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) - end if - else if (lun%itype(l) /= istdlak) then - col%z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) - col%zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) - col%dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) - end if - end do - - if (nlevurb > 0) then - deallocate(zurb_wall, zurb_roof, dzurb_wall, dzurb_roof, ziurb_wall, ziurb_roof) - end if - - !----------------------------------------------- - ! Set index defining depth to bedrock - !----------------------------------------------- - - allocate(zbedrock_in(bounds%begg:bounds%endg)) - if (use_bedrock) then - call ncd_io(ncid=ncid, varname='zbedrock', flag='read', data=zbedrock_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - call endrun( 'ERROR:: zbedrock not found on surface data set, and use_bedrock is true.'//errmsg(sourcefile, __LINE__) ) - end if - end if - - ! if use_bedrock = false, set zbedrock to lowest layer bottom interface - else - if (masterproc) write(iulog,*) 'not using use_bedrock!!' - zbedrock_in(:) = zisoi(nlevsoi) - endif - - ! determine minimum index of minimum soil depth - jmin_bedrock = 3 - do j = 3,nlevsoi - if (zisoi(j-1) < zmin_bedrock .and. zisoi(j) >= zmin_bedrock) then - jmin_bedrock = j - endif - enddo - - if (masterproc) write(iulog,*) 'jmin_bedrock: ', jmin_bedrock - - ! Determine gridcell bedrock index - do g = bounds%begg,bounds%endg - grc%nbedrock(g) = nlevsoi - do j = jmin_bedrock,nlevsoi - if (zisoi(j-1) < zbedrock_in(g) .and. zisoi(j) >= zbedrock_in(g)) then - grc%nbedrock(g) = j - end if - end do - end do - - ! Set column bedrock index - do c = begc, endc - g = col%gridcell(c) - col%nbedrock(c) = grc%nbedrock(g) - end do - - deallocate(zbedrock_in) - - !----------------------------------------------- - ! Set lake levels and layers (no interfaces) - !----------------------------------------------- - - allocate(lakedepth_in(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='LAKEDEPTH', flag='read', data=lakedepth_in, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if (masterproc) then - write(iulog,*) 'WARNING:: LAKEDEPTH not found on surface data set. All lake columns will have lake depth', & - ' set equal to default value.' - end if - lakedepth_in(:) = spval - end if - do c = begc, endc - g = col%gridcell(c) - col%lakedepth(c) = lakedepth_in(g) - end do - deallocate(lakedepth_in) - - ! Lake layers - if (.not. use_extralakelayers) then - dzlak(1) = 0.1_r8 - dzlak(2) = 1._r8 - dzlak(3) = 2._r8 - dzlak(4) = 3._r8 - dzlak(5) = 4._r8 - dzlak(6) = 5._r8 - dzlak(7) = 7._r8 - dzlak(8) = 7._r8 - dzlak(9) = 10.45_r8 - dzlak(10)= 10.45_r8 - - zlak(1) = 0.05_r8 - zlak(2) = 0.6_r8 - zlak(3) = 2.1_r8 - zlak(4) = 4.6_r8 - zlak(5) = 8.1_r8 - zlak(6) = 12.6_r8 - zlak(7) = 18.6_r8 - zlak(8) = 25.6_r8 - zlak(9) = 34.325_r8 - zlak(10)= 44.775_r8 - else - dzlak(1) =0.1_r8 - dzlak(2) =0.25_r8 - dzlak(3) =0.25_r8 - dzlak(4) =0.25_r8 - dzlak(5) =0.25_r8 - dzlak(6) =0.5_r8 - dzlak(7) =0.5_r8 - dzlak(8) =0.5_r8 - dzlak(9) =0.5_r8 - dzlak(10) =0.75_r8 - dzlak(11) =0.75_r8 - dzlak(12) =0.75_r8 - dzlak(13) =0.75_r8 - dzlak(14) =2_r8 - dzlak(15) =2_r8 - dzlak(16) =2.5_r8 - dzlak(17) =2.5_r8 - dzlak(18) =3.5_r8 - dzlak(19) =3.5_r8 - dzlak(20) =3.5_r8 - dzlak(21) =3.5_r8 - dzlak(22) =5.225_r8 - dzlak(23) =5.225_r8 - dzlak(24) =5.225_r8 - dzlak(25) =5.225_r8 - - zlak(1) = dzlak(1)/2._r8 - do i=2,nlevlak - zlak(i) = zlak(i-1) + (dzlak(i-1)+dzlak(i))/2._r8 - end do - end if - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - - if (lun%itype(l) == istdlak) then - - if (col%lakedepth(c) == spval) then - col%lakedepth(c) = zlak(nlevlak) + 0.5_r8*dzlak(nlevlak) - col%z_lake(c,1:nlevlak) = zlak(1:nlevlak) - col%dz_lake(c,1:nlevlak) = dzlak(1:nlevlak) - - else if (col%lakedepth(c) > 1._r8 .and. col%lakedepth(c) < 5000._r8) then - - depthratio = col%lakedepth(c) / (zlak(nlevlak) + 0.5_r8*dzlak(nlevlak)) - col%z_lake(c,1) = zlak(1) - col%dz_lake(c,1) = dzlak(1) - col%dz_lake(c,2:nlevlak-1) = dzlak(2:nlevlak-1)*depthratio - col%dz_lake(c,nlevlak) = dzlak(nlevlak)*depthratio - (col%dz_lake(c,1) - dzlak(1)*depthratio) - do lev=2,nlevlak - col%z_lake(c,lev) = col%z_lake(c,lev-1) + (col%dz_lake(c,lev-1)+col%dz_lake(c,lev))/2._r8 - end do - - else if (col%lakedepth(c) > 0._r8 .and. col%lakedepth(c) <= 1._r8) then - - col%dz_lake(c,:) = col%lakedepth(c) / nlevlak; - col%z_lake(c,1) = col%dz_lake(c,1) / 2._r8; - do lev=2,nlevlak - col%z_lake(c,lev) = col%z_lake(c,lev-1) + (col%dz_lake(c,lev-1)+col%dz_lake(c,lev))/2._r8 - end do - - else - - write(iulog,*)'Bad lake depth: lakedepth: ', col%lakedepth(c) - call shr_sys_abort(errmsg(sourcefile, __LINE__)) - - end if - - col%z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) - col%zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) - col%dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) - end if - end do - - ! ------------------------------------------------------------------------ - ! Set classes of layers - ! ------------------------------------------------------------------------ - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (hasBedrock(col_itype=col%itype(c), lun_itype=lun%itype(l))) then - ! NOTE(wjs, 2015-10-17) We are assuming that points with bedrock have both - ! "shallow" and "deep" bedrock. Currently, this is not true for lake columns: - ! lakes do not distinguish between "shallow" bedrock and "normal" soil. - ! However, that was just due to an oversight that is supposed to be corrected - ! soon; so to keep things simple we assume that any point with bedrock - ! potentially has both shallow and deep bedrock. - col%levgrnd_class(c, 1:col%nbedrock(c)) = LEVGRND_CLASS_STANDARD - if (col%nbedrock(c) < nlevsoi) then - col%levgrnd_class(c, (col%nbedrock(c) + 1) : nlevsoi) = LEVGRND_CLASS_SHALLOW_BEDROCK - end if - col%levgrnd_class(c, (nlevsoi + 1) : nlevgrnd) = LEVGRND_CLASS_DEEP_BEDROCK - else - col%levgrnd_class(c, 1:nlevgrnd) = LEVGRND_CLASS_STANDARD - end if - end do - - do j = 1, nlevgrnd - do c = bounds%begc, bounds%endc - if (col%z(c,j) == spval) then - col%levgrnd_class(c,j) = ispval - end if - end do - end do - - !----------------------------------------------- - ! Set cold-start values for snow levels, snow layers and snow interfaces - !----------------------------------------------- - - call InitSnowLayers(bounds, snow_depth(bounds%begc:bounds%endc)) - - !----------------------------------------------- - ! Read in topographic index and slope - !----------------------------------------------- - - allocate(tslope(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='SLOPE', flag='read', data=tslope, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call shr_sys_abort(' ERROR: TOPOGRAPHIC SLOPE NOT on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - do c = begc,endc - g = col%gridcell(c) - ! check for near zero slopes, set minimum value - col%topo_slope(c) = max(tslope(g), 0.2_r8) - end do - deallocate(tslope) - - allocate(std(bounds%begg:bounds%endg)) - call ncd_io(ncid=ncid, varname='STD_ELEV', flag='read', data=std, dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call shr_sys_abort(' ERROR: TOPOGRAPHIC STDdev (STD_ELEV) NOT on surfdata file'//& - errMsg(sourcefile, __LINE__)) - end if - do c = begc,endc - g = col%gridcell(c) - ! Topographic variables - col%topo_std(c) = std(g) - end do - deallocate(std) - - !----------------------------------------------- - ! SCA shape function defined - !----------------------------------------------- - - do c = begc,endc - l = col%landunit(c) - g = col%gridcell(c) - - if (lun%itype(l)==istice_mec .and. glc_behavior%allow_multiple_columns_grc(g)) then - ! ice_mec columns already account for subgrid topographic variability through - ! their use of multiple elevation classes; thus, to avoid double-accounting for - ! topographic variability in these columns, we ignore topo_std and use a fixed - ! value of n_melt. - col%n_melt(c) = n_melt_glcmec - else - col%n_melt(c) = 200.0/max(10.0_r8, col%topo_std(c)) - end if - - ! microtopographic parameter, units are meters (try smooth function of slope) - - slopebeta = 3._r8 - slopemax = 0.4_r8 - slope0 = slopemax**(-1._r8/slopebeta) - col%micro_sigma(c) = (col%topo_slope(c) + slope0)**(-slopebeta) - end do - - call ncd_pio_closefile(ncid) - - end subroutine initVertical - - !----------------------------------------------------------------------- - logical function hasBedrock(col_itype, lun_itype) - ! - ! !DESCRIPTION: - ! Returns true if the given column type has a representation of bedrock - i.e., a set - ! of layers at the bottom of the column that are treated fundamentally differently - ! from the upper layers. - ! - ! !USES: - use landunit_varcon, only : istice_mec, isturb_MIN, isturb_MAX - use column_varcon , only : icol_road_perv - ! - ! !ARGUMENTS: - integer, intent(in) :: col_itype ! col%itype value - integer, intent(in) :: lun_itype ! lun%itype value for the landunit on which this column sits - ! If we had an easy way to figure out which landunit a column was on based on - ! col_itype (which would be very helpful!), then we wouldn't need lun_itype. - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'hasBedrock' - !----------------------------------------------------------------------- - - ! TODO(wjs, 2015-10-17) I don't like that the logic here implicitly duplicates logic - ! elsewhere in the code. For example, if there were a change in the lake code so that - ! it no longer treated the bottom layers as bedrock, then that change would need to be - ! reflected here. One solution would be to set some has_bedrock flag in one central - ! place, and then have the science code use that. But that could get messy in the - ! science code. Another solution would be to decentralize the definition of - ! hasBedrock, so that (for example) the lake code itself sets the value for lun_itype - ! == istdlak - that way, hasBedrock(lake) would be more likely to get updated - ! correctly if the lake logic changes. - - if (lun_itype == istice_mec) then - hasBedrock = .false. - else if (lun_itype >= isturb_MIN .and. lun_itype <= isturb_MAX) then - if (col_itype == icol_road_perv) then - hasBedrock = .true. - else - hasBedrock = .false. - end if - else - hasBedrock = .true. - end if - - ! As an independent check of the above logic, assert that, at the very least, any - ! hydrologically-active column is given hasBedrock = .true. This is to try to catch - ! problems with new column types being added that aren't handled properly by the - ! above logic, since (as noted in the todo note above) there is some implicit - ! duplication of logic between this routine and other parts of the code, which is - ! dangerous. For example, if a new "urban lawn" type is added, then it should have - ! hasBedrock = .true. - and this omission will hopefully be caught by this assertion. - if (is_hydrologically_active(col_itype=col_itype, lun_itype=lun_itype)) then - SHR_ASSERT(hasBedrock, "hasBedrock should be true for all hydrologically-active columns") - end if - - end function hasBedrock - - -end module initVerticalMod diff --git a/src/main/init_hydrology.F90 b/src/main/init_hydrology.F90 deleted file mode 100644 index f03658c71a..0000000000 --- a/src/main/init_hydrology.F90 +++ /dev/null @@ -1,39 +0,0 @@ -subroutine init_hydrology( NLFilename ) -! -!DESCRIPTION -! Initialize implementation methods for different hydrology sub-modules -! This is created for unit-based sensitivity tests -! created by Jinyun Tang, Mar 22, 2014. - - ! !USES: - use spmdMod , only : masterproc, mpicom - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use shr_mpi_mod , only : shr_mpi_bcast - - use FuncPedotransferMod, only : init_pedof - use RootBiophysMod, only : init_rootprof - use SoilWaterMovementMod, only : init_soilwater_movement - use SoilMoistStressMod, only : init_root_moist_stress -implicit none - - character(len=*), intent(IN) :: NLFilename ! Namelist filename - - !In future versions, a namelist will be created here to - !set up options for different sub-models, the namelist file - !will also be passed into this different initializing methods - !to read in their local parameters, Jinyun Tang, Mar 29, 2014 - - call init_pedof - - call init_rootprof(NLFilename) - - call init_soilwater_movement - - call init_root_moist_stress - -! remove due to circular dependency of nlfilename, read namlist -! in controlmod instead, as is done for canopyhydrology -! call init_soil_resistance - -end subroutine init_hydrology diff --git a/src/main/landunit_varcon.F90 b/src/main/landunit_varcon.F90 deleted file mode 100644 index b6ddc7cf5c..0000000000 --- a/src/main/landunit_varcon.F90 +++ /dev/null @@ -1,133 +0,0 @@ -module landunit_varcon - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing landunit indices and associated variables and routines. - ! - ! !USES: -#include "shr_assert.h" - ! - ! - ! !PUBLIC TYPES: - implicit none - private - - !------------------------------------------------------------------ - ! Initialize landunit type constants - !------------------------------------------------------------------ - - integer, parameter, public :: istsoil = 1 !soil landunit type (natural vegetation) - integer, parameter, public :: istcrop = 2 !crop landunit type - ! Landunit 3 currently unused (used to be non-multiple elevation class glacier type: istice) - integer, parameter, public :: istice_mec = 4 !land ice (multiple elevation classes) landunit type - integer, parameter, public :: istdlak = 5 !deep lake landunit type (now used for all lakes) - integer, parameter, public :: istwet = 6 !wetland landunit type (swamp, marsh, etc.) - - integer, parameter, public :: isturb_MIN = 7 !minimum urban type index - integer, parameter, public :: isturb_tbd = 7 !urban tbd landunit type - integer, parameter, public :: isturb_hd = 8 !urban hd landunit type - integer, parameter, public :: isturb_md = 9 !urban md landunit type - integer, parameter, public :: isturb_MAX = 9 !maximum urban type index - - integer, parameter, public :: max_lunit = 9 !maximum value that lun%itype can have - !(i.e., largest value in the above list) - - integer, parameter, public :: landunit_name_length = 40 ! max length of landunit names - character(len=landunit_name_length), public :: landunit_names(max_lunit) ! name of each landunit type - - ! parameters that depend on the above constants - - integer, parameter, public :: numurbl = isturb_MAX - isturb_MIN + 1 ! number of urban landunits - - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: landunit_varcon_init ! initialize constants in this module - public :: landunit_is_special ! returns true if this is a special landunit - - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: set_landunit_names ! set the landunit_names vector -!----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine landunit_varcon_init() - ! - ! !DESCRIPTION: - ! Initialize constants in landunit_varcon - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'landunit_varcon_init' - !----------------------------------------------------------------------- - - call set_landunit_names() - - end subroutine landunit_varcon_init - - !----------------------------------------------------------------------- - function landunit_is_special(ltype) result(is_special) - ! - ! !DESCRIPTION: - ! Returns true if the landunit type ltype is a special landunit; returns false otherwise - ! - ! !USES: - ! - ! !ARGUMENTS: - logical :: is_special ! function result - integer :: ltype ! landunit type of interest - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'landunit_is_special' - !----------------------------------------------------------------------- - - SHR_ASSERT((ltype >= 1 .and. ltype <= max_lunit), subname//': ltype out of bounds') - - if (ltype == istsoil .or. ltype == istcrop) then - is_special = .false. - else - is_special = .true. - end if - - end function landunit_is_special - - - !----------------------------------------------------------------------- - subroutine set_landunit_names - ! - ! !DESCRIPTION: - ! Set the landunit_names vector - ! - ! !USES: - use shr_sys_mod, only : shr_sys_abort - ! - character(len=*), parameter :: not_set = 'NOT_SET' - character(len=*), parameter :: unused = 'UNUSED' - character(len=*), parameter :: subname = 'set_landunit_names' - !----------------------------------------------------------------------- - - landunit_names(:) = not_set - - landunit_names(istsoil) = 'vegetated_or_bare_soil' - landunit_names(istcrop) = 'crop' - landunit_names(istcrop+1) = unused - landunit_names(istice_mec) = 'landice_multiple_elevation_classes' - landunit_names(istdlak) = 'deep_lake' - landunit_names(istwet) = 'wetland' - landunit_names(isturb_tbd) = 'urban_tbd' - landunit_names(isturb_hd) = 'urban_hd' - landunit_names(isturb_md) = 'urban_md' - - if (any(landunit_names == not_set)) then - call shr_sys_abort(trim(subname)//': Not all landunit names set') - end if - - end subroutine set_landunit_names - -end module landunit_varcon diff --git a/src/main/lnd2atmMod.F90 b/src/main/lnd2atmMod.F90 deleted file mode 100644 index 2a4a00d5cd..0000000000 --- a/src/main/lnd2atmMod.F90 +++ /dev/null @@ -1,491 +0,0 @@ -module lnd2atmMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle lnd2atm mapping - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_megan_mod , only : shr_megan_mechcomps_n - use shr_fire_emis_mod , only : shr_fire_emis_mechcomps_n - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. - use clm_varcon , only : rair, grav, cpair, hfus, tfrz, spval - use clm_varctl , only : iulog, use_lch4 - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use decompMod , only : bounds_type - use subgridAveMod , only : p2g, c2g - use lnd2atmType , only : lnd2atm_type - use atm2lndType , only : atm2lnd_type - use ch4Mod , only : ch4_type - use DUSTMod , only : dust_type - use DryDepVelocity , only : drydepvel_type - use VocEmissionMod , only : vocemis_type - use CNFireEmissionsMod , only : fireemis_type - use EnergyFluxType , only : energyflux_type - use FrictionVelocityMod , only : frictionvel_type - use SolarAbsorbedType , only : solarabs_type - use SurfaceAlbedoType , only : surfalb_type - use TemperatureType , only : temperature_type - use WaterFluxType , only : waterflux_type - use WaterstateType , only : waterstate_type - use IrrigationMod , only : irrigation_type - use glcBehaviorMod , only : glc_behavior_type - use glc2lndMod , only : glc2lnd_type - use ColumnType , only : col - use LandunitType , only : lun - use GridcellType , only : grc - use landunit_varcon , only : istice_mec - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: lnd2atm - public :: lnd2atm_minimal - - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: handle_ice_runoff - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine lnd2atm_minimal(bounds, & - waterstate_inst, surfalb_inst, energyflux_inst, lnd2atm_inst) - ! - ! !DESCRIPTION: - ! Compute clm_l2a_inst component of gridcell derived type. This routine computes - ! the bare minimum of components necessary to get the first step of a - ! run started. - ! - ! !USES: - use clm_varcon, only : sb - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(waterstate_type) , intent(in) :: waterstate_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(lnd2atm_type) , intent(inout) :: lnd2atm_inst - ! - ! !LOCAL VARIABLES: - integer :: g ! index - real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon - real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen - real(r8), parameter :: amCO2 = amC + 2.0_r8*amO ! Atomic mass number for CO2 - ! The following converts g of C to kg of CO2 - real(r8), parameter :: convertgC2kgCO2 = 1.0e-3_r8 * (amCO2/amC) - !------------------------------------------------------------------------ - - call c2g(bounds, & - waterstate_inst%h2osno_col (bounds%begc:bounds%endc), & - lnd2atm_inst%h2osno_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - do g = bounds%begg,bounds%endg - lnd2atm_inst%h2osno_grc(g) = lnd2atm_inst%h2osno_grc(g)/1000._r8 - end do - - call c2g(bounds, nlevgrnd, & - waterstate_inst%h2osoi_vol_col (bounds%begc:bounds%endc, :), & - lnd2atm_inst%h2osoi_vol_grc (bounds%begg:bounds%endg, :), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, numrad, & - surfalb_inst%albd_patch (bounds%begp:bounds%endp, :), & - lnd2atm_inst%albd_grc (bounds%begg:bounds%endg, :), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, numrad, & - surfalb_inst%albi_patch (bounds%begp:bounds%endp, :), & - lnd2atm_inst%albi_grc (bounds%begg:bounds%endg, :), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, & - energyflux_inst%eflx_lwrad_out_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%eflx_lwrad_out_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - do g = bounds%begg,bounds%endg - lnd2atm_inst%t_rad_grc(g) = sqrt(sqrt(lnd2atm_inst%eflx_lwrad_out_grc(g)/sb)) - end do - - end subroutine lnd2atm_minimal - - !------------------------------------------------------------------------ - subroutine lnd2atm(bounds, & - atm2lnd_inst, surfalb_inst, temperature_inst, frictionvel_inst, & - waterstate_inst, waterflux_inst, irrigation_inst, energyflux_inst, & - solarabs_inst, drydepvel_inst, & - vocemis_inst, fireemis_inst, dust_inst, ch4_inst, glc_behavior, & - lnd2atm_inst, & - net_carbon_exchange_grc) - ! - ! !DESCRIPTION: - ! Compute lnd2atm_inst component of gridcell derived type - ! - ! !USES: - use ch4varcon , only : ch4offline - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(surfalb_type) , intent(in) :: surfalb_inst - type(temperature_type) , intent(in) :: temperature_inst - type(frictionvel_type) , intent(in) :: frictionvel_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(irrigation_type) , intent(in) :: irrigation_inst - type(energyflux_type) , intent(in) :: energyflux_inst - type(solarabs_type) , intent(in) :: solarabs_inst - type(drydepvel_type) , intent(in) :: drydepvel_inst - type(vocemis_type) , intent(in) :: vocemis_inst - type(fireemis_type) , intent(in) :: fireemis_inst - type(dust_type) , intent(in) :: dust_inst - type(ch4_type) , intent(in) :: ch4_inst - type(glc_behavior_type) , intent(in) :: glc_behavior - type(lnd2atm_type) , intent(inout) :: lnd2atm_inst - real(r8) , intent(in) :: net_carbon_exchange_grc( bounds%begg: ) ! net carbon exchange between land and atmosphere, positive for source (gC/m2/s) - ! - ! !LOCAL VARIABLES: - integer :: c, g ! indices - real(r8) :: qflx_ice_runoff_col(bounds%begc:bounds%endc) ! total column-level ice runoff - real(r8) :: eflx_sh_ice_to_liq_grc(bounds%begg:bounds%endg) ! sensible heat flux generated from the ice to liquid conversion, averaged to gridcell - real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon - real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen - real(r8), parameter :: amCO2 = amC + 2.0_r8*amO ! Atomic mass number for CO2 - ! The following converts g of C to kg of CO2 - real(r8), parameter :: convertgC2kgCO2 = 1.0e-3_r8 * (amCO2/amC) - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(net_carbon_exchange_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call handle_ice_runoff(bounds, waterflux_inst, glc_behavior, & - melt_non_icesheet_ice_runoff = lnd2atm_inst%params%melt_non_icesheet_ice_runoff, & - qflx_ice_runoff_col = qflx_ice_runoff_col(bounds%begc:bounds%endc), & - qflx_liq_from_ice_col = lnd2atm_inst%qflx_liq_from_ice_col(bounds%begc:bounds%endc), & - eflx_sh_ice_to_liq_col = lnd2atm_inst%eflx_sh_ice_to_liq_col(bounds%begc:bounds%endc)) - - !---------------------------------------------------- - ! lnd -> atm - !---------------------------------------------------- - - ! First, compute the "minimal" set of fields. - call lnd2atm_minimal(bounds, & - waterstate_inst, surfalb_inst, energyflux_inst, lnd2atm_inst) - - call p2g(bounds, & - temperature_inst%t_ref2m_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%t_ref2m_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - waterstate_inst%q_ref2m_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%q_ref2m_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - frictionvel_inst%u10_clm_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%u_ref10m_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - energyflux_inst%taux_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%taux_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - energyflux_inst%tauy_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%tauy_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - waterflux_inst%qflx_evap_tot_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%qflx_evap_tot_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, & - solarabs_inst%fsa_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%fsa_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(bounds, & - frictionvel_inst%fv_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%fv_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(bounds, & - frictionvel_inst%ram1_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%ram1_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g( bounds, & - energyflux_inst%eflx_sh_tot_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%eflx_sh_tot_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity',c2l_scale_type='urbanf',l2g_scale_type='unity') - call c2g( bounds, & - energyflux_inst%eflx_sh_precip_conversion_col (bounds%begc:bounds%endc), & - lnd2atm_inst%eflx_sh_precip_conversion_grc (bounds%begg:bounds%endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity') - call c2g( bounds, & - lnd2atm_inst%eflx_sh_ice_to_liq_col(bounds%begc:bounds%endc), & - eflx_sh_ice_to_liq_grc(bounds%begg:bounds%endg), & - c2l_scale_type='urbanf', l2g_scale_type='unity') - do g = bounds%begg, bounds%endg - lnd2atm_inst%eflx_sh_tot_grc(g) = lnd2atm_inst%eflx_sh_tot_grc(g) + & - lnd2atm_inst%eflx_sh_precip_conversion_grc(g) + & - eflx_sh_ice_to_liq_grc(g) - & - energyflux_inst%eflx_dynbal_grc(g) - enddo - - call p2g(bounds, & - energyflux_inst%eflx_lh_tot_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%eflx_lh_tot_grc (bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - do g = bounds%begg, bounds%endg - lnd2atm_inst%net_carbon_exchange_grc(g) = & - net_carbon_exchange_grc(g) - end do - if (use_lch4) then - if (.not. ch4offline) then - ! Adjust flux of CO2 by the net conversion of mineralizing C to CH4 - do g = bounds%begg,bounds%endg - ! nem is in g C/m2/sec - lnd2atm_inst%net_carbon_exchange_grc(g) = & - lnd2atm_inst%net_carbon_exchange_grc(g) + lnd2atm_inst%nem_grc(g) - end do - end if - end if - ! Convert from gC/m2/s to kgCO2/m2/s - do g = bounds%begg,bounds%endg - lnd2atm_inst%net_carbon_exchange_grc(g) = & - lnd2atm_inst%net_carbon_exchange_grc(g)*convertgC2kgCO2 - end do - - ! drydepvel - if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then - call p2g(bounds, n_drydep, & - drydepvel_inst%velocity_patch (bounds%begp:bounds%endp, :), & - lnd2atm_inst%ddvel_grc (bounds%begg:bounds%endg, :), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - endif - - ! voc emission flux - if (shr_megan_mechcomps_n>0) then - call p2g(bounds, shr_megan_mechcomps_n, & - vocemis_inst%vocflx_patch(bounds%begp:bounds%endp,:), & - lnd2atm_inst%flxvoc_grc (bounds%begg:bounds%endg,:), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - end if - - ! fire emissions fluxes - if (shr_fire_emis_mechcomps_n>0) then - call p2g(bounds, shr_fire_emis_mechcomps_n, & - -fireemis_inst%fireflx_patch(bounds%begp:bounds%endp,:), & - lnd2atm_inst%fireflx_grc (bounds%begg:bounds%endg,:), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - call p2g(bounds, & - fireemis_inst%ztop_patch (bounds%begp:bounds%endp), & - lnd2atm_inst%fireztop_grc(bounds%begg:bounds%endg), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - endif - - ! dust emission flux - call p2g(bounds, ndst, & - dust_inst%flx_mss_vrt_dst_patch(bounds%begp:bounds%endp, :), & - lnd2atm_inst%flxdst_grc (bounds%begg:bounds%endg, :), & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - - ! ch4 flux - if (use_lch4) then - call c2g( bounds, & - ch4_inst%ch4_surf_flux_tot_col (bounds%begc:bounds%endc), & - lnd2atm_inst%flux_ch4_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'unity', l2g_scale_type='unity' ) - end if - - !---------------------------------------------------- - ! lnd -> rof - !---------------------------------------------------- - - call c2g( bounds, & - waterflux_inst%qflx_surf_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_qsur_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - waterflux_inst%qflx_drain_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_qsub_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - ! It's not entirely appropriate to put qflx_liq_from_ice_col into - ! qflx_qrgwl_col, since this isn't necessarily just glaciers, wetlands and - ! lakes. But since we put the liquid portion of snow capping into - ! qflx_qrgwl_col, it seems reasonable to put qflx_liq_from_ice_col there as - ! well. - waterflux_inst%qflx_qrgwl_col(c) = waterflux_inst%qflx_qrgwl_col(c) + & - lnd2atm_inst%qflx_liq_from_ice_col(c) - - ! qflx_runoff is the sum of a number of terms, including qflx_qrgwl. Since we - ! are adjusting qflx_qrgwl above, we need to adjust qflx_runoff analogously. - waterflux_inst%qflx_runoff_col(c) = waterflux_inst%qflx_runoff_col(c) + & - lnd2atm_inst%qflx_liq_from_ice_col(c) - end if - end do - - call c2g( bounds, & - waterflux_inst%qflx_qrgwl_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_qgwl_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - waterflux_inst%qflx_runoff_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - do g = bounds%begg, bounds%endg - lnd2atm_inst%qflx_rofliq_qgwl_grc(g) = lnd2atm_inst%qflx_rofliq_qgwl_grc(g) - waterflux_inst%qflx_liq_dynbal_grc(g) - lnd2atm_inst%qflx_rofliq_grc(g) = lnd2atm_inst%qflx_rofliq_grc(g) - waterflux_inst%qflx_liq_dynbal_grc(g) - enddo - - call c2g( bounds, & - waterflux_inst%qflx_h2osfc_surf_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_h2osfc_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - waterflux_inst%qflx_drain_perched_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofliq_drain_perched_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - irrigation_inst%qflx_irrig_col (bounds%begc:bounds%endc), & - lnd2atm_inst%qirrig_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - - call c2g( bounds, & - qflx_ice_runoff_col(bounds%begc:bounds%endc), & - lnd2atm_inst%qflx_rofice_grc(bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - do g = bounds%begg, bounds%endg - lnd2atm_inst%qflx_rofice_grc(g) = lnd2atm_inst%qflx_rofice_grc(g) - waterflux_inst%qflx_ice_dynbal_grc(g) - enddo - - ! calculate total water storage for history files - ! first set tws to gridcell total endwb - ! second add river storage as gridcell average depth (1.e-3 converts [m3/km2] to [mm]) - ! TODO - this was in BalanceCheckMod - not sure where it belongs? - - call c2g( bounds, & - waterstate_inst%endwb_col(bounds%begc:bounds%endc), & - waterstate_inst%tws_grc (bounds%begg:bounds%endg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - do g = bounds%begg, bounds%endg - waterstate_inst%tws_grc(g) = waterstate_inst%tws_grc(g) + atm2lnd_inst%volr_grc(g) / grc%area(g) * 1.e-3_r8 - enddo - - end subroutine lnd2atm - - !----------------------------------------------------------------------- - subroutine handle_ice_runoff(bounds, waterflux_inst, glc_behavior, & - melt_non_icesheet_ice_runoff, & - qflx_ice_runoff_col, qflx_liq_from_ice_col, eflx_sh_ice_to_liq_col) - ! - ! !DESCRIPTION: - ! Take column-level ice runoff and divide it between (a) ice runoff, and (b) liquid - ! runoff with a compensating negative sensible heat flux. - ! - ! The rationale here is: Ice runoff is largely meant to represent a crude - ! parameterization of iceberg calving. Iceberg calving is mainly appropriate in - ! regions where an ice sheet terminates at the land-ocean boundary. Elsewhere, in - ! reality, we expect most ice runoff to flow downstream and melt before it reaches the - ! ocean. Furthermore, sending ice runoff directly to the ocean can lead to runaway sea - ! ice growth in some regions (around the Canadian archipelago, and possibly in more - ! wide-spread regions of the Arctic Ocean); melting this ice before it reaches the - ! ocean avoids this problem. - ! - ! If the river model were able to melt ice, then we might not need this routine. - ! - ! Note that this routine does NOT handle ice runoff generated via the dynamic - ! landunits adjustment fluxes (i.e., the fluxes that compensate for a difference in - ! ice content between the pre- and post-dynamic landunit areas). This is partly - ! because those gridcell-level dynamic landunits adjustment fluxes do not fit well - ! with this column-based infrastructure, and partly because either method of handling - ! these fluxes (i.e., sending an ice runoff or sending a liquid runoff with a - ! negative sensible heat flux) seems equally justifiable. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(waterflux_type), intent(in) :: waterflux_inst - type(glc_behavior_type), intent(in) :: glc_behavior - logical, intent(in) :: melt_non_icesheet_ice_runoff - real(r8), intent(out) :: qflx_ice_runoff_col( bounds%begc: ) ! total column-level ice runoff (mm H2O /s) - real(r8), intent(out) :: qflx_liq_from_ice_col( bounds%begc: ) ! liquid runoff from converted ice runoff (mm H2O /s) - real(r8), intent(out) :: eflx_sh_ice_to_liq_col( bounds%begc: ) ! sensible heat flux generated from the ice to liquid conversion (W/m2) (+ to atm) - - ! - ! !LOCAL VARIABLES: - integer :: c, l, g - logical :: do_conversion - - character(len=*), parameter :: subname = 'handle_ice_runoff' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(qflx_ice_runoff_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(qflx_liq_from_ice_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(eflx_sh_ice_to_liq_col) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do c = bounds%begc, bounds%endc - if (col%active(c)) then - qflx_ice_runoff_col(c) = waterflux_inst%qflx_ice_runoff_snwcp_col(c) + & - waterflux_inst%qflx_ice_runoff_xs_col(c) - qflx_liq_from_ice_col(c) = 0._r8 - eflx_sh_ice_to_liq_col(c) = 0._r8 - end if - end do - - if (melt_non_icesheet_ice_runoff) then - do c = bounds%begc, bounds%endc - if (col%active(c)) then - l = col%landunit(c) - g = col%gridcell(c) - do_conversion = .false. - if (lun%itype(l) /= istice_mec) then - do_conversion = .true. - else ! istice_mec - if (glc_behavior%ice_runoff_melted_grc(g)) then - do_conversion = .true. - else - do_conversion = .false. - end if - end if - if (do_conversion) then - ! ice to liquid absorbs energy, so results in a negative heat flux to atm - ! Note that qflx_ice_runoff_col is in mm H2O/s, which is the same as kg - ! m-2 s-1, so we can simply multiply by hfus. - eflx_sh_ice_to_liq_col(c) = -qflx_ice_runoff_col(c) * hfus - qflx_liq_from_ice_col(c) = qflx_ice_runoff_col(c) - qflx_ice_runoff_col(c) = 0._r8 - end if - end if - end do - end if - - end subroutine handle_ice_runoff - - -end module lnd2atmMod diff --git a/src/main/lnd2atmType.F90 b/src/main/lnd2atmType.F90 deleted file mode 100644 index 023608a4a7..0000000000 --- a/src/main/lnd2atmType.F90 +++ /dev/null @@ -1,329 +0,0 @@ -module lnd2atmType - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle atm2lnd, lnd2atm mapping - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. - use clm_varcon , only : spval - use clm_varctl , only : iulog, use_lch4 - use shr_megan_mod , only : shr_megan_mechcomps_n - use shr_fire_emis_mod,only : shr_fire_emis_mechcomps_n - use seq_drydep_mod, only : n_drydep, drydep_method, DD_XLND - ! - ! !PUBLIC TYPES: - implicit none - private - - type, public :: lnd2atm_params_type - ! true => ice runoff generated from non-glacier columns and glacier columns outside - ! icesheet regions is converted to liquid, with an appropriate sensible heat flux - logical, public :: melt_non_icesheet_ice_runoff - end type lnd2atm_params_type - - ! ---------------------------------------------------- - ! land -> atmosphere variables structure - !---------------------------------------------------- - type, public :: lnd2atm_type - type(lnd2atm_params_type) :: params - - ! lnd->atm - real(r8), pointer :: t_rad_grc (:) => null() ! radiative temperature (Kelvin) - real(r8), pointer :: t_ref2m_grc (:) => null() ! 2m surface air temperature (Kelvin) - real(r8), pointer :: q_ref2m_grc (:) => null() ! 2m surface specific humidity (kg/kg) - real(r8), pointer :: u_ref10m_grc (:) => null() ! 10m surface wind speed (m/sec) - real(r8), pointer :: h2osno_grc (:) => null() ! snow water (mm H2O) - real(r8), pointer :: h2osoi_vol_grc (:,:) => null() ! volumetric soil water (0~watsat, m3/m3, nlevgrnd) (for dust model) - real(r8), pointer :: albd_grc (:,:) => null() ! (numrad) surface albedo (direct) - real(r8), pointer :: albi_grc (:,:) => null() ! (numrad) surface albedo (diffuse) - real(r8), pointer :: taux_grc (:) => null() ! wind stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy_grc (:) => null() ! wind stress: n-s (kg/m/s**2) - real(r8), pointer :: eflx_lh_tot_grc (:) => null() ! total latent HF (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_grc (:) => null() ! total sensible HF (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_precip_conversion_grc(:) => null() ! sensible HF from precipitation conversion (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_ice_to_liq_col(:) => null() ! sensible HF generated from conversion of ice runoff to liquid (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lwrad_out_grc (:) => null() ! IR (longwave) radiation (W/m**2) - real(r8), pointer :: qflx_evap_tot_grc (:) => null() ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: fsa_grc (:) => null() ! solar rad absorbed (total) (W/m**2) - real(r8), pointer :: net_carbon_exchange_grc(:) => null() ! net CO2 flux (kg CO2/m**2/s) [+ to atm] - real(r8), pointer :: nem_grc (:) => null() ! gridcell average net methane correction to CO2 flux (g C/m^2/s) - real(r8), pointer :: ram1_grc (:) => null() ! aerodynamical resistance (s/m) - real(r8), pointer :: fv_grc (:) => null() ! friction velocity (m/s) (for dust model) - real(r8), pointer :: flxdst_grc (:,:) => null() ! dust flux (size bins) - real(r8), pointer :: ddvel_grc (:,:) => null() ! dry deposition velocities - real(r8), pointer :: flxvoc_grc (:,:) => null() ! VOC flux (size bins) - real(r8), pointer :: fireflx_grc (:,:) => null() ! Wild Fire Emissions - real(r8), pointer :: fireztop_grc (:) => null() ! Wild Fire Emissions vertical distribution top - real(r8), pointer :: flux_ch4_grc (:) => null() ! net CH4 flux (kg C/m**2/s) [+ to atm] - ! lnd->rof - real(r8), pointer :: qflx_rofliq_grc (:) => null() ! rof liq forcing - real(r8), pointer :: qflx_rofliq_qsur_grc (:) => null() ! rof liq -- surface runoff component - real(r8), pointer :: qflx_rofliq_qsub_grc (:) => null() ! rof liq -- subsurface runoff component - real(r8), pointer :: qflx_rofliq_qgwl_grc (:) => null() ! rof liq -- glacier, wetland and lakes water balance residual component - real(r8), pointer :: qflx_rofliq_h2osfc_grc (:) => null() ! rof liq -- surface water runoff component - real(r8), pointer :: qflx_rofliq_drain_perched_grc (:) => null() ! rof liq -- perched water table runoff component - real(r8), pointer :: qflx_rofice_grc (:) => null() ! rof ice forcing - real(r8), pointer :: qflx_liq_from_ice_col(:) => null() ! liquid runoff from converted ice runoff - real(r8), pointer :: qirrig_grc (:) => null() ! irrigation flux - - contains - - procedure, public :: Init - procedure, private :: ReadNamelist - procedure, private :: InitAllocate - procedure, private :: InitHistory - - end type lnd2atm_type - !------------------------------------------------------------------------ - - interface lnd2atm_params_type - module procedure lnd2atm_params_constructor - end interface lnd2atm_params_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !----------------------------------------------------------------------- - function lnd2atm_params_constructor(melt_non_icesheet_ice_runoff) & - result(params) - ! - ! !DESCRIPTION: - ! Creates a new instance of lnd2atm_params_type - ! - ! !ARGUMENTS: - type(lnd2atm_params_type) :: params ! function result - logical, intent(in) :: melt_non_icesheet_ice_runoff - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'lnd2atm_params_type' - !----------------------------------------------------------------------- - - params%melt_non_icesheet_ice_runoff = melt_non_icesheet_ice_runoff - - end function lnd2atm_params_constructor - - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, NLFilename) - - class(lnd2atm_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - - call this%InitAllocate(bounds) - call this%ReadNamelist(NLFilename) - call this%InitHistory(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize lnd2atm derived type - ! - ! !ARGUMENTS: - class (lnd2atm_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8) :: ival = 0.0_r8 ! initial value - integer :: begc, endc - integer :: begg, endg - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - allocate(this%t_rad_grc (begg:endg)) ; this%t_rad_grc (:) =ival - allocate(this%t_ref2m_grc (begg:endg)) ; this%t_ref2m_grc (:) =ival - allocate(this%q_ref2m_grc (begg:endg)) ; this%q_ref2m_grc (:) =ival - allocate(this%u_ref10m_grc (begg:endg)) ; this%u_ref10m_grc (:) =ival - allocate(this%h2osno_grc (begg:endg)) ; this%h2osno_grc (:) =ival - allocate(this%h2osoi_vol_grc (begg:endg,1:nlevgrnd)) ; this%h2osoi_vol_grc (:,:) =ival - allocate(this%albd_grc (begg:endg,1:numrad)) ; this%albd_grc (:,:) =ival - allocate(this%albi_grc (begg:endg,1:numrad)) ; this%albi_grc (:,:) =ival - allocate(this%taux_grc (begg:endg)) ; this%taux_grc (:) =ival - allocate(this%tauy_grc (begg:endg)) ; this%tauy_grc (:) =ival - allocate(this%eflx_lwrad_out_grc (begg:endg)) ; this%eflx_lwrad_out_grc (:) =ival - allocate(this%eflx_sh_tot_grc (begg:endg)) ; this%eflx_sh_tot_grc (:) =ival - allocate(this%eflx_sh_precip_conversion_grc(begg:endg)) ; this%eflx_sh_precip_conversion_grc(:) = ival - allocate(this%eflx_sh_ice_to_liq_col(begc:endc)) ; this%eflx_sh_ice_to_liq_col(:) = ival - allocate(this%eflx_lh_tot_grc (begg:endg)) ; this%eflx_lh_tot_grc (:) =ival - allocate(this%qflx_evap_tot_grc (begg:endg)) ; this%qflx_evap_tot_grc (:) =ival - allocate(this%fsa_grc (begg:endg)) ; this%fsa_grc (:) =ival - allocate(this%net_carbon_exchange_grc(begg:endg)) ; this%net_carbon_exchange_grc(:) =ival - allocate(this%nem_grc (begg:endg)) ; this%nem_grc (:) =ival - allocate(this%ram1_grc (begg:endg)) ; this%ram1_grc (:) =ival - allocate(this%fv_grc (begg:endg)) ; this%fv_grc (:) =ival - allocate(this%flxdst_grc (begg:endg,1:ndst)) ; this%flxdst_grc (:,:) =ival - allocate(this%flux_ch4_grc (begg:endg)) ; this%flux_ch4_grc (:) =ival - allocate(this%qflx_rofliq_grc (begg:endg)) ; this%qflx_rofliq_grc (:) =ival - allocate(this%qflx_rofliq_qsur_grc (begg:endg)) ; this%qflx_rofliq_qsur_grc (:) =ival - allocate(this%qflx_rofliq_qsub_grc (begg:endg)) ; this%qflx_rofliq_qsub_grc (:) =ival - allocate(this%qflx_rofliq_qgwl_grc (begg:endg)) ; this%qflx_rofliq_qgwl_grc (:) =ival - allocate(this%qflx_rofliq_h2osfc_grc (begg:endg)) ; this%qflx_rofliq_h2osfc_grc (:) =ival - allocate(this%qflx_rofliq_drain_perched_grc (begg:endg)) ; this%qflx_rofliq_drain_perched_grc (:) =ival - allocate(this%qflx_rofice_grc (begg:endg)) ; this%qflx_rofice_grc (:) =ival - allocate(this%qflx_liq_from_ice_col(begc:endc)) ; this%qflx_liq_from_ice_col(:) = ival - allocate(this%qirrig_grc (begg:endg)) ; this%qirrig_grc (:) =ival - - if (shr_megan_mechcomps_n>0) then - allocate(this%flxvoc_grc(begg:endg,1:shr_megan_mechcomps_n)); this%flxvoc_grc(:,:)=ival - endif - if (shr_fire_emis_mechcomps_n>0) then - allocate(this%fireflx_grc(begg:endg,1:shr_fire_emis_mechcomps_n)) - this%fireflx_grc = ival - allocate(this%fireztop_grc(begg:endg)) - this%fireztop_grc = ival - endif - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - allocate(this%ddvel_grc(begg:endg,1:n_drydep)); this%ddvel_grc(:,:)=ival - end if - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine ReadNamelist(this, NLFilename) - ! - ! !DESCRIPTION: - ! Read the lnd2atm namelist - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - class(lnd2atm_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - ! temporary variables corresponding to the components of lnd2atm_params_type - logical :: melt_non_icesheet_ice_runoff - - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - character(len=*), parameter :: nmlname = 'lnd2atm_inparm' - - character(len=*), parameter :: subname = 'ReadNamelist' - !----------------------------------------------------------------------- - - namelist /lnd2atm_inparm/ melt_non_icesheet_ice_runoff - - ! Initialize namelist variables to defaults - melt_non_icesheet_ice_runoff = .false. - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=lnd2atm_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast(melt_non_icesheet_ice_runoff, mpicom) - - if (masterproc) then - write(iulog,*) - write(iulog,*) nmlname, ' settings:' - write(iulog,nml=lnd2atm_inparm) - write(iulog,*) ' ' - end if - - this%params = lnd2atm_params_type( & - melt_non_icesheet_ice_runoff = melt_non_icesheet_ice_runoff) - - end subroutine ReadNamelist - - !----------------------------------------------------------------------- - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(lnd2atm_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc, endc - integer :: begg, endg - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - begg = bounds%begg; endg = bounds%endg - - this%eflx_sh_tot_grc(begg:endg) = 0._r8 - call hist_addfld1d (fname='FSH_TO_COUPLER', units='W/m^2', & - avgflag='A', & - long_name='sensible heat sent to coupler & - &(includes corrections for land use change, rain/snow conversion and conversion of ice runoff to liquid)', & - ptr_lnd=this%eflx_sh_tot_grc) - - this%eflx_sh_ice_to_liq_col(begc:endc) = 0._r8 - call hist_addfld1d (fname='FSH_RUNOFF_ICE_TO_LIQ', units='W/m^2', & - avgflag='A', & - long_name='sensible heat flux generated from conversion of ice runoff to liquid', & - ptr_col=this%eflx_sh_ice_to_liq_col) - - this%qflx_rofliq_grc(begg:endg) = 0._r8 - call hist_addfld1d (fname='QRUNOFF_TO_COUPLER', units='mm/s', & - avgflag='A', & - long_name='total liquid runoff sent to coupler (includes corrections for land use change)', & - ptr_lnd=this%qflx_rofliq_grc) - - this%qflx_rofice_grc(begg:endg) = 0._r8 - call hist_addfld1d (fname='QRUNOFF_ICE_TO_COUPLER', units='mm/s', & - avgflag='A', & - long_name='total ice runoff sent to coupler (includes corrections for land use change)', & - ptr_lnd=this%qflx_rofice_grc) - - this%qflx_liq_from_ice_col(begc:endc) = 0._r8 - call hist_addfld1d (fname='QRUNOFF_ICE_TO_LIQ', units='mm/s', & - avgflag='A', & - long_name='liquid runoff from converted ice runoff', & - ptr_col=this%qflx_liq_from_ice_col, default='inactive') - - this%net_carbon_exchange_grc(begg:endg) = spval - call hist_addfld1d(fname='FCO2', units='kgCO2/m2/s', & - avgflag='A', & - long_name='CO2 flux to atmosphere (+ to atm)', & - ptr_lnd=this%net_carbon_exchange_grc, & - default='inactive') - - if (use_lch4) then - this%flux_ch4_grc(begg:endg) = 0._r8 - call hist_addfld1d (fname='FCH4', units='kgC/m2/s', & - avgflag='A', long_name='Gridcell surface CH4 flux to atmosphere (+ to atm)', & - ptr_lnd=this%flux_ch4_grc) - - this%nem_grc(begg:endg) = spval - call hist_addfld1d (fname='NEM', units='gC/m2/s', & - avgflag='A', long_name='Gridcell net adjustment to net carbon exchange passed to atm. for methane production', & - ptr_lnd=this%nem_grc) - end if - - end subroutine InitHistory - -end module lnd2atmType diff --git a/src/main/lnd2glcMod.F90 b/src/main/lnd2glcMod.F90 deleted file mode 100644 index 9de7eba3f3..0000000000 --- a/src/main/lnd2glcMod.F90 +++ /dev/null @@ -1,304 +0,0 @@ -module lnd2glcMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handle arrays used for exchanging data from land model to glc - ! For now glc datais send and received on the lnd grid and decomposition. - ! - ! The fields sent from the lnd component to the glc component via - ! the coupler are labeled 's2x', or sno to coupler. - ! The fields received by the lnd component from the glc component - ! via the coupler are labeled 'x2s', or coupler to sno. - ! 'Sno' is a misnomer in that the exchanged data are related to - ! the ice beneath the snow, not the snow itself. But by CESM convention, - ! 'ice' refers to sea ice, not land ice. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : get_proc_bounds, bounds_type - use domainMod , only : ldomain - use clm_varpar , only : maxpatch_glcmec - use clm_varctl , only : iulog - use clm_varcon , only : spval, tfrz, namec - use column_varcon , only : col_itype_to_icemec_class - use landunit_varcon , only : istice_mec, istsoil - use abortutils , only : endrun - use GlacierSurfaceMassBalanceMod, only : glacier_smb_type - use TemperatureType , only : temperature_type - use LandunitType , only : lun - use ColumnType , only : col - use TopoMod , only : topo_type - ! - ! !PUBLIC TYPES: - implicit none - private - save - - ! land -> glc variables structure - type, public :: lnd2glc_type - real(r8), pointer :: tsrf_grc(:,:) => null() - real(r8), pointer :: topo_grc(:,:) => null() - real(r8), pointer :: qice_grc(:,:) => null() - - contains - - procedure, public :: Init - procedure, public :: update_lnd2glc - procedure, private :: InitAllocate - procedure, private :: InitHistory - - end type lnd2glc_type - - ! !PUBLIC MEMBER FUNCTIONS: - - ! The following is public simply to support unit testing, and should not generally be - ! called from outside this module. - ! - ! Note that it is not a type-bound procedure, because it doesn't actually involve the - ! lnd2glc_type. This suggests that perhaps it belongs in some other module. - public :: bareland_normalization ! compute normalization factor for fluxes from the bare land portion of the grid cell - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(lnd2glc_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate(bounds) - call this%InitHistory(bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize land variables required by glc - ! - ! !USES: - use clm_varcon , only : spval - use histFileMod, only : hist_addfld1d - ! - ! !ARGUMENTS: - class(lnd2glc_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begg,endg - !------------------------------------------------------------------------ - - begg = bounds%begg; endg = bounds%endg - - allocate(this%tsrf_grc(begg:endg,0:maxpatch_glcmec)) ; this%tsrf_grc(:,:)=0.0_r8 - allocate(this%topo_grc(begg:endg,0:maxpatch_glcmec)) ; this%topo_grc(:,:)=0.0_r8 - allocate(this%qice_grc(begg:endg,0:maxpatch_glcmec)) ; this%qice_grc(:,:)=0.0_r8 - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !USES: - use histFileMod, only : hist_addfld1d,hist_addfld2d - ! - ! !ARGUMENTS: - class(lnd2glc_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: data2dptr(:,:) - integer :: begg, endg - !--------------------------------------------------------------------- - - begg = bounds%begg; endg = bounds%endg - - this%qice_grc(begg:endg,0:maxpatch_glcmec) = spval - ! For this and the following fields, set up a pointer to the field simply for the - ! sake of changing the indexing, so that levels start with an index of 1, as is - ! assumed by histFileMod - so levels go 1:(nec+1) rather than 0:nec - data2dptr => this%qice_grc(:,0:maxpatch_glcmec) - call hist_addfld2d (fname='QICE_FORC', units='mm/s', type2d='elevclas', & - avgflag='A', long_name='qice forcing sent to GLC', & - ptr_lnd=data2dptr, default='inactive') - - this%tsrf_grc(begg:endg,0:maxpatch_glcmec) = spval - data2dptr => this%tsrf_grc(:,0:maxpatch_glcmec) - call hist_addfld2d (fname='TSRF_FORC', units='K', type2d='elevclas', & - avgflag='A', long_name='surface temperature sent to GLC', & - ptr_lnd=data2dptr, default='inactive') - - this%topo_grc(begg:endg,0:maxpatch_glcmec) = spval - data2dptr => this%topo_grc(:,0:maxpatch_glcmec) - call hist_addfld2d (fname='TOPO_FORC', units='m', type2d='elevclas', & - avgflag='A', long_name='topograephic height sent to GLC', & - ptr_lnd=data2dptr, default='inactive') - - end subroutine InitHistory - - - !------------------------------------------------------------------------------ - subroutine update_lnd2glc(this, bounds, num_do_smb_c, filter_do_smb_c, & - temperature_inst, glacier_smb_inst, topo_inst, init) - ! - ! !DESCRIPTION: - ! Assign values to lnd2glc+ - ! - ! !ARGUMENTS: - class(lnd2glc_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_do_smb_c ! number of columns in filter_do_smb_c - integer , intent(in) :: filter_do_smb_c(:) ! column filter: columns where smb calculations are performed - type(temperature_type) , intent(in) :: temperature_inst - type(glacier_smb_type) , intent(in) :: glacier_smb_inst - type(topo_type) , intent(in) :: topo_inst - logical , intent(in) :: init ! if true=>only set a subset of fields - ! - ! !LOCAL VARIABLES: - integer :: c, l, g, n, fc ! indices - logical, allocatable :: fields_assigned(:,:) ! tracks whether fields have already been assigned for each index [begg:endg, 0:maxpatch_glcmec] - real(r8) :: flux_normalization ! factor by which fluxes should be normalized - - character(len=*), parameter :: subname = 'update_lnd2glc' - !------------------------------------------------------------------------------ - - ! Initialize to reasonable defaults - - this%qice_grc(bounds%begg : bounds%endg, :) = 0._r8 - this%tsrf_grc(bounds%begg : bounds%endg, :) = tfrz - this%topo_grc(bounds%begg : bounds%endg, :) = 0._r8 - - ! Fill the lnd->glc data on the clm grid - - allocate(fields_assigned(bounds%begg:bounds%endg, 0:maxpatch_glcmec)) - fields_assigned(:,:) = .false. - - do fc = 1, num_do_smb_c - c = filter_do_smb_c(fc) - l = col%landunit(c) - g = col%gridcell(c) - - ! Set vertical index and a flux normalization, based on whether the column in question is glacier or vegetated. - if (lun%itype(l) == istice_mec) then - n = col_itype_to_icemec_class(col%itype(c)) - flux_normalization = 1.0_r8 - else if (lun%itype(l) == istsoil) then - n = 0 !0-level index (bareland information) - flux_normalization = bareland_normalization(c) - else - ! Other landunit types do not pass information in the lnd2glc fields. - ! Note: for this to be acceptable, we need virtual vegetated columns in any grid - ! cell that is made up solely of glacier plus some other special landunit (e.g., - ! glacier + lake) -- otherwise CISM wouldn't have any information for the non- - ! glaciated portion of the grid cell. - cycle - end if - - ! Make sure we haven't already assigned the coupling fields for this point - ! (this could happen, for example, if there were multiple columns in the - ! istsoil landunit, which we aren't prepared to handle) - if (fields_assigned(g,n)) then - write(iulog,*) subname//' ERROR: attempt to assign coupling fields twice for the same index.' - write(iulog,*) 'One possible cause is having multiple columns in the istsoil landunit,' - write(iulog,*) 'which this routine cannot handle.' - write(iulog,*) 'g, n = ', g, n - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - - ! Send surface temperature, topography, and SMB flux (qice) to coupler. - ! t_soisno and topo_col are valid even in initialization, so tsrf and topo - ! are set here regardless of the value of init. But qflx_glcice is not valid - ! until the run loop; thus, in initialization, we will use the default value - ! for qice, as set above. - fields_assigned(g,n) = .true. - this%tsrf_grc(g,n) = temperature_inst%t_soisno_col(c,1) - this%topo_grc(g,n) = topo_inst%topo_col(c) - if (.not. init) then - this%qice_grc(g,n) = glacier_smb_inst%qflx_glcice_col(c) * flux_normalization - - ! Check for bad values of qice - if ( abs(this%qice_grc(g,n)) > 1.0_r8) then - write(iulog,*) 'WARNING: qice out of bounds: g, n, qice =', g, n, this%qice_grc(g,n) - end if - end if - - end do - - deallocate(fields_assigned) - - end subroutine update_lnd2glc - - !----------------------------------------------------------------------- - real(r8) function bareland_normalization(c) - ! - ! !DESCRIPTION: - ! Compute normalization factor for fluxes from the bare land portion of the grid - ! cell. Fluxes should be multiplied by this factor before being sent to CISM. - ! - ! The point of this is: CISM effectively has two land cover types: glaciated and - ! bare. CLM, on the other hand, subdivides the bare land portion of the grid cell into - ! multiple landunits. However, we currently don't do any sort of averaging of - ! quantities computed in the different "bare land" landunits - instead, we simply send - ! the values computed in the natural vegetated landunit - these fluxes (like SMB) are - ! 0 in the other landunits. To achieve conservation, we need to normalize these - ! natural veg. fluxes by the fraction of the "bare land" area accounted for by the - ! natural veg. landunit. - ! - ! For example, consider a grid cell that is: - ! 60% glacier_mec - ! 30% natural veg - ! 10% lake - ! - ! According to CISM, this grid cell is 60% icesheet, 40% "bare land". Now suppose CLM - ! has an SMB flux of 1m in the natural veg landunit. If we simply sent 1m of ice to - ! CISM, conservation would be broken, since it would also apply 1m of ice to the 10% - ! of the grid cell that CLM says is lake. So, instead, we must multiply the 1m of ice - ! by (0.3/0.4), thus "spreading out" the SMB from the natural veg. landunit, so that - ! 0.75m of ice is grown throughout the bare land portion of CISM. - ! - ! Note: If the non-glaciated area of the grid cell is 0, then we arbitrarily return a - ! normalization factor of 1.0, in order to avoid divide-by-zero errors. - ! - ! Note: We currently aren't careful about how we would handle things if there are - ! multiple columns within the vegetated landunit. If that possibility were introduced, - ! this code - as well as the code in update_clm_s2x - may need to be reworked somewhat. - ! - ! !USES: - use subgridWeightsMod , only : get_landunit_weight - ! - ! !ARGUMENTS: - integer, intent(in) :: c ! column index - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - real(r8) :: area_glacier ! fractional area of the glacier_mec landunit in this grid cell - real(r8) :: area_this_col ! fractional area of column c in the grid cell - - real(r8), parameter :: tol = 1.e-13_r8 ! tolerance for checking subgrid weight equality - character(len=*), parameter :: subname = 'bareland_normalization' - !----------------------------------------------------------------------- - - g = col%gridcell(c) - - area_glacier = get_landunit_weight(g, istice_mec) - - if (abs(area_glacier - 1.0_r8) < tol) then - ! If the whole grid cell is glacier, then the normalization factor is arbitrary; - ! set it to 1 so we don't do any normalization in this case - bareland_normalization = 1.0_r8 - else - area_this_col = col%wtgcell(c) - bareland_normalization = area_this_col / (1.0_r8 - area_glacier) - end if - - end function bareland_normalization - -end module lnd2glcMod - diff --git a/src/main/ncdio_pio.F90.in b/src/main/ncdio_pio.F90.in deleted file mode 100644 index 6de8acb363..0000000000 --- a/src/main/ncdio_pio.F90.in +++ /dev/null @@ -1,2419 +0,0 @@ -module ncdio_pio - - !----------------------------------------------------------------------- - !BOP - ! - ! !MODULE: ncdio_pioMod - ! - ! !DESCRIPTION: - ! Generic interfaces to write fields to netcdf files for CLM - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, i4=>shr_kind_i4, shr_kind_cl - use shr_infnan_mod , only : nan => shr_infnan_nan, isnan => shr_infnan_isnan, assignment(=) - use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_getunit, shr_file_freeunit - use shr_string_mod , only : shr_string_toUpper - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc, mpicom, iam, npes - use spmdMod , only : MPI_REAL8, MPI_INTEGER, MPI_LOGICAL - use clm_varcon , only : spval,ispval, grlnd, nameg, namel, namec, namep - use clm_varctl , only : single_column, iulog - use shr_sys_mod , only : shr_sys_flush - use decompMod , only : get_clmlevel_gsize,get_clmlevel_gsmap - use perf_mod , only : t_startf, t_stopf - use fileutils , only : getavu, relavu - use mct_mod , only : mct_gsMap, mct_gsMap_lsize, mct_gsMap_gsize, mct_gsMap_orderedPoints - use pio , only : file_desc_t, io_desc_t, iosystem_desc_t - use pio , only : pio_bcast_error, pio_char, pio_clobber, pio_closefile, pio_createfile, pio_def_dim - use pio , only : pio_def_var, pio_double, pio_enddef, pio_get_att, pio_get_var, pio_global, pio_initdecomp - use pio , only : pio_inq_att, pio_inq_dimid, pio_inq_dimlen, pio_inq_dimname, pio_inq_vardimid, pio_inq_varid - use pio , only : pio_inq_varname, pio_inq_varndims, pio_inquire, pio_int, pio_internal_error - use pio , only : pio_noclobber, pio_noerr, pio_nofill, pio_nowrite, pio_offset_kind, pio_openfile - use pio , only : pio_put_att, pio_put_var, pio_read_darray, pio_real, pio_seterrorhandling - use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t - use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - ! - public :: check_var ! determine if variable is on netcdf file - public :: check_att ! check if attribute is on file - public :: check_dim ! validity check on dimension - public :: ncd_pio_openfile ! open a file - public :: ncd_pio_createfile ! create a new file - public :: ncd_pio_closefile ! close a file - public :: ncd_pio_init ! called from clm_comp - public :: ncd_enddef ! end define mode - public :: ncd_putatt ! put attribute - public :: ncd_getatt ! get attribute - public :: ncd_defdim ! define dimension - public :: ncd_inqdid ! inquire dimension id - public :: ncd_inqdname ! inquire dimension name - public :: ncd_inqdlen ! inquire dimension length - public :: ncd_inqfdims ! inquire file dimnesions - public :: ncd_defvar ! define variables - public :: ncd_inqvid ! inquire variable id - public :: ncd_inqvname ! inquire variable name - public :: ncd_inqvdims ! inquire variable ndims - public :: ncd_inqvdids ! inquire variable dimids - public :: ncd_inqvdlen ! inquire variable dimension size - public :: ncd_inqvdname ! inquire variable dimension name - public :: ncd_io ! write local data - - integer,parameter,public :: ncd_int = pio_int - integer,parameter,public :: ncd_log =-pio_int - integer,parameter,public :: ncd_float = pio_real - integer,parameter,public :: ncd_double = pio_double - integer,parameter,public :: ncd_char = pio_char - integer,parameter,public :: ncd_global = pio_global - integer,parameter,public :: ncd_write = pio_write - integer,parameter,public :: ncd_nowrite = pio_nowrite - integer,parameter,public :: ncd_clobber = pio_clobber - integer,parameter,public :: ncd_noclobber = pio_noclobber - integer,parameter,public :: ncd_nofill = pio_nofill - integer,parameter,public :: ncd_unlimited = pio_unlimited - - ! PIO types needed for ncdio_pio interface calls - public file_desc_t - public var_desc_t - - ! - ! !PRIVATE MEMBER FUNCTIONS: - ! - interface ncd_defvar - module procedure ncd_defvar_bynf - module procedure ncd_defvar_bygrid - end interface - - interface ncd_putatt - module procedure ncd_putatt_int - module procedure ncd_putatt_real - module procedure ncd_putatt_char - end interface - - interface ncd_getatt - module procedure ncd_getatt_char - module procedure ncd_getatt_int - end interface ncd_getatt - - interface ncd_io - module procedure ncd_io_char_var0_start_glob - - !DIMS 0 - module procedure ncd_io_{DIMS}d_log_glob - - !DIMS 0,1,2,3 - !TYPE int,double - module procedure ncd_io_{DIMS}d_{TYPE}_glob - - !DIMS 0,1,2 - !TYPE text - module procedure ncd_io_{DIMS}d_{TYPE}_glob - - !TYPE int,double - !DIMS 1,2,3 - module procedure ncd_io_{DIMS}d_{TYPE} - - !TYPE logical - !DIMS 1 - module procedure ncd_io_{DIMS}d_{TYPE} - end interface - - interface ncd_inqvdlen - module procedure ncd_inqvdlen_byDesc - module procedure ncd_inqvdlen_byName - end interface - - interface ncd_inqvdname - module procedure ncd_inqvdname_byDesc - module procedure ncd_inqvdname_byName - end interface - - private :: ncd_getiodesc ! obtain iodesc - private :: scam_field_offsets ! get offset to proper lat/lon gridcell for SCAM - - integer,parameter,private :: debug = 0 ! local debug level - - integer , parameter , public :: max_string_len = 256 ! length of strings - real(r8), parameter , public :: fillvalue = 1.e36_r8 ! fill value for netcdf fields - - integer, public :: io_type - integer :: io_netcdf_format - type(iosystem_desc_t), pointer, public :: pio_subsystem - - type iodesc_plus_type - character(len=64) :: name - type(IO_desc_t) :: iodesc - integer :: type - integer :: ndims - integer :: dims(4) - integer :: dimids(4) - end type iodesc_plus_type - integer,parameter ,private :: max_iodesc = 100 - integer ,private :: num_iodesc = 0 - type(iodesc_plus_type) ,private, target :: iodesc_list(max_iodesc) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine ncd_pio_init() - ! - ! !DESCRIPTION: - ! Initial PIO - ! - ! !USES: - use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype, shr_pio_getioformat - use clm_varctl , only : inst_name - !----------------------------------------------------------------------- - - PIO_subsystem => shr_pio_getiosys(inst_name) - io_type = shr_pio_getiotype(inst_name) - io_netcdf_format = shr_pio_getioformat(inst_name) - end subroutine ncd_pio_init - - !----------------------------------------------------------------------- - subroutine ncd_pio_openfile(file, fname, mode) - ! - ! !DESCRIPTION: - ! Open a NetCDF PIO file - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: file ! Output PIO file handle - character(len=*) , intent(in) :: fname ! Input filename to open - integer , intent(in) :: mode ! file mode - ! - ! !LOCAL VARIABLES: - integer :: ierr - !----------------------------------------------------------------------- - - ierr = pio_openfile(pio_subsystem, file, io_type, fname, mode) - - if(ierr/= PIO_NOERR) then - call shr_sys_abort('ncd_pio_openfile ERROR: Failed to open file') - else if(pio_iotask_rank(pio_subsystem)==0 .and. masterproc) then - write(iulog,*) 'Opened existing file ', trim(fname), file%fh - end if - - end subroutine ncd_pio_openfile - - !----------------------------------------------------------------------- - subroutine ncd_pio_closefile(file) - ! - ! !DESCRIPTION: - ! Close a NetCDF PIO file - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: file ! PIO file handle to close - !----------------------------------------------------------------------- - - call pio_closefile(file) - - end subroutine ncd_pio_closefile - - !----------------------------------------------------------------------- - subroutine ncd_pio_createfile(file, fname, avoid_pnetcdf) - ! - ! !DESCRIPTION: - ! Create a new NetCDF file with PIO - ! - ! !USES: - use pio, only : pio_iotype_pnetcdf, pio_iotype_netcdf,pio_iotask_rank - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: file ! PIO file descriptor - character(len=*) , intent(in) :: fname ! File name to create - - ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for - ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 - logical, intent(in), optional :: avoid_pnetcdf - ! - ! !LOCAL VARIABLES: - logical :: l_avoid_pnetcdf ! local version of avoid_pnetcdf - integer :: my_io_type - integer :: ierr - !----------------------------------------------------------------------- - - l_avoid_pnetcdf = .false. - if (present(avoid_pnetcdf)) then - l_avoid_pnetcdf = avoid_pnetcdf - end if - - my_io_type = io_type - if (l_avoid_pnetcdf) then - if (my_io_type == pio_iotype_pnetcdf) then - my_io_type = pio_iotype_netcdf - if(pio_iotask_rank(pio_subsystem)==0 .and. masterproc) then - write(iulog,*) 'Workaround for bugz 1730: creating' - write(iulog,*) trim(fname) - write(iulog,*) 'with type netcdf instead of pnetcdf' - end if - end if - end if - - ierr = pio_createfile(pio_subsystem, file, my_io_type, fname, ior(PIO_CLOBBER,io_netcdf_format)) - - if(ierr/= PIO_NOERR) then - call shr_sys_abort( ' ncd_pio_createfile ERROR: Failed to open file to write: '//trim(fname)) - else if(pio_iotask_rank(pio_subsystem)==0 .and. masterproc) then - write(iulog,*) 'Opened file ', trim(fname), ' to write', file%fh - end if - - end subroutine ncd_pio_createfile - - !----------------------------------------------------------------------- - subroutine check_var(ncid, varname, vardesc, readvar, print_err ) - ! - ! !DESCRIPTION: - ! Check if variable is on netcdf file - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor - character(len=*) , intent(in) :: varname ! Varible name to check - type(Var_desc_t) , intent(out) :: vardesc ! Output variable descriptor - logical , intent(out) :: readvar ! If variable exists or not - logical, optional , intent(in) :: print_err ! If should print about error - ! - ! !LOCAL VARIABLES: - integer :: ret ! return value - logical :: log_err ! if should log error - character(len=*),parameter :: subname='check_var' ! subroutine name - !----------------------------------------------------------------------- - - - if ( present(print_err) )then - log_err = print_err - else - log_err = .true. - end if - readvar = .true. - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ret = PIO_inq_varid (ncid, varname, vardesc) - if (ret /= PIO_noerr) then - readvar = .false. - if (masterproc .and. log_err) & - write(iulog,*) subname//': variable ',trim(varname),' is not on dataset' - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - - end subroutine check_var - - !----------------------------------------------------------------------- - subroutine check_att(ncid, varid, attrib, att_found) - ! - ! !DESCRIPTION: - ! Check if attribute is on file - ! - ! !USES: - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - logical ,intent(out) :: att_found ! true if the attribute was found - ! - ! !LOCAL VARIABLES: - integer :: att_type ! attribute type - integer(pio_offset_kind) :: att_len ! attribute length - integer :: status - - character(len=*), parameter :: subname = 'check_att' - !----------------------------------------------------------------------- - - att_found = .true. - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - status = PIO_inq_att(ncid, varid, trim(attrib), att_type, att_len) - if (status /= PIO_noerr) then - att_found = .false. - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - - end subroutine check_att - - !----------------------------------------------------------------------- - subroutine check_dim(ncid, dimname, value, msg) - ! - ! !DESCRIPTION: - ! Validity check on dimension - ! - ! !ARGUMENTS: - class(file_desc_t),intent(in) :: ncid ! PIO file handle - character(len=*) , intent(in) :: dimname ! Dimension name - integer, intent(in) :: value ! Expected dimension size - - character(len=*), intent(in), optional :: msg ! Optional additional message printed upon error - ! - ! !LOCAL VARIABLES: - integer :: dimid, dimlen ! temporaries - integer :: status ! error code - character(len=*),parameter :: subname='check_dim' ! subroutine name - !----------------------------------------------------------------------- - - status = pio_inq_dimid (ncid, trim(dimname), dimid) - status = pio_inq_dimlen (ncid, dimid, dimlen) - if (dimlen /= value) then - write(iulog,*) subname//' ERROR: mismatch of input dimension ',dimlen, & - ' with expected value ',value,' for variable ',trim(dimname) - if (present(msg)) then - write(iulog,'(a)') msg - end if - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - - end subroutine check_dim - - !----------------------------------------------------------------------- - subroutine ncd_enddef(ncid) - ! - ! !DESCRIPTION: - ! enddef netcdf file - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - ! - ! !LOCAL VARIABLES: - integer :: status ! error status - !----------------------------------------------------------------------- - - status = PIO_enddef(ncid) - - end subroutine ncd_enddef - - !----------------------------------------------------------------------- - subroutine ncd_inqdid(ncid,name,dimid,dimexist) - ! - ! !DESCRIPTION: - ! inquire on a dimension id - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: name ! dimension name - integer , intent(out):: dimid ! dimension id - logical,optional , intent(out):: dimexist ! if this dimension exists or not - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - if ( present(dimexist) )then - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - end if - status = PIO_inq_dimid(ncid,name,dimid) - if ( present(dimexist) )then - if ( status == PIO_NOERR)then - dimexist = .true. - else - dimexist = .false. - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - end if - - end subroutine ncd_inqdid - - !----------------------------------------------------------------------- - subroutine ncd_inqdlen(ncid,dimid,len,name) - ! - ! !DESCRIPTION: - ! Gets the length of the given dimension - ! - ! If 'name' is absent, then 'dimid' is used as an input: the dimension id to inquire. - ! If 'name' is present, then it gives the name of the dimension to inquire, and - ! 'dimid' is set to the ID associated with this dimension. - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - integer , intent(inout) :: dimid ! dimension id - integer , intent(out) :: len ! dimension len - character(len=*), optional, intent(in) :: name ! dimension name - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - if ( present(name) )then - call ncd_inqdid(ncid,name,dimid) - end if - len = -1 - status = PIO_inq_dimlen(ncid,dimid,len) - - end subroutine ncd_inqdlen - - !----------------------------------------------------------------------- - subroutine ncd_inqdname(ncid,dimid,dname) - ! - ! !DESCRIPTION: - ! inquire dim name - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - integer , intent(in) :: dimid ! dimension id - character(len=*) , intent(out):: dname ! dimension name - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = PIO_inq_dimname(ncid,dimid,dname) - - end subroutine ncd_inqdname - - !----------------------------------------------------------------------- - subroutine ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout):: ncid - logical , intent(out) :: isgrid2d - integer , intent(out) :: ni - integer , intent(out) :: nj - integer , intent(out) :: ns - ! - ! !LOCAL VARIABLES: - integer :: dimid ! netCDF id - integer :: ier ! error status - character(len=32) :: subname = 'ncd_inqfdims' ! subroutine name - !----------------------------------------------------------------------- - - if (single_column) then - ni = 1 - nj = 1 - ns = 1 - isgrid2d = .true. - RETURN - end if - - ni = 0 - nj = 0 - - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ier = pio_inq_dimid (ncid, 'lon', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, ni) - ier = pio_inq_dimid (ncid, 'lat', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, nj) - - ier = pio_inq_dimid (ncid, 'lsmlon', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, ni) - ier = pio_inq_dimid (ncid, 'lsmlat', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, nj) - - ier = pio_inq_dimid (ncid, 'ni', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, ni) - ier = pio_inq_dimid (ncid, 'nj', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, nj) - - ier = pio_inq_dimid (ncid, 'gridcell', dimid) - if (ier == PIO_NOERR) then - ier = pio_inq_dimlen(ncid, dimid, ni) - if (ier == PIO_NOERR) nj = 1 - end if - - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - - if (ni == 0 .or. nj == 0) then - write(iulog,*) trim(subname),' ERROR: ni,nj = ',ni,nj,' cannot be zero ' - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - - if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - - ns = ni*nj - - end subroutine ncd_inqfdims - - !----------------------------------------------------------------------- - subroutine ncd_inqvid(ncid,name,varid,vardesc,readvar) - ! - ! !DESCRIPTION: - ! Inquire on a variable ID - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: name ! variable name - integer , intent(out) :: varid ! variable id - type(Var_desc_t) , intent(out) :: vardesc ! variable descriptor - logical, optional , intent(out) :: readvar ! does variable exist - ! - ! !LOCAL VARIABLES: - integer :: ret ! return code - character(len=*),parameter :: subname='ncd_inqvid' ! subroutine name - !----------------------------------------------------------------------- - - if (present(readvar)) then - readvar = .false. - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ret = PIO_inq_varid(ncid,name,vardesc) - if (ret /= PIO_noerr) then - if (masterproc) write(iulog,*) subname//': variable ',trim(name),' is not on dataset' - readvar = .false. - else - readvar = .true. - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - else - ret = PIO_inq_varid(ncid,name,vardesc) - endif - varid = vardesc%varid - - end subroutine ncd_inqvid - - !----------------------------------------------------------------------- - subroutine ncd_inqvdims(ncid,ndims,vardesc) - ! - ! !DESCRIPTION: - ! inquire variable dimensions - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - integer , intent(out) :: ndims ! variable ndims - type(Var_desc_t) , intent(inout):: vardesc ! variable descriptor - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - ndims = -1 - status = PIO_inq_varndims(ncid,vardesc,ndims) - - end subroutine ncd_inqvdims - - !----------------------------------------------------------------------- - subroutine ncd_inqvname(ncid,varid,vname,vardesc) - ! - ! !DESCRIPTION: - ! inquire variable name - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - integer , intent(in) :: varid ! variable id - character(len=*) , intent(out) :: vname ! variable vname - type(Var_desc_t) , intent(inout):: vardesc ! variable descriptor - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - vname = '' - status = PIO_inq_varname(ncid,vardesc,vname) - - end subroutine ncd_inqvname - - !----------------------------------------------------------------------- - subroutine ncd_inqvdids(ncid,dids,vardesc) - ! - ! !DESCRIPTION: - ! inquire variable dimension ids - ! - ! !ARGUMENTS: - class(file_desc_t),intent(in) :: ncid ! netcdf file id - integer ,intent(out) :: dids(:) ! variable dids - type(Var_desc_t) ,intent(inout):: vardesc ! variable descriptor - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - dids = -1 - status = PIO_inq_vardimid(ncid,vardesc,dids) - - end subroutine ncd_inqvdids - - !----------------------------------------------------------------------- - subroutine ncd_inqvdlen_byDesc(ncid,vardesc,dimnum,dlen,err_code) - ! - ! !DESCRIPTION: - ! inquire size of one of a variable's dimensions, given a vardesc - ! - ! If the variable has n dimensions, then dimnum should be between 1 and n; this routine - ! returns the size of the dimnum'th dimension. - ! - ! If there is an error condition, dlen will be -1, and err_code will hold the error - ! code; possible error codes are: - ! 0: no error - ! 1: dimnum out of range - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - type(Var_desc_t) ,intent(inout) :: vardesc ! variable descriptor - integer ,intent(in) :: dimnum ! dimension number to query - integer ,intent(out) :: dlen ! length of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - ! - ! !LOCAL VARIABLES: - integer :: ndims ! number of dimensions - integer, allocatable :: dimids(:) ! dimension IDs - - integer, parameter :: dlen_invalid = -1 - integer, parameter :: error_none = 0 - integer, parameter :: error_dimnum_out_of_range = 1 - !----------------------------------------------------------------------- - - err_code = error_none - - call ncd_inqvdims(ncid, ndims, vardesc) - - if (dimnum > 0 .and. dimnum <= ndims) then - allocate(dimids(ndims)) - call ncd_inqvdids(ncid, dimids, vardesc) - call ncd_inqdlen(ncid, dimids(dimnum), dlen) - deallocate(dimids) - else - dlen = dlen_invalid - err_code = error_dimnum_out_of_range - end if - - end subroutine ncd_inqvdlen_byDesc - - - !----------------------------------------------------------------------- - subroutine ncd_inqvdlen_byName(ncid,varname,dimnum,dlen,err_code) - ! - ! !DESCRIPTION: - ! inquire size of one of a variable's dimensions, given a variable name - ! - ! If the variable has n dimensions, then dimnum should be between 1 and n; this routine - ! returns the size of the dimnum'th dimension. - ! - ! If there is an error condition, dlen will be -1, and err_code will hold the error - ! code; possible error codes are: - ! 0: no error - ! 1: dimnum out of range - ! 11: variable not found - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) ,intent(in) :: varname ! variable name - integer ,intent(in) :: dimnum ! dimension number to query - integer ,intent(out) :: dlen ! length of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - ! - ! !LOCAL VARIABLES: - type(Var_desc_t) :: vardesc ! variable descriptor - logical :: readvar ! whether the variable was found - integer, parameter :: dlen_invalid = -1 - integer, parameter :: error_variable_not_found = 11 - !----------------------------------------------------------------------- - - call check_var(ncid, varname, vardesc, readvar) - if (readvar) then - call ncd_inqvdlen_byDesc(ncid, vardesc, dimnum, dlen, err_code) - else - dlen = dlen_invalid - err_code = error_variable_not_found - end if - - end subroutine ncd_inqvdlen_byName - - !----------------------------------------------------------------------- - subroutine ncd_inqvdname_byDesc(ncid,vardesc,dimnum,dname,err_code) - ! - ! !DESCRIPTION: - ! Inquire name of one of a variable's dimensions, given a vardesc - ! - ! If the variable has n dimensions, then dimnum should be between 1 and n; this - ! routine returns the name of the dimnum'th dimension. - ! - ! If there is an error condition, dname will be ' ', and err_code will hold the error - ! code; possible error codes are: - ! 0: no error - ! 1: dimnum out of range - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - type(Var_desc_t) ,intent(inout) :: vardesc ! variable descriptor - integer ,intent(in) :: dimnum ! dimension number to query - character(len=*) ,intent(out) :: dname ! name of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - ! - ! !LOCAL VARIABLES: - integer :: ndims ! number of dimensions - integer, allocatable :: dimids(:) ! dimension IDs - - character(len=*), parameter :: dname_invalid = ' ' - integer, parameter :: error_none = 0 - integer, parameter :: error_dimnum_out_of_range = 1 - - character(len=*), parameter :: subname = 'ncd_inqvdname_byDesc' - !----------------------------------------------------------------------- - - err_code = error_none - - call ncd_inqvdims(ncid, ndims, vardesc) - - if (dimnum > 0 .and. dimnum <= ndims) then - allocate(dimids(ndims)) - call ncd_inqvdids(ncid, dimids, vardesc) - call ncd_inqdname(ncid, dimids(dimnum), dname) - deallocate(dimids) - else - dname = dname_invalid - err_code = error_dimnum_out_of_range - end if - - end subroutine ncd_inqvdname_byDesc - - !----------------------------------------------------------------------- - subroutine ncd_inqvdname_byName(ncid,varname,dimnum,dname,err_code) - ! - ! !DESCRIPTION: - ! Inquire name of one of a variable's dimensions, given a variable name - ! - ! If the variable has n dimensions, then dimnum should be between 1 and n; this - ! routine returns the name of the dimnum'th dimension. - ! - ! If there is an error condition, dname will be ' ', and err_code will hold the error - ! code; possible error codes are: - ! 0: no error - ! 1: dimnum out of range - ! 11: variable not found - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) ,intent(in) :: varname ! variable name - integer ,intent(in) :: dimnum ! dimension number to query - character(len=*) ,intent(out) :: dname ! name of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - ! - ! !LOCAL VARIABLES: - type(Var_desc_t) :: vardesc ! variable descriptor - logical :: readvar ! whether the variable was found - character(len=*), parameter :: dname_invalid = ' ' - integer, parameter :: error_variable_not_found = 11 - - character(len=*), parameter :: subname = 'ncd_inqvdname_byName' - !----------------------------------------------------------------------- - - call check_var(ncid, varname, vardesc, readvar) - if (readvar) then - call ncd_inqvdname_byDesc(ncid, vardesc, dimnum, dname, err_code) - else - dname = dname_invalid - err_code = error_variable_not_found - end if - - end subroutine ncd_inqvdname_byName - - - !----------------------------------------------------------------------- - subroutine ncd_putatt_int(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! put integer attributes - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - integer ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = PIO_put_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_putatt_int - - !----------------------------------------------------------------------- - subroutine ncd_putatt_char(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! put character attributes - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - character(len=*) ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = PIO_put_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_putatt_char - - !----------------------------------------------------------------------- - subroutine ncd_putatt_real(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! put real attributes - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - real(r8) ,intent(in) :: value ! netcdf attrib value - integer ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - real*4 :: value4 - !----------------------------------------------------------------------- - - value4 = value - - if (xtype == pio_double) then - status = PIO_put_att(ncid,varid,trim(attrib),value) - else - status = PIO_put_att(ncid,varid,trim(attrib),value4) - endif - - end subroutine ncd_putatt_real - - !----------------------------------------------------------------------- - subroutine ncd_getatt_char(ncid,varid,attrib,value) - ! - ! !DESCRIPTION: - ! get a character attribute - ! - ! !USES: - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - character(len=*) ,intent(out) :: value ! netcdf attrib value - ! - ! !LOCAL VARIABLES: - integer :: status - - character(len=*), parameter :: subname = 'ncd_getatt_char' - !----------------------------------------------------------------------- - - status = PIO_get_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_getatt_char - - !----------------------------------------------------------------------- - subroutine ncd_getatt_int(ncid,varid,attrib,value) - ! - ! !DESCRIPTION: - ! get an integer attribute - ! - ! !USES: - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - integer ,intent(out) :: value ! netcdf attrib value - ! - ! !LOCAL VARIABLES: - integer :: status - - character(len=*), parameter :: subname = 'ncd_getatt_int' - !----------------------------------------------------------------------- - - status = PIO_get_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_getatt_int - - - !----------------------------------------------------------------------- - subroutine ncd_defdim(ncid,attrib,value,dimid) - ! - ! !DESCRIPTION: - ! define dimension - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - character(len=*) , intent(in) :: attrib ! netcdf attrib - integer , intent(in) :: value ! netcdf attrib value - integer , intent(out):: dimid ! netcdf dimension id - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = pio_def_dim(ncid,attrib,value,dimid) - - end subroutine ncd_defdim - - !----------------------------------------------------------------------- - subroutine ncd_defvar_bynf(ncid, varname, xtype, ndims, dimid, varid, & - long_name, units, cell_method, missing_value, fill_value, & - imissing_value, ifill_value, comment, flag_meanings, & - flag_values, nvalid_range ) - ! - ! !DESCRIPTION: - ! Define a netcdf variable - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! external type - integer , intent(in) :: ndims ! number of dims - integer , intent(inout) :: varid ! returned var id - integer , intent(in), optional :: dimid(:) ! dimids - character(len=*) , intent(in), optional :: long_name ! attribute - character(len=*) , intent(in), optional :: units ! attribute - character(len=*) , intent(in), optional :: cell_method ! attribute - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! !LOCAL VARIABLES: - integer :: n ! indices - integer :: ldimid(4) ! local dimid - integer :: dimid0(1) ! local dimid - integer :: status ! error status - integer :: lxtype ! local external type (in case logical variable) - type(var_desc_t) :: vardesc ! local vardesc - character(len=128) :: dimname ! temporary - character(len=256) :: str ! temporary - character(len=*),parameter :: subname='ncd_defvar_bynf' ! subroutine name - !----------------------------------------------------------------------- - - varid = -1 - - dimid0 = 0 - ldimid = 0 - if (present(dimid)) then - ldimid(1:ndims) = dimid(1:ndims) - else ! ndims must be zero if dimid not present - if (ndims /= 0) then - write(iulog,*) subname//' ERROR: dimid not supplied and ndims ne 0 ',trim(varname),ndims - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - endif - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - if (masterproc .and. debug > 1) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - write(iulog,*) subname//' ',trim(varname),lxtype,ndims,ldimid(1:ndims) - endif - - if (ndims > 0) then - status = pio_inq_dimname(ncid,ldimid(ndims),dimname) - end if - - ! Define variable - if (present(dimid)) then - status = PIO_def_var(ncid,trim(varname),lxtype,dimid(1:ndims),vardesc) - else - status = PIO_def_var(ncid,trim(varname),lxtype,dimid0 ,vardesc) - endif - varid = vardesc%varid - - ! - ! Add attributes - ! - if (present(long_name)) then - call ncd_putatt(ncid, varid, 'long_name', trim(long_name)) - end if - if (present(flag_values)) then - status = PIO_put_att(ncid,varid,'flag_values',flag_values) - if ( .not. present(flag_meanings)) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_values set -- but not flag_meanings"//errMsg(sourcefile, __LINE__)) - end if - end if - if (present(flag_meanings)) then - if ( .not. present(flag_values)) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_meanings set -- but not flag_values"//errMsg(sourcefile, __LINE__) ) - end if - if ( size(flag_values) /= size(flag_meanings) ) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_meanings and flag_values dimension different"//errMsg(sourcefile, __LINE__)) - end if - str = flag_meanings(1) - do n = 1, size(flag_meanings) - if ( index(flag_meanings(n), ' ') /= 0 )then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_meanings has an invalid space in it"//errMsg(sourcefile, __LINE__) ) - end if - if ( n > 1 ) str = trim(str)//" "//flag_meanings(n) - end do - status = PIO_put_att(ncid,varid,'flag_meanings', trim(str) ) - end if - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(cell_method)) then - str = 'time: ' // trim(cell_method) - call ncd_putatt(ncid, varid, 'cell_methods', trim(str)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - end subroutine ncd_defvar_bynf - - !----------------------------------------------------------------------- - subroutine ncd_defvar_bygrid(ncid, varname, xtype, & - dim1name, dim2name, dim3name, dim4name, dim5name, & - long_name, units, cell_method, missing_value, fill_value, & - imissing_value, ifill_value, switchdim, comment, & - flag_meanings, flag_values, nvalid_range ) - ! - ! !DESCRIPTION: - ! Define a netcdf variable - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! external type - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: dim3name ! dimension name - character(len=*) , intent(in), optional :: dim4name ! dimension name - character(len=*) , intent(in), optional :: dim5name ! dimension name - character(len=*) , intent(in), optional :: long_name ! attribute - character(len=*) , intent(in), optional :: units ! attribute - character(len=*) , intent(in), optional :: cell_method ! attribute - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - logical , intent(in), optional :: switchdim ! true=> permute dim1 and dim2 for output - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! !LOCAL VARIABLES: - integer :: n ! indices - integer :: ndims ! dimension counter - integer :: dimid(5) ! dimension ids - integer :: varid ! variable id - integer :: itmp ! temporary - character(len=256) :: str ! temporary - character(len=*),parameter :: subname='ncd_defvar_bygrid' ! subroutine name - !----------------------------------------------------------------------- - - dimid(:) = 0 - - ! Determine dimension ids for variable - - if (present(dim1name)) call ncd_inqdid(ncid, dim1name, dimid(1)) - if (present(dim2name)) call ncd_inqdid(ncid, dim2name, dimid(2)) - if (present(dim3name)) call ncd_inqdid(ncid, dim3name, dimid(3)) - if (present(dim4name)) call ncd_inqdid(ncid, dim4name, dimid(4)) - if (present(dim5name)) call ncd_inqdid(ncid, dim5name, dimid(5)) - - ! Permute dim1 and dim2 if necessary - - if (present(switchdim)) then - itmp = dimid(2) - dimid(2) = dimid(1) - dimid(1) = itmp - end if - - ! Define variable - - ndims = 0 - if (present(dim1name)) then - do n = 1, size(dimid) - if (dimid(n) /= 0) ndims = ndims + 1 - end do - end if - - call ncd_defvar_bynf(ncid,varname,xtype,ndims,dimid,varid, & - long_name=long_name, units=units, cell_method=cell_method, & - missing_value=missing_value, fill_value=fill_value, & - imissing_value=imissing_value, ifill_value=ifill_value, & - comment=comment, flag_meanings=flag_meanings, & - flag_values=flag_values, nvalid_range=nvalid_range ) - - end subroutine ncd_defvar_bygrid - - !------------------------------------------------------------------------ - subroutine ncd_io_char_var0_start_glob(vardesc, data, flag, ncid, start ) - ! - ! !DESCRIPTION: - ! netcdf I/O of global character array with start indices input - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - type(var_desc_t) , intent(in) :: vardesc ! local vardesc pointer - character(len=*) , intent(inout) :: data ! raw data for this index - integer , intent(in) :: start(:) ! output bounds - ! - ! !LOCAL VARIABLES: - integer :: status ! error code - character(len=*),parameter :: subname='ncd_io_char_var0_start_glob' - !----------------------------------------------------------------------- - - if (flag == 'read') then - - status = pio_get_var(ncid, vardesc, start, data ) - - elseif (flag == 'write') then - - status = pio_put_var(ncid, vardesc, start, data ) - - endif - - end subroutine ncd_io_char_var0_start_glob - - !------------------------------------------------------------------------ - !DIMS 0 - subroutine ncd_io_{DIMS}d_log_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! netcdf I/O of global logical variable - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - logical , intent(inout) :: data{DIMSTR} ! raw data - logical, optional , intent(out) :: readvar ! was var read? - integer, optional , intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: varid ! netCDF variable id - integer :: start(2), count(2) ! output bounds - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - integer :: idata - integer, pointer :: idata1d(:) ! Temporary integer data to send to file - character(len=32) :: vname ! variable error checking - type(var_desc_t) :: vardesc ! local vardesc pointer - character(len=*),parameter :: subname='ncd_io_{DIMS}d_log_glob' - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column .and. present(posNOTonfile) ) then - if ( .not. posNOTonfile )then - call shr_sys_abort(' ERROR: scalar var is NOT compatable with posNOTonfile = .false.'//& - errMsg(sourcefile, __LINE__)) - end if - endif -#if ({DIMS}==0) - status = pio_get_var(ncid, varid, idata) - if ( idata == 0 )then - data = .false. - else if ( idata == 1 )then - data = .true. - else - call shr_sys_abort(' ERROR: bad integer value for logical data'//errMsg(sourcefile, __LINE__)) - end if -#else - call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0') -#endif - endif - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - -#if ({DIMS}==0) - start(1) = 1 ; count(1) = 1 - if (present(nt)) start(1) = nt - call ncd_inqvid (ncid, varname, varid, vardesc) - allocate(idata1d(1)) - if ( data )then - idata1d(1) = 1 - else - idata1d(1) = 0 - end if - status = pio_put_var(ncid, varid, start, count, idata1d) - deallocate(idata1d) -#else - call shr_sys_abort('ncd_io_*_log_glob not implemented for DIMS > 0') -#endif - - endif ! flag - - end subroutine ncd_io_{DIMS}d_log_glob - - !------------------------------------------------------------------------ - !DIMS 0,1,2,3 - !TYPE int,double - subroutine ncd_io_{DIMS}d_{TYPE}_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - {VTYPE} , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: m - integer :: varid ! netCDF variable id - integer :: start({DIMS}+1), count({DIMS}+1) ! output bounds - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - logical :: found ! if true, found lat/lon dims on file - character(len=32) :: vname ! variable error checking - type(var_desc_t) :: vardesc ! local vardesc pointer - {VTYPE} :: temp(1) - character(len=*),parameter :: subname='ncd_io_{DIMS}d_{TYPE}_glob' - integer :: ndims - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) -#if ({DIMS}==0) - if (varpresent) then - status = pio_get_var(ncid, vardesc, data) - if (single_column .and. present(posNOTonfile) ) then - if ( .not. posNOTonfile )then - call shr_sys_abort(' ERROR: scalar var is NOT compatable with posNOTonfile = .false.'//& - errMsg(sourcefile, __LINE__)) - end if - endif - if ( status /= PIO_NOERR )then - call shr_sys_abort(' ERROR: reading variable: '//trim(varname)//' ' & - // errMsg(sourcefile, __LINE__)) - end if - end if -#else - if (varpresent) then - if (single_column) then - call scam_field_offsets(ncid,'undefined', vardesc,& - start, count, found=found, posNOTonfile=posNOTonfile) - if ( found )then - status = pio_get_var(ncid, varid, start, count, data) - else - status = pio_get_var(ncid, varid, data) - end if - else - status = pio_get_var(ncid, varid, data) - endif - if ( status /= PIO_NOERR )then - call shr_sys_abort(' ERROR: reading variable: '//trim(varname)//' ' & - // errMsg(sourcefile, __LINE__)) - end if - endif -#endif - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - ndims = {DIMS} - if(present(nt)) ndims=ndims+1 - call ncd_inqvid (ncid, varname, varid, vardesc) -#if ({DIMS}==0) - start(1) = 1 ; count(1) = 1 - if (present(nt)) start(1) = nt ; count(1) = 1 - temp(1) = data - status = pio_put_var(ncid, varid, start(1:1), count(1:1), temp) -#elif ({DIMS}==1) - start(1) = 1 ; count(1) = size(data) - start(2) = 1 ; count(2) = 1 - if (present(nt)) start(2) = nt - status = pio_put_var(ncid, varid, start(1:ndims), count(1:ndims), data) -#elif ({DIMS}==2) - start(1) = 1 ; count(1) = size(data, dim=1) - start(2) = 1 ; count(2) = size(data, dim=2) - start(3) = 1 ; count(3) = 1 - if (present(nt)) start(3) = nt - status = pio_put_var(ncid, varid, start(1:ndims), count(1:ndims), data) -#elif ({DIMS}==3) - if (present(nt)) then - start(1) = 1 ; count(1) = size(data,dim=1) - start(2) = 1 ; count(2) = size(data,dim=2) - start(3) = 1 ; count(3) = size(data,dim=3) - start(4) = nt ; count(4) = 1 - status = pio_put_var(ncid, varid, start(1:ndims), count(1:ndims), data) - else - status = pio_put_var(ncid, varid, data) - end if -#endif - - endif - - end subroutine ncd_io_{DIMS}d_{TYPE}_glob - - !------------------------------------------------------------------------ - !DIMS 0,1,2 - !TYPE text - subroutine ncd_io_{DIMS}d_{TYPE}_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - {VTYPE} , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: m - integer :: varid ! netCDF variable id - integer :: start(4), count(4) ! output bounds - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - character(len=1) :: tmpString(199) ! temp for manipulating output string - type(var_desc_t) :: vardesc ! local vardesc pointer - character(len=*),parameter :: subname='ncd_io_{DIMS}d_{TYPE}_glob' - integer :: ndims - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - - if (varpresent) then - data = ' ' - status = pio_get_var(ncid, varid, data) - end if - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - ndims = {DIMS} - if(present(nt)) ndims=ndims+1 - call ncd_inqvid (ncid, varname, varid, vardesc) - -#if ({DIMS}==0) - if (present(nt)) then - do m = 1,len(data) - tmpString(m:m) = data(m:m) - end do - start(1) = 1 ; count(1) = len(data) - start(2) = nt; count(2) = 1 - if ( count(1) > size(tmpString) )then - call shr_sys_abort( subname//' ERROR: input string size is too large:'//& - errMsg(sourcefile, __LINE__)) - end if - status = pio_put_var(ncid, varid, start, count, ival=tmpString(1:count(1))) - else - status = pio_put_var(ncid, varid, data ) - end if -#elif ({DIMS}==1) - if (present(nt)) then - start(1) = 1 ; count(1) = len(data) - start(2) = 1 ; count(2) = size(data) - start(3) = nt; count(3) = 1 - status = pio_put_var(ncid, varid, start, count, data) - else - status = pio_put_var(ncid, varid, data) - end if -#elif ({DIMS}==2) - if (present(nt)) then - start(1) = 1 ; count(1) = len(data) - start(2) = 1 ; count(2) = size(data,dim=1) - start(3) = 1 ; count(3) = size(data,dim=2) - start(4) = nt ; count(4) = 1 - status = pio_put_var(ncid, varid, start, count, data) - else - status = pio_put_var(ncid, varid, data) - end if -#endif - - endif - - end subroutine ncd_io_{DIMS}d_{TYPE}_glob - - !----------------------------------------------------------------------- - - !TYPE int,double,logical - subroutine ncd_io_1d_{TYPE}(varname, data, dim1name, flag, ncid, nt, readvar, cnvrtnan2fill) - ! - ! !DESCRIPTION: - ! netcdf I/O for 1d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:) ! local decomposition data - character(len=*) , intent(in) :: dim1name ! dimension name - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - logical , optional, intent(in) :: cnvrtnan2fill ! true => convert any NaN's to _FillValue (spval) - ! - ! Local Variables - character(len=8) :: clmlevel ! clmlevel - character(len=32) :: dimname ! temporary - integer :: n ! index - integer :: iodnum ! iodesc num in list - integer :: varid ! varid - integer :: ndims ! ndims for var - integer :: ndims_iod ! ndims iodesc for var - integer :: dims(4) ! dim sizes - integer :: dids(4) ! dim ids - integer :: start(3) ! netcdf start index - integer :: count(3) ! netcdf count index - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - integer , pointer :: idata(:) ! Temporary integer data to send to file - type(iodesc_plus_type) , pointer :: iodesc_plus - type(var_desc_t) :: vardesc - character(len=*),parameter :: subname='ncd_io_1d_{TYPE}' ! subroutine name - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - clmlevel = dim1name - - if (masterproc .and. debug > 1) then - write(iulog,*) subname//' ',trim(flag),' ',trim(varname),' ',trim(clmlevel) - end if - -#if ({ITYPE}==TYPEDOUBLE) - if ( present(cnvrtnan2fill) )then - if (.not. cnvrtnan2fill) then - call shr_sys_abort(' ERROR: cnvrtnan2fill present but NOT set to true -- MUST set it to TRUE if used'//& - errMsg(sourcefile, __LINE__)) - endif - end if -#endif - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - if (single_column) then - start(:) = 1 ; count(:) = 1 - call scam_field_offsets(ncid,clmlevel,vardesc,start,count) - if (trim(clmlevel) == grlnd) then - n=2 - if (present(nt)) then - start(3) = nt ; count(3) = 1 - n=3 - end if - else - n=1 - if (present(nt)) then - n=2 - start(2) = nt ; count(2) = 1 - end if - end if -#if ({ITYPE}==TYPELOGICAL) - allocate(idata(size(data))) - status = pio_get_var(ncid, varid, start(1:n), count(1:n), idata) - data = (idata == 1) - if ( any(idata /= 0 .and. idata /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - deallocate( idata ) -#else - status = pio_get_var(ncid, varid, start(1:n), count(1:n), data) -#endif - if ( status /= PIO_NOERR )then - call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & - // errMsg(sourcefile, __LINE__)) - end if - else - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo -#if ({ITYPE}==TYPELOGICAL) - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_INT, iodnum) -#else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) -#endif - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if -#if ({ITYPE}==TYPELOGICAL) - allocate(idata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) - data = (idata == 1) - if ( any(idata /= 0 .and. idata /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(sourcefile, __LINE__)) - end if - deallocate( idata ) -#else - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) -#endif - if ( status /= PIO_NOERR ) then - call shr_sys_abort(' ERROR: reading in variable: '// trim(varname) & - // errMsg(sourcefile, __LINE__)) - end if - end if - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - - call ncd_inqvid(ncid, varname ,varid, vardesc) - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo -#if ({ITYPE}==TYPELOGICAL) - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_INT, iodnum) -#else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) -#endif - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if -#if ({ITYPE}==TYPELOGICAL) - allocate( idata(size(data)) ) - where( data ) - idata = 1 - elsewhere - idata = 0 - end where - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status, fillval=0) - deallocate( idata ) -#elif ({ITYPE}==TYPEINT) - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=ispval) -#elif ({ITYPE}==TYPEDOUBLE) - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) -#endif - else - - if (masterproc) then - write(iulog,*) subname//' ERROR: unsupported flag ',trim(flag) - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - - endif - - end subroutine ncd_io_1d_{TYPE} - - !----------------------------------------------------------------------- - - !TYPE int,double - subroutine ncd_io_2d_{TYPE}(varname, data, dim1name, lowerb2, upperb2, & - flag, ncid, nt, readvar, switchdim, cnvrtnan2fill) - ! - ! !DESCRIPTION: - ! Netcdf i/o of 2d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:,:) ! local decomposition input data - character(len=*) , intent(in) :: dim1name ! dimension 1 name - integer, optional, intent(in) :: nt ! time sample index - integer, optional, intent(in) :: lowerb2,upperb2 ! lower and upper bounds of second dimension - logical, optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - logical, optional, intent(in) :: switchdim ! true=> permute dim1 and dim2 for output - logical, optional, intent(in) :: cnvrtnan2fill ! true => convert any NaN's to _FillValue (spval) - ! - ! !LOCAL VARIABLES: -#if ({ITYPE}==TYPEINT) - integer , pointer :: temp(:,:) -#else - real(r8), pointer :: temp(:,:) -#endif - integer :: ndim1,ndim2 - character(len=8) :: clmlevel ! clmlevel - character(len=32) :: dimname ! temporary - integer :: status ! error status - integer :: ndims ! ndims total for var - integer :: ndims_iod ! ndims iodesc for var - integer :: varid ! varid - integer :: n,i,j ! indices - integer :: dims(4) ! dim sizes - integer :: dids(4) ! dim ids - integer :: iodnum ! iodesc num in list - integer :: start(4) ! netcdf start index - integer :: count(4) ! netcdf count index - logical :: varpresent ! if true, variable is on tape - integer :: lb1,lb2 - integer :: ub1,ub2 - type(iodesc_plus_type) , pointer :: iodesc_plus - type(var_desc_t) :: vardesc - character(len=*),parameter :: subname='ncd_io_2d_{TYPE}' ! subroutine name - !----------------------------------------------------------------------- - - start(:)=0 - count(:)=0 - - clmlevel = dim1name - - if (masterproc .and. debug > 1) then - write(iulog,*) trim(subname),' ',trim(flag),' ',trim(varname),' ',trim(clmlevel) - end if - -#if ({ITYPE}==TYPEDOUBLE) - if ( present(cnvrtnan2fill) )then - if (.not. cnvrtnan2fill) then - call shr_sys_abort( ' ERROR: cnvrtnan2fill present but NOT set to true -- MUST set it to TRUE if used'//& - errMsg(sourcefile, __LINE__)) - endif - end if -#endif - - lb1 = lbound(data, dim=1) - ub1 = ubound(data, dim=1) - lb2 = lbound(data, dim=2) - ub2 = ubound(data, dim=2) - - if (present(switchdim)) then - if (present(lowerb2)) lb2 = lowerb2 - if (present(upperb2)) ub2 = upperb2 - allocate(temp(lb2:ub2,lb1:ub1)) - end if - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column) then - start(:) = 1 ; count(:) = 1 - call scam_field_offsets(ncid, clmlevel, vardesc, start, count) - if (trim(clmlevel) == grlnd) then - count(3) = size(data,dim=2) - n=3 - if (present(nt)) then - start(4) = nt; count(4) = 1 - n=4 - end if - else - count(2) = size(data,dim=2) - n=2 - if (present(nt)) then - start(3) = nt ; count(3) = 1 - n=3 - end if - end if - if (present(switchdim)) then - status = pio_get_var(ncid, vardesc, start(1:n), count(1:n), temp) - do j = lb2,ub2 - do i = lb1,ub1 - data(i,j) = temp(j,i) - end do - end do - else - status = pio_get_var(ncid, vardesc, start(1:n), count(1:n), data) - endif - else - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid,vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid, dids(ndims), dimname) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - if (present(switchdim)) then - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum, switchdim=.true.) - else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - end if - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - if (present(switchdim)) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status) - do j = lb2,ub2 - do i = lb1,ub1 - data(i,j) = temp(j,i) - end do - end do - else - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - end if - end if -#if ({ITYPE}!=TYPEINT) - if ( present(cnvrtnan2fill) )then - do j = lb2,ub2 - do i = lb1,ub1 - if ( data(i,j) == spval )then - data(i,j) = nan - end if - end do - end do - end if -#endif - end if - if (present(readvar)) readvar = varpresent - - else if (flag == 'write') then - - call ncd_inqvid(ncid, varname ,varid, vardesc) - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc , dids(1:ndims)) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - if (present(switchdim)) then - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum, switchdim=.true.) - else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - end if - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - if (present(switchdim)) then - do j = lb2,ub2 - do i = lb1,ub1 - temp(j,i) = data(i,j) - end do - end do - end if -#if ({ITYPE}==TYPEINT) - if (present(switchdim)) then - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status, fillval=ispval) - else - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=ispval) - end if -#else - if (present(switchdim)) then - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status, fillval=spval) - else - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) - end if - if ( present(cnvrtnan2fill) )then - do j = lb2,ub2 - do i = lb1,ub1 - if ( isnan(data(i,j)) )then - data(i,j) = spval - end if - end do - end do - end if -#endif - - else - - if (masterproc) then - write(iulog,*) subname,' error: unsupported flag ',trim(flag) - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - - endif - - if (present(switchdim)) then - deallocate(temp) - end if - - end subroutine ncd_io_2d_{TYPE} - - !----------------------------------------------------------------------- - - !TYPE int,double - subroutine ncd_io_3d_{TYPE}(varname, data, dim1name, flag, ncid, nt, readvar) - ! - ! !DESCRIPTION: - ! Netcdf i/o of 3d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:,:,:) ! local decomposition input data - character(len=*) , intent(in) :: dim1name ! dimension 1 name - integer, optional, intent(in) :: nt ! time sample index - logical, optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - ! - ! !LOCAL VARIABLES: - integer :: ndim1,ndim2 - character(len=8) :: clmlevel ! clmlevel - character(len=32) :: dimname ! temporary - integer :: status ! error status - integer :: ndims ! ndims total for var - integer :: ndims_iod ! ndims iodesc for var - integer :: varid ! varid - integer :: n ! index - integer :: dims(4) ! dim sizes - integer :: dids(4) ! dim ids - integer :: iodnum ! iodesc num in list - integer :: start(5) ! netcdf start index - integer :: count(5) ! netcdf count index - logical :: varpresent ! if true, variable is on tape - type(iodesc_plus_type) , pointer :: iodesc_plus - type(var_desc_t) :: vardesc - character(len=*),parameter :: subname='ncd_io_3d_{TYPE}' ! subroutine name - !----------------------------------------------------------------------- - - clmlevel = dim1name - - if (masterproc .and. debug > 1) then - write(iulog,*) trim(subname),' ',trim(flag),' ',trim(varname),' ',trim(clmlevel) - end if - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column) then - start(:) = 1 - count(:) = 1 - call scam_field_offsets(ncid, clmlevel, vardesc, start, count) - if (trim(clmlevel) == grlnd) then - count(3) = size(data,dim=2); - count(4) = size(data,dim=3) - n=4 - if (present(nt)) then - start(5) = nt - count(5) = 1 - n=5 - end if - else - count(2) = size(data,dim=2) - count(3) = size(data,dim=3) - n=3 - if (present(nt)) then - start(4) = nt - count(4) = 1 - n=4 - end if - end if - status = pio_get_var(ncid, vardesc, start(1:n), count(1:n), data) - else - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid,vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid, dids(ndims), dimname) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - end if - end if - if (present(readvar)) readvar = varpresent - - else if (flag == 'write') then - - call ncd_inqvid(ncid, varname ,varid, vardesc) - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc , dids(1:ndims)) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - - else - - if (masterproc) then - write(iulog,*) subname,' error: unsupported flag ',trim(flag) - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - - endif - - end subroutine ncd_io_3d_{TYPE} - - !------------------------------------------------------------------------ - - subroutine scam_field_offsets( ncid, dim1name, vardesc, start, count, & - found, posNOTonfile) - ! - ! !DESCRIPTION: - ! Read/Write initial data from/to netCDF instantaneous initial data file - ! - ! !USES: - use clm_varctl, only: scmlon,scmlat,single_column - use shr_scam_mod, only: shr_scam_getCloseLatLon - use shr_string_mod, only: shr_string_toLower - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: dim1name ! dimension 1 name - type(Var_desc_t) , intent(inout) :: vardesc ! variable descriptor - integer , intent(out) :: start(:) ! start index - integer , intent(out) :: count(:) ! count to retrieve - logical, optional , intent(out) :: found ! if present return true if found - ! dimensions on file else false if NOT present abort if can't find - logical, optional , intent(in) :: posNOTonfile ! Position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: cc,i,ii ! index variable - integer :: data_offset ! offset into land array 1st column - integer :: ndata ! number of column (or pft points to read) - real(r8) , pointer :: cols1dlon(:) ! holds cols1d_ixy var - real(r8) , pointer :: cols1dlat(:) ! holds cols1d_jxy var - real(r8) , pointer :: pfts1dlon(:) ! holds pfts1d_ixy var - real(r8) , pointer :: pfts1dlat(:) ! holds pfts1d_jxy var - real(r8) , pointer :: land1dlon(:) ! holds land1d_ixy var - real(r8) , pointer :: land1dlat(:) ! holds land1d_jxy var - integer, allocatable :: cols(:) ! grid cell columns for scam - integer, allocatable :: pfts(:) ! grid cell pfts for scam - integer, allocatable :: landunits(:) ! grid cell landunits for scam - integer, allocatable :: dids(:) ! dim ids - integer :: varid ! netCDF variable id - integer :: status ! return code - integer :: latidx,lonidx ! latitude/longitude indices - real(r8) :: closelat,closelon ! closest latitude and longitude indices - integer :: ndims,dimlen ! number of dimensions in desired variable - character(len=32) :: dimname ! dimension name - character(len=32) :: subname = 'scam_field_offsets' - !------------------------------------------------------------------------ - - start(:)=1 - count(:)=1 - - if ( present(posNOTonfile) )then - if ( posNOTonfile )then - if ( .not. present(found) )then - call shr_sys_abort('ERROR: Bad subroutine calling structure posNOTonfile sent, but found was NOT!'//& - errMsg(sourcefile, __LINE__)) - end if - found = .false. - return - end if - end if - - ! find closest land grid cell for this point - - if ( present(found) )then - call shr_scam_getCloseLatLon(ncid,scmlat,scmlon,closelat,closelon,latidx,lonidx,found) - if ( .not. found ) return - else - call shr_scam_getCloseLatLon(ncid,scmlat,scmlon,closelat,closelon,latidx,lonidx) - end if - - call ncd_inqvdims(ncid,ndims,vardesc) - - allocate(dids(ndims)) - status = pio_inq_vardimid(ncid, vardesc, dids) - do i = 1,ndims - status = pio_inq_dimname(ncid,dids(i),dimname) - dimname=shr_string_toLower(dimname) - status = pio_inq_dimlen(ncid,dids(i),dimlen) - if ( trim(dimname)=='nj'.or. trim(dimname)=='lat'.or. trim(dimname)=='lsmlat') then - start(i)=latidx - count(i)=1 - else if ( trim(dimname)=='ni'.or. trim(dimname)=='lon'.or. trim(dimname)=='lsmlon') then - start(i)=lonidx - count(i)=1 - else if ( trim(dimname)=='column') then - - allocate (cols1dlon(dimlen)) - allocate (cols1dlat(dimlen)) - allocate (cols(dimlen)) - - status = pio_inq_varid(ncid, 'cols1d_lon', varid) - status = pio_get_var(ncid, varid, cols1dlon) - status = pio_inq_varid(ncid, 'cols1d_lat', varid) - status = pio_get_var(ncid, varid, cols1dlat) - - cols(:) = huge(1) - data_offset = huge(1) - ii = 1 - ndata = 0 - do cc = 1, dimlen - if (cols1dlon(cc) == closelon.and.cols1dlat(cc) == closelat) then - cols(ii)=cc - ndata =ii - ii=ii+1 - end if - end do - if (ndata == 0) then - write(iulog,*)'couldnt find any columns for this latitude ',latidx,' and longitude ',lonidx - call shr_sys_abort('ERROR:: no columns for this position'//errMsg(sourcefile, __LINE__)) - else - data_offset=cols(1) - end if - - deallocate (cols1dlon) - deallocate (cols1dlat) - deallocate (cols) - - start(i) = data_offset - count(i) = ndata - else if ( trim(dimname)=='pft') then - - allocate (pfts1dlon(dimlen)) - allocate (pfts1dlat(dimlen)) - allocate (pfts(dimlen)) - - status = pio_inq_varid(ncid, 'pfts1d_lon', varid) - status = pio_get_var(ncid, varid, pfts1dlon) - - status = pio_inq_varid(ncid, 'pfts1d_lat', varid) - status = pio_get_var(ncid, varid, pfts1dlat) - - pfts(:) = huge(1) - data_offset = huge(1) - ii = 1 - ndata = 0 - do cc = 1, dimlen - if (pfts1dlon(cc) == closelon.and.pfts1dlat(cc) == closelat) then - pfts(ii)=cc - ndata =ii - ii=ii+1 - end if - end do - if (ndata == 0) then - write(iulog,*)'couldnt find any pfts for this latitude ',closelat,' and longitude ',closelon - call shr_sys_abort('ERROR:: no PFTs for this position'//errMsg(sourcefile, __LINE__)) - else - data_offset=pfts(1) - end if - - deallocate (pfts1dlon) - deallocate (pfts1dlat) - deallocate (pfts) - - start(i) = data_offset - count(i) = ndata - else if ( trim(dimname)=='landunit') then - - allocate (land1dlon(dimlen)) - allocate (land1dlat(dimlen)) - allocate (landunits(dimlen)) - - status = pio_inq_varid(ncid, 'land1d_lon', varid) - status = pio_get_var(ncid, varid, land1dlon) - - status = pio_inq_varid(ncid, 'land1d_lat', varid) - status = pio_get_var(ncid, varid, land1dlat) - - landunits(:) = huge(1) - data_offset = huge(1) - ii = 1 - ndata = 0 - do cc = 1, dimlen - if (land1dlon(cc) == closelon.and.land1dlat(cc) == closelat) then - landunits(ii)=cc - ndata =ii - ii=ii+1 - end if - end do - if (ndata == 0) then - write(iulog,*)'couldnt find any landunits for this latitude ',closelat,' and longitude ',closelon - call shr_sys_abort('ERROR:: no landunits for this position'//errMsg(sourcefile, __LINE__)) - else - data_offset=landunits(1) - end if - - deallocate (land1dlon) - deallocate (land1dlat) - deallocate (landunits) - - start(i) = data_offset - count(i) = ndata - else - start(i)=1 - count(i)=dimlen - end if - enddo - deallocate(dids) - - end subroutine scam_field_offsets - - !------------------------------------------------------------------------ - - subroutine ncd_getiodesc(ncid, clmlevel, ndims, dims, dimids, & - xtype, iodnum, switchdim) - ! - ! !DESCRIPTION: - ! Returns an index to an io descriptor - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor - character(len=8) , intent(in) :: clmlevel ! clmlevel - integer , intent(in) :: ndims ! ndims for var - integer , intent(in) :: dims(:) ! dim sizes - integer , intent(in) :: dimids(:) ! dim ids - integer , intent(in) :: xtype ! file external type - integer , intent(out) :: iodnum ! iodesc num in list - logical,optional , intent(in) :: switchdim ! switch level dimension and first dim - ! - ! !LOCAL VARIABLES: - integer :: k,m,n,cnt ! indices - integer :: basetype ! pio basetype - integer :: gsmap_lsize ! local size of gsmap - integer :: gsmap_gsize ! global size of gsmap - integer :: fullsize ! size of entire array on cdf - integer :: gsize ! global size of clmlevel - integer :: vsize ! other dimensions - integer :: vsize1, vsize2 ! other dimensions - integer :: status ! error status - logical :: found ! true => found created iodescriptor - integer :: ndims_file ! temporary - character(len=64) dimname_file ! dimension name on file - character(len=64) dimname_iodesc ! dimension name from io descriptor - type(mct_gsMap),pointer :: gsmap ! global seg map - integer, pointer,dimension(:) :: gsmOP ! gsmap ordered points - integer(pio_offset_kind), pointer :: compDOF(:) - character(len=32) :: subname = 'ncd_getiodesc' - !------------------------------------------------------------------------ - - ! Determining if need to create a new io descriptor - n = 1 - found = .false. - do while (n <= num_iodesc .and. .not.found) - if (ndims == iodesc_list(n)%ndims .and. xtype == iodesc_list(n)%type) then - found = .true. - ! First found implies that dimension sizes are the same - do m = 1,ndims - if (dims(m) /= iodesc_list(n)%dims(m)) then - found = .false. - endif - enddo - ! If found - then also check that dimension names are equal - - ! dimension ids in iodescriptor are only used to query dimension - ! names associated with that iodescriptor - if (found) then - status = PIO_inquire(ncid, ndimensions=ndims_file) - do m = 1,ndims - status = PIO_inq_dimname(ncid,dimids(m),dimname_file) - if (iodesc_list(n)%dimids(m) > ndims_file) then - found = .false. - exit - else - status = PIO_inq_dimname(ncid,iodesc_list(n)%dimids(m),dimname_iodesc) - if (trim(dimname_file) /= trim(dimname_iodesc)) then - found = .false. - exit - end if - end if - end do - end if - if (found) then - iodnum = n - if (iodnum > num_iodesc) then - write(iulog,*) trim(subname),' ERROR: iodnum out of range ',iodnum,num_iodesc - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - RETURN - endif - endif - n = n + 1 - enddo - - ! Creating a new io descriptor - - if (ndims > 0) then - num_iodesc = num_iodesc + 1 - if (num_iodesc > max_iodesc) then - write(iulog,*) trim(subname),' ERROR num_iodesc gt max_iodesc ',max_iodesc - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - iodnum = num_iodesc - if (masterproc .and. debug > 1) then - write(iulog,*) trim(subname),' creating iodesc at iodnum,ndims,dims(1:ndims),xtype',& - iodnum,ndims,dims(1:ndims),xtype - endif - end if - - if (xtype == pio_double ) then - basetype = PIO_DOUBLE - else if (xtype == pio_real) then - basetype = PIO_DOUBLE - else if (xtype == pio_int) then - basetype = PIO_INT - else - write(iulog,*) trim(subname),'ERROR: no match for xtype = ',xtype - call shr_sys_abort(errMsg(sourcefile,__LINE__)) - end if - - call get_clmlevel_gsmap(clmlevel,gsmap) - gsize = get_clmlevel_gsize(clmlevel) - gsmap_lsize = mct_gsmap_lsize(gsmap,mpicom) - gsmap_gsize = mct_gsmap_gsize(gsmap) - - call mct_gsMap_orderedPoints(gsmap,iam,gsmOP) - - fullsize = 1 - do n = 1,ndims - fullsize = fullsize*dims(n) - enddo - - vsize = fullsize / gsize - if (mod(fullsize,gsize) /= 0) then - write(iulog,*) subname,' ERROR in vsize ',fullsize,gsize,vsize - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - endif - - allocate(compDOF(gsmap_lsize*vsize)) - - if (present(switchdim)) then - if (switchdim) then - cnt = 0 - do m = 1,gsmap_lsize - do n = 1,vsize - cnt = cnt + 1 - compDOF(cnt) = (gsmOP(m)-1)*vsize + n - enddo - enddo - else - write(iulog,*) subname,' ERROR switch dims present must have switchdim true' - call shr_sys_abort(errMsg(sourcefile, __LINE__)) - end if - else ! currently allow for up to two vertical dimensions - if (vsize /= 1 .and. vsize /= dims(ndims)) then - vsize1 = vsize/dims(ndims) - vsize2 = dims(ndims) - if (vsize1*vsize2 /= vsize) then - write(iulog,*)'vsize1= ',vsize1,' vsize2= ',vsize2,' vsize= ',vsize - call shr_sys_abort('error in vsize1 and vsize2 computation'//errMsg(sourcefile, __LINE__)) - end if - cnt = 0 - do k = 1,vsize2 - do n = 1,vsize1 - do m = 1,gsmap_lsize - cnt = cnt + 1 - compDOF(cnt) = (k-1)*vsize1*gsmap_gsize + (n-1)*gsmap_gsize + gsmOP(m) - enddo - enddo - end do - else - cnt = 0 - do n = 1,vsize - do m = 1,gsmap_lsize - cnt = cnt + 1 - compDOF(cnt) = (n-1)*gsmap_gsize + gsmOP(m) - enddo - enddo - end if - end if - - if (debug > 1) then - do m = 0,npes-1 - if (iam == m) then - write(iulog,*) trim(subname),' sizes1 = ',iam,gsize,gsmap_gsize,gsmap_lsize - write(iulog,*) trim(subname),' sizes2 = ',iam,fullsize,npes,vsize - write(iulog,*) trim(subname),' compDOF = ',iam,size(compDOF),minval(compDOF),maxval(compDOF) - call shr_sys_flush(iulog) - endif - call mpi_barrier(mpicom,status) - enddo - endif - - deallocate(gsmOP) - - call pio_initdecomp(pio_subsystem, baseTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc) - - deallocate(compDOF) - - iodesc_list(iodnum)%type = xtype - iodesc_list(iodnum)%ndims = ndims - iodesc_list(iodnum)%dims = 0 - iodesc_list(iodnum)%dims(1:ndims) = dims(1:ndims) - iodesc_list(iodnum)%dimids(1:ndims) = dimids(1:ndims) - - end subroutine ncd_getiodesc - -end module ncdio_pio diff --git a/src/main/ncdio_utils.F90 b/src/main/ncdio_utils.F90 deleted file mode 100644 index 977e10b484..0000000000 --- a/src/main/ncdio_utils.F90 +++ /dev/null @@ -1,70 +0,0 @@ -module ncdio_utils - - !----------------------------------------------------------------------- - ! This module provides higher-level netcdf i/o utilities, which build on ncdio_pio. - ! - ! The main reason for putting these utilities in a separate module (rather than putting - ! them in ncdio_pio) is to enhance testability: These routines can be unit tested with - ! a stub version of ncdio_pio. - use ncdio_pio - ! - implicit none - save - private - - public :: find_var_on_file ! given a list of possible variables, find the one that exists on the file - -contains - - !----------------------------------------------------------------------- - subroutine find_var_on_file(ncid, varname_list, varname_on_file) - ! - ! !DESCRIPTION: - ! Given a colon-delimited list of possible variable names, return the first one that - ! was found on the file. - ! - ! If none are found, arbitrarily return the first variable in the list. (Doing this - ! rather than returning a special flag simplifies the logic elsewhere - allowing the - ! ncd_io call to fail rather than requiring extra error-checking logic.) - ! - ! !USES: - use shr_string_mod, only : shr_string_listGetNum, shr_string_listGetName - ! - ! !ARGUMENTS: - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: varname_list ! colon-delimited list of possible variable names - character(len=*) , intent(out) :: varname_on_file ! first variable from the list that was found on file - ! - ! !LOCAL VARIABLES: - integer :: num_vars - integer :: n - logical :: found - logical :: readvar - character(len=len(varname_on_file)) :: cur_varname - integer :: varid - type(var_desc_t) :: vardesc - - character(len=*), parameter :: subname = 'find_var_on_file' - !----------------------------------------------------------------------- - - num_vars = shr_string_listGetNum(varname_list) - - found = .false. - n = 1 - do while ((.not. found) .and. (n <= num_vars)) - call shr_string_listGetName(varname_list, n, cur_varname) - call ncd_inqvid(ncid, cur_varname, varid, vardesc, readvar=readvar) - found = readvar - n = n + 1 - end do - - if (found) then - varname_on_file = cur_varname - else - ! If none are found, arbitrarily return the first variable in the list - call shr_string_listGetName(varname_list, 1, varname_on_file) - end if - - end subroutine find_var_on_file - -end module ncdio_utils diff --git a/src/main/ndepStreamMod.F90 b/src/main/ndepStreamMod.F90 deleted file mode 100644 index e4acd648b8..0000000000 --- a/src/main/ndepStreamMod.F90 +++ /dev/null @@ -1,353 +0,0 @@ -module ndepStreamMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains methods for reading in nitrogen deposition data file - ! Also includes functions for dynamic ndep file handling and - ! interpolation. - ! - ! !USES - use shr_kind_mod, only: r8 => shr_kind_r8, CL => shr_kind_cl - use shr_strdata_mod, only: shr_strdata_type, shr_strdata_create - use shr_strdata_mod, only: shr_strdata_print, shr_strdata_advance - use mct_mod , only: mct_ggrid - use spmdMod , only: mpicom, masterproc, comp_id, iam - use clm_varctl , only: iulog - use abortutils , only: endrun - use fileutils , only: getavu, relavu - use decompMod , only: bounds_type, ldecomp, gsmap_lnd_gdc2glo - use domainMod , only: ldomain - - ! !PUBLIC TYPES: - implicit none - private - save - - ! !PUBLIC MEMBER FUNCTIONS: - public :: ndep_init ! position datasets for dynamic ndep - public :: ndep_interp ! interpolates between two years of ndep file data - public :: clm_domain_mct ! Sets up MCT domain for this resolution - - ! !PRIVATE MEMBER FUNCTIONS: - private :: check_units ! Check the units and make sure they can be used - ! ! PRIVATE TYPES - type(shr_strdata_type) :: sdat ! input data stream - integer :: stream_year_first_ndep ! first year in stream to use - integer :: stream_year_last_ndep ! last year in stream to use - integer :: model_year_align_ndep ! align stream_year_firstndep with - logical :: divide_by_secs_per_yr = .true. ! divide by the number of seconds per year - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !============================================================================== - -contains - - !============================================================================== - - subroutine ndep_init(bounds, NLFilename) - ! - ! Initialize data stream information. - ! - ! Uses: - use shr_kind_mod , only : CS => shr_kind_cs - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use shr_nl_mod , only : shr_nl_find_group_name - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! arguments - implicit none - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! local variables - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_ndep - character(len=CL) :: ndepmapalgo = 'bilinear' - character(len=CS) :: ndep_taxmode = 'extend' - character(len=CL) :: ndep_varlist = 'NDEP_year' - character(*), parameter :: shr_strdata_unset = 'NOT_SET' - character(*), parameter :: subName = "('ndepdyn_init')" - character(*), parameter :: F00 = "('(ndepdyn_init) ',4a)" - !----------------------------------------------------------------------- - - namelist /ndepdyn_nml/ & - stream_year_first_ndep, & - stream_year_last_ndep, & - model_year_align_ndep, & - ndepmapalgo, ndep_taxmode, & - ndep_varlist, & - stream_fldFileName_ndep - - ! Default values for namelist - stream_year_first_ndep = 1 ! first year in stream to use - stream_year_last_ndep = 1 ! last year in stream to use - model_year_align_ndep = 1 ! align stream_year_first_ndep with this model year - stream_fldFileName_ndep = ' ' - - ! Read ndepdyn_nml namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call shr_nl_find_group_name(nu_nml, 'ndepdyn_nml', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=ndepdyn_nml,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg=' ERROR reading ndepdyn_nml namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg=' ERROR finding ndepdyn_nml namelist'//errMsg(sourcefile, __LINE__)) - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_ndep , mpicom) - call shr_mpi_bcast(stream_year_last_ndep , mpicom) - call shr_mpi_bcast(model_year_align_ndep , mpicom) - call shr_mpi_bcast(stream_fldFileName_ndep, mpicom) - call shr_mpi_bcast(ndep_varlist , mpicom) - call shr_mpi_bcast(ndep_taxmode , mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'ndepdyn stream settings:' - write(iulog,*) ' stream_year_first_ndep = ',stream_year_first_ndep - write(iulog,*) ' stream_year_last_ndep = ',stream_year_last_ndep - write(iulog,*) ' model_year_align_ndep = ',model_year_align_ndep - write(iulog,*) ' stream_fldFileName_ndep = ',stream_fldFileName_ndep - write(iulog,*) ' ndep_varList = ',ndep_varList - write(iulog,*) ' ndep_taxmode = ',ndep_taxmode - write(iulog,*) ' ' - endif - ! Read in units - call check_units( stream_fldFileName_ndep, ndep_varList ) - - ! Set domain and create streams - call clm_domain_mct (bounds, dom_clm) - - call shr_strdata_create(sdat,name="clmndep", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_ndep, & - yearLast=stream_year_last_ndep, & - yearAlign=model_year_align_ndep, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_ndep), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/trim(stream_fldFileName_ndep)/),& - fldListFile=ndep_varlist, & - fldListModel=ndep_varlist, & - fillalgo='none', & - mapalgo=ndepmapalgo, & - calendar=get_calendar(), & - taxmode=ndep_taxmode ) - - - if (masterproc) then - call shr_strdata_print(sdat,'CLMNDEP data') - endif - - end subroutine ndep_init - !================================================================ - - subroutine check_units( stream_fldFileName_ndep, ndep_varList ) - !------------------------------------------------------------------- - ! Check that units are correct on the file and if need any conversion - use ncdio_pio , only : ncd_pio_openfile, ncd_inqvid, ncd_getatt, ncd_pio_closefile, ncd_nowrite - use ncdio_pio , only : file_desc_t, var_desc_t - use shr_kind_mod , only : CS => shr_kind_cs - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_string_mod, only : shr_string_listGetName - implicit none - - !----------------------------------------------------------------------- - ! - ! Arguments - character(len=*), intent(IN) :: stream_fldFileName_ndep ! ndep filename - character(len=*), intent(IN) :: ndep_varList ! ndep variable list to examine - ! - ! Local variables - type(file_desc_t) :: ncid ! NetCDF filehandle for ndep file - type(var_desc_t) :: vardesc ! variable descriptor - integer :: varid ! variable index - logical :: readvar ! If variable was read - character(len=CS) :: ndepunits! ndep units - character(len=CS) :: fname ! ndep field name - !----------------------------------------------------------------------- - call ncd_pio_openfile( ncid, trim(stream_fldFileName_ndep), ncd_nowrite ) - call shr_string_listGetName( ndep_varList, 1, fname ) - call ncd_inqvid( ncid, fname, varid, vardesc, readvar=readvar ) - if ( readvar ) then - call ncd_getatt( ncid, varid, "units", ndepunits ) - else - call endrun(msg=' ERROR finding variable: '//trim(fname)//" in file: "// & - trim(stream_fldFileName_ndep)//errMsg(sourcefile, __LINE__)) - end if - call ncd_pio_closefile( ncid ) - - ! Now check to make sure they are correct - if ( trim(ndepunits) == "g(N)/m2/s" )then - divide_by_secs_per_yr = .false. - else if ( trim(ndepunits) == "g(N)/m2/yr" )then - divide_by_secs_per_yr = .true. - else - call endrun(msg=' ERROR in units for nitrogen deposition equal to: '//trim(ndepunits)//" not units expected"// & - errMsg(sourcefile, __LINE__)) - end if - - end subroutine check_units - - !================================================================ - subroutine ndep_interp(bounds, atm2lnd_inst) - - !----------------------------------------------------------------------- - use clm_time_manager, only : get_curr_date, get_days_per_year - use clm_varcon , only : secspday - use atm2lndType , only : atm2lnd_type - ! - ! Arguments - type(bounds_type) , intent(in) :: bounds - type(atm2lnd_type), intent(inout) :: atm2lnd_inst - ! - ! Local variables - integer :: g, ig - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - integer :: dayspyr ! days per year - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(sdat, mcdate, sec, mpicom, 'ndepdyn') - - if ( divide_by_secs_per_yr )then - ig = 0 - dayspyr = get_days_per_year( ) - do g = bounds%begg,bounds%endg - ig = ig+1 - atm2lnd_inst%forc_ndep_grc(g) = sdat%avs(1)%rAttr(1,ig) / (secspday * dayspyr) - end do - else - ig = 0 - do g = bounds%begg,bounds%endg - ig = ig+1 - atm2lnd_inst%forc_ndep_grc(g) = sdat%avs(1)%rAttr(1,ig) - end do - end if - - end subroutine ndep_interp - - !============================================================================== - subroutine clm_domain_mct(bounds, dom_clm) - - !------------------------------------------------------------------- - ! Set domain data type for internal clm grid - use clm_varcon , only : re - use domainMod , only : ldomain - use seq_flds_mod - use mct_mod , only : mct_ggrid, mct_gsMap_lsize, mct_gGrid_init - use mct_mod , only : mct_gsMap_orderedPoints, mct_gGrid_importIAttr - use mct_mod , only : mct_gGrid_importRAttr - implicit none - ! - ! arguments - type(bounds_type), intent(in) :: bounds - type(mct_ggrid), intent(out) :: dom_clm ! Output domain information for land model - ! - ! local variables - integer :: g,i,j ! index - integer :: lsize ! land model domain data size - real(r8), pointer :: data(:) ! temporary - integer , pointer :: idata(:) ! temporary - !------------------------------------------------------------------- - ! - ! Initialize mct domain type - ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) - ! Note that in addition land carries around landfrac for the purposes of domain checking - ! - lsize = mct_gsMap_lsize(gsmap_lnd_gdc2glo, mpicom) - call mct_gGrid_init( GGrid=dom_clm, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) - ! - ! Allocate memory - ! - allocate(data(lsize)) - ! - ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT - ! - call mct_gsMap_orderedPoints(gsmap_lnd_gdc2glo, iam, idata) - call mct_gGrid_importIAttr(dom_clm,'GlobGridNum',idata,lsize) - ! - ! Determine domain (numbering scheme is: West to East and South to North to South pole) - ! Initialize attribute vector with special value - ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_clm,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_clm,"mask" ,data,lsize) - ! - ! Determine bounds - ! - ! Fill in correct values for domain components - ! Note aream will be filled in in the atm-lnd mapper - ! - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%lonc(g) - end do - call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%latc(g) - end do - call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%area(g)/(re*re) - end do - call mct_gGrid_importRattr(dom_clm,"area",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%mask(g), r8) - end do - call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%frac(g), r8) - end do - call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) - - deallocate(data) - deallocate(idata) - - end subroutine clm_domain_mct - -end module ndepStreamMod - diff --git a/src/main/organicFileMod.F90 b/src/main/organicFileMod.F90 deleted file mode 100644 index 3adbd5b6f1..0000000000 --- a/src/main/organicFileMod.F90 +++ /dev/null @@ -1,113 +0,0 @@ -module organicFileMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: organicFileMod -! -! !DESCRIPTION: -! Contains methods for reading in organic matter data file which has -! organic matter density for each grid point and soil level -! -! !USES - use abortutils , only : endrun - use clm_varctl , only : iulog - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon , only : grlnd -! -! !PUBLIC TYPES: - implicit none - private - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: organicrd ! Read organic matter dataset -! -! !REVISION HISTORY: -! Created by David Lawrence, 4 May 2006 -! Revised by David Lawrence, 21 September 2007 -! Revised by David Lawrence, 14 October 2008 -! -!EOP -! -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: organicrd -! -! !INTERFACE: - subroutine organicrd(organic) -! -! !DESCRIPTION: -! Read the organic matter dataset. -! -! !USES: - use clm_varctl , only : fsurdat, single_column - use fileutils , only : getfil - use spmdMod , only : masterproc - use domainMod , only : ldomain - use ncdio_pio -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: organic(:,:) ! organic matter density (kg/m3) -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by David Lawrence, 4 May 2006 -! Revised by David Lawrence, 21 September 2007 -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: ni,nj,ns ! dimension sizes - logical :: isgrid2d ! true => file is 2d - logical :: readvar ! true => variable is on dataset - character(len=32) :: subname = 'organicrd' ! subroutine name -!----------------------------------------------------------------------- - - ! Initialize data to zero - no organic matter dataset - - organic(:,:) = 0._r8 - - ! Read data if file was specified in namelist - - if (fsurdat /= ' ') then - if (masterproc) then - write(iulog,*) 'Attempting to read organic matter data .....' - write(iulog,*) subname,trim(fsurdat) - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun() - end if - - call ncd_io(ncid=ncid, varname='ORGANIC', flag='read', data=organic, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('organicrd: errror reading ORGANIC') - - if ( masterproc )then - write(iulog,*) 'Successfully read organic matter data' - write(iulog,*) - end if - endif - - end subroutine organicrd - -end module organicFileMod diff --git a/src/main/paramUtilMod.F90 b/src/main/paramUtilMod.F90 deleted file mode 100644 index 96c95440e7..0000000000 --- a/src/main/paramUtilMod.F90 +++ /dev/null @@ -1,291 +0,0 @@ -module paramUtilMod - ! - ! module that deals with reading parameter files - ! - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - save - private - - interface readNcdio - module procedure readNcdioScalar - module procedure readNcdioArray1d - module procedure readNcdioArray2d - module procedure readNcdioScalarCheckDimensions - module procedure readNcdioArray1dCheckDimensions - module procedure readNcdioArray2dCheckDimensions - end interface - - public :: readNcdioScalar - public :: readNcdioArray1d - public :: readNcdioArray2d - public :: readNcdioScalarCheckDimensions - public :: readNcdioArray1dCheckDimensions - public :: readNcdioArray2dCheckDimensions - - public :: readNcdio - - private :: checkDimensions - -contains - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioScalar(ncid, varName, callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t,ncd_io - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - logical :: readv ! has variable been read in or not - - ! - ! netcdf read here - ! - - call ncd_io(varname=trim(varName),data=retVal, flag='read', ncid=ncid, readvar=readv) - - if ( .not. readv ) then - call endrun(trim(callingName)//trim(subname)//trim(errCode)//trim(varName)) - endif - - end subroutine readNcdioScalar - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray1d(ncid, varName, callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t,ncd_io - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal( 1: ) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - logical :: readv ! has variable been read in or not - - ! - ! netcdf read here - ! - - call ncd_io(varname=trim(varName),data=retVal, flag='read', ncid=ncid, readvar=readv) - - if ( .not. readv ) then - call endrun(trim(callingName)//trim(subname)//trim(errCode)//trim(varName)) - endif - - end subroutine readNcdioArray1d - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray2d(ncid, varName, callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t,ncd_io - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal( 1: , :) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - logical :: readv ! has variable been read in or not - - ! - ! netcdf read here - ! - - call ncd_io(varname=trim(varName),data=retVal, flag='read', ncid=ncid, readvar=readv) - - if ( .not. readv ) then - call endrun(trim(callingName)//trim(subname)//trim(errCode)//trim(varName)) - endif - - end subroutine readNcdioArray2d - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioScalarCheckDimensions(ncid, varName, expected_numDims, expected_dimNames, & - callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension name - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - - ! - ! netcdf read here - ! - call checkDimensions(ncid, varName, expected_numDims, expected_dimNames, subname) - call readNcdio(ncid, varName, callingName, retVal) - - end subroutine readNcdioScalarCheckDimensions - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray1dCheckDimensions(ncid, varName, expected_numDims, expected_dimNames, & - callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension name - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal( 1: ) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - ! - ! netcdf read here - ! - call checkDimensions(ncid, varName, expected_numDims, expected_dimNames, subname) - call readNcdio(ncid, varName, callingName, retVal) - - end subroutine readNcdioArray1dCheckDimensions - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine readNcdioArray2dCheckDimensions(ncid, varName, expected_numDims, expected_dimNames, & - callingName, retVal) - ! - ! read the netcdf file...generic, could be used for any parameter read - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension name - character(len=*), intent(in) :: callingName ! calling routine - real(r8), intent(inout) :: retVal(1:, : ) - - ! local vars - character(len=32) :: subname = 'readNcdio::' - character(len=100) :: errCode = ' - Error reading. Var: ' - ! - ! netcdf read here - ! - call checkDimensions(ncid, varName, expected_numDims, expected_dimNames, subname) - call readNcdio(ncid, varName, callingName, retVal) - - end subroutine readNcdioArray2dCheckDimensions - !----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! - !----------------------------------------------------------------------- - subroutine checkDimensions(ncid, varName, expected_numDims, expected_dimNames, callingName) - ! - ! Assert that the expected number of dimensions and dimension - ! names for a variable match the actual names on the file. - ! - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, var_desc_t, check_var, ncd_inqvdname, ncd_inqvdims - - implicit none - - ! arguments - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - character(len=*), intent(in) :: varName ! variable we are reading - integer, intent(in) :: expected_numDims ! number of expected dimensions on the variable - character(len=*), intent(in) :: expected_dimNames(:) ! expected dimension names - character(len=*), intent(in) :: callingName ! calling routine - integer :: error_num - - ! local vars - character(len=32) :: subname = 'checkDimensions::' - type(Var_desc_t) :: var_desc ! variable descriptor - logical :: readvar ! whether the variable was found - character(len=100) :: received_dimName - integer :: d, num_dims - character(len=256) :: msg - - call check_var(ncid, varName, var_desc, readvar) - if (readvar) then - call ncd_inqvdims(ncid, num_dims, var_desc) - if (num_dims /= expected_numDims) then - write(msg, *) trim(callingName)//trim(subname)//trim(varname)//":: expected number of dimensions = ", & - expected_numDims, " num dimensions received from file = ", num_dims - call endrun(msg) - end if - do d = 1, num_dims - received_dimName = '' - call ncd_inqvdname(ncid, varname=trim(varName), dimnum=d, dname=received_dimName, err_code=error_num) - if (trim(expected_dimNames(d)) /= trim(received_dimName)) then - write(msg, *) trim(callingName)//trim(subname)//trim(varname)//":: dimension ", d, & - " expected dimension name '"//trim(expected_dimNames(d))//& - "' dimension name received from file '"//trim(received_dimName)//"'." - call endrun(msg) - end if - end do - end if - - end subroutine checkDimensions - !----------------------------------------------------------------------- - -end module paramUtilMod diff --git a/src/main/pftconMod.F90 b/src/main/pftconMod.F90 deleted file mode 100644 index 0efa2053eb..0000000000 --- a/src/main/pftconMod.F90 +++ /dev/null @@ -1,1381 +0,0 @@ -module pftconMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing vegetation constants and method to - ! read and initialize vegetation (PFT) constants. - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_varpar , only : mxpft, numrad, ivis, inir, cft_lb, cft_ub - use clm_varctl , only : iulog, use_cndv, use_vertsoilc, use_crop - ! - ! !PUBLIC TYPES: - implicit none - ! - ! Vegetation type constants - ! - integer :: noveg ! value for not vegetated - integer :: ndllf_evr_tmp_tree ! value for Needleleaf evergreen temperate tree - integer :: ndllf_evr_brl_tree ! value for Needleleaf evergreen boreal tree - integer :: ndllf_dcd_brl_tree ! value for Needleleaf deciduous boreal tree - integer :: nbrdlf_evr_trp_tree ! value for Broadleaf evergreen tropical tree - integer :: nbrdlf_evr_tmp_tree ! value for Broadleaf evergreen temperate tree - integer :: nbrdlf_dcd_trp_tree ! value for Broadleaf deciduous tropical tree - integer :: nbrdlf_dcd_tmp_tree ! value for Broadleaf deciduous temperate tree - integer :: nbrdlf_dcd_brl_tree ! value for Broadleaf deciduous boreal tree - integer :: ntree ! value for last type of tree - integer :: nbrdlf_evr_shrub ! value for Broadleaf evergreen shrub - integer :: nbrdlf_dcd_tmp_shrub ! value for Broadleaf deciduous temperate shrub - integer :: nbrdlf_dcd_brl_shrub ! value for Broadleaf deciduous boreal shrub - integer :: nc3_arctic_grass ! value for C3 arctic grass - integer :: nc3_nonarctic_grass ! value for C3 non-arctic grass - integer :: nc4_grass ! value for C4 grass - integer :: npcropmin ! value for first crop - integer :: ntmp_corn ! value for temperate corn, rain fed (rf) - integer :: nirrig_tmp_corn ! value for temperate corn, irrigated (ir) - integer :: nswheat ! value for spring temperate cereal (rf) - integer :: nirrig_swheat ! value for spring temperate cereal (ir) - integer :: nwwheat ! value for winter temperate cereal (rf) - integer :: nirrig_wwheat ! value for winter temperate cereal (ir) - integer :: ntmp_soybean ! value for temperate soybean (rf) - integer :: nirrig_tmp_soybean ! value for temperate soybean (ir) - integer :: nbarley ! value for spring barley (rf) - integer :: nirrig_barley ! value for spring barley (ir) - integer :: nwbarley ! value for winter barley (rf) - integer :: nirrig_wbarley ! value for winter barley (ir) - integer :: nrye ! value for spring rye (rf) - integer :: nirrig_rye ! value for spring rye (ir) - integer :: nwrye ! value for winter rye (rf) - integer :: nirrig_wrye ! value for winter rye (ir) - integer :: ncassava ! ...and so on - integer :: nirrig_cassava - integer :: ncitrus - integer :: nirrig_citrus - integer :: ncocoa - integer :: nirrig_cocoa - integer :: ncoffee - integer :: nirrig_coffee - integer :: ncotton - integer :: nirrig_cotton - integer :: ndatepalm - integer :: nirrig_datepalm - integer :: nfoddergrass - integer :: nirrig_foddergrass - integer :: ngrapes - integer :: nirrig_grapes - integer :: ngroundnuts - integer :: nirrig_groundnuts - integer :: nmillet - integer :: nirrig_millet - integer :: noilpalm - integer :: nirrig_oilpalm - integer :: npotatoes - integer :: nirrig_potatoes - integer :: npulses - integer :: nirrig_pulses - integer :: nrapeseed - integer :: nirrig_rapeseed - integer :: nrice - integer :: nirrig_rice - integer :: nsorghum - integer :: nirrig_sorghum - integer :: nsugarbeet - integer :: nirrig_sugarbeet - integer :: nsugarcane - integer :: nirrig_sugarcane - integer :: nsunflower - integer :: nirrig_sunflower - integer :: nmiscanthus - integer :: nirrig_miscanthus - integer :: nswitchgrass - integer :: nirrig_switchgrass - integer :: ntrp_corn !value for tropical corn (rf) - integer :: nirrig_trp_corn !value for tropical corn (ir) - integer :: ntrp_soybean !value for tropical soybean (rf) - integer :: nirrig_trp_soybean !value for tropical soybean (ir) - integer :: npcropmax ! value for last prognostic crop in list - integer :: nc3crop ! value for generic crop (rf) - integer :: nc3irrig ! value for irrigated generic crop (ir) - - ! Number of crop functional types actually used in the model. This includes each CFT for - ! which is_pft_known_to_model is true. Note that this includes irrigated crops even if - ! irrigation is turned off in this run: it just excludes crop types that aren't handled - ! at all, as given by the mergetoclmpft list. - integer :: num_cfts_known_to_model - - ! !PUBLIC TYPES: - type, public :: pftcon_type - - integer , allocatable :: noveg (:) ! value for not vegetated - integer , allocatable :: tree (:) ! tree or not? - - real(r8), allocatable :: dleaf (:) ! characteristic leaf dimension (m) - real(r8), allocatable :: c3psn (:) ! photosynthetic pathway: 0. = c4, 1. = c3 - real(r8), allocatable :: xl (:) ! leaf/stem orientation index - real(r8), allocatable :: rhol (:,:) ! leaf reflectance: 1=vis, 2=nir - real(r8), allocatable :: rhos (:,:) ! stem reflectance: 1=vis, 2=nir - real(r8), allocatable :: taul (:,:) ! leaf transmittance: 1=vis, 2=nir - real(r8), allocatable :: taus (:,:) ! stem transmittance: 1=vis, 2=nir - real(r8), allocatable :: z0mr (:) ! ratio of momentum roughness length to canopy top height (-) - real(r8), allocatable :: displar (:) ! ratio of displacement height to canopy top height (-) - real(r8), allocatable :: roota_par (:) ! CLM rooting distribution parameter [1/m] - real(r8), allocatable :: rootb_par (:) ! CLM rooting distribution parameter [1/m] - real(r8), allocatable :: crop (:) ! crop pft: 0. = not crop, 1. = crop pft - real(r8), allocatable :: irrigated (:) ! irrigated pft: 0. = not, 1. = irrigated - real(r8), allocatable :: smpso (:) ! soil water potential at full stomatal opening (mm) - real(r8), allocatable :: smpsc (:) ! soil water potential at full stomatal closure (mm) - real(r8), allocatable :: fnitr (:) ! foliage nitrogen limitation factor (-) - - ! CN code - real(r8), allocatable :: dwood (:) ! wood density (gC/m3) - real(r8), allocatable :: slatop (:) ! SLA at top of canopy [m^2/gC] - real(r8), allocatable :: dsladlai (:) ! dSLA/dLAI [m^2/gC] - real(r8), allocatable :: leafcn (:) ! leaf C:N [gC/gN] - real(r8), allocatable :: flnr (:) ! fraction of leaf N in Rubisco [no units] - real(r8), allocatable :: woody (:) ! woody lifeform flag (0 or 1) - real(r8), allocatable :: lflitcn (:) ! leaf litter C:N (gC/gN) - real(r8), allocatable :: frootcn (:) ! fine root C:N (gC/gN) - real(r8), allocatable :: livewdcn (:) ! live wood (phloem and ray parenchyma) C:N (gC/gN) - real(r8), allocatable :: deadwdcn (:) ! dead wood (xylem and heartwood) C:N (gC/gN) - real(r8), allocatable :: grperc (:) ! growth respiration parameter - real(r8), allocatable :: grpnow (:) ! growth respiration parameter - real(r8), allocatable :: rootprof_beta (:,:) ! CLM rooting distribution parameter for C and N inputs [unitless] - real(r8), allocatable :: root_radius (:) ! root radius (m) - real(r8), allocatable :: root_density (:) ! root density (gC/m3) - - ! crop - - ! These arrays give information about the merge of unused crop types to the types CLM - ! knows about. mergetoclmpft(m) gives the crop type that CLM uses to simulate input - ! type m (and mergetoclmpft(m) == m implies that CLM simulates crop type m - ! directly). is_pft_known_to_model(m) is true if CLM simulates crop type m, and false - ! otherwise. Note that these do NOT relate to whether irrigation is on or off in a - ! given simulation - that is handled separately. - integer , allocatable :: mergetoclmpft (:) - logical , allocatable :: is_pft_known_to_model (:) - - real(r8), allocatable :: graincn (:) ! grain C:N (gC/gN) - real(r8), allocatable :: mxtmp (:) ! parameter used in accFlds - real(r8), allocatable :: baset (:) ! parameter used in accFlds - real(r8), allocatable :: declfact (:) ! parameter used in CNAllocation - real(r8), allocatable :: bfact (:) ! parameter used in CNAllocation - real(r8), allocatable :: aleaff (:) ! parameter used in CNAllocation - real(r8), allocatable :: arootf (:) ! parameter used in CNAllocation - real(r8), allocatable :: astemf (:) ! parameter used in CNAllocation - real(r8), allocatable :: arooti (:) ! parameter used in CNAllocation - real(r8), allocatable :: fleafi (:) ! parameter used in CNAllocation - real(r8), allocatable :: allconsl (:) ! parameter used in CNAllocation - real(r8), allocatable :: allconss (:) ! parameter used in CNAllocation - real(r8), allocatable :: ztopmx (:) ! parameter used in CNVegStructUpdate - real(r8), allocatable :: laimx (:) ! parameter used in CNVegStructUpdate - real(r8), allocatable :: gddmin (:) ! parameter used in CNPhenology - real(r8), allocatable :: hybgdd (:) ! parameter used in CNPhenology - real(r8), allocatable :: lfemerg (:) ! parameter used in CNPhenology - real(r8), allocatable :: grnfill (:) ! parameter used in CNPhenology - integer , allocatable :: mxmat (:) ! parameter used in CNPhenology - real(r8), allocatable :: mbbopt (:) ! Ball-Berry equation slope used in Photosynthesis - real(r8), allocatable :: medlynslope (:) ! Medlyn equation slope used in Photosynthesis - real(r8), allocatable :: medlynintercept(:) ! Medlyn equation intercept used in Photosynthesis - integer , allocatable :: mnNHplantdate (:) ! minimum planting date for NorthHemisphere (YYYYMMDD) - integer , allocatable :: mxNHplantdate (:) ! maximum planting date for NorthHemisphere (YYYYMMDD) - integer , allocatable :: mnSHplantdate (:) ! minimum planting date for SouthHemisphere (YYYYMMDD) - integer , allocatable :: mxSHplantdate (:) ! maximum planting date for SouthHemisphere (YYYYMMDD) - real(r8), allocatable :: planttemp (:) ! planting temperature used in CNPhenology (K) - real(r8), allocatable :: minplanttemp (:) ! mininum planting temperature used in CNPhenology (K) - real(r8), allocatable :: froot_leaf (:) ! allocation parameter: new fine root C per new leaf C (gC/gC) - real(r8), allocatable :: stem_leaf (:) ! allocation parameter: new stem c per new leaf C (gC/gC) - real(r8), allocatable :: croot_stem (:) ! allocation parameter: new coarse root C per new stem C (gC/gC) - real(r8), allocatable :: flivewd (:) ! allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - real(r8), allocatable :: fcur (:) ! allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - real(r8), allocatable :: fcurdv (:) ! alternate fcur for use with cndv - real(r8), allocatable :: lf_flab (:) ! leaf litter labile fraction - real(r8), allocatable :: lf_fcel (:) ! leaf litter cellulose fraction - real(r8), allocatable :: lf_flig (:) ! leaf litter lignin fraction - real(r8), allocatable :: fr_flab (:) ! fine root litter labile fraction - real(r8), allocatable :: fr_fcel (:) ! fine root litter cellulose fraction - real(r8), allocatable :: fr_flig (:) ! fine root litter lignin fraction - real(r8), allocatable :: leaf_long (:) ! leaf longevity (yrs) - real(r8), allocatable :: evergreen (:) ! binary flag for evergreen leaf habit (0 or 1) - real(r8), allocatable :: stress_decid (:) ! binary flag for stress-deciduous leaf habit (0 or 1) - real(r8), allocatable :: season_decid (:) ! binary flag for seasonal-deciduous leaf habit (0 or 1) - real(r8), allocatable :: pconv (:) ! proportion of deadstem to conversion flux - real(r8), allocatable :: pprod10 (:) ! proportion of deadstem to 10-yr product pool - real(r8), allocatable :: pprod100 (:) ! proportion of deadstem to 100-yr product pool - real(r8), allocatable :: pprodharv10 (:) ! harvest mortality proportion of deadstem to 10-yr pool - - ! pft paraemeters for fire code - real(r8), allocatable :: cc_leaf (:) - real(r8), allocatable :: cc_lstem (:) - real(r8), allocatable :: cc_dstem (:) - real(r8), allocatable :: cc_other (:) - real(r8), allocatable :: fm_leaf (:) - real(r8), allocatable :: fm_lstem (:) - real(r8), allocatable :: fm_dstem (:) - real(r8), allocatable :: fm_other (:) - real(r8), allocatable :: fm_root (:) - real(r8), allocatable :: fm_lroot (:) - real(r8), allocatable :: fm_droot (:) - real(r8), allocatable :: fsr_pft (:) - real(r8), allocatable :: fd_pft (:) - - ! pft parameters for crop code - real(r8), allocatable :: manunitro (:) ! manure - real(r8), allocatable :: fleafcn (:) ! C:N during grain fill; leaf - real(r8), allocatable :: ffrootcn (:) ! C:N during grain fill; fine root - real(r8), allocatable :: fstemcn (:) ! C:N during grain fill; stem - - real(r8), allocatable :: i_vcad (:) - real(r8), allocatable :: s_vcad (:) - real(r8), allocatable :: i_flnr (:) - real(r8), allocatable :: s_flnr (:) - - ! pft parameters for CNDV code (from LPJ subroutine pftparameters) - real(r8), allocatable :: pftpar20 (:) ! tree maximum crown area (m2) - real(r8), allocatable :: pftpar28 (:) ! min coldest monthly mean temperature - real(r8), allocatable :: pftpar29 (:) ! max coldest monthly mean temperature - real(r8), allocatable :: pftpar30 (:) ! min growing degree days (>= 5 deg C) - real(r8), allocatable :: pftpar31 (:) ! upper limit of temperature of the warmest month (twmax) - - ! pft parameters for FUN - real(r8), allocatable :: a_fix (:) ! A BNF parameter - real(r8), allocatable :: b_fix (:) ! A BNF parameter - real(r8), allocatable :: c_fix (:) ! A BNF parameter - real(r8), allocatable :: s_fix (:) ! A BNF parameter - real(r8), allocatable :: akc_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: akn_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: ekc_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: ekn_active (:) ! A mycorrhizal uptake parameter - real(r8), allocatable :: kc_nonmyc (:) ! A non-mycorrhizal uptake parameter - real(r8), allocatable :: kn_nonmyc (:) ! A non-mycorrhizal uptake parameter - real(r8), allocatable :: kr_resorb (:) ! A retrasnlcation parameter - real(r8), allocatable :: perecm (:) ! The fraction of ECM-associated PFT - real(r8), allocatable :: fun_cn_flex_a (:) ! Parameter a of FUN-flexcn link code (def 5) - real(r8), allocatable :: fun_cn_flex_b (:) ! Parameter b of FUN-flexcn link code (def 200) - real(r8), allocatable :: fun_cn_flex_c (:) ! Parameter b of FUN-flexcn link code (def 80) - real(r8), allocatable :: FUN_fracfixers(:) ! Fraction of C that can be used for fixation. - - - ! pft parameters for dynamic root code - real(r8), allocatable :: root_dmx(:) !maximum root depth - - contains - - procedure, public :: Init - procedure, public :: InitForTesting ! version of Init meant for unit testing - procedure, public :: Clean - procedure, private :: InitAllocate - procedure, private :: InitRead - procedure, private :: set_is_pft_known_to_model ! Set is_pft_known_to_model based on mergetoclmpft - procedure, private :: set_num_cfts_known_to_model ! Set the module-level variable, num_cfts_known_to_model - - end type pftcon_type - - type(pftcon_type), public :: pftcon ! pft type constants structure - - integer, parameter :: pftname_len = 40 ! max length of pftname - character(len=pftname_len) :: pftname(0:mxpft) ! PFT description - - real(r8), parameter :: reinickerp = 1.6_r8 ! parameter in allometric equation - real(r8), parameter :: dwood = 2.5e5_r8 ! cn wood density (gC/m3); lpj:2.0e5 - real(r8), parameter :: allom1 = 100.0_r8 ! parameters in - real(r8), parameter :: allom2 = 40.0_r8 ! ...allometric - real(r8), parameter :: allom3 = 0.5_r8 ! ...equations - real(r8), parameter :: allom1s = 250.0_r8 ! modified for shrubs by - real(r8), parameter :: allom2s = 8.0_r8 ! X.D.Z -! root radius, density from Bonan, GMD, 2014 - real(r8), parameter :: root_density = 0.31e06_r8 !(g biomass / m3 root) - real(r8), parameter :: root_radius = 0.29e-03_r8 !(m) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------ - subroutine Init(this) - - class(pftcon_type) :: this - - call this%InitAllocate() - call this%InitRead() - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitForTesting(this) - ! Version of Init meant for unit testing - ! - ! Allocate arrays, but don't try to read from file. - ! - ! Values can then be set by tests as needed - - class(pftcon_type) :: this - - call this%InitAllocate() - - end subroutine InitForTesting - - !----------------------------------------------------------------------- - subroutine InitAllocate (this) - ! - ! !DESCRIPTION: - ! Read and initialize vegetation (PFT) constants - ! - ! !USES: - use clm_varpar , only: nvariants - implicit none - ! - ! !ARGUMENTS: - class(pftcon_type) :: this - !----------------------------------------------------------------------- - - allocate( this%noveg (0:mxpft)); this%noveg (:) =huge(1) - allocate( this%tree (0:mxpft)); this%tree (:) =huge(1) - - allocate( this%dleaf (0:mxpft) ) - allocate( this%c3psn (0:mxpft) ) - allocate( this%xl (0:mxpft) ) - allocate( this%rhol (0:mxpft,numrad) ) - allocate( this%rhos (0:mxpft,numrad) ) - allocate( this%taul (0:mxpft,numrad) ) - allocate( this%taus (0:mxpft,numrad) ) - allocate( this%z0mr (0:mxpft) ) - allocate( this%displar (0:mxpft) ) - allocate( this%roota_par (0:mxpft) ) - allocate( this%rootb_par (0:mxpft) ) - allocate( this%crop (0:mxpft) ) - allocate( this%mergetoclmpft (0:mxpft) ) - allocate( this%is_pft_known_to_model (0:mxpft) ) - allocate( this%irrigated (0:mxpft) ) - allocate( this%smpso (0:mxpft) ) - allocate( this%smpsc (0:mxpft) ) - allocate( this%fnitr (0:mxpft) ) - allocate( this%slatop (0:mxpft) ) - allocate( this%dsladlai (0:mxpft) ) - allocate( this%leafcn (0:mxpft) ) - allocate( this%flnr (0:mxpft) ) - allocate( this%woody (0:mxpft) ) - allocate( this%lflitcn (0:mxpft) ) - allocate( this%frootcn (0:mxpft) ) - allocate( this%livewdcn (0:mxpft) ) - allocate( this%deadwdcn (0:mxpft) ) - allocate( this%grperc (0:mxpft) ) - allocate( this%grpnow (0:mxpft) ) - allocate( this%rootprof_beta (0:mxpft,nvariants) ) - allocate( this%graincn (0:mxpft) ) - allocate( this%mxtmp (0:mxpft) ) - allocate( this%baset (0:mxpft) ) - allocate( this%declfact (0:mxpft) ) - allocate( this%bfact (0:mxpft) ) - allocate( this%aleaff (0:mxpft) ) - allocate( this%arootf (0:mxpft) ) - allocate( this%astemf (0:mxpft) ) - allocate( this%arooti (0:mxpft) ) - allocate( this%fleafi (0:mxpft) ) - allocate( this%allconsl (0:mxpft) ) - allocate( this%allconss (0:mxpft) ) - allocate( this%ztopmx (0:mxpft) ) - allocate( this%laimx (0:mxpft) ) - allocate( this%gddmin (0:mxpft) ) - allocate( this%hybgdd (0:mxpft) ) - allocate( this%lfemerg (0:mxpft) ) - allocate( this%grnfill (0:mxpft) ) - allocate( this%mbbopt (0:mxpft) ) - allocate( this%medlynslope (0:mxpft) ) - allocate( this%medlynintercept(0:mxpft) ) - allocate( this%mxmat (0:mxpft) ) - allocate( this%mnNHplantdate (0:mxpft) ) - allocate( this%mxNHplantdate (0:mxpft) ) - allocate( this%mnSHplantdate (0:mxpft) ) - allocate( this%mxSHplantdate (0:mxpft) ) - allocate( this%planttemp (0:mxpft) ) - allocate( this%minplanttemp (0:mxpft) ) - allocate( this%froot_leaf (0:mxpft) ) - allocate( this%stem_leaf (0:mxpft) ) - allocate( this%croot_stem (0:mxpft) ) - allocate( this%flivewd (0:mxpft) ) - allocate( this%fcur (0:mxpft) ) - allocate( this%fcurdv (0:mxpft) ) - allocate( this%lf_flab (0:mxpft) ) - allocate( this%lf_fcel (0:mxpft) ) - allocate( this%lf_flig (0:mxpft) ) - allocate( this%fr_flab (0:mxpft) ) - allocate( this%fr_fcel (0:mxpft) ) - allocate( this%fr_flig (0:mxpft) ) - allocate( this%leaf_long (0:mxpft) ) - allocate( this%evergreen (0:mxpft) ) - allocate( this%stress_decid (0:mxpft) ) - allocate( this%season_decid (0:mxpft) ) - allocate( this%dwood (0:mxpft) ) - allocate( this%root_density (0:mxpft) ) - allocate( this%root_radius (0:mxpft) ) - allocate( this%pconv (0:mxpft) ) - allocate( this%pprod10 (0:mxpft) ) - allocate( this%pprod100 (0:mxpft) ) - allocate( this%pprodharv10 (0:mxpft) ) - allocate( this%cc_leaf (0:mxpft) ) - allocate( this%cc_lstem (0:mxpft) ) - allocate( this%cc_dstem (0:mxpft) ) - allocate( this%cc_other (0:mxpft) ) - allocate( this%fm_leaf (0:mxpft) ) - allocate( this%fm_lstem (0:mxpft) ) - allocate( this%fm_dstem (0:mxpft) ) - allocate( this%fm_other (0:mxpft) ) - allocate( this%fm_root (0:mxpft) ) - allocate( this%fm_lroot (0:mxpft) ) - allocate( this%fm_droot (0:mxpft) ) - allocate( this%fsr_pft (0:mxpft) ) - allocate( this%fd_pft (0:mxpft) ) - allocate( this%manunitro (0:mxpft) ) - allocate( this%fleafcn (0:mxpft) ) - allocate( this%ffrootcn (0:mxpft) ) - allocate( this%fstemcn (0:mxpft) ) - allocate( this%i_vcad (0:mxpft) ) - allocate( this%s_vcad (0:mxpft) ) - allocate( this%i_flnr (0:mxpft) ) - allocate( this%s_flnr (0:mxpft) ) - allocate( this%pftpar20 (0:mxpft) ) - allocate( this%pftpar28 (0:mxpft) ) - allocate( this%pftpar29 (0:mxpft) ) - allocate( this%pftpar30 (0:mxpft) ) - allocate( this%pftpar31 (0:mxpft) ) - allocate( this%a_fix (0:mxpft) ) - allocate( this%b_fix (0:mxpft) ) - allocate( this%c_fix (0:mxpft) ) - allocate( this%s_fix (0:mxpft) ) - allocate( this%akc_active (0:mxpft) ) - allocate( this%akn_active (0:mxpft) ) - allocate( this%ekc_active (0:mxpft) ) - allocate( this%ekn_active (0:mxpft) ) - allocate( this%kc_nonmyc (0:mxpft) ) - allocate( this%kn_nonmyc (0:mxpft) ) - allocate( this%kr_resorb (0:mxpft) ) - allocate( this%perecm (0:mxpft) ) - allocate( this%root_dmx (0:mxpft) ) - allocate( this%fun_cn_flex_a (0:mxpft) ) - allocate( this%fun_cn_flex_b (0:mxpft) ) - allocate( this%fun_cn_flex_c (0:mxpft) ) - allocate( this%FUN_fracfixers(0:mxpft) ) - - - end subroutine InitAllocate - - !----------------------------------------------------------------------- - subroutine InitRead(this) - ! - ! !DESCRIPTION: - ! Read and initialize vegetation (PFT) constants - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use fileutils , only : getfil - use ncdio_pio , only : ncd_io, ncd_pio_closefile, ncd_pio_openfile, file_desc_t - use ncdio_pio , only : ncd_inqdid, ncd_inqdlen - use clm_varctl , only : paramfile, use_fates, use_flexibleCN, use_dynroot - use spmdMod , only : masterproc - use CLMFatesParamInterfaceMod, only : FatesReadPFTs - ! - ! !ARGUMENTS: - class(pftcon_type) :: this - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - integer :: i,n,m ! loop indices - integer :: ier ! error code - type(file_desc_t) :: ncid ! pio netCDF file id - integer :: dimid ! netCDF dimension id - integer :: npft ! number of pfts on pft-physiology file - logical :: readv ! read variable in or not - character(len=32) :: subname = 'InitRead' ! subroutine name - character(len=pftname_len) :: expected_pftnames(0:mxpft) - character(len=512) :: msg - !----------------------------------------------------------------------- - ! - ! Expected PFT names: The names expected on the paramfile file and the order they are expected to be in. - ! NOTE: similar types are assumed to be together, first trees (ending with broadleaf_deciduous_boreal_tree - ! then shrubs, ending with broadleaf_deciduous_boreal_shrub, then grasses starting with c3_arctic_grass - ! and finally crops, ending with irrigated_tropical_soybean - ! DO NOT CHANGE THE ORDER -- WITHOUT MODIFYING OTHER PARTS OF THE CODE WHERE THE ORDER MATTERS! - - expected_pftnames( 0) = 'not_vegetated ' - expected_pftnames( 1) = 'needleleaf_evergreen_temperate_tree' - expected_pftnames( 2) = 'needleleaf_evergreen_boreal_tree ' - expected_pftnames( 3) = 'needleleaf_deciduous_boreal_tree ' - expected_pftnames( 4) = 'broadleaf_evergreen_tropical_tree ' - expected_pftnames( 5) = 'broadleaf_evergreen_temperate_tree ' - expected_pftnames( 6) = 'broadleaf_deciduous_tropical_tree ' - expected_pftnames( 7) = 'broadleaf_deciduous_temperate_tree ' - expected_pftnames( 8) = 'broadleaf_deciduous_boreal_tree ' - expected_pftnames( 9) = 'broadleaf_evergreen_shrub ' - expected_pftnames(10) = 'broadleaf_deciduous_temperate_shrub' - expected_pftnames(11) = 'broadleaf_deciduous_boreal_shrub ' - expected_pftnames(12) = 'c3_arctic_grass ' - expected_pftnames(13) = 'c3_non-arctic_grass ' - expected_pftnames(14) = 'c4_grass ' - expected_pftnames(15) = 'c3_crop ' - expected_pftnames(16) = 'c3_irrigated ' - expected_pftnames(17) = 'temperate_corn ' - expected_pftnames(18) = 'irrigated_temperate_corn ' - expected_pftnames(19) = 'spring_wheat ' - expected_pftnames(20) = 'irrigated_spring_wheat ' - expected_pftnames(21) = 'winter_wheat ' - expected_pftnames(22) = 'irrigated_winter_wheat ' - expected_pftnames(23) = 'temperate_soybean ' - expected_pftnames(24) = 'irrigated_temperate_soybean ' - expected_pftnames(25) = 'barley ' - expected_pftnames(26) = 'irrigated_barley ' - expected_pftnames(27) = 'winter_barley ' - expected_pftnames(28) = 'irrigated_winter_barley ' - expected_pftnames(29) = 'rye ' - expected_pftnames(30) = 'irrigated_rye ' - expected_pftnames(31) = 'winter_rye ' - expected_pftnames(32) = 'irrigated_winter_rye ' - expected_pftnames(33) = 'cassava ' - expected_pftnames(34) = 'irrigated_cassava ' - expected_pftnames(35) = 'citrus ' - expected_pftnames(36) = 'irrigated_citrus ' - expected_pftnames(37) = 'cocoa ' - expected_pftnames(38) = 'irrigated_cocoa ' - expected_pftnames(39) = 'coffee ' - expected_pftnames(40) = 'irrigated_coffee ' - expected_pftnames(41) = 'cotton ' - expected_pftnames(42) = 'irrigated_cotton ' - expected_pftnames(43) = 'datepalm ' - expected_pftnames(44) = 'irrigated_datepalm ' - expected_pftnames(45) = 'foddergrass ' - expected_pftnames(46) = 'irrigated_foddergrass ' - expected_pftnames(47) = 'grapes ' - expected_pftnames(48) = 'irrigated_grapes ' - expected_pftnames(49) = 'groundnuts ' - expected_pftnames(50) = 'irrigated_groundnuts ' - expected_pftnames(51) = 'millet ' - expected_pftnames(52) = 'irrigated_millet ' - expected_pftnames(53) = 'oilpalm ' - expected_pftnames(54) = 'irrigated_oilpalm ' - expected_pftnames(55) = 'potatoes ' - expected_pftnames(56) = 'irrigated_potatoes ' - expected_pftnames(57) = 'pulses ' - expected_pftnames(58) = 'irrigated_pulses ' - expected_pftnames(59) = 'rapeseed ' - expected_pftnames(60) = 'irrigated_rapeseed ' - expected_pftnames(61) = 'rice ' - expected_pftnames(62) = 'irrigated_rice ' - expected_pftnames(63) = 'sorghum ' - expected_pftnames(64) = 'irrigated_sorghum ' - expected_pftnames(65) = 'sugarbeet ' - expected_pftnames(66) = 'irrigated_sugarbeet ' - expected_pftnames(67) = 'sugarcane ' - expected_pftnames(68) = 'irrigated_sugarcane ' - expected_pftnames(69) = 'sunflower ' - expected_pftnames(70) = 'irrigated_sunflower ' - expected_pftnames(71) = 'miscanthus ' - expected_pftnames(72) = 'irrigated_miscanthus ' - expected_pftnames(73) = 'switchgrass ' - expected_pftnames(74) = 'irrigated_switchgrass ' - expected_pftnames(75) = 'tropical_corn ' - expected_pftnames(76) = 'irrigated_tropical_corn ' - expected_pftnames(77) = 'tropical_soybean ' - expected_pftnames(78) = 'irrigated_tropical_soybean ' - - ! Set specific vegetation type values - - if (masterproc) then - write(iulog,*) 'Attempting to read PFT physiological data .....' - end if - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdid(ncid, 'pft', dimid) - call ncd_inqdlen(ncid, dimid, npft) - - if (npft - 1 /= mxpft) then - ! NOTE(bja, 201503) need to subtract 1 because of indexing. - ! NOTE(bja, 201503) fail early because one of the io libs - ! throws a useless abort error message deep inside the stack - ! instead of returning readv so we can get a useful line - ! number. - write(msg, '(a, i4, a, i4, a)') "ERROR: The number of pfts in the input netcdf file (", & - npft, ") does not equal the expected number of pfts (", mxpft, "). " - call endrun(msg=trim(msg)//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io('pftname',pftname, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('z0mr', this%z0mr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('displar', this%displar, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('dleaf', this%dleaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('c3psn', this%c3psn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rholvis', this%rhol(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rholnir', this%rhol(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rhosvis', this%rhos(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rhosnir', this% rhos(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('taulvis', this%taul(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('taulnir', this%taul(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('tausvis', this%taus(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('tausnir', this%taus(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('xl', this%xl, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('roota_par', this%roota_par, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rootb_par', this%rootb_par, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('slatop', this%slatop, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('dsladlai', this%dsladlai, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('leafcn', this%leafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('flnr', this%flnr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('smpso', this%smpso, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('smpsc', this%smpsc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fnitr', this%fnitr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('woody', this%woody, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lflitcn', this%lflitcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('frootcn', this%frootcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('livewdcn', this%livewdcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('deadwdcn', this%deadwdcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('grperc', this%grperc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('grpnow', this%grpnow, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('froot_leaf', this%froot_leaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('stem_leaf', this%stem_leaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('croot_stem', this%croot_stem, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('flivewd', this%flivewd, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fcur', this%fcur, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fcurdv', this%fcurdv, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lf_flab', this%lf_flab, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lf_fcel', this%lf_fcel, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lf_flig', this%lf_flig, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fr_flab', this%fr_flab, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fr_fcel', this%fr_fcel, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fr_flig', this%fr_flig, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('leaf_long', this%leaf_long, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('evergreen', this%evergreen, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('stress_decid', this%stress_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('season_decid', this%season_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar20', this%pftpar20, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar28', this%pftpar28, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar29', this%pftpar29, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar30', this%pftpar30, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pftpar31', this%pftpar31, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('a_fix', this%a_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('b_fix', this%b_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('c_fix', this%c_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('s_fix', this%s_fix, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('akc_active', this%akc_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('akn_active', this%akn_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ekc_active', this%ekc_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ekn_active', this%ekn_active, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('kc_nonmyc', this%kc_nonmyc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('kn_nonmyc', this%kn_nonmyc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('kr_resorb', this%kr_resorb, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('perecm', this%perecm, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fun_cn_flex_a', this%fun_cn_flex_a, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fun_cn_flex_b', this%fun_cn_flex_b, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fun_cn_flex_c', this%fun_cn_flex_c, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('FUN_fracfixers', this%FUN_fracfixers, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('manunitro', this%manunitro, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fleafcn', this%fleafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ffrootcn', this%ffrootcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fstemcn', this%fstemcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('rootprof_beta', this%rootprof_beta, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pconv', this%pconv, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pprod10', this%pprod10, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pprodharv10', this%pprodharv10, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('pprod100', this%pprod100, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('graincn', this%graincn, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mxtmp', this%mxtmp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('baset', this%baset, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('declfact', this%declfact, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('bfact', this%bfact, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('aleaff', this%aleaff, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('arootf', this%arootf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('astemf', this%astemf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('arooti', this%arooti, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fleafi', this%fleafi, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('allconsl', this%allconsl, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('allconss', this%allconss, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('crop', this%crop, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mergetoclmpft', this%mergetoclmpft, 'read', ncid, readvar=readv) - if ( .not. readv ) then - call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_io('irrigated', this%irrigated, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('ztopmx', this%ztopmx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('laimx', this%laimx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('gddmin', this%gddmin, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('hybgdd', this%hybgdd, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('lfemerg', this%lfemerg, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('grnfill', this%grnfill, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mbbopt', this%mbbopt, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('medlynslope', this%medlynslope, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('medlynintercept', this%medlynintercept, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('mxmat', this%mxmat, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_leaf', this% cc_leaf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_lstem', this%cc_lstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_dstem', this%cc_dstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('cc_other', this%cc_other, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_leaf', this% fm_leaf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_lstem', this%fm_lstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_dstem', this%fm_dstem, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_other', this%fm_other, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_root', this% fm_root, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_lroot', this%fm_lroot, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fm_droot', this%fm_droot, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fsr_pft', this% fsr_pft, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('fd_pft', this% fd_pft, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('planting_temp', this%planttemp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('min_planting_temp', this%minplanttemp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('min_NH_planting_date', this%mnNHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('min_SH_planting_date', this%mnSHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('max_NH_planting_date', this%mxNHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('max_SH_planting_date', this%mxSHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - ! - ! Constants - ! - !MV (10-08-14) TODO is this right - used to be numpft - is it okay to set it to mxpft? - do m = 0,mxpft - this%dwood(m) = dwood - this%root_radius(m) = root_radius - this%root_density(m) = root_density - - if (m <= ntree) then - this%tree(m) = 1 - else - this%tree(m) = 0 - end if - end do - ! - ! clm 5 nitrogen variables - ! - if (use_flexibleCN) then - call ncd_io('i_vcad', this%i_vcad, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('s_vcad', this%s_vcad, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('i_flnr', this%i_flnr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - - call ncd_io('s_flnr', this%s_flnr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - end if - - ! - ! Dynamic Root variables for crops - ! - if ( use_crop .and. use_dynroot )then - call ncd_io('root_dmx', this%root_dmx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=' ERROR: error in reading in pft data'//errMsg(sourcefile, __LINE__)) - end if - - call ncd_pio_closefile(ncid) - - call FatesReadPFTs() - - do i = 0, mxpft - if (.not. use_fates)then - if ( trim(adjustl(pftname(i))) /= trim(expected_pftnames(i)) )then - write(iulog,*)'pftconrd: pftname is NOT what is expected, name = ', & - trim(pftname(i)), ', expected name = ', trim(expected_pftnames(i)) - call endrun(msg='pftconrd: bad name for pft on paramfile dataset'//errMsg(sourcefile, __LINE__)) - end if - end if - - if ( trim(pftname(i)) == 'not_vegetated' ) noveg = i - if ( trim(pftname(i)) == 'needleleaf_evergreen_temperate_tree' ) ndllf_evr_tmp_tree = i - if ( trim(pftname(i)) == 'needleleaf_evergreen_boreal_tree' ) ndllf_evr_brl_tree = i - if ( trim(pftname(i)) == 'needleleaf_deciduous_boreal_tree' ) ndllf_dcd_brl_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_tropical_tree' ) nbrdlf_evr_trp_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_temperate_tree' ) nbrdlf_evr_tmp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_tropical_tree' ) nbrdlf_dcd_trp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_temperate_tree' ) nbrdlf_dcd_tmp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_boreal_tree' ) nbrdlf_dcd_brl_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_shrub' ) nbrdlf_evr_shrub = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_temperate_shrub' ) nbrdlf_dcd_tmp_shrub = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_boreal_shrub' ) nbrdlf_dcd_brl_shrub = i - if ( trim(pftname(i)) == 'c3_arctic_grass' ) nc3_arctic_grass = i - if ( trim(pftname(i)) == 'c3_non-arctic_grass' ) nc3_nonarctic_grass = i - if ( trim(pftname(i)) == 'c4_grass' ) nc4_grass = i - if ( trim(pftname(i)) == 'c3_crop' ) nc3crop = i - if ( trim(pftname(i)) == 'c3_irrigated' ) nc3irrig = i - if ( trim(pftname(i)) == 'temperate_corn' ) ntmp_corn = i - if ( trim(pftname(i)) == 'irrigated_temperate_corn' ) nirrig_tmp_corn = i - if ( trim(pftname(i)) == 'spring_wheat' ) nswheat = i - if ( trim(pftname(i)) == 'irrigated_spring_wheat' ) nirrig_swheat = i - if ( trim(pftname(i)) == 'winter_wheat' ) nwwheat = i - if ( trim(pftname(i)) == 'irrigated_winter_wheat' ) nirrig_wwheat = i - if ( trim(pftname(i)) == 'temperate_soybean' ) ntmp_soybean = i - if ( trim(pftname(i)) == 'irrigated_temperate_soybean' ) nirrig_tmp_soybean = i - if ( trim(pftname(i)) == 'barley' ) nbarley = i - if ( trim(pftname(i)) == 'irrigated_barley' ) nirrig_barley = i - if ( trim(pftname(i)) == 'winter_barley' ) nwbarley = i - if ( trim(pftname(i)) == 'irrigated_winter_barley' ) nirrig_wbarley = i - if ( trim(pftname(i)) == 'rye' ) nrye = i - if ( trim(pftname(i)) == 'irrigated_rye' ) nirrig_rye = i - if ( trim(pftname(i)) == 'winter_rye' ) nwrye = i - if ( trim(pftname(i)) == 'irrigated_winter_rye' ) nirrig_wrye = i - if ( trim(pftname(i)) == 'cassava' ) ncassava = i - if ( trim(pftname(i)) == 'irrigated_cassava' ) nirrig_cassava = i - if ( trim(pftname(i)) == 'citrus' ) ncitrus = i - if ( trim(pftname(i)) == 'irrigated_citrus' ) nirrig_citrus = i - if ( trim(pftname(i)) == 'cocoa' ) ncocoa = i - if ( trim(pftname(i)) == 'irrigated_cocoa' ) nirrig_cocoa = i - if ( trim(pftname(i)) == 'coffee' ) ncoffee = i - if ( trim(pftname(i)) == 'irrigated_coffee' ) nirrig_coffee = i - if ( trim(pftname(i)) == 'cotton' ) ncotton = i - if ( trim(pftname(i)) == 'irrigated_cotton' ) nirrig_cotton = i - if ( trim(pftname(i)) == 'datepalm' ) ndatepalm = i - if ( trim(pftname(i)) == 'irrigated_datepalm' ) nirrig_datepalm = i - if ( trim(pftname(i)) == 'foddergrass' ) nfoddergrass = i - if ( trim(pftname(i)) == 'irrigated_foddergrass' ) nirrig_foddergrass = i - if ( trim(pftname(i)) == 'grapes' ) ngrapes = i - if ( trim(pftname(i)) == 'irrigated_grapes' ) nirrig_grapes = i - if ( trim(pftname(i)) == 'groundnuts' ) ngroundnuts = i - if ( trim(pftname(i)) == 'irrigated_groundnuts' ) nirrig_groundnuts = i - if ( trim(pftname(i)) == 'millet' ) nmillet = i - if ( trim(pftname(i)) == 'irrigated_millet' ) nirrig_millet = i - if ( trim(pftname(i)) == 'oilpalm' ) noilpalm = i - if ( trim(pftname(i)) == 'irrigated_oilpalm' ) nirrig_oilpalm = i - if ( trim(pftname(i)) == 'potatoes' ) npotatoes = i - if ( trim(pftname(i)) == 'irrigated_potatoes' ) nirrig_potatoes = i - if ( trim(pftname(i)) == 'pulses' ) npulses = i - if ( trim(pftname(i)) == 'irrigated_pulses' ) nirrig_pulses = i - if ( trim(pftname(i)) == 'rapeseed' ) nrapeseed = i - if ( trim(pftname(i)) == 'irrigated_rapeseed' ) nirrig_rapeseed = i - if ( trim(pftname(i)) == 'rice' ) nrice = i - if ( trim(pftname(i)) == 'irrigated_rice' ) nirrig_rice = i - if ( trim(pftname(i)) == 'sorghum' ) nsorghum = i - if ( trim(pftname(i)) == 'irrigated_sorghum' ) nirrig_sorghum = i - if ( trim(pftname(i)) == 'sugarbeet' ) nsugarbeet = i - if ( trim(pftname(i)) == 'irrigated_sugarbeet' ) nirrig_sugarbeet = i - if ( trim(pftname(i)) == 'sugarcane' ) nsugarcane = i - if ( trim(pftname(i)) == 'irrigated_sugarcane' ) nirrig_sugarcane = i - if ( trim(pftname(i)) == 'sunflower' ) nsunflower = i - if ( trim(pftname(i)) == 'irrigated_sunflower' ) nirrig_sunflower = i - if ( trim(pftname(i)) == 'miscanthus' ) nmiscanthus = i - if ( trim(pftname(i)) == 'irrigated_miscanthus' ) nirrig_miscanthus = i - if ( trim(pftname(i)) == 'switchgrass' ) nswitchgrass = i - if ( trim(pftname(i)) == 'irrigated_switchgrass' ) nirrig_switchgrass = i - if ( trim(pftname(i)) == 'tropical_corn' ) ntrp_corn = i - if ( trim(pftname(i)) == 'irrigated_tropical_corn' ) nirrig_trp_corn = i - if ( trim(pftname(i)) == 'tropical_soybean' ) ntrp_soybean = i - if ( trim(pftname(i)) == 'irrigated_tropical_soybean' ) nirrig_trp_soybean = i - end do - - ntree = nbrdlf_dcd_brl_tree ! value for last type of tree - npcropmin = ntmp_corn ! first prognostic crop - npcropmax = mxpft ! last prognostic crop in list - - call this%set_is_pft_known_to_model() - call this%set_num_cfts_known_to_model() - - if (use_cndv) then - this%fcur(:) = this%fcurdv(:) - end if - ! - ! Do some error checking, but not if fates is on. - ! - ! FIX(SPM,032414) double check if some of these should be on... - - if( .not. use_fates ) then - if ( npcropmax /= mxpft )then - call endrun(msg=' ERROR: npcropmax is NOT the last value'//errMsg(sourcefile, __LINE__)) - end if - do i = 0, mxpft - if ( this%irrigated(i) == 1.0_r8 .and. & - (i == nc3irrig .or. & - i == nirrig_tmp_corn .or. & - i == nirrig_swheat .or. i == nirrig_wwheat .or. & - i == nirrig_tmp_soybean .or. & - i == nirrig_barley .or. i == nirrig_wbarley .or. & - i == nirrig_rye .or. i == nirrig_wrye .or. & - i == nirrig_cassava .or. & - i == nirrig_citrus .or. & - i == nirrig_cocoa .or. i == nirrig_coffee .or. & - i == nirrig_cotton .or. & - i == nirrig_datepalm .or. & - i == nirrig_foddergrass .or. & - i == nirrig_grapes .or. i == nirrig_groundnuts .or. & - i == nirrig_millet .or. & - i == nirrig_oilpalm .or. & - i == nirrig_potatoes .or. i == nirrig_pulses .or. & - i == nirrig_rapeseed .or. i == nirrig_rice .or. & - i == nirrig_sorghum .or. & - i == nirrig_sugarbeet .or. i == nirrig_sugarcane .or. & - i == nirrig_sunflower .or. & - i == nirrig_miscanthus .or. i == nirrig_switchgrass .or. & - i == nirrig_trp_corn .or. & - i == nirrig_trp_soybean) )then - ! correct - else if ( this%irrigated(i) == 0.0_r8 )then - ! correct - else - call endrun(msg=' ERROR: irrigated has wrong values'//errMsg(sourcefile, __LINE__)) - end if - if ( this%crop(i) == 1.0_r8 .and. (i >= nc3crop .and. i <= npcropmax) )then - ! correct - else if ( this%crop(i) == 0.0_r8 )then - ! correct - else - call endrun(msg=' ERROR: crop has wrong values'//errMsg(sourcefile, __LINE__)) - end if - if ( (i /= noveg) .and. (i < npcropmin) .and. & - abs(this%pconv(i) + this%pprod10(i) + this%pprod100(i) - 1.0_r8) > 1.e-7_r8 )then - call endrun(msg=' ERROR: pconv+pprod10+pprod100 do NOT sum to one.'//errMsg(sourcefile, __LINE__)) - end if - if ( this%pprodharv10(i) > 1.0_r8 .or. this%pprodharv10(i) < 0.0_r8 )then - call endrun(msg=' ERROR: pprodharv10 outside of range.'//errMsg(sourcefile, __LINE__)) - end if - end do - end if - - if (masterproc) then - write(iulog,*) 'Successfully read PFT physiological data' - write(iulog,*) - end if - - end subroutine InitRead - - !----------------------------------------------------------------------- - subroutine set_is_pft_known_to_model(this) - ! - ! !DESCRIPTION: - ! Set is_pft_known_to_model based on mergetoclmpft - ! - ! !USES: - ! - ! !ARGUMENTS: - class(pftcon_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - integer :: m, merge_type - - character(len=*), parameter :: subname = 'set_is_pft_known_to_model' - !----------------------------------------------------------------------- - - this%is_pft_known_to_model(:) = .false. - - ! NOTE(wjs, 2015-10-04) Currently, type 0 has mergetoclmpft = _FillValue in the file, - ! so we can't handle it in the general loop below. But CLM always uses type 0, so - ! handle it specially here. - this%is_pft_known_to_model(0) = .true. - - ! NOTE(wjs, 2015-10-04) Currently, mergetoclmpft is only used for crop types. - ! However, we handle it more generally here (treating ALL pft types), in case its use - ! is ever extended to work with non-crop types as well. - do m = 1, mxpft - merge_type = this%mergetoclmpft(m) - this%is_pft_known_to_model(merge_type) = .true. - end do - - end subroutine set_is_pft_known_to_model - - !----------------------------------------------------------------------- - subroutine set_num_cfts_known_to_model(this) - ! - ! !DESCRIPTION: - ! Set the module-level variable, num_cfts_known_to_model - ! - ! !USES: - ! - ! !ARGUMENTS: - class(pftcon_type), intent(in) :: this - ! - ! !LOCAL VARIABLES: - integer :: m - - character(len=*), parameter :: subname = 'set_num_cfts_known_to_model' - !----------------------------------------------------------------------- - - num_cfts_known_to_model = 0 - do m = cft_lb, cft_ub - if (this%is_pft_known_to_model(m)) then - num_cfts_known_to_model = num_cfts_known_to_model + 1 - end if - end do - - end subroutine set_num_cfts_known_to_model - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! - ! !DESCRIPTION: - ! Deallocate memory - ! - ! !USES: - ! - ! !ARGUMENTS: - class(pftcon_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate( this%noveg) - deallocate( this%tree) - - deallocate( this%dleaf) - deallocate( this%c3psn) - deallocate( this%xl) - deallocate( this%rhol) - deallocate( this%rhos) - deallocate( this%taul) - deallocate( this%taus) - deallocate( this%z0mr) - deallocate( this%displar) - deallocate( this%roota_par) - deallocate( this%rootb_par) - deallocate( this%crop) - deallocate( this%mergetoclmpft) - deallocate( this%is_pft_known_to_model) - deallocate( this%irrigated) - deallocate( this%smpso) - deallocate( this%smpsc) - deallocate( this%fnitr) - deallocate( this%slatop) - deallocate( this%dsladlai) - deallocate( this%leafcn) - deallocate( this%flnr) - deallocate( this%woody) - deallocate( this%lflitcn) - deallocate( this%frootcn) - deallocate( this%livewdcn) - deallocate( this%deadwdcn) - deallocate( this%grperc) - deallocate( this%grpnow) - deallocate( this%rootprof_beta) - deallocate( this%graincn) - deallocate( this%mxtmp) - deallocate( this%baset) - deallocate( this%declfact) - deallocate( this%bfact) - deallocate( this%aleaff) - deallocate( this%arootf) - deallocate( this%astemf) - deallocate( this%arooti) - deallocate( this%fleafi) - deallocate( this%allconsl) - deallocate( this%allconss) - deallocate( this%ztopmx) - deallocate( this%laimx) - deallocate( this%gddmin) - deallocate( this%hybgdd) - deallocate( this%lfemerg) - deallocate( this%grnfill) - deallocate( this%mbbopt) - deallocate( this%medlynslope) - deallocate( this%medlynintercept) - deallocate( this%mxmat) - deallocate( this%mnNHplantdate) - deallocate( this%mxNHplantdate) - deallocate( this%mnSHplantdate) - deallocate( this%mxSHplantdate) - deallocate( this%planttemp) - deallocate( this%minplanttemp) - deallocate( this%froot_leaf) - deallocate( this%stem_leaf) - deallocate( this%croot_stem) - deallocate( this%flivewd) - deallocate( this%fcur) - deallocate( this%fcurdv) - deallocate( this%lf_flab) - deallocate( this%lf_fcel) - deallocate( this%lf_flig) - deallocate( this%fr_flab) - deallocate( this%fr_fcel) - deallocate( this%fr_flig) - deallocate( this%leaf_long) - deallocate( this%evergreen) - deallocate( this%stress_decid) - deallocate( this%season_decid) - deallocate( this%dwood) - deallocate( this%root_density) - deallocate( this%root_radius) - deallocate( this%pconv) - deallocate( this%pprod10) - deallocate( this%pprod100) - deallocate( this%pprodharv10) - deallocate( this%cc_leaf) - deallocate( this%cc_lstem) - deallocate( this%cc_dstem) - deallocate( this%cc_other) - deallocate( this%fm_leaf) - deallocate( this%fm_lstem) - deallocate( this%fm_dstem) - deallocate( this%fm_other) - deallocate( this%fm_root) - deallocate( this%fm_lroot) - deallocate( this%fm_droot) - deallocate( this%fsr_pft) - deallocate( this%fd_pft) - deallocate( this%manunitro) - deallocate( this%fleafcn) - deallocate( this%ffrootcn) - deallocate( this%fstemcn) - deallocate( this%i_vcad) - deallocate( this%s_vcad) - deallocate( this%i_flnr) - deallocate( this%s_flnr) - deallocate( this%pftpar20) - deallocate( this%pftpar28) - deallocate( this%pftpar29) - deallocate( this%pftpar30) - deallocate( this%pftpar31) - deallocate( this%a_fix) - deallocate( this%b_fix) - deallocate( this%c_fix) - deallocate( this%s_fix) - deallocate( this%akc_active) - deallocate( this%akn_active) - deallocate( this%ekc_active) - deallocate( this%ekn_active) - deallocate( this%kc_nonmyc) - deallocate( this%kn_nonmyc) - deallocate( this%kr_resorb) - deallocate( this%perecm) - deallocate( this%root_dmx) - deallocate( this%fun_cn_flex_a) - deallocate( this%fun_cn_flex_b) - deallocate( this%fun_cn_flex_c) - deallocate( this%FUN_fracfixers) - - end subroutine Clean - -end module pftconMod - diff --git a/src/main/readParamsMod.F90 b/src/main/readParamsMod.F90 deleted file mode 100644 index 7fbea89531..0000000000 --- a/src/main/readParamsMod.F90 +++ /dev/null @@ -1,107 +0,0 @@ -module readParamsMod - - !----------------------------------------------------------------------- - ! - ! Read parameters - ! module used to read parameters for individual modules and/or for some - ! well defined functionality (eg. ED). - ! - ! ! USES: - use clm_varctl , only : paramfile, iulog, use_fates, use_cn - use spmdMod , only : masterproc - use fileutils , only : getfil - use ncdio_pio , only : ncd_pio_closefile, ncd_pio_openfile - use ncdio_pio , only : file_desc_t , ncd_inqdid, ncd_inqdlen - - implicit none - private - ! - public :: readParameters - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParameters (nutrient_competition_method, photosyns_inst) - ! - ! ! USES: - use CNSharedParamsMod , only : CNParamsReadShared - use CNGapMortalityMod , only : readCNGapMortParams => readParams - use CNMRespMod , only : readCNMRespParams => readParams - use CNFUNMod , only : readCNFUNParams => readParams - use CNPhenologyMod , only : readCNPhenolParams => readParams - use SoilBiogeochemCompetitionMod , only : readSoilBiogeochemCompetitionParams => readParams - use SoilBiogeochemNLeachingMod , only : readSoilBiogeochemNLeachingParams => readParams - use SoilBiogeochemNitrifDenitrifMod , only : readSoilBiogeochemNitrifDenitrifParams => readParams - use SoilBiogeochemLittVertTranspMod , only : readSoilBiogeochemLittVertTranspParams => readParams - use SoilBiogeochemPotentialMod , only : readSoilBiogeochemPotentialParams => readParams - use SoilBiogeochemDecompMod , only : readSoilBiogeochemDecompParams => readParams - use SoilBiogeochemDecompCascadeBGCMod , only : readSoilBiogeochemDecompBgcParams => readParams - use SoilBiogeochemDecompCascadeCNMod , only : readSoilBiogeochemDecompCnParams => readParams - use ch4Mod , only : readCH4Params => readParams - use NutrientCompetitionMethodMod , only : nutrient_competition_method_type - use clm_varctl, only : NLFilename_in - use PhotosynthesisMod , only : photosyns_type - ! - ! !ARGUMENTS: - type(photosyns_type) , intent(in) :: photosyns_inst - class(nutrient_competition_method_type), intent(in) :: nutrient_competition_method - ! - ! !LOCAL VARIABLES: - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! pio netCDF file id - integer :: dimid ! netCDF dimension id - integer :: npft ! number of pfts on pft-physiology file - character(len=32) :: subname = 'readParameters' - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'paramMod.F90::'//trim(subname)//' :: reading CLM '//' parameters ' - end if - - call getfil (paramfile, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdid(ncid,'pft',dimid) - call ncd_inqdlen(ncid,dimid,npft) - - ! - ! Above ground biogeochemistry... - ! - if (use_cn) then - call nutrient_competition_method%readParams(ncid) - call readCNGapMortParams(ncid) - call readCNMRespParams(ncid) - call readCNFUNParams(ncid) - call readCNPhenolParams(ncid) - end if - - ! - ! Soil biogeochemistry... - ! - if (use_cn .or. use_fates) then - call readSoilBiogeochemCompetitionParams(ncid) - call readSoilBiogeochemDecompBgcParams(ncid) - call readSoilBiogeochemDecompCnParams(ncid) - call readSoilBiogeochemDecompParams(ncid) - call readSoilBiogeochemLittVertTranspParams(ncid) - call readSoilBiogeochemNitrifDenitrifParams(ncid) - call readSoilBiogeochemNLeachingParams(ncid) - call readSoilBiogeochemPotentialParams(ncid) - call CNParamsReadShared(ncid, NLFilename_in) ! this is called CN params but really is for the soil biogeochem parameters - - call readCH4Params (ncid) - end if - - ! - ! Biogeophysics - ! - call photosyns_inst%ReadParams( ncid ) - - - ! - call ncd_pio_closefile(ncid) - - end subroutine readParameters - -end module readParamsMod diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 deleted file mode 100644 index c352572d02..0000000000 --- a/src/main/restFileMod.F90 +++ /dev/null @@ -1,933 +0,0 @@ -module restFileMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Reads from or writes to/ the CLM restart file. - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type, get_proc_clumps, get_clump_bounds - use decompMod , only : BOUNDS_LEVEL_PROC - use spmdMod , only : masterproc, mpicom - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_time_manager , only : timemgr_restart_io, get_nstep - use subgridRestMod , only : subgridRestWrite, subgridRestRead, subgridRest_read_cleanup - use accumulMod , only : accumulRest - use clm_instMod , only : clm_instRest - use histFileMod , only : hist_restart_ncd - use clm_varctl , only : iulog, use_fates, use_hydrstress - use clm_varctl , only : create_crop_landunit, irrigate - use clm_varcon , only : nameg, namel, namec, namep, nameCohort - use ncdio_pio , only : file_desc_t, ncd_pio_createfile, ncd_pio_openfile, ncd_global - use ncdio_pio , only : ncd_pio_closefile, ncd_defdim, ncd_putatt, ncd_enddef, check_dim - use ncdio_pio , only : check_att, ncd_getatt - use glcBehaviorMod , only : glc_behavior_type - use reweightMod , only : reweight_wrapup - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: restFile_read - public :: restFile_write - public :: restFile_open - public :: restFile_close - public :: restFile_getfile - public :: restFile_filename ! Sets restart filename - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: restFile_set_derived ! On a read, set variables derived from others - private :: restFile_read_pfile - private :: restFile_write_pfile ! Writes restart pointer file - private :: restFile_closeRestart ! Close restart file and write restart pointer file - private :: restFile_dimset - private :: restFile_add_flag_metadata ! Add global metadata for some logical flag - private :: restFile_add_ilun_metadata ! Add global metadata defining landunit types - private :: restFile_add_icol_metadata ! Add global metadata defining column types - private :: restFile_add_ipft_metadata ! Add global metadata defining patch types - private :: restFile_dimcheck - private :: restFile_enddef - private :: restFile_check_consistency ! Perform consistency checks on the restart file - private :: restFile_read_consistency_nl ! Read namelist associated with consistency checks - private :: restFile_check_year ! Check consistency of year on the restart file - ! - ! !PRIVATE TYPES: - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine restFile_write( bounds, file, rdate, noptr) - ! - ! !DESCRIPTION: - ! Define/write CLM restart file. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - character(len=*) , intent(in) :: file ! output netcdf restart file - character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name - logical , intent(in), optional :: noptr ! if should NOT write to the restart pointer file - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - integer :: i ! index - logical :: ptrfile ! write out the restart pointer file - !----------------------------------------------------------------------- - - if ( present(noptr) )then - ptrfile = .not. noptr - else - ptrfile = .true. - end if - - ! Open file - - call restFile_open( flag='write', file=file, ncid=ncid ) - - ! Define dimensions and variables - - call restFile_dimset ( ncid ) - - call timemgr_restart_io(ncid, flag='define') - - call subgridRestWrite(bounds, ncid, flag='define' ) - - call accumulRest( ncid, flag='define' ) - - call clm_instRest(bounds, ncid, flag='define') - - if (present(rdate)) then - call hist_restart_ncd (bounds, ncid, flag='define', rdate=rdate ) - end if - - call restFile_enddef( ncid ) - - ! Write variables - - call timemgr_restart_io( ncid, flag='write' ) - - call subgridRestWrite(bounds, ncid, flag='write' ) - - call accumulRest( ncid, flag='write' ) - - call clm_instRest(bounds, ncid, flag='write') - - call hist_restart_ncd (bounds, ncid, flag='write' ) - - ! Close file - - call restFile_close( ncid ) - call restFile_closeRestart( file ) - - ! Write restart pointer file - - if ( ptrfile ) call restFile_write_pfile( file ) - - ! Write out diagnostic info - - if (masterproc) then - write(iulog,*) 'Successfully wrote out restart data at nstep = ',get_nstep() - write(iulog,'(72a1)') ("-",i=1,60) - end if - - end subroutine restFile_write - - !----------------------------------------------------------------------- - subroutine restFile_read( bounds_proc, file, glc_behavior ) - ! - ! !DESCRIPTION: - ! Read a CLM restart file. - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds_proc ! processor-level bounds - character(len=*) , intent(in) :: file ! output netcdf restart file - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - integer :: i ! index - integer :: nclumps ! number of clumps on this processor - integer :: nc ! clump index - type(bounds_type) :: bounds_clump - - character(len=*), parameter :: subname = 'restFile_read' - !----------------------------------------------------------------------- - - ! The provided bounds need to be proc-level bounds. This is in part because of logic - ! below that divides this into clump-level bounds for the sake of reweight_wrapup. - ! But it *MAY* also be necessary to have proc-level bounds for these i/o routines. - SHR_ASSERT(bounds_proc%level == BOUNDS_LEVEL_PROC, subname // ': argument must be PROC-level bounds') - - ! Open file - - call restFile_open( flag='read', file=file, ncid=ncid ) - - ! Read file - - call restFile_dimcheck( ncid ) - - call subgridRestRead(bounds_proc, ncid) - - ! Now that we have updated subgrid information, update the filters, active flags, - ! etc. accordingly. We do these updates as soon as possible so that the updated - ! filters and active flags are available to other restart routines - e.g., for the - ! sake of subgridAveMod calls like c2g. - ! - ! The reweight_wrapup call needs to be done inside a clump loop, so we set that up - ! here. - nclumps = get_proc_clumps() - !$OMP PARALLEL DO PRIVATE (nc, bounds_clump) - do nc = 1, nclumps - call get_clump_bounds(nc, bounds_clump) - call reweight_wrapup(bounds_clump, glc_behavior) - end do - !$OMP END PARALLEL DO - - call accumulRest( ncid, flag='read' ) - - call clm_instRest( bounds_proc, ncid, flag='read' ) - - call restFile_set_derived(bounds_proc, glc_behavior) - - call hist_restart_ncd (bounds_proc, ncid, flag='read' ) - - ! Do error checking on file - - call restFile_check_consistency(bounds_proc, ncid) - - ! Close file - - call subgridRest_read_cleanup - call restFile_close( ncid ) - - ! Write out diagnostic info - - if (masterproc) then - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) 'Successfully read restart data for restart run' - write(iulog,*) - end if - - end subroutine restFile_read - - !----------------------------------------------------------------------- - subroutine restFile_getfile( file, path ) - ! - ! !DESCRIPTION: - ! Determine and obtain netcdf restart file - ! - ! !USES: - use clm_varctl, only : caseid, nrevsn, nsrest, brnch_retain_casename - use clm_varctl, only : nsrContinue, nsrBranch - use fileutils , only : getfil - ! - ! !ARGUMENTS: - character(len=*), intent(out) :: file ! name of netcdf restart file - character(len=*), intent(out) :: path ! full pathname of netcdf restart file - ! - ! !LOCAL VARIABLES: - integer :: status ! return status - integer :: length ! temporary - character(len=256) :: ftest,ctest ! temporaries - !----------------------------------------------------------------------- - - ! Continue run: - ! Restart file pathname is read restart pointer file - - if (nsrest==nsrContinue) then - call restFile_read_pfile( path ) - call getfil( path, file, 0 ) - end if - - ! Branch run: - ! Restart file pathname is obtained from namelist "nrevsn" - ! Check case name consistency (case name must be different for branch run, - ! unless namelist specification states otherwise) - - if (nsrest==nsrBranch) then - length = len_trim(nrevsn) - if (nrevsn(length-2:length) == '.nc') then - path = trim(nrevsn) - else - path = trim(nrevsn) // '.nc' - end if - call getfil( path, file, 0 ) - - ! tcraig, adding xx. and .clm2 makes this more robust - ctest = 'xx.'//trim(caseid)//'.clm2' - ftest = 'xx.'//trim(file) - status = index(trim(ftest),trim(ctest)) - if (status /= 0 .and. .not.(brnch_retain_casename)) then - if (masterproc) then - write(iulog,*) 'Must change case name on branch run if ',& - 'brnch_retain_casename namelist is not set' - write(iulog,*) 'previous case filename= ',trim(file),& - ' current case = ',trim(caseid), & - ' ctest = ',trim(ctest), & - ' ftest = ',trim(ftest) - end if - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine restFile_getfile - - !----------------------------------------------------------------------- - subroutine restFile_set_derived(bounds, glc_behavior) - ! - ! !DESCRIPTION: - ! Upon a restart read, set variables that are not on the restart file, but can be - ! derived from variables that are on the restart file. - ! - ! This should be called after variables are read from the restart file. - ! - ! !USES: - ! - ! NOTE(wjs, 2016-04-05) Is it an architectural violation to use topo_inst directly - ! here? I can't see a good way around it. - use clm_instMod, only : topo_inst - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'restFile_set_derived' - !----------------------------------------------------------------------- - - call glc_behavior%update_glc_classes(bounds, topo_inst%topo_col(bounds%begc:bounds%endc)) - - end subroutine restFile_set_derived - - !----------------------------------------------------------------------- - subroutine restFile_read_pfile( pnamer ) - ! - ! !DESCRIPTION: - ! Setup restart file and perform necessary consistency checks - ! - ! !USES: - use fileutils , only : opnfil, getavu, relavu - use clm_varctl, only : rpntfil, rpntdir, inst_suffix - ! - ! !ARGUMENTS: - character(len=*), intent(out) :: pnamer ! full path of restart file - ! - ! !LOCAL VARIABLES: - !EOP - integer :: i ! indices - integer :: nio ! restart unit - integer :: status ! substring check status - character(len=256) :: locfn ! Restart pointer file name - !----------------------------------------------------------------------- - - ! Obtain the restart file from the restart pointer file. - ! For restart runs, the restart pointer file contains the full pathname - ! of the restart file. For branch runs, the namelist variable - ! [nrevsn] contains the full pathname of the restart file. - ! New history files are always created for branch runs. - - if (masterproc) then - write(iulog,*) 'Reading restart pointer file....' - endif - - nio = getavu() - locfn = trim(rpntdir) //'/'// trim(rpntfil)//trim(inst_suffix) - call opnfil (locfn, nio, 'f') - read (nio,'(a256)') pnamer - call relavu (nio) - - if (masterproc) then - write(iulog,*) 'Reading restart data.....' - write(iulog,'(72a1)') ("-",i=1,60) - end if - - end subroutine restFile_read_pfile - - !----------------------------------------------------------------------- - subroutine restFile_closeRestart( file ) - ! - ! !DESCRIPTION: - ! Close restart file and write restart pointer file if - ! in write mode, otherwise just close restart file if in read mode - ! - ! !USES: - use clm_time_manager, only : is_last_step - ! - ! !ARGUMENTS: - character(len=*) , intent(in) :: file ! local output filename - ! - ! !CALLED FROM: - ! subroutine restart in this module - ! - ! !REVISION HISTORY: - ! Author: Mariana Vertenstein - ! - ! - ! !LOCAL VARIABLES: - !EOP - integer :: i !index - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Successfully wrote local restart file ',trim(file) - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) - end if - - end subroutine restFile_closeRestart - - !----------------------------------------------------------------------- - subroutine restFile_write_pfile( fnamer ) - ! - ! !DESCRIPTION: - ! Open restart pointer file. Write names of current netcdf restart file. - ! - ! !USES: - use clm_varctl, only : rpntdir, rpntfil, inst_suffix - use fileutils , only : relavu - use fileutils , only : getavu, opnfil - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fnamer - ! - ! !LOCAL VARIABLES: - integer :: m ! index - integer :: nio ! restart pointer file - character(len=256) :: filename ! local file name - !----------------------------------------------------------------------- - - if (masterproc) then - nio = getavu() - filename= trim(rpntdir) //'/'// trim(rpntfil)//trim(inst_suffix) - call opnfil( filename, nio, 'f' ) - - write(nio,'(a)') fnamer - call relavu( nio ) - write(iulog,*)'Successfully wrote local restart pointer file' - end if - - end subroutine restFile_write_pfile - - !----------------------------------------------------------------------- - subroutine restFile_open( flag, file, ncid ) - - use clm_time_manager, only : get_nstep - - character(len=*), intent(in) :: flag ! flag to specify read or write - character(len=*), intent(in) :: file ! filename - type(file_desc_t), intent(out):: ncid ! netcdf id - - integer :: omode ! netCDF dummy variable - character(len= 32) :: subname='restFile_open' ! subroutine name - - if (flag == 'write') then - - ! Create new netCDF file (in define mode) and set fill mode - ! to "no fill" to optimize performance - - if (masterproc) then - write(iulog,*) - write(iulog,*)'restFile_open: writing restart dataset at ',& - trim(file), ' at nstep = ',get_nstep() - write(iulog,*) - end if - call ncd_pio_createfile(ncid, trim(file)) - - else if (flag == 'read') then - - ! Open netcdf restart file - - if (masterproc) then - write(iulog,*) 'Reading restart dataset' - end if - call ncd_pio_openfile (ncid, trim(file), 0) - - end if - - end subroutine restFile_open - - !----------------------------------------------------------------------- - character(len=256) function restFile_filename( rdate ) - ! - ! !DESCRIPTION: - ! - ! !USES: - use clm_varctl, only : caseid, inst_suffix - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: rdate ! input date for restart file name - !----------------------------------------------------------------------- - - restFile_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& - ".r."//trim(rdate)//".nc" - if (masterproc) then - write(iulog,*)'writing restart file ',trim(restFile_filename),' for model date = ',rdate - end if - - end function restFile_filename - - !------------------------------------------------------------------------ - subroutine restFile_dimset( ncid ) - ! - ! !DESCRIPTION: - ! Read/Write initial data from/to netCDF instantaneous initial data file - ! - ! !USES: - use clm_time_manager , only : get_nstep - use clm_varctl , only : caseid, ctitle, version, username, hostname, fsurdat - use clm_varctl , only : conventions, source - use dynSubgridControlMod , only : get_flanduse_timeseries - use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd, nlevurb, nlevcan - use clm_varpar , only : maxpatch_glcmec, nvegwcs - use decompMod , only : get_proc_global - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid - ! - ! !LOCAL VARIABLES: - integer :: dimid ! netCDF dimension id - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: numCohort ! total number of cohorts across all processors - integer :: ier ! error status - integer :: strlen_dimid ! string dimension id - character(len= 8) :: curdate ! current date - character(len= 8) :: curtime ! current time - character(len=256) :: str - character(len= 32) :: subname='restFile_dimset' ! subroutine name - !------------------------------------------------------------------------ - - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump, nCohorts=numCohort) - - ! Define dimensions - - call ncd_defdim(ncid , nameg , numg , dimid) - call ncd_defdim(ncid , namel , numl , dimid) - call ncd_defdim(ncid , namec , numc , dimid) - call ncd_defdim(ncid , namep , nump , dimid) - call ncd_defdim(ncid , nameCohort , numCohort , dimid) - - call ncd_defdim(ncid , 'levgrnd' , nlevgrnd , dimid) - call ncd_defdim(ncid , 'levurb' , nlevurb , dimid) - call ncd_defdim(ncid , 'levlak' , nlevlak , dimid) - call ncd_defdim(ncid , 'levsno' , nlevsno , dimid) - call ncd_defdim(ncid , 'levsno1' , nlevsno+1 , dimid) - call ncd_defdim(ncid , 'levtot' , nlevsno+nlevgrnd, dimid) - call ncd_defdim(ncid , 'numrad' , numrad , dimid) - call ncd_defdim(ncid , 'levcan' , nlevcan , dimid) - if ( use_hydrstress ) then - call ncd_defdim(ncid , 'vegwcs' , nvegwcs , dimid) - end if - call ncd_defdim(ncid , 'string_length', 64 , dimid) - call ncd_defdim(ncid , 'glc_nec', maxpatch_glcmec, dimid) - call ncd_defdim(ncid , 'glc_nec1', maxpatch_glcmec+1, dimid) - - ! Define global attributes - - call ncd_putatt(ncid, NCD_GLOBAL, 'Conventions', trim(conventions)) - call getdatetime(curdate, curtime) - str = 'created on ' // curdate // ' ' // curtime - call ncd_putatt(ncid, NCD_GLOBAL, 'history' , trim(str)) - call ncd_putatt(ncid, NCD_GLOBAL, 'username', trim(username)) - call ncd_putatt(ncid, NCD_GLOBAL, 'host' , trim(hostname)) - call ncd_putatt(ncid, NCD_GLOBAL, 'version' , trim(version)) - call ncd_putatt(ncid, NCD_GLOBAL, 'source' , trim(source)) - str = '$Id: restFileMod.F90 41292 2012-10-26 13:51:45Z erik $' - call ncd_putatt(ncid, NCD_GLOBAL, 'revision_id' , trim(str)) - call ncd_putatt(ncid, NCD_GLOBAL, 'case_title' , trim(ctitle)) - call ncd_putatt(ncid, NCD_GLOBAL, 'case_id' , trim(caseid)) - call ncd_putatt(ncid, NCD_GLOBAL, 'surface_dataset', trim(fsurdat)) - call ncd_putatt(ncid, NCD_GLOBAL, 'flanduse_timeseries', trim(get_flanduse_timeseries())) - call ncd_putatt(ncid, NCD_GLOBAL, 'title', 'CLM Restart information') - - call restFile_add_flag_metadata(ncid, create_crop_landunit, 'create_crop_landunit') - call restFile_add_flag_metadata(ncid, irrigate, 'irrigate') - ! BACKWARDS_COMPATIBILITY(wjs, 2017-12-13) created_glacier_mec_landunits is always - ! true now. However, we can't remove the read of this field from init_interp until we - ! can reliably assume that all initial conditions files that might be used in - ! init_interp have this flag .true. So until then, we write the flag with a - ! hard-coded .true. value. - call restFile_add_flag_metadata(ncid, .true., 'created_glacier_mec_landunits') - - call restFile_add_ipft_metadata(ncid) - call restFile_add_icol_metadata(ncid) - call restFile_add_ilun_metadata(ncid) - - end subroutine restFile_dimset - - !----------------------------------------------------------------------- - subroutine restFile_add_flag_metadata(ncid, flag, flag_name) - ! - ! !DESCRIPTION: - ! Add global metadata for some logical flag - ! - ! !USES: - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid ! local file id - logical , intent(in) :: flag ! logical flag - character(len=*) , intent(in) :: flag_name ! name of netcdf attribute - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'restFile_add_flag_metadata' - !----------------------------------------------------------------------- - - if (flag) then - call ncd_putatt(ncid, ncd_global, flag_name, 'true') - else - call ncd_putatt(ncid, ncd_global, flag_name, 'false') - end if - - end subroutine restFile_add_flag_metadata - - - !----------------------------------------------------------------------- - subroutine restFile_add_ilun_metadata(ncid) - ! - ! !DESCRIPTION: - ! Add global metadata defining landunit types - ! - ! !USES: - use landunit_varcon, only : max_lunit, landunit_names, landunit_name_length - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ltype ! landunit type - character(len=*), parameter :: att_prefix = 'ilun_' ! prefix for attributes - character(len=len(att_prefix)+landunit_name_length) :: attname ! attribute name - - character(len=*), parameter :: subname = 'restFile_add_ilun_metadata' - !----------------------------------------------------------------------- - - do ltype = 1, max_lunit - attname = att_prefix // landunit_names(ltype) - call ncd_putatt(ncid, ncd_global, attname, ltype) - end do - - end subroutine restFile_add_ilun_metadata - - !----------------------------------------------------------------------- - subroutine restFile_add_icol_metadata(ncid) - ! - ! !DESCRIPTION: - ! Add global metadata defining column types - ! - ! !USES: - use column_varcon, only : write_coltype_metadata - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid ! local file id - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: att_prefix = 'icol_' ! prefix for attributes - - character(len=*), parameter :: subname = 'restFile_add_icol_metadata' - !----------------------------------------------------------------------- - - call write_coltype_metadata(att_prefix, ncid) - - end subroutine restFile_add_icol_metadata - - !----------------------------------------------------------------------- - subroutine restFile_add_ipft_metadata(ncid) - ! - ! !DESCRIPTION: - ! Add global metadata defining patch types - ! - ! !USES: - use clm_varpar, only : natpft_lb, mxpft, cft_lb, cft_ub - use pftconMod , only : pftname_len, pftname - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid ! local file id - ! - ! !LOCAL VARIABLES: - integer :: ptype ! patch type - character(len=*), parameter :: att_prefix = 'ipft_' ! prefix for attributes - character(len=len(att_prefix)+pftname_len) :: attname ! attribute name - - character(len=*), parameter :: subname = 'restFile_add_ipft_metadata' - !----------------------------------------------------------------------- - - do ptype = natpft_lb, mxpft - attname = att_prefix // pftname(ptype) - call ncd_putatt(ncid, ncd_global, attname, ptype) - end do - - call ncd_putatt(ncid, ncd_global, 'cft_lb', cft_lb) - call ncd_putatt(ncid, ncd_global, 'cft_ub', cft_ub) - - end subroutine restFile_add_ipft_metadata - - !----------------------------------------------------------------------- - subroutine restFile_dimcheck( ncid ) - ! - ! !DESCRIPTION: - ! Check dimensions of restart file - ! - ! !USES: - use decompMod, only : get_proc_global - use clm_varpar, only : nlevsno, nlevlak, nlevgrnd, nlevurb - use clm_varctl, only : single_column, nsrest, nsrStartup - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid - ! - ! !LOCAL VARIABLES: - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: numCohort ! total number of cohorts across all processors - character(len=:), allocatable :: msg ! diagnostic message - character(len=32) :: subname='restFile_dimcheck' ! subroutine name - !----------------------------------------------------------------------- - - ! Get relevant sizes - - if ( .not. single_column .or. nsrest /= nsrStartup )then - call get_proc_global(ng=numg, nl=numl, nc=numc, np=nump, nCohorts=numCohort) - msg = 'Did you mean to set use_init_interp = .true. in user_nl_clm?' // & - new_line('x') // & - '(Setting use_init_interp = .true. is needed when doing a' // & - new_line('x') // & - 'transient run using an initial conditions file from a non-transient run,' // & - new_line('x') // & - 'or a non-transient run using an initial conditions file from a transient run,' // & - new_line('x') // & - 'or when running a resolution or configuration that differs from the initial conditions.)' - call check_dim(ncid, nameg, numg, msg=msg) - call check_dim(ncid, namel, numl, msg=msg) - call check_dim(ncid, namec, numc, msg=msg) - call check_dim(ncid, namep, nump, msg=msg) - if ( use_fates ) call check_dim(ncid, nameCohort , numCohort, msg=msg) - end if - msg = 'You can deal with this mismatch by rerunning with ' // & - 'use_init_interp = .true. in user_nl_clm' - call check_dim(ncid, 'levsno' , nlevsno, msg=msg) - call check_dim(ncid, 'levgrnd' , nlevgrnd, msg=msg) - call check_dim(ncid, 'levurb' , nlevurb) - call check_dim(ncid, 'levlak' , nlevlak) - - end subroutine restFile_dimcheck - - !----------------------------------------------------------------------- - subroutine restFile_enddef( ncid ) - ! - ! !DESCRIPTION: - ! Read a CLM restart file. - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid - !----------------------------------------------------------------------- - - call ncd_enddef(ncid) - - end subroutine restFile_enddef - - !----------------------------------------------------------------------- - subroutine restFile_close( ncid ) - ! - ! !DESCRIPTION: - ! Read a CLM restart file. - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname='restFile_close' ! subroutine name - !----------------------------------------------------------------------- - - call ncd_pio_closefile(ncid) - - end subroutine restFile_close - - !----------------------------------------------------------------------- - subroutine restFile_check_consistency(bounds, ncid) - ! - ! !DESCRIPTION: - ! Perform some consistency checks on the restart file - ! - ! !USES: - use subgridRestMod, only : subgridRest_check_consistency - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - ! - ! !LOCAL VARIABLES: - logical :: check_finidat_year_consistency ! whether to check consistency between year on finidat file and current year - logical :: check_finidat_pct_consistency ! whether to check consistency between pct_pft on finidat file and surface dataset - - character(len=*), parameter :: subname = 'restFile_check_consistency' - !----------------------------------------------------------------------- - - call restFile_read_consistency_nl( & - check_finidat_year_consistency, & - check_finidat_pct_consistency) - - if (check_finidat_year_consistency) then - call restFile_check_year(ncid) - end if - - if (check_finidat_pct_consistency) then - call subgridRest_check_consistency(bounds) - end if - - end subroutine restFile_check_consistency - - !----------------------------------------------------------------------- - subroutine restFile_read_consistency_nl( & - check_finidat_year_consistency, & - check_finidat_pct_consistency) - - ! - ! !DESCRIPTION: - ! Read namelist settings related to finidat consistency checks - ! - ! !USES: - use fileutils , only : getavu, relavu - use clm_nlUtilsMod , only : find_nlgroup_name - use controlMod , only : NLFilename - use shr_mpi_mod , only : shr_mpi_bcast - ! - ! !ARGUMENTS: - logical, intent(out) :: check_finidat_year_consistency - logical, intent(out) :: check_finidat_pct_consistency - ! - ! !LOCAL VARIABLES: - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - - character(len=*), parameter :: subname = 'restFile_read_consistency_nl' - !----------------------------------------------------------------------- - - namelist /finidat_consistency_checks/ & - check_finidat_year_consistency, & - check_finidat_pct_consistency - - ! Set default namelist values - check_finidat_year_consistency = .true. - check_finidat_pct_consistency = .true. - - ! Read namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call find_nlgroup_name(nu_nml, 'finidat_consistency_checks', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=finidat_consistency_checks,iostat=nml_error) - if (nml_error /= 0) then - call endrun(msg='ERROR reading finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) - end if - else - call endrun(msg='ERROR finding finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast (check_finidat_year_consistency, mpicom) - call shr_mpi_bcast (check_finidat_pct_consistency, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'finidat_consistency_checks settings:' - write(iulog,nml=finidat_consistency_checks) - write(iulog,*) ' ' - end if - - end subroutine restFile_read_consistency_nl - - !----------------------------------------------------------------------- - subroutine restFile_check_year(ncid) - ! - ! !DESCRIPTION: - ! Make sure year on the restart file is consistent with the current model year - ! - ! !USES: - use clm_time_manager , only : get_curr_date, get_rest_date - use clm_varctl , only : fname_len - use dynSubgridControlMod , only : get_flanduse_timeseries - ! - ! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid ! netcdf id - ! - ! !LOCAL VARIABLES: - logical :: att_found ! whether the attribute was found on the netcdf file - character(len=fname_len) :: flanduse_timeseries_rest ! flanduse_timeseries from the restart file - integer :: year ! current model year - integer :: mon ! current model month - integer :: day ! current model day of month - integer :: tod ! current model time of day - integer :: rest_year ! year from restart file - - character(len=*), parameter :: subname = 'restFile_check_year' - !----------------------------------------------------------------------- - - ! Only do this check for a transient run - if (get_flanduse_timeseries() /= ' ') then - ! Determine if the restart file was generated from a transient run; if so, we will - ! do this consistency check. For backwards compatibility, we allow for the - ! possibility that the flanduse_timeseries attribute was not on the restart file; - ! in that case, we act as if the restart file was generated from a non-transient - ! run, thus skipping this check. - call check_att(ncid, NCD_GLOBAL, 'flanduse_timeseries', att_found) - if (att_found) then - call ncd_getatt(ncid, NCD_GLOBAL, 'flanduse_timeseries', flanduse_timeseries_rest) - else - write(iulog,*) ' ' - write(iulog,*) subname//' WARNING: flanduse_timeseries attribute not found on restart file' - write(iulog,*) 'Assuming that the restart file was generated from a non-transient run,' - write(iulog,*) 'and thus skipping the year check' - write(iulog,*) ' ' - - flanduse_timeseries_rest = ' ' - end if - - ! If the restart file was generated from a transient run, then confirm that the - ! year of the restart file matches the current model year. - if (flanduse_timeseries_rest /= ' ') then - call get_curr_date(year, mon, day, tod) - call get_rest_date(ncid, rest_year) - if (year /= rest_year) then - if (masterproc) then - write(iulog,*) 'ERROR: Current model year does not match year on initial conditions file (finidat)' - write(iulog,*) 'Current year: ', year - write(iulog,*) 'Year on initial conditions file: ', rest_year - write(iulog,*) ' ' - write(iulog,*) 'This match is a requirement when both:' - write(iulog,*) '(a) The current run is a transient run, and' - write(iulog,*) '(b) The initial conditions file was generated from a transient run' - write(iulog,*) ' ' - write(iulog,*) 'Possible solutions to this problem:' - write(iulog,*) '(1) Make sure RUN_STARTDATE is set correctly' - write(iulog,*) '(2) Make sure you are using the correct initial conditions file (finidat)' - write(iulog,*) '(3) If you are confident that you are using the correct start date and initial conditions file,' - write(iulog,*) ' yet are still experiencing this error, then you can bypass this check by setting:' - write(iulog,*) ' check_finidat_year_consistency = .false.' - write(iulog,*) ' in user_nl_clm' - write(iulog,*) ' ' - end if - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if ! year /= rest_year - end if ! flanduse_timeseries_rest /= ' ' - end if ! fpftdyn /= ' ' - - end subroutine restFile_check_year - -end module restFileMod - - - diff --git a/src/main/reweightMod.F90 b/src/main/reweightMod.F90 deleted file mode 100644 index 5816fa1d1b..0000000000 --- a/src/main/reweightMod.F90 +++ /dev/null @@ -1,61 +0,0 @@ -module reweightMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Top level driver for things that happen when subgrid weights are changed. This is in - ! a separate module from subgridWeightsMod in order to keep subgridWeightsMod lower- - ! level - and particularly to break its dependency on filterMod. - ! - ! - ! !USES: -#include "shr_assert.h" - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - ! - ! PUBLIC TYPES: - implicit none - save - - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: reweight_wrapup ! do modifications and error-checks after modifying subgrid weights - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine reweight_wrapup(bounds, glc_behavior) - ! - ! !DESCRIPTION: - ! Do additional modifications and error-checks that should be done after modifying subgrid - ! weights - ! - ! This should be called whenever any weights change (e.g., patch weights on the column, - ! landunit weights on the grid cell, etc.). - ! - ! !USES: - use filterMod , only : setFilters - use subgridWeightsMod , only : set_active, check_weights - use decompMod , only : bounds_type, BOUNDS_LEVEL_CLUMP - use glcBehaviorMod , only : glc_behavior_type - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! clump bounds - type(glc_behavior_type), intent(in) :: glc_behavior - !------------------------------------------------------------------------ - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_CLUMP, errMsg(sourcefile, __LINE__)) - - call set_active(bounds, glc_behavior) - call check_weights(bounds, active_only=.false.) - call check_weights(bounds, active_only=.true.) - call setFilters(bounds, glc_behavior) - - end subroutine reweight_wrapup - -end module reweightMod diff --git a/src/main/subgridAveMod.F90 b/src/main/subgridAveMod.F90 deleted file mode 100644 index 3375add2e8..0000000000 --- a/src/main/subgridAveMod.F90 +++ /dev/null @@ -1,1347 +0,0 @@ -module subgridAveMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Utilities to perfrom subgrid averaging - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use column_varcon , only : icol_roof, icol_sunwall, icol_shadewall - use column_varcon , only : icol_road_perv , icol_road_imperv - use clm_varcon , only : grlnd, nameg, namel, namec, namep,spval - use clm_varctl , only : iulog - use abortutils , only : endrun - use decompMod , only : bounds_type - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: p2c ! Perform an average patches to columns - public :: p2l ! Perform an average patches to landunits - public :: p2g ! Perform an average patches to gridcells - public :: c2l ! Perform an average columns to landunits - public :: c2g ! Perform an average columns to gridcells - public :: l2g ! Perform an average landunits to gridcells - - interface p2c - module procedure p2c_1d - module procedure p2c_2d - module procedure p2c_1d_filter - module procedure p2c_2d_filter - end interface - interface p2l - module procedure p2l_1d - module procedure p2l_2d - end interface - interface p2g - module procedure p2g_1d - module procedure p2g_2d - end interface - interface c2l - module procedure c2l_1d - module procedure c2l_2d - end interface - interface c2g - module procedure c2g_1d - module procedure c2g_2d - end interface - interface l2g - module procedure l2g_1d - module procedure l2g_2d - end interface - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: build_scale_l2g - private :: create_scale_l2g_lookup - - ! Note about the urban scaling types used for c2l_scale_type (urbanf / urbans), from - ! Bill Sacks and Keith Oleson: These names originally meant to distinguish between - ! fluxes and states. However, that isn't the right distinction. In general, urbanf - ! should be used for variables that are expressed as something-per-m^2 ('extensive' - ! state or flux variables), whereas urbans should be used for variables that are not - ! expressed as per-m^2 ('intensive' state variables; an example is temperature). The - ! urbanf scaling converts from per-m^2 of vertical wall area to per-m^2 of ground area. - ! One way to think about this is: In the extreme case of a near-infinite canyon_hwr due - ! to massively tall walls, do you want a near-infinite multiplier for the walls for the - ! variable in question? If so, you want urbanf; if not, you want urbans. - ! - ! However, there may be some special cases, including some hydrology variables that - ! don't apply for urban walls. - - ! WJS (10-14-11): TODO: - ! - ! - I believe that scale_p2c, scale_c2l and scale_l2g should be included in the sumwt - ! accumulations (e.g., sumwt = sumwt + wtgcell * scale_p2c * scale_c2l * scale_l2g), but - ! that requires some more thought to (1) make sure that is correct, and (2) make sure it - ! doesn't break the urban scaling. (See also my notes in create_scale_l2g_lookup.) - ! - Once that is done, you could use a scale of 0, avoiding the need for the use of - ! spval and the special checks that requires. - ! - ! - Currently, there is a lot of repeated code to calculate scale_c2l. This should be - ! cleaned up. - ! - At a minimum, should collect the repeated code into a subroutine to eliminate this - ! repitition - ! - The best thing might be to use a lookup array, as is done for scale_l2g - - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - ! ----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine p2c_1d (bounds, parr, carr, p2c_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from patches to columns. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: parr( bounds%begp: ) ! patch array - real(r8), intent(out) :: carr( bounds%begc: ) ! column array - character(len=*), intent(in) :: p2c_scale_type ! scale type - ! - ! !LOCAL VARIABLES: - integer :: p,c,index ! indices - real(r8) :: scale_p2c(bounds%begp:bounds%endp) ! scale factor for column->landunit mapping - logical :: found ! temporary for error check - real(r8) :: sumwt(bounds%begc:bounds%endc) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(carr) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - if (p2c_scale_type == 'unity') then - do p = bounds%begp,bounds%endp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2c_1d error: scale type ',p2c_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - carr(bounds%begc:bounds%endc) = spval - sumwt(bounds%begc:bounds%endc) = 0._r8 - do p = bounds%begp,bounds%endp - if (patch%active(p) .and. patch%wtcol(p) /= 0._r8) then - if (parr(p) /= spval) then - c = patch%column(p) - if (sumwt(c) == 0._r8) carr(c) = 0._r8 - carr(c) = carr(c) + parr(p) * scale_p2c(p) * patch%wtcol(p) - sumwt(c) = sumwt(c) + patch%wtcol(p) - end if - end if - end do - found = .false. - do c = bounds%begc,bounds%endc - if (sumwt(c) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = c - else if (sumwt(c) /= 0._r8) then - carr(c) = carr(c)/sumwt(c) - end if - end do - if (found) then - write(iulog,*)'p2c_1d error: sumwt is greater than 1.0' - call endrun(decomp_index=index, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine p2c_1d - - !----------------------------------------------------------------------- - subroutine p2c_2d (bounds, num2d, parr, carr, p2c_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from landunits to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num2d ! size of second dimension - real(r8) , intent(in) :: parr( bounds%begp: , 1: ) ! patch array - real(r8) , intent(out) :: carr( bounds%begc: , 1: ) ! column array - character(len=*) , intent(in) :: p2c_scale_type ! scale type - ! - ! !LOCAL VARIABLES: - integer :: j,p,c,index ! indices - real(r8) :: scale_p2c(bounds%begp:bounds%endp) ! scale factor for column->landunit mapping - logical :: found ! temporary for error check - real(r8) :: sumwt(bounds%begc:bounds%endc) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp, num2d/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(carr) == (/bounds%endc, num2d/)), errMsg(sourcefile, __LINE__)) - - if (p2c_scale_type == 'unity') then - do p = bounds%begp,bounds%endp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2c_2d error: scale type ',p2c_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - carr(bounds%begc : bounds%endc, :) = spval - do j = 1,num2d - sumwt(bounds%begc : bounds%endc) = 0._r8 - do p = bounds%begp,bounds%endp - if (patch%active(p) .and. patch%wtcol(p) /= 0._r8) then - if (parr(p,j) /= spval) then - c = patch%column(p) - if (sumwt(c) == 0._r8) carr(c,j) = 0._r8 - carr(c,j) = carr(c,j) + parr(p,j) * scale_p2c(p) * patch%wtcol(p) - sumwt(c) = sumwt(c) + patch%wtcol(p) - end if - end if - end do - found = .false. - do c = bounds%begc,bounds%endc - if (sumwt(c) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = c - else if (sumwt(c) /= 0._r8) then - carr(c,j) = carr(c,j)/sumwt(c) - end if - end do - if (found) then - write(iulog,*)'p2c_2d error: sumwt is greater than 1.0 at c= ',index,' lev= ',j - call endrun(decomp_index=index, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - end do - end subroutine p2c_2d - - !----------------------------------------------------------------------- - subroutine p2c_1d_filter (bounds, numfc, filterc, patcharr, colarr) - ! - ! !DESCRIPTION: - ! perform patch to column averaging for single level patch arrays - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: numfc - integer , intent(in) :: filterc(numfc) - real(r8), intent(in) :: patcharr( bounds%begp: ) - real(r8), intent(out) :: colarr( bounds%begc: ) - ! - ! !LOCAL VARIABLES: - integer :: fc,c,p ! indices - !----------------------------------------------------------------------- - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(patcharr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(colarr) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - - do fc = 1,numfc - c = filterc(fc) - colarr(c) = 0._r8 - do p = col%patchi(c), col%patchf(c) - if (patch%active(p)) colarr(c) = colarr(c) + patcharr(p) * patch%wtcol(p) - end do - end do - - end subroutine p2c_1d_filter - - !----------------------------------------------------------------------- - subroutine p2c_2d_filter (lev, numfc, filterc, patcharr, colarr) - ! - ! !DESCRIPTION: - ! perform patch to column averaging for multi level patch arrays - ! - ! !ARGUMENTS: - integer , intent(in) :: lev - integer , intent(in) :: numfc - integer , intent(in) :: filterc(numfc) - real(r8), pointer :: patcharr(:,:) - real(r8), pointer :: colarr(:,:) - ! - ! !LOCAL VARIABLES: - integer :: fc,c,p,j ! indices - !----------------------------------------------------------------------- - - do j = 1,lev - do fc = 1,numfc - c = filterc(fc) - colarr(c,j) = 0._r8 - do p = col%patchi(c), col%patchf(c) - if (patch%active(p)) colarr(c,j) = colarr(c,j) + patcharr(p,j) * patch%wtcol(p) - end do - end do - end do - - end subroutine p2c_2d_filter - - !----------------------------------------------------------------------- - subroutine p2l_1d (bounds, parr, larr, p2c_scale_type, c2l_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from patches to landunits - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: parr( bounds%begp: ) ! input column array - real(r8), intent(out) :: larr( bounds%begl: ) ! output landunit array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,index ! indices - logical :: found ! temporary for error check - real(r8) :: sumwt(bounds%begl:bounds%endl) ! sum of weights - real(r8) :: scale_p2c(bounds%begp:bounds%endp) ! scale factor for patch->column mapping - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor for column->landunit mapping - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(larr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2l_1d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (p2c_scale_type == 'unity') then - do p = bounds%begp,bounds%endp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2l_1d error: scale type ',p2c_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - larr(bounds%begl : bounds%endl) = spval - sumwt(bounds%begl : bounds%endl) = 0._r8 - do p = bounds%begp,bounds%endp - if (patch%active(p) .and. patch%wtlunit(p) /= 0._r8) then - c = patch%column(p) - if (parr(p) /= spval .and. scale_c2l(c) /= spval) then - l = patch%landunit(p) - if (sumwt(l) == 0._r8) larr(l) = 0._r8 - larr(l) = larr(l) + parr(p) * scale_p2c(p) * scale_c2l(c) * patch%wtlunit(p) - sumwt(l) = sumwt(l) + patch%wtlunit(p) - end if - end if - end do - found = .false. - do l = bounds%begl,bounds%endl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l) = larr(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'p2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun(decomp_index=index, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine p2l_1d - - !----------------------------------------------------------------------- - subroutine p2l_2d(bounds, num2d, parr, larr, p2c_scale_type, c2l_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from patches to landunits - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: parr( bounds%begp: , 1: ) ! input patch array - real(r8), intent(out) :: larr( bounds%begl: , 1: ) ! output gridcell array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - ! - ! !LOCAL VARIABLES: - integer :: j,p,c,l,index ! indices - logical :: found ! temporary for error check - real(r8) :: sumwt(bounds%begl:bounds%endl) ! sum of weights - real(r8) :: scale_p2c(bounds%begc:bounds%endc) ! scale factor for patch->column mapping - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor for column->landunit mapping - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp, num2d/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(larr) == (/bounds%endl, num2d/)), errMsg(sourcefile, __LINE__)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2l_2d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (p2c_scale_type == 'unity') then - do p = bounds%begp,bounds%endp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2l_2d error: scale type ',p2c_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - larr(bounds%begl : bounds%endl, :) = spval - do j = 1,num2d - sumwt(bounds%begl : bounds%endl) = 0._r8 - do p = bounds%begp,bounds%endp - if (patch%active(p) .and. patch%wtlunit(p) /= 0._r8) then - c = patch%column(p) - if (parr(p,j) /= spval .and. scale_c2l(c) /= spval) then - l = patch%landunit(p) - if (sumwt(l) == 0._r8) larr(l,j) = 0._r8 - larr(l,j) = larr(l,j) + parr(p,j) * scale_p2c(p) * scale_c2l(c) * patch%wtlunit(p) - sumwt(l) = sumwt(l) + patch%wtlunit(p) - end if - end if - end do - found = .false. - do l = bounds%begl,bounds%endl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l,j) = larr(l,j)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'p2l_2d error: sumwt is greater than 1.0 at l= ',index,' j= ',j - call endrun(decomp_index=index, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine p2l_2d - - !----------------------------------------------------------------------- - subroutine p2g_1d(bounds, parr, garr, p2c_scale_type, c2l_scale_type, l2g_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from patches to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: parr( bounds%begp: ) ! input patch array - real(r8), intent(out) :: garr( bounds%begg: ) ! output gridcell array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,g,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_p2c(bounds%begp:bounds%endp) ! scale factor - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor - real(r8) :: scale_l2g(bounds%begl:bounds%endl) ! scale factor - real(r8) :: sumwt(bounds%begg:bounds%endg) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(garr) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call build_scale_l2g(bounds, l2g_scale_type, & - scale_l2g(bounds%begl:bounds%endl)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2g_1d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (p2c_scale_type == 'unity') then - do p = bounds%begp,bounds%endp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2g_1d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - garr(bounds%begg : bounds%endg) = spval - sumwt(bounds%begg : bounds%endg) = 0._r8 - do p = bounds%begp,bounds%endp - if (patch%active(p) .and. patch%wtgcell(p) /= 0._r8) then - c = patch%column(p) - l = patch%landunit(p) - if (parr(p) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = patch%gridcell(p) - if (sumwt(g) == 0._r8) garr(g) = 0._r8 - garr(g) = garr(g) + parr(p) * scale_p2c(p) * scale_c2l(c) * scale_l2g(l) * patch%wtgcell(p) - sumwt(g) = sumwt(g) + patch%wtgcell(p) - end if - end if - end do - found = .false. - do g = bounds%begg, bounds%endg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g) = garr(g)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'p2g_1d error: sumwt is greater than 1.0 at g= ',index - call endrun(decomp_index=index, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine p2g_1d - - !----------------------------------------------------------------------- - subroutine p2g_2d(bounds, num2d, parr, garr, p2c_scale_type, c2l_scale_type, l2g_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from patches to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: parr( bounds%begp: , 1: ) ! input patch array - real(r8), intent(out) :: garr( bounds%begg: , 1: ) ! output gridcell array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - ! - ! !LOCAL VARIABLES: - integer :: j,p,c,l,g,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_p2c(bounds%begp:bounds%endp) ! scale factor - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor - real(r8) :: scale_l2g(bounds%begl:bounds%endl) ! scale factor - real(r8) :: sumwt(bounds%begg:bounds%endg) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(parr) == (/bounds%endp, num2d/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(garr) == (/bounds%endg, num2d/)), errMsg(sourcefile, __LINE__)) - - call build_scale_l2g(bounds, l2g_scale_type, & - scale_l2g(bounds%begl:bounds%endl)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2g_2d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - if (p2c_scale_type == 'unity') then - do p = bounds%begp,bounds%endp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2g_2d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - garr(bounds%begg : bounds%endg, :) = spval - do j = 1,num2d - sumwt(bounds%begg : bounds%endg) = 0._r8 - do p = bounds%begp,bounds%endp - if (patch%active(p) .and. patch%wtgcell(p) /= 0._r8) then - c = patch%column(p) - l = patch%landunit(p) - if (parr(p,j) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = patch%gridcell(p) - if (sumwt(g) == 0._r8) garr(g,j) = 0._r8 - garr(g,j) = garr(g,j) + parr(p,j) * scale_p2c(p) * scale_c2l(c) * scale_l2g(l) * patch%wtgcell(p) - sumwt(g) = sumwt(g) + patch%wtgcell(p) - end if - end if - end do - found = .false. - do g = bounds%begg, bounds%endg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g,j) = garr(g,j)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'p2g_2d error: sumwt gt 1.0 at g/sumwt = ',index,sumwt(index) - call endrun(decomp_index=index, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine p2g_2d - - !----------------------------------------------------------------------- - subroutine c2l_1d (bounds, carr, larr, c2l_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from columns to landunits - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: carr( bounds%begc: ) ! input column array - real(r8), intent(out) :: larr( bounds%begl: ) ! output landunit array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - ! - ! !LOCAL VARIABLES: - integer :: c,l,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor for column->landunit mapping - real(r8) :: sumwt(bounds%begl:bounds%endl) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(carr) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(larr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2l_1d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - larr(bounds%begl : bounds%endl) = spval - sumwt(bounds%begl : bounds%endl) = 0._r8 - do c = bounds%begc,bounds%endc - if (col%active(c) .and. col%wtlunit(c) /= 0._r8) then - if (carr(c) /= spval .and. scale_c2l(c) /= spval) then - l = col%landunit(c) - if (sumwt(l) == 0._r8) larr(l) = 0._r8 - larr(l) = larr(l) + carr(c) * scale_c2l(c) * col%wtlunit(c) - sumwt(l) = sumwt(l) + col%wtlunit(c) - end if - end if - end do - found = .false. - do l = bounds%begl,bounds%endl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l) = larr(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'c2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun(decomp_index=index, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine c2l_1d - - !----------------------------------------------------------------------- - subroutine c2l_2d (bounds, num2d, carr, larr, c2l_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from columns to landunits - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: carr( bounds%begc: , 1: ) ! input column array - real(r8), intent(out) :: larr( bounds%begl: , 1: ) ! output landunit array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - ! - ! !LOCAL VARIABLES: - integer :: j,l,c,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor for column->landunit mapping - real(r8) :: sumwt(bounds%begl:bounds%endl) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(carr) == (/bounds%endc, num2d/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(larr) == (/bounds%endl, num2d/)), errMsg(sourcefile, __LINE__)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2l_2d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - larr(bounds%begl : bounds%endl, :) = spval - do j = 1,num2d - sumwt(bounds%begl : bounds%endl) = 0._r8 - do c = bounds%begc,bounds%endc - if (col%active(c) .and. col%wtlunit(c) /= 0._r8) then - if (carr(c,j) /= spval .and. scale_c2l(c) /= spval) then - l = col%landunit(c) - if (sumwt(l) == 0._r8) larr(l,j) = 0._r8 - larr(l,j) = larr(l,j) + carr(c,j) * scale_c2l(c) * col%wtlunit(c) - sumwt(l) = sumwt(l) + col%wtlunit(c) - end if - end if - end do - found = .false. - do l = bounds%begl,bounds%endl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l,j) = larr(l,j)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'c2l_2d error: sumwt is greater than 1.0 at l= ',index,' lev= ',j - call endrun(decomp_index=index, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine c2l_2d - - !----------------------------------------------------------------------- - subroutine c2g_1d(bounds, carr, garr, c2l_scale_type, l2g_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from columns to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: carr( bounds%begc: ) ! input column array - real(r8), intent(out) :: garr( bounds%begg: ) ! output gridcell array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - ! - ! !LOCAL VARIABLES: - integer :: c,l,g,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor - real(r8) :: scale_l2g(bounds%begl:bounds%endl) ! scale factor - real(r8) :: sumwt(bounds%begg:bounds%endg) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(carr) == (/bounds%endc/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(garr) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call build_scale_l2g(bounds, l2g_scale_type, & - scale_l2g(bounds%begl:bounds%endl)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2l_1d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - garr(bounds%begg : bounds%endg) = spval - sumwt(bounds%begg : bounds%endg) = 0._r8 - do c = bounds%begc,bounds%endc - if (col%active(c) .and. col%wtgcell(c) /= 0._r8) then - l = col%landunit(c) - if (carr(c) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = col%gridcell(c) - if (sumwt(g) == 0._r8) garr(g) = 0._r8 - garr(g) = garr(g) + carr(c) * scale_c2l(c) * scale_l2g(l) * col%wtgcell(c) - sumwt(g) = sumwt(g) + col%wtgcell(c) - end if - end if - end do - found = .false. - do g = bounds%begg, bounds%endg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g) = garr(g)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'c2g_1d error: sumwt is greater than 1.0 at g= ',index - call endrun(decomp_index=index, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine c2g_1d - - !----------------------------------------------------------------------- - subroutine c2g_2d(bounds, num2d, carr, garr, c2l_scale_type, l2g_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from columns to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: carr( bounds%begc: , 1: ) ! input column array - real(r8), intent(out) :: garr( bounds%begg: , 1: ) ! output gridcell array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging (see note at top of module) - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - ! - ! !LOCAL VARIABLES: - integer :: j,c,g,l,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_c2l(bounds%begc:bounds%endc) ! scale factor - real(r8) :: scale_l2g(bounds%begl:bounds%endl) ! scale factor - real(r8) :: sumwt(bounds%begg:bounds%endg) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(carr) == (/bounds%endc, num2d/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(garr) == (/bounds%endg, num2d/)), errMsg(sourcefile, __LINE__)) - - call build_scale_l2g(bounds, l2g_scale_type, & - scale_l2g(bounds%begl:bounds%endl)) - - if (c2l_scale_type == 'unity') then - do c = bounds%begc,bounds%endc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * lun%canyon_hwr(l) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = bounds%begc,bounds%endc - l = col%landunit(c) - if (lun%urbpoi(l)) then - if (col%itype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * lun%canyon_hwr(l)) / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_road_perv .or. col%itype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*lun%canyon_hwr(l) + 1.) - else if (col%itype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2g_2d error: scale type ',c2l_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - garr(bounds%begg : bounds%endg,:) = spval - do j = 1,num2d - sumwt(bounds%begg : bounds%endg) = 0._r8 - do c = bounds%begc,bounds%endc - if (col%active(c) .and. col%wtgcell(c) /= 0._r8) then - l = col%landunit(c) - if (carr(c,j) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = col%gridcell(c) - if (sumwt(g) == 0._r8) garr(g,j) = 0._r8 - garr(g,j) = garr(g,j) + carr(c,j) * scale_c2l(c) * scale_l2g(l) * col%wtgcell(c) - sumwt(g) = sumwt(g) + col%wtgcell(c) - end if - end if - end do - found = .false. - do g = bounds%begg, bounds%endg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g,j) = garr(g,j)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'c2g_2d error: sumwt is greater than 1.0 at g= ',index - call endrun(decomp_index=index, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine c2g_2d - - !----------------------------------------------------------------------- - subroutine l2g_1d(bounds, larr, garr, l2g_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from landunits to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: larr( bounds%begl: ) ! input landunit array - real(r8), intent(out) :: garr( bounds%begg: ) ! output gridcell array - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - ! - ! !LOCAL VARIABLES: - integer :: l,g,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_l2g(bounds%begl:bounds%endl) ! scale factor - real(r8) :: sumwt(bounds%begg:bounds%endg) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(larr) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(garr) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - call build_scale_l2g(bounds, l2g_scale_type, & - scale_l2g(bounds%begl:bounds%endl)) - - garr(bounds%begg : bounds%endg) = spval - sumwt(bounds%begg : bounds%endg) = 0._r8 - do l = bounds%begl,bounds%endl - if (lun%active(l) .and. lun%wtgcell(l) /= 0._r8) then - if (larr(l) /= spval .and. scale_l2g(l) /= spval) then - g = lun%gridcell(l) - if (sumwt(g) == 0._r8) garr(g) = 0._r8 - garr(g) = garr(g) + larr(l) * scale_l2g(l) * lun%wtgcell(l) - sumwt(g) = sumwt(g) + lun%wtgcell(l) - end if - end if - end do - found = .false. - do g = bounds%begg, bounds%endg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g) = garr(g)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'l2g_1d error: sumwt is greater than 1.0 at g= ',index - call endrun(decomp_index=index, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine l2g_1d - - !----------------------------------------------------------------------- - subroutine l2g_2d(bounds, num2d, larr, garr, l2g_scale_type) - ! - ! !DESCRIPTION: - ! Perfrom subgrid-average from landunits to gridcells. - ! Averaging is only done for points that are not equal to "spval". - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: larr( bounds%begl: , 1: ) ! input landunit array - real(r8), intent(out) :: garr( bounds%begg: , 1: ) ! output gridcell array - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - ! - ! !LOCAL VARIABLES: - integer :: j,g,l,index ! indices - integer :: max_lu_per_gcell ! max landunits per gridcell; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_l2g(bounds%begl:bounds%endl) ! scale factor - real(r8) :: sumwt(bounds%begg:bounds%endg) ! sum of weights - !------------------------------------------------------------------------ - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(larr) == (/bounds%endl, num2d/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(garr) == (/bounds%endg, num2d/)), errMsg(sourcefile, __LINE__)) - - call build_scale_l2g(bounds, l2g_scale_type, & - scale_l2g(bounds%begl:bounds%endl)) - - garr(bounds%begg : bounds%endg, :) = spval - do j = 1,num2d - sumwt(bounds%begg : bounds%endg) = 0._r8 - do l = bounds%begl,bounds%endl - if (lun%active(l) .and. lun%wtgcell(l) /= 0._r8) then - if (larr(l,j) /= spval .and. scale_l2g(l) /= spval) then - g = lun%gridcell(l) - if (sumwt(g) == 0._r8) garr(g,j) = 0._r8 - garr(g,j) = garr(g,j) + larr(l,j) * scale_l2g(l) * lun%wtgcell(l) - sumwt(g) = sumwt(g) + lun%wtgcell(l) - end if - end if - end do - found = .false. - do g = bounds%begg,bounds%endg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index= g - else if (sumwt(g) /= 0._r8) then - garr(g,j) = garr(g,j)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'l2g_2d error: sumwt is greater than 1.0 at g= ',index,' lev= ',j - call endrun(decomp_index=index, clmlevel=nameg, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine l2g_2d - - !----------------------------------------------------------------------- - subroutine build_scale_l2g(bounds, l2g_scale_type, scale_l2g) - ! - ! !DESCRIPTION: - ! Fill the scale_l2g(bounds%begl:bounds%endl) array with appropriate values for the given l2g_scale_type. - ! This array can later be used to scale each landunit in forming grid cell averages. - ! - ! !USES: - use landunit_varcon, only : max_lunit - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - real(r8) , intent(out) :: scale_l2g( bounds%begl: ) ! scale factor - ! - ! !LOCAL VARIABLES: - real(r8) :: scale_lookup(max_lunit) ! scale factor for each landunit type - integer :: l ! index - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(scale_l2g) == (/bounds%endl/)), errMsg(sourcefile, __LINE__)) - - ! TODO(wjs, 2017-03-09) If this routine is a performance problem (which it may be, - ! because I think it's called a lot), then a simple optimization would be to treat - ! l2g_scale_type = 'unity' specially, rather than using the more general-purpose code - ! for this special case. - - call create_scale_l2g_lookup(l2g_scale_type, scale_lookup) - - do l = bounds%begl,bounds%endl - scale_l2g(l) = scale_lookup(lun%itype(l)) - end do - - end subroutine build_scale_l2g - - !----------------------------------------------------------------------- - subroutine create_scale_l2g_lookup(l2g_scale_type, scale_lookup) - ! - ! DESCRIPTION: - ! Create a lookup array, scale_lookup(1..max_lunit), which gives the scale factor for - ! each landunit type depending on l2g_scale_type - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop, istice_mec, istdlak - use landunit_varcon, only : isturb_MIN, isturb_MAX, max_lunit - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - real(r8) , intent(out) :: scale_lookup(max_lunit) ! scale factor for each landunit type - !----------------------------------------------------------------------- - - ! ------------ WJS (10-14-11): IMPORTANT GENERAL NOTES ------------ - ! - ! Since scale_l2g is not currently included in the sumwt accumulations, you need to - ! be careful about the scale values you use. Values of 1 and spval are safe - ! (including having multiple landunits with value 1), but only use other values if - ! you know what you are doing! For example, using a value of 0 is NOT the correct way - ! to exclude a landunit from the average, because the normalization will be done - ! incorrectly in this case: instead, use spval to exclude a landunit from the - ! average. Similarly, using a value of 2 is NOT the correct way to give a landunit - ! double relative weight in general, because the normalization won't be done - ! correctly in this case, either. - ! - ! In the longer-term, I believe that the correct solution to this problem is to - ! include scale_l2g (and the other scale factors) in the sumwt accumulations - ! (e.g., sumwt = sumwt + wtgcell * scale_p2c * scale_c2l * scale_l2g), but that - ! requires some more thought to (1) make sure that is correct, and (2) make sure it - ! doesn't break the urban scaling. - ! - ! ----------------------------------------------------------------- - - - ! Initialize scale_lookup to spval for all landunits. Thus, any landunit that keeps - ! the default value will be excluded from grid cell averages. - scale_lookup(:) = spval - - if (l2g_scale_type == 'unity') then - scale_lookup(:) = 1.0_r8 - else if (l2g_scale_type == 'natveg') then - scale_lookup(istsoil) = 1.0_r8 - else if (l2g_scale_type == 'veg') then - scale_lookup(istsoil) = 1.0_r8 - scale_lookup(istcrop) = 1.0_r8 - else if (l2g_scale_type == 'ice') then - scale_lookup(istice_mec) = 1.0_r8 - else if (l2g_scale_type == 'nonurb') then - scale_lookup(:) = 1.0_r8 - scale_lookup(isturb_MIN:isturb_MAX) = spval - else if (l2g_scale_type == 'lake') then - scale_lookup(istdlak) = 1.0_r8 - else if (l2g_scale_type == 'veg_plus_lake') then - scale_lookup(istsoil) = 1.0_r8 - scale_lookup(istcrop) = 1.0_r8 - scale_lookup(istdlak) = 1.0_r8 - else - write(iulog,*)'scale_l2g_lookup_array error: scale type ',l2g_scale_type,' not supported' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine create_scale_l2g_lookup - -end module subgridAveMod diff --git a/src/main/subgridMod.F90 b/src/main/subgridMod.F90 deleted file mode 100644 index 6358e90b5e..0000000000 --- a/src/main/subgridMod.F90 +++ /dev/null @@ -1,564 +0,0 @@ -module subgridMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! sub-grid data and mapping types and modules - ! - ! TODO(wjs, 2015-12-08) Much of the logic here duplicates (in some sense) logic in - ! initGridCellsMod. The duplication should probably be extracted into routines shared - ! between these modules (or the two modules should be combined into one). - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use clm_varctl , only : iulog - use clm_instur , only : wt_lunit, wt_nat_patch, urban_valid, wt_cft - use landunit_varcon, only : istcrop, istdlak, istwet, isturb_tbd, isturb_hd, isturb_md - use glcBehaviorMod , only : glc_behavior_type - use FatesInterfaceMod, only : fates_maxElementsPerSite - - implicit none - private - save - - ! !PUBLIC MEMBER FUNCTIONS: - public :: subgrid_get_gcellinfo ! Obtain gridcell properties, summed across all landunits - - ! Routines to get info for each landunit: - public :: subgrid_get_info_natveg - public :: natveg_patch_exists ! returns true if the given natural veg patch should be created in memory - public :: subgrid_get_info_cohort - public :: subgrid_get_info_urban_tbd - public :: subgrid_get_info_urban_hd - public :: subgrid_get_info_urban_md - public :: subgrid_get_info_lake - public :: subgrid_get_info_wetland - public :: subgrid_get_info_glacier_mec - public :: subgrid_get_info_crop - public :: crop_patch_exists ! returns true if the given crop patch should be created in memory - - ! !PRIVATE MEMBER FUNCTIONS: - private :: subgrid_get_info_urban - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !------------------------------------------------------------------------------ - subroutine subgrid_get_gcellinfo (gi, glc_behavior, & - nlunits, ncols, npatches, ncohorts) - ! - ! !DESCRIPTION: - ! Obtain gridcell properties, aggregated across all landunits - ! - ! !ARGUMENTS - integer , intent(in) :: gi ! grid cell index - type(glc_behavior_type), intent(in) :: glc_behavior - integer , intent(out) :: nlunits ! number of landunits - integer , intent(out) :: ncols ! number of columns - integer , intent(out) :: npatches ! number of patchs - integer , intent(out) :: ncohorts ! number of cohorts - ! - ! !LOCAL VARIABLES: - ! Counts from a single landunit: - integer :: ncohorts_temp - integer :: npatches_temp - integer :: ncols_temp - integer :: nlunits_temp - - ! atm_topo is arbitrary for the sake of getting these counts. We don't have a true - ! atm_topo value at the point of this call, so use 0. - real(r8), parameter :: atm_topo = 0._r8 - !------------------------------------------------------------------------------ - - npatches = 0 - ncols = 0 - nlunits = 0 - ncohorts = 0 - - call subgrid_get_info_natveg(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_urban_tbd(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_urban_hd(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_urban_md(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_lake(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_wetland(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_glacier_mec(gi, atm_topo, glc_behavior, & - npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_crop(gi, npatches_temp, ncols_temp, nlunits_temp) - call accumulate_counters() - - call subgrid_get_info_cohort(gi,ncohorts) - - contains - subroutine accumulate_counters - ! Accumulate running sums of patches, columns and landunits. - ! - ! This uses local variables in the parent subroutine as both inputs and outputs - - npatches = npatches + npatches_temp - ncols = ncols + ncols_temp - nlunits = nlunits + nlunits_temp - - end subroutine accumulate_counters - - end subroutine subgrid_get_gcellinfo - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_natveg(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for natural vegetated landunit in this grid cell - ! - ! !USES - use clm_varpar, only : natpft_lb, natpft_ub - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of nat veg patches in this grid cell - integer, intent(out) :: ncols ! number of nat veg columns in this grid cell - integer, intent(out) :: nlunits ! number of nat veg landunits in this grid cell - ! - ! !LOCAL VARIABLES: - integer :: pft ! plant functional type index - - character(len=*), parameter :: subname = 'subgrid_get_info_natveg' - !----------------------------------------------------------------------- - - npatches = 0 - - do pft = natpft_lb, natpft_ub - if (natveg_patch_exists(gi, pft)) then - npatches = npatches + 1 - end if - end do - - if (npatches > 0) then - ! Assume that the vegetated landunit has one column - ncols = 1 - nlunits = 1 - else - ! As noted in natveg_patch_exists, we expect a naturally vegetated landunit in - ! every grid cell. This means that npatches should be at least 1 in every grid - ! cell. If we find that isn't true, abort. - write(iulog,*) 'Expect at least one natural veg patch in every grid cell' - write(iulog,*) 'Found 0 for gi = ', gi - call endrun(subname//' ERROR: Expect at least one natural veg patch in every grid cell') - end if - - end subroutine subgrid_get_info_natveg - - !----------------------------------------------------------------------- - function natveg_patch_exists(gi, pft) result(exists) - ! - ! !DESCRIPTION: - ! Returns true if a patch should be created in memory for the given natural veg PFT - ! in this grid cell. - ! - ! !USES: - use clm_varpar, only : natpft_lb, natpft_ub - use clm_varctl, only : use_cndv, use_fates - use dynSubgridControlMod, only : get_do_transient_pfts - ! - ! !ARGUMENTS: - logical :: exists ! function result - integer, intent(in) :: gi ! grid cell index - integer, intent(in) :: pft ! plant functional type - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'natveg_patch_exists' - !----------------------------------------------------------------------- - - SHR_ASSERT(pft >= natpft_lb, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(pft <= natpft_ub, errMsg(sourcefile, __LINE__)) - - if (get_do_transient_pfts() .or. use_cndv .or. use_fates) then - ! To support transient PFTS and dynamic vegetation cases, we have all possible PFTs - ! in every grid cell, because they might need to come into existence even if their - ! weight is 0 at the start of the run. (Similarly for FATES, but there patches do - ! not correspond to PFTs.) - exists = .true. - - else - ! For a non-transient PFT/dynamic-veg run: We still have a naturally vegetated - ! landunit in every grid cell, because this is needed to support any aspect of - ! dynamic landunits, as well as to provide forcings for a GLC model. So we don't - ! take into account the landunit's weight on the gridcell in determining whether to - ! allocate memory. However, we only allocate memory for patches that actually exist - ! on this landunit. (This will require running init_interp when changing between a - ! transient run and a non-transient run.) - if (wt_nat_patch(gi, pft) > 0.0_r8) then - exists = .true. - else - exists = .false. - end if - end if - - end function natveg_patch_exists - - - ! ----------------------------------------------------------------------------- - - subroutine subgrid_get_info_cohort(gi, ncohorts) - ! - ! !DESCRIPTION: - ! Obtain cohort counts per each gridcell. - ! - ! !USES - use clm_varpar, only : natpft_size - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: ncohorts ! number of cohorts in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_cohort' - !----------------------------------------------------------------------- - - ! ------------------------------------------------------------------------- - ! Number of cohorts is set here - ! FATES cohorts populate all natural vegetation columns. - ! There is only one natural vegetation column per grid-cell. So allocations - ! are mapped to the gridcell. In the future we may have more than one site - ! per gridcell, and we just multiply that factor here. - ! It is possible that there may be gridcells that don't have a naturally - ! vegetated column. That case should be fine, as the cohort - ! restart vector will just be a little sparse. - ! ------------------------------------------------------------------------- - - ncohorts = fates_maxElementsPerSite - - end subroutine subgrid_get_info_cohort - - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_urban_tbd(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for urban tbd landunit in this grid cell - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of urban tbd patches in this grid cell - integer, intent(out) :: ncols ! number of urban tbd columns in this grid cell - integer, intent(out) :: nlunits ! number of urban tbd landunits in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_urban_tbd' - !----------------------------------------------------------------------- - - call subgrid_get_info_urban(gi, isturb_tbd, npatches, ncols, nlunits) - - end subroutine subgrid_get_info_urban_tbd - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_urban_hd(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for urban hd landunit in this grid cell - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of urban hd patches in this grid cell - integer, intent(out) :: ncols ! number of urban hd columns in this grid cell - integer, intent(out) :: nlunits ! number of urban hd landunits in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_urban_hd' - !----------------------------------------------------------------------- - - call subgrid_get_info_urban(gi, isturb_hd, npatches, ncols, nlunits) - - end subroutine subgrid_get_info_urban_hd - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_urban_md(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for urban md landunit in this grid cell - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of urban md patches in this grid cell - integer, intent(out) :: ncols ! number of urban md columns in this grid cell - integer, intent(out) :: nlunits ! number of urban md landunits in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_urban_md' - !----------------------------------------------------------------------- - - call subgrid_get_info_urban(gi, isturb_md, npatches, ncols, nlunits) - - end subroutine subgrid_get_info_urban_md - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_urban(gi, ltype, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for one of the urban landunits in this grid cell - ! - ! This is shared for all urban landunits, because currently they are all treated the same. - ! - ! !USES - use clm_varpar, only : maxpatch_urb - use clm_varctl, only : run_zero_weight_urban - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(in) :: ltype ! landunit type (isturb_tbd, etc.) - integer, intent(out) :: npatches ! number of urban patches in this grid cell, for one urban landunit - integer, intent(out) :: ncols ! number of urban columns in this grid cell, for one urban landunit - integer, intent(out) :: nlunits ! number of urban landunits in this grid cell, for one urban landunit - ! - ! !LOCAL VARIABLES: - logical :: this_landunit_exists - - character(len=*), parameter :: subname = 'subgrid_get_info_urban' - !----------------------------------------------------------------------- - - ! In general, only allocate memory for urban landunits that have non-zero weight. - ! - ! However, if run_zero_weight_urban is .true., then allocate memory for all urban landunits in - ! every grid cell that has valid urban parameters. (This is useful if you want to - ! know urban behavior for all potential urban areas, or - in the future - to support - ! transient urban areas via dynamic landunits.) - ! - ! In either case, for simplicity, we always allocate space for all columns on any - ! allocated urban landunits. - - if (run_zero_weight_urban) then - if (urban_valid(gi)) then - this_landunit_exists = .true. - else - this_landunit_exists = .false. - end if - else - if (wt_lunit(gi, ltype) > 0.0_r8) then - this_landunit_exists = .true. - else - this_landunit_exists = .false. - end if - end if - - if (this_landunit_exists) then - npatches = maxpatch_urb - ncols = npatches - nlunits = 1 - else - npatches = 0 - ncols = 0 - nlunits = 0 - end if - - - end subroutine subgrid_get_info_urban - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_lake(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for lake landunit in this grid cell - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of lake patches in this grid cell - integer, intent(out) :: ncols ! number of lake columns in this grid cell - integer, intent(out) :: nlunits ! number of lake landunits in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_lake' - !----------------------------------------------------------------------- - - ! We currently do NOT allow the lake landunit to expand via dynamic landunits, so we - ! only need to allocate space for it where its weight is currently non-zero. - - if (wt_lunit(gi, istdlak) > 0.0_r8) then - npatches = 1 - ncols = 1 - nlunits = 1 - else - npatches = 0 - ncols = 0 - nlunits = 0 - end if - - end subroutine subgrid_get_info_lake - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_wetland(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for wetland landunit in this grid cell - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of wetland patches in this grid cell - integer, intent(out) :: ncols ! number of wetland columns in this grid cell - integer, intent(out) :: nlunits ! number of wetland landunits in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_wetland' - !----------------------------------------------------------------------- - - ! We currently do NOT allow the wetland landunit to expand via dynamic landunits, so we - ! only need to allocate space for it where its weight is currently non-zero. - - if (wt_lunit(gi, istwet) > 0.0_r8) then - npatches = 1 - ncols = 1 - nlunits = 1 - else - npatches = 0 - ncols = 0 - nlunits = 0 - end if - - end subroutine subgrid_get_info_wetland - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_glacier_mec(gi, atm_topo, glc_behavior, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for glacier_mec landunit in this grid cell - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - real(r8), intent(in) :: atm_topo ! atmosphere's topographic height for this grid cell (m) - type(glc_behavior_type), intent(in) :: glc_behavior - integer, intent(out) :: npatches ! number of glacier_mec patches in this grid cell - integer, intent(out) :: ncols ! number of glacier_mec columns in this grid cell - integer, intent(out) :: nlunits ! number of glacier_mec landunits in this grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgrid_get_info_glacier_mec' - !----------------------------------------------------------------------- - - call glc_behavior%get_num_glc_mec_subgrid(gi, atm_topo, npatches, ncols, nlunits) - - end subroutine subgrid_get_info_glacier_mec - - !----------------------------------------------------------------------- - subroutine subgrid_get_info_crop(gi, npatches, ncols, nlunits) - ! - ! !DESCRIPTION: - ! Obtain properties for crop landunit in this grid cell - ! - ! !USES: - use clm_varpar, only : cft_lb, cft_ub - ! - ! !ARGUMENTS: - integer, intent(in) :: gi ! grid cell index - integer, intent(out) :: npatches ! number of nat veg patches in this grid cell - integer, intent(out) :: ncols ! number of nat veg columns in this grid cell - integer, intent(out) :: nlunits ! number of nat veg landunits in this grid cell - ! - ! !LOCAL VARIABLES: - integer :: cft ! crop functional type index - - character(len=*), parameter :: subname = 'subgrid_get_info_crop' - !----------------------------------------------------------------------- - - npatches = 0 - - do cft = cft_lb, cft_ub - if (crop_patch_exists(gi, cft)) then - npatches = npatches + 1 - end if - end do - - if (npatches > 0) then - ncols = npatches - nlunits = 1 - else - ncols = 0 - nlunits = 0 - end if - - end subroutine subgrid_get_info_crop - - !----------------------------------------------------------------------- - function crop_patch_exists(gi, cft) result(exists) - ! - ! !DESCRIPTION: - ! Returns true if a patch should be created in memory for the given crop functional - ! type in this grid cell. - ! - ! This just applies to the crop landunit: it always returns .false. if - ! create_crop_landunit is .false. - ! - ! !USES: - use clm_varpar , only : cft_lb, cft_ub - use clm_varctl , only : create_crop_landunit - use pftconmod , only : pftcon - use dynSubgridControlMod , only : get_do_transient_crops - ! - ! !ARGUMENTS: - logical :: exists ! function result - integer, intent(in) :: gi ! grid cell index - integer, intent(in) :: cft ! crop functional type - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'crop_patch_exists' - !----------------------------------------------------------------------- - - if (create_crop_landunit) then - SHR_ASSERT(cft >= cft_lb, errMsg(sourcefile, __LINE__)) - SHR_ASSERT(cft <= cft_ub, errMsg(sourcefile, __LINE__)) - - if (get_do_transient_crops()) then - ! To support dynamic landunits, we have all possible crop columns in every grid - ! cell, because they might need to come into existence even if their weight is 0 at - ! the start of the run. - if (pftcon%is_pft_known_to_model(cft)) then - exists = .true. - else - exists = .false. - end if - - else - ! For a run without transient crops, only allocate memory for crops that are - ! actually present in this run. (This will require running init_interp when - ! changing between a transient crop run and a non-transient run.) - if (wt_lunit(gi, istcrop) > 0.0_r8 .and. wt_cft(gi, cft) > 0.0_r8) then - exists = .true. - else - exists = .false. - end if - end if - - else ! create_crop_landunit false - exists = .false. - end if - - end function crop_patch_exists - - - -end module subgridMod diff --git a/src/main/subgridRestMod.F90 b/src/main/subgridRestMod.F90 deleted file mode 100644 index 6237061393..0000000000 --- a/src/main/subgridRestMod.F90 +++ /dev/null @@ -1,733 +0,0 @@ -module subgridRestMod - -#include "shr_assert.h" - - !------------------------------------------------------------------------ - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use glc_elevclass_mod , only : glc_get_num_elevation_classes, glc_get_elevclass_bounds - use abortutils , only : endrun - use decompMod , only : bounds_type, BOUNDS_LEVEL_PROC, ldecomp - use domainMod , only : ldomain - use clm_time_manager , only : get_curr_date - use clm_varcon , only : nameg, namel, namec, namep - use clm_varpar , only : nlevsno, nlevgrnd - use pio , only : file_desc_t - use ncdio_pio , only : ncd_int, ncd_double - use GetGlobalValuesMod , only : GetGlobalIndex - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use restUtilMod - ! - ! !PUBLIC TYPES: - implicit none - save - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: subgridRestWrite ! handle restart writes of subgrid variables - public :: subgridRestRead ! handle restart reads of subgrid variables - public :: subgridRest_check_consistency ! check consistency of variables read by subgridRest - public :: subgridRest_read_cleanup ! do cleanup of variables allocated when reading the restart file; should be called after subgridRest and subgridRest_check_consistency are complete - - ! !PRIVATE MEMBER FUNCTIONS: - private :: subgridRest_write_only ! handle restart of subgrid variables that only need to be written, not read - private :: subgridRest_write_and_read ! handle restart of subgrid variables that need to be read as well as written - private :: save_old_weights - - ! !PRIVATE TYPES: - real(r8), allocatable :: pft_wtlunit_before_rest_read(:) ! patch%wtlunit weights - saved values from before the restart read - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !----------------------------------------------------------------------- - subroutine subgridRestWrite(bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart writes (and defines) of subgrid variables - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - type(file_desc_t), intent(inout) :: ncid ! netCDF dataset id - character(len=*) , intent(in) :: flag ! flag to determine if define or write data - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgridRestWrite' - !----------------------------------------------------------------------- - - call subgridRest_write_only(bounds, ncid, flag) - call subgridRest_write_and_read(bounds, ncid, flag) - - end subroutine subgridRestWrite - - - !------------------------------------------------------------------------ - subroutine subgridRestRead(bounds, ncid) - ! - ! !DESCRIPTION: - ! Handle restart reads of subgrid variables - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - type(file_desc_t), intent(inout) :: ncid ! netCDF dataset id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname='subgridRestRead' ! subroutine name - !------------------------------------------------------------------------ - - call subgridRest_write_and_read(bounds, ncid, 'read') - - end subroutine subgridRestRead - - !----------------------------------------------------------------------- - subroutine subgridRest_write_only(bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! Handle restart for variables that only need to be written, not read. This applies - ! to variables that are time-constant and are only put on the restart file for the - ! sake of having some additional metadata there. - ! - ! Note that 'active' flags appear in this routine: they don't need to be read because - ! they can be computed using other info on the restart file (particularly subgrid - ! weights). - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - type(file_desc_t), intent(inout) :: ncid ! netCDF dataset id - character(len=*) , intent(in) :: flag ! flag to determine if define, write or read data - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,i ! indices - logical :: readvar ! temporary - real(r8), pointer :: rgarr(:) ! temporary - real(r8), pointer :: rlarr(:) ! temporary - real(r8), pointer :: rcarr(:) ! temporary - real(r8), pointer :: rparr(:) ! temporary - integer , pointer :: igarr(:) ! temporary - integer , pointer :: ilarr(:) ! temporary - integer , pointer :: icarr(:) ! temporary - integer , pointer :: iparr(:) ! temporary - - real(r8), pointer :: elevclass_bounds(:) - - real(r8), pointer :: temp2d_r(:,:) ! temporary for multi-level variables - integer , pointer :: temp2d_i(:,:) ! temporary for multi-level variables - - character(len=*), parameter :: subname = 'subgridRest_write_only' - !----------------------------------------------------------------------- - - !------------------------------------------------------------------ - ! Write gridcell info - !------------------------------------------------------------------ - - allocate(rgarr(bounds%begg:bounds%endg), igarr(bounds%begg:bounds%endg)) - - call restartvar(ncid=ncid, flag=flag, varname='grid1d_lon', xtype=ncd_double, & - dim1name='gridcell', & - long_name='gridcell longitude', units='degrees_east', & - interpinic_flag='skip', readvar=readvar, data=grc%londeg) - - call restartvar(ncid=ncid, flag=flag, varname='grid1d_lat', xtype=ncd_double, & - dim1name='gridcell', & - long_name='gridcell latitude', units='degrees_north', & - interpinic_flag='skip', readvar=readvar, data=grc%latdeg) - - do g=bounds%begg,bounds%endg - igarr(g)= mod(ldecomp%gdc2glo(g)-1,ldomain%ni) + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='grid1d_ixy', xtype=ncd_int, & - dim1name='gridcell', & - long_name='2d longitude index of corresponding gridcell', & - interpinic_flag='skip', readvar=readvar, data=igarr) - - do g=bounds%begg,bounds%endg - igarr(g)= (ldecomp%gdc2glo(g) - 1)/ldomain%ni + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='grid1d_jxy', xtype=ncd_int, & - dim1name='gridcell', & - long_name='2d latitude index of corresponding gridcell', & - interpinic_flag='skip', readvar=readvar, data=igarr) - - deallocate(rgarr,igarr) - - !------------------------------------------------------------------ - ! Write landunit info - !------------------------------------------------------------------ - - allocate(rlarr(bounds%begl:bounds%endl), ilarr(bounds%begl:bounds%endl)) - - do l=bounds%begl,bounds%endl - rlarr(l) = grc%londeg(lun%gridcell(l)) - enddo - - call restartvar(ncid=ncid, flag=flag, varname='land1d_lon', xtype=ncd_double, & - dim1name='landunit', & - long_name='landunit longitude', units='degrees_east', & - interpinic_flag='skip', readvar=readvar, data=rlarr) - - do l=bounds%begl,bounds%endl - rlarr(l) = grc%latdeg(lun%gridcell(l)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='land1d_lat', xtype=ncd_double, & - dim1name='landunit', & - long_name='landunit latitude', units='degrees_north', & - interpinic_flag='skip', readvar=readvar, data=rlarr) - - do l=bounds%begl,bounds%endl - ilarr(l) = mod(ldecomp%gdc2glo(lun%gridcell(l))-1,ldomain%ni) + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='land1d_ixy', xtype=ncd_int, & - dim1name='landunit', & - long_name='2d longitude index of corresponding landunit', & - interpinic_flag='skip', readvar=readvar, data=ilarr) - - do l=bounds%begl,bounds%endl - ilarr(l) = (ldecomp%gdc2glo(lun%gridcell(l))-1)/ldomain%ni + 1 - end do - call restartvar(ncid=ncid, flag=flag, varname='land1d_jxy', xtype=ncd_int, & - dim1name='landunit', & - long_name='2d latitude index of corresponding landunit', & - interpinic_flag='skip', readvar=readvar, data=ilarr) - - do l=bounds%begl,bounds%endl - ilarr(l) = GetGlobalIndex(decomp_index=lun%gridcell(l), clmlevel=nameg) - end do - call restartvar(ncid=ncid, flag=flag, varname='land1d_gridcell_index', xtype=ncd_int, & - dim1name='landunit', & - long_name='gridcell index of corresponding landunit', & - interpinic_flag='skip', readvar=readvar, data=ilarr) - - call restartvar(ncid=ncid, flag=flag, varname='land1d_ityplun', xtype=ncd_int, & - dim1name='landunit', & - long_name='landunit type (see global attributes)', units=' ', & - interpinic_flag='skip', readvar=readvar, data=lun%itype) - - do l=bounds%begl,bounds%endl - if (lun%active(l)) then - ilarr(l) = 1 - else - ilarr(l) = 0 - end if - enddo - call restartvar(ncid=ncid, flag=flag, varname='land1d_active', xtype=ncd_int, & - dim1name='landunit', & - long_name='landunit active flag (1=active, 0=inactive)', & - interpinic_flag='skip', readvar=readvar, data=ilarr) - - deallocate(rlarr, ilarr) - - !------------------------------------------------------------------ - ! Write column info - !------------------------------------------------------------------ - - allocate(rcarr(bounds%begc:bounds%endc), icarr(bounds%begc:bounds%endc)) - - do c= bounds%begc, bounds%endc - rcarr(c) = grc%londeg(col%gridcell(c)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='cols1d_lon', xtype=ncd_double, & - dim1name='column', & - long_name='column longitude', units='degrees_east', & - interpinic_flag='skip', readvar=readvar, data=rcarr) - - do c= bounds%begc, bounds%endc - rcarr(c) = grc%latdeg(col%gridcell(c)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='cols1d_lat', xtype=ncd_double, & - dim1name='column', & - long_name='column latitude', units='degrees_north', & - interpinic_flag='skip', readvar=readvar, data=rcarr) - - do c= bounds%begc, bounds%endc - icarr(c) = mod(ldecomp%gdc2glo(col%gridcell(c))-1,ldomain%ni) + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='cols1d_ixy', xtype=ncd_int, & - dim1name='column', & - long_name='2d longitude index of corresponding column', units=' ', & - interpinic_flag='skip', readvar=readvar, data=icarr) - - do c= bounds%begc, bounds%endc - icarr(c) = (ldecomp%gdc2glo(col%gridcell(c))-1)/ldomain%ni + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='cols1d_jxy', xtype=ncd_int, & - dim1name='column', & - long_name='2d latitude index of corresponding column', units=' ', & - interpinic_flag='skip', readvar=readvar, data=icarr) - - do c= bounds%begc, bounds%endc - icarr(c) = GetGlobalIndex(decomp_index=col%gridcell(c), clmlevel=nameg) - end do - call restartvar(ncid=ncid, flag=flag, varname='cols1d_gridcell_index', xtype=ncd_int, & - dim1name='column', & - long_name='gridcell index of corresponding column', & - interpinic_flag='skip', readvar=readvar, data=icarr) - - do c= bounds%begc, bounds%endc - icarr(c) = GetGlobalIndex(decomp_index=col%landunit(c), clmlevel=namel) - end do - call restartvar(ncid=ncid, flag=flag, varname='cols1d_landunit_index', xtype=ncd_int, & - dim1name='column', & - long_name='landunit index of corresponding column', & - interpinic_flag='skip', readvar=readvar, data=icarr) - - do c= bounds%begc, bounds%endc - icarr(c) = lun%itype(col%landunit(c)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='cols1d_ityplun', xtype=ncd_int, & - dim1name='column', & - long_name='column landunit type (see global attributes)', units=' ', & - interpinic_flag='skip', readvar=readvar, data=icarr) - - call restartvar(ncid=ncid, flag=flag, varname='cols1d_ityp', xtype=ncd_int, & - dim1name='column', & - long_name='column type (see global attributes)', units=' ', & - interpinic_flag='skip', readvar=readvar, data=col%itype) - - do c=bounds%begc,bounds%endc - if (col%active(c)) then - icarr(c) = 1 - else - icarr(c) = 0 - end if - end do - call restartvar(ncid=ncid, flag=flag, varname='cols1d_active', xtype=ncd_int, & - dim1name='column', & - long_name='column active flag (1=active, 0=inactive)', units=' ', & - interpinic_flag='skip', readvar=readvar, data=icarr) - - call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS', xtype=ncd_int, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='class in which each layer falls', units=' ', & - interpinic_flag='skip', readvar=readvar, data=col%levgrnd_class) - - allocate(temp2d_r(bounds%begc:bounds%endc, 1:nlevgrnd)) - temp2d_r(bounds%begc:bounds%endc, 1:nlevgrnd) = col%z(bounds%begc:bounds%endc, 1:nlevgrnd) - call restartvar(ncid=ncid, flag=flag, varname='COL_Z', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='layer depth, excluding snow layers', units='m', & - interpinic_flag='skip', readvar=readvar, data=temp2d_r) - deallocate(temp2d_r) - - deallocate(rcarr, icarr) - - !------------------------------------------------------------------ - ! Write patch info - !------------------------------------------------------------------ - - allocate(rparr(bounds%begp:bounds%endp), iparr(bounds%begp:bounds%endp)) - - do p=bounds%begp,bounds%endp - rparr(p) = grc%londeg(patch%gridcell(p)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_lon', xtype=ncd_double, & - dim1name='pft', & - long_name='pft longitude', units='degrees_east', & - interpinic_flag='skip', readvar=readvar, data=rparr) - - do p=bounds%begp,bounds%endp - rparr(p) = grc%latdeg(patch%gridcell(p)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_lat', xtype=ncd_double, & - dim1name='pft', & - long_name='pft latitude', units='degrees_north', & - interpinic_flag='skip', readvar=readvar, data=rparr) - - do p=bounds%begp,bounds%endp - iparr(p) = mod(ldecomp%gdc2glo(patch%gridcell(p))-1,ldomain%ni) + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_ixy', xtype=ncd_int, & - dim1name='pft', & - long_name='2d longitude index of corresponding pft', units='', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - do p=bounds%begp,bounds%endp - iparr(p) = (ldecomp%gdc2glo(patch%gridcell(p))-1)/ldomain%ni + 1 - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_jxy', xtype=ncd_int, & - dim1name='pft', & - long_name='2d latitude index of corresponding pft', units='', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - do p=bounds%begp,bounds%endp - iparr(p) = GetGlobalIndex(decomp_index=patch%gridcell(p), clmlevel=nameg) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_gridcell_index', xtype=ncd_int, & - dim1name='pft', & - long_name='gridcell index of corresponding pft', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - do p=bounds%begp,bounds%endp - iparr(p) = GetGlobalIndex(decomp_index=patch%landunit(p), clmlevel=namel) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_landunit_index', xtype=ncd_int, & - dim1name='pft', & - long_name='landunit index of corresponding pft', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - do p=bounds%begp,bounds%endp - iparr(p) = GetGlobalIndex(decomp_index=patch%column(p), clmlevel=namec) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_column_index', xtype=ncd_int, & - dim1name='pft', & - long_name='column index of corresponding pft', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_itypveg', xtype=ncd_int, & - dim1name='pft', & - long_name='pft vegetation type', units='', & - interpinic_flag='skip', readvar=readvar, data=patch%itype) - - do p=bounds%begp,bounds%endp - iparr(p) = col%itype(patch%column(p)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_itypcol', xtype=ncd_int, & - dim1name='pft', & - long_name='pft column type (see global attributes)', units='', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - do p=bounds%begp,bounds%endp - iparr(p) = lun%itype(patch%landunit(p)) - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_ityplun', xtype=ncd_int, & - dim1name='pft', & - long_name='pft landunit type (see global attributes)', units='', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - do p=bounds%begp,bounds%endp - if (patch%active(p)) then - iparr(p) = 1 - else - iparr(p) = 0 - end if - enddo - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_active', xtype=ncd_int, & - dim1name='pft', & - long_name='pft active flag (1=active, 0=inactive)', units='', & - interpinic_flag='skip', readvar=readvar, data=iparr) - - allocate(temp2d_i(bounds%begp:bounds%endp, 1:nlevgrnd)) - do p=bounds%begp,bounds%endp - c = patch%column(p) - temp2d_i(p, 1:nlevgrnd) = col%levgrnd_class(c, 1:nlevgrnd) - end do - call restartvar(ncid=ncid, flag=flag, varname='LEVGRND_CLASS_p', xtype=ncd_int, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & - long_name='class in which each layer falls, patch-level', units=' ', & - interpinic_flag='skip', readvar=readvar, data=temp2d_i) - deallocate(temp2d_i) - - allocate(temp2d_r(bounds%begp:bounds%endp, 1:nlevgrnd)) - do p=bounds%begp,bounds%endp - c = patch%column(p) - temp2d_r(p, 1:nlevgrnd) = col%z(c, 1:nlevgrnd) - end do - call restartvar(ncid=ncid, flag=flag, varname='COL_Z_p', xtype=ncd_double, & - dim1name='pft', dim2name='levgrnd', switchdim=.true., & - long_name='layer depth, excluding snow layers, patch-level', units='m', & - interpinic_flag='skip', readvar=readvar, data=temp2d_r) - deallocate(temp2d_r) - - deallocate(rparr, iparr) - - ! ------------------------------------------------------------------------ - ! Write other subgrid-related metadata - ! ------------------------------------------------------------------------ - - allocate(elevclass_bounds(0:glc_get_num_elevation_classes())) - elevclass_bounds = glc_get_elevclass_bounds() - call restartvar(ncid=ncid, flag=flag, varname='glc_elevclass_bounds', xtype=ncd_double, & - dim1name='glc_nec1', is_spatial = .false., & - long_name='glacier elevation class bounds', units='m', & - interpinic_flag='skip', readvar=readvar, data=elevclass_bounds) - deallocate(elevclass_bounds) - - end subroutine subgridRest_write_only - - !----------------------------------------------------------------------- - subroutine subgridRest_write_and_read(bounds, ncid, flag) - ! - ! !DESCRIPTION: - ! - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - type(file_desc_t), intent(inout) :: ncid ! netCDF dataset id - character(len=*) , intent(in) :: flag ! flag to determine if define, write or read data - ! - ! !LOCAL VARIABLES: - logical :: readvar ! temporary - real(r8), pointer :: temp2d(:,:) ! temporary for sno column variables - - character(len=*), parameter :: subname = 'subgridRest_write_and_read' - !----------------------------------------------------------------------- - - if (flag == 'read') then - call save_old_weights(bounds) - end if - - call restartvar(ncid=ncid, flag=flag, varname='land1d_wtxy', xtype=ncd_double, & - dim1name='landunit', & - long_name='landunit weight relative to corresponding gridcell', & - interpinic_flag='area', readvar=readvar, data=lun%wtgcell) - - call restartvar(ncid=ncid, flag=flag, varname='cols1d_wtxy', xtype=ncd_double, & - dim1name='column', & - long_name='column weight relative to corresponding gridcell', units=' ', & - interpinic_flag='area', readvar=readvar, data=col%wtgcell) - - call restartvar(ncid=ncid, flag=flag, varname='cols1d_wtlnd', xtype=ncd_double, & - dim1name='column', & - long_name='column weight relative to corresponding landunit', units=' ', & - interpinic_flag='area', readvar=readvar, data=col%wtlunit) - - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_wtxy', xtype=ncd_double, & - dim1name='pft', & - long_name='pft weight relative to corresponding gridcell', units='', & - interpinic_flag='area', readvar=readvar, data=patch%wtgcell) - - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_wtlnd', xtype=ncd_double, & - dim1name='pft', & - long_name='pft weight relative to corresponding landunit', units='', & - interpinic_flag='area', readvar=readvar, data=patch%wtlunit) - - call restartvar(ncid=ncid, flag=flag, varname='pfts1d_wtcol', xtype=ncd_double, & - dim1name='pft', & - long_name='pft weight relative to corresponding column', units='', & - interpinic_flag='area', readvar=readvar, data=patch%wtcol) - - ! Snow column variables - - call restartvar(ncid=ncid, flag=flag, varname='SNLSNO', xtype=ncd_int, & - dim1name='column', & - long_name='negative number of snow layers', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=col%snl) - - allocate(temp2d(bounds%begc:bounds%endc,-nlevsno+1:0)) - if (flag == 'write') then - temp2d(bounds%begc:bounds%endc,-nlevsno+1:0) = col%dz(bounds%begc:bounds%endc,-nlevsno+1:0) - end if - call restartvar(ncid=ncid, flag=flag, varname='DZSNO', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer thickness', units='m', & - interpinic_flag='interp', readvar=readvar, data=temp2d) - if (flag == 'read') then - col%dz(bounds%begc:bounds%endc,-nlevsno+1:0) = temp2d(bounds%begc:bounds%endc,-nlevsno+1:0) - end if - deallocate(temp2d) - - allocate(temp2d(bounds%begc:bounds%endc,-nlevsno+1:0)) - if (flag == 'write') then - temp2d(bounds%begc:bounds%endc,-nlevsno+1:0) = col%z(bounds%begc:bounds%endc,-nlevsno+1:0) - end if - call restartvar(ncid=ncid, flag=flag, varname='ZSNO', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno+1, upperb2=0, & - long_name='snow layer depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=temp2d) - if (flag == 'read') then - col%z(bounds%begc:bounds%endc,-nlevsno+1:0) = temp2d(bounds%begc:bounds%endc,-nlevsno+1:0) - end if - deallocate(temp2d) - - allocate(temp2d(bounds%begc:bounds%endc,-nlevsno:-1)) - if (flag == 'write') then - temp2d(bounds%begc:bounds%endc,-nlevsno:-1) = col%zi(bounds%begc:bounds%endc,-nlevsno:-1) - end if - call restartvar(ncid=ncid, flag=flag, varname='ZISNO', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., lowerb2=-nlevsno, upperb2=-1, & - long_name='snow interface depth', units='m', & - interpinic_flag='interp', readvar=readvar, data=temp2d) - if (flag == 'read') then - col%zi(bounds%begc:bounds%endc,-nlevsno:-1) = temp2d(bounds%begc:bounds%endc,-nlevsno:-1) - end if - deallocate(temp2d) - - end subroutine subgridRest_write_and_read - - !----------------------------------------------------------------------- - subroutine save_old_weights(bounds) - ! - ! !DESCRIPTION: - ! Save old weights, from before the restart read, for later consistency checks. - ! - ! !USES: - type(bounds_type), intent(in) :: bounds ! bounds (expected to be proc-level) - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'save_old_weights' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, subname//' ERROR: expect proc-level bounds') - - allocate(pft_wtlunit_before_rest_read(bounds%begp:bounds%endp)) - pft_wtlunit_before_rest_read(bounds%begp:bounds%endp) = patch%wtlunit(bounds%begp:bounds%endp) - - end subroutine save_old_weights - - - !----------------------------------------------------------------------- - subroutine subgridRest_check_consistency(bounds) - ! - ! !DESCRIPTION: - ! Check consistency of variables read by subgridRest. - ! - ! This should be called AFTER subgridRest is called to read the restart file. - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgridRest_check_consistency' - !----------------------------------------------------------------------- - - if (do_check_weights()) then - call check_weights(bounds) - end if - - contains - - !----------------------------------------------------------------------- - logical function do_check_weights() - ! - ! !DESCRIPTION: - ! Return true if we should check weights - ! - ! !USES: - use clm_varctl, only : nsrest, nsrContinue, use_cndv, use_fates - use dynSubgridControlMod, only : get_do_transient_pfts - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'do_check_weights' - !----------------------------------------------------------------------- - - if (get_do_transient_pfts()) then - ! Don't check weights for a transient PATCH case, because it's harder to come up with the - ! correct weights to check against - do_check_weights = .false. - else if (nsrest == nsrContinue) then - ! Don't check weights for a restart run - ! - ! WJS (3-25-14): I'm not sure why we don't do the check in this case, but I'm - ! maintaining the logic that used to be in BiogeophysRestMod regarding these - ! weight checks - do_check_weights = .false. - else if (use_cndv) then - ! Don't check weights for a cndv case, because the weights will almost certainly - ! differ from the surface dataset in this case - do_check_weights = .false. - else if (use_fates) then - ! Don't check weights for a fates case, because the weights will almost certainly - ! differ from the surface dataset in this case - do_check_weights = .false. - else - do_check_weights = .true. - end if - - end function do_check_weights - - !----------------------------------------------------------------------- - subroutine check_weights(bounds) - ! - ! !DESCRIPTION: - ! Make sure that patch weights on the landunit agree with the weights read from the - ! surface dataset, for the natural veg landunit. - ! - ! Note that we do NOT do a more general check of all subgrid weights, because it's - ! possible that some other subgrid weights have changed relative to the surface - ! dataset, e.g., due to dynamic landunits. It would probably be possible to do more - ! checking than is done here, but the check here should be sufficient to catch major - ! inconsistencies between the restart file and the surface dataset. - ! - ! !USES: - use landunit_varcon, only : istsoil - use clm_varctl, only : iulog - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - ! - ! !LOCAL VARIABLES: - integer :: p, l ! indices - real(r8) :: diff ! difference in weights - - real(r8), parameter :: tol = 5.e-3 ! tolerance for checking weights - - character(len=*), parameter :: subname = 'check_weights' - !----------------------------------------------------------------------- - - do p = bounds%begp, bounds%endp - l = patch%landunit(p) - if (lun%itype(l) == istsoil) then - diff = abs(patch%wtlunit(p) - pft_wtlunit_before_rest_read(p)) - if (diff > tol .and. patch%wtgcell(p) > 1.0e-16_r8) then - write(iulog,*) 'ERROR: PATCH weights are SIGNIFICANTLY different between :' - write(iulog,*) 'the restart (finidat) file : ', patch%wtlunit(p) - write(iulog,*) 'and the surface dataset (fsurdat): ', pft_wtlunit_before_rest_read(p) - write(iulog,*) 'weight gridcell: ', patch%wtgcell(p) - write(iulog,*) - write(iulog,*) 'Maximum allowed difference: ', tol - write(iulog,*) 'Difference found: ', diff - write(iulog,*) 'This match is a requirement for non-transient runs' - write(iulog,*) - write(iulog,*) 'Possible solutions to this problem:' - write(iulog,*) '(1) Make sure you are using the intended finidat and fsurdat files' - write(iulog,*) '(2) If you are running a present-day simulation, then make sure that your' - write(iulog,*) ' initial conditions file is from the END of a 20th century transient run' - write(iulog,*) '(3) If you are confident that you are using the correct finidat and fsurdat files,' - write(iulog,*) ' yet are still experiencing this error, then you can bypass this check by setting:' - write(iulog,*) ' check_finidat_pct_consistency = .false.' - write(iulog,*) ' in user_nl_clm' - write(iulog,*) ' In this case, CLM will take the weights from the initial conditions file.' - write(iulog,*) ' ' - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) - end if - end if - end do - - end subroutine check_weights - - end subroutine subgridRest_check_consistency - - - !----------------------------------------------------------------------- - subroutine subgridRest_read_cleanup - ! - ! !DESCRIPTION: - ! Do cleanup of variables allocated when reading the restart file - ! - ! Should be called after subgridRest and subgridRest_check_consistency are complete. - ! Note that this must be called after subgridRest is called to read the restart file, - ! in order to avoid a memory leak. - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'subgridRest_read_cleanup' - !----------------------------------------------------------------------- - - deallocate(pft_wtlunit_before_rest_read) - - end subroutine subgridRest_read_cleanup - - -end module subgridRestMod diff --git a/src/main/subgridWeightsMod.F90 b/src/main/subgridWeightsMod.F90 deleted file mode 100644 index b2c882a478..0000000000 --- a/src/main/subgridWeightsMod.F90 +++ /dev/null @@ -1,872 +0,0 @@ -module subgridWeightsMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Handles modifications, error-checks and diagnostics related to changing subgrid weights - ! - ! ----- Requirements for subgrid weights that are enforced here ----- - ! - ! (These requirements are checked in check_weights/weights_okay) - ! - ! Note: in the following, 'active' refers to a pft, column, landunit or grid cell over - ! which computations are performed, and 'inactive' refers to a pft, column or landunit - ! where computations are NOT performed (grid cells are always active). - ! - ! (1) For all columns, landunits and grid cells, the sum of all subgrid weights of its - ! children (or grandchildren, etc.) is equal to 1. For example: - ! - For all columns, the sum of all patch weights on the column equals 1 - ! - For all landunits, the sum of all col weights on the landunit equals 1 - ! - For all grid cells, the sum of all patch weights on the grid cell equals 1 - ! - etc. - ! - ! (2) For all ACTIVE columns, landunits and grid cells, the sum of all subgrid weights of - ! its ACTIVE children (or grandchildren, etc.) is equal to 1. For example: - ! - For all active columns, the sum of all patch weights on the column equals 1 when - ! just considering active pfts - ! - For all active landunits, the sum of all col weights on the landunit equals 1 when - ! just considering active cols - ! - For ALL grid cells, the sum of all patch weights on the grid cell equals 1 when - ! just considering active pfts -- note that all grid cells are considered active! - ! - etc. - ! - ! (3) For all INACTIVE columns, landunits and grid cells, the sum of all subgrid weights of - ! its ACTIVE children, grandchildren, etc. are equal to either 0 or 1. For example: - ! - For all inactive columns, the sum of all patch weights on the column equals either 0 - ! or 1 when just considering active pfts - ! - For all inactive landunits, the sum of all col weights on the landunit equals - ! either 0 or 1 when just considering active cols - ! - etc. - ! - ! Another way of stating (2) and (3) is that the sum of weights of all ACTIVE pfts, cols - ! or landunits on their parent/grandparent/etc. is always equal to either 0 or 1 -- and - ! must be equal to 1 if this parent/grandparent, etc. is itself active. - ! - ! Note that, together, conditions (1) and (2) imply that any pft, col or landunit whose - ! weight on the grid cell is non-zero must be active. In addition, these conditions imply - ! that any patch whose weight on the column is non-zero must be active if the column is - ! active (and similarly for any patch on an active landunit, and any col on an active - ! landunit). - ! - ! - ! ----- Implications of these requirements for computing subgrid averages ----- - ! - ! The preferred way to average from, say, patch to col is: - ! colval(c) = 0 - ! do p = pfti(c), pftf(c) - ! if (active(p)) colval(c) = colval(c) + pftval(p) * wtcol(p) - ! (where wtcol(p) is the weight of the patch on the column) - ! If column c is active, then the above conditions guarantee that the pwtcol values - ! included in the above sum will sum to 1. If column c is inactive, then the above - ! conditions guarantee that the pwtcol values included in the above sum will sum to - ! either 1 or 0; if they sum to 0, then colval(c) will remain 0. - ! - ! Another acceptable method is the following; this method accommodates some unknown - ! fraction of pftval's being set to spval, and leaves colval set at spval if there are no - ! valid patch values: - ! colval(c) = spval - ! sumwt(c) = 0 - ! do p = pfti(c), pftf(c) - ! if (active(p) .and. wtcol(p) /= 0) then - ! if (pftval(p) /= spval) then - ! if (sumwt(c) == 0) colval(c) = 0 - ! colval(c) = colval(c) + pftval(p) * wtcol(p) - ! sumwt(c) = sumwt(c) + wtcol(p) - ! end if - ! end if - ! end do - ! if (sumwt(c) /= 0) then - ! colval(c) = colval(c) / sumwt(c) - ! end if - ! Note that here we check the condition (active(p) .and. wtcol(p) /= 0). We need to - ! include a check for wtcol(p) /= 0 because we don't want to set colval(c) = 0 for zero- - ! weight pfts in this line: - ! if (sumwt(c) == 0) colval(c) = 0 - ! And we include a check for active(p) because we don't want to assume that pftval(p) has - ! been set to spval for inactive pfts -- we want to allow for the possibility that - ! pftval(p) will be NaN for inactive pfts. - ! - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varctl , only : iulog, all_active, run_zero_weight_urban, use_fates - use clm_varcon , only : nameg, namel, namec, namep - use decompMod , only : bounds_type - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - use glcBehaviorMod , only : glc_behavior_type - ! - ! PUBLIC TYPES: - implicit none - save - - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: init_subgrid_weights_mod ! initialize stuff in this module - public :: compute_higher_order_weights ! given p2c, c2l and l2g weights, compute other weights - public :: set_active ! set 'active' flags at pft, column & landunit level - public :: check_weights ! check subgrid weights - public :: get_landunit_weight ! get the weight of a given landunit on a single grid cell - public :: set_landunit_weight ! set the weight of a given landunit on a single grid cell - public :: is_gcell_all_ltypeX ! determine whether a grid cell is 100% covered by the given landunit type - public :: set_subgrid_diagnostic_fields ! set all subgrid weights diagnostic fields - ! - ! !REVISION HISTORY: - ! Created by Bill Sacks - ! - ! !PRIVATE TYPES: - type subgrid_weights_diagnostics_type - ! This type contains diagnostics on subgrid weights, for output to the history file - real(r8), pointer :: pct_landunit(:,:) ! % of each landunit on the grid cell [begg:endg, 1:max_lunit] - real(r8), pointer :: pct_nat_pft(:,:) ! % of each pft, as % of landunit [begg:endg, natpft_lb:natpft_ub] - real(r8), pointer :: pct_cft(:,:) ! % of each crop functional type, as % of landunit [begg:endg, cft_lb:cft_ub] - real(r8), pointer :: pct_glc_mec(:,:) ! % of each glacier elevation class, as % of landunit [begg:endg, 1:maxpatch_glcmec] - end type subgrid_weights_diagnostics_type - - type(subgrid_weights_diagnostics_type) :: subgrid_weights_diagnostics - - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: is_active_l ! determine whether the given landunit is active - private :: is_active_c ! determine whether the given column is active - private :: is_active_p ! determine whether the given patch is active - private :: weights_okay ! determine if sum of weights satisfies requirements laid out above - private :: set_pct_landunit_diagnostics ! set pct_landunit diagnostic field - private :: set_pct_glc_mec_diagnostics ! set pct_glc_mec diagnostic field - private :: set_pct_pft_diagnostics ! set pct_nat_pft & pct_cft diagnostic fields - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine init_subgrid_weights_mod(bounds) - ! - ! !DESCRIPTION: - ! Initialize stuff in this module - ! - ! !USES: - use landunit_varcon, only : max_lunit - use clm_varpar , only : maxpatch_glcmec, natpft_size, cft_size - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : BOUNDS_LEVEL_PROC - use histFileMod , only : hist_addfld2d - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! proc bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'init_subgrid_weights_mod' - !----------------------------------------------------------------------- - - SHR_ASSERT(bounds%level == BOUNDS_LEVEL_PROC, errMsg(sourcefile, __LINE__)) - - ! ------------------------------------------------------------------------ - ! Allocate variables in subgrid_weights_diagnostics - ! ------------------------------------------------------------------------ - - ! Note that, because these variables are output to the history file, it appears that - ! their lower bounds need to start at 1 (e.g., 1:natpft_size rather than - ! natpft_lb:natpft_ub) - allocate(subgrid_weights_diagnostics%pct_landunit(bounds%begg:bounds%endg, 1:max_lunit)) - subgrid_weights_diagnostics%pct_landunit(:,:) = nan - allocate(subgrid_weights_diagnostics%pct_nat_pft(bounds%begg:bounds%endg, 1:natpft_size)) - subgrid_weights_diagnostics%pct_nat_pft(:,:) = nan - allocate(subgrid_weights_diagnostics%pct_cft(bounds%begg:bounds%endg, 1:cft_size)) - subgrid_weights_diagnostics%pct_cft(:,:) = nan - allocate(subgrid_weights_diagnostics%pct_glc_mec(bounds%begg:bounds%endg, 1:maxpatch_glcmec)) - subgrid_weights_diagnostics%pct_glc_mec(:,:) = nan - - ! ------------------------------------------------------------------------ - ! Add history fields - ! ------------------------------------------------------------------------ - - call hist_addfld2d (fname='PCT_LANDUNIT', units='%', type2d='ltype', & - avgflag='A', long_name='% of each landunit on grid cell', & - ptr_lnd=subgrid_weights_diagnostics%pct_landunit) - - if(.not.use_fates) then - call hist_addfld2d (fname='PCT_NAT_PFT', units='%', type2d='natpft', & - avgflag='A', long_name='% of each PFT on the natural vegetation (i.e., soil) landunit', & - ptr_lnd=subgrid_weights_diagnostics%pct_nat_pft) - end if - - if (cft_size > 0) then - call hist_addfld2d (fname='PCT_CFT', units='%', type2d='cft', & - avgflag='A', long_name='% of each crop on the crop landunit', & - ptr_lnd=subgrid_weights_diagnostics%pct_cft) - end if - - call hist_addfld2d (fname='PCT_GLC_MEC', units='%', type2d='glc_nec', & - avgflag='A', long_name='% of each GLC elevation class on the glc_mec landunit', & - ptr_lnd=subgrid_weights_diagnostics%pct_glc_mec) - - end subroutine init_subgrid_weights_mod - - - !----------------------------------------------------------------------- - subroutine compute_higher_order_weights(bounds) - ! - ! !DESCRIPTION: - ! Assuming patch%wtcol, col%wtlunit and lun%wtgcell have already been computed, compute - ! the "higher-order" weights: patch%wtlunit, patch%wtgcell and col%wtgcell, for all p and c - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! clump bounds - ! - ! !LOCAL VARIABLES: - integer :: p, c, l ! indices for pft, col & landunit - !------------------------------------------------------------------------ - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - col%wtgcell(c) = col%wtlunit(c) * lun%wtgcell(l) - end do - - do p = bounds%begp, bounds%endp - c = patch%column(p) - patch%wtlunit(p) = patch%wtcol(p) * col%wtlunit(c) - patch%wtgcell(p) = patch%wtcol(p) * col%wtgcell(c) - end do - end subroutine compute_higher_order_weights - - !----------------------------------------------------------------------- - subroutine set_active(bounds, glc_behavior) - ! - ! !DESCRIPTION: - ! Set 'active' flags at the pft, column and landunit level - ! (note that grid cells are always active) - ! - ! This should be called whenever any weights change (e.g., patch weights on the column, - ! landunit weights on the grid cell, etc.). - ! - ! Ensures that we don't have any active patch on an inactive column, or an active column on an - ! inactive landunit (since these conditions could lead to garbage data) - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: l,c,p ! loop counters - - character(len=*), parameter :: subname = 'set_active' - !------------------------------------------------------------------------ - - do l = bounds%begl,bounds%endl - lun%active(l) = is_active_l(l, glc_behavior) - end do - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - col%active(c) = is_active_c(c, glc_behavior) - if (col%active(c) .and. .not. lun%active(l)) then - write(iulog,*) trim(subname),' ERROR: active column found on inactive landunit', & - 'at c = ', c, ', l = ', l - call endrun(decomp_index=c, clmlevel=namec, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - do p = bounds%begp,bounds%endp - c = patch%column(p) - patch%active(p) = is_active_p(p) - if (patch%active(p) .and. .not. col%active(c)) then - write(iulog,*) trim(subname),' ERROR: active patch found on inactive column', & - 'at p = ', p, ', c = ', c - call endrun(decomp_index=p, clmlevel=namep, msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine set_active - - !----------------------------------------------------------------------- - logical function is_active_l(l, glc_behavior) - ! - ! !DESCRIPTION: - ! Determine whether the given landunit is active - ! - ! !USES: - use landunit_varcon, only : istsoil, istice_mec, isturb_MIN, isturb_MAX - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: l ! landunit index - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: g ! grid cell index - !------------------------------------------------------------------------ - - if (all_active) then - is_active_l = .true. - - else - g =lun%gridcell(l) - - is_active_l = .false. - - ! ------------------------------------------------------------------------ - ! General conditions under which is_active_l NEEDS to be true in order to satisfy - ! the requirements laid out at the top of this module: - ! ------------------------------------------------------------------------ - if (lun%wtgcell(l) > 0) is_active_l = .true. - - ! ------------------------------------------------------------------------ - ! Conditions under which is_active_p is set to true because we want extra virtual landunits: - ! ------------------------------------------------------------------------ - - if (lun%itype(l) == istice_mec .and. & - glc_behavior%has_virtual_columns_grc(g)) then - is_active_l = .true. - end if - - if ((lun%itype(l) >= isturb_MIN .and. lun%itype(l) <= isturb_MAX) .and. & - run_zero_weight_urban) then - is_active_l = .true. - end if - - ! In general, include a virtual natural vegetation landunit. This aids - ! initialization of a new landunit; and for runs that are coupled to CISM, this - ! provides bare land SMB forcing even if there is no vegetated area. - ! - ! Also (echoing the similar comment in glcBehaviorMod): We need all glacier and - ! vegetated points to be active in the icemask region for the sake of init_interp - - ! since we only interpolate onto active points, and we don't know which points will - ! have non-zero area until after initialization (as long as we can't send - ! information from glc to clm in initialization). (If we had an inactive vegetated - ! point in the icemask region, according to the weights on the surface dataset, and - ! ran init_interp, this point would keep its cold start initialization - ! values. Then, in the first time step of the run loop, it's possible that this - ! point would become active because, according to glc, there is actually > 0% bare - ! ground in that grid cell. We don't do any state / flux adjustments in the first - ! time step after init_interp due to glacier area changes, so this vegetated column - ! would remain at its cold start initialization values, which would be a Bad - ! Thing. Ensuring that all vegetated points within the icemask are active gets - ! around this problem - as well as having other benefits, as noted above.) - if (lun%itype(l) == istsoil) then - is_active_l = .true. - end if - - end if - - end function is_active_l - - !----------------------------------------------------------------------- - logical function is_active_c(c, glc_behavior) - ! - ! !DESCRIPTION: - ! Determine whether the given column is active - ! - ! !USES: - use landunit_varcon, only : istice_mec, isturb_MIN, isturb_MAX - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: c ! column index - type(glc_behavior_type), intent(in) :: glc_behavior - ! - ! !LOCAL VARIABLES: - integer :: l ! landunit index - integer :: g ! grid cell index - !------------------------------------------------------------------------ - - if (all_active) then - is_active_c = .true. - - else - l =col%landunit(c) - g =col%gridcell(c) - - is_active_c = .false. - - ! ------------------------------------------------------------------------ - ! General conditions under which is_active_c NEEDS to be true in order to satisfy - ! the requirements laid out at the top of this module: - ! ------------------------------------------------------------------------ - if (lun%active(l) .and. col%wtlunit(c) > 0._r8) is_active_c = .true. - - ! ------------------------------------------------------------------------ - ! Conditions under which is_active_c is set to true because we want extra virtual columns: - ! ------------------------------------------------------------------------ - - if (lun%itype(l) == istice_mec .and. & - glc_behavior%has_virtual_columns_grc(g)) then - is_active_c = .true. - end if - - ! We don't really need to run over 0-weight urban columns. But because of some - ! messiness in the urban code (many loops are over the landunit filter, then drill - ! down to columns - so we would need to add 'col%active(c)' conditionals in many - ! places) it keeps the code cleaner to run over 0-weight urban columns. This generally - ! shouldn't add much computation time, since in most places, all urban columns are - ! non-zero weight if the landunit is non-zero weight. - if (lun%active(l) .and. (lun%itype(l) >= isturb_MIN .and. lun%itype(l) <= isturb_MAX)) then - is_active_c = .true. - end if - end if - - end function is_active_c - - !----------------------------------------------------------------------- - logical function is_active_p(p) - ! - ! !DESCRIPTION: - ! Determine whether the given patch is active - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: p ! patch index - ! - ! !LOCAL VARIABLES: - integer :: c ! column index - !------------------------------------------------------------------------ - - if (all_active) then - is_active_p = .true. - - else - c =patch%column(p) - - is_active_p = .false. - - ! ------------------------------------------------------------------------ - ! General conditions under which is_active_p NEEDS to be true in order to satisfy - ! the requirements laid out at the top of this module: - ! ------------------------------------------------------------------------ - if (col%active(c) .and. patch%wtcol(p) > 0._r8) is_active_p = .true. - - end if - - end function is_active_p - - !----------------------------------------------------------------------- - function get_landunit_weight(g, ltype) result(weight) - ! - ! !DESCRIPTION: - ! Get the subgrid weight of a given landunit type on a single grid cell - ! - ! !USES: - use clm_varcon, only : ispval - ! - ! !ARGUMENTS: - real(r8) :: weight ! function result - integer , intent(in) :: g ! grid cell index - integer , intent(in) :: ltype ! landunit type of interest - ! - ! !LOCAL VARIABLES: - integer :: l ! landunit index - - character(len=*), parameter :: subname = 'get_landunit_weight' - !----------------------------------------------------------------------- - - l = grc%landunit_indices(ltype, g) - if (l == ispval) then - weight = 0._r8 - else - weight = lun%wtgcell(l) - end if - - end function get_landunit_weight - - !----------------------------------------------------------------------- - subroutine set_landunit_weight(g, ltype, weight) - ! - ! !DESCRIPTION: - ! Set the subgrid weight of a given landunit type on a single grid cell - ! - ! !USES: - use clm_varcon, only : ispval - ! - ! !ARGUMENTS: - integer , intent(in) :: g ! grid cell index - integer , intent(in) :: ltype ! landunit type of interest - real(r8), intent(in) :: weight ! new weight of this landunit - ! - ! !LOCAL VARIABLES: - integer :: l ! landunit index - - character(len=*), parameter :: subname = 'set_landunit_weight' - !----------------------------------------------------------------------- - - l = grc%landunit_indices(ltype, g) - if (l /= ispval) then - lun%wtgcell(l) = weight - else if (weight > 0._r8) then - write(iulog,*) subname//' ERROR: Attempt to assign non-zero weight to a non-existent landunit' - write(iulog,*) 'g, l, ltype, weight = ', g, l, ltype, weight - call endrun(decomp_index=l, clmlevel=namel, msg=errMsg(sourcefile, __LINE__)) - end if - - end subroutine set_landunit_weight - - - !----------------------------------------------------------------------- - function is_gcell_all_ltypeX(g, ltype) result(all_ltypeX) - ! - ! !DESCRIPTION: - ! Determine if the given grid cell is 100% covered by the landunit type given by ltype - ! - ! !USES: - ! - ! !ARGUMENTS: - implicit none - logical :: all_ltypeX ! function result - integer, intent(in) :: g ! grid cell index - integer, intent(in) :: ltype ! landunit type of interest - ! - ! !LOCAL VARIABLES: - real(r8) :: wt_lunit ! subgrid weight of the given landunit - - real(r8), parameter :: tolerance = 1.e-13_r8 ! tolerance for checking whether landunit's weight is 1 - character(len=*), parameter :: subname = 'is_gcell_all_ltypeX' - !------------------------------------------------------------------------------ - - wt_lunit = get_landunit_weight(g, ltype) - if (wt_lunit >= (1._r8 - tolerance)) then - all_ltypeX = .true. - else - all_ltypeX = .false. - end if - - end function is_gcell_all_ltypeX - - !------------------------------------------------------------------------------ - subroutine check_weights (bounds, active_only) - ! - ! !DESCRIPTION: - ! Check subgrid weights. - ! - ! This routine operates in two different modes, depending on the value of active_only. If - ! active_only is true, then we check the sum of weights of the ACTIVE children, - ! grandchildren, etc. of a given point. If active_only is false, then we check the sum of - ! weights of ALL children, grandchildren, etc. of a given point. - ! - ! Normally this routine will be called twice: once with active_only=false, and once with - ! active_only=true. - ! - ! !USES - ! - ! !ARGUMENTS - implicit none - type(bounds_type), intent(in) :: bounds ! bounds - logical, intent(in) :: active_only ! true => check sum of weights just of ACTIVE children, grandchildren, etc. - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p ! loop counters - real(r8), allocatable :: sumwtcol(:), sumwtlunit(:), sumwtgcell(:) - logical :: error_found ! true if we find an error - character(len=*), parameter :: subname = 'check_weights' - !------------------------------------------------------------------------------ - - allocate(sumwtcol(bounds%begc:bounds%endc)) - allocate(sumwtlunit(bounds%begl:bounds%endl)) - allocate(sumwtgcell(bounds%begg:bounds%endg)) - - error_found = .false. - - ! Check patch-level weights - sumwtcol(bounds%begc : bounds%endc) = 0._r8 - sumwtlunit(bounds%begl : bounds%endl) = 0._r8 - sumwtgcell(bounds%begg : bounds%endg) = 0._r8 - - do p = bounds%begp,bounds%endp - c = patch%column(p) - l = patch%landunit(p) - g = patch%gridcell(p) - - if ((active_only .and. patch%active(p)) .or. .not. active_only) then - sumwtcol(c) = sumwtcol(c) + patch%wtcol(p) - sumwtlunit(l) = sumwtlunit(l) + patch%wtlunit(p) - sumwtgcell(g) = sumwtgcell(g) + patch%wtgcell(p) - end if - end do - - do c = bounds%begc,bounds%endc - if (.not. weights_okay(sumwtcol(c), active_only, col%active(c))) then - write(iulog,*) trim(subname),' ERROR: at c = ',c,'total PFT weight is ',sumwtcol(c), & - 'active_only = ', active_only - error_found = .true. - end if - end do - - do l = bounds%begl,bounds%endl - if (.not. weights_okay(sumwtlunit(l), active_only, lun%active(l))) then - write(iulog,*) trim(subname),' ERROR: at l = ',l,'total PFT weight is ',sumwtlunit(l), & - 'active_only = ', active_only - error_found = .true. - end if - end do - - do g = bounds%begg,bounds%endg - if (.not. weights_okay(sumwtgcell(g), active_only, i_am_active=.true.)) then - write(iulog,*) trim(subname),' ERROR: at g = ',g,'total PFT weight is ',sumwtgcell(g), & - 'active_only = ', active_only - error_found = .true. - end if - end do - - ! Check col-level weights - sumwtlunit(bounds%begl : bounds%endl) = 0._r8 - sumwtgcell(bounds%begg : bounds%endg) = 0._r8 - - do c = bounds%begc,bounds%endc - l = col%landunit(c) - g = col%gridcell(c) - - if ((active_only .and. col%active(c)) .or. .not. active_only) then - sumwtlunit(l) = sumwtlunit(l) + col%wtlunit(c) - sumwtgcell(g) = sumwtgcell(g) + col%wtgcell(c) - end if - end do - - do l = bounds%begl,bounds%endl - if (.not. weights_okay(sumwtlunit(l), active_only, lun%active(l))) then - write(iulog,*) trim(subname),' ERROR: at l = ',l,'total col weight is ',sumwtlunit(l), & - 'active_only = ', active_only - error_found = .true. - end if - end do - - do g = bounds%begg,bounds%endg - if (.not. weights_okay(sumwtgcell(g), active_only, i_am_active=.true.)) then - write(iulog,*) trim(subname),' ERROR: at g = ',g,'total col weight is ',sumwtgcell(g), & - 'active_only = ', active_only - error_found = .true. - end if - end do - - ! Check landunit-level weights - sumwtgcell(bounds%begg : bounds%endg) = 0._r8 - - do l = bounds%begl,bounds%endl - g = lun%gridcell(l) - if ((active_only .and. lun%active(l)) .or. .not. active_only) then - sumwtgcell(g) = sumwtgcell(g) + lun%wtgcell(l) - end if - end do - - do g = bounds%begg,bounds%endg - if (.not. weights_okay(sumwtgcell(g), active_only, i_am_active=.true.)) then - write(iulog,*) trim(subname),' ERROR: at g = ',g,'total lunit weight is ',sumwtgcell(g), & - 'active_only = ', active_only - error_found = .true. - end if - end do - - deallocate(sumwtcol, sumwtlunit, sumwtgcell) - - if (error_found) then - write(iulog,*) ' ' - write(iulog,*) 'If you are seeing this message at the beginning of a run with' - write(iulog,*) 'use_init_interp = .true. and init_interp_method = "use_finidat_areas",' - write(iulog,*) 'and you are seeing weights less than 1, then a likely cause is:' - write(iulog,*) 'For the above-mentioned grid cell(s):' - write(iulog,*) 'The matching input grid cell had some non-zero-weight subgrid type' - write(iulog,*) 'that is not present in memory in the new run.' - write(iulog,*) ' ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Success - - end subroutine check_weights - - !----------------------------------------------------------------------- - logical function weights_okay(sumwts, active_weights_only, i_am_active) - ! - ! !DESCRIPTION: - ! Determine if sumwts (the sum of weights of children, grandchildren or - ! great-grandchildren of a column, landunit or grid cell) satisfies the requirements laid - ! out above. - ! - ! The way this is determined depends on the values of two other variables: - ! - active_weights_only: does sumwts just include weights of active children, - ! grandchildren or great-grandchilden? (alternative is that it includes weights of ALL - ! children, grandchildren or great-grandchildren) - ! - i_am_active: true if the column, landunit or grid cell of interest is active - ! - ! !ARGUMENTS: - implicit none - real(r8), intent(in) :: sumwts ! sum of weights of children, grandchildren or great-grandchildren - logical , intent(in) :: active_weights_only ! true if sumwts just includes active children, etc. - logical , intent(in) :: i_am_active ! true if the current point is active - ! - ! !LOCAL VARIABLES: - logical :: weights_equal_1 - real(r8), parameter :: tolerance = 1.e-12_r8 ! tolerance for checking whether weights sum to 1 - !------------------------------------------------------------------------ - - weights_equal_1 = (abs(sumwts - 1._r8) <= tolerance) - - if (active_weights_only) then - if (i_am_active) then ! condition (2) above - weights_okay = weights_equal_1 - else ! condition (3) above - weights_okay = (sumwts == 0._r8 .or. weights_equal_1) - end if - else ! condition (1) above - ! (note that i_am_active is irrelevant in this case) - weights_okay = weights_equal_1 - end if - - end function weights_okay - - !----------------------------------------------------------------------- - subroutine set_subgrid_diagnostic_fields(bounds) - ! - ! !DESCRIPTION: - ! Set history fields giving diagnostics about subgrid weights - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'set_subgrid_diagnostic_fields' - !----------------------------------------------------------------------- - - call set_pct_landunit_diagnostics(bounds) - - ! Note: (MV, 10-17-14): The following has an use_fates if-block around it since - ! the pct_pft_diagnostics referens to patch%itype(p) which is not used by ED - ! Note: (SPM, 10-20-15): If this isn't set then debug mode with intel and - ! yellowstone will fail when trying to write pct_nat_pft since it contains - ! all NaN's. - call set_pct_pft_diagnostics(bounds) - - call set_pct_glc_mec_diagnostics(bounds) - - end subroutine set_subgrid_diagnostic_fields - - !----------------------------------------------------------------------- - subroutine set_pct_landunit_diagnostics(bounds) - ! - ! !DESCRIPTION: - ! Set pct_landunit diagnostic field: % of each landunit on the grid cell - ! - ! !USES: - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g, l ! grid cell & landunit indices - integer :: ltype ! landunit type - - character(len=*), parameter :: subname = 'set_pct_landunit_diagnostics' - !----------------------------------------------------------------------- - - subgrid_weights_diagnostics%pct_landunit(bounds%begg:bounds%endg, :) = 0._r8 - - do l = bounds%begl, bounds%endl - g = lun%gridcell(l) - ltype = lun%itype(l) - subgrid_weights_diagnostics%pct_landunit(g, ltype) = lun%wtgcell(l) * 100._r8 - end do - - end subroutine set_pct_landunit_diagnostics - - !----------------------------------------------------------------------- - subroutine set_pct_glc_mec_diagnostics(bounds) - ! - ! !DESCRIPTION: - ! Set pct_glc_mec diagnostic field: % of each glc_mec column on the glc_mec landunit - ! - ! Note: it's safe to call this even if we're not running with glc_mec, but in that - ! case it won't do anything. - ! - ! Note that pct_glc_mec will be 0 for all elevation classes in a grid cell that does - ! not have a glc_mec landunit. However, it will still sum to 100% for a grid cell - ! that has a 0-weight (i.e., virtual) glc_mec landunit. - ! - ! !USES: - use landunit_varcon, only : istice_mec - use column_varcon, only : col_itype_to_icemec_class - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l,g ! indices - integer :: icemec_class ! icemec class (1..maxpatch_glcmec) - - character(len=*), parameter :: subname = 'set_pct_glc_mec_diagnostics' - !----------------------------------------------------------------------- - - subgrid_weights_diagnostics%pct_glc_mec(bounds%begg:bounds%endg, :) = 0._r8 - - do c = bounds%begc, bounds%endc - g = col%gridcell(c) - l = col%landunit(c) - if (lun%itype(l) == istice_mec) then - icemec_class = col_itype_to_icemec_class(col%itype(c)) - subgrid_weights_diagnostics%pct_glc_mec(g, icemec_class) = col%wtlunit(c) * 100._r8 - end if - end do - - end subroutine set_pct_glc_mec_diagnostics - - !----------------------------------------------------------------------- - subroutine set_pct_pft_diagnostics(bounds) - ! - ! !DESCRIPTION: - ! Set pct_nat_pft & pct_cft diagnostic fields: % of PFTs on their landunit - ! - ! !USES: - use landunit_varcon, only : istsoil, istcrop - use clm_varpar, only : natpft_lb, cft_lb - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: p,l,g ! indices - integer :: ptype ! patch itype - integer :: ptype_1indexing ! patch itype, translated into 1-indexing for the given landunit type - - character(len=*), parameter :: subname = 'set_pct_pft_diagnostics' - !----------------------------------------------------------------------- - - subgrid_weights_diagnostics%pct_nat_pft(bounds%begg:bounds%endg, :) = 0._r8 - - ! Note that pct_cft will be 0-size if cft_size is 0 (which can happen if we don't - ! have a crop landunit). But it doesn't hurt to have this line setting all elements - ! to 0, and doing this always allows us to avoid extra logic which could be a - ! maintenance problem. - subgrid_weights_diagnostics%pct_cft(bounds%begg:bounds%endg, :) = 0._r8 - - do p = bounds%begp,bounds%endp - g = patch%gridcell(p) - l = patch%landunit(p) - ptype = patch%itype(p) - if (lun%itype(l) == istsoil .and. (.not.use_fates) ) then - ptype_1indexing = ptype + (1 - natpft_lb) - subgrid_weights_diagnostics%pct_nat_pft(g, ptype_1indexing) = patch%wtlunit(p) * 100._r8 - else if (lun%itype(l) == istcrop) then - ptype_1indexing = ptype + (1 - cft_lb) - subgrid_weights_diagnostics%pct_cft(g, ptype_1indexing) = patch%wtlunit(p) * 100._r8 - end if - end do - - end subroutine set_pct_pft_diagnostics - -end module subgridWeightsMod diff --git a/src/main/surfrdMod.F90 b/src/main/surfrdMod.F90 deleted file mode 100644 index ef593b1a6e..0000000000 --- a/src/main/surfrdMod.F90 +++ /dev/null @@ -1,819 +0,0 @@ -module surfrdMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains methods for reading in surface data file and determining - ! subgrid weights - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use clm_varpar , only : nlevsoifl, numpft - use landunit_varcon , only : numurbl - use clm_varcon , only : grlnd - use clm_varctl , only : iulog, scmlat, scmlon, single_column - use clm_varctl , only : use_cndv, use_crop - use surfrdUtilsMod , only : check_sums_equal_1, collapse_crop_types - use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile - use ncdio_pio , only : ncd_io, check_var, ncd_inqfdims, check_dim, ncd_inqdid - use pio - use spmdMod - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: surfrd_get_globmask ! Reads global land mask (needed for setting domain decomp) - public :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) - public :: surfrd_get_data ! Read surface dataset and determine subgrid weights - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: surfrd_special ! Read the special landunits - private :: surfrd_veg_all ! Read all of the vegetated landunits - private :: surfrd_veg_dgvm ! Read vegetated landunits for DGVM mode - private :: surfrd_pftformat ! Read crop pfts in file format where they are part of the vegetated land unit - private :: surfrd_cftformat ! Read crop pfts in file format where they are on their own landunit - ! - ! !PRIVATE DATA MEMBERS: - ! default multiplication factor for epsilon for error checks - real(r8), private, parameter :: eps_fact = 2._r8 - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine surfrd_get_globmask(filename, mask, ni, nj) - ! - ! !DESCRIPTION: - ! Read the surface dataset grid related information: - ! This is the first routine called by clm_initialize - ! NO DOMAIN DECOMPOSITION HAS BEEN SET YET - ! - ! !USES: - use fileutils , only : getfil - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: filename ! grid filename - integer , pointer :: mask(:) ! grid mask - integer , intent(out) :: ni, nj ! global grid sizes - ! - ! !LOCAL VARIABLES: - logical :: isgrid2d - integer :: dimid,varid ! netCDF id's - integer :: ns ! size of grid on file - integer :: n,i,j ! index - integer :: ier ! error status - type(file_desc_t) :: ncid ! netcdf id - type(var_desc_t) :: vardesc ! variable descriptor - character(len=256) :: varname ! variable name - character(len=256) :: locfn ! local file name - logical :: readvar ! read variable in or not - integer , allocatable :: idata2d(:,:) - character(len=32) :: subname = 'surfrd_get_globmask' ! subroutine name - !----------------------------------------------------------------------- - - if (filename == ' ') then - mask(:) = 1 - RETURN - end if - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions and if grid file is 2d or 1d - - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - if (masterproc) then - write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d - end if - - allocate(mask(ns)) - mask(:) = 1 - - if (isgrid2d) then - allocate(idata2d(ni,nj)) - idata2d(:,:) = 1 - call ncd_io(ncid=ncid, varname='LANDMASK', data=idata2d, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) - end if - if (readvar) then - do j = 1,nj - do i = 1,ni - n = (j-1)*ni + i - mask(n) = idata2d(i,j) - enddo - enddo - end if - deallocate(idata2d) - else - call ncd_io(ncid=ncid, varname='LANDMASK', data=mask, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) - end if - end if - if (.not. readvar) call endrun( msg=' ERROR: landmask not on fatmlndfrc file'//errMsg(sourcefile, __LINE__)) - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_globmask - - !----------------------------------------------------------------------- - subroutine surfrd_get_grid(begg, endg, ldomain, filename, glcfilename) - ! - ! !DESCRIPTION: - ! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED - ! Read the surface dataset grid related information: - ! o real latitude of grid cell (degrees) - ! o real longitude of grid cell (degrees) - ! - ! !USES: - use clm_varcon, only : spval, re - use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d - use fileutils , only : getfil - ! - ! !ARGUMENTS: - integer ,intent(in) :: begg, endg - type(domain_type),intent(inout) :: ldomain ! domain to init - character(len=*) ,intent(in) :: filename ! grid filename - character(len=*) ,optional, intent(in) :: glcfilename ! glc mask filename - ! - ! !LOCAL VARIABLES: - type(file_desc_t) :: ncid ! netcdf id - type(var_desc_t) :: vardesc ! variable descriptor - integer :: beg ! local beg index - integer :: end ! local end index - integer :: ni,nj,ns ! size of grid on file - integer :: dimid,varid ! netCDF id's - integer :: start(1), count(1) ! 1d lat/lon array sections - integer :: ier,ret ! error status - logical :: readvar ! true => variable is on input file - logical :: isgrid2d ! true => file is 2d lat/lon - logical :: istype_domain ! true => input file is of type domain - real(r8), allocatable :: rdata2d(:,:) ! temporary - character(len=16) :: vname ! temporary - character(len=256):: locfn ! local file name - integer :: n ! indices - real(r8):: eps = 1.0e-12_r8 ! lat/lon error tolerance - character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name -!----------------------------------------------------------------------- - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - - ! Determine isgrid2d flag for domain - call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=begg, nend=endg) - - ! Determine type of file - old style grid file or new style domain file - call check_var(ncid=ncid, varname='LONGXY', vardesc=vardesc, readvar=readvar) - if (readvar) istype_domain = .false. - - call check_var(ncid=ncid, varname='xc', vardesc=vardesc, readvar=readvar) - if (readvar) istype_domain = .true. - - ! Read in area, lon, lat - - if (istype_domain) then - call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, & - dim1name=grlnd, readvar=readvar) - ! convert from radians**2 to km**2 - ldomain%area = ldomain%area * (re**2) - if (.not. readvar) call endrun( msg=' ERROR: area NOT on file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname= 'xc', flag='read', data=ldomain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: xc NOT on file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname= 'yc', flag='read', data=ldomain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: yc NOT on file'//errMsg(sourcefile, __LINE__)) - else - call ncd_io(ncid=ncid, varname= 'AREA', flag='read', data=ldomain%area, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: AREA NOT on file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname= 'LONGXY', flag='read', data=ldomain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: LONGXY NOT on file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname= 'LATIXY', flag='read', data=ldomain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: LATIXY NOT on file'//errMsg(sourcefile, __LINE__)) - end if - - if (isgrid2d) then - allocate(rdata2d(ni,nj), lon1d(ni), lat1d(nj)) - if (istype_domain) then - vname = 'xc' - else - vname = 'LONGXY' - end if - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lon1d(:) = rdata2d(:,1) - if (istype_domain) then - vname = 'yc' - else - vname = 'LATIXY' - end if - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lat1d(:) = rdata2d(1,:) - deallocate(rdata2d) - end if - - ! Check lat limited to -90,90 - - if (minval(ldomain%latc) < -90.0_r8 .or. & - maxval(ldomain%latc) > 90.0_r8) then - write(iulog,*) trim(subname),' WARNING: lat/lon min/max is ', & - minval(ldomain%latc),maxval(ldomain%latc) - ! call endrun( msg=' ERROR: lat is outside [-90,90]'//errMsg(sourcefile, __LINE__)) - ! write(iulog,*) trim(subname),' Limiting lat/lon to [-90/90] from ', & - ! minval(domain%latc),maxval(domain%latc) - ! where (ldomain%latc < -90.0_r8) ldomain%latc = -90.0_r8 - ! where (ldomain%latc > 90.0_r8) ldomain%latc = 90.0_r8 - endif - - call ncd_io(ncid=ncid, varname='LANDMASK', flag='read', data=ldomain%mask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', flag='read', data=ldomain%mask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: LANDMASK NOT on fracdata file'//errMsg(sourcefile, __LINE__)) - end if - end if - - call ncd_io(ncid=ncid, varname='LANDFRAC', flag='read', data=ldomain%frac, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='frac', flag='read', data=ldomain%frac, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( msg=' ERROR: LANDFRAC NOT on fracdata file'//errMsg(sourcefile, __LINE__)) - end if - end if - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_grid - - !----------------------------------------------------------------------- - subroutine surfrd_get_data (begg, endg, ldomain, lfsurdat) - ! - ! !DESCRIPTION: - ! Read the surface dataset and create subgrid weights. - ! The model's surface dataset recognizes 6 basic land cover types within a grid - ! cell: lake, wetland, urban, glacier, glacier_mec and vegetated. The vegetated - ! portion of the grid cell is comprised of up to [maxpatch_pft] patches. These - ! subgrid patches are read in explicitly for each grid cell. This is in - ! contrast to LSMv1, where the patches were built implicitly from biome types. - ! o real latitude of grid cell (degrees) - ! o real longitude of grid cell (degrees) - ! o integer surface type: 0 = ocean or 1 = land - ! o integer soil color (1 to 20) for use with soil albedos - ! o real soil texture, %sand, for thermal and hydraulic properties - ! o real soil texture, %clay, for thermal and hydraulic properties - ! o real % of cell covered by lake for use as subgrid patch - ! o real % of cell covered by wetland for use as subgrid patch - ! o real % of cell that is urban for use as subgrid patch - ! o real % of cell that is glacier for use as subgrid patch - ! o real % of cell that is glacier_mec for use as subgrid patch - ! o integer PFTs - ! o real % abundance PFTs (as a percent of vegetated area) - ! - ! !USES: - use clm_varctl , only : create_crop_landunit - use fileutils , only : getfil - use domainMod , only : domain_type, domain_init, domain_clean - use clm_instur , only : wt_lunit, topo_glc_mec - ! - ! !ARGUMENTS: - integer, intent(in) :: begg, endg - type(domain_type),intent(in) :: ldomain ! land domain - character(len=*), intent(in) :: lfsurdat ! surface dataset filename - ! - ! !LOCAL VARIABLES: - type(var_desc_t) :: vardesc ! pio variable descriptor - type(domain_type) :: surfdata_domain ! local domain associated with surface dataset - character(len=256):: locfn ! local file name - integer :: n ! loop indices - integer :: ni,nj,ns ! domain sizes - character(len=16) :: lon_var, lat_var ! names of lat/lon on dataset - logical :: readvar ! true => variable is on dataset - real(r8) :: rmaxlon,rmaxlat ! local min/max vars - type(file_desc_t) :: ncid ! netcdf id - logical :: istype_domain ! true => input file is of type domain - logical :: isgrid2d ! true => intut grid is 2d - character(len=32) :: subname = 'surfrd_get_data' ! subroutine name - !----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to read surface boundary data .....' - if (lfsurdat == ' ') then - write(iulog,*)'lfsurdat must be specified' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - endif - - wt_lunit(:,:) = 0._r8 - topo_glc_mec(:,:) = 0._r8 - - ! Read surface data - - call getfil( lfsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Read in patch mask - this variable is only on the surface dataset - but not - ! on the domain dataset - - call ncd_io(ncid=ncid, varname= 'PFTDATA_MASK', flag='read', data=ldomain%pftm, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: pftm NOT on surface dataset'//errMsg(sourcefile, __LINE__)) - - ! Check if fsurdat grid is "close" to fatmlndfrc grid, exit if lats/lon > 0.001 - - call check_var(ncid=ncid, varname='xc', vardesc=vardesc, readvar=readvar) - if (readvar) then - istype_domain = .true. - else - call check_var(ncid=ncid, varname='LONGXY', vardesc=vardesc, readvar=readvar) - if (readvar) then - istype_domain = .false. - else - call endrun( msg=' ERROR: unknown domain type'//errMsg(sourcefile, __LINE__)) - end if - end if - if (istype_domain) then - lon_var = 'xc' - lat_var = 'yc' - else - lon_var = 'LONGXY' - lat_var = 'LATIXY' - end if - if ( masterproc )then - write(iulog,*) trim(subname),' lon_var = ',trim(lon_var),' lat_var =',trim(lat_var) - end if - - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - call domain_init(surfdata_domain, isgrid2d, ni, nj, begg, endg, clmlevel=grlnd) - - call ncd_io(ncid=ncid, varname=lon_var, flag='read', data=surfdata_domain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: lon var NOT on surface dataset'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname=lat_var, flag='read', data=surfdata_domain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: lat var NOT on surface dataset'//errMsg(sourcefile, __LINE__)) - - rmaxlon = 0.0_r8 - rmaxlat = 0.0_r8 - do n = begg,endg - if (ldomain%lonc(n)-surfdata_domain%lonc(n) > 300.) then - rmaxlon = max(rmaxlon,abs(ldomain%lonc(n)-surfdata_domain%lonc(n)-360._r8)) - elseif (ldomain%lonc(n)-surfdata_domain%lonc(n) < -300.) then - rmaxlon = max(rmaxlon,abs(ldomain%lonc(n)-surfdata_domain%lonc(n)+360._r8)) - else - rmaxlon = max(rmaxlon,abs(ldomain%lonc(n)-surfdata_domain%lonc(n))) - endif - rmaxlat = max(rmaxlat,abs(ldomain%latc(n)-surfdata_domain%latc(n))) - enddo - if (rmaxlon > 0.001_r8 .or. rmaxlat > 0.001_r8) then - write(iulog,*)' ERROR: surfdata/fatmgrid lon/lat mismatch error', rmaxlon,rmaxlat - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - !~! TODO(SPM, 022015) - if we deallocate and clean ldomain here, then you - !~! get errors in htape_timeconst where the information is needed to write - !~! the *.h0* file - !~!call domain_clean(surfdata_domain) - - ! Obtain special landunit info - - call surfrd_special(begg, endg, ncid, ldomain%ns) - - ! Obtain vegetated landunit info - - call surfrd_veg_all(begg, endg, ncid, ldomain%ns) - - if (use_cndv) then - call surfrd_veg_dgvm(begg, endg) - end if - - call ncd_pio_closefile(ncid) - - call check_sums_equal_1(wt_lunit, begg, 'wt_lunit', subname) - - if ( masterproc )then - write(iulog,*) 'Successfully read surface boundary data' - write(iulog,*) - end if - - end subroutine surfrd_get_data - -!----------------------------------------------------------------------- - subroutine surfrd_special(begg, endg, ncid, ns) - ! - ! !DESCRIPTION: - ! Determine weight with respect to gridcell of all special "patches" as well - ! as soil color and percent sand and clay - ! - ! !USES: - use clm_varpar , only : maxpatch_glcmec, nlevurb - use landunit_varcon , only : isturb_MIN, isturb_MAX, istdlak, istwet, istice_mec - use clm_instur , only : wt_lunit, urban_valid, wt_glc_mec, topo_glc_mec - use UrbanParamsType , only : CheckUrban - ! - ! !ARGUMENTS: - integer , intent(in) :: begg, endg - type(file_desc_t), intent(inout) :: ncid ! netcdf id - integer , intent(in) :: ns ! domain size - ! - ! !LOCAL VARIABLES: - integer :: n,nl,nurb,g ! indices - integer :: dimid,varid ! netCDF id's - real(r8) :: nlevsoidata(nlevsoifl) - logical :: found ! temporary for error check - integer :: nindx ! temporary for error check - integer :: ier ! error status - logical :: readvar - real(r8),pointer :: pctgla(:) ! percent of grid cell is glacier - real(r8),pointer :: pctlak(:) ! percent of grid cell is lake - real(r8),pointer :: pctwet(:) ! percent of grid cell is wetland - real(r8),pointer :: pcturb(:,:) ! percent of grid cell is urbanized - integer ,pointer :: urban_region_id(:) - real(r8),pointer :: pcturb_tot(:) ! percent of grid cell is urban (sum over density classes) - real(r8),pointer :: pctspec(:) ! percent of spec lunits wrt gcell - integer :: dens_index ! urban density index - character(len=32) :: subname = 'surfrd_special' ! subroutine name - real(r8) closelat,closelon - integer, parameter :: urban_invalid_region = 0 ! urban_region_id indicating invalid point -!----------------------------------------------------------------------- - - allocate(pctgla(begg:endg)) - allocate(pctlak(begg:endg)) - allocate(pctwet(begg:endg)) - allocate(pcturb(begg:endg,numurbl)) - allocate(pcturb_tot(begg:endg)) - allocate(urban_region_id(begg:endg)) - allocate(pctspec(begg:endg)) - - call check_dim(ncid, 'nlevsoi', nlevsoifl) - - ! Obtain non-grid surface properties of surface dataset other than percent patch - - call ncd_io(ncid=ncid, varname='PCT_WETLAND', flag='read', data=pctwet, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_WETLAND NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='PCT_LAKE' , flag='read', data=pctlak, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_LAKE NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='PCT_GLACIER', flag='read', data=pctgla, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_GLACIER NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - ! Read urban info - if (nlevurb == 0) then - ! If PCT_URBAN is not multi-density then set pcturb to zero - pcturb = 0._r8 - urban_valid(begg:endg) = .false. - write(iulog,*)'PCT_URBAN is not multi-density, pcturb set to 0' - else - call ncd_io(ncid=ncid, varname='PCT_URBAN' , flag='read', data=pcturb, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_URBAN NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - call ncd_io(ncid=ncid, varname='URBAN_REGION_ID', flag='read', data=urban_region_id, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg= ' ERROR: URBAN_REGION_ID NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - where (urban_region_id == urban_invalid_region) - urban_valid = .false. - elsewhere - urban_valid = .true. - end where - end if - if ( nlevurb == 0 )then - if ( any(pcturb > 0.0_r8) ) then - call endrun( msg=' ERROR: PCT_URBAN MUST be zero when nlevurb=0'//errMsg(sourcefile, __LINE__)) - end if - end if - - pcturb_tot(:) = 0._r8 - do n = 1, numurbl - do nl = begg,endg - pcturb_tot(nl) = pcturb_tot(nl) + pcturb(nl,n) - enddo - enddo - - ! Read glacier info - - call check_dim(ncid, 'nglcec', maxpatch_glcmec ) - call check_dim(ncid, 'nglcecp1', maxpatch_glcmec+1 ) - - call ncd_io(ncid=ncid, varname='PCT_GLC_MEC', flag='read', data=wt_glc_mec, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_GLC_MEC NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - wt_glc_mec(:,:) = wt_glc_mec(:,:) / 100._r8 - call check_sums_equal_1(wt_glc_mec, begg, 'wt_glc_mec', subname) - - call ncd_io(ncid=ncid, varname='TOPO_GLC_MEC', flag='read', data=topo_glc_mec, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: TOPO_GLC_MEC NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - topo_glc_mec(:,:) = max(topo_glc_mec(:,:), 0._r8) - - pctspec = pctwet + pctlak + pcturb_tot + pctgla - - ! Error check: glacier, lake, wetland, urban sum must be less than 100 - - found = .false. - do nl = begg,endg - if (pctspec(nl) > 100._r8+1.e-04_r8) then - found = .true. - nindx = nl - exit - end if - if (found) exit - end do - if ( found ) then - write(iulog,*)'surfrd error: patch cover>100 for nl=',nindx - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - ! Determine wt_lunit for special landunits - - do nl = begg,endg - - wt_lunit(nl,istdlak) = pctlak(nl)/100._r8 - - wt_lunit(nl,istwet) = pctwet(nl)/100._r8 - - wt_lunit(nl,istice_mec) = pctgla(nl)/100._r8 - - do n = isturb_MIN, isturb_MAX - dens_index = n - isturb_MIN + 1 - wt_lunit(nl,n) = pcturb(nl,dens_index) / 100._r8 - end do - - end do - - call CheckUrban(begg, endg, pcturb(begg:endg,:), subname) - - deallocate(pctgla,pctlak,pctwet,pcturb,pcturb_tot,urban_region_id,pctspec) - - end subroutine surfrd_special - -!----------------------------------------------------------------------- - subroutine surfrd_cftformat( ncid, begg, endg, wt_cft, cftsize, natpft_size ) - ! - ! !DESCRIPTION: - ! Handle generic crop types for file format where they are on their own - ! crop landunit and read in as Crop Function Types. - ! !USES: - use clm_instur , only : fert_cft, wt_nat_patch - use clm_varpar , only : cft_size, cft_lb, natpft_lb - ! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid ! netcdf id - integer , intent(in) :: begg, endg - integer , intent(in) :: cftsize ! CFT size - real(r8), pointer, intent(inout) :: wt_cft(:,:) ! CFT weights - integer , intent(in) :: natpft_size ! natural PFT size - ! - ! !LOCAL VARIABLES: - logical :: readvar ! is variable on dataset - real(r8),pointer :: array2D(:,:) ! local array - character(len=32) :: subname = 'surfrd_cftformat'! subroutine name -!----------------------------------------------------------------------- - SHR_ASSERT_ALL((lbound(wt_cft) == (/begg, cft_lb/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wt_cft, dim=1) == (/endg/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wt_cft, dim=2) >= (/cftsize+1-cft_lb/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wt_nat_patch) >= (/endg,natpft_size-1+natpft_lb/)), errMsg(sourcefile, __LINE__)) - - call check_dim(ncid, 'cft', cftsize) - call check_dim(ncid, 'natpft', natpft_size) - - call ncd_io(ncid=ncid, varname='PCT_CFT', flag='read', data=wt_cft, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_CFT NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - if ( cft_size > 0 )then - call ncd_io(ncid=ncid, varname='CONST_FERTNITRO_CFT', flag='read', data=fert_cft, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - if ( masterproc ) & - write(iulog,*) ' WARNING: CONST_FERTNITRO_CFT NOT on surfdata file zero out' - fert_cft = 0.0_r8 - end if - else - fert_cft = 0.0_r8 - end if - - allocate( array2D(begg:endg,1:natpft_size) ) - call ncd_io(ncid=ncid, varname='PCT_NAT_PFT', flag='read', data=array2D, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_NAT_PFT NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - wt_nat_patch(begg:,natpft_lb:natpft_size-1+natpft_lb) = array2D(begg:,:) - deallocate( array2D ) - - end subroutine surfrd_cftformat - -!----------------------------------------------------------------------- - subroutine surfrd_pftformat( begg, endg, ncid ) - ! - ! !DESCRIPTION: - ! Handle generic crop types for file format where they are part of the - ! natural vegetation landunit. - ! !USES: - use clm_instur , only : fert_cft, wt_nat_patch - use clm_varpar , only : natpft_size, cft_size, natpft_lb - ! !ARGUMENTS: - implicit none - integer, intent(in) :: begg, endg - type(file_desc_t), intent(inout) :: ncid ! netcdf id - ! - ! !LOCAL VARIABLES: - logical :: cft_dim_exists ! does the dimension 'cft' exist on the dataset? - integer :: dimid ! netCDF id's - logical :: readvar ! is variable on dataset - character(len=32) :: subname = 'surfrd_pftformat'! subroutine name -!----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(wt_nat_patch) == (/endg, natpft_size-1+natpft_lb/)), errMsg(sourcefile, __LINE__)) - - call check_dim(ncid, 'natpft', natpft_size) - ! If cft_size == 0, then we expect to be running with a surface dataset - ! that does - ! NOT have a PCT_CFT array (or CONST_FERTNITRO_CFT array), and thus does not have a 'cft' dimension. - ! Make sure - ! that's the case. - call ncd_inqdid(ncid, 'cft', dimid, cft_dim_exists) - if (cft_dim_exists) then - call endrun( msg= ' ERROR: unexpectedly found cft dimension on dataset when cft_size=0'// & - ' (if the surface dataset has a separate crop landunit, then the code'// & - ' must also have a separate crop landunit, and vice versa)'//& - errMsg(sourcefile, __LINE__)) - end if - call ncd_io(ncid=ncid, varname='CONST_FERTNITRO_CFT', flag='read', data=fert_cft, & - dim1name=grlnd, readvar=readvar) - if (readvar) then - call endrun( msg= ' ERROR: unexpectedly found CONST_FERTNITRO_CFT on dataset when cft_size=0'// & - ' (if the surface dataset has a separate crop landunit, then the code'// & - ' must also have a separate crop landunit, and vice versa)'//& - errMsg(sourcefile, __LINE__)) - end if - fert_cft = 0.0_r8 - - call ncd_io(ncid=ncid, varname='PCT_NAT_PFT', flag='read', data=wt_nat_patch, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_NAT_PFT NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - - end subroutine surfrd_pftformat - -!----------------------------------------------------------------------- - subroutine surfrd_veg_all(begg, endg, ncid, ns) - ! - ! !DESCRIPTION: - ! Determine weight arrays for non-dynamic landuse mode - ! - ! !USES: - use clm_varctl , only : create_crop_landunit, use_fates - use clm_varpar , only : natpft_lb, natpft_ub, natpft_size, cft_size, cft_lb - use clm_instur , only : wt_lunit, wt_nat_patch, wt_cft, fert_cft - use landunit_varcon , only : istsoil, istcrop - use surfrdUtilsMod , only : convert_cft_to_pft - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: begg, endg - type(file_desc_t),intent(inout) :: ncid ! netcdf id - integer ,intent(in) :: ns ! domain size - ! - ! !LOCAL VARIABLES: - integer :: dimid ! netCDF id's - integer :: cftsize ! size of CFT's - logical :: readvar ! is variable on dataset - logical :: cft_dim_exists ! does the dimension 'cft' exist on the dataset? - real(r8),pointer :: arrayl(:) ! local array - real(r8),pointer :: array2D(:,:) ! local 2D array - character(len=32) :: subname = 'surfrd_veg_all' ! subroutine name -!----------------------------------------------------------------------- - ! - ! Read in variables that are handled the same for all formats - ! - ! Check dimension size - call check_dim(ncid, 'lsmpft', numpft+1) - - ! This temporary array is needed because ncd_io expects a pointer, so we can't - ! directly pass wt_lunit(begg:endg,istsoil) - allocate(arrayl(begg:endg)) - - call ncd_io(ncid=ncid, varname='PCT_NATVEG', flag='read', data=arrayl, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_NATVEG NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - wt_lunit(begg:endg,istsoil) = arrayl(begg:endg) - - call ncd_io(ncid=ncid, varname='PCT_CROP', flag='read', data=arrayl, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( msg=' ERROR: PCT_CROP NOT on surfdata file'//errMsg(sourcefile, __LINE__)) - wt_lunit(begg:endg,istcrop) = arrayl(begg:endg) - - deallocate(arrayl) - - ! Check the file format for CFT's and handle accordingly - call ncd_inqdid(ncid, 'cft', dimid, cft_dim_exists) - if ( cft_dim_exists .and. create_crop_landunit )then - call surfrd_cftformat( ncid, begg, endg, wt_cft, cft_size, natpft_size ) ! Format where CFT's is read in a seperate landunit - else if ( (.not. cft_dim_exists) .and. (.not. create_crop_landunit) )then - if ( masterproc ) write(iulog,*) "WARNING: The PFT format is an unsupported format that will be removed in th future!" - call surfrd_pftformat( begg, endg, ncid ) ! Format where crop is part of the natural veg. landunit - else if ( cft_dim_exists .and. .not. create_crop_landunit )then - if ( masterproc ) write(iulog,*) "WARNING: New CFT-based format surface datasets should be run with create_crop_landunit=T" - if ( use_fates ) then - if ( masterproc ) write(iulog,*) "WARNING: When fates is on we allow new CFT based surface datasets ", & - "to be used with create_crop_land FALSE" - cftsize = 2 - allocate(array2D(begg:endg,cft_lb:cftsize-1+cft_lb)) - call surfrd_cftformat( ncid, begg, endg, array2D, cftsize, natpft_size-cftsize ) ! Read crops in as CFT's - call convert_cft_to_pft( begg, endg, cftsize, array2D ) ! Convert from CFT to natural veg. landunit - deallocate(array2D) - else - call endrun( msg=' ERROR: New format surface datasets require create_crop_landunit TRUE'//errMsg(sourcefile, __LINE__)) - end if - end if - - ! Do some checking - - if ( (cft_size == 0) .and. any(wt_lunit(begg:endg,istcrop) > 0._r8) ) then - call endrun( msg=' ERROR: if PCT_CROP > 0 anywhere, then cft_size must be > 0'// & - ' (if the surface dataset has a separate crop landunit, then the code'// & - ' must also have a separate crop landunit, and vice versa)'//& - errMsg(sourcefile, __LINE__)) - end if - ! Convert from percent to fraction, check sums of nat vegetation add to 1 - if ( cft_size > 0 )then - wt_cft(begg:endg,:) = wt_cft(begg:endg,:) / 100._r8 - call check_sums_equal_1(wt_cft, begg, 'wt_cft', subname) - end if - wt_lunit(begg:endg,istsoil) = wt_lunit(begg:endg,istsoil) / 100._r8 - wt_lunit(begg:endg,istcrop) = wt_lunit(begg:endg,istcrop) / 100._r8 - wt_nat_patch(begg:endg,:) = wt_nat_patch(begg:endg,:) / 100._r8 - call check_sums_equal_1(wt_nat_patch, begg, 'wt_nat_patch', subname) - - ! Collapse crop landunits down when prognostic crops are on - if (use_crop) then - call collapse_crop_types(wt_cft(begg:endg, :), fert_cft(begg:endg, :), begg, endg, verbose=.true.) - end if - - end subroutine surfrd_veg_all - - !----------------------------------------------------------------------- - subroutine surfrd_veg_dgvm(begg, endg) - ! - ! !DESCRIPTION: - ! Determine weights for CNDV mode. - ! - ! !USES: - use pftconMod , only : noveg - use clm_instur, only : wt_nat_patch - ! - ! !ARGUMENTS: - integer, intent(in) :: begg, endg - ! - ! !LOCAL VARIABLES: - character(len=*), parameter :: subname = 'surfrd_veg_dgvm' - !----------------------------------------------------------------------- - - ! Bare ground gets 100% weight; all other natural patches are zeroed out - wt_nat_patch(begg:endg, :) = 0._r8 - wt_nat_patch(begg:endg, noveg) = 1._r8 - - call check_sums_equal_1(wt_nat_patch, begg, 'wt_nat_patch', subname) - - end subroutine surfrd_veg_dgvm - -end module surfrdMod diff --git a/src/main/surfrdUtilsMod.F90 b/src/main/surfrdUtilsMod.F90 deleted file mode 100644 index 45fbf9ebe1..0000000000 --- a/src/main/surfrdUtilsMod.F90 +++ /dev/null @@ -1,243 +0,0 @@ -module surfrdUtilsMod - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Contains utility methods that can be used when reading surface datasets or similar - ! datasets (such as the landuse_timeseries dataset) - ! - ! !USES: -#include "shr_assert.h" - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: check_sums_equal_1 ! Confirm that sum(arr(n,:)) == 1 for all n - public :: renormalize ! Renormalize an array - public :: convert_cft_to_pft ! Conversion of crop CFT to natural veg PFT:w - public :: collapse_crop_types ! Collapse unused crop types into types used in this run - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine check_sums_equal_1(arr, lb, name, caller, ier) - ! - ! !DESCRIPTION: - ! Confirm that sum(arr(n,:)) == 1 for all n. If this isn't true for any n, abort with a message. - ! - ! !ARGUMENTS: - integer , intent(in) :: lb ! lower bound of the first dimension of arr - real(r8) , intent(in) :: arr(lb:,:) ! array to check - character(len=*), intent(in) :: name ! name of array - character(len=*), intent(in) :: caller ! identifier of caller, for more meaningful error messages - integer, optional, intent(out):: ier ! Return an error code rather than abort - ! - ! !LOCAL VARIABLES: - logical :: found - integer :: nl - integer :: nindx - real(r8), parameter :: eps = 1.e-13_r8 - !----------------------------------------------------------------------- - - if( present(ier) ) ier = 0 - found = .false. - - do nl = lbound(arr, 1), ubound(arr, 1) - if (abs(sum(arr(nl,:)) - 1._r8) > eps) then - found = .true. - nindx = nl - exit - end if - end do - - if (found) then - write(iulog,*) trim(caller), ' ERROR: sum of ', trim(name), ' not 1.0 at nl=', nindx - write(iulog,*) 'sum is: ', sum(arr(nindx,:)) - if( present(ier) ) then - ier = -10 - else - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine check_sums_equal_1 - - !----------------------------------------------------------------------- - subroutine renormalize(arr, lb, normal) - ! - ! !DESCRIPTION: - ! Re normalize an array so that it sums to the input value - ! - ! !ARGUMENTS: - integer , intent(in) :: lb ! lower bound of the first dimension of arr - real(r8) , intent(inout) :: arr(lb:,:) ! array to check - real(r8) , intent(in) :: normal ! normal to sum to - ! - ! !LOCAL VARIABLES: - integer :: nl ! Array index - real(r8) :: arr_sum ! sum of array - real(r8) :: ratio ! ratio to multiply by - !----------------------------------------------------------------------- - - do nl = lbound(arr, 1), ubound(arr, 1) - arr_sum = sum(arr(nl,:)) - if ( arr_sum /= 0.0_r8 )then - ratio = normal / arr_sum - arr(nl,:) = arr(nl,:) * ratio - end if - end do - - end subroutine renormalize - -!----------------------------------------------------------------------- - subroutine convert_cft_to_pft( begg, endg, cftsize, wt_cft ) - ! - ! !DESCRIPTION: - ! Convert generic crop types that were read in as seperate CFT's on - ! a crop landunit, and put them on the vegetated landunit. - ! !USES: - use clm_instur , only : wt_lunit, wt_nat_patch, fert_cft - use clm_varpar , only : cft_size, natpft_size - use pftconMod , only : nc3crop - use landunit_varcon , only : istsoil, istcrop - ! !ARGUMENTS: - implicit none - integer , intent(in) :: begg, endg - integer , intent(in) :: cftsize ! CFT size - real(r8) , intent(inout) :: wt_cft(begg:,:) ! CFT weights - ! - ! !LOCAL VARIABLES: - integer :: g ! index -!----------------------------------------------------------------------- - SHR_ASSERT_ALL((ubound(wt_cft) == (/endg, cftsize/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(wt_nat_patch) == (/endg, nc3crop+cftsize-1/)), errMsg(sourcefile, __LINE__)) - - do g = begg, endg - if ( wt_lunit(g,istcrop) > 0.0_r8 )then - ! Move CFT over to PFT and do weighted average of the crop and soil parts - wt_nat_patch(g,:) = wt_nat_patch(g,:) * wt_lunit(g,istsoil) - wt_cft(g,:) = wt_cft(g,:) * wt_lunit(g,istcrop) - wt_nat_patch(g,nc3crop:) = wt_cft(g,:) ! Add crop CFT's to end of natural veg PFT's - wt_lunit(g,istsoil) = (wt_lunit(g,istsoil) + wt_lunit(g,istcrop)) ! Add crop landunit to soil landunit - wt_nat_patch(g,:) = wt_nat_patch(g,:) / wt_lunit(g,istsoil) - wt_lunit(g,istcrop) = 0.0_r8 ! Zero out crop CFT's - else - wt_nat_patch(g,nc3crop:) = 0.0_r8 ! Make sure generic crops are zeroed out - end if - end do - - end subroutine convert_cft_to_pft - - !----------------------------------------------------------------------- - subroutine collapse_crop_types(wt_cft, fert_cft, begg, endg, verbose) - ! - ! !DESCRIPTION: - ! Collapse unused crop types into types used in this run. - ! - ! Should only be called if using prognostic crops - otherwise, wt_cft is meaningless - ! - ! !USES: - use clm_varctl , only : irrigate - use clm_varpar , only : cft_lb, cft_ub, cft_size - use pftconMod , only : nc3crop, nc3irrig, npcropmax, pftcon - ! - ! !ARGUMENTS: - - ! Note that we use begg and endg rather than 'bounds', because bounds may not be - ! available yet when this is called - integer, intent(in) :: begg ! Beginning grid cell index - integer, intent(in) :: endg ! Ending grid cell index - - ! Weight and fertilizer of each CFT in each grid cell; dimensioned [g, cft_lb:cft_ub] - ! This array is modified in-place - real(r8), intent(inout) :: wt_cft(begg:, cft_lb:) - real(r8), intent(inout) :: fert_cft(begg:, cft_lb:) - - logical, intent(in) :: verbose ! If true, print some extra information - ! - ! !LOCAL VARIABLES: - integer :: g - integer :: m - real(r8) :: wt_cft_to - real(r8) :: wt_cft_from - real(r8) :: wt_cft_merge - - character(len=*), parameter :: subname = 'collapse_crop_types' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(wt_cft) == (/endg, cft_ub/)), errMsg(sourcefile, __LINE__)) - - if (cft_size <= 0) then - call endrun(msg = subname//' can only be called if cft_size > 0' // & - errMsg(sourcefile, __LINE__)) - end if - - ! ------------------------------------------------------------------------ - ! If not using irrigation, merge irrigated CFTs into rainfed CFTs - ! ------------------------------------------------------------------------ - - if (.not. irrigate) then - if (verbose .and. masterproc) then - write(iulog,*) trim(subname)//' crop=.T. and irrigate=.F., so merging irrigated pfts with rainfed' - end if - - do g = begg, endg - ! Left Hand Side: merged rainfed+irrigated crop pfts from nc3crop to - ! npcropmax-1, stride 2 - ! Right Hand Side: rainfed crop pfts from nc3crop to npcropmax-1, - ! stride 2 - ! plus irrigated crop pfts from nc3irrig to npcropmax, - ! stride 2 - ! where stride 2 means "every other" - wt_cft(g, nc3crop:npcropmax-1:2) = & - wt_cft(g, nc3crop:npcropmax-1:2) + wt_cft(g, nc3irrig:npcropmax:2) - wt_cft(g, nc3irrig:npcropmax:2) = 0._r8 - end do - - call check_sums_equal_1(wt_cft, begg, 'wt_cft', subname//': irrigation') - end if - - ! ------------------------------------------------------------------------ - ! Merge CFTs into the list of crops that CLM knows how to model - ! ------------------------------------------------------------------------ - - if (verbose .and. masterproc) then - write(iulog, *) trim(subname) // ' merging wheat, barley, and rye into temperate cereals' - write(iulog, *) trim(subname) // ' clm knows how to model corn, temperate cereals, and soybean' - write(iulog, *) trim(subname) // ' all other crops are lumped with the generic crop pft' - end if - - do g = begg, endg - do m = 1, npcropmax - if (m /= pftcon%mergetoclmpft(m)) then - wt_cft_to = wt_cft(g, pftcon%mergetoclmpft(m)) - wt_cft_from = wt_cft(g, m) - wt_cft_merge = wt_cft_to + wt_cft_from - wt_cft(g, pftcon%mergetoclmpft(m)) = wt_cft_merge - wt_cft(g, m) = 0._r8 - if (wt_cft_merge > 0._r8) then - fert_cft(g,pftcon%mergetoclmpft(m)) = (wt_cft_to * fert_cft(g,pftcon%mergetoclmpft(m)) + & - wt_cft_from * fert_cft(g,m)) / wt_cft_merge - end if - end if - end do - - end do - - call check_sums_equal_1(wt_cft, begg, 'wt_cft', subname//': mergetoclmpft') - - end subroutine collapse_crop_types - - -end module surfrdUtilsMod diff --git a/src/main/test/CMakeLists.txt b/src/main/test/CMakeLists.txt deleted file mode 100644 index 2aa80fd5d7..0000000000 --- a/src/main/test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -add_subdirectory(subgridWeights_test) -add_subdirectory(accumul_test) -add_subdirectory(surfrdUtils_test) -add_subdirectory(atm2lnd_test) -add_subdirectory(clm_glclnd_test) -add_subdirectory(glcBehavior_test) -add_subdirectory(filter_test) -add_subdirectory(ncdio_utils_test) -add_subdirectory(topo_test) diff --git a/src/main/test/accumul_test/CMakeLists.txt b/src/main/test/accumul_test/CMakeLists.txt deleted file mode 100644 index 105ef0dac1..0000000000 --- a/src/main/test/accumul_test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(pfunit_sources - test_accumul.pf) - -create_pFUnit_test(accumul test_accumul_exe - "${pfunit_sources}" "") - -target_link_libraries(test_accumul_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/main/test/accumul_test/test_accumul.pf b/src/main/test/accumul_test/test_accumul.pf deleted file mode 100644 index 8e08cff77d..0000000000 --- a/src/main/test/accumul_test/test_accumul.pf +++ /dev/null @@ -1,720 +0,0 @@ -module test_accumul - - ! Tests of accumulMod - - use pfunit_mod - use accumulMod - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod, only : setup_single_veg_patch - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon, only : spval - use PatchType, only : patch - - implicit none - - @TestCase - type, extends(TestCase) :: TestAccumul - contains - procedure :: setUp - procedure :: tearDown - procedure :: init_sl_patch_field - procedure :: init_ml_patch_field - procedure :: update_and_extract_sl_patch_field - procedure :: update_and_extract_ml_patch_field - end type TestAccumul - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Helper routines - ! ======================================================================== - - subroutine setUp(this) - class(TestAccumul), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestAccumul), intent(inout) :: this - - call clean_accum_fields - end subroutine tearDown - - subroutine init_sl_patch_field(this, name, accum_type, accum_period, init_value) - ! Call init_accum_field for a single-level patch field - class(TestAccumul), intent(in) :: this - character(len=*), intent(in) :: name - character(len=*), intent(in) :: accum_type ! timeavg, runmean, runaccum - integer, intent(in) :: accum_period - real(r8), intent(in), optional :: init_value ! if absent, use 0 - - real(r8) :: l_init_value - - if (present(init_value)) then - l_init_value = init_value - else - l_init_value = 0._r8 - end if - - call init_accum_field(& - name = name, & - units = 'none', & - desc = 'no desc', & - accum_type = accum_type, & - accum_period = accum_period, & - numlev = 1, & - subgrid_type = 'pft', & - init_value = l_init_value) - end subroutine init_sl_patch_field - - subroutine init_ml_patch_field(this, name, accum_type, accum_period, nlev, init_value) - ! Call init_accum_field for a multi-level patch field - class(TestAccumul), intent(in) :: this - character(len=*), intent(in) :: name - character(len=*), intent(in) :: accum_type ! timeavg, runmean, runaccum - integer, intent(in) :: accum_period - integer, intent(in) :: nlev - real(r8), intent(in), optional :: init_value ! if absent, use 0 - - real(r8) :: l_init_value - - if (present(init_value)) then - l_init_value = init_value - else - l_init_value = 0._r8 - end if - - call init_accum_field(& - name = name, & - units = 'none', & - desc = 'no desc', & - accum_type = accum_type, & - accum_period = accum_period, & - numlev = nlev, & - subgrid_type = 'pft', & - init_value = l_init_value, & - type2d = 'irrelevant') ! type2d just needed for restart - end subroutine init_ml_patch_field - - subroutine update_and_extract_sl_patch_field(this, fieldname, values, val_output, & - pactive, timestep_start) - ! Calls update_accum_field once for each value in 'values', assuming that the values - ! come once per timestep. For the first call, all input values are set equal to - ! values(1); for the second call, all input values are set equal to values(2); etc. - ! - ! After all update calls are done, calls extract_accum_field to extract the final - ! value from bounds%begp into val_output. This assumes the timestep at extraction is - ! size(values) (or size(values)+(timestep_start-1), if timestep_start is present). - ! - ! If pactive is present, then it should be an array of the same size as 'values', - ! specifying whether the patch at bounds%begp is active in each time step. If this is - ! absent, then this patch is assumed to be active for all time steps. - ! - ! This version is for a single-level (1-d) field. - class(TestAccumul), intent(inout) :: this - character(len=*), intent(in) :: fieldname - real(r8), intent(in) :: values(:) - real(r8), intent(out) :: val_output - logical, optional, intent(in) :: pactive(:) - - ! If present, this specifies the starting nstep value. If absent, we start with 1. - integer, optional, intent(in) :: timestep_start - - integer :: n_timesteps - integer :: timestep - integer :: timestep_offset - real(r8), pointer :: vals_input(:) - real(r8), pointer :: vals_output(:) - logical, allocatable :: l_pactive(:) ! local version of pactive - - n_timesteps = size(values) - if (present(pactive)) then - @assertEqual(n_timesteps, size(pactive)) - end if - - allocate(l_pactive(n_timesteps)) - if (present(pactive)) then - l_pactive(:) = pactive(:) - else - l_pactive(:) = .true. - end if - - if (present(timestep_start)) then - timestep_offset = timestep_start - 1 - else - timestep_offset = 0 - end if - - allocate(vals_input(bounds%begp:bounds%endp)) - allocate(vals_output(bounds%begp:bounds%endp)) - do timestep = 1, n_timesteps - vals_input(:) = values(timestep) - patch%active(bounds%begp) = l_pactive(timestep) - call update_accum_field(fieldname, vals_input, timestep+timestep_offset) - end do - call extract_accum_field(fieldname, vals_output, n_timesteps+timestep_offset) - val_output = vals_output(bounds%begp) - - deallocate(vals_input) - deallocate(vals_output) - - end subroutine update_and_extract_sl_patch_field - - subroutine update_and_extract_ml_patch_field(this, fieldname, values, val_output, pactive) - ! Calls update_accum_field once for each value in 'values', assuming that the values - ! come once per timestep. For the first call, the input values in all patches are set - ! equal to values(:,1); for the second call, the input values in all patches are set - ! equal to values(:,2); etc. Thus, 'values' specifies different values for each level - ! and time, but assumes the same values in each patch (if there is more than one - ! patch). - ! - ! After all update calls are done, calls extract_accum_field to extract the final - ! value from bounds%begp into this%vals_output. This assumes the timestep at - ! extraction is size(values,2). - ! - ! If pactive is present, then it should be an array of the same size as the second - ! dimension of 'values', specifying whether the patch at bounds%begp is active in each - ! time step. If this is absent, then this patch is assumed to be active for all time - ! steps. - ! - ! This version is for a multi-level (2-d) field. - class(TestAccumul), intent(inout) :: this - character(len=*), intent(in) :: fieldname - real(r8), intent(in) :: values(:,:) ! [level, time] - real(r8), intent(out) :: val_output(:) ! [level] - logical, optional, intent(in) :: pactive(:) - - integer :: n_timesteps - integer :: timestep - integer :: n_levels - integer :: level - real(r8), pointer :: vals_input(:,:) - real(r8), pointer :: vals_output(:,:) - logical, allocatable :: l_pactive(:) ! local version of pactive - - n_levels = size(values,1) - n_timesteps = size(values,2) - - @assertEqual(n_levels, size(val_output)) - if (present(pactive)) then - @assertEqual(n_timesteps, size(pactive)) - end if - - allocate(l_pactive(n_timesteps)) - if (present(pactive)) then - l_pactive(:) = pactive(:) - else - l_pactive(:) = .true. - end if - - allocate(vals_input(bounds%begp:bounds%endp, n_levels)) - allocate(vals_output(bounds%begp:bounds%endp, n_levels)) - do timestep = 1, n_timesteps - do level = 1, n_levels - vals_input(:,level) = values(level,timestep) - end do - patch%active(bounds%begp) = l_pactive(timestep) - call update_accum_field(fieldname, vals_input, timestep) - end do - call extract_accum_field(fieldname, vals_output, n_timesteps) - val_output(:) = vals_output(bounds%begp,:) - - deallocate(vals_input) - deallocate(vals_output) - - end subroutine update_and_extract_ml_patch_field - - ! ======================================================================== - ! Begin tests - ! ======================================================================== - - ! ------------------------------------------------------------------------ - ! Tests of timeavg - ! ------------------------------------------------------------------------ - - @Test - subroutine timeavg_basic(this) - ! Test basic operation of timeavg field - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(accum_period) = [11._r8, 12._r8, 13._r8] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - expected = sum(values)/accum_period - @assertEqual(expected, val_output, tolerance=tol) - end subroutine timeavg_basic - - @Test - subroutine timeavg_wrongTime(this) - ! Test a timeavg field when it's the wrong time for producing an average - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(2) = [11._r8, 12._r8] - real(r8) :: val_output - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - @assertEqual(spval, val_output) - end subroutine timeavg_wrongTime - - @Test - subroutine timeavg_onlyLatestPeriod(this) - ! If we go through multiple periods, the values from earlier periods should have no - ! impact on the final result. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(accum_period*2) = & - [11._r8, 12._r8, 13._r8, 21._r8, 22._r8, 23._r8] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - expected = sum(values(accum_period+1:2*accum_period))/accum_period - @assertEqual(expected, val_output, tolerance=tol) - end subroutine timeavg_onlyLatestPeriod - - @Test - subroutine timeavg_newlyActive(this) - ! For timeavg: If a point becomes active in the middle of a period, then it should - ! give the average value just over the time steps when it was active. - ! - ! This may or may not be the ideal behavior; we can change this if some other - ! behavior would be better in this situation. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(accum_period*2) = & - [11._r8, 12._r8, 13._r8, 21._r8, 22._r8, 23._r8] - logical, parameter :: pactive(accum_period*2) = & - [.false., .false., .false., .false., .true., .true.] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - expected = sum(values(5:6))/2._r8 - @assertEqual(expected, val_output, tolerance=tol) - end subroutine timeavg_newlyActive - - @Test - subroutine timeavg_veryNewlyActive(this) - ! For timeavg: If a point just became active in this time step, and this is the time - ! when we'd usually get time averages, then the time average for this point should - ! just be this time step's value. - ! - ! This may or may not be the ideal behavior; we can change this if some other - ! behavior would be better in this situation. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(accum_period) = [11._r8, 12._r8, 13._r8] - logical, parameter :: pactive(accum_period) = [.false., .false., .true.] - real(r8) :: val_output - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - @assertEqual(values(accum_period), val_output, tolerance=tol) - end subroutine timeavg_veryNewlyActive - - @Test - subroutine timeavg_activeInactiveActive(this) - ! Test timeavg with a point that starts active, becomes inactive, then later becomes - ! active again. Test spans two periods. The point is inactive during the reset time - ! step. The final average should be the average of the time steps when it was active. - ! In particular, it should not be reset. - ! - ! This may or may not be the ideal behavior; we can change this if some other - ! behavior would be better in this situation. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(accum_period*2) = & - [11._r8, 102._r8, 193._r8, 210._r8, 272._r8, 234._r8] - logical, parameter :: pactive(accum_period*2) = & - [.true., .true., .false., .false., .true., .true.] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - expected = (values(1) + values(2) + values(5) + values(6))/4._r8 - @assertEqual(expected, val_output, tolerance=tol) - end subroutine timeavg_activeInactiveActive - - @Test - subroutine timeavg_multiLevel(this) - ! Make sure that multi-level timeavg works right - ! - ! Note that we currently do not have multi-level tests of the other accum types. - ! Because of the way the code is structured, this is okay: the same multi-level code - ! is used regardless of the accum method. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values_lev1(accum_period*2) = & - [11._r8, 12._r8, 13._r8, 21._r8, 22._r8, 23._r8] - real(r8), parameter :: values_lev2(accum_period*2) = & - [111._r8, 112._r8, 113._r8, 121._r8, 122._r8, 123._r8] - real(r8) :: values(2, accum_period*2) - real(r8) :: val_output(2) - real(r8) :: expected_lev1, expected_lev2 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_ml_patch_field(name=fieldname, accum_type='timeavg', & - accum_period = accum_period, nlev=2) - values(1,:) = values_lev1 - values(2,:) = values_lev2 - - ! Exercise - call this%update_and_extract_ml_patch_field(fieldname, values, val_output) - - ! Verify - expected_lev1 = sum(values_lev1(4:6))/accum_period - expected_lev2 = sum(values_lev2(4:6))/accum_period - @assertEqual(expected_lev1, val_output(1), tolerance=tol) - @assertEqual(expected_lev2, val_output(2), tolerance=tol) - end subroutine timeavg_multiLevel - - ! ------------------------------------------------------------------------ - ! Tests of runmean - ! ------------------------------------------------------------------------ - - @Test - subroutine runmean_oneStep(this) - ! For runmean, after one time step, value should be equal to the value in that time - ! step. The initial value should be irrelevant. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: my_value = 11._r8 - real(r8) :: val_output - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runmean', & - accum_period = accum_period, init_value = 1000._r8) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, [my_value], val_output) - - ! Verify - @assertEqual(my_value, val_output, tolerance=tol) - end subroutine runmean_oneStep - - @Test - subroutine runmean_beforePeriod(this) - ! Test runmean accumulation before accum_period is reached - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 4 - real(r8), parameter :: values(3) = [11._r8, 22._r8, 43._r8] - real(r8) :: val_output - real(r8) :: expected_ts1, expected_ts2, expected_ts3 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runmean', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - expected_ts1 = values(1) - expected_ts2 = (expected_ts1 + values(2))/2._r8 - expected_ts3 = (2._r8 * expected_ts2 + values(3)) / 3._r8 - @assertEqual(expected_ts3, val_output, tolerance=tol) - end subroutine runmean_beforePeriod - - @Test - subroutine runmean_afterPeriod(this) - ! Test runmean accumulation after accum_period is reached - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(5) = [11._r8, 22._r8, 43._r8, 110._r8, 17._r8] - real(r8) :: val_output - real(r8) :: expected_ts1, expected_ts2, expected_ts3, expected_ts4, expected_ts5 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runmean', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - expected_ts1 = values(1) - expected_ts2 = (expected_ts1 + values(2))/2._r8 - expected_ts3 = (2._r8 * expected_ts2 + values(3)) / 3._r8 - expected_ts4 = (2._r8 * expected_ts3 + values(4)) / 3._r8 - expected_ts5 = (2._r8 * expected_ts4 + values(5)) / 3._r8 - @assertEqual(expected_ts5, val_output, tolerance=tol) - end subroutine runmean_afterPeriod - - @Test - subroutine runmean_newlyActive(this) - ! For runmean: If a point recently became active, its running mean should only - ! consider values from when it was active. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(7) = [1._r8, 2._r8, 11._r8, 22._r8, 43._r8, 110._r8, 17._r8] - logical, parameter :: pactive(7) = [.false., .false., .true., .true., .true., .true., .true.] - real(r8) :: val_output - real(r8) :: expected_ts3, expected_ts4, expected_ts5, expected_ts6, expected_ts7 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runmean', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - expected_ts3 = values(3) - expected_ts4 = (expected_ts3 + values(4))/2._r8 - expected_ts5 = (2._r8 * expected_ts4 + values(5)) / 3._r8 - expected_ts6 = (2._r8 * expected_ts5 + values(6)) / 3._r8 - expected_ts7 = (2._r8 * expected_ts6 + values(7)) / 3._r8 - @assertEqual(expected_ts7, val_output, tolerance=tol) - end subroutine runmean_newlyActive - - @Test - subroutine runmean_activeInactiveActive(this) - ! Test runmean with a point that starts active, becomes inactive, then later becomes - ! active again. Should ignore values in the inactive steps. Also, should continue - ! where it left off - i.e., including the values accumulated when it was first - ! active. This may or may not be the ideal behavior; we can change this if some other - ! behavior would be better in this situation. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 - real(r8), parameter :: values(7) = [1._r8, 2._r8, 11._r8, 22._r8, 43._r8, 110._r8, 17._r8] - logical, parameter :: pactive(7) = [.true., .true., .false., .false., .true., .true., .true.] - real(r8) :: val_output - real(r8) :: expected_ts1, expected_ts2, expected_ts5, expected_ts6, expected_ts7 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runmean', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - expected_ts1 = values(1) - expected_ts2 = (expected_ts1 + values(2))/2._r8 - expected_ts5 = (2._r8 * expected_ts2 + values(5)) / 3._r8 - expected_ts6 = (2._r8 * expected_ts5 + values(6)) / 3._r8 - expected_ts7 = (2._r8 * expected_ts6 + values(7)) / 3._r8 - @assertEqual(expected_ts7, val_output, tolerance=tol) - end subroutine runmean_activeInactiveActive - - ! ------------------------------------------------------------------------ - ! Tests of runaccum - ! ------------------------------------------------------------------------ - - @Test - subroutine runaccum_basic(this) - ! Test basic operation of runaccum field - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 ! irrelevant for this type - real(r8), parameter :: values(4) = [11._r8, 12._r8, 13._r8, 24._r8] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runaccum', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - expected = sum(values) - @assertEqual(expected, val_output, tolerance=tol) - end subroutine runaccum_basic - - @Test - subroutine runaccum_reset(this) - ! Test resetting of runaccum field - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 ! irrelevant for this type - real(r8), parameter :: values(5) = [11._r8, 12._r8, accumResetVal, 13._r8, 24._r8] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runaccum', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output) - - ! Verify - expected = sum(values(4:5)) - @assertEqual(expected, val_output, tolerance=tol) - end subroutine runaccum_reset - - @Test - subroutine runaccum_newlyActive(this) - ! For runaccum: If a point becomes active between accumulation resets, then it should - ! just give the accumulated amount since it became active. - ! - ! This may or may not be the ideal behavior; we can change this if some other - ! behavior would be better in this situation. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 ! irrelevant for this type - real(r8), parameter :: values(5) = [11._r8, accumResetVal, 12._r8, 13._r8, 24._r8] - logical, parameter :: pactive(5) = [.false., .false., .false., .true., .true.] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runaccum', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - expected = sum(values(4:5)) - @assertEqual(expected, val_output, tolerance=tol) - end subroutine runaccum_newlyActive - - @Test - subroutine runaccum_activeInactiveActive(this) - ! Test runaccum with a point that starts active, becomes inactive, then later becomes - ! active again. - ! - ! Should ignore values and accumResetVal in the inactive steps. - ! - ! Also, should continue where it left off - i.e., including the values accumulated - ! when it was first active. This may or may not be the ideal behavior; we can change - ! this if some other behavior would be better in this situation. - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname = 'foo' - integer, parameter :: accum_period = 3 ! irrelevant for this type - real(r8), parameter :: values(5) = [11._r8, accumResetVal, 12._r8, 17._r8, 24._r8] - logical, parameter :: pactive(5) = [.true., .false., .false., .true., .true.] - real(r8) :: val_output - real(r8) :: expected - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname, accum_type='runaccum', & - accum_period = accum_period) - - ! Exercise - call this%update_and_extract_sl_patch_field(fieldname, values, val_output, pactive=pactive) - - ! Verify - expected = values(1) + values(4) + values(5) - @assertEqual(expected, val_output, tolerance=tol) - end subroutine runaccum_activeInactiveActive - - ! ------------------------------------------------------------------------ - ! Tests of multiple fields - ! ------------------------------------------------------------------------ - - @Test - subroutine multipleFields(this) - class(TestAccumul), intent(inout) :: this - character(len=*), parameter :: fieldname1 = 'foo' - character(len=*), parameter :: fieldname2 = 'bar' - integer, parameter :: accum_period = 2 ! same for both, for simplicity - real(r8), parameter :: values1(2) = [11._r8, 12._r8] - real(r8), parameter :: values2(2) = [111._r8, 112._r8] - integer :: timestep - real(r8) :: val_output1, val_output2 - real(r8) :: expected1, expected2 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%init_sl_patch_field(name=fieldname1, accum_type='timeavg', & - accum_period = accum_period) - call this%init_sl_patch_field(name=fieldname2, accum_type='runaccum', & - accum_period = accum_period) - - ! Exercise - ! - ! In order to possibly catch more bugs, and to more closely replicate the structure of - ! the production code: rather than doing a single update and extract for each field, - ! we first do an update and extract for time1, then do an update and extract for - ! time2. - do timestep = 1, 2 - call this%update_and_extract_sl_patch_field(fieldname1, values1(timestep:timestep), val_output1, & - timestep_start=timestep) - call this%update_and_extract_sl_patch_field(fieldname2, values2(timestep:timestep), val_output2, & - timestep_start=timestep) - end do - - ! Verify - expected1 = sum(values1)/2._r8 - expected2 = sum(values2) - @assertEqual(expected1, val_output1, tolerance=tol) - @assertEqual(expected2, val_output2, tolerance=tol) - end subroutine multipleFields - -end module test_accumul diff --git a/src/main/test/atm2lnd_test/CMakeLists.txt b/src/main/test/atm2lnd_test/CMakeLists.txt deleted file mode 100644 index 018b875a27..0000000000 --- a/src/main/test/atm2lnd_test/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(pfunit_sources - test_downscale_forcings.pf - test_partition_precip.pf - test_sens_heat_from_precip_conversion.pf) - -create_pFUnit_test(atm2lnd test_atm2lnd_exe - "${pfunit_sources}" "") - -target_link_libraries(test_atm2lnd_exe clm csm_share esmf_wrf_timemgr) \ No newline at end of file diff --git a/src/main/test/atm2lnd_test/test_downscale_forcings.pf b/src/main/test/atm2lnd_test/test_downscale_forcings.pf deleted file mode 100644 index 4fe5621c7b..0000000000 --- a/src/main/test/atm2lnd_test/test_downscale_forcings.pf +++ /dev/null @@ -1,460 +0,0 @@ -module test_downscale_forcings - - ! Tests of atm2lndMod: downscale_forcings - - use pfunit_mod - use atm2lndMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestArrayMod - use atm2lndType, only : atm2lnd_type, atm2lnd_params_type - use TopoMod, only : topo_type - use decompMod, only : bounds_type - use filterColMod - - implicit none - - type, extends(topo_type) :: topo_type_always_downscale - contains - procedure, public :: DownscaleFilterc - end type topo_type_always_downscale - - @TestCase - type, extends(TestCase) :: TestDownscaleForcings - type(atm2lnd_type) :: atm2lnd_inst - type(topo_type_always_downscale) :: topo_inst - real(r8), allocatable :: eflx_sh_precip_conversion(:) - contains - procedure :: setUp - procedure :: tearDown - procedure :: create_atm2lnd - procedure :: create_topo - procedure :: call_downscale_forcings - end type TestDownscaleForcings - - real(r8), parameter :: lapse_rate = 0.006_r8 - real(r8), parameter :: lapse_rate_longwave = 0.03_r8 - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Methods on topo_type_always_downscale - ! ======================================================================== - - function DownscaleFilterc(this, bounds) result(filter) - ! Override topo_type's DownscaleFilterc - type(filter_col_type) :: filter ! function result - class(topo_type_always_downscale), intent(in) :: this - type(bounds_type), intent(in) :: bounds - - filter = col_filter_from_logical_array(bounds, & - col_array(.true.)) - end function DownscaleFilterc - - ! ======================================================================== - ! Test helper methods - ! ======================================================================== - - subroutine setUp(this) - class(TestDownscaleForcings), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestDownscaleForcings), intent(inout) :: this - - call this%atm2lnd_inst%Clean() - call this%topo_inst%Clean() - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine create_atm2lnd(this, forc_topo, forc_t, forc_th, forc_q, forc_pbot, forc_rho, & - forc_lwrad, forc_rain, forc_snow, glcmec_downscale_longwave, longwave_downscaling_limit) - ! Initializes this%atm2lnd_inst and sets gridcell-level, non-downscaled forcing - ! fields based on inputs. Excluded inputs are given a default value - class(TestDownscaleForcings), intent(inout) :: this - real(r8), intent(in) :: forc_topo(:) - real(r8), intent(in), optional :: forc_t(:) - real(r8), intent(in), optional :: forc_th(:) - real(r8), intent(in), optional :: forc_q(:) - real(r8), intent(in), optional :: forc_pbot(:) - real(r8), intent(in), optional :: forc_rho(:) - real(r8), intent(in), optional :: forc_lwrad(:) - real(r8), intent(in), optional :: forc_rain(:) - real(r8), intent(in), optional :: forc_snow(:) - - ! If not provided, assumed to be true - logical, intent(in), optional :: glcmec_downscale_longwave - - ! If not provided, assumed to be longwave_downscaling_limit_default - real(r8), intent(in), optional :: longwave_downscaling_limit - - real(r8), parameter :: forc_t_default = 301._r8 - real(r8), parameter :: forc_th_default = 302._r8 - real(r8), parameter :: forc_q_default = 0.01_r8 - real(r8), parameter :: forc_pbot_default = 100000._r8 - real(r8), parameter :: forc_rho_default = 1.1_r8 - real(r8), parameter :: forc_lwrad_default = 101._r8 - real(r8), parameter :: forc_rain_default = 21._r8 - real(r8), parameter :: forc_snow_default = 22._r8 - - real(r8), parameter :: longwave_downscaling_limit_default = 1._r8 - - real(r8), parameter :: forc_hgt = 2._r8 - - logical :: l_glcmec_downscale_longwave - real(r8) :: l_longwave_downscaling_limit - type(atm2lnd_params_type) :: atm2lnd_params - - ! ------------------------------------------------------------------------ - - if (present(glcmec_downscale_longwave)) then - l_glcmec_downscale_longwave = glcmec_downscale_longwave - else - l_glcmec_downscale_longwave = .true. - end if - - if (present(longwave_downscaling_limit)) then - l_longwave_downscaling_limit = longwave_downscaling_limit - else - l_longwave_downscaling_limit = longwave_downscaling_limit_default - end if - - atm2lnd_params = atm2lnd_params_type( & - repartition_rain_snow = .false., & - glcmec_downscale_longwave = l_glcmec_downscale_longwave, & - lapse_rate = lapse_rate, & - lapse_rate_longwave = lapse_rate_longwave, & - longwave_downscaling_limit = l_longwave_downscaling_limit) - call this%atm2lnd_inst%InitForTesting(bounds, atm2lnd_params) - this%atm2lnd_inst%forc_topo_grc(bounds%begg:bounds%endg) = forc_topo(:) - - if (present(forc_t)) then - this%atm2lnd_inst%forc_t_not_downscaled_grc(bounds%begg:bounds%endg) = forc_t(:) - else - this%atm2lnd_inst%forc_t_not_downscaled_grc(bounds%begg:bounds%endg) = forc_t_default - end if - - if (present(forc_th)) then - this%atm2lnd_inst%forc_th_not_downscaled_grc(bounds%begg:bounds%endg) = forc_th(:) - else - this%atm2lnd_inst%forc_th_not_downscaled_grc(bounds%begg:bounds%endg) = forc_th_default - end if - - if (present(forc_q)) then - this%atm2lnd_inst%forc_q_not_downscaled_grc(bounds%begg:bounds%endg) = forc_q(:) - else - this%atm2lnd_inst%forc_q_not_downscaled_grc(bounds%begg:bounds%endg) = forc_q_default - end if - - if (present(forc_pbot)) then - this%atm2lnd_inst%forc_pbot_not_downscaled_grc(bounds%begg:bounds%endg) = forc_pbot(:) - else - this%atm2lnd_inst%forc_pbot_not_downscaled_grc(bounds%begg:bounds%endg) = forc_pbot_default - end if - - if (present(forc_rho)) then - this%atm2lnd_inst%forc_rho_not_downscaled_grc(bounds%begg:bounds%endg) = forc_rho(:) - else - this%atm2lnd_inst%forc_rho_not_downscaled_grc(bounds%begg:bounds%endg) = forc_rho_default - end if - - if (present(forc_lwrad)) then - this%atm2lnd_inst%forc_lwrad_not_downscaled_grc(bounds%begg:bounds%endg) = forc_lwrad(:) - else - this%atm2lnd_inst%forc_lwrad_not_downscaled_grc(bounds%begg:bounds%endg) = forc_lwrad_default - end if - - if (present(forc_rain)) then - this%atm2lnd_inst%forc_rain_not_downscaled_grc(bounds%begg:bounds%endg) = forc_rain(:) - else - this%atm2lnd_inst%forc_rain_not_downscaled_grc(bounds%begg:bounds%endg) = forc_rain_default - end if - - if (present(forc_snow)) then - this%atm2lnd_inst%forc_snow_not_downscaled_grc(bounds%begg:bounds%endg) = forc_snow(:) - else - this%atm2lnd_inst%forc_snow_not_downscaled_grc(bounds%begg:bounds%endg) = forc_snow_default - end if - - this%atm2lnd_inst%forc_hgt_grc(bounds%begg:bounds%endg) = forc_hgt - end subroutine create_atm2lnd - - subroutine create_topo(this, topo_col) - ! Initializes this%topo_inst, and sets topo_col - class(TestDownscaleForcings), intent(inout) :: this - real(r8), intent(in) :: topo_col(:) - - call this%topo_inst%Init(bounds) - this%topo_inst%topo_col(bounds%begc:bounds%endc) = topo_col(:) - end subroutine create_topo - - subroutine call_downscale_forcings(this) - ! Wraps the call to downscale_forcings - ! - ! Modifies this%atm2lnd_inst and this%eflx_sh_precip_conversion - class(TestDownscaleForcings), intent(inout) :: this - - this%eflx_sh_precip_conversion = col_array() - call downscale_forcings(bounds, this%topo_inst, this%atm2lnd_inst, & - this%eflx_sh_precip_conversion) - end subroutine call_downscale_forcings - - ! ======================================================================== - ! Begin actual tests - ! ======================================================================== - - ! ------------------------------------------------------------------------ - ! Basic sanity tests - ! ------------------------------------------------------------------------ - - @Test - subroutine topo_greaterThan_atmTopo_gives_colder_forc_t(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: atm_topo = 17._r8 - real(r8), parameter :: forc_t = 301._r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [atm_topo], & - forc_t = [forc_t]) - call this%create_topo(topo_col = [atm_topo + 10._r8]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertGreaterThan(forc_t, this%atm2lnd_inst%forc_t_downscaled_col(begc)) - end subroutine topo_greaterThan_atmTopo_gives_colder_forc_t - - ! ------------------------------------------------------------------------ - ! Tests involving longwave normalization - ! ------------------------------------------------------------------------ - - @Test - subroutine twoTopos_at_atmTopo_give_nearlyIdentical_forc_lwrad(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_lwrad = 101._r8 - - ! Setup - call setup_landunit_ncols(ltype = 1, & - ctypes = [0, 1], cweights = [0.7_r8, 0.3_r8]) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_lwrad = [forc_lwrad]) - call this%create_topo(topo_col = [topo, topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - associate(lwrad_col => this%atm2lnd_inst%forc_lwrad_downscaled_col) - ! We expect a small difference due to normalization, so supply a tolerance - @assertEqual([forc_lwrad, forc_lwrad], lwrad_col(bounds%begc:bounds%endc), tolerance=tol) - end associate - end subroutine twoTopos_at_atmTopo_give_nearlyIdentical_forc_lwrad - - @Test - subroutine lwrad_adjusted_correctly(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: atm_topo = 17._r8 - real(r8), parameter :: topo_diff = 10._r8 - real(r8), parameter :: forc_lwrad = 101._r8 - real(r8) :: expected(3) - - ! Setup - ! The columns of interest are the first and third. However, note that they have 0 - ! weight, in order to avoid needing to take normalization into account. We construct - ! the grid so that the normalization factor will be 1 by putting the 100% area column - ! at the atmosphere's topographic height. - call setup_landunit_ncols(ltype = 1, & - ctypes = [0, 1, 2], cweights = [0.0_r8, 1.0_r8, 0.0_r8]) - call this%create_atm2lnd( & - forc_topo = [atm_topo], & - forc_lwrad = [forc_lwrad]) - call this%create_topo(topo_col = [atm_topo - topo_diff, atm_topo, atm_topo + topo_diff]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - associate(lwrad_col => this%atm2lnd_inst%forc_lwrad_downscaled_col) - expected(1) = forc_lwrad + lapse_rate_longwave * topo_diff - expected(2) = forc_lwrad - expected(3) = forc_lwrad - lapse_rate_longwave * topo_diff - @assertEqual(expected, lwrad_col(bounds%begc:bounds%endc), tolerance=tol) - end associate - end subroutine lwrad_adjusted_correctly - - @Test - subroutine lwrad_downscaling_limited(this) - ! Make sure that the downscaling of lwrad obeys the specified bounds - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: atm_topo = 5000._r8 - real(r8), parameter :: forc_lwrad = 100._r8 - ! Use a very big topo_diff in order to trigger the limit: - real(r8), parameter :: topo_diff = 4000._r8 - real(r8), parameter :: longwave_downscaling_limit = 0.4_r8 - real(r8) :: expected(3) - - ! Setup - ! The columns of interest are the first and third. However, note that they have 0 - ! weight, in order to avoid needing to take normalization into account. We construct - ! the grid so that the normalization factor will be 1 by putting the 100% area column - ! at the atmosphere's topographic height. - call setup_landunit_ncols(ltype = 1, & - ctypes = [0, 1, 2], cweights = [0.0_r8, 1.0_r8, 0.0_r8]) - call this%create_atm2lnd( & - forc_topo = [atm_topo], & - forc_lwrad = [forc_lwrad], & - longwave_downscaling_limit = longwave_downscaling_limit) - call this%create_topo(topo_col = [atm_topo - topo_diff, atm_topo, atm_topo + topo_diff]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - associate(lwrad_col => this%atm2lnd_inst%forc_lwrad_downscaled_col) - expected(1) = forc_lwrad * (1._r8 + longwave_downscaling_limit) - expected(2) = forc_lwrad - expected(3) = forc_lwrad * (1._r8 - longwave_downscaling_limit) - @assertEqual(expected, lwrad_col(bounds%begc:bounds%endc), tolerance=tol) - end associate - end subroutine lwrad_downscaling_limited - - ! ------------------------------------------------------------------------ - ! Tests with topo at atmosphere topo: downscaled forcing should be identical to - ! atmospheric forcing - ! ------------------------------------------------------------------------ - - @Test - subroutine topo_at_atmTopo_gives_identical_forc_t(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_t = 301._r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_t = [forc_t]) - call this%create_topo(topo_col = [topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertEqual(forc_t, this%atm2lnd_inst%forc_t_downscaled_col(begc)) - - end subroutine topo_at_atmTopo_gives_identical_forc_t - - @Test - subroutine topo_at_atmTopo_gives_identical_forc_th(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_th = 302._r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_th = [forc_th]) - call this%create_topo(topo_col = [topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertEqual(forc_th, this%atm2lnd_inst%forc_th_downscaled_col(begc)) - - end subroutine topo_at_atmTopo_gives_identical_forc_th - - @Test - subroutine topo_at_atmTopo_gives_identical_forc_q(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_q = 0.01_r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_q = [forc_q]) - call this%create_topo(topo_col = [topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertEqual(forc_q, this%atm2lnd_inst%forc_q_downscaled_col(begc)) - - end subroutine topo_at_atmTopo_gives_identical_forc_q - - @Test - subroutine topo_at_atmTopo_gives_identical_forc_pbot(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_pbot = 100000._r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_pbot = [forc_pbot]) - call this%create_topo(topo_col = [topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertEqual(forc_pbot, this%atm2lnd_inst%forc_pbot_downscaled_col(begc)) - - end subroutine topo_at_atmTopo_gives_identical_forc_pbot - - @Test - subroutine topo_at_atmTopo_gives_identical_forc_rho(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_rho = 1.1_r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_rho = [forc_rho]) - call this%create_topo(topo_col = [topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertEqual(forc_rho, this%atm2lnd_inst%forc_rho_downscaled_col(begc)) - - end subroutine topo_at_atmTopo_gives_identical_forc_rho - - @Test - subroutine topo_at_atmTopo_gives_identical_forc_lwrad(this) - class(TestDownscaleForcings), intent(inout) :: this - real(r8), parameter :: topo = 17._r8 - real(r8), parameter :: forc_lwrad = 101._r8 - - ! Setup - call setup_single_veg_patch(pft_type=1) - call this%create_atm2lnd( & - forc_topo = [topo], & - forc_lwrad = [forc_lwrad]) - call this%create_topo(topo_col = [topo]) - - ! Exercise - call this%call_downscale_forcings() - - ! Verify - @assertEqual(forc_lwrad, this%atm2lnd_inst%forc_lwrad_downscaled_col(begc)) - - end subroutine topo_at_atmTopo_gives_identical_forc_lwrad - -end module test_downscale_forcings diff --git a/src/main/test/atm2lnd_test/test_partition_precip.pf b/src/main/test/atm2lnd_test/test_partition_precip.pf deleted file mode 100644 index 4e996988d0..0000000000 --- a/src/main/test/atm2lnd_test/test_partition_precip.pf +++ /dev/null @@ -1,271 +0,0 @@ -module test_partition_precip - - ! Tests of atm2lndMod: partition_precip - - use pfunit_mod - use atm2lndMod - use atm2lndType - use shr_kind_mod, only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestArrayMod - use landunit_varcon, only : istice_mec - use clm_varcon, only : hfus ! latent heat of fusion for ice [J/kg] - use clm_varcon, only : denh2o ! density of liquid water [kg/m3] - use shr_const_mod, only : SHR_CONST_TKFRZ - - implicit none - - @TestCase - type, extends(TestCase) :: TestPartitionPrecip - type(atm2lnd_type) :: atm2lnd_inst - real(r8), allocatable :: sh_from_conversion(:) - contains - procedure :: setUp - procedure :: tearDown - procedure :: set_inputs - end type TestPartitionPrecip - - real(r8), parameter :: tol = 1.e-13 - real(r8), parameter :: mm_to_m = 1.e-3_r8 ! multiply by this to convert from mm to m - - ! Temperatures in degrees C - real(r8), parameter :: precip_repartition_glc_all_snow_t = -6._r8 - real(r8), parameter :: precip_repartition_glc_all_rain_t = -2._r8 - real(r8), parameter :: precip_repartition_nonglc_all_snow_t = 0._r8 - real(r8), parameter :: precip_repartition_nonglc_all_rain_t = 2._r8 - -contains - - subroutine setUp(this) - class(TestPartitionPrecip), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestPartitionPrecip), intent(inout) :: this - - call this%atm2lnd_inst%Clean() - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine set_inputs(this, rain, snow, temperature, repartition_rain_snow) - ! set necessary input variables - class(TestPartitionPrecip), intent(inout) :: this - real(r8), intent(in) :: rain(:) - real(r8), intent(in) :: snow(:) - real(r8), intent(in) :: temperature(:) - - ! If not provided, set to true - logical, intent(in), optional :: repartition_rain_snow - - logical :: l_repartition_rain_snow - type(atm2lnd_params_type) :: atm2lnd_params - - if (present(repartition_rain_snow)) then - l_repartition_rain_snow = repartition_rain_snow - else - l_repartition_rain_snow = .true. - end if - - atm2lnd_params = atm2lnd_params_type( & - repartition_rain_snow = l_repartition_rain_snow, & - glcmec_downscale_longwave = .false., & - lapse_rate = 0.01_r8, & ! arbitrary (this is unused for these tests) - precip_repartition_glc_all_snow_t = precip_repartition_glc_all_snow_t, & - precip_repartition_glc_all_rain_t = precip_repartition_glc_all_rain_t, & - precip_repartition_nonglc_all_snow_t = precip_repartition_nonglc_all_snow_t, & - precip_repartition_nonglc_all_rain_t = precip_repartition_nonglc_all_rain_t) - - ! Allocate necessary variables - call this%atm2lnd_inst%InitForTesting(bounds, atm2lnd_params) - this%sh_from_conversion = col_array() - - ! set input variables - this%atm2lnd_inst%forc_rain_not_downscaled_grc(bounds%begg:bounds%endg) = rain(:) - this%atm2lnd_inst%forc_snow_not_downscaled_grc(bounds%begg:bounds%endg) = snow(:) - this%atm2lnd_inst%forc_t_downscaled_col(bounds%begc:bounds%endc) = temperature(:) - end subroutine set_inputs - - @Test - subroutine lowTemp_resultsInCorrectPartitioning(this) - class(TestPartitionPrecip), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[1._r8], snow=[2._r8], temperature=[270._r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - associate(& - rain_col => this%atm2lnd_inst%forc_rain_downscaled_col, & - snow_col => this%atm2lnd_inst%forc_snow_downscaled_col) - @assertEqual(0._r8, rain_col(begc), tolerance=tol) - @assertEqual(3._r8, snow_col(begc), tolerance=tol) - end associate - end subroutine lowTemp_resultsInCorrectPartitioning - - @Test - subroutine highTemp_resultsInCorrectPartitioning(this) - class(TestPartitionPrecip), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[1._r8], snow=[2._r8], temperature=[276._r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - associate(& - rain_col => this%atm2lnd_inst%forc_rain_downscaled_col, & - snow_col => this%atm2lnd_inst%forc_snow_downscaled_col) - @assertEqual(3._r8, rain_col(begc), tolerance=tol) - @assertEqual(0._r8, snow_col(begc), tolerance=tol) - end associate - end subroutine highTemp_resultsInCorrectPartitioning - - @Test - subroutine intermediateTemp_resultsInCorrectPartitioning(this) - class(TestPartitionPrecip), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[1._r8], snow=[2._r8], temperature=[SHR_CONST_TKFRZ + 1.5_r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - associate(& - rain_col => this%atm2lnd_inst%forc_rain_downscaled_col, & - snow_col => this%atm2lnd_inst%forc_snow_downscaled_col) - @assertEqual(3._r8 * 0.75_r8, rain_col(begc), tolerance=tol) - @assertEqual(3._r8 * 0.25_r8, snow_col(begc), tolerance=tol) - end associate - end subroutine intermediateTemp_resultsInCorrectPartitioning - - @Test - subroutine intermediateTemp_glacier_resultsInCorrectPartitioning(this) - class(TestPartitionPrecip), intent(inout) :: this - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_landunit_ncols(ltype = istice_mec, lweight = 1._r8, & - ctypes = [1], cweights = [1._r8]) - call unittest_subgrid_setup_end() - - ! Choose a temperature 3/4 of the way from all-snow to all-rain - call this%set_inputs(rain=[1._r8], snow=[2._r8], temperature=[SHR_CONST_TKFRZ - 3._r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - associate(& - rain_col => this%atm2lnd_inst%forc_rain_downscaled_col, & - snow_col => this%atm2lnd_inst%forc_snow_downscaled_col) - @assertEqual(3._r8 * 0.75_r8, rain_col(begc), tolerance=tol) - @assertEqual(3._r8 * 0.25_r8, snow_col(begc), tolerance=tol) - end associate - end subroutine intermediateTemp_glacier_resultsInCorrectPartitioning - - @Test - subroutine noConversion_resultsInNoHeatFlux(this) - class(TestPartitionPrecip), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[5._r8], snow=[0._r8], temperature=[290._r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - @assertEqual([0._r8], this%sh_from_conversion) - end subroutine noConversion_resultsInNoHeatFlux - - @Test - subroutine snowToRain_resultsInCorrectHeatFlux(this) - class(TestPartitionPrecip), intent(inout) :: this - real(r8), parameter :: snow_old = 3._r8 ! [mm] - real(r8) :: expected - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[2._r8], snow=[snow_old], temperature=[290._r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - ! Snow to rain extracts energy, so results in a negative heat flux to atm - expected = -1._r8 * snow_old * mm_to_m * denh2o * hfus - @assertEqual([expected], this%sh_from_conversion, tolerance=tol) - end subroutine snowToRain_resultsInCorrectHeatFlux - - @Test - subroutine rainToSnow_resultsInCorrectHeatFlux(this) - class(TestPartitionPrecip), intent(inout) :: this - real(r8), parameter :: rain_old = 2._r8 ! [mm] - real(r8) :: expected - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[rain_old], snow=[3._r8], temperature=[250._r8]) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - ! Rain to snow releases energy, so results in a positive heat flux to atm - expected = rain_old * mm_to_m * denh2o * hfus - @assertEqual([expected], this%sh_from_conversion, tolerance=tol) - end subroutine rainToSnow_resultsInCorrectHeatFlux - - @Test - subroutine repartitionFlagFalse_resultsInNoChange(this) - class(TestPartitionPrecip), intent(inout) :: this - - call setup_single_veg_patch(pft_type=1) - call this%set_inputs(rain=[1._r8], snow=[2._r8], temperature=[250._r8], & - repartition_rain_snow = .false.) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - associate(& - rain_col => this%atm2lnd_inst%forc_rain_downscaled_col, & - snow_col => this%atm2lnd_inst%forc_snow_downscaled_col) - @assertEqual([1._r8], rain_col) - @assertEqual([2._r8], snow_col) - @assertEqual([0._r8], this%sh_from_conversion) - end associate - end subroutine repartitionFlagFalse_resultsInNoChange - - @Test - subroutine multiPoint_resultsInCorrectPartitioning(this) - class(TestPartitionPrecip), intent(inout) :: this - real(r8), parameter :: rain(2) = [1._r8, 3._r8] - real(r8), parameter :: snow(2) = [2._r8, 4._r8] - real(r8), parameter :: temp(2) = [290._r8, 250._r8] - real(r8), parameter :: rain_expected(2) = [3._r8, 0._r8] - real(r8), parameter :: snow_expected(2) = [0._r8, 7._r8] - - call setup_ncells_single_veg_patch(ncells=2, pft_type=1) - call this%set_inputs(rain=rain, snow=snow, temperature=temp) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - associate(& - rain_col => this%atm2lnd_inst%forc_rain_downscaled_col, & - snow_col => this%atm2lnd_inst%forc_snow_downscaled_col) - @assertEqual(rain_expected, rain_col, tolerance=tol) - @assertEqual(snow_expected, snow_col, tolerance=tol) - end associate - - end subroutine multiPoint_resultsInCorrectPartitioning - - @Test - subroutine multiPoint_resultsInCorrectHeatFlux(this) - class(TestPartitionPrecip), intent(inout) :: this - real(r8), parameter :: rain(2) = [1._r8, 3._r8] - real(r8), parameter :: snow(2) = [2._r8, 4._r8] - real(r8), parameter :: temp(2) = [290._r8, 250._r8] - real(r8) :: sens_heat_expected(2) - - call setup_ncells_single_veg_patch(ncells=2, pft_type=1) - call this%set_inputs(rain=rain, snow=snow, temperature=temp) - - call partition_precip(bounds, this%atm2lnd_inst, this%sh_from_conversion) - - ! grid cell 1: converts snow to rain - sens_heat_expected(1) = -1._r8 * snow(1) * mm_to_m * denh2o * hfus - ! grid cell 2: converts rain to snow - sens_heat_expected(2) = rain(2) * mm_to_m * denh2o * hfus - - @assertEqual(sens_heat_expected, this%sh_from_conversion, tolerance=tol) - - end subroutine multiPoint_resultsInCorrectHeatFlux - -end module test_partition_precip diff --git a/src/main/test/atm2lnd_test/test_sens_heat_from_precip_conversion.pf b/src/main/test/atm2lnd_test/test_sens_heat_from_precip_conversion.pf deleted file mode 100644 index 44ca36b9ec..0000000000 --- a/src/main/test/atm2lnd_test/test_sens_heat_from_precip_conversion.pf +++ /dev/null @@ -1,43 +0,0 @@ -module test_sens_heat_from_precip_conversion - - ! Tests of atm2lndMod: sens_heat_from_precip_conversion - ! This module just tests edge cases that would be difficult to test from the - ! multi-point wrapper. - - use pfunit_mod - use atm2lndMod - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_varcon, only : hfus ! latent heat of fusion for ice [J/kg] - use clm_varcon, only : denh2o ! density of liquid water [kg/m3] - - implicit none - - real(r8), parameter :: tol = 1.e-13_r8 - real(r8), parameter :: mm_to_m = 1.e-3_r8 ! multiply by this to convert from mm to m - -contains - - @Test - subroutine partialConversion_resultsInCorrectHeatFlux() - real(r8), parameter :: rain_old = 2._r8 ! [mm] - real(r8), parameter :: snow_old = 5._r8 ! [mm] - real(r8), parameter :: rain_new = 6._r8 ! [mm] - real(r8), parameter :: snow_new = 1._r8 ! [mm] - real(r8) :: sens_heat_flux ! [W/m2 to atm] - real(r8) :: expected - - call sens_heat_from_precip_conversion( & - rain_old = rain_old, & - snow_old = snow_old, & - rain_new = rain_new, & - snow_new = snow_new, & - sens_heat_flux = sens_heat_flux) - - ! Snow to rain extracts energy, so results in a negative heat flux to atm - expected = -4._r8 * mm_to_m * denh2o * hfus - @assertEqual(expected, sens_heat_flux, tolerance=tol) - - end subroutine partialConversion_resultsInCorrectHeatFlux - -end module test_sens_heat_from_precip_conversion - diff --git a/src/main/test/clm_glclnd_test/CMakeLists.txt b/src/main/test/clm_glclnd_test/CMakeLists.txt deleted file mode 100644 index f7ac27caf5..0000000000 --- a/src/main/test/clm_glclnd_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(clm_glclnd test_clm_glclnd_exe - "test_clm_glclnd.pf" "") - -target_link_libraries(test_clm_glclnd_exe clm csm_share) \ No newline at end of file diff --git a/src/main/test/clm_glclnd_test/test_clm_glclnd.pf b/src/main/test/clm_glclnd_test/test_clm_glclnd.pf deleted file mode 100644 index 03d60684af..0000000000 --- a/src/main/test/clm_glclnd_test/test_clm_glclnd.pf +++ /dev/null @@ -1,76 +0,0 @@ -module test_clm_glclnd - - ! Tests of clm_glclnd - - use pfunit_mod - use unittestSubgridMod - use shr_kind_mod, only : r8 => shr_kind_r8 - use lnd2glcMod - use landunit_varcon, only : istsoil, istice_mec - - implicit none - save - - real(r8), parameter :: tol = 1.e-14_r8 - -contains - - ! ------------------------------------------------------------------------ - ! Tests of bareland_normalization - ! ------------------------------------------------------------------------ - - @Test - subroutine test_bareland_normalization_glacier100() - ! glacier 100% of grid cell - integer :: c_soil ! column index of soil column - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=0.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1.0_r8) - c_soil = ci - call unittest_add_landunit(my_gi=gi, ltype=istice_mec, wtgcell=1.0_r8) - call unittest_subgrid_setup_end() - - @assertEqual(1.0_r8, bareland_normalization(c_soil)) - - call unittest_subgrid_teardown() - end subroutine test_bareland_normalization_glacier100 - - @Test - subroutine test_bareland_normalization_not1() - ! glacier < 100% of grid cell, natural veg < 100% of the remainder - integer :: c_soil ! column index of soil column - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=0.3_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1.0_r8) - c_soil = ci - call unittest_add_landunit(my_gi=gi, ltype=istice_mec, wtgcell=0.6_r8) - call unittest_subgrid_setup_end() - - @assertEqual(0.75_r8, bareland_normalization(c_soil), tolerance=tol) - - call unittest_subgrid_teardown() - end subroutine test_bareland_normalization_not1 - - @Test - subroutine test_bareland_normalization_1() - ! glacier < 100% of grid cell, natural veg 100% of the remainder - integer :: c_soil ! column index of soil column - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=0.4_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1.0_r8) - c_soil = ci - call unittest_add_landunit(my_gi=gi, ltype=istice_mec, wtgcell=0.6_r8) - call unittest_subgrid_setup_end() - - @assertEqual(1.0_r8, bareland_normalization(c_soil)) - - call unittest_subgrid_teardown() - end subroutine test_bareland_normalization_1 - -end module test_clm_glclnd diff --git a/src/main/test/filter_test/CMakeLists.txt b/src/main/test/filter_test/CMakeLists.txt deleted file mode 100644 index c5cd2b3eb4..0000000000 --- a/src/main/test/filter_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(filter test_filter_exe - "test_filter_col.pf" "") - -target_link_libraries(test_filter_exe clm csm_share) \ No newline at end of file diff --git a/src/main/test/filter_test/test_filter_col.pf b/src/main/test/filter_test/test_filter_col.pf deleted file mode 100644 index 55c11c4fb6..0000000000 --- a/src/main/test/filter_test/test_filter_col.pf +++ /dev/null @@ -1,474 +0,0 @@ -module test_filter_col - - ! Tests of filterColMod - - use pfunit_mod - use filterColMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestArrayMod - use ColumnType, only : col - use landunit_varcon, only : istsoil - - implicit none - - @TestCase - type, extends(TestCase) :: TestFilterCol - contains - procedure :: setUp - procedure :: tearDown - end type TestFilterCol - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - subroutine setUp(this) - class(TestFilterCol), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestFilterCol), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - ! ------------------------------------------------------------------------ - ! Tests of equals method - ! ------------------------------------------------------------------------ - - @Test - subroutine equals_true(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter1, filter2 - - call setup_ncells_single_veg_patch(ncells = 4, pft_type = 1) - filter1 = col_filter_from_index_array(bounds, [bounds%begc, bounds%begc+2]) - filter2 = col_filter_from_index_array(bounds, [bounds%begc, bounds%begc+2]) - - @assertTrue(filter1 == filter2) - - end subroutine equals_true - - @Test - subroutine equals_different_size(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter1, filter2 - - call setup_ncells_single_veg_patch(ncells = 4, pft_type = 1) - filter1 = col_filter_from_index_array(bounds, [bounds%begc, bounds%begc+2]) - filter2 = col_filter_from_index_array(bounds, [bounds%begc]) - - @assertFalse(filter1 == filter2) - - end subroutine equals_different_size - - @Test - subroutine equals_different_points(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter1, filter2 - - call setup_ncells_single_veg_patch(ncells = 4, pft_type = 1) - filter1 = col_filter_from_index_array(bounds, [bounds%begc, bounds%begc+2]) - filter2 = col_filter_from_index_array(bounds, [bounds%begc, bounds%begc+1]) - - @assertFalse(filter1 == filter2) - end subroutine equals_different_points - - ! ------------------------------------------------------------------------ - ! Tests of col_filter_from_logical_array - ! ------------------------------------------------------------------------ - - @Test - subroutine logicalArray_true(this) - ! Test col_filter_from_logical_array with logical true - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - logical, parameter :: logical_col(1) = [.true.] - - call setup_single_veg_patch(pft_type = 1) - expected = col_filter_from_index_array(bounds, [ci]) - - filter = col_filter_from_logical_array(bounds, logical_col) - - @assertTrue(filter == expected) - end subroutine logicalArray_true - - @Test - subroutine logicalArray_false(this) - ! Test col_filter_from_logical_array with logical false - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - logical, parameter :: logical_col(1) = [.false.] - - call setup_single_veg_patch(pft_type = 1) - expected = col_filter_empty(bounds) - - filter = col_filter_from_logical_array(bounds, logical_col) - - @assertTrue(filter == expected) - end subroutine logicalArray_false - - @Test - subroutine logicalArray_includes_inactive(this) - ! Test col_filter_from_logical_array with an inactive point: this function should - ! ignore the 'active' status of each column - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - logical, parameter :: logical_col(1) = [.true.] - - call setup_single_veg_patch(pft_type = 1) - expected = col_filter_from_index_array(bounds, [ci]) - col%active(ci) = .false. - - filter = col_filter_from_logical_array(bounds, logical_col) - - @assertTrue(filter == expected) - end subroutine logicalArray_includes_inactive - - @Test - subroutine logicalArray_multiple_points(this) - ! Test col_filter_from_logical_array with multiple points, some in and some out of - ! the filter - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - logical, parameter :: logical_col(4) = [.true., .false., .true., .false.] - - call setup_ncells_single_veg_patch(ncells = 4, pft_type = 1) - expected = col_filter_from_index_array(bounds, [bounds%begc, bounds%begc+2]) - - filter = col_filter_from_logical_array(bounds, logical_col) - - @assertTrue(filter == expected) - end subroutine logicalArray_multiple_points - - ! ------------------------------------------------------------------------ - ! Tests of col_filter_from_logical_array_active_only - ! ------------------------------------------------------------------------ - - @Test - subroutine logicalArrayActiveOnly_multiple_points(this) - ! Test col_filter_from_logical_array_active_only with multiple points, some in and - ! some out of the filter (either because the logical array is false or because - ! 'active' is false - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - logical, parameter :: logical_col(3) = [.true., .true., .false.] - logical, parameter :: active_col(3) = [.false., .true., .true.] - - call setup_ncells_single_veg_patch(ncells = 3, pft_type = 1) - col%active(bounds%begc:bounds%endc) = active_col(:) - expected = col_filter_from_index_array(bounds, [bounds%begc+1]) - - filter = col_filter_from_logical_array_active_only(bounds, logical_col) - - @assertTrue(filter == expected) - end subroutine logicalArrayActiveOnly_multiple_points - - ! ------------------------------------------------------------------------ - ! Tests of col_filter_from_ltypes - ! ------------------------------------------------------------------------ - - @Test - subroutine ltypes_multipleTargetLandunits(this) - ! Tests col_filter_from_ltypes with multiple target landunits and multiple landunits - ! present on a gridcell - some of which are in the list of target landunits and some - ! of which are not. - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - integer, allocatable :: expected_indices(:) - integer, parameter :: target_ltype1 = 2 - integer, parameter :: target_ltype2 = 3 - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call my_add_landunit(target_ltype1 - 1) - call my_add_landunit(target_ltype1) - expected_indices = [ci - 1, ci] - call my_add_landunit(target_ltype2) - expected_indices = [expected_indices, ci - 1, ci] - call my_add_landunit(target_ltype2 + 1) - call unittest_subgrid_setup_end() - expected = col_filter_from_index_array(bounds, expected_indices) - - filter = col_filter_from_ltypes(bounds = bounds, & - ltypes = [target_ltype1, target_ltype2], & - include_inactive = .false.) - - @assertTrue(filter == expected) - - contains - subroutine my_add_landunit(ltype) - integer, intent(in) :: ltype - - call create_landunit_ncols(ltype = ltype, lweight = 0.25_r8, & - ctypes = [1, 2], cweights = [0.5_r8, 0.5_r8]) - end subroutine my_add_landunit - - end subroutine ltypes_multipleTargetLandunits - - @Test - subroutine ltypes_excludes_inactive(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call setup_single_veg_patch(pft_type = 1) - col%active(bounds%begc) = .false. - expected = col_filter_empty(bounds) - - filter = col_filter_from_ltypes(bounds = bounds, & - ltypes = [istsoil], & - include_inactive = .false.) - - @assertTrue(filter == expected) - end subroutine ltypes_excludes_inactive - - ! ------------------------------------------------------------------------ - ! Tests of col_filter_from_lunflags - ! ------------------------------------------------------------------------ - - @Test - subroutine lunflags_multipleLandunits(this) - ! Multiple landunits, with two columns on each: some landunits have flag true, some - ! have flag false - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - integer, allocatable :: expected_indices(:) - logical :: lunflags(3) - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_landunit_ncols(ltype = 1, lweight = 0.25_r8, & - ctypes = [1, 2], cweights = [0.5_8, 0.5_r8]) - call create_landunit_ncols(ltype = 2, lweight = 0.25_r8, & - ctypes = [1, 2], cweights = [0.5_8, 0.5_r8]) - call create_landunit_ncols(ltype = 3, lweight = 0.5_r8, & - ctypes = [1, 2], cweights = [0.5_8, 0.5_r8]) - call unittest_subgrid_setup_end() - - lunflags = [.false., .true., .false.] - expected_indices = [begc + 2, begc + 3] - expected = col_filter_from_index_array(bounds, expected_indices) - - filter = col_filter_from_lunflags(bounds = bounds, & - lunflags = lunflags, & - include_inactive = .false.) - - @assertTrue(filter == expected) - end subroutine lunflags_multipleLandunits - - @Test - subroutine lunflags_excludes_inactive(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call setup_single_veg_patch(pft_type = 1) - col%active(bounds%begc) = .false. - expected = col_filter_empty(bounds) - - filter = col_filter_from_lunflags(bounds = bounds, & - lunflags = [.true.], & - include_inactive = .false.) - - @assertTrue(filter == expected) - end subroutine lunflags_excludes_inactive - - ! ------------------------------------------------------------------------ - ! Tests of col_filter_from_grcflags_ltypes - ! ------------------------------------------------------------------------ - - @Test - subroutine grcflagsLtypes_includes_point(this) - ! Basic test of col_filter_from_grcflags_ltypes, with an included point - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call setup_single_veg_patch(pft_type = 1) - expected = col_filter_from_index_array(bounds, [bounds%begc]) - - filter = col_filter_from_grcflags_ltypes(bounds = bounds, & - grcflags = grc_array(.true.), ltypes = [istsoil], & - include_inactive = .false.) - - @assertTrue(filter == expected) - end subroutine grcflagsLtypes_includes_point - - @Test - subroutine grcflagsLtypes_excludes_inactive(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call setup_single_veg_patch(pft_type = 1) - col%active(bounds%begc) = .false. - expected = col_filter_empty(bounds) - - filter = col_filter_from_grcflags_ltypes(bounds = bounds, & - grcflags = grc_array(.true.), ltypes = [istsoil], & - include_inactive = .false.) - - @assertTrue(filter == expected) - end subroutine grcflagsLtypes_excludes_inactive - - @Test - subroutine grcflagsLtypes_includeInactive_includes_inactive(this) - class(TestFilterCol), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call setup_single_veg_patch(pft_type = 1) - col%active(bounds%begc) = .false. - expected = col_filter_from_index_array(bounds, [bounds%begc]) - - filter = col_filter_from_grcflags_ltypes(bounds = bounds, & - grcflags = grc_array(.true.), ltypes = [istsoil], & - include_inactive = .true.) - - @assertTrue(filter == expected) - end subroutine grcflagsLtypes_includeInactive_includes_inactive - - - @Test - subroutine grcflagsLtypes_multipleGridcells(this) - ! Test col_filter_from_grcflags_ltypes with multiple grid cells, some with flag true - ! and some with flag false - class(TestFilterCol), intent(inout) :: this - integer, parameter :: target_ltype = 3 - logical, parameter :: grcflags(3) = [.false., .true., .false.] - integer, allocatable :: expected_indices(:) - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call unittest_subgrid_setup_start() - call my_add_gridcell() - call my_add_gridcell() - expected_indices = [ci - 1, ci] - call my_add_gridcell() - call unittest_subgrid_setup_end() - expected = col_filter_from_index_array(bounds, expected_indices) - - filter = col_filter_from_grcflags_ltypes(bounds = bounds, & - grcflags = grcflags, ltypes = [target_ltype], & - include_inactive = .false.) - - @assertTrue(filter == expected) - contains - subroutine my_add_gridcell - call unittest_add_gridcell() - call create_landunit_ncols(ltype = target_ltype, lweight = 1._r8, & - ctypes = [1, 2], cweights = [0.5_r8, 0.5_r8]) - end subroutine my_add_gridcell - - end subroutine grcflagsLtypes_multipleGridcells - - @Test - subroutine grcflagsLtypes_multipleLandunits(this) - ! Test col_filter_from_grcflags_ltypes with multiple landunits, some in the landunit - ! type array and some not - class(TestFilterCol), intent(inout) :: this - integer, parameter :: target_ltype1 = 2 - integer, parameter :: target_ltype2 = 3 - logical, parameter :: grcflags(1) = [.true.] - integer, allocatable :: expected_indices(:) - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call my_add_landunit(target_ltype1 - 1) - call my_add_landunit(target_ltype1) - expected_indices = [ci - 1, ci] - call my_add_landunit(target_ltype2) - expected_indices = [expected_indices, ci - 1, ci] - call my_add_landunit(target_ltype2 + 1) - call unittest_subgrid_setup_end() - expected = col_filter_from_index_array(bounds, expected_indices) - - filter = col_filter_from_grcflags_ltypes(bounds = bounds, & - grcflags = grcflags, ltypes = [target_ltype1, target_ltype2], & - include_inactive = .false.) - - @assertTrue(filter == expected) - - contains - subroutine my_add_landunit(ltype) - integer, intent(in) :: ltype - - call create_landunit_ncols(ltype = ltype, lweight = 0.25_r8, & - ctypes = [1, 2], cweights = [0.5_r8, 0.5_r8]) - end subroutine my_add_landunit - - end subroutine grcflagsLtypes_multipleLandunits - - @Test - subroutine grcflagsLtypes_ltypeNotPresent(this) - ! Test col_filter_from_grcflags_ltypes with a landunit type not present. It should - ! skip over that absent landunit type, but still include the present landunit type - ! that comes later. - class(TestFilterCol), intent(inout) :: this - integer, parameter :: target_ltype_not_present = 1 - integer, parameter :: target_ltype_present = 2 - logical, parameter :: grcflags(1) = [.true.] - integer, allocatable :: expected_indices(:) - type(filter_col_type) :: filter - type(filter_col_type) :: expected - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_landunit_ncols(ltype = target_ltype_present, lweight = 1._r8, & - ctypes = [1, 2], cweights = [0.5_r8, 0.5_r8]) - expected_indices = [ci - 1, ci] - call unittest_subgrid_setup_end() - expected = col_filter_from_index_array(bounds, expected_indices) - - filter = col_filter_from_grcflags_ltypes(bounds = bounds, & - grcflags = grcflags, ltypes = [target_ltype_not_present, target_ltype_present], & - include_inactive = .false.) - - @assertTrue(filter == expected) - end subroutine grcflagsLtypes_ltypeNotPresent - - ! ------------------------------------------------------------------------ - ! Tests of col_filter_from_filter_and_logical_array - ! ------------------------------------------------------------------------ - - @Test - subroutine filterAndLogicalArray_multiple_points(this) - ! Test col_filter_from_filter_and_logical_array with multiple points, with various - ! combinations of inside and outside the filter, and inside and outside the logical - ! array - class(TestFilterCol), intent(inout) :: this - - ! Final filter should be set where both of the following are true: - logical, parameter :: logical_orig(6) = [.false., .true., .false., .true., .false., .true.] - logical, parameter :: logical_new (6) = [.false., .false., .false., .true., .true., .true.] - - type(filter_col_type) :: filter_orig - type(filter_col_type) :: filter_new - type(filter_col_type) :: expected - - call setup_ncells_single_veg_patch(ncells = 6, pft_type = 1) - filter_orig = col_filter_from_logical_array(bounds, logical_orig) - expected = col_filter_from_index_array(bounds, [bounds%begc+3, bounds%begc+5]) - - filter_new = col_filter_from_filter_and_logical_array(& - bounds = bounds, & - num_orig = filter_orig%num, & - filter_orig = filter_orig%indices, & - logical_col = logical_new) - - @assertTrue(filter_new == expected) - end subroutine filterAndLogicalArray_multiple_points - -end module test_filter_col diff --git a/src/main/test/glcBehavior_test/CMakeLists.txt b/src/main/test/glcBehavior_test/CMakeLists.txt deleted file mode 100644 index caf52f4439..0000000000 --- a/src/main/test/glcBehavior_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(glcBehavior test_glcBehavior_exe - "test_glcBehavior.pf" "") - -target_link_libraries(test_glcBehavior_exe clm csm_share) \ No newline at end of file diff --git a/src/main/test/glcBehavior_test/test_glcBehavior.pf b/src/main/test/glcBehavior_test/test_glcBehavior.pf deleted file mode 100644 index 90f12013a9..0000000000 --- a/src/main/test/glcBehavior_test/test_glcBehavior.pf +++ /dev/null @@ -1,318 +0,0 @@ -module test_glcBehavior - - ! Tests of glcBehaviorMod - - use pfunit_mod - use glcBehaviorMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestArrayMod - use column_varcon, only : col_itype_to_icemec_class, icemec_class_to_col_itype - use landunit_varcon, only : istice_mec - use glcBehaviorMod, only : glc_behavior_type - use ColumnType, only : col - use unittestGlcMec - - implicit none - - @TestCase - type, extends(TestCase) :: TestGlcBehavior - contains - procedure :: setUp - procedure :: tearDown - end type TestGlcBehavior - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - subroutine setUp(this) - class(TestGlcBehavior), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestGlcBehavior), intent(inout) :: this - - call unittest_subgrid_teardown() - call teardown_elevation_classes() - end subroutine tearDown - - function create_glc_behavior_all_collapse() result(glc_behavior) - ! Create a glc_behavior object where all grid cells get collapsed to a single column - type(glc_behavior_type) :: glc_behavior - - call glc_behavior%InitSetDirectly(bounds%begg, bounds%endg, & - has_virtual_columns = grc_array(.false.), & - collapse_to_atm_topo = grc_array(.true.)) - end function create_glc_behavior_all_collapse - - ! ------------------------------------------------------------------------ - ! Tests of setup / initialization - ! ------------------------------------------------------------------------ - - @Test - subroutine init_multiple_behaviorIsCorrect(this) - ! Make sure behavior is correct for 'multiple' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['multiple'], & - glacier_region_melt_behavior_str = ['replaced_by_ice'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice']) - - @assertFalse(glc_behavior%has_virtual_columns_grc(bounds%begg)) - @assertFalse(glc_behavior%get_collapse_to_atm_topo(bounds%begg)) - @assertTrue(glc_behavior%allow_multiple_columns_grc(bounds%begg)) - end subroutine init_multiple_behaviorIsCorrect - - @Test - subroutine init_virtual_behaviorIsCorrect(this) - ! Make sure behavior is correct for 'virtual' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['virtual'], & - glacier_region_melt_behavior_str = ['replaced_by_ice'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice']) - - @assertTrue(glc_behavior%has_virtual_columns_grc(bounds%begg)) - @assertFalse(glc_behavior%get_collapse_to_atm_topo(bounds%begg)) - @assertTrue(glc_behavior%allow_multiple_columns_grc(bounds%begg)) - end subroutine init_virtual_behaviorIsCorrect - - @Test - subroutine init_single_behaviorIsCorrect(this) - ! Make sure behavior is correct for 'single_at_atm_topo' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['single_at_atm_topo'], & - glacier_region_melt_behavior_str = ['replaced_by_ice'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice']) - - @assertFalse(glc_behavior%has_virtual_columns_grc(bounds%begg)) - @assertTrue(glc_behavior%get_collapse_to_atm_topo(bounds%begg)) - @assertFalse(glc_behavior%allow_multiple_columns_grc(bounds%begg)) - end subroutine init_single_behaviorIsCorrect - - @Test - subroutine init_replaced_behaviorIsCorrect(this) - ! Make sure melt behavior is correct for 'replaced_by_ice' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['single_at_atm_topo'], & - glacier_region_melt_behavior_str = ['replaced_by_ice'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice']) - - @assertTrue(glc_behavior%melt_replaced_by_ice_grc(bounds%begg)) - end subroutine init_replaced_behaviorIsCorrect - - @Test - subroutine init_remains_behaviorIsCorrect(this) - ! Make sure melt behavior is correct for 'remains_in_place' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['single_at_atm_topo'], & - glacier_region_melt_behavior_str = ['remains_in_place'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice']) - - @assertFalse(glc_behavior%melt_replaced_by_ice_grc(bounds%begg)) - end subroutine init_remains_behaviorIsCorrect - - @Test - subroutine init_remainsIce_behaviorIsCorrect(this) - ! Make sure ice runoff behavior is correct for 'remains_ice' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['single_at_atm_topo'], & - glacier_region_melt_behavior_str = ['replaced_by_ice'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice']) - - @assertFalse(glc_behavior%ice_runoff_melted_grc(bounds%begg)) - end subroutine init_remainsIce_behaviorIsCorrect - - @Test - subroutine init_melted_behaviorIsCorrect(this) - ! Make sure ice runoff behavior is correct for 'melted' - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_single_veg_patch(0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0], & - glacier_region_behavior_str = ['single_at_atm_topo'], & - glacier_region_melt_behavior_str = ['replaced_by_ice'], & - glacier_region_ice_runoff_behavior_str = ['melted']) - - @assertTrue(glc_behavior%ice_runoff_melted_grc(bounds%begg)) - end subroutine init_melted_behaviorIsCorrect - - @Test - subroutine init_multipleGridCells(this) - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - - call setup_ncells_single_veg_patch(ncells = 3, pft_type = 0) - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0, 1, 0], & - glacier_region_behavior_str = ['multiple', 'virtual '], & - glacier_region_melt_behavior_str = ['replaced_by_ice ', 'remains_in_place'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice', 'melted ']) - - @assertFalse(glc_behavior%has_virtual_columns_grc(bounds%begg)) - @assertTrue(glc_behavior%has_virtual_columns_grc(bounds%begg + 1)) - @assertFalse(glc_behavior%has_virtual_columns_grc(bounds%begg + 2)) - - @assertTrue(glc_behavior%melt_replaced_by_ice_grc(bounds%begg)) - @assertFalse(glc_behavior%melt_replaced_by_ice_grc(bounds%begg + 1)) - @assertTrue(glc_behavior%melt_replaced_by_ice_grc(bounds%begg + 2)) - - @assertFalse(glc_behavior%ice_runoff_melted_grc(bounds%begg)) - @assertTrue(glc_behavior%ice_runoff_melted_grc(bounds%begg + 1)) - @assertFalse(glc_behavior%ice_runoff_melted_grc(bounds%begg + 2)) - end subroutine init_multipleGridCells - - ! ------------------------------------------------------------------------ - ! Tests of update_glc_classes - ! ------------------------------------------------------------------------ - - @Test - subroutine update_glc_classes_basic(this) - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - integer, parameter :: glc_nec = 3 - real(r8), parameter :: topomax(0:glc_nec) = [0._r8, 10._r8, 20._r8, 30._r8] - real(r8), parameter :: new_topo = 15._r8 - integer, parameter :: new_elev_class = 2 - real(r8), allocatable :: topo_col(:) - - call setup_elevation_classes(glc_nec, topomax) - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_collapse() - col%type_is_dynamic(:) = .true. - - topo_col = col_array(new_topo) - call glc_behavior%update_glc_classes(bounds, topo_col) - - @assertEqual(new_elev_class, col_itype_to_icemec_class(col%itype(bounds%begc))) - end subroutine update_glc_classes_basic - - @Test - subroutine update_glc_classes_non_icemec(this) - ! A column that is not ice_mec should remain unchanged - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - real(r8), parameter :: new_topo = 15._r8 - integer :: coltype_orig - real(r8), allocatable :: topo_col(:) - - call setup_elevation_classes(3, [0._r8, 1._r8, 2._r8, 3._r8]) - call setup_single_veg_patch(pft_type=1) - glc_behavior = create_glc_behavior_all_collapse() - coltype_orig = col%itype(bounds%begc) - - topo_col = col_array(new_topo) - call glc_behavior%update_glc_classes(bounds, topo_col) - - @assertEqual(coltype_orig, col%itype(bounds%begc)) - end subroutine update_glc_classes_non_icemec - - @Test - subroutine have_dynamic_type(this) - ! Tests cols_have_dynamic_type_array and patches_have_dynamic_type_array - class(TestGlcBehavior), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - logical, allocatable :: has_dynamic_type_col(:) - logical, allocatable :: has_dynamic_type_patch(:) - logical, allocatable :: has_dynamic_type_col_expected(:) - logical, allocatable :: has_dynamic_type_patch_expected(:) - - ! Setup - - call setup_elevation_classes(3, [0._r8, 1._r8, 2._r8, 3._r8]) - - ! Create 3 grid cells, all with one landunit of type istice_mec. The first and third - ! will have multiple elevation classes; the second will have a single elevation class - ! at the atmosphere's topographic height. All columns have 2 patches (which is not - ! typical for istice_mec, but tests the code better). - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_landunit_ncols(ltype = istice_mec, lweight = 1._r8, & - ctypes = [icemec_class_to_col_itype(1), icemec_class_to_col_itype(2)], & - cweights = [0.5_r8, 0.5_r8], & - npatches = 2) - call unittest_add_gridcell() - call create_landunit_ncols(ltype = istice_mec, lweight = 1._r8, & - ctypes = [icemec_class_to_col_itype(2)], & - cweights = [1._r8], & - npatches = 2) - call unittest_add_gridcell() - call create_landunit_ncols(ltype = istice_mec, lweight = 1._r8, & - ctypes = [icemec_class_to_col_itype(1), icemec_class_to_col_itype(2)], & - cweights = [0.5_r8, 0.5_r8], & - npatches = 2) - call unittest_subgrid_setup_end() - - call glc_behavior%InitFromInputs(bounds%begg, bounds%endg, & - glacier_region_map = [0, 1, 0], & - glacier_region_behavior_str = ['multiple ', 'single_at_atm_topo'], & - glacier_region_melt_behavior_str = ['remains_in_place', 'remains_in_place'], & - glacier_region_ice_runoff_behavior_str = ['remains_ice', 'remains_ice']) - - ! Exercise - - has_dynamic_type_col = col_array(.false.) - has_dynamic_type_patch = patch_array(.false.) - call glc_behavior%cols_have_dynamic_type_array(bounds%begc, bounds%endc, & - has_dynamic_type_col) - call glc_behavior%patches_have_dynamic_type_array(bounds%begp, bounds%endp, & - has_dynamic_type_patch) - - ! Verify - - has_dynamic_type_col_expected = col_array(.false.) - has_dynamic_type_patch_expected = patch_array(.false.) - has_dynamic_type_col_expected = [ & - .false., .false., & - .true., & - .false., .false.] - has_dynamic_type_patch_expected = [ & - .false., .false., .false., .false., & - .true., .true., & - .false., .false., .false., .false.] - - @assertEqual(logical_array_to_int(has_dynamic_type_col_expected), logical_array_to_int(has_dynamic_type_col)) - @assertEqual(logical_array_to_int(has_dynamic_type_patch_expected), logical_array_to_int(has_dynamic_type_patch)) - end subroutine have_dynamic_type - -end module test_glcBehavior diff --git a/src/main/test/ncdio_utils_test/CMakeLists.txt b/src/main/test/ncdio_utils_test/CMakeLists.txt deleted file mode 100644 index 95ff84ac1c..0000000000 --- a/src/main/test/ncdio_utils_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(ncdio_utils test_ncdio_utils_exe - "test_ncdio_utils.pf" "") - -target_link_libraries(test_ncdio_utils_exe clm csm_share) diff --git a/src/main/test/ncdio_utils_test/test_ncdio_utils.pf b/src/main/test/ncdio_utils_test/test_ncdio_utils.pf deleted file mode 100644 index e8cbeb37db..0000000000 --- a/src/main/test/ncdio_utils_test/test_ncdio_utils.pf +++ /dev/null @@ -1,131 +0,0 @@ -module test_ncdio_utils - - ! Tests of ncdio_utils - - use pfunit_mod - use ncdio_utils - use ncdio_pio ! use the fake version of this module - use shr_kind_mod, only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestNcdioUtils - contains - procedure :: setUp - procedure :: tearDown - end type TestNcdioUtils - -contains - - subroutine setUp(this) - class(TestNcdioUtils), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestNcdioUtils), intent(inout) :: this - end subroutine tearDown - - ! ======================================================================== - ! Test helpers - ! ======================================================================== - - subroutine add_vars_to_file(ncid, varnames) - ! Add one or more variables to the file, with irrelevant data - type(file_desc_t), intent(inout) :: ncid - character(len=*), intent(in) :: varnames(:) - - integer :: n - - do n = 1, size(varnames) - call ncd_set_var(ncid, varnames(n), reshape([1._r8], [1,1]), [1,1]) - end do - end subroutine add_vars_to_file - - ! ------------------------------------------------------------------------ - ! Tests of find_var_on_file - ! ------------------------------------------------------------------------ - - @Test - subroutine test_find_var_on_file_oneElement_found(this) - class(TestNcdioUtils), intent(inout) :: this - character(len=256) :: actual - type(file_desc_t) :: ncid - - ncid = file_desc_t() - call add_vars_to_file(ncid, ['foo']) - - call find_var_on_file(ncid, 'foo', actual) - - @assertEqual('foo', actual) - end subroutine test_find_var_on_file_oneElement_found - - @Test - subroutine test_find_var_on_file_oneElement_notFound(this) - class(TestNcdioUtils), intent(inout) :: this - character(len=256) :: actual - type(file_desc_t) :: ncid - - ncid = file_desc_t() - - call find_var_on_file(ncid, 'foo', actual) - - @assertEqual('foo', actual) - end subroutine test_find_var_on_file_oneElement_notFound - - @Test - subroutine test_find_var_on_file_3Elements_first(this) - class(TestNcdioUtils), intent(inout) :: this - character(len=256) :: actual - type(file_desc_t) :: ncid - - ncid = file_desc_t() - call add_vars_to_file(ncid, ['foo', 'bar', 'baz']) - - call find_var_on_file(ncid, 'foo:bar:baz', actual) - - @assertEqual('foo', actual) - end subroutine test_find_var_on_file_3Elements_first - - @Test - subroutine test_find_var_on_file_3Elements_second(this) - class(TestNcdioUtils), intent(inout) :: this - character(len=256) :: actual - type(file_desc_t) :: ncid - - ncid = file_desc_t() - call add_vars_to_file(ncid, ['bar', 'baz']) - - call find_var_on_file(ncid, 'foo:bar:baz', actual) - - @assertEqual('bar', actual) - end subroutine test_find_var_on_file_3Elements_second - - @Test - subroutine test_find_var_on_file_3Elements_third(this) - class(TestNcdioUtils), intent(inout) :: this - character(len=256) :: actual - type(file_desc_t) :: ncid - - ncid = file_desc_t() - call add_vars_to_file(ncid, ['baz']) - - call find_var_on_file(ncid, 'foo:bar:baz', actual) - - @assertEqual('baz', actual) - end subroutine test_find_var_on_file_3Elements_third - - @Test - subroutine test_find_var_on_file_3Elements_noneFound(this) - class(TestNcdioUtils), intent(inout) :: this - character(len=256) :: actual - type(file_desc_t) :: ncid - - ncid = file_desc_t() - - call find_var_on_file(ncid, 'foo:bar:baz', actual) - - @assertEqual('foo', actual) - end subroutine test_find_var_on_file_3Elements_noneFound - -end module test_ncdio_utils diff --git a/src/main/test/subgridWeights_test/CMakeLists.txt b/src/main/test/subgridWeights_test/CMakeLists.txt deleted file mode 100644 index 45b4d53b01..0000000000 --- a/src/main/test/subgridWeights_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(subgridWeights test_subgridWeights_exe - "test_subgridWeights.pf" "") - -target_link_libraries(test_subgridWeights_exe clm csm_share) \ No newline at end of file diff --git a/src/main/test/subgridWeights_test/test_subgridWeights.pf b/src/main/test/subgridWeights_test/test_subgridWeights.pf deleted file mode 100644 index 7d29ef0510..0000000000 --- a/src/main/test/subgridWeights_test/test_subgridWeights.pf +++ /dev/null @@ -1,86 +0,0 @@ -module test_subgridWeights - - ! Tests of subgridWeightsMod - - use pfunit_mod - use unittestSubgridMod - use subgridWeightsMod - use shr_kind_mod, only : r8 => shr_kind_r8 - - implicit none - save - - real(r8), parameter :: tol = 1.e-14_r8 - -contains - - subroutine setup() - call unittest_subgrid_setup_start() - - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=1, wtgcell=0.25_r8) - call unittest_add_landunit(my_gi=gi, ltype=3, wtgcell=0.75_r8) - - call unittest_subgrid_setup_end() - end subroutine setup - - subroutine teardown() - call unittest_subgrid_teardown() - end subroutine teardown - - ! ------------------------------------------------------------------------ - ! Tests of get_landunit_weight - ! ------------------------------------------------------------------------ - - @Test - subroutine test_get_landunit_weight_no_landunit() - ! no landunit of the given type - call setup() - @assertEqual(0._r8, get_landunit_weight(gi, 2)) - call teardown() - end subroutine test_get_landunit_weight_no_landunit - - @Test - subroutine test_get_landunit_weight_normal() - ! normal case, with a landunit of the given type - call setup() - @assertEqual(0.75_r8, get_landunit_weight(gi, 3), tolerance=tol) - call teardown() - end subroutine test_get_landunit_weight_normal - - ! ------------------------------------------------------------------------ - ! Tests of set_landunit_weight - ! ------------------------------------------------------------------------ - - @Test - subroutine test_set_landunit_weight() - call setup() - call set_landunit_weight(gi, 3, 0.42_r8) - @assertEqual(0.42_r8, get_landunit_weight(gi, 3), tolerance=tol) - call teardown() - end subroutine test_set_landunit_weight - - ! ------------------------------------------------------------------------ - ! Tests of is_gcell_all_ltypeX - ! ------------------------------------------------------------------------ - - @Test - subroutine test_is_gcell_all_ltypeX_false() - ! test with no landunit being 100% - call setup() - @assertFalse(is_gcell_all_ltypeX(gi, 3)) - call teardown() - end subroutine test_is_gcell_all_ltypeX_false - - @Test - subroutine test_is_gcell_all_ltypeX_true() - ! test with a landunit being 100% - call setup() - call set_landunit_weight(gi, 1, 0.0_r8) - call set_landunit_weight(gi, 3, 1.0_r8) - @assertFalse(is_gcell_all_ltypeX(gi, 1)) - @assertTrue(is_gcell_all_ltypeX(gi, 3)) - call teardown() - end subroutine test_is_gcell_all_ltypeX_true - -end module test_subgridWeights diff --git a/src/main/test/surfrdUtils_test/CMakeLists.txt b/src/main/test/surfrdUtils_test/CMakeLists.txt deleted file mode 100644 index 4139bf6faa..0000000000 --- a/src/main/test/surfrdUtils_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(surfrdUtils test_surfrdUtils_exe - "test_surfrdUtils.pf" "") - -target_link_libraries(test_surfrdUtils_exe clm csm_share) diff --git a/src/main/test/surfrdUtils_test/test_surfrdUtils.pf b/src/main/test/surfrdUtils_test/test_surfrdUtils.pf deleted file mode 100644 index ba9d5cced1..0000000000 --- a/src/main/test/surfrdUtils_test/test_surfrdUtils.pf +++ /dev/null @@ -1,217 +0,0 @@ -module test_surfrdUtils - - ! Tests of surfrdUtilsMod - - use pfunit_mod - use surfrdUtilsMod - use shr_kind_mod, only : r8 => shr_kind_r8 - - implicit none - save - - real(r8), parameter :: tol = 1.e-14_r8 - -contains - - @Test - subroutine test_convert_cft_to_pft_with_zerocft() - use clm_instur , only : wt_lunit, wt_nat_patch, fert_cft - use pftconMod , only : pftcon, nc3crop, ndllf_evr_tmp_tree, nc3irrig - use pftconMod , only : nbrdlf_evr_shrub, nc4_grass, noveg - use landunit_varcon , only : istsoil, istcrop, max_lunit - use clm_varpar , only : natpft_size, cft_size, numveg - implicit none - integer, parameter :: begg = 2, endg = 3, cftsize = 2 - real(r8) :: wt_cft(begg:endg,cftsize) - real(r8), allocatable :: wtpft(:,:) - - ! Set relevant pftcon values to defaults; these should be overridden by individual - ! tests where they matter - call pftcon%InitForTesting() - wt_cft(begg:,1) = 0.0_r8 - wt_cft(begg:,2) = 0.0_r8 - allocate( wt_lunit(begg:endg,max_lunit) ) - wt_lunit(begg:,:) = 0.00_r8 - wt_lunit(begg:,istsoil) = 100.00_r8 - wt_lunit(begg:,istcrop) = 0.00_r8 - call check_sums_equal_1( (wt_lunit/100.0_r8), begg, "test_check_sums_add_to_1", & - "should not trigger an error") - natpft_size = numveg - cft_size = 0 - noveg = 0 - nc3crop = 15 - nc3irrig = nc3crop + 1 - ndllf_evr_tmp_tree = 1 - nbrdlf_evr_shrub = 9 - nc4_grass = 14 - allocate( wt_nat_patch(begg:endg,0:natpft_size) ) - allocate( wtpft (begg:endg,0:natpft_size) ) - wt_nat_patch(begg:,:) = 0.00_r8 - wt_nat_patch(begg:,noveg) = 5.00_r8 - wt_nat_patch(begg:,ndllf_evr_tmp_tree) = 70.00_r8 - wt_nat_patch(begg:,nbrdlf_evr_shrub) = 20.00_r8 - wt_nat_patch(begg:,nc4_grass) = 5.00_r8 - wtpft = wt_nat_patch/100.0_r8 - call check_sums_equal_1( wtpft, begg, "test_check_sums_add_to_1", & - "should not trigger an error") - wt_nat_patch(begg:,nc3crop:) = -100000.00_r8 ! set crop PFT's to junk, make sure can handle it - ! Convert - call convert_cft_to_pft( begg, endg, cftsize, wt_cft ) - wt_nat_patch(begg:,:) = wt_nat_patch(begg:,:) / 100.00_r8 - wt_lunit(begg:,:) = wt_lunit(begg:,:) / 100.00_r8 - ! Now check that are correct now - call check_sums_equal_1( wt_lunit, begg, "test_check_sums_add_to_1", & - "should not trigger an error") - call check_sums_equal_1( wt_nat_patch, begg, "test_check_sums_add_to_1", & - "should not trigger an error") - @assertEqual(wtpft,wt_nat_patch) - @assertEqual(wt_lunit(begg:,istsoil),(/1.00_r8,1.00_r8/)) - deallocate( wt_nat_patch ) - deallocate( wtpft ) - - call pftcon%clean() - end subroutine test_convert_cft_to_pft_with_zerocft - - @Test - subroutine test_convert_cft_to_pft() - use clm_instur , only : wt_lunit, wt_nat_patch, fert_cft - use pftconMod , only : pftcon, nc3crop, ndllf_evr_tmp_tree, nc3irrig - use landunit_varcon , only : istsoil, istcrop, max_lunit - use clm_varpar , only : natpft_size, cft_size, numveg - - implicit none - integer, parameter :: begg = 2, endg = 3, cftsize = 2 - real(r8) :: wt_cft(begg:endg,cftsize) - - ! Set relevant pftcon values to defaults; these should be overridden by individual - ! tests where they matter - call pftcon%InitForTesting() - wt_cft(begg:,1) = 25.0_r8 - wt_cft(begg:,2) = 75.0_r8 - call check_sums_equal_1( (wt_cft/100.0_r8), begg, "test_check_sums_add_to_1", & - "should not trigger an error") - allocate( wt_lunit(begg:endg,max_lunit) ) - wt_lunit(begg:,:) = 00.00_r8 - wt_lunit(begg:,istsoil) = 25.00_r8 - wt_lunit(begg:,istcrop) = 75.00_r8 - call check_sums_equal_1( (wt_lunit/100.0_r8), begg, "test_check_sums_add_to_1", & - "should not trigger an error") - natpft_size = numveg - cft_size = 0 - nc3crop = 15 - nc3irrig = nc3crop + 1 - ndllf_evr_tmp_tree = 1 - allocate( wt_nat_patch(begg:endg,0:natpft_size) ) - wt_nat_patch(begg:,:) = 0.00_r8 - wt_nat_patch(begg:,ndllf_evr_tmp_tree) = 100.00_r8 - call check_sums_equal_1( (wt_nat_patch/100.0_r8), begg, "test_check_sums_add_to_1", & - "should not trigger an error") - ! Convert - wt_nat_patch(begg:,nc3crop:) = -100000.00_r8 ! set crop PFT's to junk, make sure can handle it - call convert_cft_to_pft( begg, endg, cftsize, wt_cft ) - wt_nat_patch(begg:,:) = wt_nat_patch(begg:,:) / 100.00_r8 - wt_lunit(begg:,:) = wt_lunit(begg:,:) / 100.00_r8 - ! Now check that are correct now - call check_sums_equal_1( wt_lunit, begg, "test_check_sums_add_to_1", & - "should not trigger an error") - call check_sums_equal_1( wt_nat_patch, begg, "test_check_sums_add_to_1", & - "should not trigger an error") - @assertEqual(wt_lunit(begg:,istsoil), (/1.00_r8,1.00_r8/)) - @assertEqual(wt_nat_patch(begg:,ndllf_evr_tmp_tree),(/0.25_r8,0.25_r8/)) - @assertEqual(wt_nat_patch(begg:,nc3crop), (/0.1875_r8,0.1875_r8/)) - @assertEqual(wt_nat_patch(begg:,nc3irrig), (/0.5625_r8,0.5625_r8/)) - - call pftcon%clean() - end subroutine test_convert_cft_to_pft - - @Test - subroutine test_check_sums_add_to_1() - implicit none - integer, parameter :: lb = 10, ub = 12, lb2 = 1, ub2 = 3 - real(r8) :: array(lb:ub,lb2:ub2) - - ! Create an array that sums to one, then copy it twice and - ! make one element off by less than tol and one off by more than tol - ! they should all work this way - array(lb,lb2) = 0.75d00 - array(lb,lb2+1) = 0.20d00 - array(lb,lb2+2) = 0.05d00 - array(lb+1,:) = array(lb,:) - array(lb+1,lb2+2) = array(lb+1,lb2+2) - tol - array(lb+2,:) = array(lb,:) - array(lb+1,lb2+2) = array(lb+1,lb2+2) + tol - call check_sums_equal_1( array, lb, "test_check_sums_add_to_1", & - "should not trigger an error") - end subroutine test_check_sums_add_to_1 - - @Test - subroutine test_check_sums_add_to_1_fail() - implicit none - integer, parameter :: lb = 10, ub = 12, lb2 = 1, ub2 = 3 - real(r8) :: array(lb:ub,lb2:ub2) - real(r8), parameter :: eps = 2.e-13 - integer :: ier - - ! Create an array that sums to one, then copy it twice and - ! then make the last element of the last one off by small - ! value that should trigger an error - array(lb,lb2) = 0.75d00 - array(lb,lb2+1) = 0.20d00 - array(lb,lb2+2) = 0.05d00 - array(lb+1,:) = array(lb,:) - array(lb+1,lb2+2) = array(lb+1,lb2+2) - tol - array(lb+2,:) = array(lb,:) - array(lb+1,lb2+2) = array(lb+1,lb2+2) + eps - call check_sums_equal_1( array, lb, "test_check_sums_add_to_1_fail", & - "should trigger an error", ier) - @assertEqual(ier,-10) - end subroutine test_check_sums_add_to_1_fail - @Test - subroutine test_renormalize - implicit none - integer, parameter :: lb = 10, ub = 12, lb2 = 1, ub2 = 3 - real(r8) :: array(lb:ub,lb2:ub2) - real(r8) :: expected(lb:ub,lb2:ub2) - integer :: ier - - ! Start with an array that sums to 1 within the tolerance - array(lb,lb2) = 0.75d00 - array(lb,lb2+1) = 0.20d00 - array(lb,lb2+2) = 0.05d00 - array(lb+1,:) = array(lb,:) - array(lb+1,lb2+2) = array(lb+1,lb2+2) - tol - array(lb+2,:) = array(lb,:) - array(lb+1,lb2+2) = array(lb+1,lb2+2) + tol - ! Add to the first element of each column a 1 which means the expected - ! result is half of the starting array - array(:,lb2) = array(:,lb2) + 1.0d00 - expected(:,:) = array(:,:) / 2.0d00 - ! Make the normalized result 100, so multiply the expected result by 100 - expected(:,:) = expected(:,:)*100.0d00 - call renormalize(array, lb, 100.0d00) - @assertEqual(array, expected, tolerance=tol) - ! divide by 100 and should add to one - array = array / 100.0d00 - call check_sums_equal_1( array, lb, "test_check_sums_add_to_1", & - "should not trigger an error") - ! Call again returning error code, make sure error code is zero - call check_sums_equal_1( array, lb, "test_check_sums_add_to_1", & - "should not trigger an error", ier) - @assertEqual(ier,0) - end subroutine test_renormalize - - @Test - subroutine test_renormalize_zero - implicit none - integer, parameter :: lb = 10, ub = 12, lb2 = 1, ub2 = 3 - real(r8) :: array(lb:ub,lb2:ub2) - real(r8) :: expected(lb:ub,lb2:ub2) - - ! An array that sums to zero will remain zeroed out - array(:,:) = 0.0d00 - expected(:,:) = array - call renormalize(array, lb, 100.0d00) - @assertEqual(array, expected, tolerance=tol) - end subroutine test_renormalize_zero - -end module test_surfrdUtils diff --git a/src/main/test/topo_test/CMakeLists.txt b/src/main/test/topo_test/CMakeLists.txt deleted file mode 100644 index c01625994a..0000000000 --- a/src/main/test/topo_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(topo test_topo_exe - "test_topo.pf" "") - -target_link_libraries(test_topo_exe clm csm_share) \ No newline at end of file diff --git a/src/main/test/topo_test/test_topo.pf b/src/main/test/topo_test/test_topo.pf deleted file mode 100644 index b89ee72db8..0000000000 --- a/src/main/test/topo_test/test_topo.pf +++ /dev/null @@ -1,389 +0,0 @@ -module test_topo - - ! Tests of TopoMod - - use pfunit_mod - use TopoMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestGlcMec - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestArrayMod - use filterColMod - use clm_instur, only : topo_glc_mec - use clm_varpar, only : maxpatch_glcmec - use clm_varctl, only : glc_do_dynglacier - use landunit_varcon, only : istice_mec - use glc2lndMod, only : glc2lnd_type - use glcBehaviorMod, only : glc_behavior_type - use unittestFilterBuilderMod - use ColumnType, only : col - use column_varcon, only : col_itype_to_icemec_class - use domainMod, only : ldomain - - implicit none - - @TestCase - type, extends(TestCase) :: TestTopo - logical :: topo_glc_mec_allocated = .false. - logical :: glc2lnd_allocated = .false. - logical :: ldomain_frac_allocated = .false. - - ! These are in TestTopo so they can be cleaned - type(glc2lnd_type) :: glc2lnd_inst - type(topo_type) :: topo - contains - procedure :: setUp - procedure :: tearDown - procedure :: setup_glc_mec - procedure :: init_glc2lnd - procedure :: do_UpdateTopo ! wrap the call to this%topo%UpdateTopo - end type TestTopo - - real(r8), parameter :: tol = 1.e-13_r8 - -contains - - ! ======================================================================== - ! Helper routines - ! ======================================================================== - - subroutine setUp(this) - class(TestTopo), intent(inout) :: this - - glc_do_dynglacier = .true. - call this%setup_glc_mec() - end subroutine setUp - - subroutine tearDown(this) - class(TestTopo), intent(inout) :: this - - call unittest_subgrid_teardown() - if (this%ldomain_frac_allocated) then - deallocate(ldomain%frac) - end if - call teardown_elevation_classes() - call this%topo%Clean() - if (this%topo_glc_mec_allocated) then - deallocate(topo_glc_mec) - this%topo_glc_mec_allocated = .false. - end if - if (this%glc2lnd_allocated) then - call this%glc2lnd_inst%Clean() - this%glc2lnd_allocated = .false. - end if - end subroutine tearDown - - subroutine setup_glc_mec(this) - ! Does some initial setup needed to run the tests here with glc_mec. - ! - ! Creates 3 elevation classes, with boundaries every 10 m. - ! - ! Sets topo_glc_mec (which is typically on the surface dataset) such that it is at - ! the midpoint of each elevation class for every gridcell. - class(TestTopo), intent(inout) :: this - - integer, parameter :: glc_nec = 3 - real(r8), parameter :: topomax(0:glc_nec) = [0._r8, 10._r8, 20._r8, 30._r8] - - integer :: ec - real(r8) :: topo_mid - - call setup_elevation_classes(glc_nec, topomax) - - ! Note that we allocate this to be the max possible size - which might exceed actual - ! bounds - because bounds may not be set up at this point - allocate(topo_glc_mec(begg:endg, glc_nec)) - do ec = 1, glc_nec - topo_mid = (topomax(ec - 1) + topomax(ec)) / 2._r8 - topo_glc_mec(:, ec) = topo_mid - end do - - this%topo_glc_mec_allocated = .true. - end subroutine setup_glc_mec - - subroutine init_glc2lnd(this, glc_behavior, topo_grc, icemask_grc) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type), intent(in) :: glc_behavior - real(r8), intent(in) :: topo_grc(:, 0: ) ! [gridcell, elevclass] array of topo values - real(r8), intent(in) :: icemask_grc(:) ! gridcell-level array of icemask values - - call this%glc2lnd_inst%Init(bounds, glc_behavior) - this%glc2lnd_allocated = .true. - call this%glc2lnd_inst%for_test_set_glc2lnd_fields_directly(bounds, & - topo = topo_grc, icemask = icemask_grc) - end subroutine init_glc2lnd - - subroutine do_UpdateTopo(this, glc_behavior, icemask_grc, atm_topo_grc, glc_topo) - ! Wrap the call to this%topo%UpdateTopo - class(TestTopo), intent(inout) :: this - type(glc_behavior_type), intent(in) :: glc_behavior - real(r8), intent(in) :: icemask_grc(:) ! gridcell-level array of icemask values - - ! gridcell-level array of atm_topo values; if not provided, will use default given - ! below - real(r8), intent(in), optional :: atm_topo_grc(:) - - ! topo value applied to ALL indices of glc2lnd_inst%topo_grc; if not provided, will - ! use default given below - real(r8), intent(in), optional :: glc_topo - - ! if atm_topo_grc isn't given, then atm_topo will have this value everywhere - real(r8), parameter :: atm_topo_default = 25._r8 - - ! if glc_topo isn't given, then glc2lnd_inst%topo_grc will have this value everywhere - real(r8), parameter :: glc_topo_default = 17._r8 - - real(r8), allocatable :: glc_topo_grc(:,:) ! [gridcell, elevclass] - - real(r8), allocatable :: atm_topo(:) - type(filter_col_type) :: filter_icemecc - - allocate(ldomain%frac(bounds%begg:bounds%endg)) - this%ldomain_frac_allocated = .true. - ldomain%frac(bounds%begg:bounds%endg) = 1._r8 - - allocate(glc_topo_grc(bounds%begg:bounds%endg, 0:maxpatch_glcmec)) - if (present(glc_topo)) then - glc_topo_grc(:,:) = glc_topo - else - glc_topo_grc(:,:) = glc_topo_default - end if - call this%init_glc2lnd( & - glc_behavior=glc_behavior, & - topo_grc = glc_topo_grc, & - icemask_grc=icemask_grc) - - filter_icemecc = col_filter_from_ltypes(bounds, [istice_mec], include_inactive = .false.) - - if (present(atm_topo_grc)) then - atm_topo = atm_topo_grc - else - atm_topo = grc_array(atm_topo_default) - end if - - call this%topo%UpdateTopo(bounds, filter_icemecc%num, filter_icemecc%indices, & - this%glc2lnd_inst, glc_behavior, atm_topo = atm_topo) - end subroutine do_UpdateTopo - - function create_glc_behavior_all_collapse() result(glc_behavior) - ! Create a glc_behavior object where all grid cells get collapsed to a single column - type(glc_behavior_type) :: glc_behavior - - call glc_behavior%InitSetDirectly(bounds%begg, bounds%endg, & - has_virtual_columns = grc_array(.false.), & - collapse_to_atm_topo = grc_array(.true.)) - - ! It may not be correct to set this to true for ALL columns (e.g., if there are some - ! non-glc_mec columns), but doing so is convenient, and shouldn't cause any problems - ! (though it might prevent some error checking). - col%type_is_dynamic(:) = .true. - end function create_glc_behavior_all_collapse - - function create_glc_behavior_all_multiple() result(glc_behavior) - ! Create a glc_behavior object where all grid cells have behavior 'multiple' - type(glc_behavior_type) :: glc_behavior - - call glc_behavior%InitSetDirectly(bounds%begg, bounds%endg, & - has_virtual_columns = grc_array(.false.), & - collapse_to_atm_topo = grc_array(.false.)) - end function create_glc_behavior_all_multiple - - function create_glc_behavior_all_virtual() result(glc_behavior) - ! Create a glc_behavior object where all grid cells have behavior 'virtual' - type(glc_behavior_type) :: glc_behavior - - call glc_behavior%InitSetDirectly(bounds%begg, bounds%endg, & - has_virtual_columns = grc_array(.true.), & - collapse_to_atm_topo = grc_array(.false.)) - end function create_glc_behavior_all_virtual - - ! ======================================================================== - ! Begin actual tests - ! - ! Note that many of these tests test the combined effect of multiple modules: TopoMod's - ! UpdateTopo plus the various things it calls. (So in that respect, they aren't strict - ! unit tests.) - ! ======================================================================== - - @Test - subroutine downscaleFilter_beforeUpdate_contains_glcmec(this) - class(TestTopo), intent(inout) :: this - type(filter_col_type) :: filter - type(filter_col_type) :: expected_filter - - call setup_single_icemec_column(elev_class = 1) - expected_filter = col_filter_from_index_array(bounds, [bounds%begc]) - - call this%topo%Init(bounds) - filter = this%topo%DownscaleFilterc(bounds) - - @assertTrue(filter == expected_filter) - end subroutine downscaleFilter_beforeUpdate_contains_glcmec - - @Test - subroutine downscaleFilter_afterUpdate_contains_glcmecOutsideIcemask(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - type(filter_col_type) :: filter - type(filter_col_type) :: expected_filter - - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_multiple() - expected_filter = col_filter_from_index_array(bounds, [bounds%begc]) - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(0._r8)) - filter = this%topo%DownscaleFilterc(bounds) - - @assertTrue(filter == expected_filter) - end subroutine downscaleFilter_afterUpdate_contains_glcmecOutsideIcemask - - @Test - subroutine downscaleFilter_afterUpdate_doesNotContain_singleAtAtmTopo(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - type(filter_col_type) :: filter - type(filter_col_type) :: expected_filter - - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_collapse() - expected_filter = col_filter_empty(bounds) - - call this%topo%Init(bounds) - ! Need icemask 0, because we can't have single_at_atm_topo inside the icemask - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(0._r8)) - filter = this%topo%DownscaleFilterc(bounds) - - @assertTrue(filter == expected_filter) - end subroutine downscaleFilter_afterUpdate_doesNotContain_singleAtAtmTopo - - @Test - subroutine downscaleFilter_afterUpdate_doesNotContain_vegOutsideIcemask(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - type(filter_col_type) :: filter - type(filter_col_type) :: expected_filter - - call setup_single_veg_patch(pft_type = 1) - ! Use 'virtual' behavior, to make sure that we're not accidentally trying to - ! downscale vegetation over virtual columns. - glc_behavior = create_glc_behavior_all_virtual() - expected_filter = col_filter_empty(bounds) - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(0._r8)) - filter = this%topo%DownscaleFilterc(bounds) - - @assertTrue(filter == expected_filter) - end subroutine downscaleFilter_afterUpdate_doesNotContain_vegOutsideIcemask - - @Test - subroutine downscaleFilter_afterUpdate_contains_vegInsideIcemask(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - type(filter_col_type) :: filter - type(filter_col_type) :: expected_filter - - call setup_single_veg_patch(pft_type = 1) - glc_behavior = create_glc_behavior_all_multiple() - expected_filter = col_filter_from_index_array(bounds, [bounds%begc]) - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(1._r8)) - filter = this%topo%DownscaleFilterc(bounds) - - @assertTrue(filter == expected_filter) - end subroutine downscaleFilter_afterUpdate_contains_vegInsideIcemask - - @Test - subroutine topo_noChange_for_glcmecOutsideIcemask(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - real(r8), parameter :: topo_orig = 7._r8 - - ! our column should NOT get set to either of these: - real(r8), parameter :: atm_topo = 23._r8 - real(r8), parameter :: glc_topo = 27._r8 - - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_virtual() - topo_glc_mec(:,:) = topo_orig - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(0._r8), & - atm_topo_grc = grc_array(atm_topo), & - glc_topo = glc_topo) - - @assertEqual(topo_orig, this%topo%topo_col(bounds%begc)) - end subroutine topo_noChange_for_glcmecOutsideIcemask - - @Test - subroutine topo_changes_for_glcmecInsideIcemask(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - real(r8), parameter :: topo_orig = 7._r8 - real(r8), parameter :: atm_topo = 23._r8 - - ! our column should get set to this: - real(r8), parameter :: glc_topo = 27._r8 - - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_virtual() - topo_glc_mec(:,:) = topo_orig - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(1._r8), & - atm_topo_grc = grc_array(atm_topo), & - glc_topo = glc_topo) - - @assertEqual(glc_topo, this%topo%topo_col(bounds%begc)) - end subroutine topo_changes_for_glcmecInsideIcemask - - @Test - subroutine topo_changes_for_singleAtAtmTopo(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - real(r8), parameter :: topo_orig = 7._r8 - real(r8), parameter :: glc_topo = 27._r8 - - ! our column should get set to this: - real(r8), parameter :: atm_topo = 23._r8 - - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_collapse() - topo_glc_mec(:,:) = topo_orig - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(0._r8), & - atm_topo_grc = grc_array(atm_topo), & - glc_topo = glc_topo) - - @assertEqual(atm_topo, this%topo%topo_col(bounds%begc)) - end subroutine topo_changes_for_singleAtAtmTopo - - @Test - subroutine elevClass_changes_for_singleAtAtmTopo(this) - class(TestTopo), intent(inout) :: this - type(glc_behavior_type) :: glc_behavior - integer :: new_elev_class - real(r8), parameter :: topo_orig = 7._r8 - real(r8), parameter :: glc_topo = 27._r8 - - ! our column should get set to this: - real(r8), parameter :: atm_topo = 23._r8 - - call setup_single_icemec_column(elev_class = 1) - glc_behavior = create_glc_behavior_all_collapse() - topo_glc_mec(:,:) = topo_orig - - call this%topo%Init(bounds) - call this%do_UpdateTopo(glc_behavior, icemask_grc = grc_array(0._r8), & - atm_topo_grc = grc_array(atm_topo), & - glc_topo = glc_topo) - - new_elev_class = col_itype_to_icemec_class(col%itype(bounds%begc)) - @assertEqual(3, new_elev_class) - end subroutine elevClass_changes_for_singleAtAtmTopo - -end module test_topo diff --git a/src/soilbiogeochem/CMakeLists.txt b/src/soilbiogeochem/CMakeLists.txt deleted file mode 100644 index 380582f236..0000000000 --- a/src/soilbiogeochem/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -list(APPEND clm_sources - SoilBiogeochemStateType.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 deleted file mode 100644 index 5d169527c5..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemCarbonFluxType.F90 +++ /dev/null @@ -1,828 +0,0 @@ -module SoilBiogeochemCarbonFluxType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevgrnd, nlevdecomp, nlevsoi - use clm_varcon , only : spval, ispval, dzsoi_decomp - use landunit_varcon , only : istsoil, istcrop, istdlak - use ch4varcon , only : allowlakeprod - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use ColumnType , only : col - use LandunitType , only : lun - use clm_varctl , only : use_fates - - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: soilbiogeochem_carbonflux_type - - ! fire fluxes - real(r8), pointer :: somc_fire_col (:) ! (gC/m2/s) carbon emissions due to peat burning - - ! decomposition fluxes - real(r8), pointer :: decomp_cpools_sourcesink_col (:,:,:) ! change in decomposing c pools. Used to update concentrations concurrently with vertical transport (gC/m3/timestep) - real(r8), pointer :: decomp_cascade_hr_vr_col (:,:,:) ! vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - real(r8), pointer :: decomp_cascade_hr_col (:,:) ! vertically-integrated (diagnostic) het. resp. from decomposing C pools (gC/m2/s) - real(r8), pointer :: decomp_cascade_ctransfer_vr_col (:,:,:) ! vertically-resolved C transferred along deomposition cascade (gC/m3/s) - real(r8), pointer :: decomp_cascade_ctransfer_col (:,:) ! vertically-integrated (diagnostic) C transferred along decomposition cascade (gC/m2/s) - real(r8), pointer :: decomp_k_col (:,:,:) ! rate constant for decomposition (1./sec) - real(r8), pointer :: hr_vr_col (:,:) ! (gC/m3/s) total vertically-resolved het. resp. from decomposing C pools - real(r8), pointer :: o_scalar_col (:,:) ! fraction by which decomposition is limited by anoxia - real(r8), pointer :: w_scalar_col (:,:) ! fraction by which decomposition is limited by moisture availability - real(r8), pointer :: t_scalar_col (:,:) ! fraction by which decomposition is limited by temperature - real(r8), pointer :: som_c_leached_col (:) ! (gC/m^2/s) total SOM C loss from vertical transport - real(r8), pointer :: decomp_cpools_leached_col (:,:) ! (gC/m^2/s) C loss from vertical transport from each decomposing C pool - real(r8), pointer :: decomp_cpools_transport_tendency_col (:,:,:) ! (gC/m^3/s) C tendency due to vertical transport in decomposing C pools - - ! nitrif_denitrif - real(r8), pointer :: phr_vr_col (:,:) ! (gC/m3/s) potential hr (not N-limited) - real(r8), pointer :: fphr_col (:,:) ! fraction of potential heterotrophic respiration - - real(r8), pointer :: hr_col (:) ! (gC/m2/s) total heterotrophic respiration - real(r8), pointer :: lithr_col (:) ! (gC/m2/s) litter heterotrophic respiration - real(r8), pointer :: somhr_col (:) ! (gC/m2/s) soil organic matter heterotrophic res - real(r8), pointer :: soilc_change_col (:) ! (gC/m2/s) FUN used soil C - - ! fluxes to receive carbon inputs from FATES - real(r8), pointer :: FATES_c_to_litr_lab_c_col (:,:) ! total labile litter coming from ED. gC/m3/s - real(r8), pointer :: FATES_c_to_litr_cel_c_col (:,:) ! total cellulose litter coming from ED. gC/m3/s - real(r8), pointer :: FATES_c_to_litr_lig_c_col (:,:) ! total lignin litter coming from ED. gC/m3/s - - contains - - procedure , public :: Init - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - procedure , public :: Restart - procedure , public :: SetValues - procedure , public :: Summary - - end type soilbiogeochem_carbonflux_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type) - - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - - call this%InitAllocate ( bounds) - call this%InitHistory ( bounds, carbon_type ) - call this%InitCold (bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp,endp - integer :: begc,endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - allocate(this%t_scalar_col (begc:endc,1:nlevdecomp_full)); this%t_scalar_col (:,:) =spval - allocate(this%w_scalar_col (begc:endc,1:nlevdecomp_full)); this%w_scalar_col (:,:) =spval - allocate(this%o_scalar_col (begc:endc,1:nlevdecomp_full)); this%o_scalar_col (:,:) =spval - allocate(this%phr_vr_col (begc:endc,1:nlevdecomp_full)); this%phr_vr_col (:,:) =nan - allocate(this%fphr_col (begc:endc,1:nlevgrnd)) ; this%fphr_col (:,:) =nan - allocate(this%som_c_leached_col (begc:endc)) ; this%som_c_leached_col (:) =nan - allocate(this%somc_fire_col (begc:endc)) ; this%somc_fire_col (:) =nan - allocate(this%hr_vr_col (begc:endc,1:nlevdecomp_full)); this%hr_vr_col (:,:) =nan - - allocate(this%decomp_cpools_sourcesink_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_cpools_sourcesink_col(:,:,:)= nan - - allocate(this%decomp_cascade_hr_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%decomp_cascade_hr_vr_col(:,:,:)= spval - - allocate(this%decomp_cascade_hr_col(begc:endc,1:ndecomp_cascade_transitions)) - this%decomp_cascade_hr_col(:,:)= nan - - allocate(this%decomp_cascade_ctransfer_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%decomp_cascade_ctransfer_vr_col(:,:,:)= nan - - allocate(this%decomp_cascade_ctransfer_col(begc:endc,1:ndecomp_cascade_transitions)) - this%decomp_cascade_ctransfer_col(:,:)= nan - - allocate(this%decomp_k_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)) - this%decomp_k_col(:,:,:)= spval - - allocate(this%decomp_cpools_leached_col(begc:endc,1:ndecomp_pools)) - this%decomp_cpools_leached_col(:,:)= nan - - allocate(this%decomp_cpools_transport_tendency_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_cpools_transport_tendency_col(:,:,:)= nan - - allocate(this%hr_col (begc:endc)) ; this%hr_col (:) = nan - allocate(this%lithr_col (begc:endc)) ; this%lithr_col (:) = nan - allocate(this%somhr_col (begc:endc)) ; this%somhr_col (:) = nan - allocate(this%soilc_change_col (begc:endc)) ; this%soilc_change_col (:) = nan - - if ( use_fates ) then - ! initialize these variables to be zero rather than a bad number since they are not zeroed every timestep (due to a need for them to persist) - - allocate(this%FATES_c_to_litr_lab_c_col(begc:endc,1:nlevdecomp_full)) - this%FATES_c_to_litr_lab_c_col(begc:endc,1:nlevdecomp_full) = 0._r8 - - allocate(this%FATES_c_to_litr_cel_c_col(begc:endc,1:nlevdecomp_full)) - this%FATES_c_to_litr_cel_c_col(begc:endc,1:nlevdecomp_full) = 0._r8 - - allocate(this%FATES_c_to_litr_lig_c_col(begc:endc,1:nlevdecomp_full)) - this%FATES_c_to_litr_lig_c_col(begc:endc,1:nlevdecomp_full) = 0._r8 - - endif - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp, nlevdecomp_full - use clm_varctl , only : hist_wrtch4diag - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type ! one of ['c12', c13','c14'] - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj,c - character(8) :: vr_suffix - character(10) :: active - integer :: begp,endp - integer :: begc,endc - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begp = bounds%begp; endp = bounds%endp - begc = bounds%begc; endc = bounds%endc - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - !------------------------------- - ! C flux variables - native to column - !------------------------------- - - ! add history fields for all CLAMP CN variables - - if (carbon_type == 'c12') then - - this%hr_col(begc:endc) = spval - call hist_addfld1d (fname='HR', units='gC/m^2/s', & - avgflag='A', long_name='total heterotrophic respiration', & - ptr_col=this%hr_col) - - this%lithr_col(begc:endc) = spval - call hist_addfld1d (fname='LITTERC_HR', units='gC/m^2/s', & - avgflag='A', long_name='litter C heterotrophic respiration', & - ptr_col=this%lithr_col) - - this%somhr_col(begc:endc) = spval - call hist_addfld1d (fname='SOILC_HR', units='gC/m^2/s', & - avgflag='A', long_name='soil C heterotrophic respiration', & - ptr_col=this%somhr_col) - - if (hist_wrtch4diag) then - this%fphr_col(begc:endc,1:nlevgrnd) = spval - call hist_addfld_decomp (fname='FPHR'//trim(vr_suffix), units='unitless', type2d='levdcmp', & - avgflag='A', long_name='fraction of potential HR due to N limitation', & - ptr_col=this%fphr_col) - end if - - this%somc_fire_col(begc:endc) = spval - call hist_addfld1d (fname='SOMC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='C loss due to peat burning', & - ptr_col=this%somc_fire_col) - - do k = 1, ndecomp_pools - ! decomposition k - data2dptr => this%decomp_k_col(:,:,k) - fieldname = 'K_'//trim(decomp_cascade_con%decomp_pool_name_history(k)) - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' potential loss coefficient' - call hist_addfld_decomp (fname=fieldname, units='1/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end do - - this%decomp_cascade_hr_col(begc:endc,:) = spval - this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval - this%decomp_cascade_ctransfer_col(begc:endc,:) = spval - this%decomp_cascade_ctransfer_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_cascade_transitions - - ! output the vertically integrated fluxes only as default - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data1dptr => this%decomp_cascade_hr_col(:,l) - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_HR' - else - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l))) - endif - longname = 'Het. Resp. from '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data1dptr => this%decomp_cascade_ctransfer_col(:,l) - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'C' - longname = 'decomp. of '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' C to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - - ! output the vertically resolved fluxes - if ( nlevdecomp_full > 1 ) then - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR'//trim(vr_suffix) - else - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))& - //trim(vr_suffix) - endif - longname = 'Het. Resp. from '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data2dptr => this%decomp_cascade_ctransfer_vr_col(:,:,l) - fieldname = & - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'C'//trim(vr_suffix) - longname = 'decomp. of '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' C to '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end if - - end do - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%t_scalar_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='T_SCALAR', units='unitless', type2d='levsoi', & - avgflag='A', long_name='temperature inhibition of decomposition', & - ptr_col=data2dptr) - - data2dptr => this%w_scalar_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='W_SCALAR', units='unitless', type2d='levsoi', & - avgflag='A', long_name='Moisture (dryness) inhibition of decomposition', & - ptr_col=data2dptr) - - data2dptr => this%o_scalar_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='O_SCALAR', units='unitless', type2d='levsoi', & - avgflag='A', long_name='fraction by which decomposition is reduced due to anoxia', & - ptr_col=data2dptr) - end if - - this%som_c_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SOM_C_LEACHED', units='gC/m^2/s', & - avgflag='A', long_name='total flux of C from SOM pools due to leaching', & - ptr_col=this%som_c_leached_col)!, default='inactive') - - this%decomp_cpools_leached_col(begc:endc,:) = spval - this%decomp_cpools_transport_tendency_col(begc:endc,:,:) = spval - do k = 1, ndecomp_pools - if ( .not. decomp_cascade_con%is_cwd(k) ) then - data1dptr => this%decomp_cpools_leached_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TO_LEACHING' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C leaching loss' - call hist_addfld1d (fname=fieldname, units='gC/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - data2dptr => this%decomp_cpools_transport_tendency_col(:,:,k) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(k))//'C_TNDNCY_VERT_TRANSPORT' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' C tendency due to vertical transport' - call hist_addfld_decomp (fname=fieldname, units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end do - - if ( nlevdecomp_full > 1 ) then - data2dptr => this%hr_vr_col(begc:endc,1:nlevsoi) - call hist_addfld2d (fname='HR_vr', units='gC/m^3/s', type2d='levsoi', & - avgflag='A', long_name='total vertically resolved heterotrophic respiration', & - ptr_col=data2dptr) - endif - - end if - - !------------------------------- - ! C13 flux variables - native to column - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%hr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total heterotrophic respiration', & - ptr_col=this%hr_col) - - this%lithr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_LITTERC_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall to litter 3 C', & - ptr_col=this%lithr_col) - - this%somhr_col(begc:endc) = spval - call hist_addfld1d (fname='C13_SOILC_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 soil organic matter heterotrophic respiration', & - ptr_col=this%somhr_col) - - - this%decomp_cascade_hr_col(begc:endc,:) = spval - this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval - this%decomp_cascade_ctransfer_col(begc:endc,:) = spval - this%decomp_cascade_ctransfer_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_cascade_transitions - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR'//trim(vr_suffix) - else - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))//& - trim(vr_suffix) - endif - longname = 'C13 Het. Resp. from '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gC13/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data2dptr => this%decomp_cascade_ctransfer_vr_col(:,:,l) - fieldname = 'C13_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'C'//trim(vr_suffix) - longname = 'C13 decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))& - //' C to '//& - trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld_decomp (fname=fieldname, units='gC13/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end do - - end if - - !------------------------------- - ! C14 flux variables - native to column - !------------------------------- - - if (carbon_type == 'c14') then - - this%hr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_HR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 total heterotrophic respiration', & - ptr_col=this%hr_col) - - this%lithr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_LITTERC_HR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 litter carbon heterotrophic respiration', & - ptr_col=this%lithr_col) - - this%somhr_col(begc:endc) = spval - call hist_addfld1d (fname='C14_SOILC_HR', units='gC14/m^2/s', & - avgflag='A', long_name='C14 soil organic matter heterotrophic respiration', & - ptr_col=this%somhr_col) - - this%decomp_cascade_hr_col(begc:endc,:) = spval - this%decomp_cascade_hr_vr_col(begc:endc,:,:) = spval - this%decomp_cascade_ctransfer_col(begc:endc,:) = spval - this%decomp_cascade_ctransfer_vr_col(begc:endc,:,:) = spval - - do l = 1, ndecomp_cascade_transitions - !-- HR fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - data2dptr => this%decomp_cascade_hr_vr_col(:,:,l) - - ! check to see if there are multiple pathways that include respiration, and if so, note that in the history file - ii = 0 - do jj = 1, ndecomp_cascade_transitions - if ( decomp_cascade_con%cascade_donor_pool(jj) == decomp_cascade_con%cascade_donor_pool(l) ) ii = ii+1 - end do - if ( ii == 1 ) then - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR'//trim(vr_suffix) - else - fieldname = 'C14_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'_HR_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_receiver_pool(l)))& - //trim(vr_suffix) - endif - longname = 'C14 Het. Resp. from '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gC14/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - data2dptr => this%decomp_cascade_ctransfer_vr_col(:,:,l) - - fieldname = 'C14_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'C_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'C'//trim(vr_suffix) - longname = 'C14 decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' C to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' C' - call hist_addfld_decomp (fname=fieldname, units='gC14/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - end do - - end if - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - this%fphr_col(c,nlevdecomp+1:nlevgrnd) = 0._r8 !used to be in ch4Mod - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - this%fphr_col(c,nlevdecomp+1:nlevgrnd) = 0._r8 - else if (lun%itype(l) == istdlak .and. allowlakeprod) then - this%fphr_col(c,:) = spval - else ! Inactive CH4 columns - this%fphr_col(c,:) = spval - end if - - end do - - if ( use_fates ) then - - call hist_addfld_decomp(fname='FATES_c_to_litr_lab_c', units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='litter labile carbon flux from FATES to BGC', & - ptr_col=this%FATES_c_to_litr_lab_c_col) - - call hist_addfld_decomp(fname='FATES_c_to_litr_cel_c', units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='litter celluluse carbon flux from FATES to BGC', & - ptr_col=this%FATES_c_to_litr_cel_c_col) - - call hist_addfld_decomp(fname='FATES_c_to_litr_lig_c', units='gC/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='litter lignin carbon flux from FATES to BGC', & - ptr_col=this%FATES_c_to_litr_lig_c_col) - - endif - - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - !----------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! initialize fields for special filters - - call this%SetValues (num_column=num_special_col, filter_column=special_col, & - value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use restUtilMod - use ncdio_pio - use clm_varctl, only : use_vertsoilc - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read', 'write', 'define' - ! - ! local vars - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - logical :: readvar - !----------------------------------------------------------------------- - - ! - ! if FATES is enabled, need to restart the variables used to transfer from FATES to CLM as they - ! are persistent between daily FATES dynamics calls and half-hourly CLM timesteps - ! - if ( use_fates ) then - - if (use_vertsoilc) then - ptr2d => this%FATES_c_to_litr_lab_c_col - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lab_c_col', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - - ptr2d => this%FATES_c_to_litr_cel_c_col - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_cel_c_col', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - - ptr2d => this%FATES_c_to_litr_lig_c_col - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lig_c_col', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - - else - ptr1d => this%FATES_c_to_litr_lab_c_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lab_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - - ptr1d => this%FATES_c_to_litr_cel_c_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_cel_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - - ptr1d => this%FATES_c_to_litr_lig_c_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='FATES_c_to_litr_lig_c_col', xtype=ncd_double, & - dim1name='column', long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - - end if - - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon fluxes - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonflux_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k,l ! indices - !------------------------------------------------------------------------ - - do l = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cascade_hr_col(i,l) = value_column - this%decomp_cascade_hr_vr_col(i,j,l) = value_column - this%decomp_cascade_ctransfer_col(i,l) = value_column - this%decomp_cascade_ctransfer_vr_col(i,j,l) = value_column - this%decomp_k_col(i,j,l) = value_column - end do - end do - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_leached_col(i,k) = value_column - end do - do j = 1, nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_transport_tendency_col(i,j,k) = value_column - this%decomp_cpools_sourcesink_col(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) - this%hr_vr_col(i,j) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - this%hr_col(i) = value_column - this%somc_fire_col(i) = value_column - this%som_c_leached_col(i) = value_column - this%somhr_col(i) = value_column - this%lithr_col(i) = value_column - this%soilc_change_col(i) = value_column - end do - - ! NOTE: do not zero the fates to BGC C flux variables since they need to persist from the daily fates timestep s to the half-hourly BGC timesteps. I.e. FATES_c_to_litr_lab_c_col, FATES_c_to_litr_cel_c_col, FATES_c_to_litr_lig_c_col - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine Summary(this, bounds, num_soilc, filter_soilc) - ! - ! !DESCRIPTION: - ! On the radiation time step, column-level carbon summary calculations - ! - ! !USES: - ! !ARGUMENTS: - class(soilbiogeochem_carbonflux_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 - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l - integer :: fc - !----------------------------------------------------------------------- - - do fc = 1,num_soilc - c = filter_soilc(fc) - this%som_c_leached_col(c) = 0._r8 - end do - - ! vertically integrate HR and decomposition cascade fluxes - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_cascade_hr_col(c,k) = & - this%decomp_cascade_hr_col(c,k) + & - this%decomp_cascade_hr_vr_col(c,j,k) * dzsoi_decomp(j) - - this%decomp_cascade_ctransfer_col(c,k) = & - this%decomp_cascade_ctransfer_col(c,k) + & - this%decomp_cascade_ctransfer_vr_col(c,j,k) * dzsoi_decomp(j) - end do - end do - end do - - ! total heterotrophic respiration, vertically resolved (HR) - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%hr_vr_col(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%hr_vr_col(c,j) = & - this%hr_vr_col(c,j) + & - this%decomp_cascade_hr_vr_col(c,j,k) - end do - end do - end do - - ! add up all vertical transport tendency terms and calculate total som leaching loss as the sum of these - do l = 1, ndecomp_pools - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_cpools_leached_col(c,l) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_cpools_leached_col(c,l) = this%decomp_cpools_leached_col(c,l) + & - this%decomp_cpools_transport_tendency_col(c,j,l) * dzsoi_decomp(j) - end do - end do - do fc = 1,num_soilc - c = filter_soilc(fc) - this%som_c_leached_col(c) = this%som_c_leached_col(c) + this%decomp_cpools_leached_col(c,l) - end do - end do - - ! soil organic matter heterotrophic respiration - associate(is_soil => decomp_cascade_con%is_soil) ! TRUE => pool is a soil pool - do k = 1, ndecomp_cascade_transitions - if ( is_soil(decomp_cascade_con%cascade_donor_pool(k)) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%somhr_col(c) = this%somhr_col(c) + this%decomp_cascade_hr_col(c,k) - end do - end if - end do - end associate - - ! litter heterotrophic respiration (LITHR) - associate(is_litter => decomp_cascade_con%is_litter) ! TRUE => pool is a litter pool - do k = 1, ndecomp_cascade_transitions - if ( is_litter(decomp_cascade_con%cascade_donor_pool(k)) ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - this%lithr_col(c) = this%lithr_col(c) + this%decomp_cascade_hr_col(c,k) - end do - end if - end do - end associate - - ! total heterotrophic respiration (HR) - do fc = 1,num_soilc - c = filter_soilc(fc) - - this%hr_col(c) = & - this%lithr_col(c) + & - this%somhr_col(c) - - end do - - end subroutine Summary - -end module SoilBiogeochemCarbonFluxType - - diff --git a/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 b/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 deleted file mode 100644 index 78be5efd44..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemCarbonStateType.F90 +++ /dev/null @@ -1,1004 +0,0 @@ -module SoilBiogeochemCarbonStateType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevdecomp, nlevsoi - use clm_varcon , only : spval, ispval, dzsoi_decomp, zisoi, zsoi, c3_r2 - use clm_varctl , only : iulog, use_vertsoilc, spinup_state, use_fates - use landunit_varcon , only : istcrop, istsoil - use abortutils , only : endrun - use spmdMod , only : masterproc - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use LandunitType , only : lun - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: soilbiogeochem_carbonstate_type - - ! all c pools involved in decomposition - real(r8), pointer :: decomp_cpools_vr_col (:,:,:) ! (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - real(r8), pointer :: ctrunc_vr_col (:,:) ! (gC/m3) vertically-resolved column-level sink for C truncation - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: ctrunc_col (:) ! (gC/m2) column-level sink for C truncation - real(r8), pointer :: totlitc_col (:) ! (gC/m2) total litter carbon - real(r8), pointer :: totlitc_1m_col (:) ! (gC/m2) total litter carbon to 1 meter - real(r8), pointer :: totsomc_col (:) ! (gC/m2) total soil organic matter carbon - real(r8), pointer :: totsomc_1m_col (:) ! (gC/m2) total soil organic matter carbon to 1 meter - real(r8), pointer :: cwdc_col (:) ! (gC/m2) coarse woody debris C (diagnostic) - real(r8), pointer :: decomp_cpools_1m_col (:,:) ! (gC/m2) Diagnostic: decomposing (litter, cwd, soil) c pools to 1 meter - real(r8), pointer :: decomp_cpools_col (:,:) ! (gC/m2) decomposing (litter, cwd, soil) c pools - real(r8), pointer :: dyn_cbal_adjustments_col (:) ! (gC/m2) adjustments to each column made in this timestep via dynamic column area adjustments (note: this variable only makes sense at the column-level: it is meaningless if averaged to the gridcell-level) - integer :: restart_file_spinup_state ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - real(r8) :: totvegcthresh ! threshold for total vegetation carbon to zero out decomposition pools - - contains - - procedure , public :: Init - procedure , public :: SetValues - procedure , public :: Restart - procedure , public :: Summary - procedure , public :: SetTotVgCThresh - procedure , public :: DynamicColumnAdjustments ! adjust state variables when column areas change - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - - end type soilbiogeochem_carbonstate_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, carbon_type, ratio, c12_soilbiogeochem_carbonstate_inst) - - class(soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type - real(r8) , intent(in) :: ratio - type(soilbiogeochem_carbonstate_type) , intent(in), optional :: c12_soilbiogeochem_carbonstate_inst - - this%totvegcthresh = nan - call this%InitAllocate ( bounds) - call this%InitHistory ( bounds, carbon_type ) - if (present(c12_soilbiogeochem_carbonstate_inst)) then - call this%InitCold ( bounds, ratio, c12_soilbiogeochem_carbonstate_inst ) - else - call this%InitCold ( bounds, ratio) - end if - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - - allocate( this%decomp_cpools_col (begc :endc,1:ndecomp_pools)) ; this%decomp_cpools_col (:,:) = nan - allocate( this%decomp_cpools_1m_col (begc :endc,1:ndecomp_pools)) ; this%decomp_cpools_1m_col (:,:) = nan - - allocate( this%ctrunc_vr_col(begc :endc,1:nlevdecomp_full)) ; - this%ctrunc_vr_col (:,:) = nan - - allocate(this%decomp_cpools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_cpools_vr_col(:,:,:)= nan - - allocate(this%ctrunc_col (begc :endc)) ; this%ctrunc_col (:) = nan - if ( .not. use_fates ) then - allocate(this%cwdc_col (begc :endc)) ; this%cwdc_col (:) = nan - endif - allocate(this%totlitc_col (begc :endc)) ; this%totlitc_col (:) = nan - allocate(this%totsomc_col (begc :endc)) ; this%totsomc_col (:) = nan - allocate(this%totlitc_1m_col (begc :endc)) ; this%totlitc_1m_col (:) = nan - allocate(this%totsomc_1m_col (begc :endc)) ; this%totsomc_1m_col (:) = nan - allocate(this%dyn_cbal_adjustments_col (begc:endc)) ; this%dyn_cbal_adjustments_col (:) = nan - - this%restart_file_spinup_state = huge(1) - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds, carbon_type) - ! - ! !USES: - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - character(len=3) , intent(in) :: carbon_type - ! - ! !LOCAL VARIABLES: - integer :: l - integer :: begc ,endc - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - - !------------------------------- - ! C12 state variables - column - !------------------------------- - - if (carbon_type == 'c12') then - - this%decomp_cpools_col(begc:endc,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_cpools_vr_col(:,1:nlevsoi,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_vr' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' C (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gC/m^3', type2d='levsoi', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr) - endif - - data1dptr => this%decomp_cpools_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'C' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' C' - call hist_addfld1d (fname=fieldname, units='gC/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr) - - if ( nlevdecomp_full > 1 ) then - data1dptr => this%decomp_cpools_1m_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_1m' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' C to 1 meter' - call hist_addfld1d (fname=fieldname, units='gC/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - end do - - this%totlitc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITC', units='gC/m^2', & - avgflag='A', long_name='total litter carbon', & - ptr_col=this%totlitc_col) - - this%totsomc_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMC', units='gC/m^2', & - avgflag='A', long_name='total soil organic matter carbon', & - ptr_col=this%totsomc_col) - - if ( nlevdecomp_full > 1 ) then - this%totlitc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITC_1m', units='gC/m^2', & - avgflag='A', long_name='total litter carbon to 1 meter depth', & - ptr_col=this%totlitc_1m_col) - end if - - if ( nlevdecomp_full > 1 ) then - this%totsomc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMC_1m', units='gC/m^2', & - avgflag='A', long_name='total soil organic matter carbon to 1 meter depth', & - ptr_col=this%totsomc_1m_col) - end if - - this%ctrunc_col(begc:endc) = spval - call hist_addfld1d (fname='COL_CTRUNC', units='gC/m^2', & - avgflag='A', long_name='column-level sink for C truncation', & - ptr_col=this%ctrunc_col, default='inactive') - - this%dyn_cbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_C', units='gC/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil carbon due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_cbal_adjustments_col, default='inactive') - - end if - - !------------------------------- - ! C13 state variables - column - !------------------------------- - - if ( carbon_type == 'c13' ) then - - this%decomp_cpools_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_cpools_vr_col(:,1:nlevsoi,l) - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_vr' - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gC13/m^3', type2d='levsoi', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - data1dptr => this%decomp_cpools_col(:,l) - fieldname = 'C13_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C' - longname = 'C13 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C' - call hist_addfld1d (fname=fieldname, units='gC13/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr) - end do - - this%totlitc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTLITC', units='gC13/m^2', & - avgflag='A', long_name='C13 total litter carbon', & - ptr_col=this%totlitc_col) - - this%totsomc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTSOMC', units='gC13/m^2', & - avgflag='A', long_name='C13 total soil organic matter carbon', & - ptr_col=this%totsomc_col) - - if ( nlevdecomp_full > 1 ) then - this%totlitc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTLITC_1m', units='gC13/m^2', & - avgflag='A', long_name='C13 total litter carbon to 1 meter', & - ptr_col=this%totlitc_1m_col) - end if - - if ( nlevdecomp_full > 1 ) then - this%totsomc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C13_TOTSOMC_1m', units='gC13/m^2', & - avgflag='A', long_name='C13 total soil organic matter carbon to 1 meter', & - ptr_col=this%totsomc_1m_col) - endif - - this%ctrunc_col(begc:endc) = spval - call hist_addfld1d (fname='C13_COL_CTRUNC', units='gC13/m^2', & - avgflag='A', long_name='C13 column-level sink for C truncation', & - ptr_col=this%ctrunc_col, default='inactive') - - this%dyn_cbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='C13_DYN_COL_SOIL_ADJUSTMENTS_C', units='gC13/m^2', & - avgflag='SUM', & - long_name='C13 adjustments in soil carbon due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_cbal_adjustments_col, default='inactive') - endif - - !------------------------------- - ! C14 state variables - column - !------------------------------- - - if ( carbon_type == 'c14' ) then - - this%decomp_cpools_vr_col(begc:endc,:,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_cpools_vr_col(:,1:nlevsoi,l) - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_vr' - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gC14/m^3', type2d='levsoi', & - avgflag='A', long_name=longname, ptr_col=data2dptr, default='inactive') - endif - - data1dptr => this%decomp_cpools_col(:,l) - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C' - longname = 'C14 '//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C' - call hist_addfld1d (fname=fieldname, units='gC14/m^2', & - avgflag='A', long_name=longname, ptr_col=data1dptr) - - if ( nlevdecomp_full > 1 ) then - data1dptr => this%decomp_cpools_1m_col(:,l) - fieldname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//'C_1m' - longname = 'C14_'//trim(decomp_cascade_con%decomp_pool_name_history(l))//' C to 1 meter' - call hist_addfld1d (fname=fieldname, units='gC/m^2', & - avgflag='A', long_name=longname, ptr_col=data1dptr, default='inactive') - endif - end do - - this%totlitc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTLITC', units='gC14/m^2', & - avgflag='A', long_name='C14 total litter carbon', & - ptr_col=this%totlitc_col) - - this%totsomc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTSOMC', units='gC14/m^2', & - avgflag='A', long_name='C14 total soil organic matter carbon', & - ptr_col=this%totsomc_col) - - if ( nlevdecomp_full > 1 ) then - this%totlitc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTLITC_1m', units='gC14/m^2', & - avgflag='A', long_name='C14 total litter carbon to 1 meter', & - ptr_col=this%totlitc_1m_col) - - this%totsomc_1m_col(begc:endc) = spval - call hist_addfld1d (fname='C14_TOTSOMC_1m', units='gC14/m^2', & - avgflag='A', long_name='C14 total soil organic matter carbon to 1 meter', & - ptr_col=this%totsomc_1m_col) - endif - - this%ctrunc_col(begc:endc) = spval - call hist_addfld1d (fname='C14_COL_CTRUNC', units='gC14/m^2', & - avgflag='A', long_name='C14 column-level sink for C truncation', & - ptr_col=this%ctrunc_col, default='inactive') - - this%dyn_cbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='C14_DYN_COL_SOIL_ADJUSTMENTS_C', units='gC14/m^2', & - avgflag='SUM', & - long_name='C14 adjustments in soil carbon due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_cbal_adjustments_col, default='inactive') - endif - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, ratio, c12_soilbiogeochem_carbonstate_inst) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: ratio - type(soilbiogeochem_carbonstate_type), intent(in), optional :: c12_soilbiogeochem_carbonstate_inst - ! - ! !LOCAL VARIABLES: - integer :: p,c,l,j,k - integer :: fc ! filter index - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - !----------------------------------------------------------------------- - - ! initialize column-level variables - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (.not. present(c12_soilbiogeochem_carbonstate_inst)) then !c12 - - do j = 1, nlevdecomp - do k = 1, ndecomp_pools - if (zsoi(j) < decomp_cascade_con%initial_stock_soildepth ) then !! only initialize upper soil column - this%decomp_cpools_vr_col(c,j,k) = decomp_cascade_con%initial_stock(k) - else - this%decomp_cpools_vr_col(c,j,k) = 0._r8 - endif - end do - this%ctrunc_vr_col(c,j) = 0._r8 - end do - if ( nlevdecomp > 1 ) then - do j = nlevdecomp+1, nlevdecomp_full - do k = 1, ndecomp_pools - this%decomp_cpools_vr_col(c,j,k) = 0._r8 - end do - this%ctrunc_vr_col(c,j) = 0._r8 - end do - end if - this%decomp_cpools_col(c,1:ndecomp_pools) = decomp_cascade_con%initial_stock(1:ndecomp_pools) - this%decomp_cpools_1m_col(c,1:ndecomp_pools) = decomp_cascade_con%initial_stock(1:ndecomp_pools) - - else - - do j = 1, nlevdecomp - do k = 1, ndecomp_pools - this%decomp_cpools_vr_col(c,j,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(c,j,k) * ratio - end do - this%ctrunc_vr_col(c,j) = c12_soilbiogeochem_carbonstate_inst%ctrunc_vr_col(c,j) * ratio - end do - if ( nlevdecomp > 1 ) then - do j = nlevdecomp+1, nlevdecomp_full - do k = 1, ndecomp_pools - this%decomp_cpools_vr_col(c,j,k) = 0._r8 - end do - this%ctrunc_vr_col(c,j) = 0._r8 - end do - end if - do k = 1, ndecomp_pools - this%decomp_cpools_col(c,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_col(c,k) * ratio - this%decomp_cpools_1m_col(c,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_1m_col(c,k) * ratio - end do - - endif - end if - - if ( .not. use_fates ) then - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - if (present(c12_soilbiogeochem_carbonstate_inst)) then - this%cwdc_col(c) = c12_soilbiogeochem_carbonstate_inst%cwdc_col(c) * ratio - else - this%cwdc_col(c) = 0._r8 - end if - this%ctrunc_col(c) = 0._r8 - this%totlitc_col(c) = 0._r8 - this%totsomc_col(c) = 0._r8 - this%totlitc_1m_col(c) = 0._r8 - this%totsomc_1m_col(c) = 0._r8 - end if - end if - end do - - ! now loop through special filters and explicitly set the variables that - ! have to be in place for biogeophysics - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - ! initialize fields for special filters - - call this%SetValues (num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, carbon_type, totvegc_col, c12_soilbiogeochem_carbonstate_inst ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_time_manager , only : is_restart, get_nstep - use shr_const_mod , only : SHR_CONST_PDB - use clm_varcon , only : c14ratio - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=3) , intent(in) :: carbon_type ! 'c12' or 'c13' or 'c14' - real(r8) , intent(in) :: totvegc_col(bounds%begc:bounds%endc) ! (gC/m2) total - ! vegetation carbon - type(soilbiogeochem_carbonstate_type) , intent(in), optional :: c12_soilbiogeochem_carbonstate_inst - - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,l,c - real(r8) :: m ! multiplier for the exit_spinup code - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - character(len=128) :: varname ! temporary - logical :: readvar - integer :: idata - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - ! flags for comparing the model and restart decomposition cascades - integer :: decomp_cascade_state, restart_file_decomp_cascade_state - !------------------------------------------------------------------------ - - if (carbon_type == 'c12') then - - do k = 1, ndecomp_pools - varname=trim(decomp_cascade_con%decomp_pool_name_restart(k))//'c' - if (use_vertsoilc) then - ptr2d => this%decomp_cpools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: '//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ctrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname='col_ctrunc_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ctrunc_vr_col(:,1) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname='col_ctrunc', xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: '//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - - end if - - !-------------------------------- - ! C13 column carbon state variables - !-------------------------------- - - if ( carbon_type == 'c13' ) then - - do k = 1, ndecomp_pools - varname = trim(decomp_cascade_con%decomp_pool_name_restart(k))//'c_13' - if (use_vertsoilc) then - ptr2d => this%decomp_cpools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - write(iulog,*) 'initializing soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col' & - // ' with atmospheric c13 value for: '//trim(varname) - do i = bounds%begc,bounds%endc - do j = 1, nlevdecomp - if (this%decomp_cpools_vr_col(i,j,k) /= spval .and. .not. isnan(this%decomp_cpools_vr_col(i,j,k)) ) then - this%decomp_cpools_vr_col(i,j,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(i,j,k) * c3_r2 - endif - end do - end do - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ctrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c13_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ctrunc_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c13", xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - end if - - !-------------------------------- - ! C14 column carbon state variables - !-------------------------------- - - if ( carbon_type == 'c14' ) then - - do k = 1, ndecomp_pools - varname = trim(decomp_cascade_con%decomp_pool_name_restart(k))//'c_14' - if (use_vertsoilc) then - ptr2d => this%decomp_cpools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_cpools_vr_col(:,1,k) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - write(iulog,*) 'initializing soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col with atmospheric c14 value for: '//& - trim(varname) - do i = bounds%begc,bounds%endc - do j = 1, nlevdecomp - if (this%decomp_cpools_vr_col(i,j,k) /= spval .and. .not. isnan(this%decomp_cpools_vr_col(i,j,k)) ) then - this%decomp_cpools_vr_col(i,j,k) = c12_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col(i,j,k) * c3_r2 - endif - end do - end do - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ctrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c14_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ctrunc_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="col_ctrunc_c14", xtype=ncd_double, & - dim1name='column', long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - - end if - - !-------------------------------- - ! Spinup state - !-------------------------------- - - - if (carbon_type == 'c12') then - if (flag == 'write') idata = spinup_state - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - if (flag == 'read') then - if (readvar) then - this%restart_file_spinup_state = idata - else - call endrun(msg=' CNRest: spinup_state was not on the restart file and is required' // & - errMsg(sourcefile, __LINE__)) - end if - end if - else - this%restart_file_spinup_state = c12_soilbiogeochem_carbonstate_inst%restart_file_spinup_state - endif - - ! now compare the model and restart file spinup states, and either take the - ! model into spinup mode or out of it if they are not identical - ! taking model out of spinup mode requires multiplying each decomposing pool - ! by the associated AD factor. - ! putting model into spinup mode requires dividing each decomposing pool - ! by the associated AD factor. - ! only allow this to occur on first timestep of model run. - - if (flag == 'read' .and. spinup_state /= this%restart_file_spinup_state ) then - if (spinup_state == 0 .and. this%restart_file_spinup_state >= 1 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking ',carbon_type,' SOM pools out of AD spinup mode' - exit_spinup = .true. - else if (spinup_state >= 1 .and. this%restart_file_spinup_state == 0 ) then - if ( masterproc ) write(iulog,*) ' CNRest: taking ',carbon_type,' SOM pools into AD spinup mode' - enter_spinup = .true. - else - call endrun(msg=' CNRest: error in entering/exiting spinup. spinup_state ' & - // ' != restart_file_spinup_state, but do not know what to do'//& - errMsg(sourcefile, __LINE__)) - end if - if (get_nstep() >= 2) then - call endrun(msg=' CNRest: error in entering/exiting spinup - should occur only when nstep = 1'//& - errMsg(sourcefile, __LINE__)) - endif - if ( exit_spinup .and. isnan(this%totvegcthresh) )then - call endrun(msg=' CNRest: error in exit spinup - totvegcthresh was not set with SetTotVgCThresh'//& - errMsg(sourcefile, __LINE__)) - end if - do k = 1, ndecomp_pools - if ( exit_spinup ) then - m = decomp_cascade_con%spinup_factor(k) - else if ( enter_spinup ) then - m = 1. / decomp_cascade_con%spinup_factor(k) - end if - do c = bounds%begc, bounds%endc - l = col%landunit(c) - do j = 1, nlevdecomp_full - if ( abs(m - 1._r8) .gt. 0.000001_r8 .and. exit_spinup) then - this%decomp_cpools_vr_col(c,j,k) = this%decomp_cpools_vr_col(c,j,k) * m * & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - ! If there is no vegetation carbon, implying that all vegetation has died, then - ! reset decomp pools to near zero during exit_spinup to avoid very - ! large and inert soil carbon stocks; note that only pools with spinup factor > 1 - ! will be affected, which means that total SOMC and LITC pools will not be set to 0. - if (totvegc_col(c) <= this%totvegcthresh .and. lun%itype(l) /= istcrop) then - this%decomp_cpools_vr_col(c,j,k) = 0.0_r8 - endif - elseif ( abs(m - 1._r8) .gt. 0.000001_r8 .and. enter_spinup) then - this%decomp_cpools_vr_col(c,j,k) = this%decomp_cpools_vr_col(c,j,k) * m / & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - this%decomp_cpools_vr_col(c,j,k) = this%decomp_cpools_vr_col(c,j,k) * m - endif - end do - end do - end do - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set carbon state variables - ! - ! !ARGUMENTS: - class (soilbiogeochem_carbonstate_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i,j,k,l ! loop index - !------------------------------------------------------------------------ - - do fi = 1,num_column - i = filter_column(fi) - if ( .not. use_fates ) then - this%cwdc_col(i) = value_column - end if - this%ctrunc_col(i) = value_column - this%totlitc_col(i) = value_column - this%totlitc_1m_col(i) = value_column - this%totsomc_col(i) = value_column - this%totsomc_1m_col(i) = value_column - end do - - do j = 1,nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%ctrunc_vr_col(i,j) = value_column - end do - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_col(i,k) = value_column - this%decomp_cpools_1m_col(i,k) = value_column - end do - end do - - do j = 1,nlevdecomp_full - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_cpools_vr_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine Summary(this, bounds, num_allc, filter_allc) - ! - ! !DESCRIPTION: - ! Perform column-level carbon summary calculations - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonstate_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l ! indices - integer :: fc ! filter indices - real(r8) :: maxdepth ! depth to integrate soil variables - !----------------------------------------------------------------------- - - ! vertically integrate each of the decomposing C pools - do l = 1, ndecomp_pools - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_col(c,l) = 0._r8 - end do - end do - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_col(c,l) = & - this%decomp_cpools_col(c,l) + & - this%decomp_cpools_vr_col(c,j,l) * dzsoi_decomp(j) - end do - end do - end do - - if ( nlevdecomp > 1) then - - ! vertically integrate each of the decomposing C pools to 1 meter - maxdepth = 1._r8 - do l = 1, ndecomp_pools - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_1m_col(c,l) = 0._r8 - end do - end do - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - if ( zisoi(j) <= maxdepth ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_1m_col(c,l) = & - this%decomp_cpools_1m_col(c,l) + & - this%decomp_cpools_vr_col(c,j,l) * dzsoi_decomp(j) - end do - elseif ( zisoi(j-1) < maxdepth ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_cpools_1m_col(c,l) = & - this%decomp_cpools_1m_col(c,l) + & - this%decomp_cpools_vr_col(c,j,l) * (maxdepth - zisoi(j-1)) - end do - endif - end do - end do - - endif - - ! truncation carbon - do fc = 1,num_allc - c = filter_allc(fc) - this%ctrunc_col(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%ctrunc_col(c) = & - this%ctrunc_col(c) + & - this%ctrunc_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - ! total litter carbon in the top meter (TOTLITC_1m) - if ( nlevdecomp > 1) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_1m_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_1m_col(c) = this%totlitc_1m_col(c) + & - this%decomp_cpools_1m_col(c,l) - end do - endif - end do - end if - - ! total soil organic matter carbon in the top meter (TOTSOMC_1m) - if ( nlevdecomp > 1) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_1m_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_soil(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_1m_col(c) = this%totsomc_1m_col(c) + this%decomp_cpools_1m_col(c,l) - end do - end if - end do - end if - - ! total litter carbon (TOTLITC) - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitc_col(c) = this%totlitc_col(c) + this%decomp_cpools_col(c,l) - end do - endif - end do - - ! total soil organic matter carbon (TOTSOMC) - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_soil(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomc_col(c) = this%totsomc_col(c) + this%decomp_cpools_col(c,l) - end do - end if - end do - - ! coarse woody debris carbon - if (.not. use_fates ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%cwdc_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_cwd(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%cwdc_col(c) = this%cwdc_col(c) + this%decomp_cpools_col(c,l) - end do - end if - end do - - end if - - end subroutine Summary - - !------------------------------------------------------------------------ - subroutine SetTotVgCThresh(this, totvegcthresh) - - class(soilbiogeochem_carbonstate_type) :: this - real(r8) , intent(in) :: totvegcthresh - - if ( totvegcthresh <= 0.0_r8 )then - call endrun(msg=' ERROR totvegcthresh is zero or negative and should be > 0'//& - errMsg(sourcefile, __LINE__)) - end if - this%totvegcthresh = totvegcthresh - - end subroutine SetTotVgCThresh - - - !----------------------------------------------------------------------- - subroutine DynamicColumnAdjustments(this, bounds, clump_index, column_state_updater) - ! - ! !DESCRIPTION: - ! Adjust state variables when column areas change due to dynamic landuse - ! - ! !USES: - use dynColumnStateUpdaterMod, only : column_state_updater_type - ! - ! !ARGUMENTS: - class(soilbiogeochem_carbonstate_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer , intent(in) :: clump_index - - type(column_state_updater_type) , intent(in) :: column_state_updater - ! - ! !LOCAL VARIABLES: - integer :: j ! level - integer :: l ! decomp pool - real(r8) :: adjustment_one_level(bounds%begc:bounds%endc) - integer :: begc, endc - - character(len=*), parameter :: subname = 'DynamicColumnAdjustments' - !----------------------------------------------------------------------- - - begc = bounds%begc - endc = bounds%endc - - this%dyn_cbal_adjustments_col(begc:endc) = 0._r8 - - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%decomp_cpools_vr_col(begc:endc, j, l), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_cbal_adjustments_col(begc:endc) = & - this%dyn_cbal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - end do - end do - - do j = 1, nlevdecomp - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%ctrunc_vr_col(begc:endc, j), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_cbal_adjustments_col(begc:endc) = & - this%dyn_cbal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - end do - - end subroutine DynamicColumnAdjustments - - -end module SoilBiogeochemCarbonStateType diff --git a/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 b/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 deleted file mode 100644 index 8faa259e34..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemCompetitionMod.F90 +++ /dev/null @@ -1,948 +0,0 @@ -module SoilBiogeochemCompetitionMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Resolve plant/heterotroph competition for mineral N - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : dzsoi_decomp - use clm_varctl , only : use_nitrif_denitrif - use abortutils , only : endrun - use decompMod , only : bounds_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenUptakeMod , only : SoilBiogeochemNitrogenUptake - use ColumnType , only : col - use CNVegstateType , only : cnveg_state_type - use CNVegCarbonStateType , only : cnveg_carbonstate_type - use CNVegCarbonFluxType , only : cnveg_carbonflux_type - use CNVegnitrogenstateType , only : cnveg_nitrogenstate_type - use CNVegnitrogenfluxType , only : cnveg_nitrogenflux_type - !use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use WaterStateType , only : waterstate_type - use WaterfluxType , only : waterflux_type - use TemperatureType , only : temperature_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : CanopyState_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemCompetitionInit ! Initialization - public :: SoilBiogeochemCompetition ! run method - - type :: params_type - real(r8) :: bdnr ! bulk denitrification rate (1/s) - real(r8) :: compet_plant_no3 ! (unitless) relative compettiveness of plants for NO3 - real(r8) :: compet_plant_nh4 ! (unitless) relative compettiveness of plants for NH4 - real(r8) :: compet_decomp_no3 ! (unitless) relative competitiveness of immobilizers for NO3 - real(r8) :: compet_decomp_nh4 ! (unitless) relative competitiveness of immobilizers for NH4 - real(r8) :: compet_denit ! (unitless) relative competitiveness of denitrifiers for NO3 - real(r8) :: compet_nit ! (unitless) relative competitiveness of nitrifiers for NH4 - end type params_type - ! - type(params_type), private :: params_inst ! params_inst is populated in readParamsMod - ! - ! !PUBLIC DATA MEMBERS: - character(len=* ), public, parameter :: suplnAll='ALL' ! Supplemental Nitrogen for all PFT's - character(len=* ), public, parameter :: suplnNon='NONE' ! No supplemental Nitrogen - character(len=15), public :: suplnitro = suplnNon ! Supplemental Nitrogen mode - ! - ! !PRIVATE DATA MEMBERS: - real(r8) :: dt ! decomp timestep (seconds) - real(r8) :: bdnr ! bulk denitrification rate (1/s) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNAllocParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in parameter - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! read in parameters - - tString='bdnr' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%bdnr=tempr - - tString='compet_plant_no3' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%compet_plant_no3=tempr - - tString='compet_plant_nh4' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%compet_plant_nh4=tempr - - tString='compet_decomp_no3' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%compet_decomp_no3=tempr - - tString='compet_decomp_nh4' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%compet_decomp_nh4=tempr - - tString='compet_denit' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%compet_denit=tempr - - tString='compet_nit' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%compet_nit=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemCompetitionInit ( bounds) - ! - ! !DESCRIPTION: - ! - ! !USES: - use clm_varcon , only: secspday - use clm_time_manager, only: get_step_size - use clm_varctl , only: iulog, cnallocate_carbon_only_set - use shr_infnan_mod , only: nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'SoilBiogeochemCompetitionInit' - logical :: carbon_only - !----------------------------------------------------------------------- - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! set space-and-time parameters from parameter file - bdnr = params_inst%bdnr * (dt/secspday) - - ! Change namelist settings into private logical variables - select case(suplnitro) - case(suplnNon) - carbon_only = .false. - case(suplnAll) - carbon_only = .true. - case default - write(iulog,*) 'Supplemental Nitrogen flag (suplnitro) can only be: ', & - suplnNon, ' or ', suplnAll - call endrun(msg='ERROR: supplemental Nitrogen flag is not correct'//& - errMsg(sourcefile, __LINE__)) - end select - - call cnallocate_carbon_only_set(carbon_only) - - end subroutine SoilBiogeochemCompetitionInit - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemCompetition (bounds, num_soilc, filter_soilc,num_soilp, filter_soilp, waterstate_inst, & - waterflux_inst, temperature_inst,soilstate_inst, & - cnveg_state_inst,cnveg_carbonstate_inst, & - cnveg_carbonflux_inst,cnveg_nitrogenstate_inst,cnveg_nitrogenflux_inst, & - soilbiogeochem_carbonflux_inst, & - soilbiogeochem_state_inst, soilbiogeochem_nitrogenstate_inst, & - soilbiogeochem_nitrogenflux_inst,canopystate_inst) - ! - ! !USES: - use clm_varctl , only: cnallocate_carbon_only, iulog - use clm_varpar , only: nlevdecomp, ndecomp_cascade_transitions - use clm_varcon , only: nitrif_n2o_loss_frac - use CNSharedParamsMod, only: use_fun - use CNFUNMod , only: CNFUN - use subgridAveMod , only: p2c_2d - use perf_mod , only : t_startf, t_stopf - ! - ! !ARGUMENTS: - 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(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(temperature_type) , intent(in) :: temperature_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(cnveg_state_type) , intent(inout) :: cnveg_state_inst - type(cnveg_carbonstate_type) , intent(inout) :: cnveg_carbonstate_inst - type(cnveg_carbonflux_type) , intent(inout) :: cnveg_carbonflux_inst - type(cnveg_nitrogenstate_type) , intent(inout) :: cnveg_nitrogenstate_inst - type(cnveg_nitrogenflux_type) , intent(inout) :: cnveg_nitrogenflux_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(canopystate_type) , intent(inout) :: canopystate_inst -! - ! - ! !LOCAL VARIABLES: - integer :: c,p,l,pi,j ! indices - integer :: fc ! filter column index - logical :: local_use_fun ! local version of use_fun - real(r8) :: compet_plant_no3 ! (unitless) relative compettiveness of plants for NO3 - real(r8) :: compet_plant_nh4 ! (unitless) relative compettiveness of plants for NH4 - real(r8) :: compet_decomp_no3 ! (unitless) relative competitiveness of immobilizers for NO3 - real(r8) :: compet_decomp_nh4 ! (unitless) relative competitiveness of immobilizers for NH4 - real(r8) :: compet_denit ! (unitless) relative competitiveness of denitrifiers for NO3 - real(r8) :: compet_nit ! (unitless) relative competitiveness of nitrifiers for NH4 - real(r8) :: fpi_no3_vr(bounds%begc:bounds%endc,1:nlevdecomp) ! fraction of potential immobilization supplied by no3(no units) - real(r8) :: fpi_nh4_vr(bounds%begc:bounds%endc,1:nlevdecomp) ! fraction of potential immobilization supplied by nh4 (no units) - real(r8) :: sum_nh4_demand(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: sum_nh4_demand_scaled(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: sum_no3_demand(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: sum_no3_demand_scaled(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: sum_ndemand_vr(bounds%begc:bounds%endc, 1:nlevdecomp) !total column N demand (gN/m3/s) at a given level - real(r8) :: nuptake_prof(bounds%begc:bounds%endc, 1:nlevdecomp) - real(r8) :: sminn_tot(bounds%begc:bounds%endc) - integer :: nlimit(bounds%begc:bounds%endc,0:nlevdecomp) !flag for N limitation - integer :: nlimit_no3(bounds%begc:bounds%endc,0:nlevdecomp) !flag for NO3 limitation - integer :: nlimit_nh4(bounds%begc:bounds%endc,0:nlevdecomp) !flag for NH4 limitation - real(r8) :: residual_sminn_vr(bounds%begc:bounds%endc, 1:nlevdecomp) - real(r8) :: residual_sminn(bounds%begc:bounds%endc) - real(r8) :: residual_smin_nh4_vr(bounds%begc:bounds%endc, 1:nlevdecomp) - real(r8) :: residual_smin_no3_vr(bounds%begc:bounds%endc, 1:nlevdecomp) - real(r8) :: residual_smin_nh4(bounds%begc:bounds%endc) - real(r8) :: residual_smin_no3(bounds%begc:bounds%endc) - real(r8) :: residual_plant_ndemand(bounds%begc:bounds%endc) - real(r8) :: sminn_to_plant_new(bounds%begc:bounds%endc) - !----------------------------------------------------------------------- - - associate( & - fpg => soilbiogeochem_state_inst%fpg_col , & ! Output: [real(r8) (:) ] fraction of potential gpp (no units) - fpi => soilbiogeochem_state_inst%fpi_col , & ! Output: [real(r8) (:) ] fraction of potential immobilization (no units) - fpi_vr => soilbiogeochem_state_inst%fpi_vr_col , & ! Output: [real(r8) (:,:) ] fraction of potential immobilization (no units) - nfixation_prof => soilbiogeochem_state_inst%nfixation_prof_col , & ! Output: [real(r8) (:,:) ] - plant_ndemand => soilbiogeochem_state_inst%plant_ndemand_col , & ! Input: [real(r8) (:) ] column-level plant N demand - - sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N - smin_nh4_vr => soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NH4 - smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NO3 - - pot_f_nit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_nit_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3/s) potential soil nitrification flux - pot_f_denit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_denit_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3/s) potential soil denitrification flux - f_nit_vr => soilbiogeochem_nitrogenflux_inst%f_nit_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3/s) soil nitrification flux - f_denit_vr => soilbiogeochem_nitrogenflux_inst%f_denit_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3/s) soil denitrification flux - potential_immob => soilbiogeochem_nitrogenflux_inst%potential_immob_col , & ! Output: [real(r8) (:) ] - actual_immob => soilbiogeochem_nitrogenflux_inst%actual_immob_col , & ! Output: [real(r8) (:) ] - sminn_to_plant => soilbiogeochem_nitrogenflux_inst%sminn_to_plant_col , & ! Output: [real(r8) (:) ] - sminn_to_denit_excess_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_denit_excess_vr_col , & ! Output: [real(r8) (:,:) ] - actual_immob_no3_vr => soilbiogeochem_nitrogenflux_inst%actual_immob_no3_vr_col , & ! Output: [real(r8) (:,:) ] - actual_immob_nh4_vr => soilbiogeochem_nitrogenflux_inst%actual_immob_nh4_vr_col , & ! Output: [real(r8) (:,:) ] - smin_no3_to_plant_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_to_plant_vr_col , & ! Output: [real(r8) (:,:) ] - smin_nh4_to_plant_vr => soilbiogeochem_nitrogenflux_inst%smin_nh4_to_plant_vr_col , & ! Output: [real(r8) (:,:) ] - n2_n2o_ratio_denit_vr => soilbiogeochem_nitrogenflux_inst%n2_n2o_ratio_denit_vr_col , & ! Output: [real(r8) (:,:) ] ratio of N2 to N2O production by denitrification [gN/gN] - f_n2o_denit_vr => soilbiogeochem_nitrogenflux_inst%f_n2o_denit_vr_col , & ! Output: [real(r8) (:,:) ] flux of N2O from denitrification [gN/m3/s] - f_n2o_nit_vr => soilbiogeochem_nitrogenflux_inst%f_n2o_nit_vr_col , & ! Output: [real(r8) (:,:) ] flux of N2O from nitrification [gN/m3/s] - supplement_to_sminn_vr => soilbiogeochem_nitrogenflux_inst%supplement_to_sminn_vr_col , & ! Output: [real(r8) (:,:) ] - sminn_to_plant_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_plant_vr_col , & ! Output: [real(r8) (:,:) ] - potential_immob_vr => soilbiogeochem_nitrogenflux_inst%potential_immob_vr_col , & ! Input: [real(r8) (:,:) ] - actual_immob_vr => soilbiogeochem_nitrogenflux_inst%actual_immob_vr_col , & ! Output: [real(r8) (:,:) ] - sminn_to_plant_fun_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_plant_fun_vr_col , & ! Iutput: [real(r8) (:) ] Total layer soil N uptake of FUN (gN/m2/s) - sminn_to_plant_fun_no3_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_plant_fun_no3_vr_col, & ! Iutput: [real(r8) (:) ] Total layer no3 uptake of FUN (gN/m2/s) - sminn_to_plant_fun_nh4_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_plant_fun_nh4_vr_col & ! Iutput: [real(r8) (:) ] Total layer nh4 uptake of FUN (gN/m2/s) - ) - - ! calcualte nitrogen uptake profile - ! nuptake_prof(:,:) = nan - ! call SoilBiogelchemNitrogenUptakeProfile(bounds, & - ! nlevdecomp, num_soilc, filter_soilc, & - ! sminn_vr, dzsoi_decomp, nfixation_prof, nuptake_prof) - - ! column loops to resolve plant/heterotroph competition for mineral N - - sminn_to_plant_new(bounds%begc:bounds%endc) = 0._r8 - - local_use_fun = use_fun - - if (.not. use_nitrif_denitrif) then - - ! init sminn_tot - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_tot(c) = 0. - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_tot(c) = sminn_tot(c) + sminn_vr(c,j) * dzsoi_decomp(j) - end do - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if (sminn_tot(c) > 0.) then - nuptake_prof(c,j) = sminn_vr(c,j) / sminn_tot(c) - else - nuptake_prof(c,j) = nfixation_prof(c,j) - endif - end do - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sum_ndemand_vr(c,j) = plant_ndemand(c) * nuptake_prof(c,j) + potential_immob_vr(c,j) - end do - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - l = col%landunit(c) - if (sum_ndemand_vr(c,j)*dt < sminn_vr(c,j)) then - - ! N availability is not limiting immobilization or plant - ! uptake, and both can proceed at their potential rates - nlimit(c,j) = 0 - fpi_vr(c,j) = 1.0_r8 - actual_immob_vr(c,j) = potential_immob_vr(c,j) - sminn_to_plant_vr(c,j) = plant_ndemand(c) * nuptake_prof(c,j) - else if ( cnallocate_carbon_only()) then !.or. & - ! this code block controls the addition of N to sminn pool - ! to eliminate any N limitation, when Carbon_Only is set. This lets the - ! model behave essentially as a carbon-only model, but with the - ! benefit of keeping track of the N additions needed to - ! eliminate N limitations, so there is still a diagnostic quantity - ! that describes the degree of N limitation at steady-state. - - nlimit(c,j) = 1 - fpi_vr(c,j) = 1.0_r8 - actual_immob_vr(c,j) = potential_immob_vr(c,j) - sminn_to_plant_vr(c,j) = plant_ndemand(c) * nuptake_prof(c,j) - supplement_to_sminn_vr(c,j) = sum_ndemand_vr(c,j) - (sminn_vr(c,j)/dt) - else - ! N availability can not satisfy the sum of immobilization and - ! plant growth demands, so these two demands compete for available - ! soil mineral N resource. - - nlimit(c,j) = 1 - if (sum_ndemand_vr(c,j) > 0.0_r8) then - actual_immob_vr(c,j) = (sminn_vr(c,j)/dt)*(potential_immob_vr(c,j) / sum_ndemand_vr(c,j)) - else - actual_immob_vr(c,j) = 0.0_r8 - end if - - if (potential_immob_vr(c,j) > 0.0_r8) then - fpi_vr(c,j) = actual_immob_vr(c,j) / potential_immob_vr(c,j) - else - fpi_vr(c,j) = 0.0_r8 - end if - - sminn_to_plant_vr(c,j) = (sminn_vr(c,j)/dt) - actual_immob_vr(c,j) - end if - end do - end do - - if ( local_use_fun ) then - call t_startf( 'CNFUN' ) - call CNFUN(bounds,num_soilc,filter_soilc,num_soilp,filter_soilp,waterstate_inst ,& - waterflux_inst,temperature_inst,soilstate_inst,cnveg_state_inst,cnveg_carbonstate_inst,& - cnveg_carbonflux_inst,cnveg_nitrogenstate_inst,cnveg_nitrogenflux_inst ,& - soilbiogeochem_nitrogenflux_inst,soilbiogeochem_carbonflux_inst,canopystate_inst, & - soilbiogeochem_nitrogenstate_inst) - call p2c_2d(bounds, nlevdecomp, & - cnveg_nitrogenflux_inst%sminn_to_plant_fun_vr_patch(bounds%begp:bounds%endp,1:nlevdecomp),& - soilbiogeochem_nitrogenflux_inst%sminn_to_plant_fun_vr_col(bounds%begc:bounds%endc,1:nlevdecomp), & - 'unity') - call t_stopf( 'CNFUN' ) - end if - - ! sum up N fluxes to plant - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = sminn_to_plant(c) + sminn_to_plant_vr(c,j) * dzsoi_decomp(j) - if ( local_use_fun ) then - if (sminn_to_plant_fun_vr(c,j).gt.sminn_to_plant_vr(c,j)) then - sminn_to_plant_fun_vr(c,j) = sminn_to_plant_vr(c,j) - end if - end if - end do - end do - - ! give plants a second pass to see if there is any mineral N left over with which to satisfy residual N demand. - do fc=1,num_soilc - c = filter_soilc(fc) - residual_sminn(c) = 0._r8 - end do - - ! sum up total N left over after initial plant and immobilization fluxes - do fc=1,num_soilc - c = filter_soilc(fc) - residual_plant_ndemand(c) = plant_ndemand(c) - sminn_to_plant(c) - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if (residual_plant_ndemand(c) > 0._r8 ) then - if (nlimit(c,j) .eq. 0) then - residual_sminn_vr(c,j) = max(sminn_vr(c,j) - (actual_immob_vr(c,j) + sminn_to_plant_vr(c,j) ) * dt, 0._r8) - residual_sminn(c) = residual_sminn(c) + residual_sminn_vr(c,j) * dzsoi_decomp(j) - else - residual_sminn_vr(c,j) = 0._r8 - endif - endif - end do - end do - - ! distribute residual N to plants - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if ( residual_plant_ndemand(c) > 0._r8 .and. residual_sminn(c) > 0._r8 .and. nlimit(c,j) .eq. 0) then - sminn_to_plant_vr(c,j) = sminn_to_plant_vr(c,j) + residual_sminn_vr(c,j) * & - min(( residual_plant_ndemand(c) * dt ) / residual_sminn(c), 1._r8) / dt - endif - end do - end do - - ! re-sum up N fluxes to plant - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = sminn_to_plant(c) + sminn_to_plant_vr(c,j) * dzsoi_decomp(j) - if ( .not. local_use_fun ) then - sum_ndemand_vr(c,j) = potential_immob_vr(c,j) + sminn_to_plant_vr(c,j) - else - sminn_to_plant_new(c) = sminn_to_plant_new(c) + sminn_to_plant_fun_vr(c,j) * dzsoi_decomp(j) - sum_ndemand_vr(c,j) = potential_immob_vr(c,j) + sminn_to_plant_fun_vr(c,j) - end if - end do - end do - - ! under conditions of excess N, some proportion is assumed to - ! be lost to denitrification, in addition to the constant - ! proportion lost in the decomposition pathways - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if ( .not. local_use_fun ) then - if ((sminn_to_plant_vr(c,j) + actual_immob_vr(c,j))*dt < sminn_vr(c,j)) then - sminn_to_denit_excess_vr(c,j) = max(bdnr*((sminn_vr(c,j)/dt) - sum_ndemand_vr(c,j)),0._r8) - else - sminn_to_denit_excess_vr(c,j) = 0._r8 - endif - else - if ((sminn_to_plant_fun_vr(c,j) + actual_immob_vr(c,j))*dt < sminn_vr(c,j)) then - sminn_to_denit_excess_vr(c,j) = max(bdnr*((sminn_vr(c,j)/dt) - sum_ndemand_vr(c,j)),0._r8) - else - sminn_to_denit_excess_vr(c,j) = 0._r8 - endif - end if - end do - end do - - ! sum up N fluxes to immobilization - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - actual_immob(c) = actual_immob(c) + actual_immob_vr(c,j) * dzsoi_decomp(j) - potential_immob(c) = potential_immob(c) + potential_immob_vr(c,j) * dzsoi_decomp(j) - end do - end do - - do fc=1,num_soilc - c = filter_soilc(fc) - ! calculate the fraction of potential growth that can be - ! acheived with the N available to plants - if (plant_ndemand(c) > 0.0_r8) then - if ( .not. local_use_fun ) then - fpg(c) = sminn_to_plant(c) / plant_ndemand(c) - else - fpg(c) = sminn_to_plant_new(c) / plant_ndemand(c) - end if - else - fpg(c) = 1.0_r8 - end if - - ! calculate the fraction of immobilization realized (for diagnostic purposes) - if (potential_immob(c) > 0.0_r8) then - fpi(c) = actual_immob(c) / potential_immob(c) - else - fpi(c) = 1.0_r8 - end if - end do - - else !----------NITRIF_DENITRIF-------------! - - ! column loops to resolve plant/heterotroph/nitrifier/denitrifier competition for mineral N - !read constants from external netcdf file - compet_plant_no3 = params_inst%compet_plant_no3 - compet_plant_nh4 = params_inst%compet_plant_nh4 - compet_decomp_no3 = params_inst%compet_decomp_no3 - compet_decomp_nh4 = params_inst%compet_decomp_nh4 - compet_denit = params_inst%compet_denit - compet_nit = params_inst%compet_nit - - ! init total mineral N pools - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_tot(c) = 0. - end do - - ! sum up total mineral N pools - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_tot(c) = sminn_tot(c) + (smin_no3_vr(c,j) + smin_nh4_vr(c,j)) * dzsoi_decomp(j) - end do - end do - - ! define N uptake profile for initial vertical distribution of plant N uptake, assuming plant seeks N from where it is most abundant - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if (sminn_tot(c) > 0.) then - nuptake_prof(c,j) = sminn_vr(c,j) / sminn_tot(c) - else - nuptake_prof(c,j) = nfixation_prof(c,j) - endif - end do - end do - - ! main column/vertical loop - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - l = col%landunit(c) - - ! first compete for nh4 - sum_nh4_demand(c,j) = plant_ndemand(c) * nuptake_prof(c,j) + potential_immob_vr(c,j) + pot_f_nit_vr(c,j) - sum_nh4_demand_scaled(c,j) = plant_ndemand(c)* nuptake_prof(c,j) * compet_plant_nh4 + & - potential_immob_vr(c,j)*compet_decomp_nh4 + pot_f_nit_vr(c,j)*compet_nit - - if (sum_nh4_demand(c,j)*dt < smin_nh4_vr(c,j)) then - - ! NH4 availability is not limiting immobilization or plant - ! uptake, and all can proceed at their potential rates - nlimit_nh4(c,j) = 0 - fpi_nh4_vr(c,j) = 1.0_r8 - actual_immob_nh4_vr(c,j) = potential_immob_vr(c,j) - !RF added new term. - - f_nit_vr(c,j) = pot_f_nit_vr(c,j) - - if ( .not. local_use_fun ) then - smin_nh4_to_plant_vr(c,j) = plant_ndemand(c) * nuptake_prof(c,j) - else - smin_nh4_to_plant_vr(c,j) = smin_nh4_vr(c,j)/dt - actual_immob_nh4_vr(c,j) - f_nit_vr(c,j) - end if - - else - - ! NH4 availability can not satisfy the sum of immobilization, nitrification, and - ! plant growth demands, so these three demands compete for available - ! soil mineral NH4 resource. - nlimit_nh4(c,j) = 1 - if (sum_nh4_demand(c,j) > 0.0_r8) then - ! RF microbes compete based on the hypothesised plant demand. - actual_immob_nh4_vr(c,j) = min((smin_nh4_vr(c,j)/dt)*(potential_immob_vr(c,j)* & - compet_decomp_nh4 / sum_nh4_demand_scaled(c,j)), potential_immob_vr(c,j)) - - f_nit_vr(c,j) = min((smin_nh4_vr(c,j)/dt)*(pot_f_nit_vr(c,j)*compet_nit / & - sum_nh4_demand_scaled(c,j)), pot_f_nit_vr(c,j)) - - if ( .not. local_use_fun ) then - smin_nh4_to_plant_vr(c,j) = min((smin_nh4_vr(c,j)/dt)*(plant_ndemand(c)* & - nuptake_prof(c,j)*compet_plant_nh4 / sum_nh4_demand_scaled(c,j)), plant_ndemand(c)*nuptake_prof(c,j)) - - else - ! RF added new term. send rest of N to plant - which decides whether it should pay or not? - smin_nh4_to_plant_vr(c,j) = smin_nh4_vr(c,j)/dt - actual_immob_nh4_vr(c,j) - f_nit_vr(c,j) - end if - - else - actual_immob_nh4_vr(c,j) = 0.0_r8 - smin_nh4_to_plant_vr(c,j) = 0.0_r8 - f_nit_vr(c,j) = 0.0_r8 - end if - - if (potential_immob_vr(c,j) > 0.0_r8) then - fpi_nh4_vr(c,j) = actual_immob_nh4_vr(c,j) / potential_immob_vr(c,j) - else - fpi_nh4_vr(c,j) = 0.0_r8 - end if - - end if - - - - if(.not.local_use_fun)then - sum_no3_demand(c,j) = (plant_ndemand(c)*nuptake_prof(c,j)-smin_nh4_to_plant_vr(c,j)) + & - (potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j)) + pot_f_denit_vr(c,j) - sum_no3_demand_scaled(c,j) = (plant_ndemand(c)*nuptake_prof(c,j) & - -smin_nh4_to_plant_vr(c,j))*compet_plant_no3 + & - (potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j))*compet_decomp_no3 + pot_f_denit_vr(c,j)*compet_denit - else - sum_no3_demand(c,j) = plant_ndemand(c)*nuptake_prof(c,j) + & - (potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j)) + pot_f_denit_vr(c,j) - sum_no3_demand_scaled(c,j) = (plant_ndemand(c)*nuptake_prof(c,j))*compet_plant_no3 + & - (potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j))*compet_decomp_no3 + pot_f_denit_vr(c,j)*compet_denit - endif - - - - if (sum_no3_demand(c,j)*dt < smin_no3_vr(c,j)) then - - ! NO3 availability is not limiting immobilization or plant - ! uptake, and all can proceed at their potential rates - nlimit_no3(c,j) = 0 - fpi_no3_vr(c,j) = 1.0_r8 - fpi_nh4_vr(c,j) - actual_immob_no3_vr(c,j) = (potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j)) - - f_denit_vr(c,j) = pot_f_denit_vr(c,j) - - if(.not.local_use_fun)then - smin_no3_to_plant_vr(c,j) = (plant_ndemand(c)*nuptake_prof(c,j)-smin_nh4_to_plant_vr(c,j)) - else - ! This restricts the N uptake of a single layer to the value determined from the total demands and the - ! hypothetical uptake profile above. Which is a strange thing to do, since that is independent of FUN - ! do we need this at all? - smin_no3_to_plant_vr(c,j) = plant_ndemand(c)*nuptake_prof(c,j) - ! RF added new term. send rest of N to plant - which decides whether it should pay or not? - if ( local_use_fun ) then - smin_no3_to_plant_vr(c,j) = smin_no3_vr(c,j)/dt - actual_immob_no3_vr(c,j) - f_denit_vr(c,j) - end if - endif - - else - - ! NO3 availability can not satisfy the sum of immobilization, denitrification, and - ! plant growth demands, so these three demands compete for available - ! soil mineral NO3 resource. - nlimit_no3(c,j) = 1 - - if (sum_no3_demand(c,j) > 0.0_r8) then - if(.not.local_use_fun)then - actual_immob_no3_vr(c,j) = min((smin_no3_vr(c,j)/dt)*((potential_immob_vr(c,j)- & - actual_immob_nh4_vr(c,j))*compet_decomp_no3 / sum_no3_demand_scaled(c,j)), & - potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j)) - - smin_no3_to_plant_vr(c,j) = min((smin_no3_vr(c,j)/dt)*((plant_ndemand(c)* & - nuptake_prof(c,j)-smin_nh4_to_plant_vr(c,j))*compet_plant_no3 / sum_no3_demand_scaled(c,j)), & - plant_ndemand(c)*nuptake_prof(c,j)-smin_nh4_to_plant_vr(c,j)) - - f_denit_vr(c,j) = min((smin_no3_vr(c,j)/dt)*(pot_f_denit_vr(c,j)*compet_denit / & - sum_no3_demand_scaled(c,j)), pot_f_denit_vr(c,j)) - else - actual_immob_no3_vr(c,j) = min((smin_no3_vr(c,j)/dt)*((potential_immob_vr(c,j)- & - actual_immob_nh4_vr(c,j))*compet_decomp_no3 / sum_no3_demand_scaled(c,j)), & - potential_immob_vr(c,j)-actual_immob_nh4_vr(c,j)) - - f_denit_vr(c,j) = min((smin_no3_vr(c,j)/dt)*(pot_f_denit_vr(c,j)*compet_denit / & - sum_no3_demand_scaled(c,j)), pot_f_denit_vr(c,j)) - - smin_no3_to_plant_vr(c,j) = (smin_no3_vr(c,j)/dt)*((plant_ndemand(c)* & - nuptake_prof(c,j)-smin_nh4_to_plant_vr(c,j))*compet_plant_no3 / sum_no3_demand_scaled(c,j)) - - ! RF added new term. send rest of N to plant - which decides whether it should pay or not? - smin_no3_to_plant_vr(c,j) = (smin_no3_vr(c,j) / dt) - actual_immob_no3_vr(c,j) - f_denit_vr(c,j) - - - end if ! use_fun - - else ! no no3 demand. no uptake fluxes. - actual_immob_no3_vr(c,j) = 0.0_r8 - smin_no3_to_plant_vr(c,j) = 0.0_r8 - f_denit_vr(c,j) = 0.0_r8 - - end if !any no3 demand? - - - - - if (potential_immob_vr(c,j) > 0.0_r8) then - fpi_no3_vr(c,j) = actual_immob_no3_vr(c,j) / potential_immob_vr(c,j) - else - fpi_no3_vr(c,j) = 0.0_r8 - end if - - end if - - - - - ! n2o emissions: n2o from nitr is const fraction, n2o from denitr is calculated in nitrif_denitrif - f_n2o_nit_vr(c,j) = f_nit_vr(c,j) * nitrif_n2o_loss_frac - f_n2o_denit_vr(c,j) = f_denit_vr(c,j) / (1._r8 + n2_n2o_ratio_denit_vr(c,j)) - - - ! this code block controls the addition of N to sminn pool - ! to eliminate any N limitation, when Carbon_Only is set. This lets the - ! model behave essentially as a carbon-only model, but with the - ! benefit of keeping track of the N additions needed to - ! eliminate N limitations, so there is still a diagnostic quantity - ! that describes the degree of N limitation at steady-state. - - if ( cnallocate_carbon_only()) then !.or. & - if ( fpi_no3_vr(c,j) + fpi_nh4_vr(c,j) < 1._r8 ) then - fpi_nh4_vr(c,j) = 1.0_r8 - fpi_no3_vr(c,j) - supplement_to_sminn_vr(c,j) = (potential_immob_vr(c,j) & - - actual_immob_no3_vr(c,j)) - actual_immob_nh4_vr(c,j) - ! update to new values that satisfy demand - actual_immob_nh4_vr(c,j) = potential_immob_vr(c,j) - actual_immob_no3_vr(c,j) - end if - if ( smin_no3_to_plant_vr(c,j) + smin_nh4_to_plant_vr(c,j) < plant_ndemand(c)*nuptake_prof(c,j) ) then - supplement_to_sminn_vr(c,j) = supplement_to_sminn_vr(c,j) + & - (plant_ndemand(c)*nuptake_prof(c,j) - smin_no3_to_plant_vr(c,j)) - smin_nh4_to_plant_vr(c,j) ! use old values - smin_nh4_to_plant_vr(c,j) = plant_ndemand(c)*nuptake_prof(c,j) - smin_no3_to_plant_vr(c,j) - end if - sminn_to_plant_vr(c,j) = smin_no3_to_plant_vr(c,j) + smin_nh4_to_plant_vr(c,j) - end if - - ! sum up no3 and nh4 fluxes - fpi_vr(c,j) = fpi_no3_vr(c,j) + fpi_nh4_vr(c,j) - sminn_to_plant_vr(c,j) = smin_no3_to_plant_vr(c,j) + smin_nh4_to_plant_vr(c,j) - actual_immob_vr(c,j) = actual_immob_no3_vr(c,j) + actual_immob_nh4_vr(c,j) - end do - end do - - if ( local_use_fun ) then - call t_startf( 'CNFUN' ) - call CNFUN(bounds,num_soilc,filter_soilc,num_soilp,filter_soilp,waterstate_inst ,& - waterflux_inst,temperature_inst,soilstate_inst,cnveg_state_inst,cnveg_carbonstate_inst,& - cnveg_carbonflux_inst,cnveg_nitrogenstate_inst,cnveg_nitrogenflux_inst ,& - soilbiogeochem_nitrogenflux_inst,soilbiogeochem_carbonflux_inst,canopystate_inst, & - soilbiogeochem_nitrogenstate_inst) - - ! sminn_to_plant_fun is output of actual N uptake from FUN - call p2c_2d(bounds,nlevdecomp, & - cnveg_nitrogenflux_inst%sminn_to_plant_fun_no3_vr_patch(bounds%begp:bounds%endp,1:nlevdecomp),& - soilbiogeochem_nitrogenflux_inst%sminn_to_plant_fun_no3_vr_col(bounds%begc:bounds%endc,1:nlevdecomp),& - 'unity') - - call p2c_2d(bounds,nlevdecomp, & - cnveg_nitrogenflux_inst%sminn_to_plant_fun_nh4_vr_patch(bounds%begp:bounds%endp,1:nlevdecomp),& - soilbiogeochem_nitrogenflux_inst%sminn_to_plant_fun_nh4_vr_col(bounds%begc:bounds%endc,1:nlevdecomp),& - 'unity') - call t_stopf( 'CNFUN' ) - end if - - - - if(.not.local_use_fun)then - do fc=1,num_soilc - c = filter_soilc(fc) - ! sum up N fluxes to plant after initial competition - sminn_to_plant(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = sminn_to_plant(c) + sminn_to_plant_vr(c,j) * dzsoi_decomp(j) - end do - end do - else - do fc=1,num_soilc - c = filter_soilc(fc) - ! sum up N fluxes to plant after initial competition - sminn_to_plant(c) = 0._r8 !this isn't use in fun. - do j = 1, nlevdecomp - if ((sminn_to_plant_fun_no3_vr(c,j)-smin_no3_to_plant_vr(c,j)).gt.0.0000000000001_r8) then - write(iulog,*) 'problem with limitations on no3 uptake', & - sminn_to_plant_fun_no3_vr(c,j),smin_no3_to_plant_vr(c,j) - call endrun("too much NO3 uptake predicted by FUN") - end if -!KO if ((sminn_to_plant_fun_nh4_vr(c,j)-smin_nh4_to_plant_vr(c,j)).gt.0.0000000000001_r8) then -!KO - if ((sminn_to_plant_fun_nh4_vr(c,j)-smin_nh4_to_plant_vr(c,j)).gt.0.0000001_r8) then -!KO - write(iulog,*) 'problem with limitations on nh4 uptake', & - sminn_to_plant_fun_nh4_vr(c,j),smin_nh4_to_plant_vr(c,j) - call endrun("too much NH4 uptake predicted by FUN") - end if - end do - end do - - end if - - if(.not.local_use_fun)then - ! give plants a second pass to see if there is any mineral N left over with which to satisfy residual N demand. - ! first take frm nh4 pool; then take from no3 pool - do fc=1,num_soilc - c = filter_soilc(fc) - residual_plant_ndemand(c) = plant_ndemand(c) - sminn_to_plant(c) - residual_smin_nh4(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if (residual_plant_ndemand(c) > 0._r8 ) then - if (nlimit_nh4(c,j) .eq. 0) then - residual_smin_nh4_vr(c,j) = max(smin_nh4_vr(c,j) - (actual_immob_nh4_vr(c,j) + & - smin_nh4_to_plant_vr(c,j) + f_nit_vr(c,j) ) * dt, 0._r8) - - residual_smin_nh4(c) = residual_smin_nh4(c) + residual_smin_nh4_vr(c,j) * dzsoi_decomp(j) - else - residual_smin_nh4_vr(c,j) = 0._r8 - endif - - if ( residual_smin_nh4(c) > 0._r8 .and. nlimit_nh4(c,j) .eq. 0 ) then - smin_nh4_to_plant_vr(c,j) = smin_nh4_to_plant_vr(c,j) + residual_smin_nh4_vr(c,j) * & - min(( residual_plant_ndemand(c) * dt ) / residual_smin_nh4(c), 1._r8) / dt - endif - end if - end do - end do - - ! re-sum up N fluxes to plant after second pass for nh4 - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant_vr(c,j) = smin_nh4_to_plant_vr(c,j) + smin_no3_to_plant_vr(c,j) - sminn_to_plant(c) = sminn_to_plant(c) + (sminn_to_plant_vr(c,j)) * dzsoi_decomp(j) - end do - end do - - ! - ! and now do second pass for no3 - do fc=1,num_soilc - c = filter_soilc(fc) - residual_plant_ndemand(c) = plant_ndemand(c) - sminn_to_plant(c) - residual_smin_no3(c) = 0._r8 - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if (residual_plant_ndemand(c) > 0._r8 ) then - if (nlimit_no3(c,j) .eq. 0) then - residual_smin_no3_vr(c,j) = max(smin_no3_vr(c,j) - (actual_immob_no3_vr(c,j) + & - smin_no3_to_plant_vr(c,j) + f_denit_vr(c,j) ) * dt, 0._r8) - residual_smin_no3(c) = residual_smin_no3(c) + residual_smin_no3_vr(c,j) * dzsoi_decomp(j) - else - residual_smin_no3_vr(c,j) = 0._r8 - endif - - if ( residual_smin_no3(c) > 0._r8 .and. nlimit_no3(c,j) .eq. 0) then - smin_no3_to_plant_vr(c,j) = smin_no3_to_plant_vr(c,j) + residual_smin_no3_vr(c,j) * & - min(( residual_plant_ndemand(c) * dt ) / residual_smin_no3(c), 1._r8) / dt - endif - endif - end do - end do - - ! re-sum up N fluxes to plant after second passes of both no3 and nh4 - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant_vr(c,j) = smin_nh4_to_plant_vr(c,j) + smin_no3_to_plant_vr(c,j) - sminn_to_plant(c) = sminn_to_plant(c) + (sminn_to_plant_vr(c,j)) * dzsoi_decomp(j) - end do - end do - - else !use_fun - !calculate maximum N available to plants. - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant_vr(c,j) = smin_nh4_to_plant_vr(c,j) + smin_no3_to_plant_vr(c,j) - sminn_to_plant(c) = sminn_to_plant(c) + (sminn_to_plant_vr(c,j)) * dzsoi_decomp(j) - end do - end do - - - ! add up fun fluxes from SMINN to plant. - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_to_plant_new(c) = sminn_to_plant_new(c) + & - (sminn_to_plant_fun_no3_vr(c,j) + sminn_to_plant_fun_nh4_vr(c,j)) * dzsoi_decomp(j) - - end do - end do - - - end if !use_f - ! sum up N fluxes to immobilization - do fc=1,num_soilc - c = filter_soilc(fc) - actual_immob(c) = 0._r8 - potential_immob(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - actual_immob(c) = actual_immob(c) + actual_immob_vr(c,j) * dzsoi_decomp(j) - potential_immob(c) = potential_immob(c) + potential_immob_vr(c,j) * dzsoi_decomp(j) - end do - end do - - - - - do fc=1,num_soilc - c = filter_soilc(fc) - ! calculate the fraction of potential growth that can be - ! acheived with the N available to plants - ! calculate the fraction of immobilization realized (for diagnostic purposes) - if(.not.local_use_fun)then !FUN has no concept of FPG. - - if (plant_ndemand(c) > 0.0_r8) then - fpg(c) = sminn_to_plant(c) / plant_ndemand(c) - else - fpg(c) = 1._r8 - end if - end if - - if (potential_immob(c) > 0.0_r8) then - fpi(c) = actual_immob(c) / potential_immob(c) - else - fpi(c) = 1._r8 - end if - end do ! end of column loops - - end if !end of if_not_use_nitrif_denitrif - - end associate - - end subroutine SoilBiogeochemCompetition - -end module SoilBiogeochemCompetitionMod diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 deleted file mode 100644 index 6098e9d120..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeBGCMod.F90 +++ /dev/null @@ -1,1120 +0,0 @@ -module SoilBiogeochemDecompCascadeBGCMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Sets the coeffiecients used in the decomposition cascade submodel. - ! This uses the CENTURY/BGC parameters - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevsoi, nlevgrnd, nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog, spinup_state, anoxia, use_lch4, use_vertsoilc, use_fates - use clm_varcon , only : zsoi - use decompMod , only : bounds_type - use spmdMod , only : masterproc - use abortutils , only : endrun - use CNSharedParamsMod , only : CNParamsShareInst, anoxia_wtsat, nlev_soildecomp_standard - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use ch4Mod , only : ch4_type - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: DecompCascadeBGCreadNML ! Read in namelist - public :: readParams ! Read in parameters from params file - public :: init_decompcascade_bgc ! Initialization - public :: decomp_rate_constants_bgc ! Figure out decomposition rates - ! - ! !PUBLIC DATA MEMBERS - logical , public :: normalize_q10_to_century_tfunc = .true.! do we normalize the century decomp. rates so that they match the CLM Q10 at a given tep? - logical , public :: use_century_tfunc = .false. - real(r8), public :: normalization_tref = 15._r8 ! reference temperature for normalizaion (degrees C) - ! - ! !PRIVATE DATA MEMBERS - - integer, private :: i_soil1 = -9 ! Soil Organic Matter (SOM) first pool - integer, private :: i_soil2 = -9 ! SOM second pool - integer, private :: i_soil3 = -9 ! SOM third pool - integer, private, parameter :: nsompools = 3 ! Number of SOM pools - integer, private, parameter :: i_litr1 = i_met_lit ! First litter pool, metobolic - integer, private, parameter :: i_litr2 = i_cel_lit ! Second litter pool, cellulose - integer, private, parameter :: i_litr3 = i_lig_lit ! Third litter pool, lignin - - type, private :: params_type - real(r8):: cn_s1_bgc !C:N for SOM 1 - real(r8):: cn_s2_bgc !C:N for SOM 2 - real(r8):: cn_s3_bgc !C:N for SOM 3 - - real(r8):: rf_l1s1_bgc !respiration fraction litter 1 -> SOM 1 - real(r8):: rf_l2s1_bgc - real(r8):: rf_l3s2_bgc - - real(r8):: rf_s2s1_bgc - real(r8):: rf_s2s3_bgc - real(r8):: rf_s3s1_bgc - - real(r8):: rf_cwdl2_bgc - real(r8):: rf_cwdl3_bgc - - real(r8):: tau_l1_bgc ! turnover time of litter 1 (yr) - real(r8):: tau_l2_l3_bgc ! turnover time of litter 2 and litter 3 (yr) - real(r8):: tau_s1_bgc ! turnover time of SOM 1 (yr) - real(r8):: tau_s2_bgc ! turnover time of SOM 2 (yr) - real(r8):: tau_s3_bgc ! turnover time of SOM 3 (yr) - real(r8):: tau_cwd_bgc ! corrected fragmentation rate constant CWD - - real(r8) :: cwd_fcel_bgc !cellulose fraction for CWD - real(r8) :: cwd_flig_bgc ! - - real(r8) :: k_frag_bgc !fragmentation rate for CWD - real(r8) :: minpsi_bgc !minimum soil water potential for heterotrophic resp - real(r8) :: maxpsi_bgc !maximum soil water potential for heterotrophic resp - - real(r8) :: initial_Cstocks(nsompools) ! Initial Carbon stocks for a cold-start - real(r8) :: initial_Cstocks_depth ! Soil depth for initial Carbon stocks for a cold-start - - end type params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine DecompCascadeBGCreadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for soil BGC Decomposition Cascade - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'DecompCascadeBGCreadNML' - character(len=*), parameter :: nmlname = 'CENTURY_soilBGCDecompCascade' - !----------------------------------------------------------------------- - real(r8) :: initial_Cstocks(nsompools), initial_Cstocks_depth - namelist /CENTURY_soilBGCDecompCascade/ initial_Cstocks, initial_Cstocks_depth - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - initial_Cstocks(:) = 200._r8 - initial_Cstocks_depth = 0.3 - - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=CENTURY_soilBGCDecompCascade, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(__FILE__, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (initial_Cstocks , mpicom) - call shr_mpi_bcast (initial_Cstocks_depth, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=CENTURY_soilBGCDecompCascade) - write(iulog,*) ' ' - end if - - params_inst%initial_Cstocks(:) = initial_Cstocks(:) - params_inst%initial_Cstocks_depth = initial_Cstocks_depth - - end subroutine DecompCascadeBGCreadNML - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNDecompBgcParamsType' - character(len=100) :: errCode = 'Error reading in CN const file ' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - ! Read off of netcdf file - tString='tau_l1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_l1_bgc=tempr - - tString='tau_l2_l3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_l2_l3_bgc=tempr - - tString='tau_s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_s1_bgc=tempr - - tString='tau_s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_s2_bgc=tempr - - tString='tau_s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_s3_bgc=tempr - - tString='tau_cwd' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%tau_cwd_bgc=tempr - - tString='cn_s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s1_bgc=tempr - - tString='cn_s2_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s2_bgc=tempr - - tString='cn_s3_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s3_bgc=tempr - - tString='rf_l1s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l1s1_bgc=tempr - - tString='rf_l2s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l2s1_bgc=tempr - - tString='rf_l3s2_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l3s2_bgc=tempr - - tString='rf_s2s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s2s1_bgc=tempr - - tString='rf_s2s3_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s2s3_bgc=tempr - - tString='rf_s3s1_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s3s1_bgc=tempr - - tString='rf_cwdl2_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_cwdl2_bgc=tempr - - tString='rf_cwdl3_bgc' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_cwdl3_bgc=tempr - - tString='cwd_fcel' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_fcel_bgc=tempr - - tString='k_frag' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_frag_bgc=tempr - - tString='minpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%minpsi_bgc=tempr - - tString='maxpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%maxpsi_bgc=tempr - - tString='cwd_flig' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_flig_bgc=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine init_decompcascade_bgc(bounds, soilbiogeochem_state_inst, soilstate_inst ) - ! - ! !DESCRIPTION: - ! initialize rate constants and decomposition pathways following the decomposition cascade of the BGC model. - ! written by C. Koven - ! - ! !USES: - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilstate_type) , intent(in) :: soilstate_inst - ! - ! !LOCAL VARIABLES - !-- properties of each decomposing pool - real(r8) :: rf_l1s1 - real(r8) :: rf_l2s1 - real(r8) :: rf_l3s2 - !real(r8) :: rf_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - !real(r8) :: rf_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8), allocatable :: rf_s1s2(:,:) - real(r8), allocatable :: rf_s1s3(:,:) - real(r8) :: rf_s2s1 - real(r8) :: rf_s2s3 - real(r8) :: rf_s3s1 - real(r8) :: rf_cwdl2 - real(r8) :: rf_cwdl3 - real(r8) :: cwd_fcel - real(r8) :: cwd_flig - real(r8) :: cn_s1 - real(r8) :: cn_s2 - real(r8) :: cn_s3 - !real(r8) :: f_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - !real(r8) :: f_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8), allocatable :: f_s1s2(:,:) - real(r8), allocatable :: f_s1s3(:,:) - real(r8) :: f_s2s1 - real(r8) :: f_s2s3 - - integer :: i_l1s1 - integer :: i_l2s1 - integer :: i_l3s2 - integer :: i_s1s2 - integer :: i_s1s3 - integer :: i_s2s1 - integer :: i_s2s3 - integer :: i_s3s1 - integer :: i_cwdl2 - integer :: i_cwdl3 - real(r8):: speedup_fac ! acceleration factor, higher when vertsoilc = .true. - - integer :: c, j ! indices - real(r8) :: t ! temporary variable - !----------------------------------------------------------------------- - - associate( & - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - cellsand => soilstate_inst%cellsand_col , & ! Input: [real(r8) (:,:) ] column 3D sand - - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Output: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Output: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Output: [logical (:) ] TRUE => pool has fixed C:N ratio - is_litter => decomp_cascade_con%is_litter , & ! Output: [logical (:) ] TRUE => pool is a litter pool - is_soil => decomp_cascade_con%is_soil , & ! Output: [logical (:) ] TRUE => pool is a soil pool - is_cwd => decomp_cascade_con%is_cwd , & ! Output: [logical (:) ] TRUE => pool is a cwd pool - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Output: [real(r8) (:) ] c:n ratio for initialization of pools - initial_stock => decomp_cascade_con%initial_stock , & ! Output: [real(r8) (:) ] initial concentration for seeding at spinup - initial_stock_soildepth => decomp_cascade_con%initial_stock_soildepth , & ! Output: [real(r8) (:) ] soil depth for initial concentration for seeding at spinup - is_metabolic => decomp_cascade_con%is_metabolic , & ! Output: [logical (:) ] TRUE => pool is metabolic material - is_cellulose => decomp_cascade_con%is_cellulose , & ! Output: [logical (:) ] TRUE => pool is cellulose - is_lignin => decomp_cascade_con%is_lignin , & ! Output: [logical (:) ] TRUE => pool is lignin - spinup_factor => decomp_cascade_con%spinup_factor & ! Output: [real(r8) (:) ] factor for AD spinup associated with each pool - - ) - - allocate(rf_s1s2(bounds%begc:bounds%endc,1:nlevdecomp)) - allocate(rf_s1s3(bounds%begc:bounds%endc,1:nlevdecomp)) - allocate(f_s1s2(bounds%begc:bounds%endc,1:nlevdecomp)) - allocate(f_s1s3(bounds%begc:bounds%endc,1:nlevdecomp)) - - !------- time-constant coefficients ---------- ! - ! set soil organic matter compartment C:N ratios - cn_s1 = params_inst%cn_s1_bgc - cn_s2 = params_inst%cn_s2_bgc - cn_s3 = params_inst%cn_s3_bgc - - ! set respiration fractions for fluxes between compartments - rf_l1s1 = params_inst%rf_l1s1_bgc - rf_l2s1 = params_inst%rf_l2s1_bgc - rf_l3s2 = params_inst%rf_l3s2_bgc - rf_s2s1 = params_inst%rf_s2s1_bgc - rf_s2s3 = params_inst%rf_s2s3_bgc - rf_s3s1 = params_inst%rf_s3s1_bgc - - rf_cwdl2 = params_inst%rf_cwdl2_bgc - rf_cwdl3 = params_inst%rf_cwdl3_bgc - - ! set the cellulose and lignin fractions for coarse woody debris - cwd_fcel = params_inst%cwd_fcel_bgc - cwd_flig = params_inst%cwd_flig_bgc - - ! set path fractions - f_s2s1 = 0.42_r8/(0.45_r8) - f_s2s3 = 0.03_r8/(0.45_r8) - - ! some of these are dependent on the soil texture properties - do c = bounds%begc, bounds%endc - do j = 1, nlevdecomp - t = 0.85_r8 - 0.68_r8 * 0.01_r8 * (100._r8 - cellsand(c,j)) - f_s1s2(c,j) = 1._r8 - .004_r8 / (1._r8 - t) - f_s1s3(c,j) = .004_r8 / (1._r8 - t) - rf_s1s2(c,j) = t - rf_s1s3(c,j) = t - end do - end do - initial_stock_soildepth = params_inst%initial_Cstocks_depth - - !------------------- list of pools and their attributes ------------ - floating_cn_ratio_decomp_pools(i_litr1) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_litr1) = 'litr1' - decomp_cascade_con%decomp_pool_name_history(i_litr1) = 'LITR1' - decomp_cascade_con%decomp_pool_name_long(i_litr1) = 'litter 1' - decomp_cascade_con%decomp_pool_name_short(i_litr1) = 'L1' - is_litter(i_litr1) = .true. - is_soil(i_litr1) = .false. - is_cwd(i_litr1) = .false. - initial_cn_ratio(i_litr1) = 90._r8 - initial_stock(i_litr1) = 0._r8 - is_metabolic(i_litr1) = .true. - is_cellulose(i_litr1) = .false. - is_lignin(i_litr1) = .false. - - floating_cn_ratio_decomp_pools(i_litr2) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_litr2) = 'litr2' - decomp_cascade_con%decomp_pool_name_history(i_litr2) = 'LITR2' - decomp_cascade_con%decomp_pool_name_long(i_litr2) = 'litter 2' - decomp_cascade_con%decomp_pool_name_short(i_litr2) = 'L2' - is_litter(i_litr2) = .true. - is_soil(i_litr2) = .false. - is_cwd(i_litr2) = .false. - initial_cn_ratio(i_litr2) = 90._r8 - initial_stock(i_litr2) = 0._r8 - is_metabolic(i_litr2) = .false. - is_cellulose(i_litr2) = .true. - is_lignin(i_litr2) = .false. - - floating_cn_ratio_decomp_pools(i_litr3) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_litr3) = 'litr3' - decomp_cascade_con%decomp_pool_name_history(i_litr3) = 'LITR3' - decomp_cascade_con%decomp_pool_name_long(i_litr3) = 'litter 3' - decomp_cascade_con%decomp_pool_name_short(i_litr3) = 'L3' - is_litter(i_litr3) = .true. - is_soil(i_litr3) = .false. - is_cwd(i_litr3) = .false. - initial_cn_ratio(i_litr3) = 90._r8 - initial_stock(i_litr3) = 0._r8 - is_metabolic(i_litr3) = .false. - is_cellulose(i_litr3) = .false. - is_lignin(i_litr3) = .true. - - if (.not. use_fates) then - ! CWD - floating_cn_ratio_decomp_pools(i_cwd) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_cwd) = 'cwd' - decomp_cascade_con%decomp_pool_name_history(i_cwd) = 'CWD' - decomp_cascade_con%decomp_pool_name_long(i_cwd) = 'coarse woody debris' - decomp_cascade_con%decomp_pool_name_short(i_cwd) = 'CWD' - is_litter(i_cwd) = .false. - is_soil(i_cwd) = .false. - is_cwd(i_cwd) = .true. - initial_cn_ratio(i_cwd) = 90._r8 - initial_stock(i_cwd) = 0._r8 - is_metabolic(i_cwd) = .false. - is_cellulose(i_cwd) = .false. - is_lignin(i_cwd) = .false. - endif - - if (.not. use_fates) then - i_soil1 = 5 - else - i_soil1 = 4 - endif - floating_cn_ratio_decomp_pools(i_soil1) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil1) = 'soil1' - decomp_cascade_con%decomp_pool_name_history(i_soil1) = 'SOIL1' - decomp_cascade_con%decomp_pool_name_long(i_soil1) = 'soil 1' - decomp_cascade_con%decomp_pool_name_short(i_soil1) = 'S1' - is_litter(i_soil1) = .false. - is_soil(i_soil1) = .true. - is_cwd(i_soil1) = .false. - initial_cn_ratio(i_soil1) = cn_s1 - initial_stock(i_soil1) = params_inst%initial_Cstocks(1) - is_metabolic(i_soil1) = .false. - is_cellulose(i_soil1) = .false. - is_lignin(i_soil1) = .false. - - if (.not. use_fates) then - i_soil2 = 6 - else - i_soil2 = 5 - endif - floating_cn_ratio_decomp_pools(i_soil2) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil2) = 'soil2' - decomp_cascade_con%decomp_pool_name_history(i_soil2) = 'SOIL2' - decomp_cascade_con%decomp_pool_name_long(i_soil2) = 'soil 2' - decomp_cascade_con%decomp_pool_name_short(i_soil2) = 'S2' - is_litter(i_soil2) = .false. - is_soil(i_soil2) = .true. - is_cwd(i_soil2) = .false. - initial_cn_ratio(i_soil2) = cn_s2 - initial_stock(i_soil2) = params_inst%initial_Cstocks(2) - is_metabolic(i_soil2) = .false. - is_cellulose(i_soil2) = .false. - is_lignin(i_soil2) = .false. - - if (.not. use_fates) then - i_soil3 = 7 - else - i_soil3 = 6 - endif - floating_cn_ratio_decomp_pools(i_soil3) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil3) = 'soil3' - decomp_cascade_con%decomp_pool_name_history(i_soil3) = 'SOIL3' - decomp_cascade_con%decomp_pool_name_long(i_soil3) = 'soil 3' - decomp_cascade_con%decomp_pool_name_short(i_soil3) = 'S3' - is_litter(i_soil3) = .false. - is_soil(i_soil3) = .true. - is_cwd(i_soil3) = .false. - initial_cn_ratio(i_soil3) = cn_s3 - initial_stock(i_soil3) = params_inst%initial_Cstocks(3) - is_metabolic(i_soil3) = .false. - is_cellulose(i_soil3) = .false. - is_lignin(i_soil3) = .false. - - - speedup_fac = 1._r8 - - !lit1 - spinup_factor(i_litr1) = 1._r8 - !lit2,3 - spinup_factor(i_litr2) = 1._r8 - spinup_factor(i_litr3) = 1._r8 - !CWD - if (.not. use_fates) then - spinup_factor(i_cwd) = max(1._r8, (speedup_fac * params_inst%tau_cwd_bgc / 2._r8 )) - end if - !som1 - spinup_factor(i_soil1) = 1._r8 - !som2,3 - spinup_factor(i_soil2) = max(1._r8, (speedup_fac * params_inst%tau_s2_bgc)) - spinup_factor(i_soil3) = max(1._r8, (speedup_fac * params_inst%tau_s3_bgc)) - - if ( masterproc ) then - write(iulog,*) 'Spinup_state ',spinup_state - write(iulog,*) 'Spinup factors ',spinup_factor - end if - - !---------------- list of transitions and their time-independent coefficients ---------------! - i_l1s1 = 1 - decomp_cascade_con%cascade_step_name(i_l1s1) = 'L1S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = rf_l1s1 - cascade_donor_pool(i_l1s1) = i_litr1 - cascade_receiver_pool(i_l1s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = 1.0_r8 - - i_l2s1 = 2 - decomp_cascade_con%cascade_step_name(i_l2s1) = 'L2S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s1) = rf_l2s1 - cascade_donor_pool(i_l2s1) = i_litr2 - cascade_receiver_pool(i_l2s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s1)= 1.0_r8 - - i_l3s2 = 3 - decomp_cascade_con%cascade_step_name(i_l3s2) = 'L3S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s2) = rf_l3s2 - cascade_donor_pool(i_l3s2) = i_litr3 - cascade_receiver_pool(i_l3s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s2) = 1.0_r8 - - i_s1s2 = 4 - decomp_cascade_con%cascade_step_name(i_s1s2) = 'S1S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = rf_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - cascade_donor_pool(i_s1s2) = i_soil1 - cascade_receiver_pool(i_s1s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = f_s1s2(bounds%begc:bounds%endc,1:nlevdecomp) - - i_s1s3 = 5 - decomp_cascade_con%cascade_step_name(i_s1s3) = 'S1S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s3) = rf_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - cascade_donor_pool(i_s1s3) = i_soil1 - cascade_receiver_pool(i_s1s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s3) = f_s1s3(bounds%begc:bounds%endc,1:nlevdecomp) - - i_s2s1 = 6 - decomp_cascade_con%cascade_step_name(i_s2s1) = 'S2S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s1) = rf_s2s1 - cascade_donor_pool(i_s2s1) = i_soil2 - cascade_receiver_pool(i_s2s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s1) = f_s2s1 - - i_s2s3 = 7 - decomp_cascade_con%cascade_step_name(i_s2s3) = 'S2S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = rf_s2s3 - cascade_donor_pool(i_s2s3) = i_soil2 - cascade_receiver_pool(i_s2s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = f_s2s3 - - i_s3s1 = 8 - decomp_cascade_con%cascade_step_name(i_s3s1) = 'S3S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s1) = rf_s3s1 - cascade_donor_pool(i_s3s1) = i_soil3 - cascade_receiver_pool(i_s3s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s1) = 1.0_r8 - - if (.not. use_fates) then - i_cwdl2 = 9 - decomp_cascade_con%cascade_step_name(i_cwdl2) = 'CWDL2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = rf_cwdl2 - cascade_donor_pool(i_cwdl2) = i_cwd - cascade_receiver_pool(i_cwdl2) = i_litr2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = cwd_fcel - - i_cwdl3 = 10 - decomp_cascade_con%cascade_step_name(i_cwdl3) = 'CWDL3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = rf_cwdl3 - cascade_donor_pool(i_cwdl3) = i_cwd - cascade_receiver_pool(i_cwdl3) = i_litr3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = cwd_flig - end if - - deallocate(rf_s1s2) - deallocate(rf_s1s3) - deallocate(f_s1s2) - deallocate(f_s1s3) - - end associate - - end subroutine init_decompcascade_bgc - - !----------------------------------------------------------------------- - subroutine decomp_rate_constants_bgc(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - ! - ! !DESCRIPTION: - ! calculate rate constants and decomposition pathways for the CENTURY decomposition cascade model - ! written by C. Koven based on original CLM4 decomposition cascade - ! - ! !USES: - use clm_time_manager , only : get_days_per_year - use shr_const_mod , only : SHR_CONST_PI - use clm_varcon , only : secspday - ! - ! !ARGUMENTS: - 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 - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(ch4_type) , intent(in) :: ch4_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - ! - ! !LOCAL VARIABLES: - real(r8):: frw(bounds%begc:bounds%endc) ! rooting fraction weight - real(r8), allocatable:: fr(:,:) ! column-level rooting fraction by soil depth - real(r8):: psi ! temporary soilpsi for water scalar - real(r8):: rate_scalar ! combined rate scalar for decomp - real(r8):: k_l1 ! decomposition rate constant litter 1 (1/sec) - real(r8):: k_l2_l3 ! decomposition rate constant litter 2 and litter 3 (1/sec) - real(r8):: k_s1 ! decomposition rate constant SOM 1 (1/sec) - real(r8):: k_s2 ! decomposition rate constant SOM 2 (1/sec) - real(r8):: k_s3 ! decomposition rate constant SOM 3 (1/sec) - real(r8):: k_frag ! fragmentation rate constant CWD (1/sec) - real(r8):: tau_l1 ! turnover time of litter 1 (yr) - real(r8):: tau_l2_l3 ! turnover time of litter 2 and litter 3 (yr) - real(r8):: tau_l3 ! turnover time of litter 3 (yr) - real(r8):: tau_s1 ! turnover time of SOM 1 (yr) - real(r8):: tau_s2 ! turnover time of SOM 2 (yr) - real(r8):: tau_s3 ! turnover time of SOM 3 (yr) - real(r8):: tau_cwd ! corrected fragmentation rate constant CWD - real(r8):: cwdc_loss ! fragmentation rate for CWD carbon (gC/m2/s) - real(r8):: cwdn_loss ! fragmentation rate for CWD nitrogen (gN/m2/s) - real(r8):: Q10 ! temperature dependence - real(r8):: froz_q10 ! separate q10 for frozen soil respiration rates. default to same as above zero rates - real(r8):: decomp_depth_efolding ! (meters) e-folding depth for reduction in decomposition [ - integer :: c, fc, j, k, l - real(r8):: catanf ! hyperbolic temperature function from CENTURY - real(r8):: catanf_30 ! reference rate at 30C - real(r8):: t1 ! temperature argument - real(r8):: normalization_factor ! factor by which to offset the decomposition rates frm century to a q10 formulation - real(r8):: days_per_year ! days per year - real(r8):: depth_scalar(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8):: mino2lim !minimum anaerobic decomposition rate - real(r8):: spinup_geogterm_l1(bounds%begc:bounds%endc) ! geographically-varying spinup term for l1 - real(r8):: spinup_geogterm_l23(bounds%begc:bounds%endc) ! geographically-varying spinup term for l2 and l3 - real(r8):: spinup_geogterm_cwd(bounds%begc:bounds%endc) ! geographically-varying spinup term for cwd - real(r8):: spinup_geogterm_s1(bounds%begc:bounds%endc) ! geographically-varying spinup term for s1 - real(r8):: spinup_geogterm_s2(bounds%begc:bounds%endc) ! geographically-varying spinup term for s2 - real(r8):: spinup_geogterm_s3(bounds%begc:bounds%endc) ! geographically-varying spinup term for s3 - - !----------------------------------------------------------------------- - - !----- CENTURY T response function - catanf(t1) = 11.75_r8 +(29.7_r8 / SHR_CONST_PI) * atan( SHR_CONST_PI * 0.031_r8 * ( t1 - 15.4_r8 )) - - associate( & - minpsi => params_inst%minpsi_bgc , & ! Input: [real(r8) ] minimum soil suction (mm) - maxpsi => params_inst%maxpsi_bgc , & ! Input: [real(r8) ] maximum soil suction (mm) - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - alt_indx => canopystate_inst%alt_indx_col , & ! Input: [integer (:) ] current depth of thaw - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - o2stress_sat => ch4_inst%o2stress_sat_col , & ! Input: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - o2stress_unsat => ch4_inst%o2stress_unsat_col , & ! Input: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area - - t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col , & ! Output: [real(r8) (:,:) ] soil temperature scalar for decomp - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Output: [real(r8) (:,:) ] soil water scalar for decomp - o_scalar => soilbiogeochem_carbonflux_inst%o_scalar_col , & ! Output: [real(r8) (:,:) ] fraction by which decomposition is limited by anoxia - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col , & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - spinup_factor => decomp_cascade_con%spinup_factor & ! Input: [real(r8) (:) ] factor for AD spinup associated with each pool - ) - - mino2lim = CNParamsShareInst%mino2lim - - if ( use_century_tfunc .and. normalize_q10_to_century_tfunc ) then - call endrun(msg='ERROR: cannot have both use_century_tfunc and normalize_q10_to_century_tfunc set as true'//& - errMsg(sourcefile, __LINE__)) - endif - - days_per_year = get_days_per_year() - - ! the belowground parameters from century - tau_l1 = 1./18.5 - tau_l2_l3 = 1./4.9 - tau_s1 = 1./7.3 - tau_s2 = 1./0.2 - tau_s3 = 1./.0045 - - ! century leaves wood decomposition rates open, within range of 0 - 0.5 yr^-1 - tau_cwd = 1./0.3 - - ! Todo: FIX(SPM,032414) - the explicit divide gives different results than when that - ! value is placed in the parameters netcdf file. To get bfb, keep the - ! divide in source. - - !tau_l1 = params_inst%tau_l1_bgc - !tau_l2_l3 = params_inst%tau_l2_l3_bgc - !tau_s1 = params_inst%tau_s1_bgc - !tau_s2 = params_inst%tau_s2_bgc - !tau_s3 = params_inst%tau_s3_bgc - - !set turnover rate of coarse woody debris - !tau_cwd = params_inst%tau_cwd_bgc - - ! set "Q10" parameter - Q10 = CNParamsShareInst%Q10 - - ! set "froz_q10" parameter - froz_q10 = CNParamsShareInst%froz_q10 - - ! Set "decomp_depth_efolding" parameter - decomp_depth_efolding = CNParamsShareInst%decomp_depth_efolding - - ! translate to per-second time constant - k_l1 = 1._r8 / (secspday * days_per_year * tau_l1) - k_l2_l3 = 1._r8 / (secspday * days_per_year * tau_l2_l3) - k_s1 = 1._r8 / (secspday * days_per_year * tau_s1) - k_s2 = 1._r8 / (secspday * days_per_year * tau_s2) - k_s3 = 1._r8 / (secspday * days_per_year * tau_s3) - k_frag = 1._r8 / (secspday * days_per_year * tau_cwd) - - ! calc ref rate - catanf_30 = catanf(30._r8) - - if ( spinup_state >= 1 ) then - do fc = 1,num_soilc - c = filter_soilc(fc) - ! - if ( abs(spinup_factor(i_litr1) - 1._r8) .gt. .000001_r8) then - spinup_geogterm_l1(c) = spinup_factor(i_litr1) * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - spinup_geogterm_l1(c) = 1._r8 - endif - ! - if ( abs(spinup_factor(i_litr2) - 1._r8) .gt. .000001_r8) then - spinup_geogterm_l23(c) = spinup_factor(i_litr2) * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - spinup_geogterm_l23(c) = 1._r8 - endif - ! - if ( .not. use_fates ) then - if ( abs(spinup_factor(i_cwd) - 1._r8) .gt. .000001_r8) then - spinup_geogterm_cwd(c) = spinup_factor(i_cwd) * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - spinup_geogterm_cwd(c) = 1._r8 - endif - endif - ! - if ( abs(spinup_factor(i_soil1) - 1._r8) .gt. .000001_r8) then - spinup_geogterm_s1(c) = spinup_factor(i_soil1) * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - spinup_geogterm_s1(c) = 1._r8 - endif - ! - if ( abs(spinup_factor(i_soil2) - 1._r8) .gt. .000001_r8) then - spinup_geogterm_s2(c) = spinup_factor(i_soil2) * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - spinup_geogterm_s2(c) = 1._r8 - endif - ! - if ( abs(spinup_factor(i_soil3) - 1._r8) .gt. .000001_r8) then - spinup_geogterm_s3(c) = spinup_factor(i_soil3) * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - spinup_geogterm_s3(c) = 1._r8 - endif - ! - end do - else - do fc = 1,num_soilc - c = filter_soilc(fc) - spinup_geogterm_l1(c) = 1._r8 - spinup_geogterm_l23(c) = 1._r8 - spinup_geogterm_cwd(c) = 1._r8 - spinup_geogterm_s1(c) = 1._r8 - spinup_geogterm_s2(c) = 1._r8 - spinup_geogterm_s3(c) = 1._r8 - end do - endif - - !--- time dependent coefficients-----! - if ( nlevdecomp .eq. 1 ) then - - ! calculate function to weight the temperature and water potential scalars - ! for decomposition control. - - - ! the following normalizes values in fr so that they - ! sum to 1.0 across top nlevdecomp levels on a column - frw(bounds%begc:bounds%endc) = 0._r8 - nlev_soildecomp_standard=5 - allocate(fr(bounds%begc:bounds%endc,nlev_soildecomp_standard)) - do j=1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - frw(c) = frw(c) + col%dz(c,j) - end do - end do - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (frw(c) /= 0._r8) then - fr(c,j) = col%dz(c,j) / frw(c) - else - fr(c,j) = 0._r8 - end if - end do - end do - - if ( .not. use_century_tfunc ) then - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) t_scalar(c,:) = 0._r8 - if (t_soisno(c,j) >= SHR_CONST_TKFRZ) then - t_scalar(c,1)=t_scalar(c,1) + & - (Q10**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8))*fr(c,j) - else - t_scalar(c,1)=t_scalar(c,1) + & - (Q10**(-25._r8/10._r8))*(froz_q10**((t_soisno(c,j)-SHR_CONST_TKFRZ)/10._r8))*fr(c,j) - endif - end do - end do - - else - ! original century uses an arctangent function to calculate the temperature dependence of decomposition - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) t_scalar(c,:) = 0._r8 - - t_scalar(c,1)=t_scalar(c,1) +max(catanf(t_soisno(c,j)-SHR_CONST_TKFRZ)/catanf_30*fr(c,j),0.01_r8) - end do - end do - - endif - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) w_scalar(c,:) = 0._r8 - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c,1) = w_scalar(c,1) + (log(minpsi/psi)/log(minpsi/maxpsi))*fr(c,j) - end if - end do - end do - - if (use_lch4) then - if (anoxia_wtsat) then ! Adjust for saturated fraction if unfrozen - do fc = 1,num_soilc - c = filter_soilc(fc) - if (alt_indx(c) >= nlev_soildecomp_standard .and. t_soisno(c,1) > SHR_CONST_TKFRZ) then - w_scalar(c,1) = w_scalar(c,1)*(1._r8 - finundated(c)) + finundated(c) - end if - end do - end if - end if - - if (use_lch4) then - ! Calculate ANOXIA - if (anoxia) then - ! Check for anoxia w/o LCH4 now done in controlMod. - - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (j==1) o_scalar(c,:) = 0._r8 - - if (.not. anoxia_wtsat) then - o_scalar(c,1) = o_scalar(c,1) + fr(c,j) * max(o2stress_unsat(c,j), mino2lim) - else - o_scalar(c,1) = o_scalar(c,1) + fr(c,j) * & - (max(o2stress_unsat(c,j), mino2lim)*(1._r8 - finundated(c)) + & - max(o2stress_sat(c,j), mino2lim)*finundated(c) ) - end if - end do - end do - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - - deallocate(fr) - - else - - if ( .not. use_century_tfunc ) then - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - ! Peter Thornton: 3/13/09 - ! Replaced the Lloyd and Taylor function with a Q10 formula, with Q10 = 1.5 - ! as part of the modifications made to improve the seasonal cycle of - ! atmospheric CO2 concentration in global simulations. This does not impact - ! the base rates at 25 C, which are calibrated from microcosm studies. - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if (t_soisno(c,j) >= SHR_CONST_TKFRZ) then - t_scalar(c,j)= (Q10**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8)) - else - t_scalar(c,j)= (Q10**(-25._r8/10._r8))*(froz_q10**((t_soisno(c,j)-SHR_CONST_TKFRZ)/10._r8)) - endif - end do - end do - - else - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - t_scalar(c,j)= max(catanf(t_soisno(c,j)-SHR_CONST_TKFRZ)/catanf_30, 0.01_r8) - end do - end do - - endif - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c,j) = (log(minpsi/psi)/log(minpsi/maxpsi)) - else - w_scalar(c,j) = 0._r8 - end if - if (use_lch4) then - if (anoxia_wtsat .and. t_soisno(c,j) > SHR_CONST_TKFRZ) then ! wet area will have w_scalar of 1 if unfrozen - w_scalar(c,j) = w_scalar(c,j)*(1._r8 - finundated(c)) + finundated(c) - end if - end if - end do - end do - - if (use_lch4) then - ! Calculate ANOXIA - ! Check for anoxia w/o LCH4 now done in controlMod. - - if (anoxia) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. anoxia_wtsat) then - o_scalar(c,j) = max(o2stress_unsat(c,j), mino2lim) - else - o_scalar(c,j) = max(o2stress_unsat(c,j), mino2lim) * (1._r8 - finundated(c)) + & - max(o2stress_sat(c,j), mino2lim) * finundated(c) - end if - end do - end do - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - - end if - - if ( normalize_q10_to_century_tfunc ) then - ! scale all decomposition rates by a constant to compensate for offset between original CENTURY temp func and Q10 - normalization_factor = (catanf(normalization_tref)/catanf_30) / (q10**((normalization_tref-25._r8)/10._r8)) - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - t_scalar(c,j) = t_scalar(c,j) * normalization_factor - end do - end do - endif - - if (use_vertsoilc) then - ! add a term to reduce decomposition rate at depth - ! for now used a fixed e-folding depth - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - depth_scalar(c,j) = exp(-zsoi(j)/decomp_depth_efolding) - end do - end do - end if - - ! calculate rate constants for all litter and som pools - if (use_vertsoilc) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_litr1) = k_l1 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) & - * spinup_geogterm_l1(c) - decomp_k(c,j,i_litr2) = k_l2_l3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) & - * spinup_geogterm_l23(c) - decomp_k(c,j,i_litr3) = k_l2_l3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) & - * spinup_geogterm_l23(c) - decomp_k(c,j,i_soil1) = k_s1 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) & - * spinup_geogterm_s1(c) - decomp_k(c,j,i_soil2) = k_s2 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) & - * spinup_geogterm_s2(c) - decomp_k(c,j,i_soil3) = k_s3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) & - * spinup_geogterm_s3(c) - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_litr1) = k_l1 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) * spinup_geogterm_l1(c) - decomp_k(c,j,i_litr2) = k_l2_l3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) * spinup_geogterm_l23(c) - decomp_k(c,j,i_litr3) = k_l2_l3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) * spinup_geogterm_l23(c) - decomp_k(c,j,i_soil1) = k_s1 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) * spinup_geogterm_s1(c) - decomp_k(c,j,i_soil2) = k_s2 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) * spinup_geogterm_s2(c) - decomp_k(c,j,i_soil3) = k_s3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) * spinup_geogterm_s3(c) - end do - end do - end if - - ! do the same for cwd, but only if fates is not enabled, because fates handles CWD on its own structure - if (.not. use_fates) then - if (use_vertsoilc) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_cwd) = k_frag * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * & - o_scalar(c,j) * spinup_geogterm_cwd(c) - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_cwd) = k_frag * t_scalar(c,j) * w_scalar(c,j) * & - o_scalar(c,j) * spinup_geogterm_cwd(c) - end do - end do - end if - end if - - end associate - - end subroutine decomp_rate_constants_bgc - -end module SoilBiogeochemDecompCascadeBGCMod diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 deleted file mode 100644 index 4ae36155f2..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeCNMod.F90 +++ /dev/null @@ -1,952 +0,0 @@ -module SoilBiogeochemDecompCascadeCNMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Sets the coeffiecients used in the decomposition cascade submodel. - ! This uses the CN parameters as in CLMCN 4.0 - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevsoi, nlevgrnd, nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog, spinup_state, anoxia, use_lch4, use_vertsoilc, use_fates - use clm_varcon , only : zsoi - use decompMod , only : bounds_type - use abortutils , only : endrun - use CNSharedParamsMod , only : CNParamsShareInst, anoxia_wtsat, nlev_soildecomp_standard - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilStateType , only : soilstate_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use ch4Mod , only : ch4_type - use ColumnType , only : col - - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: init_decompcascade_cn - public :: decomp_rate_constants_cn - - type, private :: params_type - real(r8):: cn_s1_cn !C:N for SOM 1 - real(r8):: cn_s2_cn !C:N for SOM 2 - real(r8):: cn_s3_cn !C:N for SOM 3 - real(r8):: cn_s4_cn !C:N for SOM 4 - - real(r8):: rf_l1s1_cn !respiration fraction litter 1 -> SOM 1 - real(r8):: rf_l2s2_cn !respiration fraction litter 2 -> SOM 2 - real(r8):: rf_l3s3_cn !respiration fraction litter 3 -> SOM 3 - real(r8):: rf_s1s2_cn !respiration fraction SOM 1 -> SOM 2 - real(r8):: rf_s2s3_cn !respiration fraction SOM 2 -> SOM 3 - real(r8):: rf_s3s4_cn !respiration fraction SOM 3 -> SOM 4 - - real(r8) :: cwd_fcel_cn !cellulose fraction for CWD - real(r8) :: cwd_flig_cn ! - - real(r8) :: k_l1_cn !decomposition rate for litter 1 - real(r8) :: k_l2_cn !decomposition rate for litter 2 - real(r8) :: k_l3_cn !decomposition rate for litter 3 - real(r8) :: k_s1_cn !decomposition rate for SOM 1 - real(r8) :: k_s2_cn !decomposition rate for SOM 2 - real(r8) :: k_s3_cn !decomposition rate for SOM 3 - real(r8) :: k_s4_cn !decomposition rate for SOM 4 - - real(r8) :: k_frag_cn !fragmentation rate for CWD - real(r8) :: minpsi_cn !minimum soil water potential for heterotrophic resp - real(r8) :: maxpsi_cn !maximum soil water potential for heterotrophic resp - - integer :: nsompools = 4 - real(r8), allocatable :: spinup_vector(:) ! multipliers for soil decomp during accelerated spinup - - end type params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !CALLED FROM: readParamsMod.F90::CNParamsReadFile - ! - ! !REVISION HISTORY: - ! Dec 3 2012 : Created by S. Muszala - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'SoilBiogeochemDecompCnParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - - !EOP - !----------------------------------------------------------------------- - - ! These are not read off of netcdf file - allocate(params_inst%spinup_vector(params_inst%nsompools)) - params_inst%spinup_vector(:) = (/ 1.0_r8, 1.0_r8, 5.0_r8, 70.0_r8 /) - - ! Read off of netcdf file - tString='cn_s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s1_cn=tempr - - tString='cn_s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s2_cn=tempr - - tString='cn_s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s3_cn=tempr - - tString='cn_s4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cn_s4_cn=tempr - - tString='rf_l1s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l1s1_cn=tempr - - tString='rf_l2s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l2s2_cn=tempr - - tString='rf_l3s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_l3s3_cn=tempr - - tString='rf_s1s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s1s2_cn=tempr - - tString='rf_s2s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s2s3_cn=tempr - - tString='rf_s3s4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rf_s3s4_cn=tempr - - tString='cwd_fcel' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_fcel_cn=tempr - - tString='k_l1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_l1_cn=tempr - - tString='k_l2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_l2_cn=tempr - - tString='k_l3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_l3_cn=tempr - - tString='k_s1' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s1_cn=tempr - - tString='k_s2' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s2_cn=tempr - - tString='k_s3' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s3_cn=tempr - - tString='k_s4' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_s4_cn=tempr - - tString='k_frag' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%k_frag_cn=tempr - - tString='minpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%minpsi_cn=tempr - - tString='maxpsi_hr' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%maxpsi_cn=tempr - - tString='cwd_flig' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%cwd_flig_cn=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine init_decompcascade_cn(bounds, soilbiogeochem_state_inst) - ! - ! !DESCRIPTION: - ! initialize rate constants and decomposition pathways for the BGC model originally implemented in CLM-CN - ! written by C. Koven based on original CLM4 decomposition cascade by P. Thornton - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - ! - !-- properties of each pathway along decomposition cascade - !-- properties of each decomposing pool - real(r8) :: rf_l1s1 !respiration fraction litter 1 -> SOM 1 - real(r8) :: rf_l2s2 !respiration fraction litter 2 -> SOM 2 - real(r8) :: rf_l3s3 !respiration fraction litter 3 -> SOM 3 - real(r8) :: rf_s1s2 !respiration fraction SOM 1 -> SOM 2 - real(r8) :: rf_s2s3 !respiration fraction SOM 2 -> SOM 3 - real(r8) :: rf_s3s4 !respiration fraction SOM 3 -> SOM 4 - real(r8) :: cwd_fcel - real(r8) :: cwd_flig - real(r8) :: cn_s1 - real(r8) :: cn_s2 - real(r8) :: cn_s3 - real(r8) :: cn_s4 - - integer :: i_litr1 - integer :: i_litr2 - integer :: i_litr3 - integer :: i_soil1 - integer :: i_soil2 - integer :: i_soil3 - integer :: i_soil4 - integer :: i_atm - integer :: i_l1s1 - integer :: i_l2s2 - integer :: i_l3s3 - integer :: i_s1s2 - integer :: i_s2s3 - integer :: i_s3s4 - integer :: i_s4atm - integer :: i_cwdl2 - integer :: i_cwdl3 - !----------------------------------------------------------------------- - - associate( & - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Output: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Output: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Output: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Output: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Output: [logical (:) ] TRUE => pool has fixed C:N ratio - is_litter => decomp_cascade_con%is_litter , & ! Output: [logical (:) ] TRUE => pool is a litter pool - is_soil => decomp_cascade_con%is_soil , & ! Output: [logical (:) ] TRUE => pool is a soil pool - is_cwd => decomp_cascade_con%is_cwd , & ! Output: [logical (:) ] TRUE => pool is a cwd pool - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Output: [real(r8) (:) ] c:n ratio for initialization of pools - initial_stock => decomp_cascade_con%initial_stock , & ! Output: [real(r8) (:) ] initial concentration for seeding at spinup - is_metabolic => decomp_cascade_con%is_metabolic , & ! Output: [logical (:) ] TRUE => pool is metabolic material - is_cellulose => decomp_cascade_con%is_cellulose , & ! Output: [logical (:) ] TRUE => pool is cellulose - is_lignin => decomp_cascade_con%is_lignin , & ! Output: [logical (:) ] TRUE => pool is lignin - spinup_factor => decomp_cascade_con%spinup_factor & ! Output: [real(r8) (:) ] factor for AD spinup associated with each pool - ) - - !------- time-constant coefficients ---------- ! - ! set soil organic matter compartment C:N ratios (from Biome-BGC v4.2.0) - cn_s1=params_inst%cn_s1_cn - cn_s2=params_inst%cn_s2_cn - cn_s3=params_inst%cn_s3_cn - cn_s4=params_inst%cn_s4_cn - - ! set respiration fractions for fluxes between compartments - ! (from Biome-BGC v4.2.0) - rf_l1s1=params_inst%rf_l1s1_cn - rf_l2s2=params_inst%rf_l2s2_cn - rf_l3s3=params_inst%rf_l3s3_cn - rf_s1s2=params_inst%rf_s1s2_cn - rf_s2s3=params_inst%rf_s2s3_cn - rf_s3s4=params_inst%rf_s3s4_cn - - ! set the cellulose and lignin fractions for coarse woody debris - cwd_fcel=params_inst%cwd_fcel_cn - cwd_flig=params_inst%cwd_flig_cn - - !------------------- list of pools and their attributes ------------ - - i_litr1 = i_met_lit - floating_cn_ratio_decomp_pools(i_litr1) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_litr1) = 'litr1' - decomp_cascade_con%decomp_pool_name_history(i_litr1) = 'LITR1' - decomp_cascade_con%decomp_pool_name_long(i_litr1) = 'litter 1' - decomp_cascade_con%decomp_pool_name_short(i_litr1) = 'L1' - is_litter(i_litr1) = .true. - is_soil(i_litr1) = .false. - is_cwd(i_litr1) = .false. - initial_cn_ratio(i_litr1) = 90._r8 - initial_stock(i_litr1) = 0._r8 - is_metabolic(i_litr1) = .true. - is_cellulose(i_litr1) = .false. - is_lignin(i_litr1) = .false. - - i_litr2 = i_cel_lit - floating_cn_ratio_decomp_pools(i_litr2) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_litr2) = 'litr2' - decomp_cascade_con%decomp_pool_name_history(i_litr2) = 'LITR2' - decomp_cascade_con%decomp_pool_name_long(i_litr2) = 'litter 2' - decomp_cascade_con%decomp_pool_name_short(i_litr2) = 'L2' - is_litter(i_litr2) = .true. - is_soil(i_litr2) = .false. - is_cwd(i_litr2) = .false. - initial_cn_ratio(i_litr2) = 90._r8 - initial_stock(i_litr2) = 0._r8 - is_metabolic(i_litr2) = .false. - is_cellulose(i_litr2) = .true. - is_lignin(i_litr2) = .false. - - i_litr3 = i_lig_lit - floating_cn_ratio_decomp_pools(i_litr3) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_litr3) = 'litr3' - decomp_cascade_con%decomp_pool_name_history(i_litr3) = 'LITR3' - decomp_cascade_con%decomp_pool_name_long(i_litr3) = 'litter 3' - decomp_cascade_con%decomp_pool_name_short(i_litr3) = 'L3' - is_litter(i_litr3) = .true. - is_soil(i_litr3) = .false. - is_cwd(i_litr3) = .false. - initial_cn_ratio(i_litr3) = 90._r8 - initial_stock(i_litr3) = 0._r8 - is_metabolic(i_litr3) = .false. - is_cellulose(i_litr3) = .false. - is_lignin(i_litr3) = .true. - - if (.not. use_fates) then - floating_cn_ratio_decomp_pools(i_cwd) = .true. - decomp_cascade_con%decomp_pool_name_restart(i_cwd) = 'cwd' - decomp_cascade_con%decomp_pool_name_history(i_cwd) = 'CWD' - decomp_cascade_con%decomp_pool_name_long(i_cwd) = 'coarse woody debris' - decomp_cascade_con%decomp_pool_name_short(i_cwd) = 'CWD' - is_litter(i_cwd) = .false. - is_soil(i_cwd) = .false. - is_cwd(i_cwd) = .true. - initial_cn_ratio(i_cwd) = 500._r8 - initial_stock(i_cwd) = 0._r8 - is_metabolic(i_cwd) = .false. - is_cellulose(i_cwd) = .false. - is_lignin(i_cwd) = .false. - end if - - if ( .not. use_fates ) then - i_soil1 = 5 - else - i_soil1 = 4 - endif - floating_cn_ratio_decomp_pools(i_soil1) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil1) = 'soil1' - decomp_cascade_con%decomp_pool_name_history(i_soil1) = 'SOIL1' - decomp_cascade_con%decomp_pool_name_long(i_soil1) = 'soil 1' - decomp_cascade_con%decomp_pool_name_short(i_soil1) = 'S1' - is_litter(i_soil1) = .false. - is_soil(i_soil1) = .true. - is_cwd(i_soil1) = .false. - initial_cn_ratio(i_soil1) = cn_s1 - initial_stock(i_soil1) = 0._r8 - is_metabolic(i_soil1) = .false. - is_cellulose(i_soil1) = .false. - is_lignin(i_soil1) = .false. - - if ( .not. use_fates ) then - i_soil2 = 6 - else - i_soil2 = 5 - endif - floating_cn_ratio_decomp_pools(i_soil2) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil2) = 'soil2' - decomp_cascade_con%decomp_pool_name_history(i_soil2) = 'SOIL2' - decomp_cascade_con%decomp_pool_name_long(i_soil2) = 'soil 2' - decomp_cascade_con%decomp_pool_name_short(i_soil2) = 'S2' - is_litter(i_soil2) = .false. - is_soil(i_soil2) = .true. - is_cwd(i_soil2) = .false. - initial_cn_ratio(i_soil2) = cn_s2 - initial_stock(i_soil2) = 0._r8 - is_metabolic(i_soil2) = .false. - is_cellulose(i_soil2) = .false. - is_lignin(i_soil2) = .false. - - if ( .not. use_fates ) then - i_soil3 = 7 - else - i_soil3 = 6 - endif - floating_cn_ratio_decomp_pools(i_soil3) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil3) = 'soil3' - decomp_cascade_con%decomp_pool_name_history(i_soil3) = 'SOIL3' - decomp_cascade_con%decomp_pool_name_long(i_soil3) = 'soil 3' - decomp_cascade_con%decomp_pool_name_short(i_soil3) = 'S3' - is_litter(i_soil3) = .false. - is_soil(i_soil3) = .true. - is_cwd(i_soil3) = .false. - initial_cn_ratio(i_soil3) = cn_s3 - initial_stock(i_soil3) = 0._r8 - is_metabolic(i_soil3) = .false. - is_cellulose(i_soil3) = .false. - is_lignin(i_soil3) = .false. - - if ( .not. use_fates ) then - i_soil4 = 8 - else - i_soil4 = 7 - endif - floating_cn_ratio_decomp_pools(i_soil4) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_soil4) = 'soil4' - decomp_cascade_con%decomp_pool_name_history(i_soil4) = 'SOIL4' - decomp_cascade_con%decomp_pool_name_long(i_soil4) = 'soil 4' - decomp_cascade_con%decomp_pool_name_short(i_soil4) = 'S4' - is_litter(i_soil4) = .false. - is_soil(i_soil4) = .true. - is_cwd(i_soil4) = .false. - initial_cn_ratio(i_soil4) = cn_s4 - initial_stock(i_soil4) = 10._r8 - is_metabolic(i_soil4) = .false. - is_cellulose(i_soil4) = .false. - is_lignin(i_soil4) = .false. - - i_atm = 0 !! for terminal pools (i.e. 100% respiration) - floating_cn_ratio_decomp_pools(i_atm) = .false. - decomp_cascade_con%decomp_pool_name_restart(i_atm) = 'atmosphere' - decomp_cascade_con%decomp_pool_name_history(i_atm) = 'atmosphere' - decomp_cascade_con%decomp_pool_name_long(i_atm) = 'atmosphere' - decomp_cascade_con%decomp_pool_name_short(i_atm) = '' - is_litter(i_atm) = .true. - is_soil(i_atm) = .false. - is_cwd(i_atm) = .false. - initial_cn_ratio(i_atm) = 0._r8 - initial_stock(i_atm) = 0._r8 - is_metabolic(i_atm) = .false. - is_cellulose(i_atm) = .false. - is_lignin(i_atm) = .false. - - - spinup_factor(i_litr1) = 1._r8 - spinup_factor(i_litr2) = 1._r8 - spinup_factor(i_litr3) = 1._r8 - if (.not. use_fates) then - spinup_factor(i_cwd) = 1._r8 - end if - spinup_factor(i_soil1) = params_inst%spinup_vector(1) - spinup_factor(i_soil2) = params_inst%spinup_vector(2) - spinup_factor(i_soil3) = params_inst%spinup_vector(3) - spinup_factor(i_soil4) = params_inst%spinup_vector(4) - - - !---------------- list of transitions and their time-independent coefficients ---------------! - i_l1s1 = 1 - decomp_cascade_con%cascade_step_name(i_l1s1) = 'L1S1' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = rf_l1s1 - cascade_donor_pool(i_l1s1) = i_litr1 - cascade_receiver_pool(i_l1s1) = i_soil1 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l1s1) = 1.0_r8 - - i_l2s2 = 2 - decomp_cascade_con%cascade_step_name(i_l2s2) = 'L2S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s2) = rf_l2s2 - cascade_donor_pool(i_l2s2) = i_litr2 - cascade_receiver_pool(i_l2s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l2s2) = 1.0_r8 - - i_l3s3 = 3 - decomp_cascade_con%cascade_step_name(i_l3s3) = 'L3S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s3) = rf_l3s3 - cascade_donor_pool(i_l3s3) = i_litr3 - cascade_receiver_pool(i_l3s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_l3s3) = 1.0_r8 - - i_s1s2 = 4 - decomp_cascade_con%cascade_step_name(i_s1s2) = 'S1S2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = rf_s1s2 - cascade_donor_pool(i_s1s2) = i_soil1 - cascade_receiver_pool(i_s1s2) = i_soil2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s1s2) = 1.0_r8 - - i_s2s3 = 5 - decomp_cascade_con%cascade_step_name(i_s2s3) = 'S2S3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = rf_s2s3 - cascade_donor_pool(i_s2s3) = i_soil2 - cascade_receiver_pool(i_s2s3) = i_soil3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s2s3) = 1.0_r8 - - i_s3s4 = 6 - decomp_cascade_con%cascade_step_name(i_s3s4) = 'S3S4' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s4) = rf_s3s4 - cascade_donor_pool(i_s3s4) = i_soil3 - cascade_receiver_pool(i_s3s4) = i_soil4 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s3s4) = 1.0_r8 - - i_s4atm = 7 - decomp_cascade_con%cascade_step_name(i_s4atm) = 'S4' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s4atm) = 1. - cascade_donor_pool(i_s4atm) = i_soil4 - cascade_receiver_pool(i_s4atm) = i_atm - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_s4atm) = 1.0_r8 - - if (.not. use_fates) then - i_cwdl2 = 8 - decomp_cascade_con%cascade_step_name(i_cwdl2) = 'CWDL2' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = 0._r8 - cascade_donor_pool(i_cwdl2) = i_cwd - cascade_receiver_pool(i_cwdl2) = i_litr2 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl2) = cwd_fcel - - i_cwdl3 = 9 - decomp_cascade_con%cascade_step_name(i_cwdl3) = 'CWDL3' - rf_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = 0._r8 - cascade_donor_pool(i_cwdl3) = i_cwd - cascade_receiver_pool(i_cwdl3) = i_litr3 - pathfrac_decomp_cascade(bounds%begc:bounds%endc,1:nlevdecomp,i_cwdl3) = cwd_flig - end if - - end associate - - end subroutine init_decompcascade_cn - - !----------------------------------------------------------------------- - subroutine decomp_rate_constants_cn(bounds, & - num_soilc, filter_soilc, & - canopystate_inst, soilstate_inst, temperature_inst, ch4_inst, soilbiogeochem_carbonflux_inst) - ! - ! !DESCRIPTION: - ! calculate rate constants and decomposition pathways for the BGC model - ! originally implemented in CLM-CN - ! written by C. Koven based on original CLM4 decomposition cascade by P. Thornton - ! - ! !USES: - use clm_time_manager, only : get_step_size - use clm_varcon , only : secspday - use clm_varpar , only : i_cwd - ! - ! !ARGUMENTS: - 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 - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(ch4_type) , intent(in) :: ch4_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - ! - ! !LOCAL VARIABLES: - real(r8):: dt ! decomp timestep (seconds) - real(r8):: dtd ! decomp timestep (days) - real(r8):: frw(bounds%begc:bounds%endc) ! rooting fraction weight - real(r8), allocatable:: fr(:,:) ! column-level rooting fraction by soil depth - real(r8):: minpsi, maxpsi ! limits for soil water scalar for decomp - real(r8):: psi ! temporary soilpsi for water scalar - real(r8):: rate_scalar ! combined rate scalar for decomp - real(r8):: k_l1 ! decomposition rate constant litter 1 - real(r8):: k_l2 ! decomposition rate constant litter 2 - real(r8):: k_l3 ! decomposition rate constant litter 3 - real(r8):: k_s1 ! decomposition rate constant SOM 1 - real(r8):: k_s2 ! decomposition rate constant SOM 2 - real(r8):: k_s3 ! decomposition rate constant SOM 3 - real(r8):: k_s4 ! decomposition rate constant SOM 4 - real(r8):: k_frag ! fragmentation rate constant CWD - real(r8):: ck_l1 ! corrected decomposition rate constant litter 1 - real(r8):: ck_l2 ! corrected decomposition rate constant litter 2 - real(r8):: ck_l3 ! corrected decomposition rate constant litter 3 - real(r8):: ck_s1 ! corrected decomposition rate constant SOM 1 - real(r8):: ck_s2 ! corrected decomposition rate constant SOM 2 - real(r8):: ck_s3 ! corrected decomposition rate constant SOM 3 - real(r8):: ck_s4 ! corrected decomposition rate constant SOM 4 - real(r8):: ck_frag ! corrected fragmentation rate constant CWD - real(r8):: cwdc_loss ! fragmentation rate for CWD carbon (gC/m2/s) - real(r8):: cwdn_loss ! fragmentation rate for CWD nitrogen (gN/m2/s) - integer :: i_litr1 - integer :: i_litr2 - integer :: i_litr3 - integer :: i_soil1 - integer :: i_soil2 - integer :: i_soil3 - integer :: i_soil4 - integer :: c, fc, j, k, l - real(r8):: Q10 ! temperature dependence - real(r8):: froz_q10 ! separate q10 for frozen soil respiration rates. default to same as above zero rates - real(r8):: decomp_depth_efolding ! (meters) e-folding depth for reduction in decomposition [ - real(r8):: depth_scalar(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: mino2lim ! minimum anaerobic decomposition rate as a - ! fraction of potential aerobic rate - !----------------------------------------------------------------------- - - associate( & - dz => col%dz , & ! Input: [real(r8) (:,:) ] soil layer thickness (m) - - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - alt_indx => canopystate_inst%alt_indx_col , & ! Input: [integer (:) ] current depth of thaw - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - o2stress_sat => ch4_inst%o2stress_sat_col , & ! Input: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - o2stress_unsat => ch4_inst%o2stress_unsat_col , & ! Input: [real(r8) (:,:) ] Ratio of oxygen available to that demanded by roots, aerobes, & methanotrophs (nlevsoi) - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area (excluding dedicated wetland columns) - - t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col , & ! Output: [real(r8) (:,:) ] soil temperature scalar for decomp - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Output: [real(r8) (:,:) ] soil water scalar for decomp - o_scalar => soilbiogeochem_carbonflux_inst%o_scalar_col , & ! Output: [real(r8) (:,:) ] fraction by which decomposition is limited by anoxia - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - ) - - mino2lim = CNParamsShareInst%mino2lim - - ! set time steps - dt = real( get_step_size(), r8 ) - dtd = dt/secspday - - ! set initial base rates for decomposition mass loss (1/day) - ! (from Biome-BGC v4.2.0, using three SOM pools) - ! Value inside log function is the discrete-time values for a - ! daily time step model, and the result of the log function is - ! the corresponding continuous-time decay rate (1/day), following - ! Olson, 1963. - k_l1=params_inst%k_l1_cn - k_l2=params_inst%k_l2_cn - k_l3=params_inst%k_l3_cn - - k_s1=params_inst%k_s1_cn - k_s2=params_inst%k_s2_cn - k_s3=params_inst%k_s3_cn - k_s4=params_inst%k_s4_cn - - k_frag=params_inst%k_frag_cn - - ! calculate the new discrete-time decay rate for model timestep - k_l1 = 1.0_r8-exp(-k_l1*dtd) - k_l2 = 1.0_r8-exp(-k_l2*dtd) - k_l3 = 1.0_r8-exp(-k_l3*dtd) - - k_s1 = 1.0_r8-exp(-k_s1*dtd) - k_s2 = 1.0_r8-exp(-k_s2*dtd) - k_s3 = 1.0_r8-exp(-k_s3*dtd) - k_s4 = 1.0_r8-exp(-k_s4*dtd) - - k_frag = 1.0_r8-exp(-k_frag*dtd) - - minpsi = params_inst%minpsi_cn - maxpsi = params_inst%maxpsi_cn - - Q10 = CNParamsShareInst%Q10 - - ! set "froz_q10" parameter - froz_q10 = CNParamsShareInst%froz_q10 - - if (use_vertsoilc) then - ! Set "decomp_depth_efolding" parameter - decomp_depth_efolding = CNParamsShareInst%decomp_depth_efolding - end if - - ! The following code implements the acceleration part of the AD spinup - ! algorithm, by multiplying all of the SOM decomposition base rates by 10.0. - - if ( spinup_state .eq. 1 ) then - k_s1 = k_s1 * params_inst%spinup_vector(1) - k_s2 = k_s2 * params_inst%spinup_vector(2) - k_s3 = k_s3 * params_inst%spinup_vector(3) - k_s4 = k_s4 * params_inst%spinup_vector(4) - endif - - i_litr1 = 1 - i_litr2 = 2 - i_litr3 = 3 - if (use_fates) then - i_soil1 = 4 - i_soil2 = 5 - i_soil3 = 6 - i_soil4 = 7 - else - i_soil1 = 5 - i_soil2 = 6 - i_soil3 = 7 - i_soil4 = 8 - endif - - !--- time dependent coefficients-----! - if ( nlevdecomp .eq. 1 ) then - - ! calculate function to weight the temperature and water potential scalars - ! for decomposition control. - - - ! the following normalizes values in fr so that they - ! sum to 1.0 across top nlevdecomp levels on a column - frw(bounds%begc:bounds%endc) = 0._r8 - nlev_soildecomp_standard=5 - allocate(fr(bounds%begc:bounds%endc,nlev_soildecomp_standard)) - do j=1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - frw(c) = frw(c) + dz(c,j) - end do - end do - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (frw(c) /= 0._r8) then - fr(c,j) = dz(c,j) / frw(c) - else - fr(c,j) = 0._r8 - end if - end do - end do - - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - ! Peter Thornton: 3/13/09 - ! Replaced the Lloyd and Taylor function with a Q10 formula, with Q10 = 1.5 - ! as part of the modifications made to improve the seasonal cycle of - ! atmospheric CO2 concentration in global simulations. This does not impact - ! the base rates at 25 C, which are calibrated from microcosm studies. - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) t_scalar(c,:) = 0._r8 - !! use separate (possibly equal) t funcs above and below freezing point - !! t_scalar(c,1)=t_scalar(c,1) + (1.5**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8))*fr(c,j) - if (t_soisno(c,j) >= SHR_CONST_TKFRZ) then - t_scalar(c,1)=t_scalar(c,1) + & - (Q10**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8))*fr(c,j) - else - t_scalar(c,1)=t_scalar(c,1) + & - (Q10**(-25._r8/10._r8))*(froz_q10**((t_soisno(c,j)-SHR_CONST_TKFRZ)/10._r8))*fr(c,j) - endif - end do - end do - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - if (j==1) w_scalar(c,:) = 0._r8 - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c,1) = w_scalar(c,1) + (log(minpsi/psi)/log(minpsi/maxpsi))*fr(c,j) - end if - end do - end do - - if (use_lch4) then - if (anoxia_wtsat) then ! Adjust for saturated fraction if unfrozen. - do fc = 1,num_soilc - c = filter_soilc(fc) - if (alt_indx(c) >= nlev_soildecomp_standard .and. t_soisno(c,1) > SHR_CONST_TKFRZ) then - w_scalar(c,1) = w_scalar(c,1)*(1._r8 - finundated(c)) + finundated(c) - end if - end do - end if - end if - - if (use_lch4) then - ! Calculate ANOXIA - if (anoxia) then - ! Check for anoxia w/o LCH4 now done in controlMod. - - do j = 1,nlev_soildecomp_standard - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (j==1) o_scalar(c,:) = 0._r8 - - if (.not. anoxia_wtsat) then - o_scalar(c,1) = o_scalar(c,1) + fr(c,j) * max(o2stress_unsat(c,j), mino2lim) - else - o_scalar(c,1) = o_scalar(c,1) + fr(c,j) * & - (max(o2stress_unsat(c,j), mino2lim)*(1._r8 - finundated(c)) + & - max(o2stress_sat(c,j), mino2lim)*finundated(c) ) - end if - end do - end do - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - - deallocate(fr) - - else - - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - ! Peter Thornton: 3/13/09 - ! Replaced the Lloyd and Taylor function with a Q10 formula, with Q10 = 1.5 - ! as part of the modifications made to improve the seasonal cycle of - ! atmospheric CO2 concentration in global simulations. This does not impact - ! the base rates at 25 C, which are calibrated from microcosm studies. - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - !! use separate (possibly equal) t funcs above and below freezing point - !! t_scalar(c,j)= (1.5**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8)) - if (t_soisno(c,j) >= SHR_CONST_TKFRZ) then - t_scalar(c,j)= (Q10**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8)) - else - t_scalar(c,j)= (Q10**(-25._r8/10._r8))*(froz_q10**((t_soisno(c,j)-SHR_CONST_TKFRZ)/10._r8)) - endif - end do - end do - - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c,j) = (log(minpsi/psi)/log(minpsi/maxpsi)) - else - w_scalar(c,j) = 0._r8 - end if - if (use_lch4) then - if (anoxia_wtsat .and. t_soisno(c,j) > SHR_CONST_TKFRZ) then ! wet area will have w_scalar of 1 if unfrozen - w_scalar(c,j) = w_scalar(c,j)*(1._r8 - finundated(c)) + finundated(c) - end if - end if - end do - end do - - end if - - if (use_lch4) then - ! Calculate ANOXIA - ! Check for anoxia w/o LCH4 now done in controlMod. - - if (anoxia) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. anoxia_wtsat) then - o_scalar(c,j) = max(o2stress_unsat(c,j), mino2lim) - else - o_scalar(c,j) = max(o2stress_unsat(c,j), mino2lim) * (1._r8 - finundated(c)) + & - max(o2stress_sat(c,j), mino2lim) * finundated(c) - end if - end do - end do - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - else - o_scalar(bounds%begc:bounds%endc,1:nlevdecomp) = 1._r8 - end if - - if (use_vertsoilc) then - ! add a term to reduce decomposition rate at depth - ! for now used a fixed e-folding depth - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - depth_scalar(c,j) = exp(-zsoi(j)/decomp_depth_efolding) - end do - end do - end if - - ! calculate rate constants for all litter and som pools - if (use_vertsoilc) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_litr1) = k_l1 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr2) = k_l2 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr3) = k_l3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil1) = k_s1 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil2) = k_s2 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil3) = k_s3 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil4) = k_s4 * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_litr1) = k_l1 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr2) = k_l2 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_litr3) = k_l3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil1) = k_s1 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil2) = k_s2 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil3) = k_s3 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - decomp_k(c,j,i_soil4) = k_s4 * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - end if - - ! do the same for cwd, but only if fates is not enabled (because fates handles CWD on its own structure - if (.not. use_fates) then - if (use_vertsoilc) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_cwd) = k_frag * t_scalar(c,j) * w_scalar(c,j) * depth_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - decomp_k(c,j,i_cwd) = k_frag * t_scalar(c,j) * w_scalar(c,j) * o_scalar(c,j) / dt - end do - end do - end if - end if - - end associate - - end subroutine decomp_rate_constants_cn - - end module SoilBiogeochemDecompCascadeCNMod diff --git a/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 b/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 deleted file mode 100644 index 8a8e2f8dfa..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompCascadeConType.F90 +++ /dev/null @@ -1,104 +0,0 @@ -module SoilBiogeochemDecompCascadeConType - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Decomposition Cascade Type - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: init_decomp_cascade_constants - ! - type, public :: decomp_cascade_type - !-- properties of each pathway along decomposition cascade - character(len=8) , pointer :: cascade_step_name(:) ! name of transition - integer , pointer :: cascade_donor_pool(:) ! which pool is C taken from for a given decomposition step - integer , pointer :: cascade_receiver_pool(:) ! which pool is C added to for a given decomposition step - - !-- properties of each decomposing pool - logical , pointer :: floating_cn_ratio_decomp_pools(:) ! TRUE => pool has fixed C:N ratio - character(len=8) , pointer :: decomp_pool_name_restart(:) ! name of pool for restart files - character(len=8) , pointer :: decomp_pool_name_history(:) ! name of pool for history files - character(len=20) , pointer :: decomp_pool_name_long(:) ! name of pool for netcdf long names - character(len=8) , pointer :: decomp_pool_name_short(:) ! name of pool for netcdf short names - logical , pointer :: is_litter(:) ! TRUE => pool is a litter pool - logical , pointer :: is_soil(:) ! TRUE => pool is a soil pool - logical , pointer :: is_cwd(:) ! TRUE => pool is a cwd pool - real(r8) , pointer :: initial_cn_ratio(:) ! c:n ratio for initialization of pools - real(r8) , pointer :: initial_stock(:) ! initial concentration for seeding at spinup - real(r8) :: initial_stock_soildepth ! soil depth for initial concentration for seeding at spinup - logical , pointer :: is_metabolic(:) ! TRUE => pool is metabolic material - logical , pointer :: is_cellulose(:) ! TRUE => pool is cellulose - logical , pointer :: is_lignin(:) ! TRUE => pool is lignin - real(r8) , pointer :: spinup_factor(:) ! factor by which to scale AD and relevant processes by - end type decomp_cascade_type - - type(decomp_cascade_type), public :: decomp_cascade_con - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine init_decomp_cascade_constants() - ! - ! !DESCRIPTION: - ! Initialize decomposition cascade state - !------------------------------------------------------------------------ - - !-- properties of each pathway along decomposition cascade - allocate(decomp_cascade_con%cascade_step_name(1:ndecomp_cascade_transitions)) - allocate(decomp_cascade_con%cascade_donor_pool(1:ndecomp_cascade_transitions)) - allocate(decomp_cascade_con%cascade_receiver_pool(1:ndecomp_cascade_transitions)) - - ! NOTE(bja, 2015-10) according to Dave Lawrence and Charlie Koven, - ! the indexing of decomposing pools from 0:ndecomp_pools is a - ! bug. The lower bound should be 1. The index zero data shouldn't - ! be used. - - !-- properties of each decomposing pool - allocate(decomp_cascade_con%floating_cn_ratio_decomp_pools(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_restart(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_history(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_long(0:ndecomp_pools)) - allocate(decomp_cascade_con%decomp_pool_name_short(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_litter(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_soil(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_cwd(0:ndecomp_pools)) - allocate(decomp_cascade_con%initial_cn_ratio(0:ndecomp_pools)) - allocate(decomp_cascade_con%initial_stock(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_metabolic(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_cellulose(0:ndecomp_pools)) - allocate(decomp_cascade_con%is_lignin(0:ndecomp_pools)) - allocate(decomp_cascade_con%spinup_factor(1:ndecomp_pools)) - - !-- properties of each pathway along decomposition cascade - decomp_cascade_con%cascade_step_name(1:ndecomp_cascade_transitions) = '' - decomp_cascade_con%cascade_donor_pool(1:ndecomp_cascade_transitions) = 0 - decomp_cascade_con%cascade_receiver_pool(1:ndecomp_cascade_transitions) = 0 - - !-- first initialization of properties of each decomposing pool - decomp_cascade_con%floating_cn_ratio_decomp_pools(0:ndecomp_pools) = .false. - decomp_cascade_con%decomp_pool_name_history(0:ndecomp_pools) = '' - decomp_cascade_con%decomp_pool_name_restart(0:ndecomp_pools) = '' - decomp_cascade_con%decomp_pool_name_long(0:ndecomp_pools) = '' - decomp_cascade_con%decomp_pool_name_short(0:ndecomp_pools) = '' - decomp_cascade_con%is_litter(0:ndecomp_pools) = .false. - decomp_cascade_con%is_soil(0:ndecomp_pools) = .false. - decomp_cascade_con%is_cwd(0:ndecomp_pools) = .false. - decomp_cascade_con%initial_cn_ratio(0:ndecomp_pools) = nan - decomp_cascade_con%initial_stock(0:ndecomp_pools) = nan - decomp_cascade_con%initial_stock_soildepth = 0.3 - decomp_cascade_con%is_metabolic(0:ndecomp_pools) = .false. - decomp_cascade_con%is_cellulose(0:ndecomp_pools) = .false. - decomp_cascade_con%is_lignin(0:ndecomp_pools) = .false. - decomp_cascade_con%spinup_factor(1:ndecomp_pools) = nan - - end subroutine init_decomp_cascade_constants - -end module SoilBiogeochemDecompCascadeConType diff --git a/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 b/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 deleted file mode 100644 index 413647bf1c..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemDecompMod.F90 +++ /dev/null @@ -1,277 +0,0 @@ -module SoilBiogeochemDecompMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module holding routines used in litter and soil decomposition model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use clm_varpar , only : nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use clm_varctl , only : use_nitrif_denitrif, use_lch4, use_fates - use clm_varcon , only : dzsoi_decomp - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemDecomp - ! - type, private :: params_type - real(r8) :: dnp !denitrification proportion - end type params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read parameters - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - use abortutils , only: endrun - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='dnp' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dnp=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemDecomp (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools, p_decomp_cpool_loss, pmnf_decomp_cascade) - ! - ! !USES: - ! - ! !ARGUMENT: - 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 - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - real(r8) , intent(inout) :: cn_decomp_pools(bounds%begc:,1:,1:) ! c:n ratios of applicable pools - real(r8) , intent(inout) :: p_decomp_cpool_loss(bounds%begc:,1:,1:) ! potential C loss from one pool to another - real(r8) , intent(inout) :: pmnf_decomp_cascade(bounds%begc:,1:,1:) ! potential mineral N flux from one pool to another - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l,m ! indices - integer :: fc ! lake filter column index - integer :: begc,endc ! bounds - integer, parameter :: i_atm = 0 !TODO - this appears in two places - move it to 1 - ! For methane code - real(r8):: hrsum(bounds%begc:bounds%endc,1:nlevdecomp) ! sum of HR (gC/m2/s) - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - SHR_ASSERT_ALL((ubound(cn_decomp_pools) == (/endc,nlevdecomp,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(p_decomp_cpool_loss) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pmnf_decomp_cascade) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - - associate( & - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Input: [logical (:) ] TRUE => pool has fixed C:N ratio - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Input: [real(r8) (:) ] c:n ratio for initialization of pools - - fpi_vr => soilbiogeochem_state_inst%fpi_vr_col , & ! Input: [real(r8) (:,:) ] fraction of potential immobilization (no units) - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - decomp_npools_vr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - decomp_cpools_vr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - decomp_cascade_ntransfer_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_ntransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res transfer of N from donor to receiver pool along decomp. cascade (gN/m3/s) - decomp_cascade_sminn_flux_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_sminn_flux_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res mineral N flux for transition along decomposition cascade (gN/m3/s) - potential_immob_vr => soilbiogeochem_nitrogenflux_inst%potential_immob_vr_col , & ! Output: [real(r8) (:,:) ] - sminn_to_denit_decomp_cascade_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_denit_decomp_cascade_vr_col , & ! Output: [real(r8) (:,:,:) ] - gross_nmin_vr => soilbiogeochem_nitrogenflux_inst%gross_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - net_nmin_vr => soilbiogeochem_nitrogenflux_inst%net_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - gross_nmin => soilbiogeochem_nitrogenflux_inst%gross_nmin_col , & ! Output: [real(r8) (:) ] gross rate of N mineralization (gN/m2/s) - net_nmin => soilbiogeochem_nitrogenflux_inst%net_nmin_col , & ! Output: [real(r8) (:) ] net rate of N mineralization (gN/m2/s) - - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] fraction by which decomposition is limited by moisture availability - decomp_cascade_hr_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_hr_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_cascade_ctransfer_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col , & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Input: [real(r8) (:,:) ] potential HR (gC/m3/s) - fphr => soilbiogeochem_carbonflux_inst%fphr_col & ! Output: [real(r8) (:,:) ] fraction of potential SOM + LITTER heterotrophic - ) - - ! column loop to calculate actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N - - if ( .not. use_fates) then - ! calculate c:n ratios of applicable pools - do l = 1, ndecomp_pools - if ( floating_cn_ratio_decomp_pools(l) ) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if ( decomp_npools_vr(c,j,l) > 0._r8 ) then - cn_decomp_pools(c,j,l) = decomp_cpools_vr(c,j,l) / decomp_npools_vr(c,j,l) - end if - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cn_decomp_pools(c,j,l) = initial_cn_ratio(l) - end do - end do - end if - end do - - ! column loop to calculate actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N - - ! upon return from SoilBiogeochemCompetition, the fraction of potential immobilization - ! has been set (soilbiogeochem_state_inst%fpi_vr_col). now finish the decomp calculations. - ! Only the immobilization steps are limited by fpi_vr (pmnf > 0) - ! Also calculate denitrification losses as a simple proportion - ! of mineralization flux. - - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (decomp_cpools_vr(c,j,cascade_donor_pool(k)) > 0._r8) then - if ( pmnf_decomp_cascade(c,j,k) > 0._r8 ) then - p_decomp_cpool_loss(c,j,k) = p_decomp_cpool_loss(c,j,k) * fpi_vr(c,j) - pmnf_decomp_cascade(c,j,k) = pmnf_decomp_cascade(c,j,k) * fpi_vr(c,j) - if (.not. use_nitrif_denitrif) then - sminn_to_denit_decomp_cascade_vr(c,j,k) = 0._r8 - end if - else - if (.not. use_nitrif_denitrif) then - sminn_to_denit_decomp_cascade_vr(c,j,k) = -params_inst%dnp * pmnf_decomp_cascade(c,j,k) - end if - end if - decomp_cascade_hr_vr(c,j,k) = rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - decomp_cascade_ctransfer_vr(c,j,k) = (1._r8 - rf_decomp_cascade(c,j,k)) * p_decomp_cpool_loss(c,j,k) - if (decomp_npools_vr(c,j,cascade_donor_pool(k)) > 0._r8 .and. cascade_receiver_pool(k) /= i_atm) then - decomp_cascade_ntransfer_vr(c,j,k) = p_decomp_cpool_loss(c,j,k) / cn_decomp_pools(c,j,cascade_donor_pool(k)) - else - decomp_cascade_ntransfer_vr(c,j,k) = 0._r8 - endif - if ( cascade_receiver_pool(k) /= 0 ) then - decomp_cascade_sminn_flux_vr(c,j,k) = pmnf_decomp_cascade(c,j,k) - else ! keep sign convention negative for terminal pools - decomp_cascade_sminn_flux_vr(c,j,k) = - pmnf_decomp_cascade(c,j,k) - endif - net_nmin_vr(c,j) = net_nmin_vr(c,j) - pmnf_decomp_cascade(c,j,k) - else - decomp_cascade_ntransfer_vr(c,j,k) = 0._r8 - if (.not. use_nitrif_denitrif) then - sminn_to_denit_decomp_cascade_vr(c,j,k) = 0._r8 - end if - decomp_cascade_sminn_flux_vr(c,j,k) = 0._r8 - end if - - end do - end do - end do - else - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! - decomp_cascade_hr_vr(c,j,k) = rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - ! - decomp_cascade_ctransfer_vr(c,j,k) = (1._r8 - rf_decomp_cascade(c,j,k)) * p_decomp_cpool_loss(c,j,k) - ! - end do - end do - end do - end if - - if (use_lch4) then - ! Calculate total fraction of potential HR, for methane code - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - hrsum(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - hrsum(c,j) = hrsum(c,j) + rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - end do - end do - end do - - - ! Nitrogen limitation / (low)-moisture limitation - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if (phr_vr(c,j) > 0._r8) then - fphr(c,j) = hrsum(c,j) / phr_vr(c,j) * w_scalar(c,j) - fphr(c,j) = max(fphr(c,j), 0.01_r8) ! Prevent overflow errors for 0 respiration - else - fphr(c,j) = 1._r8 - end if - end do - end do - end if - - - ! vertically integrate net and gross mineralization fluxes for diagnostic output - - do fc = 1,num_soilc - c = filter_soilc(fc) - do j = 1,nlevdecomp - if(.not.use_fates)then - 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) - ! else - ! net_nmin(c) = 0.0_r8 - ! gross_nmin(c) = 0.0_r8 - endif - end do - end do - - end associate - - end subroutine SoilBiogeochemDecomp - -end module SoilBiogeochemDecompMod diff --git a/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 b/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 deleted file mode 100644 index a82ce9c469..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemLittVertTranspMod.F90 +++ /dev/null @@ -1,516 +0,0 @@ -module SoilBiogeochemLittVertTranspMod - - !----------------------------------------------------------------------- - ! calculate vertical mixing of all decomposing C and N pools - ! - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varctl , only : iulog, use_c13, use_c14, spinup_state, use_vertsoilc, use_fates, use_cn - use clm_varcon , only : secspday - use decompMod , only : bounds_type - use abortutils , only : endrun - use CanopyStateType , only : canopystate_type - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - implicit none - private - ! - public :: readParams - public :: SoilBiogeochemLittVertTransp - - type, private :: params_type - real(r8) :: som_diffus ! Soil organic matter diffusion - real(r8) :: cryoturb_diffusion_k ! The cryoturbation diffusive constant cryoturbation to the active layer thickness - real(r8) :: max_altdepth_cryoturbation ! (m) maximum active layer thickness for cryoturbation to occur - end type params_type - - type(params_type), private :: params_inst - ! - real(r8), public :: som_adv_flux = 0._r8 - real(r8), public :: max_depth_cryoturb = 3._r8 ! (m) this is the maximum depth of cryoturbation - real(r8) :: som_diffus ! [m^2/sec] = 1 cm^2 / yr - real(r8) :: cryoturb_diffusion_k ! [m^2/sec] = 5 cm^2 / yr = 1m^2 / 200 yr - real(r8) :: max_altdepth_cryoturbation ! (m) maximum active layer thickness for cryoturbation to occur - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - use ncdio_pio , only : file_desc_t,ncd_io - ! - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - character(len=32) :: subname = 'SoilBiogeochemLittVertTranspType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - ! - ! read in parameters - ! - - tString='som_diffus' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - !soilbiogeochem_litt_verttransp_params_inst%som_diffus=tempr - ! FIX(SPM,032414) - can't be pulled out since division makes things not bfb - params_inst%som_diffus = 1e-4_r8 / (secspday * 365._r8) - - tString='cryoturb_diffusion_k' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - !soilbiogeochem_litt_verttransp_params_inst%cryoturb_diffusion_k=tempr - !FIX(SPM,032414) Todo. This constant cannot be on file since the divide makes things - !SPM Todo. This constant cannot be on file since the divide makes things - !not bfb - params_inst%cryoturb_diffusion_k = 5e-4_r8 / (secspday * 365._r8) ! [m^2/sec] = 5 cm^2 / yr = 1m^2 / 200 yr - - tString='max_altdepth_cryoturbation' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%max_altdepth_cryoturbation=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemLittVertTransp(bounds, num_soilc, filter_soilc, & - canopystate_inst, soilbiogeochem_state_inst, & - soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - c13_soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonflux_inst, & - c14_soilbiogeochem_carbonstate_inst, c14_soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! Calculate vertical mixing of soil and litter pools. Also reconcile sources and sinks of these pools - ! calculated in the CStateUpdate1 and NStateUpdate1 subroutines. - ! Advection-diffusion code based on algorithm in Patankar (1980) - ! Initial code by C. Koven and W. Riley - ! - ! !USES: - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevdecomp, ndecomp_pools, nlevdecomp_full - use clm_varcon , only : zsoi, dzsoi_decomp, zisoi - use TridiagonalMod , only : Tridiagonal - use ColumnType , only : col - use clm_varctl , only : use_bedrock - - ! - ! !ARGUMENTS: - 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 - type(canopystate_type) , intent(in) :: canopystate_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c13_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: c14_soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: diffus (bounds%begc:bounds%endc,1:nlevdecomp+1) ! diffusivity (m2/s) (includes spinup correction, if any) - real(r8) :: adv_flux(bounds%begc:bounds%endc,1:nlevdecomp+1) ! advective flux (m/s) (includes spinup correction, if any) - real(r8) :: aaa ! "A" function in Patankar - real(r8) :: pe ! Pe for "A" function in Patankar - real(r8) :: w_m1, w_p1 ! Weights for calculating harmonic mean of diffusivity - real(r8) :: d_m1, d_p1 ! Harmonic mean of diffusivity - real(r8) :: a_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "a" vector for tridiagonal matrix - real(r8) :: b_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "b" vector for tridiagonal matrix - real(r8) :: c_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "c" vector for tridiagonal matrix - real(r8) :: r_tri(bounds%begc:bounds%endc,0:nlevdecomp+1) ! "r" vector for tridiagonal solution - real(r8) :: d_p1_zp1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! diffusivity/delta_z for next j (set to zero for no diffusion) - real(r8) :: d_m1_zm1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! diffusivity/delta_z for previous j (set to zero for no diffusion) - real(r8) :: f_p1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! water flux for next j - real(r8) :: f_m1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! water flux for previous j - real(r8) :: pe_p1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! Peclet # for next j - real(r8) :: pe_m1(bounds%begc:bounds%endc,1:nlevdecomp+1) ! Peclet # for previous j - real(r8) :: dz_node(1:nlevdecomp+1) ! difference between nodes - real(r8) :: epsilon_t (bounds%begc:bounds%endc,1:nlevdecomp+1,1:ndecomp_pools) ! - real(r8) :: conc_trcr(bounds%begc:bounds%endc,0:nlevdecomp+1) ! - real(r8) :: a_p_0 - real(r8) :: deficit - integer :: ntype - integer :: i_type,s,fc,c,j,l ! indices - integer :: jtop(bounds%begc:bounds%endc) ! top level at each column - real(r8) :: dtime ! land model time step (sec) - integer :: zerolev_diffus - real(r8) :: spinup_term ! spinup accelerated decomposition factor, used to accelerate transport as well - real(r8) :: epsilon ! small number - real(r8), pointer :: conc_ptr(:,:,:) ! pointer, concentration state variable being transported - real(r8), pointer :: source(:,:,:) ! pointer, source term - real(r8), pointer :: trcr_tendency_ptr(:,:,:) ! poiner, store the vertical tendency (gain/loss due to vertical transport) - !----------------------------------------------------------------------- - - ! Set statement functions - aaa (pe) = max (0._r8, (1._r8 - 0.1_r8 * abs(pe))**5) ! A function from Patankar, Table 5.2, pg 95 - - associate( & - is_cwd => decomp_cascade_con%is_cwd , & ! Input: [logical (:) ] TRUE => pool is a cwd pool - spinup_factor => decomp_cascade_con%spinup_factor , & ! Input: [real(r8) (:) ] spinup accelerated decomposition factor, used to accelerate transport as well - - altmax => canopystate_inst%altmax_col , & ! Input: [real(r8) (:) ] maximum annual depth of thaw - altmax_lastyear => canopystate_inst%altmax_lastyear_col , & ! Input: [real(r8) (:) ] prior year maximum annual depth of thaw - - som_adv_coef => soilbiogeochem_state_inst%som_adv_coef_col , & ! Output: [real(r8) (:,:) ] SOM advective flux (m/s) - som_diffus_coef => soilbiogeochem_state_inst%som_diffus_coef_col & ! Output: [real(r8) (:,:) ] SOM diffusivity due to bio/cryo-turbation (m2/s) - ) - - !Set parameters of vertical mixing of SOM - som_diffus = params_inst%som_diffus - cryoturb_diffusion_k = params_inst%cryoturb_diffusion_k - max_altdepth_cryoturbation = params_inst%max_altdepth_cryoturbation - - dtime = get_step_size() - - ntype = 2 - if ( use_c13 ) then - ntype = ntype+1 - endif - if ( use_c14 ) then - ntype = ntype+1 - endif - if ( use_fates ) then - ntype = 1 - endif - spinup_term = 1._r8 - epsilon = 1.e-30 - - if (use_vertsoilc) then - !------ first get diffusivity / advection terms -------! - ! use different mixing rates for bioturbation and cryoturbation, with fixed bioturbation and cryoturbation set to a maximum depth - do fc = 1, num_soilc - c = filter_soilc (fc) - if (( max(altmax(c), altmax_lastyear(c)) <= max_altdepth_cryoturbation ) .and. & - ( max(altmax(c), altmax_lastyear(c)) > 0._r8) ) then - ! use mixing profile modified slightly from Koven et al. (2009): constant through active layer, linear decrease from base of active layer to zero at a fixed depth - do j = 1,nlevdecomp+1 - if ( j <= col%nbedrock(c)+1 ) then - if ( zisoi(j) < max(altmax(c), altmax_lastyear(c)) ) then - som_diffus_coef(c,j) = cryoturb_diffusion_k - som_adv_coef(c,j) = 0._r8 - else - som_diffus_coef(c,j) = max(cryoturb_diffusion_k * & - ( 1._r8 - ( zisoi(j) - max(altmax(c), altmax_lastyear(c)) ) / & - ( min(max_depth_cryoturb, zisoi(col%nbedrock(c)+1)) - max(altmax(c), altmax_lastyear(c)) ) ), 0._r8) ! go linearly to zero between ALT and max_depth_cryoturb - som_adv_coef(c,j) = 0._r8 - endif - else - som_adv_coef(c,j) = 0._r8 - som_diffus_coef(c,j) = 0._r8 - endif - end do - elseif ( max(altmax(c), altmax_lastyear(c)) > 0._r8 ) then - ! constant advection, constant diffusion - do j = 1,nlevdecomp+1 - if ( j <= col%nbedrock(c)+1 ) then - som_adv_coef(c,j) = som_adv_flux - som_diffus_coef(c,j) = som_diffus - else - som_adv_coef(c,j) = 0._r8 - som_diffus_coef(c,j) = 0._r8 - endif - end do - else - ! completely frozen soils--no mixing - do j = 1,nlevdecomp+1 - som_adv_coef(c,j) = 0._r8 - som_diffus_coef(c,j) = 0._r8 - end do - endif - end do - - ! Set the distance between the node and the one ABOVE it - dz_node(1) = zsoi(1) - do j = 2,nlevdecomp+1 - dz_node(j)= zsoi(j) - zsoi(j-1) - enddo - - endif - - !------ loop over litter/som types - do i_type = 1, ntype - - select case (i_type) - case (1) ! C - conc_ptr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col - source => soilbiogeochem_carbonflux_inst%decomp_cpools_sourcesink_col - trcr_tendency_ptr => soilbiogeochem_carbonflux_inst%decomp_cpools_transport_tendency_col - case (2) ! N - if (use_cn ) then - conc_ptr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col - source => soilbiogeochem_nitrogenflux_inst%decomp_npools_sourcesink_col - trcr_tendency_ptr => soilbiogeochem_nitrogenflux_inst%decomp_npools_transport_tendency_col - endif - case (3) - if ( use_c13 ) then - ! C13 - conc_ptr => c13_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col - source => c13_soilbiogeochem_carbonflux_inst%decomp_cpools_sourcesink_col - trcr_tendency_ptr => c13_soilbiogeochem_carbonflux_inst%decomp_cpools_transport_tendency_col - else - ! C14 - conc_ptr => c14_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col - source => c14_soilbiogeochem_carbonflux_inst%decomp_cpools_sourcesink_col - trcr_tendency_ptr => c14_soilbiogeochem_carbonflux_inst%decomp_cpools_transport_tendency_col - endif - case (4) - if ( use_c14 .and. use_c13 ) then - ! C14 - conc_ptr => c14_soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col - source => c14_soilbiogeochem_carbonflux_inst%decomp_cpools_sourcesink_col - trcr_tendency_ptr => c14_soilbiogeochem_carbonflux_inst%decomp_cpools_transport_tendency_col - else - write(iulog,*) 'error. ncase = 4, but c13 and c14 not both enabled.' - call endrun(msg=errMsg(sourcefile, __LINE__)) - endif - end select - - if (use_vertsoilc) then - - do s = 1, ndecomp_pools - - if ( .not. is_cwd(s) ) then - - do j = 1,nlevdecomp+1 - do fc = 1, num_soilc - c = filter_soilc (fc) - ! - if ( spinup_state >= 1 ) then - ! increase transport (both advection and diffusion) by the same factor as accelerated decomposition for a given pool - spinup_term = spinup_factor(s) - else - spinup_term = 1._r8 - endif - - if (abs(spinup_term - 1._r8) > .000001_r8 ) then - spinup_term = spinup_term * get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - endif - - if ( abs(som_adv_coef(c,j)) * spinup_term < epsilon ) then - adv_flux(c,j) = epsilon - else - adv_flux(c,j) = som_adv_coef(c,j) * spinup_term - endif - ! - if ( abs(som_diffus_coef(c,j)) * spinup_term < epsilon ) then - diffus(c,j) = epsilon - else - diffus(c,j) = som_diffus_coef(c,j) * spinup_term - endif - ! - end do - end do - - ! Set Pe (Peclet #) and D/dz throughout column - - do fc = 1, num_soilc ! dummy terms here - c = filter_soilc (fc) - conc_trcr(c,0) = 0._r8 - conc_trcr(c,col%nbedrock(c)+1:nlevdecomp+1) = 0._r8 - end do - - - do j = 1,nlevdecomp+1 - do fc = 1, num_soilc - c = filter_soilc (fc) - - conc_trcr(c,j) = conc_ptr(c,j,s) - - ! dz_tracer below is the difference between gridcell edges (dzsoi_decomp) - ! dz_node_tracer is difference between cell centers - - ! Calculate the D and F terms in the Patankar algorithm - if (j == 1) then - d_m1_zm1(c,j) = 0._r8 - w_p1 = (zsoi(j+1) - zisoi(j)) / dz_node(j+1) - if ( diffus(c,j+1) > 0._r8 .and. diffus(c,j) > 0._r8) then - d_p1 = 1._r8 / ((1._r8 - w_p1) / diffus(c,j) + w_p1 / diffus(c,j+1)) ! Harmonic mean of diffus - else - d_p1 = 0._r8 - endif - d_p1_zp1(c,j) = d_p1 / dz_node(j+1) - f_m1(c,j) = adv_flux(c,j) ! Include infiltration here - f_p1(c,j) = adv_flux(c,j+1) - pe_m1(c,j) = 0._r8 - pe_p1(c,j) = f_p1(c,j) / d_p1_zp1(c,j) ! Peclet # - elseif (j >= col%nbedrock(c)+1) then - ! At the bottom, assume no gradient in d_z (i.e., they're the same) - w_m1 = (zisoi(j-1) - zsoi(j-1)) / dz_node(j) - if ( diffus(c,j) > 0._r8 .and. diffus(c,j-1) > 0._r8) then - d_m1 = 1._r8 / ((1._r8 - w_m1) / diffus(c,j) + w_m1 / diffus(c,j-1)) ! Harmonic mean of diffus - else - d_m1 = 0._r8 - endif - d_m1_zm1(c,j) = d_m1 / dz_node(j) - d_p1_zp1(c,j) = d_m1_zm1(c,j) ! Set to be the same - f_m1(c,j) = adv_flux(c,j) - !f_p1(c,j) = adv_flux(c,j+1) - f_p1(c,j) = 0._r8 - pe_m1(c,j) = f_m1(c,j) / d_m1_zm1(c,j) ! Peclet # - pe_p1(c,j) = f_p1(c,j) / d_p1_zp1(c,j) ! Peclet # - else - ! Use distance from j-1 node to interface with j divided by distance between nodes - w_m1 = (zisoi(j-1) - zsoi(j-1)) / dz_node(j) - if ( diffus(c,j-1) > 0._r8 .and. diffus(c,j) > 0._r8) then - d_m1 = 1._r8 / ((1._r8 - w_m1) / diffus(c,j) + w_m1 / diffus(c,j-1)) ! Harmonic mean of diffus - else - d_m1 = 0._r8 - endif - w_p1 = (zsoi(j+1) - zisoi(j)) / dz_node(j+1) - if ( diffus(c,j+1) > 0._r8 .and. diffus(c,j) > 0._r8) then - d_p1 = 1._r8 / ((1._r8 - w_p1) / diffus(c,j) + w_p1 / diffus(c,j+1)) ! Harmonic mean of diffus - else - d_p1 = (1._r8 - w_m1) * diffus(c,j) + w_p1 * diffus(c,j+1) ! Arithmetic mean of diffus - endif - d_m1_zm1(c,j) = d_m1 / dz_node(j) - d_p1_zp1(c,j) = d_p1 / dz_node(j+1) - f_m1(c,j) = adv_flux(c,j) - f_p1(c,j) = adv_flux(c,j+1) - pe_m1(c,j) = f_m1(c,j) / d_m1_zm1(c,j) ! Peclet # - pe_p1(c,j) = f_p1(c,j) / d_p1_zp1(c,j) ! Peclet # - end if - enddo ! fc - enddo ! j; nlevdecomp - - - ! Calculate the tridiagonal coefficients - do j = 0,nlevdecomp +1 - do fc = 1, num_soilc - c = filter_soilc (fc) - ! g = cgridcell(c) - - if (j > 0 .and. j < nlevdecomp+1) then - a_p_0 = dzsoi_decomp(j) / dtime - endif - - if (j == 0) then ! top layer (atmosphere) - a_tri(c,j) = 0._r8 - b_tri(c,j) = 1._r8 - c_tri(c,j) = -1._r8 - r_tri(c,j) = 0._r8 - elseif (j == 1) then - a_tri(c,j) = -(d_m1_zm1(c,j) * aaa(pe_m1(c,j)) + max( f_m1(c,j), 0._r8)) ! Eqn 5.47 Patankar - c_tri(c,j) = -(d_p1_zp1(c,j) * aaa(pe_p1(c,j)) + max(-f_p1(c,j), 0._r8)) - b_tri(c,j) = -a_tri(c,j) - c_tri(c,j) + a_p_0 - r_tri(c,j) = source(c,j,s) * dzsoi_decomp(j) /dtime + (a_p_0 - adv_flux(c,j)) * conc_trcr(c,j) - elseif (j < nlevdecomp+1) then - a_tri(c,j) = -(d_m1_zm1(c,j) * aaa(pe_m1(c,j)) + max( f_m1(c,j), 0._r8)) ! Eqn 5.47 Patankar - c_tri(c,j) = -(d_p1_zp1(c,j) * aaa(pe_p1(c,j)) + max(-f_p1(c,j), 0._r8)) - b_tri(c,j) = -a_tri(c,j) - c_tri(c,j) + a_p_0 - r_tri(c,j) = source(c,j,s) * dzsoi_decomp(j) /dtime + a_p_0 * conc_trcr(c,j) - else ! j==nlevdecomp+1; 0 concentration gradient at bottom - a_tri(c,j) = -1._r8 - b_tri(c,j) = 1._r8 - c_tri(c,j) = 0._r8 - r_tri(c,j) = 0._r8 - endif - enddo ! fc; column - enddo ! j; nlevdecomp - - do fc = 1, num_soilc - c = filter_soilc (fc) - jtop(c) = 0 - enddo - - ! subtract initial concentration and source terms for tendency calculation - do fc = 1, num_soilc - c = filter_soilc (fc) - do j = 1, nlevdecomp - trcr_tendency_ptr(c,j,s) = 0.-(conc_trcr(c,j) + source(c,j,s)) - end do - end do - - ! Solve for the concentration profile for this time step - call Tridiagonal(bounds, 0, nlevdecomp+1, & - jtop(bounds%begc:bounds%endc), & - num_soilc, filter_soilc, & - a_tri(bounds%begc:bounds%endc, :), & - b_tri(bounds%begc:bounds%endc, :), & - c_tri(bounds%begc:bounds%endc, :), & - r_tri(bounds%begc:bounds%endc, :), & - conc_trcr(bounds%begc:bounds%endc,0:nlevdecomp+1)) - - ! add post-transport concentration to calculate tendency term - do fc = 1, num_soilc - c = filter_soilc (fc) - do j = 1, nlevdecomp - trcr_tendency_ptr(c,j,s) = trcr_tendency_ptr(c,j,s) + conc_trcr(c,j) - trcr_tendency_ptr(c,j,s) = trcr_tendency_ptr(c,j,s) / dtime - end do - end do - - else - ! for CWD pools, just add - do j = 1,nlevdecomp - do fc = 1, num_soilc - c = filter_soilc (fc) - conc_trcr(c,j) = conc_ptr(c,j,s) + source(c,j,s) - if (j > col%nbedrock(c) .and. source(c,j,s) > 0._r8) then - write(iulog,*) 'source >0',c,j,s,source(c,j,s) - end if - if (j > col%nbedrock(c) .and. conc_ptr(c,j,s) > 0._r8) then - write(iulog,*) 'conc_ptr >0',c,j,s,conc_ptr(c,j,s) - end if - - end do - end do - - end if ! not CWD - - do j = 1,nlevdecomp - do fc = 1, num_soilc - c = filter_soilc (fc) - conc_ptr(c,j,s) = conc_trcr(c,j) - ! Correct for small amounts of carbon that leak into bedrock - if (j > col%nbedrock(c)) then - conc_ptr(c,col%nbedrock(c),s) = conc_ptr(c,col%nbedrock(c),s) + & - conc_trcr(c,j) * (dzsoi_decomp(j) / dzsoi_decomp(col%nbedrock(c))) - conc_ptr(c,j,s) = 0._r8 - end if - end do - end do - - end do ! s (pool loop) - - else - - !! for single level case, no transport; just update the fluxes calculated in the StateUpdate1 subroutines - do l = 1, ndecomp_pools - do j = 1,nlevdecomp - do fc = 1, num_soilc - c = filter_soilc (fc) - - conc_ptr(c,j,l) = conc_ptr(c,j,l) + source(c,j,l) - - trcr_tendency_ptr(c,j,l) = 0._r8 - - end do - end do - end do - - endif - - end do ! i_type - - end associate - - end subroutine SoilBiogeochemLittVertTransp - -end module SoilBiogeochemLittVertTranspMod diff --git a/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 b/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 deleted file mode 100644 index 3a0cb0c91b..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNLeachingMod.F90 +++ /dev/null @@ -1,289 +0,0 @@ -module SoilBiogeochemNLeachingMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for mineral nitrogen dynamics (deposition, fixation, leaching) - ! for coupled carbon-nitrogen code. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varcon , only : dzsoi_decomp, zisoi - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemNLeaching - ! - ! !PRIVATE DATA: - type, private :: params_type - real(r8):: sf ! soluble fraction of mineral N (unitless) - real(r8):: sf_no3 ! soluble fraction of NO3 (unitless) - end type params_type - - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read in parameters - ! - ! !USES: - use ncdio_pio , only : file_desc_t,ncd_io - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNNDynamicsParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='sf_minn' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%sf=tempr - - tString='sf_no3' - call ncd_io(varname=trim(tString),data=tempr, flag='read', ncid=ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%sf_no3=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemNLeaching(bounds, num_soilc, filter_soilc, & - waterstate_inst, waterflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update the nitrogen leaching rate - ! as a function of soluble mineral N and total soil water outflow. - ! - ! !USES: - use clm_varpar , only : nlevdecomp, nlevsoi - use clm_time_manager , only : get_step_size - ! - ! !ARGUMENTS: - 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 - type(waterstate_type) , intent(in) :: waterstate_inst - type(waterflux_type) , intent(in) :: waterflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: j,c,fc ! indices - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: sf ! soluble fraction of mineral N (unitless) - real(r8) :: sf_no3 ! soluble fraction of NO3 (unitless) - real(r8) :: disn_conc ! dissolved mineral N concentration (gN/kg water) - real(r8) :: tot_water(bounds%begc:bounds%endc) ! total column liquid water (kg water/m2) - real(r8) :: surface_water(bounds%begc:bounds%endc) ! liquid water to shallow surface depth (kg water/m2) - real(r8) :: drain_tot(bounds%begc:bounds%endc) ! total drainage flux (mm H2O /s) - real(r8), parameter :: depth_runoff_Nloss = 0.05 ! (m) depth over which runoff mixes with soil water for N loss to runoff - !----------------------------------------------------------------------- - - associate( & - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - - qflx_drain => waterflux_inst%qflx_drain_col , & ! Input: [real(r8) (:) ] sub-surface runoff (mm H2O /s) - qflx_surf => waterflux_inst%qflx_surf_col , & ! Input: [real(r8) (:) ] surface runoff (mm H2O /s) - - sminn_vr => soilbiogeochem_nitrogenstate_inst%sminn_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral N - smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] - - sminn_leached_vr => soilbiogeochem_nitrogenflux_inst%sminn_leached_vr_col , & ! Output: [real(r8) (:,:) ] rate of mineral N leaching (gN/m3/s) - smin_no3_leached_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_leached_vr_col , & ! Output: [real(r8) (:,:) ] rate of mineral NO3 leaching (gN/m3/s) - smin_no3_runoff_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_runoff_vr_col & ! Output: [real(r8) (:,:) ] rate of mineral NO3 loss with runoff (gN/m3/s) - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - if (.not. use_nitrif_denitrif) then - ! set constant sf - sf = params_inst%sf - else - ! Assume that 100% of the soil NO3 is in a soluble form - sf_no3 = params_inst%sf_no3 - end if - - ! calculate the total soil water - tot_water(bounds%begc:bounds%endc) = 0._r8 - do j = 1,nlevsoi - do fc = 1,num_soilc - c = filter_soilc(fc) - tot_water(c) = tot_water(c) + h2osoi_liq(c,j) - end do - end do - - ! for runoff calculation; calculate total water to a given depth - surface_water(bounds%begc:bounds%endc) = 0._r8 - do j = 1,nlevsoi - if ( zisoi(j) <= depth_runoff_Nloss) then - do fc = 1,num_soilc - c = filter_soilc(fc) - surface_water(c) = surface_water(c) + h2osoi_liq(c,j) - end do - elseif ( zisoi(j-1) < depth_runoff_Nloss) then - do fc = 1,num_soilc - c = filter_soilc(fc) - surface_water(c) = surface_water(c) + h2osoi_liq(c,j) * ( (depth_runoff_Nloss - zisoi(j-1)) / col%dz(c,j)) - end do - endif - end do - - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - drain_tot(c) = qflx_drain(c) - end do - - - if (.not. use_nitrif_denitrif) then - - !---------------------------------------- - ! --------- NITRIF_NITRIF OFF------------ - !---------------------------------------- - - do j = 1,nlevdecomp - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. use_vertsoilc) then - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (tot_water(c) > 0._r8) then - disn_conc = (sf * sminn_vr(c,j) ) / tot_water(c) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - sminn_leached_vr(c,j) = disn_conc * drain_tot(c) - else - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (h2osoi_liq(c,j) > 0._r8) then - disn_conc = (sf * sminn_vr(c,j) * col%dz(c,j) )/(h2osoi_liq(c,j) ) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - sminn_leached_vr(c,j) = disn_conc * drain_tot(c) * h2osoi_liq(c,j) / ( tot_water(c) * col%dz(c,j) ) - - end if - - ! limit the flux based on current sminn state - ! only let at most the assumed soluble fraction - ! of sminn be leached on any given timestep - sminn_leached_vr(c,j) = min(sminn_leached_vr(c,j), (sf * sminn_vr(c,j))/dt) - - ! limit the flux to a positive value - sminn_leached_vr(c,j) = max(sminn_leached_vr(c,j), 0._r8) - - end do - end do - - else - - !---------------------------------------- - ! --------- NITRIF_NITRIF ON------------- - !---------------------------------------- - - do j = 1,nlevdecomp - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (.not. use_vertsoilc) then - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (tot_water(c) > 0._r8) then - disn_conc = (sf_no3 * smin_no3_vr(c,j) )/tot_water(c) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - smin_no3_leached_vr(c,j) = disn_conc * drain_tot(c) - else - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (h2osoi_liq(c,j) > 0._r8) then - disn_conc = (sf_no3 * smin_no3_vr(c,j) * col%dz(c,j) )/(h2osoi_liq(c,j) ) - end if - ! - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - smin_no3_leached_vr(c,j) = disn_conc * drain_tot(c) * h2osoi_liq(c,j) / ( tot_water(c) * col%dz(c,j) ) - ! - ! ensure that leaching rate isn't larger than soil N pool - smin_no3_leached_vr(c,j) = min(smin_no3_leached_vr(c,j), smin_no3_vr(c,j) / dt ) - ! - ! limit the leaching flux to a positive value - smin_no3_leached_vr(c,j) = max(smin_no3_leached_vr(c,j), 0._r8) - ! - ! - ! calculate the N loss from surface runoff, assuming a shallow mixing of surface waters into soil and removal based on runoff - if ( zisoi(j) <= depth_runoff_Nloss ) then - smin_no3_runoff_vr(c,j) = disn_conc * qflx_surf(c) * & - h2osoi_liq(c,j) / ( surface_water(c) * col%dz(c,j) ) - elseif ( zisoi(j-1) < depth_runoff_Nloss ) then - smin_no3_runoff_vr(c,j) = disn_conc * qflx_surf(c) * & - h2osoi_liq(c,j) * ((depth_runoff_Nloss - zisoi(j-1)) / & - col%dz(c,j)) / ( surface_water(c) * (depth_runoff_Nloss-zisoi(j-1) )) - else - smin_no3_runoff_vr(c,j) = 0._r8 - endif - ! - ! ensure that runoff rate isn't larger than soil N pool - smin_no3_runoff_vr(c,j) = min(smin_no3_runoff_vr(c,j), smin_no3_vr(c,j) / dt - smin_no3_leached_vr(c,j)) - ! - ! limit the flux to a positive value - smin_no3_runoff_vr(c,j) = max(smin_no3_runoff_vr(c,j), 0._r8) - - - endif - ! limit the flux based on current smin_no3 state - ! only let at most the assumed soluble fraction - ! of smin_no3 be leached on any given timestep - smin_no3_leached_vr(c,j) = min(smin_no3_leached_vr(c,j), (sf_no3 * smin_no3_vr(c,j))/dt) - - ! limit the flux to a positive value - smin_no3_leached_vr(c,j) = max(smin_no3_leached_vr(c,j), 0._r8) - - end do - end do - endif - - end associate - - end subroutine SoilBiogeochemNLeaching - -end module SoilBiogeochemNLeachingMod diff --git a/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 b/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 deleted file mode 100644 index 5fde16787c..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNStateUpdate1Mod.F90 +++ /dev/null @@ -1,267 +0,0 @@ -module SoilBiogeochemNStateUpdate1Mod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module for nitrogen state variable updates, non-mortality fluxes. - ! - ! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevdecomp, ndecomp_pools, ndecomp_cascade_transitions - use clm_varpar , only : i_met_lit, i_cel_lit, i_lig_lit, i_cwd - use clm_varctl , only : iulog, use_nitrif_denitrif, use_crop - use clm_varcon , only : nitrif_n2o_loss_frac, dzsoi_decomp - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenfluxType , only : soilbiogeochem_nitrogenflux_type - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use CNSharedParamsMod , only : use_fun - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: SoilBiogeochemNStateUpdate1 - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemNStateUpdate1(num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_nitrogenflux_inst, soilbiogeochem_nitrogenstate_inst) - ! - ! !DESCRIPTION: - ! On the radiation time step, update all the prognostic nitrogen state - ! variables (except for gap-phase mortality and fire fluxes) - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_state_type) , intent(in) :: soilbiogeochem_state_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,p,j,l,k ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - - !----------------------------------------------------------------------- - - associate( & - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step - - ndep_prof => soilbiogeochem_state_inst%ndep_prof_col , & ! Input: [real(r8) (:,:) ] profile over which N deposition is distributed through column (1/m) - nfixation_prof => soilbiogeochem_state_inst%nfixation_prof_col , & ! Input: [real(r8) (:,:) ] profile over which N fixation is distributed through column (1/m) - - nf => soilbiogeochem_nitrogenflux_inst , & ! Output: - ns => soilbiogeochem_nitrogenstate_inst & ! Output: - ) - - ! set time steps - dt = real( get_step_size(), r8 ) - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if(use_fun)then !RF in FUN logic, the fixed N goes straight into the plant, and not into the SMINN pool. - ! N deposition and fixation (put all into NH4 pool) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + nf%ndep_to_sminn_col(c)*dt * ndep_prof(c,j) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + nf%ffix_to_sminn_col(c)*dt * nfixation_prof(c,j) - else - if (.not. use_nitrif_denitrif) then - - ! N deposition and fixation - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) + nf%ndep_to_sminn_col(c)*dt * ndep_prof(c,j) - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) + nf%nfix_to_sminn_col(c)*dt * nfixation_prof(c,j) - - else - - ! N deposition and fixation (put all into NH4 pool) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + nf%ndep_to_sminn_col(c)*dt * ndep_prof(c,j) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + nf%nfix_to_sminn_col(c)*dt * nfixation_prof(c,j) - - end if - end if - - end do - - end do - - ! repeating N dep and fixation for crops - if ( use_crop )then - do j = 1, nlevdecomp - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - if (.not. use_nitrif_denitrif) then - - ! N deposition and fixation - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) & - + nf%fert_to_sminn_col(c)*dt * ndep_prof(c,j) - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) & - + nf%soyfixn_to_sminn_col(c)*dt * nfixation_prof(c,j) - - else - - ! N deposition and fixation (put all into NH4 pool) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) & - + nf%fert_to_sminn_col(c)*dt * ndep_prof(c,j) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) & - + nf%soyfixn_to_sminn_col(c)*dt * nfixation_prof(c,j) - - end if - end do - end do - end if - - ! decomposition fluxes - do k = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - nf%decomp_npools_sourcesink_col(c,j,cascade_donor_pool(k)) = & - nf%decomp_npools_sourcesink_col(c,j,cascade_donor_pool(k)) - & - nf%decomp_cascade_ntransfer_vr_col(c,j,k) * dt - end do - end do - end do - do k = 1, ndecomp_cascade_transitions - if ( cascade_receiver_pool(k) /= 0 ) then ! skip terminal transitions - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - nf%decomp_npools_sourcesink_col(c,j,cascade_receiver_pool(k)) = & - nf%decomp_npools_sourcesink_col(c,j,cascade_receiver_pool(k)) + & - (nf%decomp_cascade_ntransfer_vr_col(c,j,k) + & - nf%decomp_cascade_sminn_flux_vr_col(c,j,k)) * dt - end do - end do - else ! terminal transitions - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - nf%decomp_npools_sourcesink_col(c,j,cascade_donor_pool(k)) = & - nf%decomp_npools_sourcesink_col(c,j,cascade_donor_pool(k)) - & - nf%decomp_cascade_sminn_flux_vr_col(c,j,k) * dt - end do - end do - end if - end do - - if (.not. use_nitrif_denitrif) then - - !-------------------------------------------------------- - !------------- NITRIF_DENITRIF OFF ------------------- - !-------------------------------------------------------- - - ! immobilization/mineralization in litter-to-SOM and SOM-to-SOM fluxes and denitrification fluxes - do k = 1, ndecomp_cascade_transitions - if ( cascade_receiver_pool(k) /= 0 ) then ! skip terminal transitions - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) - & - (nf%sminn_to_denit_decomp_cascade_vr_col(c,j,k) + & - nf%decomp_cascade_sminn_flux_vr_col(c,j,k))* dt - end do - end do - else - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) - & - nf%sminn_to_denit_decomp_cascade_vr_col(c,j,k)* dt - - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) + & - nf%decomp_cascade_sminn_flux_vr_col(c,j,k)* dt - - end do - end do - endif - end do - - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - ! "bulk denitrification" - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) - nf%sminn_to_denit_excess_vr_col(c,j) * dt - - ! total plant uptake from mineral N - if ( .not. use_fun ) then - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) - nf%sminn_to_plant_vr_col(c,j)*dt - else - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) - nf%sminn_to_plant_fun_vr_col(c,j)*dt - end if - ! flux that prevents N limitation (when Carbon_only is set) - ns%sminn_vr_col(c,j) = ns%sminn_vr_col(c,j) + nf%supplement_to_sminn_vr_col(c,j)*dt - end do - end do - - else - - !-------------------------------------------------------- - !------------- NITRIF_DENITRIF ON -------------------- - !-------------------------------------------------------- - - do j = 1, nlevdecomp - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! mineralization fluxes (divert a fraction of this stream to nitrification flux, add the rest to NH4 pool) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + nf%gross_nmin_vr_col(c,j)*dt - - ! immobilization fluxes - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%actual_immob_nh4_vr_col(c,j)*dt - - ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) - nf%actual_immob_no3_vr_col(c,j)*dt - - ! plant uptake fluxes - if ( .not. use_fun )then - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%smin_nh4_to_plant_vr_col(c,j)*dt - - ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) - nf%smin_no3_to_plant_vr_col(c,j)*dt - else - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%sminn_to_plant_fun_nh4_vr_col(c,j)*dt - - ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) - nf%sminn_to_plant_fun_no3_vr_col(c,j)*dt - end if - - - ! Account for nitrification fluxes - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) - nf%f_nit_vr_col(c,j) * dt - - ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) + nf%f_nit_vr_col(c,j) * dt & - * (1._r8 - nitrif_n2o_loss_frac) - - ! Account for denitrification fluxes - ns%smin_no3_vr_col(c,j) = ns%smin_no3_vr_col(c,j) - nf%f_denit_vr_col(c,j) * dt - - ! flux that prevents N limitation (when Carbon_only is set; put all into NH4) - ns%smin_nh4_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + nf%supplement_to_sminn_vr_col(c,j)*dt - - ! update diagnostic total - ns%sminn_vr_col(c,j) = ns%smin_nh4_vr_col(c,j) + ns%smin_no3_vr_col(c,j) - - end do ! end of column loop - end do - - end if - - end associate - - end subroutine SoilBiogeochemNStateUpdate1 - -end module SoilBiogeochemNStateUpdate1Mod diff --git a/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 b/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 deleted file mode 100644 index 4286b14c4a..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrifDenitrifMod.F90 +++ /dev/null @@ -1,469 +0,0 @@ -module SoilBiogeochemNitrifDenitrifMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate nitrification and denitrification rates - ! - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod , only : SHR_CONST_TKFRZ - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : nlevdecomp - use clm_varcon , only : rpi, grav - use clm_varcon , only : d_con_g, d_con_w, secspday - use clm_varctl , only : use_lch4 - use abortutils , only : endrun - use decompMod , only : bounds_type - use SoilStatetype , only : soilstate_type - use WaterStateType , only : waterstate_type - use TemperatureType , only : temperature_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use ch4Mod , only : ch4_type - use ColumnType , only : col - ! - implicit none - private - ! - public :: readParams ! Read in parameters from params file - public :: nitrifReadNML ! Read in namelist - public :: SoilBiogeochemNitrifDenitrif ! Calculate nitrification and - ! - type, private :: params_type - real(r8) :: k_nitr_max ! maximum nitrification rate constant (1/s) - real(r8) :: surface_tension_water ! surface tension of water(J/m^2), Arah an and Vinten 1995 - real(r8) :: rij_kro_a ! Arah and Vinten 1995) - real(r8) :: rij_kro_alpha ! parameter to calculate anoxic fraction of soil (Arah and Vinten 1995) - real(r8) :: rij_kro_beta ! (Arah and Vinten 1995) - real(r8) :: rij_kro_gamma ! (Arah and Vinten 1995) - real(r8) :: rij_kro_delta ! (Arah and Vinten 1995) - real(r8) :: denitrif_respiration_coefficient ! Multiplier for heterotrophic respiration for max denitrif rates - real(r8) :: denitrif_respiration_exponent ! Exponents for heterotrophic respiration for max denitrif rates - real(r8) :: denitrif_nitrateconc_coefficient ! Multiplier for nitrate concentration for max denitrif rates - real(r8) :: denitrif_nitrateconc_exponent ! Exponent for nitrate concentration for max denitrif rates - end type params_type - - type(params_type), private :: params_inst - - logical, public :: no_frozen_nitrif_denitrif = .false. ! stop nitrification and denitrification in frozen soils - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - use ncdio_pio, only: file_desc_t,ncd_io - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNNitrifDenitrifParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - ! - ! read in constants - ! - tString='surface_tension_water' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%surface_tension_water=tempr - - tString='rij_kro_a' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_a=tempr - - tString='rij_kro_alpha' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_alpha=tempr - - tString='rij_kro_beta' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_beta=tempr - - tString='rij_kro_gamma' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_gamma=tempr - - tString='rij_kro_delta' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%rij_kro_delta=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine nitrifReadNML( NLFilename ) - ! - ! !DESCRIPTION: - ! Read the namelist for nitrification/denitrification - ! - ! !USES: - use fileutils , only : getavu, relavu, opnfil - use shr_nl_mod , only : shr_nl_find_group_name - use spmdMod , only : masterproc, mpicom - use shr_mpi_mod , only : shr_mpi_bcast - use clm_varctl , only : iulog - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: NLFilename ! Namelist filename - ! - ! !LOCAL VARIABLES: - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - - character(len=*), parameter :: subname = 'ReadNML' - character(len=*), parameter :: nmlname = 'nitrif_inparm' - !----------------------------------------------------------------------- - real(r8) :: k_nitr_max_perday, denitrif_respiration_coefficient, & - denitrif_respiration_exponent, denitrif_nitrateconc_coefficient, & - denitrif_nitrateconc_exponent - - namelist /nitrif_inparm/ k_nitr_max_perday, denitrif_respiration_coefficient, & - denitrif_respiration_exponent, denitrif_nitrateconc_coefficient, & - denitrif_nitrateconc_exponent - - ! Initialize options to default values, in case they are not specified in - ! the namelist - - - denitrif_respiration_coefficient = 0.1_r8 - denitrif_respiration_exponent = 1.3_r8 - denitrif_nitrateconc_coefficient = 1.15_r8 - denitrif_nitrateconc_exponent = 0.57_r8 - - k_nitr_max_perday = 0.1_r8 - if (masterproc) then - unitn = getavu() - write(iulog,*) 'Read in '//nmlname//' namelist' - call opnfil (NLFilename, unitn, 'F') - call shr_nl_find_group_name(unitn, nmlname, status=ierr) - if (ierr == 0) then - read(unitn, nml=nitrif_inparm, iostat=ierr) - if (ierr /= 0) then - call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) - end if - call relavu( unitn ) - end if - - call shr_mpi_bcast (k_nitr_max_perday , mpicom) - call shr_mpi_bcast (denitrif_respiration_coefficient , mpicom) - call shr_mpi_bcast (denitrif_respiration_exponent , mpicom) - call shr_mpi_bcast (denitrif_nitrateconc_coefficient , mpicom) - call shr_mpi_bcast (denitrif_nitrateconc_exponent , mpicom) - - params_inst%k_nitr_max = k_nitr_max_perday / secspday ! Change units to per second - params_inst%denitrif_respiration_coefficient = denitrif_respiration_coefficient - params_inst%denitrif_respiration_exponent = denitrif_respiration_exponent - params_inst%denitrif_nitrateconc_coefficient = denitrif_nitrateconc_coefficient - params_inst%denitrif_nitrateconc_exponent = denitrif_nitrateconc_exponent - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) nmlname//' settings:' - write(iulog,nml=nitrif_inparm) - write(iulog,*) ' ' - end if - - end subroutine nitrifReadNML - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemNitrifDenitrif(bounds, num_soilc, filter_soilc, & - soilstate_inst, waterstate_inst, temperature_inst, ch4_inst, & - soilbiogeochem_carbonflux_inst, soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst) - ! - ! !DESCRIPTION: - ! calculate nitrification and denitrification rates - ! - ! !USES: - use clm_time_manager , only : get_curr_date, get_step_size - use CNSharedParamsMod , only : anoxia_wtsat, CNParamsShareInst - ! - ! !ARGUMENTS: - 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 - type(soilstate_type) , intent(in) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(ch4_type) , intent(in) :: ch4_inst - type(soilbiogeochem_carbonflux_type) , intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(in) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - ! - ! !LOCAL VARIABLES: - integer :: c, fc, reflev, j - real(r8) :: soil_hr_vr(bounds%begc:bounds%endc,1:nlevdecomp) ! total soil respiration rate (g C / m3 / s) - real(r8) :: g_per_m3__to__ug_per_gsoil - real(r8) :: g_per_m3_sec__to__ug_per_gsoil_day - real(r8) :: mu, sigma - real(r8) :: t - real(r8) :: pH(bounds%begc:bounds%endc) - !debug-- put these type structure for outing to hist files - real(r8) :: co2diff_con(2) ! diffusion constants for CO2 - real(r8) :: eps - real(r8) :: f_a - real(r8) :: surface_tension_water ! (J/m^2), Arah and Vinten 1995 - real(r8) :: rij_kro_a ! Arah and Vinten 1995 - real(r8) :: rij_kro_alpha ! Arah and Vinten 1995 - real(r8) :: rij_kro_beta ! Arah and Vinten 1995 - real(r8) :: rij_kro_gamma ! Arah and Vinten 1995 - real(r8) :: rij_kro_delta ! Arah and Vinten 1995 - real(r8) :: rho_w = 1.e3_r8 ! (kg/m3) - real(r8) :: r_max - real(r8) :: r_min(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: ratio_diffusivity_water_gas(bounds%begc:bounds%endc,1:nlevdecomp) - real(r8) :: om_frac - real(r8) :: anaerobic_frac_sat, r_psi_sat, r_min_sat ! scalar values in sat portion for averaging - real(r8) :: organic_max ! organic matter content (kg/m3) where - ! soil is assumed to act like peat - character(len=32) :: subname='nitrif_denitrif' ! subroutine name - !----------------------------------------------------------------------- - - associate( & - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) (nlevgrnd) - watfc => soilstate_inst%watfc_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at field capacity (nlevsoi) - bd => soilstate_inst%bd_col , & ! Input: [real(r8) (:,:) ] bulk density of dry soil material [kg/m3] - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" (nlevgrnd) - cellorg => soilstate_inst%cellorg_col , & ! Input: [real(r8) (:,:) ] column 3D org (kg/m3 organic matter) (nlevgrnd) - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - soilpsi => soilstate_inst%soilpsi_col , & ! Input: [real(r8) (:,:) ] soil water potential in each soil layer (MPa) - - h2osoi_vol => waterstate_inst%h2osoi_vol_col , & ! Input: [real(r8) (:,:) ] volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - h2osoi_liq => waterstate_inst%h2osoi_liq_col , & ! Input: [real(r8) (:,:) ] liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - - o2_decomp_depth_unsat => ch4_inst%o2_decomp_depth_unsat_col , & ! Input: [real(r8) (:,:) ] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - conc_o2_unsat => ch4_inst%conc_o2_unsat_col , & ! Input: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - o2_decomp_depth_sat => ch4_inst%o2_decomp_depth_sat_col , & ! Input: [real(r8) (:,:) ] O2 consumption during decomposition in each soil layer (nlevsoi) (mol/m3/s) - conc_o2_sat => ch4_inst%conc_o2_sat_col , & ! Input: [real(r8) (:,:) ] O2 conc in each soil layer (mol/m3) (nlevsoi) - finundated => ch4_inst%finundated_col , & ! Input: [real(r8) (:) ] fractional inundated area in soil column (excluding dedicated wetland columns) - - smin_nh4_vr => soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NH4 pool - smin_no3_vr => soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col , & ! Input: [real(r8) (:,:) ] (gN/m3) soil mineral NO3 pool - - phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Input: [real(r8) (:,:) ] potential hr (not N-limited) - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] soil water scalar for decomp - t_scalar => soilbiogeochem_carbonflux_inst%t_scalar_col , & ! Input: [real(r8) (:,:) ] temperature scalar for decomp - denit_resp_coef => params_inst%denitrif_respiration_coefficient , & ! Input: [real(r8) ] coefficient for max denitrification rate based on respiration - denit_resp_exp => params_inst%denitrif_respiration_exponent , & ! Input: [real(r8) ] exponent for max denitrification rate based on respiration - denit_nitrate_coef => params_inst%denitrif_nitrateconc_coefficient , & ! Input: [real(r8) ] coefficient for max denitrification rate based on nitrate concentration - denit_nitrate_exp => params_inst%denitrif_nitrateconc_exponent , & ! Input: [real(r8) ] exponent for max denitrification rate based on nitrate concentration - k_nitr_max => params_inst%k_nitr_max , & ! Input: - - r_psi => soilbiogeochem_nitrogenflux_inst%r_psi_col , & ! Output: [real(r8) (:,:) ] - anaerobic_frac => soilbiogeochem_nitrogenflux_inst%anaerobic_frac_col , & ! Output: [real(r8) (:,:) ] - ! ! subsets of the n flux calcs (for diagnostic/debugging purposes) - smin_no3_massdens_vr => soilbiogeochem_nitrogenflux_inst%smin_no3_massdens_vr_col , & ! Output: [real(r8) (:,:) ] (ugN / g soil) soil nitrate concentration - k_nitr_t_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_t_vr_col , & ! Output: [real(r8) (:,:) ] - k_nitr_ph_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_ph_vr_col , & ! Output: [real(r8) (:,:) ] - k_nitr_h2o_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_h2o_vr_col , & ! Output: [real(r8) (:,:) ] - k_nitr_vr => soilbiogeochem_nitrogenflux_inst%k_nitr_vr_col , & ! Output: [real(r8) (:,:) ] - wfps_vr => soilbiogeochem_nitrogenflux_inst%wfps_vr_col , & ! Output: [real(r8) (:,:) ] - fmax_denit_carbonsubstrate_vr => soilbiogeochem_nitrogenflux_inst%fmax_denit_carbonsubstrate_vr_col , & ! Output: [real(r8) (:,:) ] - fmax_denit_nitrate_vr => soilbiogeochem_nitrogenflux_inst%fmax_denit_nitrate_vr_col , & ! Output: [real(r8) (:,:) ] - f_denit_base_vr => soilbiogeochem_nitrogenflux_inst%f_denit_base_vr_col , & ! Output: [real(r8) (:,:) ] - diffus => soilbiogeochem_nitrogenflux_inst%diffus_col , & ! Output: [real(r8) (:,:) ] diffusivity (unitless fraction of total diffusivity) - ratio_k1 => soilbiogeochem_nitrogenflux_inst%ratio_k1_col , & ! Output: [real(r8) (:,:) ] - ratio_no3_co2 => soilbiogeochem_nitrogenflux_inst%ratio_no3_co2_col , & ! Output: [real(r8) (:,:) ] - soil_co2_prod => soilbiogeochem_nitrogenflux_inst%soil_co2_prod_col , & ! Output: [real(r8) (:,:) ] (ug C / g soil / day) - fr_WFPS => soilbiogeochem_nitrogenflux_inst%fr_WFPS_col , & ! Output: [real(r8) (:,:) ] - soil_bulkdensity => soilbiogeochem_nitrogenflux_inst%soil_bulkdensity_col , & ! Output: [real(r8) (:,:) ] (kg soil / m3) bulk density of soil (including water) - pot_f_nit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_nit_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3/s) potential soil nitrification flux - - pot_f_denit_vr => soilbiogeochem_nitrogenflux_inst%pot_f_denit_vr_col , & ! Output: [real(r8) (:,:) ] (gN/m3/s) potential soil denitrification flux - n2_n2o_ratio_denit_vr => soilbiogeochem_nitrogenflux_inst%n2_n2o_ratio_denit_vr_col & ! Output: [real(r8) (:,:) ] ratio of N2 to N2O production by denitrification [gN/gN] - ) - - surface_tension_water = params_inst%surface_tension_water - - ! Set parameters from simple-structure model to calculate anoxic fratction (Arah and Vinten 1995) - rij_kro_a = params_inst%rij_kro_a - rij_kro_alpha = params_inst%rij_kro_alpha - rij_kro_beta = params_inst%rij_kro_beta - rij_kro_gamma = params_inst%rij_kro_gamma - rij_kro_delta = params_inst%rij_kro_delta - - organic_max = CNParamsShareInst%organic_max - - pH(bounds%begc:bounds%endc) = 6.5 !!! set all soils with the same pH as placeholder here - co2diff_con(1) = 0.1325_r8 - co2diff_con(2) = 0.0009_r8 - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - !---------------- calculate soil anoxia state - ! calculate gas diffusivity of soil at field capacity here - ! use expression from methane code, but neglect OM for now - f_a = 1._r8 - watfc(c,j) / watsat(c,j) - eps = watsat(c,j)-watfc(c,j) ! Air-filled fraction of total soil volume - - ! use diffusivity calculation including peat - if (use_lch4) then - - if (organic_max > 0._r8) then - om_frac = min(cellorg(c,j)/organic_max, 1._r8) - ! Use first power, not square as in iniTimeConst - else - om_frac = 1._r8 - end if - diffus (c,j) = (d_con_g(2,1) + d_con_g(2,2)*t_soisno(c,j)) * 1.e-4_r8 * & - (om_frac * f_a**(10._r8/3._r8) / watsat(c,j)**2 + & - (1._r8-om_frac) * eps**2 * f_a**(3._r8 / bsw(c,j)) ) - - ! calculate anoxic fraction of soils - ! use rijtema and kroess model after Riley et al., 2000 - ! caclulated r_psi as a function of psi - r_min(c,j) = 2 * surface_tension_water / (rho_w * grav * abs(soilpsi(c,j))) - r_max = 2 * surface_tension_water / (rho_w * grav * 0.1_r8) - r_psi(c,j) = sqrt(r_min(c,j) * r_max) - ratio_diffusivity_water_gas(c,j) = (d_con_g(2,1) + d_con_g(2,2)*t_soisno(c,j) ) * 1.e-4_r8 / & - ((d_con_w(2,1) + d_con_w(2,2)*t_soisno(c,j) + d_con_w(2,3)*t_soisno(c,j)**2) * 1.e-9_r8) - - if (o2_decomp_depth_unsat(c,j) > 0._r8) then - anaerobic_frac(c,j) = exp(-rij_kro_a * r_psi(c,j)**(-rij_kro_alpha) * & - o2_decomp_depth_unsat(c,j)**(-rij_kro_beta) * & - conc_o2_unsat(c,j)**rij_kro_gamma * (h2osoi_vol(c,j) + ratio_diffusivity_water_gas(c,j) * & - watsat(c,j))**rij_kro_delta) - else - anaerobic_frac(c,j) = 0._r8 - endif - - if (anoxia_wtsat) then ! Average saturated fraction values into anaerobic_frac(c,j). - r_min_sat = 2._r8 * surface_tension_water / (rho_w * grav * abs(grav * 1.e-6_r8 * sucsat(c,j))) - r_psi_sat = sqrt(r_min_sat * r_max) - if (o2_decomp_depth_sat(c,j) > 0._r8) then - anaerobic_frac_sat = exp(-rij_kro_a * r_psi_sat**(-rij_kro_alpha) * & - o2_decomp_depth_sat(c,j)**(-rij_kro_beta) * & - conc_o2_sat(c,j)**rij_kro_gamma * (watsat(c,j) + ratio_diffusivity_water_gas(c,j) * & - watsat(c,j))**rij_kro_delta) - else - anaerobic_frac_sat = 0._r8 - endif - anaerobic_frac(c,j) = (1._r8 - finundated(c))*anaerobic_frac(c,j) + finundated(c)*anaerobic_frac_sat - end if - - else - ! NITRIF_DENITRIF requires Methane model to be active, - ! otherwise diffusivity will be zeroed out here. EBK CDK 10/18/2011 - anaerobic_frac(c,j) = 0._r8 - diffus (c,j) = 0._r8 - !call endrun(msg=' ERROR: NITRIF_DENITRIF requires Methane model to be active'//errMsg(sourcefile, __LINE__) ) - end if - - - !---------------- nitrification - ! follows CENTURY nitrification scheme (Parton et al., (2001, 1996)) - - ! assume nitrification temp function equal to the HR scalar - k_nitr_t_vr(c,j) = min(t_scalar(c,j), 1._r8) - - ! ph function from Parton et al., (2001, 1996) - k_nitr_ph_vr(c,j) = 0.56 + atan(rpi * 0.45 * (-5.+ pH(c)))/rpi - - ! moisture function-- assume the same moisture function as limits heterotrophic respiration - ! Parton et al. base their nitrification- soil moisture rate constants based on heterotrophic rates-- can we do the same? - k_nitr_h2o_vr(c,j) = w_scalar(c,j) - - ! nitrification constant is a set scalar * temp, moisture, and ph scalars - k_nitr_vr(c,j) = k_nitr_max * k_nitr_t_vr(c,j) * k_nitr_h2o_vr(c,j) * k_nitr_ph_vr(c,j) - - ! first-order decay of ammonium pool with scalar defined above - pot_f_nit_vr(c,j) = max(smin_nh4_vr(c,j) * k_nitr_vr(c,j), 0._r8) - - ! limit to oxic fraction of soils - pot_f_nit_vr(c,j) = pot_f_nit_vr(c,j) * (1._r8 - anaerobic_frac(c,j)) - - ! limit to non-frozen soil layers - if ( t_soisno(c,j) <= SHR_CONST_TKFRZ .and. no_frozen_nitrif_denitrif) then - pot_f_nit_vr(c,j) = 0._r8 - endif - - - !---------------- denitrification - ! first some input variables an unit conversions - soil_hr_vr(c,j) = phr_vr(c,j) - - ! CENTURY papers give denitrification in units of per gram soil; need to convert from volumetric to mass-based units here - soil_bulkdensity(c,j) = bd(c,j) + h2osoi_liq(c,j)/col%dz(c,j) - - g_per_m3__to__ug_per_gsoil = 1.e3_r8 / soil_bulkdensity(c,j) - - g_per_m3_sec__to__ug_per_gsoil_day = g_per_m3__to__ug_per_gsoil * secspday - - smin_no3_massdens_vr(c,j) = max(smin_no3_vr(c,j), 0._r8) * g_per_m3__to__ug_per_gsoil - - soil_co2_prod(c,j) = (soil_hr_vr(c,j) * (g_per_m3_sec__to__ug_per_gsoil_day)) - - !! maximum potential denitrification rates based on heterotrophic respiration rates or nitrate concentrations, - !! from (del Grosso et al., 2000) - fmax_denit_carbonsubstrate_vr(c,j) = (denit_resp_coef * (soil_co2_prod(c,j)**denit_resp_exp)) & - / g_per_m3_sec__to__ug_per_gsoil_day - ! - fmax_denit_nitrate_vr(c,j) = (denit_nitrate_coef * smin_no3_massdens_vr(c,j)**denit_nitrate_exp) & - / g_per_m3_sec__to__ug_per_gsoil_day - - ! find limiting denitrification rate - f_denit_base_vr(c,j) = max(min(fmax_denit_carbonsubstrate_vr(c,j), fmax_denit_nitrate_vr(c,j)),0._r8) - - ! limit to non-frozen soil layers - if ( t_soisno(c,j) <= SHR_CONST_TKFRZ .and. no_frozen_nitrif_denitrif ) then - f_denit_base_vr(c,j) = 0._r8 - endif - - ! limit to anoxic fraction of soils - pot_f_denit_vr(c,j) = f_denit_base_vr(c,j) * anaerobic_frac(c,j) - - ! now calculate the ratio of N2O to N2 from denitrifictaion, following Del Grosso et al., 2000 - ! diffusivity constant (figure 6b) - ratio_k1(c,j) = max(1.7_r8, 38.4_r8 - 350._r8 * diffus(c,j)) - - ! ratio function (figure 7c) - if ( soil_co2_prod(c,j) > 1.0e-9_r8 ) then - ratio_no3_co2(c,j) = smin_no3_massdens_vr(c,j) / soil_co2_prod(c,j) - else - ! fucntion saturates at large no3/co2 ratios, so set as some nominally large number - ratio_no3_co2(c,j) = 100._r8 - endif - - ! total water limitation function (Del Grosso et al., 2000, figure 7a) - wfps_vr(c,j) = max(min(h2osoi_vol(c,j)/watsat(c, j), 1._r8), 0._r8) * 100._r8 - fr_WFPS(c,j) = max(0.1_r8, 0.015_r8 * wfps_vr(c,j) - 0.32_r8) - if (use_lch4) then - if (anoxia_wtsat) then - fr_WFPS(c,j) = fr_WFPS(c,j)*(1._r8 - finundated(c)) + finundated(c)*1.18_r8 - end if - end if - - ! final ratio expression - n2_n2o_ratio_denit_vr(c,j) = max(0.16*ratio_k1(c,j), ratio_k1(c,j)*exp(-0.8 * ratio_no3_co2(c,j))) * fr_WFPS(c,j) - - end do - - end do - - end associate - - end subroutine SoilBiogeochemNitrifDenitrif - -end module SoilBiogeochemNitrifDenitrifMod diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 deleted file mode 100644 index 49371a8c9d..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrogenFluxType.F90 +++ /dev/null @@ -1,1279 +0,0 @@ -module SoilBiogeochemNitrogenFluxType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp_full, nlevdecomp - use clm_varcon , only : spval, ispval, dzsoi_decomp - use decompMod , only : bounds_type - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_crop - use CNSharedParamsMod , only : use_fun - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use abortutils , only : endrun - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - private - ! - type, public :: SoilBiogeochem_nitrogenflux_type - - ! deposition fluxes - real(r8), pointer :: ndep_to_sminn_col (:) ! col atmospheric N deposition to soil mineral N (gN/m2/s) - real(r8), pointer :: nfix_to_sminn_col (:) ! col symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - real(r8), pointer :: ffix_to_sminn_col (:) ! col free living N fixation to soil mineral N (gN/m2/s) - real(r8), pointer :: fert_to_sminn_col (:) ! col fertilizer N to soil mineral N (gN/m2/s) - real(r8), pointer :: soyfixn_to_sminn_col (:) ! col soybean fixation to soil mineral N (gN/m2/s) - - ! decomposition fluxes - real(r8), pointer :: decomp_cascade_ntransfer_vr_col (:,:,:) ! col vert-res transfer of N from donor to receiver pool along decomp. cascade (gN/m3/s) - real(r8), pointer :: decomp_cascade_ntransfer_col (:,:) ! col vert-int (diagnostic) transfer of N from donor to receiver pool along decomp. cascade (gN/m2/s) - real(r8), pointer :: decomp_cascade_sminn_flux_vr_col (:,:,:) ! col vert-res mineral N flux for transition along decomposition cascade (gN/m3/s) - real(r8), pointer :: decomp_cascade_sminn_flux_col (:,:) ! col vert-int (diagnostic) mineral N flux for transition along decomposition cascade (gN/m2/s) - - ! Used to update concentrations concurrently with vertical transport - ! vertically-resolved immobilization fluxes - real(r8), pointer :: potential_immob_vr_col (:,:) ! col vertically-resolved potential N immobilization (gN/m3/s) at each level - real(r8), pointer :: potential_immob_col (:) ! col vert-int (diagnostic) potential N immobilization (gN/m2/s) - real(r8), pointer :: actual_immob_vr_col (:,:) ! col vertically-resolved actual N immobilization (gN/m3/s) at each level - real(r8), pointer :: actual_immob_col (:) ! col vert-int (diagnostic) actual N immobilization (gN/m2/s) - real(r8), pointer :: sminn_to_plant_vr_col (:,:) ! col vertically-resolved plant uptake of soil mineral N (gN/m3/s) - real(r8), pointer :: sminn_to_plant_col (:) ! col vert-int (diagnostic) plant uptake of soil mineral N (gN/m2/s) - real(r8), pointer :: supplement_to_sminn_vr_col (:,:) ! col vertically-resolved supplemental N supply (gN/m3/s) - real(r8), pointer :: supplement_to_sminn_col (:) ! col vert-int (diagnostic) supplemental N supply (gN/m2/s) - real(r8), pointer :: gross_nmin_vr_col (:,:) ! col vertically-resolved gross rate of N mineralization (gN/m3/s) - real(r8), pointer :: gross_nmin_col (:) ! col vert-int (diagnostic) gross rate of N mineralization (gN/m2/s) - real(r8), pointer :: net_nmin_vr_col (:,:) ! col vertically-resolved net rate of N mineralization (gN/m3/s) - real(r8), pointer :: net_nmin_col (:) ! col vert-int (diagnostic) net rate of N mineralization (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_col (:) ! col total soil N uptake of FUN (gN/m2/s) - ! ---------- NITRIF_DENITRIF --------------------- - - ! nitrification / denitrification fluxes - real(r8), pointer :: f_nit_vr_col (:,:) ! col (gN/m3/s) soil nitrification flux - real(r8), pointer :: f_denit_vr_col (:,:) ! col (gN/m3/s) soil denitrification flux - real(r8), pointer :: f_nit_col (:) ! col (gN/m2/s) soil nitrification flux - real(r8), pointer :: f_denit_col (:) ! col (gN/m2/s) soil denitrification flux - - real(r8), pointer :: pot_f_nit_vr_col (:,:) ! col (gN/m3/s) potential soil nitrification flux - real(r8), pointer :: pot_f_denit_vr_col (:,:) ! col (gN/m3/s) potential soil denitrification flux - real(r8), pointer :: pot_f_nit_col (:) ! col (gN/m2/s) potential soil nitrification flux - real(r8), pointer :: pot_f_denit_col (:) ! col (gN/m2/s) potential soil denitrification flux - real(r8), pointer :: n2_n2o_ratio_denit_vr_col (:,:) ! col ratio of N2 to N2O production by denitrification [gN/gN] - real(r8), pointer :: f_n2o_denit_vr_col (:,:) ! col flux of N2o from denitrification [gN/m^3/s] - real(r8), pointer :: f_n2o_denit_col (:) ! col flux of N2o from denitrification [gN/m^2/s] - real(r8), pointer :: f_n2o_nit_vr_col (:,:) ! col flux of N2o from nitrification [gN/m^3/s] - real(r8), pointer :: f_n2o_nit_col (:) ! col flux of N2o from nitrification [gN/m^2/s] - - ! immobilization / uptake fluxes - real(r8), pointer :: actual_immob_no3_vr_col (:,:) ! col vertically-resolved actual immobilization of NO3 (gN/m3/s) - real(r8), pointer :: actual_immob_nh4_vr_col (:,:) ! col vertically-resolved actual immobilization of NH4 (gN/m3/s) - real(r8), pointer :: smin_no3_to_plant_vr_col (:,:) ! col vertically-resolved plant uptake of soil NO3 (gN/m3/s) - real(r8), pointer :: smin_nh4_to_plant_vr_col (:,:) ! col vertically-resolved plant uptake of soil NH4 (gN/m3/s) - real(r8), pointer :: actual_immob_no3_col (:) ! col actual immobilization of NO3 (gN/m2/s) - real(r8), pointer :: actual_immob_nh4_col (:) ! col actual immobilization of NH4 (gN/m2/s) - real(r8), pointer :: smin_no3_to_plant_col (:) ! col plant uptake of soil NO3 (gN/m2/s) - real(r8), pointer :: smin_nh4_to_plant_col (:) ! col plant uptake of soil Nh4 (gN/m2/s) - - ! leaching fluxes - real(r8), pointer :: smin_no3_leached_vr_col (:,:) ! col vertically-resolved soil mineral NO3 loss to leaching (gN/m3/s) - real(r8), pointer :: smin_no3_leached_col (:) ! col soil mineral NO3 pool loss to leaching (gN/m2/s) - real(r8), pointer :: smin_no3_runoff_vr_col (:,:) ! col vertically-resolved rate of mineral NO3 loss with runoff (gN/m3/s) - real(r8), pointer :: smin_no3_runoff_col (:) ! col soil mineral NO3 pool loss to runoff (gN/m2/s) - - ! nitrification /denitrification diagnostic quantities - real(r8), pointer :: smin_no3_massdens_vr_col (:,:) ! col (ugN / g soil) soil nitrate concentration - real(r8), pointer :: soil_bulkdensity_col (:,:) ! col (kg soil / m3) bulk density of soil - real(r8), pointer :: k_nitr_t_vr_col (:,:) - real(r8), pointer :: k_nitr_ph_vr_col (:,:) - real(r8), pointer :: k_nitr_h2o_vr_col (:,:) - real(r8), pointer :: k_nitr_vr_col (:,:) - real(r8), pointer :: wfps_vr_col (:,:) - real(r8), pointer :: fmax_denit_carbonsubstrate_vr_col (:,:) - real(r8), pointer :: fmax_denit_nitrate_vr_col (:,:) - real(r8), pointer :: f_denit_base_vr_col (:,:) ! col nitrification and denitrification fluxes - real(r8), pointer :: diffus_col (:,:) ! col diffusivity (m2/s) - real(r8), pointer :: ratio_k1_col (:,:) - real(r8), pointer :: ratio_no3_co2_col (:,:) - real(r8), pointer :: soil_co2_prod_col (:,:) - real(r8), pointer :: fr_WFPS_col (:,:) - - real(r8), pointer :: r_psi_col (:,:) - real(r8), pointer :: anaerobic_frac_col (:,:) - real(r8), pointer :: sminn_to_plant_fun_no3_vr_col (:,:) ! col total layer no3 uptake of FUN (gN/m2/s) - real(r8), pointer :: sminn_to_plant_fun_nh4_vr_col (:,:) ! col total layer nh4 uptake of FUN (gN/m2/s) - !----------- no NITRIF_DENITRIF-------------- - - ! denitrification fluxes - real(r8), pointer :: sminn_to_denit_decomp_cascade_vr_col (:,:,:) ! col vertically-resolved denitrification along decomp cascade (gN/m3/s) - real(r8), pointer :: sminn_to_denit_decomp_cascade_col (:,:) ! col vertically-integrated (diagnostic) denitrification along decomp cascade (gN/m2/s) - real(r8), pointer :: sminn_to_denit_excess_vr_col (:,:) ! col vertically-resolved denitrification from excess mineral N pool (gN/m3/s) - real(r8), pointer :: sminn_to_denit_excess_col (:) ! col vertically-integrated (diagnostic) denitrification from excess mineral N pool (gN/m2/s) - - ! leaching fluxes - real(r8), pointer :: sminn_leached_vr_col (:,:) ! col vertically-resolved soil mineral N pool loss to leaching (gN/m3/s) - real(r8), pointer :: sminn_leached_col (:) ! col soil mineral N pool loss to leaching (gN/m2/s) - - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: denit_col (:) ! col total rate of denitrification (gN/m2/s) - real(r8), pointer :: ninputs_col (:) ! col column-level N inputs (gN/m2/s) - real(r8), pointer :: noutputs_col (:) ! col column-level N outputs (gN/m2/s) - real(r8), pointer :: som_n_leached_col (:) ! col total SOM N loss from vertical transport (gN/m^2/s) - real(r8), pointer :: decomp_npools_leached_col (:,:) ! col N loss from vertical transport from each decomposing N pool (gN/m^2/s) - real(r8), pointer :: decomp_npools_transport_tendency_col (:,:,:) ! col N tendency due to vertical transport in decomposing N pools (gN/m^3/s) - - ! all n pools involved in decomposition - real(r8), pointer :: decomp_npools_sourcesink_col (:,:,:) ! col (gN/m3) change in decomposing n pools - ! (sum of all additions and subtractions from stateupdate1). - real(r8), pointer :: sminn_to_plant_fun_vr_col (:,:) ! col total layer soil N uptake of FUN (gN/m2/s) - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , public :: Summary - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type SoilBiogeochem_nitrogenflux_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate (bounds) - call this%InitHistory (bounds) - call this%InitCold (bounds) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize nitrogen flux - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc,endc -! integer :: begp,endp - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc -! begp = bounds%begp; endp = bounds%endp - allocate(this%ndep_to_sminn_col (begc:endc)) ; this%ndep_to_sminn_col (:) = nan - allocate(this%nfix_to_sminn_col (begc:endc)) ; this%nfix_to_sminn_col (:) = nan - allocate(this%ffix_to_sminn_col (begc:endc)) ; this%ffix_to_sminn_col (:) = nan - allocate(this%fert_to_sminn_col (begc:endc)) ; this%fert_to_sminn_col (:) = nan - allocate(this%soyfixn_to_sminn_col (begc:endc)) ; this%soyfixn_to_sminn_col (:) = nan - allocate(this%sminn_to_plant_col (begc:endc)) ; this%sminn_to_plant_col (:) = nan - allocate(this%potential_immob_col (begc:endc)) ; this%potential_immob_col (:) = nan - allocate(this%actual_immob_col (begc:endc)) ; this%actual_immob_col (:) = nan - allocate(this%gross_nmin_col (begc:endc)) ; this%gross_nmin_col (:) = nan - allocate(this%net_nmin_col (begc:endc)) ; this%net_nmin_col (:) = nan - allocate(this%denit_col (begc:endc)) ; this%denit_col (:) = nan - allocate(this%supplement_to_sminn_col (begc:endc)) ; this%supplement_to_sminn_col (:) = nan - allocate(this%ninputs_col (begc:endc)) ; this%ninputs_col (:) = nan - allocate(this%noutputs_col (begc:endc)) ; this%noutputs_col (:) = nan - allocate(this%som_n_leached_col (begc:endc)) ; this%som_n_leached_col (:) = nan - - allocate(this%r_psi_col (begc:endc,1:nlevdecomp_full)) ; this%r_psi_col (:,:) = spval - allocate(this%anaerobic_frac_col (begc:endc,1:nlevdecomp_full)) ; this%anaerobic_frac_col (:,:) = spval - allocate(this%potential_immob_vr_col (begc:endc,1:nlevdecomp_full)) ; this%potential_immob_vr_col (:,:) = nan - allocate(this%actual_immob_vr_col (begc:endc,1:nlevdecomp_full)) ; this%actual_immob_vr_col (:,:) = nan - allocate(this%sminn_to_plant_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_vr_col (:,:) = nan - allocate(this%supplement_to_sminn_vr_col (begc:endc,1:nlevdecomp_full)) ; this%supplement_to_sminn_vr_col (:,:) = nan - allocate(this%gross_nmin_vr_col (begc:endc,1:nlevdecomp_full)) ; this%gross_nmin_vr_col (:,:) = nan - allocate(this%net_nmin_vr_col (begc:endc,1:nlevdecomp_full)) ; this%net_nmin_vr_col (:,:) = nan - allocate(this%sminn_to_plant_fun_col (begc:endc)) ; this%sminn_to_plant_fun_col (:) = nan - allocate(this%sminn_to_plant_fun_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_fun_vr_col (:,:) = nan - allocate(this%sminn_to_plant_fun_no3_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_fun_no3_vr_col(:,:) = nan - allocate(this%sminn_to_plant_fun_nh4_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_to_plant_fun_nh4_vr_col(:,:) = nan - allocate(this%f_nit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_nit_vr_col (:,:) = nan - allocate(this%f_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_denit_vr_col (:,:) = nan - allocate(this%smin_no3_leached_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_leached_vr_col (:,:) = nan - allocate(this%smin_no3_leached_col (begc:endc)) ; this%smin_no3_leached_col (:) = nan - allocate(this%smin_no3_runoff_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_runoff_vr_col (:,:) = nan - allocate(this%smin_no3_runoff_col (begc:endc)) ; this%smin_no3_runoff_col (:) = nan - allocate(this%pot_f_nit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%pot_f_nit_vr_col (:,:) = nan - allocate(this%pot_f_nit_col (begc:endc)) ; this%pot_f_nit_col (:) = nan - allocate(this%pot_f_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%pot_f_denit_vr_col (:,:) = nan - allocate(this%pot_f_denit_col (begc:endc)) ; this%pot_f_denit_col (:) = nan - allocate(this%actual_immob_no3_vr_col (begc:endc,1:nlevdecomp_full)) ; this%actual_immob_no3_vr_col (:,:) = nan - allocate(this%actual_immob_nh4_vr_col (begc:endc,1:nlevdecomp_full)) ; this%actual_immob_nh4_vr_col (:,:) = nan - allocate(this%smin_no3_to_plant_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_to_plant_vr_col (:,:) = nan - allocate(this%smin_nh4_to_plant_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_nh4_to_plant_vr_col (:,:) = nan - allocate(this%f_nit_col (begc:endc)) ; this%f_nit_col (:) = nan - allocate(this%f_denit_col (begc:endc)) ; this%f_denit_col (:) = nan - allocate(this%n2_n2o_ratio_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%n2_n2o_ratio_denit_vr_col (:,:) = nan - allocate(this%f_n2o_denit_col (begc:endc)) ; this%f_n2o_denit_col (:) = nan - allocate(this%f_n2o_denit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_n2o_denit_vr_col (:,:) = nan - allocate(this%f_n2o_nit_col (begc:endc)) ; this%f_n2o_nit_col (:) = nan - allocate(this%f_n2o_nit_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_n2o_nit_vr_col (:,:) = nan - - allocate(this%smin_no3_massdens_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_massdens_vr_col (:,:) = nan - allocate(this%soil_bulkdensity_col (begc:endc,1:nlevdecomp_full)) ; this%soil_bulkdensity_col (:,:) = nan - allocate(this%k_nitr_t_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_t_vr_col (:,:) = nan - allocate(this%k_nitr_ph_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_ph_vr_col (:,:) = nan - allocate(this%k_nitr_h2o_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_h2o_vr_col (:,:) = nan - allocate(this%k_nitr_vr_col (begc:endc,1:nlevdecomp_full)) ; this%k_nitr_vr_col (:,:) = nan - allocate(this%wfps_vr_col (begc:endc,1:nlevdecomp_full)) ; this%wfps_vr_col (:,:) = nan - allocate(this%f_denit_base_vr_col (begc:endc,1:nlevdecomp_full)) ; this%f_denit_base_vr_col (:,:) = nan - allocate(this%diffus_col (begc:endc,1:nlevdecomp_full)) ; this%diffus_col (:,:) = spval - allocate(this%ratio_k1_col (begc:endc,1:nlevdecomp_full)) ; this%ratio_k1_col (:,:) = nan - allocate(this%ratio_no3_co2_col (begc:endc,1:nlevdecomp_full)) ; this%ratio_no3_co2_col (:,:) = spval - allocate(this%soil_co2_prod_col (begc:endc,1:nlevdecomp_full)) ; this%soil_co2_prod_col (:,:) = nan - allocate(this%fr_WFPS_col (begc:endc,1:nlevdecomp_full)) ; this%fr_WFPS_col (:,:) = spval - - allocate(this%fmax_denit_carbonsubstrate_vr_col (begc:endc,1:nlevdecomp_full)) ; - this%fmax_denit_carbonsubstrate_vr_col (:,:) = nan - allocate(this%fmax_denit_nitrate_vr_col (begc:endc,1:nlevdecomp_full)) ; - this%fmax_denit_nitrate_vr_col (:,:) = nan - - allocate(this%decomp_cascade_ntransfer_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions )) - allocate(this%decomp_cascade_sminn_flux_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions )) - allocate(this%decomp_cascade_ntransfer_col (begc:endc,1:ndecomp_cascade_transitions )) - allocate(this%decomp_cascade_sminn_flux_col (begc:endc,1:ndecomp_cascade_transitions )) - - this%decomp_cascade_ntransfer_vr_col (:,:,:) = nan - this%decomp_cascade_sminn_flux_vr_col (:,:,:) = nan - this%decomp_cascade_ntransfer_col (:,:) = nan - this%decomp_cascade_sminn_flux_col (:,:) = nan - - allocate(this%sminn_to_denit_decomp_cascade_vr_col (begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions )) - allocate(this%sminn_to_denit_decomp_cascade_col (begc:endc,1:ndecomp_cascade_transitions )) - allocate(this%sminn_to_denit_excess_vr_col (begc:endc,1:nlevdecomp_full )) - allocate(this%sminn_to_denit_excess_col (begc:endc )) - allocate(this%sminn_leached_vr_col (begc:endc,1:nlevdecomp_full )) - allocate(this%sminn_leached_col (begc:endc )) - allocate(this%decomp_npools_leached_col (begc:endc,1:ndecomp_pools )) - allocate(this%decomp_npools_transport_tendency_col (begc:endc,1:nlevdecomp_full,1:ndecomp_pools )) - - this%sminn_to_denit_decomp_cascade_vr_col (:,:,:) = nan - this%sminn_to_denit_decomp_cascade_col (:,:) = nan - this%sminn_to_denit_excess_vr_col (:,:) = nan - this%sminn_to_denit_excess_col (:) = nan - this%sminn_leached_vr_col (:,:) = nan - this%sminn_leached_col (:) = nan - this%decomp_npools_leached_col (:,:) = nan - this%decomp_npools_transport_tendency_col (:,:,:) = nan - - allocate(this%decomp_npools_sourcesink_col (begc:endc,1:nlevdecomp_full,1:ndecomp_pools)) - this%decomp_npools_sourcesink_col (:,:,:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use histFileMod , only : hist_addfld1d, hist_addfld_decomp - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l - integer :: begc, endc - character(24) :: fieldname - character(100) :: longname - character(8) :: vr_suffix,default - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begc = bounds%begc; endc= bounds%endc - - ! add suffix if number of soil decomposition depths is greater than 1 - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - !------------------------------- - ! N flux variables - native to column - !------------------------------- - - this%ndep_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='NDEP_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='atmospheric N deposition to soil mineral N', & - ptr_col=this%ndep_to_sminn_col) - - if (use_fun) then - default = 'inactive' - else - default = 'active' - end if - this%nfix_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='NFIX_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='symbiotic/asymbiotic N fixation to soil mineral N', & - ptr_col=this%nfix_to_sminn_col, default=default) - - this%ffix_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='FFIX_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='free living N fixation to soil mineral N', & - ptr_col=this%ffix_to_sminn_col, default=default) - - do l = 1, ndecomp_cascade_transitions - ! vertically integrated fluxes - !-- mineralization/immobilization fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%decomp_cascade_sminn_flux_col(begc:endc,l) = spval - data1dptr => this%decomp_cascade_sminn_flux_col(:,l) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - fieldname = 'SMINN_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'N_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_donor_pool(l))) - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - else - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'N_TO_SMINN' - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l))) - endif - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - end if - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - this%decomp_cascade_ntransfer_col(begc:endc,l) = spval - data1dptr => this%decomp_cascade_ntransfer_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'N_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'N' - longname = 'decomp. of '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' N to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' N' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - end if - - ! vertically resolved fluxes - if ( nlevdecomp_full > 1 ) then - !-- mineralization/immobilization fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%decomp_cascade_sminn_flux_vr_col(begc:endc,:,l) = spval - data2dptr => this%decomp_cascade_sminn_flux_vr_col(:,:,l) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - fieldname = 'SMINN_TO_'& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))//'N_'//& - trim(decomp_cascade_con%decomp_pool_name_short(decomp_cascade_con%cascade_donor_pool(l)))//trim(vr_suffix) - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - else - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))& - //'N_TO_SMINN'//trim(vr_suffix) - longname = 'mineral N flux for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l))) - endif - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - !-- transfer fluxes (none from terminal pool, if present) - if ( decomp_cascade_con%cascade_receiver_pool(l) /= 0 ) then - this%decomp_cascade_ntransfer_vr_col(begc:endc,:,l) = spval - data2dptr => this%decomp_cascade_ntransfer_vr_col(:,:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_donor_pool(l)))//'N_TO_'//& - trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l)))& - //'N'//trim(vr_suffix) - longname = 'decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - ' N to '//trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_receiver_pool(l)))//' N' - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - - endif - end do - - this%denit_col(begc:endc) = spval - call hist_addfld1d (fname='DENIT', units='gN/m^2/s', & - avgflag='A', long_name='total rate of denitrification', & - ptr_col=this%denit_col) - - this%som_n_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SOM_N_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='total flux of N from SOM pools due to leaching', & - ptr_col=this%som_n_leached_col, default='inactive') - - do k = 1, ndecomp_pools - if ( .not. decomp_cascade_con%is_cwd(k) ) then - this%decomp_npools_leached_col(begc:endc,k) = spval - data1dptr => this%decomp_npools_leached_col(:,k) - fieldname = 'M_'//trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TO_LEACHING' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N leaching loss' - call hist_addfld1d (fname=fieldname, units='gN/m^2/s', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - - this%decomp_npools_transport_tendency_col(begc:endc,:,k) = spval - data2dptr => this%decomp_npools_transport_tendency_col(:,:,k) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(k))//'N_TNDNCY_VERT_TRANSPORT' - longname = trim(decomp_cascade_con%decomp_pool_name_long(k))//' N tendency due to vertical transport' - call hist_addfld_decomp (fname=fieldname, units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - end if - end do - - if (.not. use_nitrif_denitrif) then - do l = 1, ndecomp_cascade_transitions - !-- denitrification fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%sminn_to_denit_decomp_cascade_col(begc:endc,l) = spval - data1dptr => this%sminn_to_denit_decomp_cascade_col(:,l) - fieldname = 'SMINN_TO_DENIT_'//trim(decomp_cascade_con%cascade_step_name(l)) - longname = 'denitrification for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default='inactive') - endif - - if ( nlevdecomp_full > 1 ) then - !-- denitrification fluxes (none from CWD) - if ( .not. decomp_cascade_con%is_cwd(decomp_cascade_con%cascade_donor_pool(l)) ) then - this%sminn_to_denit_decomp_cascade_vr_col(begc:endc,:,l) = spval - data2dptr => this%sminn_to_denit_decomp_cascade_vr_col(:,:,l) - fieldname = 'SMINN_TO_DENIT_'//trim(decomp_cascade_con%cascade_step_name(l))//trim(vr_suffix) - longname = 'denitrification for decomp. of '& - //trim(decomp_cascade_con%decomp_pool_name_long(decomp_cascade_con%cascade_donor_pool(l)))//& - 'to '//trim(decomp_cascade_con%decomp_pool_name_history(decomp_cascade_con%cascade_receiver_pool(l))) - call hist_addfld_decomp (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr, default='inactive') - endif - endif - end do - end if - - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_excess_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN_TO_DENIT_EXCESS', units='gN/m^2/s', & - avgflag='A', long_name='denitrification from excess mineral N pool', & - ptr_col=this%sminn_to_denit_excess_col, default='inactive') - end if - - if (.not. use_nitrif_denitrif) then - this%sminn_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='soil mineral N pool loss to leaching', & - ptr_col=this%sminn_leached_col) - end if - - if (.not. use_nitrif_denitrif) then - if ( nlevdecomp_full > 1 ) then - this%sminn_to_denit_excess_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMINN_TO_DENIT_EXCESS'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='denitrification from excess mineral N pool', & - ptr_col=this%sminn_to_denit_excess_vr_col, default='inactive') - - this%sminn_leached_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMINN_LEACHED'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='soil mineral N pool loss to leaching', & - ptr_col=this%sminn_leached_vr_col, default='inactive') - endif - end if - - if (use_nitrif_denitrif) then - this%f_nit_col(begc:endc) = spval - call hist_addfld1d (fname='F_NIT', units='gN/m^2/s', & - avgflag='A', long_name='nitrification flux', & - ptr_col=this%f_nit_col) - end if - - if (use_nitrif_denitrif) then - this%f_denit_col(begc:endc) = spval - call hist_addfld1d (fname='F_DENIT', units='gN/m^2/s', & - avgflag='A', long_name='denitrification flux', & - ptr_col=this%f_denit_col) - end if - - if (use_nitrif_denitrif) then - this%pot_f_nit_col(begc:endc) = spval - call hist_addfld1d (fname='POT_F_NIT', units='gN/m^2/s', & - avgflag='A', long_name='potential nitrification flux', & - ptr_col=this%pot_f_nit_col) - end if - - if (use_nitrif_denitrif) then - this%pot_f_denit_col(begc:endc) = spval - call hist_addfld1d (fname='POT_F_DENIT', units='gN/m^2/s', & - avgflag='A', long_name='potential denitrification flux', & - ptr_col=this%pot_f_denit_col) - end if - - if (use_nitrif_denitrif) then - this%smin_no3_leached_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NO3_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='soil NO3 pool loss to leaching', & - ptr_col=this%smin_no3_leached_col) - end if - - if (use_nitrif_denitrif) then - this%smin_no3_runoff_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NO3_RUNOFF', units='gN/m^2/s', & - avgflag='A', long_name='soil NO3 pool loss to runoff', & - ptr_col=this%smin_no3_runoff_col) - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%f_nit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='F_NIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='nitrification flux', & - ptr_col=this%f_nit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%f_denit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='F_DENIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='denitrification flux', & - ptr_col=this%f_denit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%pot_f_nit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='POT_F_NIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='potential nitrification flux', & - ptr_col=this%pot_f_nit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%pot_f_denit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='POT_F_DENIT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='potential denitrification flux', & - ptr_col=this%pot_f_denit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%smin_no3_leached_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_LEACHED'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='soil NO3 pool loss to leaching', & - ptr_col=this%smin_no3_leached_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%smin_no3_runoff_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_RUNOFF'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='soil NO3 pool loss to runoff', & - ptr_col=this%smin_no3_runoff_vr_col, default='inactive') - endif - - if (use_nitrif_denitrif) then - this%n2_n2o_ratio_denit_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='n2_n2o_ratio_denit', units='gN/gN', type2d='levdcmp', & - avgflag='A', long_name='n2_n2o_ratio_denit', & - ptr_col=this%n2_n2o_ratio_denit_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%actual_immob_no3_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ACTUAL_IMMOB_NO3', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='immobilization of NO3', & - ptr_col=this%actual_immob_no3_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%actual_immob_nh4_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ACTUAL_IMMOB_NH4', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='immobilization of NH4', & - ptr_col=this%actual_immob_nh4_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_no3_to_plant_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_TO_PLANT', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='plant uptake of NO3', & - ptr_col=this%smin_no3_to_plant_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_nh4_to_plant_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NH4_TO_PLANT', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='plant uptake of NH4', & - ptr_col=this%smin_nh4_to_plant_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%smin_no3_massdens_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMIN_NO3_MASSDENS', units='ugN/cm^3 soil', type2d='levdcmp', & - avgflag='A', long_name='SMIN_NO3_MASSDENS', & - ptr_col=this%smin_no3_massdens_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_t_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR_T', units='unitless', type2d='levdcmp', & - avgflag='A', long_name='K_NITR_T', & - ptr_col=this%k_nitr_t_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_ph_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR_PH', units='unitless', type2d='levdcmp', & - avgflag='A', long_name='K_NITR_PH', & - ptr_col=this%k_nitr_ph_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_h2o_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR_H2O', units='unitless', type2d='levdcmp', & - avgflag='A', long_name='K_NITR_H2O', & - ptr_col=this%k_nitr_h2o_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%k_nitr_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='K_NITR', units='1/s', type2d='levdcmp', & - avgflag='A', long_name='K_NITR', & - ptr_col=this%k_nitr_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%wfps_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='WFPS', units='percent', type2d='levdcmp', & - avgflag='A', long_name='WFPS', & - ptr_col=this%wfps_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%fmax_denit_carbonsubstrate_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='FMAX_DENIT_CARBONSUBSTRATE', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='FMAX_DENIT_CARBONSUBSTRATE', & - ptr_col=this%fmax_denit_carbonsubstrate_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%fmax_denit_nitrate_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='FMAX_DENIT_NITRATE', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='FMAX_DENIT_NITRATE', & - ptr_col=this%fmax_denit_nitrate_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%f_denit_base_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='F_DENIT_BASE', units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='F_DENIT_BASE', & - ptr_col=this%f_denit_base_vr_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%diffus_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='diffus', units='m^2/s', type2d='levdcmp', & - avgflag='A', long_name='diffusivity', & - ptr_col=this%diffus_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%ratio_k1_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ratio_k1', units='none', type2d='levdcmp', & - avgflag='A', long_name='ratio_k1', & - ptr_col=this%ratio_k1_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%ratio_no3_co2_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ratio_no3_co2', units='ratio', type2d='levdcmp', & - avgflag='A', long_name='ratio_no3_co2', & - ptr_col=this%ratio_no3_co2_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%soil_co2_prod_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='soil_co2_prod', units='ug C / g soil / day', type2d='levdcmp', & - avgflag='A', long_name='soil_co2_prod', & - ptr_col=this%soil_co2_prod_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%fr_WFPS_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='fr_WFPS', units='fraction', type2d='levdcmp', & - avgflag='A', long_name='fr_WFPS', & - ptr_col=this%fr_WFPS_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%soil_bulkdensity_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='soil_bulkdensity', units='kg/m3', type2d='levdcmp', & - avgflag='A', long_name='soil_bulkdensity', & - ptr_col=this%soil_bulkdensity_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%anaerobic_frac_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='anaerobic_frac', units='m3/m3', type2d='levdcmp', & - avgflag='A', long_name='anaerobic_frac', & - ptr_col=this%anaerobic_frac_col, default='inactive') - end if - - if (use_nitrif_denitrif) then - this%r_psi_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='r_psi', units='m', type2d='levdcmp', & - avgflag='A', long_name='r_psi', & - ptr_col=this%r_psi_col, default='inactive') - end if - - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%potential_immob_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='POTENTIAL_IMMOB'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='potential N immobilization', & - ptr_col=this%potential_immob_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%actual_immob_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='ACTUAL_IMMOB'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='actual N immobilization', & - ptr_col=this%actual_immob_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%sminn_to_plant_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SMINN_TO_PLANT'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='plant uptake of soil mineral N', & - ptr_col=this%sminn_to_plant_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%supplement_to_sminn_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SUPPLEMENT_TO_SMINN'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='supplemental N supply', & - ptr_col=this%supplement_to_sminn_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%gross_nmin_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='GROSS_NMIN'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='gross rate of N mineralization', & - ptr_col=this%gross_nmin_vr_col, default='inactive') - end if - - if ( use_nitrif_denitrif .and. nlevdecomp_full > 1 ) then - this%net_nmin_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='NET_NMIN'//trim(vr_suffix), units='gN/m^3/s', type2d='levdcmp', & - avgflag='A', long_name='net rate of N mineralization', & - ptr_col=this%net_nmin_vr_col, default='inactive') - end if - - this%potential_immob_col(begc:endc) = spval - call hist_addfld1d (fname='POTENTIAL_IMMOB', units='gN/m^2/s', & - avgflag='A', long_name='potential N immobilization', & - ptr_col=this%potential_immob_col) - - this%actual_immob_col(begc:endc) = spval - call hist_addfld1d (fname='ACTUAL_IMMOB', units='gN/m^2/s', & - avgflag='A', long_name='actual N immobilization', & - ptr_col=this%actual_immob_col) - - this%sminn_to_plant_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN_TO_PLANT', units='gN/m^2/s', & - avgflag='A', long_name='plant uptake of soil mineral N', & - ptr_col=this%sminn_to_plant_col) - - this%supplement_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='SUPPLEMENT_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='supplemental N supply', & - ptr_col=this%supplement_to_sminn_col) - - this%gross_nmin_col(begc:endc) = spval - call hist_addfld1d (fname='GROSS_NMIN', units='gN/m^2/s', & - avgflag='A', long_name='gross rate of N mineralization', & - ptr_col=this%gross_nmin_col) - - this%net_nmin_col(begc:endc) = spval - call hist_addfld1d (fname='NET_NMIN', units='gN/m^2/s', & - avgflag='A', long_name='net rate of N mineralization', & - ptr_col=this%net_nmin_col) - - if (use_nitrif_denitrif) then - this%f_n2o_nit_col(begc:endc) = spval - call hist_addfld1d (fname='F_N2O_NIT', units='gN/m^2/s', & - avgflag='A', long_name='nitrification N2O flux', & - ptr_col=this%f_n2o_nit_col) - - this%f_n2o_denit_col(begc:endc) = spval - call hist_addfld1d (fname='F_N2O_DENIT', units='gN/m^2/s', & - avgflag='A', long_name='denitrification N2O flux', & - ptr_col=this%f_n2o_denit_col) - end if - - if (use_crop) then - this%fert_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='FERT_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='fertilizer to soil mineral N', & - ptr_col=this%fert_to_sminn_col, default='inactive') - end if - - if (use_crop .and. .not. use_fun) then - this%soyfixn_to_sminn_col(begc:endc) = spval - call hist_addfld1d (fname='SOYFIXN_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='Soybean fixation to soil mineral N', & - ptr_col=this%soyfixn_to_sminn_col, default='inactive') - end if - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use landunit_varcon , only : istsoil, istcrop - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: c,l - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col(bounds%endc-bounds%begc+1) ! special landunit filter - columns - !--------------------------------------------------------------------- - - ! Set column filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - !----------------------------------------------- - ! initialize nitrogen flux variables - !----------------------------------------------- - - call this%SetValues (& - num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart (this, bounds, ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for carbon state - ! - ! !USES: - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag !'read' or 'write' - ! - ! !LOCAL VARIABLES: - integer :: j,c ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - if (use_nitrif_denitrif) then - ! pot_f_nit_vr - if (use_vertsoilc) then - ptr2d => this%pot_f_nit_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='pot_f_nit_vr_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='potential soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%pot_f_nit_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='pot_f_nit_vr', xtype=ncd_double, & - dim1name='column', & - long_name='soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg= 'ERROR:: pot_f_nit_vr'//' is required on an initialization dataset' ) - end if - end if - - if (use_nitrif_denitrif) then - ! f_nit_vr - if (use_vertsoilc) then - ptr2d => this%f_nit_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='f_nit_vr_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%f_nit_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='f_nit_vr', xtype=ncd_double, & - dim1name='column', & - long_name='soil nitrification flux', units='gN/m3/s', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: f_nit_vr'//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, & - num_column, filter_column, value_column) - ! - ! !DESCRIPTION: - ! Set nitrogen flux variables - ! - ! !ARGUMENTS: - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenflux_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: 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) - - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_excess_vr_col(i,j) = value_column - this%sminn_leached_vr_col(i,j) = value_column - this%sminn_to_plant_fun_vr_col(i,j) = value_column - else - this%f_nit_vr_col(i,j) = value_column - this%f_denit_vr_col(i,j) = value_column - this%smin_no3_leached_vr_col(i,j) = value_column - this%smin_no3_runoff_vr_col(i,j) = value_column - this%n2_n2o_ratio_denit_vr_col(i,j) = value_column - this%pot_f_nit_vr_col(i,j) = value_column - this%pot_f_denit_vr_col(i,j) = value_column - this%actual_immob_no3_vr_col(i,j) = value_column - this%actual_immob_nh4_vr_col(i,j) = value_column - this%smin_no3_to_plant_vr_col(i,j) = value_column - this%smin_nh4_to_plant_vr_col(i,j) = value_column - this%f_n2o_denit_vr_col(i,j) = value_column - this%f_n2o_nit_vr_col(i,j) = value_column - - this%smin_no3_massdens_vr_col(i,j) = value_column - this%k_nitr_t_vr_col(i,j) = value_column - this%k_nitr_ph_vr_col(i,j) = value_column - this%k_nitr_h2o_vr_col(i,j) = value_column - this%k_nitr_vr_col(i,j) = value_column - this%wfps_vr_col(i,j) = value_column - this%fmax_denit_carbonsubstrate_vr_col(i,j) = value_column - this%fmax_denit_nitrate_vr_col(i,j) = value_column - this%f_denit_base_vr_col(i,j) = value_column - - this%diffus_col(i,j) = value_column - this%ratio_k1_col(i,j) = value_column - this%ratio_no3_co2_col(i,j) = value_column - this%soil_co2_prod_col(i,j) = value_column - this%fr_WFPS_col(i,j) = value_column - this%soil_bulkdensity_col(i,j) = value_column - - this%r_psi_col(i,j) = value_column - this%anaerobic_frac_col(i,j) = value_column - end if - this%potential_immob_vr_col(i,j) = value_column - this%actual_immob_vr_col(i,j) = value_column - this%sminn_to_plant_vr_col(i,j) = value_column - this%supplement_to_sminn_vr_col(i,j) = value_column - this%gross_nmin_vr_col(i,j) = value_column - this%net_nmin_vr_col(i,j) = value_column - this%sminn_to_plant_fun_no3_vr_col(i,j) = value_column - this%sminn_to_plant_fun_nh4_vr_col(i,j) = value_column - end do - end do - - do fi = 1,num_column - i = filter_column(fi) - - this%ndep_to_sminn_col(i) = value_column - this%nfix_to_sminn_col(i) = value_column - this%ffix_to_sminn_col(i) = value_column - this%fert_to_sminn_col(i) = value_column - this%soyfixn_to_sminn_col(i) = value_column - this%potential_immob_col(i) = value_column - this%actual_immob_col(i) = value_column - this%sminn_to_plant_col(i) = value_column - this%supplement_to_sminn_col(i) = value_column - this%gross_nmin_col(i) = value_column - this%net_nmin_col(i) = value_column - this%denit_col(i) = value_column - this%sminn_to_plant_fun_col(i) = value_column - if (use_nitrif_denitrif) then - this%f_nit_col(i) = value_column - this%pot_f_nit_col(i) = value_column - this%f_denit_col(i) = value_column - this%pot_f_denit_col(i) = value_column - this%f_n2o_denit_col(i) = value_column - this%f_n2o_nit_col(i) = value_column - this%smin_no3_leached_col(i) = value_column - this%smin_no3_runoff_col(i) = value_column - else - this%sminn_to_denit_excess_col(i) = value_column - this%sminn_leached_col(i) = value_column - end if - this%ninputs_col(i) = value_column - this%noutputs_col(i) = value_column - this%som_n_leached_col(i) = value_column - end do - - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_leached_col(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%decomp_npools_transport_tendency_col(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_ntransfer_col(i,l) = value_column - this%decomp_cascade_sminn_flux_col(i,l) = value_column - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_decomp_cascade_col(i,l) = value_column - end if - 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_col(i,j,l) = value_column - this%decomp_cascade_sminn_flux_vr_col(i,j,l) = value_column - if (.not. use_nitrif_denitrif) then - this%sminn_to_denit_decomp_cascade_vr_col(i,j,l) = value_column - end if - 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%decomp_npools_sourcesink_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine Summary(this, bounds, num_soilc, filter_soilc) - ! - ! !USES: - use clm_varpar , only: nlevdecomp, ndecomp_cascade_transitions,ndecomp_pools - use clm_varctl , only: use_nitrif_denitrif - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenflux_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 - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l ! indices - integer :: fc ! filter indices - !----------------------------------------------------------------------- - - do fc = 1,num_soilc - c = filter_soilc(fc) - this%denit_col(c) = 0._r8 - this%supplement_to_sminn_col(c) = 0._r8 - this%som_n_leached_col(c) = 0._r8 - end do - - ! vertically integrate decomposing N cascade fluxes and soil mineral N fluxes associated with decomposition cascade - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - this%decomp_cascade_ntransfer_col(c,k) = & - this%decomp_cascade_ntransfer_col(c,k) + & - this%decomp_cascade_ntransfer_vr_col(c,j,k) * dzsoi_decomp(j) - - this%decomp_cascade_sminn_flux_col(c,k) = & - this%decomp_cascade_sminn_flux_col(c,k) + & - this%decomp_cascade_sminn_flux_vr_col(c,j,k) * dzsoi_decomp(j) - end do - end do - end do - - if (.not. use_nitrif_denitrif) then - - ! vertically integrate each denitrification flux - do l = 1, ndecomp_cascade_transitions - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%sminn_to_denit_decomp_cascade_col(c,l) = & - this%sminn_to_denit_decomp_cascade_col(c,l) + & - this%sminn_to_denit_decomp_cascade_vr_col(c,j,l) * dzsoi_decomp(j) - end do - end do - end do - - ! vertically integrate bulk denitrification and leaching flux - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%sminn_to_denit_excess_col(c) = & - this%sminn_to_denit_excess_col(c) + & - this%sminn_to_denit_excess_vr_col(c,j) * dzsoi_decomp(j) - - this%sminn_leached_col(c) = & - this%sminn_leached_col(c) + & - this%sminn_leached_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - ! total N denitrification (DENIT) - do l = 1, ndecomp_cascade_transitions - do fc = 1,num_soilc - c = filter_soilc(fc) - this%denit_col(c) = & - this%denit_col(c) + & - this%sminn_to_denit_decomp_cascade_col(c,l) - end do - end do - - do fc = 1,num_soilc - c = filter_soilc(fc) - this%denit_col(c) = & - this%denit_col(c) + & - this%sminn_to_denit_excess_col(c) - end do - - else - - ! vertically integrate NO3 NH4 N2O fluxes and pools - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! nitrification and denitrification fluxes - this%f_nit_col(c) = & - this%f_nit_col(c) + & - this%f_nit_vr_col(c,j) * dzsoi_decomp(j) - - this%f_denit_col(c) = & - this%f_denit_col(c) + & - this%f_denit_vr_col(c,j) * dzsoi_decomp(j) - - this%pot_f_nit_col(c) = & - this%pot_f_nit_col(c) + & - this%pot_f_nit_vr_col(c,j) * dzsoi_decomp(j) - - this%pot_f_denit_col(c) = & - this%pot_f_denit_col(c) + & - this%pot_f_denit_vr_col(c,j) * dzsoi_decomp(j) - - this%f_n2o_nit_col(c) = & - this%f_n2o_nit_col(c) + & - this%f_n2o_nit_vr_col(c,j) * dzsoi_decomp(j) - - this%f_n2o_denit_col(c) = & - this%f_n2o_denit_col(c) + & - this%f_n2o_denit_vr_col(c,j) * dzsoi_decomp(j) - - ! leaching/runoff flux - this%smin_no3_leached_col(c) = & - this%smin_no3_leached_col(c) + & - this%smin_no3_leached_vr_col(c,j) * dzsoi_decomp(j) - - this%smin_no3_runoff_col(c) = & - this%smin_no3_runoff_col(c) + & - this%smin_no3_runoff_vr_col(c,j) * dzsoi_decomp(j) - - end do - end do - - do fc = 1,num_soilc - c = filter_soilc(fc) - this%denit_col(c) = this%f_denit_col(c) - end do - - end if - - ! supplementary N supplement_to_sminn - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%supplement_to_sminn_col(c) = & - this%supplement_to_sminn_col(c) + & - this%supplement_to_sminn_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - ! add up all vertical transport tendency terms and calculate total som leaching loss as the sum of these - do l = 1, ndecomp_pools - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_npools_leached_col(c,l) = 0._r8 - end do - - do j = 1, nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - this%decomp_npools_leached_col(c,l) = & - this%decomp_npools_leached_col(c,l) + & - this%decomp_npools_transport_tendency_col(c,j,l) * dzsoi_decomp(j) - end do - end do - - do fc = 1,num_soilc - c = filter_soilc(fc) - this%som_n_leached_col(c) = & - this%som_n_leached_col(c) + & - this%decomp_npools_leached_col(c,l) - end do - end do - - end subroutine Summary - -end module soilbiogeochemNitrogenFluxType - diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 deleted file mode 100644 index ca09e63624..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrogenStateType.F90 +++ /dev/null @@ -1,1023 +0,0 @@ -module SoilBiogeochemNitrogenStateType - -#include "shr_assert.h" - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools, nlevcan - use clm_varpar , only : nlevdecomp_full, nlevdecomp, nlevsoi - use clm_varcon , only : spval, dzsoi_decomp, zisoi - use clm_varctl , only : use_nitrif_denitrif, use_vertsoilc, use_century_decomp - use clm_varctl , only : iulog, override_bgc_restart_mismatch_dump, spinup_state - use landunit_varcon , only : istcrop, istsoil - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use LandunitType , only : lun - use ColumnType , only : col - use GridcellType , only : grc - use SoilBiogeochemStateType , only : get_spinup_latitude_term - ! - ! !PUBLIC TYPES: - implicit none - private - - type, public :: soilbiogeochem_nitrogenstate_type - - real(r8), pointer :: decomp_npools_vr_col (:,:,:) ! col (gN/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - real(r8), pointer :: sminn_vr_col (:,:) ! col (gN/m3) vertically-resolved soil mineral N - real(r8), pointer :: ntrunc_vr_col (:,:) ! col (gN/m3) vertically-resolved column-level sink for N truncation - - ! nitrif_denitrif - real(r8), pointer :: smin_no3_vr_col (:,:) ! col (gN/m3) vertically-resolved soil mineral NO3 - real(r8), pointer :: smin_no3_col (:) ! col (gN/m2) soil mineral NO3 pool - real(r8), pointer :: smin_nh4_vr_col (:,:) ! col (gN/m3) vertically-resolved soil mineral NH4 - real(r8), pointer :: smin_nh4_col (:) ! col (gN/m2) soil mineral NH4 pool - - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: decomp_npools_col (:,:) ! col (gN/m2) decomposing (litter, cwd, soil) N pools - real(r8), pointer :: decomp_npools_1m_col (:,:) ! col (gN/m2) diagnostic: decomposing (litter, cwd, soil) N pools to 1 meter - real(r8), pointer :: sminn_col (:) ! col (gN/m2) soil mineral N - real(r8), pointer :: ntrunc_col (:) ! col (gN/m2) column-level sink for N truncation - real(r8), pointer :: cwdn_col (:) ! col (gN/m2) Diagnostic: coarse woody debris N - real(r8), pointer :: totlitn_col (:) ! col (gN/m2) total litter nitrogen - real(r8), pointer :: totsomn_col (:) ! col (gN/m2) total soil organic matter nitrogen - real(r8), pointer :: totlitn_1m_col (:) ! col (gN/m2) total litter nitrogen to 1 meter - real(r8), pointer :: totsomn_1m_col (:) ! col (gN/m2) total soil organic matter nitrogen to 1 meter - real(r8), pointer :: dyn_nbal_adjustments_col (:) ! (gN/m2) adjustments to each column made in this timestep via dynamic column adjustments (note: this variable only makes sense at the column-level: it is meaningless if averaged to the gridcell-level) - - ! Track adjustments to no3 and nh4 pools separately, since those aren't included in - ! the N balance check - real(r8), pointer :: dyn_no3bal_adjustments_col (:) ! (gN/m2) NO3 adjustments to each column made in this timestep via dynamic column area adjustments (only makes sense at the column-level: meaningless if averaged to the gridcell-level) - real(r8), pointer :: dyn_nh4bal_adjustments_col (:) ! (gN/m2) NH4 adjustments to each column made in this timestep via dynamic column adjustments (only makes sense at the column-level: meaningless if averaged to the gridcell-level) - real(r8) :: totvegcthresh ! threshold for total vegetation carbon to zero out decomposition pools - - contains - - procedure , public :: Init - procedure , public :: Restart - procedure , public :: SetValues - procedure , public :: Summary - procedure , public :: DynamicColumnAdjustments ! adjust state variables when column areas change - procedure , public :: SetTotVgCThresh ! Set value for totvegcthresh needed in Restart - procedure , private :: InitAllocate - procedure , private :: InitHistory - procedure , private :: InitCold - - end type soilbiogeochem_nitrogenstate_type - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds, & - decomp_cpools_vr_col, decomp_cpools_col, decomp_cpools_1m_col) - - class(soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: decomp_cpools_vr_col (bounds%begc:, 1:, 1:) - real(r8) , intent(in) :: decomp_cpools_col (bounds%begc:, 1:) - real(r8) , intent(in) :: decomp_cpools_1m_col (bounds%begc:, 1:) - - this%totvegcthresh = nan - call this%InitAllocate (bounds ) - - call this%InitHistory (bounds) - - call this%InitCold ( bounds, & - decomp_cpools_vr_col, decomp_cpools_col, decomp_cpools_1m_col) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begc,endc - !------------------------------------------------------------------------ - - begc = bounds%begc; endc = bounds%endc - - allocate(this%sminn_vr_col (begc:endc,1:nlevdecomp_full)) ; this%sminn_vr_col (:,:) = nan - allocate(this%ntrunc_vr_col (begc:endc,1:nlevdecomp_full)) ; this%ntrunc_vr_col (:,:) = nan - allocate(this%smin_no3_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_no3_vr_col (:,:) = nan - allocate(this%smin_nh4_vr_col (begc:endc,1:nlevdecomp_full)) ; this%smin_nh4_vr_col (:,:) = nan - allocate(this%smin_no3_col (begc:endc)) ; this%smin_no3_col (:) = nan - allocate(this%smin_nh4_col (begc:endc)) ; this%smin_nh4_col (:) = nan - allocate(this%cwdn_col (begc:endc)) ; this%cwdn_col (:) = nan - allocate(this%sminn_col (begc:endc)) ; this%sminn_col (:) = nan - allocate(this%ntrunc_col (begc:endc)) ; this%ntrunc_col (:) = nan - allocate(this%totlitn_col (begc:endc)) ; this%totlitn_col (:) = nan - allocate(this%totsomn_col (begc:endc)) ; this%totsomn_col (:) = nan - allocate(this%totlitn_1m_col (begc:endc)) ; this%totlitn_1m_col (:) = nan - allocate(this%totsomn_1m_col (begc:endc)) ; this%totsomn_1m_col (:) = nan - allocate(this%dyn_nbal_adjustments_col (begc:endc)) ; this%dyn_nbal_adjustments_col (:) = nan - allocate(this%dyn_no3bal_adjustments_col (begc:endc)) ; this%dyn_no3bal_adjustments_col (:) = nan - allocate(this%dyn_nh4bal_adjustments_col (begc:endc)) ; this%dyn_nh4bal_adjustments_col (:) = nan - allocate(this%decomp_npools_col (begc:endc,1:ndecomp_pools)) ; this%decomp_npools_col (:,:) = nan - allocate(this%decomp_npools_1m_col (begc:endc,1:ndecomp_pools)) ; this%decomp_npools_1m_col (:,:) = nan - - allocate(this%decomp_npools_vr_col(begc:endc,1:nlevdecomp_full,1:ndecomp_pools)); - this%decomp_npools_vr_col(:,:,:)= nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! add history fields for all CN variables, always set as default='inactive' - ! - ! !USES: - use clm_varpar , only : ndecomp_cascade_transitions, ndecomp_pools - use clm_varpar , only : nlevdecomp, nlevdecomp_full, nlevgrnd - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: k,l,ii,jj - character(10) :: active - character(8) :: vr_suffix - integer :: begc,endc - character(24) :: fieldname - character(100) :: longname - real(r8), pointer :: data1dptr(:) ! temp. pointer for slicing larger arrays - real(r8), pointer :: data2dptr(:,:) ! temp. pointer for slicing larger arrays - !--------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - if ( nlevdecomp_full > 1 ) then - this%decomp_npools_vr_col(begc:endc,:,:) = spval - this%decomp_npools_1m_col(begc:endc,:) = spval - end if - this%decomp_npools_col(begc:endc,:) = spval - do l = 1, ndecomp_pools - if ( nlevdecomp_full > 1 ) then - data2dptr => this%decomp_npools_vr_col(:,:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'N_vr' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' N (vertically resolved)' - call hist_addfld2d (fname=fieldname, units='gN/m^3', type2d='levdcmp', & - avgflag='A', long_name=longname, & - ptr_col=data2dptr) - endif - - data1dptr => this%decomp_npools_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'N' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' N' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr) - - if ( nlevdecomp_full > 1 ) then - data1dptr => this%decomp_npools_1m_col(:,l) - fieldname = trim(decomp_cascade_con%decomp_pool_name_history(l))//'N_1m' - longname = trim(decomp_cascade_con%decomp_pool_name_history(l))//' N to 1 meter' - call hist_addfld1d (fname=fieldname, units='gN/m^2', & - avgflag='A', long_name=longname, & - ptr_col=data1dptr, default = 'inactive') - endif - end do - - - if ( nlevdecomp_full > 1 ) then - - this%sminn_col(begc:endc) = spval - call hist_addfld1d (fname='SMINN', units='gN/m^2', & - avgflag='A', long_name='soil mineral N', & - ptr_col=this%sminn_col) - - this%totlitn_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITN_1m', units='gN/m^2', & - avgflag='A', long_name='total litter N to 1 meter', & - ptr_col=this%totlitn_1m_col) - - this%totsomn_1m_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMN_1m', units='gN/m^2', & - avgflag='A', long_name='total soil organic matter N to 1 meter', & - ptr_col=this%totsomn_1m_col) - endif - - this%ntrunc_col(begc:endc) = spval - call hist_addfld1d (fname='COL_NTRUNC', units='gN/m^2', & - avgflag='A', long_name='column-level sink for N truncation', & - ptr_col=this%ntrunc_col, default='inactive') - - ! add suffix if number of soil decomposition depths is greater than 1 - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - - if (use_nitrif_denitrif) then - if ( nlevdecomp_full > 1 ) then - data2dptr => this%smin_no3_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMIN_NO3'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral NO3 (vert. res.)', & - ptr_col=data2dptr) - - data2dptr => this%smin_nh4_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMIN_NH4'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral NH4 (vert. res.)', & - ptr_col=data2dptr) - - data2dptr => this%sminn_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMINN'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral N', & - ptr_col=data2dptr) - - this%smin_no3_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NO3', units='gN/m^2', & - avgflag='A', long_name='soil mineral NO3', & - ptr_col=this%smin_no3_col) - - this%smin_nh4_col(begc:endc) = spval - call hist_addfld1d (fname='SMIN_NH4', units='gN/m^2', & - avgflag='A', long_name='soil mineral NH4', & - ptr_col=this%smin_nh4_col) - endif - else - if ( nlevdecomp_full > 1 ) then - data2dptr => this%sminn_vr_col(begc:endc,1:nlevsoi) - call hist_addfld_decomp (fname='SMINN'//trim(vr_suffix), units='gN/m^3', type2d='levsoi', & - avgflag='A', long_name='soil mineral N', & - ptr_col=data2dptr) - end if - - end if - - this%totlitn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTLITN', units='gN/m^2', & - avgflag='A', long_name='total litter N', & - ptr_col=this%totlitn_col) - - this%totsomn_col(begc:endc) = spval - call hist_addfld1d (fname='TOTSOMN', units='gN/m^2', & - avgflag='A', long_name='total soil organic matter N', & - ptr_col=this%totsomn_col) - - this%dyn_nbal_adjustments_col(begc:endc) = spval - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_N', units='gN/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil nitrogen due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_nbal_adjustments_col, default='inactive') - - if (use_nitrif_denitrif) then - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_NO3', units='gN/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil NO3 due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_no3bal_adjustments_col, default='inactive') - - call hist_addfld1d (fname='DYN_COL_SOIL_ADJUSTMENTS_NH4', units='gN/m^2', & - avgflag='SUM', & - long_name='Adjustments in soil NH4 due to dynamic column areas; & - &only makes sense at the column level: should not be averaged to gridcell', & - ptr_col=this%dyn_nh4bal_adjustments_col, default='inactive') - end if - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine InitCold(this, bounds, & - decomp_cpools_vr_col, decomp_cpools_col, decomp_cpools_1m_col) - ! - ! !DESCRIPTION: - ! Initializes time varying variables used only in coupled carbon-nitrogen mode (CN): - ! - ! !USES: - use decompMod , only : bounds_type - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - real(r8) , intent(in) :: decomp_cpools_vr_col(bounds%begc:,:,:) - real(r8) , intent(in) :: decomp_cpools_col(bounds%begc:,:) - real(r8) , intent(in) :: decomp_cpools_1m_col(bounds%begc:,:) - ! - ! !LOCAL VARIABLES: - integer :: fc,g,l,c,j,k ! indices - integer :: num_special_col ! number of good values in special_col filter - integer :: special_col (bounds%endc-bounds%begc+1) ! special landunit filter - columns - !------------------------------------------------------------------------ - - SHR_ASSERT_ALL((ubound(decomp_cpools_col) == (/bounds%endc,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_1m_col) == (/bounds%endc,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(decomp_cpools_vr_col) == (/bounds%endc,nlevdecomp_full,ndecomp_pools/)), errMsg(sourcefile, __LINE__)) - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - - ! column nitrogen state variables - this%ntrunc_col(c) = 0._r8 - this%sminn_col(c) = 0._r8 - do j = 1, nlevdecomp - do k = 1, ndecomp_pools - this%decomp_npools_vr_col(c,j,k) = decomp_cpools_vr_col(c,j,k) / decomp_cascade_con%initial_cn_ratio(k) - end do - this%sminn_vr_col(c,j) = 0._r8 - this%ntrunc_vr_col(c,j) = 0._r8 - end do - if ( nlevdecomp > 1 ) then - do j = nlevdecomp+1, nlevdecomp_full - do k = 1, ndecomp_pools - this%decomp_npools_vr_col(c,j,k) = 0._r8 - end do - this%sminn_vr_col(c,j) = 0._r8 - this%ntrunc_vr_col(c,j) = 0._r8 - end do - end if - do k = 1, ndecomp_pools - this%decomp_npools_col(c,k) = decomp_cpools_col(c,k) / decomp_cascade_con%initial_cn_ratio(k) - this%decomp_npools_1m_col(c,k) = decomp_cpools_1m_col(c,k) / decomp_cascade_con%initial_cn_ratio(k) - end do - - if (use_nitrif_denitrif) then - do j = 1, nlevdecomp_full - this%smin_nh4_vr_col(c,j) = 0._r8 - this%smin_no3_vr_col(c,j) = 0._r8 - end do - this%smin_nh4_col(c) = 0._r8 - this%smin_no3_col(c) = 0._r8 - end if - this%totlitn_col(c) = 0._r8 - this%totsomn_col(c) = 0._r8 - this%totlitn_1m_col(c) = 0._r8 - this%totsomn_1m_col(c) = 0._r8 - this%cwdn_col(c) = 0._r8 - - end if - end do - - ! initialize fields for special filters - - num_special_col = 0 - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - num_special_col = num_special_col + 1 - special_col(num_special_col) = c - end if - end do - - call this%SetValues (num_column=num_special_col, filter_column=special_col, value_column=0._r8) - - end subroutine InitCold - - !----------------------------------------------------------------------- - subroutine Restart ( this, bounds, ncid, flag, totvegc_col ) - ! - ! !DESCRIPTION: - ! Read/write CN restart data for nitrogen state - ! - ! !USES: - use shr_infnan_mod , only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - use clm_time_manager , only : is_restart, get_nstep - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid - character(len=*) , intent(in) :: flag !'read' or 'write' or 'define' - real(r8) , intent(in) :: totvegc_col(bounds%begc:bounds%endc) ! (gC/m2) total vegetation carbon - - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,l,c - logical :: readvar - integer :: idata - logical :: exit_spinup = .false. - logical :: enter_spinup = .false. - real(r8) :: m ! multiplier for the exit_spinup code - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - character(len=128) :: varname ! temporary - integer :: itemp ! temporary - integer , pointer :: iptemp(:) ! pointer to memory to be allocated - ! spinup state as read from restart file, for determining whether to enter or exit spinup mode. - integer :: restart_file_spinup_state - ! flags for comparing the model and restart decomposition cascades - integer :: decomp_cascade_state, restart_file_decomp_cascade_state - !------------------------------------------------------------------------ - - ! sminn - if (use_vertsoilc) then - ptr2d => this%sminn_vr_col - call restartvar(ncid=ncid, flag=flag, varname="sminn_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%sminn_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="sminn", xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR::'//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - - ! decomposing N pools - do k = 1, ndecomp_pools - varname=trim(decomp_cascade_con%decomp_pool_name_restart(k))//'n' - if (use_vertsoilc) then - ptr2d => this%decomp_npools_vr_col(:,:,k) - call restartvar(ncid=ncid, flag=flag, varname=trim(varname)//"_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%decomp_npools_vr_col(:,1,k) - call restartvar(ncid=ncid, flag=flag, varname=varname, xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg='ERROR:: '//trim(varname)//' is required on an initialization dataset'//& - errMsg(sourcefile, __LINE__)) - end if - end do - - if (use_vertsoilc) then - ptr2d => this%ntrunc_vr_col - call restartvar(ncid=ncid, flag=flag, varname="col_ntrunc_vr", xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%ntrunc_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname="col_ntrunc", xtype=ncd_double, & - dim1name='column', & - long_name='', units='', fill_value=spval, & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - - if (use_nitrif_denitrif) then - ! smin_no3_vr - if (use_vertsoilc) then - ptr2d => this%smin_no3_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='smin_no3_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%smin_no3_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='smin_no3', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg= 'ERROR:: smin_no3_vr'//' is required on an initialization dataset' ) - end if - end if - - if (use_nitrif_denitrif) then - ! smin_nh4 - if (use_vertsoilc) then - ptr2d => this%smin_nh4_vr_col(:,:) - call restartvar(ncid=ncid, flag=flag, varname='smin_nh4_vr', xtype=ncd_double, & - dim1name='column', dim2name='levgrnd', switchdim=.true., & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%smin_nh4_vr_col(:,1) - call restartvar(ncid=ncid, flag=flag, varname='smin_nh4', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=ptr1d) - end if - if (flag=='read' .and. .not. readvar) then - call endrun(msg= 'ERROR:: smin_nh4_vr'//' is required on an initialization dataset' ) - end if - end if - - ! decomp_cascade_state - the purpose of this is to check to make sure the bgc used - ! matches what the restart file was generated with. - ! add info about the SOM decomposition cascade - - if (use_century_decomp) then - decomp_cascade_state = 1 - else - decomp_cascade_state = 0 - end if - ! add info about the nitrification / denitrification state - if (use_nitrif_denitrif) then - decomp_cascade_state = decomp_cascade_state + 10 - end if - if (flag == 'write') itemp = decomp_cascade_state - call restartvar(ncid=ncid, flag=flag, varname='decomp_cascade_state', xtype=ncd_int, & - long_name='BGC of the model that wrote this restart file:' & - // ' 1s column: 0 = CLM-CN cascade, 1 = Century cascade;' & - // ' 10s column: 0 = CLM-CN denitrification, 10 = Century denitrification', units='', & - interpinic_flag='skip', readvar=readvar, data=itemp) - if (flag=='read') then - if (.not. readvar) then - ! assume, for sake of backwards compatibility, that if decomp_cascade_state - ! is not in the restart file, then the current model state is the same as - ! the prior model state - restart_file_decomp_cascade_state = decomp_cascade_state - if ( masterproc ) write(iulog,*) ' CNRest: WARNING! Restart file does not ' & - // ' contain info on decomp_cascade_state used to generate the restart file. ' - if ( masterproc ) write(iulog,*) ' Assuming the same as current setting: ', decomp_cascade_state - else - restart_file_decomp_cascade_state = itemp - if (decomp_cascade_state /= restart_file_decomp_cascade_state ) then - if ( masterproc ) then - write(iulog,*) 'CNRest: ERROR--the decomposition cascade differs between the current ' & - // ' model state and the model that wrote the restart file. ' - write(iulog,*) 'The model will be horribly out of equilibrium until after a lengthy spinup. ' - write(iulog,*) 'Stopping here since this is probably an error in configuring the run. ' - write(iulog,*) 'If you really wish to proceed, then override by setting ' - write(iulog,*) 'override_bgc_restart_mismatch_dump to .true. in the namelist' - if ( .not. override_bgc_restart_mismatch_dump ) then - call endrun(msg= ' CNRest: Stopping. Decomposition cascade mismatch error.'//& - errMsg(sourcefile, __LINE__)) - endif - endif - endif - end if - end if - - !-------------------------------- - ! Spinup state - !-------------------------------- - - ! Do nothing for write - ! Note that the call to write spinup_state out was done in soilbiogeochem_carbonstate_inst and - ! cannot be called again because it will try to define the variable twice - ! when the flag below is set to define - if (flag == 'read') then - call restartvar(ncid=ncid, flag=flag, varname='spinup_state', xtype=ncd_int, & - long_name='Spinup state of the model that wrote this restart file: ' & - // ' 0 = normal model mode, 1 = AD spinup', units='', & - interpinic_flag='copy', readvar=readvar, data=idata) - if (readvar) then - restart_file_spinup_state = idata - else - ! assume, for sake of backwards compatibility, that if spinup_state is not in - ! the restart file then current model state is the same as prior model state - restart_file_spinup_state = spinup_state - if ( masterproc ) then - write(iulog,*) ' WARNING! Restart file does not contain info ' & - // ' on spinup state used to generate the restart file. ' - write(iulog,*) ' Assuming the same as current setting: ', spinup_state - end if - end if - end if - - ! now compare the model and restart file spinup states, and either take the - ! model into spinup mode or out of it if they are not identical - ! taking model out of spinup mode requires multiplying each decomposing pool - ! by the associated AD factor. - ! putting model into spinup mode requires dividing each decomposing pool - ! by the associated AD factor. - ! only allow this to occur on first timestep of model run. - - if (flag == 'read' .and. spinup_state /= restart_file_spinup_state ) then - if (spinup_state == 0 .and. restart_file_spinup_state >= 1 ) then - if ( masterproc ) write(iulog,*) ' NitrogenStateType Restart: taking SOM pools out of AD spinup mode' - exit_spinup = .true. - else if (spinup_state >= 1 .and. restart_file_spinup_state == 0 ) then - if ( masterproc ) write(iulog,*) ' NitrogenStateType Restart: taking SOM pools into AD spinup mode' - enter_spinup = .true. - else - call endrun(msg=' Error in entering/exiting spinup. spinup_state ' & - // ' != restart_file_spinup_state, but do not know what to do'//& - errMsg(sourcefile, __LINE__)) - end if - if (get_nstep() >= 2) then - call endrun(msg=' Error in entering/exiting spinup - should occur only when nstep = 1'//& - errMsg(sourcefile, __LINE__)) - endif - if ( exit_spinup .and. isnan(this%totvegcthresh) )then - call endrun(msg=' Error in exit spinup - totvegcthresh was not set with SetTotVgCThresh'//& - errMsg(sourcefile, __LINE__)) - end if - do k = 1, ndecomp_pools - if ( exit_spinup ) then - m = decomp_cascade_con%spinup_factor(k) - else if ( enter_spinup ) then - m = 1. / decomp_cascade_con%spinup_factor(k) - end if - do c = bounds%begc, bounds%endc - l = col%landunit(c) - do j = 1, nlevdecomp - if ( abs(m - 1._r8) .gt. 0.000001_r8 .and. exit_spinup) then - this%decomp_npools_vr_col(c,j,k) = this%decomp_npools_vr_col(c,j,k) * m * & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - ! If there is no vegetation nitrogen, - ! implying that all vegetation has - ! died, then - ! reset decomp pools to near zero during exit_spinup to - ! avoid very - ! large and inert soil carbon stocks; note that only - ! pools with spinup factor > 1 - ! will be affected, which means that total SOMN and LITN - ! pools will not be set to 0. - if (totvegc_col(c) <= this%totvegcthresh .and. lun%itype(l) /= istcrop) then - this%decomp_npools_vr_col(c,j,k) = 0._r8 - endif - elseif ( abs(m - 1._r8) .gt. 0.000001_r8 .and. enter_spinup) then - this%decomp_npools_vr_col(c,j,k) = this%decomp_npools_vr_col(c,j,k) * m / & - get_spinup_latitude_term(grc%latdeg(col%gridcell(c))) - else - this%decomp_npools_vr_col(c,j,k) = this%decomp_npools_vr_col(c,j,k) * m - endif - end do - end do - end do - end if - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine SetValues ( this, num_column, filter_column, value_column ) - ! - ! !DESCRIPTION: - ! Set nitrogen state variables - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - integer , intent(in) :: num_column - integer , intent(in) :: filter_column(:) - real(r8), intent(in) :: value_column - ! - ! !LOCAL VARIABLES: - integer :: fi,i ! loop index - integer :: j,k ! indices - !------------------------------------------------------------------------ - - do fi = 1,num_column - i = filter_column(fi) - - this%sminn_col(i) = value_column - this%ntrunc_col(i) = value_column - this%cwdn_col(i) = value_column - if (use_nitrif_denitrif) then - this%smin_no3_col(i) = value_column - this%smin_nh4_col(i) = value_column - end if - this%totlitn_col(i) = value_column - this%totsomn_col(i) = value_column - this%totsomn_1m_col(i) = value_column - this%totlitn_1m_col(i) = value_column - end do - - do j = 1,nlevdecomp_full - do fi = 1,num_column - i = filter_column(fi) - this%sminn_vr_col(i,j) = value_column - this%ntrunc_vr_col(i,j) = value_column - if (use_nitrif_denitrif) then - this%smin_no3_vr_col(i,j) = value_column - this%smin_nh4_vr_col(i,j) = value_column - end if - end do - end do - - ! column and decomp_pools - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_col(i,k) = value_column - this%decomp_npools_1m_col(i,k) = value_column - end do - end do - - ! column levdecomp, and decomp_pools - do j = 1,nlevdecomp_full - do k = 1, ndecomp_pools - do fi = 1,num_column - i = filter_column(fi) - this%decomp_npools_vr_col(i,j,k) = value_column - end do - end do - end do - - end subroutine SetValues - - !----------------------------------------------------------------------- - subroutine Summary(this, bounds, num_allc, filter_allc) - ! - ! !ARGUMENTS: - class (soilbiogeochem_nitrogenstate_type) :: this - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: num_allc ! number of columns in allc filter - integer , intent(in) :: filter_allc(:) ! filter for all active columns - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l ! indices - integer :: fc ! lake filter indices - real(r8) :: maxdepth ! depth to integrate soil variables - !----------------------------------------------------------------------- - - ! vertically integrate NO3 NH4 N2O pools - if (use_nitrif_denitrif) then - do fc = 1,num_allc - c = filter_allc(fc) - this%smin_no3_col(c) = 0._r8 - this%smin_nh4_col(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%smin_no3_col(c) = & - this%smin_no3_col(c) + & - this%smin_no3_vr_col(c,j) * dzsoi_decomp(j) - - this%smin_nh4_col(c) = & - this%smin_nh4_col(c) + & - this%smin_nh4_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - end if - - ! vertically integrate each of the decomposing N pools - do l = 1, ndecomp_pools - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_npools_col(c,l) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_npools_col(c,l) = & - this%decomp_npools_col(c,l) + & - this%decomp_npools_vr_col(c,j,l) * dzsoi_decomp(j) - end do - end do - end do - - ! for vertically-resolved soil biogeochemistry, calculate some diagnostics of carbon pools to a given depth - if ( nlevdecomp > 1) then - - do l = 1, ndecomp_pools - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_npools_1m_col(c,l) = 0._r8 - end do - end do - - ! vertically integrate each of the decomposing n pools to 1 meter - maxdepth = 1._r8 - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - if ( zisoi(j) <= maxdepth ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_npools_1m_col(c,l) = & - this%decomp_npools_1m_col(c,l) + & - this%decomp_npools_vr_col(c,j,l) * dzsoi_decomp(j) - end do - elseif ( zisoi(j-1) < maxdepth ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%decomp_npools_1m_col(c,l) = & - this%decomp_npools_1m_col(c,l) + & - this%decomp_npools_vr_col(c,j,l) * (maxdepth - zisoi(j-1)) - end do - endif - end do - end do - - ! total litter nitrogen to 1 meter (TOTLITN_1m) - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitn_1m_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitn_1m_col(c) = & - this%totlitn_1m_col(c) + & - this%decomp_npools_1m_col(c,l) - end do - end if - end do - - ! total soil organic matter nitrogen to 1 meter (TOTSOMN_1m) - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomn_1m_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_soil(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomn_1m_col(c) = this%totsomn_1m_col(c) + & - this%decomp_npools_1m_col(c,l) - end do - end if - end do - - endif - - ! total litter nitrogen (TOTLITN) - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitn_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_litter(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totlitn_col(c) = & - this%totlitn_col(c) + & - this%decomp_npools_col(c,l) - end do - end if - end do - - ! total soil organic matter nitrogen (TOTSOMN) - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomn_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_soil(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%totsomn_col(c) = this%totsomn_col(c) + & - this%decomp_npools_col(c,l) - end do - end if - end do - - ! total cwdn - do fc = 1,num_allc - c = filter_allc(fc) - this%cwdn_col(c) = 0._r8 - end do - do l = 1, ndecomp_pools - if ( decomp_cascade_con%is_cwd(l) ) then - do fc = 1,num_allc - c = filter_allc(fc) - this%cwdn_col(c) = this%cwdn_col(c) + & - this%decomp_npools_col(c,l) - end do - end if - end do - - ! total sminn - do fc = 1,num_allc - c = filter_allc(fc) - this%sminn_col(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%sminn_col(c) = this%sminn_col(c) + & - this%sminn_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - ! total col_ntrunc - do fc = 1,num_allc - c = filter_allc(fc) - this%ntrunc_col(c) = 0._r8 - end do - do j = 1, nlevdecomp - do fc = 1,num_allc - c = filter_allc(fc) - this%ntrunc_col(c) = this%ntrunc_col(c) + & - this%ntrunc_vr_col(c,j) * dzsoi_decomp(j) - end do - end do - - end subroutine Summary - - !----------------------------------------------------------------------- - subroutine DynamicColumnAdjustments(this, bounds, clump_index, column_state_updater) - ! - ! !DESCRIPTION: - ! Adjust state variables when column areas change due to dynamic landuse - ! - ! !USES: - use dynColumnStateUpdaterMod, only : column_state_updater_type - ! - ! !ARGUMENTS: - class(soilbiogeochem_nitrogenstate_type) , intent(inout) :: this - type(bounds_type) , intent(in) :: bounds - - ! Index of clump on which we're currently operating. Note that this implies that this - ! routine must be called from within a clump loop. - integer , intent(in) :: clump_index - - type(column_state_updater_type) , intent(in) :: column_state_updater - ! - ! !LOCAL VARIABLES: - integer :: j ! level - integer :: l ! decomp pool - real(r8) :: adjustment_one_level(bounds%begc:bounds%endc) - integer :: begc, endc - - character(len=*), parameter :: subname = 'DynamicColumnAdjustments' - !----------------------------------------------------------------------- - - begc = bounds%begc - endc = bounds%endc - - this%dyn_nbal_adjustments_col(begc:endc) = 0._r8 - - do l = 1, ndecomp_pools - do j = 1, nlevdecomp - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%decomp_npools_vr_col(begc:endc, j, l), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_nbal_adjustments_col(begc:endc) = & - this%dyn_nbal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - end do - end do - - do j = 1, nlevdecomp - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%ntrunc_vr_col(begc:endc, j), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_nbal_adjustments_col(begc:endc) = & - this%dyn_nbal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%sminn_vr_col(begc:endc, j), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_nbal_adjustments_col(begc:endc) = & - this%dyn_nbal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - end do - - if (use_nitrif_denitrif) then - - do j = 1, nlevdecomp - ! Separately track adjustments made to no3 and nh4 pools, since those aren't included - ! in the overall N balance (totn) - this%dyn_no3bal_adjustments_col(begc:endc) = 0._r8 - this%dyn_nh4bal_adjustments_col(begc:endc) = 0._r8 - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%smin_no3_vr_col(begc:endc, j), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_no3bal_adjustments_col(begc:endc) = & - this%dyn_no3bal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - - call column_state_updater%update_column_state_no_special_handling( & - bounds = bounds, & - clump_index = clump_index, & - var = this%smin_nh4_vr_col(begc:endc, j), & - adjustment = adjustment_one_level(begc:endc)) - this%dyn_nh4bal_adjustments_col(begc:endc) = & - this%dyn_nh4bal_adjustments_col(begc:endc) + & - adjustment_one_level(begc:endc) * dzsoi_decomp(j) - end do - - end if - - end subroutine DynamicColumnAdjustments - - !------------------------------------------------------------------------ - subroutine SetTotVgCThresh(this, totvegcthresh) - - class(soilbiogeochem_nitrogenstate_type) :: this - real(r8) , intent(in) :: totvegcthresh - - if ( totvegcthresh <= 0.0_r8 )then - call endrun(msg=' Error totvegcthresh is zero or negative and should be > 0'//& - errMsg(sourcefile, __LINE__)) - end if - this%totvegcthresh = totvegcthresh - - end subroutine SetTotVgCThresh - -end module SoilBiogeochemNitrogenStateType diff --git a/src/soilbiogeochem/SoilBiogeochemNitrogenUptakeMod.F90 b/src/soilbiogeochem/SoilBiogeochemNitrogenUptakeMod.F90 deleted file mode 100644 index 578367de97..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemNitrogenUptakeMod.F90 +++ /dev/null @@ -1,81 +0,0 @@ -module SoilBiogeochemNitrogenUptakeMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate the nitrogen uptake profile - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: SoilBiogeochemNitrogenUptake - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemNitrogenUptake(bounds, nlevdecomp, num_soilc, filter_soilc, & - sminn_vr, dzsoi_decomp, nfixation_prof, nuptake_prof) - ! - ! DESCRIPTION - ! Calculate the nitrogen uptake profile - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: nlevdecomp ! number of vertical layers - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - real(r8) , intent(in) :: sminn_vr(bounds%begc: , 1: ) ! soil mineral nitrogen profile - real(r8) , intent(in) :: dzsoi_decomp(1: ) ! layer thickness - real(r8) , intent(in) :: nfixation_prof(bounds%begc: , 1: ) ! nitrogen fixation profile - real(r8) , intent(inout) :: nuptake_prof(bounds%begc:bounds%endc, 1:nlevdecomp) ! nitrogen uptake profile - ! - ! !LOCAL VARIABLES: - integer :: fc, j, c ! indices - real(r8):: sminn_tot(bounds%begc:bounds%endc) !vertically integrated mineral nitrogen - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(dzsoi_decomp) == (/nlevdecomp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(sminn_vr) == (/bounds%endc, nlevdecomp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(nfixation_prof) == (/bounds%endc, nlevdecomp/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(nuptake_prof) == (/bounds%endc, nlevdecomp/)) , errMsg(sourcefile, __LINE__)) - - ! init sminn_tot - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_tot(c) = 0. - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - sminn_tot(c) = sminn_tot(c) + sminn_vr(c,j) * dzsoi_decomp(j) - end do - end do - - do j = 1, nlevdecomp - do fc=1,num_soilc - c = filter_soilc(fc) - if (sminn_tot(c) > 0.) then - nuptake_prof(c,j) = sminn_vr(c,j) / sminn_tot(c) - else - nuptake_prof(c,j) = nfixation_prof(c,j) - endif - - end do - end do - - end subroutine SoilBiogeochemNitrogenUptake - -end module SoilBiogeochemNitrogenUptakeMod diff --git a/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 b/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 deleted file mode 100644 index 2349a63fd4..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemPotentialMod.F90 +++ /dev/null @@ -1,266 +0,0 @@ -module SoilBiogeochemPotentialMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate potential decomp rates and total immobilization demand. - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use clm_varpar , only : nlevdecomp, ndecomp_cascade_transitions, ndecomp_pools - use SoilBiogeochemDecompCascadeConType , only : decomp_cascade_con - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemCarbonFluxType , only : soilbiogeochem_carbonflux_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use SoilBiogeochemNitrogenFluxType , only : soilbiogeochem_nitrogenflux_type - use clm_varctl , only : use_fates, iulog - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: readParams - public :: SoilBiogeochemPotential - ! - type, private :: params_type - real(r8) :: dnp !denitrification proportion - end type Params_type - ! - type(params_type), private :: params_inst - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine readParams ( ncid ) - ! - ! !DESCRIPTION: - ! Read parameters - ! - ! !USES: - use ncdio_pio , only: file_desc_t,ncd_io - use abortutils , only: endrun - use shr_log_mod , only: errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - type(file_desc_t),intent(inout) :: ncid ! pio netCDF file id - ! - ! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNDecompParamsType' - character(len=100) :: errCode = '-Error reading in parameters file:' - logical :: readv ! has variable been read in or not - real(r8) :: tempr ! temporary to read in constant - character(len=100) :: tString ! temp. var for reading - !----------------------------------------------------------------------- - - tString='dnp' - call ncd_io(trim(tString),tempr, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun(msg=trim(errCode)//trim(tString)//errMsg(sourcefile, __LINE__)) - params_inst%dnp=tempr - - end subroutine readParams - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemPotential (bounds, num_soilc, filter_soilc, & - soilbiogeochem_state_inst, soilbiogeochem_carbonstate_inst, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_nitrogenstate_inst, soilbiogeochem_nitrogenflux_inst, & - cn_decomp_pools, p_decomp_cpool_loss, pmnf_decomp_cascade) - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - ! - ! !ARGUMENT: - 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 - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - type(soilbiogeochem_carbonstate_type) , intent(in) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonflux_type) , intent(inout) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - type(soilbiogeochem_nitrogenflux_type) , intent(inout) :: soilbiogeochem_nitrogenflux_inst - real(r8) , intent(out) :: cn_decomp_pools(bounds%begc:,1:,1:) ! c:n ratios of applicable pools - real(r8) , intent(out) :: p_decomp_cpool_loss(bounds%begc:,1:,1:) ! potential C loss from one pool to another - real(r8) , intent(out) :: pmnf_decomp_cascade(bounds%begc:,1:,1:) ! potential mineral N flux, from one pool to another - ! - ! !LOCAL VARIABLES: - integer :: c,j,k,l,m !indices - integer :: fc !filter column index - integer :: begc,endc !bounds - real(r8):: immob(bounds%begc:bounds%endc,1:nlevdecomp) !potential N immobilization - real(r8):: ratio !temporary variable - integer, parameter :: i_atm = 0 !TODO - this appears in two places - move it to 1 - !----------------------------------------------------------------------- - - begc = bounds%begc; endc = bounds%endc - - SHR_ASSERT_ALL((ubound(cn_decomp_pools) == (/endc,nlevdecomp,ndecomp_pools/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(p_decomp_cpool_loss) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(pmnf_decomp_cascade) == (/endc,nlevdecomp,ndecomp_cascade_transitions/)) , errMsg(sourcefile, __LINE__)) - - associate( & - cascade_donor_pool => decomp_cascade_con%cascade_donor_pool , & ! Input: [integer (:) ] which pool is C taken from for a given decomposition step - cascade_receiver_pool => decomp_cascade_con%cascade_receiver_pool , & ! Input: [integer (:) ] which pool is C added to for a given decomposition step - floating_cn_ratio_decomp_pools => decomp_cascade_con%floating_cn_ratio_decomp_pools , & ! Input: [logical (:) ] TRUE => pool has fixed C:N ratio - initial_cn_ratio => decomp_cascade_con%initial_cn_ratio , & ! Input: [real(r8) (:) ] c:n ratio for initialization of pools - - fpi_vr => soilbiogeochem_state_inst%fpi_vr_col , & ! Input: [real(r8) (:,:) ] fraction of potential immobilization (no units) - rf_decomp_cascade => soilbiogeochem_state_inst%rf_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] respired fraction in decomposition step (frac) - pathfrac_decomp_cascade => soilbiogeochem_state_inst%pathfrac_decomp_cascade_col , & ! Input: [real(r8) (:,:,:) ] what fraction of C leaving a given pool passes through a given transition (frac) - - decomp_npools_vr => soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - - decomp_cpools_vr => soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col , & ! Input: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - decomp_cascade_ntransfer_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_ntransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res transfer of N from donor to receiver pool along decomp. cascade (gN/m3/s) - decomp_cascade_sminn_flux_vr => soilbiogeochem_nitrogenflux_inst%decomp_cascade_sminn_flux_vr_col , & ! Output: [real(r8) (:,:,:) ] vert-res mineral N flux for transition along decomposition cascade (gN/m3/s) - potential_immob_vr => soilbiogeochem_nitrogenflux_inst%potential_immob_vr_col , & ! Output: [real(r8) (:,:) ] - sminn_to_denit_decomp_cascade_vr => soilbiogeochem_nitrogenflux_inst%sminn_to_denit_decomp_cascade_vr_col , & ! Output: [real(r8) (:,:,:) ] - gross_nmin_vr => soilbiogeochem_nitrogenflux_inst%gross_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - net_nmin_vr => soilbiogeochem_nitrogenflux_inst%net_nmin_vr_col , & ! Output: [real(r8) (:,:) ] - gross_nmin => soilbiogeochem_nitrogenflux_inst%gross_nmin_col , & ! Output: [real(r8) (:) ] gross rate of N mineralization (gN/m2/s) - net_nmin => soilbiogeochem_nitrogenflux_inst%net_nmin_col , & ! Output: [real(r8) (:) ] net rate of N mineralization (gN/m2/s) - - w_scalar => soilbiogeochem_carbonflux_inst%w_scalar_col , & ! Input: [real(r8) (:,:) ] fraction by which decomposition is limited by moisture availability - decomp_cascade_hr_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_hr_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_cascade_ctransfer_vr => soilbiogeochem_carbonflux_inst%decomp_cascade_ctransfer_vr_col , & ! Output: [real(r8) (:,:,:) ] vertically-resolved het. resp. from decomposing C pools (gC/m3/s) - decomp_k => soilbiogeochem_carbonflux_inst%decomp_k_col , & ! Output: [real(r8) (:,:,:) ] rate constant for decomposition (1./sec) - phr_vr => soilbiogeochem_carbonflux_inst%phr_vr_col , & ! Output: [real(r8) (:,:) ] potential HR (gC/m3/s) - fphr => soilbiogeochem_carbonflux_inst%fphr_col & ! Output: [real(r8) (:,:) ] fraction of potential SOM + LITTER heterotrophic - ) - - if ( .not. use_fates ) then - ! set initial values for potential C and N fluxes - p_decomp_cpool_loss(begc:endc, :, :) = 0._r8 - pmnf_decomp_cascade(begc:endc, :, :) = 0._r8 - - ! column loop to calculate potential decomp rates and total immobilization demand - - !! calculate c:n ratios of applicable pools - do l = 1, ndecomp_pools - if ( floating_cn_ratio_decomp_pools(l) ) then - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if ( decomp_npools_vr(c,j,l) > 0._r8 ) then - cn_decomp_pools(c,j,l) = decomp_cpools_vr(c,j,l) / decomp_npools_vr(c,j,l) - end if - end do - end do - else - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - cn_decomp_pools(c,j,l) = initial_cn_ratio(l) - end do - end do - end if - end do - - ! calculate the non-nitrogen-limited fluxes - ! these fluxes include the "/ dt" term to put them on a - ! per second basis, since the rate constants have been - ! calculated on a per timestep basis. - - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (decomp_cpools_vr(c,j,cascade_donor_pool(k)) > 0._r8 .and. & - decomp_k(c,j,cascade_donor_pool(k)) > 0._r8 ) then - p_decomp_cpool_loss(c,j,k) = decomp_cpools_vr(c,j,cascade_donor_pool(k)) & - * decomp_k(c,j,cascade_donor_pool(k)) * pathfrac_decomp_cascade(c,j,k) - if ( .not. floating_cn_ratio_decomp_pools(cascade_receiver_pool(k)) ) then !! not transition of cwd to litter - - if (cascade_receiver_pool(k) /= i_atm ) then ! not 100% respiration - ratio = 0._r8 - - if (decomp_npools_vr(c,j,cascade_donor_pool(k)) > 0._r8) then - ratio = cn_decomp_pools(c,j,cascade_receiver_pool(k))/cn_decomp_pools(c,j,cascade_donor_pool(k)) - endif - - pmnf_decomp_cascade(c,j,k) = (p_decomp_cpool_loss(c,j,k) * (1.0_r8 - rf_decomp_cascade(c,j,k) - ratio) & - / cn_decomp_pools(c,j,cascade_receiver_pool(k)) ) - - else ! 100% respiration - pmnf_decomp_cascade(c,j,k) = - p_decomp_cpool_loss(c,j,k) / cn_decomp_pools(c,j,cascade_donor_pool(k)) - endif - - else ! CWD -> litter - pmnf_decomp_cascade(c,j,k) = 0._r8 - end if - end if - end do - - end do - end do - - ! Sum up all the potential immobilization fluxes (positive pmnf flux) - ! and all the mineralization fluxes (negative pmnf flux) - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - immob(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pmnf_decomp_cascade(c,j,k) > 0._r8) then - immob(c,j) = immob(c,j) + pmnf_decomp_cascade(c,j,k) - else - gross_nmin_vr(c,j) = gross_nmin_vr(c,j) - pmnf_decomp_cascade(c,j,k) - end if - end do - end do - end do - - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - potential_immob_vr(c,j) = immob(c,j) - end do - end do - else ! use_fates - ! As a first step we are making this a C-only model, so no N downregulation of fluxes. - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - ! - p_decomp_cpool_loss(c,j,k) = decomp_cpools_vr(c,j,cascade_donor_pool(k)) & - * decomp_k(c,j,cascade_donor_pool(k)) * pathfrac_decomp_cascade(c,j,k) - ! - end do - end do - end do - end if - - ! Add up potential hr for methane calculations - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - phr_vr(c,j) = 0._r8 - end do - end do - do k = 1, ndecomp_cascade_transitions - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - phr_vr(c,j) = phr_vr(c,j) + rf_decomp_cascade(c,j,k) * p_decomp_cpool_loss(c,j,k) - end do - end do - end do - - end associate - - end subroutine SoilBiogeochemPotential - -end module SoilBiogeochemPotentialMod diff --git a/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 b/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 deleted file mode 100644 index 2bd92d2d41..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemPrecisionControlMod.F90 +++ /dev/null @@ -1,196 +0,0 @@ -module SoilBiogeochemPrecisionControlMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! controls on very low values in critical state variables - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varpar , only : ndecomp_pools - use SoilBiogeochemCarbonStateType , only : soilbiogeochem_carbonstate_type - use SoilBiogeochemNitrogenStateType , only : soilbiogeochem_nitrogenstate_type - use ColumnType , only : col - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: SoilBiogeochemPrecisionControlInit ! Initialization - public:: SoilBiogeochemPrecisionControl ! Apply precision control to soil biogeochemistry carbon and nitrogen states - - ! !PUBLIC DATA: - real(r8), public :: ccrit ! critical carbon state value for truncation (gC/m2) - real(r8), public :: ncrit ! critical nitrogen state value for truncation (gN/m2) - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemPrecisionControlInit( soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst) - - ! - ! !DESCRIPTION: - ! Initialization of soil biogeochemistry precision control - ! - ! !USES: - use clm_varctl , only : use_c13, use_c14 - ! - ! !ARGUMENTS: - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - real(r8), parameter :: totvegcthresh = 0.1_r8 ! Total vegetation carbon threshold to zero out decomposition pools - !----------------------------------------------------------------------- - ccrit = 1.e-8_r8 ! critical carbon state value for truncation (gC/m2) - ncrit = 1.e-8_r8 ! critical nitrogen state value for truncation (gN/m2) - - call soilbiogeochem_carbonstate_inst%setTotVgCThresh( totvegcthresh ) - if ( use_c13 )then - call c13_soilbiogeochem_carbonstate_inst%setTotVgCThresh( totvegcthresh ) - end if - if ( use_c14 )then - call c14_soilbiogeochem_carbonstate_inst%setTotVgCThresh( totvegcthresh ) - end if - call soilbiogeochem_nitrogenstate_inst%setTotVgCThresh( totvegcthresh ) - - end subroutine SoilBiogeochemPrecisionControlInit - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemPrecisionControl(num_soilc, filter_soilc, & - soilbiogeochem_carbonstate_inst, c13_soilbiogeochem_carbonstate_inst, & - c14_soilbiogeochem_carbonstate_inst, soilbiogeochem_nitrogenstate_inst) - - ! - ! !DESCRIPTION: - ! On the radiation time step, force leaf and deadstem c and n to 0 if - ! they get too small. - ! - ! !USES: - use clm_varctl , only : iulog, use_c13, use_c14, use_nitrif_denitrif, use_cn - use clm_varpar , only : nlevdecomp - use CNSharedParamsMod, only: use_fun - ! - ! !ARGUMENTS: - integer , intent(in) :: num_soilc ! number of soil columns in filter - integer , intent(in) :: filter_soilc(:) ! filter for soil columns - type(soilbiogeochem_carbonstate_type) , intent(inout) :: soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c13_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_carbonstate_type) , intent(inout) :: c14_soilbiogeochem_carbonstate_inst - type(soilbiogeochem_nitrogenstate_type) , intent(inout) :: soilbiogeochem_nitrogenstate_inst - ! - ! !LOCAL VARIABLES: - integer :: c,j,k ! indices - integer :: fc ! filter indices - real(r8):: cc,cn ! truncation terms for column-level corrections - real(r8):: cc13 ! truncation terms for column-level corrections - real(r8):: cc14 ! truncation terms for column-level corrections - !----------------------------------------------------------------------- - - ! soilbiogeochem_carbonstate_inst%ctrunc_vr_col Output: [real(r8) (:,:) ] (gC/m3) column-level sink for C truncation - ! soilbiogeochem_carbonstate_inst%decomp_cpools_vr_col Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) c pools - - ! soilbiogeochem_nitrogenstate_inst%ntrunc_vr_col Output: [real(r8) (:,:) ] (gN/m3) column-level sink for N truncation - ! soilbiogeochem_nitrogenstate_inst%decomp_npools_vr_col Output: [real(r8) (:,:,:) ] (gC/m3) vertically-resolved decomposing (litter, cwd, soil) N pools - ! soilbiogeochem_nitrogenstate_inst%smin_nh4_vr_col Output: [real(r8) (:,:) ] (gN/m3) soil mineral NH4 - ! soilbiogeochem_nitrogenstate_inst%smin_no3_vr_col Output: [real(r8) (:,:) ] (gN/m3) soil mineral NO3 - - associate(& - cs => soilbiogeochem_carbonstate_inst , & - ns => soilbiogeochem_nitrogenstate_inst , & - c13cs => c13_soilbiogeochem_carbonstate_inst , & - c14cs => c14_soilbiogeochem_carbonstate_inst & - ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - do j = 1,nlevdecomp - ! initialize the column-level C and N truncation terms - cc = 0._r8 - if ( use_c13 ) cc13 = 0._r8 - if ( use_c14 ) cc14 = 0._r8 - cn = 0._r8 - - ! do tests on state variables for precision control - ! for linked C-N state variables, perform precision test on - ! the C component, but truncate both C and N components - - - ! all decomposing pools C and N - do k = 1, ndecomp_pools - - if (abs(cs%decomp_cpools_vr_col(c,j,k)) < ccrit) then - cc = cc + cs%decomp_cpools_vr_col(c,j,k) - cs%decomp_cpools_vr_col(c,j,k) = 0._r8 - - if (use_cn) then - cn = cn + ns%decomp_npools_vr_col(c,j,k) - ns%decomp_npools_vr_col(c,j,k) = 0._r8 - endif - - if ( use_c13 ) then - cc13 = cc13 + c13cs%decomp_cpools_vr_col(c,j,k) - c13cs%decomp_cpools_vr_col(c,j,k) = 0._r8 - endif - if ( use_c14 ) then - cc14 = cc14 + c14cs%decomp_cpools_vr_col(c,j,k) - c14cs%decomp_cpools_vr_col(c,j,k) = 0._r8 - endif - end if - - end do - - ! not doing precision control on soil mineral N, since it will - ! be getting the N truncation flux anyway. - - cs%ctrunc_vr_col(c,j) = cs%ctrunc_vr_col(c,j) + cc - - if (use_cn) then - ns%ntrunc_vr_col(c,j) = ns%ntrunc_vr_col(c,j) + cn - endif - if ( use_c13 ) then - c13cs%ctrunc_vr_col(c,j) = c13cs%ctrunc_vr_col(c,j) + cc13 - endif - if ( use_c14 ) then - c14cs%ctrunc_vr_col(c,j) = c14cs%ctrunc_vr_col(c,j) + cc14 - endif - end do - - end do ! end of column loop - - if(.not.use_fun)then - if (use_nitrif_denitrif) then - ! remove small negative perturbations for stability purposes, if any should arise. - - do fc = 1,num_soilc - c = filter_soilc(fc) - do j = 1,nlevdecomp - if (abs(ns%smin_no3_vr_col(c,j)) < ncrit/1e4_r8) then - if ( ns%smin_no3_vr_col(c,j) < 0._r8 ) then - !write(iulog, *) '-10^-12 < smin_no3 < 0. resetting to zero.' - !write(iulog, *) 'smin_no3_vr_col(c,j), c, j: ', ns%smin_no3_vr_col(c,j), c, j - ns%smin_no3_vr_col(c,j) = 0._r8 - endif - end if - if (abs(ns%smin_nh4_vr_col(c,j)) < ncrit/1e4_r8) then - if ( ns%smin_nh4_vr_col(c,j) < 0._r8 ) then - !write(iulog, *) '-10^-12 < smin_nh4 < 0. resetting to zero.' - !write(iulog, *) 'smin_nh4_vr_col(c,j), c, j: ', ns%smin_nh4_vr_col(c,j), c, j - ns%smin_nh4_vr_col(c,j) = 0._r8 - endif - end if - end do - end do - endif - endif - - end associate - - end subroutine SoilBiogeochemPrecisionControl - -end module SoilBiogeochemPrecisionControlMod diff --git a/src/soilbiogeochem/SoilBiogeochemStateType.F90 b/src/soilbiogeochem/SoilBiogeochemStateType.F90 deleted file mode 100644 index 45cf6e27dd..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemStateType.F90 +++ /dev/null @@ -1,336 +0,0 @@ -module SoilBiogeochemStateType - - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use decompMod , only : bounds_type - use abortutils , only : endrun - use spmdMod , only : masterproc - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak, nlevsoifl, nlevsoi - use clm_varpar , only : ndecomp_cascade_transitions, nlevdecomp, nlevdecomp_full - use clm_varcon , only : spval, ispval, c14ratio, grlnd - use landunit_varcon, only : istsoil, istcrop - use clm_varpar , only : nlevsno, nlevgrnd, nlevlak - use clm_varctl , only : use_vertsoilc, use_cn - use clm_varctl , only : iulog - use LandunitType , only : lun - use ColumnType , only : col - ! - ! !PUBLIC TYPES: - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: get_spinup_latitude_term - ! - ! !PUBLIC TYPES: - type, public :: soilbiogeochem_state_type - - real(r8) , pointer :: leaf_prof_patch (:,:) ! (1/m) profile of leaves (vertical profiles for calculating fluxes) - real(r8) , pointer :: froot_prof_patch (:,:) ! (1/m) profile of fine roots (vertical profiles for calculating fluxes) - real(r8) , pointer :: croot_prof_patch (:,:) ! (1/m) profile of coarse roots (vertical profiles for calculating fluxes) - real(r8) , pointer :: stem_prof_patch (:,:) ! (1/m) profile of stems (vertical profiles for calculating fluxes) - real(r8) , pointer :: fpi_vr_col (:,:) ! (no units) fraction of potential immobilization - real(r8) , pointer :: fpi_col (:) ! (no units) fraction of potential immobilization - real(r8), pointer :: fpg_col (:) ! (no units) fraction of potential gpp - real(r8) , pointer :: rf_decomp_cascade_col (:,:,:) ! (frac) respired fraction in decomposition step - real(r8) , pointer :: pathfrac_decomp_cascade_col (:,:,:) ! (frac) what fraction of C leaving a given pool passes through a given transition - real(r8) , pointer :: nfixation_prof_col (:,:) ! (1/m) profile for N fixation additions - real(r8) , pointer :: ndep_prof_col (:,:) ! (1/m) profile for N fixation additions - real(r8) , pointer :: som_adv_coef_col (:,:) ! (m2/s) SOM advective flux - real(r8) , pointer :: som_diffus_coef_col (:,:) ! (m2/s) SOM diffusivity due to bio/cryo-turbation - real(r8) , pointer :: plant_ndemand_col (:) ! column-level plant N demand - - contains - - procedure, public :: Init - procedure, public :: Restart - procedure, private :: InitAllocate - procedure, private :: InitHistory - procedure, private :: InitCold - - end type soilbiogeochem_state_type - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine Init(this, bounds) - - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - - call this%InitAllocate ( bounds ) - if (use_cn) then - call this%InitHistory ( bounds ) - end if - call this%InitCold ( bounds ) - - end subroutine Init - - !------------------------------------------------------------------------ - subroutine InitAllocate(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - allocate(this%leaf_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%leaf_prof_patch (:,:) = spval - allocate(this%froot_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%froot_prof_patch (:,:) = spval - allocate(this%croot_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%croot_prof_patch (:,:) = spval - allocate(this%stem_prof_patch (begp:endp,1:nlevdecomp_full)) ; this%stem_prof_patch (:,:) = spval - allocate(this%fpi_vr_col (begc:endc,1:nlevdecomp_full)) ; this%fpi_vr_col (:,:) = nan - allocate(this%fpi_col (begc:endc)) ; this%fpi_col (:) = nan - allocate(this%fpg_col (begc:endc)) ; this%fpg_col (:) = nan - allocate(this%nfixation_prof_col (begc:endc,1:nlevdecomp_full)) ; this%nfixation_prof_col (:,:) = spval - allocate(this%ndep_prof_col (begc:endc,1:nlevdecomp_full)) ; this%ndep_prof_col (:,:) = spval - allocate(this%som_adv_coef_col (begc:endc,1:nlevdecomp_full)) ; this%som_adv_coef_col (:,:) = spval - allocate(this%som_diffus_coef_col (begc:endc,1:nlevdecomp_full)) ; this%som_diffus_coef_col (:,:) = spval - allocate(this%plant_ndemand_col (begc:endc)) ; this%plant_ndemand_col (:) = nan - - allocate(this%rf_decomp_cascade_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)); - this%rf_decomp_cascade_col(:,:,:) = nan - - allocate(this%pathfrac_decomp_cascade_col(begc:endc,1:nlevdecomp_full,1:ndecomp_cascade_transitions)); - this%pathfrac_decomp_cascade_col(:,:,:) = nan - - end subroutine InitAllocate - - !------------------------------------------------------------------------ - subroutine InitHistory(this, bounds) - ! - ! !DESCRIPTION: - ! Initialize module data structure - ! - ! !USES: - use shr_infnan_mod , only : nan => shr_infnan_nan, assignment(=) - use histFileMod , only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp, no_snow_normal - use CNSharedParamsMod , only : use_fun - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: begp, endp - integer :: begc, endc - character(8) :: vr_suffix - character(10) :: active - real(r8), pointer :: data2dptr(:,:), data1dptr(:) ! temp. pointers for slicing larger arrays - !------------------------------------------------------------------------ - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - this%croot_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='CROOT_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from coarse roots', & - ptr_patch=this%croot_prof_patch, default='inactive') - - this%froot_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='FROOT_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from fine roots', & - ptr_patch=this%froot_prof_patch, default='inactive') - - this%leaf_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='LEAF_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from leaves', & - ptr_patch=this%leaf_prof_patch, default='inactive') - - this%stem_prof_patch(begp:endp,:) = spval - call hist_addfld_decomp (fname='STEM_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for litter C and N inputs from stems', & - ptr_patch=this%stem_prof_patch, default='inactive') - - this%nfixation_prof_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='NFIXATION_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for biological N fixation', & - ptr_col=this%nfixation_prof_col, default='inactive') - - this%ndep_prof_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='NDEP_PROF', units='1/m', type2d='levdcmp', & - avgflag='A', long_name='profile for atmospheric N deposition', & - ptr_col=this%ndep_prof_col, default='inactive') - - this%som_adv_coef_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SOM_ADV_COEF', units='m/s', type2d='levdcmp', & - avgflag='A', long_name='advection term for vertical SOM translocation', & - ptr_col=this%som_adv_coef_col, default='inactive') - - this%som_diffus_coef_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='SOM_DIFFUS_COEF', units='m^2/s', type2d='levdcmp', & - avgflag='A', long_name='diffusion coefficient for vertical SOM translocation', & - ptr_col=this%som_diffus_coef_col, default='inactive') - - if ( nlevdecomp_full > 1 ) then - this%fpi_col(begc:endc) = spval - call hist_addfld1d (fname='FPI', units='proportion', & - avgflag='A', long_name='fraction of potential immobilization', & - ptr_col=this%fpi_col) - endif - - if (.not. use_fun) then - this%fpg_col(begc:endc) = spval - call hist_addfld1d (fname='FPG', units='proportion', & - avgflag='A', long_name='fraction of potential gpp', & - ptr_col=this%fpg_col) - end if - - if (nlevdecomp > 1) then - vr_suffix = "_vr" - else - vr_suffix = "" - endif - this%fpi_vr_col(begc:endc,:) = spval - call hist_addfld_decomp (fname='FPI'//trim(vr_suffix), units='proportion', type2d='levdcmp', & - avgflag='A', long_name='fraction of potential immobilization', & - ptr_col=this%fpi_vr_col, default='inactive') - - end subroutine InitHistory - - !----------------------------------------------------------------------- - subroutine initCold(this, bounds) - ! - ! !USES: - use spmdMod , only : masterproc - use fileutils , only : getfil - use ncdio_pio - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: g,l,c,p,n,j,m ! indices - integer :: dimid ! dimension id - integer :: ier ! error status - logical :: readvar - integer :: begc, endc - !----------------------------------------------------------------------- - - begc = bounds%begc; endc= bounds%endc - - ! -------------------------------------------------------------------- - ! Initialize terms needed for dust model - ! -------------------------------------------------------------------- - - do c = bounds%begc, bounds%endc - l = col%landunit(c) - if (lun%ifspecial(l)) then - this%fpi_col (c) = spval - this%fpg_col (c) = spval - do j = 1,nlevdecomp_full - this%fpi_vr_col(c,j) = spval - end do - end if - - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - ! initialize fpi_vr so that levels below nlevsoi are not nans - this%fpi_vr_col(c,1:nlevdecomp_full) = 0._r8 - this%som_adv_coef_col(c,1:nlevdecomp_full) = 0._r8 - this%som_diffus_coef_col(c,1:nlevdecomp_full) = 0._r8 - - ! initialize the profiles for converting to vertically resolved carbon pools - this%nfixation_prof_col(c,1:nlevdecomp_full) = 0._r8 - this%ndep_prof_col(c,1:nlevdecomp_full) = 0._r8 - end if - end do - - end subroutine initCold - - !------------------------------------------------------------------------ - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use shr_log_mod, only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc - use abortutils , only : endrun - use restUtilMod - use ncdio_pio - ! - ! !ARGUMENTS: - class(soilbiogeochem_state_type) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid - character(len=*) , intent(in) :: flag - ! - ! !LOCAL VARIABLES: - integer, pointer :: temp1d(:) ! temporary - integer :: p,j,c,i ! indices - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: ptr2d(:,:) ! temp. pointers for slicing larger arrays - real(r8), pointer :: ptr1d(:) ! temp. pointers for slicing larger arrays - !----------------------------------------------------------------------- - - if (use_vertsoilc) then - ptr2d => this%fpi_vr_col - call restartvar(ncid=ncid, flag=flag, varname='fpi_vr', xtype=ncd_double, & - dim1name='column',dim2name='levgrnd', switchdim=.true., & - long_name='fraction of potential immobilization', units='unitless', & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - else - ptr1d => this%fpi_vr_col(:,1) ! nlevdecomp = 1; so treat as 1D variable - call restartvar(ncid=ncid, flag=flag, varname='fpi', xtype=ncd_double, & - dim1name='column', & - long_name='fraction of potential immobilization', units='unitless', & - interpinic_flag='interp' , readvar=readvar, data=ptr1d) - end if - - if (use_vertsoilc) then - ptr2d => this%som_adv_coef_col - call restartvar(ncid=ncid, flag=flag, varname='som_adv_coef_vr', xtype=ncd_double, & - dim1name='column',dim2name='levgrnd', switchdim=.true., & - long_name='SOM advective flux', units='m/s', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - end if - - if (use_vertsoilc) then - ptr2d => this%som_diffus_coef_col - call restartvar(ncid=ncid, flag=flag, varname='som_diffus_coef_vr', xtype=ncd_double, & - dim1name='column',dim2name='levgrnd', switchdim=.true., & - long_name='SOM diffusivity due to bio/cryo-turbation', units='m^2/s', fill_value=spval, & - interpinic_flag='interp', readvar=readvar, data=ptr2d) - end if - - call restartvar(ncid=ncid, flag=flag, varname='fpg', xtype=ncd_double, & - dim1name='column', & - long_name='', units='', & - interpinic_flag='interp', readvar=readvar, data=this%fpg_col) - - end subroutine Restart - - - function get_spinup_latitude_term(latitude) result(ans) - - !!DESCRIPTION: - ! calculate a logistic function to scale spinup factors so that spinup is more accelerated in high latitude regions - ! - ! !REVISION HISTORY - ! charlie koven, nov. 2015 - ! - ! !ARGUMENTS: - real(r8), intent(in) :: latitude - ! - ! !LOCAL VARIABLES: - real(r8) :: ans - - ans = 1._r8 + 50._r8 / ( 1._r8 + exp(-0.15_r8 * (abs(latitude) - 60._r8) ) ) - - return - end function get_spinup_latitude_term - -end module SoilBiogeochemStateType diff --git a/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 b/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 deleted file mode 100644 index 94c8c55d6a..0000000000 --- a/src/soilbiogeochem/SoilBiogeochemVerticalProfileMod.F90 +++ /dev/null @@ -1,277 +0,0 @@ -module SoilBiogeochemVerticalProfileMod - -#include "shr_assert.h" - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Calculate vertical profiles for distributing soil and litter C and N - ! - ! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - ! - implicit none - private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public:: SoilBiogeochemVerticalProfile - ! - real(r8), public :: surfprof_exp = 10. ! how steep profile is for surface components (1/ e_folding depth) (1/m) - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine SoilBiogeochemVerticalProfile(bounds, num_soilc,filter_soilc,num_soilp,filter_soilp, & - canopystate_inst, soilstate_inst, soilbiogeochem_state_inst) - ! - ! !DESCRIPTION: - ! calculate vertical profiles for distributing soil and litter C and N - ! - ! BUG(wjs, 2014-12-15, bugz 2107) - ! Because of this routine's placement in the driver sequence (it is - ! called very early in each timestep, before weights are adjusted and filters are - ! updated), it may be necessary for this routine to compute values over inactive as well - ! as active points (since some inactive points may soon become active) - so that's what - ! is done now. Currently, it seems to be okay to do this, because the variables computed - ! here seem to only depend on quantities that are valid over inactive as well as active - ! points. However, note that this routine is (mistakenly) called from two places - ! currently - the above note applies to its call from the driver, but its call from - ! CNDecompMod uses the standard filters that just apply over active points - ! - ! !USES: - use shr_log_mod , only : errMsg => shr_log_errMsg - use decompMod , only : bounds_type - use abortutils , only : endrun - use clm_varcon , only : zsoi, dzsoi, zisoi, dzsoi_decomp, zmin_bedrock - use clm_varpar , only : nlevdecomp, nlevgrnd, nlevdecomp_full, maxpatch_pft - use clm_varctl , only : use_vertsoilc, iulog, use_bedrock - use pftconMod , only : noveg, pftcon - use SoilBiogeochemStateType , only : soilbiogeochem_state_type - use CanopyStateType , only : canopystate_type - use SoilStateType , only : soilstate_type - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - 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(canopystate_type) , intent(in) :: canopystate_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(soilbiogeochem_state_type) , intent(inout) :: soilbiogeochem_state_inst - ! - ! !LOCAL VARIABLES: - real(r8) :: surface_prof(1:nlevdecomp) - real(r8) :: surface_prof_tot - real(r8) :: rootfr_tot - real(r8) :: cinput_rootfr(bounds%begp:bounds%endp, 1:nlevdecomp_full) ! pft-native root fraction used for calculating inputs - real(r8) :: col_cinput_rootfr(bounds%begc:bounds%endc, 1:nlevdecomp_full) ! col-native root fraction used for calculating inputs - integer :: c, j, fc, p, fp, pi - integer :: alt_ind - ! debugging temp variables - real(r8) :: froot_prof_sum - real(r8) :: croot_prof_sum - real(r8) :: leaf_prof_sum - real(r8) :: stem_prof_sum - real(r8) :: ndep_prof_sum - real(r8) :: nfixation_prof_sum - real(r8) :: delta = 1.e-10 - integer :: begp, endp - integer :: begc, endc - character(len=32) :: subname = 'SoilBiogeochemVerticalProfile' - !----------------------------------------------------------------------- - - begp = bounds%begp; endp= bounds%endp - begc = bounds%begc; endc= bounds%endc - - associate( & - altmax_lastyear_indx => canopystate_inst%altmax_lastyear_indx_col , & ! Input: [integer (:) ] frost table depth (m) - - crootfr => soilstate_inst%crootfr_patch , & ! Input: [real(r8) (:,:) ] fraction of roots in each soil layer (nlevgrnd) - - nfixation_prof => soilbiogeochem_state_inst%nfixation_prof_col , & ! Input : [real(r8) (:,:) ] (1/m) profile for N fixation additions - ndep_prof => soilbiogeochem_state_inst%ndep_prof_col , & ! Input : [real(r8) (:,:) ] (1/m) profile for N fixation additions - leaf_prof => soilbiogeochem_state_inst%leaf_prof_patch , & ! Output : [real(r8) (:,:) ] (1/m) profile of leaves - froot_prof => soilbiogeochem_state_inst%froot_prof_patch , & ! Output : [real(r8) (:,:) ] (1/m) profile of fine roots - croot_prof => soilbiogeochem_state_inst%croot_prof_patch , & ! Output : [real(r8) (:,:) ] (1/m) profile of coarse roots - stem_prof => soilbiogeochem_state_inst%stem_prof_patch & ! Output : [real(r8) (:,:) ] (1/m) profile of stems - ) - - if (use_vertsoilc) then - - ! define a single shallow surface profile for surface additions (leaves, stems, and N deposition) - surface_prof(:) = 0._r8 - do j = 1, nlevdecomp - surface_prof(j) = exp(-surfprof_exp * zsoi(j)) / dzsoi_decomp(j) - if (use_bedrock) then - if (zsoi(j) > zmin_bedrock) then - surface_prof(j) = 0._r8 - end if - end if - end do - - ! initialize profiles to zero - leaf_prof(begp:endp, :) = 0._r8 - froot_prof(begp:endp, :) = 0._r8 - croot_prof(begp:endp, :) = 0._r8 - stem_prof(begp:endp, :) = 0._r8 - nfixation_prof(begc:endc, :) = 0._r8 - ndep_prof(begc:endc, :) = 0._r8 - - cinput_rootfr(begp:endp, :) = 0._r8 - col_cinput_rootfr(begc:endc, :) = 0._r8 - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - if (patch%itype(p) /= noveg) then - do j = 1, nlevdecomp - cinput_rootfr(p,j) = crootfr(p,j) / dzsoi_decomp(j) - end do - - else - cinput_rootfr(p,1) = 0. - endif - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = patch%column(p) - ! integrate rootfr over active layer of soil column - rootfr_tot = 0._r8 - surface_prof_tot = 0._r8 - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - rootfr_tot = rootfr_tot + cinput_rootfr(p,j) * dzsoi_decomp(j) - surface_prof_tot = surface_prof_tot + surface_prof(j) * dzsoi_decomp(j) - end do - if ( (altmax_lastyear_indx(c) > 0) .and. (rootfr_tot > 0._r8) .and. (surface_prof_tot > 0._r8) ) then - ! where there is not permafrost extending to the surface, integrate the profiles over the active layer - ! this is equivalnet to integrating over all soil layers outside of permafrost regions - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - froot_prof(p,j) = cinput_rootfr(p,j) / rootfr_tot - croot_prof(p,j) = cinput_rootfr(p,j) / rootfr_tot - - if (j > col%nbedrock(c) .and. cinput_rootfr(p,j) > 0._r8) then - write(iulog,*) 'cinput_rootfr > 0 in bedrock' - end if - ! set all surface processes to shallower profile - leaf_prof(p,j) = surface_prof(j)/ surface_prof_tot - stem_prof(p,j) = surface_prof(j)/ surface_prof_tot - end do - else - ! if fully frozen, or no roots, put everything in the top layer - froot_prof(p,1) = 1./dzsoi_decomp(1) - croot_prof(p,1) = 1./dzsoi_decomp(1) - leaf_prof(p,1) = 1./dzsoi_decomp(1) - stem_prof(p,1) = 1./dzsoi_decomp(1) - endif - - end do - - !! aggregate root profile to column - ! call p2c (decomp, nlevdecomp_full, & - ! cinput_rootfr(bounds%begp:bounds%endp, :), & - ! col_cinput_rootfr(bounds%begc:bounds%endc, :), & - ! 'unity') - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= col%npatches(c)) then - p = col%patchi(c) + pi - 1 - do j = 1,nlevdecomp - col_cinput_rootfr(c,j) = col_cinput_rootfr(c,j) + cinput_rootfr(p,j) * patch%wtcol(p) - end do - end if - end do - end do - - ! repeat for column-native profiles: Ndep and Nfix - do fc = 1,num_soilc - c = filter_soilc(fc) - rootfr_tot = 0._r8 - surface_prof_tot = 0._r8 - ! redo column ntegration over active layer for column-native profiles - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - rootfr_tot = rootfr_tot + col_cinput_rootfr(c,j) * dzsoi_decomp(j) - surface_prof_tot = surface_prof_tot + surface_prof(j) * dzsoi_decomp(j) - end do - if ( (altmax_lastyear_indx(c) > 0) .and. (rootfr_tot > 0._r8) .and. (surface_prof_tot > 0._r8) ) then - do j = 1, min(max(altmax_lastyear_indx(c), 1), nlevdecomp) - nfixation_prof(c,j) = col_cinput_rootfr(c,j) / rootfr_tot - ndep_prof(c,j) = surface_prof(j)/ surface_prof_tot - end do - else - nfixation_prof(c,1) = 1./dzsoi_decomp(1) - ndep_prof(c,1) = 1./dzsoi_decomp(1) - endif - end do - - else - - ! for one layer decomposition model, set profiles to unity - leaf_prof(begp:endp, :) = 1._r8 - froot_prof(begp:endp, :) = 1._r8 - croot_prof(begp:endp, :) = 1._r8 - stem_prof(begp:endp, :) = 1._r8 - nfixation_prof(begc:endc, :) = 1._r8 - ndep_prof(begc:endc, :) = 1._r8 - - end if - - - ! check to make sure integral of all profiles = 1. - do fc = 1,num_soilc - c = filter_soilc(fc) - ndep_prof_sum = 0. - nfixation_prof_sum = 0. - do j = 1, nlevdecomp - ndep_prof_sum = ndep_prof_sum + ndep_prof(c,j) * dzsoi_decomp(j) - nfixation_prof_sum = nfixation_prof_sum + nfixation_prof(c,j) * dzsoi_decomp(j) - end do - if ( ( abs(ndep_prof_sum - 1._r8) > delta ) .or. ( abs(nfixation_prof_sum - 1._r8) > delta ) ) then - write(iulog, *) 'profile sums: ', ndep_prof_sum, nfixation_prof_sum - write(iulog, *) 'c: ', c - write(iulog, *) 'altmax_lastyear_indx: ', altmax_lastyear_indx(c) - write(iulog, *) 'nfixation_prof: ', nfixation_prof(c,:) - write(iulog, *) 'ndep_prof: ', ndep_prof(c,:) - write(iulog, *) 'cinput_rootfr: ', cinput_rootfr(c,:) - write(iulog, *) 'dzsoi_decomp: ', dzsoi_decomp(:) - write(iulog, *) 'surface_prof: ', surface_prof(:) - write(iulog, *) 'npfts(c): ', col%npatches(c) - do p = col%patchi(c), col%patchi(c) + col%npatches(c) -1 - write(iulog, *) 'p, itype(p), wtcol(p): ', p, patch%itype(p), patch%wtcol(p) - write(iulog, *) 'cinput_rootfr(p,:): ', cinput_rootfr(p,:) - end do - call endrun(msg=" ERROR: _prof_sum-1>delta"//errMsg(sourcefile, __LINE__)) - endif - end do - - do fp = 1,num_soilp - p = filter_soilp(fp) - froot_prof_sum = 0. - croot_prof_sum = 0. - leaf_prof_sum = 0. - stem_prof_sum = 0. - do j = 1, nlevdecomp - froot_prof_sum = froot_prof_sum + froot_prof(p,j) * dzsoi_decomp(j) - croot_prof_sum = croot_prof_sum + croot_prof(p,j) * dzsoi_decomp(j) - leaf_prof_sum = leaf_prof_sum + leaf_prof(p,j) * dzsoi_decomp(j) - stem_prof_sum = stem_prof_sum + stem_prof(p,j) * dzsoi_decomp(j) - end do - if ( ( abs(froot_prof_sum - 1._r8) > delta ) .or. ( abs(croot_prof_sum - 1._r8) > delta ) .or. & - ( abs(stem_prof_sum - 1._r8) > delta ) .or. ( abs(leaf_prof_sum - 1._r8) > delta ) ) then - write(iulog, *) 'profile sums: ', froot_prof_sum, croot_prof_sum, leaf_prof_sum, stem_prof_sum - call endrun(msg=' ERROR: sum-1 > delta'//errMsg(sourcefile, __LINE__)) - endif - end do - - end associate - - end subroutine SoilBiogeochemVerticalProfile - -end module SoilBiogeochemVerticalProfileMod diff --git a/src/soilbiogeochem/test/ACSpinup_test/CMakeLists.txt b/src/soilbiogeochem/test/ACSpinup_test/CMakeLists.txt deleted file mode 100644 index 17f01d6d22..0000000000 --- a/src/soilbiogeochem/test/ACSpinup_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(acspinup test_acspinup_exe - "test_acspinup.pf" "") - -target_link_libraries(test_acspinup_exe clm csm_share) diff --git a/src/soilbiogeochem/test/ACSpinup_test/test_acspinup.pf b/src/soilbiogeochem/test/ACSpinup_test/test_acspinup.pf deleted file mode 100644 index df9c4f80fb..0000000000 --- a/src/soilbiogeochem/test/ACSpinup_test/test_acspinup.pf +++ /dev/null @@ -1,46 +0,0 @@ -module test_acspinup - - ! Tests of the acspinup functions in SoilBiogeochemStateType - - use pfunit_mod - - use shr_kind_mod , only : r8 => shr_kind_r8 - use SoilBiogeochemStateType, only : get_spinup_latitude_term - - implicit none - save - - real(r8), parameter :: tol = 1.e-8_r8 - -contains - - @Test - subroutine test_spinup_lat_term() - real(r8) :: previous, current - real(r8) :: dx, lat - integer :: ilat - - @assertEqual( 50.450652868_r8, get_spinup_latitude_term( 90.0_r8 ), tolerance=tol) - @assertEqual( 50.450652868_r8, get_spinup_latitude_term( -90.0_r8 ), tolerance=tol) - @assertEqual( 1.006169729_r8, get_spinup_latitude_term( 0.0_r8 ), tolerance=tol) - @assertEqual( 26.000000000_r8, get_spinup_latitude_term( 60.0_r8 ), tolerance=tol) - @assertEqual( 26.000000000_r8, get_spinup_latitude_term( -60.0_r8 ), tolerance=tol) - - ! Check that montone increasing - lat = 0.0_r8 - @assertEqual( lat, 0.0_r8 ) - previous = get_spinup_latitude_term( lat ) - dx = 0.01_r8 - do ilat = 1, nint(90.0_r8/dx) - lat = real(ilat,r8)*dx - current = get_spinup_latitude_term( lat ) - @assertGreaterThan( current, previous ) - ! Check that negative latitude gives the same answer as positive - @assertEqual( current, get_spinup_latitude_term( -lat ) ) - end do - @assertEqual( lat, 90.0_r8, tolerance=tol ) - - end subroutine test_spinup_lat_term - - -end module test_acspinup diff --git a/src/soilbiogeochem/test/CMakeLists.txt b/src/soilbiogeochem/test/CMakeLists.txt deleted file mode 100644 index 988cb531b5..0000000000 --- a/src/soilbiogeochem/test/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(ACSpinup_test) diff --git a/src/unit_test_shr/CMakeLists.txt b/src/unit_test_shr/CMakeLists.txt deleted file mode 100644 index 8e3494f8c7..0000000000 --- a/src/unit_test_shr/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set(genf90_files - unittestArrayMod.F90.in - ) - -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) - -sourcelist_to_parent(clm_genf90_sources) - -list(APPEND clm_sources "${clm_genf90_sources}") - -list(APPEND clm_sources - unittestTimeManagerMod.F90 - unittestSubgridMod.F90 - unittestSimpleSubgridSetupsMod.F90 - unittestFilterBuilderMod.F90 - unittestGlcMec.F90 - unittestUtils.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/unit_test_shr/test/CMakeLists.txt b/src/unit_test_shr/test/CMakeLists.txt deleted file mode 100644 index ef8ee66acb..0000000000 --- a/src/unit_test_shr/test/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(unittestArray_test) -add_subdirectory(unittestSubgrid_test) -add_subdirectory(unittestFilterBuilder_test) diff --git a/src/unit_test_shr/test/unittestArray_test/CMakeLists.txt b/src/unit_test_shr/test/unittestArray_test/CMakeLists.txt deleted file mode 100644 index 9a18380545..0000000000 --- a/src/unit_test_shr/test/unittestArray_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(unittestArray test_unittestArray_exe - "test_unittestArray.pf" "") - -target_link_libraries(test_unittestArray_exe clm csm_share) \ No newline at end of file diff --git a/src/unit_test_shr/test/unittestArray_test/test_unittestArray.pf b/src/unit_test_shr/test/unittestArray_test/test_unittestArray.pf deleted file mode 100644 index b11d62e612..0000000000 --- a/src/unit_test_shr/test/unittestArray_test/test_unittestArray.pf +++ /dev/null @@ -1,86 +0,0 @@ -module test_unittestArray - - ! Tests of unittestArrayMod - - use pfunit_mod - use unittestArrayMod - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestUnittestArray - contains - procedure :: setUp - procedure :: tearDown - end type TestUnittestArray - -contains - - subroutine setUp(this) - class(TestUnittestArray), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestUnittestArray), intent(inout) :: this - - call unittest_subgrid_teardown() - end subroutine tearDown - - @Test - subroutine col_array_returnsColArray(this) - class(TestUnittestArray), intent(inout) :: this - real(r8), allocatable :: arr(:) - - call unittest_subgrid_setup_start() - call create_gridcell_single_veg_patch(1) - call create_gridcell_single_veg_patch(2) - call unittest_subgrid_setup_end() - - arr = col_array() - - @assertEqual((bounds%endc-bounds%begc+1), size(arr)) - - end subroutine col_array_returnsColArray - - @Test - subroutine col_array_setsVal(this) - class(TestUnittestArray), intent(inout) :: this - real(r8), allocatable :: arr(:) - - call unittest_subgrid_setup_start() - call create_gridcell_single_veg_patch(1) - call create_gridcell_single_veg_patch(2) - call unittest_subgrid_setup_end() - - arr = col_array(17._r8) - - @assertEqual([17._r8, 17._r8], arr) - end subroutine col_array_setsVal - - @Test - subroutine col_array_uninit(this) - class(TestUnittestArray), intent(inout) :: this - real(r8), allocatable :: arr(:) - - call unittest_subgrid_setup_start() - call create_gridcell_single_veg_patch(1) - call create_gridcell_single_veg_patch(2) - call unittest_subgrid_setup_end() - - arr = col_array() - - @assertIsNan(arr(1)) - @assertIsNan(arr(2)) - end subroutine col_array_uninit - - @Test - subroutine test_logical_array_to_int(this) - class(TestUnittestArray), intent(inout) :: this - - @assertEqual([1, 0, 1], logical_array_to_int([.true., .false., .true.])) - end subroutine test_logical_array_to_int - -end module test_unittestArray diff --git a/src/unit_test_shr/test/unittestFilterBuilder_test/CMakeLists.txt b/src/unit_test_shr/test/unittestFilterBuilder_test/CMakeLists.txt deleted file mode 100644 index c767479aee..0000000000 --- a/src/unit_test_shr/test/unittestFilterBuilder_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(unittestFilterBuilder test_filterBuilder_exe - "test_filterBuilder.pf" "") - -target_link_libraries(test_filterBuilder_exe clm csm_share) \ No newline at end of file diff --git a/src/unit_test_shr/test/unittestFilterBuilder_test/test_filterBuilder.pf b/src/unit_test_shr/test/unittestFilterBuilder_test/test_filterBuilder.pf deleted file mode 100644 index 58674110a9..0000000000 --- a/src/unit_test_shr/test/unittestFilterBuilder_test/test_filterBuilder.pf +++ /dev/null @@ -1,46 +0,0 @@ -module test_filterBuilder - - ! Tests of unittestFilterBuilder - - use pfunit_mod - use unittestFilterBuilderMod - - implicit none - save - -contains - - ! ======================================================================== - ! Tests of filter_from_range - ! ======================================================================== - - @Test - subroutine test_filter_from_range_multipoint() - integer :: numf - integer, allocatable :: filter(:) - - call filter_from_range(start=3, end=5, numf=numf, filter=filter) - @assertEqual(3, numf) - @assertEqual([3,4,5], filter) - end subroutine test_filter_from_range_multipoint - - @Test - subroutine test_filter_from_range_onepoint() - integer :: numf - integer, allocatable :: filter(:) - - call filter_from_range(start=3, end=3, numf=numf, filter=filter) - @assertEqual(1, numf) - @assertEqual([3], filter) - end subroutine test_filter_from_range_onepoint - - @Test - subroutine test_filter_from_range_nopoints() - integer :: numf - integer, allocatable :: filter(:) - - call filter_from_range(start=3, end=1, numf=numf, filter=filter) - @assertEqual(0, numf) - end subroutine test_filter_from_range_nopoints - -end module test_filterBuilder diff --git a/src/unit_test_shr/test/unittestSubgrid_test/CMakeLists.txt b/src/unit_test_shr/test/unittestSubgrid_test/CMakeLists.txt deleted file mode 100644 index 2e0bc4f03e..0000000000 --- a/src/unit_test_shr/test/unittestSubgrid_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(unittestSubgrid test_unittestSubgrid_exe - "test_unittestSubgrid.pf" "") - -target_link_libraries(test_unittestSubgrid_exe clm csm_share) \ No newline at end of file diff --git a/src/unit_test_shr/test/unittestSubgrid_test/test_unittestSubgrid.pf b/src/unit_test_shr/test/unittestSubgrid_test/test_unittestSubgrid.pf deleted file mode 100644 index a0bea34dc4..0000000000 --- a/src/unit_test_shr/test/unittestSubgrid_test/test_unittestSubgrid.pf +++ /dev/null @@ -1,39 +0,0 @@ -module test_unittestSubgrid - - ! Tests of unittestSubgridMod - - use pfunit_mod - use unittestSubgridMod - use shr_kind_mod , only : r8 => shr_kind_r8 - - implicit none - - @TestCase - type, extends(TestCase) :: TestUnittestSubgrid - contains - procedure :: setUp - procedure :: tearDown - end type TestUnittestSubgrid - -contains - - subroutine setUp(this) - class(TestUnittestSubgrid), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestUnittestSubgrid), intent(inout) :: this - end subroutine tearDown - - @Test - subroutine get_ltype_special_returnsSpecialLandunit(this) - use landunit_varcon, only : landunit_is_special - class(TestUnittestSubgrid), intent(inout) :: this - integer :: ltype - - ltype = get_ltype_special() - - @assertTrue(landunit_is_special(ltype)) - end subroutine get_ltype_special_returnsSpecialLandunit - -end module test_unittestSubgrid diff --git a/src/unit_test_shr/unittestArrayMod.F90.in b/src/unit_test_shr/unittestArrayMod.F90.in deleted file mode 100644 index 2d82892063..0000000000 --- a/src/unit_test_shr/unittestArrayMod.F90.in +++ /dev/null @@ -1,220 +0,0 @@ -module unittestArrayMod - - ! Provides utility functions for working with array inputs to (or outputs from) - ! subroutines. - ! - ! The routines here assume that the subgrid structure has been set up via - ! unittestSubgridMod. - - use shr_kind_mod, only : r8 => shr_kind_r8, i4 => shr_kind_i4 - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use unittestSubgridMod, only : bounds - - implicit none - private - save - - ! Create a gridcell-level array filled with a single value; the type of the array is the - ! same as the type of the input value. If no value is given, an r8 array is returned, - ! filled with NaNs. - public :: grc_array - - ! Create a column-level array filled with a single value; the type of the array is the - ! same as the type of the input value. If no value is given, an r8 array is returned, - ! filled with NaNs. - public :: col_array - - ! Create a patch-level array filled with a single value; the type of the array is the - ! same as the type of the input value. If no value is given, an r8 array is returned, - ! filled with NaNs. - public :: patch_array - - ! Converts an array of logicals to a same-size array of integers: false => 0, true => 1 - public :: logical_array_to_int - - interface grc_array - module procedure grc_array_uninit - - !TYPE logical,int,double - module procedure grc_array_{TYPE} - end interface grc_array - - interface col_array - module procedure col_array_uninit - - !TYPE logical,int,double - module procedure col_array_{TYPE} - end interface col_array - - interface patch_array - module procedure patch_array_uninit - - !TYPE logical,int,double - module procedure patch_array_{TYPE} - end interface patch_array - -contains - - !----------------------------------------------------------------------- - pure function grc_array_uninit() result(grc_array) - ! - ! !DESCRIPTION: - ! Creates a gridcell-level array of r8 values. All elements are set to NaN. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), allocatable :: grc_array(:) ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'grc_array_uninit' - !----------------------------------------------------------------------- - - allocate(grc_array(bounds%begg:bounds%endg)) - grc_array(:) = nan - - end function grc_array_uninit - - !----------------------------------------------------------------------- - !TYPE logical,int,double - pure function grc_array_{TYPE}(val) result(grc_array) - ! - ! !DESCRIPTION: - ! Creates a gridcell-level array with the same type as val. All elements are set to val. - ! - ! !USES: - ! - ! !ARGUMENTS: - {VTYPE}, allocatable :: grc_array(:) ! function result - {VTYPE}, intent(in) :: val ! all elements in grc_array are set to val - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'grc_array_{TYPE}' - !----------------------------------------------------------------------- - - allocate(grc_array(bounds%begg:bounds%endg)) - grc_array(:) = val - - end function grc_array_{TYPE} - - - !----------------------------------------------------------------------- - pure function col_array_uninit() result(col_array) - ! - ! !DESCRIPTION: - ! Creates a column-level array of r8 values. All elements are set to NaN. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), allocatable :: col_array(:) ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'col_array_uninit' - !----------------------------------------------------------------------- - - allocate(col_array(bounds%begc:bounds%endc)) - col_array(:) = nan - - end function col_array_uninit - - - !----------------------------------------------------------------------- - !TYPE logical,int,double - pure function col_array_{TYPE}(val) result(col_array) - ! - ! !DESCRIPTION: - ! Creates a column-level array with the same type as val. All elements are set to val. - ! - ! !USES: - ! - ! !ARGUMENTS: - {VTYPE}, allocatable :: col_array(:) ! function result - {VTYPE}, intent(in) :: val ! all elements in col_array are set to val - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'col_array_{TYPE}' - !----------------------------------------------------------------------- - - allocate(col_array(bounds%begc:bounds%endc)) - col_array(:) = val - - end function col_array_{TYPE} - - - !----------------------------------------------------------------------- - pure function patch_array_uninit() result(patch_array) - ! - ! !DESCRIPTION: - ! Creates a patch-level array of r8 values. All elements are set to NaN. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), allocatable :: patch_array(:) ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'patch_array_uninit' - !----------------------------------------------------------------------- - - allocate(patch_array(bounds%begp:bounds%endp)) - patch_array(:) = nan - - end function patch_array_uninit - - - !----------------------------------------------------------------------- - !TYPE logical,int,double - pure function patch_array_{TYPE}(val) result(patch_array) - ! - ! !DESCRIPTION: - ! Creates a patch-level array with the same type as val. All elements are set to val. - ! - ! !USES: - ! - ! !ARGUMENTS: - {VTYPE}, allocatable :: patch_array(:) ! function result - {VTYPE}, intent(in) :: val ! all elements in patch_array are set to val - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'patch_array_{TYPE}' - !----------------------------------------------------------------------- - - allocate(patch_array(bounds%begp:bounds%endp)) - patch_array(:) = val - - end function patch_array_{TYPE} - - !----------------------------------------------------------------------- - function logical_array_to_int(logical_array) result(int_array) - ! - ! !DESCRIPTION: - ! Converts an array of logicals to a same-size array of integers: false => 0, true => 1 - ! - ! This can be useful for doing assertions on arrays, since pFUnit doesn't support - ! assertions of equality of logical arrays. - ! - ! !ARGUMENTS: - logical, intent(in) :: logical_array(:) - integer :: int_array(size(logical_array)) ! function result - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'logical_array_to_int' - !----------------------------------------------------------------------- - - where (logical_array) - int_array = 1 - elsewhere - int_array = 0 - end where - - end function logical_array_to_int - -end module unittestArrayMod diff --git a/src/unit_test_shr/unittestFilterBuilderMod.F90 b/src/unit_test_shr/unittestFilterBuilderMod.F90 deleted file mode 100644 index 3ed61eb9a2..0000000000 --- a/src/unit_test_shr/unittestFilterBuilderMod.F90 +++ /dev/null @@ -1,71 +0,0 @@ -module unittestFilterBuilderMod - - ! This module builds simple filters that can be used as inputs to routines that require - ! a filter. - - implicit none - private - save - - public :: filter_empty ! build a filter that doesn't contain any points - - public :: filter_from_range ! build a filter that includes all points between a start and end index - -contains - - !----------------------------------------------------------------------- - subroutine filter_empty(numf, filter) - ! - ! !DESCRIPTION: - ! Build a filter that doesn't contain any points - ! - ! Allocates the 'filter' argument - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(out) :: numf ! number of points in the filter - integer, allocatable, intent(out) :: filter(:) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'filter_empty' - !----------------------------------------------------------------------- - - numf = 0 - allocate(filter(0)) - - end subroutine filter_empty - - - !----------------------------------------------------------------------- - subroutine filter_from_range(start, end, numf, filter) - ! - ! !DESCRIPTION: - ! Build a filter that includes all points between a start and end index - ! - ! Allocates the 'filter' argument - ! - ! !ARGUMENTS: - integer, intent(in) :: start ! start index to include - integer, intent(in) :: end ! end index to include - integer, intent(out) :: numf ! number of points in the filter - integer, allocatable, intent(out) :: filter(:) - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'filter_from_list' - !----------------------------------------------------------------------- - - numf = end - start + 1 - numf = max(numf, 0) - - allocate(filter(numf)) - do i = 1, numf - filter(i) = start + i - 1 - end do - - end subroutine filter_from_range - -end module unittestFilterBuilderMod diff --git a/src/unit_test_shr/unittestGlcMec.F90 b/src/unit_test_shr/unittestGlcMec.F90 deleted file mode 100644 index 4ed1c497f9..0000000000 --- a/src/unit_test_shr/unittestGlcMec.F90 +++ /dev/null @@ -1,68 +0,0 @@ -module unittestGlcMec - - ! This module contains routines that assist unit tests working with glc_mec - ! (istice_mec) landunits. - - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use landunit_varcon, only : istice_mec - use column_varcon, only : icemec_class_to_col_itype - use glc_elevclass_mod, only : glc_elevclass_init, glc_elevclass_clean - use clm_varpar, only : maxpatch_glcmec - - implicit none - private - save - - ! Sets up modules to have the given elevation classes. This should be called early in - ! the setup of each unit test. - public :: setup_elevation_classes - - ! Do teardown mirroring what was done in setup_elevation_classes. This should be called - ! at the end of any unit test that called setup_elevation_classes. - public :: teardown_elevation_classes - - ! Do all subgrid setup needed for setting up a grid with one grid cell with a single - ! icemec column. - public :: setup_single_icemec_column - -contains - - subroutine setup_elevation_classes(glc_nec, topomax) - ! Sets up modules to have the given elevation classes. - ! - ! This should be called early in the setup of each unit test. - integer, intent(in) :: glc_nec ! number of elevation classes - real(r8), intent(in) :: topomax(:) ! should be size glc_nec+1 - - call glc_elevclass_init(glc_nec, topomax) - maxpatch_glcmec = glc_nec - end subroutine setup_elevation_classes - - subroutine teardown_elevation_classes() - ! Do teardown mirroring what was done in setup_elevation_classes. - - ! This should be called at the end of any unit test that called - ! setup_elevation_classes. - - call glc_elevclass_clean() - maxpatch_glcmec = 0 - end subroutine teardown_elevation_classes - - subroutine setup_single_icemec_column(elev_class) - ! Create a grid cell with a single icemec column. - ! - ! setup_elevation_classes must already have been called. - integer, intent(in) :: elev_class - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_landunit_ncols(ltype=istice_mec, lweight=1.0_r8, & - ctypes=[icemec_class_to_col_itype(elev_class)], cweights=[1.0_r8]) - call unittest_subgrid_setup_end() - - end subroutine setup_single_icemec_column - - -end module unittestGlcMec diff --git a/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 b/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 deleted file mode 100644 index d9a4aac403..0000000000 --- a/src/unit_test_shr/unittestSimpleSubgridSetupsMod.F90 +++ /dev/null @@ -1,313 +0,0 @@ -module unittestSimpleSubgridSetupsMod - - ! This module provides wrappers to unittestSubgridMod, which give you a variety of - ! simple subgrid setups. -#include "shr_assert.h" - use unittestSubgridMod - use shr_log_mod , only : errMsg => shr_log_errMsg - use shr_kind_mod , only : r8 => shr_kind_r8 - use landunit_varcon, only : istsoil - use pftconMod, only : noveg - - implicit none - private - save - - ! ------------------------------------------------------------------------ - ! Routines that do everything needed with the subgrid setup, including the begin & end - ! call. Once you call these routines, you cannot add any more gridcells, landunits, etc. - ! ------------------------------------------------------------------------ - - ! Create a grid that has a single gridcell with a single vegetated patch - public :: setup_single_veg_patch - - ! Create a grid that has a single gridcell with N vegetated patches - public :: setup_n_veg_patches - - ! Create a grid that has a single gridcell with one landunit of a given type with N - ! columns, each with a single patch of a given type (default patch type = noveg) - public :: setup_landunit_ncols - - ! Create a grid that has N grid cells, each with a single vegetated patch - public :: setup_ncells_single_veg_patch - - ! ------------------------------------------------------------------------ - ! Routines that create a single grid cell with certain properties. You can do other - ! subgrid setup (creating other grid cells) before and after this. - ! ------------------------------------------------------------------------ - - ! Create a grid cell that is 100% natural veg, with a single patch - public :: create_gridcell_single_veg_patch - - ! ------------------------------------------------------------------------ - ! Routines that create a single landunit with certain properties. You can do other - ! subgrid setup (creating other landunits, gridcells, etc.) before and after this. - ! These assume that unittest_add_gridcell has already been called. - ! ------------------------------------------------------------------------ - - ! Create a landunit of a given type with N columns, each with M patches (default=1) of - ! a given type (default=noveg) - public :: create_landunit_ncols - - ! Create a vegetated landunit with N patches - public :: create_vegetated_landunit_n_patches - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Routines that do everything needed with the subgrid setup, including the begin & end - ! call. Once you call these routines, you cannot add any more gridcells, landunits, etc. - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine setup_single_veg_patch(pft_type) - ! - ! !DESCRIPTION: - ! Create a grid that has a single gridcell with a single vegetated patch, with veg - ! type given by the pft_type argument - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: pft_type ! the type of the single vegetated patch - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'setup_single_veg_patch' - !----------------------------------------------------------------------- - - call setup_ncells_single_veg_patch(ncells=1, pft_type=pft_type) - - end subroutine setup_single_veg_patch - - !----------------------------------------------------------------------- - subroutine setup_n_veg_patches(pwtcol, pft_types) - ! - ! !DESCRIPTION: - ! Create a grid that has a single gridcell with N vegetated patches on one column. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), intent(in) :: pwtcol(:) - - ! If given, this gives the pft type for each patch. If not given, pft types go 1..N. - integer, optional, intent(in) :: pft_types(:) - - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'setup_n_veg_patches' - !----------------------------------------------------------------------- - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_vegetated_landunit_n_patches(lweight = 1._r8, & - pwtcol = pwtcol, pft_types = pft_types) - call unittest_subgrid_setup_end() - - end subroutine setup_n_veg_patches - - !----------------------------------------------------------------------- - subroutine setup_landunit_ncols(ltype, ctypes, cweights, ptype) - ! - ! !DESCRIPTION: - ! Create a grid that has a single gridcell with one landunit of a given type with N - ! columns, each with a single patch of type ptype (or noveg if ptype is not given) - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: ltype ! landunit type - integer, intent(in) :: ctypes(:) ! array of column types; one column is created for each element in the array - real(r8), intent(in) :: cweights(:) ! array of column weights on the landunit - integer, intent(in), optional :: ptype ! patch type (if not given, defaults to noveg) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'setup_landunit_ncols' - !----------------------------------------------------------------------- - - call unittest_subgrid_setup_start() - call unittest_add_gridcell() - call create_landunit_ncols(ltype = ltype, lweight = 1._r8, & - ctypes = ctypes, cweights = cweights, ptype = ptype) - call unittest_subgrid_setup_end() - - end subroutine setup_landunit_ncols - - - !----------------------------------------------------------------------- - subroutine setup_ncells_single_veg_patch(ncells, pft_type) - ! - ! !DESCRIPTION: - ! Create a grid that has ncells grid cells, each with a single vegetated patch. All - ! vegetated patches have the same type, given by pft_type. - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: ncells ! number of grid cells - integer, intent(in) :: pft_type ! pft type - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'setup_ncells_single_veg_patch' - !----------------------------------------------------------------------- - - call unittest_subgrid_setup_start() - do i = 1, ncells - call create_gridcell_single_veg_patch(pft_type = pft_type) - end do - call unittest_subgrid_setup_end() - - end subroutine setup_ncells_single_veg_patch - - - ! ======================================================================== - ! Routines that create a single grid cell with certain properties. You can do other - ! subgrid setup (creating other grid cells) before and after this. - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine create_gridcell_single_veg_patch(pft_type) - ! - ! !DESCRIPTION: - ! Create a grid cell that is 100% natural veg, with a single patch - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: pft_type ! the type of the single vegetated patch - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'create_gridcell_single_veg_patch' - !----------------------------------------------------------------------- - - call unittest_add_gridcell() - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=1.0_r8) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1.0_r8) - call unittest_add_patch(my_ci=ci, ptype=pft_type, wtcol=1.0_r8) - - end subroutine create_gridcell_single_veg_patch - - ! ======================================================================== - ! Routines that create a single landunit with certain properties. You can do other - ! subgrid setup (creating other landunits, gridcells, etc.) before and after this. - ! These assume that unittest_add_gridcell has already been called. - ! ======================================================================== - - - !----------------------------------------------------------------------- - subroutine create_landunit_ncols(ltype, lweight, ctypes, cweights, npatches, ptype) - ! - ! !DESCRIPTION: - ! Create a landunit of a given type with N columns, each with M patches (default=1) of - ! type noveg. - ! - ! Assumes that unittest_add_gridcell has already been called. - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: ltype ! landunit type - real(r8), intent(in) :: lweight ! landunit weight on the grid cell - integer, intent(in) :: ctypes(:) ! array of column types; one column is created for each element in the array - real(r8), intent(in) :: cweights(:) ! array of column weights on the landunit - - ! If npatches is provided, it gives the number of patches on each column. Each patch - ! has equal weight, and is of the same type (ptype). If not provided, the default is 1 - ! patch per column. - integer, intent(in), optional :: npatches - - ! If ptype is provided, it gives the pft type of every patch. If not provided, the - ! default is noveg. - integer, intent(in), optional :: ptype - ! - ! !LOCAL VARIABLES: - integer :: ncols - integer :: l_npatches ! local version of npatches - integer :: l_ptype ! local version of ptype - integer :: c, p - - character(len=*), parameter :: subname = 'create_landunit_ncols' - !----------------------------------------------------------------------- - - ncols = size(ctypes) - SHR_ASSERT((size(cweights) == ncols), errMsg(sourcefile, __LINE__)) - SHR_ASSERT(gi >= begg, 'must call unittest_add_gridcell first: ' // errMsg(sourcefile, __LINE__)) - - if (present(npatches)) then - l_npatches = npatches - else - l_npatches = 1 - end if - - if (present(ptype)) then - l_ptype = ptype - else - l_ptype = noveg - end if - - call unittest_add_landunit(my_gi=gi, ltype=ltype, wtgcell=lweight) - do c = 1, ncols - call unittest_add_column(my_li=li, ctype=ctypes(c), wtlunit=cweights(c)) - do p = 1, l_npatches - call unittest_add_patch(my_ci=ci, ptype=l_ptype, wtcol=1.0_r8/l_npatches) - end do - end do - - end subroutine create_landunit_ncols - - !----------------------------------------------------------------------- - subroutine create_vegetated_landunit_n_patches(lweight, pwtcol, pft_types) - ! - ! !DESCRIPTION: - ! Create a vegetated landunit with N patches on one column - ! - ! Assumes that unittest_add_gridcell has already been called - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), intent(in) :: lweight ! landunit weight on the gridcell - real(r8), intent(in) :: pwtcol(:) ! patch weights on the column - - ! If given, this gives the pft type for each patch. If not given, pft types go 1..N. - integer, optional, intent(in) :: pft_types(:) - ! - ! !LOCAL VARIABLES: - integer :: npatches - integer :: p - integer, allocatable :: l_pft_types(:) - - character(len=*), parameter :: subname = 'create_vegetated_landunit_n_patches' - !----------------------------------------------------------------------- - - npatches = size(pwtcol) - allocate(l_pft_types(npatches)) - if (present(pft_types)) then - SHR_ASSERT((size(pft_types) == npatches), errMsg(sourcefile, __LINE__)) - l_pft_types = pft_types - else - do p = 1, npatches - l_pft_types(p) = p - end do - end if - - call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=lweight) - call unittest_add_column(my_li=li, ctype=1, wtlunit=1._r8) - do p = 1, npatches - call unittest_add_patch(my_ci=ci, ptype=l_pft_types(p), wtcol=pwtcol(p)) - end do - - end subroutine create_vegetated_landunit_n_patches - - - -end module unittestSimpleSubgridSetupsMod diff --git a/src/unit_test_shr/unittestSubgridMod.F90 b/src/unit_test_shr/unittestSubgridMod.F90 deleted file mode 100644 index 486957b655..0000000000 --- a/src/unit_test_shr/unittestSubgridMod.F90 +++ /dev/null @@ -1,483 +0,0 @@ -module unittestSubgridMod - - ! Provides routines to aid with the setup of subgrid structure for unit tests that need - ! it. - ! - ! In the setup for a test, the following should be done: - ! - ! (1) call unittest_subgrid_setup_start - ! Note: if explicitly setting nlevsno, that must be done *before* the call to - ! unittest_subgrid_setup_start - ! (2) add grid cells, landunits, columns & pfts as desired, using the routines defined in - ! this module (i.e., using unittest_add_landunit, etc. - NOT directly via add_landunit, etc.) - ! (3) call unittest_subgrid_setup_end - ! - ! Example: To add a single grid cell, with two landunits (nat. veg. and icemec), with a - ! single column on the nat veg landunit, the following can be done: - ! - ! call unittest_subgrid_setup_start() - ! call unittest_add_gridcell() - ! call unittest_add_landunit(my_gi=gi, ltype=istsoil, wtgcell=0.4_r8) - ! call unittest_add_column(my_li=li, ctype=1, wtlunit=1.0_r8) - ! c_soil = ci - ! call unittest_add_landunit(my_gi=gi, ltype=istice_mec, wtgcell=0.6_r8) - ! call unittest_subgrid_setup_end() - ! - ! A few things to note about this example: - ! (1) Note the use of gi, li and ci to get the index of the most recently-added grid - ! cell / landunit / column - ! (2) Note that not all subgrid information has been filled in: no patches were added - ! to the soil landunit, and no columns or patches were added to the icemec - ! landunit. This is because this extra level of detail wasn't needed for this - ! particular unit test. This omission is perfectly acceptable. - ! - ! In the teardown for a test, the following should be done: - ! - ! (1) call unittest_subgrid_teardown - ! - ! Note: This can safely be done even if subgrid stuff was never set up for some - ! tests (it will only do anything if the subgrid setup was done). - - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type, procinfo, get_proc_bounds - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - - implicit none - private - save - - ! ------------------------------------------------------------------------ - ! Public entities - ! ------------------------------------------------------------------------ - - ! Public routines - public :: unittest_subgrid_setup_start ! do the initial setup of subgrid stuff needed for unit testing - public :: unittest_subgrid_setup_end ! do the last part of setup - public :: unittest_subgrid_teardown ! do any teardown needed for the subgrid stuff - public :: unittest_add_gridcell ! add a grid cell - public :: unittest_add_landunit ! add a landunit - public :: unittest_add_column ! add a column - public :: unittest_add_patch ! add a patch - public :: get_ltype_special ! get a landunit type corresponding to a special landunit - - ! bounds info, which can be passed to routines that need it - ! Note that the end indices here (endg, endl, endc, endp) will be the final indices in - ! use, in contrast to the module-level endg, endl, etc., which give the final indices - ! of the allocated arrays. - type(bounds_type), public, protected :: bounds - - ! Indices of last grid cell / landunit / column / patch added - integer, public, protected :: gi - integer, public, protected :: li - integer, public, protected :: ci - integer, public, protected :: pi - - ! Maximum array sizes at each level - integer, parameter, public :: numg = 6 - integer, parameter, public :: numl = 30 - integer, parameter, public :: numc = 50 - integer, parameter, public :: nump = 100 - - ! Indices of initial grid cell / landunit / column / patch - ! - ! Note that we do NOT start at 1, in order to catch any code that assumes indices start - ! at 1. - integer, parameter, public :: begg = 11 - integer, parameter, public :: begl = 21 - integer, parameter, public :: begc = 31 - integer, parameter, public :: begp = 41 - - ! Indices of final grid cell / landunit / column / patch - ! Note that these are the final indices of the allocated arrays, which may be greater - ! than the final index that is actually used for a given test. - integer, parameter, public :: endg = begg + numg - 1 - integer, parameter, public :: endl = begl + numl - 1 - integer, parameter, public :: endc = begc + numc - 1 - integer, parameter, public :: endp = begp + nump - 1 - - ! ------------------------------------------------------------------------ - ! Private entities - ! ------------------------------------------------------------------------ - - integer, private :: nlevsno_orig ! original value of nlevsno, saved so we can restore it later - logical, private :: nlevsno_set ! whether we set nlevsno here - logical, private :: unittest_subgrid_needs_teardown = .false. ! whether subgrid stuff has been initialized - -contains - - !----------------------------------------------------------------------- - subroutine unittest_subgrid_setup_start - ! - ! !DESCRIPTION: - ! Do the initial setup of subgrid stuff needed for unit testing. This should be - ! called for each test. - ! - ! !USES: - use clm_varpar, only : natpft_lb - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_subgrid_setup_start' - !----------------------------------------------------------------------- - - call initialize_arrays - - ! Initialize local module variables - - gi = begg - 1 - li = begl - 1 - ci = begc - 1 - pi = begp - 1 - - ! Initialize other variables needed for the subgrid setup - - natpft_lb = 0 - - unittest_subgrid_needs_teardown = .true. - - end subroutine unittest_subgrid_setup_start - - !----------------------------------------------------------------------- - subroutine unittest_subgrid_setup_end - ! - ! !DESCRIPTION: - ! Do the last part of setup. This should be called after adding all of the landunits, - ! columns, pfts, etc. for the test. - ! - ! !USES: - use initSubgridMod, only : clm_ptrs_compdown - use subgridWeightsMod, only : compute_higher_order_weights - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_subgrid_setup_end' - !----------------------------------------------------------------------- - - call set_decomp_info - call create_bounds_object - call clm_ptrs_compdown(bounds) - call compute_higher_order_weights(bounds) - - end subroutine unittest_subgrid_setup_end - - !----------------------------------------------------------------------- - subroutine set_decomp_info - ! - ! !DESCRIPTION: - ! Set up decomp info in decompMod. - ! - ! We need to do this (in addition to just making sure that the bounds derived type - ! object is set up correctly) for the sake of callers of get_proc_bounds. - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'set_decomp_info' - !----------------------------------------------------------------------- - - ! For now, not setting up clump info, because it isn't needed in any unit tests. We - ! may have to fix this in the future. - procinfo%nclumps = 1 - allocate(procinfo%cid(procinfo%nclumps)) - procinfo%cid(:) = -1 - - procinfo%begg = begg - procinfo%endg = gi - procinfo%begl = begl - procinfo%endl = li - procinfo%begc = begc - procinfo%endc = ci - procinfo%begp = begp - procinfo%endp = pi - - procinfo%ncells = procinfo%endg - procinfo%begg + 1 - procinfo%nlunits = procinfo%endl - procinfo%begl + 1 - procinfo%ncols = procinfo%endc - procinfo%begc + 1 - procinfo%npatches = procinfo%endp - procinfo%begp + 1 - - ! Currently leaving cohort info unset because it isn't needed in any unit tests. We - ! may have to fix this in the future. - - end subroutine set_decomp_info - - !----------------------------------------------------------------------- - subroutine create_bounds_object - ! - ! !DESCRIPTION: - ! Create the bounds derived type object - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'set_bounds' - !----------------------------------------------------------------------- - - ! Some routines want a proc-level bounds. So for now, just making bounds be - ! proc-level. In the future, we may need both a proc-level and clumps-level bounds - ! object (if other routines want a clump-level bounds). (For the sake of unit - ! testing, proc-level and clump-level bounds objects can probably be the same except - ! for bounds%level and bounds%clump_index.) - call get_proc_bounds(bounds) - - end subroutine create_bounds_object - - - - !----------------------------------------------------------------------- - subroutine initialize_arrays - ! - ! !DESCRIPTION: - ! Allocate subgrid arrays, and initialize them to default values. - ! - ! !USES: - use landunit_varcon , only : max_lunit - use clm_varcon , only : ispval - use GridcellType , only : grc - use LandunitType , only : lun - use ColumnType , only : col - use PatchType , only : patch - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'initialize_arrays' - !----------------------------------------------------------------------- - - ! column initialization depends on the nlevsno runtime parameter, so we first need to - ! set that - call init_nlevsno() - - call grc%Init(begg, endg) - call lun%Init(begl, endl) - call col%Init(begc, endc) - call patch%init(begp, endp) - - end subroutine initialize_arrays - - !----------------------------------------------------------------------- - subroutine unittest_subgrid_teardown - ! - ! !DESCRIPTION: - ! Do any teardown needed for the subgrid stuff - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_subgrid_teardown' - !----------------------------------------------------------------------- - - if (unittest_subgrid_needs_teardown) then - call grc%clean - call lun%clean - call col%clean - call patch%clean - - call reset_nlevsno() - - unittest_subgrid_needs_teardown = .false. - end if - - end subroutine unittest_subgrid_teardown - - !----------------------------------------------------------------------- - subroutine unittest_add_gridcell() - ! - ! !DESCRIPTION: - ! Add a grid cell. The index of the just-added grid cell can be obtained from the - ! module-level variable, gi. - ! - ! Unlike add_landunit, add_column and add_patch, this is specific to the unit test - ! code, because no such routine is needed in the production code - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_add_gridcell' - !----------------------------------------------------------------------- - - gi = gi + 1 - - end subroutine unittest_add_gridcell - - !----------------------------------------------------------------------- - subroutine unittest_add_landunit(my_gi, ltype, wtgcell) - ! - ! !DESCRIPTION: - ! Add a landunit, and make it active. The index of the just-added landunit can be - ! obtained from the module-level variable, li. - ! - ! This is simply a wrapper to the routine in initSubgridMod. We provide this for two - ! reasons: - ! - ! (1) To allow the module-level li variable to be protected - ! - ! (2) To insulate most of the unit test code from any changes in the interface to - ! add_landunit - ! - ! !USES: - use initSubgridMod, only : add_landunit - ! - ! !ARGUMENTS: - integer , intent(in) :: my_gi ! grid cell index on which this landunit should be placed - integer , intent(in) :: ltype ! landunit type - real(r8) , intent(in) :: wtgcell ! weight of the landunit relative to the grid cell - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_add_landunit' - !----------------------------------------------------------------------- - - call add_landunit(li=li, gi=my_gi, ltype=ltype, wtgcell=wtgcell) - lun%active(li) = .true. - - end subroutine unittest_add_landunit - - !----------------------------------------------------------------------- - subroutine unittest_add_column(my_li, ctype, wtlunit) - ! - ! !DESCRIPTION: - ! Add a column, and make it active. The index of the just-added column can be obtained - ! from the module-level variable, ci. - ! - ! This is simply a wrapper to the routine in initSubgridMod. We provide this for two - ! reasons: - ! - ! (1) To allow the module-level ci variable to be protected - ! - ! (2) To insulate most of the unit test code from any changes in the interface to - ! add_column - ! - ! !USES: - use initSubgridMod, only : add_column - ! - ! !ARGUMENTS: - integer , intent(in) :: my_li ! landunit index on which this column should be placed - integer , intent(in) :: ctype ! column type - real(r8) , intent(in) :: wtlunit ! weight of the column relative to the land unit - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_add_column' - !----------------------------------------------------------------------- - - call add_column(ci=ci, li=my_li, ctype=ctype, wtlunit=wtlunit) - col%active(ci) = .true. - - end subroutine unittest_add_column - - !----------------------------------------------------------------------- - subroutine unittest_add_patch(my_ci, ptype, wtcol) - ! - ! !DESCRIPTION: - ! Add a patch, and make it active. The index of the just-added patch can be obtained - ! from the module-level variable, pi. - ! - ! This is simply a wrapper to the routine in initSubgridMod. We provide this for two - ! reasons: - ! - ! (1) To allow the module-level pi variable to be protected - ! - ! (2) To insulate most of the unit test code from any changes in the interface to - ! add_patch - ! - ! !USES: - use initSubgridMod, only : add_patch - ! - ! !ARGUMENTS: - integer , intent(in) :: my_ci ! column index on which this patch should be placed - integer , intent(in) :: ptype ! patch type - real(r8) , intent(in) :: wtcol ! weight of the patch relative to the column - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_add_patch' - !----------------------------------------------------------------------- - - call add_patch(pi=pi, ci=my_ci, ptype=ptype, wtcol=wtcol) - patch%active(pi) = .true. - - end subroutine unittest_add_patch - - !----------------------------------------------------------------------- - function get_ltype_special() result(ltype) - ! - ! !DESCRIPTION: - ! Returns a landunit type corresponding to a special landunit - ! - ! !USES: - use landunit_varcon, only : max_lunit, landunit_is_special - ! - ! !ARGUMENTS: - integer :: ltype ! function result - ! - ! !LOCAL VARIABLES: - integer :: ltype_test - logical :: found - - character(len=*), parameter :: subname = 'get_ltype_special' - !----------------------------------------------------------------------- - - found = .false. - ltype_test = 1 - do while (ltype_test <= max_lunit .and. .not. found) - if (landunit_is_special(ltype_test)) then - ltype = ltype_test - found = .true. - else - ltype_test = ltype_test + 1 - end if - end do - - if (.not. found) then - print *, subname//' ERROR: cannot find a special landunit' - stop - end if - - end function get_ltype_special - - - subroutine init_nlevsno() - ! Initialize nlevsno to a reasonable value, if it is not already set - - use clm_varpar, only : nlevsno - - if (nlevsno <= 0) then - nlevsno_orig = nlevsno - nlevsno = 5 - nlevsno_set = .true. - else - nlevsno_set = .false. - end if - end subroutine init_nlevsno - - subroutine reset_nlevsno - ! If we set nlevsno in init_nlevsno, then reset it to its original value - - use clm_varpar, only : nlevsno - - if (nlevsno_set) then - nlevsno = nlevsno_orig - end if - end subroutine reset_nlevsno - -end module unittestSubgridMod diff --git a/src/unit_test_shr/unittestTimeManagerMod.F90 b/src/unit_test_shr/unittestTimeManagerMod.F90 deleted file mode 100644 index 72ff57b9b9..0000000000 --- a/src/unit_test_shr/unittestTimeManagerMod.F90 +++ /dev/null @@ -1,222 +0,0 @@ -module unittestTimeManagerMod - - ! This module provides wrappers to the clm_time_manager, which facilitate configuring - ! the time manager as desired for each unit test. - ! - ! In the setup for a test, the following should be done: - ! - ! (1) call unittest_timemgr_setup - ! - ! (2) optionally (if the unit test needs a specific date/time): call - ! unittest_timemgr_set_curr_date - ! - ! (3) optionally (if the unit test needs a specific time step number): call - ! unittest_timemgr_set_nstep - ! - ! In the teardown for any test that called unittest_timemgr_init, the following should - ! be done: - ! - ! (1) call unittest_timemgr_teardown - ! - ! - ! Note that there are still some test-specific routines in clm_time_manager. Those - ! include (a) routines that have info that is closely tied to info already in - ! clm_time_manager (e.g., timemgr_reset, which needs to reset all module data - ! defined in clm_time_manager), and/or (b) routines that modify data that are private to - ! clm_time_manager. The routines in this unittest-specific file, in contrast, tend to be - ! higher-level wrappers. - - implicit none - private - save - - ! Public routines - public :: unittest_timemgr_setup ! do the initial setup of the time manager - public :: unittest_timemgr_set_curr_date ! set the current date - public :: unittest_timemgr_teardown ! tear down the time manager at the end of a test - public :: unittest_timemgr_set_curr_year ! set the current year, keeping other date components unchanged - public :: unittest_timemgr_set_nstep ! set the time step number - -contains - - !----------------------------------------------------------------------- - subroutine unittest_timemgr_setup(dtime) - ! - ! !DESCRIPTION: - ! Set up the time manager for each unit test. - ! - ! Should be called once for every test that uses the time manager. - ! - ! !USES: - use ESMF, only : ESMF_Initialize, ESMF_SUCCESS - use clm_time_manager, only : set_timemgr_init, timemgr_init, NO_LEAP_C - ! - ! !ARGUMENTS: - integer, intent(in), optional :: dtime ! time step (seconds) - ! - ! !LOCAL VARIABLES: - integer :: l_dtime ! local version of dtime - integer :: rc ! return code - - integer, parameter :: dtime_default = 1800 ! time step (seconds) - - ! Set ymd values to be year N, month 1, day 1 - integer, parameter :: start_ymd = 10101 - integer, parameter :: ref_ymd = start_ymd - integer, parameter :: stop_ymd = 20101 - integer, parameter :: perpetual_ymd = start_ymd - - ! Set current time to be at the start of year 1 - integer, parameter :: curr_yr = 1 - integer, parameter :: curr_mon = 1 - integer, parameter :: curr_day = 1 - integer, parameter :: curr_tod = 0 - - character(len=*), parameter :: subname = 'unittest_timemgr_setup' - !----------------------------------------------------------------------- - - if (present(dtime)) then - l_dtime = dtime - else - l_dtime = dtime_default - end if - - call ESMF_Initialize(rc=rc) - if (rc /= ESMF_SUCCESS) then - stop 'Error in ESMF_Initialize' - end if - - call set_timemgr_init( & - calendar_in = NO_LEAP_C, & - start_ymd_in = start_ymd, & - start_tod_in = 0, & - ref_ymd_in = ref_ymd, & - ref_tod_in = 0, & - stop_ymd_in = stop_ymd, & - stop_tod_in = 0, & - perpetual_run_in = .false., & - perpetual_ymd_in = perpetual_ymd, & - nelapse_in = 1, & - dtime_in = l_dtime) - - call timemgr_init() - - call unittest_timemgr_set_curr_date( & - yr = curr_yr, & - mon = curr_mon, & - day = curr_day, & - tod = curr_tod) - - end subroutine unittest_timemgr_setup - - !----------------------------------------------------------------------- - subroutine unittest_timemgr_set_curr_date(yr, mon, day, tod) - ! - ! !DESCRIPTION: - ! Set the current model date in the time manager. This is the time at the END of the - ! time step. - ! - ! !USES: - use clm_time_manager, only : for_test_set_curr_date - ! - ! !ARGUMENTS: - integer, intent(in) :: yr ! year - integer, intent(in) :: mon ! month - integer, intent(in) :: day ! day of month - integer, intent(in) :: tod ! time of day (seconds past 0Z) - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'unittest_timemgr_set_curr_date' - !----------------------------------------------------------------------- - - call for_test_set_curr_date(yr, mon, day, tod) - - end subroutine unittest_timemgr_set_curr_date - - !----------------------------------------------------------------------- - subroutine unittest_timemgr_set_curr_year(yr) - ! - ! !DESCRIPTION: - ! Set the current model year, keeping other date components unchanged - ! - ! !USES: - use clm_time_manager, only : get_curr_date - ! - ! !ARGUMENTS: - integer, intent(in) :: yr ! new year - ! - ! !LOCAL VARIABLES: - integer :: curr_yr - integer :: curr_mon - integer :: curr_day - integer :: curr_tod - - character(len=*), parameter :: subname = 'unittest_timemgr_set_curr_year' - !----------------------------------------------------------------------- - - call get_curr_date(curr_yr, curr_mon, curr_day, curr_tod) - call unittest_timemgr_set_curr_date(yr, curr_mon, curr_day, curr_tod) - - end subroutine unittest_timemgr_set_curr_year - - !----------------------------------------------------------------------- - subroutine unittest_timemgr_set_nstep(nstep) - ! - ! !DESCRIPTION: - ! Set the time step number - ! - ! Note that the starting time step number is 0, so calling this with nstep = 1 - ! advances the time step beyond the starting time step. - ! - ! !USES: - use clm_time_manager, only : advance_timestep - ! - ! !ARGUMENTS: - integer, intent(in) :: nstep - ! - ! !LOCAL VARIABLES: - integer :: n - - character(len=*), parameter :: subname = 'unittest_timemgr_set_nstep' - !----------------------------------------------------------------------- - - do n = 1, nstep - call advance_timestep() - end do - - end subroutine unittest_timemgr_set_nstep - - - - !----------------------------------------------------------------------- - subroutine unittest_timemgr_teardown - ! - ! !DESCRIPTION: - ! Tear down the time manager from each unit test. - ! - ! Should be called once at the end of every test that set up the time manager. - ! - ! !USES: - use ESMF, only : ESMF_Finalize, ESMF_SUCCESS - use clm_time_manager, only : timemgr_reset - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: rc ! return code - - character(len=*), parameter :: subname = 'unittest_timemgr_teardown' - !----------------------------------------------------------------------- - - call timemgr_reset() - - call ESMF_Finalize(rc=rc) - if (rc /= ESMF_SUCCESS) then - stop 'Error in ESMF_Finalize' - end if - - end subroutine unittest_timemgr_teardown - - -end module unittestTimeManagerMod diff --git a/src/unit_test_shr/unittestUtils.F90 b/src/unit_test_shr/unittestUtils.F90 deleted file mode 100644 index 9121a2e9eb..0000000000 --- a/src/unit_test_shr/unittestUtils.F90 +++ /dev/null @@ -1,33 +0,0 @@ -module unittestUtils - - ! Miscellaneous utilities to aid unit testing - - implicit none - private - - public :: endrun_msg ! Gives the message thrown by shr_abort_abort, given a call to endrun(msg) - -contains - - !----------------------------------------------------------------------- - function endrun_msg(msg) - ! - ! !DESCRIPTION: - ! Gives the message thrown by shr_abort_abort, given a call to endrun(msg) - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=:), allocatable :: endrun_msg ! function result - character(len=*), intent(in) :: msg - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'endrun_msg' - !----------------------------------------------------------------------- - - endrun_msg = 'ABORTED: '//trim(msg) - - end function endrun_msg - -end module unittestUtils diff --git a/src/unit_test_stubs/CMakeLists.txt b/src/unit_test_stubs/CMakeLists.txt deleted file mode 100644 index 38abfb1633..0000000000 --- a/src/unit_test_stubs/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_subdirectory(csm_share) -add_subdirectory(dyn_subgrid) -add_subdirectory(main) -add_subdirectory(utils) - -sourcelist_to_parent(clm_sources) -sourcelist_to_parent(clm_genf90_sources) -sourcelist_to_parent(share_sources) diff --git a/src/unit_test_stubs/csm_share/CMakeLists.txt b/src/unit_test_stubs/csm_share/CMakeLists.txt deleted file mode 100644 index f1c6f12ded..0000000000 --- a/src/unit_test_stubs/csm_share/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -list(APPEND share_sources - mct_mod_stub.F90 - seq_comm_mct.F90 - shr_mpi_mod_stub.F90 - ) - -sourcelist_to_parent(share_sources) diff --git a/src/unit_test_stubs/csm_share/mct_mod_stub.F90 b/src/unit_test_stubs/csm_share/mct_mod_stub.F90 deleted file mode 100644 index 832b8847d7..0000000000 --- a/src/unit_test_stubs/csm_share/mct_mod_stub.F90 +++ /dev/null @@ -1,30 +0,0 @@ -module mct_mod - - ! This is a stub of mct_mod, which only includes the bare minimum needed to build CLM - ! unit tests - - implicit none - - public :: mct_gsMap - public :: mct_gsMap_orderedPoints - - type mct_gsMap - ! Empty, dummy type - end type mct_gsMap - -contains - - subroutine mct_gsMap_orderedPoints(GSMap, PEno, Points) - ! Stub routine that simply matches the signature of mct_gsMap_orderedPoints - ! this routine allocates the Points array, to match the documented behavior of the - ! real routine. This is needed so that a later deallocate will succeed. But note that - ! it is just allocated to be of size 1, so it cannot be used for any real - ! calculations. - type(mct_gsMap), intent(in) :: GSMap - integer, intent(in) :: PEno - integer,dimension(:),pointer :: Points - - allocate(Points(1)) - end subroutine mct_gsMap_orderedPoints - -end module mct_mod diff --git a/src/unit_test_stubs/csm_share/seq_comm_mct.F90 b/src/unit_test_stubs/csm_share/seq_comm_mct.F90 deleted file mode 100644 index f8201284ba..0000000000 --- a/src/unit_test_stubs/csm_share/seq_comm_mct.F90 +++ /dev/null @@ -1,10 +0,0 @@ -module seq_comm_mct - ! Stub of seq_comm_mct, containing just what's needed for CLM modules. - ! - ! Note that the true seq_comm_mct is in cime/scr/drivers/mct/shr - - implicit none - save - - integer, public :: logunit = 6 -end module seq_comm_mct diff --git a/src/unit_test_stubs/csm_share/shr_mpi_mod_stub.F90 b/src/unit_test_stubs/csm_share/shr_mpi_mod_stub.F90 deleted file mode 100644 index 7a51d56ed9..0000000000 --- a/src/unit_test_stubs/csm_share/shr_mpi_mod_stub.F90 +++ /dev/null @@ -1,469 +0,0 @@ -!=============================================================================== -! SVN $Id: shr_mpi_mod.F90 59033 2014-04-11 01:55:15Z santos@ucar.edu $ -! SVN $URL: https://svn-ccsm-models.cgd.ucar.edu/csm_share/trunk_tags/share3_140723/shr/shr_mpi_mod.F90 $ -!=============================================================================== - -Module shr_mpi_mod - -!------------------------------------------------------------------------------- -! PURPOSE: general layer on MPI functions -!------------------------------------------------------------------------------- - - use shr_kind_mod - use shr_log_mod, only: s_loglev => shr_log_Level - use shr_log_mod, only: s_logunit => shr_log_Unit - - implicit none - private - -! PUBLIC: Public interfaces - - public :: shr_mpi_chkerr - public :: shr_mpi_bcast - public :: shr_mpi_commsize - public :: shr_mpi_commrank - public :: shr_mpi_initialized - public :: shr_mpi_abort - public :: shr_mpi_barrier - public :: shr_mpi_init - public :: shr_mpi_finalize - - interface shr_mpi_bcast ; module procedure & - shr_mpi_bcastc0, & - shr_mpi_bcastc1, & - shr_mpi_bcastl0, & - shr_mpi_bcastl1, & - shr_mpi_bcasti0, & - shr_mpi_bcasti1, & - shr_mpi_bcasti2, & - shr_mpi_bcastr0, & - shr_mpi_bcastr1, & - shr_mpi_bcastr2, & - shr_mpi_bcastr3 - end interface - -!=============================================================================== -CONTAINS -!=============================================================================== - -SUBROUTINE shr_mpi_chkerr(rcode,string) - - IMPLICIT none - - !----- arguments --- - integer(SHR_KIND_IN), intent(in) :: rcode ! input MPI error code - character(*), intent(in) :: string ! message - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_chkerr) ' - -!------------------------------------------------------------------------------- -! PURPOSE: layer on MPI error checking -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_chkerr - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcasti0(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - integer(SHR_KIND_IN), intent(inout):: vec ! vector of 1 - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcasti0) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast an integer -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcasti0 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastl0(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - logical, intent(inout):: vec ! vector of 1 - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcastl0) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a logical -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastl0 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastc0(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - character(len=*), intent(inout) :: vec ! vector of 1 - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcastc0) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a character string -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastc0 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastc1(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - character(len=*), intent(inout) :: vec(:) ! 1D vector - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcastc1) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a character string -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastc1 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastr0(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - real(SHR_KIND_R8), intent(inout):: vec ! vector of 1 - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcastr0) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a real -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastr0 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcasti1(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - integer(SHR_KIND_IN), intent(inout):: vec(:) ! vector - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcasti1) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a vector of integers -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcasti1 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastl1(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - logical, intent(inout):: vec(:) ! vector of 1 - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcastl1) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a logical -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastl1 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastr1(vec,comm,string,pebcast) - - IMPLICIT none - - !----- arguments --- - real(SHR_KIND_R8), intent(inout):: vec(:) ! vector - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_bcastr1) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a vector of reals -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastr1 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastr2(arr,comm,string,pebcast) - - IMPLICIT none - - !----- arguments ----- - real(SHR_KIND_R8), intent(inout):: arr(:,:) ! array, 2d - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local ----- - - !----- formats ----- - character(*),parameter :: subName = '(shr_mpi_bcastr2) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a 2d array of reals -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastr2 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcasti2(arr,comm,string,pebcast) - - IMPLICIT none - - !----- arguments ----- - integer, intent(inout):: arr(:,:) ! array, 2d - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local ----- - character(*),parameter :: subName = '(shr_mpi_bcasti2) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a 2d array of integers -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcasti2 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_bcastr3(arr,comm,string,pebcast) - - IMPLICIT none - - !----- arguments ----- - real(SHR_KIND_R8), intent(inout):: arr(:,:,:) ! array, 3d - integer(SHR_KIND_IN), intent(in) :: comm ! mpi communicator - character(*),optional,intent(in) :: string ! message - integer(SHR_KIND_IN), optional, intent(in) :: pebcast ! bcast pe (otherwise zero) - - !----- local ----- - character(*),parameter :: subName = '(shr_mpi_bcastr3) ' - -!------------------------------------------------------------------------------- -! PURPOSE: Broadcast a 3d array of reals -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_bcastr3 - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_commsize(comm,size,string) - - IMPLICIT none - - !----- arguments --- - integer,intent(in) :: comm - integer,intent(out) :: size - character(*),optional,intent(in) :: string ! message - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_commsize) ' - -!------------------------------------------------------------------------------- -! PURPOSE: MPI commsize -!------------------------------------------------------------------------------- - size = 1 - -END SUBROUTINE shr_mpi_commsize - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_commrank(comm,rank,string) - - IMPLICIT none - - !----- arguments --- - integer,intent(in) :: comm - integer,intent(out) :: rank - character(*),optional,intent(in) :: string ! message - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_commrank) ' - -!------------------------------------------------------------------------------- -! PURPOSE: MPI commrank -!------------------------------------------------------------------------------- - rank = 0 - -END SUBROUTINE shr_mpi_commrank - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_initialized(flag,string) - - IMPLICIT none - - !----- arguments --- - logical,intent(out) :: flag - character(*),optional,intent(in) :: string ! message - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_initialized) ' - -!------------------------------------------------------------------------------- -! PURPOSE: MPI initialized -!------------------------------------------------------------------------------- - flag = .true. - -END SUBROUTINE shr_mpi_initialized - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_abort(string,rcode) - - IMPLICIT none - - !----- arguments --- - character(*),optional,intent(in) :: string ! message - integer,optional,intent(in) :: rcode ! optional code - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_abort) ' - integer :: rc ! return code - -!------------------------------------------------------------------------------- -! PURPOSE: MPI abort -!------------------------------------------------------------------------------- - - if ( present(string) .and. present(rcode) ) then - write(s_logunit,*) trim(subName),":",trim(string),rcode - endif - if ( present(rcode) )then - rc = rcode - else - rc = 1001 - end if - stop - -END SUBROUTINE shr_mpi_abort - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_barrier(comm,string) - - IMPLICIT none - - !----- arguments --- - integer,intent(in) :: comm - character(*),optional,intent(in) :: string ! message - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_barrier) ' - -!------------------------------------------------------------------------------- -! PURPOSE: MPI barrier -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_barrier - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_init(string) - - IMPLICIT none - - !----- arguments --- - character(*),optional,intent(in) :: string ! message - - !----- local --- - character(*),parameter :: subName = '(shr_mpi_init) ' - -!------------------------------------------------------------------------------- -! PURPOSE: MPI init -!------------------------------------------------------------------------------- - -END SUBROUTINE shr_mpi_init - -!=============================================================================== -!=============================================================================== - -SUBROUTINE shr_mpi_finalize(string) - - IMPLICIT none - - !----- arguments --- - character(*),optional,intent(in) :: string ! message - - !----- local --- - -!------------------------------------------------------------------------------- -! PURPOSE: MPI finalize -!------------------------------------------------------------------------------- - if ( present(string) ) & - write(s_logunit,*) trim(string) - call shr_mpi_abort("MPI Finalize") - -END SUBROUTINE shr_mpi_finalize - -!=============================================================================== -!=============================================================================== - -END MODULE shr_mpi_mod diff --git a/src/unit_test_stubs/dyn_subgrid/CMakeLists.txt b/src/unit_test_stubs/dyn_subgrid/CMakeLists.txt deleted file mode 100644 index af20f4bbd0..0000000000 --- a/src/unit_test_stubs/dyn_subgrid/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -list(APPEND clm_sources - dynFileMod_stub.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/unit_test_stubs/dyn_subgrid/dynFileMod_stub.F90 b/src/unit_test_stubs/dyn_subgrid/dynFileMod_stub.F90 deleted file mode 100644 index a07c8eec13..0000000000 --- a/src/unit_test_stubs/dyn_subgrid/dynFileMod_stub.F90 +++ /dev/null @@ -1,47 +0,0 @@ -module dynFileMod - - ! This is a stub replacement for dynFileMod. It bypasses all of the netcdf-related - ! stuff, instead allowing direct specification of the possible set of years and the - ! current year. Thus, it is essentially just a wrapper to a dyn_time_info variable. - - use dynTimeInfoMod, only : time_info_type, YEAR_POSITION_END_OF_TIMESTEP - use ncdio_pio, only : file_desc_t - implicit none - save - private - - public :: dyn_file_type - - ! Note that this is intended to be used with the fake form of file_desc_t, defined in - ! ncdio_pio_fake.F90 - type, extends(file_desc_t) :: dyn_file_type - type(time_info_type) :: time_info - end type dyn_file_type - - interface dyn_file_type - module procedure constructor ! initialize a new dyn_file_type object - end interface dyn_file_type - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - type(dyn_file_type) function constructor(my_years) - ! Note that this should be used with the fake form of file_desc_t, defined in - ! ncdio_pio_fake.F90 - ! - ! The time_info object is created assuming we want to use - ! year_position=YEAR_POSITION_END_OF_TIMESTEP - - integer, intent(in) :: my_years(:) ! all years desired for the time_info variable - - ! The following only works if we're using the fake form of file_desc_t, defined in - ! ncdio_pio_fake.F90 - constructor%file_desc_t = file_desc_t() - - constructor%time_info = time_info_type(my_years, YEAR_POSITION_END_OF_TIMESTEP) - end function constructor - -end module dynFileMod diff --git a/src/unit_test_stubs/main/CMakeLists.txt b/src/unit_test_stubs/main/CMakeLists.txt deleted file mode 100644 index b98156b5d0..0000000000 --- a/src/unit_test_stubs/main/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -set(genf90_files - ncdio_pio_fake.F90.in - ncdio_var.F90.in - ) - -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) - -sourcelist_to_parent(clm_genf90_sources) - -list(APPEND clm_sources "${clm_genf90_sources}") - -list(APPEND clm_sources - GetGlobalValuesMod_stub.F90 - histFileMod_stub.F90 - ncdio_dim.F90 - ncdio_pio_fake.F90 - ncdio_var.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/unit_test_stubs/main/GetGlobalValuesMod_stub.F90 b/src/unit_test_stubs/main/GetGlobalValuesMod_stub.F90 deleted file mode 100644 index 1e61fc17be..0000000000 --- a/src/unit_test_stubs/main/GetGlobalValuesMod_stub.F90 +++ /dev/null @@ -1,19 +0,0 @@ -module GetGlobalValuesMod - - ! Stub of GetGlobalValuesMod, which satisfies routine signatures with minimal - ! dependencies - - implicit none - - public :: GetGlobalWrite - -contains - - subroutine GetGlobalWrite(decomp_index, clmlevel) - integer, intent(in) :: decomp_index - character(len=*), intent(in) :: clmlevel - - ! do nothing - end subroutine GetGlobalWrite - -end module GetGlobalValuesMod diff --git a/src/unit_test_stubs/main/histFileMod_stub.F90 b/src/unit_test_stubs/main/histFileMod_stub.F90 deleted file mode 100644 index 0b261dc55e..0000000000 --- a/src/unit_test_stubs/main/histFileMod_stub.F90 +++ /dev/null @@ -1,111 +0,0 @@ -module histFileMod - - ! This is a stub for histFileMod. Currently all it does is provide empty - ! implementations for hist_addfld calls, to satisfy the interface that is expected - ! throughout the CLM code. - - use shr_kind_mod, only : r8 => shr_kind_r8 - - implicit none - private - save - - integer , public , parameter :: no_snow_normal = 1 ! normal treatment, which should be used for most fields (use spval when snow layer not present) - integer , public , parameter :: no_snow_zero = 2 ! average in a 0 value for times when the snow layer isn't present - - public :: hist_addfld1d - public :: hist_addfld2d - public :: hist_addfld_decomp - -contains - - subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & - ptr_gcell, ptr_lunit, ptr_col, ptr_patch, ptr_lnd, & - ptr_atm, p2c_scale_type, c2l_scale_type, & - l2g_scale_type, set_lake, set_nolake, set_urb, set_nourb, & - set_noglcmec, set_spec, default) - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: units ! units of field - character(len=1), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - character(len=*), optional, intent(in) :: type1d_out ! output type (from clmtype) - real(r8) , optional, pointer :: ptr_gcell(:) ! pointer to gridcell array - real(r8) , optional, pointer :: ptr_lunit(:) ! pointer to landunit array - real(r8) , optional, pointer :: ptr_col(:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:) ! pointer to pft array - real(r8) , optional, pointer :: ptr_lnd(:) ! pointer to lnd array - real(r8) , optional, pointer :: ptr_atm(:) ! pointer to atm array - real(r8) , optional, intent(in) :: set_lake ! value to set lakes to - real(r8) , optional, intent(in) :: set_nolake ! value to set non-lakes to - real(r8) , optional, intent(in) :: set_urb ! value to set urban to - real(r8) , optional, intent(in) :: set_nourb ! value to set non-urban to - real(r8) , optional, intent(in) :: set_noglcmec ! value to set non-glacier_mec to - real(r8) , optional, intent(in) :: set_spec ! value to set special to - character(len=*), optional, intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), optional, intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - - ! Do nothing - - end subroutine hist_addfld1d - - - subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, & - ptr_gcell, ptr_lunit, ptr_col, ptr_patch, ptr_lnd, ptr_atm, & - p2c_scale_type, c2l_scale_type, l2g_scale_type, & - set_lake, set_nolake, set_urb, set_nourb, set_spec, & - no_snow_behavior, default) - - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type2d ! 2d output type - character(len=*), intent(in) :: units ! units of field - character(len=1), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - character(len=*), optional, intent(in) :: type1d_out ! output type (from clmtype) - real(r8) , optional, pointer :: ptr_atm(:,:) ! pointer to atm array - real(r8) , optional, pointer :: ptr_lnd(:,:) ! pointer to lnd array - real(r8) , optional, pointer :: ptr_gcell(:,:) ! pointer to gridcell array - real(r8) , optional, pointer :: ptr_lunit(:,:) ! pointer to landunit array - real(r8) , optional, pointer :: ptr_col(:,:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:,:) ! pointer to pft array - real(r8) , optional, intent(in) :: set_lake ! value to set lakes to - real(r8) , optional, intent(in) :: set_nolake ! value to set non-lakes to - real(r8) , optional, intent(in) :: set_urb ! value to set urban to - real(r8) , optional, intent(in) :: set_nourb ! value to set non-urban to - real(r8) , optional, intent(in) :: set_spec ! value to set special to - integer , optional, intent(in) :: no_snow_behavior ! if a multi-layer snow field, behavior to use for absent snow layers (should be one of the public no_snow_* parameters defined above) - character(len=*), optional, intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), optional, intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - - ! Do nothing - - end subroutine hist_addfld2d - - subroutine hist_addfld_decomp (fname, type2d, units, avgflag, long_name, ptr_col, ptr_patch, default) - - ! - ! !USES: - use clm_varpar , only : nlevdecomp_full - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type2d ! 2d output type - character(len=*), intent(in) :: units ! units of field - character(len=1), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - real(r8) , optional, pointer :: ptr_col(:,:) ! pointer to column array - real(r8) , optional, pointer :: ptr_patch(:,:) ! pointer to pft array - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape - - ! Do nothing - - end subroutine hist_addfld_decomp - -end module histFileMod diff --git a/src/unit_test_stubs/main/ncdio_dim.F90 b/src/unit_test_stubs/main/ncdio_dim.F90 deleted file mode 100644 index 42c490b868..0000000000 --- a/src/unit_test_stubs/main/ncdio_dim.F90 +++ /dev/null @@ -1,58 +0,0 @@ -module ncdio_dim - ! This module is specific to using the ncdio_pio_fake version of ncdio_pio. This - ! provides a derived type for holding a single dimension from a fake netcdf file, and - ! associated methods for working with this derived type. - - implicit none - private - save - - public :: ncdio_dim_type - - integer, parameter, public :: max_name = 256 ! max length for a dimension name - - ! This type store a single dimension in a fake file - type :: ncdio_dim_type - private - character(len=max_name) :: dimname ! dimension name - integer :: dimlen ! dimension length - - contains - procedure :: get_dimname ! get the dimension name - procedure :: get_dimlen ! get the dimension length - end type ncdio_dim_type - - interface ncdio_dim_type - module procedure constructor - end interface ncdio_dim_type - -contains - - !----------------------------------------------------------------------- - type(ncdio_dim_type) function constructor(dimname, dimlen) - ! Create a new object of type ncdio_dim_type - - character(len=*) , intent(in) :: dimname ! dimension name - integer , intent(in) :: dimlen ! dimension length - - constructor%dimname = dimname - constructor%dimlen = dimlen - end function constructor - - !----------------------------------------------------------------------- - character(len=max_name) function get_dimname(this) - ! Get the name associated with this dimension - class(ncdio_dim_type), intent(in) :: this - - get_dimname = this%dimname - end function get_dimname - - !----------------------------------------------------------------------- - integer function get_dimlen(this) - ! Get the length associated with this dimension - class(ncdio_dim_type), intent(in) :: this - - get_dimlen = this%dimlen - end function get_dimlen - -end module ncdio_dim diff --git a/src/unit_test_stubs/main/ncdio_pio_fake.F90.in b/src/unit_test_stubs/main/ncdio_pio_fake.F90.in deleted file mode 100644 index 0d88830b88..0000000000 --- a/src/unit_test_stubs/main/ncdio_pio_fake.F90.in +++ /dev/null @@ -1,822 +0,0 @@ -module ncdio_pio - - ! This is a fake replacement for ncdio_pio. It does not interact with external files - ! (or pio for that matter) at all! Instead it essentially provides setters and getters - ! for module-level variables, in order to fake i/o. - - ! Currently it just contains 'read' functionality - - use shr_kind_mod, only : r8 => shr_kind_r8, i4=>shr_kind_i4 - use shr_assert_mod , only : shr_assert - use ncdio_var, only : ncdio_var_type - use ncdio_dim, only : ncdio_dim_type - - ! !PUBLIC TYPES: - implicit none - save - private - - public :: file_desc_t - public :: var_desc_t - - ! Fake replacement for file_desc_t. Instead of relating to a netcdf file, this fake - ! object contains the data faking the file. - type :: file_desc_t - private - ! all of the variables in the file (a linked list would be a more efficient - ! implementation, but I'm going for simplicity over efficiency here) - type(ncdio_var_type), allocatable :: vars(:) - - ! all of the dimensions in the file - type(ncdio_dim_type), allocatable :: dims(:) - end type file_desc_t - - ! Stub replacement for var_desc_t, to satisfy interfaces that need it - type :: var_desc_t - end type var_desc_t - - integer, parameter, public :: ncd_double = 1 - integer, parameter, public :: ncd_int = 2 - integer, parameter, public :: ncd_log = 3 - - integer, parameter, public :: ncd_global = 1 - - ! - ! !PUBLIC MEMBER FUNCTIONS: - - public :: ncd_io ! do fake i/o (currently only set up to read) - public :: ncd_inqvid ! inquire on a variable id - public :: ncd_set_var ! set data on "file" for one variable - public :: ncd_set_dim ! set a single dimension on a "file" - public :: ncd_reset_read_times ! reset the "read_times" sensor variable for a given variable - public :: ncd_get_read_times ! get the value of the "read_times" sensor variable for a given variable - public :: ncd_pio_openfile ! stub: open file - public :: ncd_pio_closefile ! stub: close file - public :: ncd_inqdid ! stub: inquire dimension id - public :: ncd_inqvdlen ! stub: inquire size of a dimension - public :: ncd_inqdlen ! stub: inquire size of a dimension - public :: ncd_inqfdims ! stub: inquire file dimensions - public :: ncd_getatt ! stub: get attribute - public :: ncd_putatt ! stub: put attribute - - interface file_desc_t - module procedure constructor ! initialize a new file_desc_t object - end interface file_desc_t - - ! - ! !PRIVATE TYPES: - - integer, parameter :: var_not_found = -1 ! flag indicating variable wasn't found on file - - ! - ! !PRIVATE MEMBER FUNCTIONS: - - private :: ncd_get_variable_index ! return the index of a given variable - - interface ncd_io - module procedure ncd_io_1d_double - module procedure ncd_io_2d_double - module procedure ncd_io_1d_int - module procedure ncd_io_2d_int - module procedure ncd_io_3d_double - module procedure ncd_io_3d_int - module procedure ncd_io_1d_logical - - !DIMS 0,1,2,3 - !TYPE int,double - module procedure ncd_io_{DIMS}d_{TYPE}_glob - - !DIMS 0,1,2 - !TYPE text - module procedure ncd_io_{DIMS}d_{TYPE}_glob - - end interface ncd_io - - interface ncd_getatt - module procedure ncd_getatt_char - module procedure ncd_getatt_int - end interface ncd_getatt - - interface ncd_putatt - module procedure ncd_putatt_int - module procedure ncd_putatt_real - module procedure ncd_putatt_char - end interface ncd_putatt - -contains - - ! ====================================================================== - ! Constructors - ! ====================================================================== - - !----------------------------------------------------------------------- - type(file_desc_t) function constructor() - ! - ! !DESCRIPTION: - ! Create a new file_desc_t object - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'file_desc_t constructor' - !----------------------------------------------------------------------- - - allocate(constructor%vars(0)) - allocate(constructor%dims(0)) - - end function constructor - - - ! ====================================================================== - ! Fakes for the actual ncdio_pio functionality - ! ====================================================================== - - !----------------------------------------------------------------------- - ! DIMS 1,2 - subroutine ncd_io_{DIMS}d_double(varname, data, dim1name, flag, ncid, nt, readvar) - ! - ! !DESCRIPTION: - ! Fake for the non-glob form of ncd_io_{DIMS}d_double. - ! - ! Note that this assumes we are working with a single time slice (I'm not sure - ! whether the true ncd_io routines carry that assumption) - ! - ! !ARGUMENTS: - character(len=*) , intent(in) :: varname ! variable name - real(r8) , pointer :: data{DIMSTR} ! local decomposition data (no time dimension) - character(len=*) , intent(in) :: dim1name ! dimension name (unused for the fake) - character(len=*) , intent(in) :: flag ! 'read' or 'write' (currently only 'read' is supported) - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - integer, optional , intent(in) :: nt ! time sample index - logical, optional , intent(out) :: readvar ! true => variable is on dataset (read only) - ! - ! !LOCAL VARIABLES: - integer :: varindex ! index of variable of interest - - character(len=*), parameter :: subname = 'ncd_io_{DIMS}d_double' - !----------------------------------------------------------------------- - - call shr_assert(flag == 'read', subname//' ERROR: currently only the "read" flag is supported') - - ! nt is optional so code can build, but any code that is actually run in a unit - ! test should be providing nt - call shr_assert(present(nt), subname//' ERROR: currently, the nt optional argument must be present') - - varindex = ncd_get_variable_index(ncid, varname) - - if (varindex /= var_not_found) then - call ncid%vars(varindex)%get_data(nt, data) - if (present(readvar)) then - readvar = .true. - end if - else ! varindex == var_not_found - if (present(readvar)) then - readvar = .false. - end if - end if - - end subroutine ncd_io_{DIMS}d_double - - !----------------------------------------------------------------------- - ! DIMS 1,2 - subroutine ncd_io_{DIMS}d_double_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! Fake for the glob (global) form of ncd_io_{DIMS}d_double. - ! - ! If nt isn't provided, it is assumed to be 1. Note that this fake implementation of - ! ncdio_pio gives all variables a time dimension. For variables that are not really - ! supposed to have a time dimension (as is the case for many global variables), it is - ! appropriate to call this routine with nt absent. - ! - ! !ARGUMENTS: - character(len=*) , intent(in) :: varname ! variable name - real(r8) , intent(inout) :: data{DIMSTR} ! read-in data (no time dimension) - character(len=*) , intent(in) :: flag ! 'read' or 'write' (currently only 'read' is supported) - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - logical, optional , intent(out) :: readvar ! true => variable is on dataset (read only) - integer, optional , intent(in) :: nt ! time sample index (if not present, assumed to be 1) - logical, optional , intent(in) :: posNOTonfile ! position is NOT on this file (ignored) - ! - ! !LOCAL VARIABLES: - integer :: l_nt ! local version of nt - integer :: varindex ! index of variable of interest - - character(len=*), parameter :: subname = 'ncd_io_{DIMS}d_double' - !----------------------------------------------------------------------- - - call shr_assert(flag == 'read', subname//' ERROR: currently only the "read" flag is supported') - - if (present(nt)) then - l_nt = nt - else - l_nt = 1 - end if - - varindex = ncd_get_variable_index(ncid, varname) - - if (varindex /= var_not_found) then - call ncid%vars(varindex)%get_data(l_nt, data) - if (present(readvar)) then - readvar = .true. - end if - else ! varindex == var_not_found - if (present(readvar)) then - readvar = .false. - end if - end if - - end subroutine ncd_io_{DIMS}d_double_glob - - - !----------------------------------------------------------------------- - subroutine ncd_inqvid(ncid, name, varid, vardesc, readvar) - ! Fake to inquire on a variable ID - ! - ! Unlike the true implementation, this one never aborts. It is meant to be called - ! with readvar present (in which case the true implementation doesn't abort, either.) - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: name ! variable name - integer , intent(out) :: varid ! variable id - type(Var_desc_t) , intent(out) :: vardesc ! variable descriptor (not set in this implementation) - logical, optional , intent(out) :: readvar ! does variable exist - !----------------------------------------------------------------------- - - varid = ncd_get_variable_index(ncid, name) - - if (present(readvar)) then - if (varid /= var_not_found) then - readvar = .true. - else - readvar = .false. - end if - end if - end subroutine ncd_inqvid - - !----------------------------------------------------------------------- - subroutine ncd_inqdid(ncid, name, dimid, dimexist) - ! - ! !DESCRIPTION: - ! Fake to inquire on a dimension ID - ! - ! Unlike the true implementation, this one never aborts. It is meant to be called - ! with dimexist present (in which case the true implementation doesn't abort, either.) - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: name ! dimension name - integer , intent(out):: dimid ! dimension id - logical,optional , intent(out):: dimexist ! if this dimension exists or not - - dimid = ncd_get_dimension_index(ncid, name) - - if (present(dimexist)) then - if (dimid /= var_not_found) then - dimexist = .true. - else - dimexist = .false. - end if - end if - - end subroutine ncd_inqdid - - !----------------------------------------------------------------------- - subroutine ncd_inqdlen(ncid, dimid, len, name) - ! - ! !DESCRIPTION: - ! Fake to inquire on a dimension length. - ! - ! Returns -1 if the given dimension isn't found. (This differs from the behavior of - ! the true ncd_inqdlen, which I think aborts if the given dimension isn't found.) - ! - ! As in the real implementation: If 'name' is absent, then 'dimid' is used as an - ! input: the dimension id to inquire. If 'name' is present, then it gives the name of - ! the dimension to inquire, and 'dimid' is set to the ID associated with this - ! dimension. - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - integer , intent(inout) :: dimid ! dimension id - integer , intent(out) :: len ! dimension len - character(len=*), optional, intent(in) :: name ! dimension name - ! - ! !LOCAL VARIABLES: - logical :: dimexist - !----------------------------------------------------------------------- - - len = -1 - - if (present(name)) then - call ncd_inqdid(ncid, name, dimid, dimexist = dimexist) - if (.not. dimexist) then - return - end if - end if - - if (dimid >= 1 .and. dimid <= size(ncid%dims)) then - len = ncid%dims(dimid)%get_dimlen() - end if - - end subroutine ncd_inqdlen - - ! ====================================================================== - ! Stubs for the actual ncdio_pio functionality (do nothing) - ! ====================================================================== - - !----------------------------------------------------------------------- - subroutine ncd_pio_openfile(file, fname, mode) - ! - ! !DESCRIPTION: - ! Stub replacement: Open a NetCDF PIO file - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: file ! Output PIO file handle - character(len=*) , intent(in) :: fname ! Input filename to open - integer , intent(in) :: mode ! file mode - - end subroutine ncd_pio_openfile - - !----------------------------------------------------------------------- - subroutine ncd_pio_closefile(file) - ! - ! !DESCRIPTION: - ! Stub replacement: Close a NetCDF PIO file - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: file ! PIO file handle to close - - end subroutine ncd_pio_closefile - - !TYPE int,logical - subroutine ncd_io_1d_{TYPE}(varname, data, dim1name, flag, ncid, nt, readvar, cnvrtnan2fill) - ! - ! !DESCRIPTION: - ! Stub replacement: netcdf I/O for 1d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:) ! local decomposition data - character(len=*) , intent(in) :: dim1name ! dimension name - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - logical , optional, intent(in) :: cnvrtnan2fill ! true => convert any NaN's to _FillValue (spval) - - if (present(readvar)) then - readvar = .false. - end if - - end subroutine ncd_io_1d_{TYPE} - - subroutine ncd_io_2d_int(varname, data, dim1name, lowerb2, upperb2, & - flag, ncid, nt, readvar, switchdim, cnvrtnan2fill) - ! - ! !DESCRIPTION: - ! Stub replacement: netcdf I/O for 2d int - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , pointer :: data(:,:) ! local decomposition input data - character(len=*) , intent(in) :: dim1name ! dimension 1 name - integer, optional, intent(in) :: nt ! time sample index - integer, optional, intent(in) :: lowerb2,upperb2 ! lower and upper bounds of second dimension - logical, optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - logical, optional, intent(in) :: switchdim ! true=> permute dim1 and dim2 for output - logical, optional, intent(in) :: cnvrtnan2fill ! true => convert any NaN's to _FillValue (spval) - - if (present(readvar)) then - readvar = .false. - end if - end subroutine ncd_io_2d_int - - !TYPE int,double - subroutine ncd_io_3d_{TYPE}(varname, data, dim1name, flag, ncid, nt, readvar) - ! - ! !DESCRIPTION: - ! Stub: Netcdf i/o of 3d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:,:,:) ! local decomposition input data - character(len=*) , intent(in) :: dim1name ! dimension 1 name - integer, optional, intent(in) :: nt ! time sample index - logical, optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - - if (present(readvar)) then - readvar = .false. - end if - end subroutine ncd_io_3d_{TYPE} - - !------------------------------------------------------------------------ - !DIMS 0,1,2,3 - subroutine ncd_io_{DIMS}d_int_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! Stub replacement: netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - integer , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - - if (present(readvar)) then - readvar = .false. - end if - - end subroutine ncd_io_{DIMS}d_int_glob - - !------------------------------------------------------------------------ - !DIMS 0,3 - subroutine ncd_io_{DIMS}d_double_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! Stub replacement: netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - real(r8) , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - - if (present(readvar)) then - readvar = .false. - end if - - end subroutine ncd_io_{DIMS}d_double_glob - - !------------------------------------------------------------------------ - !DIMS 0,1,2 - !TYPE text - subroutine ncd_io_{DIMS}d_{TYPE}_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! Stub replacement: netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - {VTYPE} , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - - if (present(readvar)) then - readvar = .false. - end if - end subroutine ncd_io_{DIMS}d_{TYPE}_glob - - !----------------------------------------------------------------------- - subroutine ncd_inqvdlen(ncid,varname,dimnum,dlen,err_code) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_inqvdlen_byName (note that we currently do not support - ! ncd_inqvdlen_byDesc). This does nothing, but just satisfies the interface for - ! ncd_inqvdlen. - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) ,intent(in) :: varname ! variable name - integer ,intent(in) :: dimnum ! dimension number to query - integer ,intent(out) :: dlen ! length of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - - dlen = 0 - err_code = 0 - - end subroutine ncd_inqvdlen - - !----------------------------------------------------------------------- - subroutine ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_inqfdims. This does nothing, but just satisfies the - ! interface. - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout):: ncid - logical , intent(out) :: isgrid2d - integer , intent(out) :: ni - integer , intent(out) :: nj - integer , intent(out) :: ns - - isgrid2d = .true. - ni = 1 - nj = 1 - ns = 1 - end subroutine ncd_inqfdims - - !----------------------------------------------------------------------- - subroutine ncd_getatt_char(ncid,varid,attrib,value) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_getatt_char. This does nothing, but just satisfies the - ! interface. - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - character(len=*) ,intent(out) :: value ! netcdf attrib value - !----------------------------------------------------------------------- - - ! Do nothing - end subroutine ncd_getatt_char - - !----------------------------------------------------------------------- - subroutine ncd_getatt_int(ncid,varid,attrib,value) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_getatt_int. This does nothing, but just satisfies the - ! interface. - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - integer ,intent(out) :: value ! netcdf attrib value - !----------------------------------------------------------------------- - - ! Do nothing - end subroutine ncd_getatt_int - - - !----------------------------------------------------------------------- - subroutine ncd_putatt_int(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_putatt_int. This does nothing, but just satisfies the - ! interface. - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - integer ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - ! Do nothing - end subroutine ncd_putatt_int - - !----------------------------------------------------------------------- - subroutine ncd_putatt_char(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_putatt_char. This does nothing, but just satisfies the - ! interface. - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - character(len=*) ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - ! Do nothing - end subroutine ncd_putatt_char - - !----------------------------------------------------------------------- - subroutine ncd_putatt_real(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! Stub replacement for ncd_putatt_real. This does nothing, but just satisfies the - ! interface. - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - real(r8) ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - ! Do nothing - end subroutine ncd_putatt_real - - - ! ====================================================================== - ! Public routines to aid unit testing, specific to this fake replacement - ! ====================================================================== - - !----------------------------------------------------------------------- - subroutine ncd_set_var(ncid, varname, data, data_shape) - ! - ! !DESCRIPTION: - ! Set values for a single variable on this netcdf 'file'. - ! - ! Regardless of the true dimensionality of the undelying data, this should be called - ! with a 2-d data variable. The 2nd dim is time, 1st is everything else compressed - ! into a single dimension. 'data_shape' then gives the true shape of the underlying - ! data, WITHOUT the underlying time dimension - ! - ! !USES: - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf 'file' into which we should add this variable - character(len=*) , intent(in) :: varname ! variable name - real(r8) , intent(in) :: data(:,:) ! the data (see notes above) - integer , intent(in) :: data_shape(:) ! true shape of the underlying data, WITHOUT the time dimension - ! - ! !LOCAL VARIABLES: - type(ncdio_var_type) :: newvar ! the new variable - type(ncdio_var_type), allocatable :: new_var_list(:) - - character(len=*), parameter :: subname = 'ncd_set_var' - !----------------------------------------------------------------------- - - ! If a variable with this name is already on the file, stop with an error message - call shr_assert(ncd_get_variable_index(ncid, varname) == var_not_found, & - subname//' ERROR: cannot set a variable already on file - '//trim(varname)) - - newvar = ncdio_var_type(varname, data, data_shape) - - ! Add newvar to the list. - ! - ! In theory, I think I should be able to do this, but it isn't working, at least with - ! the intel compiler v. 13 on yellowstone: - ! ncid%vars = [ncid%vars, newvar] - ! - ! Update: the above also doesn't work with intel v. 15 on hobart or intel v. 17 on - ! cheyenne. - ! - ! So I'm using an inefficient method, but that's okay for these purposes - allocate(new_var_list(size(ncid%vars) + 1)) - new_var_list(1:size(ncid%vars)) = ncid%vars(:) - new_var_list(size(ncid%vars)+1) = newvar - call move_alloc(new_var_list, ncid%vars) - - end subroutine ncd_set_var - - !----------------------------------------------------------------------- - subroutine ncd_set_dim(ncid, dimname, dimlen) - ! - ! !DESCRIPTION: - ! Set a single dimension on this netcdf 'file'. - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf 'file' into which we should add this dimension - character(len=*) , intent(in) :: dimname ! dimension name - integer , intent(in) :: dimlen ! dimension length - ! - ! !LOCAL VARIABLES: - type(ncdio_dim_type) :: newdim ! the new dimension - type(ncdio_dim_type), allocatable :: new_dim_list(:) - - character(len=*), parameter :: subname = 'ncd_set_dim' - !----------------------------------------------------------------------- - - ! If a dimension with this name is already on the file, stop with an error message - call shr_assert(ncd_get_dimension_index(ncid, dimname) == var_not_found, & - subname//' ERROR: cannot set a dimension already on file - '//trim(dimname)) - - newdim = ncdio_dim_type(dimname, dimlen) - - ! Add newdim to the list. - ! - ! See comment in ncd_set_var for why we use this more complex method. - allocate(new_dim_list(size(ncid%dims) + 1)) - new_dim_list(1:size(ncid%dims)) = ncid%dims(:) - new_dim_list(size(ncid%dims)+1) = newdim - call move_alloc(new_dim_list, ncid%dims) - - end subroutine ncd_set_dim - - - !----------------------------------------------------------------------- - subroutine ncd_reset_read_times(ncid, varname) - ! - ! !DESCRIPTION: - ! Reset the 'read_times' flag for a given variable. This provides a starting point - ! for a future call to ncd_get_read_times - i.e., if ncd_get_read_times were called - ! immediately after ncd_reset_read_times, it would always be false. - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf 'file' to operate on - character(len=*) , intent(in) :: varname ! variable name - ! - ! !LOCAL VARIABLES: - integer :: varindex ! index of variable of interest - - character(len=*), parameter :: subname = 'ncd_reset_read_times' - !----------------------------------------------------------------------- - - varindex = ncd_get_variable_index(ncid, varname) - - call shr_assert(varindex /= var_not_found, subname//' ERROR: could not find variable '//trim(varname)) - - call ncid%vars(varindex)%reset_read_times() - - end subroutine ncd_reset_read_times - - - !----------------------------------------------------------------------- - function ncd_get_read_times(ncid, varname) - ! - ! !DESCRIPTION: - ! Return the value of 'read_times' for all times. This tells you whether this variable - ! has been 'read' for each time index since the last call to reset_read_times (or - ! since initialization, if reset_read_times hasn't been called). - ! - ! !ARGUMENTS: - logical, allocatable :: ncd_get_read_times(:) ! function result - class(file_desc_t) , intent(in) :: ncid ! netcdf 'file' to operate on - character(len=*) , intent(in) :: varname ! variable name - ! - ! !LOCAL VARIABLES: - integer :: varindex ! index of variable of interest - - character(len=*), parameter :: subname = 'ncd_get_read_times' - !----------------------------------------------------------------------- - - varindex = ncd_get_variable_index(ncid, varname) - - call shr_assert(varindex /= var_not_found, subname//' ERROR: could not find variable '//trim(varname)) - - ncd_get_read_times = ncid%vars(varindex)%get_read_times() - - end function ncd_get_read_times - - - ! ====================================================================== - ! Private routines - ! ====================================================================== - - !----------------------------------------------------------------------- - integer function ncd_get_variable_index(ncid, varname) - ! Return the index of the variable whose name is 'varname' in the ncid structure. If - ! varname is not present, return var_not_found - class(file_desc_t), intent(in) :: ncid - character(len=*), intent(in) :: varname ! variable name to find - - integer :: index - logical :: found - - found = .false. - index = 0 - do while((index < size(ncid%vars)) .and. (.not. found)) - index = index + 1 - if (ncid%vars(index)%get_varname() == varname) then - found = .true. - end if - end do - - if (found) then - ncd_get_variable_index = index - else - ncd_get_variable_index = var_not_found - end if - end function ncd_get_variable_index - - !----------------------------------------------------------------------- - integer function ncd_get_dimension_index(ncid, dimname) - ! Return the index of the dimension whose name is 'dimname' in the ncid structure. If - ! dimname is not present, return var_not_found - class(file_desc_t), intent(in) :: ncid - character(len=*), intent(in) :: dimname ! dimension name to find - - integer :: index - logical :: found - - found = .false. - index = 0 - do while((index < size(ncid%dims)) .and. (.not. found)) - index = index + 1 - if (ncid%dims(index)%get_dimname() == dimname) then - found = .true. - end if - end do - - if (found) then - ncd_get_dimension_index = index - else - ncd_get_dimension_index = var_not_found - end if - end function ncd_get_dimension_index - -end module ncdio_pio diff --git a/src/unit_test_stubs/main/ncdio_var.F90.in b/src/unit_test_stubs/main/ncdio_var.F90.in deleted file mode 100644 index 31a509d724..0000000000 --- a/src/unit_test_stubs/main/ncdio_var.F90.in +++ /dev/null @@ -1,141 +0,0 @@ -module ncdio_var - ! This module is specific to using the ncdio_pio_fake version of ncdio_pio. This - ! provides a derived type for holding a single variable from a fake netcdf file, and - ! associated methods for working with this derived type. - - use shr_kind_mod, only : r8 => shr_kind_r8 - - ! Note that we use shr_assert directly rather than using the macros. This is so we don't - ! have to worry about whether or not NDEBUG is defined (we ALWAYS want to do these - ! assertions here). - use shr_assert_mod , only : shr_assert, shr_assert_all - - implicit none - private - save - - public :: ncdio_var_type - - integer, parameter, public :: max_name = 256 ! max length for a variable name - - ! This type stores a single variable in a fake file - type :: ncdio_var_type - private - - character(len=max_name) :: varname ! variable name - - integer :: ntimes ! number of time samples for this variable (length of second dimension) - - ! Second dimension is time, first is everything else. Regardless of the true - ! dimensionality of the underlying data, we compress all dimensions except time into - ! a single dimension, and then reshape it as needed. - real(r8), allocatable :: data(:,:) - - ! True shape of a single time slice of the data. This will have a single element if - ! the data are just spatial, two elements if the data have a space dimension plus a - ! single level dimension, etc. - integer, allocatable :: data_shape(:) - - ! This is a sensing variable, telling you which time indices have been "read" since - ! the last call to reset_read_times - logical, allocatable :: read_times(:) - - contains - generic, public :: get_data => & ! get the value of data for a single time - get_data_1d, get_data_2d - procedure :: get_varname ! get the variable name - procedure :: reset_read_times ! reset the "read_times" sensor variable - procedure :: get_read_times ! return the value of "read_times" for all times - - procedure, private :: get_data_1d - procedure, private :: get_data_2d - end type ncdio_var_type - - interface ncdio_var_type - module procedure constructor - end interface ncdio_var_type - -contains - - !----------------------------------------------------------------------- - type(ncdio_var_type) function constructor(varname, data, data_shape) - ! Create a new object of type ncdio_var_type - - character(len=*), intent(in) :: varname ! variable name - real(r8), intent(in) :: data(:,:) ! the data; 2nd dim is time, 1st is everything else compressed into a single dimension - integer, intent(in) :: data_shape(:) ! true shape of the underlying data, WITHOUT the time dimension - - character(len=*), parameter :: subname = 'ncdio_var_type constructor' - - call shr_assert(product(data_shape) == size(data, 1), subname//' product of data_shape must match length of 1st dim of data') - - constructor%varname = varname - - allocate(constructor%data(size(data,1), size(data,2))) - constructor%data = data - - allocate(constructor%data_shape(size(data_shape))) - constructor%data_shape = data_shape - - constructor%ntimes = size(data, 2) - - allocate(constructor%read_times(constructor%ntimes)) - call constructor%reset_read_times() - end function constructor - - !----------------------------------------------------------------------- - character(len=max_name) function get_varname(this) - ! Get the name associated with this variable - class(ncdio_var_type), intent(in) :: this - - get_varname = this%varname - end function get_varname - - - !----------------------------------------------------------------------- - subroutine reset_read_times(this) - ! Reset the 'read_times' variable. Any call to get_read_time will tell you whether a - ! given time slice has been read since the last call to reset_read_times - class(ncdio_var_type), intent(inout) :: this - - this%read_times(:) = .false. - end subroutine reset_read_times - - !----------------------------------------------------------------------- - function get_read_times(this) - ! Return the value of 'read_times' for all times. This tells you whether this variable - ! has been 'read' for each time index since the last call to reset_read_times (or - ! since initialization, if reset_read_times hasn't been called). - logical, allocatable :: get_read_times(:) - class(ncdio_var_type), intent(in) :: this - - character(len=*), parameter :: subname = 'get_read_times' - - get_read_times = this%read_times - end function get_read_times - - ! DIMS 1,2 - !----------------------------------------------------------------------- - subroutine get_data_{DIMS}d(this, nt, data) - ! Return the value of data at the given time. The output variable ('data') should - ! have the shape of true, underlying data (i.e., multi-dimensional if applicable) but - ! it should NOT have a time dimension because this subroutine returns the data for a - ! single time index - class(ncdio_var_type), intent(inout) :: this - integer, intent(in) :: nt ! time index of interest - real(r8), intent(out) :: data{DIMSTR} - - character(len=*), parameter :: subname = 'get_data_{DIMS}d' - - call shr_assert_all((shape(data) == this%data_shape), subname//' incorrect shape for data') - call shr_assert(1 <= nt .and. nt <= this%ntimes, subname//' nt out of bounds') - - data = reshape(this%data(:,nt), this%data_shape(1:{DIMS})) - - this%read_times(nt) = .true. - - end subroutine get_data_{DIMS}d - -end module ncdio_var - - diff --git a/src/unit_test_stubs/utils/CMakeLists.txt b/src/unit_test_stubs/utils/CMakeLists.txt deleted file mode 100644 index dc48aa9225..0000000000 --- a/src/unit_test_stubs/utils/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -set(genf90_files - restUtilMod_stub.F90.in - ) - -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) - -sourcelist_to_parent(clm_genf90_sources) - -list(APPEND clm_sources "${clm_genf90_sources}") - -list(APPEND clm_sources - restUtilMod_stub.F90 - spmdMod_stub.F90 - clmfates_paraminterfaceMod_stub.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/unit_test_stubs/utils/clmfates_paraminterfaceMod_stub.F90 b/src/unit_test_stubs/utils/clmfates_paraminterfaceMod_stub.F90 deleted file mode 100644 index 4dd580a986..0000000000 --- a/src/unit_test_stubs/utils/clmfates_paraminterfaceMod_stub.F90 +++ /dev/null @@ -1,11 +0,0 @@ -module CLMFatesParamInterfaceMod - - implicit none - - public :: FatesReadPfts - -contains - subroutine FatesReadPFTs() - implicit none - end subroutine FatesReadPFTs -end module CLMFatesParamInterfaceMod diff --git a/src/unit_test_stubs/utils/restUtilMod_stub.F90.in b/src/unit_test_stubs/utils/restUtilMod_stub.F90.in deleted file mode 100644 index ef3ec7e739..0000000000 --- a/src/unit_test_stubs/utils/restUtilMod_stub.F90.in +++ /dev/null @@ -1,150 +0,0 @@ -module restUtilMod - - ! This is a stub for restUtilMod. Currently all it does is provide empty - ! implementations for restartvar, to satisfy the interface that is expected throughout - ! the CLM code - - use shr_kind_mod, only: r8=>shr_kind_r8, r4 => shr_kind_r4, i4=>shr_kind_i4 - use ncdio_pio, only : file_desc_t - - implicit none - private - save - - interface restartvar - !DIMS 0,1,2 - !TYPE text,int,double - module procedure restartvar_{DIMS}d_{TYPE} - module procedure restartvar_2d_double_bounds - end interface restartvar - - public :: restartvar - - public :: set_missing_from_template - -contains - - !----------------------------------------------------------------------- - !DIMS 0 - !TYPE text,int,double - subroutine restartvar_{DIMS}d_{TYPE}(& - ncid, flag, varname, xtype, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - {VTYPE} , intent(inout) :: data{DIMSTR} - logical , intent(out) :: readvar ! was var read? - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - - readvar = .false. - - end subroutine restartvar_{DIMS}d_{TYPE} - - !----------------------------------------------------------------------- - !DIMS 1,2 - !TYPE text,int,double - subroutine restartvar_{DIMS}d_{TYPE}(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - {VTYPE} , pointer :: data{DIMSTR} - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - - end subroutine restartvar_{DIMS}d_{TYPE} - - !----------------------------------------------------------------------- - - subroutine restartvar_2d_double_bounds(ncid, flag, varname, xtype, & - dim1name, dim2name, switchdim, lowerb2, upperb2, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: dim1name ! dimension name - character(len=*) , intent(in) :: dim2name ! dimension name - logical , intent(in) :: switchdim - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - real(r8) , pointer :: data(:,:) ! raw data - logical , intent(out) :: readvar ! was var read? - integer , intent(in), optional :: lowerb2 - integer , intent(in), optional :: upperb2 - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - - readvar = .false. - - end subroutine restartvar_2d_double_bounds - - !----------------------------------------------------------------------- - subroutine set_missing_from_template(my_var, template_var, multiplier) - ! - ! !DESCRIPTION: - ! Set values of a missing restart field from a template field, with some constant - ! multiplier - ! - ! !USES: - use shr_infnan_mod, only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - real(r8), intent(out) :: my_var(:) - real(r8), intent(in) :: template_var(:) - real(r8), intent(in) :: multiplier - - my_var(:) = template_var(:) * multiplier - - end subroutine set_missing_from_template - -end module restUtilMod diff --git a/src/unit_test_stubs/utils/spmdMod_stub.F90 b/src/unit_test_stubs/utils/spmdMod_stub.F90 deleted file mode 100644 index c68862913d..0000000000 --- a/src/unit_test_stubs/utils/spmdMod_stub.F90 +++ /dev/null @@ -1,15 +0,0 @@ -module spmdMod - ! Stub of spmdMod - - implicit none - save - private - - logical, parameter, public :: masterproc = .true. - integer, parameter, public :: iam = 0 - integer, parameter, public :: mpicom = 0 - integer, parameter, public :: mpi_integer = 0 - integer, parameter, public :: mpi_logical = 0 - integer, parameter, public :: MPI_REAL8 = 1275070505 - -end module spmdMod diff --git a/src/utils/AnnualFluxDribbler.F90 b/src/utils/AnnualFluxDribbler.F90 deleted file mode 100644 index 600d9e5eb5..0000000000 --- a/src/utils/AnnualFluxDribbler.F90 +++ /dev/null @@ -1,615 +0,0 @@ -module AnnualFluxDribbler - -#include "shr_assert.h" - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! - ! Defines a class for handling fluxes that are generated once per year (e.g., due to - ! transient landcover changes that happen at the year boundary), but are meant to be - ! dribbled in evenly throughout the year. - ! - ! This assumes that the once-per-year fluxes are generated on the first timestep of the - ! year. Any flux given on the first timestep of the year is dribbled evenly for every - ! timestep of the coming year. Any flux given on other timesteps is applied entirely in - ! the current timestep. (Note that, if there is a combination of an annual flux and an - ! every-time-step flux, with both combined in the same delta term, then, on the first - ! timestep of the year, the every-time-step flux generated on that timestep will be - ! dribbled over the year rather than applied in that timestep.) - ! - ! NOTE(wjs, 2016-08-30) If we change the glc coupling time to be more frequent, then - ! we'll need to make this more dynamic: e.g., for coupling every 73 days (5 times per - ! year), we'd need to dribble fluxes over the next 73 days. - ! - ! Typical usage: - ! - ! - call mydribbler%set_curr_delta every time step - ! - ! This must be called every timestep, even if the delta is currently zero, in order - ! to zero out any existing stored delta. This can (and generally should) even be - ! called when it isn't the first timestep of the year. For deltas that are non-zero - ! at times other than the first timestep of the year, they will simply be passed on - ! to the output flux in get_curr_flux, making for easier handling by the client. - ! - ! - call mydribbler%get_curr_flux every time step, AFTER set_curr_delta - ! - ! This will get the current flux for this timestep, which is the sum of (1) the - ! dribbled flux from the last start-of-year timestep, and (2) the current timestep's - ! flux, based on the delta passed in to set_curr_delta in this timestep, if this is - ! not the start-of-year timestep. - ! - ! Alternatively, you can call mydribbler%get_dribbled_delta, if you need the result as - ! a delta over the time step rather than as a per-second flux. - ! - ! And, for the sake of checking conservation: - ! - ! - To get gridcell water (or whatever) content at the start of the time step: - ! - ! call mydribbler%get_amount_left_to_dribble_beg - ! - ! - To get gridcell water (or whatever) content at the end of the time step: - ! - ! call mydribbler%get_amount_left_to_dribble_end - ! - ! These both return the pseudo-state representing how much of the original delta - ! still needs to be dribbled. The 'beg' version includes the amount left to dribble - ! in the current time step; the 'end' version does not. - ! - ! - ! !USES: - use clm_varctl , only : iulog - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type, get_beg, get_end - use decompMod , only : BOUNDS_SUBGRID_GRIDCELL, BOUNDS_SUBGRID_PATCH - use clm_varcon , only : secspday, nameg, namep - use clm_time_manager , only : get_days_per_year, get_step_size_real, is_beg_curr_year - use clm_time_manager , only : get_curr_yearfrac, get_prev_yearfrac, get_prev_date - use clm_time_manager , only : is_first_step - ! - implicit none - private - - ! Compiler support for allocatable characters isn't fully robust (particularly for - ! pgi), so using a max lengths for now - ! - ! (If we used allocatable characters, these max lengths could be removed - integer, parameter :: name_maxlen = 128 - integer, parameter :: units_maxlen = 64 - integer, parameter :: subgrid_maxlen = 64 - - ! !PUBLIC TYPES: - - type, public :: annual_flux_dribbler_type - private - ! Metadata - character(len=name_maxlen) :: name - character(len=units_maxlen) :: units - - ! Whether this dribbler allows non-zero deltas on time steps other than the first - ! time step of the year - logical :: allows_non_annual_delta - - ! Which subgrid level this dribbler is operating at, stored in various ways - character(len=subgrid_maxlen) :: dim1name - character(len=subgrid_maxlen) :: name_subgrid - integer :: bounds_subgrid_level - - ! Annual amount to dribble in over the year - real(r8), pointer :: amount_to_dribble(:) - - ! Amount from the current timestep to pass through to the flux, if this isn't the - ! first timestep of the year - real(r8), pointer :: amount_from_this_timestep(:) - contains - ! Public infrastructure methods - procedure, public :: Restart - procedure, public :: Clean - - ! Public science methods - procedure, public :: set_curr_delta ! Set the delta state for this time step - procedure, public :: get_curr_flux ! Get the current flux for this time step - procedure, public :: get_dribbled_delta ! Similar to get_curr_flux, but gets result as a delta rather than a per-second flux - procedure, public :: get_amount_left_to_dribble_beg ! Get the pseudo-state representing the amount that still needs to be dribbled in this and future time steps - procedure, public :: get_amount_left_to_dribble_end ! Get the pseudo-state representing the amount that still needs to be dribbled in just future time steps - - ! Private methods - procedure, private :: allocate_and_initialize_data - procedure, private :: set_metadata - procedure, private :: get_amount_left_to_dribble - end type annual_flux_dribbler_type - - public :: annual_flux_dribbler_gridcell ! Creates an annual_flux_dribbler_type object at the gridcell-level - public :: annual_flux_dribbler_patch ! Creates an annual_flux_dribbler_type object at the patch-level - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ======================================================================== - ! Factory methods - ! - ! For now, there are only factory methods for gridcell-level and patch-level. But - ! adding the ability to work at other levels is as easy as adding another factory - ! method like this (along with some variables in the 'only' clauses of the 'use' - ! statements). - ! ======================================================================== - - !----------------------------------------------------------------------- - function annual_flux_dribbler_gridcell(bounds, name, units, allows_non_annual_delta) & - result(this) - ! - ! !DESCRIPTION: - ! Creates an annual_flux_dribbler_type object at the gridcell-level - ! - ! !USES: - ! - ! !ARGUMENTS: - type(annual_flux_dribbler_type) :: this ! function result - type(bounds_type), intent(in) :: bounds - character(len=*) , intent(in) :: name ! name of this object, used for i/o - character(len=*) , intent(in) :: units ! units metadata - should be state units, not flux (i.e., NOT per-second) - - ! If allows_non_annual_delta is .false., then an error check is performed for each - ! call to set_curr_delta, ensuring that the delta is 0 at all times other than the - ! first time step of the year. This is just provided as a convenient sanity check - - ! to ensure that the code is behaving as expected. (However, non-zero deltas are - ! always allowed on the first step of the run.) - ! - ! If allows_non_annual_delta is not provided, it is assumed to be .true. - logical, intent(in), optional :: allows_non_annual_delta - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'annual_flux_dribbler_gridcell' - !----------------------------------------------------------------------- - - this%dim1name = 'gridcell' - this%name_subgrid = nameg - this%bounds_subgrid_level = BOUNDS_SUBGRID_GRIDCELL - - call this%allocate_and_initialize_data(bounds) - call this%set_metadata(name, units, allows_non_annual_delta) - - end function annual_flux_dribbler_gridcell - - !----------------------------------------------------------------------- - function annual_flux_dribbler_patch(bounds, name, units, allows_non_annual_delta) & - result(this) - ! - ! !DESCRIPTION: - ! Creates an annual_flux_dribbler_type object at the patch-level - ! - ! !USES: - ! - ! !ARGUMENTS: - type(annual_flux_dribbler_type) :: this ! function result - type(bounds_type), intent(in) :: bounds - character(len=*) , intent(in) :: name ! name of this object, used for i/o - character(len=*) , intent(in) :: units ! units metadata - should be state units, not flux (i.e., NOT per-second) - - ! If allows_non_annual_delta is .false., then an error check is performed for each - ! call to set_curr_delta, ensuring that the delta is 0 at all times other than the - ! first time step of the year. This is just provided as a convenient sanity check - - ! to ensure that the code is behaving as expected. - ! - ! If allows_non_annual_delta is not provided, it is assumed to be .true. - logical, intent(in), optional :: allows_non_annual_delta - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'annual_flux_dribbler_patch' - !----------------------------------------------------------------------- - - this%dim1name = 'pft' - this%name_subgrid = namep - this%bounds_subgrid_level = BOUNDS_SUBGRID_PATCH - - call this%allocate_and_initialize_data(bounds) - call this%set_metadata(name, units, allows_non_annual_delta) - - end function annual_flux_dribbler_patch - - ! ======================================================================== - ! Public methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine set_curr_delta(this, bounds, delta) - ! - ! !DESCRIPTION: - ! Sets the delta state for this time step. Note that the delta is specified just as - ! the change in state - NOT as a flux (per-second) quantity. - ! - ! This must be called every timestep, even if the deltas are currently 0, in order to - ! zero out any existing stored delta. This can (and generally should) even be called - ! when it isn't the first timestep of the year. For deltas that are non-zero at times - ! other than the first timestep of the year, they will simply be passed on to the - ! output flux in get_curr_flux, making for easier handling by the client. (i.e., this - ! class handles the addition of the dribbled flux and the current flux for you.) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: delta( get_beg(bounds, this%bounds_subgrid_level) : ) - ! - ! !LOCAL VARIABLES: - integer :: beg_index, end_index - integer :: i - integer :: yr, mon, day, tod - - character(len=*), parameter :: subname = 'set_curr_delta' - !----------------------------------------------------------------------- - - beg_index = lbound(delta, 1) - end_index = get_end(bounds, this%bounds_subgrid_level) - SHR_ASSERT_ALL((ubound(delta) == (/end_index/)), errMsg(sourcefile, __LINE__)) - - if (is_beg_curr_year()) then - do i = beg_index, end_index - this%amount_to_dribble(i) = delta(i) - - ! On the first timestep of the year, we don't have any pass-through flux. Need - ! to zero out any previously-set amount_from_this_timestep. - this%amount_from_this_timestep(i) = 0._r8 - end do - else - do i = beg_index, end_index - this%amount_from_this_timestep(i) = delta(i) - end do - if (.not. this%allows_non_annual_delta .and. .not. is_first_step()) then - do i = beg_index, end_index - if (this%amount_from_this_timestep(i) /= 0._r8) then - write(iulog,*) subname//' ERROR: found unexpected non-zero delta mid-year' - write(iulog,*) 'Dribbler name: ', trim(this%name) - write(iulog,*) 'i, delta = ', i, this%amount_from_this_timestep(i) - call get_prev_date(yr, mon, day, tod) - write(iulog,*) 'Start of time step date (yr, mon, day, tod) = ', & - yr, mon, day, tod - write(iulog,*) 'This indicates that some non-zero flux was generated at a time step' - write(iulog,*) 'other than the first time step of the year, which this dribbler was told not to expect.' - write(iulog,*) 'If this non-zero mid-year delta is expected, then you can suppress this error' - write(iulog,*) 'by setting allows_non_annual_delta to .true. when constructing this dribbler.' - call endrun(decomp_index=i, clmlevel=this%name_subgrid, & - msg=subname//': found unexpected non-zero delta mid-year: ' // & - errMsg(sourcefile, __LINE__)) - end if - end do - end if - end if - - end subroutine set_curr_delta - - !----------------------------------------------------------------------- - subroutine get_curr_flux(this, bounds, flux) - ! - ! !DESCRIPTION: - ! Gets the current flux for this timestep, and stores it in the flux argument. - ! - ! This should be called AFTER set_curr_delta is called for the given timestep. - ! - ! This will get the current flux for this timestep, which is the sum of (1) the - ! dribbled flux from the last start-of-year timestep, and (2) the current timestep's - ! flux, based on the delta passed in to set_curr_delta in this timestep, if this is - ! not the start-of-year timestep. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(out) :: flux( get_beg(bounds, this%bounds_subgrid_level) : ) - ! - ! !LOCAL VARIABLES: - integer :: beg_index, end_index - integer :: i - real(r8) :: secs_per_year - real(r8) :: dtime - real(r8) :: flux_from_dribbling - real(r8) :: flux_from_this_timestep - - character(len=*), parameter :: subname = 'get_curr_flux' - !----------------------------------------------------------------------- - - beg_index = lbound(flux, 1) - end_index = get_end(bounds, this%bounds_subgrid_level) - SHR_ASSERT_ALL((ubound(flux) == (/end_index/)), errMsg(sourcefile, __LINE__)) - - secs_per_year = get_days_per_year() * secspday - dtime = get_step_size_real() - - do i = beg_index, end_index - flux_from_dribbling = this%amount_to_dribble(i) / secs_per_year - flux_from_this_timestep = this%amount_from_this_timestep(i) / dtime - flux(i) = flux_from_dribbling + flux_from_this_timestep - end do - - end subroutine get_curr_flux - - !----------------------------------------------------------------------- - subroutine get_dribbled_delta(this, bounds, delta) - ! - ! !DESCRIPTION: - ! Gets the current delta for this timestep, and stores it in the delta argument. - ! - ! This is similar to get_curr_flux, but returns the total, dribbled delta over this - ! timestep, rather than a per-second flux. See documentation in get_curr_flux for - ! more usage details. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(out) :: delta( get_beg(bounds, this%bounds_subgrid_level) : ) - ! - ! !LOCAL VARIABLES: - integer :: beg_index, end_index - integer :: i - real(r8) :: dtime - real(r8), allocatable :: flux(:) - - character(len=*), parameter :: subname = 'get_dribbled_delta' - !----------------------------------------------------------------------- - - beg_index = lbound(delta, 1) - end_index = get_end(bounds, this%bounds_subgrid_level) - SHR_ASSERT_ALL((ubound(delta) == (/end_index/)), errMsg(sourcefile, __LINE__)) - - allocate(flux(beg_index:end_index)) - - call this%get_curr_flux(bounds, flux(beg_index:end_index)) - - dtime = get_step_size_real() - do i = beg_index, end_index - delta(i) = flux(i) * dtime - end do - - end subroutine get_dribbled_delta - - - !----------------------------------------------------------------------- - subroutine get_amount_left_to_dribble_beg(this, bounds, amount_left_to_dribble) - ! - ! !DESCRIPTION: - ! Get the pseudo-state representing the amount that still needs to be dribbled in - ! this and future time steps. This represents the pseudo-state before this time - ! step's dribbling flux has been removed. (This behavior is regardless of whether - ! get_curr_flux has been called already this time step.) - ! - ! As a special case, this returns 0 in the first time step of the year, because we - ! haven't created this year's dribbling pool as of the beginning of this time step. - ! - ! i.e., if we imagined that the total amount to dribble was added to a state - ! variable, and then this state variable was updated each time step as the flux - ! dribbles out, then this subroutine gives the amount left in that state. (However, - ! the actual implementation doesn't explicitly track this state, which is why we - ! refer to it as a pseudo-state.) - ! - ! !USES: - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(out) :: amount_left_to_dribble( get_beg(bounds, this%bounds_subgrid_level) : ) - ! - ! !LOCAL VARIABLES: - real(r8) :: yearfrac - - character(len=*), parameter :: subname = 'get_amount_left_to_dribble_beg' - !----------------------------------------------------------------------- - - yearfrac = get_prev_yearfrac() - call this%get_amount_left_to_dribble(bounds, yearfrac, amount_left_to_dribble) - - end subroutine get_amount_left_to_dribble_beg - - - !----------------------------------------------------------------------- - subroutine get_amount_left_to_dribble_end(this, bounds, amount_left_to_dribble) - ! - ! !DESCRIPTION: - ! Gets the pseudo-state representing the amount that still needs to be dribbled in - ! future time steps. This represents the pseudo-state after this time step's dribbling - ! flux has been removed. i.e., this includes the amount that will be dribbled starting - ! with the *next* time step, through the end of this year. So this will return 0 on - ! the last time step of the year. (This behavior is regardless of whether - ! get_curr_flux has been called already this time step.) - ! - ! See documentation of get_amount_left_to_dribble_beg for more details. - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(out) :: amount_left_to_dribble( get_beg(bounds, this%bounds_subgrid_level) : ) - ! - ! !LOCAL VARIABLES: - real(r8) :: yearfrac - - character(len=*), parameter :: subname = 'get_amount_left_to_dribble_end' - !----------------------------------------------------------------------- - - yearfrac = get_curr_yearfrac() - call this%get_amount_left_to_dribble(bounds, yearfrac, amount_left_to_dribble) - - end subroutine get_amount_left_to_dribble_end - - - !----------------------------------------------------------------------- - subroutine Restart(this, bounds, ncid, flag) - ! - ! !USES: - use ncdio_pio, only : file_desc_t, ncd_double - use restUtilMod - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - ! - ! !LOCAL VARIABLES: - character(len=:), allocatable :: restname ! name of field on restart file - logical :: readvar - - character(len=*), parameter :: subname = 'Restart' - !----------------------------------------------------------------------- - - restname = trim(this%name) // '_amt_to_dribble' - call restartvar(ncid=ncid, flag=flag, varname=restname, xtype=ncd_double, & - dim1name = this%dim1name, & - long_name = 'total amount to dribble over the year for ' // trim(this%name), & - units = trim(this%units), & - interpinic_flag = 'interp', & - readvar = readvar, & - data = this%amount_to_dribble) - - end subroutine Restart - - !----------------------------------------------------------------------- - subroutine Clean(this) - ! - ! !DESCRIPTION: - ! Deallocate memory associated with this object - ! - ! !USES: - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(inout) :: this - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'Clean' - !----------------------------------------------------------------------- - - deallocate(this%amount_to_dribble) - deallocate(this%amount_from_this_timestep) - - end subroutine Clean - - ! ======================================================================== - ! Private methods - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine allocate_and_initialize_data(this, bounds) - ! - ! !DESCRIPTION: - ! Allocate arrays in this object and set them to initial values - ! - ! Assumes this%bounds_subgrid_level is already set - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds - ! - ! !LOCAL VARIABLES: - integer :: beg_index, end_index - - character(len=*), parameter :: subname = 'allocate_and_initialize_data' - !----------------------------------------------------------------------- - - beg_index = get_beg(bounds, this%bounds_subgrid_level) - end_index = get_end(bounds, this%bounds_subgrid_level) - - allocate(this%amount_to_dribble(beg_index:end_index)) - this%amount_to_dribble(beg_index:end_index) = 0._r8 - - allocate(this%amount_from_this_timestep(beg_index:end_index)) - this%amount_from_this_timestep(beg_index:end_index) = 0._r8 - - end subroutine allocate_and_initialize_data - - !----------------------------------------------------------------------- - subroutine set_metadata(this, name, units, allows_non_annual_delta) - ! - ! !DESCRIPTION: - ! Set metadata in this object - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(inout) :: this - character(len=*) , intent(in) :: name ! name of this object, used for i/o - character(len=*) , intent(in) :: units ! units metadata - should be state units, not flux (i.e., NOT per-second) - - ! If allows_non_annual_delta is .false., then an error check is performed for each - ! call to set_curr_delta, ensuring that the delta is 0 at all times other than the - ! first time step of the year. This is just provided as a convenient sanity check - - ! to ensure that the code is behaving as expected. - ! - ! If allows_non_annual_delta is not provided, it is assumed to be .true. - logical, intent(in), optional :: allows_non_annual_delta - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'set_metadata' - !----------------------------------------------------------------------- - - if (len_trim(name) > name_maxlen) then - write(iulog,*) subname // ': name too long' - write(iulog,*) trim(name) // ' exceeds max length: ', name_maxlen - call endrun(msg=subname // ': name too long: ' // & - errMsg(sourcefile, __LINE__)) - end if - this%name = trim(name) - - if (len_trim(units) > units_maxlen) then - write(iulog,*) subname // ': units too long' - write(iulog,*) trim(units) // ' exceeds max length: ', units_maxlen - call endrun(msg=subname // ': units too long: ' // & - errMsg(sourcefile, __LINE__)) - end if - this%units = trim(units) - - if (present(allows_non_annual_delta)) then - this%allows_non_annual_delta = allows_non_annual_delta - else - this%allows_non_annual_delta = .true. - end if - - end subroutine set_metadata - - !----------------------------------------------------------------------- - subroutine get_amount_left_to_dribble(this, bounds, yearfrac, amount_left_to_dribble) - ! - ! !DESCRIPTION: - ! Helper method shared by get_amount_left_to_dribble_beg and - ! get_amount_left_to_dribble_end. Returns amount left to dribble as of a given - ! yearfrac. - ! - ! !USES: - ! - ! !ARGUMENTS: - class(annual_flux_dribbler_type), intent(in) :: this - type(bounds_type), intent(in) :: bounds - real(r8), intent(in) :: yearfrac - real(r8), intent(out) :: amount_left_to_dribble( get_beg(bounds, this%bounds_subgrid_level) : ) - ! - ! !LOCAL VARIABLES: - integer :: beg_index, end_index - integer :: i - - character(len=*), parameter :: subname = 'get_amount_left_to_dribble' - !----------------------------------------------------------------------- - - beg_index = lbound(amount_left_to_dribble, 1) - end_index = get_end(bounds, this%bounds_subgrid_level) - SHR_ASSERT_ALL((ubound(amount_left_to_dribble) == (/end_index/)), errMsg(sourcefile, __LINE__)) - - do i = beg_index, end_index - if (yearfrac < 1.e-15_r8) then - ! last time step of year; we'd like this to be given a yearfrac of 1 rather than - ! 0 in this case; since it's given as 0, we need to handle it specially - amount_left_to_dribble(i) = 0._r8 - else - amount_left_to_dribble(i) = this%amount_to_dribble(i) * (1._r8 - yearfrac) - end if - end do - - end subroutine get_amount_left_to_dribble - - -end module AnnualFluxDribbler diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt deleted file mode 100644 index a1b8b61d72..0000000000 --- a/src/utils/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -set(genf90_files - array_utils.F90.in - ) - -process_genf90_source_list("${genf90_files}" ${CMAKE_CURRENT_SOURCE_DIR} clm_genf90_sources) - -sourcelist_to_parent(clm_genf90_sources) - -list(APPEND clm_sources "${clm_genf90_sources}") - -list(APPEND clm_sources - AnnualFluxDribbler.F90 - domainMod.F90 - clm_nlUtilsMod.F90 - clm_time_manager.F90 - quadraticMod.F90 - fileutils.F90 - ) - -sourcelist_to_parent(clm_sources) diff --git a/src/utils/SimpleMathMod.F90 b/src/utils/SimpleMathMod.F90 deleted file mode 100644 index 0727057845..0000000000 --- a/src/utils/SimpleMathMod.F90 +++ /dev/null @@ -1,230 +0,0 @@ -module SimpleMathMod - -#include "shr_assert.h" - !------------------------------------------------------------------------------ - ! - ! DESCRIPTIONS: - ! module contains simple mathematical functions for arrays - ! Created by Jinyun Tang, Feb., 2014 - -implicit none - - interface array_normalization - module procedure array_normalization_2d, array_normalization_2d_filter - end interface array_normalization - - interface array_div_vector - module procedure array_div_vector_filter, array_div_vector_nofilter - end interface array_div_vector - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains -!-------------------------------------------------------------------------------- - subroutine array_normalization_2d(which_dim, arr2d_inout) - ! - !DESCRIPTIONS - !do normalization for the input array along dimension which_dim - ! - !USES - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - - integer, intent(in) :: which_dim !do normalization along which dimension? - real(r8), intent(inout) :: arr2d_inout(:,:) !input 2d array - - - !local variables - integer :: sz1, sz2 !array size - integer :: j1, j2 !indices - real(r8) :: arr_sum - - sz1 = size(arr2d_inout,1) - sz2 = size(arr2d_inout,2) - - if(which_dim==1)then - !normalize along dimension 1, so loop along dimension 2 - do j2 = 1, sz2 - !obtain the total - arr_sum=0._r8 - do j1 = 1, sz1 - arr_sum=arr_sum+arr2d_inout(j1,j2) - enddo - !normalize with the total if arr_sum is non-zero - if(arr_sum/=0._r8)then - do j1 = 1, sz1 - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr_sum - enddo - endif - enddo - elseif(which_dim==2)then - !normalize along dimension 2, so loop along dimension 1 - do j1 = 1, sz1 - !obtain the total - arr_sum=0._r8 - do j2 = 1, sz2 - arr_sum=arr_sum+arr2d_inout(j1,j2) - enddo - !normalize with the total if arr_sum is non-zero - !I think there should be a safer mask for this to screen off spval values - !Jinyun Tang, May 30, 2014 - if(arr_sum>0._r8 .or. arr_sum < 0._r8)then - do j2 = 1, sz2 - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr_sum - enddo - endif - enddo - endif - return - end subroutine array_normalization_2d - -!-------------------------------------------------------------------------------- - subroutine array_normalization_2d_filter(lbj1, ubj1, lbj2, ubj2, numf, filter, arr2d_inout) - ! - !DESCRIPTIONS - !do normalization with filter for the input array along dimension 2 - - ! - !USES - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - implicit none - integer, intent(in) :: lbj1 !left bound of dim 1 - integer, intent(in) :: lbj2 !left bound of dim 2 - integer, intent(in) :: ubj1 !right bound of dim 1 - integer, intent(in) :: ubj2 !right bound of dim 2 - integer, intent(in) :: numf !filter size - integer, intent(in) :: filter(:) !filter - real(r8), intent(inout) :: arr2d_inout(lbj1: , lbj2: ) !input 2d array - - - !local variables - integer :: sz1, sz2 !array size - integer :: j2 !indices - integer :: f, p !indices - real(r8) :: arr_sum(lbj1:ubj1) - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(arr2d_inout) == (/ubj1, ubj2/)), errMsg(sourcefile, __LINE__)) - - - arr_sum(:) = 0._r8 - do j2 = lbj2, ubj2 - do f = 1, numf - p = filter(f) - !obtain the total - arr_sum(p)=arr_sum(p)+arr2d_inout(p,j2) - enddo - enddo - - !normalize with the total if arr_sum is non-zero - do j2 = lbj2, ubj2 - do f = 1, numf - p = filter(f) - !I found I have to ensure >0._r8 because of some unknown reason, jyt May 23, 2014 - !I will test this later with arr_sum(p)/=0._r8 - if(arr_sum(p)>0._r8 .or. arr_sum(p)<0._r8)then - arr2d_inout(p,j2) = arr2d_inout(p,j2)/arr_sum(p) - endif - enddo - enddo - return - end subroutine array_normalization_2d_filter -!-------------------------------------------------------------------------------- - - subroutine array_div_vector_filter(lbj1, ubj1, lbj2, ubj2, & - arr1d_in, fn, filter, arr2d_inout) - ! - !DESCRIPTIONS - !array divided by a vector, arr2d_in is divided by one - !element in arr1d_in - !It always assumes the filter is along with dimenion 1 - ! - ! USES - ! - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - implicit none - integer, intent(in) :: lbj1 !left bound of dim 1 - integer, intent(in) :: lbj2 !left bound of dim 2 - integer, intent(in) :: ubj1 !right bound of dim 1 - integer, intent(in) :: ubj2 !right bound of dim 2 - real(r8), intent(in) :: arr1d_in(lbj1: ) !1d scaling factor - integer , intent(in) :: fn - integer , intent(in) :: filter(:) !filter - real(r8), intent(inout) :: arr2d_inout(lbj1: ,lbj2: ) !2d array to be scaled - - integer :: sz - integer :: j, f, p - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(arr2d_inout) == (/ubj1, ubj2/)), errMsg(sourcefile, __LINE__)) - SHR_ASSERT_ALL((ubound(arr1d_in) == (/ubj1/)), errMsg(sourcefile, __LINE__)) - - - do j = lbj2, ubj2 - do f = 1, fn - p = filter(f) - if (arr1d_in(p) > 0._r8 .or. arr1d_in(p) < 0._r8) then - arr2d_inout(p,j) = arr2d_inout(p,j)/arr1d_in(p) - else - arr2d_inout(p,j) = 0._r8 - end if - end do - end do - return - end subroutine array_div_vector_filter - -!-------------------------------------------------------------------------------- - - subroutine array_div_vector_nofilter(arr1d_in, which_dim, arr2d_inout) - ! - !DESCRIPTIONS - !array divided by a vector, each row in arr2d_in is divided by one - !element in arr1d_in - ! - !USES - ! - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - implicit none - real(r8), intent(in) :: arr1d_in(:) !scaling factor - integer, intent(in) :: which_dim !which dimension is scaled - real(r8), intent(inout) :: arr2d_inout(:,:) !2d array to be scaled - - integer :: sz1, sz2 - integer :: j1, j2 - - sz1=size(arr2d_inout,1) - sz2=size(arr2d_inout,2) - - if(which_dim==1)then - ! Enforce expected array sizes - call shr_assert(sz1 == size(arr1d_in), errMsg(sourcefile, __LINE__)) - - do j2 = 1, sz2 - do j1 = 1, sz1 - if(arr1d_in(j1)>0._r8)then - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr1d_in(j1) - endif - enddo - enddo - else - ! Enforce expected array sizes - call shr_assert(sz2 == size(arr1d_in), errMsg(sourcefile, __LINE__)) - - do j2 = 1, sz2 - do j1 = 1, sz1 - if(arr1d_in(j2)>0._r8 .or. arr1d_in(j2)<0._r8)then - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr1d_in(j2) - endif - enddo - enddo - - endif - return - end subroutine array_div_vector_nofilter - -end module SimpleMathMod diff --git a/src/utils/array_utils.F90.in b/src/utils/array_utils.F90.in deleted file mode 100644 index 78a237aaae..0000000000 --- a/src/utils/array_utils.F90.in +++ /dev/null @@ -1,99 +0,0 @@ -module array_utils - - ! ------------------------------------------------------------------------ - ! !DESCRIPTION: - ! This module contains routines for working with arrays. - ! - ! NOTE(wjs, 2015-10-21) These routines could be moved to csm_share. However, I'm not - ! sure if these routines will stick around for long, since they are just here to work - ! around the fact that we don't specify -Mallocatable=03 with pgi (which in turn is - ! because that flag led to bugs with pgi14). - ! - ! !USES: - - use shr_kind_mod, only : r8 => shr_kind_r8, i4=>shr_kind_i4 - - implicit none - private - save - - ! Public routines - - public :: transpose_wrapper ! wrap the intrinsic transpose function, first allocating the destination array - public :: pack_wrapper ! wrap the intrinsic pack function, first allocating the destination array - - interface transpose_wrapper - !TYPE int,double - module procedure transpose_wrapper_{TYPE} - end interface transpose_wrapper - -contains - - !----------------------------------------------------------------------- - !TYPE int,double - subroutine transpose_wrapper_{TYPE}(arr_out, arr_in) - ! - ! !DESCRIPTION: - ! Wrap the intrinsic transpose function, doing the necessary allocation of the - ! destination array - ! - ! NOTE(wjs, 2015-10-21) This is supposed to be handled for you in Fortran2003. Within - ! CESM, it currently appears to be handled for all compilers except pgi: It is - ! handled with intel through the use of '-assume realloc_lhs'. It could be handled - ! with pgi through the use of '-Mallocatable=03', but we currently don't use that - ! flag, because it triggered bugs with pgi14. - ! - ! !USES: - ! - ! !ARGUMENTS: - {VTYPE}, allocatable, intent(out) :: arr_out(:,:) - {VTYPE}, intent(in) :: arr_in(:,:) - ! - ! !LOCAL VARIABLES: - integer :: size1, size2 - - character(len=*), parameter :: subname = 'transpose_wrapper_{TYPE}' - !----------------------------------------------------------------------- - - size1 = size(arr_in, 1) - size2 = size(arr_in, 2) - allocate(arr_out(size2, size1)) - - arr_out = transpose(arr_in) - - end subroutine transpose_wrapper_{TYPE} - - !----------------------------------------------------------------------- - subroutine pack_wrapper(arr_packed, arr, mask) - ! - ! !DESCRIPTION: - ! Wrap the intrinsic pack function, doing the necessary allocation of the destination - ! array. - ! - ! NOTE(wjs, 2015-10-21) This is supposed to be handled for you in Fortran2003. Within - ! CESM, it currently appears to be handled for all compilers except pgi: It is - ! handled with intel through the use of '-assume realloc_lhs'. It could be handled - ! with pgi through the use of '-Mallocatable=03', but we currently don't use that - ! flag, because it triggered bugs with pgi14. - ! - ! !USES: - ! - ! !ARGUMENTS: - real(r8), allocatable, intent(out) :: arr_packed(:) - real(r8), intent(in) :: arr(:) - logical , intent(in) :: mask(:) - ! - ! !LOCAL VARIABLES: - integer :: packed_size - - character(len=*), parameter :: subname = 'pack_wrapper' - !----------------------------------------------------------------------- - - packed_size = count(mask) - allocate(arr_packed(packed_size)) - arr_packed = pack(arr, mask) - - end subroutine pack_wrapper - -end module array_utils - diff --git a/src/utils/clm_nlUtilsMod.F90 b/src/utils/clm_nlUtilsMod.F90 deleted file mode 100644 index 68536bd1fb..0000000000 --- a/src/utils/clm_nlUtilsMod.F90 +++ /dev/null @@ -1,116 +0,0 @@ -module clm_nlUtilsMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_nltUtilsMod -! -! !DESCRIPTION: -! Utilities to handle namelists. -! -! !USES: - -! !PUBLIC TYPES: - implicit none - save - - private ! By default everything is private - -! !PUBLIC MEMBER FUNCTIONS: - public :: find_nlgroup_name ! find a specified namelist group in a file -! -! !REVISION HISTORY: -! Created by B. Eaton -! Move to CLM by E. Kluzek -! -! !PRIVATE MEMBER FUNCTIONS: None -!----------------------------------------------------------------------- -! !PRIVATE DATA MEMBERS: None - -!EOP -!----------------------------------------------------------------------- -contains - -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: find_nlgroup_name -! -! !INTERFACE: - subroutine find_nlgroup_name(unit, group, status) -! -! !DESCRIPTION: -! Search a file that contains namelist input for the specified namelist group name. -! Leave the file positioned so that the current record is the first record of the -! input for the specified group. -! -! METHOD: -! Read the file line by line. Each line is searched for an '&' which may only -! be preceded by blanks, immediately followed by the group name which is case -! insensitive. If found then backspace the file so the current record is the -! one containing the group name and return success. Otherwise return -1. -! -! !USES: - use shr_kind_mod , only : CS => shr_kind_cs - use shr_string_mod, only : shr_string_toLower -! -! !ARGUMENTS: - integer, intent(in) :: unit ! fortran unit attached to file - character(len=*), intent(in) :: group ! namelist group name - integer, intent(out) :: status ! 0 for success, -1 if group name not found -! -! !REVISION HISTORY: -! Created by B. Eaton, August 2007 -! Move to CLM E. Kluzek, August 2012 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: len_grp ! length of the groupname - integer :: ios ! io status - character(len=CS) :: inrec ! first shr_kind_CS characters of input record - character(len=CS) :: inrec2 ! left adjusted input record - character(len=len(group)) :: lc_group ! lower-case group name - character(len=32) :: subname = 'find_nlgroup_name' ! subroutine name -!----------------------------------------------------------------------- - len_grp = len_trim(group) - lc_group = shr_string_toLower(group) - - ios = 0 - do while (ios <= 0) - - read(unit, '(a)', iostat=ios, end=100) inrec - - if (ios <= 0) then ! ios < 0 indicates an end of record condition - - ! look for group name in this record - - ! remove leading blanks - inrec2 = adjustl(inrec) - - ! check for leading '&' - if (inrec2(1:1) == '&') then - - ! check for case insensitive group name - if (trim(lc_group) == shr_string_toLower(inrec2(2:len_grp+1))) then - - ! found group name. backspace to leave file position at this record - backspace(unit) - status = 0 - return - - end if - end if - end if - - end do - - 100 continue ! end of file processing - status = -1 - -end subroutine find_nlgroup_name - -!----------------------------------------------------------------------- - -end module clm_nlUtilsMod diff --git a/src/utils/clm_time_manager.F90 b/src/utils/clm_time_manager.F90 deleted file mode 100644 index ec62c9f071..0000000000 --- a/src/utils/clm_time_manager.F90 +++ /dev/null @@ -1,1956 +0,0 @@ -module clm_time_manager - - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_sys_mod , only: shr_sys_abort - use spmdMod , only: masterproc - use clm_varctl , only: iulog - use clm_varcon , only: isecspday - use ESMF - - implicit none - private - - ! Public methods - - public ::& - get_timemgr_defaults, &! get startup default values - set_timemgr_init, &! setup startup values - timemgr_init, &! time manager initialization - timemgr_restart_io, &! read/write time manager restart info and restart time manager - timemgr_restart, &! restart the time manager using info from timemgr_restart - timemgr_datediff, &! calculate difference between two time instants - advance_timestep, &! increment timestep number - get_clock, &! get the clock from the time-manager - get_curr_ESMF_Time, &! get current time in terms of the ESMF_Time - get_step_size, &! return step size in seconds - get_step_size_real, &! return step size in seconds, real-valued - get_rad_step_size, &! return radiation step size in seconds - get_nstep, &! return timestep number - get_nstep_since_startup_or_lastDA_restart_or_pause, &! return number of timesteps since restart was modified - get_curr_date, &! return date components at end of current timestep - get_prev_date, &! return date components at beginning of current timestep - get_start_date, &! return components of the start date - get_driver_start_ymd, &! return year/month/day (as integer in YYYYMMDD format) of driver start date - get_ref_date, &! return components of the reference date - get_perp_date, &! return components of the perpetual date, and current time of day - get_curr_time, &! return components of elapsed time since reference date at end of current timestep - get_prev_time, &! return components of elapsed time since reference date at beg of current timestep - get_curr_calday, &! return calendar day at end of current timestep - get_calday, &! return calendar day from input date - get_calendar, &! return calendar - get_days_per_year, &! return the days per year for current year - get_curr_yearfrac, &! return the fractional position in the current year, as of the end of the current timestep - get_prev_yearfrac, &! return the fractional position in the current year, as of the beginning of the current timestep - get_rest_date, &! return the date from the restart file - set_nextsw_cday, &! set the next radiation calendar day - is_first_step, &! return true on first step of initial run - is_first_restart_step, &! return true on first step of restart or branch run - is_first_step_of_this_run_segment, &! return true on first step of any run segment (initial, restart or branch run) - is_beg_curr_day, &! return true on first timestep in current day - is_end_curr_day, &! return true on last timestep in current day - is_end_curr_month, &! return true on last timestep in current month - is_beg_curr_year, &! return true on first timestep in current year - is_end_curr_year, &! return true on last timestep in current year - is_last_step, &! return true on last timestep - is_perpetual, &! return true if perpetual calendar is in use - is_restart, &! return true if this is a restart run - update_rad_dtime, &! track radiation interval via nstep - update_DA_nstep, &! update the Data Assimulation time step - timemgr_reset ! reset values to their defaults, and free memory - - ! Public methods, but just to support unit testing: - public :: for_test_set_curr_date ! set the current date and time - - ! Public parameter data - character(len=*), public, parameter :: NO_LEAP_C = 'NO_LEAP' - character(len=*), public, parameter :: GREGORIAN_C = 'GREGORIAN' - - ! Private module data - - ! Private data for input - - character(len=ESMF_MAXSTR), save ::& - calendar = NO_LEAP_C ! Calendar to use in date calculations. - integer, parameter :: uninit_int = -999999999 - real(r8), parameter :: uninit_r8 = -999999999.0 - - ! Input - integer, save ::& - dtime = uninit_int, &! timestep in seconds - dtime_rad = uninit_int, &! radiation interval in seconds - nstep_rad_prev = uninit_int ! radiation interval in seconds - - ! Input from CESM driver - integer, save ::& - nelapse = uninit_int, &! number of timesteps (or days if negative) to extend a run - start_ymd = uninit_int, &! starting date for run in yearmmdd format - start_tod = 0, &! starting time of day for run in seconds - stop_ymd = uninit_int, &! stopping date for run in yearmmdd format - stop_tod = 0, &! stopping time of day for run in seconds - ref_ymd = uninit_int, &! reference date for time coordinate in yearmmdd format - ref_tod = 0 ! reference time of day for time coordinate in seconds - type(ESMF_Calendar), target, save :: tm_cal ! calendar - type(ESMF_Clock), save :: tm_clock ! model clock - type(ESMF_Time), save :: tm_perp_date ! perpetual date - - ! Data required to restart time manager: - integer, save :: rst_step_sec = uninit_int ! timestep size seconds - integer, save :: rst_start_ymd = uninit_int ! start date - integer, save :: rst_start_tod = uninit_int ! start time of day - integer, save :: rst_ref_ymd = uninit_int ! reference date - integer, save :: rst_ref_tod = uninit_int ! reference time of day - integer, save :: rst_curr_ymd = uninit_int ! current date - integer, save :: rst_curr_tod = uninit_int ! current time of day - - integer, save :: rst_nstep_rad_prev ! nstep of previous radiation call - integer, save :: perpetual_ymd = uninit_int ! Perpetual calendar date (YYYYMMDD) - logical, save :: tm_first_restart_step = .false. ! true for first step of a restart or branch run - logical, save :: tm_perp_calendar = .false. ! true when using perpetual calendar - logical, save :: timemgr_set = .false. ! true when timemgr initialized - integer, save :: nestep = uninit_int ! ending time-step - ! - ! Next short-wave radiation calendar day - ! - real(r8) :: nextsw_cday = uninit_r8 ! calday from clock of next radiation computation - - ! - ! The time-step number of startup or last Data Assimulation (DA) restart or pause - integer, save :: DA_nstep = 0 ! Last step number that state was modified externally (by DA) - - ! Private module methods - - private :: timemgr_spmdbcast - private :: init_calendar - private :: init_clock - private :: calc_nestep - private :: timemgr_print - private :: TimeGetymd - private :: check_timemgr_initialized - - !========================================================================================= -contains - !========================================================================================= - - subroutine get_timemgr_defaults( calendar_out, start_ymd_out, start_tod_out, ref_ymd_out, & - ref_tod_out, stop_ymd_out, stop_tod_out, nelapse_out, & - dtime_out ) - - !--------------------------------------------------------------------------------- - ! get time manager startup default values - ! - ! Arguments - character(len=*), optional, intent(OUT) :: calendar_out ! Calendar type - integer , optional, intent(OUT) :: nelapse_out ! Number of step (or days) to advance - integer , optional, intent(OUT) :: start_ymd_out ! Start date (YYYYMMDD) - integer , optional, intent(OUT) :: start_tod_out ! Start time of day (sec) - integer , optional, intent(OUT) :: ref_ymd_out ! Reference date (YYYYMMDD) - integer , optional, intent(OUT) :: ref_tod_out ! Reference time of day (sec) - integer , optional, intent(OUT) :: stop_ymd_out ! Stop date (YYYYMMDD) - integer , optional, intent(OUT) :: stop_tod_out ! Stop time of day (sec) - integer , optional, intent(OUT) :: dtime_out ! Time-step (sec) - ! - character(len=*), parameter :: sub = 'clm::get_timemgr_defaults' - - if ( timemgr_set ) call shr_sys_abort( sub//":: timemgr_init or timemgr_restart already called" ) - if (present(calendar_out) ) calendar_out = trim(calendar) - if (present(start_ymd_out) ) start_ymd_out = start_ymd - if (present(start_tod_out) ) start_tod_out = start_tod - if (present(ref_ymd_out) ) ref_ymd_out = ref_ymd - if (present(ref_tod_out) ) ref_tod_out = ref_tod - if (present(stop_ymd_out) ) stop_ymd_out = stop_ymd - if (present(stop_tod_out) ) stop_tod_out = stop_tod - if (present(nelapse_out) ) nelapse_out = nelapse - if (present(dtime_out) ) dtime_out = dtime - - end subroutine get_timemgr_defaults - - !========================================================================================= - - subroutine set_timemgr_init( calendar_in, start_ymd_in, start_tod_in, ref_ymd_in, & - ref_tod_in, stop_ymd_in, stop_tod_in, perpetual_run_in, & - perpetual_ymd_in, nelapse_in, dtime_in ) - - !--------------------------------------------------------------------------------- - ! set time manager startup values - ! - ! Arguments - character(len=*), optional, intent(IN) :: calendar_in ! Calendar type - integer , optional, intent(IN) :: nelapse_in ! Number of step (or days) to advance - integer , optional, intent(IN) :: start_ymd_in ! Start date (YYYYMMDD) - integer , optional, intent(IN) :: start_tod_in ! Start time of day (sec) - integer , optional, intent(IN) :: ref_ymd_in ! Reference date (YYYYMMDD) - integer , optional, intent(IN) :: ref_tod_in ! Reference time of day (sec) - integer , optional, intent(IN) :: stop_ymd_in ! Stop date (YYYYMMDD) - integer , optional, intent(IN) :: stop_tod_in ! Stop time of day (sec) - logical , optional, intent(IN) :: perpetual_run_in ! If in perpetual mode or not - integer , optional, intent(IN) :: perpetual_ymd_in ! Perpetual date (YYYYMMDD) - integer , optional, intent(IN) :: dtime_in ! Time-step (sec) - ! - character(len=*), parameter :: sub = 'clm::set_timemgr_init' - - if ( timemgr_set ) call shr_sys_abort( sub//":: timemgr_init or timemgr_restart already called" ) - if (present(calendar_in) ) calendar = trim(calendar_in) - if (present(start_ymd_in) ) start_ymd = start_ymd_in - if (present(start_tod_in) ) start_tod = start_tod_in - if (present(ref_ymd_in) ) ref_ymd = ref_ymd_in - if (present(ref_tod_in) ) ref_tod = ref_tod_in - if (present(stop_ymd_in) ) stop_ymd = stop_ymd_in - if (present(stop_tod_in) ) stop_tod = stop_tod_in - if (present(perpetual_run_in) )then - tm_perp_calendar = perpetual_run_in - if ( tm_perp_calendar ) then - if ( .not. present(perpetual_ymd_in) .or. perpetual_ymd == uninit_int) & - call shr_sys_abort( sub//":: perpetual_run set but NOT perpetual_ymd" ) - perpetual_ymd = perpetual_ymd_in - end if - end if - if (present(nelapse_in) ) nelapse = nelapse_in - if (present(dtime_in) ) dtime = dtime_in - - end subroutine set_timemgr_init - - !========================================================================================= - - subroutine timemgr_init( ) - - !--------------------------------------------------------------------------------- - ! Initialize the ESMF time manager from the sync clock - ! - ! Arguments - ! - character(len=*), parameter :: sub = 'clm::timemgr_init' - integer :: rc ! return code - integer :: yr, mon, day, tod ! Year, month, day, and second as integers - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: curr_date ! temporary date used in logic - type(ESMF_Time) :: ref_date ! reference date for time coordinate - logical :: run_length_specified = .false. - type(ESMF_Time) :: current ! current date (from clock) - type(ESMF_TimeInterval) :: day_step_size ! day step size - type(ESMF_TimeInterval) :: step_size ! timestep size - !--------------------------------------------------------------------------------- - call timemgr_spmdbcast( ) - - ! Initalize calendar - - call init_calendar() - - ! Initalize start date. - - if ( start_ymd == uninit_int ) then - write(iulog,*)sub,': start_ymd must be specified ' - call shr_sys_abort - end if - if ( start_tod == uninit_int ) then - write(iulog,*)sub,': start_tod must be specified ' - call shr_sys_abort - end if - start_date = TimeSetymd( start_ymd, start_tod, "start_date" ) - - ! Initialize current date - - curr_date = start_date - - ! Initalize stop date. - - stop_date = TimeSetymd( 99991231, stop_tod, "stop_date" ) - - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') - - call ESMF_TimeIntervalSet( day_step_size, d=1, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting day_step_size') - - if ( stop_ymd /= uninit_int ) then - current = TimeSetymd( stop_ymd, stop_tod, "stop_date" ) - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( nelapse /= uninit_int ) then - if ( nelapse >= 0 ) then - current = curr_date + step_size*nelapse - else - current = curr_date - day_step_size*nelapse - end if - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( .not. run_length_specified ) then - call shr_sys_abort (sub//': Must specify stop_ymd or nelapse') - end if - - ! Error check - - if ( stop_date <= start_date ) then - write(iulog,*)sub, ': stop date must be specified later than start date: ' - call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - if ( curr_date >= stop_date ) then - write(iulog,*)sub, ': stop date must be specified later than current date: ' - call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - - ! Initalize reference date for time coordinate. - - if ( ref_ymd /= uninit_int ) then - ref_date = TimeSetymd( ref_ymd, ref_tod, "ref_date" ) - else - ref_date = start_date - end if - - ! Initialize clock - - call init_clock( start_date, ref_date, curr_date, stop_date ) - - ! Initialize date used for perpetual calendar day calculation. - - if (tm_perp_calendar) then - tm_perp_date = TimeSetymd( perpetual_ymd, 0, "tm_perp_date" ) - end if - - ! Print configuration summary to log file (stdout). - - if (masterproc) call timemgr_print() - - timemgr_set = .true. - - end subroutine timemgr_init - - !========================================================================================= - - subroutine init_clock( start_date, ref_date, curr_date, stop_date ) - - !--------------------------------------------------------------------------------- - ! Purpose: Initialize the clock based on the start_date, ref_date, and curr_date - ! as well as the settings from the namelist specifying the time to stop - ! - type(ESMF_Time), intent(in) :: start_date ! start date for run - type(ESMF_Time), intent(in) :: ref_date ! reference date for time coordinate - type(ESMF_Time), intent(in) :: curr_date ! current date (equal to start_date) - type(ESMF_Time), intent(in) :: stop_date ! stop date for run - ! - character(len=*), parameter :: sub = 'clm::init_clock' - type(ESMF_TimeInterval) :: step_size ! timestep size - type(ESMF_Time) :: current ! current date (from clock) - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') - - ! Initialize the clock - - tm_clock = ESMF_ClockCreate(name="CLM Time-manager clock", timeStep=step_size, startTime=start_date, & - stopTime=stop_date, refTime=ref_date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockSetup') - - ! Advance clock to the current time (in case of a restart) - - call ESMF_ClockGet(tm_clock, currTime=current, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - do while( curr_date > current ) - call ESMF_ClockAdvance( tm_clock, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockAdvance') - call ESMF_ClockGet(tm_clock, currTime=current ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - end do - end subroutine init_clock - - !========================================================================================= - - function TimeSetymd( ymd, tod, desc ) - !--------------------------------------------------------------------------------- - ! - ! Set the time by an integer as YYYYMMDD and integer seconds in the day - ! - integer, intent(in) :: ymd ! Year, month, day YYYYMMDD - integer, intent(in) :: tod ! Time of day in seconds - character(len=*), intent(in) :: desc ! Description of time to set - - type(ESMF_Time) :: TimeSetymd ! Return value - - character(len=*), parameter :: sub = 'clm::TimeSetymd' - integer :: yr, mon, day ! Year, month, day as integers - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - if ( (ymd < 0) .or. (tod < 0) .or. (tod > isecspday) )then - write(iulog,*) sub//': error yymmdd is a negative number or time-of-day out of bounds', & - ymd, tod - call shr_sys_abort - end if - yr = ymd / 10000 - mon = (ymd - yr*10000) / 100 - day = ymd - yr*10000 - mon*100 - call ESMF_TimeSet( TimeSetymd, yy=yr, mm=mon, dd=day, s=tod, & - calendar=tm_cal, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeSet: setting '//trim(desc)) - end function TimeSetymd - - !========================================================================================= - - integer function TimeGetymd( date, tod ) - ! - ! Get the date and time of day in ymd from ESMF Time. - ! - type(ESMF_Time), intent(inout) :: date ! Input date to convert to ymd - integer, intent(out), optional :: tod ! Time of day in seconds - - character(len=*), parameter :: sub = 'clm::TimeGetymd' - integer :: yr, mon, day - integer :: rc ! return code - - call ESMF_TimeGet( date, yy=yr, mm=mon, dd=day, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - TimeGetymd = yr*10000 + mon*100 + day - if ( present( tod ) )then - call ESMF_TimeGet( date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - end if - if ( yr < 0 )then - write(iulog,*) sub//': error year is less than zero', yr - call shr_sys_abort - end if - end function TimeGetymd - - !========================================================================================= - - subroutine timemgr_restart_io( ncid, flag ) - - !--------------------------------------------------------------------------------- - ! Read/Write information needed on restart to a netcdf file. - use ncdio_pio, only: ncd_int, file_desc_t - use restUtilMod - ! - ! Arguments - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*), intent(in) :: flag ! 'read' or 'write' - ! - ! Local variables - character(len=*), parameter :: sub = 'clm::timemgr_restart' - integer :: rc ! return code - logical :: readvar ! determine if variable is on initial file - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: ref_date ! reference date for run - type(ESMF_Time) :: curr_date ! date of data in restart file - integer :: rst_caltype ! calendar type - integer, parameter :: noleap = 1 - integer, parameter :: gregorian = 2 - character(len=len(calendar)) :: cal - !--------------------------------------------------------------------------------- - - if (flag == 'write') then - rst_nstep_rad_prev = nstep_rad_prev - end if - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_nstep_rad_prev', xtype=ncd_int, & - long_name='previous_radiation_nstep', units='unitless positive integer', & - ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_nstep_rad_prev) - if (flag == 'read') then - nstep_rad_prev = rst_nstep_rad_prev - end if - - if (flag == 'write') then - cal = to_upper(calendar) - if ( trim(cal) == NO_LEAP_C ) then - rst_caltype = noleap - else if ( trim(cal) == GREGORIAN_C ) then - rst_caltype = gregorian - else - call shr_sys_abort(sub//'ERROR: unrecognized calendar specified= '//trim(calendar)) - end if - end if - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_type', xtype=ncd_int, & - long_name='calendar type', units='unitless', flag_meanings=(/ "NO_LEAP_C", "GREGORIAN" /), & - flag_values=(/ noleap, gregorian /), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_caltype) - if (flag == 'read') then - if ( rst_caltype == noleap ) then - calendar = NO_LEAP_C - else if ( rst_caltype == gregorian ) then - calendar = GREGORIAN_C - else - write(iulog,*)sub,': unrecognized calendar type in restart file: ',rst_caltype - call shr_sys_abort( sub//'ERROR: bad calendar type in restart file') - end if - end if - - if (flag == 'write') then - call ESMF_ClockGet( tm_clock, startTime=start_date, currTime=curr_date, refTime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - rst_step_sec = dtime - rst_start_ymd = TimeGetymd( start_date, tod=rst_start_tod ) - rst_ref_ymd = TimeGetymd( ref_date, tod=rst_ref_tod ) - rst_curr_ymd = TimeGetymd( curr_date, tod=rst_curr_tod ) - end if - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_step_sec', xtype=ncd_int, & - long_name='seconds component of timestep size', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_step_sec) - if ((flag == 'read') .and. ( rst_step_sec < 0 .or. rst_step_sec > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_step_sec out of range') - end if - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_start_ymd', xtype=ncd_int, & - long_name='start date', units='YYYYMMDD', ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_start_ymd) - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_start_tod', xtype=ncd_int, & - long_name='start time of day', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_start_tod) - if ((flag == 'read') .and. ( rst_start_tod < 0 .or. rst_start_tod > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_strart_tod out of range') - end if - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_ref_ymd', xtype=ncd_int, & - long_name='reference date', units='YYYYMMDD', ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_ref_ymd) - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_ref_tod', xtype=ncd_int, & - long_name='reference time of day', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_ref_tod) - if ((flag == 'read') .and. ( rst_start_tod < 0 .or. rst_start_tod > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_ref_tod out of range') - end if - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_curr_ymd', xtype=ncd_int, & - long_name='current date', units='YYYYMMDD', ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_curr_ymd) - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_curr_tod', xtype=ncd_int, & - long_name='current time of day', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_curr_tod) - if ((flag == 'read') .and. ( rst_curr_tod < 0 .or. rst_curr_tod > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_ref_ymd out of range') - end if - - end subroutine timemgr_restart_io - - !========================================================================================= - - subroutine timemgr_restart( ) - - !--------------------------------------------------------------------------------- - ! Restart the ESMF time manager using the synclock for ending date. - ! - character(len=*), parameter :: sub = 'clm::timemgr_restart' - integer :: rc ! return code - integer :: yr, mon, day, tod ! Year, month, day, and second as integers - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: ref_date ! reference date for run - type(ESMF_Time) :: curr_date ! date of data in restart file - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: current ! current date (from clock) - type(ESMF_TimeInterval) :: day_step_size ! day step size - type(ESMF_TimeInterval) :: step_size ! timestep size - logical :: run_length_specified = .false. - !--------------------------------------------------------------------------------- - call timemgr_spmdbcast( ) - - ! Initialize calendar from restart info - - call init_calendar() - - ! Initialize the timestep from restart info - - dtime = rst_step_sec - - ! Initialize start date from restart info - - start_date = TimeSetymd( rst_start_ymd, rst_start_tod, "start_date" ) - - ! Initialize current date from restart info - - curr_date = TimeSetymd( rst_curr_ymd, rst_curr_tod, "curr_date" ) - - ! Initialize stop date from sync clock or namelist input - - stop_date = TimeSetymd( 99991231, stop_tod, "stop_date" ) - - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') - - call ESMF_TimeIntervalSet( day_step_size, d=1, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting day_step_size') - - if ( stop_ymd /= uninit_int ) then - current = TimeSetymd( stop_ymd, stop_tod, "stop_date" ) - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - else if ( nelapse /= uninit_int ) then - if ( nelapse >= 0 ) then - current = curr_date + step_size*nelapse - else - current = curr_date - day_step_size*nelapse - end if - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( .not. run_length_specified ) then - call shr_sys_abort (sub//': Must specify stop_ymd or nelapse') - end if - - ! Error check - - if ( stop_date <= start_date ) then - write(iulog,*)sub, ': stop date must be specified later than start date: ' - call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - if ( curr_date >= stop_date ) then - write(iulog,*)sub, ': stop date must be specified later than current date: ' - call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - - ! Initialize nstep_rad_prev from restart info - - nstep_rad_prev = rst_nstep_rad_prev - - ! Initialize ref date from restart info - - ref_date = TimeSetymd( rst_ref_ymd, rst_ref_tod, "ref_date" ) - - ! Initialize clock - - call init_clock( start_date, ref_date, curr_date, stop_date ) - - ! Advance the timestep. - ! Data from the restart file corresponds to the last timestep of the previous run. - - call advance_timestep() - - ! Set flag that this is the first timestep of the restart run. - - tm_first_restart_step = .true. - - ! Calculate ending time step - - call calc_nestep( ) - - ! Print configuration summary to log file (stdout). - - if (masterproc) call timemgr_print() - - timemgr_set = .true. - - end subroutine timemgr_restart - - !========================================================================================= - - subroutine calc_nestep() - !--------------------------------------------------------------------------------- - ! - ! Calculate ending timestep number - ! Calculation of ending timestep number (nestep) assumes a constant stepsize. - ! - character(len=*), parameter :: sub = 'clm::calc_nestep' - integer :: ntspday ! Number of time-steps per day - type(ESMF_TimeInterval) :: diff ! - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - integer :: ndays, nsecs ! Number of days, seconds to ending time - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, stopTime=stop_date, startTime=start_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - ntspday = isecspday/dtime - diff = stop_date - start_date - call ESMF_TimeIntervalGet( diff, d=ndays, s=nsecs, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet calculating nestep') - nestep = ntspday*ndays + nsecs/dtime - if ( mod(nsecs,dtime) /= 0 ) nestep = nestep + 1 - end subroutine calc_nestep - - !========================================================================================= - - subroutine init_calendar( ) - - !--------------------------------------------------------------------------------- - ! Initialize calendar - ! - ! Local variables - ! - character(len=*), parameter :: sub = 'clm::init_calendar' - type(ESMF_CalKind_Flag) :: cal_type ! calendar type - character(len=len(calendar)) :: caltmp - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - caltmp = to_upper(calendar) - if ( trim(caltmp) == NO_LEAP_C ) then - cal_type = ESMF_CALKIND_NOLEAP - else if ( trim(caltmp) == GREGORIAN_C ) then - cal_type = ESMF_CALKIND_GREGORIAN - else - write(iulog,*)sub,': unrecognized calendar specified: ',calendar - call shr_sys_abort - end if - tm_cal = ESMF_CalendarCreate( name=caltmp, calkindflag=cal_type, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_CalendarSet') - end subroutine init_calendar - - !========================================================================================= - - subroutine timemgr_print() - - !--------------------------------------------------------------------------------- - character(len=*), parameter :: sub = 'clm::timemgr_print' - integer :: rc - integer :: yr, mon, day - integer :: & ! Data required to restart time manager: - nstep = uninit_int, &! current step number - step_sec = uninit_int, &! timestep size seconds - start_yr = uninit_int, &! start year - start_mon = uninit_int, &! start month - start_day = uninit_int, &! start day of month - start_tod = uninit_int, &! start time of day - stop_yr = uninit_int, &! stop year - stop_mon = uninit_int, &! stop month - stop_day = uninit_int, &! stop day of month - stop_tod = uninit_int, &! stop time of day - ref_yr = uninit_int, &! reference year - ref_mon = uninit_int, &! reference month - ref_day = uninit_int, &! reference day of month - ref_tod = uninit_int, &! reference time of day - curr_yr = uninit_int, &! current year - curr_mon = uninit_int, &! current month - curr_day = uninit_int, &! current day of month - curr_tod = uninit_int ! current time of day - integer(ESMF_KIND_I8) :: step_no - type(ESMF_Time) :: start_date! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: curr_date ! date of data in restart file - type(ESMF_Time) :: ref_date ! reference date - type(ESMF_TimeInterval) :: step ! Time-step - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, startTime=start_date, currTime=curr_date, & - refTime=ref_date, stopTime=stop_date, timeStep=step, & - advanceCount=step_no, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - nstep = step_no - - write(iulog,*)' ******** CLM Time Manager Configuration ********' - - call ESMF_TimeIntervalGet( step, s=step_sec, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - - call ESMF_TimeGet( start_date, yy=start_yr, mm=start_mon, dd=start_day, & - s=start_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( stop_date, yy=stop_yr, mm=stop_mon, dd=stop_day, & - s=stop_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( ref_date, yy=ref_yr, mm=ref_mon, dd=ref_day, s=ref_tod, & - rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( curr_date, yy=curr_yr, mm=curr_mon, dd=curr_day, & - s=curr_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - write(iulog,*)' Calendar type: ',trim(calendar) - write(iulog,*)' Timestep size (seconds): ', step_sec - write(iulog,*)' Start date (yr mon day tod): ', start_yr, start_mon, & - start_day, start_tod - write(iulog,*)' Stop date (yr mon day tod): ', stop_yr, stop_mon, & - stop_day, stop_tod - write(iulog,*)' Reference date (yr mon day tod): ', ref_yr, ref_mon, & - ref_day, ref_tod - write(iulog,*)' Current step number: ', nstep - write(iulog,*)' Ending step number: ', nestep - write(iulog,*)' Current date (yr mon day tod): ', curr_yr, curr_mon, & - curr_day, curr_tod - - if ( tm_perp_calendar ) then - call ESMF_TimeGet( tm_perp_date, yy=yr, mm=mon, dd=day, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - write(iulog,*)' Use perpetual diurnal cycle date (yr mon day): ', & - yr, mon, day - end if - - write(iulog,*)' ************************************************' - - end subroutine timemgr_print - - !========================================================================================= - - subroutine advance_timestep() - - ! Increment the timestep number. - - character(len=*), parameter :: sub = 'clm::advance_timestep' - integer :: rc - - call ESMF_ClockAdvance( tm_clock, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockAdvance') - - tm_first_restart_step = .false. - - end subroutine advance_timestep - - !========================================================================================= - - subroutine get_clock( clock ) - - ! Return the ESMF clock - - type(ESMF_Clock), intent(inout) :: clock - - character(len=*), parameter :: sub = 'clm::get_clock' - type(ESMF_TimeInterval) :: step_size - type(ESMF_Time) :: start_date, stop_date, ref_date - integer :: rc - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, timeStep=step_size, startTime=start_date, & - stoptime=stop_date, reftime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - call ESMF_ClockSet(clock, timeStep=step_size, startTime=start_date, & - stoptime=stop_date, reftime=ref_date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockSet') - - end subroutine get_clock - - !========================================================================================= - - function get_curr_ESMF_Time( ) - - ! Return the current time as ESMF_Time - - type(ESMF_Time) :: get_curr_ESMF_Time - character(len=*), parameter :: sub = 'clm::get_curr_ESMF_Time' - integer :: rc - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, currTime=get_curr_ESMF_Time, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - end function get_curr_ESMF_Time - - !========================================================================================= - - integer function get_step_size() - - ! Return the step size in seconds. - - character(len=*), parameter :: sub = 'clm::get_step_size' - type(ESMF_TimeInterval) :: step_size ! timestep size - integer :: rc - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet(tm_clock, timeStep=step_size, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeIntervalGet(step_size, s=get_step_size, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockTimeIntervalGet') - - end function get_step_size - - !========================================================================================= - - real(r8) function get_step_size_real() - - ! Return the step size in seconds, as a real value - - get_step_size_real = real(get_step_size(), r8) - - end function get_step_size_real - - !========================================================================================= - - subroutine update_DA_nstep() - ! Update the Data Assimulation time-step to the current time step, since DA has been done - DA_nstep = get_nstep() - end subroutine update_DA_nstep - - !========================================================================================= - - subroutine update_rad_dtime(doalb) - !--------------------------------------------------------------------------------- - ! called only on doalb timesteps to save off radiation nsteps - ! - ! Local Arguments - logical,intent(in) :: doalb - integer :: dtime,nstep - - if (doalb) then - - dtime=get_step_size() - nstep = get_nstep() - - if (nstep_rad_prev == uninit_int ) then - dtime_rad = dtime - nstep_rad_prev = nstep - else - dtime_rad = (nstep - nstep_rad_prev) * dtime - nstep_rad_prev = nstep - endif - end if - end subroutine update_rad_dtime - - !========================================================================================= - - integer function get_rad_step_size() - - character(len=*), parameter :: sub = 'clm::get_rad_step_size' - - call check_timemgr_initialized(sub) - - if (nstep_rad_prev == uninit_int ) then - get_rad_step_size=get_step_size() - else - get_rad_step_size=dtime_rad - end if - - end function get_rad_step_size - - !========================================================================================= - - integer function get_nstep() - - ! Return the timestep number. - - character(len=*), parameter :: sub = 'clm::get_nstep' - integer :: rc - integer(ESMF_KIND_I8) :: step_no - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet(tm_clock, advanceCount=step_no, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - get_nstep = step_no - - end function get_nstep - - !========================================================================================= - - integer function get_nstep_since_startup_or_lastDA_restart_or_pause() - - ! Return the number of time-steps since the restart file was modified - - character(len=*), parameter :: sub = 'clm::get_nstep_since_rest_mod' - - get_nstep_since_startup_or_lastDA_restart_or_pause = get_nstep() - DA_nstep - - end function get_nstep_since_startup_or_lastDA_restart_or_pause - - !========================================================================================= - - subroutine get_curr_date(yr, mon, day, tod, offset) - - !----------------------------------------------------------------------------------------- - ! Return date components valid at end of current timestep with an optional - ! offset (positive or negative) in seconds. - - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_curr_date' - integer :: rc - type(ESMF_Time) :: date - type(ESMF_TimeInterval) :: off - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, currTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - if (present(offset)) then - if (offset > 0) then - call ESMF_TimeIntervalSet( off, s=offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date + off - else if (offset < 0) then - call ESMF_TimeIntervalSet( off, s=-offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date - off - end if - end if - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_curr_date - - !========================================================================================= - - subroutine get_perp_date(yr, mon, day, tod, offset) - - !----------------------------------------------------------------------------------------- - ! Return time of day valid at end of current timestep and the components - ! of the perpetual date (with an optional offset (positive or negative) in seconds. - - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_perp_date' - integer :: rc - type(ESMF_Time) :: date - type(ESMF_TimeInterval) :: DelTime - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, currTime=date, rc=rc ) - ! Get time of day add it to perpetual date - ! Get year, month, day so that seconds are time-of-day rather than since start time - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeIntervalSet(DelTime, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = tm_perp_date + DelTime - if ( present(offset) )then - call ESMF_TimeIntervalSet(DelTime, s=offset, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date + DelTime - end if - ! Get time of day from the result - ! Get year, month, day so that seconds are time-of-day rather than since start time - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - - ! Get the date from the fixed perpetual date (in case it overflows to next day) - call ESMF_TimeGet(tm_perp_date, yy=yr, mm=mon, dd=day, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_perp_date - - !========================================================================================= - - subroutine get_prev_date(yr, mon, day, tod) - - ! Return date components valid at beginning of current timestep. - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_prev_date' - integer :: rc - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet(tm_clock, prevTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_prev_date - - !========================================================================================= - - subroutine get_start_date(yr, mon, day, tod) - - ! Return date components valid at beginning of initial run. - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_start_date' - integer :: rc - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet(tm_clock, startTime=date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_start_date - - !========================================================================================= - - integer function get_driver_start_ymd( tod ) - - ! Return date of start of simulation from driver (i.e. NOT from restart file) - ! Note: get_start_date gets you the date from the beginning of the simulation - ! on the restart file. - - ! Arguments - integer, optional, intent(out) ::& - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_driver_start_ymd' - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - if ( start_ymd == uninit_int )then - call shr_sys_abort( sub//': error driver start date is NOT set yet' ) - end if - if ( start_ymd < 101 .or. start_ymd > 99991231 )then - call shr_sys_abort( sub//': error driver start date is invalid' ) - end if - if ( present(tod) )then - tod = start_tod - if ( (tod < 0) .or. (tod > isecspday) )then - call shr_sys_abort( sub//': error driver start tod is invalid' ) - end if - end if - get_driver_start_ymd = start_ymd - - end function get_driver_start_ymd - - !========================================================================================= - - subroutine get_ref_date(yr, mon, day, tod) - - ! Return date components of the reference date. - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_ref_date' - integer :: rc - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet(tm_clock, refTime=date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_ref_date - - !========================================================================================= - - subroutine get_curr_time(days, seconds) - - ! Return time components valid at end of current timestep. - ! Current time is the time interval between the current date and the reference date. - - ! Arguments - integer, intent(out) ::& - days, &! number of whole days in time interval - seconds ! remaining seconds in time interval - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_curr_time' - integer :: rc - type(ESMF_Time) :: cdate, rdate - type(ESMF_TimeInterval) :: diff - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, currTime=cdate, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_ClockGet( tm_clock, refTime=rdate, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - diff = cdate - rdate - - call ESMF_TimeIntervalGet(diff, d=days, s=seconds, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - - end subroutine get_curr_time - - !========================================================================================= - - subroutine get_prev_time(days, seconds) - - ! Return time components valid at beg of current timestep. - ! prev time is the time interval between the prev date and the reference date. - - ! Arguments - integer, intent(out) ::& - days, &! number of whole days in time interval - seconds ! remaining seconds in time interval - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_prev_time' - integer :: rc - type(ESMF_Time) :: date, ref_date - type(ESMF_TimeInterval) :: diff - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet(tm_clock, prevTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet for prevTime') - call ESMF_ClockGet(tm_clock, refTime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet for refTime') - diff = date - ref_date - call ESMF_TimeIntervalGet( diff, d=days, s=seconds, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeintervalGet') - - end subroutine get_prev_time - - !========================================================================================= - - function get_curr_calday(offset) - - ! Return calendar day at end of current timestep with optional offset. - ! Calendar day 1.0 = 0Z on Jan 1. - - ! Arguments - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - ! Return value - real(r8) :: get_curr_calday - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_curr_calday' - integer :: rc - type(ESMF_Time) :: date - type(ESMF_TimeInterval) :: off, diurnal - integer :: year, month, day, tod - !----------------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, currTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - if (present(offset)) then - if (offset > 0) then - call ESMF_TimeIntervalSet( off, s=offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date + off - else if (offset < 0) then - call ESMF_TimeIntervalSet( off, s=-offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date - off - end if - end if - - if ( tm_perp_calendar ) then - call ESMF_TimeGet(date, yy=year, mm=month, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeIntervalSet( diurnal, s=tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = tm_perp_date + diurnal - end if - - call ESMF_TimeGet( date, dayOfYear_r8=get_curr_calday, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - !----------------------------------------------------------------------------------------! - !!!!!!!!!!!!!! WARNING HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!! - !!!! The following hack fakes day 366 by reusing day 365. This is just because the !!!!!! - !!!! current shr_orb_decl calculation can't handle days > 366. !!!!!! - !!!! Dani Bundy-Coleman and Erik Kluzek Aug/2008 !!!!!! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if ( (get_curr_calday > 366.0) .and. (get_curr_calday <= 367.0) .and. & - (trim(calendar) == GREGORIAN_C) )then - get_curr_calday = get_curr_calday - 1.0_r8 - end if - !!!!!!!!!!!!!! END HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!!!!!! - !----------------------------------------------------------------------------------------! - if ( (get_curr_calday < 1.0) .or. (get_curr_calday > 366.0) )then - write(iulog,*) sub, ' = ', get_curr_calday - if ( present(offset) ) write(iulog,*) 'offset = ', offset - call shr_sys_abort( sub//': error get_curr_calday out of bounds' ) - end if - - end function get_curr_calday - - !========================================================================================= - - function get_calday(ymd, tod) - - ! Return calendar day corresponding to specified time instant. - ! Calendar day 1.0 = 0Z on Jan 1. - - ! Arguments - integer, intent(in) :: & - ymd, &! date in yearmmdd format - tod ! time of day (seconds past 0Z) - - ! Return value - real(r8) :: get_calday - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_calday' - integer :: rc ! return code - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - date = TimeSetymd( ymd, tod, "get_calday" ) - call ESMF_TimeGet( date, dayOfYear_r8=get_calday, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - !----------------------------------------------------------------------------------------! -!!!!!!!!!!!!!! WARNING HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!! -!!!! The following hack fakes day 366 by reusing day 365. This is just because the !!!!!! -!!!! current shr_orb_decl calculation can't handle days > 366. !!!!!! -!!!! Dani Bundy-Coleman and Erik Kluzek Aug/2008 !!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if ( (get_calday > 366.0) .and. (get_calday <= 367.0) .and. & - (trim(calendar) == GREGORIAN_C) )then - get_calday = get_calday - 1.0_r8 - end if -!!!!!!!!!!!!!! END HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!!!!!! - !----------------------------------------------------------------------------------------! - if ( (get_calday < 1.0) .or. (get_calday > 366.0) )then - write(iulog,*) sub, ' = ', get_calday - call shr_sys_abort( sub//': error calday out of range' ) - end if - - end function get_calday - - !========================================================================================= - - function get_calendar() - - ! Return calendar - - ! Return value - character(len=ESMF_MAXSTR) :: get_calendar - - get_calendar = calendar - - end function get_calendar - - !========================================================================================= - - integer function get_days_per_year( offset ) - - !--------------------------------------------------------------------------------- - ! Get the number of days per year for currrent year - - ! - ! Arguments - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_days_per_year' - integer :: yr, mon, day, tod ! current date year, month, day and time-of-day - type(ESMF_Time) :: eDate ! ESMF date - integer :: rc ! ESMF return code - !--------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - if ( present(offset) )then - call get_curr_date(yr, mon, day, tod, offset ) - else - call get_curr_date(yr, mon, day, tod ) - end if - eDate = TimeSetymd( ymd=yr*10000+1231, tod=0, desc="end of year" ) - call ESMF_TimeGet( eDate, dayOfYear=get_days_per_year, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end function get_days_per_year - - !========================================================================================= - - function get_curr_yearfrac( offset ) - - !--------------------------------------------------------------------------------- - ! Get the fractional position in the current year, as of the end of the current - ! timestep. This is 0 at midnight on Jan 1, and 1 at the end of Dec 31. - - ! - ! Arguments - real(r8) :: get_curr_yearfrac ! function result - - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_curr_yearfrac' - real(r8) :: cday ! current calendar day (1.0 = 0Z on Jan 1) - real(r8) :: days_per_year ! days per year - - call check_timemgr_initialized(sub) - - cday = get_curr_calday(offset=offset) - days_per_year = get_days_per_year() - - get_curr_yearfrac = (cday - 1._r8)/days_per_year - - end function get_curr_yearfrac - - !========================================================================================= - - function get_prev_yearfrac() - - !--------------------------------------------------------------------------------- - ! Get the fractional position in the current year, as of the beginning of the current - ! timestep. This is 0 at midnight on Jan 1, and 1 at the end of Dec 31. - - ! - ! Arguments - real(r8) :: get_prev_yearfrac ! function result - - character(len=*), parameter :: sub = 'clm::get_curr_yearfrac' - - call check_timemgr_initialized(sub) - - get_prev_yearfrac = get_curr_yearfrac(offset = -dtime) - - end function get_prev_yearfrac - - - !========================================================================================= - - subroutine get_rest_date(ncid, yr) - - !--------------------------------------------------------------------------------- - ! Get the date from the restart file. - ! - ! Currently just returns the year (because the month & day are harder to extract, and - ! currently aren't needed). - use ncdio_pio, only: ncd_io, file_desc_t - ! - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf id for the restart file - integer , intent(out) :: yr ! year from restart file - - integer :: ymd ! yyyymmdd from the restart file - logical :: readvar ! whether the variable was read from the file - - integer, parameter :: year_mask = 10000 ! divide by this to get year from ymd - - character(len=*), parameter :: subname = 'get_rest_date' - !----------------------------------------------------------------------- - - ! Get the date (yyyymmdd) from restart file. - ! Note that we cannot simply use the rst_curr_ymd module variable, because that isn't - ! set under some circumstances - call ncd_io(varname='timemgr_rst_curr_ymd', data=ymd, & - ncid=ncid, flag='read', readvar=readvar) - if (.not. readvar) then - call shr_sys_abort(subname//' ERROR: timemgr_rst_curr_ymd not found on restart file') - end if - - ! Extract the year - yr = ymd / year_mask - end subroutine get_rest_date - - !========================================================================================= - - subroutine set_nextsw_cday( nextsw_cday_in ) - - ! Set the next radiation calendar day, so that radiation step can be calculated - ! - ! Arguments - real(r8), intent(IN) :: nextsw_cday_in ! input calday of next radiation computation - - character(len=*), parameter :: sub = 'clm::set_nextsw_cday' - - nextsw_cday = nextsw_cday_in - - end subroutine set_nextsw_cday - - !========================================================================================= - - function is_beg_curr_day() - - ! Return true if current timestep is first timestep in current day. - - ! Return value - logical :: is_beg_curr_day - - ! Local variables - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - character(len=*), parameter :: sub = 'clm::is_beg_curr_day' - - call check_timemgr_initialized(sub) - - call get_curr_date(yr, mon, day, tod) - is_beg_curr_day = ( tod == dtime ) - - end function is_beg_curr_day - - !========================================================================================= - - function is_end_curr_day() - - !--------------------------------------------------------------------------------- - ! Return true if current timestep is last timestep in current day. - - ! Return value - logical :: is_end_curr_day - - ! Local variables - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - character(len=*), parameter :: sub = 'clm::is_end_curr_day' - !--------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call get_curr_date(yr, mon, day, tod) - is_end_curr_day = (tod == 0) - - end function is_end_curr_day - - !========================================================================================= - - logical function is_end_curr_month() - - !--------------------------------------------------------------------------------- - ! Return true if current timestep is last timestep in current month. - - ! Local variables - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - character(len=*), parameter :: sub = 'clm::is_end_curr_month' - !--------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call get_curr_date(yr, mon, day, tod) - is_end_curr_month = (day == 1 .and. tod == 0) - - end function is_end_curr_month - - !----------------------------------------------------------------------- - logical function is_beg_curr_year() - ! - ! !DESCRIPTION: - ! Return true if current timestep is first timestep in current year. - ! - ! !LOCAL VARIABLES: - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - character(len=*), parameter :: subname = 'is_beg_curr_year' - !----------------------------------------------------------------------- - - call check_timemgr_initialized(subname) - - call get_curr_date(yr, mon, day, tod) - is_beg_curr_year = (mon == 1 .and. day == 1 .and. tod == dtime) - - end function is_beg_curr_year - - !----------------------------------------------------------------------- - logical function is_end_curr_year() - ! - ! !DESCRIPTION: - ! Return true if current timestep is last timestep in current year. - ! - ! !LOCAL VARIABLES: - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - character(len=*), parameter :: subname = 'is_end_curr_year' - !----------------------------------------------------------------------- - - call check_timemgr_initialized(subname) - - call get_curr_date(yr, mon, day, tod) - is_end_curr_year = (mon == 1 .and. day == 1 .and. tod == 0) - - end function is_end_curr_year - - - !========================================================================================= - - logical function is_first_step() - - !--------------------------------------------------------------------------------- - ! Return true on first step of initial run only. - - ! Local variables - character(len=*), parameter :: sub = 'clm::is_first_step' - integer :: rc - integer :: nstep - integer(ESMF_KIND_I8) :: step_no - !--------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, advanceCount=step_no, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - nstep = step_no - is_first_step = (nstep == 0) - - end function is_first_step - !========================================================================================= - - logical function is_first_restart_step() - - ! Return true on first step of restart or branch run only. - character(len=*), parameter :: sub = 'clm::is_first_restart_step' - - call check_timemgr_initialized(sub) - - is_first_restart_step = tm_first_restart_step - - end function is_first_restart_step - - !========================================================================================= - - logical function is_first_step_of_this_run_segment() - - ! Return true if this is the first step of this run segment. This will be true for - ! the first step of a startup, restart or branch run. - character(len=*), parameter :: sub = 'clm::is_first_step_of_this_run_segment' - - call check_timemgr_initialized(sub) - - is_first_step_of_this_run_segment = (is_first_step() .or. is_first_restart_step()) - - end function is_first_step_of_this_run_segment - - !========================================================================================= - - logical function is_last_step() - - !--------------------------------------------------------------------------------- - ! Return true on last timestep. - - ! Local variables - character(len=*), parameter :: sub = 'clm::is_last_step' - type(ESMF_Time) :: stop_date - type(ESMF_Time) :: curr_date - type(ESMF_TimeInterval) :: time_step - integer :: rc - !--------------------------------------------------------------------------------- - - call check_timemgr_initialized(sub) - - call ESMF_ClockGet( tm_clock, stopTime=stop_date, & - currTime=curr_date, TimeStep=time_step, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - if ( curr_date+time_step > stop_date ) then - is_last_step = .true. - else - is_last_step = .false. - end if - - end function is_last_step - - !========================================================================================= - - logical function is_perpetual() - - ! Return true on last timestep. - character(len=*), parameter :: sub = 'clm::is_perpetual' - - call check_timemgr_initialized(sub) - - is_perpetual = tm_perp_calendar - - end function is_perpetual - - !========================================================================================= - - subroutine timemgr_datediff(ymd1, tod1, ymd2, tod2, days) - - ! Calculate the difference (ymd2,tod2) - (ymd1,tod1) and return the result in days. - ! Arguments - integer, intent(in) ::& - ymd1, &! date1 in yyyymmdd format - tod1, &! time of day relative to date1 (seconds past 0Z) - ymd2, &! date2 in yyyymmdd format - tod2 ! time of day relative to date2 (seconds past 0Z) - - real(r8) :: days ! (ymd2,tod2)-(ymd1,tod1) in days - - ! Local variables - character(len=*), parameter :: sub = 'clm::timemgr_datediff' - integer :: rc ! return code - - type(ESMF_Time) :: date1 - type(ESMF_Time) :: date2 - type(ESMF_TimeInterval) :: diff - !----------------------------------------------------------------------------------------- - - date1 = TimeSetymd( ymd1, tod1, "date1" ) - date2 = TimeSetymd( ymd2, tod2, "date2" ) - diff = date2 - date1 - call ESMF_TimeIntervalGet( diff, d_r8=days, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - days = days + 1.0_r8 - - end subroutine timemgr_datediff - - !========================================================================================= - - subroutine chkrc(rc, mes) - integer, intent(in) :: rc ! return code from time management library - character(len=*), intent(in) :: mes ! error message - if ( rc == ESMF_SUCCESS ) return - write(iulog,*) mes - call shr_sys_abort ('CHKRC') - end subroutine chkrc - - !========================================================================================= - - function to_upper(str) - - !--------------------------------------------------------------------------------- - ! Convert character string to upper case. Use achar and iachar intrinsics - ! to ensure use of ascii collating sequence. - ! - ! !INPUT PARAMETERS: - character(len=*), intent(in) :: str ! String to convert to upper case - ! !RETURN VALUE: - character(len=len(str)) :: to_upper - ! !LOCAL VARIABLES: - integer :: i ! Index - integer :: aseq ! ascii collating sequence - character(len=1) :: ctmp ! Character temporary - !--------------------------------------------------------------------------------- - - do i = 1, len(str) - ctmp = str(i:i) - aseq = iachar(ctmp) - if ( aseq >= 97 .and. aseq <= 122 ) ctmp = achar(aseq - 32) - to_upper(i:i) = ctmp - end do - - end function to_upper - - !========================================================================================= - - logical function is_restart( ) - ! Determine if restart run - use clm_varctl, only : nsrest, nsrContinue - if (nsrest == nsrContinue) then - is_restart = .true. - else - is_restart = .false. - end if - end function is_restart - - !========================================================================================= - - subroutine timemgr_spmdbcast( ) - - use spmdMod , only : mpicom, MPI_INTEGER - use shr_mpi_mod, only : shr_mpi_bcast - - integer :: ier - - call shr_mpi_bcast (dtime, mpicom) - - end subroutine timemgr_spmdbcast - - !========================================================================================= - - subroutine check_timemgr_initialized(caller) - ! - ! !DESCRIPTION: - ! Checks if the time manager has been initialized. If not, aborts with an error - ! message. - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: caller ! name of calling routine - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'check_timemgr_initialized' - !----------------------------------------------------------------------- - - if (.not. timemgr_set) then - call shr_sys_abort(trim(caller)//":: Time manager has not been initialized") - end if - - end subroutine check_timemgr_initialized - - !----------------------------------------------------------------------- - subroutine timemgr_reset() - ! - ! !DESCRIPTION: - ! Reset time manager module data to default values. - ! - ! All unit tests that modify the time manager should call this routine in their - ! teardown section. - ! - ! Note: we could probably get away with doing much less resetting than is currently - ! done here. For example, we could simply set timemgr_set = .false., and deallocate - ! anything that needs deallocation. That would provide the benefit of less - ! maintenance, at the cost of slightly less robustness (in case some variable isn't - ! set in the initialization of a unit test, either because the unit test forgets to - ! call the time manager initialization method, or because the initialization method - ! does not explicitly initialize all variables). - ! - ! !USES: - ! - ! !ARGUMENTS: - ! - ! !LOCAL VARIABLES: - integer :: rc ! return code - - character(len=*), parameter :: sub = 'timemgr_reset' - !----------------------------------------------------------------------- - - ! ------------------------------------------------------------------------ - ! The values in the following section should match the initialization values given in - ! the variable declarations at the top of the module. - ! - ! Note: it would be easier to ensure this match if we introduced a time manager - ! derived type, which had default initialization of its components. Then this routine - ! could simply set to time manager instance to a new instance of the derived type. - ! ------------------------------------------------------------------------ - - calendar = NO_LEAP_C - - dtime = uninit_int - dtime_rad = uninit_int - nstep_rad_prev = uninit_int - - nelapse = uninit_int - start_ymd = uninit_int - start_tod = 0 - stop_ymd = uninit_int - stop_tod = 0 - ref_ymd = uninit_int - ref_tod = 0 - - rst_step_sec = uninit_int - rst_start_ymd = uninit_int - rst_start_tod = uninit_int - rst_ref_ymd = uninit_int - rst_ref_tod = uninit_int - rst_curr_ymd = uninit_int - rst_curr_tod = uninit_int - - ! note that rst_nstep_rad_prev is NOT initialized in its declaration - rst_nstep_rad_prev = uninit_int - perpetual_ymd = uninit_int - tm_first_restart_step = .false. - tm_perp_calendar = .false. - timemgr_set = .false. - nestep = uninit_int - - nextsw_cday = uninit_r8 - - ! ------------------------------------------------------------------------ - ! Reset other module-level variables to some reasonable default, to ensure that they - ! don't carry over any state from one unit test to the next. - ! ------------------------------------------------------------------------ - - ! Reset tm_cal - call init_calendar() - - ! Reset portions of the clock. Note that this does not fully reset the clock, and so - ! there is still the potential for information in the clock to carry over to the next - ! unit test if the next test does not properly initialize things. - call ESMF_ClockDestroy(tm_clock, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockDestroy') - - ! Note that we do NOT currently reset tm_perp_date, because it's unclear what that - ! should be reset to. Thus, there is potential for its information to carry over to - ! the next unit test if the next test does not properly initialize things. - - end subroutine timemgr_reset - - ! ======================================================================== - ! The following routines are meant to be used just in unit tests - ! ======================================================================== - - !----------------------------------------------------------------------- - subroutine for_test_set_curr_date(yr, mon, day, tod) - ! - ! !DESCRIPTION: - ! Sets the current date - i.e., the date at the end of the time step - ! - ! *** Should only be used in unit tests!!! *** - ! - ! !USES: - ! - ! !ARGUMENTS: - integer, intent(in) :: yr ! year - integer, intent(in) :: mon ! month - integer, intent(in) :: day ! day of month - integer, intent(in) :: tod ! time of day (seconds past 0Z) - ! - ! !LOCAL VARIABLES: - type(ESMF_Time) :: my_time ! ESMF Time corresponding to the inputs - integer :: rc ! return code - - character(len=*), parameter :: sub = 'for_test_set_curr_date' - !----------------------------------------------------------------------- - - call ESMF_TimeSet(my_time, yy=yr, mm=mon, dd=day, s=tod, & - calendar=tm_cal, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeSet') - - call ESMF_ClockSet(tm_clock, CurrTime=my_time, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockSet') - - end subroutine for_test_set_curr_date - - -end module clm_time_manager diff --git a/src/utils/clm_varorb.F90 b/src/utils/clm_varorb.F90 deleted file mode 100644 index 47bf51e576..0000000000 --- a/src/utils/clm_varorb.F90 +++ /dev/null @@ -1,17 +0,0 @@ - -module clm_varorb - - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - - ! Orbital information needed as input to orbit_parms - - real(r8) :: eccen ! Earth's eccentricity factor (unitless) (typically 0 to 0.1) - - ! Orbital information after processed by orbit_params - - real(r8) :: obliqr ! Earth's obliquity in radians - real(r8) :: lambm0 ! Mean longitude of perihelion at the vernal equinox (radians) - real(r8) :: mvelpp ! Earth's moving vernal equinox longitude of perihelion plus pi (radians) - -end module clm_varorb diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 deleted file mode 100644 index fbbfbf99ea..0000000000 --- a/src/utils/clmfates_interfaceMod.F90 +++ /dev/null @@ -1,2379 +0,0 @@ -module CLMFatesInterfaceMod - - ! ------------------------------------------------------------------------------------- - ! This module contains various functions and definitions to aid in the - ! coupling of the FATES library/API with the CLM/ALM/ATS/etc model driver. - ! All connections between the two models should occur in this file alone. - ! - ! This is also the only location where CLM code is allowed to see FATES memory - ! structures. - ! The routines here, that call FATES library routines, will not pass any types defined - ! by the driving land model (HLM). - ! - ! either native type arrays (int,real,log, etc) or packed into fates boundary condition - ! structures. - ! - ! Note that CLM/ALM does use Shared Memory Parallelism (SMP), where processes such as - ! the update of state variables are forked. However, IO is not assumed to be - ! threadsafe and therefore memory spaces reserved for IO must be continuous vectors, - ! and moreover they must be pushed/pulled from history IO for each individual - ! bounds_proc memory space as a unit. - ! - ! Therefore, the state variables in the clm_fates communicator is vectorized by - ! threadcount, and the IO communication arrays are not. - ! - ! - ! Conventions: - ! keep line widths within 90 spaces - ! HLM acronym = Host Land Model - ! - ! ------------------------------------------------------------------------------------- - - ! use ed_driver_interface, only: - - ! Used CLM Modules - use PatchType , only : patch - use shr_kind_mod , only : r8 => shr_kind_r8 - use decompMod , only : bounds_type - use WaterStateType , only : waterstate_type - use WaterFluxType , only : waterflux_type - use CanopyStateType , only : canopystate_type - use TemperatureType , only : temperature_type - use EnergyFluxType , only : energyflux_type - - use SoilStateType , only : soilstate_type - use clm_varctl , only : iulog - use clm_varctl , only : use_vertsoilc - use clm_varctl , only : use_fates_spitfire - use clm_varctl , only : use_fates_planthydro - use clm_varctl , only : use_fates_ed_st3 - use clm_varctl , only : use_fates_ed_prescribed_phys - use clm_varctl , only : use_fates_logging - use clm_varctl , only : use_fates_inventory_init - use clm_varctl , only : fates_inventory_ctrl_filename - - use clm_varcon , only : tfrz - use clm_varcon , only : spval - use clm_varcon , only : denice - use clm_varcon , only : ispval - - use clm_varpar , only : natpft_size - use clm_varpar , only : numrad - use clm_varpar , only : ivis - use clm_varpar , only : inir - use clm_varpar , only : nlevgrnd - use clm_varpar , only : nlevsoi - use clm_varpar , only : nlevdecomp - use clm_varpar , only : nlevdecomp_full - use PhotosynthesisMod , only : photosyns_type - use atm2lndType , only : atm2lnd_type - use SurfaceAlbedoType , only : surfalb_type - use SolarAbsorbedType , only : solarabs_type - use SoilBiogeochemCarbonFluxType, only : soilbiogeochem_carbonflux_type - use SoilBiogeochemCarbonStateType, only : soilbiogeochem_carbonstate_type - use FrictionVelocityMod , only : frictionvel_type - use clm_time_manager , only : is_restart - use ncdio_pio , only : file_desc_t, ncd_int, ncd_double - use restUtilMod, only : restartvar - use clm_time_manager , only : get_days_per_year, & - get_curr_date, & - get_ref_date, & - timemgr_datediff, & - is_beg_curr_day, & - get_step_size, & - get_nstep - use spmdMod , only : masterproc - use decompMod , only : get_proc_bounds, & - get_proc_clumps, & - get_clump_bounds - use GridCellType , only : grc - use ColumnType , only : col - use LandunitType , only : lun - use landunit_varcon , only : istsoil - use abortutils , only : endrun - use shr_log_mod , only : errMsg => shr_log_errMsg - use clm_varcon , only : dzsoi_decomp - use FuncPedotransferMod, only: get_ipedof -! use SoilWaterPlantSinkMod, only : Compute_EffecRootFrac_And_VertTranSink_Default - - ! Used FATES Modules - use FatesInterfaceMod , only : fates_interface_type - use FatesInterfaceMod , only : allocate_bcin - use FatesInterfaceMod , only : allocate_bcout - use FatesInterfaceMod , only : SetFatesTime - use FatesInterfaceMod , only : set_fates_ctrlparms - - use FatesHistoryInterfaceMod, only : fates_history_interface_type - use FatesRestartInterfaceMod, only : fates_restart_interface_type - - use ChecksBalancesMod , only : SummarizeNetFluxes, FATES_BGC_Carbon_BalanceCheck - use EDTypesMod , only : ed_patch_type - use FatesHydraulicsMemMod , only : nlevsoi_hyd - use FatesInterfaceMod , only : hlm_numlevgrnd, hlm_numlevsoil, hlm_numlevdecomp_full - use EDMainMod , only : ed_ecosystem_dynamics - use EDMainMod , only : ed_update_site - use EDInitMod , only : zero_site - use EDInitMod , only : init_site_vars - use EDInitMod , only : init_patches - use EDInitMod , only : set_site_properties - use EDPftVarcon , only : EDpftvarcon_inst - use EDSurfaceRadiationMod , only : ED_SunShadeFracs, ED_Norman_Radiation - use EDBtranMod , only : btran_ed, & - get_active_suction_layers - use EDCanopyStructureMod , only : canopy_summarization, update_hlm_dynamics - use FatesPlantRespPhotosynthMod, only : FatesPlantRespPhotosynthDrive - use EDAccumulateFluxesMod , only : AccumulateFluxes_ED - use EDPhysiologyMod , only : flux_into_litter_pools - use FatesPlantHydraulicsMod, only : hydraulics_drive - use FatesPlantHydraulicsMod, only : HydrSiteColdStart - use FatesPlantHydraulicsMod, only : InitHydrSites - use FatesPlantHydraulicsMod, only : UpdateH2OVeg - - implicit none - - type, public :: f2hmap_type - - ! This is the associated column index of each FATES site - integer, allocatable :: fcolumn (:) - - ! This is the associated site index of any HLM columns - ! This vector may be sparse, and non-sites have index 0 - integer, allocatable :: hsites (:) - - end type f2hmap_type - - - type, public :: hlm_fates_interface_type - - ! private - - - ! See above for descriptions of the sub-types populated - ! by thread. This type is somewhat self-explanatory, in that it simply - ! breaks up memory and process by thread. Each thread will have its - ! own list of sites, and boundary conditions for those sites - - type(fates_interface_type), allocatable :: fates (:) - - - ! This memory structure is used to map fates sites - ! into the host model. Currently, the FATES site - ! and its column number matching are its only members - - type(f2hmap_type), allocatable :: f2hmap(:) - - ! fates_hist is the interface class for the history output - type(fates_history_interface_type) :: fates_hist - - ! fates_restart is the inteface calss for restarting the model - type(fates_restart_interface_type) :: fates_restart - - contains - - procedure, public :: init - procedure, public :: check_hlm_active - procedure, public :: restart - procedure, public :: init_coldstart - procedure, public :: dynamics_driv - procedure, public :: wrap_sunfrac - procedure, public :: wrap_btran - procedure, public :: wrap_photosynthesis - procedure, public :: wrap_accumulatefluxes - procedure, public :: prep_canopyfluxes - procedure, public :: wrap_canopy_radiation - procedure, public :: wrap_bgc_summary - procedure, public :: TransferZ0mDisp - procedure, private :: init_history_io - procedure, private :: wrap_update_hlmfates_dyn - procedure, private :: init_soil_depths - procedure, public :: ComputeRootSoilFlux - procedure, public :: wrap_hydraulics_drive - - end type hlm_fates_interface_type - - ! hlm_bounds_to_fates_bounds is not currently called outside the interface. - ! Although there may be good reasons to, I privatized it so that the next - ! developer will at least question its usage (RGK) - private :: hlm_bounds_to_fates_bounds - - logical :: DEBUG = .false. - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - ! ==================================================================================== - - subroutine init(this, bounds_proc ) - - ! --------------------------------------------------------------------------------- - ! This initializes the hlm_fates_interface_type - ! - ! sites is the root of the fates state hierarchy (instantaneous info on - ! the state of the ecosystem). As such, it governs the connection points between - ! the host (which also dictates its allocation) and its patch structures. - ! - ! sites may associate with different scales in different models. In - ! CLM, it is being designed to relate to column scale. - ! - ! This global may become relegated to this module. - ! - ! Note: CLM/ALM currently wants sites to be allocated even if ed - ! is not turned on - ! --------------------------------------------------------------------------------- - - use FatesInterfaceMod, only : FatesInterfaceInit, FatesReportParameters - use FatesInterfaceMod, only : numpft_ed => numpft - use FatesParameterDerivedMod, only : param_derived - - implicit none - - ! Input Arguments - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_proc - - ! local variables - integer :: nclumps ! Number of threads - logical :: verbose_output - integer :: pass_masterproc - integer :: pass_vertsoilc - integer :: pass_spitfire - integer :: pass_ed_st3 - integer :: pass_ed_prescribed_phys - integer :: pass_logging - integer :: pass_planthydro - integer :: pass_inventory_init - integer :: pass_is_restart - integer :: nc ! thread index - integer :: s ! FATES site index - integer :: c ! HLM column index - integer :: l ! HLM LU index - integer :: g ! HLM grid index - integer :: pi,pf - integer, allocatable :: collist (:) - type(bounds_type) :: bounds_clump - integer :: nmaxcol - - ! Initialize the FATES communicators with the HLM - ! This involves to stages - ! 1) allocate the vectors - ! 2) add the history variables defined in clm_inst to the history machinery - - - ! Parameter Routines - call param_derived%Init( numpft_ed ) - - - verbose_output = .false. - call FatesInterfaceInit(iulog, verbose_output) - - nclumps = get_proc_clumps() - allocate(this%fates(nclumps)) - allocate(this%f2hmap(nclumps)) - - ! --------------------------------------------------------------------------------- - ! Send dimensions and other model controling parameters to FATES. These - ! are obviously only those parameters that are dictated by the host - ! --------------------------------------------------------------------------------- - - ! Force FATES parameters that are recieve type, to the unset value - call set_fates_ctrlparms('flush_to_unset') - - ! Send parameters individually - call set_fates_ctrlparms('num_sw_bbands',ival=numrad) - call set_fates_ctrlparms('vis_sw_index',ival=ivis) - call set_fates_ctrlparms('nir_sw_index',ival=inir) - - call set_fates_ctrlparms('num_lev_ground',ival=nlevgrnd) - call set_fates_ctrlparms('num_lev_soil',ival=nlevsoi) - call set_fates_ctrlparms('num_levdecomp',ival=nlevdecomp) - call set_fates_ctrlparms('num_levdecomp_full',ival=nlevdecomp_full) - call set_fates_ctrlparms('hlm_name',cval='CLM') - call set_fates_ctrlparms('hio_ignore_val',rval=spval) - call set_fates_ctrlparms('soilwater_ipedof',ival=get_ipedof(0)) - call set_fates_ctrlparms('max_patch_per_site',ival=(natpft_size-1)) ! RGK: FATES IGNORES - ! AND DOESNT TOUCH - ! THE BARE SOIL PATCH - - if(is_restart()) then - pass_is_restart = 1 - else - pass_is_restart = 0 - end if - call set_fates_ctrlparms('is_restart',ival=pass_is_restart) - - if(use_vertsoilc) then - pass_vertsoilc = 1 - else - pass_vertsoilc = 0 - end if - call set_fates_ctrlparms('use_vertsoilc',ival=pass_vertsoilc) - - if(use_fates_spitfire) then - pass_spitfire = 1 - else - pass_spitfire = 0 - end if - call set_fates_ctrlparms('use_spitfire',ival=pass_spitfire) - - if(use_fates_ed_st3) then - pass_ed_st3 = 1 - else - pass_ed_st3 = 0 - end if - call set_fates_ctrlparms('use_ed_st3',ival=pass_ed_st3) - - if(use_fates_ed_prescribed_phys) then - pass_ed_prescribed_phys = 1 - else - pass_ed_prescribed_phys = 0 - end if - call set_fates_ctrlparms('use_ed_prescribed_phys',ival=pass_ed_prescribed_phys) - - if(use_fates_planthydro) then - pass_planthydro = 1 - else - pass_planthydro = 0 - end if - call set_fates_ctrlparms('use_planthydro',ival=pass_planthydro) - - if(use_fates_logging) then - pass_logging = 1 - else - pass_logging = 0 - end if - call set_fates_ctrlparms('use_logging',ival=pass_logging) - - if(use_fates_inventory_init) then - pass_inventory_init = 1 - else - pass_inventory_init = 0 - end if - call set_fates_ctrlparms('use_inventory_init',ival=pass_inventory_init) - - call set_fates_ctrlparms('inventory_ctrl_file',cval=fates_inventory_ctrl_filename) - - - if(masterproc)then - pass_masterproc = 1 - else - pass_masterproc = 0 - end if - call set_fates_ctrlparms('masterproc',ival=pass_masterproc) - - ! Check through FATES parameters to see if all have been set - call set_fates_ctrlparms('check_allset') - - if(DEBUG)then - write(iulog,*) 'clm_fates%init(): allocating for ',nclumps,' threads' - end if - - - nclumps = get_proc_clumps() - - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,nmaxcol,s,c,l,g,collist,pi,pf) - do nc = 1,nclumps - - call get_clump_bounds(nc, bounds_clump) - nmaxcol = bounds_clump%endc - bounds_clump%begc + 1 - - allocate(collist(1:nmaxcol)) - - ! Allocate the mapping that points columns to FATES sites, 0 is NA - allocate(this%f2hmap(nc)%hsites(bounds_clump%begc:bounds_clump%endc)) - - ! Initialize all columns with a zero index, which indicates no FATES site - this%f2hmap(nc)%hsites(:) = 0 - - s = 0 - do c = bounds_clump%begc,bounds_clump%endc - l = col%landunit(c) - - ! These are the key constraints that determine if this column - ! will have a FATES site associated with it - - ! INTERF-TODO: WE HAVE NOT FILTERED OUT FATES SITES ON INACTIVE COLUMNS.. YET - ! NEED A RUN-TIME ROUTINE THAT CLEARS AND REWRITES THE SITE LIST - - if (lun%itype(l) == istsoil ) then - s = s + 1 - collist(s) = c - this%f2hmap(nc)%hsites(c) = s - if(DEBUG)then - write(iulog,*) 'clm_fates%init(): thread',nc,': found column',c,'with lu',l - write(iulog,*) 'LU type:', lun%itype(l) - end if - endif - - enddo - - if(DEBUG)then - write(iulog,*) 'clm_fates%init(): thread',nc,': allocated ',s,' sites' - end if - - ! Allocate vectors that match FATES sites with HLM columns - ! RGK: Sites and fcolumns are forced as args during clm_driv() as of 6/4/2016 - ! We may have to give these a dummy allocation of 1, which should - ! not be a problem since we always iterate on nsites. - - allocate(this%f2hmap(nc)%fcolumn(s)) - - ! Assign the h2hmap indexing - this%f2hmap(nc)%fcolumn(1:s) = collist(1:s) - - ! Deallocate the temporary arrays - deallocate(collist) - - ! Set the number of FATES sites - this%fates(nc)%nsites = s - - ! Allocate the FATES sites - allocate (this%fates(nc)%sites(this%fates(nc)%nsites)) - - ! Allocate the FATES boundary arrays (in) - allocate(this%fates(nc)%bc_in(this%fates(nc)%nsites)) - - ! Allocate the FATES boundary arrays (out) - allocate(this%fates(nc)%bc_out(this%fates(nc)%nsites)) - - ! Allocate and Initialize the Boundary Condition Arrays - ! These are staticaly allocated at maximums, so - ! No information about the patch or cohort structure is needed at this step - - do s = 1, this%fates(nc)%nsites - call allocate_bcin(this%fates(nc)%bc_in(s)) - call allocate_bcout(this%fates(nc)%bc_out(s)) - call this%fates(nc)%zero_bcs(s) - - ! Pass any grid-cell derived attributes to the site - ! --------------------------------------------------------------------------- - c = this%f2hmap(nc)%fcolumn(s) - g = col%gridcell(c) - this%fates(nc)%sites(s)%lat = grc%latdeg(g) - this%fates(nc)%sites(s)%lon = grc%londeg(g) - - end do - - - ! Initialize site-level static quantities dictated by the HLM - ! currently ground layering depth - - call this%init_soil_depths(nc) - - if (use_fates_planthydro) call InitHydrSites(this%fates(nc)%sites) - - - if( this%fates(nc)%nsites == 0 ) then - write(iulog,*) 'Clump ',nc,' had no valid FATES sites' - write(iulog,*) 'This will likely cause problems until code is improved' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - - ! Set patch itypes on natural veg columns to nonsense - ! This will force a crash if the model outside of FATES tries to think - ! of the patch as a PFT. - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - pi = col%patchi(c)+1 - pf = col%patchf(c) -! patch%itype(pi:pf) = ispval - patch%is_fates(pi:pf) = .true. - end do - - end do - !$OMP END PARALLEL DO - - - call this%init_history_io(bounds_proc) - - ! Report Fates Parameters (debug flag in lower level routines) - call FatesReportParameters(masterproc) - - end subroutine init - - ! =================================================================================== - - subroutine check_hlm_active(this, nc, bounds_clump) - - ! --------------------------------------------------------------------------------- - ! This subroutine is not currently used. It is just a utility that may come - ! in handy when we have dynamic sites in FATES - ! --------------------------------------------------------------------------------- - - implicit none - class(hlm_fates_interface_type), intent(inout) :: this - integer :: nc - type(bounds_type),intent(in) :: bounds_clump - - ! local variables - integer :: c - - do c = bounds_clump%begc,bounds_clump%endc - - ! FATES ACTIVE BUT HLM IS NOT - if(this%f2hmap(nc)%hsites(c)>0 .and. .not.col%active(c)) then - - write(iulog,*) 'INACTIVE COLUMN WITH ACTIVE FATES SITE' - write(iulog,*) 'c = ',c - call endrun(msg=errMsg(sourcefile, __LINE__)) - - elseif (this%f2hmap(nc)%hsites(c)==0 .and. col%active(c)) then - - write(iulog,*) 'ACTIVE COLUMN WITH INACTIVE FATES SITE' - write(iulog,*) 'c = ',c - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end do - - end subroutine check_hlm_active - - ! ------------------------------------------------------------------------------------ - - subroutine dynamics_driv(this, nc, bounds_clump, & - atm2lnd_inst, soilstate_inst, temperature_inst, & - waterstate_inst, canopystate_inst, soilbiogeochem_carbonflux_inst, & - frictionvel_inst ) - - ! This wrapper is called daily from clm_driver - ! This wrapper calls ed_driver, which is the daily dynamics component of FATES - ! ed_driver is not a hlm_fates_inst_type procedure because we need an extra step - ! to process array bounding information - - implicit none - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_clump - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(soilstate_type) , intent(in) :: soilstate_inst - type(temperature_type) , intent(in) :: temperature_inst - integer , intent(in) :: nc - type(waterstate_type) , intent(inout) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilbiogeochem_carbonflux_type), intent(inout) :: soilbiogeochem_carbonflux_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - ! !LOCAL VARIABLES: - integer :: s ! site index - integer :: c ! column index (HLM) - integer :: ifp ! patch index - integer :: p ! HLM patch index - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day - integer :: current_year - integer :: current_month - integer :: current_day - integer :: current_tod - integer :: current_date - integer :: jan01_curr_year - integer :: reference_date - integer :: days_per_year - real(r8) :: model_day - real(r8) :: day_of_year - !----------------------------------------------------------------------- - - ! --------------------------------------------------------------------------------- - ! Part I. - ! Prepare input boundary conditions for FATES dynamics - ! Note that timing information is the same across all sites, this may - ! seem redundant, but it is possible that we may have asynchronous site simulations - ! one day. The cost of holding site level boundary conditions is minimal - ! and it keeps all the boundaries in one location - ! --------------------------------------------------------------------------------- - - days_per_year = get_days_per_year() - call get_curr_date(current_year,current_month,current_day,current_tod) - current_date = current_year*10000 + current_month*100 + current_day - jan01_curr_year = current_year*10000 + 100 + 1 - - call get_ref_date(yr, mon, day, sec) - reference_date = yr*10000 + mon*100 + day - - call timemgr_datediff(reference_date, sec, current_date, current_tod, model_day) - - call timemgr_datediff(jan01_curr_year,0,current_date,sec,day_of_year) - - call SetFatesTime(current_year, current_month, & - current_day, current_tod, & - current_date, reference_date, & - model_day, floor(day_of_year), & - days_per_year, 1.0_r8/dble(days_per_year)) - - - do s=1,this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%h2o_liqvol_gl(1:nlevsoi) = & - waterstate_inst%h2osoi_vol_col(c,1:nlevsoi) - - ! TO-DO: SHOULD THIS BE LIQVOL OR IS VOL OK? (RGK-02-2017) - - this%fates(nc)%bc_in(s)%t_veg24_si = & - temperature_inst%t_veg24_patch(col%patchi(c)) - - this%fates(nc)%bc_in(s)%max_rooting_depth_index_col = canopystate_inst%altmax_lastyear_indx_col(c) - - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - p = ifp+col%patchi(c) - this%fates(nc)%bc_in(s)%t_veg24_pa(ifp) = & - temperature_inst%t_veg24_patch(p) - - this%fates(nc)%bc_in(s)%precip24_pa(ifp) = & - atm2lnd_inst%prec24_patch(p) - - this%fates(nc)%bc_in(s)%relhumid24_pa(ifp) = & - atm2lnd_inst%rh24_patch(p) - - this%fates(nc)%bc_in(s)%wind24_pa(ifp) = & - atm2lnd_inst%wind24_patch(p) - - end do - - - if(use_fates_planthydro)then - this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoi) = soilstate_inst%hksat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoi) = soilstate_inst%watsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoi) = soilstate_inst%watres_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoi) = soilstate_inst%sucsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoi) = soilstate_inst%bsw_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoi) = waterstate_inst%h2osoi_liq_col(c,1:nlevsoi) - end if - - - end do - - ! --------------------------------------------------------------------------------- - ! Part II: Call the FATES model now that input boundary conditions have been - ! provided. - ! --------------------------------------------------------------------------------- - - do s = 1,this%fates(nc)%nsites - - call ed_ecosystem_dynamics(this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s)) - - call ed_update_site(this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s)) - - enddo - - ! call subroutine to aggregate fates litter output fluxes and - ! package them for handing across interface - call flux_into_litter_pools(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out) - - - ! --------------------------------------------------------------------------------- - ! Part III: Process FATES output into the dimensions and structures that are part - ! of the HLMs API. (column, depth, and litter fractions) - ! --------------------------------------------------------------------------------- - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lab_c_col(c,:) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lab_c_col(:) - soilbiogeochem_carbonflux_inst%FATES_c_to_litr_cel_c_col(c,:) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_cel_c_col(:) - soilbiogeochem_carbonflux_inst%FATES_c_to_litr_lig_c_col(c,:) = & - this%fates(nc)%bc_out(s)%FATES_c_to_litr_lig_c_col(:) - end do - - - ! --------------------------------------------------------------------------------- - ! Part III.2 (continued). - ! Update diagnostics of the FATES ecosystem structure that are used in the HLM. - ! --------------------------------------------------------------------------------- - call this%wrap_update_hlmfates_dyn(nc, & - bounds_clump, & - waterstate_inst, & - canopystate_inst, & - frictionvel_inst) - - ! --------------------------------------------------------------------------------- - ! Part IV: - ! Update history IO fields that depend on ecosystem dynamics - ! --------------------------------------------------------------------------------- - call this%fates_hist%update_history_dyn( nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites) - - if (masterproc) then - write(iulog, *) 'clm: leaving fates model', bounds_clump%begg, & - bounds_clump%endg - end if - - - return - end subroutine dynamics_driv - - ! ------------------------------------------------------------------------------------ - - subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & - waterstate_inst, canopystate_inst, frictionvel_inst ) - - ! --------------------------------------------------------------------------------- - ! This routine handles the updating of vegetation canopy diagnostics, (such as lai) - ! that either requires HLM boundary conditions (like snow accumulation) or - ! provides boundary conditions (such as vegetation fractional coverage) - ! --------------------------------------------------------------------------------- - - implicit none - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_clump - integer , intent(in) :: nc - type(waterstate_type) , intent(inout) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - integer :: npatch ! number of patches in each site - integer :: ifp ! index FATES patch - integer :: p ! HLM patch index - integer :: s ! site index - integer :: c ! column index - - associate( & - tlai => canopystate_inst%tlai_patch , & - elai => canopystate_inst%elai_patch , & - tsai => canopystate_inst%tsai_patch , & - esai => canopystate_inst%esai_patch , & - htop => canopystate_inst%htop_patch , & - hbot => canopystate_inst%hbot_patch , & - z0m => frictionvel_inst%z0m_patch , & ! Output: [real(r8) (:) ] momentum roughness length (m) - displa => canopystate_inst%displa_patch, & - dleaf_patch => canopystate_inst%dleaf_patch, & - snow_depth => waterstate_inst%snow_depth_col, & - frac_sno_eff => waterstate_inst%frac_sno_eff_col, & - frac_veg_nosno_alb => canopystate_inst%frac_veg_nosno_alb_patch) - - - ! Process input boundary conditions to FATES - ! -------------------------------------------------------------------------------- - do s=1,this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%snow_depth_si = snow_depth(c) - this%fates(nc)%bc_in(s)%frac_sno_eff_si = frac_sno_eff(c) - end do - - ! Canopy diagnostics for FATES - call canopy_summarization(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in) - - ! Canopy diagnostic outputs for HLM - call update_hlm_dynamics(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%f2hmap(nc)%fcolumn, & - this%fates(nc)%bc_out ) - - !--------------------------------------------------------------------------------- - ! CHANGING STORED WATER DURING PLANT DYNAMICS IS NOT FULLY IMPLEMENTED - ! LEAVING AS A PLACE-HOLDER FOR NOW. - ! ! Diagnose water storage in canopy if hydraulics is on - ! ! This updates the internal value and the bc_out value. - ! ! If hydraulics is off, it returns 0 storage - ! if ( use_fates_planthydro ) then - ! call UpdateH2OVeg(this%fates(nc)%nsites, & - ! this%fates(nc)%sites, & - ! this%fates(nc)%bc_out) - ! - ! do s = 1, this%fates(nc)%nsites - ! c = this%f2hmap(nc)%fcolumn(s) - ! waterstate_inst%total_plant_stored_h2o_col(c) = & - ! this%fates(nc)%bc_out(s)%plant_stored_h2o_si - ! end do - ! end if - !--------------------------------------------------------------------------------- - - ! Convert FATES dynamics into HLM usable information - ! Initialize weighting variables (note FATES is the only HLM module - ! that uses "is_veg" and "is_bareground". The entire purpose of these - ! variables is to inform patch%wtcol(p). wt_ed is imposed on wtcol, - ! but only for FATES columns. - - patch%is_veg(bounds_clump%begp:bounds_clump%endp) = .false. - patch%is_bareground(bounds_clump%begp:bounds_clump%endp) = .false. - patch%wt_ed(bounds_clump%begp:bounds_clump%endp) = 0.0_r8 - - do s = 1,this%fates(nc)%nsites - - c = this%f2hmap(nc)%fcolumn(s) - - ! Other modules may have AI's we only flush values - ! that are on the naturally vegetated columns - elai(col%patchi(c):col%patchf(c)) = 0.0_r8 - tlai(col%patchi(c):col%patchf(c)) = 0.0_r8 - esai(col%patchi(c):col%patchf(c)) = 0.0_r8 - tsai(col%patchi(c):col%patchf(c)) = 0.0_r8 - htop(col%patchi(c):col%patchf(c)) = 0.0_r8 - hbot(col%patchi(c):col%patchf(c)) = 0.0_r8 - - ! FATES does not dictate bare-ground so turbulent - ! variables are not over-written. - z0m(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 - displa(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 - dleaf_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 - - frac_veg_nosno_alb(col%patchi(c):col%patchf(c)) = 0.0_r8 - - ! Set the bareground patch indicator - patch%is_bareground(col%patchi(c)) = .true. - npatch = this%fates(nc)%sites(s)%youngest_patch%patchno - patch%wt_ed(col%patchi(c)) = 1.0-sum(this%fates(nc)%bc_out(s)%canopy_fraction_pa(1:npatch)) - - if(sum(this%fates(nc)%bc_out(s)%canopy_fraction_pa(1:npatch))>1.0_r8)then - write(iulog,*)'Projected Canopy Area of all FATES patches' - write(iulog,*)'cannot exceed 1.0' - !end_run() - end if - - do ifp = 1, npatch - - p = ifp+col%patchi(c) - - ! bc_out(s)%canopy_fraction_pa(ifp) is the area fraction - ! the site's total ground area that is occupied by the - ! area footprint of the current patch's vegetation canopy - - patch%is_veg(p) = .true. - patch%wt_ed(p) = this%fates(nc)%bc_out(s)%canopy_fraction_pa(ifp) - elai(p) = this%fates(nc)%bc_out(s)%elai_pa(ifp) - tlai(p) = this%fates(nc)%bc_out(s)%tlai_pa(ifp) - esai(p) = this%fates(nc)%bc_out(s)%esai_pa(ifp) - tsai(p) = this%fates(nc)%bc_out(s)%tsai_pa(ifp) - hbot(p) = this%fates(nc)%bc_out(s)%hbot_pa(ifp) - htop(p) = this%fates(nc)%bc_out(s)%htop_pa(ifp) - frac_veg_nosno_alb(p) = this%fates(nc)%bc_out(s)%frac_veg_nosno_alb_pa(ifp) - - ! Note that while we pass the following values at this point - ! we have to send the same values after each time-step because - ! the HLM keeps changing the value and re-setting, so we - ! re-send instead of re-set. See clm_fates%TransferZ0mDisp() - z0m(p) = this%fates(nc)%bc_out(s)%z0m_pa(ifp) - displa(p) = this%fates(nc)%bc_out(s)%displa_pa(ifp) - dleaf_patch(p) = this%fates(nc)%bc_out(s)%dleaf_pa(ifp) - - - end do - - end do - end associate - end subroutine wrap_update_hlmfates_dyn - - ! ==================================================================================== - - subroutine restart( this, bounds_proc, ncid, flag, waterstate_inst, & - canopystate_inst, frictionvel_inst ) - - ! --------------------------------------------------------------------------------- - ! The ability to restart the model is handled through three different types of calls - ! "Define" the variables in the restart file, we "read" those variables into memory - ! or "write" data into the file from memory. This subroutine accomodates all three - ! of those modes through the "flag" argument. FATES as an external model also - ! requires an initialization step, where we set-up the dimensions, allocate and - ! flush the memory space that is used to transfer data in and out of the file. This - ! Only occurs once, where as the define step occurs every time a file is opened. - ! - ! Note: waterstate_inst and canopystate_inst are arguments only because following - ! the reading of variables, it is necessary to update diagnostics of the canopy - ! throug the interface call clm_fates%wrap_update_hlmfates_dyn() which requires - ! this information from the HLM. - ! --------------------------------------------------------------------------------- - - - use FatesConstantsMod, only : fates_long_string_length - use FatesIODimensionsMod, only: fates_bounds_type - use FatesIOVariableKindMod, only : site_r8, site_int, cohort_r8, cohort_int - use EDMainMod, only : ed_update_site - use FatesInterfaceMod, only: fates_maxElementsPerSite - - implicit none - - ! Arguments - - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type) , intent(in) :: bounds_proc - type(file_desc_t) , intent(inout) :: ncid ! netcdf id - character(len=*) , intent(in) :: flag - type(waterstate_type) , intent(inout) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - ! Locals - type(bounds_type) :: bounds_clump - integer :: nc - integer :: nclumps - type(fates_bounds_type) :: fates_bounds - type(fates_bounds_type) :: fates_clump - integer :: c ! HLM column index - integer :: s ! Fates site index - integer :: g ! grid-cell index - integer :: dk_index - character(len=fates_long_string_length) :: ioname - integer :: nvar - integer :: ivar - logical :: readvar - - logical, save :: initialized = .false. - - - nclumps = get_proc_clumps() - - ! --------------------------------------------------------------------------------- - ! note (rgk: 11-2016) The history and restart intialization process assumes - ! that the number of site/columns active is a static entity. Thus - ! we only allocate the mapping tables for the column/sites we start with. - ! If/when we start having dynamic column/sites (for reasons uknown as of yet) - ! we will need to re-evaluate the allocation of the mapping tables so they - ! can be unallocated,reallocated and set every time a new column/site is spawned - ! --------------------------------------------------------------------------------- - - ! --------------------------------------------------------------------------------- - ! Only initialize the FATES restart structures the first time it is called - ! Note that the allocations involved with initialization are static. - ! This is because the array spaces for IO span the entire column, patch and cohort - ! range on the proc. - ! With DYNAMIC LANDUNITS or SPAWNING NEW OR CULLING OLD SITES: - ! we will in that case have to de-allocate, reallocate and then re-set the mapping - ! tables: this%fates_restart%restart_map(nc) - ! I think that is it... - ! --------------------------------------------------------------------------------- - - if(.not.initialized) then - - initialized=.true. - - ! ------------------------------------------------------------------------------ - ! PART I: Set FATES DIMENSIONING INFORMATION - ! ------------------------------------------------------------------------------ - - call hlm_bounds_to_fates_bounds(bounds_proc, fates_bounds) - - call this%fates_restart%Init(nclumps, fates_bounds) - - ! Define the bounds on the first dimension for each thread - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,fates_clump) - do nc = 1,nclumps - call get_clump_bounds(nc, bounds_clump) - - ! thread bounds for patch - call hlm_bounds_to_fates_bounds(bounds_clump, fates_clump) - call this%fates_restart%SetThreadBoundsEach(nc, fates_clump) - end do - !$OMP END PARALLEL DO - - !$OMP PARALLEL DO PRIVATE (nc,s,c,g,bounds_clump) - do nc = 1,nclumps - - call get_clump_bounds(nc, bounds_clump) - allocate(this%fates_restart%restart_map(nc)%site_index(this%fates(nc)%nsites)) - allocate(this%fates_restart%restart_map(nc)%cohort1_index(this%fates(nc)%nsites)) - do s=1,this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates_restart%restart_map(nc)%site_index(s) = c - g = col%gridcell(c) - this%fates_restart%restart_map(nc)%cohort1_index(s) = (g-1)*fates_maxElementsPerSite + 1 - end do - - end do - !$OMP END PARALLEL DO - - ! ------------------------------------------------------------------------------------ - ! PART II: USE THE JUST DEFINED DIMENSIONS TO ASSEMBLE THE VALID IO TYPES - ! INTERF-TODO: THESE CAN ALL BE EMBEDDED INTO A SUBROUTINE IN HISTORYIOMOD - ! ------------------------------------------------------------------------------------ - call this%fates_restart%assemble_restart_output_types() - - - ! ------------------------------------------------------------------------------------ - ! PART III: DEFINE THE LIST OF OUTPUT VARIABLE OBJECTS, AND REGISTER THEM WITH THE - ! HLM ACCORDING TO THEIR TYPES - ! ------------------------------------------------------------------------------------ - call this%fates_restart%initialize_restart_vars() - - end if - - ! --------------------------------------------------------------------------------- - ! If we are writing, we must loop through our linked list structures and transfer the - ! information in the linked lists (FATES state memory) to the output vectors. - ! --------------------------------------------------------------------------------- - - if(flag=='write')then - !$OMP PARALLEL DO PRIVATE (nc) - do nc = 1, nclumps - if (this%fates(nc)%nsites>0) then - call this%fates_restart%set_restart_vectors(nc,this%fates(nc)%nsites, & - this%fates(nc)%sites) - end if - end do - !$OMP END PARALLEL DO - end if - - ! --------------------------------------------------------------------------------- - ! In all cases, iterate through the list of variable objects - ! and either define, write or read to the NC buffer - ! This seems strange, but keep in mind that the call to restartvar() - ! has a different function in all three cases. - ! --------------------------------------------------------------------------------- - - nvar = this%fates_restart%num_restart_vars() - do ivar = 1, nvar - - associate( vname => this%fates_restart%rvars(ivar)%vname, & - vunits => this%fates_restart%rvars(ivar)%units, & - vlong => this%fates_restart%rvars(ivar)%long ) - - dk_index = this%fates_restart%rvars(ivar)%dim_kinds_index - ioname = trim(this%fates_restart%dim_kinds(dk_index)%name) - - select case(trim(ioname)) - case(cohort_r8) - - call restartvar(ncid=ncid, flag=flag, varname=trim(vname), & - xtype=ncd_double,dim1name=trim('cohort'),long_name=trim(vlong), & - units=trim(vunits),interpinic_flag='interp', & - data=this%fates_restart%rvars(ivar)%r81d,readvar=readvar) - - case(site_r8) - - call restartvar(ncid=ncid, flag=flag, varname=trim(vname), & - xtype=ncd_double,dim1name=trim('column'),long_name=trim(vlong), & - units=trim(vunits),interpinic_flag='interp', & - data=this%fates_restart%rvars(ivar)%r81d,readvar=readvar) - - case(cohort_int) - - call restartvar(ncid=ncid, flag=flag, varname=trim(vname), & - xtype=ncd_int,dim1name=trim('cohort'),long_name=trim(vlong), & - units=trim(vunits),interpinic_flag='interp', & - data=this%fates_restart%rvars(ivar)%int1d,readvar=readvar) - - case(site_int) - - call restartvar(ncid=ncid, flag=flag, varname=trim(vname), & - xtype=ncd_int,dim1name=trim('column'),long_name=trim(vlong), & - units=trim(vunits),interpinic_flag='interp', & - data=this%fates_restart%rvars(ivar)%int1d,readvar=readvar) - - case default - write(iulog,*) 'A FATES iotype was created that was not registerred' - write(iulog,*) 'in CLM.:',trim(ioname) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - end associate - end do - - ! --------------------------------------------------------------------------------- - ! If we are in a read mode, then we have just populated the sparse vectors - ! in the IO object list. The data in these vectors needs to be transferred - ! to the linked lists to populate the state memory. - ! --------------------------------------------------------------------------------- - - if(flag=='read')then - - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s) - do nc = 1, nclumps - if (this%fates(nc)%nsites>0) then - - call get_clump_bounds(nc, bounds_clump) - - ! ------------------------------------------------------------------------ - ! Convert newly read-in vectors into the FATES namelist state variables - ! ------------------------------------------------------------------------ - call this%fates_restart%create_patchcohort_structure(nc, & - this%fates(nc)%nsites, this%fates(nc)%sites, this%fates(nc)%bc_in) - - call this%fates_restart%get_restart_vectors(nc, this%fates(nc)%nsites, & - this%fates(nc)%sites ) - - ! I think ed_update_site and update_hlmfates_dyn are doing some similar - ! update type stuff, should consolidate (rgk 11-2016) - do s = 1,this%fates(nc)%nsites - call ed_update_site( this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s) ) - end do - - ! ------------------------------------------------------------------------ - ! Update diagnostics of FATES ecosystem structure used in HLM. - ! ------------------------------------------------------------------------ - call this%wrap_update_hlmfates_dyn(nc,bounds_clump, & - waterstate_inst,canopystate_inst,frictionvel_inst) - - ! ------------------------------------------------------------------------ - ! Update history IO fields that depend on ecosystem dynamics - ! ------------------------------------------------------------------------ - call this%fates_hist%update_history_dyn( nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites) - - - end if - end do - !$OMP END PARALLEL DO - - end if - - return - end subroutine restart - - !===================================================================================== - - subroutine init_coldstart(this, waterstate_inst, canopystate_inst, soilstate_inst, frictionvel_inst) - - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - type(waterstate_type) , intent(inout) :: waterstate_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(soilstate_type) , intent(inout) :: soilstate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - ! locals - integer :: nclumps - integer :: nc - type(bounds_type) :: bounds_clump - ! locals - real(r8) :: vol_ice - real(r8) :: eff_porosity - integer :: j - integer :: s - integer :: c - - nclumps = get_proc_clumps() - - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,s,c,j,vol_ice,eff_porosity) - do nc = 1, nclumps - - if ( this%fates(nc)%nsites>0 ) then - - call get_clump_bounds(nc, bounds_clump) - - do s = 1,this%fates(nc)%nsites - call init_site_vars(this%fates(nc)%sites(s)) - call zero_site(this%fates(nc)%sites(s)) - end do - - call set_site_properties(this%fates(nc)%nsites, this%fates(nc)%sites) - - ! ---------------------------------------------------------------------------- - ! Initialize Hydraulics Code if turned on - ! Called prior to init_patches(). Site level rhizosphere shells must - ! be set prior to cohort initialization. - ! ---------------------------------------------------------------------------- - if (use_fates_planthydro) then - - do s = 1,this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - - this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoi) = & - soilstate_inst%watsat_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoi) = & - soilstate_inst%watres_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoi) = & - soilstate_inst%sucsat_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoi) = & - soilstate_inst%bsw_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoi) = & - waterstate_inst%h2osoi_liq_col(c,1:nlevsoi) - - this%fates(nc)%bc_in(s)%hksat_sisl(1:nlevsoi) = & - soilstate_inst%hksat_col(c,1:nlevsoi) - - do j = 1, nlevsoi - vol_ice = min(soilstate_inst%watsat_col(c,j), & - waterstate_inst%h2osoi_ice_col(c,j)/(col%dz(c,j)*denice)) - eff_porosity = max(0.01_r8,soilstate_inst%watsat_col(c,j)-vol_ice) - this%fates(nc)%bc_in(s)%eff_porosity_gl(j) = eff_porosity - end do - - end do - - if (use_fates_planthydro) call HydrSiteColdStart(this%fates(nc)%sites,this%fates(nc)%bc_in) - end if - - call init_patches(this%fates(nc)%nsites, this%fates(nc)%sites, & - this%fates(nc)%bc_in) - - do s = 1,this%fates(nc)%nsites - call ed_update_site(this%fates(nc)%sites(s), & - this%fates(nc)%bc_in(s)) - end do - - ! ------------------------------------------------------------------------ - ! Update diagnostics of FATES ecosystem structure used in HLM. - ! ------------------------------------------------------------------------ - call this%wrap_update_hlmfates_dyn(nc,bounds_clump, & - waterstate_inst,canopystate_inst,frictionvel_inst) - - ! ------------------------------------------------------------------------ - ! Update history IO fields that depend on ecosystem dynamics - ! ------------------------------------------------------------------------ - call this%fates_hist%update_history_dyn( nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites) - - - - end if - end do - !$OMP END PARALLEL DO - - end subroutine init_coldstart - - ! ====================================================================================== - - subroutine wrap_sunfrac(this,nc,atm2lnd_inst,canopystate_inst) - - ! --------------------------------------------------------------------------------- - ! This interface function is a wrapper call on ED_SunShadeFracs. The only - ! returned variable is a patch vector, fsun_patch, which describes the fraction - ! of the canopy that is exposed to sun. - ! --------------------------------------------------------------------------------- - - implicit none - - ! Input Arguments - class(hlm_fates_interface_type), intent(inout) :: this - - integer, intent(in) :: nc - - ! direct and diffuse downwelling radiation (W/m2) - type(atm2lnd_type),intent(in) :: atm2lnd_inst - - ! Input/Output Arguments to CLM - type(canopystate_type),intent(inout) :: canopystate_inst - - ! Local Variables - integer :: p ! global index of the host patch - integer :: g ! global index of the host gridcell - integer :: c ! global index of the host column - - integer :: s ! FATES site index - integer :: ifp ! FATEs patch index - ! this is the order increment of patch - ! on the site - - type(ed_patch_type), pointer :: cpatch ! c"urrent" patch INTERF-TODO: SHOULD - ! BE HIDDEN AS A FATES PRIVATE - - associate( forc_solad => atm2lnd_inst%forc_solad_grc, & - forc_solai => atm2lnd_inst%forc_solai_grc, & - fsun => canopystate_inst%fsun_patch, & - laisun => canopystate_inst%laisun_patch, & - laisha => canopystate_inst%laisha_patch ) - - ! ------------------------------------------------------------------------------- - ! Convert input BC's - ! The sun-shade calculations are performed only on FATES patches - ! ------------------------------------------------------------------------------- - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - g = col%gridcell(c) - - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - !do ifp = 1, this%fates(nc)%bc_in(s)%npatches - - p = ifp+col%patchi(c) - - this%fates(nc)%bc_in(s)%solad_parb(ifp,:) = forc_solad(g,:) - this%fates(nc)%bc_in(s)%solai_parb(ifp,:) = forc_solai(g,:) - - end do - end do - - ! ------------------------------------------------------------------------------- - ! Call FATES public function to calculate internal sun/shade structures - ! as well as total patch sun/shade fraction output boundary condition - ! ------------------------------------------------------------------------------- - - call ED_SunShadeFracs(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out) - - ! ------------------------------------------------------------------------------- - ! Transfer the FATES output boundary condition for canopy sun/shade fraction - ! to the HLM - ! ------------------------------------------------------------------------------- - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - p = ifp+col%patchi(c) - fsun(p) = this%fates(nc)%bc_out(s)%fsun_pa(ifp) - laisun(p) = this%fates(nc)%bc_out(s)%laisun_pa(ifp) - laisha(p) = this%fates(nc)%bc_out(s)%laisha_pa(ifp) - end do - end do - - end associate - - end subroutine wrap_sunfrac - - ! =================================================================================== - - subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) - - ! ---------------------------------------------------------------------- - ! the main function for calculating photosynthesis is called within a - ! loop based on convergence. Some intitializations, including - ! canopy resistance must be intitialized before the loop - ! ---------------------------------------------------------------------- - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - integer, intent(in) :: nc - integer, intent(in) :: fn - integer, intent(in) :: filterp(fn) - type(photosyns_type),intent(inout) :: photosyns_inst - ! locals - integer :: f,p,c,s - ! parameters - integer,parameter :: rsmax0 = 2.e4_r8 - - do s = 1, this%fates(nc)%nsites - ! filter flag == 1 means that this patch has not been called for photosynthesis - this%fates(nc)%bc_in(s)%filter_photo_pa(:) = 1 - end do - end subroutine prep_canopyfluxes - - ! ==================================================================================== - - subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, waterstate_inst, & - temperature_inst, energyflux_inst, & - soil_water_retention_curve) - - ! --------------------------------------------------------------------------------- - ! This subroutine calculates btran for FATES, this will be an input boundary - ! condition for FATES photosynthesis/transpiration. - ! - ! This subroutine also calculates rootr - ! - ! --------------------------------------------------------------------------------- - - use SoilWaterRetentionCurveMod, only : soil_water_retention_curve_type - - implicit none - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - integer , intent(in) :: nc - integer , intent(in) :: fn - integer , intent(in) :: filterc(fn) ! This is a list of - ! columns with exposed veg - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterstate_type) , intent(in) :: waterstate_inst - type(temperature_type) , intent(in) :: temperature_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - class(soil_water_retention_curve_type), intent(in) :: soil_water_retention_curve - - ! local variables - real(r8) :: smp_node ! Soil suction potential, negative, [mm] - real(r8) :: s_node - integer :: s - integer :: c - integer :: j - integer :: ifp - integer :: p - - associate(& - sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) - watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) - bsw => soilstate_inst%bsw_col , & ! Input: [real(r8) (:,:) ] Clapp and Hornberger "b" - eff_porosity => soilstate_inst%eff_porosity_col , & ! Input: [real(r8) (:,:) ] effective porosity = porosity - vol_ice - t_soisno => temperature_inst%t_soisno_col , & ! Input: [real(r8) (:,:) ] soil temperature (Kelvin) - h2osoi_liqvol => waterstate_inst%h2osoi_liqvol_col , & ! Input: [real(r8) (:,:) ] liquid volumetric moisture, will be used for BeTR - btran => energyflux_inst%btran_patch , & ! Output: [real(r8) (:) ] transpiration wetness factor (0 to 1) - btran2 => energyflux_inst%btran2_patch , & ! Output: [real(r8) (:) ] - rresis => energyflux_inst%rresis_patch , & ! Output: [real(r8) (:,:) ] root resistance by layer (0-1) (nlevgrnd) - rootr => soilstate_inst%rootr_patch & ! Output: [real(r8) (:,:) ] Fraction of water uptake in each layer - ) - - ! ------------------------------------------------------------------------------- - ! Convert input BC's - ! Critical step: a filter is being passed in that dictates which columns have - ! exposed vegetation (above snow). This is necessary, because various hydrologic - ! variables like h2osoi_liqvol are not calculated and will have uninitialized - ! values outside this list. - ! - ! bc_in(s)%filter_btran (this is in, but is also used in this subroutine) - ! - ! We also filter a second time within this list by determining which soil layers - ! have conditions for active uptake based on soil moisture and temperature. This - ! must be determined by FATES (science stuff). But the list of layers and patches - ! needs to be passed back to the interface, because it then needs to request - ! suction on these layers via CLM/ALM functions. We cannot wide-swath calculate - ! this on all layers, because values with no moisture or low temps will generate - ! unstable values and cause sigtraps. - ! ------------------------------------------------------------------------------- - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - - ! Check to see if this column is in the exposed veg filter - if( any(filterc==c) )then - - this%fates(nc)%bc_in(s)%filter_btran = .true. - do j = 1,nlevgrnd - this%fates(nc)%bc_in(s)%tempk_gl(j) = t_soisno(c,j) - this%fates(nc)%bc_in(s)%h2o_liqvol_gl(j) = h2osoi_liqvol(c,j) - this%fates(nc)%bc_in(s)%eff_porosity_gl(j) = eff_porosity(c,j) - this%fates(nc)%bc_in(s)%watsat_gl(j) = watsat(c,j) - end do - - else - this%fates(nc)%bc_in(s)%filter_btran = .false. - this%fates(nc)%bc_in(s)%tempk_gl(:) = -999._r8 - this%fates(nc)%bc_in(s)%h2o_liqvol_gl(:) = -999._r8 - this%fates(nc)%bc_in(s)%eff_porosity_gl(:) = -999._r8 - this%fates(nc)%bc_in(s)%watsat_gl(:) = -999._r8 - end if - - end do - - ! ------------------------------------------------------------------------------- - ! This function evaluates the ground layer to determine if - ! root water uptake can happen, and soil suction should even - ! be calculated. We ask FATES for a boundary condition output - ! logical because we don't want science calculations in the interface - ! yet... hydrology (suction calculation) is provided by the host - ! so we need fates to tell us where to calculate suction - ! but not calculate it itself. Yeah, complicated, but thats life. - ! ------------------------------------------------------------------------------- - call get_active_suction_layers(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out) - - ! Now that the active layers of water uptake have been decided by fates - ! Calculate the suction that is passed back to fates - ! Note that the filter_btran is unioned with active_suction_gl - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - do j = 1,nlevgrnd - if(this%fates(nc)%bc_out(s)%active_suction_gl(j)) then - s_node = max(h2osoi_liqvol(c,j)/eff_porosity(c,j),0.01_r8) - call soil_water_retention_curve%soil_suction(c,j,s_node, soilstate_inst, smp_node) - this%fates(nc)%bc_in(s)%smp_gl(j) = smp_node - end if - end do - end do - - ! ------------------------------------------------------------------------------- - ! Suction and active uptake layers calculated, lets calculate uptake (btran) - ! This will calculate internals, as well as output boundary conditions: - ! btran, rootr - ! ------------------------------------------------------------------------------- - - call btran_ed(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out) - - ! ------------------------------------------------------------------------------- - ! Convert output BC's - ! For CLM/ALM this wrapper provides return variables that should - ! be similar to that of calc_root_moist_stress(). However, - ! CLM/ALM-FATES simulations will no make use of rresis, btran or btran2 - ! outside of FATES. We do not have code in place to calculate btran2 or - ! rresis right now, so we force to bad. We have btran calculated so we - ! pass it in case people want diagnostics. rootr is actually the only - ! variable that will be used, as it is needed to help distribute the - ! the transpiration sink to the appropriate layers. (RGK) - ! ------------------------------------------------------------------------------- - - do s = 1, this%fates(nc)%nsites - - c = this%f2hmap(nc)%fcolumn(s) - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - - p = ifp+col%patchi(c) - - do j = 1,nlevgrnd - - rresis(p,j) = -999.9 ! We do not calculate this correctly - ! it should not thought of as valid output until we decide to. - rootr(p,j) = this%fates(nc)%bc_out(s)%rootr_pagl(ifp,j) - btran(p) = this%fates(nc)%bc_out(s)%btran_pa(ifp) - btran2(p) = -999.9 ! Not available, force to nonsense - - end do - end do - end do - end associate - - end subroutine wrap_btran - - ! ==================================================================================== - - subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & - esat_tv, eair, oair, cair, rb, dayl_factor, & - atm2lnd_inst, temperature_inst, canopystate_inst, photosyns_inst) - - use shr_log_mod , only : errMsg => shr_log_errMsg - use abortutils , only : endrun - use decompMod , only : bounds_type - use clm_varcon , only : rgas, tfrz, namep - use clm_varpar , only : nlevsoi - use clm_varctl , only : iulog - use pftconMod , only : pftcon - use perf_mod , only : t_startf, t_stopf - use PatchType , only : patch - use quadraticMod , only : quadratic - use EDTypesMod , only : dinc_ed - use EDtypesMod , only : ed_patch_type, ed_cohort_type, ed_site_type - - ! - ! !ARGUMENTS: - class(hlm_fates_interface_type), intent(inout) :: this - integer , intent(in) :: nc ! clump index - type(bounds_type) , intent(in) :: bounds - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - real(r8) , intent(in) :: esat_tv(bounds%begp: ) ! saturation vapor pressure at t_veg (Pa) - real(r8) , intent(in) :: eair( bounds%begp: ) ! vapor pressure of canopy air (Pa) - real(r8) , intent(in) :: oair( bounds%begp: ) ! Atmospheric O2 partial pressure (Pa) - real(r8) , intent(in) :: cair( bounds%begp: ) ! Atmospheric CO2 partial pressure (Pa) - real(r8) , intent(in) :: rb( bounds%begp: ) ! boundary layer resistance (s/m) - real(r8) , intent(in) :: dayl_factor( bounds%begp: ) ! scalar (0-1) for daylength - type(atm2lnd_type) , intent(in) :: atm2lnd_inst - type(temperature_type) , intent(in) :: temperature_inst - type(canopystate_type) , intent(inout) :: canopystate_inst - type(photosyns_type) , intent(inout) :: photosyns_inst - - integer :: s,c,p,ifp,j,icp - real(r8) :: dtime - - call t_startf('edpsn') - associate(& - t_soisno => temperature_inst%t_soisno_col , & - t_veg => temperature_inst%t_veg_patch , & - tgcm => temperature_inst%thm_patch , & - forc_pbot => atm2lnd_inst%forc_pbot_downscaled_col, & - rssun => photosyns_inst%rssun_patch , & - rssha => photosyns_inst%rssha_patch, & - psnsun => photosyns_inst%psnsun_patch, & - psnsha => photosyns_inst%psnsha_patch) - - do s = 1, this%fates(nc)%nsites - - c = this%f2hmap(nc)%fcolumn(s) - - do j = 1,nlevsoi - this%fates(nc)%bc_in(s)%t_soisno_gl(j) = t_soisno(c,j) ! soil temperature (Kelvin) - end do - this%fates(nc)%bc_in(s)%forc_pbot = forc_pbot(c) ! atmospheric pressure (Pa) - - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - - p = ifp+col%patchi(c) - - ! Check to see if this patch is in the filter - ! Note that this filter is most likely changing size, and getting smaller - ! and smaller as more patch have converged on solution - if( any(filterp==p) )then - - ! This filter is flushed to 1 before the canopyflux stability iterator - ! It is set to status 2 if it is an active patch within the iterative loop - ! After photosynthesis is called, it is upgraded to 3 if it was called. - ! After all iterations we can evaluate which patches have a final flag - ! of 3 to check if we missed any. - - this%fates(nc)%bc_in(s)%filter_photo_pa(ifp) = 2 - this%fates(nc)%bc_in(s)%dayl_factor_pa(ifp) = dayl_factor(p) ! scalar (0-1) for daylength - this%fates(nc)%bc_in(s)%esat_tv_pa(ifp) = esat_tv(p) ! saturation vapor pressure at t_veg (Pa) - this%fates(nc)%bc_in(s)%eair_pa(ifp) = eair(p) ! vapor pressure of canopy air (Pa) - this%fates(nc)%bc_in(s)%oair_pa(ifp) = oair(p) ! Atmospheric O2 partial pressure (Pa) - this%fates(nc)%bc_in(s)%cair_pa(ifp) = cair(p) ! Atmospheric CO2 partial pressure (Pa) - this%fates(nc)%bc_in(s)%rb_pa(ifp) = rb(p) ! boundary layer resistance (s/m) - this%fates(nc)%bc_in(s)%t_veg_pa(ifp) = t_veg(p) ! vegetation temperature (Kelvin) - this%fates(nc)%bc_in(s)%tgcm_pa(ifp) = tgcm(p) ! air temperature at agcm reference height (kelvin) - end if - end do - end do - - dtime = get_step_size() - - ! Call photosynthesis - - call FatesPlantRespPhotosynthDrive (this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out, & - dtime) - - ! Perform a double check to see if all patches on naturally vegetated columns - ! were activated for photosynthesis - ! --------------------------------------------------------------------------------- - do icp = 1,fn - p = filterp(icp) - c = patch%column(p) - s = this%f2hmap(nc)%hsites(c) - ! do if structure here and only pass natveg columns - ifp = p-col%patchi(c) - if(this%fates(nc)%bc_in(s)%filter_photo_pa(ifp) /= 2)then - write(iulog,*) 'Not all patches on the natveg column in the photosynthesis' - write(iulog,*) 'filter ran photosynthesis' - call endrun(msg=errMsg(sourcefile, __LINE__)) - else - this%fates(nc)%bc_in(s)%filter_photo_pa(ifp) = 3 - rssun(p) = this%fates(nc)%bc_out(s)%rssun_pa(ifp) - rssha(p) = this%fates(nc)%bc_out(s)%rssha_pa(ifp) - - ! These fields are marked with a bad-value flag - photosyns_inst%psnsun_patch(p) = spval - photosyns_inst%psnsha_patch(p) = spval - end if - end do - - end associate - call t_stopf('edpsn') - - end subroutine wrap_photosynthesis - - ! ====================================================================================== - - subroutine wrap_accumulatefluxes(this, nc, fn, filterp) - - ! !ARGUMENTS: - class(hlm_fates_interface_type), intent(inout) :: this - integer , intent(in) :: nc ! clump index - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - - integer :: s,c,p,ifp,icp - real(r8) :: dtime - - - ! Run a check on the filter - do icp = 1,fn - p = filterp(icp) - c = patch%column(p) - s = this%f2hmap(nc)%hsites(c) - ifp = p-col%patchi(c) - if(this%fates(nc)%bc_in(s)%filter_photo_pa(ifp) /= 3)then - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - end do - - - dtime = get_step_size() - call AccumulateFluxes_ED(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out, & - dtime) - - - call this%fates_hist%update_history_prod(nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites, & - dtime) - - end subroutine wrap_accumulatefluxes - - ! ====================================================================================== - - subroutine wrap_canopy_radiation(this, bounds_clump, nc, & - num_vegsol, filter_vegsol, coszen, surfalb_inst) - - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type), intent(in) :: bounds_clump - ! filter for vegetated pfts with coszen>0 - integer , intent(in) :: nc ! clump index - integer , intent(in) :: num_vegsol - integer , intent(in) :: filter_vegsol(num_vegsol) - ! cosine solar zenith angle for next time step - real(r8) , intent(in) :: coszen( bounds_clump%begp: ) - type(surfalb_type) , intent(inout) :: surfalb_inst - - ! locals - integer :: s,c,p,ifp,icp - - associate(& - albgrd_col => surfalb_inst%albgrd_col , & !in - albgri_col => surfalb_inst%albgri_col , & !in - albd => surfalb_inst%albd_patch , & !out - albi => surfalb_inst%albi_patch , & !out - fabd => surfalb_inst%fabd_patch , & !out - fabi => surfalb_inst%fabi_patch , & !out - ftdd => surfalb_inst%ftdd_patch , & !out - ftid => surfalb_inst%ftid_patch , & !out - ftii => surfalb_inst%ftii_patch) !out - - do s = 1, this%fates(nc)%nsites - - c = this%f2hmap(nc)%fcolumn(s) - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - - p = ifp+col%patchi(c) - - if( any(filter_vegsol==p) )then - - this%fates(nc)%bc_in(s)%filter_vegzen_pa(ifp) = .true. - this%fates(nc)%bc_in(s)%coszen_pa(ifp) = coszen(p) - this%fates(nc)%bc_in(s)%albgr_dir_rb(:) = albgrd_col(c,:) - this%fates(nc)%bc_in(s)%albgr_dif_rb(:) = albgri_col(c,:) - - else - - this%fates(nc)%bc_in(s)%filter_vegzen_pa(ifp) = .false. - - end if - - end do - end do - - call ED_Norman_Radiation(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out) - - ! Pass FATES BC's back to HLM - ! ----------------------------------------------------------------------------------- - do icp = 1,num_vegsol - p = filter_vegsol(icp) - c = patch%column(p) - s = this%f2hmap(nc)%hsites(c) - ! do if structure here and only pass natveg columns - ifp = p-col%patchi(c) - - if(.not.this%fates(nc)%bc_in(s)%filter_vegzen_pa(ifp) )then - write(iulog,*) 'Not all patches on the natveg column were passed to canrad' - call endrun(msg=errMsg(sourcefile, __LINE__)) - else - albd(p,:) = this%fates(nc)%bc_out(s)%albd_parb(ifp,:) - albi(p,:) = this%fates(nc)%bc_out(s)%albi_parb(ifp,:) - fabd(p,:) = this%fates(nc)%bc_out(s)%fabd_parb(ifp,:) - fabi(p,:) = this%fates(nc)%bc_out(s)%fabi_parb(ifp,:) - ftdd(p,:) = this%fates(nc)%bc_out(s)%ftdd_parb(ifp,:) - ftid(p,:) = this%fates(nc)%bc_out(s)%ftid_parb(ifp,:) - ftii(p,:) = this%fates(nc)%bc_out(s)%ftii_parb(ifp,:) - end if - end do - - end associate - - end subroutine wrap_canopy_radiation - - ! ====================================================================================== - - subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & - soilbiogeochem_carbonstate_inst) - - - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - integer , intent(in) :: nc - type(soilbiogeochem_carbonflux_type), intent(in) :: soilbiogeochem_carbonflux_inst - type(soilbiogeochem_carbonstate_type), intent(in) :: soilbiogeochem_carbonstate_inst - - ! locals - real(r8) :: dtime - integer :: nstep - logical :: is_beg_day - integer :: s,c - - associate(& - hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration - totsomc => soilbiogeochem_carbonstate_inst%totsomc_col, & ! (gC/m2) total soil organic matter carbon - totlitc => soilbiogeochem_carbonstate_inst%totlitc_col) ! (gC/m2) total litter carbon in BGC pools - - ! Summarize Net Fluxes - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%tot_het_resp = hr(c) - this%fates(nc)%bc_in(s)%tot_somc = totsomc(c) - this%fates(nc)%bc_in(s)%tot_litc = totlitc(c) - end do - - is_beg_day = is_beg_curr_day() - dtime = get_step_size() - nstep = get_nstep() - - call SummarizeNetFluxes(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - is_beg_day) - - - call FATES_BGC_Carbon_Balancecheck(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - is_beg_day, & - dtime, nstep) - - - ! Update history variables that track these variables - call this%fates_hist%update_history_cbal(nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites) - - - end associate - end subroutine wrap_bgc_summary - - ! ====================================================================================== - - - subroutine TransferZ0mDisp(this,bounds_clump,frictionvel_inst,canopystate_inst) - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_clump - type(canopystate_type) , intent(inout) :: canopystate_inst - type(frictionvel_type) , intent(inout) :: frictionvel_inst - - ! Locals - integer :: ci ! Current clump index - integer :: s ! Site index - integer :: c ! Column index - integer :: ifp ! Fates patch index - integer :: p ! CLM patch index - - ci = bounds_clump%clump_index - - do s = 1, this%fates(ci)%nsites - c = this%f2hmap(ci)%fcolumn(s) - - frictionvel_inst%z0m_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 - canopystate_inst%displa_patch(col%patchi(c)+1:col%patchf(c)) = 0.0_r8 - - do ifp = 1, this%fates(ci)%sites(s)%youngest_patch%patchno - p = ifp+col%patchi(c) - frictionvel_inst%z0m_patch(p) = this%fates(ci)%bc_out(s)%z0m_pa(ifp) - canopystate_inst%displa_patch(p) = this%fates(ci)%bc_out(s)%displa_pa(ifp) - end do - end do - - return - end subroutine TransferZ0mDisp - - ! ====================================================================================== - - subroutine init_history_io(this,bounds_proc) - - use histFileMod, only : hist_addfld1d, hist_addfld2d, hist_addfld_decomp - - use FatesConstantsMod, only : fates_short_string_length, fates_long_string_length - use FatesIOVariableKindMod, only : patch_r8, patch_ground_r8, patch_size_pft_r8 - use FatesIOVariableKindMod, only : site_r8, site_ground_r8, site_size_pft_r8 - use FatesIOVariableKindMod, only : site_size_r8, site_pft_r8, site_age_r8 - use FatesIOVariableKindMod, only : site_fuel_r8, site_cwdsc_r8, site_scag_r8 - use FatesIOVariableKindMod, only : site_can_r8, site_cnlf_r8, site_cnlfpft_r8 - use FatesIODimensionsMod, only : fates_bounds_type - - - ! Arguments - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_proc ! Currently "proc" - - - ! Locals - type(bounds_type) :: bounds_clump - integer :: nvar ! number of IO variables found - integer :: ivar ! variable index 1:nvar - integer :: nc ! thread counter 1:nclumps - integer :: nclumps ! number of threads on this proc - integer :: s ! FATES site index - integer :: c ! ALM/CLM column index - character(len=fates_short_string_length) :: dim2name - character(len=fates_long_string_length) :: ioname - integer :: d_index, dk_index - - type(fates_bounds_type) :: fates_bounds - type(fates_bounds_type) :: fates_clump - - ! This routine initializes the types of output variables - ! not the variables themselves, just the types - ! --------------------------------------------------------------------------------- - - nclumps = get_proc_clumps() - - ! ------------------------------------------------------------------------------------ - ! PART I: Set FATES DIMENSIONING INFORMATION - ! - ! ------------------------------------------------------------------------------- - ! Those who wish add variables that require new dimensions, please - ! see FATES: FatesHistoryInterfaceMod.F90. Dimension types are defined at the top of the - ! module, and a new explicitly named instance of that type should be created. - ! With this new dimension, a new output type/kind can contain that dimension. - ! A new type/kind can be added to the dim_kinds structure, which defines its members - ! in created in init_dim_kinds_maps(). Make sure to increase the size of fates_num_dim_kinds. - ! A type/kind of output is defined by the data type (ie r8,int,..) - ! and the dimensions. Keep in mind that 3D variables (or 4D if you include time) - ! are not really supported in CLM/ALM right now. There are ways around this - ! limitations by creating combined dimensions, for instance the size+pft dimension - ! "scpf" - ! ------------------------------------------------------------------------------------ - - call hlm_bounds_to_fates_bounds(bounds_proc, fates_bounds) - - call this%fates_hist%Init(nclumps, fates_bounds) - - ! Define the bounds on the first dimension for each thread - !$OMP PARALLEL DO PRIVATE (nc,bounds_clump,fates_clump) - do nc = 1,nclumps - - call get_clump_bounds(nc, bounds_clump) - - ! thread bounds for patch - call hlm_bounds_to_fates_bounds(bounds_clump, fates_clump) - call this%fates_hist%SetThreadBoundsEach(nc, fates_clump) - end do - !$OMP END PARALLEL DO - - ! ------------------------------------------------------------------------------------ - ! PART I.5: SET SOME INDEX MAPPINGS SPECIFICALLY FOR SITE<->COLUMN AND PATCH - ! ------------------------------------------------------------------------------------ - - !$OMP PARALLEL DO PRIVATE (nc,s,c) - do nc = 1,nclumps - - allocate(this%fates_hist%iovar_map(nc)%site_index(this%fates(nc)%nsites)) - allocate(this%fates_hist%iovar_map(nc)%patch1_index(this%fates(nc)%nsites)) - - do s=1,this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates_hist%iovar_map(nc)%site_index(s) = c - this%fates_hist%iovar_map(nc)%patch1_index(s) = col%patchi(c)+1 - end do - - end do - !$OMP END PARALLEL DO - - ! ------------------------------------------------------------------------------------ - ! PART II: USE THE JUST DEFINED DIMENSIONS TO ASSEMBLE THE VALID IO TYPES - ! INTERF-TODO: THESE CAN ALL BE EMBEDDED INTO A SUBROUTINE IN HISTORYIOMOD - ! ------------------------------------------------------------------------------------ - call this%fates_hist%assemble_history_output_types() - - ! ------------------------------------------------------------------------------------ - ! PART III: DEFINE THE LIST OF OUTPUT VARIABLE OBJECTS, AND REGISTER THEM WITH THE - ! HLM ACCORDING TO THEIR TYPES - ! ------------------------------------------------------------------------------------ - call this%fates_hist%initialize_history_vars() - nvar = this%fates_hist%num_history_vars() - - do ivar = 1, nvar - - associate( vname => this%fates_hist%hvars(ivar)%vname, & - vunits => this%fates_hist%hvars(ivar)%units, & - vlong => this%fates_hist%hvars(ivar)%long, & - vdefault => this%fates_hist%hvars(ivar)%use_default, & - vavgflag => this%fates_hist%hvars(ivar)%avgflag) - - dk_index = this%fates_hist%hvars(ivar)%dim_kinds_index - ioname = trim(this%fates_hist%dim_kinds(dk_index)%name) - - select case(trim(ioname)) - case(patch_r8) - call hist_addfld1d(fname=trim(vname),units=trim(vunits), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_patch=this%fates_hist%hvars(ivar)%r81d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - - case(site_r8) - call hist_addfld1d(fname=trim(vname),units=trim(vunits), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r81d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - - case(patch_ground_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & ! <--- addfld2d - type2d=trim(dim2name), & ! <--- type2d - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_patch=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - - case(patch_size_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_patch=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_ground_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_size_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_size_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_pft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_age_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_fuel_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cwdsc_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_can_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cnlf_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_cnlfpft_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - case(site_scag_r8) - d_index = this%fates_hist%dim_kinds(dk_index)%dim2_index - dim2name = this%fates_hist%dim_bounds(d_index)%name - call hist_addfld2d(fname=trim(vname),units=trim(vunits), & - type2d=trim(dim2name), & - avgflag=trim(vavgflag),long_name=trim(vlong), & - ptr_col=this%fates_hist%hvars(ivar)%r82d, & - default=trim(vdefault), & - set_lake=0._r8,set_urb=0._r8) - - - case default - write(iulog,*) 'A FATES iotype was created that was not registerred' - write(iulog,*) 'in CLM.:',trim(ioname) - call endrun(msg=errMsg(sourcefile, __LINE__)) - end select - - end associate - end do - end subroutine init_history_io - - ! ====================================================================================== - - subroutine init_soil_depths(this, nc) - - ! Input Arguments - class(hlm_fates_interface_type), intent(inout) :: this - integer,intent(in) :: nc ! Clump - - ! Locals - integer :: s ! site index - integer :: c ! column index - integer :: j ! Depth index - - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%zi_sisl(0:hlm_numlevsoil) = col%zi(c,0:hlm_numlevsoil) - this%fates(nc)%bc_in(s)%dz_sisl(1:hlm_numlevsoil) = col%dz(c,1:hlm_numlevsoil) - this%fates(nc)%bc_in(s)%z_sisl(1:hlm_numlevsoil) = col%z(c,1:hlm_numlevsoil) - this%fates(nc)%bc_in(s)%dz_decomp_sisl(1:hlm_numlevdecomp_full) = & - dzsoi_decomp(1:hlm_numlevdecomp_full) - end do - - return - end subroutine init_soil_depths - - ! ====================================================================================== - - subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & - soilstate_inst, waterflux_inst) - - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_clump - integer,intent(in) :: num_filterc - integer,intent(in) :: filterc(num_filterc) - type(soilstate_type), intent(inout) :: soilstate_inst - type(waterflux_type), intent(inout) :: waterflux_inst - - ! locals - integer :: s - integer :: c - integer :: l - integer :: nc - integer :: num_filter_fates - - - if( .not. use_fates_planthydro ) return - - nc = bounds_clump%clump_index - - ! Perform a check that the number of columns submitted to fates for - ! root water sink is the same that was expected in the hydrology filter - num_filter_fates = 0 - do s = 1,num_filterc - l = col%landunit(filterc(s)) - if (lun%itype(l) == istsoil ) then - num_filter_fates = num_filter_fates + 1 - end if - end do - - if(num_filter_fates .ne. this%fates(nc)%nsites )then - write(iulog,*) 'The HLM list of natural veg columns during root water transfer' - write(iulog,*) 'is not the same size as the fates site list?' - call endrun(msg=errMsg(sourcefile, __LINE__)) - end if - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - waterflux_inst%qflx_rootsoi_col(c,:) = this%fates(nc)%bc_out(s)%qflx_soil2root_sisl(:) - end do - - end subroutine ComputeRootSoilFlux - - ! ====================================================================================== -! -! THIS WAS MOVED TO WRAP_HYDRAULICS_DRIVE() -! -! subroutine TransferPlantWaterStorage(this, bounds_clump, nc, waterstate_inst) -! -! implicit none -! class(hlm_fates_interface_type), intent(inout) :: this -! type(bounds_type),intent(in) :: bounds_clump -! integer,intent(in) :: nc -! type(waterstate_type) , intent(inout) :: waterstate_inst -! -! ! locals -! integer :: s -! integer :: c -! -! if (.not. (use_fates .and. use_fates_planthydro) ) return -! -! do s = 1, this%fates(nc)%nsites -! c = this%f2hmap(nc)%fcolumn(s) -! waterstate_inst%total_plant_stored_h2o_col(c) = & -! this%fates(nc)%bc_out(s)%plant_stored_h2o_si -! end do -! return -!end subroutine TransferPlantWaterStorage - - - - - ! ====================================================================================== - - subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & - soilstate_inst, waterstate_inst, waterflux_inst, & - solarabs_inst, energyflux_inst) - - - implicit none - class(hlm_fates_interface_type), intent(inout) :: this - type(bounds_type),intent(in) :: bounds_clump - integer,intent(in) :: nc - type(soilstate_type) , intent(inout) :: soilstate_inst - type(waterstate_type) , intent(inout) :: waterstate_inst - type(waterflux_type) , intent(inout) :: waterflux_inst - type(solarabs_type) , intent(inout) :: solarabs_inst - type(energyflux_type) , intent(inout) :: energyflux_inst - - ! locals - integer :: s - integer :: c - integer :: j - integer :: ifp - integer :: p - real(r8) :: dtime - - - if ( .not.use_fates_planthydro ) return - - - dtime = get_step_size() - - ! Prepare Input Boundary Conditions - ! ------------------------------------------------------------------------------------ - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - this%fates(nc)%bc_in(s)%smpmin_si = & - soilstate_inst%smpmin_col(c) - this%fates(nc)%bc_in(s)%watsat_sisl(1:nlevsoi) = & - soilstate_inst%watsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%watres_sisl(1:nlevsoi) = & - soilstate_inst%watres_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%sucsat_sisl(1:nlevsoi) = & - soilstate_inst%sucsat_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%bsw_sisl(1:nlevsoi) = & - soilstate_inst%bsw_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%h2o_liq_sisl(1:nlevsoi) = & - waterstate_inst%h2osoi_liq_col(c,1:nlevsoi) - this%fates(nc)%bc_in(s)%eff_porosity_gl(1:nlevsoi) = & - soilstate_inst%eff_porosity_col(c,1:nlevsoi) - - do ifp = 1, this%fates(nc)%sites(s)%youngest_patch%patchno - p = ifp+col%patchi(c) - this%fates(nc)%bc_in(s)%swrad_net_pa(ifp) = solarabs_inst%fsa_patch(p) - this%fates(nc)%bc_in(s)%lwrad_net_pa(ifp) = energyflux_inst%eflx_lwrad_net_patch(p) - this%fates(nc)%bc_in(s)%qflx_transp_pa(ifp) = waterflux_inst%qflx_tran_veg_patch(p) - end do - end do - - ! Call Fates Hydraulics - ! ------------------------------------------------------------------------------------ - - - call hydraulics_drive(this%fates(nc)%nsites, & - this%fates(nc)%sites, & - this%fates(nc)%bc_in, & - this%fates(nc)%bc_out, & - dtime) - - ! Prepare Output Boundary Conditions - ! ------------------------------------------------------------------------------------ - - do s = 1, this%fates(nc)%nsites - c = this%f2hmap(nc)%fcolumn(s) - waterstate_inst%total_plant_stored_h2o_col(c) = & - this%fates(nc)%bc_out(s)%plant_stored_h2o_si - end do - - - ! Update History Buffers that need to be updated after hydraulics calls - - call this%fates_hist%update_history_hydraulics(nc, & - this%fates(nc)%nsites, & - this%fates(nc)%sites, & - dtime) - - - return - end subroutine wrap_hydraulics_drive - - ! ====================================================================================== - - subroutine hlm_bounds_to_fates_bounds(hlm, fates) - - use FatesIODimensionsMod, only : fates_bounds_type - use FatesInterfaceMod, only : nlevsclass, nlevage - use EDtypesMod, only : nfsc, ncwd - use EDtypesMod, only : nlevleaf, nclmax - use FatesInterfaceMod, only : numpft_ed => numpft - use clm_varpar, only : nlevgrnd - - implicit none - - type(bounds_type), intent(in) :: hlm - type(fates_bounds_type), intent(out) :: fates - - fates%cohort_begin = hlm%begcohort - fates%cohort_end = hlm%endcohort - - fates%patch_begin = hlm%begp - fates%patch_end = hlm%endp - - fates%column_begin = hlm%begc - fates%column_end = hlm%endc - - fates%ground_begin = 1 - fates%ground_end = nlevgrnd - - fates%sizepft_class_begin = 1 - fates%sizepft_class_end = nlevsclass * numpft_ed - - fates%size_class_begin = 1 - fates%size_class_end = nlevsclass - - fates%pft_class_begin = 1 - fates%pft_class_end = numpft_ed - - fates%age_class_begin = 1 - fates%age_class_end = nlevage - - fates%sizeage_class_begin = 1 - fates%sizeage_class_end = nlevsclass * nlevage - - fates%fuel_begin = 1 - fates%fuel_end = nfsc - - fates%cwdsc_begin = 1 - fates%cwdsc_end = ncwd - - fates%can_begin = 1 - fates%can_end = nclmax - - fates%cnlf_begin = 1 - fates%cnlf_end = nlevleaf * nclmax - - fates%cnlfpft_begin = 1 - fates%cnlfpft_end = nlevleaf * nclmax * numpft_ed - - end subroutine hlm_bounds_to_fates_bounds - -end module CLMFatesInterfaceMod diff --git a/src/utils/clmfates_paraminterfaceMod.F90 b/src/utils/clmfates_paraminterfaceMod.F90 deleted file mode 100644 index 4fc12fdc31..0000000000 --- a/src/utils/clmfates_paraminterfaceMod.F90 +++ /dev/null @@ -1,240 +0,0 @@ -module CLMFatesParamInterfaceMod - ! NOTE(bja, 2017-01) this code can not go into the main clm-fates - ! interface module because of circular dependancies with pftvarcon. - - use FatesGlobals, only : fates_log - - implicit none - - ! NOTE(bja, 2017-01) these methods can NOT be part of the clmi-fates - ! nterface type because they are called before the instance is - ! initialized. - public :: FatesReadParameters - public :: FatesReadPFTs - private :: ParametersFromNetCDF - private :: SetParameterDimensions - private :: GetUsedDimensionSizes - - logical :: DEBUG = .false. - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - subroutine FatesReadParameters() - - use clm_varctl, only : use_fates, paramfile, fates_paramfile - use spmdMod, only : masterproc - - use FatesParametersInterface, only : fates_parameters_type - - use EDParamsMod, only : FatesRegisterParams, FatesReceiveParams - use SFParamsMod, only : SpitFireRegisterParams, SpitFireReceiveParams - use FatesSynchronizedParamsMod, only : FatesSynchronizedParamsInst - - implicit none - - character(len=32) :: subname = 'FatesReadParameters' - class(fates_parameters_type), allocatable :: fates_params - logical :: is_host_file - - if (use_fates) then - if (masterproc) then - write(fates_log(), *) 'clmfates_interfaceMod.F90::'//trim(subname)//' :: CLM reading ED/FATES '//' parameters ' - end if - - allocate(fates_params) - call fates_params%Init() - call FatesRegisterParams(fates_params) - call SpitFireRegisterParams(fates_params) - call FatesSynchronizedParamsInst%RegisterParams(fates_params) - - is_host_file = .false. - call ParametersFromNetCDF(fates_paramfile, is_host_file, fates_params) - - is_host_file = .true. - call ParametersFromNetCDF(paramfile, is_host_file, fates_params) - - call FatesReceiveParams(fates_params) - call SpitFireReceiveParams(fates_params) - call FatesSynchronizedParamsInst%ReceiveParams(fates_params) - - call fates_params%Destroy() - deallocate(fates_params) - end if - - end subroutine FatesReadParameters - - !----------------------------------------------------------------------- - subroutine FatesReadPFTs() - - use clm_varctl, only : use_fates, paramfile, fates_paramfile - use spmdMod, only : masterproc - - use FatesParametersInterface, only : fates_parameters_type - use EDPftvarcon , only : EDPftvarcon_inst - - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_pio_closefile, ncd_pio_openfile - - implicit none - - character(len=32) :: subname = 'FatesReadPFTs' - class(fates_parameters_type), allocatable :: fates_params - logical :: is_host_file - - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! pio netCDF file id - - if (use_fates) then - if (masterproc) then - write(fates_log(), *) 'clmfates_interfaceMod.F90::'//trim(subname)//' :: CLM reading ED/FATES '//' PFTs ' - end if - - allocate(fates_params) - call fates_params%Init() - call EDPftvarcon_inst%Init() - - call EDPftvarcon_inst%Register(fates_params) - - is_host_file = .false. - call ParametersFromNetCDF(fates_paramfile, is_host_file, fates_params) - - is_host_file = .true. - call ParametersFromNetCDF(paramfile, is_host_file, fates_params) - - call EDPftvarcon_inst%Receive(fates_params) - - call fates_params%Destroy() - deallocate(fates_params) - end if - - end subroutine FatesReadPFTs - - !----------------------------------------------------------------------- - subroutine SetParameterDimensions(ncid, is_host_file, fates_params) - ! Get the list of dimensions used by the fates parameters, - ! retreive them from the parameter file, then give the information - ! back to fates. - use FatesParametersInterface, only : fates_parameters_type, param_string_length, max_dimensions, max_used_dimensions - use ncdio_pio , only : file_desc_t - - implicit none - - type(file_desc_t), intent(inout) :: ncid - logical, intent(in) :: is_host_file - class(fates_parameters_type), intent(inout) :: fates_params - - integer :: num_used_dimensions - character(len=param_string_length) :: used_dimension_names(max_used_dimensions) - integer :: used_dimension_sizes(max_used_dimensions) - - call fates_params%GetUsedDimensions(is_host_file, num_used_dimensions, used_dimension_names) - - call GetUsedDimensionSizes(ncid, num_used_dimensions, used_dimension_names, used_dimension_sizes) - - call fates_params%SetDimensionSizes(is_host_file, num_used_dimensions, used_dimension_names, used_dimension_sizes) - - end subroutine SetParameterDimensions - - !----------------------------------------------------------------------- - subroutine GetUsedDimensionSizes(ncid, num_used_dimensions, dimension_names, dimension_sizes) - - use ncdio_pio , only : ncd_inqdid, ncd_inqdlen - use FatesParametersInterface, only : param_string_length - use ncdio_pio, only : file_desc_t - - - implicit none - - type(file_desc_t), intent(inout) :: ncid - integer, intent(in) :: num_used_dimensions - character(len=param_string_length), intent(in) :: dimension_names(:) - integer, intent(out) :: dimension_sizes(:) - - integer :: d, max_dim_size, num_dims - integer :: dim_len, dim_id - - dimension_sizes(:) = 0 - max_dim_size = 0 - - do d = 1, num_used_dimensions - call ncd_inqdid(ncid, dimension_names(d), dim_id) - call ncd_inqdlen(ncid, dim_id, dim_len) - dimension_sizes(d) = dim_len - !write(*, *) '--> ', trim(dimension_names(d)), ' setting size ', dimension_sizes(d) - end do - - end subroutine GetUsedDimensionSizes - - !----------------------------------------------------------------------- - subroutine ParametersFromNetCDF(filename, is_host_file, fates_params) - - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only : endrun - use fileutils , only : getfil - use ncdio_pio , only : file_desc_t, ncd_pio_closefile, ncd_pio_openfile - use paramUtilMod, only : readNcdio - - use FatesParametersInterface, only : fates_parameters_type - use FatesParametersInterface, only : param_string_length, max_dimensions, max_used_dimensions - use FatesParametersInterface, only : dimension_shape_scalar, dimension_shape_1d, dimension_shape_2d - - implicit none - - character(len=*), intent(in) :: filename - logical, intent(in) :: is_host_file - class(fates_parameters_type), intent(inout) :: fates_params - - character(len=32) :: subname = 'clmfates_interface::ReadParameters' - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! pio netCDF file id - integer :: dimid ! netCDF dimension id - integer :: i, num_params, dimension_shape - integer :: max_dim_size - real(r8), allocatable :: data(:, :) - character(len=param_string_length) :: name - integer :: dimension_sizes(max_dimensions) - character(len=param_string_length) :: dimension_names(max_dimensions) - integer :: size_dim_1, size_dim_2 - logical :: is_host_param - - call getfil (filename, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - call SetParameterDimensions(ncid, is_host_file, fates_params) - max_dim_size = fates_params%GetMaxDimensionSize() - allocate(data(max_dim_size, max_dim_size)) - - num_params = fates_params%num_params() - do i = 1, num_params - call fates_params%GetMetaData(i, name, dimension_shape, dimension_sizes, dimension_names, is_host_param) - if (is_host_file .eqv. is_host_param) then - select case(dimension_shape) - case(dimension_shape_scalar) - size_dim_1 = 1 - size_dim_2 = 1 - case(dimension_shape_1d) - size_dim_1 = dimension_sizes(1) - size_dim_2 = 1 - case(dimension_shape_2d) - size_dim_1 = dimension_sizes(1) - size_dim_2 = dimension_sizes(2) - case default - write(fates_log(),*) 'dimension shape:',dimension_shape - call endrun(msg='unsupported number of dimensions reading parameters.') - - end select - write(fates_log(), *) 'clmfates_interfaceMod.F90:: reading '//trim(name) - call readNcdio(ncid, name, dimension_shape, dimension_names, subname, data(1:size_dim_1, 1:size_dim_2)) - call fates_params%SetData(i, data(1:size_dim_1, 1:size_dim_2)) - end if - end do - deallocate(data) - call ncd_pio_closefile(ncid) - end subroutine ParametersFromNetCDF - !----------------------------------------------------------------------- - -end module CLMFatesParamInterfaceMod diff --git a/src/utils/domainMod.F90 b/src/utils/domainMod.F90 deleted file mode 100644 index 7cdd62b41f..0000000000 --- a/src/utils/domainMod.F90 +++ /dev/null @@ -1,233 +0,0 @@ -module domainMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: domainMod -! -! !DESCRIPTION: -! Module containing 2-d global surface boundary data information -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_abort - use spmdMod , only : masterproc - use clm_varctl , only : iulog -! -! !PUBLIC TYPES: - implicit none - private -! - public :: domain_type - - !--- this typically contains local domain info with arrays dim begg:endg --- - type domain_type - integer :: ns ! global size of domain - integer :: ni,nj ! global axis if 2d (nj=1 if unstructured) - logical :: isgrid2d ! true => global grid is lat/lon - integer :: nbeg,nend ! local beg/end indices - character(len=8) :: clmlevel ! grid type - integer ,pointer :: mask(:) ! land mask: 1 = land, 0 = ocean - real(r8),pointer :: frac(:) ! fractional land - real(r8),pointer :: latc(:) ! latitude of grid cell (deg) - real(r8),pointer :: lonc(:) ! longitude of grid cell (deg) - real(r8),pointer :: area(:) ! grid cell area (km**2) - integer ,pointer :: pftm(:) ! pft mask: 1=real, 0=fake, -1=notset - character*16 :: set ! flag to check if domain is set - logical :: decomped ! decomposed locally or global copy - end type domain_type - - type(domain_type) , public :: ldomain - real(r8), allocatable, public :: lon1d(:), lat1d(:) ! 1d lat/lons for 2d grids -! -! !PUBLIC MEMBER FUNCTIONS: - public domain_init ! allocates/nans domain types - public domain_clean ! deallocates domain types - public domain_check ! write out domain info -! -! !REVISION HISTORY: -! Originally clm_varsur by Mariana Vertenstein -! Migrated from clm_varsur to domainMod by T Craig -! - character*16,parameter :: set = 'domain_set ' - character*16,parameter :: unset = 'NOdomain_unsetNO' -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: domain_init -! -! !INTERFACE: - subroutine domain_init(domain,isgrid2d,ni,nj,nbeg,nend,clmlevel) - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) -! -! !DESCRIPTION: -! This subroutine allocates and nans the domain type -! -! !USES: -! -! !ARGUMENTS: - implicit none - type(domain_type) :: domain ! domain datatype - logical, intent(in) :: isgrid2d ! true => global grid is lat/lon - integer, intent(in) :: ni,nj ! grid size, 2d - integer , intent(in), optional :: nbeg,nend ! beg/end indices - character(len=*), intent(in), optional :: clmlevel ! grid type -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer ier - integer nb,ne -! -!------------------------------------------------------------------------------ - - nb = 1 - ne = ni*nj - if (present(nbeg)) then - if (present(nend)) then - nb = nbeg - ne = nend - endif - endif - - if (domain%set == set) then - call domain_clean(domain) - endif - allocate(domain%mask(nb:ne),domain%frac(nb:ne),domain%latc(nb:ne), & - domain%pftm(nb:ne),domain%area(nb:ne),domain%lonc(nb:ne), & - stat=ier) - if (ier /= 0) then - call shr_sys_abort('domain_init ERROR: allocate mask, frac, lat, lon, area ') - endif - - if (present(clmlevel)) then - domain%clmlevel = clmlevel - endif - - domain%isgrid2d = isgrid2d - domain%ns = ni*nj - domain%ni = ni - domain%nj = nj - domain%nbeg = nb - domain%nend = ne - domain%mask = -9999 - domain%frac = -1.0e36 - domain%latc = nan - domain%lonc = nan - domain%area = nan - - domain%set = set - if (domain%nbeg == 1 .and. domain%nend == domain%ns) then - domain%decomped = .false. - else - domain%decomped = .true. - endif - - domain%pftm = -9999 - -end subroutine domain_init -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: domain_clean -! -! !INTERFACE: - subroutine domain_clean(domain) -! -! !DESCRIPTION: -! This subroutine deallocates the domain type -! -! !ARGUMENTS: - implicit none - type(domain_type) :: domain ! domain datatype -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer ier -! -!------------------------------------------------------------------------------ - if (domain%set == set) then - if (masterproc) then - write(iulog,*) 'domain_clean: cleaning ',domain%ni,domain%nj - endif - deallocate(domain%mask,domain%frac,domain%latc, & - domain%lonc,domain%area,domain%pftm, & - stat=ier) - if (ier /= 0) then - call shr_sys_abort('domain_clean ERROR: deallocate mask, frac, lat, lon, area ') - endif - else - if (masterproc) then - write(iulog,*) 'domain_clean WARN: clean domain unecessary ' - endif - endif - - domain%clmlevel = unset - domain%ns = huge(1) - domain%ni = huge(1) - domain%nj = huge(1) - domain%nbeg = huge(1) - domain%nend = huge(1) - domain%set = unset - domain%decomped = .true. - -end subroutine domain_clean -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: domain_check -! -! !INTERFACE: - subroutine domain_check(domain) -! -! !DESCRIPTION: -! This subroutine write domain info -! -! !USES: -! -! !ARGUMENTS: - implicit none - type(domain_type),intent(in) :: domain ! domain datatype -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -! -!EOP -!------------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*) ' domain_check set = ',trim(domain%set) - write(iulog,*) ' domain_check decomped = ',domain%decomped - write(iulog,*) ' domain_check ns = ',domain%ns - write(iulog,*) ' domain_check ni,nj = ',domain%ni,domain%nj - write(iulog,*) ' domain_check clmlevel = ',trim(domain%clmlevel) - write(iulog,*) ' domain_check nbeg,nend = ',domain%nbeg,domain%nend - write(iulog,*) ' domain_check lonc = ',minval(domain%lonc),maxval(domain%lonc) - write(iulog,*) ' domain_check latc = ',minval(domain%latc),maxval(domain%latc) - write(iulog,*) ' domain_check mask = ',minval(domain%mask),maxval(domain%mask) - write(iulog,*) ' domain_check frac = ',minval(domain%frac),maxval(domain%frac) - write(iulog,*) ' domain_check area = ',minval(domain%area),maxval(domain%area) - write(iulog,*) ' domain_check pftm = ',minval(domain%pftm),maxval(domain%pftm) - write(iulog,*) ' ' - endif - -end subroutine domain_check - -!------------------------------------------------------------------------------ - -end module domainMod diff --git a/src/utils/dtypes.h b/src/utils/dtypes.h deleted file mode 100644 index 977e95ad75..0000000000 --- a/src/utils/dtypes.h +++ /dev/null @@ -1,6 +0,0 @@ -#define TYPEDOUBLE 102 -#define TYPEINT 103 -#define TYPETEXT 100 -#define TYPELONG 104 -#define TYPEREAL 101 -#define TYPELOGICAL 105 diff --git a/src/utils/fileutils.F90 b/src/utils/fileutils.F90 deleted file mode 100644 index b74af42426..0000000000 --- a/src/utils/fileutils.F90 +++ /dev/null @@ -1,179 +0,0 @@ -module fileutils - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing file I/O utilities - ! - ! !USES: - use shr_sys_mod , only : shr_sys_abort - use clm_varctl , only : iulog - use spmdMod , only : masterproc - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: get_filename !Returns filename given full pathname - public :: opnfil !Open local unformatted or formatted file - public :: getfil !Obtain local copy of file - public :: relavu !Close and release Fortran unit no longer in use - public :: getavu !Get next available Fortran unit number - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - character(len=256) function get_filename (fulpath) - ! - ! !DESCRIPTION: - ! Returns filename given full pathname - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fulpath !full pathname - ! - ! !LOCAL VARIABLES: - integer i !loop index - integer klen !length of fulpath character string - !------------------------------------------------------------------------ - - klen = len_trim(fulpath) - do i = klen, 1, -1 - if (fulpath(i:i) == '/') go to 10 - end do - i = 0 -10 get_filename = fulpath(i+1:klen) - - return - end function get_filename - - !------------------------------------------------------------------------ - subroutine getfil (fulpath, locfn, iflag) - ! - ! !DESCRIPTION: - ! Obtain local copy of file - ! First check current working directory - ! Next check full pathname[fulpath] on disk - ! - ! !USES: - use shr_file_mod, only: shr_file_get - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fulpath !Archival or permanent disk full pathname - character(len=*), intent(out) :: locfn !output local file name - integer, intent(in) :: iflag !0=>abort if file not found 1=>do not abort - ! - ! !LOCAL VARIABLES: - integer i !loop index - integer klen !length of fulpath character string - logical lexist !true if local file exists - !------------------------------------------------------------------------ - - ! get local file name from full name - - locfn = get_filename( fulpath ) - if (len_trim(locfn) == 0) then - if (masterproc) write(iulog,*)'(GETFIL): local filename has zero length' - call shr_sys_abort - else - if (masterproc) write(iulog,*)'(GETFIL): attempting to find local file ', & - trim(locfn) - endif - - ! first check if file is in current working directory. - - inquire (file=locfn,exist=lexist) - if (lexist) then - if (masterproc) write(iulog,*) '(GETFIL): using ',trim(locfn), & - ' in current working directory' - RETURN - endif - - ! second check for full pathname on disk - locfn = fulpath - - inquire (file=fulpath,exist=lexist) - if (lexist) then - if (masterproc) write(iulog,*) '(GETFIL): using ',trim(fulpath) - RETURN - else - if (masterproc) write(iulog,*)'(GETFIL): failed getting file from full path: ', fulpath - if (iflag==0) then - call shr_sys_abort ('GETFIL: FAILED to get '//trim(fulpath)) - else - RETURN - endif - endif - - end subroutine getfil - - !------------------------------------------------------------------------ - subroutine opnfil (locfn, iun, form) - ! - ! !DESCRIPTION: - ! Open file locfn in unformatted or formatted form on unit iun - ! - ! !ARGUMENTS: - character(len=*), intent(in):: locfn !file name - integer, intent(in):: iun !fortran unit number - character(len=1), intent(in):: form !file format: u = unformatted, f = formatted - ! - ! !LOCAL VARIABLES: - integer ioe !error return from fortran open - character(len=11) ft !format type: formatted. unformatted - !------------------------------------------------------------------------ - - if (len_trim(locfn) == 0) then - write(iulog,*)'(OPNFIL): local filename has zero length' - call shr_sys_abort - endif - if (form=='u' .or. form=='U') then - ft = 'unformatted' - else - ft = 'formatted ' - end if - open (unit=iun,file=locfn,status='unknown',form=ft,iostat=ioe) - if (ioe /= 0) then - write(iulog,*)'(OPNFIL): failed to open file ',trim(locfn), & - & ' on unit ',iun,' ierr=',ioe - call shr_sys_abort - else if ( masterproc )then - write(iulog,*)'(OPNFIL): Successfully opened file ',trim(locfn), & - & ' on unit= ',iun - end if - - end subroutine opnfil - - !------------------------------------------------------------------------ - integer function getavu() - ! - ! !DESCRIPTION: - ! Get next available Fortran unit number. - ! - ! !USES: - use shr_file_mod, only : shr_file_getUnit - !------------------------------------------------------------------------ - - getavu = shr_file_getunit() - - end function getavu - - !------------------------------------------------------------------------ - subroutine relavu (iunit) - ! - ! !DESCRIPTION: - ! Close and release Fortran unit no longer in use! - ! - ! !USES: - use shr_file_mod, only : shr_file_freeUnit - ! - ! !ARGUMENTS: - integer, intent(in) :: iunit !Fortran unit number - !------------------------------------------------------------------------ - - close(iunit) - call shr_file_freeUnit(iunit) - - end subroutine relavu - -end module fileutils diff --git a/src/utils/getdatetime.F90 b/src/utils/getdatetime.F90 deleted file mode 100644 index 4126d807e4..0000000000 --- a/src/utils/getdatetime.F90 +++ /dev/null @@ -1,53 +0,0 @@ -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: getdatetime -! -! !INTERFACE: -subroutine getdatetime (cdate, ctime) -! -! !DESCRIPTION: -! A generic Date and Time routine -! -! !USES: - use spmdMod , only : mpicom, masterproc, MPI_CHARACTER -! !ARGUMENTS: - implicit none - character(len=8), intent(out) :: cdate !current date - character(len=8), intent(out) :: ctime !current time -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - character(len=8) :: date !current date - character(len=10) :: time !current time - character(len=5) :: zone !zone - integer, dimension(8) :: values !temporary - integer :: ier !MPI error code -!----------------------------------------------------------------------- - if (masterproc) then - - call date_and_time (date, time, zone, values) - - cdate(1:2) = date(5:6) - cdate(3:3) = '/' - cdate(4:5) = date(7:8) - cdate(6:6) = '/' - cdate(7:8) = date(3:4) - - ctime(1:2) = time(1:2) - ctime(3:3) = ':' - ctime(4:5) = time(3:4) - ctime(6:6) = ':' - ctime(7:8) = time(5:6) - - endif - - call mpi_bcast (cdate,len(cdate),MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (ctime,len(ctime),MPI_CHARACTER, 0, mpicom, ier) - - return -end subroutine getdatetime diff --git a/src/utils/quadraticMod.F90 b/src/utils/quadraticMod.F90 deleted file mode 100644 index 87bb250945..0000000000 --- a/src/utils/quadraticMod.F90 +++ /dev/null @@ -1,76 +0,0 @@ -module quadraticMod - - use abortutils , only: endrun - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_log_mod , only: errMsg => shr_log_errMsg - use clm_varctl , only: iulog - - implicit none - - public :: quadratic - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - subroutine quadratic (a, b, c, r1, r2) - ! - ! !DESCRIPTION: - !==============================================================================! - !----------------- Solve quadratic equation for its two roots -----------------! - !==============================================================================! - ! Solution from Press et al (1986) Numerical Recipes: The Art of Scientific - ! Computing (Cambridge University Press, Cambridge), pp. 145. - ! - ! !REVISION HISTORY: - ! 4/5/10: Adapted from /home/bonan/ecm/psn/An_gs_iterative.f90 by Keith Oleson - ! - ! !USES: - implicit none - ! - ! !ARGUMENTS: - real(r8), intent(in) :: a,b,c ! Terms for quadratic equation - real(r8), intent(out) :: r1,r2 ! Roots of quadratic equation - ! - ! !LOCAL VARIABLES: - real(r8) :: q ! Temporary term for quadratic solution - real(r8) :: root ! Term that will have a square root taken - character(len=*), parameter :: subname = 'quadratic' - !------------------------------------------------------------------------------ - - if (a == 0._r8) then - write (iulog,*) subname//' ERROR: Quadratic solution error: a = ',a - write (iulog,*) errmsg(sourcefile, __LINE__) - call endrun(msg=subname//' ERROR: Quadratic solution error' ) - return - end if - - root = b*b - 4._r8*a*c - if ( root < 0.0 )then - if ( -root < 3.0_r8*epsilon(b) )then - root = 0.0_r8 - else - write (iulog,*) subname//' ERROR: Quadratic solution error: b^2 - 4ac is negative = ', root - write (iulog,*) errmsg(sourcefile, __LINE__) - call endrun( msg=subname//' ERROR: Quadratic solution error: b^2 - 4ac is negative' ) - return - end if - end if - - if (b >= 0._r8) then - q = -0.5_r8 * (b + sqrt(root)) - else - q = -0.5_r8 * (b - sqrt(root)) - end if - - r1 = q / a - if (q /= 0._r8) then - r2 = c / q - else - r2 = 1.e36_r8 - end if - - end subroutine quadratic - -end module quadraticMod diff --git a/src/utils/restUtilMod.F90.in b/src/utils/restUtilMod.F90.in deleted file mode 100644 index c3e8bafc9c..0000000000 --- a/src/utils/restUtilMod.F90.in +++ /dev/null @@ -1,701 +0,0 @@ -module restUtilMod - - !----------------------------------------------------------------------- - ! provies generic routines and types for use with restart files - ! -#include "shr_assert.h" - use shr_log_mod , only: errMsg => shr_log_errMsg - use shr_kind_mod, only: r8=>shr_kind_r8, r4 => shr_kind_r4, i4=>shr_kind_i4 - use shr_sys_mod, only: shr_sys_abort - use spmdMod, only: masterproc - use clm_varctl, only: iulog, nsrest, nsrContinue, nsrBranch - use clm_varcon, only: spval, ispval - use decompMod, only: bounds_type - use abortutils, only: endrun - use ncdio_pio - use pio - use ncdio_utils, only: find_var_on_file - use shr_string_mod, only: shr_string_listGetName - ! - implicit none - save - private - ! save - ! - !----------------------------------------------------------------------- - - interface restartvar - !DIMS 0,1,2 - !TYPE text,int,double - module procedure restartvar_{DIMS}d_{TYPE} - !TYPE int,double - module procedure restartvar_2d_{TYPE}_bounds - end interface restartvar - - ! iflag_interp => interpolate variable - ! iflag_copy => copy variable - ! iflag_skip => skip variable: maintain at cold start value on output file - ! iflag_area => area-related variable: skip if we're taking areas from the surface - ! dataset, interp if we're taking areas from the input finidat file. (The latter only - ! works if we're running at the same resolution with a similar configuration.) This - ! can apply to variables that are not actually areas, but for which we want this same - ! conditional behavior. - integer,parameter, public :: iflag_interp = 1 - integer,parameter, public :: iflag_copy = 2 - integer,parameter, public :: iflag_skip = 3 - integer,parameter, public :: iflag_area = 4 - - integer,parameter, public :: iflag_noswitchdim = 0 - integer,parameter, public :: iflag_switchdim = 1 - - public :: restartvar - - ! Set values of a missing restart field from a template field, with some constant - ! multiplier - public :: set_missing_from_template - - ! Set a gridcell-level field from a column-level field - public :: set_grc_field_from_col_field - - ! Set any NaN or spval entries in a field to some constant value - interface set_missing_vals_to_constant - !DIMS 1,2 - module procedure set_missing_vals_to_constant_{DIMS}d - end interface set_missing_vals_to_constant - public :: set_missing_vals_to_constant - - private :: missing_field_possibly_abort - private :: write_interpinic_flag - - character(len=*), parameter, private :: sourcefile = & - __FILE__ - -contains - - !----------------------------------------------------------------------- - !DIMS 0 - !TYPE text,int,double - subroutine restartvar_{DIMS}d_{TYPE}(& - ncid, flag, varname, xtype, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - ! Note that varname can be a colon-delimited list of possible variable names (with no - ! spaces around the colons). In this case, when flag = 'read', the input file is - ! searched for each possible variable name in order, starting with the first, until - ! one is found. This mechanism supports backwards compatibility with old restart - ! files, in case variables have been renamed. For example, if variable 'foo' was - ! recently renamed to 'bar', then varname should be 'bar:foo'. For flag = 'write', - ! the first name in the list is used. - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name (or colon-delimited list: see above) - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic ('interp', 'copy', 'skip' or 'area': see iflag meanings defined at the top of this module) - {VTYPE} , intent(inout) :: data{DIMSTR} - logical , intent(out) :: readvar ! was var read? - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - character(len=len(varname)) :: primary_varname ! first name in the varname list - character(len=len(varname)) :: my_varname ! actual varname to read/write - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - call shr_string_listGetName(varname, 1, primary_varname) - if (flag == 'read') then - call find_var_on_file(ncid, varname, my_varname) - if ((my_varname /= primary_varname) .and. masterproc) then - write(iulog,*) 'Restart file backwards compatibility: Translating: ', & - trim(my_varname), ' => ', trim(primary_varname) - end if - else - my_varname = primary_varname - end if - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - call ncd_defvar(ncid=ncid, varname=trim(my_varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - - status = PIO_inq_varid(ncid, trim(my_varname), vardesc) - varid = vardesc%varid - - call write_interpinic_flag(ncid=ncid, varid=varid, varname=varname, & - interpinic_flag=interpinic_flag) - - ! This attribute is written in order to communicate this metadata to initInterp - call ncd_putatt(ncid, varid, 'varnames_on_old_files', trim(varname)) - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if ({ITYPE}!=TYPETEXT) - call ncd_io(varname=trim(my_varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) -#endif - end if - - if (flag == 'read') then - if (.not. readvar) then - call missing_field_possibly_abort(my_varname) - end if - end if - - end subroutine restartvar_{DIMS}d_{TYPE} - - !----------------------------------------------------------------------- - !DIMS 1,2 - !TYPE text,int,double - subroutine restartvar_{DIMS}d_{TYPE}(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range, is_spatial ) - - ! Note that varname can be a colon-delimited list of possible variable names (with no - ! spaces around the colons). In this case, when flag = 'read', the input file is - ! searched for each possible variable name in order, starting with the first, until - ! one is found. This mechanism supports backwards compatibility with old restart - ! files, in case variables have been renamed. For example, if variable 'foo' was - ! recently renamed to 'bar', then varname should be 'bar:foo'. For flag = 'write', - ! the first name in the list is used. - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name (or colon-delimited list: see above) - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic ('interp', 'copy', 'skip' or 'area': see iflag meanings defined at the top of this module) - {VTYPE} , pointer :: data{DIMSTR} - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - logical , intent(in), optional :: is_spatial ! is this a spatial variable (with a dimension of gridcell, column, etc.)? If not present, assumed true. - ! - ! Local variables - character(len=len(varname)) :: primary_varname ! first name in the varname list - character(len=len(varname)) :: my_varname ! actual varname to read/write - logical :: l_is_spatial ! local version of is_spatial - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (present(is_spatial)) then - l_is_spatial = is_spatial - else - l_is_spatial = .true. - end if - - call shr_string_listGetName(varname, 1, primary_varname) - if (flag == 'read') then - call find_var_on_file(ncid, varname, my_varname) - if ((my_varname /= primary_varname) .and. masterproc) then - write(iulog,*) 'Restart file backwards compatibility: Translating: ', & - trim(my_varname), ' => ', trim(primary_varname) - end if - else - my_varname = primary_varname - end if - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(my_varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(my_varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(my_varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(my_varname), vardesc) - varid = vardesc%varid - - call write_interpinic_flag(ncid=ncid, varid=varid, varname=varname, & - interpinic_flag=interpinic_flag) - - ! This attribute is written in order to communicate this metadata to initInterp - call ncd_putatt(ncid, varid, 'varnames_on_old_files', trim(varname)) - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if ({ITYPE}!=TYPETEXT) - if (.not. present(dim1name) .or. .not. l_is_spatial) then - call ncd_io(varname=trim(my_varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(my_varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar) then - call missing_field_possibly_abort(my_varname) - end if - end if - - end subroutine restartvar_{DIMS}d_{TYPE} - - !----------------------------------------------------------------------- - !TYPE int,double - subroutine restartvar_2d_{TYPE}_bounds(ncid, flag, varname, xtype, & - dim1name, dim2name, switchdim, lowerb2, upperb2, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - ! Note that varname can be a colon-delimited list of possible variable names (with no - ! spaces around the colons). In this case, when flag = 'read', the input file is - ! searched for each possible variable name in order, starting with the first, until - ! one is found. This mechanism supports backwards compatibility with old restart - ! files, in case variables have been renamed. For example, if variable 'foo' was - ! recently renamed to 'bar', then varname should be 'bar:foo'. For flag = 'write', - ! the first name in the list is used. - - !---------------------------------------------------- - ! Arguments - type(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name (or colon-delimited list: see above) - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: dim1name ! dimension name - character(len=*) , intent(in) :: dim2name ! dimension name - logical , intent(in) :: switchdim - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic ('interp', 'copy', 'skip' or 'area': see iflag meanings defined at the top of this module) - {VTYPE} , pointer :: data(:,:) ! raw data - logical , intent(out) :: readvar ! was var read? - integer , intent(in), optional :: lowerb2 - integer , intent(in), optional :: upperb2 - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - character(len=len(varname)) :: primary_varname ! first name in the varname list - character(len=len(varname)) :: my_varname ! actual varname to read/write - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid ! returned var id - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - call shr_string_listGetName(varname, 1, primary_varname) - if (flag == 'read') then - call find_var_on_file(ncid, varname, my_varname) - if ((my_varname /= primary_varname) .and. masterproc) then - write(iulog,*) 'Restart file backwards compatibility: Translating: ', & - trim(my_varname), ' => ', trim(primary_varname) - end if - else - my_varname = primary_varname - end if - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (switchdim) then - call ncd_defvar(ncid=ncid, varname=trim(my_varname), xtype=lxtype, & - dim1name=trim(dim2name), dim2name=trim(dim1name), & - long_name=trim(long_name), units=units) - else - call ncd_defvar(ncid=ncid, varname=trim(my_varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - status = PIO_inq_varid(ncid, trim(my_varname), vardesc) - - varid = vardesc%varid - - call write_interpinic_flag(ncid=ncid, varid=varid, varname=varname, & - interpinic_flag=interpinic_flag) - - ! This attribute is written in order to communicate this metadata to initInterp - call ncd_putatt(ncid, varid, 'varnames_on_old_files', trim(varname)) - - if (switchdim) then - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 1) - else - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 0) - end if - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_values', (/0,1/)) - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_0', & - "1st and 2nd dims are same as model representation") - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_1', & - "1st and 2nd dims are switched from model representation") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else - - if (present(lowerb2) .and. present(upperb2)) then - call ncd_io(varname=trim(my_varname), data=data, & - dim1name=trim(dim1name), switchdim=switchdim, & - lowerb2=lowerb2, upperb2=upperb2, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(my_varname), data=data, & - dim1name=trim(dim1name), switchdim=switchdim, & - ncid=ncid, flag=flag, readvar=readvar) - end if - - end if - - if (flag == 'read') then - if (.not. readvar) then - call missing_field_possibly_abort(my_varname) - end if - end if - - end subroutine restartvar_2d_{TYPE}_bounds - - !----------------------------------------------------------------------- - subroutine set_missing_from_template(my_var, template_var, multiplier) - ! - ! !DESCRIPTION: - ! Set values of a missing restart field from a template field, with some constant - ! multiplier - ! - ! !USES: - use shr_infnan_mod, only : isnan => shr_infnan_isnan, nan => shr_infnan_nan, assignment(=) - ! - ! !ARGUMENTS: - real(r8), intent(out) :: my_var(:) - real(r8), intent(in) :: template_var(:) - real(r8), intent(in) :: multiplier - ! - ! !LOCAL VARIABLES: - integer :: i - - character(len=*), parameter :: subname = 'set_missing_from_template' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(template_var) == ubound(my_var)), errMsg(sourcefile, __LINE__)) - - do i = 1, size(my_var) - if (isnan(template_var(i))) then - my_var(i) = nan - else if (template_var(i) == spval) then - my_var(i) = spval - else - my_var(i) = template_var(i) * multiplier - end if - end do - - end subroutine set_missing_from_template - - !----------------------------------------------------------------------- - subroutine set_grc_field_from_col_field(bounds, ncid, varname, data_grc, readvar) - ! - ! !DESCRIPTION: - ! Set a gridcell-level field from a column-level field on the restart file. - ! - ! If the column-level field isn't found, then 'data' remains unchanged, and readvar - ! is set to .false. - ! - ! This can be useful for backwards compatibility: If a field that was previously on - ! the column level has been moved to the gridcell-level, then this routine can be - ! used to read the old column-level field and then average it to the gridcell-level. - ! - ! We may want to make this more general, so that a single routine can set a - ! gridcell-level field from a patch-, column- or landunit-level field - and maybe - ! also set a column-level field from a patch-level field, etc. - ! - ! !USES: - use subgridAveMod, only : c2g - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: varname ! variable name - real(r8) , intent(inout) :: data_grc( bounds%begg: ) ! gridcell-level data to set - logical , intent(out) :: readvar ! was var read? - ! - ! !LOCAL VARIABLES: - real(r8), pointer :: data_col(:) - - character(len=*), parameter :: subname = 'set_grc_field_from_col_field' - !----------------------------------------------------------------------- - - SHR_ASSERT_ALL((ubound(data_grc) == (/bounds%endg/)), errMsg(sourcefile, __LINE__)) - - allocate(data_col(bounds%begc:bounds%endc)) - call ncd_io(varname=trim(varname), data=data_col, & - dim1name='column', & - ncid=ncid, flag='read', readvar=readvar) - - if (readvar) then - call c2g(bounds, data_col, data_grc, & - c2l_scale_type = 'unity', & - l2g_scale_type = 'unity') - end if - - deallocate(data_col) - end subroutine set_grc_field_from_col_field - - !----------------------------------------------------------------------- - ! DIMS 1,2 - subroutine set_missing_vals_to_constant_{DIMS}d(data, val) - ! - ! !DESCRIPTION: - ! Set missing values (NaN or spval) of a restart field to some constant value - ! - ! !USES: - use shr_infnan_mod, only : isnan => shr_infnan_isnan - ! - ! !ARGUMENTS: - real(r8), intent(inout) :: data{DIMSTR} ! variable to modify - real(r8), intent(in) :: val ! value to replace any NaNs or spvals - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'set_missing_vals_to_constant_{DIMS}d' - !----------------------------------------------------------------------- - - where (isnan(data)) - data = val - elsewhere (data == spval) - data = val - end where - - end subroutine set_missing_vals_to_constant_{DIMS}d - - !----------------------------------------------------------------------- - subroutine missing_field_possibly_abort(varname) - ! - ! !DESCRIPTION: - ! This should be called if a field is missing from the restart file. It aborts with a - ! helpful error message if this run is one where a missing field is treated as an - ! error (e.g., a restart run). - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: varname ! name of variable that triggered the error - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'missing_field_possibly_abort' - !----------------------------------------------------------------------- - - if (nsrest == nsrContinue .or. & - nsrest == nsrBranch) then - if (masterproc) then - write(iulog,*) 'ERROR: Field missing from restart file: ', trim(varname) - write(iulog,*) 'Missing fields are not allowed in branch or continue (restart) runs.' - write(iulog,*) ' ' - write(iulog,*) 'This can happen when the restart file is from a different' - write(iulog,*) 'model configuration or different code base, which did not' - write(iulog,*) 'contain all of the restart fields needed for the current' - write(iulog,*) 'code base and configuration.' - write(iulog,*) ' ' - write(iulog,*) 'You can get around this problem by doing a startup or hybrid run' - write(iulog,*) 'that points to this initial condition file, instead of attempting' - write(iulog,*) 'a branch or continue run. However, note that, in many cases,' - write(iulog,*) 'this will result in the missing fields being filled in with' - write(iulog,*) 'their cold start initialization values, which may or may not' - write(iulog,*) 'be what you want.' - end if - call shr_sys_abort('Field missing from restart file.') - end if - end subroutine missing_field_possibly_abort - - !----------------------------------------------------------------------- - subroutine write_interpinic_flag(ncid, varid, varname, interpinic_flag) - ! - ! !DESCRIPTION: - ! Write interpinic_flag metadata for the given variable - ! - ! !ARGUMENTS: - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - integer , intent(in) :: varid ! variable id - character(len=*) , intent(in) :: varname ! variable name (just used for output on error) - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic ('interp', 'copy', 'skip' or 'area': see iflag meanings defined at the top of this module) - ! - ! !LOCAL VARIABLES: - integer :: status ! return error code - - character(len=*), parameter :: subname = 'write_interpinic_flag' - !----------------------------------------------------------------------- - - if (interpinic_flag == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (interpinic_flag == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (interpinic_flag == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - else if (interpinic_flag == 'area') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_area) - else - write(iulog,*) 'ERROR in restartvar for ', trim(varname) - write(iulog,*) 'Unknown interpinic_flag: ', trim(interpinic_flag) - write(iulog,*) 'Allowed values are: interp, copy, skip, area' - call endrun(msg='Unknown interpinic_flag') - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip, 4=area") - - end subroutine write_interpinic_flag - - -end module restUtilMod diff --git a/src/utils/spmdGathScatMod.F90 b/src/utils/spmdGathScatMod.F90 deleted file mode 100644 index b3314d2da6..0000000000 --- a/src/utils/spmdGathScatMod.F90 +++ /dev/null @@ -1,540 +0,0 @@ -module spmdGathScatMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: spmdGathScatMod -! -! !DESCRIPTION: -! Perform SPMD gather and scatter operations. -! -! !USES: - use clm_varcon, only: spval, ispval - use decompMod, only : get_clmlevel_gsmap - use shr_kind_mod, only: r8 => shr_kind_r8 - use spmdMod , only : masterproc, mpicom - use mct_mod , only : mct_aVect, mct_gsMap - use mct_mod , only : mct_aVect_init, mct_aVect_importIattr, mct_aVect_scatter - use mct_mod , only : mct_aVect_gather, mct_aVect_exportIattr, mct_aVect_clean - use mct_mod , only : mct_aVect_exportRattr, mct_aVect_importRattr - use abortutils, only : endrun - use clm_varctl, only : iulog - use perf_mod , only : t_startf, t_stopf -! -! !PUBLIC TYPES: - implicit none - private -! -! !PUBLIC MEMBER FUNCTIONS: - public scatter_data_from_master, gather_data_to_master - - interface scatter_data_from_master - module procedure scatter_1darray_int - module procedure scatter_1darray_real - end interface - - interface gather_data_to_master - module procedure gather_1darray_int - module procedure gather_1darray_real - end interface -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -!EOP -! - integer,private,parameter :: debug = 0 - -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: scatter_1darray_int -! -! !INTERFACE: - subroutine scatter_1darray_int (alocal, aglobal, clmlevel) -! -! !DESCRIPTION: -! Wrapper routine to scatter int 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer , pointer :: alocal(:) ! local data (output) - integer , pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - integer ,pointer :: adata(:) ! local data array - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'scatter_1darray_int' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(istring) == 0) then - istring = trim(fname) - else - istring = trim(istring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - if (debug > 1) call t_startf(trim(subname)//'_pack') - - if (masterproc) then - lsize = size(aglobal,dim=1) - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - allocate(adata(lsize)) - do n2 = lb2,ub2 - adata(1:lsize) = aglobal(1:lsize) - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importIattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_scat') - - call mct_aVect_scatter(AVi, AVo, gsmap, 0, mpicom) - - if (debug > 1) call t_stopf(trim(subname)//'_scat') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - lsize = size(alocal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportIattr(AVo,trim(fname),adata,lsize) - do n1 = lb1,ub1 - alocal(n1) = adata(n1-lb1+1) - enddo - enddo - deallocate(adata) - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVi) - endif - call mct_aVect_clean(AVo) - - call t_stopf(trim(subname)//'_total') - - end subroutine scatter_1darray_int - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: gather_1darray_int -! -! !INTERFACE: - subroutine gather_1darray_int (alocal, aglobal, clmlevel, missing) -! -! !DESCRIPTION: -! Wrapper routine to gather int 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer , pointer :: alocal(:) ! local data (output) - integer , pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid - integer ,optional,intent(in) :: missing ! missing value -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - integer ,pointer :: adata(:) ! temporary data array - integer ,pointer :: mvect(:) ! local array for mask - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'gather_1darray_int' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lsize = size(alocal,dim=1) - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - if (present(missing)) then - istring = "mask" - endif - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(istring) == 0) then - istring = trim(fname) - else - istring = trim(istring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - - if (debug > 1) call t_startf(trim(subname)//'_pack') - allocate(adata(lsize)) - do n2 = lb2,ub2 - do n1 = lb1,ub1 - adata(n1-lb1+1) = alocal(n1) - enddo - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importIattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - - if (present(missing)) then - allocate(mvect(lsize)) - do n1 = lb1,ub1 - mvect(n1-lb1+1) = 1 - enddo - call mct_aVect_importIattr(AVi,"mask",mvect,lsize) - deallocate(mvect) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_gath') - - if (present(missing)) then -! tcx wait for update in mct, then get rid of "mask" -! call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom, missing = missing) - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - else - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_gath') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - if (masterproc) then - lsize = size(aglobal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportIattr(AVo,trim(fname),adata,lsize) - aglobal(1:lsize) = adata(1:lsize) - enddo - deallocate(adata) - if (present(missing)) then - allocate(mvect(lsize)) - call mct_aVect_exportIattr(AVo,"mask",mvect,lsize) - do n1 = 1,lsize - if (mvect(n1) == 0) then - do n2 = lb2,ub2 - aglobal(n1) = missing - enddo - endif - enddo - deallocate(mvect) - endif - endif - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVo) - endif - - call mct_aVect_clean(AVi) - - call t_stopf(trim(subname)//'_total') - - end subroutine gather_1darray_int - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: scatter_1darray_real -! -! !INTERFACE: - subroutine scatter_1darray_real (alocal, aglobal, clmlevel) -! -! !DESCRIPTION: -! Wrapper routine to scatter real 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: alocal(:) ! local data (output) - real(r8), pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - real(r8),pointer :: adata(:) ! local data array - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'scatter_1darray_real' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(rstring) == 0) then - rstring = trim(fname) - else - rstring = trim(rstring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - if (debug > 1) call t_startf(trim(subname)//'_pack') - - if (masterproc) then - lsize = size(aglobal,dim=1) - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - allocate(adata(lsize)) - do n2 = lb2,ub2 - adata(1:lsize) = aglobal(1:lsize) - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importRattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_scat') - - call mct_aVect_scatter(AVi, AVo, gsmap, 0, mpicom) - - if (debug > 1) call t_stopf(trim(subname)//'_scat') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - lsize = size(alocal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportRattr(AVo,trim(fname),adata,lsize) - do n1 = lb1,ub1 - alocal(n1) = adata(n1-lb1+1) - enddo - enddo - deallocate(adata) - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVi) - endif - call mct_aVect_clean(AVo) - - call t_stopf(trim(subname)//'_total') - - end subroutine scatter_1darray_real - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: gather_1darray_real -! -! !INTERFACE: - subroutine gather_1darray_real (alocal, aglobal, clmlevel, missing) -! -! !DESCRIPTION: -! Wrapper routine to gather real 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: alocal(:) ! local data (output) - real(r8), pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid - real(r8),optional,intent(in) :: missing ! missing value -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - real(r8),pointer :: adata(:) ! temporary data array - integer ,pointer :: mvect(:) ! local array for mask - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'gather_1darray_real' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lsize = size(alocal,dim=1) - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - if (present(missing)) then - istring = "mask" - endif - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(rstring) == 0) then - rstring = trim(fname) - else - rstring = trim(rstring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - - if (debug > 1) call t_startf(trim(subname)//'_pack') - allocate(adata(lsize)) - do n2 = lb2,ub2 - do n1 = lb1,ub1 - adata(n1-lb1+1) = alocal(n1) - enddo - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importRattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - - if (present(missing)) then - allocate(mvect(lsize)) - do n1 = lb1,ub1 - mvect(n1-lb1+1) = 1 - enddo - call mct_aVect_importIattr(AVi,"mask",mvect,lsize) - deallocate(mvect) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_gath') - - if (present(missing)) then -! tcx wait for update in mct, then get rid of "mask" -! call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom, missing = missing) - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - else - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_gath') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - if (masterproc) then - lsize = size(aglobal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportRattr(AVo,trim(fname),adata,lsize) - aglobal(1:lsize) = adata(1:lsize) - enddo - deallocate(adata) - if (present(missing)) then - allocate(mvect(lsize)) - call mct_aVect_exportIattr(AVo,"mask",mvect,lsize) - do n1 = 1,lsize - if (mvect(n1) == 0) then - do n2 = lb2,ub2 - aglobal(n1) = missing - enddo - endif - enddo - deallocate(mvect) - endif - endif - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVo) - endif - - call mct_aVect_clean(AVi) - - call t_stopf(trim(subname)//'_total') - - end subroutine gather_1darray_real - -end module spmdGathScatMod diff --git a/src/utils/spmdMod.F90 b/src/utils/spmdMod.F90 deleted file mode 100644 index 6983b96281..0000000000 --- a/src/utils/spmdMod.F90 +++ /dev/null @@ -1,142 +0,0 @@ - -module spmdMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: spmdMod -! -! !DESCRIPTION: -! SPMD initialization -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varctl , only: iulog - implicit none - - private - -#include - - save - - ! Default settings valid even if there is no spmd - - logical, public :: masterproc ! proc 0 logical for printing msgs - integer, public :: iam ! processor number - integer, public :: npes ! number of processors for clm - integer, public :: mpicom ! communicator group for clm - integer, public :: comp_id ! component id - - ! - ! Public methods - ! - public :: spmd_init ! Initialization - - ! - ! Values from mpif.h that can be used - ! - public :: MPI_INTEGER - public :: MPI_REAL8 - public :: MPI_LOGICAL - public :: MPI_SUM - public :: MPI_MIN - public :: MPI_MAX - public :: MPI_LOR - public :: MPI_STATUS_SIZE - public :: MPI_ANY_SOURCE - public :: MPI_CHARACTER - public :: MPI_COMM_WORLD - public :: MPI_MAX_PROCESSOR_NAME - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: spmd_init( clm_mpicom ) -! -! !INTERFACE: - subroutine spmd_init( clm_mpicom, LNDID ) -! -! !DESCRIPTION: -! MPI initialization (number of cpus, processes, tids, etc) -! -! !USES -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: clm_mpicom - integer, intent(in) :: LNDID -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i,j ! indices - integer :: ier ! return error status - integer :: mylength ! my processor length - logical :: mpi_running ! temporary - integer, allocatable :: length(:) - integer, allocatable :: displ(:) - character*(MPI_MAX_PROCESSOR_NAME), allocatable :: procname(:) - character*(MPI_MAX_PROCESSOR_NAME) :: myprocname -!----------------------------------------------------------------------- - - ! Initialize mpi communicator group - - mpicom = clm_mpicom - - comp_id = LNDID - - ! Get my processor id - - call mpi_comm_rank(mpicom, iam, ier) - if (iam==0) then - masterproc = .true. - else - masterproc = .false. - end if - - ! Get number of processors - - call mpi_comm_size(mpicom, npes, ier) - - ! Get my processor names - - allocate (length(0:npes-1), displ(0:npes-1), procname(0:npes-1)) - - call mpi_get_processor_name (myprocname, mylength, ier) - call mpi_allgather(mylength,1,MPI_INTEGER,length,1,MPI_INTEGER,mpicom,ier) - - do i = 0,npes-1 - displ(i)=i*MPI_MAX_PROCESSOR_NAME - end do - call mpi_gatherv (myprocname,mylength,MPI_CHARACTER, & - procname,length,displ,MPI_CHARACTER,0,mpicom,ier) - if (masterproc) then - write(iulog,100)npes - write(iulog,200) - write(iulog,220) - do i=0,npes-1 - write(iulog,250)i,(procname((i))(j:j),j=1,length(i)) - end do - endif - - deallocate (length, displ, procname) - -100 format(//,i3," pes participating in computation for CLM") -200 format(/,35('-')) -220 format(/,"NODE#",2x,"NAME") -250 format("(",i5,")",2x,100a1,//) - - end subroutine spmd_init - -end module spmdMod diff --git a/src/utils/test/CMakeLists.txt b/src/utils/test/CMakeLists.txt deleted file mode 100644 index 53a211e89c..0000000000 --- a/src/utils/test/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(clm_time_manager_test) -add_subdirectory(annual_flux_dribbler_test) -add_subdirectory(quadratic_test) diff --git a/src/utils/test/annual_flux_dribbler_test/CMakeLists.txt b/src/utils/test/annual_flux_dribbler_test/CMakeLists.txt deleted file mode 100644 index 74923ce9a7..0000000000 --- a/src/utils/test/annual_flux_dribbler_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(annual_flux_dribbler test_annual_flux_dribbler_exe - "test_annual_flux_dribbler.pf" "") - -target_link_libraries(test_annual_flux_dribbler_exe clm csm_share esmf_wrf_timemgr) diff --git a/src/utils/test/annual_flux_dribbler_test/test_annual_flux_dribbler.pf b/src/utils/test/annual_flux_dribbler_test/test_annual_flux_dribbler.pf deleted file mode 100644 index bd9f8e489a..0000000000 --- a/src/utils/test/annual_flux_dribbler_test/test_annual_flux_dribbler.pf +++ /dev/null @@ -1,300 +0,0 @@ -module test_annual_flux_dribbler - - ! Tests of AnnualFluxDribbler - - use pfunit_mod - use AnnualFluxDribbler - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestSubgridMod - use unittestSimpleSubgridSetupsMod - use unittestTimeManagerMod, only : unittest_timemgr_setup, unittest_timemgr_teardown - use unittestTimeManagerMod, only : & - set_date => unittest_timemgr_set_curr_date - - implicit none - - @TestCase - type, extends(TestCase) :: TestDribbler - ! Put the dribbler object in the TestDribbler class so we can call Clean in teardown - type(annual_flux_dribbler_type) :: dribbler - contains - procedure :: setUp - procedure :: tearDown - end type TestDribbler - - real(r8), parameter :: tol = 1.e-13_r8 - - ! Some tests need a larger tolerance, since we're dealing with values with large - ! magnitudes - real(r8), parameter :: tol_large = 1.e-6_r8 - - ! Deliberately choosing a dtime different from the standard 1800, to make sure it's - ! handled correctly - integer, parameter :: dtime = 3600 - - real(r8), parameter :: secs_in_year = 365._r8 * 86400._r8 - -contains - - subroutine setUp(this) - class(TestDribbler), intent(inout) :: this - - call unittest_timemgr_setup(dtime=dtime) - end subroutine setUp - - subroutine tearDown(this) - class(TestDribbler), intent(inout) :: this - - call this%dribbler%Clean() - call unittest_timemgr_teardown() - call unittest_subgrid_teardown() - end subroutine tearDown - - subroutine set_date_first_timestep_of_year() - ! Sets the time manager's date so that it's the first timestep of the year, in year 2 - call set_date(yr=2, mon=1, day=1, tod=dtime) - end subroutine set_date_first_timestep_of_year - - @Test - subroutine firstTimestepOfYear_fluxDribbled(this) - ! Add a delta on the first time step of the year; make sure this flux gets divided by - ! the proper amount to create a flux in that time step - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta(1) = [1.e9_r8] - real(r8) :: flux(1) - real(r8) :: amount_left_to_dribble(1) - real(r8) :: amount_dribbled_in_this_timestep - real(r8) :: tot_amount_to_dribble - real(r8) :: expected_flux - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-') - call set_date_first_timestep_of_year() - - call this%dribbler%set_curr_delta(bounds, delta) - call this%dribbler%get_curr_flux(bounds, flux) - call this%dribbler%get_amount_left_to_dribble_end(bounds, amount_left_to_dribble) - - expected_flux = delta(1) / secs_in_year - @assertEqual(expected_flux, flux(1), tolerance=tol) - - ! Also make sure that flux*dtime + amount_left_to_dribble = delta - i.e., if you add - ! the amount dribbled in this timestep to the reported amount left to dribble, you - ! get the original delta - amount_dribbled_in_this_timestep = flux(1) * dtime - tot_amount_to_dribble = amount_dribbled_in_this_timestep + amount_left_to_dribble(1) - @assertEqual(delta(1), tot_amount_to_dribble, tolerance=tol) - end subroutine firstTimestepOfYear_fluxDribbled - - @Test - subroutine firstTimestepOfYear_patch_fluxDribbled(this) - ! For a patch-level variable: Add a delta on the first time step of the year; make - ! sure this flux gets divided by the proper amount to create a flux in that time step - ! - ! The point of this unit test is to make sure that the flux dribbler infrastructure - ! works for patch level variables - so here we exercise the main routines that have - ! code that works generically for the different subgrid levels. - ! - ! Note that this also exercises the code for multiple points. - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta(2) = [1.e9_r8, 2.e9_r8] - real(r8) :: flux(2) - real(r8) :: expected_flux(2) - real(r8) :: amount_left_to_dribble(2) - real(r8) :: amount_dribbled_in_this_timestep(2) - real(r8) :: tot_amount_to_dribble(2) - - call setup_n_veg_patches(pwtcol = [0.4_r8, 0.6_r8], pft_types = [1, 2]) - this%dribbler = annual_flux_dribbler_patch(bounds, & - name = 'foo', units = '-') - call set_date_first_timestep_of_year() - - call this%dribbler%set_curr_delta(bounds, delta) - call this%dribbler%get_curr_flux(bounds, flux) - call this%dribbler%get_amount_left_to_dribble_end(bounds, amount_left_to_dribble) - - expected_flux(:) = delta(:) / secs_in_year - @assertEqual(expected_flux, flux, tolerance=tol) - - ! Also make sure that flux*dtime + amount_left_to_dribble = delta - i.e., if you add - ! the amount dribbled in this timestep to the reported amount left to dribble, you - ! get the original delta - amount_dribbled_in_this_timestep(:) = flux(:) * dtime - tot_amount_to_dribble(:) = amount_dribbled_in_this_timestep(:) + amount_left_to_dribble(:) - @assertEqual(delta, tot_amount_to_dribble, tolerance=tol) - end subroutine firstTimestepOfYear_patch_fluxDribbled - - @Test - subroutine deltaAddedMidyear_ignoredInLaterTimesteps(this) - ! Make sure that a delta added mid-year is ignored on all later time steps - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta_first_timestep(1) = [1.e9_r8] - real(r8), parameter :: delta_should_be_ignored(1) = [3.e6_r8] - real(r8) :: flux(1) - real(r8) :: expected_flux - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-') - - ! Add some delta at the beginning of the year, which will go into the dribbling flux - call set_date_first_timestep_of_year() - call this%dribbler%set_curr_delta(bounds, delta_first_timestep) - - ! Add some delta that should be ignored - call set_date(yr=2, mon=1, day=2, tod=dtime) - call this%dribbler%set_curr_delta(bounds, delta_should_be_ignored) - - ! Advance time; in this time step, the delta is 0 - call set_date(yr=2, mon=1, day=3, tod=dtime) - call this%dribbler%set_curr_delta(bounds, [0._r8]) - - call this%dribbler%get_curr_flux(bounds, flux) - - expected_flux = delta_first_timestep(1) / secs_in_year - @assertEqual(expected_flux, flux(1), tolerance=tol) - end subroutine deltaAddedMidyear_ignoredInLaterTimesteps - - @Test - subroutine secondTimestep_fluxAdded(this) - ! Add a delta on the first time step of the year. Then change to the second time step - ! and add some other delta. Make sure that the flux in that later time step is the sum - ! of the dribbled flux and the new flux. - ! - ! Also checks get_dribbled_delta (this is a good test to check that in, because it involves - ! two different deltas). - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta_first_timestep(1) = [1.e9_r8] - real(r8), parameter :: delta_second_timestep(1) = [5000._r8] - real(r8) :: flux(1) - real(r8) :: delta(1) - real(r8) :: amount_left_to_dribble(1) - real(r8) :: amount_dribbled_so_far, tot_amount_to_dribble - real(r8) :: expected_dribbled, expected_from_this_timestep, expected_flux, expected_delta - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-') - - ! Add some delta at the beginning of the year, which will go into the dribbling flux - call set_date_first_timestep_of_year() - call this%dribbler%set_curr_delta(bounds, delta_first_timestep) - - ! Add some delta in the current timestep - call set_date(yr=2, mon=1, day=1, tod=dtime*2) - call this%dribbler%set_curr_delta(bounds, delta_second_timestep) - - call this%dribbler%get_curr_flux(bounds, flux) - call this%dribbler%get_dribbled_delta(bounds, delta) - call this%dribbler%get_amount_left_to_dribble_end(bounds, amount_left_to_dribble) - - expected_dribbled = delta_first_timestep(1) / secs_in_year - expected_from_this_timestep = delta_second_timestep(1) / dtime - expected_flux = expected_dribbled + expected_from_this_timestep - expected_delta = expected_flux * dtime - @assertEqual(expected_flux, flux(1), tolerance=tol) - @assertEqual(expected_delta, delta(1), tolerance=tol) - - ! Also make sure that (dribbled flux)*dtime*2 + amount_left_to_dribble = delta - i.e., - ! if you add the amount dribbled in this timestep and the first timestep to the - ! reported amount left to dribble, you get the original delta - amount_dribbled_so_far = expected_dribbled * dtime * 2 - tot_amount_to_dribble = amount_dribbled_so_far + amount_left_to_dribble(1) - @assertEqual(delta_first_timestep(1), tot_amount_to_dribble, tolerance=tol) - end subroutine secondTimestep_fluxAdded - - @Test - subroutine allowsNonAnnualFalse(this) - ! Make sure that operation is correct when allows_non_annual_delta is .false. - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta(1) = [1.e9_r8] - real(r8) :: flux(1) - real(r8) :: expected_flux - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-', allows_non_annual_delta = .false.) - - ! Add some delta at the beginning of the year, which will go into the dribbling flux - call set_date_first_timestep_of_year() - call this%dribbler%set_curr_delta(bounds, delta) - - ! Add some delta in the current timestep - call set_date(yr=2, mon=1, day=1, tod=dtime*2) - call this%dribbler%set_curr_delta(bounds, [0._r8]) - - call this%dribbler%get_curr_flux(bounds, flux) - - expected_flux = delta(1) / secs_in_year - @assertEqual(expected_flux, flux(1), tolerance=tol) - end subroutine allowsNonAnnualFalse - - @Test - subroutine secondToLastTimestep_amountLeft(this) - ! Check amount left to dribble on the second to last time step in the year. This - ! checks both get_amount_left_to_dribble_beg and get_amount_left_to_dribble_end - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta(1) = [1.e9_r8] - real(r8) :: amount_left_to_dribble_beg(1) - real(r8) :: amount_left_to_dribble_end(1) - real(r8) :: dribbled_flux - real(r8) :: dribbled_amount_per_timestep - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-') - call set_date_first_timestep_of_year() - call this%dribbler%set_curr_delta(bounds, delta) - - call set_date(yr=2, mon=12, day=31, tod=86400-dtime) - call this%dribbler%get_amount_left_to_dribble_beg(bounds, amount_left_to_dribble_beg) - call this%dribbler%get_amount_left_to_dribble_end(bounds, amount_left_to_dribble_end) - - dribbled_flux = delta(1) / secs_in_year - dribbled_amount_per_timestep = dribbled_flux * dtime - @assertEqual(2._r8*dribbled_amount_per_timestep, amount_left_to_dribble_beg(1), tolerance=tol_large) - @assertEqual(dribbled_amount_per_timestep, amount_left_to_dribble_end(1), tolerance=tol_large) - end subroutine secondToLastTimestep_amountLeft - - @Test - subroutine lastTimestep_amountLeftEnd_is0(this) - ! On the last timestep of the year, the amount returned by - ! get_amount_left_to_dribble_end should be 0 - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta(1) = [1.e9_r8] - real(r8) :: amount_left_to_dribble(1) - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-') - call set_date_first_timestep_of_year() - call this%dribbler%set_curr_delta(bounds, delta) - - ! Set date to the last time step of the year (this looks like the start of the next - ! year since date is given at the end of the time step) - call set_date(yr=3, mon=1, day=1, tod=0) - call this%dribbler%get_amount_left_to_dribble_end(bounds, amount_left_to_dribble) - - @assertEqual(0._r8, amount_left_to_dribble(1)) - end subroutine lastTimestep_amountLeftEnd_is0 - - @Test - subroutine firstTimestep_amountLeftBeg_is0(this) - ! On the first timestep of the year, get_amount_left_to_dribble_beg should give 0 - class(TestDribbler), intent(inout) :: this - real(r8), parameter :: delta(1) = [1.e9_r8] - real(r8) :: amount_left_to_dribble(1) - - call setup_single_veg_patch(pft_type=1) - this%dribbler = annual_flux_dribbler_gridcell(bounds, & - name = 'foo', units = '-') - call set_date_first_timestep_of_year() - call this%dribbler%set_curr_delta(bounds, delta) - - call this%dribbler%get_amount_left_to_dribble_beg(bounds, amount_left_to_dribble) - - @assertEqual(0._r8, amount_left_to_dribble(1)) - end subroutine firstTimestep_amountLeftBeg_is0 - -end module test_annual_flux_dribbler diff --git a/src/utils/test/clm_time_manager_test/CMakeLists.txt b/src/utils/test/clm_time_manager_test/CMakeLists.txt deleted file mode 100644 index 3651eaf984..0000000000 --- a/src/utils/test/clm_time_manager_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(clm_time_manager test_clm_time_manager_exe - "test_clm_time_manager.pf" "") - -target_link_libraries(test_clm_time_manager_exe clm csm_share esmf_wrf_timemgr) diff --git a/src/utils/test/clm_time_manager_test/test_clm_time_manager.pf b/src/utils/test/clm_time_manager_test/test_clm_time_manager.pf deleted file mode 100644 index b27a16f912..0000000000 --- a/src/utils/test/clm_time_manager_test/test_clm_time_manager.pf +++ /dev/null @@ -1,223 +0,0 @@ -module test_clm_time_manager - - ! Tests of clm_time_manager - - use pfunit_mod - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_time_manager - use unittestTimeManagerMod, only : unittest_timemgr_setup, unittest_timemgr_teardown - use unittestTimeManagerMod, only : & - set_date => unittest_timemgr_set_curr_date, & - set_nstep => unittest_timemgr_set_nstep - - implicit none - save - - real(r8), parameter :: tol = 1.e-13_r8 - integer, parameter :: dtime = 1800 - - @TestCase - type, extends(TestCase) :: TestTimeManager - contains - procedure :: setUp - procedure :: tearDown - end type TestTimeManager - -contains - - subroutine setUp(this) - class(TestTimeManager), intent(inout) :: this - - call unittest_timemgr_setup(dtime=dtime) - end subroutine setUp - - subroutine tearDown(this) - class(TestTimeManager), intent(inout) :: this - - call unittest_timemgr_teardown() - end subroutine tearDown - - @Test - subroutine getStepSize_returnsCorrectValue(this) - class(TestTimeManager), intent(inout) :: this - integer :: step_size - - step_size = get_step_size() - - @assertEqual(dtime, step_size) - end subroutine getStepSize_returnsCorrectValue - - @Test - subroutine getCurrYearfrac_atYearBoundary_returns0(this) - class(TestTimeManager), intent(inout) :: this - real(r8) :: yearfrac - - call set_date(yr=2, mon=1, day=1, tod=0) - - yearfrac = get_curr_yearfrac() - - @assertEqual(0._r8, yearfrac) - end subroutine getCurrYearfrac_atYearBoundary_returns0 - - @Test - subroutine getCurrYearfrac_inMiddleOfYear_returnsCorrectValue(this) - class(TestTimeManager), intent(inout) :: this - real(r8) :: yearfrac - real(r8) :: yearfrac_expected - - call set_date(yr=2, mon=3, day=1, tod=43200) - - yearfrac = get_curr_yearfrac() - - yearfrac_expected = 59.5_r8 / 365._r8 - @assertEqual(yearfrac_expected, yearfrac) - end subroutine getCurrYearfrac_inMiddleOfYear_returnsCorrectValue - - @Test - subroutine getPrevYearfrac_atYearBoundary_returnsLargeValue(this) - class(TestTimeManager), intent(inout) :: this - real(r8) :: yearfrac - integer, parameter :: secs_in_day = 86400 - real(r8) :: yearfrac_expected - - call set_date(yr=2, mon=1, day=1, tod=0) - - yearfrac = get_prev_yearfrac() - - yearfrac_expected = (365._r8 - real(dtime, r8) / real(secs_in_day, r8)) / 365._r8 - @assertEqual(yearfrac_expected, yearfrac) - end subroutine getPrevYearfrac_atYearBoundary_returnsLargeValue - - @Test - subroutine getPrevYearfrac_inMiddleOfYear_returnsCorrectValue(this) - class(TestTimeManager), intent(inout) :: this - real(r8) :: yearfrac - integer, parameter :: secs_in_day = 86400 - real(r8) :: yearfrac_expected - - call set_date(yr=2, mon=3, day=1, tod=43200) - - yearfrac = get_prev_yearfrac() - - yearfrac_expected = (59.5_r8 - real(dtime, r8) / real(secs_in_day, r8)) / 365._r8 - @assertEqual(yearfrac_expected, yearfrac) - end subroutine getPrevYearfrac_inMiddleOfYear_returnsCorrectValue - - @Test - subroutine getNstep_step0(this) - class(TestTimeManager), intent(inout) :: this - integer :: nstep - - nstep = get_nstep() - - @assertEqual(0, nstep) - end subroutine getNstep_step0 - - @Test - subroutine getNstep_step3(this) - class(TestTimeManager), intent(inout) :: this - integer, parameter :: expected_nstep = 3 - integer :: nstep - - call set_nstep(expected_nstep) - - nstep = get_nstep() - - @assertEqual(expected_nstep, nstep) - end subroutine getNstep_step3 - - @Test - subroutine isBegCurrYear_atBeg(this) - class(TestTimeManager), intent(inout) :: this - logical :: is_beg - - call set_date(yr=2, mon=1, day=1, tod=dtime) - - is_beg = is_beg_curr_year() - - @assertTrue(is_beg) - end subroutine isBegCurrYear_atBeg - - @Test - subroutine isBegCurrYear_notAtBeg(this) - class(TestTimeManager), intent(inout) :: this - logical :: is_beg - - call set_date(yr=2, mon=1, day=2, tod=dtime) - - is_beg = is_beg_curr_year() - - @assertFalse(is_beg) - end subroutine isBegCurrYear_notAtBeg - - @Test - subroutine isEndCurrYear_atEnd(this) - class(TestTimeManager), intent(inout) :: this - logical :: is_end - - call set_date(yr=2, mon=1, day=1, tod=0) - - is_end = is_end_curr_year() - - @assertTrue(is_end) - end subroutine isEndCurrYear_atEnd - - @Test - subroutine isEndCurrYear_notAtEnd(this) - class(TestTimeManager), intent(inout) :: this - logical :: is_end - - call set_date(yr=2, mon=1, day=2, tod=0) - - is_end = is_end_curr_year() - - @assertFalse(is_end) - end subroutine isEndCurrYear_notAtEnd - - @Test - subroutine isFirstStep_atFirstStep(this) - class(TestTimeManager), intent(inout) :: this - logical :: is_first - - is_first = is_first_step() - - @assertTrue(is_first) - end subroutine isFirstStep_atFirstStep - - @Test - subroutine isFirstStep_notAtFirstStep(this) - class(TestTimeManager), intent(inout) :: this - logical :: is_first - - call set_nstep(1) - - is_first = is_first_step() - - @assertFalse(is_first) - end subroutine isFirstStep_notAtFirstStep - - @Test - subroutine check_DA_nstep(this) - class(TestTimeManager), intent(inout) :: this - integer :: nstep - - nstep = 100 - call set_nstep(nstep) - - @assertEqual( nstep, get_nstep() ) - @assertEqual( nstep, get_nstep_since_startup_or_lastDA_restart_or_pause() ) - - ! Now update DA nstep, and nstep should be the same, but DA step should be zero - call update_DA_nstep() - @assertEqual( nstep, get_nstep() ) - @assertEqual( 0, get_nstep_since_startup_or_lastDA_restart_or_pause() ) - - ! Advance time step and should be one more step out - call advance_timestep() - - @assertEqual( nstep+1, get_nstep() ) - @assertEqual( 1, get_nstep_since_startup_or_lastDA_restart_or_pause() ) - - end subroutine check_DA_nstep - -end module test_clm_time_manager diff --git a/src/utils/test/quadratic_test/CMakeLists.txt b/src/utils/test/quadratic_test/CMakeLists.txt deleted file mode 100644 index 50d6c92f1a..0000000000 --- a/src/utils/test/quadratic_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -create_pFUnit_test(quadratic test_quadratic_exe - "test_quadratic.pf" "") - -target_link_libraries(test_quadratic_exe clm csm_share) diff --git a/src/utils/test/quadratic_test/test_quadratic.pf b/src/utils/test/quadratic_test/test_quadratic.pf deleted file mode 100644 index 34ecc12eb7..0000000000 --- a/src/utils/test/quadratic_test/test_quadratic.pf +++ /dev/null @@ -1,187 +0,0 @@ -module test_quadratic - - ! Tests of quadratic - - use pfunit_mod - use quadraticMod - use shr_kind_mod , only : r8 => shr_kind_r8 - use unittestUtils, only : endrun_msg - - implicit none - - @TestCase - type, extends(TestCase) :: TestQuadratic - contains - procedure :: setUp - procedure :: tearDown - end type TestQuadratic - - real(r8), parameter :: tol = 1.e-15_r8 - real(r8), parameter :: tol_big = 1.e-6_r8 - -contains - - subroutine setUp(this) - class(TestQuadratic), intent(inout) :: this - end subroutine setUp - - subroutine tearDown(this) - class(TestQuadratic), intent(inout) :: this - - end subroutine tearDown - - subroutine check_root(a,b,c,root) - real(r8), intent(IN):: a, b, c, root - real(r8) :: result - - result = a*root*root + b*root + c - if ( abs(result) > 1.e-12 )then - print *, 'result = ', result - print *, 'a, b, c = ', a, b, c - end if - @AssertEqual( result, 0.0_r8, tolerance=tol) - - end subroutine check_root - - ! ------------------------------------------------------------------------ - ! Tests of zero roots - ! ------------------------------------------------------------------------ - - @Test - subroutine zero_root(this) - class(TestQuadratic), intent(inout) :: this - real(r8) :: b, c, r1, r2 - real(r8) :: a(3) - integer :: i - - a = (/ 1000.0_r8, 5.12345678_r8, -31.415927465859_r8 /) - b = 0.0_r8 - c = 0.0_r8 - do i = 1, size(a) - call quadratic (a(i), b, c, r1, r2) - call check_root(a(i), b, c, r1) - @assertEqual(0.0_r8, r1, tolerance=tol) - @assertEqual(1.e+36_r8, r2, tolerance=tol) - end do - - end subroutine zero_root - - ! ------------------------------------------------------------------------ - ! Tests of simple roots - ! ------------------------------------------------------------------------ - - @Test - subroutine simple_roots(this) - class(TestQuadratic), intent(inout) :: this - real(r8) :: r1, r2 - real(r8) :: a(2), b(2), c(2) - real(r8) :: expectedr1(2), expectedr2(2) - integer :: i - - a = (/ 1.0_r8, 1.0_r8 /) - b = (/ 3.0_r8, 0.0_r8 /) - c = (/ 2.0_r8, -4.0_r8 /) - expectedr1 = (/ -2.0_r8, -2.0_r8 /) - expectedr2 = (/ -1.0_r8, +2.0_r8 /) - do i = 1, size(a) - call quadratic (a(i), b(i), c(i), r1, r2) - call check_root(a(i), b(i), c(i), r1) - call check_root(a(i), b(i), c(i), r2) - @assertEqual(expectedr1(i), r1, tolerance=tol) - @assertEqual(expectedr2(i), r2, tolerance=tol) - end do - - end subroutine simple_roots - - ! ------------------------------------------------------------------------ - ! Tests of near_zero_sqrts - ! ------------------------------------------------------------------------ - - @Test - subroutine near_zero_sqrts(this) - class(TestQuadratic), intent(inout) :: this - real(r8) :: r1, r2 - real(r8) :: a(1), b(1), c(1), c_coef - real(r8) :: pert(3) - real(r8) :: expectedr1(1) - integer :: i, j - - a = (/ 1.0_r8 /) - b = (/ 4.0_r8 /) - c = (/ 4.0_r8 /) - expectedr1 = (/ -2.0_r8 /) - do i = 1, size(a) - pert = (/ 0.0_r8, 0.5_r8*epsilon(b(i)), 2.0_r8*epsilon(b(i)) /) - ! Check that b2 - 4ac is zero, which is what this test is about - @assertEqual( 0.0_r8, b*b - 4.0_r8*a(i)*c(i) ) - do j = 1, size(pert) - c_coef = c(i)+pert(j) - print *, 'a, b, c_ = ', a(i), b(i), c_coef - call quadratic (a(i), b(i), c_coef, r1, r2) - call check_root(a(i), b(i), c_coef, r1) - call check_root(a(i), b(i), c_coef, r2) - @assertEqual(expectedr1(i), r1, tolerance=tol_big) - @assertEqual(r1, r2, tolerance=tol_big ) - end do - end do - - end subroutine near_zero_sqrts - - ! ------------------------------------------------------------------------ - ! Tests of error conditions - ! ------------------------------------------------------------------------ - - @Test - subroutine check_errorcondsazero(this) - class(TestQuadratic), intent(inout) :: this - - character(len=:), allocatable :: expected_msg - real(r8) :: r1, r2 - real(r8) :: a, b, c - - a = 0.0_r8 - b = a - c = a - call quadratic (a, b, c, r1, r2) - expected_msg = endrun_msg( & - 'quadratic ERROR: Quadratic solution error') - @assertExceptionRaised(expected_msg) - end subroutine check_errorcondsazero - - @Test - subroutine check_errorcondsimaginary(this) - class(TestQuadratic), intent(inout) :: this - - character(len=:), allocatable :: expected_msg - real(r8) :: r1, r2 - real(r8) :: a, b, c - - a = 1.0_r8 - b = 2.0_r8 - c = 5.0_r8 - call quadratic (a, b, c, r1, r2) - expected_msg = endrun_msg( & - 'quadratic ERROR: Quadratic solution error: b^2 - 4ac is negative') - @assertExceptionRaised(expected_msg) - end subroutine check_errorcondsimaginary - - @Test - subroutine check_errorcondsbarelyimaginary(this) - class(TestQuadratic), intent(inout) :: this - - character(len=:), allocatable :: expected_msg - real(r8) :: r1, r2 - real(r8) :: a, b, c - a = 1.0_r8 - b = 4.0_r8 - c = 4.0_r8 + 100.0_r8*epsilon(b) - call quadratic (a, b, c, r1, r2) - call check_root(a, b, c, r1) - call check_root(a, b, c, r2) - expected_msg = endrun_msg( & - 'quadratic ERROR: Quadratic solution error: b^2 - 4ac is negative') - @assertExceptionRaised(expected_msg) - - end subroutine check_errorcondsbarelyimaginary - -end module test_quadratic diff --git a/src_clm40/biogeochem/C13SummaryMod.F90 b/src_clm40/biogeochem/C13SummaryMod.F90 deleted file mode 100644 index 79d926e6bd..0000000000 --- a/src_clm40/biogeochem/C13SummaryMod.F90 +++ /dev/null @@ -1,820 +0,0 @@ -module C13SummaryMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: C13SummaryMod -! -! !DESCRIPTION: -! Module for isotope carbon summary calculations -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: C13Summary -! -! !REVISION HISTORY: -! 7/13/2005: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13Summary -! -! !INTERFACE: -subroutine C13Summary(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, perform pft and column-level carbon -! summary calculations -! -! !USES: - use clmtype - use pft2colMod, only: p2c - use clm_varctl, only: iulog, use_c13 - use shr_sys_mod, only: shr_sys_flush -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 12/9/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars - real(r8), pointer :: col_fire_closs(:) ! (gC/m2/s) total column-level fire C loss - real(r8), pointer :: er(:) ! (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - real(r8), pointer :: hr(:) ! (gC/m2/s) total heterotrophic respiration - real(r8), pointer :: litfire(:) ! (gC/m2/s) litter fire losses - real(r8), pointer :: lithr(:) ! (gC/m2/s) litter heterotrophic respiration - real(r8), pointer :: litr1_hr(:) - real(r8), pointer :: litr2_hr(:) - real(r8), pointer :: litr3_hr(:) - real(r8), pointer :: m_cwdc_to_fire(:) - real(r8), pointer :: m_litr1c_to_fire(:) - real(r8), pointer :: m_litr2c_to_fire(:) - real(r8), pointer :: m_litr3c_to_fire(:) - real(r8), pointer :: nee(:) ! (gC/m2/s) net ecosystem exchange of carbon, includes fire, land-use, and wood products flux, positive for source - real(r8), pointer :: nbp(:) ! (gC/m2/s) net biome production, includes fire, land-use, and wood products flux, positive for sink - real(r8), pointer :: nep(:) ! (gC/m2/s) net ecosystem production, excludes fire, land-use, and wood products flux, positive for sink - real(r8), pointer :: col_ar(:) ! (gC/m2/s) autotrophic respiration (MR + GR) - real(r8), pointer :: col_gpp(:) !GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: col_npp(:) ! (gC/m2/s) net primary production - real(r8), pointer :: col_pft_fire_closs(:) ! (gC/m2/s) total pft-level fire C loss - real(r8), pointer :: col_rr(:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: col_vegfire(:) ! (gC/m2/s) pft-level fire loss (obsolete, mark for removal) - real(r8), pointer :: col_wood_harvestc(:) - real(r8), pointer :: soil1_hr(:) - real(r8), pointer :: soil2_hr(:) - real(r8), pointer :: soil3_hr(:) - real(r8), pointer :: soil4_hr(:) - real(r8), pointer :: somfire(:) ! (gC/m2/s) soil organic matter fire losses - real(r8), pointer :: somhr(:) ! (gC/m2/s) soil organic matter heterotrophic respiration - real(r8), pointer :: sr(:) ! (gC/m2/s) total soil respiration (HR + root resp) - real(r8), pointer :: totfire(:) ! (gC/m2/s) total ecosystem fire losses - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: col_totpftc(:) ! (gC/m2) total pft-level carbon, including cpool - real(r8), pointer :: col_totvegc(:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: totcolc(:) ! (gC/m2) total column carbon, incl veg and cpool - real(r8), pointer :: totecosysc(:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool - real(r8), pointer :: totlitc(:) ! (gC/m2) total litter carbon - real(r8), pointer :: totsomc(:) ! (gC/m2) total soil organic matter carbon - real(r8), pointer :: agnpp(:) ! (gC/m2/s) aboveground NPP - real(r8), pointer :: ar(:) ! (gC/m2/s) autotrophic respiration (MR + GR) - real(r8), pointer :: bgnpp(:) ! (gC/m2/s) belowground NPP - real(r8), pointer :: cpool_deadcroot_gr(:) - real(r8), pointer :: cpool_deadcroot_storage_gr(:) - real(r8), pointer :: cpool_deadstem_gr(:) - real(r8), pointer :: cpool_deadstem_storage_gr(:) - real(r8), pointer :: cpool_froot_gr(:) - real(r8), pointer :: cpool_froot_storage_gr(:) - real(r8), pointer :: cpool_leaf_gr(:) - real(r8), pointer :: cpool_leaf_storage_gr(:) - real(r8), pointer :: cpool_livecroot_gr(:) - real(r8), pointer :: cpool_livecroot_storage_gr(:) - real(r8), pointer :: cpool_livestem_gr(:) - real(r8), pointer :: cpool_livestem_storage_gr(:) - real(r8), pointer :: cpool_to_deadcrootc(:) - real(r8), pointer :: cpool_to_deadstemc(:) - real(r8), pointer :: cpool_to_frootc(:) - real(r8), pointer :: cpool_to_leafc(:) - real(r8), pointer :: cpool_to_livecrootc(:) - real(r8), pointer :: cpool_to_livestemc(:) - real(r8), pointer :: current_gr(:) ! (gC/m2/s) growth resp for new growth displayed in this timestep - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: frootc_to_litter(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: froot_mr(:) - real(r8), pointer :: froot_curmr(:) - real(r8), pointer :: froot_xsmr(:) - real(r8), pointer :: gpp(:) !GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: gr(:) ! (gC/m2/s) total growth respiration - real(r8), pointer :: leafc_to_litter(:) - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: leaf_mr(:) - real(r8), pointer :: leaf_curmr(:) - real(r8), pointer :: leaf_xsmr(:) - real(r8), pointer :: litfall(:) ! (gC/m2/s) litterfall (leaves and fine roots) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: livecroot_mr(:) - real(r8), pointer :: livecroot_curmr(:) - real(r8), pointer :: livecroot_xsmr(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: livestem_mr(:) - real(r8), pointer :: livestem_curmr(:) - real(r8), pointer :: livestem_xsmr(:) - real(r8), pointer :: m_deadcrootc_storage_to_fire(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_fire(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_to_fire(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter_fire(:) - real(r8), pointer :: m_deadstemc_xfer_to_fire(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_fire(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_frootc_to_fire(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_fire(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_fire(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_fire(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_fire(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_leafc_to_fire(:) - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_fire(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_fire(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_to_fire(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_fire(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_fire(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_to_fire(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_fire(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) - real(r8), pointer :: hrv_xsmrpool_to_atm(:) - real(r8), pointer :: mr(:) ! (gC/m2/s) maintenance respiration - real(r8), pointer :: npp(:) ! (gC/m2/s) net primary production - real(r8), pointer :: pft_fire_closs(:) ! (gC/m2/s) total pft-level fire C loss - real(r8), pointer :: psnshade_to_cpool(:) - real(r8), pointer :: psnsun_to_cpool(:) - real(r8), pointer :: rr(:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: storage_gr(:) ! (gC/m2/s) growth resp for growth sent to storage for later display - real(r8), pointer :: transfer_deadcroot_gr(:) - real(r8), pointer :: transfer_deadstem_gr(:) - real(r8), pointer :: transfer_froot_gr(:) - real(r8), pointer :: transfer_gr(:) ! (gC/m2/s) growth resp for transfer growth displayed in this timestep - real(r8), pointer :: transfer_leaf_gr(:) - real(r8), pointer :: transfer_livecroot_gr(:) - real(r8), pointer :: transfer_livestem_gr(:) - real(r8), pointer :: wood_harvestc(:) ! (gC/m2/s) pft-level wood harvest (to product pools) - real(r8), pointer :: vegfire(:) ! (gC/m2/s) pft-level fire loss (obsolete, mark for removal) - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) !(gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: dispvegc(:) ! (gC/m2) displayed veg carbon, excluding storage and cpool - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) !(gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: storvegc(:) ! (gC/m2) stored vegetation carbon, excluding cpool - real(r8), pointer :: totpftc(:) ! (gC/m2) total pft-level carbon, including cpool - real(r8), pointer :: totvegc(:) ! (gC/m2) total vegetation carbon, excluding cpool - ! for landcover change - real(r8), pointer :: dwt_closs(:) ! (gC/m2/s) total carbon loss from product pools and conversion - real(r8), pointer :: dwt_conv_cflux(:) ! (gC/m2/s) conversion C flux (immediate loss to atm) - real(r8), pointer :: prod10c_loss(:) ! (gC/m2/s) loss from 10-yr wood product pool - real(r8), pointer :: prod100c_loss(:) ! (gC/m2/s) loss from 100-yr wood product pool - real(r8), pointer :: product_closs(:) ! (gC/m2/s) total wood product carbon loss - real(r8), pointer :: prod10c(:) ! (gC/m2) wood product C pool, 10-year lifespan - real(r8), pointer :: prod100c(:) ! (gC/m2) wood product C pool, 100-year lifespan - real(r8), pointer :: totprodc(:) ! (gC/m2) total wood product C -! -! -! local pointers to implicit in/out scalars -! -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - -!EOP -!----------------------------------------------------------------------- - - if (.not. use_c13) then - RETURN - end if - - ! assign local pointers - col_fire_closs => cc13f%col_fire_closs - er => cc13f%er - hr => cc13f%hr - litfire => cc13f%litfire - lithr => cc13f%lithr - litr1_hr => cc13f%litr1_hr - litr2_hr => cc13f%litr2_hr - litr3_hr => cc13f%litr3_hr - m_cwdc_to_fire => cc13f%m_cwdc_to_fire - m_litr1c_to_fire => cc13f%m_litr1c_to_fire - m_litr2c_to_fire => cc13f%m_litr2c_to_fire - m_litr3c_to_fire => cc13f%m_litr3c_to_fire - nee => cc13f%nee - nep => cc13f%nep - nbp => cc13f%nbp - col_ar => pc13f_a%ar - col_gpp => pc13f_a%gpp - col_npp => pc13f_a%npp - col_pft_fire_closs => pc13f_a%pft_fire_closs - col_rr => pc13f_a%rr - col_vegfire => pc13f_a%vegfire - col_wood_harvestc => pc13f_a%wood_harvestc - soil1_hr => cc13f%soil1_hr - soil2_hr => cc13f%soil2_hr - soil3_hr => cc13f%soil3_hr - soil4_hr => cc13f%soil4_hr - somfire => cc13f%somfire - somhr => cc13f%somhr - sr => cc13f%sr - totfire => cc13f%totfire - - ! dynamic landcover pointers - dwt_closs => cc13f%dwt_closs - dwt_conv_cflux => cc13f%dwt_conv_cflux - - ! wood product pointers - prod10c_loss => cc13f%prod10c_loss - prod100c_loss => cc13f%prod100c_loss - product_closs => cc13f%product_closs - prod10c => cc13s%prod10c - prod100c => cc13s%prod100c - totprodc => cc13s%totprodc - - cwdc => cc13s%cwdc - litr1c => cc13s%litr1c - litr2c => cc13s%litr2c - litr3c => cc13s%litr3c - col_totpftc => pc13s_a%totpftc - col_totvegc => pc13s_a%totvegc - soil1c => cc13s%soil1c - soil2c => cc13s%soil2c - soil3c => cc13s%soil3c - soil4c => cc13s%soil4c - totcolc => cc13s%totcolc - totecosysc => cc13s%totecosysc - totlitc => cc13s%totlitc - totsomc => cc13s%totsomc - agnpp => pc13f%agnpp - ar => pc13f%ar - bgnpp => pc13f%bgnpp - cpool_deadcroot_gr => pc13f%cpool_deadcroot_gr - cpool_deadcroot_storage_gr => pc13f%cpool_deadcroot_storage_gr - cpool_deadstem_gr => pc13f%cpool_deadstem_gr - cpool_deadstem_storage_gr => pc13f%cpool_deadstem_storage_gr - cpool_froot_gr => pc13f%cpool_froot_gr - cpool_froot_storage_gr => pc13f%cpool_froot_storage_gr - cpool_leaf_gr => pc13f%cpool_leaf_gr - cpool_leaf_storage_gr => pc13f%cpool_leaf_storage_gr - cpool_livecroot_gr => pc13f%cpool_livecroot_gr - cpool_livecroot_storage_gr => pc13f%cpool_livecroot_storage_gr - cpool_livestem_gr => pc13f%cpool_livestem_gr - cpool_livestem_storage_gr => pc13f%cpool_livestem_storage_gr - cpool_to_deadcrootc => pc13f%cpool_to_deadcrootc - cpool_to_deadstemc => pc13f%cpool_to_deadstemc - cpool_to_frootc => pc13f%cpool_to_frootc - cpool_to_leafc => pc13f%cpool_to_leafc - cpool_to_livecrootc => pc13f%cpool_to_livecrootc - cpool_to_livestemc => pc13f%cpool_to_livestemc - current_gr => pc13f%current_gr - deadcrootc_xfer_to_deadcrootc => pc13f%deadcrootc_xfer_to_deadcrootc - deadstemc_xfer_to_deadstemc => pc13f%deadstemc_xfer_to_deadstemc - frootc_to_litter => pc13f%frootc_to_litter - frootc_xfer_to_frootc => pc13f%frootc_xfer_to_frootc - froot_mr => pc13f%froot_mr - froot_curmr => pc13f%froot_curmr - froot_xsmr => pc13f%froot_xsmr - gpp => pc13f%gpp - gr => pc13f%gr - leafc_to_litter => pc13f%leafc_to_litter - leafc_xfer_to_leafc => pc13f%leafc_xfer_to_leafc - leaf_mr => pc13f%leaf_mr - leaf_curmr => pc13f%leaf_curmr - leaf_xsmr => pc13f%leaf_xsmr - litfall => pc13f%litfall - livecrootc_xfer_to_livecrootc => pc13f%livecrootc_xfer_to_livecrootc - livecroot_mr => pc13f%livecroot_mr - livecroot_curmr => pc13f%livecroot_curmr - livecroot_xsmr => pc13f%livecroot_xsmr - livestemc_xfer_to_livestemc => pc13f%livestemc_xfer_to_livestemc - livestem_mr => pc13f%livestem_mr - livestem_curmr => pc13f%livestem_curmr - livestem_xsmr => pc13f%livestem_xsmr - m_deadcrootc_storage_to_fire => pc13f%m_deadcrootc_storage_to_fire - m_deadcrootc_storage_to_litter => pc13f%m_deadcrootc_storage_to_litter - m_deadcrootc_to_fire => pc13f%m_deadcrootc_to_fire - m_deadcrootc_to_litter => pc13f%m_deadcrootc_to_litter - m_deadcrootc_to_litter_fire => pc13f%m_deadcrootc_to_litter_fire - m_deadcrootc_xfer_to_fire => pc13f%m_deadcrootc_xfer_to_fire - m_deadcrootc_xfer_to_litter => pc13f%m_deadcrootc_xfer_to_litter - m_deadstemc_storage_to_fire => pc13f%m_deadstemc_storage_to_fire - m_deadstemc_storage_to_litter => pc13f%m_deadstemc_storage_to_litter - m_deadstemc_to_fire => pc13f%m_deadstemc_to_fire - m_deadstemc_to_litter => pc13f%m_deadstemc_to_litter - m_deadstemc_to_litter_fire => pc13f%m_deadstemc_to_litter_fire - m_deadstemc_xfer_to_fire => pc13f%m_deadstemc_xfer_to_fire - m_deadstemc_xfer_to_litter => pc13f%m_deadstemc_xfer_to_litter - m_frootc_storage_to_fire => pc13f%m_frootc_storage_to_fire - m_frootc_storage_to_litter => pc13f%m_frootc_storage_to_litter - m_frootc_to_fire => pc13f%m_frootc_to_fire - m_frootc_to_litter => pc13f%m_frootc_to_litter - m_frootc_xfer_to_fire => pc13f%m_frootc_xfer_to_fire - m_frootc_xfer_to_litter => pc13f%m_frootc_xfer_to_litter - m_gresp_storage_to_fire => pc13f%m_gresp_storage_to_fire - m_gresp_storage_to_litter => pc13f%m_gresp_storage_to_litter - m_gresp_xfer_to_fire => pc13f%m_gresp_xfer_to_fire - m_gresp_xfer_to_litter => pc13f%m_gresp_xfer_to_litter - m_leafc_storage_to_fire => pc13f%m_leafc_storage_to_fire - m_leafc_storage_to_litter => pc13f%m_leafc_storage_to_litter - m_leafc_to_fire => pc13f%m_leafc_to_fire - m_leafc_to_litter => pc13f%m_leafc_to_litter - m_leafc_xfer_to_fire => pc13f%m_leafc_xfer_to_fire - m_leafc_xfer_to_litter => pc13f%m_leafc_xfer_to_litter - m_livecrootc_storage_to_fire => pc13f%m_livecrootc_storage_to_fire - m_livecrootc_storage_to_litter => pc13f%m_livecrootc_storage_to_litter - m_livecrootc_to_fire => pc13f%m_livecrootc_to_fire - m_livecrootc_to_litter => pc13f%m_livecrootc_to_litter - m_livecrootc_xfer_to_fire => pc13f%m_livecrootc_xfer_to_fire - m_livecrootc_xfer_to_litter => pc13f%m_livecrootc_xfer_to_litter - m_livestemc_storage_to_fire => pc13f%m_livestemc_storage_to_fire - m_livestemc_storage_to_litter => pc13f%m_livestemc_storage_to_litter - m_livestemc_to_fire => pc13f%m_livestemc_to_fire - m_livestemc_to_litter => pc13f%m_livestemc_to_litter - m_livestemc_xfer_to_fire => pc13f%m_livestemc_xfer_to_fire - m_livestemc_xfer_to_litter => pc13f%m_livestemc_xfer_to_litter - hrv_leafc_to_litter => pc13f%hrv_leafc_to_litter - hrv_leafc_storage_to_litter => pc13f%hrv_leafc_storage_to_litter - hrv_leafc_xfer_to_litter => pc13f%hrv_leafc_xfer_to_litter - hrv_frootc_to_litter => pc13f%hrv_frootc_to_litter - hrv_frootc_storage_to_litter => pc13f%hrv_frootc_storage_to_litter - hrv_frootc_xfer_to_litter => pc13f%hrv_frootc_xfer_to_litter - hrv_livestemc_to_litter => pc13f%hrv_livestemc_to_litter - hrv_livestemc_storage_to_litter => pc13f%hrv_livestemc_storage_to_litter - hrv_livestemc_xfer_to_litter => pc13f%hrv_livestemc_xfer_to_litter - hrv_deadstemc_to_prod10c => pc13f%hrv_deadstemc_to_prod10c - hrv_deadstemc_to_prod100c => pc13f%hrv_deadstemc_to_prod100c - hrv_deadstemc_storage_to_litter => pc13f%hrv_deadstemc_storage_to_litter - hrv_deadstemc_xfer_to_litter => pc13f%hrv_deadstemc_xfer_to_litter - hrv_livecrootc_to_litter => pc13f%hrv_livecrootc_to_litter - hrv_livecrootc_storage_to_litter => pc13f%hrv_livecrootc_storage_to_litter - hrv_livecrootc_xfer_to_litter => pc13f%hrv_livecrootc_xfer_to_litter - hrv_deadcrootc_to_litter => pc13f%hrv_deadcrootc_to_litter - hrv_deadcrootc_storage_to_litter => pc13f%hrv_deadcrootc_storage_to_litter - hrv_deadcrootc_xfer_to_litter => pc13f%hrv_deadcrootc_xfer_to_litter - hrv_gresp_storage_to_litter => pc13f%hrv_gresp_storage_to_litter - hrv_gresp_xfer_to_litter => pc13f%hrv_gresp_xfer_to_litter - hrv_xsmrpool_to_atm => pc13f%hrv_xsmrpool_to_atm - mr => pc13f%mr - npp => pc13f%npp - pft_fire_closs => pc13f%pft_fire_closs - psnshade_to_cpool => pc13f%psnshade_to_cpool - psnsun_to_cpool => pc13f%psnsun_to_cpool - rr => pc13f%rr - storage_gr => pc13f%storage_gr - transfer_deadcroot_gr => pc13f%transfer_deadcroot_gr - transfer_deadstem_gr => pc13f%transfer_deadstem_gr - transfer_froot_gr => pc13f%transfer_froot_gr - transfer_gr => pc13f%transfer_gr - transfer_leaf_gr => pc13f%transfer_leaf_gr - transfer_livecroot_gr => pc13f%transfer_livecroot_gr - transfer_livestem_gr => pc13f%transfer_livestem_gr - vegfire => pc13f%vegfire - wood_harvestc => pc13f%wood_harvestc - cpool => pc13s%cpool - xsmrpool => pc13s%xsmrpool - deadcrootc => pc13s%deadcrootc - deadcrootc_storage => pc13s%deadcrootc_storage - deadcrootc_xfer => pc13s%deadcrootc_xfer - deadstemc => pc13s%deadstemc - deadstemc_storage => pc13s%deadstemc_storage - deadstemc_xfer => pc13s%deadstemc_xfer - dispvegc => pc13s%dispvegc - frootc => pc13s%frootc - frootc_storage => pc13s%frootc_storage - frootc_xfer => pc13s%frootc_xfer - gresp_storage => pc13s%gresp_storage - gresp_xfer => pc13s%gresp_xfer - leafc => pc13s%leafc - leafc_storage => pc13s%leafc_storage - leafc_xfer => pc13s%leafc_xfer - livecrootc => pc13s%livecrootc - livecrootc_storage => pc13s%livecrootc_storage - livecrootc_xfer => pc13s%livecrootc_xfer - livestemc => pc13s%livestemc - livestemc_storage => pc13s%livestemc_storage - livestemc_xfer => pc13s%livestemc_xfer - storvegc => pc13s%storvegc - totpftc => pc13s%totpftc - totvegc => pc13s%totvegc - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! calculate pft-level summary carbon fluxes and states - - ! gross primary production (GPP) - gpp(p) = & - psnsun_to_cpool(p) + & - psnshade_to_cpool(p) - - ! maintenance respiration (MR) - - leaf_mr(p) = leaf_curmr(p) + leaf_xsmr(p) - froot_mr(p) = froot_curmr(p) + froot_xsmr(p) - livestem_mr(p) = livestem_curmr(p) + livestem_xsmr(p) - livecroot_mr(p) = livecroot_curmr(p) + livecroot_xsmr(p) - - mr(p) = & - leaf_mr(p) + & - froot_mr(p) + & - livestem_mr(p) + & - livecroot_mr(p) - ! growth respiration (GR) - ! current GR is respired this time step for new growth displayed in this timestep - current_gr(p) = & - cpool_leaf_gr(p) + & - cpool_froot_gr(p) + & - cpool_livestem_gr(p) + & - cpool_deadstem_gr(p) + & - cpool_livecroot_gr(p) + & - cpool_deadcroot_gr(p) - - ! transfer GR is respired this time step for transfer growth displayed in this timestep - transfer_gr(p) = & - transfer_leaf_gr(p) + & - transfer_froot_gr(p) + & - transfer_livestem_gr(p) + & - transfer_deadstem_gr(p) + & - transfer_livecroot_gr(p) + & - transfer_deadcroot_gr(p) - - ! storage GR is respired this time step for growth sent to storage for later display - storage_gr(p) = & - cpool_leaf_storage_gr(p) + & - cpool_froot_storage_gr(p) + & - cpool_livestem_storage_gr(p) + & - cpool_deadstem_storage_gr(p) + & - cpool_livecroot_storage_gr(p) + & - cpool_deadcroot_storage_gr(p) - - ! GR is the sum of current + transfer + storage GR - gr(p) = & - current_gr(p) + & - transfer_gr(p) + & - storage_gr(p) - - ! autotrophic respiration (AR) - ar(p) = mr(p) + gr(p) - - ! root respiration (RR) - rr(p) = & - froot_mr(p) + & - cpool_froot_gr(p) + & - cpool_livecroot_gr(p) + & - cpool_deadcroot_gr(p) + & - transfer_froot_gr(p) + & - transfer_livecroot_gr(p) + & - transfer_deadcroot_gr(p) + & - cpool_froot_storage_gr(p) + & - cpool_livecroot_storage_gr(p) + & - cpool_deadcroot_storage_gr(p) - - ! net primary production (NPP) - npp(p) = gpp(p) - ar(p) - - ! aboveground NPP: leaf, live stem, dead stem (AGNPP) - ! This is supposed to correspond as closely as possible to - ! field measurements of AGNPP, so it ignores the storage pools - ! and only treats the fluxes into displayed pools. - agnpp(p) = & - cpool_to_leafc(p) + & - leafc_xfer_to_leafc(p) + & - cpool_to_livestemc(p) + & - livestemc_xfer_to_livestemc(p) + & - cpool_to_deadstemc(p) + & - deadstemc_xfer_to_deadstemc(p) - - ! belowground NPP: fine root, live coarse root, dead coarse root (BGNPP) - ! This is supposed to correspond as closely as possible to - ! field measurements of BGNPP, so it ignores the storage pools - ! and only treats the fluxes into displayed pools. - bgnpp(p) = & - cpool_to_frootc(p) + & - frootc_xfer_to_frootc(p) + & - cpool_to_livecrootc(p) + & - livecrootc_xfer_to_livecrootc(p) + & - cpool_to_deadcrootc(p) + & - deadcrootc_xfer_to_deadcrootc(p) - - ! litterfall (LITFALL) - litfall(p) = & - leafc_to_litter(p) + & - frootc_to_litter(p) + & - m_leafc_to_litter(p) + & - m_leafc_storage_to_litter(p) + & - m_leafc_xfer_to_litter(p) + & - m_frootc_to_litter(p) + & - m_frootc_storage_to_litter(p) + & - m_frootc_xfer_to_litter(p) + & - m_livestemc_to_litter(p) + & - m_livestemc_storage_to_litter(p) + & - m_livestemc_xfer_to_litter(p) + & - m_deadstemc_to_litter(p) + & - m_deadstemc_storage_to_litter(p) + & - m_deadstemc_xfer_to_litter(p) + & - m_livecrootc_to_litter(p) + & - m_livecrootc_storage_to_litter(p) + & - m_livecrootc_xfer_to_litter(p) + & - m_deadcrootc_to_litter(p) + & - m_deadcrootc_storage_to_litter(p) + & - m_deadcrootc_xfer_to_litter(p) + & - m_gresp_storage_to_litter(p) + & - m_gresp_xfer_to_litter(p) + & - m_deadstemc_to_litter_fire(p) + & - m_deadcrootc_to_litter_fire(p) + & - hrv_leafc_to_litter(p) + & - hrv_leafc_storage_to_litter(p) + & - hrv_leafc_xfer_to_litter(p) + & - hrv_frootc_to_litter(p) + & - hrv_frootc_storage_to_litter(p) + & - hrv_frootc_xfer_to_litter(p) + & - hrv_livestemc_to_litter(p) + & - hrv_livestemc_storage_to_litter(p) + & - hrv_livestemc_xfer_to_litter(p) + & - hrv_deadstemc_storage_to_litter(p) + & - hrv_deadstemc_xfer_to_litter(p) + & - hrv_livecrootc_to_litter(p) + & - hrv_livecrootc_storage_to_litter(p)+ & - hrv_livecrootc_xfer_to_litter(p) + & - hrv_deadcrootc_to_litter(p) + & - hrv_deadcrootc_storage_to_litter(p)+ & - hrv_deadcrootc_xfer_to_litter(p) + & - hrv_gresp_storage_to_litter(p) + & - hrv_gresp_xfer_to_litter(p) - - ! pft-level fire losses (VEGFIRE) - vegfire(p) = 0._r8 - - ! pft-level wood harvest - wood_harvestc(p) = & - hrv_deadstemc_to_prod10c(p) + & - hrv_deadstemc_to_prod100c(p) - - ! pft-level carbon losses to fire - pft_fire_closs(p) = & - m_leafc_to_fire(p) + & - m_leafc_storage_to_fire(p) + & - m_leafc_xfer_to_fire(p) + & - m_frootc_to_fire(p) + & - m_frootc_storage_to_fire(p) + & - m_frootc_xfer_to_fire(p) + & - m_livestemc_to_fire(p) + & - m_livestemc_storage_to_fire(p) + & - m_livestemc_xfer_to_fire(p) + & - m_deadstemc_to_fire(p) + & - m_deadstemc_storage_to_fire(p) + & - m_deadstemc_xfer_to_fire(p) + & - m_livecrootc_to_fire(p) + & - m_livecrootc_storage_to_fire(p) + & - m_livecrootc_xfer_to_fire(p) + & - m_deadcrootc_to_fire(p) + & - m_deadcrootc_storage_to_fire(p) + & - m_deadcrootc_xfer_to_fire(p) + & - m_gresp_storage_to_fire(p) + & - m_gresp_xfer_to_fire(p) - - ! displayed vegetation carbon, excluding storage and cpool (DISPVEGC) - dispvegc(p) = & - leafc(p) + & - frootc(p) + & - livestemc(p) + & - deadstemc(p) + & - livecrootc(p) + & - deadcrootc(p) - - ! stored vegetation carbon, excluding cpool (STORVEGC) - storvegc(p) = & - cpool(p) + & - leafc_storage(p) + & - frootc_storage(p) + & - livestemc_storage(p) + & - deadstemc_storage(p) + & - livecrootc_storage(p) + & - deadcrootc_storage(p) + & - leafc_xfer(p) + & - frootc_xfer(p) + & - livestemc_xfer(p) + & - deadstemc_xfer(p) + & - livecrootc_xfer(p) + & - deadcrootc_xfer(p) + & - gresp_storage(p) + & - gresp_xfer(p) - - ! total vegetation carbon, excluding cpool (TOTVEGC) - totvegc(p) = dispvegc(p) + storvegc(p) - - ! total pft-level carbon, including cpool (TOTPFTC) - totpftc(p) = totvegc(p) + xsmrpool(p) - - end do ! end of pfts loop - - ! use p2c routine to get selected column-average pft-level fluxes and states - call p2c(num_soilc, filter_soilc, gpp, col_gpp) - call p2c(num_soilc, filter_soilc, ar, col_ar) - call p2c(num_soilc, filter_soilc, rr, col_rr) - call p2c(num_soilc, filter_soilc, npp, col_npp) - call p2c(num_soilc, filter_soilc, vegfire, col_vegfire) - call p2c(num_soilc, filter_soilc, wood_harvestc, col_wood_harvestc) - call p2c(num_soilc, filter_soilc, totvegc, col_totvegc) - call p2c(num_soilc, filter_soilc, totpftc, col_totpftc) - call p2c(num_soilc, filter_soilc, pft_fire_closs, col_pft_fire_closs) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! litter heterotrophic respiration (LITHR) - lithr(c) = & - litr1_hr(c) + & - litr2_hr(c) + & - litr3_hr(c) - - ! soil organic matter heterotrophic respiration (SOMHR) - somhr(c) = & - soil1_hr(c) + & - soil2_hr(c) + & - soil3_hr(c) + & - soil4_hr(c) - - ! total heterotrophic respiration (HR) - hr(c) = lithr(c) + somhr(c) - - ! total soil respiration, heterotrophic + root respiration (SR) - sr(c) = col_rr(c) + hr(c) - - ! total ecosystem respiration, autotrophic + heterotrophic (ER) - er(c) = col_ar(c) + hr(c) - - ! litter fire losses (LITFIRE) - litfire(c) = 0._r8 - - ! total wood product loss - product_closs(c) = & - prod10c_loss(c) + & - prod100c_loss(c) - - ! soil organic matter fire losses (SOMFIRE) - somfire(c) = 0._r8 - - ! total ecosystem fire losses (TOTFIRE) - totfire(c) = & - litfire(c) + & - somfire(c) + & - col_vegfire(c) - - ! column-level carbon losses to fire, including pft losses - col_fire_closs(c) = & - m_litr1c_to_fire(c) + & - m_litr2c_to_fire(c) + & - m_litr3c_to_fire(c) + & - m_cwdc_to_fire(c) + & - col_pft_fire_closs(c) - - ! column-level carbon losses due to landcover change - dwt_closs(c) = & - dwt_conv_cflux(c) - - ! net ecosystem production, excludes fire flux, positive for sink (NEP) - nep(c) = col_gpp(c) - er(c) - - ! net ecosystem exchange of carbon, includes fire flux, positive for source (NBP) - nbp(c) = nep(c) - col_fire_closs(c) - dwt_closs(c) - product_closs(c) - - ! net ecosystem exchange of carbon, includes fire flux, positive for source (NEE) - nee(c) = -nep(c) + col_fire_closs(c) + dwt_closs(c) + product_closs(c) - - ! total litter carbon (TOTLITC) - totlitc(c) = & - litr1c(c) + & - litr2c(c) + & - litr3c(c) - - ! total soil organic matter carbon (TOTSOMC) - totsomc(c) = & - soil1c(c) + & - soil2c(c) + & - soil3c(c) + & - soil4c(c) - - ! total wood product carbon - totprodc(c) = & - prod10c(c) + & - prod100c(c) - - ! total ecosystem carbon, including veg but excluding cpool (TOTECOSYSC) - totecosysc(c) = & - cwdc(c) + & - totlitc(c) + & - totsomc(c) + & - totprodc(c) + & - col_totvegc(c) - - ! total column carbon, including veg and cpool (TOTCOLC) - totcolc(c) = & - cwdc(c) + & - totlitc(c) + & - totsomc(c) + & - totprodc(c) + & - col_totpftc(c) - - end do ! end of columns loop - - -end subroutine C13Summary -!----------------------------------------------------------------------- - -end module C13SummaryMod diff --git a/src_clm40/biogeochem/CNAllocationMod.F90 b/src_clm40/biogeochem/CNAllocationMod.F90 deleted file mode 100644 index 5a760a0bc7..0000000000 --- a/src_clm40/biogeochem/CNAllocationMod.F90 +++ /dev/null @@ -1,902 +0,0 @@ -module CNAllocationMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNAllocationMod -! -! !DESCRIPTION: -! Module holding routines used in allocation model for coupled carbon -! nitrogen code. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils , only: endrun - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNAllocationInit ! Initialization - public :: CNAllocation ! run method - -! !PUBLIC DATA MEMBERS: - character(len=*), parameter, public :: suplnAll=& ! Supplemental Nitrogen for all PFT's - 'ALL' - character(len=*), parameter, public :: suplnCrp=& ! Supplemental Nitrogen for prognostic Crop - 'PROG_CROP_ONLY' - character(len=*), parameter, public :: suplnNon=& ! No supplemental Nitrogen - 'NONE' - character(len=15), public :: suplnitro = suplnNon ! Supplemental Nitrogen mode -! !PRIVATE DATA MEMBERS: - real(r8):: dt !decomp timestep (seconds) - real(r8):: bdnr !bulk denitrification rate (1/s) - real(r8):: dayscrecover !number of days to recover negative cpool - real(r8), pointer :: arepr(:) !reproduction allocation coefficient - real(r8), pointer :: aroot(:) !root allocation coefficient - real(r8), pointer:: col_plant_ndemand(:) !column-level plant N demand - logical :: Carbon_only = .false. ! Carbon only mode - ! (Nitrogen is prescribed NOT prognostic) - logical :: crop_supln = .false. ! Prognostic crop receives supplemental Nitrogen -! -! !REVISION HISTORY: -! 8/5/03: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNAllocationInit -! -! !INTERFACE: -subroutine CNAllocationInit ( lbc, ubc, lbp, ubp ) -! -! !DESCRIPTION: -! -! !USES: - use clm_varcon , only: secspday - use clm_time_manager, only: get_step_size - use surfrdMod , only: crop_prog - use clm_varctl , only: iulog, use_c13 - use shr_infnan_mod , only: nan => shr_infnan_nan, assignment(=) -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 4/6/11: Created by Erik Kluzek -! -! !LOCAL VARIABLES: - character(len=32) :: subname = 'CNAllocationInit' -!EOP -!----------------------------------------------------------------------- - if ( crop_prog )then - allocate(arepr(lbp:ubp)) - allocate(aroot(lbp:ubp)) - arepr(:) = nan - aroot(:) = nan - end if - allocate(col_plant_ndemand(lbc:ubc)) - col_plant_ndemand(:) = nan - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! set some space-and-time constant parameters - bdnr = 0.5_r8 * (dt/secspday) - dayscrecover = 30.0_r8 - - ! Change namelist settings into private logical variables - select case(suplnitro) - case(suplnNon) - Carbon_only = .false. - crop_supln = .false. - case(suplnCrp) - Carbon_only = .false. - crop_supln = .true. - if ( .not. crop_prog )then - call endrun( trim(subname)//'ERROR: '//trim(suplnCrp)// & - ' can NOT be on when crop is NOT' ) - end if - case(suplnAll) - Carbon_only = .true. - crop_supln = .false. - case default - write(iulog,*) 'Supplemental Nitrogen flag (suplnitro) can only be: ', & - suplnNon, ",", suplnCrp, ', or ', suplnAll - call endrun( trim(subname)//'ERROR: supplemental Nitrogen flag is not correct' ) - end select - -end subroutine CNAllocationInit - -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNAllocation -! -! !INTERFACE: -subroutine CNAllocation (lbp, ubp, lbc, ubc, & - num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_pcropp ) -! -! !DESCRIPTION: -! -! !USES: - use clmtype - use clm_varctl, only: iulog, use_c13 - use shr_sys_mod, only: shr_sys_flush - use pft2colMod, only: p2c - use pftvarcon , only: npcropmin, declfact, bfact, aleaff, arootf, astemf, & - arooti, fleafi, allconsl, allconss, grperc, grpnow - use clm_varcon, only: secspday, istsoil, istcrop - use clm_varpar, only: max_pft_per_col -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: lbc, ubc ! column-index 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts - integer, intent(in) :: num_pcropp ! number of pfts in prognostic crop filter -! -! !CALLED FROM: -! subroutine CNdecompAlloc in module CNdecompMod.F90 -! -! !REVISION HISTORY: -! 8/5/03: Created by Peter Thornton -! 10/23/03, Peter Thornton: migrated to vector data structures -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays -! - ! pft level - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pfti(:) ! initial pft index in landunit - real(r8), pointer :: lgsf(:) ! long growing season factor [0-1] - real(r8), pointer :: xsmrpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: psnsun(:) ! sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: psnsha(:) ! shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - - real(r8), pointer :: c13_psnsun(:) ! C13 sunlit leaf-level photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: c13_psnsha(:) ! C13 shaded leaf-level photosynthesis (umol CO2 /m**2/ s) - - real(r8), pointer :: laisun(:) ! sunlit projected leaf area index - real(r8), pointer :: laisha(:) ! shaded projected leaf area index - real(r8), pointer :: leaf_mr(:) - real(r8), pointer :: froot_mr(:) - real(r8), pointer :: livestem_mr(:) - real(r8), pointer :: livecroot_mr(:) - real(r8), pointer :: leaf_curmr(:) - real(r8), pointer :: froot_curmr(:) - real(r8), pointer :: livestem_curmr(:) - real(r8), pointer :: livecroot_curmr(:) - real(r8), pointer :: leaf_xsmr(:) - real(r8), pointer :: froot_xsmr(:) - real(r8), pointer :: livestem_xsmr(:) - real(r8), pointer :: livecroot_xsmr(:) - ! column level - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N - ! ecophysiological constants - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: froot_leaf(:) ! allocation parameter: new fine root C per new leaf C (gC/gC) - real(r8), pointer :: croot_stem(:) ! allocation parameter: new coarse root C per new stem C (gC/gC) - real(r8), pointer :: stem_leaf(:) ! allocation parameter: new stem c per new leaf C (gC/gC) - real(r8), pointer :: flivewd(:) ! allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - real(r8), pointer :: leafcn(:) ! leaf C:N (gC/gN) - real(r8), pointer :: frootcn(:) ! fine root C:N (gC/gN) - real(r8), pointer :: livewdcn(:) ! live wood (phloem and ray parenchyma) C:N (gC/gN) - real(r8), pointer :: deadwdcn(:) ! dead wood (xylem and heartwood) C:N (gC/gN) - real(r8), pointer :: fcur2(:) ! allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - integer, pointer :: plandunit(:) ! index into landunit level quantities - integer, pointer :: clandunit(:) ! index into landunit level quantities - integer , pointer :: itypelun(:) ! landunit type - logical , pointer :: croplive(:) ! flag, true if planted, not harvested - integer , pointer :: peaklai(:) ! 1: max allowed lai; 0: not at max - real(r8), pointer :: gddmaturity(:)! gdd needed to harvest - real(r8), pointer :: huileaf(:) ! heat unit index needed from planting to leaf emergence - real(r8), pointer :: huigrain(:) ! same to reach vegetative maturity - real(r8), pointer :: hui(:) ! =gdd since planting (gddplant) - real(r8), pointer :: leafout(:) ! =gdd from top soil layer temperature - real(r8), pointer :: aleafi(:) ! saved allocation coefficient from phase 2 - real(r8), pointer :: astemi(:) ! saved allocation coefficient from phase 2 - real(r8), pointer :: aleaf(:) ! leaf allocation coefficient - real(r8), pointer :: astem(:) ! stem allocation coefficient - real(r8), pointer :: graincn(:) ! grain C:N (gC/gN) -! -! local pointers to implicit in/out arrays -! - ! pft level - real(r8), pointer :: gpp(:) ! GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: availc(:) ! C flux available for allocation (gC/m2/s) - real(r8), pointer :: xsmrpool_recover(:) ! C flux assigned to recovery of negative cpool (gC/m2/s) - real(r8), pointer :: c_allometry(:) ! C allocation index (DIM) - real(r8), pointer :: n_allometry(:) ! N allocation index (DIM) - real(r8), pointer :: plant_ndemand(:) ! N flux required to support initial GPP (gN/m2/s) - real(r8), pointer :: tempsum_potential_gpp(:) ! temporary annual sum of potential GPP - real(r8), pointer :: tempmax_retransn(:) ! temporary annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: annsum_potential_gpp(:) ! annual sum of potential GPP - real(r8), pointer :: avail_retransn(:) ! N flux available from retranslocation pool (gN/m2/s) - real(r8), pointer :: annmax_retransn(:) ! annual max of retranslocated N pool - real(r8), pointer :: plant_nalloc(:) ! total allocated N flux (gN/m2/s) - real(r8), pointer :: plant_calloc(:) ! total allocated C flux (gC/m2/s) - real(r8), pointer :: excess_cflux(:) ! C flux not allocated due to downregulation (gC/m2/s) - real(r8), pointer :: downreg(:) ! fractional reduction in GPP due to N limitation (DIM) - real(r8), pointer :: annsum_npp(:) ! annual sum of NPP, for wood allocation - real(r8), pointer :: cpool_to_xsmrpool(:) - real(r8), pointer :: psnsun_to_cpool(:) - real(r8), pointer :: psnshade_to_cpool(:) - - real(r8), pointer :: c13_psnsun_to_cpool(:) - real(r8), pointer :: c13_psnshade_to_cpool(:) - - real(r8), pointer :: cpool_to_leafc(:) - real(r8), pointer :: cpool_to_leafc_storage(:) - real(r8), pointer :: cpool_to_frootc(:) - real(r8), pointer :: cpool_to_frootc_storage(:) - real(r8), pointer :: cpool_to_livestemc(:) - real(r8), pointer :: cpool_to_livestemc_storage(:) - real(r8), pointer :: cpool_to_deadstemc(:) - real(r8), pointer :: cpool_to_deadstemc_storage(:) - real(r8), pointer :: cpool_to_livecrootc(:) - real(r8), pointer :: cpool_to_livecrootc_storage(:) - real(r8), pointer :: cpool_to_deadcrootc(:) - real(r8), pointer :: cpool_to_deadcrootc_storage(:) - real(r8), pointer :: cpool_to_gresp_storage(:) ! allocation to growth respiration storage (gC/m2/s) - real(r8), pointer :: retransn_to_npool(:) ! deployment of retranslocated N (gN/m2/s) - real(r8), pointer :: sminn_to_npool(:) ! deployment of soil mineral N uptake (gN/m2/s) - real(r8), pointer :: cpool_to_grainc(:) ! allocation to grain C (gC/m2/s) - real(r8), pointer :: cpool_to_grainc_storage(:) ! allocation to grain C storage (gC/m2/s) - real(r8), pointer :: npool_to_grainn(:) ! allocation to grain N (gN/m2/s) - real(r8), pointer :: npool_to_grainn_storage(:) ! allocation to grain N storage (gN/m2/s) - real(r8), pointer :: npool_to_leafn(:) ! allocation to leaf N (gN/m2/s) - real(r8), pointer :: npool_to_leafn_storage(:) ! allocation to leaf N storage (gN/m2/s) - real(r8), pointer :: npool_to_frootn(:) ! allocation to fine root N (gN/m2/s) - real(r8), pointer :: npool_to_frootn_storage(:) ! allocation to fine root N storage (gN/m2/s) - real(r8), pointer :: npool_to_livestemn(:) - real(r8), pointer :: npool_to_livestemn_storage(:) - real(r8), pointer :: npool_to_deadstemn(:) - real(r8), pointer :: npool_to_deadstemn_storage(:) - real(r8), pointer :: npool_to_livecrootn(:) - real(r8), pointer :: npool_to_livecrootn_storage(:) - real(r8), pointer :: npool_to_deadcrootn(:) - real(r8), pointer :: npool_to_deadcrootn_storage(:) - ! column level - real(r8), pointer :: fpi(:) ! fraction of potential immobilization (no units) - real(r8), pointer :: fpg(:) ! fraction of potential gpp (no units) - real(r8), pointer :: potential_immob(:) - real(r8), pointer :: actual_immob(:) - real(r8), pointer :: sminn_to_plant(:) - real(r8), pointer :: sminn_to_denit_excess(:) - real(r8), pointer :: supplement_to_sminn(:) -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p,l,pi !indices - integer :: fp !lake filter pft index - integer :: fc !lake filter column index - integer :: nlimit !flag for N limitation - real(r8):: mr !maintenance respiration (gC/m2/s) - real(r8):: f1,f2,f3,f4,g1,g2 !allocation parameters - real(r8):: cnl,cnfr,cnlw,cndw !C:N ratios for leaf, fine root, and wood - real(r8):: fcur !fraction of current psn displayed as growth - real(r8):: sum_ndemand !total column N demand (gN/m2/s) - real(r8):: gresp_storage !temporary variable for growth resp to storage - real(r8):: nlc !temporary variable for total new leaf carbon allocation - real(r8):: curmr, curmr_ratio !xsmrpool temporary variables - real(r8) f5 !grain allocation parameter - real(r8) cng !C:N ratio for grain (= cnlw for now; slevis) - real(r8) fleaf !fraction allocated to leaf - - -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - ivt => pft%itype - pcolumn => pft%column - plandunit => pft%landunit - clandunit => col%landunit - pfti => col%pfti - itypelun => lun%itype - lgsf => pepv%lgsf - xsmrpool => pcs%xsmrpool - retransn => pns%retransn - psnsun => pcf%psnsun - psnsha => pcf%psnsha - - c13_psnsun => pc13f%psnsun - c13_psnsha => pc13f%psnsha - - laisun => pps%laisun - laisha => pps%laisha - leaf_mr => pcf%leaf_mr - froot_mr => pcf%froot_mr - livestem_mr => pcf%livestem_mr - livecroot_mr => pcf%livecroot_mr - leaf_curmr => pcf%leaf_curmr - froot_curmr => pcf%froot_curmr - livestem_curmr => pcf%livestem_curmr - livecroot_curmr => pcf%livecroot_curmr - leaf_xsmr => pcf%leaf_xsmr - froot_xsmr => pcf%froot_xsmr - livestem_xsmr => pcf%livestem_xsmr - livecroot_xsmr => pcf%livecroot_xsmr - sminn => cns%sminn - woody => pftcon%woody - froot_leaf => pftcon%froot_leaf - croot_stem => pftcon%croot_stem - stem_leaf => pftcon%stem_leaf - flivewd => pftcon%flivewd - leafcn => pftcon%leafcn - frootcn => pftcon%frootcn - livewdcn => pftcon%livewdcn - deadwdcn => pftcon%deadwdcn - fcur2 => pftcon%fcur - gddmaturity => pps%gddmaturity - huileaf => pps%huileaf - huigrain => pps%huigrain - hui => pps%gddplant - leafout => pps%gddtsoi - croplive => pps%croplive - peaklai => pps%peaklai - graincn => pftcon%graincn - ! Assign local pointers to derived type arrays (out) - gpp => pepv%gpp - availc => pepv%availc - xsmrpool_recover => pepv%xsmrpool_recover - c_allometry => pepv%c_allometry - n_allometry => pepv%n_allometry - plant_ndemand => pepv%plant_ndemand - tempsum_potential_gpp => pepv%tempsum_potential_gpp - tempmax_retransn => pepv%tempmax_retransn - annsum_potential_gpp => pepv%annsum_potential_gpp - avail_retransn => pepv%avail_retransn - annmax_retransn => pepv%annmax_retransn - plant_nalloc => pepv%plant_nalloc - plant_calloc => pepv%plant_calloc - excess_cflux => pepv%excess_cflux - downreg => pepv%downreg - annsum_npp => pepv%annsum_npp - cpool_to_xsmrpool => pcf%cpool_to_xsmrpool - psnsun_to_cpool => pcf%psnsun_to_cpool - psnshade_to_cpool => pcf%psnshade_to_cpool - - c13_psnsun_to_cpool => pc13f%psnsun_to_cpool - c13_psnshade_to_cpool => pc13f%psnshade_to_cpool - - cpool_to_leafc => pcf%cpool_to_leafc - cpool_to_leafc_storage => pcf%cpool_to_leafc_storage - cpool_to_frootc => pcf%cpool_to_frootc - cpool_to_frootc_storage => pcf%cpool_to_frootc_storage - cpool_to_livestemc => pcf%cpool_to_livestemc - cpool_to_livestemc_storage => pcf%cpool_to_livestemc_storage - cpool_to_deadstemc => pcf%cpool_to_deadstemc - cpool_to_deadstemc_storage => pcf%cpool_to_deadstemc_storage - cpool_to_livecrootc => pcf%cpool_to_livecrootc - cpool_to_livecrootc_storage => pcf%cpool_to_livecrootc_storage - cpool_to_deadcrootc => pcf%cpool_to_deadcrootc - cpool_to_deadcrootc_storage => pcf%cpool_to_deadcrootc_storage - cpool_to_gresp_storage => pcf%cpool_to_gresp_storage - cpool_to_grainc => pcf%cpool_to_grainc - cpool_to_grainc_storage => pcf%cpool_to_grainc_storage - npool_to_grainn => pnf%npool_to_grainn - npool_to_grainn_storage => pnf%npool_to_grainn_storage - retransn_to_npool => pnf%retransn_to_npool - sminn_to_npool => pnf%sminn_to_npool - npool_to_leafn => pnf%npool_to_leafn - npool_to_leafn_storage => pnf%npool_to_leafn_storage - npool_to_frootn => pnf%npool_to_frootn - npool_to_frootn_storage => pnf%npool_to_frootn_storage - npool_to_livestemn => pnf%npool_to_livestemn - npool_to_livestemn_storage => pnf%npool_to_livestemn_storage - npool_to_deadstemn => pnf%npool_to_deadstemn - npool_to_deadstemn_storage => pnf%npool_to_deadstemn_storage - npool_to_livecrootn => pnf%npool_to_livecrootn - npool_to_livecrootn_storage => pnf%npool_to_livecrootn_storage - npool_to_deadcrootn => pnf%npool_to_deadcrootn - npool_to_deadcrootn_storage => pnf%npool_to_deadcrootn_storage - fpi => cps%fpi - fpg => cps%fpg - potential_immob => cnf%potential_immob - actual_immob => cnf%actual_immob - sminn_to_plant => cnf%sminn_to_plant - sminn_to_denit_excess => cnf%sminn_to_denit_excess - supplement_to_sminn => cnf%supplement_to_sminn - aleafi => pps%aleafi - astemi => pps%astemi - aleaf => pps%aleaf - astem => pps%astem - - ! loop over pfts to assess the total plant N demand - do fp=1,num_soilp - p = filter_soilp(fp) - - ! get the time step total gross photosynthesis - ! this is coming from the canopy fluxes code, and is the - ! gpp that is used to control stomatal conductance. - ! For the nitrogen downregulation code, this is assumed - ! to be the potential gpp, and the actual gpp will be - ! reduced due to N limitation. - - ! Convert psn from umol/m2/s -> gC/m2/s - - ! The input psn (psnsun and psnsha) are expressed per unit LAI - ! in the sunlit and shaded canopy, respectively. These need to be - ! scaled by laisun and laisha to get the total gpp for allocation - - psnsun_to_cpool(p) = psnsun(p) * laisun(p) * 12.011e-6_r8 - psnshade_to_cpool(p) = psnsha(p) * laisha(p) * 12.011e-6_r8 - if (use_c13) then - c13_psnsun_to_cpool(p) = c13_psnsun(p) * laisun(p) * 12.011e-6_r8 - c13_psnshade_to_cpool(p) = c13_psnsha(p) * laisha(p) * 12.011e-6_r8 - endif - - gpp(p) = psnsun_to_cpool(p) + psnshade_to_cpool(p) - - ! get the time step total maintenance respiration - ! These fluxes should already be in gC/m2/s - - mr = leaf_mr(p) + froot_mr(p) - if (woody(ivt(p)) == 1.0_r8) then - mr = mr + livestem_mr(p) + livecroot_mr(p) - else if (ivt(p) >= npcropmin)then - if (croplive(p)) mr = mr + livestem_mr(p) - end if - - ! carbon flux available for allocation - availc(p) = gpp(p) - mr - - ! new code added for isotope calculations, 7/1/05, PET - ! If mr > gpp, then some mr comes from gpp, the rest comes from - ! cpool (xsmr) - if (mr > 0._r8 .and. availc(p) < 0._r8) then - curmr = gpp(p) - curmr_ratio = curmr / mr - else - curmr_ratio = 1._r8 - end if - leaf_curmr(p) = leaf_mr(p) * curmr_ratio - leaf_xsmr(p) = leaf_mr(p) - leaf_curmr(p) - froot_curmr(p) = froot_mr(p) * curmr_ratio - froot_xsmr(p) = froot_mr(p) - froot_curmr(p) - livestem_curmr(p) = livestem_mr(p) * curmr_ratio - livestem_xsmr(p) = livestem_mr(p) - livestem_curmr(p) - livecroot_curmr(p) = livecroot_mr(p) * curmr_ratio - livecroot_xsmr(p) = livecroot_mr(p) - livecroot_curmr(p) - - ! no allocation when available c is negative - availc(p) = max(availc(p),0.0_r8) - - ! test for an xsmrpool deficit - if (xsmrpool(p) < 0.0_r8) then - ! Running a deficit in the xsmrpool, so the first priority is to let - ! some availc from this timestep accumulate in xsmrpool. - ! Determine rate of recovery for xsmrpool deficit - - xsmrpool_recover(p) = -xsmrpool(p)/(dayscrecover*secspday) - if (xsmrpool_recover(p) < availc(p)) then - ! available carbon reduced by amount for xsmrpool recovery - availc(p) = availc(p) - xsmrpool_recover(p) - else - ! all of the available carbon goes to xsmrpool recovery - xsmrpool_recover(p) = availc(p) - availc(p) = 0.0_r8 - end if - cpool_to_xsmrpool(p) = xsmrpool_recover(p) - end if - - f1 = froot_leaf(ivt(p)) - f2 = croot_stem(ivt(p)) - - ! modified wood allocation to be 2.2 at npp=800 gC/m2/yr, 0.2 at npp=0, - ! constrained so that it does not go lower than 0.2 (under negative annsum_npp) - ! This variable allocation is only for trees. Shrubs have a constant - ! allocation as specified in the pft-physiology file. The value is also used - ! as a trigger here: -1.0 means to use the dynamic allocation (trees). - if (stem_leaf(ivt(p)) == -1._r8) then - f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4 - else - f3 = stem_leaf(ivt(p)) - end if - - f4 = flivewd(ivt(p)) - g1 = grperc(ivt(p)) - g2 = grpnow(ivt(p)) - cnl = leafcn(ivt(p)) - cnfr = frootcn(ivt(p)) - cnlw = livewdcn(ivt(p)) - cndw = deadwdcn(ivt(p)) - - ! calculate f1 to f5 for prog crops following AgroIBIS subr phenocrop - - f5 = 0._r8 ! continued intializations from above - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - - if (croplive(p)) then - ! same phases appear in subroutine CropPhenology - - ! Phase 1 completed: - ! ================== - ! if hui is less than the number of gdd needed for filling of grain - ! leaf emergence also has to have taken place for lai changes to occur - ! and carbon assimilation - ! Next phase: leaf emergence to start of leaf decline - - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p)) then - - ! allocation rules for crops based on maturity and linear decrease - ! of amount allocated to roots over course of the growing season - - if (peaklai(p) == 1) then ! lai at maximum allowed - arepr(p) = 0._r8 - aleaf(p) = 1.e-5_r8 - astem(p) = 0._r8 - aroot(p) = 1._r8 - arepr(p) - aleaf(p) - astem(p) - else - arepr(p) = 0._r8 - aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - & - (arooti(ivt(p)) - arootf(ivt(p))) * & - min(1._r8, hui(p)/gddmaturity(p)))) - fleaf = fleafi(ivt(p)) * (exp(-bfact(ivt(p))) - & - exp(-bfact(ivt(p))*hui(p)/huigrain(p))) / & - (exp(-bfact(ivt(p)))-1) ! fraction alloc to leaf (from J Norman alloc curve) - aleaf(p) = max(1.e-5_r8, (1._r8 - aroot(p)) * fleaf) - astem(p) = 1._r8 - arepr(p) - aleaf(p) - aroot(p) - end if - - ! AgroIBIS included here an immediate adjustment to aleaf & astem if the - ! predicted lai from the above allocation coefficients exceeded laimx. - ! We have decided to live with lais slightly higher than laimx by - ! enforcing the cap in the following tstep through the peaklai logic above. - - astemi(p) = astem(p) ! save for use by equations after shift - aleafi(p) = aleaf(p) ! to reproductive phenology stage begins - - ! Phase 2 completed: - ! ================== - ! shift allocation either when enough gdd are accumulated or maximum number - ! of days has elapsed since planting - - else if (hui(p) >= huigrain(p)) then - - aroot(p) = max(0._r8, min(1._r8, arooti(ivt(p)) - & - (arooti(ivt(p)) - arootf(ivt(p))) * min(1._r8, hui(p)/gddmaturity(p)))) - if (astemi(p) > astemf(ivt(p))) then - astem(p) = max(0._r8, max(astemf(ivt(p)), astem(p) * & - (1._r8 - min((hui(p)- & - huigrain(p))/((gddmaturity(p)*declfact(ivt(p)))- & - huigrain(p)),1._r8)**allconss(ivt(p)) ))) - end if - if (aleafi(p) > aleaff(ivt(p))) then - aleaf(p) = max(1.e-5_r8, max(aleaff(ivt(p)), aleaf(p) * & - (1._r8 - min((hui(p)- & - huigrain(p))/((gddmaturity(p)*declfact(ivt(p)))- & - huigrain(p)),1._r8)**allconsl(ivt(p)) ))) - end if - arepr(p) = 1._r8 - aroot(p) - astem(p) - aleaf(p) - astem(p) = astem(p)+arepr(p) - arepr(p) = 0._r8 - - else ! pre emergence - aleaf(p) = 1.e-5_r8 ! allocation coefficients should be irrelevant - astem(p) = 0._r8 ! because crops have no live carbon pools; - aroot(p) = 0._r8 ! this applies to this "else" and to the "else" - arepr(p) = 0._r8 ! a few lines down - end if - - f1 = aroot(p) / aleaf(p) - f3 = astem(p) / aleaf(p) - f5 = arepr(p) / aleaf(p) - g1 = 0.25_r8 - - else ! .not croplive - f1 = 0._r8 - f3 = 0._r8 - f5 = 0._r8 - g1 = 0.25_r8 - end if - end if - - ! based on available C, use constant allometric relationships to - ! determine N requirements - if (woody(ivt(p)) == 1.0_r8) then - c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else if (ivt(p) >= npcropmin) then ! skip generic crops - c_allometry(p) = (1._r8+g1)*(1._r8+f1+f3*(1._r8+f2)) - n_allometry(p) = 1._r8/cnl + f1/cnfr + (f3*f4*(1._r8+f2))/cnlw + & - (f3*(1._r8-f4)*(1._r8+f2))/cndw - else - c_allometry(p) = 1._r8+g1+f1+f1*g1 - n_allometry(p) = 1._r8/cnl + f1/cnfr - end if - plant_ndemand(p) = availc(p)*(n_allometry(p)/c_allometry(p)) - - ! retranslocated N deployment depends on seasonal cycle of potential GPP - ! (requires one year run to accumulate demand) - - tempsum_potential_gpp(p) = tempsum_potential_gpp(p) + gpp(p) - - ! Adding the following line to carry max retransn info to CN Annual Update - tempmax_retransn(p) = max(tempmax_retransn(p),retransn(p)) - - if (annsum_potential_gpp(p) > 0.0_r8) then - avail_retransn(p) = (annmax_retransn(p)/2.0)*(gpp(p)/annsum_potential_gpp(p))/dt - else - avail_retransn(p) = 0.0_r8 - end if - - ! make sure available retrans N doesn't exceed storage - avail_retransn(p) = min(avail_retransn(p), retransn(p)/dt) - - ! modify plant N demand according to the availability of - ! retranslocated N - ! take from retransn pool at most the flux required to meet - ! plant ndemand - - if (plant_ndemand(p) > avail_retransn(p)) then - retransn_to_npool(p) = avail_retransn(p) - else - retransn_to_npool(p) = plant_ndemand(p) - end if - plant_ndemand(p) = plant_ndemand(p) - retransn_to_npool(p) - - end do ! end pft loop - - ! now use the p2c routine to get the column-averaged plant_ndemand - call p2c(num_soilc,filter_soilc,plant_ndemand,col_plant_ndemand) - - ! column loop to resolve plant/heterotroph competition for mineral N - do fc=1,num_soilc - c = filter_soilc(fc) - l = clandunit(c) - - sum_ndemand = col_plant_ndemand(c) + potential_immob(c) - - if (sum_ndemand*dt < sminn(c)) then - ! N availability is not limiting immobilization of plant - ! uptake, and both can proceed at their potential rates - - nlimit = 0 - fpi(c) = 1.0_r8 - actual_immob(c) = potential_immob(c) - sminn_to_plant(c) = col_plant_ndemand(c) - - ! under conditions of excess N, some proportion is assumed to - ! be lost to denitrification, in addition to the constant - ! proportion lost in the decomposition pathways - - sminn_to_denit_excess(c) = bdnr*((sminn(c)/dt) - sum_ndemand) - else if ( ((.not. Carbon_only) .and. (.not. crop_supln)) .or. & - (crop_supln .and. ( (itypelun(l) /= istcrop) .or. & - ((itypelun(l) == istcrop) .and. (ivt(pfti(c)) < npcropmin) )) ) )then - - ! N availability can not satisfy the sum of immobilization and - ! plant growth demands, so these two demands compete for available - ! soil mineral N resource. - - nlimit = 1 - if (sum_ndemand > 0.0_r8) then - actual_immob(c) = (sminn(c)/dt)*(potential_immob(c) / sum_ndemand) - else - actual_immob(c) = 0.0_r8 - end if - - if (potential_immob(c) > 0.0_r8) then - fpi(c) = actual_immob(c) / potential_immob(c) - else - fpi(c) = 0.0_r8 - end if - - sminn_to_plant(c) = (sminn(c)/dt) - actual_immob(c) - else if ( Carbon_only .or. & - (crop_supln .and. (itypelun(l) == istcrop) .and. & - (ivt(pfti(c)) >= npcropmin)) )then - ! this code block controls the addition of N to sminn pool - ! to eliminate any N limitation, when Carbon_Only is set. This lets the - ! model behave essentially as a carbon-only model, but with the - ! benefit of keeping track of the N additions needed to - ! eliminate N limitations, so there is still a diagnostic quantity - ! that describes the degree of N limitation at steady-state. - - nlimit = 1 - fpi(c) = 1.0_r8 - actual_immob(c) = potential_immob(c) - sminn_to_plant(c) = col_plant_ndemand(c) - supplement_to_sminn(c) = sum_ndemand - (sminn(c)/dt) - else - call endrun( 'This else should NOT be able to happen' ) - end if - - ! calculate the fraction of potential growth that can be - ! acheived with the N available to plants - - if (col_plant_ndemand(c) > 0.0_r8) then - fpg(c) = sminn_to_plant(c) / col_plant_ndemand(c) - else - fpg(c) = 1.0_r8 - end if - - end do ! end of column loop - - ! start new pft loop to distribute the available N between the - ! competing pfts on the basis of relative demand, and allocate C and N to - ! new growth and storage - - do fp=1,num_soilp - p = filter_soilp(fp) - c = pcolumn(p) - - ! set some local allocation variables - f1 = froot_leaf(ivt(p)) - f2 = croot_stem(ivt(p)) - - ! modified wood allocation to be 2.2 at npp=800 gC/m2/yr, 0.2 at npp=0, - ! constrained so that it does not go lower than 0.2 (under negative annsum_npp) - ! There was an error in this formula in previous version, where the coefficient - ! was 0.004 instead of 0.0025. - ! This variable allocation is only for trees. Shrubs have a constant - ! allocation as specified in the pft-physiology file. The value is also used - ! as a trigger here: -1.0 means to use the dynamic allocation (trees). - if (stem_leaf(ivt(p)) == -1._r8) then - f3 = (2.7/(1.0+exp(-0.004*(annsum_npp(p) - 300.0)))) - 0.4 - else - f3 = stem_leaf(ivt(p)) - end if - - f4 = flivewd(ivt(p)) - g1 = grperc(ivt(p)) - g2 = grpnow(ivt(p)) - cnl = leafcn(ivt(p)) - cnfr = frootcn(ivt(p)) - cnlw = livewdcn(ivt(p)) - cndw = deadwdcn(ivt(p)) - fcur = fcur2(ivt(p)) - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - if (croplive(p)) then - f1 = aroot(p) / aleaf(p) - f3 = astem(p) / aleaf(p) - f5 = arepr(p) / aleaf(p) - g1 = 0.25_r8 - else - f1 = 0._r8 - f3 = 0._r8 - f5 = 0._r8 - g1 = 0.25_r8 - end if - end if - - ! increase fcur linearly with ndays_active, until fcur reaches 1.0 at - ! ndays_active = days/year. This prevents the continued storage of C and N. - ! turning off this correction (PET, 12/11/03), instead using bgtr in - ! phenology algorithm. - !fcur = fcur + (1._r8 - fcur)*lgsf(p) - - sminn_to_npool(p) = plant_ndemand(p) * fpg(c) - plant_nalloc(p) = sminn_to_npool(p) + retransn_to_npool(p) - - ! calculate the associated carbon allocation, and the excess - ! carbon flux that must be accounted for through downregulation - - plant_calloc(p) = plant_nalloc(p) * (c_allometry(p)/n_allometry(p)) - excess_cflux(p) = availc(p) - plant_calloc(p) - - ! reduce gpp fluxes due to N limitation - if (gpp(p) > 0.0_r8) then - downreg(p) = excess_cflux(p)/gpp(p) - psnsun_to_cpool(p) = psnsun_to_cpool(p)*(1._r8 - downreg(p)) - psnshade_to_cpool(p) = psnshade_to_cpool(p)*(1._r8 - downreg(p)) - if (use_c13) then - c13_psnsun_to_cpool(p) = c13_psnsun_to_cpool(p)*(1._r8 - downreg(p)) - c13_psnshade_to_cpool(p) = c13_psnshade_to_cpool(p)*(1._r8 - downreg(p)) - endif - end if - - ! calculate the amount of new leaf C dictated by these allocation - ! decisions, and calculate the daily fluxes of C and N to current - ! growth and storage pools - - ! fcur is the proportion of this day's growth that is displayed now, - ! the remainder going into storage for display next year through the - ! transfer pools - - nlc = plant_calloc(p) / c_allometry(p) - cpool_to_leafc(p) = nlc * fcur - cpool_to_leafc_storage(p) = nlc * (1._r8 - fcur) - cpool_to_frootc(p) = nlc * f1 * fcur - cpool_to_frootc_storage(p) = nlc * f1 * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - cpool_to_livestemc(p) = nlc * f3 * f4 * fcur - cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) - cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur - cpool_to_deadstemc_storage(p) = nlc * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_livecrootc(p) = nlc * f2 * f3 * f4 * fcur - cpool_to_livecrootc_storage(p) = nlc * f2 * f3 * f4 * (1._r8 - fcur) - cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur - cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool_to_livestemc(p) = nlc * f3 * f4 * fcur - cpool_to_livestemc_storage(p) = nlc * f3 * f4 * (1._r8 - fcur) - cpool_to_deadstemc(p) = nlc * f3 * (1._r8 - f4) * fcur - cpool_to_deadstemc_storage(p) = nlc * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_livecrootc(p) = nlc * f2 * f3 * f4 * fcur - cpool_to_livecrootc_storage(p) = nlc * f2 * f3 * f4 * (1._r8 - fcur) - cpool_to_deadcrootc(p) = nlc * f2 * f3 * (1._r8 - f4) * fcur - cpool_to_deadcrootc_storage(p) = nlc * f2 * f3 * (1._r8 - f4) * (1._r8 - fcur) - cpool_to_grainc(p) = nlc * f5 * fcur - cpool_to_grainc_storage(p) = nlc * f5 * (1._r8 -fcur) - end if - - ! corresponding N fluxes - npool_to_leafn(p) = (nlc / cnl) * fcur - npool_to_leafn_storage(p) = (nlc / cnl) * (1._r8 - fcur) - npool_to_frootn(p) = (nlc * f1 / cnfr) * fcur - npool_to_frootn_storage(p) = (nlc * f1 / cnfr) * (1._r8 - fcur) - if (woody(ivt(p)) == 1._r8) then - npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cng = graincn(ivt(p)) - npool_to_livestemn(p) = (nlc * f3 * f4 / cnlw) * fcur - npool_to_livestemn_storage(p) = (nlc * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadstemn(p) = (nlc * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadstemn_storage(p) = (nlc * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_livecrootn(p) = (nlc * f2 * f3 * f4 / cnlw) * fcur - npool_to_livecrootn_storage(p) = (nlc * f2 * f3 * f4 / cnlw) * (1._r8 - fcur) - npool_to_deadcrootn(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * fcur - npool_to_deadcrootn_storage(p) = (nlc * f2 * f3 * (1._r8 - f4) / cndw) * (1._r8 - fcur) - npool_to_grainn(p) = (nlc * f5 / cng) * fcur - npool_to_grainn_storage(p) = (nlc * f5 / cng) * (1._r8 -fcur) - end if - - ! Calculate the amount of carbon that needs to go into growth - ! respiration storage to satisfy all of the storage growth demands. - ! Allows for the fraction of growth respiration that is released at the - ! time of fixation, versus the remaining fraction that is stored for - ! release at the time of display. Note that all the growth respiration - ! fluxes that get released on a given timestep are calculated in growth_resp(), - ! but that the storage of C for growth resp during display of transferred - ! growth is assigned here. - - gresp_storage = cpool_to_leafc_storage(p) + cpool_to_frootc_storage(p) - if (woody(ivt(p)) == 1._r8) then - gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) - gresp_storage = gresp_storage + cpool_to_deadstemc_storage(p) - gresp_storage = gresp_storage + cpool_to_livecrootc_storage(p) - gresp_storage = gresp_storage + cpool_to_deadcrootc_storage(p) - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - gresp_storage = gresp_storage + cpool_to_livestemc_storage(p) - gresp_storage = gresp_storage + cpool_to_grainc_storage(p) - end if - cpool_to_gresp_storage(p) = gresp_storage * g1 * (1._r8 - g2) - - end do ! end pft loop - -end subroutine CNAllocation - -end module CNAllocationMod diff --git a/src_clm40/biogeochem/CNAnnualUpdateMod.F90 b/src_clm40/biogeochem/CNAnnualUpdateMod.F90 deleted file mode 100644 index 101d171fb5..0000000000 --- a/src_clm40/biogeochem/CNAnnualUpdateMod.F90 +++ /dev/null @@ -1,195 +0,0 @@ -module CNAnnualUpdateMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNAnnualUpdateMod -! -! !DESCRIPTION: -! Module for updating annual summation variables -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: CNAnnualUpdate -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNAnnualUpdate -! -! !INTERFACE: -subroutine CNAnnualUpdate(lbc, ubc, lbp, ubp, num_soilc, filter_soilc, & - num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update annual summation variables -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size, get_days_per_year - use clm_varcon , only: secspday - use pft2colMod , only: p2c - use clm_varctl , only: use_cn, use_cndv, use_crop -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(ubc-lbc+1) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(ubp-lbp+1) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 10/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: pcolumn(:) ! index into column level - ! quantities -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: annsum_counter(:) ! seconds since last annual accumulator turnover - real(r8), pointer :: tempsum_potential_gpp(:) ! temporary annual sum of potential GPP - real(r8), pointer :: annsum_potential_gpp(:) ! annual sum of potential GPP - real(r8), pointer :: tempmax_retransn(:) ! temporary annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: annmax_retransn(:) ! annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: tempavg_t2m(:) ! temporary average 2m air temperature (K) - real(r8), pointer :: annavg_t2m(:) ! annual average 2m air temperature (K) - real(r8), pointer :: tempsum_npp(:) ! temporary sum NPP (gC/m2/yr) - real(r8), pointer :: annsum_npp(:) ! annual sum NPP (gC/m2/yr) - real(r8), pointer :: cannsum_npp(:) ! column annual sum NPP (gC/m2/yr) - real(r8), pointer :: cannavg_t2m(:) !annual average of 2m air temperature, averaged from pft-level (K) - real(r8), pointer :: tempsum_litfall(:) ! temporary sum litfall (gC/m2/yr) - real(r8), pointer :: annsum_litfall(:) ! annual sum litfall (gC/m2/yr) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays - annsum_counter => cps%annsum_counter - tempsum_potential_gpp => pepv%tempsum_potential_gpp - annsum_potential_gpp => pepv%annsum_potential_gpp - tempmax_retransn => pepv%tempmax_retransn - annmax_retransn => pepv%annmax_retransn - tempavg_t2m => pepv%tempavg_t2m - annavg_t2m => pepv%annavg_t2m - tempsum_npp => pepv%tempsum_npp - annsum_npp => pepv%annsum_npp - cannsum_npp => cps%cannsum_npp - cannavg_t2m => cps%cannavg_t2m - tempsum_litfall => pepv%tempsum_litfall - annsum_litfall => pepv%annsum_litfall - pcolumn => pft%column - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - annsum_counter(c) = annsum_counter(c) + dt - end do - - ! In the future -- ONLY use the top if-block and remove the second - which is the same - ! except the ordering of the if/do blocks - - if (use_cndv .or. use_crop) then - if (annsum_counter(filter_soilc(1)) >= get_days_per_year() * secspday) then ! new (slevis) - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! update annual plant ndemand accumulator - annsum_potential_gpp(p) = tempsum_potential_gpp(p) - tempsum_potential_gpp(p) = 0._r8 - - ! update annual total N retranslocation accumulator - annmax_retransn(p) = tempmax_retransn(p) - tempmax_retransn(p) = 0._r8 - - ! update annual average 2m air temperature accumulator - annavg_t2m(p) = tempavg_t2m(p) - tempavg_t2m(p) = 0._r8 - - ! update annual NPP accumulator, convert to annual total - annsum_npp(p) = tempsum_npp(p) * dt - tempsum_npp(p) = 0._r8 - - if (use_cndv) then - ! update annual litfall accumulator, convert to annual total - annsum_litfall(p) = tempsum_litfall(p) * dt - tempsum_litfall(p) = 0._r8 - end if - end do - ! use p2c routine to get selected column-average pft-level fluxes and states - call p2c(num_soilc, filter_soilc, annsum_npp, cannsum_npp) - call p2c(num_soilc, filter_soilc, annavg_t2m, cannavg_t2m) - end if - else - do fp = 1,num_soilp - p = filter_soilp(fp) - ! In the future -- REMOVE this code and use the equivalent code above always - c = pcolumn(p) ! old (slevis) - if (annsum_counter(c) >= get_days_per_year() * secspday) then ! old (slevis) - ! update annual plant ndemand accumulator - annsum_potential_gpp(p) = tempsum_potential_gpp(p) - tempsum_potential_gpp(p) = 0._r8 - - ! update annual total N retranslocation accumulator - annmax_retransn(p) = tempmax_retransn(p) - tempmax_retransn(p) = 0._r8 - - ! update annual average 2m air temperature accumulator - annavg_t2m(p) = tempavg_t2m(p) - tempavg_t2m(p) = 0._r8 - - ! update annual NPP accumulator, convert to annual total - annsum_npp(p) = tempsum_npp(p) * dt - tempsum_npp(p) = 0._r8 - - if (use_cndv) then - ! update annual litfall accumulator, convert to annual total - annsum_litfall(p) = tempsum_litfall(p) * dt - tempsum_litfall(p) = 0._r8 - end if - end if ! old (slevis) - end do - ! use p2c routine to get selected column-average pft-level fluxes and states - call p2c(num_soilc, filter_soilc, annsum_npp, cannsum_npp) - call p2c(num_soilc, filter_soilc, annavg_t2m, cannavg_t2m) - end if - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - if (annsum_counter(c) >= get_days_per_year() * secspday) annsum_counter(c) = 0._r8 - end do - -end subroutine CNAnnualUpdate -!----------------------------------------------------------------------- - -end module CNAnnualUpdateMod diff --git a/src_clm40/biogeochem/CNBalanceCheckMod.F90 b/src_clm40/biogeochem/CNBalanceCheckMod.F90 deleted file mode 100644 index 09c66dd156..0000000000 --- a/src_clm40/biogeochem/CNBalanceCheckMod.F90 +++ /dev/null @@ -1,396 +0,0 @@ -module CNBalanceCheckMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNBalanceCheckMod -! -! !DESCRIPTION: -! Module for carbon mass balance checking. -! -! !USES: - use abortutils , only: endrun - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varctl , only: iulog - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: BeginCBalance - public :: BeginNBalance - public :: CBalanceCheck - public :: NBalanceCheck -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BeginCBalance -! -! !INTERFACE: -subroutine BeginCBalance(lbc, ubc, num_soilc, filter_soilc) -! -! !DESCRIPTION: -! On the radiation time step, calculate the beginning carbon balance for mass -! conservation checks. -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(ubc-lbc+1) ! filter for soil columns -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 2/4/05: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: totcolc(:) ! (gC/m2) total column carbon, incl veg and cpool -! -! local pointers to implicit out arrays - real(r8), pointer :: col_begcb(:) ! carbon mass, beginning of time step (gC/m**2) -! -! !OTHER LOCAL VARIABLES: - integer :: c ! indices - integer :: fc ! lake filter indices -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - col_begcb => ccbal%begcb - totcolc => ccs%totcolc - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate beginning column-level carbon balance, - ! for mass conservation check - - col_begcb(c) = totcolc(c) - - end do ! end of columns loop - - -end subroutine BeginCBalance -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BeginNBalance -! -! !INTERFACE: -subroutine BeginNBalance(lbc, ubc, num_soilc, filter_soilc) -! -! !DESCRIPTION: -! On the radiation time step, calculate the beginning nitrogen balance for mass -! conservation checks. -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(ubc-lbc+1) ! filter for soil columns -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 2/4/05: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: totcoln(:) ! (gN/m2) total column nitrogen, incl veg -! -! local pointers to implicit out arrays - real(r8), pointer :: col_begnb(:) ! nitrogen mass, beginning of time step (gN/m**2) -! -! !OTHER LOCAL VARIABLES: - integer :: c ! indices - integer :: fc ! lake filter indices -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - col_begnb => cnbal%begnb - totcoln => cns%totcoln - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate beginning column-level nitrogen balance, - ! for mass conservation check - - col_begnb(c) = totcoln(c) - - end do ! end of columns loop - -end subroutine BeginNBalance -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CBalanceCheck -! -! !INTERFACE: -subroutine CBalanceCheck(lbc, ubc, num_soilc, filter_soilc) -! -! !DESCRIPTION: -! On the radiation time step, perform carbon mass conservation check for column and pft -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(ubc-lbc+1) ! filter for soil columns -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 12/9/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arrays - real(r8), pointer :: totcolc(:) ! (gC/m2) total column carbon, incl veg and cpool - real(r8), pointer :: gpp(:) ! (gC/m2/s) gross primary production - real(r8), pointer :: er(:) ! (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - real(r8), pointer :: col_fire_closs(:) ! (gC/m2/s) total column-level fire C loss - real(r8), pointer :: col_hrv_xsmrpool_to_atm(:) ! excess MR pool harvest mortality (gC/m2/s) - real(r8), pointer :: dwt_closs(:) ! (gC/m2/s) total carbon loss from product pools and conversion - real(r8), pointer :: product_closs(:) ! (gC/m2/s) total wood product carbon loss -! -! local pointers to implicit out arrays - real(r8), pointer :: col_cinputs(:) ! (gC/m2/s) total column-level carbon inputs (for balance check) - real(r8), pointer :: col_coutputs(:) ! (gC/m2/s) total column-level carbon outputs (for balance check) - real(r8), pointer :: col_begcb(:) ! carbon mass, beginning of time step (gC/m**2) - real(r8), pointer :: col_endcb(:) ! carbon mass, end of time step (gC/m**2) - real(r8), pointer :: col_errcb(:) ! carbon balance error for the timestep (gC/m**2) -! -! !OTHER LOCAL VARIABLES: - integer :: c,err_index ! indices - integer :: fc ! lake filter indices - logical :: err_found ! error flag - real(r8):: dt ! radiation time step (seconds) -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers to column-level arrays - totcolc => ccs%totcolc - gpp => pcf_a%gpp - er => ccf%er - col_fire_closs => ccf%col_fire_closs - col_hrv_xsmrpool_to_atm => pcf_a%hrv_xsmrpool_to_atm - dwt_closs => ccf%dwt_closs - product_closs => ccf%product_closs - - col_cinputs => ccf%col_cinputs - col_coutputs => ccf%col_coutputs - col_begcb => ccbal%begcb - col_endcb => ccbal%endcb - col_errcb => ccbal%errcb - - ! set time steps - dt = real( get_step_size(), r8 ) - - err_found = .false. - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate the total column-level carbon storage, for mass conservation check - - col_endcb(c) = totcolc(c) - - ! calculate total column-level inputs - - col_cinputs(c) = gpp(c) - - ! calculate total column-level outputs - ! er = ar + hr, col_fire_closs includes pft-level fire losses - - col_coutputs(c) = er(c) + col_fire_closs(c) + dwt_closs(c) + product_closs(c) + col_hrv_xsmrpool_to_atm(c) - - ! calculate the total column-level carbon balance error for this time step - - col_errcb(c) = (col_cinputs(c) - col_coutputs(c))*dt - & - (col_endcb(c) - col_begcb(c)) - - ! check for significant errors - if (abs(col_errcb(c)) > 1e-8_r8) then - err_found = .true. - err_index = c - end if - - end do ! end of columns loop - - if (err_found) then - c = err_index - write(iulog,*)'column cbalance error = ', col_errcb(c), c - write(iulog,*)'begcb = ',col_begcb(c) - write(iulog,*)'endcb = ',col_endcb(c) - write(iulog,*)'delta store = ',col_endcb(c)-col_begcb(c) - write(iulog,*)'input mass = ',col_cinputs(c)*dt - write(iulog,*)'output mass = ',col_coutputs(c)*dt - write(iulog,*)'net flux = ',(col_cinputs(c)-col_coutputs(c))*dt - write(iulog,*)'nee = ',ccf%nee(c) * dt - write(iulog,*)'gpp = ',gpp(c) * dt - write(iulog,*)'er = ',er(c) * dt - write(iulog,*)'col_fire_closs = ',col_fire_closs(c) * dt - write(iulog,*)'col_hrv_xsmrpool_to_atm = ',col_hrv_xsmrpool_to_atm(c) * dt - write(iulog,*)'dwt_closs = ',dwt_closs(c) * dt - write(iulog,*)'product_closs = ',product_closs(c) * dt - call endrun - end if - - -end subroutine CBalanceCheck -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NBalanceCheck -! -! !INTERFACE: -subroutine NBalanceCheck(lbc, ubc, num_soilc, filter_soilc) -! -! !DESCRIPTION: -! On the radiation time step, perform nitrogen mass conservation check -! for column and pft -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(ubc-lbc+1) ! filter for soil columns -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 12/9/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arrays - real(r8), pointer :: totcoln(:) ! (gN/m2) total column nitrogen, incl veg - real(r8), pointer :: ndep_to_sminn(:) ! atmospheric N deposition to soil mineral N (gN/m2/s) - real(r8), pointer :: nfix_to_sminn(:) ! symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - real(r8), pointer :: supplement_to_sminn(:) ! supplemental N supply (gN/m2/s) - real(r8), pointer :: denit(:) ! total rate of denitrification (gN/m2/s) - real(r8), pointer :: sminn_leached(:) ! soil mineral N pool loss to leaching (gN/m2/s) - real(r8), pointer :: col_fire_nloss(:) ! total column-level fire N loss (gN/m2/s) - real(r8), pointer :: dwt_nloss(:) ! (gN/m2/s) total nitrogen loss from product pools and conversion - real(r8), pointer :: product_nloss(:) ! (gN/m2/s) total wood product nitrogen loss -! -! local pointers to implicit in/out arrays -! -! local pointers to implicit out arrays - real(r8), pointer :: col_ninputs(:) ! column-level N inputs (gN/m2/s) - real(r8), pointer :: col_noutputs(:) ! column-level N outputs (gN/m2/s) - real(r8), pointer :: col_begnb(:) ! nitrogen mass, beginning of time step (gN/m**2) - real(r8), pointer :: col_endnb(:) ! nitrogen mass, end of time step (gN/m**2) - real(r8), pointer :: col_errnb(:) ! nitrogen balance error for the timestep (gN/m**2) -! -! !OTHER LOCAL VARIABLES: - integer :: c,err_index ! indices - integer :: fc ! lake filter indices - logical :: err_found ! error flag - real(r8):: dt ! radiation time step (seconds) -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to column-level arrays - - totcoln => cns%totcoln - ndep_to_sminn => cnf%ndep_to_sminn - nfix_to_sminn => cnf%nfix_to_sminn - supplement_to_sminn => cnf%supplement_to_sminn - denit => cnf%denit - sminn_leached => cnf%sminn_leached - col_fire_nloss => cnf%col_fire_nloss - dwt_nloss => cnf%dwt_nloss - product_nloss => cnf%product_nloss - - col_ninputs => cnf%col_ninputs - col_noutputs => cnf%col_noutputs - col_begnb => cnbal%begnb - col_endnb => cnbal%endnb - col_errnb => cnbal%errnb - - ! set time steps - dt = real( get_step_size(), r8 ) - - err_found = .false. - ! column loop - do fc = 1,num_soilc - c=filter_soilc(fc) - - ! calculate the total column-level nitrogen storage, for mass conservation check - - col_endnb(c) = totcoln(c) - - ! calculate total column-level inputs - - col_ninputs(c) = ndep_to_sminn(c) + nfix_to_sminn(c) + supplement_to_sminn(c) - - ! calculate total column-level outputs - - col_noutputs(c) = denit(c) + sminn_leached(c) + col_fire_nloss(c) + dwt_nloss(c) + product_nloss(c) - - ! calculate the total column-level nitrogen balance error for this time step - - col_errnb(c) = (col_ninputs(c) - col_noutputs(c))*dt - & - (col_endnb(c) - col_begnb(c)) - - if (abs(col_errnb(c)) > 1e-8_r8) then - err_found = .true. - err_index = c - end if - - end do ! end of columns loop - - if (err_found) then - c = err_index - write(iulog,*)'column nbalance error = ', col_errnb(c), c - write(iulog,*)'begnb = ',col_begnb(c) - write(iulog,*)'endnb = ',col_endnb(c) - write(iulog,*)'delta store = ',col_endnb(c)-col_begnb(c) - write(iulog,*)'input mass = ',col_ninputs(c)*dt - write(iulog,*)'output mass = ',col_noutputs(c)*dt - write(iulog,*)'net flux = ',(col_ninputs(c)-col_noutputs(c))*dt - call endrun - end if - -end subroutine NBalanceCheck -!----------------------------------------------------------------------- - -end module CNBalanceCheckMod diff --git a/src_clm40/biogeochem/CNC13FluxMod.F90 b/src_clm40/biogeochem/CNC13FluxMod.F90 deleted file mode 100644 index be20383408..0000000000 --- a/src_clm40/biogeochem/CNC13FluxMod.F90 +++ /dev/null @@ -1,1448 +0,0 @@ -module CNC13FluxMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: C13FluxMod -! -! !DESCRIPTION: -! Module for 13-carbon flux variable update, non-mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! -! !PUBLIC MEMBER FUNCTIONS: - public:: C13Flux1 - public:: C13Flux2 - public:: C13Flux2h - public:: C13Flux3 - private:: CNC13LitterToColumn - private:: CNC13GapPftToColumn - private:: CNC13HarvestPftToColumn - private:: C13FluxCalc -! -! !REVISION HISTORY: -! 4/21/2005: Created by Peter Thornton and Neil Suits -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13Flux1 -! -! !INTERFACE: -subroutine C13Flux1(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, set the 13-carbon flux -! variables (except for gap-phase mortality and fire fluxes) -! -! !USES: - use clmtype - use clm_varctl, only : use_c13 -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! -! !LOCAL VARIABLES: -! !OTHER LOCAL VARIABLES: - type(pft_type), pointer :: p - type(column_type), pointer :: c - integer :: fp,pi -! -!EOP -!----------------------------------------------------------------------- - - if (.not. use_c13) then - RETURN - end if - - ! set local pointers - p => pft - c => col - - ! pft-level non-mortality fluxes - - call C13FluxCalc(pc13f%leafc_xfer_to_leafc, pcf%leafc_xfer_to_leafc, & - pc13s%leafc_xfer, pcs%leafc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%frootc_xfer_to_frootc, pcf%frootc_xfer_to_frootc, & - pc13s%frootc_xfer, pcs%frootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livestemc_xfer_to_livestemc, pcf%livestemc_xfer_to_livestemc, & - pc13s%livestemc_xfer, pcs%livestemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%deadstemc_xfer_to_deadstemc, pcf%deadstemc_xfer_to_deadstemc, & - pc13s%deadstemc_xfer, pcs%deadstemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livecrootc_xfer_to_livecrootc, pcf%livecrootc_xfer_to_livecrootc, & - pc13s%livecrootc_xfer, pcs%livecrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%deadcrootc_xfer_to_deadcrootc, pcf%deadcrootc_xfer_to_deadcrootc, & - pc13s%deadcrootc_xfer, pcs%deadcrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%leafc_to_litter, pcf%leafc_to_litter, & - pc13s%leafc, pcs%leafc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%frootc_to_litter, pcf%frootc_to_litter, & - pc13s%frootc, pcs%frootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livestemc_to_deadstemc, pcf%livestemc_to_deadstemc, & - pc13s%livestemc, pcs%livestemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livecrootc_to_deadcrootc, pcf%livecrootc_to_deadcrootc, & - pc13s%livecrootc, pcs%livecrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%leaf_curmr, pcf%leaf_curmr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%froot_curmr, pcf%froot_curmr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livestem_curmr, pcf%livestem_curmr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livecroot_curmr, pcf%livecroot_curmr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%leaf_xsmr, pcf%leaf_xsmr, & - pc13s%totvegc, pcs%totvegc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%froot_xsmr, pcf%froot_xsmr, & - pc13s%totvegc, pcs%totvegc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livestem_xsmr, pcf%livestem_xsmr, & - pc13s%totvegc, pcs%totvegc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livecroot_xsmr, pcf%livecroot_xsmr, & - pc13s%totvegc, pcs%totvegc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_xsmrpool, pcf%cpool_to_xsmrpool, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_leafc, pcf%cpool_to_leafc, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_leafc_storage, pcf%cpool_to_leafc_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_frootc, pcf%cpool_to_frootc, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_frootc_storage, pcf%cpool_to_frootc_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_livestemc, pcf%cpool_to_livestemc, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_livestemc_storage, pcf%cpool_to_livestemc_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_deadstemc, pcf%cpool_to_deadstemc, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_deadstemc_storage, pcf%cpool_to_deadstemc_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_livecrootc, pcf%cpool_to_livecrootc, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_livecrootc_storage, pcf%cpool_to_livecrootc_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_deadcrootc, pcf%cpool_to_deadcrootc, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_deadcrootc_storage, pcf%cpool_to_deadcrootc_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_leaf_gr, pcf%cpool_leaf_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_froot_gr, pcf%cpool_froot_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_livestem_gr, pcf%cpool_livestem_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_deadstem_gr, pcf%cpool_deadstem_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_livecroot_gr, pcf%cpool_livecroot_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_deadcroot_gr, pcf%cpool_deadcroot_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_leaf_storage_gr, pcf%cpool_leaf_storage_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_froot_storage_gr, pcf%cpool_froot_storage_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_livestem_storage_gr, pcf%cpool_livestem_storage_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_deadstem_storage_gr, pcf%cpool_deadstem_storage_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_livecroot_storage_gr, pcf%cpool_livecroot_storage_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_deadcroot_storage_gr, pcf%cpool_deadcroot_storage_gr, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%cpool_to_gresp_storage, pcf%cpool_to_gresp_storage, & - pc13s%cpool, pcs%cpool, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%transfer_leaf_gr, pcf%transfer_leaf_gr, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%transfer_froot_gr, pcf%transfer_froot_gr, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%transfer_livestem_gr, pcf%transfer_livestem_gr, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%transfer_deadstem_gr, pcf%transfer_deadstem_gr, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%transfer_livecroot_gr, pcf%transfer_livecroot_gr, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%transfer_deadcroot_gr, pcf%transfer_deadcroot_gr, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%leafc_storage_to_xfer, pcf%leafc_storage_to_xfer, & - pc13s%leafc_storage, pcs%leafc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%frootc_storage_to_xfer, pcf%frootc_storage_to_xfer, & - pc13s%frootc_storage, pcs%frootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livestemc_storage_to_xfer, pcf%livestemc_storage_to_xfer, & - pc13s%livestemc_storage, pcs%livestemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%deadstemc_storage_to_xfer, pcf%deadstemc_storage_to_xfer, & - pc13s%deadstemc_storage, pcs%deadstemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%livecrootc_storage_to_xfer, pcf%livecrootc_storage_to_xfer, & - pc13s%livecrootc_storage, pcs%livecrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%deadcrootc_storage_to_xfer, pcf%deadcrootc_storage_to_xfer, & - pc13s%deadcrootc_storage, pcs%deadcrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%gresp_storage_to_xfer, pcf%gresp_storage_to_xfer, & - pc13s%gresp_storage, pcs%gresp_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - ! call routine to shift pft-level litterfall fluxes to column, for isotopes - ! the non-isotope version of this routine is called in CNPhenologyMod.F90 - ! For later clean-up, it would be possible to generalize this function to operate on a single - ! pft-to-column flux. - - call CNC13LitterToColumn(num_soilc, filter_soilc) - - ! column-level non-mortality fluxes - - call C13FluxCalc(cc13f%cwdc_to_litr2c, ccf%cwdc_to_litr2c, & - cc13s%cwdc, ccs%cwdc, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%cwdc_to_litr3c, ccf%cwdc_to_litr3c, & - cc13s%cwdc, ccs%cwdc, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%litr1_hr, ccf%litr1_hr, & - cc13s%litr1c, ccs%litr1c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%litr1c_to_soil1c, ccf%litr1c_to_soil1c, & - cc13s%litr1c, ccs%litr1c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%litr2_hr, ccf%litr2_hr, & - cc13s%litr2c, ccs%litr2c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%litr2c_to_soil2c, ccf%litr2c_to_soil2c, & - cc13s%litr2c, ccs%litr2c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%litr3_hr, ccf%litr3_hr, & - cc13s%litr3c, ccs%litr3c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%litr3c_to_soil3c, ccf%litr3c_to_soil3c, & - cc13s%litr3c, ccs%litr3c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil1_hr, ccf%soil1_hr, & - cc13s%soil1c, ccs%soil1c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil1c_to_soil2c, ccf%soil1c_to_soil2c, & - cc13s%soil1c, ccs%soil1c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil2_hr, ccf%soil2_hr, & - cc13s%soil2c, ccs%soil2c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil2c_to_soil3c, ccf%soil2c_to_soil3c, & - cc13s%soil2c, ccs%soil2c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil3_hr, ccf%soil3_hr, & - cc13s%soil3c, ccs%soil3c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil3c_to_soil4c, ccf%soil3c_to_soil4c, & - cc13s%soil3c, ccs%soil3c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%soil4_hr, ccf%soil4_hr, & - cc13s%soil4c, ccs%soil4c, & - num_soilc, filter_soilc, 1._r8, 0) - - -! call C13FluxCalc(pc13f%fx, pcf%fx, & -! pc13s%sx, pcs%sx, & -! num_soilp, filter_soilp, 1._r8, 0) - -end subroutine C13Flux1 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13Flux2 -! -! !INTERFACE: -subroutine C13Flux2(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, set the 13-carbon fluxes for gap mortality -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! -! !LOCAL VARIABLES: -! !OTHER LOCAL VARIABLES: - type(pft_type), pointer :: p - type(column_type), pointer :: c - integer :: fp,pi -! -!EOP -!----------------------------------------------------------------------- - ! set local pointers - p => pft - c => col - - ! pft-level gap mortality fluxes - - call C13FluxCalc(pc13f%m_leafc_to_litter, pcf%m_leafc_to_litter, & - pc13s%leafc, pcs%leafc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_leafc_storage_to_litter, pcf%m_leafc_storage_to_litter, & - pc13s%leafc_storage, pcs%leafc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_leafc_xfer_to_litter, pcf%m_leafc_xfer_to_litter, & - pc13s%leafc_xfer, pcs%leafc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_frootc_to_litter, pcf%m_frootc_to_litter, & - pc13s%frootc, pcs%frootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_frootc_storage_to_litter, pcf%m_frootc_storage_to_litter, & - pc13s%frootc_storage, pcs%frootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_frootc_xfer_to_litter, pcf%m_frootc_xfer_to_litter, & - pc13s%frootc_xfer, pcs%frootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livestemc_to_litter, pcf%m_livestemc_to_litter, & - pc13s%livestemc, pcs%livestemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livestemc_storage_to_litter, pcf%m_livestemc_storage_to_litter, & - pc13s%livestemc_storage, pcs%livestemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livestemc_xfer_to_litter, pcf%m_livestemc_xfer_to_litter, & - pc13s%livestemc_xfer, pcs%livestemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_to_litter, pcf%m_deadstemc_to_litter, & - pc13s%deadstemc, pcs%deadstemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_storage_to_litter, pcf%m_deadstemc_storage_to_litter, & - pc13s%deadstemc_storage, pcs%deadstemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_xfer_to_litter, pcf%m_deadstemc_xfer_to_litter, & - pc13s%deadstemc_xfer, pcs%deadstemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livecrootc_to_litter, pcf%m_livecrootc_to_litter, & - pc13s%livecrootc, pcs%livecrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livecrootc_storage_to_litter, pcf%m_livecrootc_storage_to_litter, & - pc13s%livecrootc_storage, pcs%livecrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livecrootc_xfer_to_litter, pcf%m_livecrootc_xfer_to_litter, & - pc13s%livecrootc_xfer, pcs%livecrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_to_litter, pcf%m_deadcrootc_to_litter, & - pc13s%deadcrootc, pcs%deadcrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_storage_to_litter, pcf%m_deadcrootc_storage_to_litter, & - pc13s%deadcrootc_storage, pcs%deadcrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_xfer_to_litter, pcf%m_deadcrootc_xfer_to_litter, & - pc13s%deadcrootc_xfer, pcs%deadcrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_gresp_storage_to_litter, pcf%m_gresp_storage_to_litter, & - pc13s%gresp_storage, pcs%gresp_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_gresp_xfer_to_litter, pcf%m_gresp_xfer_to_litter, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - ! call routine to shift pft-level gap mortality fluxes to column, for isotopes - ! the non-isotope version of this routine is in CNGapMortalityMod.F90. - - call CNC13GapPftToColumn(num_soilc, filter_soilc) - -end subroutine C13Flux2 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13Flux2h -! -! !INTERFACE: -subroutine C13Flux2h(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! set the 13-carbon fluxes for harvest mortality -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! -! !LOCAL VARIABLES: -! !OTHER LOCAL VARIABLES: - type(pft_type), pointer :: p - type(column_type), pointer :: c - integer :: fp,pi -! -!EOP -!----------------------------------------------------------------------- - ! set local pointers - p => pft - c => col - - ! pft-level gap mortality fluxes - - call C13FluxCalc(pc13f%hrv_leafc_to_litter, pcf%hrv_leafc_to_litter, & - pc13s%leafc, pcs%leafc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_leafc_storage_to_litter, pcf%hrv_leafc_storage_to_litter, & - pc13s%leafc_storage, pcs%leafc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_leafc_xfer_to_litter, pcf%hrv_leafc_xfer_to_litter, & - pc13s%leafc_xfer, pcs%leafc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_frootc_to_litter, pcf%hrv_frootc_to_litter, & - pc13s%frootc, pcs%frootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_frootc_storage_to_litter, pcf%hrv_frootc_storage_to_litter, & - pc13s%frootc_storage, pcs%frootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_frootc_xfer_to_litter, pcf%hrv_frootc_xfer_to_litter, & - pc13s%frootc_xfer, pcs%frootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_livestemc_to_litter, pcf%hrv_livestemc_to_litter, & - pc13s%livestemc, pcs%livestemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_livestemc_storage_to_litter, pcf%hrv_livestemc_storage_to_litter, & - pc13s%livestemc_storage, pcs%livestemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_livestemc_xfer_to_litter, pcf%hrv_livestemc_xfer_to_litter, & - pc13s%livestemc_xfer, pcs%livestemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadstemc_to_prod10c, pcf%hrv_deadstemc_to_prod10c, & - pc13s%deadstemc, pcs%deadstemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadstemc_to_prod100c, pcf%hrv_deadstemc_to_prod100c, & - pc13s%deadstemc, pcs%deadstemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadstemc_storage_to_litter, pcf%hrv_deadstemc_storage_to_litter, & - pc13s%deadstemc_storage, pcs%deadstemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadstemc_xfer_to_litter, pcf%hrv_deadstemc_xfer_to_litter, & - pc13s%deadstemc_xfer, pcs%deadstemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_livecrootc_to_litter, pcf%hrv_livecrootc_to_litter, & - pc13s%livecrootc, pcs%livecrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_livecrootc_storage_to_litter, pcf%hrv_livecrootc_storage_to_litter, & - pc13s%livecrootc_storage, pcs%livecrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_livecrootc_xfer_to_litter, pcf%hrv_livecrootc_xfer_to_litter, & - pc13s%livecrootc_xfer, pcs%livecrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadcrootc_to_litter, pcf%hrv_deadcrootc_to_litter, & - pc13s%deadcrootc, pcs%deadcrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadcrootc_storage_to_litter, pcf%hrv_deadcrootc_storage_to_litter, & - pc13s%deadcrootc_storage, pcs%deadcrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_deadcrootc_xfer_to_litter, pcf%hrv_deadcrootc_xfer_to_litter, & - pc13s%deadcrootc_xfer, pcs%deadcrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_gresp_storage_to_litter, pcf%hrv_gresp_storage_to_litter, & - pc13s%gresp_storage, pcs%gresp_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_gresp_xfer_to_litter, pcf%hrv_gresp_xfer_to_litter, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%hrv_xsmrpool_to_atm, pcf%hrv_xsmrpool_to_atm, & - pc13s%totvegc, pcs%totvegc, & - num_soilp, filter_soilp, 1._r8, 0) - - ! call routine to shift pft-level gap mortality fluxes to column, for isotopes - ! the non-isotope version of this routine is in CNGapMortalityMod.F90. - - call CNC13HarvestPftToColumn(num_soilc, filter_soilc) - -end subroutine C13Flux2h -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13Flux3 -! -! !INTERFACE: -subroutine C13Flux3(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, set the 13-carbon fluxes for fire mortality -! -! !USES: - use clmtype - use pft2colMod, only: p2c -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! -! !LOCAL VARIABLES: -! !OTHER LOCAL VARIABLES: - type(pft_type), pointer :: p - type(column_type), pointer :: c - integer :: fp,pi - real(r8), pointer :: ptrp(:) ! pointer to input pft array - real(r8), pointer :: ptrc(:) ! pointer to output column array -! -!EOP -!----------------------------------------------------------------------- - ! set local pointers - p => pft - c => col - - ! pft-level fire mortality fluxes - - call C13FluxCalc(pc13f%m_leafc_to_fire, pcf%m_leafc_to_fire, & - pc13s%leafc, pcs%leafc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_leafc_storage_to_fire, pcf%m_leafc_storage_to_fire, & - pc13s%leafc_storage, pcs%leafc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_leafc_xfer_to_fire, pcf%m_leafc_xfer_to_fire, & - pc13s%leafc_xfer, pcs%leafc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_frootc_to_fire, pcf%m_frootc_to_fire, & - pc13s%frootc, pcs%frootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_frootc_storage_to_fire, pcf%m_frootc_storage_to_fire, & - pc13s%frootc_storage, pcs%frootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_frootc_xfer_to_fire, pcf%m_frootc_xfer_to_fire, & - pc13s%frootc_xfer, pcs%frootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livestemc_to_fire, pcf%m_livestemc_to_fire, & - pc13s%livestemc, pcs%livestemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livestemc_storage_to_fire, pcf%m_livestemc_storage_to_fire, & - pc13s%livestemc_storage, pcs%livestemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livestemc_xfer_to_fire, pcf%m_livestemc_xfer_to_fire, & - pc13s%livestemc_xfer, pcs%livestemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_to_fire, pcf%m_deadstemc_to_fire, & - pc13s%deadstemc, pcs%deadstemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_to_litter_fire, pcf%m_deadstemc_to_litter_fire, & - pc13s%deadstemc, pcs%deadstemc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_storage_to_fire, pcf%m_deadstemc_storage_to_fire, & - pc13s%deadstemc_storage, pcs%deadstemc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadstemc_xfer_to_fire, pcf%m_deadstemc_xfer_to_fire, & - pc13s%deadstemc_xfer, pcs%deadstemc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livecrootc_to_fire, pcf%m_livecrootc_to_fire, & - pc13s%livecrootc, pcs%livecrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livecrootc_storage_to_fire, pcf%m_livecrootc_storage_to_fire, & - pc13s%livecrootc_storage, pcs%livecrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_livecrootc_xfer_to_fire, pcf%m_livecrootc_xfer_to_fire, & - pc13s%livecrootc_xfer, pcs%livecrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_to_fire, pcf%m_deadcrootc_to_fire, & - pc13s%deadcrootc, pcs%deadcrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_to_litter_fire, pcf%m_deadcrootc_to_litter_fire, & - pc13s%deadcrootc, pcs%deadcrootc, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_storage_to_fire, pcf%m_deadcrootc_storage_to_fire, & - pc13s%deadcrootc_storage, pcs%deadcrootc_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_deadcrootc_xfer_to_fire, pcf%m_deadcrootc_xfer_to_fire, & - pc13s%deadcrootc_xfer, pcs%deadcrootc_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_gresp_storage_to_fire, pcf%m_gresp_storage_to_fire, & - pc13s%gresp_storage, pcs%gresp_storage, & - num_soilp, filter_soilp, 1._r8, 0) - - call C13FluxCalc(pc13f%m_gresp_xfer_to_fire, pcf%m_gresp_xfer_to_fire, & - pc13s%gresp_xfer, pcs%gresp_xfer, & - num_soilp, filter_soilp, 1._r8, 0) - - ! use routine p2c to calculate the column-level flux of deadstem and deadcrootc to - ! cwdc as the result of fire mortality. - call p2c(num_soilc, filter_soilc, pc13f%m_deadstemc_to_litter_fire, cc13f%m_deadstemc_to_cwdc_fire) - call p2c(num_soilc, filter_soilc, pc13f%m_deadcrootc_to_litter_fire, cc13f%m_deadcrootc_to_cwdc_fire) - - call C13FluxCalc(cc13f%m_litr1c_to_fire, ccf%m_litr1c_to_fire, & - cc13s%litr1c, ccs%litr1c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%m_litr2c_to_fire, ccf%m_litr2c_to_fire, & - cc13s%litr2c, ccs%litr2c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%m_litr3c_to_fire, ccf%m_litr3c_to_fire, & - cc13s%litr3c, ccs%litr3c, & - num_soilc, filter_soilc, 1._r8, 0) - - call C13FluxCalc(cc13f%m_cwdc_to_fire, ccf%m_cwdc_to_fire, & - cc13s%cwdc, ccs%cwdc, & - num_soilc, filter_soilc, 1._r8, 0) - -! call C13FluxCalc(pc13f%fx, pcf%fx, & -! pc13s%sx, pcs%sx, & -! num_soilc, filter_soilc, 1._r8, 0) - -end subroutine C13Flux3 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNC13LitterToColumn -! -! !INTERFACE: -subroutine CNC13LitterToColumn (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! called at the end of cn_phenology to gather all pft-level litterfall fluxes -! to the column level and assign them to the three litter pools -! -! !USES: - use clmtype - use clm_varpar, only : max_pft_per_col -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 9/8/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: wtcol(:) ! weight (relative to column) for this pft (0-1) - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: leafc_to_litter(:) - real(r8), pointer :: frootc_to_litter(:) - real(r8), pointer :: lf_flab(:) ! leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) ! leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) ! leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) ! fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) ! fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) ! fine root litter lignin fraction - integer , pointer :: npfts(:) ! number of pfts for each column - integer , pointer :: pfti(:) ! beginning pft index for each column -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: leafc_to_litr1c(:) - real(r8), pointer :: leafc_to_litr2c(:) - real(r8), pointer :: leafc_to_litr3c(:) - real(r8), pointer :: frootc_to_litr1c(:) - real(r8), pointer :: frootc_to_litr2c(:) - real(r8), pointer :: frootc_to_litr3c(:) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: fc,c,pi,p -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays (in) - ivt => pft%itype - wtcol => pft%wtcol - pwtgcell => pft%wtgcell - leafc_to_litter => pc13f%leafc_to_litter - frootc_to_litter => pc13f%frootc_to_litter - npfts => col%npfts - pfti => col%pfti - lf_flab => pftcon%lf_flab - lf_fcel => pftcon%lf_fcel - lf_flig => pftcon%lf_flig - fr_flab => pftcon%fr_flab - fr_fcel => pftcon%fr_fcel - fr_flig => pftcon%fr_flig - - ! assign local pointers to derived type arrays (out) - leafc_to_litr1c => cc13f%leafc_to_litr1c - leafc_to_litr2c => cc13f%leafc_to_litr2c - leafc_to_litr3c => cc13f%leafc_to_litr3c - frootc_to_litr1c => cc13f%frootc_to_litr1c - frootc_to_litr2c => cc13f%frootc_to_litr2c - frootc_to_litr3c => cc13f%frootc_to_litr3c - - do pi = 1,max_pft_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - - if ( pi <= npfts(c) ) then - p = pfti(c) + pi - 1 - if (pwtgcell(p)>0._r8) then - - ! leaf litter carbon fluxes - leafc_to_litr1c(c) = leafc_to_litr1c(c) + leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - leafc_to_litr2c(c) = leafc_to_litr2c(c) + leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - leafc_to_litr3c(c) = leafc_to_litr3c(c) + leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root litter carbon fluxes - frootc_to_litr1c(c) = frootc_to_litr1c(c) + frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - frootc_to_litr2c(c) = frootc_to_litr2c(c) + frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - frootc_to_litr3c(c) = frootc_to_litr3c(c) + frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - end if - end if - - end do - - end do - -end subroutine CNC13LitterToColumn -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNC13GapPftToColumn -! -! !INTERFACE: -subroutine CNC13GapPftToColumn (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! gather all pft-level gap mortality fluxes -! to the column level and assign them to the three litter pools (+ cwd pool) -! -! !USES: - use clmtype - use clm_varpar, only : max_pft_per_col, maxpatch_pft -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! soil column filter -! -! !CALLED FROM: -! subroutine CNphenology -! -! !REVISION HISTORY: -! 9/8/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: wtcol(:) ! pft weight relative to column (0-1) - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: lf_flab(:) ! leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) ! leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) ! leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) ! fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) ! fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) ! fine root litter lignin fraction - integer , pointer :: npfts(:) ! number of pfts for each column - integer , pointer :: pfti(:) ! beginning pft index for each column - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: m_leafc_to_litr1c(:) - real(r8), pointer :: m_leafc_to_litr2c(:) - real(r8), pointer :: m_leafc_to_litr3c(:) - real(r8), pointer :: m_frootc_to_litr1c(:) - real(r8), pointer :: m_frootc_to_litr2c(:) - real(r8), pointer :: m_frootc_to_litr3c(:) - real(r8), pointer :: m_livestemc_to_cwdc(:) - real(r8), pointer :: m_deadstemc_to_cwdc(:) - real(r8), pointer :: m_livecrootc_to_cwdc(:) - real(r8), pointer :: m_deadcrootc_to_cwdc(:) - real(r8), pointer :: m_leafc_storage_to_litr1c(:) - real(r8), pointer :: m_frootc_storage_to_litr1c(:) - real(r8), pointer :: m_livestemc_storage_to_litr1c(:) - real(r8), pointer :: m_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: m_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: m_gresp_storage_to_litr1c(:) - real(r8), pointer :: m_leafc_xfer_to_litr1c(:) - real(r8), pointer :: m_frootc_xfer_to_litr1c(:) - real(r8), pointer :: m_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: m_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_gresp_xfer_to_litr1c(:) -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: fc,c,pi,p ! indices -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers - lf_flab => pftcon%lf_flab - lf_fcel => pftcon%lf_fcel - lf_flig => pftcon%lf_flig - fr_flab => pftcon%fr_flab - fr_fcel => pftcon%fr_fcel - fr_flig => pftcon%fr_flig - - ! assign local pointers to column-level arrays - npfts => col%npfts - pfti => col%pfti - m_leafc_to_litr1c => cc13f%m_leafc_to_litr1c - m_leafc_to_litr2c => cc13f%m_leafc_to_litr2c - m_leafc_to_litr3c => cc13f%m_leafc_to_litr3c - m_frootc_to_litr1c => cc13f%m_frootc_to_litr1c - m_frootc_to_litr2c => cc13f%m_frootc_to_litr2c - m_frootc_to_litr3c => cc13f%m_frootc_to_litr3c - m_livestemc_to_cwdc => cc13f%m_livestemc_to_cwdc - m_deadstemc_to_cwdc => cc13f%m_deadstemc_to_cwdc - m_livecrootc_to_cwdc => cc13f%m_livecrootc_to_cwdc - m_deadcrootc_to_cwdc => cc13f%m_deadcrootc_to_cwdc - m_leafc_storage_to_litr1c => cc13f%m_leafc_storage_to_litr1c - m_frootc_storage_to_litr1c => cc13f%m_frootc_storage_to_litr1c - m_livestemc_storage_to_litr1c => cc13f%m_livestemc_storage_to_litr1c - m_deadstemc_storage_to_litr1c => cc13f%m_deadstemc_storage_to_litr1c - m_livecrootc_storage_to_litr1c => cc13f%m_livecrootc_storage_to_litr1c - m_deadcrootc_storage_to_litr1c => cc13f%m_deadcrootc_storage_to_litr1c - m_gresp_storage_to_litr1c => cc13f%m_gresp_storage_to_litr1c - m_leafc_xfer_to_litr1c => cc13f%m_leafc_xfer_to_litr1c - m_frootc_xfer_to_litr1c => cc13f%m_frootc_xfer_to_litr1c - m_livestemc_xfer_to_litr1c => cc13f%m_livestemc_xfer_to_litr1c - m_deadstemc_xfer_to_litr1c => cc13f%m_deadstemc_xfer_to_litr1c - m_livecrootc_xfer_to_litr1c => cc13f%m_livecrootc_xfer_to_litr1c - m_deadcrootc_xfer_to_litr1c => cc13f%m_deadcrootc_xfer_to_litr1c - m_gresp_xfer_to_litr1c => cc13f%m_gresp_xfer_to_litr1c - - ! assign local pointers to pft-level arrays - ivt => pft%itype - wtcol => pft%wtcol - pwtgcell => pft%wtgcell - m_leafc_to_litter => pc13f%m_leafc_to_litter - m_frootc_to_litter => pc13f%m_frootc_to_litter - m_livestemc_to_litter => pc13f%m_livestemc_to_litter - m_deadstemc_to_litter => pc13f%m_deadstemc_to_litter - m_livecrootc_to_litter => pc13f%m_livecrootc_to_litter - m_deadcrootc_to_litter => pc13f%m_deadcrootc_to_litter - m_leafc_storage_to_litter => pc13f%m_leafc_storage_to_litter - m_frootc_storage_to_litter => pc13f%m_frootc_storage_to_litter - m_livestemc_storage_to_litter => pc13f%m_livestemc_storage_to_litter - m_deadstemc_storage_to_litter => pc13f%m_deadstemc_storage_to_litter - m_livecrootc_storage_to_litter => pc13f%m_livecrootc_storage_to_litter - m_deadcrootc_storage_to_litter => pc13f%m_deadcrootc_storage_to_litter - m_gresp_storage_to_litter => pc13f%m_gresp_storage_to_litter - m_leafc_xfer_to_litter => pc13f%m_leafc_xfer_to_litter - m_frootc_xfer_to_litter => pc13f%m_frootc_xfer_to_litter - m_livestemc_xfer_to_litter => pc13f%m_livestemc_xfer_to_litter - m_deadstemc_xfer_to_litter => pc13f%m_deadstemc_xfer_to_litter - m_livecrootc_xfer_to_litter => pc13f%m_livecrootc_xfer_to_litter - m_deadcrootc_xfer_to_litter => pc13f%m_deadcrootc_xfer_to_litter - m_gresp_xfer_to_litter => pc13f%m_gresp_xfer_to_litter - - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - - if (pwtgcell(p)>0._r8) then - - ! leaf gap mortality carbon fluxes - m_leafc_to_litr1c(c) = m_leafc_to_litr1c(c) + & - m_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - m_leafc_to_litr2c(c) = m_leafc_to_litr2c(c) + & - m_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - m_leafc_to_litr3c(c) = m_leafc_to_litr3c(c) + & - m_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root gap mortality carbon fluxes - m_frootc_to_litr1c(c) = m_frootc_to_litr1c(c) + & - m_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - m_frootc_to_litr2c(c) = m_frootc_to_litr2c(c) + & - m_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - m_frootc_to_litr3c(c) = m_frootc_to_litr3c(c) + & - m_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! wood gap mortality carbon fluxes - m_livestemc_to_cwdc(c) = m_livestemc_to_cwdc(c) + & - m_livestemc_to_litter(p) * wtcol(p) - m_deadstemc_to_cwdc(c) = m_deadstemc_to_cwdc(c) + & - m_deadstemc_to_litter(p) * wtcol(p) - m_livecrootc_to_cwdc(c) = m_livecrootc_to_cwdc(c) + & - m_livecrootc_to_litter(p) * wtcol(p) - m_deadcrootc_to_cwdc(c) = m_deadcrootc_to_cwdc(c) + & - m_deadcrootc_to_litter(p) * wtcol(p) - - ! storage gap mortality carbon fluxes - m_leafc_storage_to_litr1c(c) = m_leafc_storage_to_litr1c(c) + & - m_leafc_storage_to_litter(p) * wtcol(p) - m_frootc_storage_to_litr1c(c) = m_frootc_storage_to_litr1c(c) + & - m_frootc_storage_to_litter(p) * wtcol(p) - m_livestemc_storage_to_litr1c(c) = m_livestemc_storage_to_litr1c(c) + & - m_livestemc_storage_to_litter(p) * wtcol(p) - m_deadstemc_storage_to_litr1c(c) = m_deadstemc_storage_to_litr1c(c) + & - m_deadstemc_storage_to_litter(p) * wtcol(p) - m_livecrootc_storage_to_litr1c(c) = m_livecrootc_storage_to_litr1c(c) + & - m_livecrootc_storage_to_litter(p) * wtcol(p) - m_deadcrootc_storage_to_litr1c(c) = m_deadcrootc_storage_to_litr1c(c) + & - m_deadcrootc_storage_to_litter(p) * wtcol(p) - m_gresp_storage_to_litr1c(c) = m_gresp_storage_to_litr1c(c) + & - m_gresp_storage_to_litter(p) * wtcol(p) - - ! transfer gap mortality carbon fluxes - m_leafc_xfer_to_litr1c(c) = m_leafc_xfer_to_litr1c(c) + & - m_leafc_xfer_to_litter(p) * wtcol(p) - m_frootc_xfer_to_litr1c(c) = m_frootc_xfer_to_litr1c(c) + & - m_frootc_xfer_to_litter(p) * wtcol(p) - m_livestemc_xfer_to_litr1c(c) = m_livestemc_xfer_to_litr1c(c) + & - m_livestemc_xfer_to_litter(p) * wtcol(p) - m_deadstemc_xfer_to_litr1c(c) = m_deadstemc_xfer_to_litr1c(c) + & - m_deadstemc_xfer_to_litter(p) * wtcol(p) - m_livecrootc_xfer_to_litr1c(c) = m_livecrootc_xfer_to_litr1c(c) + & - m_livecrootc_xfer_to_litter(p) * wtcol(p) - m_deadcrootc_xfer_to_litr1c(c) = m_deadcrootc_xfer_to_litr1c(c) + & - m_deadcrootc_xfer_to_litter(p) * wtcol(p) - m_gresp_xfer_to_litr1c(c) = m_gresp_xfer_to_litr1c(c) + & - m_gresp_xfer_to_litter(p) * wtcol(p) - - end if - end if - - end do - - end do - -end subroutine CNC13GapPftToColumn -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNC13HarvestPftToColumn -! -! !INTERFACE: -subroutine CNC13HarvestPftToColumn (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! gather all pft-level harvest mortality fluxes -! to the column level and assign them to the litter, cwd, and wood product pools -! -! !USES: - use clmtype - use clm_varpar, only : max_pft_per_col, maxpatch_pft -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! soil column filter -! -! !CALLED FROM: -! subroutine CNphenology -! -! !REVISION HISTORY: -! 9/8/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: wtcol(:) ! pft weight relative to column (0-1) - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: lf_flab(:) ! leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) ! leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) ! leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) ! fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) ! fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) ! fine root litter lignin fraction - integer , pointer :: npfts(:) ! number of pfts for each column - integer , pointer :: pfti(:) ! beginning pft index for each column - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: phrv_deadstemc_to_prod10c(:) - real(r8), pointer :: phrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: hrv_leafc_to_litr1c(:) - real(r8), pointer :: hrv_leafc_to_litr2c(:) - real(r8), pointer :: hrv_leafc_to_litr3c(:) - real(r8), pointer :: hrv_frootc_to_litr1c(:) - real(r8), pointer :: hrv_frootc_to_litr2c(:) - real(r8), pointer :: hrv_frootc_to_litr3c(:) - real(r8), pointer :: hrv_livestemc_to_cwdc(:) - real(r8), pointer :: chrv_deadstemc_to_prod10c(:) - real(r8), pointer :: chrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_livecrootc_to_cwdc(:) - real(r8), pointer :: hrv_deadcrootc_to_cwdc(:) - real(r8), pointer :: hrv_leafc_storage_to_litr1c(:) - real(r8), pointer :: hrv_frootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_gresp_storage_to_litr1c(:) - real(r8), pointer :: hrv_leafc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_frootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_gresp_xfer_to_litr1c(:) -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: fc,c,pi,p ! indices -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers - lf_flab => pftcon%lf_flab - lf_fcel => pftcon%lf_fcel - lf_flig => pftcon%lf_flig - fr_flab => pftcon%fr_flab - fr_fcel => pftcon%fr_fcel - fr_flig => pftcon%fr_flig - - ! assign local pointers to column-level arrays - npfts => col%npfts - pfti => col%pfti - hrv_leafc_to_litr1c => cc13f%hrv_leafc_to_litr1c - hrv_leafc_to_litr2c => cc13f%hrv_leafc_to_litr2c - hrv_leafc_to_litr3c => cc13f%hrv_leafc_to_litr3c - hrv_frootc_to_litr1c => cc13f%hrv_frootc_to_litr1c - hrv_frootc_to_litr2c => cc13f%hrv_frootc_to_litr2c - hrv_frootc_to_litr3c => cc13f%hrv_frootc_to_litr3c - hrv_livestemc_to_cwdc => cc13f%hrv_livestemc_to_cwdc - chrv_deadstemc_to_prod10c => cc13f%hrv_deadstemc_to_prod10c - chrv_deadstemc_to_prod100c => cc13f%hrv_deadstemc_to_prod100c - hrv_livecrootc_to_cwdc => cc13f%hrv_livecrootc_to_cwdc - hrv_deadcrootc_to_cwdc => cc13f%hrv_deadcrootc_to_cwdc - hrv_leafc_storage_to_litr1c => cc13f%hrv_leafc_storage_to_litr1c - hrv_frootc_storage_to_litr1c => cc13f%hrv_frootc_storage_to_litr1c - hrv_livestemc_storage_to_litr1c => cc13f%hrv_livestemc_storage_to_litr1c - hrv_deadstemc_storage_to_litr1c => cc13f%hrv_deadstemc_storage_to_litr1c - hrv_livecrootc_storage_to_litr1c => cc13f%hrv_livecrootc_storage_to_litr1c - hrv_deadcrootc_storage_to_litr1c => cc13f%hrv_deadcrootc_storage_to_litr1c - hrv_gresp_storage_to_litr1c => cc13f%hrv_gresp_storage_to_litr1c - hrv_leafc_xfer_to_litr1c => cc13f%hrv_leafc_xfer_to_litr1c - hrv_frootc_xfer_to_litr1c => cc13f%hrv_frootc_xfer_to_litr1c - hrv_livestemc_xfer_to_litr1c => cc13f%hrv_livestemc_xfer_to_litr1c - hrv_deadstemc_xfer_to_litr1c => cc13f%hrv_deadstemc_xfer_to_litr1c - hrv_livecrootc_xfer_to_litr1c => cc13f%hrv_livecrootc_xfer_to_litr1c - hrv_deadcrootc_xfer_to_litr1c => cc13f%hrv_deadcrootc_xfer_to_litr1c - hrv_gresp_xfer_to_litr1c => cc13f%hrv_gresp_xfer_to_litr1c - - ! assign local pointers to pft-level arrays - ivt => pft%itype - wtcol => pft%wtcol - pwtgcell => pft%wtgcell - hrv_leafc_to_litter => pc13f%hrv_leafc_to_litter - hrv_frootc_to_litter => pc13f%hrv_frootc_to_litter - hrv_livestemc_to_litter => pc13f%hrv_livestemc_to_litter - phrv_deadstemc_to_prod10c => pc13f%hrv_deadstemc_to_prod10c - phrv_deadstemc_to_prod100c => pc13f%hrv_deadstemc_to_prod100c - hrv_livecrootc_to_litter => pc13f%hrv_livecrootc_to_litter - hrv_deadcrootc_to_litter => pc13f%hrv_deadcrootc_to_litter - hrv_leafc_storage_to_litter => pc13f%hrv_leafc_storage_to_litter - hrv_frootc_storage_to_litter => pc13f%hrv_frootc_storage_to_litter - hrv_livestemc_storage_to_litter => pc13f%hrv_livestemc_storage_to_litter - hrv_deadstemc_storage_to_litter => pc13f%hrv_deadstemc_storage_to_litter - hrv_livecrootc_storage_to_litter => pc13f%hrv_livecrootc_storage_to_litter - hrv_deadcrootc_storage_to_litter => pc13f%hrv_deadcrootc_storage_to_litter - hrv_gresp_storage_to_litter => pc13f%hrv_gresp_storage_to_litter - hrv_leafc_xfer_to_litter => pc13f%hrv_leafc_xfer_to_litter - hrv_frootc_xfer_to_litter => pc13f%hrv_frootc_xfer_to_litter - hrv_livestemc_xfer_to_litter => pc13f%hrv_livestemc_xfer_to_litter - hrv_deadstemc_xfer_to_litter => pc13f%hrv_deadstemc_xfer_to_litter - hrv_livecrootc_xfer_to_litter => pc13f%hrv_livecrootc_xfer_to_litter - hrv_deadcrootc_xfer_to_litter => pc13f%hrv_deadcrootc_xfer_to_litter - hrv_gresp_xfer_to_litter => pc13f%hrv_gresp_xfer_to_litter - - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - - if (pwtgcell(p)>0._r8) then - - ! leaf harvest mortality carbon fluxes - hrv_leafc_to_litr1c(c) = hrv_leafc_to_litr1c(c) + & - hrv_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - hrv_leafc_to_litr2c(c) = hrv_leafc_to_litr2c(c) + & - hrv_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - hrv_leafc_to_litr3c(c) = hrv_leafc_to_litr3c(c) + & - hrv_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root harvest mortality carbon fluxes - hrv_frootc_to_litr1c(c) = hrv_frootc_to_litr1c(c) + & - hrv_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - hrv_frootc_to_litr2c(c) = hrv_frootc_to_litr2c(c) + & - hrv_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - hrv_frootc_to_litr3c(c) = hrv_frootc_to_litr3c(c) + & - hrv_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! wood harvest mortality carbon fluxes - hrv_livestemc_to_cwdc(c) = hrv_livestemc_to_cwdc(c) + & - hrv_livestemc_to_litter(p) * wtcol(p) - chrv_deadstemc_to_prod10c(c) = chrv_deadstemc_to_prod10c(c) + & - phrv_deadstemc_to_prod10c(p) * wtcol(p) - chrv_deadstemc_to_prod100c(c) = chrv_deadstemc_to_prod100c(c) + & - phrv_deadstemc_to_prod100c(p) * wtcol(p) - hrv_livecrootc_to_cwdc(c) = hrv_livecrootc_to_cwdc(c) + & - hrv_livecrootc_to_litter(p) * wtcol(p) - hrv_deadcrootc_to_cwdc(c) = hrv_deadcrootc_to_cwdc(c) + & - hrv_deadcrootc_to_litter(p) * wtcol(p) - - ! storage harvest mortality carbon fluxes - hrv_leafc_storage_to_litr1c(c) = hrv_leafc_storage_to_litr1c(c) + & - hrv_leafc_storage_to_litter(p) * wtcol(p) - hrv_frootc_storage_to_litr1c(c) = hrv_frootc_storage_to_litr1c(c) + & - hrv_frootc_storage_to_litter(p) * wtcol(p) - hrv_livestemc_storage_to_litr1c(c) = hrv_livestemc_storage_to_litr1c(c) + & - hrv_livestemc_storage_to_litter(p) * wtcol(p) - hrv_deadstemc_storage_to_litr1c(c) = hrv_deadstemc_storage_to_litr1c(c) + & - hrv_deadstemc_storage_to_litter(p) * wtcol(p) - hrv_livecrootc_storage_to_litr1c(c) = hrv_livecrootc_storage_to_litr1c(c) + & - hrv_livecrootc_storage_to_litter(p) * wtcol(p) - hrv_deadcrootc_storage_to_litr1c(c) = hrv_deadcrootc_storage_to_litr1c(c) + & - hrv_deadcrootc_storage_to_litter(p) * wtcol(p) - hrv_gresp_storage_to_litr1c(c) = hrv_gresp_storage_to_litr1c(c) + & - hrv_gresp_storage_to_litter(p) * wtcol(p) - - ! transfer harvest mortality carbon fluxes - hrv_leafc_xfer_to_litr1c(c) = hrv_leafc_xfer_to_litr1c(c) + & - hrv_leafc_xfer_to_litter(p) * wtcol(p) - hrv_frootc_xfer_to_litr1c(c) = hrv_frootc_xfer_to_litr1c(c) + & - hrv_frootc_xfer_to_litter(p) * wtcol(p) - hrv_livestemc_xfer_to_litr1c(c) = hrv_livestemc_xfer_to_litr1c(c) + & - hrv_livestemc_xfer_to_litter(p) * wtcol(p) - hrv_deadstemc_xfer_to_litr1c(c) = hrv_deadstemc_xfer_to_litr1c(c) + & - hrv_deadstemc_xfer_to_litter(p) * wtcol(p) - hrv_livecrootc_xfer_to_litr1c(c) = hrv_livecrootc_xfer_to_litr1c(c) + & - hrv_livecrootc_xfer_to_litter(p) * wtcol(p) - hrv_deadcrootc_xfer_to_litr1c(c) = hrv_deadcrootc_xfer_to_litr1c(c) + & - hrv_deadcrootc_xfer_to_litter(p) * wtcol(p) - hrv_gresp_xfer_to_litr1c(c) = hrv_gresp_xfer_to_litr1c(c) + & - hrv_gresp_xfer_to_litter(p) * wtcol(p) - - end if - end if - - end do - - end do - -end subroutine CNC13HarvestPftToColumn -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13FluxCalc -! -! !INTERFACE: -subroutine C13FluxCalc(c13_flux, ctot_flux, c13_state, ctot_state, & - num, filter, frax, diag) -! -! !DESCRIPTION: -! On the radiation time step, set the 13-carbon flux -! variables (except for gap-phase mortality and fire fluxes) -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: c13_flux(:) !OUTPUT 13C flux - real(r8), pointer :: ctot_flux(:) !INPUT totC flux - real(r8), pointer :: c13_state(:) !INPUT 13C state, upstream pool - real(r8), pointer :: ctot_state(:) !INPUT totC state, upstream pool - real(r8), intent(in):: frax !fractionation factor (1 = no fractionation) - integer, intent(in) :: num ! number of filter members - integer, intent(in) :: filter(:) ! filter indices - integer, intent(in) :: diag !0=no diagnostics, 1=print diagnostics -! -! !CALLED FROM: -! subroutine C13Flux1 -! -! !REVISION HISTORY: -! -! !OTHER LOCAL VARIABLES: - integer :: i,f ! indices - real(r8) :: temp -! - ! loop over the supplied filter - do f = 1,num - i = filter(f) - if (ctot_state(i) /= 0._r8) then - c13_flux(i) = ctot_flux(i) * (c13_state(i)/ctot_state(i)) * frax - else - c13_flux(i) = 0._r8 - end if - - if (diag == 1) then - ! put diagnostic print statements here for 13C flux calculations - end if - end do -end subroutine C13FluxCalc -!----------------------------------------------------------------------- - -end module CNC13FluxMod - diff --git a/src_clm40/biogeochem/CNC13StateUpdate1Mod.F90 b/src_clm40/biogeochem/CNC13StateUpdate1Mod.F90 deleted file mode 100644 index c63a1ef17c..0000000000 --- a/src_clm40/biogeochem/CNC13StateUpdate1Mod.F90 +++ /dev/null @@ -1,591 +0,0 @@ -module CNC13StateUpdate1Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: C13StateUpdate1Mod -! -! !DESCRIPTION: -! Module for carbon state variable update, non-mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! -! !PUBLIC MEMBER FUNCTIONS: - public:: C13StateUpdate1,C13StateUpdate0 -! -! !REVISION HISTORY: -! 4/21/2005: Created by Peter Thornton and Neil Suits - copied from -! CNCStateUpdate1 for C13 state variables. -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13StateUpdate0 -! -! !INTERFACE: -subroutine C13StateUpdate0(num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update cpool carbon state -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - use clm_varctl, only : use_c13 -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 7/1/05: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: psnshade_to_cpool(:) - real(r8), pointer :: psnsun_to_cpool(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - - if (.not. use_c13) then - RETURN - end if - - ! assign local pointers at the pft level - cpool => pc13s%cpool - psnshade_to_cpool => pc13f%psnshade_to_cpool - psnsun_to_cpool => pc13f%psnsun_to_cpool - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - ! gross photosynthesis fluxes - cpool(p) = cpool(p) + psnsun_to_cpool(p)*dt - cpool(p) = cpool(p) + psnshade_to_cpool(p)*dt - end do - -end subroutine C13StateUpdate0 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13StateUpdate1 -! -! !INTERFACE: -subroutine C13StateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables (except for gap-phase mortality and fire fluxes) -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! 12/5/03, Peter Thornton: Added livewood turnover fluxes -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays -! - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: cwdc_to_litr2c(:) - real(r8), pointer :: cwdc_to_litr3c(:) - real(r8), pointer :: frootc_to_litr1c(:) - real(r8), pointer :: frootc_to_litr2c(:) - real(r8), pointer :: frootc_to_litr3c(:) - real(r8), pointer :: leafc_to_litr1c(:) - real(r8), pointer :: leafc_to_litr2c(:) - real(r8), pointer :: leafc_to_litr3c(:) - real(r8), pointer :: litr1_hr(:) - real(r8), pointer :: litr1c_to_soil1c(:) - real(r8), pointer :: litr2_hr(:) - real(r8), pointer :: litr2c_to_soil2c(:) - real(r8), pointer :: litr3_hr(:) - real(r8), pointer :: litr3c_to_soil3c(:) - real(r8), pointer :: soil1_hr(:) - real(r8), pointer :: soil1c_to_soil2c(:) - real(r8), pointer :: soil2_hr(:) - real(r8), pointer :: soil2c_to_soil3c(:) - real(r8), pointer :: soil3_hr(:) - real(r8), pointer :: soil3c_to_soil4c(:) - real(r8), pointer :: soil4_hr(:) - real(r8), pointer :: col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: cpool_to_xsmrpool(:) - real(r8), pointer :: cpool_to_deadcrootc(:) - real(r8), pointer :: cpool_to_deadcrootc_storage(:) - real(r8), pointer :: cpool_to_deadstemc(:) - real(r8), pointer :: cpool_to_deadstemc_storage(:) - real(r8), pointer :: cpool_to_frootc(:) - real(r8), pointer :: cpool_to_frootc_storage(:) - real(r8), pointer :: cpool_to_gresp_storage(:) - real(r8), pointer :: cpool_to_leafc(:) - real(r8), pointer :: cpool_to_leafc_storage(:) - real(r8), pointer :: cpool_to_livecrootc(:) - real(r8), pointer :: cpool_to_livecrootc_storage(:) - real(r8), pointer :: cpool_to_livestemc(:) - real(r8), pointer :: cpool_to_livestemc_storage(:) - real(r8), pointer :: deadcrootc_storage_to_xfer(:) - real(r8), pointer :: deadstemc_storage_to_xfer(:) - real(r8), pointer :: frootc_storage_to_xfer(:) - real(r8), pointer :: frootc_to_litter(:) - real(r8), pointer :: gresp_storage_to_xfer(:) - real(r8), pointer :: leafc_storage_to_xfer(:) - real(r8), pointer :: leafc_to_litter(:) - real(r8), pointer :: livecrootc_storage_to_xfer(:) - real(r8), pointer :: livecrootc_to_deadcrootc(:) - real(r8), pointer :: livestemc_storage_to_xfer(:) - real(r8), pointer :: livestemc_to_deadstemc(:) - real(r8), pointer :: livestem_mr(:) - real(r8), pointer :: froot_mr(:) - real(r8), pointer :: leaf_mr(:) - real(r8), pointer :: livecroot_mr(:) - real(r8), pointer :: livestem_curmr(:) - real(r8), pointer :: froot_curmr(:) - real(r8), pointer :: leaf_curmr(:) - real(r8), pointer :: livecroot_curmr(:) - real(r8), pointer :: livestem_xsmr(:) - real(r8), pointer :: froot_xsmr(:) - real(r8), pointer :: leaf_xsmr(:) - real(r8), pointer :: livecroot_xsmr(:) - real(r8), pointer :: cpool_deadcroot_gr(:) - real(r8), pointer :: cpool_deadcroot_storage_gr(:) - real(r8), pointer :: cpool_deadstem_gr(:) - real(r8), pointer :: cpool_deadstem_storage_gr(:) - real(r8), pointer :: cpool_froot_gr(:) - real(r8), pointer :: cpool_froot_storage_gr(:) - real(r8), pointer :: cpool_leaf_gr(:) - real(r8), pointer :: cpool_leaf_storage_gr(:) - real(r8), pointer :: cpool_livecroot_gr(:) - real(r8), pointer :: cpool_livecroot_storage_gr(:) - real(r8), pointer :: cpool_livestem_gr(:) - real(r8), pointer :: cpool_livestem_storage_gr(:) - real(r8), pointer :: transfer_deadcroot_gr(:) - real(r8), pointer :: transfer_deadstem_gr(:) - real(r8), pointer :: transfer_froot_gr(:) - real(r8), pointer :: transfer_leaf_gr(:) - real(r8), pointer :: transfer_livecroot_gr(:) - real(r8), pointer :: transfer_livestem_gr(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool(:) ! (gC/m2) execss maint resp C pool - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - -! local pointers for dynamic landcover fluxes and states - real(r8), pointer :: dwt_seedc_to_leaf(:) - real(r8), pointer :: dwt_seedc_to_deadstem(:) - real(r8), pointer :: dwt_frootc_to_litr1c(:) - real(r8), pointer :: dwt_frootc_to_litr2c(:) - real(r8), pointer :: dwt_frootc_to_litr3c(:) - real(r8), pointer :: dwt_livecrootc_to_cwdc(:) - real(r8), pointer :: dwt_deadcrootc_to_cwdc(:) - real(r8), pointer :: seedc(:) -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers - woody => pftcon%woody - - ! assign local pointers at the column level - cwdc_to_litr2c => cc13f%cwdc_to_litr2c - cwdc_to_litr3c => cc13f%cwdc_to_litr3c - frootc_to_litr1c => cc13f%frootc_to_litr1c - frootc_to_litr2c => cc13f%frootc_to_litr2c - frootc_to_litr3c => cc13f%frootc_to_litr3c - leafc_to_litr1c => cc13f%leafc_to_litr1c - leafc_to_litr2c => cc13f%leafc_to_litr2c - leafc_to_litr3c => cc13f%leafc_to_litr3c - litr1_hr => cc13f%litr1_hr - litr1c_to_soil1c => cc13f%litr1c_to_soil1c - litr2_hr => cc13f%litr2_hr - litr2c_to_soil2c => cc13f%litr2c_to_soil2c - litr3_hr => cc13f%litr3_hr - litr3c_to_soil3c => cc13f%litr3c_to_soil3c - soil1_hr => cc13f%soil1_hr - soil1c_to_soil2c => cc13f%soil1c_to_soil2c - soil2_hr => cc13f%soil2_hr - soil2c_to_soil3c => cc13f%soil2c_to_soil3c - soil3_hr => cc13f%soil3_hr - soil3c_to_soil4c => cc13f%soil3c_to_soil4c - soil4_hr => cc13f%soil4_hr - col_ctrunc => cc13s%col_ctrunc - cwdc => cc13s%cwdc - litr1c => cc13s%litr1c - litr2c => cc13s%litr2c - litr3c => cc13s%litr3c - soil1c => cc13s%soil1c - soil2c => cc13s%soil2c - soil3c => cc13s%soil3c - soil4c => cc13s%soil4c - ! new pointers for dynamic landcover - dwt_seedc_to_leaf => cc13f%dwt_seedc_to_leaf - dwt_seedc_to_deadstem => cc13f%dwt_seedc_to_deadstem - dwt_frootc_to_litr1c => cc13f%dwt_frootc_to_litr1c - dwt_frootc_to_litr2c => cc13f%dwt_frootc_to_litr2c - dwt_frootc_to_litr3c => cc13f%dwt_frootc_to_litr3c - dwt_livecrootc_to_cwdc => cc13f%dwt_livecrootc_to_cwdc - dwt_deadcrootc_to_cwdc => cc13f%dwt_deadcrootc_to_cwdc - seedc => cc13s%seedc - - ! assign local pointers at the pft level - ivt => pft%itype - cpool_deadcroot_gr => pc13f%cpool_deadcroot_gr - cpool_deadcroot_storage_gr => pc13f%cpool_deadcroot_storage_gr - cpool_deadstem_gr => pc13f%cpool_deadstem_gr - cpool_deadstem_storage_gr => pc13f%cpool_deadstem_storage_gr - cpool_froot_gr => pc13f%cpool_froot_gr - cpool_froot_storage_gr => pc13f%cpool_froot_storage_gr - cpool_leaf_gr => pc13f%cpool_leaf_gr - cpool_leaf_storage_gr => pc13f%cpool_leaf_storage_gr - cpool_livecroot_gr => pc13f%cpool_livecroot_gr - cpool_livecroot_storage_gr => pc13f%cpool_livecroot_storage_gr - cpool_livestem_gr => pc13f%cpool_livestem_gr - cpool_livestem_storage_gr => pc13f%cpool_livestem_storage_gr - cpool_to_xsmrpool => pc13f%cpool_to_xsmrpool - cpool_to_deadcrootc => pc13f%cpool_to_deadcrootc - cpool_to_deadcrootc_storage => pc13f%cpool_to_deadcrootc_storage - cpool_to_deadstemc => pc13f%cpool_to_deadstemc - cpool_to_deadstemc_storage => pc13f%cpool_to_deadstemc_storage - cpool_to_frootc => pc13f%cpool_to_frootc - cpool_to_frootc_storage => pc13f%cpool_to_frootc_storage - cpool_to_gresp_storage => pc13f%cpool_to_gresp_storage - cpool_to_leafc => pc13f%cpool_to_leafc - cpool_to_leafc_storage => pc13f%cpool_to_leafc_storage - cpool_to_livecrootc => pc13f%cpool_to_livecrootc - cpool_to_livecrootc_storage => pc13f%cpool_to_livecrootc_storage - cpool_to_livestemc => pc13f%cpool_to_livestemc - cpool_to_livestemc_storage => pc13f%cpool_to_livestemc_storage - deadcrootc_storage_to_xfer => pc13f%deadcrootc_storage_to_xfer - deadcrootc_xfer_to_deadcrootc => pc13f%deadcrootc_xfer_to_deadcrootc - deadstemc_storage_to_xfer => pc13f%deadstemc_storage_to_xfer - deadstemc_xfer_to_deadstemc => pc13f%deadstemc_xfer_to_deadstemc - froot_mr => pc13f%froot_mr - froot_curmr => pc13f%froot_curmr - froot_xsmr => pc13f%froot_xsmr - frootc_storage_to_xfer => pc13f%frootc_storage_to_xfer - frootc_to_litter => pc13f%frootc_to_litter - frootc_xfer_to_frootc => pc13f%frootc_xfer_to_frootc - gresp_storage_to_xfer => pc13f%gresp_storage_to_xfer - leaf_mr => pc13f%leaf_mr - leaf_curmr => pc13f%leaf_curmr - leaf_xsmr => pc13f%leaf_xsmr - leafc_storage_to_xfer => pc13f%leafc_storage_to_xfer - leafc_to_litter => pc13f%leafc_to_litter - leafc_xfer_to_leafc => pc13f%leafc_xfer_to_leafc - livecroot_mr => pc13f%livecroot_mr - livecroot_curmr => pc13f%livecroot_curmr - livecroot_xsmr => pc13f%livecroot_xsmr - livecrootc_storage_to_xfer => pc13f%livecrootc_storage_to_xfer - livecrootc_to_deadcrootc => pc13f%livecrootc_to_deadcrootc - livecrootc_xfer_to_livecrootc => pc13f%livecrootc_xfer_to_livecrootc - livestem_mr => pc13f%livestem_mr - livestem_curmr => pc13f%livestem_curmr - livestem_xsmr => pc13f%livestem_xsmr - livestemc_storage_to_xfer => pc13f%livestemc_storage_to_xfer - livestemc_to_deadstemc => pc13f%livestemc_to_deadstemc - livestemc_xfer_to_livestemc => pc13f%livestemc_xfer_to_livestemc - transfer_deadcroot_gr => pc13f%transfer_deadcroot_gr - transfer_deadstem_gr => pc13f%transfer_deadstem_gr - transfer_froot_gr => pc13f%transfer_froot_gr - transfer_leaf_gr => pc13f%transfer_leaf_gr - transfer_livecroot_gr => pc13f%transfer_livecroot_gr - transfer_livestem_gr => pc13f%transfer_livestem_gr - cpool => pc13s%cpool - xsmrpool => pc13s%xsmrpool - deadcrootc => pc13s%deadcrootc - deadcrootc_storage => pc13s%deadcrootc_storage - deadcrootc_xfer => pc13s%deadcrootc_xfer - deadstemc => pc13s%deadstemc - deadstemc_storage => pc13s%deadstemc_storage - deadstemc_xfer => pc13s%deadstemc_xfer - frootc => pc13s%frootc - frootc_storage => pc13s%frootc_storage - frootc_xfer => pc13s%frootc_xfer - gresp_storage => pc13s%gresp_storage - gresp_xfer => pc13s%gresp_xfer - leafc => pc13s%leafc - leafc_storage => pc13s%leafc_storage - leafc_xfer => pc13s%leafc_xfer - livecrootc => pc13s%livecrootc - livecrootc_storage => pc13s%livecrootc_storage - livecrootc_xfer => pc13s%livecrootc_xfer - livestemc => pc13s%livestemc - livestemc_storage => pc13s%livestemc_storage - livestemc_xfer => pc13s%livestemc_xfer - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level fluxes - - ! plant to litter fluxes - ! leaf litter - litr1c(c) = litr1c(c) + leafc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + leafc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + leafc_to_litr3c(c)*dt - ! fine root litter - litr1c(c) = litr1c(c) + frootc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + frootc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + frootc_to_litr3c(c)*dt - - ! seeding fluxes, from dynamic landcover - seedc(c) = seedc(c) - dwt_seedc_to_leaf(c) * dt - seedc(c) = seedc(c) - dwt_seedc_to_deadstem(c) * dt - - ! fluxes into litter and CWD, from dynamic landcover - litr1c(c) = litr1c(c) + dwt_frootc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + dwt_frootc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + dwt_frootc_to_litr3c(c)*dt - cwdc(c) = cwdc(c) + dwt_livecrootc_to_cwdc(c)*dt - cwdc(c) = cwdc(c) + dwt_deadcrootc_to_cwdc(c)*dt - - ! litter and SOM HR fluxes - litr1c(c) = litr1c(c) - litr1_hr(c)*dt - litr2c(c) = litr2c(c) - litr2_hr(c)*dt - litr3c(c) = litr3c(c) - litr3_hr(c)*dt - soil1c(c) = soil1c(c) - soil1_hr(c)*dt - soil2c(c) = soil2c(c) - soil2_hr(c)*dt - soil3c(c) = soil3c(c) - soil3_hr(c)*dt - soil4c(c) = soil4c(c) - soil4_hr(c)*dt - - ! CWD to litter fluxes - cwdc(c) = cwdc(c) - cwdc_to_litr2c(c)*dt - litr2c(c) = litr2c(c) + cwdc_to_litr2c(c)*dt - cwdc(c) = cwdc(c) - cwdc_to_litr3c(c)*dt - litr3c(c) = litr3c(c) + cwdc_to_litr3c(c)*dt - - ! litter to SOM fluxes - litr1c(c) = litr1c(c) - litr1c_to_soil1c(c)*dt - soil1c(c) = soil1c(c) + litr1c_to_soil1c(c)*dt - litr2c(c) = litr2c(c) - litr2c_to_soil2c(c)*dt - soil2c(c) = soil2c(c) + litr2c_to_soil2c(c)*dt - litr3c(c) = litr3c(c) - litr3c_to_soil3c(c)*dt - soil3c(c) = soil3c(c) + litr3c_to_soil3c(c)*dt - - ! SOM to SOM fluxes - soil1c(c) = soil1c(c) - soil1c_to_soil2c(c)*dt - soil2c(c) = soil2c(c) + soil1c_to_soil2c(c)*dt - soil2c(c) = soil2c(c) - soil2c_to_soil3c(c)*dt - soil3c(c) = soil3c(c) + soil2c_to_soil3c(c)*dt - soil3c(c) = soil3c(c) - soil3c_to_soil4c(c)*dt - soil4c(c) = soil4c(c) + soil3c_to_soil4c(c)*dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! phenology: transfer growth fluxes - leafc(p) = leafc(p) + leafc_xfer_to_leafc(p)*dt - leafc_xfer(p) = leafc_xfer(p) - leafc_xfer_to_leafc(p)*dt - frootc(p) = frootc(p) + frootc_xfer_to_frootc(p)*dt - frootc_xfer(p) = frootc_xfer(p) - frootc_xfer_to_frootc(p)*dt - if (woody(ivt(p)) == 1._r8) then - livestemc(p) = livestemc(p) + livestemc_xfer_to_livestemc(p)*dt - livestemc_xfer(p) = livestemc_xfer(p) - livestemc_xfer_to_livestemc(p)*dt - deadstemc(p) = deadstemc(p) + deadstemc_xfer_to_deadstemc(p)*dt - deadstemc_xfer(p) = deadstemc_xfer(p) - deadstemc_xfer_to_deadstemc(p)*dt - livecrootc(p) = livecrootc(p) + livecrootc_xfer_to_livecrootc(p)*dt - livecrootc_xfer(p) = livecrootc_xfer(p) - livecrootc_xfer_to_livecrootc(p)*dt - deadcrootc(p) = deadcrootc(p) + deadcrootc_xfer_to_deadcrootc(p)*dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p)*dt - end if - - ! phenology: litterfall fluxes - leafc(p) = leafc(p) - leafc_to_litter(p)*dt - frootc(p) = frootc(p) - frootc_to_litter(p)*dt - - ! livewood turnover fluxes - if (woody(ivt(p)) == 1._r8) then - livestemc(p) = livestemc(p) - livestemc_to_deadstemc(p)*dt - deadstemc(p) = deadstemc(p) + livestemc_to_deadstemc(p)*dt - livecrootc(p) = livecrootc(p) - livecrootc_to_deadcrootc(p)*dt - deadcrootc(p) = deadcrootc(p) + livecrootc_to_deadcrootc(p)*dt - end if - - ! maintenance respiration fluxes - cpool(p) = cpool(p) - cpool_to_xsmrpool(p)*dt - cpool(p) = cpool(p) - leaf_curmr(p)*dt - cpool(p) = cpool(p) - froot_curmr(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - livestem_curmr(p)*dt - cpool(p) = cpool(p) - livecroot_curmr(p)*dt - end if - - ! maintenance respiration fluxes - xsmrpool(p) = xsmrpool(p) + cpool_to_xsmrpool(p)*dt - xsmrpool(p) = xsmrpool(p) - leaf_xsmr(p)*dt - xsmrpool(p) = xsmrpool(p) - froot_xsmr(p)*dt - if (woody(ivt(p)) == 1._r8) then - xsmrpool(p) = xsmrpool(p) - livestem_xsmr(p)*dt - xsmrpool(p) = xsmrpool(p) - livecroot_xsmr(p)*dt - end if - - ! allocation fluxes - cpool(p) = cpool(p) - cpool_to_leafc(p)*dt - leafc(p) = leafc(p) + cpool_to_leafc(p)*dt - cpool(p) = cpool(p) - cpool_to_leafc_storage(p)*dt - leafc_storage(p) = leafc_storage(p) + cpool_to_leafc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_frootc(p)*dt - frootc(p) = frootc(p) + cpool_to_frootc(p)*dt - cpool(p) = cpool(p) - cpool_to_frootc_storage(p)*dt - frootc_storage(p) = frootc_storage(p) + cpool_to_frootc_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - cpool_to_livestemc(p)*dt - livestemc(p) = livestemc(p) + cpool_to_livestemc(p)*dt - cpool(p) = cpool(p) - cpool_to_livestemc_storage(p)*dt - livestemc_storage(p) = livestemc_storage(p) + cpool_to_livestemc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_deadstemc(p)*dt - deadstemc(p) = deadstemc(p) + cpool_to_deadstemc(p)*dt - cpool(p) = cpool(p) - cpool_to_deadstemc_storage(p)*dt - deadstemc_storage(p) = deadstemc_storage(p) + cpool_to_deadstemc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_livecrootc(p)*dt - livecrootc(p) = livecrootc(p) + cpool_to_livecrootc(p)*dt - cpool(p) = cpool(p) - cpool_to_livecrootc_storage(p)*dt - livecrootc_storage(p) = livecrootc_storage(p) + cpool_to_livecrootc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_deadcrootc(p)*dt - deadcrootc(p) = deadcrootc(p) + cpool_to_deadcrootc(p)*dt - cpool(p) = cpool(p) - cpool_to_deadcrootc_storage(p)*dt - deadcrootc_storage(p) = deadcrootc_storage(p) + cpool_to_deadcrootc_storage(p)*dt - end if - - ! growth respiration fluxes for current growth - cpool(p) = cpool(p) - cpool_leaf_gr(p)*dt - cpool(p) = cpool(p) - cpool_froot_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - cpool_livestem_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadstem_gr(p)*dt - cpool(p) = cpool(p) - cpool_livecroot_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadcroot_gr(p)*dt - end if - - ! growth respiration for transfer growth - gresp_xfer(p) = gresp_xfer(p) - transfer_leaf_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_froot_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then - gresp_xfer(p) = gresp_xfer(p) - transfer_livestem_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_deadstem_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_livecroot_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_deadcroot_gr(p)*dt - end if - - ! growth respiration at time of storage - cpool(p) = cpool(p) - cpool_leaf_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_froot_storage_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - cpool_livestem_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadstem_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_livecroot_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadcroot_storage_gr(p)*dt - end if - - ! growth respiration stored for release during transfer growth - cpool(p) = cpool(p) - cpool_to_gresp_storage(p)*dt - gresp_storage(p) = gresp_storage(p) + cpool_to_gresp_storage(p)*dt - - ! move storage pools into transfer pools - leafc_storage(p) = leafc_storage(p) - leafc_storage_to_xfer(p)*dt - leafc_xfer(p) = leafc_xfer(p) + leafc_storage_to_xfer(p)*dt - frootc_storage(p) = frootc_storage(p) - frootc_storage_to_xfer(p)*dt - frootc_xfer(p) = frootc_xfer(p) + frootc_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then - livestemc_storage(p) = livestemc_storage(p) - livestemc_storage_to_xfer(p)*dt - livestemc_xfer(p) = livestemc_xfer(p) + livestemc_storage_to_xfer(p)*dt - deadstemc_storage(p) = deadstemc_storage(p) - deadstemc_storage_to_xfer(p)*dt - deadstemc_xfer(p) = deadstemc_xfer(p) + deadstemc_storage_to_xfer(p)*dt - livecrootc_storage(p) = livecrootc_storage(p) - livecrootc_storage_to_xfer(p)*dt - livecrootc_xfer(p) = livecrootc_xfer(p) + livecrootc_storage_to_xfer(p)*dt - deadcrootc_storage(p) = deadcrootc_storage(p) - deadcrootc_storage_to_xfer(p)*dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) + deadcrootc_storage_to_xfer(p)*dt - gresp_storage(p) = gresp_storage(p) - gresp_storage_to_xfer(p)*dt - gresp_xfer(p) = gresp_xfer(p) + gresp_storage_to_xfer(p)*dt - end if - - end do ! end of pft loop - -end subroutine C13StateUpdate1 -!----------------------------------------------------------------------- - -end module CNC13StateUpdate1Mod diff --git a/src_clm40/biogeochem/CNC13StateUpdate2Mod.F90 b/src_clm40/biogeochem/CNC13StateUpdate2Mod.F90 deleted file mode 100644 index 0ded060270..0000000000 --- a/src_clm40/biogeochem/CNC13StateUpdate2Mod.F90 +++ /dev/null @@ -1,576 +0,0 @@ -module CNC13StateUpdate2Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: C13StateUpdate2Mod -! -! !DESCRIPTION: -! Module for carbon state variable update, mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: C13StateUpdate2 - public:: C13StateUpdate2h -! -! !REVISION HISTORY: -! 4/21/2005: Created by Peter Thornton and Neil Suits - copied from -! CNCStateUpdate2 for C13 state variables. -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13StateUpdate2 -! -! !INTERFACE: -subroutine C13StateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables affected by gap-phase mortality fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - use clm_varctl, only : use_c13 -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: m_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_to_cwdc(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: m_deadstemc_to_cwdc(:) - real(r8), pointer :: m_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: m_frootc_storage_to_litr1c(:) - real(r8), pointer :: m_frootc_to_litr1c(:) - real(r8), pointer :: m_frootc_to_litr2c(:) - real(r8), pointer :: m_frootc_to_litr3c(:) - real(r8), pointer :: m_frootc_xfer_to_litr1c(:) - real(r8), pointer :: m_gresp_storage_to_litr1c(:) - real(r8), pointer :: m_gresp_xfer_to_litr1c(:) - real(r8), pointer :: m_leafc_storage_to_litr1c(:) - real(r8), pointer :: m_leafc_to_litr1c(:) - real(r8), pointer :: m_leafc_to_litr2c(:) - real(r8), pointer :: m_leafc_to_litr3c(:) - real(r8), pointer :: m_leafc_xfer_to_litr1c(:) - real(r8), pointer :: m_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: m_livecrootc_to_cwdc(:) - real(r8), pointer :: m_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_livestemc_storage_to_litr1c(:) - real(r8), pointer :: m_livestemc_to_cwdc(:) - real(r8), pointer :: m_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) !(gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) !(gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer -! -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - - if (.not. use_c13) then - RETURN - end if - - ! assign local pointers at the column level - m_deadcrootc_storage_to_litr1c => cc13f%m_deadcrootc_storage_to_litr1c - m_deadcrootc_to_cwdc => cc13f%m_deadcrootc_to_cwdc - m_deadcrootc_xfer_to_litr1c => cc13f%m_deadcrootc_xfer_to_litr1c - m_deadstemc_storage_to_litr1c => cc13f%m_deadstemc_storage_to_litr1c - m_deadstemc_to_cwdc => cc13f%m_deadstemc_to_cwdc - m_deadstemc_xfer_to_litr1c => cc13f%m_deadstemc_xfer_to_litr1c - m_frootc_storage_to_litr1c => cc13f%m_frootc_storage_to_litr1c - m_frootc_to_litr1c => cc13f%m_frootc_to_litr1c - m_frootc_to_litr2c => cc13f%m_frootc_to_litr2c - m_frootc_to_litr3c => cc13f%m_frootc_to_litr3c - m_frootc_xfer_to_litr1c => cc13f%m_frootc_xfer_to_litr1c - m_gresp_storage_to_litr1c => cc13f%m_gresp_storage_to_litr1c - m_gresp_xfer_to_litr1c => cc13f%m_gresp_xfer_to_litr1c - m_leafc_storage_to_litr1c => cc13f%m_leafc_storage_to_litr1c - m_leafc_to_litr1c => cc13f%m_leafc_to_litr1c - m_leafc_to_litr2c => cc13f%m_leafc_to_litr2c - m_leafc_to_litr3c => cc13f%m_leafc_to_litr3c - m_leafc_xfer_to_litr1c => cc13f%m_leafc_xfer_to_litr1c - m_livecrootc_storage_to_litr1c => cc13f%m_livecrootc_storage_to_litr1c - m_livecrootc_to_cwdc => cc13f%m_livecrootc_to_cwdc - m_livecrootc_xfer_to_litr1c => cc13f%m_livecrootc_xfer_to_litr1c - m_livestemc_storage_to_litr1c => cc13f%m_livestemc_storage_to_litr1c - m_livestemc_to_cwdc => cc13f%m_livestemc_to_cwdc - m_livestemc_xfer_to_litr1c => cc13f%m_livestemc_xfer_to_litr1c - cwdc => cc13s%cwdc - litr1c => cc13s%litr1c - litr2c => cc13s%litr2c - litr3c => cc13s%litr3c - - ! assign local pointers at the pft level - m_deadcrootc_storage_to_litter => pc13f%m_deadcrootc_storage_to_litter - m_deadcrootc_to_litter => pc13f%m_deadcrootc_to_litter - m_deadcrootc_xfer_to_litter => pc13f%m_deadcrootc_xfer_to_litter - m_deadstemc_storage_to_litter => pc13f%m_deadstemc_storage_to_litter - m_deadstemc_to_litter => pc13f%m_deadstemc_to_litter - m_deadstemc_xfer_to_litter => pc13f%m_deadstemc_xfer_to_litter - m_frootc_storage_to_litter => pc13f%m_frootc_storage_to_litter - m_frootc_to_litter => pc13f%m_frootc_to_litter - m_frootc_xfer_to_litter => pc13f%m_frootc_xfer_to_litter - m_gresp_storage_to_litter => pc13f%m_gresp_storage_to_litter - m_gresp_xfer_to_litter => pc13f%m_gresp_xfer_to_litter - m_leafc_storage_to_litter => pc13f%m_leafc_storage_to_litter - m_leafc_to_litter => pc13f%m_leafc_to_litter - m_leafc_xfer_to_litter => pc13f%m_leafc_xfer_to_litter - m_livecrootc_storage_to_litter => pc13f%m_livecrootc_storage_to_litter - m_livecrootc_to_litter => pc13f%m_livecrootc_to_litter - m_livecrootc_xfer_to_litter => pc13f%m_livecrootc_xfer_to_litter - m_livestemc_storage_to_litter => pc13f%m_livestemc_storage_to_litter - m_livestemc_to_litter => pc13f%m_livestemc_to_litter - m_livestemc_xfer_to_litter => pc13f%m_livestemc_xfer_to_litter - deadcrootc => pc13s%deadcrootc - deadcrootc_storage => pc13s%deadcrootc_storage - deadcrootc_xfer => pc13s%deadcrootc_xfer - deadstemc => pc13s%deadstemc - deadstemc_storage => pc13s%deadstemc_storage - deadstemc_xfer => pc13s%deadstemc_xfer - frootc => pc13s%frootc - frootc_storage => pc13s%frootc_storage - frootc_xfer => pc13s%frootc_xfer - gresp_storage => pc13s%gresp_storage - gresp_xfer => pc13s%gresp_xfer - leafc => pc13s%leafc - leafc_storage => pc13s%leafc_storage - leafc_xfer => pc13s%leafc_xfer - livecrootc => pc13s%livecrootc - livecrootc_storage => pc13s%livecrootc_storage - livecrootc_xfer => pc13s%livecrootc_xfer - livestemc => pc13s%livestemc - livestemc_storage => pc13s%livestemc_storage - livestemc_xfer => pc13s%livestemc_xfer - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level carbon fluxes from gap-phase mortality - - ! leaf to litter - litr1c(c) = litr1c(c) + m_leafc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + m_leafc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + m_leafc_to_litr3c(c) * dt - - ! fine root to litter - litr1c(c) = litr1c(c) + m_frootc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + m_frootc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + m_frootc_to_litr3c(c) * dt - - ! wood to CWD - cwdc(c) = cwdc(c) + m_livestemc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + m_deadstemc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + m_livecrootc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + m_deadcrootc_to_cwdc(c) * dt - - ! storage pools to litter - litr1c(c) = litr1c(c) + m_leafc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_frootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livestemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadstemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livecrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadcrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_gresp_storage_to_litr1c(c) * dt - - ! transfer pools to litter - litr1c(c) = litr1c(c) + m_leafc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_frootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livestemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadstemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livecrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadcrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_gresp_xfer_to_litr1c(c) * dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level carbon fluxes from gap-phase mortality - ! displayed pools - leafc(p) = leafc(p) - m_leafc_to_litter(p) * dt - frootc(p) = frootc(p) - m_frootc_to_litter(p) * dt - livestemc(p) = livestemc(p) - m_livestemc_to_litter(p) * dt - deadstemc(p) = deadstemc(p) - m_deadstemc_to_litter(p) * dt - livecrootc(p) = livecrootc(p) - m_livecrootc_to_litter(p) * dt - deadcrootc(p) = deadcrootc(p) - m_deadcrootc_to_litter(p) * dt - - ! storage pools - leafc_storage(p) = leafc_storage(p) - m_leafc_storage_to_litter(p) * dt - frootc_storage(p) = frootc_storage(p) - m_frootc_storage_to_litter(p) * dt - livestemc_storage(p) = livestemc_storage(p) - m_livestemc_storage_to_litter(p) * dt - deadstemc_storage(p) = deadstemc_storage(p) - m_deadstemc_storage_to_litter(p) * dt - livecrootc_storage(p) = livecrootc_storage(p) - m_livecrootc_storage_to_litter(p) * dt - deadcrootc_storage(p) = deadcrootc_storage(p) - m_deadcrootc_storage_to_litter(p) * dt - gresp_storage(p) = gresp_storage(p) - m_gresp_storage_to_litter(p) * dt - - ! transfer pools - leafc_xfer(p) = leafc_xfer(p) - m_leafc_xfer_to_litter(p) * dt - frootc_xfer(p) = frootc_xfer(p) - m_frootc_xfer_to_litter(p) * dt - livestemc_xfer(p) = livestemc_xfer(p) - m_livestemc_xfer_to_litter(p) * dt - deadstemc_xfer(p) = deadstemc_xfer(p) - m_deadstemc_xfer_to_litter(p) * dt - livecrootc_xfer(p) = livecrootc_xfer(p) - m_livecrootc_xfer_to_litter(p) * dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - m_deadcrootc_xfer_to_litter(p) * dt - gresp_xfer(p) = gresp_xfer(p) - m_gresp_xfer_to_litter(p) * dt - - end do ! end of pft loop - -end subroutine C13StateUpdate2 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13StateUpdate2h -! -! !INTERFACE: -subroutine C13StateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Update all the prognostic carbon state -! variables affected by harvest mortality fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 5/20/09: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: hrv_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_to_cwdc(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_frootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_frootc_to_litr1c(:) - real(r8), pointer :: hrv_frootc_to_litr2c(:) - real(r8), pointer :: hrv_frootc_to_litr3c(:) - real(r8), pointer :: hrv_frootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_gresp_storage_to_litr1c(:) - real(r8), pointer :: hrv_gresp_xfer_to_litr1c(:) - real(r8), pointer :: hrv_leafc_storage_to_litr1c(:) - real(r8), pointer :: hrv_leafc_to_litr1c(:) - real(r8), pointer :: hrv_leafc_to_litr2c(:) - real(r8), pointer :: hrv_leafc_to_litr3c(:) - real(r8), pointer :: hrv_leafc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_to_cwdc(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_to_cwdc(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_xsmrpool_to_atm(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: xsmrpool(:) ! (gC/m2) abstract C pool to meet excess MR demand -! -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - hrv_deadcrootc_storage_to_litr1c => cc13f%hrv_deadcrootc_storage_to_litr1c - hrv_deadcrootc_to_cwdc => cc13f%hrv_deadcrootc_to_cwdc - hrv_deadcrootc_xfer_to_litr1c => cc13f%hrv_deadcrootc_xfer_to_litr1c - hrv_deadstemc_storage_to_litr1c => cc13f%hrv_deadstemc_storage_to_litr1c - hrv_deadstemc_xfer_to_litr1c => cc13f%hrv_deadstemc_xfer_to_litr1c - hrv_frootc_storage_to_litr1c => cc13f%hrv_frootc_storage_to_litr1c - hrv_frootc_to_litr1c => cc13f%hrv_frootc_to_litr1c - hrv_frootc_to_litr2c => cc13f%hrv_frootc_to_litr2c - hrv_frootc_to_litr3c => cc13f%hrv_frootc_to_litr3c - hrv_frootc_xfer_to_litr1c => cc13f%hrv_frootc_xfer_to_litr1c - hrv_gresp_storage_to_litr1c => cc13f%hrv_gresp_storage_to_litr1c - hrv_gresp_xfer_to_litr1c => cc13f%hrv_gresp_xfer_to_litr1c - hrv_leafc_storage_to_litr1c => cc13f%hrv_leafc_storage_to_litr1c - hrv_leafc_to_litr1c => cc13f%hrv_leafc_to_litr1c - hrv_leafc_to_litr2c => cc13f%hrv_leafc_to_litr2c - hrv_leafc_to_litr3c => cc13f%hrv_leafc_to_litr3c - hrv_leafc_xfer_to_litr1c => cc13f%hrv_leafc_xfer_to_litr1c - hrv_livecrootc_storage_to_litr1c => cc13f%hrv_livecrootc_storage_to_litr1c - hrv_livecrootc_to_cwdc => cc13f%hrv_livecrootc_to_cwdc - hrv_livecrootc_xfer_to_litr1c => cc13f%hrv_livecrootc_xfer_to_litr1c - hrv_livestemc_storage_to_litr1c => cc13f%hrv_livestemc_storage_to_litr1c - hrv_livestemc_to_cwdc => cc13f%hrv_livestemc_to_cwdc - hrv_livestemc_xfer_to_litr1c => cc13f%hrv_livestemc_xfer_to_litr1c - cwdc => cc13s%cwdc - litr1c => cc13s%litr1c - litr2c => cc13s%litr2c - litr3c => cc13s%litr3c - - ! assign local pointers at the pft level - hrv_deadcrootc_storage_to_litter => pc13f%hrv_deadcrootc_storage_to_litter - hrv_deadcrootc_to_litter => pc13f%hrv_deadcrootc_to_litter - hrv_deadcrootc_xfer_to_litter => pc13f%hrv_deadcrootc_xfer_to_litter - hrv_deadstemc_storage_to_litter => pc13f%hrv_deadstemc_storage_to_litter - hrv_deadstemc_to_prod10c => pc13f%hrv_deadstemc_to_prod10c - hrv_deadstemc_to_prod100c => pc13f%hrv_deadstemc_to_prod100c - hrv_deadstemc_xfer_to_litter => pc13f%hrv_deadstemc_xfer_to_litter - hrv_frootc_storage_to_litter => pc13f%hrv_frootc_storage_to_litter - hrv_frootc_to_litter => pc13f%hrv_frootc_to_litter - hrv_frootc_xfer_to_litter => pc13f%hrv_frootc_xfer_to_litter - hrv_gresp_storage_to_litter => pc13f%hrv_gresp_storage_to_litter - hrv_gresp_xfer_to_litter => pc13f%hrv_gresp_xfer_to_litter - hrv_leafc_storage_to_litter => pc13f%hrv_leafc_storage_to_litter - hrv_leafc_to_litter => pc13f%hrv_leafc_to_litter - hrv_leafc_xfer_to_litter => pc13f%hrv_leafc_xfer_to_litter - hrv_livecrootc_storage_to_litter => pc13f%hrv_livecrootc_storage_to_litter - hrv_livecrootc_to_litter => pc13f%hrv_livecrootc_to_litter - hrv_livecrootc_xfer_to_litter => pc13f%hrv_livecrootc_xfer_to_litter - hrv_livestemc_storage_to_litter => pc13f%hrv_livestemc_storage_to_litter - hrv_livestemc_to_litter => pc13f%hrv_livestemc_to_litter - hrv_livestemc_xfer_to_litter => pc13f%hrv_livestemc_xfer_to_litter - hrv_xsmrpool_to_atm => pc13f%hrv_xsmrpool_to_atm - deadcrootc => pc13s%deadcrootc - deadcrootc_storage => pc13s%deadcrootc_storage - deadcrootc_xfer => pc13s%deadcrootc_xfer - deadstemc => pc13s%deadstemc - deadstemc_storage => pc13s%deadstemc_storage - deadstemc_xfer => pc13s%deadstemc_xfer - frootc => pc13s%frootc - frootc_storage => pc13s%frootc_storage - frootc_xfer => pc13s%frootc_xfer - gresp_storage => pc13s%gresp_storage - gresp_xfer => pc13s%gresp_xfer - leafc => pc13s%leafc - leafc_storage => pc13s%leafc_storage - leafc_xfer => pc13s%leafc_xfer - livecrootc => pc13s%livecrootc - livecrootc_storage => pc13s%livecrootc_storage - livecrootc_xfer => pc13s%livecrootc_xfer - livestemc => pc13s%livestemc - livestemc_storage => pc13s%livestemc_storage - livestemc_xfer => pc13s%livestemc_xfer - xsmrpool => pc13s%xsmrpool - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level carbon fluxes from harvest mortality - - ! leaf to litter - litr1c(c) = litr1c(c) + hrv_leafc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + hrv_leafc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + hrv_leafc_to_litr3c(c) * dt - - ! fine root to litter - litr1c(c) = litr1c(c) + hrv_frootc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + hrv_frootc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + hrv_frootc_to_litr3c(c) * dt - - ! wood to CWD - cwdc(c) = cwdc(c) + hrv_livestemc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + hrv_livecrootc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + hrv_deadcrootc_to_cwdc(c) * dt - - ! wood to product pools - states updated in CNWoodProducts() - - ! storage pools to litter - litr1c(c) = litr1c(c) + hrv_leafc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_frootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livestemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadstemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livecrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadcrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_gresp_storage_to_litr1c(c) * dt - - ! transfer pools to litter - litr1c(c) = litr1c(c) + hrv_leafc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_frootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livestemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadstemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livecrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadcrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_gresp_xfer_to_litr1c(c) * dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level carbon fluxes from harvest mortality - ! displayed pools - leafc(p) = leafc(p) - hrv_leafc_to_litter(p) * dt - frootc(p) = frootc(p) - hrv_frootc_to_litter(p) * dt - livestemc(p) = livestemc(p) - hrv_livestemc_to_litter(p) * dt - deadstemc(p) = deadstemc(p) - hrv_deadstemc_to_prod10c(p) * dt - deadstemc(p) = deadstemc(p) - hrv_deadstemc_to_prod100c(p) * dt - livecrootc(p) = livecrootc(p) - hrv_livecrootc_to_litter(p) * dt - deadcrootc(p) = deadcrootc(p) - hrv_deadcrootc_to_litter(p) * dt - - ! xsmrpool - xsmrpool(p) = xsmrpool(p) - hrv_xsmrpool_to_atm(p) * dt - - ! storage pools - leafc_storage(p) = leafc_storage(p) - hrv_leafc_storage_to_litter(p) * dt - frootc_storage(p) = frootc_storage(p) - hrv_frootc_storage_to_litter(p) * dt - livestemc_storage(p) = livestemc_storage(p) - hrv_livestemc_storage_to_litter(p) * dt - deadstemc_storage(p) = deadstemc_storage(p) - hrv_deadstemc_storage_to_litter(p) * dt - livecrootc_storage(p) = livecrootc_storage(p) - hrv_livecrootc_storage_to_litter(p) * dt - deadcrootc_storage(p) = deadcrootc_storage(p) - hrv_deadcrootc_storage_to_litter(p) * dt - gresp_storage(p) = gresp_storage(p) - hrv_gresp_storage_to_litter(p) * dt - - ! transfer pools - leafc_xfer(p) = leafc_xfer(p) - hrv_leafc_xfer_to_litter(p) * dt - frootc_xfer(p) = frootc_xfer(p) - hrv_frootc_xfer_to_litter(p) * dt - livestemc_xfer(p) = livestemc_xfer(p) - hrv_livestemc_xfer_to_litter(p) * dt - deadstemc_xfer(p) = deadstemc_xfer(p) - hrv_deadstemc_xfer_to_litter(p) * dt - livecrootc_xfer(p) = livecrootc_xfer(p) - hrv_livecrootc_xfer_to_litter(p) * dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - hrv_deadcrootc_xfer_to_litter(p) * dt - gresp_xfer(p) = gresp_xfer(p) - hrv_gresp_xfer_to_litter(p) * dt - - end do ! end of pft loop - -end subroutine C13StateUpdate2h -!----------------------------------------------------------------------- - -end module CNC13StateUpdate2Mod diff --git a/src_clm40/biogeochem/CNC13StateUpdate3Mod.F90 b/src_clm40/biogeochem/CNC13StateUpdate3Mod.F90 deleted file mode 100644 index da8cc85a0d..0000000000 --- a/src_clm40/biogeochem/CNC13StateUpdate3Mod.F90 +++ /dev/null @@ -1,244 +0,0 @@ -module CNC13StateUpdate3Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: C13StateUpdate3Mod -! -! !DESCRIPTION: -! Module for carbon state variable update, mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: C13StateUpdate3 -! -! !REVISION HISTORY: -! 4/21/2005: Created by Peter Thornton and Neil Suits - copied from -! CNCStateUpdate3 for C13 state variables. -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: C13StateUpdate3 -! -! !INTERFACE: -subroutine C13StateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables affected by fire fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - use clm_varctl, only : use_c13 -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: m_cwdc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_cwdc_fire(:) - real(r8), pointer :: m_deadstemc_to_cwdc_fire(:) - real(r8), pointer :: m_litr1c_to_fire(:) - real(r8), pointer :: m_litr2c_to_fire(:) - real(r8), pointer :: m_litr3c_to_fire(:) - real(r8), pointer :: m_deadcrootc_storage_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_litter_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_fire(:) - real(r8), pointer :: m_deadstemc_storage_to_fire(:) - real(r8), pointer :: m_deadstemc_to_fire(:) - real(r8), pointer :: m_deadstemc_to_litter_fire(:) - real(r8), pointer :: m_deadstemc_xfer_to_fire(:) - real(r8), pointer :: m_frootc_storage_to_fire(:) - real(r8), pointer :: m_frootc_to_fire(:) - real(r8), pointer :: m_frootc_xfer_to_fire(:) - real(r8), pointer :: m_gresp_storage_to_fire(:) - real(r8), pointer :: m_gresp_xfer_to_fire(:) - real(r8), pointer :: m_leafc_storage_to_fire(:) - real(r8), pointer :: m_leafc_to_fire(:) - real(r8), pointer :: m_leafc_xfer_to_fire(:) - real(r8), pointer :: m_livecrootc_storage_to_fire(:) - real(r8), pointer :: m_livecrootc_to_fire(:) - real(r8), pointer :: m_livecrootc_xfer_to_fire(:) - real(r8), pointer :: m_livestemc_storage_to_fire(:) - real(r8), pointer :: m_livestemc_to_fire(:) - real(r8), pointer :: m_livestemc_xfer_to_fire(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer -! -! local pointers to implicit out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - - if (.not. use_c13) then - RETURN - end if - - ! assign local pointers at the column level - m_cwdc_to_fire => cc13f%m_cwdc_to_fire - m_deadcrootc_to_cwdc_fire => cc13f%m_deadcrootc_to_cwdc_fire - m_deadstemc_to_cwdc_fire => cc13f%m_deadstemc_to_cwdc_fire - m_litr1c_to_fire => cc13f%m_litr1c_to_fire - m_litr2c_to_fire => cc13f%m_litr2c_to_fire - m_litr3c_to_fire => cc13f%m_litr3c_to_fire - cwdc => cc13s%cwdc - litr1c => cc13s%litr1c - litr2c => cc13s%litr2c - litr3c => cc13s%litr3c - - ! assign local pointers at the column level - m_deadcrootc_storage_to_fire => pc13f%m_deadcrootc_storage_to_fire - m_deadcrootc_to_fire => pc13f%m_deadcrootc_to_fire - m_deadcrootc_to_litter_fire => pc13f%m_deadcrootc_to_litter_fire - m_deadcrootc_xfer_to_fire => pc13f%m_deadcrootc_xfer_to_fire - m_deadstemc_storage_to_fire => pc13f%m_deadstemc_storage_to_fire - m_deadstemc_to_fire => pc13f%m_deadstemc_to_fire - m_deadstemc_to_litter_fire => pc13f%m_deadstemc_to_litter_fire - m_deadstemc_xfer_to_fire => pc13f%m_deadstemc_xfer_to_fire - m_frootc_storage_to_fire => pc13f%m_frootc_storage_to_fire - m_frootc_to_fire => pc13f%m_frootc_to_fire - m_frootc_xfer_to_fire => pc13f%m_frootc_xfer_to_fire - m_gresp_storage_to_fire => pc13f%m_gresp_storage_to_fire - m_gresp_xfer_to_fire => pc13f%m_gresp_xfer_to_fire - m_leafc_storage_to_fire => pc13f%m_leafc_storage_to_fire - m_leafc_to_fire => pc13f%m_leafc_to_fire - m_leafc_xfer_to_fire => pc13f%m_leafc_xfer_to_fire - m_livecrootc_storage_to_fire => pc13f%m_livecrootc_storage_to_fire - m_livecrootc_to_fire => pc13f%m_livecrootc_to_fire - m_livecrootc_xfer_to_fire => pc13f%m_livecrootc_xfer_to_fire - m_livestemc_storage_to_fire => pc13f%m_livestemc_storage_to_fire - m_livestemc_to_fire => pc13f%m_livestemc_to_fire - m_livestemc_xfer_to_fire => pc13f%m_livestemc_xfer_to_fire - deadcrootc => pc13s%deadcrootc - deadcrootc_storage => pc13s%deadcrootc_storage - deadcrootc_xfer => pc13s%deadcrootc_xfer - deadstemc => pc13s%deadstemc - deadstemc_storage => pc13s%deadstemc_storage - deadstemc_xfer => pc13s%deadstemc_xfer - frootc => pc13s%frootc - frootc_storage => pc13s%frootc_storage - frootc_xfer => pc13s%frootc_xfer - gresp_storage => pc13s%gresp_storage - gresp_xfer => pc13s%gresp_xfer - leafc => pc13s%leafc - leafc_storage => pc13s%leafc_storage - leafc_xfer => pc13s%leafc_xfer - livecrootc => pc13s%livecrootc - livecrootc_storage => pc13s%livecrootc_storage - livecrootc_xfer => pc13s%livecrootc_xfer - livestemc => pc13s%livestemc - livestemc_storage => pc13s%livestemc_storage - livestemc_xfer => pc13s%livestemc_xfer - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level carbon fluxes from fire - - ! pft-level wood to column-level CWD (uncombusted wood) - cwdc(c) = cwdc(c) + m_deadstemc_to_cwdc_fire(c) * dt - cwdc(c) = cwdc(c) + m_deadcrootc_to_cwdc_fire(c) * dt - - ! litter and CWD losses to fire - litr1c(c) = litr1c(c) - m_litr1c_to_fire(c) * dt - litr2c(c) = litr2c(c) - m_litr2c_to_fire(c) * dt - litr3c(c) = litr3c(c) - m_litr3c_to_fire(c) * dt - cwdc(c) = cwdc(c) - m_cwdc_to_fire(c) * dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level carbon fluxes from fire - ! displayed pools - leafc(p) = leafc(p) - m_leafc_to_fire(p) * dt - frootc(p) = frootc(p) - m_frootc_to_fire(p) * dt - livestemc(p) = livestemc(p) - m_livestemc_to_fire(p) * dt - deadstemc(p) = deadstemc(p) - m_deadstemc_to_fire(p) * dt - deadstemc(p) = deadstemc(p) - m_deadstemc_to_litter_fire(p) * dt - livecrootc(p) = livecrootc(p) - m_livecrootc_to_fire(p) * dt - deadcrootc(p) = deadcrootc(p) - m_deadcrootc_to_fire(p) * dt - deadcrootc(p) = deadcrootc(p) - m_deadcrootc_to_litter_fire(p) * dt - - ! storage pools - leafc_storage(p) = leafc_storage(p) - m_leafc_storage_to_fire(p) * dt - frootc_storage(p) = frootc_storage(p) - m_frootc_storage_to_fire(p) * dt - livestemc_storage(p) = livestemc_storage(p) - m_livestemc_storage_to_fire(p) * dt - deadstemc_storage(p) = deadstemc_storage(p) - m_deadstemc_storage_to_fire(p) * dt - livecrootc_storage(p) = livecrootc_storage(p) - m_livecrootc_storage_to_fire(p) * dt - deadcrootc_storage(p) = deadcrootc_storage(p) - m_deadcrootc_storage_to_fire(p) * dt - gresp_storage(p) = gresp_storage(p) - m_gresp_storage_to_fire(p) * dt - - ! transfer pools - leafc_xfer(p) = leafc_xfer(p) - m_leafc_xfer_to_fire(p) * dt - frootc_xfer(p) = frootc_xfer(p) - m_frootc_xfer_to_fire(p) * dt - livestemc_xfer(p) = livestemc_xfer(p) - m_livestemc_xfer_to_fire(p) * dt - deadstemc_xfer(p) = deadstemc_xfer(p) - m_deadstemc_xfer_to_fire(p) * dt - livecrootc_xfer(p) = livecrootc_xfer(p) - m_livecrootc_xfer_to_fire(p) * dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - m_deadcrootc_xfer_to_fire(p) * dt - gresp_xfer(p) = gresp_xfer(p) - m_gresp_xfer_to_fire(p) * dt - - end do ! end of pft loop - -end subroutine C13StateUpdate3 -!----------------------------------------------------------------------- - -end module CNC13StateUpdate3Mod diff --git a/src_clm40/biogeochem/CNCStateUpdate1Mod.F90 b/src_clm40/biogeochem/CNCStateUpdate1Mod.F90 deleted file mode 100644 index 881397d3ad..0000000000 --- a/src_clm40/biogeochem/CNCStateUpdate1Mod.F90 +++ /dev/null @@ -1,688 +0,0 @@ -module CNCStateUpdate1Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CStateUpdate1Mod -! -! !DESCRIPTION: -! Module for carbon state variable update, non-mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! -! !PUBLIC MEMBER FUNCTIONS: - public:: CStateUpdate1 - public:: CStateUpdate0 -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CStateUpdate0 -! -! !INTERFACE: -subroutine CStateUpdate0(num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update cpool carbon state -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 7/1/05: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: psnshade_to_cpool(:) - real(r8), pointer :: psnsun_to_cpool(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the pft level - cpool => pcs%cpool - psnshade_to_cpool => pcf%psnshade_to_cpool - psnsun_to_cpool => pcf%psnsun_to_cpool - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - ! gross photosynthesis fluxes - cpool(p) = cpool(p) + psnsun_to_cpool(p)*dt - cpool(p) = cpool(p) + psnshade_to_cpool(p)*dt - end do - -end subroutine CStateUpdate0 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CStateUpdate1 -! -! !INTERFACE: -subroutine CStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables (except for gap-phase mortality and fire fluxes) -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - use pftvarcon , only: npcropmin, nc3crop - use surfrdMod , only: crop_prog -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! 12/5/03, Peter Thornton: Added livewood turnover fluxes -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays -! - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: cwdc_to_litr2c(:) ! decomp. of coarse woody debris C to litter 2 C (gC/m2/s) - real(r8), pointer :: cwdc_to_litr3c(:) ! decomp. of coarse woody debris C to litter 3 C (gC/m2/s) - integer , pointer :: harvdate(:) ! harvest date - real(r8), pointer :: xsmrpool_to_atm(:) ! excess MR pool harvest mortality (gC/m2/s) - real(r8), pointer :: grainc_to_litr1c(:) ! grain C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: grainc_to_litr2c(:) ! grain C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: grainc_to_litr3c(:) ! grain C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr1c(:) ! livestem C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr2c(:) ! livestem C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr3c(:) ! livestem C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr1c(:) ! fine root C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr2c(:) ! fine root C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr3c(:) ! fine root C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr1c(:) ! leaf C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr2c(:) ! leaf C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr3c(:) ! leaf C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: litr1_hr(:) ! het. resp. from litter 1 C (gC/m2/s) - real(r8), pointer :: litr1c_to_soil1c(:) ! decomp. of litter 1 C to SOM 1 C (gC/m2/s) - real(r8), pointer :: litr2_hr(:) ! het. resp. from litter 2 C (gC/m2/s) - real(r8), pointer :: litr2c_to_soil2c(:) ! decomp. of litter 2 C to SOM 2 C (gC/m2/s) - real(r8), pointer :: litr3_hr(:) ! het. resp. from litter 3 C (gC/m2/s) - real(r8), pointer :: litr3c_to_soil3c(:) ! decomp. of litter 3 C to SOM 3 C (gC/m2/s) - real(r8), pointer :: soil1_hr(:) ! het. resp. from SOM 1 C (gC/m2/s) - real(r8), pointer :: soil1c_to_soil2c(:) ! decomp. of SOM 1 C to SOM 2 C (gC/m2/s) - real(r8), pointer :: soil2_hr(:) ! het. resp. from SOM 2 C (gC/m2/s) - real(r8), pointer :: soil2c_to_soil3c(:) ! decomp. of SOM 2 C to SOM 3 C (gC/m2/s) - real(r8), pointer :: soil3_hr(:) ! het. resp. from SOM 3 C (gC/m2/s) - real(r8), pointer :: soil3c_to_soil4c(:) ! decomp. of SOM 3 C to SOM 4 C (gC/m2/s) - real(r8), pointer :: soil4_hr(:) ! het. resp. from SOM 4 C (gC/m2/s) - real(r8), pointer :: col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: cpool_to_xsmrpool(:) - real(r8), pointer :: cpool_to_deadcrootc(:) - real(r8), pointer :: cpool_to_deadcrootc_storage(:) - real(r8), pointer :: cpool_to_deadstemc(:) - real(r8), pointer :: cpool_to_deadstemc_storage(:) - real(r8), pointer :: cpool_to_frootc(:) - real(r8), pointer :: cpool_to_frootc_storage(:) - real(r8), pointer :: cpool_to_gresp_storage(:) - real(r8), pointer :: cpool_to_leafc(:) - real(r8), pointer :: cpool_to_leafc_storage(:) - real(r8), pointer :: cpool_to_livecrootc(:) - real(r8), pointer :: cpool_to_livecrootc_storage(:) - real(r8), pointer :: cpool_to_livestemc(:) - real(r8), pointer :: cpool_to_livestemc_storage(:) - real(r8), pointer :: deadcrootc_storage_to_xfer(:) - real(r8), pointer :: deadstemc_storage_to_xfer(:) - real(r8), pointer :: frootc_storage_to_xfer(:) - real(r8), pointer :: frootc_to_litter(:) - real(r8), pointer :: gresp_storage_to_xfer(:) - real(r8), pointer :: leafc_storage_to_xfer(:) - real(r8), pointer :: leafc_to_litter(:) - real(r8), pointer :: livecrootc_storage_to_xfer(:) - real(r8), pointer :: livecrootc_to_deadcrootc(:) - real(r8), pointer :: livestemc_storage_to_xfer(:) - real(r8), pointer :: livestemc_to_deadstemc(:) - real(r8), pointer :: livestem_mr(:) - real(r8), pointer :: froot_mr(:) - real(r8), pointer :: leaf_mr(:) - real(r8), pointer :: livecroot_mr(:) - real(r8), pointer :: livestem_curmr(:) - real(r8), pointer :: froot_curmr(:) - real(r8), pointer :: leaf_curmr(:) - real(r8), pointer :: livecroot_curmr(:) - real(r8), pointer :: livestem_xsmr(:) - real(r8), pointer :: froot_xsmr(:) - real(r8), pointer :: leaf_xsmr(:) - real(r8), pointer :: livecroot_xsmr(:) - real(r8), pointer :: cpool_deadcroot_gr(:) - real(r8), pointer :: cpool_deadcroot_storage_gr(:) - real(r8), pointer :: cpool_deadstem_gr(:) - real(r8), pointer :: cpool_deadstem_storage_gr(:) - real(r8), pointer :: cpool_froot_gr(:) - real(r8), pointer :: cpool_froot_storage_gr(:) - real(r8), pointer :: cpool_leaf_gr(:) - real(r8), pointer :: cpool_leaf_storage_gr(:) - real(r8), pointer :: cpool_livecroot_gr(:) - real(r8), pointer :: cpool_livecroot_storage_gr(:) - real(r8), pointer :: cpool_livestem_gr(:) ! live stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livestem_storage_gr(:) ! live stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadcroot_gr(:) ! dead coarse root growth respiration from storage (gC/m2/s) - real(r8), pointer :: transfer_deadstem_gr(:) ! dead stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: transfer_froot_gr(:) ! fine root growth respiration from storage (gC/m2/s) - real(r8), pointer :: transfer_leaf_gr(:) ! leaf growth respiration from storage (gC/m2/s) - real(r8), pointer :: transfer_livecroot_gr(:) ! live coarse root growth respiration from storage (gC/m2/s) - real(r8), pointer :: transfer_livestem_gr(:) ! live stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_to_grainc(:) ! allocation to grain C (gC/m2/s) - real(r8), pointer :: cpool_to_grainc_storage(:) ! allocation to grain C storage (gC/m2/s) - real(r8), pointer :: grainc_storage_to_xfer(:) ! grain C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livestemc_to_litter(:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc_to_food(:) ! grain C to food (gC/m2/s) - real(r8), pointer :: grainc_xfer_to_grainc(:) ! grain C growth from storage (gC/m2/s) - real(r8), pointer :: cpool_grain_gr(:) ! grain growth respiration (gC/m2/s) - real(r8), pointer :: cpool_grain_storage_gr(:) ! grain growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_grain_gr(:) ! grain growth respiration from storage (gC/m2/s) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: grainc(:) ! grain C:N (gC/gN) - real(r8), pointer :: grainc_storage(:) ! (gC/m2) grain C storage - real(r8), pointer :: grainc_xfer(:) ! (gC/m2) grain C transfer - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool(:) ! (gC/m2) execss maint resp C pool - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - -! local pointers for dynamic landcover fluxes and states - real(r8), pointer :: dwt_seedc_to_leaf(:) - real(r8), pointer :: dwt_seedc_to_deadstem(:) - real(r8), pointer :: dwt_frootc_to_litr1c(:) - real(r8), pointer :: dwt_frootc_to_litr2c(:) - real(r8), pointer :: dwt_frootc_to_litr3c(:) - real(r8), pointer :: dwt_livecrootc_to_cwdc(:) - real(r8), pointer :: dwt_deadcrootc_to_cwdc(:) - real(r8), pointer :: seedc(:) - -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers - woody => pftcon%woody - - ! assign local pointers at the column level - cwdc_to_litr2c => ccf%cwdc_to_litr2c - cwdc_to_litr3c => ccf%cwdc_to_litr3c - frootc_to_litr1c => ccf%frootc_to_litr1c - frootc_to_litr2c => ccf%frootc_to_litr2c - frootc_to_litr3c => ccf%frootc_to_litr3c - leafc_to_litr1c => ccf%leafc_to_litr1c - leafc_to_litr2c => ccf%leafc_to_litr2c - leafc_to_litr3c => ccf%leafc_to_litr3c - grainc_to_litr1c => ccf%grainc_to_litr1c - grainc_to_litr2c => ccf%grainc_to_litr2c - grainc_to_litr3c => ccf%grainc_to_litr3c - livestemc_to_litr1c => ccf%livestemc_to_litr1c - livestemc_to_litr2c => ccf%livestemc_to_litr2c - livestemc_to_litr3c => ccf%livestemc_to_litr3c - litr1_hr => ccf%litr1_hr - litr1c_to_soil1c => ccf%litr1c_to_soil1c - litr2_hr => ccf%litr2_hr - litr2c_to_soil2c => ccf%litr2c_to_soil2c - litr3_hr => ccf%litr3_hr - litr3c_to_soil3c => ccf%litr3c_to_soil3c - soil1_hr => ccf%soil1_hr - soil1c_to_soil2c => ccf%soil1c_to_soil2c - soil2_hr => ccf%soil2_hr - soil2c_to_soil3c => ccf%soil2c_to_soil3c - soil3_hr => ccf%soil3_hr - soil3c_to_soil4c => ccf%soil3c_to_soil4c - soil4_hr => ccf%soil4_hr - col_ctrunc => ccs%col_ctrunc - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - soil1c => ccs%soil1c - soil2c => ccs%soil2c - soil3c => ccs%soil3c - soil4c => ccs%soil4c - ! new pointers for dynamic landcover - dwt_seedc_to_leaf => ccf%dwt_seedc_to_leaf - dwt_seedc_to_deadstem => ccf%dwt_seedc_to_deadstem - dwt_frootc_to_litr1c => ccf%dwt_frootc_to_litr1c - dwt_frootc_to_litr2c => ccf%dwt_frootc_to_litr2c - dwt_frootc_to_litr3c => ccf%dwt_frootc_to_litr3c - dwt_livecrootc_to_cwdc => ccf%dwt_livecrootc_to_cwdc - dwt_deadcrootc_to_cwdc => ccf%dwt_deadcrootc_to_cwdc - seedc => ccs%seedc - - ! assign local pointers at the pft level - ivt => pft%itype - cpool_deadcroot_gr => pcf%cpool_deadcroot_gr - cpool_deadcroot_storage_gr => pcf%cpool_deadcroot_storage_gr - cpool_deadstem_gr => pcf%cpool_deadstem_gr - cpool_deadstem_storage_gr => pcf%cpool_deadstem_storage_gr - cpool_froot_gr => pcf%cpool_froot_gr - cpool_froot_storage_gr => pcf%cpool_froot_storage_gr - cpool_leaf_gr => pcf%cpool_leaf_gr - cpool_leaf_storage_gr => pcf%cpool_leaf_storage_gr - cpool_livecroot_gr => pcf%cpool_livecroot_gr - cpool_livecroot_storage_gr => pcf%cpool_livecroot_storage_gr - cpool_livestem_gr => pcf%cpool_livestem_gr - cpool_livestem_storage_gr => pcf%cpool_livestem_storage_gr - cpool_to_xsmrpool => pcf%cpool_to_xsmrpool - cpool_to_deadcrootc => pcf%cpool_to_deadcrootc - cpool_to_deadcrootc_storage => pcf%cpool_to_deadcrootc_storage - cpool_to_deadstemc => pcf%cpool_to_deadstemc - cpool_to_deadstemc_storage => pcf%cpool_to_deadstemc_storage - cpool_to_frootc => pcf%cpool_to_frootc - cpool_to_frootc_storage => pcf%cpool_to_frootc_storage - cpool_to_gresp_storage => pcf%cpool_to_gresp_storage - cpool_to_leafc => pcf%cpool_to_leafc - cpool_to_leafc_storage => pcf%cpool_to_leafc_storage - cpool_to_livecrootc => pcf%cpool_to_livecrootc - cpool_to_livecrootc_storage => pcf%cpool_to_livecrootc_storage - cpool_to_livestemc => pcf%cpool_to_livestemc - cpool_to_livestemc_storage => pcf%cpool_to_livestemc_storage - deadcrootc_storage_to_xfer => pcf%deadcrootc_storage_to_xfer - deadcrootc_xfer_to_deadcrootc => pcf%deadcrootc_xfer_to_deadcrootc - deadstemc_storage_to_xfer => pcf%deadstemc_storage_to_xfer - deadstemc_xfer_to_deadstemc => pcf%deadstemc_xfer_to_deadstemc - froot_mr => pcf%froot_mr - froot_curmr => pcf%froot_curmr - froot_xsmr => pcf%froot_xsmr - frootc_storage_to_xfer => pcf%frootc_storage_to_xfer - frootc_to_litter => pcf%frootc_to_litter - frootc_xfer_to_frootc => pcf%frootc_xfer_to_frootc - gresp_storage_to_xfer => pcf%gresp_storage_to_xfer - leaf_mr => pcf%leaf_mr - leaf_curmr => pcf%leaf_curmr - leaf_xsmr => pcf%leaf_xsmr - leafc_storage_to_xfer => pcf%leafc_storage_to_xfer - leafc_to_litter => pcf%leafc_to_litter - leafc_xfer_to_leafc => pcf%leafc_xfer_to_leafc - livecroot_mr => pcf%livecroot_mr - livecroot_curmr => pcf%livecroot_curmr - livecroot_xsmr => pcf%livecroot_xsmr - livecrootc_storage_to_xfer => pcf%livecrootc_storage_to_xfer - livecrootc_to_deadcrootc => pcf%livecrootc_to_deadcrootc - livecrootc_xfer_to_livecrootc => pcf%livecrootc_xfer_to_livecrootc - livestem_mr => pcf%livestem_mr - livestem_curmr => pcf%livestem_curmr - livestem_xsmr => pcf%livestem_xsmr - livestemc_storage_to_xfer => pcf%livestemc_storage_to_xfer - livestemc_to_deadstemc => pcf%livestemc_to_deadstemc - livestemc_xfer_to_livestemc => pcf%livestemc_xfer_to_livestemc - transfer_deadcroot_gr => pcf%transfer_deadcroot_gr - transfer_deadstem_gr => pcf%transfer_deadstem_gr - transfer_froot_gr => pcf%transfer_froot_gr - transfer_leaf_gr => pcf%transfer_leaf_gr - transfer_livecroot_gr => pcf%transfer_livecroot_gr - transfer_livestem_gr => pcf%transfer_livestem_gr - harvdate => pps%harvdate - xsmrpool_to_atm => pcf%xsmrpool_to_atm - cpool_grain_gr => pcf%cpool_grain_gr - cpool_grain_storage_gr => pcf%cpool_grain_storage_gr - cpool_to_grainc => pcf%cpool_to_grainc - cpool_to_grainc_storage => pcf%cpool_to_grainc_storage - livestemc_to_litter => pcf%livestemc_to_litter - grainc_storage_to_xfer => pcf%grainc_storage_to_xfer - grainc_to_food => pcf%grainc_to_food - grainc_xfer_to_grainc => pcf%grainc_xfer_to_grainc - transfer_grain_gr => pcf%transfer_grain_gr - grainc => pcs%grainc - grainc_storage => pcs%grainc_storage - grainc_xfer => pcs%grainc_xfer - cpool => pcs%cpool - xsmrpool => pcs%xsmrpool - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level fluxes - - ! plant to litter fluxes - ! leaf litter - litr1c(c) = litr1c(c) + leafc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + leafc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + leafc_to_litr3c(c)*dt - ! fine root litter - litr1c(c) = litr1c(c) + frootc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + frootc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + frootc_to_litr3c(c)*dt - if ( crop_prog )then - ! livestem litter - litr1c(c) = litr1c(c) + livestemc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + livestemc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + livestemc_to_litr3c(c)*dt - ! grain litter - litr1c(c) = litr1c(c) + grainc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + grainc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + grainc_to_litr3c(c)*dt - end if - - ! seeding fluxes, from dynamic landcover - seedc(c) = seedc(c) - dwt_seedc_to_leaf(c) * dt - seedc(c) = seedc(c) - dwt_seedc_to_deadstem(c) * dt - - ! fluxes into litter and CWD, from dynamic landcover - litr1c(c) = litr1c(c) + dwt_frootc_to_litr1c(c)*dt - litr2c(c) = litr2c(c) + dwt_frootc_to_litr2c(c)*dt - litr3c(c) = litr3c(c) + dwt_frootc_to_litr3c(c)*dt - cwdc(c) = cwdc(c) + dwt_livecrootc_to_cwdc(c)*dt - cwdc(c) = cwdc(c) + dwt_deadcrootc_to_cwdc(c)*dt - - ! litter and SOM HR fluxes - litr1c(c) = litr1c(c) - litr1_hr(c)*dt - litr2c(c) = litr2c(c) - litr2_hr(c)*dt - litr3c(c) = litr3c(c) - litr3_hr(c)*dt - soil1c(c) = soil1c(c) - soil1_hr(c)*dt - soil2c(c) = soil2c(c) - soil2_hr(c)*dt - soil3c(c) = soil3c(c) - soil3_hr(c)*dt - soil4c(c) = soil4c(c) - soil4_hr(c)*dt - - ! CWD to litter fluxes - cwdc(c) = cwdc(c) - cwdc_to_litr2c(c)*dt - litr2c(c) = litr2c(c) + cwdc_to_litr2c(c)*dt - cwdc(c) = cwdc(c) - cwdc_to_litr3c(c)*dt - litr3c(c) = litr3c(c) + cwdc_to_litr3c(c)*dt - - ! litter to SOM fluxes - litr1c(c) = litr1c(c) - litr1c_to_soil1c(c)*dt - soil1c(c) = soil1c(c) + litr1c_to_soil1c(c)*dt - litr2c(c) = litr2c(c) - litr2c_to_soil2c(c)*dt - soil2c(c) = soil2c(c) + litr2c_to_soil2c(c)*dt - litr3c(c) = litr3c(c) - litr3c_to_soil3c(c)*dt - soil3c(c) = soil3c(c) + litr3c_to_soil3c(c)*dt - - ! SOM to SOM fluxes - soil1c(c) = soil1c(c) - soil1c_to_soil2c(c)*dt - soil2c(c) = soil2c(c) + soil1c_to_soil2c(c)*dt - soil2c(c) = soil2c(c) - soil2c_to_soil3c(c)*dt - soil3c(c) = soil3c(c) + soil2c_to_soil3c(c)*dt - soil3c(c) = soil3c(c) - soil3c_to_soil4c(c)*dt - soil4c(c) = soil4c(c) + soil3c_to_soil4c(c)*dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! phenology: transfer growth fluxes - leafc(p) = leafc(p) + leafc_xfer_to_leafc(p)*dt - leafc_xfer(p) = leafc_xfer(p) - leafc_xfer_to_leafc(p)*dt - frootc(p) = frootc(p) + frootc_xfer_to_frootc(p)*dt - frootc_xfer(p) = frootc_xfer(p) - frootc_xfer_to_frootc(p)*dt - if (woody(ivt(p)) == 1._r8) then - livestemc(p) = livestemc(p) + livestemc_xfer_to_livestemc(p)*dt - livestemc_xfer(p) = livestemc_xfer(p) - livestemc_xfer_to_livestemc(p)*dt - deadstemc(p) = deadstemc(p) + deadstemc_xfer_to_deadstemc(p)*dt - deadstemc_xfer(p) = deadstemc_xfer(p) - deadstemc_xfer_to_deadstemc(p)*dt - livecrootc(p) = livecrootc(p) + livecrootc_xfer_to_livecrootc(p)*dt - livecrootc_xfer(p) = livecrootc_xfer(p) - livecrootc_xfer_to_livecrootc(p)*dt - deadcrootc(p) = deadcrootc(p) + deadcrootc_xfer_to_deadcrootc(p)*dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - livestemc(p) = livestemc(p) + livestemc_xfer_to_livestemc(p)*dt - livestemc_xfer(p) = livestemc_xfer(p) - livestemc_xfer_to_livestemc(p)*dt - grainc(p) = grainc(p) + grainc_xfer_to_grainc(p)*dt - grainc_xfer(p) = grainc_xfer(p) - grainc_xfer_to_grainc(p)*dt - end if - - ! phenology: litterfall fluxes - leafc(p) = leafc(p) - leafc_to_litter(p)*dt - frootc(p) = frootc(p) - frootc_to_litter(p)*dt - - ! livewood turnover fluxes - if (woody(ivt(p)) == 1._r8) then - livestemc(p) = livestemc(p) - livestemc_to_deadstemc(p)*dt - deadstemc(p) = deadstemc(p) + livestemc_to_deadstemc(p)*dt - livecrootc(p) = livecrootc(p) - livecrootc_to_deadcrootc(p)*dt - deadcrootc(p) = deadcrootc(p) + livecrootc_to_deadcrootc(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - livestemc(p) = livestemc(p) - livestemc_to_litter(p)*dt - grainc(p) = grainc(p) - grainc_to_food(p)*dt - end if - - ! maintenance respiration fluxes from cpool - cpool(p) = cpool(p) - cpool_to_xsmrpool(p)*dt - cpool(p) = cpool(p) - leaf_curmr(p)*dt - cpool(p) = cpool(p) - froot_curmr(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - livestem_curmr(p)*dt - cpool(p) = cpool(p) - livecroot_curmr(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool(p) = cpool(p) - livestem_curmr(p)*dt - end if - - ! maintenance respiration fluxes from xsmrpool - xsmrpool(p) = xsmrpool(p) + cpool_to_xsmrpool(p)*dt - xsmrpool(p) = xsmrpool(p) - leaf_xsmr(p)*dt - xsmrpool(p) = xsmrpool(p) - froot_xsmr(p)*dt - if (woody(ivt(p)) == 1._r8) then - xsmrpool(p) = xsmrpool(p) - livestem_xsmr(p)*dt - xsmrpool(p) = xsmrpool(p) - livecroot_xsmr(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - xsmrpool(p) = xsmrpool(p) - livestem_xsmr(p)*dt - if (harvdate(p) < 999) then ! beginning at harvest, send to atm - xsmrpool_to_atm(p) = xsmrpool_to_atm(p) + xsmrpool(p)/dt - xsmrpool(p) = xsmrpool(p) - xsmrpool_to_atm(p)*dt - end if - end if - - ! allocation fluxes - cpool(p) = cpool(p) - cpool_to_leafc(p)*dt - leafc(p) = leafc(p) + cpool_to_leafc(p)*dt - cpool(p) = cpool(p) - cpool_to_leafc_storage(p)*dt - leafc_storage(p) = leafc_storage(p) + cpool_to_leafc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_frootc(p)*dt - frootc(p) = frootc(p) + cpool_to_frootc(p)*dt - cpool(p) = cpool(p) - cpool_to_frootc_storage(p)*dt - frootc_storage(p) = frootc_storage(p) + cpool_to_frootc_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - cpool_to_livestemc(p)*dt - livestemc(p) = livestemc(p) + cpool_to_livestemc(p)*dt - cpool(p) = cpool(p) - cpool_to_livestemc_storage(p)*dt - livestemc_storage(p) = livestemc_storage(p) + cpool_to_livestemc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_deadstemc(p)*dt - deadstemc(p) = deadstemc(p) + cpool_to_deadstemc(p)*dt - cpool(p) = cpool(p) - cpool_to_deadstemc_storage(p)*dt - deadstemc_storage(p) = deadstemc_storage(p) + cpool_to_deadstemc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_livecrootc(p)*dt - livecrootc(p) = livecrootc(p) + cpool_to_livecrootc(p)*dt - cpool(p) = cpool(p) - cpool_to_livecrootc_storage(p)*dt - livecrootc_storage(p) = livecrootc_storage(p) + cpool_to_livecrootc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_deadcrootc(p)*dt - deadcrootc(p) = deadcrootc(p) + cpool_to_deadcrootc(p)*dt - cpool(p) = cpool(p) - cpool_to_deadcrootc_storage(p)*dt - deadcrootc_storage(p) = deadcrootc_storage(p) + cpool_to_deadcrootc_storage(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool(p) = cpool(p) - cpool_to_livestemc(p)*dt - livestemc(p) = livestemc(p) + cpool_to_livestemc(p)*dt - cpool(p) = cpool(p) - cpool_to_livestemc_storage(p)*dt - livestemc_storage(p) = livestemc_storage(p) + cpool_to_livestemc_storage(p)*dt - cpool(p) = cpool(p) - cpool_to_grainc(p)*dt - grainc(p) = grainc(p) + cpool_to_grainc(p)*dt - cpool(p) = cpool(p) - cpool_to_grainc_storage(p)*dt - grainc_storage(p) = grainc_storage(p) + cpool_to_grainc_storage(p)*dt - end if - - ! growth respiration fluxes for current growth - cpool(p) = cpool(p) - cpool_leaf_gr(p)*dt - cpool(p) = cpool(p) - cpool_froot_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - cpool_livestem_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadstem_gr(p)*dt - cpool(p) = cpool(p) - cpool_livecroot_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadcroot_gr(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool(p) = cpool(p) - cpool_livestem_gr(p)*dt - cpool(p) = cpool(p) - cpool_grain_gr(p)*dt - end if - - ! growth respiration for transfer growth - gresp_xfer(p) = gresp_xfer(p) - transfer_leaf_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_froot_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then - gresp_xfer(p) = gresp_xfer(p) - transfer_livestem_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_deadstem_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_livecroot_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_deadcroot_gr(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - gresp_xfer(p) = gresp_xfer(p) - transfer_livestem_gr(p)*dt - gresp_xfer(p) = gresp_xfer(p) - transfer_grain_gr(p)*dt - end if - - ! growth respiration at time of storage - cpool(p) = cpool(p) - cpool_leaf_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_froot_storage_gr(p)*dt - if (woody(ivt(p)) == 1._r8) then - cpool(p) = cpool(p) - cpool_livestem_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadstem_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_livecroot_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_deadcroot_storage_gr(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool(p) = cpool(p) - cpool_livestem_storage_gr(p)*dt - cpool(p) = cpool(p) - cpool_grain_storage_gr(p)*dt - end if - - ! growth respiration stored for release during transfer growth - cpool(p) = cpool(p) - cpool_to_gresp_storage(p)*dt - gresp_storage(p) = gresp_storage(p) + cpool_to_gresp_storage(p)*dt - - ! move storage pools into transfer pools - leafc_storage(p) = leafc_storage(p) - leafc_storage_to_xfer(p)*dt - leafc_xfer(p) = leafc_xfer(p) + leafc_storage_to_xfer(p)*dt - frootc_storage(p) = frootc_storage(p) - frootc_storage_to_xfer(p)*dt - frootc_xfer(p) = frootc_xfer(p) + frootc_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then - livestemc_storage(p) = livestemc_storage(p) - livestemc_storage_to_xfer(p)*dt - livestemc_xfer(p) = livestemc_xfer(p) + livestemc_storage_to_xfer(p)*dt - deadstemc_storage(p) = deadstemc_storage(p) - deadstemc_storage_to_xfer(p)*dt - deadstemc_xfer(p) = deadstemc_xfer(p) + deadstemc_storage_to_xfer(p)*dt - livecrootc_storage(p) = livecrootc_storage(p) - livecrootc_storage_to_xfer(p)*dt - livecrootc_xfer(p) = livecrootc_xfer(p) + livecrootc_storage_to_xfer(p)*dt - deadcrootc_storage(p) = deadcrootc_storage(p) - deadcrootc_storage_to_xfer(p)*dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) + deadcrootc_storage_to_xfer(p)*dt - gresp_storage(p) = gresp_storage(p) - gresp_storage_to_xfer(p)*dt - gresp_xfer(p) = gresp_xfer(p) + gresp_storage_to_xfer(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - livestemc_storage(p) = livestemc_storage(p) - livestemc_storage_to_xfer(p)*dt - livestemc_xfer(p) = livestemc_xfer(p) + livestemc_storage_to_xfer(p)*dt - grainc_storage(p) = grainc_storage(p) - grainc_storage_to_xfer(p)*dt - grainc_xfer(p) = grainc_xfer(p) + grainc_storage_to_xfer(p)*dt - end if - - end do ! end of pft loop - -end subroutine CStateUpdate1 -!----------------------------------------------------------------------- - -end module CNCStateUpdate1Mod diff --git a/src_clm40/biogeochem/CNCStateUpdate2Mod.F90 b/src_clm40/biogeochem/CNCStateUpdate2Mod.F90 deleted file mode 100644 index 93fcb20e20..0000000000 --- a/src_clm40/biogeochem/CNCStateUpdate2Mod.F90 +++ /dev/null @@ -1,569 +0,0 @@ -module CNCStateUpdate2Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CStateUpdate2Mod -! -! !DESCRIPTION: -! Module for carbon state variable update, mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: CStateUpdate2 - public:: CStateUpdate2h -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CStateUpdate2 -! -! !INTERFACE: -subroutine CStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables affected by gap-phase mortality fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: m_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_to_cwdc(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: m_deadstemc_to_cwdc(:) - real(r8), pointer :: m_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: m_frootc_storage_to_litr1c(:) - real(r8), pointer :: m_frootc_to_litr1c(:) - real(r8), pointer :: m_frootc_to_litr2c(:) - real(r8), pointer :: m_frootc_to_litr3c(:) - real(r8), pointer :: m_frootc_xfer_to_litr1c(:) - real(r8), pointer :: m_gresp_storage_to_litr1c(:) - real(r8), pointer :: m_gresp_xfer_to_litr1c(:) - real(r8), pointer :: m_leafc_storage_to_litr1c(:) - real(r8), pointer :: m_leafc_to_litr1c(:) - real(r8), pointer :: m_leafc_to_litr2c(:) - real(r8), pointer :: m_leafc_to_litr3c(:) - real(r8), pointer :: m_leafc_xfer_to_litr1c(:) - real(r8), pointer :: m_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: m_livecrootc_to_cwdc(:) - real(r8), pointer :: m_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_livestemc_storage_to_litr1c(:) - real(r8), pointer :: m_livestemc_to_cwdc(:) - real(r8), pointer :: m_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) !(gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) !(gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer -! -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - m_deadcrootc_storage_to_litr1c => ccf%m_deadcrootc_storage_to_litr1c - m_deadcrootc_to_cwdc => ccf%m_deadcrootc_to_cwdc - m_deadcrootc_xfer_to_litr1c => ccf%m_deadcrootc_xfer_to_litr1c - m_deadstemc_storage_to_litr1c => ccf%m_deadstemc_storage_to_litr1c - m_deadstemc_to_cwdc => ccf%m_deadstemc_to_cwdc - m_deadstemc_xfer_to_litr1c => ccf%m_deadstemc_xfer_to_litr1c - m_frootc_storage_to_litr1c => ccf%m_frootc_storage_to_litr1c - m_frootc_to_litr1c => ccf%m_frootc_to_litr1c - m_frootc_to_litr2c => ccf%m_frootc_to_litr2c - m_frootc_to_litr3c => ccf%m_frootc_to_litr3c - m_frootc_xfer_to_litr1c => ccf%m_frootc_xfer_to_litr1c - m_gresp_storage_to_litr1c => ccf%m_gresp_storage_to_litr1c - m_gresp_xfer_to_litr1c => ccf%m_gresp_xfer_to_litr1c - m_leafc_storage_to_litr1c => ccf%m_leafc_storage_to_litr1c - m_leafc_to_litr1c => ccf%m_leafc_to_litr1c - m_leafc_to_litr2c => ccf%m_leafc_to_litr2c - m_leafc_to_litr3c => ccf%m_leafc_to_litr3c - m_leafc_xfer_to_litr1c => ccf%m_leafc_xfer_to_litr1c - m_livecrootc_storage_to_litr1c => ccf%m_livecrootc_storage_to_litr1c - m_livecrootc_to_cwdc => ccf%m_livecrootc_to_cwdc - m_livecrootc_xfer_to_litr1c => ccf%m_livecrootc_xfer_to_litr1c - m_livestemc_storage_to_litr1c => ccf%m_livestemc_storage_to_litr1c - m_livestemc_to_cwdc => ccf%m_livestemc_to_cwdc - m_livestemc_xfer_to_litr1c => ccf%m_livestemc_xfer_to_litr1c - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - - ! assign local pointers at the pft level - m_deadcrootc_storage_to_litter => pcf%m_deadcrootc_storage_to_litter - m_deadcrootc_to_litter => pcf%m_deadcrootc_to_litter - m_deadcrootc_xfer_to_litter => pcf%m_deadcrootc_xfer_to_litter - m_deadstemc_storage_to_litter => pcf%m_deadstemc_storage_to_litter - m_deadstemc_to_litter => pcf%m_deadstemc_to_litter - m_deadstemc_xfer_to_litter => pcf%m_deadstemc_xfer_to_litter - m_frootc_storage_to_litter => pcf%m_frootc_storage_to_litter - m_frootc_to_litter => pcf%m_frootc_to_litter - m_frootc_xfer_to_litter => pcf%m_frootc_xfer_to_litter - m_gresp_storage_to_litter => pcf%m_gresp_storage_to_litter - m_gresp_xfer_to_litter => pcf%m_gresp_xfer_to_litter - m_leafc_storage_to_litter => pcf%m_leafc_storage_to_litter - m_leafc_to_litter => pcf%m_leafc_to_litter - m_leafc_xfer_to_litter => pcf%m_leafc_xfer_to_litter - m_livecrootc_storage_to_litter => pcf%m_livecrootc_storage_to_litter - m_livecrootc_to_litter => pcf%m_livecrootc_to_litter - m_livecrootc_xfer_to_litter => pcf%m_livecrootc_xfer_to_litter - m_livestemc_storage_to_litter => pcf%m_livestemc_storage_to_litter - m_livestemc_to_litter => pcf%m_livestemc_to_litter - m_livestemc_xfer_to_litter => pcf%m_livestemc_xfer_to_litter - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level carbon fluxes from gap-phase mortality - - ! leaf to litter - litr1c(c) = litr1c(c) + m_leafc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + m_leafc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + m_leafc_to_litr3c(c) * dt - - ! fine root to litter - litr1c(c) = litr1c(c) + m_frootc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + m_frootc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + m_frootc_to_litr3c(c) * dt - - ! wood to CWD - cwdc(c) = cwdc(c) + m_livestemc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + m_deadstemc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + m_livecrootc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + m_deadcrootc_to_cwdc(c) * dt - - ! storage pools to litter - litr1c(c) = litr1c(c) + m_leafc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_frootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livestemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadstemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livecrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadcrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_gresp_storage_to_litr1c(c) * dt - - ! transfer pools to litter - litr1c(c) = litr1c(c) + m_leafc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_frootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livestemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadstemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_livecrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_deadcrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + m_gresp_xfer_to_litr1c(c) * dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level carbon fluxes from gap-phase mortality - ! displayed pools - leafc(p) = leafc(p) - m_leafc_to_litter(p) * dt - frootc(p) = frootc(p) - m_frootc_to_litter(p) * dt - livestemc(p) = livestemc(p) - m_livestemc_to_litter(p) * dt - deadstemc(p) = deadstemc(p) - m_deadstemc_to_litter(p) * dt - livecrootc(p) = livecrootc(p) - m_livecrootc_to_litter(p) * dt - deadcrootc(p) = deadcrootc(p) - m_deadcrootc_to_litter(p) * dt - - ! storage pools - leafc_storage(p) = leafc_storage(p) - m_leafc_storage_to_litter(p) * dt - frootc_storage(p) = frootc_storage(p) - m_frootc_storage_to_litter(p) * dt - livestemc_storage(p) = livestemc_storage(p) - m_livestemc_storage_to_litter(p) * dt - deadstemc_storage(p) = deadstemc_storage(p) - m_deadstemc_storage_to_litter(p) * dt - livecrootc_storage(p) = livecrootc_storage(p) - m_livecrootc_storage_to_litter(p) * dt - deadcrootc_storage(p) = deadcrootc_storage(p) - m_deadcrootc_storage_to_litter(p) * dt - gresp_storage(p) = gresp_storage(p) - m_gresp_storage_to_litter(p) * dt - - ! transfer pools - leafc_xfer(p) = leafc_xfer(p) - m_leafc_xfer_to_litter(p) * dt - frootc_xfer(p) = frootc_xfer(p) - m_frootc_xfer_to_litter(p) * dt - livestemc_xfer(p) = livestemc_xfer(p) - m_livestemc_xfer_to_litter(p) * dt - deadstemc_xfer(p) = deadstemc_xfer(p) - m_deadstemc_xfer_to_litter(p) * dt - livecrootc_xfer(p) = livecrootc_xfer(p) - m_livecrootc_xfer_to_litter(p) * dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - m_deadcrootc_xfer_to_litter(p) * dt - gresp_xfer(p) = gresp_xfer(p) - m_gresp_xfer_to_litter(p) * dt - - end do ! end of pft loop - -end subroutine CStateUpdate2 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CStateUpdate2h -! -! !INTERFACE: -subroutine CStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Update all the prognostic carbon state -! variables affected by harvest mortality fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 5/20/09: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: hrv_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_to_cwdc(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_frootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_frootc_to_litr1c(:) - real(r8), pointer :: hrv_frootc_to_litr2c(:) - real(r8), pointer :: hrv_frootc_to_litr3c(:) - real(r8), pointer :: hrv_frootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_gresp_storage_to_litr1c(:) - real(r8), pointer :: hrv_gresp_xfer_to_litr1c(:) - real(r8), pointer :: hrv_leafc_storage_to_litr1c(:) - real(r8), pointer :: hrv_leafc_to_litr1c(:) - real(r8), pointer :: hrv_leafc_to_litr2c(:) - real(r8), pointer :: hrv_leafc_to_litr3c(:) - real(r8), pointer :: hrv_leafc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_to_cwdc(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_to_cwdc(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_xsmrpool_to_atm(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: xsmrpool(:) ! (gC/m2) abstract C pool to meet excess MR demand -! -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) -! -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - hrv_deadcrootc_storage_to_litr1c => ccf%hrv_deadcrootc_storage_to_litr1c - hrv_deadcrootc_to_cwdc => ccf%hrv_deadcrootc_to_cwdc - hrv_deadcrootc_xfer_to_litr1c => ccf%hrv_deadcrootc_xfer_to_litr1c - hrv_deadstemc_storage_to_litr1c => ccf%hrv_deadstemc_storage_to_litr1c - hrv_deadstemc_xfer_to_litr1c => ccf%hrv_deadstemc_xfer_to_litr1c - hrv_frootc_storage_to_litr1c => ccf%hrv_frootc_storage_to_litr1c - hrv_frootc_to_litr1c => ccf%hrv_frootc_to_litr1c - hrv_frootc_to_litr2c => ccf%hrv_frootc_to_litr2c - hrv_frootc_to_litr3c => ccf%hrv_frootc_to_litr3c - hrv_frootc_xfer_to_litr1c => ccf%hrv_frootc_xfer_to_litr1c - hrv_gresp_storage_to_litr1c => ccf%hrv_gresp_storage_to_litr1c - hrv_gresp_xfer_to_litr1c => ccf%hrv_gresp_xfer_to_litr1c - hrv_leafc_storage_to_litr1c => ccf%hrv_leafc_storage_to_litr1c - hrv_leafc_to_litr1c => ccf%hrv_leafc_to_litr1c - hrv_leafc_to_litr2c => ccf%hrv_leafc_to_litr2c - hrv_leafc_to_litr3c => ccf%hrv_leafc_to_litr3c - hrv_leafc_xfer_to_litr1c => ccf%hrv_leafc_xfer_to_litr1c - hrv_livecrootc_storage_to_litr1c => ccf%hrv_livecrootc_storage_to_litr1c - hrv_livecrootc_to_cwdc => ccf%hrv_livecrootc_to_cwdc - hrv_livecrootc_xfer_to_litr1c => ccf%hrv_livecrootc_xfer_to_litr1c - hrv_livestemc_storage_to_litr1c => ccf%hrv_livestemc_storage_to_litr1c - hrv_livestemc_to_cwdc => ccf%hrv_livestemc_to_cwdc - hrv_livestemc_xfer_to_litr1c => ccf%hrv_livestemc_xfer_to_litr1c - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - - ! assign local pointers at the pft level - hrv_deadcrootc_storage_to_litter => pcf%hrv_deadcrootc_storage_to_litter - hrv_deadcrootc_to_litter => pcf%hrv_deadcrootc_to_litter - hrv_deadcrootc_xfer_to_litter => pcf%hrv_deadcrootc_xfer_to_litter - hrv_deadstemc_storage_to_litter => pcf%hrv_deadstemc_storage_to_litter - hrv_deadstemc_to_prod10c => pcf%hrv_deadstemc_to_prod10c - hrv_deadstemc_to_prod100c => pcf%hrv_deadstemc_to_prod100c - hrv_deadstemc_xfer_to_litter => pcf%hrv_deadstemc_xfer_to_litter - hrv_frootc_storage_to_litter => pcf%hrv_frootc_storage_to_litter - hrv_frootc_to_litter => pcf%hrv_frootc_to_litter - hrv_frootc_xfer_to_litter => pcf%hrv_frootc_xfer_to_litter - hrv_gresp_storage_to_litter => pcf%hrv_gresp_storage_to_litter - hrv_gresp_xfer_to_litter => pcf%hrv_gresp_xfer_to_litter - hrv_leafc_storage_to_litter => pcf%hrv_leafc_storage_to_litter - hrv_leafc_to_litter => pcf%hrv_leafc_to_litter - hrv_leafc_xfer_to_litter => pcf%hrv_leafc_xfer_to_litter - hrv_livecrootc_storage_to_litter => pcf%hrv_livecrootc_storage_to_litter - hrv_livecrootc_to_litter => pcf%hrv_livecrootc_to_litter - hrv_livecrootc_xfer_to_litter => pcf%hrv_livecrootc_xfer_to_litter - hrv_livestemc_storage_to_litter => pcf%hrv_livestemc_storage_to_litter - hrv_livestemc_to_litter => pcf%hrv_livestemc_to_litter - hrv_livestemc_xfer_to_litter => pcf%hrv_livestemc_xfer_to_litter - hrv_xsmrpool_to_atm => pcf%hrv_xsmrpool_to_atm - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - xsmrpool => pcs%xsmrpool - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level carbon fluxes from harvest mortality - - ! leaf to litter - litr1c(c) = litr1c(c) + hrv_leafc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + hrv_leafc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + hrv_leafc_to_litr3c(c) * dt - - ! fine root to litter - litr1c(c) = litr1c(c) + hrv_frootc_to_litr1c(c) * dt - litr2c(c) = litr2c(c) + hrv_frootc_to_litr2c(c) * dt - litr3c(c) = litr3c(c) + hrv_frootc_to_litr3c(c) * dt - - ! wood to CWD - cwdc(c) = cwdc(c) + hrv_livestemc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + hrv_livecrootc_to_cwdc(c) * dt - cwdc(c) = cwdc(c) + hrv_deadcrootc_to_cwdc(c) * dt - - ! wood to product pools - states updated in CNWoodProducts() - - ! storage pools to litter - litr1c(c) = litr1c(c) + hrv_leafc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_frootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livestemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadstemc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livecrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadcrootc_storage_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_gresp_storage_to_litr1c(c) * dt - - ! transfer pools to litter - litr1c(c) = litr1c(c) + hrv_leafc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_frootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livestemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadstemc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_livecrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_deadcrootc_xfer_to_litr1c(c) * dt - litr1c(c) = litr1c(c) + hrv_gresp_xfer_to_litr1c(c) * dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level carbon fluxes from harvest mortality - ! displayed pools - leafc(p) = leafc(p) - hrv_leafc_to_litter(p) * dt - frootc(p) = frootc(p) - hrv_frootc_to_litter(p) * dt - livestemc(p) = livestemc(p) - hrv_livestemc_to_litter(p) * dt - deadstemc(p) = deadstemc(p) - hrv_deadstemc_to_prod10c(p) * dt - deadstemc(p) = deadstemc(p) - hrv_deadstemc_to_prod100c(p) * dt - livecrootc(p) = livecrootc(p) - hrv_livecrootc_to_litter(p) * dt - deadcrootc(p) = deadcrootc(p) - hrv_deadcrootc_to_litter(p) * dt - - ! xsmrpool - xsmrpool(p) = xsmrpool(p) - hrv_xsmrpool_to_atm(p) * dt - - ! storage pools - leafc_storage(p) = leafc_storage(p) - hrv_leafc_storage_to_litter(p) * dt - frootc_storage(p) = frootc_storage(p) - hrv_frootc_storage_to_litter(p) * dt - livestemc_storage(p) = livestemc_storage(p) - hrv_livestemc_storage_to_litter(p) * dt - deadstemc_storage(p) = deadstemc_storage(p) - hrv_deadstemc_storage_to_litter(p) * dt - livecrootc_storage(p) = livecrootc_storage(p) - hrv_livecrootc_storage_to_litter(p) * dt - deadcrootc_storage(p) = deadcrootc_storage(p) - hrv_deadcrootc_storage_to_litter(p) * dt - gresp_storage(p) = gresp_storage(p) - hrv_gresp_storage_to_litter(p) * dt - - ! transfer pools - leafc_xfer(p) = leafc_xfer(p) - hrv_leafc_xfer_to_litter(p) * dt - frootc_xfer(p) = frootc_xfer(p) - hrv_frootc_xfer_to_litter(p) * dt - livestemc_xfer(p) = livestemc_xfer(p) - hrv_livestemc_xfer_to_litter(p) * dt - deadstemc_xfer(p) = deadstemc_xfer(p) - hrv_deadstemc_xfer_to_litter(p) * dt - livecrootc_xfer(p) = livecrootc_xfer(p) - hrv_livecrootc_xfer_to_litter(p) * dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - hrv_deadcrootc_xfer_to_litter(p) * dt - gresp_xfer(p) = gresp_xfer(p) - hrv_gresp_xfer_to_litter(p) * dt - - end do ! end of pft loop - -end subroutine CStateUpdate2h -!----------------------------------------------------------------------- - -end module CNCStateUpdate2Mod diff --git a/src_clm40/biogeochem/CNCStateUpdate3Mod.F90 b/src_clm40/biogeochem/CNCStateUpdate3Mod.F90 deleted file mode 100644 index 7499b90f79..0000000000 --- a/src_clm40/biogeochem/CNCStateUpdate3Mod.F90 +++ /dev/null @@ -1,238 +0,0 @@ -module CNCStateUpdate3Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CStateUpdate3Mod -! -! !DESCRIPTION: -! Module for carbon state variable update, mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: CStateUpdate3 -! -! !REVISION HISTORY: -! 7/27/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CStateUpdate3 -! -! !INTERFACE: -subroutine CStateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables affected by fire fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays - real(r8), pointer :: m_cwdc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_cwdc_fire(:) - real(r8), pointer :: m_deadstemc_to_cwdc_fire(:) - real(r8), pointer :: m_litr1c_to_fire(:) - real(r8), pointer :: m_litr2c_to_fire(:) - real(r8), pointer :: m_litr3c_to_fire(:) - real(r8), pointer :: m_deadcrootc_storage_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_litter_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_fire(:) - real(r8), pointer :: m_deadstemc_storage_to_fire(:) - real(r8), pointer :: m_deadstemc_to_fire(:) - real(r8), pointer :: m_deadstemc_to_litter_fire(:) - real(r8), pointer :: m_deadstemc_xfer_to_fire(:) - real(r8), pointer :: m_frootc_storage_to_fire(:) - real(r8), pointer :: m_frootc_to_fire(:) - real(r8), pointer :: m_frootc_xfer_to_fire(:) - real(r8), pointer :: m_gresp_storage_to_fire(:) - real(r8), pointer :: m_gresp_xfer_to_fire(:) - real(r8), pointer :: m_leafc_storage_to_fire(:) - real(r8), pointer :: m_leafc_to_fire(:) - real(r8), pointer :: m_leafc_xfer_to_fire(:) - real(r8), pointer :: m_livecrootc_storage_to_fire(:) - real(r8), pointer :: m_livecrootc_to_fire(:) - real(r8), pointer :: m_livecrootc_xfer_to_fire(:) - real(r8), pointer :: m_livestemc_storage_to_fire(:) - real(r8), pointer :: m_livestemc_to_fire(:) - real(r8), pointer :: m_livestemc_xfer_to_fire(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer -! -! local pointers to implicit out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers at the column level - m_cwdc_to_fire => ccf%m_cwdc_to_fire - m_deadcrootc_to_cwdc_fire => ccf%m_deadcrootc_to_cwdc_fire - m_deadstemc_to_cwdc_fire => ccf%m_deadstemc_to_cwdc_fire - m_litr1c_to_fire => ccf%m_litr1c_to_fire - m_litr2c_to_fire => ccf%m_litr2c_to_fire - m_litr3c_to_fire => ccf%m_litr3c_to_fire - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - - ! assign local pointers at the column level - m_deadcrootc_storage_to_fire => pcf%m_deadcrootc_storage_to_fire - m_deadcrootc_to_fire => pcf%m_deadcrootc_to_fire - m_deadcrootc_to_litter_fire => pcf%m_deadcrootc_to_litter_fire - m_deadcrootc_xfer_to_fire => pcf%m_deadcrootc_xfer_to_fire - m_deadstemc_storage_to_fire => pcf%m_deadstemc_storage_to_fire - m_deadstemc_to_fire => pcf%m_deadstemc_to_fire - m_deadstemc_to_litter_fire => pcf%m_deadstemc_to_litter_fire - m_deadstemc_xfer_to_fire => pcf%m_deadstemc_xfer_to_fire - m_frootc_storage_to_fire => pcf%m_frootc_storage_to_fire - m_frootc_to_fire => pcf%m_frootc_to_fire - m_frootc_xfer_to_fire => pcf%m_frootc_xfer_to_fire - m_gresp_storage_to_fire => pcf%m_gresp_storage_to_fire - m_gresp_xfer_to_fire => pcf%m_gresp_xfer_to_fire - m_leafc_storage_to_fire => pcf%m_leafc_storage_to_fire - m_leafc_to_fire => pcf%m_leafc_to_fire - m_leafc_xfer_to_fire => pcf%m_leafc_xfer_to_fire - m_livecrootc_storage_to_fire => pcf%m_livecrootc_storage_to_fire - m_livecrootc_to_fire => pcf%m_livecrootc_to_fire - m_livecrootc_xfer_to_fire => pcf%m_livecrootc_xfer_to_fire - m_livestemc_storage_to_fire => pcf%m_livestemc_storage_to_fire - m_livestemc_to_fire => pcf%m_livestemc_to_fire - m_livestemc_xfer_to_fire => pcf%m_livestemc_xfer_to_fire - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column level carbon fluxes from fire - - ! pft-level wood to column-level CWD (uncombusted wood) - cwdc(c) = cwdc(c) + m_deadstemc_to_cwdc_fire(c) * dt - cwdc(c) = cwdc(c) + m_deadcrootc_to_cwdc_fire(c) * dt - - ! litter and CWD losses to fire - litr1c(c) = litr1c(c) - m_litr1c_to_fire(c) * dt - litr2c(c) = litr2c(c) - m_litr2c_to_fire(c) * dt - litr3c(c) = litr3c(c) - m_litr3c_to_fire(c) * dt - cwdc(c) = cwdc(c) - m_cwdc_to_fire(c) * dt - - end do ! end of columns loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level carbon fluxes from fire - ! displayed pools - leafc(p) = leafc(p) - m_leafc_to_fire(p) * dt - frootc(p) = frootc(p) - m_frootc_to_fire(p) * dt - livestemc(p) = livestemc(p) - m_livestemc_to_fire(p) * dt - deadstemc(p) = deadstemc(p) - m_deadstemc_to_fire(p) * dt - deadstemc(p) = deadstemc(p) - m_deadstemc_to_litter_fire(p) * dt - livecrootc(p) = livecrootc(p) - m_livecrootc_to_fire(p) * dt - deadcrootc(p) = deadcrootc(p) - m_deadcrootc_to_fire(p) * dt - deadcrootc(p) = deadcrootc(p) - m_deadcrootc_to_litter_fire(p) * dt - - ! storage pools - leafc_storage(p) = leafc_storage(p) - m_leafc_storage_to_fire(p) * dt - frootc_storage(p) = frootc_storage(p) - m_frootc_storage_to_fire(p) * dt - livestemc_storage(p) = livestemc_storage(p) - m_livestemc_storage_to_fire(p) * dt - deadstemc_storage(p) = deadstemc_storage(p) - m_deadstemc_storage_to_fire(p) * dt - livecrootc_storage(p) = livecrootc_storage(p) - m_livecrootc_storage_to_fire(p) * dt - deadcrootc_storage(p) = deadcrootc_storage(p) - m_deadcrootc_storage_to_fire(p) * dt - gresp_storage(p) = gresp_storage(p) - m_gresp_storage_to_fire(p) * dt - - ! transfer pools - leafc_xfer(p) = leafc_xfer(p) - m_leafc_xfer_to_fire(p) * dt - frootc_xfer(p) = frootc_xfer(p) - m_frootc_xfer_to_fire(p) * dt - livestemc_xfer(p) = livestemc_xfer(p) - m_livestemc_xfer_to_fire(p) * dt - deadstemc_xfer(p) = deadstemc_xfer(p) - m_deadstemc_xfer_to_fire(p) * dt - livecrootc_xfer(p) = livecrootc_xfer(p) - m_livecrootc_xfer_to_fire(p) * dt - deadcrootc_xfer(p) = deadcrootc_xfer(p) - m_deadcrootc_xfer_to_fire(p) * dt - gresp_xfer(p) = gresp_xfer(p) - m_gresp_xfer_to_fire(p) * dt - - end do ! end of pft loop - -end subroutine CStateUpdate3 -!----------------------------------------------------------------------- - -end module CNCStateUpdate3Mod diff --git a/src_clm40/biogeochem/CNDVEcosystemDynIniMod.F90 b/src_clm40/biogeochem/CNDVEcosystemDynIniMod.F90 deleted file mode 100644 index 405b43b7ae..0000000000 --- a/src_clm40/biogeochem/CNDVEcosystemDynIniMod.F90 +++ /dev/null @@ -1,93 +0,0 @@ -module CNDVEcosystemDyniniMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNDVEcosystemDyniniMod -! -! !DESCRIPTION: -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: CNDVEcosystemDynini ! CNDV related initializations -! -! !REVISION HISTORY: -! Created by Sam Levis following DGVMEcosystemDynMod by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNDVEcosystemDynini -! -! !INTERFACE: - subroutine CNDVEcosystemDynini() -! -! !DESCRIPTION: -! CNDV related initializations -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use decompMod , only : get_proc_bounds, get_proc_global - use shr_const_mod, only : SHR_CONST_PI, SHR_CONST_TKFRZ -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Author: Sam Levis (adapted from LPJ initialization subroutines) -! Sam Levis (adapted for CNDV coupling; eliminated redunant parameters) -! -!EOP -! -! !LOCAL VARIABLES: - integer :: g,p,n ! indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! " column indices - integer :: begl, endl ! " landunit indices - integer :: begg, endg ! " gridcell indices - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype -!----------------------------------------------------------------------- - - ! Set pointers into derived type - - gptr => grc - pptr => pft - - ! --------------------------------------------------------------- - ! Some of the following came from LPJ subroutine initgrid - ! --------------------------------------------------------------- - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - do p = begp,endp - pdgvs%present(p) = .false. - pdgvs%crownarea(p) = 0._r8 - pdgvs%nind(p) = 0._r8 - pcs%leafcmax(p) = 0._r8 - pdgvs%t_mo_min(p) = 1.0e+36_r8 - end do - - do g = begg,endg - gdgvs%agdd20(g) = 0._r8 - gdgvs%tmomin20(g) = SHR_CONST_TKFRZ - 5._r8 !initialize this way for Phenology code - end do - - end subroutine CNDVEcosystemDynini - -end module CNDVEcosystemDyniniMod diff --git a/src_clm40/biogeochem/CNDVEstablishmentMod.F90 b/src_clm40/biogeochem/CNDVEstablishmentMod.F90 deleted file mode 100644 index 1a445d7ce6..0000000000 --- a/src_clm40/biogeochem/CNDVEstablishmentMod.F90 +++ /dev/null @@ -1,518 +0,0 @@ -module CNDVEstablishmentMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNDVEstablishmentMod -! -! !DESCRIPTION: -! Calculates establishment of new pfts -! Called once per year -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils , only: endrun -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Establishment -! -! !REVISION HISTORY: -! Module created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Establishment -! -! !INTERFACE: - subroutine Establishment(lbg, ubg, lbp, ubp) -! -! !DESCRIPTION: -! Calculates establishment of new pfts -! Called once per year -! -! !USES: - use clmtype - use clm_varpar , only : numpft - use clm_varcon , only : istsoil - use clm_varctl , only : iulog - use pftvarcon , only : noveg, nc3_arctic_grass - use shr_const_mod, only : SHR_CONST_CDAY, SHR_CONST_PI, SHR_CONST_TKFRZ -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbg, ubg ! gridcell bounds - integer , intent(in) :: lbp, ubp ! pft bounds -! -! !CALLED FROM: -! subroutine dv in module CNDVMod -! -! !REVISION HISTORY: -! Author: Sam Levis (adapted from Stephen Sitch's LPJ subr. establishment) -! 3/4/02, Peter Thornton: Migrated to new data structures. -! 10/05 , Sam Levis: adapted to work with CN -! 09/07 , Sam Levis: as 10/05 but with current CN -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - logical , pointer :: pftmayexist(:) ! exclude seasonal decid pfts from tropics [1=true, 0=false] - integer , pointer :: plandunit(:) ! landunit of corresponding pft - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: ltype(:) ! landunit type for corresponding pft - real(r8), pointer :: tmomin20(:) ! 20-yr running mean of tmomin - real(r8), pointer :: agdd20(:) ! 20-yr running mean of agdd - real(r8), pointer :: agddtw(:) ! accumulated growing degree days above twmax - real(r8), pointer :: prec365(:) ! 365-day running mean of tot. precipitation - real(r8), pointer :: slatop(:) !specific leaf area at top of canopy, projected area basis [m^2/gC] - real(r8), pointer :: dsladlai(:) !dSLA/dLAI, projected area basis [m^2/gC] - real(r8), pointer :: woody(:) ! ecophys const - woody pft or not - real(r8), pointer :: crownarea_max(:) ! ecophys const - tree maximum crown area [m2] - real(r8), pointer :: twmax(:) ! ecophys const - upper limit of temperature of the warmest month - real(r8), pointer :: reinickerp(:) ! ecophys const - parameter in allometric equation - real(r8), pointer :: dwood(:) ! ecophys const - wood density (gC/m3) - real(r8), pointer :: allom1(:) ! ecophys const - parameter in allometric - real(r8), pointer :: tcmin(:) ! ecophys const - minimum coldest monthly mean temperature - real(r8), pointer :: tcmax(:) ! ecophys const - maximum coldest monthly mean temperature - real(r8), pointer :: gddmin(:) ! ecophys const - minimum growing degree days (at or above 5 C) - real(r8), pointer :: leafcmax(:) ! (gC/m2) ann max leaf C - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: annsum_npp(:) ! annual sum NPP (gC/m2/yr) - real(r8), pointer :: annsum_litfall(:) ! annual sum litfall (gC/m2/yr) -! -! local pointers to implicit in/out arguments -! - integer , pointer :: ivt(:) ! vegetation type for this pft - logical , pointer :: present(:) ! true=> PFT present in patch - real(r8), pointer :: nind(:) ! number of individuals (#/m**2) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: fpcgrid(:) ! foliar projective cover on gridcell (fraction) - real(r8), pointer :: crownarea(:) ! area that each individual tree takes up (m^2) - real(r8), pointer :: greffic(:) ! lpj's growth efficiency - real(r8), pointer :: heatstress(:) -! -!EOP -! -! !OTHER LOCAL VARIABLES: -! - integer :: g,l,p,m ! indices - integer :: fn, filterg(ubg-lbg+1) ! local gridcell filter for error check -! -! gridcell level variables -! - integer :: ngrass(lbg:ubg) ! counter - integer :: npft_estab(lbg:ubg) ! counter - real(r8) :: fpc_tree_total(lbg:ubg) ! total fractional cover of trees in vegetated portion of gridcell - real(r8) :: fpc_total(lbg:ubg) ! old-total fractional vegetated portion of gridcell (without bare ground) - real(r8) :: fpc_total_new(lbg:ubg) ! new-total fractional vegetated portion of gridcell (without bare ground) -! -! pft level variables -! - logical :: survive(lbp:ubp) ! true=>pft survives - logical :: estab(lbp:ubp) ! true=>pft is established - real(r8) :: dstemc(lbp:ubp) ! local copy of deadstemc -! -! local and temporary variables or parameters -! - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - real(r8) :: estab_rate !establishment rate - real(r8) :: estab_grid !establishment rate on grid cell - real(r8) :: fpcgridtemp ! temporary - real(r8) :: stemdiam ! stem diameter - real(r8) :: stocking ! #stems / ha (stocking density) - real(r8) :: lai_ind ! LAI per individual - real(r8) :: lm_ind !leaf carbon (gC/ind) - real(r8) :: fpc_ind !individual foliage projective cover - real(r8):: bm_delta - - real(r8), parameter :: ramp_agddtw = 300.0 - -! minimum individual density for persistence of PFT (indiv/m2) -! - real(r8), parameter :: nind_min = 1.0e-10_r8 -! -! minimum precip. for establishment (mm/s) -! - real(r8), parameter :: prec_min_estab = 100._r8/(365._r8*SHR_CONST_CDAY) -! -! maximum sapling establishment rate (indiv/m2) -! - real(r8), parameter :: estab_max = 0.24_r8 -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (gridcell-level) - - agdd20 => gdgvs%agdd20 - tmomin20 => gdgvs%tmomin20 - - ! Assign local pointers to derived type members (landunit-level) - - ltype => lun%itype - - ! Assign local pointers to derived type members (pft-level) - - ivt => pft%itype - pgridcell => pft%gridcell - plandunit => pft%landunit - present => pdgvs%present - nind => pdgvs%nind - fpcgrid => pdgvs%fpcgrid - crownarea => pdgvs%crownarea - greffic => pdgvs%greffic - heatstress => pdgvs%heatstress - annsum_npp => pepv%annsum_npp - annsum_litfall => pepv%annsum_litfall - prec365 => pdgvs%prec365 - agddtw => pdgvs%agddtw - pftmayexist => pdgvs%pftmayexist - - ! Assign local pointers to derived type members (vegetation types) - - crownarea_max => dgv_pftcon%crownarea_max - twmax => dgv_pftcon%twmax - reinickerp => dgv_pftcon%reinickerp - allom1 => dgv_pftcon%allom1 - tcmax => dgv_pftcon%tcmax - tcmin => dgv_pftcon%tcmin - gddmin => dgv_pftcon%gddmin - leafcmax => pcs%leafcmax - deadstemc => pcs%deadstemc - slatop => pftcon%slatop - dsladlai => pftcon%dsladlai - dwood => pftcon%dwood - woody => pftcon%woody - - ! ********************************************************************** - ! Slevis version of LPJ's subr. bioclim - ! Limits based on 20-year running averages of coldest-month mean - ! temperature and growing degree days (5 degree base). - ! For SURVIVAL, coldest month temperature and GDD should be - ! at least as high as PFT-specific limits. - ! For REGENERATION, PFT must be able to survive AND coldest month - ! temperature should be no higher than a PFT-specific limit. - ! ********************************************************************** - - taper = 200._r8 ! make a global constant as with dwood (lpj's wooddens) - - ! Initialize gridcell-level metrics - - do g = lbg, ubg - ngrass(g) = 0 - npft_estab(g) = 0 - fpc_tree_total(g) = 0._r8 - fpc_total(g) = 0._r8 - fpc_total_new(g) = 0._r8 - end do - - do p = lbp, ubp - g = pgridcell(p) - - ! Set the presence of pft for this gridcell - - if (nind(p) == 0._r8) present(p) = .false. - if (.not. present(p)) then - nind(p) = 0._r8 - fpcgrid(p) = 0._r8 - end if - survive(p) = .false. - estab(p) = .false. - dstemc(p) = deadstemc(p) - end do - - ! Must go thru all 16 pfts and decide which can/cannot establish or survive - ! Determine present, survive, estab. Note: Even if tmomin20>tcmax, crops - ! and 2nd boreal summergreen tree cannot exist (see - ! EcosystemDynini) because this model cannot simulate such pfts, yet. - ! Note - agddtw is only defined at the pft level and has now been moved - ! to an if-statement below to determine establishment of boreal trees - - do p = lbp, ubp - g = pgridcell(p) - if (tmomin20(g) >= tcmin(ivt(p)) + SHR_CONST_TKFRZ ) then - if (tmomin20(g) <= tcmax(ivt(p)) + SHR_CONST_TKFRZ .and. agdd20(g) >= gddmin(ivt(p))) then - estab(p) = .true. - end if - survive(p) = .true. - ! seasonal decid. pfts that would have occurred in regions without - ! short winter day lengths (see CNPhenology) - if (.not. pftmayexist(p)) then - survive(p) = .false. - estab(p) = .false. - pftmayexist(p) = .true. - end if - end if - end do - - do p = lbp, ubp - g = pgridcell(p) - l = plandunit(p) - - ! Case 1 -- pft ceases to exist -kill pfts not adapted to current climate - - if (present(p) .and. (.not. survive(p) .or. nind(p)= prec_min_estab .and. estab(p)) then - if (twmax(ivt(p)) > 999._r8 .or. agddtw(p) == 0._r8) then - - present(p) = .true. - nind(p) = 0._r8 - ! lpj starts with fpcgrid=0 and calculates - ! seed fpcgrid from the carbon of saplings; - ! with CN we need the seed fpcgrid up front - ! to scale seed leafc to lm_ind to get fpcgrid; - ! sounds circular; also seed fpcgrid depends on sla, - ! so theoretically need diff value for each pft;slevis - fpcgrid(p) = 0.000844_r8 - if (woody(ivt(p)) < 1._r8) then - fpcgrid(p) = 0.05_r8 - end if - - ! Seed carbon for newly established pfts - ! Equiv. to pleaf=1 & pstor=1 set in subr pftwt_cnbal (slevis) - ! ***Dangerous*** to hardwire leafcmax here; find alternative! - ! Consider just assigning nind and fpcgrid for newly - ! established pfts instead of entering the circular procedure - ! outlined in the paragraph above - leafcmax(p) = 1._r8 - if (dstemc(p) <= 0._r8) dstemc(p) = 0.1_r8 - - end if ! conditions required for establishment - end if ! conditions required for establishment - end if ! if soil - - ! Case 3 -- some pfts continue to exist (no change) and some pfts - ! continue to not exist (no change). Do nothing for this case. - - end do - - ! Sapling and grass establishment - ! Calculate total woody FPC, FPC increment and grass cover (= crown area) - ! Calculate total woody FPC and number of woody PFTs present and able to establish - - do p = lbp, ubp - g = pgridcell(p) - if (present(p)) then - if (woody(ivt(p)) == 1._r8) then - fpc_tree_total(g) = fpc_tree_total(g) + fpcgrid(p) - if (estab(p)) npft_estab(g) = npft_estab(g) + 1 - else if (woody(ivt(p)) < 1._r8 .and. ivt(p) > noveg) then !grass - ngrass(g) = ngrass(g) + 1 - end if - end if - end do - - ! Above grid-level establishment counters are required for the next steps. - - do p = lbp, ubp - g = pgridcell(p) - - if (present(p) .and. woody(ivt(p)) == 1._r8 .and. estab(p)) then - - ! Calculate establishment rate over available space, per tree PFT - ! Max establishment rate reduced by shading as tree FPC approaches 1 - ! Total establishment rate partitioned equally among regenerating woody PFTs - - estab_rate = estab_max * (1._r8-exp(5._r8*(fpc_tree_total(g)-1._r8))) / real(npft_estab(g)) - - ! Calculate grid-level establishment rate per woody PFT - ! Space available for woody PFT establishment is fraction of grid cell - ! not currently occupied by woody PFTs - - estab_grid = estab_rate * (1._r8-fpc_tree_total(g)) - - ! Add new saplings to current population - - nind(p) = nind(p) + estab_grid - - !slevis: lpj's lm_ind was the max leaf mass for the year; - !now lm_ind is the max leaf mass for the year calculated in CNFire - !except when a pft is newly established (nind==0); then lm_ind - !is assigned a leafcmax above - - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) ! nind>0 for sure - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 pft area - ! stemdiam derived here from cn's formula for htop found in - ! CNVegStructUpdate and cn's assumption stemdiam=2*htop/taper - ! this derivation neglects upper htop limit enforced elsewhere - stemdiam = (24._r8 * dstemc(p) / (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) - else - stemdiam = 0._r8 - end if - ! Eqn D (now also in Light; need here for 1st yr when pfts haven't established, yet) - crownarea(p) = min(crownarea_max(ivt(p)), allom1(ivt(p))*stemdiam**reinickerp(ivt(p))) - - ! Update LAI and FPC - - if (crownarea(p) > 0._r8) then - if (dsladlai(ivt(p)) > 0._r8) then - ! make lai_ind >= 0.001 to avoid killing plants at this stage - lai_ind = max(0.001_r8,((exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) - & - slatop(ivt(p)))/dsladlai(ivt(p))) / crownarea(p)) - else ! currently redundant because dsladlai=0 for grasses only - lai_ind = lm_ind * slatop(ivt(p)) / crownarea(p) ! lpj's formula - end if - else - lai_ind = 0._r8 - end if - - fpc_ind = 1._r8 - exp(-0.5_r8*lai_ind) - fpcgrid(p) = crownarea(p) * nind(p) * fpc_ind - - end if ! add new saplings block - if (present(p) .and. woody(ivt(p)) == 1._r8) then - fpc_total_new(g) = fpc_total_new(g) + fpcgrid(p) - end if - end do ! close loop to update fpc_total_new - - ! Adjustments- don't allow trees to exceed 95% of vegetated landunit - - do p = lbp, ubp - g = pgridcell(p) - if (fpc_total_new(g) > 0.95_r8) then - if (woody(ivt(p)) == 1._r8 .and. present(p)) then - nind(p) = nind(p) * 0.95_r8 / fpc_total_new(g) - fpcgrid(p) = fpcgrid(p) * 0.95_r8 / fpc_total_new(g) - end if - fpc_total(g) = 0.95_r8 - - else - fpc_total(g) = fpc_total_new(g) - end if - end do - - ! Section for grasses. Grasses can establish in non-vegetated areas - - do p = lbp, ubp - g = pgridcell(p) - if (present(p) .and. woody(ivt(p)) < 1._r8) then - if (leafcmax(p) <= 0._r8 .or. fpcgrid(p) <= 0._r8 ) then - present(p) = .false. - nind(p) = 0._r8 - else - nind(p) = 1._r8 ! in case these grasses just established - crownarea(p) = 1._r8 - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) - if (dsladlai(ivt(p)) > 0._r8) then - lai_ind = max(0.001_r8,((exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) - & - slatop(ivt(p)))/dsladlai(ivt(p))) / crownarea(p)) - else ! 'if' is currently redundant b/c dsladlai=0 for grasses only - lai_ind = lm_ind * slatop(ivt(p)) / crownarea(p) - end if - fpc_ind = 1._r8 - exp(-0.5_r8*lai_ind) - fpcgrid(p) = crownarea(p) * nind(p) * fpc_ind - fpc_total(g) = fpc_total(g) + fpcgrid(p) - end if - end if - end do ! end of pft-loop - - ! Adjustment of fpc_total > 1 due to grasses (ivt >= nc3_arctic_grass) - - do p = lbp, ubp - g = pgridcell(p) - - if (fpc_total(g) > 1._r8) then - if (ivt(p) >= nc3_arctic_grass .and. fpcgrid(p) > 0._r8) then - fpcgridtemp = fpcgrid(p) - fpcgrid(p) = max(0._r8, fpcgrid(p) - (fpc_total(g)-1._r8)) - fpc_total(g) = fpc_total(g) - fpcgridtemp + fpcgrid(p) - end if - end if - - ! Remove tiny fpcgrid amounts - - if (fpcgrid(p) < 1.e-15_r8) then - fpc_total(g) = fpc_total(g) - fpcgrid(p) - fpcgrid(p) = 0._r8 - present(p) = .false. - nind(p) = 0._r8 - end if - - ! Set the fpcgrid for bare ground if there is bare ground in - ! vegetated landunit and pft is bare ground so that everything - ! can add up to one. - - if (fpc_total(g) < 1._r8 .and. ivt(p) == noveg) then - fpcgrid(p) = 1._r8 - fpc_total(g) - fpc_total(g) = fpc_total(g) + fpcgrid(p) - end if - - end do - - ! Annual calculations used hourly in GapMortality - ! Ultimately may wish to place in separate subroutine... - - do p = lbp, ubp - g = pgridcell(p) - - ! Stress mortality from lpj's subr Mortality - - if (woody(ivt(p)) == 1._r8 .and. nind(p) > 0._r8 .and. & - leafcmax(p) > 0._r8 .and. fpcgrid(p) > 0._r8) then - - if (twmax(ivt(p)) < 999._r8) then - heatstress(p) = max(0._r8, min(1._r8, agddtw(p) / ramp_agddtw)) - else - heatstress(p) = 0._r8 - end if - - ! Net individual living biomass increment - ! NB: lpj's turnover not exactly same as cn's litfall: - ! lpj's sap->heartwood turnover not included in litfall (slevis) - - bm_delta = max(0._r8, annsum_npp(p) - annsum_litfall(p)) - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) - - ! Growth efficiency (net biomass increment per unit leaf area) - - if (dsladlai(ivt(p)) > 0._r8) then - greffic(p) = bm_delta / (max(0.001_r8, & - ( ( exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) & - - slatop(ivt(p)) ) / dsladlai(ivt(p)) ))) - else ! currently redundant because dsladlai=0 for grasses only - greffic(p) = bm_delta / (lm_ind * slatop(ivt(p))) - end if - else - greffic(p) = 0. - heatstress(p) = 0. - end if - - end do - - ! Check for error in establishment - fn = 0 - do g = lbg, ubg - if (abs(fpc_total(g) - 1._r8) > 1.e-6) then - fn = fn + 1 - filterg(fn) = g - end if - end do - ! Just print out the first error - if (fn > 0) then - g = filterg(1) - write(iulog,*) 'Error in Establishment: fpc_total =',fpc_total(g), ' at gridcell ',g - call endrun - end if - - end subroutine Establishment - -end module CNDVEstablishmentMod diff --git a/src_clm40/biogeochem/CNDVLightMod.F90 b/src_clm40/biogeochem/CNDVLightMod.F90 deleted file mode 100644 index 734e49cd8a..0000000000 --- a/src_clm40/biogeochem/CNDVLightMod.F90 +++ /dev/null @@ -1,273 +0,0 @@ -module CNDVLightMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: LightMod -! -! !DESCRIPTION: -! Calculate light competition -! Update fpc for establishment routine -! Called once per year -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_const_mod, only : SHR_CONST_PI -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Light -! -! !REVISION HISTORY: -! Module created by Sam Levis following DGVMLightMod by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Light -! -! !INTERFACE: - subroutine Light(lbg, ubg, lbp, ubp, num_natvegp, filter_natvegp) -! -! !DESCRIPTION: -! Calculate light competition -! Update fpc for establishment routine -! Called once per year -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbg, ubg ! gridcell bounds - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_natvegp ! number of naturally-vegetated pfts in filter - integer, intent(in) :: filter_natvegp(ubp-lbp+1) ! pft filter for naturally-vegetated points -! -! !CALLED FROM: -! subroutine dv in module CNDVMod -! -! !REVISION HISTORY: -! Author: Sam Levis (adapted from Stephen Sitch's LPJ subroutine light) -! 3/4/02, Peter Thornton: Migrated to new data structures. -! 2005.10: Sam Levis updated to work with CN -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pgridcell(:) ! gridcell index of corresponding pft - integer , pointer :: tree(:) ! ecophys const - tree pft or not - real(r8), pointer :: slatop(:) !specific leaf area at top of canopy, projected area basis [m^2/gC] - real(r8), pointer :: dsladlai(:) !dSLA/dLAI, projected area basis [m^2/gC] - real(r8), pointer :: woody(:) ! ecophys const - woody pft or not - real(r8), pointer :: leafcmax(:) ! (gC/m2) leaf C storage - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: dwood(:) ! ecophys const - wood density (gC/m3) - real(r8), pointer :: reinickerp(:) ! ecophys const - parameter in allomet - real(r8), pointer :: crownarea_max(:) ! ecophys const - tree maximum crown a - real(r8), pointer :: allom1(:) ! ecophys const - parameter in allomet - -! local pointers to implicit inout arguments -! - real(r8), pointer :: crownarea(:) ! area that each individual tree takes up (m^2) - real(r8), pointer :: fpcgrid(:) ! foliar projective cover on gridcell (fraction) - real(r8), pointer :: nind(:) ! number of individuals -! -!EOP -! -! !OTHER LOCAL VARIABLES: - real(r8), parameter :: fpc_tree_max = 0.95_r8 !maximum total tree FPC - integer :: p,fp, g ! indices - real(r8) :: fpc_tree_total(lbg:ubg) - real(r8) :: fpc_inc_tree(lbg:ubg) - real(r8) :: fpc_inc(lbp:ubp) ! foliar projective cover increment (fraction) - real(r8) :: fpc_grass_total(lbg:ubg) - real(r8) :: fpc_shrub_total(lbg:ubg) - real(r8) :: fpc_grass_max(lbg:ubg) - real(r8) :: fpc_shrub_max(lbg:ubg) - integer :: numtrees(lbg:ubg) - real(r8) :: excess - real(r8) :: nind_kill - real(r8) :: lai_ind - real(r8) :: fpc_ind - real(r8) :: fpcgrid_old - real(r8) :: lm_ind !leaf carbon (gC/individual) - real(r8) :: stemdiam ! stem diameter - real(r8) :: stocking ! #stems / ha (stocking density) - real(r8) :: taper ! ratio of height:radius_breast_height (tree allometry) - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type scalar members - - ivt => pft%itype - pgridcell => pft%gridcell - nind => pdgvs%nind - fpcgrid => pdgvs%fpcgrid - leafcmax => pcs%leafcmax - deadstemc => pcs%deadstemc - crownarea => pdgvs%crownarea - crownarea_max => dgv_pftcon%crownarea_max - reinickerp => dgv_pftcon%reinickerp - allom1 => dgv_pftcon%allom1 - dwood => pftcon%dwood - slatop => pftcon%slatop - dsladlai => pftcon%dsladlai - woody => pftcon%woody - tree => pftcon%tree - - taper = 200._r8 ! make a global constant; used in Establishment + ? - - ! Initialize gridcell-level metrics - - do g = lbg, ubg - fpc_tree_total(g) = 0._r8 - fpc_inc_tree(g) = 0._r8 - fpc_grass_total(g) = 0._r8 - fpc_shrub_total(g) = 0._r8 - numtrees(g) = 0 - end do - - do fp = 1,num_natvegp - p = filter_natvegp(fp) - g = pgridcell(p) - - ! Update LAI and FPC as in the last lines of DGVMAllocation - - if (woody(ivt(p))==1._r8) then - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 pft area - ! stemdiam derived here from cn's formula for htop found in - ! CNVegStructUpdate and cn's assumption stemdiam=2*htop/taper - ! this derivation neglects upper htop limit enforced elsewhere - stemdiam = (24._r8 * deadstemc(p) / (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) - else - stemdiam = 0._r8 - end if - crownarea(p) = min(crownarea_max(ivt(p)), allom1(ivt(p))*stemdiam**reinickerp(ivt(p))) ! Eqn D (from Establishment) -! else ! crownarea is 1 and does not need updating - end if - - if (crownarea(p) > 0._r8 .and. nind(p) > 0._r8) then - lm_ind = leafcmax(p) * fpcgrid(p) / nind(p) - if (dsladlai(ivt(p)) > 0._r8) then - lai_ind = max(0.001_r8,((exp(lm_ind*dsladlai(ivt(p)) + log(slatop(ivt(p)))) - & - slatop(ivt(p)))/dsladlai(ivt(p))) / crownarea(p)) - else - lai_ind = lm_ind * slatop(ivt(p)) / crownarea(p) - end if - else - lai_ind = 0._r8 - end if - - fpc_ind = 1._r8 - exp(-0.5_r8*lai_ind) - fpcgrid_old = fpcgrid(p) - fpcgrid(p) = crownarea(p) * nind(p) * fpc_ind - fpc_inc(p) = max(0._r8, fpcgrid(p) - fpcgrid_old) - - if (woody(ivt(p)) == 1._r8) then - if (tree(ivt(p)) == 1) then - numtrees(g) = numtrees(g) + 1 - fpc_tree_total(g) = fpc_tree_total(g) + fpcgrid(p) - fpc_inc_tree(g) = fpc_inc_tree(g) + fpc_inc(p) - else ! if shrubs - fpc_shrub_total(g) = fpc_shrub_total(g) + fpcgrid(p) - end if - else ! if grass - fpc_grass_total(g) = fpc_grass_total(g) + fpcgrid(p) - end if - end do - - do g = lbg, ubg - fpc_grass_max(g) = 1._r8 - min(fpc_tree_total(g), fpc_tree_max) - fpc_shrub_max(g) = max(0._r8, fpc_grass_max(g) - fpc_grass_total(g)) - end do - - ! The gridcell level metrics are now in place; continue... - ! slevis replaced the previous code that updated pfpcgrid - ! with a simpler way of doing so: - ! fpcgrid(p) = fpcgrid(p) - excess - ! Later we may wish to update this subroutine - ! according to Strassmann's recommendations (see relevant pdf) - - do fp = 1,num_natvegp - p = filter_natvegp(fp) - g = pgridcell(p) - - ! light competition - - if (woody(ivt(p))==1._r8 .and. tree(ivt(p))==1._r8) then - - if (fpc_tree_total(g) > fpc_tree_max) then - - if (fpc_inc_tree(g) > 0._r8) then - excess = (fpc_tree_total(g) - fpc_tree_max) * & - fpc_inc(p) / fpc_inc_tree(g) - else - excess = (fpc_tree_total(g) - fpc_tree_max) / & - real(numtrees(g)) - end if - - ! Reduce individual density (and thereby gridcell-level biomass) - ! so that total tree FPC reduced to 'fpc_tree_max' - - if (fpcgrid(p) > 0._r8) then - nind_kill = nind(p) * excess / fpcgrid(p) - nind(p) = max(0._r8, nind(p) - nind_kill) - fpcgrid(p) = max(0._r8, fpcgrid(p) - excess) - else - nind(p) = 0._r8 - fpcgrid(p) = 0._r8 - end if - - ! Transfer lost biomass to litter - - end if ! if tree cover exceeds max allowed - else if (woody(ivt(p))==0._r8) then ! grass - - if (fpc_grass_total(g) > fpc_grass_max(g)) then - - ! grass competes with itself if total fpc exceeds 1 - - excess = (fpc_grass_total(g) - fpc_grass_max(g)) * fpcgrid(p) / fpc_grass_total(g) - fpcgrid(p) = max(0._r8, fpcgrid(p) - excess) - - end if - - else if (woody(ivt(p))==1._r8 .and. tree(ivt(p))==0._r8) then ! shrub - - if (fpc_shrub_total(g) > fpc_shrub_max(g)) then - - excess = 1._r8 - fpc_shrub_max(g) / fpc_shrub_total(g) - - ! Reduce individual density (and thereby gridcell-level biomass) - ! so that total shrub FPC reduced to fpc_shrub_max(g) - - if (fpcgrid(p) > 0._r8) then - nind_kill = nind(p) * excess / fpcgrid(p) - nind(p) = max(0._r8, nind(p) - nind_kill) - fpcgrid(p) = max(0._r8, fpcgrid(p) - excess) - else - nind(p) = 0._r8 - fpcgrid(p) = 0._r8 - end if - - end if - - end if ! end of if-tree - - end do - - end subroutine Light - -end module CNDVLightMod diff --git a/src_clm40/biogeochem/CNDVMod.F90 b/src_clm40/biogeochem/CNDVMod.F90 deleted file mode 100644 index 9db9dd3f18..0000000000 --- a/src_clm40/biogeochem/CNDVMod.F90 +++ /dev/null @@ -1,558 +0,0 @@ -module CNDVMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNDVMod -! -! !DESCRIPTION: -! Module containing routines to drive the annual dynamic vegetation -! that works with CN, reset related variables, -! and initialize/reset time invariant variables -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use abortutils , only : endrun - use CNVegStructUpdateMod, only : CNVegStructUpdate -! -! !PUBLIC TYPES: - implicit none - private - save -! -! !PUBLIC MEMBER FUNCTIONS: - public dv ! Drives the annual dynamic vegetation that - ! works with CN - public histCNDV ! Output CNDV history file -! -! !REVISION HISTORY: -! Module modified by Sam Levis from similar module DGVMMod -! created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: dv -! -! !INTERFACE: - subroutine dv(lbg, ubg, lbp, ubp, num_natvegp, filter_natvegp, kyr) -! -! !DESCRIPTION: -! Drives the annual dynamic vegetation that works with CN -! -! !USES: - use clmtype - use CNDVLightMod , only : Light - use CNDVEstablishmentMod, only : Establishment -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbg, ubg ! gridcell bounds - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(inout) :: num_natvegp ! number of naturally-vegetated - ! pfts in filter - integer, intent(inout) :: filter_natvegp(ubp-lbp+1) ! filter for - ! naturally-vegetated pfts - integer, intent(in) :: kyr ! used in routine climate20 below -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Author: Sam Levis -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: mxy(:) ! pft m index (for laixy(i,j,m),etc.) - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - real(r8), pointer :: fpcgrid(:) ! foliar projective cover on gridcell (fraction) - real(r8), pointer :: agdd(:) ! accumulated growing degree days above 5 - real(r8), pointer :: t_mo_min(:) ! annual min of t_mo (Kelvin) -! -! local pointers to implicit inout arguments -! - real(r8), pointer :: tmomin20(:) ! 20-yr running mean of tmomin - real(r8), pointer :: agdd20(:) ! 20-yr running mean of agdd -! -!EOP -! -! !LOCAL VARIABLES: - integer :: g,p ! indices -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (gridcell-level) - - agdd20 => gdgvs%agdd20 - tmomin20 => gdgvs%tmomin20 - - ! Assign local pointers to derived type members (pft-level) - - mxy => pft%mxy - pgridcell => pft%gridcell - fpcgrid => pdgvs%fpcgrid - t_mo_min => pdgvs%t_mo_min - agdd => pdgvs%agdd - - ! ************************************************************************* - ! S. Levis version of LPJ's routine climate20: 'Returns' tmomin20 & agdd20 - ! for use in routine bioclim, which I have placed in routine Establishment - ! Instead of 20-yr running mean of coldest monthly temperature, - ! use 20-yr running mean of minimum 10-day running mean - ! ************************************************************************* - - do p = lbp,ubp - g = pgridcell(p) - if (kyr == 2) then ! slevis: add ".and. start_type==arb_ic" here? - tmomin20(g) = t_mo_min(p) ! NO, b/c want to be able to start dgvm - agdd20(g) = agdd(p) ! w/ clmi file from non-dgvm simulation - end if - tmomin20(g) = (19._r8 * tmomin20(g) + t_mo_min(p)) / 20._r8 - agdd20(g) = (19._r8 * agdd20(g) + agdd(p) ) / 20._r8 - end do - - ! Rebuild filter of present natually-vegetated pfts after Kill() - - call BuildNatVegFilter(lbp, ubp, num_natvegp, filter_natvegp) - - ! Returns fpcgrid and nind - - call Light(lbg, ubg, lbp, ubp, num_natvegp, filter_natvegp) - - ! Returns updated fpcgrid, nind, crownarea, and present. Due to updated - ! present, we do not use the natveg filter in this subroutine. - - call Establishment(lbg, ubg, lbp, ubp) - - ! Reset dgvm variables needed in next yr (too few to keep subr. dvreset) - - do p = lbp,ubp - pcs%leafcmax(p) = 0._r8 - pdgvs%t_mo_min(p) = 1.0e+36_r8 - end do - end subroutine dv - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: histCNDV -! -! !INTERFACE: - subroutine histCNDV() -! -! !DESCRIPTION: -! Create CNDV history file -! -! !USES: - use clmtype - use decompMod , only : get_proc_bounds, get_proc_global - use clm_varpar , only : maxpatch_pft - use domainMod , only : ldomain - use clm_varctl , only : caseid, ctitle, finidat, fsurdat, fpftcon, iulog - use clm_varcon , only : spval - use clm_time_manager, only : get_ref_date, get_nstep, get_curr_date, get_curr_time - use fileutils , only : get_filename - use shr_sys_mod , only : shr_sys_getenv - use spmdMod , only : masterproc - use shr_const_mod , only : SHR_CONST_CDAY - use ncdio_pio -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Author: Sam Levis -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - logical , pointer :: ifspecial(:) ! true=>landunit is not vegetated (landunit-level) - integer , pointer :: pgridcell(:) ! gridcell index of corresponding pft (pft-level) - integer , pointer :: plandunit(:) ! landunit index of corresponding pft (pft-level) - integer , pointer :: mxy(:) ! pft m index (for laixy(i,j,m),etc.) - real(r8), pointer :: fpcgrid(:) ! foliar projective cover on gridcell (fraction) - real(r8), pointer :: nind(:) ! number of individuals (#/m**2) -! -!EOP -! -! !LOCAL VARIABLES: - character(len=256) :: dgvm_fn ! dgvm history filename - type(file_desc_t) :: ncid ! netcdf file id - integer :: ncprec ! output precision - integer :: g,p,l ! indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: ier ! error status - integer :: mdcur, mscur, mcdate ! outputs from get_curr_time - integer :: yr,mon,day,mcsec ! outputs from get_curr_date - integer :: hours,minutes,secs ! hours,minutes,seconds of hh:mm:ss - integer :: nstep ! time step - integer :: nbsec ! seconds components of a date - integer :: dimid ! dimension, variable id - real(r8):: time ! current time - character(len=256) :: str ! temporary string - character(len= 8) :: curdate ! current date - character(len= 8) :: curtime ! current time - character(len= 10) :: basedate ! base date (yyyymmdd) - character(len= 8) :: basesec ! base seconds - real(r8), pointer :: rbuf2dg(:,:) ! temporary - character(len=32) :: subname='histCNDV' -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (gridcell-level) - - ! NONE - - ! Assign local pointers to derived type members (landunit-level) - - ifspecial => lun%ifspecial - - ! Assign local pointers to derived subtypes components (pft-level) - - mxy => pft%mxy - pgridcell => pft%gridcell - plandunit => pft%landunit - fpcgrid => pdgvs%fpcgrid - nind => pdgvs%nind - - ! Determine subgrid bounds for this processor and allocate dynamic memory - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - allocate(rbuf2dg(begg:endg,maxpatch_pft), stat=ier) - if (ier /= 0) call endrun('histCNDV: allocation error for rbuf2dg') - - ! Set output precision - - ncprec = ncd_double - - ! ----------------------------------------------------------------------- - ! Create new netCDF file. File will be in define mode - ! ----------------------------------------------------------------------- - - dgvm_fn = set_dgvm_filename() - call ncd_pio_createfile(ncid, trim(dgvm_fn)) - - ! ----------------------------------------------------------------------- - ! Create global attributes. - ! ----------------------------------------------------------------------- - - str = 'CF1.0' - call ncd_putatt (ncid, ncd_global, 'conventions', trim(str)) - - call getdatetime(curdate, curtime) - str = 'created on ' // curdate // ' ' // curtime - call ncd_putatt(ncid, ncd_global,'history', trim(str)) - - call shr_sys_getenv('LOGNAME', str, ier) - if (ier /= 0) call endrun('error: LOGNAME environment variable not defined') - - call ncd_putatt (ncid, ncd_global, 'logname', trim(str)) - - call shr_sys_getenv('HOST', str, ier) - call ncd_putatt (ncid, ncd_global, 'host', trim(str)) - - str = 'Community Land Model: CLM3' - call ncd_putatt (ncid, ncd_global, 'source', trim(str)) - - str = '$Name$' - call ncd_putatt (ncid, ncd_global, 'version', trim(str)) - - str = '$Id$' - call ncd_putatt (ncid, ncd_global, 'revision_id', trim(str)) - - str = ctitle - call ncd_putatt (ncid, ncd_global, 'case_title', trim(str)) - - str = caseid - call ncd_putatt (ncid, ncd_global, 'case_id', trim(str)) - - str = get_filename(fsurdat) - call ncd_putatt(ncid, ncd_global, 'Surface_dataset', trim(str)) - - str = 'arbitrary initialization' - if (finidat /= ' ') str = get_filename(finidat) - call ncd_putatt(ncid, ncd_global, 'Initial_conditions_dataset', trim(str)) - - str = get_filename(fpftcon) - call ncd_putatt(ncid, ncd_global, 'PFT_physiological_constants_dataset', trim(str)) - - ! ----------------------------------------------------------------------- - ! Define dimensions. - ! ----------------------------------------------------------------------- - - if (ldomain%isgrid2d) then - call ncd_defdim (ncid, 'lon' ,ldomain%ni, dimid) - call ncd_defdim (ncid, 'lat' ,ldomain%nj, dimid) - else - call ncd_defdim (ncid, 'gridcell', ldomain%ns, dimid) - end if - call ncd_defdim (ncid, 'pft' , maxpatch_pft , dimid) - call ncd_defdim (ncid, 'time', ncd_unlimited, dimid) - call ncd_defdim (ncid, 'string_length', 80 , dimid) - - ! ----------------------------------------------------------------------- - ! Define variables - ! ----------------------------------------------------------------------- - - ! Define coordinate variables (including time) - - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=ncid, varname='lon', xtype=ncprec, dim1name='lon', & - long_name='coordinate longitude', units='degrees_east') - - call ncd_defvar(ncid=ncid, varname='lat', xtype=ncprec, dim1name='lat', & - long_name='coordinate latitude', units='degrees_north') - end if - - call get_curr_time(mdcur, mscur) - call get_ref_date(yr, mon, day, nbsec) - hours = nbsec / 3600 - minutes = (nbsec - hours*3600) / 60 - secs = (nbsec - hours*3600 - minutes*60) - write(basedate,80) yr,mon,day -80 format(i4.4,'-',i2.2,'-',i2.2) - write(basesec ,90) hours, minutes, secs -90 format(i2.2,':',i2.2,':',i2.2) - str = 'days since ' // basedate // " " // basesec - time = mdcur + mscur/SHR_CONST_CDAY - - call ncd_defvar(ncid=ncid, varname='time', xtype=ncd_double, dim1name='time', & - long_name='time', units=str) - - ! Define surface grid (coordinate variables, latitude, longitude, surface type). - - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=ncid, varname='longxy', xtype=ncprec, & - dim1name='lon', dim2name='lat', & - long_name='longitude', units='degrees_east') - - call ncd_defvar(ncid=ncid, varname='latixy', xtype=ncprec, & - dim1name='lon', dim2name='lat', & - long_name='latitude', units='degrees_north') - - call ncd_defvar(ncid=ncid, varname='landmask', xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='land/ocean mask (0.=ocean and 1.=land)') - else - call ncd_defvar(ncid=ncid, varname='longxy', xtype=ncprec, & - dim1name='gridcell',& - long_name='longitude', units='degrees_east') - - call ncd_defvar(ncid=ncid, varname='latixy', xtype=ncprec, & - dim1name='gridcell',& - long_name='latitude', units='degrees_north') - - call ncd_defvar(ncid=ncid, varname='landmask', xtype=ncd_int, & - dim1name='gridcell', & - long_name='land/ocean mask (0.=ocean and 1.=land)') - end if - - ! Define time information - - call ncd_defvar(ncid=ncid, varname='mcdate', xtype=ncd_int, dim1name='time',& - long_name='current date (YYYYMMDD)') - - call ncd_defvar(ncid=ncid, varname='mcsec', xtype=ncd_int, dim1name='time',& - long_name='current seconds of current date', units='s') - - call ncd_defvar(ncid=ncid, varname='mdcur', xtype=ncd_int, dim1name='time',& - long_name='current day (from base day)') - - call ncd_defvar(ncid=ncid, varname='mscur', xtype=ncd_int, dim1name='time',& - long_name='current seconds of current day', units='s') - - call ncd_defvar(ncid=ncid, varname='nstep', xtype=ncd_int, dim1name='time',& - long_name='time step', units='s') - - ! Define time dependent variables - - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=ncid, varname='FPCGRID', xtype=ncprec, & - dim1name='lon', dim2name='lat', dim3name='pft', dim4name='time', & - long_name='plant functional type cover', units='fraction of vegetated area', & - missing_value=spval, fill_value=spval) - - call ncd_defvar(ncid=ncid, varname='NIND', xtype=ncprec, & - dim1name='lon', dim2name='lat', dim3name='pft', dim4name='time', & - long_name='number of individuals', units='individuals/m2 vegetated land', & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=ncid, varname='FPCGRID', xtype=ncprec, & - dim1name='gridcell', dim2name='pft', dim3name='time', & - long_name='plant functional type cover', units='fraction of vegetated area', & - missing_value=spval, fill_value=spval) - - call ncd_defvar(ncid=ncid, varname='NIND', xtype=ncprec, & - dim1name='gridcell', dim2name='pft', dim3name='time', & - long_name='number of individuals', units='individuals/m2 vegetated land', & - missing_value=spval, fill_value=spval) - end if - - call ncd_enddef(ncid) - - ! ----------------------------------------------------------------------- - ! Write variables - ! ----------------------------------------------------------------------- - - ! Write surface grid (coordinate variables, latitude, longitude, surface type). - - call ncd_io(ncid=ncid, varname='longxy' , data=ldomain%lonc, flag='write', & - dim1name=grlnd) - call ncd_io(ncid=ncid, varname='latixy' , data=ldomain%latc, flag='write', & - dim1name=grlnd) - call ncd_io(ncid=ncid, varname='landmask', data=ldomain%mask, flag='write', & - dim1name=grlnd) - - ! Write current date, current seconds, current day, current nstep - - call get_curr_date(yr, mon, day, mcsec) - mcdate = yr*10000 + mon*100 + day - nstep = get_nstep() - - call ncd_io(ncid=ncid, varname='mcdate', data=mcdate, nt=1, flag='write') - call ncd_io(ncid=ncid, varname='mcsec' , data=mcsec , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='mdcur' , data=mdcur , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='mscur' , data=mcsec , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='nstep' , data=nstep , nt=1, flag='write') - call ncd_io(ncid=ncid, varname='time' , data=time , nt=1, flag='write') - - ! Write time dependent variables to CNDV history file - - ! The if .not. ifspecial statment below guarantees that the m index will - ! always lie between 1 and maxpatch_pft - - rbuf2dg(:,:) = 0._r8 - do p = begp,endp - g = pgridcell(p) - l = plandunit(p) - if (.not. ifspecial(l)) rbuf2dg(g,mxy(p)) = fpcgrid(p)*100._r8 - end do - call ncd_io(ncid=ncid, varname='FPCGRID', dim1name=grlnd, data=rbuf2dg, & - nt=1, flag='write') - - rbuf2dg(:,:) = 0._r8 - do p = begp,endp - g = pgridcell(p) - l = plandunit(p) - if (.not. ifspecial(l)) rbuf2dg(g,mxy(p)) = nind(p) - end do - call ncd_io(ncid=ncid, varname='NIND', dim1name=grlnd, data=rbuf2dg, & - nt=1, flag='write') - - ! Deallocate dynamic memory - - deallocate(rbuf2dg) - - !------------------------------------------------------------------ - ! Close and archive netcdf CNDV history file - !------------------------------------------------------------------ - - call ncd_pio_closefile(ncid) - - if (masterproc) then - write(iulog,*)'(histCNDV): Finished writing CNDV history dataset ',& - trim(dgvm_fn), 'at nstep = ',get_nstep() - end if - - end subroutine histCNDV - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: set_dgvm_filename -! -! !INTERFACE: - character(len=256) function set_dgvm_filename () -! -! !DESCRIPTION: -! Determine initial dataset filenames -! -! !USES: - use clm_varctl , only : caseid, inst_suffix - use clm_time_manager , only : get_curr_date -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -!EOP -! -! !LOCAL VARIABLES: - character(len=256) :: cdate !date char string - integer :: day !day (1 -> 31) - integer :: mon !month (1 -> 12) - integer :: yr !year (0 -> ...) - integer :: sec !seconds into current day -!----------------------------------------------------------------------- - - call get_curr_date (yr, mon, day, sec) - write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec - set_dgvm_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& - ".hv."//trim(cdate)//".nc" - - end function set_dgvm_filename - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BuildNatVegFilter -! -! !INTERFACE: - subroutine BuildNatVegFilter(lbp, ubp, num_natvegp, filter_natvegp) -! -! !DESCRIPTION: -! Reconstruct a filter of naturally-vegetated PFTs for use in DGVM -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(out) :: num_natvegp ! number of pfts in naturally-vegetated filter - integer, intent(out) :: filter_natvegp(ubp-lbp+1) ! pft filter for naturally-vegetated points -! -! !CALLED FROM: -! subroutine lpj in this module -! -! !REVISION HISTORY: -! Author: Forrest Hoffman -! -! !LOCAL VARIABLES: -! local pointers to implicit in arguments - logical , pointer :: present(:) ! whether this pft present in patch -!EOP -! -! !LOCAL VARIABLES: - integer :: p -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (pft-level) - present => pdgvs%present - - num_natvegp = 0 - do p = lbp,ubp - if (present(p)) then - num_natvegp = num_natvegp + 1 - filter_natvegp(num_natvegp) = p - end if - end do - - end subroutine BuildNatVegFilter - -end module CNDVMod diff --git a/src_clm40/biogeochem/CNDecompMod.F90 b/src_clm40/biogeochem/CNDecompMod.F90 deleted file mode 100644 index 8ae328bb13..0000000000 --- a/src_clm40/biogeochem/CNDecompMod.F90 +++ /dev/null @@ -1,674 +0,0 @@ -module CNDecompMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNDecompMod -! -! !DESCRIPTION: -! Module holding routines used in litter and soil decomposition model -! for coupled carbon-nitrogen code. -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: CNDecompAlloc -! -! !REVISION HISTORY: -! 8/15/03: Created by Peter Thornton -! 10/23/03, Peter Thornton: migrated to vector data structures -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNDecompAlloc -! -! !INTERFACE: -subroutine CNDecompAlloc (lbp, ubp, lbc, ubc, num_soilc, filter_soilc, & - num_soilp, filter_soilp, num_pcropp) -! -! !DESCRIPTION: -! -! !USES: - use clmtype - use CNAllocationMod , only: CNAllocation - use clm_time_manager, only: get_step_size - use pft2colMod , only: p2c - use clm_varcon , only: secspday - use clm_varctl , only: use_ad_spinup -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: lbc, ubc ! column-index 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts - integer, intent(in) :: num_pcropp ! number of pfts in prognostic crop filter -! -! !CALLED FROM: -! subroutine CNEcosystemDyn in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 8/15/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - ! column level - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: psisat(:,:) ! soil water potential at saturation for CN code (MPa) - real(r8), pointer :: soilpsi(:,:) ! soil water potential in each soil layer (MPa) - real(r8), pointer :: dz(:,:) ! soil layer thickness (m) - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - integer, pointer :: clandunit(:) ! index into landunit level quantities - integer , pointer :: itypelun(:) ! landunit type - ! pft level - real(r8), pointer :: rootfr(:,:) ! fraction of roots in each soil layer (nlevgrnd) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: fpi(:) ! fraction of potential immobilization (no units) - real(r8), pointer :: cwdc_to_litr2c(:) - real(r8), pointer :: cwdc_to_litr3c(:) - real(r8), pointer :: litr1_hr(:) - real(r8), pointer :: litr1c_to_soil1c(:) - real(r8), pointer :: litr2_hr(:) - real(r8), pointer :: litr2c_to_soil2c(:) - real(r8), pointer :: litr3_hr(:) - real(r8), pointer :: litr3c_to_soil3c(:) - real(r8), pointer :: soil1_hr(:) - real(r8), pointer :: soil1c_to_soil2c(:) - real(r8), pointer :: soil2_hr(:) - real(r8), pointer :: soil2c_to_soil3c(:) - real(r8), pointer :: soil3_hr(:) - real(r8), pointer :: soil3c_to_soil4c(:) - real(r8), pointer :: soil4_hr(:) - real(r8), pointer :: cwdn_to_litr2n(:) - real(r8), pointer :: cwdn_to_litr3n(:) - real(r8), pointer :: potential_immob(:) - real(r8), pointer :: litr1n_to_soil1n(:) - real(r8), pointer :: sminn_to_soil1n_l1(:) - real(r8), pointer :: litr2n_to_soil2n(:) - real(r8), pointer :: sminn_to_soil2n_l2(:) - real(r8), pointer :: litr3n_to_soil3n(:) - real(r8), pointer :: sminn_to_soil3n_l3(:) - real(r8), pointer :: soil1n_to_soil2n(:) - real(r8), pointer :: sminn_to_soil2n_s1(:) - real(r8), pointer :: soil2n_to_soil3n(:) - real(r8), pointer :: sminn_to_soil3n_s2(:) - real(r8), pointer :: soil3n_to_soil4n(:) - real(r8), pointer :: sminn_to_soil4n_s3(:) - real(r8), pointer :: soil4n_to_sminn(:) - real(r8), pointer :: sminn_to_denit_l1s1(:) - real(r8), pointer :: sminn_to_denit_l2s2(:) - real(r8), pointer :: sminn_to_denit_l3s3(:) - real(r8), pointer :: sminn_to_denit_s1s2(:) - real(r8), pointer :: sminn_to_denit_s2s3(:) - real(r8), pointer :: sminn_to_denit_s3s4(:) - real(r8), pointer :: sminn_to_denit_s4(:) - real(r8), pointer :: sminn_to_denit_excess(:) - real(r8), pointer :: gross_nmin(:) - real(r8), pointer :: net_nmin(:) -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: c,j !indices - integer :: fc !lake filter column index - real(r8):: dt !decomp timestep (seconds) - real(r8):: dtd !decomp timestep (days) - real(r8), pointer:: fr(:,:) !column-level rooting fraction by soil depth - real(r8):: frw(lbc:ubc) !rooting fraction weight - real(r8):: t_scalar(lbc:ubc) !soil temperature scalar for decomp - real(r8):: minpsi, maxpsi !limits for soil water scalar for decomp - real(r8):: psi !temporary soilpsi for water scalar - real(r8):: w_scalar(lbc:ubc) !soil water scalar for decomp - real(r8):: rate_scalar !combined rate scalar for decomp - real(r8):: cn_l1(lbc:ubc) !C:N for litter 1 - real(r8):: cn_l2(lbc:ubc) !C:N for litter 2 - real(r8):: cn_l3(lbc:ubc) !C:N for litter 3 - real(r8):: cn_s1 !C:N for SOM 1 - real(r8):: cn_s2 !C:N for SOM 2 - real(r8):: cn_s3 !C:N for SOM 3 - real(r8):: cn_s4 !C:N for SOM 4 - real(r8):: rf_l1s1 !respiration fraction litter 1 -> SOM 1 - real(r8):: rf_l2s2 !respiration fraction litter 2 -> SOM 2 - real(r8):: rf_l3s3 !respiration fraction litter 3 -> SOM 3 - real(r8):: rf_s1s2 !respiration fraction SOM 1 -> SOM 2 - real(r8):: rf_s2s3 !respiration fraction SOM 2 -> SOM 3 - real(r8):: rf_s3s4 !respiration fraction SOM 3 -> SOM 4 - real(r8):: k_l1 !decomposition rate constant litter 1 - real(r8):: k_l2 !decomposition rate constant litter 2 - real(r8):: k_l3 !decomposition rate constant litter 3 - real(r8):: k_s1 !decomposition rate constant SOM 1 - real(r8):: k_s2 !decomposition rate constant SOM 2 - real(r8):: k_s3 !decomposition rate constant SOM 3 - real(r8):: k_s4 !decomposition rate constant SOM 3 - real(r8):: k_frag !fragmentation rate constant CWD - real(r8):: ck_l1 !corrected decomposition rate constant litter 1 - real(r8):: ck_l2 !corrected decomposition rate constant litter 2 - real(r8):: ck_l3 !corrected decomposition rate constant litter 3 - real(r8):: ck_s1 !corrected decomposition rate constant SOM 1 - real(r8):: ck_s2 !corrected decomposition rate constant SOM 2 - real(r8):: ck_s3 !corrected decomposition rate constant SOM 3 - real(r8):: ck_s4 !corrected decomposition rate constant SOM 3 - real(r8):: ck_frag !corrected fragmentation rate constant CWD - real(r8):: cwd_fcel !cellulose fraction of coarse woody debris - real(r8):: cwd_flig !lignin fraction of coarse woody debris - real(r8):: cwdc_loss !fragmentation rate for CWD carbon (gC/m2/s) - real(r8):: cwdn_loss !fragmentation rate for CWD nitrogen (gN/m2/s) - real(r8):: plitr1c_loss(lbc:ubc) !potential C loss from litter 1 - real(r8):: plitr2c_loss(lbc:ubc) !potential C loss from litter 2 - real(r8):: plitr3c_loss(lbc:ubc) !potential C loss from litter 3 - real(r8):: psoil1c_loss(lbc:ubc) !potential C loss from SOM 1 - real(r8):: psoil2c_loss(lbc:ubc) !potential C loss from SOM 2 - real(r8):: psoil3c_loss(lbc:ubc) !potential C loss from SOM 3 - real(r8):: psoil4c_loss(lbc:ubc) !potential C loss from SOM 4 - real(r8):: pmnf_l1s1(lbc:ubc) !potential mineral N flux, litter 1 -> SOM 1 - real(r8):: pmnf_l2s2(lbc:ubc) !potential mineral N flux, litter 2 -> SOM 2 - real(r8):: pmnf_l3s3(lbc:ubc) !potential mineral N flux, litter 3 -> SOM 3 - real(r8):: pmnf_s1s2(lbc:ubc) !potential mineral N flux, SOM 1 -> SOM 2 - real(r8):: pmnf_s2s3(lbc:ubc) !potential mineral N flux, SOM 2 -> SOM 3 - real(r8):: pmnf_s3s4(lbc:ubc) !potential mineral N flux, SOM 3 -> SOM 4 - real(r8):: pmnf_s4(lbc:ubc) !potential mineral N flux, SOM 4 - real(r8):: immob(lbc:ubc) !potential N immobilization - real(r8):: ratio !temporary variable - real(r8):: dnp !denitrification proportion - integer :: nlevdecomp ! bottom layer to consider for decomp controls - real(r8):: spinup_scalar !multiplier for AD_SPINUP algorithm -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays - t_soisno => ces%t_soisno - psisat => cps%psisat - soilpsi => cps%soilpsi - dz => cps%dz - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - soil1c => ccs%soil1c - soil2c => ccs%soil2c - soil3c => ccs%soil3c - soil4c => ccs%soil4c - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - fpi => cps%fpi - cwdc_to_litr2c => ccf%cwdc_to_litr2c - cwdc_to_litr3c => ccf%cwdc_to_litr3c - litr1_hr => ccf%litr1_hr - litr1c_to_soil1c => ccf%litr1c_to_soil1c - litr2_hr => ccf%litr2_hr - litr2c_to_soil2c => ccf%litr2c_to_soil2c - litr3_hr => ccf%litr3_hr - litr3c_to_soil3c => ccf%litr3c_to_soil3c - soil1_hr => ccf%soil1_hr - soil1c_to_soil2c => ccf%soil1c_to_soil2c - soil2_hr => ccf%soil2_hr - soil2c_to_soil3c => ccf%soil2c_to_soil3c - soil3_hr => ccf%soil3_hr - soil3c_to_soil4c => ccf%soil3c_to_soil4c - soil4_hr => ccf%soil4_hr - cwdn_to_litr2n => cnf%cwdn_to_litr2n - cwdn_to_litr3n => cnf%cwdn_to_litr3n - potential_immob => cnf%potential_immob - litr1n_to_soil1n => cnf%litr1n_to_soil1n - sminn_to_soil1n_l1 => cnf%sminn_to_soil1n_l1 - litr2n_to_soil2n => cnf%litr2n_to_soil2n - sminn_to_soil2n_l2 => cnf%sminn_to_soil2n_l2 - litr3n_to_soil3n => cnf%litr3n_to_soil3n - sminn_to_soil3n_l3 => cnf%sminn_to_soil3n_l3 - soil1n_to_soil2n => cnf%soil1n_to_soil2n - sminn_to_soil2n_s1 => cnf%sminn_to_soil2n_s1 - soil2n_to_soil3n => cnf%soil2n_to_soil3n - sminn_to_soil3n_s2 => cnf%sminn_to_soil3n_s2 - soil3n_to_soil4n => cnf%soil3n_to_soil4n - sminn_to_soil4n_s3 => cnf%sminn_to_soil4n_s3 - soil4n_to_sminn => cnf%soil4n_to_sminn - sminn_to_denit_l1s1 => cnf%sminn_to_denit_l1s1 - sminn_to_denit_l2s2 => cnf%sminn_to_denit_l2s2 - sminn_to_denit_l3s3 => cnf%sminn_to_denit_l3s3 - sminn_to_denit_s1s2 => cnf%sminn_to_denit_s1s2 - sminn_to_denit_s2s3 => cnf%sminn_to_denit_s2s3 - sminn_to_denit_s3s4 => cnf%sminn_to_denit_s3s4 - sminn_to_denit_s4 => cnf%sminn_to_denit_s4 - sminn_to_denit_excess => cnf%sminn_to_denit_excess - gross_nmin => cnf%gross_nmin - net_nmin => cnf%net_nmin - rootfr => pps%rootfr - clandunit => col%landunit - itypelun => lun%itype - - ! set time steps - dt = real( get_step_size(), r8 ) - dtd = dt/secspday - - ! set soil organic matter compartment C:N ratios (from Biome-BGC v4.2.0) - cn_s1 = 12.0_r8 - cn_s2 = 12.0_r8 - cn_s3 = 10.0_r8 - cn_s4 = 10.0_r8 - - ! set respiration fractions for fluxes between compartments - ! (from Biome-BGC v4.2.0) - rf_l1s1 = 0.39_r8 - rf_l2s2 = 0.55_r8 - rf_l3s3 = 0.29_r8 - rf_s1s2 = 0.28_r8 - rf_s2s3 = 0.46_r8 - rf_s3s4 = 0.55 - - ! set the cellulose and lignin fractions for coarse woody debris - cwd_fcel = 0.76_r8 - cwd_flig = 0.24_r8 - - ! set initial base rates for decomposition mass loss (1/day) - ! (from Biome-BGC v4.2.0, using three SOM pools) - ! Value inside log function is the discrete-time values for a - ! daily time step model, and the result of the log function is - ! the corresponding continuous-time decay rate (1/day), following - ! Olson, 1963. - k_l1 = -log(1.0_r8-0.7_r8) - k_l2 = -log(1.0_r8-0.07_r8) - k_l3 = -log(1.0_r8-0.014_r8) - k_s1 = -log(1.0_r8-0.07_r8) - k_s2 = -log(1.0_r8-0.014_r8) - k_s3 = -log(1.0_r8-0.0014_r8) - k_s4 = -log(1.0_r8-0.0001_r8) - k_frag = -log(1.0_r8-0.001_r8) - - ! calculate the new discrete-time decay rate for model timestep - k_l1 = 1.0_r8-exp(-k_l1*dtd) - k_l2 = 1.0_r8-exp(-k_l2*dtd) - k_l3 = 1.0_r8-exp(-k_l3*dtd) - k_s1 = 1.0_r8-exp(-k_s1*dtd) - k_s2 = 1.0_r8-exp(-k_s2*dtd) - k_s3 = 1.0_r8-exp(-k_s3*dtd) - k_s4 = 1.0_r8-exp(-k_s4*dtd) - k_frag = 1.0_r8-exp(-k_frag*dtd) - - ! The following code implements the acceleration part of the AD spinup - ! algorithm, by multiplying all of the SOM decomposition base rates by 10.0. - - if (use_ad_spinup) then - spinup_scalar = 20._r8 - k_s1 = k_s1 * spinup_scalar - k_s2 = k_s2 * spinup_scalar - k_s3 = k_s3 * spinup_scalar - k_s4 = k_s4 * spinup_scalar - end if - - ! calculate function to weight the temperature and water potential scalars - ! for decomposition control. - - - ! the following normalizes values in fr so that they - ! sum to 1.0 across top nlevdecomp levels on a column - frw(lbc:ubc) = 0._r8 - nlevdecomp=5 - allocate(fr(lbc:ubc,nlevdecomp)) - do j=1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - frw(c) = frw(c) + dz(c,j) - end do - end do - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - if (frw(c) /= 0._r8) then - fr(c,j) = dz(c,j) / frw(c) - else - fr(c,j) = 0._r8 - end if - end do - end do - - ! calculate rate constant scalar for soil temperature - ! assuming that the base rate constants are assigned for non-moisture - ! limiting conditions at 25 C. - ! Peter Thornton: 3/13/09 - ! Replaced the Lloyd and Taylor function with a Q10 formula, with Q10 = 1.5 - ! as part of the modifications made to improve the seasonal cycle of - ! atmospheric CO2 concentration in global simulations. This does not impact - ! the base rates at 25 C, which are calibrated from microcosm studies. - t_scalar(:) = 0._r8 - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - t_scalar(c)=t_scalar(c) + (1.5**((t_soisno(c,j)-(SHR_CONST_TKFRZ+25._r8))/10._r8))*fr(c,j) - end do - end do - - ! calculate the rate constant scalar for soil water content. - ! Uses the log relationship with water potential given in - ! Andren, O., and K. Paustian, 1987. Barley straw decomposition in the field: - ! a comparison of models. Ecology, 68(5):1190-1200. - ! and supported by data in - ! Orchard, V.A., and F.J. Cook, 1983. Relationship between soil respiration - ! and soil moisture. Soil Biol. Biochem., 15(4):447-453. - - minpsi = -10.0_r8; - w_scalar(:) = 0._r8 - do j = 1,nlevdecomp - do fc = 1,num_soilc - c = filter_soilc(fc) - maxpsi = psisat(c,j) - psi = min(soilpsi(c,j),maxpsi) - ! decomp only if soilpsi is higher than minpsi - if (psi > minpsi) then - w_scalar(c) = w_scalar(c) + (log(minpsi/psi)/log(minpsi/maxpsi))*fr(c,j) - end if - end do - end do - - ! set initial values for potential C and N fluxes - plitr1c_loss(:) = 0._r8 - plitr2c_loss(:) = 0._r8 - plitr3c_loss(:) = 0._r8 - psoil1c_loss(:) = 0._r8 - psoil2c_loss(:) = 0._r8 - psoil3c_loss(:) = 0._r8 - psoil4c_loss(:) = 0._r8 - pmnf_l1s1(:) = 0._r8 - pmnf_l2s2(:) = 0._r8 - pmnf_l3s3(:) = 0._r8 - pmnf_s1s2(:) = 0._r8 - pmnf_s2s3(:) = 0._r8 - pmnf_s3s4(:) = 0._r8 - pmnf_s4(:) = 0._r8 - - ! column loop to calculate potential decomp rates and total immobilization - ! demand. - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate litter compartment C:N ratios - if (litr1n(c) > 0._r8) cn_l1(c) = litr1c(c)/litr1n(c) - if (litr2n(c) > 0._r8) cn_l2(c) = litr2c(c)/litr2n(c) - if (litr3n(c) > 0._r8) cn_l3(c) = litr3c(c)/litr3n(c) - - ! calculate the final rate scalar as the product of temperature and water - ! rate scalars, and correct the base decomp rates - - rate_scalar = t_scalar(c) * w_scalar(c) - ck_l1 = k_l1 * rate_scalar - ck_l2 = k_l2 * rate_scalar - ck_l3 = k_l3 * rate_scalar - ck_s1 = k_s1 * rate_scalar - ck_s2 = k_s2 * rate_scalar - ck_s3 = k_s3 * rate_scalar - ck_s4 = k_s4 * rate_scalar - ck_frag = k_frag * rate_scalar - - ! calculate the non-nitrogen-limited fluxes - ! these fluxes include the "/ dt" term to put them on a - ! per second basis, since the rate constants have been - ! calculated on a per timestep basis. - - ! CWD fragmentation -> litter pools - cwdc_loss = cwdc(c) * ck_frag / dt - cwdc_to_litr2c(c) = cwdc_loss * cwd_fcel - cwdc_to_litr3c(c) = cwdc_loss * cwd_flig - cwdn_loss = cwdn(c) * ck_frag / dt - cwdn_to_litr2n(c) = cwdn_loss * cwd_fcel - cwdn_to_litr3n(c) = cwdn_loss * cwd_flig - - ! litter 1 -> SOM 1 - if (litr1c(c) > 0._r8) then - plitr1c_loss(c) = litr1c(c) * ck_l1 / dt - ratio = 0._r8 - if (litr1n(c) > 0._r8) ratio = cn_s1/cn_l1(c) - pmnf_l1s1(c) = (plitr1c_loss(c) * (1.0_r8 - rf_l1s1 - ratio))/cn_s1 - end if - - ! litter 2 -> SOM 2 - if (litr2c(c) > 0._r8) then - plitr2c_loss(c) = litr2c(c) * ck_l2 / dt - ratio = 0._r8 - if (litr2n(c) > 0._r8) ratio = cn_s2/cn_l2(c) - pmnf_l2s2(c) = (plitr2c_loss(c) * (1.0_r8 - rf_l2s2 - ratio))/cn_s2 - end if - - ! litter 3 -> SOM 3 - if (litr3c(c) > 0._r8) then - plitr3c_loss(c) = litr3c(c) * ck_l3 / dt - ratio = 0._r8 - if (litr3n(c) > 0._r8) ratio = cn_s3/cn_l3(c) - pmnf_l3s3(c) = (plitr3c_loss(c) * (1.0_r8 - rf_l3s3 - ratio))/cn_s3 - end if - - ! SOM 1 -> SOM 2 - if (soil1c(c) > 0._r8) then - psoil1c_loss(c) = soil1c(c) * ck_s1 / dt - pmnf_s1s2(c) = (psoil1c_loss(c) * (1.0_r8 - rf_s1s2 - (cn_s2/cn_s1)))/cn_s2 - end if - - ! SOM 2 -> SOM 3 - if (soil2c(c) > 0._r8) then - psoil2c_loss(c) = soil2c(c) * ck_s2 / dt - pmnf_s2s3(c) = (psoil2c_loss(c) * (1.0_r8 - rf_s2s3 - (cn_s3/cn_s2)))/cn_s3 - end if - - ! SOM 3 -> SOM 4 - if (soil3c(c) > 0._r8) then - psoil3c_loss(c) = soil3c(c) * ck_s3 / dt - pmnf_s3s4(c) = (psoil3c_loss(c) * (1.0_r8 - rf_s3s4 - (cn_s4/cn_s3)))/cn_s4 - end if - - ! Loss from SOM 4 is entirely respiration (no downstream pool) - if (soil4c(c) > 0._r8) then - psoil4c_loss(c) = soil4c(c) * ck_s4 / dt - pmnf_s4(c) = -psoil4c_loss(c)/cn_s4 - end if - - ! Sum up all the potential immobilization fluxes (positive pmnf flux) - ! and all the mineralization fluxes (negative pmnf flux) - - immob(c) = 0._r8 - ! litter 1 -> SOM 1 - if (pmnf_l1s1(c) > 0._r8) then - immob(c) = immob(c) + pmnf_l1s1(c) - else - gross_nmin(c) = gross_nmin(c) - pmnf_l1s1(c) - end if - - ! litter 2 -> SOM 2 - if (pmnf_l2s2(c) > 0._r8) then - immob(c) = immob(c) + pmnf_l2s2(c) - else - gross_nmin(c) = gross_nmin(c) - pmnf_l2s2(c) - end if - - ! litter 3 -> SOM 3 - if (pmnf_l3s3(c) > 0._r8) then - immob(c) = immob(c) + pmnf_l3s3(c) - else - gross_nmin(c) = gross_nmin(c) - pmnf_l3s3(c) - end if - - ! SOM 1 -> SOM 2 - if (pmnf_s1s2(c) > 0._r8) then - immob(c) = immob(c) + pmnf_s1s2(c) - else - gross_nmin(c) = gross_nmin(c) - pmnf_s1s2(c) - end if - - ! SOM 2 -> SOM 3 - if (pmnf_s2s3(c) > 0._r8) then - immob(c) = immob(c) + pmnf_s2s3(c) - else - gross_nmin(c) = gross_nmin(c) - pmnf_s2s3(c) - end if - - ! SOM 3 -> SOM 4 - if (pmnf_s3s4(c) > 0._r8) then - immob(c) = immob(c) + pmnf_s3s4(c) - else - gross_nmin(c) = gross_nmin(c) - pmnf_s3s4(c) - end if - - ! SOM 4 - gross_nmin(c) = gross_nmin(c) - pmnf_s4(c) - - potential_immob(c) = immob(c) - - end do ! end column loop - - ! now that potential N immobilization is known, call allocation - ! to resolve the competition between plants and soil heterotrophs - ! for available soil mineral N resource. - - call CNAllocation(lbp, ubp, lbc,ubc,num_soilc,filter_soilc,num_soilp, & - filter_soilp, num_pcropp) - - ! column loop to calculate actual immobilization and decomp rates, following - ! resolution of plant/heterotroph competition for mineral N - - dnp = 0.01_r8 - - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! upon return from CNAllocation, the fraction of potential immobilization - ! has been set (cps%fpi). now finish the decomp calculations. - ! Only the immobilization steps are limited by fpi (pmnf > 0) - ! Also calculate denitrification losses as a simple proportion - ! of mineralization flux. - - ! litter 1 fluxes (labile pool) - if (litr1c(c) > 0._r8) then - if (pmnf_l1s1(c) > 0._r8) then - plitr1c_loss(c) = plitr1c_loss(c) * fpi(c) - pmnf_l1s1(c) = pmnf_l1s1(c) * fpi(c) - sminn_to_denit_l1s1(c) = 0._r8 - else - sminn_to_denit_l1s1(c) = -dnp * pmnf_l1s1(c) - end if - litr1_hr(c) = rf_l1s1 * plitr1c_loss(c) - litr1c_to_soil1c(c) = (1._r8 - rf_l1s1) * plitr1c_loss(c) - if (litr1n(c) > 0._r8) litr1n_to_soil1n(c) = plitr1c_loss(c) / cn_l1(c) - sminn_to_soil1n_l1(c) = pmnf_l1s1(c) - net_nmin(c) = net_nmin(c) - pmnf_l1s1(c) - end if - - ! litter 2 fluxes (cellulose pool) - if (litr2c(c) > 0._r8) then - if (pmnf_l2s2(c) > 0._r8) then - plitr2c_loss(c) = plitr2c_loss(c) * fpi(c) - pmnf_l2s2(c) = pmnf_l2s2(c) * fpi(c) - sminn_to_denit_l2s2(c) = 0._r8 - else - sminn_to_denit_l2s2(c) = -dnp * pmnf_l2s2(c) - end if - litr2_hr(c) = rf_l2s2 * plitr2c_loss(c) - litr2c_to_soil2c(c) = (1._r8 - rf_l2s2) * plitr2c_loss(c) - if (litr2n(c) > 0._r8) litr2n_to_soil2n(c) = plitr2c_loss(c) / cn_l2(c) - sminn_to_soil2n_l2(c) = pmnf_l2s2(c) - net_nmin(c) = net_nmin(c) - pmnf_l2s2(c) - end if - - ! litter 3 fluxes (lignin pool) - if (litr3c(c) > 0._r8) then - if (pmnf_l3s3(c) > 0._r8) then - plitr3c_loss(c) = plitr3c_loss(c) * fpi(c) - pmnf_l3s3(c) = pmnf_l3s3(c) * fpi(c) - sminn_to_denit_l3s3(c) = 0._r8 - else - sminn_to_denit_l3s3(c) = -dnp * pmnf_l3s3(c) - end if - litr3_hr(c) = rf_l3s3 * plitr3c_loss(c) - litr3c_to_soil3c(c) = (1._r8 - rf_l3s3) * plitr3c_loss(c) - if (litr3n(c) > 0._r8) litr3n_to_soil3n(c) = plitr3c_loss(c) / cn_l3(c) - sminn_to_soil3n_l3(c) = pmnf_l3s3(c) - net_nmin(c) = net_nmin(c) - pmnf_l3s3(c) - end if - - ! SOM 1 fluxes (fast rate soil organic matter pool) - if (soil1c(c) > 0._r8) then - if (pmnf_s1s2(c) > 0._r8) then - psoil1c_loss(c) = psoil1c_loss(c) * fpi(c) - pmnf_s1s2(c) = pmnf_s1s2(c) * fpi(c) - sminn_to_denit_s1s2(c) = 0._r8 - else - sminn_to_denit_s1s2(c) = -dnp * pmnf_s1s2(c) - end if - soil1_hr(c) = rf_s1s2 * psoil1c_loss(c) - soil1c_to_soil2c(c) = (1._r8 - rf_s1s2) * psoil1c_loss(c) - soil1n_to_soil2n(c) = psoil1c_loss(c) / cn_s1 - sminn_to_soil2n_s1(c) = pmnf_s1s2(c) - net_nmin(c) = net_nmin(c) - pmnf_s1s2(c) - end if - - ! SOM 2 fluxes (medium rate soil organic matter pool) - if (soil2c(c) > 0._r8) then - if (pmnf_s2s3(c) > 0._r8) then - psoil2c_loss(c) = psoil2c_loss(c) * fpi(c) - pmnf_s2s3(c) = pmnf_s2s3(c) * fpi(c) - sminn_to_denit_s2s3(c) = 0._r8 - else - sminn_to_denit_s2s3(c) = -dnp * pmnf_s2s3(c) - end if - soil2_hr(c) = rf_s2s3 * psoil2c_loss(c) - soil2c_to_soil3c(c) = (1._r8 - rf_s2s3) * psoil2c_loss(c) - soil2n_to_soil3n(c) = psoil2c_loss(c) / cn_s2 - sminn_to_soil3n_s2(c) = pmnf_s2s3(c) - net_nmin(c) = net_nmin(c) - pmnf_s2s3(c) - end if - - ! SOM 3 fluxes (slow rate soil organic matter pool) - if (soil3c(c) > 0._r8) then - if (pmnf_s3s4(c) > 0._r8) then - psoil3c_loss(c) = psoil3c_loss(c) * fpi(c) - pmnf_s3s4(c) = pmnf_s3s4(c) * fpi(c) - sminn_to_denit_s3s4(c) = 0._r8 - else - sminn_to_denit_s3s4(c) = -dnp * pmnf_s3s4(c) - end if - soil3_hr(c) = rf_s3s4 * psoil3c_loss(c) - soil3c_to_soil4c(c) = (1._r8 - rf_s3s4) * psoil3c_loss(c) - soil3n_to_soil4n(c) = psoil3c_loss(c) / cn_s3 - sminn_to_soil4n_s3(c) = pmnf_s3s4(c) - net_nmin(c) = net_nmin(c) - pmnf_s3s4(c) - end if - - ! SOM 4 fluxes (slowest rate soil organic matter pool) - if (soil4c(c) > 0._r8) then - soil4_hr(c) = psoil4c_loss(c) - soil4n_to_sminn(c) = psoil4c_loss(c) / cn_s4 - sminn_to_denit_s4(c) = -dnp * pmnf_s4(c) - net_nmin(c) = net_nmin(c) - pmnf_s4(c) - end if - - end do - - deallocate(fr) - -end subroutine CNDecompAlloc -!----------------------------------------------------------------------- - -end module CNDecompMod diff --git a/src_clm40/biogeochem/CNEcosystemDynMod.F90 b/src_clm40/biogeochem/CNEcosystemDynMod.F90 deleted file mode 100644 index 62bcc2ca90..0000000000 --- a/src_clm40/biogeochem/CNEcosystemDynMod.F90 +++ /dev/null @@ -1,259 +0,0 @@ -module CNEcosystemDynMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNEcosystemDynMod -! -! !DESCRIPTION: -! Ecosystem dynamics: phenology, vegetation -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varctl , only: flanduse_timeseries, use_c13 -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: CNEcosystemDynInit ! Ecosystem dynamics initialization - public :: CNEcosystemDyn ! Ecosystem dynamics: phenology, vegetation -! -! !REVISION HISTORY: -! Created by Peter Thornton -! 19 May 2009: PET - modified to include call to harvest routine -! -! -! !PRIVATE MEMBER FUNCTIONS: -! -! !PRIVATE TYPES: -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNEcosystemDynInit -! -! !INTERFACE: - subroutine CNEcosystemDynInit(lbc, ubc, lbp, ubp ) -! -! !DESCRIPTION: -! Initialzation of the CN Ecosystem dynamics. -! -! !USES: - use CNAllocationMod, only : CNAllocationInit - use CNPhenologyMod , only : CNPhenologyInit -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: lbp, ubp ! pft bounds -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 04/05/11, Erik Kluzek creation -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - call CNAllocationInit ( lbc, ubc, lbp, ubp ) - call CNPhenologyInit ( lbp, ubp ) - - end subroutine CNEcosystemDynInit - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNEcosystemDyn -! -! !INTERFACE: - subroutine CNEcosystemDyn(lbc, ubc, lbp, ubp, num_soilc, filter_soilc, & - num_soilp, filter_soilp, num_pcropp, filter_pcropp, doalb) -! -! !DESCRIPTION: -! The core CN code is executed here. Calculates fluxes for maintenance -! respiration, decomposition, allocation, phenology, and growth respiration. -! These routines happen on the radiation time step so that canopy structure -! stays synchronized with albedo calculations. -! -! !USES: - use clmtype - use spmdMod , only: masterproc - use CNSetValueMod , only: CNZeroFluxes - use CNNDynamicsMod , only: CNNDeposition,CNNFixation, CNNLeaching - use CNMRespMod , only: CNMResp - use CNDecompMod , only: CNDecompAlloc - use CNPhenologyMod , only: CNPhenology - use CNGRespMod , only: CNGResp - use CNCStateUpdate1Mod , only: CStateUpdate1,CStateUpdate0 - use CNNStateUpdate1Mod , only: NStateUpdate1 - use CNGapMortalityMod , only: CNGapMortality - use CNCStateUpdate2Mod , only: CStateUpdate2, CStateUpdate2h - use CNNStateUpdate2Mod , only: NStateUpdate2, NStateUpdate2h - use CNFireMod , only: CNFireArea, CNFireFluxes - use CNCStateUpdate3Mod , only: CStateUpdate3 - use CNNStateUpdate3Mod , only: NStateUpdate3 - use CNBalanceCheckMod , only: CBalanceCheck, NBalanceCheck - use CNPrecisionControlMod, only: CNPrecisionControl - use CNVegStructUpdateMod , only: CNVegStructUpdate - use CNAnnualUpdateMod , only: CNAnnualUpdate - use CNSummaryMod , only: CSummary, NSummary - - use CNC13StateUpdate1Mod , only: C13StateUpdate1,C13StateUpdate0 - use CNC13StateUpdate2Mod , only: C13StateUpdate2, C13StateUpdate2h - use CNC13StateUpdate3Mod , only: C13StateUpdate3 - use CNC13FluxMod , only: C13Flux1, C13Flux2, C13Flux2h, C13Flux3 - use C13SummaryMod , only: C13Summary - - use pftdynMod , only: CNHarvest - use CNWoodProductsMod , only: CNWoodProducts -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(ubc-lbc+1) ! filter for soil columns - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(ubp-lbp+1) ! filter for soil pfts - integer, intent(in) :: num_pcropp ! number of prog. crop pfts in filter - integer, intent(in) :: filter_pcropp(:)! filter for prognostic crop pfts - logical, intent(in) :: doalb ! true = surface albedo calculation time step -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 10/22/03, Peter Thornton: created from EcosystemDyn during migration to -! new vector code. -! 11/3/03, Peter Thornton: removed update of elai, esai, frac_veg_nosno_alb. -! These are now done in CNVegStructUpdate(), which is called -! prior to SurfaceAlbedo(). -! 11/13/03, Peter Thornton: switched from nolake to soil filtering. -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! -! local pointers to implicit out arguments -! -! !OTHER LOCAL VARIABLES: -! -!EOP -!----------------------------------------------------------------------- - - ! if (doalb) then - - ! Call the main CN routines - call CNZeroFluxes(num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CNNDeposition(lbc, ubc) - - call CNNFixation(num_soilc,filter_soilc) - - call CNMResp(lbc, ubc, num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CNDecompAlloc(lbp, ubp, lbc, ubc, num_soilc, filter_soilc, & - num_soilp, filter_soilp, num_pcropp) - - ! CNphenology needs to be called after CNdecompAlloc, because it - ! depends on current time-step fluxes to new growth on the last - ! litterfall timestep in deciduous systems - - call CNPhenology(num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_pcropp, filter_pcropp, doalb) - - call CNGResp(num_soilp, filter_soilp) - - call CStateUpdate0(num_soilp, filter_soilp) - - if (use_c13) then - call C13StateUpdate0(num_soilp, filter_soilp) - - call C13Flux1(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call CStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (use_c13) then - call C13StateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CNGapMortality(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (use_c13) then - call C13Flux2(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call CStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (use_c13) then - call C13StateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call NStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (flanduse_timeseries /= ' ') then - call CNHarvest(num_soilc, filter_soilc, num_soilp, filter_soilp) - end if - - if (use_c13) then - call C13Flux2h(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call CStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (use_c13) then - call C13StateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call NStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CNWoodProducts(num_soilc, filter_soilc) - - call CNFireArea(num_soilc, filter_soilc) - - call CNFireFluxes(num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CNNLeaching(lbc, ubc, num_soilc, filter_soilc) - - if (use_c13) then - call C13Flux3(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call CStateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (use_c13) then - call C13StateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call NStateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CNPrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (doalb) then - call CNVegStructUpdate(num_soilp, filter_soilp) - end if - -! call CNAnnualUpdate(num_soilc, filter_soilc, num_soilp, filter_soilp) - - call CSummary(num_soilc, filter_soilc, num_soilp, filter_soilp) - - if (use_c13) then - call C13Summary(num_soilc, filter_soilc, num_soilp, filter_soilp) - endif - - call NSummary(num_soilc, filter_soilc, num_soilp, filter_soilp) - -! end if !end of if-doalb block - - end subroutine CNEcosystemDyn - -!----------------------------------------------------------------------- -end module CNEcosystemDynMod diff --git a/src_clm40/biogeochem/CNFireMod.F90 b/src_clm40/biogeochem/CNFireMod.F90 deleted file mode 100644 index c703adf9bd..0000000000 --- a/src_clm40/biogeochem/CNFireMod.F90 +++ /dev/null @@ -1,668 +0,0 @@ -module CNFireMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNFireMod -! -! !DESCRIPTION: -! Module holding routines fire mod -! nitrogen code. -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_PI,SHR_CONST_TKFRZ - use pft2colMod , only: p2c - use clm_varctl , only: iulog, use_cn, use_cndv - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNFireArea - public :: CNFireFluxes -! -! !REVISION HISTORY: -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNFireArea -! -! !INTERFACE: -subroutine CNFireArea (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! Computes column-level area affected by fire in each timestep -! based on statistical fire model in Thonicke et al. 2001. -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size, get_nstep, get_days_per_year - use clm_varpar , only: max_pft_per_col - use clm_varcon , only: secspday - use clm_varctl , only: use_nofire -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns -! -! !CALLED FROM: -! subroutine CNEcosystemDyn in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - ! pft-level - real(r8), pointer :: wtcol(:) ! pft weight on the column - integer , pointer :: ivt(:) ! vegetation type for this pft - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - ! column-level - integer , pointer :: npfts(:) ! number of pfts on the column - integer , pointer :: pfti(:) ! pft index array - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: wf(:) ! soil water as frac. of whc for top 0.5 m - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - real(r8), pointer :: totlitc(:) ! (gC/m2) total litter C (not including cwdc) - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - ! PET 5/20/08, test to increase fire area - real(r8), pointer :: totvegc(:) ! (gC/m2) total veg C (column-level mean) - ! pointers for column averaging -! -! local pointers to implicit in/out scalars -! - ! column-level - real(r8), pointer :: me(:) ! column-level moisture of extinction (proportion) - real(r8), pointer :: fire_prob(:) ! daily fire probability (0-1) - real(r8), pointer :: mean_fire_prob(:) ! e-folding mean of daily fire probability (0-1) - real(r8), pointer :: fireseasonl(:) ! annual fire season length (days, <= days/year) - real(r8), pointer :: farea_burned(:) ! fractional area burned in this timestep (proportion) - real(r8), pointer :: ann_farea_burned(:) ! annual total fractional area burned (proportion) -! -! !OTHER LOCAL VARIABLES: -! real(r8), parameter:: minfuel = 200.0_r8 ! dead fuel threshold to carry a fire (gC/m2) -! PET, 5/30/08: changed from 200 to 100 gC/m2, since the original paper didn't specify -! the units as carbon, I am assuming that they were in dry biomass, so carbon would be ~50% - real(r8), parameter:: minfuel = 100.0_r8 ! dead fuel threshold to carry a fire (gC/m2) - real(r8), parameter:: me_woody = 0.3_r8 ! moisture of extinction for woody PFTs (proportion) - real(r8), parameter:: me_herb = 0.2_r8 ! moisture of extinction for herbaceous PFTs (proportion) - real(r8), parameter:: ef_time = 1.0_r8 ! e-folding time constant (years) - integer :: fc,c,pi,p ! index variables - real(r8):: dt ! time step variable (s) - real(r8):: fuelc ! temporary column-level litter + cwd C (gC/m2) - integer :: nef ! number of e-folding timesteps - real(r8):: ef_nsteps ! number of e-folding timesteps (real) - integer :: nstep ! current timestep number - real(r8):: m ! top-layer soil moisture (proportion) - real(r8):: mep ! pft-level moisture of extinction [proportion] - real(r8):: s2 ! (mean_fire_prob - 1.0) - real(r8):: dayspyr ! days per year -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type members (pft-level) - wtcol => pft%wtcol - ivt => pft%itype - pwtgcell => pft%wtgcell - woody => pftcon%woody - - ! assign local pointers to derived type members (column-level) - npfts => col%npfts - pfti => col%pfti - wf => cps%wf - me => cps%me - fire_prob => cps%fire_prob - mean_fire_prob => cps%mean_fire_prob - fireseasonl => cps%fireseasonl - farea_burned => cps%farea_burned - ann_farea_burned => cps%ann_farea_burned - t_grnd => ces%t_grnd - totlitc => ccs%totlitc - cwdc => ccs%cwdc - ! PET 5/20/08, test to increase fire area - totvegc => pcs_a%totvegc - - ! pft to column average for moisture of extinction - do fc = 1,num_soilc - c = filter_soilc(fc) - me(c) = 0._r8 - end do - mep = me_woody - do pi = 1,max_pft_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - if (pwtgcell(p)>0._r8) then - if (woody(ivt(p)) == 1) then - mep = me_woody - else - mep = me_herb - end if - end if - me(c) = me(c) + mep*wtcol(p) - end if - end do - end do - - ! Get model step size - dt = real( get_step_size(), r8 ) - - ! Set the number of timesteps for e-folding. - ! When the simulation has run fewer than this number of steps, - ! re-scale the e-folding time to get a stable early estimate. - nstep = get_nstep() - dayspyr = get_days_per_year() - nef = (ef_time*dayspyr*secspday)/dt - ef_nsteps = max(1,min(nstep,nef)) - - ! test code, added 6/6/05, PET - ! setting ef_nsteps to full count regardless of nstep, to see if this - ! gets rid of transient in fire stats for initial run from spunup - ! initial conditions - ef_nsteps = nef - - ! begin column loop to calculate fractional area affected by fire - - do fc = 1, num_soilc - c = filter_soilc(fc) - - ! dead fuel C (total litter + CWD) - fuelc = totlitc(c) + cwdc(c) - ! PET 5/20/08, test to increase fire area - ! PET, 5/30/08. going back to original treatment using dead fuel only - ! fuelc = fuelc + totvegc(c) - - ! m is the fractional soil mositure in the top layer (taken here - ! as the top 0.5 m) - ! PET 5/30/08 - note that this has been changed in Hydrology to use top 5 cm. - m = max(0._r8,wf(c)) - - - ! Calculate the probability of at least one fire in a day - ! in the gridcell. minfuel is the limit for dead fuels below which - ! fire is assumed unable to spread. - - if (t_grnd(c)>SHR_CONST_TKFRZ .and. fuelc>minfuel .and. me(c)>0._r8 .and. m<=me(c)) then - fire_prob(c) = exp(-SHR_CONST_PI * (m/me(c))**2) - else - fire_prob(c) = 0._r8 - end if - - ! Use e-folding to keep a running mean of daily fire probability, - ! which is then used to calculate annual fractional area burned. - ! mean_fire_prob corresponds to the variable s from Thonicke. - ! fireseasonl corresponds to the variable N from Thonicke. - ! ann_farea_burned corresponds to the variable A from Thonicke. - - mean_fire_prob(c) = (mean_fire_prob(c)*(ef_nsteps-1._r8) + fire_prob(c))/ef_nsteps - fireseasonl(c) = mean_fire_prob(c) * dayspyr - s2 = mean_fire_prob(c)-1._r8 - ann_farea_burned(c) = mean_fire_prob(c)*exp(s2/(0.45_r8*(s2**3) + 2.83_r8*(s2**2) + 2.96_r8*s2 + 1.04_r8)) - - ! Estimate the fractional area of the column affected by fire in this time step. - ! Over a year this should sum to a value near the annual - ! fractional area burned from equations above. - - if (fireseasonl(c) > 0._r8) then - farea_burned(c) = (fire_prob(c)/fireseasonl(c)) * ann_farea_burned(c) * (dt/secspday) - else - farea_burned(c) = 0._r8 - end if - - if (use_nofire) then - ! set the fire area 0 if NOFIRE flag is on - farea_burned(c) = 0._r8 - end if - - end do ! end of column loop - -end subroutine CNFireArea -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNFireFluxes -! -! !INTERFACE: -subroutine CNFireFluxes (num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Fire effects routine for coupled carbon-nitrogen code (CN). -! Relies primarily on estimate of fractional area burned in this -! timestep, from CNFireArea(). -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn() -! -! !REVISION HISTORY: -! 7/23/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: nind(:) ! number of individuals (#/m2) - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: resist(:) ! resistance to fire (no units) - integer , pointer :: pcolumn(:) ! pft's column index - real(r8), pointer :: farea_burned(:) ! timestep fractional area burned (proportion) - real(r8), pointer :: m_cwdc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_cwdc_fire(:) - real(r8), pointer :: m_deadstemc_to_cwdc_fire(:) - real(r8), pointer :: m_litr1c_to_fire(:) - real(r8), pointer :: m_litr2c_to_fire(:) - real(r8), pointer :: m_litr3c_to_fire(:) - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: m_cwdn_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_cwdn_fire(:) - real(r8), pointer :: m_deadstemn_to_cwdn_fire(:) - real(r8), pointer :: m_litr1n_to_fire(:) - real(r8), pointer :: m_litr2n_to_fire(:) - real(r8), pointer :: m_litr3n_to_fire(:) - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: m_deadcrootc_storage_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_litter_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_fire(:) - real(r8), pointer :: m_deadstemc_storage_to_fire(:) - real(r8), pointer :: m_deadstemc_to_fire(:) - real(r8), pointer :: m_deadstemc_to_litter_fire(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_deadstemc_xfer_to_fire(:) - real(r8), pointer :: m_frootc_storage_to_fire(:) - real(r8), pointer :: m_frootc_to_fire(:) - real(r8), pointer :: m_frootc_xfer_to_fire(:) - real(r8), pointer :: m_gresp_storage_to_fire(:) - real(r8), pointer :: m_gresp_xfer_to_fire(:) - real(r8), pointer :: m_leafc_storage_to_fire(:) - real(r8), pointer :: m_leafc_to_fire(:) - real(r8), pointer :: m_leafc_xfer_to_fire(:) - real(r8), pointer :: m_livecrootc_storage_to_fire(:) - real(r8), pointer :: m_livecrootc_to_fire(:) - real(r8), pointer :: m_livecrootc_xfer_to_fire(:) - real(r8), pointer :: m_livestemc_storage_to_fire(:) - real(r8), pointer :: m_livestemc_to_fire(:) - real(r8), pointer :: m_livestemc_xfer_to_fire(:) - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) !(gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafcmax(:) ! (gC/m2) ann max leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) !(gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: m_deadcrootn_storage_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_litter_fire(:) - real(r8), pointer :: m_deadcrootn_xfer_to_fire(:) - real(r8), pointer :: m_deadstemn_storage_to_fire(:) - real(r8), pointer :: m_deadstemn_to_fire(:) - real(r8), pointer :: m_deadstemn_to_litter_fire(:) - real(r8), pointer :: m_deadstemn_xfer_to_fire(:) - real(r8), pointer :: m_frootn_storage_to_fire(:) - real(r8), pointer :: m_frootn_to_fire(:) - real(r8), pointer :: m_frootn_xfer_to_fire(:) - real(r8), pointer :: m_leafn_storage_to_fire(:) - real(r8), pointer :: m_leafn_to_fire(:) - real(r8), pointer :: m_leafn_xfer_to_fire(:) - real(r8), pointer :: m_livecrootn_storage_to_fire(:) - real(r8), pointer :: m_livecrootn_to_fire(:) - real(r8), pointer :: m_livecrootn_xfer_to_fire(:) - real(r8), pointer :: m_livestemn_storage_to_fire(:) - real(r8), pointer :: m_livestemn_to_fire(:) - real(r8), pointer :: m_livestemn_xfer_to_fire(:) - real(r8), pointer :: m_retransn_to_fire(:) - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N -! -! !OTHER LOCAL VARIABLES: - !real(r8), parameter:: wcf = 0.2_r8 ! wood combustion fraction - real(r8), parameter:: wcf = 0.4_r8 ! wood combustion fraction - integer :: c,p ! indices - integer :: fp,fc ! filter indices - real(r8):: f ! rate for fire effects (1/s) - real(r8):: dt ! time step variable (s) -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers - - nind => pdgvs%nind - ivt => pft%itype - pcolumn => pft%column - woody => pftcon%woody - resist => pftcon%resist - farea_burned => cps%farea_burned - m_cwdc_to_fire => ccf%m_cwdc_to_fire - m_deadcrootc_to_cwdc_fire => ccf%m_deadcrootc_to_cwdc_fire - m_deadstemc_to_cwdc_fire => ccf%m_deadstemc_to_cwdc_fire - m_litr1c_to_fire => ccf%m_litr1c_to_fire - m_litr2c_to_fire => ccf%m_litr2c_to_fire - m_litr3c_to_fire => ccf%m_litr3c_to_fire - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - m_cwdn_to_fire => cnf%m_cwdn_to_fire - m_deadcrootn_to_cwdn_fire => cnf%m_deadcrootn_to_cwdn_fire - m_deadstemn_to_cwdn_fire => cnf%m_deadstemn_to_cwdn_fire - m_litr1n_to_fire => cnf%m_litr1n_to_fire - m_litr2n_to_fire => cnf%m_litr2n_to_fire - m_litr3n_to_fire => cnf%m_litr3n_to_fire - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - m_deadcrootc_storage_to_fire => pcf%m_deadcrootc_storage_to_fire - m_deadcrootc_to_fire => pcf%m_deadcrootc_to_fire - m_deadcrootc_to_litter_fire => pcf%m_deadcrootc_to_litter_fire - m_deadcrootc_xfer_to_fire => pcf%m_deadcrootc_xfer_to_fire - m_deadstemc_storage_to_fire => pcf%m_deadstemc_storage_to_fire - m_deadstemc_to_fire => pcf%m_deadstemc_to_fire - m_deadstemc_to_litter_fire => pcf%m_deadstemc_to_litter_fire - m_deadstemc_to_litter => pcf%m_deadstemc_to_litter - m_livestemc_to_litter => pcf%m_livestemc_to_litter - m_deadcrootc_to_litter => pcf%m_deadcrootc_to_litter - m_livecrootc_to_litter => pcf%m_livecrootc_to_litter - m_deadstemc_xfer_to_fire => pcf%m_deadstemc_xfer_to_fire - m_frootc_storage_to_fire => pcf%m_frootc_storage_to_fire - m_frootc_to_fire => pcf%m_frootc_to_fire - m_frootc_xfer_to_fire => pcf%m_frootc_xfer_to_fire - m_gresp_storage_to_fire => pcf%m_gresp_storage_to_fire - m_gresp_xfer_to_fire => pcf%m_gresp_xfer_to_fire - m_leafc_storage_to_fire => pcf%m_leafc_storage_to_fire - m_leafc_to_fire => pcf%m_leafc_to_fire - m_leafc_xfer_to_fire => pcf%m_leafc_xfer_to_fire - m_livecrootc_storage_to_fire => pcf%m_livecrootc_storage_to_fire - m_livecrootc_to_fire => pcf%m_livecrootc_to_fire - m_livecrootc_xfer_to_fire => pcf%m_livecrootc_xfer_to_fire - m_livestemc_storage_to_fire => pcf%m_livestemc_storage_to_fire - m_livestemc_to_fire => pcf%m_livestemc_to_fire - m_livestemc_xfer_to_fire => pcf%m_livestemc_xfer_to_fire - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafcmax => pcs%leafcmax - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - m_deadcrootn_storage_to_fire => pnf%m_deadcrootn_storage_to_fire - m_deadcrootn_to_fire => pnf%m_deadcrootn_to_fire - m_deadcrootn_to_litter_fire => pnf%m_deadcrootn_to_litter_fire - m_deadcrootn_xfer_to_fire => pnf%m_deadcrootn_xfer_to_fire - m_deadstemn_storage_to_fire => pnf%m_deadstemn_storage_to_fire - m_deadstemn_to_fire => pnf%m_deadstemn_to_fire - m_deadstemn_to_litter_fire => pnf%m_deadstemn_to_litter_fire - m_deadstemn_xfer_to_fire => pnf%m_deadstemn_xfer_to_fire - m_frootn_storage_to_fire => pnf%m_frootn_storage_to_fire - m_frootn_to_fire => pnf%m_frootn_to_fire - m_frootn_xfer_to_fire => pnf%m_frootn_xfer_to_fire - m_leafn_storage_to_fire => pnf%m_leafn_storage_to_fire - m_leafn_to_fire => pnf%m_leafn_to_fire - m_leafn_xfer_to_fire => pnf%m_leafn_xfer_to_fire - m_livecrootn_storage_to_fire => pnf%m_livecrootn_storage_to_fire - m_livecrootn_to_fire => pnf%m_livecrootn_to_fire - m_livecrootn_xfer_to_fire => pnf%m_livecrootn_xfer_to_fire - m_livestemn_storage_to_fire => pnf%m_livestemn_storage_to_fire - m_livestemn_to_fire => pnf%m_livestemn_to_fire - m_livestemn_xfer_to_fire => pnf%m_livestemn_xfer_to_fire - m_retransn_to_fire => pnf%m_retransn_to_fire - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - retransn => pns%retransn - - - ! Get model step size - - dt = real( get_step_size(), r8 ) - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = pcolumn(p) - - ! get the column-level fractional area burned for this timestep - ! and convert to a rate per second, then scale by the pft-level - ! fire resistance - f = (farea_burned(c) / dt) * (1._r8 - resist(ivt(p))) - - ! apply this rate to the pft state variables to get flux rates - - ! NOTE: the deadstem and deadcroot pools are only partly consumed - ! by fire, and the remaining affected fraction goes to the column-level - ! as litter (coarse woody debris). This is controlled by wcf, the woody - ! combustion fraction. - - ! carbon fluxes - m_leafc_to_fire(p) = leafc(p) * f - m_leafc_storage_to_fire(p) = leafc_storage(p) * f - m_leafc_xfer_to_fire(p) = leafc_xfer(p) * f - m_frootc_to_fire(p) = frootc(p) * f - m_frootc_storage_to_fire(p) = frootc_storage(p) * f - m_frootc_xfer_to_fire(p) = frootc_xfer(p) * f - m_livestemc_to_fire(p) = livestemc(p) * f - m_livestemc_storage_to_fire(p) = livestemc_storage(p) * f - m_livestemc_xfer_to_fire(p) = livestemc_xfer(p) * f - m_deadstemc_to_fire(p) = deadstemc(p) * f*wcf - m_deadstemc_to_litter_fire(p) = deadstemc(p) * f*(1._r8 - wcf) - m_deadstemc_storage_to_fire(p) = deadstemc_storage(p) * f - m_deadstemc_xfer_to_fire(p) = deadstemc_xfer(p) * f - m_livecrootc_to_fire(p) = livecrootc(p) * f - m_livecrootc_storage_to_fire(p) = livecrootc_storage(p) * f - m_livecrootc_xfer_to_fire(p) = livecrootc_xfer(p) * f - m_deadcrootc_to_fire(p) = deadcrootc(p) * f*wcf - m_deadcrootc_to_litter_fire(p) = deadcrootc(p) * f*(1._r8 - wcf) - m_deadcrootc_storage_to_fire(p) = deadcrootc_storage(p) * f - m_deadcrootc_xfer_to_fire(p) = deadcrootc_xfer(p) * f - m_gresp_storage_to_fire(p) = gresp_storage(p) * f - m_gresp_xfer_to_fire(p) = gresp_xfer(p) * f - - ! nitrogen fluxes - m_leafn_to_fire(p) = leafn(p) * f - m_leafn_storage_to_fire(p) = leafn_storage(p) * f - m_leafn_xfer_to_fire(p) = leafn_xfer(p) * f - m_frootn_to_fire(p) = frootn(p) * f - m_frootn_storage_to_fire(p) = frootn_storage(p) * f - m_frootn_xfer_to_fire(p) = frootn_xfer(p) * f - m_livestemn_to_fire(p) = livestemn(p) * f - m_livestemn_storage_to_fire(p) = livestemn_storage(p) * f - m_livestemn_xfer_to_fire(p) = livestemn_xfer(p) * f - m_deadstemn_to_fire(p) = deadstemn(p) * f*wcf - m_deadstemn_to_litter_fire(p) = deadstemn(p) * f*(1._r8 - wcf) - m_deadstemn_storage_to_fire(p) = deadstemn_storage(p) * f - m_deadstemn_xfer_to_fire(p) = deadstemn_xfer(p) * f - m_livecrootn_to_fire(p) = livecrootn(p) * f - m_livecrootn_storage_to_fire(p) = livecrootn_storage(p) * f - m_livecrootn_xfer_to_fire(p) = livecrootn_xfer(p) * f - m_deadcrootn_to_fire(p) = deadcrootn(p) * f*wcf - m_deadcrootn_to_litter_fire(p) = deadcrootn(p) * f*(1._r8 - wcf) - m_deadcrootn_storage_to_fire(p) = deadcrootn_storage(p) * f - m_deadcrootn_xfer_to_fire(p) = deadcrootn_xfer(p) * f - m_retransn_to_fire(p) = retransn(p) * f - - if (use_cndv) then - ! Carbon per individual (c) remains constant in gap mortality & fire - ! but individuals are removed from the population P (#/m2 naturally - ! vegetated area), so - ! - ! c = Cnew*FPC/Pnew = Cold*FPC/Pold - ! - ! where C = carbon/m2 pft area & FPC = pft area/naturally vegetated area. - ! FPC does not change from mortality or fire. FPC changes from Light and - ! Establishment at the end of the year. So... - ! - ! Pnew = Pold * Cnew / Cold - ! - ! where "new" refers to after mortality & fire, while "old" refers to - ! before mortality & fire. For C I use total wood. (slevis) - ! - ! nind calculation placed here for convenience; nind could be updated - ! once per year instead if we saved Cold for that calculation; - ! as is, nind slowly decreases through the year, while fpcgrid remains - ! unchanged; this affects the htop calculation in CNVegStructUpdate - - if (woody(ivt(p)) == 1._r8) then - if (livestemc(p)+deadstemc(p)+m_livestemc_to_litter(p)*dt+ & - m_deadstemc_to_litter(p)*dt > 0._r8) then - nind(p) = nind(p) * (livestemc(p) + deadstemc(p) + & - livecrootc(p) + deadcrootc(p) - dt * & - (m_livestemc_to_fire(p) + & - m_livecrootc_to_fire(p) + & - m_deadstemc_to_fire(p) + & - m_deadcrootc_to_fire(p) + & - m_deadcrootc_to_litter_fire(p) + & - m_deadstemc_to_litter_fire(p))) / & - (livestemc(p) + deadstemc(p) + & - livecrootc(p) + deadcrootc(p) + dt * & - (m_livestemc_to_litter(p) + & - m_livecrootc_to_litter(p) + & - m_deadcrootc_to_litter(p) + & - m_deadstemc_to_litter(p))) - else - nind(p) = 0._r8 - end if - end if - - ! annual dgvm calculations use lm_ind = leafcmax * fpcgrid / nind - ! leafcmax is reset to 0 once per yr - ! could calculate leafcmax in CSummary instead; if so, should remove - ! subtraction of m_leafc_to_fire(p)*dt from the calculation (slevis) - - leafcmax(p) = max(leafc(p)-m_leafc_to_fire(p)*dt, leafcmax(p)) - if (ivt(p) == 0) leafcmax(p) = 0._r8 - end if - - end do ! end of pfts loop - - ! send the fire affected but uncombusted woody fraction to the column-level cwd fluxes - ! use p2c for weighted averaging from pft to column - call p2c(num_soilc, filter_soilc, m_deadstemc_to_litter_fire, m_deadstemc_to_cwdc_fire) - call p2c(num_soilc, filter_soilc, m_deadcrootc_to_litter_fire, m_deadcrootc_to_cwdc_fire) - call p2c(num_soilc, filter_soilc, m_deadstemn_to_litter_fire, m_deadstemn_to_cwdn_fire) - call p2c(num_soilc, filter_soilc, m_deadcrootn_to_litter_fire, m_deadcrootn_to_cwdn_fire) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! get the column-level fractional area burned for this timestep - ! and convert to a rate per second, then scale by the pft-level - ! fire resistance - - f = farea_burned(c) / dt - - ! apply this rate to the column state variables to get flux rates - - ! NOTE: the coarse woody debris pools are only partly consumed - ! by fire. This is controlled by wcf, the woody - ! combustion fraction. For now using the same fraction for standing - ! wood (deadstem and deadcroot pools) and woody litter (cwd pools). - ! May be a good idea later to modify this to use different fractions - ! for different woody pools, or make the combustion fraction a dynamic - ! variable. - - ! carbon fluxes - m_litr1c_to_fire(c) = litr1c(c) * f - m_litr2c_to_fire(c) = litr2c(c) * f - m_litr3c_to_fire(c) = litr3c(c) * f - m_cwdc_to_fire(c) = cwdc(c) * f*wcf - - ! nitrogen fluxes - m_litr1n_to_fire(c) = litr1n(c) * f - m_litr2n_to_fire(c) = litr2n(c) * f - m_litr3n_to_fire(c) = litr3n(c) * f - m_cwdn_to_fire(c) = cwdn(c) * f*wcf - - end do ! end of column loop - -end subroutine CNFireFluxes -!----------------------------------------------------------------------- - -end module CNFireMod diff --git a/src_clm40/biogeochem/CNGRespMod.F90 b/src_clm40/biogeochem/CNGRespMod.F90 deleted file mode 100644 index efadd86e98..0000000000 --- a/src_clm40/biogeochem/CNGRespMod.F90 +++ /dev/null @@ -1,221 +0,0 @@ -module CNGRespMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNGRespMod -! -! !DESCRIPTION: -! Module for growth respiration fluxes, -! for coupled carbon-nitrogen code. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNGResp -! -! !REVISION HISTORY: -! 9/12/03: Created by Peter Thornton -! 10/27/03, Peter Thornton: migrated to vector data structures -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNGResp -! -! !INTERFACE: -subroutine CNGResp(num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic carbon state -! variables -! -! !USES: - use clmtype - use pftvarcon, only : npcropmin, grperc, grpnow -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn, in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: cpool_to_leafc(:) - real(r8), pointer :: cpool_to_leafc_storage(:) - real(r8), pointer :: cpool_to_frootc(:) - real(r8), pointer :: cpool_to_frootc_storage(:) - real(r8), pointer :: cpool_to_livestemc(:) - real(r8), pointer :: cpool_to_livestemc_storage(:) - real(r8), pointer :: cpool_to_deadstemc(:) - real(r8), pointer :: cpool_to_deadstemc_storage(:) - real(r8), pointer :: cpool_to_livecrootc(:) - real(r8), pointer :: cpool_to_livecrootc_storage(:) - real(r8), pointer :: cpool_to_deadcrootc(:) ! allocation to dead coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc_storage(:) ! allocation to dead coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_grainc(:) ! allocation to grain C (gC/m2/s) - real(r8), pointer :: cpool_to_grainc_storage(:) ! allocation to grain C storage (gC/m2/s) - real(r8), pointer :: grainc_xfer_to_grainc(:) ! grain C growth from storage (gC/m2/s) - real(r8), pointer :: leafc_xfer_to_leafc(:) ! leaf C growth from storage (gC/m2/s) - real(r8), pointer :: frootc_xfer_to_frootc(:) ! fine root C growth from storage (gC/m2/s) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) ! live stem C growth from storage (gC/m2/s) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) ! dead stem C growth from storage (gC/m2/s) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) ! live coarse root C growth from storage (gC/m2/s) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) ! dead coarse root C growth from storage (gC/m2/s) - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: cpool_grain_gr(:) - real(r8), pointer :: cpool_grain_storage_gr(:) - real(r8), pointer :: transfer_grain_gr(:) - real(r8), pointer :: cpool_leaf_gr(:) - real(r8), pointer :: cpool_leaf_storage_gr(:) - real(r8), pointer :: transfer_leaf_gr(:) - real(r8), pointer :: cpool_froot_gr(:) - real(r8), pointer :: cpool_froot_storage_gr(:) - real(r8), pointer :: transfer_froot_gr(:) - real(r8), pointer :: cpool_livestem_gr(:) - real(r8), pointer :: cpool_livestem_storage_gr(:) - real(r8), pointer :: transfer_livestem_gr(:) - real(r8), pointer :: cpool_deadstem_gr(:) - real(r8), pointer :: cpool_deadstem_storage_gr(:) - real(r8), pointer :: transfer_deadstem_gr(:) - real(r8), pointer :: cpool_livecroot_gr(:) - real(r8), pointer :: cpool_livecroot_storage_gr(:) - real(r8), pointer :: transfer_livecroot_gr(:) - real(r8), pointer :: cpool_deadcroot_gr(:) - real(r8), pointer :: cpool_deadcroot_storage_gr(:) - real(r8), pointer :: transfer_deadcroot_gr(:) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter pft index - -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - ivt => pft%itype - cpool_to_leafc => pcf%cpool_to_leafc - cpool_to_leafc_storage => pcf%cpool_to_leafc_storage - cpool_to_frootc => pcf%cpool_to_frootc - cpool_to_frootc_storage => pcf%cpool_to_frootc_storage - cpool_to_livestemc => pcf%cpool_to_livestemc - cpool_to_livestemc_storage => pcf%cpool_to_livestemc_storage - cpool_to_deadstemc => pcf%cpool_to_deadstemc - cpool_to_deadstemc_storage => pcf%cpool_to_deadstemc_storage - cpool_to_livecrootc => pcf%cpool_to_livecrootc - cpool_to_livecrootc_storage => pcf%cpool_to_livecrootc_storage - cpool_to_deadcrootc => pcf%cpool_to_deadcrootc - cpool_to_deadcrootc_storage => pcf%cpool_to_deadcrootc_storage - cpool_to_grainc => pcf%cpool_to_grainc - cpool_to_grainc_storage => pcf%cpool_to_grainc_storage - grainc_xfer_to_grainc => pcf%grainc_xfer_to_grainc - leafc_xfer_to_leafc => pcf%leafc_xfer_to_leafc - frootc_xfer_to_frootc => pcf%frootc_xfer_to_frootc - livestemc_xfer_to_livestemc => pcf%livestemc_xfer_to_livestemc - deadstemc_xfer_to_deadstemc => pcf%deadstemc_xfer_to_deadstemc - livecrootc_xfer_to_livecrootc => pcf%livecrootc_xfer_to_livecrootc - deadcrootc_xfer_to_deadcrootc => pcf%deadcrootc_xfer_to_deadcrootc - woody => pftcon%woody - - ! Assign local pointers to derived type arrays (out) - cpool_grain_gr => pcf%cpool_grain_gr - cpool_grain_storage_gr => pcf%cpool_grain_storage_gr - transfer_grain_gr => pcf%transfer_grain_gr - cpool_leaf_gr => pcf%cpool_leaf_gr - cpool_leaf_storage_gr => pcf%cpool_leaf_storage_gr - transfer_leaf_gr => pcf%transfer_leaf_gr - cpool_froot_gr => pcf%cpool_froot_gr - cpool_froot_storage_gr => pcf%cpool_froot_storage_gr - transfer_froot_gr => pcf%transfer_froot_gr - cpool_livestem_gr => pcf%cpool_livestem_gr - cpool_livestem_storage_gr => pcf%cpool_livestem_storage_gr - transfer_livestem_gr => pcf%transfer_livestem_gr - cpool_deadstem_gr => pcf%cpool_deadstem_gr - cpool_deadstem_storage_gr => pcf%cpool_deadstem_storage_gr - transfer_deadstem_gr => pcf%transfer_deadstem_gr - cpool_livecroot_gr => pcf%cpool_livecroot_gr - cpool_livecroot_storage_gr => pcf%cpool_livecroot_storage_gr - transfer_livecroot_gr => pcf%transfer_livecroot_gr - cpool_deadcroot_gr => pcf%cpool_deadcroot_gr - cpool_deadcroot_storage_gr => pcf%cpool_deadcroot_storage_gr - transfer_deadcroot_gr => pcf%transfer_deadcroot_gr - - ! Loop through pfts - ! start pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) - cpool_livestem_storage_gr(p) = cpool_to_livestemc_storage(p) * & - grperc(ivt(p)) * grpnow(ivt(p)) - transfer_livestem_gr(p) = livestemc_xfer_to_livestemc(p) * & - grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - cpool_grain_gr(p) = cpool_to_grainc(p) * grperc(ivt(p)) - cpool_grain_storage_gr(p) = cpool_to_grainc_storage(p) * & - grperc(ivt(p)) * grpnow(ivt(p)) - transfer_grain_gr(p) = grainc_xfer_to_grainc(p) * grperc(ivt(p)) & - * (1._r8 - grpnow(ivt(p))) - end if - - ! leaf and fine root growth respiration - cpool_leaf_gr(p) = cpool_to_leafc(p) * grperc(ivt(p)) - cpool_leaf_storage_gr(p) = cpool_to_leafc_storage(p) * grperc(ivt(p)) * & - grpnow(ivt(p)) - transfer_leaf_gr(p) = leafc_xfer_to_leafc(p) * grperc(ivt(p)) * & - (1._r8 - grpnow(ivt(p))) - cpool_froot_gr(p) = cpool_to_frootc(p) * grperc(ivt(p)) - cpool_froot_storage_gr(p) = cpool_to_frootc_storage(p) * grperc(ivt(p)) * & - grpnow(ivt(p)) - transfer_froot_gr(p) = frootc_xfer_to_frootc(p) * grperc(ivt(p)) * & - (1._r8 - grpnow(ivt(p))) - - if (woody(ivt(p)) == 1._r8) then - cpool_livestem_gr(p) = cpool_to_livestemc(p) * grperc(ivt(p)) - cpool_livestem_storage_gr(p) = cpool_to_livestemc_storage(p) * & - grperc(ivt(p)) * grpnow(ivt(p)) - transfer_livestem_gr(p) = livestemc_xfer_to_livestemc(p) * & - grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - cpool_deadstem_gr(p) = cpool_to_deadstemc(p) * grperc(ivt(p)) - cpool_deadstem_storage_gr(p) = cpool_to_deadstemc_storage(p) * & - grperc(ivt(p)) * grpnow(ivt(p)) - transfer_deadstem_gr(p) = deadstemc_xfer_to_deadstemc(p) * & - grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - cpool_livecroot_gr(p) = cpool_to_livecrootc(p) * grperc(ivt(p)) - cpool_livecroot_storage_gr(p) = cpool_to_livecrootc_storage(p) * & - grperc(ivt(p)) * grpnow(ivt(p)) - transfer_livecroot_gr(p) = livecrootc_xfer_to_livecrootc(p) * & - grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - cpool_deadcroot_gr(p) = cpool_to_deadcrootc(p) * grperc(ivt(p)) - cpool_deadcroot_storage_gr(p) = cpool_to_deadcrootc_storage(p) * & - grperc(ivt(p)) * grpnow(ivt(p)) - transfer_deadcroot_gr(p) = deadcrootc_xfer_to_deadcrootc(p) * & - grperc(ivt(p)) * (1._r8 - grpnow(ivt(p))) - end if - - end do - -end subroutine CNGResp - -end module CNGRespMod diff --git a/src_clm40/biogeochem/CNGapMortalityMod.F90 b/src_clm40/biogeochem/CNGapMortalityMod.F90 deleted file mode 100644 index 368f796170..0000000000 --- a/src_clm40/biogeochem/CNGapMortalityMod.F90 +++ /dev/null @@ -1,717 +0,0 @@ -module CNGapMortalityMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNGapMortalityMod -! -! !DESCRIPTION: -! Module holding routines used in gap mortality for coupled carbon -! nitrogen code. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNGapMortality -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNGapMortality -! -! !INTERFACE: -subroutine CNGapMortality (num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Gap-phase mortality routine for coupled carbon-nitrogen code (CN) -! -! !USES: - use clmtype - use clm_time_manager, only: get_days_per_year - use clm_varcon , only: secspday - use clm_varctl , only: use_cndv -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! column filter for soil points - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! pft filter for soil points -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arrays - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: woody(:) ! binary flag for woody lifeform - ! (1=woody, 0=not woody) - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: greffic(:) - real(r8), pointer :: heatstress(:) -! -! local pointers to implicit in/out arrays -! -! local pointers to implicit out arrays - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) - real(r8), pointer :: m_leafn_to_litter(:) - real(r8), pointer :: m_frootn_to_litter(:) - real(r8), pointer :: m_livestemn_to_litter(:) - real(r8), pointer :: m_deadstemn_to_litter(:) - real(r8), pointer :: m_livecrootn_to_litter(:) - real(r8), pointer :: m_deadcrootn_to_litter(:) - real(r8), pointer :: m_retransn_to_litter(:) - real(r8), pointer :: m_leafn_storage_to_litter(:) - real(r8), pointer :: m_frootn_storage_to_litter(:) - real(r8), pointer :: m_livestemn_storage_to_litter(:) - real(r8), pointer :: m_deadstemn_storage_to_litter(:) - real(r8), pointer :: m_livecrootn_storage_to_litter(:) - real(r8), pointer :: m_deadcrootn_storage_to_litter(:) - real(r8), pointer :: m_leafn_xfer_to_litter(:) - real(r8), pointer :: m_frootn_xfer_to_litter(:) - real(r8), pointer :: m_livestemn_xfer_to_litter(:) - real(r8), pointer :: m_deadstemn_xfer_to_litter(:) - real(r8), pointer :: m_livecrootn_xfer_to_litter(:) - real(r8), pointer :: m_deadcrootn_xfer_to_litter(:) -! -! !OTHER LOCAL VARIABLES: - integer :: p ! pft index - integer :: fp ! pft filter index - real(r8):: am ! rate for fractional mortality (1/yr) - real(r8):: m ! rate for fractional mortality (1/s) - real(r8):: mort_max ! asymptotic max mortality rate (/yr) - real(r8), parameter :: k_mort = 0.3 !coeff of growth efficiency in mortality equation -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers - woody => pftcon%woody - - ! assign local pointers to pft-level arrays - ivt => pft%itype - leafc => pcs%leafc - frootc => pcs%frootc - livestemc => pcs%livestemc - deadstemc => pcs%deadstemc - livecrootc => pcs%livecrootc - deadcrootc => pcs%deadcrootc - leafc_storage => pcs%leafc_storage - frootc_storage => pcs%frootc_storage - livestemc_storage => pcs%livestemc_storage - deadstemc_storage => pcs%deadstemc_storage - livecrootc_storage => pcs%livecrootc_storage - deadcrootc_storage => pcs%deadcrootc_storage - gresp_storage => pcs%gresp_storage - leafc_xfer => pcs%leafc_xfer - frootc_xfer => pcs%frootc_xfer - livestemc_xfer => pcs%livestemc_xfer - deadstemc_xfer => pcs%deadstemc_xfer - livecrootc_xfer => pcs%livecrootc_xfer - deadcrootc_xfer => pcs%deadcrootc_xfer - gresp_xfer => pcs%gresp_xfer - leafn => pns%leafn - frootn => pns%frootn - livestemn => pns%livestemn - deadstemn => pns%deadstemn - livecrootn => pns%livecrootn - deadcrootn => pns%deadcrootn - retransn => pns%retransn - leafn_storage => pns%leafn_storage - frootn_storage => pns%frootn_storage - livestemn_storage => pns%livestemn_storage - deadstemn_storage => pns%deadstemn_storage - livecrootn_storage => pns%livecrootn_storage - deadcrootn_storage => pns%deadcrootn_storage - leafn_xfer => pns%leafn_xfer - frootn_xfer => pns%frootn_xfer - livestemn_xfer => pns%livestemn_xfer - deadstemn_xfer => pns%deadstemn_xfer - livecrootn_xfer => pns%livecrootn_xfer - deadcrootn_xfer => pns%deadcrootn_xfer - m_leafc_to_litter => pcf%m_leafc_to_litter - m_frootc_to_litter => pcf%m_frootc_to_litter - m_livestemc_to_litter => pcf%m_livestemc_to_litter - m_deadstemc_to_litter => pcf%m_deadstemc_to_litter - m_livecrootc_to_litter => pcf%m_livecrootc_to_litter - m_deadcrootc_to_litter => pcf%m_deadcrootc_to_litter - m_leafc_storage_to_litter => pcf%m_leafc_storage_to_litter - m_frootc_storage_to_litter => pcf%m_frootc_storage_to_litter - m_livestemc_storage_to_litter => pcf%m_livestemc_storage_to_litter - m_deadstemc_storage_to_litter => pcf%m_deadstemc_storage_to_litter - m_livecrootc_storage_to_litter => pcf%m_livecrootc_storage_to_litter - m_deadcrootc_storage_to_litter => pcf%m_deadcrootc_storage_to_litter - m_gresp_storage_to_litter => pcf%m_gresp_storage_to_litter - m_leafc_xfer_to_litter => pcf%m_leafc_xfer_to_litter - m_frootc_xfer_to_litter => pcf%m_frootc_xfer_to_litter - m_livestemc_xfer_to_litter => pcf%m_livestemc_xfer_to_litter - m_deadstemc_xfer_to_litter => pcf%m_deadstemc_xfer_to_litter - m_livecrootc_xfer_to_litter => pcf%m_livecrootc_xfer_to_litter - m_deadcrootc_xfer_to_litter => pcf%m_deadcrootc_xfer_to_litter - m_gresp_xfer_to_litter => pcf%m_gresp_xfer_to_litter - m_leafn_to_litter => pnf%m_leafn_to_litter - m_frootn_to_litter => pnf%m_frootn_to_litter - m_livestemn_to_litter => pnf%m_livestemn_to_litter - m_deadstemn_to_litter => pnf%m_deadstemn_to_litter - m_livecrootn_to_litter => pnf%m_livecrootn_to_litter - m_deadcrootn_to_litter => pnf%m_deadcrootn_to_litter - m_retransn_to_litter => pnf%m_retransn_to_litter - m_leafn_storage_to_litter => pnf%m_leafn_storage_to_litter - m_frootn_storage_to_litter => pnf%m_frootn_storage_to_litter - m_livestemn_storage_to_litter => pnf%m_livestemn_storage_to_litter - m_deadstemn_storage_to_litter => pnf%m_deadstemn_storage_to_litter - m_livecrootn_storage_to_litter => pnf%m_livecrootn_storage_to_litter - m_deadcrootn_storage_to_litter => pnf%m_deadcrootn_storage_to_litter - m_leafn_xfer_to_litter => pnf%m_leafn_xfer_to_litter - m_frootn_xfer_to_litter => pnf%m_frootn_xfer_to_litter - m_livestemn_xfer_to_litter => pnf%m_livestemn_xfer_to_litter - m_deadstemn_xfer_to_litter => pnf%m_deadstemn_xfer_to_litter - m_livecrootn_xfer_to_litter => pnf%m_livecrootn_xfer_to_litter - m_deadcrootn_xfer_to_litter => pnf%m_deadcrootn_xfer_to_litter - greffic => pdgvs%greffic - heatstress => pdgvs%heatstress - - ! set the mortality rate based on annual rate - am = 0.02_r8 - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - if (use_cndv) then - ! Stress mortality from lpj's subr Mortality. - - if (woody(ivt(p)) == 1._r8) then - - if (ivt(p) == 8) then - mort_max = 0.03_r8 ! BDT boreal - else - mort_max = 0.01_r8 ! original value for all pfts - end if - - ! heatstress and greffic calculated in Establishment once/yr - - ! Mortality rate inversely related to growth efficiency - ! (Prentice et al 1993) - am = mort_max / (1._r8 + k_mort * greffic(p)) - - am = min(1._r8, am + heatstress(p)) - else ! lpj didn't set this for grasses; cn does - ! set the mortality rate based on annual rate - am = 0.02_r8 - end if - end if - - m = am/(get_days_per_year() * secspday) - - ! pft-level gap mortality carbon fluxes - ! displayed pools - m_leafc_to_litter(p) = leafc(p) * m - m_frootc_to_litter(p) = frootc(p) * m - m_livestemc_to_litter(p) = livestemc(p) * m - m_deadstemc_to_litter(p) = deadstemc(p) * m - m_livecrootc_to_litter(p) = livecrootc(p) * m - m_deadcrootc_to_litter(p) = deadcrootc(p) * m - - ! storage pools - m_leafc_storage_to_litter(p) = leafc_storage(p) * m - m_frootc_storage_to_litter(p) = frootc_storage(p) * m - m_livestemc_storage_to_litter(p) = livestemc_storage(p) * m - m_deadstemc_storage_to_litter(p) = deadstemc_storage(p) * m - m_livecrootc_storage_to_litter(p) = livecrootc_storage(p) * m - m_deadcrootc_storage_to_litter(p) = deadcrootc_storage(p) * m - m_gresp_storage_to_litter(p) = gresp_storage(p) * m - - ! transfer pools - m_leafc_xfer_to_litter(p) = leafc_xfer(p) * m - m_frootc_xfer_to_litter(p) = frootc_xfer(p) * m - m_livestemc_xfer_to_litter(p) = livestemc_xfer(p) * m - m_deadstemc_xfer_to_litter(p) = deadstemc_xfer(p) * m - m_livecrootc_xfer_to_litter(p) = livecrootc_xfer(p) * m - m_deadcrootc_xfer_to_litter(p) = deadcrootc_xfer(p) * m - m_gresp_xfer_to_litter(p) = gresp_xfer(p) * m - - ! pft-level gap mortality nitrogen fluxes - ! displayed pools - m_leafn_to_litter(p) = leafn(p) * m - m_frootn_to_litter(p) = frootn(p) * m - m_livestemn_to_litter(p) = livestemn(p) * m - m_deadstemn_to_litter(p) = deadstemn(p) * m - m_livecrootn_to_litter(p) = livecrootn(p) * m - m_deadcrootn_to_litter(p) = deadcrootn(p) * m - m_retransn_to_litter(p) = retransn(p) * m - - ! storage pools - m_leafn_storage_to_litter(p) = leafn_storage(p) * m - m_frootn_storage_to_litter(p) = frootn_storage(p) * m - m_livestemn_storage_to_litter(p) = livestemn_storage(p) * m - m_deadstemn_storage_to_litter(p) = deadstemn_storage(p) * m - m_livecrootn_storage_to_litter(p) = livecrootn_storage(p) * m - m_deadcrootn_storage_to_litter(p) = deadcrootn_storage(p) * m - - ! transfer pools - m_leafn_xfer_to_litter(p) = leafn_xfer(p) * m - m_frootn_xfer_to_litter(p) = frootn_xfer(p) * m - m_livestemn_xfer_to_litter(p) = livestemn_xfer(p) * m - m_deadstemn_xfer_to_litter(p) = deadstemn_xfer(p) * m - m_livecrootn_xfer_to_litter(p) = livecrootn_xfer(p) * m - m_deadcrootn_xfer_to_litter(p) = deadcrootn_xfer(p) * m - - end do ! end of pft loop - - ! gather all pft-level litterfall fluxes to the column - ! for litter C and N inputs - - call CNGapPftToColumn(num_soilc, filter_soilc) - -end subroutine CNGapMortality -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNGapPftToColumn -! -! !INTERFACE: -subroutine CNGapPftToColumn (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! called in the middle of CNGapMoratlity to gather all pft-level gap mortality fluxes -! to the column level and assign them to the three litter pools -! -! !USES: - use clmtype - use clm_varpar, only : maxpatch_pft -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! soil column filter -! -! !CALLED FROM: -! subroutine CNphenology -! -! !REVISION HISTORY: -! 9/8/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: wtcol(:) ! pft weight relative to column (0-1) - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: lf_flab(:) ! leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) ! leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) ! leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) ! fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) ! fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) ! fine root litter lignin fraction - integer , pointer :: npfts(:) ! number of pfts for each column - integer , pointer :: pfti(:) ! beginning pft index for each column - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) - real(r8), pointer :: m_leafn_to_litter(:) - real(r8), pointer :: m_frootn_to_litter(:) - real(r8), pointer :: m_livestemn_to_litter(:) - real(r8), pointer :: m_deadstemn_to_litter(:) - real(r8), pointer :: m_livecrootn_to_litter(:) - real(r8), pointer :: m_deadcrootn_to_litter(:) - real(r8), pointer :: m_retransn_to_litter(:) - real(r8), pointer :: m_leafn_storage_to_litter(:) - real(r8), pointer :: m_frootn_storage_to_litter(:) - real(r8), pointer :: m_livestemn_storage_to_litter(:) - real(r8), pointer :: m_deadstemn_storage_to_litter(:) - real(r8), pointer :: m_livecrootn_storage_to_litter(:) - real(r8), pointer :: m_deadcrootn_storage_to_litter(:) - real(r8), pointer :: m_leafn_xfer_to_litter(:) - real(r8), pointer :: m_frootn_xfer_to_litter(:) - real(r8), pointer :: m_livestemn_xfer_to_litter(:) - real(r8), pointer :: m_deadstemn_xfer_to_litter(:) - real(r8), pointer :: m_livecrootn_xfer_to_litter(:) - real(r8), pointer :: m_deadcrootn_xfer_to_litter(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: m_leafc_to_litr1c(:) - real(r8), pointer :: m_leafc_to_litr2c(:) - real(r8), pointer :: m_leafc_to_litr3c(:) - real(r8), pointer :: m_frootc_to_litr1c(:) - real(r8), pointer :: m_frootc_to_litr2c(:) - real(r8), pointer :: m_frootc_to_litr3c(:) - real(r8), pointer :: m_livestemc_to_cwdc(:) - real(r8), pointer :: m_deadstemc_to_cwdc(:) - real(r8), pointer :: m_livecrootc_to_cwdc(:) - real(r8), pointer :: m_deadcrootc_to_cwdc(:) - real(r8), pointer :: m_leafc_storage_to_litr1c(:) - real(r8), pointer :: m_frootc_storage_to_litr1c(:) - real(r8), pointer :: m_livestemc_storage_to_litr1c(:) - real(r8), pointer :: m_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: m_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: m_gresp_storage_to_litr1c(:) - real(r8), pointer :: m_leafc_xfer_to_litr1c(:) - real(r8), pointer :: m_frootc_xfer_to_litr1c(:) - real(r8), pointer :: m_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: m_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: m_gresp_xfer_to_litr1c(:) - real(r8), pointer :: m_leafn_to_litr1n(:) - real(r8), pointer :: m_leafn_to_litr2n(:) - real(r8), pointer :: m_leafn_to_litr3n(:) - real(r8), pointer :: m_frootn_to_litr1n(:) - real(r8), pointer :: m_frootn_to_litr2n(:) - real(r8), pointer :: m_frootn_to_litr3n(:) - real(r8), pointer :: m_livestemn_to_cwdn(:) - real(r8), pointer :: m_deadstemn_to_cwdn(:) - real(r8), pointer :: m_livecrootn_to_cwdn(:) - real(r8), pointer :: m_deadcrootn_to_cwdn(:) - real(r8), pointer :: m_retransn_to_litr1n(:) - real(r8), pointer :: m_leafn_storage_to_litr1n(:) - real(r8), pointer :: m_frootn_storage_to_litr1n(:) - real(r8), pointer :: m_livestemn_storage_to_litr1n(:) - real(r8), pointer :: m_deadstemn_storage_to_litr1n(:) - real(r8), pointer :: m_livecrootn_storage_to_litr1n(:) - real(r8), pointer :: m_deadcrootn_storage_to_litr1n(:) - real(r8), pointer :: m_leafn_xfer_to_litr1n(:) - real(r8), pointer :: m_frootn_xfer_to_litr1n(:) - real(r8), pointer :: m_livestemn_xfer_to_litr1n(:) - real(r8), pointer :: m_deadstemn_xfer_to_litr1n(:) - real(r8), pointer :: m_livecrootn_xfer_to_litr1n(:) - real(r8), pointer :: m_deadcrootn_xfer_to_litr1n(:) -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: fc,c,pi,p ! indices -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers - lf_flab => pftcon%lf_flab - lf_fcel => pftcon%lf_fcel - lf_flig => pftcon%lf_flig - fr_flab => pftcon%fr_flab - fr_fcel => pftcon%fr_fcel - fr_flig => pftcon%fr_flig - - ! assign local pointers to column-level arrays - npfts => col%npfts - pfti => col%pfti - m_leafc_to_litr1c => ccf%m_leafc_to_litr1c - m_leafc_to_litr2c => ccf%m_leafc_to_litr2c - m_leafc_to_litr3c => ccf%m_leafc_to_litr3c - m_frootc_to_litr1c => ccf%m_frootc_to_litr1c - m_frootc_to_litr2c => ccf%m_frootc_to_litr2c - m_frootc_to_litr3c => ccf%m_frootc_to_litr3c - m_livestemc_to_cwdc => ccf%m_livestemc_to_cwdc - m_deadstemc_to_cwdc => ccf%m_deadstemc_to_cwdc - m_livecrootc_to_cwdc => ccf%m_livecrootc_to_cwdc - m_deadcrootc_to_cwdc => ccf%m_deadcrootc_to_cwdc - m_leafc_storage_to_litr1c => ccf%m_leafc_storage_to_litr1c - m_frootc_storage_to_litr1c => ccf%m_frootc_storage_to_litr1c - m_livestemc_storage_to_litr1c => ccf%m_livestemc_storage_to_litr1c - m_deadstemc_storage_to_litr1c => ccf%m_deadstemc_storage_to_litr1c - m_livecrootc_storage_to_litr1c => ccf%m_livecrootc_storage_to_litr1c - m_deadcrootc_storage_to_litr1c => ccf%m_deadcrootc_storage_to_litr1c - m_gresp_storage_to_litr1c => ccf%m_gresp_storage_to_litr1c - m_leafc_xfer_to_litr1c => ccf%m_leafc_xfer_to_litr1c - m_frootc_xfer_to_litr1c => ccf%m_frootc_xfer_to_litr1c - m_livestemc_xfer_to_litr1c => ccf%m_livestemc_xfer_to_litr1c - m_deadstemc_xfer_to_litr1c => ccf%m_deadstemc_xfer_to_litr1c - m_livecrootc_xfer_to_litr1c => ccf%m_livecrootc_xfer_to_litr1c - m_deadcrootc_xfer_to_litr1c => ccf%m_deadcrootc_xfer_to_litr1c - m_gresp_xfer_to_litr1c => ccf%m_gresp_xfer_to_litr1c - m_leafn_to_litr1n => cnf%m_leafn_to_litr1n - m_leafn_to_litr2n => cnf%m_leafn_to_litr2n - m_leafn_to_litr3n => cnf%m_leafn_to_litr3n - m_frootn_to_litr1n => cnf%m_frootn_to_litr1n - m_frootn_to_litr2n => cnf%m_frootn_to_litr2n - m_frootn_to_litr3n => cnf%m_frootn_to_litr3n - m_livestemn_to_cwdn => cnf%m_livestemn_to_cwdn - m_deadstemn_to_cwdn => cnf%m_deadstemn_to_cwdn - m_livecrootn_to_cwdn => cnf%m_livecrootn_to_cwdn - m_deadcrootn_to_cwdn => cnf%m_deadcrootn_to_cwdn - m_retransn_to_litr1n => cnf%m_retransn_to_litr1n - m_leafn_storage_to_litr1n => cnf%m_leafn_storage_to_litr1n - m_frootn_storage_to_litr1n => cnf%m_frootn_storage_to_litr1n - m_livestemn_storage_to_litr1n => cnf%m_livestemn_storage_to_litr1n - m_deadstemn_storage_to_litr1n => cnf%m_deadstemn_storage_to_litr1n - m_livecrootn_storage_to_litr1n => cnf%m_livecrootn_storage_to_litr1n - m_deadcrootn_storage_to_litr1n => cnf%m_deadcrootn_storage_to_litr1n - m_leafn_xfer_to_litr1n => cnf%m_leafn_xfer_to_litr1n - m_frootn_xfer_to_litr1n => cnf%m_frootn_xfer_to_litr1n - m_livestemn_xfer_to_litr1n => cnf%m_livestemn_xfer_to_litr1n - m_deadstemn_xfer_to_litr1n => cnf%m_deadstemn_xfer_to_litr1n - m_livecrootn_xfer_to_litr1n => cnf%m_livecrootn_xfer_to_litr1n - m_deadcrootn_xfer_to_litr1n => cnf%m_deadcrootn_xfer_to_litr1n - - ! assign local pointers to pft-level arrays - ivt => pft%itype - wtcol => pft%wtcol - pwtgcell => pft%wtgcell - m_leafc_to_litter => pcf%m_leafc_to_litter - m_frootc_to_litter => pcf%m_frootc_to_litter - m_livestemc_to_litter => pcf%m_livestemc_to_litter - m_deadstemc_to_litter => pcf%m_deadstemc_to_litter - m_livecrootc_to_litter => pcf%m_livecrootc_to_litter - m_deadcrootc_to_litter => pcf%m_deadcrootc_to_litter - m_leafc_storage_to_litter => pcf%m_leafc_storage_to_litter - m_frootc_storage_to_litter => pcf%m_frootc_storage_to_litter - m_livestemc_storage_to_litter => pcf%m_livestemc_storage_to_litter - m_deadstemc_storage_to_litter => pcf%m_deadstemc_storage_to_litter - m_livecrootc_storage_to_litter => pcf%m_livecrootc_storage_to_litter - m_deadcrootc_storage_to_litter => pcf%m_deadcrootc_storage_to_litter - m_gresp_storage_to_litter => pcf%m_gresp_storage_to_litter - m_leafc_xfer_to_litter => pcf%m_leafc_xfer_to_litter - m_frootc_xfer_to_litter => pcf%m_frootc_xfer_to_litter - m_livestemc_xfer_to_litter => pcf%m_livestemc_xfer_to_litter - m_deadstemc_xfer_to_litter => pcf%m_deadstemc_xfer_to_litter - m_livecrootc_xfer_to_litter => pcf%m_livecrootc_xfer_to_litter - m_deadcrootc_xfer_to_litter => pcf%m_deadcrootc_xfer_to_litter - m_gresp_xfer_to_litter => pcf%m_gresp_xfer_to_litter - m_leafn_to_litter => pnf%m_leafn_to_litter - m_frootn_to_litter => pnf%m_frootn_to_litter - m_livestemn_to_litter => pnf%m_livestemn_to_litter - m_deadstemn_to_litter => pnf%m_deadstemn_to_litter - m_livecrootn_to_litter => pnf%m_livecrootn_to_litter - m_deadcrootn_to_litter => pnf%m_deadcrootn_to_litter - m_retransn_to_litter => pnf%m_retransn_to_litter - m_leafn_storage_to_litter => pnf%m_leafn_storage_to_litter - m_frootn_storage_to_litter => pnf%m_frootn_storage_to_litter - m_livestemn_storage_to_litter => pnf%m_livestemn_storage_to_litter - m_deadstemn_storage_to_litter => pnf%m_deadstemn_storage_to_litter - m_livecrootn_storage_to_litter => pnf%m_livecrootn_storage_to_litter - m_deadcrootn_storage_to_litter => pnf%m_deadcrootn_storage_to_litter - m_leafn_xfer_to_litter => pnf%m_leafn_xfer_to_litter - m_frootn_xfer_to_litter => pnf%m_frootn_xfer_to_litter - m_livestemn_xfer_to_litter => pnf%m_livestemn_xfer_to_litter - m_deadstemn_xfer_to_litter => pnf%m_deadstemn_xfer_to_litter - m_livecrootn_xfer_to_litter => pnf%m_livecrootn_xfer_to_litter - m_deadcrootn_xfer_to_litter => pnf%m_deadcrootn_xfer_to_litter - - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - - if (pwtgcell(p)>0._r8) then - - ! leaf gap mortality carbon fluxes - m_leafc_to_litr1c(c) = m_leafc_to_litr1c(c) + & - m_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - m_leafc_to_litr2c(c) = m_leafc_to_litr2c(c) + & - m_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - m_leafc_to_litr3c(c) = m_leafc_to_litr3c(c) + & - m_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root gap mortality carbon fluxes - m_frootc_to_litr1c(c) = m_frootc_to_litr1c(c) + & - m_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - m_frootc_to_litr2c(c) = m_frootc_to_litr2c(c) + & - m_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - m_frootc_to_litr3c(c) = m_frootc_to_litr3c(c) + & - m_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! wood gap mortality carbon fluxes - m_livestemc_to_cwdc(c) = m_livestemc_to_cwdc(c) + & - m_livestemc_to_litter(p) * wtcol(p) - m_deadstemc_to_cwdc(c) = m_deadstemc_to_cwdc(c) + & - m_deadstemc_to_litter(p) * wtcol(p) - m_livecrootc_to_cwdc(c) = m_livecrootc_to_cwdc(c) + & - m_livecrootc_to_litter(p) * wtcol(p) - m_deadcrootc_to_cwdc(c) = m_deadcrootc_to_cwdc(c) + & - m_deadcrootc_to_litter(p) * wtcol(p) - - ! storage gap mortality carbon fluxes - m_leafc_storage_to_litr1c(c) = m_leafc_storage_to_litr1c(c) + & - m_leafc_storage_to_litter(p) * wtcol(p) - m_frootc_storage_to_litr1c(c) = m_frootc_storage_to_litr1c(c) + & - m_frootc_storage_to_litter(p) * wtcol(p) - m_livestemc_storage_to_litr1c(c) = m_livestemc_storage_to_litr1c(c) + & - m_livestemc_storage_to_litter(p) * wtcol(p) - m_deadstemc_storage_to_litr1c(c) = m_deadstemc_storage_to_litr1c(c) + & - m_deadstemc_storage_to_litter(p) * wtcol(p) - m_livecrootc_storage_to_litr1c(c) = m_livecrootc_storage_to_litr1c(c) + & - m_livecrootc_storage_to_litter(p) * wtcol(p) - m_deadcrootc_storage_to_litr1c(c) = m_deadcrootc_storage_to_litr1c(c) + & - m_deadcrootc_storage_to_litter(p) * wtcol(p) - m_gresp_storage_to_litr1c(c) = m_gresp_storage_to_litr1c(c) + & - m_gresp_storage_to_litter(p) * wtcol(p) - - ! transfer gap mortality carbon fluxes - m_leafc_xfer_to_litr1c(c) = m_leafc_xfer_to_litr1c(c) + & - m_leafc_xfer_to_litter(p) * wtcol(p) - m_frootc_xfer_to_litr1c(c) = m_frootc_xfer_to_litr1c(c) + & - m_frootc_xfer_to_litter(p) * wtcol(p) - m_livestemc_xfer_to_litr1c(c) = m_livestemc_xfer_to_litr1c(c) + & - m_livestemc_xfer_to_litter(p) * wtcol(p) - m_deadstemc_xfer_to_litr1c(c) = m_deadstemc_xfer_to_litr1c(c) + & - m_deadstemc_xfer_to_litter(p) * wtcol(p) - m_livecrootc_xfer_to_litr1c(c) = m_livecrootc_xfer_to_litr1c(c) + & - m_livecrootc_xfer_to_litter(p) * wtcol(p) - m_deadcrootc_xfer_to_litr1c(c) = m_deadcrootc_xfer_to_litr1c(c) + & - m_deadcrootc_xfer_to_litter(p) * wtcol(p) - m_gresp_xfer_to_litr1c(c) = m_gresp_xfer_to_litr1c(c) + & - m_gresp_xfer_to_litter(p) * wtcol(p) - - ! leaf gap mortality nitrogen fluxes - m_leafn_to_litr1n(c) = m_leafn_to_litr1n(c) + & - m_leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - m_leafn_to_litr2n(c) = m_leafn_to_litr2n(c) + & - m_leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - m_leafn_to_litr3n(c) = m_leafn_to_litr3n(c) + & - m_leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root litter nitrogen fluxes - m_frootn_to_litr1n(c) = m_frootn_to_litr1n(c) + & - m_frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - m_frootn_to_litr2n(c) = m_frootn_to_litr2n(c) + & - m_frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - m_frootn_to_litr3n(c) = m_frootn_to_litr3n(c) + & - m_frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! wood gap mortality nitrogen fluxes - m_livestemn_to_cwdn(c) = m_livestemn_to_cwdn(c) + & - m_livestemn_to_litter(p) * wtcol(p) - m_deadstemn_to_cwdn(c) = m_deadstemn_to_cwdn(c) + & - m_deadstemn_to_litter(p) * wtcol(p) - m_livecrootn_to_cwdn(c) = m_livecrootn_to_cwdn(c) + & - m_livecrootn_to_litter(p) * wtcol(p) - m_deadcrootn_to_cwdn(c) = m_deadcrootn_to_cwdn(c) + & - m_deadcrootn_to_litter(p) * wtcol(p) - - ! retranslocated N pool gap mortality fluxes - m_retransn_to_litr1n(c) = m_retransn_to_litr1n(c) + & - m_retransn_to_litter(p) * wtcol(p) - - ! storage gap mortality nitrogen fluxes - m_leafn_storage_to_litr1n(c) = m_leafn_storage_to_litr1n(c) + & - m_leafn_storage_to_litter(p) * wtcol(p) - m_frootn_storage_to_litr1n(c) = m_frootn_storage_to_litr1n(c) + & - m_frootn_storage_to_litter(p) * wtcol(p) - m_livestemn_storage_to_litr1n(c) = m_livestemn_storage_to_litr1n(c) + & - m_livestemn_storage_to_litter(p) * wtcol(p) - m_deadstemn_storage_to_litr1n(c) = m_deadstemn_storage_to_litr1n(c) + & - m_deadstemn_storage_to_litter(p) * wtcol(p) - m_livecrootn_storage_to_litr1n(c) = m_livecrootn_storage_to_litr1n(c) + & - m_livecrootn_storage_to_litter(p) * wtcol(p) - m_deadcrootn_storage_to_litr1n(c) = m_deadcrootn_storage_to_litr1n(c) + & - m_deadcrootn_storage_to_litter(p) * wtcol(p) - - ! transfer gap mortality nitrogen fluxes - m_leafn_xfer_to_litr1n(c) = m_leafn_xfer_to_litr1n(c) + & - m_leafn_xfer_to_litter(p) * wtcol(p) - m_frootn_xfer_to_litr1n(c) = m_frootn_xfer_to_litr1n(c) + & - m_frootn_xfer_to_litter(p) * wtcol(p) - m_livestemn_xfer_to_litr1n(c) = m_livestemn_xfer_to_litr1n(c) + & - m_livestemn_xfer_to_litter(p) * wtcol(p) - m_deadstemn_xfer_to_litr1n(c) = m_deadstemn_xfer_to_litr1n(c) + & - m_deadstemn_xfer_to_litter(p) * wtcol(p) - m_livecrootn_xfer_to_litr1n(c) = m_livecrootn_xfer_to_litr1n(c) + & - m_livecrootn_xfer_to_litter(p) * wtcol(p) - m_deadcrootn_xfer_to_litr1n(c) = m_deadcrootn_xfer_to_litr1n(c) + & - m_deadcrootn_xfer_to_litter(p) * wtcol(p) - - end if - end if - - end do - - end do - -end subroutine CNGapPftToColumn -!----------------------------------------------------------------------- - -end module CNGapMortalityMod diff --git a/src_clm40/biogeochem/CNMRespMod.F90 b/src_clm40/biogeochem/CNMRespMod.F90 deleted file mode 100644 index bf2a1b6f15..0000000000 --- a/src_clm40/biogeochem/CNMRespMod.F90 +++ /dev/null @@ -1,180 +0,0 @@ -module CNMRespMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNMRespMod -! -! !DESCRIPTION: -! Module holding maintenance respiration routines for coupled carbon -! nitrogen code. -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use clm_varpar , only: nlevgrnd - use shr_const_mod, only: SHR_CONST_TKFRZ - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNMResp -! -! !REVISION HISTORY: -! 8/14/03: Created by Peter Thornton -! 10/23/03, Peter Thornton: Migrated all subroutines to vector data structures. -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNMResp -! -! !INTERFACE: -subroutine CNMResp(lbc, ubc, num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! -! !USES: - use clmtype - use pftvarcon , only : npcropmin -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: num_soilc ! number of soil points in column filter - integer, intent(in) :: filter_soilc(:) ! column filter for soil points - integer, intent(in) :: num_soilp ! number of soil points in pft filter - integer, intent(in) :: filter_soilp(:) ! pft filter for soil points -! -! !CALLED FROM: -! subroutine CNEcosystemDyn in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 8/14/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in arrays -! - ! column level - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - ! pft level - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (Kelvin) - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: rootfr(:,:) ! fraction of roots in each soil layer (nlevgrnd) - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! index into column level quantities - integer , pointer :: plandunit(:) ! index into landunit level quantities - integer , pointer :: clandunit(:) ! index into landunit level quantities - integer , pointer :: itypelun(:) ! landunit type - ! ecophysiological constants - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - logical , pointer :: croplive(:) ! Flag, true if planted, not harvested -! -! local pointers to implicit in/out arrays -! - ! pft level - real(r8), pointer :: leaf_mr(:) - real(r8), pointer :: froot_mr(:) - real(r8), pointer :: livestem_mr(:) - real(r8), pointer :: livecroot_mr(:) -! -! !OTHER LOCAL VARIABLES: - integer :: c,p,j ! indices - integer :: fp ! soil filter pft index - integer :: fc ! soil filter column index - real(r8):: mr ! maintenance respiration (gC/m2/s) - real(r8):: br ! base rate (gC/gN/s) - real(r8):: q10 ! temperature dependence - real(r8):: tc ! temperature correction, 2m air temp (unitless) - real(r8):: tcsoi(lbc:ubc,nlevgrnd) ! temperature correction by soil layer (unitless) -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays - t_soisno => ces%t_soisno - t_ref2m => pes%t_ref2m - leafn => pns%leafn - frootn => pns%frootn - livestemn => pns%livestemn - livecrootn => pns%livecrootn - rootfr => pps%rootfr - leaf_mr => pcf%leaf_mr - froot_mr => pcf%froot_mr - livestem_mr => pcf%livestem_mr - livecroot_mr => pcf%livecroot_mr - ivt => pft%itype - pcolumn => pft%column - plandunit => pft%landunit - clandunit => col%landunit - itypelun => lun%itype - woody => pftcon%woody - croplive => pps%croplive - - ! base rate for maintenance respiration is from: - ! M. Ryan, 1991. Effects of climate change on plant respiration. - ! Ecological Applications, 1(2), 157-167. - ! Original expression is br = 0.0106 molC/(molN h) - ! Conversion by molecular weights of C and N gives 2.525e-6 gC/(gN s) - br = 2.525e-6_r8 - ! Peter Thornton: 3/13/09 - ! Q10 was originally set to 2.0, an arbitrary choice, but reduced to 1.5 as part of the tuning - ! to improve seasonal cycle of atmospheric CO2 concentration in global - ! simulatoins - q10 = 1.5_r8 - - ! column loop to calculate temperature factors in each soil layer - do j=1,nlevgrnd - do fc = 1, num_soilc - c = filter_soilc(fc) - - ! calculate temperature corrections for each soil layer, for use in - ! estimating fine root maintenance respiration with depth - - tcsoi(c,j) = q10**((t_soisno(c,j)-SHR_CONST_TKFRZ - 20.0_r8)/10.0_r8) - end do - end do - - ! pft loop for leaves and live wood - do fp = 1, num_soilp - p = filter_soilp(fp) - - ! calculate maintenance respiration fluxes in - ! gC/m2/s for each of the live plant tissues. - ! Leaf and live wood MR - - tc = q10**((t_ref2m(p)-SHR_CONST_TKFRZ - 20.0_r8)/10.0_r8) - leaf_mr(p) = leafn(p)*br*tc - if (woody(ivt(p)) == 1) then - livestem_mr(p) = livestemn(p)*br*tc - livecroot_mr(p) = livecrootn(p)*br*tc - else if (ivt(p) >= npcropmin) then - livestem_mr(p) = livestemn(p)*br*tc - end if - end do - - ! soil and pft loop for fine root - do j = 1,nlevgrnd - do fp = 1,num_soilp - p = filter_soilp(fp) - c = pcolumn(p) - - ! Fine root MR - ! rootfr(j) sums to 1.0 over all soil layers, and - ! describes the fraction of root mass that is in each - ! layer. This is used with the layer temperature correction - ! to estimate the total fine root maintenance respiration as a - ! function of temperature and N content. - - froot_mr(p) = froot_mr(p) + frootn(p)*br*tcsoi(c,j)*rootfr(p,j) - end do - end do - -end subroutine CNMResp - -end module CNMRespMod diff --git a/src_clm40/biogeochem/CNNDynamicsMod.F90 b/src_clm40/biogeochem/CNNDynamicsMod.F90 deleted file mode 100644 index 756ababeb8..0000000000 --- a/src_clm40/biogeochem/CNNDynamicsMod.F90 +++ /dev/null @@ -1,268 +0,0 @@ -module CNNDynamicsMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNNDynamicsMod -! -! !DESCRIPTION: -! Module for mineral nitrogen dynamics (deposition, fixation, leaching) -! for coupled carbon-nitrogen code. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNNDeposition - public :: CNNFixation - public :: CNNLeaching -! -! !REVISION HISTORY: -! 6/1/04: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNNDeposition -! -! !INTERFACE: -subroutine CNNDeposition( lbc, ubc ) -! -! !DESCRIPTION: -! On the radiation time step, update the nitrogen deposition rate -! from atmospheric forcing. For now it is assumed that all the atmospheric -! N deposition goes to the soil mineral N pool. -! This could be updated later to divide the inputs between mineral N absorbed -! directly into the canopy and mineral N entering the soil pool. -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds -! -! !CALLED FROM: -! subroutine CNEcosystemDyn, in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 6/1/04: Created by Peter Thornton -! 11/06/09: Copy to all columns NOT just over soil. S. Levis -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: forc_ndep(:) ! nitrogen deposition rate (gN/m2/s) - integer , pointer :: gridcell(:) ! index into gridcell level quantities -! -! local pointers to implicit out scalars -! - real(r8), pointer :: ndep_to_sminn(:) -! -! !OTHER LOCAL VARIABLES: - integer :: g,c ! indices - -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - forc_ndep => clm_a2l%forc_ndep - gridcell => col%gridcell - - ! Assign local pointers to derived type arrays (out) - ndep_to_sminn => cnf%ndep_to_sminn - - ! Loop through columns - do c = lbc, ubc - g = gridcell(c) - - ndep_to_sminn(c) = forc_ndep(g) - - end do - -end subroutine CNNDeposition - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNNFixation -! -! !INTERFACE: -subroutine CNNFixation(num_soilc, filter_soilc) -! -! !DESCRIPTION: -! On the radiation time step, update the nitrogen fixation rate -! as a function of annual total NPP. This rate gets updated once per year. -! All N fixation goes to the soil mineral N pool. -! -! !USES: - use clmtype - use clm_varctl , only: iulog - use clm_time_manager, only: get_days_per_year - use shr_sys_mod , only: shr_sys_flush - use clm_varcon , only: secspday -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns -! -! !CALLED FROM: -! subroutine CNEcosystemDyn, in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 6/1/04: Created by Peter Thornton -! 2/14/05, PET: After looking at a number of point simulations, -! it looks like a constant Nfix might be more efficient and -! maybe more realistic - setting to constant 0.4 gN/m2/yr. -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: cannsum_npp(:) ! nitrogen deposition rate (gN/m2/s) -! -! local pointers to implicit out scalars -! - real(r8), pointer :: nfix_to_sminn(:) -! -! !OTHER LOCAL VARIABLES: - integer :: c,fc ! indices - real(r8) :: t ! temporary - real(r8) :: dayspyr ! days per year - -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - cannsum_npp => cps%cannsum_npp - - ! Assign local pointers to derived type arrays (out) - nfix_to_sminn => cnf%nfix_to_sminn - - dayspyr = get_days_per_year() - - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! the value 0.001666 is set to give 100 TgN/yr when global - ! NPP = 60 PgC/yr. (Cleveland et al., 1999) - ! Convert from gN/m2/yr -> gN/m2/s - !t = cannsum_npp(c) * 0.001666_r8 / (secspday * dayspyr) - t = (1.8_r8 * (1._r8 - exp(-0.003_r8 * cannsum_npp(c))))/(secspday * dayspyr) - nfix_to_sminn(c) = max(0._r8,t) - ! PET 2/14/05: commenting out the dependence on NPP, and - ! forcing Nfix to global constant = 0.4 gN/m2/yr - !nfix_to_sminn(c) = 0.4 / (secspday*dayspyr) - - end do - -end subroutine CNNFixation - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNNLeaching -! -! !INTERFACE: -subroutine CNNLeaching(lbc, ubc, num_soilc, filter_soilc) -! -! !DESCRIPTION: -! On the radiation time step, update the nitrogen leaching rate -! as a function of soluble mineral N and total soil water outflow. -! -! !USES: - use clmtype - use clm_varpar , only : nlevsoi - use clm_time_manager , only : get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 6/9/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: qflx_drain(:) ! sub-surface runoff (mm H2O /s) - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N -! -! local pointers to implicit out scalars -! - real(r8), pointer :: sminn_leached(:) ! rate of mineral N leaching (gN/m2/s) -! -! !OTHER LOCAL VARIABLES: - integer :: j,c,fc ! indices - real(r8) :: dt ! radiation time step (seconds) - real(r8) :: tot_water(lbc:ubc) ! total column liquid water (kg water/m2) - real(r8) :: sf ! soluble fraction of mineral N (unitless) - real(r8) :: disn_conc ! dissolved mineral N concentration - ! (gN/kg water) - -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - h2osoi_liq => cws%h2osoi_liq - qflx_drain => cwf%qflx_drain - sminn => cns%sminn - - ! Assign local pointers to derived type arrays (out) - sminn_leached => cnf%sminn_leached - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! Assume that 10% of the soil mineral N is in a soluble form - sf = 0.1_r8 - - ! calculate the total soil water - tot_water(lbc:ubc) = 0._r8 - do j = 1,nlevsoi - do fc = 1,num_soilc - c = filter_soilc(fc) - tot_water(c) = tot_water(c) + h2osoi_liq(c,j) - end do - end do - - ! Loop through columns - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate the dissolved mineral N concentration (gN/kg water) - ! assumes that 10% of mineral nitrogen is soluble - disn_conc = 0._r8 - if (tot_water(c) > 0._r8) then - disn_conc = (sf * sminn(c))/tot_water(c) - end if - - ! calculate the N leaching flux as a function of the dissolved - ! concentration and the sub-surface drainage flux - sminn_leached(c) = disn_conc * qflx_drain(c) - - ! limit the flux based on current sminn state - ! only let at most the assumed soluble fraction - ! of sminn be leached on any given timestep - sminn_leached(c) = min(sminn_leached(c), (sf * sminn(c))/dt) - - ! limit the flux to a positive value - sminn_leached(c) = max(sminn_leached(c), 0._r8) - - end do - -end subroutine CNNLeaching - -end module CNNDynamicsMod diff --git a/src_clm40/biogeochem/CNNStateUpdate1Mod.F90 b/src_clm40/biogeochem/CNNStateUpdate1Mod.F90 deleted file mode 100644 index a6518f3a75..0000000000 --- a/src_clm40/biogeochem/CNNStateUpdate1Mod.F90 +++ /dev/null @@ -1,537 +0,0 @@ -module CNNStateUpdate1Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: NStateUpdate1Mod -! -! !DESCRIPTION: -! Module for nitrogen state variable updates, non-mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: NStateUpdate1 -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NStateUpdate1 -! -! !INTERFACE: -subroutine NStateUpdate1(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic nitrogen state -! variables (except for gap-phase mortality and fire fluxes) -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - use pftvarcon , only: npcropmin, nc3crop - use surfrdMod , only: crop_prog -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: cwdn_to_litr2n(:) ! decomp. of coarse woody debris N to litter 2 N (gN/m2/s) - real(r8), pointer :: cwdn_to_litr3n(:) ! decomp. of coarse woody debris N to litter 3 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr1n(:) ! grain N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr2n(:) ! grain N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr3n(:) ! grain N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr1n(:) ! livestem N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr2n(:) ! livestem N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr3n(:) ! livestem N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr1n(:) ! fine root N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr2n(:) ! fine root N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr3n(:) ! fine root N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr1n(:) ! leaf N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr2n(:) ! leaf N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr3n(:) ! leaf N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: litr1n_to_soil1n(:) - real(r8), pointer :: litr2n_to_soil2n(:) - real(r8), pointer :: litr3n_to_soil3n(:) - real(r8), pointer :: ndep_to_sminn(:) - real(r8), pointer :: nfix_to_sminn(:) ! symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - real(r8), pointer :: sminn_to_denit_excess(:) - real(r8), pointer :: sminn_to_denit_l1s1(:) - real(r8), pointer :: sminn_to_denit_l2s2(:) - real(r8), pointer :: sminn_to_denit_l3s3(:) - real(r8), pointer :: sminn_to_denit_s1s2(:) - real(r8), pointer :: sminn_to_denit_s2s3(:) - real(r8), pointer :: sminn_to_denit_s3s4(:) - real(r8), pointer :: sminn_to_denit_s4(:) - real(r8), pointer :: sminn_to_plant(:) - real(r8), pointer :: sminn_to_soil1n_l1(:) - real(r8), pointer :: sminn_to_soil2n_l2(:) - real(r8), pointer :: sminn_to_soil2n_s1(:) - real(r8), pointer :: sminn_to_soil3n_l3(:) - real(r8), pointer :: sminn_to_soil3n_s2(:) - real(r8), pointer :: sminn_to_soil4n_s3(:) - real(r8), pointer :: soil1n_to_soil2n(:) - real(r8), pointer :: soil2n_to_soil3n(:) - real(r8), pointer :: soil3n_to_soil4n(:) - real(r8), pointer :: soil4n_to_sminn(:) - real(r8), pointer :: supplement_to_sminn(:) - real(r8), pointer :: deadcrootn_storage_to_xfer(:) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn(:) - real(r8), pointer :: deadstemn_storage_to_xfer(:) - real(r8), pointer :: deadstemn_xfer_to_deadstemn(:) - real(r8), pointer :: frootn_storage_to_xfer(:) - real(r8), pointer :: frootn_to_litter(:) - real(r8), pointer :: frootn_xfer_to_frootn(:) - real(r8), pointer :: leafn_storage_to_xfer(:) - real(r8), pointer :: leafn_to_litter(:) - real(r8), pointer :: leafn_to_retransn(:) - real(r8), pointer :: leafn_xfer_to_leafn(:) - real(r8), pointer :: livecrootn_storage_to_xfer(:) - real(r8), pointer :: livecrootn_to_deadcrootn(:) - real(r8), pointer :: livecrootn_to_retransn(:) - real(r8), pointer :: livecrootn_xfer_to_livecrootn(:) - real(r8), pointer :: livestemn_storage_to_xfer(:) - real(r8), pointer :: livestemn_to_deadstemn(:) - real(r8), pointer :: livestemn_to_retransn(:) - real(r8), pointer :: livestemn_xfer_to_livestemn(:) - real(r8), pointer :: npool_to_deadcrootn(:) - real(r8), pointer :: npool_to_deadcrootn_storage(:) - real(r8), pointer :: npool_to_deadstemn(:) - real(r8), pointer :: npool_to_deadstemn_storage(:) - real(r8), pointer :: npool_to_frootn(:) - real(r8), pointer :: npool_to_frootn_storage(:) - real(r8), pointer :: npool_to_leafn(:) - real(r8), pointer :: npool_to_leafn_storage(:) - real(r8), pointer :: npool_to_livecrootn(:) - real(r8), pointer :: npool_to_livecrootn_storage(:) - real(r8), pointer :: npool_to_livestemn(:) ! allocation to live stem N (gN/m2/s) - real(r8), pointer :: npool_to_livestemn_storage(:) ! allocation to live stem N storage (gN/m2/s) - real(r8), pointer :: retransn_to_npool(:) ! deployment of retranslocated N (gN/m2/s) - real(r8), pointer :: sminn_to_npool(:) ! deployment of soil mineral N uptake (gN/m2/s) - real(r8), pointer :: grainn_storage_to_xfer(:) ! grain N shift storage to transfer (gN/m2/s) - real(r8), pointer :: grainn_to_food(:) ! grain N to food (gN/m2/s) - real(r8), pointer :: grainn_xfer_to_grainn(:) ! grain N growth from storage (gN/m2/s) - real(r8), pointer :: livestemn_to_litter(:) ! livestem N to litter (gN/m2/s) - real(r8), pointer :: npool_to_grainn(:) ! allocation to grain N (gN/m2/s) - real(r8), pointer :: npool_to_grainn_storage(:) ! allocation to grain N storage (gN/m2/s) -! -! local pointers to implicit in/out scalars - real(r8), pointer :: grainn(:) ! (gN/m2) grain N - real(r8), pointer :: grainn_storage(:) ! (gN/m2) grain N storage - real(r8), pointer :: grainn_xfer(:) ! (gN/m2) grain N transfer - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N - real(r8), pointer :: soil1n(:) ! (gN/m2) soil organic matter N (fast pool) - real(r8), pointer :: soil2n(:) ! (gN/m2) soil organic matter N (medium pool) - real(r8), pointer :: soil3n(:) ! (gN/m2) soil orgainc matter N (slow pool) - real(r8), pointer :: soil4n(:) ! (gN/m2) soil orgainc matter N (slowest pool) - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: npool(:) ! (gN/m2) temporary plant N pool - -! local pointers for dynamic landcover fluxes and states - real(r8), pointer :: dwt_seedn_to_leaf(:) - real(r8), pointer :: dwt_seedn_to_deadstem(:) - real(r8), pointer :: dwt_frootn_to_litr1n(:) - real(r8), pointer :: dwt_frootn_to_litr2n(:) - real(r8), pointer :: dwt_frootn_to_litr3n(:) - real(r8), pointer :: dwt_livecrootn_to_cwdn(:) - real(r8), pointer :: dwt_deadcrootn_to_cwdn(:) - real(r8), pointer :: seedn(:) -! -! local pointers to implicit out scalars - real(r8), pointer :: col_begnb(:) ! nitrogen mass, beginning of time step (gN/m**2) - real(r8), pointer :: pft_begnb(:) ! nitrogen mass, beginning of time step (gN/m**2) -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers - woody => pftcon%woody - - ! assign local pointers at the column level - cwdn_to_litr2n => cnf%cwdn_to_litr2n - cwdn_to_litr3n => cnf%cwdn_to_litr3n - livestemn_to_litr1n => cnf%livestemn_to_litr1n - livestemn_to_litr2n => cnf%livestemn_to_litr2n - livestemn_to_litr3n => cnf%livestemn_to_litr3n - grainn_to_litr1n => cnf%grainn_to_litr1n - grainn_to_litr2n => cnf%grainn_to_litr2n - grainn_to_litr3n => cnf%grainn_to_litr3n - frootn_to_litr1n => cnf%frootn_to_litr1n - frootn_to_litr2n => cnf%frootn_to_litr2n - frootn_to_litr3n => cnf%frootn_to_litr3n - leafn_to_litr1n => cnf%leafn_to_litr1n - leafn_to_litr2n => cnf%leafn_to_litr2n - leafn_to_litr3n => cnf%leafn_to_litr3n - litr1n_to_soil1n => cnf%litr1n_to_soil1n - litr2n_to_soil2n => cnf%litr2n_to_soil2n - litr3n_to_soil3n => cnf%litr3n_to_soil3n - ndep_to_sminn => cnf%ndep_to_sminn - nfix_to_sminn => cnf%nfix_to_sminn - sminn_to_denit_excess => cnf%sminn_to_denit_excess - sminn_to_denit_l1s1 => cnf%sminn_to_denit_l1s1 - sminn_to_denit_l2s2 => cnf%sminn_to_denit_l2s2 - sminn_to_denit_l3s3 => cnf%sminn_to_denit_l3s3 - sminn_to_denit_s1s2 => cnf%sminn_to_denit_s1s2 - sminn_to_denit_s2s3 => cnf%sminn_to_denit_s2s3 - sminn_to_denit_s3s4 => cnf%sminn_to_denit_s3s4 - sminn_to_denit_s4 => cnf%sminn_to_denit_s4 - sminn_to_plant => cnf%sminn_to_plant - sminn_to_soil1n_l1 => cnf%sminn_to_soil1n_l1 - sminn_to_soil2n_l2 => cnf%sminn_to_soil2n_l2 - sminn_to_soil2n_s1 => cnf%sminn_to_soil2n_s1 - sminn_to_soil3n_l3 => cnf%sminn_to_soil3n_l3 - sminn_to_soil3n_s2 => cnf%sminn_to_soil3n_s2 - sminn_to_soil4n_s3 => cnf%sminn_to_soil4n_s3 - soil1n_to_soil2n => cnf%soil1n_to_soil2n - soil2n_to_soil3n => cnf%soil2n_to_soil3n - soil3n_to_soil4n => cnf%soil3n_to_soil4n - soil4n_to_sminn => cnf%soil4n_to_sminn - supplement_to_sminn => cnf%supplement_to_sminn - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - sminn => cns%sminn - soil1n => cns%soil1n - soil2n => cns%soil2n - soil3n => cns%soil3n - soil4n => cns%soil4n - ! new pointers for dynamic landcover - dwt_seedn_to_leaf => cnf%dwt_seedn_to_leaf - dwt_seedn_to_deadstem => cnf%dwt_seedn_to_deadstem - dwt_frootn_to_litr1n => cnf%dwt_frootn_to_litr1n - dwt_frootn_to_litr2n => cnf%dwt_frootn_to_litr2n - dwt_frootn_to_litr3n => cnf%dwt_frootn_to_litr3n - dwt_livecrootn_to_cwdn => cnf%dwt_livecrootn_to_cwdn - dwt_deadcrootn_to_cwdn => cnf%dwt_deadcrootn_to_cwdn - seedn => cns%seedn - - ! assign local pointers at the pft level - ivt => pft%itype - deadcrootn_storage_to_xfer => pnf%deadcrootn_storage_to_xfer - deadcrootn_xfer_to_deadcrootn => pnf%deadcrootn_xfer_to_deadcrootn - deadstemn_storage_to_xfer => pnf%deadstemn_storage_to_xfer - deadstemn_xfer_to_deadstemn => pnf%deadstemn_xfer_to_deadstemn - frootn_storage_to_xfer => pnf%frootn_storage_to_xfer - frootn_to_litter => pnf%frootn_to_litter - frootn_xfer_to_frootn => pnf%frootn_xfer_to_frootn - leafn_storage_to_xfer => pnf%leafn_storage_to_xfer - leafn_to_litter => pnf%leafn_to_litter - leafn_to_retransn => pnf%leafn_to_retransn - leafn_xfer_to_leafn => pnf%leafn_xfer_to_leafn - livecrootn_storage_to_xfer => pnf%livecrootn_storage_to_xfer - livecrootn_to_deadcrootn => pnf%livecrootn_to_deadcrootn - livecrootn_to_retransn => pnf%livecrootn_to_retransn - livecrootn_xfer_to_livecrootn => pnf%livecrootn_xfer_to_livecrootn - livestemn_storage_to_xfer => pnf%livestemn_storage_to_xfer - livestemn_to_deadstemn => pnf%livestemn_to_deadstemn - livestemn_to_retransn => pnf%livestemn_to_retransn - livestemn_xfer_to_livestemn => pnf%livestemn_xfer_to_livestemn - npool_to_deadcrootn => pnf%npool_to_deadcrootn - npool_to_deadcrootn_storage => pnf%npool_to_deadcrootn_storage - npool_to_deadstemn => pnf%npool_to_deadstemn - npool_to_deadstemn_storage => pnf%npool_to_deadstemn_storage - npool_to_frootn => pnf%npool_to_frootn - npool_to_frootn_storage => pnf%npool_to_frootn_storage - npool_to_leafn => pnf%npool_to_leafn - npool_to_leafn_storage => pnf%npool_to_leafn_storage - npool_to_livecrootn => pnf%npool_to_livecrootn - npool_to_livecrootn_storage => pnf%npool_to_livecrootn_storage - npool_to_livestemn => pnf%npool_to_livestemn - npool_to_livestemn_storage => pnf%npool_to_livestemn_storage - retransn_to_npool => pnf%retransn_to_npool - sminn_to_npool => pnf%sminn_to_npool - grainn_storage_to_xfer => pnf%grainn_storage_to_xfer - grainn_to_food => pnf%grainn_to_food - grainn_xfer_to_grainn => pnf%grainn_xfer_to_grainn - livestemn_to_litter => pnf%livestemn_to_litter - npool_to_grainn => pnf%npool_to_grainn - npool_to_grainn_storage => pnf%npool_to_grainn_storage - grainn => pns%grainn - grainn_storage => pns%grainn_storage - grainn_xfer => pns%grainn_xfer - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - npool => pns%npool - retransn => pns%retransn - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column-level fluxes - - ! N deposition and fixation - sminn(c) = sminn(c) + ndep_to_sminn(c)*dt - sminn(c) = sminn(c) + nfix_to_sminn(c)*dt - - ! plant to litter fluxes - ! leaf litter - litr1n(c) = litr1n(c) + leafn_to_litr1n(c)*dt - litr2n(c) = litr2n(c) + leafn_to_litr2n(c)*dt - litr3n(c) = litr3n(c) + leafn_to_litr3n(c)*dt - ! fine root litter - litr1n(c) = litr1n(c) + frootn_to_litr1n(c)*dt - litr2n(c) = litr2n(c) + frootn_to_litr2n(c)*dt - litr3n(c) = litr3n(c) + frootn_to_litr3n(c)*dt - if ( crop_prog )then - ! livestem litter - litr1n(c) = litr1n(c) + livestemn_to_litr1n(c)*dt - litr2n(c) = litr2n(c) + livestemn_to_litr2n(c)*dt - litr3n(c) = litr3n(c) + livestemn_to_litr3n(c)*dt - ! grain litter - litr1n(c) = litr1n(c) + grainn_to_litr1n(c)*dt - litr2n(c) = litr2n(c) + grainn_to_litr2n(c)*dt - litr3n(c) = litr3n(c) + grainn_to_litr3n(c)*dt - end if - - ! seeding fluxes, from dynamic landcover - seedn(c) = seedn(c) - dwt_seedn_to_leaf(c) * dt - seedn(c) = seedn(c) - dwt_seedn_to_deadstem(c) * dt - - ! fluxes into litter and CWD, from dynamic landcover - litr1n(c) = litr1n(c) + dwt_frootn_to_litr1n(c)*dt - litr2n(c) = litr2n(c) + dwt_frootn_to_litr2n(c)*dt - litr3n(c) = litr3n(c) + dwt_frootn_to_litr3n(c)*dt - cwdn(c) = cwdn(c) + dwt_livecrootn_to_cwdn(c)*dt - cwdn(c) = cwdn(c) + dwt_deadcrootn_to_cwdn(c)*dt - - ! CWD to litter fluxes - cwdn(c) = cwdn(c) - cwdn_to_litr2n(c)*dt - litr2n(c) = litr2n(c) + cwdn_to_litr2n(c)*dt - cwdn(c) = cwdn(c) - cwdn_to_litr3n(c)*dt - litr3n(c) = litr3n(c) + cwdn_to_litr3n(c)*dt - - ! update litter states - litr1n(c) = litr1n(c) - litr1n_to_soil1n(c)*dt - litr2n(c) = litr2n(c) - litr2n_to_soil2n(c)*dt - litr3n(c) = litr3n(c) - litr3n_to_soil3n(c)*dt - - ! update SOM states - soil1n(c) = soil1n(c) + & - (litr1n_to_soil1n(c) + sminn_to_soil1n_l1(c) - soil1n_to_soil2n(c))*dt - soil2n(c) = soil2n(c) + & - (litr2n_to_soil2n(c) + sminn_to_soil2n_l2(c) + & - soil1n_to_soil2n(c) + sminn_to_soil2n_s1(c) - soil2n_to_soil3n(c))*dt - soil3n(c) = soil3n(c) + & - (litr3n_to_soil3n(c) + sminn_to_soil3n_l3(c) + & - soil2n_to_soil3n(c) + sminn_to_soil3n_s2(c) - soil3n_to_soil4n(c))*dt - soil4n(c) = soil4n(c) + & - (soil3n_to_soil4n(c) + sminn_to_soil4n_s3(c) - soil4n_to_sminn(c))*dt - - ! immobilization/mineralization in litter-to-SOM and SOM-to-SOM fluxes - sminn(c) = sminn(c) - & - (sminn_to_soil1n_l1(c) + sminn_to_soil2n_l2(c) + & - sminn_to_soil3n_l3(c) + sminn_to_soil2n_s1(c) + & - sminn_to_soil3n_s2(c) + sminn_to_soil4n_s3(c) - & - soil4n_to_sminn(c))*dt - - ! denitrification fluxes - sminn(c) = sminn(c) - & - (sminn_to_denit_l1s1(c) + sminn_to_denit_l2s2(c) + & - sminn_to_denit_l3s3(c) + sminn_to_denit_s1s2(c) + & - sminn_to_denit_s2s3(c) + sminn_to_denit_s3s4(c) + & - sminn_to_denit_s4(c) + sminn_to_denit_excess(c))*dt - - ! total plant uptake from mineral N - sminn(c) = sminn(c) - sminn_to_plant(c)*dt - - ! flux that prevents N limitation (when Carbon_only is set) - sminn(c) = sminn(c) + supplement_to_sminn(c)*dt - - end do ! end of column loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! phenology: transfer growth fluxes - leafn(p) = leafn(p) + leafn_xfer_to_leafn(p)*dt - leafn_xfer(p) = leafn_xfer(p) - leafn_xfer_to_leafn(p)*dt - frootn(p) = frootn(p) + frootn_xfer_to_frootn(p)*dt - frootn_xfer(p) = frootn_xfer(p) - frootn_xfer_to_frootn(p)*dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn(p) = livestemn(p) + livestemn_xfer_to_livestemn(p)*dt - livestemn_xfer(p) = livestemn_xfer(p) - livestemn_xfer_to_livestemn(p)*dt - deadstemn(p) = deadstemn(p) + deadstemn_xfer_to_deadstemn(p)*dt - deadstemn_xfer(p) = deadstemn_xfer(p) - deadstemn_xfer_to_deadstemn(p)*dt - livecrootn(p) = livecrootn(p) + livecrootn_xfer_to_livecrootn(p)*dt - livecrootn_xfer(p) = livecrootn_xfer(p) - livecrootn_xfer_to_livecrootn(p)*dt - deadcrootn(p) = deadcrootn(p) + deadcrootn_xfer_to_deadcrootn(p)*dt - deadcrootn_xfer(p) = deadcrootn_xfer(p) - deadcrootn_xfer_to_deadcrootn(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - livestemn(p) = livestemn(p) + livestemn_xfer_to_livestemn(p)*dt - livestemn_xfer(p) = livestemn_xfer(p) - livestemn_xfer_to_livestemn(p)*dt - grainn(p) = grainn(p) + grainn_xfer_to_grainn(p)*dt - grainn_xfer(p) = grainn_xfer(p) - grainn_xfer_to_grainn(p)*dt - end if - - ! phenology: litterfall and retranslocation fluxes - leafn(p) = leafn(p) - leafn_to_litter(p)*dt - frootn(p) = frootn(p) - frootn_to_litter(p)*dt - leafn(p) = leafn(p) - leafn_to_retransn(p)*dt - retransn(p) = retransn(p) + leafn_to_retransn(p)*dt - - ! live wood turnover and retranslocation fluxes - if (woody(ivt(p)) == 1._r8) then - livestemn(p) = livestemn(p) - livestemn_to_deadstemn(p)*dt - deadstemn(p) = deadstemn(p) + livestemn_to_deadstemn(p)*dt - livestemn(p) = livestemn(p) - livestemn_to_retransn(p)*dt - retransn(p) = retransn(p) + livestemn_to_retransn(p)*dt - livecrootn(p) = livecrootn(p) - livecrootn_to_deadcrootn(p)*dt - deadcrootn(p) = deadcrootn(p) + livecrootn_to_deadcrootn(p)*dt - livecrootn(p) = livecrootn(p) - livecrootn_to_retransn(p)*dt - retransn(p) = retransn(p) + livecrootn_to_retransn(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - livestemn(p) = livestemn(p) - livestemn_to_litter(p)*dt - livestemn(p) = livestemn(p) - livestemn_to_retransn(p)*dt - retransn(p) = retransn(p) + livestemn_to_retransn(p)*dt - grainn(p) = grainn(p) - grainn_to_food(p)*dt - end if - - ! uptake from soil mineral N pool - npool(p) = npool(p) + sminn_to_npool(p)*dt - - ! deployment from retranslocation pool - npool(p) = npool(p) + retransn_to_npool(p)*dt - retransn(p) = retransn(p) - retransn_to_npool(p)*dt - - ! allocation fluxes - npool(p) = npool(p) - npool_to_leafn(p)*dt - leafn(p) = leafn(p) + npool_to_leafn(p)*dt - npool(p) = npool(p) - npool_to_leafn_storage(p)*dt - leafn_storage(p) = leafn_storage(p) + npool_to_leafn_storage(p)*dt - npool(p) = npool(p) - npool_to_frootn(p)*dt - frootn(p) = frootn(p) + npool_to_frootn(p)*dt - npool(p) = npool(p) - npool_to_frootn_storage(p)*dt - frootn_storage(p) = frootn_storage(p) + npool_to_frootn_storage(p)*dt - if (woody(ivt(p)) == 1._r8) then - npool(p) = npool(p) - npool_to_livestemn(p)*dt - livestemn(p) = livestemn(p) + npool_to_livestemn(p)*dt - npool(p) = npool(p) - npool_to_livestemn_storage(p)*dt - livestemn_storage(p) = livestemn_storage(p) + npool_to_livestemn_storage(p)*dt - npool(p) = npool(p) - npool_to_deadstemn(p)*dt - deadstemn(p) = deadstemn(p) + npool_to_deadstemn(p)*dt - npool(p) = npool(p) - npool_to_deadstemn_storage(p)*dt - deadstemn_storage(p) = deadstemn_storage(p) + npool_to_deadstemn_storage(p)*dt - npool(p) = npool(p) - npool_to_livecrootn(p)*dt - livecrootn(p) = livecrootn(p) + npool_to_livecrootn(p)*dt - npool(p) = npool(p) - npool_to_livecrootn_storage(p)*dt - livecrootn_storage(p) = livecrootn_storage(p) + npool_to_livecrootn_storage(p)*dt - npool(p) = npool(p) - npool_to_deadcrootn(p)*dt - deadcrootn(p) = deadcrootn(p) + npool_to_deadcrootn(p)*dt - npool(p) = npool(p) - npool_to_deadcrootn_storage(p)*dt - deadcrootn_storage(p) = deadcrootn_storage(p) + npool_to_deadcrootn_storage(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - npool(p) = npool(p) - npool_to_livestemn(p)*dt - livestemn(p) = livestemn(p) + npool_to_livestemn(p)*dt - npool(p) = npool(p) - npool_to_livestemn_storage(p)*dt - livestemn_storage(p) = livestemn_storage(p) + npool_to_livestemn_storage(p)*dt - npool(p) = npool(p) - npool_to_grainn(p)*dt - grainn(p) = grainn(p) + npool_to_grainn(p)*dt - npool(p) = npool(p) - npool_to_grainn_storage(p)*dt - grainn_storage(p) = grainn_storage(p) + npool_to_grainn_storage(p)*dt - end if - - ! move storage pools into transfer pools - leafn_storage(p) = leafn_storage(p) - leafn_storage_to_xfer(p)*dt - leafn_xfer(p) = leafn_xfer(p) + leafn_storage_to_xfer(p)*dt - frootn_storage(p) = frootn_storage(p) - frootn_storage_to_xfer(p)*dt - frootn_xfer(p) = frootn_xfer(p) + frootn_storage_to_xfer(p)*dt - if (woody(ivt(p)) == 1._r8) then - livestemn_storage(p) = livestemn_storage(p) - livestemn_storage_to_xfer(p)*dt - livestemn_xfer(p) = livestemn_xfer(p) + livestemn_storage_to_xfer(p)*dt - deadstemn_storage(p) = deadstemn_storage(p) - deadstemn_storage_to_xfer(p)*dt - deadstemn_xfer(p) = deadstemn_xfer(p) + deadstemn_storage_to_xfer(p)*dt - livecrootn_storage(p) = livecrootn_storage(p) - livecrootn_storage_to_xfer(p)*dt - livecrootn_xfer(p) = livecrootn_xfer(p) + livecrootn_storage_to_xfer(p)*dt - deadcrootn_storage(p) = deadcrootn_storage(p) - deadcrootn_storage_to_xfer(p)*dt - deadcrootn_xfer(p) = deadcrootn_xfer(p) + deadcrootn_storage_to_xfer(p)*dt - end if - if (ivt(p) >= npcropmin) then ! skip 2 generic crops - ! lines here for consistency; the transfer terms are zero - livestemn_storage(p) = livestemn_storage(p) - livestemn_storage_to_xfer(p)*dt - livestemn_xfer(p) = livestemn_xfer(p) + livestemn_storage_to_xfer(p)*dt - grainn_storage(p) = grainn_storage(p) - grainn_storage_to_xfer(p)*dt - grainn_xfer(p) = grainn_xfer(p) + grainn_storage_to_xfer(p)*dt - end if - - end do - -end subroutine NStateUpdate1 -!----------------------------------------------------------------------- - -end module CNNStateUpdate1Mod diff --git a/src_clm40/biogeochem/CNNStateUpdate2Mod.F90 b/src_clm40/biogeochem/CNNStateUpdate2Mod.F90 deleted file mode 100644 index a26e4c87cc..0000000000 --- a/src_clm40/biogeochem/CNNStateUpdate2Mod.F90 +++ /dev/null @@ -1,550 +0,0 @@ -module CNNStateUpdate2Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: NStateUpdate2Mod -! -! !DESCRIPTION: -! Module for nitrogen state variable update, mortality fluxes. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: NStateUpdate2 - public:: NStateUpdate2h -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NStateUpdate2 -! -! !INTERFACE: -subroutine NStateUpdate2(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic nitrogen state -! variables affected by gap-phase mortality fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: m_deadcrootn_storage_to_litr1n(:) - real(r8), pointer :: m_deadcrootn_to_cwdn(:) - real(r8), pointer :: m_deadcrootn_xfer_to_litr1n(:) - real(r8), pointer :: m_deadstemn_storage_to_litr1n(:) - real(r8), pointer :: m_deadstemn_to_cwdn(:) - real(r8), pointer :: m_deadstemn_xfer_to_litr1n(:) - real(r8), pointer :: m_frootn_storage_to_litr1n(:) - real(r8), pointer :: m_frootn_to_litr1n(:) - real(r8), pointer :: m_frootn_to_litr2n(:) - real(r8), pointer :: m_frootn_to_litr3n(:) - real(r8), pointer :: m_frootn_xfer_to_litr1n(:) - real(r8), pointer :: m_leafn_storage_to_litr1n(:) - real(r8), pointer :: m_leafn_to_litr1n(:) - real(r8), pointer :: m_leafn_to_litr2n(:) - real(r8), pointer :: m_leafn_to_litr3n(:) - real(r8), pointer :: m_leafn_xfer_to_litr1n(:) - real(r8), pointer :: m_livecrootn_storage_to_litr1n(:) - real(r8), pointer :: m_livecrootn_to_cwdn(:) - real(r8), pointer :: m_livecrootn_xfer_to_litr1n(:) - real(r8), pointer :: m_livestemn_storage_to_litr1n(:) - real(r8), pointer :: m_livestemn_to_cwdn(:) - real(r8), pointer :: m_livestemn_xfer_to_litr1n(:) - real(r8), pointer :: m_retransn_to_litr1n(:) - real(r8), pointer :: m_deadcrootn_storage_to_litter(:) - real(r8), pointer :: m_deadcrootn_to_litter(:) - real(r8), pointer :: m_deadcrootn_xfer_to_litter(:) - real(r8), pointer :: m_deadstemn_storage_to_litter(:) - real(r8), pointer :: m_deadstemn_to_litter(:) - real(r8), pointer :: m_deadstemn_xfer_to_litter(:) - real(r8), pointer :: m_frootn_storage_to_litter(:) - real(r8), pointer :: m_frootn_to_litter(:) - real(r8), pointer :: m_frootn_xfer_to_litter(:) - real(r8), pointer :: m_leafn_storage_to_litter(:) - real(r8), pointer :: m_leafn_to_litter(:) - real(r8), pointer :: m_leafn_xfer_to_litter(:) - real(r8), pointer :: m_livecrootn_storage_to_litter(:) - real(r8), pointer :: m_livecrootn_to_litter(:) - real(r8), pointer :: m_livecrootn_xfer_to_litter(:) - real(r8), pointer :: m_livestemn_storage_to_litter(:) - real(r8), pointer :: m_livestemn_to_litter(:) - real(r8), pointer :: m_livestemn_xfer_to_litter(:) - real(r8), pointer :: m_retransn_to_litter(:) -! -! local pointers to implicit in/out scalars - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - m_deadcrootn_storage_to_litr1n => cnf%m_deadcrootn_storage_to_litr1n - m_deadcrootn_to_cwdn => cnf%m_deadcrootn_to_cwdn - m_deadcrootn_xfer_to_litr1n => cnf%m_deadcrootn_xfer_to_litr1n - m_deadstemn_storage_to_litr1n => cnf%m_deadstemn_storage_to_litr1n - m_deadstemn_to_cwdn => cnf%m_deadstemn_to_cwdn - m_deadstemn_xfer_to_litr1n => cnf%m_deadstemn_xfer_to_litr1n - m_frootn_storage_to_litr1n => cnf%m_frootn_storage_to_litr1n - m_frootn_to_litr1n => cnf%m_frootn_to_litr1n - m_frootn_to_litr2n => cnf%m_frootn_to_litr2n - m_frootn_to_litr3n => cnf%m_frootn_to_litr3n - m_frootn_xfer_to_litr1n => cnf%m_frootn_xfer_to_litr1n - m_leafn_storage_to_litr1n => cnf%m_leafn_storage_to_litr1n - m_leafn_to_litr1n => cnf%m_leafn_to_litr1n - m_leafn_to_litr2n => cnf%m_leafn_to_litr2n - m_leafn_to_litr3n => cnf%m_leafn_to_litr3n - m_leafn_xfer_to_litr1n => cnf%m_leafn_xfer_to_litr1n - m_livecrootn_storage_to_litr1n => cnf%m_livecrootn_storage_to_litr1n - m_livecrootn_to_cwdn => cnf%m_livecrootn_to_cwdn - m_livecrootn_xfer_to_litr1n => cnf%m_livecrootn_xfer_to_litr1n - m_livestemn_storage_to_litr1n => cnf%m_livestemn_storage_to_litr1n - m_livestemn_to_cwdn => cnf%m_livestemn_to_cwdn - m_livestemn_xfer_to_litr1n => cnf%m_livestemn_xfer_to_litr1n - m_retransn_to_litr1n => cnf%m_retransn_to_litr1n - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - - ! assign local pointers at the pft level - m_deadcrootn_storage_to_litter => pnf%m_deadcrootn_storage_to_litter - m_deadcrootn_to_litter => pnf%m_deadcrootn_to_litter - m_deadcrootn_xfer_to_litter => pnf%m_deadcrootn_xfer_to_litter - m_deadstemn_storage_to_litter => pnf%m_deadstemn_storage_to_litter - m_deadstemn_to_litter => pnf%m_deadstemn_to_litter - m_deadstemn_xfer_to_litter => pnf%m_deadstemn_xfer_to_litter - m_frootn_storage_to_litter => pnf%m_frootn_storage_to_litter - m_frootn_to_litter => pnf%m_frootn_to_litter - m_frootn_xfer_to_litter => pnf%m_frootn_xfer_to_litter - m_leafn_storage_to_litter => pnf%m_leafn_storage_to_litter - m_leafn_to_litter => pnf%m_leafn_to_litter - m_leafn_xfer_to_litter => pnf%m_leafn_xfer_to_litter - m_livecrootn_storage_to_litter => pnf%m_livecrootn_storage_to_litter - m_livecrootn_to_litter => pnf%m_livecrootn_to_litter - m_livecrootn_xfer_to_litter => pnf%m_livecrootn_xfer_to_litter - m_livestemn_storage_to_litter => pnf%m_livestemn_storage_to_litter - m_livestemn_to_litter => pnf%m_livestemn_to_litter - m_livestemn_xfer_to_litter => pnf%m_livestemn_xfer_to_litter - m_retransn_to_litter => pnf%m_retransn_to_litter - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - retransn => pns%retransn - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column-level nitrogen fluxes from gap-phase mortality - - ! leaf to litter - litr1n(c) = litr1n(c) + m_leafn_to_litr1n(c) * dt - litr2n(c) = litr2n(c) + m_leafn_to_litr2n(c) * dt - litr3n(c) = litr3n(c) + m_leafn_to_litr3n(c) * dt - - ! fine root to litter - litr1n(c) = litr1n(c) + m_frootn_to_litr1n(c) * dt - litr2n(c) = litr2n(c) + m_frootn_to_litr2n(c) * dt - litr3n(c) = litr3n(c) + m_frootn_to_litr3n(c) * dt - - ! wood to CWD - cwdn(c) = cwdn(c) + m_livestemn_to_cwdn(c) * dt - cwdn(c) = cwdn(c) + m_deadstemn_to_cwdn(c) * dt - cwdn(c) = cwdn(c) + m_livecrootn_to_cwdn(c) * dt - cwdn(c) = cwdn(c) + m_deadcrootn_to_cwdn(c) * dt - - ! retranslocated N pool to litter - litr1n(c) = litr1n(c) + m_retransn_to_litr1n(c) * dt - - ! storage pools to litter - litr1n(c) = litr1n(c) + m_leafn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_frootn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_livestemn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_deadstemn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_livecrootn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_deadcrootn_storage_to_litr1n(c) * dt - - ! transfer pools to litter - litr1n(c) = litr1n(c) + m_leafn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_frootn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_livestemn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_deadstemn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_livecrootn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + m_deadcrootn_xfer_to_litr1n(c) * dt - - end do ! end of column loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level nitrogen fluxes from gap-phase mortality - ! displayed pools - leafn(p) = leafn(p) - m_leafn_to_litter(p) * dt - frootn(p) = frootn(p) - m_frootn_to_litter(p) * dt - livestemn(p) = livestemn(p) - m_livestemn_to_litter(p) * dt - deadstemn(p) = deadstemn(p) - m_deadstemn_to_litter(p) * dt - livecrootn(p) = livecrootn(p) - m_livecrootn_to_litter(p) * dt - deadcrootn(p) = deadcrootn(p) - m_deadcrootn_to_litter(p) * dt - retransn(p) = retransn(p) - m_retransn_to_litter(p) * dt - - ! storage pools - leafn_storage(p) = leafn_storage(p) - m_leafn_storage_to_litter(p) * dt - frootn_storage(p) = frootn_storage(p) - m_frootn_storage_to_litter(p) * dt - livestemn_storage(p) = livestemn_storage(p) - m_livestemn_storage_to_litter(p) * dt - deadstemn_storage(p) = deadstemn_storage(p) - m_deadstemn_storage_to_litter(p) * dt - livecrootn_storage(p) = livecrootn_storage(p) - m_livecrootn_storage_to_litter(p) * dt - deadcrootn_storage(p) = deadcrootn_storage(p) - m_deadcrootn_storage_to_litter(p) * dt - - ! transfer pools - leafn_xfer(p) = leafn_xfer(p) - m_leafn_xfer_to_litter(p) * dt - frootn_xfer(p) = frootn_xfer(p) - m_frootn_xfer_to_litter(p) * dt - livestemn_xfer(p) = livestemn_xfer(p) - m_livestemn_xfer_to_litter(p) * dt - deadstemn_xfer(p) = deadstemn_xfer(p) - m_deadstemn_xfer_to_litter(p) * dt - livecrootn_xfer(p) = livecrootn_xfer(p) - m_livecrootn_xfer_to_litter(p) * dt - deadcrootn_xfer(p) = deadcrootn_xfer(p) - m_deadcrootn_xfer_to_litter(p) * dt - - end do - -end subroutine NStateUpdate2 -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NStateUpdate2h -! -! !INTERFACE: -subroutine NStateUpdate2h(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Update all the prognostic nitrogen state -! variables affected by harvest mortality fluxes -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: hrv_deadcrootn_storage_to_litr1n(:) - real(r8), pointer :: hrv_deadcrootn_to_cwdn(:) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_deadstemn_storage_to_litr1n(:) - real(r8), pointer :: hrv_deadstemn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_frootn_storage_to_litr1n(:) - real(r8), pointer :: hrv_frootn_to_litr1n(:) - real(r8), pointer :: hrv_frootn_to_litr2n(:) - real(r8), pointer :: hrv_frootn_to_litr3n(:) - real(r8), pointer :: hrv_frootn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_leafn_storage_to_litr1n(:) - real(r8), pointer :: hrv_leafn_to_litr1n(:) - real(r8), pointer :: hrv_leafn_to_litr2n(:) - real(r8), pointer :: hrv_leafn_to_litr3n(:) - real(r8), pointer :: hrv_leafn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_livecrootn_storage_to_litr1n(:) - real(r8), pointer :: hrv_livecrootn_to_cwdn(:) - real(r8), pointer :: hrv_livecrootn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_livestemn_storage_to_litr1n(:) - real(r8), pointer :: hrv_livestemn_to_cwdn(:) - real(r8), pointer :: hrv_livestemn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_retransn_to_litr1n(:) - real(r8), pointer :: hrv_deadcrootn_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemn_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemn_to_prod10n(:) - real(r8), pointer :: hrv_deadstemn_to_prod100n(:) - real(r8), pointer :: hrv_deadstemn_xfer_to_litter(:) - real(r8), pointer :: hrv_frootn_storage_to_litter(:) - real(r8), pointer :: hrv_frootn_to_litter(:) - real(r8), pointer :: hrv_frootn_xfer_to_litter(:) - real(r8), pointer :: hrv_leafn_storage_to_litter(:) - real(r8), pointer :: hrv_leafn_to_litter(:) - real(r8), pointer :: hrv_leafn_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootn_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootn_to_litter(:) - real(r8), pointer :: hrv_livecrootn_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemn_storage_to_litter(:) - real(r8), pointer :: hrv_livestemn_to_litter(:) - real(r8), pointer :: hrv_livestemn_xfer_to_litter(:) - real(r8), pointer :: hrv_retransn_to_litter(:) -! -! local pointers to implicit in/out scalars - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - hrv_deadcrootn_storage_to_litr1n => cnf%hrv_deadcrootn_storage_to_litr1n - hrv_deadcrootn_to_cwdn => cnf%hrv_deadcrootn_to_cwdn - hrv_deadcrootn_xfer_to_litr1n => cnf%hrv_deadcrootn_xfer_to_litr1n - hrv_deadstemn_storage_to_litr1n => cnf%hrv_deadstemn_storage_to_litr1n - hrv_deadstemn_xfer_to_litr1n => cnf%hrv_deadstemn_xfer_to_litr1n - hrv_frootn_storage_to_litr1n => cnf%hrv_frootn_storage_to_litr1n - hrv_frootn_to_litr1n => cnf%hrv_frootn_to_litr1n - hrv_frootn_to_litr2n => cnf%hrv_frootn_to_litr2n - hrv_frootn_to_litr3n => cnf%hrv_frootn_to_litr3n - hrv_frootn_xfer_to_litr1n => cnf%hrv_frootn_xfer_to_litr1n - hrv_leafn_storage_to_litr1n => cnf%hrv_leafn_storage_to_litr1n - hrv_leafn_to_litr1n => cnf%hrv_leafn_to_litr1n - hrv_leafn_to_litr2n => cnf%hrv_leafn_to_litr2n - hrv_leafn_to_litr3n => cnf%hrv_leafn_to_litr3n - hrv_leafn_xfer_to_litr1n => cnf%hrv_leafn_xfer_to_litr1n - hrv_livecrootn_storage_to_litr1n => cnf%hrv_livecrootn_storage_to_litr1n - hrv_livecrootn_to_cwdn => cnf%hrv_livecrootn_to_cwdn - hrv_livecrootn_xfer_to_litr1n => cnf%hrv_livecrootn_xfer_to_litr1n - hrv_livestemn_storage_to_litr1n => cnf%hrv_livestemn_storage_to_litr1n - hrv_livestemn_to_cwdn => cnf%hrv_livestemn_to_cwdn - hrv_livestemn_xfer_to_litr1n => cnf%hrv_livestemn_xfer_to_litr1n - hrv_retransn_to_litr1n => cnf%hrv_retransn_to_litr1n - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - - ! assign local pointers at the pft level - hrv_deadcrootn_storage_to_litter => pnf%hrv_deadcrootn_storage_to_litter - hrv_deadcrootn_to_litter => pnf%hrv_deadcrootn_to_litter - hrv_deadcrootn_xfer_to_litter => pnf%hrv_deadcrootn_xfer_to_litter - hrv_deadstemn_storage_to_litter => pnf%hrv_deadstemn_storage_to_litter - hrv_deadstemn_to_prod10n => pnf%hrv_deadstemn_to_prod10n - hrv_deadstemn_to_prod100n => pnf%hrv_deadstemn_to_prod100n - hrv_deadstemn_xfer_to_litter => pnf%hrv_deadstemn_xfer_to_litter - hrv_frootn_storage_to_litter => pnf%hrv_frootn_storage_to_litter - hrv_frootn_to_litter => pnf%hrv_frootn_to_litter - hrv_frootn_xfer_to_litter => pnf%hrv_frootn_xfer_to_litter - hrv_leafn_storage_to_litter => pnf%hrv_leafn_storage_to_litter - hrv_leafn_to_litter => pnf%hrv_leafn_to_litter - hrv_leafn_xfer_to_litter => pnf%hrv_leafn_xfer_to_litter - hrv_livecrootn_storage_to_litter => pnf%hrv_livecrootn_storage_to_litter - hrv_livecrootn_to_litter => pnf%hrv_livecrootn_to_litter - hrv_livecrootn_xfer_to_litter => pnf%hrv_livecrootn_xfer_to_litter - hrv_livestemn_storage_to_litter => pnf%hrv_livestemn_storage_to_litter - hrv_livestemn_to_litter => pnf%hrv_livestemn_to_litter - hrv_livestemn_xfer_to_litter => pnf%hrv_livestemn_xfer_to_litter - hrv_retransn_to_litter => pnf%hrv_retransn_to_litter - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - retransn => pns%retransn - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column-level nitrogen fluxes from harvest mortality - - ! leaf to litter - litr1n(c) = litr1n(c) + hrv_leafn_to_litr1n(c) * dt - litr2n(c) = litr2n(c) + hrv_leafn_to_litr2n(c) * dt - litr3n(c) = litr3n(c) + hrv_leafn_to_litr3n(c) * dt - - ! fine root to litter - litr1n(c) = litr1n(c) + hrv_frootn_to_litr1n(c) * dt - litr2n(c) = litr2n(c) + hrv_frootn_to_litr2n(c) * dt - litr3n(c) = litr3n(c) + hrv_frootn_to_litr3n(c) * dt - - ! wood to CWD - cwdn(c) = cwdn(c) + hrv_livestemn_to_cwdn(c) * dt - cwdn(c) = cwdn(c) + hrv_livecrootn_to_cwdn(c) * dt - cwdn(c) = cwdn(c) + hrv_deadcrootn_to_cwdn(c) * dt - - ! wood to product pools - updates done in CNWoodProducts() - - ! retranslocated N pool to litter - litr1n(c) = litr1n(c) + hrv_retransn_to_litr1n(c) * dt - - ! storage pools to litter - litr1n(c) = litr1n(c) + hrv_leafn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_frootn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_livestemn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_deadstemn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_livecrootn_storage_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_deadcrootn_storage_to_litr1n(c) * dt - - ! transfer pools to litter - litr1n(c) = litr1n(c) + hrv_leafn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_frootn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_livestemn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_deadstemn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_livecrootn_xfer_to_litr1n(c) * dt - litr1n(c) = litr1n(c) + hrv_deadcrootn_xfer_to_litr1n(c) * dt - - end do ! end of column loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level nitrogen fluxes from harvest mortality - ! displayed pools - leafn(p) = leafn(p) - hrv_leafn_to_litter(p) * dt - frootn(p) = frootn(p) - hrv_frootn_to_litter(p) * dt - livestemn(p) = livestemn(p) - hrv_livestemn_to_litter(p) * dt - deadstemn(p) = deadstemn(p) - hrv_deadstemn_to_prod10n(p) * dt - deadstemn(p) = deadstemn(p) - hrv_deadstemn_to_prod100n(p)* dt - livecrootn(p) = livecrootn(p) - hrv_livecrootn_to_litter(p) * dt - deadcrootn(p) = deadcrootn(p) - hrv_deadcrootn_to_litter(p) * dt - retransn(p) = retransn(p) - hrv_retransn_to_litter(p) * dt - - ! storage pools - leafn_storage(p) = leafn_storage(p) - hrv_leafn_storage_to_litter(p) * dt - frootn_storage(p) = frootn_storage(p) - hrv_frootn_storage_to_litter(p) * dt - livestemn_storage(p) = livestemn_storage(p) - hrv_livestemn_storage_to_litter(p) * dt - deadstemn_storage(p) = deadstemn_storage(p) - hrv_deadstemn_storage_to_litter(p) * dt - livecrootn_storage(p) = livecrootn_storage(p) - hrv_livecrootn_storage_to_litter(p) * dt - deadcrootn_storage(p) = deadcrootn_storage(p) - hrv_deadcrootn_storage_to_litter(p) * dt - - ! transfer pools - leafn_xfer(p) = leafn_xfer(p) - hrv_leafn_xfer_to_litter(p) * dt - frootn_xfer(p) = frootn_xfer(p) - hrv_frootn_xfer_to_litter(p) * dt - livestemn_xfer(p) = livestemn_xfer(p) - hrv_livestemn_xfer_to_litter(p) * dt - deadstemn_xfer(p) = deadstemn_xfer(p) - hrv_deadstemn_xfer_to_litter(p) * dt - livecrootn_xfer(p) = livecrootn_xfer(p) - hrv_livecrootn_xfer_to_litter(p) * dt - deadcrootn_xfer(p) = deadcrootn_xfer(p) - hrv_deadcrootn_xfer_to_litter(p) * dt - - end do - -end subroutine NStateUpdate2h -!----------------------------------------------------------------------- - -end module CNNStateUpdate2Mod diff --git a/src_clm40/biogeochem/CNNStateUpdate3Mod.F90 b/src_clm40/biogeochem/CNNStateUpdate3Mod.F90 deleted file mode 100644 index 839d988e99..0000000000 --- a/src_clm40/biogeochem/CNNStateUpdate3Mod.F90 +++ /dev/null @@ -1,243 +0,0 @@ -module CNNStateUpdate3Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: NStateUpdate3Mod -! -! !DESCRIPTION: -! Module for nitrogen state variable update, mortality fluxes. -! Also, sminn leaching flux. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: NStateUpdate3 -! -! !REVISION HISTORY: -! 7/27/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NStateUpdate3 -! -! !INTERFACE: -subroutine NStateUpdate3(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, update all the prognostic nitrogen state -! variables affected by gap-phase mortality fluxes. Also the Sminn leaching flux. -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars - real(r8), pointer :: sminn_leached(:) - real(r8), pointer :: m_cwdn_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_cwdn_fire(:) - real(r8), pointer :: m_deadstemn_to_cwdn_fire(:) - real(r8), pointer :: m_litr1n_to_fire(:) - real(r8), pointer :: m_litr2n_to_fire(:) - real(r8), pointer :: m_litr3n_to_fire(:) - real(r8), pointer :: m_deadcrootn_storage_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_litter_fire(:) - real(r8), pointer :: m_deadcrootn_xfer_to_fire(:) - real(r8), pointer :: m_deadstemn_storage_to_fire(:) - real(r8), pointer :: m_deadstemn_to_fire(:) - real(r8), pointer :: m_deadstemn_to_litter_fire(:) - real(r8), pointer :: m_deadstemn_xfer_to_fire(:) - real(r8), pointer :: m_frootn_storage_to_fire(:) - real(r8), pointer :: m_frootn_to_fire(:) - real(r8), pointer :: m_frootn_xfer_to_fire(:) - real(r8), pointer :: m_leafn_storage_to_fire(:) - real(r8), pointer :: m_leafn_to_fire(:) - real(r8), pointer :: m_leafn_xfer_to_fire(:) - real(r8), pointer :: m_livecrootn_storage_to_fire(:) - real(r8), pointer :: m_livecrootn_to_fire(:) - real(r8), pointer :: m_livecrootn_xfer_to_fire(:) - real(r8), pointer :: m_livestemn_storage_to_fire(:) - real(r8), pointer :: m_livestemn_to_fire(:) - real(r8), pointer :: m_livestemn_xfer_to_fire(:) - real(r8), pointer :: m_retransn_to_fire(:) -! -! local pointers to implicit in/out scalars - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: dt ! radiation time step (seconds) - -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers at the column level - sminn_leached => cnf%sminn_leached - m_cwdn_to_fire => cnf%m_cwdn_to_fire - m_deadcrootn_to_cwdn_fire => cnf%m_deadcrootn_to_cwdn_fire - m_deadstemn_to_cwdn_fire => cnf%m_deadstemn_to_cwdn_fire - m_litr1n_to_fire => cnf%m_litr1n_to_fire - m_litr2n_to_fire => cnf%m_litr2n_to_fire - m_litr3n_to_fire => cnf%m_litr3n_to_fire - sminn => cns%sminn - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - - ! assign local pointers at the pft level - m_deadcrootn_storage_to_fire => pnf%m_deadcrootn_storage_to_fire - m_deadcrootn_to_fire => pnf%m_deadcrootn_to_fire - m_deadcrootn_to_litter_fire => pnf%m_deadcrootn_to_litter_fire - m_deadcrootn_xfer_to_fire => pnf%m_deadcrootn_xfer_to_fire - m_deadstemn_storage_to_fire => pnf%m_deadstemn_storage_to_fire - m_deadstemn_to_fire => pnf%m_deadstemn_to_fire - m_deadstemn_to_litter_fire => pnf%m_deadstemn_to_litter_fire - m_deadstemn_xfer_to_fire => pnf%m_deadstemn_xfer_to_fire - m_frootn_storage_to_fire => pnf%m_frootn_storage_to_fire - m_frootn_to_fire => pnf%m_frootn_to_fire - m_frootn_xfer_to_fire => pnf%m_frootn_xfer_to_fire - m_leafn_storage_to_fire => pnf%m_leafn_storage_to_fire - m_leafn_to_fire => pnf%m_leafn_to_fire - m_leafn_xfer_to_fire => pnf%m_leafn_xfer_to_fire - m_livecrootn_storage_to_fire => pnf%m_livecrootn_storage_to_fire - m_livecrootn_to_fire => pnf%m_livecrootn_to_fire - m_livecrootn_xfer_to_fire => pnf%m_livecrootn_xfer_to_fire - m_livestemn_storage_to_fire => pnf%m_livestemn_storage_to_fire - m_livestemn_to_fire => pnf%m_livestemn_to_fire - m_livestemn_xfer_to_fire => pnf%m_livestemn_xfer_to_fire - m_retransn_to_fire => pnf%m_retransn_to_fire - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - retransn => pns%retransn - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! mineral N loss due to leaching - sminn(c) = sminn(c) - sminn_leached(c) * dt - - ! column level nitrogen fluxes from fire - - ! pft-level wood to column-level CWD (uncombusted wood) - cwdn(c) = cwdn(c) + m_deadstemn_to_cwdn_fire(c) * dt - cwdn(c) = cwdn(c) + m_deadcrootn_to_cwdn_fire(c) * dt - - ! litter and CWD losses to fire - litr1n(c) = litr1n(c) - m_litr1n_to_fire(c) * dt - litr2n(c) = litr2n(c) - m_litr2n_to_fire(c) * dt - litr3n(c) = litr3n(c) - m_litr3n_to_fire(c) * dt - cwdn(c) = cwdn(c) - m_cwdn_to_fire(c) * dt - - end do ! end of column loop - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! pft-level nitrogen fluxes from fire - ! displayed pools - leafn(p) = leafn(p) - m_leafn_to_fire(p) * dt - frootn(p) = frootn(p) - m_frootn_to_fire(p) * dt - livestemn(p) = livestemn(p) - m_livestemn_to_fire(p) * dt - deadstemn(p) = deadstemn(p) - m_deadstemn_to_fire(p) * dt - deadstemn(p) = deadstemn(p) - m_deadstemn_to_litter_fire(p) * dt - livecrootn(p) = livecrootn(p) - m_livecrootn_to_fire(p) * dt - deadcrootn(p) = deadcrootn(p) - m_deadcrootn_to_fire(p) * dt - deadcrootn(p) = deadcrootn(p) - m_deadcrootn_to_litter_fire(p) * dt - - ! storage pools - leafn_storage(p) = leafn_storage(p) - m_leafn_storage_to_fire(p) * dt - frootn_storage(p) = frootn_storage(p) - m_frootn_storage_to_fire(p) * dt - livestemn_storage(p) = livestemn_storage(p) - m_livestemn_storage_to_fire(p) * dt - deadstemn_storage(p) = deadstemn_storage(p) - m_deadstemn_storage_to_fire(p) * dt - livecrootn_storage(p) = livecrootn_storage(p) - m_livecrootn_storage_to_fire(p) * dt - deadcrootn_storage(p) = deadcrootn_storage(p) - m_deadcrootn_storage_to_fire(p) * dt - - ! transfer pools - leafn_xfer(p) = leafn_xfer(p) - m_leafn_xfer_to_fire(p) * dt - frootn_xfer(p) = frootn_xfer(p) - m_frootn_xfer_to_fire(p) * dt - livestemn_xfer(p) = livestemn_xfer(p) - m_livestemn_xfer_to_fire(p) * dt - deadstemn_xfer(p) = deadstemn_xfer(p) - m_deadstemn_xfer_to_fire(p) * dt - livecrootn_xfer(p) = livecrootn_xfer(p) - m_livecrootn_xfer_to_fire(p) * dt - deadcrootn_xfer(p) = deadcrootn_xfer(p) - m_deadcrootn_xfer_to_fire(p) * dt - - ! retranslocated N pool - retransn(p) = retransn(p) - m_retransn_to_fire(p) * dt - - end do - -end subroutine NStateUpdate3 -!----------------------------------------------------------------------- - -end module CNNStateUpdate3Mod diff --git a/src_clm40/biogeochem/CNPhenologyMod.F90 b/src_clm40/biogeochem/CNPhenologyMod.F90 deleted file mode 100644 index 2266684fd5..0000000000 --- a/src_clm40/biogeochem/CNPhenologyMod.F90 +++ /dev/null @@ -1,2750 +0,0 @@ -module CNPhenologyMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNPhenologyMod -! -! !DESCRIPTION: -! Module holding routines used in phenology model for coupled carbon -! nitrogen code. -! -! !USES: - use clmtype - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varcon , only: tfrz - use clm_varctl , only: iulog, use_cndv - use clm_varpar , only: numpft - use shr_sys_mod , only: shr_sys_flush - use abortutils , only: endrun - implicit none - save - private - -! !PUBLIC MEMBER FUNCTIONS: - public :: CNPhenologyInit ! Initialization - public :: CNPhenology ! Update -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! 10/23/03, Peter Thornton: migrated all routines to vector data structures -! 2/4/08, slevis: adding crop phenology from AgroIBIS - -! !PRIVATE DATA MEMBERS: - - real(r8) :: dt ! radiation time step delta t (seconds) - real(r8) :: fracday ! dtime as a fraction of day - real(r8) :: crit_dayl ! critical daylength for offset (seconds) - real(r8) :: ndays_on ! number of days to complete onset - real(r8) :: ndays_off ! number of days to complete offset - real(r8) :: fstor2tran ! fraction of storage to move to transfer on each onset - real(r8) :: crit_onset_fdd ! critical number of freezing days - real(r8) :: crit_onset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_on ! water potential for onset trigger (MPa) - real(r8) :: crit_offset_fdd ! critical number of freezing degree days - ! to trigger offset - real(r8) :: crit_offset_swi ! water stress days for offset trigger - real(r8) :: soilpsi_off ! water potential for offset trigger (MPa) - real(r8) :: lwtop ! live wood turnover proportion (annual fraction) - ! - ! CropPhenology variables and constants - ! - real(r8) :: p1d, p1v ! photoperiod factor constants for crop vernalization - real(r8) :: hti ! cold hardening index threshold for vernalization - real(r8) :: tbase ! base temperature for vernalization - integer, parameter :: NOT_Planted = 999 ! If not planted yet in year - integer, parameter :: NOT_Harvested = 999 ! If not harvested yet in year - integer, parameter :: inNH = 1 ! Northern Hemisphere - integer, parameter :: inSH = 2 ! Southern Hemisphere - integer, pointer :: inhemi(:) ! Hemisphere that pft is in - integer :: minplantjday(0:numpft,inSH) ! minimum planting julian day - integer :: maxplantjday(0:numpft,inSH) ! maximum planting julian day - integer :: jdayyrstart(inSH) ! julian day of start of year - -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNPhenology -! -! !INTERFACE: -subroutine CNPhenology (num_soilc, filter_soilc, num_soilp, filter_soilp, & - num_pcropp, filter_pcropp, doalb) -! -! !DESCRIPTION: -! Dynamic phenology routine for coupled carbon-nitrogen code (CN) -! 1. grass phenology -! -! !USES: -! -! !ARGUMENTS: - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts - integer, intent(in) :: num_pcropp ! number of prog. crop pfts in filter - integer, intent(in) :: filter_pcropp(:)! filter for prognostic crop pfts - logical, intent(in) :: doalb ! true if time for sfc albedo calc -! -! !CALLED FROM: -! subroutine CNEcosystemDyn in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 7/28/03: Created by Peter Thornton -! 9/05/03, Peter Thornton: moved from call with (p) to call with (c) -! 10/3/03, Peter Thornton: added subroutine calls for different phenology types -! 11/7/03, Peter Thornton: moved phenology type tests into phenology type -! routines, and moved onset, offset, background litfall routines into -! main phenology call. -! !LOCAL VARIABLES: -! local pointers to implicit in arrays -! -! local pointers to implicit in/out scalars -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - - ! each of the following phenology type routines includes a filter - ! to operate only on the relevant pfts - - call CNPhenologyClimate(num_soilp, filter_soilp, num_pcropp, filter_pcropp) - - call CNEvergreenPhenology(num_soilp, filter_soilp) - - call CNSeasonDecidPhenology(num_soilp, filter_soilp) - - call CNStressDecidPhenology(num_soilp, filter_soilp) - - if (doalb .and. num_pcropp > 0 ) call CropPhenology(num_pcropp, filter_pcropp) - - ! the same onset and offset routines are called regardless of - ! phenology type - they depend only on onset_flag, offset_flag, bglfr, and bgtr - - call CNOnsetGrowth(num_soilp, filter_soilp) - - call CNOffsetLitterfall(num_soilp, filter_soilp) - - call CNBackgroundLitterfall(num_soilp, filter_soilp) - - call CNLivewoodTurnover(num_soilp, filter_soilp) - - ! gather all pft-level litterfall fluxes to the column - ! for litter C and N inputs - - call CNLitterToColumn(num_soilc, filter_soilc) - -end subroutine CNPhenology - -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNPhenologyInit -! -! !INTERFACE: -subroutine CNPhenologyInit( begp, endp ) -! -! !DESCRIPTION: -! Initialization of CNPhenology. Must be called after time-manager is -! initialized, and after pftcon file is read in. -! -! !USES: - use clm_time_manager, only: get_step_size - use surfrdMod , only: crop_prog - use clm_varcon , only: secspday -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begp, endp ! Beginning and ending PFT index -! !CALLED FROM: -! subroutine initialize2 in module clm_initializeMod.F90 -! -! !REVISION HISTORY: -! 3/28/11: Created by Erik Kluzek -! -! !LOCAL VARIABLES: -!EOP -!------------------------------------------------------------------------ - - ! - ! Get time-step and what fraction of a day it is - ! - dt = real( get_step_size(), r8 ) - fracday = dt/secspday - - ! set some local parameters - these will be moved into - ! parameter file after testing - - ! ----------------------------------------- - ! Constants for CNSeasonDecidPhenology - ! ----------------------------------------- - ! - ! critical daylength from Biome-BGC, v4.1.2 - crit_dayl = 39300._r8 - - ! ----------------------------------------- - ! Constants for CNSeasonDecidPhenology and CNStressDecidPhenology - ! ----------------------------------------- - ndays_on = 30._r8 - ndays_off = 15._r8 - - ! transfer parameters - fstor2tran = 0.5_r8 - ! ----------------------------------------- - ! Constants for CNStressDecidPhenology - ! ----------------------------------------- - - ! onset parameters - crit_onset_fdd = 15.0_r8 - ! critical onset gdd now being calculated as a function of annual - ! average 2m temp. - ! crit_onset_gdd = 150.0 ! c3 grass value - ! crit_onset_gdd = 1000.0 ! c4 grass value - crit_onset_swi = 15.0_r8 - soilpsi_on = -2.0_r8 - - ! offset parameters - crit_offset_fdd = 15.0_r8 - crit_offset_swi = 15.0_r8 - soilpsi_off = -2.0_r8 - - ! ----------------------------------------- - ! Constants for CNLivewoodTurnover - ! ----------------------------------------- - - ! set the global parameter for livewood turnover rate - ! define as an annual fraction (0.7), and convert to fraction per second - lwtop = 0.7_r8 / 31536000.0_r8 - - ! ----------------------------------------- - ! Call any subroutine specific initialization routines - ! ----------------------------------------- - - if ( crop_prog ) call CropPhenologyInit( begp, endp ) - -end subroutine CNPhenologyInit -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNPhenologyClimate -! -! !INTERFACE: -subroutine CNPhenologyClimate (num_soilp, filter_soilp, num_pcropp, filter_pcropp) -! -! !DESCRIPTION: -! For coupled carbon-nitrogen code (CN). -! -! !USES: - use clm_time_manager, only: get_days_per_year - use clm_time_manager, only: get_curr_date, is_first_step - use CropRestMod , only: CropRestYear -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts - integer, intent(in) :: num_pcropp ! number of prognostic crops in filter - integer, intent(in) :: filter_pcropp(:)! filter for prognostic crop pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 3/13/07: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - ! ecophysiological constants - real(r8), pointer :: t_ref2m(:) ! 2m air temperature (K) - real(r8), pointer :: tempavg_t2m(:) ! temp. avg 2m air temperature (K) - real(r8), pointer :: gdd0(:) ! growing deg. days base 0 deg C (ddays) - real(r8), pointer :: gdd8(:) ! " " " " 8 " " " - real(r8), pointer :: gdd10(:) ! " " " " 10 " " " - real(r8), pointer :: gdd020(:) ! 20-yr mean of gdd0 (ddays) - real(r8), pointer :: gdd820(:) ! 20-yr mean of gdd8 (ddays) - real(r8), pointer :: gdd1020(:) ! 20-yr mean of gdd10 (ddays) - integer , pointer :: pgridcell(:) ! pft's gridcell index -! -! local pointers to implicit in/out scalars -! -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter pft index - integer :: nyrs ! number of years prognostic crop has run - real(r8):: dayspyr ! days per year (days) - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) - real(r8), parameter :: yravg = 20.0_r8 ! length of years to average for gdd - real(r8), parameter :: yravgm1 = yravg-1.0_r8 ! minus 1 of above -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers to derived type arrays - ivt => pft%itype - t_ref2m => pes%t_ref2m - tempavg_t2m => pepv%tempavg_t2m - - gdd0 => pps%gdd0 - gdd8 => pps%gdd8 - gdd10 => pps%gdd10 - gdd020 => pps%gdd020 - gdd820 => pps%gdd820 - gdd1020 => pps%gdd1020 - pgridcell => pft%gridcell - - ! set time steps - - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - tempavg_t2m(p) = tempavg_t2m(p) + t_ref2m(p) * (fracday/dayspyr) - end do - - ! - ! The following crop related steps are done here rather than CropPhenology - ! so that they will be completed each time-step rather than with doalb. - ! - ! The following lines come from ibis's climate.f + stats.f - ! gdd SUMMATIONS ARE RELATIVE TO THE PLANTING DATE (see subr. updateAccFlds) - - if (num_pcropp > 0) then - ! get time-related info - call get_curr_date(kyr, kmo, kda, mcsec) - nyrs = CropRestYear() - end if - - do fp = 1,num_pcropp - p = filter_pcropp(fp) - if (kmo == 1 .and. kda == 1 .and. nyrs == 0) then ! YR 1: - gdd020(p) = 0._r8 ! set gdd..20 variables to 0 - gdd820(p) = 0._r8 ! and crops will not be planted - gdd1020(p) = 0._r8 - end if - if (kmo == 1 .and. kda == 1 .and. mcsec == 0) then ! <-- END of EVERY YR: - if (nyrs == 1) then ! <-- END of YR 1 - gdd020(p) = gdd0(p) ! <-- END of YR 1 - gdd820(p) = gdd8(p) ! <-- END of YR 1 - gdd1020(p) = gdd10(p) ! <-- END of YR 1 - end if ! <-- END of YR 1 - gdd020(p) = (yravgm1* gdd020(p) + gdd0(p)) / yravg ! gdd..20 must be long term avgs - gdd820(p) = (yravgm1* gdd820(p) + gdd8(p)) / yravg ! so ignore results for yrs 1 & 2 - gdd1020(p) = (yravgm1* gdd1020(p) + gdd10(p)) / yravg - end if - end do - -end subroutine CNPhenologyClimate -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNEvergreenPhenology -! -! !INTERFACE: -subroutine CNEvergreenPhenology (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! For coupled carbon-nitrogen code (CN). -! -! !USES: - use clm_varcon , only: secspday - use clm_time_manager, only: get_days_per_year -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 10/2/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - ! ecophysiological constants - real(r8), pointer :: evergreen(:) ! binary flag for evergreen leaf habit (0 or 1) - real(r8), pointer :: leaf_long(:) ! leaf longevity (yrs) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: bglfr(:) ! background litterfall rate (1/s) - real(r8), pointer :: bgtr(:) ! background transfer growth rate (1/s) - real(r8), pointer :: lgsf(:) ! long growing season factor [0-1] -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - real(r8):: dayspyr ! Days per year - integer :: p ! indices - integer :: fp ! lake filter pft index -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers to derived type arrays - ivt => pft%itype - evergreen => pftcon%evergreen - leaf_long => pftcon%leaf_long - bglfr => pepv%bglfr - bgtr => pepv%bgtr - lgsf => pepv%lgsf - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - if (evergreen(ivt(p)) == 1._r8) then - bglfr(p) = 1._r8/(leaf_long(ivt(p))*dayspyr*secspday) - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - end if - end do - -end subroutine CNEvergreenPhenology -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSeasonDecidPhenology -! -! !INTERFACE: -subroutine CNSeasonDecidPhenology (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! For coupled carbon-nitrogen code (CN). -! This routine handles the seasonal deciduous phenology code (temperate -! deciduous vegetation that has only one growing season per year). -! -! !USES: - use shr_const_mod , only: SHR_CONST_TKFRZ, SHR_CONST_PI - use clm_varcon , only: secspday -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 10/6/03: Created by Peter Thornton -! 10/24/03, Peter Thornton: migrated to vector data structures -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pgridcell(:) ! pft's gridcell index - real(r8), pointer :: latdeg(:) ! latitude (radians) - real(r8), pointer :: decl(:) ! solar declination (radians) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: soilpsi(:,:) ! soil water potential in each soil layer (MPa) - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - ! ecophysiological constants - real(r8), pointer :: season_decid(:) ! binary flag for seasonal-deciduous leaf habit (0 or 1) - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) -! -! local pointers to implicit in/out scalars - real(r8), pointer :: dormant_flag(:) ! dormancy flag - real(r8), pointer :: days_active(:) ! number of days since last dormancy - real(r8), pointer :: onset_flag(:) ! onset flag - real(r8), pointer :: onset_counter(:) ! onset counter (seconds) - real(r8), pointer :: onset_gddflag(:) ! onset freeze flag - real(r8), pointer :: onset_gdd(:) ! onset growing degree days - real(r8), pointer :: offset_flag(:) ! offset flag - real(r8), pointer :: offset_counter(:) ! offset counter (seconds) - real(r8), pointer :: dayl(:) ! daylength (seconds) - real(r8), pointer :: prev_dayl(:) ! daylength from previous albedo timestep (seconds) - real(r8), pointer :: annavg_t2m(:) ! annual average 2m air temperature (K) - real(r8), pointer :: prev_leafc_to_litter(:) ! previous timestep leaf C litterfall flux (gC/m2/s) - real(r8), pointer :: prev_frootc_to_litter(:) ! previous timestep froot C litterfall flux (gC/m2/s) - real(r8), pointer :: lgsf(:) ! long growing season factor [0-1] - real(r8), pointer :: bglfr(:) ! background litterfall rate (1/s) - real(r8), pointer :: bgtr(:) ! background transfer growth rate (1/s) - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: leafn_xfer_to_leafn(:) - real(r8), pointer :: frootn_xfer_to_frootn(:) - real(r8), pointer :: livestemn_xfer_to_livestemn(:) - real(r8), pointer :: deadstemn_xfer_to_deadstemn(:) - real(r8), pointer :: livecrootn_xfer_to_livecrootn(:) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn(:) - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: leafc_storage_to_xfer(:) - real(r8), pointer :: frootc_storage_to_xfer(:) - real(r8), pointer :: livestemc_storage_to_xfer(:) - real(r8), pointer :: deadstemc_storage_to_xfer(:) - real(r8), pointer :: livecrootc_storage_to_xfer(:) - real(r8), pointer :: deadcrootc_storage_to_xfer(:) - real(r8), pointer :: gresp_storage_to_xfer(:) - real(r8), pointer :: leafn_storage_to_xfer(:) - real(r8), pointer :: frootn_storage_to_xfer(:) - real(r8), pointer :: livestemn_storage_to_xfer(:) - real(r8), pointer :: deadstemn_storage_to_xfer(:) - real(r8), pointer :: livecrootn_storage_to_xfer(:) - real(r8), pointer :: deadcrootn_storage_to_xfer(:) - logical , pointer :: pftmayexist(:) ! exclude seasonal decid pfts from tropics -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: c,p !indices - integer :: fp !lake filter pft index - real(r8):: ws_flag !winter-summer solstice flag (0 or 1) - real(r8):: crit_onset_gdd !critical onset growing degree-day sum - real(r8):: soilt - real(r8):: lat !latitude (radians) - real(r8):: temp !temporary variable for daylength calculation - -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - ivt => pft%itype - pcolumn => pft%column - pgridcell => pft%gridcell - latdeg => grc%latdeg - decl => cps%decl - t_soisno => ces%t_soisno - leafc_storage => pcs%leafc_storage - frootc_storage => pcs%frootc_storage - livestemc_storage => pcs%livestemc_storage - deadstemc_storage => pcs%deadstemc_storage - livecrootc_storage => pcs%livecrootc_storage - deadcrootc_storage => pcs%deadcrootc_storage - gresp_storage => pcs%gresp_storage - leafn_storage => pns%leafn_storage - frootn_storage => pns%frootn_storage - livestemn_storage => pns%livestemn_storage - deadstemn_storage => pns%deadstemn_storage - livecrootn_storage => pns%livecrootn_storage - deadcrootn_storage => pns%deadcrootn_storage - season_decid => pftcon%season_decid - woody => pftcon%woody - - ! Assign local pointers to derived type arrays (out) - dormant_flag => pepv%dormant_flag - days_active => pepv%days_active - onset_flag => pepv%onset_flag - onset_counter => pepv%onset_counter - onset_gddflag => pepv%onset_gddflag - onset_gdd => pepv%onset_gdd - offset_flag => pepv%offset_flag - offset_counter => pepv%offset_counter - dayl => pepv%dayl - prev_dayl => pepv%prev_dayl - annavg_t2m => pepv%annavg_t2m - prev_leafc_to_litter => pepv%prev_leafc_to_litter - prev_frootc_to_litter => pepv%prev_frootc_to_litter - bglfr => pepv%bglfr - bgtr => pepv%bgtr - lgsf => pepv%lgsf - leafc_xfer_to_leafc => pcf%leafc_xfer_to_leafc - frootc_xfer_to_frootc => pcf%frootc_xfer_to_frootc - livestemc_xfer_to_livestemc => pcf%livestemc_xfer_to_livestemc - deadstemc_xfer_to_deadstemc => pcf%deadstemc_xfer_to_deadstemc - livecrootc_xfer_to_livecrootc => pcf%livecrootc_xfer_to_livecrootc - deadcrootc_xfer_to_deadcrootc => pcf%deadcrootc_xfer_to_deadcrootc - leafn_xfer_to_leafn => pnf%leafn_xfer_to_leafn - frootn_xfer_to_frootn => pnf%frootn_xfer_to_frootn - livestemn_xfer_to_livestemn => pnf%livestemn_xfer_to_livestemn - deadstemn_xfer_to_deadstemn => pnf%deadstemn_xfer_to_deadstemn - livecrootn_xfer_to_livecrootn => pnf%livecrootn_xfer_to_livecrootn - deadcrootn_xfer_to_deadcrootn => pnf%deadcrootn_xfer_to_deadcrootn - leafc_xfer => pcs%leafc_xfer - frootc_xfer => pcs%frootc_xfer - livestemc_xfer => pcs%livestemc_xfer - deadstemc_xfer => pcs%deadstemc_xfer - livecrootc_xfer => pcs%livecrootc_xfer - deadcrootc_xfer => pcs%deadcrootc_xfer - leafn_xfer => pns%leafn_xfer - frootn_xfer => pns%frootn_xfer - livestemn_xfer => pns%livestemn_xfer - deadstemn_xfer => pns%deadstemn_xfer - livecrootn_xfer => pns%livecrootn_xfer - deadcrootn_xfer => pns%deadcrootn_xfer - leafc_storage_to_xfer => pcf%leafc_storage_to_xfer - frootc_storage_to_xfer => pcf%frootc_storage_to_xfer - livestemc_storage_to_xfer => pcf%livestemc_storage_to_xfer - deadstemc_storage_to_xfer => pcf%deadstemc_storage_to_xfer - livecrootc_storage_to_xfer => pcf%livecrootc_storage_to_xfer - deadcrootc_storage_to_xfer => pcf%deadcrootc_storage_to_xfer - gresp_storage_to_xfer => pcf%gresp_storage_to_xfer - leafn_storage_to_xfer => pnf%leafn_storage_to_xfer - frootn_storage_to_xfer => pnf%frootn_storage_to_xfer - livestemn_storage_to_xfer => pnf%livestemn_storage_to_xfer - deadstemn_storage_to_xfer => pnf%deadstemn_storage_to_xfer - livecrootn_storage_to_xfer => pnf%livecrootn_storage_to_xfer - deadcrootn_storage_to_xfer => pnf%deadcrootn_storage_to_xfer - pftmayexist => pdgvs%pftmayexist - - ! start pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = pcolumn(p) - - if (season_decid(ivt(p)) == 1._r8) then - - ! set background litterfall rate, background transfer rate, and - ! long growing season factor to 0 for seasonal deciduous types - bglfr(p) = 0._r8 - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - - ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - - ! use solar declination information stored during Surface Albedo() - ! and latitude from gps to calcluate daylength (convert latitude from degrees to radians) - ! the constant 13750.9871 is the number of seconds per radian of hour-angle - - prev_dayl(p) = dayl(p) - lat = (SHR_CONST_PI/180._r8)*latdeg(pgridcell(p)) - temp = -(sin(lat)*sin(decl(c)))/(cos(lat) * cos(decl(c))) - temp = min(1._r8,max(-1._r8,temp)) - dayl(p) = 2.0_r8 * 13750.9871_r8 * acos(temp) - - ! set flag for solstice period (winter->summer = 1, summer->winter = 0) - if (dayl(p) >= prev_dayl(p)) then - ws_flag = 1._r8 - else - ws_flag = 0._r8 - end if - - ! update offset_counter and test for the end of the offset period - if (offset_flag(p) == 1.0_r8) then - ! decrement counter for offset period - offset_counter(p) = offset_counter(p) - dt - - ! if this is the end of the offset_period, reset phenology - ! flags and indices - if (offset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_offset_cleanup(p) - ! inlined during vectorization - - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - if (use_cndv) then - pftmayexist(p) = .true. - end if - - ! reset the previous timestep litterfall flux memory - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! update onset_counter and test for the end of the onset period - if (onset_flag(p) == 1.0_r8) then - ! decrement counter for onset period - onset_counter(p) = onset_counter(p) - dt - - ! if this is the end of the onset period, reset phenology - ! flags and indices - if (onset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_onset_cleanup(p) - ! inlined during vectorization - - onset_flag(p) = 0.0_r8 - onset_counter(p) = 0.0_r8 - ! set all transfer growth rates to 0.0 - leafc_xfer_to_leafc(p) = 0.0_r8 - frootc_xfer_to_frootc(p) = 0.0_r8 - leafn_xfer_to_leafn(p) = 0.0_r8 - frootn_xfer_to_frootn(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = 0.0_r8 - deadstemc_xfer_to_deadstemc(p) = 0.0_r8 - livecrootc_xfer_to_livecrootc(p) = 0.0_r8 - deadcrootc_xfer_to_deadcrootc(p) = 0.0_r8 - livestemn_xfer_to_livestemn(p) = 0.0_r8 - deadstemn_xfer_to_deadstemn(p) = 0.0_r8 - livecrootn_xfer_to_livecrootn(p) = 0.0_r8 - deadcrootn_xfer_to_deadcrootn(p) = 0.0_r8 - end if - ! set transfer pools to 0.0 - leafc_xfer(p) = 0.0_r8 - leafn_xfer(p) = 0.0_r8 - frootc_xfer(p) = 0.0_r8 - frootn_xfer(p) = 0.0_r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer(p) = 0.0_r8 - livestemn_xfer(p) = 0.0_r8 - deadstemc_xfer(p) = 0.0_r8 - deadstemn_xfer(p) = 0.0_r8 - livecrootc_xfer(p) = 0.0_r8 - livecrootn_xfer(p) = 0.0_r8 - deadcrootc_xfer(p) = 0.0_r8 - deadcrootn_xfer(p) = 0.0_r8 - end if - end if - end if - - ! test for switching from dormant period to growth period - if (dormant_flag(p) == 1.0_r8) then - - ! Test to turn on growing degree-day sum, if off. - ! switch on the growing degree day sum on the winter solstice - - if (onset_gddflag(p) == 0._r8 .and. ws_flag == 1._r8) then - onset_gddflag(p) = 1._r8 - onset_gdd(p) = 0._r8 - end if - - ! Test to turn off growing degree-day sum, if on. - ! This test resets the growing degree day sum if it gets past - ! the summer solstice without reaching the threshold value. - ! In that case, it will take until the next winter solstice - ! before the growing degree-day summation starts again. - - if (onset_gddflag(p) == 1._r8 .and. ws_flag == 0._r8) then - onset_gddflag(p) = 0._r8 - onset_gdd(p) = 0._r8 - end if - - ! if the gdd flag is set, and if the soil is above freezing - ! then accumulate growing degree days for onset trigger - - soilt = t_soisno(c,3) - if (onset_gddflag(p) == 1.0_r8 .and. soilt > SHR_CONST_TKFRZ) then - onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday - end if - - ! set onset_flag if critical growing degree-day sum is exceeded - if (onset_gdd(p) > crit_onset_gdd) then - onset_flag(p) = 1.0_r8 - dormant_flag(p) = 0.0_r8 - onset_gddflag(p) = 0.0_r8 - onset_gdd(p) = 0.0_r8 - onset_counter(p) = ndays_on * secspday - - ! move all the storage pools into transfer pools, - ! where they will be transfered to displayed growth over the onset period. - ! this code was originally handled with call cn_storage_to_xfer(p) - ! inlined during vectorization - - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt - end if - end if - - ! test for switching from growth period to offset period - else if (offset_flag(p) == 0.0_r8) then - if (use_cndv) then - ! If days_active > 355, then remove pft in - ! CNDVEstablishment at the end of the year. - ! days_active > 355 is a symptom of seasonal decid. pfts occurring in - ! gridcells where dayl never drops below crit_dayl. - ! This results in TLAI>1e4 in a few gridcells. - days_active(p) = days_active(p) + fracday - if (days_active(p) > 355._r8) pftmayexist(p) = .false. - end if - - ! only begin to test for offset daylength once past the summer sol - if (ws_flag == 0._r8 .and. dayl(p) < crit_dayl) then - offset_flag(p) = 1._r8 - offset_counter(p) = ndays_off * secspday - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - end if ! end if seasonal deciduous - - end do ! end of pft loop - -end subroutine CNSeasonDecidPhenology -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNStressDecidPhenology -! -! !INTERFACE: -subroutine CNStressDecidPhenology (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! This routine handles phenology for vegetation types, such as grasses and -! tropical drought deciduous trees, that respond to cold and drought stress -! signals and that can have multiple growing seasons in a given year. -! This routine allows for the possibility that leaves might persist year-round -! in the absence of a suitable stress trigger, by switching to an essentially -! evergreen habit, but maintaining a deciduous leaf longevity, while waiting -! for the next stress trigger. This is in contrast to the seasonal deciduous -! algorithm (for temperate deciduous trees) that forces a single growing season -! per year. -! -! !USES: - use clm_time_manager, only: get_days_per_year - use clm_varcon , only: secspday - use shr_const_mod , only: SHR_CONST_TKFRZ, SHR_CONST_PI -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 10/27/03: Created by Peter Thornton -! 01/29/04: Made onset_gdd critical sum a function of temperature, as in -! seasonal deciduous algorithm. -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pgridcell(:) ! pft's gridcell index - real(r8), pointer :: latdeg(:) ! latitude (radians) - real(r8), pointer :: decl(:) ! solar declination (radians) - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: soilpsi(:,:) ! soil water potential in each soil layer (MPa) - real(r8), pointer :: leaf_long(:) ! leaf longevity (yrs) - real(r8), pointer :: stress_decid(:) ! binary flag for stress-deciduous leaf habit (0 or 1) - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: dormant_flag(:) ! dormancy flag - real(r8), pointer :: days_active(:) ! number of days since last dormancy - real(r8), pointer :: onset_flag(:) ! onset flag - real(r8), pointer :: onset_counter(:) ! onset counter (seconds) - real(r8), pointer :: onset_gddflag(:) ! onset freeze flag - real(r8), pointer :: onset_fdd(:) ! onset freezing degree days counter - real(r8), pointer :: onset_gdd(:) ! onset growing degree days - real(r8), pointer :: onset_swi(:) ! onset soil water index - real(r8), pointer :: offset_flag(:) ! offset flag - real(r8), pointer :: offset_counter(:) ! offset counter (seconds) - real(r8), pointer :: dayl(:) ! daylength (seconds) - real(r8), pointer :: offset_fdd(:) ! offset freezing degree days counter - real(r8), pointer :: offset_swi(:) ! offset soil water index - real(r8), pointer :: annavg_t2m(:) ! annual average 2m air temperature (K) - real(r8), pointer :: lgsf(:) ! long growing season factor [0-1] - real(r8), pointer :: bglfr(:) ! background litterfall rate (1/s) - real(r8), pointer :: bgtr(:) ! background transfer growth rate (1/s) - real(r8), pointer :: prev_leafc_to_litter(:) ! previous timestep leaf C litterfall flux (gC/m2/s) - real(r8), pointer :: prev_frootc_to_litter(:) ! previous timestep froot C litterfall flux (gC/m2/s) - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: leafn_xfer_to_leafn(:) - real(r8), pointer :: frootn_xfer_to_frootn(:) - real(r8), pointer :: livestemn_xfer_to_livestemn(:) - real(r8), pointer :: deadstemn_xfer_to_deadstemn(:) - real(r8), pointer :: livecrootn_xfer_to_livecrootn(:) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn(:) - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: leafc_storage_to_xfer(:) - real(r8), pointer :: frootc_storage_to_xfer(:) - real(r8), pointer :: livestemc_storage_to_xfer(:) - real(r8), pointer :: deadstemc_storage_to_xfer(:) - real(r8), pointer :: livecrootc_storage_to_xfer(:) - real(r8), pointer :: deadcrootc_storage_to_xfer(:) - real(r8), pointer :: gresp_storage_to_xfer(:) - real(r8), pointer :: leafn_storage_to_xfer(:) - real(r8), pointer :: frootn_storage_to_xfer(:) - real(r8), pointer :: livestemn_storage_to_xfer(:) - real(r8), pointer :: deadstemn_storage_to_xfer(:) - real(r8), pointer :: livecrootn_storage_to_xfer(:) - real(r8), pointer :: deadcrootn_storage_to_xfer(:) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - real(r8),parameter :: secspqtrday = secspday / 4 ! seconds per quarter day - integer :: c,p ! indices - integer :: fp ! lake filter pft index - real(r8):: dayspyr ! days per year - real(r8):: crit_onset_gdd ! degree days for onset trigger - real(r8):: soilt ! temperature of top soil layer - real(r8):: psi ! water stress of top soil layer - real(r8):: lat !latitude (radians) - real(r8):: temp !temporary variable for daylength calculation -!EOP -!----------------------------------------------------------------------- - ! Assign local pointers to derived type arrays (in) - ivt => pft%itype - pcolumn => pft%column - pgridcell => pft%gridcell - latdeg => grc%latdeg - decl => cps%decl - leafc_storage => pcs%leafc_storage - frootc_storage => pcs%frootc_storage - livestemc_storage => pcs%livestemc_storage - deadstemc_storage => pcs%deadstemc_storage - livecrootc_storage => pcs%livecrootc_storage - deadcrootc_storage => pcs%deadcrootc_storage - gresp_storage => pcs%gresp_storage - leafn_storage => pns%leafn_storage - frootn_storage => pns%frootn_storage - livestemn_storage => pns%livestemn_storage - deadstemn_storage => pns%deadstemn_storage - livecrootn_storage => pns%livecrootn_storage - deadcrootn_storage => pns%deadcrootn_storage - soilpsi => cps%soilpsi - t_soisno => ces%t_soisno - leaf_long => pftcon%leaf_long - woody => pftcon%woody - stress_decid => pftcon%stress_decid - - ! Assign local pointers to derived type arrays (out) - dormant_flag => pepv%dormant_flag - days_active => pepv%days_active - onset_flag => pepv%onset_flag - onset_counter => pepv%onset_counter - onset_gddflag => pepv%onset_gddflag - onset_fdd => pepv%onset_fdd - onset_gdd => pepv%onset_gdd - onset_swi => pepv%onset_swi - offset_flag => pepv%offset_flag - offset_counter => pepv%offset_counter - dayl => pepv%dayl - offset_fdd => pepv%offset_fdd - offset_swi => pepv%offset_swi - annavg_t2m => pepv%annavg_t2m - prev_leafc_to_litter => pepv%prev_leafc_to_litter - prev_frootc_to_litter => pepv%prev_frootc_to_litter - lgsf => pepv%lgsf - bglfr => pepv%bglfr - bgtr => pepv%bgtr - leafc_xfer_to_leafc => pcf%leafc_xfer_to_leafc - frootc_xfer_to_frootc => pcf%frootc_xfer_to_frootc - livestemc_xfer_to_livestemc => pcf%livestemc_xfer_to_livestemc - deadstemc_xfer_to_deadstemc => pcf%deadstemc_xfer_to_deadstemc - livecrootc_xfer_to_livecrootc => pcf%livecrootc_xfer_to_livecrootc - deadcrootc_xfer_to_deadcrootc => pcf%deadcrootc_xfer_to_deadcrootc - leafn_xfer_to_leafn => pnf%leafn_xfer_to_leafn - frootn_xfer_to_frootn => pnf%frootn_xfer_to_frootn - livestemn_xfer_to_livestemn => pnf%livestemn_xfer_to_livestemn - deadstemn_xfer_to_deadstemn => pnf%deadstemn_xfer_to_deadstemn - livecrootn_xfer_to_livecrootn => pnf%livecrootn_xfer_to_livecrootn - deadcrootn_xfer_to_deadcrootn => pnf%deadcrootn_xfer_to_deadcrootn - leafc_xfer => pcs%leafc_xfer - frootc_xfer => pcs%frootc_xfer - livestemc_xfer => pcs%livestemc_xfer - deadstemc_xfer => pcs%deadstemc_xfer - livecrootc_xfer => pcs%livecrootc_xfer - deadcrootc_xfer => pcs%deadcrootc_xfer - leafn_xfer => pns%leafn_xfer - frootn_xfer => pns%frootn_xfer - livestemn_xfer => pns%livestemn_xfer - deadstemn_xfer => pns%deadstemn_xfer - livecrootn_xfer => pns%livecrootn_xfer - deadcrootn_xfer => pns%deadcrootn_xfer - leafc_storage_to_xfer => pcf%leafc_storage_to_xfer - frootc_storage_to_xfer => pcf%frootc_storage_to_xfer - livestemc_storage_to_xfer => pcf%livestemc_storage_to_xfer - deadstemc_storage_to_xfer => pcf%deadstemc_storage_to_xfer - livecrootc_storage_to_xfer => pcf%livecrootc_storage_to_xfer - deadcrootc_storage_to_xfer => pcf%deadcrootc_storage_to_xfer - gresp_storage_to_xfer => pcf%gresp_storage_to_xfer - leafn_storage_to_xfer => pnf%leafn_storage_to_xfer - frootn_storage_to_xfer => pnf%frootn_storage_to_xfer - livestemn_storage_to_xfer => pnf%livestemn_storage_to_xfer - deadstemn_storage_to_xfer => pnf%deadstemn_storage_to_xfer - livecrootn_storage_to_xfer => pnf%livecrootn_storage_to_xfer - deadcrootn_storage_to_xfer => pnf%deadcrootn_storage_to_xfer - - ! set time steps - dayspyr = get_days_per_year() - - do fp = 1,num_soilp - p = filter_soilp(fp) - c = pcolumn(p) - - if (stress_decid(ivt(p)) == 1._r8) then - soilt = t_soisno(c,3) - psi = soilpsi(c,3) - - ! use solar declination information stored during Surface Albedo() - ! and latitude from gps to calcluate daylength (convert latitude from degrees to radians) - ! the constant 13750.9871 is the number of seconds per radian of hour-angle - - lat = (SHR_CONST_PI/180._r8)*latdeg(pgridcell(p)) - temp = -(sin(lat)*sin(decl(c)))/(cos(lat) * cos(decl(c))) - temp = min(1._r8,max(-1._r8,temp)) - dayl(p) = 2.0_r8 * 13750.9871_r8 * acos(temp) - - ! onset gdd sum from Biome-BGC, v4.1.2 - crit_onset_gdd = exp(4.8_r8 + 0.13_r8*(annavg_t2m(p) - SHR_CONST_TKFRZ)) - - - ! update offset_counter and test for the end of the offset period - if (offset_flag(p) == 1._r8) then - ! decrement counter for offset period - offset_counter(p) = offset_counter(p) - dt - - ! if this is the end of the offset_period, reset phenology - ! flags and indices - if (offset_counter(p) == 0._r8) then - ! this code block was originally handled by call cn_offset_cleanup(p) - ! inlined during vectorization - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - - ! reset the previous timestep litterfall flux memory - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! update onset_counter and test for the end of the onset period - if (onset_flag(p) == 1.0_r8) then - ! decrement counter for onset period - onset_counter(p) = onset_counter(p) - dt - - ! if this is the end of the onset period, reset phenology - ! flags and indices - if (onset_counter(p) == 0.0_r8) then - ! this code block was originally handled by call cn_onset_cleanup(p) - ! inlined during vectorization - onset_flag(p) = 0._r8 - onset_counter(p) = 0._r8 - ! set all transfer growth rates to 0.0 - leafc_xfer_to_leafc(p) = 0._r8 - frootc_xfer_to_frootc(p) = 0._r8 - leafn_xfer_to_leafn(p) = 0._r8 - frootn_xfer_to_frootn(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = 0._r8 - deadstemc_xfer_to_deadstemc(p) = 0._r8 - livecrootc_xfer_to_livecrootc(p) = 0._r8 - deadcrootc_xfer_to_deadcrootc(p) = 0._r8 - livestemn_xfer_to_livestemn(p) = 0._r8 - deadstemn_xfer_to_deadstemn(p) = 0._r8 - livecrootn_xfer_to_livecrootn(p) = 0._r8 - deadcrootn_xfer_to_deadcrootn(p) = 0._r8 - end if - ! set transfer pools to 0.0 - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = 0._r8 - frootc_xfer(p) = 0._r8 - frootn_xfer(p) = 0._r8 - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer(p) = 0._r8 - livestemn_xfer(p) = 0._r8 - deadstemc_xfer(p) = 0._r8 - deadstemn_xfer(p) = 0._r8 - livecrootc_xfer(p) = 0._r8 - livecrootn_xfer(p) = 0._r8 - deadcrootc_xfer(p) = 0._r8 - deadcrootn_xfer(p) = 0._r8 - end if - end if - end if - - ! test for switching from dormant period to growth period - if (dormant_flag(p) == 1._r8) then - - ! keep track of the number of freezing degree days in this - ! dormancy period (only if the freeze flag has not previously been set - ! for this dormancy period - - if (onset_gddflag(p) == 0._r8 .and. soilt < SHR_CONST_TKFRZ) onset_fdd(p) = onset_fdd(p) + fracday - - ! if the number of freezing degree days exceeds a critical value, - ! then onset will require both wet soils and a critical soil - ! temperature sum. If this case is triggered, reset any previously - ! accumulated value in onset_swi, so that onset now depends on - ! the accumulated soil water index following the freeze trigger - - if (onset_fdd(p) > crit_onset_fdd) then - onset_gddflag(p) = 1._r8 - onset_fdd(p) = 0._r8 - onset_swi(p) = 0._r8 - end if - - ! if the freeze flag is set, and if the soil is above freezing - ! then accumulate growing degree days for onset trigger - - if (onset_gddflag(p) == 1._r8 .and. soilt > SHR_CONST_TKFRZ) then - onset_gdd(p) = onset_gdd(p) + (soilt-SHR_CONST_TKFRZ)*fracday - end if - - ! if soils are wet, accumulate soil water index for onset trigger - if (psi >= soilpsi_on) onset_swi(p) = onset_swi(p) + fracday - - ! if critical soil water index is exceeded, set onset_flag, and - ! then test for soil temperature criteria - - if (onset_swi(p) > crit_onset_swi) then - onset_flag(p) = 1._r8 - - ! only check soil temperature criteria if freeze flag set since - ! beginning of last dormancy. If freeze flag set and growing - ! degree day sum (since freeze trigger) is lower than critical - ! value, then override the onset_flag set from soil water. - - if (onset_gddflag(p) == 1._r8 .and. onset_gdd(p) < crit_onset_gdd) onset_flag(p) = 0._r8 - end if - - ! only allow onset if dayl > 6hrs - if (onset_flag(p) == 1._r8 .and. dayl(p) <= secspqtrday) then - onset_flag(p) = 0._r8 - end if - - ! if this is the beginning of the onset period - ! then reset the phenology flags and indices - - if (onset_flag(p) == 1._r8) then - dormant_flag(p) = 0._r8 - days_active(p) = 0._r8 - onset_gddflag(p) = 0._r8 - onset_fdd(p) = 0._r8 - onset_gdd(p) = 0._r8 - onset_swi(p) = 0._r8 - onset_counter(p) = ndays_on * secspday - - ! call subroutine to move all the storage pools into transfer pools, - ! where they will be transfered to displayed growth over the onset period. - ! this code was originally handled with call cn_storage_to_xfer(p) - ! inlined during vectorization - - ! set carbon fluxes for shifting storage pools to transfer pools - leafc_storage_to_xfer(p) = fstor2tran * leafc_storage(p)/dt - frootc_storage_to_xfer(p) = fstor2tran * frootc_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = fstor2tran * livestemc_storage(p)/dt - deadstemc_storage_to_xfer(p) = fstor2tran * deadstemc_storage(p)/dt - livecrootc_storage_to_xfer(p) = fstor2tran * livecrootc_storage(p)/dt - deadcrootc_storage_to_xfer(p) = fstor2tran * deadcrootc_storage(p)/dt - gresp_storage_to_xfer(p) = fstor2tran * gresp_storage(p)/dt - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = fstor2tran * leafn_storage(p)/dt - frootn_storage_to_xfer(p) = fstor2tran * frootn_storage(p)/dt - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = fstor2tran * livestemn_storage(p)/dt - deadstemn_storage_to_xfer(p) = fstor2tran * deadstemn_storage(p)/dt - livecrootn_storage_to_xfer(p) = fstor2tran * livecrootn_storage(p)/dt - deadcrootn_storage_to_xfer(p) = fstor2tran * deadcrootn_storage(p)/dt - end if - end if - - ! test for switching from growth period to offset period - else if (offset_flag(p) == 0._r8) then - - ! if soil water potential lower than critical value, accumulate - ! as stress in offset soil water index - - if (psi <= soilpsi_off) then - offset_swi(p) = offset_swi(p) + fracday - - ! if the offset soil water index exceeds critical value, and - ! if this is not the middle of a previously initiated onset period, - ! then set flag to start the offset period and reset index variables - - if (offset_swi(p) >= crit_offset_swi .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 - - ! if soil water potential higher than critical value, reduce the - ! offset water stress index. By this mechanism, there must be a - ! sustained period of water stress to initiate offset. - - else if (psi >= soilpsi_on) then - offset_swi(p) = offset_swi(p) - fracday - offset_swi(p) = max(offset_swi(p),0._r8) - end if - - ! decrease freezing day accumulator for warm soil - if (offset_fdd(p) > 0._r8 .and. soilt > SHR_CONST_TKFRZ) then - offset_fdd(p) = offset_fdd(p) - fracday - offset_fdd(p) = max(0._r8, offset_fdd(p)) - end if - - ! increase freezing day accumulator for cold soil - if (soilt <= SHR_CONST_TKFRZ) then - offset_fdd(p) = offset_fdd(p) + fracday - - ! if freezing degree day sum is greater than critical value, initiate offset - if (offset_fdd(p) > crit_offset_fdd .and. onset_flag(p) == 0._r8) offset_flag(p) = 1._r8 - end if - - ! force offset if daylength is < 6 hrs - if (dayl(p) <= secspqtrday) then - offset_flag(p) = 1._r8 - end if - - ! if this is the beginning of the offset period - ! then reset flags and indices - if (offset_flag(p) == 1._r8) then - offset_fdd(p) = 0._r8 - offset_swi(p) = 0._r8 - offset_counter(p) = ndays_off * secspday - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - end if - end if - - ! keep track of number of days since last dormancy for control on - ! fraction of new growth to send to storage for next growing season - - if (dormant_flag(p) == 0.0_r8) then - days_active(p) = days_active(p) + fracday - end if - - ! calculate long growing season factor (lgsf) - ! only begin to calculate a lgsf greater than 0.0 once the number - ! of days active exceeds days/year. - lgsf(p) = max(min((days_active(p)-dayspyr)/dayspyr, 1._r8),0._r8) - - ! set background litterfall rate, when not in the phenological offset period - if (offset_flag(p) == 1._r8) then - bglfr(p) = 0._r8 - else - ! calculate the background litterfall rate (bglfr) - ! in units 1/s, based on leaf longevity (yrs) and correction for long growing season - - bglfr(p) = (1._r8/(leaf_long(ivt(p))*dayspyr*secspday))*lgsf(p) - end if - - ! set background transfer rate when active but not in the phenological onset period - if (onset_flag(p) == 1._r8) then - bgtr(p) = 0._r8 - else - ! the background transfer rate is calculated as the rate that would result - ! in complete turnover of the storage pools in one year at steady state, - ! once lgsf has reached 1.0 (after 730 days active). - - bgtr(p) = (1._r8/(dayspyr*secspday))*lgsf(p) - - ! set carbon fluxes for shifting storage pools to transfer pools - - leafc_storage_to_xfer(p) = leafc_storage(p) * bgtr(p) - frootc_storage_to_xfer(p) = frootc_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_storage_to_xfer(p) = livestemc_storage(p) * bgtr(p) - deadstemc_storage_to_xfer(p) = deadstemc_storage(p) * bgtr(p) - livecrootc_storage_to_xfer(p) = livecrootc_storage(p) * bgtr(p) - deadcrootc_storage_to_xfer(p) = deadcrootc_storage(p) * bgtr(p) - gresp_storage_to_xfer(p) = gresp_storage(p) * bgtr(p) - end if - - ! set nitrogen fluxes for shifting storage pools to transfer pools - leafn_storage_to_xfer(p) = leafn_storage(p) * bgtr(p) - frootn_storage_to_xfer(p) = frootn_storage(p) * bgtr(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemn_storage_to_xfer(p) = livestemn_storage(p) * bgtr(p) - deadstemn_storage_to_xfer(p) = deadstemn_storage(p) * bgtr(p) - livecrootn_storage_to_xfer(p) = livecrootn_storage(p) * bgtr(p) - deadcrootn_storage_to_xfer(p) = deadcrootn_storage(p) * bgtr(p) - end if - end if - - end if ! end if stress deciduous - - end do ! end of pft loop - -end subroutine CNStressDecidPhenology -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CropPhenology -! -! !INTERFACE: -subroutine CropPhenology(num_pcropp, filter_pcropp) - -! !DESCRIPTION: -! Code from AgroIBIS to determine crop phenology and code from CN to -! handle CN fluxes during the phenological onset & offset periods. - -! !USES: - use clm_time_manager, only : get_curr_date, get_curr_calday, get_days_per_year - use pftvarcon , only : ncorn, nscereal, nwcereal, nsoybean, gddmin, hybgdd, & - lfemerg, grnfill, mxmat, minplanttemp, planttemp - use clm_varcon , only : spval, secspday - -! !ARGUMENTS: - integer, intent(in) :: num_pcropp ! number of prog crop pfts in filter - integer, intent(in) :: filter_pcropp(:) ! filter for prognostic crop pfts - -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 2/5/08: slevis created according to AgroIBIS subroutines of Kucharik et al. -! 7/14/08: slevis adapted crop cycles to southern hemisphere -! 3/29/11: ekluzek simply logic using pftvarcon arrays - -!EOP - -! LOCAL VARAIBLES: - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) - integer jday ! julian day of the year - integer fp,p ! pft indices - integer c ! column indices - integer g ! gridcell indices - integer h ! hemisphere indices - integer idpp ! number of days past planting - integer pmmin ! earliest month to plant winter temperate cereal - integer pdmin ! earliest day in earliest month to plant - integer pmmax ! latest possible month (month) and - integer pdmax ! latest day in latest month to plant - real(r8) dayspyr ! days per year - real(r8) crmcorn ! comparitive relative maturity for corn - -! local pointers to implicit in scalars - - integer , pointer :: pgridcell(:)! pft's gridcell index - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: ivt(:) ! pft - real(r8), pointer :: hui(:) ! =gdd since planting (gddplant) - real(r8), pointer :: leafout(:) ! =gdd from top soil layer temperature - real(r8), pointer :: tlai(:) ! one-sided leaf area index, no burying by snow - real(r8), pointer :: gdd020(:) ! 20 yr mean of gdd0 - real(r8), pointer :: gdd820(:) ! 20 yr mean of gdd8 - real(r8), pointer :: gdd1020(:) ! 20 yr mean of gdd10 - real(r8), pointer :: a5tmin(:) ! 5-day running mean of min 2-m temperature - real(r8), pointer :: a10tmin(:) ! 10-day running mean of min 2-m temperature - real(r8), pointer :: t10(:) ! 10-day running mean of the 2 m temperature (K) - real(r8), pointer :: t_ref2m_min(:) !daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: bgtr(:) ! background transfer growth rate (1/s) - real(r8), pointer :: lgsf(:) ! long growing season factor [0-1] - real(r8), pointer :: offset_flag(:) ! offset flag - real(r8), pointer :: offset_counter(:) ! offset counter - real(r8), pointer :: leaf_long(:) ! leaf longevity (yrs) - real(r8), pointer :: leafcn(:) ! leaf C:N (gC/gN) -! local pointers to implicit out scalars - integer , pointer :: idop(:) ! date of planting - integer , pointer :: harvdate(:) ! harvest date - logical , pointer :: croplive(:) ! Flag, true if planted, not harvested - logical , pointer :: cropplant(:) ! Flag, true if crop may be planted - real(r8), pointer :: cumvd(:) ! cumulative vernalization d?ependence? - real(r8), pointer :: hdidx(:) ! cold hardening index? - real(r8), pointer :: vf(:) ! vernalization factor - real(r8), pointer :: gddmaturity(:) ! gdd needed to harvest - real(r8), pointer :: bglfr(:) ! background litterfall rate (1/s) - real(r8), pointer :: huileaf(:) ! heat unit index needed from planting to leaf emergence - real(r8), pointer :: huigrain(:) ! same to reach vegetative maturity - real(r8), pointer :: onset_flag(:) ! onset flag - real(r8), pointer :: onset_counter(:) ! onset counter - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: dwt_seedc_to_leaf(:) ! (gC/m2/s) seed source to PFT-level - real(r8), pointer :: dwt_seedn_to_leaf(:) ! (gN/m2/s) seed source to PFT-level -!------------------------------------------------------------------------ - - pgridcell => pft%gridcell - pcolumn => pft%column - ivt => pft%itype - idop => pps%idop - harvdate => pps%harvdate - croplive => pps%croplive - cropplant => pps%cropplant - gddmaturity => pps%gddmaturity - huileaf => pps%huileaf - huigrain => pps%huigrain - hui => pps%gddplant - leafout => pps%gddtsoi - tlai => pps%tlai - gdd020 => pps%gdd020 - gdd820 => pps%gdd820 - gdd1020 => pps%gdd1020 - a5tmin => pes%a5tmin - a10tmin => pes%a10tmin - t10 => pes%t10 - cumvd => pps%cumvd - hdidx => pps%hdidx - vf => pps%vf - t_ref2m_min => pes%t_ref2m_min - bglfr => pepv%bglfr - bgtr => pepv%bgtr - lgsf => pepv%lgsf - onset_flag => pepv%onset_flag - offset_flag => pepv%offset_flag - onset_counter => pepv%onset_counter - offset_counter => pepv%offset_counter - leafc_xfer => pcs%leafc_xfer - leafn_xfer => pns%leafn_xfer - leaf_long => pftcon%leaf_long - leafcn => pftcon%leafcn - dwt_seedc_to_leaf => ccf%dwt_seedc_to_leaf - dwt_seedn_to_leaf => cnf%dwt_seedn_to_leaf -! --------------------------------------- - - ! get time info - dayspyr = get_days_per_year() - jday = get_curr_calday() - call get_curr_date(kyr, kmo, kda, mcsec) - - do fp = 1, num_pcropp - p = filter_pcropp(fp) - c = pcolumn(p) - g = pgridcell(p) - h = inhemi(p) - - ! background litterfall and transfer rates; long growing season factor - - bglfr(p) = 0._r8 ! this value changes later in a crop's life cycle - bgtr(p) = 0._r8 - lgsf(p) = 0._r8 - - ! --------------------------------- - ! from AgroIBIS subroutine planting - ! --------------------------------- - - ! in order to allow a crop to be planted only once each year - ! initialize cropplant = .false., but hold it = .true. through the end of the year - - ! initialize other variables that are calculated for crops - ! on an annual basis in cropresidue subroutine - - if ( jday == jdayyrstart(h) .and. mcsec == 0 )then - - ! make sure variables aren't changed at beginning of the year - ! for a crop that is currently planted (e.g. winter temperate cereal) - - if (.not. croplive(p)) then - cropplant(p) = .false. - idop(p) = NOT_Planted - - ! keep next for continuous, annual winter temperate cereal type crop; - ! if we removed elseif, - ! winter cereal grown continuously would amount to a cereal/fallow - ! rotation because cereal would only be planted every other year - - else if (croplive(p) .and. ivt(p) == nwcereal) then - cropplant(p) = .false. -! else ! not possible to have croplive and ivt==cornORsoy? (slevis) - end if - - end if - - if ( (.not. croplive(p)) .and. (.not. cropplant(p)) ) then - - ! gdd needed for * chosen crop and a likely hybrid (for that region) * - ! to reach full physiological maturity - - ! based on accumulated seasonal average growing degree days from - ! April 1 - Sept 30 (inclusive) - ! for corn and soybeans in the United States - - ! decided upon by what the typical average growing season length is - ! and the gdd needed to reach maturity in those regions - - ! first choice is used for spring temperate cereal and/or soybeans and maize - - ! slevis: ibis reads xinpdate in io.f from control.crops.nc variable name 'plantdate' - ! According to Chris Kucharik, the dataset of - ! xinpdate was generated from a previous model run at 0.5 deg resolution - - ! winter temperate cereal : use gdd0 as a limit to plant winter cereal - - if (ivt(p) == nwcereal) then - - ! add check to only plant winter cereal after other crops (soybean, maize) - ! have been harvested - - ! *** remember order of planting is crucial - in terms of which crops you want - ! to be grown in what order *** - - ! in this case, corn or soybeans are assumed to be planted before - ! cereal would be in any particular year that both pfts are allowed - ! to grow in the same grid cell (e.g., double-cropping) - - ! slevis: harvdate below needs cropplant(p) above to be cropplant(p,ivt(p)) - ! where ivt(p) has rotated to winter cereal because - ! cropplant through the end of the year for a harvested crop. - ! Also harvdate(p) should be harvdate(p,ivt(p)) and should be - ! updated on Jan 1st instead of at harvest (slevis) - if (a5tmin(p) /= spval .and. & - a5tmin(p) <= minplanttemp(ivt(p)) .and. & - jday >= minplantjday(ivt(p),h) .and. & - (gdd020(p) /= spval .and. & - gdd020(p) >= gddmin(ivt(p)))) then - - cumvd(p) = 0._r8 - hdidx(p) = 0._r8 - vf(p) = 0._r8 - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - gddmaturity(p) = hybgdd(ivt(p)) - leafc_xfer(p) = 1._r8 ! initial seed at planting to appear - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - dwt_seedc_to_leaf(c) = dwt_seedc_to_leaf(c) + leafc_xfer(p)/dt - dwt_seedn_to_leaf(c) = dwt_seedn_to_leaf(c) + leafn_xfer(p)/dt - - ! latest possible date to plant winter cereal and after all other - ! crops were harvested for that year - - else if (jday >= maxplantjday(ivt(p),h) .and. & - gdd020(p) /= spval .and. & - gdd020(p) >= gddmin(ivt(p))) then - - cumvd(p) = 0._r8 - hdidx(p) = 0._r8 - vf(p) = 0._r8 - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - gddmaturity(p) = hybgdd(ivt(p)) - leafc_xfer(p) = 1._r8 ! initial seed at planting to appear - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - dwt_seedc_to_leaf(c) = dwt_seedc_to_leaf(c) + leafc_xfer(p)/dt - dwt_seedn_to_leaf(c) = dwt_seedn_to_leaf(c) + leafn_xfer(p)/dt - else - gddmaturity(p) = 0._r8 - end if - - else ! not winter cereal... slevis: added distinction between NH and SH - ! slevis: The idea is that jday will equal idop sooner or later in the year - ! while the gdd part is either true or false for the year. - if (t10(p) /= spval.and. a10tmin(p) /= spval .and. & - t10(p) > planttemp(ivt(p)) .and. & - a10tmin(p) > minplanttemp(ivt(p)) .and. & - jday >= minplantjday(ivt(p),h) .and. & - jday <= maxplantjday(ivt(p),h) .and. & - t10(p) /= spval .and. a10tmin(p) /= spval .and. & - gdd820(p) /= spval .and. & - gdd820(p) >= gddmin(ivt(p))) then - - ! impose limit on growing season length needed - ! for crop maturity - for cold weather constraints - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - - ! go a specified amount of time before/after - ! climatological date - if (ivt(p)==nsoybean) gddmaturity(p)=min(gdd1020(p),hybgdd(ivt(p))) - if (ivt(p)==ncorn) then - gddmaturity(p)=max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) - gddmaturity(p)=max(950._r8, min(gddmaturity(p)+150._r8,1850._r8)) - end if - if (ivt(p)==nscereal) gddmaturity(p)=min(gdd020(p),hybgdd(ivt(p))) - - leafc_xfer(p) = 1._r8 ! initial seed at planting to appear - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - dwt_seedc_to_leaf(c) = dwt_seedc_to_leaf(c) + leafc_xfer(p)/dt - dwt_seedn_to_leaf(c) = dwt_seedn_to_leaf(c) + leafn_xfer(p)/dt - - ! If hit the max planting julian day -- go ahead and plant - else if (jday == maxplantjday(ivt(p),h) .and. gdd820(p) > 0._r8 .and. & - gdd820(p) /= spval ) then - croplive(p) = .true. - cropplant(p) = .true. - idop(p) = jday - harvdate(p) = NOT_Harvested - - if (ivt(p)==nsoybean) gddmaturity(p)=min(gdd1020(p),hybgdd(ivt(p))) - if (ivt(p)==ncorn) gddmaturity(p)=max(950._r8, min(gdd820(p)*0.85_r8, hybgdd(ivt(p)))) - if (ivt(p)==nscereal) gddmaturity(p)=min(gdd020(p),hybgdd(ivt(p))) - - leafc_xfer(p) = 1._r8 ! initial seed at planting to appear - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) ! with onset - dwt_seedc_to_leaf(c) = dwt_seedc_to_leaf(c) + leafc_xfer(p)/dt - dwt_seedn_to_leaf(c) = dwt_seedn_to_leaf(c) + leafn_xfer(p)/dt - - else - gddmaturity(p) = 0._r8 - end if - end if ! crop pft distinction - - ! crop phenology (gdd thresholds) controlled by gdd needed for - ! maturity (physiological) which is based on the average gdd - ! accumulation and hybrids in United States from April 1 - Sept 30 - - ! calculate threshold from phase 1 to phase 2: - ! threshold for attaining leaf emergence (based on fraction of - ! gdd(i) -- climatological average) - ! Hayhoe and Dwyer, 1990, Can. J. Soil Sci 70:493-497 - ! Carlson and Gage, 1989, Agric. For. Met., 45: 313-324 - ! J.T. Ritchie, 1991: Modeling Plant and Soil systems - - huileaf(p) = lfemerg(ivt(p)) * gddmaturity(p) ! 3-7% in cereal - - ! calculate threshhold from phase 2 to phase 3: - ! from leaf emergence to beginning of grain-fill period - ! this hypothetically occurs at the end of tassling, not the beginning - ! tassel initiation typically begins at 0.5-0.55 * gddmaturity - - ! calculate linear relationship between huigrain fraction and relative - ! maturity rating for maize - - if (ivt(p) == ncorn) then - ! the following estimation of crmcorn from gddmaturity is based on a linear - ! regression using data from Pioneer-brand corn hybrids (Kucharik, 2003, - ! Earth Interactions 7:1-33: fig. 2) - crmcorn = max(73._r8, min(135._r8, (gddmaturity(p)+ 53.683_r8)/13.882_r8)) - - ! the following adjustment of grnfill based on crmcorn is based on a tuning - ! of Agro-IBIS to give reasonable results for max LAI and the seasonal - ! progression of LAI growth (pers. comm. C. Kucharik June 10, 2010) - huigrain(p) = -0.002_r8 * (crmcorn - 73._r8) + grnfill(ivt(p)) - - huigrain(p) = min(max(huigrain(p), grnfill(ivt(p))-0.1_r8), grnfill(ivt(p))) - huigrain(p) = huigrain(p) * gddmaturity(p) ! Cabelguenne et - else - huigrain(p) = grnfill(ivt(p)) * gddmaturity(p) ! al. 1999 - end if - - end if ! crop not live nor planted - - ! ---------------------------------- - ! from AgroIBIS subroutine phenocrop - ! ---------------------------------- - - ! all of the phenology changes are based on the total number of gdd needed - ! to change to the next phase - based on fractions of the total gdd typical - ! for that region based on the April 1 - Sept 30 window of development - - ! crop phenology (gdd thresholds) controlled by gdd needed for - ! maturity (physiological) which is based on the average gdd - ! accumulation and hybrids in United States from April 1 - Sept 30 - - ! Phase 1: Planting to leaf emergence (now in CNAllocation) - ! Phase 2: Leaf emergence to beginning of grain fill (general LAI accumulation) - ! Phase 3: Grain fill to physiological maturity and harvest (LAI decline) - ! Harvest: if gdd past grain fill initiation exceeds limit - ! or number of days past planting reaches a maximum, the crop has - ! reached physiological maturity and plant is harvested; - ! crop could be live or dead at this stage - these limits - ! could lead to reaching physiological maturity or determining - ! a harvest date for a crop killed by an early frost (see next comments) - ! --- --- --- - ! keeping comments without the code (slevis): - ! if minimum temperature, t_ref2m_min <= freeze kill threshold, tkill - ! for 3 consecutive days and lai is above a minimum, - ! plant will be damaged/killed. This function is more for spring freeze events - ! or for early fall freeze events - - ! spring temperate cereal is affected by this, winter cereal kill function - ! is determined in crops.f - is a more elaborate function of - ! cold hardening of the plant - - ! currently simulates too many grid cells killed by freezing temperatures - - ! removed on March 12 2002 - C. Kucharik - ! until it can be a bit more refined, or used at a smaller scale. - ! we really have no way of validating this routine - ! too difficult to implement on 0.5 degree scale grid cells - ! --- --- --- - - onset_flag(p) = 0._r8 ! CN terminology to trigger certain - offset_flag(p) = 0._r8 ! carbon and nitrogen transfers - - if (croplive(p)) then - - ! call vernalization if winter temperate cereal planted, living, and the - ! vernalization factor is not 1; - ! vf affects the calculation of gddtsoi & gddplant - - if (t_ref2m_min(p) < 1.e30_r8 .and. vf(p) /= 1._r8 .and. ivt(p) == nwcereal) then - call vernalization(p) - end if - - ! days past planting may determine harvest - - if (jday >= idop(p)) then - idpp = jday - idop(p) - else - idpp = int(dayspyr) + jday - idop(p) - end if - - ! onset_counter initialized to zero when .not. croplive - ! offset_counter relevant only at time step of harvest - - onset_counter(p) = onset_counter(p) - dt - - ! enter phase 2 onset for one time step: - ! transfer seed carbon to leaf emergence - - if (leafout(p) >= huileaf(p) .and. hui(p) < huigrain(p) .and. idpp < mxmat(ivt(p))) then - if (abs(onset_counter(p)) > 1.e-6_r8) then - onset_flag(p) = 1._r8 - onset_counter(p) = dt - else - onset_counter(p) = dt ! ensure no re-entry to onset of phase2 - end if - - ! enter harvest for one time step: - ! - transfer live biomass to litter and to crop yield - ! - send xsmrpool to the atmosphere - ! if onset and harvest needed to last longer than one timestep - ! the onset_counter would change from dt and you'd need to make - ! changes to the offset subroutine below - - else if (hui(p) >= gddmaturity(p) .or. idpp >= mxmat(ivt(p))) then - if (harvdate(p) >= NOT_Harvested) harvdate(p) = jday - croplive(p) = .false. ! no re-entry in greater if-block - if (tlai(p) > 0._r8) then ! plant had emerged before harvest - offset_flag(p) = 1._r8 - offset_counter(p) = dt - else ! plant never emerged from the ground - dwt_seedc_to_leaf(c) = dwt_seedc_to_leaf(c) - leafc_xfer(p)/dt - dwt_seedn_to_leaf(c) = dwt_seedn_to_leaf(c) - leafn_xfer(p)/dt - leafc_xfer(p) = 0._r8 ! revert planting transfers - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) - end if - - ! enter phase 3 while previous criteria fail and next is true; - ! in terms of order, phase 3 occurs before harvest, but when - ! harvest *can* occur, we want it to have first priority. - ! AgroIBIS uses a complex formula for lai decline. - ! Use CN's simple formula at least as a place holder (slevis) - - else if (hui(p) >= huigrain(p)) then - bglfr(p) = 1._r8/(leaf_long(ivt(p))*dayspyr*secspday) - end if - - else ! crop not live - onset_counter(p) = 0._r8 - leafc_xfer(p) = 0._r8 - leafn_xfer(p) = leafc_xfer(p) / leafcn(ivt(p)) - end if ! croplive - - end do ! prognostic crops loop - -end subroutine CropPhenology -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CropPhenologyInit -! -! !INTERFACE: -subroutine CropPhenologyInit( begp, endp ) - -! !DESCRIPTION: -! Initialization of CropPhenology. Must be called after time-manager is -! initialized, and after pftcon file is read in. -! -! !USES: - use pftvarcon , only: nwcereal, nsoybean, ncorn, nscereal, & - npcropmin, npcropmax, mnNHplantdate, & - mnSHplantdate, mxNHplantdate, & - mxSHplantdate - use clm_time_manager, only: get_calday -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begp, endp ! Beginning and ending PFT index -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -!EOP - -! LOCAL VARAIBLES: - real(r8), pointer :: latdeg(:) ! latitude (radians) - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer :: p,g,n,i ! indices -!------------------------------------------------------------------------ - latdeg => grc%latdeg - pgridcell => pft%gridcell - - allocate( inhemi(begp:endp) ) - - ! Julian day for the start of the year (mid-winter) - jdayyrstart(inNH) = 1 - jdayyrstart(inSH) = 182 - - ! Convert planting dates into julian day - minplantjday(:,:) = huge(1) - maxplantjday(:,:) = huge(1) - do n = npcropmin, npcropmax - minplantjday(n,inNH) = int( get_calday( mnNHplantdate(n), 0 ) ) - maxplantjday(n,inNH) = int( get_calday( mxNHplantdate(n), 0 ) ) - end do - do n = npcropmin, npcropmax - minplantjday(n,inSH) = int( get_calday( mnSHplantdate(n), 0 ) ) - maxplantjday(n,inSH) = int( get_calday( mxSHplantdate(n), 0 ) ) - end do - - ! Figure out what hemisphere each PFT is in - do p = begp, endp - g = pgridcell(p) - ! Northern hemisphere - if ( latdeg(g) > 0.0_r8 )then - inhemi(p) = inNH - else - inhemi(p) = inSH - end if - end do - - ! - ! Constants for Crop vernalization - ! - - ! photoperiod factor calculation - ! genetic constant - can be modified - - p1d = 0.004_r8 ! average for genotypes from Ritchey, 1991. - ! Modeling plant & soil systems: Wheat phasic developmt - p1v = 0.003_r8 ! average for genotypes from Ritchey, 1991. - - hti = 1._r8 - tbase = 0._r8 - -end subroutine CropPhenologyInit - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: vernalization -! -! !INTERFACE: - subroutine vernalization(p) -! -! !DESCRIPTION: -! -! * * * only call for winter temperate cereal * * * -! -! subroutine calculates vernalization and photoperiod effects on -! gdd accumulation in winter temperate cereal varieties. Thermal time accumulation -! is reduced in 1st period until plant is fully vernalized. During this -! time of emergence to spikelet formation, photoperiod can also have a -! drastic effect on plant development. -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: p ! PFT index running over -! -! !REVISION HISTORY: -! Created by Sam Levis from AGROIBIS -! -!EOP - -! LOCAL VARAIBLES: - real(r8) tcrown ! ? - real(r8) vd, vd1, vd2 ! vernalization dependence - real(r8) tkil ! Freeze kill threshold - integer c,g ! indices -! local pointers to implicit in scalars - integer , pointer :: pcolumn(:) ! pft's column index - logical , pointer :: croplive(:) ! Flag, true if planted, not harvested - real(r8), pointer :: tlai(:) ! one-sided leaf area index, no burying by snow - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min(:) !daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max(:) !daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: snowdp(:) ! snow height (m) -! local pointers to implicit out scalars - real(r8), pointer :: vf(:) ! vernalization factor for cereal - real(r8), pointer :: cumvd(:) ! cumulative vernalization d?ependence? - real(r8), pointer :: gddmaturity(:) ! gdd needed to harvest - real(r8), pointer :: huigrain(:) ! heat unit index needed to reach vegetative maturity - real(r8), pointer :: hdidx(:) ! cold hardening index? -!------------------------------------------------------------------------ - - pcolumn => pft%column - croplive => pps%croplive - hdidx => pps%hdidx - cumvd => pps%cumvd - vf => pps%vf - gddmaturity => pps%gddmaturity - huigrain => pps%huigrain - tlai => pps%tlai - t_ref2m => pes%t_ref2m - t_ref2m_min => pes%t_ref2m_min - t_ref2m_max => pes%t_ref2m_max - snowdp => cps%snowdp - - c = pcolumn(p) - - ! for all equations - temperatures must be in degrees (C) - ! calculate temperature of crown of crop (e.g., 3 cm soil temperature) - ! snow depth in centimeters - - if (t_ref2m(p) < tfrz) then !slevis: t_ref2m inst of td=daily avg (K) - tcrown = 2._r8 + (t_ref2m(p) - tfrz) * (0.4_r8 + 0.0018_r8 * & - (min(snowdp(c)*100._r8, 15._r8) - 15._r8)**2) - else !slevis: snowdp inst of adsnod=daily average (m) - tcrown = t_ref2m(p) - tfrz - end if - - ! vernalization factor calculation - ! if vf(p) = 1. then plant is fully vernalized - and thermal time - ! accumulation in phase 1 will be unaffected - ! refers to gddtsoi & gddplant, defined in the accumulation routines (slevis) - ! reset vf, cumvd, and hdidx to 0 at planting of crop (slevis) - - if (t_ref2m_max(p) > tfrz) then - if (t_ref2m_min(p) <= tfrz+15._r8) then - vd1 = 1.4_r8 - 0.0778_r8 * tcrown - vd2 = 0.5_r8 + 13.44_r8 / ((t_ref2m_max(p)-t_ref2m_min(p)+3._r8)**2) * tcrown - vd = max(0._r8, min(1._r8, vd1, vd2)) - cumvd(p) = cumvd(p) + vd - end if - - if (cumvd(p) < 10._r8 .and. t_ref2m_max(p) > tfrz+30._r8) then - cumvd(p) = cumvd(p) - 0.5_r8 * (t_ref2m_max(p) - tfrz - 30._r8) - end if - cumvd(p) = max(0._r8, cumvd(p)) ! must be > 0 - - vf(p) = 1._r8 - p1v * (50._r8 - cumvd(p)) - vf(p) = max(0._r8, min(vf(p), 1._r8)) ! must be between 0 - 1 - end if - - ! calculate cold hardening of plant - ! determines for winter cereal varieties whether the plant has completed - ! a period of cold hardening to protect it from freezing temperatures. If - ! not, then exposure could result in death or killing of plants. - - ! there are two distinct phases of hardening - - if (t_ref2m_min(p) <= tfrz-3._r8 .or. hdidx(p) /= 0._r8) then - if (hdidx(p) >= hti) then ! done with phase 1 - hdidx(p) = hdidx(p) + 0.083_r8 - hdidx(p) = min(hdidx(p), hti*2._r8) - end if - - if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then - hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - hdidx(p) = max(0._r8, hdidx(p)) - end if - - else if (tcrown >= tbase-1._r8) then - if (tcrown <= tbase+8._r8) then - hdidx(p) = hdidx(p) + 0.1_r8 - (tcrown-tbase+3.5_r8)**2 / 506._r8 - if (hdidx(p) >= hti .and. tcrown <= tbase + 0._r8) then - hdidx(p) = hdidx(p) + 0.083_r8 - hdidx(p) = min(hdidx(p), hti*2._r8) - end if - end if - - if (t_ref2m_max(p) >= tbase + tfrz + 10._r8) then - hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - if (hdidx(p) > hti) hdidx(p) = hdidx(p) - 0.02_r8 * (t_ref2m_max(p)-tbase-tfrz-10._r8) - hdidx(p) = max(0._r8, hdidx(p)) - end if - end if - - ! calculate what the cereal killing temperature - ! there is a linear inverse relationship between - ! hardening of the plant and the killing temperature or - ! threshold that the plant can withstand - ! when plant is fully-hardened (hdidx = 2), the killing threshold is -18 C - - ! will have to develop some type of relationship that reduces LAI and - ! biomass pools in response to cold damaged crop - - if (t_ref2m_min(p) <= tfrz - 6._r8) then - tkil = (tbase - 6._r8) - 6._r8 * hdidx(p) - if (tkil >= tcrown) then - if ((0.95_r8 - 0.02_r8 * (tcrown - tkil)**2) >= 0.02_r8) then - write (iulog,*) 'crop damaged by cold temperatures at p,c =', p,c - else if (tlai(p) > 0._r8) then ! slevis: kill if past phase1 - gddmaturity(p) = 0._r8 ! by forcing through - huigrain(p) = 0._r8 ! harvest - write (iulog,*) '95% of crop killed by cold temperatures at p,c =', p,c - end if - end if - end if - - end subroutine vernalization - -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNOnsetGrowth -! -! !INTERFACE: -subroutine CNOnsetGrowth (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Determines the flux of stored C and N from transfer pools to display -! pools during the phenological onset period. -! -! !USES: -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 10/27/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: onset_flag(:) ! onset flag - real(r8), pointer :: onset_counter(:) ! onset days counter - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: bgtr(:) ! background transfer growth rate (1/s) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: leafn_xfer_to_leafn(:) - real(r8), pointer :: frootn_xfer_to_frootn(:) - real(r8), pointer :: livestemn_xfer_to_livestemn(:) - real(r8), pointer :: deadstemn_xfer_to_deadstemn(:) - real(r8), pointer :: livecrootn_xfer_to_livecrootn(:) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn(:) -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter pft index - real(r8):: t1 ! temporary variable - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays (in) - ivt => pft%itype - onset_flag => pepv%onset_flag - onset_counter => pepv%onset_counter - leafc_xfer => pcs%leafc_xfer - frootc_xfer => pcs%frootc_xfer - livestemc_xfer => pcs%livestemc_xfer - deadstemc_xfer => pcs%deadstemc_xfer - livecrootc_xfer => pcs%livecrootc_xfer - deadcrootc_xfer => pcs%deadcrootc_xfer - leafn_xfer => pns%leafn_xfer - frootn_xfer => pns%frootn_xfer - livestemn_xfer => pns%livestemn_xfer - deadstemn_xfer => pns%deadstemn_xfer - livecrootn_xfer => pns%livecrootn_xfer - deadcrootn_xfer => pns%deadcrootn_xfer - bgtr => pepv%bgtr - woody => pftcon%woody - - ! assign local pointers to derived type arrays (out) - leafc_xfer_to_leafc => pcf%leafc_xfer_to_leafc - frootc_xfer_to_frootc => pcf%frootc_xfer_to_frootc - livestemc_xfer_to_livestemc => pcf%livestemc_xfer_to_livestemc - deadstemc_xfer_to_deadstemc => pcf%deadstemc_xfer_to_deadstemc - livecrootc_xfer_to_livecrootc => pcf%livecrootc_xfer_to_livecrootc - deadcrootc_xfer_to_deadcrootc => pcf%deadcrootc_xfer_to_deadcrootc - leafn_xfer_to_leafn => pnf%leafn_xfer_to_leafn - frootn_xfer_to_frootn => pnf%frootn_xfer_to_frootn - livestemn_xfer_to_livestemn => pnf%livestemn_xfer_to_livestemn - deadstemn_xfer_to_deadstemn => pnf%deadstemn_xfer_to_deadstemn - livecrootn_xfer_to_livecrootn => pnf%livecrootn_xfer_to_livecrootn - deadcrootn_xfer_to_deadcrootn => pnf%deadcrootn_xfer_to_deadcrootn - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes during onset period - if (onset_flag(p) == 1._r8) then - - ! The transfer rate is a linearly decreasing function of time, - ! going to zero on the last timestep of the onset period - - if (onset_counter(p) == dt) then - t1 = 1.0_r8 / dt - else - t1 = 2.0_r8 / (onset_counter(p)) - end if - leafc_xfer_to_leafc(p) = t1 * leafc_xfer(p) - frootc_xfer_to_frootc(p) = t1 * frootc_xfer(p) - leafn_xfer_to_leafn(p) = t1 * leafn_xfer(p) - frootn_xfer_to_frootn(p) = t1 * frootn_xfer(p) - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = t1 * livestemc_xfer(p) - deadstemc_xfer_to_deadstemc(p) = t1 * deadstemc_xfer(p) - livecrootc_xfer_to_livecrootc(p) = t1 * livecrootc_xfer(p) - deadcrootc_xfer_to_deadcrootc(p) = t1 * deadcrootc_xfer(p) - livestemn_xfer_to_livestemn(p) = t1 * livestemn_xfer(p) - deadstemn_xfer_to_deadstemn(p) = t1 * deadstemn_xfer(p) - livecrootn_xfer_to_livecrootn(p) = t1 * livecrootn_xfer(p) - deadcrootn_xfer_to_deadcrootn(p) = t1 * deadcrootn_xfer(p) - end if - - end if ! end if onset period - - ! calculate the background rate of transfer growth (used for stress - ! deciduous algorithm). In this case, all of the mass in the transfer - ! pools should be moved to displayed growth in each timestep. - - if (bgtr(p) > 0._r8) then - leafc_xfer_to_leafc(p) = leafc_xfer(p) / dt - frootc_xfer_to_frootc(p) = frootc_xfer(p) / dt - leafn_xfer_to_leafn(p) = leafn_xfer(p) / dt - frootn_xfer_to_frootn(p) = frootn_xfer(p) / dt - if (woody(ivt(p)) == 1.0_r8) then - livestemc_xfer_to_livestemc(p) = livestemc_xfer(p) / dt - deadstemc_xfer_to_deadstemc(p) = deadstemc_xfer(p) / dt - livecrootc_xfer_to_livecrootc(p) = livecrootc_xfer(p) / dt - deadcrootc_xfer_to_deadcrootc(p) = deadcrootc_xfer(p) / dt - livestemn_xfer_to_livestemn(p) = livestemn_xfer(p) / dt - deadstemn_xfer_to_deadstemn(p) = deadstemn_xfer(p) / dt - livecrootn_xfer_to_livecrootn(p) = livecrootn_xfer(p) / dt - deadcrootn_xfer_to_deadcrootn(p) = deadcrootn_xfer(p) / dt - end if - end if ! end if bgtr - - end do ! end pft loop - -end subroutine CNOnsetGrowth -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNOffsetLitterfall -! -! !INTERFACE: -subroutine CNOffsetLitterfall (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Determines the flux of C and N from displayed pools to litter -! pools during the phenological offset period. -! -! !USES: - use pftvarcon , only: npcropmin -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 10/27/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: offset_flag(:) ! offset flag - real(r8), pointer :: offset_counter(:) ! offset days counter - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: cpool_to_leafc(:) ! allocation to leaf C (gC/m2/s) - real(r8), pointer :: cpool_to_frootc(:) ! allocation to fine root C (gC/m2/s) -! integer , pointer :: pcolumn(:) ! pft's column index - real(r8), pointer :: grainc(:) ! (gC/m2) grain C - real(r8), pointer :: livestemc(:) ! (gC/m2) livestem C - real(r8), pointer :: cpool_to_grainc(:) ! allocation to grain C (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc(:) ! allocation to live stem C (gC/m2/s) - real(r8), pointer :: livewdcn(:) ! live wood C:N (gC/gN) - real(r8), pointer :: graincn(:) ! grain C:N (gC/gN) - real(r8), pointer :: leafcn(:) ! leaf C:N (gC/gN) - real(r8), pointer :: lflitcn(:) ! leaf litter C:N (gC/gN) - real(r8), pointer :: frootcn(:) ! fine root C:N (gC/gN) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: prev_leafc_to_litter(:) ! previous timestep leaf C litterfall flux (gC/m2/s) - real(r8), pointer :: prev_frootc_to_litter(:) ! previous timestep froot C litterfall flux (gC/m2/s) - real(r8), pointer :: leafc_to_litter(:) ! leaf C litterfall (gC/m2/s) - real(r8), pointer :: frootc_to_litter(:) ! fine root C litterfall (gC/m2/s) - real(r8), pointer :: leafn_to_litter(:) ! leaf N litterfall (gN/m2/s) - real(r8), pointer :: leafn_to_retransn(:) ! leaf N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: frootn_to_litter(:) ! fine root N litterfall (gN/m2/s) - real(r8), pointer :: livestemc_to_litter(:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc_to_food(:) ! grain C to food (gC/m2/s) - real(r8), pointer :: livestemn_to_litter(:) ! livestem N to litter (gN/m2/s) - real(r8), pointer :: grainn_to_food(:) ! grain N to food (gN/m2/s) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: p, c ! indices - integer :: fp ! lake filter pft index - real(r8):: t1 ! temporary variable - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays (in) - ivt => pft%itype - offset_flag => pepv%offset_flag - offset_counter => pepv%offset_counter - leafc => pcs%leafc - frootc => pcs%frootc - grainc => pcs%grainc - livestemc => pcs%livestemc - cpool_to_grainc => pcf%cpool_to_grainc - cpool_to_livestemc => pcf%cpool_to_livestemc - cpool_to_leafc => pcf%cpool_to_leafc - cpool_to_frootc => pcf%cpool_to_frootc - leafcn => pftcon%leafcn - lflitcn => pftcon%lflitcn - frootcn => pftcon%frootcn - livewdcn => pftcon%livewdcn - graincn => pftcon%graincn - - ! assign local pointers to derived type arrays (out) - prev_leafc_to_litter => pepv%prev_leafc_to_litter - prev_frootc_to_litter => pepv%prev_frootc_to_litter - leafc_to_litter => pcf%leafc_to_litter - frootc_to_litter => pcf%frootc_to_litter - livestemc_to_litter => pcf%livestemc_to_litter - grainc_to_food => pcf%grainc_to_food - livestemn_to_litter => pnf%livestemn_to_litter - grainn_to_food => pnf%grainn_to_food - leafn_to_litter => pnf%leafn_to_litter - leafn_to_retransn => pnf%leafn_to_retransn - frootn_to_litter => pnf%frootn_to_litter - - ! The litterfall transfer rate starts at 0.0 and increases linearly - ! over time, with displayed growth going to 0.0 on the last day of litterfall - - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate fluxes during offset period - if (offset_flag(p) == 1._r8) then - - if (offset_counter(p) == dt) then - t1 = 1.0_r8 / dt - leafc_to_litter(p) = t1 * leafc(p) + cpool_to_leafc(p) - frootc_to_litter(p) = t1 * frootc(p) + cpool_to_frootc(p) - ! this assumes that offset_counter == dt for crops - ! if this were ever changed, we'd need to add code to the "else" - if (ivt(p) >= npcropmin) then - grainc_to_food(p) = t1 * grainc(p) + cpool_to_grainc(p) - livestemc_to_litter(p) = t1 * livestemc(p) + cpool_to_livestemc(p) - end if - else - t1 = dt * 2.0_r8 / (offset_counter(p) * offset_counter(p)) - leafc_to_litter(p) = prev_leafc_to_litter(p) + t1*(leafc(p) - prev_leafc_to_litter(p)*offset_counter(p)) - frootc_to_litter(p) = prev_frootc_to_litter(p) + t1*(frootc(p) - prev_frootc_to_litter(p)*offset_counter(p)) - end if - - ! calculate the leaf N litterfall and retranslocation - leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) - leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) - - ! calculate fine root N litterfall (no retranslocation of fine root N) - frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) - - if (ivt(p) >= npcropmin) then - livestemn_to_litter(p) = livestemc_to_litter(p) / livewdcn(ivt(p)) - grainn_to_food(p) = grainc_to_food(p) / graincn(ivt(p)) - end if - - ! save the current litterfall fluxes - prev_leafc_to_litter(p) = leafc_to_litter(p) - prev_frootc_to_litter(p) = frootc_to_litter(p) - - end if ! end if offset period - - end do ! end pft loop - -end subroutine CNOffsetLitterfall -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNBackgroundLitterfall -! -! !INTERFACE: -subroutine CNBackgroundLitterfall (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Determines the flux of C and N from displayed pools to litter -! pools as the result of background litter fall. -! -! !USES: -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 10/2/03: Created by Peter Thornton -! 10/24/03, Peter Thornton: migrated to vector data structures -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - ! pft level - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: bglfr(:) ! background litterfall rate (1/s) - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - ! ecophysiological constants - real(r8), pointer :: leafcn(:) ! leaf C:N (gC/gN) - real(r8), pointer :: lflitcn(:) ! leaf litter C:N (gC/gN) - real(r8), pointer :: frootcn(:) ! fine root C:N (gC/gN) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: leafc_to_litter(:) - real(r8), pointer :: frootc_to_litter(:) - real(r8), pointer :: leafn_to_litter(:) - real(r8), pointer :: leafn_to_retransn(:) - real(r8), pointer :: frootn_to_litter(:) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter pft index - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays (in) - ivt => pft%itype - bglfr => pepv%bglfr - leafc => pcs%leafc - frootc => pcs%frootc - leafcn => pftcon%leafcn - lflitcn => pftcon%lflitcn - frootcn => pftcon%frootcn - - ! assign local pointers to derived type arrays (out) - leafc_to_litter => pcf%leafc_to_litter - frootc_to_litter => pcf%frootc_to_litter - leafn_to_litter => pnf%leafn_to_litter - leafn_to_retransn => pnf%leafn_to_retransn - frootn_to_litter => pnf%frootn_to_litter - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes if the background litterfall rate is non-zero - if (bglfr(p) > 0._r8) then - ! units for bglfr are already 1/s - leafc_to_litter(p) = bglfr(p) * leafc(p) - frootc_to_litter(p) = bglfr(p) * frootc(p) - - ! calculate the leaf N litterfall and retranslocation - leafn_to_litter(p) = leafc_to_litter(p) / lflitcn(ivt(p)) - leafn_to_retransn(p) = (leafc_to_litter(p) / leafcn(ivt(p))) - leafn_to_litter(p) - - ! calculate fine root N litterfall (no retranslocation of fine root N) - frootn_to_litter(p) = frootc_to_litter(p) / frootcn(ivt(p)) - - end if - - end do - -end subroutine CNBackgroundLitterfall -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNLivewoodTurnover -! -! !INTERFACE: -subroutine CNLivewoodTurnover (num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Determines the flux of C and N from live wood to -! dead wood pools, for stem and coarse root. -! -! !USES: -! -! !ARGUMENTS: - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 12/5/03: created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - ! pft level - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - ! ecophysiological constants - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: livewdcn(:) ! live wood (phloem and ray parenchyma) C:N (gC/gN) - real(r8), pointer :: deadwdcn(:) ! dead wood (xylem and heartwood) C:N (gC/gN) -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: livestemc_to_deadstemc(:) - real(r8), pointer :: livecrootc_to_deadcrootc(:) - real(r8), pointer :: livestemn_to_deadstemn(:) - real(r8), pointer :: livestemn_to_retransn(:) - real(r8), pointer :: livecrootn_to_deadcrootn(:) - real(r8), pointer :: livecrootn_to_retransn(:) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: p ! indices - integer :: fp ! lake filter pft index - real(r8):: ctovr ! temporary variable for carbon turnover - real(r8):: ntovr ! temporary variable for nitrogen turnover - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays (in) - ivt => pft%itype - livestemc => pcs%livestemc - livecrootc => pcs%livecrootc - livestemn => pns%livestemn - livecrootn => pns%livecrootn - woody => pftcon%woody - livewdcn => pftcon%livewdcn - deadwdcn => pftcon%deadwdcn - - ! assign local pointers to derived type arrays (out) - livestemc_to_deadstemc => pcf%livestemc_to_deadstemc - livecrootc_to_deadcrootc => pcf%livecrootc_to_deadcrootc - livestemn_to_deadstemn => pnf%livestemn_to_deadstemn - livestemn_to_retransn => pnf%livestemn_to_retransn - livecrootn_to_deadcrootn => pnf%livecrootn_to_deadcrootn - livecrootn_to_retransn => pnf%livecrootn_to_retransn - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! only calculate these fluxes for woody types - if (woody(ivt(p)) > 0._r8) then - - ! live stem to dead stem turnover - - ctovr = livestemc(p) * lwtop - ntovr = ctovr / livewdcn(ivt(p)) - livestemc_to_deadstemc(p) = ctovr - livestemn_to_deadstemn(p) = ctovr / deadwdcn(ivt(p)) - livestemn_to_retransn(p) = ntovr - livestemn_to_deadstemn(p) - - ! live coarse root to dead coarse root turnover - - ctovr = livecrootc(p) * lwtop - ntovr = ctovr / livewdcn(ivt(p)) - livecrootc_to_deadcrootc(p) = ctovr - livecrootn_to_deadcrootn(p) = ctovr / deadwdcn(ivt(p)) - livecrootn_to_retransn(p) = ntovr - livecrootn_to_deadcrootn(p) - - end if - - end do - -end subroutine CNLivewoodTurnover -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNLitterToColumn -! -! !INTERFACE: -subroutine CNLitterToColumn (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! called at the end of cn_phenology to gather all pft-level litterfall fluxes -! to the column level and assign them to the three litter pools -! -! !USES: - use clm_varpar, only : max_pft_per_col - use pftvarcon , only : npcropmin -! -! !ARGUMENTS: - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns -! -! !CALLED FROM: -! subroutine CNPhenology -! -! !REVISION HISTORY: -! 9/8/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: wtcol(:) ! weight (relative to column) for this pft (0-1) - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: leafc_to_litter(:) ! leaf C litterfall (gC/m2/s) - real(r8), pointer :: frootc_to_litter(:) ! fine root N litterfall (gN/m2/s) - real(r8), pointer :: livestemc_to_litter(:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc_to_food(:) ! grain C to food (gC/m2/s) - real(r8), pointer :: livestemn_to_litter(:) ! livestem N to litter (gN/m2/s) - real(r8), pointer :: grainn_to_food(:) ! grain N to food (gN/m2/s) - real(r8), pointer :: leafn_to_litter(:) ! leaf N litterfall (gN/m2/s) - real(r8), pointer :: frootn_to_litter(:) ! fine root N litterfall (gN/m2/s) - real(r8), pointer :: lf_flab(:) ! leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) ! leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) ! leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) ! fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) ! fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) ! fine root litter lignin fraction - integer , pointer :: npfts(:) ! number of pfts for each column - integer , pointer :: pfti(:) ! beginning pft index for each column -! -! local pointers to implicit in/out scalars -! - real(r8), pointer :: leafc_to_litr1c(:) ! leaf C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr2c(:) ! leaf C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr3c(:) ! leaf C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr1c(:) ! fine root C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr2c(:) ! fine root C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr3c(:) ! fine root C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr1c(:) ! livestem C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr2c(:) ! livestem C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr3c(:) ! livestem C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: livestemn_to_litr1n(:) ! livestem N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr2n(:) ! livestem N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr3n(:) ! livestem N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: grainc_to_litr1c(:) ! grain C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: grainc_to_litr2c(:) ! grain C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: grainc_to_litr3c(:) ! grain C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: grainn_to_litr1n(:) ! grain N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr2n(:) ! grain N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr3n(:) ! grain N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr1n(:) ! leaf N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr2n(:) ! leaf N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr3n(:) ! leaf N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr1n(:) ! fine root N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr2n(:) ! fine root N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr3n(:) ! fine root N litterfall to litter 3 N (gN/m2/s) -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: fc,c,pi,p ! indices -!EOP -!----------------------------------------------------------------------- - ! assign local pointers to derived type arrays (in) - ivt => pft%itype - wtcol => pft%wtcol - pwtgcell => pft%wtgcell - leafc_to_litter => pcf%leafc_to_litter - frootc_to_litter => pcf%frootc_to_litter - livestemc_to_litter => pcf%livestemc_to_litter - grainc_to_food => pcf%grainc_to_food - livestemn_to_litter => pnf%livestemn_to_litter - grainn_to_food => pnf%grainn_to_food - leafn_to_litter => pnf%leafn_to_litter - frootn_to_litter => pnf%frootn_to_litter - npfts => col%npfts - pfti => col%pfti - lf_flab => pftcon%lf_flab - lf_fcel => pftcon%lf_fcel - lf_flig => pftcon%lf_flig - fr_flab => pftcon%fr_flab - fr_fcel => pftcon%fr_fcel - fr_flig => pftcon%fr_flig - - ! assign local pointers to derived type arrays (out) - leafc_to_litr1c => ccf%leafc_to_litr1c - leafc_to_litr2c => ccf%leafc_to_litr2c - leafc_to_litr3c => ccf%leafc_to_litr3c - frootc_to_litr1c => ccf%frootc_to_litr1c - frootc_to_litr2c => ccf%frootc_to_litr2c - frootc_to_litr3c => ccf%frootc_to_litr3c - grainc_to_litr1c => ccf%grainc_to_litr1c - grainc_to_litr2c => ccf%grainc_to_litr2c - grainc_to_litr3c => ccf%grainc_to_litr3c - livestemc_to_litr1c => ccf%livestemc_to_litr1c - livestemc_to_litr2c => ccf%livestemc_to_litr2c - livestemc_to_litr3c => ccf%livestemc_to_litr3c - livestemn_to_litr1n => cnf%livestemn_to_litr1n - livestemn_to_litr2n => cnf%livestemn_to_litr2n - livestemn_to_litr3n => cnf%livestemn_to_litr3n - grainn_to_litr1n => cnf%grainn_to_litr1n - grainn_to_litr2n => cnf%grainn_to_litr2n - grainn_to_litr3n => cnf%grainn_to_litr3n - leafn_to_litr1n => cnf%leafn_to_litr1n - leafn_to_litr2n => cnf%leafn_to_litr2n - leafn_to_litr3n => cnf%leafn_to_litr3n - frootn_to_litr1n => cnf%frootn_to_litr1n - frootn_to_litr2n => cnf%frootn_to_litr2n - frootn_to_litr3n => cnf%frootn_to_litr3n - - do pi = 1,max_pft_per_col - do fc = 1,num_soilc - c = filter_soilc(fc) - - if ( pi <= npfts(c) ) then - p = pfti(c) + pi - 1 - if (pwtgcell(p)>0._r8) then - - ! leaf litter carbon fluxes - leafc_to_litr1c(c) = leafc_to_litr1c(c) + leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - leafc_to_litr2c(c) = leafc_to_litr2c(c) + leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - leafc_to_litr3c(c) = leafc_to_litr3c(c) + leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! leaf litter nitrogen fluxes - leafn_to_litr1n(c) = leafn_to_litr1n(c) + leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - leafn_to_litr2n(c) = leafn_to_litr2n(c) + leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - leafn_to_litr3n(c) = leafn_to_litr3n(c) + leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root litter carbon fluxes - frootc_to_litr1c(c) = frootc_to_litr1c(c) + frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - frootc_to_litr2c(c) = frootc_to_litr2c(c) + frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - frootc_to_litr3c(c) = frootc_to_litr3c(c) + frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! fine root litter nitrogen fluxes - frootn_to_litr1n(c) = frootn_to_litr1n(c) + frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - frootn_to_litr2n(c) = frootn_to_litr2n(c) + frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - frootn_to_litr3n(c) = frootn_to_litr3n(c) + frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - - ! agroibis puts crop stem litter together with leaf litter - ! so I've used the leaf lf_f* parameters instead of making - ! new ones for now (slevis) - ! also for simplicity I've put "food" into the litter pools - if (ivt(p) >= npcropmin) then ! add livestemc to litter - ! stem litter carbon fluxes - livestemc_to_litr1c(c) = livestemc_to_litr1c(c) + livestemc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - livestemc_to_litr2c(c) = livestemc_to_litr2c(c) + livestemc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - livestemc_to_litr3c(c) = livestemc_to_litr3c(c) + livestemc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! stem litter nitrogen fluxes - livestemn_to_litr1n(c) = livestemn_to_litr1n(c) + livestemn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - livestemn_to_litr2n(c) = livestemn_to_litr2n(c) + livestemn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - livestemn_to_litr3n(c) = livestemn_to_litr3n(c) + livestemn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! grain litter carbon fluxes - grainc_to_litr1c(c) = grainc_to_litr1c(c) + grainc_to_food(p) * lf_flab(ivt(p)) * wtcol(p) - grainc_to_litr2c(c) = grainc_to_litr2c(c) + grainc_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) - grainc_to_litr3c(c) = grainc_to_litr3c(c) + grainc_to_food(p) * lf_flig(ivt(p)) * wtcol(p) - - ! grain litter nitrogen fluxes - grainn_to_litr1n(c) = grainn_to_litr1n(c) + grainn_to_food(p) * lf_flab(ivt(p)) * wtcol(p) - grainn_to_litr2n(c) = grainn_to_litr2n(c) + grainn_to_food(p) * lf_fcel(ivt(p)) * wtcol(p) - grainn_to_litr3n(c) = grainn_to_litr3n(c) + grainn_to_food(p) * lf_flig(ivt(p)) * wtcol(p) - end if - end if - end if - - end do - - end do - -end subroutine CNLitterToColumn -!----------------------------------------------------------------------- - -end module CNPhenologyMod diff --git a/src_clm40/biogeochem/CNPrecisionControlMod.F90 b/src_clm40/biogeochem/CNPrecisionControlMod.F90 deleted file mode 100644 index 9acac12aca..0000000000 --- a/src_clm40/biogeochem/CNPrecisionControlMod.F90 +++ /dev/null @@ -1,737 +0,0 @@ -module CNPrecisionControlMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNPrecisionControlMod -! -! !DESCRIPTION: -! controls on very low values in critical state variables -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: CNPrecisionControl -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNPrecisionControl -! -! !INTERFACE: -subroutine CNPrecisionControl(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, force leaf and deadstem c and n to 0 if -! they get too small. -! -! !USES: - use clmtype - use abortutils, only: endrun - use clm_varctl, only: iulog, use_c13 - use pftvarcon, only: nc3crop - use surfrdMod, only: crop_prog -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 8/1/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars - real(r8), pointer :: col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - - real(r8), pointer :: c13_col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - real(r8), pointer :: c13_cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: c13_litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: c13_litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: c13_litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: c13_soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: c13_soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: c13_soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: c13_soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - - real(r8), pointer :: col_ntrunc(:) ! (gN/m2) column-level sink for N truncation - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: soil1n(:) ! (gN/m2) soil organic matter N (fast pool) - real(r8), pointer :: soil2n(:) ! (gN/m2) soil organic matter N (medium pool) - real(r8), pointer :: soil3n(:) ! (gN/m2) soil orgainc matter N (slow pool) - real(r8), pointer :: soil4n(:) ! (gN/m2) soil orgainc matter N (slowest pool) - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: pft_ctrunc(:) ! (gC/m2) pft-level sink for C truncation - real(r8), pointer :: xsmrpool(:) ! (gC/m2) execss maint resp C pool - real(r8), pointer :: grainc(:) ! (gC/m2) grain C - real(r8), pointer :: grainc_storage(:) ! (gC/m2) grain C storage - real(r8), pointer :: grainc_xfer(:) ! (gC/m2) grain C transfer - - real(r8), pointer :: c13_cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: c13_deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: c13_deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: c13_deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: c13_deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: c13_deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: c13_deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: c13_frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: c13_frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: c13_frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: c13_gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: c13_gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: c13_leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: c13_leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: c13_leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: c13_livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: c13_livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: c13_livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: c13_livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: c13_livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: c13_livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: c13_pft_ctrunc(:) ! (gC/m2) pft-level sink for C truncation - - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: grainn(:) ! (gC/m2) grain N - real(r8), pointer :: grainn_storage(:) ! (gC/m2) grain N storage - real(r8), pointer :: grainn_xfer(:) ! (gC/m2) grain N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: npool(:) ! (gN/m2) temporary plant N pool - real(r8), pointer :: pft_ntrunc(:) ! (gN/m2) pft-level sink for N truncation - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - integer , pointer :: ivt(:) ! pft vegetation type -! -! local pointers to implicit in/out scalars -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - real(r8):: pc,pn ! truncation terms for pft-level corrections - real(r8):: cc,cn ! truncation terms for column-level corrections - - real(r8):: pc13 ! truncation terms for pft-level corrections - real(r8):: cc13 ! truncation terms for column-level corrections - - real(r8):: ccrit ! critical carbon state value for truncation - real(r8):: ncrit ! critical nitrogen state value for truncation - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers at the column level - col_ctrunc => ccs%col_ctrunc - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - soil1c => ccs%soil1c - soil2c => ccs%soil2c - soil3c => ccs%soil3c - soil4c => ccs%soil4c - - c13_col_ctrunc => cc13s%col_ctrunc - c13_cwdc => cc13s%cwdc - c13_litr1c => cc13s%litr1c - c13_litr2c => cc13s%litr2c - c13_litr3c => cc13s%litr3c - c13_soil1c => cc13s%soil1c - c13_soil2c => cc13s%soil2c - c13_soil3c => cc13s%soil3c - c13_soil4c => cc13s%soil4c - - col_ntrunc => cns%col_ntrunc - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - soil1n => cns%soil1n - soil2n => cns%soil2n - soil3n => cns%soil3n - soil4n => cns%soil4n - - ! assign local pointers at the pft level - ivt => pft%itype - cpool => pcs%cpool - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - pft_ctrunc => pcs%pft_ctrunc - xsmrpool => pcs%xsmrpool - grainc => pcs%grainc - grainc_storage => pcs%grainc_storage - grainc_xfer => pcs%grainc_xfer - - c13_cpool => pc13s%cpool - c13_deadcrootc => pc13s%deadcrootc - c13_deadcrootc_storage => pc13s%deadcrootc_storage - c13_deadcrootc_xfer => pc13s%deadcrootc_xfer - c13_deadstemc => pc13s%deadstemc - c13_deadstemc_storage => pc13s%deadstemc_storage - c13_deadstemc_xfer => pc13s%deadstemc_xfer - c13_frootc => pc13s%frootc - c13_frootc_storage => pc13s%frootc_storage - c13_frootc_xfer => pc13s%frootc_xfer - c13_gresp_storage => pc13s%gresp_storage - c13_gresp_xfer => pc13s%gresp_xfer - c13_leafc => pc13s%leafc - c13_leafc_storage => pc13s%leafc_storage - c13_leafc_xfer => pc13s%leafc_xfer - c13_livecrootc => pc13s%livecrootc - c13_livecrootc_storage => pc13s%livecrootc_storage - c13_livecrootc_xfer => pc13s%livecrootc_xfer - c13_livestemc => pc13s%livestemc - c13_livestemc_storage => pc13s%livestemc_storage - c13_livestemc_xfer => pc13s%livestemc_xfer - c13_pft_ctrunc => pc13s%pft_ctrunc - - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - grainn => pns%grainn - grainn_storage => pns%grainn_storage - grainn_xfer => pns%grainn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - npool => pns%npool - pft_ntrunc => pns%pft_ntrunc - retransn => pns%retransn - - ! set the critical carbon state value for truncation (gC/m2) - ccrit = 1.e-8_r8 - ! set the critical nitrogen state value for truncation (gN/m2) - ncrit = 1.e-8_r8 - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! initialize the pft-level C and N truncation terms - pc = 0._r8 - if (use_c13) then - pc13 = 0._r8 - end if - pn = 0._r8 - - ! do tests on state variables for precision control - ! for linked C-N state variables, perform precision test on - ! the C component, but truncate C, C13, and N components - - ! leaf C and N - if (abs(leafc(p)) < ccrit) then - pc = pc + leafc(p) - leafc(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_leafc(p) - c13_leafc(p) = 0._r8 - endif - pn = pn + leafn(p) - leafn(p) = 0._r8 - end if - - ! leaf storage C and N - if (abs(leafc_storage(p)) < ccrit) then - pc = pc + leafc_storage(p) - leafc_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_leafc_storage(p) - c13_leafc_storage(p) = 0._r8 - endif - pn = pn + leafn_storage(p) - leafn_storage(p) = 0._r8 - end if - - ! leaf transfer C and N - if (abs(leafc_xfer(p)) < ccrit) then - pc = pc + leafc_xfer(p) - leafc_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_leafc_xfer(p) - c13_leafc_xfer(p) = 0._r8 - endif - pn = pn + leafn_xfer(p) - leafn_xfer(p) = 0._r8 - end if - - ! froot C and N - if (abs(frootc(p)) < ccrit) then - pc = pc + frootc(p) - frootc(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_frootc(p) - c13_frootc(p) = 0._r8 - endif - pn = pn + frootn(p) - frootn(p) = 0._r8 - end if - - ! froot storage C and N - if (abs(frootc_storage(p)) < ccrit) then - pc = pc + frootc_storage(p) - frootc_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_frootc_storage(p) - c13_frootc_storage(p) = 0._r8 - endif - pn = pn + frootn_storage(p) - frootn_storage(p) = 0._r8 - end if - - ! froot transfer C and N - if (abs(frootc_xfer(p)) < ccrit) then - pc = pc + frootc_xfer(p) - frootc_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_frootc_xfer(p) - c13_frootc_xfer(p) = 0._r8 - endif - pn = pn + frootn_xfer(p) - frootn_xfer(p) = 0._r8 - end if - - if ( crop_prog .and. ivt(p) >= nc3crop )then - ! grain C and N - if (abs(grainc(p)) < ccrit) then - pc = pc + grainc(p) - grainc(p) = 0._r8 - pn = pn + grainn(p) - grainn(p) = 0._r8 - end if - - ! grain storage C and N - if (abs(grainc_storage(p)) < ccrit) then - pc = pc + grainc_storage(p) - grainc_storage(p) = 0._r8 - pn = pn + grainn_storage(p) - grainn_storage(p) = 0._r8 - end if - - ! grain transfer C and N - if (abs(grainc_xfer(p)) < ccrit) then - pc = pc + grainc_xfer(p) - grainc_xfer(p) = 0._r8 - pn = pn + grainn_xfer(p) - grainn_xfer(p) = 0._r8 - end if - end if - - ! livestem C and N - if (abs(livestemc(p)) < ccrit) then - pc = pc + livestemc(p) - livestemc(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_livestemc(p) - c13_livestemc(p) = 0._r8 - endif - pn = pn + livestemn(p) - livestemn(p) = 0._r8 - end if - - ! livestem storage C and N - if (abs(livestemc_storage(p)) < ccrit) then - pc = pc + livestemc_storage(p) - livestemc_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_livestemc_storage(p) - c13_livestemc_storage(p) = 0._r8 - endif - pn = pn + livestemn_storage(p) - livestemn_storage(p) = 0._r8 - end if - - ! livestem transfer C and N - if (abs(livestemc_xfer(p)) < ccrit) then - pc = pc + livestemc_xfer(p) - livestemc_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_livestemc_xfer(p) - c13_livestemc_xfer(p) = 0._r8 - endif - pn = pn + livestemn_xfer(p) - livestemn_xfer(p) = 0._r8 - end if - - ! deadstem C and N - if (abs(deadstemc(p)) < ccrit) then - pc = pc + deadstemc(p) - deadstemc(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_deadstemc(p) - c13_deadstemc(p) = 0._r8 - endif - pn = pn + deadstemn(p) - deadstemn(p) = 0._r8 - end if - - ! deadstem storage C and N - if (abs(deadstemc_storage(p)) < ccrit) then - pc = pc + deadstemc_storage(p) - deadstemc_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_deadstemc_storage(p) - c13_deadstemc_storage(p) = 0._r8 - endif - pn = pn + deadstemn_storage(p) - deadstemn_storage(p) = 0._r8 - end if - - ! deadstem transfer C and N - if (abs(deadstemc_xfer(p)) < ccrit) then - pc = pc + deadstemc_xfer(p) - deadstemc_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_deadstemc_xfer(p) - c13_deadstemc_xfer(p) = 0._r8 - endif - pn = pn + deadstemn_xfer(p) - deadstemn_xfer(p) = 0._r8 - end if - - ! livecroot C and N - if (abs(livecrootc(p)) < ccrit) then - pc = pc + livecrootc(p) - livecrootc(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_livecrootc(p) - c13_livecrootc(p) = 0._r8 - endif - pn = pn + livecrootn(p) - livecrootn(p) = 0._r8 - end if - - ! livecroot storage C and N - if (abs(livecrootc_storage(p)) < ccrit) then - pc = pc + livecrootc_storage(p) - livecrootc_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_livecrootc_storage(p) - c13_livecrootc_storage(p) = 0._r8 - endif - pn = pn + livecrootn_storage(p) - livecrootn_storage(p) = 0._r8 - end if - - ! livecroot transfer C and N - if (abs(livecrootc_xfer(p)) < ccrit) then - pc = pc + livecrootc_xfer(p) - livecrootc_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_livecrootc_xfer(p) - c13_livecrootc_xfer(p) = 0._r8 - endif - pn = pn + livecrootn_xfer(p) - livecrootn_xfer(p) = 0._r8 - end if - - ! deadcroot C and N - if (abs(deadcrootc(p)) < ccrit) then - pc = pc + deadcrootc(p) - deadcrootc(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_deadcrootc(p) - c13_deadcrootc(p) = 0._r8 - endif - pn = pn + deadcrootn(p) - deadcrootn(p) = 0._r8 - end if - - ! deadcroot storage C and N - if (abs(deadcrootc_storage(p)) < ccrit) then - pc = pc + deadcrootc_storage(p) - deadcrootc_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_deadcrootc_storage(p) - c13_deadcrootc_storage(p) = 0._r8 - endif - pn = pn + deadcrootn_storage(p) - deadcrootn_storage(p) = 0._r8 - end if - - ! deadcroot transfer C and N - if (abs(deadcrootc_xfer(p)) < ccrit) then - pc = pc + deadcrootc_xfer(p) - deadcrootc_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_deadcrootc_xfer(p) - c13_deadcrootc_xfer(p) = 0._r8 - endif - pn = pn + deadcrootn_xfer(p) - deadcrootn_xfer(p) = 0._r8 - end if - - ! gresp_storage (C only) - if (abs(gresp_storage(p)) < ccrit) then - pc = pc + gresp_storage(p) - gresp_storage(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_gresp_storage(p) - c13_gresp_storage(p) = 0._r8 - endif - end if - - ! gresp_xfer (C only) - if (abs(gresp_xfer(p)) < ccrit) then - pc = pc + gresp_xfer(p) - gresp_xfer(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_gresp_xfer(p) - c13_gresp_xfer(p) = 0._r8 - endif - end if - - ! cpool (C only) - if (abs(cpool(p)) < ccrit) then - pc = pc + cpool(p) - cpool(p) = 0._r8 - if (use_c13) then - pc13 = pc13 + c13_cpool(p) - c13_cpool(p) = 0._r8 - endif - end if - - if ( crop_prog .and. ivt(p) >= nc3crop )then - ! xsmrpool (C only) - if (abs(xsmrpool(p)) < ccrit) then - pc = pc + xsmrpool(p) - xsmrpool(p) = 0._r8 - end if - end if - - ! retransn (N only) - if (abs(retransn(p)) < ncrit) then - pn = pn + retransn(p) - retransn(p) = 0._r8 - end if - - ! npool (N only) - if (abs(npool(p)) < ncrit) then - pn = pn + npool(p) - npool(p) = 0._r8 - end if - - pft_ctrunc(p) = pft_ctrunc(p) + pc - if (use_c13) then - c13_pft_ctrunc(p) = c13_pft_ctrunc(p) + pc13 - endif - pft_ntrunc(p) = pft_ntrunc(p) + pn - - end do ! end of pft loop - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! initialize the column-level C and N truncation terms - cc = 0._r8 - if (use_c13) then - cc13 = 0._r8 - endif - cn = 0._r8 - - ! do tests on state variables for precision control - ! for linked C-N state variables, perform precision test on - ! the C component, but truncate both C and N components - - ! coarse woody debris C and N - if (abs(cwdc(c)) < ccrit) then - cc = cc + cwdc(c) - cwdc(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_cwdc(c) - c13_cwdc(c) = 0._r8 - endif - cn = cn + cwdn(c) - cwdn(c) = 0._r8 - end if - - ! litr1 C and N - if (abs(litr1c(c)) < ccrit) then - cc = cc + litr1c(c) - litr1c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_litr1c(c) - c13_litr1c(c) = 0._r8 - endif - cn = cn + litr1n(c) - litr1n(c) = 0._r8 - end if - - ! litr2 C and N - if (abs(litr2c(c)) < ccrit) then - cc = cc + litr2c(c) - litr2c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_litr2c(c) - c13_litr2c(c) = 0._r8 - endif - cn = cn + litr2n(c) - litr2n(c) = 0._r8 - end if - - ! litr3 C and N - if (abs(litr3c(c)) < ccrit) then - cc = cc + litr3c(c) - litr3c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_litr3c(c) - c13_litr3c(c) = 0._r8 - endif - cn = cn + litr3n(c) - litr3n(c) = 0._r8 - end if - - ! soil1 C and N - if (abs(soil1c(c)) < ccrit) then - cc = cc + soil1c(c) - soil1c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_soil1c(c) - c13_soil1c(c) = 0._r8 - endif - cn = cn + soil1n(c) - soil1n(c) = 0._r8 - end if - - ! soil2 C and N - if (abs(soil2c(c)) < ccrit) then - cc = cc + soil2c(c) - soil2c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_soil2c(c) - c13_soil2c(c) = 0._r8 - endif - cn = cn + soil2n(c) - soil2n(c) = 0._r8 - end if - - ! soil3 C and N - if (abs(soil3c(c)) < ccrit) then - cc = cc + soil3c(c) - soil3c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_soil3c(c) - c13_soil3c(c) = 0._r8 - endif - cn = cn + soil3n(c) - soil3n(c) = 0._r8 - end if - - ! soil4 C and N - if (abs(soil4c(c)) < ccrit) then - cc = cc + soil4c(c) - soil4c(c) = 0._r8 - if (use_c13) then - cc13 = cc13 + c13_soil4c(c) - c13_soil4c(c) = 0._r8 - endif - cn = cn + soil4n(c) - soil4n(c) = 0._r8 - end if - - ! not doing precision control on soil mineral N, since it will - ! be getting the N truncation flux anyway. - - col_ctrunc(c) = col_ctrunc(c) + cc - if (use_c13) then - c13_col_ctrunc(c) = c13_col_ctrunc(c) + cc13 - endif - col_ntrunc(c) = col_ntrunc(c) + cn - - end do ! end of column loop - -end subroutine CNPrecisionControl -!----------------------------------------------------------------------- - -end module CNPrecisionControlMod diff --git a/src_clm40/biogeochem/CNSetValueMod.F90 b/src_clm40/biogeochem/CNSetValueMod.F90 deleted file mode 100644 index bcb8700e18..0000000000 --- a/src_clm40/biogeochem/CNSetValueMod.F90 +++ /dev/null @@ -1,1280 +0,0 @@ -module CNSetValueMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNSetValueMod -! -! !DESCRIPTION: -! contains code to set all CN variables to specified value -! Used for both initialization of special landunit values, and -! setting fluxes to 0.0 at the beginning of each time step -! 3/23/09, Peter Thornton: Added new subroutine, CNZeroFluxes_dwt(), -! which initialize flux variables used in the pftdyn -! routines. This is called from clm_driver1, as -! these variables need to be initialized outside of the clumps loop. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varpar , only: nlevgrnd - use clm_varctl , only: iulog, use_c13, use_cn, use_cndv - use clmtype - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNZeroFluxes - public :: CNZeroFluxes_dwt - public :: CNSetPps - public :: CNSetPepv - public :: CNSetPcs - public :: CNSetPns - public :: CNSetPcf - public :: CNSetPnf - public :: CNSetCps - public :: CNSetCcs - public :: CNSetCns - public :: CNSetCcf - public :: CNSetCnf -! !PRIVATE MEMBER FUNCTIONS: -! -! !REVISION HISTORY: -! 9/04/03: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNZeroFluxes -! -! !INTERFACE: -subroutine CNZeroFluxes(num_filterc, filterc, num_filterp, filterp) -! -! !DESCRIPTION: -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_filterc ! number of good values in filterc - integer, intent(in) :: filterc(:) ! column filter - integer, intent(in) :: num_filterp ! number of good values in filterp - integer, intent(in) :: filterp(:) ! pft filter -! -! !CALLED FROM: -! subroutine CNEcosystemDyn in module CNEcosystemDynMod.F90 -! -! !REVISION HISTORY: -! 9/04/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! -! -! local pointers to implicit in/out scalars -! -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - - ! zero the column-level C and N fluxes - call CNSetCcf(num_filterc, filterc, 0._r8, ccf) - if (use_c13) then - call CNSetCcf(num_filterc, filterc, 0._r8, cc13f) - end if - call CNSetCnf(num_filterc, filterc, 0._r8, cnf) - - ! zero the column-average pft-level C and N fluxes - call CNSetPcf(num_filterc, filterc, 0._r8, pcf_a) - call CNSetPnf(num_filterc, filterc, 0._r8, pnf_a) - - ! zero the pft-level C and N fluxes - call CNSetPcf(num_filterp, filterp, 0._r8, pcf) - if (use_c13) then - call CNSetPcf(num_filterp, filterp, 0._r8, pc13f) - end if - call CNSetPnf(num_filterp, filterp, 0._r8, pnf) - -end subroutine CNZeroFluxes -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNZeroFluxes_dwt -! -! !INTERFACE: -subroutine CNZeroFluxes_dwt( begc, endc, begp, endp ) -! -! !DESCRIPTION: -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begc, endc ! proc beginning and ending column indices - integer, intent(IN) :: begp, endp ! proc beginning and ending pft indices -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 3/23/09: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! -! -! local pointers to implicit in/out scalars -! -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: c, p ! indices - type(column_type), pointer :: cptr ! pointer to column derived subtype -!EOP -!----------------------------------------------------------------------- - - cptr => col - ! set column-level conversion and product pool fluxes - ! to 0 at the beginning of every timestep - - do c = begc,endc - ! C fluxes - ccf%dwt_seedc_to_leaf(c) = 0._r8 - ccf%dwt_seedc_to_deadstem(c) = 0._r8 - ccf%dwt_conv_cflux(c) = 0._r8 - ccf%dwt_prod10c_gain(c) = 0._r8 - ccf%dwt_prod100c_gain(c) = 0._r8 - ccf%dwt_frootc_to_litr1c(c) = 0._r8 - ccf%dwt_frootc_to_litr2c(c) = 0._r8 - ccf%dwt_frootc_to_litr3c(c) = 0._r8 - ccf%dwt_livecrootc_to_cwdc(c) = 0._r8 - ccf%dwt_deadcrootc_to_cwdc(c) = 0._r8 - if (use_c13) then - ! C13 fluxes - cc13f%dwt_seedc_to_leaf(c) = 0._r8 - cc13f%dwt_seedc_to_deadstem(c) = 0._r8 - cc13f%dwt_conv_cflux(c) = 0._r8 - cc13f%dwt_prod10c_gain(c) = 0._r8 - cc13f%dwt_prod100c_gain(c) = 0._r8 - cc13f%dwt_frootc_to_litr1c(c) = 0._r8 - cc13f%dwt_frootc_to_litr2c(c) = 0._r8 - cc13f%dwt_frootc_to_litr3c(c) = 0._r8 - cc13f%dwt_livecrootc_to_cwdc(c) = 0._r8 - cc13f%dwt_deadcrootc_to_cwdc(c) = 0._r8 - end if - ! N fluxes - cnf%dwt_seedn_to_leaf(c) = 0._r8 - cnf%dwt_seedn_to_deadstem(c) = 0._r8 - cnf%dwt_conv_nflux(c) = 0._r8 - cnf%dwt_prod10n_gain(c) = 0._r8 - cnf%dwt_prod100n_gain(c) = 0._r8 - cnf%dwt_frootn_to_litr1n(c) = 0._r8 - cnf%dwt_frootn_to_litr2n(c) = 0._r8 - cnf%dwt_frootn_to_litr3n(c) = 0._r8 - cnf%dwt_livecrootn_to_cwdn(c) = 0._r8 - cnf%dwt_deadcrootn_to_cwdn(c) = 0._r8 - end do - if (use_cn) then - do p = begp,endp - pcs%dispvegc(p) = 0._r8 - pcs%storvegc(p) = 0._r8 - pcs%totpftc(p) = 0._r8 - if (use_c13) then - pc13s%dispvegc(p) = 0._r8 - pc13s%storvegc(p) = 0._r8 - pc13s%totpftc(p) = 0._r8 - end if - pns%dispvegn(p) = 0._r8 - pns%storvegn(p) = 0._r8 - pns%totvegn(p) = 0._r8 - pns%totpftn(p) = 0._r8 - end do - end if - -end subroutine CNZeroFluxes_dwt -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetPps -! -! !INTERFACE: -subroutine CNSetPps(num, filter, val, pps) -! -! !DESCRIPTION: -! Set pft physical state variables -! !USES: - use clm_varpar , only : numrad -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (pft_pstate_type), intent(inout) :: pps -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i,j ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - pps%slasun(i) = val - pps%slasha(i) = val - pps%lncsun(i) = val - pps%lncsha(i) = val - pps%vcmxsun(i) = val - pps%vcmxsha(i) = val - pps%gdir(i) = val - end do - - do j = 1,numrad - do fi = 1,num - i = filter(fi) - pps%omega(i,j) = val - pps%eff_kid(i,j) = val - pps%eff_kii(i,j) = val - pps%sun_faid(i,j) = val - pps%sun_faii(i,j) = val - pps%sha_faid(i,j) = val - pps%sha_faii(i,j) = val - end do - end do - -end subroutine CNSetPps -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetPepv -! -! !INTERFACE: -subroutine CNSetPepv (num, filter, val, pepv) -! -! !DESCRIPTION: -! Set pft ecophysiological variables -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (pft_epv_type), intent(inout) :: pepv -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - pepv%dormant_flag(i) = val - pepv%days_active(i) = val - pepv%onset_flag(i) = val - pepv%onset_counter(i) = val - pepv%onset_gddflag(i) = val - pepv%onset_fdd(i) = val - pepv%onset_gdd(i) = val - pepv%onset_swi(i) = val - pepv%offset_flag(i) = val - pepv%offset_counter(i) = val - pepv%offset_fdd(i) = val - pepv%offset_swi(i) = val - pepv%lgsf(i) = val - pepv%bglfr(i) = val - pepv%bgtr(i) = val - pepv%dayl(i) = val - pepv%prev_dayl(i) = val - pepv%annavg_t2m(i) = val - pepv%tempavg_t2m(i) = val - pepv%gpp(i) = val - pepv%availc(i) = val - pepv%xsmrpool_recover(i) = val - if (use_c13) then - pepv%xsmrpool_c13ratio(i) = val - end if - pepv%alloc_pnow(i) = val - pepv%c_allometry(i) = val - pepv%n_allometry(i) = val - pepv%plant_ndemand(i) = val - pepv%tempsum_potential_gpp(i) = val - pepv%annsum_potential_gpp(i) = val - pepv%tempmax_retransn(i) = val - pepv%annmax_retransn(i) = val - pepv%avail_retransn(i) = val - pepv%plant_nalloc(i) = val - pepv%plant_calloc(i) = val - pepv%excess_cflux(i) = val - pepv%downreg(i) = val - pepv%prev_leafc_to_litter(i) = val - pepv%prev_frootc_to_litter(i) = val - pepv%tempsum_npp(i) = val - pepv%annsum_npp(i) = val - if (use_cndv) then - pepv%tempsum_litfall(i) = val - pepv%annsum_litfall(i) = val - end if - end do - -end subroutine CNSetPepv -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetPcs -! -! !INTERFACE: -subroutine CNSetPcs (num, filter, val, pcs) -! -! !DESCRIPTION: -! Set pft carbon state variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (pft_cstate_type), intent(inout) :: pcs -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - pcs%leafc(i) = val - pcs%leafc_storage(i) = val - pcs%leafc_xfer(i) = val - pcs%frootc(i) = val - pcs%frootc_storage(i) = val - pcs%frootc_xfer(i) = val - pcs%livestemc(i) = val - pcs%livestemc_storage(i) = val - pcs%livestemc_xfer(i) = val - pcs%deadstemc(i) = val - pcs%deadstemc_storage(i) = val - pcs%deadstemc_xfer(i) = val - pcs%livecrootc(i) = val - pcs%livecrootc_storage(i) = val - pcs%livecrootc_xfer(i) = val - pcs%deadcrootc(i) = val - pcs%deadcrootc_storage(i) = val - pcs%deadcrootc_xfer(i) = val - pcs%gresp_storage(i) = val - pcs%gresp_xfer(i) = val - pcs%cpool(i) = val - pcs%xsmrpool(i) = val - pcs%pft_ctrunc(i) = val - pcs%dispvegc(i) = val - pcs%storvegc(i) = val - pcs%totvegc(i) = val - pcs%totpftc(i) = val - pcs%woodc(i) = val - - if ( crop_prog )then - pcs%grainc(i) = val - pcs%grainc_storage(i) = val - pcs%grainc_xfer(i) = val - end if - end do - -end subroutine CNSetPcs -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetPns -! -! !INTERFACE: -subroutine CNSetPns(num, filter, val, pns) -! -! !DESCRIPTION: -! Set pft nitrogen state variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (pft_nstate_type), intent(inout) :: pns -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - pns%leafn(i) = val - pns%leafn_storage(i) = val - pns%leafn_xfer(i) = val - pns%frootn(i) = val - pns%frootn_storage(i) = val - pns%frootn_xfer(i) = val - pns%livestemn(i) = val - pns%livestemn_storage(i) = val - pns%livestemn_xfer(i) = val - pns%deadstemn(i) = val - pns%deadstemn_storage(i) = val - pns%deadstemn_xfer(i) = val - pns%livecrootn(i) = val - pns%livecrootn_storage(i) = val - pns%livecrootn_xfer(i) = val - pns%deadcrootn(i) = val - pns%deadcrootn_storage(i) = val - pns%deadcrootn_xfer(i) = val - pns%retransn(i) = val - pns%npool(i) = val - pns%pft_ntrunc(i) = val - pns%dispvegn(i) = val - pns%storvegn(i) = val - pns%totvegn(i) = val - pns%totpftn(i) = val - if ( crop_prog )then - pns%grainn(i) = val - pns%grainn_storage(i) = val - pns%grainn_xfer(i) = val - end if - end do - -end subroutine CNSetPns -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetPcf -! -! !INTERFACE: -subroutine CNSetPcf(num, filter, val, pcf) -! -! !DESCRIPTION: -! Set pft carbon flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (pft_cflux_type), intent(inout) :: pcf -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - pcf%m_leafc_to_litter(i) = val - pcf%m_frootc_to_litter(i) = val - pcf%m_leafc_storage_to_litter(i) = val - pcf%m_frootc_storage_to_litter(i) = val - pcf%m_livestemc_storage_to_litter(i) = val - pcf%m_deadstemc_storage_to_litter(i) = val - pcf%m_livecrootc_storage_to_litter(i) = val - pcf%m_deadcrootc_storage_to_litter(i) = val - pcf%m_leafc_xfer_to_litter(i) = val - pcf%m_frootc_xfer_to_litter(i) = val - pcf%m_livestemc_xfer_to_litter(i) = val - pcf%m_deadstemc_xfer_to_litter(i) = val - pcf%m_livecrootc_xfer_to_litter(i) = val - pcf%m_deadcrootc_xfer_to_litter(i) = val - pcf%m_livestemc_to_litter(i) = val - pcf%m_deadstemc_to_litter(i) = val - pcf%m_livecrootc_to_litter(i) = val - pcf%m_deadcrootc_to_litter(i) = val - pcf%m_gresp_storage_to_litter(i) = val - pcf%m_gresp_xfer_to_litter(i) = val - pcf%hrv_leafc_to_litter(i) = val - pcf%hrv_leafc_storage_to_litter(i) = val - pcf%hrv_leafc_xfer_to_litter(i) = val - pcf%hrv_frootc_to_litter(i) = val - pcf%hrv_frootc_storage_to_litter(i) = val - pcf%hrv_frootc_xfer_to_litter(i) = val - pcf%hrv_livestemc_to_litter(i) = val - pcf%hrv_livestemc_storage_to_litter(i) = val - pcf%hrv_livestemc_xfer_to_litter(i) = val - pcf%hrv_deadstemc_to_prod10c(i) = val - pcf%hrv_deadstemc_to_prod100c(i) = val - pcf%hrv_deadstemc_storage_to_litter(i) = val - pcf%hrv_deadstemc_xfer_to_litter(i) = val - pcf%hrv_livecrootc_to_litter(i) = val - pcf%hrv_livecrootc_storage_to_litter(i) = val - pcf%hrv_livecrootc_xfer_to_litter(i) = val - pcf%hrv_deadcrootc_to_litter(i) = val - pcf%hrv_deadcrootc_storage_to_litter(i) = val - pcf%hrv_deadcrootc_xfer_to_litter(i) = val - pcf%hrv_gresp_storage_to_litter(i) = val - pcf%hrv_gresp_xfer_to_litter(i) = val - pcf%hrv_xsmrpool_to_atm(i) = val - pcf%m_leafc_to_fire(i) = val - pcf%m_frootc_to_fire(i) = val - pcf%m_leafc_storage_to_fire(i) = val - pcf%m_frootc_storage_to_fire(i) = val - pcf%m_livestemc_storage_to_fire(i) = val - pcf%m_deadstemc_storage_to_fire(i) = val - pcf%m_livecrootc_storage_to_fire(i) = val - pcf%m_deadcrootc_storage_to_fire(i) = val - pcf%m_leafc_xfer_to_fire(i) = val - pcf%m_frootc_xfer_to_fire(i) = val - pcf%m_livestemc_xfer_to_fire(i) = val - pcf%m_deadstemc_xfer_to_fire(i) = val - pcf%m_livecrootc_xfer_to_fire(i) = val - pcf%m_deadcrootc_xfer_to_fire(i) = val - pcf%m_livestemc_to_fire(i) = val - pcf%m_deadstemc_to_fire(i) = val - pcf%m_deadstemc_to_litter_fire(i) = val - pcf%m_livecrootc_to_fire(i) = val - pcf%m_deadcrootc_to_fire(i) = val - pcf%m_deadcrootc_to_litter_fire(i) = val - pcf%m_gresp_storage_to_fire(i) = val - pcf%m_gresp_xfer_to_fire(i) = val - pcf%leafc_xfer_to_leafc(i) = val - pcf%frootc_xfer_to_frootc(i) = val - pcf%livestemc_xfer_to_livestemc(i) = val - pcf%deadstemc_xfer_to_deadstemc(i) = val - pcf%livecrootc_xfer_to_livecrootc(i) = val - pcf%deadcrootc_xfer_to_deadcrootc(i) = val - pcf%leafc_to_litter(i) = val - pcf%frootc_to_litter(i) = val - pcf%leaf_mr(i) = val - pcf%froot_mr(i) = val - pcf%livestem_mr(i) = val - pcf%livecroot_mr(i) = val - pcf%leaf_curmr(i) = val - pcf%froot_curmr(i) = val - pcf%livestem_curmr(i) = val - pcf%livecroot_curmr(i) = val - pcf%leaf_xsmr(i) = val - pcf%froot_xsmr(i) = val - pcf%livestem_xsmr(i) = val - pcf%livecroot_xsmr(i) = val - pcf%psnsun_to_cpool(i) = val - pcf%psnshade_to_cpool(i) = val - pcf%cpool_to_xsmrpool(i) = val - pcf%cpool_to_leafc(i) = val - pcf%cpool_to_leafc_storage(i) = val - pcf%cpool_to_frootc(i) = val - pcf%cpool_to_frootc_storage(i) = val - pcf%cpool_to_livestemc(i) = val - pcf%cpool_to_livestemc_storage(i) = val - pcf%cpool_to_deadstemc(i) = val - pcf%cpool_to_deadstemc_storage(i) = val - pcf%cpool_to_livecrootc(i) = val - pcf%cpool_to_livecrootc_storage(i) = val - pcf%cpool_to_deadcrootc(i) = val - pcf%cpool_to_deadcrootc_storage(i) = val - pcf%cpool_to_gresp_storage(i) = val - pcf%cpool_leaf_gr(i) = val - pcf%cpool_leaf_storage_gr(i) = val - pcf%transfer_leaf_gr(i) = val - pcf%cpool_froot_gr(i) = val - pcf%cpool_froot_storage_gr(i) = val - pcf%transfer_froot_gr(i) = val - pcf%cpool_livestem_gr(i) = val - pcf%cpool_livestem_storage_gr(i) = val - pcf%transfer_livestem_gr(i) = val - pcf%cpool_deadstem_gr(i) = val - pcf%cpool_deadstem_storage_gr(i) = val - pcf%transfer_deadstem_gr(i) = val - pcf%cpool_livecroot_gr(i) = val - pcf%cpool_livecroot_storage_gr(i) = val - pcf%transfer_livecroot_gr(i) = val - pcf%cpool_deadcroot_gr(i) = val - pcf%cpool_deadcroot_storage_gr(i) = val - pcf%transfer_deadcroot_gr(i) = val - pcf%leafc_storage_to_xfer(i) = val - pcf%frootc_storage_to_xfer(i) = val - pcf%livestemc_storage_to_xfer(i) = val - pcf%deadstemc_storage_to_xfer(i) = val - pcf%livecrootc_storage_to_xfer(i) = val - pcf%deadcrootc_storage_to_xfer(i) = val - pcf%gresp_storage_to_xfer(i) = val - pcf%livestemc_to_deadstemc(i) = val - pcf%livecrootc_to_deadcrootc(i) = val - pcf%gpp(i) = val - pcf%mr(i) = val - pcf%current_gr(i) = val - pcf%transfer_gr(i) = val - pcf%storage_gr(i) = val - pcf%gr(i) = val - pcf%ar(i) = val - pcf%rr(i) = val - pcf%npp(i) = val - pcf%agnpp(i) = val - pcf%bgnpp(i) = val - pcf%litfall(i) = val - pcf%vegfire(i) = val - pcf%wood_harvestc(i) = val - pcf%pft_cinputs(i) = val - pcf%pft_coutputs(i) = val - pcf%pft_fire_closs(i) = val - pcf%frootc_alloc(i) = val - pcf%frootc_loss(i) = val - pcf%leafc_alloc(i) = val - pcf%leafc_loss(i) = val - pcf%woodc_alloc(i) = val - pcf%woodc_loss(i) = val - if ( crop_prog )then - pcf%xsmrpool_to_atm(i) = val - pcf%livestemc_to_litter(i) = val - pcf%grainc_to_food(i) = val - pcf%grainc_xfer_to_grainc(i) = val - pcf%cpool_to_grainc(i) = val - pcf%cpool_to_grainc_storage(i) = val - pcf%cpool_grain_gr(i) = val - pcf%cpool_grain_storage_gr(i) = val - pcf%transfer_grain_gr(i) = val - pcf%grainc_storage_to_xfer(i) = val - end if - end do - -end subroutine CNSetPcf -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetPnf -! -! !INTERFACE: -subroutine CNSetPnf(num, filter, val, pnf) -! -! !DESCRIPTION: -! Set pft nitrogen flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (pft_nflux_type), intent(inout) :: pnf -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i=filter(fi) - pnf%m_leafn_to_litter(i) = val - pnf%m_frootn_to_litter(i) = val - pnf%m_leafn_storage_to_litter(i) = val - pnf%m_frootn_storage_to_litter(i) = val - pnf%m_livestemn_storage_to_litter(i) = val - pnf%m_deadstemn_storage_to_litter(i) = val - pnf%m_livecrootn_storage_to_litter(i) = val - pnf%m_deadcrootn_storage_to_litter(i) = val - pnf%m_leafn_xfer_to_litter(i) = val - pnf%m_frootn_xfer_to_litter(i) = val - pnf%m_livestemn_xfer_to_litter(i) = val - pnf%m_deadstemn_xfer_to_litter(i) = val - pnf%m_livecrootn_xfer_to_litter(i) = val - pnf%m_deadcrootn_xfer_to_litter(i) = val - pnf%m_livestemn_to_litter(i) = val - pnf%m_deadstemn_to_litter(i) = val - pnf%m_livecrootn_to_litter(i) = val - pnf%m_deadcrootn_to_litter(i) = val - pnf%m_retransn_to_litter(i) = val - pnf%hrv_leafn_to_litter(i) = val - pnf%hrv_frootn_to_litter(i) = val - pnf%hrv_leafn_storage_to_litter(i) = val - pnf%hrv_frootn_storage_to_litter(i) = val - pnf%hrv_livestemn_storage_to_litter(i) = val - pnf%hrv_deadstemn_storage_to_litter(i) = val - pnf%hrv_livecrootn_storage_to_litter(i) = val - pnf%hrv_deadcrootn_storage_to_litter(i) = val - pnf%hrv_leafn_xfer_to_litter(i) = val - pnf%hrv_frootn_xfer_to_litter(i) = val - pnf%hrv_livestemn_xfer_to_litter(i) = val - pnf%hrv_deadstemn_xfer_to_litter(i) = val - pnf%hrv_livecrootn_xfer_to_litter(i) = val - pnf%hrv_deadcrootn_xfer_to_litter(i) = val - pnf%hrv_livestemn_to_litter(i) = val - pnf%hrv_deadstemn_to_prod10n(i) = val - pnf%hrv_deadstemn_to_prod100n(i) = val - pnf%hrv_livecrootn_to_litter(i) = val - pnf%hrv_deadcrootn_to_litter(i) = val - pnf%hrv_retransn_to_litter(i) = val - pnf%m_leafn_to_fire(i) = val - pnf%m_frootn_to_fire(i) = val - pnf%m_leafn_storage_to_fire(i) = val - pnf%m_frootn_storage_to_fire(i) = val - pnf%m_livestemn_storage_to_fire(i) = val - pnf%m_deadstemn_storage_to_fire(i) = val - pnf%m_livecrootn_storage_to_fire(i) = val - pnf%m_deadcrootn_storage_to_fire(i) = val - pnf%m_leafn_xfer_to_fire(i) = val - pnf%m_frootn_xfer_to_fire(i) = val - pnf%m_livestemn_xfer_to_fire(i) = val - pnf%m_deadstemn_xfer_to_fire(i) = val - pnf%m_livecrootn_xfer_to_fire(i) = val - pnf%m_deadcrootn_xfer_to_fire(i) = val - pnf%m_livestemn_to_fire(i) = val - pnf%m_deadstemn_to_fire(i) = val - pnf%m_deadstemn_to_litter_fire(i) = val - pnf%m_livecrootn_to_fire(i) = val - pnf%m_deadcrootn_to_fire(i) = val - pnf%m_deadcrootn_to_litter_fire(i) = val - pnf%m_retransn_to_fire(i) = val - pnf%leafn_xfer_to_leafn(i) = val - pnf%frootn_xfer_to_frootn(i) = val - pnf%livestemn_xfer_to_livestemn(i) = val - pnf%deadstemn_xfer_to_deadstemn(i) = val - pnf%livecrootn_xfer_to_livecrootn(i) = val - pnf%deadcrootn_xfer_to_deadcrootn(i) = val - pnf%leafn_to_litter(i) = val - pnf%leafn_to_retransn(i) = val - pnf%frootn_to_litter(i) = val - pnf%retransn_to_npool(i) = val - pnf%sminn_to_npool(i) = val - pnf%npool_to_leafn(i) = val - pnf%npool_to_leafn_storage(i) = val - pnf%npool_to_frootn(i) = val - pnf%npool_to_frootn_storage(i) = val - pnf%npool_to_livestemn(i) = val - pnf%npool_to_livestemn_storage(i) = val - pnf%npool_to_deadstemn(i) = val - pnf%npool_to_deadstemn_storage(i) = val - pnf%npool_to_livecrootn(i) = val - pnf%npool_to_livecrootn_storage(i) = val - pnf%npool_to_deadcrootn(i) = val - pnf%npool_to_deadcrootn_storage(i) = val - pnf%leafn_storage_to_xfer(i) = val - pnf%frootn_storage_to_xfer(i) = val - pnf%livestemn_storage_to_xfer(i) = val - pnf%deadstemn_storage_to_xfer(i) = val - pnf%livecrootn_storage_to_xfer(i) = val - pnf%deadcrootn_storage_to_xfer(i) = val - pnf%livestemn_to_deadstemn(i) = val - pnf%livestemn_to_retransn(i) = val - pnf%livecrootn_to_deadcrootn(i) = val - pnf%livecrootn_to_retransn(i) = val - pnf%ndeploy(i) = val - pnf%pft_ninputs(i) = val - pnf%pft_noutputs(i) = val - pnf%wood_harvestn(i) = val - pnf%pft_fire_nloss(i) = val - if ( crop_prog )then - pnf%livestemn_to_litter(i) = val - pnf%grainn_to_food(i) = val - pnf%grainn_xfer_to_grainn(i) = val - pnf%npool_to_grainn(i) = val - pnf%npool_to_grainn_storage(i) = val - pnf%grainn_storage_to_xfer(i) = val - end if - end do - -end subroutine CNSetPnf -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetCps -! -! !INTERFACE: -subroutine CNSetCps(num, filter, val, cps) -! -! !DESCRIPTION: -! Set column physical state variables -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (column_pstate_type), intent(inout) :: cps -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i,j ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - cps%decl(i) = val - cps%coszen(i) = val - cps%fpi(i) = val - cps%fpg(i) = val - cps%annsum_counter(i) = val - cps%cannsum_npp(i) = val - cps%cannavg_t2m(i) = val - cps%wf(i) = val - cps%me(i) = val - cps%fire_prob(i) = val - cps%mean_fire_prob(i) = val - cps%fireseasonl(i) = val - cps%farea_burned(i) = val - cps%ann_farea_burned(i) = val - end do - - do j = 1,nlevgrnd - do fi = 1,num - i = filter(fi) - cps%bsw2(i,j) = val - cps%psisat(i,j) = val - cps%vwcsat(i,j) = val - cps%soilpsi(i,j) = val - end do - end do - -end subroutine CNSetCps -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetCcs -! -! !INTERFACE: -subroutine CNSetCcs(num, filter, val, ccs) -! -! !DESCRIPTION: -! Set column carbon state variables -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (column_cstate_type), intent(inout) :: ccs -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - ccs%cwdc(i) = val - ccs%litr1c(i) = val - ccs%litr2c(i) = val - ccs%litr3c(i) = val - ccs%soil1c(i) = val - ccs%soil2c(i) = val - ccs%soil3c(i) = val - ccs%soil4c(i) = val - ccs%col_ctrunc(i) = val - ccs%totlitc(i) = val - ccs%totsomc(i) = val - ccs%totecosysc(i) = val - ccs%totcolc(i) = val - - end do - -end subroutine CNSetCcs -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetCns -! -! !INTERFACE: -subroutine CNSetCns(num, filter, val, cns) -! -! !DESCRIPTION: -! Set column nitrogen state variables -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (column_nstate_type), intent(inout) :: cns -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - cns%cwdn(i) = val - cns%litr1n(i) = val - cns%litr2n(i) = val - cns%litr3n(i) = val - cns%soil1n(i) = val - cns%soil2n(i) = val - cns%soil3n(i) = val - cns%soil4n(i) = val - cns%sminn(i) = val - cns%col_ntrunc(i) = val - cns%totlitn(i) = val - cns%totsomn(i) = val - cns%totecosysn(i) = val - cns%totcoln(i) = val - end do - -end subroutine CNSetCns -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetCcf -! -! !INTERFACE: -subroutine CNSetCcf(num, filter, val, ccf) -! -! !DESCRIPTION: -! Set column carbon flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (column_cflux_type), intent(inout) :: ccf -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - ccf%m_leafc_to_litr1c(i) = val - ccf%m_leafc_to_litr2c(i) = val - ccf%m_leafc_to_litr3c(i) = val - ccf%m_frootc_to_litr1c(i) = val - ccf%m_frootc_to_litr2c(i) = val - ccf%m_frootc_to_litr3c(i) = val - ccf%m_leafc_storage_to_litr1c(i) = val - ccf%m_frootc_storage_to_litr1c(i) = val - ccf%m_livestemc_storage_to_litr1c(i) = val - ccf%m_deadstemc_storage_to_litr1c(i) = val - ccf%m_livecrootc_storage_to_litr1c(i) = val - ccf%m_deadcrootc_storage_to_litr1c(i) = val - ccf%m_leafc_xfer_to_litr1c(i) = val - ccf%m_frootc_xfer_to_litr1c(i) = val - ccf%m_livestemc_xfer_to_litr1c(i) = val - ccf%m_deadstemc_xfer_to_litr1c(i) = val - ccf%m_livecrootc_xfer_to_litr1c(i) = val - ccf%m_deadcrootc_xfer_to_litr1c(i) = val - ccf%m_livestemc_to_cwdc(i) = val - ccf%m_deadstemc_to_cwdc(i) = val - ccf%m_livecrootc_to_cwdc(i) = val - ccf%m_deadcrootc_to_cwdc(i) = val - ccf%m_gresp_storage_to_litr1c(i) = val - ccf%m_gresp_xfer_to_litr1c(i) = val - ccf%hrv_leafc_to_litr1c(i) = val - ccf%hrv_leafc_to_litr2c(i) = val - ccf%hrv_leafc_to_litr3c(i) = val - ccf%hrv_frootc_to_litr1c(i) = val - ccf%hrv_frootc_to_litr2c(i) = val - ccf%hrv_frootc_to_litr3c(i) = val - ccf%hrv_livestemc_to_cwdc(i) = val - ccf%hrv_deadstemc_to_prod10c(i) = val - ccf%hrv_deadstemc_to_prod100c(i) = val - ccf%hrv_livecrootc_to_cwdc(i) = val - ccf%hrv_deadcrootc_to_cwdc(i) = val - ccf%hrv_leafc_storage_to_litr1c(i) = val - ccf%hrv_frootc_storage_to_litr1c(i) = val - ccf%hrv_livestemc_storage_to_litr1c(i) = val - ccf%hrv_deadstemc_storage_to_litr1c(i) = val - ccf%hrv_livecrootc_storage_to_litr1c(i) = val - ccf%hrv_deadcrootc_storage_to_litr1c(i) = val - if ( crop_prog )then - ccf%livestemc_to_litr1c(i) = val - ccf%livestemc_to_litr2c(i) = val - ccf%livestemc_to_litr3c(i) = val - ccf%grainc_to_litr1c(i) = val - ccf%grainc_to_litr2c(i) = val - ccf%grainc_to_litr3c(i) = val - end if - ccf%hrv_gresp_storage_to_litr1c(i) = val - ccf%hrv_leafc_xfer_to_litr1c(i) = val - ccf%hrv_frootc_xfer_to_litr1c(i) = val - ccf%hrv_livestemc_xfer_to_litr1c(i) = val - ccf%hrv_deadstemc_xfer_to_litr1c(i) = val - ccf%hrv_livecrootc_xfer_to_litr1c(i) = val - ccf%hrv_deadcrootc_xfer_to_litr1c(i) = val - ccf%hrv_gresp_xfer_to_litr1c(i) = val - ccf%m_deadstemc_to_cwdc_fire(i) = val - ccf%m_deadcrootc_to_cwdc_fire(i) = val - ccf%m_litr1c_to_fire(i) = val - ccf%m_litr2c_to_fire(i) = val - ccf%m_litr3c_to_fire(i) = val - ccf%m_cwdc_to_fire(i) = val - ccf%prod10c_loss(i) = val - ccf%prod100c_loss(i) = val - ccf%product_closs(i) = val - ccf%leafc_to_litr1c(i) = val - ccf%leafc_to_litr2c(i) = val - ccf%leafc_to_litr3c(i) = val - ccf%frootc_to_litr1c(i) = val - ccf%frootc_to_litr2c(i) = val - ccf%frootc_to_litr3c(i) = val - ccf%cwdc_to_litr2c(i) = val - ccf%cwdc_to_litr3c(i) = val - ccf%litr1_hr(i) = val - ccf%litr1c_to_soil1c(i) = val - ccf%litr2_hr(i) = val - ccf%litr2c_to_soil2c(i) = val - ccf%litr3_hr(i) = val - ccf%litr3c_to_soil3c(i) = val - ccf%soil1_hr(i) = val - ccf%soil1c_to_soil2c(i) = val - ccf%soil2_hr(i) = val - ccf%soil2c_to_soil3c(i) = val - ccf%soil3_hr(i) = val - ccf%soil3c_to_soil4c(i) = val - ccf%soil4_hr(i) = val - ccf%lithr(i) = val - ccf%somhr(i) = val - ccf%hr(i) = val - ccf%sr(i) = val - ccf%er(i) = val - ccf%litfire(i) = val - ccf%somfire(i) = val - ccf%totfire(i) = val - ccf%nep(i) = val - ccf%nbp(i) = val - ccf%nee(i) = val - ccf%col_cinputs(i) = val - ccf%col_coutputs(i) = val - ccf%col_fire_closs(i) = val - ccf%cwdc_hr(i) = val - ccf%cwdc_loss(i) = val - ccf%litterc_loss(i) = val - - end do - -end subroutine CNSetCcf -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNSetCnf -! -! !INTERFACE: -subroutine CNSetCnf(num, filter, val, cnf) -! -! !DESCRIPTION: -! Set column nitrogen flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer , intent(in) :: num - integer , intent(in) :: filter(:) - real(r8), intent(in) :: val - type (column_nflux_type), intent(inout) :: cnf -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in/out arrays -! -! !OTHER LOCAL VARIABLES: - integer :: fi,i ! loop index -!EOP -!------------------------------------------------------------------------ - - do fi = 1,num - i = filter(fi) - cnf%ndep_to_sminn(i) = val - cnf%nfix_to_sminn(i) = val - cnf%m_leafn_to_litr1n(i) = val - cnf%m_leafn_to_litr2n(i) = val - cnf%m_leafn_to_litr3n(i) = val - cnf%m_frootn_to_litr1n(i) = val - cnf%m_frootn_to_litr2n(i) = val - cnf%m_frootn_to_litr3n(i) = val - cnf%m_leafn_storage_to_litr1n(i) = val - cnf%m_frootn_storage_to_litr1n(i) = val - cnf%m_livestemn_storage_to_litr1n(i) = val - cnf%m_deadstemn_storage_to_litr1n(i) = val - cnf%m_livecrootn_storage_to_litr1n(i) = val - cnf%m_deadcrootn_storage_to_litr1n(i) = val - cnf%m_leafn_xfer_to_litr1n(i) = val - cnf%m_frootn_xfer_to_litr1n(i) = val - cnf%m_livestemn_xfer_to_litr1n(i) = val - cnf%m_deadstemn_xfer_to_litr1n(i) = val - cnf%m_livecrootn_xfer_to_litr1n(i) = val - cnf%m_deadcrootn_xfer_to_litr1n(i) = val - cnf%m_livestemn_to_cwdn(i) = val - cnf%m_deadstemn_to_cwdn(i) = val - cnf%m_livecrootn_to_cwdn(i) = val - cnf%m_deadcrootn_to_cwdn(i) = val - cnf%m_retransn_to_litr1n(i) = val - cnf%hrv_leafn_to_litr1n(i) = val - cnf%hrv_leafn_to_litr2n(i) = val - cnf%hrv_leafn_to_litr3n(i) = val - cnf%hrv_frootn_to_litr1n(i) = val - cnf%hrv_frootn_to_litr2n(i) = val - cnf%hrv_frootn_to_litr3n(i) = val - cnf%hrv_livestemn_to_cwdn(i) = val - cnf%hrv_deadstemn_to_prod10n(i) = val - cnf%hrv_deadstemn_to_prod100n(i) = val - cnf%hrv_livecrootn_to_cwdn(i) = val - cnf%hrv_deadcrootn_to_cwdn(i) = val - cnf%hrv_retransn_to_litr1n(i) = val - cnf%hrv_leafn_storage_to_litr1n(i) = val - cnf%hrv_frootn_storage_to_litr1n(i) = val - cnf%hrv_livestemn_storage_to_litr1n(i) = val - cnf%hrv_deadstemn_storage_to_litr1n(i) = val - cnf%hrv_livecrootn_storage_to_litr1n(i) = val - cnf%hrv_deadcrootn_storage_to_litr1n(i) = val - cnf%hrv_leafn_xfer_to_litr1n(i) = val - cnf%hrv_frootn_xfer_to_litr1n(i) = val - cnf%hrv_livestemn_xfer_to_litr1n(i) = val - cnf%hrv_deadstemn_xfer_to_litr1n(i) = val - cnf%hrv_livecrootn_xfer_to_litr1n(i) = val - cnf%hrv_deadcrootn_xfer_to_litr1n(i) = val - cnf%m_deadstemn_to_cwdn_fire(i) = val - cnf%m_deadcrootn_to_cwdn_fire(i) = val - cnf%m_litr1n_to_fire(i) = val - cnf%m_litr2n_to_fire(i) = val - cnf%m_litr3n_to_fire(i) = val - cnf%m_cwdn_to_fire(i) = val - cnf%prod10n_loss(i) = val - cnf%prod100n_loss(i) = val - cnf%product_nloss(i) = val - if ( crop_prog )then - cnf%grainn_to_litr1n(i) = val - cnf%grainn_to_litr2n(i) = val - cnf%grainn_to_litr3n(i) = val - cnf%livestemn_to_litr1n(i) = val - cnf%livestemn_to_litr2n(i) = val - cnf%livestemn_to_litr3n(i) = val - end if - cnf%leafn_to_litr1n(i) = val - cnf%leafn_to_litr2n(i) = val - cnf%leafn_to_litr3n(i) = val - cnf%frootn_to_litr1n(i) = val - cnf%frootn_to_litr2n(i) = val - cnf%frootn_to_litr3n(i) = val - cnf%cwdn_to_litr2n(i) = val - cnf%cwdn_to_litr3n(i) = val - cnf%litr1n_to_soil1n(i) = val - cnf%sminn_to_soil1n_l1(i) = val - cnf%litr2n_to_soil2n(i) = val - cnf%sminn_to_soil2n_l2(i) = val - cnf%litr3n_to_soil3n(i) = val - cnf%sminn_to_soil3n_l3(i) = val - cnf%soil1n_to_soil2n(i) = val - cnf%sminn_to_soil2n_s1(i) = val - cnf%soil2n_to_soil3n(i) = val - cnf%sminn_to_soil3n_s2(i) = val - cnf%soil3n_to_soil4n(i) = val - cnf%sminn_to_soil4n_s3(i) = val - cnf%soil4n_to_sminn(i) = val - cnf%sminn_to_denit_l1s1(i) = val - cnf%sminn_to_denit_l2s2(i) = val - cnf%sminn_to_denit_l3s3(i) = val - cnf%sminn_to_denit_s1s2(i) = val - cnf%sminn_to_denit_s2s3(i) = val - cnf%sminn_to_denit_s3s4(i) = val - cnf%sminn_to_denit_s4(i) = val - cnf%sminn_to_denit_excess(i) = val - cnf%sminn_leached(i) = val - cnf%potential_immob(i) = val - cnf%actual_immob(i) = val - cnf%sminn_to_plant(i) = val - cnf%supplement_to_sminn(i) = val - cnf%gross_nmin(i) = val - cnf%net_nmin(i) = val - cnf%denit(i) = val - cnf%col_ninputs(i) = val - cnf%col_noutputs(i) = val - cnf%col_fire_nloss(i) = val - end do - -end subroutine CNSetCnf -!----------------------------------------------------------------------- - -end module CNSetValueMod diff --git a/src_clm40/biogeochem/CNSummaryMod.F90 b/src_clm40/biogeochem/CNSummaryMod.F90 deleted file mode 100644 index 2a1f08a51e..0000000000 --- a/src_clm40/biogeochem/CNSummaryMod.F90 +++ /dev/null @@ -1,1402 +0,0 @@ -module CNSummaryMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNSummaryMod -! -! !DESCRIPTION: -! Module for carbon and nitrogen summary calculations -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use pftvarcon , only: npcropmin, nc3crop - use surfrdMod , only: crop_prog - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CSummary - public :: NSummary -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CSummary -! -! !INTERFACE: -subroutine CSummary(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, perform pft and column-level carbon -! summary calculations -! -! !USES: - use clmtype - use pft2colMod, only: p2c - use clm_varctl, only: iulog, use_cndv - use shr_sys_mod, only: shr_sys_flush -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 12/9/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: col_fire_closs(:) ! (gC/m2/s) total column-level fire C loss - real(r8), pointer :: er(:) ! (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - real(r8), pointer :: hr(:) ! (gC/m2/s) total heterotrophic respiration - real(r8), pointer :: litfire(:) ! (gC/m2/s) litter fire losses - real(r8), pointer :: lithr(:) ! (gC/m2/s) litter heterotrophic respiration - real(r8), pointer :: litr1_hr(:) - real(r8), pointer :: litr2_hr(:) - real(r8), pointer :: litr3_hr(:) - real(r8), pointer :: m_cwdc_to_fire(:) - real(r8), pointer :: m_litr1c_to_fire(:) - real(r8), pointer :: m_litr2c_to_fire(:) - real(r8), pointer :: m_litr3c_to_fire(:) - real(r8), pointer :: nee(:) ! (gC/m2/s) net ecosystem exchange of carbon, includes fire, land-use, harvest, and hrv_xsmrpool flux, positive for source - real(r8), pointer :: nep(:) ! (gC/m2/s) net ecosystem production, excludes fire, land-use, and harvest flux, positive for sink - real(r8), pointer :: nbp(:) ! (gC/m2/s) net biome production, includes fire, land-use, and harvest flux, positive for sink - real(r8), pointer :: col_ar(:) ! (gC/m2/s) autotrophic respiration (MR + GR) - real(r8), pointer :: col_gpp(:) ! GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: col_npp(:) ! (gC/m2/s) net primary production - real(r8), pointer :: col_pft_fire_closs(:) ! (gC/m2/s) total pft-level fire C loss - real(r8), pointer :: col_litfall(:) ! (gC/m2/s) total pft-level litterfall C loss - real(r8), pointer :: col_rr(:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: col_vegfire(:) ! (gC/m2/s) pft-level fire loss (obsolete, mark for removal) - real(r8), pointer :: col_wood_harvestc(:) - real(r8), pointer :: soil1_hr(:) - real(r8), pointer :: soil2_hr(:) - real(r8), pointer :: soil3_hr(:) - real(r8), pointer :: soil4_hr(:) - real(r8), pointer :: somfire(:) ! (gC/m2/s) soil organic matter fire losses - real(r8), pointer :: somhr(:) ! (gC/m2/s) soil organic matter heterotrophic respiration - real(r8), pointer :: sr(:) ! (gC/m2/s) total soil respiration (HR + root resp) - real(r8), pointer :: totfire(:) ! (gC/m2/s) total ecosystem fire losses - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: col_totpftc(:) ! (gC/m2) total pft-level carbon, including cpool - real(r8), pointer :: col_totvegc(:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - real(r8), pointer :: totcolc(:) ! (gC/m2) total column carbon, incl veg and cpool - real(r8), pointer :: totecosysc(:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool - real(r8), pointer :: totlitc(:) ! (gC/m2) total litter carbon - real(r8), pointer :: totsomc(:) ! (gC/m2) total soil organic matter carbon - real(r8), pointer :: agnpp(:) ! (gC/m2/s) aboveground NPP - real(r8), pointer :: ar(:) ! (gC/m2/s) autotrophic respiration (MR + GR) - real(r8), pointer :: bgnpp(:) ! (gC/m2/s) belowground NPP - real(r8), pointer :: xsmrpool_to_atm(:) ! excess MR pool harvest mortality (gC/m2/s) - real(r8), pointer :: cpool_grain_gr(:) ! grain growth respiration (gC/m2/s) - real(r8), pointer :: cpool_grain_storage_gr(:) ! grain growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_to_grainc(:) ! allocation to grain C storage (gC/m2/s) - real(r8), pointer :: grainc_xfer_to_grainc(:) ! grain C growth from storage (gC/m2/s) - real(r8), pointer :: transfer_grain_gr(:) ! grain growth respiration from storage (gC/m2/s) - real(r8), pointer :: grainc_to_food(:) ! grain C to food (gC/m2/s) - real(r8), pointer :: livestemc_to_litter(:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc(:) ! (gC/m2) grain C - real(r8), pointer :: grainc_storage(:) ! (gC/m2) grain C storage - real(r8), pointer :: grainc_xfer(:) ! (gC/m2) grain C transfer - real(r8), pointer :: cpool_deadcroot_gr(:) ! dead coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_storage_gr(:) ! dead coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_deadstem_gr(:) ! dead stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadstem_storage_gr(:) ! dead stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_froot_gr(:) ! fine root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_froot_storage_gr(:) ! fine root growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_leaf_gr(:) ! leaf growth respiration (gC/m2/s) - real(r8), pointer :: cpool_leaf_storage_gr(:) ! leaf growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_livecroot_gr(:) ! live coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livecroot_storage_gr(:) ! live coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_livestem_gr(:) ! live stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livestem_storage_gr(:) ! live stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc(:) ! allocation to dead coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc(:) ! allocation to dead stem C (gC/m2/s) - real(r8), pointer :: cpool_to_frootc(:) ! allocation to fine root C (gC/m2/s) - real(r8), pointer :: cpool_to_leafc(:) ! allocation to leaf C (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc(:) ! allocation to live coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc(:) ! allocation to live stem C (gC/m2/s) - real(r8), pointer :: current_gr(:) ! (gC/m2/s) growth resp for new growth displayed in this timestep - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) - real(r8), pointer :: frootc_to_litter(:) - real(r8), pointer :: frootc_xfer_to_frootc(:) - real(r8), pointer :: froot_mr(:) - real(r8), pointer :: gpp(:) !GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: gr(:) ! (gC/m2/s) total growth respiration - real(r8), pointer :: leafc_to_litter(:) - real(r8), pointer :: leafc_xfer_to_leafc(:) - real(r8), pointer :: leaf_mr(:) - real(r8), pointer :: litfall(:) ! (gC/m2/s) litterfall (leaves and fine roots) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) - real(r8), pointer :: livecroot_mr(:) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) - real(r8), pointer :: livestem_mr(:) - real(r8), pointer :: m_deadcrootc_storage_to_fire(:) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_fire(:) - real(r8), pointer :: m_deadcrootc_to_litter(:) - real(r8), pointer :: m_deadcrootc_to_litter_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_fire(:) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: m_deadstemc_storage_to_fire(:) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) - real(r8), pointer :: m_deadstemc_to_fire(:) - real(r8), pointer :: m_deadstemc_to_litter(:) - real(r8), pointer :: m_deadstemc_to_litter_fire(:) - real(r8), pointer :: m_deadstemc_xfer_to_fire(:) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) - real(r8), pointer :: m_frootc_storage_to_fire(:) - real(r8), pointer :: m_frootc_storage_to_litter(:) - real(r8), pointer :: m_frootc_to_fire(:) - real(r8), pointer :: m_frootc_to_litter(:) - real(r8), pointer :: m_frootc_xfer_to_fire(:) - real(r8), pointer :: m_frootc_xfer_to_litter(:) - real(r8), pointer :: m_gresp_storage_to_fire(:) - real(r8), pointer :: m_gresp_storage_to_litter(:) - real(r8), pointer :: m_gresp_xfer_to_fire(:) - real(r8), pointer :: m_gresp_xfer_to_litter(:) - real(r8), pointer :: m_leafc_storage_to_fire(:) - real(r8), pointer :: m_leafc_storage_to_litter(:) - real(r8), pointer :: m_leafc_to_fire(:) - real(r8), pointer :: m_leafc_to_litter(:) - real(r8), pointer :: m_leafc_xfer_to_fire(:) - real(r8), pointer :: m_leafc_xfer_to_litter(:) - real(r8), pointer :: m_livecrootc_storage_to_fire(:) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) - real(r8), pointer :: m_livecrootc_to_fire(:) - real(r8), pointer :: m_livecrootc_to_litter(:) - real(r8), pointer :: m_livecrootc_xfer_to_fire(:) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) - real(r8), pointer :: m_livestemc_storage_to_fire(:) - real(r8), pointer :: m_livestemc_storage_to_litter(:) - real(r8), pointer :: m_livestemc_to_fire(:) - real(r8), pointer :: m_livestemc_to_litter(:) - real(r8), pointer :: m_livestemc_xfer_to_fire(:) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) - real(r8), pointer :: hrv_xsmrpool_to_atm(:) - real(r8), pointer :: col_hrv_xsmrpool_to_atm(:) - real(r8), pointer :: mr(:) ! (gC/m2/s) maintenance respiration - real(r8), pointer :: npp(:) ! (gC/m2/s) net primary production - real(r8), pointer :: pft_fire_closs(:) ! (gC/m2/s) total pft-level fire C loss - real(r8), pointer :: psnshade_to_cpool(:) - real(r8), pointer :: psnsun_to_cpool(:) - real(r8), pointer :: rr(:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: storage_gr(:) ! (gC/m2/s) growth resp for growth sent to storage for later display - real(r8), pointer :: transfer_deadcroot_gr(:) - real(r8), pointer :: transfer_deadstem_gr(:) - real(r8), pointer :: transfer_froot_gr(:) - real(r8), pointer :: transfer_gr(:) ! (gC/m2/s) growth resp for transfer growth displayed in this timestep - real(r8), pointer :: transfer_leaf_gr(:) - real(r8), pointer :: transfer_livecroot_gr(:) - real(r8), pointer :: transfer_livestem_gr(:) - real(r8), pointer :: wood_harvestc(:) ! (gC/m2/s) pft-level wood harvest (to product pools) - real(r8), pointer :: vegfire(:) ! (gC/m2/s) pft-level fire loss (obsolete, mark for removal) - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: pft_ctrunc(:) ! (gC/m2) pft-level sink for C truncation - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: dispvegc(:) ! (gC/m2) displayed veg carbon, excluding storage and cpool - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: storvegc(:) ! (gC/m2) stored vegetation carbon, excluding cpool - real(r8), pointer :: totpftc(:) ! (gC/m2) total pft-level carbon, including cpool - real(r8), pointer :: totvegc(:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: tempsum_npp(:) ! temporary annual sum of NPP (gC/m2/yr) - real(r8), pointer :: tempsum_litfall(:) !temporary annual sum of litfall (gC/m2/yr) - - ! for landcover change - real(r8), pointer :: landuseflux(:) ! (gC/m2/s) dwt_closs+product_closs - real(r8), pointer :: landuptake(:) ! (gC/m2/s) nee-landuseflux - real(r8), pointer :: dwt_closs(:) ! (gC/m2/s) total carbon loss from land cover conversion - real(r8), pointer :: dwt_conv_cflux(:) ! (gC/m2/s) conversion C flux (immediate loss to atm) - real(r8), pointer :: prod10c_loss(:) ! (gC/m2/s) loss from 10-yr wood product pool - real(r8), pointer :: prod100c_loss(:) ! (gC/m2/s) loss from 100-yr wood product pool - real(r8), pointer :: product_closs(:) ! (gC/m2/s) total wood product carbon loss - real(r8), pointer :: seedc(:) ! (gC/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10c(:) ! (gC/m2) wood product C pool, 10-year lifespan - real(r8), pointer :: prod100c(:) ! (gC/m2) wood product C pool, 100-year lifespan - real(r8), pointer :: totprodc(:) ! (gC/m2) total wood product C - - real(r8), pointer :: frootc_alloc(:) ! fine root C allocation (gC/m2/s) - real(r8), pointer :: frootc_loss(:) ! fine root C loss (gC/m2/s) - real(r8), pointer :: leafc_alloc(:) ! leaf C allocation (gC/m2/s) - real(r8), pointer :: leafc_loss(:) ! leaf C loss (gC/m2/s) - real(r8), pointer :: woodc(:) ! wood C (gC/m2) - real(r8), pointer :: woodc_alloc(:) ! wood C allocation (gC/m2/s) - real(r8), pointer :: woodc_loss(:) ! wood C loss (gC/m2/s) - real(r8), pointer :: cwdc_hr(:) ! coarse woody debris C heterotrophic respiration (gC/m2/s) - real(r8), pointer :: cwdc_loss(:) ! coarse woody debris C loss (gC/m2/s) - real(r8), pointer :: litterc_loss(:) ! litter C loss (gC/m2/s) - real(r8), pointer :: litr1c_to_soil1c(:) ! litter1 C loss to soil1 (gC/m2/s) - real(r8), pointer :: litr2c_to_soil2c(:) ! litter2 C loss to soil2 (gC/m2/s) - real(r8), pointer :: litr3c_to_soil3c(:) ! litter3 C loss to soil3 (gC/m2/s) - real(r8), pointer :: cwdc_to_litr2c(:) ! cwdc C to soil2 (gC/m2/s) - real(r8), pointer :: cwdc_to_litr3c(:) ! cwdc C to soil3 (gC/m2/s) -! -! -! local pointers to implicit in/out scalars -! -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers - ivt => pft%itype - col_fire_closs => ccf%col_fire_closs - er => ccf%er - hr => ccf%hr - litfire => ccf%litfire - lithr => ccf%lithr - litr1_hr => ccf%litr1_hr - litr2_hr => ccf%litr2_hr - litr3_hr => ccf%litr3_hr - m_cwdc_to_fire => ccf%m_cwdc_to_fire - m_litr1c_to_fire => ccf%m_litr1c_to_fire - m_litr2c_to_fire => ccf%m_litr2c_to_fire - m_litr3c_to_fire => ccf%m_litr3c_to_fire - cwdc_to_litr2c => ccf%cwdc_to_litr2c - cwdc_to_litr3c => ccf%cwdc_to_litr3c - litr1c_to_soil1c => ccf%litr1c_to_soil1c - litr2c_to_soil2c => ccf%litr2c_to_soil2c - litr3c_to_soil3c => ccf%litr3c_to_soil3c - nee => ccf%nee - nep => ccf%nep - nbp => ccf%nbp - col_ar => pcf_a%ar - col_gpp => pcf_a%gpp - col_npp => pcf_a%npp - col_pft_fire_closs => pcf_a%pft_fire_closs - col_litfall => pcf_a%litfall - col_rr => pcf_a%rr - col_vegfire => pcf_a%vegfire - col_wood_harvestc => pcf_a%wood_harvestc - soil1_hr => ccf%soil1_hr - soil2_hr => ccf%soil2_hr - soil3_hr => ccf%soil3_hr - soil4_hr => ccf%soil4_hr - somfire => ccf%somfire - somhr => ccf%somhr - sr => ccf%sr - totfire => ccf%totfire - cwdc_hr => ccf%cwdc_hr - cwdc_loss => ccf%cwdc_loss - litterc_loss => ccf%litterc_loss - ! dynamic landcover pointers - dwt_closs => ccf%dwt_closs - landuseflux => ccf%landuseflux - landuptake => ccf%landuptake - dwt_conv_cflux => ccf%dwt_conv_cflux - seedc => ccs%seedc - - ! wood product pointers - prod10c_loss => ccf%prod10c_loss - prod100c_loss => ccf%prod100c_loss - product_closs => ccf%product_closs - prod10c => ccs%prod10c - prod100c => ccs%prod100c - totprodc => ccs%totprodc - - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - col_totpftc => pcs_a%totpftc - col_totvegc => pcs_a%totvegc - soil1c => ccs%soil1c - soil2c => ccs%soil2c - soil3c => ccs%soil3c - soil4c => ccs%soil4c - col_ctrunc => ccs%col_ctrunc - totcolc => ccs%totcolc - totecosysc => ccs%totecosysc - totlitc => ccs%totlitc - totsomc => ccs%totsomc - agnpp => pcf%agnpp - ar => pcf%ar - bgnpp => pcf%bgnpp - xsmrpool_to_atm => pcf%xsmrpool_to_atm - cpool_grain_gr => pcf%cpool_grain_gr - cpool_grain_storage_gr => pcf%cpool_grain_storage_gr - cpool_to_grainc => pcf%cpool_to_grainc - grainc_xfer_to_grainc => pcf%grainc_xfer_to_grainc - transfer_grain_gr => pcf%transfer_grain_gr - grainc_to_food => pcf%grainc_to_food - livestemc_to_litter => pcf%livestemc_to_litter - grainc => pcs%grainc - grainc_storage => pcs%grainc_storage - grainc_xfer => pcs%grainc_xfer - cpool_deadcroot_gr => pcf%cpool_deadcroot_gr - cpool_deadcroot_storage_gr => pcf%cpool_deadcroot_storage_gr - cpool_deadstem_gr => pcf%cpool_deadstem_gr - cpool_deadstem_storage_gr => pcf%cpool_deadstem_storage_gr - cpool_froot_gr => pcf%cpool_froot_gr - cpool_froot_storage_gr => pcf%cpool_froot_storage_gr - cpool_leaf_gr => pcf%cpool_leaf_gr - cpool_leaf_storage_gr => pcf%cpool_leaf_storage_gr - cpool_livecroot_gr => pcf%cpool_livecroot_gr - cpool_livecroot_storage_gr => pcf%cpool_livecroot_storage_gr - cpool_livestem_gr => pcf%cpool_livestem_gr - cpool_livestem_storage_gr => pcf%cpool_livestem_storage_gr - cpool_to_deadcrootc => pcf%cpool_to_deadcrootc - cpool_to_deadstemc => pcf%cpool_to_deadstemc - cpool_to_frootc => pcf%cpool_to_frootc - cpool_to_leafc => pcf%cpool_to_leafc - cpool_to_livecrootc => pcf%cpool_to_livecrootc - cpool_to_livestemc => pcf%cpool_to_livestemc - current_gr => pcf%current_gr - deadcrootc_xfer_to_deadcrootc => pcf%deadcrootc_xfer_to_deadcrootc - deadstemc_xfer_to_deadstemc => pcf%deadstemc_xfer_to_deadstemc - frootc_to_litter => pcf%frootc_to_litter - frootc_xfer_to_frootc => pcf%frootc_xfer_to_frootc - froot_mr => pcf%froot_mr - gpp => pcf%gpp - gr => pcf%gr - leafc_to_litter => pcf%leafc_to_litter - leafc_xfer_to_leafc => pcf%leafc_xfer_to_leafc - leaf_mr => pcf%leaf_mr - litfall => pcf%litfall - livecrootc_xfer_to_livecrootc => pcf%livecrootc_xfer_to_livecrootc - livecroot_mr => pcf%livecroot_mr - livestemc_xfer_to_livestemc => pcf%livestemc_xfer_to_livestemc - livestem_mr => pcf%livestem_mr - m_deadcrootc_storage_to_fire => pcf%m_deadcrootc_storage_to_fire - m_deadcrootc_storage_to_litter => pcf%m_deadcrootc_storage_to_litter - m_deadcrootc_to_fire => pcf%m_deadcrootc_to_fire - m_deadcrootc_to_litter => pcf%m_deadcrootc_to_litter - m_deadcrootc_to_litter_fire => pcf%m_deadcrootc_to_litter_fire - m_deadcrootc_xfer_to_fire => pcf%m_deadcrootc_xfer_to_fire - m_deadcrootc_xfer_to_litter => pcf%m_deadcrootc_xfer_to_litter - m_deadstemc_storage_to_fire => pcf%m_deadstemc_storage_to_fire - m_deadstemc_storage_to_litter => pcf%m_deadstemc_storage_to_litter - m_deadstemc_to_fire => pcf%m_deadstemc_to_fire - m_deadstemc_to_litter => pcf%m_deadstemc_to_litter - m_deadstemc_to_litter_fire => pcf%m_deadstemc_to_litter_fire - m_deadstemc_xfer_to_fire => pcf%m_deadstemc_xfer_to_fire - m_deadstemc_xfer_to_litter => pcf%m_deadstemc_xfer_to_litter - m_frootc_storage_to_fire => pcf%m_frootc_storage_to_fire - m_frootc_storage_to_litter => pcf%m_frootc_storage_to_litter - m_frootc_to_fire => pcf%m_frootc_to_fire - m_frootc_to_litter => pcf%m_frootc_to_litter - m_frootc_xfer_to_fire => pcf%m_frootc_xfer_to_fire - m_frootc_xfer_to_litter => pcf%m_frootc_xfer_to_litter - m_gresp_storage_to_fire => pcf%m_gresp_storage_to_fire - m_gresp_storage_to_litter => pcf%m_gresp_storage_to_litter - m_gresp_xfer_to_fire => pcf%m_gresp_xfer_to_fire - m_gresp_xfer_to_litter => pcf%m_gresp_xfer_to_litter - m_leafc_storage_to_fire => pcf%m_leafc_storage_to_fire - m_leafc_storage_to_litter => pcf%m_leafc_storage_to_litter - m_leafc_to_fire => pcf%m_leafc_to_fire - m_leafc_to_litter => pcf%m_leafc_to_litter - m_leafc_xfer_to_fire => pcf%m_leafc_xfer_to_fire - m_leafc_xfer_to_litter => pcf%m_leafc_xfer_to_litter - m_livecrootc_storage_to_fire => pcf%m_livecrootc_storage_to_fire - m_livecrootc_storage_to_litter => pcf%m_livecrootc_storage_to_litter - m_livecrootc_to_fire => pcf%m_livecrootc_to_fire - m_livecrootc_to_litter => pcf%m_livecrootc_to_litter - m_livecrootc_xfer_to_fire => pcf%m_livecrootc_xfer_to_fire - m_livecrootc_xfer_to_litter => pcf%m_livecrootc_xfer_to_litter - m_livestemc_storage_to_fire => pcf%m_livestemc_storage_to_fire - m_livestemc_storage_to_litter => pcf%m_livestemc_storage_to_litter - m_livestemc_to_fire => pcf%m_livestemc_to_fire - m_livestemc_to_litter => pcf%m_livestemc_to_litter - m_livestemc_xfer_to_fire => pcf%m_livestemc_xfer_to_fire - m_livestemc_xfer_to_litter => pcf%m_livestemc_xfer_to_litter - hrv_leafc_to_litter => pcf%hrv_leafc_to_litter - hrv_leafc_storage_to_litter => pcf%hrv_leafc_storage_to_litter - hrv_leafc_xfer_to_litter => pcf%hrv_leafc_xfer_to_litter - hrv_frootc_to_litter => pcf%hrv_frootc_to_litter - hrv_frootc_storage_to_litter => pcf%hrv_frootc_storage_to_litter - hrv_frootc_xfer_to_litter => pcf%hrv_frootc_xfer_to_litter - hrv_livestemc_to_litter => pcf%hrv_livestemc_to_litter - hrv_livestemc_storage_to_litter => pcf%hrv_livestemc_storage_to_litter - hrv_livestemc_xfer_to_litter => pcf%hrv_livestemc_xfer_to_litter - hrv_deadstemc_to_prod10c => pcf%hrv_deadstemc_to_prod10c - hrv_deadstemc_to_prod100c => pcf%hrv_deadstemc_to_prod100c - hrv_deadstemc_storage_to_litter => pcf%hrv_deadstemc_storage_to_litter - hrv_deadstemc_xfer_to_litter => pcf%hrv_deadstemc_xfer_to_litter - hrv_livecrootc_to_litter => pcf%hrv_livecrootc_to_litter - hrv_livecrootc_storage_to_litter => pcf%hrv_livecrootc_storage_to_litter - hrv_livecrootc_xfer_to_litter => pcf%hrv_livecrootc_xfer_to_litter - hrv_deadcrootc_to_litter => pcf%hrv_deadcrootc_to_litter - hrv_deadcrootc_storage_to_litter => pcf%hrv_deadcrootc_storage_to_litter - hrv_deadcrootc_xfer_to_litter => pcf%hrv_deadcrootc_xfer_to_litter - hrv_gresp_storage_to_litter => pcf%hrv_gresp_storage_to_litter - hrv_gresp_xfer_to_litter => pcf%hrv_gresp_xfer_to_litter - hrv_xsmrpool_to_atm => pcf%hrv_xsmrpool_to_atm - col_hrv_xsmrpool_to_atm => pcf_a%hrv_xsmrpool_to_atm - mr => pcf%mr - npp => pcf%npp - pft_fire_closs => pcf%pft_fire_closs - psnshade_to_cpool => pcf%psnshade_to_cpool - psnsun_to_cpool => pcf%psnsun_to_cpool - rr => pcf%rr - storage_gr => pcf%storage_gr - transfer_deadcroot_gr => pcf%transfer_deadcroot_gr - transfer_deadstem_gr => pcf%transfer_deadstem_gr - transfer_froot_gr => pcf%transfer_froot_gr - transfer_gr => pcf%transfer_gr - transfer_leaf_gr => pcf%transfer_leaf_gr - transfer_livecroot_gr => pcf%transfer_livecroot_gr - transfer_livestem_gr => pcf%transfer_livestem_gr - vegfire => pcf%vegfire - wood_harvestc => pcf%wood_harvestc - frootc_alloc => pcf%frootc_alloc - frootc_loss => pcf%frootc_loss - leafc_alloc => pcf%leafc_alloc - leafc_loss => pcf%leafc_loss - woodc_alloc => pcf%woodc_alloc - woodc_loss => pcf%woodc_loss - cpool => pcs%cpool - xsmrpool => pcs%xsmrpool - pft_ctrunc => pcs%pft_ctrunc - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - dispvegc => pcs%dispvegc - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - storvegc => pcs%storvegc - totpftc => pcs%totpftc - totvegc => pcs%totvegc - woodc => pcs%woodc - tempsum_npp => pepv%tempsum_npp - tempsum_litfall => pepv%tempsum_litfall - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! calculate pft-level summary carbon fluxes and states - - ! gross primary production (GPP) - gpp(p) = & - psnsun_to_cpool(p) + & - psnshade_to_cpool(p) - - ! maintenance respiration (MR) - mr(p) = & - leaf_mr(p) + & - froot_mr(p) + & - livestem_mr(p) + & - livecroot_mr(p) - - ! growth respiration (GR) - ! current GR is respired this time step for new growth displayed in this timestep - current_gr(p) = & - cpool_leaf_gr(p) + & - cpool_froot_gr(p) + & - cpool_livestem_gr(p) + & - cpool_deadstem_gr(p) + & - cpool_livecroot_gr(p) + & - cpool_deadcroot_gr(p) - - ! transfer GR is respired this time step for transfer growth displayed in this timestep - transfer_gr(p) = & - transfer_leaf_gr(p) + & - transfer_froot_gr(p) + & - transfer_livestem_gr(p) + & - transfer_deadstem_gr(p) + & - transfer_livecroot_gr(p) + & - transfer_deadcroot_gr(p) - - ! storage GR is respired this time step for growth sent to storage for later display - storage_gr(p) = & - cpool_leaf_storage_gr(p) + & - cpool_froot_storage_gr(p) + & - cpool_livestem_storage_gr(p) + & - cpool_deadstem_storage_gr(p) + & - cpool_livecroot_storage_gr(p) + & - cpool_deadcroot_storage_gr(p) - - ! GR is the sum of current + transfer + storage GR - gr(p) = & - current_gr(p) + & - transfer_gr(p) + & - storage_gr(p) - - ! autotrophic respiration (AR) - if ( ivt(p) >= npcropmin )then - ar(p) = mr(p) + gr(p) + xsmrpool_to_atm(p) ! xsmr... is -ve (slevis) - else - ar(p) = mr(p) + gr(p) - end if - - ! root respiration (RR) - rr(p) = & - froot_mr(p) + & - cpool_froot_gr(p) + & - cpool_livecroot_gr(p) + & - cpool_deadcroot_gr(p) + & - transfer_froot_gr(p) + & - transfer_livecroot_gr(p) + & - transfer_deadcroot_gr(p) + & - cpool_froot_storage_gr(p) + & - cpool_livecroot_storage_gr(p) + & - cpool_deadcroot_storage_gr(p) - - ! net primary production (NPP) - npp(p) = gpp(p) - ar(p) - - ! update the annual NPP accumulator, for use in allocation code - tempsum_npp(p) = tempsum_npp(p) + npp(p) - - ! aboveground NPP: leaf, live stem, dead stem (AGNPP) - ! This is supposed to correspond as closely as possible to - ! field measurements of AGNPP, so it ignores the storage pools - ! and only treats the fluxes into displayed pools. - agnpp(p) = & - cpool_to_leafc(p) + & - leafc_xfer_to_leafc(p) + & - cpool_to_livestemc(p) + & - livestemc_xfer_to_livestemc(p) + & - cpool_to_deadstemc(p) + & - deadstemc_xfer_to_deadstemc(p) - - ! belowground NPP: fine root, live coarse root, dead coarse root (BGNPP) - ! This is supposed to correspond as closely as possible to - ! field measurements of BGNPP, so it ignores the storage pools - ! and only treats the fluxes into displayed pools. - bgnpp(p) = & - cpool_to_frootc(p) + & - frootc_xfer_to_frootc(p) + & - cpool_to_livecrootc(p) + & - livecrootc_xfer_to_livecrootc(p) + & - cpool_to_deadcrootc(p) + & - deadcrootc_xfer_to_deadcrootc(p) - - ! litterfall (LITFALL) - litfall(p) = & - leafc_to_litter(p) + & - frootc_to_litter(p) + & - m_leafc_to_litter(p) + & - m_leafc_storage_to_litter(p) + & - m_leafc_xfer_to_litter(p) + & - m_frootc_to_litter(p) + & - m_frootc_storage_to_litter(p) + & - m_frootc_xfer_to_litter(p) + & - m_livestemc_to_litter(p) + & - m_livestemc_storage_to_litter(p) + & - m_livestemc_xfer_to_litter(p) + & - m_deadstemc_to_litter(p) + & - m_deadstemc_storage_to_litter(p) + & - m_deadstemc_xfer_to_litter(p) + & - m_livecrootc_to_litter(p) + & - m_livecrootc_storage_to_litter(p) + & - m_livecrootc_xfer_to_litter(p) + & - m_deadcrootc_to_litter(p) + & - m_deadcrootc_storage_to_litter(p) + & - m_deadcrootc_xfer_to_litter(p) + & - m_gresp_storage_to_litter(p) + & - m_gresp_xfer_to_litter(p) + & - m_deadstemc_to_litter_fire(p) + & - m_deadcrootc_to_litter_fire(p) + & - hrv_leafc_to_litter(p) + & - hrv_leafc_storage_to_litter(p) + & - hrv_leafc_xfer_to_litter(p) + & - hrv_frootc_to_litter(p) + & - hrv_frootc_storage_to_litter(p) + & - hrv_frootc_xfer_to_litter(p) + & - hrv_livestemc_to_litter(p) + & - hrv_livestemc_storage_to_litter(p) + & - hrv_livestemc_xfer_to_litter(p) + & - hrv_deadstemc_storage_to_litter(p) + & - hrv_deadstemc_xfer_to_litter(p) + & - hrv_livecrootc_to_litter(p) + & - hrv_livecrootc_storage_to_litter(p)+ & - hrv_livecrootc_xfer_to_litter(p) + & - hrv_deadcrootc_to_litter(p) + & - hrv_deadcrootc_storage_to_litter(p)+ & - hrv_deadcrootc_xfer_to_litter(p) + & - hrv_gresp_storage_to_litter(p) + & - hrv_gresp_xfer_to_litter(p) - - if (use_cndv) then - ! update the annual litfall accumulator, for use in mortality code - tempsum_litfall(p) = tempsum_litfall(p) + leafc_to_litter(p) + frootc_to_litter(p) - end if - - ! pft-level fire losses (VEGFIRE) - vegfire(p) = 0._r8 - - ! pft-level wood harvest - wood_harvestc(p) = & - hrv_deadstemc_to_prod10c(p) + & - hrv_deadstemc_to_prod100c(p) - - ! pft-level carbon losses to fire - pft_fire_closs(p) = & - m_leafc_to_fire(p) + & - m_leafc_storage_to_fire(p) + & - m_leafc_xfer_to_fire(p) + & - m_frootc_to_fire(p) + & - m_frootc_storage_to_fire(p) + & - m_frootc_xfer_to_fire(p) + & - m_livestemc_to_fire(p) + & - m_livestemc_storage_to_fire(p) + & - m_livestemc_xfer_to_fire(p) + & - m_deadstemc_to_fire(p) + & - m_deadstemc_storage_to_fire(p) + & - m_deadstemc_xfer_to_fire(p) + & - m_livecrootc_to_fire(p) + & - m_livecrootc_storage_to_fire(p) + & - m_livecrootc_xfer_to_fire(p) + & - m_deadcrootc_to_fire(p) + & - m_deadcrootc_storage_to_fire(p) + & - m_deadcrootc_xfer_to_fire(p) + & - m_gresp_storage_to_fire(p) + & - m_gresp_xfer_to_fire(p) - - ! displayed vegetation carbon, excluding storage and cpool (DISPVEGC) - dispvegc(p) = & - leafc(p) + & - frootc(p) + & - livestemc(p) + & - deadstemc(p) + & - livecrootc(p) + & - deadcrootc(p) - - ! stored vegetation carbon, excluding cpool (STORVEGC) - storvegc(p) = & - cpool(p) + & - leafc_storage(p) + & - frootc_storage(p) + & - livestemc_storage(p) + & - deadstemc_storage(p) + & - livecrootc_storage(p) + & - deadcrootc_storage(p) + & - leafc_xfer(p) + & - frootc_xfer(p) + & - livestemc_xfer(p) + & - deadstemc_xfer(p) + & - livecrootc_xfer(p) + & - deadcrootc_xfer(p) + & - gresp_storage(p) + & - gresp_xfer(p) - - if ( crop_prog .and. ivt(p) >= nc3crop )then - current_gr(p) = current_gr(p) + & - cpool_grain_gr(p) - storvegc(p) = storvegc(p) + & - grainc_storage(p) + & - grainc_xfer(p) - transfer_gr(p) = transfer_gr(p) + & - transfer_grain_gr(p) - storage_gr(p) = storage_gr(p) + & - cpool_grain_storage_gr(p) - agnpp(p) = agnpp(p) + & - cpool_to_grainc(p) + & - grainc_xfer_to_grainc(p) - litfall(p) = litfall(p) + & - livestemc_to_litter(p) + & - grainc_to_food(p) - dispvegc(p) = dispvegc(p) + & - grainc(p) - end if - - ! total vegetation carbon, excluding cpool (TOTVEGC) - totvegc(p) = dispvegc(p) + storvegc(p) - - ! total pft-level carbon, including xsmrpool, ctrunc - totpftc(p) = totvegc(p) + xsmrpool(p) + pft_ctrunc(p) - - ! new summary variables for CLAMP - - ! (FROOTC_ALLOC) - fine root C allocation - frootc_alloc(p) = & - frootc_xfer_to_frootc(p) + & - cpool_to_frootc(p) - - ! (FROOTC_LOSS) - fine root C loss - frootc_loss(p) = & - m_frootc_to_litter(p) + & - m_frootc_to_fire(p) + & - hrv_frootc_to_litter(p) + & - frootc_to_litter(p) - - ! (LEAFC_ALLOC) - leaf C allocation - leafc_alloc(p) = & - leafc_xfer_to_leafc(p) + & - cpool_to_leafc(p) - - ! (LEAFC_LOSS) - leaf C loss - leafc_loss(p) = & - m_leafc_to_litter(p) + & - m_leafc_to_fire(p) + & - hrv_leafc_to_litter(p) + & - leafc_to_litter(p) - - ! (WOODC) - wood C - woodc(p) = & - deadstemc(p) + & - livestemc(p) + & - deadcrootc(p) + & - livecrootc(p) - - ! (WOODC_ALLOC) - wood C allocation - woodc_alloc(p) = & - livestemc_xfer_to_livestemc(p) + & - deadstemc_xfer_to_deadstemc(p) + & - livecrootc_xfer_to_livecrootc(p) + & - deadcrootc_xfer_to_deadcrootc(p) + & - cpool_to_livestemc(p) + & - cpool_to_deadstemc(p) + & - cpool_to_livecrootc(p) + & - cpool_to_deadcrootc(p) - - ! (WOODC_LOSS) - wood C loss - woodc_loss(p) = & - m_livestemc_to_litter(p) + & - m_deadstemc_to_litter(p) + & - m_livecrootc_to_litter(p) + & - m_deadcrootc_to_litter(p) + & - m_livestemc_to_fire(p) + & - m_deadstemc_to_fire(p) + & - m_livecrootc_to_fire(p) + & - m_deadcrootc_to_fire(p) + & - hrv_livestemc_to_litter(p) + & - hrv_livestemc_storage_to_litter(p) + & - hrv_livestemc_xfer_to_litter(p) + & - hrv_deadstemc_to_prod10c(p) + & - hrv_deadstemc_to_prod100c(p) + & - hrv_deadstemc_storage_to_litter(p) + & - hrv_deadstemc_xfer_to_litter(p) + & - hrv_livecrootc_to_litter(p) + & - hrv_livecrootc_storage_to_litter(p)+ & - hrv_livecrootc_xfer_to_litter(p) + & - hrv_deadcrootc_to_litter(p) + & - hrv_deadcrootc_storage_to_litter(p)+ & - hrv_deadcrootc_xfer_to_litter(p) - - end do ! end of pfts loop - - ! use p2c routine to get selected column-average pft-level fluxes and states - call p2c(num_soilc, filter_soilc, gpp, col_gpp) - call p2c(num_soilc, filter_soilc, ar, col_ar) - call p2c(num_soilc, filter_soilc, rr, col_rr) - call p2c(num_soilc, filter_soilc, npp, col_npp) - call p2c(num_soilc, filter_soilc, vegfire, col_vegfire) - call p2c(num_soilc, filter_soilc, wood_harvestc, col_wood_harvestc) - call p2c(num_soilc, filter_soilc, totvegc, col_totvegc) - call p2c(num_soilc, filter_soilc, totpftc, col_totpftc) - call p2c(num_soilc, filter_soilc, pft_fire_closs, col_pft_fire_closs) - call p2c(num_soilc, filter_soilc, litfall, col_litfall) - call p2c(num_soilc, filter_soilc, hrv_xsmrpool_to_atm, col_hrv_xsmrpool_to_atm) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! litter heterotrophic respiration (LITHR) - lithr(c) = & - litr1_hr(c) + & - litr2_hr(c) + & - litr3_hr(c) - - ! soil organic matter heterotrophic respiration (SOMHR) - somhr(c) = & - soil1_hr(c) + & - soil2_hr(c) + & - soil3_hr(c) + & - soil4_hr(c) - - ! total heterotrophic respiration (HR) - hr(c) = lithr(c) + somhr(c) - - ! total soil respiration, heterotrophic + root respiration (SR) - sr(c) = col_rr(c) + hr(c) - - ! total ecosystem respiration, autotrophic + heterotrophic (ER) - er(c) = col_ar(c) + hr(c) - - ! litter fire losses (LITFIRE) - litfire(c) = 0._r8 - - ! total wood product loss - product_closs(c) = & - prod10c_loss(c) + & - prod100c_loss(c) - - ! soil organic matter fire losses (SOMFIRE) - somfire(c) = 0._r8 - - ! total ecosystem fire losses (TOTFIRE) - totfire(c) = & - litfire(c) + & - somfire(c) + & - col_vegfire(c) - - ! column-level carbon losses to fire, including pft losses - col_fire_closs(c) = & - m_litr1c_to_fire(c) + & - m_litr2c_to_fire(c) + & - m_litr3c_to_fire(c) + & - m_cwdc_to_fire(c) + & - col_pft_fire_closs(c) - - ! column-level carbon losses due to landcover change - dwt_closs(c) = & - dwt_conv_cflux(c) - - ! net ecosystem production, excludes fire flux, landcover change, and loss from wood products, positive for sink (NEP) - nep(c) = col_gpp(c) - er(c) - - ! net biome production of carbon, includes depletion from: fire flux, landcover change flux, and loss - ! from wood products pools, positive for sink (NBP) - nbp(c) = nep(c) - col_fire_closs(c) - dwt_closs(c) - product_closs(c) - - ! net ecosystem exchange of carbon, includes fire flux, landcover change flux, loss - ! from wood products pools, and hrv_xsmrpool flux, positive for source (NEE) - nee(c) = -nep(c) + col_fire_closs(c) + dwt_closs(c) + product_closs(c) + col_hrv_xsmrpool_to_atm(c) - ! land use flux and land uptake - landuseflux(c) = dwt_closs(c) + product_closs(c) - landuptake(c) = nee(c) - landuseflux(c) - - ! total litter carbon (TOTLITC) - totlitc(c) = & - litr1c(c) + & - litr2c(c) + & - litr3c(c) - - ! total soil organic matter carbon (TOTSOMC) - totsomc(c) = & - soil1c(c) + & - soil2c(c) + & - soil3c(c) + & - soil4c(c) - - ! total wood product carbon - totprodc(c) = & - prod10c(c) + & - prod100c(c) - - ! total ecosystem carbon, including veg but excluding cpool (TOTECOSYSC) - totecosysc(c) = & - cwdc(c) + & - totlitc(c) + & - totsomc(c) + & - totprodc(c) + & - col_totvegc(c) - - ! total column carbon, including veg and cpool (TOTCOLC) - ! adding col_ctrunc, seedc - totcolc(c) = & - col_totpftc(c) + & - cwdc(c) + & - totlitc(c) + & - totsomc(c) + & - totprodc(c) + & - seedc(c) + & - col_ctrunc(c) - - ! new summary variables for CLAMP - - ! (CWDC_HR) - coarse woody debris heterotrophic respiration - cwdc_hr(c) = 0._r8 - - ! (CWDC_LOSS) - coarse woody debris C loss - cwdc_loss(c) = & - m_cwdc_to_fire(c) + & - cwdc_to_litr2c(c) + & - cwdc_to_litr3c(c) - - ! (LITTERC_LOSS) - litter C loss - litterc_loss(c) = & - lithr(c) + & - m_litr1c_to_fire(c) + & - m_litr2c_to_fire(c) + & - m_litr3c_to_fire(c) + & - litr1c_to_soil1c(c) + & - litr2c_to_soil2c(c) + & - litr3c_to_soil3c(c) - - end do ! end of columns loop - - -end subroutine CSummary -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: NSummary -! -! !INTERFACE: -subroutine NSummary(num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, perform pft and column-level nitrogen -! summary calculations -! -! !USES: - use clmtype - use pft2colMod, only: p2c -! -! !ARGUMENTS: - implicit none - 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 pfts in filter - integer, intent(in) :: filter_soilp(:) ! filter for soil pfts -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 6/28/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: col_fire_nloss(:) ! (gN/m2/s) total column-level fire N loss - real(r8), pointer :: col_wood_harvestn(:) - real(r8), pointer :: denit(:) - real(r8), pointer :: m_cwdn_to_fire(:) - real(r8), pointer :: m_litr1n_to_fire(:) - real(r8), pointer :: m_litr2n_to_fire(:) - real(r8), pointer :: m_litr3n_to_fire(:) - real(r8), pointer :: col_pft_fire_nloss(:) ! (gN/m2/s) total pft-level fire C loss - real(r8), pointer :: sminn_to_denit_excess(:) - real(r8), pointer :: sminn_to_denit_l1s1(:) - real(r8), pointer :: sminn_to_denit_l2s2(:) - real(r8), pointer :: sminn_to_denit_l3s3(:) - real(r8), pointer :: sminn_to_denit_s1s2(:) - real(r8), pointer :: sminn_to_denit_s2s3(:) - real(r8), pointer :: sminn_to_denit_s3s4(:) - real(r8), pointer :: sminn_to_denit_s4(:) - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: col_totpftn(:) ! (gN/m2) total pft-level nitrogen - real(r8), pointer :: col_totvegn(:) ! (gN/m2) total vegetation nitrogen - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N - real(r8), pointer :: soil1n(:) ! (gN/m2) soil organic matter N (fast pool) - real(r8), pointer :: soil2n(:) ! (gN/m2) soil organic matter N (medium pool) - real(r8), pointer :: soil3n(:) ! (gN/m2) soil orgainc matter N (slow pool) - real(r8), pointer :: soil4n(:) ! (gN/m2) soil orgainc matter N (slowest pool) - real(r8), pointer :: col_ntrunc(:) ! (gN/m2) column-level sink for N truncation - real(r8), pointer :: totcoln(:) ! (gN/m2) total column nitrogen, incl veg - real(r8), pointer :: totecosysn(:) ! (gN/m2) total ecosystem nitrogen, incl veg - real(r8), pointer :: totlitn(:) ! (gN/m2) total litter nitrogen - real(r8), pointer :: totsomn(:) ! (gN/m2) total soil organic matter nitrogen - real(r8), pointer :: m_deadcrootn_storage_to_fire(:) - real(r8), pointer :: m_deadcrootn_to_fire(:) - real(r8), pointer :: m_deadcrootn_xfer_to_fire(:) - real(r8), pointer :: m_deadstemn_storage_to_fire(:) - real(r8), pointer :: m_deadstemn_to_fire(:) - real(r8), pointer :: m_deadstemn_xfer_to_fire(:) - real(r8), pointer :: m_frootn_storage_to_fire(:) - real(r8), pointer :: m_frootn_to_fire(:) - real(r8), pointer :: m_frootn_xfer_to_fire(:) - real(r8), pointer :: m_leafn_storage_to_fire(:) - real(r8), pointer :: m_leafn_to_fire(:) - real(r8), pointer :: m_leafn_xfer_to_fire(:) - real(r8), pointer :: m_livecrootn_storage_to_fire(:) - real(r8), pointer :: m_livecrootn_to_fire(:) - real(r8), pointer :: m_livecrootn_xfer_to_fire(:) - real(r8), pointer :: m_livestemn_storage_to_fire(:) - real(r8), pointer :: m_livestemn_to_fire(:) - real(r8), pointer :: m_livestemn_xfer_to_fire(:) - real(r8), pointer :: m_retransn_to_fire(:) - real(r8), pointer :: hrv_deadstemn_to_prod10n(:) - real(r8), pointer :: hrv_deadstemn_to_prod100n(:) - real(r8), pointer :: ndeploy(:) - real(r8), pointer :: pft_fire_nloss(:) ! (gN/m2/s) total pft-level fire C loss - real(r8), pointer :: retransn_to_npool(:) - real(r8), pointer :: sminn_to_npool(:) - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: dispvegn(:) ! (gN/m2) displayed veg nitrogen, excluding storage - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: grainn(:) ! (gN/m2) grain N - real(r8), pointer :: grainn_storage(:) ! (gN/m2) grain N storage - real(r8), pointer :: grainn_xfer(:) ! (gN/m2) grain N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: npool(:) ! (gN/m2) temporary plant N pool - real(r8), pointer :: pft_ntrunc(:) ! (gN/m2) pft-level sink for N truncation - real(r8), pointer :: storvegn(:) ! (gN/m2) stored vegetation nitrogen - real(r8), pointer :: totpftn(:) ! (gN/m2) total pft-level nitrogen - real(r8), pointer :: totvegn(:) ! (gN/m2) total vegetation nitrogen - ! for landcover change - real(r8), pointer :: wood_harvestn(:) ! total N losses to wood product pools (gN/m2/s) - real(r8), pointer :: dwt_nloss(:) ! (gN/m2/s) total nitrogen loss from product pools and conversion - real(r8), pointer :: dwt_conv_nflux(:) ! (gN/m2/s) conversion N flux (immediate loss to atm) - real(r8), pointer :: seedn(:) ! (gN/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10n_loss(:) ! (gN/m2/s) loss from 10-yr wood product pool - real(r8), pointer :: prod100n_loss(:) ! (gN/m2/s) loss from 100-yr wood product pool - real(r8), pointer :: product_nloss(:) ! (gN/m2/s) total wood product nitrogen loss - real(r8), pointer :: prod10n(:) ! (gN/m2) wood product N pool, 10-year lifespan - real(r8), pointer :: prod100n(:) ! (gN/m2) wood product N pool, 100-year lifespan - real(r8), pointer :: totprodn(:) ! (gN/m2) total wood product N -! -! local pointers to implicit in/out scalars -! -! local pointers to implicit out scalars -! -! !OTHER LOCAL VARIABLES: - integer :: c,p ! indices - integer :: fp,fc ! lake filter indices - -!EOP -!----------------------------------------------------------------------- - ! assign local pointers - ivt => pft%itype - col_fire_nloss => cnf%col_fire_nloss - denit => cnf%denit - m_cwdn_to_fire => cnf%m_cwdn_to_fire - m_litr1n_to_fire => cnf%m_litr1n_to_fire - m_litr2n_to_fire => cnf%m_litr2n_to_fire - m_litr3n_to_fire => cnf%m_litr3n_to_fire - col_pft_fire_nloss => pnf_a%pft_fire_nloss - sminn_to_denit_excess => cnf%sminn_to_denit_excess - sminn_to_denit_l1s1 => cnf%sminn_to_denit_l1s1 - sminn_to_denit_l2s2 => cnf%sminn_to_denit_l2s2 - sminn_to_denit_l3s3 => cnf%sminn_to_denit_l3s3 - sminn_to_denit_s1s2 => cnf%sminn_to_denit_s1s2 - sminn_to_denit_s2s3 => cnf%sminn_to_denit_s2s3 - sminn_to_denit_s3s4 => cnf%sminn_to_denit_s3s4 - sminn_to_denit_s4 => cnf%sminn_to_denit_s4 - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - col_totpftn => pns_a%totpftn - col_totvegn => pns_a%totvegn - sminn => cns%sminn - col_ntrunc => cns%col_ntrunc - soil1n => cns%soil1n - soil2n => cns%soil2n - soil3n => cns%soil3n - soil4n => cns%soil4n - totcoln => cns%totcoln - totecosysn => cns%totecosysn - totlitn => cns%totlitn - totsomn => cns%totsomn - m_deadcrootn_storage_to_fire => pnf%m_deadcrootn_storage_to_fire - m_deadcrootn_to_fire => pnf%m_deadcrootn_to_fire - m_deadcrootn_xfer_to_fire => pnf%m_deadcrootn_xfer_to_fire - m_deadstemn_storage_to_fire => pnf%m_deadstemn_storage_to_fire - m_deadstemn_to_fire => pnf%m_deadstemn_to_fire - m_deadstemn_xfer_to_fire => pnf%m_deadstemn_xfer_to_fire - m_frootn_storage_to_fire => pnf%m_frootn_storage_to_fire - m_frootn_to_fire => pnf%m_frootn_to_fire - m_frootn_xfer_to_fire => pnf%m_frootn_xfer_to_fire - m_leafn_storage_to_fire => pnf%m_leafn_storage_to_fire - m_leafn_to_fire => pnf%m_leafn_to_fire - m_leafn_xfer_to_fire => pnf%m_leafn_xfer_to_fire - m_livecrootn_storage_to_fire => pnf%m_livecrootn_storage_to_fire - m_livecrootn_to_fire => pnf%m_livecrootn_to_fire - m_livecrootn_xfer_to_fire => pnf%m_livecrootn_xfer_to_fire - m_livestemn_storage_to_fire => pnf%m_livestemn_storage_to_fire - m_livestemn_to_fire => pnf%m_livestemn_to_fire - m_livestemn_xfer_to_fire => pnf%m_livestemn_xfer_to_fire - m_retransn_to_fire => pnf%m_retransn_to_fire - hrv_deadstemn_to_prod10n => pnf%hrv_deadstemn_to_prod10n - hrv_deadstemn_to_prod100n => pnf%hrv_deadstemn_to_prod100n - ndeploy => pnf%ndeploy - pft_fire_nloss => pnf%pft_fire_nloss - retransn_to_npool => pnf%retransn_to_npool - sminn_to_npool => pnf%sminn_to_npool - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - dispvegn => pns%dispvegn - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - grainn => pns%grainn - grainn_storage => pns%grainn_storage - grainn_xfer => pns%grainn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - retransn => pns%retransn - npool => pns%npool - pft_ntrunc => pns%pft_ntrunc - storvegn => pns%storvegn - totpftn => pns%totpftn - totvegn => pns%totvegn - ! dynamic landcover pointers - wood_harvestn => pnf%wood_harvestn - col_wood_harvestn => pnf_a%wood_harvestn - dwt_nloss => cnf%dwt_nloss - dwt_conv_nflux => cnf%dwt_conv_nflux - prod10n_loss => cnf%prod10n_loss - prod100n_loss => cnf%prod100n_loss - product_nloss => cnf%product_nloss - seedn => cns%seedn - prod10n => cns%prod10n - prod100n => cns%prod100n - totprodn => cns%totprodn - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - - ! calculate pft-level summary nitrogen fluxes and states - - ! total N deployment (from sminn and retranslocated N pool) (NDEPLOY) - ndeploy(p) = & - sminn_to_npool(p) + & - retransn_to_npool(p) - - ! pft-level wood harvest - wood_harvestn(p) = & - hrv_deadstemn_to_prod10n(p) + & - hrv_deadstemn_to_prod100n(p) - - ! total pft-level fire N losses - pft_fire_nloss(p) = & - m_leafn_to_fire(p) + & - m_leafn_storage_to_fire(p) + & - m_leafn_xfer_to_fire(p) + & - m_frootn_to_fire(p) + & - m_frootn_storage_to_fire(p) + & - m_frootn_xfer_to_fire(p) + & - m_livestemn_to_fire(p) + & - m_livestemn_storage_to_fire(p) + & - m_livestemn_xfer_to_fire(p) + & - m_deadstemn_to_fire(p) + & - m_deadstemn_storage_to_fire(p) + & - m_deadstemn_xfer_to_fire(p) + & - m_livecrootn_to_fire(p) + & - m_livecrootn_storage_to_fire(p) + & - m_livecrootn_xfer_to_fire(p) + & - m_deadcrootn_to_fire(p) + & - m_deadcrootn_storage_to_fire(p) + & - m_deadcrootn_xfer_to_fire(p) + & - m_retransn_to_fire(p) - - ! displayed vegetation nitrogen, excluding storage (DISPVEGN) - dispvegn(p) = & - leafn(p) + & - frootn(p) + & - livestemn(p) + & - deadstemn(p) + & - livecrootn(p) + & - deadcrootn(p) - - ! stored vegetation nitrogen, including retranslocated N pool (STORVEGN) - storvegn(p) = & - leafn_storage(p) + & - frootn_storage(p) + & - livestemn_storage(p) + & - deadstemn_storage(p) + & - livecrootn_storage(p) + & - deadcrootn_storage(p) + & - leafn_xfer(p) + & - frootn_xfer(p) + & - livestemn_xfer(p) + & - deadstemn_xfer(p) + & - livecrootn_xfer(p) + & - deadcrootn_xfer(p) + & - npool(p) + & - retransn(p) - - if ( crop_prog .and. ivt(p) >= nc3crop )then - dispvegn(p) = dispvegn(p) + & - grainn(p) - storvegn(p) = storvegn(p) + & - grainn_storage(p) + & - grainn_xfer(p) - end if - - ! total vegetation nitrogen (TOTVEGN) - totvegn(p) = dispvegn(p) + storvegn(p) - - ! total pft-level carbon (add pft_ntrunc) - totpftn(p) = totvegn(p) + pft_ntrunc(p) - - - end do ! end of pfts loop - - ! use p2c routine to get selected column-average pft-level fluxes and states - call p2c(num_soilc, filter_soilc, pft_fire_nloss, col_pft_fire_nloss) - call p2c(num_soilc, filter_soilc, wood_harvestn, col_wood_harvestn) - call p2c(num_soilc, filter_soilc, totvegn, col_totvegn) - call p2c(num_soilc, filter_soilc, totpftn, col_totpftn) - - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! total N denitrification (DENIT) - denit(c) = & - sminn_to_denit_l1s1(c) + & - sminn_to_denit_l2s2(c) + & - sminn_to_denit_l3s3(c) + & - sminn_to_denit_s1s2(c) + & - sminn_to_denit_s2s3(c) + & - sminn_to_denit_s3s4(c) + & - sminn_to_denit_s4(c) + & - sminn_to_denit_excess(c) - - ! total column-level fire N losses - col_fire_nloss(c) = & - m_litr1n_to_fire(c) + & - m_litr2n_to_fire(c) + & - m_litr3n_to_fire(c) + & - m_cwdn_to_fire(c) + & - col_pft_fire_nloss(c) - - ! column-level N losses due to landcover change - dwt_nloss(c) = & - dwt_conv_nflux(c) - - ! total wood product N loss - product_nloss(c) = & - prod10n_loss(c) + & - prod100n_loss(c) - - ! total litter nitrogen (TOTLITN) - totlitn(c) = & - litr1n(c) + & - litr2n(c) + & - litr3n(c) - - ! total soil organic matter nitrogen (TOTSOMN) - totsomn(c) = & - soil1n(c) + & - soil2n(c) + & - soil3n(c) + & - soil4n(c) - - ! total wood product nitrogen - totprodn(c) = & - prod10n(c) + & - prod100n(c) - - ! total ecosystem nitrogen, including veg (TOTECOSYSN) - totecosysn(c) = & - cwdn(c) + & - totlitn(c) + & - totsomn(c) + & - sminn(c) + & - totprodn(c) + & - col_totvegn(c) - - ! total column nitrogen, including pft (TOTCOLN) - totcoln(c) = & - col_totpftn(c) + & - cwdn(c) + & - totlitn(c) + & - totsomn(c) + & - sminn(c) + & - totprodn(c) + & - seedn(c) + & - col_ntrunc(c) - - end do ! end of columns loop - - -end subroutine NSummary -!----------------------------------------------------------------------- - -end module CNSummaryMod diff --git a/src_clm40/biogeochem/CNVegStructUpdateMod.F90 b/src_clm40/biogeochem/CNVegStructUpdateMod.F90 deleted file mode 100644 index 955f76ef7e..0000000000 --- a/src_clm40/biogeochem/CNVegStructUpdateMod.F90 +++ /dev/null @@ -1,317 +0,0 @@ -module CNVegStructUpdateMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNVegStructUpdateMod -! -! !DESCRIPTION: -! Module for vegetation structure updates (LAI, SAI, htop, hbot) -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public :: CNVegStructUpdate -! -! !REVISION HISTORY: -! 4/23/2004: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNVegStructUpdate -! -! !INTERFACE: -subroutine CNVegStructUpdate(num_soilp, filter_soilp) -! -! !DESCRIPTION: -! On the radiation time step, use C state variables and epc to diagnose -! vegetation structure (LAI, SAI, height) -! -! !USES: - use clmtype - use clm_atmlnd , only: clm_a2l - use pftvarcon , only: noveg, nc3crop, nirrig, nbrdlf_evr_shrub, nbrdlf_dcd_brl_shrub - use pftvarcon , only: ncorn, npcropmin, ztopmx, laimx - use clm_varctl , only: iulog, use_cndv - use shr_sys_mod , only: shr_sys_flush - use shr_const_mod, only: SHR_CONST_PI - use clm_time_manager , only : get_rad_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilp ! number of column soil points in pft filter - integer, intent(in) :: filter_soilp(:) ! pft filter for soil points -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 10/28/03: Created by Peter Thornton -! 2/29/08, David Lawrence: revised snow burial fraction for short vegetation -! -! !LOCAL VARIABLES: -! local pointers to implicit in scalars -! - real(r8), pointer :: allom2(:) ! ecophys const - real(r8), pointer :: allom3(:) ! ecophys const - real(r8), pointer :: nind(:) ! number of individuals (#/m**2) - real(r8), pointer :: fpcgrid(:) ! fractional area of pft (pft area/nat veg area) - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! column index associated with each pft - integer , pointer :: pgridcell(:) ! pft's gridcell index - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: woody(:) !binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: slatop(:) !specific leaf area at top of canopy, projected area basis [m^2/gC] - real(r8), pointer :: dsladlai(:) !dSLA/dLAI, projected area basis [m^2/gC] - real(r8), pointer :: z0mr(:) !ratio of momentum roughness length to canopy top height (-) - real(r8), pointer :: displar(:) !ratio of displacement height to canopy top height (-) - real(r8), pointer :: forc_hgt_u_pft(:) ! observational height of wind at pft-level [m] - real(r8), pointer :: dwood(:) ! density of wood (gC/m^3) -! -! local pointers to implicit in/out scalars -! - integer , pointer :: frac_veg_nosno_alb(:) ! frac of vegetation not covered by snow [-] - real(r8), pointer :: tlai(:) !one-sided leaf area index, no burying by snow - real(r8), pointer :: tsai(:) !one-sided stem area index, no burying by snow - real(r8), pointer :: htop(:) !canopy top (m) - real(r8), pointer :: hbot(:) !canopy bottom (m) - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - real(r8), pointer :: htmx(:) ! max hgt attained by a crop during yr (m) - integer , pointer :: peaklai(:) ! 1: max allowed lai; 0: not at max - integer , pointer :: harvdate(:) ! harvest date -! -! local pointers to implicit out scalars -! -! -! !OTHER LOCAL VARIABLES: - integer :: p,c,g !indices - integer :: fp !lake filter indices - real(r8):: taper ! ratio of height:radius_breast_height (tree allometry) - real(r8):: stocking ! #stems / ha (stocking density) - real(r8):: ol ! thickness of canopy layer covered by snow (m) - real(r8):: fb ! fraction of canopy layer covered by snow - real(r8) :: tlai_old ! for use in Zeng tsai formula - real(r8) :: tsai_old ! for use in Zeng tsai formula - real(r8) :: tsai_min ! PFT derived minimum tsai - real(r8) :: tsai_alpha ! monthly decay rate of tsai - real(r8) dt ! radiation time step (sec) - - real(r8), parameter :: dtsmonth = 2592000._r8 ! number of seconds in a 30 day month (60x60x24x30) -!EOP -!----------------------------------------------------------------------- -! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 -! -! tsai(p) = max( tsai_alpha(ivt(p))*tsai_old + max(tlai_old-tlai(p),0_r8), tsai_min(ivt(p)) ) -! notes: -! * RHS tsai & tlai are from previous timestep -! * should create tsai_alpha(ivt(p)) & tsai_min(ivt(p)) in pftvarcon.F90 - slevis -! * all non-crop pfts use same values: -! crop tsai_alpha,tsai_min = 0.0,0.1 -! noncrop tsai_alpha,tsai_min = 0.5,1.0 (includes bare soil and urban) -!------------------------------------------------------------------------------- - - ! assign local pointers to derived type arrays (in) - allom2 => dgv_pftcon%allom2 - allom3 => dgv_pftcon%allom3 - nind => pdgvs%nind - fpcgrid => pdgvs%fpcgrid - ivt => pft%itype - pcolumn => pft%column - pgridcell => pft%gridcell - leafc => pcs%leafc - deadstemc => pcs%deadstemc - snowdp => cps%snowdp - woody => pftcon%woody - slatop => pftcon%slatop - dsladlai => pftcon%dsladlai - z0mr => pftcon%z0mr - displar => pftcon%displar - dwood => pftcon%dwood - - ! assign local pointers to derived type arrays (out) - tlai => pps%tlai - tsai => pps%tsai - htop => pps%htop - hbot => pps%hbot - elai => pps%elai - esai => pps%esai - frac_veg_nosno_alb => pps%frac_veg_nosno_alb - htmx => pps%htmx - peaklai => pps%peaklai - harvdate => pps%harvdate - forc_hgt_u_pft => pps%forc_hgt_u_pft - - dt = real( get_rad_step_size(), r8 ) - - ! constant allometric parameters - taper = 200._r8 - stocking = 1000._r8 - - ! convert from stems/ha -> stems/m^2 - stocking = stocking / 10000._r8 - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - c = pcolumn(p) - g = pgridcell(p) - - if (ivt(p) /= noveg) then - - tlai_old = tlai(p) ! n-1 value - tsai_old = tsai(p) ! n-1 value - - ! update the leaf area index based on leafC and SLA - ! Eq 3 from Thornton and Zimmerman, 2007, J Clim, 20, 3902-3923. - if (dsladlai(ivt(p)) > 0._r8) then - tlai(p) = (slatop(ivt(p))*(exp(leafc(p)*dsladlai(ivt(p))) - 1._r8))/dsladlai(ivt(p)) - else - tlai(p) = slatop(ivt(p)) * leafc(p) - end if - tlai(p) = max(0._r8, tlai(p)) - - ! update the stem area index and height based on LAI, stem mass, and veg type. - ! With the exception of htop for woody vegetation, this follows the DGVM logic. - - ! tsai formula from Zeng et. al. 2002, Journal of Climate, p1835 (see notes) - ! Assumes doalb time step .eq. CLM time step, SAI min and monthly decay factor - ! alpha are set by PFT, and alpha is scaled to CLM time step by multiplying by - ! dt and dividing by dtsmonth (seconds in average 30 day month) - ! tsai_min scaled by 0.5 to match MODIS satellite derived values - if (ivt(p) == nc3crop .or. ivt(p) == nirrig) then ! generic crops - - tsai_alpha = 1.0_r8-1.0_r8*dt/dtsmonth - tsai_min = 0.1_r8 - else - tsai_alpha = 1.0_r8-0.5_r8*dt/dtsmonth - tsai_min = 1.0_r8 - end if - tsai_min = tsai_min * 0.5_r8 - tsai(p) = max(tsai_alpha*tsai_old+max(tlai_old-tlai(p),0._r8),tsai_min) - - if (woody(ivt(p)) == 1._r8) then - - ! trees and shrubs - - ! if shrubs have a squat taper - if (ivt(p) >= nbrdlf_evr_shrub .and. ivt(p) <= nbrdlf_dcd_brl_shrub) then - taper = 10._r8 - ! otherwise have a tall taper - else - taper = 200._r8 - end if - - ! trees and shrubs for now have a very simple allometry, with hard-wired - ! stem taper (height:radius) and hard-wired stocking density (#individuals/area) - if (use_cndv) then - if (fpcgrid(p) > 0._r8 .and. nind(p) > 0._r8) then - stocking = nind(p)/fpcgrid(p) !#ind/m2 nat veg area -> #ind/m2 pft area - ! lpj's htop w/ cn's stemdiam - htop(p) = allom2(ivt(p)) * ( (24._r8 * deadstemc(p) / & - (SHR_CONST_PI * stocking * dwood(ivt(p)) * taper))**(1._r8/3._r8) )**allom3(ivt(p)) - else - htop(p) = 0._r8 - end if - else - htop(p) = ((3._r8 * deadstemc(p) * taper * taper)/ & - (SHR_CONST_PI * stocking * dwood(ivt(p))))**(1._r8/3._r8) - end if - - ! Peter Thornton, 5/3/2004 - ! Adding test to keep htop from getting too close to forcing height for windspeed - ! Also added for grass, below, although it is not likely to ever be an issue. - htop(p) = min(htop(p),(forc_hgt_u_pft(p)/(displar(ivt(p))+z0mr(ivt(p))))-3._r8) - - ! Peter Thornton, 8/11/2004 - ! Adding constraint to keep htop from going to 0.0. - ! This becomes an issue when fire mortality is pushing deadstemc - ! to 0.0. - htop(p) = max(htop(p), 0.01_r8) - - hbot(p) = max(0._r8, min(3._r8, htop(p)-1._r8)) - - else if (ivt(p) >= npcropmin) then ! prognostic crops - - if (tlai(p) >= laimx(ivt(p))) peaklai(p) = 1 ! used in CNAllocation - - if (ivt(p) == ncorn) then - tsai(p) = 0.1_r8 * tlai(p) - else - tsai(p) = 0.2_r8 * tlai(p) - end if - - ! "stubble" after harvest - if (harvdate(p) < 999 .and. tlai(p) == 0._r8) then - tsai(p) = 0.25_r8 - htmx(p) = 0._r8 - peaklai(p) = 0 - end if - !if (harvdate(p) < 999 .and. tlai(p) > 0._r8) write(iulog,*) 'CNVegStructUpdate: tlai>0 after harvest!' ! remove after initial debugging? - - ! canopy top and bottom heights - htop(p) = ztopmx(ivt(p)) * (min(tlai(p)/(laimx(ivt(p))-1._r8),1._r8))**2 - htmx(p) = max(htmx(p), htop(p)) - htop(p) = max(0.05_r8, max(htmx(p),htop(p))) - hbot(p) = 0.02_r8 - else ! generic crops and ... - ! grasses - - ! height for grasses depends only on LAI - htop(p) = max(0.25_r8, tlai(p) * 0.25_r8) - - htop(p) = min(htop(p),(forc_hgt_u_pft(p)/(displar(ivt(p))+z0mr(ivt(p))))-3._r8) - - ! Peter Thornton, 8/11/2004 - ! Adding constraint to keep htop from going to 0.0. - htop(p) = max(htop(p), 0.01_r8) - - hbot(p) = max(0.0_r8, min(0.05_r8, htop(p)-0.20_r8)) - end if - - else - tlai(p) = 0._r8 - tsai(p) = 0._r8 - htop(p) = 0._r8 - hbot(p) = 0._r8 - end if - - ! adjust lai and sai for burying by snow. - - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. - if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then - ol = min( max(snowdp(c)-hbot(p), 0._r8), htop(p)-hbot(p)) - fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) - else - fb = 1._r8 - max(min(snowdp(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses - endif - - elai(p) = max(tlai(p)*fb, 0.0_r8) - esai(p) = max(tsai(p)*fb, 0.0_r8) - - ! Fraction of vegetation free of snow - if ((elai(p) + esai(p)) > 0._r8) then - frac_veg_nosno_alb(p) = 1 - else - frac_veg_nosno_alb(p) = 0 - end if - - end do - -end subroutine CNVegStructUpdate -!----------------------------------------------------------------------- - -end module CNVegStructUpdateMod diff --git a/src_clm40/biogeochem/CNWoodProductsMod.F90 b/src_clm40/biogeochem/CNWoodProductsMod.F90 deleted file mode 100644 index 7bcc54b24d..0000000000 --- a/src_clm40/biogeochem/CNWoodProductsMod.F90 +++ /dev/null @@ -1,138 +0,0 @@ -module CNWoodProductsMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNWoodProductsMod -! -! !DESCRIPTION: -! Calculate loss fluxes from wood products pools, and update product pool state variables -! -! !USES: - use decompMod , only : get_proc_bounds - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varcon , only: istsoil - use spmdMod , only: masterproc - implicit none - save - private -! !PUBLIC MEMBER FUNCTIONS: - public:: CNWoodProducts -! -! !REVISION HISTORY: -! 5/20/2009: Created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNWoodProducts -! -! !INTERFACE: -subroutine CNWoodProducts(num_soilc, filter_soilc) -! -! !DESCRIPTION: -! Update all loss fluxes from wood product pools, and update product pool state variables -! for both loss and gain terms. Gain terms are calculated in pftdyn_cnbal() for gains associated -! with changes in landcover, and in CNHarvest(), for gains associated with wood harvest. -! -! !USES: - use clmtype - use clm_time_manager, only: get_step_size - use clm_varctl, only : use_c13 -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! filter for soil columns -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 5/21/09: Created by Peter Thornton -! -! !LOCAL VARIABLES: - - integer :: fc ! lake filter indices - integer :: c ! indices - real(r8):: dt ! time step (seconds) - type(column_type), pointer :: cptr ! pointer to column derived subtype - real(r8) :: kprod10 ! decay constant for 10-year product pool - real(r8) :: kprod100 ! decay constant for 100-year product pool - -!EOP -!----------------------------------------------------------------------- - - cptr => col - - ! calculate column-level losses from product pools - ! the following (1/s) rate constants result in ~90% loss of initial state over 10 and 100 years, - ! respectively, using a discrete-time fractional decay algorithm. - kprod10 = 7.2e-9 - kprod100 = 7.2e-10 - - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! calculate fluxes (1/sec) - ccf%prod10c_loss(c) = ccs%prod10c(c) * kprod10 - ccf%prod100c_loss(c) = ccs%prod100c(c) * kprod100 - if (use_c13) then - cc13f%prod10c_loss(c) = cc13s%prod10c(c) * kprod10 - cc13f%prod100c_loss(c) = cc13s%prod100c(c) * kprod100 - end if - cnf%prod10n_loss(c) = cns%prod10n(c) * kprod10 - cnf%prod100n_loss(c) = cns%prod100n(c) * kprod100 - end do - - ! set time steps - dt = real( get_step_size(), r8 ) - - ! update wood product state variables - ! column loop - do fc = 1,num_soilc - c = filter_soilc(fc) - - ! column-level fluxes - - ! fluxes into wood product pools, from landcover change - ccs%prod10c(c) = ccs%prod10c(c) + ccf%dwt_prod10c_gain(c)*dt - ccs%prod100c(c) = ccs%prod100c(c) + ccf%dwt_prod100c_gain(c)*dt - if (use_c13) then - cc13s%prod10c(c) = cc13s%prod10c(c) + cc13f%dwt_prod10c_gain(c)*dt - cc13s%prod100c(c) = cc13s%prod100c(c) + cc13f%dwt_prod100c_gain(c)*dt - end if - cns%prod10n(c) = cns%prod10n(c) + cnf%dwt_prod10n_gain(c)*dt - cns%prod100n(c) = cns%prod100n(c) + cnf%dwt_prod100n_gain(c)*dt - - ! fluxes into wood product pools, from harvest - ccs%prod10c(c) = ccs%prod10c(c) + ccf%hrv_deadstemc_to_prod10c(c)*dt - ccs%prod100c(c) = ccs%prod100c(c) + ccf%hrv_deadstemc_to_prod100c(c)*dt - if (use_c13) then - cc13s%prod10c(c) = cc13s%prod10c(c) + cc13f%hrv_deadstemc_to_prod10c(c)*dt - cc13s%prod100c(c) = cc13s%prod100c(c) + cc13f%hrv_deadstemc_to_prod100c(c)*dt - end if - cns%prod10n(c) = cns%prod10n(c) + cnf%hrv_deadstemn_to_prod10n(c)*dt - cns%prod100n(c) = cns%prod100n(c) + cnf%hrv_deadstemn_to_prod100n(c)*dt - - ! fluxes out of wood product pools, from decomposition - ccs%prod10c(c) = ccs%prod10c(c) - ccf%prod10c_loss(c)*dt - ccs%prod100c(c) = ccs%prod100c(c) - ccf%prod100c_loss(c)*dt - if (use_c13) then - cc13s%prod10c(c) = cc13s%prod10c(c) - cc13f%prod10c_loss(c)*dt - cc13s%prod100c(c) = cc13s%prod100c(c) - cc13f%prod100c_loss(c)*dt - end if - cns%prod10n(c) = cns%prod10n(c) - cnf%prod10n_loss(c)*dt - cns%prod100n(c) = cns%prod100n(c) - cnf%prod100n_loss(c)*dt - - end do ! end of column loop - -end subroutine CNWoodProducts -!----------------------------------------------------------------------- - -end module CNWoodProductsMod diff --git a/src_clm40/biogeochem/CNrestMod.F90 b/src_clm40/biogeochem/CNrestMod.F90 deleted file mode 100644 index c22e5b48cd..0000000000 --- a/src_clm40/biogeochem/CNrestMod.F90 +++ /dev/null @@ -1,2339 +0,0 @@ -module CNrestMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CNrestMod -! -! !DESCRIPTION: -! Read/Write to/from CN info to CLM restart file. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc - use abortutils , only : endrun -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: CNrest -! -! !REVISION HISTORY: -! 11/05/03: Module created by Peter Thornton -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNRest -! -! !INTERFACE: - subroutine CNRest ( ncid, flag ) -! -! !DESCRIPTION: -! Read/write CN restart data -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varpar , only : numrad - use clm_varctl , only : use_c13, use_cndv, use_exit_spinup - use decompMod , only : get_proc_bounds - use clm_time_manager, only : is_restart - use ncdio_pio -! -! !ARGUMENTS: - implicit none - type(file_desc_t) :: ncid ! netcdf id - character(len=*), intent(in) :: flag !'read' or 'write' -! -! !CALLED FROM: -! subroutine restart in module restFileMod -! -! !REVISION HISTORY: -! Author: Peter Thornton -! -! -! !LOCAL VARIABLES: -!EOP - integer :: c,p,j ! indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - real(r8):: m ! multiplier for the exit_spinup code - logical :: readvar ! determine if variable is on initial file - character(len=128) :: varname ! temporary - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - integer , pointer :: iptemp(:) ! pointer to memory to be allocated - integer :: ier ! error status -!----------------------------------------------------------------------- - - ! Set pointers into derived type - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - ! Determine necessary subgrid bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - !-------------------------------- - ! pft ecophysiological variables - !-------------------------------- - - ! dormant_flag - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='dormant_flag', xtype=ncd_double, & - dim1name='pft',long_name='dormancy flag',units='unitless' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='dormant_flag', data=pepv%dormant_flag, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! days_active - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='days_active', xtype=ncd_double, & - dim1name='pft',long_name='number of days since last dormancy',units='days' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='days_active', data=pepv%days_active, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! onset_flag - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='onset_flag', xtype=ncd_double, & - dim1name='pft',long_name='flag if critical growing degree-day sum is exceeded',units='unitless' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='onset_flag', data=pepv%onset_flag, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! onset_counter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='onset_counter', xtype=ncd_double, & - dim1name='pft',long_name='onset days counter',units='sec' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='onset_counter', data=pepv%onset_counter, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! onset_gddflag - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='onset_gddflag', xtype=ncd_double, & - dim1name='pft',long_name='onset flag for growing degree day sum',units='' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='onset_gddflag', data=pepv%onset_gddflag, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! onset_fdd - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='onset_fdd', xtype=ncd_double, & - dim1name='pft',long_name='onset freezing degree days counter',units='days' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='onset_fdd', data=pepv%onset_fdd, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! onset_gdd - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='onset_gdd', xtype=ncd_double, & - dim1name='pft',long_name='onset growing degree days',units='days' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='onset_gdd', data=pepv%onset_gdd, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! onset_swi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='onset_swi', xtype=ncd_double, & - dim1name='pft',long_name='onset soil water index',units='days' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='onset_swi', data=pepv%onset_swi, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! offset_flag - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='offset_flag', xtype=ncd_double, & - dim1name='pft',long_name='offset flag',units='unitless' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='offset_flag', data=pepv%offset_flag, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! offset_counter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='offset_counter', xtype=ncd_double, & - dim1name='pft',long_name='offset days counter',units='sec' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='offset_counter', data=pepv%offset_counter, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! offset_fdd - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='offset_fdd', xtype=ncd_double, & - dim1name='pft',long_name='offset freezing degree days counter',units='days' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='offset_fdd', data=pepv%offset_fdd, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! offset_swi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='offset_swi', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='offset_swi', data=pepv%offset_swi, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! lgsf - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='lgsf', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='lgsf', data=pepv%lgsf, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! bglfr - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='bglfr', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='bglfr', data=pepv%bglfr, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! bgtr - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='bgtr', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='bgtr', data=pepv%bgtr, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! dayl - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='dayl', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='dayl', data=pepv%dayl, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prev_dayl - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prev_dayl', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prev_dayl', data=pepv%prev_dayl, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! annavg_t2m - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='annavg_t2m', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='annavg_t2m', data=pepv%annavg_t2m, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! tempavg_t2m - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tempavg_t2m', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tempavg_t2m', data=pepv%tempavg_t2m, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gpp - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gpp_pepv', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gpp_pepv', data=pepv%gpp, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! availc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='availc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='availc', data=pepv%availc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! xsmrpool_recover - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='xsmrpool_recover', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='xsmrpool_recover', data=pepv%xsmrpool_recover, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - - if (use_c13) then - ! xsmrpool_c13ratio - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='xsmrpool_c13ratio', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='xsmrpool_c13ratio', data=pepv%xsmrpool_c13ratio, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - end if - - ! alloc_pnow - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='alloc_pnow', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='alloc_pnow', data=pepv%alloc_pnow, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! c_allometry - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='c_allometry', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='c_allometry', data=pepv%c_allometry, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! n_allometry - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='n_allometry', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='n_allometry', data=pepv%n_allometry, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! plant_ndemand - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='plant_ndemand', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='plant_ndemand', data=pepv%plant_ndemand, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! tempsum_potential_gpp - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tempsum_potential_gpp', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tempsum_potential_gpp', data=pepv%tempsum_potential_gpp, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !annsum_potential_gpp - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='annsum_potential_gpp', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='annsum_potential_gpp', data=pepv%annsum_potential_gpp, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! tempmax_retransn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tempmax_retransn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tempmax_retransn', data=pepv%tempmax_retransn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! annmax_retransn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='annmax_retransn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='annmax_retransn', data=pepv%annmax_retransn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! avail_retransn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='avail_retransn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='avail_retransn', data=pepv%avail_retransn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! plant_nalloc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='plant_nalloc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='plant_nalloc', data=pepv%plant_nalloc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! plant_calloc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='plant_calloc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='plant_calloc', data=pepv%plant_calloc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! excess_cflux - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='excess_cflux', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='excess_cflux', data=pepv%excess_cflux, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! downreg - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='downreg', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='downreg', data=pepv%downreg, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prev_leafc_to_litter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prev_leafc_to_litter', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prev_leafc_to_litter', data=pepv%prev_leafc_to_litter, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prev_frootc_to_litter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prev_frootc_to_litter', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prev_frootc_to_litter', data=pepv%prev_frootc_to_litter, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! tempsum_npp - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tempsum_npp', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tempsum_npp', data=pepv%tempsum_npp, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! annsum_npp - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='annsum_npp', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='annsum_npp', data=pepv%annsum_npp, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - if (use_c13) then - ! rc13_canair - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='rc13_canair', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='rc13_canair', data=pepv%rc13_canair, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! rc13_psnsun - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='rc13_psnsun', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='rc13_psnsun', data=pepv%rc13_psnsun, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! rc13_psnsha - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='rc13_psnsha', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='rc13_psnsha', data=pepv%rc13_psnsha, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - end if - - !-------------------------------- - ! pft carbon state variables - !-------------------------------- - - ! leafc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafc', data=pcs%leafc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! leafc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafc_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafc_storage', data=pcs%leafc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! leafc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafc_xfer', data=pcs%leafc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootc', data=pcs%frootc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootc_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootc_storage', data=pcs%frootc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !frootc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootc_xfer', data=pcs%frootc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc', data=pcs%livestemc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc_storage', data=pcs%livestemc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc_xfer', data=pcs%livestemc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemc', data=pcs%deadstemc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemc_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemc_storage', data=pcs%deadstemc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemc_xfer', data=pcs%deadstemc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootc', data=pcs%livecrootc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootc_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootc_storage', data=pcs%livecrootc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootc_xfer', data=pcs%livecrootc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootc', data=pcs%deadcrootc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootc_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootc_storage', data=pcs%deadcrootc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootc_xfer', data=pcs%deadcrootc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gresp_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gresp_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gresp_storage', data=pcs%gresp_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gresp_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gresp_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gresp_xfer', data=pcs%gresp_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cpool - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cpool', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cpool', data=pcs%cpool, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! xsmrpool - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='xsmrpool', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='xsmrpool', data=pcs%xsmrpool, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! pft_ctrunc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='pft_ctrunc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='pft_ctrunc', data=pcs%pft_ctrunc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totvegc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totvegc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totvegc', data=pcs%totvegc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - if (use_c13) then - !-------------------------------- - ! C13 pft carbon state variables - !-------------------------------- - - ! leafc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafc_13', data=pc13s%leafc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! leafc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafc_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafc_storage_13', data=pc13s%leafc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! leafc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafc_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafc_xfer_13', data=pc13s%leafc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootc_13', data=pc13s%frootc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootc_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootc_storage_13', data=pc13s%frootc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !frootc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootc_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootc_xfer_13', data=pc13s%frootc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc_13', data=pc13s%livestemc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc_storage_13', data=pc13s%livestemc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc_xfer_13', data=pc13s%livestemc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemc_13', data=pc13s%deadstemc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemc_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemc_storage_13', data=pc13s%deadstemc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemc_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemc_xfer_13', data=pc13s%deadstemc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootc_13', data=pc13s%livecrootc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootc_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootc_storage_13', data=pc13s%livecrootc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootc_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootc_xfer_13', data=pc13s%livecrootc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootc_13', data=pc13s%deadcrootc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootc_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootc_storage_13', data=pc13s%deadcrootc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootc_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootc_xfer_13', data=pc13s%deadcrootc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gresp_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gresp_storage_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gresp_storage_13', data=pc13s%gresp_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gresp_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gresp_xfer_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gresp_xfer_13', data=pc13s%gresp_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cpool - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cpool_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cpool_13', data=pc13s%cpool, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! xsmrpool - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='xsmrpool_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='xsmrpool_13', data=pc13s%xsmrpool, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! pft_ctrunc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='pft_ctrunc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='pft_ctrunc_13', data=pc13s%pft_ctrunc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totvegc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totvegc_13', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totvegc_13', data=pc13s%totvegc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - end if - - !-------------------------------- - ! pft nitrogen state variables - !-------------------------------- - - ! leafn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafn', data=pns%leafn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! leafn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafn_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafn_storage', data=pns%leafn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! leafn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafn_xfer', data=pns%leafn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootn', data=pns%frootn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootn_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootn_storage', data=pns%frootn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! frootn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frootn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frootn_xfer', data=pns%frootn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemn', data=pns%livestemn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemn_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemn_storage', data=pns%livestemn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemn_xfer', data=pns%livestemn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadstemn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemn', data=pns%deadstemn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !deadstemn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemn_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemn_storage', data=pns%deadstemn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !deadstemn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadstemn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadstemn_xfer', data=pns%deadstemn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootn', data=pns%livecrootn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livecrootn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootn_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootn_storage', data=pns%livecrootn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !livecrootn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livecrootn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livecrootn_xfer', data=pns%livecrootn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootn', data=pns%deadcrootn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootn_storage', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootn_storage', data=pns%deadcrootn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! deadcrootn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='deadcrootn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='deadcrootn_xfer', data=pns%deadcrootn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !retransn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='retransn', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='retransn', data=pns%retransn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! npool - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='npool', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='npool', data=pns%npool, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! pft_ntrunc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='pft_ntrunc', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='pft_ntrunc', data=pns%pft_ntrunc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !-------------------------------- - ! column physical state variables - !-------------------------------- - - ! decl - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='decl', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='decl', data=cps%decl, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! fpi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fpi', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fpi', data=cps%fpi, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! fpg - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fpg', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fpg', data=cps%fpg, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! annsum_counter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='annsum_counter', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='annsum_counter', data=cps%annsum_counter, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cannsum_npp - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cannsum_npp', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cannsum_npp', data=cps%cannsum_npp, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cannavg_t2m - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cannavg_t2m', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cannavg_t2m', data=cps%cannavg_t2m, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! wf - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='wf', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='wf', data=cps%wf, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! me - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='me', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='me', data=cps%me, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! fire_prob - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fire_prob', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fire_prob', data=cps%fire_prob, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! mean_fire_prob - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mean_fire_prob', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mean_fire_prob', data=cps%mean_fire_prob, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! fireseasonl - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fireseasonl', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fireseasonl', data=cps%fireseasonl, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! farea_burned - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='farea_burned', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='farea_burned', data=cps%farea_burned, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! ann_farea_burned - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ann_farea_burned', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='ann_farea_burned', data=cps%ann_farea_burned, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !-------------------------------- - ! column carbon state variables - !-------------------------------- - - ! cwdc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cwdc', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cwdc', data=ccs%cwdc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! litr1c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr1c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr1c', data=ccs%litr1c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !litr2c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr2c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr2c', data=ccs%litr2c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! litr3c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr3c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr3c', data=ccs%litr3c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !soil1c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil1c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil1c', data=ccs%soil1c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil2c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil2c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil2c', data=ccs%soil2c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil3c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil3c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil3c', data=ccs%soil3c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil4c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil4c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil4c', data=ccs%soil4c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! seedc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='seedc', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='seedc', data=ccs%seedc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! col_ctrunc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='col_ctrunc', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='col_ctrunc', data=ccs%col_ctrunc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totlitc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totlitc', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totlitc', data=ccs%totlitc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totcolc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totcolc', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totcolc', data=ccs%totcolc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prod10c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prod10c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prod10c', data=ccs%prod10c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prod100c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prod100c', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prod100c', data=ccs%prod100c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - if (use_c13) then - !-------------------------------- - ! C13 column carbon state variables - !-------------------------------- - - ! cwdc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cwdc_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cwdc_13', data=cc13s%cwdc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! litr1c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr1c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr1c_13', data=cc13s%litr1c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !litr2c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr2c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr2c_13', data=cc13s%litr2c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! litr3c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr3c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr3c_13', data=cc13s%litr3c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !soil1c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil1c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil1c_13', data=cc13s%soil1c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil2c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil2c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil2c_13', data=cc13s%soil2c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil3c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil3c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil3c_13', data=cc13s%soil3c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil4c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil4c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil4c_13', data=cc13s%soil4c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! seedc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='seedc_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='seedc_13', data=cc13s%seedc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! col_ctrunc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='col_ctrunc_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='col_ctrunc_13', data=cc13s%col_ctrunc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totlitc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totlitc_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totlitc_13', data=cc13s%totlitc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totcolc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totcolc_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totcolc_13', data=cc13s%totcolc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prod10c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prod10c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prod10c_13', data=cc13s%prod10c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prod100c - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prod100c_13', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prod100c_13', data=cc13s%prod100c, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - end if - - !-------------------------------- - ! column nitrogen state variables - !-------------------------------- - - ! cwdn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cwdn', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cwdn', data=cns%cwdn, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - !litr1n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr1n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr1n', data=cns%litr1n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! litr2n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr2n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr2n', data=cns%litr2n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! litr3n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='litr3n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='litr3n', data=cns%litr3n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil1n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil1n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil1n', data=cns%soil1n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil2n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil2n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil2n', data=cns%soil2n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil3n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil3n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil3n', data=cns%soil3n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! soil4n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='soil4n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='soil4n', data=cns%soil4n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! sminn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sminn', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sminn', data=cns%sminn, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! col_ntrunc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='col_ntrunc', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='col_ntrunc', data=cns%col_ntrunc, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! totcoln - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='totcoln', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='totcoln', data=cns%totcoln, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! seedn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='seedn', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='seedn', data=cns%seedn, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prod10n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prod10n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prod10n', data=cns%prod10n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! prod100n - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='prod100n', xtype=ncd_double, & - dim1name='column',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='prod100n', data=cns%prod100n, & - dim1name=namec, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - if (use_exit_spinup) then - if (flag == 'read') then - m = 20._r8 - do c = begc, endc - ccs%soil1c(c) = ccs%soil1c(c) * m - ccs%soil2c(c) = ccs%soil2c(c) * m - ccs%soil3c(c) = ccs%soil3c(c) * m - ccs%soil4c(c) = ccs%soil4c(c) * m - if (use_c13) then - ! adding code for 13C, 12/25/05, PET - cc13s%soil1c(c) = cc13s%soil1c(c) * m - cc13s%soil2c(c) = cc13s%soil2c(c) * m - cc13s%soil3c(c) = cc13s%soil3c(c) * m - cc13s%soil4c(c) = cc13s%soil4c(c) * m - end if - cns%soil1n(c) = cns%soil1n(c) * m - cns%soil2n(c) = cns%soil2n(c) * m - cns%soil3n(c) = cns%soil3n(c) * m - cns%soil4n(c) = cns%soil4n(c) * m - end do - end if - end if - - if (use_cndv) then - ! pft type dgvm physical state - crownarea - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='CROWNAREA', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='CROWNAREA', data=pdgvs%crownarea, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! tempsum_litfall - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tempsum_litfall', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tempsum_litfall', data=pepv%tempsum_litfall, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! annsum_litfall - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='annsum_litfall', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='annsum_litfall', data=pepv%annsum_litfall, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! nind - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='nind', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='nind', data=pdgvs%nind, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! fpcgrid - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fpcgrid', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fpcgrid', data=pdgvs%fpcgrid, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! fpcgridold - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fpcgridold', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fpcgridold', data=pdgvs%fpcgridold, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gridcell type dgvm physical state - tmomin20 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='TMOMIN20', xtype=ncd_double, & - dim1name='gridcell',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='TMOMIN20', data=gdgvs%tmomin20, & - dim1name=nameg, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gridcell type dgvm physical state - agdd20 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='AGDD20', xtype=ncd_double, & - dim1name='gridcell',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='AGDD20', data=gdgvs%agdd20, & - dim1name=nameg, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! pft type dgvm physical state - t_mo_min - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_MO_MIN', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_MO_MIN', data=pdgvs%t_mo_min, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! present - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='present', xtype=ncd_int, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - allocate (iptemp(begp:endp), stat=ier) - if (ier /= 0) then - call endrun('CNrest: allocation error ') - end if - if (flag == 'write') then - do p = begp,endp - iptemp(p) = 0 - if (pdgvs%present(p)) iptemp(p) = 1 - end do - end if - call ncd_io(varname='present', data=iptemp, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read') then - if (.not. readvar) then - if (is_restart()) call endrun - else - do p = begp,endp - pdgvs%present(p) = .false. - if (iptemp(p) == 1) pdgvs%present(p) = .true. - end do - end if - end if - deallocate (iptemp) - end if - - ! leafcmax - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='leafcmax', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='leafcmax', data=pcs%leafcmax, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! heatstress - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='heatstress', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='heatstress', data=pdgvs%heatstress, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! greffic - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='greffic', xtype=ncd_double, & - dim1name='pft',long_name='',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='greffic', data=pdgvs%greffic, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - end if - - end subroutine CNRest - -end module CNrestMod - diff --git a/src_clm40/biogeochem/CropRestMod.F90 b/src_clm40/biogeochem/CropRestMod.F90 deleted file mode 100644 index d9a5df20cd..0000000000 --- a/src_clm40/biogeochem/CropRestMod.F90 +++ /dev/null @@ -1,744 +0,0 @@ -module CropRestMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: CropRestMod -! -! !DESCRIPTION: -! Read/Write to/from Crop info to CLM restart file. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc - use abortutils , only : endrun -! -! !PUBLIC TYPES: - implicit none - private - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: CropRest ! Restart prognostic crop model - public :: CropRestYear ! Get the number of years crop has spunup - public :: CropRestIncYear ! Increment the crop spinup years -! -! !REVISION HISTORY: -! Module created by slevis following CNRestMod by Peter Thornton -! - -! !PRIVATE DATA MEMBERS: - integer :: restyear = 0 ! Restart year from the initial conditions file, incremented as time elapses - -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CropRest -! -! !INTERFACE: - subroutine CropRest ( ncid, flag ) -! -! !DESCRIPTION: -! Read/write Crop restart data -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varpar , only : numrad - use decompMod , only : get_proc_bounds - use clm_time_manager, only : is_restart - use ncdio_pio -! -! !ARGUMENTS: - implicit none - type(file_desc_t) :: ncid ! netcdf id - character(len=*), intent(in) :: flag !'read' or 'write' -! -! !CALLED FROM: -! subroutine restart in module restFileMod -! -! !REVISION HISTORY: -! Author: slevis -! -!EOP -! -! !LOCAL VARIABLES: - integer :: c,p,j ! indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - real(r8):: m ! multiplier for the exit_spinup code - logical :: readvar ! determine if variable is on initial file - character(len=128) :: varname ! temporary - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - integer , pointer :: iptemp(:) ! pointer to memory to be allocated - integer :: ier ! error status -!----------------------------------------------------------------------- - - ! Prognostic crop restart year - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='restyear', xtype=ncd_int, & - long_name='Number of years prognostic crop ran', units="years") - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='restyear', data=restyear, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' )then - if ( readvar ) then - call checkDates( ) - else - if ( is_restart()) call endrun - end if - end if - end if - - ! Set pointers into derived type - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - ! Determine necessary subgrid bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - !-------------------------------- - ! pft physical state variables - !-------------------------------- - - ! peaklai - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='peaklai', xtype=ncd_int, & - dim1name='pft',long_name='Flag if at max allowed LAI or not', & - flag_values=(/0,1/), nvalid_range=(/0,1/), & - flag_meanings=(/'NOT-at-peak', 'AT_peak-LAI' /) ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='peaklai', data=pps%peaklai, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! idop - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='idop', xtype=ncd_int, & - dim1name='pft',long_name='Date of planting',units='jday', & - nvalid_range=(/1,366/) ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='idop', data=pps%idop, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! aleaf - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='aleaf', xtype=ncd_double, & - dim1name='pft',long_name='leaf allocation coefficient',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='aleaf', data=pps%aleaf, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! aleafi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='aleafi', xtype=ncd_double, & - dim1name='pft',long_name='Saved leaf allocation coefficient from phase 2', & - units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='aleafi', data=pps%aleafi, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! astem - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='astem', xtype=ncd_double, & - dim1name='pft',long_name='stem allocation coefficient',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='astem', data=pps%astem, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! astemi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='astemi', xtype=ncd_double, & - dim1name='pft',long_name='Saved stem allocation coefficient from phase 2',& - units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='astemi', data=pps%astemi, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! htmx - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='htmx', xtype=ncd_double, & - dim1name='pft',long_name='max height attained by a crop during year',& - units='m') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='htmx', data=pps%htmx, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! hdidx - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='hdidx', xtype=ncd_double, & - dim1name='pft',long_name='cold hardening index',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='hdidx', data=pps%hdidx, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! vf - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='vf', xtype=ncd_double, & - dim1name='pft',long_name='vernalization factor',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='vf', data=pps%vf, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cumvd - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cumvd', xtype=ncd_double, & - dim1name='pft',long_name='cumulative vernalization d',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cumvd', data=pps%cumvd, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! croplive - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='croplive', xtype=ncd_log, & - dim1name='pft',long_name='Flag that crop is alive, but not harvested') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='croplive', data=pps%croplive, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cropplant - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cropplant', xtype=ncd_log, & - dim1name='pft',long_name='Flag that crop is planted, but not harvested' ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cropplant', data=pps%cropplant, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! harvdate - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='harvdate', xtype=ncd_int, & - dim1name='pft',long_name='harvest date',units='jday', & - nvalid_range=(/1,366/) ) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='harvdate', data=pps%harvdate, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gdd1020 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gdd1020', xtype=ncd_double, & - dim1name='pft', & - long_name='20 year average of growing degree-days base 10C from planting', & - units='ddays') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gdd1020', data=pps%gdd1020, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gdd820 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gdd820', xtype=ncd_double, & - dim1name='pft', & - long_name='20 year average of growing degree-days base 8C from planting', & - units='ddays') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gdd820', data=pps%gdd820, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gdd020 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gdd020', xtype=ncd_double, & - dim1name='pft', & - long_name='20 year average of growing degree-days base 0C from planting', & - units='ddays') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gdd020', data=pps%gdd020, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! gddmaturity - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gddmaturity', xtype=ncd_double, & - dim1name='pft',long_name='Growing degree days needed to harvest',units='ddays') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gddmaturity', data=pps%gddmaturity, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! huileaf - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='huileaf', xtype=ncd_double, & - dim1name='pft', & - long_name='heat unit index needed from planting to leaf emergence',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='huileaf', data=pps%huileaf, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! huigrain - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='huigrain', xtype=ncd_double, & - dim1name='pft',long_name='heat unit index needed to reach vegetative maturity', & - units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='huigrain', data=pps%huigrain, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainc', xtype=ncd_double, & - dim1name='pft',long_name='grain C',units='gC/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainc', data=pcs%grainc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainc_storage', xtype=ncd_double, & - dim1name='pft',long_name='grain C storage',units='gC/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainc_storage', data=pcs%grainc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainc_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainc_xfer', xtype=ncd_double, & - dim1name='pft',long_name='grain C transfer',units='gC/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainc_xfer', data=pcs%grainc_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainn', xtype=ncd_double, & - dim1name='pft',long_name='grain N',units='gN/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainn', data=pns%grainn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainn_storage', xtype=ncd_double, & - dim1name='pft',long_name='grain N storage',units='gN/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainn_storage', data=pns%grainn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainn_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainn_xfer', xtype=ncd_double, & - dim1name='pft',long_name='grain N transfer',units='gN/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainn_xfer', data=pns%grainn_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainc_xfer_to_grainc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainc_xfer_to_grainc', xtype=ncd_double, & - dim1name='pft',long_name='grain C growth from storage',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainc_xfer_to_grainc', data=pcf%grainc_xfer_to_grainc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemc_to_litter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemc_to_litter', xtype=ncd_double, & - dim1name='pft',long_name='live stem C litterfall',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemc_to_litter', data=pcf%livestemc_to_litter, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainc_to_food - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainc_to_food', xtype=ncd_double, & - dim1name='pft',long_name='grain C to food',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainc_to_food', data=pcf%grainc_to_food, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainn_xfer_to_grainn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainn_xfer_to_grainn', xtype=ncd_double, & - dim1name='pft',long_name='grain N growth from storage',units='gN/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainn_xfer_to_grainn', data=pnf%grainn_xfer_to_grainn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! livestemn_to_litter - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='livestemn_to_litter', xtype=ncd_double, & - dim1name='pft',long_name='livestem N to litter',units='gN/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='livestemn_to_litter', data=pnf%livestemn_to_litter, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainn_to_food - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainn_to_food', xtype=ncd_double, & - dim1name='pft',long_name='grain N to food',units='gN/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainn_to_food', data=pnf%grainn_to_food, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cpool_to_grainc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cpool_to_grainc', xtype=ncd_double, & - dim1name='pft',long_name='allocation to grain C',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cpool_to_grainc', data=pcf%cpool_to_grainc, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cpool_to_grainc_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cpool_to_grainc_storage', xtype=ncd_double, & - dim1name='pft',long_name='allocation to grain C storage',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cpool_to_grainc_storage', data=pcf%cpool_to_grainc_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! npool_to_grainn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='npool_to_grainn', xtype=ncd_double, & - dim1name='pft',long_name='allocation to grain N',units='gN/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='npool_to_grainn', data=pnf%npool_to_grainn, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! npool_to_grainn_storage - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='npool_to_grainn_storage', xtype=ncd_double, & - dim1name='pft',long_name='allocation to grain N storage',units='gN/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='npool_to_grainn_storage', data=pnf%npool_to_grainn_storage, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cpool_grain_gr - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cpool_grain_gr', xtype=ncd_double, & - dim1name='pft',long_name='grain growth respiration',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cpool_grain_gr', data=pcf%cpool_grain_gr, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! cpool_grain_storage_gr - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cpool_grain_storage_gr', xtype=ncd_double, & - dim1name='pft',long_name='grain growth respiration to storage',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='cpool_grain_storage_gr', data=pcf%cpool_grain_storage_gr, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! transfer_grain_gr - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='transfer_grain_gr', xtype=ncd_double, & - dim1name='pft',long_name='grain growth respiration from storage',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='transfer_grain_gr', data=pcf%transfer_grain_gr, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainc_storage_to_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainc_storage_to_xfer', xtype=ncd_double, & - dim1name='pft',long_name='grain C shift storage to transfer',units='gC/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainc_storage_to_xfer', data=pcf%grainc_storage_to_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - ! grainn_storage_to_xfer - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grainn_storage_to_xfer', xtype=ncd_double, & - dim1name='pft',long_name='grain N shift storage to transfer',units='gN/m2/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='grainn_storage_to_xfer', data=pnf%grainn_storage_to_xfer, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun - end if - end if - - end subroutine CropRest - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CropRestYear -! -! !INTERFACE: - integer function CropRestYear ( ) -! -! !DESCRIPTION: -! Return the restart year for prognostic crop -! -! !USES: -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Author: Erik Kluzek -! -!EOP -! -! !LOCAL VARIABLES: - CropRestYear = restyear - end function CropRestYear - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CropRestIncYear -! -! !INTERFACE: - subroutine CropRestIncYear () -! -! !DESCRIPTION: -! Increment the crop restart year, if appropriate -! -! This routine should be called every time step, but only once per clump (to avoid -! inadvertently updating nyrs multiple times) -! -! !USES: - use surfrdMod , only : crop_prog - use clm_time_manager , only : get_curr_date, is_first_step - implicit none -! -! !LOCAL VARIABLES: - integer kyr ! current year - integer kmo ! month of year (1, ..., 12) - integer kda ! day of month (1, ..., 31) - integer mcsec ! seconds of day (0, ..., seconds/day) -!----------------------------------------------------------------------- - - ! Update restyear only when running with prognostic crop - if ( crop_prog )then - ! Update restyear when it's the start of a new year - but don't do that at the - ! very start of the run - call get_curr_date ( kyr, kmo, kda, mcsec) - if ((kmo == 1 .and. kda == 1 .and. mcsec == 0) .and. .not. is_first_step()) then - restyear = restyear + 1 - end if - end if - - end subroutine CropRestIncYear - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: checkDates -! -! !INTERFACE: - subroutine checkDates( ) -! -! !DESCRIPTION: -! Make sure the dates are compatible. The date given to startup the model -! and the date on the restart file must be the same although years can be -! different. The dates need to be checked when the restart file is being -! read in for a startup or branch case (they are NOT allowed to be different -! for a restart case). -! -! For the prognostic crop model the date of planting is tracked and growing -! degree days is tracked (with a 20 year mean) -- so shifting the start dates -! messes up these bits of saved information. -! -! !USES: -! -! !ARGUMENTS: - use clm_time_manager, only : get_driver_start_ymd, get_start_date - use clm_varctl , only : iulog - use clm_varctl , only : nsrest, nsrBranch, nsrStartup -! -! !REVISION HISTORY: -! Author: Erik Kluzek -! -!EOP -! -! !LOCAL VARIABLES: - integer :: stymd ! Start date YYYYMMDD from driver - integer :: styr ! Start year from driver - integer :: stmon_day ! Start date MMDD from driver - integer :: rsmon_day ! Restart date MMDD from restart file - integer :: rsyr ! Restart year from restart file - integer :: rsmon ! Restart month from restart file - integer :: rsday ! Restart day from restart file - integer :: tod ! Restart time of day from restart file - character(len=*), parameter :: formDate = '(A,i4.4,"/",i2.2,"/",i2.2)' ! log output format - character(len=32) :: subname = 'CropRest::checkDates' - ! - ! If branch or startup make sure the startdate is compatible with the date - ! on the restart file. - ! - if ( nsrest == nsrBranch .or. nsrest == nsrStartup )then - stymd = get_driver_start_ymd() - styr = stymd / 10000 - stmon_day = stymd - styr*10000 - call get_start_date( rsyr, rsmon, rsday, tod ) - rsmon_day = rsmon*100 + rsday - if ( masterproc ) & - write(iulog,formDate) 'Date on the restart file is: ', rsyr, rsmon, rsday - if ( stmon_day /= rsmon_day )then - write(iulog,formDate) 'Start date is: ', styr, stmon_day/100, & - (stmon_day - stmon_day/100) - call endrun( trim(subname)// & - ' ERROR: For prognostic crop to work correctly, the start date (month and day)'// & - ' and the date on the restart file needs to match (years can be different)' ) - end if - end if - - end subroutine checkDates - -end module CropRestMod - diff --git a/src_clm40/biogeochem/DUSTMod.F90 b/src_clm40/biogeochem/DUSTMod.F90 deleted file mode 100644 index f41be79105..0000000000 --- a/src_clm40/biogeochem/DUSTMod.F90 +++ /dev/null @@ -1,900 +0,0 @@ -module DUSTMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: DUSTMod -! -! !DESCRIPTION: -! Routines in this module calculate Dust mobilization and dry deposition for dust. -! Simulates dust mobilization due to wind from the surface into the -! lowest atmospheric layer. On output flx_mss_vrt_dst(ndst) is the surface dust -! emission (kg/m**2/s) [ + = to atm]. -! Calculates the turbulent component of dust dry deposition, (the turbulent deposition -! velocity through the lowest atmospheric layer). CAM will calculate the settling -! velocity through the whole atmospheric column. The two calculations will determine -! the dust dry deposition flux to the surface. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_varpar , only : dst_src_nbr, ndst, sz_nbr - use clm_varcon , only : grav, istsoil - use clm_varcon , only : istcrop, istice_mec - use clm_varctl , only : iulog - use abortutils , only : endrun - use subgridAveMod, only: p2l_1d - use clm_varcon, only: spval -! -! !PUBLIC TYPES - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: -! - public Dustini ! Initialize variables used in subroutine Dust - public DustEmission ! Dust mobilization - public DustDryDep ! Turbulent dry deposition for dust -! -! !REVISION HISTORY -! Created by Sam Levis, updated to clm2.1 by Mariana Vertenstein -! Source: C. Zender's dust model -! -!EOP -! -! Data private to this module -! - private - real(r8) ovr_src_snk_mss(dst_src_nbr,ndst) - real(r8) tmp1 !Factor in saltation computation (named as in Charlie's code) - real(r8) dmt_vwr(ndst) ![m] Mass-weighted mean diameter resolved - real(r8) stk_crc(ndst) ![frc] Correction to Stokes settling velocity - real(r8) dns_aer ![kg m-3] Aerosol density -!------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: DustEmission -! -! !INTERFACE: - subroutine DustEmission (lbp, ubp, lbc,ubc,lbl,ubl,num_nolakep, filter_nolakep) -! -! !DESCRIPTION: -! Dust mobilization. This code simulates dust mobilization due to wind -! from the surface into the lowest atmospheric layer -! On output flx_mss_vrt_dst(ndst) is the surface dust emission -! (kg/m**2/s) [ + = to atm] -! Source: C. Zender's dust model -! -! !USES - use clm_atmlnd , only : clm_a2l - use shr_const_mod, only : SHR_CONST_RHOFW -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp,lbc,ubc,ubl,lbl ! pft bounds - integer, intent(in) :: num_nolakep ! number of column non-lake points in pft filter - integer, intent(in) :: filter_nolakep(num_nolakep) ! pft filter for non-lake points -! -! !LOCAL VARIABLES -! -! local pointers to implicit in arguments -! - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: ityplun(:) ! landunit type - real(r8), pointer :: tlai(:) ! one-sided leaf area index, no burying by snow - real(r8), pointer :: tsai(:) ! one-sided stem area index, no burying by snow - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: gwc_thr(:) ! threshold gravimetric soil moisture based on clay content - real(r8), pointer :: forc_rho(:) ! density (kg/m**3) - real(r8), pointer :: fv(:) ! friction velocity (m/s) (for dust model) - real(r8), pointer :: u10(:) ! 10-m wind (m/s) (created for dust model) - real(r8), pointer :: mbl_bsn_fct(:) ! basin factor - real(r8), pointer :: mss_frc_cly_vld(:) ! [frc] Mass fraction clay limited to 0.20 - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (0<=h2osoi_vol<=watsat) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid soil water (kg/m2) - real(r8), pointer :: h2osoi_ice(:,:) ! frozen soil water (kg/m2) - real(r8), pointer :: watsat(:,:) ! saturated volumetric soil water - -! local pointers to implicit out arguments -! - real(r8), pointer :: flx_mss_vrt_dst(:,:) ! surface dust emission (kg/m**2/s) - real(r8), pointer :: flx_mss_vrt_dst_tot(:) ! total dust flux into atmosphere - -! !REVISION HISTORY -! Created by Sam Levis -! Migrated to new data structures by Peter Thornton and Mariana Vertenstein -! !Created by Peter Thornton and Mariana Vertenstein -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: fp,p,c,l,g,m,n ! indices - real(r8) :: liqfrac ! fraction of total water that is liquid - real(r8) :: wnd_frc_rat ! [frc] Wind friction threshold over wind friction - real(r8) :: wnd_frc_slt_dlt ! [m s-1] Friction velocity increase from saltatn - real(r8) :: wnd_rfr_dlt ! [m s-1] Reference windspeed excess over threshld - real(r8) :: dst_slt_flx_rat_ttl - real(r8) :: flx_mss_hrz_slt_ttl - real(r8) :: flx_mss_vrt_dst_ttl(lbp:ubp) - real(r8) :: frc_thr_wet_fct - real(r8) :: frc_thr_rgh_fct - real(r8) :: wnd_frc_thr_slt - real(r8) :: wnd_rfr_thr_slt - real(r8) :: wnd_frc_slt - real(r8) :: lnd_frc_mbl(lbp:ubp) - real(r8) :: bd - real(r8) :: gwc_sfc - real(r8) :: ttlai(lbp:ubp) - real(r8) :: tlai_lu(lbl:ubl) -! -! constants -! - real(r8), parameter :: cst_slt = 2.61_r8 ! [frc] Saltation constant - real(r8), parameter :: flx_mss_fdg_fct = 5.0e-4_r8 ! [frc] Empir. mass flx tuning eflx_lh_vegt - real(r8), parameter :: vai_mbl_thr = 0.3_r8 ! [m2 m-2] VAI threshold quenching dust mobilization - real(r8), pointer :: wtlunit(:) ! weight of pft relative to landunit - real(r8) :: sumwt(lbl:ubl) ! sum of weights - logical :: found ! temporary for error check - integer :: index - -!------------------------------------------------------------------------ - - ! Assign local pointers to derived type scalar members (gridcell-level) - - forc_rho => clm_a2l%forc_rho - - ! Assign local pointers to derived type scalar members (landunit-level) - - ityplun => lun%itype - - ! Assign local pointers to derived type scalar members (column-level) - - frac_sno => cps%frac_sno - gwc_thr => cps%gwc_thr - mbl_bsn_fct => cps%mbl_bsn_fct - mss_frc_cly_vld => cps%mss_frc_cly_vld - h2osoi_vol => cws%h2osoi_vol - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - watsat => cps%watsat - - ! Assign local pointers to derived type scalar members (pft-level) - - pgridcell => pft%gridcell - plandunit => pft%landunit - pcolumn => pft%column - tlai => pps%tlai - tsai => pps%tsai - fv => pps%fv - u10 => pps%u10 - flx_mss_vrt_dst => pdf%flx_mss_vrt_dst - flx_mss_vrt_dst_tot => pdf%flx_mss_vrt_dst_tot - !local pointers from subgridAveMod/p2l_1d - wtlunit => pft%wtlunit - - ttlai(:) = 0._r8 -! make lai average at landunit level - do fp = 1,num_nolakep - p = filter_nolakep(fp) - ttlai(p) = tlai(p)+tsai(p) - enddo - - tlai_lu(:) = spval - sumwt(:) = 0._r8 - do p = lbp,ubp - if (ttlai(p) /= spval .and. wtlunit(p) /= 0._r8) then - c = pcolumn(p) - l = plandunit(p) - if (sumwt(l) == 0._r8) tlai_lu(l) = 0._r8 - tlai_lu(l) = tlai_lu(l) + ttlai(p) * wtlunit(p) - sumwt(l) = sumwt(l) + wtlunit(p) - end if - end do - found = .false. - do l = lbl,ubl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - exit - else if (sumwt(l) /= 0._r8) then - tlai_lu(l) = tlai_lu(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*) 'p2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun() - end if - -! Loop through pfts - -! initialize variables which get passed to the atmosphere - flx_mss_vrt_dst(lbp:ubp,:)=0._r8 - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - l = plandunit(p) - - ! the following code from subr. lnd_frc_mbl_get was adapted for lsm use - ! purpose: return fraction of each gridcell suitable for dust mobilization - - ! the "bare ground" fraction of the current sub-gridscale cell decreases - ! linearly from 1 to 0 as VAI(=tlai+tsai) increases from 0 to vai_mbl_thr - ! if ice sheet, wetland, or lake, no dust allowed - - if (ityplun(l) == istsoil .or. ityplun(l) == istcrop) then - if (tlai_lu(l) < vai_mbl_thr) then - lnd_frc_mbl(p) = 1.0_r8 - (tlai_lu(l))/vai_mbl_thr - else - lnd_frc_mbl(p) = 0.0_r8 - endif - lnd_frc_mbl(p) = lnd_frc_mbl(p) * (1.0_r8 - frac_sno(c)) - else - lnd_frc_mbl(p) = 0.0_r8 - end if - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p)>1.0_r8 .or. lnd_frc_mbl(p)<0.0_r8) then - write(iulog,*)'Error dstmbl: pft= ',p,' lnd_frc_mbl(p)= ',lnd_frc_mbl(p) - call endrun - end if - end do - - ! reset history output variables before next if-statement to avoid output = inf - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - flx_mss_vrt_dst_tot(p) = 0.0_r8 - end do - do n = 1, ndst - do fp = 1,num_nolakep - p = filter_nolakep(fp) - flx_mss_vrt_dst(p,n) = 0.0_r8 - end do - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - l = plandunit(p) - g = pgridcell(p) - - ! only perform the following calculations if lnd_frc_mbl is non-zero - - if (lnd_frc_mbl(p) > 0.0_r8) then - - ! the following comes from subr. frc_thr_rgh_fct_get - ! purpose: compute factor by which surface roughness increases threshold - ! friction velocity (currently a constant) - - frc_thr_rgh_fct = 1.0_r8 - - ! the following comes from subr. frc_thr_wet_fct_get - ! purpose: compute factor by which soil moisture increases threshold friction velocity - ! adjust threshold velocity for inhibition by moisture - ! modified 4/5/2002 (slevis) to use gravimetric instead of volumetric - ! water content - - bd = (1._r8-watsat(c,1))*2.7e3_r8 ![kg m-3] Bulk density of dry surface soil - gwc_sfc = h2osoi_vol(c,1)*SHR_CONST_RHOFW/bd ![kg kg-1] Gravimetric H2O cont - if (gwc_sfc > gwc_thr(c)) then - frc_thr_wet_fct = sqrt(1.0_r8 + 1.21_r8 * (100.0_r8*(gwc_sfc - gwc_thr(c)))**0.68_r8) - else - frc_thr_wet_fct = 1.0_r8 - end if - - ! slevis: adding liqfrac here, because related to effects from soil water - - liqfrac = max( 0.0_r8, min( 1.0_r8, h2osoi_liq(c,1) / (h2osoi_ice(c,1)+h2osoi_liq(c,1)+1.0e-6_r8) ) ) - - ! the following lines come from subr. dst_mbl - ! purpose: adjust threshold friction velocity to acct for moisture and - ! roughness. The ratio tmp1 / sqrt(forc_rho) comes from - ! subr. wnd_frc_thr_slt_get which computes dry threshold - ! friction velocity for saltation - - wnd_frc_thr_slt = tmp1 / sqrt(forc_rho(g)) * frc_thr_wet_fct * frc_thr_rgh_fct - - ! reset these variables which will be updated in the following if-block - - wnd_frc_slt = fv(p) - flx_mss_hrz_slt_ttl = 0.0_r8 - flx_mss_vrt_dst_ttl(p) = 0.0_r8 - - ! the following line comes from subr. dst_mbl - ! purpose: threshold saltation wind speed - - wnd_rfr_thr_slt = u10(p) * wnd_frc_thr_slt / fv(p) - - ! the following if-block comes from subr. wnd_frc_slt_get - ! purpose: compute the saltating friction velocity - ! theory: saltation roughens the boundary layer, AKA "Owen's effect" - - if (u10(p) >= wnd_rfr_thr_slt) then - wnd_rfr_dlt = u10(p) - wnd_rfr_thr_slt - wnd_frc_slt_dlt = 0.003_r8 * wnd_rfr_dlt * wnd_rfr_dlt - wnd_frc_slt = fv(p) + wnd_frc_slt_dlt - end if - - ! the following comes from subr. flx_mss_hrz_slt_ttl_Whi79_get - ! purpose: compute vertically integrated streamwise mass flux of particles - - if (wnd_frc_slt > wnd_frc_thr_slt) then - wnd_frc_rat = wnd_frc_thr_slt / wnd_frc_slt - flx_mss_hrz_slt_ttl = cst_slt * forc_rho(g) * (wnd_frc_slt**3.0_r8) * & - (1.0_r8 - wnd_frc_rat) * (1.0_r8 + wnd_frc_rat) * (1.0_r8 + wnd_frc_rat) / grav - - ! the following loop originates from subr. dst_mbl - ! purpose: apply land sfc and veg limitations and global tuning factor - ! slevis: multiply flx_mss_hrz_slt_ttl by liqfrac to incude the effect - ! of frozen soil - - flx_mss_hrz_slt_ttl = flx_mss_hrz_slt_ttl * lnd_frc_mbl(p) * mbl_bsn_fct(c) * & - flx_mss_fdg_fct * liqfrac - end if - - ! the following comes from subr. flx_mss_vrt_dst_ttl_MaB95_get - ! purpose: diagnose total vertical mass flux of dust from vertically - ! integrated streamwise mass flux - - dst_slt_flx_rat_ttl = 100.0_r8 * exp( log(10.0_r8) * (13.4_r8 * mss_frc_cly_vld(c) - 6.0_r8) ) - flx_mss_vrt_dst_ttl(p) = flx_mss_hrz_slt_ttl * dst_slt_flx_rat_ttl - - end if ! lnd_frc_mbl > 0.0 - - end do - - ! the following comes from subr. flx_mss_vrt_dst_prt in C. Zender's code - ! purpose: partition total vertical mass flux of dust into transport bins - - do n = 1, ndst - do m = 1, dst_src_nbr - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p) > 0.0_r8) then - flx_mss_vrt_dst(p,n) = flx_mss_vrt_dst(p,n) + ovr_src_snk_mss(m,n) * flx_mss_vrt_dst_ttl(p) - end if - end do - end do - end do - - do n = 1, ndst - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (lnd_frc_mbl(p) > 0.0_r8) then - flx_mss_vrt_dst_tot(p) = flx_mss_vrt_dst_tot(p) + flx_mss_vrt_dst(p,n) - end if - end do - end do - - end subroutine DustEmission - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: subroutine DustDryDep -! -! !INTERFACE: -! - subroutine DustDryDep (lbp, ubp) -! -! !DESCRIPTION: -! -! Determine Turbulent dry deposition for dust. Calculate the turbulent -! component of dust dry deposition, (the turbulent deposition velocity -! through the lowest atmospheric layer. CAM will calculate the settling -! velocity through the whole atmospheric column. The two calculations -! will determine the dust dry deposition flux to the surface. -! Note: Same process should occur over oceans. For the coupled CESM, -! we may find it more efficient to let CAM calculate the turbulent dep -! velocity over all surfaces. This would require passing the -! aerodynamic resistance, ram(1), and the friction velocity, fv, from -! the land to the atmosphere component. In that case, dustini need not -! calculate particle diamter (dmt_vwr) and particle density (dns_aer). -! Source: C. Zender's dry deposition code -! -! !USES -! - use shr_const_mod, only : SHR_CONST_PI, SHR_CONST_RDAIR, SHR_CONST_BOLTZ - use clm_atmlnd , only : clm_a2l -! -! !ARGUMENTS: -! - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds -! -! !LOCAL VARIABLES -! -! local pointers to implicit in arguments -! - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: ityplun(:) ! landunit type - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: forc_t(:) ! atm temperature (K) - real(r8), pointer :: forc_pbot(:) ! atm pressure (Pa) - real(r8), pointer :: forc_rho(:) ! atm density (kg/m**3) - real(r8), pointer :: fv(:) ! friction velocity (m/s) - real(r8), pointer :: ram1(:) ! aerodynamical resistance (s/m) - real(r8), pointer :: vlc_trb(:,:) ! Turbulent deposn velocity (m/s) - real(r8), pointer :: vlc_trb_1(:) ! Turbulent deposition velocity 1 - real(r8), pointer :: vlc_trb_2(:) ! Turbulent deposition velocity 2 - real(r8), pointer :: vlc_trb_3(:) ! Turbulent deposition velocity 3 - real(r8), pointer :: vlc_trb_4(:) ! Turbulent deposition velocity 4 -! -! !REVISION HISTORY -! Created by Sam Levis -! -! -! !LOCAL VARIABLES -!EOP -! - integer :: p,l,g,m,n ! indices - real(r8) :: vsc_dyn_atm(lbp:ubp) ! [kg m-1 s-1] Dynamic viscosity of air - real(r8) :: vsc_knm_atm(lbp:ubp) ! [m2 s-1] Kinematic viscosity of atmosphere - real(r8) :: shm_nbr_xpn ! [frc] Sfc-dep exponent for aerosol-diffusion dependence on Schmidt number - real(r8) :: shm_nbr ! [frc] Schmidt number - real(r8) :: stk_nbr ! [frc] Stokes number - real(r8) :: mfp_atm ! [m] Mean free path of air - real(r8) :: dff_aer ! [m2 s-1] Brownian diffusivity of particle - real(r8) :: rss_trb ! [s m-1] Resistance to turbulent deposition - real(r8) :: slp_crc(lbp:ubp,ndst) ! [frc] Slip correction factor - real(r8) :: vlc_grv(lbp:ubp,ndst) ! [m s-1] Settling velocity - real(r8) :: rss_lmn(lbp:ubp,ndst) ! [s m-1] Quasi-laminar layer resistance - real(r8) :: tmp ! temporary - -! constants - - real(r8),parameter::shm_nbr_xpn_lnd=-2._r8/3._r8 ![frc] shm_nbr_xpn over land -!------------------------------------------------------------------------ - - ! Assign local pointers to derived type members (gridcell-level) - - forc_pbot => clm_a2l%forc_pbot - forc_rho => clm_a2l%forc_rho - forc_t => clm_a2l%forc_t - - ! Assign local pointers to derived type members (landunit-level) - - ityplun => lun%itype - - ! Assign local pointers to derived type members (pft-level) - - plandunit => pft%landunit - pgridcell => pft%gridcell - pwtgcell => pft%wtgcell - fv => pps%fv - ram1 => pps%ram1 - vlc_trb => pdf%vlc_trb - vlc_trb_1 => pdf%vlc_trb_1 - vlc_trb_2 => pdf%vlc_trb_2 - vlc_trb_3 => pdf%vlc_trb_3 - vlc_trb_4 => pdf%vlc_trb_4 - - do p = lbp,ubp - l = plandunit(p) - ! Note: some glacier_mec pfts may have zero weight - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - g = pgridcell(p) - - ! from subroutine dst_dps_dry (consider adding sanity checks from line 212) - ! when code asks to use midlayer density, pressure, temperature, - ! I use the data coming in from the atmosphere, ie forc_t, forc_pbot, forc_rho - - ! Quasi-laminar layer resistance: call rss_lmn_get - ! Size-independent thermokinetic properties - - vsc_dyn_atm(p) = 1.72e-5_r8 * ((forc_t(g)/273.0_r8)**1.5_r8) * 393.0_r8 / & - (forc_t(g)+120.0_r8) ![kg m-1 s-1] RoY94 p. 102 - mfp_atm = 2.0_r8 * vsc_dyn_atm(p) / & ![m] SeP97 p. 455 - (forc_pbot(g)*sqrt(8.0_r8/(SHR_CONST_PI*SHR_CONST_RDAIR*forc_t(g)))) - vsc_knm_atm(p) = vsc_dyn_atm(p) / forc_rho(g) ![m2 s-1] Kinematic viscosity of air - - do m = 1, ndst - slp_crc(p,m) = 1.0_r8 + 2.0_r8 * mfp_atm * & - (1.257_r8+0.4_r8*exp(-1.1_r8*dmt_vwr(m)/(2.0_r8*mfp_atm))) / & - dmt_vwr(m) ![frc] Slip correction factor SeP97 p. 464 - vlc_grv(p,m) = (1.0_r8/18.0_r8) * dmt_vwr(m) * dmt_vwr(m) * dns_aer * & - grav * slp_crc(p,m) / vsc_dyn_atm(p) ![m s-1] Stokes' settling velocity SeP97 p. 466 - vlc_grv(p,m) = vlc_grv(p,m) * stk_crc(m) ![m s-1] Correction to Stokes settling velocity - end do - end if - end do - - do m = 1, ndst - do p = lbp,ubp - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - g = pgridcell(p) - - stk_nbr = vlc_grv(p,m) * fv(p) * fv(p) / (grav * vsc_knm_atm(p)) ![frc] SeP97 p.965 - dff_aer = SHR_CONST_BOLTZ * forc_t(g) * slp_crc(p,m) / & ![m2 s-1] - (3.0_r8*SHR_CONST_PI * vsc_dyn_atm(p) * dmt_vwr(m)) !SeP97 p.474 - shm_nbr = vsc_knm_atm(p) / dff_aer ![frc] SeP97 p.972 - shm_nbr_xpn = shm_nbr_xpn_lnd ![frc] - - ! fxm: Turning this on dramatically reduces - ! deposition velocity in low wind regimes - ! Schmidt number exponent is -2/3 over solid surfaces and - ! -1/2 over liquid surfaces SlS80 p. 1014 - ! if (oro(i)==0.0) shm_nbr_xpn=shm_nbr_xpn_ocn else shm_nbr_xpn=shm_nbr_xpn_lnd - ! [frc] Surface-dependent exponent for aerosol-diffusion dependence on Schmidt # - - tmp = shm_nbr**shm_nbr_xpn + 10.0_r8**(-3.0_r8/stk_nbr) - rss_lmn(p,m) = 1.0_r8 / (tmp * fv(p)) ![s m-1] SeP97 p.972,965 - end if - end do - end do - - ! Lowest layer: Turbulent deposition (CAM will calc. gravitational dep) - - do m = 1, ndst - do p = lbp,ubp - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - rss_trb = ram1(p) + rss_lmn(p,m) + ram1(p) * rss_lmn(p,m) * vlc_grv(p,m) ![s m-1] - vlc_trb(p,m) = 1.0_r8 / rss_trb ![m s-1] - end if - end do - end do - - do p = lbp,ubp - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - vlc_trb_1(p) = vlc_trb(p,1) - vlc_trb_2(p) = vlc_trb(p,2) - vlc_trb_3(p) = vlc_trb(p,3) - vlc_trb_4(p) = vlc_trb(p,4) - end if - end do - - end subroutine DustDryDep - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: subroutine Dustini -! -! !INTERFACE: -! - subroutine Dustini() -! -! !DESCRIPTION: -! -! Compute source efficiency factor from topography -! Initialize other variables used in subroutine Dust: -! ovr_src_snk_mss(m,n) and tmp1. -! Define particle diameter and density needed by atm model -! as well as by dry dep model -! Source: Paul Ginoux (for source efficiency factor) -! Modifications by C. Zender and later by S. Levis -! Rest of subroutine from C. Zender's dust model -! -! !USES - use shr_const_mod, only: SHR_CONST_PI, SHR_CONST_RDAIR - use decompMod, only : get_proc_bounds - use shr_spfn_mod, only: erf => shr_spfn_erf -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY -! Created by Samual Levis -! -! !LOCAL VARIABLES -! -! local pointers to implicit in arguments -! - real(r8), pointer :: mbl_bsn_fct(:) !basin factor -! -! -! !LOCAL VARIABLES -!EOP -! - integer :: fc,c,l,m,n ! indices - real(r8) :: ovr_src_snk_frc - real(r8) :: sqrt2lngsdi ! [frc] Factor in erf argument - real(r8) :: lndmaxjovrdmdni ! [frc] Factor in erf argument - real(r8) :: lndminjovrdmdni ! [frc] Factor in erf argument - real(r8) :: ryn_nbr_frc_thr_prx_opt ! [frc] Threshold friction Reynolds number approximation for optimal size - real(r8) :: ryn_nbr_frc_thr_opt_fnc ! [frc] Threshold friction Reynolds factor for saltation calculation - real(r8) :: icf_fct ! Interpartical cohesive forces factor for saltation calc - real(r8) :: dns_fct ! Density ratio factor for saltation calculation - real(r8) :: dmt_min(ndst) ! [m] Size grid minimum - real(r8) :: dmt_max(ndst) ! [m] Size grid maximum - real(r8) :: dmt_ctr(ndst) ! [m] Diameter at bin center - real(r8) :: dmt_dlt(ndst) ! [m] Width of size bin - real(r8) :: slp_crc(ndst) ! [frc] Slip correction factor - real(r8) :: vlm_rsl(ndst) ! [m3 m-3] Volume concentration resolved - real(r8) :: vlc_stk(ndst) ! [m s-1] Stokes settling velocity - real(r8) :: vlc_grv(ndst) ! [m s-1] Settling velocity - real(r8) :: ryn_nbr_grv(ndst) ! [frc] Reynolds number at terminal velocity - real(r8) :: cff_drg_grv(ndst) ! [frc] Drag coefficient at terminal velocity - real(r8) :: tmp ! temporary - real(r8) :: ln_gsd ! [frc] ln(gsd) - real(r8) :: gsd_anl ! [frc] Geometric standard deviation - real(r8) :: dmt_vma ! [m] Mass median diameter analytic She84 p.75 Tabl.1 - real(r8) :: dmt_nma ! [m] Number median particle diameter - real(r8) :: lgn_dst ! Lognormal distribution at sz_ctr - real(r8) :: eps_max ! [frc] Relative accuracy for convergence - real(r8) :: eps_crr ! [frc] Current relative accuracy - real(r8) :: itr_idx ! [idx] Counting index - real(r8) :: dns_mdp ! [kg m-3] Midlayer density - real(r8) :: mfp_atm ! [m] Mean free path of air - real(r8) :: vsc_dyn_atm ! [kg m-1 s-1] Dynamic viscosity of air - real(r8) :: vsc_knm_atm ! [kg m-1 s-1] Kinematic viscosity of air - real(r8) :: vlc_grv_old ! [m s-1] Previous gravitational settling velocity - real(r8) :: series_ratio ! Factor for logarithmic grid - real(r8) :: lngsdsqrttwopi_rcp ! Factor in lognormal distribution - real(r8) :: sz_min(sz_nbr) ! [m] Size Bin minima - real(r8) :: sz_max(sz_nbr) ! [m] Size Bin maxima - real(r8) :: sz_ctr(sz_nbr) ! [m] Size Bin centers - real(r8) :: sz_dlt(sz_nbr) ! [m] Size Bin widths - - ! constants - real(r8) :: dmt_vma_src(dst_src_nbr) = & ! [m] Mass median diameter - (/ 0.832e-6_r8 , 4.82e-6_r8 , 19.38e-6_r8 /) ! BSM96 p. 73 Table 2 - real(r8) :: gsd_anl_src(dst_src_nbr) = & ! [frc] Geometric std deviation - (/ 2.10_r8 , 1.90_r8 , 1.60_r8 /) ! BSM96 p. 73 Table 2 - real(r8) :: mss_frc_src(dst_src_nbr) = & ! [frc] Mass fraction - (/ 0.036_r8, 0.957_r8, 0.007_r8 /) ! BSM96 p. 73 Table 2 - real(r8) :: dmt_grd(5) = & ! [m] Particle diameter grid - (/ 0.1e-6_r8, 1.0e-6_r8, 2.5e-6_r8, 5.0e-6_r8, 10.0e-6_r8 /) - real(r8), parameter :: dmt_slt_opt = 75.0e-6_r8 ! [m] Optim diam for saltation - real(r8), parameter :: dns_slt = 2650.0_r8 ! [kg m-3] Density of optimal saltation particles - - ! declare erf intrinsic function - real(r8) :: dum ! dummy variable for erf test - - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices -!------------------------------------------------------------------------ - - ! Assign local pointers to derived type scalar members (column-level) - - mbl_bsn_fct => cps%mbl_bsn_fct - - ! the following comes from (1) szdstlgn.F subroutine ovr_src_snk_frc_get - ! and (2) dstszdst.F subroutine dst_szdst_ini - ! purpose(1): given one set (the "source") of lognormal distributions, - ! and one set of bin boundaries (the "sink"), compute and return - ! the overlap factors between the source and sink distributions - ! purpose(2): set important statistics of size distributions - - do m = 1, dst_src_nbr - sqrt2lngsdi = sqrt(2.0_r8) * log(gsd_anl_src(m)) - do n = 1, ndst - lndmaxjovrdmdni = log(dmt_grd(n+1)/dmt_vma_src(m)) - lndminjovrdmdni = log(dmt_grd(n )/dmt_vma_src(m)) - ovr_src_snk_frc = 0.5_r8 * (erf(lndmaxjovrdmdni/sqrt2lngsdi) - & - erf(lndminjovrdmdni/sqrt2lngsdi)) - ovr_src_snk_mss(m,n) = ovr_src_snk_frc * mss_frc_src(m) - end do - end do - - ! The following code from subroutine wnd_frc_thr_slt_get was placed - ! here because tmp1 needs to be defined just once - - ryn_nbr_frc_thr_prx_opt = 0.38_r8 + 1331.0_r8 * (100.0_r8*dmt_slt_opt)**1.56_r8 - - if (ryn_nbr_frc_thr_prx_opt < 0.03_r8) then - write(iulog,*) 'dstmbl: ryn_nbr_frc_thr_prx_opt < 0.03' - call endrun - else if (ryn_nbr_frc_thr_prx_opt < 10.0_r8) then - ryn_nbr_frc_thr_opt_fnc = -1.0_r8 + 1.928_r8 * (ryn_nbr_frc_thr_prx_opt**0.0922_r8) - ryn_nbr_frc_thr_opt_fnc = 0.1291_r8 * 0.1291_r8 / ryn_nbr_frc_thr_opt_fnc - else - ryn_nbr_frc_thr_opt_fnc = 1.0_r8 - 0.0858_r8 * exp(-0.0617_r8*(ryn_nbr_frc_thr_prx_opt-10.0_r8)) - ryn_nbr_frc_thr_opt_fnc = 0.120_r8 * 0.120_r8 * ryn_nbr_frc_thr_opt_fnc * ryn_nbr_frc_thr_opt_fnc - end if - - icf_fct = 1.0_r8 + 6.0e-07_r8 / (dns_slt * grav * (dmt_slt_opt**2.5_r8)) - dns_fct = dns_slt * grav * dmt_slt_opt - tmp1 = sqrt(icf_fct * dns_fct * ryn_nbr_frc_thr_opt_fnc) - - ! Set basin factor to 1 for now - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - do c = begc, endc - l = col%landunit(c) - if (.not. lun%lakpoi(l)) then - mbl_bsn_fct(c) = 1.0_r8 - end if - end do - - ! Introducing particle diameter. Needed by atm model and by dry dep model. - ! Taken from Charlie Zender's subroutines dst_psd_ini, dst_sz_rsl, - ! grd_mk (dstpsd.F90) and subroutine lgn_evl (psdlgn.F90) - - ! Charlie allows logarithmic or linear option for size distribution - ! however, he hardwires the distribution to logarithmic in his code - ! therefore, I take his logarithmic code only - ! furthermore, if dst_nbr == 4, he overrides the automatic grid calculation - ! he currently works with dst_nbr = 4, so I only take the relevant code - ! if ndst ever becomes different from 4, must add call grd_mk (dstpsd.F90) - ! as done in subroutine dst_psd_ini - ! note that here ndst = dst_nbr - - ! Override automatic grid with preset grid if available - - if (ndst == 4) then - do n = 1, ndst - dmt_min(n) = dmt_grd(n) ![m] Max diameter in bin - dmt_max(n) = dmt_grd(n+1) ![m] Min diameter in bin - dmt_ctr(n) = 0.5_r8 * (dmt_min(n)+dmt_max(n)) ![m] Diameter at bin ctr - dmt_dlt(n) = dmt_max(n)-dmt_min(n) ![m] Width of size bin - end do - else - write(iulog,*) 'Dustini error: ndst must equal to 4 with current code' - call endrun !see more comments above - end if !end if ndst == 4 - - ! Bin physical properties - - gsd_anl = 2.0_r8 ! [frc] Geometric std dev PaG77 p. 2080 Table1 - ln_gsd = log(gsd_anl) - dns_aer = 2.5e+3_r8 ! [kg m-3] Aerosol density - - ! Set a fundamental statistic for each bin - - dmt_vma = 3.5000e-6_r8 ! [m] Mass median diameter analytic She84 p.75 Table1 - - ! Compute analytic size statistics - ! Convert mass median diameter to number median diameter (call vma2nma) - - dmt_nma = dmt_vma * exp(-3.0_r8*ln_gsd*ln_gsd) ! [m] - - ! Compute resolved size statistics for each size distribution - ! In C. Zender's code call dst_sz_rsl - - do n = 1, ndst - - series_ratio = (dmt_max(n)/dmt_min(n))**(1.0_r8/sz_nbr) - sz_min(1) = dmt_min(n) - do m = 2, sz_nbr ! Loop starts at 2 - sz_min(m) = sz_min(m-1) * series_ratio - end do - - ! Derived grid values - do m = 1, sz_nbr-1 ! Loop ends at sz_nbr-1 - sz_max(m) = sz_min(m+1) ! [m] - end do - sz_max(sz_nbr) = dmt_max(n) ! [m] - - ! Final derived grid values - do m = 1, sz_nbr - sz_ctr(m) = 0.5_r8 * (sz_min(m)+sz_max(m)) - sz_dlt(m) = sz_max(m)-sz_min(m) - end do - - lngsdsqrttwopi_rcp = 1.0_r8 / (ln_gsd*sqrt(2.0_r8*SHR_CONST_PI)) - dmt_vwr(n) = 0.0_r8 ! [m] Mass wgted diameter resolved - vlm_rsl(n) = 0.0_r8 ! [m3 m-3] Volume concentration resolved - - do m = 1, sz_nbr - - ! Evaluate lognormal distribution for these sizes (call lgn_evl) - tmp = log(sz_ctr(m)/dmt_nma) / ln_gsd - lgn_dst = lngsdsqrttwopi_rcp * exp(-0.5_r8*tmp*tmp) / sz_ctr(m) - - ! Integrate moments of size distribution - dmt_vwr(n) = dmt_vwr(n) + sz_ctr(m) * & - SHR_CONST_PI / 6.0_r8 * (sz_ctr(m)**3.0_r8) * & ![m3] Volume - lgn_dst * sz_dlt(m) ![# m-3] Number concentrn - vlm_rsl(n) = vlm_rsl(n) + & - SHR_CONST_PI / 6.0_r8 * (sz_ctr(m)**3.0_r8) * & ![m3] Volume - lgn_dst * sz_dlt(m) ![# m-3] Number concentrn - - end do - - dmt_vwr(n) = dmt_vwr(n) / vlm_rsl(n) ![m] Mass weighted diameter resolved - - end do - - ! calculate correction to Stokes' settling velocity (subroutine stk_crc_get) - - eps_max = 1.0e-4_r8 - dns_mdp = 100000._r8 / (295.0_r8*SHR_CONST_RDAIR) ![kg m-3] const prs_mdp & tpt_vrt - - ! Size-independent thermokinetic properties - - vsc_dyn_atm = 1.72e-5_r8 * ((295.0_r8/273.0_r8)**1.5_r8) * 393.0_r8 / & - (295.0_r8+120.0_r8) ![kg m-1 s-1] RoY94 p.102 tpt_mdp=295.0 - mfp_atm = 2.0_r8 * vsc_dyn_atm / & !SeP97 p. 455 constant prs_mdp, tpt_mdp - (100000._r8*sqrt(8.0_r8/(SHR_CONST_PI*SHR_CONST_RDAIR*295.0_r8))) - vsc_knm_atm = vsc_dyn_atm / dns_mdp ![m2 s-1] Kinematic viscosity of air - - do m = 1, ndst - slp_crc(m) = 1.0_r8 + 2.0_r8 * mfp_atm * & - (1.257_r8+0.4_r8*exp(-1.1_r8*dmt_vwr(m)/(2.0_r8*mfp_atm))) / & - dmt_vwr(m) ! [frc] Slip correction factor SeP97 p.464 - vlc_stk(m) = (1.0_r8/18.0_r8) * dmt_vwr(m) * dmt_vwr(m) * dns_aer * & - grav * slp_crc(m) / vsc_dyn_atm ! [m s-1] SeP97 p.466 - end do - - ! For Reynolds number flows Re < 0.1 Stokes' velocity is valid for - ! vlc_grv SeP97 p. 466 (8.42). For larger Re, inertial effects become - ! important and empirical drag coefficients must be employed - ! Implicit equation for Re, Cd, and Vt is SeP97 p. 467 (8.44) - ! Using Stokes' velocity rather than iterative solution with empirical - ! drag coefficient causes 60% errors for D = 200 um SeP97 p. 468 - - ! Iterative solution for drag coefficient, Reynolds number, and terminal veloc - do m = 1, ndst - - ! Initialize accuracy and counter - eps_crr = eps_max + 1.0_r8 ![frc] Current relative accuracy - itr_idx = 0 ![idx] Counting index - - ! Initial guess for vlc_grv is exact for Re < 0.1 - vlc_grv(m) = vlc_stk(m) ![m s-1] - - do while(eps_crr > eps_max) - - ! Save terminal velocity for convergence test - vlc_grv_old = vlc_grv(m) ![m s-1] - ryn_nbr_grv(m) = vlc_grv(m) * dmt_vwr(m) / vsc_knm_atm !SeP97 p.460 - - ! Update drag coefficient based on new Reynolds number - if (ryn_nbr_grv(m) < 0.1_r8) then - cff_drg_grv(m) = 24.0_r8 / ryn_nbr_grv(m) !Stokes' law Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 2.0_r8) then - cff_drg_grv(m) = (24.0_r8/ryn_nbr_grv(m)) * & - (1.0_r8 + 3.0_r8*ryn_nbr_grv(m)/16.0_r8 + & - 9.0_r8*ryn_nbr_grv(m)*ryn_nbr_grv(m)* & - log(2.0_r8*ryn_nbr_grv(m))/160.0_r8) !Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 500.0_r8) then - cff_drg_grv(m) = (24.0_r8/ryn_nbr_grv(m)) * & - (1.0_r8 + 0.15_r8*ryn_nbr_grv(m)**0.687_r8) !Sep97 p.463 (8.32) - else if (ryn_nbr_grv(m) < 2.0e5_r8) then - cff_drg_grv(m) = 0.44_r8 !Sep97 p.463 (8.32) - else - write(iulog,'(a,es9.2)') "ryn_nbr_grv(m) = ",ryn_nbr_grv(m) - write(iulog,*)'Dustini error: Reynolds number too large in stk_crc_get()' - call endrun - end if - - ! Update terminal velocity based on new Reynolds number and drag coeff - ! [m s-1] Terminal veloc SeP97 p.467 (8.44) - - vlc_grv(m) = sqrt(4.0_r8 * grav * dmt_vwr(m) * slp_crc(m) * dns_aer / & - (3.0_r8*cff_drg_grv(m)*dns_mdp)) - eps_crr = abs((vlc_grv(m)-vlc_grv_old)/vlc_grv(m)) !Relative convergence - if (itr_idx == 12) then - ! Numerical pingpong may occur when Re = 0.1, 2.0, or 500.0 - ! due to discontinuities in derivative of drag coefficient - vlc_grv(m) = 0.5_r8 * (vlc_grv(m)+vlc_grv_old) ! [m s-1] - end if - if (itr_idx > 20) then - write(iulog,*) 'Dustini error: Terminal velocity not converging ',& - ' in stk_crc_get(), breaking loop...' - goto 100 !to next iteration - end if - itr_idx = itr_idx + 1 - - end do !end while - -100 continue !Label to jump to when iteration does not converge - end do !end loop over size - - ! Compute factors to convert Stokes' settling velocities to - ! actual settling velocities - - do m = 1, ndst - stk_crc(m) = vlc_grv(m) / vlc_stk(m) - end do - - end subroutine Dustini - -end module DUSTMod diff --git a/src_clm40/biogeochem/DryDepVelocity.F90 b/src_clm40/biogeochem/DryDepVelocity.F90 deleted file mode 100644 index deb64f3dc1..0000000000 --- a/src_clm40/biogeochem/DryDepVelocity.F90 +++ /dev/null @@ -1,608 +0,0 @@ -Module DryDepVelocity - - !----------------------------------------------------------------------- - ! - ! Purpose: - ! Deposition velocity (m/s) - ! - ! Method: - ! This code simulates dry deposition velocities using the Wesely scheme. - ! Details of this method can be found in: - ! - ! M.L Wesely. Parameterization of surface resistances to gaseous dry deposition - ! in regional-scale numericl models. 1989. Atmospheric Environment vol.23 No.6 - ! pp. 1293-1304. - ! - ! In Wesely (1998) "the magnitude of the dry deposition velocity can be found - ! as: - ! - ! |vd|=(ra+rb+rc)^-1 - ! - ! where ra is the aerodynamic resistance (common to all gases) between a - ! specific height and the surface, rb is the quasilaminar sublayer resistance - ! (whose only dependence on the porperties of the gas of interest is its - ! molecular diffusivity in air), and rc is the bulk surface resistance". - ! - ! In this subroutine both ra and rb are calculated elsewhere in CLM. Thus ra - ! and rb were "globalized" in order to gain access to them for the calculation. - ! "ram1" is the CLM variable used for ra. ram1 was globalized in the following - ! subroutines; BareGroundFluxes.F90, Biogeophysics_lake.F90, CanopyFluxes.F90, - ! and clmtype.F90. - ! - ! "rb" is the CLM variable used for rb in the Wesely equation above. rb was - ! globalized in the following subroutines; clmtype.F90 - ! - ! In Wesely (1989) rc is estimated for five seasonal categories and 11 landuse - ! types. For each season and landuse type, Wesely compiled data into a - ! look-up-table for several parameters used to calculate rc. In this subroutine - ! the same values are used as found in wesely's look-up-tables, the only - ! difference is that this subroutine uses a CLM generated LAI to select values - ! from the look-up-table instead of seasonality. Inaddition, Wesely(1989) - ! land use types are "mapped" into CLM plant function types (PFT). - ! - ! Subroutine written to operate at the patch level. - ! - ! Output: - ! - ! vd(n_species) !Dry deposition velocity [m s-1] for each molecule or species - ! - ! Author: Beth Holland and James Sulzman - ! - ! Modified: Francis Vitt -- 30 Mar 2007 - ! Modified: Maria Val Martin -- 15 Jan 2014 - ! Corrected major bugs in the leaf and stomatal resitances. The code is now - ! coupled to LAI and Rs uses the Ball-Berry Scheme. Also, corrected minor - ! bugs in rlu and rcl calculations. Added - ! no vegetation removal for CO. See README for details and - ! Val Martin et al., 2014 GRL for major corrections - ! - !********* !!! IMPORTANT !!! ************ - ! STOMATAL RESISTANCE IS OPTIMIZED TO MATCH UP OBSERVATIONS - !----------------------------------------------------------------------- - - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use abortutils, only : endrun - use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time - use clm_atmlnd, only : clm_a2l - use spmdMod, only : masterproc - use seq_drydep_mod, only : n_drydep, drydep_list - use seq_drydep_mod, only : drydep_method, DD_XLND - use seq_drydep_mod, only : index_o3=>o3_ndx, index_o3a=>o3a_ndx, index_so2=>so2_ndx, index_h2=>h2_ndx, & - index_co=>co_ndx, index_ch4=>ch4_ndx, index_pan=>pan_ndx, & - index_xpan=>xpan_ndx - implicit none - save - - private - - public :: depvel_compute - -CONTAINS - - !----------------------------------------------------------------------- - ! computes the dry deposition velocity of tracers - !----------------------------------------------------------------------- - subroutine depvel_compute( lbp , ubp ) - use shr_const_mod , only : tmelt => shr_const_tkfrz - use seq_drydep_mod , only : seq_drydep_setHCoeff, mapping, drat, foxd, & - rcls, h2_a, h2_b, h2_c, ri, rac, rclo, rlu, & - rgss, rgso - use clm_varcon , only : istsoil, istice, istice_mec, istslak, istdlak, istwet, isturb - use clm_varctl , only : iulog - use pftvarcon , only : noveg, ndllf_evr_tmp_tree, ndllf_evr_brl_tree, & - ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree, & - nbrdlf_evr_tmp_tree, nbrdlf_dcd_trp_tree, & - nbrdlf_dcd_tmp_tree, nbrdlf_dcd_brl_tree, & - nbrdlf_evr_shrub, nbrdlf_dcd_tmp_shrub, & - nbrdlf_dcd_brl_shrub, nc3_arctic_grass, & - nc3_nonarctic_grass, nc4_grass, nc3crop, & - nirrig, npcropmin, npcropmax - - implicit none - - !----Arguments----------------------------------------------------- - - integer, intent(in) :: lbp, ubp ! pft bounds - - ! ------------------------ local variables ------------------------ - ! local pointers to implicit in arguments - integer , pointer :: plandunit(:) !pft's landunit index - integer , pointer :: ivt(:) !landunit type - integer , pointer :: itypveg(:) !vegetation type for current pft - integer , pointer :: pgridcell(:) !pft's gridcell index - real(r8), pointer :: pwtgcell(:) !weight of pft relative to corresponding gridcell - real(r8), pointer :: elai(:) !one-sided leaf area index with burying by snow - real(r8), pointer :: forc_t(:) !atmospheric temperature (Kelvin) - real(r8), pointer :: forc_q(:) !atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_psrf(:) !surface pressure (Pa) - real(r8), pointer :: latdeg(:) !latitude (degrees) - real(r8), pointer :: londeg(:) !longitude (degrees) - real(r8), pointer :: forc_rain(:) !rain rate [mm/s] - real(r8), pointer :: forc_snow(:) !snow rate [mm/s] - real(r8), pointer :: forc_lwrad(:) !direct beam radiation (visible only) - real(r8), pointer :: forc_solad(:,:) !direct beam radiation (visible only) - real(r8), pointer :: forc_solai(:,:) !direct beam radiation (visible only) - real(r8), pointer :: ram1(:) !aerodynamical resistance - real(r8), pointer :: vds(:) !aerodynamical resistance - real(r8), pointer :: rssun(:) !stomatal resistance - real(r8), pointer :: rssha(:) !shaded stomatal resistance (s/m) - real(r8), pointer :: fsun(:) !sunlit fraction of canopy - real(r8), pointer :: rb1(:) !leaf boundary layer resistance [s/m] - real(r8), pointer :: annlai(:,:) !12 months of monthly lai from input data set - real(r8), pointer :: mlaidiff(:) !difference in lai between month one and month two - real(r8), pointer :: velocity(:,:) - real(r8), pointer :: snowdp(:) ! snow height (m) - - integer, pointer :: pcolumn(:) ! column index associated with each pft - integer :: c - integer , pointer :: itypelun(:) ! landunit type - - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (0<=h2osoi_vol<=watsat) - real(r8) :: soilw, var_soilw, fact_h2, dv_soil_h2 - - ! new local variables - integer :: pi,g, l - integer :: ispec - integer :: length - integer :: wesveg !wesely vegegation index - integer :: clmveg !clm veg index from ivegtype - integer :: i - integer :: index_season !seasonal index based on LAI. This indexs wesely data tables - integer :: nstep !current step - integer :: indexp - - real(r8) :: pg ! surface pressure - real(r8) :: tc ! temperature in celsius - real(r8) :: rs ! constant for calculating rsmx - real(r8) :: es ! saturation vapor pressur - real(r8) :: ws ! saturation mixing ratio - real(r8) :: rmx ! resistance by vegetation - real(r8) :: qs ! saturation specific humidity - real(r8) :: dewm ! multiplier for rs when dew occurs - real(r8) :: crs ! multiplier to calculate crs - real(r8) :: rdc ! part of lower canopy resistance - real(r8) :: rain ! rain fall - real(r8) :: spec_hum ! specific humidity - real(r8) :: solar_flux ! solar radiation(direct beam) W/m2 - real(r8) :: lat ! latitude in degrees - real(r8) :: lon ! longitude in degrees - real(r8) :: sfc_temp ! surface temp - real(r8) :: minlai ! minimum of monthly lai - real(r8) :: maxlai ! maximum of monthly lai - real(r8) :: rds ! resistance for aerosols - - !mvm 11/30/2013 - real(r8) :: rlu_lai ! constant to calculate rlu over bulk canopy - real(r8) :: rs_factor ! constant to optimize stomatal resistance - - logical :: has_dew - logical :: has_rain - real(r8), parameter :: rain_threshold = 1.e-7_r8 ! of the order of 1cm/day expressed in m/s - - ! local arrays: dependent on species only - ! - - real(r8), dimension(n_drydep) :: rsmx !vegetative resistance (plant mesophyll) - real(r8), dimension(n_drydep) :: rclx !lower canopy resistance - real(r8), dimension(n_drydep) :: rlux !vegetative resistance (upper canopy) - real(r8), dimension(n_drydep) :: rgsx !gournd resistance - real(r8), dimension(n_drydep) :: heff - real(r8) :: rc !combined surface resistance - real(r8) :: cts !correction to flu rcl and rgs for frost - real(r8) :: rlux_o3 !to calculate O3 leaf resistance in dew/rain conditions - - ! constants - real(r8), parameter :: slope = 0._r8 ! Used to calculate rdc in (lower canopy resistance) - integer, parameter :: wveg_unset = -1 ! Unset Wesley vegetation type - - character(len=32), parameter :: subname = "depvel_compute" - - !------------------------------------------------------------------------------------- - ! jfl : mods for PAN - !------------------------------------------------------------------------------------- - real(r8) :: dv_pan - real(r8) :: c0_pan(11) = (/ 0.000_r8, 0.006_r8, 0.002_r8, 0.009_r8, 0.015_r8, & - 0.006_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.002_r8, 0.002_r8 /) - real(r8) :: k_pan (11) = (/ 0.000_r8, 0.010_r8, 0.005_r8, 0.004_r8, 0.003_r8, & - 0.005_r8, 0.000_r8, 0.000_r8, 0.000_r8, 0.075_r8, 0.002_r8 /) - !----------------------------------------------------------------------- - if ( n_drydep == 0 .or. drydep_method /= DD_XLND ) return - - ! local pointers to original implicit out arrays - - ! Assign local pointers to derived subtypes components (column-level) - forc_t => clm_a2l%forc_t - forc_q => clm_a2l%forc_q - forc_psrf => clm_a2l%forc_pbot - forc_rain => clm_a2l%forc_rain - - latdeg => grc%latdeg - londeg => grc%londeg - ivt => pft%itype - elai => pps%elai - ram1 => pps%ram1 - vds => pps%vds - fsun => pps%fsun - rssun => pps%rssun - rssha => pps%rssha - rb1 => pps%rb1 - mlaidiff => pps%mlaidiff - annlai => pps%annlai - - forc_solai => clm_a2l%forc_solai - forc_solad => clm_a2l%forc_solad - - pwtgcell => pft%wtgcell - pgridcell => pft%gridcell - plandunit => pft%landunit - - pcolumn => pft%column - itypelun => lun%itype - - h2osoi_vol => cws%h2osoi_vol - - velocity => pdd%drydepvel ! cm/sec - - snowdp => cps%snowdp - - ! Assign local pointers to original implicit out arrays - !_________________________________________________________________ - ! - ! Begin loop through pfts - pft_loop: do pi = lbp,ubp - l = plandunit(pi) - - ! Note: some glacier_mec pfts may have zero weight - gcell_wght: if (pwtgcell(pi)>0._r8 .or. itypelun(l)==istice_mec) then - - c = pcolumn(pi) - g = pgridcell(pi) - pg = forc_psrf(g) - spec_hum = forc_q(g) - rain = forc_rain(g) - sfc_temp = forc_t(g) - lat = latdeg(g) - lon = londeg(g) - solar_flux = forc_solad(g,1) - clmveg = ivt(pi) - soilw = h2osoi_vol(c,1) - - !map CLM veg type into Wesely veg type - wesveg = wveg_unset - if (clmveg == noveg ) wesveg = 8 - if (clmveg == ndllf_evr_tmp_tree ) wesveg = 5 - if (clmveg == ndllf_evr_brl_tree ) wesveg = 5 - if (clmveg == ndllf_dcd_brl_tree ) wesveg = 5 - if (clmveg == nbrdlf_evr_trp_tree ) wesveg = 4 - if (clmveg == nbrdlf_evr_tmp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_trp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_tmp_tree ) wesveg = 4 - if (clmveg == nbrdlf_dcd_brl_tree ) wesveg = 4 - if (clmveg == nbrdlf_evr_shrub ) wesveg = 11 - if (clmveg == nbrdlf_dcd_tmp_shrub ) wesveg = 11 - if (clmveg == nbrdlf_dcd_brl_shrub ) wesveg = 11 - if (clmveg == nc3_arctic_grass ) wesveg = 3 - if (clmveg == nc3_nonarctic_grass ) wesveg = 3 - if (clmveg == nc4_grass ) wesveg = 3 - if (clmveg == nc3crop ) wesveg = 2 - if (clmveg == nirrig ) wesveg = 2 - if (clmveg >= npcropmin .and. clmveg <= npcropmax ) wesveg = 2 - if (wesveg == wveg_unset )then - write(iulog,*) 'clmveg = ', clmveg, 'itypelun = ', itypelun(l) - call endrun( subname//': Not able to determine Wesley vegetation type') - end if - - ! create seasonality index used to index wesely data tables from LAI, Bascially - !if elai is between max lai from input data and half that max the index_season=1 - - - !mail1j and mlai2j are the two monthly lai values pulled from a CLM input data set - !/fs/cgd/csm/inputdata/lnd/clm2/rawdata/mksrf_lai.nc. lai for dates in the middle - !of the month are interpolated using using these values and stored in the variable - !elai (done elsewhere). If the difference between mlai1j and mlai2j is greater - !than zero it is assumed to be fall and less than zero it is assumed to be spring. - - !wesely seasonal "index_season" - ! 1 - midsummer with lush vegetation - ! 2 - Autumn with unharvested cropland - ! 3 - Late autumn after frost, no snow - ! 4 - Winter, snow on ground and subfreezing - ! 5 - Transitional spring with partially green short annuals - - - !mlaidiff=jan-feb - minlai=minval(annlai(:,pi)) - maxlai=maxval(annlai(:,pi)) - - index_season = -1 - - if ( itypelun(l) /= istsoil )then - if ( itypelun(l) == istice .or. itypelun(l) == istice_mec ) then - wesveg = 8 - index_season = 4 - elseif ( itypelun(l) == istdlak .or. itypelun(l) == istslak ) then - wesveg = 7 - index_season = 4 - elseif ( itypelun(l) == istwet ) then - wesveg = 9 - index_season = 2 - elseif ( itypelun(l) == isturb ) then - wesveg = 1 - index_season = 2 - end if - else if ( snowdp(c) > 0 ) then - index_season = 4 - else if(elai(pi).gt.0.5_r8*maxlai) then - index_season = 1 - endif - - if (index_season<0) then - if (elai(pi).lt.(minlai+0.05*(maxlai-minlai))) then - index_season = 3 - endif - endif - - if (index_season<0) then - if (mlaidiff(pi).gt.0.0_r8) then - index_season = 2 - elseif (mlaidiff(pi).lt.0.0_r8) then - index_season = 5 - elseif (mlaidiff(pi).eq.0.0_r8) then - index_season = 3 - endif - endif - - if (index_season<0) then - call endrun( subname//': not able to determine season') - endif - - ! saturation specific humidity - ! - es = 611_r8*exp(5414.77_r8*((1._r8/tmelt)-(1._r8/sfc_temp))) - ws = .622_r8*es/(pg-es) - qs = ws/(1._r8+ws) - - has_dew = .false. - if( qs <= spec_hum ) then - has_dew = .true. - end if - if( sfc_temp < tmelt ) then - has_dew = .false. - end if - - has_rain = rain > rain_threshold - - if ( has_dew .or. has_rain ) then - dewm = 3._r8 - else - dewm = 1._r8 - end if - - !Define tc - tc = sfc_temp - tmelt - - ! - ! rdc (lower canopy res) - ! - rdc=100._r8*(1._r8+1000._r8/(solar_flux+10._r8))/(1._r8+1000._r8*slope) - - ! surface resistance : depends on both land type and species - ! land types are computed seperately, then resistance is computed as average of values - ! following wesely rc=(1/(rs+rm) + 1/rlu +1/(rdc+rcl) + 1/(rac+rgs))**-1 - - !******************************************************* - call seq_drydep_setHCoeff( sfc_temp, heff(:n_drydep) ) - !********************************************************* - - species_loop1: do ispec=1, n_drydep - if(mapping(ispec).le.0) cycle - - if(ispec.eq.index_o3.or.ispec.eq.index_o3a.or.ispec.eq.index_so2) then - rmx=0._r8 - else - rmx=1._r8/((heff(ispec)/3000._r8)+(100._r8*foxd(ispec))) - endif - - ! correction for frost - cts = 1000._r8*exp( -tc - 4._r8 ) - - !ground resistance - rgsx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rgss(index_season,wesveg)+cts))) + & - (foxd(ispec)/(rgso(index_season,wesveg)+cts))) - - !------------------------------------------------------------------------------------- - ! special case for H2 and CO;; CH4 is set ot a fraction of dv(H2) - !------------------------------------------------------------------------------------- - if( ispec == index_h2 .or. ispec == index_co .or. ispec == index_ch4 ) then - - if( ispec == index_co ) then - fact_h2 = 1.0_r8 - elseif ( ispec == index_h2 ) then - fact_h2 = 0.5_r8 - elseif ( ispec == index_ch4 ) then - fact_h2 = 50.0_r8 - end if - - !------------------------------------------------------------------------------------- - ! no deposition on snow, ice, desert, and water - !------------------------------------------------------------------------------------- - if( wesveg == 1 .or. wesveg == 7 .or. wesveg == 8 .or. index_season == 4 ) then - rgsx(ispec) = 1.e36_r8 - else - var_soilw = max( .1_r8,min( soilw,.3_r8 ) ) - if( wesveg == 3 ) then - var_soilw = log( var_soilw ) - end if - dv_soil_h2 = h2_c(wesveg) + var_soilw*(h2_b(wesveg) + var_soilw*h2_a(wesveg)) - if( dv_soil_h2 > 0._r8 ) then - rgsx(ispec) = fact_h2/(dv_soil_h2*1.e-4_r8) - end if - end if - end if - - !------------------------------------------------------------------------------------- - ! no deposition on water or no vegetation or snow (elai<=0) - !------------------------------------------------------------------------------------- - - no_dep: if( wesveg == 7 .or. elai(pi).le.0_r8 ) then !mvm 11/26/2013 - rclx(ispec)=1.e36_r8 - rsmx(ispec)=1.e36_r8 - rlux(ispec)=1.e36_r8 - else - - !Stomatal resistance - !MVM: adjusted rs to calculate stomata conductance over bulk canopy (CLM report pag 161) - rs=(fsun(pi)*rssun(pi)/elai(pi))+((rssha(pi)/elai(pi))*(1.-fsun(pi))) - - !MVM: rs_factor=0.2 to match up Rs observations (Padro et al, 1996) - rs_factor = 0.2_r8 - rsmx(ispec) = rs_factor*rs*drat(ispec)+rmx - - ! Leaf resistance - !MVM: adjusted rlu by LAI to get leaf resistance over bulk canopy (gao and wesely, 1995) - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec) = rlu_lai/(1.e-5_r8*heff(ispec)+foxd(ispec)) - - !Lower canopy resistance - rclx(ispec) = 1._r8/((heff(ispec)/(1.e5_r8*(rcls(index_season,wesveg)+cts))) + & - (foxd(ispec)/(rclo(index_season,wesveg)+cts))) - - !----------------------------------- - !mvm 11/30/2013: special case for CO - !Dry deposition of CO and hydrocarbons is negligibly - !small in vegetation [Mueller and Brasseur, 1995]. - !------------------------------------ - if( ispec == index_co ) then - rclx(ispec)=1.e36_r8 - rsmx(ispec)=1.e36_r8 - rlux(ispec)=1.e36_r8 - endif - - !-------------------------------------------- - ! jfl : special case for PAN - !-------------------------------------------- - if( ispec == index_pan ) then - dv_pan = c0_pan(wesveg) * (1._r8 - exp(-k_pan(wesveg)*(rs*drat(ispec))*1.e-2_r8 )) - - if( dv_pan > 0._r8 .and. index_season /= 4 ) then - rsmx(ispec) = ( 1._r8/dv_pan ) - end if - end if - - endif no_dep - - end do species_loop1 - - - !---------------------------------------------- - !Adjustment for dew and rain in leaf resitances - !--------------------------------------------- - ! no effect over water - no_water: if( wesveg.ne.7 ) then - !MVM: effect only on vegetated areas (elai> 0) - with_LAI: if (elai(pi).gt.0._r8) then - - ! - ! no effect if sfc_temp < O C - ! - non_freezing: if(sfc_temp.gt.tmelt) then - if( has_dew ) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux_o3 = 1._r8/((1._r8/3000._r8)+(1._r8/(3._r8*rlu_lai))) - - if (index_o3 > 0) then - rlux(index_o3) = rlux_o3 - endif - if (index_o3a > 0) then - rlux(index_o3a) = rlux_o3 - endif - endif - - if(has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux_o3 = 1._r8/((1._r8/1000._r8)+(1._r8/(3._r8*rlu_lai))) - - if (index_o3 > 0) then - rlux(index_o3) = rlux_o3 - endif - if (index_o3a > 0) then - rlux(index_o3a) = rlux_o3 - endif - endif - - species_loop2: do ispec=1,n_drydep - if(mapping(ispec).le.0) cycle - if(ispec.ne.index_o3.and.ispec.ne.index_o3a.and.ispec.ne.index_so2) then - - if( has_dew .or. has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec)=1._r8/((1._r8/(3._r8*rlu_lai))+ & - (1.e-7_r8*heff(ispec))+(foxd(ispec)/rlux_o3)) - endif - - elseif(ispec.eq.index_so2) then - - if( has_dew ) then - rlux(ispec) = 100._r8 - endif - - if(has_rain) then - rlu_lai=cts+rlu(index_season,wesveg)/elai(pi) - rlux(ispec) = 1._r8/((1._r8/5000._r8)+(1._r8/(3._r8*rlu_lai))) - endif - - if( has_dew .or. has_rain ) then - !MVM:rlux=50 for SO2 in dew or rain only for *urban land* type surfaces. - if (wesveg.eq.1) then - rlux(ispec)=50._r8 - endif - endif - end if - !mvm 11/30/2013: special case for CO - if( ispec.eq.index_co ) then - rlux(ispec)=1.e36_r8 - endif - end do species_loop2 - endif non_freezing - endif with_LAI - endif no_water - - ! resistance for aerosols - rds = 1._r8/vds(pi) - - species_loop3: do ispec=1,n_drydep - if(mapping(ispec).le.0) cycle - - ! - ! compute rc - ! - rc = 1._r8/((1._r8/rsmx(ispec))+(1._r8/rlux(ispec)) + & - (1._r8/(rdc+rclx(ispec)))+(1._r8/(rac(index_season,wesveg)+rgsx(ispec)))) - rc = max( 10._r8, rc) - ! - ! assume no surface resistance for SO2 over water - ! - if ( drydep_list(ispec) == 'SO2' .and. wesveg == 7 ) then - rc = 0._r8 - end if - - select case( drydep_list(ispec) ) - case ( 'SO4' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+rds))*100._r8 - case ( 'NH4','NH4NO3','XNH4NO3' ) - velocity(pi,ispec) = (1._r8/(ram1(pi)+0.5_r8*rds))*100._r8 - case ( 'Pb' ) - velocity(pi,ispec) = 0.2_r8 - case ( 'CB1', 'CB2', 'OC1', 'OC2', 'SOAM', 'SOAI', 'SOAT', 'SOAB', 'SOAX' ) - velocity(pi,ispec) = 0.10_r8 - case default - velocity(pi,ispec) = (1._r8/(ram1(pi)+rb1(pi)+rc))*100._r8 - end select - end do species_loop3 - endif gcell_wght - end do pft_loop - - end subroutine depvel_compute - -end module DryDepVelocity diff --git a/src_clm40/biogeochem/MEGANFactorsMod.F90 b/src_clm40/biogeochem/MEGANFactorsMod.F90 deleted file mode 100644 index 2d045d9e53..0000000000 --- a/src_clm40/biogeochem/MEGANFactorsMod.F90 +++ /dev/null @@ -1,319 +0,0 @@ -module MEGANFactorsMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: MEGANFactorsMod -! -! !DESCRIPTION: -! Manages input of MEGAN emissions factors from netCDF file -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils, only : endrun - use clm_varctl, only : iulog -! - implicit none - private - save -! -! !PUBLIC MEMBERS: - public :: megan_factors_init - public :: megan_factors_get - public :: comp_names -! -! !PUBLIC DATA: - real(r8), public, allocatable :: LDF(:) ! light dependent fraction - real(r8), public, allocatable :: Agro(:) ! growing leaf age factor - real(r8), public, allocatable :: Amat(:) ! mature leaf age factor - real(r8), public, allocatable :: Anew(:) ! new leaf age factor - real(r8), public, allocatable :: Aold(:) ! old leaf age factor - real(r8), public, allocatable :: betaT(:)! temperature factor - real(r8), public, allocatable :: ct1(:) ! temperature coefficient 1 - real(r8), public, allocatable :: ct2(:) ! temperature coefficient 2 - real(r8), public, allocatable :: Ceo(:) ! Eopt coefficient -! -! !PRIVATE MEMBERS: - integer :: npfts ! number of plant function types -! - type emis_eff_t - real(r8), pointer :: eff(:) ! emissions efficiency factor - real(r8) :: wght ! molecular weight - integer :: class_num ! MEGAN class number - endtype emis_eff_t -! - type(emis_eff_t), pointer :: comp_factors_table(:) ! hash table of MEGAN factors (points to an array of pointers) - integer, pointer :: hash_table_indices(:) ! pointer to hash table indices - integer, parameter :: tbl_hash_sz = 2**16 ! hash table size -! - character(len=32), allocatable :: comp_names(:) ! MEGAN compound names - real(r8), allocatable :: comp_molecwghts(:)! MEGAN compound molecular weights -! -! !REVISION HISTORY: -! 28 Oct 2011: Created by Francis Vitt -! -!EOP -!----------------------------------------------------------------------- -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: megan_factors_get -! -! !INTERFACE: - subroutine megan_factors_get( comp_name, factors, class_n, molecwght ) -! -! !DESCRIPTION: -! Method for getting MEGAN information for a named compound -! -! !ARGUMENTS: - character(len=*),intent(in) :: comp_name ! MEGAN compound name - real(r8), intent(out) :: factors(npfts) ! vegitation type factors for the compound of intrest - integer, intent(out) :: class_n ! MEGAN class number for the compound of intrest - real(r8), intent(out) :: molecwght ! molecular weight of the compound of intrest -! -!EOP -!----------------------------------------------------------------------- -! local vars: - integer :: hashkey, ndx - character(len=120) :: errmes - - hashkey = gen_hashkey(comp_name) - ndx = hash_table_indices(hashkey) - - if (ndx<1) then - errmes = 'megan_factors_get: '//trim(comp_name)//' compound not found in MEGAN table' - write(iulog,*) trim(errmes) - call endrun(errmes) - endif - - factors(:) = comp_factors_table( ndx )%eff(:) - class_n = comp_factors_table( ndx )%class_num - molecwght = comp_factors_table( ndx )%wght - - end subroutine megan_factors_get -!----------------------------------------------------------------------- -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: megan_factors_init -! -! !INTERFACE: - subroutine megan_factors_init( filename ) -! -! !DESCRIPTION: -! Initializes the MEGAN factors using data from input file -! -! !USES: - use ncdio_pio, only : ncd_pio_openfile,ncd_inqdlen - use pio, only : pio_inq_varid,pio_get_var,file_desc_t,pio_closefile - use fileutils , only : getfil -! -! !ARGUMENTS: - character(len=*),intent(in) :: filename ! MEGAN factors input file - -!EOP -!----------------------------------------------------------------------- -! - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - - integer :: start(2), count(2) - - integer :: ierr, i, vid - integer :: dimid, n_comps, n_classes, n_pfts - integer :: class_ef_vid,comp_ef_vid,comp_name_vid,class_num_vid - integer :: comp_mw_vid - integer, allocatable :: class_nums(:) - - real(r8),allocatable :: factors(:) - real(r8),allocatable :: comp_factors(:) - real(r8),allocatable :: class_factors(:) - - allocate(comp_factors_table(150)) - allocate(hash_table_indices(tbl_hash_sz)) - - - call getfil(filename, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - call ncd_inqdlen( ncid, dimid, n_comps, name='Comp_Num') - call ncd_inqdlen( ncid, dimid, n_classes, name='Class_Num') - call ncd_inqdlen( ncid, dimid, n_pfts, name='PFT_Num') - - npfts = n_pfts - - ierr = pio_inq_varid(ncid,'Class_EF', class_ef_vid) - ierr = pio_inq_varid(ncid,'Comp_EF', comp_ef_vid) - ierr = pio_inq_varid(ncid,'Comp_Name',comp_name_vid) - ierr = pio_inq_varid(ncid,'Class_Num',class_num_vid) - ierr = pio_inq_varid(ncid,'Comp_MW', comp_mw_vid) - - allocate( factors(n_pfts) ) - allocate( comp_factors(n_pfts) ) - allocate( class_factors(n_pfts) ) - - allocate( comp_names(n_comps) ) - allocate( comp_molecwghts(n_comps) ) - allocate( class_nums(n_comps) ) - - ierr = pio_get_var( ncid, comp_name_vid, comp_names ) - ierr = pio_get_var( ncid, comp_mw_vid, comp_molecwghts ) - ierr = pio_get_var( ncid, class_num_vid, class_nums ) - - ! set up hash table where data is stored - call bld_hash_table_indices( comp_names ) - do i=1,n_comps - start=(/i,1/) - count=(/1,16/) - ierr = pio_get_var( ncid, comp_ef_vid, start, count, comp_factors ) - start=(/class_nums(i),1/) - ierr = pio_get_var( ncid, class_ef_vid, start, count, class_factors ) - factors(:) = comp_factors(:)*class_factors(:) - call enter_hash_data( trim(comp_names(i)), factors, class_nums(i), comp_molecwghts(i) ) - enddo - - allocate( LDF(n_classes) ) - allocate( Agro(n_classes) ) - allocate( Amat(n_classes) ) - allocate( Anew(n_classes) ) - allocate( Aold(n_classes) ) - allocate( betaT(n_classes) ) - allocate( ct1(n_classes) ) - allocate( ct2(n_classes) ) - allocate( Ceo(n_classes) ) - - ierr = pio_inq_varid(ncid,'LDF', vid) - ierr = pio_get_var( ncid, vid, LDF ) - - ierr = pio_inq_varid(ncid,'Agro', vid) - ierr = pio_get_var( ncid, vid, Agro ) - - ierr = pio_inq_varid(ncid,'Amat', vid) - ierr = pio_get_var( ncid, vid, Amat ) - - ierr = pio_inq_varid(ncid,'Anew', vid) - ierr = pio_get_var( ncid, vid, Anew ) - - ierr = pio_inq_varid(ncid,'Aold', vid) - ierr = pio_get_var( ncid, vid, Aold ) - - ierr = pio_inq_varid(ncid,'betaT', vid) - ierr = pio_get_var( ncid, vid, betaT ) - - ierr = pio_inq_varid(ncid,'ct1', vid) - ierr = pio_get_var( ncid, vid, ct1 ) - - ierr = pio_inq_varid(ncid,'ct2', vid) - ierr = pio_get_var( ncid, vid, ct2 ) - - ierr = pio_inq_varid(ncid,'Ceo', vid) - ierr = pio_get_var( ncid, vid, Ceo ) - - call pio_closefile(ncid) - - deallocate( class_nums, comp_factors,class_factors,factors ) - - endsubroutine megan_factors_init -!----------------------------------------------------------------------- - - !----------------------------------------------------------------------- - ! Private methods... - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine bld_hash_table_indices( names ) - character(len=*),intent(in) :: names(:) - - integer :: n, i, hashkey - - hash_table_indices(:) = 0 - - n = size(names) - do i=1,n - hashkey = gen_hashkey(names(i)) - hash_table_indices(hashkey) = i - enddo - - endsubroutine bld_hash_table_indices - - !----------------------------------------------------------------------- - !----------------------------------------------------------------------- - subroutine enter_hash_data( name, data, class_n, molec_wght ) - character(len=*), intent(in) :: name - real(r8), intent(in) :: data(:) - integer, intent(in) :: class_n - real(r8), intent(in) :: molec_wght - - integer :: hashkey, ndx - integer :: nfactors - - hashkey = gen_hashkey(name) - nfactors = size(data) - - ndx = hash_table_indices(hashkey) - - allocate (comp_factors_table(ndx)%eff(nfactors)) - - comp_factors_table(ndx)%eff(:) = data(:) - comp_factors_table(ndx)%class_num = class_n - comp_factors_table(ndx)%wght = molec_wght - - end subroutine enter_hash_data - - !----------------------------------------------------------------------- - !from cam_history - ! - ! Purpose: Generate a hash key on the interval [0 .. tbl_hash_sz-1] - ! given a character string. - ! - ! Algorithm is a variant of perl's internal hashing function. - ! - !----------------------------------------------------------------------- - integer function gen_hashkey(string) - - implicit none - ! - ! Arguments: - ! - character(len=*), intent(in) :: string - ! - ! Local vars - ! - integer :: hash - integer :: i - - integer, parameter :: tbl_max_idx = 15 ! 2**N - 1 - integer, parameter :: gen_hash_key_offset = z'000053db' - integer, dimension(0:tbl_max_idx) :: tbl_gen_hash_key = (/61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1/) - - hash = gen_hash_key_offset - - if ( len_trim(string) /= 19 ) then - ! - ! Process arbitrary string length. - ! - do i = 1, len_trim(string) - hash = ieor(hash , (ichar(string(i:i)) * tbl_gen_hash_key(iand(i-1,tbl_max_idx)))) - end do - else - ! - ! Special case string length = 19 - ! - do i = 1, tbl_max_idx+1 - hash = ieor(hash , ichar(string(i:i)) * tbl_gen_hash_key(i-1)) - end do - do i = tbl_max_idx+2, len_trim(string) - hash = ieor(hash , ichar(string(i:i)) * tbl_gen_hash_key(i-tbl_max_idx-2)) - end do - end if - - gen_hashkey = iand(hash, tbl_hash_sz-1) - - return - - end function gen_hashkey - -end module MEGANFactorsMod - - diff --git a/src_clm40/biogeochem/STATICEcosysDynMod.F90 b/src_clm40/biogeochem/STATICEcosysDynMod.F90 deleted file mode 100644 index c7039c7942..0000000000 --- a/src_clm40/biogeochem/STATICEcosysDynMod.F90 +++ /dev/null @@ -1,549 +0,0 @@ -module STATICEcosysdynMOD - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: STATICEcosysDynMod -! -! !DESCRIPTION: -! Static Ecosystem dynamics: phenology, vegetation. This is for the CLM Satelitte Phenology -! model (CLMSP). Allow some subroutines to be used by the CLM Carbon Nitrogen model (CLMCN) -! so that DryDeposition code can get estimates of LAI differences between months. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils, only : endrun - use clm_varctl, only : scmlat,scmlon,single_column - use clm_varctl, only : iulog - use perf_mod, only : t_startf, t_stopf - use spmdMod, only : masterproc - use ncdio_pio -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: EcosystemDyn ! CLMSP Ecosystem dynamics: phenology, vegetation - public :: EcosystemDynini ! Dynamically allocate memory - public :: interpMonthlyVeg ! interpolate monthly vegetation data - public :: readAnnualVegetation ! Read in annual vegetation (needed for Dry-deposition) -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !PRIVATE MEMBER FUNCTIONS: - private :: readMonthlyVegetation ! read monthly vegetation data for two months -! -! !PRIVATE TYPES: - integer , private :: InterpMonths1 ! saved month index - real(r8), private :: timwt(2) ! time weights for month 1 and month 2 - real(r8), private, allocatable :: mlai2t(:,:) ! lai for interpolation (2 months) - real(r8), private, allocatable :: msai2t(:,:) ! sai for interpolation (2 months) - real(r8), private, allocatable :: mhvt2t(:,:) ! top vegetation height for interpolation (2 months) - real(r8), private, allocatable :: mhvb2t(:,:) ! bottom vegetation height for interpolation(2 months) -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: EcosystemDynini -! -! !INTERFACE: - subroutine EcosystemDynini () -! -! !DESCRIPTION: -! Dynamically allocate memory and set to signaling NaN. -! -! !USES: - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use decompMod, only : get_proc_bounds -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! -! -! !LOCAL VARIABLES: -!EOP - integer :: ier ! error code - integer :: begp,endp ! local beg and end p index -!----------------------------------------------------------------------- - - InterpMonths1 = -999 ! saved month index - call get_proc_bounds(begp=begp,endp=endp) - - ier = 0 - if(.not.allocated(mlai2t))allocate (mlai2t(begp:endp,2), & - msai2t(begp:endp,2), & - mhvt2t(begp:endp,2), & - mhvb2t(begp:endp,2), stat=ier) - if (ier /= 0) then - write(iulog,*) 'EcosystemDynini allocation error' - call endrun - end if - - mlai2t(:,:) = nan - msai2t(:,:) = nan - mhvt2t(:,:) = nan - mhvb2t(:,:) = nan - - end subroutine EcosystemDynini - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: EcosystemDyn -! -! !INTERFACE: - subroutine EcosystemDyn(lbp, ubp, num_nolakep, filter_nolakep, doalb) -! -! !DESCRIPTION: -! Ecosystem dynamics: phenology, vegetation -! Calculates leaf areas (tlai, elai), stem areas (tsai, esai) and -! height (htop). -! -! !USES: - use clmtype - use pftvarcon, only : noveg, nc3crop, nbrdlf_dcd_brl_shrub -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_nolakep ! number of column non-lake points in pft filter - integer, intent(in) :: filter_nolakep(ubp-lbp+1) ! pft filter for non-lake points - logical, intent(in) :: doalb ! true = surface albedo calculation time step -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 2/1/02, Peter Thornton: Migrated to new data structure. -! 2/29/08, David Lawrence: revised snow burial fraction for short vegetation -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: pcolumn(:) ! column index associated with each pft - real(r8), pointer :: snowdp(:) ! snow height (m) - integer , pointer :: ivt(:) ! pft vegetation type -! -! local pointers to implicit out arguments -! - real(r8), pointer :: tlai(:) ! one-sided leaf area index, no burying by snow - real(r8), pointer :: tsai(:) ! one-sided stem area index, no burying by snow - real(r8), pointer :: htop(:) ! canopy top (m) - real(r8), pointer :: hbot(:) ! canopy bottom (m) - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - integer , pointer :: frac_veg_nosno_alb(:) ! frac of vegetation not covered by snow [-] -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: fp,p,c ! indices - real(r8) :: ol ! thickness of canopy layer covered by snow (m) - real(r8) :: fb ! fraction of canopy layer covered by snow -!----------------------------------------------------------------------- - - if (doalb) then - - ! Assign local pointers to derived type scalar members (column-level) - - snowdp => cps%snowdp - - ! Assign local pointers to derived type scalar members (pftlevel) - - pcolumn => pft%column - tlai => pps%tlai - tsai => pps%tsai - elai => pps%elai - esai => pps%esai - htop => pps%htop - hbot => pps%hbot - frac_veg_nosno_alb => pps%frac_veg_nosno_alb - ivt => pft%itype - - do fp = 1, num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - - ! need to update elai and esai only every albedo time step so do not - ! have any inconsistency in lai and sai between SurfaceAlbedo calls (i.e., - ! if albedos are not done every time step). - ! leaf phenology - ! Set leaf and stem areas based on day of year - ! Interpolate leaf area index, stem area index, and vegetation heights - ! between two monthly - ! The weights below (timwt(1) and timwt(2)) were obtained by a call to - ! routine InterpMonthlyVeg in subroutine NCARlsm. - ! Field Monthly Values - ! ------------------------- - ! leaf area index LAI <- mlai1 and mlai2 - ! leaf area index SAI <- msai1 and msai2 - ! top height HTOP <- mhvt1 and mhvt2 - ! bottom height HBOT <- mhvb1 and mhvb2 - - tlai(p) = timwt(1)*mlai2t(p,1) + timwt(2)*mlai2t(p,2) - tsai(p) = timwt(1)*msai2t(p,1) + timwt(2)*msai2t(p,2) - htop(p) = timwt(1)*mhvt2t(p,1) + timwt(2)*mhvt2t(p,2) - hbot(p) = timwt(1)*mhvb2t(p,1) + timwt(2)*mhvb2t(p,2) - - ! adjust lai and sai for burying by snow. if exposed lai and sai - ! are less than 0.05, set equal to zero to prevent numerical - ! problems associated with very small lai and sai. - - ! snow burial fraction for short vegetation (e.g. grasses) as in - ! Wang and Zeng, 2007. - - if (ivt(p) > noveg .and. ivt(p) <= nbrdlf_dcd_brl_shrub ) then - ol = min( max(snowdp(c)-hbot(p), 0._r8), htop(p)-hbot(p)) - fb = 1._r8 - ol / max(1.e-06_r8, htop(p)-hbot(p)) - else - fb = 1._r8 - max(min(snowdp(c),0.2_r8),0._r8)/0.2_r8 ! 0.2m is assumed - !depth of snow required for complete burial of grasses - endif - - elai(p) = max(tlai(p)*fb, 0.0_r8) - esai(p) = max(tsai(p)*fb, 0.0_r8) - if (elai(p) < 0.05_r8) elai(p) = 0._r8 - if (esai(p) < 0.05_r8) esai(p) = 0._r8 - - ! Fraction of vegetation free of snow - - if ((elai(p) + esai(p)) >= 0.05_r8) then - frac_veg_nosno_alb(p) = 1 - else - frac_veg_nosno_alb(p) = 0 - end if - - end do ! end of pft loop - - end if !end of if-doalb block - - end subroutine EcosystemDyn - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: interpMonthlyVeg -! -! !INTERFACE: - subroutine interpMonthlyVeg () -! -! !DESCRIPTION: -! Determine if 2 new months of data are to be read. -! -! !USES: - use clm_varctl , only : fsurdat - use clm_time_manager, only : get_curr_date, get_step_size, & - get_perp_date, is_perpetual, get_nstep -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: kyr ! year (0, ...) for nstep+1 - integer :: kmo ! month (1, ..., 12) - integer :: kda ! day of month (1, ..., 31) - integer :: ksec ! seconds into current date for nstep+1 - real(r8):: dtime ! land model time step (sec) - real(r8):: t ! a fraction: kda/ndaypm - integer :: it(2) ! month 1 and month 2 (step 1) - integer :: months(2) ! months to be interpolated (1 to 12) - integer, dimension(12) :: ndaypm= & - (/31,28,31,30,31,30,31,31,30,31,30,31/) !days per month -!----------------------------------------------------------------------- - - dtime = get_step_size() - - if ( is_perpetual() ) then - call get_perp_date(kyr, kmo, kda, ksec, offset=int(dtime)) - else - call get_curr_date(kyr, kmo, kda, ksec, offset=int(dtime)) - end if - - t = (kda-0.5_r8) / ndaypm(kmo) - it(1) = t + 0.5_r8 - it(2) = it(1) + 1 - months(1) = kmo + it(1) - 1 - months(2) = kmo + it(2) - 1 - if (months(1) < 1) months(1) = 12 - if (months(2) > 12) months(2) = 1 - timwt(1) = (it(1)+0.5_r8) - t - timwt(2) = 1._r8-timwt(1) - - if (InterpMonths1 /= months(1)) then - if (masterproc) then - write(iulog,*) 'Attempting to read monthly vegetation data .....' - write(iulog,*) 'nstep = ',get_nstep(),' month = ',kmo,' day = ',kda - end if - call t_startf('readMonthlyVeg') - call readMonthlyVegetation (fsurdat, months) - InterpMonths1 = months(1) - call t_stopf('readMonthlyVeg') - end if - - end subroutine interpMonthlyVeg - -!----------------------------------------------------------------------- -! read 12 months of veg data for dry deposition -!----------------------------------------------------------------------- - - subroutine readAnnualVegetation ( ) - - use clmtype - use clm_varpar , only : numpft - use pftvarcon , only : noveg - use decompMod , only : get_proc_bounds - use domainMod , only : ldomain - use fileutils , only : getfil - use clm_varctl , only : fsurdat - use shr_scam_mod, only : shr_scam_getCloseLatLon - - implicit none - - ! local vars - - type(file_desc_t) :: ncid ! netcdf id - real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set - real(r8), pointer :: mlai(:,:) ! lai read from input files - integer :: ier ! error code - character(len=256) :: locfn ! local file name - integer :: g,k,l,m,n,p,ivt ! indices - integer :: ni,nj,ns ! indices - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nlon_i ! number of input data longitudes - integer :: nlat_i ! number of input data latitudes - integer :: npft_i ! number of input data pft types - integer :: begp,endp ! beg and end local p index - integer :: begg,endg ! beg and end local g index - integer :: closelatidx,closelonidx ! single column vars - real(r8):: closelat,closelon ! single column vars - logical :: isgrid2d ! true => file is 2d - character(len=32) :: subname = 'readAnnualVegetation' - - annlai => pps%annlai - - ! Determine necessary indices - - call get_proc_bounds(begg=begg,endg=endg,begp=begp,endp=endp) - - allocate(mlai(begg:endg,0:numpft), stat=ier) - if (ier /= 0) then - write(iulog,*)subname, 'allocation error '; call endrun() - end if - - if (masterproc) then - write (iulog,*) 'Attempting to read annual vegetation data .....' - end if - - call getfil(fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun() - end if - call check_dim(ncid, 'lsmpft', numpft+1) - - if (single_column) then - call shr_scam_getCloseLatLon(locfn, scmlat, scmlon, & - closelat, closelon, closelatidx, closelonidx) - endif - - do k=1,12 !! loop over months and read vegetated data - - call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, & - dim1name=grlnd, nt=k) - - !! store data directly in clmtype structure - !! only vegetated pfts have nonzero values - !! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] pfts - !! as determined in subroutine surfrd - - do p = begp,endp - g = pft%gridcell(p) - ivt = pft%itype(p) - if (ivt /= noveg) then !! vegetated pft - do l = 0, numpft - if (l == ivt) then - annlai(k,p) = mlai(g,l) - end if - end do - else !! non-vegetated pft - annlai(k,p) = 0._r8 - end if - end do ! end of loop over pfts - - enddo ! months loop - - call ncd_pio_closefile(ncid) - - deallocate(mlai) - - endsubroutine readAnnualVegetation - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: readMonthlyVegetation -! -! !INTERFACE: - subroutine readMonthlyVegetation (fveg, months) -! -! !DESCRIPTION: -! Read monthly vegetation data for two consec. months. -! -! !USES: - use clmtype - use decompMod , only : get_proc_bounds - use clm_varpar , only : numpft - use pftvarcon , only : noveg - use fileutils , only : getfil - use spmdMod , only : masterproc, mpicom, MPI_REAL8, MPI_INTEGER - use shr_scam_mod, only : shr_scam_getCloseLatLon - use clm_time_manager, only : get_nstep - use netcdf -! -! !ARGUMENTS: - implicit none - - character(len=*), intent(in) :: fveg ! file with monthly vegetation data - integer, intent(in) :: months(2) ! months to be interpolated (1 to 12) -! -! !REVISION HISTORY: -! Created by Sam Levis -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: g,n,k,l,m,p,ivt,ni,nj,ns ! indices - integer :: dimid,varid ! input netCDF id's - integer :: ntim ! number of input data time samples - integer :: nlon_i ! number of input data longitudes - integer :: nlat_i ! number of input data latitudes - integer :: npft_i ! number of input data pft types - integer :: begp,endp ! beg and end local p index - integer :: begg,endg ! beg and end local g index - integer :: ier ! error code - integer :: closelatidx,closelonidx - real(r8):: closelat,closelon - logical :: readvar - real(r8), pointer :: mlai(:,:) ! lai read from input files - real(r8), pointer :: msai(:,:) ! sai read from input files - real(r8), pointer :: mhgtt(:,:) ! top vegetation height - real(r8), pointer :: mhgtb(:,:) ! bottom vegetation height - real(r8), pointer :: mlaidiff(:) ! difference between lai month one and month two - character(len=32) :: subname = 'readMonthlyVegetation' -!----------------------------------------------------------------------- - - ! Determine necessary indices - - call get_proc_bounds(begg=begg,endg=endg,begp=begp,endp=endp) - - allocate(mlai(begg:endg,0:numpft), & - msai(begg:endg,0:numpft), & - mhgtt(begg:endg,0:numpft), & - mhgtb(begg:endg,0:numpft), & - stat=ier) - if (ier /= 0) then - write(iulog,*)subname, 'allocation big error '; call endrun() - end if - - ! ---------------------------------------------------------------------- - ! Open monthly vegetation file - ! Read data and convert from gridcell to pft data - ! ---------------------------------------------------------------------- - - call getfil(fveg, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - if (single_column) then - call shr_scam_getCloseLatLon (ncid, scmlat, scmlon, closelat, closelon,& - closelatidx, closelonidx) - endif - - do k=1,2 !loop over months and read vegetated data - - call ncd_io(ncid=ncid, varname='MONTHLY_LAI', flag='read', data=mlai, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: MONTHLY_LAI NOT on fveg file' ) - - call ncd_io(ncid=ncid, varname='MONTHLY_SAI', flag='read', data=msai, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: MONTHLY_SAI NOT on fveg file' ) - - call ncd_io(ncid=ncid, varname='MONTHLY_HEIGHT_TOP', flag='read', data=mhgtt, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file' ) - - call ncd_io(ncid=ncid, varname='MONTHLY_HEIGHT_BOT', flag='read', data=mhgtb, dim1name=grlnd, & - nt=months(k), readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: MONTHLY_HEIGHT_TOP NOT on fveg file' ) - - ! Store data directly in clmtype structure - ! only vegetated pfts have nonzero values - ! Assign lai/sai/hgtt/hgtb to the top [maxpatch_pft] pfts - ! as determined in subroutine surfrd - - do p = begp,endp - g = pft%gridcell(p) - ivt = pft%itype(p) - if (ivt /= noveg) then ! vegetated pft - do l = 0, numpft - if (l == ivt) then - mlai2t(p,k) = mlai(g,l) - msai2t(p,k) = msai(g,l) - mhvt2t(p,k) = mhgtt(g,l) - mhvb2t(p,k) = mhgtb(g,l) - end if - end do - else ! non-vegetated pft - mlai2t(p,k) = 0._r8 - msai2t(p,k) = 0._r8 - mhvt2t(p,k) = 0._r8 - mhvb2t(p,k) = 0._r8 - end if - end do ! end of loop over pfts - - end do ! end of loop over months - - call ncd_pio_closefile(ncid) - - if (masterproc) then - k = 2 - write(iulog,*) 'Successfully read monthly vegetation data for' - write(iulog,*) 'month ', months(k) - write(iulog,*) - end if - - deallocate(mlai, msai, mhgtt, mhgtb) - - mlaidiff => pps%mlaidiff - do p = begp,endp - mlaidiff(p)=mlai2t(p,1)-mlai2t(p,2) - enddo - - end subroutine readMonthlyVegetation - -end module STATICEcosysDynMod diff --git a/src_clm40/biogeochem/VOCEmissionMod.F90 b/src_clm40/biogeochem/VOCEmissionMod.F90 deleted file mode 100644 index c225a36d0f..0000000000 --- a/src_clm40/biogeochem/VOCEmissionMod.F90 +++ /dev/null @@ -1,1023 +0,0 @@ -module VOCEmissionMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: VOCEmissionMod -! -! !DESCRIPTION: -! Volatile organic compound emission -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_varctl, only : iulog - use abortutils, only : endrun - use clm_varpar, only : numpft - use pftvarcon , only : ndllf_evr_tmp_tree, ndllf_evr_brl_tree, & - ndllf_dcd_brl_tree, nbrdlf_evr_trp_tree, & - nbrdlf_evr_tmp_tree, nbrdlf_dcd_brl_shrub, & - nbrdlf_dcd_trp_tree, nbrdlf_dcd_tmp_tree, & - nbrdlf_dcd_brl_tree, nbrdlf_evr_shrub, & - nc3_arctic_grass, nc3crop, & - nc4_grass, noveg - - use shr_megan_mod, only : shr_megan_megcomps_n, shr_megan_megcomp_t, shr_megan_linkedlist - use shr_megan_mod, only : shr_megan_mechcomps_n, shr_megan_mechcomps, shr_megan_mapped_emisfctrs - use MEGANFactorsMod,only : Agro, Amat, Anew, Aold, betaT, ct1, ct2, LDF, Ceo - -! -! !PUBLIC TYPES: - implicit none - save - - logical, parameter :: debug = .false. - -! -! -! !PUBLIC MEMBER FUNCTIONS: - public :: VOCEmission - public :: VOCEmission_init -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: VOCEmission -! -! !INTERFACE: - subroutine VOCEmission (lbp, ubp, num_soilp, filter_soilp ) -! -! ! NEW DESCRIPTION -! Volatile organic compound emission -! This code simulates volatile organic compound emissions following -! MEGAN (Model of Emissions of Gases and Aerosols from Nature) v2.1 -! for 20 compound classes. The original description of this -! algorithm (for isoprene only) can be found in Guenther et al., 2006 -! (we follow equations 2-9, 16-17, 20 for explicit canopy). -! The model scheme came be described as: -! E= epsilon * gamma * rho -! VOC flux (E) [ug m-2 h-1] is calculated from baseline emission -! factors (epsilon) [ug m-2 h-1] which are specified for each of the 16 -! CLM PFTs (in input file) OR in the case of isoprene, from -! mapped EFs for each PFT which reflect species divergence of emissions, -! particularly in North America. -! The emission activity factor (gamma) [unitless] for includes -! dependence on PPFT, temperature, LAI, leaf age and soil moisture. -! For isoprene only we also include the effect of CO2 inhibition as -! described by Heald et al., 2009. -! The canopy environment constant was calculated offline for CLM+CAM at -! standard conditions. -! We assume that the escape efficiency (rho) here is unity following -! Guenther et al., 2006. -! A manuscript describing MEGAN 2.1 and the implementation in CLM is -! in preparation: Guenther, Heald et al., 2012 -! Subroutine written to operate at the patch level. -! -! Input: to be read in with EFs and some parameters. -! Currently these are set in procedure init_EF_params -! Output: vocflx(shr_megan_mechcomps_n) !VOC flux [moles/m2/sec] -! -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_atmlnd , only : clm_a2l - use clmtype - use domainMod, only : ldomain - use clm_varcon , only : spval -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_soilp ! number of columns in soil pft filter - integer, intent(in) :: filter_soilp(num_soilp) ! pft filter for soil -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Author: Sam Levis -! 2/1/02: Peter Thornton: migration to new data structure -! 4/15/06: Colette L. Heald: modify for updated MEGAN model (Guenther et al., 2006) -! 4/29/11: Colette L. Heald: expand MEGAN to 20 compound classes -! 7 Feb 2012: Francis Vitt: Implemented capability to specify MEGAN emissions in namelist -! and read in MEGAN factors from file. -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: pgridcell(:) ! gridcell index of corresponding pft - integer , pointer :: pcolumn(:) ! column index of corresponding pft - integer , pointer :: ivt(:) ! pft vegetation type for current - real(r8), pointer :: t_veg(:) ! pft vegetation temperature (Kelvin) - real(r8), pointer :: fsun(:) ! sunlit fraction of canopy - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: clayfrac(:) ! fraction of soil that is clay - real(r8), pointer :: sandfrac(:) ! fraction of soil that is sand - real(r8), pointer :: forc_solad(:,:) ! direct beam radiation (visible only) - real(r8), pointer :: forc_solai(:,:) ! diffuse radiation (visible only) - real(r8), pointer :: elai_p(:) ! one-sided leaf area index from previous timestep - real(r8), pointer :: t_veg24(:) ! avg pft vegetation temperature for last 24 hrs - real(r8), pointer :: t_veg240(:) ! avg pft vegetation temperature for last 240 hrs - real(r8), pointer :: fsun24(:) ! sunlit fraction of canopy last 24 hrs - real(r8), pointer :: fsun240(:) ! sunlit fraction of canopy last 240 hrs - real(r8), pointer :: forc_solad24(:) ! direct beam radiation last 24hrs (visible only) - real(r8), pointer :: forc_solai24(:) ! diffuse radiation last 24hrs (visible only) - real(r8), pointer :: forc_solad240(:) ! direct beam radiation last 240hrs (visible only) - real(r8), pointer :: forc_solai240(:) ! diffuse radiation last 240hrs (visible only) - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (m3/m3) - real(r8), pointer :: h2osoi_ice(:,:) ! ice soil content (kg/m3) - real(r8), pointer :: dz(:,:) ! depth of layer (m) - real(r8), pointer :: bsw(:,:) ! Clapp and Hornberger "b" (nlevgrnd) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) (nlevgrnd) - real(r8), pointer :: sucsat(:,:) ! minimum soil suction (mm) (nlevgrnd) - real(r8), pointer :: cisun(:) ! sunlit intracellular CO2 (Pa) - real(r8), pointer :: cisha(:) ! shaded intracellular CO2 (Pa) - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - real(r8), pointer :: forc_pco2(:) ! CO2 partial pressure -! -! local pointers to original implicit out arrays -! - real(r8), pointer :: vocflx(:,:) ! VOC flux [moles/m2/sec] - real(r8), pointer :: vocflx_tot(:) ! VOC flux [moles/m2/sec] - - type(megan_out_type), pointer :: meg_out(:) ! fluxes for CLM history - - real(r8), pointer :: gamma_out(:) - real(r8), pointer :: gammaT_out(:) - real(r8), pointer :: gammaP_out(:) - real(r8), pointer :: gammaL_out(:) - real(r8), pointer :: gammaA_out(:) - real(r8), pointer :: gammaS_out(:) - real(r8), pointer :: gammaC_out(:) - - real(r8), pointer :: Eopt_out(:) - real(r8), pointer :: topt_out(:) - real(r8), pointer :: alpha_out(:) - real(r8), pointer :: cp_out(:) - real(r8), pointer :: paru_out(:) - real(r8), pointer :: par24u_out(:) - real(r8), pointer :: par240u_out(:) - real(r8), pointer :: para_out(:) - real(r8), pointer :: par24a_out(:) - real(r8), pointer :: par240a_out(:) - -! -! -! !OTHER LOCAL VARIABLES: -! - integer :: fp,p,g,c ! indices - real(r8) :: epsilon ! emission factor [ug m-2 h-1] - real(r8) :: par_sun ! temporary - real(r8) :: par24_sun ! temporary - real(r8) :: par240_sun ! temporary - real(r8) :: par_sha ! temporary - real(r8) :: par24_sha ! temporary - real(r8) :: par240_sha ! temporary - real(r8) :: gamma ! activity factor (accounting for light, T, age, LAI conditions) - real(r8) :: gamma_p ! activity factor for PPFD - real(r8) :: gamma_l ! activity factor for PPFD & LAI - real(r8) :: gamma_t ! activity factor for temperature - real(r8) :: gamma_a ! activity factor for leaf age - real(r8) :: gamma_sm ! activity factor for soil moisture - real(r8) :: gamma_c ! activity factor for CO2 (only isoprene) - - integer :: class_num, n_meg_comps, imech, imeg, ii - character(len=16) :: mech_name - - real(r8) :: vocflx_meg(shr_megan_megcomps_n) - type(shr_megan_megcomp_t), pointer :: meg_cmp - - real(r8) :: cp, alpha, Eopt, topt ! for history output - real(r8) :: co2_ppmv - - ! factor used convert MEGAN units [micro-grams/m2/hr] to CAM srf emis units [g/m2/sec] - real(r8), parameter :: megemis_units_factor = 1._r8/3600._r8/1.e6_r8 - -! real(r8) :: root_depth(0:numpft) ! Root depth [m] -! -!!----------------------------------------------------------------------- -! -! ! root depth (m) (defined based on Zeng et al., 2001, cf Guenther 2006) -! root_depth(noveg) = 0._r8 ! bare-soil -! root_depth(ndllf_evr_tmp_tree:ndllf_evr_brl_tree) = 1.8_r8 ! evergreen tree -! root_depth(ndllf_dcd_brl_tree) = 2.0_r8 ! needleleaf deciduous boreal tree -! root_depth(nbrdlf_evr_trp_tree:nbrdlf_evr_tmp_tree) = 3.0_r8 ! broadleaf evergreen tree -! root_depth(nbrdlf_dcd_trp_tree:nbrdlf_dcd_brl_tree) = 2.0_r8 ! broadleaf deciduous tree -! root_depth(nbrdlf_evr_shrub:nbrdlf_dcd_brl_shrub) = 2.5_r8 ! shrub -! root_depth(nc3_arctic_grass:numpft) = 1.5_r8 ! grass/crop -! -!----------------------------------------------------------------------- - if ( shr_megan_mechcomps_n < 1) return - - ! Assign local pointers to derived type members (gridcell-level) - forc_solad => clm_a2l%forc_solad - forc_solai => clm_a2l%forc_solai - forc_pbot => clm_a2l%forc_pbot - forc_pco2 => clm_a2l%forc_pco2 - - ! Assign local pointers to derived subtypes components (column-level) - h2osoi_vol => cws%h2osoi_vol - h2osoi_ice => cws%h2osoi_ice - dz => cps%dz - bsw => cps%bsw - watsat => cps%watsat - sucsat => cps%sucsat - - ! Assign local pointers to derived subtypes components (pft-level) - - pgridcell => pft%gridcell - pcolumn => pft%column - ivt => pft%itype - t_veg => pes%t_veg - fsun => pps%fsun - elai => pps%elai - clayfrac => pps%clayfrac - sandfrac => pps%sandfrac - - cisun => pps%cisun - cisha => pps%cisha - - vocflx => pvf%vocflx - vocflx_tot => pvf%vocflx_tot - meg_out => pvf%meg - - gammaL_out => pvf%gammaL_out - gammaT_out => pvf%gammaT_out - gammaP_out => pvf%gammaP_out - gammaA_out => pvf%gammaA_out - gammaS_out => pvf%gammaS_out - gammaC_out => pvf%gammaC_out - gamma_out => pvf%gamma_out - - Eopt_out => pvf%Eopt_out - topt_out => pvf%topt_out - alpha_out => pvf%alpha_out - cp_out => pvf%cp_out - paru_out => pvf%paru_out - par24u_out => pvf%par24u_out - par240u_out => pvf%par240u_out - para_out => pvf%para_out - par24a_out => pvf%par24a_out - par240a_out => pvf%par240a_out - - t_veg24 => pvs%t_veg24 - t_veg240 => pvs%t_veg240 - forc_solad24 => pvs%fsd24 - forc_solad240 => pvs%fsd240 - forc_solai24 => pvs%fsi24 - forc_solai240 => pvs%fsi240 - fsun24 => pvs%fsun24 - fsun240 => pvs%fsun240 - elai_p => pvs%elai_p - - ! initialize variables which get passed to the atmosphere - vocflx(lbp:ubp,:) = 0._r8 - vocflx_tot(lbp:ubp) = 0._r8 - - do imeg=1,shr_megan_megcomps_n - meg_out(imeg)%flux_out(lbp:ubp) = 0._r8 - enddo - - gamma_out(lbp:ubp) = spval - gammaP_out(lbp:ubp) = spval - gammaT_out(lbp:ubp) = spval - gammaA_out(lbp:ubp) = spval - gammaS_out(lbp:ubp) = spval - gammaL_out(lbp:ubp) = spval - gammaC_out(lbp:ubp) = spval - - paru_out(lbp:ubp) = spval - par24u_out(lbp:ubp) = spval - par240u_out(lbp:ubp) = spval - - para_out(lbp:ubp) = spval - par24a_out(lbp:ubp) = spval - par240a_out(lbp:ubp) = spval - - alpha_out(lbp:ubp) = spval - cp_out(lbp:ubp) = spval - - topt_out(lbp:ubp) = spval - Eopt_out(lbp:ubp) = spval - - ! Begin loop over points - !_______________________________________________________________________________ - do fp = 1,num_soilp - p = filter_soilp(fp) - g = pgridcell(p) - c = pcolumn(p) - - ! initialize EF - epsilon=0._r8 - - ! initalize to zero since this might not alway get set - ! this needs to be within the fp loop ... - vocflx_meg(:) = 0._r8 - - ! calculate VOC emissions for non-bare ground PFTs - if (ivt(p) > 0) then - gamma=0._r8 - - ! Calculate PAR: multiply w/m2 by 4.6 to get umol/m2/s for par (added 8/14/02) - !------------------------ - ! SUN: - par_sun = (forc_solad(g,1) + fsun(p) * forc_solai(g,1)) * 4.6_r8 - par24_sun = (forc_solad24(p) + fsun24(p) * forc_solai24(p)) * 4.6_r8 - par240_sun = (forc_solad240(p) + fsun240(p) * forc_solai240(p)) * 4.6_r8 - ! SHADE: - par_sha = ((1._r8 - fsun(p)) * forc_solai(g,1)) * 4.6_r8 - par24_sha = ((1._r8 - fsun24(p)) * forc_solai24(p)) * 4.6_r8 - par240_sha = ((1._r8 - fsun240(p)) * forc_solai240(p)) * 4.6_r8 - - ! Activity factor for LAI (Guenther et al., 2006): all species - gamma_l = get_gamma_L(fsun240(p), elai(p)) - - ! Activity factor for soil moisture: all species (commented out for now) -! gamma_sm = get_gamma_SM(clayfrac(p), sandfrac(p), h2osoi_vol(c,:), h2osoi_ice(c,:), & -! dz(c,:), bsw(c,:), watsat(c,:), sucsat(c,:), root_depth(ivt(p))) - gamma_sm = 1.0_r8 - - ! Loop through VOCs for light, temperature and leaf age activity factor & apply - ! all final activity factors to baseline emission factors - !_______________________________________________________________________________ - - ! loop over megan compounds - meg_cmp => shr_megan_linkedlist - meg_cmp_loop: do while(associated(meg_cmp)) - imeg = meg_cmp%index - - ! set emis factor - ! if specified, set EF for isoprene with mapped values - if ( trim(meg_cmp%name) == 'isoprene' .and. shr_megan_mapped_emisfctrs) then - epsilon = get_map_EF(ivt(p),g) - else - epsilon = meg_cmp%emis_factors(ivt(p)) - end if - - class_num = meg_cmp%class_number - - ! Activity factor for PPFD - gamma_p = get_gamma_P(par_sun, par24_sun, par240_sun, par_sha, par24_sha, par240_sha, & - fsun(p), fsun240(p), forc_solad240(p),forc_solai240(p), LDF(class_num), cp, alpha) - - ! Activity factor for T - gamma_t = get_gamma_T(t_veg240(p), t_veg24(p),t_veg(p), ct1(class_num), ct2(class_num),& - betaT(class_num),LDF(class_num), Ceo(class_num), Eopt, topt) - - ! Activity factor for Leaf Age - gamma_a = get_gamma_A(ivt(p), elai_p(p),elai(p),class_num) - - ! Activity factor for CO2 (only for isoprene) - if (trim(meg_cmp%name) == 'isoprene') then - co2_ppmv = 1.e6*forc_pco2(g)/forc_pbot(g) - gamma_c = get_gamma_C(cisun(p),cisha(p),forc_pbot(g),fsun(p), co2_ppmv) - else - gamma_c = 1._r8 - end if - - ! Calculate total scaling factor - gamma = gamma_l * gamma_sm * gamma_a * gamma_p * gamma_T * gamma_c - - if ( (gamma >=0.0_r8) .and. (gamma< 100._r8) ) then - - vocflx_meg(imeg) = epsilon * gamma * megemis_units_factor / meg_cmp%molec_weight ! moles/m2/sec - - ! assign to arrays for history file output (not weighted by landfrac) - meg_out(imeg)%flux_out(p) = meg_out(imeg)%flux_out(p) & - + epsilon * gamma * megemis_units_factor*1.e-3_r8 ! Kg/m2/sec - - if (imeg==1) then - ! - gamma_out(p)=gamma - gammaP_out(p)=gamma_p - gammaT_out(p)=gamma_t - gammaA_out(p)=gamma_a - gammaS_out(p)=gamma_sm - gammaL_out(p)=gamma_l - gammaC_out(p)=gamma_c - - paru_out(p)=par_sun - par24u_out(p)=par24_sun - par240u_out(p)=par240_sun - - para_out(p)=par_sha - par24a_out(p)=par24_sha - par240a_out(p)=par240_sha - - alpha_out(p)=alpha - cp_out(p)=cp - - topt_out(p)=topt - Eopt_out(p)=Eopt - - end if - endif - - if (debug .and. gamma > 0.0_r8) then - write(iulog,*) 'MEGAN: n, megan name, epsilon, gamma, vocflx: ', & - imeg, meg_cmp%name, epsilon, gamma, vocflx_meg(imeg), gamma_p,gamma_t,gamma_a,gamma_sm,gamma_l - endif - - meg_cmp => meg_cmp%next_megcomp - enddo meg_cmp_loop - - ! sum up the megan compound fluxes for the fluxes of chem mechanism compounds - do imech = 1,shr_megan_mechcomps_n - n_meg_comps = shr_megan_mechcomps(imech)%n_megan_comps - do imeg = 1,n_meg_comps ! loop over number of megan compounds that make up the nth mechanism compoud - ii = shr_megan_mechcomps(imech)%megan_comps(imeg)%ptr%index - vocflx(p,imech) = vocflx(p,imech) + vocflx_meg(ii) - enddo - vocflx_tot(p) = vocflx_tot(p) + vocflx(p,imech) ! moles/m2/sec - enddo - - end if ! ivt(1:15 only) - - enddo ! fp - - end subroutine VOCEmission -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! !IROUTINE: init_EF_params -! -! !INTERFACE: - subroutine VOCEmission_init( ) - ! Interface to set all input parameters for 20 VOC compound classes. - ! including EFs for 16(+1 bare ground) PFTs. - ! For now set all specified values, in future to be replaced with values read in from file. - ! (heald, 04/27/11) - - use shr_megan_mod, only : shr_megan_factors_file - use MEGANFactorsMod, only : megan_factors_init, megan_factors_get - -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! -! !USES -! -! !ARGUMENTS: - implicit none - -! character(len=*),intent(in) :: filename -! -! !LOCAL VARIABLES: -!----------------------------------------------------------------------- - - integer :: nmech, nmeg - type(shr_megan_megcomp_t), pointer :: meg_cmp - - integer :: class_num - real(r8) :: factors(numpft) - real(r8) :: molec_wght - - if ( shr_megan_mechcomps_n < 1) return - - call megan_factors_init( shr_megan_factors_file ) - - meg_cmp => shr_megan_linkedlist - do while(associated(meg_cmp)) - allocate(meg_cmp%emis_factors(numpft)) - call megan_factors_get( trim(meg_cmp%name), factors, class_num, molec_wght ) - meg_cmp%emis_factors = factors - meg_cmp%class_number = class_num - meg_cmp%molec_weight = molec_wght - meg_cmp => meg_cmp%next_megcomp - enddo - - end subroutine VOCEmission_init -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_map_EF -! -! !INTERFACE: -function get_map_EF(ivt_in,g_in) -! -! Get mapped EF for isoprene -! Use gridded values for 6 PFTs specified by MEGAN following -! Guenther et al. (2006). Map the numpft CLM PFTs to these 6. -! Units: [ug m-2 h-1] -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! - -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none -! -! !LOCAL VARIABLES: - - ! varibles in - integer, intent(in) :: ivt_in - integer, intent(in) :: g_in - real(r8) :: get_map_EF - - real(r8), pointer :: efisop(:,:) ! emission factors for isoprene for each pft [ug m-2 h-1] - - ! assign local pointer - efisop => gve%efisop -!----------------------------------------------------------------------- - get_map_EF = 0._r8 - - if ( ivt_in == ndllf_evr_tmp_tree & - .or. ivt_in == ndllf_evr_brl_tree) then !fineleaf evergreen - get_map_EF = efisop(2,g_in) - else if (ivt_in == ndllf_dcd_brl_tree) then !fineleaf deciduous - get_map_EF = efisop(3,g_in) - else if (ivt_in >= nbrdlf_evr_trp_tree & - .and. ivt_in <= nbrdlf_dcd_brl_tree) then !broadleaf trees - get_map_EF = efisop(1,g_in) - else if (ivt_in >= nbrdlf_evr_shrub & - .and. ivt_in <= nbrdlf_dcd_brl_shrub) then !shrubs - get_map_EF = efisop(4,g_in) - else if (ivt_in >= nc3_arctic_grass & - .and. ivt_in <= nc4_grass) then !grass - get_map_EF = efisop(5,g_in) - else if (ivt_in >= nc3crop) then !crops - get_map_EF =efisop(6,g_in) - end if - -end function get_map_EF -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_gamma_P -! -! !INTERFACE: - function get_gamma_P(par_sun_in, par24_sun_in, par240_sun_in, par_sha_in, par24_sha_in, par240_sha_in, & - fsun_in, fsun240_in, forc_solad240_in,forc_solai240_in, LDF_in, cp, alpha) - -! Activity factor for PPFD (Guenther et al., 2006): all light dependent species -!------------------------- -! With distinction between sunlit and shaded leafs, weight scalings by -! fsun and fshade -! Scale total incident par by fraction of sunlit leaves (added on 1/2002) - -! fvitt -- forc_solad240, forc_solai240 can be zero when CLM finidat is specified -! which will cause par240 to be zero and produce NaNs via log(par240) -! dml -- fsun240 can be equal to or greater than one before 10 day averages are -! set on startup or if a new pft comes online during land cover change. -! Avoid this problem by only doing calculations with fsun240 when fsun240 is -! between 0 and 1 -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! -! -! !ARGUMENTS: - implicit none -! -! !LOCAL VARIABLES: - - ! varibles in - real(r8),intent(in) :: par_sun_in - real(r8),intent(in) :: par24_sun_in - real(r8),intent(in) :: par240_sun_in - real(r8),intent(in) :: par_sha_in - real(r8),intent(in) :: par24_sha_in - real(r8),intent(in) :: par240_sha_in - real(r8),intent(in) :: fsun_in - real(r8),intent(in) :: fsun240_in - real(r8),intent(in) :: forc_solad240_in - real(r8),intent(in) :: forc_solai240_in - real(r8),intent(in) :: LDF_in - - real(r8),intent(out) :: cp ! temporary - real(r8),intent(out) :: alpha ! temporary - real(r8) :: gamma_p_LDF ! activity factor for PPFD - real(r8) :: get_gamma_P ! return value - - real(r8), parameter :: ca1 = 0.004_r8 ! empirical coefficent for alpha - real(r8), parameter :: ca2 = 0.0005_r8 ! empirical coefficent for alpha - real(r8), parameter :: ca3 = 0.0468_r8 ! empirical coefficent for cp - real(r8), parameter :: par0_sun = 200._r8 ! std conditions for past 24 hrs [umol/m2/s] - real(r8), parameter :: par0_shade = 50._r8 ! std conditions for past 24 hrs [umol/m2/s] - real(r8), parameter :: alpha_fix = 0.001_r8 ! empirical coefficient - real(r8), parameter :: cp_fix = 1.21_r8 ! empirical coefficient -! -! local pointers to implicit in arguments -! -!----------------------------------------------------------------------- - - if ( (fsun240_in > 0._r8) .and. (fsun240_in < 1._r8) .and. (forc_solad240_in > 0._r8) & - .and. (forc_solai240_in > 0._r8)) then - ! With alpha and cp calculated based on eq 6 and 7: - ! Note indexing for accumulated variables is all at pft level - ! SUN: - alpha = ca1 - ca2 * log(par240_sun_in) - cp = ca3 * exp(ca2 * (par24_sun_in-par0_sun))*par240_sun_in**(0.6_r8) - gamma_p_LDF = fsun_in * ( cp * alpha * par_sun_in * (1._r8 + alpha*alpha*par_sun_in*par_sun_in)**(-0.5_r8) ) - ! SHADE: - alpha = ca1 - ca2 * log(par240_sha_in) - cp = ca3 * exp(ca2 * (par_sha_in-par0_shade))*par240_sha_in**(0.6_r8) - gamma_p_LDF = gamma_p_LDF + (1._r8-fsun_in) * (cp*alpha*par_sha_in*(1._r8 + alpha*alpha*par_sha_in*par_sha_in)**(-0.5_r8)) - else - ! With fixed alpha and cp (from MEGAN User's Guide): - ! SUN: direct + diffuse - alpha = alpha_fix - cp = cp_fix - gamma_p_LDF = fsun_in * ( cp * alpha*par_sun_in * (1._r8 + alpha*alpha*par_sun_in*par_sun_in)**(-0.5_r8) ) - ! SHADE: diffuse - gamma_p_LDF = gamma_p_LDF + (1._r8-fsun_in) * (cp*alpha*par_sha_in*(1._r8 + alpha*alpha*par_sha_in*par_sha_in)**(-0.5_r8)) - end if - - ! Calculate total activity factor for PPFD accounting for light-dependent fraction - get_gamma_P = (1._r8 - LDF_in) + LDF_in * gamma_p_LDF - -end function get_gamma_P -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_gamma_L -! -! !INTERFACE: -function get_gamma_L(fsun240_in,elai_in) -! -! Activity factor for LAI (Guenther et al., 2006): all species -! Guenther et al., 2006 eq 3 -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! - -! !USES: - use clm_varcon , only : denice - use clm_varpar , only : nlevsoi -! -! !ARGUMENTS: - implicit none -! -! !LOCAL VARIABLES: - - ! varibles in - real(r8),intent(in) :: fsun240_in - real(r8),intent(in) :: elai_in - real(r8) :: get_gamma_L ! return value - - - ! parameters - real(r8), parameter :: cce = 0.30_r8 ! factor to set emissions to unity @ std - real(r8), parameter :: cce1 = 0.24_r8 ! same as Cce but for non-accumulated vars -!----------------------------------------------------------------------- - if ( (fsun240_in > 0.0_r8) .and. (fsun240_in < 1.e30_r8) ) then - get_gamma_L = cce * elai_in - else - get_gamma_L = cce1 * elai_in - end if - -end function get_gamma_L -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_gamma_SM -! -! !INTERFACE: -function get_gamma_SM(clayfrac_in, sandfrac_in, h2osoi_vol_in, h2osoi_ice_in, dz_in, & - bsw_in, watsat_in, sucsat_in, root_depth_in) -! -! Activity factor for soil moisture (Guenther et al., 2006): all species -!---------------------------------- -! Calculate the mean scaling factor throughout the root depth. -! wilting point potential is in units of matric potential (mm) -! (1 J/Kg = 0.001 MPa, approx = 0.1 m) -! convert to volumetric soil water using equation 7.118 of the CLM4 Technical Note -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! - -! !USES: - use clm_varcon , only : denice - use clm_varpar , only : nlevsoi -! -! !ARGUMENTS: - implicit none -! -! !LOCAL VARIABLES: - - ! varibles in - real(r8),intent(in) :: clayfrac_in - real(r8),intent(in) :: sandfrac_in - real(r8),intent(in) :: h2osoi_vol_in(nlevsoi) - real(r8),intent(in) :: h2osoi_ice_in(nlevsoi) - real(r8),intent(in) :: dz_in(nlevsoi) - real(r8),intent(in) :: bsw_in(nlevsoi) - real(r8),intent(in) :: watsat_in(nlevsoi) - real(r8),intent(in) :: sucsat_in(nlevsoi) - real(r8),intent(in) :: root_depth_in - - real(r8) :: get_gamma_SM - - ! local variables - integer :: j - real(r8) :: nl ! temporary number of soil levels - real(r8) :: theta_ice ! water content in ice in m3/m3 - real(r8) :: wilt ! wilting point in m3/m3 - real(r8) :: theta1 ! temporary - - ! parameters - real(r8), parameter :: deltheta1=0.06_r8 ! empirical coefficient - real(r8), parameter :: smpmax = 2.57e5_r8 ! maximum soil matrix potential - - if ((clayfrac_in > 0) .and. (sandfrac_in > 0)) then - get_gamma_SM = 0._r8 - nl=0._r8 - - do j = 1,nlevsoi - if (sum(dz_in(1:j)) < root_depth_in) then - theta_ice = h2osoi_ice_in(j)/(dz_in(j)*denice) - wilt = ((smpmax/sucsat_in(j))**(-1._r8/bsw_in(j))) * (watsat_in(j) - theta_ice) - theta1 = wilt + deltheta1 - if (h2osoi_vol_in(j) >= theta1) then - get_gamma_SM = get_gamma_SM + 1._r8 - else if ( (h2osoi_vol_in(j) > wilt) .and. (h2osoi_vol_in(j) < theta1) ) then - get_gamma_SM = get_gamma_SM + ( h2osoi_vol_in(j) - wilt ) / deltheta1 - else - get_gamma_SM = get_gamma_SM + 0._r8 - end if - nl=nl+1._r8 - end if - end do - - if (nl > 0._r8) then - get_gamma_SM = get_gamma_SM/nl - endif - - if (get_gamma_SM > 1.0_r8) then - write(iulog,*) 'healdSM > 1: gamma_SM, nl', get_gamma_SM, nl - get_gamma_SM=1.0_r8 - endif - - else - get_gamma_SM = 1.0_r8 - end if - - -end function get_gamma_SM -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_gamma_T -! -! !INTERFACE: -function get_gamma_T(t_veg240_in, t_veg24_in,t_veg_in, ct1_in, ct2_in, betaT_in, LDF_in, Ceo_in, Eopt, topt) - -! Activity factor for temperature -!-------------------------------- -! Calculate both a light-dependent fraction as in Guenther et al., 2006 for isoprene -! of a max saturation type form. Also caculate a light-independent fraction of the -! form of an exponential. Final activity factor depends on light dependent fraction -! of compound type. -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! -! !ARGUMENTS: - implicit none -! -! !LOCAL VARIABLES: - - ! varibles in - real(r8),intent(in) :: t_veg240_in - real(r8),intent(in) :: t_veg24_in - real(r8),intent(in) :: t_veg_in - real(r8),intent(in) :: ct1_in - real(r8),intent(in) :: ct2_in - real(r8),intent(in) :: betaT_in - real(r8),intent(in) :: LDF_in - real(r8),intent(in) :: Ceo_in - real(r8),intent(out) :: Eopt ! temporary - real(r8),intent(out) :: topt ! temporary - - ! local variables - real(r8) :: get_gamma_T - real(r8) :: gamma_t_LDF ! activity factor for temperature - real(r8) :: gamma_t_LIF ! activity factor for temperature - real(r8) :: x ! temporary - - ! parameters - real(r8), parameter :: co1 = 313._r8 ! empirical coefficient - real(r8), parameter :: co2 = 0.6_r8 ! empirical coefficient - real(r8), parameter :: co4 = 0.05_r8 ! empirical coefficient - real(r8), parameter :: tstd0 = 297_r8 ! std temperature [K] - real(r8), parameter :: topt_fix = 317._r8 ! std temperature [K] - real(r8), parameter :: Eopt_fix = 2.26_r8 ! empirical coefficient - real(r8), parameter :: ct3 = 0.00831_r8 ! empirical coefficient (0.0083 in User's Guide) - real(r8), parameter :: tstd = 303.15_r8 ! std temperature [K] - real(r8), parameter :: bet = 0.09_r8 ! beta empirical coefficient [K-1] -!----------------------------------------------------------------------- - - ! Light dependent fraction (Guenther et al., 2006) - if ( (t_veg240_in > 0.0_r8) .and. (t_veg240_in < 1.e30_r8) ) then - ! topt and Eopt from eq 8 and 9: - topt = co1 + (co2 * (t_veg240_in-tstd0)) - Eopt = Ceo_in * exp (co4 * (t_veg24_in-tstd0)) * exp(co4 * (t_veg240_in -tstd0)) - else - topt = topt_fix - Eopt = Eopt_fix - endif - x = ( (1._r8/topt) - (1._r8/(t_veg_in)) ) / ct3 - gamma_t_LDF = Eopt * ( ct2_in * exp(ct1_in * x)/(ct2_in - ct1_in * (1._r8 - exp(ct2_in * x))) ) - - - ! Light independent fraction (of exp(beta T) form) - gamma_t_LIF = exp(betaT_in * (t_veg_in - tstd)) - - ! Calculate total activity factor for light as a function of light-dependent fraction - !-------------------------------- - get_gamma_T = (1-LDF_in)*gamma_T_LIF + LDF_in*gamma_T_LDF - -end function get_gamma_T -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_gamma_A -! -! !INTERFACE: -function get_gamma_A(ivt_in, elai_p_in,elai_in,nclass_in) - -! Activity factor for leaf age (Guenther et al., 2006) -!----------------------------- -! If not CNDV elai is constant therefore gamma_a=1.0 -! gamma_a set to unity for evergreens (PFTs 1, 2, 4, 5) -! Note that we assume here that the time step is shorter than the number of -!days after budbreak required to induce isoprene emissions (ti=12 days) and -! the number of days after budbreak to reach peak emission (tm=28 days) -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (4/27/11) -! -! !ARGUMENTS: - implicit none -! !LOCAL VARIABLES: - - ! varibles in - integer,intent(in) :: ivt_in - integer,intent(in) :: nclass_in - real(r8),intent(in) :: elai_p_in - real(r8),intent(in) :: elai_in - - real(r8) :: get_gamma_A - - ! local variables - real(r8) :: elai_prev ! lai for previous timestep - real(r8) :: fnew, fgro, fmat, fold ! fractions of leaves at different phenological stages - !----------------------------------------------------------------------- - if ( (ivt_in == ndllf_dcd_brl_tree) .or. (ivt_in >= nbrdlf_dcd_trp_tree) ) then ! non-evergreen - - if ( (elai_p_in > 0.0_r8) .and. (elai_p_in < 1.e30_r8) )then - elai_prev = 2._r8*elai_p_in-elai_in ! have accumulated average lai over last timestep - if (elai_prev == elai_in) then - fnew = 0.0_r8 - fgro = 0.0_r8 - fmat = 1.0_r8 - fold = 0.0_r8 - else if (elai_prev > elai_in) then - fnew = 0.0_r8 - fgro = 0.0_r8 - fmat = 1.0_r8 - (elai_prev - elai_in)/elai_prev - fold = (elai_prev - elai_in)/elai_prev - else if (elai_prev < elai_in) then - fnew = 1 - (elai_prev / elai_in) - fgro = 0.0_r8 - fmat = (elai_prev / elai_in) - fold = 0.0_r8 - end if - - get_gamma_A = fnew*Anew(nclass_in) + fgro*Agro(nclass_in) + fmat*Amat(nclass_in) + fold*Aold(nclass_in) - - else - get_gamma_A = 1.0_r8 - end if - - else - get_gamma_A = 1.0_r8 - end if - - - end function get_gamma_A -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -! FUNCTION: get_gamma_C -! -! !INTERFACE: - function get_gamma_C(cisun_in,cisha_in,forc_pbot_in,fsun_in, co2_ppmv) - -! Activity factor for instantaneous CO2 changes (Heald et al., 2009) -!------------------------- -! With distinction between sunlit and shaded leaves, weight scalings by -! fsun and fshade -! -! !CALLED FROM: VOCEmission -! -! !REVISION HISTORY: -! Author: Colette L. Heald (11/30/11) -! Louisa K. Emmons (16/03/2015) - implement Colette's intended code -! and use atmosphere CO2 (not nml setting) -! -! !USES: -! use clm_varctl, only : co2_ppmv ! corresponds to CCSM_CO2_PPMV set in env_conf.xml -! -! !ARGUMENTS: - implicit none -! !LOCAL VARIABLES: - - ! varibles in - real(r8),intent(in) :: cisun_in - real(r8),intent(in) :: cisha_in - real(r8),intent(in) :: forc_pbot_in - real(r8),intent(in) :: fsun_in - real(r8),intent(in) :: co2_ppmv - - real(r8) :: get_gamma_C - - ! local variables - real(r8) :: Ismax ! empirical coeff for CO2 - real(r8) :: h ! empirical coeff for CO2 - real(r8) :: Cstar ! empirical coeff for CO2 - real(r8) :: fint ! interpolation fraction for CO2 - real(r8) :: ci ! temporary sunlight/shade weighted cisun & cisha (umolCO2/mol) - real(r8) :: gamma_ci ! short-term exposure gamma - real(r8) :: gamma_ca ! long-term exposure gamma - !----------------------------------------------------------------------- - - - ! LONG-TERM EXPOSURE (based on ambient CO2, Ca) - !----------------------------------------------------------------------------- - gamma_ca = 1.344_r8 - ( (1.344_r8*(0.7_r8*co2_ppmv)**1.4614_r8)/(585._r8**1.4614_r8+(0.7_r8*co2_ppmv)**1.4614_r8) ) - - - ! SHORT-TERM EXPOSURE (based on intercellular CO2, Ci) - !----------------------------------------------------------------------------- - ! Determine long-term CO2 growth environment (ie. ambient CO2) and interpolate - ! parameters - if ( co2_ppmv < 400._r8 ) then - Ismax = 1.072_r8 - h = 1.70_r8 - Cstar = 1218._r8 - else if ( (co2_ppmv > 400._r8) .and. (co2_ppmv < 600._r8) ) then - fint = (co2_ppmv - 400._r8)/200._r8 - Ismax = fint*1.036_r8 + (1.- fint)*1.072_r8 - h = fint*2.0125_r8 + (1.- fint)*1.70_r8 - Cstar = fint*1150._r8 + (1.- fint)*1218._r8 - else if ( (co2_ppmv > 600._r8) .and. (co2_ppmv < 800._r8) ) then - fint = (co2_ppmv - 600._r8)/200._r8 - Ismax = fint*1.046_r8 + (1.- fint)*1.036_r8 - h = fint*1.5380_r8 + (1.- fint)*2.0125_r8 - Cstar = fint*2025._r8 + (1.- fint)*1150._r8 - else if ( co2_ppmv > 800._r8 ) then - Ismax = 1.014_r8 - h = 2.861_r8 - Cstar = 1525._r8 - end if - - ! Intercellular CO2 concentrations (ci) given in Pa, divide by atmos - ! pressure to get mixing ratio (umolCO2/mol) - if ( (cisun_in .gt. 0._r8) .and. (cisha_in .gt. 0._r8) .and. & - (cisun_in .eq. cisun_in) .and. (cisha_in .eq. cisha_in) .and. (forc_pbot_in > 0._r8) .and. (fsun_in > 0._r8) ) then - ci = ( fsun_in*cisun_in + (1._r8-fsun_in)*cisha_in )/forc_pbot_in * 1.e6_r8 - gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) ) - else if ( (cisun_in > 0.0_r8) .and. (cisun_in < 1.e30_r8) .and. (forc_pbot_in > 0._r8) .and. (fsun_in .eq. 1._r8) ) then - ci = cisun_in/forc_pbot_in * 1.e6_r8 - gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) ) - else if ( (cisha_in > 0.0_r8) .and. (cisha_in < 1.e30_r8) .and. (forc_pbot_in > 0._r8) .and. (fsun_in .eq. 0._r8) ) then - ci = cisha_in/forc_pbot_in * 1.e6_r8 - gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) ) - else - gamma_ci = 1._r8 - end if - - get_gamma_C = gamma_ci * gamma_ca - - end function get_gamma_C -!----------------------------------------------------------------------- - -end module VOCEmissionMod - - diff --git a/src_clm40/biogeophys/BalanceCheckMod.F90 b/src_clm40/biogeophys/BalanceCheckMod.F90 deleted file mode 100644 index 980690ff0c..0000000000 --- a/src_clm40/biogeophys/BalanceCheckMod.F90 +++ /dev/null @@ -1,735 +0,0 @@ -module BalanceCheckMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: BalanceCheckMod -! -! !DESCRIPTION: -! Water and energy balance check. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only: endrun - use clm_varctl, only: iulog -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: BeginWaterBalance ! Initialize water balance check - public :: BalanceCheck ! Water and energy balance check -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BeginWaterBalance -! -! !INTERFACE: - subroutine BeginWaterBalance(lbc, ubc, lbp, ubp, & - num_nolakec, filter_nolakec, num_lakec, filter_lakec, & - num_hydrologyc, filter_hydrologyc) -! -! !DESCRIPTION: -! Initialize column-level water balance at beginning of time step -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_varpar , only : nlevgrnd, nlevsoi - use subgridAveMod, only : p2c - use clm_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, & - icol_road_imperv -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_lakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_lakec(ubc-lbc+1) ! column filter for non-lake points - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(ubc-lbc+1) ! column filter for soil points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in variables -! - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: h2ocan_pft(:) ! canopy water (mm H2O) (pft-level) - real(r8), pointer :: wa(:) ! water in the unconfined aquifer (mm) - integer , pointer :: ctype(:) ! column type - real(r8), pointer :: zwt(:) ! water table depth (m) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) -! -! local pointers to original implicit out variables -! - real(r8), pointer :: h2ocan_col(:) ! canopy water (mm H2O) (column level) - real(r8), pointer :: begwb(:) ! water mass begining of the time step -! -! !OTHER LOCAL VARIABLES: -! - integer :: c, p, f, j, fc ! indices -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (column-level) - - h2osno => cws%h2osno - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - begwb => cwbal%begwb - h2ocan_col => pws_a%h2ocan - wa => cws%wa - ctype => col%itype - zwt => cws%zwt - zi => cps%zi - - ! Assign local pointers to derived type members (pft-level) - - h2ocan_pft => pws%h2ocan - - ! Determine beginning water balance for time step - ! pft-level canopy water averaged to column - call p2c(num_nolakec, filter_nolakec, h2ocan_pft, h2ocan_col) - - do f = 1, num_hydrologyc - c = filter_hydrologyc(f) - if(zwt(c) <= zi(c,nlevsoi)) then - wa(c) = 5000._r8 - end if - end do - - do f = 1, num_nolakec - c = filter_nolakec(f) - if (ctype(c) == icol_roof .or. ctype(c) == icol_sunwall & - .or. ctype(c) == icol_shadewall .or. ctype(c) == icol_road_imperv) then - begwb(c) = h2ocan_col(c) + h2osno(c) - else - begwb(c) = h2ocan_col(c) + h2osno(c) + wa(c) - end if - end do - do j = 1, nlevgrnd - do f = 1, num_nolakec - c = filter_nolakec(f) - begwb(c) = begwb(c) + h2osoi_ice(c,j) + h2osoi_liq(c,j) - end do - end do - - do f = 1, num_lakec - c = filter_lakec(f) - begwb(c) = h2osno(c) - end do - - end subroutine BeginWaterBalance -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BalanceCheck -! -! !INTERFACE: - subroutine BalanceCheck(lbp, ubp, lbc, ubc, lbl, ubl, lbg, ubg) -! -! !DESCRIPTION: -! This subroutine accumulates the numerical truncation errors of the water -! and energy balance calculation. It is helpful to see the performance of -! the process of integration. -! -! The error for energy balance: -! -! error = abs(Net radiation - change of internal energy - Sensible heat -! - Latent heat) -! -! The error for water balance: -! -! error = abs(precipitation - change of water storage - evaporation - runoff) -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use subgridAveMod - use clm_time_manager , only : get_step_size, get_nstep - use clm_varcon , only : isturb, icol_roof, icol_sunwall, icol_shadewall, & - spval, icol_road_perv, icol_road_imperv, istice_mec, & - istdlak, istslak, istwet, istcrop, istsoil - use clm_varctl , only : glc_dyntopo -! -! !ARGUMENTS: - implicit none - integer :: lbp, ubp ! pft-index bounds - integer :: lbc, ubc ! column-index bounds - integer :: lbl, ubl ! landunit-index bounds - integer :: lbg, ubg ! grid-index bounds -! -! !CALLED FROM: -! subroutine clm_driver -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 10 November 2000: Mariana Vertenstein -! Migrated to new data structures by Mariana Vertenstein and -! Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - logical , pointer :: do_capsnow(:) ! true => do snow capping - real(r8), pointer :: qflx_floodc(:) ! total runoff due to flooding - real(r8), pointer :: qflx_snow_melt(:) ! snow melt (net) - real(r8), pointer :: qflx_rain_grnd_col(:) ! rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_col(:) ! snow on ground after interception (mm H2O/s) [+] - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: cgridcell(:) ! column's gridcell index - integer , pointer :: clandunit(:) ! column's landunit index - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: ctype(:) ! column type - real(r8), pointer :: pwtgcell(:) ! pft's weight relative to corresponding gridcell - real(r8), pointer :: cwtgcell(:) ! column's weight relative to corresponding gridcell - real(r8), pointer :: forc_rain(:) ! rain rate [mm/s] - real(r8), pointer :: forc_snow(:) ! snow rate [mm/s] - real(r8), pointer :: forc_lwrad(:) ! downward infrared (longwave) radiation (W/m**2) - real(r8), pointer :: endwb(:) ! water mass end of the time step - real(r8), pointer :: begwb(:) ! water mass begining of the time step - real(r8), pointer :: fsa(:) ! solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsr(:) ! solar radiation reflected (W/m**2) - real(r8), pointer :: eflx_lwrad_out(:) ! emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_net(:) ! net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: sabv(:) ! solar radiation absorbed by vegetation (W/m**2) - real(r8), pointer :: sabg(:) ! solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: eflx_sh_tot(:) ! total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_totg(:) ! total sensible heat flux at grid level (W/m**2) [+ to atm] - real(r8), pointer :: eflx_dynbal(:) ! energy conversion flux due to dynamic land cover change(W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot(:) ! total latent heat flux (W/m8*2) [+ to atm] - real(r8), pointer :: eflx_soil_grnd(:) ! soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: qflx_evap_tot(:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: qflx_irrig(:) ! irrigation flux (mm H2O /s) - real(r8), pointer :: qflx_surf(:) ! surface runoff (mm H2O /s) - real(r8), pointer :: qflx_qrgwl(:) ! qflx_surf at glaciers, wetlands, lakes - real(r8), pointer :: qflx_drain(:) ! sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_runoff(:) ! total runoff (mm H2O /s) - real(r8), pointer :: qflx_runoffg(:) ! total runoff at gridcell level inc land cover change flux (mm H2O /s) - real(r8), pointer :: qflx_liq_dynbal(:) ! liq runoff due to dynamic land cover change (mm H2O /s) - real(r8), pointer :: qflx_snwcp_ice(:) ! excess snowfall due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: qflx_glcice(:) ! flux of new glacier ice (mm H2O /s) [+ if ice grows] - real(r8), pointer :: qflx_glcice_frz(:) ! ice growth (mm H2O/s) [+] - real(r8), pointer :: qflx_snwcp_iceg(:) ! excess snowfall due to snow cap inc land cover change flux (mm H20/s) - real(r8), pointer :: qflx_ice_dynbal(:) ! ice runoff due to dynamic land cover change (mm H2O /s) - real(r8), pointer :: forc_solad(:,:) ! direct beam radiation (vis=forc_sols , nir=forc_soll ) - real(r8), pointer :: forc_solai(:,:) ! diffuse radiation (vis=forc_solsd, nir=forc_solld) - real(r8), pointer :: eflx_traffic_pft(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat_pft(:) ! sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width - real(r8), pointer :: eflx_heat_from_ac_pft(:) !sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: h2osno_old(:) ! snow water (mm H2O) at previous time step - real(r8), pointer :: qflx_dew_snow(:) ! surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_sub_snow(:) ! sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_top_soil(:) ! net water input into soil from top (mm/s) - real(r8), pointer :: qflx_dew_grnd(:) ! ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: qflx_evap_grnd(:) ! ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_prec_grnd(:) ! water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_snwcp_liq(:) ! excess liquid water due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: qflx_sl_top_soil(:) ! liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - integer , pointer :: snl(:) ! number of snow layers -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: errh2o(:) ! water conservation error (mm H2O) - real(r8), pointer :: errsol(:) ! solar radiation conservation error (W/m**2) - real(r8), pointer :: errlon(:) ! longwave radiation conservation error (W/m**2) - real(r8), pointer :: errseb(:) ! surface energy conservation error (W/m**2) - real(r8), pointer :: netrad(:) ! net radiation (positive downward) (W/m**2) - real(r8), pointer :: errsoi_col(:) ! column-level soil/lake energy conservation error (W/m**2) - real(r8), pointer :: snow_sources(:) ! snow sources (mm H2O /s) - real(r8), pointer :: snow_sinks(:) ! snow sinks (mm H2O /s) - real(r8), pointer :: errh2osno(:) ! error in h2osno (kg m-2) -! -!EOP -! -! !OTHER LOCAL VARIABLES: - integer :: p,c,l,g ! indices - real(r8) :: dtime ! land model time step (sec) - integer :: nstep ! time step number - logical :: found ! flag in search loop - integer :: indexp,indexc,indexl,indexg ! index of first found in search loop - real(r8) :: forc_rain_col(lbc:ubc) ! column level rain rate [mm/s] - real(r8) :: forc_snow_col(lbc:ubc) ! column level snow rate [mm/s] - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type scalar members (gridcell-level) - - do_capsnow => cps%do_capsnow - qflx_floodc => cwf%qflx_floodc - qflx_snow_melt => cwf%qflx_snow_melt - qflx_rain_grnd_col => pwf_a%qflx_rain_grnd - qflx_snow_grnd_col => pwf_a%qflx_snow_grnd - clandunit => col%landunit - forc_rain => clm_a2l%forc_rain - forc_snow => clm_a2l%forc_snow - forc_lwrad => clm_a2l%forc_lwrad - forc_solad => clm_a2l%forc_solad - forc_solai => clm_a2l%forc_solai - - ! Assign local pointers to derived type scalar members (landunit-level) - - ltype => lun%itype - canyon_hwr => lun%canyon_hwr - - ! Assign local pointers to derived type scalar members (column-level) - - ctype => col%itype - cgridcell => col%gridcell - cwtgcell => col%wtgcell - endwb => cwbal%endwb - begwb => cwbal%begwb - qflx_irrig => cwf%qflx_irrig - qflx_surf => cwf%qflx_surf - qflx_qrgwl => cwf%qflx_qrgwl - qflx_drain => cwf%qflx_drain - qflx_runoff => cwf%qflx_runoff - qflx_snwcp_ice => pwf_a%qflx_snwcp_ice - qflx_evap_tot => pwf_a%qflx_evap_tot - qflx_glcice => cwf%qflx_glcice - qflx_glcice_frz => cwf%qflx_glcice_frz - errh2o => cwbal%errh2o - errsoi_col => cebal%errsoi - h2osno => cws%h2osno - h2osno_old => cws%h2osno_old - qflx_dew_snow => pwf_a%qflx_dew_snow - qflx_sub_snow => pwf_a%qflx_sub_snow - qflx_top_soil => cwf%qflx_top_soil - qflx_evap_grnd => pwf_a%qflx_evap_grnd - qflx_dew_grnd => pwf_a%qflx_dew_grnd - qflx_prec_grnd => pwf_a%qflx_prec_grnd - qflx_snwcp_liq => pwf_a%qflx_snwcp_liq - qflx_sl_top_soil => cwf%qflx_sl_top_soil - snow_sources => cws%snow_sources - snow_sinks => cws%snow_sinks - errh2osno => cws%errh2osno - snl => cps%snl - - ! Assign local pointers to derived type scalar members (pft-level) - - pgridcell => pft%gridcell - plandunit => pft%landunit - pwtgcell => pft%wtgcell - fsa => pef%fsa - fsr => pef%fsr - eflx_lwrad_out => pef%eflx_lwrad_out - eflx_lwrad_net => pef%eflx_lwrad_net - sabv => pef%sabv - sabg => pef%sabg - eflx_sh_tot => pef%eflx_sh_tot - eflx_lh_tot => pef%eflx_lh_tot - eflx_soil_grnd => pef%eflx_soil_grnd - errsol => pebal%errsol - errseb => pebal%errseb - errlon => pebal%errlon - netrad => pef%netrad - eflx_wasteheat_pft => pef%eflx_wasteheat_pft - eflx_heat_from_ac_pft => pef%eflx_heat_from_ac_pft - eflx_traffic_pft => pef%eflx_traffic_pft - - ! Assign local pointers to derived type scalar members (gridcell-level) - - qflx_runoffg => gwf%qflx_runoffg - qflx_liq_dynbal => gwf%qflx_liq_dynbal - qflx_snwcp_iceg => gwf%qflx_snwcp_iceg - qflx_ice_dynbal => gwf%qflx_ice_dynbal - eflx_sh_totg => gef%eflx_sh_totg - eflx_dynbal => gef%eflx_dynbal - - ! Get step size and time step - - nstep = get_nstep() - dtime = get_step_size() - - ! Determine column level incoming snow and rain - ! Assume no incident precipitation on urban wall columns (as in Hydrology1Mod.F90). - - do c = lbc,ubc - g = cgridcell(c) - if (ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall) then - forc_rain_col(c) = 0. - forc_snow_col(c) = 0. - else - forc_rain_col(c) = forc_rain(g) - forc_snow_col(c) = forc_snow(g) - end if - end do - - ! Water balance check - - do c = lbc, ubc - g = cgridcell(c) - l = clandunit(c) - - ! Note: Some glacier_mec cols may have zero weight - if (cwtgcell(c) > 0._r8 .or. ltype(l)==istice_mec)then - errh2o(c) = endwb(c) - begwb(c) & - - (forc_rain_col(c) + forc_snow_col(c) + qflx_irrig(c) + qflx_floodc(c) & - - qflx_evap_tot(c) - qflx_surf(c) & - - qflx_qrgwl(c) - qflx_drain(c) - qflx_snwcp_ice(c)) * dtime - - ! Suppose glc_dyntopo = T: - ! (1) We have qflx_snwcp_ice = 0, and excess snow has been incorporated in qflx_glcice. - ! This flux must be included here to complete the water balance. - ! (2) Meltwater from ice is allowed to run off and is included in qflx_qrgwl, - ! but the water content of the ice column has not changed (at least for now) because - ! an equivalent ice mass has been "borrowed" from the base of the column. That - ! meltwater is included in qflx_glcice. - ! - ! Note that qflx_glcice is only valid over ice_mec landunits; elsewhere it is spval - - if (glc_dyntopo .and. ltype(l)==istice_mec) then - errh2o(c) = errh2o(c) + qflx_glcice(c)*dtime - end if - - else - - errh2o(c) = 0.0_r8 - - end if - - end do - - found = .false. - do c = lbc, ubc - if (abs(errh2o(c)) > 1e-7_r8) then - found = .true. - indexc = c - end if - end do - if ( found ) then - write(iulog,*)'WARNING: water balance error ',& - ' nstep = ',nstep,' indexc= ',indexc,' errh2o= ',errh2o(indexc),' landunit type= ',ltype(clandunit(indexc)) - if ((ctype(indexc) .eq. icol_roof .or. ctype(indexc) .eq. icol_road_imperv .or. & - ctype(indexc) .eq. icol_road_perv) .and. abs(errh2o(indexc)) > 1.e-1 .and. (nstep > 2) ) then - write(iulog,*)'clm urban model is stopping - error is greater than 1.e-1' - write(iulog,*)'nstep = ',nstep,' indexc= ',indexc,' errh2o= ',errh2o(indexc) - write(iulog,*)'ctype(indexc): ',ctype(indexc) - write(iulog,*)'forc_rain = ',forc_rain_col(indexc) - write(iulog,*)'forc_snow = ',forc_snow_col(indexc) - write(iulog,*)'endwb = ',endwb(indexc) - write(iulog,*)'begwb = ',begwb(indexc) - write(iulog,*)'qflx_evap_tot= ',qflx_evap_tot(indexc) - write(iulog,*)'qflx_irrig = ',qflx_irrig(indexc) - write(iulog,*)'qflx_surf = ',qflx_surf(indexc) - write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc) - write(iulog,*)'qflx_drain = ',qflx_drain(indexc) - write(iulog,*)'qflx_flood = ',qflx_floodc(indexc) - write(iulog,*)'qflx_snwcp_ice = ',qflx_snwcp_ice(indexc) - write(iulog,*)'clm model is stopping' - call endrun() - else if (abs(errh2o(indexc)) > .10_r8 .and. (nstep > 2) ) then - write(iulog,*)'clm model is stopping - error is greater than .10' - write(iulog,*)'nstep = ',nstep,' indexc= ',indexc,' errh2o= ',errh2o(indexc) - write(iulog,*)'ctype(indexc): ',ctype(indexc) - write(iulog,*)'forc_rain = ',forc_rain_col(indexc) - write(iulog,*)'forc_snow = ',forc_snow_col(indexc) - write(iulog,*)'endwb = ',endwb(indexc) - write(iulog,*)'begwb = ',begwb(indexc) - write(iulog,*)'qflx_evap_tot= ',qflx_evap_tot(indexc) - write(iulog,*)'qflx_irrig = ',qflx_irrig(indexc) - write(iulog,*)'qflx_surf = ',qflx_surf(indexc) - write(iulog,*)'qflx_qrgwl = ',qflx_qrgwl(indexc) - write(iulog,*)'qflx_drain = ',qflx_drain(indexc) - write(iulog,*)'qflx_flood = ',qflx_floodc(indexc) - write(iulog,*)'qflx_snwcp_ice = ',qflx_snwcp_ice(indexc) - write(iulog,*)'clm model is stopping' - call endrun() - end if - end if - - ! Snow balance check - do c = lbc, ubc - g = cgridcell(c) - l = clandunit(c) - ! As defined here, snow_sources - snow_sinks will equal the change in h2osno at - ! any given time step but only if there is at least one snow layer. h2osno - ! also includes snow that is part of the soil column (an initial snow layer is - ! only created if h2osno > 10mm). - - ! --------------------------------------------------------------------- ! - ! SPM - brought in qflx_snow_melt to get snow - ! balance working after the flooding modifications were in place. - ! This new check is based on a perfrostsims branch of S. Swenson. - ! --------------------------------------------------------------------- ! - - if (snl(c) .lt. 0) then - snow_sources(c) = qflx_prec_grnd(c) + qflx_dew_snow(c) + qflx_dew_grnd(c) - snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) + qflx_snow_melt(c) & - + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) + qflx_sl_top_soil(c) - - if (ltype(l) == istdlak) then - if ( do_capsnow(c) ) then - snow_sources(c) = qflx_snow_grnd_col(c) & - + qflx_dew_snow(c) + qflx_dew_grnd(c) - - snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) & - + (qflx_snwcp_ice(c) + qflx_snwcp_liq(c) - qflx_prec_grnd(c)) & - + qflx_snow_melt(c) + qflx_sl_top_soil(c) - else - snow_sources(c) = qflx_snow_grnd_col(c) & - + qflx_rain_grnd_col(c) & - + qflx_dew_snow(c) + qflx_dew_grnd(c) - - snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) & - + qflx_snow_melt(c) + qflx_sl_top_soil(c) - endif - endif - - if (ltype(l) == istsoil .or. ltype(l) == istcrop .or. ltype(l) == istwet ) then - if ( do_capsnow(c) ) then - snow_sources(c) = qflx_dew_snow(c) + qflx_dew_grnd(c) & - + qflx_prec_grnd(c) - - snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) & - + qflx_snwcp_ice(c) + qflx_snwcp_liq(c) & - + qflx_snow_melt(c) + qflx_sl_top_soil(c) - else - snow_sources(c) = qflx_snow_grnd_col(c) & - + qflx_rain_grnd_col(c) & - + qflx_dew_snow(c) + qflx_dew_grnd(c) - - snow_sinks(c) = qflx_sub_snow(c) + qflx_evap_grnd(c) & - + qflx_snow_melt(c) + qflx_sl_top_soil(c) - endif - endif - - if (ltype(l) == istice_mec .and. glc_dyntopo) then - snow_sinks(c) = snow_sinks(c) + qflx_glcice_frz(c) - end if - - errh2osno(c) = (h2osno(c) - h2osno_old(c)) - (snow_sources(c) - snow_sinks(c)) * dtime - else - snow_sources(c) = 0._r8 - snow_sinks(c) = 0._r8 - errh2osno(c) = 0._r8 - end if - end do - - found = .false. - do c = lbc, ubc - if (cwtgcell(c) > 0._r8 .and. abs(errh2osno(c)) > 1.0e-7_r8) then - found = .true. - indexc = c - end if - end do - - if ( found ) then - write(iulog,*)'WARNING: snow balance error ',& - ' nstep = ',nstep,' indexc= ',indexc,' errh2osno= ',errh2osno(indexc) - if (abs(errh2osno(indexc)) > 0.1_r8 .and. (nstep > 2) ) then - write(iulog,*)'clm model is stopping - error is greater than .10' - write(iulog,*)'nstep = ',nstep,' indexc= ',indexc,' errh2osno= ',errh2osno(indexc) - write(iulog,*)'ltype: ', ltype(clandunit(indexc)) - write(iulog,*)'ctype(indexc): ',ctype(indexc) - write(iulog,*)'snl: ',snl(indexc) - write(iulog,*)'h2osno: ',h2osno(indexc) - write(iulog,*)'h2osno_old: ',h2osno_old(indexc) - write(iulog,*)'snow_sources: ', snow_sources(indexc) - write(iulog,*)'snow_sinks: ', snow_sinks(indexc) - write(iulog,*)'qflx_prec_grnd: ',qflx_prec_grnd(indexc)*dtime - write(iulog,*)'qflx_sub_snow: ',qflx_sub_snow(indexc)*dtime - write(iulog,*)'qflx_evap_grnd: ',qflx_evap_grnd(indexc)*dtime - write(iulog,*)'qflx_top_soil: ',qflx_top_soil(indexc)*dtime - write(iulog,*)'qflx_dew_snow: ',qflx_dew_snow(indexc)*dtime - write(iulog,*)'qflx_dew_grnd: ',qflx_dew_grnd(indexc)*dtime - write(iulog,*)'qflx_snwcp_ice: ',qflx_snwcp_ice(indexc)*dtime - write(iulog,*)'qflx_snow_melt: ',qflx_snow_melt(indexc)*dtime - write(iulog,*)'qflx_snwcp_liq: ',qflx_snwcp_liq(indexc)*dtime - write(iulog,*)'qflx_sl_top_soil: ',qflx_sl_top_soil(indexc)*dtime - write(iulog,*)'qflx_glcice_frz: ',qflx_glcice_frz(indexc)*dtime - write(iulog,*)'clm model is stopping' - call endrun() - end if - end if - - ! Energy balance checks - - do p = lbp, ubp - l = plandunit(p) - ! Note: Some glacier_mec pfts may have zero weight - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - g = pgridcell(p) - - ! Solar radiation energy balance - ! Do not do this check for an urban pft since it will not balance on a per-column - ! level because of interactions between columns and since a separate check is done - ! in the urban radiation module - if (ltype(l) /= isturb) then - errsol(p) = fsa(p) + fsr(p) & - - (forc_solad(g,1) + forc_solad(g,2) + forc_solai(g,1) + forc_solai(g,2)) - else - errsol(p) = spval - end if - - ! Longwave radiation energy balance - ! Do not do this check for an urban pft since it will not balance on a per-column - ! level because of interactions between columns and since a separate check is done - ! in the urban radiation module - if (ltype(l) /= isturb) then - errlon(p) = eflx_lwrad_out(p) - eflx_lwrad_net(p) - forc_lwrad(g) - else - errlon(p) = spval - end if - - ! Surface energy balance - ! Changed to using (eflx_lwrad_net) here instead of (forc_lwrad - eflx_lwrad_out) because - ! there are longwave interactions between urban columns (and therefore pfts). - ! For surfaces other than urban, (eflx_lwrad_net) equals (forc_lwrad - eflx_lwrad_out), - ! and a separate check is done above for these terms. - - if (ltype(l) /= isturb) then - errseb(p) = sabv(p) + sabg(p) + forc_lwrad(g) - eflx_lwrad_out(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) - else - errseb(p) = sabv(p) + sabg(p) & - - eflx_lwrad_net(p) & - - eflx_sh_tot(p) - eflx_lh_tot(p) - eflx_soil_grnd(p) & - + eflx_wasteheat_pft(p) + eflx_heat_from_ac_pft(p) + eflx_traffic_pft(p) - end if - netrad(p) = fsa(p) - eflx_lwrad_net(p) - end if - end do - - ! Solar radiation energy balance check - - found = .false. - do p = lbp, ubp - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - if ( (errsol(p) /= spval) .and. (abs(errsol(p)) > .10_r8) ) then - found = .true. - indexp = p - indexg = pgridcell(p) - end if - end if - end do - if ( found .and. (nstep > 2) ) then - write(iulog,100)'BalanceCheck: solar radiation balance error', nstep, indexp, errsol(indexp) - write(iulog,*)'fsa = ',fsa(indexp) - write(iulog,*)'fsr = ',fsr(indexp) - write(iulog,*)'forc_solad(1)= ',forc_solad(indexg,1) - write(iulog,*)'forc_solad(2)= ',forc_solad(indexg,2) - write(iulog,*)'forc_solai(1)= ',forc_solai(indexg,1) - write(iulog,*)'forc_solai(2)= ',forc_solai(indexg,2) - write(iulog,*)'forc_tot = ',forc_solad(indexg,1)+forc_solad(indexg,2)& - +forc_solai(indexg,1)+forc_solai(indexg,2) - write(iulog,*)'clm model is stopping' - call endrun() - end if - - ! Longwave radiation energy balance check - - found = .false. - do p = lbp, ubp - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - if ( (errlon(p) /= spval) .and. (abs(errlon(p)) > .10_r8) ) then - found = .true. - indexp = p - end if - end if - end do - if ( found .and. (nstep > 2) ) then - write(iulog,100)'BalanceCheck: longwave enery balance error',nstep,indexp,errlon(indexp) - write(iulog,*)'clm model is stopping' - call endrun() - end if - - ! Surface energy balance check - - found = .false. - do p = lbp, ubp - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - if (abs(errseb(p)) > .10_r8 ) then - found = .true. - indexp = p - end if - end if - end do - if ( found .and. (nstep > 2) ) then - write(iulog,100)'BalanceCheck: surface flux energy balance error',nstep,indexp,errseb(indexp) - write(iulog,*)' sabv = ',sabv(indexp) - write(iulog,*)' sabg = ',sabg(indexp) - write(iulog,*)' eflx_lwrad_net = ',eflx_lwrad_net(indexp) - write(iulog,*)' eflx_sh_tot = ',eflx_sh_tot(indexp) - write(iulog,*)' eflx_lh_tot = ',eflx_lh_tot(indexp) - write(iulog,*)' eflx_soil_grnd = ',eflx_soil_grnd(indexp) - write(iulog,*)'clm model is stopping' - call endrun() - end if - - ! Soil energy balance check - - found = .false. - do c = lbc, ubc - if (abs(errsoi_col(c)) > 1.0e-7_r8 ) then - found = .true. - indexc = c - end if - end do - if ( found ) then - write(iulog,100)'BalanceCheck: soil balance error',nstep,indexc,errsoi_col(indexc) - if (abs(errsoi_col(indexc)) > .10_r8 .and. (nstep > 2) ) then - write(iulog,*)'clm model is stopping' - call endrun() - end if - end if - - ! Update SH and RUNOFF for dynamic land cover change energy and water fluxes - call c2g( lbc, ubc, lbl, ubl, lbg, ubg, & - qflx_runoff(lbc:ubc), qflx_runoffg(lbg:ubg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - do g = lbg, ubg - qflx_runoffg(g) = qflx_runoffg(g) - qflx_liq_dynbal(g) - enddo - - call c2g( lbc, ubc, lbl, ubl, lbg, ubg, & - qflx_snwcp_ice(lbc:ubc), qflx_snwcp_iceg(lbg:ubg), & - c2l_scale_type= 'urbanf', l2g_scale_type='unity' ) - do g = lbg, ubg - qflx_snwcp_iceg(g) = qflx_snwcp_iceg(g) - qflx_ice_dynbal(g) - enddo - - call p2g( lbp, ubp, lbc, ubc, lbl, ubl, lbg, ubg, & - eflx_sh_tot(lbp:ubp), eflx_sh_totg(lbg:ubg), & - p2c_scale_type='unity',c2l_scale_type='urbanf',l2g_scale_type='unity') - do g = lbg, ubg - eflx_sh_totg(g) = eflx_sh_totg(g) - eflx_dynbal(g) - enddo - -100 format (1x,a,' nstep =',i10,' point =',i6,' imbalance =',f12.6,' W/m2') -200 format (1x,a,' nstep =',i10,' point =',i6,' imbalance =',f12.6,' mm') - - end subroutine BalanceCheck - -end module BalanceCheckMod diff --git a/src_clm40/biogeophys/BareGroundFluxesMod.F90 b/src_clm40/biogeophys/BareGroundFluxesMod.F90 deleted file mode 100644 index 3e7ea8c815..0000000000 --- a/src_clm40/biogeophys/BareGroundFluxesMod.F90 +++ /dev/null @@ -1,441 +0,0 @@ -module BareGroundFluxesMod - -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: BareGroundFluxesMod -! -! !DESCRIPTION: -! Compute sensible and latent fluxes and their derivatives with respect -! to ground temperature using ground temperatures from previous time step. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: BareGroundFluxes ! Calculate sensible and latent heat fluxes -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: BareGroundFluxes -! -! !INTERFACE: - subroutine BareGroundFluxes(lbp, ubp, num_nolakep, filter_nolakep) -! -! !DESCRIPTION: -! Compute sensible and latent fluxes and their derivatives with respect -! to ground temperature using ground temperatures from previous time step. -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varpar , only : nlevgrnd - use clm_varcon , only : cpair, vkc, grav, denice, denh2o, istsoil - use clm_varcon , only : istcrop - use clm_varctl , only : use_c13 - use shr_const_mod , only : SHR_CONST_RGAS - use FrictionVelocityMod, only : FrictionVelocity, MoninObukIni - use QSatMod , only : QSat - -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_nolakep ! number of pft non-lake points in pft filter - integer, intent(in) :: filter_nolakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine Biogeophysics1 in module Biogeophysics1Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 12/19/01, Peter Thornton -! This routine originally had a long list of parameters, and also a reference to -! the entire clm derived type. For consistency, only the derived type reference -! is passed (now pointing to the current column and pft), and the other original -! parameters are initialized locally. Using t_grnd instead of tg (tg eliminated -! as redundant). -! 1/23/02, PET: Added pft reference as parameter. All outputs will be written -! to the pft data structures, and averaged to the column level outside of -! this routine. -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: frac_veg_nosno(:) ! fraction of vegetation not covered by snow (0 OR 1) [-] - real(r8), pointer :: t_grnd(:) ! ground surface temperature [K] - real(r8), pointer :: thm(:) ! intermediate variable (forc_t+0.0098*forc_hgt_t_pft) - real(r8), pointer :: qg(:) ! specific humidity at ground surface [kg/kg] - real(r8), pointer :: thv(:) ! virtual potential temperature (kelvin) - real(r8), pointer :: dqgdT(:) ! temperature derivative of "qg" - real(r8), pointer :: htvp(:) ! latent heat of evaporation (/sublimation) [J/kg] - real(r8), pointer :: beta(:) ! coefficient of conective velocity [-] - real(r8), pointer :: zii(:) ! convective boundary height [m] - real(r8), pointer :: forc_u(:) ! atmospheric wind speed in east direction (m/s) - real(r8), pointer :: forc_v(:) ! atmospheric wind speed in north direction (m/s) - real(r8), pointer :: forc_t(:) ! atmospheric temperature (Kelvin) - real(r8), pointer :: forc_th(:) ! atmospheric potential temperature (Kelvin) - real(r8), pointer :: forc_q(:) ! atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_rho(:) ! density (kg/m**3) - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - real(r8), pointer :: forc_hgt_u_pft(:) ! observational height of wind at pft level [m] - real(r8), pointer :: psnsun(:) ! sunlit leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: psnsha(:) ! shaded leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: z0mg_col(:) ! roughness length, momentum [m] - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: dz(:,:) ! layer depth (m) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: soilbeta(:) ! soil wetness relative to field capacity -! -! local pointers to implicit inout arguments -! - real(r8), pointer :: z0hg_col(:) ! roughness length, sensible heat [m] - real(r8), pointer :: z0qg_col(:) ! roughness length, latent heat [m] -! -! local pointers to implicit out arguments -! - real(r8), pointer :: dlrad(:) ! downward longwave radiation below the canopy [W/m2] - real(r8), pointer :: ulrad(:) ! upward longwave radiation above the canopy [W/m2] - real(r8), pointer :: cgrnds(:) ! deriv, of soil sensible heat flux wrt soil temp [w/m2/k] - real(r8), pointer :: cgrndl(:) ! deriv of soil latent heat flux wrt soil temp [w/m**2/k] - real(r8), pointer :: cgrnd(:) ! deriv. of soil energy flux wrt to soil temp [w/m2/k] - real(r8), pointer :: taux(:) ! wind (shear) stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy(:) ! wind (shear) stress: n-s (kg/m/s**2) - real(r8), pointer :: eflx_sh_grnd(:) ! sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot(:) ! total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_soi(:) ! soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot(:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (Kelvin) - real(r8), pointer :: q_ref2m(:) ! 2 m height surface specific humidity (kg/kg) - real(r8), pointer :: t_ref2m_r(:) ! Rural 2 m height surface air temperature (Kelvin) - real(r8), pointer :: rh_ref2m_r(:) ! Rural 2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m(:) ! 2 m height surface relative humidity (%) - real(r8), pointer :: t_veg(:) ! vegetation temperature (Kelvin) - real(r8), pointer :: btran(:) ! transpiration wetness factor (0 to 1) - real(r8), pointer :: rssun(:) ! sunlit stomatal resistance (s/m) - real(r8), pointer :: rssha(:) ! shaded stomatal resistance (s/m) - real(r8), pointer :: ram1(:) ! aerodynamical resistance (s/m) - real(r8), pointer :: fpsn(:) ! photosynthesis (umol CO2 /m**2 /s) - real(r8), pointer :: rootr(:,:) ! effective fraction of roots in each soil layer - real(r8), pointer :: rresis(:,:) ! root resistance by layer (0-1) (nlevgrnd) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer, parameter :: niters = 3 ! maximum number of iterations for surface temperature - integer :: p,c,g,f,j,l ! indices - integer :: filterp(ubp-lbp+1) ! pft filter for vegetated pfts - integer :: fn ! number of values in local pft filter - integer :: fp ! lake filter pft index - integer :: iter ! iteration index - real(r8) :: zldis(lbp:ubp) ! reference height "minus" zero displacement height [m] - real(r8) :: displa(lbp:ubp) ! displacement height [m] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: dth(lbp:ubp) ! diff of virtual temp. between ref. height and surface - real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: dqh(lbp:ubp) ! diff of humidity between ref. height and surface - real(r8) :: obu(lbp:ubp) ! Monin-Obukhov length (m) - real(r8) :: ur(lbp:ubp) ! wind speed at reference height [m/s] - real(r8) :: um(lbp:ubp) ! wind speed including the stablity effect [m/s] - real(r8) :: temp1(lbp:ubp) ! relation for potential temperature profile - real(r8) :: temp12m(lbp:ubp) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(lbp:ubp) ! relation for specific humidity profile - real(r8) :: temp22m(lbp:ubp) ! relation for specific humidity profile applied at 2-m - real(r8) :: ustar(lbp:ubp) ! friction velocity [m/s] - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: cf ! heat transfer coefficient from leaves [-] - real(r8) :: ram ! aerodynamical resistance [s/m] - real(r8) :: rah ! thermal resistance [s/m] - real(r8) :: raw ! moisture resistance [s/m] - real(r8) :: raih ! temporary variable [kg/m2/s] - real(r8) :: raiw ! temporary variable [kg/m2/s] - real(r8) :: fm(lbp:ubp) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: z0mg_pft(lbp:ubp) - real(r8) :: z0hg_pft(lbp:ubp) - real(r8) :: z0qg_pft(lbp:ubp) - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - real(r8) :: www ! surface soil wetness [-] -!------------------------------------------------------------------------------ - - ! Assign local pointers to derived type members (gridcell-level) - - forc_u => clm_a2l%forc_u - forc_v => clm_a2l%forc_v - - ! Assign local pointers to derived type members (landunit-level) - - ltype => lun%itype - - ! Assign local pointers to derived type members (column-level) - - forc_th => ces%forc_th - forc_t => ces%forc_t - forc_pbot => cps%forc_pbot - forc_rho => cps%forc_rho - forc_q => cws%forc_q - pcolumn => pft%column - pgridcell => pft%gridcell - frac_veg_nosno => pps%frac_veg_nosno - dlrad => pef%dlrad - ulrad => pef%ulrad - t_grnd => ces%t_grnd - qg => cws%qg - z0mg_col => cps%z0mg - z0hg_col => cps%z0hg - z0qg_col => cps%z0qg - thv => ces%thv - beta => cps%beta - zii => cps%zii - ram1 => pps%ram1 - cgrnds => pef%cgrnds - cgrndl => pef%cgrndl - cgrnd => pef%cgrnd - dqgdT => cws%dqgdT - htvp => cps%htvp - watsat => cps%watsat - h2osoi_ice => cws%h2osoi_ice - dz => cps%dz - h2osoi_liq => cws%h2osoi_liq - frac_sno => cps%frac_sno - soilbeta => cws%soilbeta - - ! Assign local pointers to derived type members (pft-level) - - taux => pmf%taux - tauy => pmf%tauy - eflx_sh_grnd => pef%eflx_sh_grnd - eflx_sh_tot => pef%eflx_sh_tot - qflx_evap_soi => pwf%qflx_evap_soi - qflx_evap_tot => pwf%qflx_evap_tot - t_ref2m => pes%t_ref2m - q_ref2m => pes%q_ref2m - t_ref2m_r => pes%t_ref2m_r - rh_ref2m_r => pes%rh_ref2m_r - plandunit => pft%landunit - rh_ref2m => pes%rh_ref2m - t_veg => pes%t_veg - thm => pes%thm - btran => pps%btran - rssun => pps%rssun - rssha => pps%rssha - rootr => pps%rootr - rresis => pps%rresis - psnsun => pcf%psnsun - psnsha => pcf%psnsha - fpsn => pcf%fpsn - forc_hgt_u_pft => pps%forc_hgt_u_pft - - ! Filter pfts where frac_veg_nosno is zero - - fn = 0 - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (frac_veg_nosno(p) == 0) then - fn = fn + 1 - filterp(fn) = p - end if - end do - - ! Compute sensible and latent fluxes and their derivatives with respect - ! to ground temperature using ground temperatures from previous time step - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - ! Initialization variables - - displa(p) = 0._r8 - dlrad(p) = 0._r8 - ulrad(p) = 0._r8 - - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - dth(p) = thm(p)-t_grnd(c) - dqh(p) = forc_q(c) - qg(c) - dthv = dth(p)*(1._r8+0.61_r8*forc_q(c))+0.61_r8*forc_th(c)*dqh(p) - zldis(p) = forc_hgt_u_pft(p) - - ! Copy column roughness to local pft-level arrays - - z0mg_pft(p) = z0mg_col(c) - z0hg_pft(p) = z0hg_col(c) - z0qg_pft(p) = z0qg_col(c) - - ! Initialize Monin-Obukhov length and wind speed - - call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg_pft(p), um(p), obu(p)) - - end do - - ! Perform stability iteration - ! Determine friction velocity, and potential temperature and humidity - ! profiles of the surface boundary layer - - do iter = 1, niters - - call FrictionVelocity(lbp, ubp, fn, filterp, & - displa, z0mg_pft, z0hg_pft, z0qg_pft, & - obu, iter, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm) - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - tstar = temp1(p)*dth(p) - qstar = temp2(p)*dqh(p) - z0hg_pft(p) = z0mg_pft(p)/exp(0.13_r8 * (ustar(p)*z0mg_pft(p)/1.5e-5_r8)**0.45_r8) - z0qg_pft(p) = z0hg_pft(p) - thvstar = tstar*(1._r8+0.61_r8*forc_q(c)) + 0.61_r8*forc_th(c)*qstar - zeta = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) - - if (zeta >= 0._r8) then !stable - zeta = min(2._r8,max(zeta,0.01_r8)) - um(p) = max(ur(p),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta(c)*(-grav*ustar(p)*thvstar*zii(c)/thv(c))**0.333_r8 - um(p) = sqrt(ur(p)*ur(p) + wc*wc) - end if - obu(p) = zldis(p)/zeta - end do - - end do ! end stability iteration - - do j = 1, nlevgrnd - do f = 1, fn - p = filterp(f) - rootr(p,j) = 0._r8 - rresis(p,j) = 0._r8 - end do - end do - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - l = plandunit(p) - - ! Determine aerodynamic resistances - - ram = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah = 1._r8/(temp1(p)*ustar(p)) - raw = 1._r8/(temp2(p)*ustar(p)) - raih = forc_rho(c)*cpair/rah - - ! Soil evaporation resistance - www = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/dz(c,1)/watsat(c,1) - www = min(max(www,0.0_r8),1._r8) - - !changed by K.Sakaguchi. Soilbeta is used for evaporation - if (dqh(p) .gt. 0._r8) then !dew (beta is not applied, just like rsoil used to be) - raiw = forc_rho(c)/(raw) - else - ! Lee and Pielke 1992 beta is applied - raiw = soilbeta(c)*forc_rho(c)/(raw) - end if - - ram1(p) = ram !pass value to global variable - - ! Output to pft-level data structures - ! Derivative of fluxes with respect to ground temperature - - cgrnds(p) = raih - cgrndl(p) = raiw*dqgdT(c) - cgrnd(p) = cgrnds(p) + htvp(c)*cgrndl(p) - - ! Surface fluxes of momentum, sensible and latent heat - ! using ground temperatures from previous time step - - taux(p) = -forc_rho(c)*forc_u(g)/ram - tauy(p) = -forc_rho(c)*forc_v(g)/ram - eflx_sh_grnd(p) = -raih*dth(p) - eflx_sh_tot(p) = eflx_sh_grnd(p) - qflx_evap_soi(p) = -raiw*dqh(p) - qflx_evap_tot(p) = qflx_evap_soi(p) - - ! 2 m height air temperature - - t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) - - ! 2 m height specific humidity - - q_ref2m(p) = forc_q(c) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(c), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - rh_ref2m_r(p) = rh_ref2m(p) - t_ref2m_r(p) = t_ref2m(p) - end if - - ! Variables needed by history tape - - t_veg(p) = forc_t(c) - btran(p) = 0._r8 - cf = forc_pbot(c)/(SHR_CONST_RGAS*0.001_r8*thm(p))*1.e06_r8 - rssun(p) = 1._r8/1.e15_r8 * cf - rssha(p) = 1._r8/1.e15_r8 * cf - - ! Add the following to avoid NaN - - psnsun(p) = 0._r8 - psnsha(p) = 0._r8 - fpsn(p) = 0._r8 - pps%lncsun(p) = 0._r8 - pps%lncsha(p) = 0._r8 - pps%vcmxsun(p) = 0._r8 - pps%vcmxsha(p) = 0._r8 - ! adding code for isotopes, 8/17/05, PET - pps%cisun(p) = 0._r8 - pps%cisha(p) = 0._r8 - if (use_c13) then - pps%alphapsnsun(p) = 0._r8 - pps%alphapsnsha(p) = 0._r8 - pepv%rc13_canair(p) = 0._r8 - pepv%rc13_psnsun(p) = 0._r8 - pepv%rc13_psnsha(p) = 0._r8 - pc13f%psnsun(p) = 0._r8 - pc13f%psnsha(p) = 0._r8 - pc13f%fpsn(p) = 0._r8 - end if - - end do - - end subroutine BareGroundFluxes - -end module BareGroundFluxesMod diff --git a/src_clm40/biogeophys/BiogeophysRestMod.F90 b/src_clm40/biogeophys/BiogeophysRestMod.F90 deleted file mode 100644 index 811f727c0b..0000000000 --- a/src_clm40/biogeophys/BiogeophysRestMod.F90 +++ /dev/null @@ -1,2137 +0,0 @@ -module BiogeophysRestMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: BiogeophysRestMod -! -! !DESCRIPTION: -! Reads from or biogeophysics restart/initial data -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use spmdMod , only : masterproc -! -! !PUBLIC TYPES: - implicit none - - private -! save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: BiogeophysRest -! -! !REVISION HISTORY: -! 2005-06-12: Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - - private :: weights_exactly_the_same - private :: weights_within_roundoff_different - private :: weights_tooDifferent - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BiogeophysRest -! -! !INTERFACE: - subroutine BiogeophysRest( ncid, flag ) -! -! !DESCRIPTION: -! Read/Write biogeophysics information to/from restart file. -! -! !USES: - use ncdio_pio , only : file_desc_t, ncd_defvar, ncd_io, ncd_double, ncd_int - use clmtype - use decompMod , only : get_proc_bounds - use clm_varpar , only : nlevgrnd, nlevsno, nlevlak, nlevurb - use clm_varcon , only : istcrop - use clm_varcon , only : denice, denh2o, istdlak, istslak, isturb, & - istsoil, pondmx, watmin, spval - use clm_varctl , only : allocate_all_vegpfts, nsrest, flanduse_timeseries, & - iulog, nsrContinue, nsrStartup, nsrBranch, & - use_cndv, use_cn, use_snicar_frc - use initSurfAlbMod , only : do_initsurfalb - use clm_time_manager, only : is_first_step - use SNICARMod , only : snw_rds_min - use shr_infnan_mod , only : shr_infnan_isnan - use clm_time_manager, only : is_restart -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*), intent(in) :: flag ! 'read' or 'write' -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! 12/11/2003, Peter Thornton: Added cps%coszen, pps%gdir, and pps%omega -! for new sunlit/shaded canopy algorithm (in SUNSHA ifdef block) -! 4/25/2005, Peter Thornton: Removed the SUNSHA ifdefs, since this is now the -! default code behavior. -! 6/12/2005, Moved to netcdf format and renamed file -! -! -! !LOCAL VARIABLES: -!EOP -! -! local pointers to implicit in arguments -! - real(r8) :: maxwatsat !maximum porosity - real(r8) :: excess !excess volumetric soil water - real(r8) :: totwat !total soil water (mm) - real(r8) :: maxdiff !maximum difference in PFT weights - real(r8), pointer :: wtgcell(:) ! Grid cell weights for PFT - real(r8), pointer :: wtlunit(:) ! Land-unit weights for PFT - real(r8), pointer :: wtcol(:) ! Column weights for PFT - integer :: p,c,l,g,j ! indices - integer :: nlevs ! number of layers - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - logical :: readvar ! determine if variable is on initial file - character(len=128) :: varname ! temporary - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ltype(:) ! landunit type - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - real(r8), pointer :: temp2d(:,:) ! temporary for zisno - real(r8), parameter :: adiff = 5.e-04_r8 ! tolerance of acceptible difference - character(len=7) :: filetypes(0:3) - character(len=32) :: fileusing - character(len=*), parameter :: sub="BiogeophysRest" -!----------------------------------------------------------------------- - filetypes(:) = "missing" - filetypes(nsrStartup) = "finidat" - filetypes(nsrContinue) = "restart" - filetypes(nsrBranch) = "nrevsn" - - ! Set pointers into derived type - - gptr => grc - lptr => lun - cptr => col - pptr => pft - ltype => lptr%itype - clandunit => cptr%landunit - clandunit => cptr%landunit - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! - ! Read in weights if allocating all vegetation types - ! - - if (allocate_all_vegpfts) then - - ! pft weight wrt gridcell - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='PFT_WTGCELL', xtype=ncd_double, & - dim1name='pft', & - long_name='pft weight relative to corresponding gridcell', units='') - else if (flag == 'read' .or. flag == 'write') then - ! Copy weights calculated from fsurdat/flanduse_timeseries to temp array for comparision - ! Don't read directly into temp array -- so that answers are identical with clm3.6.58. EBK 1/9/2010 - if (flag == 'read' )then - allocate( wtgcell(begp:endp) ) - wtgcell(:) = pptr%wtgcell(:) - end if - call ncd_io(varname='PFT_WTGCELL', data=pptr%wtgcell, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft weight wrt landunit - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='PFT_WTLUNIT', xtype=ncd_double, & - dim1name='pft', & - long_name='pft weight relative to corresponding landunit', units='') - else if (flag == 'read' .or. flag == 'write') then - ! Copy weights calculated from fsurdat/flanduse_timeseries to temp array for comparision - ! Don't read directly into temp array -- so that answers are identical with clm3.6.58. EBK 1/9/2010 - if (flag == 'read' )then - allocate( wtlunit(begp:endp) ) - wtlunit(:) = pptr%wtlunit(:) - end if - call ncd_io(varname='PFT_WTLUNIT', data=pptr%wtlunit, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft weight wrt column - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='PFT_WTCOL', xtype=ncd_double, & - dim1name='pft', & - long_name='pft weight relative to corresponding column', units='') - else if (flag == 'read' .or. flag == 'write') then - ! Copy weights calculated from fsurdat/flanduse_timeseries to temp array for comparision - ! Don't read directly into temp array -- so that answers are identical with clm3.6.58. EBK 1/9/2010 - if (flag == 'read' )then - allocate( wtcol(begp:endp) ) - wtcol(:) = pptr%wtcol(:) - end if - call ncd_io(varname='PFT_WTCOL', data=pptr%wtcol, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - if (flag == 'read' )then - - if ( flanduse_timeseries /= ' ' )then - fileusing = "fsurdat/flanduse_timeseries" - else - fileusing = "fsurdat" - end if - ! - ! Note: Do not compare weights if restart or if dynamic-pft branch - ! - if ( nsrest == nsrContinue .or. flanduse_timeseries /= ' ' )then - ! Do NOT do any testing for restart or a pftdyn case - ! - ! Otherwise test and make sure weights agree to reasonable tolerence - ! - else if ( .not.weights_exactly_the_same( pptr, wtgcell, wtlunit, wtcol ) )then - if (.not. use_cndv) then - if ( weights_within_roundoff_different( pptr, wtgcell, wtlunit, wtcol ) )then - write(iulog,*) sub//"::NOTE, PFT weights from ", filetypes(nsrest), & - " file and ", trim(fileusing), " file(s) are different to roundoff -- using ", & - trim(fileusing), " values." - else if ( weights_tooDifferent( begp, endp, pptr, wtgcell, adiff, maxdiff ) )then - write(iulog,*) "ERROR:: PFT weights are SIGNIFICANTLY different from the input ", & - filetypes(nsrest), " file and ", trim(fileusing), " file(s)." - write(iulog,*) "ERROR:: maximum difference is ", maxdiff, " max allowed = ", adiff - write(iulog,*) "ERROR:: Run interpinic on your initial condition file to interpolate to the new surface dataset" - call endrun( sub//"::ERROR:: Weights between initial condition file and surface dataset are too different" ) - else - write(iulog,*) sub//"::NOTE, PFT weights from ", filetypes(nsrest), & - " file and ", trim(fileusing), " file(s) are different to < ", & - adiff, " -- using ", trim(fileusing), " values." - end if - write(iulog,*) sub//"::WARNING, weights different between ", filetypes(nsrest), & - " file and ", trim(fileusing), " file(s), but close enough -- using ", & - trim(fileusing), " values." - ! Copy weights from fsurdat file back in -- they are only off by roundoff to 1% or so... - pptr%wtgcell(:) = wtgcell(:) - pptr%wtlunit(:) = wtlunit(:) - pptr%wtcol(:) = wtcol(:) - end if - end if - - deallocate( wtgcell ) - deallocate( wtlunit ) - deallocate( wtcol ) - - end if - - end if - - ! Note - for the snow interfaces, are only examing the snow interfaces - ! above zi=0 which is why zisno and zsno have the same level dimension below - ! (Note - for zisno, zi(0) is set to 0 in routine iniTimeConst) - - ! pft energy flux - eflx_lwrad_out - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='EFLX_LWRAD_OUT', xtype=ncd_double, & - dim1name='pft', & - long_name='emitted infrared (longwave) radiation', units='watt/m^2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='EFLX_LWRAD_OUT', data=pef%eflx_lwrad_out, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - snow levels - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='SNLSNO', xtype=ncd_int, & - dim1name='column', & - long_name='number of snow layers', units='unitless') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='SNLSNO', data=cps%snl, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - snowdp - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='SNOWDP', xtype=ncd_double, & - dim1name='column', & - long_name='snow depth', units='m') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='SNOWDP', data=cps%snowdp, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - wa - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='WA', xtype=ncd_double, & - dim1name='column', & - long_name='water in the unconfined aquifer', units='mm') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='WA', data=cws%wa, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - wt - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='WT', xtype=ncd_double, & - dim1name='column', & - long_name='total water storage', units='mm') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='WT', data=cws%wt, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - zwt - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ZWT', xtype=ncd_double, & - dim1name='column', & - long_name='water table depth', units='m') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='ZWT', data=cws%zwt, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column type physical state variable - frac_sno - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='frac_sno', xtype=ncd_double, & - dim1name='column',& - long_name='fraction of ground covered by snow (0 to 1)',units='unitless') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='frac_sno', data=cps%frac_sno, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column type physical state variable - dzsno - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='DZSNO', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer thickness', units='m') - else if (flag == 'read' .or. flag == 'write') then - allocate(temp2d(begc:endc,-nlevsno+1:0)) - if (flag == 'write') then - temp2d(begc:endc,-nlevsno+1:0) = cps%dz(begc:endc,-nlevsno+1:0) - end if - call ncd_io(varname='DZSNO', data=temp2d, & - dim1name=namec, switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - if (flag == 'read') then - cps%dz(begc:endc,-nlevsno+1:0) = temp2d(begc:endc,-nlevsno+1:0) - end if - deallocate(temp2d) - end if - - ! column type physical state variable - zsno - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ZSNO', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer depth', units='m') - else if (flag == 'read' .or. flag == 'write') then - allocate(temp2d(begc:endc,-nlevsno+1:0)) - if (flag == 'write') then - temp2d(begc:endc,-nlevsno+1:0) = cps%z(begc:endc,-nlevsno+1:0) - end if - call ncd_io(varname='ZSNO', data=temp2d, & - dim1name=namec, switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - if (flag == 'read') then - cps%z(begc:endc,-nlevsno+1:0) = temp2d(begc:endc,-nlevsno+1:0) - end if - deallocate(temp2d) - end if - - ! column type physical state variable - zisno - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ZISNO', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow interface depth', units='m') - else if (flag == 'read' .or. flag == 'write') then - allocate(temp2d(begc:endc,-nlevsno:-1)) - if (flag == 'write') then - temp2d(begc:endc,-nlevsno:-1) = cps%zi(begc:endc,-nlevsno:-1) - end if - call ncd_io(varname='ZISNO', data=temp2d, & - dim1name=namec, switchdim=.true., & - lowerb2=-nlevsno, upperb2=-1, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - if (flag == 'read') then - cps%zi(begc:endc,-nlevsno:-1) = temp2d(begc:endc,-nlevsno:-1) - end if - deallocate(temp2d) - end if - - ! column type physical state variable - coszen - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='coszen', xtype=ncd_double, & - dim1name='column', & - long_name='cosine of solar zenith angle', units='unitless') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='coszen', data=cps%coszen, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - gdir - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='gdir', xtype=ncd_double, & - dim1name='pft', & - long_name='leaf projection in solar direction (0 to 1)', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='gdir', data=pps%gdir, & - dim1name=namep, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - omega - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='omega', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='fraction of intercepted radiation that is scattered (0 to 1)', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='omega', data=pps%omega, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_roof_dir - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_roof_dir', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by roof per unit ground area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_roof_dir', data=lps%sabs_roof_dir, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_roof_dif - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_roof_dif', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by roof per unit ground area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_roof_dif', data=lps%sabs_roof_dif, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_sunwall_dir - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_sunwall_dir', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by sunwall per unit wall area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_sunwall_dir', data=lps%sabs_sunwall_dir, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_sunwall_dif - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_sunwall_dif', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by sunwall per unit wall area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_sunwall_dif', data=lps%sabs_sunwall_dif, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_shadewall_dir - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_shadewall_dir', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by shadewall per unit wall area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_shadewall_dir', data=lps%sabs_shadewall_dir, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_shadewall_dif - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_shadewall_dif', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by shadewall per unit wall area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_shadewall_dif', data=lps%sabs_shadewall_dif, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_improad_dir - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_improad_dir', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by impervious road per unit ground area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_improad_dir', data=lps%sabs_improad_dir, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_improad_dif - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_improad_dif', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by impervious road per unit ground area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_improad_dif', data=lps%sabs_improad_dif, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_perroad_dir - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_perroad_dir', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='direct solar absorbed by pervious road per unit ground area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_perroad_dir', data=lps%sabs_perroad_dir, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - sabs_perroad_dif - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='sabs_perroad_dif', xtype=ncd_double, & - dim1name='landunit', dim2name='numrad', switchdim=.true., & - long_name='diffuse solar absorbed by pervious road per unit ground area per unit incident flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='sabs_perroad_dif', data=lps%sabs_perroad_dif, & - dim1name=namel, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - vf_sr - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='vf_sr', xtype=ncd_double, & - dim1name='landunit', & - long_name='view factor of sky for road',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='vf_sr', data=lps%vf_sr, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - vf_wr - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='vf_wr', xtype=ncd_double, & - dim1name='landunit', & - long_name='view factor of one wall for road',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='vf_wr', data=lps%vf_wr, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - vf_sw - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='vf_sw', xtype=ncd_double, & - dim1name='landunit', & - long_name='view factor of sky for one wall',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='vf_sw', data=lps%vf_sw, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - vf_rw - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='vf_rw', xtype=ncd_double, & - dim1name='landunit', & - long_name='view factor of road for one wall',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='vf_rw', data=lps%vf_rw, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - vf_ww - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='vf_ww', xtype=ncd_double, & - dim1name='landunit', & - long_name='view factor of opposing wall for one wall',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='vf_ww', data=lps%vf_ww, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - taf - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='taf', xtype=ncd_double, & - dim1name='landunit', & - long_name='urban canopy air temperature',units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='taf', data=lps%taf, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! landunit type physical state variable - qaf - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='qaf', xtype=ncd_double, & - dim1name='landunit', & - long_name='urban canopy specific humidity',units='kg/kg') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='qaf', data=lps%qaf, & - dim1name=namel, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - albd - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='surface albedo (direct) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albd', data=pps%albd, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - if (nsrest == nsrStartup) do_initsurfalb = .true. - end if - end if - end if - - ! pft type physical state variable - albi - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albi', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='surface albedo (diffuse) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albi', data=pps%albi, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - if (nsrest == nsrStartup) do_initsurfalb = .true. - end if - end if - end if - - ! column type physical state variable - albgrd - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgrd', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo (direct) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgrd', data=cps%albgrd, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column type physical state variable - albgri - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgri', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo (indirect) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgri', data=cps%albgri, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - if (use_snicar_frc) then - ! column type physical state variable - albgrd_bc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgrd_bc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without BC (direct) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgrd_bc', data=cps%albgrd_bc, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_bc in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgrd_bc to albgrd" - do c=begc,endc - cps%albgrd_bc(c,:) = cps%albgrd(c,:) - enddo - end if - end if - ! column type physical state variable - albgri_bc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgri_bc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without BC (diffuse) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgri_bc', data=cps%albgri_bc, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_bc in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgri_bc to albgri" - do c=begc,endc - cps%albgri_bc(c,:) = cps%albgri(c,:) - enddo - end if - end if - ! column type physical state variable - albgrd_pur - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgrd_pur', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='pure snow ground albedo (direct) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgrd_pur', data=cps%albgrd_pur, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_pur in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgrd_pur to albgrd" - do c=begc,endc - cps%albgrd_pur(c,:) = cps%albgrd(c,:) - enddo - end if - end if - ! column type physical state variable - albgri_pur - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgri_pur', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='pure snow ground albedo (diffuse) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgri_pur', data=cps%albgri_pur, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_pur in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgri_pur to albgri" - do c=begc,endc - cps%albgri_pur(c,:) = cps%albgri(c,:) - enddo - end if - end if - ! column type physical state variable - albgrd_oc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgrd_oc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without OC (direct) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgrd_oc', data=cps%albgrd_oc, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_oc in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgrd_oc to albgrd" - do c=begc,endc - cps%albgrd_oc(c,:) = cps%albgrd(c,:) - enddo - end if - end if - ! column type physical state variable - albgri_oc - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgri_oc', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without OC (diffuse) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgri_oc', data=cps%albgri_oc, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_oc in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgri_oc to albgri" - do c=begc,endc - cps%albgri_oc(c,:) = cps%albgri(c,:) - enddo - end if - end if - ! column type physical state variable - albgrd_dst - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgrd_dst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without dust (direct) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgrd_dst', data=cps%albgrd_dst, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgrd_dst in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgrd_dst to albgrd" - do c=begc,endc - cps%albgrd_dst(c,:) = cps%albgrd(c,:) - enddo - end if - end if - ! column type physical state variable - albgri_dst - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albgri_dst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='ground albedo without dust (diffuse) (0 to 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albgri_dst', data=cps%albgri_dst, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find albgri_dst in restart (or initial) file..." - if (masterproc) write(iulog,*) "Initialize albgri_dst to albgri" - do c=begc,endc - cps%albgri_dst(c,:) = cps%albgri(c,:) - enddo - end if - end if - end if !end of if use_snicar_frc - - ! column water state variable - h2osno - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='H2OSNO', xtype=ncd_double, & - dim1name='column', & - long_name='snow water', units='kg/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='H2OSNO', data=cws%h2osno, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - h2osoi_liq - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='H2OSOI_LIQ', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='liquid water', units='kg/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='H2OSOI_LIQ', data=cws%h2osoi_liq, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column water state variable - h2osoi_ice - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='H2OSOI_ICE', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='ice lens', units='kg/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='H2OSOI_ICE', data=cws%h2osoi_ice, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column energy state variable - t_grnd - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_GRND', xtype=ncd_double, & - dim1name='column', & - long_name='ground temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_GRND', data=ces%t_grnd, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column urban energy state variable - eflx_urban_ac - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='URBAN_AC', xtype=ncd_double, & - dim1name='column', & - long_name='urban air conditioning flux', units='watt/m^2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='URBAN_AC', data=cef%eflx_urban_ac, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column urban energy state variable - eflx_urban_heat - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='URBAN_HEAT', xtype=ncd_double, & - dim1name='column', & - long_name='urban heating flux', units='watt/m^2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='URBAN_HEAT', data=cef%eflx_urban_heat, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft energy state variable - t_ref2m_min - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MIN', xtype=ncd_double, & - dim1name='pft', & - long_name='daily minimum of average 2 m height surface air temperature (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MIN', data=pes%t_ref2m_min, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_max - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MAX', xtype=ncd_double, & - dim1name='pft', & - long_name='daily maximum of average 2 m height surface air temperature (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MAX', data=pes%t_ref2m_max, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_min_inst - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MIN_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily min of average 2 m height surface air temp (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MIN_INST', data=pes%t_ref2m_min_inst, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_max_inst - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MAX_INST', xtype=ncd_double, & - dim1name='pft', & - long_name='instantaneous daily max of average 2 m height surface air temp (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MAX_INST', data=pes%t_ref2m_max_inst, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_u - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname="T_REF2M_U", xtype=ncd_double, & - dim1name='pft', & - long_name='Urban 2m height surface air temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname="T_REF2M_U", data=pes%t_ref2m_u, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column energy state variable - t_grnd_u - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_GRND_U', xtype=ncd_double, & - dim1name='column', & - long_name='urban ground temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_GRND_U', data=ces%t_grnd_u, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft energy state variable - t_ref2m_min_u - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MIN_U', xtype=ncd_double, & - dim1name='pft', & - long_name='urban daily minimum of average 2 m height surface air temperature (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MIN_U', data=pes%t_ref2m_min_u, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_max_u - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MAX_U', xtype=ncd_double, & - dim1name='pft', & - long_name='urban daily maximum of average 2 m height surface air temperature (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MAX_U', data=pes%t_ref2m_max_u, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_min_inst_u - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MIN_INST_U', xtype=ncd_double, & - dim1name='pft', & - long_name='urban instantaneous daily min of average 2 m height surface air temp (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MIN_INST_U', data=pes%t_ref2m_min_inst_u, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_max_inst_u - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MAX_INST_U', xtype=ncd_double, & - dim1name='pft', & - long_name='urban instantaneous daily max of average 2 m height surface air temp (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MAX_INST_U', data=pes%t_ref2m_max_inst_u, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_r - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname="T_REF2M_R", xtype=ncd_double, & - dim1name='pft', & - long_name='Rural 2m height surface air temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname="T_REF2M_R", data=pes%t_ref2m_r, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column energy state variable - t_grnd_r - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_GRND_R', xtype=ncd_double, & - dim1name='column', & - long_name='rural ground temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_GRND_R', data=ces%t_grnd_r, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft energy state variable - t_ref2m_min_r - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MIN_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural daily minimum of average 2 m height surface air temperature (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MIN_R', data=pes%t_ref2m_min_r, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_max_r - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MAX_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural daily maximum of average 2 m height surface air temperature (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MAX_R', data=pes%t_ref2m_max_r, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_min_inst_r - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MIN_INST_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural instantaneous daily min of average 2 m height surface air temp (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MIN_INST_R', data=pes%t_ref2m_min_inst_r, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! pft energy state variable - t_ref2m_max_inst_r - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_REF2M_MAX_INST_R', xtype=ncd_double, & - dim1name='pft', & - long_name='rural instantaneous daily max of average 2 m height surface air temp (K)', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_REF2M_MAX_INST_R', data=pes%t_ref2m_max_inst_r, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - endif - - ! column energy state variable - t_soisno - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_SOISNO', xtype=ncd_double, & - dim1name='column', dim2name='levtot', switchdim=.true., & - long_name='soil-snow temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_SOISNO', data=ces%t_soisno, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column type energy state variable - t_lake - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_LAKE', xtype=ncd_double, & - dim1name='column', dim2name='levlak', switchdim=.true., & - long_name='lake temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_LAKE', data=ces%t_lake, & - dim1name=namec, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft physical state variable - frac_veg_nosno_alb - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='FRAC_VEG_NOSNO_ALB', xtype=ncd_int, & - dim1name='pft',& - long_name='fraction of vegetation not covered by snow (0 or 1)',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='FRAC_VEG_NOSNO_ALB', data=pps%frac_veg_nosno_alb, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - fwet - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='FWET', xtype=ncd_double, & - dim1name='pft', & - long_name='fraction of canopy that is wet (0 to 1)', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='FWET', data=pps%fwet, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - tlai - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tlai', xtype=ncd_double, & - dim1name='pft', & - long_name='one-sided leaf area index, no burying by snow', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tlai', data=pps%tlai, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - tsai - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='tsai', xtype=ncd_double, & - dim1name='pft', & - long_name='one-sided stem area index, no burying by snow', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='tsai', data=pps%tsai, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mlaidiff', xtype=ncd_double, & - dim1name='pft',& - long_name='difference between lai month one and month two',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mlaidiff', data=pps%mlaidiff, & - dim1name='pft', & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - elai - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='elai', xtype=ncd_double, & - dim1name='pft', & - long_name='one-sided leaf area index, with burying by snow', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='elai', data=pps%elai, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - esai - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='esai', xtype=ncd_double, & - dim1name='pft', & - long_name='one-sided stem area index, with burying by snow', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='esai', data=pps%esai, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - fsun - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fsun', xtype=ncd_double, & - dim1name='pft', & - long_name='sunlit fraction of canopy', units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fsun', data=pps%fsun, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' )then - if ( .not. readvar) then - if (is_restart()) call endrun() - else - do p = begp, endp - if ( shr_infnan_isnan( pps%fsun(p) ) )then - pps%fsun(p) = spval - end if - end do - end if - end if - end if - - ! pft type physical state variable - htop - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='htop', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy top', units='m') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='htop', data=pps%htop, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - hbot - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='hbot', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy botton', units='m') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='hbot', data=pps%hbot, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - fabd - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fabd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by veg per unit direct flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fabd', data=pps%fabd, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - fabi - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='fabi', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='flux absorbed by veg per unit diffuse flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='fabi', data=pps%fabi, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - ftdd - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ftdd', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down direct flux below veg per unit direct flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='ftdd', data=pps%ftdd, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - ftid - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ftid', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down diffuse flux below veg per unit direct flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='ftid', data=pps%ftid, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft type physical state variable - ftii - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='ftii', xtype=ncd_double, & - dim1name='pft', dim2name='numrad', switchdim=.true., & - long_name='down diffuse flux below veg per unit diffuse flux',units='') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='ftii', data=pps%ftii, & - dim1name=namep, switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft energy state variable - t_veg - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='T_VEG', xtype=ncd_double, & - dim1name='pft', & - long_name='vegetation temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='T_VEG', data=pes%t_veg, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! pft energy state variable - t_ref2m - - varname = 'T_REF2M' - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname=varname, xtype=ncd_double, & - dim1name='pft', & - long_name='2m height surface air temperature', units='K') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname=varname, data=pes%t_ref2m, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (allocate_all_vegpfts) then - call endrun() - else - if (is_restart()) call endrun() - end if - end if - end if - - ! pft type water state variable - h2ocan - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='H2OCAN', xtype=ncd_double, & - dim1name='pft', & - long_name='canopy water', units='kg/m2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='H2OCAN', data=pws%h2ocan, & - dim1name=namep, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column irrigation variable - n_irrig_steps_left - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='n_irrig_steps_left', xtype=ncd_int, & - dim1name='column', & - long_name='number of irrigation time steps left', units='#') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='n_irrig_steps_left', data=cps%n_irrig_steps_left, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - cps%n_irrig_steps_left = 0 - end if - end if - - ! column irrigation variable - irrig_rate - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='irrig_rate', xtype=ncd_double, & - dim1name='column', & - long_name='irrigation rate', units='mm/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='irrig_rate', data=cps%irrig_rate, & - dim1name=namec, & - ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - cps%irrig_rate = 0.0_r8 - end if - end if - - ! ------------------------------------------------------------ - ! Determine volumetric soil water (for read only) - ! ------------------------------------------------------------ - - if (flag == 'read' ) then - do c = begc,endc - l = clandunit(c) - if ( ltype(l) == istdlak .or. ltype(l) == istslak )then - nlevs = nlevlak - else if ( ltype(l) == isturb )then - nlevs = nlevurb - else - nlevs = nlevgrnd - end if - ! NOTE: THIS IS A MEMORY INEFFICIENT COPY - do j = 1,nlevs - cws%h2osoi_vol(c,j) = cws%h2osoi_liq(c,j)/(cps%dz(c,j)*denh2o) & - + cws%h2osoi_ice(c,j)/(cps%dz(c,j)*denice) - end do - end do - - - ! ------------------------------------------------------------ - ! If initial run -- ensure that water is properly bounded - ! ------------------------------------------------------------ - - if ( is_first_step() )then - do c = begc,endc - l = clandunit(c) - if ( ltype(l) == istdlak .or. ltype(l) == istslak )then - nlevs = nlevlak - else if ( ltype(l) == isturb )then - nlevs = nlevurb - else - nlevs = nlevgrnd - end if - do j = 1,nlevs - l = clandunit(c) - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - cws%h2osoi_liq(c,j) = max(0._r8,cws%h2osoi_liq(c,j)) - cws%h2osoi_ice(c,j) = max(0._r8,cws%h2osoi_ice(c,j)) - cws%h2osoi_vol(c,j) = cws%h2osoi_liq(c,j)/(cps%dz(c,j)*denh2o) & - + cws%h2osoi_ice(c,j)/(cps%dz(c,j)*denice) - if (j == 1) then - maxwatsat = (cps%watsat(c,j)*cps%dz(c,j)*1000.0_r8 + pondmx) / & - (cps%dz(c,j)*1000.0_r8) - else - maxwatsat = cps%watsat(c,j) - end if - if (cws%h2osoi_vol(c,j) > maxwatsat) then - excess = (cws%h2osoi_vol(c,j) - maxwatsat)*cps%dz(c,j)*1000.0_r8 - totwat = cws%h2osoi_liq(c,j) + cws%h2osoi_ice(c,j) - cws%h2osoi_liq(c,j) = cws%h2osoi_liq(c,j) - & - (cws%h2osoi_liq(c,j)/totwat) * excess - cws%h2osoi_ice(c,j) = cws%h2osoi_ice(c,j) - & - (cws%h2osoi_ice(c,j)/totwat) * excess - end if - cws%h2osoi_liq(c,j) = max(watmin,cws%h2osoi_liq(c,j)) - cws%h2osoi_ice(c,j) = max(watmin,cws%h2osoi_ice(c,j)) - cws%h2osoi_vol(c,j) = cws%h2osoi_liq(c,j)/(cps%dz(c,j)*denh2o) & - + cws%h2osoi_ice(c,j)/(cps%dz(c,j)*denice) - end if - end do - end do - end if - endif - ! - ! variables needed for SNICAR - ! - ! column type physical state variable - snw_rds - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='snw_rds', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer effective radius', units='um') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='snw_rds', data=cps%snw_rds, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (masterproc) write(iulog,*) "SNICAR: can't find snw_rds in restart (or initial) file..." - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize snw_rds - if (masterproc) then - write(iulog,*) "SNICAR: This is an initial run (not a restart), and grain size/aerosol " // & - "mass data are not defined in initial condition file. Initialize snow " // & - "effective radius to fresh snow value, and snow/aerosol masses to zero." - endif - do c=begc,endc - if (cps%snl(c) < 0) then - cps%snw_rds(c,cps%snl(c)+1:0) = snw_rds_min - cps%snw_rds(c,-nlevsno+1:cps%snl(c)) = 0._r8 - cps%snw_rds_top(c) = snw_rds_min - cps%sno_liq_top(c) = cws%h2osoi_liq(c,cps%snl(c)+1) / & - (cws%h2osoi_liq(c,cps%snl(c)+1)+cws%h2osoi_ice(c,cps%snl(c)+1)) - elseif (cws%h2osno(c) > 0._r8) then - cps%snw_rds(c,0) = snw_rds_min - cps%snw_rds(c,-nlevsno+1:-1) = 0._r8 - cps%snw_rds_top(c) = spval - cps%sno_liq_top(c) = spval - else - cps%snw_rds(c,:) = 0._r8 - cps%snw_rds_top(c) = spval - cps%sno_liq_top(c) = spval - endif - enddo - endif - end if - end if - - ! column type physical state variable - mss_bcpho - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_bcpho', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer hydrophobic black carbon mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_bcpho', data=cps%mss_bcpho, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_bcpho to zero - do c=begc,endc - cps%mss_bcpho(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_bcphi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_bcphi', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer hydrophilic black carbon mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_bcphi', data=cps%mss_bcphi, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_bcphi to zero - do c=begc,endc - cps%mss_bcphi(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_ocpho - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_ocpho', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer hydrophobic organic carbon mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_ocpho', data=cps%mss_ocpho, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_ocpho to zero - do c=begc,endc - cps%mss_ocpho(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_ocphi - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_ocphi', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer hydrophilic organic carbon mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_ocphi', data=cps%mss_ocphi, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_ocphi to zero - do c=begc,endc - cps%mss_ocphi(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_dst1 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_dst1', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer dust species 1 mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_dst1', data=cps%mss_dst1, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_dst1 to zero - do c=begc,endc - cps%mss_dst1(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_dst2 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_dst2', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer dust species 2 mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_dst2', data=cps%mss_dst2, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_dst2 to zero - do c=begc,endc - cps%mss_dst2(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_dst3 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_dst3', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer dust species 3 mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_dst3', data=cps%mss_dst3, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_dst3 to zero - do c=begc,endc - cps%mss_dst3(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - mss_dst4 - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mss_dst4', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer dust species 4 mass', units='kg m-2') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='mss_dst4', data=cps%mss_dst4, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize mss_dst4 to zero - do c=begc,endc - cps%mss_dst4(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type physical state variable - flx_absdv - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='flx_absdv', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., & - long_name='snow layer flux absorption factors (direct, VIS)', units='fraction') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='flx_absdv', data=cps%flx_absdv, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=1, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - ! SNICAR, via SurfaceAlbedo, will define the needed flux absorption factors - if (nsrest == nsrStartup) do_initsurfalb = .true. - end if - end if - - ! column type physical state variable - flx_absdn - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='flx_absdn', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., & - long_name='snow layer flux absorption factors (direct, NIR)', units='fraction') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='flx_absdn', data=cps%flx_absdn, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=1, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - ! SNICAR, via SurfaceAlbedo, will define the needed flux absorption factors - if (nsrest == nsrStartup) do_initsurfalb = .true. - end if - end if - - ! column type physical state variable - flx_absiv - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='flx_absiv', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., & - long_name='snow layer flux absorption factors (diffuse, VIS)', units='fraction') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='flx_absiv', data=cps%flx_absiv, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=1, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - ! SNICAR, via SurfaceAlbedo, will define the needed flux absorption factors - if (nsrest == nsrStartup) do_initsurfalb = .true. - end if - end if - - ! column type physical state variable - flx_absin - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='flx_absin', xtype=ncd_double, & - dim1name='column', dim2name='levsno1', switchdim=.true., & - long_name='snow layer flux absorption factors (diffuse, NIR)', units='fraction') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='flx_absin', data=cps%flx_absin, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=1, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) call endrun() - ! SNICAR, via SurfaceAlbedo, will define the needed flux absorption factors - if (nsrest == nsrStartup) do_initsurfalb = .true. - end if - end if - - ! column type physical state variable - albsnd_hst - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albsnd_hst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='snow albedo (direct) (0 to 1)',units='proportion') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albsnd_hst', data=cps%albsnd_hst, & - dim1name='column', switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column type physical state variable - albsni_hst - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='albsni_hst', xtype=ncd_double, & - dim1name='column', dim2name='numrad', switchdim=.true., & - long_name='snow albedo (diffuse) (0 to 1)',units='proportion') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='albsni_hst', data=cps%albsni_hst, & - dim1name='column', switchdim=.true., ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call endrun() - end if - end if - - ! column type water flux variable - qflx_snofrz_lyr - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='qflx_snofrz_lyr', xtype=ncd_double, & - dim1name='column', dim2name='levsno', switchdim=.true., & - long_name='snow layer ice freezing rate', units='kg m-2 s-1') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='qflx_snofrz_lyr', data=cwf%qflx_snofrz_lyr, & - dim1name='column', switchdim=.true., & - lowerb2=-nlevsno+1, upperb2=0, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize qflx_snofrz_lyr to zero - do c=begc,endc - cwf%qflx_snofrz_lyr(c,-nlevsno+1:0) = 0._r8 - enddo - endif - end if - end if - - ! column type water flux variable - qflx_snow_melt - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='qflx_snow_melt', xtype=ncd_double, & - dim1name='column', long_name='net snow melt', units='mm/s') - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname='qflx_snow_melt', data=cwf%qflx_snow_melt, & - dim1name='column', ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. .not. readvar) then - if (is_restart()) then - call endrun() - else - ! initial run, not restart: initialize qflx_snow_melt to zero - cwf%qflx_snow_melt = 0._r8 - endif - end if - end if - - ! initialize other variables that are derived from those - ! stored in the restart buffer. (there may be a more appropriate - ! place to do this, but functionally this works) - if (flag == 'read' ) then - do j = -nlevsno+1,0 - do c = begc,endc - ! mass concentrations of aerosols in snow - if (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j) > 0._r8) then - cps%mss_cnc_bcpho(c,j) = cps%mss_bcpho(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - cps%mss_cnc_bcphi(c,j) = cps%mss_bcphi(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - cps%mss_cnc_ocpho(c,j) = cps%mss_ocpho(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - cps%mss_cnc_ocphi(c,j) = cps%mss_ocphi(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - - cps%mss_cnc_dst1(c,j) = cps%mss_dst1(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - cps%mss_cnc_dst2(c,j) = cps%mss_dst2(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - cps%mss_cnc_dst3(c,j) = cps%mss_dst3(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - cps%mss_cnc_dst4(c,j) = cps%mss_dst4(c,j) / (cws%h2osoi_ice(c,j)+cws%h2osoi_liq(c,j)) - else - cps%mss_cnc_bcpho(c,j) = 0._r8 - cps%mss_cnc_bcphi(c,j) = 0._r8 - cps%mss_cnc_ocpho(c,j) = 0._r8 - cps%mss_cnc_ocphi(c,j) = 0._r8 - - cps%mss_cnc_dst1(c,j) = 0._r8 - cps%mss_cnc_dst2(c,j) = 0._r8 - cps%mss_cnc_dst3(c,j) = 0._r8 - cps%mss_cnc_dst4(c,j) = 0._r8 - endif - enddo - enddo - endif - !-- SNICAR variables - - - end subroutine BiogeophysRest - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: weights_exactly_the_same -! -! !INTERFACE: - logical function weights_exactly_the_same( pptr, wtgcell, wtlunit, wtcol ) -! -! !DESCRIPTION: -! Determine if the weights read in are exactly the same as those from surface dataset -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - type(pft_type), pointer :: pptr ! pointer to pft derived subtype - real(r8), intent(IN) :: wtgcell(:) ! grid cell weights for each PFT - real(r8), intent(IN) :: wtlunit(:) ! land-unit weights for each PFT - real(r8), intent(IN) :: wtcol(:) ! column weights for each PFT -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -!EOP -!----------------------------------------------------------------------- - - ! Check that weights are identical for all PFT's and all weight types - if ( all( pptr%wtgcell(:) == wtgcell ) .and. all( pptr%wtlunit(:) == wtlunit ) & - .and. all( pptr%wtcol(:) == wtcol ) )then - weights_exactly_the_same = .true. - else - weights_exactly_the_same = .false. - end if - - end function weights_exactly_the_same - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: weights_within_roundoff_different -! -! !INTERFACE: - logical function weights_within_roundoff_different( pptr, wtgcell, wtlunit, wtcol ) -! -! !DESCRIPTION: -! Determine if the weights are within roundoff different from each other -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - type(pft_type), pointer :: pptr ! pointer to pft derived subtype - real(r8), intent(IN) :: wtgcell(:) ! grid cell weights for each PFT - real(r8), intent(IN) :: wtlunit(:) ! land-unit weights for each PFT - real(r8), intent(IN) :: wtcol(:) ! column weights for each PFT -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -!EOP -!----------------------------------------------------------------------- - real(r8), parameter :: rndVal = 1.e-13_r8 - - ! If differences between all weights for each PFT and each weight type is - ! less than or equal to double precision roundoff level -- weights are close - if ( all( abs(pptr%wtgcell(:) - wtgcell) <= rndVal ) & - .and. all( abs(pptr%wtlunit(:) - wtlunit) <= rndVal ) & - .and. all( abs(pptr%wtcol(:) - wtcol ) <= rndVal ) )then - weights_within_roundoff_different = .true. - else - weights_within_roundoff_different = .false. - end if - - end function weights_within_roundoff_different - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: weights_tooDifferent -! -! !INTERFACE: - logical function weights_tooDifferent( begp, endp, pptr, wtgcell, adiff, maxdiff ) -! -! !DESCRIPTION: -! Determine if the weights read in are too different and should flag an error -! -! !USES: - use clmtype - implicit none -! -! !ARGUMENTS: - integer, intent(IN) :: begp, endp ! per-proc beginning and ending pft indices - type(pft_type), pointer :: pptr ! pointer to pft derived subtype - real(r8), intent(IN) :: wtgcell(begp:endp) ! grid cell weights for each PFT - real(r8), intent(IN) :: adiff ! tolerance of acceptible difference - real(r8), intent(OUT) :: maxdiff ! maximum difference found -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -!EOP -!----------------------------------------------------------------------- - integer :: p ! PFT index - real(r8) :: diff ! difference in weights - - ! Assume weights are NOT different and only change if find weights too different - weights_tooDifferent = .false. - maxdiff = 0.0_r8 - do p = begp, endp - - diff = abs(pptr%wtgcell(p) - wtgcell(p)) - if ( diff > maxdiff ) maxdiff = diff - if ( diff > adiff ) weights_tooDifferent = .true. - end do - - end function weights_tooDifferent - - -end module BiogeophysRestMod diff --git a/src_clm40/biogeophys/Biogeophysics1Mod.F90 b/src_clm40/biogeophys/Biogeophysics1Mod.F90 deleted file mode 100644 index 142d454e28..0000000000 --- a/src_clm40/biogeophys/Biogeophysics1Mod.F90 +++ /dev/null @@ -1,544 +0,0 @@ -module Biogeophysics1Mod - -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: Biogeophysics1Mod -! -! !DESCRIPTION: -! Performs calculation of leaf temperature and surface fluxes. -! Biogeophysics2.F90 then determines soil/snow and ground -! temperatures and updates the surface fluxes for the new ground -! temperature. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Biogeophysics1 ! Calculate leaf temperature and surface fluxes -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: Biogeophysics1 -! -! !INTERFACE: - subroutine Biogeophysics1(lbg, ubg, lbc, ubc, lbp, ubp, & - num_nolakec, filter_nolakec, num_nolakep, filter_nolakep) -! -! !DESCRIPTION: -! This is the main subroutine to execute the calculation of leaf temperature -! and surface fluxes. Biogeophysics2.F90 then determines soil/snow and ground -! temperatures and updates the surface fluxes for the new ground -! temperature. -! -! Calling sequence is: -! Biogeophysics1: surface biogeophysics driver -! -> QSat: saturated vapor pressure, specific humidity, and -! derivatives at ground surface and derivatives at -! leaf surface using updated leaf temperature -! Leaf temperature -! Foliage energy conservation is given by the foliage energy budget -! equation: -! Rnet - Hf - LEf = 0 -! The equation is solved by Newton-Raphson iteration, in which this -! iteration includes the calculation of the photosynthesis and -! stomatal resistance, and the integration of turbulent flux profiles. -! The sensible and latent heat transfer between foliage and atmosphere -! and ground is linked by the equations: -! Ha = Hf + Hg and Ea = Ef + Eg -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varcon , only : denh2o, denice, roverg, hvap, hsub, & - istice, istice_mec, istwet, istsoil, isturb, istdlak, & - zlnd, zsno, tfrz, & - icol_roof, icol_sunwall, icol_shadewall, & - icol_road_imperv, icol_road_perv, tfrz, spval, istdlak - use clm_varcon , only : istcrop - use clm_varpar , only : nlevgrnd, nlevurb, nlevsno, max_pft_per_gcell, nlevsoi - use QSatMod , only : QSat - use shr_const_mod , only : SHR_CONST_PI -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbg, ubg ! gridcell-index bounds - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_nolakep ! number of column non-lake points in pft filter - integer, intent(in) :: filter_nolakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! Migrated to clm2.0 by Keith Oleson and Mariana Vertenstein -! Migrated to clm2.1 new data structures by Peter Thornton and M. Vertenstein -! 27 February 2008: Keith Oleson; weighted soil/snow emissivity -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: ivt(:) !pft vegetation type - integer , pointer :: ityplun(:) !landunit type - integer , pointer :: clandunit(:) !column's landunit index - integer , pointer :: cgridcell(:) !column's gridcell index - real(r8), pointer :: pwtgcell(:) !weight relative to gridcell for each pft - integer , pointer :: ctype(:) !column type - real(r8), pointer :: forc_pbot(:) !atmospheric pressure (Pa) - real(r8), pointer :: forc_q(:) !atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_t(:) !atmospheric temperature (Kelvin) - real(r8), pointer :: forc_hgt_t(:) !observational height of temperature [m] - real(r8), pointer :: forc_hgt_u(:) !observational height of wind [m] - real(r8), pointer :: forc_hgt_q(:) !observational height of specific humidity [m] - integer , pointer :: npfts(:) !number of pfts on gridcell - integer , pointer :: pfti(:) !initial pft on gridcell - integer , pointer :: plandunit(:) !pft's landunit index - real(r8), pointer :: forc_hgt_u_pft(:) !observational height of wind at pft level [m] - real(r8), pointer :: forc_hgt_t_pft(:) !observational height of temperature at pft level [m] - real(r8), pointer :: forc_hgt_q_pft(:) !observational height of specific humidity at pft level [m] - integer , pointer :: frac_veg_nosno(:) !fraction of vegetation not covered by snow (0 OR 1) [-] - integer , pointer :: pgridcell(:) !pft's gridcell index - integer , pointer :: pcolumn(:) !pft's column index - real(r8), pointer :: z_0_town(:) !momentum roughness length of urban landunit (m) - real(r8), pointer :: z_d_town(:) !displacement height of urban landunit (m) - real(r8), pointer :: forc_th(:) !atmospheric potential temperature (Kelvin) - real(r8), pointer :: forc_u(:) !atmospheric wind speed in east direction (m/s) - real(r8), pointer :: forc_v(:) !atmospheric wind speed in north direction (m/s) - real(r8), pointer :: smpmin(:) !restriction for min of soil potential (mm) - integer , pointer :: snl(:) !number of snow layers - real(r8), pointer :: frac_sno(:) !fraction of ground covered by snow (0 to 1) - real(r8), pointer :: h2osno(:) !snow water (mm H2O) - real(r8), pointer :: elai(:) !one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) !one-sided stem area index with burying by snow - real(r8), pointer :: z0mr(:) !ratio of momentum roughness length to canopy top height (-) - real(r8), pointer :: displar(:) !ratio of displacement height to canopy top height (-) - real(r8), pointer :: htop(:) !canopy top (m) - real(r8), pointer :: dz(:,:) !layer depth (m) - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: watsat(:,:) !volumetric soil water at saturation (porosity) - real(r8), pointer :: sucsat(:,:) !minimum soil suction (mm) - real(r8), pointer :: bsw(:,:) !Clapp and Hornberger "b" - real(r8), pointer :: watfc(:,:) !volumetric soil water at field capacity - real(r8), pointer :: watopt(:,:) !volumetric soil moisture corresponding to no restriction on ET from urban pervious surface - real(r8), pointer :: watdry(:,:) !volumetric soil moisture corresponding to no restriction on ET from urban pervious surface - real(r8), pointer :: rootfr_road_perv(:,:) !fraction of roots in each soil layer for urban pervious road - real(r8), pointer :: rootr_road_perv(:,:) !effective fraction of roots in each soil layer for urban pervious road -! -! local pointers to implicit out arguments -! - real(r8), pointer :: t_grnd(:) !ground temperature (Kelvin) - real(r8), pointer :: qg(:) !ground specific humidity [kg/kg] - real(r8), pointer :: dqgdT(:) !d(qg)/dT - real(r8), pointer :: emg(:) !ground emissivity - real(r8), pointer :: htvp(:) !latent heat of vapor of water (or sublimation) [j/kg] - real(r8), pointer :: beta(:) !coefficient of convective velocity [-] - real(r8), pointer :: zii(:) !convective boundary height [m] - real(r8), pointer :: thm(:) !intermediate variable (forc_t+0.0098*forc_hgt_t_pft) - real(r8), pointer :: thv(:) !virtual potential temperature (kelvin) - real(r8), pointer :: z0mg(:) !roughness length over ground, momentum [m] - real(r8), pointer :: z0hg(:) !roughness length over ground, sensible heat [m] - real(r8), pointer :: z0qg(:) !roughness length over ground, latent heat [m] - real(r8), pointer :: emv(:) !vegetation emissivity - real(r8), pointer :: z0m(:) !momentum roughness length (m) - real(r8), pointer :: displa(:) !displacement height (m) - real(r8), pointer :: z0mv(:) !roughness length over vegetation, momentum [m] - real(r8), pointer :: z0hv(:) !roughness length over vegetation, sensible heat [m] - real(r8), pointer :: z0qv(:) !roughness length over vegetation, latent heat [m] - real(r8), pointer :: eflx_sh_tot(:) !total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_u(:) !urban total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_r(:) !rural total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot(:) !total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_u(:) !urban total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_r(:) !rural total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_veg(:) !sensible heat flux from leaves (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_tot(:) !qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: qflx_evap_veg(:) !vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg(:) !vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: cgrnd(:) !deriv. of soil energy flux wrt to soil temp [w/m2/k] - real(r8), pointer :: cgrnds(:) !deriv. of soil sensible heat flux wrt soil temp [w/m2/k] - real(r8), pointer :: cgrndl(:) !deriv. of soil latent heat flux wrt soil temp [w/m**2/k] - real(r8) ,pointer :: tssbef(:,:) !soil/snow temperature before update - real(r8) ,pointer :: soilalpha(:) !factor that reduces ground saturated specific humidity (-) - real(r8) ,pointer :: soilbeta(:) !factor that reduces ground evaporation - real(r8) ,pointer :: soilalpha_u(:) !Urban factor that reduces ground saturated specific humidity (-) - -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: g,l,c,p !indices - integer :: j !soil/snow level index - integer :: fp !lake filter pft index - integer :: fc !lake filter column index - real(r8) :: qred !soil surface relative humidity - real(r8) :: avmuir !ir inverse optical depth per unit leaf area - real(r8) :: eg !water vapor pressure at temperature T [pa] - real(r8) :: qsatg !saturated humidity [kg/kg] - real(r8) :: degdT !d(eg)/dT - real(r8) :: qsatgdT !d(qsatg)/dT - real(r8) :: fac !soil wetness of surface layer - real(r8) :: psit !negative potential of soil - real(r8) :: hr !relative humidity - real(r8) :: hr_road_perv !relative humidity for urban pervious road - real(r8) :: wx !partial volume of ice and water of surface layer - real(r8) :: fac_fc !soil wetness of surface layer relative to field capacity - real(r8) :: eff_porosity ! effective porosity in layer - real(r8) :: vol_ice ! partial volume of ice lens in layer - real(r8) :: vol_liq ! partial volume of liquid water in layer - integer :: pi !index -!------------------------------------------------------------------------------ - - ! Assign local pointers to derived type members (gridcell-level) - - forc_hgt_t => clm_a2l%forc_hgt_t - forc_u => clm_a2l%forc_u - forc_v => clm_a2l%forc_v - forc_hgt_u => clm_a2l%forc_hgt_u - forc_hgt_q => clm_a2l%forc_hgt_q - npfts => grc%npfts - pfti => grc%pfti - - ! Assign local pointers to derived type members (landunit-level) - - ityplun => lun%itype - z_0_town => lun%z_0_town - z_d_town => lun%z_d_town - - ! Assign local pointers to derived type members (column-level) - - forc_pbot => cps%forc_pbot - forc_q => cws%forc_q - forc_t => ces%forc_t - forc_th => ces%forc_th - - cgridcell => col%gridcell - clandunit => col%landunit - ctype => col%itype - beta => cps%beta - dqgdT => cws%dqgdT - emg => cps%emg - frac_sno => cps%frac_sno - h2osno => cws%h2osno - htvp => cps%htvp - qg => cws%qg - smpmin => cps%smpmin - snl => cps%snl - t_grnd => ces%t_grnd - thv => ces%thv - z0hg => cps%z0hg - z0mg => cps%z0mg - z0qg => cps%z0qg - zii => cps%zii - bsw => cps%bsw - dz => cps%dz - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - soilalpha => cws%soilalpha - soilbeta => cws%soilbeta - soilalpha_u => cws%soilalpha_u - sucsat => cps%sucsat - t_soisno => ces%t_soisno - tssbef => ces%tssbef - watsat => cps%watsat - watfc => cps%watfc - watdry => cps%watdry - watopt => cps%watopt - rootfr_road_perv => cps%rootfr_road_perv - rootr_road_perv => cps%rootr_road_perv - - ! Assign local pointers to derived type members (pft-level) - - ivt => pft%itype - elai => pps%elai - esai => pps%esai - htop => pps%htop - emv => pps%emv - z0m => pps%z0m - displa => pps%displa - z0mv => pps%z0mv - z0hv => pps%z0hv - z0qv => pps%z0qv - eflx_sh_tot => pef%eflx_sh_tot - eflx_sh_tot_u => pef%eflx_sh_tot_u - eflx_sh_tot_r => pef%eflx_sh_tot_r - eflx_lh_tot => pef%eflx_lh_tot - eflx_lh_tot_u => pef%eflx_lh_tot_u - eflx_lh_tot_r => pef%eflx_lh_tot_r - eflx_sh_veg => pef%eflx_sh_veg - qflx_evap_tot => pwf%qflx_evap_tot - qflx_evap_veg => pwf%qflx_evap_veg - qflx_tran_veg => pwf%qflx_tran_veg - cgrnd => pef%cgrnd - cgrnds => pef%cgrnds - cgrndl => pef%cgrndl - forc_hgt_u_pft => pps%forc_hgt_u_pft - forc_hgt_t_pft => pps%forc_hgt_t_pft - forc_hgt_q_pft => pps%forc_hgt_q_pft - plandunit => pft%landunit - frac_veg_nosno => pps%frac_veg_nosno - thm => pes%thm - pgridcell => pft%gridcell - pcolumn => pft%column - pwtgcell => pft%wtgcell - - ! Assign local pointers to derived type members (ecophysiological) - - z0mr => pftcon%z0mr - displar => pftcon%displar - - do j = -nlevsno+1, nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - tssbef(c,j) = t_soisno(c,j) - end do - end do - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - - if (ctype(c) == icol_road_perv) then - hr_road_perv = 0._r8 - end if - - ! begin calculations that relate only to the column level - ! Ground and soil temperatures from previous time step - - t_grnd(c) = t_soisno(c,snl(c)+1) - - ! Saturated vapor pressure, specific humidity and their derivatives - ! at ground surface - - qred = 1._r8 - if (ityplun(l)/=istwet .AND. ityplun(l)/=istice & - .AND. ityplun(l)/=istice_mec) then - if (ityplun(l) == istsoil .or. ityplun(l) == istcrop) then - wx = (h2osoi_liq(c,1)/denh2o+h2osoi_ice(c,1)/denice)/dz(c,1) - fac = min(1._r8, wx/watsat(c,1)) - fac = max( fac, 0.01_r8 ) - psit = -sucsat(c,1) * fac ** (-bsw(c,1)) - psit = max(smpmin(c), psit) - hr = exp(psit/roverg/t_grnd(c)) - qred = (1.-frac_sno(c))*hr + frac_sno(c) - - !! Lee and Pielke 1992 beta, added by K.Sakaguchi - if (wx < watfc(c,1) ) then !when water content of ths top layer is less than that at F.C. - fac_fc = min(1._r8, wx/watfc(c,1)) !eqn5.66 but divided by theta at field capacity - fac_fc = max( fac_fc, 0.01_r8 ) - ! modifiy soil beta by snow cover. soilbeta for snow surface is one - soilbeta(c) = (1._r8-frac_sno(c))*0.25_r8*(1._r8 - cos(SHR_CONST_PI*fac_fc))**2._r8 & - + frac_sno(c) - else !when water content of ths top layer is more than that at F.C. - soilbeta(c) = 1._r8 - end if - - soilalpha(c) = qred - ! Pervious road depends on water in total soil column - else if (ctype(c) == icol_road_perv) then - do j = 1, nlevsoi - if (t_soisno(c,j) >= tfrz) then - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - eff_porosity = watsat(c,j)-vol_ice - vol_liq = min(eff_porosity, h2osoi_liq(c,j)/(dz(c,j)*denh2o)) - fac = min( max(vol_liq-watdry(c,j),0._r8) / (watopt(c,j)-watdry(c,j)), 1._r8 ) - else - fac = 0._r8 - end if - rootr_road_perv(c,j) = rootfr_road_perv(c,j)*fac - hr_road_perv = hr_road_perv + rootr_road_perv(c,j) - end do - ! Allows for sublimation of snow or dew on snow - qred = (1.-frac_sno(c))*hr_road_perv + frac_sno(c) - - ! Normalize root resistances to get layer contribution to total ET - if (hr_road_perv .gt. 0._r8) then - do j = 1, nlevsoi - rootr_road_perv(c,j) = rootr_road_perv(c,j)/hr_road_perv - end do - end if - soilalpha_u(c) = qred - soilbeta(c) = 0._r8 - else if (ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall) then - qred = 0._r8 - soilbeta(c) = 0._r8 - soilalpha_u(c) = spval - else if (ctype(c) == icol_roof .or. ctype(c) == icol_road_imperv) then - qred = 1._r8 - soilbeta(c) = 0._r8 - soilalpha_u(c) = spval - end if - else - soilalpha(c) = spval - soilbeta(c) = 1._r8 - end if - - call QSat(t_grnd(c), forc_pbot(c), eg, degdT, qsatg, qsatgdT) - - qg(c) = qred*qsatg - dqgdT(c) = qred*qsatgdT - - if (qsatg > forc_q(c) .and. forc_q(c) > qred*qsatg) then - qg(c) = forc_q(c) - dqgdT(c) = 0._r8 - end if - - ! Ground emissivity - only calculate for non-urban landunits - ! Urban emissivities are currently read in from data file - - if (ityplun(l) /= isturb) then - if (ityplun(l)==istice .or. ityplun(l)==istice_mec) then - emg(c) = 0.97_r8 - else - emg(c) = (1._r8-frac_sno(c))*0.96_r8 + frac_sno(c)*0.97_r8 - end if - end if - - ! Latent heat. We arbitrarily assume that the sublimation occurs - ! only as h2osoi_liq = 0 - - htvp(c) = hvap - if (h2osoi_liq(c,snl(c)+1) <= 0._r8 .and. h2osoi_ice(c,snl(c)+1) > 0._r8) htvp(c) = hsub - - ! Ground roughness lengths over non-lake columns (includes bare ground, ground - ! underneath canopy, wetlands, etc.) - - if (frac_sno(c) > 0._r8) then - z0mg(c) = zsno - else - z0mg(c) = zlnd - end if - z0hg(c) = z0mg(c) ! initial set only - z0qg(c) = z0mg(c) ! initial set only - - ! Potential, virtual potential temperature, and wind speed at the - ! reference height - - beta(c) = 1._r8 - zii(c) = 1000._r8 - thv(c) = forc_th(c)*(1._r8+0.61_r8*forc_q(c)) - - end do ! (end of columns loop) - - ! Initialization - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - - ! Initial set (needed for history tape fields) - - eflx_sh_tot(p) = 0._r8 - l = plandunit(p) - if (ityplun(l) == isturb) then - eflx_sh_tot_u(p) = 0._r8 - else if (ityplun(l) == istsoil .or. ityplun(l) == istcrop) then - eflx_sh_tot_r(p) = 0._r8 - end if - eflx_lh_tot(p) = 0._r8 - if (ityplun(l) == isturb) then - eflx_lh_tot_u(p) = 0._r8 - else if (ityplun(l) == istsoil .or. ityplun(l) == istcrop) then - eflx_lh_tot_r(p) = 0._r8 - end if - eflx_sh_veg(p) = 0._r8 - qflx_evap_tot(p) = 0._r8 - qflx_evap_veg(p) = 0._r8 - qflx_tran_veg(p) = 0._r8 - - ! Initial set for calculation - - cgrnd(p) = 0._r8 - cgrnds(p) = 0._r8 - cgrndl(p) = 0._r8 - - ! Vegetation Emissivity - - avmuir = 1._r8 - emv(p) = 1._r8-exp(-(elai(p)+esai(p))/avmuir) - - ! Roughness lengths over vegetation - - z0m(p) = z0mr(ivt(p)) * htop(p) - displa(p) = displar(ivt(p)) * htop(p) - - z0mv(p) = z0m(p) - z0hv(p) = z0mv(p) - z0qv(p) = z0mv(p) - end do - - ! Make forcing height a pft-level quantity that is the atmospheric forcing - ! height plus each pft's z0m+displa - do pi = 1,max_pft_per_gcell - do g = lbg, ubg - if (pi <= npfts(g)) then - p = pfti(g) + pi - 1 - l = plandunit(p) - ! Note: Some glacier_mec pfts may have zero weight - if (pwtgcell(p) > 0._r8 .or. ityplun(l)==istice_mec) then - c = pcolumn(p) - if (ityplun(l) == istsoil .or. ityplun(l) == istcrop) then - if (frac_veg_nosno(p) == 0) then - forc_hgt_u_pft(p) = forc_hgt_u(g) + z0mg(c) + displa(p) - forc_hgt_t_pft(p) = forc_hgt_t(g) + z0mg(c) + displa(p) - forc_hgt_q_pft(p) = forc_hgt_q(g) + z0mg(c) + displa(p) - else - forc_hgt_u_pft(p) = forc_hgt_u(g) + z0m(p) + displa(p) - forc_hgt_t_pft(p) = forc_hgt_t(g) + z0m(p) + displa(p) - forc_hgt_q_pft(p) = forc_hgt_q(g) + z0m(p) + displa(p) - end if - else if (ityplun(l) == istwet .or. ityplun(l) == istice & - .or. ityplun(l) == istice_mec) then - forc_hgt_u_pft(p) = forc_hgt_u(g) + z0mg(c) - forc_hgt_t_pft(p) = forc_hgt_t(g) + z0mg(c) - forc_hgt_q_pft(p) = forc_hgt_q(g) + z0mg(c) - else if (ityplun(l) == istdlak) then - ! Should change the roughness lengths to shared constants - if (t_grnd(c) >= tfrz) then - forc_hgt_u_pft(p) = forc_hgt_u(g) + 0.01_r8 - forc_hgt_t_pft(p) = forc_hgt_t(g) + 0.01_r8 - forc_hgt_q_pft(p) = forc_hgt_q(g) + 0.01_r8 - else - forc_hgt_u_pft(p) = forc_hgt_u(g) + 0.04_r8 - forc_hgt_t_pft(p) = forc_hgt_t(g) + 0.04_r8 - forc_hgt_q_pft(p) = forc_hgt_q(g) + 0.04_r8 - end if - else if (ityplun(l) == isturb) then - forc_hgt_u_pft(p) = forc_hgt_u(g) + z_0_town(l) + z_d_town(l) - forc_hgt_t_pft(p) = forc_hgt_t(g) + z_0_town(l) + z_d_town(l) - forc_hgt_q_pft(p) = forc_hgt_q(g) + z_0_town(l) + z_d_town(l) - end if - end if - end if - end do - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - thm(p) = forc_t(c) + 0.0098_r8*forc_hgt_t_pft(p) - end do - - end subroutine Biogeophysics1 - -end module Biogeophysics1Mod diff --git a/src_clm40/biogeophys/Biogeophysics2Mod.F90 b/src_clm40/biogeophys/Biogeophysics2Mod.F90 deleted file mode 100644 index 94ff9169b3..0000000000 --- a/src_clm40/biogeophys/Biogeophysics2Mod.F90 +++ /dev/null @@ -1,509 +0,0 @@ -module Biogeophysics2Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: Biogeophysics2Mod -! -! !DESCRIPTION: -! Performs the calculation of soil/snow and ground temperatures -! and updates surface fluxes based on the new ground temperature. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Biogeophysics2 ! Calculate soil/snow and ground temperatures -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Biogeophysics2 -! -! !INTERFACE: - subroutine Biogeophysics2 (lbl, ubl, lbc, ubc, lbp, ubp, & - num_urbanl, filter_urbanl, num_nolakec, filter_nolakec, & - num_nolakep, filter_nolakep) -! -! !DESCRIPTION: -! This is the main subroutine to execute the calculation of soil/snow and -! ground temperatures and update surface fluxes based on the new ground -! temperature -! -! Calling sequence is: -! Biogeophysics2: surface biogeophysics driver -! -> SoilTemperature: soil/snow and ground temperatures -! -> SoilTermProp thermal conductivities and heat capacities -! -> Tridiagonal tridiagonal matrix solution -! -> PhaseChange phase change of liquid/ice contents -! -! (1) Snow and soil temperatures -! o The volumetric heat capacity is calculated as a linear combination -! in terms of the volumetric fraction of the constituent phases. -! o The thermal conductivity of soil is computed from -! the algorithm of Johansen (as reported by Farouki 1981), and the -! conductivity of snow is from the formulation used in -! SNTHERM (Jordan 1991). -! o Boundary conditions: -! F = Rnet - Hg - LEg (top), F= 0 (base of the soil column). -! o Soil / snow temperature is predicted from heat conduction -! in 10 soil layers and up to 5 snow layers. -! The thermal conductivities at the interfaces between two -! neighboring layers (j, j+1) are derived from an assumption that -! the flux across the interface is equal to that from the node j -! to the interface and the flux from the interface to the node j+1. -! The equation is solved using the Crank-Nicholson method and -! results in a tridiagonal system equation. -! -! (2) Phase change (see PhaseChange.F90) -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_time_manager , only : get_step_size - use clm_varcon , only : hvap, cpair, grav, vkc, tfrz, sb, & - isturb, icol_roof, icol_sunwall, icol_shadewall, istsoil, & - istice_mec - use clm_varcon , only : istcrop - use clm_varpar , only : nlevsno, nlevgrnd, max_pft_per_col - use SoilTemperatureMod, only : SoilTemperature - use subgridAveMod , only : p2c -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: lbl, ubl ! landunit bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_urbanl ! number of urban landunits in clump - integer, intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - integer, intent(in) :: num_nolakep ! number of column non-lake points in pft filter - integer, intent(in) :: filter_nolakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! Migrated to clm2.0 by Keith Oleson and Mariana Vertenstein -! Migrated to clm2.1 new data structures by Peter Thornton and M. Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: ctype(:) ! column type - integer , pointer :: clandunit(:) ! column's landunit index - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: pgridcell(:) ! pft's gridcell index - real(r8), pointer :: pwtgcell(:) ! pft's weight relative to corresponding column - integer , pointer :: npfts(:) ! column's number of pfts - integer , pointer :: pfti(:) ! column's beginning pft index - integer , pointer :: snl(:) ! number of snow layers - logical , pointer :: do_capsnow(:) ! true => do snow capping - real(r8), pointer :: forc_lwrad(:) ! downward infrared (longwave) radiation (W/m**2) - real(r8), pointer :: emg(:) ! ground emissivity - real(r8), pointer :: htvp(:) ! latent heat of vapor of water (or sublimation) [j/kg] - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - integer , pointer :: frac_veg_nosno(:) ! fraction of vegetation not covered by snow (0 OR 1 now) [-] - real(r8), pointer :: cgrnds(:) ! deriv, of soil sensible heat flux wrt soil temp [w/m2/k] - real(r8), pointer :: cgrndl(:) ! deriv of soil latent heat flux wrt soil temp [w/m**2/k] - real(r8), pointer :: sabg(:) ! solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: dlrad(:) ! downward longwave radiation below the canopy [W/m2] - real(r8), pointer :: ulrad(:) ! upward longwave radiation above the canopy [W/m2] - real(r8), pointer :: eflx_sh_veg(:) ! sensible heat flux from leaves (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_veg(:) ! vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg(:) ! vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_can(:) ! evaporation from leaves and stems (mm H2O/s) (+ = to atm) - real(r8), pointer :: wtcol(:) ! pft weight relative to column - real(r8), pointer :: tssbef(:,:) ! soil/snow temperature before update - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) (new) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) (new) - real(r8), pointer :: eflx_building_heat(:) ! heat flux from urban building interior to walls, roof - real(r8), pointer :: eflx_traffic_pft(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat_pft(:) ! sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_pft(:) ! sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width (-) - -! local pointers to implicit inout arguments -! - real(r8), pointer :: eflx_sh_grnd(:) ! sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_soi(:) ! soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_snwcp_liq(:) ! excess rainfall due to snow capping (mm H2O /s) - real(r8), pointer :: qflx_snwcp_ice(:) ! excess snowfall due to snow capping (mm H2O /s) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: dt_grnd(:) ! change in t_grnd, last iteration (Kelvin) - real(r8), pointer :: eflx_soil_grnd(:) ! soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_u(:)! urban soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_r(:)! rural soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_sh_tot(:) ! total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_u(:) ! urban total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_r(:) ! rural total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_tot(:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: eflx_lh_tot(:) ! total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_u(:) ! urban total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_r(:) ! rural total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_grnd(:) ! ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_sub_snow(:) ! sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow(:) ! surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd(:) ! ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: eflx_lwrad_out(:) ! emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_net(:) ! net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_u(:) ! urban net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_r(:) ! rural net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lh_vege(:) ! veg evaporation heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vegt(:) ! veg transpiration heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_grnd(:) ! ground evaporation heat flux (W/m**2) [+ to atm] - real(r8), pointer :: errsoi_pft(:) ! pft-level soil/lake energy conservation error (W/m**2) - real(r8), pointer :: errsoi_col(:) ! column-level soil/lake energy conservation error (W/m**2) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: p,c,g,j,pi,l ! indices - integer :: fc,fp ! lake filtered column and pft indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: egsmax(lbc:ubc) ! max. evaporation which soil can provide at one time step - real(r8) :: egirat(lbc:ubc) ! ratio of topsoil_evap_tot : egsmax - real(r8) :: tinc(lbc:ubc) ! temperature difference of two time step - real(r8) :: xmf(lbc:ubc) ! total latent heat of phase change of ground water - real(r8) :: sumwt(lbc:ubc) ! temporary - real(r8) :: evaprat(lbp:ubp) ! ratio of qflx_evap_soi/topsoil_evap_tot - real(r8) :: save_qflx_evap_soi ! temporary storage for qflx_evap_soi - real(r8) :: topsoil_evap_tot(lbc:ubc) ! column-level total evaporation from top soil layer - real(r8) :: fact(lbc:ubc, -nlevsno+1:nlevgrnd) ! used in computing tridiagonal matrix - real(r8) :: eflx_lwrad_del(lbp:ubp) ! update due to eflx_lwrad -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (gridcell-level) - - forc_lwrad => clm_a2l%forc_lwrad - - ! Assign local pointers to derived subtypes components (landunit-level) - - ltype => lun%itype - canyon_hwr => lun%canyon_hwr - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype - clandunit => col%landunit - npfts => col%npfts - pfti => col%pfti - snl => cps%snl - do_capsnow => cps%do_capsnow - htvp => cps%htvp - emg => cps%emg - t_grnd => ces%t_grnd - dt_grnd => ces%dt_grnd - t_soisno => ces%t_soisno - tssbef => ces%tssbef - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - errsoi_col => cebal%errsoi - eflx_building_heat => cef%eflx_building_heat - - ! Assign local pointers to derived subtypes components (pft-level) - - pcolumn => pft%column - plandunit => pft%landunit - pgridcell => pft%gridcell - pwtgcell => pft%wtgcell - frac_veg_nosno => pps%frac_veg_nosno - sabg => pef%sabg - dlrad => pef%dlrad - ulrad => pef%ulrad - eflx_sh_grnd => pef%eflx_sh_grnd - eflx_sh_veg => pef%eflx_sh_veg - qflx_evap_soi => pwf%qflx_evap_soi - qflx_evap_veg => pwf%qflx_evap_veg - qflx_tran_veg => pwf%qflx_tran_veg - qflx_evap_can => pwf%qflx_evap_can - qflx_snwcp_liq => pwf%qflx_snwcp_liq - qflx_snwcp_ice => pwf%qflx_snwcp_ice - qflx_evap_tot => pwf%qflx_evap_tot - qflx_evap_grnd => pwf%qflx_evap_grnd - qflx_sub_snow => pwf%qflx_sub_snow - qflx_dew_snow => pwf%qflx_dew_snow - qflx_dew_grnd => pwf%qflx_dew_grnd - eflx_soil_grnd => pef%eflx_soil_grnd - eflx_soil_grnd_u => pef%eflx_soil_grnd_u - eflx_soil_grnd_r => pef%eflx_soil_grnd_r - eflx_sh_tot => pef%eflx_sh_tot - eflx_sh_tot_u => pef%eflx_sh_tot_u - eflx_sh_tot_r => pef%eflx_sh_tot_r - eflx_lh_tot => pef%eflx_lh_tot - eflx_lh_tot_u => pef%eflx_lh_tot_u - eflx_lh_tot_r => pef%eflx_lh_tot_r - eflx_lwrad_out => pef%eflx_lwrad_out - eflx_lwrad_net => pef%eflx_lwrad_net - eflx_lwrad_net_u => pef%eflx_lwrad_net_u - eflx_lwrad_net_r => pef%eflx_lwrad_net_r - eflx_lh_vege => pef%eflx_lh_vege - eflx_lh_vegt => pef%eflx_lh_vegt - eflx_lh_grnd => pef%eflx_lh_grnd - cgrnds => pef%cgrnds - cgrndl => pef%cgrndl - eflx_sh_grnd => pef%eflx_sh_grnd - qflx_evap_soi => pwf%qflx_evap_soi - errsoi_pft => pebal%errsoi - wtcol => pft%wtcol - eflx_wasteheat_pft => pef%eflx_wasteheat_pft - eflx_heat_from_ac_pft => pef%eflx_heat_from_ac_pft - eflx_traffic_pft => pef%eflx_traffic_pft - - ! Get step size - - dtime = get_step_size() - - ! Determine soil temperatures including surface soil temperature - - call SoilTemperature(lbl, ubl, lbc, ubc, num_urbanl, filter_urbanl, & - num_nolakec, filter_nolakec, xmf , fact) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - j = snl(c)+1 - - ! Calculate difference in soil temperature from last time step, for - ! flux corrections - - tinc(c) = t_soisno(c,j) - tssbef(c,j) - - ! Determine ratio of topsoil_evap_tot - - egsmax(c) = (h2osoi_ice(c,j)+h2osoi_liq(c,j)) / dtime - - ! added to trap very small negative soil water,ice - - if (egsmax(c) < 0._r8) then - egsmax(c) = 0._r8 - end if - end do - - ! A preliminary pft loop to determine if corrections are required for - ! excess evaporation from the top soil layer... Includes new logic - ! to distribute the corrections between pfts on the basis of their - ! evaporative demands. - ! egirat holds the ratio of demand to availability if demand is - ! greater than availability, or 1.0 otherwise. - ! Correct fluxes to present soil temperature - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - eflx_sh_grnd(p) = eflx_sh_grnd(p) + tinc(c)*cgrnds(p) - qflx_evap_soi(p) = qflx_evap_soi(p) + tinc(c)*cgrndl(p) - end do - - ! Set the column-average qflx_evap_soi as the weighted average over all pfts - ! but only count the pfts that are evaporating - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - topsoil_evap_tot(c) = 0._r8 - sumwt(c) = 0._r8 - end do - - do pi = 1,max_pft_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if ( pi <= npfts(c) ) then - p = pfti(c) + pi - 1 - ! Note: some glacier_mec pfts may have zero weight - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - topsoil_evap_tot(c) = topsoil_evap_tot(c) + qflx_evap_soi(p) * wtcol(p) - end if - end if - end do - end do - - ! Calculate ratio for rescaling pft-level fluxes to meet availability - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (topsoil_evap_tot(c) > egsmax(c)) then - egirat(c) = (egsmax(c)/topsoil_evap_tot(c)) - else - egirat(c) = 1.0_r8 - end if - end do - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - l = plandunit(p) - g = pgridcell(p) - j = snl(c)+1 - - ! Correct soil fluxes for possible evaporation in excess of top layer water - ! excess energy is added to the sensible heat flux from soil - - if (egirat(c) < 1.0_r8) then - save_qflx_evap_soi = qflx_evap_soi(p) - qflx_evap_soi(p) = qflx_evap_soi(p) * egirat(c) - eflx_sh_grnd(p) = eflx_sh_grnd(p) + (save_qflx_evap_soi - qflx_evap_soi(p))*htvp(c) - end if - - ! Ground heat flux - - if (ltype(l) /= isturb) then - eflx_soil_grnd(p) = sabg(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(g) & - - emg(c)*sb*tssbef(c,j)**3*(tssbef(c,j) + 4._r8*tinc(c)) & - - (eflx_sh_grnd(p) + qflx_evap_soi(p)*htvp(c)) - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - eflx_soil_grnd_r(p) = eflx_soil_grnd(p) - end if - else - ! For all urban columns we use the net longwave radiation (eflx_lwrad_net) since - ! the term (emg*sb*tssbef(snl+1)**4) is not the upward longwave flux because of - ! interactions between urban columns. - - eflx_lwrad_del(p) = 4._r8*emg(c)*sb*tssbef(c,j)**3*tinc(c) - ! Include transpiration term because needed for pervious road - ! and wasteheat and traffic flux - eflx_soil_grnd(p) = sabg(p) + dlrad(p) & - - eflx_lwrad_net(p) - eflx_lwrad_del(p) & - - (eflx_sh_grnd(p) + qflx_evap_soi(p)*htvp(c) + qflx_tran_veg(p)*hvap) & - + eflx_wasteheat_pft(p) + eflx_heat_from_ac_pft(p) + eflx_traffic_pft(p) - eflx_soil_grnd_u(p) = eflx_soil_grnd(p) - end if - - ! Total fluxes (vegetation + ground) - - eflx_sh_tot(p) = eflx_sh_veg(p) + eflx_sh_grnd(p) - qflx_evap_tot(p) = qflx_evap_veg(p) + qflx_evap_soi(p) - eflx_lh_tot(p)= hvap*qflx_evap_veg(p) + htvp(c)*qflx_evap_soi(p) - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - eflx_lh_tot_r(p)= eflx_lh_tot(p) - eflx_sh_tot_r(p)= eflx_sh_tot(p) - else if (ltype(l) == isturb) then - eflx_lh_tot_u(p)= eflx_lh_tot(p) - eflx_sh_tot_u(p)= eflx_sh_tot(p) - end if - - ! Assign ground evaporation to sublimation from soil ice or to dew - ! on snow or ground - - qflx_evap_grnd(p) = 0._r8 - qflx_sub_snow(p) = 0._r8 - qflx_dew_snow(p) = 0._r8 - qflx_dew_grnd(p) = 0._r8 - - if (qflx_evap_soi(p) >= 0._r8) then - ! for evaporation partitioning between liquid evap and ice sublimation, - ! use the ratio of liquid to (liquid+ice) in the top layer to determine split - if ((h2osoi_liq(c,j)+h2osoi_ice(c,j)) > 0.) then - qflx_evap_grnd(p) = max(qflx_evap_soi(p)*(h2osoi_liq(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j))), 0._r8) - else - qflx_evap_grnd(p) = 0. - end if - qflx_sub_snow(p) = qflx_evap_soi(p) - qflx_evap_grnd(p) - else - if (t_grnd(c) < tfrz) then - qflx_dew_snow(p) = abs(qflx_evap_soi(p)) - else - qflx_dew_grnd(p) = abs(qflx_evap_soi(p)) - end if - end if - - ! Update the pft-level qflx_snwcp - ! This was moved in from Hydrology2 to keep all pft-level - ! calculations out of Hydrology2 - - if (snl(c) < 0 .and. do_capsnow(c)) then - qflx_snwcp_liq(p) = qflx_snwcp_liq(p) + qflx_dew_grnd(p) - qflx_snwcp_ice(p) = qflx_snwcp_ice(p) + qflx_dew_snow(p) - end if - - ! Variables needed by history tape - - qflx_evap_can(p) = qflx_evap_veg(p) - qflx_tran_veg(p) - eflx_lh_vege(p) = (qflx_evap_veg(p) - qflx_tran_veg(p)) * hvap - eflx_lh_vegt(p) = qflx_tran_veg(p) * hvap - eflx_lh_grnd(p) = qflx_evap_soi(p) * htvp(c) - - end do - - ! Soil Energy balance check - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - errsoi_pft(p) = eflx_soil_grnd(p) - xmf(c) - - ! For urban sunwall, shadewall, and roof columns, the "soil" energy balance check - ! must include the heat flux from the interior of the building. - if (ctype(c)==icol_sunwall .or. ctype(c)==icol_shadewall .or. ctype(c)==icol_roof) then - errsoi_pft(p) = errsoi_pft(p) + eflx_building_heat(c) - end if - end do - do j = -nlevsno+1,nlevgrnd - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - if (j >= snl(c)+1) then - errsoi_pft(p) = errsoi_pft(p) - (t_soisno(c,j)-tssbef(c,j))/fact(c,j) - end if - end do - end do - - ! Outgoing long-wave radiation from vegetation + ground - ! For conservation we put the increase of ground longwave to outgoing - ! For urban pfts, ulrad=0 and (1-fracveg_nosno)=1, and eflx_lwrad_out and eflx_lwrad_net - ! are calculated in UrbanRadiation. The increase of ground longwave is added directly - ! to the outgoing longwave and the net longwave. - - do fp = 1,num_nolakep - p = filter_nolakep(fp) - c = pcolumn(p) - l = plandunit(p) - g = pgridcell(p) - j = snl(c)+1 - - if (ltype(l) /= isturb) then - eflx_lwrad_out(p) = ulrad(p) & - + (1-frac_veg_nosno(p))*(1.-emg(c))*forc_lwrad(g) & - + (1-frac_veg_nosno(p))*emg(c)*sb*tssbef(c,j)**4 & - + 4.*emg(c)*sb*tssbef(c,j)**3*tinc(c) - eflx_lwrad_net(p) = eflx_lwrad_out(p) - forc_lwrad(g) - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - eflx_lwrad_net_r(p) = eflx_lwrad_out(p) - forc_lwrad(g) - end if - else - eflx_lwrad_out(p) = eflx_lwrad_out(p) + eflx_lwrad_del(p) - eflx_lwrad_net(p) = eflx_lwrad_net(p) + eflx_lwrad_del(p) - eflx_lwrad_net_u(p) = eflx_lwrad_net_u(p) + eflx_lwrad_del(p) - end if - end do - - ! lake balance for errsoi is not over pft - ! therefore obtain column-level radiative temperature - - call p2c(num_nolakec, filter_nolakec, errsoi_pft, errsoi_col) - - end subroutine Biogeophysics2 - -end module Biogeophysics2Mod diff --git a/src_clm40/biogeophys/BiogeophysicsLakeMod.F90 b/src_clm40/biogeophys/BiogeophysicsLakeMod.F90 deleted file mode 100644 index d902720ea9..0000000000 --- a/src_clm40/biogeophys/BiogeophysicsLakeMod.F90 +++ /dev/null @@ -1,764 +0,0 @@ -module BiogeophysicsLakeMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: BiogeophysicsLakeMod -! -! !DESCRIPTION: -! Calculates lake temperatures and surface fluxes. -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: BiogeophysicsLake - -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BiogeophysicsLake -! -! !INTERFACE: - subroutine BiogeophysicsLake(lbc, ubc, lbp, ubp, num_lakec, filter_lakec, & - num_lakep, filter_lakep) -! -! !DESCRIPTION: -! Calculates lake temperatures and surface fluxes. -! Lake temperatures are determined from a one-dimensional thermal -! stratification model based on eddy diffusion concepts to -! represent vertical mixing of heat. -! -! d ts d d ts 1 ds -! ---- = -- [(km + ke) ----] + -- -- -! dt dz dz cw dz -! -! where: ts = temperature (kelvin) -! t = time (s) -! z = depth (m) -! km = molecular diffusion coefficient (m**2/s) -! ke = eddy diffusion coefficient (m**2/s) -! cw = heat capacity (j/m**3/kelvin) -! s = heat source term (w/m**2) -! -! There are two types of lakes: -! Deep lakes are 50 m. -! Shallow lakes are 10 m deep. -! -! For unfrozen deep lakes: ke > 0 and convective mixing -! For unfrozen shallow lakes: ke = 0 and no convective mixing -! -! Use the Crank-Nicholson method to set up tridiagonal system of equations to -! solve for ts at time n+1, where the temperature equation for layer i is -! r_i = a_i [ts_i-1] n+1 + b_i [ts_i] n+1 + c_i [ts_i+1] n+1 -! -! The solution conserves energy as: -! -! cw*([ts( 1)] n+1 - [ts( 1)] n)*dz( 1)/dt + ... + -! cw*([ts(nlevlak)] n+1 - [ts(nlevlak)] n)*dz(nlevlak)/dt = fin -! -! where: -! [ts] n = old temperature (kelvin) -! [ts] n+1 = new temperature (kelvin) -! fin = heat flux into lake (w/m**2) -! = beta*sabg + forc_lwrad - eflx_lwrad_out - eflx_sh_tot - eflx_lh_tot -! - hm + phi(1) + ... + phi(nlevlak) -! -! WARNING: This subroutine assumes lake columns have one and only one pft. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_time_manager , only : get_step_size - use clm_varpar , only : nlevlak - use clm_varcon , only : hvap, hsub, hfus, cpair, cpliq, cpice, tkwat, tkice, & - sb, vkc, grav, denh2o, tfrz, spval - use QSatMod , only : QSat - use FrictionVelocityMod, only : FrictionVelocity, MoninObukIni - use TridiagonalMod , only : Tridiagonal -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: num_lakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_lakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_lakep ! number of column non-lake points in pft filter - integer, intent(in) :: filter_lakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! Migrated to clm2.1 new data structures by Peter Thornton and M. Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: cgridcell(:) ! column's gridcell index - real(r8), pointer :: forc_t(:) ! atmospheric temperature (Kelvin) - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - real(r8), pointer :: forc_hgt_u_pft(:) ! observational height of wind at pft level [m] - real(r8), pointer :: forc_hgt_t_pft(:) ! observational height of temperature at pft level [m] - real(r8), pointer :: forc_hgt_q_pft(:) ! observational height of specific humidity at pft level [m] - real(r8), pointer :: forc_th(:) ! atmospheric potential temperature (Kelvin) - real(r8), pointer :: forc_q(:) ! atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_u(:) ! atmospheric wind speed in east direction (m/s) - real(r8), pointer :: forc_v(:) ! atmospheric wind speed in north direction (m/s) - real(r8), pointer :: forc_lwrad(:) ! downward infrared (longwave) radiation (W/m**2) - real(r8), pointer :: forc_rho(:) ! density (kg/m**3) - real(r8), pointer :: forc_snow(:) ! snow rate [mm/s] - real(r8), pointer :: forc_rain(:) ! rain rate [mm/s] - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - real(r8), pointer :: hc_soisno(:) ! soil plus snow plus lake heat content (MJ/m2) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: sabg(:) ! solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: lat(:) ! latitude (radians) - real(r8), pointer :: dz(:,:) ! layer thickness (m) - real(r8), pointer :: z(:,:) ! layer depth (m) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: qflx_prec_grnd(:) ! water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_evap_soi(:) ! soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot(:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: qflx_snwcp_liq(:) ! excess rainfall due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: qflx_snwcp_ice(:) ! excess snowfall due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: eflx_sh_grnd(:) ! sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lwrad_out(:) ! emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_net(:) ! net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_soil_grnd(:) ! soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_sh_tot(:) ! total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot(:) ! total latent heat flux (W/m8*2) [+ to atm] - real(r8), pointer :: eflx_lh_grnd(:) ! ground evaporation heat flux (W/m**2) [+ to atm] - real(r8), pointer :: t_veg(:) ! vegetation temperature (Kelvin) - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (Kelvin) - real(r8), pointer :: q_ref2m(:) ! 2 m height surface specific humidity (kg/kg) - real(r8), pointer :: rh_ref2m(:) ! 2 m height surface relative humidity (%) - real(r8), pointer :: taux(:) ! wind (shear) stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy(:) ! wind (shear) stress: n-s (kg/m/s**2) - real(r8), pointer :: qmelt(:) ! snow melt [mm/s] - real(r8), pointer :: ram1(:) ! aerodynamical resistance (s/m) - real(r8), pointer :: errsoi(:) ! soil/lake energy conservation error (W/m**2) - real(r8), pointer :: t_lake(:,:) ! lake temperature (Kelvin) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer , parameter :: idlak = 1 ! index of lake, 1 = deep lake, 2 = shallow lake - integer , parameter :: niters = 3 ! maximum number of iterations for surface temperature - real(r8), parameter :: beta1 = 1._r8 ! coefficient of connective velocity (in computing W_*) [-] - real(r8), parameter :: emg = 0.97_r8 ! ground emissivity (0.97 for snow) - real(r8), parameter :: zii = 1000._r8 ! convective boundary height [m] - real(r8), parameter :: p0 = 1._r8 ! neutral value of turbulent prandtl number - integer :: i,j,fc,fp,g,c,p ! do loop or array index - integer :: fncopy ! number of values in pft filter copy - integer :: fnold ! previous number of pft filter values - integer :: fpcopy(num_lakep) ! pft filter copy for iteration loop - integer :: num_unfrzc ! number of values in unfrozen column filter - integer :: filter_unfrzc(ubc-lbc+1)! unfrozen column filter - integer :: iter ! iteration index - integer :: nmozsgn(lbp:ubp) ! number of times moz changes sign - integer :: jtop(lbc:ubc) ! number of levels for each column (all 1) - real(r8) :: dtime ! land model time step (sec) - real(r8) :: ax ! - real(r8) :: bx ! - real(r8) :: degdT ! d(eg)/dT - real(r8) :: dqh(lbp:ubp) ! diff of humidity between ref. height and surface - real(r8) :: dth(lbp:ubp) ! diff of virtual temp. between ref. height and surface - real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: dzsur(lbc:ubc) ! - real(r8) :: eg ! water vapor pressure at temperature T [pa] - real(r8) :: hm ! energy residual [W/m2] - real(r8) :: htvp(lbc:ubc) ! latent heat of vapor of water (or sublimation) [j/kg] - real(r8) :: obu(lbp:ubp) ! monin-obukhov length (m) - real(r8) :: obuold(lbp:ubp) ! monin-obukhov length of previous iteration - real(r8) :: qsatg(lbc:ubc) ! saturated humidity [kg/kg] - real(r8) :: qsatgdT(lbc:ubc) ! d(qsatg)/dT - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: ram(lbp:ubp) ! aerodynamical resistance [s/m] - real(r8) :: rah(lbp:ubp) ! thermal resistance [s/m] - real(r8) :: raw(lbp:ubp) ! moisture resistance [s/m] - real(r8) :: stftg3(lbp:ubp) ! derivative of fluxes w.r.t ground temperature - real(r8) :: temp1(lbp:ubp) ! relation for potential temperature profile - real(r8) :: temp12m(lbp:ubp) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(lbp:ubp) ! relation for specific humidity profile - real(r8) :: temp22m(lbp:ubp) ! relation for specific humidity profile applied at 2-m - real(r8) :: tgbef(lbc:ubc) ! initial ground temperature - real(r8) :: thm(lbp:ubp) ! intermediate variable (forc_t+0.0098*forc_hgt_t_pft) - real(r8) :: thv(lbc:ubc) ! virtual potential temperature (kelvin) - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: tksur ! thermal conductivity of snow/soil (w/m/kelvin) - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: um(lbp:ubp) ! wind speed including the stablity effect [m/s] - real(r8) :: ur(lbp:ubp) ! wind speed at reference height [m/s] - real(r8) :: ustar(lbp:ubp) ! friction velocity [m/s] - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: zldis(lbp:ubp) ! reference height "minus" zero displacement height [m] - real(r8) :: displa(lbp:ubp) ! displacement (always zero) [m] - real(r8) :: z0mg(lbp:ubp) ! roughness length over ground, momentum [m] - real(r8) :: z0hg(lbp:ubp) ! roughness length over ground, sensible heat [m] - real(r8) :: z0qg(lbp:ubp) ! roughness length over ground, latent heat [m] - real(r8) :: beta(2) ! fraction solar rad absorbed at surface: depends on lake type - real(r8) :: za(2) ! base of surface absorption layer (m): depends on lake type - real(r8) :: eta(2) ! light extinction coefficient (/m): depends on lake type - real(r8) :: a(lbc:ubc,nlevlak) ! "a" vector for tridiagonal matrix - real(r8) :: b(lbc:ubc,nlevlak) ! "b" vector for tridiagonal matrix - real(r8) :: c1(lbc:ubc,nlevlak) ! "c" vector for tridiagonal matrix - real(r8) :: r(lbc:ubc,nlevlak) ! "r" vector for tridiagonal solution - real(r8) :: rhow(lbc:ubc,nlevlak) ! density of water (kg/m**3) - real(r8) :: phi(lbc:ubc,nlevlak) ! solar radiation absorbed by layer (w/m**2) - real(r8) :: kme(lbc:ubc,nlevlak) ! molecular + eddy diffusion coefficient (m**2/s) - real(r8) :: cwat ! specific heat capacity of water (j/m**3/kelvin) - real(r8) :: ws(lbc:ubc) ! surface friction velocity (m/s) - real(r8) :: ks(lbc:ubc) ! coefficient - real(r8) :: in ! relative flux of solar radiation into layer - real(r8) :: out ! relative flux of solar radiation out of layer - real(r8) :: ri ! richardson number - real(r8) :: fin(lbc:ubc) ! heat flux into lake - flux out of lake (w/m**2) - real(r8) :: ocvts(lbc:ubc) ! (cwat*(t_lake[n ])*dz - real(r8) :: ncvts(lbc:ubc) ! (cwat*(t_lake[n+1])*dz - real(r8) :: m1 ! intermediate variable for calculating r, a, b, c - real(r8) :: m2 ! intermediate variable for calculating r, a, b, c - real(r8) :: m3 ! intermediate variable for calculating r, a, b, c - real(r8) :: ke ! eddy diffusion coefficient (m**2/s) - real(r8) :: km ! molecular diffusion coefficient (m**2/s) - real(r8) :: zin ! depth at top of layer (m) - real(r8) :: zout ! depth at bottom of layer (m) - real(r8) :: drhodz ! d [rhow] /dz (kg/m**4) - real(r8) :: n2 ! brunt-vaisala frequency (/s**2) - real(r8) :: num ! used in calculating ri - real(r8) :: den ! used in calculating ri - real(r8) :: tav(lbc:ubc) ! used in aver temp for convectively mixed layers - real(r8) :: nav(lbc:ubc) ! used in aver temp for convectively mixed layers - real(r8) :: phidum ! temporary value of phi - real(r8) :: u2m ! 2 m wind speed (m/s) - real(r8) :: fm(lbp:ubp) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m -! -! Constants for lake temperature model -! - data beta/0.4_r8, 0.4_r8/ ! (deep lake, shallow lake) - data za /0.6_r8, 0.5_r8/ - data eta /0.1_r8, 0.5_r8/ -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (gridcell-level) - - forc_t => clm_a2l%forc_t - forc_pbot => clm_a2l%forc_pbot - forc_th => clm_a2l%forc_th - forc_q => clm_a2l%forc_q - forc_u => clm_a2l%forc_u - forc_v => clm_a2l%forc_v - forc_rho => clm_a2l%forc_rho - forc_lwrad => clm_a2l%forc_lwrad - forc_snow => clm_a2l%forc_snow - forc_rain => clm_a2l%forc_rain - lat => grc%lat - - ! Assign local pointers to derived type members (column-level) - - cgridcell => col%gridcell - dz => cps%dz - z => cps%z - t_lake => ces%t_lake - h2osno => cws%h2osno - snowdp => cps%snowdp - t_grnd => ces%t_grnd - hc_soisno => ces%hc_soisno - errsoi => cebal%errsoi - qmelt => cwf%qmelt - - ! Assign local pointers to derived type members (pft-level) - - pcolumn => pft%column - pgridcell => pft%gridcell - sabg => pef%sabg - t_ref2m => pes%t_ref2m - q_ref2m => pes%q_ref2m - rh_ref2m => pes%rh_ref2m - t_veg => pes%t_veg - eflx_lwrad_out => pef%eflx_lwrad_out - eflx_lwrad_net => pef%eflx_lwrad_net - eflx_soil_grnd => pef%eflx_soil_grnd - eflx_lh_tot => pef%eflx_lh_tot - eflx_lh_grnd => pef%eflx_lh_grnd - eflx_sh_grnd => pef%eflx_sh_grnd - eflx_sh_tot => pef%eflx_sh_tot - ram1 => pps%ram1 - taux => pmf%taux - tauy => pmf%tauy - qflx_prec_grnd => pwf%qflx_prec_grnd - qflx_evap_soi => pwf%qflx_evap_soi - qflx_evap_tot => pwf%qflx_evap_tot - forc_hgt_u_pft => pps%forc_hgt_u_pft - forc_hgt_t_pft => pps%forc_hgt_t_pft - forc_hgt_q_pft => pps%forc_hgt_q_pft - qflx_snwcp_ice => pwf%qflx_snwcp_ice - qflx_snwcp_liq => pwf%qflx_snwcp_liq - - ! Determine step size - - dtime = get_step_size() - - ! Begin calculations - - do fc = 1, num_lakec - c = filter_lakec(fc) - g = cgridcell(c) - - ! Initialize quantities computed below - - ocvts(c) = 0._r8 - ncvts(c) = 0._r8 - hc_soisno(c) = 0._r8 - - ! Surface temperature and fluxes - - dzsur(c) = dz(c,1) + snowdp(c) - - ! Saturated vapor pressure, specific humidity and their derivatives - ! at lake surface - - call QSat(t_grnd(c), forc_pbot(g), eg, degdT, qsatg(c), qsatgdT(c)) - - ! Potential, virtual potential temperature, and wind speed at the - ! reference height - - !zii = 1000. ! m (pbl height) - thv(c) = forc_th(g)*(1._r8+0.61_r8*forc_q(g)) ! virtual potential T - end do - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - g = pgridcell(p) - - nmozsgn(p) = 0 - obuold(p) = 0._r8 - displa(p) = 0._r8 - thm(p) = forc_t(g) + 0.0098_r8*forc_hgt_t_pft(p) ! intermediate variable - - ! Roughness lengths - - if (t_grnd(c) >= tfrz) then ! for unfrozen lake - z0mg(p) = 0.01_r8 - else ! for frozen lake - z0mg(p) = 0.04_r8 - end if - z0hg(p) = z0mg(p) - z0qg(p) = z0mg(p) - - ! Latent heat - - if (forc_t(g) > tfrz) then - htvp(c) = hvap - else - htvp(c) = hsub - end if - - ! Initialize stability variables - - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - dth(p) = thm(p)-t_grnd(c) - dqh(p) = forc_q(g)-qsatg(c) - dthv = dth(p)*(1._r8+0.61_r8*forc_q(g))+0.61_r8*forc_th(g)*dqh(p) - zldis(p) = forc_hgt_u_pft(p) - 0._r8 - - ! Initialize Monin-Obukhov length and wind speed - - call MoninObukIni(ur(p), thv(c), dthv, zldis(p), z0mg(p), um(p), obu(p)) - - end do - - iter = 1 - fncopy = num_lakep - fpcopy(1:num_lakep) = filter_lakep(1:num_lakep) - - ! Begin stability iteration - - ITERATION : do while (iter <= niters .and. fncopy > 0) - - ! Determine friction velocity, and potential temperature and humidity - ! profiles of the surface boundary layer - - call FrictionVelocity(lbp, ubp, fncopy, fpcopy, & - displa, z0mg, z0hg, z0qg, & - obu, iter, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm) - - do fp = 1, fncopy - p = fpcopy(fp) - c = pcolumn(p) - g = pgridcell(p) - - tgbef(c) = t_grnd(c) - if (t_grnd(c) > tfrz) then - tksur = tkwat - else - tksur = tkice - end if - - ! Determine aerodynamic resistances - - ram(p) = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah(p) = 1._r8/(temp1(p)*ustar(p)) - raw(p) = 1._r8/(temp2(p)*ustar(p)) - ram1(p) = ram(p) !pass value to global variable - - ! Get derivative of fluxes with respect to ground temperature - - stftg3(p) = emg*sb*tgbef(c)*tgbef(c)*tgbef(c) - - ax = sabg(p) + emg*forc_lwrad(g) + 3._r8*stftg3(p)*tgbef(c) & - + forc_rho(g)*cpair/rah(p)*thm(p) & - - htvp(c)*forc_rho(g)/raw(p)*(qsatg(c)-qsatgdT(c)*tgbef(c) - forc_q(g)) & - + tksur*t_lake(c,1)/dzsur(c) - - bx = 4._r8*stftg3(p) + forc_rho(g)*cpair/rah(p) & - + htvp(c)*forc_rho(g)/raw(p)*qsatgdT(c) + tksur/dzsur(c) - - t_grnd(c) = ax/bx - - ! Surface fluxes of momentum, sensible and latent heat - ! using ground temperatures from previous time step - - eflx_sh_grnd(p) = forc_rho(g)*cpair*(t_grnd(c)-thm(p))/rah(p) - qflx_evap_soi(p) = forc_rho(g)*(qsatg(c)+qsatgdT(c)*(t_grnd(c)-tgbef(c))-forc_q(g))/raw(p) - - ! Re-calculate saturated vapor pressure, specific humidity and their - ! derivatives at lake surface - - call QSat(t_grnd(c), forc_pbot(g), eg, degdT, qsatg(c), qsatgdT(c)) - - dth(p)=thm(p)-t_grnd(c) - dqh(p)=forc_q(g)-qsatg(c) - - tstar = temp1(p)*dth(p) - qstar = temp2(p)*dqh(p) - - !not used - !dthv=dth(p)*(1.+0.61*forc_q(g))+0.61*forc_th(g)*dqh(p) - thvstar=tstar*(1._r8+0.61_r8*forc_q(g)) + 0.61_r8*forc_th(g)*qstar - zeta=zldis(p)*vkc * grav*thvstar/(ustar(p)**2*thv(c)) - - if (zeta >= 0._r8) then !stable - zeta = min(2._r8,max(zeta,0.01_r8)) - um(p) = max(ur(p),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta1*(-grav*ustar(p)*thvstar*zii/thv(c))**0.333_r8 - um(p) = sqrt(ur(p)*ur(p)+wc*wc) - end if - obu(p) = zldis(p)/zeta - - if (obuold(p)*obu(p) < 0._r8) nmozsgn(p) = nmozsgn(p)+1 - - obuold(p) = obu(p) - - end do ! end of filtered pft loop - - iter = iter + 1 - if (iter <= niters ) then - ! Rebuild copy of pft filter for next pass through the ITERATION loop - - fnold = fncopy - fncopy = 0 - do fp = 1, fnold - p = fpcopy(fp) - if (nmozsgn(p) < 3) then - fncopy = fncopy + 1 - fpcopy(fncopy) = p - end if - end do ! end of filtered pft loop - end if - - end do ITERATION ! end of stability iteration - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - g = pgridcell(p) - - ! initialize snow cap terms to zero for lake columns - qflx_snwcp_ice(p) = 0._r8 - qflx_snwcp_liq(p) = 0._r8 - - ! If there is snow on the ground and t_grnd > tfrz: reset t_grnd = tfrz. - ! Re-evaluate ground fluxes. Energy imbalance used to melt snow. - ! h2osno > 0.5 prevents spurious fluxes. - ! note that qsatg and qsatgdT should be f(tgbef) (PET: not sure what this - ! comment means) - - if (h2osno(c) > 0.5_r8 .AND. t_grnd(c) > tfrz) then - t_grnd(c) = tfrz - eflx_sh_grnd(p) = forc_rho(g)*cpair*(t_grnd(c)-thm(p))/rah(p) - qflx_evap_soi(p) = forc_rho(g)*(qsatg(c)+qsatgdT(c)*(t_grnd(c)-tgbef(c)) - forc_q(g))/raw(p) - end if - - ! Net longwave from ground to atmosphere - - eflx_lwrad_out(p) = (1._r8-emg)*forc_lwrad(g) + stftg3(p)*(-3._r8*tgbef(c)+4._r8*t_grnd(c)) - - ! Ground heat flux - - eflx_soil_grnd(p) = sabg(p) + forc_lwrad(g) - eflx_lwrad_out(p) - & - eflx_sh_grnd(p) - htvp(c)*qflx_evap_soi(p) - - taux(p) = -forc_rho(g)*forc_u(g)/ram(p) - tauy(p) = -forc_rho(g)*forc_v(g)/ram(p) - - eflx_sh_tot(p) = eflx_sh_grnd(p) - qflx_evap_tot(p) = qflx_evap_soi(p) - eflx_lh_tot(p) = htvp(c)*qflx_evap_soi(p) - eflx_lh_grnd(p) = htvp(c)*qflx_evap_soi(p) - - ! 2 m height air temperature - t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) - - ! 2 m height specific humidity - q_ref2m(p) = forc_q(g) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(g), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - - ! Energy residual used for melting snow - if (h2osno(c) > 0._r8 .AND. t_grnd(c) >= tfrz) then - hm = min(h2osno(c)*hfus/dtime, max(eflx_soil_grnd(p),0._r8)) - else - hm = 0._r8 - end if - qmelt(c) = hm/hfus ! snow melt (mm/s) - - ! Prepare for lake layer temperature calculations below - - fin(c) = beta(idlak) * sabg(p) + forc_lwrad(g) - (eflx_lwrad_out(p) + & - eflx_sh_tot(p) + eflx_lh_tot(p) + hm) - u2m = max(1.0_r8,ustar(p)/vkc*log(2._r8/z0mg(p))) - - ws(c) = 1.2e-03_r8 * u2m - ks(c) = 6.6_r8*sqrt(abs(sin(lat(g))))*(u2m**(-1.84_r8)) - - end do - - ! Eddy diffusion + molecular diffusion coefficient (constants): - ! eddy diffusion coefficient used for unfrozen deep lakes only - - cwat = cpliq*denh2o ! a constant - km = tkwat/cwat ! a constant - - ! Lake density - - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - rhow(c,j) = 1000._r8*( 1.0_r8 - 1.9549e-05_r8*(abs(t_lake(c,j)-277._r8))**1.68_r8 ) - end do - end do - - do j = 1, nlevlak-1 - do fc = 1, num_lakec - c = filter_lakec(fc) - drhodz = (rhow(c,j+1)-rhow(c,j)) / (z(c,j+1)-z(c,j)) - n2 = -grav / rhow(c,j) * drhodz - num = 40._r8 * n2 * (vkc*z(c,j))**2 - den = max( (ws(c)**2) * exp(-2._r8*ks(c)*z(c,j)), 1.e-10_r8 ) - ri = ( -1._r8 + sqrt( max(1._r8+num/den, 0._r8) ) ) / 20._r8 - if (t_grnd(c) > tfrz) then - ! valid for deep lake only (idlak == 1) - ke = vkc*ws(c)*z(c,j)/p0 * exp(-ks(c)*z(c,j)) / (1._r8+37._r8*ri*ri) - else - ke = 0._r8 - end if - kme(c,j) = km + ke - end do - end do - - do fc = 1, num_lakec - c = filter_lakec(fc) - kme(c,nlevlak) = kme(c,nlevlak-1) - ! set number of column levels for use by Tridiagonal below - jtop(c) = 1 - end do - - ! Heat source term: unfrozen lakes only - - do j = 1, nlevlak - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - - zin = z(c,j) - 0.5_r8*dz(c,j) - zout = z(c,j) + 0.5_r8*dz(c,j) - in = exp( -eta(idlak)*max( zin-za(idlak),0._r8 ) ) - out = exp( -eta(idlak)*max( zout-za(idlak),0._r8 ) ) - - ! Assume solar absorption is only in the considered depth - if (j == nlevlak) out = 0._r8 - if (t_grnd(c) > tfrz) then - phidum = (in-out) * sabg(p) * (1._r8-beta(idlak)) - else if (j == 1) then - phidum = sabg(p) * (1._r8-beta(idlak)) - else - phidum = 0._r8 - end if - phi(c,j) = phidum - end do - end do - - ! Sum cwat*t_lake*dz for energy check - - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - - ocvts(c) = ocvts(c) + cwat*t_lake(c,j)*dz(c,j) - end do - end do - - ! Set up vector r and vectors a, b, c that define tridiagonal matrix - - do fc = 1, num_lakec - c = filter_lakec(fc) - - j = 1 - m2 = dz(c,j)/kme(c,j) + dz(c,j+1)/kme(c,j+1) - m3 = dtime/dz(c,j) - r(c,j) = t_lake(c,j) + (fin(c)+phi(c,j))*m3/cwat - (t_lake(c,j)-t_lake(c,j+1))*m3/m2 - a(c,j) = 0._r8 - b(c,j) = 1._r8 + m3/m2 - c1(c,j) = -m3/m2 - - j = nlevlak - m1 = dz(c,j-1)/kme(c,j-1) + dz(c,j)/kme(c,j) - m3 = dtime/dz(c,j) - r(c,j) = t_lake(c,j) + phi(c,j)*m3/cwat + (t_lake(c,j-1)-t_lake(c,j))*m3/m1 - a(c,j) = -m3/m1 - b(c,j) = 1._r8 + m3/m1 - c1(c,j) = 0._r8 - end do - - do j = 2, nlevlak-1 - do fc = 1, num_lakec - c = filter_lakec(fc) - - m1 = dz(c,j-1)/kme(c,j-1) + dz(c,j )/kme(c,j ) - m2 = dz(c,j )/kme(c,j ) + dz(c,j+1)/kme(c,j+1) - m3 = dtime/dz(c,j) - r(c,j) = t_lake(c,j) + phi(c,j)*m3/cwat + & - (t_lake(c,j-1) - t_lake(c,j ))*m3/m1 - & - (t_lake(c,j ) - t_lake(c,j+1))*m3/m2 - - a(c,j) = -m3/m1 - b(c,j) = 1._r8 + m3/m1 + m3/m2 - c1(c,j) = -m3/m2 - end do - end do - - ! Solve for t_lake: a, b, c, r, u - - call Tridiagonal(lbc, ubc, 1, nlevlak, jtop, num_lakec, filter_lakec, & - a, b, c1, r, t_lake(lbc:ubc,1:nlevlak)) - - ! Convective mixing: make sure cwat*dz*ts is conserved. Valid only for - ! deep lakes (idlak == 1). - - num_unfrzc = 0 - do fc = 1, num_lakec - c = filter_lakec(fc) - if (t_grnd(c) > tfrz) then - num_unfrzc = num_unfrzc + 1 - filter_unfrzc(num_unfrzc) = c - end if - end do - - do j = 1, nlevlak-1 - do fc = 1, num_unfrzc - c = filter_unfrzc(fc) - tav(c) = 0._r8 - nav(c) = 0._r8 - end do - - do i = 1, j+1 - do fc = 1, num_unfrzc - c = filter_unfrzc(fc) - if (rhow(c,j) > rhow(c,j+1)) then - tav(c) = tav(c) + t_lake(c,i)*dz(c,i) - nav(c) = nav(c) + dz(c,i) - end if - end do - end do - - do fc = 1, num_unfrzc - c = filter_unfrzc(fc) - if (rhow(c,j) > rhow(c,j+1)) then - tav(c) = tav(c)/nav(c) - end if - end do - - do i = 1, j+1 - do fc = 1, num_unfrzc - c = filter_unfrzc(fc) - if (nav(c) > 0._r8) then - t_lake(c,i) = tav(c) - rhow(c,i) = 1000._r8*( 1.0_r8 - 1.9549e-05_r8*(abs(t_lake(c,i)-277._r8))**1.68_r8 ) - end if - end do - end do - end do - - ! Sum cwat*t_lake*dz and total energy into lake for energy check - - do j = 1, nlevlak - do fc = 1, num_lakec - c = filter_lakec(fc) - ncvts(c) = ncvts(c) + cwat*t_lake(c,j)*dz(c,j) - hc_soisno(c) = hc_soisno(c) + cwat*t_lake(c,j)*dz(c,j) /1.e6_r8 - if (j == nlevlak) then - hc_soisno(c) = hc_soisno(c) + & - cpice*h2osno(c)*t_grnd(c)*snowdp(c) /1.e6_r8 - endif - fin(c) = fin(c) + phi(c,j) - end do - end do - - ! The following are needed for global average on history tape. - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - g = pgridcell(p) - errsoi(c) = (ncvts(c)-ocvts(c)) / dtime - fin(c) - t_veg(p) = forc_t(g) - eflx_lwrad_net(p) = eflx_lwrad_out(p) - forc_lwrad(g) - qflx_prec_grnd(p) = forc_rain(g) + forc_snow(g) - end do - - end subroutine BiogeophysicsLake - -end module BiogeophysicsLakeMod diff --git a/src_clm40/biogeophys/CanopyFluxesMod.F90 b/src_clm40/biogeophys/CanopyFluxesMod.F90 deleted file mode 100644 index 4ddf095a0c..0000000000 --- a/src_clm40/biogeophys/CanopyFluxesMod.F90 +++ /dev/null @@ -1,1434 +0,0 @@ -module CanopyFluxesMod - -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: CanopyFluxesMod -! -! !DESCRIPTION: -! Calculates the leaf temperature and the leaf fluxes, -! transpiration, photosynthesis and updates the dew -! accumulation due to evaporation. -! -! !USES: - use abortutils, only: endrun - use clm_varctl, only: iulog, use_c13, use_cn, use_cndv - use shr_sys_mod, only: shr_sys_flush -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: CanopyFluxes !Calculates the leaf temperature and leaf fluxes -! -! !PRIVATE MEMBER FUNCTIONS: - private :: Stomata !Leaf stomatal resistance and leaf photosynthesis -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 4/25/05, Peter Thornton: replaced old Stomata subroutine with what -! used to be called StomataCN, as part of migration to new sun/shade -! algorithms. -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: CanopyFluxes -! -! !INTERFACE: - subroutine CanopyFluxes(lbg, ubg, lbc, ubc, lbp, ubp, & - num_nolakep, filter_nolakep) -! -! !DESCRIPTION: -! 1. Calculates the leaf temperature: -! 2. Calculates the leaf fluxes, transpiration, photosynthesis and -! updates the dew accumulation due to evaporation. -! -! Method: -! Use the Newton-Raphson iteration to solve for the foliage -! temperature that balances the surface energy budget: -! -! f(t_veg) = Net radiation - Sensible - Latent = 0 -! f(t_veg) + d(f)/d(t_veg) * dt_veg = 0 (*) -! -! Note: -! (1) In solving for t_veg, t_grnd is given from the previous timestep. -! (2) The partial derivatives of aerodynamical resistances, which cannot -! be determined analytically, are ignored for d(H)/dT and d(LE)/dT -! (3) The weighted stomatal resistance of sunlit and shaded foliage is used -! (4) Canopy air temperature and humidity are derived from => Hc + Hg = Ha -! => Ec + Eg = Ea -! (5) Energy loss is due to: numerical truncation of energy budget equation -! (*); and "ecidif" (see the code) which is dropped into the sensible -! heat -! (6) The convergence criteria: the difference, del = t_veg(n+1)-t_veg(n) -! and del2 = t_veg(n)-t_veg(n-1) less than 0.01 K, and the difference -! of water flux from the leaf between the iteration step (n+1) and (n) -! less than 0.1 W/m2; or the iterative steps over 40. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_time_manager , only : get_step_size, get_prev_date - use clm_varpar , only : nlevgrnd, nlevsno - use clm_varcon , only : sb, cpair, hvap, vkc, grav, denice, & - denh2o, tfrz, csoilc, tlsai_crit, alpha_aero, & - isecspday, degpsec - use shr_const_mod , only : SHR_CONST_TKFRZ - use pftvarcon , only : nirrig - use QSatMod , only : QSat - use FrictionVelocityMod, only : FrictionVelocity, MoninObukIni - use spmdMod , only : masterproc -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbg, ubg ! gridcell bounds - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_nolakep ! number of column non-lake points in pft filter - integer, intent(in) :: filter_nolakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine Biogeophysics1 in module Biogeophysics1Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 12/19/01, Peter Thornton -! Changed tg to t_grnd for consistency with other routines -! 1/29/02, Peter Thornton -! Migrate to new data structures, new calling protocol. For now co2 and -! o2 partial pressures are hardwired, but they should be coming in from -! forc_pco2 and forc_po2. Keeping the same hardwired values as in CLM2 to -! assure bit-for-bit results in the first comparisons. -! 27 February 2008: Keith Oleson; Sparse/dense aerodynamic parameters from -! X. Zeng -! 6 March 2009: Peter Thornton; Daylength control on Vcmax, from Bill Bauerle -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in variables -! - integer , pointer :: frac_veg_nosno(:) ! frac of veg not covered by snow (0 OR 1 now) [-] - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: pgridcell(:) ! pft's gridcell index - real(r8), pointer :: forc_th(:) ! atmospheric potential temperature (Kelvin) - real(r8), pointer :: t_grnd(:) ! ground surface temperature [K] - real(r8), pointer :: thm(:) ! intermediate variable (forc_t+0.0098*forc_hgt_t_pft) - real(r8), pointer :: qg(:) ! specific humidity at ground surface [kg/kg] - real(r8), pointer :: thv(:) ! virtual potential temperature (kelvin) - real(r8), pointer :: z0mv(:) ! roughness length over vegetation, momentum [m] - real(r8), pointer :: z0hv(:) ! roughness length over vegetation, sensible heat [m] - real(r8), pointer :: z0qv(:) ! roughness length over vegetation, latent heat [m] - real(r8), pointer :: z0mg(:) ! roughness length of ground, momentum [m] - real(r8), pointer :: dqgdT(:) ! temperature derivative of "qg" - real(r8), pointer :: htvp(:) ! latent heat of evaporation (/sublimation) [J/kg] - real(r8), pointer :: emv(:) ! ground emissivity - real(r8), pointer :: emg(:) ! vegetation emissivity - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - real(r8), pointer :: forc_pco2(:) ! partial pressure co2 (Pa) - - ! 4/14/05: PET - ! Adding isotope code - real(r8), pointer :: forc_pc13o2(:) ! partial pressure c13o2 (Pa) - - real(r8), pointer :: forc_po2(:) ! partial pressure o2 (Pa) - real(r8), pointer :: forc_q(:) ! atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_u(:) ! atmospheric wind speed in east direction (m/s) - real(r8), pointer :: forc_v(:) ! atmospheric wind speed in north direction (m/s) - real(r8), pointer :: forc_hgt_u_pft(:) !observational height of wind at pft level [m] - real(r8), pointer :: forc_rho(:) ! density (kg/m**3) - real(r8), pointer :: forc_lwrad(:) ! downward infrared (longwave) radiation (W/m**2) - real(r8), pointer :: displa(:) ! displacement height (m) - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - real(r8), pointer :: fdry(:) ! fraction of foliage that is green and dry [-] - real(r8), pointer :: fwet(:) ! fraction of canopy that is wet (0 to 1) - real(r8), pointer :: laisun(:) ! sunlit leaf area - real(r8), pointer :: laisha(:) ! shaded leaf area - real(r8), pointer :: sabv(:) ! solar radiation absorbed by vegetation (W/m**2) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) - real(r8), pointer :: watdry(:,:) ! btran parameter for btran=0 - real(r8), pointer :: watopt(:,:) ! btran parameter for btran = 1 - real(r8), pointer :: h2osoi_ice(:,:)! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:)! liquid water (kg/m2) - real(r8), pointer :: dz(:,:) ! layer depth (m) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: sucsat(:,:) ! minimum soil suction (mm) - real(r8), pointer :: bsw(:,:) ! Clapp and Hornberger "b" - real(r8), pointer :: rootfr(:,:) ! fraction of roots in each soil layer - real(r8), pointer :: dleaf(:) ! characteristic leaf dimension (m) - real(r8), pointer :: smpso(:) ! soil water potential at full stomatal opening (mm) - real(r8), pointer :: smpsc(:) ! soil water potential at full stomatal closure (mm) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: htop(:) ! canopy top(m) - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: soilbeta(:) ! soil wetness relative to field capacity - real(r8), pointer :: lat(:) ! latitude (radians) - real(r8), pointer :: decl(:) ! declination angle (radians) - real(r8), pointer :: max_dayl(:) !maximum daylength for this column (s) - real(r8), pointer :: londeg(:) ! longitude (degrees) (for calculation of local time) - -! -! local pointers to implicit inout arguments -! - real(r8), pointer :: cgrnds(:) ! deriv. of soil sensible heat flux wrt soil temp [w/m2/k] - real(r8), pointer :: cgrndl(:) ! deriv. of soil latent heat flux wrt soil temp [w/m**2/k] - real(r8), pointer :: t_veg(:) ! vegetation temperature (Kelvin) - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (Kelvin) - real(r8), pointer :: q_ref2m(:) ! 2 m height surface specific humidity (kg/kg) - real(r8), pointer :: t_ref2m_r(:) ! Rural 2 m height surface air temperature (Kelvin) - real(r8), pointer :: rh_ref2m(:) ! 2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m_r(:) ! Rural 2 m height surface relative humidity (%) - real(r8), pointer :: h2ocan(:) ! canopy water (mm H2O) - real(r8), pointer :: cisun(:) !sunlit intracellular CO2 (Pa) - real(r8), pointer :: cisha(:) !shaded intracellular CO2 (Pa) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: rb1(:) ! boundary layer resistance (s/m) - real(r8), pointer :: cgrnd(:) ! deriv. of soil energy flux wrt to soil temp [w/m2/k] - real(r8), pointer :: dlrad(:) ! downward longwave radiation below the canopy [W/m2] - real(r8), pointer :: ulrad(:) ! upward longwave radiation above the canopy [W/m2] - real(r8), pointer :: ram1(:) ! aerodynamical resistance (s/m) - real(r8), pointer :: btran(:) ! transpiration wetness factor (0 to 1) - real(r8), pointer :: rssun(:) ! sunlit stomatal resistance (s/m) - real(r8), pointer :: rssha(:) ! shaded stomatal resistance (s/m) - real(r8), pointer :: psnsun(:) ! sunlit leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: psnsha(:) ! shaded leaf photosynthesis (umol CO2 /m**2/ s) - - ! 4/14/05: PET - ! Adding isotope code - real(r8), pointer :: c13_psnsun(:) ! sunlit leaf photosynthesis (umol 13CO2 /m**2/ s) - real(r8), pointer :: c13_psnsha(:) ! shaded leaf photosynthesis (umol 13CO2 /m**2/ s) - ! 4/21/05: PET - ! Adding isotope code - real(r8), pointer :: rc13_canair(:) !C13O2/C12O2 in canopy air - real(r8), pointer :: rc13_psnsun(:) !C13O2/C12O2 in sunlit canopy psn flux - real(r8), pointer :: rc13_psnsha(:) !C13O2/C12O2 in shaded canopy psn flux - real(r8), pointer :: alphapsnsun(:) !fractionation factor in sunlit canopy psn flux - real(r8), pointer :: alphapsnsha(:) !fractionation factor in shaded canopy psn flux - - real(r8), pointer :: qflx_tran_veg(:) ! vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: dt_veg(:) ! change in t_veg, last iteration (Kelvin) - real(r8), pointer :: qflx_evap_veg(:) ! vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: eflx_sh_veg(:) ! sensible heat flux from leaves (W/m**2) [+ to atm] - real(r8), pointer :: taux(:) ! wind (shear) stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy(:) ! wind (shear) stress: n-s (kg/m/s**2) - real(r8), pointer :: eflx_sh_grnd(:) ! sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_soi(:) ! soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: fpsn(:) ! photosynthesis (umol CO2 /m**2 /s) - real(r8), pointer :: rootr(:,:) ! effective fraction of roots in each soil layer - real(r8), pointer :: rresis(:,:) ! root resistance by layer (0-1) (nlevgrnd) - real(r8), pointer :: irrig_rate(:) ! current irrigation rate [mm/s] - integer, pointer :: n_irrig_steps_left(:) ! # of time steps for which we still need to irrigate today -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - real(r8), parameter :: btran0 = 0.0_r8 ! initial value - real(r8), parameter :: zii = 1000.0_r8 ! convective boundary layer height [m] - real(r8), parameter :: beta = 1.0_r8 ! coefficient of conective velocity [-] - real(r8), parameter :: delmax = 1.0_r8 ! maxchange in leaf temperature [K] - real(r8), parameter :: dlemin = 0.1_r8 ! max limit for energy flux convergence [w/m2] - real(r8), parameter :: dtmin = 0.01_r8 ! max limit for temperature convergence [K] - integer , parameter :: itmax = 40 ! maximum number of iteration [-] - integer , parameter :: itmin = 2 ! minimum number of iteration [-] - real(r8), parameter :: irrig_min_lai = 0.0_r8 ! Minimum LAI for irrigation - real(r8), parameter :: irrig_btran_thresh = 0.999999_r8 ! Irrigate when btran falls below 0.999999 rather than 1 to allow for round-off error - integer , parameter :: irrig_start_time = isecspday/4 ! Time of day to check whether we need irrigation, seconds (0 = midnight). - ! We start applying the irrigation in the time step FOLLOWING this time, - ! since we won't begin irrigating until the next call to Hydrology1 - integer , parameter :: irrig_length = isecspday/6 ! Desired amount of time to irrigate per day (sec). Actual time may - ! differ if this is not a multiple of dtime. Irrigation won't work properly - ! if dtime > secsperday - real(r8), parameter :: irrig_factor = 0.7_r8 ! Determines target soil moisture level for irrigation. If h2osoi_liq_so - ! is the soil moisture level at which stomata are fully open and - ! h2osoi_liq_sat is the soil moisture level at saturation (eff_porosity), - ! then the target soil moisture level is - ! (h2osoi_liq_so + irrig_factor*(h2osoi_liq_sat - h2osoi_liq_so)). - ! A value of 0 means that the target soil moisture level is h2osoi_liq_so. - ! A value of 1 means that the target soil moisture level is h2osoi_liq_sat - - !added by K.Sakaguchi for litter resistance - real(r8), parameter :: lai_dl = 0.5_r8 ! placeholder for (dry) plant litter area index (m2/m2) - real(r8), parameter :: z_dl = 0.05_r8 ! placeholder for (dry) litter layer thickness (m) - !added by K.Sakaguchi for stability formulation - real(r8), parameter :: ria = 0.5_r8 ! free parameter for stable formulation (currently = 0.5, "gamma" in Sakaguchi&Zeng,2008) - real(r8) :: dtime ! land model time step (sec) - real(r8) :: zldis(lbp:ubp) ! reference height "minus" zero displacement height [m] - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: dth(lbp:ubp) ! diff of virtual temp. between ref. height and surface - real(r8) :: dthv(lbp:ubp) ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: dqh(lbp:ubp) ! diff of humidity between ref. height and surface - real(r8) :: obu(lbp:ubp) ! Monin-Obukhov length (m) - real(r8) :: um(lbp:ubp) ! wind speed including the stablity effect [m/s] - real(r8) :: ur(lbp:ubp) ! wind speed at reference height [m/s] - real(r8) :: uaf(lbp:ubp) ! velocity of air within foliage [m/s] - real(r8) :: temp1(lbp:ubp) ! relation for potential temperature profile - real(r8) :: temp12m(lbp:ubp) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(lbp:ubp) ! relation for specific humidity profile - real(r8) :: temp22m(lbp:ubp) ! relation for specific humidity profile applied at 2-m - real(r8) :: ustar(lbp:ubp) ! friction velocity [m/s] - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: taf(lbp:ubp) ! air temperature within canopy space [K] - real(r8) :: qaf(lbp:ubp) ! humidity of canopy air [kg/kg] - real(r8) :: rpp ! fraction of potential evaporation from leaf [-] - real(r8) :: rppdry ! fraction of potential evaporation through transp [-] - real(r8) :: cf ! heat transfer coefficient from leaves [-] - real(r8) :: rb(lbp:ubp) ! leaf boundary layer resistance [s/m] - real(r8) :: rah(lbp:ubp,2) ! thermal resistance [s/m] - real(r8) :: raw(lbp:ubp,2) ! moisture resistance [s/m] - real(r8) :: wta ! heat conductance for air [m/s] - real(r8) :: wtg(lbp:ubp) ! heat conductance for ground [m/s] - real(r8) :: wtl ! heat conductance for leaf [m/s] - real(r8) :: wta0(lbp:ubp) ! normalized heat conductance for air [-] - real(r8) :: wtl0(lbp:ubp) ! normalized heat conductance for leaf [-] - real(r8) :: wtg0 ! normalized heat conductance for ground [-] - real(r8) :: wtal(lbp:ubp) ! normalized heat conductance for air and leaf [-] - real(r8) :: wtga ! normalized heat cond. for air and ground [-] - real(r8) :: wtaq ! latent heat conductance for air [m/s] - real(r8) :: wtlq ! latent heat conductance for leaf [m/s] - real(r8) :: wtgq(lbp:ubp) ! latent heat conductance for ground [m/s] - real(r8) :: wtaq0(lbp:ubp) ! normalized latent heat conductance for air [-] - real(r8) :: wtlq0(lbp:ubp) ! normalized latent heat conductance for leaf [-] - real(r8) :: wtgq0 ! normalized heat conductance for ground [-] - real(r8) :: wtalq(lbp:ubp) ! normalized latent heat cond. for air and leaf [-] - real(r8) :: wtgaq ! normalized latent heat cond. for air and ground [-] - real(r8) :: el(lbp:ubp) ! vapor pressure on leaf surface [pa] - real(r8) :: deldT ! derivative of "el" on "t_veg" [pa/K] - real(r8) :: qsatl(lbp:ubp) ! leaf specific humidity [kg/kg] - real(r8) :: qsatldT(lbp:ubp) ! derivative of "qsatl" on "t_veg" - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - real(r8) :: air(lbp:ubp),bir(lbp:ubp),cir(lbp:ubp) ! atmos. radiation temporay set - real(r8) :: dc1,dc2 ! derivative of energy flux [W/m2/K] - real(r8) :: delt ! temporary - real(r8) :: delq(lbp:ubp) ! temporary - real(r8) :: del(lbp:ubp) ! absolute change in leaf temp in current iteration [K] - real(r8) :: del2(lbp:ubp) ! change in leaf temperature in previous iteration [K] - real(r8) :: dele(lbp:ubp) ! change in latent heat flux from leaf [K] - real(r8) :: dels ! change in leaf temperature in current iteration [K] - real(r8) :: det(lbp:ubp) ! maximum leaf temp. change in two consecutive iter [K] - real(r8) :: efeb(lbp:ubp) ! latent heat flux from leaf (previous iter) [mm/s] - real(r8) :: efeold ! latent heat flux from leaf (previous iter) [mm/s] - real(r8) :: efpot ! potential latent energy flux [kg/m2/s] - real(r8) :: efe(lbp:ubp) ! water flux from leaf [mm/s] - real(r8) :: efsh ! sensible heat from leaf [mm/s] - real(r8) :: obuold(lbp:ubp) ! monin-obukhov length from previous iteration - real(r8) :: tlbef(lbp:ubp) ! leaf temperature from previous iteration [K] - real(r8) :: ecidif ! excess energies [W/m2] - real(r8) :: err(lbp:ubp) ! balance error - real(r8) :: erre ! balance error - real(r8) :: co2(lbp:ubp) ! atmospheric co2 partial pressure (pa) - - ! 4/14/05: PET - ! Adding isotope code - real(r8) :: c13o2(lbp:ubp) ! atmospheric c13o2 partial pressure (pa) - - real(r8) :: o2(lbp:ubp) ! atmospheric o2 partial pressure (pa) - real(r8) :: svpts(lbp:ubp) ! saturation vapor pressure at t_veg (pa) - real(r8) :: eah(lbp:ubp) ! canopy air vapor pressure (pa) - real(r8) :: s_node ! vol_liq/eff_porosity - real(r8) :: smp_node ! matrix potential - real(r8) :: vol_ice ! partial volume of ice lens in layer - real(r8) :: eff_porosity ! effective porosity in layer - real(r8) :: vol_liq ! partial volume of liquid water in layer - integer :: itlef ! counter for leaf temperature iteration [-] - integer :: nmozsgn(lbp:ubp) ! number of times stability changes sign - real(r8) :: w ! exp(-LSAI) - real(r8) :: csoilcn ! interpolated csoilc for less than dense canopies - real(r8) :: fm(lbp:ubp) ! needed for BGC only to diagnose 10m wind speed - real(r8) :: wtshi ! sensible heat resistance for air, grnd and leaf [-] - real(r8) :: wtsqi ! latent heat resistance for air, grnd and leaf [-] - integer :: j ! soil/snow level index - integer :: p ! pft index - integer :: c ! column index - integer :: l ! landunit index - integer :: g ! gridcell index - integer :: fp ! lake filter pft index - integer :: fn ! number of values in pft filter - integer :: fnorig ! number of values in pft filter copy - integer :: fnold ! temporary copy of pft count - integer :: f ! filter index - integer :: filterp(ubp-lbp+1) ! temporary filter - integer :: fporig(ubp-lbp+1) ! temporary filter - real(r8) :: displa_loc(lbp:ubp) ! temporary copy - real(r8) :: z0mv_loc(lbp:ubp) ! temporary copy - real(r8) :: z0hv_loc(lbp:ubp) ! temporary copy - real(r8) :: z0qv_loc(lbp:ubp) ! temporary copy - logical :: found ! error flag for canopy above forcing hgt - integer :: index ! pft index for error - real(r8) :: egvf ! effective green vegetation fraction - real(r8) :: lt ! elai+esai - real(r8) :: ri ! stability parameter for under canopy air (unitless) - real(r8) :: csoilb ! turbulent transfer coefficient over bare soil (unitless) - real(r8) :: ricsoilc ! modified transfer coefficient under dense canopy (unitless) - real(r8) :: snowdp_c ! critical snow depth to cover plant litter (m) - real(r8) :: rdl ! dry litter layer resistance for water vapor (s/m) - real(r8) :: elai_dl ! exposed (dry) plant litter area index - real(r8) :: fsno_dl ! effective snow cover over plant litter - real(r8) :: dayl ! daylength (s) - real(r8) :: temp ! temporary, for daylength calculation - real(r8) :: dayl_factor(lbp:ubp) ! scalar (0-1) for daylength effect on Vcmax - integer :: yr ! year at start of time step - integer :: mon ! month at start of time step - integer :: day ! day at start of time step - integer :: time ! time at start of time step (seconds after 0Z) - integer :: local_time ! local time at start of time step (seconds after solar midnight) - integer :: irrig_nsteps_per_day ! number of time steps per day in which we irrigate - logical :: check_for_irrig(lbp:ubp) ! where do we need to check soil moisture to see if we need to irrigate? - logical :: frozen_soil(lbc:ubc) ! set to true if we have encountered a frozen soil layer - real(r8) :: vol_liq_so ! partial volume of liquid water in layer for which smp_node = smpso - real(r8) :: h2osoi_liq_so ! liquid water corresponding to vol_liq_so for this layer [kg/m2] - real(r8) :: h2osoi_liq_sat ! liquid water corresponding to eff_porosity for this layer [kg/m2] - real(r8) :: deficit ! difference between desired soil moisture level for this layer and current soil moisture level [kg/m2] -!------------------------------------------------------------------------------ - - ! Assign local pointers to derived type members (gridcell-level) - - forc_lwrad => clm_a2l%forc_lwrad - forc_pco2 => clm_a2l%forc_pco2 - - forc_pc13o2 => clm_a2l%forc_pc13o2 - - forc_po2 => clm_a2l%forc_po2 - forc_q => clm_a2l%forc_q - forc_pbot => clm_a2l%forc_pbot - forc_u => clm_a2l%forc_u - forc_v => clm_a2l%forc_v - forc_th => clm_a2l%forc_th - forc_rho => clm_a2l%forc_rho - lat => grc%lat - londeg => grc%londeg - - ! Assign local pointers to derived type members (column-level) - - t_soisno => ces%t_soisno - watsat => cps%watsat - watdry => cps%watdry - watopt => cps%watopt - h2osoi_ice => cws%h2osoi_ice - dz => cps%dz - h2osoi_liq => cws%h2osoi_liq - sucsat => cps%sucsat - bsw => cps%bsw - emg => cps%emg - t_grnd => ces%t_grnd - qg => cws%qg - thv => ces%thv - dqgdT => cws%dqgdT - htvp => cps%htvp - z0mg => cps%z0mg - frac_sno => cps%frac_sno - snowdp => cps%snowdp - soilbeta => cws%soilbeta - decl => cps%decl - max_dayl => cps%max_dayl - - ! Assign local pointers to derived type members (pft-level) - - rb1 => pps%rb1 - ivt => pft%itype - pcolumn => pft%column - plandunit => pft%landunit - pgridcell => pft%gridcell - frac_veg_nosno => pps%frac_veg_nosno - btran => pps%btran - rootfr => pps%rootfr - rootr => pps%rootr - rresis => pps%rresis - emv => pps%emv - t_veg => pes%t_veg - displa => pps%displa - z0mv => pps%z0mv - z0hv => pps%z0hv - z0qv => pps%z0qv - ram1 => pps%ram1 - htop => pps%htop - rssun => pps%rssun - rssha => pps%rssha - cisun => pps%cisun - cisha => pps%cisha - psnsun => pcf%psnsun - psnsha => pcf%psnsha - - ! 4/14/05: PET - ! Adding isotope code - c13_psnsun => pc13f%psnsun - c13_psnsha => pc13f%psnsha - ! 4/21/05: PET - ! Adding isotope code - rc13_canair => pepv%rc13_canair - rc13_psnsun => pepv%rc13_psnsun - rc13_psnsha => pepv%rc13_psnsha - alphapsnsun => pps%alphapsnsun - alphapsnsha => pps%alphapsnsha - - elai => pps%elai - esai => pps%esai - fdry => pps%fdry - laisun => pps%laisun - laisha => pps%laisha - qflx_tran_veg => pwf%qflx_tran_veg - fwet => pps%fwet - h2ocan => pws%h2ocan - dt_veg => pps%dt_veg - sabv => pef%sabv - qflx_evap_veg => pwf%qflx_evap_veg - eflx_sh_veg => pef%eflx_sh_veg - taux => pmf%taux - tauy => pmf%tauy - eflx_sh_grnd => pef%eflx_sh_grnd - qflx_evap_soi => pwf%qflx_evap_soi - t_ref2m => pes%t_ref2m - q_ref2m => pes%q_ref2m - t_ref2m_r => pes%t_ref2m_r - rh_ref2m_r => pes%rh_ref2m_r - rh_ref2m => pes%rh_ref2m - dlrad => pef%dlrad - ulrad => pef%ulrad - cgrnds => pef%cgrnds - cgrndl => pef%cgrndl - cgrnd => pef%cgrnd - fpsn => pcf%fpsn - forc_hgt_u_pft => pps%forc_hgt_u_pft - thm => pes%thm - irrig_rate => cps%irrig_rate - n_irrig_steps_left => cps%n_irrig_steps_left - - ! Assign local pointers to derived type members (ecophysiological) - - dleaf => pftcon%dleaf - smpso => pftcon%smpso - smpsc => pftcon%smpsc - - ! Determine step size - - dtime = get_step_size() - irrig_nsteps_per_day = ((irrig_length + (dtime - 1))/dtime) ! round up - - ! Filter pfts where frac_veg_nosno is non-zero - - fn = 0 - do fp = 1,num_nolakep - p = filter_nolakep(fp) - if (frac_veg_nosno(p) /= 0) then - fn = fn + 1 - filterp(fn) = p - end if - end do - - ! Initialize - - do f = 1, fn - p = filterp(f) - del(p) = 0._r8 ! change in leaf temperature from previous iteration - efeb(p) = 0._r8 ! latent head flux from leaf for previous iteration - wtlq0(p) = 0._r8 - wtalq(p) = 0._r8 - wtgq(p) = 0._r8 - wtaq0(p) = 0._r8 - obuold(p) = 0._r8 - btran(p) = btran0 - end do - - ! calculate daylength control for Vcmax - do f = 1, fn - p=filterp(f) - c=pcolumn(p) - g=pgridcell(p) - ! calculate daylength - temp = -(sin(lat(g))*sin(decl(c)))/(cos(lat(g)) * cos(decl(c))) - temp = min(1._r8,max(-1._r8,temp)) - dayl = 2.0_r8 * 13750.9871_r8 * acos(temp) - ! calculate dayl_factor as the ratio of (current:max dayl)^2 - ! set a minimum of 0.01 (1%) for the dayl_factor - dayl_factor(p)=min(1._r8,max(0.01_r8,(dayl*dayl)/(max_dayl(c)*max_dayl(c)))) - end do - - rb1(lbp:ubp) = 0._r8 - - ! Effective porosity of soil, partial volume of ice and liquid (needed for btran) - ! and root resistance factors - - do j = 1,nlevgrnd - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - l = plandunit(p) - - ! Root resistance factors - - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - eff_porosity = watsat(c,j)-vol_ice - vol_liq = min(eff_porosity, h2osoi_liq(c,j)/(dz(c,j)*denh2o)) - if (vol_liq .le. 0._r8 .or. t_soisno(c,j) .le. tfrz-2._r8) then - rootr(p,j) = 0._r8 - else - s_node = max(vol_liq/eff_porosity,0.01_r8) - smp_node = max(smpsc(ivt(p)), -sucsat(c,j)*s_node**(-bsw(c,j))) - - rresis(p,j) = min( (eff_porosity/watsat(c,j))* & - (smp_node - smpsc(ivt(p))) / (smpso(ivt(p)) - smpsc(ivt(p))), 1._r8) - rootr(p,j) = rootfr(p,j)*rresis(p,j) - btran(p) = btran(p) + rootr(p,j) - endif - end do - end do - - ! Normalize root resistances to get layer contribution to ET - - do j = 1,nlevgrnd - do f = 1, fn - p = filterp(f) - if (btran(p) .gt. btran0) then - rootr(p,j) = rootr(p,j)/btran(p) - else - rootr(p,j) = 0._r8 - end if - end do - end do - - ! Determine if irrigation is needed (over irrigated soil columns) - - ! First, determine in what grid cells we need to bother 'measuring' soil water, to see if we need irrigation - ! Also set n_irrig_steps_left for these grid cells - ! n_irrig_steps_left(p) > 0 is ok even if irrig_rate(p) ends up = 0 - ! in this case, we'll irrigate by 0 for the given number of time steps - call get_prev_date(yr, mon, day, time) ! get time as of beginning of time step - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - if (ivt(p) == nirrig .and. elai(p) > irrig_min_lai .and. btran(p) < irrig_btran_thresh) then - ! see if it's the right time of day to start irrigating: - local_time = modulo(time + nint(londeg(g)/degpsec), isecspday) - if (modulo(local_time - irrig_start_time, isecspday) < dtime) then - ! it's time to start irrigating - check_for_irrig(p) = .true. - n_irrig_steps_left(c) = irrig_nsteps_per_day - irrig_rate(c) = 0._r8 ! reset; we'll add to this later - else - check_for_irrig(p) = .false. - end if - else ! non-irrig pft or elai<=irrig_min_lai or btran>irrig_btran_thresh - check_for_irrig(p) = .false. - end if - - end do - - - ! Now 'measure' soil water for the grid cells identified above and see if the soil is dry enough to warrant irrigation - frozen_soil(:) = .false. - do j = 1,nlevgrnd - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - if (check_for_irrig(p) .and. .not. frozen_soil(c)) then - ! if level L was frozen, then we don't look at any levels below L - if (t_soisno(c,j) <= SHR_CONST_TKFRZ) then - frozen_soil(c) = .true. - else if (rootfr(p,j) > 0._r8) then - ! determine soil water deficit in this layer: - - ! Calculate vol_liq_so - i.e., vol_liq at which smp_node = smpso - by inverting the above equations - ! for the root resistance factors - vol_ice = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) ! this duplicates the above equation for vol_ice - eff_porosity = watsat(c,j)-vol_ice ! this duplicates the above equation for eff_porosity - vol_liq_so = eff_porosity * (-smpso(ivt(p))/sucsat(c,j))**(-1/bsw(c,j)) - - ! Translate vol_liq_so and eff_porosity into h2osoi_liq_so and h2osoi_liq_sat and calculate deficit - h2osoi_liq_so = vol_liq_so * denh2o * dz(c,j) - h2osoi_liq_sat = eff_porosity * denh2o * dz(c,j) - deficit = max((h2osoi_liq_so + irrig_factor*(h2osoi_liq_sat - h2osoi_liq_so)) - h2osoi_liq(c,j), 0._r8) - - ! Add deficit to irrig_rate, converting units from mm to mm/sec - irrig_rate(c) = irrig_rate(c) + deficit/(dtime*irrig_nsteps_per_day) - - end if ! else if (rootfr(p,j) .gt. 0) - end if ! if (check_for_irrig(p) .and. .not. frozen_soil(c)) - end do ! do f - end do ! do j - - ! Modify aerodynamic parameters for sparse/dense canopy (X. Zeng) - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - - lt = min(elai(p)+esai(p), tlsai_crit) - egvf =(1._r8 - alpha_aero * exp(-lt)) / (1._r8 - alpha_aero * exp(-tlsai_crit)) - displa(p) = egvf * displa(p) - z0mv(p) = exp(egvf * log(z0mv(p)) + (1._r8 - egvf) * log(z0mg(c))) - z0hv(p) = z0mv(p) - z0qv(p) = z0mv(p) - - end do - - found = .false. - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - ! Net absorbed longwave radiation by canopy and ground - ! =air+bir*t_veg**4+cir*t_grnd(c)**4 - - air(p) = emv(p) * (1._r8+(1._r8-emv(p))*(1._r8-emg(c))) * forc_lwrad(g) - bir(p) = - (2._r8-emv(p)*(1._r8-emg(c))) * emv(p) * sb - cir(p) = emv(p)*emg(c)*sb - - ! Saturated vapor pressure, specific humidity, and their derivatives - ! at the leaf surface - - call QSat (t_veg(p), forc_pbot(g), el(p), deldT, qsatl(p), qsatldT(p)) - - ! Determine atmospheric co2 and o2 - - co2(p) = forc_pco2(g) - o2(p) = forc_po2(g) - - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - c13o2(p) = forc_pc13o2(g) - end if - - ! Initialize flux profile - - nmozsgn(p) = 0 - - taf(p) = (t_grnd(c) + thm(p))/2._r8 - qaf(p) = (forc_q(g)+qg(c))/2._r8 - - ur(p) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - dth(p) = thm(p)-taf(p) - dqh(p) = forc_q(g)-qaf(p) - delq(p) = qg(c) - qaf(p) - dthv(p) = dth(p)*(1._r8+0.61_r8*forc_q(g))+0.61_r8*forc_th(g)*dqh(p) - zldis(p) = forc_hgt_u_pft(p) - displa(p) - - ! Check to see if the forcing height is below the canopy height - if (zldis(p) < 0._r8) then - found = .true. - index = p - end if - - end do - - if (found) then - write(iulog,*)'Error: Forcing height is below canopy height for pft index ',index - call endrun() - end if - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - - ! Initialize Monin-Obukhov length and wind speed - - call MoninObukIni(ur(p), thv(c), dthv(p), zldis(p), z0mv(p), um(p), obu(p)) - - end do - - ! Set counter for leaf temperature iteration (itlef) - - itlef = 0 - fnorig = fn - fporig(1:fn) = filterp(1:fn) - - ! Make copies so that array sections are not passed in function calls to friction velocity - - do f = 1, fn - p = filterp(f) - displa_loc(p) = displa(p) - z0mv_loc(p) = z0mv(p) - z0hv_loc(p) = z0hv(p) - z0qv_loc(p) = z0qv(p) - end do - - ! Begin stability iteration - - ITERATION : do while (itlef <= itmax .and. fn > 0) - - ! Determine friction velocity, and potential temperature and humidity - ! profiles of the surface boundary layer - - call FrictionVelocity (lbp, ubp, fn, filterp, & - displa_loc, z0mv_loc, z0hv_loc, z0qv_loc, & - obu, itlef+1, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm) - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - tlbef(p) = t_veg(p) - del2(p) = del(p) - - ! Determine aerodynamic resistances - - ram1(p) = 1._r8/(ustar(p)*ustar(p)/um(p)) - rah(p,1) = 1._r8/(temp1(p)*ustar(p)) - raw(p,1) = 1._r8/(temp2(p)*ustar(p)) - - ! Bulk boundary layer resistance of leaves - - uaf(p) = um(p)*sqrt( 1._r8/(ram1(p)*um(p)) ) - cf = 0.01_r8/(sqrt(uaf(p))*sqrt(dleaf(ivt(p)))) - rb(p) = 1._r8/(cf*uaf(p)) - rb1(p) = rb(p) - - ! Parameterization for variation of csoilc with canopy density from - ! X. Zeng, University of Arizona - - w = exp(-(elai(p)+esai(p))) - - ! changed by K.Sakaguchi from here - ! transfer coefficient over bare soil is changed to a local variable - ! just for readability of the code (from line 680) - csoilb = (vkc/(0.13_r8*(z0mg(c)*uaf(p)/1.5e-5_r8)**0.45_r8)) - - !compute the stability parameter for ricsoilc ("S" in Sakaguchi&Zeng,2008) - - ri = ( grav*htop(p) * (taf(p) - t_grnd(c)) ) / (taf(p) * uaf(p) **2.00_r8) - - !! modify csoilc value (0.004) if the under-canopy is in stable condition - - if ( (taf(p) - t_grnd(c) ) > 0._r8) then - ! decrease the value of csoilc by dividing it with (1+gamma*min(S, 10.0)) - ! ria ("gmanna" in Sakaguchi&Zeng, 2008) is a constant (=0.5) - ricsoilc = csoilc / (1.00_r8 + ria*min( ri, 10.0_r8) ) - csoilcn = csoilb*w + ricsoilc*(1._r8-w) - else - csoilcn = csoilb*w + csoilc*(1._r8-w) - end if - - !! Sakaguchi changes for stability formulation ends here - - rah(p,2) = 1._r8/(csoilcn*uaf(p)) - raw(p,2) = rah(p,2) - - ! Stomatal resistances for sunlit and shaded fractions of canopy. - ! Done each iteration to account for differences in eah, tv. - - svpts(p) = el(p) ! pa - eah(p) = forc_pbot(g) * qaf(p) / 0.622_r8 ! pa - end do - - ! 4/25/05, PET: Now calling the sun/shade version of Stomata by default - call Stomata (fn, filterp, lbp, ubp, svpts, eah, o2, co2, rb, dayl_factor, phase='sun') - call Stomata (fn, filterp, lbp, ubp, svpts, eah, o2, co2, rb, dayl_factor, phase='sha') - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - ! Sensible heat conductance for air, leaf and ground - ! Moved the original subroutine in-line... - - wta = 1._r8/rah(p,1) ! air - wtl = (elai(p)+esai(p))/rb(p) ! leaf - wtg(p) = 1._r8/rah(p,2) ! ground - wtshi = 1._r8/(wta+wtl+wtg(p)) - - wtl0(p) = wtl*wtshi ! leaf - wtg0 = wtg(p)*wtshi ! ground - wta0(p) = wta*wtshi ! air - - wtga = wta0(p)+wtg0 ! ground + air - wtal(p) = wta0(p)+wtl0(p) ! air + leaf - - ! Fraction of potential evaporation from leaf - - if (fdry(p) .gt. 0._r8) then - rppdry = fdry(p)*rb(p)*(laisun(p)/(rb(p)+rssun(p)) + & - laisha(p)/(rb(p)+rssha(p)))/elai(p) - else - rppdry = 0._r8 - end if - efpot = forc_rho(g)*wtl*(qsatl(p)-qaf(p)) - - if (efpot > 0._r8) then - if (btran(p) > btran0) then - qflx_tran_veg(p) = efpot*rppdry - rpp = rppdry + fwet(p) - else - !No transpiration if btran below 1.e-10 - rpp = fwet(p) - qflx_tran_veg(p) = 0._r8 - end if - !Check total evapotranspiration from leaves - rpp = min(rpp, (qflx_tran_veg(p)+h2ocan(p)/dtime)/efpot) - else - !No transpiration if potential evaporation less than zero - rpp = 1._r8 - qflx_tran_veg(p) = 0._r8 - end if - - ! Update conductances for changes in rpp - ! Latent heat conductances for ground and leaf. - ! Air has same conductance for both sensible and latent heat. - ! Moved the original subroutine in-line... - - wtaq = frac_veg_nosno(p)/raw(p,1) ! air - wtlq = frac_veg_nosno(p)*(elai(p)+esai(p))/rb(p) * rpp ! leaf - - !Litter layer resistance. Added by K.Sakaguchi - snowdp_c = z_dl ! critical depth for 100% litter burial by snow (=litter thickness) - fsno_dl = snowdp(c)/snowdp_c ! effective snow cover for (dry)plant litter - elai_dl = lai_dl*(1._r8 - min(fsno_dl,1._r8)) ! exposed (dry)litter area index - rdl = ( 1._r8 - exp(-elai_dl) ) / ( 0.004_r8*uaf(p)) ! dry litter layer resistance - - ! add litter resistance and Lee and Pielke 1992 beta - if (delq(p) .lt. 0._r8) then !dew. Do not apply beta for negative flux (follow old rsoil) - wtgq(p) = frac_veg_nosno(p)/(raw(p,2)+rdl) - else - wtgq(p) = soilbeta(c)*frac_veg_nosno(p)/(raw(p,2)+rdl) - end if - - wtsqi = 1._r8/(wtaq+wtlq+wtgq(p)) - - wtgq0 = wtgq(p)*wtsqi ! ground - wtlq0(p) = wtlq*wtsqi ! leaf - wtaq0(p) = wtaq*wtsqi ! air - - wtgaq = wtaq0(p)+wtgq0 ! air + ground - wtalq(p) = wtaq0(p)+wtlq0(p) ! air + leaf - - dc1 = forc_rho(g)*cpair*wtl - dc2 = hvap*forc_rho(g)*wtlq - - efsh = dc1*(wtga*t_veg(p)-wtg0*t_grnd(c)-wta0(p)*thm(p)) - efe(p) = dc2*(wtgaq*qsatl(p)-wtgq0*qg(c)-wtaq0(p)*forc_q(g)) - - ! Evaporation flux from foliage - - erre = 0._r8 - if (efe(p)*efeb(p) < 0._r8) then - efeold = efe(p) - efe(p) = 0.1_r8*efeold - erre = efe(p) - efeold - end if - dt_veg(p) = (sabv(p) + air(p) + bir(p)*t_veg(p)**4 + & - cir(p)*t_grnd(c)**4 - efsh - efe(p)) / & - (- 4._r8*bir(p)*t_veg(p)**3 +dc1*wtga +dc2*wtgaq*qsatldT(p)) - t_veg(p) = tlbef(p) + dt_veg(p) - dels = dt_veg(p) - del(p) = abs(dels) - err(p) = 0._r8 - if (del(p) > delmax) then - dt_veg(p) = delmax*dels/del(p) - t_veg(p) = tlbef(p) + dt_veg(p) - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + cir(p)*t_grnd(c)**4 - & - (efsh + dc1*wtga*dt_veg(p)) - (efe(p) + & - dc2*wtgaq*qsatldT(p)*dt_veg(p)) - end if - - ! Fluxes from leaves to canopy space - ! "efe" was limited as its sign changes frequently. This limit may - ! result in an imbalance in "hvap*qflx_evap_veg" and - ! "efe + dc2*wtgaq*qsatdt_veg" - - efpot = forc_rho(g)*wtl*(wtgaq*(qsatl(p)+qsatldT(p)*dt_veg(p)) & - -wtgq0*qg(c)-wtaq0(p)*forc_q(g)) - qflx_evap_veg(p) = rpp*efpot - - ! Calculation of evaporative potentials (efpot) and - ! interception losses; flux in kg m**-2 s-1. ecidif - ! holds the excess energy if all intercepted water is evaporated - ! during the timestep. This energy is later added to the - ! sensible heat flux. - - ecidif = 0._r8 - if (efpot > 0._r8 .and. btran(p) > btran0) then - qflx_tran_veg(p) = efpot*rppdry - else - qflx_tran_veg(p) = 0._r8 - end if - ecidif = max(0._r8, qflx_evap_veg(p)-qflx_tran_veg(p)-h2ocan(p)/dtime) - qflx_evap_veg(p) = min(qflx_evap_veg(p),qflx_tran_veg(p)+h2ocan(p)/dtime) - - ! The energy loss due to above two limits is added to - ! the sensible heat flux. - - eflx_sh_veg(p) = efsh + dc1*wtga*dt_veg(p) + err(p) + erre + hvap*ecidif - - ! Re-calculate saturated vapor pressure, specific humidity, and their - ! derivatives at the leaf surface - - call QSat(t_veg(p), forc_pbot(g), el(p), deldT, qsatl(p), qsatldT(p)) - - ! Update vegetation/ground surface temperature, canopy air - ! temperature, canopy vapor pressure, aerodynamic temperature, and - ! Monin-Obukhov stability parameter for next iteration. - - taf(p) = wtg0*t_grnd(c) + wta0(p)*thm(p) + wtl0(p)*t_veg(p) - qaf(p) = wtlq0(p)*qsatl(p) + wtgq0*qg(c) + forc_q(g)*wtaq0(p) - - ! Update Monin-Obukhov length and wind speed including the - ! stability effect - - dth(p) = thm(p)-taf(p) - dqh(p) = forc_q(g)-qaf(p) - delq(p) = wtalq(p)*qg(c)-wtlq0(p)*qsatl(p)-wtaq0(p)*forc_q(g) - - tstar = temp1(p)*dth(p) - qstar = temp2(p)*dqh(p) - - thvstar = tstar*(1._r8+0.61_r8*forc_q(g)) + 0.61_r8*forc_th(g)*qstar - zeta = zldis(p)*vkc*grav*thvstar/(ustar(p)**2*thv(c)) - - if (zeta >= 0._r8) then !stable - zeta = min(2._r8,max(zeta,0.01_r8)) - um(p) = max(ur(p),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta*(-grav*ustar(p)*thvstar*zii/thv(c))**0.333_r8 - um(p) = sqrt(ur(p)*ur(p)+wc*wc) - end if - obu(p) = zldis(p)/zeta - - if (obuold(p)*obu(p) < 0._r8) nmozsgn(p) = nmozsgn(p)+1 - if (nmozsgn(p) >= 4) obu(p) = zldis(p)/(-0.01_r8) - obuold(p) = obu(p) - - end do ! end of filtered pft loop - - ! Test for convergence - - itlef = itlef+1 - if (itlef > itmin) then - do f = 1, fn - p = filterp(f) - dele(p) = abs(efe(p)-efeb(p)) - efeb(p) = efe(p) - det(p) = max(del(p),del2(p)) - end do - fnold = fn - fn = 0 - do f = 1, fnold - p = filterp(f) - if (.not. (det(p) < dtmin .and. dele(p) < dlemin)) then - fn = fn + 1 - filterp(fn) = p - end if - end do - end if - - end do ITERATION ! End stability iteration - - fn = fnorig - filterp(1:fn) = fporig(1:fn) - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - ! Energy balance check in canopy - - err(p) = sabv(p) + air(p) + bir(p)*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) & - + cir(p)*t_grnd(c)**4 - eflx_sh_veg(p) - hvap*qflx_evap_veg(p) - - ! Fluxes from ground to canopy space - - delt = wtal(p)*t_grnd(c)-wtl0(p)*t_veg(p)-wta0(p)*thm(p) - taux(p) = -forc_rho(g)*forc_u(g)/ram1(p) - tauy(p) = -forc_rho(g)*forc_v(g)/ram1(p) - eflx_sh_grnd(p) = cpair*forc_rho(g)*wtg(p)*delt - qflx_evap_soi(p) = forc_rho(g)*wtgq(p)*delq(p) - - ! 2 m height air temperature - - t_ref2m(p) = thm(p) + temp1(p)*dth(p)*(1._r8/temp12m(p) - 1._r8/temp1(p)) - t_ref2m_r(p) = t_ref2m(p) - - ! 2 m height specific humidity - - q_ref2m(p) = forc_q(g) + temp2(p)*dqh(p)*(1._r8/temp22m(p) - 1._r8/temp2(p)) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(g), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - rh_ref2m_r(p) = rh_ref2m(p) - - ! Downward longwave radiation below the canopy - - dlrad(p) = (1._r8-emv(p))*emg(c)*forc_lwrad(g) + & - emv(p)*emg(c)*sb*tlbef(p)**3*(tlbef(p) + 4._r8*dt_veg(p)) - - ! Upward longwave radiation above the canopy - - ulrad(p) = ((1._r8-emg(c))*(1._r8-emv(p))*(1._r8-emv(p))*forc_lwrad(g) & - + emv(p)*(1._r8+(1._r8-emg(c))*(1._r8-emv(p)))*sb*tlbef(p)**3*(tlbef(p) + & - 4._r8*dt_veg(p)) + emg(c)*(1._r8-emv(p))*sb*t_grnd(c)**4) - - ! Derivative of soil energy flux with respect to soil temperature - - cgrnds(p) = cgrnds(p) + cpair*forc_rho(g)*wtg(p)*wtal(p) - cgrndl(p) = cgrndl(p) + forc_rho(g)*wtgq(p)*wtalq(p)*dqgdT(c) - cgrnd(p) = cgrnds(p) + cgrndl(p)*htvp(c) - - ! Update dew accumulation (kg/m2) - - h2ocan(p) = max(0._r8,h2ocan(p)+(qflx_tran_veg(p)-qflx_evap_veg(p))*dtime) - - ! total photosynthesis - - fpsn(p) = psnsun(p)*laisun(p) + psnsha(p)*laisha(p) - - if (use_cn) then - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - rc13_canair(p) = c13o2(p)/(co2(p)-c13o2(p)) - rc13_psnsun(p) = rc13_canair(p)/alphapsnsun(p) - rc13_psnsha(p) = rc13_canair(p)/alphapsnsha(p) - c13_psnsun(p) = psnsun(p) * (rc13_psnsun(p)/(1._r8+rc13_psnsun(p))) - c13_psnsha(p) = psnsha(p) * (rc13_psnsha(p)/(1._r8+rc13_psnsha(p))) - !write(iulog,*) p,ivt(p),btran(p),psnsun(p),psnsha(p),alphapsnsun(p),alphapsnsha(p) - end if - end if - - end do - - ! Filter out pfts which have small energy balance errors; report others - - fnold = fn - fn = 0 - do f = 1, fnold - p = filterp(f) - if (abs(err(p)) > 0.1_r8) then - fn = fn + 1 - filterp(fn) = p - end if - end do - - do f = 1, fn - p = filterp(f) - write(iulog,*) 'energy balance in canopy ',p,', err=',err(p) - end do - - end subroutine CanopyFluxes - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: Stomata -! -! !INTERFACE: - subroutine Stomata (fn, filterp, lbp, ubp, ei, ea, o2, co2, rb, dayl_factor, phase) -! -! !DESCRIPTION: -! Leaf stomatal resistance and leaf photosynthesis. Modifications for CN code. - -! !REVISION HISTORY: -! 22 January 2004: Created by Peter Thornton -! 4/14/05: Peter Thornton: Converted Ci from local variable to pps struct member -! now returns cisun or cisha per pft as implicit output argument. -! Also sets alphapsnsun and alphapsnsha. -! 4/25/05, Peter Thornton: Adopted as the default code for CLM, together with -! modifications for sun/shade canopy. Renamed from StomataCN to Stomata, -! and eliminating the older Stomata subroutine -! 3/6/09: Peter Thornton; added dayl_factor control on Vcmax, from Bill Bauerle - -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_const_mod, only : SHR_CONST_TKFRZ, SHR_CONST_RGAS - use clmtype - use clm_atmlnd , only : clm_a2l - use spmdMod , only: masterproc - use pftvarcon , only : nbrdlf_dcd_tmp_shrub - use pftvarcon , only : nsoybean, npcropmin -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: fn ! size of pft filter - integer , intent(in) :: filterp(fn) ! pft filter - integer , intent(in) :: lbp, ubp ! pft bounds - real(r8), intent(in) :: ei(lbp:ubp) ! vapor pressure inside leaf (sat vapor press at tl) (pa) - real(r8), intent(in) :: ea(lbp:ubp) ! vapor pressure of canopy air (pa) - real(r8), intent(in) :: o2(lbp:ubp) ! atmospheric o2 concentration (pa) - real(r8), intent(in) :: co2(lbp:ubp) ! atmospheric co2 concentration (pa) - real(r8), intent(inout) :: rb(lbp:ubp) ! boundary layer resistance (s/m) - real(r8), intent(in) :: dayl_factor(lbp:ubp) ! scalar (0-1) for daylength - character(len=*), intent(in) :: phase ! 'sun' or 'sha' -! -! !CALLED FROM: -! subroutine CanopyFluxes in this module -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in variables -! new ecophys variables (leafcn, flnr) added 1/26/04 -! - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: qe25(:) ! quantum efficiency at 25C (umol CO2 / umol photon) - real(r8), pointer :: c3psn(:) ! photosynthetic pathway: 0. = c4, 1. = c3 - real(r8), pointer :: mp(:) ! slope of conductance-to-photosynthesis relationship - real(r8), pointer :: tgcm(:) ! air temperature at agcm reference height (kelvin) - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - real(r8), pointer :: tl(:) ! leaf temperature (Kelvin) - real(r8), pointer :: btran(:) ! soil water transpiration factor (0 to 1) - real(r8), pointer :: apar(:) ! par absorbed per unit lai (w/m**2) - real(r8), pointer :: leafcn(:) ! leaf C:N (gC/gN) - real(r8), pointer :: flnr(:) ! fraction of leaf N in the Rubisco enzyme (gN Rubisco / gN leaf) - real(r8), pointer :: sla(:) ! specific leaf area, projected area basis (m^2/gC) - real(r8), pointer :: fnitr(:) ! foliage nitrogen limitation factor (-) -! -! local pointers to implicit inout variables -! - real(r8), pointer :: rs(:) ! leaf stomatal resistance (s/m) - real(r8), pointer :: psn(:) ! foliage photosynthesis (umol co2 /m**2/ s) [always +] - real(r8), pointer :: ci(:) ! intracellular leaf CO2 (Pa) - real(r8), pointer :: alphapsn(:) ! 13C fractionation factor for PSN () -! -! local pointers to implicit out variables -! - real(r8), pointer :: lnc(:) ! leaf N concentration per unit projected LAI (gN leaf/m^2) - real(r8), pointer :: vcmx(:) ! maximum rate of carboxylation (umol co2/m**2/s) -! -! -! !LOCAL VARIABLES: -!EOP -! - real(r8), parameter :: mpe = 1.e-6_r8 ! prevents overflow error if division by zero - integer , parameter :: niter = 3 ! number of iterations - integer :: f,p,c,g ! indices - integer :: iter ! iteration index - real(r8) :: ab ! used in statement functions - real(r8) :: bc ! used in statement functions - real(r8) :: f1 ! generic temperature response (statement function) - real(r8) :: f2 ! generic temperature inhibition (statement function) - real(r8) :: tc ! leaf temperature (degree celsius) - real(r8) :: cs ! co2 concentration at leaf surface (pa) - real(r8) :: kc ! co2 michaelis-menten constant (pa) - real(r8) :: ko ! o2 michaelis-menten constant (pa) - real(r8) :: atmp ! intermediate calculations for rs - real(r8) :: btmp ! intermediate calculations for rs - real(r8) :: ctmp ! intermediate calculations for rs - real(r8) :: q ! intermediate calculations for rs - real(r8) :: r1,r2 ! roots for rs - real(r8) :: ppf ! absorb photosynthetic photon flux (umol photons/m**2/s) - real(r8) :: wc ! rubisco limited photosynthesis (umol co2/m**2/s) - real(r8) :: wj ! light limited photosynthesis (umol co2/m**2/s) - real(r8) :: we ! export limited photosynthesis (umol co2/m**2/s) - real(r8) :: cp ! co2 compensation point (pa) - real(r8) :: awc ! intermediate calcuation for wc - real(r8) :: j ! electron transport (umol co2/m**2/s) - real(r8) :: cea ! constrain ea or else model blows up - real(r8) :: cf ! s m**2/umol -> s/m - real(r8) :: rsmax0 ! maximum stomatal resistance [s/m] - real(r8) :: kc25 ! co2 michaelis-menten constant at 25c (pa) - real(r8) :: akc ! q10 for kc25 - real(r8) :: ko25 ! o2 michaelis-menten constant at 25c (pa) - real(r8) :: ako ! q10 for ko25 - real(r8) :: bp ! minimum leaf conductance (umol/m**2/s) - ! additional variables for new treatment of Vcmax, Peter Thornton, 1/26/04 - real(r8) :: act25 ! (umol/mgRubisco/min) Rubisco activity at 25 C - real(r8) :: act ! (umol/mgRubisco/min) Rubisco activity - real(r8) :: q10act ! (DIM) Q_10 for Rubisco activity - real(r8) :: fnr ! (gRubisco/gN in Rubisco) -!------------------------------------------------------------------------------ - - ! Set statement functions - - f1(ab,bc) = ab**((bc-25._r8)/10._r8) - f2(ab) = 1._r8 + exp((-2.2e05_r8+710._r8*(ab+SHR_CONST_TKFRZ))/(SHR_CONST_RGAS*0.001_r8*(ab+SHR_CONST_TKFRZ))) - - ! Assign local pointers to derived type members (pft-level) - - pcolumn => pft%column - pgridcell => pft%gridcell - ivt => pft%itype - tl => pes%t_veg - btran => pps%btran - if (phase == 'sun') then - apar => pef%parsun - rs => pps%rssun - psn => pcf%psnsun - ci => pps%cisun - - alphapsn => pps%alphapsnsun - - sla => pps%slasun - lnc => pps%lncsun - vcmx => pps%vcmxsun - else if (phase == 'sha') then - apar => pef%parsha - rs => pps%rssha - psn => pcf%psnsha - ci => pps%cisha - sla => pps%slasha - - alphapsn => pps%alphapsnsha - - lnc => pps%lncsha - vcmx => pps%vcmxsha - end if - - ! Assign local pointers to derived type members (gridcell-level) - - forc_pbot => clm_a2l%forc_pbot - - ! Assign local pointers to derived type members (column-level) - - tgcm => pes%thm - - ! Assign local pointers to pft constants - ! new ecophys constants added 1/26/04 - - qe25 => pftcon%qe25 - c3psn => pftcon%c3psn - mp => pftcon%mp - leafcn => pftcon%leafcn - flnr => pftcon%flnr - fnitr => pftcon%fnitr - - ! Set constant values - - kc25 = 30._r8 - akc = 2.1_r8 - ko25 = 30000._r8 - ako = 1.2_r8 - bp = 2000._r8 - - ! New constants for CN code, added 1/26/04 - - act25 = 3.6_r8 - q10act = 2.4_r8 - fnr = 7.16_r8 - - ! Convert rubisco activity units from umol/mgRubisco/min -> umol/gRubisco/s - - act25 = act25 * 1000.0_r8 / 60.0_r8 - - do f = 1, fn - p = filterp(f) - c = pcolumn(p) - g = pgridcell(p) - - ! Initialize rs=rsmax and psn=0 because calculations are performed only - ! when apar > 0, in which case rs <= rsmax and psn >= 0 - ! Set constants - - rsmax0 = 2.e4_r8 - cf = forc_pbot(g)/(SHR_CONST_RGAS*0.001_r8*tgcm(p))*1.e06_r8 - if (apar(p) <= 0._r8) then ! night time - rs(p) = min(rsmax0, 1._r8/bp * cf) - psn(p) = 0._r8 - lnc(p) = 0._r8 - vcmx(p) = 0._r8 - if (use_c13) then - alphapsn(p) = 1._r8 - end if - else ! day time - tc = tl(p) - SHR_CONST_TKFRZ - ppf = 4.6_r8 * apar(p) - j = ppf * qe25(ivt(p)) - kc = kc25 * f1(akc,tc) - ko = ko25 * f1(ako,tc) - awc = kc * (1._r8+o2(p)/ko) - cp = 0.5_r8*kc/ko*o2(p)*0.21_r8 - - ! Modification for shrubs proposed by X.D.Z - ! Why does he prefer this line here instead of in subr. - ! CanopyFluxes? (slevis) - ! Equivalent modification for soy following AgroIBIS - if (use_cndv) then - if (ivt(p) == nbrdlf_dcd_tmp_shrub) btran(p) = min(1._r8, btran(p) * 3.33_r8) - end if - if (ivt(p) == nsoybean) btran(p) = min(1._r8, btran(p) * 1.25_r8) - - ! new calculations for vcmax, 1/26/04 - lnc(p) = 1._r8 / (sla(p) * leafcn(ivt(p))) - act = act25 * f1(q10act,tc) - if (use_cn) then - if ( ivt(p) < npcropmin )then - vcmx(p) = lnc(p) * flnr(ivt(p)) * fnr * act / f2(tc) * btran(p) * & - dayl_factor(p) - else - vcmx(p) = 101._r8 * f1(q10act,tc) / f2(tc) * btran(p) * dayl_factor(p) - end if - else - vcmx(p) = lnc(p) * flnr(ivt(p)) * fnr * act / f2(tc) * btran(p) * & - dayl_factor(p) * fnitr(ivt(p)) - end if - - ! First guess ci - - ci(p) = 0.7_r8*co2(p)*c3psn(ivt(p)) + 0.4_r8*co2(p)*(1._r8-c3psn(ivt(p))) - - ! rb: s/m -> s m**2 / umol - - rb(p) = rb(p)/cf - - ! Constrain ea - - cea = max(0.25_r8*ei(p)*c3psn(ivt(p))+0.40_r8*ei(p)*(1._r8-c3psn(ivt(p))), min(ea(p),ei(p)) ) - - ! ci iteration for 'actual' photosynthesis - - do iter = 1, niter - wj = max(ci(p)-cp,0._r8)*j/(ci(p)+2._r8*cp)*c3psn(ivt(p)) + j*(1._r8-c3psn(ivt(p))) - wc = max(ci(p)-cp,0._r8)*vcmx(p)/(ci(p)+awc)*c3psn(ivt(p)) + vcmx(p)*(1._r8-c3psn(ivt(p))) - we = 0.5_r8*vcmx(p)*c3psn(ivt(p)) + 4000._r8*vcmx(p)*ci(p)/forc_pbot(g)*(1._r8-c3psn(ivt(p))) - psn(p) = min(wj,wc,we) - cs = max( co2(p)-1.37_r8*rb(p)*forc_pbot(g)*psn(p), mpe ) - atmp = mp(ivt(p))*psn(p)*forc_pbot(g)*cea / (cs*ei(p)) + bp - btmp = ( mp(ivt(p))*psn(p)*forc_pbot(g)/cs + bp ) * rb(p) - 1._r8 - ctmp = -rb(p) - if (btmp >= 0._r8) then - q = -0.5_r8*( btmp + sqrt(btmp*btmp-4._r8*atmp*ctmp) ) - else - q = -0.5_r8*( btmp - sqrt(btmp*btmp-4._r8*atmp*ctmp) ) - end if - r1 = q/atmp - r2 = ctmp/q - rs(p) = max(r1,r2) - ci(p) = max( cs-psn(p)*forc_pbot(g)*1.65_r8*rs(p), 0._r8 ) - end do - - ! rs, rb: s m**2 / umol -> s/m - - rs(p) = min(rsmax0, rs(p)*cf) - rb(p) = rb(p) * cf - - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - alphapsn(p) = 1._r8 + (((c3psn(ivt(p)) * (4.4_r8 + (22.6_r8*(ci(p)/co2(p))))) + & - ((1._r8 - c3psn(ivt(p))) * 4.4_r8))/1000._r8) - !alphapsn(p) = 1._r8 - !write(iulog,*) 'in StomataCN ',p,ivt(p),c3psn(ivt(p)),ci(p),co2(p),alphapsn(p) - end if - - end if - - end do - - end subroutine Stomata - -end module CanopyFluxesMod diff --git a/src_clm40/biogeophys/FracWetMod.F90 b/src_clm40/biogeophys/FracWetMod.F90 deleted file mode 100644 index f4bd6b9b80..0000000000 --- a/src_clm40/biogeophys/FracWetMod.F90 +++ /dev/null @@ -1,115 +0,0 @@ -module FracWetMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: FracWetMod -! -! !DESCRIPTION: -! Determine fraction of vegetated surfaces which are wet and -! fraction of elai which is dry. -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: FracWet -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: FracWet -! -! !INTERFACE: - subroutine FracWet(numf, filter) -! -! !DESCRIPTION: -! Determine fraction of vegetated surfaces which are wet and -! fraction of elai which is dry. The variable ``fwet'' is the -! fraction of all vegetation surfaces which are wet including -! stem area which contribute to evaporation. The variable ``fdry'' -! is the fraction of elai which is dry because only leaves -! can transpire. Adjusted for stem area which does not transpire. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: numf ! number of filter non-lake points - integer, intent(in) :: filter(numf) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine Hydrology1 in module Hydrology1Mod -! -! !REVISION HISTORY: -! Created by Keith Oleson and M. Vertenstein -! 03/08/29 Mariana Vertenstein : Migrated to vectorized code -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: frac_veg_nosno(:) ! fraction of veg not covered by snow (0/1 now) [-] - real(r8), pointer :: dewmx(:) ! Maximum allowed dew [mm] - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - real(r8), pointer :: h2ocan(:) ! total canopy water (mm H2O) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: fwet(:) ! fraction of canopy that is wet (0 to 1) - real(r8), pointer :: fdry(:) ! fraction of foliage that is green and dry [-] (new) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: fp,p ! indices - real(r8) :: vegt ! frac_veg_nosno*lsai - real(r8) :: dewmxi ! inverse of maximum allowed dew [1/mm] -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (pft-level) - - frac_veg_nosno => pps%frac_veg_nosno - dewmx => pps%dewmx - elai => pps%elai - esai => pps%esai - h2ocan => pws%h2ocan - fwet => pps%fwet - fdry => pps%fdry - - ! Compute fraction of canopy that is wet and dry - - do fp = 1,numf - p = filter(fp) - if (frac_veg_nosno(p) == 1) then - if (h2ocan(p) > 0._r8) then - vegt = frac_veg_nosno(p)*(elai(p) + esai(p)) - dewmxi = 1.0_r8/dewmx(p) - fwet(p) = ((dewmxi/vegt)*h2ocan(p))**0.666666666666_r8 - fwet(p) = min (fwet(p),1.0_r8) ! Check for maximum limit of fwet - else - fwet(p) = 0._r8 - end if - fdry(p) = (1._r8-fwet(p))*elai(p)/(elai(p)+esai(p)) - else - fwet(p) = 0._r8 - fdry(p) = 0._r8 - end if - end do - - end subroutine FracWet - -end module FracWetMod diff --git a/src_clm40/biogeophys/FrictionVelocityMod.F90 b/src_clm40/biogeophys/FrictionVelocityMod.F90 deleted file mode 100644 index 0f3eaa3a52..0000000000 --- a/src_clm40/biogeophys/FrictionVelocityMod.F90 +++ /dev/null @@ -1,572 +0,0 @@ -module FrictionVelocityMod - -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: FrictionVelocityMod -! -! !DESCRIPTION: -! Calculation of the friction velocity, relation for potential -! temperature and humidity profiles of surface boundary layer. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: FrictionVelocity ! Calculate friction velocity - public :: MoninObukIni ! Initialization of the Monin-Obukhov length -! -! !PRIVATE MEMBER FUNCTIONS: - private :: StabilityFunc1 ! Stability function for rib < 0. - private :: StabilityFunc2 ! Stability function for rib < 0. -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: FrictionVelocity -! -! !INTERFACE: - subroutine FrictionVelocity(lbn, ubn, fn, filtern, & - displa, z0m, z0h, z0q, & - obu, iter, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm, landunit_index) -! -! !DESCRIPTION: -! Calculation of the friction velocity, relation for potential -! temperature and humidity profiles of surface boundary layer. -! The scheme is based on the work of Zeng et al. (1998): -! Intercomparison of bulk aerodynamic algorithms for the computation -! of sea surface fluxes using TOGA CORE and TAO data. J. Climate, -! Vol. 11, 2628-2644. -! -! !USES: - use clmtype - use clm_atmlnd, only : clm_a2l - use clm_varcon, only : vkc - use clm_varctl, only : iulog -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbn, ubn ! pft/landunit array bounds - integer , intent(in) :: fn ! number of filtered pft/landunit elements - integer , intent(in) :: filtern(fn) ! pft/landunit filter - real(r8), intent(in) :: displa(lbn:ubn) ! displacement height (m) - real(r8), intent(in) :: z0m(lbn:ubn) ! roughness length over vegetation, momentum [m] - real(r8), intent(in) :: z0h(lbn:ubn) ! roughness length over vegetation, sensible heat [m] - real(r8), intent(in) :: z0q(lbn:ubn) ! roughness length over vegetation, latent heat [m] - real(r8), intent(in) :: obu(lbn:ubn) ! monin-obukhov length (m) - integer, intent(in) :: iter ! iteration number - real(r8), intent(in) :: ur(lbn:ubn) ! wind speed at reference height [m/s] - real(r8), intent(in) :: um(lbn:ubn) ! wind speed including the stablity effect [m/s] - logical, optional, intent(in) :: landunit_index ! optional argument that defines landunit or pft level - real(r8), intent(out) :: ustar(lbn:ubn) ! friction velocity [m/s] - real(r8), intent(out) :: temp1(lbn:ubn) ! relation for potential temperature profile - real(r8), intent(out) :: temp12m(lbn:ubn) ! relation for potential temperature profile applied at 2-m - real(r8), intent(out) :: temp2(lbn:ubn) ! relation for specific humidity profile - real(r8), intent(out) :: temp22m(lbn:ubn) ! relation for specific humidity profile applied at 2-m - real(r8), intent(inout) :: fm(lbn:ubn) ! diagnose 10m wind (DUST only) -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 12/19/01, Peter Thornton -! Added arguments to eliminate passing clm derived type into this function. -! Created by Mariana Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: ngridcell(:) !pft/landunit gridcell index - real(r8), pointer :: forc_hgt_u_pft(:) !observational height of wind at pft level [m] - real(r8), pointer :: forc_hgt_t_pft(:) !observational height of temperature at pft level [m] - real(r8), pointer :: forc_hgt_q_pft(:) !observational height of specific humidity at pft level [m] - integer , pointer :: pfti(:) !beginning pfti index for landunit - integer , pointer :: pftf(:) !final pft index for landunit -! -! local pointers to implicit out arguments -! - real(r8), pointer :: u10(:) ! 10-m wind (m/s) (for dust model) - real(r8), pointer :: fv(:) ! friction velocity (m/s) (for dust model) - real(r8), pointer :: vds(:) ! dry deposition velocity term (m/s) (for SO4 NH4NO3) - real(r8), pointer :: u10_clm(:) ! 10-m wind (m/s) - real(r8), pointer :: va(:) ! atmospheric wind speed plus convective velocity (m/s) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - real(r8), parameter :: zetam = 1.574_r8 ! transition point of flux-gradient relation (wind profile) - real(r8), parameter :: zetat = 0.465_r8 ! transition point of flux-gradient relation (temp. profile) - integer :: f ! pft/landunit filter index - integer :: n ! pft/landunit index - integer :: g ! gridcell index - integer :: pp ! pfti,pftf index - real(r8):: zldis(lbn:ubn) ! reference height "minus" zero displacement heght [m] - real(r8):: zeta(lbn:ubn) ! dimensionless height used in Monin-Obukhov theory - real(r8) :: tmp1,tmp2,tmp3,tmp4 ! Used to diagnose the 10 meter wind - real(r8) :: fmnew ! Used to diagnose the 10 meter wind - real(r8) :: fm10 ! Used to diagnose the 10 meter wind - real(r8) :: zeta10 ! Used to diagnose the 10 meter wind - real(r8) :: vds_tmp ! Temporary for dry deposition velocity -!------------------------------------------------------------------------------ - - ! Assign local pointers to derived type members (gridcell-level) - - if (present(landunit_index)) then - ngridcell => lun%gridcell - else - ngridcell => pft%gridcell - end if - - vds => pps%vds - u10 => pps%u10 - u10_clm => pps%u10_clm - va => pps%va - fv => pps%fv - - ! Assign local pointers to derived type members (pft or landunit-level) - - pfti => lun%pfti - pftf => lun%pftf - - ! Assign local pointers to derived type members (pft-level) - - forc_hgt_u_pft => pps%forc_hgt_u_pft - forc_hgt_t_pft => pps%forc_hgt_t_pft - forc_hgt_q_pft => pps%forc_hgt_q_pft - - ! Adjustment factors for unstable (moz < 0) or stable (moz > 0) conditions. - - do f = 1, fn - n = filtern(f) - g = ngridcell(n) - - ! Wind profile - - if (present(landunit_index)) then - zldis(n) = forc_hgt_u_pft(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_u_pft(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetam) then - ustar(n) = vkc*um(n)/(log(-zetam*obu(n)/z0m(n))& - - StabilityFunc1(-zetam) & - + StabilityFunc1(z0m(n)/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) - else if (zeta(n) < 0._r8) then - ustar(n) = vkc*um(n)/(log(zldis(n)/z0m(n))& - - StabilityFunc1(zeta(n))& - + StabilityFunc1(z0m(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - ustar(n) = vkc*um(n)/(log(zldis(n)/z0m(n)) + 5._r8*zeta(n) -5._r8*z0m(n)/obu(n)) - else - ustar(n) = vkc*um(n)/(log(obu(n)/z0m(n))+5._r8-5._r8*z0m(n)/obu(n) & - +(5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - if (zeta(n) < 0._r8) then - vds_tmp = 2.e-3_r8*ustar(n) * ( 1._r8 + (300._r8/(-obu(n)))**0.666_r8) - else - vds_tmp = 2.e-3_r8*ustar(n) - endif - - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - vds(pp) = vds_tmp - end do - else - vds(n) = vds_tmp - end if - -! Calculate a 10-m wind (10m + z0m + d) -! For now, this will not be the same as the 10-m wind calculated for the dust -! model because the CLM stability functions are used here, not the LSM stability -! functions used in the dust model. We will eventually change the dust model to be -! consistent with the following formulation. -! Note that the 10-m wind calculated this way could actually be larger than the -! atmospheric forcing wind because 1) this includes the convective velocity, 2) -! this includes the 1 m/s minimum wind threshold - -! If forcing height is less than or equal to 10m, then set 10-m wind to um - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - if (zldis(n)-z0m(n) .le. 10._r8) then - u10_clm(pp) = um(n) - else - if (zeta(n) < -zetam) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(-zetam*obu(n)/(10._r8+z0m(n))) & - - StabilityFunc1(-zetam) & - + StabilityFunc1((10._r8+z0m(n))/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) ) - else if (zeta(n) < 0._r8) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - - StabilityFunc1(zeta(n)) & - + StabilityFunc1((10._r8+z0m(n))/obu(n))) ) - else if (zeta(n) <= 1._r8) then - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - + 5._r8*zeta(n) - 5._r8*(10._r8+z0m(n))/obu(n)) ) - else - u10_clm(pp) = um(n) - ( ustar(n)/vkc*(log(obu(n)/(10._r8+z0m(n))) & - + 5._r8 - 5._r8*(10._r8+z0m(n))/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) ) - - end if - end if - va(pp) = um(n) - end do - else - if (zldis(n)-z0m(n) .le. 10._r8) then - u10_clm(n) = um(n) - else - if (zeta(n) < -zetam) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(-zetam*obu(n)/(10._r8+z0m(n))) & - - StabilityFunc1(-zetam) & - + StabilityFunc1((10._r8+z0m(n))/obu(n)) & - + 1.14_r8*((-zeta(n))**0.333_r8-(zetam)**0.333_r8)) ) - else if (zeta(n) < 0._r8) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - - StabilityFunc1(zeta(n)) & - + StabilityFunc1((10._r8+z0m(n))/obu(n))) ) - else if (zeta(n) <= 1._r8) then - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(zldis(n)/(10._r8+z0m(n))) & - + 5._r8*zeta(n) - 5._r8*(10._r8+z0m(n))/obu(n)) ) - else - u10_clm(n) = um(n) - ( ustar(n)/vkc*(log(obu(n)/(10._r8+z0m(n))) & - + 5._r8 - 5._r8*(10._r8+z0m(n))/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) ) - end if - end if - va(n) = um(n) - end if - - ! Temperature profile - - if (present(landunit_index)) then - zldis(n) = forc_hgt_t_pft(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_t_pft(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp1(n) = vkc/(log(-zetat*obu(n)/z0h(n))& - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0h(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp1(n) = vkc/(log(zldis(n)/z0h(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0h(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp1(n) = vkc/(log(zldis(n)/z0h(n)) + 5._r8*zeta(n) - 5._r8*z0h(n)/obu(n)) - else - temp1(n) = vkc/(log(obu(n)/z0h(n)) + 5._r8 - 5._r8*z0h(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - ! Humidity profile - - if (present(landunit_index)) then - if (forc_hgt_q_pft(pfti(n)) == forc_hgt_t_pft(pfti(n)) .and. z0q(n) == z0h(n)) then - temp2(n) = temp1(n) - else - zldis(n) = forc_hgt_q_pft(pfti(n))-displa(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp2(n) = vkc/(log(-zetat*obu(n)/z0q(n)) & - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp2(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - end if - else - if (forc_hgt_q_pft(n) == forc_hgt_t_pft(n) .and. z0q(n) == z0h(n)) then - temp2(n) = temp1(n) - else - zldis(n) = forc_hgt_q_pft(n)-displa(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp2(n) = vkc/(log(-zetat*obu(n)/z0q(n)) & - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp2(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp2(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - endif - endif - - ! Temperature profile applied at 2-m - - zldis(n) = 2.0_r8 + z0h(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp12m(n) = vkc/(log(-zetat*obu(n)/z0h(n))& - - StabilityFunc2(-zetat) & - + StabilityFunc2(z0h(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp12m(n) = vkc/(log(zldis(n)/z0h(n)) & - - StabilityFunc2(zeta(n)) & - + StabilityFunc2(z0h(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp12m(n) = vkc/(log(zldis(n)/z0h(n)) + 5._r8*zeta(n) - 5._r8*z0h(n)/obu(n)) - else - temp12m(n) = vkc/(log(obu(n)/z0h(n)) + 5._r8 - 5._r8*z0h(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - - ! Humidity profile applied at 2-m - - if (z0q(n) == z0h(n)) then - temp22m(n) = temp12m(n) - else - zldis(n) = 2.0_r8 + z0q(n) - zeta(n) = zldis(n)/obu(n) - if (zeta(n) < -zetat) then - temp22m(n) = vkc/(log(-zetat*obu(n)/z0q(n)) - & - StabilityFunc2(-zetat) + StabilityFunc2(z0q(n)/obu(n)) & - + 0.8_r8*((zetat)**(-0.333_r8)-(-zeta(n))**(-0.333_r8))) - else if (zeta(n) < 0._r8) then - temp22m(n) = vkc/(log(zldis(n)/z0q(n)) - & - StabilityFunc2(zeta(n))+StabilityFunc2(z0q(n)/obu(n))) - else if (zeta(n) <= 1._r8) then - temp22m(n) = vkc/(log(zldis(n)/z0q(n)) + 5._r8*zeta(n)-5._r8*z0q(n)/obu(n)) - else - temp22m(n) = vkc/(log(obu(n)/z0q(n)) + 5._r8 - 5._r8*z0q(n)/obu(n) & - + (5._r8*log(zeta(n))+zeta(n)-1._r8)) - end if - end if - - ! diagnose 10-m wind for dust model (dstmbl.F) - ! Notes from C. Zender's dst.F: - ! According to Bon96 p. 62, the displacement height d (here displa) is - ! 0.0 <= d <= 0.34 m in dust source regions (i.e., regions w/o trees). - ! Therefore d <= 0.034*z1 and may safely be neglected. - ! Code from LSM routine SurfaceTemperature was used to obtain u10 - - if (present(landunit_index)) then - zldis(n) = forc_hgt_u_pft(pfti(n))-displa(n) - else - zldis(n) = forc_hgt_u_pft(n)-displa(n) - end if - zeta(n) = zldis(n)/obu(n) - if (min(zeta(n), 1._r8) < 0._r8) then - tmp1 = (1._r8 - 16._r8*min(zeta(n),1._r8))**0.25_r8 - tmp2 = log((1._r8+tmp1*tmp1)/2._r8) - tmp3 = log((1._r8+tmp1)/2._r8) - fmnew = 2._r8*tmp3 + tmp2 - 2._r8*atan(tmp1) + 1.5707963_r8 - else - fmnew = -5._r8*min(zeta(n),1._r8) - endif - if (iter == 1) then - fm(n) = fmnew - else - fm(n) = 0.5_r8 * (fm(n)+fmnew) - end if - zeta10 = min(10._r8/obu(n), 1._r8) - if (zeta(n) == 0._r8) zeta10 = 0._r8 - if (zeta10 < 0._r8) then - tmp1 = (1.0_r8 - 16.0_r8 * zeta10)**0.25_r8 - tmp2 = log((1.0_r8 + tmp1*tmp1)/2.0_r8) - tmp3 = log((1.0_r8 + tmp1)/2.0_r8) - fm10 = 2.0_r8*tmp3 + tmp2 - 2.0_r8*atan(tmp1) + 1.5707963_r8 - else ! not stable - fm10 = -5.0_r8 * zeta10 - end if - if (present(landunit_index)) then - tmp4 = log( max( 1.0_r8, forc_hgt_u_pft(pfti(n)) / 10._r8) ) - else - tmp4 = log( max( 1.0_r8, forc_hgt_u_pft(n) / 10._r8) ) - end if - if (present(landunit_index)) then - do pp = pfti(n),pftf(n) - u10(pp) = ur(n) - ustar(n)/vkc * (tmp4 - fm(n) + fm10) - fv(pp) = ustar(n) - end do - else - u10(n) = ur(n) - ustar(n)/vkc * (tmp4 - fm(n) + fm10) - fv(n) = ustar(n) - end if - - end do - - end subroutine FrictionVelocity - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: StabilityFunc -! -! !INTERFACE: - real(r8) function StabilityFunc1(zeta) -! -! !DESCRIPTION: -! Stability function for rib < 0. -! -! !USES: - use shr_const_mod, only: SHR_CONST_PI -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: zeta ! dimensionless height used in Monin-Obukhov theory -! -! !CALLED FROM: -! subroutine FrictionVelocity in this module -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! -! -! !LOCAL VARIABLES: -!EOP - real(r8) :: chik, chik2 -!------------------------------------------------------------------------------ - - chik2 = sqrt(1._r8-16._r8*zeta) - chik = sqrt(chik2) - StabilityFunc1 = 2._r8*log((1._r8+chik)*0.5_r8) & - + log((1._r8+chik2)*0.5_r8)-2._r8*atan(chik)+SHR_CONST_PI*0.5_r8 - - end function StabilityFunc1 - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: StabilityFunc2 -! -! !INTERFACE: - real(r8) function StabilityFunc2(zeta) -! -! !DESCRIPTION: -! Stability function for rib < 0. -! -! !USES: - use shr_const_mod, only: SHR_CONST_PI -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: zeta ! dimensionless height used in Monin-Obukhov theory -! -! !CALLED FROM: -! subroutine FrictionVelocity in this module -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! -! -! !LOCAL VARIABLES: -!EOP - real(r8) :: chik2 -!------------------------------------------------------------------------------ - - chik2 = sqrt(1._r8-16._r8*zeta) - StabilityFunc2 = 2._r8*log((1._r8+chik2)*0.5_r8) - - end function StabilityFunc2 - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: MoninObukIni -! -! !INTERFACE: - subroutine MoninObukIni (ur, thv, dthv, zldis, z0m, um, obu) -! -! !DESCRIPTION: -! Initialization of the Monin-Obukhov length. -! The scheme is based on the work of Zeng et al. (1998): -! Intercomparison of bulk aerodynamic algorithms for the computation -! of sea surface fluxes using TOGA CORE and TAO data. J. Climate, -! Vol. 11, 2628-2644. -! -! !USES: - use clm_varcon, only : grav -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: ur ! wind speed at reference height [m/s] - real(r8), intent(in) :: thv ! virtual potential temperature (kelvin) - real(r8), intent(in) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8), intent(in) :: zldis ! reference height "minus" zero displacement heght [m] - real(r8), intent(in) :: z0m ! roughness length, momentum [m] - real(r8), intent(out) :: um ! wind speed including the stability effect [m/s] - real(r8), intent(out) :: obu ! monin-obukhov length (m) -! -! !CALLED FROM: -! subroutine BareGroundFluxes in module BareGroundFluxesMod.F90 -! subroutine BiogeophysicsLake in module BiogeophysicsLakeMod.F90 -! subroutine CanopyFluxes in module CanopyFluxesMod.F90 -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: wc ! convective velocity [m/s] - real(r8) :: rib ! bulk Richardson number - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: ustar ! friction velocity [m/s] -!----------------------------------------------------------------------- - - ! Initial values of u* and convective velocity - - ustar=0.06_r8 - wc=0.5_r8 - if (dthv >= 0._r8) then - um=max(ur,0.1_r8) - else - um=sqrt(ur*ur+wc*wc) - endif - - rib=grav*zldis*dthv/(thv*um*um) - - if (rib >= 0._r8) then ! neutral or stable - zeta = rib*log(zldis/z0m)/(1._r8-5._r8*min(rib,0.19_r8)) - zeta = min(2._r8,max(zeta,0.01_r8 )) - else ! unstable - zeta=rib*log(zldis/z0m) - zeta = max(-100._r8,min(zeta,-0.01_r8 )) - endif - - obu=zldis/zeta - - end subroutine MoninObukIni - -end module FrictionVelocityMod diff --git a/src_clm40/biogeophys/Hydrology1Mod.F90 b/src_clm40/biogeophys/Hydrology1Mod.F90 deleted file mode 100644 index 915c0969ac..0000000000 --- a/src_clm40/biogeophys/Hydrology1Mod.F90 +++ /dev/null @@ -1,499 +0,0 @@ -module Hydrology1Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: Hydrology1Mod -! -! !DESCRIPTION: -! Calculation of -! (1) water storage of intercepted precipitation -! (2) direct throughfall and canopy drainage of precipitation -! (3) the fraction of foliage covered by water and the fraction -! of foliage that is dry and transpiring. -! (4) snow layer initialization if the snow accumulation exceeds 10 mm. -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Hydrology1 -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Hydrology1 -! -! !INTERFACE: - subroutine Hydrology1(lbc, ubc, lbp, ubp, num_nolakec, filter_nolakec, & - num_nolakep, filter_nolakep) -! -! !DESCRIPTION: -! Calculation of -! (1) water storage of intercepted precipitation -! (2) direct throughfall and canopy drainage of precipitation -! (3) the fraction of foliage covered by water and the fraction -! of foliage that is dry and transpiring. -! (4) snow layer initialization if the snow accumulation exceeds 10 mm. -! Note: The evaporation loss is taken off after the calculation of leaf -! temperature in the subroutine clm\_leaftem.f90, not in this subroutine. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varcon , only : tfrz, istice, istwet, istsoil, istice_mec, isturb, & - icol_roof, icol_sunwall, icol_shadewall - use clm_varcon , only : istcrop - use FracWetMod , only : FracWet - use clm_time_manager , only : get_step_size - use subgridAveMod, only : p2c - use SNICARMod , only : snw_rds_min - -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_nolakep ! number of pft non-lake points in pft filter - integer, intent(in) :: filter_nolakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/15/02, Peter Thornton: Migrated to new data structures. Required -! adding a PFT loop. -! 4/26/05, Peter Thornton: Made the canopy interception factor fpi max=0.25 -! the default behavior -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arrays -! - real(r8), pointer :: qflx_floodg(:) ! gridcell flux of flood water from RTM - real(r8), pointer :: qflx_floodc(:) ! column flux of flood water from RTM - integer , pointer :: cgridcell(:) ! columns's gridcell - integer , pointer :: clandunit(:) ! columns's landunit - integer , pointer :: pgridcell(:) ! pft's gridcell - integer , pointer :: plandunit(:) ! pft's landunit - integer , pointer :: pcolumn(:) ! pft's column - integer , pointer :: npfts(:) ! number of pfts in column - integer , pointer :: pfti(:) ! column's beginning pft index - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: ctype(:) ! column type - real(r8), pointer :: forc_rain(:) ! rain rate [mm/s] - real(r8), pointer :: forc_snow(:) ! snow rate [mm/s] - real(r8), pointer :: forc_t(:) ! atmospheric temperature (Kelvin) - logical , pointer :: do_capsnow(:) ! true => do snow capping - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - real(r8), pointer :: dewmx(:) ! Maximum allowed dew [mm] - integer , pointer :: frac_veg_nosno(:) ! fraction of veg not covered by snow (0/1 now) [-] - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - real(r8), pointer :: h2ocan_loss(:) ! canopy water mass balance term (column) - real(r8), pointer :: irrig_rate(:) ! current irrigation rate (applied if n_irrig_steps_left > 0) [mm/s] -! -! local pointers to original implicit inout arrays -! - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: h2ocan(:) ! total canopy water (mm H2O) - real(r8), pointer :: qflx_irrig(:) ! irrigation amount (mm/s) - integer, pointer :: n_irrig_steps_left(:) ! number of time steps for which we still need to irrigate today -! -! local pointers to original implicit out arrays -! - real(r8), pointer :: qflx_prec_intr(:) ! interception of precipitation [mm/s] - real(r8), pointer :: qflx_prec_grnd(:) ! water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_snwcp_liq(:) ! excess rainfall due to snow capping (mm H2O /s) [+] - real(r8), pointer :: qflx_snwcp_ice(:) ! excess snowfall due to snow capping (mm H2O /s) [+] - real(r8), pointer :: qflx_snow_grnd_pft(:) ! snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_col(:) ! snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_rain_grnd(:) ! rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: fwet(:) ! fraction of canopy that is wet (0 to 1) - real(r8), pointer :: fdry(:) ! fraction of foliage that is green and dry [-] (new) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) - real(r8), pointer :: dz(:,:) ! layer depth (m) - real(r8), pointer :: z(:,:) ! layer thickness (m) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: frac_iceold(:,:) ! fraction of ice relative to the tot water - real(r8), pointer :: snw_rds(:,:) ! effective snow grain radius (col,lyr) [microns, m^-6] - real(r8), pointer :: mss_bcpho(:,:) ! mass of hydrophobic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcphi(:,:) ! mass of hydrophilic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bctot(:,:) ! total mass of BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bc_col(:) ! total column mass of BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bc_top(:) ! total top-layer mass of BC (col,lyr) [kg] - real(r8), pointer :: mss_ocpho(:,:) ! mass of hydrophobic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! mass of hydrophilic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_octot(:,:) ! total mass of OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_oc_col(:) ! total column mass of OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_oc_top(:) ! total top-layer mass of OC (col,lyr) [kg] - real(r8), pointer :: mss_dst1(:,:) ! mass of dust species 1 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! mass of dust species 2 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! mass of dust species 3 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! mass of dust species 4 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dsttot(:,:) ! total mass of dust in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst_col(:) ! total column mass of dust in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst_top(:) ! total top-layer mass of dust in snow (col,lyr) [kg] -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: f ! filter index - integer :: pi ! pft index - integer :: p ! pft index - integer :: c ! column index - integer :: l ! landunit index - integer :: g ! gridcell index - integer :: newnode ! flag when new snow node is set, (1=yes, 0=no) - real(r8) :: dtime ! land model time step (sec) - real(r8) :: h2ocanmx ! maximum allowed water on canopy [mm] - real(r8) :: fpi ! coefficient of interception - real(r8) :: xrun ! excess water that exceeds the leaf capacity [mm/s] - real(r8) :: dz_snowf ! layer thickness rate change due to precipitation [mm/s] - real(r8) :: bifall ! bulk density of newly fallen dry snow [kg/m3] - real(r8) :: fracsnow(lbp:ubp) ! frac of precipitation that is snow - real(r8) :: fracrain(lbp:ubp) ! frac of precipitation that is rain - real(r8) :: qflx_candrip(lbp:ubp) ! rate of canopy runoff and snow falling off canopy [mm/s] - real(r8) :: qflx_through_rain(lbp:ubp) ! direct rain throughfall [mm/s] - real(r8) :: qflx_through_snow(lbp:ubp) ! direct snow throughfall [mm/s] - real(r8) :: qflx_prec_grnd_snow(lbp:ubp) ! snow precipitation incident on ground [mm/s] - real(r8) :: qflx_prec_grnd_rain(lbp:ubp) ! rain precipitation incident on ground [mm/s] -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (gridcell-level) - - pgridcell => pft%gridcell - forc_rain => clm_a2l%forc_rain - forc_snow => clm_a2l%forc_snow - - ! Assign local pointers to derived type members (landunit-level) - - ltype => lun%itype - - ! Assign local pointers to derived type members (column-level) - - qflx_floodg => clm_a2l%forc_flood - qflx_floodc => cwf%qflx_floodc - cgridcell => col%gridcell - clandunit => col%landunit - ctype => col%itype - pfti => col%pfti - npfts => col%npfts - do_capsnow => cps%do_capsnow - forc_t => ces%forc_t - t_grnd => ces%t_grnd - snl => cps%snl - snowdp => cps%snowdp - h2osno => cws%h2osno - zi => cps%zi - dz => cps%dz - z => cps%z - frac_iceold => cps%frac_iceold - t_soisno => ces%t_soisno - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - qflx_snow_grnd_col => pwf_a%qflx_snow_grnd - h2ocan_loss => cwf%h2ocan_loss - snw_rds => cps%snw_rds - mss_bcpho => cps%mss_bcpho - mss_bcphi => cps%mss_bcphi - mss_bctot => cps%mss_bctot - mss_bc_col => cps%mss_bc_col - mss_bc_top => cps%mss_bc_top - mss_ocpho => cps%mss_ocpho - mss_ocphi => cps%mss_ocphi - mss_octot => cps%mss_octot - mss_oc_col => cps%mss_oc_col - mss_oc_top => cps%mss_oc_top - mss_dst1 => cps%mss_dst1 - mss_dst2 => cps%mss_dst2 - mss_dst3 => cps%mss_dst3 - mss_dst4 => cps%mss_dst4 - mss_dsttot => cps%mss_dsttot - mss_dst_col => cps%mss_dst_col - mss_dst_top => cps%mss_dst_top - - ! Assign local pointers to derived type members (pft-level) - - plandunit => pft%landunit - pcolumn => pft%column - dewmx => pps%dewmx - frac_veg_nosno => pps%frac_veg_nosno - elai => pps%elai - esai => pps%esai - h2ocan => pws%h2ocan - qflx_prec_intr => pwf%qflx_prec_intr - qflx_prec_grnd => pwf%qflx_prec_grnd - qflx_snwcp_liq => pwf%qflx_snwcp_liq - qflx_snwcp_ice => pwf%qflx_snwcp_ice - qflx_snow_grnd_pft => pwf%qflx_snow_grnd - qflx_rain_grnd => pwf%qflx_rain_grnd - fwet => pps%fwet - fdry => pps%fdry - irrig_rate => cps%irrig_rate - n_irrig_steps_left => cps%n_irrig_steps_left - qflx_irrig => cwf%qflx_irrig - - ! Compute time step - - dtime = get_step_size() - - ! Start pft loop - - do f = 1, num_nolakep - p = filter_nolakep(f) - g = pgridcell(p) - l = plandunit(p) - c = pcolumn(p) - - ! Canopy interception and precipitation onto ground surface - ! Add precipitation to leaf water - - if (ltype(l)==istsoil .or. ltype(l)==istwet .or. ltype(l)==isturb .or. & - ltype(l)==istcrop) then - qflx_candrip(p) = 0._r8 ! rate of canopy runoff - qflx_through_snow(p) = 0._r8 ! rain precipitation direct through canopy - qflx_through_rain(p) = 0._r8 ! snow precipitation direct through canopy - qflx_prec_intr(p) = 0._r8 ! total intercepted precipitation - fracsnow(p) = 0._r8 ! fraction of input precip that is snow - fracrain(p) = 0._r8 ! fraction of input precip that is rain - - if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall) then - if (frac_veg_nosno(p) == 1 .and. (forc_rain(g) + forc_snow(g)) > 0._r8) then - - ! determine fraction of input precipitation that is snow and rain - - fracsnow(p) = forc_snow(g)/(forc_snow(g) + forc_rain(g)) - fracrain(p) = forc_rain(g)/(forc_snow(g) + forc_rain(g)) - - ! The leaf water capacities for solid and liquid are different, - ! generally double for snow, but these are of somewhat less - ! significance for the water budget because of lower evap. rate at - ! lower temperature. Hence, it is reasonable to assume that - ! vegetation storage of solid water is the same as liquid water. - h2ocanmx = dewmx(p) * (elai(p) + esai(p)) - - ! Coefficient of interception - ! set fraction of potential interception to max 0.25 - fpi = 0.25_r8*(1._r8 - exp(-0.5_r8*(elai(p) + esai(p)))) - - ! Direct throughfall - qflx_through_snow(p) = forc_snow(g) * (1._r8-fpi) - qflx_through_rain(p) = forc_rain(g) * (1._r8-fpi) - - ! Intercepted precipitation [mm/s] - qflx_prec_intr(p) = (forc_snow(g) + forc_rain(g)) * fpi - - ! Water storage of intercepted precipitation and dew - h2ocan(p) = max(0._r8, h2ocan(p) + dtime*qflx_prec_intr(p)) - - ! Initialize rate of canopy runoff and snow falling off canopy - qflx_candrip(p) = 0._r8 - - ! Excess water that exceeds the leaf capacity - xrun = (h2ocan(p) - h2ocanmx)/dtime - - ! Test on maximum dew on leaf - ! Note if xrun > 0 then h2ocan must be at least h2ocanmx - if (xrun > 0._r8) then - qflx_candrip(p) = xrun - h2ocan(p) = h2ocanmx - end if - - end if - end if - - else if (ltype(l)==istice .or. ltype(l)==istice_mec) then - - h2ocan(p) = 0._r8 - qflx_candrip(p) = 0._r8 - qflx_through_snow(p) = 0._r8 - qflx_through_rain(p) = 0._r8 - qflx_prec_intr(p) = 0._r8 - fracsnow(p) = 0._r8 - fracrain(p) = 0._r8 - - end if - - ! Precipitation onto ground (kg/(m2 s)) - ! PET, 1/18/2005: Added new terms for mass balance correction - ! due to dynamic pft weight shifting (column-level h2ocan_loss) - ! Because the fractionation between rain and snow is indeterminate if - ! rain + snow = 0, I am adding this very small flux only to the rain - ! components. - - if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall) then - if (frac_veg_nosno(p) == 0) then - qflx_prec_grnd_snow(p) = forc_snow(g) - qflx_prec_grnd_rain(p) = forc_rain(g) + h2ocan_loss(c) - else - qflx_prec_grnd_snow(p) = qflx_through_snow(p) + (qflx_candrip(p) * fracsnow(p)) - qflx_prec_grnd_rain(p) = qflx_through_rain(p) + (qflx_candrip(p) * fracrain(p)) + h2ocan_loss(c) - end if - ! Urban sunwall and shadewall have no intercepted precipitation - else - qflx_prec_grnd_snow(p) = 0. - qflx_prec_grnd_rain(p) = 0. - end if - - ! Determine whether we're irrigating here; set qflx_irrig appropriately - if (n_irrig_steps_left(c) > 0) then - qflx_irrig(c) = irrig_rate(c) - n_irrig_steps_left(c) = n_irrig_steps_left(c) - 1 - else - qflx_irrig(c) = 0._r8 - end if - - ! Add irrigation water directly onto ground (bypassing canopy interception) - ! Note that it's still possible that (some of) this irrigation water will runoff (as runoff is computed later) - qflx_prec_grnd_rain(p) = qflx_prec_grnd_rain(p) + qflx_irrig(c) - - ! Done irrigation - - qflx_prec_grnd(p) = qflx_prec_grnd_snow(p) + qflx_prec_grnd_rain(p) - - if (do_capsnow(c)) then - qflx_snwcp_liq(p) = qflx_prec_grnd_rain(p) - qflx_snwcp_ice(p) = qflx_prec_grnd_snow(p) - - qflx_snow_grnd_pft(p) = 0._r8 - qflx_rain_grnd(p) = 0._r8 - else - qflx_snwcp_liq(p) = 0._r8 - qflx_snwcp_ice(p) = 0._r8 - qflx_snow_grnd_pft(p) = qflx_prec_grnd_snow(p) ! ice onto ground (mm/s) - qflx_rain_grnd(p) = qflx_prec_grnd_rain(p) ! liquid water onto ground (mm/s) - end if - - end do ! (end pft loop) - - ! Determine the fraction of foliage covered by water and the - ! fraction of foliage that is dry and transpiring. - - call FracWet(num_nolakep, filter_nolakep) - - ! Update column level state variables for snow. - - call p2c(num_nolakec, filter_nolakec, qflx_snow_grnd_pft, qflx_snow_grnd_col) - -!rtm_flood: apply gridcell flood water flux to non-lake columns -! no inputs to urban wall columns, as above with atm inputs -!dir$ concurrent -!cdir nodep - do f = 1, num_nolakec - c = filter_nolakec(f) - g = cgridcell(c) - if (ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall) then - qflx_floodc(c) = qflx_floodg(g) - else - qflx_floodc(c) = 0._r8 - endif - enddo -!rtm_flood - - ! Determine snow height and snow water - - do f = 1, num_nolakec - c = filter_nolakec(f) - l = clandunit(c) - g = cgridcell(c) - - ! Use Alta relationship, Anderson(1976); LaChapelle(1961), - ! U.S.Department of Agriculture Forest Service, Project F, - ! Progress Rep. 1, Alta Avalanche Study Center:Snow Layer Densification. - - if (do_capsnow(c)) then - dz_snowf = 0._r8 - else - if (forc_t(c) > tfrz + 2._r8) then - bifall=50._r8 + 1.7_r8*(17.0_r8)**1.5_r8 - else if (forc_t(c) > tfrz - 15._r8) then - bifall=50._r8 + 1.7_r8*(forc_t(c) - tfrz + 15._r8)**1.5_r8 - else - bifall=50._r8 - end if - dz_snowf = qflx_snow_grnd_col(c)/bifall - snowdp(c) = snowdp(c) + dz_snowf*dtime - h2osno(c) = h2osno(c) + qflx_snow_grnd_col(c)*dtime ! snow water equivalent (mm) - - end if - - if (ltype(l)==istwet .and. t_grnd(c)>tfrz) then - h2osno(c)=0._r8 - snowdp(c)=0._r8 - end if - - ! When the snow accumulation exceeds 10 mm, initialize snow layer - ! Currently, the water temperature for the precipitation is simply set - ! as the surface air temperature - - newnode = 0 ! flag for when snow node will be initialized - if (snl(c) == 0 .and. qflx_snow_grnd_col(c) > 0.0_r8 .and. snowdp(c) >= 0.01_r8) then - newnode = 1 - snl(c) = -1 - dz(c,0) = snowdp(c) ! meter - z(c,0) = -0.5_r8*dz(c,0) - zi(c,-1) = -dz(c,0) - t_soisno(c,0) = min(tfrz, forc_t(c)) ! K - h2osoi_ice(c,0) = h2osno(c) ! kg/m2 - h2osoi_liq(c,0) = 0._r8 ! kg/m2 - frac_iceold(c,0) = 1._r8 - - - ! intitialize SNICAR variables for fresh snow: - snw_rds(c,0) = snw_rds_min - - mss_bcpho(c,:) = 0._r8 - mss_bcphi(c,:) = 0._r8 - mss_bctot(c,:) = 0._r8 - mss_bc_col(c) = 0._r8 - mss_bc_top(c) = 0._r8 - - mss_ocpho(c,:) = 0._r8 - mss_ocphi(c,:) = 0._r8 - mss_octot(c,:) = 0._r8 - mss_oc_col(c) = 0._r8 - mss_oc_top(c) = 0._r8 - - mss_dst1(c,:) = 0._r8 - mss_dst2(c,:) = 0._r8 - mss_dst3(c,:) = 0._r8 - mss_dst4(c,:) = 0._r8 - mss_dsttot(c,:) = 0._r8 - mss_dst_col(c) = 0._r8 - mss_dst_top(c) = 0._r8 - end if - - ! The change of ice partial density of surface node due to precipitation. - ! Only ice part of snowfall is added here, the liquid part will be added - ! later. - - if (snl(c) < 0 .and. newnode == 0) then - h2osoi_ice(c,snl(c)+1) = h2osoi_ice(c,snl(c)+1)+dtime*qflx_snow_grnd_col(c) - dz(c,snl(c)+1) = dz(c,snl(c)+1)+dz_snowf*dtime - end if - - end do - - end subroutine Hydrology1 - -end module Hydrology1Mod diff --git a/src_clm40/biogeophys/Hydrology2Mod.F90 b/src_clm40/biogeophys/Hydrology2Mod.F90 deleted file mode 100644 index 759e9d3657..0000000000 --- a/src_clm40/biogeophys/Hydrology2Mod.F90 +++ /dev/null @@ -1,757 +0,0 @@ -module Hydrology2Mod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: Hydrology2Mod -! -! !DESCRIPTION: -! Calculation of soil/snow hydrology. -! -! !USES: - use clm_varctl, only : iulog, use_cn - use abortutils, only : endrun -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Hydrology2 ! Calculates soil/snow hydrology -! -! !REVISION HISTORY: -! 2/28/02 Peter Thornton: Migrated to new data structures. -! 7/12/03 Forrest Hoffman ,Mariana Vertenstein : Migrated to vector code -! 11/05/03 Peter Thornton: Added calculation of soil water potential -! for use in CN phenology code. -! 04/25/07 Keith Oleson: CLM3.5 Hydrology -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Hydrology2 -! -! !INTERFACE: - subroutine Hydrology2(lbc, ubc, lbp, ubp, & - num_nolakec, filter_nolakec, & - num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - num_snowc, filter_snowc, & - num_nosnowc, filter_nosnowc) -! -! !DESCRIPTION: -! This is the main subroutine to execute the calculation of soil/snow -! hydrology -! Calling sequence is: -! Hydrology2: surface hydrology driver -! -> SnowWater: change of snow mass and snow water onto soil -! -> SurfaceRunoff: surface runoff -! -> Infiltration: infiltration into surface soil layer -! -> SoilWater: soil water movement between layers -! -> Tridiagonal tridiagonal matrix solution -! -> Drainage: subsurface runoff -! -> SnowCompaction: compaction of snow layers -! -> CombineSnowLayers: combine snow layers that are thinner than minimum -! -> DivideSnowLayers: subdivide snow layers that are thicker than maximum -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varcon , only : denh2o, denice, spval, & - istice, istwet, istsoil, isturb, istice_mec, & - icol_roof, icol_road_imperv, icol_road_perv, icol_sunwall, & - icol_shadewall - use clm_varcon , only : istcrop - use clm_varctl , only : glc_dyntopo - use clm_varpar , only : nlevgrnd, nlevsno, nlevsoi - use SnowHydrologyMod, only : SnowCompaction, CombineSnowLayers, DivideSnowLayers, & - SnowWater, BuildSnowFilter - use SoilHydrologyMod, only : Infiltration, SoilWater, Drainage, SurfaceRunoff - use clm_time_manager, only : get_step_size, get_nstep, is_perpetual - -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: lbp, ubp ! pft bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer, intent(in) :: filter_hydrologyc(ubc-lbc+1)! column filter for soil points - integer, intent(in) :: num_urbanc ! number of column urban points in column filter - integer, intent(in) :: filter_urbanc(ubc-lbc+1) ! column filter for urban points - integer :: num_snowc ! number of column snow points - integer :: filter_snowc(ubc-lbc+1) ! column filter for snow points - integer :: num_nosnowc ! number of column non-snow points - integer :: filter_nosnowc(ubc-lbc+1) ! column filter for non-snow points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! -!rtm_flood - real(r8), pointer :: qflx_floodg(:) ! gridcell flux of flood water from RTM -!rtm_flood - integer , pointer :: cgridcell(:) ! column's gridcell - integer , pointer :: clandunit(:) ! column's landunit - integer , pointer :: ityplun(:) ! landunit type - integer , pointer :: ctype(:) ! column type - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: h2ocan(:) ! canopy water (mm H2O) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) - real(r8), pointer :: sucsat(:,:) ! minimum soil suction (mm) - real(r8), pointer :: bsw(:,:) ! Clapp and Hornberger "b" - real(r8), pointer :: z(:,:) ! layer depth (m) - real(r8), pointer :: forc_rain(:) ! rain rate [mm/s] - real(r8), pointer :: forc_snow(:) ! snow rate [mm/s] - real(r8), pointer :: begwb(:) ! water mass begining of the time step - real(r8), pointer :: qflx_evap_tot(:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: bsw2(:,:) ! Clapp and Hornberger "b" for CN code - real(r8), pointer :: psisat(:,:) ! soil water potential at saturation for CN code (MPa) - real(r8), pointer :: vwcsat(:,:) ! volumetric water content at saturation for CN code (m3/m3) -! -! local pointers to implicit inout arguments -! - real(r8), pointer :: dz(:,:) ! layer thickness depth (m) - real(r8), pointer :: zi(:,:) ! interface depth (m) - real(r8), pointer :: zwt(:) ! water table depth (m) - real(r8), pointer :: fcov(:) ! fractional impermeable area - real(r8), pointer :: fsat(:) ! fractional area with water table at surface - real(r8), pointer :: wa(:) ! water in the unconfined aquifer (mm) - real(r8), pointer :: qcharge(:) ! aquifer recharge rate (mm/s) - real(r8), pointer :: smp_l(:,:) ! soil matrix potential [mm] - real(r8), pointer :: hk_l(:,:) ! hydraulic conductivity (mm/s) - real(r8), pointer :: qflx_rsub_sat(:) ! soil saturation excess [mm h2o/s] -! -! local pointers to implicit out arguments -! - real(r8), pointer :: endwb(:) ! water mass end of the time step - real(r8), pointer :: wf(:) ! soil water as frac. of whc for top 0.5 m - real(r8), pointer :: snowice(:) ! average snow ice lens - real(r8), pointer :: snowliq(:) ! average snow liquid water - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: t_soi_10cm(:) ! soil temperature in top 10cm of soil (Kelvin) - real(r8), pointer :: h2osoi_liqice_10cm(:) ! liquid water + ice lens in top 10cm of soil (kg/m2) - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - real(r8), pointer :: qflx_drain(:) ! sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_surf(:) ! surface runoff (mm H2O /s) - real(r8), pointer :: qflx_infl(:) ! infiltration (mm H2O /s) - real(r8), pointer :: qflx_qrgwl(:) ! qflx_surf at glaciers, wetlands, lakes - real(r8), pointer :: qflx_irrig(:) ! irrigation flux (mm H2O /s) - real(r8), pointer :: qflx_runoff(:) ! total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_runoff_u(:) ! Urban total runoff (qflx_drain+qflx_surf) (mm H2O /s) - real(r8), pointer :: qflx_runoff_r(:) ! Rural total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: t_grnd_u(:) ! Urban ground temperature (Kelvin) - real(r8), pointer :: t_grnd_r(:) ! Rural ground temperature (Kelvin) - real(r8), pointer :: qflx_snwcp_ice(:)! excess snowfall due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: soilpsi(:,:) ! soil water potential in each soil layer (MPa) - - real(r8), pointer :: snot_top(:) ! snow temperature in top layer (col) [K] - real(r8), pointer :: dTdz_top(:) ! temperature gradient in top layer (col) [K m-1] - real(r8), pointer :: snw_rds(:,:) ! effective snow grain radius (col,lyr) [microns, m^-6] - real(r8), pointer :: snw_rds_top(:) ! effective snow grain size, top layer(col) [microns] - real(r8), pointer :: sno_liq_top(:) ! liquid water fraction in top snow layer (col) [frc] - real(r8), pointer :: frac_sno(:) ! snow cover fraction (col) [frc] - real(r8), pointer :: h2osno_top(:) ! mass of snow in top layer (col) [kg] - - real(r8), pointer :: mss_bcpho(:,:) ! mass of hydrophobic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcphi(:,:) ! mass of hydrophillic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bctot(:,:) ! total mass of BC (pho+phi) (col,lyr) [kg] - real(r8), pointer :: mss_bc_col(:) ! total mass of BC in snow column (col) [kg] - real(r8), pointer :: mss_bc_top(:) ! total mass of BC in top snow layer (col) [kg] - real(r8), pointer :: mss_cnc_bcphi(:,:) ! mass concentration of BC species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_bcpho(:,:) ! mass concentration of BC species 2 (col,lyr) [kg/kg] - real(r8), pointer :: mss_ocpho(:,:) ! mass of hydrophobic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! mass of hydrophillic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_octot(:,:) ! total mass of OC (pho+phi) (col,lyr) [kg] - real(r8), pointer :: mss_oc_col(:) ! total mass of OC in snow column (col) [kg] - real(r8), pointer :: mss_oc_top(:) ! total mass of OC in top snow layer (col) [kg] - real(r8), pointer :: mss_cnc_ocphi(:,:) ! mass concentration of OC species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_ocpho(:,:) ! mass concentration of OC species 2 (col,lyr) [kg/kg] - - real(r8), pointer :: mss_dst1(:,:) ! mass of dust species 1 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! mass of dust species 2 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! mass of dust species 3 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! mass of dust species 4 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dsttot(:,:) ! total mass of dust in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst_col(:) ! total mass of dust in snow column (col) [kg] - real(r8), pointer :: mss_dst_top(:) ! total mass of dust in top snow layer (col) [kg] - real(r8), pointer :: mss_cnc_dst1(:,:) ! mass concentration of dust species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst2(:,:) ! mass concentration of dust species 2 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst3(:,:) ! mass concentration of dust species 3 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst4(:,:) ! mass concentration of dust species 4 (col,lyr) [kg/kg] - logical , pointer :: do_capsnow(:) ! true => do snow capping - real(r8), pointer :: qflx_glcice(:) ! flux of new glacier ice (mm H2O /s) - real(r8), pointer :: qflx_glcice_frz(:) ! ice growth (positive definite) (mm H2O/s) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: g,l,c,j,fc ! indices - integer :: nstep ! time step number - real(r8) :: dtime ! land model time step (sec) - real(r8) :: vol_liq(lbc:ubc,1:nlevgrnd)! partial volume of liquid water in layer - real(r8) :: icefrac(lbc:ubc,1:nlevgrnd)! ice fraction in layer - real(r8) :: dwat(lbc:ubc,1:nlevgrnd) ! change in soil water - real(r8) :: hk(lbc:ubc,1:nlevgrnd) ! hydraulic conductivity (mm h2o/s) - real(r8) :: dhkdw(lbc:ubc,1:nlevgrnd) ! d(hk)/d(vol_liq) - real(r8) :: psi,vwc,fsattmp ! temporary variables for soilpsi calculation - real(r8) :: watdry ! temporary - real(r8) :: rwat(lbc:ubc) ! soil water wgted by depth to maximum depth of 0.5 m - real(r8) :: swat(lbc:ubc) ! same as rwat but at saturation - real(r8) :: rz(lbc:ubc) ! thickness of soil layers contributing to rwat (m) - real(r8) :: tsw ! volumetric soil water to 0.5 m - real(r8) :: stsw ! volumetric soil water to 0.5 m at saturation - real(r8) :: snowmass ! liquid+ice snow mass in a layer [kg/m2] - real(r8) :: snowcap_scl_fct ! temporary factor used to correct for snow capping - real(r8) :: fracl ! fraction of soil layer contributing to 10cm total soil water - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (gridcell-level) - - forc_rain => clm_a2l%forc_rain - forc_snow => clm_a2l%forc_snow - - ! Assign local pointers to derived subtypes components (landunit-level) - - ityplun => lun%itype - - ! Assign local pointers to derived subtypes components (column-level) - -!rtm_flood - qflx_floodg => clm_a2l%forc_flood -!rtm_flood - cgridcell => col%gridcell - clandunit => col%landunit - ctype => col%itype - snl => cps%snl - t_grnd => ces%t_grnd - h2ocan => pws_a%h2ocan - h2osno => cws%h2osno - wf => cps%wf - snowice => cws%snowice - snowliq => cws%snowliq - zwt => cws%zwt - fcov => cws%fcov - fsat => cws%fsat - wa => cws%wa - qcharge => cws%qcharge - watsat => cps%watsat - sucsat => cps%sucsat - bsw => cps%bsw - z => cps%z - dz => cps%dz - zi => cps%zi - t_soisno => ces%t_soisno - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - h2osoi_vol => cws%h2osoi_vol - t_soi_10cm => ces%t_soi_10cm - h2osoi_liqice_10cm => cws%h2osoi_liqice_10cm - qflx_evap_tot => pwf_a%qflx_evap_tot - qflx_drain => cwf%qflx_drain - qflx_surf => cwf%qflx_surf - qflx_infl => cwf%qflx_infl - qflx_qrgwl => cwf%qflx_qrgwl - qflx_irrig => cwf%qflx_irrig - endwb => cwbal%endwb - begwb => cwbal%begwb - bsw2 => cps%bsw2 - psisat => cps%psisat - vwcsat => cps%vwcsat - soilpsi => cps%soilpsi - smp_l => cws%smp_l - hk_l => cws%hk_l - qflx_rsub_sat => cwf%qflx_rsub_sat - qflx_runoff => cwf%qflx_runoff - qflx_runoff_u => cwf%qflx_runoff_u - qflx_runoff_r => cwf%qflx_runoff_r - t_grnd_u => ces%t_grnd_u - t_grnd_r => ces%t_grnd_r - snot_top => cps%snot_top - dTdz_top => cps%dTdz_top - snw_rds => cps%snw_rds - snw_rds_top => cps%snw_rds_top - sno_liq_top => cps%sno_liq_top - frac_sno => cps%frac_sno - h2osno_top => cps%h2osno_top - mss_bcpho => cps%mss_bcpho - mss_bcphi => cps%mss_bcphi - mss_bctot => cps%mss_bctot - mss_bc_col => cps%mss_bc_col - mss_bc_top => cps%mss_bc_top - mss_cnc_bcphi => cps%mss_cnc_bcphi - mss_cnc_bcpho => cps%mss_cnc_bcpho - mss_ocpho => cps%mss_ocpho - mss_ocphi => cps%mss_ocphi - mss_octot => cps%mss_octot - mss_oc_col => cps%mss_oc_col - mss_oc_top => cps%mss_oc_top - mss_cnc_ocphi => cps%mss_cnc_ocphi - mss_cnc_ocpho => cps%mss_cnc_ocpho - mss_dst1 => cps%mss_dst1 - mss_dst2 => cps%mss_dst2 - mss_dst3 => cps%mss_dst3 - mss_dst4 => cps%mss_dst4 - mss_dsttot => cps%mss_dsttot - mss_dst_col => cps%mss_dst_col - mss_dst_top => cps%mss_dst_top - mss_cnc_dst1 => cps%mss_cnc_dst1 - mss_cnc_dst2 => cps%mss_cnc_dst2 - mss_cnc_dst3 => cps%mss_cnc_dst3 - mss_cnc_dst4 => cps%mss_cnc_dst4 - do_capsnow => cps%do_capsnow - qflx_snwcp_ice => pwf_a%qflx_snwcp_ice - qflx_glcice => cwf%qflx_glcice - qflx_glcice_frz => cwf%qflx_glcice_frz - - ! Determine time step and step size - - nstep = get_nstep() - dtime = get_step_size() - - ! Determine initial snow/no-snow filters (will be modified possibly by - ! routines CombineSnowLayers and DivideSnowLayers below - - call BuildSnowFilter(lbc, ubc, num_nolakec, filter_nolakec, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - - ! Determine the change of snow mass and the snow water onto soil - - call SnowWater(lbc, ubc, num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - - ! Determine soil hydrology - - call SurfaceRunoff(lbc, ubc, lbp, ubp, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - vol_liq, icefrac ) - - call Infiltration(lbc, ubc, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc) - - call SoilWater(lbc, ubc, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - vol_liq, dwat, hk, dhkdw) - - call Drainage(lbc, ubc, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - vol_liq, hk, icefrac) - - if (.not. is_perpetual()) then - - ! Natural compaction and metamorphosis. - - call SnowCompaction(lbc, ubc, num_snowc, filter_snowc) - - ! Combine thin snow elements - - call CombineSnowLayers(lbc, ubc, num_snowc, filter_snowc) - - ! Divide thick snow elements - - call DivideSnowLayers(lbc, ubc, num_snowc, filter_snowc) - - else - - do fc = 1, num_snowc - c = filter_snowc(fc) - h2osno(c) = 0._r8 - end do - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - h2osno(c) = h2osno(c) + h2osoi_ice(c,j) + h2osoi_liq(c,j) - end if - end do - end do - - end if - - ! Set empty snow layers to zero - - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j <= snl(c) .and. snl(c) > -nlevsno) then - h2osoi_ice(c,j) = 0._r8 - h2osoi_liq(c,j) = 0._r8 - t_soisno(c,j) = 0._r8 - dz(c,j) = 0._r8 - z(c,j) = 0._r8 - zi(c,j-1) = 0._r8 - end if - end do - end do - - ! Build new snow filter - - call BuildSnowFilter(lbc, ubc, num_nolakec, filter_nolakec, & - num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - - ! Vertically average t_soisno and sum of h2osoi_liq and h2osoi_ice - ! over all snow layers for history output - - do fc = 1, num_nolakec - c = filter_nolakec(fc) - snowice(c) = 0._r8 - snowliq(c) = 0._r8 - end do - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - snowice(c) = snowice(c) + h2osoi_ice(c,j) - snowliq(c) = snowliq(c) + h2osoi_liq(c,j) - end if - end do - end do - - ! Determine ground temperature, ending water balance and volumetric soil water - ! Calculate soil temperature and total water (liq+ice) in top 10cm of soil - do fc = 1, num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (ityplun(l) /= isturb) then - t_soi_10cm(c) = 0._r8 - h2osoi_liqice_10cm(c) = 0._r8 - end if - end do - do j = 1, nlevsoi - do fc = 1, num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (ityplun(l) /= isturb) then - if (zi(c,j) <= 0.1_r8) then - fracl = 1._r8 - t_soi_10cm(c) = t_soi_10cm(c) + t_soisno(c,j)*dz(c,j)*fracl - h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & - fracl - else - if (zi(c,j) > 0.1_r8 .and. zi(c,j-1) .lt. 0.1_r8) then - fracl = (0.1_r8 - zi(c,j-1))/dz(c,j) - t_soi_10cm(c) = t_soi_10cm(c) + t_soisno(c,j)*dz(c,j)*fracl - h2osoi_liqice_10cm(c) = h2osoi_liqice_10cm(c) + (h2osoi_liq(c,j)+h2osoi_ice(c,j))* & - fracl - end if - end if - end if - end do - end do - - do fc = 1, num_nolakec - - c = filter_nolakec(fc) - l = clandunit(c) - - t_grnd(c) = t_soisno(c,snl(c)+1) - if (ityplun(l) /= isturb) then - t_soi_10cm(c) = t_soi_10cm(c)/0.1_r8 - end if - if (ityplun(l)==isturb) then - t_grnd_u(c) = t_soisno(c,snl(c)+1) - end if - if (ityplun(l)==istsoil .or. ityplun(l)==istcrop) then - t_grnd_r(c) = t_soisno(c,snl(c)+1) - end if - if (ctype(c) == icol_roof .or. ctype(c) == icol_sunwall & - .or. ctype(c) == icol_shadewall .or. ctype(c) == icol_road_imperv) then - endwb(c) = h2ocan(c) + h2osno(c) - else - endwb(c) = h2ocan(c) + h2osno(c) + wa(c) - end if - end do - - do j = 1, nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - endwb(c) = endwb(c) + h2osoi_ice(c,j) + h2osoi_liq(c,j) - h2osoi_vol(c,j) = h2osoi_liq(c,j)/(dz(c,j)*denh2o) + h2osoi_ice(c,j)/(dz(c,j)*denice) - end do - end do - - ! Determine wetland and land ice hydrology (must be placed here - ! since need snow updated from CombineSnowLayers) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - g = cgridcell(c) - if (ityplun(l)==istwet .or. ityplun(l)==istice & - .or. ityplun(l)==istice_mec) then - qflx_drain(c) = 0._r8 - qflx_irrig(c) = 0._r8 - qflx_surf(c) = 0._r8 - qflx_infl(c) = 0._r8 - -!rtm_flood: add flood water flux to runoff for wetlands/glaciers - qflx_qrgwl(c) = forc_rain(g) + forc_snow(g) + qflx_floodg(g) - qflx_evap_tot(c) - qflx_snwcp_ice(c) - & -!rtm_flood - (endwb(c)-begwb(c))/dtime - ! For dynamic topography, add meltwater from glacier_mec ice to the runoff. - ! (Negative qflx_glcice => positive contribution to runoff) - ! Note: The meltwater contribution is computed in PhaseChanges (part of Biogeophysics2). - ! This code will not work if Hydrology2 is called before Biogeophysics2, or if - ! qflx_snwcp_ice has alread been included in qflx_glcice. - ! (The snwcp flux is added to qflx_glcice later in this subroutine.) - - if (glc_dyntopo .and. ityplun(l)==istice_mec) then - qflx_qrgwl(c) = qflx_qrgwl(c) - qflx_glcice(c) ! meltwater from melted ice - endif - fcov(c) = spval - fsat(c) = spval - qcharge(c) = spval - qflx_rsub_sat(c) = spval - else if (ityplun(l) == isturb .and. ctype(c) /= icol_road_perv) then - fcov(c) = spval - fsat(c) = spval - qcharge(c) = spval - qflx_rsub_sat(c) = spval - end if - - ! If snow exceeds the thickness limit in glacier_mec columns, convert to an ice flux. - ! For dynamic glacier topography, remove qflx_snwcp_ice from the runoff. - ! Note that qflx_glcice can also have a negative component from melting of bare ice, - ! as computed in SoilTemperatureMod.F90 - - if (ityplun(l)==istice_mec) then - - qflx_glcice_frz(c) = qflx_snwcp_ice(c) - qflx_glcice(c) = qflx_glcice(c) + qflx_glcice_frz(c) - - ! For dynamic topography, set qflx_snwcp_ice = 0 so that this ice mass does not run off. - ! For static topography, qflx_glc_ice is passed to the ice sheet model, but the - ! CLM runoff terms are not changed. - - if (glc_dyntopo) qflx_snwcp_ice(c) = 0._r8 - - endif ! istice_mec - - qflx_runoff(c) = qflx_drain(c) + qflx_surf(c) + qflx_qrgwl(c) - if (ityplun(l)==istsoil .and. col%wtgcell(c) > 0.0_r8 ) then - qflx_runoff(c) = qflx_runoff(c) - qflx_irrig(c) - end if - if (ityplun(l)==isturb) then - qflx_runoff_u(c) = qflx_runoff(c) - else if (ityplun(l)==istsoil .or. ityplun(l)==istcrop) then - qflx_runoff_r(c) = qflx_runoff(c) - end if - - end do - - if (use_cn) then - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - if (h2osoi_liq(c,j) > 0._r8) then - vwc = h2osoi_liq(c,j)/(dz(c,j)*denh2o) - - ! the following limit set to catch very small values of - ! fractional saturation that can crash the calculation of psi - - fsattmp = max(vwc/vwcsat(c,j), 0.001_r8) - psi = psisat(c,j) * (fsattmp)**bsw2(c,j) - soilpsi(c,j) = min(max(psi,-15.0_r8),0._r8) - else - soilpsi(c,j) = -15.0_r8 - end if - end do - end do - end if - - if (use_cn) then - ! Available soil water up to a depth of 0.5 m. - ! Potentially available soil water (=whc) up to a depth of 0.5 m. - ! Water content as fraction of whc up to a depth of 0.5 m. - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - rwat(c) = 0._r8 - swat(c) = 0._r8 - rz(c) = 0._r8 - end do - - do j = 1, nlevgrnd - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - !if (z(c,j)+0.5_r8*dz(c,j) <= 0.5_r8) then - if (z(c,j)+0.5_r8*dz(c,j) <= 0.05_r8) then - watdry = watsat(c,j) * (316230._r8/sucsat(c,j)) ** (-1._r8/bsw(c,j)) - rwat(c) = rwat(c) + (h2osoi_vol(c,j)-watdry) * dz(c,j) - swat(c) = swat(c) + (watsat(c,j) -watdry) * dz(c,j) - rz(c) = rz(c) + dz(c,j) - end if - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (rz(c) /= 0._r8) then - tsw = rwat(c)/rz(c) - stsw = swat(c)/rz(c) - else - watdry = watsat(c,1) * (316230._r8/sucsat(c,1)) ** (-1._r8/bsw(c,1)) - tsw = h2osoi_vol(c,1) - watdry - stsw = watsat(c,1) - watdry - end if - wf(c) = tsw/stsw - end do - end if - - - ! Calculate column-integrated aerosol masses, and - ! mass concentrations for radiative calculations and output - ! (based on new snow level state, after SnowFilter is rebuilt. - ! NEEDS TO BE AFTER SnowFiler is rebuilt, otherwise there - ! can be zero snow layers but an active column in filter) - - do fc = 1, num_snowc - c = filter_snowc(fc) - - ! Zero column-integrated aerosol mass before summation - mss_bc_col(c) = 0._r8 - mss_oc_col(c) = 0._r8 - mss_dst_col(c) = 0._r8 - - do j = -nlevsno+1, 0 - - ! layer mass of snow: - snowmass = h2osoi_ice(c,j)+h2osoi_liq(c,j) - - ! Correct the top layer aerosol mass to account for snow capping. - ! This approach conserves the aerosol mass concentration - ! (but not the aerosol amss) when snow-capping is invoked - - if (j == snl(c)+1) then - if (do_capsnow(c)) then - snowcap_scl_fct = snowmass / (snowmass+(qflx_snwcp_ice(c)*dtime)) - - mss_bcpho(c,j) = mss_bcpho(c,j)*snowcap_scl_fct - mss_bcphi(c,j) = mss_bcphi(c,j)*snowcap_scl_fct - mss_ocpho(c,j) = mss_ocpho(c,j)*snowcap_scl_fct - mss_ocphi(c,j) = mss_ocphi(c,j)*snowcap_scl_fct - - mss_dst1(c,j) = mss_dst1(c,j)*snowcap_scl_fct - mss_dst2(c,j) = mss_dst2(c,j)*snowcap_scl_fct - mss_dst3(c,j) = mss_dst3(c,j)*snowcap_scl_fct - mss_dst4(c,j) = mss_dst4(c,j)*snowcap_scl_fct - endif - endif - - if (j >= snl(c)+1) then - mss_bctot(c,j) = mss_bcpho(c,j) + mss_bcphi(c,j) - mss_bc_col(c) = mss_bc_col(c) + mss_bctot(c,j) - mss_cnc_bcphi(c,j) = mss_bcphi(c,j) / snowmass - mss_cnc_bcpho(c,j) = mss_bcpho(c,j) / snowmass - - mss_octot(c,j) = mss_ocpho(c,j) + mss_ocphi(c,j) - mss_oc_col(c) = mss_oc_col(c) + mss_octot(c,j) - mss_cnc_ocphi(c,j) = mss_ocphi(c,j) / snowmass - mss_cnc_ocpho(c,j) = mss_ocpho(c,j) / snowmass - - mss_dsttot(c,j) = mss_dst1(c,j) + mss_dst2(c,j) + mss_dst3(c,j) + mss_dst4(c,j) - mss_dst_col(c) = mss_dst_col(c) + mss_dsttot(c,j) - mss_cnc_dst1(c,j) = mss_dst1(c,j) / snowmass - mss_cnc_dst2(c,j) = mss_dst2(c,j) / snowmass - mss_cnc_dst3(c,j) = mss_dst3(c,j) / snowmass - mss_cnc_dst4(c,j) = mss_dst4(c,j) / snowmass - - else - !set variables of empty snow layers to zero - snw_rds(c,j) = 0._r8 - - mss_bcpho(c,j) = 0._r8 - mss_bcphi(c,j) = 0._r8 - mss_bctot(c,j) = 0._r8 - mss_cnc_bcphi(c,j) = 0._r8 - mss_cnc_bcpho(c,j) = 0._r8 - - mss_ocpho(c,j) = 0._r8 - mss_ocphi(c,j) = 0._r8 - mss_octot(c,j) = 0._r8 - mss_cnc_ocphi(c,j) = 0._r8 - mss_cnc_ocpho(c,j) = 0._r8 - - mss_dst1(c,j) = 0._r8 - mss_dst2(c,j) = 0._r8 - mss_dst3(c,j) = 0._r8 - mss_dst4(c,j) = 0._r8 - mss_dsttot(c,j) = 0._r8 - mss_cnc_dst1(c,j) = 0._r8 - mss_cnc_dst2(c,j) = 0._r8 - mss_cnc_dst3(c,j) = 0._r8 - mss_cnc_dst4(c,j) = 0._r8 - endif - enddo - - ! top-layer diagnostics - h2osno_top(c) = h2osoi_ice(c,snl(c)+1) + h2osoi_liq(c,snl(c)+1) - mss_bc_top(c) = mss_bctot(c,snl(c)+1) - mss_oc_top(c) = mss_octot(c,snl(c)+1) - mss_dst_top(c) = mss_dsttot(c,snl(c)+1) - enddo - - ! Zero mass variables in columns without snow - do fc = 1, num_nosnowc - c = filter_nosnowc(fc) - - h2osno_top(c) = 0._r8 - snw_rds(c,:) = 0._r8 - - mss_bc_top(c) = 0._r8 - mss_bc_col(c) = 0._r8 - mss_bcpho(c,:) = 0._r8 - mss_bcphi(c,:) = 0._r8 - mss_bctot(c,:) = 0._r8 - mss_cnc_bcphi(c,:) = 0._r8 - mss_cnc_bcpho(c,:) = 0._r8 - - mss_oc_top(c) = 0._r8 - mss_oc_col(c) = 0._r8 - mss_ocpho(c,:) = 0._r8 - mss_ocphi(c,:) = 0._r8 - mss_octot(c,:) = 0._r8 - mss_cnc_ocphi(c,:) = 0._r8 - mss_cnc_ocpho(c,:) = 0._r8 - - mss_dst_top(c) = 0._r8 - mss_dst_col(c) = 0._r8 - mss_dst1(c,:) = 0._r8 - mss_dst2(c,:) = 0._r8 - mss_dst3(c,:) = 0._r8 - mss_dst4(c,:) = 0._r8 - mss_dsttot(c,:) = 0._r8 - mss_cnc_dst1(c,:) = 0._r8 - mss_cnc_dst2(c,:) = 0._r8 - mss_cnc_dst3(c,:) = 0._r8 - mss_cnc_dst4(c,:) = 0._r8 - - ! top-layer diagnostics (spval is not averaged when computing history fields) - snot_top(c) = spval - dTdz_top(c) = spval - snw_rds_top(c) = spval - sno_liq_top(c) = spval - enddo - - end subroutine Hydrology2 - -end module Hydrology2Mod diff --git a/src_clm40/biogeophys/HydrologyLakeMod.F90 b/src_clm40/biogeophys/HydrologyLakeMod.F90 deleted file mode 100644 index 09207e6e35..0000000000 --- a/src_clm40/biogeophys/HydrologyLakeMod.F90 +++ /dev/null @@ -1,322 +0,0 @@ -module HydrologyLakeMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: HydrologyLakeMod -! -! !DESCRIPTION: -! Calculate lake hydrology -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: HydrologyLake -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: HydrologyLake -! -! !INTERFACE: - subroutine HydrologyLake(lbp, ubp, num_lakep, filter_lakep) -! -! !DESCRIPTION: -! Calculate lake hydrology -! -! WARNING: This subroutine assumes lake columns have one and only one pft. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_time_manager, only : get_step_size - use clm_varcon , only : hfus, tfrz, spval -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: num_lakep ! number of pft non-lake points in pft filter - integer, intent(in) :: filter_lakep(ubp-lbp+1) ! pft filter for non-lake points -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 3/4/02: Peter Thornton; Migrated to new data structures. -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arrays -! - integer , pointer :: pcolumn(:) !pft's column index - integer , pointer :: pgridcell(:) !pft's gridcell index - real(r8), pointer :: begwb(:) !water mass begining of the time step - real(r8), pointer :: forc_snow(:) !snow rate [mm/s] - real(r8), pointer :: forc_rain(:) !rain rate [mm/s] - logical , pointer :: do_capsnow(:) !true => do snow capping - real(r8), pointer :: t_grnd(:) !ground temperature (Kelvin) - real(r8), pointer :: qmelt(:) !snow melt [mm/s] - real(r8), pointer :: qflx_evap_soi(:) !soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot(:) !qflx_evap_soi + qflx_evap_can + qflx_tran_veg -! -! local pointers to implicit inout arrays -! - real(r8), pointer :: h2osno(:) !snow water (mm H2O) -! -! local pointers to implicit out arrays -! -!rtm_flood - real(r8), pointer :: qflx_floodg(:) ! gridcell flux of flood water from RTM - real(r8), pointer :: qflx_floodc(:) ! column flux of flood water from RTM -!rtm_flood - real(r8), pointer :: endwb(:) !water mass end of the time step - real(r8), pointer :: snowdp(:) !snow height (m) - real(r8), pointer :: snowice(:) !average snow ice lens - real(r8), pointer :: snowliq(:) !average snow liquid water - real(r8), pointer :: qflx_rain_grnd(:)!rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_rain_grnd_col(:)!rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd(:)!snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd_col(:)!snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: eflx_snomelt(:) !snow melt heat flux (W/m**2) - real(r8), pointer :: qflx_infl(:) !infiltration (mm H2O /s) - real(r8), pointer :: qflx_snomelt(:) !snow melt (mm H2O /s) - real(r8), pointer :: qflx_surf(:) !surface runoff (mm H2O /s) - real(r8), pointer :: qflx_drain(:) !sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_irrig(:) !irrigation flux (mm H2O /s) - real(r8), pointer :: qflx_qrgwl(:) !qflx_surf at glaciers, wetlands, lakes - real(r8), pointer :: qflx_runoff(:) !total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_snwcp_ice(:)!excess snowfall due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: qflx_snwcp_ice_col(:)!excess snowfall due to snow capping (mm H2O /s) [+]` - real(r8), pointer :: qflx_evap_tot_col(:) !pft quantity averaged to the column (assuming one pft) - real(r8), pointer :: qflx_evap_grnd(:)! ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_evap_grnd_col(:)! ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_sub_snow(:) ! sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_sub_snow_col(:) ! sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow(:) ! surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow_col(:) ! surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd(:) ! ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd_col(:) ! ground surface dew formation (mm H2O /s) [+] - real(r8) ,pointer :: soilalpha(:) !factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: zwt(:) !water table depth - real(r8), pointer :: fcov(:) !fractional impermeable area - real(r8), pointer :: fsat(:) !fractional area with water table at surface - real(r8), pointer :: qcharge(:) !aquifer recharge rate (mm/s) - real(r8), pointer :: qflx_top_soil(:) ! net water input into soil from top (mm/s) - real(r8), pointer :: qflx_prec_grnd(:) ! water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_prec_grnd_col(:) ! water onto ground including canopy runoff [kg/(m2 s)] -! -! local pointers to implicit out multi-level arrays -! - real(r8), pointer :: rootr_column(:,:) !effective fraction of roots in each soil layer - real(r8), pointer :: h2osoi_vol(:,:) !volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) - real(r8), pointer :: qflx_snofrz_col(:)!column-integrated snow freezing rate (kg m-2 s-1) [+] -! -! -! !OTHER LOCAL VARIABLES: -!EOP - real(r8), parameter :: snow_bd = 250._r8 !constant snow bulk density - integer :: fp, p, c, g ! indices - real(r8) :: dtime ! land model time step (sec) -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type gridcell members - - forc_snow => clm_a2l%forc_snow - forc_rain => clm_a2l%forc_rain - - ! Assign local pointers to derived type column members - -!rtm_flood: add flooding terms - qflx_floodg => clm_a2l%forc_flood - qflx_floodc => cwf%qflx_floodc -!rtm_flood - begwb => cwbal%begwb - endwb => cwbal%endwb - do_capsnow => cps%do_capsnow - snowdp => cps%snowdp - t_grnd => ces%t_grnd - h2osno => cws%h2osno - snowice => cws%snowice - snowliq => cws%snowliq - eflx_snomelt => cef%eflx_snomelt - qmelt => cwf%qmelt - qflx_snomelt => cwf%qflx_snomelt - qflx_surf => cwf%qflx_surf - qflx_qrgwl => cwf%qflx_qrgwl - qflx_runoff => cwf%qflx_runoff - qflx_snwcp_ice_col => pwf_a%qflx_snwcp_ice - qflx_drain => cwf%qflx_drain - qflx_irrig => cwf%qflx_irrig - qflx_infl => cwf%qflx_infl - rootr_column => cps%rootr_column - h2osoi_vol => cws%h2osoi_vol - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - qflx_evap_tot_col => pwf_a%qflx_evap_tot - soilalpha => cws%soilalpha - zwt => cws%zwt - fcov => cws%fcov - fsat => cws%fsat - qcharge => cws%qcharge - qflx_snofrz_col => cwf%qflx_snofrz_col - qflx_top_soil => cwf%qflx_top_soil - qflx_prec_grnd_col => pwf_a%qflx_prec_grnd - qflx_evap_grnd_col => pwf_a%qflx_evap_grnd - qflx_dew_grnd_col => pwf_a%qflx_dew_grnd - qflx_dew_snow_col => pwf_a%qflx_dew_snow - qflx_sub_snow_col => pwf_a%qflx_sub_snow - qflx_rain_grnd_col => pwf_a%qflx_rain_grnd - qflx_snow_grnd_col => pwf_a%qflx_snow_grnd - - ! Assign local pointers to derived type pft members - - pcolumn => pft%column - pgridcell => pft%gridcell - qflx_evap_soi => pwf%qflx_evap_soi - qflx_evap_tot => pwf%qflx_evap_tot - qflx_evap_grnd => pwf%qflx_evap_grnd - qflx_sub_snow => pwf%qflx_sub_snow - qflx_dew_snow => pwf%qflx_dew_snow - qflx_dew_grnd => pwf%qflx_dew_grnd - qflx_rain_grnd => pwf%qflx_rain_grnd - qflx_snow_grnd => pwf%qflx_snow_grnd - qflx_prec_grnd => pwf%qflx_prec_grnd - qflx_snwcp_ice => pwf%qflx_snwcp_ice - - ! Determine step size - - dtime = get_step_size() - - do fp = 1, num_lakep - p = filter_lakep(fp) - c = pcolumn(p) - g = pgridcell(p) - - ! Snow on the lake ice - - qflx_evap_grnd(p) = 0._r8 - qflx_sub_snow(p) = 0._r8 - qflx_dew_snow(p) = 0._r8 - qflx_dew_grnd(p) = 0._r8 - - if (qflx_evap_soi(p) >= 0._r8) then - - ! Sublimation: do not allow for more sublimation than there is snow - ! after melt. Remaining surface evaporation used for infiltration. - - qflx_sub_snow(p) = min(qflx_evap_soi(p), h2osno(c)/dtime-qmelt(c)) - ! Liquid water evaporation from snow or "ground" is implicitly treated as a term in qrgwl - qflx_evap_grnd(p) = 0._r8 - - else - - if (t_grnd(c) < tfrz-0.1_r8) then - qflx_dew_snow(p) = abs(qflx_evap_soi(p)) - else - ! Liquid dew on snow or "ground" is implicitly treated as a term in qrgwl - qflx_dew_grnd(p) = 0._r8 - end if - - end if - - ! Update snow pack - - ! WJS (8-26-11): For consistency with non-lake columns, I am setting the values of - ! qflx_rain_grnd and qflx_snow_grnd dependent on do_capsnow. For qflx_snow_grnd, - ! this makes sense: as with non-lake columns, this gives the amount of snowfall - ! that is added to the snowpack as opposed to running off due to snow capping. For - ! qflx_rain_grnd, the definition over lakes is less well defined, since (I believe) - ! all rain runs off over lakes (and qflx_snwcp_liq is always 0 over - ! lakes). Nevertheless, I am trying to be consistent with the definition of - ! qflx_rain_grnd elsewhere, which is: the amount of rainfall reaching the ground, - ! but 0 if there is snow capping. - - if (do_capsnow(c)) then - qflx_rain_grnd(p) = 0._r8 - qflx_snow_grnd(p) = 0._r8 - h2osno(c) = h2osno(c) - (qmelt(c) + qflx_sub_snow(p))*dtime - qflx_snwcp_ice(p) = forc_snow(g) + qflx_dew_snow(p) - else - qflx_rain_grnd(p) = forc_rain(g) - qflx_snow_grnd(p) = forc_snow(g) - h2osno(c) = h2osno(c) + (forc_snow(g)-qmelt(c)-qflx_sub_snow(p)+qflx_dew_snow(p))*dtime - qflx_snwcp_ice(p) = 0._r8 - end if - h2osno(c) = max(h2osno(c), 0._r8) - - ! No snow if lake unfrozen - - if (t_grnd(c) > tfrz) h2osno(c) = 0._r8 - - ! Snow depth - - snowdp(c) = h2osno(c)/snow_bd !Assume a constant snow bulk density = 250. - - ! Determine ending water balance - - endwb(c) = h2osno(c) - - ! The following are needed for global average on history tape. - ! Note that components that are not displayed over lake on history tape - ! must be set to spval here - - eflx_snomelt(c) = qmelt(c)*hfus - qflx_infl(c) = 0._r8 - qflx_snomelt(c) = qmelt(c) - qflx_surf(c) = 0._r8 - qflx_drain(c) = 0._r8 - qflx_irrig(c) = 0._r8 - rootr_column(c,:) = spval - snowice(c) = spval - snowliq(c) = spval - soilalpha(c) = spval - zwt(c) = spval - fcov(c) = spval - fsat(c) = spval - qcharge(c) = spval - h2osoi_vol(c,:) = spval - h2osoi_ice(c,:) = spval - h2osoi_liq(c,:) = spval - qflx_snofrz_col(c) = spval - qflx_qrgwl(c) = forc_rain(g) + forc_snow(g) + qflx_floodg(g) - qflx_evap_tot(p) - qflx_snwcp_ice(p) - & - (endwb(c)-begwb(c))/dtime - qflx_floodc(c) = qflx_floodg(g) - qflx_runoff(c) = qflx_drain(c) + qflx_surf(c) + qflx_qrgwl(c) - qflx_top_soil(c) = forc_rain(g) + qflx_snomelt(c) - qflx_prec_grnd(p) = forc_rain(g) + forc_snow(g) - - ! pft averages must be done here for output to history tape and other uses - ! (note that pft2col is called before HydrologyLake, so we can't use that routine - ! to do these column -> pft averages) - - qflx_evap_tot_col(c) = qflx_evap_tot(p) - qflx_prec_grnd_col(c) = qflx_prec_grnd(p) - qflx_evap_grnd_col(c) = qflx_evap_grnd(p) - qflx_dew_grnd_col(c) = qflx_dew_grnd(p) - qflx_dew_snow_col(c) = qflx_dew_snow(p) - qflx_sub_snow_col(c) = qflx_sub_snow(p) - qflx_rain_grnd_col(c) = qflx_rain_grnd(p) - qflx_snow_grnd_col(c) = qflx_snow_grnd(p) - qflx_snwcp_ice_col(c) = qflx_snwcp_ice(p) - - end do - - end subroutine HydrologyLake - -end module HydrologyLakeMod diff --git a/src_clm40/biogeophys/QSatMod.F90 b/src_clm40/biogeophys/QSatMod.F90 deleted file mode 100644 index 8a9fa0829b..0000000000 --- a/src_clm40/biogeophys/QSatMod.F90 +++ /dev/null @@ -1,149 +0,0 @@ - -module QSatMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: QSatMod -! -! !DESCRIPTION: -! Computes saturation mixing ratio and the change in saturation -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: QSat -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: QSat -! -! !INTERFACE: - subroutine QSat (T, p, es, esdT, qs, qsdT) -! -! !DESCRIPTION: -! Computes saturation mixing ratio and the change in saturation -! mixing ratio with respect to temperature. -! Reference: Polynomial approximations from: -! Piotr J. Flatau, et al.,1992: Polynomial fits to saturation -! vapor pressure. Journal of Applied Meteorology, 31, 1507-1513. -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_TKFRZ -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: T ! temperature (K) - real(r8), intent(in) :: p ! surface atmospheric pressure (pa) - real(r8), intent(out) :: es ! vapor pressure (pa) - real(r8), intent(out) :: esdT ! d(es)/d(T) - real(r8), intent(out) :: qs ! humidity (kg/kg) - real(r8), intent(out) :: qsdT ! d(qs)/d(T) -! -! !CALLED FROM: -! subroutine Biogeophysics1 in module Biogeophysics1Mod -! subroutine BiogeophysicsLake in module BiogeophysicsLakeMod -! subroutine CanopyFluxesMod CanopyFluxesMod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: T_limit - real(r8) :: td,vp,vp1,vp2 -! -! For water vapor (temperature range 0C-100C) -! - real(r8), parameter :: a0 = 6.11213476_r8 - real(r8), parameter :: a1 = 0.444007856_r8 - real(r8), parameter :: a2 = 0.143064234e-01_r8 - real(r8), parameter :: a3 = 0.264461437e-03_r8 - real(r8), parameter :: a4 = 0.305903558e-05_r8 - real(r8), parameter :: a5 = 0.196237241e-07_r8 - real(r8), parameter :: a6 = 0.892344772e-10_r8 - real(r8), parameter :: a7 = -0.373208410e-12_r8 - real(r8), parameter :: a8 = 0.209339997e-15_r8 -! -! For derivative:water vapor -! - real(r8), parameter :: b0 = 0.444017302_r8 - real(r8), parameter :: b1 = 0.286064092e-01_r8 - real(r8), parameter :: b2 = 0.794683137e-03_r8 - real(r8), parameter :: b3 = 0.121211669e-04_r8 - real(r8), parameter :: b4 = 0.103354611e-06_r8 - real(r8), parameter :: b5 = 0.404125005e-09_r8 - real(r8), parameter :: b6 = -0.788037859e-12_r8 - real(r8), parameter :: b7 = -0.114596802e-13_r8 - real(r8), parameter :: b8 = 0.381294516e-16_r8 -! -! For ice (temperature range -75C-0C) -! - real(r8), parameter :: c0 = 6.11123516_r8 - real(r8), parameter :: c1 = 0.503109514_r8 - real(r8), parameter :: c2 = 0.188369801e-01_r8 - real(r8), parameter :: c3 = 0.420547422e-03_r8 - real(r8), parameter :: c4 = 0.614396778e-05_r8 - real(r8), parameter :: c5 = 0.602780717e-07_r8 - real(r8), parameter :: c6 = 0.387940929e-09_r8 - real(r8), parameter :: c7 = 0.149436277e-11_r8 - real(r8), parameter :: c8 = 0.262655803e-14_r8 -! -! For derivative:ice -! - real(r8), parameter :: d0 = 0.503277922_r8 - real(r8), parameter :: d1 = 0.377289173e-01_r8 - real(r8), parameter :: d2 = 0.126801703e-02_r8 - real(r8), parameter :: d3 = 0.249468427e-04_r8 - real(r8), parameter :: d4 = 0.313703411e-06_r8 - real(r8), parameter :: d5 = 0.257180651e-08_r8 - real(r8), parameter :: d6 = 0.133268878e-10_r8 - real(r8), parameter :: d7 = 0.394116744e-13_r8 - real(r8), parameter :: d8 = 0.498070196e-16_r8 -!----------------------------------------------------------------------- - - T_limit = T - SHR_CONST_TKFRZ - if (T_limit > 100.0_r8) T_limit=100.0_r8 - if (T_limit < -75.0_r8) T_limit=-75.0_r8 - - td = T_limit - if (td >= 0.0_r8) then - es = a0 + td*(a1 + td*(a2 + td*(a3 + td*(a4 & - + td*(a5 + td*(a6 + td*(a7 + td*a8))))))) - esdT = b0 + td*(b1 + td*(b2 + td*(b3 + td*(b4 & - + td*(b5 + td*(b6 + td*(b7 + td*b8))))))) - else - es = c0 + td*(c1 + td*(c2 + td*(c3 + td*(c4 & - + td*(c5 + td*(c6 + td*(c7 + td*c8))))))) - esdT = d0 + td*(d1 + td*(d2 + td*(d3 + td*(d4 & - + td*(d5 + td*(d6 + td*(d7 + td*d8))))))) - endif - - es = es * 100._r8 ! pa - esdT = esdT * 100._r8 ! pa/K - - vp = 1.0_r8 / (p - 0.378_r8*es) - vp1 = 0.622_r8 * vp - vp2 = vp1 * vp - - qs = es * vp1 ! kg/kg - qsdT = esdT * vp2 * p ! 1 / K - - end subroutine QSat - -end module QSatMod diff --git a/src_clm40/biogeophys/SNICARMod.F90 b/src_clm40/biogeophys/SNICARMod.F90 deleted file mode 100644 index 3febfe7160..0000000000 --- a/src_clm40/biogeophys/SNICARMod.F90 +++ /dev/null @@ -1,1494 +0,0 @@ -module SNICARMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: SNICARMod -! -! !DESCRIPTION: -! Calculate albedo of snow containing impurities -! and the evolution of snow effective radius -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use clm_varctl , only : iulog - use shr_const_mod , only : SHR_CONST_RHOICE - use abortutils , only : endrun - - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: SNICAR_RT ! Snow albedo and vertically-resolved solar absorption - public :: SnowAge_grain ! Snow effective grain size evolution - public :: SnowAge_init ! Initial read in of snow-aging file - public :: SnowOptics_init ! Initial read in of snow-optics file -! -! !PUBLIC DATA MEMBERS: - - real(r8), public, parameter :: snw_rds_min = 54.526_r8 ! minimum allowed snow effective radius - ! (also "fresh snow" value) [microns] - integer, public, parameter :: sno_nbr_aer = 8 ! number of aerosol species in snowpack - ! (indices described above) [nbr] - logical, public, parameter :: DO_SNO_OC = .false. ! parameter to include organic carbon (OC) - ! in snowpack radiative calculations - logical, public, parameter :: DO_SNO_AER = .true. ! parameter to include aerosols in snowpack radiative calculations - - real(r8), public, parameter :: scvng_fct_mlt_bcphi = 0.20_r8 ! scavenging factor for hydrophillic BC inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_bcpho = 0.03_r8 ! scavenging factor for hydrophobic BC inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_ocphi = 0.20_r8 ! scavenging factor for hydrophillic OC inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_ocpho = 0.03_r8 ! scavenging factor for hydrophobic OC inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst1 = 0.02_r8 ! scavenging factor for dust species 1 inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst2 = 0.02_r8 ! scavenging factor for dust species 2 inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst3 = 0.01_r8 ! scavenging factor for dust species 3 inclusion in meltwater - ! [frc] - real(r8), public, parameter :: scvng_fct_mlt_dst4 = 0.01_r8 ! scavenging factor for dust species 4 inclusion in meltwater - ! [frc] - -! !PRIVATE MEMBER FUNCTIONS: - -! -! !PRIVATE DATA MEMBERS: - ! Aerosol species indices: - ! 1= hydrophillic black carbon - ! 2= hydrophobic black carbon - ! 3= hydrophilic organic carbon - ! 4= hydrophobic organic carbon - ! 5= dust species 1 - ! 6= dust species 2 - ! 7= dust species 3 - ! 8= dust species 4 - integer, parameter :: numrad_snw = 5 ! number of spectral bands used in snow model [nbr] - integer, parameter :: nir_bnd_bgn = 2 ! first band index in near-IR spectrum [idx] - integer, parameter :: nir_bnd_end = 5 ! ending near-IR band index [idx] - - integer, parameter :: idx_Mie_snw_mx = 1471 ! number of effective radius indices used in Mie lookup table [idx] - integer, parameter :: idx_T_max = 11 ! maxiumum temperature index used in aging lookup table [idx] - integer, parameter :: idx_T_min = 1 ! minimum temperature index used in aging lookup table [idx] - integer, parameter :: idx_Tgrd_max = 31 ! maxiumum temperature gradient index used in aging lookup table [idx] - integer, parameter :: idx_Tgrd_min = 1 ! minimum temperature gradient index used in aging lookup table [idx] - integer, parameter :: idx_rhos_max = 8 ! maxiumum snow density index used in aging lookup table [idx] - integer, parameter :: idx_rhos_min = 1 ! minimum snow density index used in aging lookup table [idx] - - integer, parameter :: snw_rds_max_tbl = 1500 ! maximum effective radius defined in Mie lookup table [microns] - integer, parameter :: snw_rds_min_tbl = 30 ! minimium effective radius defined in Mie lookup table [microns] - real(r8), parameter :: snw_rds_max = 1500._r8 ! maximum allowed snow effective radius [microns] - real(r8), parameter :: snw_rds_refrz = 1000._r8 ! effective radius of re-frozen snow [microns] - - real(r8), parameter :: min_snw = 1.0E-30_r8 ! minimum snow mass required for SNICAR RT calculation [kg m-2] - - !real(r8), parameter :: C1_liq_Brun89 = 1.28E-17_r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89 - real(r8), parameter :: C1_liq_Brun89 = 0._r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89: zeroed to accomodate dry snow aging - real(r8), parameter :: C2_liq_Brun89 = 4.22E-13_r8 ! constant for liquid water grain growth [m3 s-1], - ! from Brun89: corrected for LWC in units of percent - - real(r8), parameter :: tim_cns_bc_rmv = 2.2E-8_r8 ! time constant for removal of BC in snow on sea-ice - ! [s-1] (50% mass removal/year) - real(r8), parameter :: tim_cns_oc_rmv = 2.2E-8_r8 ! time constant for removal of OC in snow on sea-ice - ! [s-1] (50% mass removal/year) - real(r8), parameter :: tim_cns_dst_rmv = 2.2E-8_r8 ! time constant for removal of dust in snow on sea-ice - ! [s-1] (50% mass removal/year) - - ! scaling of the snow aging rate (tuning option): - logical :: flg_snoage_scl = .false. ! flag for scaling the snow aging rate by some arbitrary factor - real(r8), parameter :: xdrdt = 1.0_r8 ! arbitrary factor applied to snow aging rate - - ! snow and aerosol Mie parameters: - ! (arrays declared here, but are set in iniTimeConst) - ! (idx_Mie_snw_mx is number of snow radii with defined parameters (i.e. from 30um to 1500um)) - - ! direct-beam weighted ice optical properties - real(r8) :: ss_alb_snw_drc(idx_Mie_snw_mx,numrad_snw) - real(r8) :: asm_prm_snw_drc(idx_Mie_snw_mx,numrad_snw) - real(r8) :: ext_cff_mss_snw_drc(idx_Mie_snw_mx,numrad_snw) - - ! diffuse radiation weighted ice optical properties - real(r8) :: ss_alb_snw_dfs(idx_Mie_snw_mx,numrad_snw) - real(r8) :: asm_prm_snw_dfs(idx_Mie_snw_mx,numrad_snw) - real(r8) :: ext_cff_mss_snw_dfs(idx_Mie_snw_mx,numrad_snw) - - ! hydrophiliic BC - real(r8) :: ss_alb_bc1(numrad_snw) - real(r8) :: asm_prm_bc1(numrad_snw) - real(r8) :: ext_cff_mss_bc1(numrad_snw) - - ! hydrophobic BC - real(r8) :: ss_alb_bc2(numrad_snw) - real(r8) :: asm_prm_bc2(numrad_snw) - real(r8) :: ext_cff_mss_bc2(numrad_snw) - - ! hydrophobic OC - real(r8) :: ss_alb_oc1(numrad_snw) - real(r8) :: asm_prm_oc1(numrad_snw) - real(r8) :: ext_cff_mss_oc1(numrad_snw) - - ! hydrophilic OC - real(r8) :: ss_alb_oc2(numrad_snw) - real(r8) :: asm_prm_oc2(numrad_snw) - real(r8) :: ext_cff_mss_oc2(numrad_snw) - - ! dust species 1: - real(r8) :: ss_alb_dst1(numrad_snw) - real(r8) :: asm_prm_dst1(numrad_snw) - real(r8) :: ext_cff_mss_dst1(numrad_snw) - - ! dust species 2: - real(r8) :: ss_alb_dst2(numrad_snw) - real(r8) :: asm_prm_dst2(numrad_snw) - real(r8) :: ext_cff_mss_dst2(numrad_snw) - - ! dust species 3: - real(r8) :: ss_alb_dst3(numrad_snw) - real(r8) :: asm_prm_dst3(numrad_snw) - real(r8) :: ext_cff_mss_dst3(numrad_snw) - - ! dust species 4: - real(r8) :: ss_alb_dst4(numrad_snw) - real(r8) :: asm_prm_dst4(numrad_snw) - real(r8) :: ext_cff_mss_dst4(numrad_snw) - - ! best-fit parameters for snow aging defined over: - ! 11 temperatures from 225 to 273 K - ! 31 temperature gradients from 0 to 300 K/m - ! 8 snow densities from 0 to 350 kg/m3 - ! (arrays declared here, but are set in iniTimeConst) - real(r8), pointer :: snowage_tau(:,:,:) ! (idx_rhos_max,idx_Tgrd_max,idx_T_max) - real(r8), pointer :: snowage_kappa(:,:,:) ! (idx_rhos_max,idx_Tgrd_max,idx_T_max) - real(r8), pointer :: snowage_drdt0(:,:,:) ! idx_rhos_max,idx_Tgrd_max,idx_T_max) - -! -! !REVISION HISTORY: -! Created by Mark Flanner -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SNICAR_RT -! -! -! !CALLED FROM: -! subroutine SurfaceAlbedo in module SurfaceAlbedoMod (CLM) -! subroutine albice (CSIM) -! -! !REVISION HISTORY: -! Author: Mark Flanner -! -! !INTERFACE: - - subroutine SNICAR_RT (flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen, flg_slr_in, h2osno_liq, h2osno_ice, snw_rds, & - mss_cnc_aer_in, albsfc, albout, flx_abs) - - ! - ! !DESCRIPTION: - ! Determine reflectance of, and vertically-resolved solar absorption in, - ! snow with impurities. - ! - ! Original references on physical models of snow reflectance include: - ! Wiscombe and Warren [1980] and Warren and Wiscombe [1980], - ! Journal of Atmospheric Sciences, 37, - ! - ! The multi-layer solution for multiple-scattering used here is from: - ! Toon et al. [1989], Rapid calculation of radiative heating rates - ! and photodissociation rates in inhomogeneous multiple scattering atmospheres, - ! J. Geophys. Res., 94, D13, 16287-16301 - ! - ! The implementation of the SNICAR model in CLM/CSIM is described in: - ! Flanner, M., C. Zender, J. Randerson, and P. Rasch [2007], - ! Present-day climate forcing and response from black carbon in snow, - ! J. Geophys. Res., 112, D11202, doi: 10.1029/2006JD008003 - - - ! !USES: - use clmtype - use clm_varpar , only : nlevsno, numrad - use clm_time_manager , only : get_nstep - use shr_const_mod , only : SHR_CONST_PI - - - ! - ! !ARGUMENTS: - implicit none - integer , intent(in) :: flg_snw_ice ! flag: =1 when called from CLM, =2 when called from CSIM - integer , intent(in) :: lbc, ubc ! column index bounds [unitless] - integer , intent(in) :: num_nourbanc ! number of columns in non-urban filter - integer , intent(in) :: filter_nourbanc(ubc-lbc+1) ! column filter for non-urban points - real(r8), intent(in) :: coszen(lbc:ubc) ! cosine of solar zenith angle for next time step - ! (col) [unitless] - integer , intent(in) :: flg_slr_in ! flag: =1 for direct-beam incident flux, - ! =2 for diffuse incident flux - real(r8), intent(in) :: h2osno_liq(lbc:ubc,-nlevsno+1:0) ! liquid water content (col,lyr) [kg/m2] - real(r8), intent(in) :: h2osno_ice(lbc:ubc,-nlevsno+1:0) ! ice content (col,lyr) [kg/m2] - integer, intent(in) :: snw_rds(lbc:ubc,-nlevsno+1:0) ! snow effective radius (col,lyr) [microns, m^-6] - real(r8), intent(in) :: mss_cnc_aer_in(lbc:ubc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of all aerosol species - ! (col,lyr,aer) [kg/kg] - real(r8), intent(in) :: albsfc(lbc:ubc,numrad) ! albedo of surface underlying snow - ! (col,bnd) [frc] - real(r8), intent(out) :: albout(lbc:ubc,numrad) ! snow albedo, averaged into 2 bands - ! (=0 if no sun or no snow) (col,bnd) [frc] - real(r8), intent(out) :: flx_abs(lbc:ubc,-nlevsno+1:1,numrad) ! absorbed flux in each layer per unit flux incident - ! on top of snowpack (col,lyr,bnd) [frc] - - ! - ! !LOCAL VARIABLES: - ! - ! local pointers to implicit in arguments - ! - integer, pointer :: snl(:) ! negative number of snow layers (col) [nbr] - real(r8), pointer :: h2osno(:) ! snow liquid water equivalent (col) [kg/m2] - integer, pointer :: clandunit(:) ! corresponding landunit of column (col) [idx] (debugging only) - integer, pointer :: cgridcell(:) ! columns's gridcell index (col) [idx] (debugging only) - integer, pointer :: ltype(:) ! landunit type (lnd) (debugging only) - real(r8), pointer :: londeg(:) ! longitude (degrees) (debugging only) - real(r8), pointer :: latdeg(:) ! latitude (degrees) (debugging only) -! -! !OTHER LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - ! - ! variables for snow radiative transfer calculations - - ! Local variables representing single-column values of arrays: - integer :: snl_lcl ! negative number of snow layers [nbr] - integer :: snw_rds_lcl(-nlevsno+1:0) ! snow effective radius [m^-6] - real(r8):: flx_slrd_lcl(1:numrad_snw) ! direct beam incident irradiance [W/m2] (set to 1) - real(r8):: flx_slri_lcl(1:numrad_snw) ! diffuse incident irradiance [W/m2] (set to 1) - real(r8):: mss_cnc_aer_lcl(-nlevsno+1:0,1:sno_nbr_aer) ! aerosol mass concentration (lyr,aer_nbr) [kg/kg] - real(r8):: h2osno_lcl ! total column snow mass [kg/m2] - real(r8):: h2osno_liq_lcl(-nlevsno+1:0) ! liquid water mass [kg/m2] - real(r8):: h2osno_ice_lcl(-nlevsno+1:0) ! ice mass [kg/m2] - real(r8):: albsfc_lcl(1:numrad_snw) ! albedo of underlying surface [frc] - real(r8):: ss_alb_snw_lcl(-nlevsno+1:0) ! single-scatter albedo of ice grains (lyr) [frc] - real(r8):: asm_prm_snw_lcl(-nlevsno+1:0) ! asymmetry parameter of ice grains (lyr) [frc] - real(r8):: ext_cff_mss_snw_lcl(-nlevsno+1:0) ! mass extinction coefficient of ice grains (lyr) [m2/kg] - real(r8):: ss_alb_aer_lcl(sno_nbr_aer) ! single-scatter albedo of aerosol species (aer_nbr) [frc] - real(r8):: asm_prm_aer_lcl(sno_nbr_aer) ! asymmetry parameter of aerosol species (aer_nbr) [frc] - real(r8):: ext_cff_mss_aer_lcl(sno_nbr_aer) ! mass extinction coefficient of aerosol species (aer_nbr) [m2/kg] - - - ! Other local variables - integer :: APRX_TYP ! two-stream approximation type - ! (1=Eddington, 2=Quadrature, 3=Hemispheric Mean) [nbr] - integer :: DELTA ! flag to use Delta approximation (Joseph, 1976) - ! (1= use, 0= don't use) - real(r8):: flx_wgt(1:numrad_snw) ! weights applied to spectral bands, - ! specific to direct and diffuse cases (bnd) [frc] - - integer :: flg_nosnl ! flag: =1 if there is snow, but zero snow layers, - ! =0 if at least 1 snow layer [flg] - integer :: trip ! flag: =1 to redo RT calculation if result is unrealistic - integer :: flg_dover ! defines conditions for RT redo (explained below) - - real(r8):: albedo ! temporary snow albedo [frc] - real(r8):: flx_sum ! temporary summation variable for NIR weighting - real(r8):: albout_lcl(numrad_snw) ! snow albedo by band [frc] - real(r8):: flx_abs_lcl(-nlevsno+1:1,numrad_snw)! absorbed flux per unit incident flux at top of snowpack (lyr,bnd) [frc] - - real(r8):: L_snw(-nlevsno+1:0) ! h2o mass (liquid+solid) in snow layer (lyr) [kg/m2] - real(r8):: tau_snw(-nlevsno+1:0) ! snow optical depth (lyr) [unitless] - real(r8):: L_aer(-nlevsno+1:0,sno_nbr_aer) ! aerosol mass in snow layer (lyr,nbr_aer) [kg/m2] - real(r8):: tau_aer(-nlevsno+1:0,sno_nbr_aer) ! aerosol optical depth (lyr,nbr_aer) [unitless] - real(r8):: tau_sum ! cumulative (snow+aerosol) optical depth [unitless] - real(r8):: tau_clm(-nlevsno+1:0) ! column optical depth from layer bottom to snowpack top (lyr) [unitless] - real(r8):: omega_sum ! temporary summation of single-scatter albedo of all aerosols [frc] - real(r8):: g_sum ! temporary summation of asymmetry parameter of all aerosols [frc] - - real(r8):: tau(-nlevsno+1:0) ! weighted optical depth of snow+aerosol layer (lyr) [unitless] - real(r8):: omega(-nlevsno+1:0) ! weighted single-scatter albedo of snow+aerosol layer (lyr) [frc] - real(r8):: g(-nlevsno+1:0) ! weighted asymmetry parameter of snow+aerosol layer (lyr) [frc] - real(r8):: tau_star(-nlevsno+1:0) ! transformed (i.e. Delta-Eddington) optical depth of snow+aerosol layer - ! (lyr) [unitless] - real(r8):: omega_star(-nlevsno+1:0) ! transformed (i.e. Delta-Eddington) SSA of snow+aerosol layer (lyr) [frc] - real(r8):: g_star(-nlevsno+1:0) ! transformed (i.e. Delta-Eddington) asymmetry paramater of snow+aerosol layer - ! (lyr) [frc] - - integer :: nstep ! current timestep [nbr] (debugging only) - integer :: g_idx, c_idx, l_idx ! gridcell, column, and landunit indices [idx] - integer :: bnd_idx ! spectral band index (1 <= bnd_idx <= numrad_snw) [idx] - integer :: rds_idx ! snow effective radius index for retrieving - ! Mie parameters from lookup table [idx] - integer :: snl_btm ! index of bottom snow layer (0) [idx] - integer :: snl_top ! index of top snow layer (-4 to 0) [idx] - integer :: fc ! column filter index - integer :: i ! layer index [idx] - integer :: j ! aerosol number index [idx] - integer :: n ! tridiagonal matrix index [idx] - integer :: m ! secondary layer index [idx] - - real(r8):: F_direct(-nlevsno+1:0) ! direct-beam radiation at bottom of layer interface (lyr) [W/m^2] - real(r8):: F_net(-nlevsno+1:0) ! net radiative flux at bottom of layer interface (lyr) [W/m^2] - real(r8):: F_abs(-nlevsno+1:0) ! net absorbed radiative energy (lyr) [W/m^2] - real(r8):: F_abs_sum ! total absorbed energy in column [W/m^2] - real(r8):: F_sfc_pls ! upward radiative flux at snowpack top [W/m^2] - real(r8):: F_btm_net ! net flux at bottom of snowpack [W/m^2] - real(r8):: F_sfc_net ! net flux at top of snowpack [W/m^2] - real(r8):: energy_sum ! sum of all energy terms; should be 0.0 [W/m^2] - real(r8):: F_direct_btm ! direct-beam radiation at bottom of snowpack [W/m^2] - real(r8):: mu_not ! cosine of solar zenith angle (used locally) [frc] - - integer :: err_idx ! counter for number of times through error loop [nbr] - real(r8):: lat_coord ! gridcell latitude (debugging only) - real(r8):: lon_coord ! gridcell longitude (debugging only) - integer :: sfctype ! underlying surface type (debugging only) - real(r8):: pi ! 3.1415... - - - ! intermediate variables for radiative transfer approximation: - real(r8):: gamma1(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: gamma2(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: gamma3(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: gamma4(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: lambda(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: GAMMA(-nlevsno+1:0) ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: mu_one ! two-stream coefficient from Toon et al. (lyr) [unitless] - real(r8):: e1(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: e2(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: e3(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: e4(-nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (lyr) - real(r8):: C_pls_btm(-nlevsno+1:0) ! intermediate variable: upward flux at bottom interface (lyr) [W/m2] - real(r8):: C_mns_btm(-nlevsno+1:0) ! intermediate variable: downward flux at bottom interface (lyr) [W/m2] - real(r8):: C_pls_top(-nlevsno+1:0) ! intermediate variable: upward flux at top interface (lyr) [W/m2] - real(r8):: C_mns_top(-nlevsno+1:0) ! intermediate variable: downward flux at top interface (lyr) [W/m2] - real(r8):: A(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: B(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: D(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: E(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: AS(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: DS(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: X(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - real(r8):: Y(-2*nlevsno+1:0) ! tri-diag intermediate variable from Toon et al. (2*lyr) - - - ! Assign local pointers to derived subtypes components (column-level) - ! (CLM-specific) - if (flg_snw_ice == 1) then - snl => cps%snl - h2osno => cws%h2osno - clandunit => col%landunit ! (debug only) - cgridcell => col%gridcell ! (debug only) - ltype => lun%itype ! (debug only) - londeg => grc%londeg ! (debug only) - latdeg => grc%latdeg ! (debug only) - endif - - - ! Define constants - pi = SHR_CONST_PI - - ! always use Delta approximation for snow - DELTA = 1 - - ! Get current timestep - nstep = get_nstep() - - ! Loop over all non-urban columns - ! (when called from CSIM, there is only one column) - do fc = 1,num_nourbanc - c_idx = filter_nourbanc(fc) - - - ! Zero absorbed radiative fluxes: - do i=-nlevsno+1,1,1 - flx_abs_lcl(:,:) = 0._r8 - flx_abs(c_idx,i,:) = 0._r8 - enddo - - ! set snow/ice mass to be used for RT: - if (flg_snw_ice == 1) then - h2osno_lcl = h2osno(c_idx) - else - h2osno_lcl = h2osno_ice(c_idx,0) - endif - - - ! Qualifier for computing snow RT: - ! 1) sunlight from atmosphere model - ! 2) minimum amount of snow on ground. - ! Otherwise, set snow albedo to zero - if ((coszen(c_idx) > 0._r8) .and. (h2osno_lcl > min_snw)) then - - ! Set variables specific to CLM - if (flg_snw_ice == 1) then - ! Assign local (single-column) variables to global values - ! If there is snow, but zero snow layers, we must create a layer locally. - ! This layer is presumed to have the fresh snow effective radius. - if (snl(c_idx) > -1) then - flg_nosnl = 1 - snl_lcl = -1 - h2osno_ice_lcl(0) = h2osno_lcl - h2osno_liq_lcl(0) = 0._r8 - snw_rds_lcl(0) = nint(snw_rds_min) - else - flg_nosnl = 0 - snl_lcl = snl(c_idx) - h2osno_liq_lcl(:) = h2osno_liq(c_idx,:) - h2osno_ice_lcl(:) = h2osno_ice(c_idx,:) - snw_rds_lcl(:) = snw_rds(c_idx,:) - endif - - snl_btm = 0 - snl_top = snl_lcl+1 - - ! for debugging only - l_idx = clandunit(c_idx) - g_idx = cgridcell(c_idx) - sfctype = ltype(l_idx) - lat_coord = latdeg(g_idx) - lon_coord = londeg(g_idx) - - - ! Set variables specific to CSIM - else - flg_nosnl = 0 - snl_lcl = -1 - h2osno_liq_lcl(:) = h2osno_liq(c_idx,:) - h2osno_ice_lcl(:) = h2osno_ice(c_idx,:) - snw_rds_lcl(:) = snw_rds(c_idx,:) - snl_btm = 0 - snl_top = 0 - sfctype = -1 - lat_coord = -90 - lon_coord = 0 - endif - - ! Set local aerosol array - do j=1,sno_nbr_aer - mss_cnc_aer_lcl(:,j) = mss_cnc_aer_in(c_idx,:,j) - enddo - - - ! Set spectral underlying surface albedos to their corresponding VIS or NIR albedos - albsfc_lcl(1) = albsfc(c_idx,1) - albsfc_lcl(nir_bnd_bgn:nir_bnd_end) = albsfc(c_idx,2) - - - ! Error check for snow grain size: - do i=snl_top,snl_btm,1 - if ((snw_rds_lcl(i) < snw_rds_min_tbl) .or. (snw_rds_lcl(i) > snw_rds_max_tbl)) then - write (iulog,*) "SNICAR ERROR: snow grain radius of ", snw_rds_lcl(i), " out of bounds." - write (iulog,*) "NSTEP= ", nstep - write (iulog,*) "flg_snw_ice= ", flg_snw_ice - write (iulog,*) "column: ", c_idx, " level: ", i, " snl(c)= ", snl_lcl - write (iulog,*) "lat= ", lat_coord, " lon= ", lon_coord - write (iulog,*) "h2osno(c)= ", h2osno_lcl - call endrun() - endif - enddo - - ! Incident flux weighting parameters - ! - sum of all VIS bands must equal 1 - ! - sum of all NIR bands must equal 1 - ! - ! Spectral bands (5-band case) - ! Band 1: 0.3-0.7um (VIS) - ! Band 2: 0.7-1.0um (NIR) - ! Band 3: 1.0-1.2um (NIR) - ! Band 4: 1.2-1.5um (NIR) - ! Band 5: 1.5-5.0um (NIR) - ! - ! The following weights are appropriate for surface-incident flux in a mid-latitude winter atmosphere - ! - ! 3-band weights - if (numrad_snw==3) then - ! Direct: - if (flg_slr_in == 1) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.66628670195247_r8 - flx_wgt(3) = 0.33371329804753_r8 - ! Diffuse: - elseif (flg_slr_in == 2) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.77887652162877_r8 - flx_wgt(3) = 0.22112347837123_r8 - endif - - ! 5-band weights - elseif(numrad_snw==5) then - ! Direct: - if (flg_slr_in == 1) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.49352158521175_r8 - flx_wgt(3) = 0.18099494230665_r8 - flx_wgt(4) = 0.12094898498813_r8 - flx_wgt(5) = 0.20453448749347_r8 - ! Diffuse: - elseif (flg_slr_in == 2) then - flx_wgt(1) = 1._r8 - flx_wgt(2) = 0.58581507618433_r8 - flx_wgt(3) = 0.20156903770812_r8 - flx_wgt(4) = 0.10917889346386_r8 - flx_wgt(5) = 0.10343699264369_r8 - endif - endif - - ! Loop over snow spectral bands - do bnd_idx = 1,numrad_snw - - mu_not = coszen(c_idx) ! must set here, because of error handling - flg_dover = 1 ! default is to redo - err_idx = 0 ! number of times through loop - - do while (flg_dover > 0) - - ! DEFAULT APPROXIMATIONS: - ! VIS: Delta-Eddington - ! NIR (all): Delta-Hemispheric Mean - ! WARNING: DO NOT USE DELTA-EDDINGTON FOR NIR DIFFUSE - this sometimes results in negative albedo - ! - ! ERROR CONDITIONS: - ! Conditions which cause "trip", resulting in redo of RT approximation: - ! 1. negative absorbed flux - ! 2. total absorbed flux greater than incident flux - ! 3. negative albedo - ! NOTE: These errors have only been encountered in spectral bands 4 and 5 - ! - ! ERROR HANDLING - ! 1st error (flg_dover=2): switch approximation (Edd->HM or HM->Edd) - ! 2nd error (flg_dover=3): change zenith angle by 0.02 (this happens about 1 in 10^6 cases) - ! 3rd error (flg_dover=4): switch approximation with new zenith - ! Subsequent errors: repeatedly change zenith and approximations... - - if (bnd_idx == 1) then - if (flg_dover == 2) then - APRX_TYP = 3 - elseif (flg_dover == 3) then - APRX_TYP = 1 - if (coszen(c_idx) > 0.5_r8) then - mu_not = mu_not - 0.02_r8 - else - mu_not = mu_not + 0.02_r8 - endif - elseif (flg_dover == 4) then - APRX_TYP = 3 - else - APRX_TYP = 1 - endif - - else - if (flg_dover == 2) then - APRX_TYP = 1 - elseif (flg_dover == 3) then - APRX_TYP = 3 - if (coszen(c_idx) > 0.5_r8) then - mu_not = mu_not - 0.02_r8 - else - mu_not = mu_not + 0.02_r8 - endif - elseif (flg_dover == 4) then - APRX_TYP = 1 - else - APRX_TYP = 3 - endif - - endif - - ! Set direct or diffuse incident irradiance to 1 - ! (This has to be within the bnd loop because mu_not is adjusted in rare cases) - if (flg_slr_in == 1) then - flx_slrd_lcl(bnd_idx) = 1._r8/(mu_not*pi) ! this corresponds to incident irradiance of 1.0 - flx_slri_lcl(bnd_idx) = 0._r8 - else - flx_slrd_lcl(bnd_idx) = 0._r8 - flx_slri_lcl(bnd_idx) = 1._r8 - endif - - ! Pre-emptive error handling: aerosols can reap havoc on these absorptive bands. - ! Since extremely high soot concentrations have a negligible effect on these bands, zero them. - if ( (numrad_snw == 5).and.((bnd_idx == 5).or.(bnd_idx == 4)) ) then - mss_cnc_aer_lcl(:,:) = 0._r8 - endif - - if ( (numrad_snw == 3).and.(bnd_idx == 3) ) then - mss_cnc_aer_lcl(:,:) = 0._r8 - endif - - ! Define local Mie parameters based on snow grain size and aerosol species, - ! retrieved from a lookup table. - if (flg_slr_in == 1) then - do i=snl_top,snl_btm,1 - rds_idx = snw_rds_lcl(i) - snw_rds_min_tbl + 1 - ! snow optical properties (direct radiation) - ss_alb_snw_lcl(i) = ss_alb_snw_drc(rds_idx,bnd_idx) - asm_prm_snw_lcl(i) = asm_prm_snw_drc(rds_idx,bnd_idx) - ext_cff_mss_snw_lcl(i) = ext_cff_mss_snw_drc(rds_idx,bnd_idx) - enddo - elseif (flg_slr_in == 2) then - do i=snl_top,snl_btm,1 - rds_idx = snw_rds_lcl(i) - snw_rds_min_tbl + 1 - ! snow optical properties (diffuse radiation) - ss_alb_snw_lcl(i) = ss_alb_snw_dfs(rds_idx,bnd_idx) - asm_prm_snw_lcl(i) = asm_prm_snw_dfs(rds_idx,bnd_idx) - ext_cff_mss_snw_lcl(i) = ext_cff_mss_snw_dfs(rds_idx,bnd_idx) - enddo - endif - - ! aerosol species 1 optical properties - ss_alb_aer_lcl(1) = ss_alb_bc1(bnd_idx) - asm_prm_aer_lcl(1) = asm_prm_bc1(bnd_idx) - ext_cff_mss_aer_lcl(1) = ext_cff_mss_bc1(bnd_idx) - - ! aerosol species 2 optical properties - ss_alb_aer_lcl(2) = ss_alb_bc2(bnd_idx) - asm_prm_aer_lcl(2) = asm_prm_bc2(bnd_idx) - ext_cff_mss_aer_lcl(2) = ext_cff_mss_bc2(bnd_idx) - - ! aerosol species 3 optical properties - ss_alb_aer_lcl(3) = ss_alb_oc1(bnd_idx) - asm_prm_aer_lcl(3) = asm_prm_oc1(bnd_idx) - ext_cff_mss_aer_lcl(3) = ext_cff_mss_oc1(bnd_idx) - - ! aerosol species 4 optical properties - ss_alb_aer_lcl(4) = ss_alb_oc2(bnd_idx) - asm_prm_aer_lcl(4) = asm_prm_oc2(bnd_idx) - ext_cff_mss_aer_lcl(4) = ext_cff_mss_oc2(bnd_idx) - - ! aerosol species 5 optical properties - ss_alb_aer_lcl(5) = ss_alb_dst1(bnd_idx) - asm_prm_aer_lcl(5) = asm_prm_dst1(bnd_idx) - ext_cff_mss_aer_lcl(5) = ext_cff_mss_dst1(bnd_idx) - - ! aerosol species 6 optical properties - ss_alb_aer_lcl(6) = ss_alb_dst2(bnd_idx) - asm_prm_aer_lcl(6) = asm_prm_dst2(bnd_idx) - ext_cff_mss_aer_lcl(6) = ext_cff_mss_dst2(bnd_idx) - - ! aerosol species 7 optical properties - ss_alb_aer_lcl(7) = ss_alb_dst3(bnd_idx) - asm_prm_aer_lcl(7) = asm_prm_dst3(bnd_idx) - ext_cff_mss_aer_lcl(7) = ext_cff_mss_dst3(bnd_idx) - - ! aerosol species 8 optical properties - ss_alb_aer_lcl(8) = ss_alb_dst4(bnd_idx) - asm_prm_aer_lcl(8) = asm_prm_dst4(bnd_idx) - ext_cff_mss_aer_lcl(8) = ext_cff_mss_dst4(bnd_idx) - - - ! 1. snow and aerosol layer column mass (L_snw, L_aer [kg/m^2]) - ! 2. optical Depths (tau_snw, tau_aer) - ! 3. weighted Mie properties (tau, omega, g) - - ! Weighted Mie parameters of each layer - do i=snl_top,snl_btm,1 - L_snw(i) = h2osno_ice_lcl(i)+h2osno_liq_lcl(i) - tau_snw(i) = L_snw(i)*ext_cff_mss_snw_lcl(i) - - do j=1,sno_nbr_aer - L_aer(i,j) = L_snw(i)*mss_cnc_aer_lcl(i,j) - tau_aer(i,j) = L_aer(i,j)*ext_cff_mss_aer_lcl(j) - enddo - - tau_sum = 0._r8 - omega_sum = 0._r8 - g_sum = 0._r8 - - do j=1,sno_nbr_aer - tau_sum = tau_sum + tau_aer(i,j) - omega_sum = omega_sum + (tau_aer(i,j)*ss_alb_aer_lcl(j)) - g_sum = g_sum + (tau_aer(i,j)*ss_alb_aer_lcl(j)*asm_prm_aer_lcl(j)) - enddo - - tau(i) = tau_sum + tau_snw(i) - omega(i) = (1/tau(i))*(omega_sum+(ss_alb_snw_lcl(i)*tau_snw(i))) - g(i) = (1/(tau(i)*omega(i)))*(g_sum+ (asm_prm_snw_lcl(i)*ss_alb_snw_lcl(i)*tau_snw(i))) - enddo - - ! DELTA transformations, if requested - if (DELTA == 1) then - do i=snl_top,snl_btm,1 - g_star(i) = g(i)/(1+g(i)) - omega_star(i) = ((1-(g(i)**2))*omega(i)) / (1-(omega(i)*(g(i)**2))) - tau_star(i) = (1-(omega(i)*(g(i)**2)))*tau(i) - enddo - else - do i=snl_top,snl_btm,1 - g_star(i) = g(i) - omega_star(i) = omega(i) - tau_star(i) = tau(i) - enddo - endif - - ! Total column optical depth: - ! tau_clm(i) = total optical depth above the bottom of layer i - tau_clm(snl_top) = 0._r8 - do i=snl_top+1,snl_btm,1 - tau_clm(i) = tau_clm(i-1)+tau_star(i-1) - enddo - - ! Direct radiation at bottom of snowpack: - F_direct_btm = albsfc_lcl(bnd_idx)*mu_not*exp(-(tau_clm(snl_btm)+tau_star(snl_btm))/mu_not)*pi*flx_slrd_lcl(bnd_idx) - - ! Intermediates - ! Gamma values are approximation-specific. - - ! Eddington - if (APRX_TYP==1) then - do i=snl_top,snl_btm,1 - gamma1(i) = (7-(omega_star(i)*(4+(3*g_star(i)))))/4 - gamma2(i) = -(1-(omega_star(i)*(4-(3*g_star(i)))))/4 - gamma3(i) = (2-(3*g_star(i)*mu_not))/4 - gamma4(i) = 1-gamma3(i) - mu_one = 0.5 - enddo - - ! Quadrature - elseif (APRX_TYP==2) then - do i=snl_top,snl_btm,1 - gamma1(i) = (3**0.5)*(2-(omega_star(i)*(1+g_star(i))))/2 - gamma2(i) = omega_star(i)*(3**0.5)*(1-g_star(i))/2 - gamma3(i) = (1-((3**0.5)*g_star(i)*mu_not))/2 - gamma4(i) = 1-gamma3(i) - mu_one = 1/(3**0.5) - enddo - - ! Hemispheric Mean - elseif (APRX_TYP==3) then - do i=snl_top,snl_btm,1 - gamma1(i) = 2 - (omega_star(i)*(1+g_star(i))) - gamma2(i) = omega_star(i)*(1-g_star(i)) - gamma3(i) = (1-((3**0.5)*g_star(i)*mu_not))/2 - gamma4(i) = 1-gamma3(i) - mu_one = 0.5 - enddo - endif - - ! Intermediates for tri-diagonal solution - do i=snl_top,snl_btm,1 - lambda(i) = sqrt(abs((gamma1(i)**2) - (gamma2(i)**2))) - GAMMA(i) = gamma2(i)/(gamma1(i)+lambda(i)) - - e1(i) = 1+(GAMMA(i)*exp(-lambda(i)*tau_star(i))) - e2(i) = 1-(GAMMA(i)*exp(-lambda(i)*tau_star(i))) - e3(i) = GAMMA(i) + exp(-lambda(i)*tau_star(i)) - e4(i) = GAMMA(i) - exp(-lambda(i)*tau_star(i)) - enddo !enddo over snow layers - - - ! Intermediates for tri-diagonal solution - do i=snl_top,snl_btm,1 - if (flg_slr_in == 1) then - - C_pls_btm(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-(tau_clm(i)+tau_star(i))/mu_not)* & - (((gamma1(i)-(1/mu_not))*gamma3(i))+ & - (gamma4(i)*gamma2(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - C_mns_btm(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-(tau_clm(i)+tau_star(i))/mu_not)* & - (((gamma1(i)+(1/mu_not))*gamma4(i))+ & - (gamma2(i)*gamma3(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - C_pls_top(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-tau_clm(i)/mu_not)*(((gamma1(i)-(1/mu_not))* & - gamma3(i))+(gamma4(i)*gamma2(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - C_mns_top(i) = (omega_star(i)*pi*flx_slrd_lcl(bnd_idx)* & - exp(-tau_clm(i)/mu_not)*(((gamma1(i)+(1/mu_not))* & - gamma4(i))+(gamma2(i)*gamma3(i))))/((lambda(i)**2)-(1/(mu_not**2))) - - else - C_pls_btm(i) = 0._r8 - C_mns_btm(i) = 0._r8 - C_pls_top(i) = 0._r8 - C_mns_top(i) = 0._r8 - endif - enddo - - ! Coefficients for tridiaganol matrix solution - do i=2*snl_lcl+1,0,1 - - !Boundary values for i=1 and i=2*snl_lcl, specifics for i=odd and i=even - if (i==(2*snl_lcl+1)) then - A(i) = 0 - B(i) = e1(snl_top) - D(i) = -e2(snl_top) - E(i) = flx_slri_lcl(bnd_idx)-C_mns_top(snl_top) - - elseif(i==0) then - A(i) = e1(snl_btm)-(albsfc_lcl(bnd_idx)*e3(snl_btm)) - B(i) = e2(snl_btm)-(albsfc_lcl(bnd_idx)*e4(snl_btm)) - D(i) = 0 - E(i) = F_direct_btm-C_pls_btm(snl_btm)+(albsfc_lcl(bnd_idx)*C_mns_btm(snl_btm)) - - elseif(mod(i,2)==-1) then ! If odd and i>=3 (n=1 for i=3) - n=floor(i/2.0) - A(i) = (e2(n)*e3(n))-(e4(n)*e1(n)) - B(i) = (e1(n)*e1(n+1))-(e3(n)*e3(n+1)) - D(i) = (e3(n)*e4(n+1))-(e1(n)*e2(n+1)) - E(i) = (e3(n)*(C_pls_top(n+1)-C_pls_btm(n)))+(e1(n)*(C_mns_btm(n)-C_mns_top(n+1))) - - elseif(mod(i,2)==0) then ! If even and i<=2*snl_lcl - n=(i/2) - A(i) = (e2(n+1)*e1(n))-(e3(n)*e4(n+1)) - B(i) = (e2(n)*e2(n+1))-(e4(n)*e4(n+1)) - D(i) = (e1(n+1)*e4(n+1))-(e2(n+1)*e3(n+1)) - E(i) = (e2(n+1)*(C_pls_top(n+1)-C_pls_btm(n)))+(e4(n+1)*(C_mns_top(n+1)-C_mns_btm(n))) - endif - enddo - - AS(0) = A(0)/B(0) - DS(0) = E(0)/B(0) - - do i=-1,(2*snl_lcl+1),-1 - X(i) = 1/(B(i)-(D(i)*AS(i+1))) - AS(i) = A(i)*X(i) - DS(i) = (E(i)-(D(i)*DS(i+1)))*X(i) - enddo - - Y(2*snl_lcl+1) = DS(2*snl_lcl+1) - do i=(2*snl_lcl+2),0,1 - Y(i) = DS(i)-(AS(i)*Y(i-1)) - enddo - - ! Downward direct-beam and net flux (F_net) at the base of each layer: - do i=snl_top,snl_btm,1 - F_direct(i) = mu_not*pi*flx_slrd_lcl(bnd_idx)*exp(-(tau_clm(i)+tau_star(i))/mu_not) - F_net(i) = (Y(2*i-1)*(e1(i)-e3(i))) + (Y(2*i)*(e2(i)-e4(i))) + & - C_pls_btm(i) - C_mns_btm(i) - F_direct(i) - enddo - - ! Upward flux at snowpack top: - F_sfc_pls = (Y(2*snl_lcl+1)*(exp(-lambda(snl_top)*tau_star(snl_top))+ & - GAMMA(snl_top))) + (Y(2*snl_lcl+2)*(exp(-lambda(snl_top)* & - tau_star(snl_top))-GAMMA(snl_top))) + C_pls_top(snl_top) - - ! Net flux at bottom = absorbed radiation by underlying surface: - F_btm_net = -F_net(snl_btm) - - - ! Bulk column albedo and surface net flux - albedo = F_sfc_pls/((mu_not*pi*flx_slrd_lcl(bnd_idx))+flx_slri_lcl(bnd_idx)) - F_sfc_net = F_sfc_pls - ((mu_not*pi*flx_slrd_lcl(bnd_idx))+flx_slri_lcl(bnd_idx)) - - trip = 0 - ! Absorbed flux in each layer - do i=snl_top,snl_btm,1 - if(i==snl_top) then - F_abs(i) = F_net(i)-F_sfc_net - else - F_abs(i) = F_net(i)-F_net(i-1) - endif - flx_abs_lcl(i,bnd_idx) = F_abs(i) - - - ! ERROR check: negative absorption - if (flx_abs_lcl(i,bnd_idx) < -0.00001) then - trip = 1 - endif - enddo - - flx_abs_lcl(1,bnd_idx) = F_btm_net - - if (flg_nosnl == 1) then - ! If there are no snow layers (but still snow), all absorbed energy must be in top soil layer - !flx_abs_lcl(:,bnd_idx) = 0._r8 - !flx_abs_lcl(1,bnd_idx) = F_abs(0) + F_btm_net - - ! changed on 20070408: - ! OK to put absorbed energy in the fictitous snow layer because routine SurfaceRadiation - ! handles the case of no snow layers. Then, if a snow layer is addded between now and - ! SurfaceRadiation (called in Hydrology1), absorbed energy will be properly distributed. - flx_abs_lcl(0,bnd_idx) = F_abs(0) - flx_abs_lcl(1,bnd_idx) = F_btm_net - endif - - !Underflow check (we've already tripped the error condition above) - do i=snl_top,1,1 - if (flx_abs_lcl(i,bnd_idx) < 0._r8) then - flx_abs_lcl(i,bnd_idx) = 0._r8 - endif - enddo - - F_abs_sum = 0._r8 - do i=snl_top,snl_btm,1 - F_abs_sum = F_abs_sum + F_abs(i) - enddo - - - !ERROR check: absorption greater than incident flux - ! (should make condition more generic than "1._r8") - if (F_abs_sum > 1._r8) then - trip = 1 - endif - - !ERROR check: - if ((albedo < 0._r8).and.(trip==0)) then - trip = 1 - endif - - ! Set conditions for redoing RT calculation - if ((trip == 1).and.(flg_dover == 1)) then - flg_dover = 2 - elseif ((trip == 1).and.(flg_dover == 2)) then - flg_dover = 3 - elseif ((trip == 1).and.(flg_dover == 3)) then - flg_dover = 4 - elseif((trip == 1).and.(flg_dover == 4).and.(err_idx < 20)) then - flg_dover = 3 - err_idx = err_idx + 1 - elseif((trip == 1).and.(flg_dover == 4).and.(err_idx >= 20)) then - flg_dover = 0 - write(iulog,*) "SNICAR ERROR: FOUND A WORMHOLE. STUCK IN INFINITE LOOP! Called from: ", flg_snw_ice - write(iulog,*) "SNICAR STATS: snw_rds(0)= ", snw_rds(c_idx,0) - write(iulog,*) "SNICAR STATS: L_snw(0)= ", L_snw(0) - write(iulog,*) "SNICAR STATS: h2osno= ", h2osno_lcl, " snl= ", snl_lcl - write(iulog,*) "SNICAR STATS: soot1(0)= ", mss_cnc_aer_lcl(0,1) - write(iulog,*) "SNICAR STATS: soot2(0)= ", mss_cnc_aer_lcl(0,2) - write(iulog,*) "SNICAR STATS: dust1(0)= ", mss_cnc_aer_lcl(0,3) - write(iulog,*) "SNICAR STATS: dust2(0)= ", mss_cnc_aer_lcl(0,4) - write(iulog,*) "SNICAR STATS: dust3(0)= ", mss_cnc_aer_lcl(0,5) - write(iulog,*) "SNICAR STATS: dust4(0)= ", mss_cnc_aer_lcl(0,6) - - call endrun() - else - flg_dover = 0 - endif - - enddo !enddo while (flg_dover > 0) - - ! Energy conservation check: - ! Incident direct+diffuse radiation equals (absorbed+bulk_transmitted+bulk_reflected) - energy_sum = (mu_not*pi*flx_slrd_lcl(bnd_idx)) + flx_slri_lcl(bnd_idx) - (F_abs_sum + F_btm_net + F_sfc_pls) - if (abs(energy_sum) > 0.00001_r8) then - write (iulog,"(a,e12.6,a,i6,a,i6)") "SNICAR ERROR: Energy conservation error of : ", energy_sum, & - " at timestep: ", nstep, " at column: ", c_idx - call endrun() - endif - - albout_lcl(bnd_idx) = albedo - - - ! Check that albedo is less than 1 - if (albout_lcl(bnd_idx) > 1.0) then - - write (iulog,*) "SNICAR ERROR: Albedo > 1.0 at c: ", c_idx, " NSTEP= ",nstep - write (iulog,*) "SNICAR STATS: bnd_idx= ",bnd_idx - write (iulog,*) "SNICAR STATS: albout_lcl(bnd)= ",albout_lcl(bnd_idx), " albsfc_lcl(bnd_idx)= ",albsfc_lcl(bnd_idx) - write (iulog,*) "SNICAR STATS: landtype= ", sfctype - write (iulog,*) "SNICAR STATS: h2osno= ", h2osno_lcl, " snl= ", snl_lcl - write (iulog,*) "SNICAR STATS: coszen= ", coszen(c_idx), " flg_slr= ", flg_slr_in - - write (iulog,*) "SNICAR STATS: soot(-4)= ", mss_cnc_aer_lcl(-4,1) - write (iulog,*) "SNICAR STATS: soot(-3)= ", mss_cnc_aer_lcl(-3,1) - write (iulog,*) "SNICAR STATS: soot(-2)= ", mss_cnc_aer_lcl(-2,1) - write (iulog,*) "SNICAR STATS: soot(-1)= ", mss_cnc_aer_lcl(-1,1) - write (iulog,*) "SNICAR STATS: soot(0)= ", mss_cnc_aer_lcl(0,1) - - write (iulog,*) "SNICAR STATS: L_snw(-4)= ", L_snw(-4) - write (iulog,*) "SNICAR STATS: L_snw(-3)= ", L_snw(-3) - write (iulog,*) "SNICAR STATS: L_snw(-2)= ", L_snw(-2) - write (iulog,*) "SNICAR STATS: L_snw(-1)= ", L_snw(-1) - write (iulog,*) "SNICAR STATS: L_snw(0)= ", L_snw(0) - - write (iulog,*) "SNICAR STATS: snw_rds(-4)= ", snw_rds(c_idx,-4) - write (iulog,*) "SNICAR STATS: snw_rds(-3)= ", snw_rds(c_idx,-3) - write (iulog,*) "SNICAR STATS: snw_rds(-2)= ", snw_rds(c_idx,-2) - write (iulog,*) "SNICAR STATS: snw_rds(-1)= ", snw_rds(c_idx,-1) - write (iulog,*) "SNICAR STATS: snw_rds(0)= ", snw_rds(c_idx,0) - - call endrun() - endif - - enddo ! loop over wvl bands - - - ! Weight output NIR albedo appropriately - albout(c_idx,1) = albout_lcl(1) - flx_sum = 0._r8 - do bnd_idx= nir_bnd_bgn,nir_bnd_end - flx_sum = flx_sum + flx_wgt(bnd_idx)*albout_lcl(bnd_idx) - end do - albout(c_idx,2) = flx_sum / sum(flx_wgt(nir_bnd_bgn:nir_bnd_end)) - - ! Weight output NIR absorbed layer fluxes (flx_abs) appropriately - flx_abs(c_idx,:,1) = flx_abs_lcl(:,1) - do i=snl_top,1,1 - flx_sum = 0._r8 - do bnd_idx= nir_bnd_bgn,nir_bnd_end - flx_sum = flx_sum + flx_wgt(bnd_idx)*flx_abs_lcl(i,bnd_idx) - enddo - flx_abs(c_idx,i,2) = flx_sum / sum(flx_wgt(nir_bnd_bgn:nir_bnd_end)) - end do - - ! If snow < minimum_snow, but > 0, and there is sun, set albedo to underlying surface albedo - elseif ( (coszen(c_idx) > 0._r8) .and. (h2osno_lcl < min_snw) .and. (h2osno_lcl > 0._r8) ) then - albout(c_idx,1) = albsfc(c_idx,1) - albout(c_idx,2) = albsfc(c_idx,2) - - ! There is either zero snow, or no sun - else - albout(c_idx,1) = 0._r8 - albout(c_idx,2) = 0._r8 - endif ! if column has snow and coszen > 0 - - enddo ! loop over all columns - - - end subroutine SNICAR_RT - - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SnowAge_grain -! -! !INTERFACE: - subroutine SnowAge_grain(lbc, ubc, num_snowc, filter_snowc, num_nosnowc, filter_nosnowc) - ! - ! !DESCRIPTION: - ! Updates the snow effective grain size (radius). - ! Contributions to grain size evolution are from: - ! 1. vapor redistribution (dry snow) - ! 2. liquid water redistribution (wet snow) - ! 3. re-freezing of liquid water - ! - ! Vapor redistribution: Method is to retrieve 3 best-bit parameters that - ! depend on snow temperature, temperature gradient, and density, - ! that are derived from the microphysical model described in: - ! Flanner and Zender (2006), Linking snowpack microphysics and albedo - ! evolution, J. Geophys. Res., 111, D12208, doi:10.1029/2005JD006834. - ! The parametric equation has the form: - ! dr/dt = drdt_0*(tau/(dr_fresh+tau))^(1/kappa), where: - ! r is the effective radius, - ! tau and kappa are best-fit parameters, - ! drdt_0 is the initial rate of change of effective radius, and - ! dr_fresh is the difference between the current and fresh snow states - ! (r_current - r_fresh). - ! - ! Liquid water redistribution: Apply the grain growth function from: - ! Brun, E. (1989), Investigation of wet-snow metamorphism in respect of - ! liquid-water content, Annals of Glaciology, 13, 22-26. - ! There are two parameters that describe the grain growth rate as - ! a function of snow liquid water content (LWC). The "LWC=0" parameter - ! is zeroed here because we are accounting for dry snowing with a - ! different representation - ! - ! Re-freezing of liquid water: Assume that re-frozen liquid water clumps - ! into an arbitrarily large effective grain size (snw_rds_refrz). - ! The phenomenon is observed (Grenfell), but so far unquantified, as far as - ! I am aware. - ! - ! - ! !USES: - use clmtype - use clm_time_manager , only : get_step_size, get_nstep - use clm_varpar , only : nlevsno - use clm_varcon , only : spval - use abortutils , only : endrun - use shr_const_mod , only : SHR_CONST_RHOICE, SHR_CONST_PI - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_snowc ! number of column snow points in column filter - integer, intent(in) :: filter_snowc(ubc-lbc+1) ! column filter for snow points - integer, intent(in) :: num_nosnowc ! number of column non-snow points in column filter - integer, intent(in) :: filter_nosnowc(ubc-lbc+1) ! column filter for non-snow points - ! - ! - ! !CALLED FROM: clm_driver1 - ! - - ! !LOCAL VARIABLES: - ! - ! local pointers to implicit arguments - ! - - real(r8), pointer :: t_soisno(:,:) ! soil and snow temperature (col,lyr) [K] - integer, pointer :: snl(:) ! negative number of snow layers (col) [nbr] - real(r8), pointer :: t_grnd(:) ! ground temperature (col) [K] - real(r8), pointer :: dz(:,:) ! layer thickness (col,lyr) [m] - real(r8), pointer :: h2osno(:) ! snow water (col) [mm H2O] - real(r8), pointer :: snw_rds(:,:) ! effective grain radius (col,lyr) [microns, m-6] - real(r8), pointer :: snw_rds_top(:) ! effective grain radius, top layer (col) [microns, m-6] - real(r8), pointer :: sno_liq_top(:) ! liquid water fraction (mass) in top snow layer (col) [frc] - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water content (col,lyr) [kg m-2] - real(r8), pointer :: h2osoi_ice(:,:) ! ice content (col,lyr) [kg m-2] - real(r8), pointer :: snot_top(:) ! snow temperature in top layer (col) [K] - real(r8), pointer :: dTdz_top(:) ! temperature gradient in top layer (col) [K m-1] - real(r8), pointer :: qflx_snow_grnd_col(:) ! snow on ground after interception (col) [kg m-2 s-1] - real(r8), pointer :: qflx_snwcp_ice(:) ! excess precipitation due to snow capping [kg m-2 s-1] - real(r8), pointer :: qflx_snofrz_lyr(:,:) ! snow freezing rate (col,lyr) [kg m-2 s-1] - logical , pointer :: do_capsnow(:) ! true => do snow capping - - ! - ! !OTHER LOCAL VARIABLES: - ! - integer :: snl_top ! top snow layer index [idx] - integer :: snl_btm ! bottom snow layer index [idx] - integer :: i ! layer index [idx] - integer :: c_idx ! column index [idx] - integer :: fc ! snow column filter index [idx] - integer :: T_idx ! snow aging lookup table temperature index [idx] - integer :: Tgrd_idx ! snow aging lookup table temperature gradient index [idx] - integer :: rhos_idx ! snow aging lookup table snow density index [idx] - real(r8) :: t_snotop ! temperature at upper layer boundary [K] - real(r8) :: t_snobtm ! temperature at lower layer boundary [K] - real(r8) :: dTdz(lbc:ubc,-nlevsno:0) ! snow temperature gradient (col,lyr) [K m-1] - real(r8) :: bst_tau ! snow aging parameter retrieved from lookup table [hour] - real(r8) :: bst_kappa ! snow aging parameter retrieved from lookup table [unitless] - real(r8) :: bst_drdt0 ! snow aging parameter retrieved from lookup table [um hr-1] - real(r8) :: dr ! incremental change in snow effective radius [um] - real(r8) :: dr_wet ! incremental change in snow effective radius from wet growth [um] - real(r8) :: dr_fresh ! difference between fresh snow r_e and current r_e [um] - real(r8) :: newsnow ! fresh snowfall [kg m-2] - real(r8) :: refrzsnow ! re-frozen snow [kg m-2] - real(r8) :: frc_newsnow ! fraction of layer mass that is new snow [frc] - real(r8) :: frc_oldsnow ! fraction of layer mass that is old snow [frc] - real(r8) :: frc_refrz ! fraction of layer mass that is re-frozen snow [frc] - real(r8) :: frc_liq ! fraction of layer mass that is liquid water[frc] - real(r8) :: dtime ! land model time step [sec] - real(r8) :: rhos ! snow density [kg m-3] - real(r8) :: h2osno_lyr ! liquid + solid H2O in snow layer [kg m-2] - - - ! Assign local pointers to derived subtypes components (column-level) - t_soisno => ces%t_soisno - snl => cps%snl - t_grnd => ces%t_grnd - dz => cps%dz - h2osno => cws%h2osno - snw_rds => cps%snw_rds - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - snot_top => cps%snot_top - dTdz_top => cps%dTdz_top - snw_rds_top => cps%snw_rds_top - sno_liq_top => cps%sno_liq_top - qflx_snow_grnd_col => pwf_a%qflx_snow_grnd - qflx_snwcp_ice => pwf_a%qflx_snwcp_ice - qflx_snofrz_lyr => cwf%qflx_snofrz_lyr - do_capsnow => cps%do_capsnow - - - ! set timestep and step interval - dtime = get_step_size() - - ! loop over columns that have at least one snow layer - do fc = 1, num_snowc - c_idx = filter_snowc(fc) - - snl_btm = 0 - snl_top = snl(c_idx) + 1 - - ! loop over snow layers - do i=snl_top,snl_btm,1 - ! - !********** 1. DRY SNOW AGING *********** - ! - h2osno_lyr = h2osoi_liq(c_idx,i) + h2osoi_ice(c_idx,i) - - ! temperature gradient - if (i == snl_top) then - ! top layer - t_snotop = t_grnd(c_idx) - t_snobtm = (t_soisno(c_idx,i+1)*dz(c_idx,i) + t_soisno(c_idx,i)*dz(c_idx,i+1)) / (dz(c_idx,i)+dz(c_idx,i+1)) - else - t_snotop = (t_soisno(c_idx,i-1)*dz(c_idx,i) + t_soisno(c_idx,i)*dz(c_idx,i-1)) / (dz(c_idx,i)+dz(c_idx,i-1)) - t_snobtm = (t_soisno(c_idx,i+1)*dz(c_idx,i) + t_soisno(c_idx,i)*dz(c_idx,i+1)) / (dz(c_idx,i)+dz(c_idx,i+1)) - endif - - dTdz(c_idx,i) = abs((t_snotop - t_snobtm) / dz(c_idx,i)) - - ! snow density - rhos = (h2osoi_liq(c_idx,i)+h2osoi_ice(c_idx,i)) / dz(c_idx,i) - - ! best-fit table indecies - T_idx = nint((t_soisno(c_idx,i)-223) / 5) + 1 - Tgrd_idx = nint(dTdz(c_idx,i) / 10) + 1 - rhos_idx = nint((rhos-50) / 50) + 1 - - ! boundary check: - if (T_idx < idx_T_min) then - T_idx = idx_T_min - endif - if (T_idx > idx_T_max) then - T_idx = idx_T_max - endif - if (Tgrd_idx < idx_Tgrd_min) then - Tgrd_idx = idx_Tgrd_min - endif - if (Tgrd_idx > idx_Tgrd_max) then - Tgrd_idx = idx_Tgrd_max - endif - if (rhos_idx < idx_rhos_min) then - rhos_idx = idx_rhos_min - endif - if (rhos_idx > idx_rhos_max) then - rhos_idx = idx_rhos_max - endif - - ! best-fit parameters - bst_tau = snowage_tau(rhos_idx,Tgrd_idx,T_idx) - bst_kappa = snowage_kappa(rhos_idx,Tgrd_idx,T_idx) - bst_drdt0 = snowage_drdt0(rhos_idx,Tgrd_idx,T_idx) - - - ! change in snow effective radius, using best-fit parameters - dr_fresh = snw_rds(c_idx,i)-snw_rds_min - dr = (bst_drdt0*(bst_tau/(dr_fresh+bst_tau))**(1/bst_kappa)) * (dtime/3600) - - - ! - !********** 2. WET SNOW AGING *********** - ! - ! We are assuming wet and dry evolution occur simultaneously, and - ! the contributions from both can be summed. - ! This is justified by setting the linear offset constant C1_liq_Brun89 to zero [Brun, 1989] - - ! liquid water faction - frc_liq = min(0.1_r8, (h2osoi_liq(c_idx,i) / (h2osoi_liq(c_idx,i)+h2osoi_ice(c_idx,i)))) - - !dr_wet = 1E6_r8*(dtime*(C1_liq_Brun89 + C2_liq_Brun89*(frc_liq**(3))) / (4*SHR_CONST_PI*(snw_rds(c_idx,i)/1E6)**(2))) - !simplified, units of microns: - dr_wet = 1E18_r8*(dtime*(C2_liq_Brun89*(frc_liq**(3))) / (4*SHR_CONST_PI*snw_rds(c_idx,i)**(2))) - - dr = dr + dr_wet - - ! - !********** 3. SNOWAGE SCALING (TURNED OFF BY DEFAULT) ************* - ! - ! Multiply rate of change of effective radius by some constant, xdrdt - if (flg_snoage_scl) then - dr = dr*xdrdt - endif - - - ! - !********** 4. INCREMENT EFFECTIVE RADIUS, ACCOUNTING FOR: *********** - ! DRY AGING - ! WET AGING - ! FRESH SNOW - ! RE-FREEZING - ! - ! new snowfall [kg/m2] - if (do_capsnow(c_idx)) then - newsnow = max(0._r8, (qflx_snwcp_ice(c_idx)*dtime)) - else - newsnow = max(0._r8, (qflx_snow_grnd_col(c_idx)*dtime)) - endif - - ! snow that has re-frozen [kg/m2] - refrzsnow = max(0._r8, (qflx_snofrz_lyr(c_idx,i)*dtime)) - - ! fraction of layer mass that is re-frozen - frc_refrz = refrzsnow / h2osno_lyr - - ! fraction of layer mass that is new snow - if (i == snl_top) then - frc_newsnow = newsnow / h2osno_lyr - else - frc_newsnow = 0._r8 - endif - - if ((frc_refrz + frc_newsnow) > 1._r8) then - frc_refrz = frc_refrz / (frc_refrz + frc_newsnow) - frc_newsnow = 1._r8 - frc_refrz - frc_oldsnow = 0._r8 - else - frc_oldsnow = 1._r8 - frc_refrz - frc_newsnow - endif - - ! mass-weighted mean of fresh snow, old snow, and re-frozen snow effective radius - snw_rds(c_idx,i) = (snw_rds(c_idx,i)+dr)*frc_oldsnow + snw_rds_min*frc_newsnow + snw_rds_refrz*frc_refrz - - - ! - !********** 5. CHECK BOUNDARIES *********** - ! - ! boundary check - if (snw_rds(c_idx,i) < snw_rds_min) then - snw_rds(c_idx,i) = snw_rds_min - endif - - if (snw_rds(c_idx,i) > snw_rds_max) then - snw_rds(c_idx,i) = snw_rds_max - end if - - ! set top layer variables for history files - if (i == snl_top) then - snot_top(c_idx) = t_soisno(c_idx,i) - dTdz_top(c_idx) = dTdz(c_idx,i) - snw_rds_top(c_idx) = snw_rds(c_idx,i) - sno_liq_top(c_idx) = h2osoi_liq(c_idx,i) / (h2osoi_liq(c_idx,i)+h2osoi_ice(c_idx,i)) - endif - - enddo - enddo - - ! Special case: snow on ground, but not enough to have defined a snow layer: - ! set snw_rds to fresh snow grain size: - do fc = 1, num_nosnowc - c_idx = filter_nosnowc(fc) - if (h2osno(c_idx) > 0._r8) then - snw_rds(c_idx,0) = snw_rds_min - endif - enddo - - end subroutine SnowAge_grain - - subroutine SnowOptics_init( ) - use fileutils , only : getfil - use CLM_varctl , only : fsnowoptics - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - - type(file_desc_t) :: ncid ! netCDF file id - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'SnowOptics_init' ! subroutine name - integer :: ier ! error status - - - ! - ! Open optics file: - if(masterproc) write(iulog,*) 'Attempting to read snow optical properties .....' - call getfil (fsnowoptics, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - if(masterproc) write(iulog,*) subname,trim(fsnowoptics) - - ! direct-beam snow Mie parameters: - call ncd_io('ss_alb_ice_drc', ss_alb_snw_drc, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ice_drc',asm_prm_snw_drc, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ice_drc', ext_cff_mss_snw_drc, 'read', ncid, posNOTonfile=.true.) - - ! diffuse snow Mie parameters - call ncd_io( 'ss_alb_ice_dfs', ss_alb_snw_dfs, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ice_dfs', asm_prm_snw_dfs, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ice_dfs', ext_cff_mss_snw_dfs, 'read', ncid, posNOTonfile=.true.) - - ! BC species 1 Mie parameters - call ncd_io( 'ss_alb_bcphil', ss_alb_bc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_bcphil', asm_prm_bc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_bcphil', ext_cff_mss_bc1, 'read', ncid, posNOTonfile=.true.) - - ! BC species 2 Mie parameters - call ncd_io( 'ss_alb_bcphob', ss_alb_bc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_bcphob', asm_prm_bc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_bcphob', ext_cff_mss_bc2, 'read', ncid, posNOTonfile=.true.) - - ! OC species 1 Mie parameters - call ncd_io( 'ss_alb_ocphil', ss_alb_oc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ocphil', asm_prm_oc1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ocphil', ext_cff_mss_oc1, 'read', ncid, posNOTonfile=.true.) - - ! OC species 2 Mie parameters - call ncd_io( 'ss_alb_ocphob', ss_alb_oc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_ocphob', asm_prm_oc2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_ocphob', ext_cff_mss_oc2, 'read', ncid, posNOTonfile=.true.) - - ! dust species 1 Mie parameters - call ncd_io( 'ss_alb_dust01', ss_alb_dst1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust01', asm_prm_dst1, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust01', ext_cff_mss_dst1, 'read', ncid, posNOTonfile=.true.) - - ! dust species 2 Mie parameters - call ncd_io( 'ss_alb_dust02', ss_alb_dst2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust02', asm_prm_dst2, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust02', ext_cff_mss_dst2, 'read', ncid, posNOTonfile=.true.) - - ! dust species 3 Mie parameters - call ncd_io( 'ss_alb_dust03', ss_alb_dst3, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust03', asm_prm_dst3, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust03', ext_cff_mss_dst3, 'read', ncid, posNOTonfile=.true.) - - ! dust species 4 Mie parameters - call ncd_io( 'ss_alb_dust04', ss_alb_dst4, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'asm_prm_dust04', asm_prm_dst4, 'read', ncid, posNOTonfile=.true.) - call ncd_io( 'ext_cff_mss_dust04', ext_cff_mss_dst4, 'read', ncid, posNOTonfile=.true.) - - - call ncd_pio_closefile(ncid) - if (masterproc) then - - write(iulog,*) 'Successfully read snow optical properties' - ! print some diagnostics: - write (iulog,*) 'SNICAR: Mie single scatter albedos for direct-beam ice, rds=100um: ', & - ss_alb_snw_drc(71,1), ss_alb_snw_drc(71,2), ss_alb_snw_drc(71,3), & - ss_alb_snw_drc(71,4), ss_alb_snw_drc(71,5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for diffuse ice, rds=100um: ', & - ss_alb_snw_dfs(71,1), ss_alb_snw_dfs(71,2), ss_alb_snw_dfs(71,3), & - ss_alb_snw_dfs(71,4), ss_alb_snw_dfs(71,5) - if (DO_SNO_OC) then - write (iulog,*) 'SNICAR: Including OC aerosols from snow radiative transfer calculations' - else - write (iulog,*) 'SNICAR: Excluding OC aerosols from snow radiative transfer calculations' - endif - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophillic BC: ', & - ss_alb_bc1(1), ss_alb_bc1(2), ss_alb_bc1(3), ss_alb_bc1(4), ss_alb_bc1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophobic BC: ', & - ss_alb_bc2(1), ss_alb_bc2(2), ss_alb_bc2(3), ss_alb_bc2(4), ss_alb_bc2(5) - if (DO_SNO_OC) then - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophillic OC: ', & - ss_alb_oc1(1), ss_alb_oc1(2), ss_alb_oc1(3), ss_alb_oc1(4), ss_alb_oc1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for hydrophobic OC: ', & - ss_alb_oc2(1), ss_alb_oc2(2), ss_alb_oc2(3), ss_alb_oc2(4), ss_alb_oc2(5) - endif - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 1: ', & - ss_alb_dst1(1), ss_alb_dst1(2), ss_alb_dst1(3), ss_alb_dst1(4), ss_alb_dst1(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 2: ', & - ss_alb_dst2(1), ss_alb_dst2(2), ss_alb_dst2(3), ss_alb_dst2(4), ss_alb_dst2(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 3: ', & - ss_alb_dst3(1), ss_alb_dst3(2), ss_alb_dst3(3), ss_alb_dst3(4), ss_alb_dst3(5) - write (iulog,*) 'SNICAR: Mie single scatter albedos for dust species 4: ', & - ss_alb_dst4(1), ss_alb_dst4(2), ss_alb_dst4(3), ss_alb_dst4(4), ss_alb_dst4(5) - write(iulog,*) - end if - - end subroutine SnowOptics_init - - subroutine SnowAge_init( ) - use CLM_varctl , only : fsnowaging - use fileutils , only : getfil - use spmdMod , only : masterproc - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - - type(file_desc_t) :: ncid ! netCDF file id - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'SnowOptics_init' ! subroutine name - integer :: varid ! netCDF id's - integer :: ier ! error status - - ! Open snow aging (effective radius evolution) file: - allocate(snowage_tau(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - allocate(snowage_kappa(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - allocate(snowage_drdt0(idx_rhos_max,idx_Tgrd_max,idx_T_max)) - - if(masterproc) write(iulog,*) 'Attempting to read snow aging parameters .....' - call getfil (fsnowaging, locfn, 0) - call ncd_pio_openfile(ncid, locfn, 0) - if(masterproc) write(iulog,*) subname,trim(fsnowaging) - - ! snow aging parameters - - call ncd_io('tau', snowage_tau, 'read', ncid, posNOTonfile=.true.) - call ncd_io('kappa', snowage_kappa, 'read', ncid, posNOTonfile=.true.) - call ncd_io('drdsdt0', snowage_drdt0, 'read', ncid, posNOTonfile=.true.) - - call ncd_pio_closefile(ncid) - if (masterproc) then - - write(iulog,*) 'Successfully read snow aging properties' - - ! print some diagnostics: - write (iulog,*) 'SNICAR: snowage tau for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_tau(3,11,9) - write (iulog,*) 'SNICAR: snowage kappa for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_kappa(3,11,9) - write (iulog,*) 'SNICAR: snowage dr/dt_0 for T=263K, dTdz = 100 K/m, rhos = 150 kg/m3: ', snowage_drdt0(3,11,9) - endif - - end subroutine SnowAge_init - - -end module SNICARMod diff --git a/src_clm40/biogeophys/SnowHydrologyMod.F90 b/src_clm40/biogeophys/SnowHydrologyMod.F90 deleted file mode 100644 index ecd92bc640..0000000000 --- a/src_clm40/biogeophys/SnowHydrologyMod.F90 +++ /dev/null @@ -1,1650 +0,0 @@ -module SnowHydrologyMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: SnowHydrologyMod -! -! !DESCRIPTION: -! Calculate snow hydrology. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varpar , only : nlevsno -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: SnowWater ! Change of snow mass and the snow water onto soil - public :: SnowCompaction ! Change in snow layer thickness due to compaction - public :: CombineSnowLayers ! Combine snow layers less than a min thickness - public :: DivideSnowLayers ! Subdivide snow layers if they exceed maximum thickness - public :: BuildSnowFilter ! Construct snow/no-snow filters -! -! !PRIVATE MEMBER FUNCTIONS: - private :: Combo ! Returns the combined variables: dz, t, wliq, wice. -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SnowWater -! -! !INTERFACE: - subroutine SnowWater(lbc, ubc, num_snowc, filter_snowc, & - num_nosnowc, filter_nosnowc) -! -! !DESCRIPTION: -! Evaluate the change of snow mass and the snow water onto soil. -! Water flow within snow is computed by an explicit and non-physical -! based scheme, which permits a part of liquid water over the holding -! capacity (a tentative value is used, i.e. equal to 0.033*porosity) to -! percolate into the underlying layer. Except for cases where the -! porosity of one of the two neighboring layers is less than 0.05, zero -! flow is assumed. The water flow out of the bottom of the snow pack will -! participate as the input of the soil water and runoff. This subroutine -! uses a filter for columns containing snow which must be constructed prior -! to being called. -! -! !USES: - use clmtype - use clm_varcon , only : denh2o, denice, wimp, ssi - use clm_time_manager, only : get_step_size - use clm_atmlnd , only : clm_a2l - use SNICARMod , only : scvng_fct_mlt_bcphi, scvng_fct_mlt_bcpho, & - scvng_fct_mlt_ocphi, scvng_fct_mlt_ocpho, & - scvng_fct_mlt_dst1, scvng_fct_mlt_dst2, & - scvng_fct_mlt_dst3, scvng_fct_mlt_dst4 -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_snowc ! number of snow points in column filter - integer, intent(in) :: filter_snowc(ubc-lbc+1) ! column filter for snow points - integer, intent(in) :: num_nosnowc ! number of non-snow points in column filter - integer, intent(in) :: filter_nosnowc(ubc-lbc+1) ! column filter for non-snow points -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 15 November 2000: Mariana Vertenstein -! 2/26/02, Peter Thornton: Migrated to new data structures. -! 03/28/08, Mark Flanner: Added aerosol deposition and flushing with meltwater -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: snl(:) !number of snow layers - logical , pointer :: do_capsnow(:) !true => do snow capping - real(r8), pointer :: qflx_snow_melt(:) !net snow melt - real(r8), pointer :: qflx_snomelt(:) !snow melt (mm H2O /s) - real(r8), pointer :: qflx_rain_grnd(:) !rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_sub_snow(:) !sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_evap_grnd(:) !ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_dew_snow(:) !surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd(:) !ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: dz(:,:) !layer depth (m) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: qflx_top_soil(:) !net water input into soil from top (mm/s) -! -! local pointers to implicit inout arguments -! - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) - integer , pointer :: cgridcell(:) ! columns's gridcell (col) - real(r8), pointer :: mss_bcphi(:,:) ! hydrophillic BC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcpho(:,:) ! hydrophobic BC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! hydrophillic OC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocpho(:,:) ! hydrophobic OC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst1(:,:) ! mass of dust species 1 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! mass of dust species 2 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! mass of dust species 3 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! mass of dust species 4 in snow (col,lyr) [kg] - real(r8), pointer :: flx_bc_dep_dry(:) ! dry BC deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_bc_dep_wet(:) ! wet BC deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_bc_dep(:) ! total BC deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_bc_dep_pho(:) ! hydrophobic BC deposition (col) [kg m-1 s-1] - real(r8), pointer :: flx_bc_dep_phi(:) ! hydrophillic BC deposition (col) [kg m-1 s-1] - real(r8), pointer :: flx_oc_dep_dry(:) ! dry OC deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_oc_dep_wet(:) ! wet OC deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_oc_dep(:) ! total OC deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_oc_dep_pho(:) ! hydrophobic OC deposition (col) [kg m-1 s-1] - real(r8), pointer :: flx_oc_dep_phi(:) ! hydrophillic OC deposition (col) [kg m-1 s-1] - real(r8), pointer :: flx_dst_dep_dry1(:) ! dry dust (species 1) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_wet1(:) ! wet dust (species 1) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_dry2(:) ! dry dust (species 2) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_wet2(:) ! wet dust (species 2) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_dry3(:) ! dry dust (species 3) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_wet3(:) ! wet dust (species 3) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_dry4(:) ! dry dust (species 4) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep_wet4(:) ! wet dust (species 4) deposition (col) [kg m-2 s-1] - real(r8), pointer :: flx_dst_dep(:) ! total dust deposition (col) [kg m-2 s-1] - real(r8), pointer :: forc_aer(:,:) ! aerosol deposition from atmosphere model (grd,aer) [kg m-1 s-1] -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: c, j, fc !do loop/array indices - real(r8) :: dtime !land model time step (sec) - real(r8) :: qin(lbc:ubc) !water flow into the elmement (mm/s) - real(r8) :: qout(lbc:ubc) !water flow out of the elmement (mm/s) - real(r8) :: wgdif !ice mass after minus sublimation - real(r8) :: vol_liq(lbc:ubc,-nlevsno+1:0) !partial volume of liquid water in layer - real(r8) :: vol_ice(lbc:ubc,-nlevsno+1:0) !partial volume of ice lens in layer - real(r8) :: eff_porosity(lbc:ubc,-nlevsno+1:0) !effective porosity = porosity - vol_ice - integer :: g ! gridcell loop index - real(r8) :: qin_bc_phi(lbc:ubc) ! flux of hydrophilic BC into layer [kg] - real(r8) :: qout_bc_phi(lbc:ubc) ! flux of hydrophilic BC out of layer [kg] - real(r8) :: qin_bc_pho(lbc:ubc) ! flux of hydrophobic BC into layer [kg] - real(r8) :: qout_bc_pho(lbc:ubc) ! flux of hydrophobic BC out of layer [kg] - real(r8) :: qin_oc_phi(lbc:ubc) ! flux of hydrophilic OC into layer [kg] - real(r8) :: qout_oc_phi(lbc:ubc) ! flux of hydrophilic OC out of layer [kg] - real(r8) :: qin_oc_pho(lbc:ubc) ! flux of hydrophobic OC into layer [kg] - real(r8) :: qout_oc_pho(lbc:ubc) ! flux of hydrophobic OC out of layer [kg] - real(r8) :: qin_dst1(lbc:ubc) ! flux of dust species 1 into layer [kg] - real(r8) :: qout_dst1(lbc:ubc) ! flux of dust species 1 out of layer [kg] - real(r8) :: qin_dst2(lbc:ubc) ! flux of dust species 2 into layer [kg] - real(r8) :: qout_dst2(lbc:ubc) ! flux of dust species 2 out of layer [kg] - real(r8) :: qin_dst3(lbc:ubc) ! flux of dust species 3 into layer [kg] - real(r8) :: qout_dst3(lbc:ubc) ! flux of dust species 3 out of layer [kg] - real(r8) :: qin_dst4(lbc:ubc) ! flux of dust species 4 into layer [kg] - real(r8) :: qout_dst4(lbc:ubc) ! flux of dust species 4 out of layer [kg] - real(r8) :: mss_liqice ! mass of liquid+ice in a layer - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtype components (column-level) - - snl => cps%snl - do_capsnow => cps%do_capsnow - qflx_snow_melt => cwf%qflx_snow_melt - qflx_snomelt => cwf%qflx_snomelt - qflx_rain_grnd => pwf_a%qflx_rain_grnd - qflx_sub_snow => pwf_a%qflx_sub_snow - qflx_evap_grnd => pwf_a%qflx_evap_grnd - qflx_dew_snow => pwf_a%qflx_dew_snow - qflx_dew_grnd => pwf_a%qflx_dew_grnd - qflx_top_soil => cwf%qflx_top_soil - dz => cps%dz - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - cgridcell => col%gridcell - mss_bcphi => cps%mss_bcphi - mss_bcpho => cps%mss_bcpho - mss_ocphi => cps%mss_ocphi - mss_ocpho => cps%mss_ocpho - mss_dst1 => cps%mss_dst1 - mss_dst2 => cps%mss_dst2 - mss_dst3 => cps%mss_dst3 - mss_dst4 => cps%mss_dst4 - flx_bc_dep => cwf%flx_bc_dep - flx_bc_dep_wet => cwf%flx_bc_dep_wet - flx_bc_dep_dry => cwf%flx_bc_dep_dry - flx_bc_dep_phi => cwf%flx_bc_dep_phi - flx_bc_dep_pho => cwf%flx_bc_dep_pho - flx_oc_dep => cwf%flx_oc_dep - flx_oc_dep_wet => cwf%flx_oc_dep_wet - flx_oc_dep_dry => cwf%flx_oc_dep_dry - flx_oc_dep_phi => cwf%flx_oc_dep_phi - flx_oc_dep_pho => cwf%flx_oc_dep_pho - flx_dst_dep => cwf%flx_dst_dep - flx_dst_dep_wet1 => cwf%flx_dst_dep_wet1 - flx_dst_dep_dry1 => cwf%flx_dst_dep_dry1 - flx_dst_dep_wet2 => cwf%flx_dst_dep_wet2 - flx_dst_dep_dry2 => cwf%flx_dst_dep_dry2 - flx_dst_dep_wet3 => cwf%flx_dst_dep_wet3 - flx_dst_dep_dry3 => cwf%flx_dst_dep_dry3 - flx_dst_dep_wet4 => cwf%flx_dst_dep_wet4 - flx_dst_dep_dry4 => cwf%flx_dst_dep_dry4 - forc_aer => clm_a2l%forc_aer - - ! Determine model time step - - dtime = get_step_size() - - ! Renew the mass of ice lens (h2osoi_ice) and liquid (h2osoi_liq) in the - ! surface snow layer resulting from sublimation (frost) / evaporation (condense) - - do fc = 1,num_snowc - c = filter_snowc(fc) - if (do_capsnow(c)) then - wgdif = h2osoi_ice(c,snl(c)+1) - qflx_sub_snow(c)*dtime - h2osoi_ice(c,snl(c)+1) = wgdif - if (wgdif < 0._r8) then - h2osoi_ice(c,snl(c)+1) = 0._r8 - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + wgdif - end if - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) - qflx_evap_grnd(c) * dtime - else - wgdif = h2osoi_ice(c,snl(c)+1) + (qflx_dew_snow(c) - qflx_sub_snow(c)) * dtime - h2osoi_ice(c,snl(c)+1) = wgdif - if (wgdif < 0._r8) then - h2osoi_ice(c,snl(c)+1) = 0._r8 - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + wgdif - end if - h2osoi_liq(c,snl(c)+1) = h2osoi_liq(c,snl(c)+1) + & - (qflx_rain_grnd(c) + qflx_dew_grnd(c) - qflx_evap_grnd(c)) * dtime - end if - h2osoi_liq(c,snl(c)+1) = max(0._r8, h2osoi_liq(c,snl(c)+1)) - end do - - ! Porosity and partial volume - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - vol_ice(c,j) = min(1._r8, h2osoi_ice(c,j)/(dz(c,j)*denice)) - eff_porosity(c,j) = 1._r8 - vol_ice(c,j) - vol_liq(c,j) = min(eff_porosity(c,j),h2osoi_liq(c,j)/(dz(c,j)*denh2o)) - end if - end do - end do - - ! Capillary forces within snow are usually two or more orders of magnitude - ! less than those of gravity. Only gravity terms are considered. - ! the genernal expression for water flow is "K * ss**3", however, - ! no effective parameterization for "K". Thus, a very simple consideration - ! (not physically based) is introduced: - ! when the liquid water of layer exceeds the layer's holding - ! capacity, the excess meltwater adds to the underlying neighbor layer. - - ! Also compute aerosol fluxes through snowpack in this loop: - ! 1) compute aerosol mass in each layer - ! 2) add aerosol mass flux from above layer to mass of this layer - ! 3) qout_xxx is mass flux of aerosol species xxx out bottom of - ! layer in water flow, proportional to (current) concentration - ! of aerosol in layer multiplied by a scavenging ratio. - ! 4) update mass of aerosol in top layer, accordingly - ! 5) update mass concentration of aerosol accordingly - - qin(:) = 0._r8 - qin_bc_phi(:) = 0._r8 - qin_bc_pho(:) = 0._r8 - qin_oc_phi(:) = 0._r8 - qin_oc_pho(:) = 0._r8 - qin_dst1(:) = 0._r8 - qin_dst2(:) = 0._r8 - qin_dst3(:) = 0._r8 - qin_dst4(:) = 0._r8 - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - h2osoi_liq(c,j) = h2osoi_liq(c,j) + qin(c) - - mss_bcphi(c,j) = mss_bcphi(c,j) + qin_bc_phi(c) - mss_bcpho(c,j) = mss_bcpho(c,j) + qin_bc_pho(c) - mss_ocphi(c,j) = mss_ocphi(c,j) + qin_oc_phi(c) - mss_ocpho(c,j) = mss_ocpho(c,j) + qin_oc_pho(c) - mss_dst1(c,j) = mss_dst1(c,j) + qin_dst1(c) - mss_dst2(c,j) = mss_dst2(c,j) + qin_dst2(c) - mss_dst3(c,j) = mss_dst3(c,j) + qin_dst3(c) - mss_dst4(c,j) = mss_dst4(c,j) + qin_dst4(c) - - if (j <= -1) then - ! No runoff over snow surface, just ponding on surface - if (eff_porosity(c,j) < wimp .OR. eff_porosity(c,j+1) < wimp) then - qout(c) = 0._r8 - else - qout(c) = max(0._r8,(vol_liq(c,j)-ssi*eff_porosity(c,j))*dz(c,j)) - qout(c) = min(qout(c),(1._r8-vol_ice(c,j+1)-vol_liq(c,j+1))*dz(c,j+1)) - end if - else - qout(c) = max(0._r8,(vol_liq(c,j) - ssi*eff_porosity(c,j))*dz(c,j)) - end if - qout(c) = qout(c)*1000._r8 - h2osoi_liq(c,j) = h2osoi_liq(c,j) - qout(c) - qin(c) = qout(c) - - ! mass of ice+water: in extremely rare circumstances, this can - ! be zero, even though there is a snow layer defined. In - ! this case, set the mass to a very small value to - ! prevent division by zero. - mss_liqice = h2osoi_liq(c,j)+h2osoi_ice(c,j) - if (mss_liqice < 1E-30_r8) then - mss_liqice = 1E-30_r8 - endif - - ! BCPHI: - ! 1. flux with meltwater: - qout_bc_phi(c) = qout(c)*scvng_fct_mlt_bcphi*(mss_bcphi(c,j)/mss_liqice) - if (qout_bc_phi(c) > mss_bcphi(c,j)) then - qout_bc_phi(c) = mss_bcphi(c,j) - endif - mss_bcphi(c,j) = mss_bcphi(c,j) - qout_bc_phi(c) - qin_bc_phi(c) = qout_bc_phi(c) - - ! BCPHO: - ! 1. flux with meltwater: - qout_bc_pho(c) = qout(c)*scvng_fct_mlt_bcpho*(mss_bcpho(c,j)/mss_liqice) - if (qout_bc_pho(c) > mss_bcpho(c,j)) then - qout_bc_pho(c) = mss_bcpho(c,j) - endif - mss_bcpho(c,j) = mss_bcpho(c,j) - qout_bc_pho(c) - qin_bc_pho(c) = qout_bc_pho(c) - - ! OCPHI: - ! 1. flux with meltwater: - qout_oc_phi(c) = qout(c)*scvng_fct_mlt_ocphi*(mss_ocphi(c,j)/mss_liqice) - if (qout_oc_phi(c) > mss_ocphi(c,j)) then - qout_oc_phi(c) = mss_ocphi(c,j) - endif - mss_ocphi(c,j) = mss_ocphi(c,j) - qout_oc_phi(c) - qin_oc_phi(c) = qout_oc_phi(c) - - ! OCPHO: - ! 1. flux with meltwater: - qout_oc_pho(c) = qout(c)*scvng_fct_mlt_ocpho*(mss_ocpho(c,j)/mss_liqice) - if (qout_oc_pho(c) > mss_ocpho(c,j)) then - qout_oc_pho(c) = mss_ocpho(c,j) - endif - mss_ocpho(c,j) = mss_ocpho(c,j) - qout_oc_pho(c) - qin_oc_pho(c) = qout_oc_pho(c) - - ! DUST 1: - ! 1. flux with meltwater: - qout_dst1(c) = qout(c)*scvng_fct_mlt_dst1*(mss_dst1(c,j)/mss_liqice) - if (qout_dst1(c) > mss_dst1(c,j)) then - qout_dst1(c) = mss_dst1(c,j) - endif - mss_dst1(c,j) = mss_dst1(c,j) - qout_dst1(c) - qin_dst1(c) = qout_dst1(c) - - ! DUST 2: - ! 1. flux with meltwater: - qout_dst2(c) = qout(c)*scvng_fct_mlt_dst2*(mss_dst2(c,j)/mss_liqice) - if (qout_dst2(c) > mss_dst2(c,j)) then - qout_dst2(c) = mss_dst2(c,j) - endif - mss_dst2(c,j) = mss_dst2(c,j) - qout_dst2(c) - qin_dst2(c) = qout_dst2(c) - - ! DUST 3: - ! 1. flux with meltwater: - qout_dst3(c) = qout(c)*scvng_fct_mlt_dst3*(mss_dst3(c,j)/mss_liqice) - if (qout_dst3(c) > mss_dst3(c,j)) then - qout_dst3(c) = mss_dst3(c,j) - endif - mss_dst3(c,j) = mss_dst3(c,j) - qout_dst3(c) - qin_dst3(c) = qout_dst3(c) - - ! DUST 4: - ! 1. flux with meltwater: - qout_dst4(c) = qout(c)*scvng_fct_mlt_dst4*(mss_dst4(c,j)/mss_liqice) - if (qout_dst4(c) > mss_dst4(c,j)) then - qout_dst4(c) = mss_dst4(c,j) - endif - mss_dst4(c,j) = mss_dst4(c,j) - qout_dst4(c) - qin_dst4(c) = qout_dst4(c) - - end if - end do - end do - - ! Adjust layer thickness for any water+ice content changes in excess of previous - ! layer thickness. Strictly speaking, only necessary for top snow layer, but doing - ! it for all snow layers will catch problems with older initial files. - ! Layer interfaces (zi) and node depths (z) do not need adjustment here because they - ! are adjusted in CombineSnowLayers and are not used up to that point. - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - dz(c,j) = max(dz(c,j),h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice) - end if - end do - end do - - do fc = 1, num_snowc - c = filter_snowc(fc) - ! Qout from snow bottom - qflx_top_soil(c) = qout(c) / dtime - qflx_snow_melt(c) = qflx_snow_melt(c) + (qout(c) / dtime) - end do - - do fc = 1, num_nosnowc - c = filter_nosnowc(fc) - qflx_top_soil(c) = qflx_rain_grnd(c) + qflx_snomelt(c) - qflx_snow_melt(c) = qflx_snomelt(c) - end do - - ! set aerosol deposition fluxes from forcing array - ! The forcing array is either set from an external file - ! or from fluxes received from the atmosphere model - do c = lbc,ubc - g = cgridcell(c) - - flx_bc_dep_dry(c) = forc_aer(g,1) + forc_aer(g,2) - flx_bc_dep_wet(c) = forc_aer(g,3) - flx_bc_dep_phi(c) = forc_aer(g,1) + forc_aer(g,3) - flx_bc_dep_pho(c) = forc_aer(g,2) - flx_bc_dep(c) = forc_aer(g,1) + forc_aer(g,2) + forc_aer(g,3) - - flx_oc_dep_dry(c) = forc_aer(g,4) + forc_aer(g,5) - flx_oc_dep_wet(c) = forc_aer(g,6) - flx_oc_dep_phi(c) = forc_aer(g,4) + forc_aer(g,6) - flx_oc_dep_pho(c) = forc_aer(g,5) - flx_oc_dep(c) = forc_aer(g,4) + forc_aer(g,5) + forc_aer(g,6) - - flx_dst_dep_wet1(c) = forc_aer(g,7) - flx_dst_dep_dry1(c) = forc_aer(g,8) - flx_dst_dep_wet2(c) = forc_aer(g,9) - flx_dst_dep_dry2(c) = forc_aer(g,10) - flx_dst_dep_wet3(c) = forc_aer(g,11) - flx_dst_dep_dry3(c) = forc_aer(g,12) - flx_dst_dep_wet4(c) = forc_aer(g,13) - flx_dst_dep_dry4(c) = forc_aer(g,14) - flx_dst_dep(c) = forc_aer(g,7) + forc_aer(g,8) + forc_aer(g,9) + & - forc_aer(g,10) + forc_aer(g,11) + forc_aer(g,12) + & - forc_aer(g,13) + forc_aer(g,14) - - end do - - ! aerosol deposition fluxes into top layer - ! This is done after the inter-layer fluxes so that some aerosol - ! is in the top layer after deposition, and is not immediately - ! washed out before radiative calculations are done - do fc = 1, num_snowc - c = filter_snowc(fc) - mss_bcphi(c,snl(c)+1) = mss_bcphi(c,snl(c)+1) + (flx_bc_dep_phi(c)*dtime) - mss_bcpho(c,snl(c)+1) = mss_bcpho(c,snl(c)+1) + (flx_bc_dep_pho(c)*dtime) - mss_ocphi(c,snl(c)+1) = mss_ocphi(c,snl(c)+1) + (flx_oc_dep_phi(c)*dtime) - mss_ocpho(c,snl(c)+1) = mss_ocpho(c,snl(c)+1) + (flx_oc_dep_pho(c)*dtime) - - mss_dst1(c,snl(c)+1) = mss_dst1(c,snl(c)+1) + (flx_dst_dep_dry1(c) + flx_dst_dep_wet1(c))*dtime - mss_dst2(c,snl(c)+1) = mss_dst2(c,snl(c)+1) + (flx_dst_dep_dry2(c) + flx_dst_dep_wet2(c))*dtime - mss_dst3(c,snl(c)+1) = mss_dst3(c,snl(c)+1) + (flx_dst_dep_dry3(c) + flx_dst_dep_wet3(c))*dtime - mss_dst4(c,snl(c)+1) = mss_dst4(c,snl(c)+1) + (flx_dst_dep_dry4(c) + flx_dst_dep_wet4(c))*dtime - end do - - end subroutine SnowWater - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SnowCompaction -! -! !INTERFACE: - subroutine SnowCompaction(lbc, ubc, num_snowc, filter_snowc) -! -! !DESCRIPTION: -! Determine the change in snow layer thickness due to compaction and -! settling. -! Three metamorphisms of changing snow characteristics are implemented, -! i.e., destructive, overburden, and melt. The treatments of the former -! two are from SNTHERM.89 and SNTHERM.99 (1991, 1999). The contribution -! due to melt metamorphism is simply taken as a ratio of snow ice -! fraction after the melting versus before the melting. -! -! !USES: - use clmtype - use clm_time_manager, only : get_step_size - use clm_varcon , only : denice, denh2o, tfrz, istice_mec -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_snowc ! number of column snow points in column filter - integer, intent(in) :: filter_snowc(ubc-lbc+1) ! column filter for snow points -! -! !CALLED FROM: -! subroutine Hydrology2 in module Hydrology2Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/28/02, Peter Thornton: Migrated to new data structures -! 2/29/08, David Lawrence: Revised snow overburden to be include 0.5 weight of current layer -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in scalars -! - integer, pointer :: snl(:) !number of snow layers -! -! local pointers to implicit in arguments -! - integer, pointer :: imelt(:,:) !flag for melting (=1), freezing (=2), Not=0 - real(r8), pointer :: frac_iceold(:,:) !fraction of ice relative to the tot water - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) -! -! local pointers to implicit inout arguments -! - real(r8), pointer :: dz(:,:) !layer depth (m) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: j, l, c, fc ! indices - real(r8):: dtime ! land model time step (sec) - real(r8), parameter :: c2 = 23.e-3_r8 ! [m3/kg] - real(r8), parameter :: c3 = 2.777e-6_r8 ! [1/s] - real(r8), parameter :: c4 = 0.04_r8 ! [1/K] - real(r8), parameter :: c5 = 2.0_r8 ! - real(r8), parameter :: dm = 100.0_r8 ! Upper Limit on Destructive Metamorphism Compaction [kg/m3] - real(r8), parameter :: eta0 = 9.e+5_r8 ! The Viscosity Coefficient Eta0 [kg-s/m2] - real(r8) :: burden(lbc:ubc) ! pressure of overlying snow [kg/m2] - real(r8) :: ddz1 ! Rate of settling of snowpack due to destructive metamorphism. - real(r8) :: ddz2 ! Rate of compaction of snowpack due to overburden. - real(r8) :: ddz3 ! Rate of compaction of snowpack due to melt [1/s] - real(r8) :: dexpf ! expf=exp(-c4*(273.15-t_soisno)). - real(r8) :: fi ! Fraction of ice relative to the total water content at current time step - real(r8) :: td ! t_soisno - tfrz [K] - real(r8) :: pdzdtc ! Nodal rate of change in fractional-thickness due to compaction [fraction/s] - real(r8) :: void ! void (1 - vol_ice - vol_liq) - real(r8) :: wx ! water mass (ice+liquid) [kg/m2] - real(r8) :: bi ! partial density of ice [kg/m3] - - integer, pointer :: clandunit(:) !landunit index for each column - integer, pointer :: ltype(:) !landunit type - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes (column-level) - - snl => cps%snl - dz => cps%dz - imelt => cps%imelt - frac_iceold => cps%frac_iceold - t_soisno => ces%t_soisno - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - clandunit => col%landunit - ltype => lun%itype - - ! Get time step - - dtime = get_step_size() - - ! Begin calculation - note that the following column loops are only invoked if snl(c) < 0 - - burden(:) = 0._r8 - - do j = -nlevsno+1, 0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - - wx = h2osoi_ice(c,j) + h2osoi_liq(c,j) - void = 1._r8 - (h2osoi_ice(c,j)/denice + h2osoi_liq(c,j)/denh2o) / dz(c,j) - - ! If void is negative, then increase dz such that void = 0. - ! This should be done for any landunit, but for now is done only for glacier_mec 1andunits. - l = clandunit(c) - if (ltype(l)==istice_mec .and. void < 0._r8) then - dz(c,j) = h2osoi_ice(c,j)/denice + h2osoi_liq(c,j)/denh2o - void = 0._r8 - endif - - ! Allow compaction only for non-saturated node and higher ice lens node. - if (void > 0.001_r8 .and. h2osoi_ice(c,j) > .1_r8) then - bi = h2osoi_ice(c,j) / dz(c,j) - fi = h2osoi_ice(c,j) / wx - td = tfrz-t_soisno(c,j) - dexpf = exp(-c4*td) - - ! Settling as a result of destructive metamorphism - - ddz1 = -c3*dexpf - if (bi > dm) ddz1 = ddz1*exp(-46.0e-3_r8*(bi-dm)) - - ! Liquid water term - - if (h2osoi_liq(c,j) > 0.01_r8*dz(c,j)) ddz1=ddz1*c5 - - ! Compaction due to overburden - - ddz2 = -(burden(c)+wx/2._r8)*exp(-0.08_r8*td - c2*bi)/eta0 - - ! Compaction occurring during melt - - if (imelt(c,j) == 1) then - ddz3 = - 1._r8/dtime * max(0._r8,(frac_iceold(c,j) - fi)/frac_iceold(c,j)) - else - ddz3 = 0._r8 - end if - - ! Time rate of fractional change in dz (units of s-1) - - pdzdtc = ddz1 + ddz2 + ddz3 - - ! The change in dz due to compaction - ! Limit compaction to no less than fully saturated layer thickness - - dz(c,j) = max(dz(c,j) * (1._r8+pdzdtc*dtime),h2osoi_ice(c,j)/denice & - + h2osoi_liq(c,j)/denh2o) - - end if - - ! Pressure of overlying snow - - burden(c) = burden(c) + wx - - end if - end do - end do - - end subroutine SnowCompaction - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CombineSnowLayers -! -! !INTERFACE: - subroutine CombineSnowLayers(lbc, ubc, num_snowc, filter_snowc) -! -! !DESCRIPTION: -! Combine snow layers that are less than a minimum thickness or mass -! If the snow element thickness or mass is less than a prescribed minimum, -! then it is combined with a neighboring element. The subroutine -! clm\_combo.f90 then executes the combination of mass and energy. -! -! !USES: - use clmtype - use clm_varcon, only : istsoil, isturb - use clm_varcon, only : istcrop - use clm_time_manager, only : get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(inout) :: num_snowc ! number of column snow points in column filter - integer, intent(inout) :: filter_snowc(ubc-lbc+1) ! column filter for snow points -! -! !CALLED FROM: -! subroutine Hydrology2 in module Hydrology2Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/28/02, Peter Thornton: Migrated to new data structures. -! 03/28/08, Mark Flanner: Added aerosol masses and snow grain radius -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer, pointer :: clandunit(:) !landunit index for each column - integer, pointer :: ltype(:) !landunit type -! -! local pointers to implicit inout arguments -! - integer , pointer :: snl(:) !number of snow layers - real(r8), pointer :: h2osno(:) !snow water (mm H2O) - real(r8), pointer :: snowdp(:) !snow height (m) - real(r8), pointer :: dz(:,:) !layer depth (m) - real(r8), pointer :: zi(:,:) !interface level below a "z" level (m) - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: z(:,:) ! layer thickness (m) - real(r8), pointer :: mss_bcphi(:,:) ! hydrophilic BC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcpho(:,:) ! hydrophobic BC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! hydrophilic OC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocpho(:,:) ! hydrophobic OC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst1(:,:) ! dust species 1 mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! dust species 2 mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! dust species 3 mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! dust species 4 mass in snow (col,lyr) [kg] - real(r8), pointer :: snw_rds(:,:) ! effective snow grain radius (col,lyr) [microns, m^-6] - real(r8), pointer :: qflx_sl_top_soil(:) ! liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: c, fc ! column indices - integer :: i,k ! loop indices - integer :: j,l ! node indices - integer :: msn_old(lbc:ubc) ! number of top snow layer - integer :: mssi(lbc:ubc) ! node index - integer :: neibor ! adjacent node selected for combination - real(r8):: zwice(lbc:ubc) ! total ice mass in snow - real(r8):: zwliq (lbc:ubc) ! total liquid water in snow - real(r8):: dzmin(5) ! minimum of top snow layer - real(r8) :: dtime !land model time step (sec) - - data dzmin /0.010_r8, 0.015_r8, 0.025_r8, 0.055_r8, 0.115_r8/ -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes (landunit-level) - - ltype => lun%itype - - ! Assign local pointers to derived subtypes (column-level) - - clandunit => col%landunit - snl => cps%snl - snowdp => cps%snowdp - h2osno => cws%h2osno - dz => cps%dz - zi => cps%zi - z => cps%z - t_soisno => ces%t_soisno - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - mss_bcphi => cps%mss_bcphi - mss_bcpho => cps%mss_bcpho - mss_ocphi => cps%mss_ocphi - mss_ocpho => cps%mss_ocpho - mss_dst1 => cps%mss_dst1 - mss_dst2 => cps%mss_dst2 - mss_dst3 => cps%mss_dst3 - mss_dst4 => cps%mss_dst4 - snw_rds => cps%snw_rds - qflx_sl_top_soil => cwf%qflx_sl_top_soil - - ! Determine model time step - - dtime = get_step_size() - - - ! Check the mass of ice lens of snow, when the total is less than a small value, - ! combine it with the underlying neighbor. - - do fc = 1, num_snowc - c = filter_snowc(fc) - msn_old(c) = snl(c) - qflx_sl_top_soil(c) = 0._r8 - end do - - ! The following loop is NOT VECTORIZED - - do fc = 1, num_snowc - c = filter_snowc(fc) - l = clandunit(c) - do j = msn_old(c)+1,0 - if (h2osoi_ice(c,j) <= .1_r8) then - if (ltype(l) == istsoil .or. ltype(l)==isturb .or. ltype(l) == istcrop) then - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) + h2osoi_liq(c,j) - h2osoi_ice(c,j+1) = h2osoi_ice(c,j+1) + h2osoi_ice(c,j) - - if (j == 0) then - qflx_sl_top_soil(c) = (h2osoi_liq(c,j) + h2osoi_ice(c,j))/dtime - end if - - if (j /= 0) dz(c,j+1) = dz(c,j+1) + dz(c,j) - - ! NOTE: Temperature, and similarly snw_rds, of the - ! underlying snow layer are NOT adjusted in this case. - ! Because the layer being eliminated has a small mass, - ! this should not make a large difference, but it - ! would be more thorough to do so. - if (j /= 0) then - mss_bcphi(c,j+1) = mss_bcphi(c,j+1) + mss_bcphi(c,j) - mss_bcpho(c,j+1) = mss_bcpho(c,j+1) + mss_bcpho(c,j) - mss_ocphi(c,j+1) = mss_ocphi(c,j+1) + mss_ocphi(c,j) - mss_ocpho(c,j+1) = mss_ocpho(c,j+1) + mss_ocpho(c,j) - mss_dst1(c,j+1) = mss_dst1(c,j+1) + mss_dst1(c,j) - mss_dst2(c,j+1) = mss_dst2(c,j+1) + mss_dst2(c,j) - mss_dst3(c,j+1) = mss_dst3(c,j+1) + mss_dst3(c,j) - mss_dst4(c,j+1) = mss_dst4(c,j+1) + mss_dst4(c,j) - end if - - else if (ltype(l) /= istsoil .and. ltype(l) /= isturb .and. ltype(l) /= istcrop .and. j /= 0) then - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) + h2osoi_liq(c,j) - h2osoi_ice(c,j+1) = h2osoi_ice(c,j+1) + h2osoi_ice(c,j) - dz(c,j+1) = dz(c,j+1) + dz(c,j) - - mss_bcphi(c,j+1) = mss_bcphi(c,j+1) + mss_bcphi(c,j) - mss_bcpho(c,j+1) = mss_bcpho(c,j+1) + mss_bcpho(c,j) - mss_ocphi(c,j+1) = mss_ocphi(c,j+1) + mss_ocphi(c,j) - mss_ocpho(c,j+1) = mss_ocpho(c,j+1) + mss_ocpho(c,j) - mss_dst1(c,j+1) = mss_dst1(c,j+1) + mss_dst1(c,j) - mss_dst2(c,j+1) = mss_dst2(c,j+1) + mss_dst2(c,j) - mss_dst3(c,j+1) = mss_dst3(c,j+1) + mss_dst3(c,j) - mss_dst4(c,j+1) = mss_dst4(c,j+1) + mss_dst4(c,j) - - end if - - ! shift all elements above this down one. - if (j > snl(c)+1 .and. snl(c) < -1) then - do i = j, snl(c)+2, -1 - ! If the layer closest to the surface is less than 0.1 mm and the ltype is not - ! urban, soil or crop, the h2osoi_liq and h2osoi_ice associated with this layer is sent - ! to qflx_qrgwl later on in the code. To keep track of this for the snow balance - ! error check, we add this to qflx_sl_top_soil here - if (ltype(l) /= istsoil .and. ltype(l) /= istcrop .and. ltype(l) /= isturb .and. i == 0) then - qflx_sl_top_soil(c) = (h2osoi_liq(c,i) + h2osoi_ice(c,i))/dtime - end if - - t_soisno(c,i) = t_soisno(c,i-1) - h2osoi_liq(c,i) = h2osoi_liq(c,i-1) - h2osoi_ice(c,i) = h2osoi_ice(c,i-1) - - mss_bcphi(c,i) = mss_bcphi(c,i-1) - mss_bcpho(c,i) = mss_bcpho(c,i-1) - mss_ocphi(c,i) = mss_ocphi(c,i-1) - mss_ocpho(c,i) = mss_ocpho(c,i-1) - mss_dst1(c,i) = mss_dst1(c,i-1) - mss_dst2(c,i) = mss_dst2(c,i-1) - mss_dst3(c,i) = mss_dst3(c,i-1) - mss_dst4(c,i) = mss_dst4(c,i-1) - snw_rds(c,i) = snw_rds(c,i-1) - - dz(c,i) = dz(c,i-1) - end do - end if - snl(c) = snl(c) + 1 - end if - end do - end do - - do fc = 1, num_snowc - c = filter_snowc(fc) - h2osno(c) = 0._r8 - snowdp(c) = 0._r8 - zwice(c) = 0._r8 - zwliq(c) = 0._r8 - end do - - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - h2osno(c) = h2osno(c) + h2osoi_ice(c,j) + h2osoi_liq(c,j) - snowdp(c) = snowdp(c) + dz(c,j) - zwice(c) = zwice(c) + h2osoi_ice(c,j) - zwliq(c) = zwliq(c) + h2osoi_liq(c,j) - end if - end do - end do - - ! Check the snow depth - all snow gone - ! The liquid water assumes ponding on soil surface. - - do fc = 1, num_snowc - c = filter_snowc(fc) - l = clandunit(c) - if (snowdp(c) < 0.01_r8 .and. snowdp(c) > 0._r8) then - snl(c) = 0 - h2osno(c) = zwice(c) - - mss_bcphi(c,:) = 0._r8 - mss_bcpho(c,:) = 0._r8 - mss_ocphi(c,:) = 0._r8 - mss_ocpho(c,:) = 0._r8 - mss_dst1(c,:) = 0._r8 - mss_dst2(c,:) = 0._r8 - mss_dst3(c,:) = 0._r8 - mss_dst4(c,:) = 0._r8 - - if (h2osno(c) <= 0._r8) snowdp(c) = 0._r8 - if (ltype(l) == istsoil .or. ltype(l) == isturb .or. ltype(l) == istcrop) then - h2osoi_liq(c,1) = h2osoi_liq(c,1) + zwliq(c) - end if - end if - end do - - ! Check the snow depth - snow layers combined - ! The following loop IS NOT VECTORIZED - - do fc = 1, num_snowc - c = filter_snowc(fc) - - ! Two or more layers - - if (snl(c) < -1) then - - msn_old(c) = snl(c) - mssi(c) = 1 - - do i = msn_old(c)+1,0 - if (dz(c,i) < dzmin(mssi(c))) then - - if (i == snl(c)+1) then - ! If top node is removed, combine with bottom neighbor. - neibor = i + 1 - else if (i == 0) then - ! If the bottom neighbor is not snow, combine with the top neighbor. - neibor = i - 1 - else - ! If none of the above special cases apply, combine with the thinnest neighbor - neibor = i + 1 - if ((dz(c,i-1)+dz(c,i)) < (dz(c,i+1)+dz(c,i))) neibor = i-1 - end if - - ! Node l and j are combined and stored as node j. - if (neibor > i) then - j = neibor - l = i - else - j = i - l = neibor - end if - - ! this should be included in 'Combo' for consistency, - ! but functionally it is the same to do it here - mss_bcphi(c,j)=mss_bcphi(c,j)+mss_bcphi(c,l) - mss_bcpho(c,j)=mss_bcpho(c,j)+mss_bcpho(c,l) - mss_ocphi(c,j)=mss_ocphi(c,j)+mss_ocphi(c,l) - mss_ocpho(c,j)=mss_ocpho(c,j)+mss_ocpho(c,l) - mss_dst1(c,j)=mss_dst1(c,j)+mss_dst1(c,l) - mss_dst2(c,j)=mss_dst2(c,j)+mss_dst2(c,l) - mss_dst3(c,j)=mss_dst3(c,j)+mss_dst3(c,l) - mss_dst4(c,j)=mss_dst4(c,j)+mss_dst4(c,l) - ! mass-weighted combination of effective grain size: - snw_rds(c,j) = (snw_rds(c,j)*(h2osoi_liq(c,j)+h2osoi_ice(c,j)) + & - snw_rds(c,l)*(h2osoi_liq(c,l)+h2osoi_ice(c,l))) / & - (h2osoi_liq(c,j)+h2osoi_ice(c,j)+h2osoi_liq(c,l)+h2osoi_ice(c,l)) - - call Combo (dz(c,j), h2osoi_liq(c,j), h2osoi_ice(c,j), & - t_soisno(c,j), dz(c,l), h2osoi_liq(c,l), h2osoi_ice(c,l), t_soisno(c,l) ) - - ! Now shift all elements above this down one. - if (j-1 > snl(c)+1) then - do k = j-1, snl(c)+2, -1 - t_soisno(c,k) = t_soisno(c,k-1) - h2osoi_ice(c,k) = h2osoi_ice(c,k-1) - h2osoi_liq(c,k) = h2osoi_liq(c,k-1) - - mss_bcphi(c,k) = mss_bcphi(c,k-1) - mss_bcpho(c,k) = mss_bcpho(c,k-1) - mss_ocphi(c,k) = mss_ocphi(c,k-1) - mss_ocpho(c,k) = mss_ocpho(c,k-1) - mss_dst1(c,k) = mss_dst1(c,k-1) - mss_dst2(c,k) = mss_dst2(c,k-1) - mss_dst3(c,k) = mss_dst3(c,k-1) - mss_dst4(c,k) = mss_dst4(c,k-1) - snw_rds(c,k) = snw_rds(c,k-1) - - dz(c,k) = dz(c,k-1) - end do - end if - - ! Decrease the number of snow layers - snl(c) = snl(c) + 1 - if (snl(c) >= -1) EXIT - - else - - ! The layer thickness is greater than the prescribed minimum value - mssi(c) = mssi(c) + 1 - - end if - end do - - end if - - end do - - ! Reset the node depth and the depth of layer interface - - do j = 0, -nlevsno+1, -1 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c) + 1) then - z(c,j) = zi(c,j) - 0.5_r8*dz(c,j) - zi(c,j-1) = zi(c,j) - dz(c,j) - end if - end do - end do - - end subroutine CombineSnowLayers - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: DivideSnowLayers -! -! !INTERFACE: - subroutine DivideSnowLayers(lbc, ubc, num_snowc, filter_snowc) -! -! !DESCRIPTION: -! Subdivides snow layers if they exceed their prescribed maximum thickness. -! -! !USES: - use clmtype - use clm_varcon, only : tfrz -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(inout) :: num_snowc ! number of column snow points in column filter - integer, intent(inout) :: filter_snowc(ubc-lbc+1) ! column filter for snow points -! -! !CALLED FROM: -! subroutine Hydrology2 in module Hydrology2Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/28/02, Peter Thornton: Migrated to new data structures. -! 2/29/08, David Lawrence: Snowpack T profile maintained during layer splitting -! 03/28/08, Mark Flanner: Added aerosol masses and snow grain radius -! -! !LOCAL VARIABLES: -! -! local pointers to implicit inout arguments -! - integer , pointer :: snl(:) !number of snow layers - real(r8), pointer :: dz(:,:) !layer depth (m) - real(r8), pointer :: zi(:,:) !interface level below a "z" level (m) - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: z(:,:) ! layer thickness (m) - real(r8), pointer :: mss_bcphi(:,:) ! hydrophilic BC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcpho(:,:) ! hydrophobic BC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! hydrophilic OC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocpho(:,:) ! hydrophobic OC mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst1(:,:) ! dust species 1 mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! dust species 2 mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! dust species 3 mass in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! dust species 4 mass in snow (col,lyr) [kg] - real(r8), pointer :: snw_rds(:,:) ! effective snow grain radius (col,lyr) [microns, m^-6] -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: j, c, fc ! indices - real(r8) :: drr ! thickness of the combined [m] - integer :: msno ! number of snow layer 1 (top) to msno (bottom) - real(r8) :: dzsno(lbc:ubc,nlevsno) ! Snow layer thickness [m] - real(r8) :: swice(lbc:ubc,nlevsno) ! Partial volume of ice [m3/m3] - real(r8) :: swliq(lbc:ubc,nlevsno) ! Partial volume of liquid water [m3/m3] - real(r8) :: tsno(lbc:ubc ,nlevsno) ! Nodel temperature [K] - real(r8) :: zwice ! temporary - real(r8) :: zwliq ! temporary - real(r8) :: propor ! temporary - real(r8) :: dtdz ! temporary - - ! temporary variables mimicking the structure of other layer division variables - real(r8) :: mbc_phi(lbc:ubc,nlevsno) ! mass of BC in each snow layer - real(r8) :: zmbc_phi ! temporary - real(r8) :: mbc_pho(lbc:ubc,nlevsno) ! mass of BC in each snow layer - real(r8) :: zmbc_pho ! temporary - real(r8) :: moc_phi(lbc:ubc,nlevsno) ! mass of OC in each snow layer - real(r8) :: zmoc_phi ! temporary - real(r8) :: moc_pho(lbc:ubc,nlevsno) ! mass of OC in each snow layer - real(r8) :: zmoc_pho ! temporary - real(r8) :: mdst1(lbc:ubc,nlevsno) ! mass of dust 1 in each snow layer - real(r8) :: zmdst1 ! temporary - real(r8) :: mdst2(lbc:ubc,nlevsno) ! mass of dust 2 in each snow layer - real(r8) :: zmdst2 ! temporary - real(r8) :: mdst3(lbc:ubc,nlevsno) ! mass of dust 3 in each snow layer - real(r8) :: zmdst3 ! temporary - real(r8) :: mdst4(lbc:ubc,nlevsno) ! mass of dust 4 in each snow layer - real(r8) :: zmdst4 ! temporary - real(r8) :: rds(lbc:ubc,nlevsno) - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtype components (column-level) - - snl => cps%snl - dz => cps%dz - zi => cps%zi - z => cps%z - t_soisno => ces%t_soisno - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - mss_bcphi => cps%mss_bcphi - mss_bcpho => cps%mss_bcpho - mss_ocphi => cps%mss_ocphi - mss_ocpho => cps%mss_ocpho - mss_dst1 => cps%mss_dst1 - mss_dst2 => cps%mss_dst2 - mss_dst3 => cps%mss_dst3 - mss_dst4 => cps%mss_dst4 - snw_rds => cps%snw_rds - - - ! Begin calculation - note that the following column loops are only invoked - ! for snow-covered columns - - do j = 1,nlevsno - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j <= abs(snl(c))) then - dzsno(c,j) = dz(c,j+snl(c)) - swice(c,j) = h2osoi_ice(c,j+snl(c)) - swliq(c,j) = h2osoi_liq(c,j+snl(c)) - tsno(c,j) = t_soisno(c,j+snl(c)) - - mbc_phi(c,j) = mss_bcphi(c,j+snl(c)) - mbc_pho(c,j) = mss_bcpho(c,j+snl(c)) - moc_phi(c,j) = mss_ocphi(c,j+snl(c)) - moc_pho(c,j) = mss_ocpho(c,j+snl(c)) - mdst1(c,j) = mss_dst1(c,j+snl(c)) - mdst2(c,j) = mss_dst2(c,j+snl(c)) - mdst3(c,j) = mss_dst3(c,j+snl(c)) - mdst4(c,j) = mss_dst4(c,j+snl(c)) - rds(c,j) = snw_rds(c,j+snl(c)) - - end if - end do - end do - - do fc = 1, num_snowc - c = filter_snowc(fc) - - msno = abs(snl(c)) - - if (msno == 1) then - ! Specify a new snow layer - if (dzsno(c,1) > 0.03_r8) then - msno = 2 - dzsno(c,1) = dzsno(c,1)/2._r8 - swice(c,1) = swice(c,1)/2._r8 - swliq(c,1) = swliq(c,1)/2._r8 - dzsno(c,2) = dzsno(c,1) - swice(c,2) = swice(c,1) - swliq(c,2) = swliq(c,1) - tsno(c,2) = tsno(c,1) - - mbc_phi(c,1) = mbc_phi(c,1)/2._r8 - mbc_phi(c,2) = mbc_phi(c,1) - mbc_pho(c,1) = mbc_pho(c,1)/2._r8 - mbc_pho(c,2) = mbc_pho(c,1) - moc_phi(c,1) = moc_phi(c,1)/2._r8 - moc_phi(c,2) = moc_phi(c,1) - moc_pho(c,1) = moc_pho(c,1)/2._r8 - moc_pho(c,2) = moc_pho(c,1) - mdst1(c,1) = mdst1(c,1)/2._r8 - mdst1(c,2) = mdst1(c,1) - mdst2(c,1) = mdst2(c,1)/2._r8 - mdst2(c,2) = mdst2(c,1) - mdst3(c,1) = mdst3(c,1)/2._r8 - mdst3(c,2) = mdst3(c,1) - mdst4(c,1) = mdst4(c,1)/2._r8 - mdst4(c,2) = mdst4(c,1) - rds(c,2) = rds(c,1) - - end if - end if - - if (msno > 1) then - if (dzsno(c,1) > 0.02_r8) then - drr = dzsno(c,1) - 0.02_r8 - propor = drr/dzsno(c,1) - zwice = propor*swice(c,1) - zwliq = propor*swliq(c,1) - - zmbc_phi = propor*mbc_phi(c,1) - zmbc_pho = propor*mbc_pho(c,1) - zmoc_phi = propor*moc_phi(c,1) - zmoc_pho = propor*moc_pho(c,1) - zmdst1 = propor*mdst1(c,1) - zmdst2 = propor*mdst2(c,1) - zmdst3 = propor*mdst3(c,1) - zmdst4 = propor*mdst4(c,1) - - propor = 0.02_r8/dzsno(c,1) - swice(c,1) = propor*swice(c,1) - swliq(c,1) = propor*swliq(c,1) - - mbc_phi(c,1) = propor*mbc_phi(c,1) - mbc_pho(c,1) = propor*mbc_pho(c,1) - moc_phi(c,1) = propor*moc_phi(c,1) - moc_pho(c,1) = propor*moc_pho(c,1) - mdst1(c,1) = propor*mdst1(c,1) - mdst2(c,1) = propor*mdst2(c,1) - mdst3(c,1) = propor*mdst3(c,1) - mdst4(c,1) = propor*mdst4(c,1) - - dzsno(c,1) = 0.02_r8 - - mbc_phi(c,2) = mbc_phi(c,2)+zmbc_phi ! (combo) - mbc_pho(c,2) = mbc_pho(c,2)+zmbc_pho ! (combo) - moc_phi(c,2) = moc_phi(c,2)+zmoc_phi ! (combo) - moc_pho(c,2) = moc_pho(c,2)+zmoc_pho ! (combo) - mdst1(c,2) = mdst1(c,2)+zmdst1 ! (combo) - mdst2(c,2) = mdst2(c,2)+zmdst2 ! (combo) - mdst3(c,2) = mdst3(c,2)+zmdst3 ! (combo) - mdst4(c,2) = mdst4(c,2)+zmdst4 ! (combo) - rds(c,2) = rds(c,1) ! (combo) - - call Combo (dzsno(c,2), swliq(c,2), swice(c,2), tsno(c,2), drr, & - zwliq, zwice, tsno(c,1)) - - ! Subdivide a new layer - if (msno <= 2 .and. dzsno(c,2) > 0.07_r8) then - msno = 3 - dtdz = (tsno(c,1) - tsno(c,2))/((dzsno(c,1)+dzsno(c,2))/2._r8) - dzsno(c,2) = dzsno(c,2)/2._r8 - swice(c,2) = swice(c,2)/2._r8 - swliq(c,2) = swliq(c,2)/2._r8 - dzsno(c,3) = dzsno(c,2) - swice(c,3) = swice(c,2) - swliq(c,3) = swliq(c,2) - tsno(c,3) = tsno(c,2) - dtdz*dzsno(c,2)/2._r8 - if (tsno(c,3) >= tfrz) then - tsno(c,3) = tsno(c,2) - else - tsno(c,2) = tsno(c,2) + dtdz*dzsno(c,2)/2._r8 - endif - - mbc_phi(c,2) = mbc_phi(c,2)/2._r8 - mbc_phi(c,3) = mbc_phi(c,2) - mbc_pho(c,2) = mbc_pho(c,2)/2._r8 - mbc_pho(c,3) = mbc_pho(c,2) - moc_phi(c,2) = moc_phi(c,2)/2._r8 - moc_phi(c,3) = moc_phi(c,2) - moc_pho(c,2) = moc_pho(c,2)/2._r8 - moc_pho(c,3) = moc_pho(c,2) - mdst1(c,2) = mdst1(c,2)/2._r8 - mdst1(c,3) = mdst1(c,2) - mdst2(c,2) = mdst2(c,2)/2._r8 - mdst2(c,3) = mdst2(c,2) - mdst3(c,2) = mdst3(c,2)/2._r8 - mdst3(c,3) = mdst3(c,2) - mdst4(c,2) = mdst4(c,2)/2._r8 - mdst4(c,3) = mdst4(c,2) - rds(c,3) = rds(c,2) - - end if - end if - end if - - if (msno > 2) then - if (dzsno(c,2) > 0.05_r8) then - drr = dzsno(c,2) - 0.05_r8 - propor = drr/dzsno(c,2) - zwice = propor*swice(c,2) - zwliq = propor*swliq(c,2) - - zmbc_phi = propor*mbc_phi(c,2) - zmbc_pho = propor*mbc_pho(c,2) - zmoc_phi = propor*moc_phi(c,2) - zmoc_pho = propor*moc_pho(c,2) - zmdst1 = propor*mdst1(c,2) - zmdst2 = propor*mdst2(c,2) - zmdst3 = propor*mdst3(c,2) - zmdst4 = propor*mdst4(c,2) - - propor = 0.05_r8/dzsno(c,2) - swice(c,2) = propor*swice(c,2) - swliq(c,2) = propor*swliq(c,2) - - mbc_phi(c,2) = propor*mbc_phi(c,2) - mbc_pho(c,2) = propor*mbc_pho(c,2) - moc_phi(c,2) = propor*moc_phi(c,2) - moc_pho(c,2) = propor*moc_pho(c,2) - mdst1(c,2) = propor*mdst1(c,2) - mdst2(c,2) = propor*mdst2(c,2) - mdst3(c,2) = propor*mdst3(c,2) - mdst4(c,2) = propor*mdst4(c,2) - - dzsno(c,2) = 0.05_r8 - - mbc_phi(c,3) = mbc_phi(c,3)+zmbc_phi ! (combo) - mbc_pho(c,3) = mbc_pho(c,3)+zmbc_pho ! (combo) - moc_phi(c,3) = moc_phi(c,3)+zmoc_phi ! (combo) - moc_pho(c,3) = moc_pho(c,3)+zmoc_pho ! (combo) - mdst1(c,3) = mdst1(c,3)+zmdst1 ! (combo) - mdst2(c,3) = mdst2(c,3)+zmdst2 ! (combo) - mdst3(c,3) = mdst3(c,3)+zmdst3 ! (combo) - mdst4(c,3) = mdst4(c,3)+zmdst4 ! (combo) - rds(c,3) = rds(c,2) ! (combo) - - call Combo (dzsno(c,3), swliq(c,3), swice(c,3), tsno(c,3), drr, & - zwliq, zwice, tsno(c,2)) - - ! Subdivided a new layer - if (msno <= 3 .and. dzsno(c,3) > 0.18_r8) then - msno = 4 - dtdz = (tsno(c,2) - tsno(c,3))/((dzsno(c,2)+dzsno(c,3))/2._r8) - dzsno(c,3) = dzsno(c,3)/2._r8 - swice(c,3) = swice(c,3)/2._r8 - swliq(c,3) = swliq(c,3)/2._r8 - dzsno(c,4) = dzsno(c,3) - swice(c,4) = swice(c,3) - swliq(c,4) = swliq(c,3) - tsno(c,4) = tsno(c,3) - dtdz*dzsno(c,3)/2._r8 - if (tsno(c,4) >= tfrz) then - tsno(c,4) = tsno(c,3) - else - tsno(c,3) = tsno(c,3) + dtdz*dzsno(c,3)/2._r8 - endif - - mbc_phi(c,3) = mbc_phi(c,3)/2._r8 - mbc_phi(c,4) = mbc_phi(c,3) - mbc_pho(c,3) = mbc_pho(c,3)/2._r8 - mbc_pho(c,4) = mbc_pho(c,3) - moc_phi(c,3) = moc_phi(c,3)/2._r8 - moc_phi(c,4) = moc_phi(c,3) - moc_pho(c,3) = moc_pho(c,3)/2._r8 - moc_pho(c,4) = moc_pho(c,3) - mdst1(c,3) = mdst1(c,3)/2._r8 - mdst1(c,4) = mdst1(c,3) - mdst2(c,3) = mdst2(c,3)/2._r8 - mdst2(c,4) = mdst2(c,3) - mdst3(c,3) = mdst3(c,3)/2._r8 - mdst3(c,4) = mdst3(c,3) - mdst4(c,3) = mdst4(c,3)/2._r8 - mdst4(c,4) = mdst4(c,3) - rds(c,4) = rds(c,3) - - end if - end if - end if - - if (msno > 3) then - if (dzsno(c,3) > 0.11_r8) then - drr = dzsno(c,3) - 0.11_r8 - propor = drr/dzsno(c,3) - zwice = propor*swice(c,3) - zwliq = propor*swliq(c,3) - - zmbc_phi = propor*mbc_phi(c,3) - zmbc_pho = propor*mbc_pho(c,3) - zmoc_phi = propor*moc_phi(c,3) - zmoc_pho = propor*moc_pho(c,3) - zmdst1 = propor*mdst1(c,3) - zmdst2 = propor*mdst2(c,3) - zmdst3 = propor*mdst3(c,3) - zmdst4 = propor*mdst4(c,3) - - propor = 0.11_r8/dzsno(c,3) - swice(c,3) = propor*swice(c,3) - swliq(c,3) = propor*swliq(c,3) - - mbc_phi(c,3) = propor*mbc_phi(c,3) - mbc_pho(c,3) = propor*mbc_pho(c,3) - moc_phi(c,3) = propor*moc_phi(c,3) - moc_pho(c,3) = propor*moc_pho(c,3) - mdst1(c,3) = propor*mdst1(c,3) - mdst2(c,3) = propor*mdst2(c,3) - mdst3(c,3) = propor*mdst3(c,3) - mdst4(c,3) = propor*mdst4(c,3) - - dzsno(c,3) = 0.11_r8 - - mbc_phi(c,4) = mbc_phi(c,4)+zmbc_phi ! (combo) - mbc_pho(c,4) = mbc_pho(c,4)+zmbc_pho ! (combo) - moc_phi(c,4) = moc_phi(c,4)+zmoc_phi ! (combo) - moc_pho(c,4) = moc_pho(c,4)+zmoc_pho ! (combo) - mdst1(c,4) = mdst1(c,4)+zmdst1 ! (combo) - mdst2(c,4) = mdst2(c,4)+zmdst2 ! (combo) - mdst3(c,4) = mdst3(c,4)+zmdst3 ! (combo) - mdst4(c,4) = mdst4(c,4)+zmdst4 ! (combo) - rds(c,4) = rds(c,3) ! (combo) - - call Combo (dzsno(c,4), swliq(c,4), swice(c,4), tsno(c,4), drr, & - zwliq, zwice, tsno(c,3)) - - ! Subdivided a new layer - if (msno <= 4 .and. dzsno(c,4) > 0.41_r8) then - msno = 5 - dtdz = (tsno(c,3) - tsno(c,4))/((dzsno(c,3)+dzsno(c,4))/2._r8) - dzsno(c,4) = dzsno(c,4)/2._r8 - swice(c,4) = swice(c,4)/2._r8 - swliq(c,4) = swliq(c,4)/2._r8 - dzsno(c,5) = dzsno(c,4) - swice(c,5) = swice(c,4) - swliq(c,5) = swliq(c,4) - tsno(c,5) = tsno(c,4) - dtdz*dzsno(c,4)/2._r8 - if (tsno(c,5) >= tfrz) then - tsno(c,5) = tsno(c,4) - else - tsno(c,4) = tsno(c,4) + dtdz*dzsno(c,4)/2._r8 - endif - - mbc_phi(c,4) = mbc_phi(c,4)/2._r8 - mbc_phi(c,5) = mbc_phi(c,4) - mbc_pho(c,4) = mbc_pho(c,4)/2._r8 - mbc_pho(c,5) = mbc_pho(c,4) - moc_phi(c,4) = moc_phi(c,4)/2._r8 - moc_phi(c,5) = moc_phi(c,4) - moc_pho(c,4) = moc_pho(c,4)/2._r8 - moc_pho(c,5) = moc_pho(c,4) - mdst1(c,4) = mdst1(c,4)/2._r8 - mdst1(c,5) = mdst1(c,4) - mdst2(c,4) = mdst2(c,4)/2._r8 - mdst2(c,5) = mdst2(c,4) - mdst3(c,4) = mdst3(c,4)/2._r8 - mdst3(c,5) = mdst3(c,4) - mdst4(c,4) = mdst4(c,4)/2._r8 - mdst4(c,5) = mdst4(c,4) - rds(c,5) = rds(c,4) - - end if - end if - end if - - if (msno > 4) then - if (dzsno(c,4) > 0.23_r8) then - drr = dzsno(c,4) - 0.23_r8 - propor = drr/dzsno(c,4) - zwice = propor*swice(c,4) - zwliq = propor*swliq(c,4) - - zmbc_phi = propor*mbc_phi(c,4) - zmbc_pho = propor*mbc_pho(c,4) - zmoc_phi = propor*moc_phi(c,4) - zmoc_pho = propor*moc_pho(c,4) - zmdst1 = propor*mdst1(c,4) - zmdst2 = propor*mdst2(c,4) - zmdst3 = propor*mdst3(c,4) - zmdst4 = propor*mdst4(c,4) - - propor = 0.23_r8/dzsno(c,4) - swice(c,4) = propor*swice(c,4) - swliq(c,4) = propor*swliq(c,4) - - mbc_phi(c,4) = propor*mbc_phi(c,4) - mbc_pho(c,4) = propor*mbc_pho(c,4) - moc_phi(c,4) = propor*moc_phi(c,4) - moc_pho(c,4) = propor*moc_pho(c,4) - mdst1(c,4) = propor*mdst1(c,4) - mdst2(c,4) = propor*mdst2(c,4) - mdst3(c,4) = propor*mdst3(c,4) - mdst4(c,4) = propor*mdst4(c,4) - - dzsno(c,4) = 0.23_r8 - - mbc_phi(c,5) = mbc_phi(c,5)+zmbc_phi ! (combo) - mbc_pho(c,5) = mbc_pho(c,5)+zmbc_pho ! (combo) - moc_phi(c,5) = moc_phi(c,5)+zmoc_phi ! (combo) - moc_pho(c,5) = moc_pho(c,5)+zmoc_pho ! (combo) - mdst1(c,5) = mdst1(c,5)+zmdst1 ! (combo) - mdst2(c,5) = mdst2(c,5)+zmdst2 ! (combo) - mdst3(c,5) = mdst3(c,5)+zmdst3 ! (combo) - mdst4(c,5) = mdst4(c,5)+zmdst4 ! (combo) - rds(c,5) = rds(c,4) ! (combo) - - call Combo (dzsno(c,5), swliq(c,5), swice(c,5), tsno(c,5), drr, & - zwliq, zwice, tsno(c,4)) - end if - end if - - snl(c) = -msno - - end do - - do j = -nlevsno+1,0 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - dz(c,j) = dzsno(c,j-snl(c)) - h2osoi_ice(c,j) = swice(c,j-snl(c)) - h2osoi_liq(c,j) = swliq(c,j-snl(c)) - t_soisno(c,j) = tsno(c,j-snl(c)) - - mss_bcphi(c,j) = mbc_phi(c,j-snl(c)) - mss_bcpho(c,j) = mbc_pho(c,j-snl(c)) - mss_ocphi(c,j) = moc_phi(c,j-snl(c)) - mss_ocpho(c,j) = moc_pho(c,j-snl(c)) - mss_dst1(c,j) = mdst1(c,j-snl(c)) - mss_dst2(c,j) = mdst2(c,j-snl(c)) - mss_dst3(c,j) = mdst3(c,j-snl(c)) - mss_dst4(c,j) = mdst4(c,j-snl(c)) - snw_rds(c,j) = rds(c,j-snl(c)) - - end if - end do - end do - - do j = 0, -nlevsno+1, -1 - do fc = 1, num_snowc - c = filter_snowc(fc) - if (j >= snl(c)+1) then - z(c,j) = zi(c,j) - 0.5_r8*dz(c,j) - zi(c,j-1) = zi(c,j) - dz(c,j) - end if - end do - end do - - end subroutine DivideSnowLayers - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Combo -! -! !INTERFACE: - subroutine Combo(dz, wliq, wice, t, dz2, wliq2, wice2, t2) -! -! !DESCRIPTION: -! Combines two elements and returns the following combined -! variables: dz, t, wliq, wice. -! The combined temperature is based on the equation: -! the sum of the enthalpies of the two elements = -! that of the combined element. -! -! !USES: - use clm_varcon, only : cpice, cpliq, tfrz, hfus -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: dz2 ! nodal thickness of 2 elements being combined [m] - real(r8), intent(in) :: wliq2 ! liquid water of element 2 [kg/m2] - real(r8), intent(in) :: wice2 ! ice of element 2 [kg/m2] - real(r8), intent(in) :: t2 ! nodal temperature of element 2 [K] - real(r8), intent(inout) :: dz ! nodal thickness of 1 elements being combined [m] - real(r8), intent(inout) :: wliq ! liquid water of element 1 - real(r8), intent(inout) :: wice ! ice of element 1 [kg/m2] - real(r8), intent(inout) :: t ! nodel temperature of elment 1 [K] -! -! !CALLED FROM: -! subroutine CombineSnowLayers in this module -! subroutine DivideSnowLayers in this module -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! -! -! !LOCAL VARIABLES: -!EOP -! - real(r8) :: dzc ! Total thickness of nodes 1 and 2 (dzc=dz+dz2). - real(r8) :: wliqc ! Combined liquid water [kg/m2] - real(r8) :: wicec ! Combined ice [kg/m2] - real(r8) :: tc ! Combined node temperature [K] - real(r8) :: h ! enthalpy of element 1 [J/m2] - real(r8) :: h2 ! enthalpy of element 2 [J/m2] - real(r8) :: hc ! temporary -!----------------------------------------------------------------------- - - dzc = dz+dz2 - wicec = (wice+wice2) - wliqc = (wliq+wliq2) - h = (cpice*wice+cpliq*wliq) * (t-tfrz)+hfus*wliq - h2= (cpice*wice2+cpliq*wliq2) * (t2-tfrz)+hfus*wliq2 - - hc = h + h2 - tc = tfrz + (hc - hfus*wliqc) / (cpice*wicec + cpliq*wliqc) - - dz = dzc - wice = wicec - wliq = wliqc - t = tc - - end subroutine Combo - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: BuildSnowFilter -! -! !INTERFACE: - subroutine BuildSnowFilter(lbc, ubc, num_nolakec, filter_nolakec, & - num_snowc, filter_snowc, & - num_nosnowc, filter_nosnowc) -! -! !DESCRIPTION: -! Constructs snow filter for use in vectorized loops for snow hydrology. -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(out) :: num_snowc ! number of column snow points in column filter - integer, intent(out) :: filter_snowc(ubc-lbc+1) ! column filter for snow points - integer, intent(out) :: num_nosnowc ! number of column non-snow points in column filter - integer, intent(out) :: filter_nosnowc(ubc-lbc+1) ! column filter for non-snow points -! -! !CALLED FROM: -! subroutine Hydrology2 in Hydrology2Mod -! subroutine CombineSnowLayers in this module -! -! !REVISION HISTORY: -! 2003 July 31: Forrest Hoffman -! -! !LOCAL VARIABLES: -! local pointers to implicit in arguments - integer , pointer :: snl(:) ! number of snow layers -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: fc, c -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtype components (column-level) - - snl => cps%snl - - ! Build snow/no-snow filters for other subroutines - - num_snowc = 0 - num_nosnowc = 0 - do fc = 1, num_nolakec - c = filter_nolakec(fc) - if (snl(c) < 0) then - num_snowc = num_snowc + 1 - filter_snowc(num_snowc) = c - else - num_nosnowc = num_nosnowc + 1 - filter_nosnowc(num_nosnowc) = c - end if - end do - - end subroutine BuildSnowFilter - -end module SnowHydrologyMod diff --git a/src_clm40/biogeophys/SoilHydrologyMod.F90 b/src_clm40/biogeophys/SoilHydrologyMod.F90 deleted file mode 100644 index e490e13542..0000000000 --- a/src_clm40/biogeophys/SoilHydrologyMod.F90 +++ /dev/null @@ -1,1243 +0,0 @@ -module SoilHydrologyMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: SoilHydrologyMod -! -! !DESCRIPTION: -! Calculate soil hydrology -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: SurfaceRunoff ! Calculate surface runoff - public :: Infiltration ! Calculate infiltration into surface soil layer - public :: SoilWater ! Calculate soil hydrology - public :: Drainage ! Calculate subsurface drainage -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 04/25/07 Keith Oleson: CLM3.5 hydrology -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SurfaceRunoff -! -! !INTERFACE: - subroutine SurfaceRunoff (lbc, ubc, lbp, ubp, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, vol_liq, icefrac) -! -! !DESCRIPTION: -! Calculate surface runoff -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_varcon , only : denice, denh2o, wimp, pondmx_urban, & - icol_roof, icol_sunwall, icol_shadewall, & - icol_road_imperv, icol_road_perv - - use clm_varpar , only : nlevsoi, maxpatch_pft - use clm_time_manager, only : get_step_size -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: lbp, ubp ! pft bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(ubc-lbc+1) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(ubc-lbc+1) ! column filter for urban points - real(r8), intent(out) :: vol_liq(lbc:ubc,1:nlevsoi) ! partial volume of liquid water in layer - real(r8), intent(out) :: icefrac(lbc:ubc,1:nlevsoi) ! fraction of ice in layer (-) -! -! !CALLED FROM: -! subroutine Hydrology2 in module Hydrology2Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 12 November 1999: Z.-L. Yang and G.-Y. Niu -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/26/02, Peter Thornton: Migrated to new data structures. -! 4/26/05, David Lawrence: Made surface runoff for dry soils a function -! of rooting fraction in top three soil layers. -! 04/25/07 Keith Oleson: Completely new routine for CLM3.5 hydrology -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! -!rtm_flood - real(r8), pointer :: qflx_floodc(:) ! column flux of flood water from RTM -!rtm_flood - integer , pointer :: cgridcell(:) ! gridcell index for each column - integer , pointer :: ctype(:) ! column type index - real(r8), pointer :: qflx_top_soil(:) !net water input into soil from top (mm/s) - real(r8), pointer :: watsat(:,:) !volumetric soil water at saturation (porosity) - real(r8), pointer :: hkdepth(:) !decay factor (m) - real(r8), pointer :: zwt(:) !water table depth (m) - real(r8), pointer :: fcov(:) !fractional impermeable area - real(r8), pointer :: fsat(:) !fractional area with water table at surface - real(r8), pointer :: dz(:,:) !layer depth (m) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) - real(r8), pointer :: wtfact(:) !maximum saturated fraction for a gridcell - real(r8), pointer :: hksat(:,:) ! hydraulic conductivity at saturation (mm H2O /s) - real(r8), pointer :: bsw(:,:) ! Clapp and Hornberger "b" - real(r8), pointer :: sucsat(:,:) ! minimum soil suction (mm) - integer , pointer :: snl(:) ! minus number of snow layers - real(r8), pointer :: qflx_evap_grnd(:) ! ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: qflx_surf(:) ! surface runoff (mm H2O /s) - real(r8), pointer :: eff_porosity(:,:) ! effective porosity = porosity - vol_ice - real(r8), pointer :: fracice(:,:) !fractional impermeability (-) -! -!EOP -! -! !OTHER LOCAL VARIABLES: -! - integer :: c,j,fc,g !indices - real(r8) :: dtime ! land model time step (sec) - real(r8) :: xs(lbc:ubc) ! excess soil water above urban ponding limit - real(r8) :: vol_ice(lbc:ubc,1:nlevsoi) !partial volume of ice lens in layer - real(r8) :: fff(lbc:ubc) !decay factor (m-1) - real(r8) :: s1 !variable to calculate qinmax - real(r8) :: su !variable to calculate qinmax - real(r8) :: v !variable to calculate qinmax - real(r8) :: qinmax !maximum infiltration capacity (mm/s) - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtype components (column-level) - -!rtm_flood - qflx_floodc => cwf%qflx_floodc -!rtm_flood - ctype => col%itype - qflx_top_soil => cwf%qflx_top_soil - qflx_surf => cwf%qflx_surf - watsat => cps%watsat - hkdepth => cps%hkdepth - dz => cps%dz - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - fcov => cws%fcov - fsat => cws%fsat - eff_porosity => cps%eff_porosity - wtfact => cps%wtfact - zwt => cws%zwt - fracice => cps%fracice - hksat => cps%hksat - bsw => cps%bsw - sucsat => cps%sucsat - snl => cps%snl - qflx_evap_grnd => pwf_a%qflx_evap_grnd - zi => cps%zi - - ! Get time step - - dtime = get_step_size() - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Porosity of soil, partial volume of ice and liquid, fraction of ice in each layer, - ! fractional impermeability - - vol_ice(c,j) = min(watsat(c,j), h2osoi_ice(c,j)/(dz(c,j)*denice)) - eff_porosity(c,j) = max(0.01_r8,watsat(c,j)-vol_ice(c,j)) - vol_liq(c,j) = min(eff_porosity(c,j), h2osoi_liq(c,j)/(dz(c,j)*denh2o)) - - icefrac(c,j) = min(1._r8,h2osoi_ice(c,j)/(h2osoi_ice(c,j)+h2osoi_liq(c,j))) - - fracice(c,j) = max(0._r8,exp(-3._r8*(1._r8-icefrac(c,j)))- exp(-3._r8))/(1.0_r8-exp(-3._r8)) - end do - end do - - ! Saturated fraction - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - fff(c) = 0.5_r8 - fsat(c) = wtfact(c) * exp(-0.5_r8*fff(c)*zwt(c)) - fcov(c) = (1._r8 - fracice(c,1)) * fsat(c) + fracice(c,1) - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Maximum infiltration capacity - s1 = max(0.01_r8,vol_liq(c,1)/max(wimp,eff_porosity(c,1))) - su = max(0._r8,(s1-fcov(c)) / (max(0.01_r8,1._r8-fcov(c)))) - v = -bsw(c,1)*sucsat(c,1)/(0.5_r8*dz(c,1)*1000._r8) - qinmax = (1._r8+v*(su-1._r8))*hksat(c,1) - - ! Surface runoff - qflx_surf(c) = fcov(c) * qflx_top_soil(c) + & - (1._r8-fcov(c)) * max(0._r8, qflx_top_soil(c)-qinmax) - - end do - - ! Determine water in excess of ponding limit for urban roof and impervious road. - ! Excess goes to surface runoff. No surface runoff for sunwall and shadewall. - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (ctype(c) == icol_roof .or. ctype(c) == icol_road_imperv) then - - ! If there are snow layers then all qflx_top_soil goes to surface runoff - if (snl(c) < 0) then - qflx_surf(c) = max(0._r8,qflx_top_soil(c)) - else - xs(c) = max(0._r8, & - h2osoi_liq(c,1)/dtime + qflx_top_soil(c) - qflx_evap_grnd(c) - & - pondmx_urban/dtime) - if (xs(c) > 0.) then - h2osoi_liq(c,1) = pondmx_urban - else - h2osoi_liq(c,1) = max(0._r8,h2osoi_liq(c,1)+ & - (qflx_top_soil(c)-qflx_evap_grnd(c))*dtime) - end if - qflx_surf(c) = xs(c) - end if - else if (ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall) then - qflx_surf(c) = 0._r8 - end if -!rtm_flood: send flood water flux to runoff for all urban columns - qflx_surf(c) = qflx_surf(c) + qflx_floodc(c) -!rtm_flood - end do - -!rtm_flood: add qflx_flood to qflx_top_soil -!dir$ concurrent -!cdir nodep - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qflx_top_soil(c) = qflx_top_soil(c) + qflx_floodc(c) - end do - end subroutine SurfaceRunoff - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Infiltration -! -! !INTERFACE: - subroutine Infiltration(lbc, ubc, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc) -! -! !DESCRIPTION: -! Calculate infiltration into surface soil layer (minus the evaporation) -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_varcon , only : icol_roof, icol_road_imperv, icol_sunwall, icol_shadewall, & - icol_road_perv - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer, intent(in) :: filter_hydrologyc(ubc-lbc+1) ! column filter for soil points - integer, intent(in) :: num_urbanc ! number of column urban points in column filter - integer, intent(in) :: filter_urbanc(ubc-lbc+1) ! column filter for urban points -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 12 November 1999: Z.-L. Yang and G.-Y. Niu -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/27/02, Peter Thornton: Migrated to new data structures. -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: ctype(:) ! column type index - integer , pointer :: snl(:) ! minus number of snow layers - real(r8), pointer :: qflx_top_soil(:) ! net water input into soil from top (mm/s) - real(r8), pointer :: qflx_surf(:) ! surface runoff (mm H2O /s) - real(r8), pointer :: qflx_evap_grnd(:)! ground surface evaporation rate (mm H2O/s) [+] -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: qflx_infl(:) !infiltration (mm H2O /s) -! -!EOP -! -! !OTHER LOCAL VARIABLES: -! - integer :: c, fc !indices -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (column-level) - - ctype => col%itype - snl => cps%snl - qflx_top_soil => cwf%qflx_top_soil - qflx_surf => cwf%qflx_surf - qflx_infl => cwf%qflx_infl - qflx_evap_grnd => pwf_a%qflx_evap_grnd - - ! Infiltration into surface soil layer (minus the evaporation) - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (snl(c) >= 0) then - qflx_infl(c) = qflx_top_soil(c) - qflx_surf(c) - qflx_evap_grnd(c) - else - qflx_infl(c) = qflx_top_soil(c) - qflx_surf(c) - end if - end do - - ! No infiltration for impervious urban surfaces - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (ctype(c) /= icol_road_perv) then - qflx_infl(c) = 0._r8 - end if - end do - - end subroutine Infiltration - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SoilWater -! -! !INTERFACE: - subroutine SoilWater(lbc, ubc, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, & - vol_liq, dwat, hk, dhkdw) -! -! !DESCRIPTION: -! Soil hydrology -! Soil moisture is predicted from a 10-layer model (as with soil -! temperature), in which the vertical soil moisture transport is governed -! by infiltration, runoff, gradient diffusion, gravity, and root -! extraction through canopy transpiration. The net water applied to the -! surface layer is the snowmelt plus precipitation plus the throughfall -! of canopy dew minus surface runoff and evaporation. -! CLM3.5 uses a zero-flow bottom boundary condition. -! -! The vertical water flow in an unsaturated porous media is described by -! Darcy's law, and the hydraulic conductivity and the soil negative -! potential vary with soil water content and soil texture based on the work -! of Clapp and Hornberger (1978) and Cosby et al. (1984). The equation is -! integrated over the layer thickness, in which the time rate of change in -! water mass must equal the net flow across the bounding interface, plus the -! rate of internal source or sink. The terms of water flow across the layer -! interfaces are linearly expanded by using first-order Taylor expansion. -! The equations result in a tridiagonal system equation. -! -! Note: length units here are all millimeter -! (in temperature subroutine uses same soil layer -! structure required but lengths are m) -! -! Richards equation: -! -! d wat d d wat d psi -! ----- = - -- [ k(----- ----- - 1) ] + S -! dt dz dz d wat -! -! where: wat = volume of water per volume of soil (mm**3/mm**3) -! psi = soil matrix potential (mm) -! dt = time step (s) -! z = depth (mm) -! dz = thickness (mm) -! qin = inflow at top (mm h2o /s) -! qout= outflow at bottom (mm h2o /s) -! s = source/sink flux (mm h2o /s) -! k = hydraulic conductivity (mm h2o /s) -! -! d qin d qin -! qin[n+1] = qin[n] + -------- d wat(j-1) + --------- d wat(j) -! d wat(j-1) d wat(j) -! ==================|================= -! < qin -! -! d wat(j)/dt * dz = qin[n+1] - qout[n+1] + S(j) -! -! > qout -! ==================|================= -! d qout d qout -! qout[n+1] = qout[n] + --------- d wat(j) + --------- d wat(j+1) -! d wat(j) d wat(j+1) -! -! -! Solution: linearize k and psi about d wat and use tridiagonal -! system of equations to solve for d wat, -! where for layer j -! -! -! r_j = a_j [d wat_j-1] + b_j [d wat_j] + c_j [d wat_j+1] -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_varcon , only : wimp, icol_roof, icol_road_imperv - use clm_varpar , only : nlevsoi, max_pft_per_col - use clm_varctl , only : iulog - use shr_const_mod , only : SHR_CONST_TKFRZ, SHR_CONST_LATICE, SHR_CONST_G - use TridiagonalMod, only : Tridiagonal - use clm_time_manager , only : get_step_size -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: filter_hydrologyc(ubc-lbc+1) ! column filter for soil points - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(ubc-lbc+1) ! column filter for urban points - real(r8), intent(in) :: vol_liq(lbc:ubc,1:nlevsoi) ! soil water per unit volume [mm/mm] - real(r8), intent(out) :: dwat(lbc:ubc,1:nlevsoi) ! change of soil water [m3/m3] - real(r8), intent(out) :: hk(lbc:ubc,1:nlevsoi) ! hydraulic conductivity [mm h2o/s] - real(r8), intent(out) :: dhkdw(lbc:ubc,1:nlevsoi) ! d(hk)/d(vol_liq) -! -! !CALLED FROM: -! subroutine Hydrology2 in module Hydrology2Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/27/02, Peter Thornton: Migrated to new data structures. Includes -! treatment of multiple PFTs on a single soil column. -! 04/25/07 Keith Oleson: CLM3.5 hydrology -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: ctype(:) ! column type index - integer , pointer :: npfts(:) ! column's number of pfts - ADD - real(r8), pointer :: pwtcol(:) ! weight relative to column for each pft - real(r8), pointer :: pwtgcell(:) ! weight relative to gridcell for each pft - real(r8), pointer :: z(:,:) ! layer depth (m) - real(r8), pointer :: dz(:,:) ! layer thickness (m) - real(r8), pointer :: smpmin(:) ! restriction for min of soil potential (mm) - real(r8), pointer :: qflx_infl(:) ! infiltration (mm H2O /s) - real(r8), pointer :: qflx_tran_veg_pft(:) ! vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg_col(:) ! vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: eff_porosity(:,:) ! effective porosity = porosity - vol_ice - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) - real(r8), pointer :: hksat(:,:) ! hydraulic conductivity at saturation (mm H2O /s) - real(r8), pointer :: bsw(:,:) ! Clapp and Hornberger "b" - real(r8), pointer :: sucsat(:,:) ! minimum soil suction (mm) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: rootr_pft(:,:) ! effective fraction of roots in each soil layer - integer , pointer :: pfti(:) ! beginning pft index for each column - real(r8), pointer :: fracice(:,:) ! fractional impermeability (-) - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - real(r8), pointer :: qcharge(:) ! aquifer recharge rate (mm/s) - real(r8), pointer :: hkdepth(:) ! decay factor (m) - real(r8), pointer :: zwt(:) ! water table depth (m) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) -! -! local pointers to original implicit inout arguments -! - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) -! -! local pointer s to original implicit out arguments -! - real(r8), pointer :: rootr_col(:,:) ! effective fraction of roots in each soil layer - real(r8), pointer :: smp_l(:,:) ! soil matrix potential [mm] - real(r8), pointer :: hk_l(:,:) ! hydraulic conductivity (mm/s) -! -!EOP -! -! !OTHER LOCAL VARIABLES: -! - integer :: p,c,fc,j ! do loop indices - integer :: jtop(lbc:ubc) ! top level at each column - real(r8) :: dtime ! land model time step (sec) - real(r8) :: amx(lbc:ubc,1:nlevsoi+1) ! "a" left off diagonal of tridiagonal matrix - real(r8) :: bmx(lbc:ubc,1:nlevsoi+1) ! "b" diagonal column for tridiagonal matrix - real(r8) :: cmx(lbc:ubc,1:nlevsoi+1) ! "c" right off diagonal tridiagonal matrix - real(r8) :: rmx(lbc:ubc,1:nlevsoi+1) ! "r" forcing term of tridiagonal matrix - real(r8) :: zmm(lbc:ubc,1:nlevsoi+1) ! layer depth [mm] - real(r8) :: dzmm(lbc:ubc,1:nlevsoi+1) ! layer thickness [mm] - real(r8) :: den ! used in calculating qin, qout - real(r8) :: dqidw0(lbc:ubc,1:nlevsoi+1) ! d(qin)/d(vol_liq(i-1)) - real(r8) :: dqidw1(lbc:ubc,1:nlevsoi+1) ! d(qin)/d(vol_liq(i)) - real(r8) :: dqodw1(lbc:ubc,1:nlevsoi+1) ! d(qout)/d(vol_liq(i)) - real(r8) :: dqodw2(lbc:ubc,1:nlevsoi+1) ! d(qout)/d(vol_liq(i+1)) - real(r8) :: dsmpdw(lbc:ubc,1:nlevsoi+1) ! d(smp)/d(vol_liq) - real(r8) :: num ! used in calculating qin, qout - real(r8) :: qin(lbc:ubc,1:nlevsoi+1) ! flux of water into soil layer [mm h2o/s] - real(r8) :: qout(lbc:ubc,1:nlevsoi+1) ! flux of water out of soil layer [mm h2o/s] - real(r8) :: s_node ! soil wetness - real(r8) :: s1 ! "s" at interface of layer - real(r8) :: s2 ! k*s**(2b+2) - real(r8) :: smp(lbc:ubc,1:nlevsoi) ! soil matrix potential [mm] - real(r8) :: sdamp ! extrapolates soiwat dependence of evaporation - integer :: pi ! pft index - real(r8) :: temp(lbc:ubc) ! accumulator for rootr weighting - integer :: jwt(lbc:ubc) ! index of the soil layer right above the water table (-) - real(r8) :: smp1,dsmpdw1,wh,wh_zwt,ka - real(r8) :: dwat2(lbc:ubc,1:nlevsoi+1) - real(r8) :: dzq ! used in calculating qin, qout (difference in equilbirium matric potential) - real(r8) :: zimm(lbc:ubc,0:nlevsoi) ! layer interface depth [mm] - real(r8) :: zq(lbc:ubc,1:nlevsoi+1) ! equilibrium matric potential for each layer [mm] - real(r8) :: vol_eq(lbc:ubc,1:nlevsoi+1) ! equilibrium volumetric water content - real(r8) :: tempi ! temp variable for calculating vol_eq - real(r8) :: temp0 ! temp variable for calculating vol_eq - real(r8) :: voleq1 ! temp variable for calculating vol_eq - real(r8) :: zwtmm(lbc:ubc) ! water table depth [mm] -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (column-level) - - qcharge => cws%qcharge - hkdepth => cps%hkdepth - zi => cps%zi - zwt => cws%zwt - ctype => col%itype - npfts => col%npfts - z => cps%z - dz => cps%dz - smpmin => cps%smpmin - watsat => cps%watsat - hksat => cps%hksat - bsw => cps%bsw - sucsat => cps%sucsat - eff_porosity => cps%eff_porosity - rootr_col => cps%rootr_column - t_soisno => ces%t_soisno - h2osoi_liq => cws%h2osoi_liq - h2osoi_vol => cws%h2osoi_vol - qflx_infl => cwf%qflx_infl - fracice => cps%fracice - qflx_tran_veg_col => pwf_a%qflx_tran_veg - pfti => col%pfti - smp_l => cws%smp_l - hk_l => cws%hk_l - - ! Assign local pointers to derived type members (pft-level) - - qflx_tran_veg_pft => pwf%qflx_tran_veg - rootr_pft => pps%rootr - pwtcol => pft%wtcol - pwtgcell => pft%wtgcell - - ! Get time step - - dtime = get_step_size() - - ! Because the depths in this routine are in mm, use local - ! variable arrays instead of pointers - - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - zmm(c,j) = z(c,j)*1.e3_r8 - dzmm(c,j) = dz(c,j)*1.e3_r8 - zimm(c,j) = zi(c,j)*1.e3_r8 - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - zimm(c,0) = 0.0_r8 - zwtmm(c) = zwt(c)*1.e3_r8 - end do - - ! First step is to calculate the column-level effective rooting - ! fraction in each soil layer. This is done outside the usual - ! PFT-to-column averaging routines because it is not a simple - ! weighted average of the PFT level rootr arrays. Instead, the - ! weighting depends on both the per-unit-area transpiration - ! of the PFT and the PFTs area relative to all PFTs. - - temp(:) = 0._r8 - - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - rootr_col(c,j) = 0._r8 - end do - end do - - do pi = 1,max_pft_per_col - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - if (pwtgcell(p)>0._r8) then - rootr_col(c,j) = rootr_col(c,j) + rootr_pft(p,j) * qflx_tran_veg_pft(p) * pwtcol(p) - end if - end if - end do - end do - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - if (pwtgcell(p)>0._r8) then - temp(c) = temp(c) + qflx_tran_veg_pft(p) * pwtcol(p) - end if - end if - end do - end do - - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (temp(c) /= 0._r8) then - rootr_col(c,j) = rootr_col(c,j)/temp(c) - end if - end do - end do - - !compute jwt index - ! The layer index of the first unsaturated layer, i.e., the layer right above - ! the water table - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - jwt(c) = nlevsoi - do j = 2,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - end do - - ! calculate the equilibrium water content based on the water table depth - - do j=1,nlevsoi - do fc=1, num_hydrologyc - c = filter_hydrologyc(fc) - if ((zwtmm(c) .lt. zimm(c,j-1))) then !fully saturated when wtd is less than the layer top - vol_eq(c,j) = watsat(c,j) - - ! use the weighted average from the saturated part (depth > wtd) and the equilibrium solution for the - ! rest of the layer - - else if ((zwtmm(c) .lt. zimm(c,j)) .and. (zwtmm(c) .gt. zimm(c,j-1))) then - tempi = 1.0_r8 - temp0 = (((sucsat(c,j)+zwtmm(c)-zimm(c,j-1))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - voleq1 = -sucsat(c,j)*watsat(c,j)/(1._r8-1._r8/bsw(c,j))/(zwtmm(c)-zimm(c,j-1))*(tempi-temp0) - vol_eq(c,j) = (voleq1*(zwtmm(c)-zimm(c,j-1)) + watsat(c,j)*(zimm(c,j)-zwtmm(c)))/(zimm(c,j)-zimm(c,j-1)) - vol_eq(c,j) = min(watsat(c,j),vol_eq(c,j)) - vol_eq(c,j) = max(vol_eq(c,j),0.0_r8) - else - tempi = (((sucsat(c,j)+zwtmm(c)-zimm(c,j))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - temp0 = (((sucsat(c,j)+zwtmm(c)-zimm(c,j-1))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - vol_eq(c,j) = -sucsat(c,j)*watsat(c,j)/(1._r8-1._r8/bsw(c,j))/(zimm(c,j)-zimm(c,j-1))*(tempi-temp0) - vol_eq(c,j) = max(vol_eq(c,j),0.0_r8) - vol_eq(c,j) = min(watsat(c,j),vol_eq(c,j)) - endif - zq(c,j) = -sucsat(c,j)*(max(vol_eq(c,j)/watsat(c,j),0.01_r8))**(-bsw(c,j)) - zq(c,j) = max(smpmin(c), zq(c,j)) - end do - end do - - ! If water table is below soil column calculate zq for the 11th layer - j = nlevsoi - do fc=1, num_hydrologyc - c = filter_hydrologyc(fc) - if(jwt(c) == nlevsoi) then - tempi = 1._r8 - temp0 = (((sucsat(c,j)+zwtmm(c)-zimm(c,j))/sucsat(c,j)))**(1._r8-1._r8/bsw(c,j)) - vol_eq(c,j+1) = -sucsat(c,j)*watsat(c,j)/(1._r8-1._r8/bsw(c,j))/(zwtmm(c)-zimm(c,j))*(tempi-temp0) - vol_eq(c,j+1) = max(vol_eq(c,j+1),0.0_r8) - vol_eq(c,j+1) = min(watsat(c,j),vol_eq(c,j+1)) - zq(c,j+1) = -sucsat(c,j)*(max(vol_eq(c,j+1)/watsat(c,j),0.01_r8))**(-bsw(c,j)) - zq(c,j+1) = max(smpmin(c), zq(c,j+1)) - end if - end do - - ! Hydraulic conductivity and soil matric potential and their derivatives - - sdamp = 0._r8 - do j = 1, nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - s1 = 0.5_r8*(h2osoi_vol(c,j) + h2osoi_vol(c,min(nlevsoi, j+1))) / & - (0.5_r8*(watsat(c,j)+watsat(c,min(nlevsoi, j+1)))) - s1 = min(1._r8, s1) - s2 = hksat(c,j)*s1**(2._r8*bsw(c,j)+2._r8) - - hk(c,j) = (1._r8-0.5_r8*(fracice(c,j)+fracice(c,min(nlevsoi, j+1))))*s1*s2 - - dhkdw(c,j) = (1._r8-0.5_r8*(fracice(c,j)+fracice(c,min(nlevsoi, j+1))))* & - (2._r8*bsw(c,j)+3._r8)*s2*0.5_r8/watsat(c,j) - - s_node = max(h2osoi_vol(c,j)/watsat(c,j), 0.01_r8) - s_node = min(1.0_r8, s_node) - - smp(c,j) = -sucsat(c,j)*s_node**(-bsw(c,j)) - smp(c,j) = max(smpmin(c), smp(c,j)) - - dsmpdw(c,j) = -bsw(c,j)*smp(c,j)/(s_node*watsat(c,j)) - - smp_l(c,j) = smp(c,j) - hk_l(c,j) = hk(c,j) - - end do - end do - - ! aquifer (11th) layer - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - zmm(c,nlevsoi+1) = 0.5*(1.e3_r8*zwt(c) + zmm(c,nlevsoi)) - if(jwt(c) < nlevsoi) then - dzmm(c,nlevsoi+1) = dzmm(c,nlevsoi) - else - dzmm(c,nlevsoi+1) = (1.e3_r8*zwt(c) - zmm(c,nlevsoi)) - end if - end do - - ! Set up r, a, b, and c vectors for tridiagonal solution - - ! Node j=1 (top) - - j = 1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qin(c,j) = qflx_infl(c) - den = (zmm(c,j+1)-zmm(c,j)) - dzq = (zq(c,j+1)-zq(c,j)) - num = (smp(c,j+1)-smp(c,j)) - dzq - qout(c,j) = -hk(c,j)*num/den - dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_tran_veg_col(c) * rootr_col(c,j) - amx(c,j) = 0._r8 - bmx(c,j) = dzmm(c,j)*(sdamp+1._r8/dtime) + dqodw1(c,j) - cmx(c,j) = dqodw2(c,j) - end do - - ! Nodes j=2 to j=nlevsoi-1 - - do j = 2, nlevsoi - 1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - den = (zmm(c,j) - zmm(c,j-1)) - dzq = (zq(c,j)-zq(c,j-1)) - num = (smp(c,j)-smp(c,j-1)) - dzq - qin(c,j) = -hk(c,j-1)*num/den - dqidw0(c,j) = -(-hk(c,j-1)*dsmpdw(c,j-1) + num*dhkdw(c,j-1))/den - dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den - den = (zmm(c,j+1)-zmm(c,j)) - dzq = (zq(c,j+1)-zq(c,j)) - num = (smp(c,j+1)-smp(c,j)) - dzq - qout(c,j) = -hk(c,j)*num/den - dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqodw2(c,j) = -( hk(c,j)*dsmpdw(c,j+1) + num*dhkdw(c,j))/den - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_tran_veg_col(c)*rootr_col(c,j) - amx(c,j) = -dqidw0(c,j) - bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) - cmx(c,j) = dqodw2(c,j) - end do - end do - - ! Node j=nlevsoi (bottom) - - j = nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if(j > jwt(c)) then !water table is in soil column - den = (zmm(c,j) - zmm(c,j-1)) - dzq = (zq(c,j)-zq(c,j-1)) - num = (smp(c,j)-smp(c,j-1)) - dzq - qin(c,j) = -hk(c,j-1)*num/den - dqidw0(c,j) = -(-hk(c,j-1)*dsmpdw(c,j-1) + num*dhkdw(c,j-1))/den - dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den - qout(c,j) = 0._r8 - dqodw1(c,j) = 0._r8 - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_tran_veg_col(c)*rootr_col(c,j) - amx(c,j) = -dqidw0(c,j) - bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) - cmx(c,j) = 0._r8 - - !scs: next set up aquifer layer; hydrologically inactive - rmx(c,j+1) = 0._r8 - amx(c,j+1) = 0._r8 - bmx(c,j+1) = dzmm(c,j+1)/dtime - cmx(c,j+1) = 0._r8 - else ! water table is below soil column - - !scs: compute aquifer soil moisture as average of layer 10 and saturation - s_node = max(0.5*(1.0_r8+h2osoi_vol(c,j)/watsat(c,j)), 0.01_r8) - s_node = min(1.0_r8, s_node) - - !scs: compute smp for aquifer layer - smp1 = -sucsat(c,j)*s_node**(-bsw(c,j)) - smp1 = max(smpmin(c), smp1) - - !scs: compute dsmpdw for aquifer layer - dsmpdw1 = -bsw(c,j)*smp1/(s_node*watsat(c,j)) - - !scs: first set up bottom layer of soil column - den = (zmm(c,j) - zmm(c,j-1)) - dzq = (zq(c,j)-zq(c,j-1)) - num = (smp(c,j)-smp(c,j-1)) - dzq - qin(c,j) = -hk(c,j-1)*num/den - dqidw0(c,j) = -(-hk(c,j-1)*dsmpdw(c,j-1) + num*dhkdw(c,j-1))/den - dqidw1(c,j) = -( hk(c,j-1)*dsmpdw(c,j) + num*dhkdw(c,j-1))/den - den = (zmm(c,j+1)-zmm(c,j)) - dzq = (zq(c,j+1)-zq(c,j)) - num = (smp1-smp(c,j)) - dzq - qout(c,j) = -hk(c,j)*num/den - dqodw1(c,j) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqodw2(c,j) = -( hk(c,j)*dsmpdw1 + num*dhkdw(c,j))/den - - rmx(c,j) = qin(c,j) - qout(c,j) - qflx_tran_veg_col(c)*rootr_col(c,j) - amx(c,j) = -dqidw0(c,j) - bmx(c,j) = dzmm(c,j)/dtime - dqidw1(c,j) + dqodw1(c,j) - cmx(c,j) = dqodw2(c,j) - - !scs: next set up aquifer layer; den/num unchanged, qin=qout - qin(c,j+1) = qout(c,j) - dqidw0(c,j+1) = -(-hk(c,j)*dsmpdw(c,j) + num*dhkdw(c,j))/den - dqidw1(c,j+1) = -( hk(c,j)*dsmpdw1 + num*dhkdw(c,j))/den - qout(c,j+1) = 0._r8 ! zero-flow bottom boundary condition - dqodw1(c,j+1) = 0._r8 ! zero-flow bottom boundary condition - rmx(c,j+1) = qin(c,j+1) - qout(c,j+1) - amx(c,j+1) = -dqidw0(c,j+1) - bmx(c,j+1) = dzmm(c,j+1)/dtime - dqidw1(c,j+1) + dqodw1(c,j+1) - cmx(c,j+1) = 0._r8 - endif - end do - - ! Solve for dwat - - jtop(:) = 1 - call Tridiagonal(lbc, ubc, 1, nlevsoi+1, jtop, num_hydrologyc, filter_hydrologyc, & - amx, bmx, cmx, rmx, dwat2 ) - !scs: set dwat - do fc = 1,num_hydrologyc - c = filter_hydrologyc(fc) - do j = 1, nlevsoi - dwat(c,j)=dwat2(c,j) - end do - end do - - ! Renew the mass of liquid water - !scs: also compute qcharge from dwat in aquifer layer - !scs: update in drainage for case jwt < nlevsoi - - do fc = 1,num_hydrologyc - c = filter_hydrologyc(fc) - do j = 1, nlevsoi - h2osoi_liq(c,j) = h2osoi_liq(c,j) + dwat2(c,j)*dzmm(c,j) - end do - - !scs: calculate qcharge for case jwt < nlevsoi - if(jwt(c) < nlevsoi) then - wh_zwt = 0._r8 !since wh_zwt = -sucsat - zq_zwt, where zq_zwt = -sucsat - - s_node = max(h2osoi_vol(c,jwt(c))/watsat(c,jwt(c)), 0.01_r8) - s_node = min(1.0_r8, s_node) - - !scs: use average moisture between water table and layer jwt - s1 = 0.5_r8*(1.0+s_node) - s1 = min(1._r8, s1) - - !scs: this is the expression for unsaturated hk - ka = hksat(c,jwt(c))*s1**(2._r8*bsw(c,jwt(c))+3._r8) - - ! Recharge rate qcharge to groundwater (positive to aquifer) - smp1 = -sucsat(c,jwt(c))*s_node**(-bsw(c,jwt(c))) - smp1 = max(smpmin(c), smp(c,jwt(c))) - wh = smp1 - zq(c,jwt(c)) - qcharge(c) = -ka * (wh_zwt-wh) /((zwt(c)-z(c,jwt(c)))*1000._r8) - - ! To limit qcharge (for the first several timesteps) - qcharge(c) = max(-10.0_r8/dtime,qcharge(c)) - qcharge(c) = min( 10.0_r8/dtime,qcharge(c)) - else - !scs: if water table is below soil column, compute qcharge from dwat2(11) - qcharge(c) = dwat2(c,nlevsoi+1)*dzmm(c,nlevsoi+1)/dtime - endif - end do - - end subroutine SoilWater - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Drainage -! -! !INTERFACE: - subroutine Drainage(lbc, ubc, num_hydrologyc, filter_hydrologyc, & - num_urbanc, filter_urbanc, vol_liq, hk, & - icefrac) -! -! !DESCRIPTION: -! Calculate subsurface drainage -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use clm_time_manager, only : get_step_size - use clm_varcon , only : pondmx, tfrz, icol_roof, icol_road_imperv, icol_road_perv, watmin - use clm_varpar , only : nlevsoi -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: num_hydrologyc ! number of column soil points in column filter - integer , intent(in) :: num_urbanc ! number of column urban points in column filter - integer , intent(in) :: filter_urbanc(ubc-lbc+1) ! column filter for urban points - integer , intent(in) :: filter_hydrologyc(ubc-lbc+1) ! column filter for soil points - real(r8), intent(in) :: vol_liq(lbc:ubc,1:nlevsoi) ! partial volume of liquid water in layer - real(r8), intent(in) :: hk(lbc:ubc,1:nlevsoi) ! hydraulic conductivity (mm h2o/s) - real(r8), intent(in) :: icefrac(lbc:ubc,1:nlevsoi) ! fraction of ice in layer -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 12 November 1999: Z.-L. Yang and G.-Y. Niu -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 4/26/05, Peter Thornton and David Lawrence: Turned off drainage from -! middle soil layers for both wet and dry fractions. -! 04/25/07 Keith Oleson: Completely new routine for CLM3.5 hydrology -! 27 February 2008: Keith Oleson; Saturation excess modification -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: ctype(:) !column type index - integer , pointer :: snl(:) !number of snow layers - real(r8), pointer :: qflx_snwcp_liq(:) !excess rainfall due to snow capping (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_grnd(:) !ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow(:) !surface dew added to snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_sub_snow(:) !sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: dz(:,:) !layer depth (m) - real(r8), pointer :: bsw(:,:) !Clapp and Hornberger "b" - real(r8), pointer :: eff_porosity(:,:) !effective porosity = porosity - vol_ice - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) - real(r8), pointer :: hksat(:,:) !hydraulic conductivity at saturation (mm H2O /s) - real(r8), pointer :: sucsat(:,:) !minimum soil suction (mm) - real(r8), pointer :: z(:,:) !layer depth (m) - real(r8), pointer :: zi(:,:) !interface level below a "z" level (m) - real(r8), pointer :: watsat(:,:) !volumetric soil water at saturation (porosity) - real(r8), pointer :: hkdepth(:) !decay factor (m) - real(r8), pointer :: zwt(:) !water table depth (m) - real(r8), pointer :: wa(:) !water in the unconfined aquifer (mm) - real(r8), pointer :: wt(:) !total water storage (unsaturated soil water + groundwater) (mm) - real(r8), pointer :: qcharge(:) !aquifer recharge rate (mm/s) -! -! local pointers to original implicit inout arguments -! - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: qflx_drain(:) !sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_irrig(:) !irrigation flux (mm H2O /s) - real(r8), pointer :: qflx_qrgwl(:) !qflx_surf at glaciers, wetlands, lakes (mm H2O /s) - real(r8), pointer :: eflx_impsoil(:) !implicit evaporation for soil temperature equation - real(r8), pointer :: qflx_rsub_sat(:) !soil saturation excess [mm h2o/s] -! -!EOP -! -! !OTHER LOCAL VARIABLES: -! - integer :: c,j,fc,i !indices - real(r8) :: dtime !land model time step (sec) - real(r8) :: xs(lbc:ubc) !water needed to bring soil moisture to watmin (mm) - real(r8) :: dzmm(lbc:ubc,1:nlevsoi) !layer thickness (mm) - integer :: jwt(lbc:ubc) !index of the soil layer right above the water table (-) - real(r8) :: rsub_bot(lbc:ubc) !subsurface runoff - bottom drainage (mm/s) - real(r8) :: rsub_top(lbc:ubc) !subsurface runoff - topographic control (mm/s) - real(r8) :: fff(lbc:ubc) !decay factor (m-1) - real(r8) :: xsi(lbc:ubc) !excess soil water above saturation at layer i (mm) - real(r8) :: xsia(lbc:ubc) !available pore space at layer i (mm) - real(r8) :: xs1(lbc:ubc) !excess soil water above saturation at layer 1 (mm) - real(r8) :: smpfz(1:nlevsoi) !matric potential of layer right above water table (mm) - real(r8) :: wtsub !summation of hk*dzmm for layers below water table (mm**2/s) - real(r8) :: rous !aquifer yield (-) - real(r8) :: wh !smpfz(jwt)-z(jwt) (mm) - real(r8) :: wh_zwt !water head at the water table depth (mm) - real(r8) :: ws !summation of pore space of layers below water table (mm) - real(r8) :: s_node !soil wetness (-) - real(r8) :: dzsum !summation of dzmm of layers below water table (mm) - real(r8) :: icefracsum !summation of icefrac*dzmm of layers below water table (-) - real(r8) :: fracice_rsub(lbc:ubc) !fractional impermeability of soil layers (-) - real(r8) :: ka !hydraulic conductivity of the aquifer (mm/s) - real(r8) :: dza !fff*(zwt-z(jwt)) (-) - real(r8) :: available_h2osoi_liq !available soil liquid water in a layer -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype -! cgridcell => col%gridcell - - snl => cps%snl - dz => cps%dz - bsw => cps%bsw - t_soisno => ces%t_soisno - hksat => cps%hksat - sucsat => cps%sucsat - z => cps%z - zi => cps%zi - watsat => cps%watsat - hkdepth => cps%hkdepth - zwt => cws%zwt - wa => cws%wa - wt => cws%wt - qcharge => cws%qcharge - eff_porosity => cps%eff_porosity - qflx_snwcp_liq => pwf_a%qflx_snwcp_liq - qflx_dew_grnd => pwf_a%qflx_dew_grnd - qflx_dew_snow => pwf_a%qflx_dew_snow - qflx_sub_snow => pwf_a%qflx_sub_snow - qflx_drain => cwf%qflx_drain - qflx_irrig => cwf%qflx_irrig - qflx_qrgwl => cwf%qflx_qrgwl - qflx_rsub_sat => cwf%qflx_rsub_sat - eflx_impsoil => cef%eflx_impsoil - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - - ! Get time step - - dtime = get_step_size() - - ! Convert layer thicknesses from m to mm - - do j = 1,nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - dzmm(c,j) = dz(c,j)*1.e3_r8 - end do - end do - - ! Initial set - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - qflx_drain(c) = 0._r8 - rsub_bot(c) = 0._r8 - qflx_rsub_sat(c) = 0._r8 - rsub_top(c) = 0._r8 - fracice_rsub(c) = 0._r8 - end do - - ! The layer index of the first unsaturated layer, i.e., the layer right above - ! the water table - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - jwt(c) = nlevsoi - do j = 2,nlevsoi - if(zwt(c) <= zi(c,j)) then - jwt(c) = j-1 - exit - end if - enddo - end do - - ! Topographic runoff - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - fff(c) = 1._r8/ hkdepth(c) - dzsum = 0._r8 - icefracsum = 0._r8 - do j = jwt(c), nlevsoi - dzsum = dzsum + dzmm(c,j) - icefracsum = icefracsum + icefrac(c,j) * dzmm(c,j) - end do - fracice_rsub(c) = max(0._r8,exp(-3._r8*(1._r8-(icefracsum/dzsum)))- exp(-3._r8))/(1.0_r8-exp(-3._r8)) - rsub_top(c) = (1._r8 - fracice_rsub(c)) * 5.5e-3_r8 * exp(-fff(c)*zwt(c)) - end do - - rous = 0.2_r8 - - ! Water table calculation - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Water storage in aquifer + soil - wt(c) = wt(c) + (qcharge(c) - rsub_top(c)) * dtime - - if(jwt(c) == nlevsoi) then ! water table is below the soil column - wa(c) = wa(c) + (qcharge(c) -rsub_top(c)) * dtime - wt(c) = wa(c) - zwt(c) = (zi(c,nlevsoi) + 25._r8) - wa(c)/1000._r8/rous - h2osoi_liq(c,nlevsoi) = h2osoi_liq(c,nlevsoi) + max(0._r8,(wa(c)-5000._r8)) - wa(c) = min(wa(c), 5000._r8) - else ! water table within soil layers - if (jwt(c) == nlevsoi-1) then ! water table within bottom soil layer - - zwt(c) = zi(c,nlevsoi)- (wt(c)-rous*1000._r8*25._r8) /eff_porosity(c,nlevsoi)/1000._r8 - - else ! water table within soil layers 1-9 - ws = 0._r8 ! water used to fill soil air pores regardless of water content - do j = jwt(c)+2,nlevsoi - ws = ws + eff_porosity(c,j) * 1000._r8 * dz(c,j) - enddo - zwt(c) = zi(c,jwt(c)+1)-(wt(c)-rous*1000_r8*25._r8-ws) /eff_porosity(c,jwt(c)+1)/1000._r8 - endif - - wtsub = 0._r8 - do j = jwt(c)+1, nlevsoi - wtsub = wtsub + hk(c,j)*dzmm(c,j) - end do - - ! Remove subsurface runoff - do j = jwt(c)+1, nlevsoi - h2osoi_liq(c,j) = h2osoi_liq(c,j) - rsub_top(c)*dtime*hk(c,j)*dzmm(c,j)/wtsub - end do - end if - - zwt(c) = max(0.05_r8,zwt(c)) - zwt(c) = min(80._r8,zwt(c)) - - end do - - ! excessive water above saturation added to the above unsaturated layer like a bucket - ! if column fully saturated, excess water goes to runoff - - do j = nlevsoi,2,-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - xsi(c) = max(h2osoi_liq(c,j)-eff_porosity(c,j)*dzmm(c,j),0._r8) - h2osoi_liq(c,j) = min(eff_porosity(c,j)*dzmm(c,j), h2osoi_liq(c,j)) - h2osoi_liq(c,j-1) = h2osoi_liq(c,j-1) + xsi(c) - end do - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - xs1(c) = max(max(h2osoi_liq(c,1),0._r8)-max(0._r8,(pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1))),0._r8) - h2osoi_liq(c,1) = min(max(0._r8,pondmx+watsat(c,1)*dzmm(c,1)-h2osoi_ice(c,1)), h2osoi_liq(c,1)) - qflx_rsub_sat(c) = xs1(c) / dtime - end do - - ! Limit h2osoi_liq to be greater than or equal to watmin. - ! Get water needed to bring h2osoi_liq equal watmin from lower layer. - ! If insufficient water in soil layers, get from aquifer water - - do j = 1, nlevsoi-1 - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin - h2osoi_liq(c,j) - else - xs(c) = 0._r8 - end if - h2osoi_liq(c,j ) = h2osoi_liq(c,j ) + xs(c) - h2osoi_liq(c,j+1) = h2osoi_liq(c,j+1) - xs(c) - end do - end do - -! Get water for bottom layer from layers above if possible - j = nlevsoi - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - if (h2osoi_liq(c,j) < watmin) then - xs(c) = watmin-h2osoi_liq(c,j) - searchforwater: do i = nlevsoi-1, 1, -1 - available_h2osoi_liq = max(h2osoi_liq(c,i)-watmin-xs(c),0._r8) - if (available_h2osoi_liq .ge. xs(c)) then - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - h2osoi_liq(c,i) = h2osoi_liq(c,i) - xs(c) - xs(c) = 0._r8 - exit searchforwater - else - h2osoi_liq(c,j) = h2osoi_liq(c,j) + available_h2osoi_liq - h2osoi_liq(c,i) = h2osoi_liq(c,i) - available_h2osoi_liq - xs(c) = xs(c) - available_h2osoi_liq - end if - end do searchforwater - else - xs(c) = 0._r8 - end if -! Needed in case there is no water to be found - h2osoi_liq(c,j) = h2osoi_liq(c,j) + xs(c) - wt(c) = wt(c) - xs(c) -! Instead of removing water from aquifer where it eventually -! shows up as excess drainage to the ocean, take it back out of -! drainage - rsub_top(c) = rsub_top(c) - xs(c)/dtime - end do - - do fc = 1, num_hydrologyc - c = filter_hydrologyc(fc) - - ! Sub-surface runoff and drainage - - qflx_drain(c) = qflx_rsub_sat(c) + rsub_top(c) - - ! Set imbalance for snow capping - - qflx_qrgwl(c) = qflx_snwcp_liq(c) - - ! Implicit evaporation term is now zero - - eflx_impsoil(c) = 0._r8 - - ! Renew the ice and liquid mass due to condensation - - if (snl(c)+1 >= 1) then - h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_dew_grnd(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_dew_snow(c) * dtime) - if (qflx_sub_snow(c)*dtime > h2osoi_ice(c,1)) then - qflx_sub_snow(c) = h2osoi_ice(c,1)/dtime - h2osoi_ice(c,1) = 0._r8 - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_sub_snow(c) * dtime) - end if - end if - end do - - ! No drainage for urban columns (except for pervious road as computed above) - - do fc = 1, num_urbanc - c = filter_urbanc(fc) - if (ctype(c) /= icol_road_perv) then - qflx_drain(c) = 0._r8 - qflx_irrig(c) = 0._r8 - ! This must be done for roofs and impervious road (walls will be zero) - qflx_qrgwl(c) = qflx_snwcp_liq(c) - eflx_impsoil(c) = 0._r8 - end if - - ! Renew the ice and liquid mass due to condensation for urban roof and impervious road - - if (ctype(c) == icol_roof .or. ctype(c) == icol_road_imperv) then - if (snl(c)+1 >= 1) then - h2osoi_liq(c,1) = h2osoi_liq(c,1) + qflx_dew_grnd(c) * dtime - h2osoi_ice(c,1) = h2osoi_ice(c,1) + (qflx_dew_snow(c) * dtime) - if (qflx_sub_snow(c)*dtime > h2osoi_ice(c,1)) then - qflx_sub_snow(c) = h2osoi_ice(c,1)/dtime - h2osoi_ice(c,1) = 0._r8 - else - h2osoi_ice(c,1) = h2osoi_ice(c,1) - (qflx_sub_snow(c) * dtime) - end if - end if - end if - - end do - - end subroutine Drainage - -end module SoilHydrologyMod diff --git a/src_clm40/biogeophys/SoilTemperatureMod.F90 b/src_clm40/biogeophys/SoilTemperatureMod.F90 deleted file mode 100644 index 9e81a79cd0..0000000000 --- a/src_clm40/biogeophys/SoilTemperatureMod.F90 +++ /dev/null @@ -1,1225 +0,0 @@ -module SoilTemperatureMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: SoilTemperatureMod -! -! !DESCRIPTION: -! Calculates snow and soil temperatures including phase change -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: SoilTemperature ! Snow and soil temperatures including phase change -! -! !PRIVATE MEMBER FUNCTIONS: - private :: SoilThermProp ! Set therm conductivities and heat cap of snow/soil layers - private :: PhaseChange ! Calculation of the phase change within snow and soil layers -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SoilTemperature -! -! !INTERFACE: - subroutine SoilTemperature(lbl, ubl, lbc, ubc, num_urbanl, filter_urbanl, & - num_nolakec, filter_nolakec, xmf, fact) -! -! !DESCRIPTION: -! Snow and soil temperatures including phase change -! o The volumetric heat capacity is calculated as a linear combination -! in terms of the volumetric fraction of the constituent phases. -! o The thermal conductivity of soil is computed from -! the algorithm of Johansen (as reported by Farouki 1981), and the -! conductivity of snow is from the formulation used in -! SNTHERM (Jordan 1991). -! o Boundary conditions: -! F = Rnet - Hg - LEg (top), F= 0 (base of the soil column). -! o Soil / snow temperature is predicted from heat conduction -! in 10 soil layers and up to 5 snow layers. -! The thermal conductivities at the interfaces between two -! neighboring layers (j, j+1) are derived from an assumption that -! the flux across the interface is equal to that from the node j -! to the interface and the flux from the interface to the node j+1. -! The equation is solved using the Crank-Nicholson method and -! results in a tridiagonal system equation. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_time_manager , only : get_step_size - use clm_varctl , only : iulog - use clm_varcon , only : sb, capr, cnfac, hvap, istice_mec, isturb, & - icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv, istwet - use clm_varpar , only : nlevsno, nlevgrnd, max_pft_per_col, nlevurb - use TridiagonalMod, only : Tridiagonal - -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer , intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - real(r8), intent(out) :: xmf(lbc:ubc) ! total latent heat of phase change of ground water - real(r8), intent(out) :: fact(lbc:ubc, -nlevsno+1:nlevgrnd) ! used in computing tridiagonal matrix -! -! !CALLED FROM: -! subroutine Biogeophysics2 in module Biogeophysics2Mod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 12/19/01, Peter Thornton -! Changed references for tg to t_grnd, for consistency with the -! rest of the code (tg eliminated as redundant) -! 2/14/02, Peter Thornton: Migrated to new data structures. Added pft loop -! in calculation of net ground heat flux. -! 3/18/08, David Lawrence: Change nlevsoi to nlevgrnd for deep soil -! 03/28/08, Mark Flanner: Changes to allow solar radiative absorption in all snow layers and top soil layer -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: pgridcell(:) ! pft's gridcell index - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: clandunit(:) ! column's landunit - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: ctype(:) ! column type - integer , pointer :: npfts(:) ! column's number of pfts - integer , pointer :: pfti(:) ! column's beginning pft index - real(r8), pointer :: pwtcol(:) ! weight of pft relative to column - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: forc_lwrad(:) ! downward infrared (longwave) radiation (W/m**2) - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: htvp(:) ! latent heat of vapor of water (or sublimation) [j/kg] - real(r8), pointer :: emg(:) ! ground emissivity - real(r8), pointer :: cgrnd(:) ! deriv. of soil energy flux wrt to soil temp [w/m2/k] - real(r8), pointer :: dlrad(:) ! downward longwave radiation blow the canopy [W/m2] - real(r8), pointer :: sabg(:) ! solar radiation absorbed by ground (W/m**2) - integer , pointer :: frac_veg_nosno(:) ! fraction of vegetation not covered by snow (0 OR 1 now) [-] (new) - real(r8), pointer :: eflx_sh_grnd(:) ! sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_soi(:) ! soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg(:) ! vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) - real(r8), pointer :: dz(:,:) ! layer depth (m) - real(r8), pointer :: z(:,:) ! layer thickness (m) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: eflx_lwrad_net(:) ! net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: tssbef(:,:) ! temperature at previous time step [K] - real(r8), pointer :: t_building(:) ! internal building temperature (K) - real(r8), pointer :: t_building_max(:) ! maximum internal building temperature (K) - real(r8), pointer :: t_building_min(:) ! minimum internal building temperature (K) - real(r8), pointer :: hc_soi(:) ! soil heat content (MJ/m2) - real(r8), pointer :: hc_soisno(:) ! soil plus snow plus lake heat content (MJ/m2) - real(r8), pointer :: eflx_fgr12(:) ! heat flux between soil layer 1 and 2 (W/m2) - real(r8), pointer :: eflx_traffic(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat(:) ! sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_wasteheat_pft(:) ! sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac(:) !sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_pft(:) !sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_traffic_pft(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_anthro(:) ! total anthropogenic heat flux (W/m**2) - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio - real(r8), pointer :: wtlunit_roof(:) ! weight of roof with respect to landunit - real(r8), pointer :: eflx_bot(:) ! heat flux from beneath column (W/m**2) [+ = upward] -! -! local pointers to original implicit inout arguments -! - real(r8), pointer :: t_grnd(:) ! ground surface temperature [K] -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: eflx_gnet(:) ! net ground heat flux into the surface (W/m**2) - real(r8), pointer :: dgnetdT(:) ! temperature derivative of ground net heat flux - real(r8), pointer :: eflx_building_heat(:) ! heat flux from urban building interior to walls, roof (W/m**2) - -! variables needed for SNICAR - real(r8), pointer :: sabg_lyr(:,:) ! absorbed solar radiation (pft,lyr) [W/m2] - real(r8), pointer :: h2osno(:) ! total snow water (col) [kg/m2] - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (col,lyr) [kg/m2] - real(r8), pointer :: h2osoi_ice(:,:) ! ice content (col,lyr) [kg/m2] - -! Urban building HAC fluxes - real(r8), pointer :: eflx_urban_ac(:) ! urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat(:) ! urban heating flux (W/m**2) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: j,c,p,l,g,pi ! indices - integer :: fc ! lake filtered column indices - integer :: fl ! urban filtered landunit indices - integer :: jtop(lbc:ubc) ! top level at each column - real(r8) :: dtime ! land model time step (sec) - real(r8) :: at (lbc:ubc,-nlevsno+1:nlevgrnd) ! "a" vector for tridiagonal matrix - real(r8) :: bt (lbc:ubc,-nlevsno+1:nlevgrnd) ! "b" vector for tridiagonal matrix - real(r8) :: ct (lbc:ubc,-nlevsno+1:nlevgrnd) ! "c" vector for tridiagonal matrix - real(r8) :: rt (lbc:ubc,-nlevsno+1:nlevgrnd) ! "r" vector for tridiagonal solution - real(r8) :: cv (lbc:ubc,-nlevsno+1:nlevgrnd) ! heat capacity [J/(m2 K)] - real(r8) :: tk (lbc:ubc,-nlevsno+1:nlevgrnd) ! thermal conductivity [W/(m K)] - real(r8) :: fn (lbc:ubc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] - real(r8) :: fn1(lbc:ubc,-nlevsno+1:nlevgrnd) ! heat diffusion through the layer interface [W/m2] - real(r8) :: brr(lbc:ubc,-nlevsno+1:nlevgrnd) ! temporary - real(r8) :: dzm ! used in computing tridiagonal matrix - real(r8) :: dzp ! used in computing tridiagonal matrix - real(r8) :: hs(lbc:ubc) ! net energy flux into the surface (w/m2) - real(r8) :: dhsdT(lbc:ubc) ! d(hs)/dT - real(r8) :: lwrad_emit(lbc:ubc) ! emitted longwave radiation - real(r8) :: dlwrad_emit(lbc:ubc) ! time derivative of emitted longwave radiation - integer :: lyr_top ! index of top layer of snowpack (-4 to 0) [idx] - real(r8) :: sabg_lyr_col(lbc:ubc,-nlevsno+1:1) ! absorbed solar radiation (col,lyr) [W/m2] - real(r8) :: eflx_gnet_top ! net energy flux into surface layer, pft-level [W/m2] - real(r8) :: hs_top(lbc:ubc) ! net energy flux into surface layer (col) [W/m2] - logical :: cool_on(lbl:ubl) ! is urban air conditioning on? - logical :: heat_on(lbl:ubl) ! is urban heating on? -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (gridcell-level) - - forc_lwrad => clm_a2l%forc_lwrad - - ! Assign local pointers to derived subtypes components (landunit-level) - - ltype => lun%itype - t_building => lps%t_building - t_building_max => lps%t_building_max - t_building_min => lps%t_building_min - eflx_traffic => lef%eflx_traffic - canyon_hwr => lun%canyon_hwr - eflx_wasteheat => lef%eflx_wasteheat - eflx_heat_from_ac => lef%eflx_heat_from_ac - wtlunit_roof => lun%wtlunit_roof - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype - clandunit => col%landunit - npfts => col%npfts - pfti => col%pfti - snl => cps%snl - htvp => cps%htvp - emg => cps%emg - t_grnd => ces%t_grnd - hc_soi => ces%hc_soi - hc_soisno => ces%hc_soisno - eflx_fgr12 => cef%eflx_fgr12 - zi => cps%zi - dz => cps%dz - z => cps%z - t_soisno => ces%t_soisno - eflx_building_heat => cef%eflx_building_heat - tssbef => ces%tssbef - eflx_urban_ac => cef%eflx_urban_ac - eflx_urban_heat => cef%eflx_urban_heat - eflx_bot => cef%eflx_bot - - ! Assign local pointers to derived subtypes components (pft-level) - - pgridcell => pft%gridcell - plandunit => pft%landunit - pwtcol => pft%wtcol - pwtgcell => pft%wtgcell - frac_veg_nosno => pps%frac_veg_nosno - cgrnd => pef%cgrnd - dlrad => pef%dlrad - sabg => pef%sabg - eflx_sh_grnd => pef%eflx_sh_grnd - qflx_evap_soi => pwf%qflx_evap_soi - qflx_tran_veg => pwf%qflx_tran_veg - eflx_gnet => pef%eflx_gnet - dgnetdT => pef%dgnetdT - eflx_lwrad_net => pef%eflx_lwrad_net - eflx_wasteheat_pft => pef%eflx_wasteheat_pft - eflx_heat_from_ac_pft => pef%eflx_heat_from_ac_pft - eflx_traffic_pft => pef%eflx_traffic_pft - eflx_anthro => pef%eflx_anthro - - sabg_lyr => pef%sabg_lyr - h2osno => cws%h2osno - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - - ! Get step size - - dtime = get_step_size() - - ! Compute ground surface and soil temperatures - - ! Thermal conductivity and Heat capacity - - call SoilThermProp(lbc, ubc, num_nolakec, filter_nolakec, tk, cv) - - ! Net ground heat flux into the surface and its temperature derivative - ! Added a pfts loop here to get the average of hs and dhsdT over - ! all PFTs on the column. Precalculate the terms that do not depend on PFT. - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - lwrad_emit(c) = emg(c) * sb * t_grnd(c)**4 - dlwrad_emit(c) = 4._r8*emg(c) * sb * t_grnd(c)**3 - end do - - hs(lbc:ubc) = 0._r8 - dhsdT(lbc:ubc) = 0._r8 - do pi = 1,max_pft_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if ( pi <= npfts(c) ) then - p = pfti(c) + pi - 1 - l = plandunit(p) - g = pgridcell(p) - - ! Note: Some glacier_mec pfts may have zero weight - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - if (ltype(l) /= isturb) then - eflx_gnet(p) = sabg(p) + dlrad(p) & - + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(g) - lwrad_emit(c) & - - (eflx_sh_grnd(p)+qflx_evap_soi(p)*htvp(c)) - else - ! For urban columns we use the net longwave radiation (eflx_lwrad_net) because of - ! interactions between urban columns. - - ! All wasteheat and traffic flux goes into canyon floor - if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - eflx_wasteheat_pft(p) = eflx_wasteheat(l)/(1._r8-wtlunit_roof(l)) - eflx_heat_from_ac_pft(p) = eflx_heat_from_ac(l)/(1._r8-wtlunit_roof(l)) - eflx_traffic_pft(p) = eflx_traffic(l)/(1._r8-wtlunit_roof(l)) - else - eflx_wasteheat_pft(p) = 0._r8 - eflx_heat_from_ac_pft(p) = 0._r8 - eflx_traffic_pft(p) = 0._r8 - end if - ! Include transpiration term because needed for previous road - ! and include wasteheat and traffic flux - eflx_gnet(p) = sabg(p) + dlrad(p) & - - eflx_lwrad_net(p) & - - (eflx_sh_grnd(p) + qflx_evap_soi(p)*htvp(c) + qflx_tran_veg(p)*hvap) & - + eflx_wasteheat_pft(p) + eflx_heat_from_ac_pft(p) + eflx_traffic_pft(p) - eflx_anthro(p) = eflx_wasteheat_pft(p) + eflx_traffic_pft(p) - end if - dgnetdT(p) = - cgrnd(p) - dlwrad_emit(c) - hs(c) = hs(c) + eflx_gnet(p) * pwtcol(p) - dhsdT(c) = dhsdT(c) + dgnetdT(p) * pwtcol(p) - end if - - end if - end do - end do - - ! Additional calculations with SNICAR: - ! Set up tridiagonal matrix in a new manner. There is now - ! absorbed solar radiation in each snow layer, instead of - ! only the surface. Following the current implementation, - ! absorbed solar flux should be: S + ((delS/delT)*dT), - ! where S is absorbed radiation, and T is temperature. Now, - ! assume delS/delT is zero, then it is OK to just add S - ! to each layer - - ! Initialize: - sabg_lyr_col(lbc:ubc,-nlevsno+1:1) = 0._r8 - hs_top(lbc:ubc) = 0._r8 - - do pi = 1,max_pft_per_col - do fc = 1,num_nolakec - c = filter_nolakec(fc) - lyr_top = snl(c) + 1 - if ( pi <= npfts(c) ) then - p = pfti(c) + pi - 1 - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ltype(l)==istice_mec) then - g = pgridcell(p) - if (ltype(l) /= isturb )then - - eflx_gnet_top = sabg_lyr(p,lyr_top) + dlrad(p) + (1-frac_veg_nosno(p))*emg(c)*forc_lwrad(g) & - - lwrad_emit(c) - (eflx_sh_grnd(p)+qflx_evap_soi(p)*htvp(c)) - - hs_top(c) = hs_top(c) + eflx_gnet_top*pwtcol(p) - - do j = lyr_top,1,1 - sabg_lyr_col(c,j) = sabg_lyr_col(c,j) + sabg_lyr(p,j) * pwtcol(p) - enddo - else - - hs_top(c) = hs_top(c) + eflx_gnet(p)*pwtcol(p) - - sabg_lyr_col(c,lyr_top) = sabg_lyr_col(c,lyr_top) + sabg(p) * pwtcol(p) - - endif - endif - - endif - enddo - enddo - - ! Restrict internal building temperature to between min and max - ! and determine if heating or air conditioning is on - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if (ltype(l) == isturb) then - cool_on(l) = .false. - heat_on(l) = .false. - if (t_building(l) > t_building_max(l)) then - t_building(l) = t_building_max(l) - cool_on(l) = .true. - heat_on(l) = .false. - else if (t_building(l) < t_building_min(l)) then - t_building(l) = t_building_min(l) - cool_on(l) = .false. - heat_on(l) = .true. - end if - end if - end do - - ! Determine heat diffusion through the layer interface and factor used in computing - ! tridiagonal matrix and set up vector r and vectors a, b, c that define tridiagonal - ! matrix and solve system - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (j >= snl(c)+1) then - if (j == snl(c)+1) then - if (ctype(c)==icol_sunwall .or. ctype(c)==icol_shadewall .or. ctype(c)==icol_roof) then - fact(c,j) = dtime/cv(c,j) - else - fact(c,j) = dtime/cv(c,j) * dz(c,j) / (0.5_r8*(z(c,j)-zi(c,j-1)+capr*(z(c,j+1)-zi(c,j-1)))) - end if - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j <= nlevgrnd-1) then - fact(c,j) = dtime/cv(c,j) - fn(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - dzm = (z(c,j)-z(c,j-1)) - else if (j == nlevgrnd) then - fact(c,j) = dtime/cv(c,j) - - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - if (ctype(c)==icol_sunwall .or. ctype(c)==icol_shadewall .or. ctype(c)==icol_roof) then - fn(c,j) = tk(c,j) * (t_building(l) - cnfac*t_soisno(c,j))/(zi(c,j) - z(c,j)) - else - fn(c,j) = eflx_bot(c) - end if - end if - end if - enddo - end do - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (j >= snl(c)+1) then - if (j == snl(c)+1) then - dzp = z(c,j+1)-z(c,j) - at(c,j) = 0._r8 - bt(c,j) = 1+(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp-fact(c,j)*dhsdT(c) - ct(c,j) = -(1._r8-cnfac)*fact(c,j)*tk(c,j)/dzp - ! changed hs to hs_top - rt(c,j) = t_soisno(c,j) + fact(c,j)*( hs_top(c) - dhsdT(c)*t_soisno(c,j) + cnfac*fn(c,j) ) - else if (j <= nlevgrnd-1) then - dzm = (z(c,j)-z(c,j-1)) - dzp = (z(c,j+1)-z(c,j)) - at(c,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j-1)/dzm - bt(c,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j)/dzp + tk(c,j-1)/dzm) - ct(c,j) = - (1._r8-cnfac)*fact(c,j)* tk(c,j)/dzp - - ! if this is a snow layer or the top soil layer, - ! add absorbed solar flux to factor 'rt' - if (j <= 1) then - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) + (fact(c,j)*sabg_lyr_col(c,j)) - else - rt(c,j) = t_soisno(c,j) + cnfac*fact(c,j)*( fn(c,j) - fn(c,j-1) ) - endif - - else if (j == nlevgrnd) then - - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - if (ctype(c)==icol_sunwall .or. ctype(c)==icol_shadewall .or. ctype(c)==icol_roof) then - dzm = ( z(c,j)-z(c,j-1)) - dzp = (zi(c,j)-z(c,j)) - at(c,j) = - (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm) - bt(c,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*(tk(c,j-1)/dzm + tk(c,j)/dzp) - ct(c,j) = 0._r8 - rt(c,j) = t_soisno(c,j) + fact(c,j)*( fn(c,j) - cnfac*fn(c,j-1) ) - else - dzm = (z(c,j)-z(c,j-1)) - at(c,j) = - (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - bt(c,j) = 1._r8+ (1._r8-cnfac)*fact(c,j)*tk(c,j-1)/dzm - ct(c,j) = 0._r8 - rt(c,j) = t_soisno(c,j) - cnfac*fact(c,j)*fn(c,j-1) + fact(c,j)*fn(c,j) - end if - end if - - end if - enddo - end do - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - jtop(c) = snl(c) + 1 - end do - call Tridiagonal(lbc, ubc, -nlevsno+1, nlevgrnd, jtop, num_nolakec, filter_nolakec, & - at, bt, ct, rt, t_soisno(lbc:ubc,-nlevsno+1:nlevgrnd)) - - ! Melting or Freezing - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (j >= snl(c)+1) then - if (j <= nlevgrnd-1) then - fn1(c,j) = tk(c,j)*(t_soisno(c,j+1)-t_soisno(c,j))/(z(c,j+1)-z(c,j)) - else if (j == nlevgrnd) then - - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - ! Note new formulation for fn, this will be used below in brr computation - if (ctype(c)==icol_sunwall .or. ctype(c)==icol_shadewall .or. ctype(c)==icol_roof) then - fn1(c,j) = tk(c,j) * (t_building(l) - t_soisno(c,j))/(zi(c,j) - z(c,j)) - fn(c,j) = tk(c,j) * (t_building(l) - tssbef(c,j))/(zi(c,j) - z(c,j)) - else - fn1(c,j) = 0._r8 - end if - end if - end if - end do - end do - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (ltype(l) == isturb) then - eflx_building_heat(c) = cnfac*fn(c,nlevurb) + (1-cnfac)*fn1(c,nlevurb) - if (cool_on(l)) then - eflx_urban_ac(c) = abs(eflx_building_heat(c)) - eflx_urban_heat(c) = 0._r8 - else if (heat_on(l)) then - eflx_urban_ac(c) = 0._r8 - eflx_urban_heat(c) = abs(eflx_building_heat(c)) - else - eflx_urban_ac(c) = 0._r8 - eflx_urban_heat(c) = 0._r8 - end if - end if - end do - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (j >= snl(c)+1) then - if (j == snl(c)+1) then - brr(c,j) = cnfac*fn(c,j) + (1._r8-cnfac)*fn1(c,j) - else - brr(c,j) = cnfac*(fn(c,j)-fn(c,j-1)) + (1._r8-cnfac)*(fn1(c,j)-fn1(c,j-1)) - end if - end if - end do - end do - - call PhaseChange (lbc, ubc, num_nolakec, filter_nolakec, fact, brr, hs, dhsdT, xmf, hs_top, sabg_lyr_col) - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - t_grnd(c) = t_soisno(c,snl(c)+1) - end do - - -! Initialize soil heat content - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (ltype(l) /= isturb) then - hc_soisno(c) = 0._r8 - hc_soi(c) = 0._r8 - end if - eflx_fgr12(c)= 0._r8 - end do - -! Calculate soil heat content and soil plus snow heat content - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - eflx_fgr12(c) = -cnfac*fn(c,1) - (1._r8-cnfac)*fn1(c,1) - if (ltype(l) /= isturb) then - if (j >= snl(c)+1) then - hc_soisno(c) = hc_soisno(c) + cv(c,j)*t_soisno(c,j) / 1.e6_r8 - endif - if (j >= 1) then - hc_soi(c) = hc_soi(c) + cv(c,j)*t_soisno(c,j) / 1.e6_r8 - end if - end if - end do - end do - - end subroutine SoilTemperature - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SoilThermProp -! -! !INTERFACE: - subroutine SoilThermProp (lbc, ubc, num_nolakec, filter_nolakec, tk, cv) -! -! !DESCRIPTION: -! Calculation of thermal conductivities and heat capacities of -! snow/soil layers -! (1) The volumetric heat capacity is calculated as a linear combination -! in terms of the volumetric fraction of the constituent phases. -! -! (2) The thermal conductivity of soil is computed from the algorithm of -! Johansen (as reported by Farouki 1981), and of snow is from the -! formulation used in SNTHERM (Jordan 1991). -! The thermal conductivities at the interfaces between two neighboring -! layers (j, j+1) are derived from an assumption that the flux across -! the interface is equal to that from the node j to the interface and the -! flux from the interface to the node j+1. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use clm_varcon , only : denh2o, denice, tfrz, tkwat, tkice, tkair, & - cpice, cpliq, istice, istice_mec, istwet, & - icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv - use clm_varpar , only : nlevsno, nlevgrnd, nlevurb, nlevsoi -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - real(r8), intent(out) :: cv(lbc:ubc,-nlevsno+1:nlevgrnd)! heat capacity [J/(m2 K)] - real(r8), intent(out) :: tk(lbc:ubc,-nlevsno+1:nlevgrnd)! thermal conductivity [W/(m K)] -! -! !CALLED FROM: -! subroutine SoilTemperature in this module -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/13/02, Peter Thornton: migrated to new data structures -! 7/01/03, Mariana Vertenstein: migrated to vector code -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in scalars -! - integer , pointer :: ctype(:) ! column type - integer , pointer :: clandunit(:) ! column's landunit - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) -! -! local pointers to original implicit in arrays -! - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) - real(r8), pointer :: tksatu(:,:) ! thermal conductivity, saturated soil [W/m-K] - real(r8), pointer :: tkmg(:,:) ! thermal conductivity, soil minerals [W/m-K] - real(r8), pointer :: tkdry(:,:) ! thermal conductivity, dry soil (W/m/Kelvin) - real(r8), pointer :: csol(:,:) ! heat capacity, soil solids (J/m**3/Kelvin) - real(r8), pointer :: dz(:,:) ! layer depth (m) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) - real(r8), pointer :: z(:,:) ! layer thickness (m) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: tk_wall(:,:) ! thermal conductivity of urban wall - real(r8), pointer :: tk_roof(:,:) ! thermal conductivity of urban roof - real(r8), pointer :: tk_improad(:,:) ! thermal conductivity of urban impervious road - real(r8), pointer :: cv_wall(:,:) ! thermal conductivity of urban wall - real(r8), pointer :: cv_roof(:,:) ! thermal conductivity of urban roof - real(r8), pointer :: cv_improad(:,:) ! thermal conductivity of urban impervious road - integer, pointer :: nlev_improad(:) ! number of impervious road layers - -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: l,c,j ! indices - integer :: fc ! lake filtered column indices - real(r8) :: bw ! partial density of water (ice + liquid) - real(r8) :: dksat ! thermal conductivity for saturated soil (j/(k s m)) - real(r8) :: dke ! kersten number - real(r8) :: fl ! fraction of liquid or unfrozen water to total water - real(r8) :: satw ! relative total water content of soil. - real(r8) :: thk(lbc:ubc,-nlevsno+1:nlevgrnd) ! thermal conductivity of layer - real(r8) :: thk_bedrock = 3.0_r8 ! thermal conductivity of 'typical' saturated granitic rock - ! (Clauser and Huenges, 1995)(W/m/K) -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (landunit-level) - - ltype => lun%itype - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype - clandunit => col%landunit - snl => cps%snl - h2osno => cws%h2osno - watsat => cps%watsat - tksatu => cps%tksatu - tkmg => cps%tkmg - tkdry => cps%tkdry - csol => cps%csol - dz => cps%dz - zi => cps%zi - z => cps%z - t_soisno => ces%t_soisno - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - tk_wall => lps%tk_wall - tk_roof => lps%tk_roof - tk_improad => lps%tk_improad - cv_wall => lps%cv_wall - cv_roof => lps%cv_roof - cv_improad => lps%cv_improad - nlev_improad => lps%nlev_improad - - ! Thermal conductivity of soil from Farouki (1981) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. - - do j = -nlevsno+1,nlevgrnd - do fc = 1, num_nolakec - c = filter_nolakec(fc) - - ! Only examine levels from 1->nlevgrnd - if (j >= 1) then - l = clandunit(c) - if (ctype(c) == icol_sunwall .OR. ctype(c) == icol_shadewall) then - thk(c,j) = tk_wall(l,j) - else if (ctype(c) == icol_roof) then - thk(c,j) = tk_roof(l,j) - else if (ctype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - thk(c,j) = tk_improad(l,j) - elseif (ltype(l) /= istwet .AND. ltype(l) /= istice & - .AND. ltype(l) /= istice_mec) then - satw = (h2osoi_liq(c,j)/denh2o + h2osoi_ice(c,j)/denice)/(dz(c,j)*watsat(c,j)) - satw = min(1._r8, satw) - if (satw > .1e-6_r8) then - fl = h2osoi_liq(c,j)/(h2osoi_ice(c,j)+h2osoi_liq(c,j)) - if (t_soisno(c,j) >= tfrz) then ! Unfrozen soil - dke = max(0._r8, log10(satw) + 1.0_r8) - dksat = tksatu(c,j) - else ! Frozen soil - dke = satw - dksat = tkmg(c,j)*0.249_r8**(fl*watsat(c,j))*2.29_r8**watsat(c,j) - endif - thk(c,j) = dke*dksat + (1._r8-dke)*tkdry(c,j) - else - thk(c,j) = tkdry(c,j) - endif - if (j > nlevsoi) thk(c,j) = thk_bedrock - else if (ltype(l) == istice .OR. ltype(l) == istice_mec) then - thk(c,j) = tkwat - if (t_soisno(c,j) < tfrz) thk(c,j) = tkice - else if (ltype(l) == istwet) then - if (j > nlevsoi) then - thk(c,j) = thk_bedrock - else - thk(c,j) = tkwat - if (t_soisno(c,j) < tfrz) thk(c,j) = tkice - endif - endif - endif - - ! Thermal conductivity of snow, which from Jordan (1991) pp. 18 - ! Only examine levels from snl(c)+1 -> 0 where snl(c) < 1 - if (snl(c)+1 < 1 .AND. (j >= snl(c)+1) .AND. (j <= 0)) then - bw = (h2osoi_ice(c,j)+h2osoi_liq(c,j))/dz(c,j) - thk(c,j) = tkair + (7.75e-5_r8 *bw + 1.105e-6_r8*bw*bw)*(tkice-tkair) - end if - - end do - end do - - ! Thermal conductivity at the layer interface - - do j = -nlevsno+1,nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (j >= snl(c)+1 .AND. j <= nlevgrnd-1) then - tk(c,j) = thk(c,j)*thk(c,j+1)*(z(c,j+1)-z(c,j)) & - /(thk(c,j)*(z(c,j+1)-zi(c,j))+thk(c,j+1)*(zi(c,j)-z(c,j))) - else if (j == nlevgrnd) then - - ! For urban sunwall, shadewall, and roof columns, there is a non-zero heat flux across - ! the bottom "soil" layer and the equations are derived assuming a prescribed internal - ! building temperature. (See Oleson urban notes of 6/18/03). - if (ctype(c)==icol_sunwall .OR. ctype(c)==icol_shadewall .OR. ctype(c)==icol_roof) then - tk(c,j) = thk(c,j) - else - tk(c,j) = 0._r8 - end if - end if - end do - end do - - ! Soil heat capacity, from de Vires (1963) - ! Urban values are from Masson et al. 2002, Evaluation of the Town Energy Balance (TEB) - ! scheme with direct measurements from dry districts in two cities, J. Appl. Meteorol., - ! 41, 1011-1026. - - do j = 1, nlevgrnd - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (ctype(c)==icol_sunwall .OR. ctype(c)==icol_shadewall) then - cv(c,j) = cv_wall(l,j) * dz(c,j) - else if (ctype(c) == icol_roof) then - cv(c,j) = cv_roof(l,j) * dz(c,j) - else if (ctype(c) == icol_road_imperv .and. j >= 1 .and. j <= nlev_improad(l)) then - cv(c,j) = cv_improad(l,j) * dz(c,j) - elseif (ltype(l) /= istwet .AND. ltype(l) /= istice & - .AND. ltype(l) /= istice_mec) then - cv(c,j) = csol(c,j)*(1-watsat(c,j))*dz(c,j) + (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - else if (ltype(l) == istwet) then - cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - if (j > nlevsoi) cv(c,j) = csol(c,j)*dz(c,j) - else if (ltype(l) == istice .OR. ltype(l) == istice_mec) then - cv(c,j) = (h2osoi_ice(c,j)*cpice + h2osoi_liq(c,j)*cpliq) - endif - if (j == 1) then - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8) then - cv(c,j) = cv(c,j) + cpice*h2osno(c) - end if - end if - enddo - end do - - ! Snow heat capacity - - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (snl(c)+1 < 1 .and. j >= snl(c)+1) then - cv(c,j) = cpliq*h2osoi_liq(c,j) + cpice*h2osoi_ice(c,j) - end if - end do - end do - - end subroutine SoilThermProp - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: PhaseChange -! -! !INTERFACE: - subroutine PhaseChange (lbc, ubc, num_nolakec, filter_nolakec, fact, & - brr, hs, dhsdT, xmf, hs_top, sabg_lyr_col) -! -! !DESCRIPTION: -! Calculation of the phase change within snow and soil layers: -! (1) Check the conditions for which the phase change may take place, -! i.e., the layer temperature is great than the freezing point -! and the ice mass is not equal to zero (i.e. melting), -! or the layer temperature is less than the freezing point -! and the liquid water mass is greater than the allowable supercooled -! liquid water calculated from freezing point depression (i.e. freezing). -! (2) Assess the rate of phase change from the energy excess (or deficit) -! after setting the layer temperature to freezing point. -! (3) Re-adjust the ice and liquid mass, and the layer temperature -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_time_manager, only : get_step_size - use clm_varcon , only : tfrz, hfus, grav, istsoil, istice_mec, isturb, icol_road_perv - use clm_varcon , only : istcrop - use clm_varpar , only : nlevsno, nlevgrnd - -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer , intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - real(r8), intent(in) :: brr (lbc:ubc, -nlevsno+1:nlevgrnd) ! temporary - real(r8), intent(in) :: fact (lbc:ubc, -nlevsno+1:nlevgrnd) ! temporary - real(r8), intent(in) :: hs (lbc:ubc) ! net ground heat flux into the surface - real(r8), intent(in) :: dhsdT (lbc:ubc) ! temperature derivative of "hs" - real(r8), intent(out):: xmf (lbc:ubc) ! total latent heat of phase change - real(r8), intent(in) :: hs_top(lbc:ubc) ! net heat flux into the top snow layer [W/m2] - real(r8), intent(in) :: sabg_lyr_col(lbc:ubc,-nlevsno+1:1) ! absorbed solar radiation (col,lyr) [W/m2] - -! -! !CALLED FROM: -! subroutine SoilTemperature in this module -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 2/14/02, Peter Thornton: Migrated to new data structures. -! 7/01/03, Mariana Vertenstein: Migrated to vector code -! 04/25/07 Keith Oleson: CLM3.5 Hydrology -! 03/28/08 Mark Flanner: accept new arguments and calculate freezing rate of h2o in snow -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in scalars -! - real(r8), pointer :: qflx_snow_melt(:) ! net snow melt - integer , pointer :: snl(:) !number of snow layers - real(r8), pointer :: h2osno(:) !snow water (mm H2O) - integer , pointer :: ltype(:) !landunit type - integer , pointer :: clandunit(:) !column's landunit - integer , pointer :: ctype(:) !column type -! -! local pointers to original implicit inout scalars -! - real(r8), pointer :: snowdp(:) !snow height (m) -! -! local pointers to original implicit out scalars -! - real(r8), pointer :: qflx_snomelt(:) !snow melt (mm H2O /s) - real(r8), pointer :: eflx_snomelt(:) !snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_u(:)!urban snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_r(:)!rural snow melt heat flux (W/m**2) - real(r8), pointer :: qflx_snofrz_lyr(:,:) !snow freezing rate (positive definite) (col,lyr) [kg m-2 s-1] - real(r8), pointer :: qflx_snofrz_col(:) !column-integrated snow freezing rate (positive definite) [kg m-2 s-1] - real(r8), pointer :: qflx_glcice(:) !flux of new glacier ice (mm H2O/s) [+ = ice grows] - real(r8), pointer :: qflx_glcice_melt(:) !ice melt (positive definite) (mm H2O/s) -! -! local pointers to original implicit in arrays -! - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) (new) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) (new) - real(r8), pointer :: tssbef(:,:) !temperature at previous time step [K] - real(r8), pointer :: sucsat(:,:) !minimum soil suction (mm) - real(r8), pointer :: watsat(:,:) !volumetric soil water at saturation (porosity) - real(r8), pointer :: bsw(:,:) !Clapp and Hornberger "b" - real(r8), pointer :: dz(:,:) !layer thickness (m) -! -! local pointers to original implicit inout arrays -! - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) -! -! local pointers to original implicit out arrays -! - integer, pointer :: imelt(:,:) !flag for melting (=1), freezing (=2), Not=0 (new) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: j,c,g,l !do loop index - integer :: fc !lake filtered column indices - real(r8) :: dtime !land model time step (sec) - real(r8) :: heatr !energy residual or loss after melting or freezing - real(r8) :: temp1 !temporary variables [kg/m2] - real(r8) :: hm(lbc:ubc,-nlevsno+1:nlevgrnd) !energy residual [W/m2] - real(r8) :: xm(lbc:ubc,-nlevsno+1:nlevgrnd) !melting or freezing within a time step [kg/m2] - real(r8) :: wmass0(lbc:ubc,-nlevsno+1:nlevgrnd)!initial mass of ice and liquid (kg/m2) - real(r8) :: wice0 (lbc:ubc,-nlevsno+1:nlevgrnd)!initial mass of ice (kg/m2) - real(r8) :: wliq0 (lbc:ubc,-nlevsno+1:nlevgrnd)!initial mass of liquid (kg/m2) - real(r8) :: supercool(lbc:ubc,nlevgrnd) !supercooled water in soil (kg/m2) - real(r8) :: propor !proportionality constant (-) - real(r8) :: tinc !t(n+1)-t(n) (K) - real(r8) :: smp !frozen water potential (mm) -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (column-level) - - snl => cps%snl - h2osno => cws%h2osno - snowdp => cps%snowdp - qflx_snow_melt => cwf%qflx_snow_melt - qflx_snomelt => cwf%qflx_snomelt - eflx_snomelt => cef%eflx_snomelt - eflx_snomelt_u => cef%eflx_snomelt_u - eflx_snomelt_r => cef%eflx_snomelt_r - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - imelt => cps%imelt - t_soisno => ces%t_soisno - tssbef => ces%tssbef - bsw => cps%bsw - sucsat => cps%sucsat - watsat => cps%watsat - dz => cps%dz - ctype => col%itype - clandunit => col%landunit - ltype => lun%itype - qflx_snofrz_lyr => cwf%qflx_snofrz_lyr - qflx_snofrz_col => cwf%qflx_snofrz_col - qflx_glcice => cwf%qflx_glcice - qflx_glcice_melt => cwf%qflx_glcice_melt - - ! Get step size - - dtime = get_step_size() - - ! Initialization - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - - qflx_snomelt(c) = 0._r8 - qflx_snow_melt(c) = 0._r8 - xmf(c) = 0._r8 - qflx_snofrz_lyr(c,-nlevsno+1:0) = 0._r8 - qflx_snofrz_col(c) = 0._r8 - if (ltype(l)==istice_mec) then - ! only need to initialize qflx_glcice_melt over ice_mec landunits, because - ! those are the only places where it is computed - qflx_glcice_melt(c) = 0._r8 - end if - end do - - do j = -nlevsno+1,nlevgrnd ! all layers - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (j >= snl(c)+1) then - - ! Initialization - imelt(c,j) = 0 - hm(c,j) = 0._r8 - xm(c,j) = 0._r8 - wice0(c,j) = h2osoi_ice(c,j) - wliq0(c,j) = h2osoi_liq(c,j) - wmass0(c,j) = h2osoi_ice(c,j) + h2osoi_liq(c,j) - endif ! end of snow layer if-block - end do ! end of column-loop - enddo ! end of level-loop - - do j = -nlevsno+1,0 ! snow layers - do fc = 1,num_nolakec - c = filter_nolakec(fc) - if (j >= snl(c)+1) then - - ! Melting identification - ! If ice exists above melt point, melt some to liquid. - if (h2osoi_ice(c,j) > 0._r8 .AND. t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - t_soisno(c,j) = tfrz - endif - - ! Freezing identification - ! If liquid exists below melt point, freeze some to ice. - if (h2osoi_liq(c,j) > 0._r8 .AND. t_soisno(c,j) < tfrz) then - imelt(c,j) = 2 - t_soisno(c,j) = tfrz - endif - endif ! end of snow layer if-block - end do ! end of column-loop - enddo ! end of level-loop - - do j = 1,nlevgrnd ! soil layers - do fc = 1,num_nolakec - c = filter_nolakec(fc) - l = clandunit(c) - if (h2osoi_ice(c,j) > 0. .AND. t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - t_soisno(c,j) = tfrz - endif - - ! from Zhao (1997) and Koren (1999) - supercool(c,j) = 0.0_r8 - if (ltype(l) == istsoil .or. ltype(l) == istcrop .or. ctype(c) == icol_road_perv) then - if(t_soisno(c,j) < tfrz) then - smp = hfus*(tfrz-t_soisno(c,j))/(grav*t_soisno(c,j)) * 1000._r8 !(mm) - supercool(c,j) = watsat(c,j)*(smp/sucsat(c,j))**(-1._r8/bsw(c,j)) - supercool(c,j) = supercool(c,j)*dz(c,j)*1000._r8 ! (mm) - endif - endif - - if (h2osoi_liq(c,j) > supercool(c,j) .AND. t_soisno(c,j) < tfrz) then - imelt(c,j) = 2 - t_soisno(c,j) = tfrz - endif - - ! If snow exists, but its thickness is less than the critical value (0.01 m) - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. j == 1) then - if (t_soisno(c,j) > tfrz) then - imelt(c,j) = 1 - t_soisno(c,j) = tfrz - endif - endif - end do - enddo - - do j = -nlevsno+1,nlevgrnd ! all layers - do fc = 1,num_nolakec - c = filter_nolakec(fc) - - if (j >= snl(c)+1) then - - ! Calculate the energy surplus and loss for melting and freezing - if (imelt(c,j) > 0) then - tinc = t_soisno(c,j)-tssbef(c,j) - - ! added unique cases for this calculation, - ! to account for absorbed solar radiation in each layer - if (j == snl(c)+1) then - ! top layer - hm(c,j) = hs_top(c) + dhsdT(c)*tinc + brr(c,j) - tinc/fact(c,j) - elseif (j <= 1) then - ! snow layer or top soil layer (where sabg_lyr_col is defined) - hm(c,j) = brr(c,j) - tinc/fact(c,j) + sabg_lyr_col(c,j) - else - ! soil layer - hm(c,j) = brr(c,j) - tinc/fact(c,j) - endif - - endif - - ! These two errors were checked carefully (Y. Dai). They result from the - ! computed error of "Tridiagonal-Matrix" in subroutine "thermal". - if (imelt(c,j) == 1 .AND. hm(c,j) < 0._r8) then - hm(c,j) = 0._r8 - imelt(c,j) = 0 - endif - if (imelt(c,j) == 2 .AND. hm(c,j) > 0._r8) then - hm(c,j) = 0._r8 - imelt(c,j) = 0 - endif - - ! The rate of melting and freezing - - if (imelt(c,j) > 0 .and. abs(hm(c,j)) > 0._r8) then - xm(c,j) = hm(c,j)*dtime/hfus ! kg/m2 - - ! If snow exists, but its thickness is less than the critical value - ! (1 cm). Note: more work is needed to determine how to tune the - ! snow depth for this case - if (j == 1) then - if (snl(c)+1 == 1 .AND. h2osno(c) > 0._r8 .AND. xm(c,j) > 0._r8) then - temp1 = h2osno(c) ! kg/m2 - h2osno(c) = max(0._r8,temp1-xm(c,j)) - propor = h2osno(c)/temp1 - snowdp(c) = propor * snowdp(c) - heatr = hm(c,j) - hfus*(temp1-h2osno(c))/dtime ! W/m2 - if (heatr > 0._r8) then - xm(c,j) = heatr*dtime/hfus ! kg/m2 - hm(c,j) = heatr ! W/m2 - else - xm(c,j) = 0._r8 - hm(c,j) = 0._r8 - endif - qflx_snomelt(c) = max(0._r8,(temp1-h2osno(c)))/dtime ! kg/(m2 s) - xmf(c) = hfus*qflx_snomelt(c) - qflx_snow_melt(c) = qflx_snomelt(c) - endif - endif - - heatr = 0._r8 - if (xm(c,j) > 0._r8) then - h2osoi_ice(c,j) = max(0._r8, wice0(c,j)-xm(c,j)) - heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - else if (xm(c,j) < 0._r8) then - if (j <= 0) then - h2osoi_ice(c,j) = min(wmass0(c,j), wice0(c,j)-xm(c,j)) ! snow - else - if (wmass0(c,j) < supercool(c,j)) then - h2osoi_ice(c,j) = 0._r8 - else - h2osoi_ice(c,j) = min(wmass0(c,j) - supercool(c,j),wice0(c,j)-xm(c,j)) - endif - endif - heatr = hm(c,j) - hfus*(wice0(c,j)-h2osoi_ice(c,j))/dtime - endif - - h2osoi_liq(c,j) = max(0._r8,wmass0(c,j)-h2osoi_ice(c,j)) - - if (abs(heatr) > 0._r8) then - if (j > snl(c)+1) then - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr - else - t_soisno(c,j) = t_soisno(c,j) + fact(c,j)*heatr/(1._r8-fact(c,j)*dhsdT(c)) - endif - if (j <= 0) then ! snow - if (h2osoi_liq(c,j)*h2osoi_ice(c,j)>0._r8) t_soisno(c,j) = tfrz - end if - endif - - xmf(c) = xmf(c) + hfus * (wice0(c,j)-h2osoi_ice(c,j))/dtime - - if (imelt(c,j) == 1 .AND. j < 1) then - qflx_snomelt(c) = qflx_snomelt(c) + max(0._r8,(wice0(c,j)-h2osoi_ice(c,j)))/dtime - endif - - ! layer freezing mass flux (positive): - if (imelt(c,j) == 2 .AND. j < 1) then - qflx_snofrz_lyr(c,j) = max(0._r8,(h2osoi_ice(c,j)-wice0(c,j)))/dtime - endif - - endif - endif ! end of snow layer if-block - - ! For glacier_mec columns, compute negative ice flux from melted ice. - ! Note that qflx_glcice can also include a positive component from excess snow, - ! as computed in Hydrology2Mod.F90. - - l = clandunit(c) - if (ltype(l)==istice_mec) then - - if (j>=1 .and. h2osoi_liq(c,j) > 0._r8) then ! ice layer with meltwater - ! melting corresponds to a negative ice flux - qflx_glcice_melt(c) = qflx_glcice_melt(c) + h2osoi_liq(c,j)/dtime - qflx_glcice(c) = qflx_glcice(c) - h2osoi_liq(c,j)/dtime - - ! convert layer back to pure ice by "borrowing" ice from below the column - h2osoi_ice(c,j) = h2osoi_ice(c,j) + h2osoi_liq(c,j) - h2osoi_liq(c,j) = 0._r8 - - endif ! liquid water is present - endif ! istice_mec - - end do ! end of column-loop - enddo ! end of level-loop - - ! Needed for history file output - - do fc = 1,num_nolakec - c = filter_nolakec(fc) - eflx_snomelt(c) = qflx_snomelt(c) * hfus - l = clandunit(c) - if (ltype(l) == isturb) then - eflx_snomelt_u(c) = eflx_snomelt(c) - else if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - eflx_snomelt_r(c) = eflx_snomelt(c) - end if - end do - - do j = -nlevsno+1,0 - do fc = 1,num_nolakec - c = filter_nolakec(fc) - qflx_snofrz_col(c) = qflx_snofrz_col(c) + qflx_snofrz_lyr(c,j) - end do - end do - - end subroutine PhaseChange - - -end module SoilTemperatureMod diff --git a/src_clm40/biogeophys/SurfaceAlbedoMod.F90 b/src_clm40/biogeophys/SurfaceAlbedoMod.F90 deleted file mode 100644 index 1fa9e12055..0000000000 --- a/src_clm40/biogeophys/SurfaceAlbedoMod.F90 +++ /dev/null @@ -1,1045 +0,0 @@ -module SurfaceAlbedoMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: SurfaceAlbedoMod -! -! !DESCRIPTION: -! Performs surface albedo calculations -! -! !PUBLIC TYPES: - use clm_varcon , only : istsoil - use clm_varpar , only : numrad - use clm_varcon , only : istcrop - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_varpar , only : nlevsno - use SNICARMod , only : sno_nbr_aer, SNICAR_RT, DO_SNO_AER, DO_SNO_OC - use clm_varctl , only : use_snicar_frc - - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: SurfaceAlbedo ! Surface albedo and two-stream fluxes -! -! !PUBLIC DATA MEMBERS: -! The CLM default albice values are too high. -! Full-spectral albedo for land ice is ~0.5 (Paterson, Physics of Glaciers, 1994, p. 59) -! This is the value used in CAM3 by Pritchard et al., GRL, 35, 2008. - - real(r8), public :: albice(numrad) = & ! albedo land ice by waveband (1=vis, 2=nir) - (/ 0.80_r8, 0.55_r8 /) -! -! !PRIVATE MEMBER FUNCTIONS: - private :: SoilAlbedo ! Determine ground surface albedo - private :: TwoStream ! Two-stream fluxes for canopy radiative transfer - -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SurfaceAlbedo -! -! !INTERFACE: - subroutine SurfaceAlbedo(lbg, ubg, lbc, ubc, lbp, ubp, & - num_nourbanc, filter_nourbanc, & - num_nourbanp, filter_nourbanp, & - nextsw_cday, declinp1) -! -! !DESCRIPTION: -! Surface albedo and two-stream fluxes -! Surface albedos. Also fluxes (per unit incoming direct and diffuse -! radiation) reflected, transmitted, and absorbed by vegetation. -! Also sunlit fraction of the canopy. -! The calling sequence is: -! -> SurfaceAlbedo: albedos for next time step -! -> SoilAlbedo: soil/lake/glacier/wetland albedos -! -> SNICAR_RT: snow albedos: direct beam (SNICAR) -! -> SNICAR_RT: snow albedos: diffuse (SNICAR) -! -> TwoStream: absorbed, reflected, transmitted solar fluxes (vis dir,vis dif, nir dir, nir dif) -! - -! !USES: - use clmtype - use shr_orb_mod - use clm_time_manager, only : get_nstep - -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbg, ubg ! gridcell bounds - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: lbp, ubp ! pft bounds - integer , intent(in) :: num_nourbanc ! number of columns in non-urban filter - integer , intent(in) :: filter_nourbanc(ubc-lbc+1) ! column filter for non-urban points - integer , intent(in) :: num_nourbanp ! number of pfts in non-urban filter - integer , intent(in) :: filter_nourbanp(ubp-lbp+1) ! pft filter for non-urban points - real(r8), intent(in) :: nextsw_cday ! calendar day at Greenwich (1.00, ..., days/year) - real(r8), intent(in) :: declinp1 ! declination angle (radians) for next time step -! -! !CALLED FROM: -! subroutine clm_driver1 -! subroutine iniTimeVar -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 2/1/02, Peter Thornton: Migrate to new data structures -! 8/20/03, Mariana Vertenstein: Vectorized routine -! 11/3/03, Peter Thornton: added decl(c) output for use in CN code. -! 03/28/08, Mark Flanner: added SNICAR, which required reversing the -! order of calls to SNICAR_RT and SoilAlbedo and the location where -! ground albedo is calculated -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: plandunit(:) ! index into landunit level quantities - integer , pointer :: itypelun(:) ! landunit type - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: cgridcell(:) ! gridcell of corresponding column - real(r8), pointer :: pwtgcell(:) ! weight of pft wrt corresponding gridcell - real(r8), pointer :: lat(:) ! gridcell latitude (radians) - real(r8), pointer :: lon(:) ! gridcell longitude (radians) - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: rhol(:,:) ! leaf reflectance: 1=vis, 2=nir - real(r8), pointer :: rhos(:,:) ! stem reflectance: 1=vis, 2=nir - real(r8), pointer :: taul(:,:) ! leaf transmittance: 1=vis, 2=nir - real(r8), pointer :: taus(:,:) ! stem transmittance: 1=vis, 2=nir - integer , pointer :: ivt(:) ! pft vegetation type -! -! local pointers toimplicit out arguments -! - real(r8), pointer :: coszen(:) ! cosine of solar zenith angle - real(r8), pointer :: fsun(:) ! sunlit fraction of canopy - real(r8), pointer :: albgrd(:,:) ! ground albedo (direct) - real(r8), pointer :: albgri(:,:) ! ground albedo (diffuse) - real(r8), pointer :: albd(:,:) ! surface albedo (direct) - real(r8), pointer :: albi(:,:) ! surface albedo (diffuse) - real(r8), pointer :: fabd(:,:) ! flux absorbed by veg per unit direct flux - real(r8), pointer :: fabi(:,:) ! flux absorbed by veg per unit diffuse flux - real(r8), pointer :: ftdd(:,:) ! down direct flux below veg per unit dir flx - real(r8), pointer :: ftid(:,:) ! down diffuse flux below veg per unit dir flx - real(r8), pointer :: ftii(:,:) ! down diffuse flux below veg per unit dif flx - real(r8), pointer :: decl(:) ! solar declination angle (radians) - real(r8), pointer :: gdir(:) ! leaf projection in solar direction (0 to 1) - real(r8), pointer :: omega(:,:) ! fraction of intercepted radiation that is scattered (0 to 1) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water content (col,lyr) [kg/m2] - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens content (col,lyr) [kg/m2] - real(r8), pointer :: mss_cnc_bcphi(:,:) ! mass concentration of hydrophilic BC (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_bcpho(:,:) ! mass concentration of hydrophobic BC (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_ocphi(:,:) ! mass concentration of hydrophilic OC (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_ocpho(:,:) ! mass concentration of hydrophobic OC (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst1(:,:) ! mass concentration of dust aerosol species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst2(:,:) ! mass concentration of dust aerosol species 2 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst3(:,:) ! mass concentration of dust aerosol species 3 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst4(:,:) ! mass concentration of dust aerosol species 4 (col,lyr) [kg/kg] - real(r8), pointer :: albsod(:,:) ! direct-beam soil albedo (col,bnd) [frc] - real(r8), pointer :: albsoi(:,:) ! diffuse soil albedo (col,bnd) [frc] - real(r8), pointer :: flx_absdv(:,:) ! direct flux absorption factor (col,lyr): VIS [frc] - real(r8), pointer :: flx_absdn(:,:) ! direct flux absorption factor (col,lyr): NIR [frc] - real(r8), pointer :: flx_absiv(:,:) ! diffuse flux absorption factor (col,lyr): VIS [frc] - real(r8), pointer :: flx_absin(:,:) ! diffuse flux absorption factor (col,lyr): NIR [frc] - real(r8), pointer :: snw_rds(:,:) ! snow grain radius (col,lyr) [microns] - real(r8), pointer :: albgrd_pur(:,:) ! pure snow ground albedo (direct) - real(r8), pointer :: albgri_pur(:,:) ! pure snow ground albedo (diffuse) - real(r8), pointer :: albgrd_bc(:,:) ! ground albedo without BC (direct) - real(r8), pointer :: albgri_bc(:,:) ! ground albedo without BC (diffuse) - real(r8), pointer :: albgrd_oc(:,:) ! ground albedo without OC (direct) - real(r8), pointer :: albgri_oc(:,:) ! ground albedo without OC (diffuse) - real(r8), pointer :: albgrd_dst(:,:) ! ground albedo without dust (direct) - real(r8), pointer :: albgri_dst(:,:) ! ground albedo without dust (diffuse) - real(r8), pointer :: albsnd_hst(:,:) ! snow albedo, direct, for history files (col,bnd) [frc] - real(r8), pointer :: albsni_hst(:,:) ! snow ground albedo, diffuse, for history files (col,bnd) [frc] -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - real(r8), parameter :: mpe = 1.e-06_r8 ! prevents overflow for division by zero - integer :: fp,fc,g,c,p ! indices - integer :: ib ! band index - integer :: ic ! 0=unit incoming direct; 1=unit incoming diffuse - real(r8) :: wl(lbp:ubp) ! fraction of LAI+SAI that is LAI - real(r8) :: ws(lbp:ubp) ! fraction of LAI+SAI that is SAI - real(r8) :: vai(lbp:ubp) ! elai+esai - real(r8) :: rho(lbp:ubp,numrad) ! leaf/stem refl weighted by fraction LAI and SAI - real(r8) :: tau(lbp:ubp,numrad) ! leaf/stem tran weighted by fraction LAI and SAI - real(r8) :: ftdi(lbp:ubp,numrad) ! down direct flux below veg per unit dif flux = 0 - real(r8) :: albsnd(lbc:ubc,numrad) ! snow albedo (direct) - real(r8) :: albsni(lbc:ubc,numrad) ! snow albedo (diffuse) - real(r8) :: ext(lbp:ubp) ! optical depth direct beam per unit LAI+SAI - real(r8) :: coszen_gcell(lbg:ubg) ! cosine solar zenith angle for next time step (gridcell level) - real(r8) :: coszen_col(lbc:ubc) ! cosine solar zenith angle for next time step (pft level) - real(r8) :: coszen_pft(lbp:ubp) ! cosine solar zenith angle for next time step (pft level) - integer :: num_vegsol ! number of vegetated pfts where coszen>0 - integer :: filter_vegsol(ubp-lbp+1) ! pft filter where vegetated and coszen>0 - integer :: num_novegsol ! number of vegetated pfts where coszen>0 - integer :: filter_novegsol(ubp-lbp+1) ! pft filter where vegetated and coszen>0 - integer, parameter :: nband =numrad ! number of solar radiation waveband classes - integer :: flg_slr ! flag for SNICAR (=1 if direct, =2 if diffuse) - integer :: flg_snw_ice ! flag for SNICAR (=1 when called from CLM, =2 when called from sea-ice) - real(r8) :: albsnd_pur(lbc:ubc,numrad) ! direct pure snow albedo (radiative forcing) - real(r8) :: albsni_pur(lbc:ubc,numrad) ! diffuse pure snow albedo (radiative forcing) - real(r8) :: albsnd_bc(lbc:ubc,numrad) ! direct snow albedo without BC (radiative forcing) - real(r8) :: albsni_bc(lbc:ubc,numrad) ! diffuse snow albedo without BC (radiative forcing) - real(r8) :: albsnd_oc(lbc:ubc,numrad) ! direct snow albedo without OC (radiative forcing) - real(r8) :: albsni_oc(lbc:ubc,numrad) ! diffuse snow albedo without OC (radiative forcing) - real(r8) :: albsnd_dst(lbc:ubc,numrad) ! direct snow albedo without dust (radiative forcing) - real(r8) :: albsni_dst(lbc:ubc,numrad) ! diffuse snow albedo without dust (radiative forcing) - integer :: i ! index for layers [idx] - real(r8) :: flx_absd_snw(lbc:ubc,-nlevsno+1:1,numrad) ! flux absorption factor for just snow (direct) [frc] - real(r8) :: flx_absi_snw(lbc:ubc,-nlevsno+1:1,numrad) ! flux absorption factor for just snow (diffuse) [frc] - real(r8) :: foo_snw(lbc:ubc,-nlevsno+1:1,numrad) ! dummy array for forcing calls - real(r8) :: albsfc(lbc:ubc,numrad) ! albedo of surface underneath snow (col,bnd) - real(r8) :: h2osno_liq(lbc:ubc,-nlevsno+1:0) ! liquid snow content (col,lyr) [kg m-2] - real(r8) :: h2osno_ice(lbc:ubc,-nlevsno+1:0) ! ice content in snow (col,lyr) [kg m-2] - integer :: snw_rds_in(lbc:ubc,-nlevsno+1:0) ! snow grain size sent to SNICAR (col,lyr) [microns] - real(r8) :: mss_cnc_aer_in_frc_pur(lbc:ubc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for forcing calculation (zero) (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_frc_bc(lbc:ubc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for BC forcing (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_frc_oc(lbc:ubc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for OC forcing (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_frc_dst(lbc:ubc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of aerosol species for dust forcing (col,lyr,aer) [kg kg-1] - real(r8) :: mss_cnc_aer_in_fdb(lbc:ubc,-nlevsno+1:0,sno_nbr_aer) ! mass concentration of all aerosol species for feedback calculation (col,lyr,aer) [kg kg-1] - !----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (gridcell-level) - - lat => grc%lat - lon => grc%lon - - ! Assign local pointers to derived subtypes components (landunit level) - - itypelun => lun%itype - - ! Assign local pointers to derived subtypes components (column-level) - - cgridcell => col%gridcell - h2osno => cws%h2osno - albgrd => cps%albgrd - albgri => cps%albgri - decl => cps%decl - coszen => cps%coszen - albsod => cps%albsod - albsoi => cps%albsoi - frac_sno => cps%frac_sno - flx_absdv => cps%flx_absdv - flx_absdn => cps%flx_absdn - flx_absiv => cps%flx_absiv - flx_absin => cps%flx_absin - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - snw_rds => cps%snw_rds - albgrd_pur => cps%albgrd_pur - albgri_pur => cps%albgri_pur - albgrd_bc => cps%albgrd_bc - albgri_bc => cps%albgri_bc - albgrd_oc => cps%albgrd_oc - albgri_oc => cps%albgri_oc - albgrd_dst => cps%albgrd_dst - albgri_dst => cps%albgri_dst - mss_cnc_bcphi => cps%mss_cnc_bcphi - mss_cnc_bcpho => cps%mss_cnc_bcpho - mss_cnc_ocphi => cps%mss_cnc_ocphi - mss_cnc_ocpho => cps%mss_cnc_ocpho - mss_cnc_dst1 => cps%mss_cnc_dst1 - mss_cnc_dst2 => cps%mss_cnc_dst2 - mss_cnc_dst3 => cps%mss_cnc_dst3 - mss_cnc_dst4 => cps%mss_cnc_dst4 - albsnd_hst => cps%albsnd_hst - albsni_hst => cps%albsni_hst - - ! Assign local pointers to derived subtypes components (pft-level) - - plandunit => pft%landunit - pgridcell => pft%gridcell - pcolumn => pft%column - pwtgcell => pft%wtgcell - albd => pps%albd - albi => pps%albi - fabd => pps%fabd - fabi => pps%fabi - ftdd => pps%ftdd - ftid => pps%ftid - ftii => pps%ftii - fsun => pps%fsun - elai => pps%elai - esai => pps%esai - gdir => pps%gdir - omega => pps%omega - ivt => pft%itype - rhol => pftcon%rhol - rhos => pftcon%rhos - taul => pftcon%taul - taus => pftcon%taus - - - ! Cosine solar zenith angle for next time step - - do g = lbg, ubg - coszen_gcell(g) = shr_orb_cosz (nextsw_cday, lat(g), lon(g), declinp1) - end do - - ! Save coszen and declination values to clm3 data structures for - ! use in other places in the CN and urban code - - do c = lbc,ubc - g = cgridcell(c) - coszen_col(c) = coszen_gcell(g) - coszen(c) = coszen_col(c) - decl(c) = declinp1 - end do - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) -! if (pwtgcell(p)>0._r8) then ! "if" added due to chg in filter definition - g = pgridcell(p) - coszen_pft(p) = coszen_gcell(g) -! end if ! then removed for CNDV (and dyn. landuse?) cases to work - end do - - ! Initialize output because solar radiation only done if coszen > 0 - - do ib = 1, numrad - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - albgrd(c,ib) = 0._r8 - albgri(c,ib) = 0._r8 - albgrd_pur(c,ib) = 0._r8 - albgri_pur(c,ib) = 0._r8 - albgrd_bc(c,ib) = 0._r8 - albgri_bc(c,ib) = 0._r8 - albgrd_oc(c,ib) = 0._r8 - albgri_oc(c,ib) = 0._r8 - albgrd_dst(c,ib) = 0._r8 - albgri_dst(c,ib) = 0._r8 - do i=-nlevsno+1,1,1 - flx_absdv(c,i) = 0._r8 - flx_absdn(c,i) = 0._r8 - flx_absiv(c,i) = 0._r8 - flx_absin(c,i) = 0._r8 - enddo - end do - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) -! if (pwtgcell(p)>0._r8) then ! "if" added due to chg in filter definition - albd(p,ib) = 1._r8 - albi(p,ib) = 1._r8 - fabd(p,ib) = 0._r8 - fabi(p,ib) = 0._r8 - ftdd(p,ib) = 0._r8 - ftid(p,ib) = 0._r8 - ftii(p,ib) = 0._r8 - omega(p,ib)= 0._r8 - if (ib==1) then - gdir(p) = 0._r8 - end if -! end if ! then removed for CNDV (and dyn. landuse?) cases to work - end do - end do - - ! SoilAlbedo called before SNICAR_RT - ! so that reflectance of soil beneath snow column is known - ! ahead of time for snow RT calculation. - - ! Snow albedos - ! Note that snow albedo routine will only compute nonzero snow albedos - ! where h2osno> 0 and coszen > 0 - - ! Ground surface albedos - ! Note that ground albedo routine will only compute nonzero snow albedos - ! where coszen > 0 - - call SoilAlbedo(lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, albsnd, albsni) - - ! set variables to pass to SNICAR. - - flg_snw_ice = 1 ! calling from CLM, not CSIM - do c=lbc,ubc - albsfc(c,:) = albsoi(c,:) - h2osno_liq(c,:) = h2osoi_liq(c,-nlevsno+1:0) - h2osno_ice(c,:) = h2osoi_ice(c,-nlevsno+1:0) - snw_rds_in(c,:) = nint(snw_rds(c,:)) - - ! zero aerosol input arrays - mss_cnc_aer_in_frc_pur(c,:,:) = 0._r8 - mss_cnc_aer_in_frc_bc(c,:,:) = 0._r8 - mss_cnc_aer_in_frc_oc(c,:,:) = 0._r8 - mss_cnc_aer_in_frc_dst(c,:,:) = 0._r8 - mss_cnc_aer_in_fdb(c,:,:) = 0._r8 - end do - - ! Set aerosol input arrays - ! feedback input arrays have been zeroed - ! set soot and dust aerosol concentrations: - if (DO_SNO_AER) then - mss_cnc_aer_in_fdb(lbc:ubc,:,1) = mss_cnc_bcphi(lbc:ubc,:) - mss_cnc_aer_in_fdb(lbc:ubc,:,2) = mss_cnc_bcpho(lbc:ubc,:) - - ! DO_SNO_OC is set in SNICAR_varpar. Default case is to ignore OC concentrations because: - ! 1) Knowledge of their optical properties is primitive - ! 2) When 'water-soluble' OPAC optical properties are applied to OC in snow, - ! it has a negligible darkening effect. - if (DO_SNO_OC) then - mss_cnc_aer_in_fdb(lbc:ubc,:,3) = mss_cnc_ocphi(lbc:ubc,:) - mss_cnc_aer_in_fdb(lbc:ubc,:,4) = mss_cnc_ocpho(lbc:ubc,:) - endif - - mss_cnc_aer_in_fdb(lbc:ubc,:,5) = mss_cnc_dst1(lbc:ubc,:) - mss_cnc_aer_in_fdb(lbc:ubc,:,6) = mss_cnc_dst2(lbc:ubc,:) - mss_cnc_aer_in_fdb(lbc:ubc,:,7) = mss_cnc_dst3(lbc:ubc,:) - mss_cnc_aer_in_fdb(lbc:ubc,:,8) = mss_cnc_dst4(lbc:ubc,:) - endif - - -! If radiative forcing is being calculated, first estimate clean-snow albedo - - if (use_snicar_frc) then - - ! 1. BC input array: - ! set dust and (optionally) OC concentrations, so BC_FRC=[(BC+OC+dust)-(OC+dust)] - mss_cnc_aer_in_frc_bc(lbc:ubc,:,5) = mss_cnc_dst1(lbc:ubc,:) - mss_cnc_aer_in_frc_bc(lbc:ubc,:,6) = mss_cnc_dst2(lbc:ubc,:) - mss_cnc_aer_in_frc_bc(lbc:ubc,:,7) = mss_cnc_dst3(lbc:ubc,:) - mss_cnc_aer_in_frc_bc(lbc:ubc,:,8) = mss_cnc_dst4(lbc:ubc,:) - if (DO_SNO_OC) then - mss_cnc_aer_in_frc_bc(lbc:ubc,:,3) = mss_cnc_ocphi(lbc:ubc,:) - mss_cnc_aer_in_frc_bc(lbc:ubc,:,4) = mss_cnc_ocpho(lbc:ubc,:) - endif - - ! BC FORCING CALCULATIONS - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_bc, albsfc, albsnd_bc, foo_snw) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_bc, albsfc, albsni_bc, foo_snw) - - - ! 2. OC input array: - ! set BC and dust concentrations, so OC_FRC=[(BC+OC+dust)-(BC+dust)] - if (DO_SNO_OC) then - mss_cnc_aer_in_frc_oc(lbc:ubc,:,1) = mss_cnc_bcphi(lbc:ubc,:) - mss_cnc_aer_in_frc_oc(lbc:ubc,:,2) = mss_cnc_bcpho(lbc:ubc,:) - mss_cnc_aer_in_frc_oc(lbc:ubc,:,5) = mss_cnc_dst1(lbc:ubc,:) - mss_cnc_aer_in_frc_oc(lbc:ubc,:,6) = mss_cnc_dst2(lbc:ubc,:) - mss_cnc_aer_in_frc_oc(lbc:ubc,:,7) = mss_cnc_dst3(lbc:ubc,:) - mss_cnc_aer_in_frc_oc(lbc:ubc,:,8) = mss_cnc_dst4(lbc:ubc,:) - - ! OC FORCING CALCULATIONS - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_oc, albsfc, albsnd_oc, foo_snw) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_oc, albsfc, albsni_oc, foo_snw) - endif - - ! 3. DUST input array: - ! set BC and OC concentrations, so DST_FRC=[(BC+OC+dust)-(BC+OC)] - mss_cnc_aer_in_frc_dst(lbc:ubc,:,1) = mss_cnc_bcphi(lbc:ubc,:) - mss_cnc_aer_in_frc_dst(lbc:ubc,:,2) = mss_cnc_bcpho(lbc:ubc,:) - if (DO_SNO_OC) then - mss_cnc_aer_in_frc_dst(lbc:ubc,:,3) = mss_cnc_ocphi(lbc:ubc,:) - mss_cnc_aer_in_frc_dst(lbc:ubc,:,4) = mss_cnc_ocpho(lbc:ubc,:) - endif - - ! DUST FORCING CALCULATIONS - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_dst, albsfc, albsnd_dst, foo_snw) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_dst, albsfc, albsni_dst, foo_snw) - - - ! 4. ALL AEROSOL FORCING CALCULATION - ! (pure snow albedo) - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_pur, albsfc, albsnd_pur, foo_snw) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_frc_pur, albsfc, albsni_pur, foo_snw) - - end if - - ! CLIMATE FEEDBACK CALCULATIONS, ALL AEROSOLS: - flg_slr = 1; ! direct-beam - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_fdb, albsfc, albsnd, flx_absd_snw) - - flg_slr = 2; ! diffuse - call SNICAR_RT(flg_snw_ice, lbc, ubc, num_nourbanc, filter_nourbanc, & - coszen_col, flg_slr, h2osno_liq, h2osno_ice, snw_rds_in, & - mss_cnc_aer_in_fdb, albsfc, albsni, flx_absi_snw) - - ! ground albedos and snow-fraction weighting of snow absorption factors - do ib = 1, nband - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - if (coszen(c) > 0._r8) then - ! ground albedo was originally computed in SoilAlbedo, but is now computed here - ! because the order of SoilAlbedo and SNICAR_RT was switched for SNICAR. - albgrd(c,ib) = albsod(c,ib)*(1._r8-frac_sno(c)) + albsnd(c,ib)*frac_sno(c) - albgri(c,ib) = albsoi(c,ib)*(1._r8-frac_sno(c)) + albsni(c,ib)*frac_sno(c) - - ! albedos for radiative forcing calculations: - if (use_snicar_frc) then - - ! BC forcing albedo - albgrd_bc(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_bc(c,ib)*frac_sno(c) - albgri_bc(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_bc(c,ib)*frac_sno(c) - - if (DO_SNO_OC) then - ! OC forcing albedo - albgrd_oc(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_oc(c,ib)*frac_sno(c) - albgri_oc(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_oc(c,ib)*frac_sno(c) - endif - - ! dust forcing albedo - albgrd_dst(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_dst(c,ib)*frac_sno(c) - albgri_dst(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_dst(c,ib)*frac_sno(c) - - ! pure snow albedo for all-aerosol radiative forcing - albgrd_pur(c,ib) = albsod(c,ib)*(1.-frac_sno(c)) + albsnd_pur(c,ib)*frac_sno(c) - albgri_pur(c,ib) = albsoi(c,ib)*(1.-frac_sno(c)) + albsni_pur(c,ib)*frac_sno(c) - - end if - - ! also in this loop (but optionally in a different loop for vectorized code) - ! weight snow layer radiative absorption factors based on snow fraction and soil albedo - ! (NEEDED FOR ENERGY CONSERVATION) - do i = -nlevsno+1,1,1 - if (ib == 1) then - flx_absdv(c,i) = flx_absd_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsod(c,ib))*(flx_absd_snw(c,i,ib)/(1.-albsnd(c,ib)))) - flx_absiv(c,i) = flx_absi_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsoi(c,ib))*(flx_absi_snw(c,i,ib)/(1.-albsni(c,ib)))) - elseif (ib == 2) then - flx_absdn(c,i) = flx_absd_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsod(c,ib))*(flx_absd_snw(c,i,ib)/(1.-albsnd(c,ib)))) - flx_absin(c,i) = flx_absi_snw(c,i,ib)*frac_sno(c) + & - ((1.-frac_sno(c))*(1-albsoi(c,ib))*(flx_absi_snw(c,i,ib)/(1.-albsni(c,ib)))) - endif - enddo - endif - enddo - enddo - - ! for diagnostics, set snow albedo to spval over non-snow points - ! so that it is not averaged in history buffer - ! (OPTIONAL) - do ib = 1, nband - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - if ((coszen(c) > 0._r8) .and. (h2osno(c) > 0._r8)) then - albsnd_hst(c,ib) = albsnd(c,ib) - albsni_hst(c,ib) = albsni(c,ib) - else - albsnd_hst(c,ib) = 0._r8 - albsni_hst(c,ib) = 0._r8 - endif - enddo - enddo - - ! Create solar-vegetated filter for the following calculations - - num_vegsol = 0 - num_novegsol = 0 - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - if (coszen_pft(p) > 0._r8) then - if ((itypelun(plandunit(p)) == istsoil .or. & - itypelun(plandunit(p)) == istcrop ) & - .and. (elai(p) + esai(p)) > 0._r8 & - .and. pwtgcell(p) > 0._r8) then - num_vegsol = num_vegsol + 1 - filter_vegsol(num_vegsol) = p - else - num_novegsol = num_novegsol + 1 - filter_novegsol(num_novegsol) = p - end if - end if - end do - - ! Weight reflectance/transmittance by lai and sai - ! Only perform on vegetated pfts where coszen > 0 - - do fp = 1,num_vegsol - p = filter_vegsol(fp) - vai(p) = elai(p) + esai(p) - wl(p) = elai(p) / max( vai(p), mpe ) - ws(p) = esai(p) / max( vai(p), mpe ) - end do - - do ib = 1, numrad - do fp = 1,num_vegsol - p = filter_vegsol(fp) - rho(p,ib) = max( rhol(ivt(p),ib)*wl(p) + rhos(ivt(p),ib)*ws(p), mpe ) - tau(p,ib) = max( taul(ivt(p),ib)*wl(p) + taus(ivt(p),ib)*ws(p), mpe ) - end do - end do - - ! Calculate surface albedos and fluxes - ! Only perform on vegetated pfts where coszen > 0 - - call TwoStream (lbc, ubc, lbp, ubp, filter_vegsol, num_vegsol, & - coszen_pft, vai, rho, tau) - - ! Determine values for non-vegetated pfts where coszen > 0 - - do ib = 1,numrad - do fp = 1,num_novegsol - p = filter_novegsol(fp) - c = pcolumn(p) - fabd(p,ib) = 0._r8 - fabi(p,ib) = 0._r8 - ftdd(p,ib) = 1._r8 - ftid(p,ib) = 0._r8 - ftii(p,ib) = 1._r8 - albd(p,ib) = albgrd(c,ib) - albi(p,ib) = albgri(c,ib) - gdir(p) = 0._r8 - end do - end do - - end subroutine SurfaceAlbedo - - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: SoilAlbedo -! -! !INTERFACE: - subroutine SoilAlbedo (lbc, ubc, num_nourbanc, filter_nourbanc, coszen, albsnd, albsni) -! -! !DESCRIPTION: -! Determine ground surface albedo, accounting for snow -! -! !USES: - use clmtype - use clm_varpar, only : numrad - use clm_varcon, only : albsat, albdry, alblak, tfrz, istice, istice_mec -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: num_nourbanc ! number of columns in non-urban points in column filter - integer , intent(in) :: filter_nourbanc(ubc-lbc+1) ! column filter for non-urban points - real(r8), intent(in) :: coszen(lbc:ubc) ! cos solar zenith angle next time step (column-level) - real(r8), intent(in) :: albsnd(lbc:ubc,numrad) ! snow albedo (direct) - real(r8), intent(in) :: albsni(lbc:ubc,numrad) ! snow albedo (diffuse) -! -! !CALLED FROM: -! subroutine SurfaceAlbedo in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 2/5/02, Peter Thornton: Migrated to new data structures. -! 8/20/03, Mariana Vertenstein: Vectorized routine -! 03/28/08, Mark Flanner: changes for SNICAR -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: isoicol(:) ! soil color class - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water [m3/m3] -! -! local pointers to original implicit out arguments -! - real(r8), pointer:: albgrd(:,:) ! ground albedo (direct) - real(r8), pointer:: albgri(:,:) ! ground albedo (diffuse) - ! albsod and albsoi are now clm_type variables so they can be used by SNICAR. - real(r8), pointer :: albsod(:,:) ! soil albedo (direct) - real(r8), pointer :: albsoi(:,:) ! soil albedo (diffuse) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer, parameter :: nband =numrad ! number of solar radiation waveband classes - integer :: fc ! non-urban filter column index - integer :: c,l ! indices - integer :: ib ! waveband number (1=vis, 2=nir) - real(r8) :: inc ! soil water correction factor for soil albedo - ! albsod and albsoi are now clm_type variables so they can be used by SNICAR. - !real(r8) :: albsod ! soil albedo (direct) - !real(r8) :: albsoi ! soil albedo (diffuse) - integer :: soilcol ! soilcolor -!----------------------------------------------------------------------- -!dir$ inlinenever SoilAlbedo - - ! Assign local pointers to derived subtypes components (column-level) - - clandunit => col%landunit - isoicol => cps%isoicol - t_grnd => ces%t_grnd - frac_sno => cps%frac_sno - h2osoi_vol => cws%h2osoi_vol - albgrd => cps%albgrd - albgri => cps%albgri - albsod => cps%albsod - albsoi => cps%albsoi - - ! Assign local pointers to derived subtypes components (landunit-level) - - ltype => lun%itype - - ! Compute soil albedos - - do ib = 1, nband - do fc = 1,num_nourbanc - c = filter_nourbanc(fc) - if (coszen(c) > 0._r8) then - l = clandunit(c) - - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then ! soil - inc = max(0.11_r8-0.40_r8*h2osoi_vol(c,1), 0._r8) - soilcol = isoicol(c) - ! changed from local variable to clm_type: - !albsod = min(albsat(soilcol,ib)+inc, albdry(soilcol,ib)) - !albsoi = albsod - albsod(c,ib) = min(albsat(soilcol,ib)+inc, albdry(soilcol,ib)) - albsoi(c,ib) = albsod(c,ib) - else if (ltype(l) == istice .or. ltype(l) == istice_mec) then ! land ice - ! changed from local variable to clm_type: - !albsod = albice(ib) - !albsoi = albsod - albsod(c,ib) = albice(ib) - albsoi(c,ib) = albsod(c,ib) - else if (t_grnd(c) > tfrz) then ! unfrozen lake, wetland - ! changed from local variable to clm_type: - !albsod = 0.05_r8/(max(0.001_r8,coszen(c)) + 0.15_r8) - !albsoi = albsod - albsod(c,ib) = 0.05_r8/(max(0.001_r8,coszen(c)) + 0.15_r8) - albsoi(c,ib) = albsod(c,ib) - else ! frozen lake, wetland - ! changed from local variable to clm_type: - !albsod = alblak(ib) - !albsoi = albsod - albsod(c,ib) = alblak(ib) - albsoi(c,ib) = albsod(c,ib) - end if - - ! Weighting is done in SurfaceAlbedo, after the call to SNICAR_RT - ! This had to be done, because SoilAlbedo is called before SNICAR_RT, so at - ! this point, snow albedo is not yet known. - end if - end do - end do - - end subroutine SoilAlbedo - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: TwoStream -! -! !INTERFACE: - subroutine TwoStream (lbc, ubc, lbp, ubp, filter_vegsol, num_vegsol, & - coszen, vai, rho, tau) -! -! !DESCRIPTION: -! Two-stream fluxes for canopy radiative transfer -! Use two-stream approximation of Dickinson (1983) Adv Geophysics -! 25:305-353 and Sellers (1985) Int J Remote Sensing 6:1335-1372 -! to calculate fluxes absorbed by vegetation, reflected by vegetation, -! and transmitted through vegetation for unit incoming direct or diffuse -! flux given an underlying surface with known albedo. -! -! !USES: - use clmtype - use clm_varpar, only : numrad - use clm_varcon, only : omegas, tfrz, betads, betais -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! column bounds - integer , intent(in) :: lbp, ubp ! pft bounds - integer , intent(in) :: filter_vegsol(ubp-lbp+1) ! filter for vegetated pfts with coszen>0 - integer , intent(in) :: num_vegsol ! number of vegetated pfts where coszen>0 - real(r8), intent(in) :: coszen(lbp:ubp) ! cosine solar zenith angle for next time step - real(r8), intent(in) :: vai(lbp:ubp) ! elai+esai - real(r8), intent(in) :: rho(lbp:ubp,numrad) ! leaf/stem refl weighted by fraction LAI and SAI - real(r8), intent(in) :: tau(lbp:ubp,numrad) ! leaf/stem tran weighted by fraction LAI and SAI -! -! !CALLED FROM: -! subroutine SurfaceAlbedo in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! Modified for speedup: Mariana Vertenstein, 8/26/02 -! Vectorized routine: Mariana Vertenstein: 8/20/03 -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in scalars -! - integer , pointer :: pcolumn(:) ! column of corresponding pft - real(r8), pointer :: albgrd(:,:) ! ground albedo (direct) (column-level) - real(r8), pointer :: albgri(:,:) ! ground albedo (diffuse)(column-level) - real(r8), pointer :: t_veg(:) ! vegetation temperature (Kelvin) - real(r8), pointer :: fwet(:) ! fraction of canopy that is wet (0 to 1) - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: xl(:) ! ecophys const - leaf/stem orientation index -! -! local pointers to implicit out scalars -! - real(r8), pointer :: albd(:,:) ! surface albedo (direct) - real(r8), pointer :: albi(:,:) ! surface albedo (diffuse) - real(r8), pointer :: fabd(:,:) ! flux absorbed by veg per unit direct flux - real(r8), pointer :: fabi(:,:) ! flux absorbed by veg per unit diffuse flux - real(r8), pointer :: ftdd(:,:) ! down direct flux below veg per unit dir flx - real(r8), pointer :: ftid(:,:) ! down diffuse flux below veg per unit dir flx - real(r8), pointer :: ftii(:,:) ! down diffuse flux below veg per unit dif flx - real(r8), pointer :: gdir(:) ! leaf projection in solar direction (0 to 1) - real(r8), pointer :: omega(:,:) ! fraction of intercepted radiation that is scattered (0 to 1) -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: fp,p,c ! array indices - !integer :: ic ! 0=unit incoming direct; 1=unit incoming diffuse - integer :: ib ! waveband number - real(r8) :: cosz ! 0.001 <= coszen <= 1.000 - real(r8) :: asu ! single scattering albedo - real(r8) :: chil(lbp:ubp) ! -0.4 <= xl <= 0.6 - real(r8) :: twostext(lbp:ubp)! optical depth of direct beam per unit leaf area - real(r8) :: avmu(lbp:ubp) ! average diffuse optical depth - real(r8) :: omegal ! omega for leaves - real(r8) :: betai ! upscatter parameter for diffuse radiation - real(r8) :: betail ! betai for leaves - real(r8) :: betad ! upscatter parameter for direct beam radiation - real(r8) :: betadl ! betad for leaves - real(r8) :: tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7,tmp8,tmp9 ! temporary - real(r8) :: p1,p2,p3,p4,s1,s2,u1,u2,u3 ! temporary - real(r8) :: b,c1,d,d1,d2,f,h,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10 ! temporary - real(r8) :: phi1,phi2,sigma ! temporary - real(r8) :: temp0(lbp:ubp),temp1,temp2(lbp:ubp) ! temporary - real(r8) :: t1 -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (column-level) - - albgrd => cps%albgrd - albgri => cps%albgri - - ! Assign local pointers to derived subtypes components (pft-level) - - pcolumn => pft%column - fwet => pps%fwet - t_veg => pes%t_veg - ivt => pft%itype - albd => pps%albd - albi => pps%albi - fabd => pps%fabd - fabi => pps%fabi - ftdd => pps%ftdd - ftid => pps%ftid - ftii => pps%ftii - gdir => pps%gdir - omega => pps%omega - xl => pftcon%xl - - ! Calculate two-stream parameters omega, betad, betai, avmu, gdir, twostext. - ! Omega, betad, betai are adjusted for snow. Values for omega*betad - ! and omega*betai are calculated and then divided by the new omega - ! because the product omega*betai, omega*betad is used in solution. - ! Also, the transmittances and reflectances (tau, rho) are linear - ! weights of leaf and stem values. - - do fp = 1,num_vegsol - p = filter_vegsol(fp) - - ! note that the following limit only acts on cosz values > 0 and less than - ! 0.001, not on values cosz = 0, since these zero have already been filtered - ! out in filter_vegsol - cosz = max(0.001_r8, coszen(p)) - - chil(p) = min( max(xl(ivt(p)), -0.4_r8), 0.6_r8 ) - if (abs(chil(p)) <= 0.01_r8) chil(p) = 0.01_r8 - phi1 = 0.5_r8 - 0.633_r8*chil(p) - 0.330_r8*chil(p)*chil(p) - phi2 = 0.877_r8 * (1._r8-2._r8*phi1) - gdir(p) = phi1 + phi2*cosz - twostext(p) = gdir(p)/cosz - avmu(p) = ( 1._r8 - phi1/phi2 * log((phi1+phi2)/phi1) ) / phi2 - temp0(p) = gdir(p) + phi2*cosz - temp1 = phi1*cosz - temp2(p) = ( 1._r8 - temp1/temp0(p) * log((temp1+temp0(p))/temp1) ) - end do - - do ib = 1, numrad - do fp = 1,num_vegsol - p = filter_vegsol(fp) - c = pcolumn(p) - - omegal = rho(p,ib) + tau(p,ib) - asu = 0.5_r8*omegal*gdir(p)/temp0(p) *temp2(p) - betadl = (1._r8+avmu(p)*twostext(p))/(omegal*avmu(p)*twostext(p))*asu - betail = 0.5_r8 * ((rho(p,ib)+tau(p,ib)) + (rho(p,ib)-tau(p,ib)) & - * ((1._r8+chil(p))/2._r8)**2) / omegal - - ! Adjust omega, betad, and betai for intercepted snow - - if (t_veg(p) > tfrz) then !no snow - tmp0 = omegal - tmp1 = betadl - tmp2 = betail - else - tmp0 = (1._r8-fwet(p))*omegal + fwet(p)*omegas(ib) - tmp1 = ( (1._r8-fwet(p))*omegal*betadl + fwet(p)*omegas(ib)*betads ) / tmp0 - tmp2 = ( (1._r8-fwet(p))*omegal*betail + fwet(p)*omegas(ib)*betais ) / tmp0 - end if - omega(p,ib) = tmp0 - betad = tmp1 - betai = tmp2 - - ! Absorbed, reflected, transmitted fluxes per unit incoming radiation - - b = 1._r8 - omega(p,ib) + omega(p,ib)*betai - c1 = omega(p,ib)*betai - tmp0 = avmu(p)*twostext(p) - d = tmp0 * omega(p,ib)*betad - f = tmp0 * omega(p,ib)*(1._r8-betad) - tmp1 = b*b - c1*c1 - h = sqrt(tmp1) / avmu(p) - sigma = tmp0*tmp0 - tmp1 - p1 = b + avmu(p)*h - p2 = b - avmu(p)*h - p3 = b + tmp0 - p4 = b - tmp0 - - ! PET, 03/01/04: added this test to avoid floating point errors in exp() - ! EBK, 04/15/08: always do this for all modes -- not just CN - - t1 = min(h*vai(p), 40._r8) - s1 = exp(-t1) - t1 = min(twostext(p)*vai(p), 40._r8) - s2 = exp(-t1) - - ! Determine fluxes for vegetated pft for unit incoming direct - ! Loop over incoming direct and incoming diffuse - ! 0=unit incoming direct; 1=unit incoming diffuse - - ! ic = 0 unit incoming direct flux - ! ======================================== - - u1 = b - c1/albgrd(c,ib) - u2 = b - c1*albgrd(c,ib) - u3 = f + c1*albgrd(c,ib) - - tmp2 = u1 - avmu(p)*h - tmp3 = u1 + avmu(p)*h - d1 = p1*tmp2/s1 - p2*tmp3*s1 - tmp4 = u2 + avmu(p)*h - tmp5 = u2 - avmu(p)*h - d2 = tmp4/s1 - tmp5*s1 - h1 = -d*p4 - c1*f - tmp6 = d - h1*p3/sigma - tmp7 = ( d - c1 - h1/sigma*(u1+tmp0) ) * s2 - h2 = ( tmp6*tmp2/s1 - p2*tmp7 ) / d1 - h3 = - ( tmp6*tmp3*s1 - p1*tmp7 ) / d1 - h4 = -f*p3 - c1*d - tmp8 = h4/sigma - tmp9 = ( u3 - tmp8*(u2-tmp0) ) * s2 - h5 = - ( tmp8*tmp4/s1 + tmp9 ) / d2 - h6 = ( tmp8*tmp5*s1 + tmp9 ) / d2 - h7 = (c1*tmp2) / (d1*s1) - h8 = (-c1*tmp3*s1) / d1 - h9 = tmp4 / (d2*s1) - h10 = (-tmp5*s1) / d2 - - ! Downward direct and diffuse fluxes below vegetation (ic = 0) - - ftdd(p,ib) = s2 - ftid(p,ib) = h4*s2/sigma + h5*s1 + h6/s1 - - ! Flux reflected by vegetation (ic = 0) - - albd(p,ib) = h1/sigma + h2 + h3 - - ! Flux absorbed by vegetation (ic = 0) - - fabd(p,ib) = 1._r8 - albd(p,ib) & - - (1._r8-albgrd(c,ib))*ftdd(p,ib) - (1._r8-albgri(c,ib))*ftid(p,ib) - - ! ic = 1 unit incoming diffuse - ! ======================================== - - u1 = b - c1/albgri(c,ib) - u2 = b - c1*albgri(c,ib) - u3 = f + c1*albgri(c,ib) - - tmp2 = u1 - avmu(p)*h - tmp3 = u1 + avmu(p)*h - d1 = p1*tmp2/s1 - p2*tmp3*s1 - tmp4 = u2 + avmu(p)*h - tmp5 = u2 - avmu(p)*h - d2 = tmp4/s1 - tmp5*s1 - h1 = -d*p4 - c1*f - tmp6 = d - h1*p3/sigma - tmp7 = ( d - c1 - h1/sigma*(u1+tmp0) ) * s2 - h2 = ( tmp6*tmp2/s1 - p2*tmp7 ) / d1 - h3 = - ( tmp6*tmp3*s1 - p1*tmp7 ) / d1 - h4 = -f*p3 - c1*d - tmp8 = h4/sigma - tmp9 = ( u3 - tmp8*(u2-tmp0) ) * s2 - h5 = - ( tmp8*tmp4/s1 + tmp9 ) / d2 - h6 = ( tmp8*tmp5*s1 + tmp9 ) / d2 - h7 = (c1*tmp2) / (d1*s1) - h8 = (-c1*tmp3*s1) / d1 - h9 = tmp4 / (d2*s1) - h10 = (-tmp5*s1) / d2 - - ! Downward direct and diffuse fluxes below vegetation - - ftii(p,ib) = h9*s1 + h10/s1 - - ! Flux reflected by vegetation - - albi(p,ib) = h7 + h8 - - ! Flux absorbed by vegetation - - fabi(p,ib) = 1._r8 - albi(p,ib) - (1._r8-albgri(c,ib))*ftii(p,ib) - - end do ! end of pft loop - end do ! end of radiation band loop - - end subroutine TwoStream - -end module SurfaceAlbedoMod diff --git a/src_clm40/biogeophys/SurfaceRadiationMod.F90 b/src_clm40/biogeophys/SurfaceRadiationMod.F90 deleted file mode 100644 index d8e87f78c1..0000000000 --- a/src_clm40/biogeophys/SurfaceRadiationMod.F90 +++ /dev/null @@ -1,801 +0,0 @@ -module SurfaceRadiationMod - -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: SurfaceRadiationMod -! -! !DESCRIPTION: -! Calculate solar fluxes absorbed by vegetation and ground surface -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varctl , only: iulog - -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: SurfaceRadiation ! Solar fluxes absorbed by veg and ground surface -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 11/26/03, Peter Thornton: Added new routine for improved treatment of -! sunlit/shaded canopy radiation. -! 4/26/05, Peter Thornton: Adopted the sun/shade algorithm as the default, -! removed the old SurfaceRadiation(), and renamed SurfaceRadiationSunShade() -! as SurfaceRadiation(). -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: SurfaceRadiation -! -! !INTERFACE: - subroutine SurfaceRadiation(lbp, ubp, num_nourbanp, filter_nourbanp) -! -! !DESCRIPTION: -! Solar fluxes absorbed by vegetation and ground surface -! Note possible problem when land is on different grid than atmosphere. -! Land may have sun above the horizon (coszen > 0) but atmosphere may -! have sun below the horizon (forc_solad = 0 and forc_solai = 0). This is okay -! because all fluxes (absorbed, reflected, transmitted) are multiplied -! by the incoming flux and all will equal zero. -! Atmosphere may have sun above horizon (forc_solad > 0 and forc_solai > 0) but -! land may have sun below horizon. This is okay because fabd, fabi, -! ftdd, ftid, and ftii all equal zero so that sabv=sabg=fsa=0. Also, -! albd and albi equal one so that fsr=forc_solad+forc_solai. In other words, all -! the radiation is reflected. NDVI should equal zero in this case. -! However, the way the code is currently implemented this is only true -! if (forc_solad+forc_solai)|vis = (forc_solad+forc_solai)|nir. -! Output variables are parsun,parsha,sabv,sabg,fsa,fsr,ndvi -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use clm_varpar , only : numrad - use clm_varcon , only : spval, istsoil, degpsec, isecspday - use clm_varcon , only : istice_mec - use clm_varcon , only : istcrop - use clm_time_manager, only : get_curr_date, get_step_size - use clm_varpar , only : nlevsno - use SNICARMod , only : DO_SNO_OC - use abortutils , only : endrun - use clm_varctl , only : use_snicar_frc -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbp, ubp ! pft upper and lower bounds - integer, intent(in) :: num_nourbanp ! number of pfts in non-urban points in pft filter - integer, intent(in) :: filter_nourbanp(ubp-lbp+1) ! pft filter for non-urban points -! -! !CALLED FROM: -! subroutine Biogeophysics1 in module Biogeophysics1Mod -! subroutine BiogeophysicsLake in module BiogeophysicsLakeMod -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 2/18/02, Peter Thornton: Migrated to new data structures. Added a pft loop. -! 6/05/03, Peter Thornton: Modified sunlit/shaded canopy treatment. Original code -! had all radiation being absorbed in the sunlit canopy, and now the sunlit and shaded -! canopies are each given the appropriate fluxes. There was also an inconsistency in -! the original code, where parsun was not being scaled by leaf area, and so represented -! the entire canopy flux. This goes into Stomata (in CanopyFluxes) where it is assumed -! to be a flux per unit leaf area. In addition, the fpsn flux coming out of Stomata was -! being scaled back up to the canopy by multiplying by lai, but the input radiation flux was -! for the entire canopy to begin with. Corrected this inconsistency in this version, so that -! the parsun and parsha fluxes going into canopy fluxes are per unit lai in the sunlit and -! shaded canopies. -! 6/9/03, Peter Thornton: Moved coszen from gps to c%cps to avoid problem -! with OpenMP threading over columns, where different columns hit the radiation -! time step at different times during execution. -! 6/10/03, Peter Thornton: Added constraint on negative tot_aid, instead of -! exiting with error. Appears to be happening only at roundoff level. -! 6/11/03, Peter Thornton: Moved calculation of ext inside if (coszen), -! and added check on laisun = 0 and laisha = 0 in calculation of sun_aperlai -! and sha_aperlai. -! 11/26/03, Peter Thornton: During migration to new vector code, created -! this as a new routine to handle sunlit/shaded canopy calculations. -! 03/28/08, Mark Flanner: Incorporated SNICAR, including absorbed solar radiation -! in each snow layer and top soil layer, and optional radiative forcing calculation -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: ivt(:) ! pft vegetation type - integer , pointer :: pcolumn(:) ! pft's column index - integer , pointer :: pgridcell(:) ! pft's gridcell index - real(r8), pointer :: pwtgcell(:) ! pft's weight relative to corresponding gridcell - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow - real(r8), pointer :: londeg(:) ! longitude (degrees) - real(r8), pointer :: latdeg(:) ! latitude (degrees) - real(r8), pointer :: slasun(:) ! specific leaf area for sunlit canopy, projected area basis (m^2/gC) - real(r8), pointer :: slasha(:) ! specific leaf area for shaded canopy, projected area basis (m^2/gC) - real(r8), pointer :: gdir(:) ! leaf projection in solar direction (0 to 1) - real(r8), pointer :: omega(:,:) ! fraction of intercepted radiation that is scattered (0 to 1) - real(r8), pointer :: coszen(:) ! cosine of solar zenith angle - real(r8), pointer :: forc_solad(:,:) ! direct beam radiation (W/m**2) - real(r8), pointer :: forc_solai(:,:) ! diffuse radiation (W/m**2) - real(r8), pointer :: fabd(:,:) ! flux absorbed by veg per unit direct flux - real(r8), pointer :: fabi(:,:) ! flux absorbed by veg per unit diffuse flux - real(r8), pointer :: ftdd(:,:) ! down direct flux below veg per unit dir flx - real(r8), pointer :: ftid(:,:) ! down diffuse flux below veg per unit dir flx - real(r8), pointer :: ftii(:,:) ! down diffuse flux below veg per unit dif flx - real(r8), pointer :: albgrd(:,:) ! ground albedo (direct) - real(r8), pointer :: albgri(:,:) ! ground albedo (diffuse) - real(r8), pointer :: albd(:,:) ! surface albedo (direct) - real(r8), pointer :: albi(:,:) ! surface albedo (diffuse) - real(r8), pointer :: slatop(:) ! specific leaf area at top of canopy, projected area basis [m^2/gC] - real(r8), pointer :: dsladlai(:) ! dSLA/dLAI, projected area basis [m^2/gC] -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: fsun(:) ! sunlit fraction of canopy - real(r8), pointer :: laisun(:) ! sunlit leaf area - real(r8), pointer :: laisha(:) ! shaded leaf area - real(r8), pointer :: sabg(:) ! solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: sabv(:) ! solar radiation absorbed by vegetation (W/m**2) - real(r8), pointer :: fsa(:) ! solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_r(:) ! rural solar radiation absorbed (total) (W/m**2) - integer , pointer :: ityplun(:) ! landunit type - integer , pointer :: plandunit(:) ! index into landunit level quantities - real(r8), pointer :: parsun(:) ! average absorbed PAR for sunlit leaves (W/m**2) - real(r8), pointer :: parsha(:) ! average absorbed PAR for shaded leaves (W/m**2) - real(r8), pointer :: fsr(:) ! solar radiation reflected (W/m**2) - real(r8), pointer :: fsds_vis_d(:) ! incident direct beam vis solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_d(:) ! incident direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsds_vis_i(:) ! incident diffuse vis solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_i(:) ! incident diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsr_vis_d(:) ! reflected direct beam vis solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_d(:) ! reflected direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsr_vis_i(:) ! reflected diffuse vis solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_i(:) ! reflected diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsds_vis_d_ln(:) ! incident direct beam vis solar rad at local noon (W/m**2) - real(r8), pointer :: fsds_nir_d_ln(:) ! incident direct beam nir solar rad at local noon (W/m**2) - real(r8), pointer :: fsr_vis_d_ln(:) ! reflected direct beam vis solar rad at local noon (W/m**2) - real(r8), pointer :: fsr_nir_d_ln(:) ! reflected direct beam nir solar rad at local noon (W/m**2) - real(r8), pointer :: eff_kid(:,:) ! effective extinction coefficient for indirect from direct - real(r8), pointer :: eff_kii(:,:) ! effective extinction coefficient for indirect from indirect - real(r8), pointer :: sun_faid(:,:) ! fraction sun canopy absorbed indirect from direct - real(r8), pointer :: sun_faii(:,:) ! fraction sun canopy absorbed indirect from indirect - real(r8), pointer :: sha_faid(:,:) ! fraction shade canopy absorbed indirect from direct - real(r8), pointer :: sha_faii(:,:) ! fraction shade canopy absorbed indirect from indirect - real(r8), pointer :: sun_add(:,:) ! sun canopy absorbed direct from direct (W/m**2) - real(r8), pointer :: tot_aid(:,:) ! total canopy absorbed indirect from direct (W/m**2) - real(r8), pointer :: sun_aid(:,:) ! sun canopy absorbed indirect from direct (W/m**2) - real(r8), pointer :: sun_aii(:,:) ! sun canopy absorbed indirect from indirect (W/m**2) - real(r8), pointer :: sha_aid(:,:) ! shade canopy absorbed indirect from direct (W/m**2) - real(r8), pointer :: sha_aii(:,:) ! shade canopy absorbed indirect from indirect (W/m**2) - real(r8), pointer :: sun_atot(:,:) ! sun canopy total absorbed (W/m**2) - real(r8), pointer :: sha_atot(:,:) ! shade canopy total absorbed (W/m**2) - real(r8), pointer :: sun_alf(:,:) ! sun canopy total absorbed by leaves (W/m**2) - real(r8), pointer :: sha_alf(:,:) ! shade canopy total absored by leaves (W/m**2) - real(r8), pointer :: sun_aperlai(:,:) ! sun canopy total absorbed per unit LAI (W/m**2) - real(r8), pointer :: sha_aperlai(:,:) ! shade canopy total absorbed per unit LAI (W/m**2) - real(r8), pointer :: flx_absdv(:,:) ! direct flux absorption factor (col,lyr): VIS [frc] - real(r8), pointer :: flx_absdn(:,:) ! direct flux absorption factor (col,lyr): NIR [frc] - real(r8), pointer :: flx_absiv(:,:) ! diffuse flux absorption factor (col,lyr): VIS [frc] - real(r8), pointer :: flx_absin(:,:) ! diffuse flux absorption factor (col,lyr): NIR [frc] - integer , pointer :: snl(:) ! negative number of snow layers [nbr] - real(r8), pointer :: albgrd_pur(:,:) ! pure snow ground albedo (direct) - real(r8), pointer :: albgri_pur(:,:) ! pure snow ground albedo (diffuse) - real(r8), pointer :: albgrd_bc(:,:) ! ground albedo without BC (direct) (col,bnd) - real(r8), pointer :: albgri_bc(:,:) ! ground albedo without BC (diffuse) (col,bnd) - real(r8), pointer :: albgrd_oc(:,:) ! ground albedo without OC (direct) (col,bnd) - real(r8), pointer :: albgri_oc(:,:) ! ground albedo without OC (diffuse) (col,bnd) - real(r8), pointer :: albgrd_dst(:,:) ! ground albedo without dust (direct) (col,bnd) - real(r8), pointer :: albgri_dst(:,:) ! ground albedo without dust (diffuse) (col,bnd) - real(r8), pointer :: albsnd_hst(:,:) ! snow albedo, direct, for history files (col,bnd) [frc] - real(r8), pointer :: albsni_hst(:,:) ! snow ground albedo, diffuse, for history files (col,bnd - real(r8), pointer :: sabg_lyr(:,:) ! absorbed radiative flux (pft,lyr) [W/m2] - real(r8), pointer :: sfc_frc_aer(:) ! surface forcing of snow with all aerosols (pft) [W/m2] - real(r8), pointer :: sfc_frc_bc(:) ! surface forcing of snow with BC (pft) [W/m2] - real(r8), pointer :: sfc_frc_oc(:) ! surface forcing of snow with OC (pft) [W/m2] - real(r8), pointer :: sfc_frc_dst(:) ! surface forcing of snow with dust (pft) [W/m2] - real(r8), pointer :: sfc_frc_aer_sno(:) ! surface forcing of snow with all aerosols, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: sfc_frc_bc_sno(:) ! surface forcing of snow with BC, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: sfc_frc_oc_sno(:) ! surface forcing of snow with OC, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: sfc_frc_dst_sno(:) ! surface forcing of snow with dust, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: fsr_sno_vd(:) ! reflected visible, direct radiation from snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsr_sno_nd(:) ! reflected near-IR, direct radiation from snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsr_sno_vi(:) ! reflected visible, diffuse radiation from snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsr_sno_ni(:) ! reflected near-IR, diffuse radiation from snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsds_sno_vd(:) ! incident visible, direct radiation on snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsds_sno_nd(:) ! incident near-IR, direct radiation on snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsds_sno_vi(:) ! incident visible, diffuse radiation on snow (for history files) (pft) [W/m2] - real(r8), pointer :: fsds_sno_ni(:) ! incident near-IR, diffuse radiation on snow (for history files) (pft) [W/m2] - real(r8), pointer :: snowdp(:) ! snow height (m) - -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer , parameter :: nband = numrad ! number of solar radiation waveband classes - real(r8), parameter :: mpe = 1.e-06_r8 ! prevents overflow for division by zero - integer :: fp ! non-urban filter pft index - integer :: p ! pft index - integer :: c ! column index - integer :: l ! landunit index - integer :: g ! grid cell index - integer :: ib ! waveband number (1=vis, 2=nir) - real(r8) :: absrad ! absorbed solar radiation (W/m**2) - real(r8) :: rnir ! reflected solar radiation [nir] (W/m**2) - real(r8) :: rvis ! reflected solar radiation [vis] (W/m**2) - real(r8) :: laifra ! leaf area fraction of canopy - real(r8) :: trd(lbp:ubp,numrad) ! transmitted solar radiation: direct (W/m**2) - real(r8) :: tri(lbp:ubp,numrad) ! transmitted solar radiation: diffuse (W/m**2) - real(r8) :: cad(lbp:ubp,numrad) ! direct beam absorbed by canopy (W/m**2) - real(r8) :: cai(lbp:ubp,numrad) ! diffuse radiation absorbed by canopy (W/m**2) - real(r8) :: vai(lbp:ubp) ! total leaf area index + stem area index, one sided - real(r8) :: ext ! optical depth direct beam per unit LAI+SAI - real(r8) :: t1, t2 ! temporary variables - real(r8) :: cosz - integer :: local_secp1 ! seconds into current date in local time - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day,secs ! calendar info for current time step - integer :: i ! layer index [idx] - real(r8) :: sabg_snl_sum ! temporary, absorbed energy in all active snow layers [W/m2] - real(r8) :: absrad_pur ! temp: absorbed solar radiation by pure snow [W/m2] - real(r8) :: absrad_bc ! temp: absorbed solar radiation without BC [W/m2] - real(r8) :: absrad_oc ! temp: absorbed solar radiation without OC [W/m2] - real(r8) :: absrad_dst ! temp: absorbed solar radiation without dust [W/m2] - real(r8) :: sabg_pur(lbp:ubp) ! solar radiation absorbed by ground with pure snow [W/m2] - real(r8) :: sabg_bc(lbp:ubp) ! solar radiation absorbed by ground without BC [W/m2] - real(r8) :: sabg_oc(lbp:ubp) ! solar radiation absorbed by ground without OC [W/m2] - real(r8) :: sabg_dst(lbp:ubp) ! solar radiation absorbed by ground without dust [W/m2] -!------------------------------------------------------------------------------ - - ! Assign local pointers to multi-level derived type members (gridcell level) - - londeg => grc%londeg - latdeg => grc%latdeg - forc_solad => clm_a2l%forc_solad - forc_solai => clm_a2l%forc_solai - - ! Assign local pointers to multi-level derived type members (landunit level) - - ityplun => lun%itype - - ! Assign local pointers to multi-level derived type members (column level) - - albgrd => cps%albgrd - albgri => cps%albgri - coszen => cps%coszen - - ! Assign local pointers to derived type members (pft-level) - - plandunit => pft%landunit - ivt => pft%itype - pcolumn => pft%column - pgridcell => pft%gridcell - pwtgcell => pft%wtgcell - elai => pps%elai - esai => pps%esai - slasun => pps%slasun - slasha => pps%slasha - gdir => pps%gdir - omega => pps%omega - laisun => pps%laisun - laisha => pps%laisha - fabd => pps%fabd - fabi => pps%fabi - ftdd => pps%ftdd - ftid => pps%ftid - ftii => pps%ftii - albd => pps%albd - albi => pps%albi - fsun => pps%fsun - sabg => pef%sabg - sabv => pef%sabv - snowdp => cps%snowdp - fsa => pef%fsa - fsa_r => pef%fsa_r - fsr => pef%fsr - parsun => pef%parsun - parsha => pef%parsha - fsds_vis_d => pef%fsds_vis_d - fsds_nir_d => pef%fsds_nir_d - fsds_vis_i => pef%fsds_vis_i - fsds_nir_i => pef%fsds_nir_i - fsr_vis_d => pef%fsr_vis_d - fsr_nir_d => pef%fsr_nir_d - fsr_vis_i => pef%fsr_vis_i - fsr_nir_i => pef%fsr_nir_i - fsds_vis_d_ln => pef%fsds_vis_d_ln - fsds_nir_d_ln => pef%fsds_nir_d_ln - fsr_vis_d_ln => pef%fsr_vis_d_ln - fsr_nir_d_ln => pef%fsr_nir_d_ln - eff_kid => pps%eff_kid - eff_kii => pps%eff_kii - sun_faid => pps%sun_faid - sun_faii => pps%sun_faii - sha_faid => pps%sha_faid - sha_faii => pps%sha_faii - sun_add => pef%sun_add - tot_aid => pef%tot_aid - sun_aid => pef%sun_aid - sun_aii => pef%sun_aii - sha_aid => pef%sha_aid - sha_aii => pef%sha_aii - sun_atot => pef%sun_atot - sha_atot => pef%sha_atot - sun_alf => pef%sun_alf - sha_alf => pef%sha_alf - sun_aperlai => pef%sun_aperlai - sha_aperlai => pef%sha_aperlai - - ! Assign local pointers to derived type members (ecophysiological) - - slatop => pftcon%slatop - dsladlai => pftcon%dsladlai - frac_sno => cps%frac_sno - flx_absdv => cps%flx_absdv - flx_absdn => cps%flx_absdn - flx_absiv => cps%flx_absiv - flx_absin => cps%flx_absin - sabg_lyr => pef%sabg_lyr - snl => cps%snl - sfc_frc_aer => pef%sfc_frc_aer - sfc_frc_aer_sno => pef%sfc_frc_aer_sno - albgrd_pur => cps%albgrd_pur - albgri_pur => cps%albgri_pur - sfc_frc_bc => pef%sfc_frc_bc - sfc_frc_bc_sno => pef%sfc_frc_bc_sno - albgrd_bc => cps%albgrd_bc - albgri_bc => cps%albgri_bc - sfc_frc_oc => pef%sfc_frc_oc - sfc_frc_oc_sno => pef%sfc_frc_oc_sno - albgrd_oc => cps%albgrd_oc - albgri_oc => cps%albgri_oc - sfc_frc_dst => pef%sfc_frc_dst - sfc_frc_dst_sno => pef%sfc_frc_dst_sno - albgrd_dst => cps%albgrd_dst - albgri_dst => cps%albgri_dst - albsnd_hst => cps%albsnd_hst - albsni_hst => cps%albsni_hst - fsr_sno_vd => pef%fsr_sno_vd - fsr_sno_nd => pef%fsr_sno_nd - fsr_sno_vi => pef%fsr_sno_vi - fsr_sno_ni => pef%fsr_sno_ni - fsds_sno_vd => pef%fsds_sno_vd - fsds_sno_nd => pef%fsds_sno_nd - fsds_sno_vi => pef%fsds_sno_vi - fsds_sno_ni => pef%fsds_sno_ni - - ! Determine seconds off current time step - - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! Determine fluxes - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - ! was redundant b/c filter already included wt>0; - ! not redundant anymore with chg in filter definition - l = plandunit(p) - !Note: Some glacier_mec pfts may have zero weight - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - sabg(p) = 0._r8 - sabv(p) = 0._r8 - fsa(p) = 0._r8 - l = plandunit(p) - if (ityplun(l)==istsoil .or. ityplun(l)==istcrop) then - fsa_r(p) = 0._r8 - end if - sabg_lyr(p,:) = 0._r8 - sabg_pur(p) = 0._r8 - sabg_bc(p) = 0._r8 - sabg_oc(p) = 0._r8 - sabg_dst(p) = 0._r8 - end if - end do - - ! Loop over pfts to calculate fsun, etc - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - c = pcolumn(p) - g = pgridcell(p) - - vai(p) = elai(p) + esai(p) - if (coszen(c) > 0._r8 .and. elai(p) > 0._r8 .and. gdir(p) > 0._r8) then - cosz = max(0.001_r8, coszen(c)) - ext = gdir(p)/cosz - t1 = min(ext*elai(p), 40.0_r8) - t2 = exp(-t1) - fsun(p) = (1._r8-t2)/t1 - - ! new control on low lai, to avoid numerical problems in - ! calculation of slasun, slasha - ! PET: 2/29/04 - - if (elai(p) > 0.01_r8) then - laisun(p) = elai(p)*fsun(p) - laisha(p) = elai(p)*(1._r8-fsun(p)) - - ! calculate the average specific leaf area for sunlit and shaded - ! canopies, when effective LAI > 0 - slasun(p) = (t2*dsladlai(ivt(p))*ext*elai(p) + & - t2*dsladlai(ivt(p)) + & - t2*slatop(ivt(p))*ext - & - dsladlai(ivt(p)) - & - slatop(ivt(p))*ext) / & - (ext*(t2-1._r8)) - slasha(p) = ((slatop(ivt(p)) + & - (dsladlai(ivt(p)) * elai(p)/2.0_r8)) * elai(p) - & - laisun(p)*slasun(p)) / laisha(p) - else - ! special case for low elai - fsun(p) = 1._r8 - laisun(p) = elai(p) - laisha(p) = 0._r8 - slasun(p) = slatop(ivt(p)) - slasha(p) = 0._r8 - end if - else - fsun(p) = 0._r8 - laisun(p) = 0._r8 - laisha(p) = elai(p) - slasun(p) = 0._r8 - slasha(p) = 0._r8 - end if - end if - end do - - ! Loop over nband wavebands - do ib = 1, nband - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - c = pcolumn(p) - g = pgridcell(p) - - ! Absorbed by canopy - - cad(p,ib) = forc_solad(g,ib)*fabd(p,ib) - cai(p,ib) = forc_solai(g,ib)*fabi(p,ib) - sabv(p) = sabv(p) + cad(p,ib) + cai(p,ib) - fsa(p) = fsa(p) + cad(p,ib) + cai(p,ib) - l = plandunit(p) - if (ityplun(l)==istsoil .or. ityplun(l)==istcrop) then - fsa_r(p) = fsa_r(p) + cad(p,ib) + cai(p,ib) - end if - - ! Transmitted = solar fluxes incident on ground - - trd(p,ib) = forc_solad(g,ib)*ftdd(p,ib) - tri(p,ib) = forc_solad(g,ib)*ftid(p,ib) + forc_solai(g,ib)*ftii(p,ib) - - ! Solar radiation absorbed by ground surface - - absrad = trd(p,ib)*(1._r8-albgrd(c,ib)) + tri(p,ib)*(1._r8-albgri(c,ib)) - sabg(p) = sabg(p) + absrad - fsa(p) = fsa(p) + absrad - if (ityplun(l)==istsoil .or. ityplun(l)==istcrop) then - fsa_r(p) = fsa_r(p) + absrad - end if - - if (use_snicar_frc) then - ! Solar radiation absorbed by ground surface without BC - absrad_bc = trd(p,ib)*(1._r8-albgrd_bc(c,ib)) + tri(p,ib)*(1._r8-albgri_bc(c,ib)) - sabg_bc(p) = sabg_bc(p) + absrad_bc - - ! Solar radiation absorbed by ground surface without OC - absrad_oc = trd(p,ib)*(1._r8-albgrd_oc(c,ib)) + tri(p,ib)*(1._r8-albgri_oc(c,ib)) - sabg_oc(p) = sabg_oc(p) + absrad_oc - - ! Solar radiation absorbed by ground surface without dust - absrad_dst = trd(p,ib)*(1._r8-albgrd_dst(c,ib)) + tri(p,ib)*(1._r8-albgri_dst(c,ib)) - sabg_dst(p) = sabg_dst(p) + absrad_dst - - ! Solar radiation absorbed by ground surface without any aerosols - absrad_pur = trd(p,ib)*(1._r8-albgrd_pur(c,ib)) + tri(p,ib)*(1._r8-albgri_pur(c,ib)) - sabg_pur(p) = sabg_pur(p) + absrad_pur - end if - - - ! New sunlit.shaded canopy algorithm - - if (coszen(c) > 0._r8 .and. elai(p) > 0._r8 .and. gdir(p) > 0._r8 ) then - - ! 1. calculate flux of direct beam radiation absorbed in the - ! sunlit canopy as direct (sun_add), and the flux of direct - ! beam radiation absorbed in the total canopy as indirect - - sun_add(p,ib) = forc_solad(g,ib) * (1._r8-ftdd(p,ib)) * (1._r8-omega(p,ib)) - tot_aid(p,ib) = (forc_solad(g,ib) * fabd(p,ib)) - sun_add(p,ib) - - ! the following constraint set to catch round-off level errors - ! that can cause negative tot_aid - - tot_aid(p,ib) = max(tot_aid(p,ib), 0._r8) - - ! 2. calculate the effective extinction coefficients for indirect - ! transmission originating from direct and indirect streams, - ! using ftid and ftii - - !eff_kid(p,ib) = -(log(ftid(p,ib)))/vai(p) - !eff_kii(p,ib) = -(log(ftii(p,ib)))/vai(p) - - ! 3. calculate the fraction of indirect radiation being absorbed - ! in the sunlit and shaded canopy fraction. Some of this indirect originates in - ! the direct beam and some originates in the indirect beam. - - !sun_faid(p,ib) = 1.-exp(-eff_kid(p,ib) * vaisun(p)) - !sun_faii(p,ib) = 1.-exp(-eff_kii(p,ib) * vaisun(p)) - sun_faid(p,ib) = fsun(p) - sun_faii(p,ib) = fsun(p) - sha_faid(p,ib) = 1._r8-sun_faid(p,ib) - sha_faii(p,ib) = 1._r8-sun_faii(p,ib) - - ! 4. calculate the total indirect flux absorbed by the sunlit - ! and shaded canopy based on these fractions and the fabd and - ! fabi from surface albedo calculations - - sun_aid(p,ib) = tot_aid(p,ib) * sun_faid(p,ib) - sun_aii(p,ib) = forc_solai(g,ib)*fabi(p,ib)*sun_faii(p,ib) - sha_aid(p,ib) = tot_aid(p,ib) * sha_faid(p,ib) - sha_aii(p,ib) = forc_solai(g,ib)*fabi(p,ib)*sha_faii(p,ib) - - ! 5. calculate the total flux absorbed in the sunlit and shaded - ! canopy as the sum of these terms - - sun_atot(p,ib) = sun_add(p,ib) + sun_aid(p,ib) + sun_aii(p,ib) - sha_atot(p,ib) = sha_aid(p,ib) + sha_aii(p,ib) - - ! 6. calculate the total flux absorbed by leaves in the sunlit - ! and shaded canopies - - laifra = elai(p)/vai(p) - sun_alf(p,ib) = sun_atot(p,ib) * laifra - sha_alf(p,ib) = sha_atot(p,ib) * laifra - - ! 7. calculate the fluxes per unit lai in the sunlit and shaded - ! canopies - - if (laisun(p) > 0._r8) then - sun_aperlai(p,ib) = sun_alf(p,ib)/laisun(p) - else - sun_aperlai(p,ib) = 0._r8 - endif - if (laisha(p) > 0._r8) then - sha_aperlai(p,ib) = sha_alf(p,ib)/laisha(p) - else - sha_aperlai(p,ib) = 0._r8 - endif - - else ! coszen = 0 or elai = 0 - - sun_add(p,ib) = 0._r8 - tot_aid(p,ib) = 0._r8 - eff_kid(p,ib) = 0._r8 - eff_kii(p,ib) = 0._r8 - sun_faid(p,ib) = 0._r8 - sun_faii(p,ib) = 0._r8 - sha_faid(p,ib) = 0._r8 - sha_faii(p,ib) = 0._r8 - sun_aid(p,ib) = 0._r8 - sun_aii(p,ib) = 0._r8 - sha_aid(p,ib) = 0._r8 - sha_aii(p,ib) = 0._r8 - sun_atot(p,ib) = 0._r8 - sha_atot(p,ib) = 0._r8 - sun_alf(p,ib) = 0._r8 - sha_alf(p,ib) = 0._r8 - sun_aperlai(p,ib) = 0._r8 - sha_aperlai(p,ib) = 0._r8 - - end if - end if - end do ! end of pft loop - end do ! end nbands loop - - - ! compute absorbed flux in each snow layer and top soil layer, - ! based on flux factors computed in the radiative transfer portion of SNICAR. - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - c = pcolumn(p) - sabg_snl_sum = 0._r8 - - ! CASE1: No snow layers: all energy is absorbed in top soil layer - if (snl(c) == 0) then - sabg_lyr(p,:) = 0._r8 - sabg_lyr(p,1) = sabg(p) - sabg_snl_sum = sabg_lyr(p,1) - - ! CASE 2: Snow layers present: absorbed radiation is scaled according to - ! flux factors computed by SNICAR - else - do i = -nlevsno+1,1,1 - sabg_lyr(p,i) = flx_absdv(c,i)*trd(p,1) + flx_absdn(c,i)*trd(p,2) + & - flx_absiv(c,i)*tri(p,1) + flx_absin(c,i)*tri(p,2) - ! summed radiation in active snow layers: - if (i >= snl(c)+1) then - sabg_snl_sum = sabg_snl_sum + sabg_lyr(p,i) - endif - enddo - - ! Error handling: The situation below can occur when solar radiation is - ! NOT computed every timestep. - ! When the number of snow layers has changed in between computations of the - ! absorbed solar energy in each layer, we must redistribute the absorbed energy - ! to avoid physically unrealistic conditions. The assumptions made below are - ! somewhat arbitrary, but this situation does not arise very frequently. - ! This error handling is implemented to accomodate any value of the - ! radiation frequency. - if (abs(sabg_snl_sum-sabg(p)) > 0.00001_r8) then - if (snl(c) == 0) then - sabg_lyr(p,-4:0) = 0._r8 - sabg_lyr(p,1) = sabg(p) - elseif (snl(c) == -1) then - sabg_lyr(p,-4:-1) = 0._r8 - sabg_lyr(p,0) = sabg(p)*0.6_r8 - sabg_lyr(p,1) = sabg(p)*0.4_r8 - else - sabg_lyr(p,:) = 0._r8 - sabg_lyr(p,snl(c)+1) = sabg(p)*0.75_r8 - sabg_lyr(p,snl(c)+2) = sabg(p)*0.25_r8 - endif - endif - - ! If shallow snow depth, all solar radiation absorbed in top or top two snow layers - ! to prevent unrealistic timestep soil warming - if (snowdp(c) < 0.10_r8) then - if (snl(c) == 0) then - sabg_lyr(p,-4:0) = 0._r8 - sabg_lyr(p,1) = sabg(p) - elseif (snl(c) == -1) then - sabg_lyr(p,-4:-1) = 0._r8 - sabg_lyr(p,0) = sabg(p) - sabg_lyr(p,1) = 0._r8 - else - sabg_lyr(p,:) = 0._r8 - sabg_lyr(p,snl(c)+1) = sabg(p)*0.75_r8 - sabg_lyr(p,snl(c)+2) = sabg(p)*0.25_r8 - endif - endif - - endif - - ! This situation should not happen: - if (abs(sum(sabg_lyr(p,:))-sabg(p)) > 0.00001_r8) then - write(iulog,*) "SNICAR ERROR: Absorbed ground radiation not equal to summed snow layer radiation. pft = ", & - p," Col= ", c, " Diff= ",sum(sabg_lyr(p,:))-sabg(p), " sabg(p)= ", sabg(p), " sabg_sum(p)= ", & - sum(sabg_lyr(p,:)), " snl(c)= ", snl(c) - write(iulog,*) "flx_absdv1= ", trd(p,1)*(1.-albgrd(c,1)), "flx_absdv2= ", sum(flx_absdv(c,:))*trd(p,1) - write(iulog,*) "flx_absiv1= ", tri(p,1)*(1.-albgri(c,1))," flx_absiv2= ", sum(flx_absiv(c,:))*tri(p,1) - write(iulog,*) "flx_absdn1= ", trd(p,2)*(1.-albgrd(c,2))," flx_absdn2= ", sum(flx_absdn(c,:))*trd(p,2) - write(iulog,*) "flx_absin1= ", tri(p,2)*(1.-albgri(c,2))," flx_absin2= ", sum(flx_absin(c,:))*tri(p,2) - - write(iulog,*) "albgrd_nir= ", albgrd(c,2) - write(iulog,*) "coszen= ", coszen(c) - call endrun() - endif - - - if (use_snicar_frc) then - - ! BC aerosol forcing (pft-level): - sfc_frc_bc(p) = sabg(p) - sabg_bc(p) - - ! OC aerosol forcing (pft-level): - if (DO_SNO_OC) then - sfc_frc_oc(p) = sabg(p) - sabg_oc(p) - else - sfc_frc_oc(p) = 0._r8 - endif - - ! dust aerosol forcing (pft-level): - sfc_frc_dst(p) = sabg(p) - sabg_dst(p) - - ! all-aerosol forcing (pft-level): - sfc_frc_aer(p) = sabg(p) - sabg_pur(p) - - ! forcings averaged only over snow: - if (frac_sno(c) > 0._r8) then - sfc_frc_bc_sno(p) = sfc_frc_bc(p)/frac_sno(c) - sfc_frc_oc_sno(p) = sfc_frc_oc(p)/frac_sno(c) - sfc_frc_dst_sno(p) = sfc_frc_dst(p)/frac_sno(c) - sfc_frc_aer_sno(p) = sfc_frc_aer(p)/frac_sno(c) - else - sfc_frc_bc_sno(p) = spval - sfc_frc_oc_sno(p) = spval - sfc_frc_dst_sno(p) = spval - sfc_frc_aer_sno(p) = spval - endif - - end if - endif - enddo - - - do fp = 1,num_nourbanp - p = filter_nourbanp(fp) - l = plandunit(p) - if (pwtgcell(p)>0._r8 .or. ityplun(l)==istice_mec) then - g = pgridcell(p) - - ! Final step of new sunlit/shaded canopy algorithm - ! 8. calculate the total and per-unit-lai fluxes for PAR in the - ! sunlit and shaded canopy leaf fractions - - parsun(p) = sun_aperlai(p,1) - parsha(p) = sha_aperlai(p,1) - - ! The following code is duplicated from SurfaceRadiation - ! NDVI and reflected solar radiation - - rvis = albd(p,1)*forc_solad(g,1) + albi(p,1)*forc_solai(g,1) - rnir = albd(p,2)*forc_solad(g,2) + albi(p,2)*forc_solai(g,2) - fsr(p) = rvis + rnir - - fsds_vis_d(p) = forc_solad(g,1) - fsds_nir_d(p) = forc_solad(g,2) - fsds_vis_i(p) = forc_solai(g,1) - fsds_nir_i(p) = forc_solai(g,2) - fsr_vis_d(p) = albd(p,1)*forc_solad(g,1) - fsr_nir_d(p) = albd(p,2)*forc_solad(g,2) - fsr_vis_i(p) = albi(p,1)*forc_solai(g,1) - fsr_nir_i(p) = albi(p,2)*forc_solai(g,2) - - local_secp1 = secs + nint((londeg(g)/degpsec)/dtime)*dtime - local_secp1 = mod(local_secp1,isecspday) - if (local_secp1 == isecspday/2) then - fsds_vis_d_ln(p) = forc_solad(g,1) - fsds_nir_d_ln(p) = forc_solad(g,2) - fsr_vis_d_ln(p) = albd(p,1)*forc_solad(g,1) - fsr_nir_d_ln(p) = albd(p,2)*forc_solad(g,2) - else - fsds_vis_d_ln(p) = spval - fsds_nir_d_ln(p) = spval - fsr_vis_d_ln(p) = spval - fsr_nir_d_ln(p) = spval - end if - - ! diagnostic variables (downwelling and absorbed radiation partitioning) for history files - ! (OPTIONAL) - c = pcolumn(p) - if (snl(c) < 0) then - fsds_sno_vd(p) = forc_solad(g,1) - fsds_sno_nd(p) = forc_solad(g,2) - fsds_sno_vi(p) = forc_solai(g,1) - fsds_sno_ni(p) = forc_solai(g,2) - - fsr_sno_vd(p) = fsds_vis_d(p)*albsnd_hst(c,1) - fsr_sno_nd(p) = fsds_nir_d(p)*albsnd_hst(c,2) - fsr_sno_vi(p) = fsds_vis_i(p)*albsni_hst(c,1) - fsr_sno_ni(p) = fsds_nir_i(p)*albsni_hst(c,2) - else - fsds_sno_vd(p) = spval - fsds_sno_nd(p) = spval - fsds_sno_vi(p) = spval - fsds_sno_ni(p) = spval - - fsr_sno_vd(p) = spval - fsr_sno_nd(p) = spval - fsr_sno_vi(p) = spval - fsr_sno_ni(p) = spval - endif - - end if - end do - - end subroutine SurfaceRadiation - -end module SurfaceRadiationMod diff --git a/src_clm40/biogeophys/TridiagonalMod.F90 b/src_clm40/biogeophys/TridiagonalMod.F90 deleted file mode 100644 index a5e8d7d1ab..0000000000 --- a/src_clm40/biogeophys/TridiagonalMod.F90 +++ /dev/null @@ -1,106 +0,0 @@ -module TridiagonalMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: TridiagonalMod -! -! !DESCRIPTION: -! Tridiagonal matrix solution -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: Tridiagonal -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: Tridiagonal -! -! !INTERFACE: - subroutine Tridiagonal (lbc, ubc, lbj, ubj, jtop, numf, filter, & - a, b, c, r, u) -! -! !DESCRIPTION: -! Tridiagonal matrix solution -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! lbinning and ubing column indices - integer , intent(in) :: lbj, ubj ! lbinning and ubing level indices - integer , intent(in) :: jtop(lbc:ubc) ! top level for each column - integer , intent(in) :: numf ! filter dimension - integer , intent(in) :: filter(1:numf) ! filter - real(r8), intent(in) :: a(lbc:ubc, lbj:ubj) ! "a" left off diagonal of tridiagonal matrix - real(r8), intent(in) :: b(lbc:ubc, lbj:ubj) ! "b" diagonal column for tridiagonal matrix - real(r8), intent(in) :: c(lbc:ubc, lbj:ubj) ! "c" right off diagonal tridiagonal matrix - real(r8), intent(in) :: r(lbc:ubc, lbj:ubj) ! "r" forcing term of tridiagonal matrix - real(r8), intent(inout) :: u(lbc:ubc, lbj:ubj) ! solution -! -! !CALLED FROM: -! subroutine BiogeophysicsLake in module BiogeophysicsLakeMod -! subroutine SoilTemperature in module SoilTemperatureMod -! subroutine SoilWater in module HydrologyMod -! -! !REVISION HISTORY: -! 15 September 1999: Yongjiu Dai; Initial code -! 15 December 1999: Paul Houser and Jon Radakovich; F90 Revision -! 1 July 2003: Mariana Vertenstein; modified for vectorization -! -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: j,ci,fc !indices - real(r8) :: gam(lbc:ubc,lbj:ubj) !temporary - real(r8) :: bet(lbc:ubc) !temporary -!----------------------------------------------------------------------- - - ! Solve the matrix - - do fc = 1,numf - ci = filter(fc) - bet(ci) = b(ci,jtop(ci)) - end do - - do j = lbj, ubj - do fc = 1,numf - ci = filter(fc) - if (j >= jtop(ci)) then - if (j == jtop(ci)) then - u(ci,j) = r(ci,j) / bet(ci) - else - gam(ci,j) = c(ci,j-1) / bet(ci) - bet(ci) = b(ci,j) - a(ci,j) * gam(ci,j) - u(ci,j) = (r(ci,j) - a(ci,j)*u(ci,j-1)) / bet(ci) - end if - end if - end do - end do - - do j = ubj-1,lbj,-1 - do fc = 1,numf - ci = filter(fc) - if (j >= jtop(ci)) then - u(ci,j) = u(ci,j) - gam(ci,j+1) * u(ci,j+1) - end if - end do - end do - - end subroutine Tridiagonal - -end module TridiagonalMod diff --git a/src_clm40/biogeophys/UrbanInitMod.F90 b/src_clm40/biogeophys/UrbanInitMod.F90 deleted file mode 100644 index ad48b350ce..0000000000 --- a/src_clm40/biogeophys/UrbanInitMod.F90 +++ /dev/null @@ -1,477 +0,0 @@ -module UrbanInitMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: UrbanInitMod -! -! !DESCRIPTION: -! Initialize urban data -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use shr_sys_mod , only : shr_sys_flush - use clm_varctl , only : iulog, use_vancouver, use_mexicocity - use UrbanMod, only : urban_traffic, urban_hac, urban_hac_off -! -! !PUBLIC TYPES: - implicit none - save - - private -! -! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanInitTimeVar ! Initialize urban time varying variables - public :: UrbanInitTimeConst ! Initialize urban time constant variables - public :: UrbanInitAero ! Calculate urban landunit aerodynamic constants -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanInitAero -! -! !INTERFACE: - subroutine UrbanInitAero( ) -! -! !DESCRIPTION: -! Calculate urban land unit aerodynamic constants using Macdonald (1998) as used in -! Grimmond and Oke (1999) -! -! !USES: - use clmtype - use clm_varcon, only : isturb, vkc - use decompMod , only : get_proc_bounds -! -! !ARGUMENTS: - implicit none -! -! local pointers to original implicit in arguments (urban clump) -! - real(r8), pointer :: ht_roof(:) ! height of urban roof (m) - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width (-) - integer , pointer :: ltype(:) ! landunit type -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: z_0_town(:) ! urban landunit momentum roughness length (m) - real(r8), pointer :: z_d_town(:) ! urban landunit displacement height (m) -! -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! Created by Keith Oleson January 2005 -! -! -! !LOCAL VARIABLES: -!EOP - real(r8), parameter :: alpha = 4.43_r8 ! coefficient used to calculate z_d_town - real(r8), parameter :: beta = 1.0_r8 ! coefficient used to calculate z_d_town - real(r8), parameter :: C_d = 1.2_r8 ! drag coefficient as used in Grimmond and Oke (1999) - real(r8) :: plan_ai ! plan area index - ratio building area to plan area (-) - real(r8) :: frontal_ai ! frontal area index of buildings (-) - real(r8) :: build_lw_ratio ! building short/long side ratio (-) - integer :: l,g ! indices - integer :: begp, endp ! clump beginning and ending pft indices - integer :: begc, endc ! clump beginning and ending column indices - integer :: begl, endl ! clump beginning and ending landunit indices - integer :: begg, endg ! clump beginning and ending gridcell indices -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (landunit level) - - ltype => lun%itype - z_0_town => lun%z_0_town - z_d_town => lun%z_d_town - ht_roof => lun%ht_roof - canyon_hwr => lun%canyon_hwr - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - do l = begl, endl - if (ltype(l) == isturb) then - - ! Calculate plan area index - plan_ai = canyon_hwr(l)/(canyon_hwr(l) + 1._r8) - - ! Building shape shortside/longside ratio (e.g. 1 = square ) - ! This assumes the building occupies the entire canyon length - build_lw_ratio = plan_ai - - ! Calculate frontal area index - frontal_ai = (1._r8 - plan_ai) * canyon_hwr(l) - - ! Adjust frontal area index for different building configuration - frontal_ai = frontal_ai * sqrt(1/build_lw_ratio) * sqrt(plan_ai) - - ! Calculate displacement height - - if (use_vancouver) then - z_d_town(l) = 3.5_r8 - else if (use_mexicocity) then - z_d_town(l) = 10.9_r8 - else - z_d_town(l) = (1._r8 + alpha**(-plan_ai) * (plan_ai - 1._r8)) * ht_roof(l) - end if - - ! Calculate the roughness length - - if (use_vancouver) then - z_0_town(l) = 0.35_r8 - else if (use_mexicocity) then - z_0_town(l) = 2.2_r8 - else - z_0_town(l) = ht_roof(l) * (1._r8 - z_d_town(l) / ht_roof(l)) * & - exp(-1.0_r8 * (0.5_r8 * beta * C_d / vkc**2 * & - (1 - z_d_town(l) / ht_roof(l)) * frontal_ai)**(-0.5_r8)) - end if - end if - end do - - end subroutine UrbanInitAero - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanInitTimeConst -! -! !INTERFACE: - subroutine UrbanInitTimeConst() -! -! !DESCRIPTION: -! Initialize urban time-constant variables -! -! !USES: - use clmtype - use clm_varcon , only : isturb, icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv, spval - use decompMod , only : get_proc_bounds, ldecomp - use UrbanInputMod, only : urbinp -! -! !ARGUMENTS: - implicit none -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: gdc(:) ! grid index for landunit - integer , pointer :: coli(:) ! beginning column index for landunit - integer , pointer :: colf(:) ! ending column index for landunit - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type index - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio - real(r8), pointer :: emg(:) ! ground emissivity - real(r8), pointer :: wtroad_perv(:) ! weight of pervious column to total road - real(r8), pointer :: ht_roof(:) ! height of urban roof (m) - real(r8), pointer :: wtlunit_roof(:) ! weight of roof with respect to landunit - real(r8), pointer :: wind_hgt_canyon(:) ! height above road at which wind in canyon is to be computed (m) - real(r8), pointer :: eflx_traffic_factor(:) ! multiplicative factor for sensible heat flux from urban traffic - real(r8), pointer :: t_building_max(:) ! maximum internal building temperature (K) - real(r8), pointer :: t_building_min(:) ! minimum internal building temperature (K) - real(r8), pointer :: tk_wall(:,:) ! thermal conductivity of urban wall (W/m/K) - real(r8), pointer :: tk_roof(:,:) ! thermal conductivity of urban roof (W/m/K) - real(r8), pointer :: tk_improad(:,:) ! thermal conductivity of urban impervious road (W/m/K) - real(r8), pointer :: cv_wall(:,:) ! thermal conductivity of urban wall (J/m^3/K) - real(r8), pointer :: cv_roof(:,:) ! thermal conductivity of urban roof (J/m^3/K) - real(r8), pointer :: cv_improad(:,:) ! thermal conductivity of urban impervious road (J/m^3/K) - real(r8), pointer :: thick_wall(:) ! thickness of urban wall (m) - real(r8), pointer :: thick_roof(:) ! thickness of urban roof (m) - integer, pointer :: nlev_improad(:) ! number of impervious road layers (-) -! -! -! !OTHER LOCAL VARIABLES -!EOP - integer :: nc,fl,ib,l,c,p,g ! indices - integer :: ier ! error status - integer :: begp, endp ! clump beginning and ending pft indices - integer :: begc, endc ! clump beginning and ending column indices - integer :: begl, endl ! clump beginning and ending landunit indices - integer :: begg, endg ! clump beginning and ending gridcell indices - - ! Assign local pointers to derived type members (landunit-level) - - ltype => lun%itype - lgridcell => lun%gridcell - coli => lun%coli - colf => lun%colf - canyon_hwr => lun%canyon_hwr - wtroad_perv => lun%wtroad_perv - ht_roof => lun%ht_roof - wtlunit_roof => lun%wtlunit_roof - wind_hgt_canyon => lun%wind_hgt_canyon - eflx_traffic_factor => lef%eflx_traffic_factor - t_building_max => lps%t_building_max - t_building_min => lps%t_building_min - canyon_hwr => lun%canyon_hwr - tk_wall => lps%tk_wall - tk_roof => lps%tk_roof - tk_improad => lps%tk_improad - cv_wall => lps%cv_wall - cv_roof => lps%cv_roof - cv_improad => lps%cv_improad - thick_wall => lps%thick_wall - thick_roof => lps%thick_roof - nlev_improad => lps%nlev_improad - - ! Assign local pointers to derived type members (column-level) - - ctype => col%itype - emg => cps%emg - - ! Initialize time constant urban variables - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - do l = begl, endl - if (ltype(l) == isturb) then - g = lun%gridcell(l) - canyon_hwr(l) = urbinp%canyon_hwr(g) - wtroad_perv(l) = urbinp%wtroad_perv(g) - ht_roof(l) = urbinp%ht_roof(g) - wtlunit_roof(l) = urbinp%wtlunit_roof(g) - wind_hgt_canyon(l) = urbinp%wind_hgt_canyon(g) - tk_wall(l,:) = urbinp%tk_wall(g,:) - tk_roof(l,:) = urbinp%tk_roof(g,:) - tk_improad(l,:) = urbinp%tk_improad(g,:) - cv_wall(l,:) = urbinp%cv_wall(g,:) - cv_roof(l,:) = urbinp%cv_roof(g,:) - cv_improad(l,:) = urbinp%cv_improad(g,:) - thick_wall(l) = urbinp%thick_wall(g) - thick_roof(l) = urbinp%thick_roof(g) - nlev_improad(l) = urbinp%nlev_improad(g) - t_building_min(l) = urbinp%t_building_min(g) - t_building_max(l) = urbinp%t_building_max(g) - - do c = coli(l),colf(l) - if (ctype(c) == icol_roof ) emg(c) = urbinp%em_roof(g) - if (ctype(c) == icol_sunwall ) emg(c) = urbinp%em_wall(g) - if (ctype(c) == icol_shadewall ) emg(c) = urbinp%em_wall(g) - if (ctype(c) == icol_road_imperv) emg(c) = urbinp%em_improad(g) - if (ctype(c) == icol_road_perv ) emg(c) = urbinp%em_perroad(g) - end do - - ! Inferred from Sailor and Lu 2004 - if (urban_traffic) then - eflx_traffic_factor(l) = 3.6_r8 * (canyon_hwr(l)-0.5_r8) + 1.0_r8 - else - eflx_traffic_factor(l) = 0.0_r8 - end if - - if (use_vancouver .or. use_mexicocity) then - ! Freely evolving - t_building_max(l) = 380.00_r8 - t_building_min(l) = 200.00_r8 - else - if (urban_hac == urban_hac_off) then - ! Overwrite values read in from urbinp by freely evolving values - t_building_max(l) = 380.00_r8 - t_building_min(l) = 200.00_r8 - end if - end if - else - eflx_traffic_factor(l) = 0.0_r8 - t_building_max(l) = 0.0_r8 - t_building_min(l) = 0.0_r8 - end if - end do - - end subroutine UrbanInitTimeConst - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanInitTimeVar -! -! !INTERFACE: - subroutine UrbanInitTimeVar( ) -! -! !DESCRIPTION: -! Initialize urban time-varying variables -! -! !USES: - use clmtype - use clm_varcon, only : isturb, spval, icol_road_perv - use decompMod , only : get_proc_bounds -! -! !ARGUMENTS: - implicit none -! -! local pointers to original implicit in arguments (urban clump) -! - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: clandunit(:) ! landunit index of corresponding column - integer , pointer :: plandunit(:) ! landunit index of corresponding pft - integer , pointer :: ctype(:) ! column type -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: taf(:) ! urban canopy air temperature (K) - real(r8), pointer :: qaf(:) ! urban canopy air specific humidity (kg/kg) - real(r8), pointer :: eflx_building_heat(:) ! heat flux from urban building interior to walls, roof (W/m**2) - real(r8), pointer :: eflx_urban_ac(:) ! urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat(:) ! urban heating flux (W/m**2) - real(r8), pointer :: fcov(:) ! fractional impermeable area - real(r8), pointer :: fsat(:) ! fractional area with water table at surface - real(r8), pointer :: qcharge(:) ! aquifer recharge rate (mm/s) - real(r8), pointer :: t_building(:) ! internal building temperature (K) - real(r8), pointer :: eflx_traffic(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat(:) ! sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_wasteheat_pft(:) ! sensible heat flux from urban heating/cooling sources of waste heat at pft level (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_pft(:) ! sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_traffic_pft(:) ! sensible heat flux from traffic (W/m**2) - real(r8), pointer :: eflx_anthro(:) ! total anthropogenic heat flux (W/m**2) - real(r8), pointer :: t_ref2m_u(:) ! Urban 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_min_u(:) ! Urban daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_u(:) ! Urban daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: rh_ref2m_u(:) ! Urban 2 m height surface relative humidity (%) - real(r8), pointer :: t_grnd_u(:) ! Urban ground temperature (Kelvin) - real(r8), pointer :: qflx_runoff_u(:) ! Urban total runoff (qflx_drain+qflx_surf) (mm H2O /s) - real(r8), pointer :: fsa_u(:) ! Urban absorbed solar radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_net_u(:) ! Urban net longwave radiation (W/m**2) - real(r8), pointer :: eflx_lh_tot_u(:) ! Urban latent heat flux (W/m**2) - real(r8), pointer :: eflx_sh_tot_u(:) ! Urban sensible heat flux (W/m**2) - real(r8), pointer :: eflx_soil_grnd_u(:) ! Urban ground heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_u(:) ! Urban snow melt heat flux (W/m**2) -! -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! Created by Keith Oleson February 2005 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: l,g,c,p ! indices - integer :: begp, endp ! clump beginning and ending pft indices - integer :: begc, endc ! clump beginning and ending column indices - integer :: begl, endl ! clump beginning and ending landunit indices - integer :: begg, endg ! clump beginning and ending gridcell indices -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (landunit level) - - taf => lps%taf - qaf => lps%qaf - ltype => lun%itype - lgridcell => lun%gridcell - t_building => lps%t_building - eflx_traffic => lef%eflx_traffic - eflx_wasteheat => lef%eflx_wasteheat - - ! Assign local pointers to derived type members (column level) - - clandunit => col%landunit - eflx_building_heat => cef%eflx_building_heat - eflx_urban_ac => cef%eflx_urban_ac - eflx_urban_heat => cef%eflx_urban_heat - fcov => cws%fcov - fsat => cws%fsat - qcharge => cws%qcharge - ctype => col%itype - t_grnd_u => ces%t_grnd_u - qflx_runoff_u => cwf%qflx_runoff_u - eflx_snomelt_u => cef%eflx_snomelt_u - - ! Assign local pointers to derived type members (pft level) - - t_ref2m_u => pes%t_ref2m_u - t_ref2m_min_u => pes%t_ref2m_min_u - t_ref2m_max_u => pes%t_ref2m_max_u - rh_ref2m_u => pes%rh_ref2m_u - plandunit => pft%landunit - eflx_wasteheat_pft => pef%eflx_wasteheat_pft - eflx_heat_from_ac_pft => pef%eflx_heat_from_ac_pft - eflx_traffic_pft => pef%eflx_traffic_pft - eflx_anthro => pef%eflx_anthro - fsa_u => pef%fsa_u - eflx_lwrad_net_u => pef%eflx_lwrad_net_u - eflx_lh_tot_u => pef%eflx_lh_tot_u - eflx_sh_tot_u => pef%eflx_sh_tot_u - eflx_soil_grnd_u => pef%eflx_soil_grnd_u - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - do l = begl, endl - g = lgridcell(l) - if (ltype(l) == isturb) then - if (use_vancouver) then - taf(l) = 297.56_r8 - qaf(l) = 0.0111_r8 - else if (use_mexicocity) then - taf(l) = 289.46_r8 - qaf(l) = 0.00248_r8 - else - taf(l) = 283._r8 - ! Arbitrary set since forc_q is not yet available - qaf(l) = 1.e-4_r8 - end if - else - t_building(l) = 0.0_r8 - eflx_traffic(l) = 0.0_r8 - eflx_wasteheat(l) = 0.0_r8 - end if - end do - - do c = begc, endc - l = clandunit(c) - if (ltype(l) == isturb) then - eflx_building_heat(c) = 0._r8 - eflx_urban_ac(c) = 0._r8 - eflx_urban_heat(c) = 0._r8 - ! - ! Set hydrology variables for urban to spvalue -- as only valid for pervious road - ! - if (ctype(c) /= icol_road_perv )then - fcov(c) = spval - fsat(c) = spval - qcharge(c) = spval - end if - else - eflx_building_heat(c) = 0._r8 - eflx_urban_ac(c) = 0._r8 - eflx_urban_heat(c) = 0.0_r8 - t_grnd_u(c) = 0.0_r8 - qflx_runoff_u(c) = 0.0_r8 - eflx_snomelt_u(c) = 0.0_r8 - end if - end do - - do p = begp, endp - l = plandunit(p) - if (ltype(l) /= isturb) then - t_ref2m_u(p) = 0.0_r8 - t_ref2m_min_u(p) = 0.0_r8 - t_ref2m_max_u(p) = 0.0_r8 - rh_ref2m_u(p) = 0.0_r8 - eflx_wasteheat_pft(p) = 0.0_r8 - eflx_heat_from_ac_pft(p) = 0.0_r8 - eflx_traffic_pft(p) = 0.0_r8 - eflx_anthro(p) = 0.0_r8 - fsa_u(p) = 0.0_r8 - eflx_lwrad_net_u(p) = 0.0_r8 - eflx_lh_tot_u(p) = 0.0_r8 - eflx_sh_tot_u(p) = 0.0_r8 - eflx_soil_grnd_u(p) = 0.0_r8 - else - eflx_wasteheat_pft(p) = 0.0_r8 - eflx_heat_from_ac_pft(p) = 0.0_r8 - eflx_traffic_pft(p) = 0.0_r8 - end if - end do - - end subroutine UrbanInitTimeVar - -end module UrbanInitMod diff --git a/src_clm40/biogeophys/UrbanInputMod.F90 b/src_clm40/biogeophys/UrbanInputMod.F90 deleted file mode 100644 index dd73156fca..0000000000 --- a/src_clm40/biogeophys/UrbanInputMod.F90 +++ /dev/null @@ -1,355 +0,0 @@ -module UrbanInputMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: UrbanInputMod -! -! !DESCRIPTION: -! Read in input urban data - fill in data structure urbinp -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use shr_sys_mod , only : shr_sys_flush -! -! !PUBLIC TYPES: - implicit none - save - - private -! -! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanInput ! Read in urban input data - - type urbinp_t - real(r8), pointer :: canyon_hwr(:) - real(r8), pointer :: wtlunit_roof(:) - real(r8), pointer :: wtroad_perv(:) - real(r8), pointer :: em_roof(:) - real(r8), pointer :: em_improad(:) - real(r8), pointer :: em_perroad(:) - real(r8), pointer :: em_wall(:) - real(r8), pointer :: alb_roof_dir(:,:) - real(r8), pointer :: alb_roof_dif(:,:) - real(r8), pointer :: alb_improad_dir(:,:) - real(r8), pointer :: alb_improad_dif(:,:) - real(r8), pointer :: alb_perroad_dir(:,:) - real(r8), pointer :: alb_perroad_dif(:,:) - real(r8), pointer :: alb_wall_dir(:,:) - real(r8), pointer :: alb_wall_dif(:,:) - real(r8), pointer :: ht_roof(:) - real(r8), pointer :: wind_hgt_canyon(:) - real(r8), pointer :: tk_wall(:,:) - real(r8), pointer :: tk_roof(:,:) - real(r8), pointer :: tk_improad(:,:) - real(r8), pointer :: cv_wall(:,:) - real(r8), pointer :: cv_roof(:,:) - real(r8), pointer :: cv_improad(:,:) - real(r8), pointer :: thick_wall(:) - real(r8), pointer :: thick_roof(:) - integer, pointer :: nlev_improad(:) - real(r8), pointer :: t_building_min(:) - real(r8), pointer :: t_building_max(:) - end type urbinp_t - public urbinp_t - - type (urbinp_t) , public :: urbinp ! urban input derived type -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanInput -! -! !INTERFACE: - subroutine UrbanInput(mode) -! -! !DESCRIPTION: -! Allocate memory and read in urban input data -! -! !USES: - use clm_varpar, only : numrad, nlevurb, numsolar - use clm_varctl, only : iulog, fsurdat, single_column - use fileutils , only : getavu, relavu, getfil, opnfil - use spmdMod , only : masterproc - use clmtype - use decompMod , only : get_proc_bounds - use domainMod , only : ldomain - use ncdio_pio , only : file_desc_t, ncd_pio_openfile, ncd_io, ncd_inqfdims, ncd_pio_closefile, ncd_inqdid, ncd_inqdlen -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: mode -! -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein July 2004 -! Revised by Keith Oleson for netcdf input Jan 2008 -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: dimid,varid ! netCDF id's - integer :: begg,endg ! start/stop gridcells - integer :: nw,n,k,i,j,ni,nj,ns ! indices - integer :: nlevurb_i ! input grid: number of urban vertical levels - integer :: numsolar_i ! input grid: number of solar type (DIR/DIF) - integer :: numrad_i ! input grid: number of solar bands (VIS/NIR) - integer :: ier,ret ! error status - logical :: isgrid2d ! true => file is 2d - logical :: readvar ! true => variable is on dataset - real(r8), pointer :: arrayl3d(:,:,:) ! generic global array - character(len=32) :: subname = 'UrbanInput' ! subroutine name -!----------------------------------------------------------------------- - - call get_proc_bounds(begg,endg) - - if (mode == 'initialize') then - - ! Allocate dynamic memory - allocate(urbinp%canyon_hwr(begg:endg), & - urbinp%wtlunit_roof(begg:endg), & - urbinp%wtroad_perv(begg:endg), & - urbinp%em_roof(begg:endg), & - urbinp%em_improad(begg:endg), & - urbinp%em_perroad(begg:endg), & - urbinp%em_wall(begg:endg), & - urbinp%alb_roof_dir(begg:endg,numrad), & - urbinp%alb_roof_dif(begg:endg,numrad), & - urbinp%alb_improad_dir(begg:endg,numrad), & - urbinp%alb_perroad_dir(begg:endg,numrad), & - urbinp%alb_improad_dif(begg:endg,numrad), & - urbinp%alb_perroad_dif(begg:endg,numrad), & - urbinp%alb_wall_dir(begg:endg,numrad), & - urbinp%alb_wall_dif(begg:endg,numrad), & - urbinp%ht_roof(begg:endg), & - urbinp%wind_hgt_canyon(begg:endg), & - urbinp%tk_wall(begg:endg,nlevurb), & - urbinp%tk_roof(begg:endg,nlevurb), & - urbinp%tk_improad(begg:endg,nlevurb), & - urbinp%cv_wall(begg:endg,nlevurb), & - urbinp%cv_roof(begg:endg,nlevurb), & - urbinp%cv_improad(begg:endg,nlevurb), & - urbinp%thick_wall(begg:endg), & - urbinp%thick_roof(begg:endg), & - urbinp%nlev_improad(begg:endg), & - urbinp%t_building_min(begg:endg), & - urbinp%t_building_max(begg:endg), & - stat=ier) - if (ier /= 0) then - write(iulog,*)'initUrbanInput: allocation error '; call endrun() - endif - - ! Read urban data - - if (masterproc) then - write(iulog,*)' Reading in urban input data from fsurdat file ...' - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - if (masterproc) then - write(iulog,*) subname,trim(fsurdat) - end if - - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun() - end if - - call ncd_inqdid(ncid, 'nlevurb', dimid) - call ncd_inqdlen(ncid, dimid, nlevurb_i) - if (nlevurb_i /= nlevurb) then - write(iulog,*)trim(subname)// ': parameter nlevurb= ',nlevurb, & - 'does not equal input dataset nlevurb= ',nlevurb_i - call endrun - endif - - call ncd_inqdid(ncid, 'numsolar', dimid) - call ncd_inqdlen(ncid, dimid, numsolar_i) - if (numsolar_i /= numsolar) then - write(iulog,*)trim(subname)// ': parameter numsolar= ',numsolar, & - 'does not equal input dataset numsolar= ',numsolar_i - call endrun - endif - - call ncd_inqdid(ncid, 'numrad', dimid) - call ncd_inqdlen(ncid, dimid, numrad_i) - if (numrad_i /= numrad) then - write(iulog,*)trim(subname)// ': parameter numrad= ',numrad, & - 'does not equal input dataset numrad= ',numrad_i - call endrun - endif - - call ncd_io(ncid=ncid, varname='CANYON_HWR', flag='read', data=urbinp%canyon_hwr,& - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: CANYON_HWR NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='WTLUNIT_ROOF', flag='read', data=urbinp%wtlunit_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: WTLUNIT_ROOF NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='WTROAD_PERV', flag='read', data=urbinp%wtroad_perv, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: WTROAD_PERV NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='EM_ROOF', flag='read', data=urbinp%em_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: EM_ROOF NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='EM_IMPROAD', flag='read', data=urbinp%em_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: EM_IMPROAD NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='EM_PERROAD', flag='read', data=urbinp%em_perroad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: EM_PERROAD NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='EM_WALL', flag='read', data=urbinp%em_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: EM_WALL NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='HT_ROOF', flag='read', data=urbinp%ht_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: HT_ROOF NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='WIND_HGT_CANYON', flag='read', data=urbinp%wind_hgt_canyon, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: WIND_HGT_CANYON NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='THICK_WALL', flag='read', data=urbinp%thick_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: THICK_WALL NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='THICK_ROOF', flag='read', data=urbinp%thick_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: THICK_ROOF NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='NLEV_IMPROAD', flag='read', data=urbinp%nlev_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: NLEV_IMPROAD NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='T_BUILDING_MIN', flag='read', data=urbinp%t_building_min, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: T_BUILDING_MIN NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='T_BUILDING_MAX', flag='read', data=urbinp%t_building_max, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: T_BUILDING_MAX NOT on fsurdat file' ) - - allocate(arrayl3d(begg:endg,numrad,numsolar)) - - call ncd_io(ncid=ncid, varname='ALB_IMPROAD', flag='read', data=arrayl3d, & - dim1name=grlnd, readvar=readvar) - if (.not.readvar) call endrun( trim(subname)//' ERROR: ALB_IMPROAD NOT on fsurdat file' ) - urbinp%alb_improad_dir(begg:endg,:) = arrayl3d(begg:endg,:,1) - urbinp%alb_improad_dif(begg:endg,:) = arrayl3d(begg:endg,:,2) - - call ncd_io(ncid=ncid, varname='ALB_PERROAD', flag='read',data=arrayl3d, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: ALB_PERROAD NOT on fsurdat file' ) - urbinp%alb_perroad_dir(begg:endg,:) = arrayl3d(begg:endg,:,1) - urbinp%alb_perroad_dif(begg:endg,:) = arrayl3d(begg:endg,:,2) - - call ncd_io(ncid=ncid, varname='ALB_ROOF', flag='read', data=arrayl3d, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: ALB_ROOF NOT on fsurdat file' ) - urbinp%alb_roof_dir(begg:endg,:) = arrayl3d(begg:endg,:,1) - urbinp%alb_roof_dif(begg:endg,:) = arrayl3d(begg:endg,:,2 ) - - call ncd_io(ncid=ncid, varname='ALB_WALL', flag='read', data=arrayl3d, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: ALB_WALL NOT on fsurdat file' ) - urbinp%alb_wall_dir(begg:endg,:) = arrayl3d(begg:endg,:,1) - urbinp%alb_wall_dif(begg:endg,:) = arrayl3d(begg:endg,:,2) - - deallocate (arrayl3d) - - call ncd_io(ncid=ncid, varname='TK_IMPROAD', flag='read', data=urbinp%tk_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: TK_IMPROAD NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='TK_ROOF', flag='read', data=urbinp%tk_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: TK_ROOF NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='TK_WALL', flag='read', data=urbinp%tk_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: TK_WALL NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='CV_IMPROAD', flag='read', data=urbinp%cv_improad, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: CV_IMPROAD NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='CV_ROOF', flag='read', data=urbinp%cv_roof, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: CV_ROOF NOT on fsurdat file' ) - - call ncd_io(ncid=ncid, varname='CV_WALL', flag='read', data=urbinp%cv_wall, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: CV_WALL NOT on fsurdat file' ) - - call ncd_pio_closefile(ncid) - if (masterproc) then - write(iulog,*)' Sucessfully read urban input data' - write(iulog,*) - end if - - else if (mode == 'finalize') then - - deallocate(urbinp%canyon_hwr, & - urbinp%wtlunit_roof, & - urbinp%wtroad_perv, & - urbinp%em_roof, & - urbinp%em_improad, & - urbinp%em_perroad, & - urbinp%em_wall, & - urbinp%alb_roof_dir, & - urbinp%alb_roof_dif, & - urbinp%alb_improad_dir, & - urbinp%alb_perroad_dir, & - urbinp%alb_improad_dif, & - urbinp%alb_perroad_dif, & - urbinp%alb_wall_dir, & - urbinp%alb_wall_dif, & - urbinp%ht_roof, & - urbinp%wind_hgt_canyon, & - urbinp%tk_wall, & - urbinp%tk_roof, & - urbinp%tk_improad, & - urbinp%cv_wall, & - urbinp%cv_roof, & - urbinp%cv_improad, & - urbinp%thick_wall, & - urbinp%thick_roof, & - urbinp%nlev_improad, & - urbinp%t_building_min, & - urbinp%t_building_max, & - stat=ier) - if (ier /= 0) then - write(iulog,*)'initUrbanInput: deallocation error '; call endrun() - endif - - else - write(iulog,*)'initUrbanInput error: mode ',trim(mode),' not supported ' - call endrun() - end if - - end subroutine UrbanInput - -end module UrbanInputMod - diff --git a/src_clm40/biogeophys/UrbanMod.F90 b/src_clm40/biogeophys/UrbanMod.F90 deleted file mode 100644 index 01896678f5..0000000000 --- a/src_clm40/biogeophys/UrbanMod.F90 +++ /dev/null @@ -1,3464 +0,0 @@ -module UrbanMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: UrbanMod -! -! !DESCRIPTION: -! Calculate solar and longwave radiation, and turbulent fluxes for urban landunit -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_varpar , only : numrad - use clm_varcon , only : isecspday, degpsec - use clm_varctl , only : iulog - use abortutils , only : endrun - use shr_sys_mod , only : shr_sys_flush -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: UrbanClumpInit ! Initialization of urban clump data structure - public :: UrbanRadiation ! Urban radiative fluxes - public :: UrbanAlbedo ! Urban albedos - public :: UrbanSnowAlbedo ! Urban snow albedos - public :: UrbanFluxes ! Urban turbulent fluxes - -! !Urban control variables - character(len= *), parameter, public :: urban_hac_off = 'OFF' ! - character(len= *), parameter, public :: urban_hac_on = 'ON' ! - character(len= *), parameter, public :: urban_wasteheat_on = 'ON_WASTEHEAT' ! - character(len= 16), public :: urban_hac = urban_hac_off - logical, public :: urban_traffic = .false. ! urban traffic fluxes -! -! !REVISION HISTORY: -! Created by Gordon Bonan and Mariana Vertenstein and Keith Oleson 04/2003 -! -!EOP -! -! PRIVATE MEMBER FUNCTIONS - private :: view_factor ! View factors for road and one wall - private :: incident_direct ! Direct beam solar rad incident on walls and road in urban canyon - private :: incident_diffuse ! Diffuse solar rad incident on walls and road in urban canyon - private :: net_solar ! Solar radiation absorbed by road and both walls in urban canyon - private :: net_longwave ! Net longwave radiation for road and both walls in urban canyon - -! PRIVATE TYPES - private - type urban_clump_t - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width - real(r8), pointer :: wtroad_perv(:) ! weight of pervious road wrt total road - real(r8), pointer :: ht_roof(:) ! height of urban roof (m) - real(r8), pointer :: wtlunit_roof(:) ! weight of roof with respect to landunit - real(r8), pointer :: wind_hgt_canyon(:) ! height above road at which wind in canyon is to be computed (m) - real(r8), pointer :: em_roof(:) ! roof emissivity - real(r8), pointer :: em_improad(:) ! impervious road emissivity - real(r8), pointer :: em_perroad(:) ! pervious road emissivity - real(r8), pointer :: em_wall(:) ! wall emissivity - real(r8), pointer :: alb_roof_dir(:,:) ! direct roof albedo - real(r8), pointer :: alb_roof_dif(:,:) ! diffuse roof albedo - real(r8), pointer :: alb_improad_dir(:,:) ! direct impervious road albedo - real(r8), pointer :: alb_improad_dif(:,:) ! diffuse impervious road albedo - real(r8), pointer :: alb_perroad_dir(:,:) ! direct pervious road albedo - real(r8), pointer :: alb_perroad_dif(:,:) ! diffuse pervious road albedo - real(r8), pointer :: alb_wall_dir(:,:) ! direct wall albedo - real(r8), pointer :: alb_wall_dif(:,:) ! diffuse wall albedo - end type urban_clump_t - - type (urban_clump_t), private, pointer :: urban_clump(:) ! array of urban clumps for this processor - - integer, private, parameter :: noonsec = isecspday / 2 ! seconds at local noon -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanAlbedo -! -! !INTERFACE: - subroutine UrbanAlbedo (nc, lbl, ubl, lbc, ubc, lbp, ubp, & - num_urbanl, filter_urbanl, & - num_urbanc, filter_urbanc, & - num_urbanp, filter_urbanp) -! -! !DESCRIPTION: -! Determine urban landunit component albedos -! -! !USES: - use clmtype - use shr_orb_mod , only : shr_orb_decl, shr_orb_cosz - use clm_varcon , only : icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv, & - sb -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: nc ! clump index - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(ubc-lbc+1) ! urban column filter - integer , intent(in) :: num_urbanp ! number of urban pfts in clump - integer , intent(in) :: filter_urbanp(ubp-lbp+1) ! urban pft filter -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 03/2003, Mariana Vertenstein: Migrated to clm2.2 -! 01/2008, Erik Kluzek: Migrated to clm3.5.15 -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: clandunit(:) ! column's landunit - integer , pointer :: cgridcell(:) ! gridcell of corresponding column - integer , pointer :: coli(:) ! beginning column index for landunit - integer , pointer :: colf(:) ! ending column index for landunit - integer , pointer :: ctype(:) ! column type - integer , pointer :: pcolumn(:) ! column of corresponding pft - real(r8), pointer :: czen(:) ! cosine of solar zenith angle for each column - real(r8), pointer :: lat(:) ! latitude (radians) - real(r8), pointer :: lon(:) ! longitude (radians) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: albgrd(:,:) ! ground albedo (direct) - real(r8), pointer :: albgri(:,:) ! ground albedo (diffuse) - real(r8), pointer :: albd(:,:) ! surface albedo (direct) - real(r8), pointer :: albi(:,:) ! surface albedo (diffuse) - real(r8), pointer :: fabd(:,:) ! flux absorbed by veg per unit direct flux - real(r8), pointer :: fabi(:,:) ! flux absorbed by veg per unit diffuse flux - real(r8), pointer :: ftdd(:,:) ! down direct flux below veg per unit dir flx - real(r8), pointer :: ftid(:,:) ! down diffuse flux below veg per unit dir flx - real(r8), pointer :: ftii(:,:) ! down diffuse flux below veg per unit dif flx - real(r8), pointer :: fsun(:) ! sunlit fraction of canopy - real(r8), pointer :: gdir(:) ! leaf projection in solar direction (0 to 1) - real(r8), pointer :: omega(:,:) ! fraction of intercepted radiation that is scattered (0 to 1) - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_wr(:) ! view factor of one wall for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall - real(r8), pointer :: vf_rw(:) ! view factor of road for one wall - real(r8), pointer :: vf_ww(:) ! view factor of opposing wall for one wall - real(r8), pointer :: sabs_roof_dir(:,:) ! direct solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_roof_dif(:,:) ! diffuse solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_sunwall_dir(:,:) ! direct solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_sunwall_dif(:,:) ! diffuse solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dir(:,:) ! direct solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dif(:,:) ! diffuse solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_improad_dir(:,:) ! direct solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_improad_dif(:,:) ! diffuse solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dir(:,:) ! direct solar absorbed by pervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dif(:,:) ! diffuse solar absorbed by pervious road per unit ground area per unit incident flux -! -! -! !OTHER LOCAL VARIABLES -!EOP -! - real(r8) :: coszen(num_urbanl) ! cosine solar zenith angle - real(r8) :: coszen_pft(num_urbanp) ! cosine solar zenith angle for next time step (pft level) - real(r8) :: zen(num_urbanl) ! solar zenith angle (radians) - real(r8) :: sdir(num_urbanl, numrad) ! direct beam solar radiation on horizontal surface - real(r8) :: sdif(num_urbanl, numrad) ! diffuse solar radiation on horizontal surface - - real(r8) :: sdir_road(num_urbanl, numrad) ! direct beam solar radiation incident on road - real(r8) :: sdif_road(num_urbanl, numrad) ! diffuse solar radiation incident on road - real(r8) :: sdir_sunwall(num_urbanl, numrad) ! direct beam solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8) :: sdif_sunwall(num_urbanl, numrad) ! diffuse solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8) :: sdir_shadewall(num_urbanl, numrad) ! direct beam solar radiation (per unit wall area) incident on shaded wall per unit incident flux - real(r8) :: sdif_shadewall(num_urbanl, numrad) ! diffuse solar radiation (per unit wall area) incident on shaded wall per unit incident flux - real(r8) :: albsnd_roof(num_urbanl,numrad) ! snow albedo for roof (direct) - real(r8) :: albsni_roof(num_urbanl,numrad) ! snow albedo for roof (diffuse) - real(r8) :: albsnd_improad(num_urbanl,numrad) ! snow albedo for impervious road (direct) - real(r8) :: albsni_improad(num_urbanl,numrad) ! snow albedo for impervious road (diffuse) - real(r8) :: albsnd_perroad(num_urbanl,numrad) ! snow albedo for pervious road (direct) - real(r8) :: albsni_perroad(num_urbanl,numrad) ! snow albedo for pervious road (diffuse) - - integer :: fl,fp,fc,g,l,p,c,ib ! indices - integer :: ic ! 0=unit incoming direct; 1=unit incoming diffuse - integer :: num_solar ! counter - real(r8) :: alb_roof_dir_s(num_urbanl,numrad) ! direct roof albedo with snow effects - real(r8) :: alb_roof_dif_s(num_urbanl,numrad) ! diffuse roof albedo with snow effects - real(r8) :: alb_improad_dir_s(num_urbanl,numrad) ! direct impervious road albedo with snow effects - real(r8) :: alb_perroad_dir_s(num_urbanl,numrad) ! direct pervious road albedo with snow effects - real(r8) :: alb_improad_dif_s(num_urbanl,numrad) ! diffuse impervious road albedo with snow effects - real(r8) :: alb_perroad_dif_s(num_urbanl,numrad) ! diffuse pervious road albedo with snow effects - real(r8) :: sref_roof_dir(num_urbanl,numrad) ! direct solar reflected by roof per unit ground area per unit incident flux - real(r8) :: sref_roof_dif(num_urbanl,numrad) ! diffuse solar reflected by roof per unit ground area per unit incident flux - real(r8) :: sref_sunwall_dir(num_urbanl,numrad) ! direct solar reflected by sunwall per unit wall area per unit incident flux - real(r8) :: sref_sunwall_dif(num_urbanl,numrad) ! diffuse solar reflected by sunwall per unit wall area per unit incident flux - real(r8) :: sref_shadewall_dir(num_urbanl,numrad) ! direct solar reflected by shadewall per unit wall area per unit incident flux - real(r8) :: sref_shadewall_dif(num_urbanl,numrad) ! diffuse solar reflected by shadewall per unit wall area per unit incident flux - real(r8) :: sref_improad_dir(num_urbanl,numrad) ! direct solar reflected by impervious road per unit ground area per unit incident flux - real(r8) :: sref_improad_dif(num_urbanl,numrad) ! diffuse solar reflected by impervious road per unit ground area per unit incident flux - real(r8) :: sref_perroad_dir(num_urbanl,numrad) ! direct solar reflected by pervious road per unit ground area per unit incident flux - real(r8) :: sref_perroad_dif(num_urbanl,numrad) ! diffuse solar reflected by pervious road per unit ground area per unit incident flux - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width - real(r8), pointer :: wtroad_perv(:) ! weight of pervious road wrt total road - real(r8), pointer :: alb_roof_dir(:,:) ! direct roof albedo - real(r8), pointer :: alb_roof_dif(:,:) ! diffuse roof albedo - real(r8), pointer :: alb_improad_dir(:,:) ! direct impervious road albedo - real(r8), pointer :: alb_perroad_dir(:,:) ! direct pervious road albedo - real(r8), pointer :: alb_improad_dif(:,:) ! diffuse imprevious road albedo - real(r8), pointer :: alb_perroad_dif(:,:) ! diffuse pervious road albedo - real(r8), pointer :: alb_wall_dir(:,:) ! direct wall albedo - real(r8), pointer :: alb_wall_dif(:,:) ! diffuse wall albedo -!----------------------------------------------------------------------- - - ! Assign pointers into module urban clumps - - canyon_hwr => urban_clump(nc)%canyon_hwr - wtroad_perv => urban_clump(nc)%wtroad_perv - alb_roof_dir => urban_clump(nc)%alb_roof_dir - alb_roof_dif => urban_clump(nc)%alb_roof_dif - alb_improad_dir => urban_clump(nc)%alb_improad_dir - alb_improad_dif => urban_clump(nc)%alb_improad_dif - alb_perroad_dir => urban_clump(nc)%alb_perroad_dir - alb_perroad_dif => urban_clump(nc)%alb_perroad_dif - alb_wall_dir => urban_clump(nc)%alb_wall_dir - alb_wall_dif => urban_clump(nc)%alb_wall_dif - - ! Assign gridcell level pointers - - lat => grc%lat - lon => grc%lon - - ! Assign landunit level pointer - - lgridcell => lun%gridcell - coli => lun%coli - colf => lun%colf - vf_sr => lps%vf_sr - vf_wr => lps%vf_wr - vf_sw => lps%vf_sw - vf_rw => lps%vf_rw - vf_ww => lps%vf_ww - sabs_roof_dir => lps%sabs_roof_dir - sabs_roof_dif => lps%sabs_roof_dif - sabs_sunwall_dir => lps%sabs_sunwall_dir - sabs_sunwall_dif => lps%sabs_sunwall_dif - sabs_shadewall_dir => lps%sabs_shadewall_dir - sabs_shadewall_dif => lps%sabs_shadewall_dif - sabs_improad_dir => lps%sabs_improad_dir - sabs_improad_dif => lps%sabs_improad_dif - sabs_perroad_dir => lps%sabs_perroad_dir - sabs_perroad_dif => lps%sabs_perroad_dif - - ! Assign column level pointers - - ctype => col%itype - albgrd => cps%albgrd - albgri => cps%albgri - frac_sno => cps%frac_sno - clandunit => col%landunit - cgridcell => col%gridcell - czen => cps%coszen - - ! Assign pft level pointers - - pgridcell => pft%gridcell - pcolumn => pft%column - albd => pps%albd - albi => pps%albi - fabd => pps%fabd - fabi => pps%fabi - ftdd => pps%ftdd - ftid => pps%ftid - ftii => pps%ftii - fsun => pps%fsun - gdir => pps%gdir - omega => pps%omega - - ! ---------------------------------------------------------------------------- - ! Solar declination and cosine solar zenith angle and zenith angle for - ! next time step - ! ---------------------------------------------------------------------------- - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - coszen(fl) = czen(coli(l)) ! Assumes coszen for each column are the same - zen(fl) = acos(coszen(fl)) - end do - - do fp = 1,num_urbanp - p = filter_urbanp(fp) - g = pgridcell(p) - c = pcolumn(p) - coszen_pft(fp) = czen(c) - end do - - ! ---------------------------------------------------------------------------- - ! Initialize clmtype output since solar radiation is only done if coszen > 0 - ! ---------------------------------------------------------------------------- - - do ib = 1,numrad - do fc = 1,num_urbanc - c = filter_urbanc(fc) - - albgrd(c,ib) = 0._r8 - albgri(c,ib) = 0._r8 - end do - - do fp = 1,num_urbanp - p = filter_urbanp(fp) - g = pgridcell(p) - albd(p,ib) = 1._r8 - albi(p,ib) = 1._r8 - fabd(p,ib) = 0._r8 - fabi(p,ib) = 0._r8 - if (coszen_pft(fp) > 0._r8) then - ftdd(p,ib) = 1._r8 - else - ftdd(p,ib) = 0._r8 - end if - ftid(p,ib) = 0._r8 - if (coszen_pft(fp) > 0._r8) then - ftii(p,ib) = 1._r8 - else - ftii(p,ib) = 0._r8 - end if - omega(p,ib) = 0._r8 - if (ib == 1) then - gdir(p) = 0._r8 - fsun(p) = 0._r8 - end if - end do - end do - - ! ---------------------------------------------------------------------------- - ! Urban Code - ! ---------------------------------------------------------------------------- - - num_solar = 0 - do fl = 1,num_urbanl - if (coszen(fl) > 0._r8) num_solar = num_solar + 1 - end do - - ! Initialize urban clump components - - do ib = 1,numrad - do fl = 1,num_urbanl - l = filter_urbanl(fl) - sabs_roof_dir(l,ib) = 0._r8 - sabs_roof_dif(l,ib) = 0._r8 - sabs_sunwall_dir(l,ib) = 0._r8 - sabs_sunwall_dif(l,ib) = 0._r8 - sabs_shadewall_dir(l,ib) = 0._r8 - sabs_shadewall_dif(l,ib) = 0._r8 - sabs_improad_dir(l,ib) = 0._r8 - sabs_improad_dif(l,ib) = 0._r8 - sabs_perroad_dir(l,ib) = 0._r8 - sabs_perroad_dif(l,ib) = 0._r8 - sref_roof_dir(fl,ib) = 1._r8 - sref_roof_dif(fl,ib) = 1._r8 - sref_sunwall_dir(fl,ib) = 1._r8 - sref_sunwall_dif(fl,ib) = 1._r8 - sref_shadewall_dir(fl,ib) = 1._r8 - sref_shadewall_dif(fl,ib) = 1._r8 - sref_improad_dir(fl,ib) = 1._r8 - sref_improad_dif(fl,ib) = 1._r8 - sref_perroad_dir(fl,ib) = 1._r8 - sref_perroad_dif(fl,ib) = 1._r8 - end do - end do - - ! View factors for road and one wall in urban canyon (depends only on canyon_hwr) - - if (num_urbanl .gt. 0) then - call view_factor (lbl, ubl, num_urbanl, filter_urbanl, canyon_hwr) - end if - - ! ---------------------------------------------------------------------------- - ! Only do the rest if all coszen are positive - ! ---------------------------------------------------------------------------- - - if (num_solar > 0)then - - ! Set constants - solar fluxes are per unit incoming flux - - do ib = 1,numrad - do fl = 1,num_urbanl - sdir(fl,ib) = 1._r8 - sdif(fl,ib) = 1._r8 - end do - end do - - ! Incident direct beam radiation for - ! (a) roof and (b) road and both walls in urban canyon - - if (num_urbanl .gt. 0) then - call incident_direct (lbl, ubl, num_urbanl, canyon_hwr, coszen, zen, sdir, sdir_road, sdir_sunwall, sdir_shadewall) - end if - - ! Incident diffuse radiation for - ! (a) roof and (b) road and both walls in urban canyon. - - if (num_urbanl .gt. 0) then - call incident_diffuse (lbl, ubl, num_urbanl, filter_urbanl, canyon_hwr, sdif, sdif_road, & - sdif_sunwall, sdif_shadewall) - end if - - ! Get snow albedos for roof and impervious and pervious road - if (num_urbanl .gt. 0) then - ic = 0; call UrbanSnowAlbedo(lbl, ubl, num_urbanl, filter_urbanl, coszen, ic, albsnd_roof, albsnd_improad, albsnd_perroad) - ic = 1; call UrbanSnowAlbedo(lbl, ubl, num_urbanl, filter_urbanl, coszen, ic, albsni_roof, albsni_improad, albsni_perroad) - end if - - ! Combine snow-free and snow albedos - do ib = 1,numrad - do fl = 1,num_urbanl - l = filter_urbanl(fl) - do c = coli(l),colf(l) - if (ctype(c) == icol_roof) then - alb_roof_dir_s(fl,ib) = alb_roof_dir(fl,ib)*(1._r8-frac_sno(c)) & - + albsnd_roof(fl,ib)*frac_sno(c) - alb_roof_dif_s(fl,ib) = alb_roof_dif(fl,ib)*(1._r8-frac_sno(c)) & - + albsni_roof(fl,ib)*frac_sno(c) - else if (ctype(c) == icol_road_imperv) then - alb_improad_dir_s(fl,ib) = alb_improad_dir(fl,ib)*(1._r8-frac_sno(c)) & - + albsnd_improad(fl,ib)*frac_sno(c) - alb_improad_dif_s(fl,ib) = alb_improad_dif(fl,ib)*(1._r8-frac_sno(c)) & - + albsni_improad(fl,ib)*frac_sno(c) - else if (ctype(c) == icol_road_perv) then - alb_perroad_dir_s(fl,ib) = alb_perroad_dir(fl,ib)*(1._r8-frac_sno(c)) & - + albsnd_perroad(fl,ib)*frac_sno(c) - alb_perroad_dif_s(fl,ib) = alb_perroad_dif(fl,ib)*(1._r8-frac_sno(c)) & - + albsni_perroad(fl,ib)*frac_sno(c) - end if - end do - end do - end do - - ! Reflected and absorbed solar radiation per unit incident radiation - ! for road and both walls in urban canyon allowing for multiple reflection - ! Reflected and absorbed solar radiation per unit incident radiation for roof - - if (num_urbanl .gt. 0) then - call net_solar (lbl, ubl, num_urbanl, filter_urbanl, coszen, canyon_hwr, wtroad_perv, sdir, sdif, & - alb_improad_dir_s, alb_perroad_dir_s, alb_wall_dir, alb_roof_dir_s, & - alb_improad_dif_s, alb_perroad_dif_s, alb_wall_dif, alb_roof_dif_s, & - sdir_road, sdir_sunwall, sdir_shadewall, & - sdif_road, sdif_sunwall, sdif_shadewall, & - sref_improad_dir, sref_perroad_dir, sref_sunwall_dir, sref_shadewall_dir, sref_roof_dir, & - sref_improad_dif, sref_perroad_dif, sref_sunwall_dif, sref_shadewall_dif, sref_roof_dif) - end if - - ! ---------------------------------------------------------------------------- - ! Map urban output to clmtype components - ! ---------------------------------------------------------------------------- - - ! Set albgrd and albgri (ground albedos) and albd and albi (surface albedos) - - do ib = 1,numrad - do fl = 1,num_urbanl - l = filter_urbanl(fl) - do c = coli(l),colf(l) - if (ctype(c) == icol_roof) then - albgrd(c,ib) = sref_roof_dir(fl,ib) - albgri(c,ib) = sref_roof_dif(fl,ib) - else if (ctype(c) == icol_sunwall) then - albgrd(c,ib) = sref_sunwall_dir(fl,ib) - albgri(c,ib) = sref_sunwall_dif(fl,ib) - else if (ctype(c) == icol_shadewall) then - albgrd(c,ib) = sref_shadewall_dir(fl,ib) - albgri(c,ib) = sref_shadewall_dif(fl,ib) - else if (ctype(c) == icol_road_perv) then - albgrd(c,ib) = sref_perroad_dir(fl,ib) - albgri(c,ib) = sref_perroad_dif(fl,ib) - else if (ctype(c) == icol_road_imperv) then - albgrd(c,ib) = sref_improad_dir(fl,ib) - albgri(c,ib) = sref_improad_dif(fl,ib) - endif - end do - end do - do fp = 1,num_urbanp - p = filter_urbanp(fp) - c = pcolumn(p) - albd(p,ib) = albgrd(c,ib) - albi(p,ib) = albgri(c,ib) - end do - end do - end if - - end subroutine UrbanAlbedo - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanSnowAlbedo -! -! !INTERFACE: - subroutine UrbanSnowAlbedo (lbl, ubl, num_urbanl, filter_urbanl, coszen, ind, & - albsn_roof, albsn_improad, albsn_perroad) -! -! !DESCRIPTION: -! Determine urban snow albedos -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_varcon , only : icol_roof, icol_road_perv, icol_road_imperv -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - integer , intent(in) :: ind ! 0=direct beam, 1=diffuse radiation - real(r8), intent(in) :: coszen(num_urbanl) ! cosine solar zenith angle - real(r8), intent(out):: albsn_roof(num_urbanl,2) ! roof snow albedo by waveband (assume 2 wavebands) - real(r8), intent(out):: albsn_improad(num_urbanl,2) ! impervious road snow albedo by waveband (assume 2 wavebands) - real(r8), intent(out):: albsn_perroad(num_urbanl,2) ! pervious road snow albedo by waveband (assume 2 wavebands) -! -! !CALLED FROM: -! subroutine UrbanAlbedo in this module -! -! !REVISION HISTORY: -! Author: Keith Oleson 9/2005 -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments - integer , pointer :: coli(:) ! beginning column index for landunit - integer , pointer :: colf(:) ! ending column index for landunit - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - integer , pointer :: ctype(:) ! column type -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: fl,c,l ! indices -! -! variables and constants for snow albedo calculation -! -! These values are derived from Marshall (1989) assuming soot content of 1.5e-5 -! (three times what LSM uses globally). Note that snow age effects are ignored here. - real(r8), parameter :: snal0 = 0.66_r8 ! vis albedo of urban snow - real(r8), parameter :: snal1 = 0.56_r8 ! nir albedo of urban snow -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (landunit level) - - coli => lun%coli - colf => lun%colf - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype - h2osno => cws%h2osno - - ! this code assumes that numrad = 2 , with the following - ! index values: 1 = visible, 2 = NIR - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - do c = coli(l),colf(l) - if (coszen(fl) > 0._r8 .and. h2osno(c) > 0._r8) then - if (ctype(c) == icol_roof) then - albsn_roof(fl,1) = snal0 - albsn_roof(fl,2) = snal1 - else if (ctype(c) == icol_road_imperv) then - albsn_improad(fl,1) = snal0 - albsn_improad(fl,2) = snal1 - else if (ctype(c) == icol_road_perv) then - albsn_perroad(fl,1) = snal0 - albsn_perroad(fl,2) = snal1 - end if - else - if (ctype(c) == icol_roof) then - albsn_roof(fl,1) = 0._r8 - albsn_roof(fl,2) = 0._r8 - else if (ctype(c) == icol_road_imperv) then - albsn_improad(fl,1) = 0._r8 - albsn_improad(fl,2) = 0._r8 - else if (ctype(c) == icol_road_perv) then - albsn_perroad(fl,1) = 0._r8 - albsn_perroad(fl,2) = 0._r8 - end if - end if - end do - end do - - end subroutine UrbanSnowAlbedo - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanRadiation -! -! !INTERFACE: - subroutine UrbanRadiation (nc, lbl, ubl, lbc, ubc, lbp, ubp, & - num_nourbanl, filter_nourbanl, & - num_urbanl, filter_urbanl, & - num_urbanc, filter_urbanc, & - num_urbanp, filter_urbanp) -! -! !DESCRIPTION: -! Solar fluxes absorbed and reflected by roof and canyon (walls, road). -! Also net and upward longwave fluxes. - -! !USES: - use clmtype - use clm_varcon , only : spval, icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv, sb - use clm_varcon , only : tfrz ! To use new constant.. - use clm_time_manager , only : get_curr_date, get_step_size - use clm_atmlnd , only : clm_a2l -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: nc ! clump index - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer , intent(in) :: num_nourbanl ! number of non-urban landunits in clump - integer , intent(in) :: filter_nourbanl(ubl-lbl+1) ! non-urban landunit filter - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(ubc-lbc+1) ! urban column filter - integer , intent(in) :: num_urbanp ! number of urban pfts in clump - integer , intent(in) :: filter_urbanp(ubp-lbp+1) ! urban pft filter -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 03/2003, Mariana Vertenstein: Migrated to clm2.2 -! 07/2004, Mariana Vertenstein: Migrated to clm3.0 -! 01/2008, Erik Kluzek: Migrated to clm3.5.15 -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments (urban clump) -! - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width - real(r8), pointer :: wtroad_perv(:) ! weight of pervious road wrt total road - real(r8), pointer :: em_roof(:) ! roof emissivity - real(r8), pointer :: em_improad(:) ! impervious road emissivity - real(r8), pointer :: em_perroad(:) ! pervious road emissivity - real(r8), pointer :: em_wall(:) ! wall emissivity -! -! local pointers to original implicit in arguments (clmtype) -! - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: ctype(:) ! column type - integer , pointer :: coli(:) ! beginning column index for landunit - integer , pointer :: colf(:) ! ending column index for landunit - integer , pointer :: pfti(:) ! beginning pfti index for landunit - integer , pointer :: pftf(:) ! ending pftf index for landunit - real(r8), pointer :: londeg(:) ! longitude (degrees) - real(r8), pointer :: forc_lwrad(:) ! downward infrared (longwave) radiation (W/m**2) - real(r8), pointer :: forc_solad(:,:) ! direct beam radiation (vis=forc_sols , nir=forc_soll ) (W/m**2) - real(r8), pointer :: forc_solai(:,:) ! diffuse beam radiation (vis=forc_sols , nir=forc_soll ) (W/m**2) - real(r8), pointer :: forc_solar(:) ! incident solar radiation (W/m**2) - real(r8), pointer :: albd(:,:) ! surface albedo (direct) - real(r8), pointer :: albi(:,:) ! surface albedo (diffuse) - real(r8), pointer :: t_grnd(:) ! ground temperature (K) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (K) - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_wr(:) ! view factor of one wall for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall - real(r8), pointer :: vf_rw(:) ! view factor of road for one wall - real(r8), pointer :: vf_ww(:) ! view factor of opposing wall for one wall - real(r8), pointer :: sabs_roof_dir(:,:) ! direct solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_roof_dif(:,:) ! diffuse solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_sunwall_dir(:,:) ! direct solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_sunwall_dif(:,:) ! diffuse solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dir(:,:) ! direct solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dif(:,:) ! diffuse solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_improad_dir(:,:) ! direct solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_improad_dif(:,:) ! diffuse solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dir(:,:) ! direct solar absorbed by pervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dif(:,:) ! diffuse solar absorbed by pervious road per unit ground area per unit incident flux -! -! local pointers to original implicit out arguments (clmtype) -! - real(r8), pointer :: parsun(:) ! average absorbed PAR for sunlit leaves (W/m**2) - real(r8), pointer :: parsha(:) ! average absorbed PAR for shaded leaves (W/m**2) - real(r8), pointer :: sabg(:) ! solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: sabv(:) ! solar radiation absorbed by vegetation (W/m**2) - real(r8), pointer :: fsa(:) ! solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_u(:) ! urban solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsr(:) ! solar radiation reflected (total) (W/m**2) - real(r8), pointer :: fsds_vis_d(:) ! incident direct beam vis solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_d(:) ! incident direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsds_vis_i(:) ! incident diffuse vis solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_i(:) ! incident diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsr_vis_d(:) ! reflected direct beam vis solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_d(:) ! reflected direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsr_vis_i(:) ! reflected diffuse vis solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_i(:) ! reflected diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsds_vis_d_ln(:) ! incident direct beam vis solar rad at local noon (W/m**2) - real(r8), pointer :: fsds_nir_d_ln(:) ! incident direct beam nir solar rad at local noon (W/m**2) - real(r8), pointer :: fsr_vis_d_ln(:) ! reflected direct beam vis solar rad at local noon (W/m**2) - real(r8), pointer :: fsr_nir_d_ln(:) ! reflected direct beam nir solar rad at local noon (W/m**2) - real(r8), pointer :: eflx_lwrad_out(:) ! emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_net(:) ! net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_u(:) ! urban net infrared (longwave) rad (W/m**2) [+ = to atm] -! -! -! !OTHER LOCAL VARIABLES -!EOP -! - integer :: fp,fl,p,c,l,g ! indices - integer :: local_secp1 ! seconds into current date in local time - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day ! temporaries (not used) - integer :: secs ! seconds into current date - - real(r8), parameter :: mpe = 1.e-06_r8 ! prevents overflow for division by zero - real(r8), parameter :: snoem = 0.97_r8 ! snow emissivity (should use value from Biogeophysics1) - - real(r8) :: lwnet_roof(num_urbanl) ! net (outgoing-incoming) longwave radiation (per unit ground area), roof (W/m**2) - real(r8) :: lwnet_improad(num_urbanl) ! net (outgoing-incoming) longwave radiation (per unit ground area), impervious road (W/m**2) - real(r8) :: lwnet_perroad(num_urbanl) ! net (outgoing-incoming) longwave radiation (per unit ground area), pervious road (W/m**2) - real(r8) :: lwnet_sunwall(num_urbanl) ! net (outgoing-incoming) longwave radiation (per unit wall area), sunlit wall (W/m**2) - real(r8) :: lwnet_shadewall(num_urbanl)! net (outgoing-incoming) longwave radiation (per unit wall area), shaded wall (W/m**2) - real(r8) :: lwnet_canyon(num_urbanl) ! net (outgoing-incoming) longwave radiation for canyon, per unit ground area (W/m**2) - real(r8) :: lwup_roof(num_urbanl) ! upward longwave radiation (per unit ground area), roof (W/m**2) - real(r8) :: lwup_improad(num_urbanl) ! upward longwave radiation (per unit ground area), impervious road (W/m**2) - real(r8) :: lwup_perroad(num_urbanl) ! upward longwave radiation (per unit ground area), pervious road (W/m**2) - real(r8) :: lwup_sunwall(num_urbanl) ! upward longwave radiation, (per unit wall area), sunlit wall (W/m**2) - real(r8) :: lwup_shadewall(num_urbanl) ! upward longwave radiation, (per unit wall area), shaded wall (W/m**2) - real(r8) :: lwup_canyon(num_urbanl) ! upward longwave radiation for canyon, per unit ground area (W/m**2) - real(r8) :: t_roof(num_urbanl) ! roof temperature (K) - real(r8) :: t_improad(num_urbanl) ! imppervious road temperature (K) - real(r8) :: t_perroad(num_urbanl) ! pervious road temperature (K) - real(r8) :: t_sunwall(num_urbanl) ! sunlit wall temperature (K) - real(r8) :: t_shadewall(num_urbanl) ! shaded wall temperature (K) - real(r8) :: lwdown(num_urbanl) ! atmospheric downward longwave radiation (W/m**2) - real(r8) :: em_roof_s(num_urbanl) ! roof emissivity with snow effects - real(r8) :: em_improad_s(num_urbanl) ! impervious road emissivity with snow effects - real(r8) :: em_perroad_s(num_urbanl) ! pervious road emissivity with snow effects -!----------------------------------------------------------------------- - - ! Assign pointers into module urban clumps - - if( num_urbanl > 0 )then - canyon_hwr => urban_clump(nc)%canyon_hwr - wtroad_perv => urban_clump(nc)%wtroad_perv - em_roof => urban_clump(nc)%em_roof - em_improad => urban_clump(nc)%em_improad - em_perroad => urban_clump(nc)%em_perroad - em_wall => urban_clump(nc)%em_wall - end if - - ! Assign local pointers to multi-level derived type members (gridcell level) - - londeg => grc%londeg - forc_solad => clm_a2l%forc_solad - forc_solai => clm_a2l%forc_solai - forc_solar => clm_a2l%forc_solar - forc_lwrad => clm_a2l%forc_lwrad - - ! Assign local pointers to derived type members (landunit level) - - pfti => lun%pfti - pftf => lun%pftf - coli => lun%coli - colf => lun%colf - lgridcell => lun%gridcell - vf_sr => lps%vf_sr - vf_wr => lps%vf_wr - vf_sw => lps%vf_sw - vf_rw => lps%vf_rw - vf_ww => lps%vf_ww - sabs_roof_dir => lps%sabs_roof_dir - sabs_roof_dif => lps%sabs_roof_dif - sabs_sunwall_dir => lps%sabs_sunwall_dir - sabs_sunwall_dif => lps%sabs_sunwall_dif - sabs_shadewall_dir => lps%sabs_shadewall_dir - sabs_shadewall_dif => lps%sabs_shadewall_dif - sabs_improad_dir => lps%sabs_improad_dir - sabs_improad_dif => lps%sabs_improad_dif - sabs_perroad_dir => lps%sabs_perroad_dir - sabs_perroad_dif => lps%sabs_perroad_dif - - ! Assign local pointers to derived type members (column level) - - ctype => col%itype - t_grnd => ces%t_grnd - frac_sno => cps%frac_sno - - ! Assign local pointers to derived type members (pft level) - - pgridcell => pft%gridcell - pcolumn => pft%column - albd => pps%albd - albi => pps%albi - sabg => pef%sabg - sabv => pef%sabv - fsa => pef%fsa - fsa_u => pef%fsa_u - fsr => pef%fsr - fsds_vis_d => pef%fsds_vis_d - fsds_nir_d => pef%fsds_nir_d - fsds_vis_i => pef%fsds_vis_i - fsds_nir_i => pef%fsds_nir_i - fsr_vis_d => pef%fsr_vis_d - fsr_nir_d => pef%fsr_nir_d - fsr_vis_i => pef%fsr_vis_i - fsr_nir_i => pef%fsr_nir_i - fsds_vis_d_ln => pef%fsds_vis_d_ln - fsds_nir_d_ln => pef%fsds_nir_d_ln - fsr_vis_d_ln => pef%fsr_vis_d_ln - fsr_nir_d_ln => pef%fsr_nir_d_ln - eflx_lwrad_out => pef%eflx_lwrad_out - eflx_lwrad_net => pef%eflx_lwrad_net - eflx_lwrad_net_u => pef%eflx_lwrad_net_u - parsun => pef%parsun - parsha => pef%parsha - t_ref2m => pes%t_ref2m - - ! Define fields that appear on the restart file for non-urban landunits - - do fl = 1,num_nourbanl - l = filter_nourbanl(fl) - sabs_roof_dir(l,:) = spval - sabs_roof_dif(l,:) = spval - sabs_sunwall_dir(l,:) = spval - sabs_sunwall_dif(l,:) = spval - sabs_shadewall_dir(l,:) = spval - sabs_shadewall_dif(l,:) = spval - sabs_improad_dir(l,:) = spval - sabs_improad_dif(l,:) = spval - sabs_perroad_dir(l,:) = spval - sabs_perroad_dif(l,:) = spval - vf_sr(l) = spval - vf_wr(l) = spval - vf_sw(l) = spval - vf_rw(l) = spval - vf_ww(l) = spval - end do - - ! Set input forcing fields - do fl = 1,num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - ! Need to set the following temperatures to some defined value even if it - ! does not appear in the urban landunit for the net_longwave computation - - t_roof(fl) = 19._r8 + tfrz - t_sunwall(fl) = 19._r8 + tfrz - t_shadewall(fl) = 19._r8 + tfrz - t_improad(fl) = 19._r8 + tfrz - t_perroad(fl) = 19._r8 + tfrz - - ! Initial assignment of emissivity - em_roof_s(fl) = em_roof(fl) - em_improad_s(fl) = em_improad(fl) - em_perroad_s(fl) = em_perroad(fl) - - ! Set urban temperatures and emissivity including snow effects. - do c = coli(l),colf(l) - if (ctype(c) == icol_roof ) then - t_roof(fl) = t_grnd(c) - em_roof_s(fl) = em_roof(fl)*(1._r8-frac_sno(c)) + snoem*frac_sno(c) - else if (ctype(c) == icol_road_imperv) then - t_improad(fl) = t_grnd(c) - em_improad_s(fl) = em_improad(fl)*(1._r8-frac_sno(c)) + snoem*frac_sno(c) - else if (ctype(c) == icol_road_perv ) then - t_perroad(fl) = t_grnd(c) - em_perroad_s(fl) = em_perroad(fl)*(1._r8-frac_sno(c)) + snoem*frac_sno(c) - else if (ctype(c) == icol_sunwall ) then - t_sunwall(fl) = t_grnd(c) - else if (ctype(c) == icol_shadewall ) then - t_shadewall(fl) = t_grnd(c) - end if - end do - lwdown(fl) = forc_lwrad(g) - end do - - ! Net longwave radiation for road and both walls in urban canyon allowing for multiple re-emission - - if (num_urbanl .gt. 0) then - call net_longwave (lbl, ubl, num_urbanl, filter_urbanl, canyon_hwr, wtroad_perv, & - lwdown, em_roof_s, em_improad_s, em_perroad_s, em_wall, & - t_roof, t_improad, t_perroad, t_sunwall, t_shadewall, & - lwnet_roof, lwnet_improad, lwnet_perroad, lwnet_sunwall, lwnet_shadewall, lwnet_canyon, & - lwup_roof, lwup_improad, lwup_perroad, lwup_sunwall, lwup_shadewall, lwup_canyon) - end if - - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! Determine clmtype variables needed for history output and communication with atm - ! Loop over urban pfts in clump - - do fp = 1,num_urbanp - p = filter_urbanp(fp) - g = pgridcell(p) - - local_secp1 = secs + nint((londeg(g)/degpsec)/dtime)*dtime - local_secp1 = mod(local_secp1,isecspday) - - ! Solar incident - - fsds_vis_d(p) = forc_solad(g,1) - fsds_nir_d(p) = forc_solad(g,2) - fsds_vis_i(p) = forc_solai(g,1) - fsds_nir_i(p) = forc_solai(g,2) - ! Determine local noon incident solar - if (local_secp1 == noonsec) then - fsds_vis_d_ln(p) = forc_solad(g,1) - fsds_nir_d_ln(p) = forc_solad(g,2) - else - fsds_vis_d_ln(p) = spval - fsds_nir_d_ln(p) = spval - endif - - ! Solar reflected - ! per unit ground area (roof, road) and per unit wall area (sunwall, shadewall) - - fsr_vis_d(p) = albd(p,1) * forc_solad(g,1) - fsr_nir_d(p) = albd(p,2) * forc_solad(g,2) - fsr_vis_i(p) = albi(p,1) * forc_solai(g,1) - fsr_nir_i(p) = albi(p,2) * forc_solai(g,2) - - ! Determine local noon reflected solar - if (local_secp1 == noonsec) then - fsr_vis_d_ln(p) = fsr_vis_d(p) - fsr_nir_d_ln(p) = fsr_nir_d(p) - else - fsr_vis_d_ln(p) = spval - fsr_nir_d_ln(p) = spval - endif - fsr(p) = fsr_vis_d(p) + fsr_nir_d(p) + fsr_vis_i(p) + fsr_nir_i(p) - - end do - - ! Loop over urban landunits in clump - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - ! Solar absorbed and longwave out and net - ! per unit ground area (roof, road) and per unit wall area (sunwall, shadewall) - ! Each urban pft has its own column - this is used in the logic below - - do p = pfti(l), pftf(l) - c = pcolumn(p) - if (ctype(c) == icol_roof) then - eflx_lwrad_out(p) = lwup_roof(fl) - eflx_lwrad_net(p) = lwnet_roof(fl) - eflx_lwrad_net_u(p) = lwnet_roof(fl) - sabg(p) = sabs_roof_dir(l,1)*forc_solad(g,1) + & - sabs_roof_dif(l,1)*forc_solai(g,1) + & - sabs_roof_dir(l,2)*forc_solad(g,2) + & - sabs_roof_dif(l,2)*forc_solai(g,2) - else if (ctype(c) == icol_sunwall) then - eflx_lwrad_out(p) = lwup_sunwall(fl) - eflx_lwrad_net(p) = lwnet_sunwall(fl) - eflx_lwrad_net_u(p) = lwnet_sunwall(fl) - sabg(p) = sabs_sunwall_dir(l,1)*forc_solad(g,1) + & - sabs_sunwall_dif(l,1)*forc_solai(g,1) + & - sabs_sunwall_dir(l,2)*forc_solad(g,2) + & - sabs_sunwall_dif(l,2)*forc_solai(g,2) - else if (ctype(c) == icol_shadewall) then - eflx_lwrad_out(p) = lwup_shadewall(fl) - eflx_lwrad_net(p) = lwnet_shadewall(fl) - eflx_lwrad_net_u(p) = lwnet_shadewall(fl) - sabg(p) = sabs_shadewall_dir(l,1)*forc_solad(g,1) + & - sabs_shadewall_dif(l,1)*forc_solai(g,1) + & - sabs_shadewall_dir(l,2)*forc_solad(g,2) + & - sabs_shadewall_dif(l,2)*forc_solai(g,2) - else if (ctype(c) == icol_road_perv) then - eflx_lwrad_out(p) = lwup_perroad(fl) - eflx_lwrad_net(p) = lwnet_perroad(fl) - eflx_lwrad_net_u(p) = lwnet_perroad(fl) - sabg(p) = sabs_perroad_dir(l,1)*forc_solad(g,1) + & - sabs_perroad_dif(l,1)*forc_solai(g,1) + & - sabs_perroad_dir(l,2)*forc_solad(g,2) + & - sabs_perroad_dif(l,2)*forc_solai(g,2) - else if (ctype(c) == icol_road_imperv) then - eflx_lwrad_out(p) = lwup_improad(fl) - eflx_lwrad_net(p) = lwnet_improad(fl) - eflx_lwrad_net_u(p) = lwnet_improad(fl) - sabg(p) = sabs_improad_dir(l,1)*forc_solad(g,1) + & - sabs_improad_dif(l,1)*forc_solai(g,1) + & - sabs_improad_dir(l,2)*forc_solad(g,2) + & - sabs_improad_dif(l,2)*forc_solai(g,2) - end if - sabv(p) = 0._r8 - fsa(p) = sabv(p) + sabg(p) - fsa_u(p) = fsa(p) - parsun(p) = 0._r8 - parsha(p) = 0._r8 - - end do ! end loop over urban pfts - - end do ! end loop over urban landunits - - end subroutine UrbanRadiation - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: view_factor -! -! !INTERFACE: - subroutine view_factor (lbl, ubl, num_urbanl, filter_urbanl, canyon_hwr) - -! -! !DESCRIPTION: -! View factors for road and one wall -! WALL | -! ROAD | -! wall | -! -----\ /----- - - |\----------/ -! | \ vsr / | | r | | \ vww / s -! | \ / | h o w | \ / k -! wall | \ / | wall | a | | \ / y -! |vwr \ / vwr| | d | |vrw \ / vsw -! ------\/------ - - |-----\/----- -! road wall | -! <----- w ----> | -! <---- h --->| -! -! vsr = view factor of sky for road vrw = view factor of road for wall -! vwr = view factor of one wall for road vww = view factor of opposing wall for wall -! vsw = view factor of sky for wall -! vsr + vwr + vwr = 1 vrw + vww + vsw = 1 -! -! Source: Masson, V. (2000) A physically-based scheme for the urban energy budget in -! atmospheric models. Boundary-Layer Meteorology 94:357-397 -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - real(r8), intent(in) :: canyon_hwr(num_urbanl) ! ratio of building height to street width -! -! local pointers to original implicit out arguments (clmtype) -! - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_wr(:) ! view factor of one wall for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall - real(r8), pointer :: vf_rw(:) ! view factor of road for one wall - real(r8), pointer :: vf_ww(:) ! view factor of opposing wall for one wall -! -! !CALLED FROM: -! subroutine UrbanAlbedo in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! 03/2003, Mariana Vertenstein: Migrated to clm2.2 -! 01/2008, Erik Kluzek: Migrated to clm3.5.15 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: l, fl ! indices - real(r8) :: sum ! sum of view factors for wall or road -!----------------------------------------------------------------------- - - ! Assign landunit level pointer - - vf_sr => lps%vf_sr - vf_wr => lps%vf_wr - vf_sw => lps%vf_sw - vf_rw => lps%vf_rw - vf_ww => lps%vf_ww - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - - ! road -- sky view factor -> 1 as building height -> 0 - ! and -> 0 as building height -> infinity - - vf_sr(l) = sqrt(canyon_hwr(fl)**2 + 1._r8) - canyon_hwr(fl) - vf_wr(l) = 0.5_r8 * (1._r8 - vf_sr(l)) - - ! one wall -- sky view factor -> 0.5 as building height -> 0 - ! and -> 0 as building height -> infinity - - vf_sw(l) = 0.5_r8 * (canyon_hwr(fl) + 1._r8 - sqrt(canyon_hwr(fl)**2+1._r8)) / canyon_hwr(fl) - vf_rw(l) = vf_sw(l) - vf_ww(l) = 1._r8 - vf_sw(l) - vf_rw(l) - - end do - - - ! error check -- make sure view factor sums to one for road and wall - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - - sum = vf_sr(l) + 2._r8*vf_wr(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban road view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - sum = vf_sw(l) + vf_rw(l) + vf_ww(l) - if (abs(sum-1._r8) > 1.e-06_r8 ) then - write (iulog,*) 'urban wall view factor error',sum - write (iulog,*) 'clm model is stopping' - call endrun() - endif - - end do - - end subroutine view_factor - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: incident_direct -! -! !INTERFACE: - subroutine incident_direct (lbl, ubl, num_urbanl, canyon_hwr, coszen, zen, sdir, sdir_road, sdir_sunwall, sdir_shadewall) -! -! !DESCRIPTION: -! Direct beam solar radiation incident on walls and road in urban canyon -! -! Sun -! / -! roof / -! ------ /--- - -! | / | | -! sunlit wall | / | shaded wall h -! | / | | -! -----/----- - -! road -! <--- w ---> -! -! Method: -! Road = Horizontal surface. Account for shading by wall. Integrate over all canyon orientations -! Wall (sunlit) = Adjust horizontal radiation for 90 degree surface. Account for shading by opposing wall. -! Integrate over all canyon orientations -! Wall (shaded) = 0 -! -! Conservation check: Total incoming direct beam (sdir) = sdir_road + (sdir_shadewall + sdir_sunwall)*canyon_hwr -! Multiplication by canyon_hwr scales wall fluxes (per unit wall area) to per unit ground area -! -! Source: Masson, V. (2000) A physically-based scheme for the urban energy budget in -! atmospheric models. Boundary-Layer Meteorology 94:357-397 -! -! This analytical solution from Masson (2000) agrees with the numerical solution to -! within 0.6 W/m**2 for sdir = 1000 W/m**2 and for all H/W from 0.1 to 10 by 0.1 -! and all solar zenith angles from 1 to 90 deg by 1 -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon , only : rpi - implicit none -! -! !ARGUMENTS: - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - real(r8), intent(in) :: canyon_hwr(num_urbanl) ! ratio of building height to street width - real(r8), intent(in) :: coszen(num_urbanl) ! cosine solar zenith angle - real(r8), intent(in) :: zen(num_urbanl) ! solar zenith angle (radians) - real(r8), intent(in) :: sdir(num_urbanl, numrad) ! direct beam solar radiation incident on horizontal surface - real(r8), intent(out) :: sdir_road(num_urbanl, numrad) ! direct beam solar radiation incident on road per unit incident flux - real(r8), intent(out) :: sdir_sunwall(num_urbanl, numrad) ! direct beam solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8), intent(out) :: sdir_shadewall(num_urbanl, numrad) ! direct beam solar radiation (per unit wall area) incident on shaded wall per unit incident flux -! -! !CALLED FROM: -! subroutine UrbanAlbedo in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - integer :: l,i,ib ! indices -!KO logical :: numchk = .true. ! true => perform numerical check of analytical solution - logical :: numchk = .false. ! true => perform numerical check of analytical solution - real(r8) :: theta0(num_urbanl) ! critical canyon orientation for which road is no longer illuminated - real(r8) :: tanzen(num_urbanl) ! tan(zenith angle) - real(r8) :: swall_projected ! direct beam solar radiation (per unit ground area) incident on wall - real(r8) :: err1(num_urbanl) ! energy conservation error - real(r8) :: err2(num_urbanl) ! energy conservation error - real(r8) :: err3(num_urbanl) ! energy conservation error - real(r8) :: sumr ! sum of sroad for each orientation (0 <= theta <= pi/2) - real(r8) :: sumw ! sum of swall for each orientation (0 <= theta <= pi/2) - real(r8) :: num ! number of orientations - real(r8) :: theta ! canyon orientation relative to sun (0 <= theta <= pi/2) - real(r8) :: zen0 ! critical solar zenith angle for which sun begins to illuminate road -!----------------------------------------------------------------------- - - do l = 1,num_urbanl - if (coszen(l) > 0._r8) then - theta0(l) = asin(min( (1._r8/(canyon_hwr(l)*tan(max(zen(l),0.000001_r8)))), 1._r8 )) - tanzen(l) = tan(zen(l)) - end if - end do - - do ib = 1,numrad - - do l = 1,num_urbanl - if (coszen(l) > 0._r8) then - sdir_shadewall(l,ib) = 0._r8 - - ! incident solar radiation on wall and road integrated over all canyon orientations (0 <= theta <= pi/2) - - sdir_road(l,ib) = sdir(l,ib) * & - (2._r8*theta0(l)/rpi - 2./rpi*canyon_hwr(l)*tanzen(l)*(1._r8-cos(theta0(l)))) - sdir_sunwall(l,ib) = 2._r8 * sdir(l,ib) * ((1._r8/canyon_hwr(l))* & - (0.5_r8-theta0(l)/rpi) + (1._r8/rpi)*tanzen(l)*(1._r8-cos(theta0(l)))) - - ! conservation check for road and wall. need to use wall fluxes converted to ground area - - swall_projected = (sdir_shadewall(l,ib) + sdir_sunwall(l,ib)) * canyon_hwr(l) - err1(l) = sdir(l,ib) - (sdir_road(l,ib) + swall_projected) - else - sdir_road(l,ib) = 0._r8 - sdir_sunwall(l,ib) = 0._r8 - sdir_shadewall(l,ib) = 0._r8 - endif - end do - - do l = 1,num_urbanl - if (coszen(l) > 0._r8) then - if (abs(err1(l)) > 0.001_r8) then - write (iulog,*) 'urban direct beam solar radiation balance error',err1(l) - write (iulog,*) 'clm model is stopping' - call endrun() - endif - endif - end do - - ! numerical check of analytical solution - ! sum sroad and swall over all canyon orientations (0 <= theta <= pi/2) - - if (numchk) then - do l = 1,num_urbanl - if (coszen(l) > 0._r8) then - sumr = 0._r8 - sumw = 0._r8 - num = 0._r8 - do i = 1, 9000 - theta = i/100._r8 * rpi/180._r8 - zen0 = atan(1._r8/(canyon_hwr(l)*sin(theta))) - if (zen(l) >= zen0) then - sumr = sumr + 0._r8 - sumw = sumw + sdir(l,ib) / canyon_hwr(l) - else - sumr = sumr + sdir(l,ib) * (1._r8-canyon_hwr(l)*sin(theta)*tanzen(l)) - sumw = sumw + sdir(l,ib) * sin(theta)*tanzen(l) - end if - num = num + 1._r8 - end do - err2(l) = sumr/num - sdir_road(l,ib) - err3(l) = sumw/num - sdir_sunwall(l,ib) - endif - end do - do l = 1,num_urbanl - if (coszen(l) > 0._r8) then - if (abs(err2(l)) > 0.0006_r8 ) then - write (iulog,*) 'urban road incident direct beam solar radiation error',err2(l) - write (iulog,*) 'clm model is stopping' - call endrun - endif - if (abs(err3(l)) > 0.0006_r8 ) then - write (iulog,*) 'urban wall incident direct beam solar radiation error',err3(l) - write (iulog,*) 'clm model is stopping' - call endrun - end if - end if - end do - end if - - end do - - end subroutine incident_direct - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: incident_diffuse -! -! !INTERFACE: - subroutine incident_diffuse (lbl, ubl, num_urbanl, filter_urbanl, canyon_hwr, sdif, sdif_road, sdif_sunwall, sdif_shadewall) -! -! !DESCRIPTION: -! Diffuse solar radiation incident on walls and road in urban canyon -! Conservation check: Total incoming diffuse -! (sdif) = sdif_road + (sdif_shadewall + sdif_sunwall)*canyon_hwr -! Multiplication by canyon_hwr scales wall fluxes (per unit wall area) to per unit ground area -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype -! -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - real(r8), intent(in) :: canyon_hwr(num_urbanl) ! ratio of building height to street width - real(r8), intent(in) :: sdif(num_urbanl, numrad) ! diffuse solar radiation incident on horizontal surface - real(r8), intent(out) :: sdif_road(num_urbanl, numrad) ! diffuse solar radiation incident on road - real(r8), intent(out) :: sdif_sunwall(num_urbanl, numrad) ! diffuse solar radiation (per unit wall area) incident on sunlit wall - real(r8), intent(out) :: sdif_shadewall(num_urbanl, numrad) ! diffuse solar radiation (per unit wall area) incident on shaded wall -! -! local pointers to original implicit in arguments (clmtype) -! - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall -! -! !CALLED FROM: -! subroutine UrbanAlbedo in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - integer :: l, fl, ib ! indices - real(r8) :: err(num_urbanl) ! energy conservation error (W/m**2) - real(r8) :: swall_projected ! diffuse solar radiation (per unit ground area) incident on wall (W/m**2) -!----------------------------------------------------------------------- - - ! Assign landunit level pointer - - vf_sr => lps%vf_sr - vf_sw => lps%vf_sw - - do ib = 1, numrad - - ! diffuse solar and conservation check. need to convert wall fluxes to ground area - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - sdif_road(fl,ib) = sdif(fl,ib) * vf_sr(l) - sdif_sunwall(fl,ib) = sdif(fl,ib) * vf_sw(l) - sdif_shadewall(fl,ib) = sdif(fl,ib) * vf_sw(l) - - swall_projected = (sdif_shadewall(fl,ib) + sdif_sunwall(fl,ib)) * canyon_hwr(fl) - err(fl) = sdif(fl,ib) - (sdif_road(fl,ib) + swall_projected) - end do - - ! error check - - do l = 1, num_urbanl - if (abs(err(l)) > 0.001_r8) then - write (iulog,*) 'urban diffuse solar radiation balance error',err(l) - write (iulog,*) 'clm model is stopping' - call endrun - endif - end do - - end do - - end subroutine incident_diffuse - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: net_solar -! -! !INTERFACE: - subroutine net_solar (lbl, ubl, num_urbanl, filter_urbanl, coszen, canyon_hwr, wtroad_perv, sdir, sdif, & - alb_improad_dir, alb_perroad_dir, alb_wall_dir, alb_roof_dir, & - alb_improad_dif, alb_perroad_dif, alb_wall_dif, alb_roof_dif, & - sdir_road, sdir_sunwall, sdir_shadewall, & - sdif_road, sdif_sunwall, sdif_shadewall, & - sref_improad_dir, sref_perroad_dir, sref_sunwall_dir, sref_shadewall_dir, sref_roof_dir, & - sref_improad_dif, sref_perroad_dif, sref_sunwall_dif, sref_shadewall_dif, sref_roof_dif) -! -! !DESCRIPTION: -! Solar radiation absorbed by road and both walls in urban canyon allowing -! for multiple reflection. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype -! -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: num_urbanl ! number of urban landunits - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - real(r8), intent(in) :: coszen(num_urbanl) ! cosine solar zenith angle - real(r8), intent(in) :: canyon_hwr(num_urbanl) ! ratio of building height to street width - real(r8), intent(in) :: wtroad_perv(num_urbanl) ! weight of pervious road wrt total road - real(r8), intent(in) :: sdir(num_urbanl, numrad) ! direct beam solar radiation incident on horizontal surface - real(r8), intent(in) :: sdif(num_urbanl, numrad) ! diffuse solar radiation on horizontal surface - real(r8), intent(in) :: alb_improad_dir(num_urbanl, numrad) ! direct impervious road albedo - real(r8), intent(in) :: alb_perroad_dir(num_urbanl, numrad) ! direct pervious road albedo - real(r8), intent(in) :: alb_wall_dir(num_urbanl, numrad) ! direct wall albedo - real(r8), intent(in) :: alb_roof_dir(num_urbanl, numrad) ! direct roof albedo - real(r8), intent(in) :: alb_improad_dif(num_urbanl, numrad) ! diffuse impervious road albedo - real(r8), intent(in) :: alb_perroad_dif(num_urbanl, numrad) ! diffuse pervious road albedo - real(r8), intent(in) :: alb_wall_dif(num_urbanl, numrad) ! diffuse wall albedo - real(r8), intent(in) :: alb_roof_dif(num_urbanl, numrad) ! diffuse roof albedo - real(r8), intent(in) :: sdir_road(num_urbanl, numrad) ! direct beam solar radiation incident on road per unit incident flux - real(r8), intent(in) :: sdir_sunwall(num_urbanl, numrad) ! direct beam solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8), intent(in) :: sdir_shadewall(num_urbanl, numrad) ! direct beam solar radiation (per unit wall area) incident on shaded wall per unit incident flux - real(r8), intent(in) :: sdif_road(num_urbanl, numrad) ! diffuse solar radiation incident on road per unit incident flux - real(r8), intent(in) :: sdif_sunwall(num_urbanl, numrad) ! diffuse solar radiation (per unit wall area) incident on sunlit wall per unit incident flux - real(r8), intent(in) :: sdif_shadewall(num_urbanl, numrad) ! diffuse solar radiation (per unit wall area) incident on shaded wall per unit incident flux - real(r8), intent(inout) :: sref_improad_dir(num_urbanl, numrad) ! direct solar rad reflected by impervious road (per unit ground area) per unit incident flux - real(r8), intent(inout) :: sref_perroad_dir(num_urbanl, numrad) ! direct solar rad reflected by pervious road (per unit ground area) per unit incident flux - real(r8), intent(inout) :: sref_improad_dif(num_urbanl, numrad) ! diffuse solar rad reflected by impervious road (per unit ground area) per unit incident flux - real(r8), intent(inout) :: sref_perroad_dif(num_urbanl, numrad) ! diffuse solar rad reflected by pervious road (per unit ground area) per unit incident flux - real(r8), intent(inout) :: sref_sunwall_dir(num_urbanl, numrad) ! direct solar rad reflected by sunwall (per unit wall area) per unit incident flux - real(r8), intent(inout) :: sref_sunwall_dif(num_urbanl, numrad) ! diffuse solar rad reflected by sunwall (per unit wall area) per unit incident flux - real(r8), intent(inout) :: sref_shadewall_dir(num_urbanl, numrad) ! direct solar rad reflected by shadewall (per unit wall area) per unit incident flux - real(r8), intent(inout) :: sref_shadewall_dif(num_urbanl, numrad) ! diffuse solar rad reflected by shadewall (per unit wall area) per unit incident flux - real(r8), intent(inout) :: sref_roof_dir(num_urbanl, numrad) ! direct solar rad reflected by roof (per unit ground area) per unit incident flux - real(r8), intent(inout) :: sref_roof_dif(num_urbanl, numrad) ! diffuse solar rad reflected by roof (per unit ground area) per unit incident flux -! -! local pointers to original implicit in arguments (clmtype) -! - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_wr(:) ! view factor of one wall for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall - real(r8), pointer :: vf_rw(:) ! view factor of road for one wall - real(r8), pointer :: vf_ww(:) ! view factor of opposing wall for one wall - real(r8), pointer :: sabs_roof_dir(:,:) ! direct solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_roof_dif(:,:) ! diffuse solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_sunwall_dir(:,:) ! direct solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_sunwall_dif(:,:) ! diffuse solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dir(:,:) ! direct solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dif(:,:) ! diffuse solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_improad_dir(:,:) ! direct solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_improad_dif(:,:) ! diffuse solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dir(:,:) ! direct solar absorbed by pervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dif(:,:) ! diffuse solar absorbed by pervious road per unit ground area per unit incident flux -! -! !CALLED FROM: -! subroutine UrbanAlbedo in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! -! -! !LOCAL VARIABLES -!EOP -! - real(r8) :: wtroad_imperv(num_urbanl) ! weight of impervious road wrt total road - real(r8) :: sabs_canyon_dir(num_urbanl) ! direct solar rad absorbed by canyon per unit incident flux - real(r8) :: sabs_canyon_dif(num_urbanl) ! diffuse solar rad absorbed by canyon per unit incident flux - real(r8) :: sref_canyon_dir(num_urbanl) ! direct solar reflected by canyon per unit incident flux - real(r8) :: sref_canyon_dif(num_urbanl) ! diffuse solar reflected by canyon per unit incident flux - - real(r8) :: improad_a_dir(num_urbanl) ! absorbed direct solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_a_dif(num_urbanl) ! absorbed diffuse solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_r_dir(num_urbanl) ! reflected direct solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_r_dif(num_urbanl) ! reflected diffuse solar for impervious road after "n" reflections per unit incident flux - real(r8) :: improad_r_sky_dir(num_urbanl) ! improad_r_dir to sky per unit incident flux - real(r8) :: improad_r_sunwall_dir(num_urbanl) ! improad_r_dir to sunlit wall per unit incident flux - real(r8) :: improad_r_shadewall_dir(num_urbanl) ! improad_r_dir to shaded wall per unit incident flux - real(r8) :: improad_r_sky_dif(num_urbanl) ! improad_r_dif to sky per unit incident flux - real(r8) :: improad_r_sunwall_dif(num_urbanl) ! improad_r_dif to sunlit wall per unit incident flux - real(r8) :: improad_r_shadewall_dif(num_urbanl) ! improad_r_dif to shaded wall per unit incident flux - - real(r8) :: perroad_a_dir(num_urbanl) ! absorbed direct solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_a_dif(num_urbanl) ! absorbed diffuse solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_r_dir(num_urbanl) ! reflected direct solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_r_dif(num_urbanl) ! reflected diffuse solar for pervious road after "n" reflections per unit incident flux - real(r8) :: perroad_r_sky_dir(num_urbanl) ! perroad_r_dir to sky per unit incident flux - real(r8) :: perroad_r_sunwall_dir(num_urbanl) ! perroad_r_dir to sunlit wall per unit incident flux - real(r8) :: perroad_r_shadewall_dir(num_urbanl) ! perroad_r_dir to shaded wall per unit incident flux - real(r8) :: perroad_r_sky_dif(num_urbanl) ! perroad_r_dif to sky per unit incident flux - real(r8) :: perroad_r_sunwall_dif(num_urbanl) ! perroad_r_dif to sunlit wall per unit incident flux - real(r8) :: perroad_r_shadewall_dif(num_urbanl) ! perroad_r_dif to shaded wall per unit incident flux - - real(r8) :: road_a_dir(num_urbanl) ! absorbed direct solar for total road after "n" reflections per unit incident flux - real(r8) :: road_a_dif(num_urbanl) ! absorbed diffuse solar for total road after "n" reflections per unit incident flux - real(r8) :: road_r_dir(num_urbanl) ! reflected direct solar for total road after "n" reflections per unit incident flux - real(r8) :: road_r_dif(num_urbanl) ! reflected diffuse solar for total road after "n" reflections per unit incident flux - real(r8) :: road_r_sky_dir(num_urbanl) ! road_r_dir to sky per unit incident flux - real(r8) :: road_r_sunwall_dir(num_urbanl) ! road_r_dir to sunlit wall per unit incident flux - real(r8) :: road_r_shadewall_dir(num_urbanl) ! road_r_dir to shaded wall per unit incident flux - real(r8) :: road_r_sky_dif(num_urbanl) ! road_r_dif to sky per unit incident flux - real(r8) :: road_r_sunwall_dif(num_urbanl) ! road_r_dif to sunlit wall per unit incident flux - real(r8) :: road_r_shadewall_dif(num_urbanl) ! road_r_dif to shaded wall per unit incident flux - - real(r8) :: sunwall_a_dir(num_urbanl) ! absorbed direct solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_a_dif(num_urbanl) ! absorbed diffuse solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_r_dir(num_urbanl) ! reflected direct solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_r_dif(num_urbanl) ! reflected diffuse solar for sunlit wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: sunwall_r_sky_dir(num_urbanl) ! sunwall_r_dir to sky per unit incident flux - real(r8) :: sunwall_r_road_dir(num_urbanl) ! sunwall_r_dir to road per unit incident flux - real(r8) :: sunwall_r_shadewall_dir(num_urbanl) ! sunwall_r_dir to opposing (shaded) wall per unit incident flux - real(r8) :: sunwall_r_sky_dif(num_urbanl) ! sunwall_r_dif to sky per unit incident flux - real(r8) :: sunwall_r_road_dif(num_urbanl) ! sunwall_r_dif to road per unit incident flux - real(r8) :: sunwall_r_shadewall_dif(num_urbanl) ! sunwall_r_dif to opposing (shaded) wall per unit incident flux - - real(r8) :: shadewall_a_dir(num_urbanl) ! absorbed direct solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_a_dif(num_urbanl) ! absorbed diffuse solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_r_dir(num_urbanl) ! reflected direct solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_r_dif(num_urbanl) ! reflected diffuse solar for shaded wall (per unit wall area) after "n" reflections per unit incident flux - real(r8) :: shadewall_r_sky_dir(num_urbanl) ! shadewall_r_dir to sky per unit incident flux - real(r8) :: shadewall_r_road_dir(num_urbanl) ! shadewall_r_dir to road per unit incident flux - real(r8) :: shadewall_r_sunwall_dir(num_urbanl) ! shadewall_r_dir to opposing (sunlit) wall per unit incident flux - real(r8) :: shadewall_r_sky_dif(num_urbanl) ! shadewall_r_dif to sky per unit incident flux - real(r8) :: shadewall_r_road_dif(num_urbanl) ! shadewall_r_dif to road per unit incident flux - real(r8) :: shadewall_r_sunwall_dif(num_urbanl) ! shadewall_r_dif to opposing (sunlit) wall per unit incident flux - - real(r8) :: canyon_alb_dir(num_urbanl) ! direct canyon albedo - real(r8) :: canyon_alb_dif(num_urbanl) ! diffuse canyon albedo - - real(r8) :: stot(num_urbanl) ! sum of radiative terms - real(r8) :: stot_dir(num_urbanl) ! sum of direct radiative terms - real(r8) :: stot_dif(num_urbanl) ! sum of diffuse radiative terms - - integer :: l,fl,ib ! indices - integer :: iter_dir,iter_dif ! iteration counter - real(r8) :: crit ! convergence criterion - real(r8) :: err ! energy conservation error - integer :: pass - integer, parameter :: n = 50 ! number of interations - real(r8) :: sabs_road ! temporary for absorption over road - real(r8) :: sref_road ! temporary for reflected over road - real(r8), parameter :: errcrit = .00001_r8 ! error criteria -!----------------------------------------------------------------------- - - ! Assign landunit level pointer - - vf_sr => lps%vf_sr - vf_wr => lps%vf_wr - vf_sw => lps%vf_sw - vf_rw => lps%vf_rw - vf_ww => lps%vf_ww - sabs_roof_dir => lps%sabs_roof_dir - sabs_roof_dif => lps%sabs_roof_dif - sabs_sunwall_dir => lps%sabs_sunwall_dir - sabs_sunwall_dif => lps%sabs_sunwall_dif - sabs_shadewall_dir => lps%sabs_shadewall_dir - sabs_shadewall_dif => lps%sabs_shadewall_dif - sabs_improad_dir => lps%sabs_improad_dir - sabs_improad_dif => lps%sabs_improad_dif - sabs_perroad_dir => lps%sabs_perroad_dir - sabs_perroad_dif => lps%sabs_perroad_dif - - ! Calculate impervious road - - do l = 1,num_urbanl - wtroad_imperv(l) = 1._r8 - wtroad_perv(l) - end do - - do ib = 1,numrad - do fl = 1,num_urbanl - if (coszen(fl) .gt. 0._r8) then - l = filter_urbanl(fl) - - ! initial absorption and reflection for road and both walls. - ! distribute reflected radiation to sky, road, and walls - ! according to appropriate view factor. radiation reflected to - ! road and walls will undergo multiple reflections within the canyon. - ! do separately for direct beam and diffuse radiation. - - ! direct beam - - road_a_dir(fl) = 0.0_r8 - road_r_dir(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_a_dir(fl) = (1._r8-alb_improad_dir(fl,ib)) * sdir_road(fl,ib) - improad_r_dir(fl) = alb_improad_dir(fl,ib) * sdir_road(fl,ib) - improad_r_sky_dir(fl) = improad_r_dir(fl) * vf_sr(l) - improad_r_sunwall_dir(fl) = improad_r_dir(fl) * vf_wr(l) - improad_r_shadewall_dir(fl) = improad_r_dir(fl) * vf_wr(l) - road_a_dir(fl) = road_a_dir(fl) + improad_a_dir(fl)*wtroad_imperv(fl) - road_r_dir(fl) = road_r_dir(fl) + improad_r_dir(fl)*wtroad_imperv(fl) - end if - - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_a_dir(fl) = (1._r8-alb_perroad_dir(fl,ib)) * sdir_road(fl,ib) - perroad_r_dir(fl) = alb_perroad_dir(fl,ib) * sdir_road(fl,ib) - perroad_r_sky_dir(fl) = perroad_r_dir(fl) * vf_sr(l) - perroad_r_sunwall_dir(fl) = perroad_r_dir(fl) * vf_wr(l) - perroad_r_shadewall_dir(fl) = perroad_r_dir(fl) * vf_wr(l) - road_a_dir(fl) = road_a_dir(fl) + perroad_a_dir(fl)*wtroad_perv(fl) - road_r_dir(fl) = road_r_dir(fl) + perroad_r_dir(fl)*wtroad_perv(fl) - end if - - road_r_sky_dir(fl) = road_r_dir(fl) * vf_sr(l) - road_r_sunwall_dir(fl) = road_r_dir(fl) * vf_wr(l) - road_r_shadewall_dir(fl) = road_r_dir(fl) * vf_wr(l) - - sunwall_a_dir(fl) = (1._r8-alb_wall_dir(fl,ib)) * sdir_sunwall(fl,ib) - sunwall_r_dir(fl) = alb_wall_dir(fl,ib) * sdir_sunwall(fl,ib) - sunwall_r_sky_dir(fl) = sunwall_r_dir(fl) * vf_sw(l) - sunwall_r_road_dir(fl) = sunwall_r_dir(fl) * vf_rw(l) - sunwall_r_shadewall_dir(fl) = sunwall_r_dir(fl) * vf_ww(l) - - shadewall_a_dir(fl) = (1._r8-alb_wall_dir(fl,ib)) * sdir_shadewall(fl,ib) - shadewall_r_dir(fl) = alb_wall_dir(fl,ib) * sdir_shadewall(fl,ib) - shadewall_r_sky_dir(fl) = shadewall_r_dir(fl) * vf_sw(l) - shadewall_r_road_dir(fl) = shadewall_r_dir(fl) * vf_rw(l) - shadewall_r_sunwall_dir(fl) = shadewall_r_dir(fl) * vf_ww(l) - - ! diffuse - - road_a_dif(fl) = 0.0_r8 - road_r_dif(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_a_dif(fl) = (1._r8-alb_improad_dif(fl,ib)) * sdif_road(fl,ib) - improad_r_dif(fl) = alb_improad_dif(fl,ib) * sdif_road(fl,ib) - improad_r_sky_dif(fl) = improad_r_dif(fl) * vf_sr(l) - improad_r_sunwall_dif(fl) = improad_r_dif(fl) * vf_wr(l) - improad_r_shadewall_dif(fl) = improad_r_dif(fl) * vf_wr(l) - road_a_dif(fl) = road_a_dif(fl) + improad_a_dif(fl)*wtroad_imperv(fl) - road_r_dif(fl) = road_r_dif(fl) + improad_r_dif(fl)*wtroad_imperv(fl) - end if - - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_a_dif(fl) = (1._r8-alb_perroad_dif(fl,ib)) * sdif_road(fl,ib) - perroad_r_dif(fl) = alb_perroad_dif(fl,ib) * sdif_road(fl,ib) - perroad_r_sky_dif(fl) = perroad_r_dif(fl) * vf_sr(l) - perroad_r_sunwall_dif(fl) = perroad_r_dif(fl) * vf_wr(l) - perroad_r_shadewall_dif(fl) = perroad_r_dif(fl) * vf_wr(l) - road_a_dif(fl) = road_a_dif(fl) + perroad_a_dif(fl)*wtroad_perv(fl) - road_r_dif(fl) = road_r_dif(fl) + perroad_r_dif(fl)*wtroad_perv(fl) - end if - - road_r_sky_dif(fl) = road_r_dif(fl) * vf_sr(l) - road_r_sunwall_dif(fl) = road_r_dif(fl) * vf_wr(l) - road_r_shadewall_dif(fl) = road_r_dif(fl) * vf_wr(l) - - sunwall_a_dif(fl) = (1._r8-alb_wall_dif(fl,ib)) * sdif_sunwall(fl,ib) - sunwall_r_dif(fl) = alb_wall_dif(fl,ib) * sdif_sunwall(fl,ib) - sunwall_r_sky_dif(fl) = sunwall_r_dif(fl) * vf_sw(l) - sunwall_r_road_dif(fl) = sunwall_r_dif(fl) * vf_rw(l) - sunwall_r_shadewall_dif(fl) = sunwall_r_dif(fl) * vf_ww(l) - - shadewall_a_dif(fl) = (1._r8-alb_wall_dif(fl,ib)) * sdif_shadewall(fl,ib) - shadewall_r_dif(fl) = alb_wall_dif(fl,ib) * sdif_shadewall(fl,ib) - shadewall_r_sky_dif(fl) = shadewall_r_dif(fl) * vf_sw(l) - shadewall_r_road_dif(fl) = shadewall_r_dif(fl) * vf_rw(l) - shadewall_r_sunwall_dif(fl) = shadewall_r_dif(fl) * vf_ww(l) - - ! initialize sum of direct and diffuse solar absorption and reflection for road and both walls - - if ( wtroad_imperv(fl) > 0.0_r8 ) sabs_improad_dir(l,ib) = improad_a_dir(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sabs_perroad_dir(l,ib) = perroad_a_dir(fl) - sabs_sunwall_dir(l,ib) = sunwall_a_dir(fl) - sabs_shadewall_dir(l,ib) = shadewall_a_dir(fl) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sabs_improad_dif(l,ib) = improad_a_dif(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sabs_perroad_dif(l,ib) = perroad_a_dif(fl) - sabs_sunwall_dif(l,ib) = sunwall_a_dif(fl) - sabs_shadewall_dif(l,ib) = shadewall_a_dif(fl) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sref_improad_dir(fl,ib) = improad_r_sky_dir(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sref_perroad_dir(fl,ib) = perroad_r_sky_dir(fl) - sref_sunwall_dir(fl,ib) = sunwall_r_sky_dir(fl) - sref_shadewall_dir(fl,ib) = shadewall_r_sky_dir(fl) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sref_improad_dif(fl,ib) = improad_r_sky_dif(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sref_perroad_dif(fl,ib) = perroad_r_sky_dif(fl) - sref_sunwall_dif(fl,ib) = sunwall_r_sky_dif(fl) - sref_shadewall_dif(fl,ib) = shadewall_r_sky_dif(fl) - endif - - end do - - ! absorption and reflection for walls and road with multiple reflections - ! (i.e., absorb and reflect initial reflection in canyon and allow for - ! subsequent scattering) - ! - ! (1) absorption and reflection of scattered solar radiation - ! road: reflected fluxes from walls need to be projected to ground area - ! wall: reflected flux from road needs to be projected to wall area - ! - ! (2) add absorbed radiation for ith reflection to total absorbed - ! - ! (3) distribute reflected radiation to sky, road, and walls according to view factors - ! - ! (4) add solar reflection to sky for ith reflection to total reflection - ! - ! (5) stop iteration when absorption for ith reflection is less than some nominal amount. - ! small convergence criteria is required to ensure solar radiation is conserved - ! - ! do separately for direct beam and diffuse - - do fl = 1,num_urbanl - if (coszen(fl) .gt. 0._r8) then - l = filter_urbanl(fl) - - ! reflected direct beam - - do iter_dir = 1, n - ! step (1) - - stot(fl) = (sunwall_r_road_dir(fl) + shadewall_r_road_dir(fl))*canyon_hwr(fl) - - road_a_dir(fl) = 0.0_r8 - road_r_dir(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_a_dir(fl) = (1._r8-alb_improad_dir(fl,ib)) * stot(fl) - improad_r_dir(fl) = alb_improad_dir(fl,ib) * stot(fl) - road_a_dir(fl) = road_a_dir(fl) + improad_a_dir(fl)*wtroad_imperv(fl) - road_r_dir(fl) = road_r_dir(fl) + improad_r_dir(fl)*wtroad_imperv(fl) - end if - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_a_dir(fl) = (1._r8-alb_perroad_dir(fl,ib)) * stot(fl) - perroad_r_dir(fl) = alb_perroad_dir(fl,ib) * stot(fl) - road_a_dir(fl) = road_a_dir(fl) + perroad_a_dir(fl)*wtroad_perv(fl) - road_r_dir(fl) = road_r_dir(fl) + perroad_r_dir(fl)*wtroad_perv(fl) - end if - - stot(fl) = road_r_sunwall_dir(fl)/canyon_hwr(fl) + shadewall_r_sunwall_dir(fl) - sunwall_a_dir(fl) = (1._r8-alb_wall_dir(fl,ib)) * stot(fl) - sunwall_r_dir(fl) = alb_wall_dir(fl,ib) * stot(fl) - - stot(fl) = road_r_shadewall_dir(fl)/canyon_hwr(fl) + sunwall_r_shadewall_dir(fl) - shadewall_a_dir(fl) = (1._r8-alb_wall_dir(fl,ib)) * stot(fl) - shadewall_r_dir(fl) = alb_wall_dir(fl,ib) * stot(fl) - - ! step (2) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sabs_improad_dir(l,ib) = sabs_improad_dir(l,ib) + improad_a_dir(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sabs_perroad_dir(l,ib) = sabs_perroad_dir(l,ib) + perroad_a_dir(fl) - sabs_sunwall_dir(l,ib) = sabs_sunwall_dir(l,ib) + sunwall_a_dir(fl) - sabs_shadewall_dir(l,ib) = sabs_shadewall_dir(l,ib) + shadewall_a_dir(fl) - - ! step (3) - - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_r_sky_dir(fl) = improad_r_dir(fl) * vf_sr(l) - improad_r_sunwall_dir(fl) = improad_r_dir(fl) * vf_wr(l) - improad_r_shadewall_dir(fl) = improad_r_dir(fl) * vf_wr(l) - end if - - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_r_sky_dir(fl) = perroad_r_dir(fl) * vf_sr(l) - perroad_r_sunwall_dir(fl) = perroad_r_dir(fl) * vf_wr(l) - perroad_r_shadewall_dir(fl) = perroad_r_dir(fl) * vf_wr(l) - end if - - road_r_sky_dir(fl) = road_r_dir(fl) * vf_sr(l) - road_r_sunwall_dir(fl) = road_r_dir(fl) * vf_wr(l) - road_r_shadewall_dir(fl) = road_r_dir(fl) * vf_wr(l) - - sunwall_r_sky_dir(fl) = sunwall_r_dir(fl) * vf_sw(l) - sunwall_r_road_dir(fl) = sunwall_r_dir(fl) * vf_rw(l) - sunwall_r_shadewall_dir(fl) = sunwall_r_dir(fl) * vf_ww(l) - - shadewall_r_sky_dir(fl) = shadewall_r_dir(fl) * vf_sw(l) - shadewall_r_road_dir(fl) = shadewall_r_dir(fl) * vf_rw(l) - shadewall_r_sunwall_dir(fl) = shadewall_r_dir(fl) * vf_ww(l) - - ! step (4) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sref_improad_dir(fl,ib) = sref_improad_dir(fl,ib) + improad_r_sky_dir(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sref_perroad_dir(fl,ib) = sref_perroad_dir(fl,ib) + perroad_r_sky_dir(fl) - sref_sunwall_dir(fl,ib) = sref_sunwall_dir(fl,ib) + sunwall_r_sky_dir(fl) - sref_shadewall_dir(fl,ib) = sref_shadewall_dir(fl,ib) + shadewall_r_sky_dir(fl) - - ! step (5) - - crit = max(road_a_dir(fl), sunwall_a_dir(fl), shadewall_a_dir(fl)) - if (crit < errcrit) exit - end do - if (iter_dir >= n) then - write (iulog,*) 'urban net solar radiation error: no convergence, direct beam' - write (iulog,*) 'clm model is stopping' - call endrun - endif - - ! reflected diffuse - - do iter_dif = 1, n - ! step (1) - - stot(fl) = (sunwall_r_road_dif(fl) + shadewall_r_road_dif(fl))*canyon_hwr(fl) - road_a_dif(fl) = 0.0_r8 - road_r_dif(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_a_dif(fl) = (1._r8-alb_improad_dif(fl,ib)) * stot(fl) - improad_r_dif(fl) = alb_improad_dif(fl,ib) * stot(fl) - road_a_dif(fl) = road_a_dif(fl) + improad_a_dif(fl)*wtroad_imperv(fl) - road_r_dif(fl) = road_r_dif(fl) + improad_r_dif(fl)*wtroad_imperv(fl) - end if - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_a_dif(fl) = (1._r8-alb_perroad_dif(fl,ib)) * stot(fl) - perroad_r_dif(fl) = alb_perroad_dif(fl,ib) * stot(fl) - road_a_dif(fl) = road_a_dif(fl) + perroad_a_dif(fl)*wtroad_perv(fl) - road_r_dif(fl) = road_r_dif(fl) + perroad_r_dif(fl)*wtroad_perv(fl) - end if - - stot(fl) = road_r_sunwall_dif(fl)/canyon_hwr(fl) + shadewall_r_sunwall_dif(fl) - sunwall_a_dif(fl) = (1._r8-alb_wall_dif(fl,ib)) * stot(fl) - sunwall_r_dif(fl) = alb_wall_dif(fl,ib) * stot(fl) - - stot(fl) = road_r_shadewall_dif(fl)/canyon_hwr(fl) + sunwall_r_shadewall_dif(fl) - shadewall_a_dif(fl) = (1._r8-alb_wall_dif(fl,ib)) * stot(fl) - shadewall_r_dif(fl) = alb_wall_dif(fl,ib) * stot(fl) - - ! step (2) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sabs_improad_dif(l,ib) = sabs_improad_dif(l,ib) + improad_a_dif(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sabs_perroad_dif(l,ib) = sabs_perroad_dif(l,ib) + perroad_a_dif(fl) - sabs_sunwall_dif(l,ib) = sabs_sunwall_dif(l,ib) + sunwall_a_dif(fl) - sabs_shadewall_dif(l,ib) = sabs_shadewall_dif(l,ib) + shadewall_a_dif(fl) - - ! step (3) - - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_r_sky_dif(fl) = improad_r_dif(fl) * vf_sr(l) - improad_r_sunwall_dif(fl) = improad_r_dif(fl) * vf_wr(l) - improad_r_shadewall_dif(fl) = improad_r_dif(fl) * vf_wr(l) - end if - - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_r_sky_dif(fl) = perroad_r_dif(fl) * vf_sr(l) - perroad_r_sunwall_dif(fl) = perroad_r_dif(fl) * vf_wr(l) - perroad_r_shadewall_dif(fl) = perroad_r_dif(fl) * vf_wr(l) - end if - - road_r_sky_dif(fl) = road_r_dif(fl) * vf_sr(l) - road_r_sunwall_dif(fl) = road_r_dif(fl) * vf_wr(l) - road_r_shadewall_dif(fl) = road_r_dif(fl) * vf_wr(l) - - sunwall_r_sky_dif(fl) = sunwall_r_dif(fl) * vf_sw(l) - sunwall_r_road_dif(fl) = sunwall_r_dif(fl) * vf_rw(l) - sunwall_r_shadewall_dif(fl) = sunwall_r_dif(fl) * vf_ww(l) - - shadewall_r_sky_dif(fl) = shadewall_r_dif(fl) * vf_sw(l) - shadewall_r_road_dif(fl) = shadewall_r_dif(fl) * vf_rw(l) - shadewall_r_sunwall_dif(fl) = shadewall_r_dif(fl) * vf_ww(l) - - ! step (4) - - if ( wtroad_imperv(fl) > 0.0_r8 ) sref_improad_dif(fl,ib) = sref_improad_dif(fl,ib) + improad_r_sky_dif(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) sref_perroad_dif(fl,ib) = sref_perroad_dif(fl,ib) + perroad_r_sky_dif(fl) - sref_sunwall_dif(fl,ib) = sref_sunwall_dif(fl,ib) + sunwall_r_sky_dif(fl) - sref_shadewall_dif(fl,ib) = sref_shadewall_dif(fl,ib) + shadewall_r_sky_dif(fl) - - ! step (5) - - crit = max(road_a_dif(fl), sunwall_a_dif(fl), shadewall_a_dif(fl)) - if (crit < errcrit) exit - end do - if (iter_dif >= n) then - write (iulog,*) 'urban net solar radiation error: no convergence, diffuse' - write (iulog,*) 'clm model is stopping' - call endrun() - endif - - ! total reflected by canyon - sum of solar reflection to sky from canyon. - ! project wall fluxes to horizontal surface - - sref_canyon_dir(fl) = 0.0_r8 - sref_canyon_dif(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - sref_canyon_dir(fl) = sref_canyon_dir(fl) + sref_improad_dir(fl,ib)*wtroad_imperv(fl) - sref_canyon_dif(fl) = sref_canyon_dif(fl) + sref_improad_dif(fl,ib)*wtroad_imperv(fl) - end if - if ( wtroad_perv(fl) > 0.0_r8 ) then - sref_canyon_dir(fl) = sref_canyon_dir(fl) + sref_perroad_dir(fl,ib)*wtroad_perv(fl) - sref_canyon_dif(fl) = sref_canyon_dif(fl) + sref_perroad_dif(fl,ib)*wtroad_perv(fl) - end if - sref_canyon_dir(fl) = sref_canyon_dir(fl) + (sref_sunwall_dir(fl,ib) + sref_shadewall_dir(fl,ib))*canyon_hwr(fl) - sref_canyon_dif(fl) = sref_canyon_dif(fl) + (sref_sunwall_dif(fl,ib) + sref_shadewall_dif(fl,ib))*canyon_hwr(fl) - - ! total absorbed by canyon. project wall fluxes to horizontal surface - - sabs_canyon_dir(fl) = 0.0_r8 - sabs_canyon_dif(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - sabs_canyon_dir(fl) = sabs_canyon_dir(fl) + sabs_improad_dir(l,ib)*wtroad_imperv(fl) - sabs_canyon_dif(fl) = sabs_canyon_dif(fl) + sabs_improad_dif(l,ib)*wtroad_imperv(fl) - end if - if ( wtroad_perv(fl) > 0.0_r8 ) then - sabs_canyon_dir(fl) = sabs_canyon_dir(fl) + sabs_perroad_dir(l,ib)*wtroad_perv(fl) - sabs_canyon_dif(fl) = sabs_canyon_dif(fl) + sabs_perroad_dif(l,ib)*wtroad_perv(fl) - end if - sabs_canyon_dir(fl) = sabs_canyon_dir(fl) + (sabs_sunwall_dir(l,ib) + sabs_shadewall_dir(l,ib))*canyon_hwr(fl) - sabs_canyon_dif(fl) = sabs_canyon_dif(fl) + (sabs_sunwall_dif(l,ib) + sabs_shadewall_dif(l,ib))*canyon_hwr(fl) - - ! conservation check. note: previous conservation checks confirm partioning of total direct - ! beam and diffuse radiation from atmosphere to road and walls is conserved as - ! sdir (from atmosphere) = sdir_road + (sdir_sunwall + sdir_shadewall)*canyon_hwr - ! sdif (from atmosphere) = sdif_road + (sdif_sunwall + sdif_shadewall)*canyon_hwr - - stot_dir(fl) = sdir_road(fl,ib) + (sdir_sunwall(fl,ib) + sdir_shadewall(fl,ib))*canyon_hwr(fl) - stot_dif(fl) = sdif_road(fl,ib) + (sdif_sunwall(fl,ib) + sdif_shadewall(fl,ib))*canyon_hwr(fl) - - err = stot_dir(fl) + stot_dif(fl) & - - (sabs_canyon_dir(fl) + sabs_canyon_dif(fl) + sref_canyon_dir(fl) + sref_canyon_dif(fl)) - if (abs(err) > 0.001_r8 ) then - write(iulog,*)'urban net solar radiation balance error for ib=',ib,' err= ',err - write(iulog,*)' l= ',l,' ib= ',ib - write(iulog,*)' stot_dir = ',stot_dir(fl) - write(iulog,*)' stot_dif = ',stot_dif(fl) - write(iulog,*)' sabs_canyon_dir = ',sabs_canyon_dir(fl) - write(iulog,*)' sabs_canyon_dif = ',sabs_canyon_dif(fl) - write(iulog,*)' sref_canyon_dir = ',sref_canyon_dir(fl) - write(iulog,*)' sref_canyon_dif = ',sref_canyon_dir(fl) - write(iulog,*) 'clm model is stopping' - call endrun() - endif - - ! canyon albedo - - canyon_alb_dif(fl) = sref_canyon_dif(fl) / max(stot_dif(fl), 1.e-06_r8) - canyon_alb_dir(fl) = sref_canyon_dir(fl) / max(stot_dir(fl), 1.e-06_r8) - end if - - end do ! end of landunit loop - - ! Refected and absorbed solar radiation per unit incident radiation for roof - - do fl = 1,num_urbanl - if (coszen(fl) .gt. 0._r8) then - l = filter_urbanl(fl) - sref_roof_dir(fl,ib) = alb_roof_dir(fl,ib) * sdir(fl,ib) - sref_roof_dif(fl,ib) = alb_roof_dif(fl,ib) * sdif(fl,ib) - sabs_roof_dir(l,ib) = sdir(fl,ib) - sref_roof_dir(fl,ib) - sabs_roof_dif(l,ib) = sdif(fl,ib) - sref_roof_dif(fl,ib) - end if - end do - - end do ! end of radiation band loop - - end subroutine net_solar - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: net_longwave -! -! !INTERFACE: - subroutine net_longwave (lbl, ubl, num_urbanl, filter_urbanl, canyon_hwr, wtroad_perv, & - lwdown, em_roof, em_improad, em_perroad, em_wall, & - t_roof, t_improad, t_perroad, t_sunwall, t_shadewall, & - lwnet_roof, lwnet_improad, lwnet_perroad, lwnet_sunwall, lwnet_shadewall, lwnet_canyon, & - lwup_roof, lwup_improad, lwup_perroad, lwup_sunwall, lwup_shadewall, lwup_canyon) -! -! !DESCRIPTION: -! Net longwave radiation for road and both walls in urban canyon allowing for -! multiple reflection. Also net longwave radiation for urban roof. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varcon , only : sb - use clmtype -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: num_urbanl ! number of urban landunits - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - real(r8), intent(in) :: canyon_hwr(num_urbanl) ! ratio of building height to street width - real(r8), intent(in) :: wtroad_perv(num_urbanl) ! weight of pervious road wrt total road - - real(r8), intent(in) :: lwdown(num_urbanl) ! atmospheric longwave radiation (W/m**2) - real(r8), intent(in) :: em_roof(num_urbanl) ! roof emissivity - real(r8), intent(in) :: em_improad(num_urbanl) ! impervious road emissivity - real(r8), intent(in) :: em_perroad(num_urbanl) ! pervious road emissivity - real(r8), intent(in) :: em_wall(num_urbanl) ! wall emissivity - - real(r8), intent(in) :: t_roof(num_urbanl) ! roof temperature (K) - real(r8), intent(in) :: t_improad(num_urbanl) ! impervious road temperature (K) - real(r8), intent(in) :: t_perroad(num_urbanl) ! ervious road temperature (K) - real(r8), intent(in) :: t_sunwall(num_urbanl) ! sunlit wall temperature (K) - real(r8), intent(in) :: t_shadewall(num_urbanl) ! shaded wall temperature (K) - - real(r8), intent(out) :: lwnet_roof(num_urbanl) ! net (outgoing-incoming) longwave radiation, roof (W/m**2) - real(r8), intent(out) :: lwnet_improad(num_urbanl) ! net (outgoing-incoming) longwave radiation, impervious road (W/m**2) - real(r8), intent(out) :: lwnet_perroad(num_urbanl) ! net (outgoing-incoming) longwave radiation, pervious road (W/m**2) - real(r8), intent(out) :: lwnet_sunwall(num_urbanl) ! net (outgoing-incoming) longwave radiation (per unit wall area), sunlit wall (W/m**2) - real(r8), intent(out) :: lwnet_shadewall(num_urbanl) ! net (outgoing-incoming) longwave radiation (per unit wall area), shaded wall (W/m**2) - real(r8), intent(out) :: lwnet_canyon(num_urbanl) ! net (outgoing-incoming) longwave radiation for canyon, per unit ground area (W/m**2) - - real(r8), intent(out) :: lwup_roof(num_urbanl) ! upward longwave radiation, roof (W/m**2) - real(r8), intent(out) :: lwup_improad(num_urbanl) ! upward longwave radiation, impervious road (W/m**2) - real(r8), intent(out) :: lwup_perroad(num_urbanl) ! upward longwave radiation, pervious road (W/m**2) - real(r8), intent(out) :: lwup_sunwall(num_urbanl) ! upward longwave radiation (per unit wall area), sunlit wall (W/m**2) - real(r8), intent(out) :: lwup_shadewall(num_urbanl) ! upward longwave radiation (per unit wall area), shaded wall (W/m**2) - real(r8), intent(out) :: lwup_canyon(num_urbanl) ! upward longwave radiation for canyon, per unit ground area (W/m**2) -! -! local pointers to original implicit in arguments (clmtype) -! - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_wr(:) ! view factor of one wall for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall - real(r8), pointer :: vf_rw(:) ! view factor of road for one wall - real(r8), pointer :: vf_ww(:) ! view factor of opposing wall for one wall -! -! !CALLED FROM: -! subroutine UrbanRadiation in this module -! -! !REVISION HISTORY: -! Author: Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - real(r8) :: lwdown_road(num_urbanl) ! atmospheric longwave radiation for total road (W/m**2) - real(r8) :: lwdown_sunwall(num_urbanl) ! atmospheric longwave radiation (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: lwdown_shadewall(num_urbanl) ! atmospheric longwave radiation (per unit wall area) for shaded wall (W/m**2) - real(r8) :: lwtot(num_urbanl) ! incoming longwave radiation (W/m**2) - - real(r8) :: improad_a(num_urbanl) ! absorbed longwave for improad (W/m**2) - real(r8) :: improad_r(num_urbanl) ! reflected longwave for improad (W/m**2) - real(r8) :: improad_r_sky(num_urbanl) ! improad_r to sky (W/m**2) - real(r8) :: improad_r_sunwall(num_urbanl) ! improad_r to sunlit wall (W/m**2) - real(r8) :: improad_r_shadewall(num_urbanl) ! improad_r to shaded wall (W/m**2) - real(r8) :: improad_e(num_urbanl) ! emitted longwave for improad (W/m**2) - real(r8) :: improad_e_sky(num_urbanl) ! improad_e to sky (W/m**2) - real(r8) :: improad_e_sunwall(num_urbanl) ! improad_e to sunlit wall (W/m**2) - real(r8) :: improad_e_shadewall(num_urbanl) ! improad_e to shaded wall (W/m**2) - - real(r8) :: perroad_a(num_urbanl) ! absorbed longwave for perroad (W/m**2) - real(r8) :: perroad_r(num_urbanl) ! reflected longwave for perroad (W/m**2) - real(r8) :: perroad_r_sky(num_urbanl) ! perroad_r to sky (W/m**2) - real(r8) :: perroad_r_sunwall(num_urbanl) ! perroad_r to sunlit wall (W/m**2) - real(r8) :: perroad_r_shadewall(num_urbanl) ! perroad_r to shaded wall (W/m**2) - real(r8) :: perroad_e(num_urbanl) ! emitted longwave for perroad (W/m**2) - real(r8) :: perroad_e_sky(num_urbanl) ! perroad_e to sky (W/m**2) - real(r8) :: perroad_e_sunwall(num_urbanl) ! perroad_e to sunlit wall (W/m**2) - real(r8) :: perroad_e_shadewall(num_urbanl) ! perroad_e to shaded wall (W/m**2) - - real(r8) :: road_a(num_urbanl) ! absorbed longwave for total road (W/m**2) - real(r8) :: road_r(num_urbanl) ! reflected longwave for total road (W/m**2) - real(r8) :: road_r_sky(num_urbanl) ! total road_r to sky (W/m**2) - real(r8) :: road_r_sunwall(num_urbanl) ! total road_r to sunlit wall (W/m**2) - real(r8) :: road_r_shadewall(num_urbanl) ! total road_r to shaded wall (W/m**2) - real(r8) :: road_e(num_urbanl) ! emitted longwave for total road (W/m**2) - real(r8) :: road_e_sky(num_urbanl) ! total road_e to sky (W/m**2) - real(r8) :: road_e_sunwall(num_urbanl) ! total road_e to sunlit wall (W/m**2) - real(r8) :: road_e_shadewall(num_urbanl) ! total road_e to shaded wall (W/m**2) - - real(r8) :: sunwall_a(num_urbanl) ! absorbed longwave (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: sunwall_r(num_urbanl) ! reflected longwave (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: sunwall_r_sky(num_urbanl) ! sunwall_r to sky (W/m**2) - real(r8) :: sunwall_r_road(num_urbanl) ! sunwall_r to road (W/m**2) - real(r8) :: sunwall_r_shadewall(num_urbanl) ! sunwall_r to opposing (shaded) wall (W/m**2) - real(r8) :: sunwall_e(num_urbanl) ! emitted longwave (per unit wall area) for sunlit wall (W/m**2) - real(r8) :: sunwall_e_sky(num_urbanl) ! sunwall_e to sky (W/m**2) - real(r8) :: sunwall_e_road(num_urbanl) ! sunwall_e to road (W/m**2) - real(r8) :: sunwall_e_shadewall(num_urbanl) ! sunwall_e to opposing (shaded) wall (W/m**2) - - real(r8) :: shadewall_a(num_urbanl) ! absorbed longwave (per unit wall area) for shaded wall (W/m**2) - real(r8) :: shadewall_r(num_urbanl) ! reflected longwave (per unit wall area) for shaded wall (W/m**2) - real(r8) :: shadewall_r_sky(num_urbanl) ! shadewall_r to sky (W/m**2) - real(r8) :: shadewall_r_road(num_urbanl) ! shadewall_r to road (W/m**2) - real(r8) :: shadewall_r_sunwall(num_urbanl) ! shadewall_r to opposing (sunlit) wall (W/m**2) - real(r8) :: shadewall_e(num_urbanl) ! emitted longwave (per unit wall area) for shaded wall (W/m**2) - real(r8) :: shadewall_e_sky(num_urbanl) ! shadewall_e to sky (W/m**2) - real(r8) :: shadewall_e_road(num_urbanl) ! shadewall_e to road (W/m**2) - real(r8) :: shadewall_e_sunwall(num_urbanl) ! shadewall_e to opposing (sunlit) wall (W/m**2) - integer :: l,fl,iter ! indices - integer, parameter :: n = 50 ! number of interations - real(r8) :: crit ! convergence criterion (W/m**2) - real(r8) :: err ! energy conservation error (W/m**2) - real(r8) :: wtroad_imperv(num_urbanl) ! weight of impervious road wrt total road -!----------------------------------------------------------------------- - - ! Assign landunit level pointer - - vf_sr => lps%vf_sr - vf_wr => lps%vf_wr - vf_sw => lps%vf_sw - vf_rw => lps%vf_rw - vf_ww => lps%vf_ww - - ! Calculate impervious road - - do l = 1,num_urbanl - wtroad_imperv(l) = 1._r8 - wtroad_perv(l) - end do - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - ! atmospheric longwave radiation incident on walls and road in urban canyon. - ! check for conservation (need to convert wall fluxes to ground area). - ! lwdown (from atmosphere) = lwdown_road + (lwdown_sunwall + lwdown_shadewall)*canyon_hwr - - lwdown_road(fl) = lwdown(fl) * vf_sr(l) - lwdown_sunwall(fl) = lwdown(fl) * vf_sw(l) - lwdown_shadewall(fl) = lwdown(fl) * vf_sw(l) - - err = lwdown(fl) - (lwdown_road(fl) + (lwdown_shadewall(fl) + lwdown_sunwall(fl))*canyon_hwr(fl)) - if (abs(err) > 0.10_r8 ) then - write (iulog,*) 'urban incident atmospheric longwave radiation balance error',err - write (iulog,*) 'clm model is stopping' - call endrun - endif - end do - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - - ! initial absorption, reflection, and emission for road and both walls. - ! distribute reflected and emitted radiation to sky, road, and walls according - ! to appropriate view factor. radiation reflected to road and walls will - ! undergo multiple reflections within the canyon. - - road_a(fl) = 0.0_r8 - road_r(fl) = 0.0_r8 - road_e(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_a(fl) = em_improad(fl) * lwdown_road(fl) - improad_r(fl) = (1._r8-em_improad(fl)) * lwdown_road(fl) - improad_r_sky(fl) = improad_r(fl) * vf_sr(l) - improad_r_sunwall(fl) = improad_r(fl) * vf_wr(l) - improad_r_shadewall(fl) = improad_r(fl) * vf_wr(l) - improad_e(fl) = em_improad(fl) * sb * (t_improad(fl)**4) - improad_e_sky(fl) = improad_e(fl) * vf_sr(l) - improad_e_sunwall(fl) = improad_e(fl) * vf_wr(l) - improad_e_shadewall(fl) = improad_e(fl) * vf_wr(l) - road_a(fl) = road_a(fl) + improad_a(fl)*wtroad_imperv(fl) - road_r(fl) = road_r(fl) + improad_r(fl)*wtroad_imperv(fl) - road_e(fl) = road_e(fl) + improad_e(fl)*wtroad_imperv(fl) - end if - - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_a(fl) = em_perroad(fl) * lwdown_road(fl) - perroad_r(fl) = (1._r8-em_perroad(fl)) * lwdown_road(fl) - perroad_r_sky(fl) = perroad_r(fl) * vf_sr(l) - perroad_r_sunwall(fl) = perroad_r(fl) * vf_wr(l) - perroad_r_shadewall(fl) = perroad_r(fl) * vf_wr(l) - perroad_e(fl) = em_perroad(fl) * sb * (t_perroad(fl)**4) - perroad_e_sky(fl) = perroad_e(fl) * vf_sr(l) - perroad_e_sunwall(fl) = perroad_e(fl) * vf_wr(l) - perroad_e_shadewall(fl) = perroad_e(fl) * vf_wr(l) - road_a(fl) = road_a(fl) + perroad_a(fl)*wtroad_perv(fl) - road_r(fl) = road_r(fl) + perroad_r(fl)*wtroad_perv(fl) - road_e(fl) = road_e(fl) + perroad_e(fl)*wtroad_perv(fl) - end if - - road_r_sky(fl) = road_r(fl) * vf_sr(l) - road_r_sunwall(fl) = road_r(fl) * vf_wr(l) - road_r_shadewall(fl) = road_r(fl) * vf_wr(l) - road_e_sky(fl) = road_e(fl) * vf_sr(l) - road_e_sunwall(fl) = road_e(fl) * vf_wr(l) - road_e_shadewall(fl) = road_e(fl) * vf_wr(l) - - sunwall_a(fl) = em_wall(fl) * lwdown_sunwall(fl) - sunwall_r(fl) = (1._r8-em_wall(fl)) * lwdown_sunwall(fl) - sunwall_r_sky(fl) = sunwall_r(fl) * vf_sw(l) - sunwall_r_road(fl) = sunwall_r(fl) * vf_rw(l) - sunwall_r_shadewall(fl) = sunwall_r(fl) * vf_ww(l) - sunwall_e(fl) = em_wall(fl) * sb * (t_sunwall(fl)**4) - sunwall_e_sky(fl) = sunwall_e(fl) * vf_sw(l) - sunwall_e_road(fl) = sunwall_e(fl) * vf_rw(l) - sunwall_e_shadewall(fl) = sunwall_e(fl) * vf_ww(l) - - shadewall_a(fl) = em_wall(fl) * lwdown_shadewall(fl) - shadewall_r(fl) = (1._r8-em_wall(fl)) * lwdown_shadewall(fl) - shadewall_r_sky(fl) = shadewall_r(fl) * vf_sw(l) - shadewall_r_road(fl) = shadewall_r(fl) * vf_rw(l) - shadewall_r_sunwall(fl) = shadewall_r(fl) * vf_ww(l) - shadewall_e(fl) = em_wall(fl) * sb * (t_shadewall(fl)**4) - shadewall_e_sky(fl) = shadewall_e(fl) * vf_sw(l) - shadewall_e_road(fl) = shadewall_e(fl) * vf_rw(l) - shadewall_e_sunwall(fl) = shadewall_e(fl) * vf_ww(l) - - ! initialize sum of net and upward longwave radiation for road and both walls - - if ( wtroad_imperv(fl) > 0.0_r8 ) lwnet_improad(fl) = improad_e(fl) - improad_a(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) lwnet_perroad(fl) = perroad_e(fl) - perroad_a(fl) - lwnet_sunwall(fl) = sunwall_e(fl) - sunwall_a(fl) - lwnet_shadewall(fl) = shadewall_e(fl) - shadewall_a(fl) - - if ( wtroad_imperv(fl) > 0.0_r8 ) lwup_improad(fl) = improad_r_sky(fl) + improad_e_sky(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) lwup_perroad(fl) = perroad_r_sky(fl) + perroad_e_sky(fl) - lwup_sunwall(fl) = sunwall_r_sky(fl) + sunwall_e_sky(fl) - lwup_shadewall(fl) = shadewall_r_sky(fl) + shadewall_e_sky(fl) - - end do - - ! now account for absorption and reflection within canyon of fluxes from road and walls - ! allowing for multiple reflections - ! - ! (1) absorption and reflection. note: emission from road and walls absorbed by walls and roads - ! only occurs in first iteration. zero out for later iterations. - ! - ! road: fluxes from walls need to be projected to ground area - ! wall: fluxes from road need to be projected to wall area - ! - ! (2) add net longwave for ith reflection to total net longwave - ! - ! (3) distribute reflected radiation to sky, road, and walls according to view factors - ! - ! (4) add upward longwave radiation to sky from road and walls for ith reflection to total - ! - ! (5) stop iteration when absorption for ith reflection is less than some nominal amount. - ! small convergence criteria is required to ensure radiation is conserved - - do fl = 1,num_urbanl - l = filter_urbanl(fl) - - do iter = 1, n - ! step (1) - - lwtot(fl) = (sunwall_r_road(fl) + sunwall_e_road(fl) & - + shadewall_r_road(fl) + shadewall_e_road(fl))*canyon_hwr(fl) - road_a(fl) = 0.0_r8 - road_r(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_r(fl) = (1._r8-em_improad(fl)) * lwtot(fl) - improad_a(fl) = em_improad(fl) * lwtot(fl) - road_a(fl) = road_a(fl) + improad_a(fl)*wtroad_imperv(fl) - road_r(fl) = road_r(fl) + improad_r(fl)*wtroad_imperv(fl) - end if - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_r(fl) = (1._r8-em_perroad(fl)) * lwtot(fl) - perroad_a(fl) = em_perroad(fl) * lwtot(fl) - road_a(fl) = road_a(fl) + perroad_a(fl)*wtroad_perv(fl) - road_r(fl) = road_r(fl) + perroad_r(fl)*wtroad_perv(fl) - end if - - lwtot(fl) = (road_r_sunwall(fl) + road_e_sunwall(fl))/canyon_hwr(fl) & - + (shadewall_r_sunwall(fl) + shadewall_e_sunwall(fl)) - sunwall_a(fl) = em_wall(fl) * lwtot(fl) - sunwall_r(fl) = (1._r8-em_wall(fl)) * lwtot(fl) - - lwtot(fl) = (road_r_shadewall(fl) + road_e_shadewall(fl))/canyon_hwr(fl) & - + (sunwall_r_shadewall(fl) + sunwall_e_shadewall(fl)) - shadewall_a(fl) = em_wall(fl) * lwtot(fl) - shadewall_r(fl) = (1._r8-em_wall(fl)) * lwtot(fl) - - sunwall_e_road(fl) = 0._r8 - shadewall_e_road(fl) = 0._r8 - road_e_sunwall(fl) = 0._r8 - shadewall_e_sunwall(fl) = 0._r8 - road_e_shadewall(fl) = 0._r8 - sunwall_e_shadewall(fl) = 0._r8 - - ! step (2) - - if ( wtroad_imperv(fl) > 0.0_r8 ) lwnet_improad(fl) = lwnet_improad(fl) - improad_a(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) lwnet_perroad(fl) = lwnet_perroad(fl) - perroad_a(fl) - lwnet_sunwall(fl) = lwnet_sunwall(fl) - sunwall_a(fl) - lwnet_shadewall(fl) = lwnet_shadewall(fl) - shadewall_a(fl) - - ! step (3) - - if ( wtroad_imperv(fl) > 0.0_r8 ) then - improad_r_sky(fl) = improad_r(fl) * vf_sr(l) - improad_r_sunwall(fl) = improad_r(fl) * vf_wr(l) - improad_r_shadewall(fl) = improad_r(fl) * vf_wr(l) - end if - - if ( wtroad_perv(fl) > 0.0_r8 ) then - perroad_r_sky(fl) = perroad_r(fl) * vf_sr(l) - perroad_r_sunwall(fl) = perroad_r(fl) * vf_wr(l) - perroad_r_shadewall(fl) = perroad_r(fl) * vf_wr(l) - end if - - road_r_sky(fl) = road_r(fl) * vf_sr(l) - road_r_sunwall(fl) = road_r(fl) * vf_wr(l) - road_r_shadewall(fl) = road_r(fl) * vf_wr(l) - - sunwall_r_sky(fl) = sunwall_r(fl) * vf_sw(l) - sunwall_r_road(fl) = sunwall_r(fl) * vf_rw(l) - sunwall_r_shadewall(fl) = sunwall_r(fl) * vf_ww(l) - - shadewall_r_sky(fl) = shadewall_r(fl) * vf_sw(l) - shadewall_r_road(fl) = shadewall_r(fl) * vf_rw(l) - shadewall_r_sunwall(fl) = shadewall_r(fl) * vf_ww(l) - - ! step (4) - - if ( wtroad_imperv(fl) > 0.0_r8 ) lwup_improad(fl) = lwup_improad(fl) + improad_r_sky(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) lwup_perroad(fl) = lwup_perroad(fl) + perroad_r_sky(fl) - lwup_sunwall(fl) = lwup_sunwall(fl) + sunwall_r_sky(fl) - lwup_shadewall(fl) = lwup_shadewall(fl) + shadewall_r_sky(fl) - - ! step (5) - - crit = max(road_a(fl), sunwall_a(fl), shadewall_a(fl)) - if (crit < .001_r8) exit - end do - if (iter >= n) then - write (iulog,*) 'urban net longwave radiation error: no convergence' - write (iulog,*) 'clm model is stopping' - call endrun - endif - - ! total net longwave radiation for canyon. project wall fluxes to horizontal surface - - lwnet_canyon(fl) = 0.0_r8 - if ( wtroad_imperv(fl) > 0.0_r8 ) lwnet_canyon(fl) = lwnet_canyon(fl) + lwnet_improad(fl)*wtroad_imperv(fl) - if ( wtroad_perv(fl) > 0.0_r8 ) lwnet_canyon(fl) = lwnet_canyon(fl) + lwnet_perroad(fl)*wtroad_perv(fl) - lwnet_canyon(fl) = lwnet_canyon(fl) + (lwnet_sunwall(fl) + lwnet_shadewall(fl))*canyon_hwr(fl) - - ! total emitted longwave for canyon. project wall fluxes to horizontal - - lwup_canyon(fl) = 0.0_r8 - if( wtroad_imperv(fl) > 0.0_r8 ) lwup_canyon(fl) = lwup_canyon(fl) + lwup_improad(fl)*wtroad_imperv(fl) - if( wtroad_perv(fl) > 0.0_r8 ) lwup_canyon(fl) = lwup_canyon(fl) + lwup_perroad(fl)*wtroad_perv(fl) - lwup_canyon(fl) = lwup_canyon(fl) + (lwup_sunwall(fl) + lwup_shadewall(fl))*canyon_hwr(fl) - - ! conservation check. note: previous conservation check confirms partioning of incident - ! atmospheric longwave radiation to road and walls is conserved as - ! lwdown (from atmosphere) = lwdown_improad + lwdown_perroad + (lwdown_sunwall + lwdown_shadewall)*canyon_hwr - - err = lwnet_canyon(fl) - (lwup_canyon(fl) - lwdown(fl)) - if (abs(err) > .10_r8 ) then - write (iulog,*) 'urban net longwave radiation balance error',err - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - end do - - ! Net longwave radiation for roof - - do l = 1,num_urbanl - lwup_roof(l) = em_roof(l)*sb*(t_roof(l)**4) + (1._r8-em_roof(l))*lwdown(l) - lwnet_roof(l) = lwup_roof(l) - lwdown(l) - end do - - end subroutine net_longwave - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanClumpInit -! -! !INTERFACE: - subroutine UrbanClumpInit() -! -! !DESCRIPTION: -! Initialize urban radiation module -! -! !USES: - use clmtype - use clm_varcon , only : spval, icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv - use decompMod , only : get_proc_clumps, ldecomp - use filterMod , only : filter - use UrbanInputMod, only : urbinp -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein 04/2003 -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments -! - integer , pointer :: coli(:) ! beginning column index for landunit - integer , pointer :: colf(:) ! ending column index for landunit - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: ctype(:) ! column type -! -! -! !OTHER LOCAL VARIABLES -!EOP -! - integer :: nc,fl,ib,l,c,p,g ! indices - integer :: nclumps ! number of clumps on processor - integer :: num_urbanl ! number of per-clump urban landunits - integer :: ier ! error status -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (landunit-level) - - coli => lun%coli - colf => lun%colf - lgridcell => lun%gridcell - - ! Assign local pointers to derived type members (column-level) - - ctype => col%itype - - ! Allocate memory - - nclumps = get_proc_clumps() - allocate(urban_clump(nclumps), stat=ier) - if (ier /= 0) then - write (iulog,*) 'UrbanInit: allocation error for urban clumps'; call endrun() - end if - - ! Loop over all clumps on this processor - - do nc = 1, nclumps - - ! Determine number of unrban landunits in clump - - num_urbanl = filter(nc)%num_urbanl - - ! Consistency check for urban columns - - do fl = 1,num_urbanl - l = filter(nc)%urbanl(fl) - do c = coli(l),colf(l) - if ( ctype(c) /= icol_roof .and. & - ctype(c) /= icol_sunwall .and. ctype(c) /= icol_shadewall .and. & - ctype(c) /= icol_road_perv .and. ctype(c) /= icol_road_imperv) then - write(iulog,*)'error in urban column types for landunit = ',l - write(iulog,*)'ctype= ',ctype(c) - call endrun() - endif - end do - end do - - ! Allocate memory for urban clump clumponents - - if (num_urbanl > 0) then - allocate( urban_clump(nc)%canyon_hwr (num_urbanl), & - urban_clump(nc)%wtroad_perv (num_urbanl), & - urban_clump(nc)%ht_roof (num_urbanl), & - urban_clump(nc)%wtlunit_roof (num_urbanl), & - urban_clump(nc)%wind_hgt_canyon (num_urbanl), & - urban_clump(nc)%em_roof (num_urbanl), & - urban_clump(nc)%em_improad (num_urbanl), & - urban_clump(nc)%em_perroad (num_urbanl), & - urban_clump(nc)%em_wall (num_urbanl), & - urban_clump(nc)%alb_roof_dir (num_urbanl,numrad), & - urban_clump(nc)%alb_roof_dif (num_urbanl,numrad), & - urban_clump(nc)%alb_improad_dir (num_urbanl,numrad), & - urban_clump(nc)%alb_perroad_dir (num_urbanl,numrad), & - urban_clump(nc)%alb_improad_dif (num_urbanl,numrad), & - urban_clump(nc)%alb_perroad_dif (num_urbanl,numrad), & - urban_clump(nc)%alb_wall_dir (num_urbanl,numrad), & - urban_clump(nc)%alb_wall_dif (num_urbanl,numrad), stat=ier ) - if (ier /= 0) then - write(iulog,*)'UrbanRadInit: allocation error for urban derived type'; call endrun() - endif - end if - - ! Set constants in derived type values for urban clump - - do fl = 1,num_urbanl - l = filter(nc)%urbanl(fl) - g = lun%gridcell(l) - urban_clump(nc)%canyon_hwr (fl) = urbinp%canyon_hwr (g) - urban_clump(nc)%wtroad_perv (fl) = urbinp%wtroad_perv (g) - urban_clump(nc)%ht_roof (fl) = urbinp%ht_roof (g) - urban_clump(nc)%wtlunit_roof (fl) = urbinp%wtlunit_roof (g) - urban_clump(nc)%wind_hgt_canyon(fl) = urbinp%wind_hgt_canyon(g) - do ib = 1,numrad - urban_clump(nc)%alb_roof_dir (fl,ib) = urbinp%alb_roof_dir (g,ib) - urban_clump(nc)%alb_roof_dif (fl,ib) = urbinp%alb_roof_dif (g,ib) - urban_clump(nc)%alb_improad_dir(fl,ib) = urbinp%alb_improad_dir(g,ib) - urban_clump(nc)%alb_perroad_dir(fl,ib) = urbinp%alb_perroad_dir(g,ib) - urban_clump(nc)%alb_improad_dif(fl,ib) = urbinp%alb_improad_dif(g,ib) - urban_clump(nc)%alb_perroad_dif(fl,ib) = urbinp%alb_perroad_dif(g,ib) - urban_clump(nc)%alb_wall_dir (fl,ib) = urbinp%alb_wall_dir (g,ib) - urban_clump(nc)%alb_wall_dif (fl,ib) = urbinp%alb_wall_dif (g,ib) - end do - urban_clump(nc)%em_roof (fl) = urbinp%em_roof (g) - urban_clump(nc)%em_improad(fl) = urbinp%em_improad(g) - urban_clump(nc)%em_perroad(fl) = urbinp%em_perroad(g) - urban_clump(nc)%em_wall (fl) = urbinp%em_wall (g) -! write(iulog,*)'g: ',g -! write(iulog,*)'l: ',l -! write(iulog,*)'fl: ',fl -! write(iulog,*)'urban_clump(nc)%canyon_hwr: ',urban_clump(nc)%canyon_hwr(fl) -! write(iulog,*)'urban_clump(nc)%wtroad_perv: ',urban_clump(nc)%wtroad_perv(fl) -! write(iulog,*)'urban_clump(nc)%ht_roof: ',urban_clump(nc)%ht_roof(fl) -! write(iulog,*)'urban_clump(nc)%wtlunit_roof: ',urban_clump(nc)%wtlunit_roof(fl) -! write(iulog,*)'urban_clump(nc)%wind_hgt_canyon: ',urban_clump(nc)%wind_hgt_canyon(fl) -! write(iulog,*)'urban_clump(nc)%alb_roof_dir: ',urban_clump(nc)%alb_roof_dir(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_roof_dif: ',urban_clump(nc)%alb_roof_dif(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_improad_dir: ',urban_clump(nc)%alb_improad_dir(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_improad_dif: ',urban_clump(nc)%alb_improad_dif(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_perroad_dir: ',urban_clump(nc)%alb_perroad_dir(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_perroad_dif: ',urban_clump(nc)%alb_perroad_dif(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_wall_dir: ',urban_clump(nc)%alb_wall_dir(fl,:) -! write(iulog,*)'urban_clump(nc)%alb_wall_dif: ',urban_clump(nc)%alb_wall_dif(fl,:) -! write(iulog,*)'urban_clump(nc)%em_roof: ',urban_clump(nc)%em_roof(fl) -! write(iulog,*)'urban_clump(nc)%em_improad: ',urban_clump(nc)%em_improad(fl) -! write(iulog,*)'urban_clump(nc)%em_perroad: ',urban_clump(nc)%em_perroad(fl) -! write(iulog,*)'urban_clump(nc)%em_wall: ',urban_clump(nc)%em_wall(fl) - end do - end do ! end of loop over clumps - - end subroutine UrbanClumpInit - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: UrbanFluxes -! -! !INTERFACE: - subroutine UrbanFluxes (nc, lbp, ubp, lbl, ubl, lbc, ubc, & - num_nourbanl, filter_nourbanl, & - num_urbanl, filter_urbanl, & - num_urbanc, filter_urbanc, & - num_urbanp, filter_urbanp) -! -! !DESCRIPTION: -! Turbulent and momentum fluxes from urban canyon (consisting of roof, sunwall, -! shadewall, pervious and impervious road). - -! !USES: - use clmtype - use clm_varcon , only : cpair, vkc, spval, icol_roof, icol_sunwall, & - icol_shadewall, icol_road_perv, icol_road_imperv, & - grav, pondmx_urban, rpi, rgas, & - ht_wasteheat_factor, ac_wasteheat_factor, & - wasteheat_limit - use filterMod , only : filter - use FrictionVelocityMod, only : FrictionVelocity, MoninObukIni - use QSatMod , only : QSat - use clm_varpar , only : maxpatch_urb, nlevurb - use clm_time_manager , only : get_curr_date, get_step_size, get_nstep - use clm_atmlnd , only : clm_a2l - -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: nc ! clump index - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: lbl, ubl ! landunit-index bounds - integer, intent(in) :: lbc, ubc ! column-index bounds - integer , intent(in) :: num_nourbanl ! number of non-urban landunits in clump - integer , intent(in) :: filter_nourbanl(ubl-lbl+1) ! non-urban landunit filter - integer , intent(in) :: num_urbanl ! number of urban landunits in clump - integer , intent(in) :: filter_urbanl(ubl-lbl+1) ! urban landunit filter - integer , intent(in) :: num_urbanc ! number of urban columns in clump - integer , intent(in) :: filter_urbanc(ubc-lbc+1) ! urban column filter - integer , intent(in) :: num_urbanp ! number of urban pfts in clump - integer , intent(in) :: filter_urbanp(ubp-lbp+1) ! urban pft filter -! -! !CALLED FROM: -! subroutine clm_driver1 -! -! !REVISION HISTORY: -! Author: Keith Oleson 10/2005 -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in arguments (urban clump) -! - real(r8), pointer :: ht_roof(:) ! height of urban roof (m) - real(r8), pointer :: wtlunit_roof(:) ! weight of roof with respect to landunit - real(r8), pointer :: canyon_hwr(:) ! ratio of building height to street width - real(r8), pointer :: wtroad_perv(:) ! weight of pervious road wrt total road - real(r8), pointer :: wind_hgt_canyon(:) ! height above road at which wind in canyon is to be computed (m) -! -! local pointers to original implicit in arguments (clmtype) -! - real(r8), pointer :: forc_u(:) ! atmospheric wind speed in east direction (m/s) - real(r8), pointer :: forc_v(:) ! atmospheric wind speed in north direction (m/s) - real(r8), pointer :: forc_rho(:) ! density (kg/m**3) - real(r8), pointer :: forc_hgt_u_pft(:) ! observational height of wind at pft-level (m) - real(r8), pointer :: forc_hgt_t_pft(:) ! observational height of temperature at pft-level (m) - real(r8), pointer :: forc_q(:) ! atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_t(:) ! atmospheric temperature (K) - real(r8), pointer :: forc_th(:) ! atmospheric potential temperature (K) - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - - real(r8), pointer :: z_0_town(:) ! momentum roughness length of urban landunit (m) - real(r8), pointer :: z_d_town(:) ! displacement height of urban landunit (m) - - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: plandunit(:) ! pft's landunit index - integer , pointer :: ctype(:) ! column type - integer , pointer :: coli(:) ! beginning column index for landunit - integer , pointer :: colf(:) ! ending column index for landunit - integer , pointer :: pfti(:) ! beginning pft index for landunit - integer , pointer :: pftf(:) ! ending pft index for landunit - - real(r8), pointer :: taf(:) ! urban canopy air temperature (K) - real(r8), pointer :: qaf(:) ! urban canopy air specific humidity (kg/kg) - integer , pointer :: npfts(:) ! landunit's number of pfts (columns) - real(r8), pointer :: t_grnd(:) ! ground surface temperature (K) - real(r8), pointer :: qg(:) ! specific humidity at ground surface (kg/kg) - real(r8), pointer :: htvp(:) ! latent heat of evaporation (/sublimation) (J/kg) - real(r8), pointer :: dqgdT(:) ! temperature derivative of "qg" - real(r8), pointer :: eflx_traffic(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_traffic_factor(:) ! multiplicative urban traffic factor for sensible heat flux - real(r8), pointer :: eflx_wasteheat(:) ! sensible heat flux from urban heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac(:) ! sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: t_soisno(:,:) ! soil temperature (K) - real(r8), pointer :: eflx_urban_ac(:) ! urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat(:) ! urban heating flux (W/m**2) - real(r8), pointer :: londeg(:) ! longitude (degrees) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: rootr_road_perv(:,:) ! effective fraction of roots in each soil layer for urban pervious road - real(r8), pointer :: soilalpha_u(:) ! Urban factor that reduces ground saturated specific humidity (-) -! -! local pointers to original implicit out arguments -! - real(r8), pointer :: dlrad(:) ! downward longwave radiation below the canopy (W/m**2) - real(r8), pointer :: ulrad(:) ! upward longwave radiation above the canopy (W/m**2) - real(r8), pointer :: cgrnds(:) ! deriv, of soil sensible heat flux wrt soil temp (W/m**2/K) - real(r8), pointer :: cgrndl(:) ! deriv of soil latent heat flux wrt soil temp (W/m**2/K) - real(r8), pointer :: cgrnd(:) ! deriv. of soil energy flux wrt to soil temp (W/m**2/K) - real(r8), pointer :: taux(:) ! wind (shear) stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy(:) ! wind (shear) stress: n-s (kg/m/s**2) - real(r8), pointer :: eflx_sh_grnd(:) ! sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot(:) ! total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_u(:) ! urban total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: qflx_evap_soi(:) ! soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg(:) ! vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_veg(:) ! vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot(:) ! qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (K) - real(r8), pointer :: q_ref2m(:) ! 2 m height surface specific humidity (kg/kg) - real(r8), pointer :: t_ref2m_u(:) ! Urban 2 m height surface air temperature (K) - real(r8), pointer :: t_veg(:) ! vegetation temperature (K) - real(r8), pointer :: ram1(:) ! aerodynamical resistance (s/m) - real(r8), pointer :: rootr(:,:) ! effective fraction of roots in each soil layer - real(r8), pointer :: psnsun(:) ! sunlit leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: psnsha(:) ! shaded leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: t_building(:) ! internal building temperature (K) - real(r8), pointer :: rh_ref2m(:) ! 2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m_u(:) ! Urban 2 m height surface relative humidity (%) -! -! -! !OTHER LOCAL VARIABLES -!EOP -! - character(len=*), parameter :: sub="UrbanFluxes" - integer :: fp,fc,fl,f,p,c,l,g,j,pi,i ! indices - - real(r8) :: canyontop_wind(num_urbanl) ! wind at canyon top (m/s) - real(r8) :: canyon_u_wind(num_urbanl) ! u-component of wind speed inside canyon (m/s) - real(r8) :: canyon_wind(num_urbanl) ! net wind speed inside canyon (m/s) - real(r8) :: canyon_resistance(num_urbanl) ! resistance to heat and moisture transfer from canyon road/walls to canyon air (s/m) - - real(r8) :: ur(lbl:ubl) ! wind speed at reference height (m/s) - real(r8) :: ustar(lbl:ubl) ! friction velocity (m/s) - real(r8) :: ramu(lbl:ubl) ! aerodynamic resistance (s/m) - real(r8) :: rahu(lbl:ubl) ! thermal resistance (s/m) - real(r8) :: rawu(lbl:ubl) ! moisture resistance (s/m) - real(r8) :: temp1(lbl:ubl) ! relation for potential temperature profile - real(r8) :: temp12m(lbl:ubl) ! relation for potential temperature profile applied at 2-m - real(r8) :: temp2(lbl:ubl) ! relation for specific humidity profile - real(r8) :: temp22m(lbl:ubl) ! relation for specific humidity profile applied at 2-m - real(r8) :: thm_g(lbl:ubl) ! intermediate variable (forc_t+0.0098*forc_hgt_t) - real(r8) :: thv_g(lbl:ubl) ! virtual potential temperature (K) - real(r8) :: dth(lbl:ubl) ! diff of virtual temp. between ref. height and surface - real(r8) :: dqh(lbl:ubl) ! diff of humidity between ref. height and surface - real(r8) :: zldis(lbl:ubl) ! reference height "minus" zero displacement height (m) - real(r8) :: um(lbl:ubl) ! wind speed including the stablity effect (m/s) - real(r8) :: obu(lbl:ubl) ! Monin-Obukhov length (m) - real(r8) :: taf_numer(lbl:ubl) ! numerator of taf equation (K m/s) - real(r8) :: taf_denom(lbl:ubl) ! denominator of taf equation (m/s) - real(r8) :: qaf_numer(lbl:ubl) ! numerator of qaf equation (kg m/kg s) - real(r8) :: qaf_denom(lbl:ubl) ! denominator of qaf equation (m/s) - real(r8) :: wtas(lbl:ubl) ! sensible heat conductance for urban air to atmospheric air (m/s) - real(r8) :: wtaq(lbl:ubl) ! latent heat conductance for urban air to atmospheric air (m/s) - real(r8) :: wts_sum(lbl:ubl) ! sum of wtas, wtus_roof, wtus_road_perv, wtus_road_imperv, wtus_sunwall, wtus_shadewall - real(r8) :: wtq_sum(lbl:ubl) ! sum of wtaq, wtuq_roof, wtuq_road_perv, wtuq_road_imperv, wtuq_sunwall, wtuq_shadewall - real(r8) :: beta(lbl:ubl) ! coefficient of convective velocity - real(r8) :: zii(lbl:ubl) ! convective boundary layer height (m) - - real(r8) :: fm(lbl:ubl) ! needed for BGC only to diagnose 10m wind speed - - real(r8) :: wtus(lbc:ubc) ! sensible heat conductance for urban columns (m/s) - real(r8) :: wtuq(lbc:ubc) ! latent heat conductance for urban columns (m/s) - - integer :: iter ! iteration index - real(r8) :: dthv ! diff of vir. poten. temp. between ref. height and surface - real(r8) :: tstar ! temperature scaling parameter - real(r8) :: qstar ! moisture scaling parameter - real(r8) :: thvstar ! virtual potential temperature scaling parameter - real(r8) :: wtus_roof(lbl:ubl) ! sensible heat conductance for roof (not scaled) (m/s) - real(r8) :: wtuq_roof(lbl:ubl) ! latent heat conductance for roof (not scaled) (m/s) - real(r8) :: wtus_road_perv(lbl:ubl) ! sensible heat conductance for pervious road (not scaled) (m/s) - real(r8) :: wtuq_road_perv(lbl:ubl) ! latent heat conductance for pervious road (not scaled) (m/s) - real(r8) :: wtus_road_imperv(lbl:ubl) ! sensible heat conductance for impervious road (not scaled) (m/s) - real(r8) :: wtuq_road_imperv(lbl:ubl) ! latent heat conductance for impervious road (not scaled) (m/s) - real(r8) :: wtus_sunwall(lbl:ubl) ! sensible heat conductance for sunwall (not scaled) (m/s) - real(r8) :: wtuq_sunwall(lbl:ubl) ! latent heat conductance for sunwall (not scaled) (m/s) - real(r8) :: wtus_shadewall(lbl:ubl) ! sensible heat conductance for shadewall (not scaled) (m/s) - real(r8) :: wtuq_shadewall(lbl:ubl) ! latent heat conductance for shadewall (not scaled) (m/s) - real(r8) :: t_sunwall_innerl(lbl:ubl) ! temperature of inner layer of sunwall (K) - real(r8) :: t_shadewall_innerl(lbl:ubl) ! temperature of inner layer of shadewall (K) - real(r8) :: t_roof_innerl(lbl:ubl) ! temperature of inner layer of roof (K) - real(r8) :: lngth_roof ! length of roof (m) - real(r8) :: wc ! convective velocity (m/s) - real(r8) :: zeta ! dimensionless height used in Monin-Obukhov theory - real(r8) :: eflx_sh_grnd_scale(lbp:ubp) ! scaled sensible heat flux from ground (W/m**2) [+ to atm] - real(r8) :: qflx_evap_soi_scale(lbp:ubp) ! scaled soil evaporation (mm H2O/s) (+ = to atm) - real(r8) :: eflx_wasteheat_roof(lbl:ubl) ! sensible heat flux from urban heating/cooling sources of waste heat for roof (W/m**2) - real(r8) :: eflx_wasteheat_sunwall(lbl:ubl) ! sensible heat flux from urban heating/cooling sources of waste heat for sunwall (W/m**2) - real(r8) :: eflx_wasteheat_shadewall(lbl:ubl) ! sensible heat flux from urban heating/cooling sources of waste heat for shadewall (W/m**2) - real(r8) :: eflx_heat_from_ac_roof(lbl:ubl) ! sensible heat flux put back into canyon due to heat removal by AC for roof (W/m**2) - real(r8) :: eflx_heat_from_ac_sunwall(lbl:ubl) ! sensible heat flux put back into canyon due to heat removal by AC for sunwall (W/m**2) - real(r8) :: eflx_heat_from_ac_shadewall(lbl:ubl) ! sensible heat flux put back into canyon due to heat removal by AC for shadewall (W/m**2) - real(r8) :: eflx(lbl:ubl) ! total sensible heat flux for error check (W/m**2) - real(r8) :: qflx(lbl:ubl) ! total water vapor flux for error check (kg/m**2/s) - real(r8) :: eflx_scale(lbl:ubl) ! sum of scaled sensible heat fluxes for urban columns for error check (W/m**2) - real(r8) :: qflx_scale(lbl:ubl) ! sum of scaled water vapor fluxes for urban columns for error check (kg/m**2/s) - real(r8) :: eflx_err(lbl:ubl) ! sensible heat flux error (W/m**2) - real(r8) :: qflx_err(lbl:ubl) ! water vapor flux error (kg/m**2/s) - real(r8) :: fwet_roof ! fraction of roof surface that is wet (-) - real(r8) :: fwet_road_imperv ! fraction of impervious road surface that is wet (-) - - integer, parameter :: niters = 3 ! maximum number of iterations for surface temperature - integer :: local_secp1(lbl:ubl) ! seconds into current date in local time (sec) - real(r8) :: dtime ! land model time step (sec) - integer :: year,month,day,secs ! calendar info for current time step - logical :: found ! flag in search loop - integer :: indexl ! index of first found in search loop - integer :: nstep ! time step number - real(r8) :: z_d_town_loc(lbl:ubl) ! temporary copy - real(r8) :: z_0_town_loc(lbl:ubl) ! temporary copy - real(r8), parameter :: lapse_rate = 0.0098_r8 ! Dry adiabatic lapse rate (K/m) - real(r8) :: e_ref2m ! 2 m height surface saturated vapor pressure [Pa] - real(r8) :: de2mdT ! derivative of 2 m height surface saturated vapor pressure on t_ref2m - real(r8) :: qsat_ref2m ! 2 m height surface saturated specific humidity [kg/kg] - real(r8) :: dqsat2mdT ! derivative of 2 m height surface saturated specific humidity on t_ref2m - -!----------------------------------------------------------------------- - - ! Assign pointers into module urban clumps - - if ( num_urbanl > 0 )then - ht_roof => urban_clump(nc)%ht_roof - wtlunit_roof => urban_clump(nc)%wtlunit_roof - canyon_hwr => urban_clump(nc)%canyon_hwr - wtroad_perv => urban_clump(nc)%wtroad_perv - wind_hgt_canyon => urban_clump(nc)%wind_hgt_canyon - end if - - ! Assign local pointers to multi-level derived type members (gridcell level) - - forc_t => clm_a2l%forc_t - forc_th => clm_a2l%forc_th - forc_u => clm_a2l%forc_u - forc_v => clm_a2l%forc_v - forc_rho => clm_a2l%forc_rho - forc_q => clm_a2l%forc_q - forc_pbot => clm_a2l%forc_pbot - londeg => grc%londeg - - ! Assign local pointers to derived type members (landunit level) - - pfti => lun%pfti - pftf => lun%pftf - coli => lun%coli - colf => lun%colf - lgridcell => lun%gridcell - z_0_town => lun%z_0_town - z_d_town => lun%z_d_town - taf => lps%taf - qaf => lps%qaf - npfts => lun%npfts - eflx_traffic => lef%eflx_traffic - eflx_traffic_factor => lef%eflx_traffic_factor - eflx_wasteheat => lef%eflx_wasteheat - eflx_heat_from_ac => lef%eflx_heat_from_ac - t_building => lps%t_building - - ! Assign local pointers to derived type members (column level) - - ctype => col%itype - t_grnd => ces%t_grnd - qg => cws%qg - htvp => cps%htvp - dqgdT => cws%dqgdT - t_soisno => ces%t_soisno - eflx_urban_ac => cef%eflx_urban_ac - eflx_urban_heat => cef%eflx_urban_heat - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - frac_sno => cps%frac_sno - snowdp => cps%snowdp - h2osno => cws%h2osno - snl => cps%snl - rootr_road_perv => cps%rootr_road_perv - soilalpha_u => cws%soilalpha_u - - ! Assign local pointers to derived type members (pft level) - - pgridcell => pft%gridcell - pcolumn => pft%column - plandunit => pft%landunit - ram1 => pps%ram1 - dlrad => pef%dlrad - ulrad => pef%ulrad - cgrnds => pef%cgrnds - cgrndl => pef%cgrndl - cgrnd => pef%cgrnd - taux => pmf%taux - tauy => pmf%tauy - eflx_sh_grnd => pef%eflx_sh_grnd - eflx_sh_tot => pef%eflx_sh_tot - eflx_sh_tot_u => pef%eflx_sh_tot_u - qflx_evap_soi => pwf%qflx_evap_soi - qflx_tran_veg => pwf%qflx_tran_veg - qflx_evap_veg => pwf%qflx_evap_veg - qflx_evap_tot => pwf%qflx_evap_tot - t_ref2m => pes%t_ref2m - q_ref2m => pes%q_ref2m - t_ref2m_u => pes%t_ref2m_u - t_veg => pes%t_veg - rootr => pps%rootr - psnsun => pcf%psnsun - psnsha => pcf%psnsha - forc_hgt_u_pft => pps%forc_hgt_u_pft - forc_hgt_t_pft => pps%forc_hgt_t_pft - forc_hgt_u_pft => pps%forc_hgt_u_pft - forc_hgt_t_pft => pps%forc_hgt_t_pft - rh_ref2m => pes%rh_ref2m - rh_ref2m_u => pes%rh_ref2m_u - - ! Define fields that appear on the restart file for non-urban landunits - - do fl = 1,num_nourbanl - l = filter_nourbanl(fl) - taf(l) = spval - qaf(l) = spval - end do - - ! Get time step - nstep = get_nstep() - - ! Set constants (same as in Biogeophysics1Mod) - beta(:) = 1._r8 ! Should be set to the same values as in Biogeophysics1Mod - zii(:) = 1000._r8 ! Should be set to the same values as in Biogeophysics1Mod - - ! Get current date - dtime = get_step_size() - call get_curr_date (year, month, day, secs) - - ! Compute canyontop wind using Masson (2000) - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - local_secp1(l) = secs + nint((londeg(g)/degpsec)/dtime)*dtime - local_secp1(l) = mod(local_secp1(l),isecspday) - - ! Error checks - - if (ht_roof(fl) - z_d_town(l) <= z_0_town(l)) then - write (iulog,*) 'aerodynamic parameter error in UrbanFluxes' - write (iulog,*) 'h_r - z_d <= z_0' - write (iulog,*) 'ht_roof, z_d_town, z_0_town: ', ht_roof(fl), z_d_town(l), & - z_0_town(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - if (forc_hgt_u_pft(pfti(l)) - z_d_town(l) <= z_0_town(l)) then - write (iulog,*) 'aerodynamic parameter error in UrbanFluxes' - write (iulog,*) 'h_u - z_d <= z_0' - write (iulog,*) 'forc_hgt_u_pft, z_d_town, z_0_town: ', forc_hgt_u_pft(pfti(l)), z_d_town(l), & - z_0_town(l) - write (iulog,*) 'clm model is stopping' - call endrun() - end if - - ! Magnitude of atmospheric wind - - ur(l) = max(1.0_r8,sqrt(forc_u(g)*forc_u(g)+forc_v(g)*forc_v(g))) - - ! Canyon top wind - - canyontop_wind(fl) = ur(l) * & - log( (ht_roof(fl)-z_d_town(l)) / z_0_town(l) ) / & - log( (forc_hgt_u_pft(pfti(l))-z_d_town(l)) / z_0_town(l) ) - - ! U component of canyon wind - - if (canyon_hwr(fl) < 0.5_r8) then ! isolated roughness flow - canyon_u_wind(fl) = canyontop_wind(fl) * exp( -0.5_r8*canyon_hwr(fl)* & - (1._r8-(wind_hgt_canyon(fl)/ht_roof(fl))) ) - else if (canyon_hwr(fl) < 1.0_r8) then ! wake interference flow - canyon_u_wind(fl) = canyontop_wind(fl) * (1._r8+2._r8*(2._r8/rpi - 1._r8)* & - (ht_roof(fl)/(ht_roof(fl)/canyon_hwr(fl)) - 0.5_r8)) * & - exp(-0.5_r8*canyon_hwr(fl)*(1._r8-(wind_hgt_canyon(fl)/ht_roof(fl)))) - else ! skimming flow - canyon_u_wind(fl) = canyontop_wind(fl) * (2._r8/rpi) * & - exp(-0.5_r8*canyon_hwr(fl)*(1._r8-(wind_hgt_canyon(fl)/ht_roof(fl)))) - end if - - end do - -! Compute fluxes - Follows CLM approach for bare soils (Oleson et al 2004) - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - thm_g(l) = forc_t(g) + lapse_rate*forc_hgt_t_pft(pfti(l)) - thv_g(l) = forc_th(g)*(1._r8+0.61_r8*forc_q(g)) - dth(l) = thm_g(l)-taf(l) - dqh(l) = forc_q(g)-qaf(l) - dthv = dth(l)*(1._r8+0.61_r8*forc_q(g))+0.61_r8*forc_th(g)*dqh(l) - zldis(l) = forc_hgt_u_pft(pfti(l)) - z_d_town(l) - - ! Initialize Monin-Obukhov length and wind speed including convective velocity - - call MoninObukIni(ur(l), thv_g(l), dthv, zldis(l), z_0_town(l), um(l), obu(l)) - - end do - - ! Initialize conductances - wtus_roof(:) = 0._r8 - wtus_road_perv(:) = 0._r8 - wtus_road_imperv(:) = 0._r8 - wtus_sunwall(:) = 0._r8 - wtus_shadewall(:) = 0._r8 - wtuq_roof(:) = 0._r8 - wtuq_road_perv(:) = 0._r8 - wtuq_road_imperv(:) = 0._r8 - wtuq_sunwall(:) = 0._r8 - wtuq_shadewall(:) = 0._r8 - - ! Make copies so that array sections are not passed in function calls to friction velocity - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - z_d_town_loc(l) = z_d_town(l) - z_0_town_loc(l) = z_0_town(l) - end do - - ! Start stability iteration - - do iter = 1,niters - - ! Get friction velocity, relation for potential - ! temperature and humidity profiles of surface boundary layer. - - if (num_urbanl .gt. 0) then - call FrictionVelocity(lbl, ubl, num_urbanl, filter_urbanl, & - z_d_town_loc, z_0_town_loc, z_0_town_loc, z_0_town_loc, & - obu, iter, ur, um, ustar, & - temp1, temp2, temp12m, temp22m, fm, landunit_index=.true.) - end if - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - ! Determine aerodynamic resistance to fluxes from urban canopy air to - ! atmosphere - - ramu(l) = 1._r8/(ustar(l)*ustar(l)/um(l)) - rahu(l) = 1._r8/(temp1(l)*ustar(l)) - rawu(l) = 1._r8/(temp2(l)*ustar(l)) - - ! Determine magnitude of canyon wind by using horizontal wind determined - ! previously and vertical wind from friction velocity (Masson 2000) - - canyon_wind(fl) = sqrt(canyon_u_wind(fl)**2._r8 + ustar(l)**2._r8) - - ! Determine canyon_resistance (currently this single resistance determines the - ! resistance from urban surfaces (roof, pervious and impervious road, sunlit and - ! shaded walls) to urban canopy air, since it is only dependent on wind speed - ! Also from Masson 2000. - - canyon_resistance(fl) = cpair * forc_rho(g) / (11.8_r8 + 4.2_r8*canyon_wind(fl)) - - end do - - ! This is the first term in the equation solutions for urban canopy air temperature - ! and specific humidity (numerator) and is a landunit quantity - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - taf_numer(l) = thm_g(l)/rahu(l) - taf_denom(l) = 1._r8/rahu(l) - qaf_numer(l) = forc_q(g)/rawu(l) - qaf_denom(l) = 1._r8/rawu(l) - - ! First term needed for derivative of heat fluxes - wtas(l) = 1._r8/rahu(l) - wtaq(l) = 1._r8/rawu(l) - - end do - - - ! Gather other terms for other urban columns for numerator and denominator of - ! equations for urban canopy air temperature and specific humidity - - do pi = 1,maxpatch_urb - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if ( pi <= npfts(l) ) then - c = coli(l) + pi - 1 - - if (ctype(c) == icol_roof) then - - ! scaled sensible heat conductance - wtus(c) = wtlunit_roof(fl)/canyon_resistance(fl) - ! unscaled sensible heat conductance - wtus_roof(l) = 1._r8/canyon_resistance(fl) - - if (snowdp(c) > 0._r8) then - fwet_roof = min(snowdp(c)/0.05_r8, 1._r8) - else - fwet_roof = (max(0._r8, h2osoi_liq(c,1)+h2osoi_ice(c,1))/pondmx_urban)**0.666666666666_r8 - fwet_roof = min(fwet_roof,1._r8) - end if - if (qaf(l) > qg(c)) then - fwet_roof = 1._r8 - end if - ! scaled latent heat conductance - wtuq(c) = fwet_roof*(wtlunit_roof(fl)/canyon_resistance(fl)) - ! unscaled latent heat conductance - wtuq_roof(l) = fwet_roof*(1._r8/canyon_resistance(fl)) - - ! wasteheat from heating/cooling - if (trim(urban_hac) == urban_wasteheat_on) then - eflx_wasteheat_roof(l) = ac_wasteheat_factor * eflx_urban_ac(c) + & - ht_wasteheat_factor * eflx_urban_heat(c) - else - eflx_wasteheat_roof(l) = 0._r8 - end if - - ! If air conditioning on, always replace heat removed with heat into canyon - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - eflx_heat_from_ac_roof(l) = abs(eflx_urban_ac(c)) - else - eflx_heat_from_ac_roof(l) = 0._r8 - end if - - else if (ctype(c) == icol_road_perv) then - - ! scaled sensible heat conductance - wtus(c) = wtroad_perv(fl)*(1._r8-wtlunit_roof(fl))/canyon_resistance(fl) - ! unscaled sensible heat conductance - if (wtroad_perv(fl) > 0._r8) then - wtus_road_perv(l) = 1._r8/canyon_resistance(fl) - else - wtus_road_perv(l) = 0._r8 - end if - - ! scaled latent heat conductance - wtuq(c) = wtroad_perv(fl)*(1._r8-wtlunit_roof(fl))/canyon_resistance(fl) - ! unscaled latent heat conductance - if (wtroad_perv(fl) > 0._r8) then - wtuq_road_perv(l) = 1._r8/canyon_resistance(fl) - else - wtuq_road_perv(l) = 0._r8 - end if - - else if (ctype(c) == icol_road_imperv) then - - ! scaled sensible heat conductance - wtus(c) = (1._r8-wtroad_perv(fl))*(1._r8-wtlunit_roof(fl))/canyon_resistance(fl) - ! unscaled sensible heat conductance - if ((1._r8-wtroad_perv(fl)) > 0._r8) then - wtus_road_imperv(l) = 1._r8/canyon_resistance(fl) - else - wtus_road_imperv(l) = 0._r8 - end if - - if (snowdp(c) > 0._r8) then - fwet_road_imperv = min(snowdp(c)/0.05_r8, 1._r8) - else - fwet_road_imperv = (max(0._r8, h2osoi_liq(c,1)+h2osoi_ice(c,1))/pondmx_urban)**0.666666666666_r8 - fwet_road_imperv = min(fwet_road_imperv,1._r8) - end if - if (qaf(l) > qg(c)) then - fwet_road_imperv = 1._r8 - end if - ! scaled latent heat conductance - wtuq(c) = fwet_road_imperv*(1._r8-wtroad_perv(fl))*(1._r8-wtlunit_roof(fl))/canyon_resistance(fl) - ! unscaled latent heat conductance - if ((1._r8-wtroad_perv(fl)) > 0._r8) then - wtuq_road_imperv(l) = fwet_road_imperv*(1._r8/canyon_resistance(fl)) - else - wtuq_road_imperv(l) = 0._r8 - end if - - else if (ctype(c) == icol_sunwall) then - - ! scaled sensible heat conductance - wtus(c) = canyon_hwr(fl)*(1._r8-wtlunit_roof(fl))/canyon_resistance(fl) - ! unscaled sensible heat conductance - wtus_sunwall(l) = 1._r8/canyon_resistance(fl) - - ! scaled latent heat conductance - wtuq(c) = 0._r8 - ! unscaled latent heat conductance - wtuq_sunwall(l) = 0._r8 - - ! wasteheat from heating/cooling - if (trim(urban_hac) == urban_wasteheat_on) then - eflx_wasteheat_sunwall(l) = ac_wasteheat_factor * eflx_urban_ac(c) + & - ht_wasteheat_factor * eflx_urban_heat(c) - else - eflx_wasteheat_sunwall(l) = 0._r8 - end if - - ! If air conditioning on, always replace heat removed with heat into canyon - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - eflx_heat_from_ac_sunwall(l) = abs(eflx_urban_ac(c)) - else - eflx_heat_from_ac_sunwall(l) = 0._r8 - end if - - else if (ctype(c) == icol_shadewall) then - - ! scaled sensible heat conductance - wtus(c) = canyon_hwr(fl)*(1._r8-wtlunit_roof(fl))/canyon_resistance(fl) - ! unscaled sensible heat conductance - wtus_shadewall(l) = 1._r8/canyon_resistance(fl) - - ! scaled latent heat conductance - wtuq(c) = 0._r8 - ! unscaled latent heat conductance - wtuq_shadewall(l) = 0._r8 - - ! wasteheat from heating/cooling - if (trim(urban_hac) == urban_wasteheat_on) then - eflx_wasteheat_shadewall(l) = ac_wasteheat_factor * eflx_urban_ac(c) + & - ht_wasteheat_factor * eflx_urban_heat(c) - else - eflx_wasteheat_shadewall(l) = 0._r8 - end if - - ! If air conditioning on, always replace heat removed with heat into canyon - if (trim(urban_hac) == urban_hac_on .or. trim(urban_hac) == urban_wasteheat_on) then - eflx_heat_from_ac_shadewall(l) = abs(eflx_urban_ac(c)) - else - eflx_heat_from_ac_shadewall(l) = 0._r8 - end if - else - write(iulog,*) 'c, ctype, pi = ', c, ctype(c), pi - write(iulog,*) 'Column indices for: shadewall, sunwall, road_imperv, road_perv, roof: ' - write(iulog,*) icol_shadewall, icol_sunwall, icol_road_imperv, icol_road_perv, icol_roof - call endrun( sub//':: ERROR, ctype out of range' ) - end if - - taf_numer(l) = taf_numer(l) + t_grnd(c)*wtus(c) - taf_denom(l) = taf_denom(l) + wtus(c) - qaf_numer(l) = qaf_numer(l) + qg(c)*wtuq(c) - qaf_denom(l) = qaf_denom(l) + wtuq(c) - - end if - end do - end do - - ! Calculate new urban canopy air temperature and specific humidity - - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - ! Total waste heat and heat from AC is sum of heat for walls and roofs - ! accounting for different surface areas - eflx_wasteheat(l) = wtlunit_roof(fl)*eflx_wasteheat_roof(l) + & - (1._r8-wtlunit_roof(fl))*(canyon_hwr(fl)*(eflx_wasteheat_sunwall(l) + & - eflx_wasteheat_shadewall(l))) - - ! Limit wasteheat to ensure that we don't get any unrealistically strong - ! positive feedbacks due to AC in a warmer climate - eflx_wasteheat(l) = min(eflx_wasteheat(l),wasteheat_limit) - - eflx_heat_from_ac(l) = wtlunit_roof(fl)*eflx_heat_from_ac_roof(l) + & - (1._r8-wtlunit_roof(fl))*(canyon_hwr(fl)*(eflx_heat_from_ac_sunwall(l) + & - eflx_heat_from_ac_shadewall(l))) - - ! Calculate traffic heat flux - ! Only comes from impervious road - eflx_traffic(l) = (1._r8-wtlunit_roof(fl))*(1._r8-wtroad_perv(fl))* & - eflx_traffic_factor(l) - - taf(l) = taf_numer(l)/taf_denom(l) - qaf(l) = qaf_numer(l)/qaf_denom(l) - - wts_sum(l) = wtas(l) + wtus_roof(l) + wtus_road_perv(l) + & - wtus_road_imperv(l) + wtus_sunwall(l) + wtus_shadewall(l) - - wtq_sum(l) = wtaq(l) + wtuq_roof(l) + wtuq_road_perv(l) + & - wtuq_road_imperv(l) + wtuq_sunwall(l) + wtuq_shadewall(l) - - end do - - ! This section of code is not required if niters = 1 - ! Determine stability using new taf and qaf - ! TODO: Some of these constants replicate what is in FrictionVelocity and BareGround fluxes should consildate. EBK - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - - dth(l) = thm_g(l)-taf(l) - dqh(l) = forc_q(g)-qaf(l) - tstar = temp1(l)*dth(l) - qstar = temp2(l)*dqh(l) - thvstar = tstar*(1._r8+0.61_r8*forc_q(g)) + 0.61_r8*forc_th(g)*qstar - zeta = zldis(l)*vkc*grav*thvstar/(ustar(l)**2*thv_g(l)) - - if (zeta >= 0._r8) then !stable - zeta = min(2._r8,max(zeta,0.01_r8)) - um(l) = max(ur(l),0.1_r8) - else !unstable - zeta = max(-100._r8,min(zeta,-0.01_r8)) - wc = beta(l)*(-grav*ustar(l)*thvstar*zii(l)/thv_g(l))**0.333_r8 - um(l) = sqrt(ur(l)*ur(l) + wc*wc) - end if - - obu(l) = zldis(l)/zeta - end do - - end do ! end iteration - -! Determine fluxes from canyon surfaces - - do f = 1, num_urbanp - - p = filter_urbanp(f) - c = pcolumn(p) - g = pgridcell(p) - l = plandunit(p) - - ram1(p) = ramu(l) !pass value to global variable - - ! Upward and downward canopy longwave are zero - - ulrad(p) = 0._r8 - dlrad(p) = 0._r8 - - ! Derivative of sensible and latent heat fluxes with respect to - ! ground temperature - - if (ctype(c) == icol_roof) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_road_perv(l) + & - wtus_road_imperv(l) + wtus_sunwall(l) + wtus_shadewall(l)) * & - (wtus_roof(l)/wts_sum(l)) - cgrndl(p) = forc_rho(g) * (wtaq(l) + wtuq_road_perv(l) + & - wtuq_road_imperv(l) + wtuq_sunwall(l) + wtuq_shadewall(l)) * & - (wtuq_roof(l)/wtq_sum(l))*dqgdT(c) - else if (ctype(c) == icol_road_perv) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_imperv(l) + wtus_sunwall(l) + wtus_shadewall(l)) * & - (wtus_road_perv(l)/wts_sum(l)) - cgrndl(p) = forc_rho(g) * (wtaq(l) + wtuq_roof(l) + & - wtuq_road_imperv(l) + wtuq_sunwall(l) + wtuq_shadewall(l)) * & - (wtuq_road_perv(l)/wtq_sum(l))*dqgdT(c) - else if (ctype(c) == icol_road_imperv) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_perv(l) + wtus_sunwall(l) + wtus_shadewall(l)) * & - (wtus_road_imperv(l)/wts_sum(l)) - cgrndl(p) = forc_rho(g) * (wtaq(l) + wtuq_roof(l) + & - wtuq_road_perv(l) + wtuq_sunwall(l) + wtuq_shadewall(l)) * & - (wtuq_road_imperv(l)/wtq_sum(l))*dqgdT(c) - else if (ctype(c) == icol_sunwall) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_perv(l) + wtus_road_imperv(l) + wtus_shadewall(l)) * & - (wtus_sunwall(l)/wts_sum(l)) - cgrndl(p) = 0._r8 - else if (ctype(c) == icol_shadewall) then - cgrnds(p) = forc_rho(g) * cpair * (wtas(l) + wtus_roof(l) + & - wtus_road_perv(l) + wtus_road_imperv(l) + wtus_sunwall(l)) * & - (wtus_shadewall(l)/wts_sum(l)) - cgrndl(p) = 0._r8 - end if - cgrnd(p) = cgrnds(p) + cgrndl(p)*htvp(c) - - ! Surface fluxes of momentum, sensible and latent heat - - taux(p) = -forc_rho(g)*forc_u(g)/ramu(l) - tauy(p) = -forc_rho(g)*forc_v(g)/ramu(l) - - ! Use new canopy air temperature - dth(l) = taf(l) - t_grnd(c) - - if (ctype(c) == icol_roof) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_roof(l)*dth(l) - else if (ctype(c) == icol_road_perv) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_road_perv(l)*dth(l) - else if (ctype(c) == icol_road_imperv) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_road_imperv(l)*dth(l) - else if (ctype(c) == icol_sunwall) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_sunwall(l)*dth(l) - else if (ctype(c) == icol_shadewall) then - eflx_sh_grnd(p) = -forc_rho(g)*cpair*wtus_shadewall(l)*dth(l) - end if - - eflx_sh_tot(p) = eflx_sh_grnd(p) - eflx_sh_tot_u(p) = eflx_sh_tot(p) - - dqh(l) = qaf(l) - qg(c) - - if (ctype(c) == icol_roof) then - qflx_evap_soi(p) = -forc_rho(g)*wtuq_roof(l)*dqh(l) - else if (ctype(c) == icol_road_perv) then - ! Evaporation assigned to soil term if dew or snow - ! or if no liquid water available in soil column - if (dqh(l) > 0._r8 .or. frac_sno(c) > 0._r8 .or. soilalpha_u(c) .le. 0._r8) then - qflx_evap_soi(p) = -forc_rho(g)*wtuq_road_perv(l)*dqh(l) - qflx_tran_veg(p) = 0._r8 - ! Otherwise, evaporation assigned to transpiration term - else - qflx_evap_soi(p) = 0._r8 - qflx_tran_veg(p) = -forc_rho(g)*wtuq_road_perv(l)*dqh(l) - end if - qflx_evap_veg(p) = qflx_tran_veg(p) - else if (ctype(c) == icol_road_imperv) then - qflx_evap_soi(p) = -forc_rho(g)*wtuq_road_imperv(l)*dqh(l) - else if (ctype(c) == icol_sunwall) then - qflx_evap_soi(p) = 0._r8 - else if (ctype(c) == icol_shadewall) then - qflx_evap_soi(p) = 0._r8 - end if - - ! SCALED sensible and latent heat flux for error check - eflx_sh_grnd_scale(p) = -forc_rho(g)*cpair*wtus(c)*dth(l) - qflx_evap_soi_scale(p) = -forc_rho(g)*wtuq(c)*dqh(l) - - end do - - ! Check to see that total sensible and latent heat equal the sum of - ! the scaled heat fluxes above - do fl = 1, num_urbanl - l = filter_urbanl(fl) - g = lgridcell(l) - eflx(l) = -(forc_rho(g)*cpair/rahu(l))*(thm_g(l) - taf(l)) - qflx(l) = -(forc_rho(g)/rawu(l))*(forc_q(g) - qaf(l)) - eflx_scale(l) = sum(eflx_sh_grnd_scale(pfti(l):pftf(l))) - qflx_scale(l) = sum(qflx_evap_soi_scale(pfti(l):pftf(l))) - eflx_err(l) = eflx_scale(l) - eflx(l) - qflx_err(l) = qflx_scale(l) - qflx(l) - end do - - found = .false. - do fl = 1, num_urbanl - l = filter_urbanl(fl) - if (abs(eflx_err(l)) > 0.01_r8) then - found = .true. - indexl = l - exit - end if - end do - if ( found ) then - write(iulog,*)'WARNING: Total sensible heat does not equal sum of scaled heat fluxes for urban columns ',& - ' nstep = ',nstep,' indexl= ',indexl,' eflx_err= ',eflx_err(indexl) - if (abs(eflx_err(indexl)) > .01_r8) then - write(iulog,*)'clm model is stopping - error is greater than .01 W/m**2' - write(iulog,*)'eflx_scale = ',eflx_scale(indexl) - write(iulog,*)'eflx_sh_grnd_scale: ',eflx_sh_grnd_scale(pfti(indexl):pftf(indexl)) - write(iulog,*)'eflx = ',eflx(indexl) - call endrun - end if - end if - - found = .false. - do fl = 1, num_urbanl - l = filter_urbanl(fl) - ! 4.e-9 kg/m**2/s = 0.01 W/m**2 - if (abs(qflx_err(l)) > 4.e-9_r8) then - found = .true. - indexl = l - exit - end if - end do - if ( found ) then - write(iulog,*)'WARNING: Total water vapor flux does not equal sum of scaled water vapor fluxes for urban columns ',& - ' nstep = ',nstep,' indexl= ',indexl,' qflx_err= ',qflx_err(indexl) - if (abs(qflx_err(indexl)) > 4.e-9_r8) then - write(iulog,*)'clm model is stopping - error is greater than 4.e-9 kg/m**2/s' - write(iulog,*)'qflx_scale = ',qflx_scale(indexl) - write(iulog,*)'qflx = ',qflx(indexl) - call endrun - end if - end if - - ! Gather terms required to determine internal building temperature - - do pi = 1,maxpatch_urb - do fl = 1,num_urbanl - l = filter_urbanl(fl) - if ( pi <= npfts(l) ) then - c = coli(l) + pi - 1 - - if (ctype(c) == icol_roof) then - t_roof_innerl(l) = t_soisno(c,nlevurb) - else if (ctype(c) == icol_sunwall) then - t_sunwall_innerl(l) = t_soisno(c,nlevurb) - else if (ctype(c) == icol_shadewall) then - t_shadewall_innerl(l) = t_soisno(c,nlevurb) - end if - - end if - end do - end do - - ! Calculate internal building temperature - do fl = 1, num_urbanl - l = filter_urbanl(fl) - - lngth_roof = (ht_roof(fl)/canyon_hwr(fl))*wtlunit_roof(fl)/(1._r8-wtlunit_roof(fl)) - t_building(l) = (ht_roof(fl)*(t_shadewall_innerl(l) + t_sunwall_innerl(l)) & - +lngth_roof*t_roof_innerl(l))/(2._r8*ht_roof(fl)+lngth_roof) - end do - - ! No roots for urban except for pervious road - - do j = 1, nlevurb - do f = 1, num_urbanp - p = filter_urbanp(f) - c = pcolumn(p) - if (ctype(c) == icol_road_perv) then - rootr(p,j) = rootr_road_perv(c,j) - else - rootr(p,j) = 0._r8 - end if - end do - end do - - do f = 1, num_urbanp - - p = filter_urbanp(f) - c = pcolumn(p) - g = pgridcell(p) - l = plandunit(p) - - ! Use urban canopy air temperature and specific humidity to represent - ! 2-m temperature and humidity - - t_ref2m(p) = taf(l) - q_ref2m(p) = qaf(l) - t_ref2m_u(p) = taf(l) - - ! 2 m height relative humidity - - call QSat(t_ref2m(p), forc_pbot(g), e_ref2m, de2mdT, qsat_ref2m, dqsat2mdT) - rh_ref2m(p) = min(100._r8, q_ref2m(p) / qsat_ref2m * 100._r8) - rh_ref2m_u(p) = rh_ref2m(p) - - ! Variables needed by history tape - - t_veg(p) = forc_t(g) - - ! Add the following to avoid NaN - - psnsun(p) = 0._r8 - psnsha(p) = 0._r8 - pps%lncsun(p) = 0._r8 - pps%lncsha(p) = 0._r8 - pps%vcmxsun(p) = 0._r8 - pps%vcmxsha(p) = 0._r8 - - end do - - end subroutine UrbanFluxes - -end module UrbanMod diff --git a/src_clm40/biogeophys/clm_driverInitMod.F90 b/src_clm40/biogeophys/clm_driverInitMod.F90 deleted file mode 100644 index ac28ed9558..0000000000 --- a/src_clm40/biogeophys/clm_driverInitMod.F90 +++ /dev/null @@ -1,247 +0,0 @@ - -module clm_driverInitMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_driverInitMod -! -! !DESCRIPTION: -! Initialization of clm driver variables needed from previous timestep -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: clm_driverInit -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: clm_driverInit -! -! !INTERFACE: - subroutine clm_driverInit(lbc, ubc, lbp, ubp, & - num_nolakec, filter_nolakec, num_lakec, filter_lakec) -! -! !DESCRIPTION: -! Initialization of clm driver variables needed from previous timestep -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_varpar , only : nlevsno - use subgridAveMod, only : p2c - use clm_varcon, only : h2osno_max, rair, cpair, grav, istice_mec, lapse_glcmec - use clm_atmlnd, only : clm_a2l - use domainMod, only : ldomain - use clmtype - use QsatMod, only : Qsat - -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column-index bounds - integer, intent(in) :: lbp, ubp ! pft-index bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points - integer, intent(in) :: num_lakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_lakec(ubc-lbc+1) ! column filter for non-lake points -! -! !CALLED FROM: -! subroutine driver1 -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -! -! local pointers to original implicit in variables -! - real(r8), pointer :: pwtgcell(:) ! weight of pft wrt corresponding gridcell - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - integer , pointer :: frac_veg_nosno_alb(:) ! fraction of vegetation not covered by snow (0 OR 1) [-] - integer , pointer :: frac_veg_nosno(:) ! fraction of vegetation not covered by snow (0 OR 1 now) [-] (pft-level) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) -! -! local pointers to original implicit out variables -! - logical , pointer :: do_capsnow(:) ! true => do snow capping - real(r8), pointer :: h2osno_old(:) ! snow water (mm H2O) at previous time step - real(r8), pointer :: frac_iceold(:,:) ! fraction of ice relative to the tot water -! -! !OTHER LOCAL VARIABLES: -!EOP -! - integer :: g, l, c, p, f, j, fc ! indices - - real(r8), pointer :: qflx_glcice(:) ! flux of new glacier ice (mm H2O/s) [+ = ice grows] - real(r8), pointer :: eflx_bot(:) ! heat flux from beneath soil/ice column (W/m**2) - real(r8), pointer :: glc_topo(:) ! sfc elevation for glacier_mec column (m) - real(r8), pointer :: forc_t(:) ! atmospheric temperature (Kelvin) - real(r8), pointer :: forc_th(:) ! atmospheric potential temperature (Kelvin) - real(r8), pointer :: forc_q(:) ! atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_pbot(:) ! atmospheric pressure (Pa) - real(r8), pointer :: forc_rho(:) ! atmospheric density (kg/m**3) - integer , pointer :: cgridcell(:) ! column's gridcell - integer , pointer :: clandunit(:) ! column's landunit - integer , pointer :: plandunit(:) ! pft's landunit - integer , pointer :: ityplun(:) ! landunit type - - ! temporaries for topo downscaling - real(r8) :: hsurf_g,hsurf_c,Hbot - real(r8) :: zbot_g, tbot_g, pbot_g, thbot_g, qbot_g, qs_g, es_g - real(r8) :: zbot_c, tbot_c, pbot_c, thbot_c, qbot_c, qs_c, es_c - real(r8) :: egcm_c, rhos_c - real(r8) :: dum1, dum2 - -!----------------------------------------------------------------------- - - ! Assign local pointers to derived type members (landunit-level) - - ityplun => lun%itype - - ! Assign local pointers to derived type members (column-level) - - snl => cps%snl - h2osno => cws%h2osno - h2osno_old => cws%h2osno_old - do_capsnow => cps%do_capsnow - frac_iceold => cps%frac_iceold - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - frac_veg_nosno_alb => pps%frac_veg_nosno_alb - frac_veg_nosno => pps%frac_veg_nosno - qflx_glcice => cwf%qflx_glcice - eflx_bot => cef%eflx_bot - glc_topo => cps%glc_topo - forc_t => ces%forc_t - forc_th => ces%forc_th - forc_q => cws%forc_q - forc_pbot => cps%forc_pbot - forc_rho => cps%forc_rho - clandunit => col%landunit - cgridcell => col%gridcell - - ! Assign local pointers to derived type members (pft-level) - - pwtgcell => pft%wtgcell - plandunit => pft%landunit - - do c = lbc, ubc - - l = clandunit(c) - g = cgridcell(c) - - ! Initialize column forcing - - forc_t(c) = clm_a2l%forc_t(g) - forc_th(c) = clm_a2l%forc_th(g) - forc_q(c) = clm_a2l%forc_q(g) - forc_pbot(c) = clm_a2l%forc_pbot(g) - forc_rho(c) = clm_a2l%forc_rho(g) - - ! Save snow mass at previous time step - h2osno_old(c) = h2osno(c) - - ! Decide whether to cap snow - if (h2osno(c) > h2osno_max) then - do_capsnow(c) = .true. - else - do_capsnow(c) = .false. - end if - eflx_bot(c) = 0._r8 - - ! Initialize qflx_glcice, but only over ice_mec landunits (elsewhere, it is spval) - if (ityplun(l) == istice_mec) then - qflx_glcice(c) = 0._r8 - end if - - end do - - ! Initialize fraction of vegetation not covered by snow (pft-level) - - do p = lbp,ubp - l = plandunit(p) - ! Note: Some glacier_mec points may have zero weight - if (pwtgcell(p)>0._r8 .or. ityplun(l) == istice_mec) then - frac_veg_nosno(p) = frac_veg_nosno_alb(p) - else - frac_veg_nosno(p) = 0._r8 - end if - end do - - ! Initialize set of previous time-step variables - ! Ice fraction of snow at previous time step - - do j = -nlevsno+1,0 - do f = 1, num_nolakec - c = filter_nolakec(f) - if (j >= snl(c) + 1) then - frac_iceold(c,j) = h2osoi_ice(c,j)/(h2osoi_liq(c,j)+h2osoi_ice(c,j)) - end if - end do - end do - - ! Downscale forc_t, forc_th, forc_q, forc_pbot, and forc_rho to columns. - ! For glacier_mec columns the downscaling is based on surface elevation. - ! For other columns the downscaling is a simple copy. - - do f = 1, num_nolakec - c = filter_nolakec(f) - l = clandunit(c) - g = cgridcell(c) - - if (ityplun(l) == istice_mec) then ! downscale to elevation classes - - ! This is a simple downscaling procedure taken from subroutine clm_mapa2l. - ! Note that forc_hgt, forc_u, and forc_v are not downscaled. - - hsurf_g = ldomain%topo(g) ! gridcell sfc elevation - hsurf_c = glc_topo(c) ! column sfc elevation - - tbot_g = clm_a2l%forc_t(g) ! atm sfc temp - thbot_g = clm_a2l%forc_th(g) ! atm sfc pot temp - qbot_g = clm_a2l%forc_q(g) ! atm sfc spec humid - pbot_g = clm_a2l%forc_pbot(g) ! atm sfc pressure - zbot_g = clm_a2l%forc_hgt(g) ! atm ref height - - zbot_c = zbot_g - tbot_c = tbot_g-lapse_glcmec*(hsurf_c-hsurf_g) ! sfc temp for column - - Hbot = rair*0.5_r8*(tbot_g+tbot_c)/grav ! scale ht at avg temp - pbot_c = pbot_g*exp(-(hsurf_c-hsurf_g)/Hbot) ! column sfc press - thbot_c= tbot_c*exp((zbot_c/Hbot)*(rair/cpair)) ! pot temp calc - - call Qsat(tbot_g,pbot_g,es_g,dum1,qs_g,dum2) - call Qsat(tbot_c,pbot_c,es_c,dum1,qs_c,dum2) - - qbot_c = qbot_g*(qs_c/qs_g) - egcm_c = qbot_c*pbot_c/(0.622+0.378*qbot_c) - rhos_c = (pbot_c-0.378*egcm_c) / (rair*tbot_c) - - forc_t(c) = tbot_c - forc_th(c) = thbot_c - forc_q(c) = qbot_c - forc_pbot(c) = pbot_c - forc_rho(c) = rhos_c - - endif - - enddo ! num_nolakec - - end subroutine clm_driverInit - -end module clm_driverInitMod diff --git a/src_clm40/main/CMakeLists.txt b/src_clm40/main/CMakeLists.txt deleted file mode 100644 index f5594094fd..0000000000 --- a/src_clm40/main/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Note that this is just used for unit testing; hence, we only need to add -# source files that are currently used in unit tests - -list(APPEND clm_sources domainMod.F90) - -sourcelist_to_parent(clm_sources) diff --git a/src_clm40/main/CNiniSpecial.F90 b/src_clm40/main/CNiniSpecial.F90 deleted file mode 100644 index 91677c0dbb..0000000000 --- a/src_clm40/main/CNiniSpecial.F90 +++ /dev/null @@ -1,223 +0,0 @@ -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNiniSpecial -! -! !INTERFACE: -subroutine CNiniSpecial () -! -! !DESCRIPTION: -! One-time initialization of CN variables for special landunits -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use pftvarcon , only: noveg - use decompMod , only: get_proc_bounds - use clm_varcon , only: spval - use clm_varctl , only: iulog, use_c13, use_cn - use clmtype - use CNSetValueMod -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine iniTimeConst in file iniTimeConst.F90 -! -! !REVISION HISTORY: -! 11/13/03: Created by Peter Thornton -! -! -! local pointers to implicit in arguments -! - integer , pointer :: clandunit(:) ! landunit index of corresponding column - integer , pointer :: plandunit(:) ! landunit index of corresponding pft - logical , pointer :: ifspecial(:) ! BOOL: true=>landunit is wetland,ice,lake, or urban -! -! local pointers to implicit out arguments -! -! !LOCAL VARIABLES: -!EOP - integer :: fc,fp,l,c,p ! indices - integer :: begp, endp ! per-clump/proc beginning and ending pft indices - integer :: begc, endc ! per-clump/proc beginning and ending column indices - integer :: begl, endl ! per-clump/proc beginning and ending landunit indices - integer :: begg, endg ! per-clump/proc gridcell ending gridcell indices - integer :: num_specialc ! number of good values in specialc filter - integer :: num_specialp ! number of good values in specialp filter - integer, allocatable :: specialc(:) ! special landunit filter - columns - integer, allocatable :: specialp(:) ! special landunit filter - pfts -!----------------------------------------------------------------------- - ! assign local pointers at the landunit level - ifspecial => lun%ifspecial - - ! assign local pointers at the column level - clandunit => col%landunit - - ! assign local pointers at the pft level - plandunit => pft%landunit - - ! Determine subgrid bounds on this processor - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! allocate special landunit filters - allocate(specialc(endc-begc+1)) - allocate(specialp(endp-begp+1)) - - ! fill special landunit filters - num_specialc = 0 - do c = begc, endc - l = clandunit(c) - if (ifspecial(l)) then - num_specialc = num_specialc + 1 - specialc(num_specialc) = c - end if - end do - - num_specialp = 0 - do p = begp, endp - l = plandunit(p) - if (ifspecial(l)) then - num_specialp = num_specialp + 1 - specialp(num_specialp) = p - end if - end do - - ! initialize column-level fields - call CNSetCps(num_specialc, specialc, spval, cps) - call CNSetCcs(num_specialc, specialc, 0._r8, ccs) - call CNSetCns(num_specialc, specialc, 0._r8, cns) - call CNSetCcf(num_specialc, specialc, 0._r8, ccf) - call CNSetCnf(num_specialc, specialc, 0._r8, cnf) - if (use_c13) then - ! 4/14/05: PET - ! adding isotope code - call CNSetCcs(num_specialc, specialc, 0._r8, cc13s) - call CNSetCcf(num_specialc, specialc, 0._r8, cc13f) - endif - - ! initialize column-average pft fields - call CNSetPps(num_specialc, specialc, spval, pps_a) - call CNSetPcs(num_specialc, specialc, 0._r8, pcs_a) - call CNSetPns(num_specialc, specialc, 0._r8, pns_a) - call CNSetPcf(num_specialc, specialc, 0._r8, pcf_a) - call CNSetPnf(num_specialc, specialc, 0._r8, pnf_a) - - ! initialize pft-level fields - call CNSetPepv(num_specialp, specialp, spval, pepv) - call CNSetPps(num_specialp, specialp, spval, pps) - call CNSetPcs(num_specialp, specialp, 0._r8, pcs) - call CNSetPns(num_specialp, specialp, 0._r8, pns) - call CNSetPcf(num_specialp, specialp, 0._r8, pcf) - call CNSetPnf(num_specialp, specialp, 0._r8, pnf) - if (use_c13) then - ! 4/14/05: PET - ! adding isotope code - call CNSetPcs(num_specialp, specialp, 0._r8, pc13s) - call CNSetPcf(num_specialp, specialp, 0._r8, pc13f) - endif - - ! now loop through special filters and explicitly set the variables that - ! have to be in place for SurfaceAlbedo and biogeophysics - ! also set pcf%psnsun and pcf%psnsha to 0 (not included in CNSetPcf()) - - do fp = 1,num_specialp - p = specialp(fp) - pps%tlai(p) = 0._r8 - pps%tsai(p) = 0._r8 - pps%elai(p) = 0._r8 - pps%esai(p) = 0._r8 - pps%htop(p) = 0._r8 - pps%hbot(p) = 0._r8 - pps%fwet(p) = 0._r8 - pps%fdry(p) = 0._r8 - pps%frac_veg_nosno_alb(p) = 0._r8 - pps%frac_veg_nosno(p) = 0._r8 - pcf%psnsun(p) = 0._r8 - pcf%psnsha(p) = 0._r8 - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - pc13f%psnsun(p) = 0._r8 - pc13f%psnsha(p) = 0._r8 - endif - - end do - - do fc = 1,num_specialc - c = specialc(fc) - pcf_a%psnsun(c) = 0._r8 - pcf_a%psnsha(c) = 0._r8 - if (use_c13) then - ! 8/17/05: PET - ! Adding isotope code - pcf_a%psnsun(c) = 0._r8 - pcf_a%psnsha(c) = 0._r8 - endif - - ! adding dynpft code - ccs%seedc(c) = 0._r8 - ccs%prod10c(c) = 0._r8 - ccs%prod100c(c) = 0._r8 - ccs%totprodc(c) = 0._r8 - if (use_c13) then - cc13s%seedc(c) = 0._r8 - cc13s%prod10c(c) = 0._r8 - cc13s%prod100c(c) = 0._r8 - cc13s%totprodc(c) = 0._r8 - endif - cns%seedn(c) = 0._r8 - cns%prod10n(c) = 0._r8 - cns%prod100n(c) = 0._r8 - cns%totprodn(c) = 0._r8 - ccf%dwt_seedc_to_leaf(c) = 0._r8 - ccf%dwt_seedc_to_deadstem(c) = 0._r8 - ccf%dwt_conv_cflux(c) = 0._r8 - ccf%dwt_prod10c_gain(c) = 0._r8 - ccf%prod10c_loss(c) = 0._r8 - ccf%dwt_prod100c_gain(c) = 0._r8 - ccf%prod100c_loss(c) = 0._r8 - ccf%dwt_frootc_to_litr1c(c) = 0._r8 - ccf%dwt_frootc_to_litr2c(c) = 0._r8 - ccf%dwt_frootc_to_litr3c(c) = 0._r8 - ccf%dwt_livecrootc_to_cwdc(c) = 0._r8 - ccf%dwt_deadcrootc_to_cwdc(c) = 0._r8 - ccf%dwt_closs(c) = 0._r8 - ccf%landuseflux(c) = 0._r8 - ccf%landuptake(c) = 0._r8 - if (use_c13) then - cc13f%dwt_seedc_to_leaf(c) = 0._r8 - cc13f%dwt_seedc_to_deadstem(c) = 0._r8 - cc13f%dwt_conv_cflux(c) = 0._r8 - cc13f%dwt_prod10c_gain(c) = 0._r8 - cc13f%prod10c_loss(c) = 0._r8 - cc13f%dwt_prod100c_gain(c) = 0._r8 - cc13f%prod100c_loss(c) = 0._r8 - cc13f%dwt_frootc_to_litr1c(c) = 0._r8 - cc13f%dwt_frootc_to_litr2c(c) = 0._r8 - cc13f%dwt_frootc_to_litr3c(c) = 0._r8 - cc13f%dwt_livecrootc_to_cwdc(c) = 0._r8 - cc13f%dwt_deadcrootc_to_cwdc(c) = 0._r8 - cc13f%dwt_closs(c) = 0._r8 - endif - cnf%dwt_seedn_to_leaf(c) = 0._r8 - cnf%dwt_seedn_to_deadstem(c) = 0._r8 - cnf%dwt_conv_nflux(c) = 0._r8 - cnf%dwt_prod10n_gain(c) = 0._r8 - cnf%prod10n_loss(c) = 0._r8 - cnf%dwt_prod100n_gain(c) = 0._r8 - cnf%prod100n_loss(c) = 0._r8 - cnf%dwt_frootn_to_litr1n(c) = 0._r8 - cnf%dwt_frootn_to_litr2n(c) = 0._r8 - cnf%dwt_frootn_to_litr3n(c) = 0._r8 - cnf%dwt_livecrootn_to_cwdn(c) = 0._r8 - cnf%dwt_deadcrootn_to_cwdn(c) = 0._r8 - cnf%dwt_nloss(c) = 0._r8 - - end do - - ! deallocate special landunit filters - deallocate(specialc) - deallocate(specialp) - -end subroutine CNiniSpecial diff --git a/src_clm40/main/CNiniTimeVar.F90 b/src_clm40/main/CNiniTimeVar.F90 deleted file mode 100644 index 9f48a5ef65..0000000000 --- a/src_clm40/main/CNiniTimeVar.F90 +++ /dev/null @@ -1,875 +0,0 @@ -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNiniTimeVar -! -! !INTERFACE: -subroutine CNiniTimeVar() -! -! !DESCRIPTION: -! Initializes time varying variables used only in -! coupled carbon-nitrogen mode (CN): -! -! !USES: - use clmtype - use clm_atmlnd , only: clm_a2l - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varcon , only: istsoil - use clm_varcon , only: istcrop - use clm_varcon , only: c13ratio - use clm_varctl , only: use_c13, use_cndv - use pftvarcon , only: noveg - use pftvarcon , only: npcropmin - use decompMod , only: get_proc_bounds - use surfrdMod , only: crop_prog -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine iniTimeVar in file iniTimeVar.F90 -! -! !REVISION HISTORY: -! 10/21/03: Created by Peter Thornton -! -! -! local pointers to implicit in arguments -! - real(r8), pointer :: evergreen(:) ! binary flag for evergreen leaf habit (0 or 1) - real(r8), pointer :: woody(:) ! binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: leafcn(:) ! leaf C:N (gC/gN) - real(r8), pointer :: deadwdcn(:) ! dead wood (xylem and heartwood) C:N (gC/gN) - integer , pointer :: ivt(:) ! pft vegetation type - logical , pointer :: lakpoi(:) ! true => landunit is a lake point - integer , pointer :: plandunit(:) ! landunit index associated with each pft - integer , pointer :: clandunit(:) ! landunit index associated with each column - integer , pointer :: itypelun(:) ! landunit type -! -! local pointers to implicit out arguments -! - real(r8), pointer :: forc_hgt_u_pft(:) !observational height of wind at pft-level [m] - real(r8), pointer :: annsum_counter(:) ! seconds since last annual accumulator turnover - real(r8), pointer :: cannsum_npp(:) ! annual sum of NPP, averaged from pft-level (gC/m2/yr) - real(r8), pointer :: cannavg_t2m(:) !annual average of 2m air temperature, averaged from pft-level (K) - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: soil1n(:) ! (gN/m2) soil organic matter N (fast pool) - real(r8), pointer :: soil2n(:) ! (gN/m2) soil organic matter N (medium pool) - real(r8), pointer :: soil3n(:) ! (gN/m2) soil orgainc matter N (slow pool) - real(r8), pointer :: soil4n(:) ! (gN/m2) soil orgainc matter N (slowest pool) - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: grainc(:) ! (gC/m2) grain C - real(r8), pointer :: grainc_storage(:) ! (gC/m2) grain C storage - real(r8), pointer :: grainc_xfer(:) ! (gC/m2) grain C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool(:) ! (gC/m2) abstract C pool to meet excess MR demand - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: grainn(:) ! (gN/m2) grain N - real(r8), pointer :: grainn_storage(:) ! (gN/m2) grain N storage - real(r8), pointer :: grainn_xfer(:) ! (gN/m2) grain N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: npool(:) ! (gN/m2) temporary plant N pool - real(r8), pointer :: psnsun(:) ! sunlit leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: psnsha(:) ! shaded leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: c13_psnsun(:) ! sunlit leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: c13_psnsha(:) ! shaded leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: laisun(:) ! sunlit projected leaf area index - real(r8), pointer :: laisha(:) ! shaded projected leaf area index - real(r8), pointer :: dormant_flag(:) ! dormancy flag - real(r8), pointer :: days_active(:) ! number of days since last dormancy - real(r8), pointer :: onset_flag(:) ! onset flag - real(r8), pointer :: onset_counter(:) ! onset days counter - real(r8), pointer :: onset_gddflag(:) ! onset flag for growing degree day sum - real(r8), pointer :: onset_fdd(:) ! onset freezing degree days counter - real(r8), pointer :: onset_gdd(:) ! onset growing degree days - real(r8), pointer :: onset_swi(:) ! onset soil water index - real(r8), pointer :: offset_flag(:) ! offset flag - real(r8), pointer :: offset_counter(:) ! offset days counter - real(r8), pointer :: offset_fdd(:) ! offset freezing degree days counter - real(r8), pointer :: offset_swi(:) ! offset soil water index - real(r8), pointer :: lgsf(:) ! long growing season factor [0-1] - real(r8), pointer :: bglfr(:) ! background litterfall rate (1/s) - real(r8), pointer :: bgtr(:) ! background transfer rate (1/s) - real(r8), pointer :: dayl(:) ! daylength (seconds) - real(r8), pointer :: prev_dayl(:) ! daylength from previous timestep (seconds) - real(r8), pointer :: annavg_t2m(:) ! annual average 2m air temperature (K) - real(r8), pointer :: tempavg_t2m(:) ! temporary average 2m air temperature (K) - real(r8), pointer :: gpp(:) ! GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: availc(:) ! C flux available for allocation (gC/m2/s) - real(r8), pointer :: xsmrpool_recover(:) ! C flux assigned to recovery of negative cpool (gC/m2/s) - real(r8), pointer :: xsmrpool_c13ratio(:) ! C flux assigned to recovery of negative cpool (gC/m2/s) - real(r8), pointer :: alloc_pnow(:) ! fraction of current allocation to display as new growth (DIM) - real(r8), pointer :: c_allometry(:) ! C allocation index (DIM) - real(r8), pointer :: n_allometry(:) ! N allocation index (DIM) - real(r8), pointer :: plant_ndemand(:) ! N flux required to support initial GPP (gN/m2/s) - real(r8), pointer :: tempsum_potential_gpp(:) ! temporary annual sum of plant_ndemand - real(r8), pointer :: annsum_potential_gpp(:) ! annual sum of plant_ndemand - real(r8), pointer :: tempmax_retransn(:) ! temporary max of retranslocated N pool (gN/m2) - real(r8), pointer :: annmax_retransn(:) ! annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: avail_retransn(:) ! N flux available from retranslocation pool (gN/m2/s) - real(r8), pointer :: plant_nalloc(:) ! total allocated N flux (gN/m2/s) - real(r8), pointer :: plant_calloc(:) ! total allocated C flux (gC/m2/s) - real(r8), pointer :: excess_cflux(:) ! C flux not allocated due to downregulation (gC/m2/s) - real(r8), pointer :: downreg(:) ! fractional reduction in GPP due to N limitation (DIM) - real(r8), pointer :: tempsum_npp(:) ! temporary annual sum of NPP - real(r8), pointer :: annsum_npp(:) ! annual sum of NPP - real(r8), pointer :: tempsum_litfall(:) ! temporary annual sum of litfall - real(r8), pointer :: annsum_litfall(:) ! annual sum of litfall - real(r8), pointer :: rc13_canair(:) !C13O2/C12O2 in canopy air - real(r8), pointer :: rc13_psnsun(:) !C13O2/C12O2 in sunlit canopy psn flux - real(r8), pointer :: rc13_psnsha(:) !C13O2/C12O2 in shaded canopy psn flux - real(r8), pointer :: alphapsnsun(:) !sunlit 13c fractionation ([]) - real(r8), pointer :: alphapsnsha(:) !shaded 13c fractionation ([]) - real(r8), pointer :: qflx_drain(:) ! sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_irrig(:) !irrigation flux (mm H2O/s) - ! new variables for fire - real(r8), pointer :: wf(:) ! soil moisture in top 0.5 m - real(r8), pointer :: me(:) ! moisture of extinction (proportion) - real(r8), pointer :: fire_prob(:) ! daily fire probability (0-1) - real(r8), pointer :: mean_fire_prob(:) ! e-folding mean of daily fire probability (0-1) - real(r8), pointer :: fireseasonl(:) ! annual fire season length (days, <= days/year) - real(r8), pointer :: farea_burned(:) ! timestep fractional area burned (proportion) - real(r8), pointer :: ann_farea_burned(:) ! annual total fractional area burned (proportion) - real(r8), pointer :: col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - real(r8), pointer :: totcolc(:) ! (gC/m2) total column carbon, incl veg and cpool - real(r8), pointer :: totecosysc(:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool - real(r8), pointer :: totlitc(:) ! (gC/m2) total litter carbon - real(r8), pointer :: totsomc(:) ! (gC/m2) total soil organic matter carbon - - real(r8), pointer :: woodc(:) ! (gC/m2) pft-level wood C - real(r8), pointer :: col_ntrunc(:) ! (gN/m2) column-level sink for N truncation - real(r8), pointer :: totcoln(:) ! (gN/m2) total column nitrogen, incl veg - real(r8), pointer :: totecosysn(:) ! (gN/m2) total ecosystem nitrogen, incl veg - real(r8), pointer :: totlitn(:) ! (gN/m2) total litter nitrogen - real(r8), pointer :: totsomn(:) ! (gN/m2) total soil organic matter nitrogen - real(r8), pointer :: dispvegc(:) ! (gC/m2) displayed veg carbon, excluding storage and cpool - real(r8), pointer :: pft_ctrunc(:) ! (gC/m2) pft-level sink for C truncation - real(r8), pointer :: storvegc(:) ! (gC/m2) stored vegetation carbon, excluding cpool - real(r8), pointer :: totpftc(:) ! (gC/m2) total pft-level carbon, including cpool - real(r8), pointer :: totvegc(:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: prev_frootc_to_litter(:)!previous timestep froot C litterfall flux (gC/m2/s) - real(r8), pointer :: prev_leafc_to_litter(:) !previous timestep leaf C litterfall flux (gC/m2/s) - real(r8), pointer :: dispvegn(:) ! (gN/m2) displayed veg nitrogen, excluding storage - real(r8), pointer :: pft_ntrunc(:) ! (gN/m2) pft-level sink for N truncation - real(r8), pointer :: storvegn(:) ! (gN/m2) stored vegetation nitrogen - real(r8), pointer :: totpftn(:) ! (gN/m2) total pft-level nitrogen - real(r8), pointer :: totvegn(:) ! (gN/m2) total vegetation nitrogen - real(r8), pointer :: lncsha(:) ! leaf N concentration per unit projected LAI (gN leaf/m^2) - real(r8), pointer :: lncsun(:) ! leaf N concentration per unit projected LAI (gN leaf/m^2) - real(r8), pointer :: vcmxsha(:) ! shaded leaf Vcmax (umolCO2/m^2/s) - real(r8), pointer :: vcmxsun(:) ! sunlit leaf Vcmax (umolCO2/m^2/s) - ! 4/14/05: PET - ! Adding isotope code - real(r8), pointer :: cwdc13(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c13(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c13(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c13(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c13(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c13(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c13(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c13(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: c13_col_ctrunc(:) ! (gC/m2) C truncation term - real(r8), pointer :: leafc13(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc13_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc13_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc13(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc13_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc13_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc13(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc13_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc13_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc13(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc13_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc13_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc13(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc13_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc13_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc13(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc13_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc13_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: c13_gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: c13_gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: c13pool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: c13xsmrpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: c13_pft_ctrunc(:) ! (gC/m2) C truncation term - real(r8), pointer :: totvegc13(:) ! (gC/m2) total vegetation carbon, excluding cpool - ! dynamic landuse variables - real(r8), pointer :: seedc(:) ! (gC/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10c(:) ! (gC/m2) wood product C pool, 10-year lifespan - real(r8), pointer :: prod100c(:) ! (gC/m2) wood product C pool, 100-year lifespan - real(r8), pointer :: totprodc(:) ! (gC/m2) total wood product C - real(r8), pointer :: seedc13(:) ! (gC/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10c13(:) ! (gC/m2) wood product C13 pool, 10-year lifespan - real(r8), pointer :: prod100c13(:) ! (gC/m2) wood product C13 pool, 100-year lifespan - real(r8), pointer :: totprodc13(:) ! (gC/m2) total wood product C13 - real(r8), pointer :: seedn(:) ! (gN/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10n(:) ! (gN/m2) wood product N pool, 10-year lifespan - real(r8), pointer :: prod100n(:) ! (gN/m2) wood product N pool, 100-year lifespan - real(r8), pointer :: totprodn(:) ! (gN/m2) total wood product N -! -! !LOCAL VARIABLES: - integer :: g,l,c,p ! indices - integer :: begp, endp ! per-clump/proc beginning and ending pft indices - integer :: begc, endc ! per-clump/proc beginning and ending column indices - integer :: begl, endl ! per-clump/proc beginning and ending landunit indices - integer :: begg, endg ! per-clump/proc gridcell ending gridcell indices -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers at the gridcell level - - ! assign local pointers at the landunit level - lakpoi => lun%lakpoi - itypelun => lun%itype - - ! assign local pointers at the column level - clandunit => col%landunit - annsum_counter => cps%annsum_counter - cannsum_npp => cps%cannsum_npp - cannavg_t2m => cps%cannavg_t2m - wf => cps%wf - me => cps%me - fire_prob => cps%fire_prob - mean_fire_prob => cps%mean_fire_prob - fireseasonl => cps%fireseasonl - farea_burned => cps%farea_burned - ann_farea_burned => cps%ann_farea_burned - qflx_drain => cwf%qflx_drain - qflx_irrig => cwf%qflx_irrig - cwdc => ccs%cwdc - litr1c => ccs%litr1c - litr2c => ccs%litr2c - litr3c => ccs%litr3c - soil1c => ccs%soil1c - soil2c => ccs%soil2c - soil3c => ccs%soil3c - soil4c => ccs%soil4c - - ! dynamic landuse variables - seedc => ccs%seedc - prod10c => ccs%prod10c - prod100c => ccs%prod100c - totprodc => ccs%totprodc - seedc13 => cc13s%seedc - prod10c13 => cc13s%prod10c - prod100c13 => cc13s%prod100c - totprodc13 => cc13s%totprodc - seedn => cns%seedn - prod10n => cns%prod10n - prod100n => cns%prod100n - totprodn => cns%totprodn - - cwdn => cns%cwdn - litr1n => cns%litr1n - litr2n => cns%litr2n - litr3n => cns%litr3n - soil1n => cns%soil1n - soil2n => cns%soil2n - soil3n => cns%soil3n - soil4n => cns%soil4n - sminn => cns%sminn - col_ctrunc => ccs%col_ctrunc - totcolc => ccs%totcolc - totecosysc => ccs%totecosysc - totlitc => ccs%totlitc - totsomc => ccs%totsomc - - col_ntrunc => cns%col_ntrunc - totcoln => cns%totcoln - totecosysn => cns%totecosysn - totlitn => cns%totlitn - totsomn => cns%totsomn - - ! 4/14/05: PET - ! Adding isotope code - cwdc13 => cc13s%cwdc - litr1c13 => cc13s%litr1c - litr2c13 => cc13s%litr2c - litr3c13 => cc13s%litr3c - soil1c13 => cc13s%soil1c - soil2c13 => cc13s%soil2c - soil3c13 => cc13s%soil3c - soil4c13 => cc13s%soil4c - c13_col_ctrunc => cc13s%col_ctrunc - - ! assign local pointers at the pft level - ivt => pft%itype - plandunit => pft%landunit - leafc => pcs%leafc - leafc_storage => pcs%leafc_storage - leafc_xfer => pcs%leafc_xfer - grainc => pcs%grainc - grainc_storage => pcs%grainc_storage - grainc_xfer => pcs%grainc_xfer - frootc => pcs%frootc - frootc_storage => pcs%frootc_storage - frootc_xfer => pcs%frootc_xfer - livestemc => pcs%livestemc - livestemc_storage => pcs%livestemc_storage - livestemc_xfer => pcs%livestemc_xfer - deadstemc => pcs%deadstemc - deadstemc_storage => pcs%deadstemc_storage - deadstemc_xfer => pcs%deadstemc_xfer - livecrootc => pcs%livecrootc - livecrootc_storage => pcs%livecrootc_storage - livecrootc_xfer => pcs%livecrootc_xfer - deadcrootc => pcs%deadcrootc - deadcrootc_storage => pcs%deadcrootc_storage - deadcrootc_xfer => pcs%deadcrootc_xfer - gresp_storage => pcs%gresp_storage - gresp_xfer => pcs%gresp_xfer - cpool => pcs%cpool - xsmrpool => pcs%xsmrpool - forc_hgt_u_pft => pps%forc_hgt_u_pft - woodc => pcs%woodc - leafn => pns%leafn - leafn_storage => pns%leafn_storage - leafn_xfer => pns%leafn_xfer - grainn => pns%grainn - grainn_storage => pns%grainn_storage - grainn_xfer => pns%grainn_xfer - frootn => pns%frootn - frootn_storage => pns%frootn_storage - frootn_xfer => pns%frootn_xfer - livestemn => pns%livestemn - livestemn_storage => pns%livestemn_storage - livestemn_xfer => pns%livestemn_xfer - deadstemn => pns%deadstemn - deadstemn_storage => pns%deadstemn_storage - deadstemn_xfer => pns%deadstemn_xfer - livecrootn => pns%livecrootn - livecrootn_storage => pns%livecrootn_storage - livecrootn_xfer => pns%livecrootn_xfer - deadcrootn => pns%deadcrootn - deadcrootn_storage => pns%deadcrootn_storage - deadcrootn_xfer => pns%deadcrootn_xfer - retransn => pns%retransn - npool => pns%npool - psnsun => pcf%psnsun - psnsha => pcf%psnsha - - c13_psnsun => pc13f%psnsun - c13_psnsha => pc13f%psnsha - - laisun => pps%laisun - laisha => pps%laisha - dormant_flag => pepv%dormant_flag - days_active => pepv%days_active - onset_flag => pepv%onset_flag - onset_counter => pepv%onset_counter - onset_gddflag => pepv%onset_gddflag - onset_fdd => pepv%onset_fdd - onset_gdd => pepv%onset_gdd - onset_swi => pepv%onset_swi - offset_flag => pepv%offset_flag - offset_counter => pepv%offset_counter - offset_fdd => pepv%offset_fdd - offset_swi => pepv%offset_swi - lgsf => pepv%lgsf - bglfr => pepv%bglfr - bgtr => pepv%bgtr - dayl => pepv%dayl - prev_dayl => pepv%prev_dayl - annavg_t2m => pepv%annavg_t2m - tempavg_t2m => pepv%tempavg_t2m - gpp => pepv%gpp - availc => pepv%availc - xsmrpool_recover => pepv%xsmrpool_recover - - xsmrpool_c13ratio => pepv%xsmrpool_c13ratio - - alloc_pnow => pepv%alloc_pnow - c_allometry => pepv%c_allometry - n_allometry => pepv%n_allometry - plant_ndemand => pepv%plant_ndemand - tempsum_potential_gpp => pepv%tempsum_potential_gpp - annsum_potential_gpp => pepv%annsum_potential_gpp - tempmax_retransn => pepv%tempmax_retransn - annmax_retransn => pepv%annmax_retransn - avail_retransn => pepv%avail_retransn - plant_nalloc => pepv%plant_nalloc - plant_calloc => pepv%plant_calloc - excess_cflux => pepv%excess_cflux - downreg => pepv%downreg - tempsum_npp => pepv%tempsum_npp - annsum_npp => pepv%annsum_npp - tempsum_litfall => pepv%tempsum_litfall - annsum_litfall => pepv%annsum_litfall - dispvegc => pcs%dispvegc - pft_ctrunc => pcs%pft_ctrunc - storvegc => pcs%storvegc - totpftc => pcs%totpftc - totvegc => pcs%totvegc - prev_frootc_to_litter => pepv%prev_frootc_to_litter - prev_leafc_to_litter => pepv%prev_leafc_to_litter - dispvegn => pns%dispvegn - pft_ntrunc => pns%pft_ntrunc - storvegn => pns%storvegn - totpftn => pns%totpftn - totvegn => pns%totvegn - lncsha => pps%lncsha - lncsun => pps%lncsun - vcmxsha => pps%vcmxsha - vcmxsun => pps%vcmxsun - - ! 4/14/05: PET - ! Adding isotope code - alphapsnsun => pps%alphapsnsun - alphapsnsha => pps%alphapsnsha - leafc13 => pc13s%leafc - leafc13_storage => pc13s%leafc_storage - leafc13_xfer => pc13s%leafc_xfer - frootc13 => pc13s%frootc - frootc13_storage => pc13s%frootc_storage - frootc13_xfer => pc13s%frootc_xfer - livestemc13 => pc13s%livestemc - livestemc13_storage => pc13s%livestemc_storage - livestemc13_xfer => pc13s%livestemc_xfer - deadstemc13 => pc13s%deadstemc - deadstemc13_storage => pc13s%deadstemc_storage - deadstemc13_xfer => pc13s%deadstemc_xfer - livecrootc13 => pc13s%livecrootc - livecrootc13_storage => pc13s%livecrootc_storage - livecrootc13_xfer => pc13s%livecrootc_xfer - deadcrootc13 => pc13s%deadcrootc - deadcrootc13_storage => pc13s%deadcrootc_storage - deadcrootc13_xfer => pc13s%deadcrootc_xfer - c13_gresp_storage => pc13s%gresp_storage - c13_gresp_xfer => pc13s%gresp_xfer - c13pool => pc13s%cpool - c13xsmrpool => pc13s%xsmrpool - c13_pft_ctrunc => pc13s%pft_ctrunc - totvegc13 => pc13s%totvegc - rc13_canair => pepv%rc13_canair - rc13_psnsun => pepv%rc13_psnsun - rc13_psnsha => pepv%rc13_psnsha - - ! assign local pointers for ecophysiological constants - evergreen => pftcon%evergreen - woody => pftcon%woody - leafcn => pftcon%leafcn - deadwdcn => pftcon%deadwdcn - - ! Determine subgrid bounds on this processor - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! Added 5/4/04, PET: initialize forc_hgt_u (gridcell-level), - ! since this is not initialized before first call to CNVegStructUpdate, - ! and it is required to set the upper bound for canopy top height. - ! Changed 3/21/08, KO: still needed but don't have sufficient information - ! to set this properly (e.g., pft-level displacement height and roughness - ! length). So leave at 30m. - do p = begp, endp - forc_hgt_u_pft(p) = 30._r8 - end do - - ! initialize column-level variables - do c = begc, endc - l = clandunit(c) - if (itypelun(l) == istsoil .or. itypelun(l) == istcrop) then - - ! column physical state variables - annsum_counter(c) = 0._r8 - cannsum_npp(c) = 0._r8 - cannavg_t2m(c) = 280._r8 - wf(c) = 1.0_r8 ! it needs to be non zero so the first time step has no fires - me(c) = 0._r8 - fire_prob(c) = 0._r8 - mean_fire_prob(c) = 0._r8 - fireseasonl(c) = 0._r8 - farea_burned(c) = 0._r8 - ann_farea_burned(c) = 0._r8 - - ! needed for CNNLeaching - qflx_drain(c) = 0._r8 - - qflx_irrig(c) = 0._r8 - - ! column carbon state variable initialization - cwdc(c) = 0._r8 - litr1c(c) = 0._r8 - litr2c(c) = 0._r8 - litr3c(c) = 0._r8 - soil1c(c) = 0._r8 - soil2c(c) = 0._r8 - soil3c(c) = 0._r8 - soil4c(c) = 10._r8 - col_ctrunc(c) = 0._r8 - totlitc(c) = 0._r8 - totsomc(c) = 0._r8 - totecosysc(c) = 0._r8 - totcolc(c) = 0._r8 - - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - cwdc13(c) = cwdc(c) * c13ratio - litr1c13(c) = litr1c(c) * c13ratio - litr2c13(c) = litr2c(c) * c13ratio - litr3c13(c) = litr3c(c) * c13ratio - soil1c13(c) = soil1c(c) * c13ratio - soil2c13(c) = soil2c(c) * c13ratio - soil3c13(c) = soil3c(c) * c13ratio - soil4c13(c) = soil4c(c) * c13ratio - c13_col_ctrunc(c) = col_ctrunc(c) * c13ratio - end if - - ! column nitrogen state variables - cwdn(c) = cwdc(c) / 500._r8 - litr1n(c) = litr1c(c) / 90._r8 - litr2n(c) = litr2c(c) / 90._r8 - litr3n(c) = litr3c(c) / 90._r8 - soil1n(c) = soil1c(c) / 12._r8 - soil2n(c) = soil2c(c) / 12._r8 - soil3n(c) = soil3c(c) / 10._r8 - soil4n(c) = soil4c(c) / 10._r8 - sminn(c) = 0._r8 - col_ntrunc(c) = 0._r8 - totlitn(c) = 0._r8 - totsomn(c) = 0._r8 - totecosysn(c) = 0._r8 - totcoln(c) = 0._r8 - - ! dynamic landcover state variables - seedc(c) = 0._r8 - prod10c(c) = 0._r8 - prod100c(c) = 0._r8 - totprodc(c) = 0._r8 - if (use_c13) then - seedc13(c) = 0._r8 - prod10c13(c) = 0._r8 - prod100c13(c) = 0._r8 - totprodc13(c) = 0._r8 - endif - seedn(c) = 0._r8 - prod10n(c) = 0._r8 - prod100n(c) = 0._r8 - totprodn(c) = 0._r8 - - ! also initialize dynamic landcover fluxes so that they have - ! real values on first timestep, prior to calling pftdyn_cnbal - ccf%dwt_seedc_to_leaf(c) = 0._r8 - ccf%dwt_seedc_to_deadstem(c) = 0._r8 - ccf%dwt_conv_cflux(c) = 0._r8 - ccf%dwt_prod10c_gain(c) = 0._r8 - ccf%prod10c_loss(c) = 0._r8 - ccf%dwt_prod100c_gain(c) = 0._r8 - ccf%prod100c_loss(c) = 0._r8 - ccf%dwt_frootc_to_litr1c(c) = 0._r8 - ccf%dwt_frootc_to_litr2c(c) = 0._r8 - ccf%dwt_frootc_to_litr3c(c) = 0._r8 - ccf%dwt_livecrootc_to_cwdc(c) = 0._r8 - ccf%dwt_deadcrootc_to_cwdc(c) = 0._r8 - ccf%dwt_closs(c) = 0._r8 - if (use_c13) then - cc13f%dwt_seedc_to_leaf(c) = 0._r8 - cc13f%dwt_seedc_to_deadstem(c) = 0._r8 - cc13f%dwt_conv_cflux(c) = 0._r8 - cc13f%dwt_prod10c_gain(c) = 0._r8 - cc13f%prod10c_loss(c) = 0._r8 - cc13f%dwt_prod100c_gain(c) = 0._r8 - cc13f%prod100c_loss(c) = 0._r8 - cc13f%dwt_frootc_to_litr1c(c) = 0._r8 - cc13f%dwt_frootc_to_litr2c(c) = 0._r8 - cc13f%dwt_frootc_to_litr3c(c) = 0._r8 - cc13f%dwt_livecrootc_to_cwdc(c) = 0._r8 - cc13f%dwt_deadcrootc_to_cwdc(c) = 0._r8 - cc13f%dwt_closs(c) = 0._r8 - endif - cnf%dwt_seedn_to_leaf(c) = 0._r8 - cnf%dwt_seedn_to_deadstem(c) = 0._r8 - cnf%dwt_conv_nflux(c) = 0._r8 - cnf%dwt_prod10n_gain(c) = 0._r8 - cnf%prod10n_loss(c) = 0._r8 - cnf%dwt_prod100n_gain(c) = 0._r8 - cnf%prod100n_loss(c) = 0._r8 - cnf%dwt_frootn_to_litr1n(c) = 0._r8 - cnf%dwt_frootn_to_litr2n(c) = 0._r8 - cnf%dwt_frootn_to_litr3n(c) = 0._r8 - cnf%dwt_livecrootn_to_cwdn(c) = 0._r8 - cnf%dwt_deadcrootn_to_cwdn(c) = 0._r8 - cnf%dwt_nloss(c) = 0._r8 - end if - end do - - ! initialize pft-level variables - do p = begp, endp - l = plandunit(p) - if (itypelun(l) == istsoil .or. itypelun(l) == istcrop) then - - ! carbon state variables - if (ivt(p) == noveg) then - leafc(p) = 0._r8 - leafc_storage(p) = 0._r8 - else - if (evergreen(ivt(p)) == 1._r8) then - leafc(p) = 1._r8 - leafc_storage(p) = 0._r8 - else if (ivt(p) >= npcropmin) then ! prognostic crop types - leafc(p) = 0._r8 - leafc_storage(p) = 0._r8 - else - leafc(p) = 0._r8 - leafc_storage(p) = 1._r8 - end if - end if - - leafc_xfer(p) = 0._r8 - if ( crop_prog )then - grainc(p) = 0._r8 - grainc_storage(p) = 0._r8 - grainc_xfer(p) = 0._r8 - end if - frootc(p) = 0._r8 - frootc_storage(p) = 0._r8 - frootc_xfer(p) = 0._r8 - livestemc(p) = 0._r8 - livestemc_storage(p) = 0._r8 - livestemc_xfer(p) = 0._r8 - - ! tree types need to be initialized with some stem mass so that - ! roughness length is not zero in canopy flux calculation - - if (woody(ivt(p)) == 1._r8) then - deadstemc(p) = 0.1_r8 - else - deadstemc(p) = 0._r8 - end if - - deadstemc_storage(p) = 0._r8 - deadstemc_xfer(p) = 0._r8 - livecrootc(p) = 0._r8 - livecrootc_storage(p) = 0._r8 - livecrootc_xfer(p) = 0._r8 - deadcrootc(p) = 0._r8 - deadcrootc_storage(p) = 0._r8 - deadcrootc_xfer(p) = 0._r8 - gresp_storage(p) = 0._r8 - gresp_xfer(p) = 0._r8 - cpool(p) = 0._r8 - xsmrpool(p) = 0._r8 - pft_ctrunc(p) = 0._r8 - dispvegc(p) = 0._r8 - storvegc(p) = 0._r8 - totpftc(p) = 0._r8 - ! calculate totvegc explicitly so that it is available for the isotope - ! code on the first time step. - totvegc(p) = leafc(p) + leafc_storage(p) + leafc_xfer(p) + frootc(p) + & - frootc_storage(p) + frootc_xfer(p) + livestemc(p) + livestemc_storage(p) + & - livestemc_xfer(p) + deadstemc(p) + deadstemc_storage(p) + deadstemc_xfer(p) + & - livecrootc(p) + livecrootc_storage(p) + livecrootc_xfer(p) + deadcrootc(p) + & - deadcrootc_storage(p) + deadcrootc_xfer(p) + gresp_storage(p) + & - gresp_xfer(p) + cpool(p) - - woodc(p) = 0._r8 - - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - leafc13(p) = leafc(p) * c13ratio - leafc13_storage(p) = leafc_storage(p) * c13ratio - leafc13_xfer(p) = leafc_xfer(p) * c13ratio - frootc13(p) = frootc(p) * c13ratio - frootc13_storage(p) = frootc_storage(p) * c13ratio - frootc13_xfer(p) = frootc_xfer(p) * c13ratio - livestemc13(p) = livestemc(p) * c13ratio - livestemc13_storage(p) = livestemc_storage(p) * c13ratio - livestemc13_xfer(p) = livestemc_xfer(p) * c13ratio - deadstemc13(p) = deadstemc(p) * c13ratio - deadstemc13_storage(p) = deadstemc_storage(p) * c13ratio - deadstemc13_xfer(p) = deadstemc_xfer(p) * c13ratio - livecrootc13(p) = livecrootc(p) * c13ratio - livecrootc13_storage(p) = livecrootc_storage(p) * c13ratio - livecrootc13_xfer(p) = livecrootc_xfer(p) * c13ratio - deadcrootc13(p) = deadcrootc(p) * c13ratio - deadcrootc13_storage(p) = deadcrootc_storage(p) * c13ratio - deadcrootc13_xfer(p) = deadcrootc_xfer(p) * c13ratio - c13_gresp_storage(p) = gresp_storage(p) * c13ratio - c13_gresp_xfer(p) = gresp_xfer(p) * c13ratio - c13pool(p) = cpool(p) * c13ratio - c13xsmrpool(p) = xsmrpool(p) * c13ratio - c13_pft_ctrunc(p) = pft_ctrunc(p) * c13ratio - - ! calculate totvegc explicitly so that it is available for the isotope - ! code on the first time step. - totvegc13(p) = leafc13(p) + leafc13_storage(p) + leafc13_xfer(p) + frootc13(p) + & - frootc13_storage(p) + frootc13_xfer(p) + livestemc13(p) + livestemc13_storage(p) + & - livestemc13_xfer(p) + deadstemc13(p) + deadstemc13_storage(p) + deadstemc13_xfer(p) + & - livecrootc13(p) + livecrootc13_storage(p) + livecrootc13_xfer(p) + deadcrootc13(p) + & - deadcrootc13_storage(p) + deadcrootc13_xfer(p) + c13_gresp_storage(p) + & - c13_gresp_xfer(p) + c13pool(p) - endif - - ! nitrogen state variables - if (ivt(p) == noveg) then - leafn(p) = 0._r8 - leafn_storage(p) = 0._r8 - else - leafn(p) = leafc(p) / leafcn(ivt(p)) - leafn_storage(p) = leafc_storage(p) / leafcn(ivt(p)) - end if - - leafn_xfer(p) = 0._r8 - if ( crop_prog )then - grainn(p) = 0._r8 - grainn_storage(p) = 0._r8 - grainn_xfer(p) = 0._r8 - end if - frootn(p) = 0._r8 - frootn_storage(p) = 0._r8 - frootn_xfer(p) = 0._r8 - livestemn(p) = 0._r8 - livestemn_storage(p) = 0._r8 - livestemn_xfer(p) = 0._r8 - - ! tree types need to be initialized with some stem mass so that - ! roughness length is not zero in canopy flux calculation - - if (woody(ivt(p)) == 1._r8) then - deadstemn(p) = deadstemc(p) / deadwdcn(ivt(p)) - else - deadstemn(p) = 0._r8 - end if - - deadstemn_storage(p) = 0._r8 - deadstemn_xfer(p) = 0._r8 - livecrootn(p) = 0._r8 - livecrootn_storage(p) = 0._r8 - livecrootn_xfer(p) = 0._r8 - deadcrootn(p) = 0._r8 - deadcrootn_storage(p) = 0._r8 - deadcrootn_xfer(p) = 0._r8 - retransn(p) = 0._r8 - npool(p) = 0._r8 - pft_ntrunc(p) = 0._r8 - dispvegn(p) = 0._r8 - storvegn(p) = 0._r8 - totvegn(p) = 0._r8 - totpftn(p) = 0._r8 - - ! initialization for psnsun and psnsha required for - ! proper arbitrary initialization of allocation routine - ! in initial ecosysdyn call - - psnsun(p) = 0._r8 - psnsha(p) = 0._r8 - if (use_c13) then - c13_psnsun(p) = 0._r8 - c13_psnsha(p) = 0._r8 - endif - laisun(p) = 0._r8 - laisha(p) = 0._r8 - lncsun(p) = 0._r8 - lncsha(p) = 0._r8 - vcmxsun(p) = 0._r8 - vcmxsha(p) = 0._r8 - - ! ecophysiological variables - ! phenology variables - dormant_flag(p) = 1._r8 - days_active(p) = 0._r8 - onset_flag(p) = 0._r8 - onset_counter(p) = 0._r8 - onset_gddflag(p) = 0._r8 - onset_fdd(p) = 0._r8 - onset_gdd(p) = 0._r8 - onset_swi(p) = 0.0_r8 - offset_flag(p) = 0._r8 - offset_counter(p) = 0._r8 - offset_fdd(p) = 0._r8 - offset_swi(p) = 0._r8 - lgsf(p) = 0._r8 - bglfr(p) = 0._r8 - bgtr(p) = 0._r8 - annavg_t2m(p) = 280._r8 - tempavg_t2m(p) = 0._r8 - - ! non-phenology variables - gpp(p) = 0._r8 - availc(p) = 0._r8 - xsmrpool_recover(p) = 0._r8 - if (use_c13) then - xsmrpool_c13ratio(p) = c13ratio - endif - alloc_pnow(p) = 1._r8 - c_allometry(p) = 0._r8 - n_allometry(p) = 0._r8 - plant_ndemand(p) = 0._r8 - tempsum_potential_gpp(p) = 0._r8 - annsum_potential_gpp(p) = 0._r8 - tempmax_retransn(p) = 0._r8 - annmax_retransn(p) = 0._r8 - avail_retransn(p) = 0._r8 - plant_nalloc(p) = 0._r8 - plant_calloc(p) = 0._r8 - excess_cflux(p) = 0._r8 - downreg(p) = 0._r8 - prev_leafc_to_litter(p) = 0._r8 - prev_frootc_to_litter(p) = 0._r8 - tempsum_npp(p) = 0._r8 - annsum_npp(p) = 0._r8 - if (use_cndv) then - tempsum_litfall(p) = 0._r8 - annsum_litfall(p) = 0._r8 - end if - if (use_c13) then - rc13_canair(p) = 0._r8 - rc13_psnsun(p) = 0._r8 - rc13_psnsha(p) = 0._r8 - alphapsnsun(p) = 0._r8 - alphapsnsha(p) = 0._r8 - endif - - - - end if ! end of if-istsoil block - end do ! end of loop over pfts - -end subroutine CNiniTimeVar diff --git a/src_clm40/main/GetGlobalValuesMod.F90 b/src_clm40/main/GetGlobalValuesMod.F90 deleted file mode 100644 index bfe99b3361..0000000000 --- a/src_clm40/main/GetGlobalValuesMod.F90 +++ /dev/null @@ -1,145 +0,0 @@ -module GetGlobalValuesMod - - !----------------------------------------------------------------------- - ! Obtain and Write Global Index information - !----------------------------------------------------------------------- - implicit none - private - - ! PUBLIC MEMBER FUNCTIONS: - - public :: GetGlobalIndex - public :: GetGlobalWrite - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - integer function GetGlobalIndex(decomp_index, clmlevel) - - !---------------------------------------------------------------- - ! Description - ! Determine global index space value for target point at given clmlevel - ! - ! Uses: - use clmtype , only: nameg, namel, namec, namep - use decompMod , only: bounds_type, get_clmlevel_gsmap, get_proc_bounds - use spmdMod , only: iam - use clm_varctl , only: iulog - use shr_log_mod, only: errMsg => shr_log_errMsg - use mct_mod - ! - ! Arguments - integer , intent(in) :: decomp_index - character(len=*) , intent(in) :: clmlevel - ! - ! Local Variables: - type(bounds_type) :: bounds_proc ! processor bounds - type(mct_gsMap),pointer :: gsmap ! global seg map - integer, pointer,dimension(:) :: gsmap_ordered ! gsmap ordered points - integer :: beg_index ! beginning proc index for clmlevel - !---------------------------------------------------------------- - - call get_proc_bounds(bounds_proc) - - if (trim(clmlevel) == nameg) then - beg_index = bounds_proc%begg - else if (trim(clmlevel) == namel) then - beg_index = bounds_proc%begl - else if (trim(clmlevel) == namec) then - beg_index = bounds_proc%begc - else if (trim(clmlevel) == namep) then - beg_index = bounds_proc%begp - else - call shr_sys_abort('clmlevel of '//trim(clmlevel)//' not supported' // & - errmsg(__FILE__, __LINE__)) - end if - - call get_clmlevel_gsmap(clmlevel=trim(clmlevel), gsmap=gsmap) - call mct_gsmap_orderedPoints(gsmap, iam, gsmap_ordered) - GetGlobalIndex = gsmap_ordered(decomp_index - beg_index + 1) - deallocate(gsmap_ordered) - - end function GetGlobalIndex - - !----------------------------------------------------------------------- - subroutine GetGlobalWrite(decomp_index, clmlevel) - - !----------------------------------------------------------------------- - ! Description: - ! Write global index information for input local indices - ! - use clmtype - use shr_sys_mod , only: shr_sys_flush - use shr_sys_mod , only: shr_sys_abort - use shr_log_mod , only: errMsg => shr_log_errMsg - use clm_varctl , only: iulog - ! - ! Arguments: - integer , intent(in) :: decomp_index - character(len=*) , intent(in) :: clmlevel - ! - ! Local Variables: - integer :: igrc, ilun, icol, ipft - !----------------------------------------------------------------------- - - if (trim(clmlevel) == nameg) then - - igrc = decomp_index - write(iulog,*)'local gridcell index = ',igrc - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - - else if (trim(clmlevel) == namel) then - - ilun = decomp_index - igrc = lun%gridcell(ilun) - write(iulog,*)'local landunit index = ',ilun - write(iulog,*)'global landunit index = ',GetGlobalIndex(decomp_index=ilun, clmlevel=namel) - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - write(iulog,*)'landunit type = ',lun%itype(decomp_index) - - else if (trim(clmlevel) == namec) then - - icol = decomp_index - ilun = col%landunit(icol) - igrc = col%gridcell(icol) - write(iulog,*)'local column index = ',icol - write(iulog,*)'global column index = ',GetGlobalIndex(decomp_index=icol, clmlevel=namec) - write(iulog,*)'global landunit index = ',GetGlobalIndex(decomp_index=ilun, clmlevel=namel) - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - write(iulog,*)'column type = ',col%itype(icol) - write(iulog,*)'landunit type = ',lun%itype(ilun) - - else if (trim(clmlevel) == namep) then - - ipft = decomp_index - icol = pft%column(ipft) - ilun = pft%landunit(ipft) - igrc = pft%gridcell(ipft) - write(iulog,*)'local pft index = ',ipft - write(iulog,*)'global pft index = ',GetGlobalIndex(decomp_index=ipft, clmlevel=namep) - write(iulog,*)'global column index = ',GetGlobalIndex(decomp_index=icol, clmlevel=namec) - write(iulog,*)'global landunit index = ',GetGlobalIndex(decomp_index=ilun, clmlevel=namel) - write(iulog,*)'global gridcell index = ',GetGlobalIndex(decomp_index=igrc, clmlevel=nameg) - write(iulog,*)'gridcell longitude = ',grc%londeg(igrc) - write(iulog,*)'gridcell latitude = ',grc%latdeg(igrc) - write(iulog,*)'pft type = ',pft%itype(ipft) - write(iulog,*)'column type = ',col%itype(icol) - write(iulog,*)'landunit type = ',lun%itype(ilun) - - else - call shr_sys_abort('clmlevel '//trim(clmlevel)//'not supported '//errmsg(__FILE__, __LINE__)) - - end if - - call shr_sys_flush(iulog) - - end subroutine GetGlobalWrite - -end module GetGlobalValuesMod diff --git a/src_clm40/main/SimpleMathMod.F90 b/src_clm40/main/SimpleMathMod.F90 deleted file mode 100644 index 5649a54263..0000000000 --- a/src_clm40/main/SimpleMathMod.F90 +++ /dev/null @@ -1,226 +0,0 @@ -module SimpleMathMod - -#include "shr_assert.h" - !------------------------------------------------------------------------------ - ! - ! DESCRIPTIONS: - ! module contains simple mathematical functions for arrays - ! Created by Jinyun Tang, Feb., 2014 - -implicit none - - interface array_normalization - module procedure array_normalization_2d, array_normalization_2d_filter - end interface array_normalization - - interface array_div_vector - module procedure array_div_vector_filter, array_div_vector_nofilter - end interface array_div_vector -contains -!-------------------------------------------------------------------------------- - subroutine array_normalization_2d(which_dim, arr2d_inout) - ! - !DESCRIPTIONS - !do normalization for the input array along dimension which_dim - ! - !USES - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none - - integer, intent(in) :: which_dim !do normalization along which dimension? - real(r8), intent(inout) :: arr2d_inout(:,:) !input 2d array - - - !local variables - integer :: sz1, sz2 !array size - integer :: j1, j2 !indices - real(r8) :: arr_sum - - sz1 = size(arr2d_inout,1) - sz2 = size(arr2d_inout,2) - - if(which_dim==1)then - !normalize along dimension 1, so loop along dimension 2 - do j2 = 1, sz2 - !obtain the total - arr_sum=0._r8 - do j1 = 1, sz1 - arr_sum=arr_sum+arr2d_inout(j1,j2) - enddo - !normalize with the total if arr_sum is non-zero - if(arr_sum/=0._r8)then - do j1 = 1, sz1 - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr_sum - enddo - endif - enddo - elseif(which_dim==2)then - !normalize along dimension 2, so loop along dimension 1 - do j1 = 1, sz1 - !obtain the total - arr_sum=0._r8 - do j2 = 1, sz2 - arr_sum=arr_sum+arr2d_inout(j1,j2) - enddo - !normalize with the total if arr_sum is non-zero - !I think there should be a safer mask for this to screen off spval values - !Jinyun Tang, May 30, 2014 - if(arr_sum>0._r8 .or. arr_sum < 0._r8)then - do j2 = 1, sz2 - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr_sum - enddo - endif - enddo - endif - return - end subroutine array_normalization_2d - -!-------------------------------------------------------------------------------- - subroutine array_normalization_2d_filter(lbj1, ubj1, lbj2, ubj2, numf, filter, arr2d_inout) - ! - !DESCRIPTIONS - !do normalization with filter for the input array along dimension 2 - - ! - !USES - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - implicit none - integer, intent(in) :: lbj1 !left bound of dim 1 - integer, intent(in) :: lbj2 !left bound of dim 2 - integer, intent(in) :: ubj1 !right bound of dim 1 - integer, intent(in) :: ubj2 !right bound of dim 2 - integer, intent(in) :: numf !filter size - integer, intent(in) :: filter(:) !filter - real(r8), intent(inout) :: arr2d_inout(lbj1: , lbj2: ) !input 2d array - - - !local variables - integer :: sz1, sz2 !array size - integer :: j2 !indices - integer :: f, p !indices - real(r8) :: arr_sum(lbj1:ubj1) - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(arr2d_inout) == (/ubj1, ubj2/)), errMsg(__FILE__, __LINE__)) - - - arr_sum(:) = 0._r8 - do j2 = lbj2, ubj2 - do f = 1, numf - p = filter(f) - !obtain the total - arr_sum(p)=arr_sum(p)+arr2d_inout(p,j2) - enddo - enddo - - !normalize with the total if arr_sum is non-zero - do j2 = lbj2, ubj2 - do f = 1, numf - p = filter(f) - !I found I have to ensure >0._r8 because of some unknown reason, jyt May 23, 2014 - !I will test this later with arr_sum(p)/=0._r8 - if(arr_sum(p)>0._r8 .or. arr_sum(p)<0._r8)then - arr2d_inout(p,j2) = arr2d_inout(p,j2)/arr_sum(p) - endif - enddo - enddo - return - end subroutine array_normalization_2d_filter -!-------------------------------------------------------------------------------- - - subroutine array_div_vector_filter(lbj1, ubj1, lbj2, ubj2, & - arr1d_in, fn, filter, arr2d_inout) - ! - !DESCRIPTIONS - !array divided by a vector, arr2d_in is divided by one - !element in arr1d_in - !It always assumes the filter is along with dimenion 1 - ! - ! USES - ! - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_log_mod , only : errMsg => shr_log_errMsg - implicit none - integer, intent(in) :: lbj1 !left bound of dim 1 - integer, intent(in) :: lbj2 !left bound of dim 2 - integer, intent(in) :: ubj1 !right bound of dim 1 - integer, intent(in) :: ubj2 !right bound of dim 2 - real(r8), intent(in) :: arr1d_in(lbj1: ) !1d scaling factor - integer , intent(in) :: fn - integer , intent(in) :: filter(:) !filter - real(r8), intent(inout) :: arr2d_inout(lbj1: ,lbj2: ) !2d array to be scaled - - integer :: sz - integer :: j, f, p - - ! Enforce expected array sizes - SHR_ASSERT_ALL((ubound(arr2d_inout) == (/ubj1, ubj2/)), errMsg(__FILE__, __LINE__)) - SHR_ASSERT_ALL((ubound(arr1d_in) == (/ubj1/)), errMsg(__FILE__, __LINE__)) - - - do j = lbj2, ubj2 - do f = 1, fn - p = filter(f) - if (arr1d_in(p) > 0._r8 .or. arr1d_in(p) < 0._r8) then - arr2d_inout(p,j) = arr2d_inout(p,j)/arr1d_in(p) - else - arr2d_inout(p,j) = 0._r8 - end if - end do - end do - return - end subroutine array_div_vector_filter - -!-------------------------------------------------------------------------------- - - subroutine array_div_vector_nofilter(arr1d_in, which_dim, arr2d_inout) - ! - !DESCRIPTIONS - !array divided by a vector, each row in arr2d_in is divided by one - !element in arr1d_in - ! - !USES - ! - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_assert_mod , only : shr_assert - use shr_log_mod , only : errMsg => shr_log_errMsg - implicit none - real(r8), intent(in) :: arr1d_in(:) !scaling factor - integer, intent(in) :: which_dim !which dimension is scaled - real(r8), intent(inout) :: arr2d_inout(:,:) !2d array to be scaled - - integer :: sz1, sz2 - integer :: j1, j2 - - sz1=size(arr2d_inout,1) - sz2=size(arr2d_inout,2) - - if(which_dim==1)then - ! Enforce expected array sizes - call shr_assert(sz1 == size(arr1d_in), errMsg(__FILE__, __LINE__)) - - do j2 = 1, sz2 - do j1 = 1, sz1 - if(arr1d_in(j1)>0._r8)then - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr1d_in(j1) - endif - enddo - enddo - else - ! Enforce expected array sizes - call shr_assert(sz2 == size(arr1d_in), errMsg(__FILE__, __LINE__)) - - do j2 = 1, sz2 - do j1 = 1, sz1 - if(arr1d_in(j2)>0._r8 .or. arr1d_in(j2)<0._r8)then - arr2d_inout(j1,j2) = arr2d_inout(j1,j2)/arr1d_in(j2) - endif - enddo - enddo - - endif - return - end subroutine array_div_vector_nofilter - -end module SimpleMathMod diff --git a/src_clm40/main/abortutils.F90 b/src_clm40/main/abortutils.F90 deleted file mode 100644 index 8718f0af04..0000000000 --- a/src_clm40/main/abortutils.F90 +++ /dev/null @@ -1,82 +0,0 @@ -module abortutils - - !----------------------------------------------------------------------- - ! !MODULE: abortutils - ! - ! !DESCRIPTION: - ! Abort the model for abnormal termination - !----------------------------------------------------------------------- - - private - save - - public :: endrun - - interface endrun - module procedure endrun_vanilla - module procedure endrun_globalindex - end interface - -CONTAINS - - !----------------------------------------------------------------------- - subroutine endrun_vanilla(msg) - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Abort the model for abnormal termination - ! - use shr_sys_mod , only: shr_sys_abort - use clm_varctl , only: iulog - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in), optional :: msg ! string to be printed - !----------------------------------------------------------------------- - - if (present (msg)) then - write(iulog,*)'ENDRUN:', msg - else - write(iulog,*)'ENDRUN: called without a message string' - end if - - call shr_sys_abort() - - end subroutine endrun_vanilla - - !----------------------------------------------------------------------- - subroutine endrun_globalindex(decomp_index, clmlevel, msg) - - !----------------------------------------------------------------------- - ! Description: - ! Abort the model for abnormal termination - ! - use clmtype - use shr_sys_mod , only: shr_sys_abort - use clm_varctl , only: iulog - use GetGlobalValuesMod, only: GetGlobalWrite - ! - ! Arguments: - implicit none - integer , intent(in) :: decomp_index - character(len=*) , intent(in) :: clmlevel - character(len=*) , intent(in), optional :: msg ! string to be printed - ! - ! Local Variables: - integer :: igrc, ilun, icol - !----------------------------------------------------------------------- - - write(6,*)'calling getglobalwrite with decomp_index= ',decomp_index,' and clmlevel= ',trim(clmlevel) - call GetGlobalWrite(decomp_index, clmlevel) - - if (present (msg)) then - write(iulog,*)'ENDRUN:', msg - else - write(iulog,*)'ENDRUN: called without a message string' - end if - - call shr_sys_abort() - - end subroutine endrun_globalindex - -end module abortutils diff --git a/src_clm40/main/accFldsMod.F90 b/src_clm40/main/accFldsMod.F90 deleted file mode 100644 index 5e8853857c..0000000000 --- a/src_clm40/main/accFldsMod.F90 +++ /dev/null @@ -1,1044 +0,0 @@ -module accFldsMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: accFldsMod -! -! !DESCRIPTION: -! This module contains subroutines that initialize, update and extract -! the user-specified fields over user-defined intervals. Each interval -! and accumulation type is unique to each field processed. -! Subroutine [initAccumFlds] defines the fields to be processed -! and the type of accumulation. Subroutine [updateAccumFlds] does -! the actual accumulation for a given field. Fields are accumulated -! by calls to subroutine [update_accum_field]. To accumulate a field, -! it must first be defined in subroutine [initAccumFlds] and then -! accumulated by calls to [updateAccumFlds]. -! Four types of accumulations are possible: -! o average over time interval -! o running mean over time interval -! o running accumulation over time interval -! Time average fields are only valid at the end of the averaging interval. -! Running means are valid once the length of the simulation exceeds the -! averaging interval. Accumulated fields are continuously accumulated. -! The trigger value "-99999." resets the accumulation to zero. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only: endrun - use clm_varctl, only: iulog, use_cndv, use_cn, use_crop - use surfrdMod, only: crop_prog -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: initAccFlds ! Initialization accumulator fields - public :: initAccClmtype ! Initialize clmtype variables obtained from accum fields - public :: updateAccFlds ! Update accumulator fields -! -! !REVISION HISTORY: -! Created by M. Vertenstein 03/2003 -! -!EOP - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: initAccFlds() -! -! !INTERFACE: - subroutine initAccFlds() -! -! !DESCRIPTION: -! Initializes accumulator and sets up array of accumulated fields -! -! !USES: - use accumulMod , only : init_accum_field, print_accum_fields - use clm_time_manager , only : get_step_size - use shr_const_mod, only : SHR_CONST_CDAY, SHR_CONST_TKFRZ -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY:: -! Created by M. Vertenstein 03/2003 -! -! -! !LOCAL VARIABLES: -!EOP -! - integer :: dtime !time step size - integer, parameter :: not_used = huge(1) -!------------------------------------------------------------------------ - - ! Hourly average of 2m temperature. - - dtime = get_step_size() - call init_accum_field(name='TREFAV', units='K', & - desc='average over an hour of 2-m temperature', & - accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! Hourly average of Urban 2m temperature. - - call init_accum_field(name='TREFAV_U', units='K', & - desc='average over an hour of urban 2-m temperature', & - accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! Hourly average of Rural 2m temperature. - - call init_accum_field(name='TREFAV_R', units='K', & - desc='average over an hour of rural 2-m temperature', & - accum_type='timeavg', accum_period=nint(3600._r8/dtime), & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 24hr average of vegetation temperature (heald, 04/06) - call init_accum_field (name='T_VEG24', units='K', & - desc='24hr average of vegetation temperature', & - accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 240hr average of vegetation temperature (heald, 04/06) - call init_accum_field (name='T_VEG240', units='K', & - desc='240hr average of vegetation temperature', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 24hr average of direct solar radiation (heald, 04/06) - call init_accum_field (name='FSD24', units='W/m2', & - desc='24hr average of direct solar radiation', & - accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 240hr average of direct solar radiation (heald, 04/06) - call init_accum_field (name='FSD240', units='W/m2', & - desc='240hr average of direct solar radiation', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 24hr average of diffuse solar radiation (heald, 04/06) - call init_accum_field (name='FSI24', units='W/m2', & - desc='24hr average of diffuse solar radiation', & - accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 240hr average of diffuse solar radiation (heald, 04/06) - call init_accum_field (name='FSI240', units='W/m2', & - desc='240hr average of diffuse solar radiation', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 24hr average of fraction of canopy that is sunlit (heald, 04/06) - call init_accum_field (name='FSUN24', units='fraction', & - desc='24hr average of diffuse solar radiation', & - accum_type='runmean', accum_period=-1, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! 240hr average of fraction of canopy that is sunlit (heald, 04/06) - call init_accum_field (name='FSUN240', units='fraction', & - desc='240hr average of diffuse solar radiation', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! Average of LAI from previous and current timestep (heald, 04/06) - ! corrected to be 10-day average (LKE, 2014-12-5) - call init_accum_field (name='LAIP', units='m2/m2', & - desc='leaf area index average over timestep', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - if (use_cndv .or. use_crop) then - ! The following is a running mean. - ! The accumulation period is set to -10 for a 10-day running mean. - - call init_accum_field (name='T10', units='K', & - desc='10-day running mean of 2-m temperature', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1,init_value=SHR_CONST_TKFRZ+20._r8) - - end if - - if (use_cndv) then - ! 30-day average of 2m temperature. - - call init_accum_field (name='TDA', units='K', & - desc='30-day average of 2-m temperature', & - accum_type='timeavg', accum_period=-30, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! The following are running means. - ! The accumulation period is set to -365 for a 365-day running mean. - - call init_accum_field (name='PREC365', units='MM H2O/S', & - desc='365-day running mean of total precipitation', & - accum_type='runmean', accum_period=-365, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - ! The following are accumulated fields. - ! These types of fields are accumulated until a trigger value resets - ! the accumulation to zero (see subroutine update_accum_field). - ! Hence, [accper] is not valid. - - call init_accum_field (name='AGDDTW', units='K', & - desc='growing degree-days base twmax', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='AGDD', units='K', & - desc='growing degree-days base 5C', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - end if - - if ( crop_prog )then - ! 10-day average of min 2m temperature. - - call init_accum_field (name='TDM10', units='K', & - desc='10-day running mean of min 2-m temperature', & - accum_type='runmean', accum_period=-10, & - subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) - - ! 5-day average of min 2m temperature. - - call init_accum_field (name='TDM5', units='K', & - desc='5-day running mean of min 2-m temperature', & - accum_type='runmean', accum_period=-5, & - subgrid_type='pft', numlev=1, init_value=SHR_CONST_TKFRZ) - - ! All GDD summations are relative to the planting date - ! (Kucharik & Brye 2003) - - call init_accum_field (name='GDD0', units='K', & - desc='growing degree-days base 0C from planting', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDD8', units='K', & - desc='growing degree-days base 8C from planting', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDD10', units='K', & - desc='growing degree-days base 10C from planting', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDDPLANT', units='K', & - desc='growing degree-days from planting', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - - call init_accum_field (name='GDDTSOI', units='K', & - desc='growing degree-days from planting (top two soil layers)', & - accum_type='runaccum', accum_period=not_used, & - subgrid_type='pft', numlev=1, init_value=0._r8) - end if - - ! Print output of accumulated fields - - call print_accum_fields() - - end subroutine initAccFlds - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: updateAccFlds -! -! !INTERFACE: - subroutine updateAccFlds() -! -! !DESCRIPTION: -! Update and/or extract accumulated fields -! -! !USES: - use clmtype - use clm_atmlnd , only : clm_a2l - use decompMod , only : get_proc_bounds - use clm_varcon , only : spval - use shr_const_mod, only : SHR_CONST_CDAY, SHR_CONST_TKFRZ - use clm_time_manager , only : get_step_size, get_nstep, is_end_curr_day, get_curr_date - use accumulMod , only : update_accum_field, extract_accum_field - use pftvarcon , only : nwcereal, mxtmp, baset - use clm_time_manager , only : get_start_date - use pftvarcon , only : ndllf_dcd_brl_tree -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by M. Vertenstein 03/2003 -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: itype(:) ! pft vegetation - integer , pointer :: pgridcell(:) ! index into gridcell level quantities - real(r8), pointer :: forc_t(:) ! atmospheric temperature (Kelvin) - real(r8), pointer :: forc_rain(:) ! rain rate [mm/s] - real(r8), pointer :: forc_snow(:) ! snow rate [mm/s] - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_u(:) ! Urban 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_r(:) ! Rural 2 m height surface air temperature (Kelvin) - logical , pointer :: urbpoi(:) ! true => landunit is an urban point - logical , pointer :: ifspecial(:) ! true => landunit is not vegetated - integer , pointer :: plandunit(:) ! landunit index associated with each pft - real(r8), pointer :: vf(:) ! vernalization factor - real(r8), pointer :: t_soisno(:,:) ! soil temperature (K) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) (nlevgrnd) - real(r8), pointer :: dz(:,:) ! layer thickness depth (m) - real(r8), pointer :: latdeg(:) ! latitude (radians) - logical , pointer :: croplive(:) ! Flag, true if planted, not harvested - integer , pointer :: pcolumn(:) ! index into column level quantities -! -! local pointers to implicit out arguments -! - ! heald (04/06): variables to be accumulated for VOC emissions - real(r8), pointer :: t_veg(:) ! pft vegetation temperature (Kelvin) - real(r8), pointer :: forc_solad(:,:) ! direct beam radiation (visible only) - real(r8), pointer :: forc_solai(:,:) ! diffuse radiation (visible only) - real(r8), pointer :: fsun(:) ! sunlit fraction of canopy - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - ! heald (04/06): accumulated variables for VOC emissions - real(r8), pointer :: t_veg24(:) ! 24hr average vegetation temperature (K) - real(r8), pointer :: t_veg240(:) ! 240hr average vegetation temperature (Kelvin) - real(r8), pointer :: fsd24(:) ! 24hr average of direct beam radiation - real(r8), pointer :: fsd240(:) ! 240hr average of direct beam radiation - real(r8), pointer :: fsi24(:) ! 24hr average of diffuse beam radiation - real(r8), pointer :: fsi240(:) ! 240hr average of diffuse beam radiation - real(r8), pointer :: fsun24(:) ! 24hr average of sunlit fraction of canopy - real(r8), pointer :: fsun240(:) ! 240hr average of sunlit fraction of canopy - real(r8), pointer :: elai_p(:) ! leaf area index average over timestep - - real(r8), pointer :: t_ref2m_min(:) ! daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max(:) ! daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_inst(:) ! instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst(:) ! instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_u(:) ! Urban daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_r(:) ! Rural daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_u(:) ! Urban daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_r(:) ! Rural daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_inst_u(:) ! Urban instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_inst_r(:) ! Rural instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_u(:) ! Urban instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_r(:) ! Rural instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t10(:) ! 10-day running mean of the 2 m temperature (K) - real(r8), pointer :: t_mo(:) ! 30-day average temperature (Kelvin) - real(r8), pointer :: t_mo_min(:) ! annual min of t_mo (Kelvin) - real(r8), pointer :: prec365(:) ! 365-day running mean of tot. precipitation - real(r8), pointer :: agddtw(:) ! accumulated growing degree days above twmax - real(r8), pointer :: agdd(:) ! accumulated growing degree days above 5 - real(r8), pointer :: twmax(:) ! upper limit of temperature of the warmest month - real(r8), pointer :: gdd0(:) ! growing degree-days base 0C' - real(r8), pointer :: gdd8(:) ! growing degree-days base 8C from planting - real(r8), pointer :: gdd10(:) ! growing degree-days base 10C from planting - real(r8), pointer :: gddplant(:) ! growing degree-days from planting - real(r8), pointer :: gddtsoi(:) ! growing degree-days from planting (top two soil layers) - real(r8), pointer :: a10tmin(:) ! 10-day running mean of min 2-m temperature - real(r8), pointer :: a5tmin(:) ! 5-day running mean of min 2-m temperature -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: g,l,c,p ! indices - integer :: itypveg ! vegetation type - integer :: dtime ! timestep size [seconds] - integer :: nstep ! timestep number - integer :: year ! year (0, ...) for nstep - integer :: month ! month (1, ..., 12) for nstep - integer :: day ! day of month (1, ..., 31) for nstep - integer :: secs ! seconds into current date for nstep - logical :: end_cd ! temporary for is_end_curr_day() value - integer :: ier ! error status - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - real(r8), pointer :: rbufslp(:) ! temporary single level - pft level -!------------------------------------------------------------------------ - - ! Determine necessary indices - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! Assign local pointers to derived subtypes components (gridcell-level) - - forc_t => clm_a2l%forc_t - forc_rain => clm_a2l%forc_rain - forc_snow => clm_a2l%forc_snow - forc_solad => clm_a2l%forc_solad ! (heald 04/06) - forc_solai => clm_a2l%forc_solai ! (heald 04/06) - - ! Assign local pointers to derived subtypes components (landunit-level) - ifspecial => lun%ifspecial - urbpoi => lun%urbpoi - - ! Assign local pointers to derived subtypes components (pft-level) - - itype => pft%itype - pgridcell => pft%gridcell - t_ref2m => pes%t_ref2m - t_ref2m_max_inst => pes%t_ref2m_max_inst - t_ref2m_min_inst => pes%t_ref2m_min_inst - t_ref2m_max => pes%t_ref2m_max - t_ref2m_min => pes%t_ref2m_min - t_ref2m_u => pes%t_ref2m_u - t_ref2m_r => pes%t_ref2m_r - t_ref2m_max_u => pes%t_ref2m_max_u - t_ref2m_max_r => pes%t_ref2m_max_r - t_ref2m_min_u => pes%t_ref2m_min_u - t_ref2m_min_r => pes%t_ref2m_min_r - t_ref2m_max_inst_u => pes%t_ref2m_max_inst_u - t_ref2m_max_inst_r => pes%t_ref2m_max_inst_r - t_ref2m_min_inst_u => pes%t_ref2m_min_inst_u - t_ref2m_min_inst_r => pes%t_ref2m_min_inst_r - plandunit => pft%landunit - t10 => pes%t10 - a10tmin => pes%a10tmin - a5tmin => pes%a5tmin - t_mo => pdgvs%t_mo - t_mo_min => pdgvs%t_mo_min - prec365 => pdgvs%prec365 - agddtw => pdgvs%agddtw - agdd => pdgvs%agdd - twmax => dgv_pftcon%twmax - gdd0 => pps%gdd0 - gdd8 => pps%gdd8 - gdd10 => pps%gdd10 - gddplant => pps%gddplant - gddtsoi => pps%gddtsoi - vf => pps%vf - t_soisno => ces%t_soisno - h2osoi_liq => cws%h2osoi_liq - watsat => cps%watsat - dz => cps%dz - latdeg => grc%latdeg - croplive => pps%croplive - pcolumn => pft%column - t_veg24 => pvs%t_veg24 ! (heald 04/06) - t_veg240 => pvs%t_veg240 ! (heald 04/06) - fsd24 => pvs%fsd24 ! (heald 04/06) - fsd240 => pvs%fsd240 ! (heald 04/06) - fsi24 => pvs%fsi24 ! (heald 04/06) - fsi240 => pvs%fsi240 ! (heald 04/06) - fsun24 => pvs%fsun24 ! (heald 04/06) - fsun240 => pvs%fsun240 ! (heald 04/06) - elai_p => pvs%elai_p ! (heald 04/06) - t_veg => pes%t_veg ! (heald 04/06) - fsun => pps%fsun ! (heald 04/06) - elai => pps%elai ! (heald 04/06) - - ! Determine calendar information - - dtime = get_step_size() - nstep = get_nstep() - call get_curr_date (year, month, day, secs) - - ! Don't do any accumulation if nstep is zero - ! (only applies to coupled or cam mode) - - if (nstep == 0) return - - ! NOTE: currently only single level pft fields are used below - ! Variables are declared above that should make it easy to incorporate - ! multi-level or single-level fields of any subgrid type - - ! Allocate needed dynamic memory for single level pft field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'update_accum_hist allocation error for rbuf1dp' - call endrun - endif - - ! Accumulate and extract TREFAV - hourly average 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV', t_ref2m, nstep) - call extract_accum_field ('TREFAV', rbufslp, nstep) - end_cd = is_end_curr_day() - do p = begp,endp - if (rbufslp(p) /= spval) then - t_ref2m_max_inst(p) = max(rbufslp(p), t_ref2m_max_inst(p)) - t_ref2m_min_inst(p) = min(rbufslp(p), t_ref2m_min_inst(p)) - endif - if (end_cd) then - t_ref2m_max(p) = t_ref2m_max_inst(p) - t_ref2m_min(p) = t_ref2m_min_inst(p) - t_ref2m_max_inst(p) = -spval - t_ref2m_min_inst(p) = spval - else if (secs == int(dtime)) then - t_ref2m_max(p) = spval - t_ref2m_min(p) = spval - endif - end do - - ! Accumulate and extract TREFAV_U - hourly average urban 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV_U', t_ref2m_u, nstep) - call extract_accum_field ('TREFAV_U', rbufslp, nstep) - do p = begp,endp - l = plandunit(p) - if (rbufslp(p) /= spval) then - t_ref2m_max_inst_u(p) = max(rbufslp(p), t_ref2m_max_inst_u(p)) - t_ref2m_min_inst_u(p) = min(rbufslp(p), t_ref2m_min_inst_u(p)) - endif - if (end_cd) then - if (urbpoi(l)) then - t_ref2m_max_u(p) = t_ref2m_max_inst_u(p) - t_ref2m_min_u(p) = t_ref2m_min_inst_u(p) - t_ref2m_max_inst_u(p) = -spval - t_ref2m_min_inst_u(p) = spval - end if - else if (secs == int(dtime)) then - t_ref2m_max_u(p) = spval - t_ref2m_min_u(p) = spval - endif - end do - - ! Accumulate and extract TREFAV_R - hourly average rural 2m air temperature - ! Used to compute maximum and minimum of hourly averaged 2m reference - ! temperature over a day. Note that "spval" is returned by the call to - ! accext if the time step does not correspond to the end of an - ! accumulation interval. First, initialize the necessary values for - ! an initial run at the first time step the accumulator is called - - call update_accum_field ('TREFAV_R', t_ref2m_r, nstep) - call extract_accum_field ('TREFAV_R', rbufslp, nstep) - do p = begp,endp - l = plandunit(p) - if (rbufslp(p) /= spval) then - t_ref2m_max_inst_r(p) = max(rbufslp(p), t_ref2m_max_inst_r(p)) - t_ref2m_min_inst_r(p) = min(rbufslp(p), t_ref2m_min_inst_r(p)) - endif - if (end_cd) then - if (.not.(ifspecial(l))) then - t_ref2m_max_r(p) = t_ref2m_max_inst_r(p) - t_ref2m_min_r(p) = t_ref2m_min_inst_r(p) - t_ref2m_max_inst_r(p) = -spval - t_ref2m_min_inst_r(p) = spval - end if - else if (secs == int(dtime)) then - t_ref2m_max_r(p) = spval - t_ref2m_min_r(p) = spval - endif - end do - - ! Accumulate and extract T_VEG24 & T_VEG240 (heald 04/06) - do p = begp,endp - rbufslp(p) = t_veg(p) - end do - call update_accum_field ('T_VEG24', rbufslp, nstep) - call extract_accum_field ('T_VEG24', t_veg24, nstep) - call update_accum_field ('T_VEG240', rbufslp, nstep) - call extract_accum_field ('T_VEG240', t_veg240, nstep) - - ! Accumulate and extract forc_solad24 & forc_solad240 (heald 04/06) - do p = begp,endp - g = pgridcell(p) - rbufslp(p) = forc_solad(g,1) - end do - call update_accum_field ('FSD240', rbufslp, nstep) - call extract_accum_field ('FSD240', fsd240, nstep) - call update_accum_field ('FSD24', rbufslp, nstep) - call extract_accum_field ('FSD24', fsd24, nstep) - - ! Accumulate and extract forc_solai24 & forc_solai240 (heald 04/06) - do p = begp,endp - g = pgridcell(p) - rbufslp(p) = forc_solai(g,1) - end do - call update_accum_field ('FSI24', rbufslp, nstep) - call extract_accum_field ('FSI24', fsi24, nstep) - call update_accum_field ('FSI240', rbufslp, nstep) - call extract_accum_field ('FSI240', fsi240, nstep) - - ! Accumulate and extract fsun24 & fsun240 (heald 04/06) - do p = begp,endp - rbufslp(p) = fsun(p) - end do - call update_accum_field ('FSUN24', rbufslp, nstep) - call extract_accum_field ('FSUN24', fsun24, nstep) - call update_accum_field ('FSUN240', rbufslp, nstep) - call extract_accum_field ('FSUN240', fsun240, nstep) - - ! Accumulate and extract elai_p (heald 04/06) - do p = begp,endp - rbufslp(p) = elai(p) - end do - call update_accum_field ('LAIP', rbufslp, nstep) - call extract_accum_field ('LAIP', elai_p, nstep) - - if (use_cndv .or. use_crop) then - ! Accumulate and extract T10 - !(acumulates TSA as 10-day running mean) - - call update_accum_field ('T10', t_ref2m, nstep) - call extract_accum_field ('T10', t10, nstep) - end if - - if (use_cndv) then - ! Accumulate and extract TDA - ! (accumulates TBOT as 30-day average) - ! Also determine t_mo_min - - do p = begp,endp - g = pgridcell(p) - rbufslp(p) = forc_t(g) - end do - call update_accum_field ('TDA', rbufslp, nstep) - call extract_accum_field ('TDA', rbufslp, nstep) - do p = begp,endp - t_mo(p) = rbufslp(p) - t_mo_min(p) = min(t_mo_min(p), rbufslp(p)) - end do - - ! Accumulate and extract PREC365 - ! (accumulates total precipitation as 365-day running mean) - - do p = begp,endp - g = pgridcell(p) - rbufslp(p) = forc_rain(g) + forc_snow(g) - end do - call update_accum_field ('PREC365', rbufslp, nstep) - call extract_accum_field ('PREC365', prec365, nstep) - - ! Accumulate growing degree days based on 10-day running mean temperature. - ! The trigger to reset the accumulated values to zero is -99999. - - ! Accumulate and extract AGDDTW (gdd base twmax, which is 23 deg C - ! for boreal woody pfts) - - do p = begp,endp - rbufslp(p) = max(0._r8, (t10(p) - SHR_CONST_TKFRZ - twmax(ndllf_dcd_brl_tree)) & - * dtime/SHR_CONST_CDAY) - if (month==1 .and. day==1 .and. secs==int(dtime)) rbufslp(p) = -99999._r8 - end do - call update_accum_field ('AGDDTW', rbufslp, nstep) - call extract_accum_field ('AGDDTW', agddtw, nstep) - - ! Accumulate and extract AGDD - - do p = begp,endp - rbufslp(p) = max(0.0_r8, (t_ref2m(p) - (SHR_CONST_TKFRZ + 5.0_r8)) & - * dtime/SHR_CONST_CDAY) - end do - call update_accum_field ('AGDD', rbufslp, nstep) - call extract_accum_field ('AGDD', agdd, nstep) - end if - - if ( crop_prog )then - ! Accumulate and extract TDM10 - - do p = begp,endp - rbufslp(p) = min(t_ref2m_min(p),t_ref2m_min_inst(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM10', rbufslp, nstep) - call extract_accum_field ('TDM10', a10tmin, nstep) - - ! Accumulate and extract TDM5 - - do p = begp,endp - rbufslp(p) = min(t_ref2m_min(p),t_ref2m_min_inst(p)) !slevis: ok choice? - if (rbufslp(p) > 1.e30_r8) rbufslp(p) = SHR_CONST_TKFRZ !and were 'min'& - end do !'min_inst' not initialized? - call update_accum_field ('TDM5', rbufslp, nstep) - call extract_accum_field ('TDM5', a5tmin, nstep) - - ! Accumulate and extract GDD0 - - do p = begp,endp - itypveg = itype(p) - g = pgridcell(p) - if (month==1 .and. day==1 .and. secs==int(dtime)) then - rbufslp(p) = -99999._r8 ! reset gdd - else if (( month > 3 .and. month < 10 .and. latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(26._r8, t_ref2m(p)-SHR_CONST_TKFRZ)) & - * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end do - call update_accum_field ('GDD0', rbufslp, nstep) - call extract_accum_field ('GDD0', gdd0, nstep) - - ! Accumulate and extract GDD8 - - do p = begp,endp - itypveg = itype(p) - g = pgridcell(p) - if (month==1 .and. day==1 .and. secs==int(dtime)) then - rbufslp(p) = -99999._r8 ! reset gdd - else if (( month > 3 .and. month < 10 .and. latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(30._r8, & - t_ref2m(p)-(SHR_CONST_TKFRZ + 8._r8))) & - * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end do - call update_accum_field ('GDD8', rbufslp, nstep) - call extract_accum_field ('GDD8', gdd8, nstep) - - ! Accumulate and extract GDD10 - - do p = begp,endp - itypveg = itype(p) - g = pgridcell(p) - if (month==1 .and. day==1 .and. secs==int(dtime)) then - rbufslp(p) = -99999._r8 ! reset gdd - else if (( month > 3 .and. month < 10 .and. latdeg(g) >= 0._r8) .or. & - ((month > 9 .or. month < 4) .and. latdeg(g) < 0._r8) ) then - rbufslp(p) = max(0._r8, min(30._r8, & - t_ref2m(p)-(SHR_CONST_TKFRZ + 10._r8))) & - * dtime/SHR_CONST_CDAY - else - rbufslp(p) = 0._r8 ! keeps gdd unchanged at other times (eg, through Dec in NH) - end if - end do - call update_accum_field ('GDD10', rbufslp, nstep) - call extract_accum_field ('GDD10', gdd10, nstep) - - ! Accumulate and extract GDDPLANT - - do p = begp,endp - if (croplive(p)) then ! relative to planting date - itypveg = itype(p) - rbufslp(p) = max(0._r8, min(mxtmp(itypveg), & - t_ref2m(p)-(SHR_CONST_TKFRZ + baset(itypveg)))) & - * dtime/SHR_CONST_CDAY - if (itypveg == nwcereal) rbufslp(p) = rbufslp(p)*vf(p) - else - rbufslp(p) = -99999._r8 - end if - end do - call update_accum_field ('GDDPLANT', rbufslp, nstep) - call extract_accum_field ('GDDPLANT', gddplant, nstep) - - ! Accumulate and extract GDDTSOI - ! In agroibis this variable is calculated - ! to 0.05 m, so here we use the top two soil layers - - do p = begp,endp - if (croplive(p)) then ! relative to planting date - itypveg = itype(p) - c = pcolumn(p) - rbufslp(p) = max(0._r8, min(mxtmp(itypveg), & - ((t_soisno(c,1)*dz(c,1)+t_soisno(c,2)*dz(c,2))/(dz(c,1)+dz(c,2))) - & - (SHR_CONST_TKFRZ + baset(itypveg)))) * dtime/SHR_CONST_CDAY - if (itypveg == nwcereal) rbufslp(p) = rbufslp(p)*vf(p) - else - rbufslp(p) = -99999._r8 - end if - end do - call update_accum_field ('GDDTSOI', rbufslp, nstep) - call extract_accum_field ('GDDTSOI', gddtsoi, nstep) - - end if - - ! Deallocate dynamic memory - - deallocate(rbufslp) - - end subroutine updateAccFlds - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: initAccClmtype -! -! !INTERFACE: - subroutine initAccClmtype -! -! !DESCRIPTION: -! Initialize clmtype variables that are associated with -! time accumulated fields. This routine is called in an initial run -! at nstep=0 for cam and csm mode. -! This routine is also always called for a restart run and -! therefore must be called after the restart file is read in -! and the accumulated fields are obtained. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use decompMod , only : get_proc_bounds, get_proc_global - use accumulMod , only : extract_accum_field - use clm_time_manager, only : get_nstep - use clm_varctl , only : nsrest, nsrStartup - use clm_varcon , only : spval -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit out arguments -! - real(r8), pointer :: t_ref2m_min(:) ! daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max(:) ! daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_inst(:) ! instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst(:) ! instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_u(:) ! Urban daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_r(:) ! Rural daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_u(:) ! Urban daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_r(:) ! Rural daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_inst_u(:) ! Urban instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_inst_r(:) ! Rural instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_u(:) ! Urban instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_r(:) ! Rural instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t10(:) ! 10-day running mean of the 2 m temperature (K) - real(r8), pointer :: t_mo(:) ! 30-day average temperature (Kelvin) - real(r8), pointer :: prec365(:) ! 365-day running mean of tot. precipitation - real(r8), pointer :: agddtw(:) ! accumulated growing degree days above twmax - real(r8), pointer :: agdd(:) ! accumulated growing degree days above 5 - real(r8), pointer :: gdd0(:) ! growing degree-days base 0C' - real(r8), pointer :: gdd8(:) ! growing degree-days base 8C from planting - real(r8), pointer :: gdd10(:) ! growing degree-days base 10C from planting - real(r8), pointer :: gddplant(:) ! growing degree-days from planting - real(r8), pointer :: gddtsoi(:) ! growing degree-days from planting (top two soil layers) - real(r8), pointer :: a10tmin(:) ! 10-day running mean of min 2-m temperature - real(r8), pointer :: a5tmin(:) ! 5-day running mean of min 2-m temperature - ! heald (04/06): accumulated variables for VOC emissions - real(r8), pointer :: t_veg24(:) ! 24hr average vegetation temperature (K) - real(r8), pointer :: t_veg240(:) ! 240hr average vegetation temperature (Kelvin) - real(r8), pointer :: fsd24(:) ! 24hr average of direct beam radiation - real(r8), pointer :: fsd240(:) ! 240hr average of direct beam radiation - real(r8), pointer :: fsi24(:) ! 24hr average of diffuse beam radiation - real(r8), pointer :: fsi240(:) ! 240hr average of diffuse beam radiation - real(r8), pointer :: fsun24(:) ! 24hr average of sunlit fraction of canopy - real(r8), pointer :: fsun240(:) ! 240hr average of sunlit fraction of canopy - real(r8), pointer :: elai_p(:) ! leaf area index average over timestep -! -! !LOCAL VARIABLES: -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: p ! indices - integer :: nstep ! time step - integer :: ier ! error status - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - real(r8), pointer :: rbufslp(:) ! temporary - character(len=32) :: subname = 'initAccClmtype' ! subroutine name -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (pft-level) - - t_ref2m_max_inst => pes%t_ref2m_max_inst - t_ref2m_min_inst => pes%t_ref2m_min_inst - t_ref2m_max => pes%t_ref2m_max - t_ref2m_min => pes%t_ref2m_min - t_ref2m_max_inst_u => pes%t_ref2m_max_inst_u - t_ref2m_max_inst_r => pes%t_ref2m_max_inst_r - t_ref2m_min_inst_u => pes%t_ref2m_min_inst_u - t_ref2m_min_inst_r => pes%t_ref2m_min_inst_r - t_ref2m_max_u => pes%t_ref2m_max_u - t_ref2m_max_r => pes%t_ref2m_max_r - t_ref2m_min_u => pes%t_ref2m_min_u - t_ref2m_min_r => pes%t_ref2m_min_r - t10 => pes%t10 - a10tmin => pes%a10tmin - a5tmin => pes%a5tmin - t_mo => pdgvs%t_mo - prec365 => pdgvs%prec365 - agddtw => pdgvs%agddtw - agdd => pdgvs%agdd - gdd0 => pps%gdd0 - gdd8 => pps%gdd8 - gdd10 => pps%gdd10 - gddplant => pps%gddplant - gddtsoi => pps%gddtsoi - ! heald (04/06): accumulated variables for VOC emissions - t_veg24 => pvs%t_veg24 - t_veg240 => pvs%t_veg240 - fsd24 => pvs%fsd24 - fsd240 => pvs%fsd240 - fsi24 => pvs%fsi24 - fsi240 => pvs%fsi240 - fsun24 => pvs%fsun24 - fsun240 => pvs%fsun240 - elai_p => pvs%elai_p - - ! Determine necessary indices - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! Determine time step - - nstep = get_nstep() - - ! Initialize 2m ref temperature max and min values - - if (nsrest == nsrStartup) then ! Why not restart&branch? These vars are not in clmr. - do p = begp,endp - t_ref2m_max(p) = spval - t_ref2m_min(p) = spval - t_ref2m_max_inst(p) = -spval - t_ref2m_min_inst(p) = spval - t_ref2m_max_u(p) = spval - t_ref2m_max_r(p) = spval - t_ref2m_min_u(p) = spval - t_ref2m_min_r(p) = spval - t_ref2m_max_inst_u(p) = -spval - t_ref2m_max_inst_r(p) = -spval - t_ref2m_min_inst_u(p) = spval - t_ref2m_min_inst_r(p) = spval - end do - end if - - ! Allocate needed dynamic memory for single level pft field - - allocate(rbufslp(begp:endp), stat=ier) - if (ier/=0) then - write(iulog,*)'extract_accum_hist allocation error for rbufslp in '//subname - call endrun - endif - - ! Initialize clmtype variables that are to be time accumulated - - call extract_accum_field ('T_VEG24', rbufslp, nstep) - do p = begp,endp - t_veg24(p) = rbufslp(p) - end do - - call extract_accum_field ('T_VEG240', rbufslp, nstep) - do p = begp,endp - t_veg240(p) = rbufslp(p) - end do - - call extract_accum_field ('FSD24', rbufslp, nstep) - do p = begp,endp - fsd24(p) = rbufslp(p) - end do - - call extract_accum_field ('FSD240', rbufslp, nstep) - do p = begp,endp - fsd240(p) = rbufslp(p) - end do - - call extract_accum_field ('FSI24', rbufslp, nstep) - do p = begp,endp - fsi24(p) = rbufslp(p) - end do - - call extract_accum_field ('FSI240', rbufslp, nstep) - do p = begp,endp - fsi240(p) = rbufslp(p) - end do - - call extract_accum_field ('FSUN24', rbufslp, nstep) - do p = begp,endp - fsun24(p) = rbufslp(p) - end do - - call extract_accum_field ('FSUN240', rbufslp, nstep) - do p = begp,endp - fsun240(p) = rbufslp(p) - end do - - call extract_accum_field ('LAIP', rbufslp, nstep) - do p = begp,endp - elai_p(p) = rbufslp(p) - end do - - if ( crop_prog )then - - call extract_accum_field ('GDD0', rbufslp, nstep) - do p = begp,endp - gdd0(p) = rbufslp(p) - end do - - call extract_accum_field ('GDD8', rbufslp, nstep) - do p = begp,endp - gdd8(p) = rbufslp(p) - end do - - call extract_accum_field ('GDD10', rbufslp, nstep) - do p = begp,endp - gdd10(p) = rbufslp(p) - end do - - call extract_accum_field ('GDDPLANT', rbufslp, nstep) - do p = begp,endp - gddplant(p) = rbufslp(p) - end do - - call extract_accum_field ('GDDTSOI', rbufslp, nstep) - do p = begp,endp - gddtsoi(p) = rbufslp(p) - end do - - call extract_accum_field ('TDM10', rbufslp, nstep) - do p = begp,endp - a10tmin(p) = rbufslp(p) - end do - - call extract_accum_field ('TDM5', rbufslp, nstep) - do p = begp,endp - a5tmin(p) = rbufslp(p) - end do - - end if - - if (use_cndv .or. use_crop) then - call extract_accum_field ('T10', rbufslp, nstep) - do p = begp,endp - t10(p) = rbufslp(p) - end do - end if - - if (use_cndv) then - call extract_accum_field ('TDA', rbufslp, nstep) - do p = begp,endp - t_mo(p) = rbufslp(p) - end do - - call extract_accum_field ('PREC365', rbufslp, nstep) - do p = begp,endp - prec365(p) = rbufslp(p) - end do - - call extract_accum_field ('AGDDTW', rbufslp, nstep) - do p = begp,endp - agddtw(p) = rbufslp(p) - end do - - call extract_accum_field ('AGDD', rbufslp, nstep) - do p = begp,endp - agdd(p) = rbufslp(p) - end do - end if - - deallocate(rbufslp) - - end subroutine initAccClmtype - -end module accFldsMod diff --git a/src_clm40/main/accumulMod.F90 b/src_clm40/main/accumulMod.F90 deleted file mode 100644 index f78723f975..0000000000 --- a/src_clm40/main/accumulMod.F90 +++ /dev/null @@ -1,656 +0,0 @@ -module accumulMod - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! This module contains generic subroutines that can be used to - ! define, accumulate and extract user-specified fields over - ! user-defined intervals. Each interval and accumulation type is - ! unique to each field processed. - ! Subroutine [init_accumulator] defines the values of the accumulated - ! field data structure. Subroutine [update_accum_field] does - ! the actual accumulation for a given field. - ! Four types of accumulations are possible: - ! - Average over time interval. Time average fields are only - ! valid at the end of the averaging interval. - ! - Running mean over time interval. Running means are valid once the - ! length of the simulation exceeds the - ! - Running accumulation over time interval. Accumulated fields are - ! continuously accumulated. The trigger value "-99999." resets - ! the accumulation to zero. - ! - ! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_sys_mod , only: shr_sys_abort - use clm_varctl , only: iulog - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: accumulRest ! Write/read restart of accumulation fields - public :: init_accum_field ! Initialize an accumulator field - public :: print_accum_fields ! Print info about accumulator fields - public :: extract_accum_field ! Extracts the current value of an accumulator field - public :: update_accum_field ! Update the current value of an accumulator field - - interface extract_accum_field - module procedure extract_accum_field_sl ! Extract current val of single-level accumulator field - module procedure extract_accum_field_ml ! Extract current val of multi-level accumulator field - end interface - interface update_accum_field ! Updates the current value of an accumulator field - module procedure update_accum_field_sl ! Update single-level accumulator field - module procedure update_accum_field_ml ! Update multi-level accumulator field - end interface - private - ! - ! !PRIVATE TYPES: - type accum_field - character(len= 8) :: name !field name - character(len=128) :: desc !field description - character(len= 8) :: units !field units - character(len= 8) :: acctype !accumulation type: ["timeavg","runmean","runaccum"] - character(len= 8) :: type1d !subgrid type: ["gridcell","landunit","column" or "pft"] - character(len= 8) :: type2d !type2d ('','levsoi','numrad',..etc. ) - integer :: beg1d !subgrid type beginning index - integer :: end1d !subgrid type ending index - integer :: num1d !total subgrid points - integer :: numlev !number of vertical levels in field - real(r8) :: initval !initial value of accumulated field - real(r8), pointer :: val(:,:) !accumulated field - integer :: period !field accumulation period (in model time steps) - end type accum_field - - real(r8), parameter, public :: accumResetVal = -99999._r8 ! used to do an annual reset ( put in for bug 1858) - - integer, parameter :: max_accum = 100 !maximum number of accumulated fields - type (accum_field) :: accum(max_accum) !array accumulated fields - integer :: naccflds = 0 !accumulator field counter - - integer :: iflag_interp = 1 - integer :: iflag_copy = 2 - integer :: iflag_skip = 3 - !------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------ - subroutine init_accum_field (name, units, desc, & - accum_type, accum_period, numlev, subgrid_type, init_value, type2d) - ! - ! !DESCRIPTION: - ! Initialize accumulation fields. This subroutine sets: - ! o name of accumulated field - ! o units of accumulated field - ! o accumulation type of accumulated field - ! o description of accumulated fields: accdes - ! o accumulation period for accumulated field (in iterations) - ! o initial value of accumulated field - ! - ! !USES: - use shr_const_mod, only: SHR_CONST_CDAY - use clm_time_manager, only : get_step_size - use decompMod, only : get_proc_bounds, get_proc_global - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - character(len=*), intent(in) :: units !field units - character(len=*), intent(in) :: desc !field description - character(len=*), intent(in) :: accum_type !field type: tavg, runm, runa, ins - integer , intent(in) :: accum_period !field accumulation period - character(len=*), intent(in) :: subgrid_type !["gridcell","landunit","column" or "pft"] - integer , intent(in) :: numlev !number of vertical levels - real(r8), intent(in) :: init_value !field initial or reset value - character(len=*), intent(in), optional :: type2d !level type (optional) - needed if numlev > 1 - ! - ! !LOCAL VARIABLES: - integer :: nf ! field index - integer :: beg1d,end1d ! beggining and end subgrid indices - integer :: num1d ! total number subgrid indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: begCohort, endCohort ! per-proc beg end cohort indices - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: numCohort ! total number of cohorts across all processors - !------------------------------------------------------------------------ - - ! Determine necessary indices - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp, & - begCohort, endCohort ) - call get_proc_global(numg, numl, numc, nump, numCohort) - - ! update field index - ! Consistency check that number of accumulated does not exceed maximum. - - naccflds = naccflds + 1 - if (naccflds > max_accum) then - write(iulog,*) 'ACCUMULINIT error: user-defined accumulation fields ', & - 'equal to ',naccflds,' exceeds max_accum' - call shr_sys_abort() - end if - nf = naccflds - - ! Note accumulation period must be converted from days - ! to number of iterations - - accum(nf)%name = trim(name) - accum(nf)%units = trim(units) - accum(nf)%desc = trim(desc) - accum(nf)%acctype = trim(accum_type) - accum(nf)%initval = init_value - accum(nf)%period = accum_period - if (accum(nf)%period < 0) then - accum(nf)%period = -accum(nf)%period * nint(SHR_CONST_CDAY) / get_step_size() - end if - - select case (trim(subgrid_type)) - case ('gridcell') - beg1d = begg - end1d = endg - num1d = numg - case ('landunit') - beg1d = begl - end1d = endl - num1d = numl - case ('column') - beg1d = begc - end1d = endc - num1d = numc - case ('pft') - beg1d = begp - end1d = endp - num1d = nump - case default - write(iulog,*)'ACCUMULINIT: unknown subgrid type ',subgrid_type - call shr_sys_abort () - end select - - accum(nf)%type1d = trim(subgrid_type) - accum(nf)%beg1d = beg1d - accum(nf)%end1d = end1d - accum(nf)%num1d = num1d - accum(nf)%numlev = numlev - - if (present(type2d)) then - accum(nf)%type2d = type2d - else - accum(nf)%type2d = ' ' - end if - - ! Allocate and initialize accumulation field - - allocate(accum(nf)%val(beg1d:end1d,numlev)) - accum(nf)%val(beg1d:end1d,numlev) = init_value - - end subroutine init_accum_field - - !------------------------------------------------------------------------ - subroutine print_accum_fields() - ! - ! !DESCRIPTION: - ! Diagnostic printout of accumulated fields - ! - ! !USES: - use spmdMod, only : masterproc - ! - ! !ARGUMENTS: - implicit none - ! - integer :: i,nf !indices - !------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*) - write(iulog,*) 'Initializing variables for time accumulation .....' - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) 'Accumulated fields' - write(iulog,1002) - write(iulog,'(72a1)') ("_",i=1,71) - do nf = 1, naccflds - if (accum(nf)%period /= huge(1)) then - write(iulog,1003) nf,accum(nf)%name,accum(nf)%units,& - accum(nf)%acctype, accum(nf)%period, accum(nf)%initval, & - accum(nf)%desc - else - write(iulog,1004) nf,accum(nf)%name,accum(nf)%units,& - accum(nf)%acctype, accum(nf)%initval, accum(nf)%desc - endif - end do - write(iulog,'(72a1)') ("_",i=1,71) - write(iulog,*) - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) 'Successfully initialized variables for accumulation' - write(iulog,*) - endif - -1002 format(' No',' Name ',' Units ',' Type ','Period',' Inival',' Description') -1003 format((1x,i2),(1x,a8),(1x,a8),(1x,a8), (1x,i5),(1x,f4.0),(1x,a40)) -1004 format((1x,i2),(1x,a8),(1x,a8),(1x,a8),' N.A.',(1x,f4.0),(1x,a40)) - - end subroutine print_accum_fields - - !------------------------------------------------------------------------ - subroutine extract_accum_field_sl (name, field, nstep) - ! - ! !DESCRIPTION: - ! Extract single-level accumulated field. - ! This routine extracts the field values from the multi-level - ! accumulation field. It extracts the current value except if - ! the field type is a time average. In this case, an absurd value - ! is assigned to indicate the time average is not yet valid. - ! - ! !USES: - use clm_varcon, only : spval, ispval - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:) :: field !field values for current time step - integer , intent(in) :: nstep !timestep index - ! - ! !LOCAL VARIABLES: - integer :: i,k,nf !indices - integer :: beg,end !subgrid beginning,ending indices - !------------------------------------------------------------------------ - - ! find field index. return if "name" is not on list - - nf = 0 - do i = 1, naccflds - if (name == accum(i)%name) nf = i - end do - if (nf == 0) then - write(iulog,*) 'EXTRACT_ACCUM_FIELD_SL error: field name ',name,' not found' - call shr_sys_abort - endif - - ! error check - - beg = accum(nf)%beg1d - end = accum(nf)%end1d - if (size(field,dim=1) /= end-beg+1) then - write(iulog,*)'ERROR in extract_accum_field for field ',accum(nf)%name - write(iulog,*)'size of first dimension of field is ',& - size(field,dim=1),' and should be ',end-beg+1 - call shr_sys_abort - endif - - ! extract field - - if (accum(nf)%acctype == 'timeavg' .and. & - mod(nstep,accum(nf)%period) /= 0) then - do k = beg,end - field(k) = spval !assign absurd value when avg not ready - end do - else - do k = beg,end - field(k) = accum(nf)%val(k,1) - end do - end if - - end subroutine extract_accum_field_sl - - !------------------------------------------------------------------------ - subroutine extract_accum_field_ml (name, field, nstep) - ! - ! !DESCRIPTION: - ! Extract mutli-level accumulated field. - ! This routine extracts the field values from the multi-level - ! accumulation field. It extracts the current value except if - ! the field type is a time average. In this case, an absurd value - ! is assigned to indicate the time average is not yet valid. - ! - ! !USES: - use clm_varcon, only : spval - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:,:) :: field !field values for current time step - integer, intent(in) :: nstep !timestep index - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,nf !indices - integer :: beg,end !subgrid beginning,ending indices - integer :: numlev !number of vertical levels - !------------------------------------------------------------------------ - - ! find field index. return if "name" is not on list - - nf = 0 - do i = 1, naccflds - if (name == accum(i)%name) nf = i - end do - if (nf == 0) then - write(iulog,*) 'EXTRACT_ACCUM_FIELD_ML error: field name ',name,' not found' - call shr_sys_abort - endif - - ! error check - - numlev = accum(nf)%numlev - beg = accum(nf)%beg1d - end = accum(nf)%end1d - if (size(field,dim=1) /= end-beg+1) then - write(iulog,*)'ERROR in extract_accum_field for field ',accum(nf)%name - write(iulog,*)'size of first dimension of field is ',& - size(field,dim=1),' and should be ',end-beg+1 - call shr_sys_abort - else if (size(field,dim=2) /= numlev) then - write(iulog,*)'ERROR in extract_accum_field for field ',accum(nf)%name - write(iulog,*)'size of second dimension of field iis ',& - size(field,dim=2),' and should be ',numlev - call shr_sys_abort - endif - - !extract field - - if (accum(nf)%acctype == 'timeavg' .and. & - mod(nstep,accum(nf)%period) /= 0) then - do j = 1,numlev - do k = beg,end - field(k,j) = spval !assign absurd value when avg not ready - end do - end do - else - do j = 1,numlev - do k = beg,end - field(k,j) = accum(nf)%val(k,j) - end do - end do - end if - - end subroutine extract_accum_field_ml - - !------------------------------------------------------------------------ - subroutine update_accum_field_sl (name, field, nstep) - ! - ! !DESCRIPTION: - ! Accumulate single level field over specified time interval. - ! The appropriate field is accumulated in the array [accval]. - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:) :: field !field values for current time step - integer , intent(in) :: nstep !time step index - ! - ! !LOCAL VARIABLES: - integer :: i,k,nf !indices - integer :: accper !temporary accumulation period - integer :: beg,end !subgrid beginning,ending indices - !------------------------------------------------------------------------ - - ! find field index. return if "name" is not on list - - nf = 0 - do i = 1, naccflds - if (name == accum(i)%name) nf = i - end do - if (nf == 0) then - write(iulog,*) 'UPDATE_ACCUM_FIELD_SL error: field name ',name,' not found' - call shr_sys_abort - endif - - ! error check - - beg = accum(nf)%beg1d - end = accum(nf)%end1d - if (size(field,dim=1) /= end-beg+1) then - write(iulog,*)'ERROR in UPDATE_ACCUM_FIELD_SL for field ',accum(nf)%name - write(iulog,*)'size of first dimension of field is ',size(field,dim=1),& - ' and should be ',end-beg+1 - call shr_sys_abort - endif - - ! accumulate field - - if (accum(nf)%acctype /= 'timeavg' .AND. & - accum(nf)%acctype /= 'runmean' .AND. & - accum(nf)%acctype /= 'runaccum') then - write(iulog,*) 'UPDATE_ACCUM_FIELD_SL error: incorrect accumulation type' - write(iulog,*) ' was specified for field ',name - write(iulog,*)' accumulation type specified is ',accum(nf)%acctype - write(iulog,*)' only [timeavg, runmean, runaccum] are currently acceptable' - call shr_sys_abort() - end if - - - ! reset accumulated field value if necessary and update - ! accumulation field - ! running mean never reset - - if (accum(nf)%acctype == 'timeavg') then - - !time average field reset every accumulation period - !normalize at end of accumulation period - - if ((mod(nstep,accum(nf)%period) == 1 .or. accum(nf)%period == 1) .and. (nstep /= 0))then - accum(nf)%val(beg:end,1) = 0._r8 - end if - accum(nf)%val(beg:end,1) = accum(nf)%val(beg:end,1) + field(beg:end) - if (mod(nstep,accum(nf)%period) == 0) then - accum(nf)%val(beg:end,1) = accum(nf)%val(beg:end,1) / accum(nf)%period - endif - - else if (accum(nf)%acctype == 'runmean') then - - !running mean - reset accumulation period until greater than nstep - - accper = min (nstep,accum(nf)%period) - accum(nf)%val(beg:end,1) = ((accper-1)*accum(nf)%val(beg:end,1) + field(beg:end)) / accper - - else if (accum(nf)%acctype == 'runaccum') then - - !running accumulation field reset at trigger -99999 - - do k = beg,end - if (nint(field(k)) == -99999) then - accum(nf)%val(k,1) = 0._r8 - end if - end do - accum(nf)%val(beg:end,1) = min(max(accum(nf)%val(beg:end,1) + field(beg:end), 0._r8), 99999._r8) - - end if - - end subroutine update_accum_field_sl - - !------------------------------------------------------------------------ - subroutine update_accum_field_ml (name, field, nstep) - ! - ! !DESCRIPTION: - ! Accumulate multi level field over specified time interval. - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name !field name - real(r8), pointer, dimension(:,:) :: field !field values for current time step - integer , intent(in) :: nstep !time step index - ! - ! !LOCAL VARIABLES: - integer :: i,j,k,nf !indices - integer :: accper !temporary accumulation period - integer :: beg,end !subgrid beginning,ending indices - integer :: numlev !number of vertical levels - !------------------------------------------------------------------------ - - ! find field index. return if "name" is not on list - - nf = 0 - do i = 1, naccflds - if (name == accum(i)%name) nf = i - end do - if (nf == 0) then - write(iulog,*) 'UPDATE_ACCUM_FIELD_ML error: field name ',name,' not found' - call shr_sys_abort - endif - - ! error check - - numlev = accum(nf)%numlev - beg = accum(nf)%beg1d - end = accum(nf)%end1d - if (size(field,dim=1) /= end-beg+1) then - write(iulog,*)'ERROR in UPDATE_ACCUM_FIELD_ML for field ',accum(nf)%name - write(iulog,*)'size of first dimension of field is ',size(field,dim=1),& - ' and should be ',end-beg+1 - call shr_sys_abort - else if (size(field,dim=2) /= numlev) then - write(iulog,*)'ERROR in UPDATE_ACCUM_FIELD_ML for field ',accum(nf)%name - write(iulog,*)'size of second dimension of field is ',size(field,dim=2),& - ' and should be ',numlev - call shr_sys_abort - endif - - ! accumulate field - - if (accum(nf)%acctype /= 'timeavg' .AND. & - accum(nf)%acctype /= 'runmean' .AND. & - accum(nf)%acctype /= 'runaccum') then - write(iulog,*) 'UPDATE_ACCUM_FIELD_ML error: incorrect accumulation type' - write(iulog,*) ' was specified for field ',name - write(iulog,*)' accumulation type specified is ',accum(nf)%acctype - write(iulog,*)' only [timeavg, runmean, runaccum] are currently acceptable' - call shr_sys_abort() - end if - - ! accumulate field - - ! reset accumulated field value if necessary and update - ! accumulation field - ! running mean never reset - - if (accum(nf)%acctype == 'timeavg') then - - !time average field reset every accumulation period - !normalize at end of accumulation period - - if ((mod(nstep,accum(nf)%period) == 1 .or. accum(nf)%period == 1) .and. (nstep /= 0))then - accum(nf)%val(beg:end,1:numlev) = 0._r8 - endif - accum(nf)%val(beg:end,1:numlev) = accum(nf)%val(beg:end,1:numlev) + field(beg:end,1:numlev) - if (mod(nstep,accum(nf)%period) == 0) then - accum(nf)%val(beg:end,1:numlev) = accum(nf)%val(beg:end,1:numlev) / accum(nf)%period - endif - - else if (accum(nf)%acctype == 'runmean') then - - !running mean - reset accumulation period until greater than nstep - - accper = min (nstep,accum(nf)%period) - accum(nf)%val(beg:end,1:numlev) = & - ((accper-1)*accum(nf)%val(beg:end,1:numlev) + field(beg:end,1:numlev)) / accper - - else if (accum(nf)%acctype == 'runaccum') then - - !running accumulation field reset at trigger -99999 - - do j = 1,numlev - do k = beg,end - if (nint(field(k,j)) == -99999) then - accum(nf)%val(k,j) = 0._r8 - end if - end do - end do - accum(nf)%val(beg:end,1:numlev) = & - min(max(accum(nf)%val(beg:end,1:numlev) + field(beg:end,1:numlev), 0._r8), 99999._r8) - - end if - - end subroutine update_accum_field_ml - - !------------------------------------------------------------------------ - subroutine accumulRest( ncid, flag ) - ! - ! !DESCRIPTION: - ! Read/write accumulation restart data - ! - ! !USES: - use clm_time_manager, only : is_restart - use clm_varcon , only : ispval - use ncdio_pio - use pio - ! - ! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid !netcdf unit - character(len=*) , intent(in) :: flag !'define','read', or 'write' - ! - ! !LOCAL VARIABLES: - integer :: nf,k,j ! indices - integer :: beg1d, end1d ! buffer bounds - integer :: ier ! error status - logical :: readvar ! determine if variable is on initial file - real(r8), pointer :: rbuf1d(:) ! temporary 1d buffer - type(var_desc_t) :: vardesc ! local vardesc - character(len=128) :: varname ! temporary - character(len= 32) :: subname='AccumRest' ! subroutine name - !------------------------------------------------------------------------ - - do nf = 1,naccflds - - ! Note = below need to allocate rbuf for single level variables, since - ! accum(nf)%val is always 2d - - varname = trim(accum(nf)%name) // '_VALUE' - if (flag == 'define') then - if (accum(nf)%numlev == 1) then - call ncd_defvar(ncid=ncid, varname=varname, xtype=ncd_double, & - dim1name=accum(nf)%type1d, & - long_name=accum(nf)%desc, units=accum(nf)%units) - ier = PIO_inq_varid(ncid, trim(varname), vardesc) - ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_interp) - else - call ncd_defvar(ncid=ncid, varname=varname, xtype=ncd_double, & - dim1name=accum(nf)%type1d, dim2name=accum(nf)%type2d, & - long_name=accum(nf)%desc, units=accum(nf)%units) - end if - else if (flag == 'read' .or. flag == 'write') then - if (accum(nf)%numlev == 1) then - beg1d = accum(nf)%beg1d - end1d = accum(nf)%end1d - allocate(rbuf1d(beg1d:end1d)) - if (flag == 'write') then - rbuf1d(beg1d:end1d) = accum(nf)%val(beg1d:end1d,1) - end if - call ncd_io(varname=varname, data=rbuf1d, & - dim1name=accum(nf)%type1d, ncid=ncid, flag=flag, readvar=readvar) - if (flag == 'read' .and. readvar) then - accum(nf)%val(beg1d:end1d,1) = rbuf1d(beg1d:end1d) - end if - deallocate(rbuf1d) - else - call ncd_io(varname=varname, data=accum(nf)%val, & - dim1name=accum(nf)%type1d, ncid=ncid, flag=flag, readvar=readvar) - end if - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call shr_sys_abort() - end if - end if - - varname = trim(accum(nf)%name) // '_PERIOD' - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname=varname, xtype=ncd_int, & - long_name='', units='time steps', imissing_value=ispval, & - ifill_value=huge(1)) - ier = PIO_inq_varid(ncid, trim(varname), vardesc) - ier = PIO_put_att(ncid, vardesc%varid, 'interpinic_flag', iflag_copy) - else if (flag == 'read' .or. flag == 'write') then - call ncd_io(varname=varname, data=accum(nf)%period, ncid=ncid, flag=flag, readvar=readvar) - if (flag=='read' .and. .not. readvar) then - if (is_restart()) call shr_sys_abort() - end if - end if - - end do - - end subroutine accumulRest - -end module accumulMod diff --git a/src_clm40/main/clm_atmlnd.F90 b/src_clm40/main/clm_atmlnd.F90 deleted file mode 100644 index b280aae03d..0000000000 --- a/src_clm40/main/clm_atmlnd.F90 +++ /dev/null @@ -1,551 +0,0 @@ -module clm_atmlnd - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_atmlnd -! -! !DESCRIPTION: -! Handle atm2lnd, lnd2atm mapping -! -! !USES: - use clm_varpar , only : numrad, ndst, nlevgrnd !ndst = number of dust bins. - use clm_varcon , only : rair, grav, cpair, hfus, tfrz - use clm_varctl , only : iulog, use_cn - use decompMod , only : get_proc_bounds - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use spmdMod , only : masterproc - use abortutils , only : endrun - use seq_drydep_mod, only : n_drydep, drydep_method, DD_XLND - use shr_megan_mod, only : shr_megan_mechcomps_n -! -! !PUBLIC TYPES: - implicit none - private - save -!---------------------------------------------------- -! atmosphere -> land variables structure -!---------------------------------------------------- - - ! Notes about atm2lnd_downscaled_fields_type, atm2lnd_type, and - ! a2l_not_downscaled_gcell: On the CLM4.5 side, atm2lnd_type has been broken into two - ! types: atm2lnd_type contains a subset of the original type, and - ! atm2lnd_downscaled_fields_type contains the remaining fields. Similarly, there are two - ! variables at the grid cell level: clm_a2l (of type atm2lnd_type) and - ! a2l_not_downscaled_gcell (of type atm2lnd_downscaled_fields_type). Because - ! lnd_import_export accesses these types and the related variables, and because - ! lnd_import_export is shared between the clm4.0 and clm4.5 sides, we needed to make - ! changes on the clm4.0 side for compatibility. Specifically, we needed to introduce a - ! pointer/alias named a2l_not_downscaled_gcell; for simplicity, this is simply another - ! way to access all of the fields in clm_a2l. Getting its type right is a bit tricky: - ! lnd_import_export expects it to be of type atm2lnd_downscaled_fields_type, but it - ! needs to point to a variable of type atm2lnd_type. To accomplish this, we have used - ! inheritance & polymorphism (Fortran 2003 features). - - ! This is really the type definition for atm2lnd_type. However, for compatibility with - ! clm4_5 (particularly in lnd_import_export) we need to call this - ! atm2lnd_downscaled_fields_type, and then define an extended type called atm2lnd_type. - type, public :: atm2lnd_downscaled_fields_type - real(r8), pointer :: forc_t(:) => null() !atmospheric temperature (Kelvin) - real(r8), pointer :: forc_u(:) => null() !atm wind speed, east direction (m/s) - real(r8), pointer :: forc_v(:) => null() !atm wind speed, north direction (m/s) - real(r8), pointer :: forc_wind(:) => null() !atmospheric wind speed - real(r8), pointer :: forc_q(:) => null() !atmospheric specific humidity (kg/kg) - real(r8), pointer :: forc_hgt(:) => null() !atmospheric reference height (m) - real(r8), pointer :: forc_hgt_u(:) => null() !obs height of wind [m] (new) - real(r8), pointer :: forc_hgt_t(:) => null() !obs height of temperature [m] (new) - real(r8), pointer :: forc_hgt_q(:) => null() !obs height of humidity [m] (new) - real(r8), pointer :: forc_pbot(:) => null() !atmospheric pressure (Pa) - real(r8), pointer :: forc_th(:) => null() !atm potential temperature (Kelvin) - real(r8), pointer :: forc_vp(:) => null() !atmospheric vapor pressure (Pa) - real(r8), pointer :: forc_rho(:) => null() !density (kg/m**3) - real(r8), pointer :: forc_rh(:) => null() !atmospheric relative humidity (%) - real(r8), pointer :: forc_psrf(:) => null() !surface pressure (Pa) - real(r8), pointer :: forc_pco2(:) => null() !CO2 partial pressure (Pa) - real(r8), pointer :: forc_lwrad(:) => null() !downward IR longwave radiation (W/m**2) - real(r8), pointer :: forc_solad(:,:) => null() !direct beam radiation (numrad) (vis=forc_sols , nir=forc_soll ) - real(r8), pointer :: forc_solai(:,:) => null() !diffuse radiation (numrad) (vis=forc_solsd, nir=forc_solld) - real(r8), pointer :: forc_solar(:) => null() !incident solar radiation - real(r8), pointer :: forc_rain(:) => null() !rain rate [mm/s] - real(r8), pointer :: forc_snow(:) => null() !snow rate [mm/s] - real(r8), pointer :: forc_ndep(:) => null() !nitrogen deposition rate (gN/m2/s) - real(r8), pointer :: forc_pc13o2(:) => null() !C13O2 partial pressure (Pa) - real(r8), pointer :: forc_po2(:) => null() !O2 partial pressure (Pa) - real(r8), pointer :: forc_flood(:) => null() ! rof flood (mm/s) - real(r8), pointer :: volr(:) => null() ! rof volr total (m3) - real(r8), pointer :: volrmch(:) => null() ! rof volr main channel (m3) - real(r8), pointer :: forc_aer(:,:) => null() ! aerosol deposition array - ! Needed for backwards compatibility with lnd_comp_mct used in clm4_5 - real(r8), pointer :: forc_pch4(:) => null() !CH4 partial pressure (Pa) - ! anomaly forcing - only define and only used in clm4_5. This is a hack - ! since lnd_import_export doesn't have a way to deal with the 45/40 - ! distinction - real(r8), pointer ::af_precip(:) => null() ! anomaly forcing - real(r8), pointer ::af_uwind(:) => null() ! anomaly forcing - real(r8), pointer ::af_vwind(:) => null() ! anomaly forcing - real(r8), pointer ::af_tbot(:) => null() ! anomaly forcing - real(r8), pointer ::af_pbot(:) => null() ! anomaly forcing - real(r8), pointer ::af_shum(:) => null() ! anomaly forcing - real(r8), pointer ::af_swdn(:) => null() ! anomaly forcing - real(r8), pointer ::af_lwdn(:) => null() ! anomaly forcing - real(r8), pointer :: bc_precip(:) => null() ! anomaly forcing - add bias correction - end type atm2lnd_downscaled_fields_type - - ! The following type extension is needed just so that lnd_import_export can remain - ! consistent between the clm4_0 code and clm4_5 code. - type, public, extends(atm2lnd_downscaled_fields_type) :: atm2lnd_type - end type atm2lnd_type - -!---------------------------------------------------- -! land -> atmosphere variables structure -!---------------------------------------------------- - - type, public :: lnd2atm_type - real(r8), pointer :: t_rad(:) => null() !radiative temperature (Kelvin) - real(r8), pointer :: t_ref2m(:) => null() !2m surface air temperature (Kelvin) - real(r8), pointer :: q_ref2m(:) => null() !2m surface specific humidity (kg/kg) - real(r8), pointer :: u_ref10m(:) => null() !10m surface wind speed (m/sec) - real(r8), pointer :: h2osno(:) => null() !snow water (mm H2O) - real(r8), pointer :: albd(:,:) => null() !(numrad) surface albedo (direct) - real(r8), pointer :: albi(:,:) => null() !(numrad) surface albedo (diffuse) - real(r8), pointer :: taux(:) => null() !wind stress: e-w (kg/m/s**2) - real(r8), pointer :: tauy(:) => null() !wind stress: n-s (kg/m/s**2) - real(r8), pointer :: eflx_lh_tot(:) => null() !total latent HF (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot(:) => null() !total sensible HF (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lwrad_out(:) => null() !IR (longwave) radiation (W/m**2) - real(r8), pointer :: qflx_evap_tot(:) => null() !qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: fsa(:) => null() !solar rad absorbed (total) (W/m**2) - real(r8), pointer :: nee(:) => null() !net CO2 flux (kg CO2/m**2/s) [+ to atm] - real(r8), pointer :: ram1(:) => null() !aerodynamical resistance (s/m) - real(r8), pointer :: fv(:) => null() !friction velocity (m/s) (for dust model) - real(r8), pointer :: h2osoi_vol(:,:) => null() !volumetric soil water (0~watsat, m3/m3, nlevgrnd) (for dust model) - real(r8), pointer :: rofliq(:) => null() ! rof liq forcing - real(r8), pointer :: rofice(:) => null() ! rof ice forcing - real(r8), pointer :: flxdst(:,:) => null() !dust flux (size bins) - real(r8), pointer :: ddvel(:,:) => null() !dry deposition velocities - real(r8), pointer :: flxvoc(:,:) => null() ! VOC flux (size bins) - ! Needed for backwards compatibility with lnd_comp_mct used in clm4_5 - real(r8), pointer :: flux_ch4(:) => null() !net CH4 flux (kg C/m**2/s) [+ to atm] - end type lnd2atm_type - - type(atm2lnd_type),public,target :: clm_a2l ! a2l fields on clm grid - type(lnd2atm_type),public,target :: clm_l2a ! l2a fields on clm grid - - ! The following alias is needed just so that lnd_import_export can remain consistent - ! between the clm4_0 code and clm4_5 code. - class(atm2lnd_downscaled_fields_type),public,pointer :: a2l_not_downscaled_gcell - -! !PUBLIC MEMBER FUNCTIONS: - public :: init_atm2lnd_type - public :: init_lnd2atm_type - public :: clm_map2gcell_minimal - public :: clm_map2gcell -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein and Tony Craig, 2006-01-10 -! -! !PRIVATE MEMBER FUNCTIONS: - -!EOP -!---------------------------------------------------- - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_atm2lnd_type -! -! !INTERFACE: - subroutine init_atm2lnd_type(beg, end, a2l) -! -! !DESCRIPTION: -! Initialize atmospheric variables required by the land -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (atm2lnd_type), intent(inout):: a2l -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! Modified by T Craig, 11/01/05 for finemesh project -! -! -! !LOCAL VARIABLES: -!EOP - real(r8) :: ival ! initial value -!------------------------------------------------------------------------ - - allocate(a2l%forc_t(beg:end)) - allocate(a2l%forc_u(beg:end)) - allocate(a2l%forc_v(beg:end)) - allocate(a2l%forc_wind(beg:end)) - allocate(a2l%forc_q(beg:end)) - allocate(a2l%forc_rh(beg:end)) - allocate(a2l%forc_hgt(beg:end)) - allocate(a2l%forc_hgt_u(beg:end)) - allocate(a2l%forc_hgt_t(beg:end)) - allocate(a2l%forc_hgt_q(beg:end)) - allocate(a2l%forc_pbot(beg:end)) - allocate(a2l%forc_th(beg:end)) - allocate(a2l%forc_vp(beg:end)) - allocate(a2l%forc_rho(beg:end)) - allocate(a2l%forc_psrf(beg:end)) - allocate(a2l%forc_pco2(beg:end)) - allocate(a2l%forc_lwrad(beg:end)) - allocate(a2l%forc_solad(beg:end,numrad)) - allocate(a2l%forc_solai(beg:end,numrad)) - allocate(a2l%forc_solar(beg:end)) - allocate(a2l%forc_rain(beg:end)) - allocate(a2l%forc_snow(beg:end)) - allocate(a2l%forc_ndep(beg:end)) - allocate(a2l%forc_pc13o2(beg:end)) - allocate(a2l%forc_po2(beg:end)) - allocate(a2l%forc_flood(beg:end)) - allocate(a2l%volr(beg:end)) - allocate(a2l%volrmch(beg:end)) - allocate(a2l%forc_aer(beg:end,14)) - - ! ival = nan ! causes core dump in map_maparray, tcx fix - ival = 0.0_r8 - - a2l%forc_t(beg:end) = ival - a2l%forc_u(beg:end) = ival - a2l%forc_v(beg:end) = ival - a2l%forc_wind(beg:end) = ival - a2l%forc_q(beg:end) = ival - a2l%forc_rh(beg:end) = ival - a2l%forc_hgt(beg:end) = ival - a2l%forc_hgt_u(beg:end) = ival - a2l%forc_hgt_t(beg:end) = ival - a2l%forc_hgt_q(beg:end) = ival - a2l%forc_pbot(beg:end) = ival - a2l%forc_th(beg:end) = ival - a2l%forc_vp(beg:end) = ival - a2l%forc_rho(beg:end) = ival - a2l%forc_psrf(beg:end) = ival - a2l%forc_pco2(beg:end) = ival - a2l%forc_lwrad(beg:end) = ival - a2l%forc_solad(beg:end,1:numrad) = ival - a2l%forc_solai(beg:end,1:numrad) = ival - a2l%forc_solar(beg:end) = ival - a2l%forc_rain(beg:end) = ival - a2l%forc_snow(beg:end) = ival - a2l%forc_ndep(beg:end) = ival - a2l%forc_pc13o2(beg:end) = ival - a2l%forc_po2(beg:end) = ival - a2l%forc_flood(beg:end) = ival - a2l%volr(beg:end) = ival - a2l%volrmch(beg:end) = ival - a2l%forc_aer(beg:end,:) = ival - - ! The following alias is needed just so that lnd_import_export can remain consistent - ! between the clm4_0 code and clm4_5 code. - a2l_not_downscaled_gcell => clm_a2l - -end subroutine init_atm2lnd_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_lnd2atm_type -! -! !INTERFACE: - subroutine init_lnd2atm_type(beg, end, l2a) -! -! !DESCRIPTION: -! Initialize land variables required by the atmosphere -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (lnd2atm_type), intent(inout):: l2a -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! Modified by T Craig, 11/01/05 for finemesh project -! -! -! !LOCAL VARIABLES: -!EOP - real(r8) :: ival ! initial value -!------------------------------------------------------------------------ - - allocate(l2a%t_rad(beg:end)) - allocate(l2a%t_ref2m(beg:end)) - allocate(l2a%q_ref2m(beg:end)) - allocate(l2a%u_ref10m(beg:end)) - allocate(l2a%h2osno(beg:end)) - allocate(l2a%albd(beg:end,1:numrad)) - allocate(l2a%albi(beg:end,1:numrad)) - allocate(l2a%taux(beg:end)) - allocate(l2a%tauy(beg:end)) - allocate(l2a%eflx_lwrad_out(beg:end)) - allocate(l2a%eflx_sh_tot(beg:end)) - allocate(l2a%eflx_lh_tot(beg:end)) - allocate(l2a%qflx_evap_tot(beg:end)) - allocate(l2a%fsa(beg:end)) - allocate(l2a%nee(beg:end)) - allocate(l2a%ram1(beg:end)) - allocate(l2a%fv(beg:end)) - allocate(l2a%h2osoi_vol(beg:end,1:nlevgrnd)) - allocate(l2a%rofliq(beg:end)) - allocate(l2a%rofice(beg:end)) - allocate(l2a%flxdst(beg:end,1:ndst)) - if (shr_megan_mechcomps_n>0) then - allocate(l2a%flxvoc(beg:end,1:shr_megan_mechcomps_n)) - endif - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - allocate(l2a%ddvel(beg:end,1:n_drydep)) - end if - - ! ival = nan ! causes core dump in map_maparray, tcx fix - ival = 0.0_r8 - - l2a%t_rad(beg:end) = ival - l2a%t_ref2m(beg:end) = ival - l2a%q_ref2m(beg:end) = ival - l2a%u_ref10m(beg:end) = ival - l2a%h2osno(beg:end) = ival - l2a%albd(beg:end,1:numrad) = ival - l2a%albi(beg:end,1:numrad) = ival - l2a%taux(beg:end) = ival - l2a%tauy(beg:end) = ival - l2a%eflx_lwrad_out(beg:end) = ival - l2a%eflx_sh_tot(beg:end) = ival - l2a%eflx_lh_tot(beg:end) = ival - l2a%qflx_evap_tot(beg:end) = ival - l2a%fsa(beg:end) = ival - l2a%nee(beg:end) = ival - l2a%ram1(beg:end) = ival - l2a%fv(beg:end) = ival - l2a%h2osoi_vol(beg:end,1:nlevgrnd) = ival - l2a%rofliq(beg:end) = ival - l2a%rofice(beg:end) = ival - l2a%flxdst(beg:end,1:ndst) = ival - if (shr_megan_mechcomps_n>0) then - l2a%flxvoc(beg:end,1:shr_megan_mechcomps_n) = ival - endif - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - l2a%ddvel(beg:end, : ) = ival - end if - -end subroutine init_lnd2atm_type - -!------------------------------------------------------------------------ -! -! !IROUTINE: clm_map2gcell_minimal -! -! !INTERFACE: subroutine clm_map2gcell_minimal(init) -subroutine clm_map2gcell_minimal() -! -! !DESCRIPTION: -! Compute l2a component of gridcell derived type. This routine computes the -! bare minimum of components necessary to get the first step of a run -! started. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use subgridAveMod - use clm_varcon , only : sb - use clm_varpar , only : numrad -! -! !REVISION HISTORY: -! Sean Santos: Extracted from clm_map2gcell 2013/08/27 -! -! -! !LOCAL VARIABLES: - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - - integer :: g ! indices - real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon - real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen - real(r8), parameter :: amCO2 = amC + 2.0_r8*amO ! Atomic mass number for CO2 - ! The following converts g of C to kg of CO2 - real(r8), parameter :: convertgC2kgCO2 = 1.0e-3_r8 * (amCO2/amC) - -!------------------------------------------------------------------------ - - ! Determine processor bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! Compute gridcell averages. - - call c2g(begc, endc, begl, endl, begg, endg, & - cws%h2osno, clm_l2a%h2osno, & - c2l_scale_type= 'urbanf', l2g_scale_type='unity') - do g = begg,endg - clm_l2a%h2osno(g) = clm_l2a%h2osno(g)/1000._r8 - end do - - call c2g(begc, endc, begl, endl, begg, endg, nlevgrnd, & - cws%h2osoi_vol, clm_l2a%h2osoi_vol, & - c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, numrad, & - pps%albd, clm_l2a%albd,& - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, numrad, & - pps%albi, clm_l2a%albi,& - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pef%eflx_lwrad_out, clm_l2a%eflx_lwrad_out,& - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - do g = begg,endg - clm_l2a%t_rad(g) = sqrt(sqrt(clm_l2a%eflx_lwrad_out(g)/sb)) - end do - -end subroutine clm_map2gcell_minimal - -!------------------------------------------------------------------------ -! -! !IROUTINE: clm_map2gcell -! -! !INTERFACE: subroutine clm_map2gcell() -subroutine clm_map2gcell() -! -! !DESCRIPTION: -! Compute l2a component of gridcell derived type -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use subgridAveMod - use clm_varcon , only : sb - use clm_varpar , only : numrad -! -! !REVISION HISTORY: -! Mariana Vertenstein: created 03/10-25 -! 03-04-27 : Created by Mariana Vertenstein -! 03-08-25 : Updated to vector data structure (Mariana Vertenstein) -! -! -! !LOCAL VARIABLES: - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - - integer :: g ! indices - real(r8), parameter :: amC = 12.0_r8 ! Atomic mass number for Carbon - real(r8), parameter :: amO = 16.0_r8 ! Atomic mass number for Oxygen - real(r8), parameter :: amCO2 = amC + 2.0_r8*amO ! Atomic mass number for CO2 - ! The following converts g of C to kg of CO2 - real(r8), parameter :: convertgC2kgCO2 = 1.0e-3_r8 * (amCO2/amC) - -!------------------------------------------------------------------------ - - ! First, compute the "minimal" set of fields. - call clm_map2gcell_minimal() - - ! Determine processor bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! Compute remaining gridcell averages. - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pes%t_ref2m, clm_l2a%t_ref2m, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pes%q_ref2m, clm_l2a%q_ref2m, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pps%u10_clm, clm_l2a%u_ref10m, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pmf%taux, clm_l2a%taux, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pmf%tauy, clm_l2a%tauy, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pef%eflx_lh_tot, clm_l2a%eflx_lh_tot, & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - -!DML note: use new array: gef%eflx_sh_totg -! call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & -! pef%eflx_sh_tot, clm_l2a%eflx_sh_tot, & -! p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - do g = begg,endg - clm_l2a%eflx_sh_tot(g) = gef%eflx_sh_totg(g) - end do - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pwf%qflx_evap_tot, clm_l2a%qflx_evap_tot, & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pef%fsa, clm_l2a%fsa, & - p2c_scale_type='unity', c2l_scale_type= 'urbanf', l2g_scale_type='unity') - - if (use_cn) then - call c2g(begc, endc, begl, endl, begg, endg, & - ccf%nee, clm_l2a%nee, & - c2l_scale_type= 'unity', l2g_scale_type='unity') - else - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pcf%fco2, clm_l2a%nee, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - ! Note that fco2 in is umolC/m2/sec so units need to be changed to gC/m2/sec - do g = begg,endg - clm_l2a%nee(g) = clm_l2a%nee(g)*12.011e-6_r8 - end do - end if - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pps%fv, clm_l2a%fv, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, & - pps%ram1, clm_l2a%ram1, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - do g = begg,endg - clm_l2a%rofliq(g) = gwf%qflx_runoffg(g) - clm_l2a%rofice(g) = gwf%qflx_snwcp_iceg(g) - end do - - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, ndst, & - pdf%flx_mss_vrt_dst, clm_l2a%flxdst, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - - if (shr_megan_mechcomps_n>0) then - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, shr_megan_mechcomps_n, & - pvf%vocflx, clm_l2a%flxvoc, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - endif - - if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, n_drydep, & - pdd%drydepvel, clm_l2a%ddvel, & - p2c_scale_type='unity', c2l_scale_type= 'unity', l2g_scale_type='unity') - endif - - ! Convert from gC/m2/s to kgCO2/m2/s - do g = begg,endg - clm_l2a%nee(g) = clm_l2a%nee(g)*convertgC2kgCO2 - end do - -end subroutine clm_map2gcell - -!------------------------------------------------------------------------ -!------------------------------------------------------------------------ -end module clm_atmlnd - diff --git a/src_clm40/main/clm_cpl_indices.F90 b/src_clm40/main/clm_cpl_indices.F90 deleted file mode 100644 index b2a17229df..0000000000 --- a/src_clm40/main/clm_cpl_indices.F90 +++ /dev/null @@ -1,311 +0,0 @@ -module clm_cpl_indices - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing the indices for the fields passed between CLM and - ! the driver. Includes the River Transport Model fields (RTM) and the - ! fields needed by the land-ice component (sno). - ! - ! !USES: - - use shr_sys_mod, only : shr_sys_abort - implicit none - - SAVE - private ! By default make data private - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: clm_cpl_indices_set ! Set the coupler indices - ! - ! !PUBLIC DATA MEMBERS: - ! - integer , public :: glc_nec ! number of elevation classes for glacier_mec landunits - ! (from coupler) - must equal maxpatch_glcmec from namelist - integer , parameter, private:: glc_nec_max = 100 - - ! lnd -> drv (required) - - integer, public ::index_l2x_Flrl_rofsur ! lnd->rtm input surface liquid fluxes - integer, public ::index_l2x_Flrl_rofgwl ! lnd->rtm input gwl liquid fluxes - integer, public ::index_l2x_Flrl_rofsub ! lnd->rtm input subsurface liquid fluxes - integer, public ::index_l2x_Flrl_rofdto ! lnd->rtm input direct to ocean liquid fluxes - integer, public ::index_l2x_Flrl_rofi ! lnd->rtm input frozen fluxes - - integer, public ::index_l2x_Sl_t ! temperature - integer, public ::index_l2x_Sl_tref ! 2m reference temperature - integer, public ::index_l2x_Sl_qref ! 2m reference specific humidity - integer, public ::index_l2x_Sl_avsdr ! albedo: direct , visible - integer, public ::index_l2x_Sl_anidr ! albedo: direct , near-ir - integer, public ::index_l2x_Sl_avsdf ! albedo: diffuse, visible - integer, public ::index_l2x_Sl_anidf ! albedo: diffuse, near-ir - integer, public ::index_l2x_Sl_snowh ! snow height - integer, public ::index_l2x_Sl_u10 ! 10m wind - integer, public ::index_l2x_Sl_ddvel ! dry deposition velocities (optional) - integer, public ::index_l2x_Sl_fv ! friction velocity - integer, public ::index_l2x_Sl_ram1 ! aerodynamical resistance - integer, public ::index_l2x_Sl_soilw ! volumetric soil water - integer, public ::index_l2x_Fall_taux ! wind stress, zonal - integer, public ::index_l2x_Fall_tauy ! wind stress, meridional - integer, public ::index_l2x_Fall_lat ! latent heat flux - integer, public ::index_l2x_Fall_sen ! sensible heat flux - integer, public ::index_l2x_Fall_lwup ! upward longwave heat flux - integer, public ::index_l2x_Fall_evap ! evaporation water flux - integer, public ::index_l2x_Fall_swnet ! heat flux shortwave net - integer, public ::index_l2x_Fall_fco2_lnd ! co2 flux **For testing set to 0 - integer, public ::index_l2x_Fall_flxdst1 ! dust flux size bin 1 - integer, public ::index_l2x_Fall_flxdst2 ! dust flux size bin 2 - integer, public ::index_l2x_Fall_flxdst3 ! dust flux size bin 3 - integer, public ::index_l2x_Fall_flxdst4 ! dust flux size bin 4 - integer, public ::index_l2x_Fall_flxvoc ! MEGAN fluxes - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, public ::index_l2x_Sl_tsrf(0:glc_nec_max) = 0 ! glc MEC temperature - integer, public ::index_l2x_Sl_topo(0:glc_nec_max) = 0 ! glc MEC topo height - integer, public ::index_l2x_Flgl_qice(0:glc_nec_max) = 0 ! glc MEC ice flux - - integer, public ::index_x2l_Sa_methane - integer, public ::index_l2x_Fall_methane - - integer, public :: nflds_l2x = 0 - - ! drv -> lnd (required) - - integer, public ::index_x2l_Sa_z ! bottom atm level height - integer, public ::index_x2l_Sa_u ! bottom atm level zon wind - integer, public ::index_x2l_Sa_v ! bottom atm level mer wind - integer, public ::index_x2l_Sa_ptem ! bottom atm level pot temp - integer, public ::index_x2l_Sa_shum ! bottom atm level spec hum - integer, public ::index_x2l_Sa_pbot ! bottom atm level pressure - integer, public ::index_x2l_Sa_tbot ! bottom atm level temp - integer, public ::index_x2l_Faxa_lwdn ! downward lw heat flux - integer, public ::index_x2l_Faxa_rainc ! prec: liquid "convective" - integer, public ::index_x2l_Faxa_rainl ! prec: liquid "large scale" - integer, public ::index_x2l_Faxa_snowc ! prec: frozen "convective" - integer, public ::index_x2l_Faxa_snowl ! prec: frozen "large scale" - integer, public ::index_x2l_Faxa_swndr ! sw: nir direct downward - integer, public ::index_x2l_Faxa_swvdr ! sw: vis direct downward - integer, public ::index_x2l_Faxa_swndf ! sw: nir diffuse downward - integer, public ::index_x2l_Faxa_swvdf ! sw: vis diffuse downward - integer, public ::index_x2l_Sa_co2prog ! bottom atm level prognostic co2 - integer, public ::index_x2l_Sa_co2diag ! bottom atm level diagnostic co2 - integer, public ::index_x2l_Faxa_bcphidry ! flux: Black Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_bcphodry ! flux: Black Carbon hydrophobic dry deposition - integer, public ::index_x2l_Faxa_bcphiwet ! flux: Black Carbon hydrophilic wet deposition - integer, public ::index_x2l_Faxa_ocphidry ! flux: Organic Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_ocphodry ! flux: Organic Carbon hydrophobic dry deposition - integer, public ::index_x2l_Faxa_ocphiwet ! flux: Organic Carbon hydrophilic dry deposition - integer, public ::index_x2l_Faxa_dstwet1 ! flux: Size 1 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet2 ! flux: Size 2 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet3 ! flux: Size 3 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstwet4 ! flux: Size 4 dust -- wet deposition - integer, public ::index_x2l_Faxa_dstdry1 ! flux: Size 1 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry2 ! flux: Size 2 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry3 ! flux: Size 3 dust -- dry deposition - integer, public ::index_x2l_Faxa_dstdry4 ! flux: Size 4 dust -- dry deposition - - integer, public ::index_x2l_Flrr_flood ! rtm->lnd rof (flood) flux - integer, public ::index_x2l_Flrr_volr ! rtm->lnd rof volr total volume - integer, public ::index_x2l_Flrr_volrmch ! rtm->lnd rof volr main channel volume - - ! In the following, index 0 is bare land, other indices are glc elevation classes - integer, public ::index_x2l_Sg_ice_covered(0:glc_nec_max) = 0 ! Fraction of glacier from glc model - integer, public ::index_x2l_Sg_topo(0:glc_nec_max) = 0 ! Topo height from glc model - integer, public ::index_x2l_Flgg_hflx(0:glc_nec_max) = 0 ! Heat flux from glc model - - integer, public ::index_x2l_Sg_icemask - - integer, public :: nflds_x2l = 0 - - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine clm_cpl_indices_set( ) - ! - ! !DESCRIPTION: - ! Set the coupler indices needed by the land model coupler - ! interface. - ! - ! !USES: - use seq_flds_mod , only: seq_flds_x2l_fields, seq_flds_l2x_fields - use mct_mod , only: mct_aVect, mct_aVect_init, mct_avect_indexra - use mct_mod , only: mct_aVect_clean, mct_avect_nRattr - use seq_drydep_mod , only: drydep_fields_token, lnd_drydep - use shr_megan_mod , only: shr_megan_fields_token, shr_megan_mechcomps_n - use clm_varctl , only: use_voc - ! - ! !ARGUMENTS: - implicit none - ! - ! !REVISION HISTORY: - ! Author: Mariana Vertenstein - ! 01/2011, Erik Kluzek: Added protex headers - ! - ! !LOCAL VARIABLES: - type(mct_aVect) :: l2x ! temporary, land to coupler - type(mct_aVect) :: x2l ! temporary, coupler to land - integer :: num - character(len= 2) :: cnum - character(len=64) :: name - character(len=32) :: subname = 'clm_cpl_indices_set' ! subroutine name - !----------------------------------------------------------------------- - - ! Determine attribute vector indices - - ! create temporary attribute vectors - call mct_aVect_init(x2l, rList=seq_flds_x2l_fields, lsize=1) - nflds_x2l = mct_avect_nRattr(x2l) - - call mct_aVect_init(l2x, rList=seq_flds_l2x_fields, lsize=1) - nflds_l2x = mct_avect_nRattr(l2x) - - !------------------------------------------------------------- - ! clm -> drv - !------------------------------------------------------------- - - index_l2x_Flrl_rofsur = mct_avect_indexra(l2x,'Flrl_rofsur') - index_l2x_Flrl_rofgwl = mct_avect_indexra(l2x,'Flrl_rofgwl') - index_l2x_Flrl_rofsub = mct_avect_indexra(l2x,'Flrl_rofsub') - index_l2x_Flrl_rofdto = mct_avect_indexra(l2x,'Flrl_rofdto') - index_l2x_Flrl_rofi = mct_avect_indexra(l2x,'Flrl_rofi') - - index_l2x_Sl_t = mct_avect_indexra(l2x,'Sl_t') - index_l2x_Sl_snowh = mct_avect_indexra(l2x,'Sl_snowh') - index_l2x_Sl_avsdr = mct_avect_indexra(l2x,'Sl_avsdr') - index_l2x_Sl_anidr = mct_avect_indexra(l2x,'Sl_anidr') - index_l2x_Sl_avsdf = mct_avect_indexra(l2x,'Sl_avsdf') - index_l2x_Sl_anidf = mct_avect_indexra(l2x,'Sl_anidf') - index_l2x_Sl_tref = mct_avect_indexra(l2x,'Sl_tref') - index_l2x_Sl_qref = mct_avect_indexra(l2x,'Sl_qref') - index_l2x_Sl_u10 = mct_avect_indexra(l2x,'Sl_u10') - index_l2x_Sl_ram1 = mct_avect_indexra(l2x,'Sl_ram1') - index_l2x_Sl_fv = mct_avect_indexra(l2x,'Sl_fv') - index_l2x_Sl_soilw = mct_avect_indexra(l2x,'Sl_soilw',perrwith='quiet') - if ( lnd_drydep )then - index_l2x_Sl_ddvel = mct_avect_indexra(l2x, trim(drydep_fields_token)) - else - index_l2x_Sl_ddvel = 0 - end if - - index_l2x_Fall_taux = mct_avect_indexra(l2x,'Fall_taux') - index_l2x_Fall_tauy = mct_avect_indexra(l2x,'Fall_tauy') - index_l2x_Fall_lat = mct_avect_indexra(l2x,'Fall_lat') - index_l2x_Fall_sen = mct_avect_indexra(l2x,'Fall_sen') - index_l2x_Fall_lwup = mct_avect_indexra(l2x,'Fall_lwup') - index_l2x_Fall_evap = mct_avect_indexra(l2x,'Fall_evap') - index_l2x_Fall_swnet = mct_avect_indexra(l2x,'Fall_swnet') - index_l2x_Fall_flxdst1 = mct_avect_indexra(l2x,'Fall_flxdst1') - index_l2x_Fall_flxdst2 = mct_avect_indexra(l2x,'Fall_flxdst2') - index_l2x_Fall_flxdst3 = mct_avect_indexra(l2x,'Fall_flxdst3') - index_l2x_Fall_flxdst4 = mct_avect_indexra(l2x,'Fall_flxdst4') - - index_l2x_Fall_fco2_lnd = mct_avect_indexra(l2x,'Fall_fco2_lnd',perrwith='quiet') - - index_l2x_Fall_methane = mct_avect_indexra(l2x,'Fall_methane',perrWith='quiet') - - ! MEGAN fluxes - ! use_voc is a temporary logic to enable turning off MEGAN fluxes when prognostic crop - ! is used - if (shr_megan_mechcomps_n>0 .and. use_voc) then - index_l2x_Fall_flxvoc = mct_avect_indexra(l2x,trim(shr_megan_fields_token)) - else - index_l2x_Fall_flxvoc = 0 - endif - - !------------------------------------------------------------- - ! drv -> clm - !------------------------------------------------------------- - - index_x2l_Sa_z = mct_avect_indexra(x2l,'Sa_z') - index_x2l_Sa_u = mct_avect_indexra(x2l,'Sa_u') - index_x2l_Sa_v = mct_avect_indexra(x2l,'Sa_v') - index_x2l_Sa_ptem = mct_avect_indexra(x2l,'Sa_ptem') - index_x2l_Sa_pbot = mct_avect_indexra(x2l,'Sa_pbot') - index_x2l_Sa_tbot = mct_avect_indexra(x2l,'Sa_tbot') - index_x2l_Sa_shum = mct_avect_indexra(x2l,'Sa_shum') - index_x2l_Sa_co2prog = mct_avect_indexra(x2l,'Sa_co2prog',perrwith='quiet') - index_x2l_Sa_co2diag = mct_avect_indexra(x2l,'Sa_co2diag',perrwith='quiet') - - index_x2l_Sa_methane = mct_avect_indexra(x2l,'Sa_methane',perrWith='quiet') - - index_x2l_Flrr_volr = mct_avect_indexra(x2l,'Flrr_volr') - index_x2l_Flrr_volrmch = mct_avect_indexra(x2l,'Flrr_volrmch') - - index_x2l_Faxa_lwdn = mct_avect_indexra(x2l,'Faxa_lwdn') - index_x2l_Faxa_rainc = mct_avect_indexra(x2l,'Faxa_rainc') - index_x2l_Faxa_rainl = mct_avect_indexra(x2l,'Faxa_rainl') - index_x2l_Faxa_snowc = mct_avect_indexra(x2l,'Faxa_snowc') - index_x2l_Faxa_snowl = mct_avect_indexra(x2l,'Faxa_snowl') - index_x2l_Faxa_swndr = mct_avect_indexra(x2l,'Faxa_swndr') - index_x2l_Faxa_swvdr = mct_avect_indexra(x2l,'Faxa_swvdr') - index_x2l_Faxa_swndf = mct_avect_indexra(x2l,'Faxa_swndf') - index_x2l_Faxa_swvdf = mct_avect_indexra(x2l,'Faxa_swvdf') - index_x2l_Faxa_bcphidry = mct_avect_indexra(x2l,'Faxa_bcphidry') - index_x2l_Faxa_bcphodry = mct_avect_indexra(x2l,'Faxa_bcphodry') - index_x2l_Faxa_bcphiwet = mct_avect_indexra(x2l,'Faxa_bcphiwet') - index_x2l_Faxa_ocphidry = mct_avect_indexra(x2l,'Faxa_ocphidry') - index_x2l_Faxa_ocphodry = mct_avect_indexra(x2l,'Faxa_ocphodry') - index_x2l_Faxa_ocphiwet = mct_avect_indexra(x2l,'Faxa_ocphiwet') - index_x2l_Faxa_dstdry1 = mct_avect_indexra(x2l,'Faxa_dstdry1') - index_x2l_Faxa_dstdry2 = mct_avect_indexra(x2l,'Faxa_dstdry2') - index_x2l_Faxa_dstdry3 = mct_avect_indexra(x2l,'Faxa_dstdry3') - index_x2l_Faxa_dstdry4 = mct_avect_indexra(x2l,'Faxa_dstdry4') - index_x2l_Faxa_dstwet1 = mct_avect_indexra(x2l,'Faxa_dstwet1') - index_x2l_Faxa_dstwet2 = mct_avect_indexra(x2l,'Faxa_dstwet2') - index_x2l_Faxa_dstwet3 = mct_avect_indexra(x2l,'Faxa_dstwet3') - index_x2l_Faxa_dstwet4 = mct_avect_indexra(x2l,'Faxa_dstwet4') - - index_x2l_Flrr_flood = mct_avect_indexra(x2l,'Flrr_flood') - - !------------------------------------------------------------- - ! glc coupling - !------------------------------------------------------------- - - glc_nec = 0 - - do num = 0,glc_nec_max - - write(cnum,'(i2.2)') num - name = 'Sg_ice_covered' // cnum - index_x2l_Sg_ice_covered(num) = mct_avect_indexra(x2l,trim(name),perrwith='quiet') - name = 'Sg_topo' // cnum - index_x2l_Sg_topo(num) = mct_avect_indexra(x2l,trim(name),perrwith='quiet') - name = 'Flgg_hflx' // cnum - index_x2l_Flgg_hflx(num) = mct_avect_indexra(x2l,trim(name),perrwith='quiet') - if ( index_x2l_Sg_ice_covered(num) == 0 .and. & - index_x2l_Sg_topo(num) == 0 .and. & - index_x2l_Flgg_hflx(num) == 0 ) then - exit - end if - glc_nec = num - end do - - index_x2l_Sg_icemask = mct_avect_indexra(x2l,'Sg_icemask',perrwith='quiet') - - if (glc_nec == glc_nec_max) then - call shr_sys_abort (subname // 'error: glc_nec_cpl cannot equal glc_nec_max') - end if - - ! If glc_nec > 0, then create coupling fields for all glc elevation classes - ! (1:glc_nec) plus bare land (index 0). Note that, if glc_nec = 0, then we don't - ! even need the bare land (0) index. - if (glc_nec > 0) then - do num = 0,glc_nec - write(cnum,'(i2.2)') num - name = 'Sl_tsrf' // cnum - index_l2x_Sl_tsrf(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Sl_topo' // cnum - index_l2x_Sl_topo(num) = mct_avect_indexra(l2x,trim(name)) - name = 'Flgl_qice' // cnum - index_l2x_Flgl_qice(num) = mct_avect_indexra(l2x,trim(name)) - end do - end if - - call mct_aVect_clean(x2l) - call mct_aVect_clean(l2x) - - end subroutine clm_cpl_indices_set - -!======================================================================= - -end module clm_cpl_indices diff --git a/src_clm40/main/clm_driver.F90 b/src_clm40/main/clm_driver.F90 deleted file mode 100644 index c7a5b28507..0000000000 --- a/src_clm40/main/clm_driver.F90 +++ /dev/null @@ -1,903 +0,0 @@ -module clm_driver - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_driver -! -! !DESCRIPTION: -! This module provides the main CLM driver physics calling sequence. Most -! computations occurs over ``clumps'' of gridcells (and associated subgrid -! scale entities) assigned to each MPI process. Computation is further -! parallelized by looping over clumps on each process using shared memory OpenMP. -! -! The main CLM driver physics calling sequence for clm_driver1 is as follows: -! \begin{verbatim} -! -! + interpMonthlyVeg interpolate monthly vegetation data [! CN or ! CNDV] -! + readMonthlyVegetation read vegetation data for two months [! CN or ! CNDV] -! -! ==== Begin Loop over clumps ==== -! -> dynland_hwcontent Get initial heat, water content -! + pftdyn_interp [pftdyn] -! + dynland_hwcontent Get new heat, water content [pftdyn] -! ==== End Loop over clumps ==== -! -! ==== Begin Loop over clumps ==== -! -> clm_driverInit save of variables from previous time step -! -> Hydrology1 canopy interception and precip on ground -! -> FracWet fraction of wet vegetated surface and dry elai -! -> SurfaceRadiation surface solar radiation -! -> UrbanRadiation surface solar and longwave radiation for Urban landunits -! -> Biogeophysics1 leaf temperature and surface fluxes -! -> BareGroundFluxes surface fluxes for bare soil or snow-covered -! vegetation patches -! -> UrbanFluxes surface fluxes for urban landunits -! -> MoninObukIni first-guess Monin-Obukhov length and wind speed -! -> FrictionVelocity friction velocity and potential temperature and -! humidity profiles -! -> CanopyFluxes leaf temperature and surface fluxes for vegetated -! patches -! -> QSat saturated vapor pressure, specific humidity, & -! derivatives at leaf surface -! -> MoninObukIni first-guess Monin-Obukhov length and wind speed -! -> FrictionVelocity friction velocity and potential temperature and -! humidity profiles -! -> Stomata stomatal resistance and photosynthesis for -! sunlit leaves -! -> Stomata stomatal resistance and photosynthesis for -! shaded leaves -! -> QSat recalculation of saturated vapor pressure, -! specific humidity, & derivatives at leaf surface -! + DustEmission Dust mobilization -! + DustDryDep Dust dry deposition -! -> Biogeophysics_Lake lake temperature and surface fluxes -! + VOCEmission compute VOC emission [VOC] -! -> Biogeophysics2 soil/snow & ground temp and update surface fluxes -! -> pft2col Average from PFT level to column level -! -> Hydrology2 surface and soil hydrology -! -> Hydrology_Lake lake hydrology -! -> SnowAge_grain update snow effective grain size for snow radiative transfer -! + CNEcosystemDyn Carbon Nitrogen model ecosystem dynamics: [CN] -! vegetation phenology and soil carbon -! + EcosystemDyn "static" ecosystem dynamics: [! CN ] -! vegetation phenology and soil carbon -! -> BalanceCheck check for errors in energy and water balances -! -> SurfaceAlbedo albedos for next time step -! -> UrbanAlbedo Urban landunit albedos for next time step -! ==== End Loop over clumps ==== -! -! Second phase of the clm main driver, for handling history and restart file output. -! -! -> write_diagnostic output diagnostic if appropriate -! -> updateAccFlds update accumulated fields -! -> hist_update_hbuf accumulate history fields for time interval -! -> htapes_wrapup write history tapes if appropriate -! -> restFile_write write restart file if appropriate -! \end{verbatim} -! -! Optional subroutines are denoted by an plus (+) with the associated -! CPP token or variable in brackets at the end of the line. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use clm_varctl , only : wrtdia, flanduse_timeseries, iulog, create_glacier_mec_landunit, & - use_cn, use_cndv, use_exit_spinup - use spmdMod , only : masterproc,mpicom - use decompMod , only : get_proc_clumps, get_clump_bounds, get_proc_bounds - use filterMod , only : filter, setFilters - use CNDVMod , only : dv, histCNDV - use pftdynMod , only : pftwt_interp - use pftdynMod , only : pftdyn_interp, pftdyn_wbal_init, pftdyn_wbal - use pftdynMod , only : pftdyn_cnbal - use dynlandMod , only : dynland_hwcontent - use clm_varcon , only : zlnd, isturb - use clm_time_manager , only : get_step_size,get_curr_date,get_ref_date,get_nstep - use CropRestMod , only : CropRestIncYear - use histFileMod , only : hist_update_hbuf, hist_htapes_wrapup - use restFileMod , only : restFile_write, restFile_filename - use accFldsMod , only : updateAccFlds - use clm_driverInitMod , only : clm_driverInit - use BalanceCheckMod , only : BeginWaterBalance, BalanceCheck - use SurfaceRadiationMod , only : SurfaceRadiation - use Hydrology1Mod , only : Hydrology1 - use Hydrology2Mod , only : Hydrology2 - use HydrologyLakeMod , only : HydrologyLake - use Biogeophysics1Mod , only : Biogeophysics1 - use BareGroundFluxesMod , only : BareGroundFluxes - use CanopyFluxesMod , only : CanopyFluxes - use Biogeophysics2Mod , only : Biogeophysics2 - use BiogeophysicsLakeMod, only : BiogeophysicsLake - use SurfaceAlbedoMod , only : SurfaceAlbedo - use pft2colMod , only : pft2col - use CNSetValueMod , only : CNZeroFluxes_dwt - use CNEcosystemDynMod , only : CNEcosystemDyn - use CNAnnualUpdateMod , only : CNAnnualUpdate - use CNBalanceCheckMod , only : BeginCBalance, BeginNBalance, & - CBalanceCheck, NBalanceCheck - use ndepStreamMod , only : ndep_interp - use STATICEcosysDynMod , only : EcosystemDyn - use DUSTMod , only : DustDryDep, DustEmission - use VOCEmissionMod , only : VOCEmission - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use STATICEcosysDynMod , only : interpMonthlyVeg - use DryDepVelocity , only : depvel_compute - use abortutils , only : endrun - use UrbanMod , only : UrbanAlbedo, UrbanRadiation, UrbanFluxes - use SNICARMod , only : SnowAge_grain - use clm_atmlnd , only : clm_map2gcell - use clm_glclnd , only : update_clm_s2x - use perf_mod -! -! !PUBLIC TYPES: - implicit none -! -! !PUBLIC MEMBER FUNCTIONS: - public :: clm_drv ! clm physics,history, restart writes -! -! !PRIVATE MEMBER FUNCTIONS: - private :: write_diagnostic ! Write diagnostic information to log file -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: clm_drv -! -! !INTERFACE: -subroutine clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate) -! -! !DESCRIPTION: -! -! First phase of the clm driver calling the clm physics. An outline of -! the calling tree is given in the description of this module. -! -! !USES: - -! !ARGUMENTS: - implicit none - logical, intent(in) :: doalb ! true if time for surface albedo calc - real(r8), intent(in) :: nextsw_cday ! calendar day for nstep+1 - real(r8), intent(in) :: declinp1 ! declination angle for next time step - real(r8), intent(in) :: declin ! declination angle for current time step - logical, intent(in) :: rstwr ! true => write restart file this step - logical, intent(in) :: nlend ! true => end of run on this step - character(len=*),intent(in) :: rdate ! restart file time stamp for name -! -! !REVISION HISTORY: -! 2002.10.01 Mariana Vertenstein latest update to new data structures -! 11/26/03, Peter Thornton: Added new call for SurfaceRadiationSunShade when -! cpp directive SUNSHA is set, for sunlit/shaded canopy radiation. -! 4/25/05, Peter Thornton: Made the sun/shade routine the default, no longer -! need to have SUNSHA defined. -! Oct/05 & Jul/07 Sam Levis: Starting dates of CNDV and crop model work -! 2/29/08, Dave Lawrence: Revised snow cover fraction according to Niu and Yang, 2007 -! 3/6/09, Peter Thornton: Added declin as new argument, for daylength control on Vcmax -! 2008.11.12 B. Kauffman: morph routine casa() in casa_ecosytemDyn(), so casa -! is more similar to CN & DGVM -! 2/25/2012 M. Vertenstein: Removed CASA references -! -!EOP -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: clandunit(:) ! landunit index associated with each column - integer , pointer :: itypelun(:) ! landunit type -! -! !OTHER LOCAL VARIABLES: - integer :: nstep ! time step number - real(r8) :: dtime ! land model time step (sec) - real(r8) :: t1, t2, t3 ! temporary for mass balance checks - integer :: nc, fc, c, fp, p, l, g ! indices - integer :: nclumps ! number of clumps on this processor - integer :: begg, endg ! clump beginning and ending gridcell indices - integer :: begl, endl ! clump beginning and ending landunit indices - integer :: begc, endc ! clump beginning and ending column indices - integer :: begp, endp ! clump beginning and ending pft indices - integer :: begg_proc, endg_proc ! proc beginning and ending gridcell indices - integer :: begl_proc, endl_proc ! proc beginning and ending landunit indices - integer :: begc_proc, endc_proc ! proc beginning and ending column indices - integer :: begp_proc, endp_proc ! proc beginning and ending pft indices - type(column_type), pointer :: cptr ! pointer to column derived subtype - integer :: yrp1 ! year (0, ...) for nstep+1 - integer :: monp1 ! month (1, ..., 12) for nstep+1 - integer :: dayp1 ! day of month (1, ..., 31) for nstep+1 - integer :: secp1 ! seconds into current date for nstep+1 - integer :: yr ! year (0, ...) - integer :: mon ! month (1, ..., 12) - integer :: day ! day of month (1, ..., 31) - integer :: sec ! seconds of the day - integer :: ncdate ! current date - integer :: nbdate ! base date (reference date) - integer :: kyr ! thousand years, equals 2 at end of first year - character(len=256) :: filer ! restart file name - integer :: ier ! error code -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (landunit-level) - - itypelun => lun%itype - - ! Assign local pointers to derived subtypes components (column-level) - - clandunit => col%landunit - - ! Set pointers into derived type - - cptr => col - - ! Update time-related info - - call CropRestIncYear() - - - if (use_cn) then - ! For dry-deposition need to call CLMSP so that mlaidiff is obtained - if ( n_drydep > 0 .and. drydep_method == DD_XLND ) then - call t_startf('interpMonthlyVeg') - call interpMonthlyVeg() - call t_stopf('interpMonthlyVeg') - endif - 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 ecosystemdyn to obtain time - ! interpolated values. - if (doalb .or. ( n_drydep > 0 .and. drydep_method == DD_XLND )) then - call t_startf('interpMonthlyVeg') - call interpMonthlyVeg() - call t_stopf('interpMonthlyVeg') - end if - end if - - ! ============================================================================ - ! Loop over clumps - ! ============================================================================ - - nclumps = get_proc_clumps() - - !$OMP PARALLEL DO PRIVATE (nc,g,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1,nclumps - - ! ============================================================================ - ! Determine clump boundaries - ! ============================================================================ - - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - ! ============================================================================ - ! change pft weights and compute associated heat & water fluxes - ! ============================================================================ - - ! initialize heat and water content and dynamic balance fields to zero - do g = begg,endg - gwf%qflx_liq_dynbal(g) = 0._r8 - gws%gc_liq2(g) = 0._r8 - gws%gc_liq1(g) = 0._r8 - gwf%qflx_ice_dynbal(g) = 0._r8 - gws%gc_ice2(g) = 0._r8 - gws%gc_ice1(g) = 0._r8 - gef%eflx_dynbal(g) = 0._r8 - ges%gc_heat2(g) = 0._r8 - ges%gc_heat1(g) = 0._r8 - enddo - - !--- get initial heat,water content --- - call dynland_hwcontent( begg, endg, gws%gc_liq1(begg:endg), & - gws%gc_ice1(begg:endg), ges%gc_heat1(begg:endg) ) - end do - !$OMP END PARALLEL DO - - if (.not. use_cndv) then - if (flanduse_timeseries /= ' ') then - call pftdyn_interp ! change the pft weights - - !$OMP PARALLEL DO PRIVATE (nc,g,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1,nclumps - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - !--- get new heat,water content: (new-old)/dt = flux into lnd model --- - call dynland_hwcontent( begg, endg, gws%gc_liq2(begg:endg), & - gws%gc_ice2(begg:endg), ges%gc_heat2(begg:endg) ) - dtime = get_step_size() - do g = begg,endg - gwf%qflx_liq_dynbal(g) = (gws%gc_liq2 (g) - gws%gc_liq1 (g))/dtime - gwf%qflx_ice_dynbal(g) = (gws%gc_ice2 (g) - gws%gc_ice1 (g))/dtime - gef%eflx_dynbal (g) = (ges%gc_heat2(g) - ges%gc_heat1(g))/dtime - enddo - end do - !$OMP END PARALLEL DO - end if - end if - - !$OMP PARALLEL DO PRIVATE (nc,g,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1,nclumps - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - ! ============================================================================ - ! Initialize the mass balance checks: water, carbon, and nitrogen - ! ============================================================================ - - call t_startf('begwbal') - call BeginWaterBalance(begc, endc, begp, endp, & - filter(nc)%num_nolakec, filter(nc)%nolakec, filter(nc)%num_lakec, filter(nc)%lakec, & - filter(nc)%num_hydrologyc, filter(nc)%hydrologyc) - call t_stopf('begwbal') - - if (use_cn) then - call t_startf('begcnbal') - call BeginCBalance(begc, endc, filter(nc)%num_soilc, filter(nc)%soilc) - call BeginNBalance(begc, endc, filter(nc)%num_soilc, filter(nc)%soilc) - call t_stopf('begcnbal') - end if - - end do - !$OMP END PARALLEL DO - - ! ============================================================================ - ! Initialize h2ocan_loss to zero - ! ============================================================================ - - call t_startf('pftdynwts') - - !$OMP PARALLEL DO PRIVATE (nc,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1,nclumps - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - call pftdyn_wbal_init( begc, endc ) - - if (use_cndv) then - ! NOTE: Currently CNDV and flanduse_timeseries /= ' ' are incompatible - call CNZeroFluxes_dwt( begc, endc, begp, endp ) - call pftwt_interp( begp, endp ) - call pftdyn_wbal( begg, endg, begc, endc, begp, endp ) - call pftdyn_cnbal( begc, endc, begp, endp ) - call setFilters(nc) - else - ! ============================================================================ - ! Update weights and reset filters if dynamic land use - ! This needs to be done outside the clumps loop, but after BeginWaterBalance() - ! The call to CNZeroFluxes_dwt() is needed regardless of flanduse_timeseries - ! ============================================================================ - if (use_cn) then - call CNZeroFluxes_dwt( begc, endc, begp, endp ) - end if - if (flanduse_timeseries /= ' ') then - if (use_cn) then - call pftdyn_cnbal( begc, endc, begp, endp ) - end if - call setFilters(nc) - end if - end if - - end do - !$OMP END PARALLEL DO - - - if (use_cn) then - ! ============================================================================ - ! Update dynamic N deposition field, on albedo timestep - ! currently being done outside clumps loop, but no reason why it couldn't be - ! re-written to go inside. - ! ============================================================================ - ! PET: switching CN timestep - call ndep_interp() - end if - call t_stopf('pftdynwts') - - !$OMP PARALLEL DO PRIVATE (nc,l,c,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1,nclumps - - ! ============================================================================ - ! Determine clump boundaries - ! ============================================================================ - - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - ! ============================================================================ - ! Initialize variables from previous time step and - ! Determine canopy interception and precipitation onto ground surface. - ! Determine the fraction of foliage covered by water and the fraction - ! of foliage that is dry and transpiring. Initialize snow layer if the - ! snow accumulation exceeds 10 mm. - ! ============================================================================ - - ! initialize intracellular CO2 (Pa) parameters each timestep for use in VOCEmission - pps%cisun(begp:endp) = -999._r8 - pps%cisha(begp:endp) = -999._r8 - - ! initialize declination for current timestep - do c = begc,endc - cps%decl(c) = declin - end do - - call t_startf('drvinit') - call clm_driverInit(begc, endc, begp, endp, & - filter(nc)%num_nolakec, filter(nc)%nolakec, filter(nc)%num_lakec, filter(nc)%lakec) - call t_stopf('drvinit') - - ! ============================================================================ - ! Hydrology1 - ! ============================================================================ - - call t_startf('hydro1') - call Hydrology1(begc, endc, begp, endp, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep) - call t_stopf('hydro1') - - ! ============================================================================ - ! Surface Radiation - ! ============================================================================ - - call t_startf('surfrad') - - ! Surface Radiation for non-urban columns - - call SurfaceRadiation(begp, endp, & - filter(nc)%num_nourbanp, filter(nc)%nourbanp) - - ! Surface Radiation for urban columns - - call UrbanRadiation(nc, begl, endl, begc, endc, begp, endp, & - filter(nc)%num_nourbanl, filter(nc)%nourbanl, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_urbanp, filter(nc)%urbanp) - - call t_stopf('surfrad') - - ! ============================================================================ - ! Determine leaf temperature and surface fluxes based on ground - ! temperature from previous time step. - ! ============================================================================ - - call t_startf('bgp1') - call Biogeophysics1(begg, endg, begc, endc, begp, endp, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep) - call t_stopf('bgp1') - - ! ============================================================================ - ! Determine bare soil or snow-covered vegetation surface temperature and fluxes - ! Calculate Ground fluxes (frac_veg_nosno is either 1 or 0) - ! ============================================================================ - - call t_startf('bgflux') - - ! BareGroundFluxes for all pfts except lakes and urban landunits - - call BareGroundFluxes(begp, endp, & - filter(nc)%num_nolakeurbanp, filter(nc)%nolakeurbanp) - call t_stopf('bgflux') - - ! Fluxes for all Urban landunits - - call t_startf('uflux') - call UrbanFluxes(nc, begp, endp, begl, endl, begc, endc, & - filter(nc)%num_nourbanl, filter(nc)%nourbanl, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_urbanp, filter(nc)%urbanp) - call t_stopf('uflux') - - ! ============================================================================ - ! Determine non snow-covered vegetation surface temperature and fluxes - ! Calculate canopy temperature, latent and sensible fluxes from the canopy, - ! and leaf water change by evapotranspiration - ! ============================================================================ - - call t_startf('canflux') - call CanopyFluxes(begg, endg, begc, endc, begp, endp, & - filter(nc)%num_nolakep, filter(nc)%nolakep) - call t_stopf('canflux') - - ! ============================================================================ - ! Determine lake temperature and surface fluxes - ! ============================================================================ - - call t_startf('bgplake') - call BiogeophysicsLake(begc, endc, begp, endp, & - filter(nc)%num_lakec, filter(nc)%lakec, & - filter(nc)%num_lakep, filter(nc)%lakep) - call t_stopf('bgplake') - - ! ============================================================================ - ! DUST and VOC emissions - ! ============================================================================ - - call t_startf('bgc') - - ! Dust mobilization (C. Zender's modified codes) - call DustEmission(begp, endp, begc, endc, begl, endl, & - filter(nc)%num_nolakep, filter(nc)%nolakep) - - ! Dust dry deposition (C. Zender's modified codes) - call DustDryDep(begp, endp) - - ! VOC emission (A. Guenther's MEGAN (2006) model) - call VOCEmission(begp, endp, & - filter(nc)%num_soilp, filter(nc)%soilp) - - call t_stopf('bgc') - - ! ============================================================================ - ! Determine soil/snow temperatures including ground temperature and - ! update surface fluxes for new ground temperature. - ! ============================================================================ - - call t_startf('bgp2') - call Biogeophysics2(begl, endl, begc, endc, begp, endp, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_nolakep, filter(nc)%nolakep) - call t_stopf('bgp2') - - ! ============================================================================ - ! Perform averaging from PFT level to column level - ! ============================================================================ - - call t_startf('pft2col') - call pft2col(begc, endc, filter(nc)%num_nolakec, filter(nc)%nolakec) - call t_stopf('pft2col') - - ! ============================================================================ - ! Vertical (column) soil and surface hydrology - ! ============================================================================ - - call t_startf('hydro2') - call Hydrology2(begc, endc, begp, endp, & - filter(nc)%num_nolakec, filter(nc)%nolakec, & - filter(nc)%num_hydrologyc, filter(nc)%hydrologyc, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_snowc, filter(nc)%snowc, & - filter(nc)%num_nosnowc, filter(nc)%nosnowc) - call t_stopf('hydro2') - - ! ============================================================================ - ! Lake hydrology - ! ============================================================================ - - call t_startf('hylake') - call HydrologyLake(begp, endp, & - filter(nc)%num_lakep, filter(nc)%lakep) - call t_stopf('hylake') - - ! ============================================================================ - ! ! Fraction of soil covered by snow (Z.-L. Yang U. Texas) - ! ============================================================================ - - do c = begc,endc - l = clandunit(c) - if (itypelun(l) == isturb) then - ! Urban landunit use Bonan 1996 (LSM Technical Note) - cps%frac_sno(c) = min( cps%snowdp(c)/0.05_r8, 1._r8) - else - ! snow cover fraction in Niu et al. 2007 - cps%frac_sno(c) = 0.0_r8 - if(cps%snowdp(c) .gt. 0.0_r8) then - cps%frac_sno(c) = tanh(cps%snowdp(c)/(2.5_r8*zlnd* & - (min(800._r8,cws%h2osno(c)/cps%snowdp(c))/100._r8)**1._r8) ) - endif - end if - end do - - ! ============================================================================ - ! Snow aging routine based on Flanner and Zender (2006), Linking snowpack - ! microphysics and albedo evolution, JGR, and Brun (1989), Investigation of - ! wet-snow metamorphism in respect of liquid-water content, Ann. Glaciol. - ! ============================================================================ - call SnowAge_grain(begc, endc, & - filter(nc)%num_snowc, filter(nc)%snowc, & - filter(nc)%num_nosnowc, filter(nc)%nosnowc) - - ! ============================================================================ - ! Ecosystem dynamics: Uses CN, CNDV, or static parameterizations - ! ============================================================================ - call t_startf('ecosysdyn') - - if (use_cn) then - ! fully prognostic canopy structure and C-N biogeochemistry - ! - CNDV defined: prognostic biogeography; else prescribed - ! - crop model: crop algorithms called from within CNEcosystemDyn - call CNEcosystemDyn(begc,endc,begp,endp,filter(nc)%num_soilc,& - filter(nc)%soilc, filter(nc)%num_soilp, & - filter(nc)%soilp, filter(nc)%num_pcropp, & - filter(nc)%pcropp, doalb) - call CNAnnualUpdate(begc,endc,begp,endp,filter(nc)%num_soilc,& - filter(nc)%soilc, filter(nc)%num_soilp, & - filter(nc)%soilp) - else - ! Prescribed biogeography, - ! prescribed canopy structure, some prognostic carbon fluxes - call EcosystemDyn(begp, endp, & - filter(nc)%num_nolakep, filter(nc)%nolakep, & - doalb) - end if - call t_stopf('ecosysdyn') - - ! Dry Deposition of chemical tracers (Wesely (1998) parameterizaion) - call depvel_compute(begp,endp) - - ! ============================================================================ - ! Check the energy and water balance, also carbon and nitrogen balance - ! ============================================================================ - - call t_startf('balchk') - call BalanceCheck(begp, endp, begc, endc, begl, endl, begg, endg) - call t_stopf('balchk') - - if (use_exit_spinup) then - ! skip calls to C and N balance checking during EXIT_SPINUP - ! because the system is (intentionally) not conserving mass - ! on the first EXIT_SPINUP doalb timestep - else - if (use_cn) then - nstep = get_nstep() - if (nstep > 2) then - call t_startf('cnbalchk') - call CBalanceCheck(begc, endc, filter(nc)%num_soilc, filter(nc)%soilc) - call NBalanceCheck(begc, endc, filter(nc)%num_soilc, filter(nc)%soilc) - call t_stopf('cnbalchk') - end if - end if - end if - - ! ============================================================================ - ! Determine albedos for next time step - ! ============================================================================ - - if (doalb) then - call t_startf('surfalb') - - ! Albedos for non-urban columns - - call SurfaceAlbedo(begg, endg, begc, endc, begp, endp, & - filter(nc)%num_nourbanc, filter(nc)%nourbanc, & - filter(nc)%num_nourbanp, filter(nc)%nourbanp, & - nextsw_cday, declinp1) - - call t_stopf('surfalb') - - ! Albedos for urban columns - - call t_startf('urbsurfalb') - - if (filter(nc)%num_urbanl > 0) then - call UrbanAlbedo(nc, begl, endl, begc, endc, begp, endp, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_urbanp, filter(nc)%urbanp) - end if - - call t_stopf('urbsurfalb') - - end if - - end do - !$OMP END PARALLEL DO - - ! ============================================================================ - ! Determine gridcell averaged properties to send to atm (l2as and l2af derived types) - ! ============================================================================ - - call t_startf('clm_map2gcell') - call clm_map2gcell( ) - call t_stopf('clm_map2gcell') - - ! ============================================================================ - ! Determine fields to send to glc - ! ============================================================================ - - if (create_glacier_mec_landunit) then - call t_startf('create_s2x') - call update_clm_s2x(init=.false.) - call t_stopf('create_s2x') - end if - - ! ============================================================================ - ! Write global average diagnostics to standard output - ! ============================================================================ - - nstep = get_nstep() - if (wrtdia) call mpi_barrier(mpicom,ier) - call t_startf('wrtdiag') - call write_diagnostic(wrtdia, nstep) - call t_stopf('wrtdiag') - - ! ============================================================================ - ! Update accumulators - ! ============================================================================ - - call t_startf('accum') - call updateAccFlds() - call t_stopf('accum') - - ! ============================================================================ - ! Update history buffer - ! ============================================================================ - - call t_startf('hbuf') - call hist_update_hbuf() - call t_stopf('hbuf') - - ! ============================================================================ - ! Call dv (dynamic vegetation) at last time step of year - ! NOTE: monp1, dayp1, and secp1 correspond to nstep+1 - ! ============================================================================ - - if (use_cndv) then - call t_startf('d2dgvm') - dtime = get_step_size() - call get_curr_date(yrp1, monp1, dayp1, secp1, offset=int(dtime)) - if (monp1==1 .and. dayp1==1 .and. secp1==dtime .and. nstep>0) then - - ! Get date info. kyr is used in lpj(). At end of first year, kyr = 2. - call get_curr_date(yr, mon, day, sec) - ncdate = yr*10000 + mon*100 + day - call get_ref_date(yr, mon, day, sec) - nbdate = yr*10000 + mon*100 + day - kyr = ncdate/10000 - nbdate/10000 + 1 - - if (masterproc) write(iulog,*) 'End of year. CNDV called now: ncdate=', & - ncdate,' nbdate=',nbdate,' kyr=',kyr,' nstep=', nstep - - nclumps = get_proc_clumps() - - !$OMP PARALLEL DO PRIVATE (nc,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1,nclumps - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - call dv(begg, endg, begp, endp, & - filter(nc)%num_natvegp, filter(nc)%natvegp, kyr) - end do - !$OMP END PARALLEL DO - end if - call t_stopf('d2dgvm') - end if - - ! ============================================================================ - ! Create history and write history tapes if appropriate - ! ============================================================================ - - call t_startf('clm_drv_io') - - call t_startf('clm_drv_io_htapes') - call hist_htapes_wrapup( rstwr, nlend ) - call t_stopf('clm_drv_io_htapes') - - ! ============================================================================ - ! Write to CNDV history buffer if appropriate - ! ============================================================================ - - if (use_cndv) then - if (monp1==1 .and. dayp1==1 .and. secp1==dtime .and. nstep>0) then - call t_startf('clm_drv_io_hdgvm') - call histCNDV() - if (masterproc) write(iulog,*) 'Annual CNDV calculations are complete' - call t_stopf('clm_drv_io_hdgvm') - end if - end if - - ! ============================================================================ - ! Write restart/initial files if appropriate - ! ============================================================================ - - if (rstwr) then - call t_startf('clm_drv_io_wrest') - filer = restFile_filename(rdate=rdate) - call restFile_write( filer, nlend, rdate=rdate ) - call t_stopf('clm_drv_io_wrest') - end if - - call t_stopf('clm_drv_io') - -end subroutine clm_drv - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: write_diagnostic -! -! !INTERFACE: -subroutine write_diagnostic (wrtdia, nstep) -! -! !DESCRIPTION: -! Write diagnostic surface temperature output each timestep. Written to -! be fast but not bit-for-bit because order of summations can change each -! timestep. -! -! !USES: - use clm_atmlnd , only : clm_l2a - use decompMod , only : get_proc_bounds, get_proc_global - use spmdMod , only : masterproc, npes, MPI_REAL8, MPI_ANY_SOURCE, & - MPI_STATUS_SIZE, mpicom, MPI_SUM - use shr_sys_mod, only : shr_sys_flush - use abortutils , only : endrun -! -! !ARGUMENTS: - implicit none - logical, intent(in) :: wrtdia !true => write diagnostic - integer, intent(in) :: nstep !model time step -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -! -! !LOCAL VARIABLES: - integer :: p ! loop index - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: ier ! error status - real(r8):: psum ! partial sum of ts - real(r8):: tsum ! sum of ts - real(r8):: tsxyav ! average ts for diagnostic output - integer :: status(MPI_STATUS_SIZE) ! mpi status - logical,parameter :: old_sendrecv = .false. ! Flag if should use old send/receive method rather than MPI reduce -!------------------------------------------------------------------------ - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - call get_proc_global(numg, numl, numc, nump) - - if (wrtdia) then - - call t_barrierf('sync_write_diag', mpicom) - psum = sum(clm_l2a%t_rad(begg:endg)) - if (old_sendrecv) then - if (masterproc) then - tsum = psum - do p = 1, npes-1 - call mpi_recv(psum, 1, MPI_REAL8, p, 999, mpicom, status, ier) - if (ier/=0) then - write(iulog,*) 'write_diagnostic: Error in mpi_recv()' - call endrun - end if - tsum = tsum + psum - end do - else - call mpi_send(psum, 1, MPI_REAL8, 0, 999, mpicom, ier) - if (ier/=0) then - write(iulog,*) 'write_diagnostic: Error in mpi_send()' - call endrun - end if - end if - else - call mpi_reduce(psum, tsum, 1, MPI_REAL8, MPI_SUM, 0, mpicom, ier) - if (ier/=0) then - write(iulog,*) 'write_diagnostic: Error in mpi_reduce()' - call endrun - end if - endif - if (masterproc) then - tsxyav = tsum / numg - write(iulog,1000) nstep, tsxyav - call shr_sys_flush(iulog) - end if - - else - - if (masterproc) then - write(iulog,*)'clm2: completed timestep ',nstep - call shr_sys_flush(iulog) - end if - - endif - -1000 format (1x,'nstep = ',i10,' TS = ',f21.15) - -end subroutine write_diagnostic - -end module clm_driver diff --git a/src_clm40/main/clm_glclnd.F90 b/src_clm40/main/clm_glclnd.F90 deleted file mode 100644 index 82231a302b..0000000000 --- a/src_clm40/main/clm_glclnd.F90 +++ /dev/null @@ -1,242 +0,0 @@ -module clm_glclnd - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_glclnd -! -! !DESCRIPTION: -! Handle arrays used for exchanging data between glc and land model. -! Based on clm_atmlnd (but without mapping routines because glc data -! is send and received on the lnd decomposition, at least for now). -! -! The fields sent from the lnd component to the glc component via -! the coupler are labeled 's2x', or sno to coupler. -! The fields received by the lnd component from the glc component -! via the coupler are labeled 'x2s', or coupler to sno. -! 'Sno' is a misnomer in that the exchanged data are related to -! the ice beneath the snow, not the snow itself. But by CESM convention, -! 'ice' refers to sea ice, not land ice. -! -! !USES: - use decompMod , only : get_proc_bounds - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use spmdMod , only : masterproc - use clm_varpar , only : maxpatch_glcmec - use clm_varctl , only : iulog - use abortutils , only : endrun -! -! !REVISION HISTORY: -! Created by William Lipscomb, Dec. 2007, based on clm_atmlnd.F90. -! -! !PUBLIC TYPES: - implicit none - private - save - -!---------------------------------------------------- -! glc -> land variables structure -!---------------------------------------------------- - type, public :: glc2lnd_type - real(r8), pointer :: frac(:,:) => null() - real(r8), pointer :: topo(:,:) => null() - real(r8), pointer :: hflx(:,:) => null() - real(r8), pointer :: icemask(:) => null() - end type glc2lnd_type - -!---------------------------------------------------- -! land -> glc variables structure -!---------------------------------------------------- - type, public :: lnd2glc_type - real(r8), pointer :: tsrf(:,:) => null() - real(r8), pointer :: topo(:,:) => null() - real(r8), pointer :: qice(:,:) => null() - end type lnd2glc_type - - type (lnd2glc_type), public, target :: clm_s2x ! s2x fields on clm grid - type (glc2lnd_type), public, target :: clm_x2s ! x2s fields on clm grid - -! !PUBLIC MEMBER FUNCTIONS: - public :: init_glc2lnd_type - public :: init_lnd2glc_type - public :: update_clm_s2x -! -! !PRIVATE MEMBER FUNCTIONS: - -!EOP -!---------------------------------------------------- - -contains - - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_glc2lnd_type -! -! !INTERFACE: - subroutine init_glc2lnd_type(beg, end, x2s) -! -! !DESCRIPTION: -! Initialize glc variables required by the land -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (glc2lnd_type), intent(inout):: x2s -! -! !REVISION HISTORY: -! Created by William Lipscomb, based on init_atm2lnd_type -!EOP -! -! !LOCAL VARIABLES: - real(r8) :: ival ! initial value -!------------------------------------------------------------------------ - - allocate(x2s%frac(beg:end,0:maxpatch_glcmec)) - allocate(x2s%topo(beg:end,0:maxpatch_glcmec)) - allocate(x2s%hflx(beg:end,0:maxpatch_glcmec)) - allocate(x2s%icemask(beg:end)) - -! ival = nan ! causes core dump in map_maparray, tcx fix - ival = 0.0_r8 - - x2s%frac(beg:end,0:) = ival - x2s%topo(beg:end,0:) = ival - x2s%hflx(beg:end,0:) = ival - x2s%icemask(beg:end)= ival - -end subroutine init_glc2lnd_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_lnd2glc_type -! -! !INTERFACE: - subroutine init_lnd2glc_type(beg, end, s2x) -! -! !DESCRIPTION: -! Initialize land variables required by glc -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (lnd2glc_type), intent(inout):: s2x -! -! !REVISION HISTORY: -! Created by William Lipscomb, based on init_lnd2atm_type -! -!EOP -! -! !LOCAL VARIABLES: - real(r8) :: ival ! initial value -!------------------------------------------------------------------------ - - allocate(s2x%tsrf(beg:end,0:maxpatch_glcmec)) - allocate(s2x%topo(beg:end,0:maxpatch_glcmec)) - allocate(s2x%qice(beg:end,0:maxpatch_glcmec)) - -! ival = nan ! causes core dump in map_maparray, tcx fix - ival = 0.0_r8 - - s2x%tsrf(beg:end,0:) = ival - s2x%topo(beg:end,0:) = ival - s2x%qice(beg:end,0:) = ival - -end subroutine init_lnd2glc_type - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: update_clm_s2x -! -! !INTERFACE: - subroutine update_clm_s2x(init) -! -! !DESCRIPTION: -! Assign values to clm_s2x based on the appropriate derived types -! -! !USES: - use clmtype - use domainMod , only : ldomain - use clm_varcon , only : istice_mec - use clm_atmlnd , only : clm_l2a, clm_a2l - use clm_varcon , only : spval, tfrz -! -! !ARGUMENTS: - implicit none - - logical, intent(in) :: init ! if true=>only set a subset of fields -! -! !REVISION HISTORY: -! Written by William Lipscomb, Feb. 2009 -! - - integer :: begg, endg ! per-proc beginning and ending gridcell indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: c, l, g, n ! indices - integer , pointer :: ityplun(:) ! landunit type - integer , pointer :: clandunit(:) ! column's landunit index - integer , pointer :: cgridcell(:) ! column's gridcell index - - ! Assign local pointers to derived type members - - clandunit => col%landunit - cgridcell => col%gridcell - ityplun => lun%itype - - ! Get processor bounds - call get_proc_bounds(begg, endg, begc=begc, endc=endc) - - ! Initialize qice because otherwise it will remain unset if init=true; - ! note that the value here is the value qice will keep if these - ! conditions hold. Also, need to set a reasonable default for elevation class 0, - ! which is used by the CLM4.5 code, but not by CLM4.0. - - clm_s2x%qice(:,0:) = 0._r8 - - ! and initialize the other variables just to be safe; also need to set a reasonable - ! default for elevation class 0 (for tsrf, note that we initialize other elevation - ! classes to 0, to remain consistent with what was done before, but set elevation - ! class 0 to a reasonable default, because it will remain at its default value). - - clm_s2x%tsrf(:,0) = tfrz - clm_s2x%tsrf(:,1:) = 0._r8 - clm_s2x%topo(:,:) = 0._r8 - - ! Fill the clm_s2x vector on the clm grid - - do c = begc, endc - l = clandunit(c) - g = cgridcell(c) - - ! Following assumes all elevation classes are populated - if (ityplun(l) == istice_mec) then - n = c - lun%coli(l) + 1 ! elevation class index - - ! t_soisno and glc_topo are valid even in initialization, so tsrf and topo - ! are set here regardless of the value of init. But qflx_glcice is not valid - ! until the run loop; thus, in initialization, we will use the default value - ! for qice, as set above. - clm_s2x%tsrf(g,n) = ces%t_soisno(c,1) - clm_s2x%topo(g,n) = cps%glc_topo(c) - if (.not. init) then - clm_s2x%qice(g,n) = cwf%qflx_glcice(c) - - ! Check for bad values of qice - if ( abs(clm_s2x%qice(g,n)) > 1.0_r8 .and. clm_s2x%qice(g,n) /= spval) then - write(iulog,*) 'WARNING: qice out of bounds: g, n, qice =', g, n, clm_s2x%qice(g,n) - endif - end if - - endif ! istice_mec - enddo ! c - -end subroutine update_clm_s2x - -!------------------------------------------------------------------------ - -end module clm_glclnd - diff --git a/src_clm40/main/clm_initializeMod.F90 b/src_clm40/main/clm_initializeMod.F90 deleted file mode 100644 index dc6443bcc1..0000000000 --- a/src_clm40/main/clm_initializeMod.F90 +++ /dev/null @@ -1,684 +0,0 @@ -module clm_initializeMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_initializeMod -! -! !DESCRIPTION: -! Performs land model initialization -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use spmdMod , only : masterproc - use shr_sys_mod , only : shr_sys_flush - use abortutils , only : endrun - use clm_varctl , only : nsrest, nsrStartup, nsrContinue, nsrBranch, & - create_glacier_mec_landunit, iulog, & - use_cn, use_cndv - use clm_varsur , only : wtxy, vegxy, topoxy - use perf_mod , only : t_startf, t_stopf - use ncdio_pio , only : file_desc_t - -! !PUBLIC TYPES: - implicit none - save - - private ! By default everything is private - -! !PUBLIC MEMBER FUNCTIONS: - public :: initialize1 ! Phase one initialization - public :: initialize2 ! Phase two initialization -! -! !REVISION HISTORY: -! Created by Gordon Bonan, Sam Levis and Mariana Vertenstein -! -! -! !PRIVATE MEMBER FUNCTIONS: - private header ! echo version numbers - private do_restread ! read a restart file -!----------------------------------------------------------------------- -! !PRIVATE DATA MEMBERS: None - -!EOP -!----------------------------------------------------------------------- -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: initialize1 -! -! !INTERFACE: - subroutine initialize1( ) -! -! !DESCRIPTION: -! Land model initialization. -! o Initializes run control variables via the [clm_inparm] namelist. -! o Reads surface data on model grid. -! o Defines the multiple plant types and fraction areas for each surface type. -! o Builds the appropriate subgrid <-> grid mapping indices and weights. -! o Set up parallel processing. -! o Initializes time constant variables. -! o Reads restart data for a restart or branch run. -! o Reads initial data and initializes the time variant variables for an initial run. -! o Initializes history file output. -! o Initializes river routing model. -! o Initializes accumulation variables. -! -! !USES: - use clmtypeInitMod , only : initClmtype - use clm_varpar , only : maxpatch, clm_varpar_init - use clm_varctl , only : fsurdat, fatmlndfrc, flndtopo, fglcmask, noland - use pftvarcon , only : pftconrd - use decompInitMod , only : decompInit_lnd, decompInit_glcp - use decompMod , only : get_proc_bounds - use domainMod , only : domain_check, ldomain, domain_init - use surfrdMod , only : surfrd_get_globmask, surfrd_get_grid, surfrd_get_topo, & - surfrd_get_data - use controlMod , only : control_init, control_print, nlfilename - use UrbanInputMod , only : UrbanInput - use ncdio_pio , only : ncd_pio_init - use clm_atmlnd , only : init_atm2lnd_type, init_lnd2atm_type, clm_a2l, clm_l2a - use clm_glclnd , only : init_glc2lnd_type, init_lnd2glc_type, clm_x2s, clm_s2x - use initGridCellsMod, only : initGridCells -! -! !ARGUMENTS: -! -! !REVISION HISTORY: -! Created by Gordon Bonan, Sam Levis and Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: ier ! error status - integer :: i,j,n,k ! loop indices - integer :: nl ! gdc and glo lnd indices - integer :: ns, ni, nj ! global grid sizes - logical :: isgrid2d ! true => global grid is regular lat/lon - integer :: begp, endp ! clump beg and ending pft indices - integer :: begc, endc ! clump beg and ending column indices - integer :: begl, endl ! clump beg and ending landunit indices - integer :: begg, endg ! clump beg and ending gridcell indices - integer ,pointer :: amask(:) ! global land mask - character(len=32) :: subname = 'initialize1' ! subroutine name -!----------------------------------------------------------------------- - - call t_startf('clm_init1') - - ! ------------------------------------------------------------------------ - ! Initialize run control variables, timestep - ! ------------------------------------------------------------------------ - - call header() - - if (masterproc) then - write(iulog,*) 'Attempting to initialize the land model .....' - write(iulog,*) - call shr_sys_flush(iulog) - endif - - call control_init() - call clm_varpar_init() - call ncd_pio_init() - - if (masterproc) call control_print() - - ! ------------------------------------------------------------------------ - ! Read in global land grid and land mask (amask)- needed to set decomposition - ! ------------------------------------------------------------------------ - - ! global memory for amask is allocate in surfrd_get_glomask - must be - ! deallocated below - if (masterproc) then - write(iulog,*) 'Attempting to read global land mask from ',trim(fatmlndfrc) - call shr_sys_flush(iulog) - endif - call surfrd_get_globmask(filename=fatmlndfrc, mask=amask, ni=ni, nj=nj) - - ! Exit early if no valid land points - if ( all(amask == 0) )then - if (masterproc) write(iulog,*) trim(subname)//': no valid land points do NOT run clm' - noland = .true. - return - end if - - ! Determine clm decomposition - - call decompInit_lnd(ni, nj, amask) - deallocate(amask) - - ! Get grid and land fraction (set ldomain) - - if (masterproc) then - write(iulog,*) 'Attempting to read ldomain from ',trim(fatmlndfrc) - call shr_sys_flush(iulog) - endif - if (create_glacier_mec_landunit) then - call surfrd_get_grid(ldomain, fatmlndfrc, fglcmask) - else - call surfrd_get_grid(ldomain, fatmlndfrc) - endif - if (masterproc) then - call domain_check(ldomain) - endif - ldomain%mask = 1 !!! TODO - is this needed? - - ! Get topo if appropriate (set ldomain%topo) - - if (flndtopo /= " ") then - if (masterproc) then - write(iulog,*) 'Attempting to read atm topo from ',trim(flndtopo) - call shr_sys_flush(iulog) - endif - call surfrd_get_topo(ldomain, flndtopo) - endif - - ! Initialize urban model input (initialize urbinp data structure) - - call UrbanInput(mode='initialize') - - ! Allocate surface grid dynamic memory (for wtxy and vegxy arrays) - ! Allocate additional dynamic memory for glacier_mec topo and thickness - - call get_proc_bounds(begg, endg) - allocate (vegxy(begg:endg,maxpatch), wtxy(begg:endg,maxpatch), stat=ier) - if (create_glacier_mec_landunit) then - allocate (topoxy(begg:endg,maxpatch), stat=ier) - else - allocate (topoxy(1,1), stat=ier) - endif - if (ier /= 0) then - write(iulog,*)'initialize allocation error'; call endrun() - endif - - ! Read list of PFTs and their corresponding parameter values - ! Independent of model resolution, Needs to stay before surfrd_get_data - - call pftconrd() - - ! Read surface dataset and set up vegetation type [vegxy] and - ! weight [wtxy] arrays for [maxpatch] subgrid patches. - - call surfrd_get_data(ldomain, fsurdat) - - ! Determine decomposition of subgrid scale landunits, columns, pfts - - if (create_glacier_mec_landunit) then - call decompInit_glcp (ns, ni, nj, ldomain%glcmask) - else - call decompInit_glcp (ns, ni, nj) - endif - - ! Allocate memory and initialize values of clmtype data structures - - call initClmtype() - - ! Initialize atm->lnd, lnd->atm, glc->lnd and lnd->glc data structures - - call init_atm2lnd_type(begg, endg, clm_a2l) - call init_lnd2atm_type(begg, endg, clm_l2a) - if (create_glacier_mec_landunit) then - call init_glc2lnd_type(begg, endg, clm_x2s) - call init_lnd2glc_type(begg, endg, clm_s2x) - endif - - ! Build hierarchy and topological info for derived types - - call initGridCells() - - ! Deallocate surface grid dynamic memory (for wtxy and vegxy arrays) - - deallocate (vegxy, wtxy, topoxy) - - call t_stopf('clm_init1') - - end subroutine initialize1 - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: initialize2 -! -! !INTERFACE: - subroutine initialize2( ) -! -! !DESCRIPTION: -! Land model initialization. -! o Initializes run control variables via the [clm_inparm] namelist. -! o Reads surface data on model grid. -! o Defines the multiple plant types and fraction areas for each surface type. -! o Builds the appropriate subgrid <-> grid mapping indices and weights. -! o Set up parallel processing. -! o Initializes time constant variables. -! o Reads restart data for a restart or branch run. -! o Reads initial data and initializes the time variant variables for an initial run. -! o Initializes history file output. -! o Initializes river routing model. -! o Initializes accumulation variables. -! -! !USES: - use clm_atmlnd , only : clm_map2gcell_minimal - use clm_glclnd , only : update_clm_s2x - use clm_varctl , only : finidat, flanduse_timeseries - use decompMod , only : get_proc_clumps, get_proc_bounds - use filterMod , only : allocFilters, setFilters - use histFldsMod , only : hist_initFlds - use histFileMod , only : hist_htapes_build, htapes_fieldlist - use restFileMod , only : restFile_getfile, & - restFile_open, restFile_close, restFile_read - use accFldsMod , only : initAccFlds, initAccClmtype - use mkarbinitMod , only : mkarbinit - use pftdynMod , only : pftdyn_init, pftdyn_interp - use ndepStreamMod , only : ndep_init, ndep_interp - use CNEcosystemDynMod, only : CNEcosystemDynInit - use pftdynMod , only : pftwt_init - use CNDVEcosystemDyniniMod, only : CNDVEcosystemDynini - use STATICEcosysDynMod , only : EcosystemDynini, readAnnualVegetation - use STATICEcosysDynMod , only : interpMonthlyVeg - use DustMod , only : Dustini - use clm_time_manager, only : get_curr_date, get_nstep, advance_timestep, & - timemgr_init, timemgr_restart_io, timemgr_restart - use clm_time_manager, only : get_step_size, get_curr_calday - use fileutils , only : getfil - use UrbanMod , only : UrbanClumpInit - use UrbanInitMod , only : UrbanInitTimeConst, UrbanInitTimeVar, UrbanInitAero - use UrbanInputMod , only : UrbanInput - use seq_drydep_mod , only : n_drydep, drydep_method, DD_XLND - use shr_orb_mod , only : shr_orb_decl - use initSurfAlbMod , only : initSurfAlb, do_initsurfalb - use clm_varorb , only : eccen, mvelpp, lambm0, obliqr - use VOCEmissionMod , only : VOCEmission_init - - -! !Arguments - implicit none -! -! !REVISION HISTORY: -! Created by Gordon Bonan, Sam Levis and Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: nl,na,nag ! indices - integer :: i,j,k ! indices - integer :: yr ! current year (0, ...) - integer :: mon ! current month (1 -> 12) - integer :: day ! current day (1 -> 31) - integer :: ncsec ! current time of day [seconds] - integer :: nc ! clump index - integer :: nclumps ! number of clumps on this processor - integer :: begp, endp ! clump beg and ending pft indices - integer :: begc, endc ! clump beg and ending column indices - integer :: begl, endl ! clump beg and ending landunit indices - integer :: begg, endg ! clump beg and ending gridcell indices - character(len=256) :: fnamer ! name of netcdf restart file - character(len=256) :: pnamer ! full pathname of netcdf restart file - type(file_desc_t) :: ncid ! netcdf id - real(r8) :: dtime ! time step increment (sec) - integer :: nstep ! model time step - real(r8) :: calday ! calendar day for nstep - real(r8) :: caldaym1 ! calendar day for nstep-1 - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinm1 ! solar declination angle in radians for nstep-1 - real(r8) :: eccf ! earth orbit eccentricity factor - character(len=32) :: subname = 'initialize2' ! subroutine name -!---------------------------------------------------------------------- - - call t_startf('clm_init2') - - ! ------------------------------------------------------------------------ - ! Initialize time constant variables - ! ------------------------------------------------------------------------ - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp ) - - ! Initialize Ecosystem Dynamics - - call t_startf('init_ecosys') - if (use_cndv) then - call CNDVEcosystemDynini() - else if (.not. use_cn) then - call EcosystemDynini() - end if - - if (use_cn .or. use_cndv) then - ! -------------------------------------------------------------- - ! Initialize CLMSP ecosystem dynamics when drydeposition is used - ! so that estimates of monthly differences in LAI can be computed - ! -------------------------------------------------------------- - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - call EcosystemDynini() - end if - end if - call t_stopf('init_ecosys') - - ! Initialize dust emissions model - - call t_startf('init_dust') - call Dustini() - call t_stopf('init_dust') - - ! Initialize MEGAN emissions model - - call VOCEmission_init( ) - - ! ------------------------------------------------------------------------ - ! Initialize time constant urban variables - ! ------------------------------------------------------------------------ - - call t_startf('init_io1') - call UrbanInitTimeConst() - call iniTimeConst() - - ! ------------------------------------------------------------------------ - ! Obtain restart file if appropriate - ! ------------------------------------------------------------------------ - - if (do_restread()) then - call restFile_getfile( file=fnamer, path=pnamer ) - end if - - ! ------------------------------------------------------------------------ - ! Initialize master history list. - ! ------------------------------------------------------------------------ - call t_startf('hist_initFlds') - - call hist_initFlds() - ! On restart process the history namelist. Later the namelist from the restart file - ! will be used. But, this allows some basic checking to make sure you didn't - ! try to change the history namelist on restart. - if (nsrest == nsrContinue ) call htapes_fieldlist() - - call t_stopf('hist_initFlds') - ! ------------------------------------------------------------------------ - ! Initialize time manager - ! ------------------------------------------------------------------------ - - if (nsrest == nsrStartup) then - call timemgr_init() - else - call restFile_open( flag='read', file=fnamer, ncid=ncid ) - call timemgr_restart_io( ncid=ncid, flag='read' ) - call restFile_close( ncid=ncid ) - call timemgr_restart() - end if - call t_stopf('init_io1') - - ! ------------------------------------------------------------------------ - ! Initialize CN Ecosystem Dynamics (must be after time-manager initialization) - ! ------------------------------------------------------------------------ - if (use_cn .or. use_cndv) then - call CNEcosystemDynInit( begc, endc, begp, endp ) - end if - - ! ------------------------------------------------------------------------ - ! Initialize accumulated fields - ! ------------------------------------------------------------------------ - - ! Initialize accumulator fields to be time accumulated for various purposes. - ! The time manager needs to be initialized before this called is made, since - ! the step size is needed. - - call t_startf('init_accflds') - call initAccFlds() - call t_stopf('init_accflds') - - ! ------------------------------------------------------------------------ - ! Set arbitrary initial conditions for time varying fields - ! used in coupled carbon-nitrogen code - ! ------------------------------------------------------------------------ - - if (use_cn) then - call t_startf('init_cninitim') - if (nsrest == nsrStartup) then - call CNiniTimeVar() - end if - call t_stopf('init_cninitim') - end if - - ! ------------------------------------------------------------------------ - ! Initialization of dynamic pft weights - ! ------------------------------------------------------------------------ - - ! Determine correct pft weights (interpolate pftdyn dataset if initial run) - ! Otherwise these are read in for a restart run - - if (use_cndv) then - call pftwt_init() - else - if (flanduse_timeseries /= ' ') then - call t_startf('init_pftdyn') - call pftdyn_init() - call pftdyn_interp( ) - call t_stopf('init_pftdyn') - end if - end if - - ! ------------------------------------------------------------------------ - ! Read restart/initial info - ! ------------------------------------------------------------------------ - - ! No weight related information can be contained in the routines, - ! "mkarbinit, inicfile and restFile". - - call t_startf('init_io2') - if (do_restread()) then - call UrbanInitTimeVar( ) - if (masterproc) write(iulog,*)'reading restart file ',fnamer - call restFile_read( fnamer ) - else if (nsrest == nsrStartup .and. finidat == ' ') then - call mkarbinit() - call UrbanInitTimeVar( ) - end if - call t_stopf('init_io2') - - ! ------------------------------------------------------------------------ - ! Initialize nitrogen deposition - ! ------------------------------------------------------------------------ - - if (use_cn) then - call t_startf('init_ndep') - call ndep_init() - call ndep_interp() - call t_stopf('init_ndep') - end if - - ! ------------------------------------------------------------------------ - ! Initialization of model parameterizations that are needed after - ! restart file is read in - ! ------------------------------------------------------------------------ - - ! ------------------------------------------------------------------------ - ! Initialize history and accumator buffers - ! ------------------------------------------------------------------------ - - call t_startf('init_hist1') - - ! Initialize active history fields. This is only done if not a restart run. - ! If a restart run, then this information has already been obtained from the - ! restart data read above. Note that routine hist_htapes_build needs time manager - ! information, so this call must be made after the restart information has been read. - - if (nsrest == nsrStartup .or. nsrest == nsrBranch) call hist_htapes_build() - - ! Initialize clmtype variables that are obtained from accumulated fields. - ! This routine is called in an initial run at nstep=0 - ! This routine is also always called for a restart run and must - ! therefore be called after the restart file is read in - - call initAccClmtype() - - call t_stopf('init_hist1') - - ! -------------------------------------------------------------- - ! Note - everything below this point needs updated weights - ! -------------------------------------------------------------- - - ! Initialize filters - - call t_startf('init_filters') - - call allocFilters() - nclumps = get_proc_clumps() -!$OMP PARALLEL DO PRIVATE (nc) - do nc = 1, nclumps - call setFilters(nc) - end do -!$OMP END PARALLEL DO - - call t_stopf('init_filters') - - ! Calculate urban "town" roughness length and displacement - ! height for urban landunits - - call UrbanInitAero() - - ! Initialize urban radiation model - this uses urbinp data structure - - call UrbanClumpInit() - - ! Finalize urban model initialization - - call UrbanInput(mode='finalize') - - ! - ! Even if CN 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 )then - call readAnnualVegetation() - end if - - ! End initialization - - call t_startf('init_wlog') - if (masterproc) then - write(iulog,*) 'Successfully initialized the land model' - if (nsrest == nsrStartup) then - write(iulog,*) 'begin initial run at: ' - else - write(iulog,*) 'begin continuation run at:' - end if - call get_curr_date(yr, mon, day, ncsec) - write(iulog,*) ' nstep= ',get_nstep(), ' year= ',yr,' month= ',mon,& - ' day= ',day,' seconds= ',ncsec - write(iulog,*) - write(iulog,'(72a1)') ("*",i=1,60) - write(iulog,*) - endif - call t_stopf('init_wlog') - - if (get_nstep() == 0 .or. nsrest == nsrStartup) then - ! Initialize albedos (correct pft filters are needed) - - if (finidat == ' ' .or. do_initsurfalb) then - call t_startf('init_orb') - calday = get_curr_calday() - call t_startf('init_orbd1') - call shr_orb_decl( calday, eccen, mvelpp, lambm0, obliqr, declin, eccf ) - call t_stopf('init_orbd1') - - dtime = get_step_size() - caldaym1 = get_curr_calday(offset=-int(dtime)) - call t_startf('init_orbd2') - call shr_orb_decl( caldaym1, eccen, mvelpp, lambm0, obliqr, declinm1, eccf ) - call t_stopf('init_orbd2') - - call t_startf('init_orbSA') - call initSurfAlb( calday, declin, declinm1 ) - call t_stopf('init_orbSA') - call t_stopf('init_orb') - else if ( n_drydep > 0 .and. drydep_method == DD_XLND )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() - end if - - ! Determine gridcell averaged properties to send to atm - - call t_startf('init_map2gc') - call clm_map2gcell_minimal() - call t_stopf('init_map2gc') - - end if - - ! Initialize sno export state - if (create_glacier_mec_landunit) then - call t_startf('init_create_s2x') - call update_clm_s2x(init=.true.) - call t_stopf('init_create_s2x') - end if - - call t_stopf('clm_init2') - - end subroutine initialize2 - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: header -! -! !INTERFACE: - subroutine header() -! -! !DESCRIPTION: -! Echo and save model version number -! -! !USES: - use clm_varctl , only : version -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine initialize in this module -! -! !REVISION HISTORY: -! Created by Gordon Bonan -! -!EOP -!----------------------------------------------------------------------- - - if ( masterproc )then - write(iulog,*) trim(version) - write(iulog,*) - end if - - end subroutine header - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: do_restread -! -! !INTERFACE: - logical function do_restread( ) -! -! !DESCRIPTION: -! Determine if restart file will be read -! -! !USES: - use clm_varctl, only : finidat -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine initialize in this module -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - - do_restread = .false. - if (nsrest == nsrStartup .and. finidat /= ' ') then - do_restread = .true. - end if - if (nsrest == nsrContinue .or. nsrest == nsrBranch) then - do_restread = .true. - end if - end function do_restread - -end module clm_initializeMod diff --git a/src_clm40/main/clm_nlUtilsMod.F90 b/src_clm40/main/clm_nlUtilsMod.F90 deleted file mode 100644 index 68536bd1fb..0000000000 --- a/src_clm40/main/clm_nlUtilsMod.F90 +++ /dev/null @@ -1,116 +0,0 @@ -module clm_nlUtilsMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_nltUtilsMod -! -! !DESCRIPTION: -! Utilities to handle namelists. -! -! !USES: - -! !PUBLIC TYPES: - implicit none - save - - private ! By default everything is private - -! !PUBLIC MEMBER FUNCTIONS: - public :: find_nlgroup_name ! find a specified namelist group in a file -! -! !REVISION HISTORY: -! Created by B. Eaton -! Move to CLM by E. Kluzek -! -! !PRIVATE MEMBER FUNCTIONS: None -!----------------------------------------------------------------------- -! !PRIVATE DATA MEMBERS: None - -!EOP -!----------------------------------------------------------------------- -contains - -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: find_nlgroup_name -! -! !INTERFACE: - subroutine find_nlgroup_name(unit, group, status) -! -! !DESCRIPTION: -! Search a file that contains namelist input for the specified namelist group name. -! Leave the file positioned so that the current record is the first record of the -! input for the specified group. -! -! METHOD: -! Read the file line by line. Each line is searched for an '&' which may only -! be preceded by blanks, immediately followed by the group name which is case -! insensitive. If found then backspace the file so the current record is the -! one containing the group name and return success. Otherwise return -1. -! -! !USES: - use shr_kind_mod , only : CS => shr_kind_cs - use shr_string_mod, only : shr_string_toLower -! -! !ARGUMENTS: - integer, intent(in) :: unit ! fortran unit attached to file - character(len=*), intent(in) :: group ! namelist group name - integer, intent(out) :: status ! 0 for success, -1 if group name not found -! -! !REVISION HISTORY: -! Created by B. Eaton, August 2007 -! Move to CLM E. Kluzek, August 2012 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: len_grp ! length of the groupname - integer :: ios ! io status - character(len=CS) :: inrec ! first shr_kind_CS characters of input record - character(len=CS) :: inrec2 ! left adjusted input record - character(len=len(group)) :: lc_group ! lower-case group name - character(len=32) :: subname = 'find_nlgroup_name' ! subroutine name -!----------------------------------------------------------------------- - len_grp = len_trim(group) - lc_group = shr_string_toLower(group) - - ios = 0 - do while (ios <= 0) - - read(unit, '(a)', iostat=ios, end=100) inrec - - if (ios <= 0) then ! ios < 0 indicates an end of record condition - - ! look for group name in this record - - ! remove leading blanks - inrec2 = adjustl(inrec) - - ! check for leading '&' - if (inrec2(1:1) == '&') then - - ! check for case insensitive group name - if (trim(lc_group) == shr_string_toLower(inrec2(2:len_grp+1))) then - - ! found group name. backspace to leave file position at this record - backspace(unit) - status = 0 - return - - end if - end if - end if - - end do - - 100 continue ! end of file processing - status = -1 - -end subroutine find_nlgroup_name - -!----------------------------------------------------------------------- - -end module clm_nlUtilsMod diff --git a/src_clm40/main/clm_time_manager.F90 b/src_clm40/main/clm_time_manager.F90 deleted file mode 100644 index 3057294bc3..0000000000 --- a/src_clm40/main/clm_time_manager.F90 +++ /dev/null @@ -1,1625 +0,0 @@ -module clm_time_manager - - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_sys_mod , only: shr_sys_abort - use spmdMod , only: masterproc - use clm_varctl , only: iulog - use clm_varcon , only: isecspday - use ESMF - - implicit none - private - - ! Public methods - - public ::& - get_timemgr_defaults, &! get startup default values - set_timemgr_init, &! setup startup values - timemgr_init, &! time manager initialization - timemgr_restart_io, &! read/write time manager restart info and restart time manager - timemgr_restart, &! restart the time manager using info from timemgr_restart - timemgr_datediff, &! calculate difference between two time instants - advance_timestep, &! increment timestep number - get_clock, &! get the clock from the time-manager - get_curr_ESMF_Time, &! get current time in terms of the ESMF_Time - get_step_size, &! return step size in seconds - get_rad_step_size, &! return radiation step size in seconds - get_nstep, &! return timestep number - get_curr_date, &! return date components at end of current timestep - get_prev_date, &! return date components at beginning of current timestep - get_start_date, &! return components of the start date - get_driver_start_ymd, &! return year/month/day (as integer in YYYYMMDD format) of driver start date - get_ref_date, &! return components of the reference date - get_perp_date, &! return components of the perpetual date, and current time of day - get_curr_time, &! return components of elapsed time since reference date at end of current timestep - get_prev_time, &! return components of elapsed time since reference date at beg of current timestep - get_curr_calday, &! return calendar day at end of current timestep - get_calday, &! return calendar day from input date - get_calendar, &! return calendar - get_days_per_year, &! return the days per year for current year - get_curr_yearfrac, &! return the fractional position in the current year - get_rest_date, &! return the date from the restart file - set_nextsw_cday, &! set the next radiation calendar day - is_first_step, &! return true on first step of initial run - is_first_restart_step, &! return true on first step of restart or branch run - is_beg_curr_day, &! return true on first timestep in current day - is_end_curr_day, &! return true on last timestep in current day - is_end_curr_month, &! return true on last timestep in current month - is_last_step, &! return true on last timestep - is_perpetual, &! return true if perpetual calendar is in use - is_restart, &! return true if this is a restart run - update_rad_dtime ! track radiation interval via nstep - - ! Public parameter data - character(len=*), public, parameter :: NO_LEAP_C = 'NO_LEAP' - character(len=*), public, parameter :: GREGORIAN_C = 'GREGORIAN' - - ! Private module data - - ! Private data for input - - character(len=ESMF_MAXSTR), save ::& - calendar = NO_LEAP_C ! Calendar to use in date calculations. - integer, parameter :: uninit_int = -999999999 - real(r8), parameter :: uninit_r8 = -999999999.0 - - ! Input - integer, save ::& - dtime = uninit_int, &! timestep in seconds - dtime_rad = uninit_int, &! radiation interval in seconds - nstep_rad_prev = uninit_int ! radiation interval in seconds - - ! Input from CESM driver - integer, save ::& - nelapse = uninit_int, &! number of timesteps (or days if negative) to extend a run - start_ymd = uninit_int, &! starting date for run in yearmmdd format - start_tod = 0, &! starting time of day for run in seconds - stop_ymd = uninit_int, &! stopping date for run in yearmmdd format - stop_tod = 0, &! stopping time of day for run in seconds - ref_ymd = uninit_int, &! reference date for time coordinate in yearmmdd format - ref_tod = 0 ! reference time of day for time coordinate in seconds - type(ESMF_Calendar), target, save :: tm_cal ! calendar - type(ESMF_Clock), save :: tm_clock ! model clock - type(ESMF_Time), save :: tm_perp_date ! perpetual date - - ! Data required to restart time manager: - integer, save :: rst_step_sec = uninit_int ! timestep size seconds - integer, save :: rst_start_ymd = uninit_int ! start date - integer, save :: rst_start_tod = uninit_int ! start time of day - integer, save :: rst_ref_ymd = uninit_int ! reference date - integer, save :: rst_ref_tod = uninit_int ! reference time of day - integer, save :: rst_curr_ymd = uninit_int ! current date - integer, save :: rst_curr_tod = uninit_int ! current time of day - - integer, save :: rst_nstep_rad_prev ! nstep of previous radiation call - integer, save :: perpetual_ymd = uninit_int ! Perpetual calendar date (YYYYMMDD) - logical, save :: tm_first_restart_step = .false. ! true for first step of a restart or branch run - logical, save :: tm_perp_calendar = .false. ! true when using perpetual calendar - logical, save :: timemgr_set = .false. ! true when timemgr initialized - integer, save :: nestep = uninit_int ! ending time-step - ! - ! Next short-wave radiation calendar day - ! - real(r8) :: nextsw_cday = uninit_r8 ! calday from clock of next radiation computation - - ! Private module methods - - private :: timemgr_spmdbcast - private :: init_calendar - private :: init_clock - private :: calc_nestep - private :: timemgr_print - private :: TimeGetymd - - !========================================================================================= -contains - !========================================================================================= - - subroutine get_timemgr_defaults( calendar_out, start_ymd_out, start_tod_out, ref_ymd_out, & - ref_tod_out, stop_ymd_out, stop_tod_out, nelapse_out, & - dtime_out ) - - !--------------------------------------------------------------------------------- - ! get time manager startup default values - ! - ! Arguments - character(len=*), optional, intent(OUT) :: calendar_out ! Calendar type - integer , optional, intent(OUT) :: nelapse_out ! Number of step (or days) to advance - integer , optional, intent(OUT) :: start_ymd_out ! Start date (YYYYMMDD) - integer , optional, intent(OUT) :: start_tod_out ! Start time of day (sec) - integer , optional, intent(OUT) :: ref_ymd_out ! Reference date (YYYYMMDD) - integer , optional, intent(OUT) :: ref_tod_out ! Reference time of day (sec) - integer , optional, intent(OUT) :: stop_ymd_out ! Stop date (YYYYMMDD) - integer , optional, intent(OUT) :: stop_tod_out ! Stop time of day (sec) - integer , optional, intent(OUT) :: dtime_out ! Time-step (sec) - ! - character(len=*), parameter :: sub = 'clm::get_timemgr_defaults' - - if ( timemgr_set ) call shr_sys_abort( sub//":: timemgr_init or timemgr_restart already called" ) - if (present(calendar_out) ) calendar_out = trim(calendar) - if (present(start_ymd_out) ) start_ymd_out = start_ymd - if (present(start_tod_out) ) start_tod_out = start_tod - if (present(ref_ymd_out) ) ref_ymd_out = ref_ymd - if (present(ref_tod_out) ) ref_tod_out = ref_tod - if (present(stop_ymd_out) ) stop_ymd_out = stop_ymd - if (present(stop_tod_out) ) stop_tod_out = stop_tod - if (present(nelapse_out) ) nelapse_out = nelapse - if (present(dtime_out) ) dtime_out = dtime - - end subroutine get_timemgr_defaults - - !========================================================================================= - - subroutine set_timemgr_init( calendar_in, start_ymd_in, start_tod_in, ref_ymd_in, & - ref_tod_in, stop_ymd_in, stop_tod_in, perpetual_run_in, & - perpetual_ymd_in, nelapse_in, dtime_in ) - - !--------------------------------------------------------------------------------- - ! set time manager startup values - ! - ! Arguments - character(len=*), optional, intent(IN) :: calendar_in ! Calendar type - integer , optional, intent(IN) :: nelapse_in ! Number of step (or days) to advance - integer , optional, intent(IN) :: start_ymd_in ! Start date (YYYYMMDD) - integer , optional, intent(IN) :: start_tod_in ! Start time of day (sec) - integer , optional, intent(IN) :: ref_ymd_in ! Reference date (YYYYMMDD) - integer , optional, intent(IN) :: ref_tod_in ! Reference time of day (sec) - integer , optional, intent(IN) :: stop_ymd_in ! Stop date (YYYYMMDD) - integer , optional, intent(IN) :: stop_tod_in ! Stop time of day (sec) - logical , optional, intent(IN) :: perpetual_run_in ! If in perpetual mode or not - integer , optional, intent(IN) :: perpetual_ymd_in ! Perpetual date (YYYYMMDD) - integer , optional, intent(IN) :: dtime_in ! Time-step (sec) - ! - character(len=*), parameter :: sub = 'clm::set_timemgr_init' - - if ( timemgr_set ) call shr_sys_abort( sub//":: timemgr_init or timemgr_restart already called" ) - if (present(calendar_in) ) calendar = trim(calendar_in) - if (present(start_ymd_in) ) start_ymd = start_ymd_in - if (present(start_tod_in) ) start_tod = start_tod_in - if (present(ref_ymd_in) ) ref_ymd = ref_ymd_in - if (present(ref_tod_in) ) ref_tod = ref_tod_in - if (present(stop_ymd_in) ) stop_ymd = stop_ymd_in - if (present(stop_tod_in) ) stop_tod = stop_tod_in - if (present(perpetual_run_in) )then - tm_perp_calendar = perpetual_run_in - if ( tm_perp_calendar ) then - if ( .not. present(perpetual_ymd_in) .or. perpetual_ymd == uninit_int) & - call shr_sys_abort( sub//":: perpetual_run set but NOT perpetual_ymd" ) - perpetual_ymd = perpetual_ymd_in - end if - end if - if (present(nelapse_in) ) nelapse = nelapse_in - if (present(dtime_in) ) dtime = dtime_in - - end subroutine set_timemgr_init - - !========================================================================================= - - subroutine timemgr_init( ) - - !--------------------------------------------------------------------------------- - ! Initialize the ESMF time manager from the sync clock - ! - ! Arguments - ! - character(len=*), parameter :: sub = 'clm::timemgr_init' - integer :: rc ! return code - integer :: yr, mon, day, tod ! Year, month, day, and second as integers - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: curr_date ! temporary date used in logic - type(ESMF_Time) :: ref_date ! reference date for time coordinate - logical :: run_length_specified = .false. - type(ESMF_Time) :: current ! current date (from clock) - type(ESMF_TimeInterval) :: day_step_size ! day step size - type(ESMF_TimeInterval) :: step_size ! timestep size - !--------------------------------------------------------------------------------- - call timemgr_spmdbcast( ) - - ! Initalize calendar - - call init_calendar() - - ! Initalize start date. - - if ( start_ymd == uninit_int ) then - write(iulog,*)sub,': start_ymd must be specified ' - call shr_sys_abort - end if - if ( start_tod == uninit_int ) then - write(iulog,*)sub,': start_tod must be specified ' - call shr_sys_abort - end if - start_date = TimeSetymd( start_ymd, start_tod, "start_date" ) - - ! Initialize current date - - curr_date = start_date - - ! Initalize stop date. - - stop_date = TimeSetymd( 99991231, stop_tod, "stop_date" ) - - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') - - call ESMF_TimeIntervalSet( day_step_size, d=1, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting day_step_size') - - if ( stop_ymd /= uninit_int ) then - current = TimeSetymd( stop_ymd, stop_tod, "stop_date" ) - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( nelapse /= uninit_int ) then - if ( nelapse >= 0 ) then - current = curr_date + step_size*nelapse - else - current = curr_date - day_step_size*nelapse - end if - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( .not. run_length_specified ) then - call shr_sys_abort (sub//': Must specify stop_ymd or nelapse') - end if - - ! Error check - - if ( stop_date <= start_date ) then - write(iulog,*)sub, ': stop date must be specified later than start date: ' - call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - if ( curr_date >= stop_date ) then - write(iulog,*)sub, ': stop date must be specified later than current date: ' - call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - - ! Initalize reference date for time coordinate. - - if ( ref_ymd /= uninit_int ) then - ref_date = TimeSetymd( ref_ymd, ref_tod, "ref_date" ) - else - ref_date = start_date - end if - - ! Initialize clock - - call init_clock( start_date, ref_date, curr_date, stop_date ) - - ! Initialize date used for perpetual calendar day calculation. - - if (tm_perp_calendar) then - tm_perp_date = TimeSetymd( perpetual_ymd, 0, "tm_perp_date" ) - end if - - ! Print configuration summary to log file (stdout). - - if (masterproc) call timemgr_print() - - timemgr_set = .true. - - end subroutine timemgr_init - - !========================================================================================= - - subroutine init_clock( start_date, ref_date, curr_date, stop_date ) - - !--------------------------------------------------------------------------------- - ! Purpose: Initialize the clock based on the start_date, ref_date, and curr_date - ! as well as the settings from the namelist specifying the time to stop - ! - type(ESMF_Time), intent(in) :: start_date ! start date for run - type(ESMF_Time), intent(in) :: ref_date ! reference date for time coordinate - type(ESMF_Time), intent(in) :: curr_date ! current date (equal to start_date) - type(ESMF_Time), intent(in) :: stop_date ! stop date for run - ! - character(len=*), parameter :: sub = 'clm::init_clock' - type(ESMF_TimeInterval) :: step_size ! timestep size - type(ESMF_Time) :: current ! current date (from clock) - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') - - ! Initialize the clock - - tm_clock = ESMF_ClockCreate(name="CLM Time-manager clock", timeStep=step_size, startTime=start_date, & - stopTime=stop_date, refTime=ref_date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockSetup') - - ! Advance clock to the current time (in case of a restart) - - call ESMF_ClockGet(tm_clock, currTime=current, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - do while( curr_date > current ) - call ESMF_ClockAdvance( tm_clock, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockAdvance') - call ESMF_ClockGet(tm_clock, currTime=current ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - end do - end subroutine init_clock - - !========================================================================================= - - function TimeSetymd( ymd, tod, desc ) - !--------------------------------------------------------------------------------- - ! - ! Set the time by an integer as YYYYMMDD and integer seconds in the day - ! - integer, intent(in) :: ymd ! Year, month, day YYYYMMDD - integer, intent(in) :: tod ! Time of day in seconds - character(len=*), intent(in) :: desc ! Description of time to set - - type(ESMF_Time) :: TimeSetymd ! Return value - - character(len=*), parameter :: sub = 'clm::TimeSetymd' - integer :: yr, mon, day ! Year, month, day as integers - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - if ( (ymd < 0) .or. (tod < 0) .or. (tod > isecspday) )then - write(iulog,*) sub//': error yymmdd is a negative number or time-of-day out of bounds', & - ymd, tod - call shr_sys_abort - end if - yr = ymd / 10000 - mon = (ymd - yr*10000) / 100 - day = ymd - yr*10000 - mon*100 - call ESMF_TimeSet( TimeSetymd, yy=yr, mm=mon, dd=day, s=tod, & - calendar=tm_cal, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeSet: setting '//trim(desc)) - end function TimeSetymd - - !========================================================================================= - - integer function TimeGetymd( date, tod ) - ! - ! Get the date and time of day in ymd from ESMF Time. - ! - type(ESMF_Time), intent(inout) :: date ! Input date to convert to ymd - integer, intent(out), optional :: tod ! Time of day in seconds - - character(len=*), parameter :: sub = 'clm::TimeGetymd' - integer :: yr, mon, day - integer :: rc ! return code - - call ESMF_TimeGet( date, yy=yr, mm=mon, dd=day, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - TimeGetymd = yr*10000 + mon*100 + day - if ( present( tod ) )then - call ESMF_TimeGet( date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - end if - if ( yr < 0 )then - write(iulog,*) sub//': error year is less than zero', yr - call shr_sys_abort - end if - end function TimeGetymd - - !========================================================================================= - - subroutine timemgr_restart_io( ncid, flag ) - - !--------------------------------------------------------------------------------- - ! Read/Write information needed on restart to a netcdf file. - use ncdio_pio, only: ncd_int - use pio, only: var_desc_t, file_desc_t - use restUtilMod - ! - ! Arguments - type(file_desc_t), intent(inout) :: ncid ! netcdf id - character(len=*), intent(in) :: flag ! 'read' or 'write' - ! - ! Local variables - character(len=*), parameter :: sub = 'clm::timemgr_restart' - integer :: rc ! return code - logical :: readvar ! determine if variable is on initial file - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: ref_date ! reference date for run - type(ESMF_Time) :: curr_date ! date of data in restart file - integer :: rst_caltype ! calendar type - integer, parameter :: noleap = 1 - integer, parameter :: gregorian = 2 - character(len=len(calendar)) :: cal - !--------------------------------------------------------------------------------- - - if (flag == 'write') then - rst_nstep_rad_prev = nstep_rad_prev - end if - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_nstep_rad_prev', xtype=ncd_int, & - long_name='previous_radiation_nstep', units='unitless positive integer', & - ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_nstep_rad_prev) - if (flag == 'read') then - nstep_rad_prev = rst_nstep_rad_prev - end if - - if (flag == 'write') then - cal = to_upper(calendar) - if ( trim(cal) == NO_LEAP_C ) then - rst_caltype = noleap - else if ( trim(cal) == GREGORIAN_C ) then - rst_caltype = gregorian - else - call shr_sys_abort(sub//'ERROR: unrecognized calendar specified= '//trim(calendar)) - end if - end if - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_type', xtype=ncd_int, & - long_name='calendar type', units='unitless', flag_meanings=(/ "NO_LEAP_C", "GREGORIAN" /), & - flag_values=(/ noleap, gregorian /), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_caltype) - if (flag == 'read') then - if ( rst_caltype == noleap ) then - calendar = NO_LEAP_C - else if ( rst_caltype == gregorian ) then - calendar = GREGORIAN_C - else - write(iulog,*)sub,': unrecognized calendar type in restart file: ',rst_caltype - call shr_sys_abort( sub//'ERROR: bad calendar type in restart file') - end if - end if - - if (flag == 'write') then - call ESMF_ClockGet( tm_clock, startTime=start_date, currTime=curr_date, refTime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - rst_step_sec = dtime - rst_start_ymd = TimeGetymd( start_date, tod=rst_start_tod ) - rst_ref_ymd = TimeGetymd( ref_date, tod=rst_ref_tod ) - rst_curr_ymd = TimeGetymd( curr_date, tod=rst_curr_tod ) - end if - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_step_sec', xtype=ncd_int, & - long_name='seconds component of timestep size', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_step_sec) - if ((flag == 'read') .and. ( rst_step_sec < 0 .or. rst_step_sec > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_step_sec out of range') - end if - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_start_ymd', xtype=ncd_int, & - long_name='start date', units='YYYYMMDD', ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_start_ymd) - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_start_tod', xtype=ncd_int, & - long_name='start time of day', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_start_tod) - if ((flag == 'read') .and. ( rst_start_tod < 0 .or. rst_start_tod > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_strart_tod out of range') - end if - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_ref_ymd', xtype=ncd_int, & - long_name='reference date', units='YYYYMMDD', ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_ref_ymd) - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_ref_tod', xtype=ncd_int, & - long_name='reference time of day', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_ref_tod) - if ((flag == 'read') .and. ( rst_start_tod < 0 .or. rst_start_tod > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_ref_tod out of range') - end if - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_curr_ymd', xtype=ncd_int, & - long_name='current date', units='YYYYMMDD', ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_curr_ymd) - - call restartvar(ncid=ncid, flag=flag, varname='timemgr_rst_curr_tod', xtype=ncd_int, & - long_name='current time of day', units='sec', & - nvalid_range=(/0,isecspday/), ifill_value=uninit_int, & - interpinic_flag='skip', readvar=readvar, data=rst_curr_tod) - if ((flag == 'read') .and. ( rst_curr_tod < 0 .or. rst_curr_tod > isecspday )) then - call shr_sys_abort( sub//'ERROR: timemgr_rst_ref_ymd out of range') - end if - - end subroutine timemgr_restart_io - - !========================================================================================= - - subroutine timemgr_restart( ) - - !--------------------------------------------------------------------------------- - ! Restart the ESMF time manager using the synclock for ending date. - ! - character(len=*), parameter :: sub = 'clm::timemgr_restart' - integer :: rc ! return code - integer :: yr, mon, day, tod ! Year, month, day, and second as integers - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: ref_date ! reference date for run - type(ESMF_Time) :: curr_date ! date of data in restart file - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: current ! current date (from clock) - type(ESMF_TimeInterval) :: day_step_size ! day step size - type(ESMF_TimeInterval) :: step_size ! timestep size - logical :: run_length_specified = .false. - !--------------------------------------------------------------------------------- - call timemgr_spmdbcast( ) - - ! Initialize calendar from restart info - - call init_calendar() - - ! Initialize the timestep from restart info - - dtime = rst_step_sec - - ! Initialize start date from restart info - - start_date = TimeSetymd( rst_start_ymd, rst_start_tod, "start_date" ) - - ! Initialize current date from restart info - - curr_date = TimeSetymd( rst_curr_ymd, rst_curr_tod, "curr_date" ) - - ! Initialize stop date from sync clock or namelist input - - stop_date = TimeSetymd( 99991231, stop_tod, "stop_date" ) - - call ESMF_TimeIntervalSet( step_size, s=dtime, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting step_size') - - call ESMF_TimeIntervalSet( day_step_size, d=1, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet: setting day_step_size') - - if ( stop_ymd /= uninit_int ) then - current = TimeSetymd( stop_ymd, stop_tod, "stop_date" ) - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - else if ( nelapse /= uninit_int ) then - if ( nelapse >= 0 ) then - current = curr_date + step_size*nelapse - else - current = curr_date - day_step_size*nelapse - end if - if ( current < stop_date ) stop_date = current - run_length_specified = .true. - end if - if ( .not. run_length_specified ) then - call shr_sys_abort (sub//': Must specify stop_ymd or nelapse') - end if - - ! Error check - - if ( stop_date <= start_date ) then - write(iulog,*)sub, ': stop date must be specified later than start date: ' - call ESMF_TimeGet( start_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Start date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - if ( curr_date >= stop_date ) then - write(iulog,*)sub, ': stop date must be specified later than current date: ' - call ESMF_TimeGet( curr_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Current date (yr, mon, day, tod): ', yr, mon, day, tod - call ESMF_TimeGet( stop_date, yy=yr, mm=mon, dd=day, s=tod ) - write(iulog,*) ' Stop date (yr, mon, day, tod): ', yr, mon, day, tod - call shr_sys_abort - end if - - ! Initialize nstep_rad_prev from restart info - - nstep_rad_prev = rst_nstep_rad_prev - - ! Initialize ref date from restart info - - ref_date = TimeSetymd( rst_ref_ymd, rst_ref_tod, "ref_date" ) - - ! Initialize clock - - call init_clock( start_date, ref_date, curr_date, stop_date ) - - ! Advance the timestep. - ! Data from the restart file corresponds to the last timestep of the previous run. - - call advance_timestep() - - ! Set flag that this is the first timestep of the restart run. - - tm_first_restart_step = .true. - - ! Calculate ending time step - - call calc_nestep( ) - - ! Print configuration summary to log file (stdout). - - if (masterproc) call timemgr_print() - - timemgr_set = .true. - - end subroutine timemgr_restart - - !========================================================================================= - - subroutine calc_nestep() - !--------------------------------------------------------------------------------- - ! - ! Calculate ending timestep number - ! Calculation of ending timestep number (nestep) assumes a constant stepsize. - ! - character(len=*), parameter :: sub = 'clm::calc_nestep' - integer :: ntspday ! Number of time-steps per day - type(ESMF_TimeInterval) :: diff ! - type(ESMF_Time) :: start_date ! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - integer :: ndays, nsecs ! Number of days, seconds to ending time - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, stopTime=stop_date, startTime=start_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - ntspday = isecspday/dtime - diff = stop_date - start_date - call ESMF_TimeIntervalGet( diff, d=ndays, s=nsecs, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet calculating nestep') - nestep = ntspday*ndays + nsecs/dtime - if ( mod(nsecs,dtime) /= 0 ) nestep = nestep + 1 - end subroutine calc_nestep - - !========================================================================================= - - subroutine init_calendar( ) - - !--------------------------------------------------------------------------------- - ! Initialize calendar - ! - ! Local variables - ! - character(len=*), parameter :: sub = 'clm::init_calendar' - type(ESMF_CalKind_Flag) :: cal_type ! calendar type - character(len=len(calendar)) :: caltmp - integer :: rc ! return code - !--------------------------------------------------------------------------------- - - caltmp = to_upper(calendar) - if ( trim(caltmp) == NO_LEAP_C ) then - cal_type = ESMF_CALKIND_NOLEAP - else if ( trim(caltmp) == GREGORIAN_C ) then - cal_type = ESMF_CALKIND_GREGORIAN - else - write(iulog,*)sub,': unrecognized calendar specified: ',calendar - call shr_sys_abort - end if - tm_cal = ESMF_CalendarCreate( name=caltmp, calkindflag=cal_type, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_CalendarSet') - end subroutine init_calendar - - !========================================================================================= - - subroutine timemgr_print() - - !--------------------------------------------------------------------------------- - character(len=*), parameter :: sub = 'clm::timemgr_print' - integer :: rc - integer :: yr, mon, day - integer :: & ! Data required to restart time manager: - nstep = uninit_int, &! current step number - step_sec = uninit_int, &! timestep size seconds - start_yr = uninit_int, &! start year - start_mon = uninit_int, &! start month - start_day = uninit_int, &! start day of month - start_tod = uninit_int, &! start time of day - stop_yr = uninit_int, &! stop year - stop_mon = uninit_int, &! stop month - stop_day = uninit_int, &! stop day of month - stop_tod = uninit_int, &! stop time of day - ref_yr = uninit_int, &! reference year - ref_mon = uninit_int, &! reference month - ref_day = uninit_int, &! reference day of month - ref_tod = uninit_int, &! reference time of day - curr_yr = uninit_int, &! current year - curr_mon = uninit_int, &! current month - curr_day = uninit_int, &! current day of month - curr_tod = uninit_int ! current time of day - integer(ESMF_KIND_I8) :: step_no - type(ESMF_Time) :: start_date! start date for run - type(ESMF_Time) :: stop_date ! stop date for run - type(ESMF_Time) :: curr_date ! date of data in restart file - type(ESMF_Time) :: ref_date ! reference date - type(ESMF_TimeInterval) :: step ! Time-step - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, startTime=start_date, currTime=curr_date, & - refTime=ref_date, stopTime=stop_date, timeStep=step, & - advanceCount=step_no, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - nstep = step_no - - write(iulog,*)' ******** CLM Time Manager Configuration ********' - - call ESMF_TimeIntervalGet( step, s=step_sec, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - - call ESMF_TimeGet( start_date, yy=start_yr, mm=start_mon, dd=start_day, & - s=start_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( stop_date, yy=stop_yr, mm=stop_mon, dd=stop_day, & - s=stop_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( ref_date, yy=ref_yr, mm=ref_mon, dd=ref_day, s=ref_tod, & - rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeGet( curr_date, yy=curr_yr, mm=curr_mon, dd=curr_day, & - s=curr_tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - write(iulog,*)' Calendar type: ',trim(calendar) - write(iulog,*)' Timestep size (seconds): ', step_sec - write(iulog,*)' Start date (yr mon day tod): ', start_yr, start_mon, & - start_day, start_tod - write(iulog,*)' Stop date (yr mon day tod): ', stop_yr, stop_mon, & - stop_day, stop_tod - write(iulog,*)' Reference date (yr mon day tod): ', ref_yr, ref_mon, & - ref_day, ref_tod - write(iulog,*)' Current step number: ', nstep - write(iulog,*)' Ending step number: ', nestep - write(iulog,*)' Current date (yr mon day tod): ', curr_yr, curr_mon, & - curr_day, curr_tod - - if ( tm_perp_calendar ) then - call ESMF_TimeGet( tm_perp_date, yy=yr, mm=mon, dd=day, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - write(iulog,*)' Use perpetual diurnal cycle date (yr mon day): ', & - yr, mon, day - end if - - write(iulog,*)' ************************************************' - - end subroutine timemgr_print - - !========================================================================================= - - subroutine advance_timestep() - - ! Increment the timestep number. - - character(len=*), parameter :: sub = 'clm::advance_timestep' - integer :: rc - - call ESMF_ClockAdvance( tm_clock, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockAdvance') - - tm_first_restart_step = .false. - - end subroutine advance_timestep - - !========================================================================================= - - subroutine get_clock( clock ) - - ! Return the ESMF clock - - type(ESMF_Clock), intent(inout) :: clock - - character(len=*), parameter :: sub = 'clm::get_clock' - type(ESMF_TimeInterval) :: step_size - type(ESMF_Time) :: start_date, stop_date, ref_date - integer :: rc - - call ESMF_ClockGet( tm_clock, timeStep=step_size, startTime=start_date, & - stoptime=stop_date, reftime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - call ESMF_ClockSet(clock, timeStep=step_size, startTime=start_date, & - stoptime=stop_date, reftime=ref_date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockSet') - - end subroutine get_clock - - !========================================================================================= - - function get_curr_ESMF_Time( ) - - ! Return the current time as ESMF_Time - - type(ESMF_Time) :: get_curr_ESMF_Time - character(len=*), parameter :: sub = 'clm::get_curr_ESMF_Time' - integer :: rc - - call ESMF_ClockGet( tm_clock, currTime=get_curr_ESMF_Time, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - end function get_curr_ESMF_Time - - !========================================================================================= - - integer function get_step_size() - - ! Return the step size in seconds. - - character(len=*), parameter :: sub = 'clm::get_step_size' - type(ESMF_TimeInterval) :: step_size ! timestep size - integer :: rc - - call ESMF_ClockGet(tm_clock, timeStep=step_size, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeIntervalGet(step_size, s=get_step_size, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockTimeIntervalGet') - - end function get_step_size - - !========================================================================================= - - subroutine update_rad_dtime(doalb) - !--------------------------------------------------------------------------------- - ! called only on doalb timesteps to save off radiation nsteps - ! - ! Local Arguments - logical,intent(in) :: doalb - integer :: dtime,nstep - - if (doalb) then - - dtime=get_step_size() - nstep = get_nstep() - - if (nstep_rad_prev == uninit_int ) then - dtime_rad = dtime - nstep_rad_prev = nstep - else - dtime_rad = (nstep - nstep_rad_prev) * dtime - nstep_rad_prev = nstep - endif - end if - end subroutine update_rad_dtime - - !========================================================================================= - - integer function get_rad_step_size() - - if (nstep_rad_prev == uninit_int ) then - get_rad_step_size=get_step_size() - else - get_rad_step_size=dtime_rad - end if - - end function get_rad_step_size - - !========================================================================================= - - integer function get_nstep() - - ! Return the timestep number. - - character(len=*), parameter :: sub = 'clm::get_nstep' - integer :: rc - integer(ESMF_KIND_I8) :: step_no - - call ESMF_ClockGet(tm_clock, advanceCount=step_no, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - get_nstep = step_no - - end function get_nstep - - !========================================================================================= - - subroutine get_curr_date(yr, mon, day, tod, offset) - - !----------------------------------------------------------------------------------------- - ! Return date components valid at end of current timestep with an optional - ! offset (positive or negative) in seconds. - - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_curr_date' - integer :: rc - type(ESMF_Time) :: date - type(ESMF_TimeInterval) :: off - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, currTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - if (present(offset)) then - if (offset > 0) then - call ESMF_TimeIntervalSet( off, s=offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date + off - else if (offset < 0) then - call ESMF_TimeIntervalSet( off, s=-offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date - off - end if - end if - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_curr_date - - !========================================================================================= - - subroutine get_perp_date(yr, mon, day, tod, offset) - - !----------------------------------------------------------------------------------------- - ! Return time of day valid at end of current timestep and the components - ! of the perpetual date (with an optional offset (positive or negative) in seconds. - - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_perp_date' - integer :: rc - type(ESMF_Time) :: date - type(ESMF_TimeInterval) :: DelTime - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, currTime=date, rc=rc ) - ! Get time of day add it to perpetual date - ! Get year, month, day so that seconds are time-of-day rather than since start time - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeIntervalSet(DelTime, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = tm_perp_date + DelTime - if ( present(offset) )then - call ESMF_TimeIntervalSet(DelTime, s=offset, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date + DelTime - end if - ! Get time of day from the result - ! Get year, month, day so that seconds are time-of-day rather than since start time - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - - ! Get the date from the fixed perpetual date (in case it overflows to next day) - call ESMF_TimeGet(tm_perp_date, yy=yr, mm=mon, dd=day, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_perp_date - - !========================================================================================= - - subroutine get_prev_date(yr, mon, day, tod) - - ! Return date components valid at beginning of current timestep. - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_prev_date' - integer :: rc - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet(tm_clock, prevTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_prev_date - - !========================================================================================= - - subroutine get_start_date(yr, mon, day, tod) - - ! Return date components valid at beginning of initial run. - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_start_date' - integer :: rc - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet(tm_clock, startTime=date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_start_date - - !========================================================================================= - - integer function get_driver_start_ymd( tod ) - - ! Return date of start of simulation from driver (i.e. NOT from restart file) - ! Note: get_start_date gets you the date from the beginning of the simulation - ! on the restart file. - - ! Arguments - integer, optional, intent(out) ::& - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_driver_start_ymd' - !----------------------------------------------------------------------------------------- - - if ( start_ymd == uninit_int )then - call shr_sys_abort( sub//': error driver start date is NOT set yet' ) - end if - if ( start_ymd < 101 .or. start_ymd > 99991231 )then - call shr_sys_abort( sub//': error driver start date is invalid' ) - end if - if ( present(tod) )then - tod = start_tod - if ( (tod < 0) .or. (tod > isecspday) )then - call shr_sys_abort( sub//': error driver start tod is invalid' ) - end if - end if - get_driver_start_ymd = start_ymd - - end function get_driver_start_ymd - - !========================================================================================= - - subroutine get_ref_date(yr, mon, day, tod) - - ! Return date components of the reference date. - - ! Arguments - integer, intent(out) ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_ref_date' - integer :: rc - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet(tm_clock, refTime=date, rc=rc) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_TimeGet(date, yy=yr, mm=mon, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end subroutine get_ref_date - - !========================================================================================= - - subroutine get_curr_time(days, seconds) - - ! Return time components valid at end of current timestep. - ! Current time is the time interval between the current date and the reference date. - - ! Arguments - integer, intent(out) ::& - days, &! number of whole days in time interval - seconds ! remaining seconds in time interval - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_curr_time' - integer :: rc - type(ESMF_Time) :: cdate, rdate - type(ESMF_TimeInterval) :: diff - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, currTime=cdate, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - call ESMF_ClockGet( tm_clock, refTime=rdate, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - diff = cdate - rdate - - call ESMF_TimeIntervalGet(diff, d=days, s=seconds, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - - end subroutine get_curr_time - - !========================================================================================= - - subroutine get_prev_time(days, seconds) - - ! Return time components valid at beg of current timestep. - ! prev time is the time interval between the prev date and the reference date. - - ! Arguments - integer, intent(out) ::& - days, &! number of whole days in time interval - seconds ! remaining seconds in time interval - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_prev_time' - integer :: rc - type(ESMF_Time) :: date, ref_date - type(ESMF_TimeInterval) :: diff - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet(tm_clock, prevTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet for prevTime') - call ESMF_ClockGet(tm_clock, refTime=ref_date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet for refTime') - diff = date - ref_date - call ESMF_TimeIntervalGet( diff, d=days, s=seconds, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeintervalGet') - - end subroutine get_prev_time - - !========================================================================================= - - function get_curr_calday(offset) - - ! Return calendar day at end of current timestep with optional offset. - ! Calendar day 1.0 = 0Z on Jan 1. - - ! Arguments - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - ! Return value - real(r8) :: get_curr_calday - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_curr_calday' - integer :: rc - type(ESMF_Time) :: date - type(ESMF_TimeInterval) :: off, diurnal - integer :: year, month, day, tod - !----------------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, currTime=date, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - - if (present(offset)) then - if (offset > 0) then - call ESMF_TimeIntervalSet( off, s=offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date + off - else if (offset < 0) then - call ESMF_TimeIntervalSet( off, s=-offset, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = date - off - end if - end if - - if ( tm_perp_calendar ) then - call ESMF_TimeGet(date, yy=year, mm=month, dd=day, s=tod, rc=rc) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - call ESMF_TimeIntervalSet( diurnal, s=tod, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalSet') - date = tm_perp_date + diurnal - end if - - call ESMF_TimeGet( date, dayOfYear_r8=get_curr_calday, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - !----------------------------------------------------------------------------------------! - !!!!!!!!!!!!!! WARNING HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!! - !!!! The following hack fakes day 366 by reusing day 365. This is just because the !!!!!! - !!!! current shr_orb_decl calculation can't handle days > 366. !!!!!! - !!!! Dani Bundy-Coleman and Erik Kluzek Aug/2008 !!!!!! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if ( (get_curr_calday > 366.0) .and. (get_curr_calday <= 367.0) .and. & - (trim(calendar) == GREGORIAN_C) )then - get_curr_calday = get_curr_calday - 1.0_r8 - end if - !!!!!!!!!!!!!! END HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!!!!!! - !----------------------------------------------------------------------------------------! - if ( (get_curr_calday < 1.0) .or. (get_curr_calday > 366.0) )then - write(iulog,*) sub, ' = ', get_curr_calday - if ( present(offset) ) write(iulog,*) 'offset = ', offset - call shr_sys_abort( sub//': error get_curr_calday out of bounds' ) - end if - - end function get_curr_calday - - !========================================================================================= - - function get_calday(ymd, tod) - - ! Return calendar day corresponding to specified time instant. - ! Calendar day 1.0 = 0Z on Jan 1. - - ! Arguments - integer, intent(in) :: & - ymd, &! date in yearmmdd format - tod ! time of day (seconds past 0Z) - - ! Return value - real(r8) :: get_calday - - ! Local variables - character(len=*), parameter :: sub = 'clm::get_calday' - integer :: rc ! return code - type(ESMF_Time) :: date - !----------------------------------------------------------------------------------------- - - date = TimeSetymd( ymd, tod, "get_calday" ) - call ESMF_TimeGet( date, dayOfYear_r8=get_calday, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - !----------------------------------------------------------------------------------------! -!!!!!!!!!!!!!! WARNING HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!! -!!!! The following hack fakes day 366 by reusing day 365. This is just because the !!!!!! -!!!! current shr_orb_decl calculation can't handle days > 366. !!!!!! -!!!! Dani Bundy-Coleman and Erik Kluzek Aug/2008 !!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if ( (get_calday > 366.0) .and. (get_calday <= 367.0) .and. & - (trim(calendar) == GREGORIAN_C) )then - get_calday = get_calday - 1.0_r8 - end if -!!!!!!!!!!!!!! END HACK TO ENABLE Gregorian CALENDAR WITH SHR_ORB !!!!!!!!!!!!!!!!!!!!!!!! - !----------------------------------------------------------------------------------------! - if ( (get_calday < 1.0) .or. (get_calday > 366.0) )then - write(iulog,*) sub, ' = ', get_calday - call shr_sys_abort( sub//': error calday out of range' ) - end if - - end function get_calday - - !========================================================================================= - - function get_calendar() - - ! Return calendar - - ! Return value - character(len=ESMF_MAXSTR) :: get_calendar - - get_calendar = calendar - - end function get_calendar - - !========================================================================================= - - integer function get_days_per_year( offset ) - - !--------------------------------------------------------------------------------- - ! Get the number of days per year for currrent year - - ! - ! Arguments - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_days_per_year' - integer :: yr, mon, day, tod ! current date year, month, day and time-of-day - type(ESMF_Time) :: eDate ! ESMF date - integer :: rc ! ESMF return code - !--------------------------------------------------------------------------------- - - if ( present(offset) )then - call get_curr_date(yr, mon, day, tod, offset ) - else - call get_curr_date(yr, mon, day, tod ) - end if - eDate = TimeSetymd( ymd=yr*10000+1231, tod=0, desc="end of year" ) - call ESMF_TimeGet( eDate, dayOfYear=get_days_per_year, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeGet') - - end function get_days_per_year - - !========================================================================================= - - function get_curr_yearfrac( offset ) - - !--------------------------------------------------------------------------------- - ! Get the fractional position in the current year. This is 0 at midnight on Jan 1, - ! and 1 at the end of Dec 31. - - ! - ! Arguments - real(r8) :: get_curr_yearfrac ! function result - - integer, optional, intent(in) :: offset ! Offset from current time in seconds. - ! Positive for future times, negative - ! for previous times. - - character(len=*), parameter :: sub = 'clm::get_curr_yearfrac' - real(r8) :: cday ! current calendar day (1.0 = 0Z on Jan 1) - real(r8) :: days_per_year ! days per year - - cday = get_curr_calday(offset=offset) - days_per_year = get_days_per_year() - - get_curr_yearfrac = (cday - 1._r8)/days_per_year - - end function get_curr_yearfrac - - !========================================================================================= - - subroutine get_rest_date(ncid, yr) - - !--------------------------------------------------------------------------------- - ! Get the date from the restart file. - ! - ! Currently just returns the year (because the month & day are harder to extract, and - ! currently aren't needed). - use pio, only: file_desc_t - use ncdio_pio, only: ncd_io - ! - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf id for the restart file - integer , intent(out) :: yr ! year from restart file - - integer :: ymd ! yyyymmdd from the restart file - logical :: readvar ! whether the variable was read from the file - - integer, parameter :: year_mask = 10000 ! divide by this to get year from ymd - - character(len=*), parameter :: subname = 'get_rest_date' - !----------------------------------------------------------------------- - - ! Get the date (yyyymmdd) from restart file. - ! Note that we cannot simply use the rst_curr_ymd module variable, because that isn't - ! set under some circumstances - call ncd_io(varname='timemgr_rst_curr_ymd', data=ymd, & - ncid=ncid, flag='read', readvar=readvar) - if (.not. readvar) then - call shr_sys_abort(subname//' ERROR: timemgr_rst_curr_ymd not found on restart file') - end if - - ! Extract the year - yr = ymd / year_mask - end subroutine get_rest_date - - !========================================================================================= - - subroutine set_nextsw_cday( nextsw_cday_in ) - - ! Set the next radiation calendar day, so that radiation step can be calculated - ! - ! Arguments - real(r8), intent(IN) :: nextsw_cday_in ! input calday of next radiation computation - - character(len=*), parameter :: sub = 'clm::set_nextsw_cday' - - nextsw_cday = nextsw_cday_in - - end subroutine set_nextsw_cday - - !========================================================================================= - - function is_beg_curr_day() - - ! Return true if current timestep is first timestep in current day. - - ! Return value - logical :: is_beg_curr_day - - ! Local variables - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - - call get_curr_date(yr, mon, day, tod) - is_beg_curr_day = ( tod == dtime ) - - end function is_beg_curr_day - - !========================================================================================= - - function is_end_curr_day() - - !--------------------------------------------------------------------------------- - ! Return true if current timestep is last timestep in current day. - - ! Return value - logical :: is_end_curr_day - - ! Local variables - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - !--------------------------------------------------------------------------------- - - call get_curr_date(yr, mon, day, tod) - is_end_curr_day = (tod == 0) - - end function is_end_curr_day - - !========================================================================================= - - logical function is_end_curr_month() - - !--------------------------------------------------------------------------------- - ! Return true if current timestep is last timestep in current month. - - ! Local variables - integer ::& - yr, &! year - mon, &! month - day, &! day of month - tod ! time of day (seconds past 0Z) - !--------------------------------------------------------------------------------- - - call get_curr_date(yr, mon, day, tod) - is_end_curr_month = (day == 1 .and. tod == 0) - - end function is_end_curr_month - - !========================================================================================= - - logical function is_first_step() - - !--------------------------------------------------------------------------------- - ! Return true on first step of initial run only. - - ! Local variables - character(len=*), parameter :: sub = 'clm::is_first_step' - integer :: rc - integer :: nstep - integer(ESMF_KIND_I8) :: step_no - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, advanceCount=step_no, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - nstep = step_no - is_first_step = (nstep == 0) - - end function is_first_step - !========================================================================================= - - logical function is_first_restart_step() - - ! Return true on first step of restart run only. - - is_first_restart_step = tm_first_restart_step - - end function is_first_restart_step - - !========================================================================================= - - logical function is_last_step() - - !--------------------------------------------------------------------------------- - ! Return true on last timestep. - - ! Local variables - character(len=*), parameter :: sub = 'clm::is_last_step' - type(ESMF_Time) :: stop_date - type(ESMF_Time) :: curr_date - type(ESMF_TimeInterval) :: time_step - integer :: rc - !--------------------------------------------------------------------------------- - - call ESMF_ClockGet( tm_clock, stopTime=stop_date, & - currTime=curr_date, TimeStep=time_step, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_ClockGet') - if ( curr_date+time_step > stop_date ) then - is_last_step = .true. - else - is_last_step = .false. - end if - - end function is_last_step - - !========================================================================================= - - logical function is_perpetual() - - ! Return true on last timestep. - - is_perpetual = tm_perp_calendar - - end function is_perpetual - - !========================================================================================= - - subroutine timemgr_datediff(ymd1, tod1, ymd2, tod2, days) - - ! Calculate the difference (ymd2,tod2) - (ymd1,tod1) and return the result in days. - ! Arguments - integer, intent(in) ::& - ymd1, &! date1 in yyyymmdd format - tod1, &! time of day relative to date1 (seconds past 0Z) - ymd2, &! date2 in yyyymmdd format - tod2 ! time of day relative to date2 (seconds past 0Z) - - real(r8) :: days ! (ymd2,tod2)-(ymd1,tod1) in days - - ! Local variables - character(len=*), parameter :: sub = 'clm::timemgr_datediff' - integer :: rc ! return code - - type(ESMF_Time) :: date1 - type(ESMF_Time) :: date2 - type(ESMF_TimeInterval) :: diff - !----------------------------------------------------------------------------------------- - - date1 = TimeSetymd( ymd1, tod1, "date1" ) - date2 = TimeSetymd( ymd2, tod2, "date2" ) - diff = date2 - date1 - call ESMF_TimeIntervalGet( diff, d_r8=days, rc=rc ) - call chkrc(rc, sub//': error return from ESMF_TimeIntervalGet') - days = days + 1.0_r8 - - end subroutine timemgr_datediff - - !========================================================================================= - - subroutine chkrc(rc, mes) - integer, intent(in) :: rc ! return code from time management library - character(len=*), intent(in) :: mes ! error message - if ( rc == ESMF_SUCCESS ) return - write(iulog,*) mes - call shr_sys_abort ('CHKRC') - end subroutine chkrc - - !========================================================================================= - - function to_upper(str) - - !--------------------------------------------------------------------------------- - ! Convert character string to upper case. Use achar and iachar intrinsics - ! to ensure use of ascii collating sequence. - ! - ! !INPUT PARAMETERS: - character(len=*), intent(in) :: str ! String to convert to upper case - ! !RETURN VALUE: - character(len=len(str)) :: to_upper - ! !LOCAL VARIABLES: - integer :: i ! Index - integer :: aseq ! ascii collating sequence - character(len=1) :: ctmp ! Character temporary - !--------------------------------------------------------------------------------- - - do i = 1, len(str) - ctmp = str(i:i) - aseq = iachar(ctmp) - if ( aseq >= 97 .and. aseq <= 122 ) ctmp = achar(aseq - 32) - to_upper(i:i) = ctmp - end do - - end function to_upper - - !========================================================================================= - - logical function is_restart( ) - ! Determine if restart run - use clm_varctl, only : nsrest, nsrContinue - if (nsrest == nsrContinue) then - is_restart = .true. - else - is_restart = .false. - end if - end function is_restart - - !========================================================================================= - - subroutine timemgr_spmdbcast( ) - - use spmdMod, only : mpicom, MPI_INTEGER - - integer :: ier - - call mpi_bcast (dtime , 1, MPI_INTEGER , 0, mpicom, ier) - - end subroutine timemgr_spmdbcast - -end module clm_time_manager diff --git a/src_clm40/main/clm_varcon.F90 b/src_clm40/main/clm_varcon.F90 deleted file mode 100644 index b3b076ac5c..0000000000 --- a/src_clm40/main/clm_varcon.F90 +++ /dev/null @@ -1,167 +0,0 @@ -module clm_varcon - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_varcon -! -! !DESCRIPTION: -! Module containing various model constants -! -! !USES: - use shr_kind_mod , only: r8 => shr_kind_r8 - use shr_const_mod, only: SHR_CONST_G,SHR_CONST_STEBOL,SHR_CONST_KARMAN, & - SHR_CONST_RWV,SHR_CONST_RDAIR,SHR_CONST_CPFW, & - SHR_CONST_CPICE,SHR_CONST_CPDAIR,SHR_CONST_LATVAP, & - SHR_CONST_LATSUB,SHR_CONST_LATICE,SHR_CONST_RHOFW, & - SHR_CONST_RHOICE,SHR_CONST_TKFRZ,SHR_CONST_REARTH, & - SHR_CONST_PDB, SHR_CONST_PI, SHR_CONST_CDAY, & - SHR_CONST_RGAS - use clm_varpar , only: numrad, nlevgrnd, nlevlak -! -! !PUBLIC TYPES: - implicit none - save -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 27 February 2008: Keith Oleson; Add forcing height and aerodynamic parameters -! -!EOP -!----------------------------------------------------------------------- - - !------------------------------------------------------------------ - ! Initialize mathmatical constants - !------------------------------------------------------------------ - - real(r8) :: rpi = SHR_CONST_PI - - !------------------------------------------------------------------ - ! Initialize physical constants - !------------------------------------------------------------------ - - real(r8) :: grav = SHR_CONST_G !gravity constant [m/s2] - real(r8) :: sb = SHR_CONST_STEBOL !stefan-boltzmann constant [W/m2/K4] - real(r8) :: vkc = SHR_CONST_KARMAN !von Karman constant [-] - real(r8) :: rwat = SHR_CONST_RWV !gas constant for water vapor [J/(kg K)] - real(r8) :: rair = SHR_CONST_RDAIR !gas constant for dry air [J/kg/K] - real(r8) :: roverg = SHR_CONST_RWV/SHR_CONST_G*1000._r8 !Rw/g constant = (8.3144/0.018)/(9.80616)*1000. mm/K - real(r8) :: cpliq = SHR_CONST_CPFW !Specific heat of water [J/kg-K] - real(r8) :: cpice = SHR_CONST_CPICE !Specific heat of ice [J/kg-K] - real(r8) :: cpair = SHR_CONST_CPDAIR !specific heat of dry air [J/kg/K] - real(r8) :: hvap = SHR_CONST_LATVAP !Latent heat of evap for water [J/kg] - real(r8) :: hsub = SHR_CONST_LATSUB !Latent heat of sublimation [J/kg] - real(r8) :: hfus = SHR_CONST_LATICE !Latent heat of fusion for ice [J/kg] - real(r8) :: denh2o = SHR_CONST_RHOFW !density of liquid water [kg/m3] - real(r8) :: denice = SHR_CONST_RHOICE !density of ice [kg/m3] - real(r8) :: rgas = SHR_CONST_RGAS !universal gas constant [J/K/kmole] - real(r8) :: tkair = 0.023_r8 !thermal conductivity of air [W/m/K] - real(r8) :: tkice = 2.290_r8 !thermal conductivity of ice [W/m/K] - real(r8) :: tkwat = 0.6_r8 !thermal conductivity of water [W/m/K] - real(r8) :: tfrz = SHR_CONST_TKFRZ !freezing temperature [K] - real(r8) :: tcrit = 2.5_r8 !critical temperature to determine rain or snow - real(r8) :: o2_molar_const = 0.209_r8 !constant atmospheric O2 molar ratio (mol/mol) - - real(r8) :: bdsno = 250._r8 !bulk density snow (kg/m**3) - real(r8) :: alpha_aero = 1.0_r8 !constant for aerodynamic parameter weighting - real(r8) :: tlsai_crit = 2.0_r8 !critical value of elai+esai for which aerodynamic parameters are maximum - real(r8) :: watmin = 0.01_r8 !minimum soil moisture (mm) - - real(r8) :: re = SHR_CONST_REARTH*0.001_r8 !radius of earth (km) - - real(r8), public, parameter :: degpsec = 15._r8/3600.0_r8 ! Degree's earth rotates per second - - real(r8), public, parameter :: secspday= SHR_CONST_CDAY ! Seconds per day - integer, public, parameter :: isecspday= secspday ! Integer seconds per day - real(r8), public, parameter :: spval = 1.e36_r8 ! special value for real data - integer , public, parameter :: ispval = -9999 ! special value for int data - - ! These are tunable constants from clm2_3 - - real(r8) :: zlnd = 0.01_r8 !Roughness length for soil [m] - real(r8) :: zsno = 0.0024_r8 !Roughness length for snow [m] - real(r8) :: csoilc = 0.004_r8 !Drag coefficient for soil under canopy [-] - real(r8) :: capr = 0.34_r8 !Tuning factor to turn first layer T into surface T - real(r8) :: cnfac = 0.5_r8 !Crank Nicholson factor between 0 and 1 - real(r8) :: ssi = 0.033_r8 !Irreducible water saturation of snow - real(r8) :: wimp = 0.05_r8 !Water impremeable if porosity less than wimp - real(r8) :: pondmx = 10.0_r8 !Ponding depth (mm) - real(r8) :: pondmx_urban = 1.0_r8 !Ponding depth for urban roof and impervious road (mm) - ! 4/14/05: PET - ! Adding isotope code - real(r8), parameter :: preind_atm_del13c = -6.0 ! preindustrial value for atmospheric del13C - real(r8), parameter :: preind_atm_ratio = SHR_CONST_PDB + (preind_atm_del13c * SHR_CONST_PDB)/1000.0 ! 13C/12C - real(r8) :: c13ratio = preind_atm_ratio/(1.0+preind_atm_ratio) ! 13C/(12+13)C preind atmosphere - - real(r8), parameter :: ht_efficiency_factor = 0.75_r8 !efficiency factor for urban heating (-) - real(r8), parameter :: ac_efficiency_factor = 0.25_r8 !efficiency factor for urban air conditioning (-) - real(r8) :: ht_wasteheat_factor = 1.0_r8/ht_efficiency_factor !wasteheat factor for urban heating (-) - real(r8) :: ac_wasteheat_factor = 1.0_r8/ac_efficiency_factor !wasteheat factor for urban air conditioning (-) - real(r8) :: wasteheat_limit = 100._r8 !limit on wasteheat (W/m2) - - real(r8), parameter :: h2osno_max = 1000._r8 ! max allowed snow thickness (mm H2O) - real(r8), parameter :: lapse_glcmec = 0.006_r8 ! surface temperature lapse rate (deg m-1) - ! Pritchard et al. (GRL, 35, 2008) use 0.006 - - !------------------------------------------------------------------ - ! Initialize water type constants - !------------------------------------------------------------------ - - ! "land unit " types - ! 1 soil (includes vegetated landunits) - ! 2 land ice (glacier) - ! 3 deep lake - ! 4 shallow lake - ! 5 wetland (swamp, marsh, etc.) - ! 6 urban - ! 7 land ice (glacier) with multiple elevation classes - ! 8 crop - - integer :: istsoil = 1 !soil landunit type - integer :: istice = 2 !land ice landunit type - integer :: istdlak = 3 !deep lake landunit type - integer :: istslak = 4 !shallow lake landunit type - integer :: istwet = 5 !wetland landunit type - integer :: isturb = 6 !urban landunit type - integer :: istice_mec = 7 !land ice (multiple elevation classes) landunit type - integer :: istcrop = 8 !crop landunit type - integer :: max_lunit = 8 !maximum value that lun%itype can have - !(i.e., largest value in the above list) - - ! urban column types - - integer :: icol_roof = 61 - integer :: icol_sunwall = 62 - integer :: icol_shadewall = 63 - integer :: icol_road_imperv = 64 - integer :: icol_road_perv = 65 - - !------------------------------------------------------------------ - ! Initialize miscellaneous radiation constants - !------------------------------------------------------------------ - - integer, private :: i ! loop index - - real(r8), allocatable :: albsat(:,:) ! wet soil albedo by color class and waveband (1=vis,2=nir) - real(r8), allocatable :: albdry(:,:) ! dry soil albedo by color class and waveband (1=vis,2=nir) - - real(r8) :: alblak(numrad) ! albedo frozen lakes by waveband (1=vis, 2=nir) - data (alblak(i),i=1,numrad) /0.60_r8, 0.40_r8/ - - real(r8) :: betads = 0.5_r8 ! two-stream parameter betad for snow - real(r8) :: betais = 0.5_r8 ! two-stream parameter betai for snow - real(r8) :: omegas(numrad) ! two-stream parameter omega for snow by band - data (omegas(i),i=1,numrad) /0.8_r8, 0.4_r8/ - - !------------------------------------------------------------------ - ! Soil and Lake depths are constants for now - ! The values for the following arrays are set in routine iniTimeConst - !------------------------------------------------------------------ - - real(r8) :: zlak(1:nlevlak) !lake z (layers) - real(r8) :: dzlak(1:nlevlak) !lake dz (thickness) - real(r8) :: zsoi(1:nlevgrnd) !soil z (layers) - real(r8) :: dzsoi(1:nlevgrnd) !soil dz (thickness) - real(r8) :: zisoi(0:nlevgrnd) !soil zi (interfaces) - -end module clm_varcon diff --git a/src_clm40/main/clm_varctl.F90 b/src_clm40/main/clm_varctl.F90 deleted file mode 100644 index ec8466201b..0000000000 --- a/src_clm40/main/clm_varctl.F90 +++ /dev/null @@ -1,318 +0,0 @@ -module clm_varctl - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_varctl -! -! !DESCRIPTION: -! Module containing run control variables -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC MEMBER FUNCTIONS: - implicit none - public :: clm_varctl_set ! Set variables - public :: clmvarctl_init ! Initialize and check values after namelist input - - private - save -! -! !PUBLIC TYPES: -! - integer, parameter, private :: iundef = -9999999 - integer, parameter, private :: rundef = -9999999._r8 -! -! Run control variables -! - character(len=256), public :: caseid = ' ' ! case id - character(len=256), public :: ctitle = ' ' ! case title - integer, public :: nsrest = iundef ! Type of run - integer, public, parameter :: nsrStartup = 0 ! Startup from initial conditions - integer, public, parameter :: nsrContinue = 1 ! Continue from restart files - integer, public, parameter :: nsrBranch = 2 ! Branch from restart files - logical, public :: brnch_retain_casename = .false. ! true => allow case name to remain the same for branch run - ! by default this is not allowed - logical, public :: noland = .false. ! true => no valid land points -- do NOT run - character(len=256), public :: hostname = ' ' ! Hostname of machine running on - character(len=256), public :: username = ' ' ! username of user running program - character(len=256), public :: source = "Community Land Model CLM4.0" ! description of this source - character(len=256), public :: version = " " ! version of program - character(len=256), public :: conventions = "CF-1.0" ! dataset conventions -! -! Unit Numbers -! - integer, public :: iulog = 6 ! "stdout" log file unit number, default is 6 -! -! Output NetCDF files -! - logical, public :: outnc_large_files = .true. ! large file support for output NetCDF files -! -! Run input files -! - character(len=256), public :: finidat = ' ' ! initial conditions file name - character(len=256), public :: fsurdat = ' ' ! surface data file name - character(len=256), public :: fatmgrid = ' ' ! atm grid file name - character(len=256), public :: fatmlndfrc = ' ' ! lnd frac file on atm grid - character(len=256), public :: fatmtopo = ' ' ! topography on atm grid - character(len=256), public :: flndtopo = ' ' ! topography on lnd grid - character(len=256), public :: flanduse_timeseries = ' ' ! dynamic landuse dataset - character(len=256), public :: fpftcon = ' ' ! ASCII data file with PFT physiological constants - character(len=256), public :: nrevsn = ' ' ! restart data file name for branch run - character(len=256), public :: fsnowoptics = ' ' ! snow optical properties file name - character(len=256), public :: fsnowaging = ' ' ! snow aging parameters file name - -! -! Landunit logic -! - logical, public :: create_crop_landunit = .false. ! true => separate crop landunit is not created by default - logical, public :: allocate_all_vegpfts = .false. ! true => allocate memory for all possible vegetated pfts on - ! vegetated landunit if at least one pft has nonzero weight -! -! BGC logic and datasets -! - character(len=16), public :: co2_type = 'constant' ! values of 'prognostic','diagnostic','constant' -! -! Physics -! - logical, public :: wrtdia = .false. ! true => write global average diagnostics to std out - real(r8), public :: co2_ppmv = 355._r8 ! atmospheric CO2 molar ratio (by volume) (umol/mol) - - ! C isotopes - logical, public :: use_c13 = .false. ! true => use C-13 model - logical, public :: use_c14 = .false. ! true => use C-14 model - -! glacier_mec control variables: default values (may be overwritten by namelist) - - logical , public :: create_glacier_mec_landunit = .false. ! glacier_mec landunit is not created (set in controlMod) - logical , public :: glc_dyntopo = .false. ! true => CLM glacier topography changes dynamically - real(r8), public, allocatable :: glc_topomax(:) ! upper limit of each class (m) (set in surfrd) - character(len=256), public :: fglcmask = ' ' ! glacier mask file name -! -! single column control variables -! - logical, public :: single_column = .false. ! true => single column mode - real(r8), public :: scmlat = rundef ! single column lat - real(r8), public :: scmlon = rundef ! single column lon -! -! instance control -! - integer, public :: inst_index - character(len=16), public :: inst_name - character(len=16), public :: inst_suffix -! -! Decomp control variables -! - integer, public :: nsegspc = 20 ! number of segments per clump for decomp -! -! Derived variables (run, history and restart file) -! - character(len=256), public :: rpntdir = '.' ! directory name for local restart pointer file - character(len=256), public :: rpntfil = 'rpointer.lnd' ! file name for local restart pointer file -! -! Migration of CPP variables -! -#if (defined CN) - logical, public :: use_cn = .true. -#else - logical, public :: use_cn = .false. -#endif -#if (defined CNDV) - logical, public :: use_cndv = .true. -#else - logical, public :: use_cndv = .false. -#endif -#if (defined CROP) - logical, public :: use_crop = .true. -#else - logical, public :: use_crop = .false. -#endif -#if (defined SNICAR_FRC) - logical, public :: use_snicar_frc = .true. -#else - logical, public :: use_snicar_frc = .false. -#endif -#if (defined NOFIRE) - logical, public :: use_nofire = .true. -#else - logical, public :: use_nofire = .false. -#endif -#if (defined VANCOUVER) - logical, public :: use_vancouver = .true. -#else - logical, public :: use_vancouver = .false. -#endif -#if (defined MEXICOCITY) - logical, public :: use_mexicocity = .true. -#else - logical, public :: use_mexicocity = .false. -#endif -#if (defined AD_SPINUP) - logical, public :: use_ad_spinup = .true. -#else - logical, public :: use_ad_spinup = .false. -#endif -#if (defined EXIT_SPINUP) - logical, public :: use_exit_spinup = .true. -#else - logical, public :: use_exit_spinup = .false. -#endif - !needed for compatibility with changes in clm4_5 and reference dy lnd_comp_mct - !however use_voc is not used anywhere inside the clm4_0 code - logical, public :: use_voc = .true. -! -! !PRIVATE DATA MEMBERS: -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein and Gordon Bonan -! 1 June 2004, Peter Thornton: added fnedpdat for nitrogen deposition data -! -!EOP -!----------------------------------------------------------------------- - logical, private :: clmvarctl_isset = .false. - -!=============================================================== -contains -!=============================================================== - -!--------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: clm_varctl_set -! -! !INTERFACE: - subroutine clm_varctl_set( caseid_in, ctitle_in, brnch_retain_casename_in, & - single_column_in, scmlat_in, scmlon_in, nsrest_in, & - version_in, hostname_in, username_in) -! -! !DESCRIPTION: -! Set input control variables. -! -! !USES: - use shr_sys_mod, only : shr_sys_abort -! -! !ARGUMENTS: - character(len=256), optional, intent(IN) :: caseid_in ! case id - character(len=256), optional, intent(IN) :: ctitle_in ! case title - logical, optional, intent(IN) :: brnch_retain_casename_in ! true => allow case name to remain the same for branch run - logical, optional, intent(IN) :: single_column_in ! true => single column mode - real(r8), optional, intent(IN) :: scmlat_in ! single column lat - real(r8), optional, intent(IN) :: scmlon_in ! single column lon - integer, optional, intent(IN) :: nsrest_in ! 0: initial run. 1: restart: 3: branch - character(len=256), optional, intent(IN) :: version_in ! model version - character(len=256), optional, intent(IN) :: hostname_in ! hostname running on - character(len=256), optional, intent(IN) :: username_in ! username running job - -! -! !LOCAL VARIABLES: - character(len=32) :: subname = 'clm_varctl_set' ! subroutine name -! -! !REVISION HISTORY: -! Author: Erik Kluzek -! -!EOP -!----------------------------------------------------------------------- - if ( clmvarctl_isset )then - call shr_sys_abort( subname//' ERROR:: control variables already set -- can not call this subroutine' ) - end if - if ( present(caseid_in ) ) caseid = caseid_in - if ( present(ctitle_in ) ) ctitle = ctitle_in - if ( present(single_column_in) ) single_column = single_column_in - if ( present(scmlat_in ) ) scmlat = scmlat_in - if ( present(scmlon_in ) ) scmlon = scmlon_in - if ( present(nsrest_in ) ) nsrest = nsrest_in - if ( present(brnch_retain_casename_in) ) brnch_retain_casename = brnch_retain_casename_in - if ( present(version_in ) ) version = version_in - if ( present(username_in ) ) username = username_in - if ( present(hostname_in ) ) hostname = hostname_in - - end subroutine clm_varctl_set - -!--------------------------------------------------------------------------- -!BOP -! -! !IROUTINE: clmvarctl_init -! -! !INTERFACE: - subroutine clmvarctl_init( masterproc, dtime ) -! -! !DESCRIPTION: -! Check that values are correct, and finish setting variables based on other variables. -! -! !USES: - use shr_sys_mod , only : shr_sys_abort - use clm_varpar , only : maxpatch_pft, numpft -! -! !ARGUMENTS: - logical, intent(IN) :: masterproc ! proc 0 logical for printing msgs - integer, intent(IN) :: dtime ! timestep in seconds -! -! !LOCAL VARIABLES: - character(len=32) :: subname = 'clmvarctl_init' ! subroutine name -! -! !REVISION HISTORY: -! Author: Erik Kluzek -! -!EOP -!----------------------------------------------------------------------- - - ! landunit generation - - if (maxpatch_pft == numpft+1) then - allocate_all_vegpfts = .true. - else - allocate_all_vegpfts = .false. - if (use_crop) then - write(iulog,*)'maxpatch_pft = ',maxpatch_pft,& - ' does NOT equal numpft+1 = ',numpft+1 - call shr_sys_abort( subname//' ERROR:: Can NOT turn CROP on without all PFTs' ) - end if - end if - - if (masterproc) then - - ! Consistency settings for co2 type - - if (co2_type /= 'constant' .and. co2_type /= 'prognostic' .and. co2_type /= 'diagnostic') then - write(iulog,*)'co2_type = ',co2_type,' is not supported' - call shr_sys_abort( subname//' ERROR:: choices are constant, prognostic or diagnostic' ) - end if - - ! Consistency settings for dynamic land use, etc. - - if (flanduse_timeseries /= ' ' .and. create_crop_landunit) & - call shr_sys_abort( subname//' ERROR:: dynamic landuse is currently not supported with create_crop_landunit option' ) - if (create_crop_landunit .and. .not.allocate_all_vegpfts) & - call shr_sys_abort( subname//' ERROR:: maxpft 3000.0_r8) ) & - call shr_sys_abort( subname//' ERROR: co2_ppmv is out of a reasonable range' ) - - if (nsrest == nsrStartup ) nrevsn = ' ' - if (nsrest == nsrContinue) nrevsn = 'set by restart pointer file file' - if (nsrest /= nsrStartup .and. nsrest /= nsrContinue .and. nsrest /= nsrBranch ) & - call shr_sys_abort( subname//' ERROR: nsrest NOT set to a valid value' ) - - if ( single_column .and. (scmlat == rundef .or. scmlon == rundef ) ) & - call shr_sys_abort( subname//' ERROR:: single column mode on -- but scmlat and scmlon are NOT set' ) - - endif ! end of if-masterproc if-block - - clmvarctl_isset = .true. - - end subroutine clmvarctl_init - -end module clm_varctl diff --git a/src_clm40/main/clm_varorb.F90 b/src_clm40/main/clm_varorb.F90 deleted file mode 100644 index 47bf51e576..0000000000 --- a/src_clm40/main/clm_varorb.F90 +++ /dev/null @@ -1,17 +0,0 @@ - -module clm_varorb - - use shr_kind_mod , only: r8 => shr_kind_r8 - implicit none - - ! Orbital information needed as input to orbit_parms - - real(r8) :: eccen ! Earth's eccentricity factor (unitless) (typically 0 to 0.1) - - ! Orbital information after processed by orbit_params - - real(r8) :: obliqr ! Earth's obliquity in radians - real(r8) :: lambm0 ! Mean longitude of perihelion at the vernal equinox (radians) - real(r8) :: mvelpp ! Earth's moving vernal equinox longitude of perihelion plus pi (radians) - -end module clm_varorb diff --git a/src_clm40/main/clm_varpar.F90 b/src_clm40/main/clm_varpar.F90 deleted file mode 100644 index 252569e385..0000000000 --- a/src_clm40/main/clm_varpar.F90 +++ /dev/null @@ -1,118 +0,0 @@ -module clm_varpar - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_varpar -! -! !DESCRIPTION: -! Module containing CLM parameters -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! ------------------------------------------------------- -! Module Parameters -! ------------------------------------------------------- - -! Note - model resolution is read in from the surface dataset - - integer, parameter :: nlevsoi = 10 ! number of hydrologically active soil layers - integer, parameter :: nlevgrnd = 15 ! number of ground layers (includes lower layers that are hydrologically inactive) - integer, parameter :: nlevurb = nlevgrnd! number of urban layers (must equal nlevgrnd right now) - integer, parameter :: nlevlak = 10 ! number of lake layers - integer, parameter :: nlevsno = 5 ! maximum number of snow layers - integer, parameter :: numwat = 5 ! number of water types (soil, ice, 2 lakes, wetland) - integer, parameter :: numrad = 2 ! number of solar radiation bands: vis, nir - integer, parameter :: ivis = 1 ! index for visible band - integer, parameter :: inir = 2 ! index for near-infrared band - integer, parameter :: numsolar = 2 ! number of solar type bands: direct, diffuse - integer, parameter :: ndst = 4 ! number of dust size classes (BGC only) - integer, parameter :: dst_src_nbr = 3 ! number of size distns in src soil (BGC only) - integer, parameter :: sz_nbr = 200 ! number of sub-grid bins in large bin of dust size distribution (BGC only) - integer, parameter :: mxpft = 20 ! maximum number of PFT's for any mode - integer, parameter :: numveg = 16 ! number of veg types (without specific crop) -#if (defined CROP) - integer, parameter :: numpft = mxpft ! actual # of pfts (without bare) - integer, parameter :: numcft = 6 ! actual # of crops -#else - integer, parameter :: numpft = numveg ! actual # of pfts (without bare) - integer, parameter :: numcft = 2 ! actual # of crops -#endif - integer, parameter :: maxpatch_pft= MAXPATCH_PFT ! max number of plant functional types in naturally vegetated landunit - -! ------------------------------------------------------- -! Module Varaibles (initialized in clm_varpar_init) -! ------------------------------------------------------- - -! Indices used in surface file read and set in clm_varpar_init - - integer :: maxpatch ! max number of patches - integer :: maxpatch_glcmec ! max number of elevation classes - integer :: maxpatch_urb ! max number of urban pfts (columns) in urban landunit - integer :: npatch_urban ! number of urban pfts (columns) in urban landunit - integer :: npatch_lake ! number of lake pfts (columns) in lake landunit - integer :: npatch_wet ! number of wetland pfts (columns) in wetland landunit - integer :: npatch_glacier ! number of glacier pfts (columns) in glacier landunit - integer :: npatch_glacier_mec ! number of glacier_mec pfts (columns) in glacier_mec landunit - integer :: max_pft_per_gcell - integer :: max_pft_per_lu - integer :: max_pft_per_col - -! !PUBLIC MEMBER FUNCTIONS: - public clm_varpar_init ! set parameters - -! !REVISION HISTORY: -! Created by Mariana Vertenstein - -!EOP -!----------------------------------------------------------------------- -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: clm_varpar_init -! -! !INTERFACE: - subroutine clm_varpar_init() -! -! !DESCRIPTION: -! This subroutine initializes parameters in clm_varpar -! -! !USES: -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by T Craig -! -! !LOCAL VARIABLES: -! -!EOP -!------------------------------------------------------------------------------ - - maxpatch_urb = 5 - npatch_urban = maxpatch_pft + 1 - npatch_lake = npatch_urban + maxpatch_urb - npatch_wet = npatch_lake + 1 - npatch_glacier = npatch_wet + 1 - npatch_glacier_mec = npatch_glacier + maxpatch_glcmec - maxpatch = npatch_glacier_mec - - max_pft_per_gcell = numpft+1 + 3 + maxpatch_urb + maxpatch_glcmec -#if (defined CROP) - max_pft_per_gcell = max_pft_per_gcell + numcft -#endif - max_pft_per_lu = max(numpft+1, numcft, maxpatch_urb) - max_pft_per_col = max(numpft+1, numcft, maxpatch_urb) - - end subroutine clm_varpar_init - -!------------------------------------------------------------------------------ -end module clm_varpar diff --git a/src_clm40/main/clm_varsur.F90 b/src_clm40/main/clm_varsur.F90 deleted file mode 100644 index 3ff2162c14..0000000000 --- a/src_clm40/main/clm_varsur.F90 +++ /dev/null @@ -1,37 +0,0 @@ - -module clm_varsur - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clm_varsur -! -! !DESCRIPTION: -! Module containing 2-d surface boundary data information -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - save -! -! land model grid - moved to domainMod -! -! surface boundary data, these are all "gdc" local -! - integer , allocatable :: vegxy(:,:) ! vegetation type - real(r8), allocatable,target :: wtxy(:,:) ! subgrid weights - - real(r8),allocatable :: pctspec(:) ! percent of spec lunits wrt gcell - - real(r8), allocatable,target :: topoxy(:,:) ! subgrid glacier_mec sfc elevation -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 2005-11-01 Moved grid to domainMod, T Craig -! -!EOP -!----------------------------------------------------------------------- - -end module clm_varsur diff --git a/src_clm40/main/clmtype.F90 b/src_clm40/main/clmtype.F90 deleted file mode 100644 index 0498100222..0000000000 --- a/src_clm40/main/clmtype.F90 +++ /dev/null @@ -1,1991 +0,0 @@ -module clmtype - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clmtype -! -! !DESCRIPTION: -! Define derived type hierarchy. Includes declaration of -! the clm derived type and 1d mapping arrays. -! -! -------------------------------------------------------- -! gridcell types can have values of -! -------------------------------------------------------- -! 1 => default -! -------------------------------------------------------- -! landunits types can have values of (see clm_varcon.F90) -! -------------------------------------------------------- -! 1 => (istsoil) soil (vegetated or bare soil landunit) -! 2 => (istice) land ice -! 3 => (istdlak) deep lake -! 4 => (istslak) shallow lake (not currently implemented) -! 5 => (istwet) wetland -! 6 => (isturb) urban -! 7 => (istice_mec) land ice (multiple elevation classes) -! 8 => (istcrop) crop (only for crop configuration) -! -------------------------------------------------------- -! column types can have values of -! -------------------------------------------------------- -! 1 => (istsoil) soil (vegetated or bare soil) -! 2 => (istice) land ice -! 3 => (istdlak) deep lake -! 4 => (istslak) shallow lake -! 5 => (istwet) wetland -! 7 => (istice_mec) land ice (multiple elevation classes) -! 61 => (icol_roof) urban roof -! 62 => (icol_sunwall) urban sunwall -! 63 => (icol_shadewall) urban shadewall -! 64 => (icol_road_imperv) urban impervious road -! 65 => (icol_road_perv) urban pervious road -! -------------------------------------------------------- -! pft types can have values of -! -------------------------------------------------------- -! 0 => not vegetated -! 1 => needleleaf evergreen temperate tree -! 2 => needleleaf evergreen boreal tree -! 3 => needleleaf deciduous boreal tree -! 4 => broadleaf evergreen tropical tree -! 5 => broadleaf evergreen temperate tree -! 6 => broadleaf deciduous tropical tree -! 7 => broadleaf deciduous temperate tree -! 8 => broadleaf deciduous boreal tree -! 9 => broadleaf evergreen shrub -! 10 => broadleaf deciduous temperate shrub -! 11 => broadleaf deciduous boreal shrub -! 12 => c3 arctic grass -! 13 => c3 non-arctic grass -! 14 => c4 grass -! 15 => c3_crop -! 16 => c3_irrigated -! 17 => corn -! 18 => spring temperate cereal -! 19 => winter temperate cereal -! 20 => soybean -! -------------------------------------------------------- -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use domainMod , only: domain_type -! -! !PUBLIC TYPES: - implicit none - - public -! -! !REVISION HISTORY: -! Created by Peter Thornton and Mariana Vertenstein -! -!******************************************************************************* -!---------------------------------------------------- -! Begin definition of conservation check structures -!---------------------------------------------------- -! energy balance structure -!---------------------------------------------------- -type, public :: energy_balance_type - real(r8), pointer :: errsoi(:) !soil/lake energy conservation error (W/m**2) - real(r8), pointer :: errseb(:) !surface energy conservation error (W/m**2) - real(r8), pointer :: errsol(:) !solar radiation conservation error (W/m**2) - real(r8), pointer :: errlon(:) !longwave radiation conservation error (W/m**2) -end type energy_balance_type - -type(energy_balance_type) :: pebal !energy balance structure -type(energy_balance_type) :: cebal !energy balance structure - -!---------------------------------------------------- -! water balance structure -!---------------------------------------------------- -type, public :: water_balance_type - real(r8), pointer :: begwb(:) !water mass begining of the time step - real(r8), pointer :: endwb(:) !water mass end of the time step - real(r8), pointer :: errh2o(:) !water conservation error (mm H2O) -end type water_balance_type - -type(water_balance_type) :: pwbal !water balance structure -type(water_balance_type) :: cwbal !water balance structure - -!---------------------------------------------------- -! carbon balance structure -!---------------------------------------------------- -type, public :: carbon_balance_type - real(r8), pointer :: begcb(:) !carbon mass, beginning of time step (gC/m**2) - real(r8), pointer :: endcb(:) !carbon mass, end of time step (gC/m**2) - real(r8), pointer :: errcb(:) !carbon balance error for the timestep (gC/m**2) -end type carbon_balance_type - -type(carbon_balance_type) :: pcbal !carbon balance structure -type(carbon_balance_type) :: ccbal !carbon balance structure - -!---------------------------------------------------- -! nitrogen balance structure -!---------------------------------------------------- -type, public :: nitrogen_balance_type - real(r8), pointer :: begnb(:) !nitrogen mass, beginning of time step (gN/m**2) - real(r8), pointer :: endnb(:) !nitrogen mass, end of time step (gN/m**2) - real(r8), pointer :: errnb(:) !nitrogen balance error for the timestep (gN/m**2) -end type nitrogen_balance_type - -type(nitrogen_balance_type) :: pnbal !nitrogen balance structure -type(nitrogen_balance_type) :: cnbal !nitrogen balance structure - -!---------------------------------------------------- -! End definition of conservation check structures -!---------------------------------------------------- -!******************************************************************************* - -!******************************************************************************* -!---------------------------------------------------- -! Begin definition of structures defined at the pft_type level -!---------------------------------------------------- -! pft physical state variables structure -!---------------------------------------------------- -type, public :: pft_pstate_type - integer , pointer :: frac_veg_nosno(:) !fraction of vegetation not covered by snow (0 OR 1) [-] - integer , pointer :: frac_veg_nosno_alb(:) !fraction of vegetation not covered by snow (0 OR 1) [-] - real(r8), pointer :: emv(:) !vegetation emissivity - real(r8), pointer :: z0mv(:) !roughness length over vegetation, momentum [m] - real(r8), pointer :: z0hv(:) !roughness length over vegetation, sensible heat [m] - real(r8), pointer :: z0qv(:) !roughness length over vegetation, latent heat [m] - real(r8), pointer :: rootfr(:,:) !fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootr(:,:) !effective fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rresis(:,:) !root resistance by layer (0-1) (nlevgrnd) - real(r8), pointer :: dewmx(:) !Maximum allowed dew [mm] - real(r8), pointer :: rssun(:) !sunlit stomatal resistance (s/m) - real(r8), pointer :: rssha(:) !shaded stomatal resistance (s/m) - real(r8), pointer :: laisun(:) !sunlit projected leaf area index - real(r8), pointer :: laisha(:) !shaded projected leaf area index - real(r8), pointer :: btran(:) !transpiration wetness factor (0 to 1) - real(r8), pointer :: fsun(:) !sunlit fraction of canopy - real(r8), pointer :: tlai(:) !one-sided leaf area index, no burying by snow - real(r8), pointer :: tsai(:) !one-sided stem area index, no burying by snow - real(r8), pointer :: elai(:) !one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) !one-sided stem area index with burying by snow - real(r8), pointer :: fwet(:) !fraction of canopy that is wet (0 to 1) - real(r8), pointer :: fdry(:) !fraction of foliage that is green and dry [-] (new) - real(r8), pointer :: dt_veg(:) !change in t_veg, last iteration (Kelvin) - real(r8), pointer :: htop(:) !canopy top (m) - real(r8), pointer :: hbot(:) !canopy bottom (m) - real(r8), pointer :: z0m(:) !momentum roughness length (m) - real(r8), pointer :: displa(:) !displacement height (m) - real(r8), pointer :: albd(:,:) !surface albedo (direct) (numrad) - real(r8), pointer :: albi(:,:) !surface albedo (indirect) (numrad) - real(r8), pointer :: fabd(:,:) !flux absorbed by veg per unit direct flux (numrad) - real(r8), pointer :: fabi(:,:) !flux absorbed by veg per unit diffuse flux (numrad) - real(r8), pointer :: ftdd(:,:) !down direct flux below veg per unit dir flx (numrad) - real(r8), pointer :: ftid(:,:) !down diffuse flux below veg per unit dir flx (numrad) - real(r8), pointer :: ftii(:,:) !down diffuse flux below veg per unit dif flx (numrad) - real(r8), pointer :: u10(:) !10-m wind (m/s) (for dust model) - real(r8), pointer :: u10_clm(:) !10-m wind (m/s) - real(r8), pointer :: va(:) !atmospheric wind speed plus convective velocity (m/s) - real(r8), pointer :: ram1(:) !aerodynamical resistance (s/m) - real(r8), pointer :: fv(:) !friction velocity (m/s) (for dust model) - real(r8), pointer :: forc_hgt_u_pft(:) !wind forcing height (10m+z0m+d) (m) - real(r8), pointer :: forc_hgt_t_pft(:) !temperature forcing height (10m+z0m+d) (m) - real(r8), pointer :: forc_hgt_q_pft(:) !specific humidity forcing height (10m+z0m+d) (m) - ! Variables for prognostic crop model - real(r8), pointer :: hdidx(:) ! cold hardening index? - real(r8), pointer :: cumvd(:) ! cumulative vernalization d?ependence? - real(r8), pointer :: htmx(:) ! max hgt attained by a crop during yr (m) - real(r8), pointer :: vf(:) ! vernalization factor for cereal - real(r8), pointer :: gddmaturity(:) ! growing degree days (gdd) needed to harvest (ddays) - real(r8), pointer :: gdd0(:) ! growing degree-days base 0C from planting (ddays) - real(r8), pointer :: gdd8(:) ! growing degree-days base 8C from planting (ddays) - real(r8), pointer :: gdd10(:) ! growing degree-days base 10C from planting (ddays) - real(r8), pointer :: gdd020(:) ! 20-year average of gdd0 (ddays) - real(r8), pointer :: gdd820(:) ! 20-year average of gdd8 (ddays) - real(r8), pointer :: gdd1020(:) ! 20-year average of gdd10 (ddays) - real(r8), pointer :: gddplant(:) ! accum gdd past planting date for crop (ddays) - real(r8), pointer :: gddtsoi(:) ! growing degree-days from planting (top two soil layers) (ddays) - real(r8), pointer :: huileaf(:) ! heat unit index needed from planting to leaf emergence - real(r8), pointer :: huigrain(:) ! heat unit index needed to reach vegetative maturity - real(r8), pointer :: aleafi(:) ! saved leaf allocation coefficient from phase 2 - real(r8), pointer :: astemi(:) ! saved stem allocation coefficient from phase 2 - real(r8), pointer :: aleaf(:) ! leaf allocation coefficient - real(r8), pointer :: astem(:) ! stem allocation coefficient - logical , pointer :: croplive(:) ! Flag, true if planted, not harvested - logical , pointer :: cropplant(:) ! Flag, true if planted - integer , pointer :: harvdate(:) ! harvest date - ! cropplant and harvdate could be 2D to facilitate rotation - integer , pointer :: idop(:) ! date of planting - integer , pointer :: peaklai(:) ! 1: max allowed lai; 0: not at max - real(r8), pointer :: vds(:) !deposition velocity term (m/s) (for dry dep SO4, NH4NO3) - ! new variables for CN code - real(r8), pointer :: slasun(:) !specific leaf area for sunlit canopy, projected area basis (m^2/gC) - real(r8), pointer :: slasha(:) !specific leaf area for shaded canopy, projected area basis (m^2/gC) - real(r8), pointer :: lncsun(:) !leaf N concentration per unit projected LAI (gN leaf/m^2) - real(r8), pointer :: lncsha(:) !leaf N concentration per unit projected LAI (gN leaf/m^2) - real(r8), pointer :: vcmxsun(:) !sunlit leaf Vcmax (umolCO2/m^2/s) - real(r8), pointer :: vcmxsha(:) !shaded leaf Vcmax (umolCO2/m^2/s) - real(r8), pointer :: gdir(:) !leaf projection in solar direction (0 to 1) - real(r8), pointer :: omega(:,:) !fraction of intercepted radiation that is scattered (0 to 1) - real(r8), pointer :: eff_kid(:,:) !effective extinction coefficient for indirect from direct - real(r8), pointer :: eff_kii(:,:) !effective extinction coefficient for indirect from indirect - real(r8), pointer :: sun_faid(:,:) !fraction sun canopy absorbed indirect from direct - real(r8), pointer :: sun_faii(:,:) !fraction sun canopy absorbed indirect from indirect - real(r8), pointer :: sha_faid(:,:) !fraction shade canopy absorbed indirect from direct - real(r8), pointer :: sha_faii(:,:) !fraction shade canopy absorbed indirect from indirect - real(r8), pointer :: cisun(:) !sunlit intracellular CO2 (Pa) - real(r8), pointer :: cisha(:) !shaded intracellular CO2 (Pa) - real(r8), pointer :: alphapsnsun(:) !sunlit 13c fractionation ([]) - real(r8), pointer :: alphapsnsha(:) !shaded 13c fractionation ([]) - real(r8), pointer :: sandfrac(:) ! sand fraction - real(r8), pointer :: clayfrac(:) ! clay fraction - ! for dry deposition of chemical tracers - real(r8), pointer :: mlaidiff(:) ! difference between lai month one and month two - real(r8), pointer :: rb1(:) ! aerodynamical resistance (s/m) - real(r8), pointer :: annlai(:,:) ! 12 months of monthly lai from input data set -end type pft_pstate_type - -type(pft_pstate_type) :: pps !physical state variables -type(pft_pstate_type) :: pps_a !pft-level pstate variables averaged to the column - -!---------------------------------------------------- -! pft ecophysiological constants structure -!---------------------------------------------------- -type, public :: pft_epc_type - integer , pointer :: noveg(:) !value for not vegetated - integer , pointer :: tree(:) !tree or not? - real(r8), pointer :: smpso(:) !soil water potential at full stomatal opening (mm) - real(r8), pointer :: smpsc(:) !soil water potential at full stomatal closure (mm) - real(r8), pointer :: fnitr(:) !foliage nitrogen limitation factor (-) - real(r8), pointer :: foln(:) !foliage nitrogen (%) - real(r8), pointer :: dleaf(:) !characteristic leaf dimension (m) - real(r8), pointer :: c3psn(:) !photosynthetic pathway: 0. = c4, 1. = c3 - real(r8), pointer :: mp(:) !slope of conductance-to-photosynthesis relationship - real(r8), pointer :: qe25(:) !quantum efficiency at 25C (umol CO2 / umol photon) - real(r8), pointer :: xl(:) !leaf/stem orientation index - real(r8), pointer :: rhol(:,:) !leaf reflectance: 1=vis, 2=nir (numrad) - real(r8), pointer :: rhos(:,:) !stem reflectance: 1=vis, 2=nir (numrad) - real(r8), pointer :: taul(:,:) !leaf transmittance: 1=vis, 2=nir (numrad) - real(r8), pointer :: taus(:,:) !stem transmittance: 1=vis, 2=nir (numrad) - real(r8), pointer :: z0mr(:) !ratio of momentum roughness length to canopy top height (-) - real(r8), pointer :: displar(:) !ratio of displacement height to canopy top height (-) - real(r8), pointer :: roota_par(:) !CLM rooting distribution parameter [1/m] - real(r8), pointer :: rootb_par(:) !CLM rooting distribution parameter [1/m] - real(r8), pointer :: sla(:) !specific leaf area [m2 leaf g-1 carbon] - ! new variables for CN code - real(r8), pointer :: dwood(:) !wood density (gC/m3) - real(r8), pointer :: slatop(:) !specific leaf area at top of canopy, projected area basis [m^2/gC] - real(r8), pointer :: dsladlai(:) !dSLA/dLAI, projected area basis [m^2/gC] - real(r8), pointer :: leafcn(:) !leaf C:N (gC/gN) - real(r8), pointer :: flnr(:) !fraction of leaf N in the Rubisco enzyme (gN Rubisco / gN leaf) - real(r8), pointer :: woody(:) !binary flag for woody lifeform (1=woody, 0=not woody) - real(r8), pointer :: lflitcn(:) !leaf litter C:N (gC/gN) - real(r8), pointer :: frootcn(:) !fine root C:N (gC/gN) - real(r8), pointer :: livewdcn(:) !live wood (phloem and ray parenchyma) C:N (gC/gN) - real(r8), pointer :: deadwdcn(:) !dead wood (xylem and heartwood) C:N (gC/gN) - real(r8), pointer :: graincn(:) !grain C:N (gC/gN) for prognostic crop model - real(r8), pointer :: froot_leaf(:) !allocation parameter: new fine root C per new leaf C (gC/gC) - real(r8), pointer :: stem_leaf(:) !allocation parameter: new stem c per new leaf C (gC/gC) - real(r8), pointer :: croot_stem(:) !allocation parameter: new coarse root C per new stem C (gC/gC) - real(r8), pointer :: flivewd(:) !allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - real(r8), pointer :: fcur(:) !allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - real(r8), pointer :: lf_flab(:) !leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) !leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) !leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) !fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) !fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) !fine root litter lignin fraction - real(r8), pointer :: leaf_long(:) !leaf longevity (yrs) - real(r8), pointer :: evergreen(:) !binary flag for evergreen leaf habit (0 or 1) - real(r8), pointer :: stress_decid(:) !binary flag for stress-deciduous leaf habit (0 or 1) - real(r8), pointer :: season_decid(:) !binary flag for seasonal-deciduous leaf habit (0 or 1) - ! new variables for fire code - real(r8), pointer :: resist(:) !resistance to fire (no units) -end type pft_epc_type - -type(pft_epc_type), public, target, save :: pftcon - -!---------------------------------------------------- -! pft DGVM-specific ecophysiological constants structure -!---------------------------------------------------- -type, public :: pft_dgvepc_type - real(r8), pointer :: crownarea_max(:) !tree maximum crown area [m2] - real(r8), pointer :: tcmin(:) !minimum coldest monthly mean temperature [units?] - real(r8), pointer :: tcmax(:) !maximum coldest monthly mean temperature [units?] - real(r8), pointer :: gddmin(:) !minimum growing degree days (at or above 5 C) - real(r8), pointer :: twmax(:) !upper limit of temperature of the warmest month [units?] - real(r8), pointer :: reinickerp(:) !parameter in allometric equation - real(r8), pointer :: allom1(:) !parameter in allometric - real(r8), pointer :: allom2(:) !parameter in allometric - real(r8), pointer :: allom3(:) !parameter in allometric -end type pft_dgvepc_type - -type(pft_dgvepc_type), public, target, save :: dgv_pftcon - -!---------------------------------------------------- -! pft ecophysiological variables structure -!---------------------------------------------------- -type, public :: pft_epv_type - real(r8), pointer :: dormant_flag(:) !dormancy flag - real(r8), pointer :: days_active(:) !number of days since last dormancy - real(r8), pointer :: onset_flag(:) !onset flag - real(r8), pointer :: onset_counter(:) !onset days counter - real(r8), pointer :: onset_gddflag(:) !onset flag for growing degree day sum - real(r8), pointer :: onset_fdd(:) !onset freezing degree days counter - real(r8), pointer :: onset_gdd(:) !onset growing degree days - real(r8), pointer :: onset_swi(:) !onset soil water index - real(r8), pointer :: offset_flag(:) !offset flag - real(r8), pointer :: offset_counter(:) !offset days counter - real(r8), pointer :: offset_fdd(:) !offset freezing degree days counter - real(r8), pointer :: offset_swi(:) !offset soil water index - real(r8), pointer :: lgsf(:) !long growing season factor [0-1] - real(r8), pointer :: bglfr(:) !background litterfall rate (1/s) - real(r8), pointer :: bgtr(:) !background transfer growth rate (1/s) - real(r8), pointer :: dayl(:) !daylength (seconds) - real(r8), pointer :: prev_dayl(:) !daylength from previous timestep (seconds) - real(r8), pointer :: annavg_t2m(:) !annual average 2m air temperature (K) - real(r8), pointer :: tempavg_t2m(:) !temporary average 2m air temperature (K) - real(r8), pointer :: gpp(:) !GPP flux before downregulation (gC/m2/s) - real(r8), pointer :: availc(:) !C flux available for allocation (gC/m2/s) - real(r8), pointer :: xsmrpool_recover(:) !C flux assigned to recovery of negative cpool (gC/m2/s) - real(r8), pointer :: xsmrpool_c13ratio(:) !C13/C(12+13) ratio for xsmrpool (proportion) - real(r8), pointer :: alloc_pnow(:) !fraction of current allocation to display as new growth (DIM) - real(r8), pointer :: c_allometry(:) !C allocation index (DIM) - real(r8), pointer :: n_allometry(:) !N allocation index (DIM) - real(r8), pointer :: plant_ndemand(:) !N flux required to support initial GPP (gN/m2/s) - real(r8), pointer :: tempsum_potential_gpp(:)!temporary annual sum of potential GPP - real(r8), pointer :: annsum_potential_gpp(:) !annual sum of potential GPP - real(r8), pointer :: tempmax_retransn(:) !temporary annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: annmax_retransn(:) !annual max of retranslocated N pool (gN/m2) - real(r8), pointer :: avail_retransn(:) !N flux available from retranslocation pool (gN/m2/s) - real(r8), pointer :: plant_nalloc(:) !total allocated N flux (gN/m2/s) - real(r8), pointer :: plant_calloc(:) !total allocated C flux (gC/m2/s) - real(r8), pointer :: excess_cflux(:) !C flux not allocated due to downregulation (gC/m2/s) - real(r8), pointer :: downreg(:) !fractional reduction in GPP due to N limitation (DIM) - real(r8), pointer :: prev_leafc_to_litter(:) !previous timestep leaf C litterfall flux (gC/m2/s) - real(r8), pointer :: prev_frootc_to_litter(:)!previous timestep froot C litterfall flux (gC/m2/s) - real(r8), pointer :: tempsum_npp(:) !temporary annual sum of NPP (gC/m2/yr) - real(r8), pointer :: annsum_npp(:) !annual sum of NPP (gC/m2/yr) - real(r8), pointer :: tempsum_litfall(:) !temporary annual sum of litfall (gC/m2/yr) - real(r8), pointer :: annsum_litfall(:) !annual sum of litfall (gC/m2/yr) - real(r8), pointer :: rc13_canair(:) !C13O2/C12O2 in canopy air - real(r8), pointer :: rc13_psnsun(:) !C13O2/C12O2 in sunlit canopy psn flux - real(r8), pointer :: rc13_psnsha(:) !C13O2/C12O2 in shaded canopy psn flux -end type pft_epv_type - -type(pft_epv_type) :: pepv !pft ecophysiological variables - -!---------------------------------------------------- -! pft energy state variables structure -!---------------------------------------------------- -type, public :: pft_estate_type - real(r8), pointer :: t_ref2m(:) !2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_min(:) !daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max(:) !daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_inst(:) !instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst(:) !instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: q_ref2m(:) !2 m height surface specific humidity (kg/kg) - real(r8), pointer :: t_ref2m_u(:) !Urban 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_r(:) !Rural 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_min_u(:) !Urban daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_r(:) !Rural daily minimum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_u(:) !Urban daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_max_r(:) !Rural daily maximum of average 2 m height surface air temperature (K) - real(r8), pointer :: t_ref2m_min_inst_u(:) !Urban instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_min_inst_r(:) !Rural instantaneous daily min of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_u(:) !Urban instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: t_ref2m_max_inst_r(:) !Rural instantaneous daily max of average 2 m height surface air temp (K) - real(r8), pointer :: a10tmin(:) ! 10-day running mean of min 2-m temperature - real(r8), pointer :: a5tmin(:) ! 5-day running mean of min 2-m temperature - real(r8), pointer :: t10(:) !10-day running mean of the 2 m temperature (K) - real(r8), pointer :: rh_ref2m(:) !2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m_u(:) !Urban 2 m height surface relative humidity (%) - real(r8), pointer :: rh_ref2m_r(:) !Rural 2 m height surface relative humidity (%) - real(r8), pointer :: t_veg(:) !vegetation temperature (Kelvin) - real(r8), pointer :: thm(:) !intermediate variable (forc_t+0.0098*forc_hgt_t_pft) -end type pft_estate_type - -type(pft_estate_type) :: pes !pft energy state - -!---------------------------------------------------- -! pft water state variables structure -!---------------------------------------------------- -type, public :: pft_wstate_type - real(r8), pointer :: h2ocan(:) !canopy water (mm H2O) -end type pft_wstate_type - -type(pft_wstate_type) :: pws !pft water state - -!---------------------------------------------------- -! pft carbon state variables structure -!---------------------------------------------------- -type, public :: pft_cstate_type - real(r8), pointer :: leafcmax(:) ! (gC/m2) ann max leaf C - ! variables for prognostic crop model - real(r8), pointer :: grainc(:) ! (gC/m2) grain C - real(r8), pointer :: grainc_storage(:) ! (gC/m2) grain C storage - real(r8), pointer :: grainc_xfer(:) ! (gC/m2) grain C transfer - ! - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: cpool(:) ! (gC/m2) temporary photosynthate C pool - real(r8), pointer :: xsmrpool(:) ! (gC/m2) abstract C pool to meet excess MR demand - real(r8), pointer :: pft_ctrunc(:) ! (gC/m2) pft-level sink for C truncation - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: dispvegc(:) ! (gC/m2) displayed veg carbon, excluding storage and cpool - real(r8), pointer :: storvegc(:) ! (gC/m2) stored vegetation carbon, excluding cpool - real(r8), pointer :: totvegc(:) ! (gC/m2) total vegetation carbon, excluding cpool - real(r8), pointer :: totpftc(:) ! (gC/m2) total pft-level carbon, including cpool - real(r8), pointer :: woodc(:) ! (gC/m2) wood C -end type pft_cstate_type - -type(pft_cstate_type) :: pcs !pft carbon state -type(pft_cstate_type) :: pcs_a !pft-level carbon state averaged to the column -type(pft_cstate_type) :: pc13s !pft carbon-13 state -type(pft_cstate_type) :: pc13s_a !pft carbon-13 state averaged to the column - -!---------------------------------------------------- -! pft nitrogen state variables structure -!---------------------------------------------------- -type, public :: pft_nstate_type - ! variables for prognostic crop model - real(r8), pointer :: grainn(:) ! (gN/m2) grain N - real(r8), pointer :: grainn_storage(:) ! (gN/m2) grain N storage - real(r8), pointer :: grainn_xfer(:) ! (gN/m2) grain N transfer - ! - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: npool(:) ! (gN/m2) temporary plant N pool - real(r8), pointer :: pft_ntrunc(:) ! (gN/m2) pft-level sink for N truncation - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: dispvegn(:) ! (gN/m2) displayed veg nitrogen, excluding storage - real(r8), pointer :: storvegn(:) ! (gN/m2) stored vegetation nitrogen - real(r8), pointer :: totvegn(:) ! (gN/m2) total vegetation nitrogen - real(r8), pointer :: totpftn(:) ! (gN/m2) total pft-level nitrogen -end type pft_nstate_type - -type(pft_nstate_type) :: pns !pft nitrogen state - -!---------------------------------------------------- -! pft VOC state variables structure -!---------------------------------------------------- -type, public :: pft_vstate_type - real(r8), pointer :: t_veg24(:) ! 24hr average vegetation temperature (K) - real(r8), pointer :: t_veg240(:) ! 240hr average vegetation temperature (Kelvin) - real(r8), pointer :: fsd24(:) ! 24hr average of direct beam radiation - real(r8), pointer :: fsd240(:) ! 240hr average of direct beam radiation - real(r8), pointer :: fsi24(:) ! 24hr average of diffuse beam radiation - real(r8), pointer :: fsi240(:) ! 240hr average of diffuse beam radiation - real(r8), pointer :: fsun24(:) ! 24hr average of sunlit fraction of canopy - real(r8), pointer :: fsun240(:) ! 240hr average of sunlit fraction of canopy - real(r8), pointer :: elai_p(:) ! leaf area index average over timestep -end type pft_vstate_type - -type(pft_vstate_type) :: pvs !pft VOC state - -!---------------------------------------------------- -! pft DGVM state variables structure -!---------------------------------------------------- -type, public :: pft_dgvstate_type - real(r8), pointer :: agddtw(:) !accumulated growing degree days above twmax - real(r8), pointer :: agdd(:) !accumulated growing degree days above 5 - real(r8), pointer :: t_mo(:) !30-day average temperature (Kelvin) - real(r8), pointer :: t_mo_min(:) !annual min of t_mo (Kelvin) - real(r8), pointer :: prec365(:) !365-day running mean of tot. precipitation - logical , pointer :: present(:) !whether PFT present in patch - logical , pointer :: pftmayexist(:) !if .false. then exclude seasonal decid pfts from tropics - real(r8), pointer :: nind(:) !number of individuals (#/m**2) - real(r8), pointer :: lm_ind(:) !individual leaf mass - real(r8), pointer :: lai_ind(:) !LAI per individual - real(r8), pointer :: fpcinc(:) !foliar projective cover increment (fraction) - real(r8), pointer :: fpcgrid(:) !foliar projective cover on gridcell (fraction) - real(r8), pointer :: fpcgridold(:) !last yr's fpcgrid - real(r8), pointer :: crownarea(:) !area that each individual tree takes up (m^2) - real(r8), pointer :: greffic(:) - real(r8), pointer :: heatstress(:) -end type pft_dgvstate_type - -type(pft_dgvstate_type) :: pdgvs !pft DGVM state variables - -!---------------------------------------------------- -! pft energy flux variables structure -!---------------------------------------------------- -type, public :: pft_eflux_type - real(r8), pointer :: sabg(:) !solar radiation absorbed by ground (W/m**2) - real(r8), pointer :: sabv(:) !solar radiation absorbed by vegetation (W/m**2) - real(r8), pointer :: fsa(:) !solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_u(:) !urban solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsa_r(:) !rural solar radiation absorbed (total) (W/m**2) - real(r8), pointer :: fsr(:) !solar radiation reflected (W/m**2) - real(r8), pointer :: parsun(:) !average absorbed PAR for sunlit leaves (W/m**2) - real(r8), pointer :: parsha(:) !average absorbed PAR for shaded leaves (W/m**2) - real(r8), pointer :: dlrad(:) !downward longwave radiation below the canopy [W/m2] - real(r8), pointer :: ulrad(:) !upward longwave radiation above the canopy [W/m2] - real(r8), pointer :: eflx_lh_tot(:) !total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_u(:) !urban total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_tot_r(:) !rural total latent heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_grnd(:) !ground evaporation heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_soil_grnd(:) !soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_u(:) !urban soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_soil_grnd_r(:) !rural soil heat flux (W/m**2) [+ = into soil] - real(r8), pointer :: eflx_sh_tot(:) !total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_u(:) !urban total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_tot_r(:) !rural total sensible heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_grnd(:) !sensible heat flux from ground (W/m**2) [+ to atm] - real(r8), pointer :: eflx_sh_veg(:) !sensible heat flux from leaves (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vege(:) !veg evaporation heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_lh_vegt(:) !veg transpiration heat flux (W/m**2) [+ to atm] - real(r8), pointer :: eflx_wasteheat_pft(:) !sensible heat flux from domestic heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac_pft(:) !sensible heat flux put back into canyon due to removal by AC (W/m**2) - real(r8), pointer :: eflx_traffic_pft(:) !traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_anthro(:) !total anthropogenic heat flux (W/m**2) - real(r8), pointer :: cgrnd(:) !deriv. of soil energy flux wrt to soil temp [w/m2/k] - real(r8), pointer :: cgrndl(:) !deriv. of soil latent heat flux wrt soil temp [w/m**2/k] - real(r8), pointer :: cgrnds(:) !deriv. of soil sensible heat flux wrt soil temp [w/m2/k] - real(r8), pointer :: eflx_gnet(:) !net heat flux into ground (W/m**2) - real(r8), pointer :: dgnetdT(:) !derivative of net ground heat flux wrt soil temp (W/m**2 K) - real(r8), pointer :: eflx_lwrad_out(:) !emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: eflx_lwrad_net(:) !net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_u(:) !urban net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: eflx_lwrad_net_r(:) !rural net infrared (longwave) rad (W/m**2) [+ = to atm] - real(r8), pointer :: netrad(:) !net radiation (W/m**2) [+ = to sfc] - real(r8), pointer :: fsds_vis_d(:) !incident direct beam vis solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_d(:) !incident direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsds_vis_i(:) !incident diffuse vis solar radiation (W/m**2) - real(r8), pointer :: fsds_nir_i(:) !incident diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsr_vis_d(:) !reflected direct beam vis solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_d(:) !reflected direct beam nir solar radiation (W/m**2) - real(r8), pointer :: fsr_vis_i(:) !reflected diffuse vis solar radiation (W/m**2) - real(r8), pointer :: fsr_nir_i(:) !reflected diffuse nir solar radiation (W/m**2) - real(r8), pointer :: fsds_vis_d_ln(:) !incident direct beam vis solar radiation at local noon (W/m**2) - real(r8), pointer :: fsds_nir_d_ln(:) !incident direct beam nir solar radiation at local noon (W/m**2) - real(r8), pointer :: fsr_vis_d_ln(:) !reflected direct beam vis solar radiation at local noon (W/m**2) - real(r8), pointer :: fsr_nir_d_ln(:) !reflected direct beam nir solar radiation at local noon (W/m**2) - real(r8), pointer :: sun_add(:,:) !sun canopy absorbed direct from direct (W/m**2) - real(r8), pointer :: tot_aid(:,:) !total canopy absorbed indirect from direct (W/m**2) - real(r8), pointer :: sun_aid(:,:) !sun canopy absorbed indirect from direct (W/m**2) - real(r8), pointer :: sun_aii(:,:) !sun canopy absorbed indirect from indirect (W/m**2) - real(r8), pointer :: sha_aid(:,:) !shade canopy absorbed indirect from direct (W/m**2) - real(r8), pointer :: sha_aii(:,:) !shade canopy absorbed indirect from indirect (W/m**2) - real(r8), pointer :: sun_atot(:,:) !sun canopy total absorbed (W/m**2) - real(r8), pointer :: sha_atot(:,:) !shade canopy total absorbed (W/m**2) - real(r8), pointer :: sun_alf(:,:) !sun canopy total absorbed by leaves (W/m**2) - real(r8), pointer :: sha_alf(:,:) !shade canopy total absored by leaves (W/m**2) - real(r8), pointer :: sun_aperlai(:,:) !sun canopy total absorbed per unit LAI (W/m**2) - real(r8), pointer :: sha_aperlai(:,:) !shade canopy total absorbed per unit LAI (W/m**2) - real(r8), pointer :: sabg_lyr(:,:) ! absorbed radiation in each snow layer and top soil layer (pft,lyr) [W/m2] - real(r8), pointer :: sfc_frc_aer(:) ! surface forcing of snow with all aerosols (pft) [W/m2] - real(r8), pointer :: sfc_frc_bc(:) ! surface forcing of snow with BC (pft) [W/m2] - real(r8), pointer :: sfc_frc_oc(:) ! surface forcing of snow with OC (pft) [W/m2] - real(r8), pointer :: sfc_frc_dst(:) ! surface forcing of snow with dust (pft) [W/m2] - real(r8), pointer :: sfc_frc_aer_sno(:)! surface forcing of snow with all aerosols, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: sfc_frc_bc_sno(:) ! surface forcing of snow with BC, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: sfc_frc_oc_sno(:) ! surface forcing of snow with OC, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: sfc_frc_dst_sno(:)! surface forcing of snow with dust, averaged only when snow is present (pft) [W/m2] - real(r8), pointer :: fsr_sno_vd(:) ! reflected direct beam vis solar radiation from snow (W/m**2) - real(r8), pointer :: fsr_sno_nd(:) ! reflected direct beam NIR solar radiation from snow (W/m**2) - real(r8), pointer :: fsr_sno_vi(:) ! reflected diffuse vis solar radiation from snow (W/m**2) - real(r8), pointer :: fsr_sno_ni(:) ! reflected diffuse NIR solar radiation from snow (W/m**2) - real(r8), pointer :: fsds_sno_vd(:) ! incident visible, direct radiation on snow (for history files) [W/m2] - real(r8), pointer :: fsds_sno_nd(:) ! incident near-IR, direct radiation on snow (for history files) [W/m2] - real(r8), pointer :: fsds_sno_vi(:) ! incident visible, diffuse radiation on snow (for history files) [W/m2] - real(r8), pointer :: fsds_sno_ni(:) ! incident near-IR, diffuse radiation on snow (for history files) [W/m2] -end type pft_eflux_type - -type(pft_eflux_type) :: pef !pft energy flux - -!---------------------------------------------------- -! pft momentum flux variables structure -!---------------------------------------------------- -type, public :: pft_mflux_type - real(r8),pointer :: taux(:) !wind (shear) stress: e-w (kg/m/s**2) - real(r8),pointer :: tauy(:) !wind (shear) stress: n-s (kg/m/s**2) -end type pft_mflux_type - -type(pft_mflux_type) :: pmf !pft momentum flux - -!---------------------------------------------------- -! pft water flux variables structure -!---------------------------------------------------- -type, public :: pft_wflux_type - real(r8), pointer :: qflx_prec_intr(:) !interception of precipitation [mm/s] - real(r8), pointer :: qflx_prec_grnd(:) !water onto ground including canopy runoff [kg/(m2 s)] - real(r8), pointer :: qflx_rain_grnd(:) !rain on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snow_grnd(:) !snow on ground after interception (mm H2O/s) [+] - real(r8), pointer :: qflx_snwcp_ice(:) !excess snowfall due to snow capping (mm H2O /s) [+] - real(r8), pointer :: qflx_snwcp_liq(:) !excess rainfall due to snow capping (mm H2O /s) [+] - real(r8), pointer :: qflx_evap_veg(:) !vegetation evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_tran_veg(:) !vegetation transpiration (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_can(:) !evaporation from leaves and stems - real(r8), pointer :: qflx_evap_soi(:) !soil evaporation (mm H2O/s) (+ = to atm) - real(r8), pointer :: qflx_evap_tot(:) !qflx_evap_soi + qflx_evap_can + qflx_tran_veg - real(r8), pointer :: qflx_evap_grnd(:) !ground surface evaporation rate (mm H2O/s) [+] - real(r8), pointer :: qflx_dew_grnd(:) !ground surface dew formation (mm H2O /s) [+] - real(r8), pointer :: qflx_sub_snow(:) !sublimation rate from snow pack (mm H2O /s) [+] - real(r8), pointer :: qflx_dew_snow(:) !surface dew added to snow pack (mm H2O /s) [+] -end type pft_wflux_type - -type(pft_wflux_type) :: pwf !pft water flux - -!---------------------------------------------------- -! pft carbon flux variables structure -!---------------------------------------------------- -type, public :: pft_cflux_type - real(r8), pointer :: psnsun(:) !sunlit leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: psnsha(:) !shaded leaf photosynthesis (umol CO2 /m**2/ s) - real(r8), pointer :: fpsn(:) !photosynthesis (umol CO2 /m**2 /s) - real(r8), pointer :: fco2(:) !net CO2 flux (umol CO2 /m**2 /s) [+ = to atm] - ! new variables for CN code - ! gap mortality fluxes - real(r8), pointer :: m_leafc_to_litter(:) ! leaf C mortality (gC/m2/s) - real(r8), pointer :: m_leafc_storage_to_litter(:) ! leaf C storage mortality (gC/m2/s) - real(r8), pointer :: m_leafc_xfer_to_litter(:) ! leaf C transfer mortality (gC/m2/s) - real(r8), pointer :: m_frootc_to_litter(:) ! fine root C mortality (gC/m2/s) - real(r8), pointer :: m_frootc_storage_to_litter(:) ! fine root C storage mortality (gC/m2/s) - real(r8), pointer :: m_frootc_xfer_to_litter(:) ! fine root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_to_litter(:) ! live stem C mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_storage_to_litter(:) ! live stem C storage mortality (gC/m2/s) - real(r8), pointer :: m_livestemc_xfer_to_litter(:) ! live stem C transfer mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_to_litter(:) ! dead stem C mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_storage_to_litter(:) ! dead stem C storage mortality (gC/m2/s) - real(r8), pointer :: m_deadstemc_xfer_to_litter(:) ! dead stem C transfer mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_to_litter(:) ! live coarse root C mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_storage_to_litter(:) ! live coarse root C storage mortality (gC/m2/s) - real(r8), pointer :: m_livecrootc_xfer_to_litter(:) ! live coarse root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_litter(:) ! dead coarse root C mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_storage_to_litter(:) ! dead coarse root C storage mortality (gC/m2/s) - real(r8), pointer :: m_deadcrootc_xfer_to_litter(:) ! dead coarse root C transfer mortality (gC/m2/s) - real(r8), pointer :: m_gresp_storage_to_litter(:) ! growth respiration storage mortality (gC/m2/s) - real(r8), pointer :: m_gresp_xfer_to_litter(:) ! growth respiration transfer mortality (gC/m2/s) - ! harvest mortality fluxes - real(r8), pointer :: hrv_leafc_to_litter(:) ! leaf C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) ! leaf C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) ! leaf C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_to_litter(:) ! fine root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) ! fine root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) ! fine root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_to_litter(:) ! live stem C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) ! live stem C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) ! live stem C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) ! dead stem C harvest to 10-year product pool (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) ! dead stem C harvest to 100-year product pool (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) ! dead stem C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) ! dead stem C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_to_litter(:) ! live coarse root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) ! live coarse root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) ! live coarse root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) ! dead coarse root C harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) ! dead coarse root C storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) ! dead coarse root C transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) ! growth respiration storage harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) ! growth respiration transfer harvest mortality (gC/m2/s) - real(r8), pointer :: hrv_xsmrpool_to_atm(:) ! excess MR pool harvest mortality (gC/m2/s) - ! PFT-level fire fluxes - real(r8), pointer :: m_leafc_to_fire(:) ! leaf C fire loss (gC/m2/s) - real(r8), pointer :: m_leafc_storage_to_fire(:) ! leaf C storage fire loss (gC/m2/s) - real(r8), pointer :: m_leafc_xfer_to_fire(:) ! leaf C transfer fire loss (gC/m2/s) - real(r8), pointer :: m_frootc_to_fire(:) ! fine root C fire loss (gC/m2/s) - real(r8), pointer :: m_frootc_storage_to_fire(:) ! fine root C storage fire loss (gC/m2/s) - real(r8), pointer :: m_frootc_xfer_to_fire(:) ! fine root C transfer fire loss (gC/m2/s) - real(r8), pointer :: m_livestemc_to_fire(:) ! live stem C fire loss (gC/m2/s) - real(r8), pointer :: m_livestemc_storage_to_fire(:) ! live stem C storage fire loss (gC/m2/s) - real(r8), pointer :: m_livestemc_xfer_to_fire(:) ! live stem C transfer fire loss (gC/m2/s) - real(r8), pointer :: m_deadstemc_to_fire(:) ! dead stem C fire loss (gC/m2/s) - real(r8), pointer :: m_deadstemc_to_litter_fire(:) ! dead stem C fire mortality to litter (gC/m2/s) - real(r8), pointer :: m_deadstemc_storage_to_fire(:) ! dead stem C storage fire loss (gC/m2/s) - real(r8), pointer :: m_deadstemc_xfer_to_fire(:) ! dead stem C transfer fire loss (gC/m2/s) - real(r8), pointer :: m_livecrootc_to_fire(:) ! live coarse root C fire loss (gC/m2/s) - real(r8), pointer :: m_livecrootc_storage_to_fire(:) ! live coarse root C storage fire loss (gC/m2/s) - real(r8), pointer :: m_livecrootc_xfer_to_fire(:) ! live coarse root C transfer fire loss (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_fire(:) ! dead coarse root C fire loss (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_litter_fire(:) ! dead coarse root C fire mortality to litter (gC/m2/s) - real(r8), pointer :: m_deadcrootc_storage_to_fire(:) ! dead coarse root C storage fire loss (gC/m2/s) - real(r8), pointer :: m_deadcrootc_xfer_to_fire(:) ! dead coarse root C transfer fire loss (gC/m2/s) - real(r8), pointer :: m_gresp_storage_to_fire(:) ! growth respiration storage fire loss (gC/m2/s) - real(r8), pointer :: m_gresp_xfer_to_fire(:) ! growth respiration transfer fire loss (gC/m2/s) - ! phenology fluxes from transfer pools - real(r8), pointer :: grainc_xfer_to_grainc(:) ! grain C growth from storage for prognostic crop(gC/m2/s) - real(r8), pointer :: leafc_xfer_to_leafc(:) ! leaf C growth from storage (gC/m2/s) - real(r8), pointer :: frootc_xfer_to_frootc(:) ! fine root C growth from storage (gC/m2/s) - real(r8), pointer :: livestemc_xfer_to_livestemc(:) ! live stem C growth from storage (gC/m2/s) - real(r8), pointer :: deadstemc_xfer_to_deadstemc(:) ! dead stem C growth from storage (gC/m2/s) - real(r8), pointer :: livecrootc_xfer_to_livecrootc(:) ! live coarse root C growth from storage (gC/m2/s) - real(r8), pointer :: deadcrootc_xfer_to_deadcrootc(:) ! dead coarse root C growth from storage (gC/m2/s) - ! leaf and fine root litterfall - real(r8), pointer :: leafc_to_litter(:) ! leaf C litterfall (gC/m2/s) - real(r8), pointer :: frootc_to_litter(:) ! fine root C litterfall (gC/m2/s) - real(r8), pointer :: livestemc_to_litter(:) ! live stem C litterfall (gC/m2/s) - real(r8), pointer :: grainc_to_food(:) ! grain C to food for prognostic crop(gC/m2/s) - ! maintenance respiration fluxes - real(r8), pointer :: leaf_mr(:) ! leaf maintenance respiration (gC/m2/s) - real(r8), pointer :: froot_mr(:) ! fine root maintenance respiration (gC/m2/s) - real(r8), pointer :: livestem_mr(:) ! live stem maintenance respiration (gC/m2/s) - real(r8), pointer :: livecroot_mr(:) ! live coarse root maintenance respiration (gC/m2/s) - real(r8), pointer :: leaf_curmr(:) ! leaf maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: froot_curmr(:) ! fine root maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: livestem_curmr(:) ! live stem maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: livecroot_curmr(:) ! live coarse root maintenance respiration from current GPP (gC/m2/s) - real(r8), pointer :: leaf_xsmr(:) ! leaf maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: froot_xsmr(:) ! fine root maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: livestem_xsmr(:) ! live stem maintenance respiration from storage (gC/m2/s) - real(r8), pointer :: livecroot_xsmr(:) ! live coarse root maintenance respiration from storage (gC/m2/s) - ! photosynthesis fluxes - real(r8), pointer :: psnsun_to_cpool(:) ! C fixation from sunlit canopy (gC/m2/s) - real(r8), pointer :: psnshade_to_cpool(:) ! C fixation from shaded canopy (gC/m2/s) - ! allocation fluxes, from current GPP - real(r8), pointer :: cpool_to_xsmrpool(:) ! allocation to maintenance respiration storage pool (gC/m2/s) - real(r8), pointer :: cpool_to_grainc(:) ! allocation to grain C for prognostic crop(gC/m2/s) - real(r8), pointer :: cpool_to_grainc_storage(:) ! allocation to grain C storage for prognostic crop(gC/m2/s) - real(r8), pointer :: cpool_to_leafc(:) ! allocation to leaf C (gC/m2/s) - real(r8), pointer :: cpool_to_leafc_storage(:) ! allocation to leaf C storage (gC/m2/s) - real(r8), pointer :: cpool_to_frootc(:) ! allocation to fine root C (gC/m2/s) - real(r8), pointer :: cpool_to_frootc_storage(:) ! allocation to fine root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc(:) ! allocation to live stem C (gC/m2/s) - real(r8), pointer :: cpool_to_livestemc_storage(:) ! allocation to live stem C storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc(:) ! allocation to dead stem C (gC/m2/s) - real(r8), pointer :: cpool_to_deadstemc_storage(:) ! allocation to dead stem C storage (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc(:) ! allocation to live coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_livecrootc_storage(:) ! allocation to live coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc(:) ! allocation to dead coarse root C (gC/m2/s) - real(r8), pointer :: cpool_to_deadcrootc_storage(:) ! allocation to dead coarse root C storage (gC/m2/s) - real(r8), pointer :: cpool_to_gresp_storage(:) ! allocation to growth respiration storage (gC/m2/s) - ! growth respiration fluxes - real(r8), pointer :: xsmrpool_to_atm(:) ! excess MR pool harvest mortality (gC/m2/s) - real(r8), pointer :: cpool_leaf_gr(:) ! leaf growth respiration (gC/m2/s) - real(r8), pointer :: cpool_leaf_storage_gr(:) ! leaf growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_leaf_gr(:) ! leaf growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_froot_gr(:) ! fine root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_froot_storage_gr(:) ! fine root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_froot_gr(:) ! fine root growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_livestem_gr(:) ! live stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livestem_storage_gr(:) ! live stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_livestem_gr(:) ! live stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_deadstem_gr(:) ! dead stem growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadstem_storage_gr(:) ! dead stem growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadstem_gr(:) ! dead stem growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_livecroot_gr(:) ! live coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_livecroot_storage_gr(:) ! live coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_livecroot_gr(:) ! live coarse root growth respiration from storage (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_gr(:) ! dead coarse root growth respiration (gC/m2/s) - real(r8), pointer :: cpool_deadcroot_storage_gr(:) ! dead coarse root growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_deadcroot_gr(:) ! dead coarse root growth respiration from storage (gC/m2/s) - ! growth respiration for prognostic crop model - real(r8), pointer :: cpool_grain_gr(:) ! grain growth respiration (gC/m2/s) - real(r8), pointer :: cpool_grain_storage_gr(:) ! grain growth respiration to storage (gC/m2/s) - real(r8), pointer :: transfer_grain_gr(:) ! grain growth respiration from storage (gC/m2/s) - ! annual turnover of storage to transfer pools - real(r8), pointer :: grainc_storage_to_xfer(:) ! grain C shift storage to transfer for prognostic crop model (gC/m2/s) - real(r8), pointer :: leafc_storage_to_xfer(:) ! leaf C shift storage to transfer (gC/m2/s) - real(r8), pointer :: frootc_storage_to_xfer(:) ! fine root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livestemc_storage_to_xfer(:) ! live stem C shift storage to transfer (gC/m2/s) - real(r8), pointer :: deadstemc_storage_to_xfer(:) ! dead stem C shift storage to transfer (gC/m2/s) - real(r8), pointer :: livecrootc_storage_to_xfer(:) ! live coarse root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: deadcrootc_storage_to_xfer(:) ! dead coarse root C shift storage to transfer (gC/m2/s) - real(r8), pointer :: gresp_storage_to_xfer(:) ! growth respiration shift storage to transfer (gC/m2/s) - ! turnover of livewood to deadwood - real(r8), pointer :: livestemc_to_deadstemc(:) ! live stem C turnover (gC/m2/s) - real(r8), pointer :: livecrootc_to_deadcrootc(:) ! live coarse root C turnover (gC/m2/s) - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: gpp(:) ! (gC/m2/s) gross primary production - real(r8), pointer :: mr(:) ! (gC/m2/s) maintenance respiration - real(r8), pointer :: current_gr(:) ! (gC/m2/s) growth resp for new growth displayed in this timestep - real(r8), pointer :: transfer_gr(:) ! (gC/m2/s) growth resp for transfer growth displayed in this timestep - real(r8), pointer :: storage_gr(:) ! (gC/m2/s) growth resp for growth sent to storage for later display - real(r8), pointer :: gr(:) ! (gC/m2/s) total growth respiration - real(r8), pointer :: ar(:) ! (gC/m2/s) autotrophic respiration (MR + GR) - real(r8), pointer :: rr(:) ! (gC/m2/s) root respiration (fine root MR + total root GR) - real(r8), pointer :: npp(:) ! (gC/m2/s) net primary production - real(r8), pointer :: agnpp(:) ! (gC/m2/s) aboveground NPP - real(r8), pointer :: bgnpp(:) ! (gC/m2/s) belowground NPP - real(r8), pointer :: litfall(:) ! (gC/m2/s) litterfall (leaves and fine roots) - real(r8), pointer :: vegfire(:) ! (gC/m2/s) pft-level fire loss (obsolete, mark for removal) - real(r8), pointer :: wood_harvestc(:) ! (gC/m2/s) pft-level wood harvest (to product pools) - real(r8), pointer :: pft_cinputs(:) ! (gC/m2/s) pft-level carbon inputs (for balance checking) - real(r8), pointer :: pft_coutputs(:) ! (gC/m2/s) pft-level carbon outputs (for balance checking) - ! CLAMP summary (diagnostic) variables, not involved in mass balance - real(r8), pointer :: frootc_alloc(:) ! (gC/m2/s) pft-level fine root C alloc - real(r8), pointer :: frootc_loss(:) ! (gC/m2/s) pft-level fine root C loss - real(r8), pointer :: leafc_alloc(:) ! (gC/m2/s) pft-level leaf C alloc - real(r8), pointer :: leafc_loss(:) ! (gC/m2/s) pft-level leaf C loss - real(r8), pointer :: woodc_alloc(:) ! (gC/m2/s) pft-level wood C alloc - real(r8), pointer :: woodc_loss(:) ! (gC/m2/s) pft-level wood C loss - ! new variables for fire code - real(r8), pointer :: pft_fire_closs(:) ! (gC/m2/s) total pft-level fire C loss -end type pft_cflux_type - -type(pft_cflux_type) :: pcf !pft carbon flux -type(pft_cflux_type) :: pcf_a !pft carbon flux averaged to the column -type(pft_cflux_type) :: pc13f !pft carbon-13 flux -type(pft_cflux_type) :: pc13f_a !pft carbon-13 flux averaged to the column - -!---------------------------------------------------- -! pft nitrogen flux variables structure -!---------------------------------------------------- -type, public :: pft_nflux_type - ! new variables for CN code - ! gap mortality fluxes - real(r8), pointer :: m_leafn_to_litter(:) ! leaf N mortality (gN/m2/s) - real(r8), pointer :: m_frootn_to_litter(:) ! fine root N mortality (gN/m2/s) - real(r8), pointer :: m_leafn_storage_to_litter(:) ! leaf N storage mortality (gN/m2/s) - real(r8), pointer :: m_frootn_storage_to_litter(:) ! fine root N storage mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_storage_to_litter(:) ! live stem N storage mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_storage_to_litter(:) ! dead stem N storage mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_storage_to_litter(:) ! live coarse root N storage mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_storage_to_litter(:) ! dead coarse root N storage mortality (gN/m2/s) - real(r8), pointer :: m_leafn_xfer_to_litter(:) ! leaf N transfer mortality (gN/m2/s) - real(r8), pointer :: m_frootn_xfer_to_litter(:) ! fine root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_xfer_to_litter(:) ! live stem N transfer mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_xfer_to_litter(:) ! dead stem N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_xfer_to_litter(:) ! live coarse root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_xfer_to_litter(:) ! dead coarse root N transfer mortality (gN/m2/s) - real(r8), pointer :: m_livestemn_to_litter(:) ! live stem N mortality (gN/m2/s) - real(r8), pointer :: m_deadstemn_to_litter(:) ! dead stem N mortality (gN/m2/s) - real(r8), pointer :: m_livecrootn_to_litter(:) ! live coarse root N mortality (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_litter(:) ! dead coarse root N mortality (gN/m2/s) - real(r8), pointer :: m_retransn_to_litter(:) ! retranslocated N pool mortality (gN/m2/s) - ! harvest mortality fluxes - real(r8), pointer :: hrv_leafn_to_litter(:) ! leaf N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_to_litter(:) ! fine root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_leafn_storage_to_litter(:) ! leaf N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_storage_to_litter(:) ! fine root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_storage_to_litter(:) ! live stem N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_storage_to_litter(:) ! dead stem N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_storage_to_litter(:) ! live coarse root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_storage_to_litter(:) ! dead coarse root N storage harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_leafn_xfer_to_litter(:) ! leaf N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_frootn_xfer_to_litter(:) ! fine root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_xfer_to_litter(:) ! live stem N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_xfer_to_litter(:) ! dead stem N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_xfer_to_litter(:) ! live coarse root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litter(:) ! dead coarse root N transfer harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_livestemn_to_litter(:) ! live stem N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_to_prod10n(:) ! dead stem N harvest to 10-year product pool (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_to_prod100n(:) ! dead stem N harvest to 100-year product pool (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_to_litter(:) ! live coarse root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_to_litter(:) ! dead coarse root N harvest mortality (gN/m2/s) - real(r8), pointer :: hrv_retransn_to_litter(:) ! retranslocated N pool harvest mortality (gN/m2/s) - ! fire mortality fluxes - real(r8), pointer :: m_leafn_to_fire(:) ! leaf N fire loss (gN/m2/s) - real(r8), pointer :: m_leafn_storage_to_fire(:) ! leaf N storage fire loss (gN/m2/s) - real(r8), pointer :: m_leafn_xfer_to_fire(:) ! leaf N transfer fire loss (gN/m2/s) - real(r8), pointer :: m_frootn_to_fire(:) ! fine root N fire loss (gN/m2/s) - real(r8), pointer :: m_frootn_storage_to_fire(:) ! fine root N storage fire loss (gN/m2/s) - real(r8), pointer :: m_frootn_xfer_to_fire(:) ! fine root N transfer fire loss (gN/m2/s) - real(r8), pointer :: m_livestemn_to_fire(:) ! live stem N fire loss (gN/m2/s) - real(r8), pointer :: m_livestemn_storage_to_fire(:) ! live stem N storage fire loss (gN/m2/s) - real(r8), pointer :: m_livestemn_xfer_to_fire(:) ! live stem N transfer fire loss (gN/m2/s) - real(r8), pointer :: m_deadstemn_to_fire(:) ! dead stem N fire loss (gN/m2/s) - real(r8), pointer :: m_deadstemn_to_litter_fire(:) ! dead stem N fire mortality to litter (gN/m2/s) - real(r8), pointer :: m_deadstemn_storage_to_fire(:) ! dead stem N storage fire loss (gN/m2/s) - real(r8), pointer :: m_deadstemn_xfer_to_fire(:) ! dead stem N transfer fire loss (gN/m2/s) - real(r8), pointer :: m_livecrootn_to_fire(:) ! live coarse root N fire loss (gN/m2/s) - real(r8), pointer :: m_livecrootn_storage_to_fire(:) ! live coarse root N storage fire loss (gN/m2/s) - real(r8), pointer :: m_livecrootn_xfer_to_fire(:) ! live coarse root N transfer fire loss (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_fire(:) ! dead coarse root N fire loss (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_litter_fire(:) ! dead coarse root N fire mortality to litter (gN/m2/s) - real(r8), pointer :: m_deadcrootn_storage_to_fire(:) ! dead coarse root N storage fire loss (gN/m2/s) - real(r8), pointer :: m_deadcrootn_xfer_to_fire(:) ! dead coarse root N transfer fire loss (gN/m2/s) - real(r8), pointer :: m_retransn_to_fire(:) ! retranslocated N pool fire loss (gN/m2/s) - ! phenology fluxes from transfer pool - real(r8), pointer :: grainn_xfer_to_grainn(:) ! grain N growth from storage for prognostic crop model (gN/m2/s) - real(r8), pointer :: leafn_xfer_to_leafn(:) ! leaf N growth from storage (gN/m2/s) - real(r8), pointer :: frootn_xfer_to_frootn(:) ! fine root N growth from storage (gN/m2/s) - real(r8), pointer :: livestemn_xfer_to_livestemn(:) ! live stem N growth from storage (gN/m2/s) - real(r8), pointer :: deadstemn_xfer_to_deadstemn(:) ! dead stem N growth from storage (gN/m2/s) - real(r8), pointer :: livecrootn_xfer_to_livecrootn(:) ! live coarse root N growth from storage (gN/m2/s) - real(r8), pointer :: deadcrootn_xfer_to_deadcrootn(:) ! dead coarse root N growth from storage (gN/m2/s) - ! litterfall fluxes - real(r8), pointer :: livestemn_to_litter(:) ! livestem N to litter (gN/m2/s) - real(r8), pointer :: grainn_to_food(:) ! grain N to food for prognostic crop (gN/m2/s) - real(r8), pointer :: leafn_to_litter(:) ! leaf N litterfall (gN/m2/s) - real(r8), pointer :: leafn_to_retransn(:) ! leaf N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: frootn_to_litter(:) ! fine root N litterfall (gN/m2/s) - ! allocation fluxes - real(r8), pointer :: retransn_to_npool(:) ! deployment of retranslocated N (gN/m2/s) - real(r8), pointer :: sminn_to_npool(:) ! deployment of soil mineral N uptake (gN/m2/s) - real(r8), pointer :: npool_to_grainn(:) ! allocation to grain N for prognostic crop (gN/m2/s) - real(r8), pointer :: npool_to_grainn_storage(:) ! allocation to grain N storage for prognostic crop (gN/m2/s) - real(r8), pointer :: npool_to_leafn(:) ! allocation to leaf N (gN/m2/s) - real(r8), pointer :: npool_to_leafn_storage(:) ! allocation to leaf N storage (gN/m2/s) - real(r8), pointer :: npool_to_frootn(:) ! allocation to fine root N (gN/m2/s) - real(r8), pointer :: npool_to_frootn_storage(:) ! allocation to fine root N storage (gN/m2/s) - real(r8), pointer :: npool_to_livestemn(:) ! allocation to live stem N (gN/m2/s) - real(r8), pointer :: npool_to_livestemn_storage(:) ! allocation to live stem N storage (gN/m2/s) - real(r8), pointer :: npool_to_deadstemn(:) ! allocation to dead stem N (gN/m2/s) - real(r8), pointer :: npool_to_deadstemn_storage(:) ! allocation to dead stem N storage (gN/m2/s) - real(r8), pointer :: npool_to_livecrootn(:) ! allocation to live coarse root N (gN/m2/s) - real(r8), pointer :: npool_to_livecrootn_storage(:) ! allocation to live coarse root N storage (gN/m2/s) - real(r8), pointer :: npool_to_deadcrootn(:) ! allocation to dead coarse root N (gN/m2/s) - real(r8), pointer :: npool_to_deadcrootn_storage(:) ! allocation to dead coarse root N storage (gN/m2/s) - ! annual turnover of storage to transfer pools - real(r8), pointer :: grainn_storage_to_xfer(:) ! grain N shift storage to transfer for prognostic crop (gN/m2/s) - real(r8), pointer :: leafn_storage_to_xfer(:) ! leaf N shift storage to transfer (gN/m2/s) - real(r8), pointer :: frootn_storage_to_xfer(:) ! fine root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: livestemn_storage_to_xfer(:) ! live stem N shift storage to transfer (gN/m2/s) - real(r8), pointer :: deadstemn_storage_to_xfer(:) ! dead stem N shift storage to transfer (gN/m2/s) - real(r8), pointer :: livecrootn_storage_to_xfer(:) ! live coarse root N shift storage to transfer (gN/m2/s) - real(r8), pointer :: deadcrootn_storage_to_xfer(:) ! dead coarse root N shift storage to transfer (gN/m2/s) - ! turnover of livewood to deadwood, with retranslocation - real(r8), pointer :: livestemn_to_deadstemn(:) ! live stem N turnover (gN/m2/s) - real(r8), pointer :: livestemn_to_retransn(:) ! live stem N to retranslocated N pool (gN/m2/s) - real(r8), pointer :: livecrootn_to_deadcrootn(:) ! live coarse root N turnover (gN/m2/s) - real(r8), pointer :: livecrootn_to_retransn(:) ! live coarse root N to retranslocated N pool (gN/m2/s) - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: ndeploy(:) ! total N deployed to growth and storage (gN/m2/s) - real(r8), pointer :: pft_ninputs(:) ! total N inputs to pft-level (gN/m2/s) - real(r8), pointer :: pft_noutputs(:) ! total N outputs from pft-level (gN/m2/s) - real(r8), pointer :: wood_harvestn(:) ! total N losses to wood product pools (gN/m2/s) - ! new variables for fire code - real(r8), pointer :: pft_fire_nloss(:) ! total pft-level fire N loss (gN/m2/s) -end type pft_nflux_type - -type(pft_nflux_type) :: pnf !pft nitrogen flux -type(pft_nflux_type) :: pnf_a !pft-level nitrogen flux variables averaged to the column - -!---------------------------------------------------- -! pft VOC fluxes structure for history output -!---------------------------------------------------- -type, public :: megan_out_type - real(r8), pointer :: flux_out(:) !(n_megan_comps) MEGAN flux [ug C m-2 h-1] -endtype megan_out_type - -!---------------------------------------------------- -! pft VOC flux variables structure -!---------------------------------------------------- -type, public :: pft_vflux_type - real(r8), pointer :: vocflx_tot(:) !total VOC flux into atmosphere [moles/m2/sec] - real(r8), pointer :: vocflx(:,:) !(num_mech_comps) MEGAN flux [moles/m2/sec] - real(r8), pointer :: Eopt_out(:) !Eopt coefficient - real(r8), pointer :: topt_out(:) !topt coefficient - real(r8), pointer :: alpha_out(:) !alpha coefficient - real(r8), pointer :: cp_out(:) !cp coefficient - real(r8), pointer :: paru_out(:) - real(r8), pointer :: par24u_out(:) - real(r8), pointer :: par240u_out(:) - real(r8), pointer :: para_out(:) - real(r8), pointer :: par24a_out(:) - real(r8), pointer :: par240a_out(:) - real(r8), pointer :: gamma_out(:) - real(r8), pointer :: gammaL_out(:) - real(r8), pointer :: gammaT_out(:) - real(r8), pointer :: gammaP_out(:) - real(r8), pointer :: gammaA_out(:) - real(r8), pointer :: gammaS_out(:) - real(r8), pointer :: gammaC_out(:) - type(megan_out_type), pointer :: meg(:) ! points to output fluxes -end type pft_vflux_type - -type(pft_vflux_type) :: pvf !pft VOC flux - -!---------------------------------------------------- -! pft dry dep velocity variables structure -!---------------------------------------------------- -type, public :: pft_depvd_type - real(r8), pointer :: drydepvel(:,:) -end type pft_depvd_type - -type(pft_depvd_type) :: pdd !dry dep velocity - -!---------------------------------------------------- -! pft dust flux variables structure -!---------------------------------------------------- -type, public :: pft_dflux_type - real(r8), pointer :: flx_mss_vrt_dst(:,:) !(ndst) !surface dust emission (kg/m**2/s) [ + = to atm] - real(r8), pointer :: flx_mss_vrt_dst_tot(:) !total dust flux into atmosphere - real(r8), pointer :: vlc_trb(:,:) !(ndst) turbulent deposition velocity (m/s) - real(r8), pointer :: vlc_trb_1(:) !turbulent deposition velocity 1(m/s) - real(r8), pointer :: vlc_trb_2(:) !turbulent deposition velocity 2(m/s) - real(r8), pointer :: vlc_trb_3(:) !turbulent deposition velocity 3(m/s) - real(r8), pointer :: vlc_trb_4(:) !turbulent deposition velocity 4(m/s) -end type pft_dflux_type - -type(pft_dflux_type) :: pdf !pft dust flux - -!---------------------------------------------------- -! End definition of structures defined at the pft_type level -!---------------------------------------------------- -!******************************************************************************* - - -!******************************************************************************* -!---------------------------------------------------- -! Begin definition of structures defined at the column_type level -!---------------------------------------------------- -! column physical state variables structure -!---------------------------------------------------- -type, public :: column_pstate_type - integer , pointer :: snl(:) !number of snow layers - integer , pointer :: isoicol(:) !soil color class - real(r8), pointer :: bsw(:,:) !Clapp and Hornberger "b" (nlevgrnd) - real(r8), pointer :: watsat(:,:) !volumetric soil water at saturation (porosity) (nlevgrnd) - real(r8), pointer :: watdry(:,:) !btran parameter for btran=0 - real(r8), pointer :: watopt(:,:) !btran parameter for btran = 1 - real(r8), pointer :: hksat(:,:) !hydraulic conductivity at saturation (mm H2O /s) (nlevgrnd) - real(r8), pointer :: sucsat(:,:) !minimum soil suction (mm) (nlevgrnd) - real(r8), pointer :: hkdepth(:) !decay factor (m) - real(r8), pointer :: wtfact(:) !maximum saturated fraction for a gridcell - real(r8), pointer :: fracice(:,:) !fractional impermeability (-) - real(r8), pointer :: csol(:,:) !heat capacity, soil solids (J/m**3/Kelvin) (nlevgrnd) - real(r8), pointer :: tkmg(:,:) !thermal conductivity, soil minerals [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: tkdry(:,:) !thermal conductivity, dry soil (W/m/Kelvin) (nlevgrnd) - real(r8), pointer :: tksatu(:,:) !thermal conductivity, saturated soil [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: smpmin(:) !restriction for min of soil potential (mm) (new) - real(r8), pointer :: gwc_thr(:) !threshold soil moisture based on clay content - real(r8), pointer :: mss_frc_cly_vld(:) ![frc] Mass fraction clay limited to 0.20 - real(r8), pointer :: mbl_bsn_fct(:) !basin factor - logical , pointer :: do_capsnow(:) !true => do snow capping - real(r8), pointer :: snowdp(:) !snow height (m) - real(r8), pointer :: frac_sno(:) !fraction of ground covered by snow (0 to 1) - !real(r8), pointer :: res_sno(:) !residual snow when snl -> 0 - !real(r8), pointer :: topo_ndx(:) !gridcell topographic index - !real(r8), pointer :: topo_slope(:) !gridcell topographic slope - !real(r8), pointer :: var_track(:) !generic variable to track... - !real(r8), pointer :: var_track2(:) !generic variable to track... - real(r8), pointer :: zi(:,:) !interface level below a "z" level (m) (-nlevsno+0:nlevgrnd) - real(r8), pointer :: dz(:,:) !layer thickness (m) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: z(:,:) !layer depth (m) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: frac_iceold(:,:) !fraction of ice relative to the tot water (new) (-nlevsno+1:nlevgrnd) - integer , pointer :: imelt(:,:) !flag for melting (=1), freezing (=2), Not=0 (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: eff_porosity(:,:) !effective porosity = porosity - vol_ice (nlevgrnd) - real(r8), pointer :: emg(:) !ground emissivity - real(r8), pointer :: z0mg(:) !roughness length over ground, momentum [m] - real(r8), pointer :: z0hg(:) !roughness length over ground, sensible heat [m] - real(r8), pointer :: z0qg(:) !roughness length over ground, latent heat [m] - real(r8), pointer :: htvp(:) !latent heat of vapor of water (or sublimation) [j/kg] - real(r8), pointer :: beta(:) !coefficient of convective velocity [-] - real(r8), pointer :: zii(:) !convective boundary height [m] - real(r8), pointer :: albgrd(:,:) !ground albedo (direct) (numrad) - real(r8), pointer :: albgri(:,:) !ground albedo (diffuse) (numrad) - real(r8), pointer :: rootr_column(:,:) !effective fraction of roots in each soil layer (nlevgrnd) - real(r8), pointer :: rootfr_road_perv(:,:) !fraction of roots in each soil layer for urban pervious road - real(r8), pointer :: rootr_road_perv(:,:) !effective fraction of roots in each soil layer of urban pervious road - real(r8), pointer :: wf(:) !soil water as frac. of whc for top 0.5 m -! real(r8), pointer :: xirrig(:) !irrigation rate - real(r8), pointer :: max_dayl(:) !maximum daylength for this column (s) - ! new variables for CN code - real(r8), pointer :: bsw2(:,:) !Clapp and Hornberger "b" for CN code - real(r8), pointer :: psisat(:,:) !soil water potential at saturation for CN code (MPa) - real(r8), pointer :: vwcsat(:,:) !volumetric water content at saturation for CN code (m3/m3) - real(r8), pointer :: decl(:) ! solar declination angle (radians) - real(r8), pointer :: coszen(:) !cosine of solar zenith angle - real(r8), pointer :: soilpsi(:,:) !soil water potential in each soil layer (MPa) - real(r8), pointer :: fpi(:) !fraction of potential immobilization (no units) - real(r8), pointer :: fpg(:) !fraction of potential gpp (no units) - real(r8), pointer :: annsum_counter(:) !seconds since last annual accumulator turnover - real(r8), pointer :: cannsum_npp(:) !annual sum of NPP, averaged from pft-level (gC/m2/yr) - real(r8), pointer :: cannavg_t2m(:) !annual average of 2m air temperature, averaged from pft-level (K) - real(r8), pointer :: watfc(:,:) !volumetric soil water at field capacity (nlevsoi) - ! new variables for fire code - real(r8), pointer :: me(:) !moisture of extinction (proportion) - real(r8), pointer :: fire_prob(:) !daily fire probability (0-1) - real(r8), pointer :: mean_fire_prob(:) !e-folding mean of daily fire probability (0-1) - real(r8), pointer :: fireseasonl(:) !annual fire season length (days, <= days/year) - real(r8), pointer :: farea_burned(:) !timestep fractional area burned (proportion) - real(r8), pointer :: ann_farea_burned(:) !annual total fractional area burned (proportion) - real(r8), pointer :: albsnd_hst(:,:) ! snow albedo, direct, for history files (col,bnd) [frc] - real(r8), pointer :: albsni_hst(:,:) ! snow albedo, diffuse, for history files (col,bnd) [frc] - real(r8), pointer :: albsod(:,:) ! soil albedo: direct (col,bnd) [frc] - real(r8), pointer :: albsoi(:,:) ! soil albedo: diffuse (col,bnd) [frc] - real(r8), pointer :: flx_absdv(:,:) ! absorbed flux per unit incident direct flux: VIS (col,lyr) [frc] - real(r8), pointer :: flx_absdn(:,:) ! absorbed flux per unit incident direct flux: NIR (col,lyr) [frc] - real(r8), pointer :: flx_absiv(:,:) ! absorbed flux per unit incident diffuse flux: VIS (col,lyr) [frc] - real(r8), pointer :: flx_absin(:,:) ! absorbed flux per unit incident diffuse flux: NIR (col,lyr) [frc] - real(r8), pointer :: snw_rds(:,:) ! snow grain radius (col,lyr) [m^-6, microns] - real(r8), pointer :: snw_rds_top(:) ! snow grain radius, top layer (col) [m^-6, microns] - real(r8), pointer :: sno_liq_top(:) ! snow liquid water fraction (mass), top layer (col) [fraction] - real(r8), pointer :: mss_bcpho(:,:) ! mass of hydrophobic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcphi(:,:) ! mass of hydrophillic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bctot(:,:) ! total mass of BC in snow (pho+phi) (col,lyr) [kg] - real(r8), pointer :: mss_bc_col(:) ! column-integrated mass of total BC (col) [kg] - real(r8), pointer :: mss_bc_top(:) ! top-layer mass of total BC (col) [kg] - real(r8), pointer :: mss_ocpho(:,:) ! mass of hydrophobic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! mass of hydrophillic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_octot(:,:) ! total mass of OC in snow (pho+phi) (col,lyr) [kg] - real(r8), pointer :: mss_oc_col(:) ! column-integrated mass of total OC (col) [kg] - real(r8), pointer :: mss_oc_top(:) ! top-layer mass of total OC (col) [kg] - real(r8), pointer :: mss_dst1(:,:) ! mass of dust species 1 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! mass of dust species 2 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! mass of dust species 3 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! mass of dust species 4 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dsttot(:,:) ! total mass of dust in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst_col(:) ! column-integrated mass of dust in snow (col) [kg] - real(r8), pointer :: mss_dst_top(:) ! top-layer mass of dust in snow (col) [kg] - real(r8), pointer :: h2osno_top(:) ! top-layer mass of snow (col) [kg] - real(r8), pointer :: mss_cnc_bcphi(:,:) ! mass concentration of hydrophilic BC in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_bcpho(:,:) ! mass concentration of hydrophilic BC in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_ocphi(:,:) ! mass concentration of hydrophilic OC in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_ocpho(:,:) ! mass concentration of hydrophilic OC in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst1(:,:) ! mass concentration of dust species 1 in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst2(:,:) ! mass concentration of dust species 2 in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst3(:,:) ! mass concentration of dust species 3 in snow (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst4(:,:) ! mass concentration of dust species 4 in snow (col,lyr) [kg/kg] - real(r8), pointer :: albgrd_pur(:,:) ! pure snow ground direct albedo (numrad) - real(r8), pointer :: albgri_pur(:,:) ! pure snow ground diffuse albedo (numrad) - real(r8), pointer :: albgrd_bc(:,:) ! ground direct albedo without BC (numrad) - real(r8), pointer :: albgri_bc(:,:) ! ground diffuse albedo without BC (numrad) - real(r8), pointer :: albgrd_oc(:,:) ! ground direct albedo without OC (numrad) - real(r8), pointer :: albgri_oc(:,:) ! ground diffuse albedo without OC (numrad) - real(r8), pointer :: albgrd_dst(:,:) ! ground direct albedo without dust (numrad) - real(r8), pointer :: albgri_dst(:,:) ! ground diffuse albedo without dust (numrad) - real(r8), pointer :: dTdz_top(:) ! temperature gradient in top layer [K m-1] - real(r8), pointer :: snot_top(:) ! temperature of top snow layer [K] - real(r8), pointer :: irrig_rate(:) ! current irrigation rate [mm/s] - integer, pointer :: n_irrig_steps_left(:) ! number of time steps for which we still need to irrigate today (if 0, ignore irrig_rate) - real(r8), pointer :: forc_pbot(:) ! surface atm pressure, downscaled to column (Pa) - real(r8), pointer :: forc_rho(:) ! surface air density, downscaled to column (kg/m^3) - real(r8), pointer :: glc_frac(:) ! ice fractional area - real(r8), pointer :: glc_topo(:) ! surface elevation (m) -end type column_pstate_type - -type(column_pstate_type) :: cps !column physical state variables - -!---------------------------------------------------- -! column energy state variables structure -!---------------------------------------------------- -type, public :: column_estate_type - real(r8), pointer :: t_grnd(:) !ground temperature (Kelvin) - real(r8), pointer :: t_grnd_u(:) !Urban ground temperature (Kelvin) - real(r8), pointer :: t_grnd_r(:) !Rural ground temperature (Kelvin) - real(r8), pointer :: dt_grnd(:) !change in t_grnd, last iteration (Kelvin) - real(r8), pointer :: t_soisno(:,:) !soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: t_soi_10cm(:) !soil temperature in top 10cm of soil (Kelvin) - real(r8), pointer :: t_lake(:,:) !lake temperature (Kelvin) (1:nlevlak) - real(r8), pointer :: tssbef(:,:) !soil/snow temperature before update (-nlevsno+1:nlevgrnd) - real(r8), pointer :: thv(:) !virtual potential temperature (kelvin) - real(r8), pointer :: hc_soi(:) !soil heat content (MJ/m2) - real(r8), pointer :: hc_soisno(:) !soil plus snow heat content (MJ/m2) - real(r8), pointer :: forc_t(:) !atm temperature, downscaled to column (Kelvin) - real(r8), pointer :: forc_th(:) !atm potl temperature, downscaled to column (Kelvin) -end type column_estate_type - -type(column_estate_type) :: ces !column energy state - -!---------------------------------------------------- -! column water state variables structure -!---------------------------------------------------- -type, public :: column_wstate_type - real(r8), pointer :: h2osno(:) !snow water (mm H2O) - real(r8), pointer :: errh2osno(:) !imbalance in snow water (mm H2O) - real(r8), pointer :: snow_sources(:) !snow sources (mm H2O/s) - real(r8), pointer :: snow_sinks(:) !snow sinks (mm H2O/s) - real(r8), pointer :: h2osoi_liq(:,:) !liquid water (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_ice(:,:) !ice lens (kg/m2) (new) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: h2osoi_liqice_10cm(:) !liquid water + ice lens in top 10cm of soil (kg/m2) - real(r8), pointer :: h2osoi_vol(:,:) !volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] (nlevgrnd) - real(r8), pointer :: h2osno_old(:) !snow mass for previous time step (kg/m2) (new) - real(r8), pointer :: qg(:) !ground specific humidity [kg/kg] - real(r8), pointer :: dqgdT(:) !d(qg)/dT - real(r8), pointer :: snowice(:) !average snow ice lens - real(r8), pointer :: snowliq(:) !average snow liquid water - real(r8) ,pointer :: soilalpha(:) !factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: soilbeta(:) !factor that reduces ground evaporation L&P1992(-) - real(r8) ,pointer :: soilalpha_u(:) !urban factor that reduces ground saturated specific humidity (-) - real(r8), pointer :: zwt(:) !water table depth - !real(r8), pointer :: frost_table(:) !frost table depth - !real(r8), pointer :: zwt_perched(:) !perched water table depth - real(r8), pointer :: fcov(:) !fractional impermeable area - real(r8), pointer :: wa(:) !water in the unconfined aquifer (mm) - real(r8), pointer :: wt(:) !total water storage (unsaturated soil water + groundwater) (mm) - real(r8), pointer :: qcharge(:) !aquifer recharge rate (mm/s) - real(r8), pointer :: smp_l(:,:) !soil matric potential (mm) - real(r8), pointer :: hk_l(:,:) !hydraulic conductivity (mm/s) - real(r8), pointer :: fsat(:) !fractional area with water table at surface - real(r8), pointer :: forc_q(:) !atm specific humidity, downscaled to column (kg/kg) -end type column_wstate_type - -type(column_wstate_type) :: cws !column water state -type(pft_wstate_type) :: pws_a !pft-level water state variables averaged to the column - -!---------------------------------------------------- -! column carbon state variables structure -!---------------------------------------------------- -type, public :: column_cstate_type - ! NOTE: the soilc variable is used by the original CLM C-cycle code, - ! and is not used by the CN code - real(r8), pointer :: soilc(:) !soil carbon (kg C /m**2) - ! BGC variables - real(r8), pointer :: cwdc(:) ! (gC/m2) coarse woody debris C - real(r8), pointer :: litr1c(:) ! (gC/m2) litter labile C - real(r8), pointer :: litr2c(:) ! (gC/m2) litter cellulose C - real(r8), pointer :: litr3c(:) ! (gC/m2) litter lignin C - real(r8), pointer :: soil1c(:) ! (gC/m2) soil organic matter C (fast pool) - real(r8), pointer :: soil2c(:) ! (gC/m2) soil organic matter C (medium pool) - real(r8), pointer :: soil3c(:) ! (gC/m2) soil organic matter C (slow pool) - real(r8), pointer :: soil4c(:) ! (gC/m2) soil organic matter C (slowest pool) - real(r8), pointer :: col_ctrunc(:) ! (gC/m2) column-level sink for C truncation - ! pools for dynamic landcover - real(r8), pointer :: seedc(:) ! (gC/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10c(:) ! (gC/m2) wood product C pool, 10-year lifespan - real(r8), pointer :: prod100c(:) ! (gC/m2) wood product C pool, 100-year lifespan - real(r8), pointer :: totprodc(:) ! (gC/m2) total wood product C - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: totlitc(:) ! (gC/m2) total litter carbon - real(r8), pointer :: totsomc(:) ! (gC/m2) total soil organic matter carbon - real(r8), pointer :: totecosysc(:) ! (gC/m2) total ecosystem carbon, incl veg but excl cpool - real(r8), pointer :: totcolc(:) ! (gC/m2) total column carbon, incl veg and cpool -end type column_cstate_type - -type(column_cstate_type) :: ccs !column carbon state -type(column_cstate_type) :: cc13s !column carbon-13 state - -!---------------------------------------------------- -! column nitrogen state variables structure -!---------------------------------------------------- -type, public :: column_nstate_type - ! BGC variables - real(r8), pointer :: cwdn(:) ! (gN/m2) coarse woody debris N - real(r8), pointer :: litr1n(:) ! (gN/m2) litter labile N - real(r8), pointer :: litr2n(:) ! (gN/m2) litter cellulose N - real(r8), pointer :: litr3n(:) ! (gN/m2) litter lignin N - real(r8), pointer :: soil1n(:) ! (gN/m2) soil organic matter N (fast pool) - real(r8), pointer :: soil2n(:) ! (gN/m2) soil organic matter N (medium pool) - real(r8), pointer :: soil3n(:) ! (gN/m2) soil orgainc matter N (slow pool) - real(r8), pointer :: soil4n(:) ! (gN/m2) soil orgainc matter N (slowest pool) - real(r8), pointer :: sminn(:) ! (gN/m2) soil mineral N - real(r8), pointer :: col_ntrunc(:) ! (gN/m2) column-level sink for N truncation - ! wood product pools, for dynamic landcover - real(r8), pointer :: seedn(:) ! (gN/m2) column-level pool for seeding new PFTs - real(r8), pointer :: prod10n(:) ! (gN/m2) wood product N pool, 10-year lifespan - real(r8), pointer :: prod100n(:) ! (gN/m2) wood product N pool, 100-year lifespan - real(r8), pointer :: totprodn(:) ! (gN/m2) total wood product N - ! summary (diagnostic) state variables, not involved in mass balance - real(r8), pointer :: totlitn(:) ! (gN/m2) total litter nitrogen - real(r8), pointer :: totsomn(:) ! (gN/m2) total soil organic matter nitrogen - real(r8), pointer :: totecosysn(:) ! (gN/m2) total ecosystem nitrogen, incl veg - real(r8), pointer :: totcoln(:) ! (gN/m2) total column nitrogen, incl veg -end type column_nstate_type - -type(column_nstate_type) :: cns !column nitrogen state -type(pft_nstate_type) :: pns_a !pft-level nitrogen state variables averaged to the column - -!---------------------------------------------------- -! column VOC state variables structure -!---------------------------------------------------- -type, public :: column_vstate_type - real(r8), pointer :: dummy_entry(:) -end type column_vstate_type - -!---------------------------------------------------- -! column DGVM state variables structure -!---------------------------------------------------- -type, public :: column_dgvstate_type - real(r8), pointer :: dummy_entry(:) -end type column_dgvstate_type - -!---------------------------------------------------- -! column dust state variables structure -!---------------------------------------------------- -type, public :: column_dstate_type - real(r8), pointer :: dummy_entry(:) -end type column_dstate_type - -!---------------------------------------------------- -! column energy flux variables structure -!---------------------------------------------------- -type, public :: column_eflux_type - real(r8), pointer :: eflx_snomelt(:) ! snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_u(:) ! urban snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_snomelt_r(:) ! rural snow melt heat flux (W/m**2) - real(r8), pointer :: eflx_impsoil(:) ! implicit evaporation for soil temperature equation - real(r8), pointer :: eflx_fgr12(:) ! ground heat flux between soil layers 1 and 2 (W/m2) - ! Urban variable - real(r8), pointer :: eflx_building_heat(:) ! heat flux from urban building interior to urban walls, roof (W/m**2) - real(r8), pointer :: eflx_urban_ac(:) ! urban air conditioning flux (W/m**2) - real(r8), pointer :: eflx_urban_heat(:) ! urban heating flux (W/m**2) - real(r8), pointer :: eflx_bot(:) ! heat flux from beneath the soil or ice column (W/m**2) - ! positive upward; usually eflx_bot >= 0 -end type column_eflux_type - -type(column_eflux_type) :: cef ! column energy flux -type(pft_eflux_type) :: pef_a ! pft-level energy flux variables averaged to the column - -!---------------------------------------------------- -! column momentum flux variables structure -!---------------------------------------------------- -type, public :: column_mflux_type - real(r8), pointer :: dummy_entry(:) -end type column_mflux_type - -type(column_mflux_type) :: cmf ! column momentum flux -type(pft_mflux_type) :: pmf_a ! pft-level momentum flux variables averaged to the column - -!---------------------------------------------------- -! column water flux variables structure -!---------------------------------------------------- -type, public :: column_wflux_type - real(r8), pointer :: qflx_infl(:) ! infiltration (mm H2O /s) - real(r8), pointer :: qflx_surf(:) ! surface runoff (mm H2O /s) - real(r8), pointer :: qflx_drain(:) ! sub-surface runoff (mm H2O /s) - real(r8), pointer :: qflx_top_soil(:)! net water input into soil from top (mm/s) - real(r8), pointer :: qflx_sl_top_soil(:) ! liquid water + ice from layer above soil to top soil layer or sent to qflx_qrgwl (mm H2O/s) - !real(r8), pointer :: qflx_snow_out(:) ! net water output from snow column - !real(r8), pointer :: qflx_drain_perched(:) ! sub-surface runoff from perched wt (mm H2O /s) - ! - real(r8), pointer :: qflx_h2osfc_surf(:) ! surface water runoff - real(r8), pointer :: qflx_snow_h2osfc(:) ! snow falling on surface water - real(r8), pointer :: qflx_drain_perched(:) ! sub-surface runoff from perched wt (mm H2O /s) - real(r8), pointer :: qflx_floodc(:) ! flood water flux at column level - real(r8), pointer :: qflx_snow_melt(:) ! snow melt (net) - ! - real(r8), pointer :: qflx_snomelt(:) ! snow melt (mm H2O /s) - real(r8), pointer :: qflx_qrgwl(:) ! qflx_surf at glaciers, wetlands, lakes - real(r8), pointer :: qflx_runoff(:) ! total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qflx_runoff_u(:)! Urban total runoff (qflx_drain+qflx_surf) (mm H2O /s) - real(r8), pointer :: qflx_runoff_r(:)! Rural total runoff (qflx_drain+qflx_surf+qflx_qrgwl) (mm H2O /s) - real(r8), pointer :: qmelt(:) ! snow melt [mm/s] - real(r8), pointer :: h2ocan_loss(:) ! mass balance correction term for dynamic weights - real(r8), pointer :: qflx_rsub_sat(:) ! soil saturation excess [mm/s] - real(r8), pointer :: flx_bc_dep_dry(:) ! dry (BCPHO+BCPHI) BC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_bc_dep_wet(:) ! wet (BCPHI) BC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_bc_dep_pho(:) ! hydrophobic BC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_bc_dep_phi(:) ! hydrophillic BC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_bc_dep(:) ! total (dry+wet) BC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_oc_dep_dry(:) ! dry (OCPHO+OCPHI) OC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_oc_dep_wet(:) ! wet (OCPHI) OC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_oc_dep_pho(:) ! hydrophobic OC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_oc_dep_phi(:) ! hydrophillic OC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_oc_dep(:) ! total (dry+wet) OC deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_dry1(:) ! dust species 1 dry deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_wet1(:) ! dust species 1 wet deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_dry2(:) ! dust species 2 dry deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_wet2(:) ! dust species 2 wet deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_dry3(:) ! dust species 3 dry deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_wet3(:) ! dust species 3 wet deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_dry4(:) ! dust species 4 dry deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep_wet4(:) ! dust species 4 wet deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: flx_dst_dep(:) ! total (dry+wet) dust deposition on ground (positive definite) (col) [kg/s] - real(r8), pointer :: qflx_snofrz_lyr(:,:)! snow freezing rate (positive definite) (col,lyr) [kg m-2 s-1] - real(r8), pointer :: qflx_snofrz_col(:) ! column-integrated snow freezing rate (positive definite) (col) [kg m-2 s-1] - real(r8), pointer :: qflx_irrig(:) ! irrigation flux (mm H2O/s) - real(r8), pointer :: qflx_glcice(:) ! net flux of new glacial ice (growth - melt) (mm H2O/s), passed to GLC - real(r8), pointer :: qflx_glcice_frz(:) ! ice growth (positive definite) (mm H2O/s) - real(r8), pointer :: qflx_glcice_melt(:) ! ice melt (positive definite) (mm H2O/s) - real(r8), pointer :: glc_rofi(:) ! ice runoff passed from GLC to CLM (mm H2O /s) - real(r8), pointer :: glc_rofl(:) ! liquid runoff passed from GLC to CLM (mm H2O /s) -end type column_wflux_type - -type(column_wflux_type) :: cwf ! column water flux -type(pft_wflux_type) :: pwf_a ! pft-level water flux variables averaged to the column - -!---------------------------------------------------- -! column carbon flux variables structure -!---------------------------------------------------- -type, public :: column_cflux_type - ! new variables for CN code - ! column-level gap mortality fluxes - real(r8), pointer :: m_leafc_to_litr1c(:) ! leaf C mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_leafc_to_litr2c(:) ! leaf C mortality to litter 2 C (gC/m2/s) - real(r8), pointer :: m_leafc_to_litr3c(:) ! leaf C mortality to litter 3 C (gC/m2/s) - real(r8), pointer :: m_frootc_to_litr1c(:) ! fine root C mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_frootc_to_litr2c(:) ! fine root C mortality to litter 2 C (gC/m2/s) - real(r8), pointer :: m_frootc_to_litr3c(:) ! fine root C mortality to litter 3 C (gC/m2/s) - real(r8), pointer :: m_livestemc_to_cwdc(:) ! live stem C mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: m_deadstemc_to_cwdc(:) ! dead stem C mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: m_livecrootc_to_cwdc(:) ! live coarse root C mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_cwdc(:) ! dead coarse root C mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: m_leafc_storage_to_litr1c(:) ! leaf C storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_frootc_storage_to_litr1c(:) ! fine root C storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_livestemc_storage_to_litr1c(:) ! live stem C storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_deadstemc_storage_to_litr1c(:) ! dead stem C storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_livecrootc_storage_to_litr1c(:) ! live coarse root C storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_deadcrootc_storage_to_litr1c(:) ! dead coarse root C storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_gresp_storage_to_litr1c(:) ! growth respiration storage mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_leafc_xfer_to_litr1c(:) ! leaf C transfer mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_frootc_xfer_to_litr1c(:) ! fine root C transfer mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_livestemc_xfer_to_litr1c(:) ! live stem C transfer mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_deadstemc_xfer_to_litr1c(:) ! dead stem C transfer mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_livecrootc_xfer_to_litr1c(:) ! live coarse root C transfer mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_deadcrootc_xfer_to_litr1c(:) ! dead coarse root C transfer mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: m_gresp_xfer_to_litr1c(:) ! growth respiration transfer mortality to litter 1 C (gC/m2/s) - ! column-level harvest mortality fluxes - real(r8), pointer :: hrv_leafc_to_litr1c(:) ! leaf C harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_leafc_to_litr2c(:) ! leaf C harvest mortality to litter 2 C (gC/m2/s) - real(r8), pointer :: hrv_leafc_to_litr3c(:) ! leaf C harvest mortality to litter 3 C (gC/m2/s) - real(r8), pointer :: hrv_frootc_to_litr1c(:) ! fine root C harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_frootc_to_litr2c(:) ! fine root C harvest mortality to litter 2 C (gC/m2/s) - real(r8), pointer :: hrv_frootc_to_litr3c(:) ! fine root C harvest mortality to litter 3 C (gC/m2/s) - real(r8), pointer :: hrv_livestemc_to_cwdc(:) ! live stem C harvest mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) ! dead stem C harvest mortality to 10-year product pool (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) ! dead stem C harvest mortality to 100-year product pool (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_to_cwdc(:) ! live coarse root C harvest mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_to_cwdc(:) ! dead coarse root C harvest mortality to coarse woody debris C (gC/m2/s) - real(r8), pointer :: hrv_leafc_storage_to_litr1c(:) ! leaf C storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_frootc_storage_to_litr1c(:) ! fine root C storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_livestemc_storage_to_litr1c(:) ! live stem C storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_storage_to_litr1c(:) ! dead stem C storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_storage_to_litr1c(:) ! live coarse root C storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_storage_to_litr1c(:) ! dead coarse root C storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_gresp_storage_to_litr1c(:) ! growth respiration storage harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_leafc_xfer_to_litr1c(:) ! leaf C transfer harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_frootc_xfer_to_litr1c(:) ! fine root C transfer harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_livestemc_xfer_to_litr1c(:) ! live stem C transfer harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_deadstemc_xfer_to_litr1c(:) ! dead stem C transfer harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_livecrootc_xfer_to_litr1c(:) ! live coarse root C transfer harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litr1c(:) ! dead coarse root C transfer harvest mortality to litter 1 C (gC/m2/s) - real(r8), pointer :: hrv_gresp_xfer_to_litr1c(:) ! growth respiration transfer harvest mortality to litter 1 C (gC/m2/s) - ! column-level fire fluxes - real(r8), pointer :: m_deadstemc_to_cwdc_fire(:) ! dead stem C to coarse woody debris C by fire (gC/m2/s) - real(r8), pointer :: m_deadcrootc_to_cwdc_fire(:) ! dead coarse root C to to woody debris C by fire (gC/m2/s) - real(r8), pointer :: m_litr1c_to_fire(:) ! litter 1 C fire loss (gC/m2/s) - real(r8), pointer :: m_litr2c_to_fire(:) ! litter 2 C fire loss (gC/m2/s) - real(r8), pointer :: m_litr3c_to_fire(:) ! litter 3 C fire loss (gC/m2/s) - real(r8), pointer :: m_cwdc_to_fire(:) ! coarse woody debris C fire loss (gC/m2/s) - ! litterfall fluxes - real(r8), pointer :: livestemc_to_litr1c(:) ! livestem C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr2c(:) ! livestem C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: livestemc_to_litr3c(:) ! livestem C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr1c(:) ! leaf C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr2c(:) ! leaf C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: leafc_to_litr3c(:) ! leaf C litterfall to litter 3 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr1c(:) ! fine root C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr2c(:) ! fine root C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: frootc_to_litr3c(:) ! fine root C litterfall to litter 3 C (gC/m2/s) - ! litterfall fluxes for prognostic crop model - real(r8), pointer :: grainc_to_litr1c(:) ! grain C litterfall to litter 1 C (gC/m2/s) - real(r8), pointer :: grainc_to_litr2c(:) ! grain C litterfall to litter 2 C (gC/m2/s) - real(r8), pointer :: grainc_to_litr3c(:) ! grain C litterfall to litter 3 C (gC/m2/s) - ! decomposition fluxes - real(r8), pointer :: cwdc_to_litr2c(:) ! decomp. of coarse woody debris C to litter 2 C (gC/m2/s) - real(r8), pointer :: cwdc_to_litr3c(:) ! decomp. of coarse woody debris C to litter 3 C (gC/m2/s) - real(r8), pointer :: litr1_hr(:) ! het. resp. from litter 1 C (gC/m2/s) - real(r8), pointer :: litr1c_to_soil1c(:) ! decomp. of litter 1 C to SOM 1 C (gC/m2/s) - real(r8), pointer :: litr2_hr(:) ! het. resp. from litter 2 C (gC/m2/s) - real(r8), pointer :: litr2c_to_soil2c(:) ! decomp. of litter 2 C to SOM 2 C (gC/m2/s) - real(r8), pointer :: litr3_hr(:) ! het. resp. from litter 3 C (gC/m2/s) - real(r8), pointer :: litr3c_to_soil3c(:) ! decomp. of litter 3 C to SOM 3 C (gC/m2/s) - real(r8), pointer :: soil1_hr(:) ! het. resp. from SOM 1 C (gC/m2/s) - real(r8), pointer :: soil1c_to_soil2c(:) ! decomp. of SOM 1 C to SOM 2 C (gC/m2/s) - real(r8), pointer :: soil2_hr(:) ! het. resp. from SOM 2 C (gC/m2/s) - real(r8), pointer :: soil2c_to_soil3c(:) ! decomp. of SOM 2 C to SOM 3 C (gC/m2/s) - real(r8), pointer :: soil3_hr(:) ! het. resp. from SOM 3 C (gC/m2/s) - real(r8), pointer :: soil3c_to_soil4c(:) ! decomp. of SOM 3 C to SOM 4 C (gC/m2/s) - real(r8), pointer :: soil4_hr(:) ! het. resp. from SOM 4 C (gC/m2/s) - ! dynamic landcover fluxes - real(r8), pointer :: dwt_seedc_to_leaf(:) ! (gC/m2/s) seed source to PFT-level - real(r8), pointer :: dwt_seedc_to_deadstem(:) ! (gC/m2/s) seed source to PFT-level - real(r8), pointer :: dwt_conv_cflux(:) ! (gC/m2/s) conversion C flux (immediate loss to atm) - real(r8), pointer :: dwt_prod10c_gain(:) ! (gC/m2/s) addition to 10-yr wood product pool - real(r8), pointer :: dwt_prod100c_gain(:) ! (gC/m2/s) addition to 100-yr wood product pool - real(r8), pointer :: dwt_frootc_to_litr1c(:) ! (gC/m2/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootc_to_litr2c(:) ! (gC/m2/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootc_to_litr3c(:) ! (gC/m2/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_livecrootc_to_cwdc(:) ! (gC/m2/s) live coarse root to CWD due to landcover change - real(r8), pointer :: dwt_deadcrootc_to_cwdc(:) ! (gC/m2/s) dead coarse root to CWD due to landcover change - real(r8), pointer :: dwt_closs(:) ! (gC/m2/s) total carbon loss from product pools and conversion - real(r8), pointer :: landuseflux(:) ! (gC/m2/s) dwt_closs+product_closs - real(r8), pointer :: landuptake(:) ! (gC/m2/s) nee-landuseflux - ! wood product pool loss fluxes - real(r8), pointer :: prod10c_loss(:) ! (gC/m2/s) decomposition loss from 10-yr wood product pool - real(r8), pointer :: prod100c_loss(:) ! (gC/m2/s) decomposition loss from 100-yr wood product pool - real(r8), pointer :: product_closs(:) ! (gC/m2/s) total wood product carbon loss - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: lithr(:) ! (gC/m2/s) litter heterotrophic respiration - real(r8), pointer :: somhr(:) ! (gC/m2/s) soil organic matter heterotrophic respiration - real(r8), pointer :: hr(:) ! (gC/m2/s) total heterotrophic respiration - real(r8), pointer :: sr(:) ! (gC/m2/s) total soil respiration (HR + root resp) - real(r8), pointer :: er(:) ! (gC/m2/s) total ecosystem respiration, autotrophic + heterotrophic - real(r8), pointer :: litfire(:) ! (gC/m2/s) litter fire losses - real(r8), pointer :: somfire(:) ! (gC/m2/s) soil organic matter fire losses - real(r8), pointer :: totfire(:) ! (gC/m2/s) total ecosystem fire losses - real(r8), pointer :: nep(:) ! (gC/m2/s) net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink - real(r8), pointer :: nbp(:) ! (gC/m2/s) net biome production, includes fire, landuse, and harvest flux, positive for sink - real(r8), pointer :: nee(:) ! (gC/m2/s) net ecosystem exchange of carbon, includes fire, landuse, harvest, and hrv_xsmrpool flux, positive for source - real(r8), pointer :: col_cinputs(:) ! (gC/m2/s) total column-level carbon inputs (for balance check) - real(r8), pointer :: col_coutputs(:) ! (gC/m2/s) total column-level carbon outputs (for balance check) - ! CLAMP summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: cwdc_hr(:) ! (gC/m2/s) col-level coarse woody debris C heterotrophic respiration - real(r8), pointer :: cwdc_loss(:) ! (gC/m2/s) col-level coarse woody debris C loss - real(r8), pointer :: litterc_loss(:) ! (gC/m2/s) col-level litter C loss - ! new variables for fire - real(r8), pointer :: col_fire_closs(:) ! (gC/m2/s) total column-level fire C loss -end type column_cflux_type - -type(column_cflux_type) :: ccf ! column carbon flux -type(column_cflux_type) :: cc13f ! column carbon-13 flux - -!---------------------------------------------------- -! column nitrogen flux variables structure -!---------------------------------------------------- -type, public :: column_nflux_type - ! new variables for CN code - ! deposition fluxes - real(r8), pointer :: ndep_to_sminn(:) ! atmospheric N deposition to soil mineral N (gN/m2/s) - real(r8), pointer :: nfix_to_sminn(:) ! symbiotic/asymbiotic N fixation to soil mineral N (gN/m2/s) - ! column-level gap mortality fluxes - real(r8), pointer :: m_leafn_to_litr1n(:) ! leaf N mortality to litter 1 N (gC/m2/s) - real(r8), pointer :: m_leafn_to_litr2n(:) ! leaf N mortality to litter 2 N (gC/m2/s) - real(r8), pointer :: m_leafn_to_litr3n(:) ! leaf N mortality to litter 3 N (gC/m2/s) - real(r8), pointer :: m_frootn_to_litr1n(:) ! fine root N mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_frootn_to_litr2n(:) ! fine root N mortality to litter 2 N (gN/m2/s) - real(r8), pointer :: m_frootn_to_litr3n(:) ! fine root N mortality to litter 3 N (gN/m2/s) - real(r8), pointer :: m_livestemn_to_cwdn(:) ! live stem N mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: m_deadstemn_to_cwdn(:) ! dead stem N mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: m_livecrootn_to_cwdn(:) ! live coarse root N mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_cwdn(:) ! dead coarse root N mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: m_retransn_to_litr1n(:) ! retranslocated N pool mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_leafn_storage_to_litr1n(:) ! leaf N storage mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_frootn_storage_to_litr1n(:) ! fine root N storage mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_livestemn_storage_to_litr1n(:) ! live stem N storage mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_deadstemn_storage_to_litr1n(:) ! dead stem N storage mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_livecrootn_storage_to_litr1n(:) ! live coarse root N storage mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_deadcrootn_storage_to_litr1n(:) ! dead coarse root N storage mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_leafn_xfer_to_litr1n(:) ! leaf N transfer mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_frootn_xfer_to_litr1n(:) ! fine root N transfer mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_livestemn_xfer_to_litr1n(:) ! live stem N transfer mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_deadstemn_xfer_to_litr1n(:) ! dead stem N transfer mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_livecrootn_xfer_to_litr1n(:) ! live coarse root N transfer mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: m_deadcrootn_xfer_to_litr1n(:) ! dead coarse root N transfer mortality to litter 1 N (gN/m2/s) - ! column-level harvest fluxes - real(r8), pointer :: hrv_leafn_to_litr1n(:) ! leaf N harvest mortality to litter 1 N (gC/m2/s) - real(r8), pointer :: hrv_leafn_to_litr2n(:) ! leaf N harvest mortality to litter 2 N (gC/m2/s) - real(r8), pointer :: hrv_leafn_to_litr3n(:) ! leaf N harvest mortality to litter 3 N (gC/m2/s) - real(r8), pointer :: hrv_frootn_to_litr1n(:) ! fine root N harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_frootn_to_litr2n(:) ! fine root N harvest mortality to litter 2 N (gN/m2/s) - real(r8), pointer :: hrv_frootn_to_litr3n(:) ! fine root N harvest mortality to litter 3 N (gN/m2/s) - real(r8), pointer :: hrv_livestemn_to_cwdn(:) ! live stem N harvest mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_to_prod10n(:) ! dead stem N harvest mortality to 10-year product pool (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_to_prod100n(:) ! dead stem N harvest mortality to 100-year product pool (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_to_cwdn(:) ! live coarse root N harvest mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_to_cwdn(:) ! dead coarse root N harvest mortality to coarse woody debris N (gN/m2/s) - real(r8), pointer :: hrv_retransn_to_litr1n(:) ! retranslocated N pool harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_leafn_storage_to_litr1n(:) ! leaf N storage harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_frootn_storage_to_litr1n(:) ! fine root N storage harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_livestemn_storage_to_litr1n(:) ! live stem N storage harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_storage_to_litr1n(:) ! dead stem N storage harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_storage_to_litr1n(:) ! live coarse root N storage harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_storage_to_litr1n(:) ! dead coarse root N storage harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_leafn_xfer_to_litr1n(:) ! leaf N transfer harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_frootn_xfer_to_litr1n(:) ! fine root N transfer harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_livestemn_xfer_to_litr1n(:) ! live stem N transfer harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_deadstemn_xfer_to_litr1n(:) ! dead stem N transfer harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_livecrootn_xfer_to_litr1n(:) ! live coarse root N transfer harvest mortality to litter 1 N (gN/m2/s) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litr1n(:) ! dead coarse root N transfer harvest mortality to litter 1 N (gN/m2/s) - ! column-level fire fluxes - real(r8), pointer :: m_deadstemn_to_cwdn_fire(:) ! dead stem N to coarse woody debris N by fire (gN/m2/s) - real(r8), pointer :: m_deadcrootn_to_cwdn_fire(:) ! dead coarse root N to to woody debris N by fire (gN/m2/s) - real(r8), pointer :: m_litr1n_to_fire(:) ! litter 1 N fire loss (gN/m2/s) - real(r8), pointer :: m_litr2n_to_fire(:) ! litter 2 N fire loss (gN/m2/s) - real(r8), pointer :: m_litr3n_to_fire(:) ! litter 3 N fire loss (gN/m2/s) - real(r8), pointer :: m_cwdn_to_fire(:) ! coarse woody debris N fire loss (gN/m2/s) - ! litterfall fluxes - real(r8), pointer :: livestemn_to_litr1n(:) ! livestem N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr2n(:) ! livestem N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: livestemn_to_litr3n(:) ! livestem N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr1n(:) ! leaf N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr2n(:) ! leaf N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: leafn_to_litr3n(:) ! leaf N litterfall to litter 3 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr1n(:) ! fine root N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr2n(:) ! fine root N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: frootn_to_litr3n(:) ! fine root N litterfall to litter 3 N (gN/m2/s) - ! litterfall fluxes for prognostic crop model - real(r8), pointer :: grainn_to_litr1n(:) ! grain N litterfall to litter 1 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr2n(:) ! grain N litterfall to litter 2 N (gN/m2/s) - real(r8), pointer :: grainn_to_litr3n(:) ! grain N litterfall to litter 3 N (gN/m2/s) - ! decomposition fluxes - real(r8), pointer :: cwdn_to_litr2n(:) ! decomp. of coarse woody debris N to litter 2 N (gN/m2/s) - real(r8), pointer :: cwdn_to_litr3n(:) ! decomp. of coarse woody debris N to litter 3 N (gN/m2/s) - real(r8), pointer :: litr1n_to_soil1n(:) ! decomp. of litter 1 N to SOM 1 N (gN/m2/s) - real(r8), pointer :: sminn_to_soil1n_l1(:) ! mineral N flux for decomp. of litter 1 to SOM 1 (gN/m2/s) - real(r8), pointer :: litr2n_to_soil2n(:) ! decomp. of litter 2 N to SOM 2 N (gN/m2/s) - real(r8), pointer :: sminn_to_soil2n_l2(:) ! mineral N flux for decomp. of litter 2 to SOM 2 (gN/m2/s) - real(r8), pointer :: litr3n_to_soil3n(:) ! decomp. of litter 3 N to SOM 3 N (gN/m2/s) - real(r8), pointer :: sminn_to_soil3n_l3(:) ! mineral N flux for decomp. of litter 3 to SOM 3 (gN/m2/s) - real(r8), pointer :: soil1n_to_soil2n(:) ! decomp. of SOM 1 N to SOM 2 N (gN/m2/s) - real(r8), pointer :: sminn_to_soil2n_s1(:) ! mineral N flux for decomp. of SOM 1 to SOM 2 (gN/m2/s) - real(r8), pointer :: soil2n_to_soil3n(:) ! decomp. of SOM 2 N to SOM 3 N (gN/m2/s) - real(r8), pointer :: sminn_to_soil3n_s2(:) ! mineral N flux for decomp. of SOM 2 to SOM 3 (gN/m2/s) - real(r8), pointer :: soil3n_to_soil4n(:) ! decomp. of SOM 3 N to SOM 4 N (gN/m2/s) - real(r8), pointer :: sminn_to_soil4n_s3(:) ! mineral N flux for decomp. of SOM 3 to SOM 4 (gN/m2/s) - real(r8), pointer :: soil4n_to_sminn(:) ! N mineralization for decomp. of SOM 4 (gN/m2/s) - ! denitrification fluxes - real(r8), pointer :: sminn_to_denit_l1s1(:) ! denitrification for decomp. of litter 1 to SOM 1 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_l2s2(:) ! denitrification for decomp. of litter 2 to SOM 2 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_l3s3(:) ! denitrification for decomp. of litter 3 to SOM 3 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_s1s2(:) ! denitrification for decomp. of SOM 1 to SOM 2 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_s2s3(:) ! denitrification for decomp. of SOM 2 to SOM 3 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_s3s4(:) ! denitrification for decomp. of SOM 3 to SOM 4 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_s4(:) ! denitrification for decomp. of SOM 4 (gN/m2/s) - real(r8), pointer :: sminn_to_denit_excess(:) ! denitrification from excess mineral N pool (gN/m2/s) - ! leaching fluxes - real(r8), pointer :: sminn_leached(:) ! soil mineral N pool loss to leaching (gN/m2/s) - ! dynamic landcover fluxes - real(r8), pointer :: dwt_seedn_to_leaf(:) ! (gN/m2/s) seed source to PFT-level - real(r8), pointer :: dwt_seedn_to_deadstem(:) ! (gN/m2/s) seed source to PFT-level - real(r8), pointer :: dwt_conv_nflux(:) ! (gN/m2/s) conversion N flux (immediate loss to atm) - real(r8), pointer :: dwt_prod10n_gain(:) ! (gN/m2/s) addition to 10-yr wood product pool - real(r8), pointer :: dwt_prod100n_gain(:) ! (gN/m2/s) addition to 100-yr wood product pool - real(r8), pointer :: dwt_frootn_to_litr1n(:) ! (gN/m2/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootn_to_litr2n(:) ! (gN/m2/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_frootn_to_litr3n(:) ! (gN/m2/s) fine root to litter due to landcover change - real(r8), pointer :: dwt_livecrootn_to_cwdn(:) ! (gN/m2/s) live coarse root to CWD due to landcover change - real(r8), pointer :: dwt_deadcrootn_to_cwdn(:) ! (gN/m2/s) dead coarse root to CWD due to landcover change - real(r8), pointer :: dwt_nloss(:) ! (gN/m2/s) total nitrogen loss from product pools and conversion - ! wood product pool loss fluxes - real(r8), pointer :: prod10n_loss(:) ! (gN/m2/s) decomposition loss from 10-yr wood product pool - real(r8), pointer :: prod100n_loss(:) ! (gN/m2/s) decomposition loss from 100-yr wood product pool - real(r8), pointer :: product_nloss(:) ! (gN/m2/s) total wood product nitrogen loss - ! summary (diagnostic) flux variables, not involved in mass balance - real(r8), pointer :: potential_immob(:) ! potential N immobilization (gN/m2/s) - real(r8), pointer :: actual_immob(:) ! actual N immobilization (gN/m2/s) - real(r8), pointer :: sminn_to_plant(:) ! plant uptake of soil mineral N (gN/m2/s) - real(r8), pointer :: supplement_to_sminn(:) ! supplemental N supply (gN/m2/s) - real(r8), pointer :: gross_nmin(:) ! gross rate of N mineralization (gN/m2/s) - real(r8), pointer :: net_nmin(:) ! net rate of N mineralization (gN/m2/s) - real(r8), pointer :: denit(:) ! total rate of denitrification (gN/m2/s) - real(r8), pointer :: col_ninputs(:) ! column-level N inputs (gN/m2/s) - real(r8), pointer :: col_noutputs(:) ! column-level N outputs (gN/m2/s) - ! new variables for fire - real(r8), pointer :: col_fire_nloss(:) ! total column-level fire N loss (gN/m2/s) -end type column_nflux_type - -type(column_nflux_type) :: cnf !column nitrogen flux - -!---------------------------------------------------- -! column dust flux variables structure -!---------------------------------------------------- -type, public :: column_dflux_type - real(r8), pointer :: dummy_entry(:) -end type column_dflux_type - -!---------------------------------------------------- -! End definition of structures defined at the column_type level -!---------------------------------------------------- -!******************************************************************************* - - -!******************************************************************************* -!---------------------------------------------------- -! Begin definition of structures defined at the landunit_type level -!---------------------------------------------------- -!---------------------------------------------------- -! landunit physical state variables structure -!---------------------------------------------------- -! note - landunit type can be vegetated (includes bare soil), deep lake, -! shallow lake, wetland, glacier or urban -type, public :: landunit_pstate_type - ! Urban variables - real(r8), pointer :: t_building(:) ! internal building temperature (K) - real(r8), pointer :: t_building_max(:) ! maximum internal building temperature (K) - real(r8), pointer :: t_building_min(:) ! minimum internal building temperature (K) - real(r8), pointer :: tk_wall(:,:) ! thermal conductivity of urban wall (W/m/K) - real(r8), pointer :: tk_roof(:,:) ! thermal conductivity of urban roof (W/m/K) - real(r8), pointer :: tk_improad(:,:) ! thermal conductivity of urban impervious road (W/m/K) - real(r8), pointer :: cv_wall(:,:) ! heat capacity of urban wall (J/m^3/K) - real(r8), pointer :: cv_roof(:,:) ! heat capacity of urban roof (J/m^3/K) - real(r8), pointer :: cv_improad(:,:) ! heat capacity of urban impervious road (J/m^3/K) - real(r8), pointer :: thick_wall(:) ! total thickness of urban wall (m) - real(r8), pointer :: thick_roof(:) ! total thickness of urban roof (m) - integer , pointer :: nlev_improad(:) ! number of impervious road layers (-) - real(r8), pointer :: vf_sr(:) ! view factor of sky for road - real(r8), pointer :: vf_wr(:) ! view factor of one wall for road - real(r8), pointer :: vf_sw(:) ! view factor of sky for one wall - real(r8), pointer :: vf_rw(:) ! view factor of road for one wall - real(r8), pointer :: vf_ww(:) ! view factor of opposing wall for one wall - real(r8), pointer :: taf(:) ! urban canopy air temperature (K) - real(r8), pointer :: qaf(:) ! urban canopy air specific humidity (kg/kg) - real(r8), pointer :: sabs_roof_dir(:,:) ! direct solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_roof_dif(:,:) ! diffuse solar absorbed by roof per unit ground area per unit incident flux - real(r8), pointer :: sabs_sunwall_dir(:,:) ! direct solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_sunwall_dif(:,:) ! diffuse solar absorbed by sunwall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dir(:,:) ! direct solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_shadewall_dif(:,:) ! diffuse solar absorbed by shadewall per unit wall area per unit incident flux - real(r8), pointer :: sabs_improad_dir(:,:) ! direct solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_improad_dif(:,:) ! diffuse solar absorbed by impervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dir(:,:) ! direct solar absorbed by pervious road per unit ground area per unit incident flux - real(r8), pointer :: sabs_perroad_dif(:,:) ! diffuse solar absorbed by pervious road per unit ground area per unit incident flux -end type landunit_pstate_type - -type(landunit_pstate_type) :: lps !land unit physical state variables - -!---------------------------------------------------- -! landunit energy flux variables structure -!---------------------------------------------------- -type, public :: landunit_eflux_type - ! Urban variables - real(r8), pointer :: eflx_traffic_factor(:) ! multiplicative traffic factor for sensible heat flux from urban traffic (-) - real(r8), pointer :: eflx_traffic(:) ! traffic sensible heat flux (W/m**2) - real(r8), pointer :: eflx_wasteheat(:) ! sensible heat flux from domestic heating/cooling sources of waste heat (W/m**2) - real(r8), pointer :: eflx_heat_from_ac(:) ! sensible heat flux to be put back into canyon due to removal by AC (W/m**2) -end type landunit_eflux_type - -type(landunit_eflux_type) :: lef ! average of energy fluxes all columns - -!---------------------------------------------------- -! End definition of structures defined at the landunit_type level -!---------------------------------------------------- -!******************************************************************************* - -!******************************************************************************* -!---------------------------------------------------- -! Begin definition of structures defined at the gridcell_type level -!---------------------------------------------------- -! gridcell physical state variables structure -!---------------------------------------------------- -type, public :: gridcell_pstate_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_pstate_type - -!---------------------------------------------------- -! gridcell energy state variables structure -!---------------------------------------------------- -type, public :: gridcell_estate_type - real(r8), pointer :: gc_heat1(:) ! initial gridcell total heat content - real(r8), pointer :: gc_heat2(:) ! post land cover change total heat content -end type gridcell_estate_type - -type(gridcell_estate_type) :: ges !average of energy states all landunits - -!---------------------------------------------------- -! gridcell water state variables structure -!---------------------------------------------------- -type, public :: gridcell_wstate_type - real(r8), pointer :: gc_liq1(:) ! initial gridcell total h2o liq content - real(r8), pointer :: gc_liq2(:) ! post land cover change total liq content - real(r8), pointer :: gc_ice1(:) ! initial gridcell total h2o liq content - real(r8), pointer :: gc_ice2(:) ! post land cover change total ice content -end type gridcell_wstate_type - -type(gridcell_wstate_type) :: gws !average of water states all landunits - -!---------------------------------------------------- -! gridcell carbon state variables structure -!---------------------------------------------------- -type, public :: gridcell_cstate_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_cstate_type - -type(column_cstate_type):: ccs_a !column-level carbon state variables averaged to gridcell - -!---------------------------------------------------- -! gridcell nitrogen state variables structure -!---------------------------------------------------- -type, public :: gridcell_nstate_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_nstate_type - -type(column_nstate_type):: cns_a !column-level nitrogen state variables averaged to gridcell - -!---------------------------------------------------- -! gridcell VOC state variables structure -!---------------------------------------------------- -type, public :: gridcell_vstate_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_vstate_type - -type(column_vstate_type):: cvs_a !column-level VOC state variables averaged to gridcell - -!---------------------------------------------------- -! gridcell VOC emission factor variables structure (heald) -!---------------------------------------------------- -type, public :: gridcell_efstate_type - real(r8), pointer :: efisop(:,:) ! isoprene emission factors -end type gridcell_efstate_type -type(gridcell_efstate_type):: gve !gridcell VOC emission factors - -!---------------------------------------------------- -! gridcell dust state variables structure -!---------------------------------------------------- -type, public :: gridcell_dstate_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_dstate_type - -!---------------------------------------------------- -! gridcell DGVM state variables structure -!---------------------------------------------------- -type, public :: gridcell_dgvstate_type - real(r8), pointer :: agdd20(:) !20-yr running mean of agdd - real(r8), pointer :: tmomin20(:) !20-yr running mean of tmomin - real(r8), pointer :: t10min(:) !ann minimum of 10-day running mean (K) -end type gridcell_dgvstate_type - -type(gridcell_dgvstate_type):: gdgvs !gridcell DGVM structure - -!---------------------------------------------------- -! gridcell energy flux variables structure -!---------------------------------------------------- -type, public :: gridcell_eflux_type - real(r8), pointer :: eflx_sh_totg(:) ! total grid-level sensible heat flux - real(r8), pointer :: eflx_dynbal(:) ! dynamic land cover change conversion energy flux -end type gridcell_eflux_type - -type(gridcell_eflux_type) :: gef !average of energy fluxes all landunits - -!---------------------------------------------------- -! gridcell momentum flux variables structure -!-- ------------------------------------------------- -type, public :: gridcell_mflux_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_mflux_type - -!---------------------------------------------------- -! gridcell water flux variables structure -!---------------------------------------------------- -type, public :: gridcell_wflux_type - real(r8), pointer :: qflx_runoffg(:) ! total grid-level liq runoff - real(r8), pointer :: qflx_snwcp_iceg(:) ! total grid-level ice runoff - real(r8), pointer :: qflx_liq_dynbal(:) ! liq dynamic land cover change conversion runoff flux - real(r8), pointer :: qflx_ice_dynbal(:) ! ice dynamic land cover change conversion runoff flux - real(r8), pointer :: qflx_floodg(:) ! total grid-level flood water flux -end type gridcell_wflux_type - -type(gridcell_wflux_type) :: gwf !average of water fluxes all landunits - -!---------------------------------------------------- -! gridcell carbon flux variables structure -!---------------------------------------------------- -type, public :: gridcell_cflux_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_cflux_type - -!---------------------------------------------------- -! gridcell nitrogen flux variables structure -!---------------------------------------------------- -type, public :: gridcell_nflux_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_nflux_type - -!---------------------------------------------------- -! gridcell dust flux variables structure -!---------------------------------------------------- -type, public :: gridcell_dflux_type - real(r8), pointer :: dummy_entry(:) -end type gridcell_dflux_type - -!---------------------------------------------------- -! End definition of structures defined at the gridcell_type level -!---------------------------------------------------- -!******************************************************************************* - -!******************************************************************************* -!---------------------------------------------------- -! define the pft structure -!---------------------------------------------------- -type, public :: pft_type - integer , pointer :: column(:) !index into column level quantities - real(r8), pointer :: wtcol(:) !weight (relative to column) - integer , pointer :: landunit(:) !index into landunit level quantities - real(r8), pointer :: wtlunit(:) !weight (relative to landunit) - integer , pointer :: gridcell(:) !index into gridcell level quantities - real(r8), pointer :: wtgcell(:) !weight (relative to gridcell) - integer , pointer :: itype(:) !pft vegetation - integer , pointer :: mxy(:) !m index for laixy(i,j,m),etc. -end type pft_type - -type(pft_type), target :: pft !plant functional type (pft) data structure - -!---------------------------------------------------- -! define the column structure -!---------------------------------------------------- -type, public :: column_type - integer , pointer :: landunit(:) !index into landunit level quantities - real(r8), pointer :: wtlunit(:) !weight (relative to landunit) - integer , pointer :: gridcell(:) !index into gridcell level quantities - real(r8), pointer :: wtgcell(:) !weight (relative to gridcell) - integer , pointer :: pfti(:) !beginning pft index for each column - integer , pointer :: pftf(:) !ending pft index for each column - integer , pointer :: npfts(:) !number of pfts for each column - integer , pointer :: itype(:) !column type -end type column_type - -type(column_type), target :: col !column data structure (soil/snow/canopy columns) - -!---------------------------------------------------- -! define the geomorphological land unit structure -!---------------------------------------------------- -type, public :: landunit_type - integer , pointer :: gridcell(:) !index into gridcell level quantities - real(r8), pointer :: wtgcell(:) !weight (relative to gridcell) - integer , pointer :: coli(:) !beginning column index per landunit - integer , pointer :: colf(:) !ending column index for each landunit - integer , pointer :: ncolumns(:) !number of columns for each landunit - integer , pointer :: pfti(:) !beginning pft index for each landunit - integer , pointer :: pftf(:) !ending pft index for each landunit - integer , pointer :: npfts(:) !number of pfts for each landunit - integer , pointer :: itype(:) !landunit type - logical , pointer :: ifspecial(:) !BOOL: true=>landunit is not vegetated - logical , pointer :: lakpoi(:) !BOOL: true=>lake point - logical , pointer :: urbpoi(:) !BOOL: true=>urban point - logical , pointer :: glcmecpoi(:) !BOOL: true=>glacier_mec point - - ! Urban canyon related properties - real(r8), pointer :: canyon_hwr(:) ! urban landunit canyon height to width ratio (-) - real(r8), pointer :: wtroad_perv(:) ! urban landunit weight of pervious road column to total road (-) - real(r8), pointer :: wtlunit_roof(:) ! weight of roof with respect to urban landunit (-) - - ! Urban related info MV - this should be moved to land physical state - MV - real(r8), pointer :: ht_roof(:) ! height of urban roof (m) - real(r8), pointer :: wind_hgt_canyon(:)! height above road at which wind in canyon is to be computed (m) - real(r8), pointer :: z_0_town(:) ! urban landunit momentum roughness length (m) - real(r8), pointer :: z_d_town(:) ! urban landunit displacement height (m) -end type landunit_type - -type(landunit_type), target :: lun !geomorphological landunits - -!---------------------------------------------------- -! define the gridcell structure -!---------------------------------------------------- -type, public :: gridcell_type - integer , pointer :: luni(:) !beginning landunit index - integer , pointer :: lunf(:) !ending landunit index - integer , pointer :: nlandunits(:) !number of landunit for each gridcell - integer , pointer :: coli(:) !beginning column index - integer , pointer :: colf(:) !ending column index - integer , pointer :: ncolumns(:) !number of columns for each gridcell - integer , pointer :: pfti(:) !beginning pft index - integer , pointer :: pftf(:) !ending pft index - integer , pointer :: npfts(:) !number of pfts for each gridcell - integer , pointer :: gindex(:) !global index - real(r8), pointer :: area(:) !total land area, gridcell (km^2) - real(r8), pointer :: lat(:) !latitude (radians) - real(r8), pointer :: lon(:) !longitude (radians) - real(r8), pointer :: latdeg(:) !latitude (degrees) - real(r8), pointer :: londeg(:) !longitude (degrees) - real(r8), pointer :: gris_mask(:) !Greenland ice sheet mask - real(r8), pointer :: gris_area(:) !Greenland ice-covered area per gridcell (km^2) - real(r8), pointer :: aais_mask(:) !Antarctic ice sheet mask - real(r8), pointer :: aais_area(:) !Antarctic ice-covered area per gridcell (km^2) -end type gridcell_type - -type(gridcell_type), target :: grc !gridcell data structure - -!---------------------------------------------------- -! End definition of spatial scaling hierarchy -!---------------------------------------------------- - -character(len=16), parameter, public :: grlnd = 'lndgrid' ! name of lndgrid -character(len=16), parameter, public :: namea = 'gridcellatm' ! name of atmgrid -character(len=16), parameter, public :: nameg = 'gridcell' ! name of gridcells -character(len=16), parameter, public :: namel = 'landunit' ! name of landunits -character(len=16), parameter, public :: namec = 'column' ! name of columns -character(len=16), parameter, public :: namep = 'pft' ! name of pfts - -! -!EOP -!----------------------------------------------------------------------- -end module clmtype diff --git a/src_clm40/main/clmtypeInitMod.F90 b/src_clm40/main/clmtypeInitMod.F90 deleted file mode 100644 index f31c1dec28..0000000000 --- a/src_clm40/main/clmtypeInitMod.F90 +++ /dev/null @@ -1,4116 +0,0 @@ -module clmtypeInitMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: clmtypeInitMod -! -! !DESCRIPTION: -! Allocate clmtype components and initialize them to signaling NaN. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) - use clmtype - use clm_varpar , only : maxpatch_pft, nlevsno, nlevgrnd, numrad, nlevlak, & - numpft, ndst, nlevurb, nlevsoi - use clm_varctl , only : use_c13, use_cn, use_cndv, use_crop -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: initClmtype -! -! !REVISION HISTORY: -! Created by Peter Thornton and Mariana Vertenstein -! Modified by Colette L. Heald (05/06) for VOC emission factors -! 3/17/08 David Lawrence, changed nlevsoi to nlevgrnd where appropriate -! -! !PRIVATE MEMBER FUNCTIONS: - private :: init_pft_type - private :: init_column_type - private :: init_landunit_type - private :: init_gridcell_type - private :: init_energy_balance_type - private :: init_water_balance_type - private :: init_pft_ecophys_constants - private :: init_pft_DGVMecophys_constants - private :: init_pft_pstate_type - private :: init_pft_epv_type - private :: init_pft_pdgvstate_type - private :: init_pft_vstate_type - private :: init_pft_estate_type - private :: init_pft_wstate_type - private :: init_pft_cstate_type - private :: init_pft_nstate_type - private :: init_pft_eflux_type - private :: init_pft_mflux_type - private :: init_pft_wflux_type - private :: init_pft_cflux_type - private :: init_pft_nflux_type - private :: init_pft_vflux_type - private :: init_pft_dflux_type - private :: init_pft_depvd_type - private :: init_column_pstate_type - private :: init_column_estate_type - private :: init_column_wstate_type - private :: init_column_cstate_type - private :: init_column_nstate_type - private :: init_column_eflux_type - private :: init_column_wflux_type - private :: init_column_cflux_type - private :: init_column_nflux_type - private :: init_landunit_pstate_type - private :: init_landunit_eflux_type - private :: init_gridcell_pstate_type - private :: init_gridcell_efstate_type - private :: init_gridcell_wflux_type -!EOP -!---------------------------------------------------- - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: initClmtype -! -! !INTERFACE: - subroutine initClmtype() -! -! !DESCRIPTION: -! Initialize clmtype components to signaling nan -! The following clmtype components should NOT be initialized here -! since they are set in routine clm_map which is called before this -! routine is invoked -! *%area, *%wt, *%wtlnd, *%wtxy, *%ixy, *%jxy, *%mxy, %snindex -! *%ifspecial, *%ityplun, *%itype -! *%pfti, *%pftf, *%pftn -! *%coli, *%colf, *%coln -! *%luni, *%lunf, *%lunn -! -! !USES: - use abortutils, only : endrun - use decompMod , only : get_proc_bounds, get_proc_global -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -! -! LOCAL VARAIBLES: - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - character(len=32), parameter :: subname = "initClmtype" -!------------------------------------------------------------------------ - - ! Determine necessary indices - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - call get_proc_global(numg, numl, numc, nump) - - call init_pft_type (begp, endp, pft) - call init_column_type (begc, endc, col) - call init_landunit_type(begl, endl, lun) - call init_gridcell_type(begg, endg, grc) - - ! pft ecophysiological constants - - call init_pft_ecophys_constants() - - ! pft DGVM-specific ecophysiological constants - - if (use_cndv) then - call init_pft_DGVMecophys_constants() - end if - - ! energy balance structures (all levels) - - call init_energy_balance_type(begp, endp, pebal) - call init_energy_balance_type(begc, endc, cebal) - - ! water balance structures (all levels) - - call init_water_balance_type(begp, endp, pwbal) - call init_water_balance_type(begc, endc, cwbal) - - ! carbon balance structures (pft and column levels) - - call init_carbon_balance_type(begp, endp, pcbal) - call init_carbon_balance_type(begc, endc, ccbal) - - ! nitrogen balance structures (pft and column levels) - - call init_nitrogen_balance_type(begp, endp, pnbal) - call init_nitrogen_balance_type(begc, endc, cnbal) - - ! pft physical state variables at pft level and averaged to the column - - call init_pft_pstate_type(begp, endp, pps) - call init_pft_pstate_type(begc, endc, pps_a) - - ! pft ecophysiological variables (only at the pft level for now) - call init_pft_epv_type(begp, endp, pepv) - - ! pft DGVM state variables at pft level - - if (use_cndv) then - call init_pft_pdgvstate_type(begp, endp, pdgvs) - end if - call init_pft_vstate_type(begp, endp, pvs) - - ! pft energy state variables at the pft level - - call init_pft_estate_type(begp, endp, pes) - - ! pft water state variables at the pft level and averaged to the column - - call init_pft_wstate_type(begp, endp, pws) - call init_pft_wstate_type(begc, endc, pws_a) - - ! pft carbon state variables at the pft level and averaged to the column - - call init_pft_cstate_type(begp, endp, pcs) - call init_pft_cstate_type(begc, endc, pcs_a) - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - call init_pft_cstate_type(begp, endp, pc13s) - call init_pft_cstate_type(begc, endc, pc13s_a) - if (use_crop) then - call endrun( trim(subname)//" ERROR:: CROP and C13 can NOT be on at the same time" ) - end if - endif - - ! pft nitrogen state variables at the pft level and averaged to the column - - call init_pft_nstate_type(begp, endp, pns) - call init_pft_nstate_type(begc, endc, pns_a) - - ! pft energy flux variables at pft level - - call init_pft_eflux_type(begp, endp, pef) - - ! pft momentum flux variables at pft level - - call init_pft_mflux_type(begp, endp, pmf) - - ! pft water flux variables - - call init_pft_wflux_type(begp, endp, pwf) - call init_pft_wflux_type(begc, endc, pwf_a) - - ! pft carbon flux variables at pft level and averaged to column - - call init_pft_cflux_type(begp, endp, pcf) - call init_pft_cflux_type(begc, endc, pcf_a) - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - call init_pft_cflux_type(begp, endp, pc13f) - call init_pft_cflux_type(begc, endc, pc13f_a) - endif - - ! pft nitrogen flux variables at pft level and averaged to column - - call init_pft_nflux_type(begp, endp, pnf) - call init_pft_nflux_type(begc, endc, pnf_a) - - ! pft VOC flux variables at pft level - - call init_pft_vflux_type(begp, endp, pvf) - - ! gridcell VOC emission factors (heald, 05/06) - - call init_gridcell_efstate_type(begg, endg, gve) - - ! pft dust flux variables at pft level - - call init_pft_dflux_type(begp, endp, pdf) - - ! pft dry dep velocity variables at pft level - - call init_pft_depvd_type(begp, endp, pdd) - - ! column physical state variables at column level - - call init_column_pstate_type(begc, endc, cps) - - ! column energy state variables at column level - - - call init_column_estate_type(begc, endc, ces) - - ! column water state variables at column level - - call init_column_wstate_type(begc, endc, cws) - - ! column carbon state variables at column level - - call init_column_cstate_type(begc, endc, ccs) - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - call init_column_cstate_type(begc, endc, cc13s) - endif - - ! column nitrogen state variables at column level - - call init_column_nstate_type(begc, endc, cns) - - ! column energy flux variables at column level - - call init_column_eflux_type(begc, endc, cef) - - ! column water flux variables at column level - - call init_column_wflux_type(begc, endc, cwf) - - ! column carbon flux variables at column level - - call init_column_cflux_type(begc, endc, ccf) - if (use_c13) then - ! 4/14/05: PET - ! Adding isotope code - call init_column_cflux_type(begc, endc, cc13f) - endif - - ! column nitrogen flux variables at column level - - call init_column_nflux_type(begc, endc, cnf) - - ! land unit physical state variables - - call init_landunit_pstate_type(begl, endl, lps) - - ! land unit energy flux variables - - call init_landunit_eflux_type(begl, endl, lef) - - ! gridcell DGVM variables - - if (use_cndv) then - call init_gridcell_dgvstate_type(begg, endg, gdgvs) - end if - - ! gridcell physical state variables - - - ! gridcell: water flux variables - - call init_gridcell_wflux_type(begg, endg, gwf) - - ! gridcell: energy flux variables - - call init_gridcell_eflux_type(begg, endg, gef) - - ! gridcell: water state variables - - call init_gridcell_wstate_type(begg, endg, gws) - - ! gridcell: energy state variables - - call init_gridcell_estate_type(begg, endg, ges) - - end subroutine initClmtype - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_type -! -! !INTERFACE: - subroutine init_pft_type (beg, end, p) -! -! !DESCRIPTION: -! Initialize components of pft_type structure -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(pft_type), intent(inout):: p -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pft%gridcell(beg:end),& - pft%wtgcell(beg:end), & - pft%landunit(beg:end),& - pft%wtlunit(beg:end), & - pft%column(beg:end), & - pft%wtcol(beg:end), & - pft%itype(beg:end), & - pft%mxy(beg:end)) - - end subroutine init_pft_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_type -! -! !INTERFACE: - subroutine init_column_type (beg, end, c) -! -! !DESCRIPTION: -! Initialize components of column_type structure -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(column_type), intent(inout):: c -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(col%gridcell(beg:end),& - col%wtgcell(beg:end), & - col%landunit(beg:end),& - col%wtlunit(beg:end), & - col%pfti(beg:end), & - col%pftf(beg:end), & - col%npfts(beg:end), & - col%itype(beg:end)) - - end subroutine init_column_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_landunit_type -! -! !INTERFACE: - subroutine init_landunit_type (beg, end,l) -! -! !DESCRIPTION: -! Initialize components of landunit_type structure -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(landunit_type), intent(inout):: l -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(lun%gridcell(beg:end), & - lun%wtgcell(beg:end), & - lun%coli(beg:end), & - lun%colf(beg:end), & - lun%ncolumns(beg:end), & - lun%pfti(beg:end), & - lun%pftf(beg:end), & - lun%npfts(beg:end), & - lun%itype(beg:end), & - lun%ifspecial(beg:end),& - lun%lakpoi(beg:end), & - lun%urbpoi(beg:end), & - lun%glcmecpoi(beg:end)) - - ! These should be moved to landunit physical state - allocate(lun%canyon_hwr(beg:end), & - lun%wtroad_perv(beg:end), & - lun%ht_roof(beg:end), & - lun%wtlunit_roof(beg:end), & - lun%wind_hgt_canyon(beg:end),& - lun%z_0_town(beg:end), & - lun%z_d_town(beg:end)) - - lun%canyon_hwr(beg:end) = nan - lun%wtroad_perv(beg:end) = nan - lun%ht_roof(beg:end) = nan - lun%wtlunit_roof(beg:end) = nan - lun%wind_hgt_canyon(beg:end)= nan - lun%z_0_town(beg:end) = nan - lun%z_d_town(beg:end) = nan - - lun%glcmecpoi(beg:end) = .false. - - end subroutine init_landunit_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_type -! -! !INTERFACE: - subroutine init_gridcell_type (beg, end,g) -! -! !DESCRIPTION: -! Initialize components of gridcell_type structure -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(gridcell_type), intent(inout):: g -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(grc%luni(beg:end), & - grc%lunf(beg:end), & - grc%nlandunits(beg:end),& - grc%coli(beg:end), & - grc%colf(beg:end), & - grc%ncolumns(beg:end), & - grc%pfti(beg:end), & - grc%pftf(beg:end), & - grc%npfts(beg:end), & - grc%gindex(beg:end), & - grc%area(beg:end), & - grc%lat(beg:end), & - grc%lon(beg:end), & - grc%latdeg(beg:end), & - grc%londeg(beg:end), & - grc%gris_mask(beg:end), & - grc%gris_area(beg:end), & - grc%aais_mask(beg:end), & - grc%aais_area(beg:end)) - - grc%gris_mask(beg:end) = nan - grc%gris_area(beg:end) = nan - grc%aais_mask(beg:end) = nan - grc%aais_area(beg:end) = nan - - end subroutine init_gridcell_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_energy_balance_type -! -! !INTERFACE: - subroutine init_energy_balance_type(beg, end, ebal) -! -! !DESCRIPTION: -! Initialize energy balance variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(energy_balance_type), intent(inout):: ebal -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(ebal%errsoi(beg:end)) - allocate(ebal%errseb(beg:end)) - allocate(ebal%errsol(beg:end)) - allocate(ebal%errlon(beg:end)) - - ebal%errsoi(beg:end) = nan - ebal%errseb(beg:end) = nan - ebal%errsol(beg:end) = nan - ebal%errlon(beg:end) = nan - - end subroutine init_energy_balance_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_water_balance_type -! -! !INTERFACE: - subroutine init_water_balance_type(beg, end, wbal) -! -! !DESCRIPTION: -! Initialize water balance variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(water_balance_type), intent(inout):: wbal -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(wbal%begwb(beg:end)) - allocate(wbal%endwb(beg:end)) - allocate(wbal%errh2o(beg:end)) - - wbal%begwb(beg:end) = nan - wbal%endwb(beg:end) = nan - wbal%errh2o(beg:end) = nan - - end subroutine init_water_balance_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_carbon_balance_type -! -! !INTERFACE: - subroutine init_carbon_balance_type(beg, end, cbal) -! -! !DESCRIPTION: -! Initialize carbon balance variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(carbon_balance_type), intent(inout):: cbal -! -! !REVISION HISTORY: -! Created by Peter Thornton, 12/11/2003 -! -!EOP -!------------------------------------------------------------------------ - - allocate(cbal%begcb(beg:end)) - allocate(cbal%endcb(beg:end)) - allocate(cbal%errcb(beg:end)) - - cbal%begcb(beg:end) = nan - cbal%endcb(beg:end) = nan - cbal%errcb(beg:end) = nan - - end subroutine init_carbon_balance_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_nitrogen_balance_type -! -! !INTERFACE: - subroutine init_nitrogen_balance_type(beg, end, nbal) -! -! !DESCRIPTION: -! Initialize nitrogen balance variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type(nitrogen_balance_type), intent(inout):: nbal -! -! !REVISION HISTORY: -! Created by Peter Thornton, 12/11/2003 -! -!EOP -!------------------------------------------------------------------------ - - allocate(nbal%begnb(beg:end)) - allocate(nbal%endnb(beg:end)) - allocate(nbal%errnb(beg:end)) - - nbal%begnb(beg:end) = nan - nbal%endnb(beg:end) = nan - nbal%errnb(beg:end) = nan - - end subroutine init_nitrogen_balance_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_ecophys_constants -! -! !INTERFACE: - subroutine init_pft_ecophys_constants() -! -! !DESCRIPTION: -! Initialize pft physical state -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pftcon%noveg(0:numpft)) - allocate(pftcon%tree(0:numpft)) - allocate(pftcon%smpso(0:numpft)) - allocate(pftcon%smpsc(0:numpft)) - allocate(pftcon%fnitr(0:numpft)) - allocate(pftcon%foln(0:numpft)) - allocate(pftcon%dleaf(0:numpft)) - allocate(pftcon%c3psn(0:numpft)) - allocate(pftcon%mp(0:numpft)) - allocate(pftcon%qe25(0:numpft)) - allocate(pftcon%xl(0:numpft)) - allocate(pftcon%rhol(0:numpft,numrad)) - allocate(pftcon%rhos(0:numpft,numrad)) - allocate(pftcon%taul(0:numpft,numrad)) - allocate(pftcon%taus(0:numpft,numrad)) - allocate(pftcon%z0mr(0:numpft)) - allocate(pftcon%displar(0:numpft)) - allocate(pftcon%roota_par(0:numpft)) - allocate(pftcon%rootb_par(0:numpft)) - allocate(pftcon%sla(0:numpft)) - allocate(pftcon%slatop(0:numpft)) - allocate(pftcon%dsladlai(0:numpft)) - allocate(pftcon%leafcn(0:numpft)) - allocate(pftcon%flnr(0:numpft)) - allocate(pftcon%woody(0:numpft)) - allocate(pftcon%lflitcn(0:numpft)) - allocate(pftcon%frootcn(0:numpft)) - allocate(pftcon%livewdcn(0:numpft)) - allocate(pftcon%deadwdcn(0:numpft)) - allocate(pftcon%graincn(0:numpft)) - allocate(pftcon%froot_leaf(0:numpft)) - allocate(pftcon%stem_leaf(0:numpft)) - allocate(pftcon%croot_stem(0:numpft)) - allocate(pftcon%flivewd(0:numpft)) - allocate(pftcon%fcur(0:numpft)) - allocate(pftcon%lf_flab(0:numpft)) - allocate(pftcon%lf_fcel(0:numpft)) - allocate(pftcon%lf_flig(0:numpft)) - allocate(pftcon%fr_flab(0:numpft)) - allocate(pftcon%fr_fcel(0:numpft)) - allocate(pftcon%fr_flig(0:numpft)) - allocate(pftcon%leaf_long(0:numpft)) - allocate(pftcon%evergreen(0:numpft)) - allocate(pftcon%stress_decid(0:numpft)) - allocate(pftcon%season_decid(0:numpft)) - allocate(pftcon%resist(0:numpft)) - allocate(pftcon%dwood(0:numpft)) - - pftcon%noveg(:) = huge(1) - pftcon%tree(:) = huge(1) - pftcon%smpso(:) = nan - pftcon%smpsc(:) = nan - pftcon%fnitr(:) = nan - pftcon%foln(:) = nan - pftcon%dleaf(:) = nan - pftcon%c3psn(:) = nan - pftcon%mp(:) = nan - pftcon%qe25(:) = nan - pftcon%xl(:) = nan - pftcon%rhol(:,:numrad) = nan - pftcon%rhos(:,:numrad) = nan - pftcon%taul(:,:numrad) = nan - pftcon%taus(:,:numrad) = nan - pftcon%z0mr(:) = nan - pftcon%displar(:) = nan - pftcon%roota_par(:) = nan - pftcon%rootb_par(:) = nan - pftcon%sla(:) = nan - pftcon%slatop(:) = nan - pftcon%dsladlai(:) = nan - pftcon%leafcn(:) = nan - pftcon%flnr(:) = nan - pftcon%woody(:) = nan - pftcon%lflitcn(:) = nan - pftcon%frootcn(:) = nan - pftcon%livewdcn(:) = nan - pftcon%deadwdcn(:) = nan - pftcon%graincn(:) = nan - pftcon%froot_leaf(:) = nan - pftcon%stem_leaf(:) = nan - pftcon%croot_stem(:) = nan - pftcon%flivewd(:) = nan - pftcon%fcur(:) = nan - pftcon%lf_flab(:) = nan - pftcon%lf_fcel(:) = nan - pftcon%lf_flig(:) = nan - pftcon%fr_flab(:) = nan - pftcon%fr_fcel(:) = nan - pftcon%fr_flig(:) = nan - pftcon%leaf_long(:) = nan - pftcon%evergreen(:) = nan - pftcon%stress_decid(:) = nan - pftcon%season_decid(:) = nan - pftcon%resist(:) = nan - pftcon%dwood(:) = nan - - end subroutine init_pft_ecophys_constants - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_DGVMecophys_constants -! -! !INTERFACE: - subroutine init_pft_DGVMecophys_constants() -! -! !DESCRIPTION: -! Initialize pft physical state -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(dgv_pftcon%crownarea_max(0:numpft)) - allocate(dgv_pftcon%tcmin(0:numpft)) - allocate(dgv_pftcon%tcmax(0:numpft)) - allocate(dgv_pftcon%gddmin(0:numpft)) - allocate(dgv_pftcon%twmax(0:numpft)) - allocate(dgv_pftcon%reinickerp(0:numpft)) - allocate(dgv_pftcon%allom1(0:numpft)) - allocate(dgv_pftcon%allom2(0:numpft)) - allocate(dgv_pftcon%allom3(0:numpft)) - - dgv_pftcon%crownarea_max(:) = nan - dgv_pftcon%tcmin(:) = nan - dgv_pftcon%tcmax(:) = nan - dgv_pftcon%gddmin(:) = nan - dgv_pftcon%twmax(:) = nan - dgv_pftcon%reinickerp(:) = nan - dgv_pftcon%allom1(:) = nan - dgv_pftcon%allom2(:) = nan - dgv_pftcon%allom3(:) = nan - - end subroutine init_pft_DGVMecophys_constants - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_pstate_type -! -! !INTERFACE: - subroutine init_pft_pstate_type(beg, end, pps) -! -! !DESCRIPTION: -! Initialize pft physical state -! -! !USES: - use clm_varcon, only : spval - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_pstate_type), intent(inout):: pps -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pps%frac_veg_nosno(beg:end)) - allocate(pps%frac_veg_nosno_alb(beg:end)) - allocate(pps%emv(beg:end)) - allocate(pps%z0mv(beg:end)) - allocate(pps%z0hv(beg:end)) - allocate(pps%z0qv(beg:end)) - allocate(pps%rootfr(beg:end,1:nlevgrnd)) - allocate(pps%rootr(beg:end,1:nlevgrnd)) - allocate(pps%rresis(beg:end,1:nlevgrnd)) - allocate(pps%dewmx(beg:end)) - allocate(pps%rssun(beg:end)) - allocate(pps%rssha(beg:end)) - allocate(pps%laisun(beg:end)) - allocate(pps%laisha(beg:end)) - allocate(pps%btran(beg:end)) - allocate(pps%fsun(beg:end)) - allocate(pps%tlai(beg:end)) - allocate(pps%tsai(beg:end)) - allocate(pps%elai(beg:end)) - allocate(pps%esai(beg:end)) - allocate(pps%fwet(beg:end)) - allocate(pps%fdry(beg:end)) - allocate(pps%dt_veg(beg:end)) - allocate(pps%htop(beg:end)) - allocate(pps%hbot(beg:end)) - allocate(pps%z0m(beg:end)) - allocate(pps%displa(beg:end)) - allocate(pps%albd(beg:end,1:numrad)) - allocate(pps%albi(beg:end,1:numrad)) - allocate(pps%fabd(beg:end,1:numrad)) - allocate(pps%fabi(beg:end,1:numrad)) - allocate(pps%ftdd(beg:end,1:numrad)) - allocate(pps%ftid(beg:end,1:numrad)) - allocate(pps%ftii(beg:end,1:numrad)) - allocate(pps%u10(beg:end)) - allocate(pps%u10_clm(beg:end)) - allocate(pps%va(beg:end)) - allocate(pps%fv(beg:end)) - allocate(pps%ram1(beg:end)) - if ( crop_prog )then - allocate(pps%hdidx(beg:end)) - allocate(pps%cumvd(beg:end)) - allocate(pps%htmx(beg:end)) - allocate(pps%vf(beg:end)) - allocate(pps%gddmaturity(beg:end)) - allocate(pps%gdd0(beg:end)) - allocate(pps%gdd8(beg:end)) - allocate(pps%gdd10(beg:end)) - allocate(pps%gdd020(beg:end)) - allocate(pps%gdd820(beg:end)) - allocate(pps%gdd1020(beg:end)) - allocate(pps%gddplant(beg:end)) - allocate(pps%gddtsoi(beg:end)) - allocate(pps%huileaf(beg:end)) - allocate(pps%huigrain(beg:end)) - allocate(pps%aleafi(beg:end)) - allocate(pps%astemi(beg:end)) - allocate(pps%aleaf(beg:end)) - allocate(pps%astem(beg:end)) - allocate(pps%croplive(beg:end)) - allocate(pps%cropplant(beg:end)) !,numpft)) ! make 2-D if using - allocate(pps%harvdate(beg:end)) !,numpft)) ! crop rotation - allocate(pps%idop(beg:end)) - allocate(pps%peaklai(beg:end)) - end if - allocate(pps%vds(beg:end)) - allocate(pps%slasun(beg:end)) - allocate(pps%slasha(beg:end)) - allocate(pps%lncsun(beg:end)) - allocate(pps%lncsha(beg:end)) - allocate(pps%vcmxsun(beg:end)) - allocate(pps%vcmxsha(beg:end)) - allocate(pps%gdir(beg:end)) - allocate(pps%omega(beg:end,1:numrad)) - allocate(pps%eff_kid(beg:end,1:numrad)) - allocate(pps%eff_kii(beg:end,1:numrad)) - allocate(pps%sun_faid(beg:end,1:numrad)) - allocate(pps%sun_faii(beg:end,1:numrad)) - allocate(pps%sha_faid(beg:end,1:numrad)) - allocate(pps%sha_faii(beg:end,1:numrad)) - allocate(pps%forc_hgt_u_pft(beg:end)) - allocate(pps%forc_hgt_t_pft(beg:end)) - allocate(pps%forc_hgt_q_pft(beg:end)) - ! 4/14/05: PET - ! Adding isotope code - allocate(pps%cisun(beg:end)) - allocate(pps%cisha(beg:end)) - allocate(pps%alphapsnsun(beg:end)) - allocate(pps%alphapsnsha(beg:end)) - - allocate(pps%sandfrac(beg:end)) - allocate(pps%clayfrac(beg:end)) - pps%sandfrac(beg:end) = nan - pps%clayfrac(beg:end) = nan - allocate(pps%mlaidiff(beg:end)) - allocate(pps%rb1(beg:end)) - allocate(pps%annlai(12,beg:end)) - pps%mlaidiff(beg:end) = nan - pps%rb1(beg:end) = nan - pps%annlai(:,:) = nan - - pps%frac_veg_nosno(beg:end) = huge(1) - pps%frac_veg_nosno_alb(beg:end) = 0 - pps%emv(beg:end) = nan - pps%z0mv(beg:end) = nan - pps%z0hv(beg:end) = nan - pps%z0qv(beg:end) = nan - pps%rootfr(beg:end,:nlevgrnd) = spval - pps%rootr (beg:end,:nlevgrnd) = spval - pps%rresis(beg:end,:nlevgrnd) = spval - pps%dewmx(beg:end) = nan - pps%rssun(beg:end) = nan - pps%rssha(beg:end) = nan - pps%laisun(beg:end) = nan - pps%laisha(beg:end) = nan - pps%btran(beg:end) = spval - pps%fsun(beg:end) = spval - pps%tlai(beg:end) = 0._r8 - pps%tsai(beg:end) = 0._r8 - pps%elai(beg:end) = 0._r8 - pps%esai(beg:end) = 0._r8 - pps%fwet(beg:end) = nan - pps%fdry(beg:end) = nan - pps%dt_veg(beg:end) = nan - pps%htop(beg:end) = 0._r8 - pps%hbot(beg:end) = 0._r8 - pps%z0m(beg:end) = nan - pps%displa(beg:end) = nan - pps%albd(beg:end,:numrad) = nan - pps%albi(beg:end,:numrad) = nan - pps%fabd(beg:end,:numrad) = nan - pps%fabi(beg:end,:numrad) = nan - pps%ftdd(beg:end,:numrad) = nan - pps%ftid(beg:end,:numrad) = nan - pps%ftii(beg:end,:numrad) = nan - pps%u10(beg:end) = nan - pps%u10_clm(beg:end) = nan - pps%va(beg:end) = nan - pps%fv(beg:end) = nan - pps%ram1(beg:end) = nan - if ( crop_prog )then - pps%hdidx(beg:end) = nan - pps%cumvd(beg:end) = nan - pps%htmx(beg:end) = 0.0_r8 - pps%vf(beg:end) = 0.0_r8 - pps%gddmaturity(beg:end) = spval - pps%gdd0(beg:end) = spval - pps%gdd8(beg:end) = spval - pps%gdd10(beg:end) = spval - pps%gdd020(beg:end) = spval - pps%gdd820(beg:end) = spval - pps%gdd1020(beg:end) = spval - pps%gddplant(beg:end) = spval - pps%gddtsoi(beg:end) = spval - pps%huileaf(beg:end) = nan - pps%huigrain(beg:end) = nan - pps%aleafi(beg:end) = nan - pps%astemi(beg:end) = nan - pps%aleaf(beg:end) = nan - pps%astem(beg:end) = nan - pps%croplive(beg:end) = .false. - pps%cropplant(beg:end) = .false. - pps%harvdate(beg:end) = huge(1) - pps%idop(beg:end) = huge(1) - pps%peaklai(beg:end) = 0 - end if - pps%vds(beg:end) = nan - pps%slasun(beg:end) = nan - pps%slasha(beg:end) = nan - pps%lncsun(beg:end) = nan - pps%lncsha(beg:end) = nan - pps%vcmxsun(beg:end) = nan - pps%vcmxsha(beg:end) = nan - pps%gdir(beg:end) = nan - pps%omega(beg:end,1:numrad) = nan - pps%eff_kid(beg:end,1:numrad) = nan - pps%eff_kii(beg:end,1:numrad) = nan - pps%sun_faid(beg:end,1:numrad) = nan - pps%sun_faii(beg:end,1:numrad) = nan - pps%sha_faid(beg:end,1:numrad) = nan - pps%sha_faii(beg:end,1:numrad) = nan - pps%forc_hgt_u_pft(beg:end) = nan - pps%forc_hgt_t_pft(beg:end) = nan - pps%forc_hgt_q_pft(beg:end) = nan - ! 4/14/05: PET - ! Adding isotope code - pps%cisun(beg:end) = nan - pps%cisha(beg:end) = nan - if (use_c13) then - pps%alphapsnsun(beg:end) = nan - pps%alphapsnsha(beg:end) = nan - endif - - end subroutine init_pft_pstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_epv_type -! -! !INTERFACE: - subroutine init_pft_epv_type(beg, end, pepv) -! -! !DESCRIPTION: -! Initialize pft ecophysiological variables -! -! !USES: -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_epv_type), intent(inout):: pepv -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -!------------------------------------------------------------------------ - - allocate(pepv%dormant_flag(beg:end)) - allocate(pepv%days_active(beg:end)) - allocate(pepv%onset_flag(beg:end)) - allocate(pepv%onset_counter(beg:end)) - allocate(pepv%onset_gddflag(beg:end)) - allocate(pepv%onset_fdd(beg:end)) - allocate(pepv%onset_gdd(beg:end)) - allocate(pepv%onset_swi(beg:end)) - allocate(pepv%offset_flag(beg:end)) - allocate(pepv%offset_counter(beg:end)) - allocate(pepv%offset_fdd(beg:end)) - allocate(pepv%offset_swi(beg:end)) - allocate(pepv%lgsf(beg:end)) - allocate(pepv%bglfr(beg:end)) - allocate(pepv%bgtr(beg:end)) - allocate(pepv%dayl(beg:end)) - allocate(pepv%prev_dayl(beg:end)) - allocate(pepv%annavg_t2m(beg:end)) - allocate(pepv%tempavg_t2m(beg:end)) - allocate(pepv%gpp(beg:end)) - allocate(pepv%availc(beg:end)) - allocate(pepv%xsmrpool_recover(beg:end)) - allocate(pepv%xsmrpool_c13ratio(beg:end)) - allocate(pepv%alloc_pnow(beg:end)) - allocate(pepv%c_allometry(beg:end)) - allocate(pepv%n_allometry(beg:end)) - allocate(pepv%plant_ndemand(beg:end)) - allocate(pepv%tempsum_potential_gpp(beg:end)) - allocate(pepv%annsum_potential_gpp(beg:end)) - allocate(pepv%tempmax_retransn(beg:end)) - allocate(pepv%annmax_retransn(beg:end)) - allocate(pepv%avail_retransn(beg:end)) - allocate(pepv%plant_nalloc(beg:end)) - allocate(pepv%plant_calloc(beg:end)) - allocate(pepv%excess_cflux(beg:end)) - allocate(pepv%downreg(beg:end)) - allocate(pepv%prev_leafc_to_litter(beg:end)) - allocate(pepv%prev_frootc_to_litter(beg:end)) - allocate(pepv%tempsum_npp(beg:end)) - allocate(pepv%annsum_npp(beg:end)) - allocate(pepv%tempsum_litfall(beg:end)) - allocate(pepv%annsum_litfall(beg:end)) - ! 4/21/05, PET - ! Adding isotope code - allocate(pepv%rc13_canair(beg:end)) - allocate(pepv%rc13_psnsun(beg:end)) - allocate(pepv%rc13_psnsha(beg:end)) - - pepv%dormant_flag(beg:end) = nan - pepv%days_active(beg:end) = nan - pepv%onset_flag(beg:end) = nan - pepv%onset_counter(beg:end) = nan - pepv%onset_gddflag(beg:end) = nan - pepv%onset_fdd(beg:end) = nan - pepv%onset_gdd(beg:end) = nan - pepv%onset_swi(beg:end) = nan - pepv%offset_flag(beg:end) = nan - pepv%offset_counter(beg:end) = nan - pepv%offset_fdd(beg:end) = nan - pepv%offset_swi(beg:end) = nan - pepv%lgsf(beg:end) = nan - pepv%bglfr(beg:end) = nan - pepv%bgtr(beg:end) = nan - pepv%dayl(beg:end) = nan - pepv%prev_dayl(beg:end) = nan - pepv%annavg_t2m(beg:end) = nan - pepv%tempavg_t2m(beg:end) = nan - pepv%gpp(beg:end) = nan - pepv%availc(beg:end) = nan - pepv%xsmrpool_recover(beg:end) = nan - if (use_c13) then - pepv%xsmrpool_c13ratio(beg:end) = nan - endif - pepv%alloc_pnow(beg:end) = nan - pepv%c_allometry(beg:end) = nan - pepv%n_allometry(beg:end) = nan - pepv%plant_ndemand(beg:end) = nan - pepv%tempsum_potential_gpp(beg:end) = nan - pepv%annsum_potential_gpp(beg:end) = nan - pepv%tempmax_retransn(beg:end) = nan - pepv%annmax_retransn(beg:end) = nan - pepv%avail_retransn(beg:end) = nan - pepv%plant_nalloc(beg:end) = nan - pepv%plant_calloc(beg:end) = nan - pepv%excess_cflux(beg:end) = nan - pepv%downreg(beg:end) = nan - pepv%prev_leafc_to_litter(beg:end) = nan - pepv%prev_frootc_to_litter(beg:end) = nan - pepv%tempsum_npp(beg:end) = nan - pepv%annsum_npp(beg:end) = nan - pepv%tempsum_litfall(beg:end) = nan - pepv%annsum_litfall(beg:end) = nan - if (use_c13) then - ! 4/21/05, PET - ! Adding isotope code - pepv%rc13_canair(beg:end) = nan - pepv%rc13_psnsun(beg:end) = nan - pepv%rc13_psnsha(beg:end) = nan - endif - - end subroutine init_pft_epv_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_pdgvstate_type -! -! !INTERFACE: - subroutine init_pft_pdgvstate_type(beg, end, pdgvs) -! -! !DESCRIPTION: -! Initialize pft DGVM state variables -! -! !USES: -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_dgvstate_type), intent(inout):: pdgvs -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pdgvs%agddtw(beg:end)) - allocate(pdgvs%agdd(beg:end)) - allocate(pdgvs%t_mo(beg:end)) - allocate(pdgvs%t_mo_min(beg:end)) - allocate(pdgvs%prec365(beg:end)) - allocate(pdgvs%present(beg:end)) - allocate(pdgvs%pftmayexist(beg:end)) - allocate(pdgvs%nind(beg:end)) - allocate(pdgvs%lm_ind(beg:end)) - allocate(pdgvs%lai_ind(beg:end)) - allocate(pdgvs%fpcinc(beg:end)) - allocate(pdgvs%fpcgrid(beg:end)) - allocate(pdgvs%fpcgridold(beg:end)) - allocate(pdgvs%crownarea(beg:end)) - allocate(pdgvs%greffic(beg:end)) - allocate(pdgvs%heatstress(beg:end)) - - pdgvs%agddtw(beg:end) = nan - pdgvs%agdd(beg:end) = nan - pdgvs%t_mo(beg:end) = nan - pdgvs%t_mo_min(beg:end) = nan - pdgvs%prec365(beg:end) = nan - pdgvs%present(beg:end) = .false. - pdgvs%pftmayexist(beg:end) = .true. - pdgvs%nind(beg:end) = nan - pdgvs%lm_ind(beg:end) = nan - pdgvs%lai_ind(beg:end) = nan - pdgvs%fpcinc(beg:end) = nan - pdgvs%fpcgrid(beg:end) = nan - pdgvs%fpcgridold(beg:end) = nan - pdgvs%crownarea(beg:end) = nan - pdgvs%greffic(beg:end) = nan - pdgvs%heatstress(beg:end) = nan - - end subroutine init_pft_pdgvstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_vstate_type -! -! !INTERFACE: - subroutine init_pft_vstate_type(beg, end, pvs) -! -! !DESCRIPTION: -! Initialize pft VOC variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_vstate_type), intent(inout):: pvs -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -!EOP -!------------------------------------------------------------------------ - - allocate(pvs%t_veg24 (beg:end)) - allocate(pvs%t_veg240(beg:end)) - allocate(pvs%fsd24 (beg:end)) - allocate(pvs%fsd240 (beg:end)) - allocate(pvs%fsi24 (beg:end)) - allocate(pvs%fsi240 (beg:end)) - allocate(pvs%fsun24 (beg:end)) - allocate(pvs%fsun240 (beg:end)) - allocate(pvs%elai_p (beg:end)) - - pvs%t_veg24 (beg:end) = spval - pvs%t_veg240(beg:end) = spval - pvs%fsd24 (beg:end) = spval - pvs%fsd240 (beg:end) = spval - pvs%fsi24 (beg:end) = spval - pvs%fsi240 (beg:end) = spval - pvs%fsun24 (beg:end) = spval - pvs%fsun240 (beg:end) = spval - pvs%elai_p (beg:end) = spval - end subroutine init_pft_vstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_estate_type -! -! !INTERFACE: - subroutine init_pft_estate_type(beg, end, pes) -! -! !DESCRIPTION: -! Initialize pft energy state -! -! !USES: - use clm_varcon, only : spval - use surfrdMod, only : crop_prog -! !AGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_estate_type), intent(inout):: pes -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - - allocate(pes%t_ref2m(beg:end)) - allocate(pes%t_ref2m_min(beg:end)) - allocate(pes%t_ref2m_max(beg:end)) - allocate(pes%t_ref2m_min_inst(beg:end)) - allocate(pes%t_ref2m_max_inst(beg:end)) - allocate(pes%q_ref2m(beg:end)) - allocate(pes%t_ref2m_u(beg:end)) - allocate(pes%t_ref2m_r(beg:end)) - allocate(pes%t_ref2m_min_u(beg:end)) - allocate(pes%t_ref2m_min_r(beg:end)) - allocate(pes%t_ref2m_max_u(beg:end)) - allocate(pes%t_ref2m_max_r(beg:end)) - allocate(pes%t_ref2m_min_inst_u(beg:end)) - allocate(pes%t_ref2m_min_inst_r(beg:end)) - allocate(pes%t_ref2m_max_inst_u(beg:end)) - allocate(pes%t_ref2m_max_inst_r(beg:end)) - allocate(pes%t10(beg:end)) - if ( crop_prog )then - allocate(pes%a10tmin(beg:end)) - allocate(pes%a5tmin(beg:end)) - end if - allocate(pes%rh_ref2m(beg:end)) - allocate(pes%rh_ref2m_u(beg:end)) - allocate(pes%rh_ref2m_r(beg:end)) - allocate(pes%t_veg(beg:end)) - allocate(pes%thm(beg:end)) - - pes%t_ref2m(beg:end) = nan - pes%t_ref2m_min(beg:end) = nan - pes%t_ref2m_max(beg:end) = nan - pes%t_ref2m_min_inst(beg:end) = nan - pes%t_ref2m_max_inst(beg:end) = nan - pes%q_ref2m(beg:end) = nan - pes%t_ref2m_u(beg:end) = nan - pes%t_ref2m_r(beg:end) = nan - pes%t_ref2m_min_u(beg:end) = nan - pes%t_ref2m_min_r(beg:end) = nan - pes%t_ref2m_max_u(beg:end) = nan - pes%t_ref2m_max_r(beg:end) = nan - pes%t_ref2m_min_inst_u(beg:end) = nan - pes%t_ref2m_min_inst_r(beg:end) = nan - pes%t_ref2m_max_inst_u(beg:end) = nan - pes%t_ref2m_max_inst_r(beg:end) = nan - pes%t10(beg:end) = spval - if ( crop_prog )then - pes%a10tmin(beg:end) = spval - pes%a5tmin(beg:end) = spval - end if - pes%rh_ref2m(beg:end) = nan - pes%rh_ref2m_u(beg:end) = nan - pes%rh_ref2m_r(beg:end) = nan - pes%t_veg(beg:end) = nan - pes%thm(beg:end) = nan - - end subroutine init_pft_estate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_wstate_type -! -! !INTERFACE: - subroutine init_pft_wstate_type(beg, end, pws) -! -! !DESCRIPTION: -! Initialize pft water state -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_wstate_type), intent(inout):: pws !pft water state -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pws%h2ocan(beg:end)) - pws%h2ocan(beg:end) = nan - - end subroutine init_pft_wstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_cstate_type -! -! !INTERFACE: - subroutine init_pft_cstate_type(beg, end, pcs) -! -! !DESCRIPTION: -! Initialize pft carbon state -! -! !USES: - use surfrdMod, only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_cstate_type), intent(inout):: pcs !pft carbon state -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -!------------------------------------------------------------------------ - - allocate(pcs%leafc(beg:end)) - allocate(pcs%leafc_storage(beg:end)) - allocate(pcs%leafc_xfer(beg:end)) - allocate(pcs%frootc(beg:end)) - allocate(pcs%frootc_storage(beg:end)) - allocate(pcs%frootc_xfer(beg:end)) - allocate(pcs%livestemc(beg:end)) - allocate(pcs%livestemc_storage(beg:end)) - allocate(pcs%livestemc_xfer(beg:end)) - allocate(pcs%deadstemc(beg:end)) - allocate(pcs%deadstemc_storage(beg:end)) - allocate(pcs%deadstemc_xfer(beg:end)) - allocate(pcs%livecrootc(beg:end)) - allocate(pcs%livecrootc_storage(beg:end)) - allocate(pcs%livecrootc_xfer(beg:end)) - allocate(pcs%deadcrootc(beg:end)) - allocate(pcs%deadcrootc_storage(beg:end)) - allocate(pcs%deadcrootc_xfer(beg:end)) - allocate(pcs%gresp_storage(beg:end)) - allocate(pcs%gresp_xfer(beg:end)) - allocate(pcs%cpool(beg:end)) - allocate(pcs%xsmrpool(beg:end)) - allocate(pcs%pft_ctrunc(beg:end)) - allocate(pcs%dispvegc(beg:end)) - allocate(pcs%storvegc(beg:end)) - allocate(pcs%totvegc(beg:end)) - allocate(pcs%totpftc(beg:end)) - allocate(pcs%leafcmax(beg:end)) - if ( crop_prog )then - allocate(pcs%grainc(beg:end)) - allocate(pcs%grainc_storage(beg:end)) - allocate(pcs%grainc_xfer(beg:end)) - end if - allocate(pcs%woodc(beg:end)) - - pcs%leafc(beg:end) = nan - pcs%leafc_storage(beg:end) = nan - pcs%leafc_xfer(beg:end) = nan - pcs%frootc(beg:end) = nan - pcs%frootc_storage(beg:end) = nan - pcs%frootc_xfer(beg:end) = nan - pcs%livestemc(beg:end) = nan - pcs%livestemc_storage(beg:end) = nan - pcs%livestemc_xfer(beg:end) = nan - pcs%deadstemc(beg:end) = nan - pcs%deadstemc_storage(beg:end) = nan - pcs%deadstemc_xfer(beg:end) = nan - pcs%livecrootc(beg:end) = nan - pcs%livecrootc_storage(beg:end) = nan - pcs%livecrootc_xfer(beg:end) = nan - pcs%deadcrootc(beg:end) = nan - pcs%deadcrootc_storage(beg:end) = nan - pcs%deadcrootc_xfer(beg:end) = nan - pcs%gresp_storage(beg:end) = nan - pcs%gresp_xfer(beg:end) = nan - pcs%cpool(beg:end) = nan - pcs%xsmrpool(beg:end) = nan - pcs%pft_ctrunc(beg:end) = nan - pcs%dispvegc(beg:end) = nan - pcs%storvegc(beg:end) = nan - pcs%totvegc(beg:end) = nan - pcs%totpftc(beg:end) = nan - pcs%leafcmax(beg:end) = nan - if ( crop_prog )then - pcs%grainc(beg:end) = nan - pcs%grainc_storage(beg:end) = nan - pcs%grainc_xfer(beg:end) = nan - end if - pcs%woodc(beg:end) = nan - - end subroutine init_pft_cstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_nstate_type -! -! !INTERFACE: - subroutine init_pft_nstate_type(beg, end, pns) -! -! !DESCRIPTION: -! Initialize pft nitrogen state -! -! !USES: - use surfrdMod, only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_nstate_type), intent(inout):: pns !pft nitrogen state -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -!------------------------------------------------------------------------ - - if ( crop_prog )then - allocate(pns%grainn(beg:end)) - allocate(pns%grainn_storage(beg:end)) - allocate(pns%grainn_xfer(beg:end)) - end if - allocate(pns%leafn(beg:end)) - allocate(pns%leafn_storage(beg:end)) - allocate(pns%leafn_xfer(beg:end)) - allocate(pns%frootn(beg:end)) - allocate(pns%frootn_storage(beg:end)) - allocate(pns%frootn_xfer(beg:end)) - allocate(pns%livestemn(beg:end)) - allocate(pns%livestemn_storage(beg:end)) - allocate(pns%livestemn_xfer(beg:end)) - allocate(pns%deadstemn(beg:end)) - allocate(pns%deadstemn_storage(beg:end)) - allocate(pns%deadstemn_xfer(beg:end)) - allocate(pns%livecrootn(beg:end)) - allocate(pns%livecrootn_storage(beg:end)) - allocate(pns%livecrootn_xfer(beg:end)) - allocate(pns%deadcrootn(beg:end)) - allocate(pns%deadcrootn_storage(beg:end)) - allocate(pns%deadcrootn_xfer(beg:end)) - allocate(pns%retransn(beg:end)) - allocate(pns%npool(beg:end)) - allocate(pns%pft_ntrunc(beg:end)) - allocate(pns%dispvegn(beg:end)) - allocate(pns%storvegn(beg:end)) - allocate(pns%totvegn(beg:end)) - allocate(pns%totpftn(beg:end)) - - if ( crop_prog )then - pns%grainn(beg:end) = nan - pns%grainn_storage(beg:end) = nan - pns%grainn_xfer(beg:end) = nan - end if - pns%leafn(beg:end) = nan - pns%leafn_storage(beg:end) = nan - pns%leafn_xfer(beg:end) = nan - pns%frootn(beg:end) = nan - pns%frootn_storage(beg:end) = nan - pns%frootn_xfer(beg:end) = nan - pns%livestemn(beg:end) = nan - pns%livestemn_storage(beg:end) = nan - pns%livestemn_xfer(beg:end) = nan - pns%deadstemn(beg:end) = nan - pns%deadstemn_storage(beg:end) = nan - pns%deadstemn_xfer(beg:end) = nan - pns%livecrootn(beg:end) = nan - pns%livecrootn_storage(beg:end) = nan - pns%livecrootn_xfer(beg:end) = nan - pns%deadcrootn(beg:end) = nan - pns%deadcrootn_storage(beg:end) = nan - pns%deadcrootn_xfer(beg:end) = nan - pns%retransn(beg:end) = nan - pns%npool(beg:end) = nan - pns%pft_ntrunc(beg:end) = nan - pns%dispvegn(beg:end) = nan - pns%storvegn(beg:end) = nan - pns%totvegn(beg:end) = nan - pns%totpftn(beg:end) = nan - - end subroutine init_pft_nstate_type -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_eflux_type -! -! !INTERFACE: - subroutine init_pft_eflux_type(beg, end, pef) -! -! !DESCRIPTION: -! Initialize pft energy flux variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_eflux_type), intent(inout):: pef -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pef%sabg(beg:end)) - allocate(pef%sabv(beg:end)) - allocate(pef%fsa(beg:end)) - allocate(pef%fsa_u(beg:end)) - allocate(pef%fsa_r(beg:end)) - allocate(pef%fsr(beg:end)) - allocate(pef%parsun(beg:end)) - allocate(pef%parsha(beg:end)) - allocate(pef%dlrad(beg:end)) - allocate(pef%ulrad(beg:end)) - allocate(pef%eflx_lh_tot(beg:end)) - allocate(pef%eflx_lh_tot_u(beg:end)) - allocate(pef%eflx_lh_tot_r(beg:end)) - allocate(pef%eflx_lh_grnd(beg:end)) - allocate(pef%eflx_soil_grnd(beg:end)) - allocate(pef%eflx_soil_grnd_u(beg:end)) - allocate(pef%eflx_soil_grnd_r(beg:end)) - allocate(pef%eflx_sh_tot(beg:end)) - allocate(pef%eflx_sh_tot_u(beg:end)) - allocate(pef%eflx_sh_tot_r(beg:end)) - allocate(pef%eflx_sh_grnd(beg:end)) - allocate(pef%eflx_sh_veg(beg:end)) - allocate(pef%eflx_lh_vege(beg:end)) - allocate(pef%eflx_lh_vegt(beg:end)) - allocate(pef%eflx_wasteheat_pft(beg:end)) - allocate(pef%eflx_heat_from_ac_pft(beg:end)) - allocate(pef%eflx_traffic_pft(beg:end)) - allocate(pef%eflx_anthro(beg:end)) - allocate(pef%cgrnd(beg:end)) - allocate(pef%cgrndl(beg:end)) - allocate(pef%cgrnds(beg:end)) - allocate(pef%eflx_gnet(beg:end)) - allocate(pef%dgnetdT(beg:end)) - allocate(pef%eflx_lwrad_out(beg:end)) - allocate(pef%eflx_lwrad_net(beg:end)) - allocate(pef%eflx_lwrad_net_u(beg:end)) - allocate(pef%eflx_lwrad_net_r(beg:end)) - allocate(pef%netrad(beg:end)) - allocate(pef%fsds_vis_d(beg:end)) - allocate(pef%fsds_nir_d(beg:end)) - allocate(pef%fsds_vis_i(beg:end)) - allocate(pef%fsds_nir_i(beg:end)) - allocate(pef%fsr_vis_d(beg:end)) - allocate(pef%fsr_nir_d(beg:end)) - allocate(pef%fsr_vis_i(beg:end)) - allocate(pef%fsr_nir_i(beg:end)) - allocate(pef%fsds_vis_d_ln(beg:end)) - allocate(pef%fsds_nir_d_ln(beg:end)) - allocate(pef%fsr_vis_d_ln(beg:end)) - allocate(pef%fsr_nir_d_ln(beg:end)) - allocate(pef%sun_add(beg:end,1:numrad)) - allocate(pef%tot_aid(beg:end,1:numrad)) - allocate(pef%sun_aid(beg:end,1:numrad)) - allocate(pef%sun_aii(beg:end,1:numrad)) - allocate(pef%sha_aid(beg:end,1:numrad)) - allocate(pef%sha_aii(beg:end,1:numrad)) - allocate(pef%sun_atot(beg:end,1:numrad)) - allocate(pef%sha_atot(beg:end,1:numrad)) - allocate(pef%sun_alf(beg:end,1:numrad)) - allocate(pef%sha_alf(beg:end,1:numrad)) - allocate(pef%sun_aperlai(beg:end,1:numrad)) - allocate(pef%sha_aperlai(beg:end,1:numrad)) - allocate(pef%sabg_lyr(beg:end,-nlevsno+1:1)) - allocate(pef%sfc_frc_aer(beg:end)) - allocate(pef%sfc_frc_bc(beg:end)) - allocate(pef%sfc_frc_oc(beg:end)) - allocate(pef%sfc_frc_dst(beg:end)) - allocate(pef%sfc_frc_aer_sno(beg:end)) - allocate(pef%sfc_frc_bc_sno(beg:end)) - allocate(pef%sfc_frc_oc_sno(beg:end)) - allocate(pef%sfc_frc_dst_sno(beg:end)) - allocate(pef%fsr_sno_vd(beg:end)) - allocate(pef%fsr_sno_nd(beg:end)) - allocate(pef%fsr_sno_vi(beg:end)) - allocate(pef%fsr_sno_ni(beg:end)) - allocate(pef%fsds_sno_vd(beg:end)) - allocate(pef%fsds_sno_nd(beg:end)) - allocate(pef%fsds_sno_vi(beg:end)) - allocate(pef%fsds_sno_ni(beg:end)) - - pef%sabg(beg:end) = nan - pef%sabv(beg:end) = nan - pef%fsa(beg:end) = nan - pef%fsa_u(beg:end) = nan - pef%fsa_r(beg:end) = nan - pef%fsr(beg:end) = nan - pef%parsun(beg:end) = nan - pef%parsha(beg:end) = nan - pef%dlrad(beg:end) = nan - pef%ulrad(beg:end) = nan - pef%eflx_lh_tot(beg:end) = nan - pef%eflx_lh_tot_u(beg:end) = nan - pef%eflx_lh_tot_r(beg:end) = nan - pef%eflx_lh_grnd(beg:end) = nan - pef%eflx_soil_grnd(beg:end) = nan - pef%eflx_soil_grnd_u(beg:end) = nan - pef%eflx_soil_grnd_r(beg:end) = nan - pef%eflx_sh_tot(beg:end) = nan - pef%eflx_sh_tot_u(beg:end) = nan - pef%eflx_sh_tot_r(beg:end) = nan - pef%eflx_sh_grnd(beg:end) = nan - pef%eflx_sh_veg(beg:end) = nan - pef%eflx_lh_vege(beg:end) = nan - pef%eflx_lh_vegt(beg:end) = nan - pef%eflx_wasteheat_pft(beg:end) = spval - pef%eflx_heat_from_ac_pft(beg:end) = spval - pef%eflx_traffic_pft(beg:end) = spval - pef%eflx_anthro(beg:end) = nan - pef%cgrnd(beg:end) = nan - pef%cgrndl(beg:end) = nan - pef%cgrnds(beg:end) = nan - pef%eflx_gnet(beg:end) = nan - pef%dgnetdT(beg:end) = nan - pef%eflx_lwrad_out(beg:end) = nan - pef%eflx_lwrad_net(beg:end) = nan - pef%eflx_lwrad_net_u(beg:end) = nan - pef%eflx_lwrad_net_r(beg:end) = nan - pef%netrad(beg:end) = nan - pef%fsds_vis_d(beg:end) = nan - pef%fsds_nir_d(beg:end) = nan - pef%fsds_vis_i(beg:end) = nan - pef%fsds_nir_i(beg:end) = nan - pef%fsr_vis_d(beg:end) = nan - pef%fsr_nir_d(beg:end) = nan - pef%fsr_vis_i(beg:end) = nan - pef%fsr_nir_i(beg:end) = nan - pef%fsds_vis_d_ln(beg:end) = nan - pef%fsds_nir_d_ln(beg:end) = nan - pef%fsr_vis_d_ln(beg:end) = nan - pef%fsr_nir_d_ln(beg:end) = nan - pef%sun_add(beg:end,1:numrad) = nan - pef%tot_aid(beg:end,1:numrad) = nan - pef%sun_aid(beg:end,1:numrad) = nan - pef%sun_aii(beg:end,1:numrad) = nan - pef%sha_aid(beg:end,1:numrad) = nan - pef%sha_aii(beg:end,1:numrad) = nan - pef%sun_atot(beg:end,1:numrad) = nan - pef%sha_atot(beg:end,1:numrad) = nan - pef%sun_alf(beg:end,1:numrad) = nan - pef%sha_alf(beg:end,1:numrad) = nan - pef%sun_aperlai(beg:end,1:numrad) = nan - pef%sha_aperlai(beg:end,1:numrad) = nan - pef%sabg_lyr(beg:end,-nlevsno+1:1) = nan - pef%sfc_frc_aer(beg:end) = nan - pef%sfc_frc_bc(beg:end) = nan - pef%sfc_frc_oc(beg:end) = nan - pef%sfc_frc_dst(beg:end) = nan - pef%sfc_frc_aer_sno(beg:end) = nan - pef%sfc_frc_bc_sno(beg:end) = nan - pef%sfc_frc_oc_sno(beg:end) = nan - pef%sfc_frc_dst_sno(beg:end) = nan - pef%fsr_sno_vd(beg:end) = nan - pef%fsr_sno_nd(beg:end) = nan - pef%fsr_sno_vi(beg:end) = nan - pef%fsr_sno_ni(beg:end) = nan - pef%fsds_sno_vd(beg:end) = nan - pef%fsds_sno_nd(beg:end) = nan - pef%fsds_sno_vi(beg:end) = nan - pef%fsds_sno_ni(beg:end) = nan - end subroutine init_pft_eflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_mflux_type -! -! !INTERFACE: - subroutine init_pft_mflux_type(beg, end, pmf) -! -! !DESCRIPTION: -! Initialize pft momentum flux variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_mflux_type), intent(inout) :: pmf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pmf%taux(beg:end)) - allocate(pmf%tauy(beg:end)) - - pmf%taux(beg:end) = nan - pmf%tauy(beg:end) = nan - - end subroutine init_pft_mflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_wflux_type -! -! !INTERFACE: - subroutine init_pft_wflux_type(beg, end, pwf) -! -! !DESCRIPTION: -! Initialize pft water flux variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_wflux_type), intent(inout) :: pwf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pwf%qflx_prec_intr(beg:end)) - allocate(pwf%qflx_prec_grnd(beg:end)) - allocate(pwf%qflx_rain_grnd(beg:end)) - allocate(pwf%qflx_snow_grnd(beg:end)) - allocate(pwf%qflx_snwcp_liq(beg:end)) - allocate(pwf%qflx_snwcp_ice(beg:end)) - allocate(pwf%qflx_evap_veg(beg:end)) - allocate(pwf%qflx_tran_veg(beg:end)) - allocate(pwf%qflx_evap_can(beg:end)) - allocate(pwf%qflx_evap_soi(beg:end)) - allocate(pwf%qflx_evap_tot(beg:end)) - allocate(pwf%qflx_evap_grnd(beg:end)) - allocate(pwf%qflx_dew_grnd(beg:end)) - allocate(pwf%qflx_sub_snow(beg:end)) - allocate(pwf%qflx_dew_snow(beg:end)) - - pwf%qflx_prec_intr(beg:end) = nan - pwf%qflx_prec_grnd(beg:end) = nan - pwf%qflx_rain_grnd(beg:end) = nan - pwf%qflx_snow_grnd(beg:end) = nan - pwf%qflx_snwcp_liq(beg:end) = nan - pwf%qflx_snwcp_ice(beg:end) = nan - pwf%qflx_evap_veg(beg:end) = nan - pwf%qflx_tran_veg(beg:end) = nan - pwf%qflx_evap_can(beg:end) = nan - pwf%qflx_evap_soi(beg:end) = nan - pwf%qflx_evap_tot(beg:end) = nan - pwf%qflx_evap_grnd(beg:end) = nan - pwf%qflx_dew_grnd(beg:end) = nan - pwf%qflx_sub_snow(beg:end) = nan - pwf%qflx_dew_snow(beg:end) = nan - - end subroutine init_pft_wflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_cflux_type -! -! !INTERFACE: - subroutine init_pft_cflux_type(beg, end, pcf) -! -! !DESCRIPTION: -! Initialize pft carbon flux variables -! -! !USES: - use clm_varcon, only : spval - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_cflux_type), intent(inout) :: pcf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pcf%psnsun(beg:end)) - allocate(pcf%psnsha(beg:end)) - allocate(pcf%fpsn(beg:end)) - allocate(pcf%fco2(beg:end)) - - allocate(pcf%m_leafc_to_litter(beg:end)) - allocate(pcf%m_frootc_to_litter(beg:end)) - allocate(pcf%m_leafc_storage_to_litter(beg:end)) - allocate(pcf%m_frootc_storage_to_litter(beg:end)) - allocate(pcf%m_livestemc_storage_to_litter(beg:end)) - allocate(pcf%m_deadstemc_storage_to_litter(beg:end)) - allocate(pcf%m_livecrootc_storage_to_litter(beg:end)) - allocate(pcf%m_deadcrootc_storage_to_litter(beg:end)) - allocate(pcf%m_leafc_xfer_to_litter(beg:end)) - allocate(pcf%m_frootc_xfer_to_litter(beg:end)) - allocate(pcf%m_livestemc_xfer_to_litter(beg:end)) - allocate(pcf%m_deadstemc_xfer_to_litter(beg:end)) - allocate(pcf%m_livecrootc_xfer_to_litter(beg:end)) - allocate(pcf%m_deadcrootc_xfer_to_litter(beg:end)) - allocate(pcf%m_livestemc_to_litter(beg:end)) - allocate(pcf%m_deadstemc_to_litter(beg:end)) - allocate(pcf%m_livecrootc_to_litter(beg:end)) - allocate(pcf%m_deadcrootc_to_litter(beg:end)) - allocate(pcf%m_gresp_storage_to_litter(beg:end)) - allocate(pcf%m_gresp_xfer_to_litter(beg:end)) - allocate(pcf%hrv_leafc_to_litter(beg:end)) - allocate(pcf%hrv_leafc_storage_to_litter(beg:end)) - allocate(pcf%hrv_leafc_xfer_to_litter(beg:end)) - allocate(pcf%hrv_frootc_to_litter(beg:end)) - allocate(pcf%hrv_frootc_storage_to_litter(beg:end)) - allocate(pcf%hrv_frootc_xfer_to_litter(beg:end)) - allocate(pcf%hrv_livestemc_to_litter(beg:end)) - allocate(pcf%hrv_livestemc_storage_to_litter(beg:end)) - allocate(pcf%hrv_livestemc_xfer_to_litter(beg:end)) - allocate(pcf%hrv_deadstemc_to_prod10c(beg:end)) - allocate(pcf%hrv_deadstemc_to_prod100c(beg:end)) - allocate(pcf%hrv_deadstemc_storage_to_litter(beg:end)) - allocate(pcf%hrv_deadstemc_xfer_to_litter(beg:end)) - allocate(pcf%hrv_livecrootc_to_litter(beg:end)) - allocate(pcf%hrv_livecrootc_storage_to_litter(beg:end)) - allocate(pcf%hrv_livecrootc_xfer_to_litter(beg:end)) - allocate(pcf%hrv_deadcrootc_to_litter(beg:end)) - allocate(pcf%hrv_deadcrootc_storage_to_litter(beg:end)) - allocate(pcf%hrv_deadcrootc_xfer_to_litter(beg:end)) - allocate(pcf%hrv_gresp_storage_to_litter(beg:end)) - allocate(pcf%hrv_gresp_xfer_to_litter(beg:end)) - allocate(pcf%hrv_xsmrpool_to_atm(beg:end)) - allocate(pcf%m_leafc_to_fire(beg:end)) - allocate(pcf%m_frootc_to_fire(beg:end)) - allocate(pcf%m_leafc_storage_to_fire(beg:end)) - allocate(pcf%m_frootc_storage_to_fire(beg:end)) - allocate(pcf%m_livestemc_storage_to_fire(beg:end)) - allocate(pcf%m_deadstemc_storage_to_fire(beg:end)) - allocate(pcf%m_livecrootc_storage_to_fire(beg:end)) - allocate(pcf%m_deadcrootc_storage_to_fire(beg:end)) - allocate(pcf%m_leafc_xfer_to_fire(beg:end)) - allocate(pcf%m_frootc_xfer_to_fire(beg:end)) - allocate(pcf%m_livestemc_xfer_to_fire(beg:end)) - allocate(pcf%m_deadstemc_xfer_to_fire(beg:end)) - allocate(pcf%m_livecrootc_xfer_to_fire(beg:end)) - allocate(pcf%m_deadcrootc_xfer_to_fire(beg:end)) - allocate(pcf%m_livestemc_to_fire(beg:end)) - allocate(pcf%m_deadstemc_to_fire(beg:end)) - allocate(pcf%m_deadstemc_to_litter_fire(beg:end)) - allocate(pcf%m_livecrootc_to_fire(beg:end)) - allocate(pcf%m_deadcrootc_to_fire(beg:end)) - allocate(pcf%m_deadcrootc_to_litter_fire(beg:end)) - allocate(pcf%m_gresp_storage_to_fire(beg:end)) - allocate(pcf%m_gresp_xfer_to_fire(beg:end)) - allocate(pcf%leafc_xfer_to_leafc(beg:end)) - allocate(pcf%frootc_xfer_to_frootc(beg:end)) - allocate(pcf%livestemc_xfer_to_livestemc(beg:end)) - allocate(pcf%deadstemc_xfer_to_deadstemc(beg:end)) - allocate(pcf%livecrootc_xfer_to_livecrootc(beg:end)) - allocate(pcf%deadcrootc_xfer_to_deadcrootc(beg:end)) - allocate(pcf%leafc_to_litter(beg:end)) - allocate(pcf%frootc_to_litter(beg:end)) - allocate(pcf%leaf_mr(beg:end)) - allocate(pcf%froot_mr(beg:end)) - allocate(pcf%livestem_mr(beg:end)) - allocate(pcf%livecroot_mr(beg:end)) - allocate(pcf%leaf_curmr(beg:end)) - allocate(pcf%froot_curmr(beg:end)) - allocate(pcf%livestem_curmr(beg:end)) - allocate(pcf%livecroot_curmr(beg:end)) - allocate(pcf%leaf_xsmr(beg:end)) - allocate(pcf%froot_xsmr(beg:end)) - allocate(pcf%livestem_xsmr(beg:end)) - allocate(pcf%livecroot_xsmr(beg:end)) - allocate(pcf%psnsun_to_cpool(beg:end)) - allocate(pcf%psnshade_to_cpool(beg:end)) - allocate(pcf%cpool_to_xsmrpool(beg:end)) - allocate(pcf%cpool_to_leafc(beg:end)) - allocate(pcf%cpool_to_leafc_storage(beg:end)) - allocate(pcf%cpool_to_frootc(beg:end)) - allocate(pcf%cpool_to_frootc_storage(beg:end)) - allocate(pcf%cpool_to_livestemc(beg:end)) - allocate(pcf%cpool_to_livestemc_storage(beg:end)) - allocate(pcf%cpool_to_deadstemc(beg:end)) - allocate(pcf%cpool_to_deadstemc_storage(beg:end)) - allocate(pcf%cpool_to_livecrootc(beg:end)) - allocate(pcf%cpool_to_livecrootc_storage(beg:end)) - allocate(pcf%cpool_to_deadcrootc(beg:end)) - allocate(pcf%cpool_to_deadcrootc_storage(beg:end)) - allocate(pcf%cpool_to_gresp_storage(beg:end)) - allocate(pcf%cpool_leaf_gr(beg:end)) - allocate(pcf%cpool_leaf_storage_gr(beg:end)) - allocate(pcf%transfer_leaf_gr(beg:end)) - allocate(pcf%cpool_froot_gr(beg:end)) - allocate(pcf%cpool_froot_storage_gr(beg:end)) - allocate(pcf%transfer_froot_gr(beg:end)) - allocate(pcf%cpool_livestem_gr(beg:end)) - allocate(pcf%cpool_livestem_storage_gr(beg:end)) - allocate(pcf%transfer_livestem_gr(beg:end)) - allocate(pcf%cpool_deadstem_gr(beg:end)) - allocate(pcf%cpool_deadstem_storage_gr(beg:end)) - allocate(pcf%transfer_deadstem_gr(beg:end)) - allocate(pcf%cpool_livecroot_gr(beg:end)) - allocate(pcf%cpool_livecroot_storage_gr(beg:end)) - allocate(pcf%transfer_livecroot_gr(beg:end)) - allocate(pcf%cpool_deadcroot_gr(beg:end)) - allocate(pcf%cpool_deadcroot_storage_gr(beg:end)) - allocate(pcf%transfer_deadcroot_gr(beg:end)) - allocate(pcf%leafc_storage_to_xfer(beg:end)) - allocate(pcf%frootc_storage_to_xfer(beg:end)) - allocate(pcf%livestemc_storage_to_xfer(beg:end)) - allocate(pcf%deadstemc_storage_to_xfer(beg:end)) - allocate(pcf%livecrootc_storage_to_xfer(beg:end)) - allocate(pcf%deadcrootc_storage_to_xfer(beg:end)) - allocate(pcf%gresp_storage_to_xfer(beg:end)) - allocate(pcf%livestemc_to_deadstemc(beg:end)) - allocate(pcf%livecrootc_to_deadcrootc(beg:end)) - allocate(pcf%gpp(beg:end)) - allocate(pcf%mr(beg:end)) - allocate(pcf%current_gr(beg:end)) - allocate(pcf%transfer_gr(beg:end)) - allocate(pcf%storage_gr(beg:end)) - allocate(pcf%gr(beg:end)) - allocate(pcf%ar(beg:end)) - allocate(pcf%rr(beg:end)) - allocate(pcf%npp(beg:end)) - allocate(pcf%agnpp(beg:end)) - allocate(pcf%bgnpp(beg:end)) - allocate(pcf%litfall(beg:end)) - allocate(pcf%vegfire(beg:end)) - allocate(pcf%wood_harvestc(beg:end)) - allocate(pcf%pft_cinputs(beg:end)) - allocate(pcf%pft_coutputs(beg:end)) - allocate(pcf%pft_fire_closs(beg:end)) - if ( crop_prog )then - allocate(pcf%xsmrpool_to_atm(beg:end)) - allocate(pcf%grainc_xfer_to_grainc(beg:end)) - allocate(pcf%livestemc_to_litter(beg:end)) - allocate(pcf%grainc_to_food(beg:end)) - allocate(pcf%cpool_to_grainc(beg:end)) - allocate(pcf%cpool_to_grainc_storage(beg:end)) - allocate(pcf%cpool_grain_gr(beg:end)) - allocate(pcf%cpool_grain_storage_gr(beg:end)) - allocate(pcf%transfer_grain_gr(beg:end)) - allocate(pcf%grainc_storage_to_xfer(beg:end)) - end if - if (use_cn) then - allocate(pcf%frootc_alloc(beg:end)) - allocate(pcf%frootc_loss(beg:end)) - allocate(pcf%leafc_alloc(beg:end)) - allocate(pcf%leafc_loss(beg:end)) - allocate(pcf%woodc_alloc(beg:end)) - allocate(pcf%woodc_loss(beg:end)) - end if - - pcf%psnsun(beg:end) = nan - pcf%psnsha(beg:end) = nan - pcf%fpsn(beg:end) = spval - pcf%fco2(beg:end) = 0._r8 - - pcf%m_leafc_to_litter(beg:end) = nan - pcf%m_frootc_to_litter(beg:end) = nan - pcf%m_leafc_storage_to_litter(beg:end) = nan - pcf%m_frootc_storage_to_litter(beg:end) = nan - pcf%m_livestemc_storage_to_litter(beg:end) = nan - pcf%m_deadstemc_storage_to_litter(beg:end) = nan - pcf%m_livecrootc_storage_to_litter(beg:end) = nan - pcf%m_deadcrootc_storage_to_litter(beg:end) = nan - pcf%m_leafc_xfer_to_litter(beg:end) = nan - pcf%m_frootc_xfer_to_litter(beg:end) = nan - pcf%m_livestemc_xfer_to_litter(beg:end) = nan - pcf%m_deadstemc_xfer_to_litter(beg:end) = nan - pcf%m_livecrootc_xfer_to_litter(beg:end) = nan - pcf%m_deadcrootc_xfer_to_litter(beg:end) = nan - pcf%m_livestemc_to_litter(beg:end) = nan - pcf%m_deadstemc_to_litter(beg:end) = nan - pcf%m_livecrootc_to_litter(beg:end) = nan - pcf%m_deadcrootc_to_litter(beg:end) = nan - pcf%m_gresp_storage_to_litter(beg:end) = nan - pcf%m_gresp_xfer_to_litter(beg:end) = nan - pcf%hrv_leafc_to_litter(beg:end) = nan - pcf%hrv_leafc_storage_to_litter(beg:end) = nan - pcf%hrv_leafc_xfer_to_litter(beg:end) = nan - pcf%hrv_frootc_to_litter(beg:end) = nan - pcf%hrv_frootc_storage_to_litter(beg:end) = nan - pcf%hrv_frootc_xfer_to_litter(beg:end) = nan - pcf%hrv_livestemc_to_litter(beg:end) = nan - pcf%hrv_livestemc_storage_to_litter(beg:end) = nan - pcf%hrv_livestemc_xfer_to_litter(beg:end) = nan - pcf%hrv_deadstemc_to_prod10c(beg:end) = nan - pcf%hrv_deadstemc_to_prod100c(beg:end) = nan - pcf%hrv_deadstemc_storage_to_litter(beg:end) = nan - pcf%hrv_deadstemc_xfer_to_litter(beg:end) = nan - pcf%hrv_livecrootc_to_litter(beg:end) = nan - pcf%hrv_livecrootc_storage_to_litter(beg:end) = nan - pcf%hrv_livecrootc_xfer_to_litter(beg:end) = nan - pcf%hrv_deadcrootc_to_litter(beg:end) = nan - pcf%hrv_deadcrootc_storage_to_litter(beg:end) = nan - pcf%hrv_deadcrootc_xfer_to_litter(beg:end) = nan - pcf%hrv_gresp_storage_to_litter(beg:end) = nan - pcf%hrv_gresp_xfer_to_litter(beg:end) = nan - pcf%hrv_xsmrpool_to_atm(beg:end) = nan - pcf%m_leafc_to_fire(beg:end) = nan - pcf%m_frootc_to_fire(beg:end) = nan - pcf%m_leafc_storage_to_fire(beg:end) = nan - pcf%m_frootc_storage_to_fire(beg:end) = nan - pcf%m_livestemc_storage_to_fire(beg:end) = nan - pcf%m_deadstemc_storage_to_fire(beg:end) = nan - pcf%m_livecrootc_storage_to_fire(beg:end) = nan - pcf%m_deadcrootc_storage_to_fire(beg:end) = nan - pcf%m_leafc_xfer_to_fire(beg:end) = nan - pcf%m_frootc_xfer_to_fire(beg:end) = nan - pcf%m_livestemc_xfer_to_fire(beg:end) = nan - pcf%m_deadstemc_xfer_to_fire(beg:end) = nan - pcf%m_livecrootc_xfer_to_fire(beg:end) = nan - pcf%m_deadcrootc_xfer_to_fire(beg:end) = nan - pcf%m_livestemc_to_fire(beg:end) = nan - pcf%m_deadstemc_to_fire(beg:end) = nan - pcf%m_deadstemc_to_litter_fire(beg:end) = nan - pcf%m_livecrootc_to_fire(beg:end) = nan - pcf%m_deadcrootc_to_fire(beg:end) = nan - pcf%m_deadcrootc_to_litter_fire(beg:end) = nan - pcf%m_gresp_storage_to_fire(beg:end) = nan - pcf%m_gresp_xfer_to_fire(beg:end) = nan - pcf%leafc_xfer_to_leafc(beg:end) = nan - pcf%frootc_xfer_to_frootc(beg:end) = nan - pcf%livestemc_xfer_to_livestemc(beg:end) = nan - pcf%deadstemc_xfer_to_deadstemc(beg:end) = nan - pcf%livecrootc_xfer_to_livecrootc(beg:end) = nan - pcf%deadcrootc_xfer_to_deadcrootc(beg:end) = nan - pcf%leafc_to_litter(beg:end) = nan - pcf%frootc_to_litter(beg:end) = nan - pcf%leaf_mr(beg:end) = nan - pcf%froot_mr(beg:end) = nan - pcf%livestem_mr(beg:end) = nan - pcf%livecroot_mr(beg:end) = nan - pcf%leaf_curmr(beg:end) = nan - pcf%froot_curmr(beg:end) = nan - pcf%livestem_curmr(beg:end) = nan - pcf%livecroot_curmr(beg:end) = nan - pcf%leaf_xsmr(beg:end) = nan - pcf%froot_xsmr(beg:end) = nan - pcf%livestem_xsmr(beg:end) = nan - pcf%livecroot_xsmr(beg:end) = nan - pcf%psnsun_to_cpool(beg:end) = nan - pcf%psnshade_to_cpool(beg:end) = nan - pcf%cpool_to_xsmrpool(beg:end) = nan - pcf%cpool_to_leafc(beg:end) = nan - pcf%cpool_to_leafc_storage(beg:end) = nan - pcf%cpool_to_frootc(beg:end) = nan - pcf%cpool_to_frootc_storage(beg:end) = nan - pcf%cpool_to_livestemc(beg:end) = nan - pcf%cpool_to_livestemc_storage(beg:end) = nan - pcf%cpool_to_deadstemc(beg:end) = nan - pcf%cpool_to_deadstemc_storage(beg:end) = nan - pcf%cpool_to_livecrootc(beg:end) = nan - pcf%cpool_to_livecrootc_storage(beg:end) = nan - pcf%cpool_to_deadcrootc(beg:end) = nan - pcf%cpool_to_deadcrootc_storage(beg:end) = nan - pcf%cpool_to_gresp_storage(beg:end) = nan - pcf%cpool_leaf_gr(beg:end) = nan - pcf%cpool_leaf_storage_gr(beg:end) = nan - pcf%transfer_leaf_gr(beg:end) = nan - pcf%cpool_froot_gr(beg:end) = nan - pcf%cpool_froot_storage_gr(beg:end) = nan - pcf%transfer_froot_gr(beg:end) = nan - pcf%cpool_livestem_gr(beg:end) = nan - pcf%cpool_livestem_storage_gr(beg:end) = nan - pcf%transfer_livestem_gr(beg:end) = nan - pcf%cpool_deadstem_gr(beg:end) = nan - pcf%cpool_deadstem_storage_gr(beg:end) = nan - pcf%transfer_deadstem_gr(beg:end) = nan - pcf%cpool_livecroot_gr(beg:end) = nan - pcf%cpool_livecroot_storage_gr(beg:end) = nan - pcf%transfer_livecroot_gr(beg:end) = nan - pcf%cpool_deadcroot_gr(beg:end) = nan - pcf%cpool_deadcroot_storage_gr(beg:end) = nan - pcf%transfer_deadcroot_gr(beg:end) = nan - pcf%leafc_storage_to_xfer(beg:end) = nan - pcf%frootc_storage_to_xfer(beg:end) = nan - pcf%livestemc_storage_to_xfer(beg:end) = nan - pcf%deadstemc_storage_to_xfer(beg:end) = nan - pcf%livecrootc_storage_to_xfer(beg:end) = nan - pcf%deadcrootc_storage_to_xfer(beg:end) = nan - pcf%gresp_storage_to_xfer(beg:end) = nan - pcf%livestemc_to_deadstemc(beg:end) = nan - pcf%livecrootc_to_deadcrootc(beg:end) = nan - pcf%gpp(beg:end) = nan - pcf%mr(beg:end) = nan - pcf%current_gr(beg:end) = nan - pcf%transfer_gr(beg:end) = nan - pcf%storage_gr(beg:end) = nan - pcf%gr(beg:end) = nan - pcf%ar(beg:end) = nan - pcf%rr(beg:end) = nan - pcf%npp(beg:end) = nan - pcf%agnpp(beg:end) = nan - pcf%bgnpp(beg:end) = nan - pcf%litfall(beg:end) = nan - pcf%vegfire(beg:end) = nan - pcf%wood_harvestc(beg:end) = nan - pcf%pft_cinputs(beg:end) = nan - pcf%pft_coutputs(beg:end) = nan - pcf%pft_fire_closs(beg:end) = nan - if ( crop_prog )then - pcf%xsmrpool_to_atm(beg:end) = nan - pcf%grainc_xfer_to_grainc(beg:end) = nan - pcf%livestemc_to_litter(beg:end) = nan - pcf%grainc_to_food(beg:end) = nan - pcf%cpool_to_grainc(beg:end) = nan - pcf%cpool_to_grainc_storage(beg:end) = nan - pcf%cpool_grain_gr(beg:end) = nan - pcf%cpool_grain_storage_gr(beg:end) = nan - pcf%transfer_grain_gr(beg:end) = nan - pcf%grainc_storage_to_xfer(beg:end) = nan - end if - if (use_cn) then - pcf%frootc_alloc(beg:end) = nan - pcf%frootc_loss(beg:end) = nan - pcf%leafc_alloc(beg:end) = nan - pcf%leafc_loss(beg:end) = nan - pcf%woodc_alloc(beg:end) = nan - pcf%woodc_loss(beg:end) = nan - end if - - end subroutine init_pft_cflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_nflux_type -! -! !INTERFACE: - subroutine init_pft_nflux_type(beg, end, pnf) -! -! !DESCRIPTION: -! Initialize pft nitrogen flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_nflux_type), intent(inout) :: pnf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pnf%m_leafn_to_litter(beg:end)) - allocate(pnf%m_frootn_to_litter(beg:end)) - allocate(pnf%m_leafn_storage_to_litter(beg:end)) - allocate(pnf%m_frootn_storage_to_litter(beg:end)) - allocate(pnf%m_livestemn_storage_to_litter(beg:end)) - allocate(pnf%m_deadstemn_storage_to_litter(beg:end)) - allocate(pnf%m_livecrootn_storage_to_litter(beg:end)) - allocate(pnf%m_deadcrootn_storage_to_litter(beg:end)) - allocate(pnf%m_leafn_xfer_to_litter(beg:end)) - allocate(pnf%m_frootn_xfer_to_litter(beg:end)) - allocate(pnf%m_livestemn_xfer_to_litter(beg:end)) - allocate(pnf%m_deadstemn_xfer_to_litter(beg:end)) - allocate(pnf%m_livecrootn_xfer_to_litter(beg:end)) - allocate(pnf%m_deadcrootn_xfer_to_litter(beg:end)) - allocate(pnf%m_livestemn_to_litter(beg:end)) - allocate(pnf%m_deadstemn_to_litter(beg:end)) - allocate(pnf%m_livecrootn_to_litter(beg:end)) - allocate(pnf%m_deadcrootn_to_litter(beg:end)) - allocate(pnf%m_retransn_to_litter(beg:end)) - allocate(pnf%hrv_leafn_to_litter(beg:end)) - allocate(pnf%hrv_frootn_to_litter(beg:end)) - allocate(pnf%hrv_leafn_storage_to_litter(beg:end)) - allocate(pnf%hrv_frootn_storage_to_litter(beg:end)) - allocate(pnf%hrv_livestemn_storage_to_litter(beg:end)) - allocate(pnf%hrv_deadstemn_storage_to_litter(beg:end)) - allocate(pnf%hrv_livecrootn_storage_to_litter(beg:end)) - allocate(pnf%hrv_deadcrootn_storage_to_litter(beg:end)) - allocate(pnf%hrv_leafn_xfer_to_litter(beg:end)) - allocate(pnf%hrv_frootn_xfer_to_litter(beg:end)) - allocate(pnf%hrv_livestemn_xfer_to_litter(beg:end)) - allocate(pnf%hrv_deadstemn_xfer_to_litter(beg:end)) - allocate(pnf%hrv_livecrootn_xfer_to_litter(beg:end)) - allocate(pnf%hrv_deadcrootn_xfer_to_litter(beg:end)) - allocate(pnf%hrv_livestemn_to_litter(beg:end)) - allocate(pnf%hrv_deadstemn_to_prod10n(beg:end)) - allocate(pnf%hrv_deadstemn_to_prod100n(beg:end)) - allocate(pnf%hrv_livecrootn_to_litter(beg:end)) - allocate(pnf%hrv_deadcrootn_to_litter(beg:end)) - allocate(pnf%hrv_retransn_to_litter(beg:end)) - allocate(pnf%m_leafn_to_fire(beg:end)) - allocate(pnf%m_frootn_to_fire(beg:end)) - allocate(pnf%m_leafn_storage_to_fire(beg:end)) - allocate(pnf%m_frootn_storage_to_fire(beg:end)) - allocate(pnf%m_livestemn_storage_to_fire(beg:end)) - allocate(pnf%m_deadstemn_storage_to_fire(beg:end)) - allocate(pnf%m_livecrootn_storage_to_fire(beg:end)) - allocate(pnf%m_deadcrootn_storage_to_fire(beg:end)) - allocate(pnf%m_leafn_xfer_to_fire(beg:end)) - allocate(pnf%m_frootn_xfer_to_fire(beg:end)) - allocate(pnf%m_livestemn_xfer_to_fire(beg:end)) - allocate(pnf%m_deadstemn_xfer_to_fire(beg:end)) - allocate(pnf%m_livecrootn_xfer_to_fire(beg:end)) - allocate(pnf%m_deadcrootn_xfer_to_fire(beg:end)) - allocate(pnf%m_livestemn_to_fire(beg:end)) - allocate(pnf%m_deadstemn_to_fire(beg:end)) - allocate(pnf%m_deadstemn_to_litter_fire(beg:end)) - allocate(pnf%m_livecrootn_to_fire(beg:end)) - allocate(pnf%m_deadcrootn_to_fire(beg:end)) - allocate(pnf%m_deadcrootn_to_litter_fire(beg:end)) - allocate(pnf%m_retransn_to_fire(beg:end)) - allocate(pnf%leafn_xfer_to_leafn(beg:end)) - allocate(pnf%frootn_xfer_to_frootn(beg:end)) - allocate(pnf%livestemn_xfer_to_livestemn(beg:end)) - allocate(pnf%deadstemn_xfer_to_deadstemn(beg:end)) - allocate(pnf%livecrootn_xfer_to_livecrootn(beg:end)) - allocate(pnf%deadcrootn_xfer_to_deadcrootn(beg:end)) - allocate(pnf%leafn_to_litter(beg:end)) - allocate(pnf%leafn_to_retransn(beg:end)) - allocate(pnf%frootn_to_litter(beg:end)) - allocate(pnf%retransn_to_npool(beg:end)) - allocate(pnf%sminn_to_npool(beg:end)) - allocate(pnf%npool_to_leafn(beg:end)) - allocate(pnf%npool_to_leafn_storage(beg:end)) - allocate(pnf%npool_to_frootn(beg:end)) - allocate(pnf%npool_to_frootn_storage(beg:end)) - allocate(pnf%npool_to_livestemn(beg:end)) - allocate(pnf%npool_to_livestemn_storage(beg:end)) - allocate(pnf%npool_to_deadstemn(beg:end)) - allocate(pnf%npool_to_deadstemn_storage(beg:end)) - allocate(pnf%npool_to_livecrootn(beg:end)) - allocate(pnf%npool_to_livecrootn_storage(beg:end)) - allocate(pnf%npool_to_deadcrootn(beg:end)) - allocate(pnf%npool_to_deadcrootn_storage(beg:end)) - allocate(pnf%leafn_storage_to_xfer(beg:end)) - allocate(pnf%frootn_storage_to_xfer(beg:end)) - allocate(pnf%livestemn_storage_to_xfer(beg:end)) - allocate(pnf%deadstemn_storage_to_xfer(beg:end)) - allocate(pnf%livecrootn_storage_to_xfer(beg:end)) - allocate(pnf%deadcrootn_storage_to_xfer(beg:end)) - allocate(pnf%livestemn_to_deadstemn(beg:end)) - allocate(pnf%livestemn_to_retransn(beg:end)) - allocate(pnf%livecrootn_to_deadcrootn(beg:end)) - allocate(pnf%livecrootn_to_retransn(beg:end)) - allocate(pnf%ndeploy(beg:end)) - allocate(pnf%pft_ninputs(beg:end)) - allocate(pnf%pft_noutputs(beg:end)) - allocate(pnf%wood_harvestn(beg:end)) - allocate(pnf%pft_fire_nloss(beg:end)) - if ( crop_prog )then - allocate(pnf%grainn_xfer_to_grainn(beg:end)) - allocate(pnf%livestemn_to_litter(beg:end)) - allocate(pnf%grainn_to_food(beg:end)) - allocate(pnf%npool_to_grainn(beg:end)) - allocate(pnf%npool_to_grainn_storage(beg:end)) - allocate(pnf%grainn_storage_to_xfer(beg:end)) - end if - - pnf%m_leafn_to_litter(beg:end) = nan - pnf%m_frootn_to_litter(beg:end) = nan - pnf%m_leafn_storage_to_litter(beg:end) = nan - pnf%m_frootn_storage_to_litter(beg:end) = nan - pnf%m_livestemn_storage_to_litter(beg:end) = nan - pnf%m_deadstemn_storage_to_litter(beg:end) = nan - pnf%m_livecrootn_storage_to_litter(beg:end) = nan - pnf%m_deadcrootn_storage_to_litter(beg:end) = nan - pnf%m_leafn_xfer_to_litter(beg:end) = nan - pnf%m_frootn_xfer_to_litter(beg:end) = nan - pnf%m_livestemn_xfer_to_litter(beg:end) = nan - pnf%m_deadstemn_xfer_to_litter(beg:end) = nan - pnf%m_livecrootn_xfer_to_litter(beg:end) = nan - pnf%m_deadcrootn_xfer_to_litter(beg:end) = nan - pnf%m_livestemn_to_litter(beg:end) = nan - pnf%m_deadstemn_to_litter(beg:end) = nan - pnf%m_livecrootn_to_litter(beg:end) = nan - pnf%m_deadcrootn_to_litter(beg:end) = nan - pnf%m_retransn_to_litter(beg:end) = nan - pnf%hrv_leafn_to_litter(beg:end) = nan - pnf%hrv_frootn_to_litter(beg:end) = nan - pnf%hrv_leafn_storage_to_litter(beg:end) = nan - pnf%hrv_frootn_storage_to_litter(beg:end) = nan - pnf%hrv_livestemn_storage_to_litter(beg:end) = nan - pnf%hrv_deadstemn_storage_to_litter(beg:end) = nan - pnf%hrv_livecrootn_storage_to_litter(beg:end) = nan - pnf%hrv_deadcrootn_storage_to_litter(beg:end) = nan - pnf%hrv_leafn_xfer_to_litter(beg:end) = nan - pnf%hrv_frootn_xfer_to_litter(beg:end) = nan - pnf%hrv_livestemn_xfer_to_litter(beg:end) = nan - pnf%hrv_deadstemn_xfer_to_litter(beg:end) = nan - pnf%hrv_livecrootn_xfer_to_litter(beg:end) = nan - pnf%hrv_deadcrootn_xfer_to_litter(beg:end) = nan - pnf%hrv_livestemn_to_litter(beg:end) = nan - pnf%hrv_deadstemn_to_prod10n(beg:end) = nan - pnf%hrv_deadstemn_to_prod100n(beg:end) = nan - pnf%hrv_livecrootn_to_litter(beg:end) = nan - pnf%hrv_deadcrootn_to_litter(beg:end) = nan - pnf%hrv_retransn_to_litter(beg:end) = nan - pnf%m_leafn_to_fire(beg:end) = nan - pnf%m_frootn_to_fire(beg:end) = nan - pnf%m_leafn_storage_to_fire(beg:end) = nan - pnf%m_frootn_storage_to_fire(beg:end) = nan - pnf%m_livestemn_storage_to_fire(beg:end) = nan - pnf%m_deadstemn_storage_to_fire(beg:end) = nan - pnf%m_livecrootn_storage_to_fire(beg:end) = nan - pnf%m_deadcrootn_storage_to_fire(beg:end) = nan - pnf%m_leafn_xfer_to_fire(beg:end) = nan - pnf%m_frootn_xfer_to_fire(beg:end) = nan - pnf%m_livestemn_xfer_to_fire(beg:end) = nan - pnf%m_deadstemn_xfer_to_fire(beg:end) = nan - pnf%m_livecrootn_xfer_to_fire(beg:end) = nan - pnf%m_deadcrootn_xfer_to_fire(beg:end) = nan - pnf%m_livestemn_to_fire(beg:end) = nan - pnf%m_deadstemn_to_fire(beg:end) = nan - pnf%m_deadstemn_to_litter_fire(beg:end) = nan - pnf%m_livecrootn_to_fire(beg:end) = nan - pnf%m_deadcrootn_to_fire(beg:end) = nan - pnf%m_deadcrootn_to_litter_fire(beg:end) = nan - pnf%m_retransn_to_fire(beg:end) = nan - pnf%leafn_xfer_to_leafn(beg:end) = nan - pnf%frootn_xfer_to_frootn(beg:end) = nan - pnf%livestemn_xfer_to_livestemn(beg:end) = nan - pnf%deadstemn_xfer_to_deadstemn(beg:end) = nan - pnf%livecrootn_xfer_to_livecrootn(beg:end) = nan - pnf%deadcrootn_xfer_to_deadcrootn(beg:end) = nan - pnf%leafn_to_litter(beg:end) = nan - pnf%leafn_to_retransn(beg:end) = nan - pnf%frootn_to_litter(beg:end) = nan - pnf%retransn_to_npool(beg:end) = nan - pnf%sminn_to_npool(beg:end) = nan - pnf%npool_to_leafn(beg:end) = nan - pnf%npool_to_leafn_storage(beg:end) = nan - pnf%npool_to_frootn(beg:end) = nan - pnf%npool_to_frootn_storage(beg:end) = nan - pnf%npool_to_livestemn(beg:end) = nan - pnf%npool_to_livestemn_storage(beg:end) = nan - pnf%npool_to_deadstemn(beg:end) = nan - pnf%npool_to_deadstemn_storage(beg:end) = nan - pnf%npool_to_livecrootn(beg:end) = nan - pnf%npool_to_livecrootn_storage(beg:end) = nan - pnf%npool_to_deadcrootn(beg:end) = nan - pnf%npool_to_deadcrootn_storage(beg:end) = nan - pnf%leafn_storage_to_xfer(beg:end) = nan - pnf%frootn_storage_to_xfer(beg:end) = nan - pnf%livestemn_storage_to_xfer(beg:end) = nan - pnf%deadstemn_storage_to_xfer(beg:end) = nan - pnf%livecrootn_storage_to_xfer(beg:end) = nan - pnf%deadcrootn_storage_to_xfer(beg:end) = nan - pnf%livestemn_to_deadstemn(beg:end) = nan - pnf%livestemn_to_retransn(beg:end) = nan - pnf%livecrootn_to_deadcrootn(beg:end) = nan - pnf%livecrootn_to_retransn(beg:end) = nan - pnf%ndeploy(beg:end) = nan - pnf%pft_ninputs(beg:end) = nan - pnf%pft_noutputs(beg:end) = nan - pnf%wood_harvestn(beg:end) = nan - pnf%pft_fire_nloss(beg:end) = nan - if ( crop_prog )then - pnf%grainn_xfer_to_grainn(beg:end) = nan - pnf%livestemn_to_litter(beg:end) = nan - pnf%grainn_to_food(beg:end) = nan - pnf%npool_to_grainn(beg:end) = nan - pnf%npool_to_grainn_storage(beg:end) = nan - pnf%grainn_storage_to_xfer(beg:end) = nan - end if - - end subroutine init_pft_nflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_vflux_type -! -! !INTERFACE: - subroutine init_pft_vflux_type(beg, end, pvf) -! -! !DESCRIPTION: -! Initialize pft VOC flux variables -! - use clm_varcon, only : spval - use shr_megan_mod, only: shr_megan_megcomps_n, shr_megan_mechcomps_n -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_vflux_type), intent(inout) :: pvf - - integer :: i -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! (heald, 08/06) -! -!EOP -!------------------------------------------------------------------------ - - if (shr_megan_mechcomps_n<1) return - - allocate(pvf%vocflx_tot(beg:end)) - allocate(pvf%vocflx(beg:end,1:shr_megan_mechcomps_n)) - allocate(pvf%Eopt_out(beg:end)) - allocate(pvf%topt_out(beg:end)) - allocate(pvf%alpha_out(beg:end)) - allocate(pvf%cp_out(beg:end)) - allocate(pvf%para_out(beg:end)) - allocate(pvf%par24a_out(beg:end)) - allocate(pvf%par240a_out(beg:end)) - allocate(pvf%paru_out(beg:end)) - allocate(pvf%par24u_out(beg:end)) - allocate(pvf%par240u_out(beg:end)) - allocate(pvf%gamma_out(beg:end)) - allocate(pvf%gammaL_out(beg:end)) - allocate(pvf%gammaT_out(beg:end)) - allocate(pvf%gammaP_out(beg:end)) - allocate(pvf%gammaA_out(beg:end)) - allocate(pvf%gammaS_out(beg:end)) - allocate(pvf%gammaC_out(beg:end)) - - pvf%vocflx_tot(beg:end) = nan - pvf%vocflx(beg:end,1:shr_megan_mechcomps_n) = nan - pvf%Eopt_out(beg:end) = nan - pvf%topt_out(beg:end) = nan - pvf%alpha_out(beg:end) = nan - pvf%cp_out(beg:end) = nan - pvf%para_out(beg:end) = nan - pvf%par24a_out(beg:end) = nan - pvf%par240a_out(beg:end) = nan - pvf%paru_out(beg:end) = nan - pvf%par24u_out(beg:end) = nan - pvf%par240u_out(beg:end) = nan - pvf%gamma_out(beg:end) = nan - pvf%gammaL_out(beg:end) = nan - pvf%gammaT_out(beg:end) = nan - pvf%gammaP_out(beg:end) = nan - pvf%gammaA_out(beg:end) = nan - pvf%gammaS_out(beg:end) = nan - pvf%gammaC_out(beg:end) = nan - - allocate(pvf%meg(shr_megan_megcomps_n)) - - do i=1,shr_megan_megcomps_n - allocate(pvf%meg(i)%flux_out(beg:end)) - pvf%meg(i)%flux_out(beg:end) = nan - enddo - - end subroutine init_pft_vflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_dflux_type -! -! !INTERFACE: - subroutine init_pft_dflux_type(beg, end, pdf) -! -! !DESCRIPTION: -! Initialize pft dust flux variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_dflux_type), intent(inout):: pdf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(pdf%flx_mss_vrt_dst(beg:end,1:ndst)) - allocate(pdf%flx_mss_vrt_dst_tot(beg:end)) - allocate(pdf%vlc_trb(beg:end,1:ndst)) - allocate(pdf%vlc_trb_1(beg:end)) - allocate(pdf%vlc_trb_2(beg:end)) - allocate(pdf%vlc_trb_3(beg:end)) - allocate(pdf%vlc_trb_4(beg:end)) - - pdf%flx_mss_vrt_dst(beg:end,1:ndst) = nan - pdf%flx_mss_vrt_dst_tot(beg:end) = nan - pdf%vlc_trb(beg:end,1:ndst) = nan - pdf%vlc_trb_1(beg:end) = nan - pdf%vlc_trb_2(beg:end) = nan - pdf%vlc_trb_3(beg:end) = nan - pdf%vlc_trb_4(beg:end) = nan - - end subroutine init_pft_dflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_pft_depvd_type -! -! !INTERFACE: - subroutine init_pft_depvd_type(beg, end, pdd) - - use seq_drydep_mod, only: n_drydep, drydep_method, DD_XLND -! -! !DESCRIPTION: -! Initialize pft dep velocity variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (pft_depvd_type), intent(inout):: pdd - integer :: i -! -! !REVISION HISTORY: -! Created by James Sulzman 541-929-6183 -! -!EOP -!------------------------------------------------------------------------ - - if ( n_drydep > 0 .and. drydep_method == DD_XLND )then - allocate(pdd%drydepvel(beg:end,n_drydep)) - pdd%drydepvel = nan - end if - - end subroutine init_pft_depvd_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_pstate_type -! -! !INTERFACE: - subroutine init_column_pstate_type(beg, end, cps) -! -! !DESCRIPTION: -! Initialize column physical state variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_pstate_type), intent(inout):: cps -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(cps%snl(beg:end)) !* cannot be averaged up - allocate(cps%isoicol(beg:end)) !* cannot be averaged up - allocate(cps%bsw(beg:end,nlevgrnd)) - allocate(cps%watsat(beg:end,nlevgrnd)) - allocate(cps%watfc(beg:end,nlevgrnd)) - allocate(cps%watdry(beg:end,nlevgrnd)) - allocate(cps%watopt(beg:end,nlevgrnd)) - allocate(cps%hksat(beg:end,nlevgrnd)) - allocate(cps%sucsat(beg:end,nlevgrnd)) - allocate(cps%csol(beg:end,nlevgrnd)) - allocate(cps%tkmg(beg:end,nlevgrnd)) - allocate(cps%tkdry(beg:end,nlevgrnd)) - allocate(cps%tksatu(beg:end,nlevgrnd)) - allocate(cps%smpmin(beg:end)) - allocate(cps%hkdepth(beg:end)) - allocate(cps%wtfact(beg:end)) - allocate(cps%fracice(beg:end,nlevgrnd)) - allocate(cps%gwc_thr(beg:end)) - allocate(cps%mss_frc_cly_vld(beg:end)) - allocate(cps%mbl_bsn_fct(beg:end)) - allocate(cps%do_capsnow(beg:end)) - allocate(cps%snowdp(beg:end)) - allocate(cps%frac_sno (beg:end)) - allocate(cps%zi(beg:end,-nlevsno+0:nlevgrnd)) - allocate(cps%dz(beg:end,-nlevsno+1:nlevgrnd)) - allocate(cps%z (beg:end,-nlevsno+1:nlevgrnd)) - allocate(cps%frac_iceold(beg:end,-nlevsno+1:nlevgrnd)) - allocate(cps%imelt(beg:end,-nlevsno+1:nlevgrnd)) - allocate(cps%eff_porosity(beg:end,nlevgrnd)) - allocate(cps%emg(beg:end)) - allocate(cps%z0mg(beg:end)) - allocate(cps%z0hg(beg:end)) - allocate(cps%z0qg(beg:end)) - allocate(cps%htvp(beg:end)) - allocate(cps%beta(beg:end)) - allocate(cps%zii(beg:end)) - allocate(cps%albgrd(beg:end,numrad)) - allocate(cps%albgri(beg:end,numrad)) - allocate(cps%rootr_column(beg:end,nlevgrnd)) - allocate(cps%rootfr_road_perv(beg:end,nlevgrnd)) - allocate(cps%rootr_road_perv(beg:end,nlevgrnd)) - allocate(cps%wf(beg:end)) -! allocate(cps%xirrig(beg:end)) - allocate(cps%max_dayl(beg:end)) - allocate(cps%bsw2(beg:end,nlevgrnd)) - allocate(cps%psisat(beg:end,nlevgrnd)) - allocate(cps%vwcsat(beg:end,nlevgrnd)) - allocate(cps%soilpsi(beg:end,nlevgrnd)) - allocate(cps%decl(beg:end)) - allocate(cps%coszen(beg:end)) - allocate(cps%fpi(beg:end)) - allocate(cps%fpg(beg:end)) - allocate(cps%annsum_counter(beg:end)) - allocate(cps%cannsum_npp(beg:end)) - allocate(cps%cannavg_t2m(beg:end)) - allocate(cps%me(beg:end)) - allocate(cps%fire_prob(beg:end)) - allocate(cps%mean_fire_prob(beg:end)) - allocate(cps%fireseasonl(beg:end)) - allocate(cps%farea_burned(beg:end)) - allocate(cps%ann_farea_burned(beg:end)) - allocate(cps%albsnd_hst(beg:end,numrad)) - allocate(cps%albsni_hst(beg:end,numrad)) - allocate(cps%albsod(beg:end,numrad)) - allocate(cps%albsoi(beg:end,numrad)) - allocate(cps%flx_absdv(beg:end,-nlevsno+1:1)) - allocate(cps%flx_absdn(beg:end,-nlevsno+1:1)) - allocate(cps%flx_absiv(beg:end,-nlevsno+1:1)) - allocate(cps%flx_absin(beg:end,-nlevsno+1:1)) - allocate(cps%snw_rds(beg:end,-nlevsno+1:0)) - allocate(cps%snw_rds_top(beg:end)) - allocate(cps%sno_liq_top(beg:end)) - allocate(cps%mss_bcpho(beg:end,-nlevsno+1:0)) - allocate(cps%mss_bcphi(beg:end,-nlevsno+1:0)) - allocate(cps%mss_bctot(beg:end,-nlevsno+1:0)) - allocate(cps%mss_bc_col(beg:end)) - allocate(cps%mss_bc_top(beg:end)) - allocate(cps%mss_ocpho(beg:end,-nlevsno+1:0)) - allocate(cps%mss_ocphi(beg:end,-nlevsno+1:0)) - allocate(cps%mss_octot(beg:end,-nlevsno+1:0)) - allocate(cps%mss_oc_col(beg:end)) - allocate(cps%mss_oc_top(beg:end)) - allocate(cps%mss_dst1(beg:end,-nlevsno+1:0)) - allocate(cps%mss_dst2(beg:end,-nlevsno+1:0)) - allocate(cps%mss_dst3(beg:end,-nlevsno+1:0)) - allocate(cps%mss_dst4(beg:end,-nlevsno+1:0)) - allocate(cps%mss_dsttot(beg:end,-nlevsno+1:0)) - allocate(cps%mss_dst_col(beg:end)) - allocate(cps%mss_dst_top(beg:end)) - allocate(cps%h2osno_top(beg:end)) - allocate(cps%mss_cnc_bcphi(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_bcpho(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_ocphi(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_ocpho(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_dst1(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_dst2(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_dst3(beg:end,-nlevsno+1:0)) - allocate(cps%mss_cnc_dst4(beg:end,-nlevsno+1:0)) - allocate(cps%albgrd_pur(beg:end,numrad)) - allocate(cps%albgri_pur(beg:end,numrad)) - allocate(cps%albgrd_bc(beg:end,numrad)) - allocate(cps%albgri_bc(beg:end,numrad)) - allocate(cps%albgrd_oc(beg:end,numrad)) - allocate(cps%albgri_oc(beg:end,numrad)) - allocate(cps%albgrd_dst(beg:end,numrad)) - allocate(cps%albgri_dst(beg:end,numrad)) - allocate(cps%dTdz_top(beg:end)) - allocate(cps%snot_top(beg:end)) - allocate(cps%irrig_rate(beg:end)) - allocate(cps%n_irrig_steps_left(beg:end)) - allocate(cps%forc_pbot(beg:end)) - allocate(cps%forc_rho(beg:end)) - allocate(cps%glc_topo(beg:end)) - cps%isoicol(beg:end) = huge(1) - cps%bsw(beg:end,1:nlevgrnd) = nan - cps%watsat(beg:end,1:nlevgrnd) = nan - cps%watfc(beg:end,1:nlevgrnd) = nan - cps%watdry(beg:end,1:nlevgrnd) = nan - cps%watopt(beg:end,1:nlevgrnd) = nan - cps%hksat(beg:end,1:nlevgrnd) = nan - cps%sucsat(beg:end,1:nlevgrnd) = nan - cps%csol(beg:end,1:nlevgrnd) = nan - cps%tkmg(beg:end,1:nlevgrnd) = nan - cps%tkdry(beg:end,1:nlevgrnd) = nan - cps%tksatu(beg:end,1:nlevgrnd) = nan - cps%smpmin(beg:end) = nan - cps%hkdepth(beg:end) = nan - cps%wtfact(beg:end) = nan - cps%fracice(beg:end,1:nlevgrnd) = nan - cps%gwc_thr(beg:end) = nan - cps%mss_frc_cly_vld(beg:end) = nan - cps%mbl_bsn_fct(beg:end) = nan - cps%do_capsnow (beg:end)= .false. - cps%snowdp(beg:end) = nan - cps%frac_sno(beg:end) = nan - cps%zi(beg:end,-nlevsno+0:nlevgrnd) = nan - cps%dz(beg:end,-nlevsno+1:nlevgrnd) = nan - cps%z (beg:end,-nlevsno+1:nlevgrnd) = nan - cps%frac_iceold(beg:end,-nlevsno+1:nlevgrnd) = spval - cps%imelt(beg:end,-nlevsno+1:nlevgrnd) = huge(1) - cps%eff_porosity(beg:end,1:nlevgrnd) = spval - cps%emg(beg:end) = nan - cps%z0mg(beg:end) = nan - cps%z0hg(beg:end) = nan - cps%z0qg(beg:end) = nan - cps%htvp(beg:end) = nan - cps%beta(beg:end) = nan - cps%zii(beg:end) = nan - cps%albgrd(beg:end,:numrad) = nan - cps%albgri(beg:end,:numrad) = nan - cps%rootr_column(beg:end,1:nlevgrnd) = spval - cps%rootfr_road_perv(beg:end,1:nlevurb) = nan - cps%rootr_road_perv(beg:end,1:nlevurb) = nan - cps%wf(beg:end) = nan -! cps%xirrig(beg:end) = 0._r8 - cps%bsw2(beg:end,1:nlevgrnd) = nan - cps%psisat(beg:end,1:nlevgrnd) = nan - cps%vwcsat(beg:end,1:nlevgrnd) = nan - cps%soilpsi(beg:end,1:nlevgrnd) = spval - cps%decl(beg:end) = nan - cps%coszen(beg:end) = nan - cps%fpi(beg:end) = nan - cps%fpg(beg:end) = nan - cps%annsum_counter(beg:end) = nan - cps%cannsum_npp(beg:end) = nan - cps%cannavg_t2m(beg:end) = nan - cps%me(beg:end) = nan - cps%fire_prob(beg:end) = nan - cps%mean_fire_prob(beg:end) = nan - cps%fireseasonl(beg:end) = nan - cps%farea_burned(beg:end) = nan - cps%ann_farea_burned(beg:end) = nan - cps%albsnd_hst(beg:end,:numrad) = spval - cps%albsni_hst(beg:end,:numrad) = spval - cps%albsod(beg:end,:numrad) = nan - cps%albsoi(beg:end,:numrad) = nan - cps%flx_absdv(beg:end,-nlevsno+1:1) = spval - cps%flx_absdn(beg:end,-nlevsno+1:1) = spval - cps%flx_absiv(beg:end,-nlevsno+1:1) = spval - cps%flx_absin(beg:end,-nlevsno+1:1) = spval - cps%snw_rds(beg:end,-nlevsno+1:0) = nan - cps%snw_rds_top(beg:end) = nan - cps%sno_liq_top(beg:end) = nan - cps%mss_bcpho(beg:end,-nlevsno+1:0) = nan - cps%mss_bcphi(beg:end,-nlevsno+1:0) = nan - cps%mss_bctot(beg:end,-nlevsno+1:0) = nan - cps%mss_bc_col(beg:end) = nan - cps%mss_bc_top(beg:end) = nan - cps%mss_ocpho(beg:end,-nlevsno+1:0) = nan - cps%mss_ocphi(beg:end,-nlevsno+1:0) = nan - cps%mss_octot(beg:end,-nlevsno+1:0) = nan - cps%mss_oc_col(beg:end) = nan - cps%mss_oc_top(beg:end) = nan - cps%mss_dst1(beg:end,-nlevsno+1:0) = nan - cps%mss_dst2(beg:end,-nlevsno+1:0) = nan - cps%mss_dst3(beg:end,-nlevsno+1:0) = nan - cps%mss_dst4(beg:end,-nlevsno+1:0) = nan - cps%mss_dsttot(beg:end,-nlevsno+1:0) = nan - cps%mss_dst_col(beg:end) = nan - cps%mss_dst_top(beg:end) = nan - cps%h2osno_top(beg:end) = nan - cps%mss_cnc_bcphi(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_bcpho(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_ocphi(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_ocpho(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_dst1(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_dst2(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_dst3(beg:end,-nlevsno+1:0) = nan - cps%mss_cnc_dst4(beg:end,-nlevsno+1:0) = nan - cps%albgrd_pur(beg:end,:numrad) = nan - cps%albgri_pur(beg:end,:numrad) = nan - cps%albgrd_bc(beg:end,:numrad) = nan - cps%albgri_bc(beg:end,:numrad) = nan - cps%albgrd_oc(beg:end,:numrad) = nan - cps%albgri_oc(beg:end,:numrad) = nan - cps%albgrd_dst(beg:end,:numrad) = nan - cps%albgri_dst(beg:end,:numrad) = nan - cps%dTdz_top(beg:end) = nan - cps%snot_top(beg:end) = nan - cps%irrig_rate(beg:end) = nan - cps%n_irrig_steps_left(beg:end) = 0 - cps%forc_pbot(beg:end) = nan - cps%forc_rho(beg:end) = nan - cps%glc_topo(beg:end) = nan - - end subroutine init_column_pstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_estate_type -! -! !INTERFACE: - subroutine init_column_estate_type(beg, end, ces) -! -! !DESCRIPTION: -! Initialize column energy state variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_estate_type), intent(inout):: ces -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - allocate(ces%t_grnd(beg:end)) - allocate(ces%t_grnd_u(beg:end)) - allocate(ces%t_grnd_r(beg:end)) - allocate(ces%dt_grnd(beg:end)) - allocate(ces%t_soisno(beg:end,-nlevsno+1:nlevgrnd)) - allocate(ces%t_soi_10cm(beg:end)) - allocate(ces%t_lake(beg:end,1:nlevlak)) - allocate(ces%tssbef(beg:end,-nlevsno+1:nlevgrnd)) - allocate(ces%thv(beg:end)) - allocate(ces%hc_soi(beg:end)) - allocate(ces%hc_soisno(beg:end)) - allocate(ces%forc_t(beg:end)) - allocate(ces%forc_th(beg:end)) - - ces%t_grnd(beg:end) = nan - ces%t_grnd_u(beg:end) = nan - ces%t_grnd_r(beg:end) = nan - ces%dt_grnd(beg:end) = nan - ces%t_soisno(beg:end,-nlevsno+1:nlevgrnd) = spval - ces%t_soi_10cm(beg:end) = spval - ces%t_lake(beg:end,1:nlevlak) = nan - ces%tssbef(beg:end,-nlevsno+1:nlevgrnd) = nan - ces%thv(beg:end) = nan - ces%hc_soi(beg:end) = nan - ces%hc_soisno(beg:end) = nan - ces%forc_t(beg:end) = nan - ces%forc_th(beg:end) = nan - - end subroutine init_column_estate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_wstate_type -! -! !INTERFACE: - subroutine init_column_wstate_type(beg, end, cws) -! -! !DESCRIPTION: -! Initialize column water state variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_wstate_type), intent(inout):: cws !column water state -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(cws%h2osno(beg:end)) - allocate(cws%errh2osno(beg:end)) - allocate(cws%snow_sources(beg:end)) - allocate(cws%snow_sinks(beg:end)) - allocate(cws%h2osoi_liq(beg:end,-nlevsno+1:nlevgrnd)) - allocate(cws%h2osoi_ice(beg:end,-nlevsno+1:nlevgrnd)) - allocate(cws%h2osoi_liqice_10cm(beg:end)) - allocate(cws%h2osoi_vol(beg:end,1:nlevgrnd)) - allocate(cws%h2osno_old(beg:end)) - allocate(cws%qg(beg:end)) - allocate(cws%dqgdT(beg:end)) - allocate(cws%snowice(beg:end)) - allocate(cws%snowliq(beg:end)) - allocate(cws%soilalpha(beg:end)) - allocate(cws%soilbeta(beg:end)) - allocate(cws%soilalpha_u(beg:end)) - allocate(cws%zwt(beg:end)) - allocate(cws%fcov(beg:end)) - allocate(cws%fsat(beg:end)) - allocate(cws%wa(beg:end)) - allocate(cws%wt(beg:end)) - allocate(cws%qcharge(beg:end)) - allocate(cws%smp_l(beg:end,1:nlevgrnd)) - allocate(cws%hk_l(beg:end,1:nlevgrnd)) - allocate(cws%forc_q(beg:end)) - - cws%h2osno(beg:end) = nan - cws%errh2osno(beg:end) = nan - cws%snow_sources(beg:end) = nan - cws%snow_sinks(beg:end) = nan - cws%h2osoi_liq(beg:end,-nlevsno+1:nlevgrnd)= spval - cws%h2osoi_ice(beg:end,-nlevsno+1:nlevgrnd) = spval - cws%h2osoi_liqice_10cm(beg:end) = spval - cws%h2osoi_vol(beg:end,1:nlevgrnd) = spval - cws%h2osno_old(beg:end) = nan - cws%qg(beg:end) = nan - cws%dqgdT(beg:end) = nan - cws%snowice(beg:end) = nan - cws%snowliq(beg:end) = nan - cws%soilalpha(beg:end) = nan - cws%soilbeta(beg:end) = nan - cws%soilalpha_u(beg:end) = nan - cws%zwt(beg:end) = nan - cws%fcov(beg:end) = nan - cws%fsat(beg:end) = nan - cws%wa(beg:end) = nan - cws%wt(beg:end) = nan - cws%qcharge(beg:end) = nan - cws%smp_l(beg:end,1:nlevgrnd) = spval - cws%hk_l(beg:end,1:nlevgrnd) = spval - cws%forc_q(beg:end) = nan - - end subroutine init_column_wstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_cstate_type -! -! !INTERFACE: - subroutine init_column_cstate_type(beg, end, ccs) -! -! !DESCRIPTION: -! Initialize column carbon state variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_cstate_type), intent(inout):: ccs -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(ccs%soilc(beg:end)) - allocate(ccs%cwdc(beg:end)) - allocate(ccs%litr1c(beg:end)) - allocate(ccs%litr2c(beg:end)) - allocate(ccs%litr3c(beg:end)) - allocate(ccs%soil1c(beg:end)) - allocate(ccs%soil2c(beg:end)) - allocate(ccs%soil3c(beg:end)) - allocate(ccs%soil4c(beg:end)) - allocate(ccs%seedc(beg:end)) - allocate(ccs%col_ctrunc(beg:end)) - allocate(ccs%prod10c(beg:end)) - allocate(ccs%prod100c(beg:end)) - allocate(ccs%totprodc(beg:end)) - allocate(ccs%totlitc(beg:end)) - allocate(ccs%totsomc(beg:end)) - allocate(ccs%totecosysc(beg:end)) - allocate(ccs%totcolc(beg:end)) - - ccs%soilc(beg:end) = nan - ccs%cwdc(beg:end) = nan - ccs%litr1c(beg:end) = nan - ccs%litr2c(beg:end) = nan - ccs%litr3c(beg:end) = nan - ccs%soil1c(beg:end) = nan - ccs%soil2c(beg:end) = nan - ccs%soil3c(beg:end) = nan - ccs%soil4c(beg:end) = nan - ccs%seedc(beg:end) = nan - ccs%col_ctrunc(beg:end) = nan - ccs%prod10c(beg:end) = nan - ccs%prod100c(beg:end) = nan - ccs%totprodc(beg:end) = nan - ccs%totlitc(beg:end) = nan - ccs%totsomc(beg:end) = nan - ccs%totecosysc(beg:end) = nan - ccs%totcolc(beg:end) = nan - - end subroutine init_column_cstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_nstate_type -! -! !INTERFACE: - subroutine init_column_nstate_type(beg, end, cns) -! -! !DESCRIPTION: -! Initialize column nitrogen state variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_nstate_type), intent(inout):: cns -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -!------------------------------------------------------------------------ - - allocate(cns%cwdn(beg:end)) - allocate(cns%litr1n(beg:end)) - allocate(cns%litr2n(beg:end)) - allocate(cns%litr3n(beg:end)) - allocate(cns%soil1n(beg:end)) - allocate(cns%soil2n(beg:end)) - allocate(cns%soil3n(beg:end)) - allocate(cns%soil4n(beg:end)) - allocate(cns%sminn(beg:end)) - allocate(cns%col_ntrunc(beg:end)) - allocate(cns%seedn(beg:end)) - allocate(cns%prod10n(beg:end)) - allocate(cns%prod100n(beg:end)) - allocate(cns%totprodn(beg:end)) - allocate(cns%totlitn(beg:end)) - allocate(cns%totsomn(beg:end)) - allocate(cns%totecosysn(beg:end)) - allocate(cns%totcoln(beg:end)) - - cns%cwdn(beg:end) = nan - cns%litr1n(beg:end) = nan - cns%litr2n(beg:end) = nan - cns%litr3n(beg:end) = nan - cns%soil1n(beg:end) = nan - cns%soil2n(beg:end) = nan - cns%soil3n(beg:end) = nan - cns%soil4n(beg:end) = nan - cns%sminn(beg:end) = nan - cns%col_ntrunc(beg:end) = nan - cns%seedn(beg:end) = nan - cns%prod10n(beg:end) = nan - cns%prod100n(beg:end) = nan - cns%totprodn(beg:end) = nan - cns%totlitn(beg:end) = nan - cns%totsomn(beg:end) = nan - cns%totecosysn(beg:end) = nan - cns%totcoln(beg:end) = nan - - end subroutine init_column_nstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_eflux_type -! -! !INTERFACE: - subroutine init_column_eflux_type(beg, end, cef) -! -! !DESCRIPTION: -! Initialize column energy flux variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_eflux_type), intent(inout):: cef -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(cef%eflx_snomelt(beg:end)) - allocate(cef%eflx_snomelt_u(beg:end)) - allocate(cef%eflx_snomelt_r(beg:end)) - allocate(cef%eflx_impsoil(beg:end)) - allocate(cef%eflx_fgr12(beg:end)) - allocate(cef%eflx_building_heat(beg:end)) - allocate(cef%eflx_urban_ac(beg:end)) - allocate(cef%eflx_urban_heat(beg:end)) - allocate(cef%eflx_bot(beg:end)) - - cef%eflx_snomelt(beg:end) = nan - cef%eflx_snomelt_u(beg:end) = nan - cef%eflx_snomelt_r(beg:end) = nan - cef%eflx_impsoil(beg:end) = nan - cef%eflx_fgr12(beg:end) = nan - cef%eflx_building_heat(beg:end) = nan - cef%eflx_urban_ac(beg:end) = nan - cef%eflx_urban_heat(beg:end) = nan - cef%eflx_bot(beg:end) = nan - - end subroutine init_column_eflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_wflux_type -! -! !INTERFACE: - subroutine init_column_wflux_type(beg, end, cwf) -! -! !DESCRIPTION: -! Initialize column water flux variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_wflux_type), intent(inout):: cwf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(cwf%qflx_infl(beg:end)) - allocate(cwf%qflx_surf(beg:end)) - allocate(cwf%qflx_drain(beg:end)) - allocate(cwf%qflx_top_soil(beg:end)) - allocate(cwf%qflx_sl_top_soil(beg:end)) - allocate(cwf%qflx_snomelt(beg:end)) - allocate(cwf%qflx_qrgwl(beg:end)) - allocate(cwf%qflx_runoff(beg:end)) - allocate(cwf%qflx_runoff_u(beg:end)) - allocate(cwf%qflx_runoff_r(beg:end)) - allocate(cwf%qmelt(beg:end)) - allocate(cwf%h2ocan_loss(beg:end)) - allocate(cwf%qflx_rsub_sat(beg:end)) - allocate(cwf%flx_bc_dep_dry(beg:end)) - allocate(cwf%flx_bc_dep_wet(beg:end)) - allocate(cwf%flx_bc_dep_pho(beg:end)) - allocate(cwf%flx_bc_dep_phi(beg:end)) - allocate(cwf%flx_bc_dep(beg:end)) - allocate(cwf%flx_oc_dep_dry(beg:end)) - allocate(cwf%flx_oc_dep_wet(beg:end)) - allocate(cwf%flx_oc_dep_pho(beg:end)) - allocate(cwf%flx_oc_dep_phi(beg:end)) - allocate(cwf%flx_oc_dep(beg:end)) - allocate(cwf%flx_dst_dep_dry1(beg:end)) - allocate(cwf%flx_dst_dep_wet1(beg:end)) - allocate(cwf%flx_dst_dep_dry2(beg:end)) - allocate(cwf%flx_dst_dep_wet2(beg:end)) - allocate(cwf%flx_dst_dep_dry3(beg:end)) - allocate(cwf%flx_dst_dep_wet3(beg:end)) - allocate(cwf%flx_dst_dep_dry4(beg:end)) - allocate(cwf%flx_dst_dep_wet4(beg:end)) - allocate(cwf%flx_dst_dep(beg:end)) - allocate(cwf%qflx_snofrz_lyr(beg:end,-nlevsno+1:0)) - allocate(cwf%qflx_snofrz_col(beg:end)) - allocate(cwf%qflx_irrig(beg:end)) - allocate(cwf%qflx_glcice(beg:end)) - allocate(cwf%qflx_glcice_frz(beg:end)) - allocate(cwf%qflx_glcice_melt(beg:end)) - allocate(cwf%glc_rofi(beg:end)) - allocate(cwf%glc_rofl(beg:end)) - allocate(cwf%qflx_floodc(beg:end)) - allocate(cwf%qflx_snow_melt(beg:end)) - - cwf%qflx_infl(beg:end) = nan - cwf%qflx_surf(beg:end) = nan - cwf%qflx_drain(beg:end) = nan - cwf%qflx_top_soil(beg:end) = spval - cwf%qflx_sl_top_soil(beg:end) = nan - cwf%qflx_snomelt(beg:end) = nan - cwf%qflx_qrgwl(beg:end) = nan - cwf%qflx_runoff(beg:end) = nan - cwf%qflx_runoff_u(beg:end) = nan - cwf%qflx_runoff_r(beg:end) = nan - cwf%qmelt(beg:end) = nan - cwf%h2ocan_loss(beg:end) = nan - cwf%qflx_rsub_sat(beg:end) = nan - cwf%flx_bc_dep_dry(beg:end) = nan - cwf%flx_bc_dep_wet(beg:end) = nan - cwf%flx_bc_dep_pho(beg:end) = nan - cwf%flx_bc_dep_phi(beg:end) = nan - cwf%flx_bc_dep(beg:end) = nan - cwf%flx_oc_dep_dry(beg:end) = nan - cwf%flx_oc_dep_wet(beg:end) = nan - cwf%flx_oc_dep_pho(beg:end) = nan - cwf%flx_oc_dep_phi(beg:end) = nan - cwf%flx_oc_dep(beg:end) = nan - cwf%flx_dst_dep_dry1(beg:end) = nan - cwf%flx_dst_dep_wet1(beg:end) = nan - cwf%flx_dst_dep_dry2(beg:end) = nan - cwf%flx_dst_dep_wet2(beg:end) = nan - cwf%flx_dst_dep_dry3(beg:end) = nan - cwf%flx_dst_dep_wet3(beg:end) = nan - cwf%flx_dst_dep_dry4(beg:end) = nan - cwf%flx_dst_dep_wet4(beg:end) = nan - cwf%flx_dst_dep(beg:end) = nan - cwf%qflx_snofrz_lyr(beg:end,-nlevsno+1:0) = spval - cwf%qflx_snofrz_col(beg:end) = nan - cwf%qflx_irrig(beg:end) = nan - cwf%qflx_glcice(beg:end) = nan - cwf%qflx_glcice_frz(beg:end) = nan - cwf%qflx_glcice_melt(beg:end) = nan - cwf%glc_rofi(beg:end) = nan - cwf%glc_rofl(beg:end) = nan - cwf%qflx_floodc(beg:end) = spval - cwf%qflx_snow_melt(beg:end) = spval - - end subroutine init_column_wflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_cflux_type -! -! !INTERFACE: - subroutine init_column_cflux_type(beg, end, ccf) -! -! !DESCRIPTION: -! Initialize column carbon flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_cflux_type), intent(inout):: ccf -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -!------------------------------------------------------------------------ - - allocate(ccf%m_leafc_to_litr1c(beg:end)) - allocate(ccf%m_leafc_to_litr2c(beg:end)) - allocate(ccf%m_leafc_to_litr3c(beg:end)) - allocate(ccf%m_frootc_to_litr1c(beg:end)) - allocate(ccf%m_frootc_to_litr2c(beg:end)) - allocate(ccf%m_frootc_to_litr3c(beg:end)) - allocate(ccf%m_leafc_storage_to_litr1c(beg:end)) - allocate(ccf%m_frootc_storage_to_litr1c(beg:end)) - allocate(ccf%m_livestemc_storage_to_litr1c(beg:end)) - allocate(ccf%m_deadstemc_storage_to_litr1c(beg:end)) - allocate(ccf%m_livecrootc_storage_to_litr1c(beg:end)) - allocate(ccf%m_deadcrootc_storage_to_litr1c(beg:end)) - allocate(ccf%m_leafc_xfer_to_litr1c(beg:end)) - allocate(ccf%m_frootc_xfer_to_litr1c(beg:end)) - allocate(ccf%m_livestemc_xfer_to_litr1c(beg:end)) - allocate(ccf%m_deadstemc_xfer_to_litr1c(beg:end)) - allocate(ccf%m_livecrootc_xfer_to_litr1c(beg:end)) - allocate(ccf%m_deadcrootc_xfer_to_litr1c(beg:end)) - allocate(ccf%m_livestemc_to_cwdc(beg:end)) - allocate(ccf%m_deadstemc_to_cwdc(beg:end)) - allocate(ccf%m_livecrootc_to_cwdc(beg:end)) - allocate(ccf%m_deadcrootc_to_cwdc(beg:end)) - allocate(ccf%m_gresp_storage_to_litr1c(beg:end)) - allocate(ccf%m_gresp_xfer_to_litr1c(beg:end)) - allocate(ccf%m_deadstemc_to_cwdc_fire(beg:end)) - allocate(ccf%m_deadcrootc_to_cwdc_fire(beg:end)) - allocate(ccf%hrv_leafc_to_litr1c(beg:end)) - allocate(ccf%hrv_leafc_to_litr2c(beg:end)) - allocate(ccf%hrv_leafc_to_litr3c(beg:end)) - allocate(ccf%hrv_frootc_to_litr1c(beg:end)) - allocate(ccf%hrv_frootc_to_litr2c(beg:end)) - allocate(ccf%hrv_frootc_to_litr3c(beg:end)) - allocate(ccf%hrv_livestemc_to_cwdc(beg:end)) - allocate(ccf%hrv_deadstemc_to_prod10c(beg:end)) - allocate(ccf%hrv_deadstemc_to_prod100c(beg:end)) - allocate(ccf%hrv_livecrootc_to_cwdc(beg:end)) - allocate(ccf%hrv_deadcrootc_to_cwdc(beg:end)) - allocate(ccf%hrv_leafc_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_frootc_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_livestemc_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_deadstemc_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_livecrootc_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_deadcrootc_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_gresp_storage_to_litr1c(beg:end)) - allocate(ccf%hrv_leafc_xfer_to_litr1c(beg:end)) - allocate(ccf%hrv_frootc_xfer_to_litr1c(beg:end)) - allocate(ccf%hrv_livestemc_xfer_to_litr1c(beg:end)) - allocate(ccf%hrv_deadstemc_xfer_to_litr1c(beg:end)) - allocate(ccf%hrv_livecrootc_xfer_to_litr1c(beg:end)) - allocate(ccf%hrv_deadcrootc_xfer_to_litr1c(beg:end)) - allocate(ccf%hrv_gresp_xfer_to_litr1c(beg:end)) - allocate(ccf%m_litr1c_to_fire(beg:end)) - allocate(ccf%m_litr2c_to_fire(beg:end)) - allocate(ccf%m_litr3c_to_fire(beg:end)) - allocate(ccf%m_cwdc_to_fire(beg:end)) - if ( crop_prog )then - allocate(ccf%grainc_to_litr1c(beg:end)) - allocate(ccf%grainc_to_litr2c(beg:end)) - allocate(ccf%grainc_to_litr3c(beg:end)) - allocate(ccf%livestemc_to_litr1c(beg:end)) - allocate(ccf%livestemc_to_litr2c(beg:end)) - allocate(ccf%livestemc_to_litr3c(beg:end)) - end if - allocate(ccf%leafc_to_litr1c(beg:end)) - allocate(ccf%leafc_to_litr2c(beg:end)) - allocate(ccf%leafc_to_litr3c(beg:end)) - allocate(ccf%frootc_to_litr1c(beg:end)) - allocate(ccf%frootc_to_litr2c(beg:end)) - allocate(ccf%frootc_to_litr3c(beg:end)) - allocate(ccf%cwdc_to_litr2c(beg:end)) - allocate(ccf%cwdc_to_litr3c(beg:end)) - allocate(ccf%litr1_hr(beg:end)) - allocate(ccf%litr1c_to_soil1c(beg:end)) - allocate(ccf%litr2_hr(beg:end)) - allocate(ccf%litr2c_to_soil2c(beg:end)) - allocate(ccf%litr3_hr(beg:end)) - allocate(ccf%litr3c_to_soil3c(beg:end)) - allocate(ccf%soil1_hr(beg:end)) - allocate(ccf%soil1c_to_soil2c(beg:end)) - allocate(ccf%soil2_hr(beg:end)) - allocate(ccf%soil2c_to_soil3c(beg:end)) - allocate(ccf%soil3_hr(beg:end)) - allocate(ccf%soil3c_to_soil4c(beg:end)) - allocate(ccf%soil4_hr(beg:end)) - if (use_cn) then - allocate(ccf%dwt_seedc_to_leaf(beg:end)) - allocate(ccf%dwt_seedc_to_deadstem(beg:end)) - allocate(ccf%dwt_conv_cflux(beg:end)) - allocate(ccf%dwt_prod10c_gain(beg:end)) - allocate(ccf%dwt_prod100c_gain(beg:end)) - allocate(ccf%dwt_frootc_to_litr1c(beg:end)) - allocate(ccf%dwt_frootc_to_litr2c(beg:end)) - allocate(ccf%dwt_frootc_to_litr3c(beg:end)) - allocate(ccf%dwt_livecrootc_to_cwdc(beg:end)) - allocate(ccf%dwt_deadcrootc_to_cwdc(beg:end)) - allocate(ccf%dwt_closs(beg:end)) - allocate(ccf%landuseflux(beg:end)) - allocate(ccf%landuptake(beg:end)) - allocate(ccf%prod10c_loss(beg:end)) - allocate(ccf%prod100c_loss(beg:end)) - allocate(ccf%product_closs(beg:end)) - end if - allocate(ccf%lithr(beg:end)) - allocate(ccf%somhr(beg:end)) - allocate(ccf%hr(beg:end)) - allocate(ccf%sr(beg:end)) - allocate(ccf%er(beg:end)) - allocate(ccf%litfire(beg:end)) - allocate(ccf%somfire(beg:end)) - allocate(ccf%totfire(beg:end)) - allocate(ccf%nep(beg:end)) - allocate(ccf%nbp(beg:end)) - allocate(ccf%nee(beg:end)) - allocate(ccf%col_cinputs(beg:end)) - allocate(ccf%col_coutputs(beg:end)) - allocate(ccf%col_fire_closs(beg:end)) - - if (use_cn) then - allocate(ccf%cwdc_hr(beg:end)) - allocate(ccf%cwdc_loss(beg:end)) - allocate(ccf%litterc_loss(beg:end)) - end if - - ccf%m_leafc_to_litr1c(beg:end) = nan - ccf%m_leafc_to_litr2c(beg:end) = nan - ccf%m_leafc_to_litr3c(beg:end) = nan - ccf%m_frootc_to_litr1c(beg:end) = nan - ccf%m_frootc_to_litr2c(beg:end) = nan - ccf%m_frootc_to_litr3c(beg:end) = nan - ccf%m_leafc_storage_to_litr1c(beg:end) = nan - ccf%m_frootc_storage_to_litr1c(beg:end) = nan - ccf%m_livestemc_storage_to_litr1c(beg:end) = nan - ccf%m_deadstemc_storage_to_litr1c(beg:end) = nan - ccf%m_livecrootc_storage_to_litr1c(beg:end) = nan - ccf%m_deadcrootc_storage_to_litr1c(beg:end) = nan - ccf%m_leafc_xfer_to_litr1c(beg:end) = nan - ccf%m_frootc_xfer_to_litr1c(beg:end) = nan - ccf%m_livestemc_xfer_to_litr1c(beg:end) = nan - ccf%m_deadstemc_xfer_to_litr1c(beg:end) = nan - ccf%m_livecrootc_xfer_to_litr1c(beg:end) = nan - ccf%m_deadcrootc_xfer_to_litr1c(beg:end) = nan - ccf%m_livestemc_to_cwdc(beg:end) = nan - ccf%m_deadstemc_to_cwdc(beg:end) = nan - ccf%m_livecrootc_to_cwdc(beg:end) = nan - ccf%m_deadcrootc_to_cwdc(beg:end) = nan - ccf%m_gresp_storage_to_litr1c(beg:end) = nan - ccf%m_gresp_xfer_to_litr1c(beg:end) = nan - ccf%m_deadstemc_to_cwdc_fire(beg:end) = nan - ccf%m_deadcrootc_to_cwdc_fire(beg:end) = nan - ccf%hrv_leafc_to_litr1c(beg:end) = nan - ccf%hrv_leafc_to_litr2c(beg:end) = nan - ccf%hrv_leafc_to_litr3c(beg:end) = nan - ccf%hrv_frootc_to_litr1c(beg:end) = nan - ccf%hrv_frootc_to_litr2c(beg:end) = nan - ccf%hrv_frootc_to_litr3c(beg:end) = nan - ccf%hrv_livestemc_to_cwdc(beg:end) = nan - ccf%hrv_deadstemc_to_prod10c(beg:end) = nan - ccf%hrv_deadstemc_to_prod100c(beg:end) = nan - ccf%hrv_livecrootc_to_cwdc(beg:end) = nan - ccf%hrv_deadcrootc_to_cwdc(beg:end) = nan - ccf%hrv_leafc_storage_to_litr1c(beg:end) = nan - ccf%hrv_frootc_storage_to_litr1c(beg:end) = nan - ccf%hrv_livestemc_storage_to_litr1c(beg:end) = nan - ccf%hrv_deadstemc_storage_to_litr1c(beg:end) = nan - ccf%hrv_livecrootc_storage_to_litr1c(beg:end) = nan - ccf%hrv_deadcrootc_storage_to_litr1c(beg:end) = nan - if ( crop_prog )then - ccf%grainc_to_litr1c(beg:end) = nan - ccf%grainc_to_litr2c(beg:end) = nan - ccf%grainc_to_litr3c(beg:end) = nan - ccf%livestemc_to_litr1c(beg:end) = nan - ccf%livestemc_to_litr2c(beg:end) = nan - ccf%livestemc_to_litr3c(beg:end) = nan - end if - ccf%hrv_gresp_storage_to_litr1c(beg:end) = nan - ccf%hrv_leafc_xfer_to_litr1c(beg:end) = nan - ccf%hrv_frootc_xfer_to_litr1c(beg:end) = nan - ccf%hrv_livestemc_xfer_to_litr1c(beg:end) = nan - ccf%hrv_deadstemc_xfer_to_litr1c(beg:end) = nan - ccf%hrv_livecrootc_xfer_to_litr1c(beg:end) = nan - ccf%hrv_deadcrootc_xfer_to_litr1c(beg:end) = nan - ccf%hrv_gresp_xfer_to_litr1c(beg:end) = nan - ccf%m_litr1c_to_fire(beg:end) = nan - ccf%m_litr2c_to_fire(beg:end) = nan - ccf%m_litr3c_to_fire(beg:end) = nan - ccf%m_cwdc_to_fire(beg:end) = nan - ccf%leafc_to_litr1c(beg:end) = nan - ccf%leafc_to_litr2c(beg:end) = nan - ccf%leafc_to_litr3c(beg:end) = nan - ccf%frootc_to_litr1c(beg:end) = nan - ccf%frootc_to_litr2c(beg:end) = nan - ccf%frootc_to_litr3c(beg:end) = nan - ccf%cwdc_to_litr2c(beg:end) = nan - ccf%cwdc_to_litr3c(beg:end) = nan - ccf%litr1_hr(beg:end) = nan - ccf%litr1c_to_soil1c(beg:end) = nan - ccf%litr2_hr(beg:end) = nan - ccf%litr2c_to_soil2c(beg:end) = nan - ccf%litr3_hr(beg:end) = nan - ccf%litr3c_to_soil3c(beg:end) = nan - ccf%soil1_hr(beg:end) = nan - ccf%soil1c_to_soil2c(beg:end) = nan - ccf%soil2_hr(beg:end) = nan - ccf%soil2c_to_soil3c(beg:end) = nan - ccf%soil3_hr(beg:end) = nan - ccf%soil3c_to_soil4c(beg:end) = nan - ccf%soil4_hr(beg:end) = nan - if (use_cn) then - ccf%dwt_seedc_to_leaf(beg:end) = nan - ccf%dwt_seedc_to_deadstem(beg:end) = nan - ccf%dwt_conv_cflux(beg:end) = nan - ccf%dwt_prod10c_gain(beg:end) = nan - ccf%dwt_prod100c_gain(beg:end) = nan - ccf%dwt_frootc_to_litr1c(beg:end) = nan - ccf%dwt_frootc_to_litr2c(beg:end) = nan - ccf%dwt_frootc_to_litr3c(beg:end) = nan - ccf%dwt_livecrootc_to_cwdc(beg:end) = nan - ccf%dwt_deadcrootc_to_cwdc(beg:end) = nan - ccf%dwt_closs(beg:end) = nan - ccf%landuseflux(beg:end) = nan - ccf%landuptake(beg:end) = nan - ccf%prod10c_loss(beg:end) = nan - ccf%prod100c_loss(beg:end) = nan - ccf%product_closs(beg:end) = nan - end if - ccf%lithr(beg:end) = nan - ccf%somhr(beg:end) = nan - ccf%hr(beg:end) = nan - ccf%sr(beg:end) = nan - ccf%er(beg:end) = nan - ccf%litfire(beg:end) = nan - ccf%somfire(beg:end) = nan - ccf%totfire(beg:end) = nan - ccf%nep(beg:end) = nan - ccf%nbp(beg:end) = nan - ccf%nee(beg:end) = nan - ccf%col_cinputs(beg:end) = nan - ccf%col_coutputs(beg:end) = nan - ccf%col_fire_closs(beg:end) = nan - - if (use_cn) then - ccf%cwdc_hr(beg:end) = nan - ccf%cwdc_loss(beg:end) = nan - ccf%litterc_loss(beg:end) = nan - end if - - end subroutine init_column_cflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_column_nflux_type -! -! !INTERFACE: - subroutine init_column_nflux_type(beg, end, cnf) -! -! !DESCRIPTION: -! Initialize column nitrogen flux variables -! -! !USES: - use surfrdMod , only : crop_prog -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (column_nflux_type), intent(inout):: cnf -! -! !REVISION HISTORY: -! Created by Peter Thornton -! -!EOP -!------------------------------------------------------------------------ - - allocate(cnf%ndep_to_sminn(beg:end)) - allocate(cnf%nfix_to_sminn(beg:end)) - allocate(cnf%m_leafn_to_litr1n(beg:end)) - allocate(cnf%m_leafn_to_litr2n(beg:end)) - allocate(cnf%m_leafn_to_litr3n(beg:end)) - allocate(cnf%m_frootn_to_litr1n(beg:end)) - allocate(cnf%m_frootn_to_litr2n(beg:end)) - allocate(cnf%m_frootn_to_litr3n(beg:end)) - allocate(cnf%m_leafn_storage_to_litr1n(beg:end)) - allocate(cnf%m_frootn_storage_to_litr1n(beg:end)) - allocate(cnf%m_livestemn_storage_to_litr1n(beg:end)) - allocate(cnf%m_deadstemn_storage_to_litr1n(beg:end)) - allocate(cnf%m_livecrootn_storage_to_litr1n(beg:end)) - allocate(cnf%m_deadcrootn_storage_to_litr1n(beg:end)) - allocate(cnf%m_leafn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_frootn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_livestemn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_deadstemn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_livecrootn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_deadcrootn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_livestemn_to_cwdn(beg:end)) - allocate(cnf%m_deadstemn_to_cwdn(beg:end)) - allocate(cnf%m_livecrootn_to_cwdn(beg:end)) - allocate(cnf%m_deadcrootn_to_cwdn(beg:end)) - allocate(cnf%m_retransn_to_litr1n(beg:end)) - allocate(cnf%hrv_leafn_to_litr1n(beg:end)) - allocate(cnf%hrv_leafn_to_litr2n(beg:end)) - allocate(cnf%hrv_leafn_to_litr3n(beg:end)) - allocate(cnf%hrv_frootn_to_litr1n(beg:end)) - allocate(cnf%hrv_frootn_to_litr2n(beg:end)) - allocate(cnf%hrv_frootn_to_litr3n(beg:end)) - allocate(cnf%hrv_livestemn_to_cwdn(beg:end)) - allocate(cnf%hrv_deadstemn_to_prod10n(beg:end)) - allocate(cnf%hrv_deadstemn_to_prod100n(beg:end)) - allocate(cnf%hrv_livecrootn_to_cwdn(beg:end)) - allocate(cnf%hrv_deadcrootn_to_cwdn(beg:end)) - allocate(cnf%hrv_retransn_to_litr1n(beg:end)) - allocate(cnf%hrv_leafn_storage_to_litr1n(beg:end)) - allocate(cnf%hrv_frootn_storage_to_litr1n(beg:end)) - allocate(cnf%hrv_livestemn_storage_to_litr1n(beg:end)) - allocate(cnf%hrv_deadstemn_storage_to_litr1n(beg:end)) - allocate(cnf%hrv_livecrootn_storage_to_litr1n(beg:end)) - allocate(cnf%hrv_deadcrootn_storage_to_litr1n(beg:end)) - allocate(cnf%hrv_leafn_xfer_to_litr1n(beg:end)) - allocate(cnf%hrv_frootn_xfer_to_litr1n(beg:end)) - allocate(cnf%hrv_livestemn_xfer_to_litr1n(beg:end)) - allocate(cnf%hrv_deadstemn_xfer_to_litr1n(beg:end)) - allocate(cnf%hrv_livecrootn_xfer_to_litr1n(beg:end)) - allocate(cnf%hrv_deadcrootn_xfer_to_litr1n(beg:end)) - allocate(cnf%m_deadstemn_to_cwdn_fire(beg:end)) - allocate(cnf%m_deadcrootn_to_cwdn_fire(beg:end)) - allocate(cnf%m_litr1n_to_fire(beg:end)) - allocate(cnf%m_litr2n_to_fire(beg:end)) - allocate(cnf%m_litr3n_to_fire(beg:end)) - allocate(cnf%m_cwdn_to_fire(beg:end)) - if ( crop_prog )then - allocate(cnf%grainn_to_litr1n(beg:end)) - allocate(cnf%grainn_to_litr2n(beg:end)) - allocate(cnf%grainn_to_litr3n(beg:end)) - allocate(cnf%livestemn_to_litr1n(beg:end)) - allocate(cnf%livestemn_to_litr2n(beg:end)) - allocate(cnf%livestemn_to_litr3n(beg:end)) - end if - allocate(cnf%leafn_to_litr1n(beg:end)) - allocate(cnf%leafn_to_litr2n(beg:end)) - allocate(cnf%leafn_to_litr3n(beg:end)) - allocate(cnf%frootn_to_litr1n(beg:end)) - allocate(cnf%frootn_to_litr2n(beg:end)) - allocate(cnf%frootn_to_litr3n(beg:end)) - allocate(cnf%cwdn_to_litr2n(beg:end)) - allocate(cnf%cwdn_to_litr3n(beg:end)) - allocate(cnf%litr1n_to_soil1n(beg:end)) - allocate(cnf%sminn_to_soil1n_l1(beg:end)) - allocate(cnf%litr2n_to_soil2n(beg:end)) - allocate(cnf%sminn_to_soil2n_l2(beg:end)) - allocate(cnf%litr3n_to_soil3n(beg:end)) - allocate(cnf%sminn_to_soil3n_l3(beg:end)) - allocate(cnf%soil1n_to_soil2n(beg:end)) - allocate(cnf%sminn_to_soil2n_s1(beg:end)) - allocate(cnf%soil2n_to_soil3n(beg:end)) - allocate(cnf%sminn_to_soil3n_s2(beg:end)) - allocate(cnf%soil3n_to_soil4n(beg:end)) - allocate(cnf%sminn_to_soil4n_s3(beg:end)) - allocate(cnf%soil4n_to_sminn(beg:end)) - allocate(cnf%sminn_to_denit_l1s1(beg:end)) - allocate(cnf%sminn_to_denit_l2s2(beg:end)) - allocate(cnf%sminn_to_denit_l3s3(beg:end)) - allocate(cnf%sminn_to_denit_s1s2(beg:end)) - allocate(cnf%sminn_to_denit_s2s3(beg:end)) - allocate(cnf%sminn_to_denit_s3s4(beg:end)) - allocate(cnf%sminn_to_denit_s4(beg:end)) - allocate(cnf%sminn_to_denit_excess(beg:end)) - allocate(cnf%sminn_leached(beg:end)) - allocate(cnf%dwt_seedn_to_leaf(beg:end)) - allocate(cnf%dwt_seedn_to_deadstem(beg:end)) - allocate(cnf%dwt_conv_nflux(beg:end)) - allocate(cnf%dwt_prod10n_gain(beg:end)) - allocate(cnf%dwt_prod100n_gain(beg:end)) - allocate(cnf%dwt_frootn_to_litr1n(beg:end)) - allocate(cnf%dwt_frootn_to_litr2n(beg:end)) - allocate(cnf%dwt_frootn_to_litr3n(beg:end)) - allocate(cnf%dwt_livecrootn_to_cwdn(beg:end)) - allocate(cnf%dwt_deadcrootn_to_cwdn(beg:end)) - allocate(cnf%dwt_nloss(beg:end)) - allocate(cnf%prod10n_loss(beg:end)) - allocate(cnf%prod100n_loss(beg:end)) - allocate(cnf%product_nloss(beg:end)) - allocate(cnf%potential_immob(beg:end)) - allocate(cnf%actual_immob(beg:end)) - allocate(cnf%sminn_to_plant(beg:end)) - allocate(cnf%supplement_to_sminn(beg:end)) - allocate(cnf%gross_nmin(beg:end)) - allocate(cnf%net_nmin(beg:end)) - allocate(cnf%denit(beg:end)) - allocate(cnf%col_ninputs(beg:end)) - allocate(cnf%col_noutputs(beg:end)) - allocate(cnf%col_fire_nloss(beg:end)) - - cnf%ndep_to_sminn(beg:end) = nan - cnf%nfix_to_sminn(beg:end) = nan - cnf%m_leafn_to_litr1n(beg:end) = nan - cnf%m_leafn_to_litr2n(beg:end) = nan - cnf%m_leafn_to_litr3n(beg:end) = nan - cnf%m_frootn_to_litr1n(beg:end) = nan - cnf%m_frootn_to_litr2n(beg:end) = nan - cnf%m_frootn_to_litr3n(beg:end) = nan - cnf%m_leafn_storage_to_litr1n(beg:end) = nan - cnf%m_frootn_storage_to_litr1n(beg:end) = nan - cnf%m_livestemn_storage_to_litr1n(beg:end) = nan - cnf%m_deadstemn_storage_to_litr1n(beg:end) = nan - cnf%m_livecrootn_storage_to_litr1n(beg:end) = nan - cnf%m_deadcrootn_storage_to_litr1n(beg:end) = nan - cnf%m_leafn_xfer_to_litr1n(beg:end) = nan - cnf%m_frootn_xfer_to_litr1n(beg:end) = nan - cnf%m_livestemn_xfer_to_litr1n(beg:end) = nan - cnf%m_deadstemn_xfer_to_litr1n(beg:end) = nan - cnf%m_livecrootn_xfer_to_litr1n(beg:end) = nan - cnf%m_deadcrootn_xfer_to_litr1n(beg:end) = nan - cnf%m_livestemn_to_cwdn(beg:end) = nan - cnf%m_deadstemn_to_cwdn(beg:end) = nan - cnf%m_livecrootn_to_cwdn(beg:end) = nan - cnf%m_deadcrootn_to_cwdn(beg:end) = nan - cnf%m_retransn_to_litr1n(beg:end) = nan - cnf%hrv_leafn_to_litr1n(beg:end) = nan - cnf%hrv_leafn_to_litr2n(beg:end) = nan - cnf%hrv_leafn_to_litr3n(beg:end) = nan - cnf%hrv_frootn_to_litr1n(beg:end) = nan - cnf%hrv_frootn_to_litr2n(beg:end) = nan - cnf%hrv_frootn_to_litr3n(beg:end) = nan - cnf%hrv_livestemn_to_cwdn(beg:end) = nan - cnf%hrv_deadstemn_to_prod10n(beg:end) = nan - cnf%hrv_deadstemn_to_prod100n(beg:end) = nan - cnf%hrv_livecrootn_to_cwdn(beg:end) = nan - cnf%hrv_deadcrootn_to_cwdn(beg:end) = nan - cnf%hrv_retransn_to_litr1n(beg:end) = nan - cnf%hrv_leafn_storage_to_litr1n(beg:end) = nan - cnf%hrv_frootn_storage_to_litr1n(beg:end) = nan - cnf%hrv_livestemn_storage_to_litr1n(beg:end) = nan - cnf%hrv_deadstemn_storage_to_litr1n(beg:end) = nan - cnf%hrv_livecrootn_storage_to_litr1n(beg:end) = nan - cnf%hrv_deadcrootn_storage_to_litr1n(beg:end) = nan - cnf%hrv_leafn_xfer_to_litr1n(beg:end) = nan - cnf%hrv_frootn_xfer_to_litr1n(beg:end) = nan - cnf%hrv_livestemn_xfer_to_litr1n(beg:end) = nan - cnf%hrv_deadstemn_xfer_to_litr1n(beg:end) = nan - cnf%hrv_livecrootn_xfer_to_litr1n(beg:end) = nan - cnf%hrv_deadcrootn_xfer_to_litr1n(beg:end) = nan - cnf%m_deadstemn_to_cwdn_fire(beg:end) = nan - cnf%m_deadcrootn_to_cwdn_fire(beg:end) = nan - cnf%m_litr1n_to_fire(beg:end) = nan - cnf%m_litr2n_to_fire(beg:end) = nan - cnf%m_litr3n_to_fire(beg:end) = nan - cnf%m_cwdn_to_fire(beg:end) = nan - if ( crop_prog )then - cnf%grainn_to_litr1n(beg:end) = nan - cnf%grainn_to_litr2n(beg:end) = nan - cnf%grainn_to_litr3n(beg:end) = nan - cnf%livestemn_to_litr1n(beg:end) = nan - cnf%livestemn_to_litr2n(beg:end) = nan - cnf%livestemn_to_litr3n(beg:end) = nan - end if - cnf%leafn_to_litr1n(beg:end) = nan - cnf%leafn_to_litr2n(beg:end) = nan - cnf%leafn_to_litr3n(beg:end) = nan - cnf%frootn_to_litr1n(beg:end) = nan - cnf%frootn_to_litr2n(beg:end) = nan - cnf%frootn_to_litr3n(beg:end) = nan - cnf%cwdn_to_litr2n(beg:end) = nan - cnf%cwdn_to_litr3n(beg:end) = nan - cnf%litr1n_to_soil1n(beg:end) = nan - cnf%sminn_to_soil1n_l1(beg:end) = nan - cnf%litr2n_to_soil2n(beg:end) = nan - cnf%sminn_to_soil2n_l2(beg:end) = nan - cnf%litr3n_to_soil3n(beg:end) = nan - cnf%sminn_to_soil3n_l3(beg:end) = nan - cnf%soil1n_to_soil2n(beg:end) = nan - cnf%sminn_to_soil2n_s1(beg:end) = nan - cnf%soil2n_to_soil3n(beg:end) = nan - cnf%sminn_to_soil3n_s2(beg:end) = nan - cnf%soil3n_to_soil4n(beg:end) = nan - cnf%sminn_to_soil4n_s3(beg:end) = nan - cnf%soil4n_to_sminn(beg:end) = nan - cnf%sminn_to_denit_l1s1(beg:end) = nan - cnf%sminn_to_denit_l2s2(beg:end) = nan - cnf%sminn_to_denit_l3s3(beg:end) = nan - cnf%sminn_to_denit_s1s2(beg:end) = nan - cnf%sminn_to_denit_s2s3(beg:end) = nan - cnf%sminn_to_denit_s3s4(beg:end) = nan - cnf%sminn_to_denit_s4(beg:end) = nan - cnf%sminn_to_denit_excess(beg:end) = nan - cnf%sminn_leached(beg:end) = nan - cnf%dwt_seedn_to_leaf(beg:end) = nan - cnf%dwt_seedn_to_deadstem(beg:end) = nan - cnf%dwt_conv_nflux(beg:end) = nan - cnf%dwt_prod10n_gain(beg:end) = nan - cnf%dwt_prod100n_gain(beg:end) = nan - cnf%dwt_frootn_to_litr1n(beg:end) = nan - cnf%dwt_frootn_to_litr2n(beg:end) = nan - cnf%dwt_frootn_to_litr3n(beg:end) = nan - cnf%dwt_livecrootn_to_cwdn(beg:end) = nan - cnf%dwt_deadcrootn_to_cwdn(beg:end) = nan - cnf%dwt_nloss(beg:end) = nan - cnf%prod10n_loss(beg:end) = nan - cnf%prod100n_loss(beg:end) = nan - cnf%product_nloss(beg:end) = nan - cnf%potential_immob(beg:end) = nan - cnf%actual_immob(beg:end) = nan - cnf%sminn_to_plant(beg:end) = nan - cnf%supplement_to_sminn(beg:end) = nan - cnf%gross_nmin(beg:end) = nan - cnf%net_nmin(beg:end) = nan - cnf%denit(beg:end) = nan - cnf%col_ninputs(beg:end) = nan - cnf%col_noutputs(beg:end) = nan - cnf%col_fire_nloss(beg:end) = nan - - end subroutine init_column_nflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_landunit_pstate_type -! -! !INTERFACE: - subroutine init_landunit_pstate_type(beg, end, lps) -! -! !DESCRIPTION: -! Initialize landunit physical state variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (landunit_pstate_type), intent(inout):: lps -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(lps%t_building(beg:end)) - allocate(lps%t_building_max(beg:end)) - allocate(lps%t_building_min(beg:end)) - allocate(lps%tk_wall(beg:end,nlevurb)) - allocate(lps%tk_roof(beg:end,nlevurb)) - allocate(lps%tk_improad(beg:end,nlevgrnd)) - allocate(lps%cv_wall(beg:end,nlevurb)) - allocate(lps%cv_roof(beg:end,nlevurb)) - allocate(lps%cv_improad(beg:end,nlevgrnd)) - allocate(lps%thick_wall(beg:end)) - allocate(lps%thick_roof(beg:end)) - allocate(lps%nlev_improad(beg:end)) - allocate(lps%vf_sr(beg:end)) - allocate(lps%vf_wr(beg:end)) - allocate(lps%vf_sw(beg:end)) - allocate(lps%vf_rw(beg:end)) - allocate(lps%vf_ww(beg:end)) - allocate(lps%taf(beg:end)) - allocate(lps%qaf(beg:end)) - allocate(lps%sabs_roof_dir(beg:end,1:numrad)) - allocate(lps%sabs_roof_dif(beg:end,1:numrad)) - allocate(lps%sabs_sunwall_dir(beg:end,1:numrad)) - allocate(lps%sabs_sunwall_dif(beg:end,1:numrad)) - allocate(lps%sabs_shadewall_dir(beg:end,1:numrad)) - allocate(lps%sabs_shadewall_dif(beg:end,1:numrad)) - allocate(lps%sabs_improad_dir(beg:end,1:numrad)) - allocate(lps%sabs_improad_dif(beg:end,1:numrad)) - allocate(lps%sabs_perroad_dir(beg:end,1:numrad)) - allocate(lps%sabs_perroad_dif(beg:end,1:numrad)) - - lps%t_building(beg:end) = nan - lps%t_building_max(beg:end) = nan - lps%t_building_min(beg:end) = nan - lps%tk_wall(beg:end,1:nlevurb) = nan - lps%tk_roof(beg:end,1:nlevurb) = nan - lps%tk_improad(beg:end,1:nlevgrnd) = nan - lps%cv_wall(beg:end,1:nlevurb) = nan - lps%cv_roof(beg:end,1:nlevurb) = nan - lps%cv_improad(beg:end,1:nlevgrnd) = nan - lps%cv_improad(beg:end,1:5) = nan - lps%thick_wall(beg:end) = nan - lps%thick_roof(beg:end) = nan - lps%nlev_improad(beg:end) = huge(1) - lps%vf_sr(beg:end) = nan - lps%vf_wr(beg:end) = nan - lps%vf_sw(beg:end) = nan - lps%vf_rw(beg:end) = nan - lps%vf_ww(beg:end) = nan - lps%taf(beg:end) = nan - lps%qaf(beg:end) = nan - lps%sabs_roof_dir(beg:end,1:numrad) = nan - lps%sabs_roof_dif(beg:end,1:numrad) = nan - lps%sabs_sunwall_dir(beg:end,1:numrad) = nan - lps%sabs_sunwall_dif(beg:end,1:numrad) = nan - lps%sabs_shadewall_dir(beg:end,1:numrad) = nan - lps%sabs_shadewall_dif(beg:end,1:numrad) = nan - lps%sabs_improad_dir(beg:end,1:numrad) = nan - lps%sabs_improad_dif(beg:end,1:numrad) = nan - lps%sabs_perroad_dir(beg:end,1:numrad) = nan - lps%sabs_perroad_dif(beg:end,1:numrad) = nan - - end subroutine init_landunit_pstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_landunit_eflux_type -! -! !INTERFACE: - subroutine init_landunit_eflux_type(beg, end, lef) -! -! !DESCRIPTION: -! Initialize landunit energy flux variables -! -! !USES: - use clm_varcon, only : spval -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (landunit_eflux_type), intent(inout):: lef -! -! !REVISION HISTORY: -! Created by Keith Oleson -! -!EOP -!------------------------------------------------------------------------ - - allocate(lef%eflx_traffic(beg:end)) - allocate(lef%eflx_traffic_factor(beg:end)) - allocate(lef%eflx_wasteheat(beg:end)) - allocate(lef%eflx_heat_from_ac(beg:end)) - - lef%eflx_traffic(beg:end) = spval - lef%eflx_traffic_factor(beg:end) = nan - lef%eflx_wasteheat(beg:end) = spval - lef%eflx_heat_from_ac(beg:end) = spval - - end subroutine init_landunit_eflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_dgvstate_type -! -! !INTERFACE: - subroutine init_gridcell_dgvstate_type(beg, end, gps) -! -! !DESCRIPTION: -! Initialize gridcell DGVM variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_dgvstate_type), intent(inout):: gps -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(gps%agdd20(beg:end)) - allocate(gps%tmomin20(beg:end)) - allocate(gps%t10min(beg:end)) - - gps%agdd20(beg:end) = nan - gps%tmomin20(beg:end) = nan - gps%t10min(beg:end) = nan - - end subroutine init_gridcell_dgvstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_pstate_type -! -! !INTERFACE: - subroutine init_gridcell_pstate_type(beg, end, gps) -! -! !DESCRIPTION: -! Initialize gridcell physical state variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_pstate_type), intent(inout):: gps -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - - !allocate(gps%bcphiwet2t(beg:end,1:2)) - !allocate(gps%bcphidry2t(beg:end,1:2)) - !allocate(gps%bcphodry2t(beg:end,1:2)) - !allocate(gps%ocphiwet2t(beg:end,1:2)) - !allocate(gps%ocphidry2t(beg:end,1:2)) - !allocate(gps%ocphodry2t(beg:end,1:2)) - !allocate(gps%dstx01wd2t(beg:end,1:2)) - !allocate(gps%dstx01dd2t(beg:end,1:2)) - !allocate(gps%dstx02wd2t(beg:end,1:2)) - !allocate(gps%dstx02dd2t(beg:end,1:2)) - !allocate(gps%dstx03wd2t(beg:end,1:2)) - !allocate(gps%dstx03dd2t(beg:end,1:2)) - !allocate(gps%dstx04wd2t(beg:end,1:2)) - !allocate(gps%dstx04dd2t(beg:end,1:2)) - - !gps%bcphiwet2t(beg:end,1:2) = nan - !gps%bcphidry2t(beg:end,1:2) = nan - !gps%bcphodry2t(beg:end,1:2) = nan - !gps%ocphiwet2t(beg:end,1:2) = nan - !gps%ocphidry2t(beg:end,1:2) = nan - !gps%ocphodry2t(beg:end,1:2) = nan - !gps%dstx01wd2t(beg:end,1:2) = nan - !gps%dstx01dd2t(beg:end,1:2) = nan - !gps%dstx02wd2t(beg:end,1:2) = nan - !gps%dstx02dd2t(beg:end,1:2) = nan - !gps%dstx03wd2t(beg:end,1:2) = nan - !gps%dstx03dd2t(beg:end,1:2) = nan - !gps%dstx04wd2t(beg:end,1:2) = nan - !gps%dstx04dd2t(beg:end,1:2) = nan - - end subroutine init_gridcell_pstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_efstate_type -! -! !INTERFACE: - subroutine init_gridcell_efstate_type(beg, end, gve) -! -! !DESCRIPTION: -! Initialize gridcell isoprene emission factor variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_efstate_type), intent(inout) :: gve -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein (heald) -! -!EOP -!------------------------------------------------------------------------ - - allocate(gve%efisop(6,beg:end)) - gve%efisop(:,beg:end) = nan - - end subroutine init_gridcell_efstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_wflux_type -! -! !INTERFACE: - subroutine init_gridcell_wflux_type(beg, end, gwf) -! -! !DESCRIPTION: -! Initialize gridcell water flux variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_wflux_type), intent(inout):: gwf -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP -!------------------------------------------------------------------------ - - allocate(gwf%qflx_runoffg(beg:end)) - allocate(gwf%qflx_snwcp_iceg(beg:end)) - allocate(gwf%qflx_liq_dynbal(beg:end)) - allocate(gwf%qflx_ice_dynbal(beg:end)) - allocate(gwf%qflx_floodg(beg:end)) - - gwf%qflx_runoffg(beg:end) = 0._r8 - gwf%qflx_snwcp_iceg(beg:end) = 0._r8 - gwf%qflx_liq_dynbal(beg:end) = nan - gwf%qflx_ice_dynbal(beg:end) = nan - gwf%qflx_floodg(beg:end) = 0._r8 !rtm_flood: initialize to zero for 1st time step instead of nan - - end subroutine init_gridcell_wflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_eflux_type -! -! !INTERFACE: - subroutine init_gridcell_eflux_type(beg, end, gef) -! -! !DESCRIPTION: -! Initialize gridcell energy flux variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_eflux_type), intent(inout):: gef -! -! !REVISION HISTORY: -! Created by David Lawrence -! -!EOP -!------------------------------------------------------------------------ - allocate(gef%eflx_sh_totg(beg:end)) - allocate(gef%eflx_dynbal(beg:end)) - - gef%eflx_sh_totg(beg:end) = nan - gef%eflx_dynbal(beg:end) = nan - - end subroutine init_gridcell_eflux_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_wstate_type -! -! !INTERFACE: - subroutine init_gridcell_wstate_type(beg, end, gws) -! -! !DESCRIPTION: -! Initialize gridcell water state variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_wstate_type), intent(inout):: gws -! -! !REVISION HISTORY: -! Created by David Lawrence -! -!EOP -!------------------------------------------------------------------------ - allocate(gws%gc_liq1(beg:end)) - allocate(gws%gc_liq2(beg:end)) - allocate(gws%gc_ice1(beg:end)) - allocate(gws%gc_ice2(beg:end)) - - gws%gc_liq1(beg:end) = nan - gws%gc_liq2(beg:end) = nan - gws%gc_ice1(beg:end) = nan - gws%gc_ice2(beg:end) = nan - - end subroutine init_gridcell_wstate_type - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: init_gridcell_estate_type -! -! !INTERFACE: - subroutine init_gridcell_estate_type(beg, end, ges) -! -! !DESCRIPTION: -! Initialize gridcell energy state variables -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: beg, end - type (gridcell_estate_type), intent(inout):: ges -! -! !REVISION HISTORY: -! Created by David Lawrence -! -!EOP -!------------------------------------------------------------------------ - allocate(ges%gc_heat1(beg:end)) - allocate(ges%gc_heat2(beg:end)) - - ges%gc_heat1(beg:end) = nan - ges%gc_heat2(beg:end) = nan - - end subroutine init_gridcell_estate_type - -end module clmtypeInitMod diff --git a/src_clm40/main/controlMod.F90 b/src_clm40/main/controlMod.F90 deleted file mode 100644 index 164939da95..0000000000 --- a/src_clm40/main/controlMod.F90 +++ /dev/null @@ -1,556 +0,0 @@ -module controlMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: controlMod -! -! !DESCRIPTION: -! Module which initializes run control variables. The following possible -! namelist variables are set default values and possibly read in on startup -! -! Note: For definitions of namelist variables see -! ../../bld/namelist_files/namelist_definition.xml -! Display the file in a browser to see it neatly formatted in html. -! - -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, SHR_KIND_CL - use clm_varpar , only : maxpatch_pft, maxpatch_glcmec - use clm_varctl , only : caseid, ctitle, nsrest, brnch_retain_casename, hostname, & - model_version=>version, & - iulog, finidat, fsurdat, fatmlndfrc, & - fatmtopo, flndtopo, flanduse_timeseries, fpftcon, nrevsn, & - create_crop_landunit, allocate_all_vegpfts, & - co2_type, wrtdia, co2_ppmv, nsegspc, & - username, fsnowaging, fsnowoptics, fglcmask, & - create_glacier_mec_landunit, glc_dyntopo, & - use_c13, use_c14, use_cn, use_cndv, use_crop - use spmdMod , only : masterproc - use decompMod , only : clump_pproc - use histFileMod , only : max_tapes, max_namlen, & - hist_empty_htapes, hist_dov2xy, & - hist_avgflag_pertape, hist_type1d_pertape, & - hist_nhtfrq, hist_ndens, hist_mfilt, & - hist_fincl1, hist_fincl2, hist_fincl3, & - hist_fincl4, hist_fincl5, hist_fincl6, & - hist_fexcl1, hist_fexcl2, hist_fexcl3, & - hist_fexcl4, hist_fexcl5, hist_fexcl6 - use shr_const_mod, only : SHR_CONST_CDAY - use abortutils , only : endrun - use UrbanMod , only : urban_hac, urban_traffic - use SurfaceAlbedoMod, only : albice - use CNAllocationMod , only : suplnitro - -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: control_setNL ! Set namelist filename - public :: control_init ! initial run control information - public :: control_print ! print run control information -! -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !PRIVATE TYPES: -! Namelist variables only used locally - character(len= 7) :: runtyp(4) ! run type - character(len=SHR_KIND_CL) :: NLFilename = 'lnd.stdin' ! Namelist filename -#if (defined _OPENMP) - integer, external :: omp_get_max_threads ! max number of threads that can execute - ! concurrently in a single parallel region -#endif -!EOP -!----------------------------------------------------------------------- - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: control_setNL -! -! !INTERFACE: - subroutine control_setNL( NLfile ) - - implicit none -! -! !DESCRIPTION: -! Set the namelist filename to use -! -! -! !ARGUMENTS: - character(len=*), intent(IN) :: NLFile ! Namelist filename -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -! -! !LOCAL VARIABLES: -!EOP - character(len=32) :: subname = 'control_setNL' ! subroutine name - logical :: lexist ! File exists - - ! Error checking... - if ( len_trim(NLFile) == 0 )then - call endrun( subname//' error: nlfilename entered is not set' ) - end if - inquire (file = trim(NLFile), exist = lexist) - if ( .not. lexist )then - call endrun( subname//' error: NLfilename entered does NOT exist:'//trim(NLFile) ) - end if - if ( len_trim(NLFile) > len(NLFilename) )then - call endrun( subname//' error: entered NLFile is too long' ) - end if - ! Set the filename - NLFilename = NLFile - end subroutine control_setNL - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: control_init -! -! !INTERFACE: - subroutine control_init( ) -! -! !DESCRIPTION: -! Initialize CLM run control information -! -! !USES: - use clm_time_manager , only : set_timemgr_init, get_timemgr_defaults - use fileutils , only : getavu, relavu - use shr_string_mod , only : shr_string_getParentDir - use clm_varctl , only : clmvarctl_init, clm_varctl_set, nsrBranch, nsrStartup, & - nsrContinue - use clm_cpl_indices , only : glc_nec - - implicit none -! -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - character(len=32) :: starttype ! infodata start type - integer :: i,j,n ! loop indices - integer :: ierr ! error code - integer :: unitn ! unit for namelist file - integer :: dtime ! Integer time-step - integer :: override_nsrest ! If want to override the startup type sent from driver - character(len=32) :: subname = 'control_init' ! subroutine name -!------------------------------------------------------------------------ - - ! ---------------------------------------------------------------------- - ! Namelist Variables - ! ---------------------------------------------------------------------- - - ! Time step - namelist / clm_inparm/ & - dtime - - ! CLM namelist settings - - namelist /clm_inparm / & - fatmlndfrc, finidat, nrevsn - - ! Input datasets - - namelist /clm_inparm/ & - fsurdat, fatmtopo, flndtopo, & - fpftcon, flanduse_timeseries, fsnowoptics, fsnowaging - - ! History, restart options - - namelist /clm_inparm/ & - hist_empty_htapes, hist_dov2xy, & - hist_avgflag_pertape, hist_type1d_pertape, & - hist_nhtfrq, hist_ndens, hist_mfilt, & - hist_fincl1, hist_fincl2, hist_fincl3, & - hist_fincl4, hist_fincl5, hist_fincl6, & - hist_fexcl1, hist_fexcl2, hist_fexcl3, & - hist_fexcl4, hist_fexcl5, hist_fexcl6 - - ! BGC info - - namelist /clm_inparm/ & - suplnitro - - namelist /clm_inparm / use_c13, use_c14 - - namelist /clm_inparm / & - co2_type - - ! Glacier_mec info - namelist /clm_inparm / & - maxpatch_glcmec, glc_dyntopo, fglcmask - - ! Other options - - namelist /clm_inparm/ & - clump_pproc, wrtdia, & - create_crop_landunit, nsegspc, co2_ppmv, override_nsrest, & - albice - ! Urban options - - namelist /clm_inparm/ & - urban_hac, urban_traffic - - ! ---------------------------------------------------------------------- - ! Default values - ! ---------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to initialize run control settings .....' - endif - - runtyp(:) = 'missing' - runtyp(nsrStartup + 1) = 'initial' - runtyp(nsrContinue + 1) = 'restart' - runtyp(nsrBranch + 1) = 'branch ' - - ! Set clumps per procoessor - -#if (defined _OPENMP) - clump_pproc = omp_get_max_threads() -#else - clump_pproc = 1 -#endif - - override_nsrest = nsrest - - if (masterproc) then - - ! ---------------------------------------------------------------------- - ! Read namelist from standard input. - ! ---------------------------------------------------------------------- - - if ( len_trim(NLFilename) == 0 )then - call endrun( subname//' error: nlfilename not set' ) - end if - unitn = getavu() - write(iulog,*) 'Read in clm_inparm namelist from: ', trim(NLFilename) - open( unitn, file=trim(NLFilename), status='old' ) - ierr = 1 - do while ( ierr /= 0 ) - read(unitn, clm_inparm, iostat=ierr) - if (ierr < 0) then - call endrun( subname//' encountered end-of-file on clm_inparm read' ) - endif - end do - call relavu( unitn ) - - ! ---------------------------------------------------------------------- - ! Consistency checks on input namelist. - ! ---------------------------------------------------------------------- - - call set_timemgr_init( dtime_in=dtime ) - - if (urban_traffic) then - write(iulog,*)'Urban traffic fluxes are not implemented currently' - call endrun() - end if - - ! History and restart files - - do i = 1, max_tapes - if (hist_nhtfrq(i) == 0) then - hist_mfilt(i) = 1 - else if (hist_nhtfrq(i) < 0) then - hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) - endif - end do - - ! Override start-type (can only override to branch (3) and only - ! if the driver is a startup type - if ( override_nsrest /= nsrest )then - if ( override_nsrest /= nsrBranch .and. nsrest /= nsrStartup )then - call endrun( subname//' ERROR: can ONLY override clm start-type ' // & - 'to branch type and ONLY if driver is a startup type' ) - end if - call clm_varctl_set( nsrest_in=override_nsrest ) - end if - - ! Consistency of elevation classes on namelist to what's sent by the coupler - if (glc_nec /= maxpatch_glcmec ) then - write(iulog,*)'glc_nec, maxpatch_glcmec=',glc_nec, maxpatch_glcmec - write(iulog,*)'Number of glacier elevation classes from clm namelist and' // & - ' sent by the coupler MUST be equal' - call endrun( subname //' ERROR: glc_nec and maxpatch_glcmec must be equal') - end if - if (maxpatch_glcmec > 0) then - create_glacier_mec_landunit = .true. - else - create_glacier_mec_landunit = .false. - end if - - endif ! end of if-masterproc if-block - - call clmvarctl_init( masterproc, dtime ) - - ! ---------------------------------------------------------------------- - ! Broadcast all control information if appropriate - ! ---------------------------------------------------------------------- - - call control_spmd() - - if (masterproc) then - write(iulog,*) 'Successfully initialized run control settings' - write(iulog,*) - endif - - end subroutine control_init - - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: control_spmd -! -! !INTERFACE: - subroutine control_spmd() -! -! !DESCRIPTION: -! Distribute namelist data all processors. All program i/o is -! funnelled through the master processor. Processor 0 either -! reads restart/history data from the disk and distributes -! it to all processors, or collects data from -! all processors and writes it to disk. -! -! !USES: -! - use spmdMod, only : mpicom, MPI_CHARACTER, MPI_INTEGER, MPI_LOGICAL, MPI_REAL8 - use clm_varctl, only : single_column, scmlat, scmlon, rpntfil -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer ier !error code -!----------------------------------------------------------------------- - - ! run control variables - - call mpi_bcast (caseid, len(caseid), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (ctitle, len(ctitle), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (model_version, len(model_version), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hostname, len(hostname), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (username, len(username), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (nsrest, 1, MPI_INTEGER , 0, mpicom, ier) - - ! initial file variables - - call mpi_bcast (nrevsn , len(nrevsn) , MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat , len(finidat) , MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fsurdat , len(fsurdat) , MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fatmtopo, len(fatmtopo) ,MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (flndtopo, len(flndtopo) ,MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fpftcon , len(fpftcon) , MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (flanduse_timeseries , len(flanduse_timeseries) , MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fsnowoptics, len(fsnowoptics), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fsnowaging, len(fsnowaging), MPI_CHARACTER, 0, mpicom, ier) - - ! Landunit generation - - call mpi_bcast(create_crop_landunit, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast(allocate_all_vegpfts, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! BGC - - call mpi_bcast (co2_type, len(co2_type), MPI_CHARACTER, 0, mpicom, ier) - if (use_cn) then - call mpi_bcast (suplnitro, len(suplnitro), MPI_CHARACTER, 0, mpicom, ier) - end if - - ! isotopes - - call mpi_bcast (use_c13, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_c14, 1, MPI_LOGICAL, 0, mpicom, ier) - - ! physics variables - - call mpi_bcast (urban_hac , len(urban_hac), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (urban_traffic , 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (nsegspc , 1, MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (wrtdia , 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (single_column,1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (scmlat, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (scmlon, 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (co2_ppmv , 1, MPI_REAL8, 0, mpicom, ier) - call mpi_bcast (albice , 2, MPI_REAL8, 0, mpicom, ier) - - ! glacier_mec variables - - call mpi_bcast (create_glacier_mec_landunit, 1, MPI_LOGICAL , 0, mpicom, ier) - call mpi_bcast (maxpatch_glcmec ,1, MPI_INTEGER , 0, mpicom, ier) - call mpi_bcast (glc_dyntopo, 1, MPI_LOGICAL , 0, mpicom, ier) - call mpi_bcast (fglcmask, len(fglcmask), MPI_CHARACTER, 0, mpicom, ier) - - ! history file variables - - call mpi_bcast (hist_empty_htapes, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (hist_dov2xy, size(hist_dov2xy), MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (hist_nhtfrq, size(hist_nhtfrq), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_mfilt, size(hist_mfilt), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_ndens, size(hist_ndens), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_avgflag_pertape, size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_type1d_pertape, max_namlen*size(hist_type1d_pertape), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl1, max_namlen*size(hist_fexcl1), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl2, max_namlen*size(hist_fexcl2), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl3, max_namlen*size(hist_fexcl3), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl4, max_namlen*size(hist_fexcl4), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl5, max_namlen*size(hist_fexcl5), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl6, max_namlen*size(hist_fexcl6), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl1, (max_namlen+2)*size(hist_fincl1), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl2, (max_namlen+2)*size(hist_fincl2), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl3, (max_namlen+2)*size(hist_fincl3), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl4, (max_namlen+2)*size(hist_fincl4), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl5, (max_namlen+2)*size(hist_fincl5), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl6, (max_namlen+2)*size(hist_fincl6), MPI_CHARACTER, 0, mpicom, ier) - - ! restart file variables - - call mpi_bcast (rpntfil, len(rpntfil), MPI_CHARACTER, 0, mpicom, ier) - - ! clump decomposition variables - - call mpi_bcast (clump_pproc, 1, MPI_INTEGER, 0, mpicom, ier) - - end subroutine control_spmd - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: control_print -! -! !INTERFACE: - subroutine control_print () -! -! !DESCRIPTION: -! Write out the clm namelist run control variables -! -! !USES: -! - use clm_varctl, only : source, rpntdir, rpntfil, nsrStartup, nsrBranch, & - nsrContinue - use CNAllocationMod, only : suplnitro, suplnNon -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer i !loop index - character(len=32) :: subname = 'control_print' ! subroutine name -!------------------------------------------------------------------------ - - write(iulog,*) 'define run:' - write(iulog,*) ' source = ',trim(source) - write(iulog,*) ' model_version = ',trim(model_version) - write(iulog,*) ' run type = ',runtyp(nsrest+1) - write(iulog,*) ' case title = ',trim(ctitle) - write(iulog,*) ' username = ',trim(username) - write(iulog,*) ' hostname = ',trim(hostname) - write(iulog,*) 'input data files:' - write(iulog,*) ' PFT physiology = ',trim(fpftcon) - if (fsurdat == ' ') then - write(iulog,*) ' fsurdat, surface dataset not set' - else - write(iulog,*) ' surface data = ',trim(fsurdat) - end if - if (fatmlndfrc == ' ') then - write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' - else - write(iulog,*) ' land frac data = ',trim(fatmlndfrc) - end if - if (flndtopo == ' ') then - write(iulog,*) ' flndtopo not set' - else - write(iulog,*) ' land topographic data = ',trim(flndtopo) - end if - if (fatmtopo == ' ') then - write(iulog,*) ' fatmtopo not set' - else - write(iulog,*) ' atm topographic data = ',trim(fatmtopo) - end if - if (use_cn) then - if (suplnitro /= suplnNon)then - write(iulog,*) ' Supplemental Nitrogen mode is set to run over PFTs: ', & - trim(suplnitro) - end if - write(iulog, *) ' use_c13: ', use_c13 - write(iulog, *) ' use_c14: ', use_c14 - end if - if (fsnowoptics == ' ') then - write(iulog,*) ' snow optical properties file NOT set' - else - write(iulog,*) ' snow optical properties file = ',trim(fsnowoptics) - endif - if (fsnowaging == ' ') then - write(iulog,*) ' snow aging parameters file NOT set' - else - write(iulog,*) ' snow aging parameters file = ',trim(fsnowaging) - endif - - if (create_glacier_mec_landunit) then - write(iulog,*) ' glc number of elevation classes =', maxpatch_glcmec - write(iulog,*) ' glc glacier mask file = ',trim(fglcmask) - if (glc_dyntopo) then - write(iulog,*) ' glc CLM glacier topography will evolve dynamically' - else - write(iulog,*) ' glc CLM glacier topography will NOT evolve dynamically' - endif - endif - - if (nsrest == nsrStartup .and. finidat == ' ') write(iulog,*) ' initial data created by model' - if (nsrest == nsrStartup .and. finidat /= ' ') write(iulog,*) ' initial data = ',trim(finidat) - if (nsrest /= nsrStartup) write(iulog,*) ' restart data = ',trim(nrevsn) - write(iulog,*) ' atmospheric forcing data is from cesm atm model' - write(iulog,*) 'Restart parameters:' - write(iulog,*)' restart pointer file directory = ',trim(rpntdir) - write(iulog,*)' restart pointer file name = ',trim(rpntfil) - write(iulog,*) 'model physics parameters:' - - if ( trim(co2_type) == 'constant' )then - write(iulog,*) ' CO2 volume mixing ratio (umol/mol) = ', co2_ppmv - else - write(iulog,*) ' CO2 volume mixing ratio = ', co2_type - end if - - write(iulog,*) ' land-ice albedos (unitless 0-1) = ', albice - write(iulog,*) ' urban air conditioning/heating and wasteheat = ', urban_hac - write(iulog,*) ' urban traffic flux = ', urban_traffic - if (nsrest == nsrContinue) then - write(iulog,*) 'restart warning:' - write(iulog,*) ' Namelist not checked for agreement with initial run.' - write(iulog,*) ' Namelist should not differ except for ending time step and run type' - end if - if (nsrest == nsrBranch) then - write(iulog,*) 'branch warning:' - write(iulog,*) ' Namelist not checked for agreement with initial run.' - write(iulog,*) ' Surface data set and reference date should not differ from initial run' - end if - write(iulog,*) ' maxpatch_pft = ',maxpatch_pft - write(iulog,*) ' allocate_all_vegpfts = ',allocate_all_vegpfts - write(iulog,*) ' nsegspc = ',nsegspc - - end subroutine control_print - -end module controlMod diff --git a/src_clm40/main/decompInitMod.F90 b/src_clm40/main/decompInitMod.F90 deleted file mode 100644 index 031275f1ab..0000000000 --- a/src_clm40/main/decompInitMod.F90 +++ /dev/null @@ -1,762 +0,0 @@ -module decompInitMod - -!------------------------------------------------------------------------------ -!BOP -! -! !MODULE: decompInitMod -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc, iam, npes, mpicom, comp_id - use shr_sys_mod , only : shr_sys_flush - use abortutils , only : endrun - use clm_varctl , only : iulog - use mct_mod - use decompMod -! -! !PUBLIC TYPES: - implicit none -! -! !PUBLIC MEMBER FUNCTIONS: - public decompInit_lnd ! initializes atm grid decomposition into clumps and processors - public decompInit_glcp ! initializes g,l,c,p decomp info - -! -! !DESCRIPTION: -! Module provides a descomposition into a clumped data structure which can -! be mapped back to atmosphere physics chunks. -! -! !REVISION HISTORY: -! 2002.09.11 Forrest Hoffman Creation. -! 2005.11.01 T Craig Rewrite -! 2006.06.06 T Craig Reduce memory, cleanup -! -! -! !PRIVATE TYPES: - private - - integer, pointer :: lcid(:) ! temporary for setting ldecomp - -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: decompInit_lnd -! -! !INTERFACE: - subroutine decompInit_lnd(lni,lnj,amask) -! -! !DESCRIPTION: -! This subroutine initializes the land surface decomposition into a clump -! data structure. This assumes each pe has the same number of clumps -! set by clump_pproc -! -! !USES: - use clm_varctl, only : nsegspc -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: amask(:) - integer , intent(in) :: lni,lnj ! domain global size -! -! !LOCAL VARIABLES: - integer :: lns ! global domain size - integer :: ln,lj ! indices - integer :: ag,an,ai,aj ! indices - integer :: numg ! number of land gridcells - logical :: seglen1 ! is segment length one - real(r8):: seglen ! average segment length - real(r8):: rcid ! real value of cid - integer :: cid,pid ! indices - integer :: n,m,ng ! indices - integer :: ier ! error code - integer :: beg,end,lsize,gsize ! used for gsmap init - integer, pointer :: gindex(:) ! global index for gsmap init - integer, pointer :: clumpcnt(:) ! clump index counter - integer, parameter :: dbug=1 ! 0 = min, 1=normal, 2=much, 3=max - -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! 2002.09.11 Forrest Hoffman Creation. -! 2005.12.15 T Craig Updated for finemesh -! 2006.08.18 P Worley Performance optimizations -! 2007.01.24 T Craig Created decompInit_atm from decomp_init -! -!EOP -!------------------------------------------------------------------------------ - - lns = lni * lnj - - !--- set and verify nclumps --- - if (clump_pproc > 0) then - nclumps = clump_pproc * npes - if (nclumps < npes) then - write(iulog,*) 'decompInit_lnd(): Number of gridcell clumps= ',nclumps, & - ' is less than the number of processes = ', npes - call endrun() - end if - else - write(iulog,*)'clump_pproc= ',clump_pproc,' must be greater than 0' - call endrun() - end if - - !--- allocate and initialize procinfo and clumps --- - !--- beg and end indices initialized for simple addition of cells later --- - - allocate(procinfo%cid(clump_pproc), stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error for procinfo%cid' - call endrun() - endif - procinfo%nclumps = clump_pproc - procinfo%cid(:) = -1 - procinfo%ncells = 0 - procinfo%nlunits = 0 - procinfo%ncols = 0 - procinfo%npfts = 0 - procinfo%begg = 1 - procinfo%begl = 1 - procinfo%begc = 1 - procinfo%begp = 1 - procinfo%endg = 0 - procinfo%endl = 0 - procinfo%endc = 0 - procinfo%endp = 0 - - allocate(clumps(nclumps), stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error for clumps' - call endrun() - end if - clumps(:)%owner = -1 - clumps(:)%ncells = 0 - clumps(:)%nlunits = 0 - clumps(:)%ncols = 0 - clumps(:)%npfts = 0 - clumps(:)%begg = 1 - clumps(:)%begl = 1 - clumps(:)%begc = 1 - clumps(:)%begp = 1 - clumps(:)%endg = 0 - clumps(:)%endl = 0 - clumps(:)%endc = 0 - clumps(:)%endp = 0 - - !--- assign clumps to proc round robin --- - cid = 0 - do n = 1,nclumps - pid = mod(n-1,npes) - if (pid < 0 .or. pid > npes-1) then - write(iulog,*) 'decompInit_lnd(): round robin pid error ',n,pid,npes - call endrun() - endif - clumps(n)%owner = pid - if (iam == pid) then - cid = cid + 1 - if (cid < 1 .or. cid > clump_pproc) then - write(iulog,*) 'decompInit_lnd(): round robin pid error ',n,pid,npes - call endrun() - endif - procinfo%cid(cid) = n - endif - enddo - - !--- count total land gridcells - numg = 0 - do ln = 1,lns - if (amask(ln) == 1) then - numg = numg + 1 - endif - enddo - - if (npes > numg) then - write(iulog,*) 'decompInit_lnd(): Number of processes exceeds number ', & - 'of land grid cells',npes,numg - call endrun() - end if - if (nclumps > numg) then - write(iulog,*) 'decompInit_lnd(): Number of clumps exceeds number ', & - 'of land grid cells',nclumps,numg - call endrun() - end if - - if (float(numg)/float(nclumps) < float(nsegspc)) then - seglen1 = .true. - seglen = 1.0_r8 - else - seglen1 = .false. - seglen = dble(numg)/(dble(nsegspc)*dble(nclumps)) - endif - - if (masterproc) then - write(iulog,*) ' decomp precompute numg,nclumps,seglen1,avg_seglen,nsegspc=', & - numg,nclumps,seglen1,& - sngl(seglen),sngl(dble(numg)/(seglen*dble(nclumps))) - end if - - ! Assign gridcells to clumps (and thus pes) --- - - allocate(lcid(lns)) - lcid(:) = 0 - ng = 0 - do ln = 1,lns - if (amask(ln) == 1) then - ng = ng + 1 - - !--- give to clumps in order based on nsegspc - if (seglen1) then - cid = mod(ng-1,nclumps) + 1 - else - rcid = (dble(ng-1)/dble(numg))*dble(nsegspc)*dble(nclumps) - cid = mod(int(rcid),nclumps) + 1 - endif - lcid(ln) = cid - - !--- give gridcell cell to pe that owns cid --- - !--- this needs to be done to subsequently use function - !--- get_proc_bounds(begg,endg) - if (iam == clumps(cid)%owner) then - procinfo%ncells = procinfo%ncells + 1 - endif - if (iam > clumps(cid)%owner) then - procinfo%begg = procinfo%begg + 1 - endif - if (iam >= clumps(cid)%owner) then - procinfo%endg = procinfo%endg + 1 - endif - - !--- give gridcell to cid --- - !--- increment the beg and end indices --- - clumps(cid)%ncells = clumps(cid)%ncells + 1 - do m = 1,nclumps - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m > cid)) then - clumps(m)%begg = clumps(m)%begg + 1 - endif - - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m >= cid)) then - clumps(m)%endg = clumps(m)%endg + 1 - endif - enddo - - end if - enddo - - ! Set ldecomp - - allocate(ldecomp%gdc2glo(numg), ldecomp%glo2gdc(lns), stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error1 for ldecomp, etc' - call endrun() - end if - allocate(clumpcnt(nclumps),stat=ier) - if (ier /= 0) then - write(iulog,*) 'decompInit_lnd(): allocation error1 for clumpcnt' - call endrun() - end if - - ldecomp%gdc2glo(:) = 0 - ldecomp%glo2gdc(:) = 0 - - ! clumpcnt is the start gdc index of each clump - - clumpcnt = 0 - ag = 1 - do pid = 0,npes-1 - do cid = 1,nclumps - if (clumps(cid)%owner == pid) then - clumpcnt(cid) = ag - ag = ag + clumps(cid)%ncells - endif - enddo - enddo - - ! now go through gridcells one at a time and increment clumpcnt - ! in order to set gdc2glo and glo2gdc - - do aj = 1,lnj - do ai = 1,lni - an = (aj-1)*lni + ai - cid = lcid(an) - if (cid > 0) then - ag = clumpcnt(cid) - ldecomp%gdc2glo(ag) = an - ldecomp%glo2gdc(an) = ag - clumpcnt(cid) = clumpcnt(cid) + 1 - end if - enddo - enddo - - deallocate(clumpcnt) - - ! Set gsMap_lnd_gdc2glo - - call get_proc_bounds(beg, end) - allocate(gindex(beg:end)) - do n = beg,end - gindex(n) = ldecomp%gdc2glo(n) - enddo - lsize = end-beg+1 - gsize = lni * lnj - call mct_gsMap_init(gsMap_lnd_gdc2glo, gindex, mpicom, comp_id, lsize, gsize) - deallocate(gindex) - - ! Diagnostic output - - if (masterproc) then - write(iulog,*)' Surface Grid Characteristics' - write(iulog,*)' longitude points = ',lni - write(iulog,*)' latitude points = ',lnj - write(iulog,*)' total number of land gridcells = ',numg - write(iulog,*)' Decomposition Characteristics' - write(iulog,*)' clumps per process = ',clump_pproc - write(iulog,*)' gsMap Characteristics' - write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd_gdc2glo) - write(iulog,*) - end if - - call shr_sys_flush(iulog) - - end subroutine decompInit_lnd - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: decompInit_glcp -! -! !INTERFACE: - subroutine decompInit_glcp(lns,lni,lnj,glcmask) -! -! !DESCRIPTION: -! This subroutine initializes the land surface decomposition into a clump -! data structure. This assumes each pe has the same number of clumps -! set by clump_pproc -! -! !USES: - use clmtype , only : grlnd, nameg, namel, namec, namep - use spmdMod - use spmdGathScatMod - use subgridMod, only : subgrid_get_gcellinfo -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lns,lni,lnj ! land domain global size - integer , pointer, optional :: glcmask(:) ! glc mask -! -! !LOCAL VARIABLES: - integer :: ln,an ! indices - integer :: i,g,l,k ! indices - integer :: cid,pid ! indices - integer :: n,m,np ! indices - integer :: anumg ! lnd num gridcells - integer :: begg,endg ! beg,end gridcells - integer :: begl,endl ! beg,end landunits - integer :: begc,endc ! beg,end columns - integer :: begp,endp ! beg,end pfts - integer :: icells ! temporary - integer :: ilunits ! temporary - integer :: icols ! temporary - integer :: ipfts ! temporary - integer :: ier ! error code - integer :: npmin,npmax,npint ! do loop values for printing - integer :: clmin,clmax ! do loop values for printing - integer :: lsize,gsize ! used for gsmap init - integer :: ng ! number of gridcells in gsmap - integer :: beg,end,num ! temporaries - integer :: val1, val2 ! temporaries - integer, pointer :: gindex(:) ! global index for gsmap init - integer, pointer :: arrayg(:) - integer, pointer :: gstart(:),gcount(:) - integer, pointer :: lstart(:),lcount(:) - integer, pointer :: cstart(:),ccount(:) - integer, pointer :: pstart(:),pcount(:) - integer, pointer :: start(:),count(:) - integer, pointer :: tarr1(:),tarr2(:) - integer, allocatable :: allvecg(:,:) ! temporary vector "global" - integer, allocatable :: allvecl(:,:) ! temporary vector "local" - type(mct_gsmap),pointer :: gsmap - character(len=8) :: clmlevel - integer :: ntest - integer, parameter :: dbug=1 ! 0 = min, 1=normal, 2=much, 3=max - character(len=32), parameter :: subname = 'decompInit_glcp' - -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! 2002.09.11 Forrest Hoffman Creation. -! 2005.12.15 T Craig Updated for finemesh -! 2006.08.18 P Worley Performance optimizations -! -!EOP -!------------------------------------------------------------------------------ - - !--- assign gridcells to clumps (and thus pes) --- - call get_proc_bounds(begg, endg) - - allocate(gstart(begg:endg),lstart(begg:endg),cstart(begg:endg),pstart(begg:endg)) - allocate(gcount(begg:endg),lcount(begg:endg),ccount(begg:endg),pcount(begg:endg)) - allocate(allvecg(nclumps,4),allvecl(nclumps,4)) ! 3 = gcells,lunit,cols,pfts - - allvecg= 0 - allvecl= 0 - gcount = 0 - lcount = 0 - ccount = 0 - pcount = 0 - do anumg = begg,endg - an = ldecomp%gdc2glo(anumg) - cid = lcid(an) - ln = anumg - if (present(glcmask)) then - call subgrid_get_gcellinfo (ln, nlunits=ilunits, & - ncols=icols, npfts=ipfts, glcmask=glcmask(ln)) - else - call subgrid_get_gcellinfo (ln, nlunits=ilunits, & - ncols=icols, npfts=ipfts) - endif - allvecl(cid,1) = allvecl(cid,1) + 1 - allvecl(cid,2) = allvecl(cid,2) + ilunits - allvecl(cid,3) = allvecl(cid,3) + icols - allvecl(cid,4) = allvecl(cid,4) + ipfts - gcount(ln) = 1 - lcount(ln) = ilunits - ccount(ln) = icols - pcount(ln) = ipfts - enddo - call mpi_allreduce(allvecl,allvecg,size(allvecg),MPI_INTEGER,MPI_SUM,mpicom,ier) - - numg = 0 - numl = 0 - numc = 0 - nump = 0 - do cid = 1,nclumps - icells = allvecg(cid,1) - ilunits = allvecg(cid,2) - icols = allvecg(cid,3) - ipfts = allvecg(cid,4) - - !--- overall total --- - numg = numg + icells - numl = numl + ilunits - numc = numc + icols - nump = nump + ipfts - - !--- give gridcell to cid --- - !--- increment the beg and end indices --- - clumps(cid)%nlunits = clumps(cid)%nlunits + ilunits - clumps(cid)%ncols = clumps(cid)%ncols + icols - clumps(cid)%npfts = clumps(cid)%npfts + ipfts - - do m = 1,nclumps - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m > cid)) then - clumps(m)%begl = clumps(m)%begl + ilunits - clumps(m)%begc = clumps(m)%begc + icols - clumps(m)%begp = clumps(m)%begp + ipfts - endif - - if ((clumps(m)%owner > clumps(cid)%owner) .or. & - (clumps(m)%owner == clumps(cid)%owner .and. m >= cid)) then - clumps(m)%endl = clumps(m)%endl + ilunits - clumps(m)%endc = clumps(m)%endc + icols - clumps(m)%endp = clumps(m)%endp + ipfts - endif - enddo - - !--- give gridcell to the proc that owns the cid --- - !--- increment the beg and end indices --- - if (iam == clumps(cid)%owner) then - procinfo%nlunits = procinfo%nlunits + ilunits - procinfo%ncols = procinfo%ncols + icols - procinfo%npfts = procinfo%npfts + ipfts - endif - - if (iam > clumps(cid)%owner) then - procinfo%begl = procinfo%begl + ilunits - procinfo%begc = procinfo%begc + icols - procinfo%begp = procinfo%begp + ipfts - endif - - if (iam >= clumps(cid)%owner) then - procinfo%endl = procinfo%endl + ilunits - procinfo%endc = procinfo%endc + icols - procinfo%endp = procinfo%endp + ipfts - endif - enddo - - do n = 1,nclumps - if (clumps(n)%ncells /= allvecg(n,1) .or. & - clumps(n)%nlunits /= allvecg(n,2) .or. & - clumps(n)%ncols /= allvecg(n,3) .or. & - clumps(n)%npfts /= allvecg(n,4)) then - write(iulog,*) 'decompInit_glcp(): allvecg error ncells ',iam,n,clumps(n)%ncells ,allvecg(n,1) - write(iulog,*) 'decompInit_glcp(): allvecg error lunits ',iam,n,clumps(n)%nlunits,allvecg(n,2) - write(iulog,*) 'decompInit_glcp(): allvecg error ncols ',iam,n,clumps(n)%ncols ,allvecg(n,3) - write(iulog,*) 'decompInit_glcp(): allvecg error pfts ',iam,n,clumps(n)%npfts ,allvecg(n,4) - call endrun() - endif - enddo - - deallocate(allvecg,allvecl) - deallocate(lcid) - - ! set gsMaps, perms for lun, col, pft - - ! this was just "set" above in procinfo, be careful not to move it up - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ng = mct_gsmap_gsize(gsmap_lnd_gdc2glo) - allocate(arrayg(ng)) - - ! for each subgrid gsmap (l, c, p) - ! gather the gdc subgrid counts to masterproc in glo order - ! compute glo ordered start indices from the counts - ! scatter the subgrid start indices back out to the gdc gridcells - ! set the local gindex array for the subgrid from the subgrid start and count arrays - - do k = 1,4 - if (k == 1) then - clmlevel = nameg - beg = begg - end = endg - num = numg - gsmap => gsmap_gce_gdc2glo - start => gstart - count => gcount - elseif (k == 2) then - clmlevel = namel - beg = begl - end = endl - num = numl - gsmap => gsmap_lun_gdc2glo - start => lstart - count => lcount - elseif (k == 3) then - clmlevel = namec - beg = begc - end = endc - num = numc - gsmap => gsmap_col_gdc2glo - start => cstart - count => ccount - elseif (k == 4) then - clmlevel = namep - beg = begp - end = endp - num = nump - gsmap => gsmap_pft_gdc2glo - start => pstart - count => pcount - else - write(iulog,*) 'decompInit_glcp error in k ',k - call endrun() - endif - - arrayg = 0 - call gather_data_to_master(count,arrayg,grlnd) - if (masterproc) then - gsize = arrayg(1) - val1 = arrayg(1) - arrayg(1) = 1 - do n = 2,ng - gsize = gsize + arrayg(n) - val2 = arrayg(n) - arrayg(n) = arrayg(n-1) + val1 - val1 = val2 - enddo - endif - call scatter_data_from_master(start,arrayg,grlnd) - - allocate(gindex(beg:end)) - - i = beg-1 - do g = begg,endg - if (count(g) < 1) then - write(iulog,*) 'decompInit_glcp warning count g ',k,iam,g,count(g) - endif - do l = 1,count(g) - i = i + 1 - if (i < beg .or. i > end) then - write(iulog,*) 'decompInit_glcp error i ',i,beg,end - call endrun() - endif - gindex(i) = start(g) + l - 1 - enddo - enddo - if (i /= end) then - write(iulog,*) 'decompInit_glcp error size ',i,beg,end - call endrun() - endif - lsize = end-beg+1 - gsize = num - call mct_gsMap_init(gsMap, gindex, mpicom, comp_id, lsize, gsize) - - if (dbug > 1) then - !--- test gsmap --- - ntest = mct_gsMap_gsize(gsMap) - allocate(tarr1(ntest),tarr2(beg:end)) - call gather_data_to_master(gindex,tarr1,clmlevel) - call scatter_data_from_master(tarr2,tarr1,clmlevel) - !--- verify gather/scatter produces same result - do l = beg,end - if (tarr2(l) /= gindex(l)) then - write(iulog,*) 'decompInit_glcp error tarr2 ',k,l,gindex(l),tarr2(l) - call endrun() - endif - enddo - !--- verify gather of gindex on new gsmap produces ordered indices - if (masterproc) then - if (tarr1(1) /= 1) then - write(iulog,*) 'decompInit_glcp error tarr1 ',k,1,tarr1(1) - call endrun() - endif - do l = 2,ntest - if (tarr1(l)-tarr1(l-1) /= 1) then - write(iulog,*) 'decompInit_glcp error tarr1 ',k,l,tarr1(l-1),tarr1(l) - call endrun() - endif - enddo - endif - deallocate(tarr1,tarr2) - if (masterproc) then - write(iulog,*) 'decompInit_glcp gsmap [l,c,p] test passes for ',k - endif - !--- end test section - end if - deallocate(gindex) - - enddo - - deallocate(gstart,lstart,cstart,pstart) - deallocate(gcount,lcount,ccount,pcount) - - ! Diagnostic output - - if (masterproc) then - write(iulog,*)' Surface Grid Characteristics' - write(iulog,*)' longitude points = ',lni - write(iulog,*)' latitude points = ',lnj - write(iulog,*)' total number of gridcells = ',numg - write(iulog,*)' total number of landunits = ',numl - write(iulog,*)' total number of columns = ',numc - write(iulog,*)' total number of pfts = ',nump - write(iulog,*)' Decomposition Characteristics' - write(iulog,*)' clumps per process = ',clump_pproc - write(iulog,*)' gsMap Characteristics' - write(iulog,*) ' lnd gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lnd_gdc2glo) - write(iulog,*) ' gce gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_gce_gdc2glo) - write(iulog,*) ' lun gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_lun_gdc2glo) - write(iulog,*) ' col gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_col_gdc2glo) - write(iulog,*) ' pft gsmap glo num of segs = ',mct_gsMap_ngseg(gsMap_pft_gdc2glo) - write(iulog,*) - end if - - ! Write out clump and proc info, one pe at a time, - ! barrier to control pes overwriting each other on stdout - - call shr_sys_flush(iulog) - call mpi_barrier(mpicom,ier) - npmin = 0 - npmax = npes-1 - npint = 1 - if (dbug == 0) then - npmax = 0 - elseif (dbug == 1) then - npmax = min(npes-1,4) - elseif (dbug == 2) then - npint = npes/8 - endif - do np = npmin,npmax,npint - pid = np - if (dbug == 1) then - if (np == 2) pid=npes/2-1 - if (np == 3) pid=npes-2 - if (np == 4) pid=npes-1 - endif - pid = max(pid,0) - pid = min(pid,npes-1) - - if (iam == pid) then - write(iulog,*) - write(iulog,*)'proc= ',pid,& - ' beg gridcell= ',procinfo%begg, & - ' end gridcell= ',procinfo%endg, & - ' total gridcells per proc= ',procinfo%ncells - write(iulog,*)'proc= ',pid,& - ' beg landunit= ',procinfo%begl, & - ' end landunit= ',procinfo%endl, & - ' total landunits per proc= ',procinfo%nlunits - write(iulog,*)'proc= ',pid,& - ' beg column = ',procinfo%begc, & - ' end column = ',procinfo%endc, & - ' total columns per proc = ',procinfo%ncols - write(iulog,*)'proc= ',pid,& - ' beg pft = ',procinfo%begp, & - ' end pft = ',procinfo%endp, & - ' total pfts per proc = ',procinfo%npfts - write(iulog,*)'proc= ',pid,& - ' lnd ngseg = ',mct_gsMap_ngseg(gsMap_lnd_gdc2glo), & - ' lnd nlseg = ',mct_gsMap_nlseg(gsMap_lnd_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' gce ngseg = ',mct_gsMap_ngseg(gsMap_gce_gdc2glo), & - ' gce nlseg = ',mct_gsMap_nlseg(gsMap_gce_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' lun ngseg = ',mct_gsMap_ngseg(gsMap_lun_gdc2glo), & - ' lun nlseg = ',mct_gsMap_nlseg(gsMap_lun_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' col ngseg = ',mct_gsMap_ngseg(gsMap_col_gdc2glo), & - ' col nlseg = ',mct_gsMap_nlseg(gsMap_col_gdc2glo,iam) - write(iulog,*)'proc= ',pid,& - ' pft ngseg = ',mct_gsMap_ngseg(gsMap_pft_gdc2glo), & - ' pft nlseg = ',mct_gsMap_nlseg(gsMap_pft_gdc2glo,iam) - write(iulog,*)'proc= ',pid,' nclumps = ',procinfo%nclumps - - clmin = 1 - clmax = procinfo%nclumps - if (dbug == 1) then - clmax = 1 - elseif (dbug == 0) then - clmax = -1 - endif - do n = clmin,clmax - cid = procinfo%cid(n) - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg gridcell= ',clumps(cid)%begg, & - ' end gridcell= ',clumps(cid)%endg, & - ' total gridcells per clump= ',clumps(cid)%ncells - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg landunit= ',clumps(cid)%begl, & - ' end landunit= ',clumps(cid)%endl, & - ' total landunits per clump = ',clumps(cid)%nlunits - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg column = ',clumps(cid)%begc, & - ' end column = ',clumps(cid)%endc, & - ' total columns per clump = ',clumps(cid)%ncols - write(iulog,*)'proc= ',pid,' clump no = ',n, & - ' clump id= ',procinfo%cid(n), & - ' beg pft = ',clumps(cid)%begp, & - ' end pft = ',clumps(cid)%endp, & - ' total pfts per clump = ',clumps(cid)%npfts - end do - end if - call shr_sys_flush(iulog) - call mpi_barrier(mpicom,ier) - end do - call shr_sys_flush(iulog) - - end subroutine decompInit_glcp - -!------------------------------------------------------------------------------ - -end module decompInitMod diff --git a/src_clm40/main/decompMod.F90 b/src_clm40/main/decompMod.F90 deleted file mode 100644 index 74f35c3de9..0000000000 --- a/src_clm40/main/decompMod.F90 +++ /dev/null @@ -1,359 +0,0 @@ -module decompMod - - !------------------------------------------------------------------------------ - ! !DESCRIPTION: - ! Module provides a descomposition into a clumped data structure which can - ! be mapped back to atmosphere physics chunks. - ! - ! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_abort - use spmdMod , only : masterproc, iam, npes, mpicom, comp_id - use clm_varctl , only : iulog - use mct_mod - ! - ! !PUBLIC TYPES: - implicit none - integer, public :: clump_pproc ! number of clumps per MPI process - ! - ! !PUBLIC MEMBER FUNCTIONS: - - public get_proc_clumps ! number of clumps for this processor - public get_proc_total ! total no. of gridcells, landunits, columns and pfts for any processor - public get_proc_global ! total gridcells, landunits, columns, pfts across all processors - public get_clmlevel_gsize ! get global size associated with clmlevel - public get_clmlevel_gsmap ! get gsmap associated with clmlevel - - interface get_clump_bounds - module procedure get_clump_bounds_old - module procedure get_clump_bounds_new - end interface - public get_clump_bounds ! clump beg and end gridcell,landunit,column,pft - - interface get_proc_bounds - module procedure get_proc_bounds_old - module procedure get_proc_bounds_new - end interface - public get_proc_bounds ! this processor beg and end gridcell,landunit,column,pft - - ! - ! !PRIVATE TYPES: - private ! (now mostly public for decompinitmod) - - integer,public :: nclumps ! total number of clumps across all processors - integer,public :: numg ! total number of gridcells on all procs - integer,public :: numl ! total number of landunits on all procs - integer,public :: numc ! total number of columns on all procs - integer,public :: nump ! total number of pfts on all procs - - type bounds_type - integer :: begg, endg ! beginning and ending gridcell index - integer :: begl, endl ! beginning and ending landunit index - integer :: begc, endc ! beginning and ending column index - integer :: begp, endp ! beginning and ending pft index - end type bounds_type - public bounds_type - - !---global information on each pe - type processor_type - integer :: nclumps ! number of clumps for processor_type iam - integer,pointer :: cid(:) ! clump indices - integer :: ncells ! number of gridcells in proc - integer :: nlunits ! number of landunits in proc - integer :: ncols ! number of columns in proc - integer :: npfts ! number of pfts in proc - integer :: begg, endg ! beginning and ending gridcell index - integer :: begl, endl ! beginning and ending landunit index - integer :: begc, endc ! beginning and ending column index - integer :: begp, endp ! beginning and ending pft index - end type processor_type - public processor_type - type(processor_type),public :: procinfo - - !---global information on each pe - type clump_type - integer :: owner ! process id owning clump - integer :: ncells ! number of gridcells in clump - integer :: nlunits ! number of landunits in clump - integer :: ncols ! number of columns in clump - integer :: npfts ! number of pfts in clump - integer :: begg, endg ! beginning and ending gridcell index - integer :: begl, endl ! beginning and ending landunit index - integer :: begc, endc ! beginning and ending column index - integer :: begp, endp ! beginning and ending pft index - end type clump_type - public clump_type - type(clump_type),public, allocatable :: clumps(:) - - !---global information on each pe - !--- i,j = 2d global - !--- glo = 1d global sn ordered - !--- gsn = 1d global sn ordered compressed - !--- gdc = 1d global dc ordered compressed - type decomp_type - integer,pointer :: glo2gdc(:) ! 1d glo to 1d gdc - integer,pointer :: gdc2glo(:) ! 1d gdc to 1d glo - end type decomp_type - public decomp_type - type(decomp_type),public,target :: ldecomp - - type(mct_gsMap) ,public,target :: gsMap_lnd_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_gce_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_lun_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_col_gdc2glo - type(mct_gsMap) ,public,target :: gsMap_pft_gdc2glo - !------------------------------------------------------------------------------ - -contains - - !------------------------------------------------------------------------------ - subroutine get_clump_bounds_new (n, bounds) - ! - ! !DESCRIPTION: - ! Determine clump bounds - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: n ! processor clump index - type(bounds_type), intent(out) :: bounds ! clump bounds - ! - ! !LOCAL VARIABLES: - character(len=32), parameter :: subname = 'get_clump_bounds' ! Subroutine name - integer :: cid ! clump id -#ifdef _OPENMP - integer, external :: OMP_GET_MAX_THREADS - integer, external :: OMP_GET_NUM_THREADS -#endif - !------------------------------------------------------------------------------ - ! Make sure this IS being called from a threaded region -#ifdef _OPENMP - if ( OMP_GET_NUM_THREADS() == 1 .and. OMP_GET_MAX_THREADS() > 1 )then - call shr_sys_abort( trim(subname)//' ERROR: Calling from inside a non-threaded region)') - end if -#endif - - cid = procinfo%cid(n) - bounds%begp = clumps(cid)%begp - bounds%endp = clumps(cid)%endp - bounds%begc = clumps(cid)%begc - bounds%endc = clumps(cid)%endc - bounds%begl = clumps(cid)%begl - bounds%endl = clumps(cid)%endl - bounds%begg = clumps(cid)%begg - bounds%endg = clumps(cid)%endg - end subroutine get_clump_bounds_new - - !------------------------------------------------------------------------------ - subroutine get_clump_bounds_old (n, begg, endg, begl, endl, begc, endc, begp, endp) - implicit none - integer, intent(in) :: n ! proc clump index - integer, intent(out) :: begp, endp ! clump beg and end pft indices - integer, intent(out) :: begc, endc ! clump beg and end column indices - integer, intent(out) :: begl, endl ! clump beg and end landunit indices - integer, intent(out) :: begg, endg ! clump beg and end gridcell indices - integer :: cid ! clump id - !------------------------------------------------------------------------------ - - cid = procinfo%cid(n) - begp = clumps(cid)%begp - endp = clumps(cid)%endp - begc = clumps(cid)%begc - endc = clumps(cid)%endc - begl = clumps(cid)%begl - endl = clumps(cid)%endl - begg = clumps(cid)%begg - endg = clumps(cid)%endg - end subroutine get_clump_bounds_old - - !------------------------------------------------------------------------------ - subroutine get_proc_bounds_new (bounds) - ! - ! !DESCRIPTION: - ! Retrieve processor bounds - ! - ! !ARGUMENTS: - implicit none - type(bounds_type), intent(out) :: bounds ! processor bounds bounds - ! - ! !LOCAL VARIABLES: -#ifdef _OPENMP - integer, external :: OMP_GET_NUM_THREADS -#endif - character(len=32), parameter :: subname = 'get_proc_bounds' ! Subroutine name - !------------------------------------------------------------------------------ - ! Make sure this is NOT being called from a threaded region -#ifdef _OPENMP - if ( OMP_GET_NUM_THREADS() > 1 )then - call shr_sys_abort( trim(subname)//' ERROR: Calling from inside a threaded region') - end if -#endif - - bounds%begp = procinfo%begp - bounds%endp = procinfo%endp - bounds%begc = procinfo%begc - bounds%endc = procinfo%endc - bounds%begl = procinfo%begl - bounds%endl = procinfo%endl - bounds%begg = procinfo%begg - bounds%endg = procinfo%endg - - end subroutine get_proc_bounds_new - - !------------------------------------------------------------------------------ - subroutine get_proc_bounds_old (begg, endg, begl, endl, begc, endc, begp, endp, & - begCohort, endCohort) - implicit none - integer, optional, intent(out) :: begp, endp ! proc beg and end pft indices - integer, optional, intent(out) :: begc, endc ! proc beg and end column indices - integer, optional, intent(out) :: begl, endl ! proc beg and end landunit indices - integer, optional, intent(out) :: begg, endg ! proc beg and end gridcell indices - ! these are dummy arguments for backwards compatibility with 4_5 in - ! util_share/accumulMod.F90. 4_0 will never have a cohort dimension - integer, optional, intent(out) :: begCohort, endCohort ! cohort beg and end gridcell indices - !------------------------------------------------------------------------------ - - if (present(begp)) begp = procinfo%begp - if (present(endp)) endp = procinfo%endp - if (present(begc)) begc = procinfo%begc - if (present(endc)) endc = procinfo%endc - if (present(begl)) begl = procinfo%begl - if (present(endl)) endl = procinfo%endl - if (present(begg)) begg = procinfo%begg - if (present(endg)) endg = procinfo%endg - end subroutine get_proc_bounds_old - - !------------------------------------------------------------------------------ - subroutine get_proc_total(pid, ncells, nlunits, ncols, npfts) - ! - ! !DESCRIPTION: - ! Count up gridcells, landunits, columns, and pfts on process. - ! - ! !ARGUMENTS: - implicit none - integer, intent(in) :: pid ! proc id - integer, intent(out) :: ncells ! total number of gridcells on the processor - integer, intent(out) :: nlunits ! total number of landunits on the processor - integer, intent(out) :: ncols ! total number of columns on the processor - integer, intent(out) :: npfts ! total number of pfts on the processor - ! - ! !LOCAL VARIABLES: - integer :: cid ! clump index - !------------------------------------------------------------------------------ - - npfts = 0 - nlunits = 0 - ncols = 0 - ncells = 0 - do cid = 1,nclumps - if (clumps(cid)%owner == pid) then - ncells = ncells + clumps(cid)%ncells - nlunits = nlunits + clumps(cid)%nlunits - ncols = ncols + clumps(cid)%ncols - npfts = npfts + clumps(cid)%npfts - end if - end do - end subroutine get_proc_total - - !------------------------------------------------------------------------------ - subroutine get_proc_global(ng, nl, nc, np, nCohorts) - ! - ! !DESCRIPTION: - ! Return number of gridcells, landunits, columns, and pfts across all processes. - ! - ! !ARGUMENTS: - implicit none - integer, intent(out) :: ng ! total number of gridcells across all processors - integer, intent(out) :: nl ! total number of landunits across all processors - integer, intent(out) :: nc ! total number of columns across all processors - integer, intent(out) :: np ! total number of pfts across all processors - ! this is a dummy argument for backwards compatibility with 4_5 in - ! util_share/accumulMod.F90. 4_0 will never have a cohort dimension - integer, optional, intent(out) :: nCohorts ! total number ED cohorts - !------------------------------------------------------------------------------ - - np = nump - nc = numc - nl = numl - ng = numg - end subroutine get_proc_global - - !------------------------------------------------------------------------------ - integer function get_proc_clumps() - ! - ! !DESCRIPTION: - ! Return the number of clumps. - ! - ! !ARGUMENTS: - implicit none - !------------------------------------------------------------------------------ - - get_proc_clumps = procinfo%nclumps - - end function get_proc_clumps - - !----------------------------------------------------------------------- - integer function get_clmlevel_gsize (clmlevel) - ! - ! !DESCRIPTION: - ! Determine 1d size from clmlevel - ! - ! !USES: - use clmtype , only : grlnd, nameg, namel, namec, namep - use domainMod, only : ldomain - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: clmlevel !type of clm 1d array - !----------------------------------------------------------------------- - - select case (clmlevel) - case(grlnd) - get_clmlevel_gsize = ldomain%ns - case(nameg) - get_clmlevel_gsize = numg - case(namel) - get_clmlevel_gsize = numl - case(namec) - get_clmlevel_gsize = numc - case(namep) - get_clmlevel_gsize = nump - case default - write(iulog,*) 'get_clmlevel_gsize does not match clmlevel type: ', trim(clmlevel) - call shr_sys_abort() - end select - - end function get_clmlevel_gsize - - !----------------------------------------------------------------------- - subroutine get_clmlevel_gsmap (clmlevel, gsmap) - ! - ! !DESCRIPTION: - ! Compute arguments for gatherv, scatterv for vectors - ! - ! !USES: - use clmtype, only : grlnd, nameg, namel, namec, namep - ! - ! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: clmlevel ! type of input data - type(mct_gsmap) , pointer :: gsmap - !---------------------------------------------------------------------- - - select case (clmlevel) - case(grlnd) - gsmap => gsmap_lnd_gdc2glo - case(nameg) - gsmap => gsmap_gce_gdc2glo - case(namel) - gsmap => gsmap_lun_gdc2glo - case(namec) - gsmap => gsmap_col_gdc2glo - case(namep) - gsmap => gsmap_pft_gdc2glo - case default - write(iulog,*) 'get_clmlevel_gsmap: Invalid expansion character: ',trim(clmlevel) - call shr_sys_abort() - end select - end subroutine get_clmlevel_gsmap - -end module decompMod diff --git a/src_clm40/main/domainMod.F90 b/src_clm40/main/domainMod.F90 deleted file mode 100644 index 310131ee31..0000000000 --- a/src_clm40/main/domainMod.F90 +++ /dev/null @@ -1,241 +0,0 @@ -module domainMod -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: domainMod -! -! !DESCRIPTION: -! Module containing 2-d global surface boundary data information -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_abort - use spmdMod , only : masterproc - use clm_varctl , only : iulog -! -! !PUBLIC TYPES: - implicit none - private -! - public :: domain_type - - !--- this typically contains local domain info with arrays dim begg:endg --- - type domain_type - integer :: ns ! global size of domain - integer :: ni,nj ! global axis if 2d (nj=1 if unstructured) - logical :: isgrid2d ! true => global grid is lat/lon - integer :: nbeg,nend ! local beg/end indices - character(len=8) :: clmlevel ! grid type - integer ,pointer :: mask(:) ! land mask: 1 = land, 0 = ocean - real(r8),pointer :: frac(:) ! fractional land - real(r8),pointer :: topo(:) ! topography - real(r8),pointer :: latc(:) ! latitude of grid cell (deg) - real(r8),pointer :: lonc(:) ! longitude of grid cell (deg) - real(r8),pointer :: area(:) ! grid cell area (km**2) - integer ,pointer :: pftm(:) ! pft mask: 1=real, 0=fake, -1=notset - integer ,pointer :: glcmask(:) ! glc mask: 1=sfc mass balance required by GLC component - ! 0=SMB not required (default) - ! (glcmask is just a guess at the appropriate mask, known at initialization - in contrast to icemask, which is the true mask obtained from glc) - character*16 :: set ! flag to check if domain is set - logical :: decomped ! decomposed locally or global copy - end type domain_type - - type(domain_type) , public :: ldomain - real(r8), allocatable, public :: lon1d(:), lat1d(:) ! 1d lat/lons for 2d grids -! -! !PUBLIC MEMBER FUNCTIONS: - public domain_init ! allocates/nans domain types - public domain_clean ! deallocates domain types - public domain_check ! write out domain info -! -! !REVISION HISTORY: -! Originally clm_varsur by Mariana Vertenstein -! Migrated from clm_varsur to domainMod by T Craig -! - character*16,parameter :: set = 'domain_set ' - character*16,parameter :: unset = 'NOdomain_unsetNO' -! -!EOP -!------------------------------------------------------------------------------ - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: domain_init -! -! !INTERFACE: - subroutine domain_init(domain,isgrid2d,ni,nj,nbeg,nend,clmlevel) - use shr_infnan_mod, only : nan => shr_infnan_nan, assignment(=) -! -! !DESCRIPTION: -! This subroutine allocates and nans the domain type -! -! !USES: -! -! !ARGUMENTS: - implicit none - type(domain_type) :: domain ! domain datatype - logical, intent(in) :: isgrid2d ! true => global grid is lat/lon - integer, intent(in) :: ni,nj ! grid size, 2d - integer , intent(in), optional :: nbeg,nend ! beg/end indices - character(len=*), intent(in), optional :: clmlevel ! grid type -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer ier - integer nb,ne -! -!------------------------------------------------------------------------------ - - nb = 1 - ne = ni*nj - if (present(nbeg)) then - if (present(nend)) then - nb = nbeg - ne = nend - endif - endif - - if (domain%set == set) then - call domain_clean(domain) - endif - allocate(domain%mask(nb:ne),domain%frac(nb:ne),domain%latc(nb:ne), & - domain%pftm(nb:ne),domain%area(nb:ne),domain%lonc(nb:ne), & - domain%topo(nb:ne),domain%glcmask(nb:ne),stat=ier) - if (ier /= 0) then - call shr_sys_abort('domain_init ERROR: allocate mask, frac, lat, lon, area ') - endif - - if (present(clmlevel)) then - domain%clmlevel = clmlevel - endif - - domain%isgrid2d = isgrid2d - domain%ns = ni*nj - domain%ni = ni - domain%nj = nj - domain%nbeg = nb - domain%nend = ne - domain%mask = -9999 - domain%frac = -1.0e36 - domain%topo = 0._r8 - domain%latc = nan - domain%lonc = nan - domain%area = nan - - domain%set = set - if (domain%nbeg == 1 .and. domain%nend == domain%ns) then - domain%decomped = .false. - else - domain%decomped = .true. - endif - - domain%pftm = -9999 - domain%glcmask = 0 - -end subroutine domain_init -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: domain_clean -! -! !INTERFACE: - subroutine domain_clean(domain) -! -! !DESCRIPTION: -! This subroutine deallocates the domain type -! -! !ARGUMENTS: - implicit none - type(domain_type) :: domain ! domain datatype -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer ier -! -!------------------------------------------------------------------------------ - if (domain%set == set) then - if (masterproc) then - write(iulog,*) 'domain_clean: cleaning ',domain%ni,domain%nj - endif - deallocate(domain%mask,domain%frac,domain%latc, & - domain%lonc,domain%area,domain%pftm, & - domain%topo,domain%glcmask,stat=ier) - if (ier /= 0) then - call shr_sys_abort('domain_clean ERROR: deallocate mask, frac, lat, lon, area ') - endif - else - if (masterproc) then - write(iulog,*) 'domain_clean WARN: clean domain unecessary ' - endif - endif - - domain%clmlevel = unset - domain%ns = huge(1) - domain%ni = huge(1) - domain%nj = huge(1) - domain%nbeg = huge(1) - domain%nend = huge(1) - domain%set = unset - domain%decomped = .true. - -end subroutine domain_clean -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: domain_check -! -! !INTERFACE: - subroutine domain_check(domain) -! -! !DESCRIPTION: -! This subroutine write domain info -! -! !USES: -! -! !ARGUMENTS: - implicit none - type(domain_type),intent(in) :: domain ! domain datatype -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -! -!EOP -!------------------------------------------------------------------------------ - - if (masterproc) then - write(iulog,*) ' domain_check set = ',trim(domain%set) - write(iulog,*) ' domain_check decomped = ',domain%decomped - write(iulog,*) ' domain_check ns = ',domain%ns - write(iulog,*) ' domain_check ni,nj = ',domain%ni,domain%nj - write(iulog,*) ' domain_check clmlevel = ',trim(domain%clmlevel) - write(iulog,*) ' domain_check nbeg,nend = ',domain%nbeg,domain%nend - write(iulog,*) ' domain_check lonc = ',minval(domain%lonc),maxval(domain%lonc) - write(iulog,*) ' domain_check latc = ',minval(domain%latc),maxval(domain%latc) - write(iulog,*) ' domain_check mask = ',minval(domain%mask),maxval(domain%mask) - write(iulog,*) ' domain_check frac = ',minval(domain%frac),maxval(domain%frac) - write(iulog,*) ' domain_check topo = ',minval(domain%topo),maxval(domain%topo) - write(iulog,*) ' domain_check area = ',minval(domain%area),maxval(domain%area) - write(iulog,*) ' domain_check pftm = ',minval(domain%pftm),maxval(domain%pftm) - write(iulog,*) ' domain_check glcmask = ',minval(domain%glcmask),maxval(domain%glcmask) - write(iulog,*) ' ' - endif - -end subroutine domain_check - -!------------------------------------------------------------------------------ - -end module domainMod diff --git a/src_clm40/main/dtypes.h b/src_clm40/main/dtypes.h deleted file mode 100644 index 977e95ad75..0000000000 --- a/src_clm40/main/dtypes.h +++ /dev/null @@ -1,6 +0,0 @@ -#define TYPEDOUBLE 102 -#define TYPEINT 103 -#define TYPETEXT 100 -#define TYPELONG 104 -#define TYPEREAL 101 -#define TYPELOGICAL 105 diff --git a/src_clm40/main/dynlandMod.F90 b/src_clm40/main/dynlandMod.F90 deleted file mode 100644 index b4fe770c19..0000000000 --- a/src_clm40/main/dynlandMod.F90 +++ /dev/null @@ -1,255 +0,0 @@ -module dynlandMod - -!--------------------------------------------------------------------------- -!BOP -! -! !MODULE: dynlandMod -! -! !USES: - use spmdMod - use clmtype - use decompMod , only : get_proc_bounds - use clm_varctl , only : iulog - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun -! -! !DESCRIPTION: -! Compute heat and water content to track conservation wrt dynamic land use -! -! !PUBLIC TYPES: - implicit none - private - save - public :: dynland_hwcontent -! -! !REVISION HISTORY: -! 2009-feb-20 B. Kauffman, created by -! -!EOP -! -! ! PRIVATE TYPES - -!=============================================================================== - -contains - -!=============================================================================== -!BOP -! -! !ROUTINE: dynland_hwcontent -! -! !INTERFACE: - - subroutine dynland_hwcontent(begg,endg,gcell_liq,gcell_ice,gcell_heat) - -! !DESCRIPTION: -! Compute grid-level heat and water content -! -! !REVISION HISTORY: -! 2009-feb-20 B. Kauffman, created by -! -! !USES: - - use clm_varcon, only : istsoil,istice,istwet,istdlak,istslak,isturb,istice_mec - use clm_varcon, only : istcrop - use clm_varcon, only : icol_road_perv,icol_road_imperv,icol_roof - use clm_varcon, only : icol_sunwall,icol_shadewall - use clm_varcon, only : cpice, cpliq - use clm_varpar, only : nlevsno, nlevgrnd - - implicit none - -! !ARGUMENTS: - - integer , intent(in) :: begg, endg ! proc beg & end gridcell indices - real(r8), intent(out) :: gcell_liq(begg:endg) - real(r8), intent(out) :: gcell_ice (begg:endg) - real(r8), intent(out) :: gcell_heat (begg:endg) - -! !LOCAL VARIABLES: -!EOP - - integer :: li,lf ! loop initial/final indicies - integer :: ci,cf ! loop initial/final indicies - integer :: pi,pf ! loop initial/final indicies - - integer :: g,l,c,p,k ! loop indicies (grid,lunit,column,pft,vertical level) - - real(r8) :: wtgcell ! weight relative to grid cell - real(r8) :: wtcol ! weight relative to column - real(r8) :: liq ! sum of liquid water at column level - real(r8) :: ice ! sum of frozen water at column level - real(r8) :: heat ! sum of heat content at column level - real(r8) :: cv ! heat capacity [J/(m^2 K)] - - integer ,pointer :: ltype(:) ! landunit type index - integer ,pointer :: ctype(:) ! column type index - integer ,pointer :: ptype(:) ! pft type index - - integer, pointer :: nlev_improad(:) ! number of impervious road layers - real(r8), pointer :: cv_wall(:,:) ! thermal conductivity of urban wall - real(r8), pointer :: cv_roof(:,:) ! thermal conductivity of urban roof - real(r8), pointer :: cv_improad(:,:) ! thermal conductivity of urban impervious road - - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: h2osoi_ice(:,:) ! frozen water (kg/m2) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) - real(r8), pointer :: csol(:,:) ! heat capacity, soil solids (J/m**3/Kelvin) - real(r8), pointer :: dz(:,:) ! layer depth (m) - real(r8), pointer :: wa(:,:) ! h2o in underground aquifer - - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - -!------------------------------------------------------------------------------- -! Note: this routine does not compute heat or water content of lakes. -! -!------------------------------------------------------------------------------- - - ! Set pointers into derived type - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - ltype => lun%itype - ctype => col%itype - ptype => pft%itype - - nlev_improad => lps%nlev_improad - cv_wall => lps%cv_wall - cv_roof => lps%cv_roof - cv_improad => lps%cv_improad - - snl => cps%snl - watsat => cps%watsat - csol => cps%csol - dz => cps%dz - t_soisno => ces%t_soisno - h2osoi_liq => cws%h2osoi_liq - h2osoi_ice => cws%h2osoi_ice - h2osno => cws%h2osno - - ! Get relevant sizes - - do g = begg,endg ! loop over grid cells - - gcell_liq (g) = 0.0_r8 ! sum for one grid cell - gcell_ice (g) = 0.0_r8 ! sum for one grid cell - gcell_heat (g) = 0.0_r8 ! sum for one grid cell - - li = gptr%luni(g) - lf = gptr%lunf(g) - do l = li,lf ! loop over land units - - ci = lptr%coli(l) - cf = lptr%colf(l) - do c = ci,cf ! loop over columns - - liq = 0.0_r8 ! sum for one column - ice = 0.0_r8 - heat = 0.0_r8 - - !--- water & ice, above ground only --- - if ( (ltype(l) == istsoil .or. ltype(l) == istcrop ) & - .or. (ltype(l) == istwet ) & - .or. (ltype(l) == istice ) & - .or. (ltype(l) == istice_mec ) & - .or. (ltype(l) == isturb .and. ctype(c) == icol_roof ) & - .or. (ltype(l) == isturb .and. ctype(c) == icol_road_imperv) & - .or. (ltype(l) == isturb .and. ctype(c) == icol_road_perv )) then - - if ( snl(c) < 0 ) then - do k = snl(c)+1,0 ! loop over snow layers - liq = liq + cws%h2osoi_liq(c,k) - ice = ice + cws%h2osoi_ice(c,k) - end do - else ! no snow layers exist - ice = ice + cws%h2osno(c) - end if - end if - - !--- water & ice, below ground only --- - if ( (ltype(l) == istsoil .or. ltype(l) == istcrop ) & - .or. (ltype(l) == istwet ) & - .or. (ltype(l) == istice ) & - .or. (ltype(l) == istice_mec ) & - .or. (ltype(l) == isturb .and. ctype(c) == icol_road_perv )) then - do k = 1,nlevgrnd - liq = liq + cws%h2osoi_liq(c,k) - ice = ice + cws%h2osoi_ice(c,k) - end do - end if - - !--- water in aquifer --- - if ( (ltype(l) == istsoil .or. ltype(l) == istcrop ) & - .or. (ltype(l) == istwet ) & - .or. (ltype(l) == istice ) & - .or. (ltype(l) == istice_mec ) & - .or. (ltype(l) == isturb .and. ctype(c) == icol_road_perv )) then - liq = liq + cws%wa(c) - end if - - !--- water in canopy (at pft level) --- - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then ! note: soil specified at LU level - pi = cptr%pfti(c) - pf = cptr%pftf(c) - do p = pi,pf ! loop over pfts - wtcol = pptr%wtcol(p) - liq = liq + pws%h2ocan(p) * wtcol - end do - end if - - if ( (ltype(l) /= istslak) .and. ltype(l) /= istdlak) then - - !--- heat content, below ground only --- - do k = 1,nlevgrnd - if (ctype(c)==icol_sunwall .OR. ctype(c)==icol_shadewall) then - cv = cv_wall(l,k) * dz(c,k) - else if (ctype(c) == icol_roof) then - cv = cv_roof(l,k) * dz(c,k) - else if (ctype(c) == icol_road_imperv .and. k >= 1 .and. k <= nlev_improad(l)) then - cv = cv_improad(l,k) * dz(c,k) - else if (ltype(l) /= istwet .AND. ltype(l) /= istice .AND. ltype(l) /= istice_mec) then - cv = csol(c,k)*(1-watsat(c,k))*dz(c,k) + (h2osoi_ice(c,k)*cpice + h2osoi_liq(c,k)*cpliq) - else - cv = (h2osoi_ice(c,k)*cpice + h2osoi_liq(c,k)*cpliq) - endif - heat = heat + cv*t_soisno(c,k) / 1.e6_r8 - end do - - !--- heat content, above ground only --- - if ( snl(c) < 0 ) then - do k = snl(c)+1,0 ! loop over snow layers - cv = cpliq*h2osoi_liq(c,k) + cpice*h2osoi_ice(c,k) - heat = heat + cv*t_soisno(c,k) / 1.e6_r8 - end do - else if ( h2osno(c) > 0.0_r8) then - k = 1 - cv = cpice*h2osno(c) - heat = heat + cv*t_soisno(c,k) / 1.e6_r8 - end if - - end if - - !--- scale x/m^2 column-level values into x/m^2 gridcell-level values --- - wtgcell = cptr%wtgcell(c) - gcell_liq (g) = gcell_liq (g) + liq * wtgcell - gcell_ice (g) = gcell_ice (g) + ice * wtgcell - gcell_heat (g) = gcell_heat (g) + heat * wtgcell - - end do ! column loop - end do ! landunit loop - end do ! grid cell loop - - end subroutine dynland_hwcontent - -!=============================================================================== - -end module dynlandMod diff --git a/src_clm40/main/fileutils.F90 b/src_clm40/main/fileutils.F90 deleted file mode 100644 index b74af42426..0000000000 --- a/src_clm40/main/fileutils.F90 +++ /dev/null @@ -1,179 +0,0 @@ -module fileutils - - !----------------------------------------------------------------------- - ! !DESCRIPTION: - ! Module containing file I/O utilities - ! - ! !USES: - use shr_sys_mod , only : shr_sys_abort - use clm_varctl , only : iulog - use spmdMod , only : masterproc - ! - ! !PUBLIC TYPES: - implicit none - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - public :: get_filename !Returns filename given full pathname - public :: opnfil !Open local unformatted or formatted file - public :: getfil !Obtain local copy of file - public :: relavu !Close and release Fortran unit no longer in use - public :: getavu !Get next available Fortran unit number - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - character(len=256) function get_filename (fulpath) - ! - ! !DESCRIPTION: - ! Returns filename given full pathname - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fulpath !full pathname - ! - ! !LOCAL VARIABLES: - integer i !loop index - integer klen !length of fulpath character string - !------------------------------------------------------------------------ - - klen = len_trim(fulpath) - do i = klen, 1, -1 - if (fulpath(i:i) == '/') go to 10 - end do - i = 0 -10 get_filename = fulpath(i+1:klen) - - return - end function get_filename - - !------------------------------------------------------------------------ - subroutine getfil (fulpath, locfn, iflag) - ! - ! !DESCRIPTION: - ! Obtain local copy of file - ! First check current working directory - ! Next check full pathname[fulpath] on disk - ! - ! !USES: - use shr_file_mod, only: shr_file_get - ! - ! !ARGUMENTS: - character(len=*), intent(in) :: fulpath !Archival or permanent disk full pathname - character(len=*), intent(out) :: locfn !output local file name - integer, intent(in) :: iflag !0=>abort if file not found 1=>do not abort - ! - ! !LOCAL VARIABLES: - integer i !loop index - integer klen !length of fulpath character string - logical lexist !true if local file exists - !------------------------------------------------------------------------ - - ! get local file name from full name - - locfn = get_filename( fulpath ) - if (len_trim(locfn) == 0) then - if (masterproc) write(iulog,*)'(GETFIL): local filename has zero length' - call shr_sys_abort - else - if (masterproc) write(iulog,*)'(GETFIL): attempting to find local file ', & - trim(locfn) - endif - - ! first check if file is in current working directory. - - inquire (file=locfn,exist=lexist) - if (lexist) then - if (masterproc) write(iulog,*) '(GETFIL): using ',trim(locfn), & - ' in current working directory' - RETURN - endif - - ! second check for full pathname on disk - locfn = fulpath - - inquire (file=fulpath,exist=lexist) - if (lexist) then - if (masterproc) write(iulog,*) '(GETFIL): using ',trim(fulpath) - RETURN - else - if (masterproc) write(iulog,*)'(GETFIL): failed getting file from full path: ', fulpath - if (iflag==0) then - call shr_sys_abort ('GETFIL: FAILED to get '//trim(fulpath)) - else - RETURN - endif - endif - - end subroutine getfil - - !------------------------------------------------------------------------ - subroutine opnfil (locfn, iun, form) - ! - ! !DESCRIPTION: - ! Open file locfn in unformatted or formatted form on unit iun - ! - ! !ARGUMENTS: - character(len=*), intent(in):: locfn !file name - integer, intent(in):: iun !fortran unit number - character(len=1), intent(in):: form !file format: u = unformatted, f = formatted - ! - ! !LOCAL VARIABLES: - integer ioe !error return from fortran open - character(len=11) ft !format type: formatted. unformatted - !------------------------------------------------------------------------ - - if (len_trim(locfn) == 0) then - write(iulog,*)'(OPNFIL): local filename has zero length' - call shr_sys_abort - endif - if (form=='u' .or. form=='U') then - ft = 'unformatted' - else - ft = 'formatted ' - end if - open (unit=iun,file=locfn,status='unknown',form=ft,iostat=ioe) - if (ioe /= 0) then - write(iulog,*)'(OPNFIL): failed to open file ',trim(locfn), & - & ' on unit ',iun,' ierr=',ioe - call shr_sys_abort - else if ( masterproc )then - write(iulog,*)'(OPNFIL): Successfully opened file ',trim(locfn), & - & ' on unit= ',iun - end if - - end subroutine opnfil - - !------------------------------------------------------------------------ - integer function getavu() - ! - ! !DESCRIPTION: - ! Get next available Fortran unit number. - ! - ! !USES: - use shr_file_mod, only : shr_file_getUnit - !------------------------------------------------------------------------ - - getavu = shr_file_getunit() - - end function getavu - - !------------------------------------------------------------------------ - subroutine relavu (iunit) - ! - ! !DESCRIPTION: - ! Close and release Fortran unit no longer in use! - ! - ! !USES: - use shr_file_mod, only : shr_file_freeUnit - ! - ! !ARGUMENTS: - integer, intent(in) :: iunit !Fortran unit number - !------------------------------------------------------------------------ - - close(iunit) - call shr_file_freeUnit(iunit) - - end subroutine relavu - -end module fileutils diff --git a/src_clm40/main/filterMod.F90 b/src_clm40/main/filterMod.F90 deleted file mode 100644 index e3151548a9..0000000000 --- a/src_clm40/main/filterMod.F90 +++ /dev/null @@ -1,390 +0,0 @@ -module filterMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: filterMod -! -! !DESCRIPTION: -! Module of filters used for processing columns and pfts of particular -! types, including lake, non-lake, urban, soil, snow, non-snow, and -! naturally-vegetated patches. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use abortutils, only : endrun - use clm_varctl, only : iulog, use_cndv -! -! !PUBLIC TYPES: - implicit none - save - - private - - type clumpfilter - integer, pointer :: natvegp(:) ! CNDV nat-vegetated (present) filter (pfts) - integer :: num_natvegp ! number of pfts in nat-vegetated filter - - integer, pointer :: pcropp(:) ! prognostic crop filter (pfts) - integer :: num_pcropp ! number of pfts in prognostic crop filter - integer, pointer :: soilnopcropp(:) ! soil w/o prog. crops (pfts) - integer :: num_soilnopcropp ! number of pfts in soil w/o prog crops - - integer, pointer :: lakep(:) ! lake filter (pfts) - integer :: num_lakep ! number of pfts in lake filter - integer, pointer :: nolakep(:) ! non-lake filter (pfts) - integer :: num_nolakep ! number of pfts in non-lake filter - integer, pointer :: lakec(:) ! lake filter (columns) - integer :: num_lakec ! number of columns in lake filter - integer, pointer :: nolakec(:) ! non-lake filter (columns) - integer :: num_nolakec ! number of columns in non-lake filter - - integer, pointer :: soilc(:) ! soil filter (columns) - integer :: num_soilc ! number of columns in soil filter - integer, pointer :: soilp(:) ! soil filter (pfts) - integer :: num_soilp ! number of pfts in soil filter - - integer, pointer :: snowc(:) ! snow filter (columns) - integer :: num_snowc ! number of columns in snow filter - integer, pointer :: nosnowc(:) ! non-snow filter (columns) - integer :: num_nosnowc ! number of columns in non-snow filter - - integer, pointer :: hydrologyc(:) ! hydrology filter (columns) - integer :: num_hydrologyc ! number of columns in hydrology filter - - integer, pointer :: urbanl(:) ! urban filter (landunits) - integer :: num_urbanl ! number of landunits in urban filter - integer, pointer :: nourbanl(:) ! non-urban filter (landunits) - integer :: num_nourbanl ! number of landunits in non-urban filter - - integer, pointer :: urbanc(:) ! urban filter (columns) - integer :: num_urbanc ! number of columns in urban filter - integer, pointer :: nourbanc(:) ! non-urban filter (columns) - integer :: num_nourbanc ! number of columns in non-urban filter - - integer, pointer :: urbanp(:) ! urban filter (pfts) - integer :: num_urbanp ! number of pfts in urban filter - integer, pointer :: nourbanp(:) ! non-urban filter (pfts) - integer :: num_nourbanp ! number of pfts in non-urban filter - - integer, pointer :: nolakeurbanp(:) ! non-lake, non-urban filter (pfts) - integer :: num_nolakeurbanp ! number of pfts in non-lake, non-urban filter - - end type clumpfilter - public clumpfilter - - type(clumpfilter), allocatable, public :: filter(:) -! - public allocFilters ! allocate memory for filters - public setFilters ! set filters -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 11/13/03, Peter Thornton: Added soilp and num_soilp -! Jan/08, S. Levis: Added crop-related filters -! -!EOP -!----------------------------------------------------------------------- - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: allocFilters -! -! !INTERFACE: - subroutine allocFilters() -! -! !DESCRIPTION: -! Allocate CLM filters. -! -! !USES: - use clmtype - use decompMod , only : get_proc_clumps, get_clump_bounds -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 2004.04.27 DGVM naturally-vegetated filter added by Forrest Hoffman -! -!EOP -! -! LOCAL VARAIBLES: - integer :: nc ! clump index - integer :: nclumps ! total number of clumps on this processor - integer :: begp, endp ! per-clump beginning and ending pft indices - integer :: begc, endc ! per-clump beginning and ending column indices - integer :: begl, endl ! per-clump beginning and ending landunit indices - integer :: begg, endg ! per-clump beginning and ending gridcell indices - integer :: ier ! error status -!------------------------------------------------------------------------ - - ! Determine clump variables for this processor - - nclumps = get_proc_clumps() - ier = 0 - if( .not. allocated(filter)) then - allocate(filter(nclumps), stat=ier) - end if - if (ier /= 0) then - write(iulog,*) 'allocFilters(): allocation error for clumpsfilters' - call endrun - end if - - ! Loop over clumps on this processor - - !$OMP PARALLEL DO PRIVATE (nc,begg,endg,begl,endl,begc,endc,begp,endp) - do nc = 1, nclumps - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - allocate(filter(nc)%lakep(endp-begp+1)) - allocate(filter(nc)%nolakep(endp-begp+1)) - allocate(filter(nc)%nolakeurbanp(endp-begp+1)) - - allocate(filter(nc)%lakec(endc-begc+1)) - allocate(filter(nc)%nolakec(endc-begc+1)) - - allocate(filter(nc)%soilc(endc-begc+1)) - allocate(filter(nc)%soilp(endp-begp+1)) - - allocate(filter(nc)%snowc(endc-begc+1)) - allocate(filter(nc)%nosnowc(endc-begc+1)) - - if (use_cndv) then - allocate(filter(nc)%natvegp(endp-begp+1)) - end if - - allocate(filter(nc)%hydrologyc(endc-begc+1)) - - allocate(filter(nc)%urbanp(endp-begp+1)) - allocate(filter(nc)%nourbanp(endp-begp+1)) - - allocate(filter(nc)%urbanc(endc-begc+1)) - allocate(filter(nc)%nourbanc(endc-begc+1)) - - allocate(filter(nc)%urbanl(endl-begl+1)) - allocate(filter(nc)%nourbanl(endl-begl+1)) - - allocate(filter(nc)%pcropp(endp-begp+1)) - allocate(filter(nc)%soilnopcropp(endp-begp+1)) - end do - !$OMP END PARALLEL DO - - end subroutine allocFilters - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: setFilters -! -! !INTERFACE: - subroutine setFilters( nc ) -! -! !DESCRIPTION: -! Set CLM filters. -! -! !USES: - use clmtype - use decompMod , only : get_clump_bounds - use pftvarcon , only : npcropmin - use clm_varcon, only : istsoil, isturb, icol_road_perv, istice_mec - use clm_varcon, only : istcrop -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: nc ! clump index -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 2004.04.27 DGVM naturally-vegetated filter added by Forrest Hoffman -! 2005.09.12 Urban related filters added by Mariana Vertenstein -! -!EOP -! -! LOCAL VARAIBLES: - integer , pointer :: ctype(:) ! column type - integer :: c,l,p ! column, landunit, pft indices - integer :: fl ! lake filter index - integer :: fnl,fnlu ! non-lake filter index - integer :: fs ! soil filter index - integer :: f, fn ! general indices - integer :: begp, endp ! per-clump beginning and ending pft indices - integer :: begc, endc ! per-clump beginning and ending column indices - integer :: begl, endl ! per-clump beginning and ending landunit indices - integer :: begg, endg ! per-clump beginning and ending gridcell indices -!------------------------------------------------------------------------ - - ctype => col%itype - - ! Determine clump boundaries - - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - ! Create lake and non-lake filters at column-level - - fl = 0 - fnl = 0 - do c = begc,endc - l = col%landunit(c) - if (lun%lakpoi(l)) then - fl = fl + 1 - filter(nc)%lakec(fl) = c - else - fnl = fnl + 1 - filter(nc)%nolakec(fnl) = c - end if - end do - filter(nc)%num_lakec = fl - filter(nc)%num_nolakec = fnl - - ! Create lake and non-lake filters at pft-level - ! Filter will only be active if weight of pft wrt gcell is nonzero - - fl = 0 - fnl = 0 - fnlu = 0 - do p = begp,endp - l = pft%landunit(p) - if (pft%wtgcell(p) > 0._r8 & - .or. & - lun%itype(l)==istice_mec) then ! some glacier_mec columns have zero weight - - l = pft%landunit(p) - if (lun%lakpoi(l) ) then - fl = fl + 1 - filter(nc)%lakep(fl) = p - else - fnl = fnl + 1 - filter(nc)%nolakep(fnl) = p - if (lun%itype(l) /= isturb) then - fnlu = fnlu + 1 - filter(nc)%nolakeurbanp(fnlu) = p - end if - end if - end if - end do - filter(nc)%num_lakep = fl - filter(nc)%num_nolakep = fnl - filter(nc)%num_nolakeurbanp = fnlu - - ! Create soil filter at column-level - - fs = 0 - do c = begc,endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fs = fs + 1 - filter(nc)%soilc(fs) = c - end if - end do - filter(nc)%num_soilc = fs - - ! Create soil filter at pft-level - ! Filter will only be active if weight of pft wrt gcell is nonzero - - fs = 0 - do p = begp,endp - if (pft%wtgcell(p) > 0._r8) then - l = pft%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fs = fs + 1 - filter(nc)%soilp(fs) = p - end if - end if - end do - filter(nc)%num_soilp = fs - - ! Create column-level hydrology filter (soil and Urban pervious road cols) - - f = 0 - do c = begc,endc - l = col%landunit(c) - if (lun%itype(l) == istsoil .or. ctype(c) == icol_road_perv .or. & - lun%itype(l) == istcrop) then - f = f + 1 - filter(nc)%hydrologyc(f) = c - end if - end do - filter(nc)%num_hydrologyc = f - - ! Create prognostic crop and soil w/o prog. crop filters at pft-level - ! according to where the crop model should be used - - fl = 0 - fnl = 0 - do p = begp,endp - if (pft%wtgcell(p) > 0._r8) then - if (pft%itype(p) >= npcropmin) then !skips 2 generic crop types - fl = fl + 1 - filter(nc)%pcropp(fl) = p - else - l = pft%landunit(p) - if (lun%itype(l) == istsoil .or. lun%itype(l) == istcrop) then - fnl = fnl + 1 - filter(nc)%soilnopcropp(fnl) = p - end if - end if - end if - end do - filter(nc)%num_pcropp = fl - filter(nc)%soilnopcropp = fnl ! This wasn't being set before... - - ! Create landunit-level urban and non-urban filters - - f = 0 - fn = 0 - do l = begl,endl - if (lun%itype(l) == isturb) then - f = f + 1 - filter(nc)%urbanl(f) = l - else - fn = fn + 1 - filter(nc)%nourbanl(fn) = l - end if - end do - filter(nc)%num_urbanl = f - filter(nc)%num_nourbanl = fn - - ! Create column-level urban and non-urban filters - - f = 0 - fn = 0 - do c = begc,endc - l = col%landunit(c) - if (lun%itype(l) == isturb) then - f = f + 1 - filter(nc)%urbanc(f) = c - else - fn = fn + 1 - filter(nc)%nourbanc(fn) = c - end if - end do - filter(nc)%num_urbanc = f - filter(nc)%num_nourbanc = fn - - ! Create pft-level urban and non-urban filters - - f = 0 - fn = 0 - do p = begp,endp - l = pft%landunit(p) - if (lun%itype(l) == isturb .and. pft%wtgcell(p) > 0._r8) then - f = f + 1 - filter(nc)%urbanp(f) = p - else - fn = fn + 1 - filter(nc)%nourbanp(fn) = p - end if - end do - filter(nc)%num_urbanp = f - filter(nc)%num_nourbanp = fn - - ! Note: snow filters are reconstructed each time step in Hydrology2 - ! Note: CNDV "pft present" filter is reconstructed each time CNDV is run - - end subroutine setFilters - -end module filterMod diff --git a/src_clm40/main/findHistFields.pl b/src_clm40/main/findHistFields.pl deleted file mode 100755 index d9e39946e5..0000000000 --- a/src_clm40/main/findHistFields.pl +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/env perl -# -# This perl script reads in the histFldsMod.F90 file to find the total list of history -# fields that can be added for this model version, regardless of namelist options, or -# CPP processing. -# -use strict; -#use warnings; -#use diagnostics; - -use Cwd; -use English; -use Getopt::Long; -use IO::File; -use File::Glob ':glob'; - -# Set the directory that contains the CLM configuration scripts. If the command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume -# the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $cmdline = "@ARGV"; # Command line arguments to script -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -my $nm = "${ProgName}::"; # name to use if script dies -if ($ProgDir) { - $cfgdir = $ProgDir; -} else { - $cfgdir = $cwd; -} -# The namelist definition file contains entries for all namelist variables that -# can be output by build-namelist. -my $nl_definition_file = "$cfgdir/../../bld/namelist_files/namelist_definition_clm4_0.xml"; -(-f "$nl_definition_file") or die <<"EOF"; -** $ProgName - Cannot find namelist definition file \"$nl_definition_file\" ** -EOF -print "Using namelist definition file $nl_definition_file\n"; - -# The Build::NamelistDefinition module provides utilities to get the list of -# megan compounds - -#The root directory to cesm utils Tools -my $cesm_tools = "$cfgdir/../../../../cime/utils"; - -(-f "$cesm_tools/perl5lib/Build/NamelistDefinition.pm") or die <<"EOF"; -** $ProgName - Cannot find perl module \"Build/NamelistDefinition.pm\" in directory - \"$cesm_tools/perl5lib\" ** -EOF -# Add $cfgdir/perl5lib to the list of paths that Perl searches for modules -my @dirs = ( $cfgdir, "$cesm_tools/perl5lib"); -unshift @INC, @dirs; -require Build::NamelistDefinition; -# Create a namelist definition object. This object provides a method for verifying that -# the -# output namelist variables are in the definition file, and are output in the correct -# namelist groups. -my $definition = Build::NamelistDefinition->new($nl_definition_file); - - -my $mxname = 0; -my $mxlongn = 0; -my %fields; -my $fldnamevar = "fieldname_var"; - -sub matchKeyword { -# -# Match a keyword -# - my $keyword = shift; - my $line = shift; - my $fh = shift; - - my $match = undef; - if ( $line =~ /$keyword/ ) { - if ( $line =~ /$keyword\s*=\s*['"]([^'"]+)['"]/ ) { - $match = $1; - } elsif ( $line =~ /$keyword\s*=\s*&\s*$/ ) { - $line = <$fh>; - if ( $line =~ /^\s*['"]([^'"]+)['"]/ ) { - $match = $1; - } else { - die "ERROR: Trouble getting keyword string\n Line: $line"; - } - } else { - if ( $line =~ /fname\s*=\s*fieldname/ ) { - print STDERR "Found variable used for fieldname = $line\n"; - $match = $fldnamevar; - } elsif ( $line =~ /fname\s*=\s*trim\(fname\)/ ) { - $match = undef; - } elsif ( $line =~ /units\s*=\s*units/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*long_name/ ) { - $match = undef; - } elsif ( $line =~ /long_name\s*=\s*longname/ ) { - print STDERR "Found variable used for longname = $line\n"; - $match = "longname_var"; - } else { - die "ERROR: Still have a match on $keyword\n Line: $line"; - } - } - } - return( $match ); -} - -sub getFieldInfo { -# -# Get field Information -# - my $fh = shift; - my $line = shift; - - my $fname = undef; - my $units = undef; - my $longn = undef; - my $endin = undef; - do { - if ( $line =~ /MEG_/ ) { - $line =~ s|'//'_'|_'|g; - $line =~ s|'//trim\(meg_cmp\%name\)|megancmpd'|gi; - if ( $line =~ /meg_cmp\%name/ ) { - die "ERROR: Still have meg_cmp in a line\n"; - } - } - if ( ! defined($fname) ) { - $fname = &matchKeyword( "fname", $line, $fh ); - } - if ( ! defined($units) ) { - $units = &matchKeyword( "units", $line, $fh ); - } - if ( ! defined($longn) ) { - $longn = &matchKeyword( "long_name", $line, $fh ); - } - if ( $line =~ /\)\s*$/ ) { - $endin = 1; - } - if ( ! defined($endin) ) { $line = <$fh>; } - - } until( (defined($fname) && defined($units) && defined($longn)) || - ! defined($line) || defined($endin) ); - if ( ! defined($fname) ) { - die "ERROR: name undefined for field ending with: $line\n"; - } - return( $fname, $longn, $units ); -} - -sub setField { -# -# Set the field -# - my $name = shift; - my $longn = shift; - my $units = shift; - - if ( defined($name) && $name ne $fldnamevar ) { - if ( length($name) > $mxname ) { $mxname = length($name); } - if ( length($longn) > $mxlongn ) { $mxlongn = length($longn); } - my $len; - if ( length($longn) > 90 ) { - $len = 110; - } elsif ( length($longn) > 60 ) { - $len = 90; - } else { - $len = 60; - } - $fields{$name} = sprintf( "%-${len}s\t(%s)", $longn, $units ); - } -} - -sub XML_Header { -# -# Write out header to history fields file -# - my $outfh = shift; - my $outfilename = shift; - my $filename = shift; - - print STDERR " Write out header to history fields file to: $outfilename\n"; - my $svnurl = '$URL$'; - my $svnid = '$Id$'; - print $outfh <<"EOF"; - - -\<\?xml-stylesheet type="text\/xsl" href="history_fields.xsl"\?\> - -\<\!-- - List of history file field names, long-names and units for all the fields output - by CLM. This was created by reading in the file: $filename - SVN version information: - $svnurl - $svnid ---\> - -\ -EOF -} - -sub XML_Footer { -# -# Write out footer to history fields file -# - my $outfh = shift; - - print STDERR " Write out footer to history fields file\n"; - print $outfh "\n\n"; -} - -my $pwd = `pwd`; -chomp( $pwd ); -my $filename = "$pwd/histFldsMod.F90"; - -my $fh = IO::File->new($filename, '<') or die "** $ProgName - can't open history Fields file: $filename\n"; -my @megcmpds = $definition->get_valid_values( "megan_cmpds", 'noquotes'=>1 ); -# -# Read in the list of fields from the source file -# And output to an XML file -# -my $outfilename = "$pwd/../../bld/namelist_files/history_fields_clm4_0.xml"; - -my $outfh = IO::File->new($outfilename, '>') or die "** $ProgName - can't open output history Fields XML file: $outfilename\n"; -&XML_Header( $outfh, $outfilename, $filename ); -while (my $line = <$fh>) { - - # Comments - if ($line =~ /(.*)\!/) { - $line = $1; - } - my $format = "\n\n"; - if ($line =~ /call\s*hist_addfld/i ) { - (my $name, my $longn, my $units) = &getFieldInfo( $fh, $line ); - if ( $name ne "MEG_megancmpd" ) { - &setField( $name, $longn, $units ); - printf( $outfh $format, $name, $units, $longn ); - } else { - foreach my $megcmpd ( @megcmpds ) { - my $name = "MEG_${megcmpd}"; - &setField( $name, $longn, $units ); - printf( $outfh $format, $name, $units, $longn ); - } - } - } -} -close( $fh ); -&XML_Footer( $outfh ); -close( $outfh ); -print STDERR " mxname = $mxname\n"; -print STDERR " mxlongn = $mxlongn\n"; - -# -# List the fields in a neatly ordered list -# -foreach my $name ( sort(keys(%fields)) ) { - my $len; - if ( length($name) > 20 ) { - $len = 40; - } else { - $len = 20; - } - printf( "%-${len}s = %s\n", $name, $fields{$name} ); -} - diff --git a/src_clm40/main/getdatetime.F90 b/src_clm40/main/getdatetime.F90 deleted file mode 100644 index 4126d807e4..0000000000 --- a/src_clm40/main/getdatetime.F90 +++ /dev/null @@ -1,53 +0,0 @@ -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: getdatetime -! -! !INTERFACE: -subroutine getdatetime (cdate, ctime) -! -! !DESCRIPTION: -! A generic Date and Time routine -! -! !USES: - use spmdMod , only : mpicom, masterproc, MPI_CHARACTER -! !ARGUMENTS: - implicit none - character(len=8), intent(out) :: cdate !current date - character(len=8), intent(out) :: ctime !current time -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - character(len=8) :: date !current date - character(len=10) :: time !current time - character(len=5) :: zone !zone - integer, dimension(8) :: values !temporary - integer :: ier !MPI error code -!----------------------------------------------------------------------- - if (masterproc) then - - call date_and_time (date, time, zone, values) - - cdate(1:2) = date(5:6) - cdate(3:3) = '/' - cdate(4:5) = date(7:8) - cdate(6:6) = '/' - cdate(7:8) = date(3:4) - - ctime(1:2) = time(1:2) - ctime(3:3) = ':' - ctime(4:5) = time(3:4) - ctime(6:6) = ':' - ctime(7:8) = time(5:6) - - endif - - call mpi_bcast (cdate,len(cdate),MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (ctime,len(ctime),MPI_CHARACTER, 0, mpicom, ier) - - return -end subroutine getdatetime diff --git a/src_clm40/main/histFileMod.F90 b/src_clm40/main/histFileMod.F90 deleted file mode 100644 index e73972cbc5..0000000000 --- a/src_clm40/main/histFileMod.F90 +++ /dev/null @@ -1,4497 +0,0 @@ -module histFileMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: histFileMod -! -! !DESCRIPTION: -! Module containing methods to for CLM history file handling. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc - use shr_sys_mod , only : shr_sys_flush - use abortutils , only : endrun - use clm_varcon , only : spval,ispval - use clm_varctl , only : iulog - use clmtype - use decompMod , only : get_proc_bounds, get_proc_global - use ncdio_pio - implicit none - save - private - -! -! !PUBLIC TYPES: -! -! Constants -! - integer , public, parameter :: max_tapes = 6 ! max number of history tapes - integer , public, parameter :: max_flds = 1500 ! max number of history fields - integer , public, parameter :: max_namlen = 32 ! maximum number of characters for field name -! -! Counters -! - integer , public :: ntapes = 0 ! index of max history file requested -! -! Namelist -! - integer :: ni ! implicit index below - logical, public :: & - hist_empty_htapes = .false. ! namelist: flag indicates no default history fields - integer, public :: & - hist_ndens(max_tapes) = 2 ! namelist: output density of netcdf history files - integer, public :: & - hist_mfilt(max_tapes) = 30 ! namelist: number of time samples per tape - logical, public :: & - hist_dov2xy(max_tapes) = (/.true.,(.true.,ni=2,max_tapes)/) ! namelist: true=> do grid averaging - integer, public :: & - hist_nhtfrq(max_tapes) = (/0, (-24, ni=2,max_tapes)/) ! namelist: history write freq(0=monthly) - character(len=1), public :: & - hist_avgflag_pertape(max_tapes) = (/(' ',ni=1,max_tapes)/) ! namelist: per tape averaging flag - character(len=max_namlen), public :: & - hist_type1d_pertape(max_tapes) = (/(' ',ni=1,max_tapes)/) ! namelist: per tape type1d - - character(len=max_namlen+2), public :: & - fincl(max_flds,max_tapes) ! namelist-equivalence list of fields to add - - character(len=max_namlen+2), public :: & - hist_fincl1(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl2(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl3(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl4(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl5(max_flds) = ' ' ! namelist: list of fields to add - character(len=max_namlen+2), public :: & - hist_fincl6(max_flds) = ' ' ! namelist: list of fields to add - - character(len=max_namlen+2), public :: & - fexcl(max_flds,max_tapes) ! namelist-equivalence list of fields to remove - - character(len=max_namlen+2), public :: & - hist_fexcl1(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl2(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl3(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl4(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl5(max_flds) = ' ' ! namelist: list of fields to remove - character(len=max_namlen+2), public :: & - hist_fexcl6(max_flds) = ' ' ! namelist: list of fields to remove -! -! Restart -! - logical, private :: if_disphist(max_tapes) ! true => save history file -! -! !PUBLIC MEMBER FUNCTIONS: - public :: hist_addfld1d ! Add a 1d single-level field to the master field list - public :: hist_addfld2d ! Add a 2d multi-level field to the master field list - public :: hist_add_subscript ! Add a 2d subscript dimension - public :: hist_printflds ! Print summary of master field list - public :: hist_htapes_build ! Initialize history file handler for initial or continue run - public :: hist_update_hbuf ! Updates history buffer for all fields and tapes - public :: hist_htapes_wrapup ! Write history tape(s) - public :: hist_restart_ncd ! Read/write history file restart data - public :: htapes_fieldlist ! Define the contents of each history file based on namelist -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !PRIVATE MEMBER FUNCTIONS: - private :: masterlist_make_active ! Add a field to a history file default "on" list - private :: masterlist_addfld ! Add a field to the master field list - private :: masterlist_change_timeavg ! Override default history tape contents for specific tape - private :: htape_addfld ! Add a field to the active list for a history tape - private :: htape_create ! Define contents of history file t - private :: htape_timeconst ! Write time constant values to history tape - private :: htape_timeconst3D ! Write time constant 3D values to primary history tape - private :: hfields_normalize ! Normalize history file fields by number of accumulations - private :: hfields_zero ! Zero out accumulation and hsitory buffers for a tape - private :: hfields_write ! Write a variable to a history tape - private :: hfields_1dinfo ! Define/output 1d subgrid info if appropriate - private :: hist_update_hbuf_field_1d ! Updates history buffer for specific field and tape - private :: hist_update_hbuf_field_2d ! Updates history buffer for specific field and tape - private :: list_index ! Find index of field in exclude list - private :: set_hist_filename ! Determine history dataset filenames - private :: getname ! Retrieve name portion of input "inname" - private :: getflag ! Retrieve flag - private :: pointer_index ! Track data pointer indices - private :: max_nFields ! The max number of fields on any tape - -! !PRIVATE TYPES: -! Constants -! - integer, parameter :: max_chars = 128 ! max chars for char variables -! -! Subscript dimensions -! - integer, parameter :: max_subs = 100 ! max number of subscripts - integer :: num_subs = 0 ! actual number of subscripts - character(len=32) :: subs_name(max_subs) ! name of subscript - integer :: subs_dim(max_subs) ! dimension of subscript -! -! Derived types -! - type field_info - character(len=max_namlen) :: name ! field name - character(len=max_chars) :: long_name ! long name - character(len=max_chars) :: units ! units - character(len=8) :: type1d ! clm pointer first dimension type - ! from clmtype (nameg, etc) - character(len=8) :: type1d_out ! hbuf first dimension type - ! from clmtype (nameg, etc) - character(len=8) :: type2d ! hbuf second dimension type - ! ["levgrnd","levlak","numrad","glc_nec","subname(n)"] - integer :: beg1d ! on-node 1d clm pointer start index - integer :: end1d ! on-node 1d clm pointer end index - integer :: num1d ! size of clm pointer first dimension (all nodes) - integer :: beg1d_out ! on-node 1d hbuf pointer start index - integer :: end1d_out ! on-node 1d hbuf pointer end index - integer :: num1d_out ! size of hbuf first dimension (all nodes) - integer :: num2d ! size of hbuf second dimension (e.g. number of vertical levels) - integer :: hpindex ! history pointer index - character(len=8) :: p2c_scale_type ! scale factor when averaging pft to column - character(len=8) :: c2l_scale_type ! scale factor when averaging column to landunit - character(len=8) :: l2g_scale_type ! scale factor when averaging landunit to gridcell - end type field_info - - type master_entry - type (field_info) :: field ! field information - logical :: actflag(max_tapes) ! active/inactive flag - character(len=1) :: avgflag(max_tapes) ! time averaging flag ("X","A","M" or "I",) - end type master_entry - - type history_entry - type (field_info) :: field ! field information - character(len=1) :: avgflag ! time averaging flag - real(r8), pointer :: hbuf(:,:) ! history buffer (dimensions: dim1d x num2d) - integer , pointer :: nacs(:,:) ! accumulation counter (dimensions: dim1d x num2d) - end type history_entry - - type history_tape - integer :: nflds ! number of active fields on tape - integer :: ntimes ! current number of time samples on tape - integer :: mfilt ! maximum number of time samples per tape - integer :: nhtfrq ! number of time samples per tape - integer :: ncprec ! netcdf output precision - logical :: dov2xy ! true => do xy average for all fields - logical :: is_endhist ! true => current time step is end of history interval - real(r8) :: begtime ! time at beginning of history averaging interval - type (history_entry) :: hlist(max_flds) ! array of active history tape entries - end type history_tape - - type clmpoint_rs ! Pointer to real scalar data (1D) - real(r8), pointer :: ptr(:) - end type clmpoint_rs - type clmpoint_ra ! Pointer to real array data (2D) - real(r8), pointer :: ptr(:,:) - end type clmpoint_ra -!EOP -! -! Pointers into clmtype arrays -! - integer, parameter :: max_mapflds = 1500 ! Maximum number of fields to track - type (clmpoint_rs) :: clmptr_rs(max_mapflds) ! Real scalar data (1D) - type (clmpoint_ra) :: clmptr_ra(max_mapflds) ! Real array data (2D) -! -! Master list: an array of master_entry entities -! - type (master_entry) :: masterlist(max_flds) ! master field list -! -! History tape: an array of history_tape entities (only active fields) -! - type (history_tape) :: tape(max_tapes) ! array history tapes -! -! Namelist input -! -! Counters -! - integer :: nfmaster = 0 ! number of fields in master field list -! -! Other variables -! - character(len=max_chars) :: locfnh(max_tapes) ! local history file names - character(len=max_chars) :: locfnhr(max_tapes) ! local history restart file names - logical :: htapes_defined = .false. ! flag indicates history contents have been defined -! -! NetCDF Id's -! - type(file_desc_t) :: nfid(max_tapes) ! file ids - type(file_desc_t) :: ncid_hist(max_tapes) ! file ids for history restart files - integer :: time_dimid ! time dimension id - integer :: hist_interval_dimid ! time bounds dimension id - integer :: strlen_dimid ! string dimension id - -! -! Time Constant variable names and filename -! - character(len=max_chars) :: TimeConst3DVars_Filename = ' ' - character(len=max_chars) :: TimeConst3DVars = ' ' -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_printflds -! -! !INTERFACE: - subroutine hist_printflds() -! -! !DESCRIPTION: -! Print summary of master field list. -! -! !USES: -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 03/2003 -! -! -! !LOCAL VARIABLES: -!EOP - integer nf - character(len=*),parameter :: subname = 'CLM_hist_printflds' -!----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) trim(subname),' : number of master fields = ',nfmaster - write(iulog,*)' ******* MASTER FIELD LIST *******' - do nf = 1,nfmaster - write(iulog,9000)nf, masterlist(nf)%field%name, masterlist(nf)%field%units -9000 format (i5,1x,a32,1x,a16) - end do - call shr_sys_flush(iulog) - end if - - end subroutine hist_printflds - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: masterlist_addfld -! -! !INTERFACE: - subroutine masterlist_addfld (fname, type1d, type1d_out, & - type2d, num2d, units, avgflag, long_name, hpindex, & - p2c_scale_type, c2l_scale_type, l2g_scale_type) -! -! !DESCRIPTION: -! Add a field to the master field list. Put input arguments of -! field name, units, number of levels, averaging flag, and long name -! into a type entry in the global master field list (masterlist). -! -! !USES: -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type1d ! 1d data type - character(len=*), intent(in) :: type1d_out ! 1d output type - character(len=*), intent(in) :: type2d ! 2d output type - integer , intent(in) :: num2d ! size of second dimension (e.g. number of vertical levels) - character(len=*), intent(in) :: units ! units of field - character(len=1), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - integer , intent(in) :: hpindex ! clmtype index for history buffer output - character(len=*), intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n ! loop index - integer :: f ! masterlist index - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: numa ! total number of atm cells across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - character(len=*),parameter :: subname = 'masterlist_addfld' -!------------------------------------------------------------------------ - - ! Determine bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - call get_proc_global(numg, numl, numc, nump) - ! Ensure that new field is not all blanks - - if (fname == ' ') then - write(iulog,*) trim(subname),' ERROR: blank field name not allowed' - call endrun() - end if - - ! Ensure that new field doesn't already exist - - do n = 1,nfmaster - if (masterlist(n)%field%name == fname) then - write(iulog,*) trim(subname),' ERROR:', fname, ' already on list' - call endrun() - end if - end do - - ! Increase number of fields on master field list - - nfmaster = nfmaster + 1 - f = nfmaster - - ! Check number of fields in master list against maximum number for master list - - if (nfmaster > max_flds) then - write(iulog,*) trim(subname),' ERROR: too many fields for primary history file ', & - '-- max_flds,nfmaster=', max_flds, nfmaster - call endrun() - end if - - ! Add field to master list - - masterlist(f)%field%name = fname - masterlist(f)%field%long_name = long_name - masterlist(f)%field%units = units - masterlist(f)%field%type1d = type1d - masterlist(f)%field%type1d_out = type1d_out - masterlist(f)%field%type2d = type2d - masterlist(f)%field%num2d = num2d - masterlist(f)%field%hpindex = hpindex - masterlist(f)%field%p2c_scale_type = p2c_scale_type - masterlist(f)%field%c2l_scale_type = c2l_scale_type - masterlist(f)%field%l2g_scale_type = l2g_scale_type - - select case (type1d) - case (grlnd) - masterlist(f)%field%beg1d = begg - masterlist(f)%field%end1d = endg - masterlist(f)%field%num1d = numg - case (nameg) - masterlist(f)%field%beg1d = begg - masterlist(f)%field%end1d = endg - masterlist(f)%field%num1d = numg - case (namel) - masterlist(f)%field%beg1d = begl - masterlist(f)%field%end1d = endl - masterlist(f)%field%num1d = numl - case (namec) - masterlist(f)%field%beg1d = begc - masterlist(f)%field%end1d = endc - masterlist(f)%field%num1d = numc - case (namep) - masterlist(f)%field%beg1d = begp - masterlist(f)%field%end1d = endp - masterlist(f)%field%num1d = nump - case default - write(iulog,*) trim(subname),' ERROR: unknown 1d output type= ',type1d - call endrun() - end select - - ! The following two fields are used only in master field list, - ! NOT in the runtime active field list - ! ALL FIELDS IN THE MASTER LIST ARE INITIALIZED WITH THE ACTIVE - ! FLAG SET TO FALSE - - masterlist(f)%avgflag(:) = avgflag - masterlist(f)%actflag(:) = .false. - - end subroutine masterlist_addfld - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_htapes_build -! -! !INTERFACE: - subroutine hist_htapes_build () -! -! !DESCRIPTION: -! Initialize history file for initial or continuation run. For example, -! on an initial run, this routine initializes ``ntapes'' history files. -! On a restart run, this routine only initializes history files declared -! beyond what existed on the previous run. Files which already existed on -! the previous run have already been initialized (i.e. named and opened) -! in routine restart\_history. Loop over tapes and fields per tape setting -! appropriate variables and calling appropriate routines -! -! !USES: - use clm_time_manager, only: get_prev_time - use clm_varcon , only: secspday -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i ! index - integer :: ier ! error code - integer :: t, f ! tape, field indices - integer :: day, sec ! day and seconds from base date - character(len=*),parameter :: subname = 'hist_htapes_build' -!----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) trim(subname),' Initializing clm2 history files' - write(iulog,'(72a1)') ("-",i=1,60) - call shr_sys_flush(iulog) - endif - - ! Define field list information for all history files. - ! Update ntapes to reflect number of active history files - ! Note - branch runs can have additional auxiliary history files - ! declared). - - call htapes_fieldlist() - - ! Determine if gridcell (xy) averaging is done for all fields on tape - - do t=1,ntapes - tape(t)%dov2xy = hist_dov2xy(t) - write(iulog,*)trim(subname),' hist tape = ',t,& - ' written with dov2xy= ',tape(t)%dov2xy - end do - - ! Set number of time samples in each history file and - ! Note - the following entries will be overwritten by history restart - ! Note - with netcdf, only 1 (ncd_double) and 2 (ncd_float) are allowed - - do t=1,ntapes - tape(t)%ntimes = 0 - tape(t)%dov2xy = hist_dov2xy(t) - tape(t)%nhtfrq = hist_nhtfrq(t) - tape(t)%mfilt = hist_mfilt(t) - if (hist_ndens(t) == 1) then - tape(t)%ncprec = ncd_double - else - tape(t)%ncprec = ncd_float - endif - end do - - ! Set time of beginning of current averaging interval - ! First etermine elapased time since reference date - - call get_prev_time(day, sec) - do t=1,ntapes - tape(t)%begtime = day + sec/secspday - end do - - if (masterproc) then - write(iulog,*) trim(subname),' Successfully initialized clm2 history files' - write(iulog,'(72a1)') ("-",i=1,60) - call shr_sys_flush(iulog) - endif - - end subroutine hist_htapes_build - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: masterlist_make_active -! -! !INTERFACE: - subroutine masterlist_make_active (name, tape_index, avgflag) -! -! !DESCRIPTION: -! Add a field to the default ``on'' list for a given history file. -! Also change the default time averaging flag if requested. -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name ! field name - integer, intent(in) :: tape_index ! history tape index - character(len=1), intent(in), optional :: avgflag ! time averaging flag -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - logical :: found ! flag indicates field found in masterlist - character(len=*),parameter :: subname = 'masterlist_make_active' -!----------------------------------------------------------------------- - - ! Check validity of input arguments - - if (tape_index > max_tapes) then - write(iulog,*) trim(subname),' ERROR: tape index=', tape_index, ' is too big' - call endrun() - end if - - if (present(avgflag)) then - if ( avgflag /= ' ' .and. & - avgflag /= 'A' .and. avgflag /= 'I' .and. & - avgflag /= 'X' .and. avgflag /= 'M') then - write(iulog,*) trim(subname),' ERROR: unknown averaging flag=', avgflag - call endrun() - endif - end if - - ! Look through master list for input field name. - ! When found, set active flag for that tape to true. - ! Also reset averaging flag if told to use other than default. - - found = .false. - do f = 1,nfmaster - if (trim(name) == trim(masterlist(f)%field%name)) then - masterlist(f)%actflag(tape_index) = .true. - if (present(avgflag)) then - if (avgflag/= ' ') masterlist(f)%avgflag(tape_index) = avgflag - end if - found = .true. - exit - end if - end do - if (.not. found) then - write(iulog,*) trim(subname),' ERROR: field=', name, ' not found' - call endrun() - end if - - end subroutine masterlist_make_active - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: masterlist_change_timeavg -! -! !INTERFACE: - subroutine masterlist_change_timeavg (t) -! -! !DESCRIPTION: -! Override default history tape contents for a specific tape. -! Copy the flag into the master field list. -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! history tape index -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - character(len=1) :: avgflag ! lcl equiv of hist_avgflag_pertape(t) - character(len=*),parameter :: subname = 'masterlist_change_timeavg' -!----------------------------------------------------------------------- - - avgflag = hist_avgflag_pertape(t) - - do f = 1,nfmaster - select case (avgflag) - case ('A') - masterlist(f)%avgflag(t) = avgflag - case ('I') - masterlist(f)%avgflag(t) = avgflag - case ('X') - masterlist(f)%avgflag(t) = avgflag - case ('M') - masterlist(f)%avgflag(t) = avgflag - case default - write(iulog,*) trim(subname),' ERROR: unknown avgflag=',avgflag - call endrun () - end select - end do - - end subroutine masterlist_change_timeavg - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: htapes_fieldlist -! -! !INTERFACE: - subroutine htapes_fieldlist() -! -! !DESCRIPTION: -! Define the contents of each history file based on namelist -! input for initial or branch run, and restart data if a restart run. -! Use arrays fincl and fexcl to modify default history tape contents. -! Then sort the result alphanumerically. -! -! !USES: -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: t, f ! tape, field indices - integer :: ff ! index into include, exclude and fprec list - character(len=max_namlen) :: name ! field name portion of fincl (i.e. no avgflag separator) - character(len=max_namlen) :: mastername ! name from masterlist field - character(len=1) :: avgflag ! averaging flag - character(len=1) :: prec_acc ! history buffer precision flag - character(len=1) :: prec_wrt ! history buffer write precision flag - type (history_entry) :: tmp ! temporary used for swapping - character(len=*),parameter :: subname = 'htapes_fieldlist' -!----------------------------------------------------------------------- - - ! Override averaging flag for all fields on a particular tape - ! if namelist input so specifies - - do t=1,max_tapes - if (hist_avgflag_pertape(t) /= ' ') then - call masterlist_change_timeavg (t) - end if - end do - - fincl(:,1) = hist_fincl1(:) - fincl(:,2) = hist_fincl2(:) - fincl(:,3) = hist_fincl3(:) - fincl(:,4) = hist_fincl4(:) - fincl(:,5) = hist_fincl5(:) - fincl(:,6) = hist_fincl6(:) - - fexcl(:,1) = hist_fexcl1(:) - fexcl(:,2) = hist_fexcl2(:) - fexcl(:,3) = hist_fexcl3(:) - fexcl(:,4) = hist_fexcl4(:) - fexcl(:,5) = hist_fexcl5(:) - fexcl(:,6) = hist_fexcl6(:) - - - ! First ensure contents of fincl and fexcl are valid names - - do t = 1,max_tapes - f = 1 - do while (f < max_flds .and. fincl(f,t) /= ' ') - name = getname (fincl(f,t)) - do ff = 1,nfmaster - mastername = masterlist(ff)%field%name - if (name == mastername) exit - end do - if (name /= mastername) then - write(iulog,*) trim(subname),' ERROR: ', trim(name), ' in fincl(', f, ') ',& - 'for history tape ',t,' not found' - call endrun() - end if - f = f + 1 - end do - - f = 1 - do while (f < max_flds .and. fexcl(f,t) /= ' ') - do ff = 1,nfmaster - mastername = masterlist(ff)%field%name - if (fexcl(f,t) == mastername) exit - end do - if (fexcl(f,t) /= mastername) then - write(iulog,*) trim(subname),' ERROR: ', fexcl(f,t), ' in fexcl(', f, ') ', & - 'for history tape ',t,' not found' - call endrun() - end if - f = f + 1 - end do - end do - - tape(:)%nflds = 0 - do t = 1,max_tapes - - ! Loop through the masterlist set of field names and determine if any of those - ! are in the FINCL or FEXCL arrays - ! The call to list_index determines the index in the FINCL or FEXCL arrays - ! that the masterlist field corresponds to - ! Add the field to the tape if specified via namelist (FINCL[1-max_tapes]), - ! or if it is on by default and was not excluded via namelist (FEXCL[1-max_tapes]). - - do f = 1,nfmaster - mastername = masterlist(f)%field%name - call list_index (fincl(1,t), mastername, ff) - - if (ff > 0) then - - ! if field is in include list, ff > 0 and htape_addfld - ! will not be called for field - - avgflag = getflag (fincl(ff,t)) - call htape_addfld (t, f, avgflag) - - else if (.not. hist_empty_htapes) then - - ! find index of field in exclude list - - call list_index (fexcl(1,t), mastername, ff) - - ! if field is in exclude list, ff > 0 and htape_addfld - ! will not be called for field - ! if field is not in exclude list, ff =0 and htape_addfld - ! will be called for field (note that htape_addfld will be - ! called below only if field is not in exclude list OR in - ! include list - - if (ff == 0 .and. masterlist(f)%actflag(t)) then - call htape_addfld (t, f, ' ') - end if - - end if - end do - - ! Specification of tape contents now complete. - ! Sort each list of active entries - - do f = tape(t)%nflds-1,1,-1 - do ff = 1,f - if (tape(t)%hlist(ff)%field%name > tape(t)%hlist(ff+1)%field%name) then - - tmp = tape(t)%hlist(ff) - tape(t)%hlist(ff ) = tape(t)%hlist(ff+1) - tape(t)%hlist(ff+1) = tmp - - else if (tape(t)%hlist(ff)%field%name == tape(t)%hlist(ff+1)%field%name) then - - write(iulog,*) trim(subname),' ERROR: Duplicate field ', & - tape(t)%hlist(ff)%field%name, & - 't,ff,name=',t,ff,tape(t)%hlist(ff+1)%field%name - call endrun() - - end if - end do - end do - - if (masterproc) then - if (tape(t)%nflds > 0) then - write(iulog,*) trim(subname),' : Included fields tape ',t,'=',tape(t)%nflds - end if - do f = 1,tape(t)%nflds - write(iulog,*) f,' ',tape(t)%hlist(f)%field%name, & - tape(t)%hlist(f)%field%num2d,' ',tape(t)%hlist(f)%avgflag - end do - call shr_sys_flush(iulog) - end if - end do - - ! Determine total number of active history tapes - - ntapes = 0 - do t = max_tapes,1,-1 - if (tape(t)%nflds > 0) then - ntapes = t - exit - end if - end do - - ! Ensure there are no "holes" in tape specification, i.e. empty tapes. - ! Enabling holes should not be difficult if necessary. - - do t = 1,ntapes - if (tape(t)%nflds == 0) then - write(iulog,*) trim(subname),' ERROR: Tape ',t,' is empty' - call endrun() - end if - end do - - ! Check that the number of history files declared does not exceed - ! the maximum allowed. - - if (ntapes > max_tapes) then - write(iulog,*) trim(subname),' ERROR: Too many history files declared, max_tapes=',max_tapes - call endrun() - end if - - ! Change 1d output per tape output flag if requested - only for history - ! tapes where 2d xy averaging is not enabled - - do t = 1,ntapes - if (hist_type1d_pertape(t) /= ' ' .and. (.not. hist_dov2xy(t))) then - select case (trim(hist_type1d_pertape(t))) - case ('PFTS','COLS', 'LAND', 'GRID') - if ( masterproc ) & - write(iulog,*)'history tape ',t,' will have 1d output type of ',hist_type1d_pertape(t) - case default - write(iulog,*) trim(subname),' ERROR: unknown namelist type1d per tape=',hist_type1d_pertape(t) - call endrun() - end select - end if - end do - - if (masterproc) then - write(iulog,*) 'There will be a total of ',ntapes,' history tapes' - do t=1,ntapes - write(iulog,*) - if (hist_nhtfrq(t) == 0) then - write(iulog,*)'History tape ',t,' write frequency is MONTHLY' - else - write(iulog,*)'History tape ',t,' write frequency = ',hist_nhtfrq(t) - endif - if (hist_dov2xy(t)) then - write(iulog,*)'All fields on history tape ',t,' are grid averaged' - else - write(iulog,*)'All fields on history tape ',t,' are not grid averaged' - end if - write(iulog,*)'Number of time samples on history tape ',t,' is ',hist_mfilt(t) - write(iulog,*)'Output precision on history tape ',t,'=',hist_ndens(t) - write(iulog,*) - end do - call shr_sys_flush(iulog) - end if - - ! Set flag indicating h-tape contents are now defined (needed by masterlist_addfld) - - htapes_defined = .true. - - end subroutine htapes_fieldlist - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: htape_addfld -! -! !INTERFACE: - subroutine htape_addfld (t, f, avgflag) -! -! !DESCRIPTION: -! Add a field to the active list for a history tape. Copy the data from -! the master field list to the active list for the tape. -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! history tape index - integer, intent(in) :: f ! field index from master field list - character(len=1), intent(in) :: avgflag ! time averaging flag -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n ! field index on defined tape - character(len=8) :: type1d ! clm pointer 1d type - character(len=8) :: type1d_out ! history buffer 1d type - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: numa ! total number of atm cells across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: num2d ! size of second dimension (e.g. .number of vertical levels) - integer :: beg1d_out,end1d_out ! history output per-proc 1d beginning and ending indices - integer :: num1d_out ! history output 1d size - character(len=*),parameter :: subname = 'htape_addfld' -!----------------------------------------------------------------------- - - ! Ensure that it is not to late to add a field to the history tape - - if (htapes_defined) then - write(iulog,*) trim(subname),' ERROR: attempt to add field ', & - masterlist(f)%field%name, ' after history files are set' - call endrun() - end if - - tape(t)%nflds = tape(t)%nflds + 1 - n = tape(t)%nflds - - ! Copy field information - - tape(t)%hlist(n)%field = masterlist(f)%field - - ! Determine bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - call get_proc_global(numg, numl, numc, nump) - - ! Modify type1d_out if necessary - - if (hist_dov2xy(t)) then - - ! If xy output averaging is requested, set output 1d type to grlnd - ! ***NOTE- the following logic is what permits non lat/lon grids to - ! be written to clm history file - - type1d = tape(t)%hlist(n)%field%type1d - - if (type1d == nameg .or. & - type1d == namel .or. & - type1d == namec .or. & - type1d == namep) then - tape(t)%hlist(n)%field%type1d_out = grlnd - end if - if (type1d == grlnd) then - tape(t)%hlist(n)%field%type1d_out = grlnd - end if - - else if (hist_type1d_pertape(t) /= ' ') then - - ! Set output 1d type based on namelist setting of hist_type1d_pertape - ! Only applies to tapes when xy output is not required - - type1d = tape(t)%hlist(n)%field%type1d - - select case (trim(hist_type1d_pertape(t))) - case('GRID') - tape(t)%hlist(n)%field%type1d_out = nameg - case('LAND') - tape(t)%hlist(n)%field%type1d_out = namel - case('COLS') - tape(t)%hlist(n)%field%type1d_out = namec - case ('PFTS') - tape(t)%hlist(n)%field%type1d_out = namep - case default - write(iulog,*) trim(subname),' ERROR: unknown input hist_type1d_pertape= ', hist_type1d_pertape(t) - call endrun() - end select - - endif - - ! Determine output 1d dimensions - - type1d_out = tape(t)%hlist(n)%field%type1d_out - if (type1d_out == grlnd) then - beg1d_out = begg - end1d_out = endg - num1d_out = numg - else if (type1d_out == nameg) then - beg1d_out = begg - end1d_out = endg - num1d_out = numg - else if (type1d_out == namel) then - beg1d_out = begl - end1d_out = endl - num1d_out = numl - else if (type1d_out == namec) then - beg1d_out = begc - end1d_out = endc - num1d_out = numc - else if (type1d_out == namep) then - beg1d_out = begp - end1d_out = endp - num1d_out = nump - else - write(iulog,*) trim(subname),' ERROR: incorrect value of type1d_out= ',type1d_out - call endrun() - end if - - tape(t)%hlist(n)%field%beg1d_out = beg1d_out - tape(t)%hlist(n)%field%end1d_out = end1d_out - tape(t)%hlist(n)%field%num1d_out = num1d_out - - ! Alloccate and initialize history buffer and related info - - num2d = tape(t)%hlist(n)%field%num2d - allocate (tape(t)%hlist(n)%hbuf(beg1d_out:end1d_out,num2d)) - allocate (tape(t)%hlist(n)%nacs(beg1d_out:end1d_out,num2d)) - tape(t)%hlist(n)%hbuf(:,:) = 0._r8 - tape(t)%hlist(n)%nacs(:,:) = 0 - - ! Set time averaging flag based on masterlist setting or - ! override the default averaging flag with namelist setting - - select case (avgflag) - case (' ') - tape(t)%hlist(n)%avgflag = masterlist(f)%avgflag(t) - case ('A','I','X','M') - tape(t)%hlist(n)%avgflag = avgflag - case default - write(iulog,*) trim(subname),' ERROR: unknown avgflag=', avgflag - call endrun() - end select - - end subroutine htape_addfld - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_update_hbuf -! -! !INTERFACE: - subroutine hist_update_hbuf() -! -! !DESCRIPTION: -! Accumulate (or take min, max, etc. as appropriate) input field -! into its history buffer for appropriate tapes. -! -! !USES: -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: t ! tape index - integer :: f ! field index - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: num2d ! size of second dimension (e.g. number of vertical levels) - character(len=*),parameter :: subname = 'hist_update_hbuf' -!----------------------------------------------------------------------- - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - do t = 1,ntapes -!$OMP PARALLEL DO PRIVATE (f, num2d) - do f = 1,tape(t)%nflds - num2d = tape(t)%hlist(f)%field%num2d - if ( num2d == 1) then - call hist_update_hbuf_field_1d (t, f, begp, endp, begc, endc, begl, endl, begg, endg) - else - call hist_update_hbuf_field_2d (t, f, begp, endp, begc, endc, begl, endl, begg, endg, num2d) - end if - end do -!$OMP END PARALLEL DO - end do - - end subroutine hist_update_hbuf - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_update_hbuf_field_1d -! -! !INTERFACE: - subroutine hist_update_hbuf_field_1d (t, f, begp, endp, begc, endc, begl, endl, begg, endg) -! -! !DESCRIPTION: -! Accumulate (or take min, max, etc. as appropriate) input field -! into its history buffer for appropriate tapes. -! -! !USES: - use clmtype - use subgridAveMod, only : p2g, c2g, l2g - use clm_varcon , only : istice_mec -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - integer, intent(in) :: f ! field index - integer, intent(in) :: begp, endp ! per-proc beginning and ending pft indices - integer, intent(in) :: begc, endc ! per-proc beginning and ending column indices - integer, intent(in) :: begl, endl ! per-proc beginning and ending landunit indices - integer, intent(in) :: begg, endg ! per-proc gridcell ending gridcell indices -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: hpindex ! history pointer index - integer :: k ! gridcell, landunit, column or pft index - integer :: l ! landunit index - integer :: beg1d,end1d ! beginning and ending indices - logical :: checkwt ! true => check weight of pft relative to gridcell - logical :: valid ! true => history operation is valid - logical :: map2gcell ! true => map clm pointer field to gridcell - character(len=8) :: type1d ! 1d clm pointerr type ["gridcell","landunit","column","pft"] - character(len=8) :: type1d_out ! 1d history buffer type ["gridcell","landunit","column","pft"] - character(len=1) :: avgflag ! time averaging flag - character(len=8) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=8) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=8) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - real(r8), pointer :: hbuf(:,:) ! history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: plandunit(:) ! pft's landunit index - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: field(:) ! clm 1d pointer field - real(r8) :: field_gcell(begg:endg) ! gricell level field (used if mapping to gridcell is done) - integer j - character(len=*),parameter :: subname = 'hist_update_hbuf_field_1d' -!----------------------------------------------------------------------- - - avgflag = tape(t)%hlist(f)%avgflag - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - type1d = tape(t)%hlist(f)%field%type1d - type1d_out = tape(t)%hlist(f)%field%type1d_out - p2c_scale_type = tape(t)%hlist(f)%field%p2c_scale_type - c2l_scale_type = tape(t)%hlist(f)%field%c2l_scale_type - l2g_scale_type = tape(t)%hlist(f)%field%l2g_scale_type - hpindex = tape(t)%hlist(f)%field%hpindex - field => clmptr_rs(hpindex)%ptr - - ! set variables to check weights when allocate all pfts - - map2gcell = .false. - if (type1d_out == nameg .or. type1d_out == grlnd) then - if (type1d == namep) then - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, field, field_gcell, & - p2c_scale_type, c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namec) then - call c2g(begc, endc, begl, endl, begg, endg, field, field_gcell, & - c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namel) then - call l2g(begl, endl, begg, endg, field, field_gcell, & - l2g_scale_type) - map2gcell = .true. - end if - end if - - if (map2gcell) then ! Map to gridcell - - ! note that in this case beg1d = begg and end1d=endg - select case (avgflag) - case ('I') ! Instantaneous - do k = begg,endg - if (field_gcell(k) /= spval) then - hbuf(k,1) = field_gcell(k) - else - hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case ('A') ! Time average - do k = begg,endg - if (field_gcell(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = 0._r8 - hbuf(k,1) = hbuf(k,1) + field_gcell(k) - nacs(k,1) = nacs(k,1) + 1 - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - end do - case ('X') ! Maximum over time - do k = begg,endg - if (field_gcell(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = -1.e50_r8 - hbuf(k,1) = max( hbuf(k,1), field_gcell(k) ) - else - hbuf(k,1) = spval - endif - nacs(k,1) = 1 - end do - case ('M') ! Minimum over time - do k = begg,endg - if (field_gcell(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = +1.e50_r8 - hbuf(k,1) = min( hbuf(k,1), field_gcell(k) ) - else - hbuf(k,1) = spval - endif - nacs(k,1) = 1 - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun() - end select - - else ! Do not map to gridcell - - pwtgcell => pft%wtgcell - plandunit => pft%landunit - ltype => lun%itype - - checkwt = .false. - if (type1d == namep) checkwt = .true. - - select case (avgflag) - case ('I') ! Instantaneous - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - ! Note: some glacier_mec pfts may have zero weight and still be considered valid - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - hbuf(k,1) = field(k) - else - hbuf(k,1) = spval - end if - else - hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case ('A') ! Time average - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = 0._r8 - hbuf(k,1) = hbuf(k,1) + field(k) - nacs(k,1) = nacs(k,1) + 1 - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - end do - case ('X') ! Maximum over time - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = -1.e50_r8 - hbuf(k,1) = max( hbuf(k,1), field(k) ) - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case ('M') ! Minimum over time - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k) /= spval) then - if (nacs(k,1) == 0) hbuf(k,1) = +1.e50_r8 - hbuf(k,1) = min( hbuf(k,1), field(k) ) - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - else - if (nacs(k,1) == 0) hbuf(k,1) = spval - end if - nacs(k,1) = 1 - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun() - end select - end if - - end subroutine hist_update_hbuf_field_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_update_hbuf_field_2d -! -! !INTERFACE: - subroutine hist_update_hbuf_field_2d (t, f, begp, endp, begc, endc, begl, endl, begg, endg, num2d) -! -! !DESCRIPTION: -! Accumulate (or take min, max, etc. as appropriate) input field -! into its history buffer for appropriate tapes. -! -! !USES: - use clmtype - use subgridAveMod, only : p2g, c2g, l2g - use clm_varcon , only : istice_mec -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - integer, intent(in) :: f ! field index - integer, intent(in) :: begp, endp ! per-proc beginning and ending pft indices - integer, intent(in) :: begc, endc ! per-proc beginning and ending column indices - integer, intent(in) :: begl, endl ! per-proc beginning and ending landunit indices - integer, intent(in) :: begg, endg ! per-proc gridcell ending gridcell indices - integer, intent(in) :: num2d ! size of second dimension -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: hpindex ! history pointer index - integer :: k ! gridcell, landunit, column or pft index - integer :: l ! landunit index - integer :: j ! level index - integer :: beg1d,end1d ! beginning and ending indices - logical :: checkwt ! true => check weight of pft relative to gridcell - logical :: valid ! true => history operation is valid - logical :: map2gcell ! true => map clm pointer field to gridcell - character(len=8) :: type1d ! 1d clm pointerr type ["gridcell","landunit","column","pft"] - character(len=8) :: type1d_out ! 1d history buffer type ["gridcell","landunit","column","pft"] - character(len=1) :: avgflag ! time averaging flag - character(len=8) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=8) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=8) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - real(r8), pointer :: hbuf(:,:) ! history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - integer , pointer :: ltype(:) ! landunit type - integer , pointer :: plandunit(:) ! pft's landunit index - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: field(:,:) ! clm 2d pointer field - real(r8) :: field_gcell(begg:endg,num2d) ! gricell level field (used if mapping to gridcell is done) - character(len=*),parameter :: subname = 'hist_update_hbuf_field_2d' -!----------------------------------------------------------------------- - - avgflag = tape(t)%hlist(f)%avgflag - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - beg1d = tape(t)%hlist(f)%field%beg1d - end1d = tape(t)%hlist(f)%field%end1d - type1d = tape(t)%hlist(f)%field%type1d - type1d_out = tape(t)%hlist(f)%field%type1d_out - p2c_scale_type = tape(t)%hlist(f)%field%p2c_scale_type - c2l_scale_type = tape(t)%hlist(f)%field%c2l_scale_type - l2g_scale_type = tape(t)%hlist(f)%field%l2g_scale_type - hpindex = tape(t)%hlist(f)%field%hpindex - field => clmptr_ra(hpindex)%ptr(:,1:num2d) - - ! set variables to check weights when allocate all pfts - - map2gcell = .false. - if (type1d_out == nameg .or. type1d_out == grlnd) then - if (type1d == namep) then - call p2g(begp, endp, begc, endc, begl, endl, begg, endg, num2d, field, field_gcell, & - p2c_scale_type, c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namec) then - call c2g(begc, endc, begl, endl, begg, endg, num2d, field, field_gcell, & - c2l_scale_type, l2g_scale_type) - map2gcell = .true. - else if (type1d == namel) then - call l2g(begl, endl, begg, endg, num2d, field, field_gcell, & - l2g_scale_type) - map2gcell = .true. - end if - end if - - if (map2gcell) then ! Map to gridcell - - ! note that in this case beg1d = begg and end1d=endg - select case (avgflag) - case ('I') ! Instantaneous - do j = 1,num2d - do k = begg,endg - if (field_gcell(k,j) /= spval) then - hbuf(k,j) = field_gcell(k,j) - else - hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case ('A') ! Time average - do j = 1,num2d - do k = begg,endg - if (field_gcell(k,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = 0._r8 - hbuf(k,j) = hbuf(k,j) + field_gcell(k,j) - nacs(k,j) = nacs(k,j) + 1 - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - endif - end do - end do - case ('X') ! Maximum over time - do j = 1,num2d - do k = begg,endg - if (field_gcell(k,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = -1.e50_r8 - hbuf(k,j) = max( hbuf(k,j), field_gcell(k,j) ) - else - hbuf(k,j) = spval - endif - nacs(k,j) = 1 - end do - end do - case ('M') ! Minimum over time - do j = 1,num2d - do k = begg,endg - if (field_gcell(k,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = +1.e50_r8 - hbuf(k,j) = min( hbuf(k,j), field_gcell(k,j) ) - else - hbuf(k,j) = spval - endif - nacs(k,j) = 1 - end do - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun() - end select - - else ! Do not map to gridcell - - ! Note that since field points to an array section the - ! bounds are field(1:end1d-beg1d+1, num2d) - therefore - ! need to do the shifting below - - pwtgcell => pft%wtgcell - plandunit => pft%landunit - ltype => lun%itype - - checkwt = .false. - if (type1d == namep) checkwt = .true. - - select case (avgflag) - case ('I') ! Instantaneous - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - hbuf(k,j) = field(k-beg1d+1,j) - else - hbuf(k,j) = spval - end if - else - hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case ('A') ! Time average - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = 0._r8 - hbuf(k,j) = hbuf(k,j) + field(k-beg1d+1,j) - nacs(k,j) = nacs(k,j) + 1 - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - end do - end do - case ('X') ! Maximum over time - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = -1.e50_r8 - hbuf(k,j) = max( hbuf(k,j), field(k-beg1d+1,j) ) - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case ('M') ! Minimum over time - do j = 1,num2d - do k = beg1d,end1d - valid = .true. - if (checkwt) then - l = plandunit(k) - if (pwtgcell(k) == 0._r8 .and. ltype(l)/=istice_mec) valid = .false. - end if - if (valid) then - if (field(k-beg1d+1,j) /= spval) then - if (nacs(k,j) == 0) hbuf(k,j) = +1.e50_r8 - hbuf(k,j) = min( hbuf(k,j), field(k-beg1d+1,j)) - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - else - if (nacs(k,j) == 0) hbuf(k,j) = spval - end if - nacs(k,j) = 1 - end do - end do - case default - write(iulog,*) trim(subname),' ERROR: invalid time averaging flag ', avgflag - call endrun() - end select - end if - - end subroutine hist_update_hbuf_field_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hfields_normalize -! -! !INTERFACE: - subroutine hfields_normalize (t) -! -! !DESCRIPTION: -! Normalize fields on a history file by the number of accumulations. -! Loop over fields on the tape. Need averaging flag and number of -! accumulations to perform normalization. -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - integer :: k ! 1d index - integer :: j ! 2d index - logical :: aflag ! averaging flag - integer :: beg1d_out,end1d_out ! hbuf 1d beginning and ending indices - integer :: num2d ! hbuf size of second dimension (e.g. number of vertical levels) - character(len=1) :: avgflag ! averaging flag - real(r8), pointer :: hbuf(:,:) ! history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - character(len=*),parameter :: subname = 'hfields_normalize' -!----------------------------------------------------------------------- -!dir$ inlinenever hfields_normalize - - ! Normalize by number of accumulations for time averaged case - - do f = 1,tape(t)%nflds - avgflag = tape(t)%hlist(f)%avgflag - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - num2d = tape(t)%hlist(f)%field%num2d - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (avgflag == 'A') then - aflag = .true. - else - aflag = .false. - end if - - do j = 1, num2d - do k = beg1d_out, end1d_out - if (aflag .and. nacs(k,j) /= 0) then - hbuf(k,j) = hbuf(k,j) / float(nacs(k,j)) - end if - end do - end do - end do - - end subroutine hfields_normalize - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hfields_zero -! -! !INTERFACE: - subroutine hfields_zero (t) -! -! !DESCRIPTION: -! Zero out accumulation and history buffers for a given history tape. -! Loop through fields on the tape. -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - character(len=*),parameter :: subname = 'hfields_zero' -!----------------------------------------------------------------------- - - do f = 1,tape(t)%nflds - tape(t)%hlist(f)%hbuf(:,:) = 0._r8 - tape(t)%hlist(f)%nacs(:,:) = 0 - end do - - end subroutine hfields_zero - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: htape_create -! -! !INTERFACE: - subroutine htape_create (t, histrest) -! -! !DESCRIPTION: -! Define contents of history file t. Issue the required netcdf -! wrapper calls to define the history file contents. -! -! !USES: - use clmtype - use clm_varpar , only : nlevgrnd, nlevlak, numrad, maxpatch_glcmec - use clm_varctl , only : caseid, ctitle, fsurdat, finidat, fpftcon, & - version, hostname, username, conventions, source - use domainMod , only : ldomain - use fileutils , only : get_filename -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - logical, intent(in), optional :: histrest ! if creating the history restart file -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - integer :: p,c,l,n ! indices - integer :: ier ! error code - integer :: num2d ! size of second dimension (e.g. number of vertical levels) - integer :: dimid ! dimension id temporary - integer :: dim1id(1) ! netCDF dimension id - integer :: dim2id(2) ! netCDF dimension id - integer :: ndims ! dimension counter - integer :: omode ! returned mode from netCDF call - integer :: ncprec ! output netCDF write precision - integer :: ret ! netCDF error status - integer :: nump ! total number of pfts across all processors - integer :: numc ! total number of columns across all processors - integer :: numl ! total number of landunits across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numa ! total number of atm cells across all processors - logical :: avoid_pnetcdf ! whether we should avoid using pnetcdf - logical :: lhistrest ! local history restart flag - type(file_desc_t) :: lnfid ! local file id - character(len= 8) :: curdate ! current date - character(len= 8) :: curtime ! current time - character(len=256) :: name ! name of attribute - character(len=256) :: units ! units of attribute - character(len=256) :: str ! global attribute string - character(len= 1) :: avgflag ! time averaging flag - character(len=*),parameter :: subname = 'htape_create' -!----------------------------------------------------------------------- - - if ( present(histrest) )then - lhistrest = histrest - else - lhistrest = .false. - end if - - ! Determine necessary indices - - call get_proc_global(numg, numl, numc, nump) - - ! define output write precsion for tape - - ncprec = tape(t)%ncprec - - ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for - ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 - ! - 1-d hist files have problems with pnetcdf. A better workaround in terms of - ! performance is to keep pnetcdf, but set PIO_BUFFER_SIZE_LIMIT=0, but that can't be - ! done on a per-file basis. - if (.not. tape(t)%dov2xy) then - avoid_pnetcdf = .true. - else - avoid_pnetcdf = .false. - end if - - ! Create new netCDF file. It will be in define mode - - if ( .not. lhistrest )then - if (masterproc) then - write(iulog,*) trim(subname),' : Opening netcdf htape ', & - trim(locfnh(t)) - call shr_sys_flush(iulog) - end if - call ncd_pio_createfile(lnfid, trim(locfnh(t)), avoid_pnetcdf=avoid_pnetcdf) - call ncd_putatt(lnfid, ncd_global, 'title', 'CLM History file information' ) - call ncd_putatt(lnfid, ncd_global, 'comment', & - "NOTE: None of the variables are weighted by land fraction!" ) - else - if (masterproc) then - write(iulog,*) trim(subname),' : Opening netcdf rhtape ', & - trim(locfnhr(t)) - call shr_sys_flush(iulog) - end if - call ncd_pio_createfile(lnfid, trim(locfnhr(t)), avoid_pnetcdf=avoid_pnetcdf) - call ncd_putatt(lnfid, ncd_global, 'title', & - 'CLM Restart History information, required to continue a simulation' ) - call ncd_putatt(lnfid, ncd_global, 'comment', & - "This entire file NOT needed for startup or branch simulations") - end if - - ! Create global attributes. Attributes are used to store information - ! about the data set. Global attributes are information about the - ! data set as a whole, as opposed to a single variable - - call ncd_putatt(lnfid, ncd_global, 'Conventions', trim(conventions)) - call getdatetime(curdate, curtime) - str = 'created on ' // curdate // ' ' // curtime - call ncd_putatt(lnfid, ncd_global, 'history' , trim(str)) - call ncd_putatt(lnfid, ncd_global, 'source' , trim(source)) - call ncd_putatt(lnfid, ncd_global, 'hostname', trim(hostname)) - call ncd_putatt(lnfid, ncd_global, 'username', trim(username)) - call ncd_putatt(lnfid, ncd_global, 'version' , trim(version)) - - str = & - '$Id$' - call ncd_putatt(lnfid, ncd_global, 'revision_id', trim(str)) - call ncd_putatt(lnfid, ncd_global, 'case_title', trim(ctitle)) - call ncd_putatt(lnfid, ncd_global, 'case_id', trim(caseid)) - str = get_filename(fsurdat) - call ncd_putatt(lnfid, ncd_global, 'Surface_dataset', trim(str)) - if (finidat == ' ') then - str = 'arbitrary initialization' - else - str = get_filename(finidat) - endif - call ncd_putatt(lnfid, ncd_global, 'Initial_conditions_dataset', trim(str)) - str = get_filename(fpftcon) - call ncd_putatt(lnfid, ncd_global, 'PFT_physiological_constants_dataset', trim(str)) - - ! Define dimensions. - ! Time is an unlimited dimension. Character string is treated as an array of characters. - - ! Global uncompressed dimensions (including non-land points) - if (ldomain%isgrid2d) then - call ncd_defdim(lnfid, 'lon' , ldomain%ni, dimid) - call ncd_defdim(lnfid, 'lat' , ldomain%nj, dimid) - else - call ncd_defdim(lnfid, trim(grlnd), ldomain%ns, dimid) - end if - - ! Global compressed dimensions (not including non-land points) - call ncd_defdim(lnfid, trim(nameg), numg, dimid) - call ncd_defdim(lnfid, trim(namel), numl, dimid) - call ncd_defdim(lnfid, trim(namec), numc, dimid) - call ncd_defdim(lnfid, trim(namep), nump, dimid) - - ! "level" dimensions - call ncd_defdim(lnfid, 'levgrnd', nlevgrnd, dimid) - call ncd_defdim(lnfid, 'levlak' , nlevlak, dimid) - call ncd_defdim(lnfid, 'numrad' , numrad , dimid) - if (maxpatch_glcmec > 0) then - call ncd_defdim(lnfid, 'glc_nec' , maxpatch_glcmec , dimid) - end if - - do n = 1,num_subs - call ncd_defdim(lnfid, subs_name(n), subs_dim(n), dimid) - end do - call ncd_defdim(lnfid, 'string_length', 8, strlen_dimid) - - if ( .not. lhistrest )then - call ncd_defdim(lnfid, 'hist_interval', 2, hist_interval_dimid) - call ncd_defdim(lnfid, 'time', ncd_unlimited, time_dimid) - nfid(t) = lnfid - if (masterproc)then - write(iulog,*) trim(subname), & - ' : Successfully defined netcdf history file ',t - call shr_sys_flush(iulog) - end if - else - ncid_hist(t) = lnfid - if (masterproc)then - write(iulog,*) trim(subname), & - ' : Successfully defined netcdf restart history file ',t - call shr_sys_flush(iulog) - end if - end if - - end subroutine htape_create - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: htape_timeconst3D -! -! !INTERFACE: - subroutine htape_timeconst3D(t, mode) -! -! !DESCRIPTION: -! Write time constant 3D variables to history tapes. -! Only write out when this subroutine is called (normally only for -! primary history files at very first time-step, nstep=0). -! Issue the required netcdf wrapper calls to define the history file -! contents. -! -! !USES: - use clmtype - use subgridAveMod , only : c2g - use clm_varpar , only : nlevgrnd - use shr_string_mod, only : shr_string_listAppend - use domainMod , only : ldomain -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - character(len=*), intent(in) :: mode ! 'define' or 'write' -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: c,l,lev,ifld ! indices - integer :: ier ! error status - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - character(len=max_chars) :: long_name ! variable long name - character(len=max_namlen):: varname ! variable name - character(len=max_namlen):: units ! variable units - character(len=8) :: l2g_scale_type ! scale type for subgrid averaging of landunits to grid cells - real(r8), pointer :: histi(:,:) ! temporary - real(r8), pointer :: histo(:,:) ! temporary - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - integer, parameter :: nflds = 6 ! Number of 3D time-constant fields - character(len=*),parameter :: subname = 'htape_timeconst3D' - character(len=*),parameter :: varnames(nflds) = (/ & - 'ZSOI ', & - 'DZSOI ', & - 'WATSAT', & - 'SUCSAT', & - 'BSW ', & - 'HKSAT ' & - /) -!----------------------------------------------------------------------- - -!------------------------------------------------------------------------------- -!*** Non-time varying 3D fields *** -!*** Only write out when this subroutine is called *** -!*** Normally only called once for primary tapes *** -!------------------------------------------------------------------------------- - - if (mode == 'define') then - - do ifld = 1,nflds - ! Field indices MUST match varnames array order above! - if (ifld == 1) then - long_name='soil depth'; units = 'm' - else if (ifld == 2) then - long_name='soil thickness'; units = 'm' - else if (ifld == 3) then - long_name='saturated soil water content (porosity)'; units = 'mm3/mm3' - else if (ifld == 4) then - long_name='saturated soil matric potential'; units = 'mm' - else if (ifld == 5) then - long_name='slope of soil water retention curve'; units = 'unitless' - else if (ifld == 6) then - long_name='saturated hydraulic conductivity'; units = 'unitless' - else - call endrun( subname//' ERROR: bad 3D time-constant field index' ) - end if - if (tape(t)%dov2xy) then - if (ldomain%isgrid2d) then - call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec,& - dim1name='lon', dim2name='lat', dim3name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec, & - dim1name=grlnd, dim2name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - end if - else - call ncd_defvar(ncid=nfid(t), varname=trim(varnames(ifld)), xtype=tape(t)%ncprec, & - dim1name=namec, dim2name='levgrnd', & - long_name=long_name, units=units, missing_value=spval, fill_value=spval) - end if - call shr_string_listAppend(TimeConst3DVars,varnames(ifld)) - end do - - else if (mode == 'write') then - - ! Set pointers into derived type and get necessary bounds - - lptr => lun - cptr => col - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - allocate(histi(begc:endc,nlevgrnd), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for histi'; call endrun() - end if - - ! Write time constant fields - - if (tape(t)%dov2xy) then - allocate(histo(begg:endg,nlevgrnd), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for histo'; call endrun() - end if - end if - - do ifld = 1,nflds - - ! WJS (10-25-11): Note about l2g_scale_type in the following: ZSOI & DZSOI are - ! currently constant in space, except for urban points, so their scale type - ! doesn't matter at the moment as long as it excludes urban points. I am using - ! 'nonurb' so that the values are output everywhere where the fields are - ! constant (i.e., everywhere except urban points). For the other fields, I am - ! using 'veg' to be consistent with the l2g_scale_type that is now used for many - ! of the 3-d time-variant fields; in theory, though, one might want versions of - ! these variables output for different landunits. - - ! Field indices MUST match varnames array order above! - if (ifld == 1) then ! ZSOI - l2g_scale_type = 'nonurb' - else if (ifld == 2) then ! DZSOI - l2g_scale_type = 'nonurb' - else if (ifld == 3) then ! WATSAT - l2g_scale_type = 'veg' - else if (ifld == 4) then ! SUCSAT - l2g_scale_type = 'veg' - else if (ifld == 5) then ! BSW - l2g_scale_type = 'veg' - else if (ifld == 6) then ! HKSAT - l2g_scale_type = 'veg' - end if - - histi(:,:) = spval - do lev = 1,nlevgrnd - do c = begc, endc - l = cptr%landunit(c) - if (.not. lptr%lakpoi(l)) then - ! Field indices MUST match varnames array order above! - if (ifld ==1) histi(c,lev) = cps%z(c,lev) - if (ifld ==2) histi(c,lev) = cps%dz(c,lev) - if (ifld ==3) histi(c,lev) = cps%watsat(c,lev) - if (ifld ==4) histi(c,lev) = cps%sucsat(c,lev) - if (ifld ==5) histi(c,lev) = cps%bsw(c,lev) - if (ifld ==6) histi(c,lev) = cps%hksat(c,lev) - end if - end do - end do - if (tape(t)%dov2xy) then - histo(:,:) = spval - call c2g(begc, endc, begl, endl, begg, endg, nlevgrnd, histi, histo, & - c2l_scale_type='unity', l2g_scale_type=l2g_scale_type) - - if (ldomain%isgrid2d) then - call ncd_io(varname=trim(varnames(ifld)), dim1name=grlnd, & - data=histo, ncid=nfid(t), flag='write') - else - call ncd_io(varname=trim(varnames(ifld)), dim1name=grlnd, & - data=histo, ncid=nfid(t), flag='write') - end if - else - call ncd_io(varname=trim(varnames(ifld)), dim1name=namec, & - data=histi, ncid=nfid(t), flag='write') - end if - end do - - if (tape(t)%dov2xy) deallocate(histo) - deallocate(histi) - - end if ! (define/write mode - - end subroutine htape_timeconst3D - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: htape_timeconst -! -! !INTERFACE: - subroutine htape_timeconst(t, mode) -! -! !DESCRIPTION: -! Write time constant values to primary history tape. -! Issue the required netcdf wrapper calls to define the history file -! contents. -! -! !USES: - use clmtype - use clm_varcon , only : zsoi, zlak, secspday - use domainMod , only : ldomain, lon1d, lat1d - use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time - use clm_time_manager, only : get_ref_date, get_calendar, NO_LEAP_C, GREGORIAN_C -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - character(len=*), intent(in) :: mode ! 'define' or 'write' -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: vid,n,i,j,m ! indices - integer :: nstep ! current step - integer :: mcsec ! seconds of current date - integer :: mdcur ! current day - integer :: mscur ! seconds of current day - integer :: mcdate ! current date - integer :: yr,mon,day,nbsec ! year,month,day,seconds components of a date - integer :: hours,minutes,secs ! hours,minutes,seconds of hh:mm:ss - character(len= 10) :: basedate ! base date (yyyymmdd) - character(len= 8) :: basesec ! base seconds - character(len= 8) :: cdate ! system date - character(len= 8) :: ctime ! system time - real(r8):: time ! current time - real(r8):: timedata(2) ! time interval boundaries - integer :: dim1id(1) ! netCDF dimension id - integer :: dim2id(2) ! netCDF dimension id - integer :: varid ! netCDF variable id - type(Var_desc_t) :: vardesc ! netCDF variable description - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - character(len=max_chars) :: long_name ! variable long name - character(len=max_namlen):: varname ! variable name - character(len=max_namlen):: units ! variable units - character(len=max_namlen):: cal ! calendar from the time-manager - character(len=max_namlen):: caldesc ! calendar description to put on file - character(len=256):: str ! global attribute string - real(r8), pointer :: histo(:,:) ! temporary - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - integer :: status - - character(len=*),parameter :: subname = 'htape_timeconst' -!----------------------------------------------------------------------- - - !------------------------------------------------------------------------------- - !*** Time constant grid variables only on first time-sample of file *** - !------------------------------------------------------------------------------- - if (tape(t)%ntimes == 1) then - if (mode == 'define') then - call ncd_defvar(varname='levgrnd', xtype=tape(t)%ncprec, & - dim1name='levgrnd', & - long_name='coordinate soil levels', units='m', ncid=nfid(t)) - call ncd_defvar(varname='levlak', xtype=tape(t)%ncprec, & - dim1name='levlak', & - long_name='coordinate lake levels', units='m', ncid=nfid(t)) - elseif (mode == 'write') then - call ncd_io(varname='levgrnd', data=zsoi , ncid=nfid(t), flag='write') - call ncd_io(varname='levlak' , data=zlak , ncid=nfid(t), flag='write') - endif - endif - - !------------------------------------------------------------------------------- - !*** Time definition variables *** - !------------------------------------------------------------------------------- - - ! For define mode -- only do this for first time-sample - if (mode == 'define' .and. tape(t)%ntimes == 1) then - call get_ref_date(yr, mon, day, nbsec) - nstep = get_nstep() - hours = nbsec / 3600 - minutes = (nbsec - hours*3600) / 60 - secs = (nbsec - hours*3600 - minutes*60) - write(basedate,80) yr,mon,day -80 format(i4.4,'-',i2.2,'-',i2.2) - write(basesec ,90) hours, minutes, secs -90 format(i2.2,':',i2.2,':',i2.2) - - dim1id(1) = time_dimid - str = 'days since ' // basedate // " " // basesec - call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & - long_name='time',units=str) - cal = get_calendar() - if ( trim(cal) == NO_LEAP_C )then - caldesc = "noleap" - else if ( trim(cal) == GREGORIAN_C )then - caldesc = "gregorian" - end if - call ncd_putatt(nfid(t), varid, 'calendar', caldesc) - call ncd_putatt(nfid(t), varid, 'bounds', 'time_bounds') - - dim1id(1) = time_dimid - call ncd_defvar(nfid(t) , 'mcdate', ncd_int, 1, dim1id , varid, & - long_name = 'current date (YYYYMMDD)') - call ncd_defvar(nfid(t) , 'mcsec' , ncd_int, 1, dim1id , varid, & - long_name = 'current seconds of current date', units='s') - call ncd_defvar(nfid(t) , 'mdcur' , ncd_int, 1, dim1id , varid, & - long_name = 'current day (from base day)') - call ncd_defvar(nfid(t) , 'mscur' , ncd_int, 1, dim1id , varid, & - long_name = 'current seconds of current day') - call ncd_defvar(nfid(t) , 'nstep' , ncd_int, 1, dim1id , varid, & - long_name = 'time step') - - dim2id(1) = hist_interval_dimid; dim2id(2) = time_dimid - call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & - long_name = 'history time interval endpoints') - - dim2id(1) = strlen_dimid; dim2id(2) = time_dimid - call ncd_defvar(nfid(t), 'date_written', ncd_char, 2, dim2id, varid) - call ncd_defvar(nfid(t), 'time_written', ncd_char, 2, dim2id, varid) - - if ( len_trim(TimeConst3DVars_Filename) > 0 )then - call ncd_putatt(nfid(t), ncd_global, 'Time_constant_3Dvars_filename', & - trim(TimeConst3DVars_Filename)) - end if - if ( len_trim(TimeConst3DVars) > 0 )then - call ncd_putatt(nfid(t), ncd_global, 'Time_constant_3Dvars', & - trim(TimeConst3DVars)) - end if - - elseif (mode == 'write') then - - call get_curr_time (mdcur, mscur) - call get_curr_date (yr, mon, day, mcsec) - mcdate = yr*10000 + mon*100 + day - nstep = get_nstep() - - call ncd_io('mcdate', mcdate, 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('mcsec' , mcsec , 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('mdcur' , mdcur , 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('mscur' , mscur , 'write', nfid(t), nt=tape(t)%ntimes) - call ncd_io('nstep' , nstep , 'write', nfid(t), nt=tape(t)%ntimes) - - time = mdcur + mscur/secspday - call ncd_io('time' , time , 'write', nfid(t), nt=tape(t)%ntimes) - - timedata(1) = tape(t)%begtime - timedata(2) = time - call ncd_io('time_bounds', timedata, 'write', nfid(t), nt=tape(t)%ntimes) - - call getdatetime (cdate, ctime) - call ncd_io('date_written', cdate, 'write', nfid(t), nt=tape(t)%ntimes) - - call ncd_io('time_written', ctime, 'write', nfid(t), nt=tape(t)%ntimes) - - endif - - !------------------------------------------------------------------------------- - !*** Grid definition variables *** - !------------------------------------------------------------------------------- - ! For define mode -- only do this for first time-sample - if (mode == 'define' .and. tape(t)%ntimes == 1) then - - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, dim1name='lon', & - long_name='coordinate longitude', units='degrees_east', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lon', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate longitude', units='degrees_east', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, dim1name='lat', & - long_name='coordinate latitude', units='degrees_north', & - ncid=nfid(t), missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='lat', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='coordinate latitude', units='degrees_north', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat',& - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='area', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='grid cell areas', units='km^2', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name='lon', dim2name='lat', & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(varname='landfrac', xtype=tape(t)%ncprec, & - dim1name=grlnd, & - long_name='land fraction', ncid=nfid(t), & - missing_value=spval, fill_value=spval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='landmask', xtype=ncd_int, & - dim1name=grlnd, & - long_name='land/ocean mask (0.=ocean and 1.=land)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - if (ldomain%isgrid2d) then - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name='lon', dim2name='lat', & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - else - call ncd_defvar(varname='pftmask' , xtype=ncd_int, & - dim1name=grlnd, & - long_name='pft real/fake mask (0.=fake and 1.=real)', ncid=nfid(t), & - imissing_value=ispval, ifill_value=ispval) - end if - else if (mode == 'write') then - - ! Most of this is constant and only needs to be done on tape(t)%ntimes=1 - ! But, some may change for dynamic PFT mode for example - ! Set pointers into derived type and get necessary bounds - - lptr => lun - cptr => col - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - if (ldomain%isgrid2d) then - call ncd_io(varname='lon', data=lon1d, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=lat1d, ncid=nfid(t), flag='write') - else - call ncd_io(varname='lon', data=ldomain%lonc, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='lat', data=ldomain%latc, dim1name=grlnd, ncid=nfid(t), flag='write') - end if - call ncd_io(varname='area' , data=ldomain%area, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landfrac', data=ldomain%frac, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='landmask', data=ldomain%mask, dim1name=grlnd, ncid=nfid(t), flag='write') - call ncd_io(varname='pftmask' , data=ldomain%pftm, dim1name=grlnd, ncid=nfid(t), flag='write') - end if ! (define/write mode - - end subroutine htape_timeconst - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hfields_write -! -! !INTERFACE: - subroutine hfields_write(t, mode) -! -! !DESCRIPTION: -! Write history tape. Issue the call to write the variable. -! -! !USES: - use clmtype - use domainMod , only : ldomain -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - character(len=*), intent(in) :: mode ! 'define' or 'write' -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - integer :: k ! 1d index - integer :: c,l,p ! indices - integer :: beg1d_out ! on-node 1d hbuf pointer start index - integer :: end1d_out ! on-node 1d hbuf pointer end index - integer :: num1d_out ! size of hbuf first dimension (overall all nodes) - integer :: num2d ! hbuf second dimension size - integer :: nt ! time index - integer :: ier ! error status - character(len=1) :: avgflag ! time averaging flag - character(len=max_chars) :: long_name! long name - character(len=max_chars) :: units ! units - character(len=max_namlen):: varname ! variable name - character(len=32) :: avgstr ! time averaging type - character(len=8) :: type1d_out ! history output 1d type - character(len=8) :: type2d ! history output 2d type - character(len=32) :: dim1name ! temporary - character(len=32) :: dim2name ! temporary - real(r8), pointer :: histo(:,:) ! temporary - real(r8), pointer :: hist1do(:) ! temporary - character(len=*),parameter :: subname = 'hfields_write' -!----------------------------------------------------------------------- - - ! Write/define 1d topological info - - if (.not. tape(t)%dov2xy) then - if (mode == 'define') then - call hfields_1dinfo(t, mode='define') - else if (mode == 'write') then - call hfields_1dinfo(t, mode='write') - end if - end if - - ! Define time-dependent variables create variables and attributes for field list - - do f = 1,tape(t)%nflds - - ! Set history field variables - - varname = tape(t)%hlist(f)%field%name - long_name = tape(t)%hlist(f)%field%long_name - units = tape(t)%hlist(f)%field%units - avgflag = tape(t)%hlist(f)%avgflag - type1d_out = tape(t)%hlist(f)%field%type1d_out - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - num1d_out = tape(t)%hlist(f)%field%num1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - nt = tape(t)%ntimes - - if (mode == 'define') then - - select case (avgflag) - case ('A') - avgstr = 'mean' - case ('I') - avgstr = 'instantaneous' - case ('X') - avgstr = 'maximum' - case ('M') - avgstr = 'minimum' - case default - write(iulog,*) trim(subname),' ERROR: unknown time averaging flag (avgflag)=',avgflag; call endrun() - end select - - if (type1d_out == grlnd) then - if (ldomain%isgrid2d) then - dim1name = 'lon' ; dim2name = 'lat' - else - dim1name = trim(grlnd); dim2name = 'undefined' - end if - else - dim1name = type1d_out ; dim2name = 'undefined' - endif - - if (dim2name == 'undefined') then - if (num2d == 1) then - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name=type2d, dim3name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - end if - else - if (num2d == 1) then - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name=dim2name, dim3name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - else - call ncd_defvar(ncid=nfid(t), varname=varname, xtype=tape(t)%ncprec, & - dim1name=dim1name, dim2name=dim2name, dim3name=type2d, dim4name='time', & - long_name=long_name, units=units, cell_method=avgstr, & - missing_value=spval, fill_value=spval) - end if - endif - - else if (mode == 'write') then - - ! Determine output buffer - - histo => tape(t)%hlist(f)%hbuf - - ! Allocate dynamic memory - - if (num2d == 1) then - allocate(hist1do(beg1d_out:end1d_out), stat=ier) - if (ier /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation'; call endrun() - end if - hist1do(beg1d_out:end1d_out) = histo(beg1d_out:end1d_out,1) - end if - - ! Write history output. Always output land and ocean runoff on xy grid. - - if (num2d == 1) then - call ncd_io(flag='write', varname=varname, & - dim1name=type1d_out, data=hist1do, ncid=nfid(t), nt=nt) - else - call ncd_io(flag='write', varname=varname, & - dim1name=type1d_out, data=histo, ncid=nfid(t), nt=nt) - end if - - - ! Deallocate dynamic memory - - if (num2d == 1) then - deallocate(hist1do) - end if - - end if - - end do - - end subroutine hfields_write - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hfields_1dinfo -! -! !INTERFACE: - subroutine hfields_1dinfo(t, mode) -! -! !DESCRIPTION: -! Write/define 1d info for history tape. -! -! !USES: - use clmtype - use decompMod , only : ldecomp - use domainMod , only : ldomain, ldomain -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: t ! tape index - character(len=*), intent(in) :: mode ! 'define' or 'write' -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: f ! field index - integer :: k ! 1d index - integer :: g,c,l,p ! indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: ier ! errir status - real(r8), pointer :: rgarr(:) ! temporary - real(r8), pointer :: rcarr(:) ! temporary - real(r8), pointer :: rlarr(:) ! temporary - real(r8), pointer :: rparr(:) ! temporary - integer , pointer :: igarr(:) ! temporary - integer , pointer :: icarr(:) ! temporary - integer , pointer :: ilarr(:) ! temporary - integer , pointer :: iparr(:) ! temporary - type(file_desc_t) :: ncid ! netcdf file - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - character(len=*),parameter :: subname = 'hfields_1dinfo' -!----------------------------------------------------------------------- - - ncid = nfid(t) - - if (mode == 'define') then - - ! Define gridcell info - - call ncd_defvar(varname='grid1d_lon', xtype=ncd_double, dim1name=nameg, & - long_name='gridcell longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='grid1d_lat', xtype=ncd_double, dim1name=nameg, & - long_name='gridcell latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='grid1d_ixy', xtype=ncd_int, dim1name=nameg, & - long_name='2d longitude index of corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='grid1d_jxy', xtype=ncd_int, dim1name=nameg, & - long_name='2d latitude index of corresponding gridcell', ncid=ncid) - - ! Define landunit info - - call ncd_defvar(varname='land1d_lon', xtype=ncd_double, dim1name=namel, & - long_name='landunit longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='land1d_lat', xtype=ncd_double, dim1name=namel, & - long_name='landunit latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='land1d_ixy', xtype=ncd_int, dim1name=namel, & - long_name='2d longitude index of corresponding landunit', ncid=ncid) - - call ncd_defvar(varname='land1d_jxy', xtype=ncd_int, dim1name=namel, & - long_name='2d latitude index of corresponding landunit', ncid=ncid) - - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(varname='land1d_gi', xtype=ncd_int, dim1name='landunit', & - ! long_name='1d grid index of corresponding landunit', ncid=ncid) - ! ---------------------------------------------------------------- - - call ncd_defvar(varname='land1d_wtgcell', xtype=ncd_double, dim1name=namel, & - long_name='landunit weight relative to corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='land1d_ityplunit', xtype=ncd_int, dim1name=namel, & - long_name='landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) - - ! Define column info - - call ncd_defvar(varname='cols1d_lon', xtype=ncd_double, dim1name=namec, & - long_name='column longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='cols1d_lat', xtype=ncd_double, dim1name=namec, & - long_name='column latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='cols1d_ixy', xtype=ncd_int, dim1name=namec, & - long_name='2d longitude index of corresponding column', ncid=ncid) - - call ncd_defvar(varname='cols1d_jxy', xtype=ncd_int, dim1name=namec, & - long_name='2d latitude index of corresponding column', ncid=ncid) - - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(varname='cols1d_gi', xtype=ncd_int, dim1name='column', & - ! long_name='1d grid index of corresponding column', ncid=ncid) - - !call ncd_defvar(varname='cols1d_li', xtype=ncd_int, dim1name='column', & - ! long_name='1d landunit index of corresponding column', ncid=ncid) - ! ---------------------------------------------------------------- - - call ncd_defvar(varname='cols1d_wtgcell', xtype=ncd_double, dim1name=namec, & - long_name='column weight relative to corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='cols1d_wtlunit', xtype=ncd_double, dim1name=namec, & - long_name='column weight relative to corresponding landunit', ncid=ncid) - - call ncd_defvar(varname='cols1d_itype_lunit', xtype=ncd_int, dim1name=namec, & - long_name='column landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) - - ! Define pft info - - call ncd_defvar(varname='pfts1d_lon', xtype=ncd_double, dim1name=namep, & - long_name='pft longitude', units='degrees_east', ncid=ncid) - - call ncd_defvar(varname='pfts1d_lat', xtype=ncd_double, dim1name=namep, & - long_name='pft latitude', units='degrees_north', ncid=ncid) - - call ncd_defvar(varname='pfts1d_ixy', xtype=ncd_int, dim1name=namep, & - long_name='2d longitude index of corresponding pft', ncid=ncid) - - call ncd_defvar(varname='pfts1d_jxy', xtype=ncd_int, dim1name=namep, & - long_name='2d latitude index of corresponding pft', ncid=ncid) - - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(varname='pfts1d_gi', xtype=ncd_int, dim1name='pft', & - ! long_name='1d grid index of corresponding pft', ncid=ncid) - - !call ncd_defvar(varname='pfts1d_li', xtype=ncd_int, dim1name='pft', & - ! long_name='1d landunit index of corresponding pft', ncid=ncid) - - !call ncd_defvar(varname='pfts1d_ci', xtype=ncd_int, dim1name='pft', & - ! long_name='1d column index of corresponding pft', ncid=ncid) - ! ---------------------------------------------------------------- - - call ncd_defvar(varname='pfts1d_wtgcell', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding gridcell', ncid=ncid) - - call ncd_defvar(varname='pfts1d_wtlunit', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding landunit', ncid=ncid) - - call ncd_defvar(varname='pfts1d_wtcol', xtype=ncd_double, dim1name=namep, & - long_name='pft weight relative to corresponding column', ncid=ncid) - - call ncd_defvar(varname='pfts1d_itype_veg', xtype=ncd_int, dim1name=namep, & - long_name='pft vegetation type', ncid=ncid) - - call ncd_defvar(varname='pfts1d_itype_lunit', xtype=ncd_int, dim1name=namep, & - long_name='pft landunit type (vegetated,urban,lake,wetland,glacier or glacier_mec)', & - ncid=ncid) - - else if (mode == 'write') then - - ! Set pointers into derived type - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - ! Determine bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - allocate(rgarr(begg:endg),rlarr(begl:endl),rcarr(begc:endc),rparr(begp:endp),stat=ier) - if (ier /= 0) call endrun('hfields_1dinfo allocation error of rarrs') - - allocate(igarr(begg:endg),ilarr(begl:endl),icarr(begc:endc),iparr(begp:endp),stat=ier) - if (ier /= 0) call endrun('hfields_1dinfo allocation error of iarrs') - - ! Write gridcell info - - call ncd_io(varname='grid1d_lon', data=gptr%londeg, dim1name=nameg, ncid=ncid, flag='write') - call ncd_io(varname='grid1d_lat', data=gptr%latdeg, dim1name=nameg, ncid=ncid, flag='write') - do g=begg,endg - igarr(g)= mod(ldecomp%gdc2glo(g)-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='grid1d_ixy', data=igarr , dim1name=nameg, ncid=ncid, flag='write') - do g=begg,endg - igarr(g)= (ldecomp%gdc2glo(g) - 1)/ldomain%ni + 1 - enddo - call ncd_io(varname='grid1d_jxy', data=igarr , dim1name=nameg, ncid=ncid, flag='write') - - ! Write landunit info - - do l=begl,endl - rlarr(l) = gptr%londeg(lptr%gridcell(l)) - enddo - call ncd_io(varname='land1d_lon', data=rlarr, dim1name=namel, ncid=ncid, flag='write') - do l=begl,endl - rlarr(l) = gptr%latdeg(lptr%gridcell(l)) - enddo - call ncd_io(varname='land1d_lat', data=rlarr, dim1name=namel, ncid=ncid, flag='write') - do l=begl,endl - ilarr(l) = mod(ldecomp%gdc2glo(lptr%gridcell(l))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='land1d_ixy', data=ilarr, dim1name=namel, ncid=ncid, flag='write') - do l=begl,endl - ilarr(l) = (ldecomp%gdc2glo(lptr%gridcell(l))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='land1d_jxy' , data=ilarr , dim1name=namel, ncid=ncid, flag='write') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 Bug 1310 - !call ncd_io(varname='land1d_gi' , data=lptr%gridcell, dim1name=namel, ncid=ncid, flag='write') - ! ---------------------------------------------------------------- - call ncd_io(varname='land1d_wtgcell' , data=lptr%wtgcell , dim1name=namel, ncid=ncid, flag='write') - call ncd_io(varname='land1d_ityplunit', data=lptr%itype , dim1name=namel, ncid=ncid, flag='write') - - ! Write column info - - do c=begc,endc - rcarr(c) = gptr%londeg(cptr%gridcell(c)) - enddo - call ncd_io(varname='cols1d_lon', data=rcarr, dim1name=namec, ncid=ncid, flag='write') - do c=begc,endc - rcarr(c) = gptr%latdeg(cptr%gridcell(c)) - enddo - call ncd_io(varname='cols1d_lat', data=rcarr, dim1name=namec, ncid=ncid, flag='write') - do c=begc,endc - icarr(c) = mod(ldecomp%gdc2glo(cptr%gridcell(c))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='cols1d_ixy', data=icarr, dim1name=namec, ncid=ncid, flag='write') - do c=begc,endc - icarr(c) = (ldecomp%gdc2glo(cptr%gridcell(c))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='cols1d_jxy' , data=icarr ,dim1name=namec, ncid=ncid, flag='write') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 Bug 1310 - !call ncd_io(varname='cols1d_gi' , data=cptr%gridcell, dim1name=namec, ncid=ncid, flag='write') - !call ncd_io(varname='cols1d_li' , data=cptr%landunit, dim1name=namec, ncid=ncid, flag='write') - ! ---------------------------------------------------------------- - call ncd_io(varname='cols1d_wtgcell', data=cptr%wtgcell , dim1name=namec, ncid=ncid, flag='write') - call ncd_io(varname='cols1d_wtlunit', data=cptr%wtlunit , dim1name=namec, ncid=ncid, flag='write') - do c=begc,endc - icarr(c) = lptr%itype(cptr%landunit(c)) - enddo - call ncd_io(varname='cols1d_itype_lunit', data=icarr , dim1name=namec, ncid=ncid, flag='write') - - ! Write pft info - - do p=begp,endp - rparr(p) = gptr%londeg(pptr%gridcell(p)) - enddo - call ncd_io(varname='pfts1d_lon', data=rparr, dim1name=namep, ncid=ncid, flag='write') - do p=begp,endp - rparr(p) = gptr%latdeg(pptr%gridcell(p)) - enddo - call ncd_io(varname='pfts1d_lat', data=rparr, dim1name=namep, ncid=ncid, flag='write') - do p=begp,endp - iparr(p) = mod(ldecomp%gdc2glo(pptr%gridcell(p))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='pfts1d_ixy', data=iparr, dim1name=namep, ncid=ncid, flag='write') - do p=begp,endp - iparr(p) = (ldecomp%gdc2glo(pptr%gridcell(p))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='pfts1d_jxy' , data=iparr , dim1name=namep, ncid=ncid, flag='write') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_io(varname='pfts1d_gi' , data=pptr%gridcell, dim1name=namep, ncid=ncid, flag='write') - !call ncd_io(varname='pfts1d_li' , data=pptr%landunit, dim1name=namep, ncid=ncid, flag='write') - !call ncd_io(varname='pfts1d_ci' , data=pptr%column , dim1name=namep, ncid=ncid, flag='write') - ! ---------------------------------------------------------------- - call ncd_io(varname='pfts1d_wtgcell' , data=pptr%wtgcell , dim1name=namep, ncid=ncid, flag='write') - call ncd_io(varname='pfts1d_wtlunit' , data=pptr%wtlunit , dim1name=namep, ncid=ncid, flag='write') - call ncd_io(varname='pfts1d_wtcol' , data=pptr%wtcol , dim1name=namep, ncid=ncid, flag='write') - call ncd_io(varname='pfts1d_itype_veg', data=pptr%itype , dim1name=namep, ncid=ncid, flag='write') - - do p=begp,endp - iparr(p) = lptr%itype(pptr%landunit(p)) - enddo - call ncd_io(varname='pfts1d_itype_lunit', data=iparr , dim1name=namep, ncid=ncid, flag='write') - - deallocate(rgarr,rlarr,rcarr,rparr) - deallocate(igarr,ilarr,icarr,iparr) - - end if - - end subroutine hfields_1dinfo - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_htapes_wrapup -! -! !INTERFACE: - subroutine hist_htapes_wrapup( rstwr, nlend ) -! -! !DESCRIPTION: -! Write history tape(s) -! Determine if next time step is beginning of history interval and if so: -! increment the current time sample counter, open a new history file -! and if needed (i.e., when ntim = 1), write history data to current -! history file, reset field accumulation counters to zero. -! If primary history file is full or at the last time step of the simulation, -! write restart dataset and close all history fiels. -! If history file is full or at the last time step of the simulation: -! close history file -! and reset time sample counter to zero if file is full. -! Daily-averaged data for the first day in September are written on -! date = 00/09/02 with mscur = 0. -! Daily-averaged data for the first day in month mm are written on -! date = yyyy/mm/02 with mscur = 0. -! Daily-averaged data for the 30th day (last day in September) are written -! on date = 0000/10/01 mscur = 0. -! Daily-averaged data for the last day in month mm are written on -! date = yyyy/mm+1/01 with mscur = 0. -! -! !USES: - use clm_time_manager, only : get_nstep, get_curr_date, get_curr_time, get_prev_date - use clm_varcon , only : secspday - use clmtype -! -! !ARGUMENTS: - implicit none - logical, intent(in) :: rstwr ! true => write restart file this step - logical, intent(in) :: nlend ! true => end of run on this step -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: t ! tape index - integer :: f ! field index - integer :: ier ! error code - integer :: nstep ! current step - integer :: day ! current day (1 -> 31) - integer :: mon ! current month (1 -> 12) - integer :: yr ! current year (0 -> ...) - integer :: mdcur ! current day - integer :: mscur ! seconds of current day - integer :: mcsec ! current time of day [seconds] - integer :: daym1 ! nstep-1 day (1 -> 31) - integer :: monm1 ! nstep-1 month (1 -> 12) - integer :: yrm1 ! nstep-1 year (0 -> ...) - integer :: mcsecm1 ! nstep-1 time of day [seconds] - real(r8):: time ! current time - character(len=256) :: str ! global attribute string - logical :: if_stop ! true => last time step of run - logical, save :: do_3Dtconst = .true. ! true => write out 3D time-constant data - character(len=*),parameter :: subname = 'hist_htapes_wrapup' -!----------------------------------------------------------------------- - - ! get current step - - nstep = get_nstep() - - ! Set calendar for current time step - - call get_curr_date (yr, mon, day, mcsec) - call get_curr_time (mdcur, mscur) - time = mdcur + mscur/secspday - - ! Set calendar for current for previous time step - - call get_prev_date (yrm1, monm1, daym1, mcsecm1) - - ! Loop over active history tapes, create new history files if necessary - ! and write data to history files if end of history interval. - do t = 1, ntapes - - ! Skip nstep=0 if monthly average - - if (nstep==0 .and. tape(t)%nhtfrq==0) cycle - - ! Determine if end of history interval - tape(t)%is_endhist = .false. - if (tape(t)%nhtfrq==0) then !monthly average - if (mon /= monm1) tape(t)%is_endhist = .true. - else - if (mod(nstep,tape(t)%nhtfrq) == 0) tape(t)%is_endhist = .true. - end if - - ! If end of history interval - - if (tape(t)%is_endhist) then - - ! Normalize history buffer if time averaged - - call hfields_normalize(t) - - ! Increment current time sample counter. - - tape(t)%ntimes = tape(t)%ntimes + 1 - - ! Create history file if appropriate and build time comment - - ! If first time sample, generate unique history file name, open file, - ! define dims, vars, etc. - - if (tape(t)%ntimes == 1) then - locfnh(t) = set_hist_filename (hist_freq=tape(t)%nhtfrq, & - hist_mfilt=tape(t)%mfilt, hist_file=t) - if (masterproc) then - write(iulog,*) trim(subname),' : Creating history file ', trim(locfnh(t)), & - ' at nstep = ',get_nstep() - write(iulog,*)'calling htape_create for file t = ',t - endif - call htape_create (t) - - ! Define time-constant field variables - call htape_timeconst(t, mode='define') - - ! Define 3D time-constant field variables only to first primary tape - - if ( do_3Dtconst .and. t == 1 ) then - call htape_timeconst3D(t, mode='define') - TimeConst3DVars_Filename = trim(locfnh(t)) - end if - - ! Define model field variables - - call hfields_write(t, mode='define') - - ! Exit define model - call ncd_enddef(nfid(t)) - - endif - - ! Write time constant history variables - call htape_timeconst(t, mode='write') - - ! Write 3D time constant history variables only to first primary tape - if ( do_3Dtconst .and. t == 1 .and. tape(t)%ntimes == 1 )then - call htape_timeconst3D(t, mode='write') - do_3Dtconst = .false. - end if - - if (masterproc) then - write(iulog,*) - write(iulog,*) trim(subname),' : Writing current time sample to local history file ', & - trim(locfnh(t)),' at nstep = ',get_nstep(), & - ' for history time interval beginning at ', tape(t)%begtime, & - ' and ending at ',time - write(iulog,*) - call shr_sys_flush(iulog) - endif - - ! Update beginning time of next interval - - tape(t)%begtime = time - - ! Write history time samples - - call hfields_write(t, mode='write') - - ! Zero necessary history buffers - - call hfields_zero(t) - - end if - - end do ! end loop over history tapes - - ! Determine if file needs to be closed - - call hist_do_disp (ntapes, tape(:)%ntimes, tape(:)%mfilt, if_stop, if_disphist, rstwr, nlend) - - ! Close open history file - ! Auxilary files may have been closed and saved off without being full, - ! must reopen the files - - do t = 1, ntapes - if (if_disphist(t)) then - if (tape(t)%ntimes /= 0) then - if (masterproc) then - write(iulog,*) - write(iulog,*) trim(subname),' : Closing local history file ',& - trim(locfnh(t)),' at nstep = ', get_nstep() - write(iulog,*) - endif - call ncd_pio_closefile(nfid(t)) - if (.not.if_stop .and. (tape(t)%ntimes/=tape(t)%mfilt)) then - call ncd_pio_openfile (nfid(t), trim(locfnh(t)), ncd_write) - end if - else - if (masterproc) then - write(iulog,*) trim(subname),' : history tape ',t,': no open file to close' - end if - endif - endif - end do - - ! Reset number of time samples to zero if file is full - - do t = 1, ntapes - if (if_disphist(t) .and. tape(t)%ntimes==tape(t)%mfilt) then - tape(t)%ntimes = 0 - end if - end do - - end subroutine hist_htapes_wrapup - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_restart_ncd -! -! !INTERFACE: - subroutine hist_restart_ncd (ncid, flag, rdate) -! -! !DESCRIPTION: -! Read/write history file restart data. -! If the current history file(s) are not full, file(s) are opened -! so that subsequent time samples are added until the file is full. -! A new history file is used on a branch run. -! -! !USES: - use clm_varctl , only : nsrest, caseid, inst_suffix, nsrStartup, nsrBranch - use fileutils , only : getfil - use clmtype - use domainMod , only : ldomain - use clm_varpar , only : nlevgrnd, nlevlak, numrad - use clm_time_manager, only : is_restart -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid ! netcdf file - character(len=*) , intent(in) :: flag !'read' or 'write' - character(len=*) , intent(in), optional :: rdate ! restart file time stamp for name -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: max_nflds ! Max number of fields - integer :: num1d,beg1d,end1d ! 1d size, beginning and ending indices - integer :: num1d_out,beg1d_out,end1d_out ! 1d size, beginning and ending indices - integer :: num2d ! 2d size (e.g. number of vertical levels) - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: numa ! total number of atm cells across all processors - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - character(len=max_namlen) :: name ! variable name - character(len=max_namlen) :: name_acc ! accumulator variable name - character(len=max_namlen) :: long_name ! long name of variable - character(len=max_chars) :: long_name_acc ! long name for accumulator - character(len=max_chars) :: units ! units of variable - character(len=max_chars) :: units_acc ! accumulator units - character(len=max_chars) :: fname ! full name of history file - character(len=max_chars) :: locrest(max_tapes) ! local history restart file names - - character(len=max_namlen),allocatable :: tname(:) - character(len=max_chars), allocatable :: tunits(:),tlongname(:) - character(len=8), allocatable :: tmpstr(:,:) - character(len=1), allocatable :: tavgflag(:) - integer :: start(2) - - character(len=1) :: hnum ! history file index - character(len=8) :: type1d ! clm pointer 1d type - character(len=8) :: type1d_out ! history buffer 1d type - character(len=8) :: type2d ! history buffer 2d type - character(len=32) :: dim1name ! temporary - character(len=32) :: dim2name ! temporary - type(var_desc_t) :: name_desc ! variable descriptor for name - type(var_desc_t) :: longname_desc ! variable descriptor for long_name - type(var_desc_t) :: units_desc ! variable descriptor for units - type(var_desc_t) :: type1d_desc ! variable descriptor for type1d - type(var_desc_t) :: type1d_out_desc ! variable descriptor for type1d_out - type(var_desc_t) :: type2d_desc ! variable descriptor for type2d - type(var_desc_t) :: avgflag_desc ! variable descriptor for avgflag - type(var_desc_t) :: p2c_scale_type_desc ! variable descriptor for p2c_scale_type - type(var_desc_t) :: c2l_scale_type_desc ! variable descriptor for c2l_scale_type - type(var_desc_t) :: l2g_scale_type_desc ! variable descriptor for l2g_scale_type - integer :: status ! error status - integer :: dimid ! dimension ID - integer :: k ! 1d index - integer :: ntapes_onfile ! number of history tapes on the restart file - integer :: nflds_onfile ! number of history fields on the restart file - integer :: t ! tape index - integer :: f ! field index - integer :: varid ! variable id - integer, allocatable :: itemp(:) ! temporary - real(r8), pointer :: hbuf(:,:) ! history buffer - real(r8), pointer :: hbuf1d(:) ! 1d history buffer - integer , pointer :: nacs(:,:) ! accumulation counter - integer , pointer :: nacs1d(:) ! 1d accumulation counter - character(len=*),parameter :: subname = 'hist_restart_ncd' -!------------------------------------------------------------------------ - - ! If branch run, initialize file times and return - - if (flag == 'read') then - if (nsrest == nsrBranch) then - do t = 1,ntapes - tape(t)%ntimes = 0 - end do - RETURN - end if - ! If startup run just return - if (nsrest == nsrStartup) then - RETURN - end if - endif - - ! Read history file data only for restart run (not for branch run) - - ! - ! First when writing out and in define mode, create files and define all variables - ! - !================================================ - if (flag == 'define') then - !================================================ - - if (.not. present(rdate)) then - call endrun('variable rdate must be present for writing restart files') - end if - - ! - ! On master restart file add ntapes/max_chars dimension - ! and then add the history and history restart filenames - ! - call ncd_defdim( ncid, 'ntapes' , ntapes , dimid) - call ncd_defdim( ncid, 'max_chars' , max_chars , dimid) - - call ncd_defvar(ncid=ncid, varname='locfnh', xtype=ncd_char, & - long_name="History filename", & - comment="This variable NOT needed for startup or branch simulations", & - dim1name='max_chars', dim2name="ntapes" ) - call ncd_defvar(ncid=ncid, varname='locfnhr', xtype=ncd_char, & - long_name="Restart history filename", & - comment="This variable NOT needed for startup or branch simulations", & - dim1name='max_chars', dim2name="ntapes" ) - - ! max_nflds is the maximum number of fields on any tape - ! max_flds is the maximum number possible number of fields - - max_nflds = max_nFields() - - call get_proc_global(numg, numl, numc, nump) - - ! Loop over tapes - write out namelist information to each restart-history tape - ! only read/write accumulators and counters if needed - - do t = 1,ntapes - - ! - ! Create the restart history filename and open it - ! - write(hnum,'(i1.1)') t-1 - locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) & - // ".rh" // hnum //"."// trim(rdate) //".nc" - - call htape_create( t, histrest=.true. ) - - ! - ! Add read/write accumultators and counters if needed - ! - if (.not. tape(t)%is_endhist) then - do f = 1,tape(t)%nflds - name = tape(t)%hlist(f)%field%name - long_name = tape(t)%hlist(f)%field%long_name - units = tape(t)%hlist(f)%field%units - name_acc = trim(name) // "_acc" - units_acc = "unitless positive integer" - long_name_acc = trim(long_name) // " accumulator number of samples" - type1d_out = tape(t)%hlist(f)%field%type1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (type1d_out == grlnd) then - if (ldomain%isgrid2d) then - dim1name = 'lon' ; dim2name = 'lat' - else - dim1name = trim(grlnd); dim2name = 'undefined' - end if - else - dim1name = type1d_out ; dim2name = 'undefined' - endif - - if (dim2name == 'undefined') then - if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, & - long_name=trim(long_name_acc), units=trim(units_acc)) - else - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, dim2name=type2d, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, dim2name=type2d, & - long_name=trim(long_name_acc), units=trim(units_acc)) - end if - else - if (num2d == 1) then - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, dim2name=dim2name, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, dim2name=dim2name, & - long_name=trim(long_name_acc), units=trim(units_acc)) - else - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name), xtype=ncd_double, & - dim1name=dim1name, dim2name=dim2name, dim3name=type2d, & - long_name=trim(long_name), units=trim(units)) - call ncd_defvar(ncid=ncid_hist(t), varname=trim(name_acc), xtype=ncd_int, & - dim1name=dim1name, dim2name=dim2name, dim3name=type2d, & - long_name=trim(long_name_acc), units=trim(units_acc)) - end if - endif - end do - endif - - ! - ! Add namelist information to each restart history tape - ! - call ncd_defdim( ncid_hist(t), 'fname_lenp2' , max_namlen+2, dimid) - call ncd_defdim( ncid_hist(t), 'fname_len' , max_namlen , dimid) - call ncd_defdim( ncid_hist(t), 'len1' , 1 , dimid) - call ncd_defdim( ncid_hist(t), 'scalar' , 1 , dimid) - call ncd_defdim( ncid_hist(t), 'max_chars' , max_chars , dimid) - call ncd_defdim( ncid_hist(t), 'max_nflds' , max_nflds , dimid) - call ncd_defdim( ncid_hist(t), 'max_flds' , max_flds , dimid) - - call ncd_defvar(ncid=ncid_hist(t), varname='nhtfrq', xtype=ncd_int, & - long_name="Frequency of history writes", & - comment="Namelist item", & - units="absolute value of negative is in hours, 0=monthly, positive is time-steps", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='mfilt', xtype=ncd_int, & - long_name="Number of history time samples on a file", units="unitless", & - comment="Namelist item", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='ncprec', xtype=ncd_int, & - long_name="Flag for data precision", flag_values=(/1,2/), & - comment="Namelist item", & - nvalid_range=(/1,2/), & - flag_meanings=(/"single-precision", "double-precision"/), & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='dov2xy', xtype=ncd_log, & - long_name="Output on 2D grid format (TRUE) or vector format (FALSE)", & - comment="Namelist item", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='fincl', xtype=ncd_char, & - comment="Namelist item", & - long_name="Fieldnames to include", & - dim1name='fname_lenp2', dim2name='max_flds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='fexcl', xtype=ncd_char, & - comment="Namelist item", & - long_name="Fieldnames to exclude", & - dim1name='fname_lenp2', dim2name='max_flds' ) - - call ncd_defvar(ncid=ncid_hist(t), varname='nflds', xtype=ncd_int, & - long_name="Number of fields on file", units="unitless", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='ntimes', xtype=ncd_int, & - long_name="Number of time steps on file", units="time-step", & - dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='is_endhist', xtype=ncd_log, & - long_name="End of history file", dim1name='scalar') - call ncd_defvar(ncid=ncid_hist(t), varname='begtime', xtype=ncd_double, & - long_name="Beginning time", units="time units", & - dim1name='scalar') - - call ncd_defvar(ncid=ncid_hist(t), varname='num2d', xtype=ncd_int, & - long_name="Size of second dimension", units="unitless", & - dim1name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='hpindex', xtype=ncd_int, & - long_name="History pointer index", units="unitless", & - dim1name='max_nflds' ) - - call ncd_defvar(ncid=ncid_hist(t), varname='avgflag', xtype=ncd_char, & - long_name="Averaging flag", & - units="A=Average, X=Maximum, M=Minimum, I=Instantaneous", & - dim1name='len1', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='name', xtype=ncd_char, & - long_name="Fieldnames", & - dim1name='fname_len', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='long_name', xtype=ncd_char, & - long_name="Long descriptive names for fields", & - dim1name='max_chars', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='units', xtype=ncd_char, & - long_name="Units for each history field output", & - dim1name='max_chars', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='type1d', xtype=ncd_char, & - long_name="1st dimension type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='type1d_out', xtype=ncd_char, & - long_name="1st output dimension type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='type2d', xtype=ncd_char, & - long_name="2nd dimension type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='p2c_scale_type', xtype=ncd_char, & - long_name="PFT to column scale type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='c2l_scale_type', xtype=ncd_char, & - long_name="column to landunit scale type", & - dim1name='string_length', dim2name='max_nflds' ) - call ncd_defvar(ncid=ncid_hist(t), varname='l2g_scale_type', xtype=ncd_char, & - long_name="landunit to gridpoint scale type", & - dim1name='string_length', dim2name='max_nflds' ) - - call ncd_enddef(ncid_hist(t)) - - end do ! end of ntapes loop - - RETURN - - ! - ! First write out namelist information to each restart history file - ! - !================================================ - else if (flag == 'write') then - !================================================ - - ! Add history filenames to master restart file - do t = 1,ntapes - call ncd_io('locfnh', locfnh(t), 'write', ncid, nt=t) - call ncd_io('locfnhr', locfnhr(t), 'write', ncid, nt=t) - end do - - fincl(:,1) = hist_fincl1(:) - fincl(:,2) = hist_fincl2(:) - fincl(:,3) = hist_fincl3(:) - fincl(:,4) = hist_fincl4(:) - fincl(:,5) = hist_fincl5(:) - fincl(:,6) = hist_fincl6(:) - - fexcl(:,1) = hist_fexcl1(:) - fexcl(:,2) = hist_fexcl2(:) - fexcl(:,3) = hist_fexcl3(:) - fexcl(:,4) = hist_fexcl4(:) - fexcl(:,5) = hist_fexcl5(:) - fexcl(:,6) = hist_fexcl6(:) - - max_nflds = max_nFields() - - start(1)=1 - - - ! - ! Add history namelist data to each history restart tape - ! - allocate(itemp(max_nflds)) - - do t = 1,ntapes - call ncd_io(varname='fincl', data=fincl(:,t), ncid=ncid_hist(t), flag='write') - - call ncd_io(varname='fexcl', data=fexcl(:,t), ncid=ncid_hist(t), flag='write') - - call ncd_io(varname='is_endhist', data=tape(t)%is_endhist, ncid=ncid_hist(t), flag='write') - - call ncd_io(varname='dov2xy', data=tape(t)%dov2xy, ncid=ncid_hist(t), flag='write') - - itemp(:) = 0 - do f=1,tape(t)%nflds - itemp(f) = tape(t)%hlist(f)%field%num2d - end do - call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='write') - - itemp(:) = 0 - do f=1,tape(t)%nflds - itemp(f) = tape(t)%hlist(f)%field%hpindex - end do - call ncd_io(varname='hpindex', data=itemp(:), ncid=ncid_hist(t), flag='write') - - call ncd_io('nflds', tape(t)%nflds, 'write', ncid_hist(t) ) - call ncd_io('ntimes', tape(t)%ntimes, 'write', ncid_hist(t) ) - call ncd_io('nhtfrq', tape(t)%nhtfrq, 'write', ncid_hist(t) ) - call ncd_io('mfilt', tape(t)%mfilt, 'write', ncid_hist(t) ) - call ncd_io('ncprec', tape(t)%ncprec, 'write', ncid_hist(t) ) - call ncd_io('begtime', tape(t)%begtime, 'write', ncid_hist(t) ) - allocate(tmpstr(tape(t)%nflds,6 ),tname(tape(t)%nflds), & - tavgflag(tape(t)%nflds),tunits(tape(t)%nflds),tlongname(tape(t)%nflds)) - do f=1,tape(t)%nflds - tname(f) = tape(t)%hlist(f)%field%name - tunits(f) = tape(t)%hlist(f)%field%units - tlongname(f) = tape(t)%hlist(f)%field%long_name - tmpstr(f,1) = tape(t)%hlist(f)%field%type1d - tmpstr(f,2) = tape(t)%hlist(f)%field%type1d_out - tmpstr(f,3) = tape(t)%hlist(f)%field%type2d - tavgflag(f) = tape(t)%hlist(f)%avgflag - tmpstr(f,4) = tape(t)%hlist(f)%field%p2c_scale_type - tmpstr(f,5) = tape(t)%hlist(f)%field%c2l_scale_type - tmpstr(f,6) = tape(t)%hlist(f)%field%l2g_scale_type - end do - call ncd_io( 'name', tname, 'write',ncid_hist(t)) - call ncd_io('long_name', tlongname, 'write', ncid_hist(t)) - call ncd_io('units', tunits, 'write',ncid_hist(t)) - call ncd_io('type1d', tmpstr(:,1), 'write', ncid_hist(t)) - call ncd_io('type1d_out', tmpstr(:,2), 'write', ncid_hist(t)) - call ncd_io('type2d', tmpstr(:,3), 'write', ncid_hist(t)) - call ncd_io('avgflag',tavgflag , 'write', ncid_hist(t)) - call ncd_io('p2c_scale_type', tmpstr(:,4), 'write', ncid_hist(t)) - call ncd_io('c2l_scale_type', tmpstr(:,5), 'write', ncid_hist(t)) - call ncd_io('l2g_scale_type', tmpstr(:,6), 'write', ncid_hist(t)) - deallocate(tname,tlongname,tunits,tmpstr,tavgflag) - enddo - deallocate(itemp) - - ! - ! Read in namelist information - ! - !================================================ - else if (flag == 'read') then - !================================================ - - call ncd_inqdlen(ncid,dimid,ntapes_onfile, name='ntapes') - if ( is_restart() .and. ntapes_onfile /= ntapes )then - write(iulog,*) 'ntapes = ', ntapes, ' ntapes_onfile = ', ntapes_onfile - call endrun( trim(subname)//' ERROR: number of ntapes different than on restart file!, '// & - ' you can NOT change history options on restart!' ) - end if - if ( is_restart() .and. ntapes > 0 )then - call ncd_io('locfnh', locfnh(1:ntapes), 'read', ncid ) - call ncd_io('locfnhr', locrest(1:ntapes), 'read', ncid ) - do t = 1,ntapes - call strip_null(locrest(t)) - call strip_null(locfnh(t)) - end do - end if - - ! Determine necessary indices - the following is needed if model decomposition is different on restart - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - call get_proc_global(numg, numl, numc, nump) - - start(1)=1 - - do t = 1,ntapes - - call getfil( locrest(t), locfnhr(t), 0 ) - call ncd_pio_openfile (ncid_hist(t), trim(locfnhr(t)), ncd_nowrite) - - if ( t == 1 )then - - call ncd_inqdlen(ncid_hist(1),dimid,max_nflds,name='max_nflds') - - allocate(itemp(max_nflds)) - end if - - call ncd_inqvid(ncid_hist(t), 'name', varid, name_desc) - call ncd_inqvid(ncid_hist(t), 'long_name', varid, longname_desc) - call ncd_inqvid(ncid_hist(t), 'units', varid, units_desc) - call ncd_inqvid(ncid_hist(t), 'type1d', varid, type1d_desc) - call ncd_inqvid(ncid_hist(t), 'type1d_out', varid, type1d_out_desc) - call ncd_inqvid(ncid_hist(t), 'type2d', varid, type2d_desc) - call ncd_inqvid(ncid_hist(t), 'avgflag', varid, avgflag_desc) - call ncd_inqvid(ncid_hist(t), 'p2c_scale_type', varid, p2c_scale_type_desc) - call ncd_inqvid(ncid_hist(t), 'c2l_scale_type', varid, c2l_scale_type_desc) - call ncd_inqvid(ncid_hist(t), 'l2g_scale_type', varid, l2g_scale_type_desc) - - call ncd_io(varname='fincl', data=fincl(:,t), ncid=ncid_hist(t), flag='read') - - call ncd_io(varname='fexcl', data=fexcl(:,t), ncid=ncid_hist(t), flag='read') - - call ncd_io('nflds', tape(t)%nflds, 'read', ncid_hist(t) ) - call ncd_io('ntimes', tape(t)%ntimes, 'read', ncid_hist(t) ) - call ncd_io('nhtfrq', tape(t)%nhtfrq, 'read', ncid_hist(t) ) - call ncd_io('mfilt', tape(t)%mfilt, 'read', ncid_hist(t) ) - call ncd_io('ncprec', tape(t)%ncprec, 'read', ncid_hist(t) ) - call ncd_io('begtime', tape(t)%begtime, 'read', ncid_hist(t) ) - - call ncd_io(varname='is_endhist', data=tape(t)%is_endhist, ncid=ncid_hist(t), flag='read') - call ncd_io(varname='dov2xy', data=tape(t)%dov2xy, ncid=ncid_hist(t), flag='read') - call ncd_io(varname='num2d', data=itemp(:), ncid=ncid_hist(t), flag='read') - do f=1,tape(t)%nflds - tape(t)%hlist(f)%field%num2d = itemp(f) - end do - - call ncd_io(varname='hpindex', data=itemp(:), ncid=ncid_hist(t), flag='read') - do f=1,tape(t)%nflds - tape(t)%hlist(f)%field%hpindex = itemp(f) - end do - - do f=1,tape(t)%nflds - start(2) = f - call ncd_io( name_desc, tape(t)%hlist(f)%field%name, & - 'read', ncid_hist(t), start ) - call ncd_io( longname_desc, tape(t)%hlist(f)%field%long_name, & - 'read', ncid_hist(t), start ) - call ncd_io( units_desc, tape(t)%hlist(f)%field%units, & - 'read', ncid_hist(t), start ) - call ncd_io( type1d_desc, tape(t)%hlist(f)%field%type1d, & - 'read', ncid_hist(t), start ) - call ncd_io( type1d_out_desc, tape(t)%hlist(f)%field%type1d_out, & - 'read', ncid_hist(t), start ) - call ncd_io( type2d_desc, tape(t)%hlist(f)%field%type2d, & - 'read', ncid_hist(t), start ) - call ncd_io( avgflag_desc, tape(t)%hlist(f)%avgflag, & - 'read', ncid_hist(t), start ) - call ncd_io( p2c_scale_type_desc, tape(t)%hlist(f)%field%p2c_scale_type, & - 'read', ncid_hist(t), start ) - call ncd_io( c2l_scale_type_desc, tape(t)%hlist(f)%field%c2l_scale_type, & - 'read', ncid_hist(t), start ) - call ncd_io( l2g_scale_type_desc, tape(t)%hlist(f)%field%l2g_scale_type, & - 'read', ncid_hist(t), start ) - call strip_null(tape(t)%hlist(f)%field%name) - call strip_null(tape(t)%hlist(f)%field%long_name) - call strip_null(tape(t)%hlist(f)%field%units) - call strip_null(tape(t)%hlist(f)%field%type1d) - call strip_null(tape(t)%hlist(f)%field%type1d_out) - call strip_null(tape(t)%hlist(f)%field%type2d) - call strip_null(tape(t)%hlist(f)%field%p2c_scale_type) - call strip_null(tape(t)%hlist(f)%field%c2l_scale_type) - call strip_null(tape(t)%hlist(f)%field%l2g_scale_type) - call strip_null(tape(t)%hlist(f)%avgflag) - - type1d_out = trim(tape(t)%hlist(f)%field%type1d_out) - select case (trim(type1d_out)) - case (grlnd) - num1d_out = numg - beg1d_out = begg - end1d_out = endg - case (nameg) - num1d_out = numg - beg1d_out = begg - end1d_out = endg - case (namel) - num1d_out = numl - beg1d_out = begl - end1d_out = endl - case (namec) - num1d_out = numc - beg1d_out = begc - end1d_out = endc - case (namep) - num1d_out = nump - beg1d_out = begp - end1d_out = endp - case default - write(iulog,*) trim(subname),' ERROR: read unknown 1d output type=',trim(type1d_out) - call endrun () - end select - - tape(t)%hlist(f)%field%num1d_out = num1d_out - tape(t)%hlist(f)%field%beg1d_out = beg1d_out - tape(t)%hlist(f)%field%end1d_out = end1d_out - - num2d = tape(t)%hlist(f)%field%num2d - allocate (tape(t)%hlist(f)%hbuf(beg1d_out:end1d_out,num2d), & - tape(t)%hlist(f)%nacs(beg1d_out:end1d_out,num2d), & - stat=status) - if (status /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation error for hbuf,nacs at t,f=',t,f,beg1d_out,end1d_out,num2d - call endrun() - endif - tape(t)%hlist(f)%hbuf(:,:) = 0._r8 - tape(t)%hlist(f)%nacs(:,:) = 0 - - type1d = tape(t)%hlist(f)%field%type1d - select case (type1d) - case (grlnd) - num1d = numg - beg1d = begg - end1d = endg - case (nameg) - num1d = numg - beg1d = begg - end1d = endg - case (namel) - num1d = numl - beg1d = begl - end1d = endl - case (namec) - num1d = numc - beg1d = begc - end1d = endc - case (namep) - num1d = nump - beg1d = begp - end1d = endp - case default - write(iulog,*) trim(subname),' ERROR: read unknown 1d type=',type1d - call endrun () - end select - - tape(t)%hlist(f)%field%num1d = num1d - tape(t)%hlist(f)%field%beg1d = beg1d - tape(t)%hlist(f)%field%end1d = end1d - - end do ! end of flds loop - - ! If history file is not full, open it - - if (tape(t)%ntimes /= 0) then - call ncd_pio_openfile (nfid(t), trim(locfnh(t)), ncd_write) - end if - - end do ! end of tapes loop - - hist_fincl1(:) = fincl(:,1) - hist_fincl2(:) = fincl(:,2) - hist_fincl3(:) = fincl(:,3) - hist_fincl4(:) = fincl(:,4) - hist_fincl5(:) = fincl(:,5) - hist_fincl6(:) = fincl(:,6) - - hist_fexcl1(:) = fexcl(:,1) - hist_fexcl2(:) = fexcl(:,2) - hist_fexcl3(:) = fexcl(:,3) - hist_fexcl4(:) = fexcl(:,4) - hist_fexcl5(:) = fexcl(:,5) - hist_fexcl6(:) = fexcl(:,6) - - if ( allocated(itemp) ) deallocate(itemp) - - end if - - !====================================================================== - ! Read/write history file restart data. - ! If the current history file(s) are not full, file(s) are opened - ! so that subsequent time samples are added until the file is full. - ! A new history file is used on a branch run. - !====================================================================== - - if (flag == 'write') then - - do t = 1,ntapes - if (.not. tape(t)%is_endhist) then - - do f = 1,tape(t)%nflds - name = tape(t)%hlist(f)%field%name - name_acc = trim(name) // "_acc" - type1d_out = tape(t)%hlist(f)%field%type1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (num2d == 1) then - allocate(hbuf1d(beg1d_out:end1d_out), & - nacs1d(beg1d_out:end1d_out), stat=status) - if (status /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation'; call endrun() - end if - - hbuf1d(beg1d_out:end1d_out) = hbuf(beg1d_out:end1d_out,1) - nacs1d(beg1d_out:end1d_out) = nacs(beg1d_out:end1d_out,1) - - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name), & - dim1name=type1d_out, data=hbuf1d) - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs1d) - - deallocate(hbuf1d) - deallocate(nacs1d) - else - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name), & - dim1name=type1d_out, data=hbuf) - call ncd_io(ncid=ncid_hist(t), flag='write', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs) - end if - - end do - - end if ! end of is_endhist block - - call ncd_pio_closefile(ncid_hist(t)) - - end do ! end of ntapes loop - - else if (flag == 'read') then - - ! Read history restart information if history files are not full - - do t = 1,ntapes - - if (.not. tape(t)%is_endhist) then - - do f = 1,tape(t)%nflds - name = tape(t)%hlist(f)%field%name - name_acc = trim(name) // "_acc" - type1d_out = tape(t)%hlist(f)%field%type1d_out - type2d = tape(t)%hlist(f)%field%type2d - num2d = tape(t)%hlist(f)%field%num2d - beg1d_out = tape(t)%hlist(f)%field%beg1d_out - end1d_out = tape(t)%hlist(f)%field%end1d_out - nacs => tape(t)%hlist(f)%nacs - hbuf => tape(t)%hlist(f)%hbuf - - if (num2d == 1) then - allocate(hbuf1d(beg1d_out:end1d_out), & - nacs1d(beg1d_out:end1d_out), stat=status) - if (status /= 0) then - write(iulog,*) trim(subname),' ERROR: allocation'; call endrun() - end if - - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & - dim1name=type1d_out, data=hbuf1d) - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs1d) - - hbuf(beg1d_out:end1d_out,1) = hbuf1d(beg1d_out:end1d_out) - nacs(beg1d_out:end1d_out,1) = nacs1d(beg1d_out:end1d_out) - - deallocate(hbuf1d) - deallocate(nacs1d) - else - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name), & - dim1name=type1d_out, data=hbuf) - call ncd_io(ncid=ncid_hist(t), flag='read', varname=trim(name_acc), & - dim1name=type1d_out, data=nacs) - end if - end do - - end if - - call ncd_pio_closefile(ncid_hist(t)) - - end do - - end if - - end subroutine hist_restart_ncd - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: max_nFields -! -! !INTERFACE: -integer function max_nFields() -! -! !DESCRIPTION: -! Get the maximum number of fields on all tapes. -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Erik Kluzek -! -! -! !LOCAL VARIABLES: -!EOP - integer :: t ! index - character(len=*),parameter :: subname = 'max_nFields' -!----------------------------------------------------------------------- - max_nFields = 0 - do t = 1,ntapes - max_nFields = max(max_nFields, tape(t)%nflds) - end do - - return - -end function max_nFields - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: getname -! -! !INTERFACE: - character(len=max_namlen) function getname (inname) -! -! !DESCRIPTION: -! Retrieve name portion of inname. If an averaging flag separater character -! is present (:) in inname, lop it off. -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: inname -! -! !REVISION HISTORY: -! Created by Jim Rosinski -! -! -! !LOCAL VARIABLES: -!EOP - integer :: length - integer :: i - character(len=*),parameter :: subname = 'getname' -!----------------------------------------------------------------------- - - length = len (inname) - - if (length < max_namlen .or. length > max_namlen+2) then - write(iulog,*) trim(subname),' ERROR: bad length=',length - call endrun() - end if - - getname = ' ' - do i = 1,max_namlen - if (inname(i:i) == ':') exit - getname(i:i) = inname(i:i) - end do - - end function getname - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: getflag -! -! !INTERFACE: - character(len=1) function getflag (inname) -! -! !DESCRIPTION: -! Retrieve flag portion of inname. If an averaging flag separater character -! is present (:) in inname, return the character after it as the flag -! -! !ARGUMENTS: - implicit none - character(len=*) inname ! character string -! -! !REVISION HISTORY: -! Created by Jim Rosinski -! -! -! !LOCAL VARIABLES: -!EOP - integer :: length ! length of inname - integer :: i ! loop index - character(len=*),parameter :: subname = 'getflag' -!----------------------------------------------------------------------- - - length = len (inname) - - if (length < max_namlen .or. length > max_namlen+2) then - write(iulog,*) trim(subname),' ERROR: bad length=',length - call endrun() - end if - - getflag = ' ' - do i = 1,length - if (inname(i:i) == ':') then - getflag = inname(i+1:i+1) - exit - end if - end do - - end function getflag - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: list_index -! -! !INTERFACE: - subroutine list_index (list, name, index) -! -! !DESCRIPTION: -! -! !USES: -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: list(max_flds) ! input list of names, possibly ":" delimited - character(len=max_namlen), intent(in) :: name ! name to be searched for - integer, intent(out) :: index ! index of "name" in "list" -! -! !REVISION HISTORY: -! Created by Jim Rosinski -! -! -! !LOCAL VARIABLES: -!EOP - character(len=max_namlen) :: listname ! input name with ":" stripped off. - integer f ! field index - character(len=*),parameter :: subname = 'list_index' -!----------------------------------------------------------------------- - - ! Only list items - - index = 0 - do f=1,max_flds - listname = getname (list(f)) - if (listname == ' ') exit - if (listname == name) then - index = f - exit - end if - end do - - end subroutine list_index - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: set_hist_filename -! -! !INTERFACE: - character(len=256) function set_hist_filename (hist_freq, hist_mfilt, hist_file) -! -! !DESCRIPTION: -! Determine history dataset filenames. -! -! !USES: - use clm_varctl, only : caseid, inst_suffix - use clm_time_manager, only : get_curr_date, get_prev_date -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: hist_freq !history file frequency - integer, intent(in) :: hist_mfilt !history file number of time-samples - integer, intent(in) :: hist_file !history file index -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: cdate !date char string - character(len= 1) :: hist_index !p,1 or 2 (currently) - integer :: day !day (1 -> 31) - integer :: mon !month (1 -> 12) - integer :: yr !year (0 -> ...) - integer :: sec !seconds into current day - character(len=*),parameter :: subname = 'set_hist_filename' -!----------------------------------------------------------------------- - - if (hist_freq == 0 .and. hist_mfilt == 1) then !monthly - call get_prev_date (yr, mon, day, sec) - write(cdate,'(i4.4,"-",i2.2)') yr,mon - else !other - call get_curr_date (yr, mon, day, sec) - write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec - endif - write(hist_index,'(i1.1)') hist_file - 1 - set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& - ".h"//hist_index//"."//trim(cdate)//".nc" - - end function set_hist_filename - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_addfld1d -! -! !INTERFACE: - subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & - ptr_gcell, ptr_lunit, ptr_col, ptr_pft, ptr_lnd, & - ptr_atm, p2c_scale_type, c2l_scale_type, & - l2g_scale_type, set_lake, set_urb, set_nourb, & - set_noglcmec, set_spec, default) -! -! !DESCRIPTION: -! Initialize a single level history field. The pointer, ptrhist, -! is a pointer to the clmtype array that the history buffer will use. -! The value of type1d passed to masterlist\_add\_fld determines which of the -! 1d type of the output and the beginning and ending indices the history -! buffer field). Default history contents for given field on all tapes -! are set by calling [masterlist\_make\_active] for the appropriate tape. -! After the masterlist is built, routine [htapes\_build] is called for an -! initial or branch run to initialize the actual history tapes. -! -! !USES: - use clmtype -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: units ! units of field - character(len=1), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - character(len=*), optional, intent(in) :: type1d_out ! output type (from clmtype) - real(r8) , optional, pointer :: ptr_gcell(:) ! pointer to gridcell array - real(r8) , optional, pointer :: ptr_lunit(:) ! pointer to landunit array - real(r8) , optional, pointer :: ptr_col(:) ! pointer to column array - real(r8) , optional, pointer :: ptr_pft(:) ! pointer to pft array - real(r8) , optional, pointer :: ptr_lnd(:) ! pointer to lnd array - real(r8) , optional, pointer :: ptr_atm(:) ! pointer to atm array - real(r8) , optional, intent(in) :: set_lake ! value to set lakes to - real(r8) , optional, intent(in) :: set_urb ! value to set urban to - real(r8) , optional, intent(in) :: set_nourb ! value to set non-urban to - real(r8) , optional, intent(in) :: set_noglcmec ! value to set non-glacier_mec to - real(r8) , optional, intent(in) :: set_spec ! value to set special to - character(len=*), optional, intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), optional, intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: p,c,l,g ! indices - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: hpindex ! history buffer pointer index - character(len=8) :: l_type1d ! 1d data type - character(len=8) :: l_type1d_out ! 1d output type - character(len=8) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column - character(len=8) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits - character(len=8) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - character(len=*),parameter :: subname = 'hist_addfld1d' -!------------------------------------------------------------------------ - - ! Determine processor bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! History buffer pointer - - hpindex = pointer_index() - - if (present(ptr_lnd)) then - l_type1d = grlnd - l_type1d_out = grlnd - clmptr_rs(hpindex)%ptr => ptr_lnd - - else if (present(ptr_gcell)) then - l_type1d = nameg - l_type1d_out = nameg - clmptr_rs(hpindex)%ptr => ptr_gcell - - else if (present(ptr_lunit)) then - l_type1d = namel - l_type1d_out = namel - clmptr_rs(hpindex)%ptr => ptr_lunit - if (present(set_lake)) then - do l = begl,endl - if (lun%lakpoi(l)) ptr_lunit(l) = set_lake - end do - end if - if (present(set_urb)) then - do l = begl,endl - if (lun%urbpoi(l)) ptr_lunit(l) = set_urb - end do - end if - if (present(set_nourb)) then - do l = begl,endl - if (.not.(lun%urbpoi(l))) ptr_lunit(l) = set_nourb - end do - end if - if (present(set_spec)) then - do l = begl,endl - if (lun%ifspecial(l)) ptr_lunit(l) = set_spec - end do - end if - - else if (present(ptr_col)) then - l_type1d = namec - l_type1d_out = namec - clmptr_rs(hpindex)%ptr => ptr_col - if (present(set_lake)) then - do c = begc,endc - l = col%landunit(c) - if (lun%lakpoi(l)) ptr_col(c) = set_lake - end do - end if - if (present(set_urb)) then - do c = begc,endc - l = col%landunit(c) - if (lun%urbpoi(l)) ptr_col(c) = set_urb - end do - end if - if (present(set_nourb)) then - do c = begc,endc - l = col%landunit(c) - if (.not.(lun%urbpoi(l))) ptr_col(c) = set_nourb - end do - end if - if (present(set_spec)) then - do c = begc,endc - l = col%landunit(c) - if (lun%ifspecial(l)) ptr_col(c) = set_spec - end do - end if - if (present(set_noglcmec)) then - do c = begc,endc - l = col%landunit(c) - if (.not.(lun%glcmecpoi(l))) ptr_col(c) = set_noglcmec - end do - endif - - else if (present(ptr_pft)) then - l_type1d = namep - l_type1d_out = namep - clmptr_rs(hpindex)%ptr => ptr_pft - if (present(set_lake)) then - do p = begp,endp - l = pft%landunit(p) - if (lun%lakpoi(l)) ptr_pft(p) = set_lake - end do - end if - if (present(set_urb)) then - do p = begp,endp - l = pft%landunit(p) - if (lun%urbpoi(l)) ptr_pft(p) = set_urb - end do - end if - if (present(set_nourb)) then - do p = begp,endp - l = pft%landunit(p) - if (.not.(lun%urbpoi(l))) ptr_pft(p) = set_nourb - end do - end if - if (present(set_spec)) then - do p = begp,endp - l = pft%landunit(p) - if (lun%ifspecial(l)) ptr_pft(p) = set_spec - end do - end if - if (present(set_noglcmec)) then - do p = begp,endp - l = pft%landunit(p) - if (.not.(lun%glcmecpoi(l))) ptr_pft(p) = set_noglcmec - end do - end if - else - write(iulog,*) trim(subname),' ERROR: must specify a valid pointer index,', & - ' choices are [ptr_atm, ptr_lnd, ptr_gcell, ptr_lunit, ptr_col, ptr_pft] ' - call endrun() - - end if - - ! Set scaling factor - - scale_type_p2c = 'unity' - scale_type_c2l = 'unity' - scale_type_l2g = 'unity' - - if (present(p2c_scale_type)) scale_type_p2c = p2c_scale_type - if (present(c2l_scale_type)) scale_type_c2l = c2l_scale_type - if (present(l2g_scale_type)) scale_type_l2g = l2g_scale_type - if (present(type1d_out)) l_type1d_out = type1d_out - - ! Add field to masterlist - - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d='unset', num2d=1, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g) - - if (present(default)) then - if (trim(default) == 'inactive') return - else - call masterlist_make_active (name=trim(fname), tape_index=1) - end if - - end subroutine hist_addfld1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_addfld2d -! -! !INTERFACE: - subroutine hist_addfld2d (fname, type2d, units, avgflag, long_name, type1d_out, & - ptr_gcell, ptr_lunit, ptr_col, ptr_pft, ptr_lnd, ptr_atm, & - p2c_scale_type, c2l_scale_type, l2g_scale_type, & - set_lake, set_urb, set_nourb, set_spec, default) -! -! !DESCRIPTION: -! Initialize a single level history field. The pointer, ptrhist, -! is a pointer to the clmtype array that the history buffer will use. -! The value of type1d passed to masterlist\_add\_fld determines which of the -! 1d type of the output and the beginning and ending indices the history -! buffer field). Default history contents for given field on all tapes -! are set by calling [masterlist\_make\_active] for the appropriatae tape. -! After the masterlist is built, routine [htapes\_build] is called for an -! initial or branch run to initialize the actual history tapes. -! -! !USES: - use clmtype - use clm_varpar, only : nlevgrnd, nlevlak, numrad, maxpatch_glcmec -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fname ! field name - character(len=*), intent(in) :: type2d ! 2d output type - character(len=*), intent(in) :: units ! units of field - character(len=1), intent(in) :: avgflag ! time averaging flag - character(len=*), intent(in) :: long_name ! long name of field - character(len=*), optional, intent(in) :: type1d_out ! output type (from clmtype) - real(r8) , optional, pointer :: ptr_atm(:,:) ! pointer to atm array - real(r8) , optional, pointer :: ptr_lnd(:,:) ! pointer to lnd array - real(r8) , optional, pointer :: ptr_gcell(:,:) ! pointer to gridcell array - real(r8) , optional, pointer :: ptr_lunit(:,:) ! pointer to landunit array - real(r8) , optional, pointer :: ptr_col(:,:) ! pointer to column array - real(r8) , optional, pointer :: ptr_pft(:,:) ! pointer to pft array - real(r8) , optional, intent(in) :: set_lake ! value to set lakes to - real(r8) , optional, intent(in) :: set_urb ! value to set urban to - real(r8) , optional, intent(in) :: set_nourb ! value to set non-urban to - real(r8) , optional, intent(in) :: set_spec ! value to set special to - character(len=*), optional, intent(in) :: p2c_scale_type ! scale type for subgrid averaging of pfts to column - character(len=*), optional, intent(in) :: c2l_scale_type ! scale type for subgrid averaging of columns to landunits - character(len=*), optional, intent(in) :: l2g_scale_type ! scale type for subgrid averaging of landunits to gridcells - character(len=*), optional, intent(in) :: default ! if set to 'inactive, field will not appear on primary tape -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: p,c,l,g ! indices - integer :: num2d ! size of second dimension (e.g. number of vertical levels) - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: hpindex ! history buffer index - character(len=8) :: l_type1d ! 1d data type - character(len=8) :: l_type1d_out ! 1d output type - character(len=8) :: scale_type_p2c ! scale type for subgrid averaging of pfts to column - character(len=8) :: scale_type_c2l ! scale type for subgrid averaging of columns to landunits - character(len=8) :: scale_type_l2g ! scale type for subgrid averaging of landunits to gridcells - character(len=*),parameter :: subname = 'hist_addfld2d' -!------------------------------------------------------------------------ - - ! Determine second dimension size - - select case (type2d) - case ('levgrnd') - num2d = nlevgrnd - case ('levlak') - num2d = nlevlak - case ('numrad') - num2d = numrad - case ('glc_nec') - if (maxpatch_glcmec > 0) then - num2d = maxpatch_glcmec - else - write(iulog,*) trim(subname),' ERROR: 2d type =', trim(type2d), & - ' only valid for maxpatch_glcmec > 0' - call endrun() - end if - case default - write(iulog,*) trim(subname),' ERROR: unsupported 2d type ',type2d, & - ' currently supported types for multi level fields are [levgrnd,levlak,numrad,glc_nec]' - call endrun() - end select - - ! Determine processor bounds - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! History buffer pointer - - hpindex = pointer_index() - - if (present(ptr_lnd)) then - l_type1d = grlnd - l_type1d_out = grlnd - clmptr_ra(hpindex)%ptr => ptr_lnd - - else if (present(ptr_gcell)) then - l_type1d = nameg - l_type1d_out = nameg - clmptr_ra(hpindex)%ptr => ptr_gcell - - else if (present(ptr_lunit)) then - l_type1d = namel - l_type1d_out = namel - clmptr_ra(hpindex)%ptr => ptr_lunit - if (present(set_lake)) then - do l = begl,endl - if (lun%lakpoi(l)) ptr_lunit(l,:) = set_lake - end do - end if - if (present(set_urb)) then - do l = begl,endl - if (lun%urbpoi(l)) ptr_lunit(l,:) = set_urb - end do - end if - if (present(set_nourb)) then - do l = begl,endl - if (.not.(lun%urbpoi(l))) ptr_lunit(l,:) = set_nourb - end do - end if - if (present(set_spec)) then - do l = begl,endl - if (lun%ifspecial(l)) ptr_lunit(l,:) = set_spec - end do - end if - - else if (present(ptr_col)) then - l_type1d = namec - l_type1d_out = namec - clmptr_ra(hpindex)%ptr => ptr_col - if (present(set_lake)) then - do c = begc,endc - l = col%landunit(c) - if (lun%lakpoi(l)) ptr_col(c,:) = set_lake - end do - end if - if (present(set_urb)) then - do c = begc,endc - l = col%landunit(c) - if (lun%urbpoi(l)) ptr_col(c,:) = set_urb - end do - end if - if (present(set_nourb)) then - do c = begc,endc - l = col%landunit(c) - if (.not.(lun%urbpoi(l))) ptr_col(c,:) = set_nourb - end do - end if - if (present(set_spec)) then - do c = begc,endc - l = col%landunit(c) - if (lun%ifspecial(l)) ptr_col(c,:) = set_spec - end do - end if - - else if (present(ptr_pft)) then - l_type1d = namep - l_type1d_out = namep - clmptr_ra(hpindex)%ptr => ptr_pft - if (present(set_lake)) then - do p = begp,endp - l = pft%landunit(p) - if (lun%lakpoi(l)) ptr_pft(p,:) = set_lake - end do - end if - if (present(set_urb)) then - do p = begp,endp - l = pft%landunit(p) - if (lun%urbpoi(l)) ptr_pft(p,:) = set_urb - end do - end if - if (present(set_nourb)) then - do p = begp,endp - l = pft%landunit(p) - if (.not.(lun%urbpoi(l))) ptr_pft(p,:) = set_nourb - end do - end if - if (present(set_spec)) then - do p = begp,endp - l = pft%landunit(p) - if (lun%ifspecial(l)) ptr_pft(p,:) = set_spec - end do - end if - - else - write(iulog,*) trim(subname),' ERROR: must specify a valid pointer index,', & - ' choices are ptr_atm, ptr_lnd, ptr_gcell, ptr_lunit, ptr_col, ptr_pft' - call endrun() - - end if - - ! Set scaling factor - - scale_type_p2c = 'unity' - scale_type_c2l = 'unity' - scale_type_l2g = 'unity' - - if (present(p2c_scale_type)) scale_type_p2c = p2c_scale_type - if (present(c2l_scale_type)) scale_type_c2l = c2l_scale_type - if (present(l2g_scale_type)) scale_type_l2g = l2g_scale_type - if (present(type1d_out)) l_type1d_out = type1d_out - - ! Add field to masterlist - - call masterlist_addfld (fname=trim(fname), type1d=l_type1d, type1d_out=l_type1d_out, & - type2d=type2d, num2d=num2d, & - units=units, avgflag=avgflag, long_name=long_name, hpindex=hpindex, & - p2c_scale_type=scale_type_p2c, c2l_scale_type=scale_type_c2l, l2g_scale_type=scale_type_l2g) - - if (present(default)) then - if (trim(default) == 'inactive') return - else - call masterlist_make_active (name=trim(fname), tape_index=1) - end if - - end subroutine hist_addfld2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: pointer_index -! -! !INTERFACE: - integer function pointer_index () -! -! !DESCRIPTION: -! Set the current pointer index and increment the value of the index. -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -!EOP - integer, save :: lastindex = 1 - character(len=*),parameter :: subname = 'pointer_index' -!----------------------------------------------------------------------- - - pointer_index = lastindex - lastindex = lastindex + 1 - if (lastindex > max_mapflds) then - write(iulog,*) trim(subname),' ERROR: ',& - ' lastindex = ',lastindex,' greater than max_mapflds= ',max_mapflds - call endrun() - endif - - end function pointer_index - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_add_subscript -! -! !INTERFACE: - subroutine hist_add_subscript(name, dim) -! -! !DESCRIPTION: -! Add a history variable to the output history tape. -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: name ! name of subscript - integer , intent(in) :: dim ! dimension of subscript -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - character(len=*),parameter :: subname = 'hist_add_subscript' -!----------------------------------------------------------------------- - - num_subs = num_subs + 1 - if (num_subs > max_subs) then - write(iulog,*) trim(subname),' ERROR: ',& - ' num_subs = ',num_subs,' greater than max_subs= ',max_subs - call endrun() - endif - subs_name(num_subs) = name - subs_dim(num_subs) = dim - - end subroutine hist_add_subscript - -!----------------------------------------------------------------------- - - subroutine strip_null(str) - character(len=*), intent(inout) :: str - integer :: i - do i=1,len(str) - if(ichar(str(i:i))==0) str(i:i)=' ' - end do - end subroutine strip_null - -!------------------------------------------------------------------------ -!BOP -! -! !ROUTINE: hist_do_disp -! -! !INTERFACE: - subroutine hist_do_disp (ntapes, hist_ntimes, hist_mfilt, if_stop, if_disphist, rstwr, nlend) -! -! !DESCRIPTION: -! Determine logic for closeing and/or disposing history file -! Sets values for if_disphist, if_stop (arguments) -! Remove history files unless this is end of run or -! history file is not full. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_abort - use clm_time_manager, only : is_last_step -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: ntapes !actual number of history tapes - integer, intent(in) :: hist_ntimes(ntapes) !current numbers of time samples on history tape - integer, intent(in) :: hist_mfilt(ntapes) !maximum number of time samples per tape - logical, intent(out) :: if_stop !true => last time step of run - logical, intent(out) :: if_disphist(ntapes) !true => save and dispose history file - logical, intent(in) :: rstwr - logical, intent(in) :: nlend - ! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: t ! history tape index - logical :: rest_now ! temporary - logical :: stop_now ! temporary -!------------------------------------------------------------------------ - - rest_now = .false. - stop_now = .false. - - if (nlend) stop_now = .true. - if (rstwr) rest_now = .true. - - if_stop = stop_now - - if (stop_now) then - ! End of run - dispose all history files - - if_disphist(1:ntapes) = .true. - - else if (rest_now) then - ! Restart - dispose all history files - - do t = 1,ntapes - if_disphist(t) = .true. - end do - else - ! Dispose - - if_disphist(1:ntapes) = .false. - do t = 1,ntapes - if (hist_ntimes(t) == hist_mfilt(t)) then - if_disphist(t) = .true. - endif - end do - endif - - end subroutine hist_do_disp - -end module histFileMod - diff --git a/src_clm40/main/histFldsMod.F90 b/src_clm40/main/histFldsMod.F90 deleted file mode 100644 index 9004215912..0000000000 --- a/src_clm40/main/histFldsMod.F90 +++ /dev/null @@ -1,4599 +0,0 @@ -module histFldsMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: histFldsMod -! -! !DESCRIPTION: -! Module containing initialization of clm history fields and files -! This is the module that the user must modify in order to add new -! history fields or modify defaults associated with existing history -! fields. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - implicit none -! -! !PUBLIC MEMBER FUNCTIONS: - public hist_initFlds ! Build master field list of all possible history - ! file fields -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 03/2003 -! heald (11/28/06) -! -!EOP -!------------------------------------------------------------------------ - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: hist_initFlds -! -! !INTERFACE: - subroutine hist_initFlds() -! -! !DESCRIPTION: -! Build master field list of all possible fields in a history file. -! Each field has associated with it a ``long\_name'' netcdf attribute that -! describes what the field is, and a ``units'' attribute. A subroutine is -! called to add each field to the masterlist. -! -! !USES: - use clmtype - use clm_varcon , only : spval - use clm_varpar , only : maxpatch_glcmec - use clm_atmlnd , only : clm_a2l - use clm_glclnd , only : clm_s2x - use clm_varctl , only : create_glacier_mec_landunit, use_c13, use_cndv, use_cn, use_crop, & - use_snicar_frc - use histFileMod, only : hist_add_subscript, hist_addfld1d, hist_addfld2d, & - hist_printflds - use surfrdMod , only : crop_prog - use shr_megan_mod , only : shr_megan_linkedlist, shr_megan_megcomp_t, shr_megan_megcomps_n - -! -! !ARGUMENTS: - implicit none - - type(shr_megan_megcomp_t), pointer :: meg_cmp - integer :: imeg -! -! !REVISION HISTORY: -! Mariana Vertenstein: Created 03/2003 -! Mariana Vertenstein: Updated interface to create history fields 10/2003 -! -!EOP -!----------------------------------------------------------------------- - - ! Determine what subscripts to add - ! (uncomment the following call and modify it appropriately) - - ! call hist_add_subscript(subname='subscript_name', subdim=subscript_dim) - - ! NOTE: make a field not appear on the primary history tape by default - - ! add the keyword to default='inactive' to the call to addfld_1d or addfld_2d - - ! Snow properties - ! These will be vertically averaged over the snow profile - - call hist_addfld1d (fname='SNOWDP', units='m', & - avgflag='A', long_name='snow height', & - ptr_col=cps%snowdp, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSNO', units='unitless', & - avgflag='A', long_name='fraction of ground covered by snow', & - ptr_col=cps%frac_sno, c2l_scale_type='urbanf') - - ! Temperatures - - call hist_addfld1d (fname='TSA', units='K', & - avgflag='A', long_name='2m air temperature', & - ptr_pft=pes%t_ref2m) - - call hist_addfld1d (fname='TSA_U', units='K', & - avgflag='A', long_name='Urban 2m air temperature', & - ptr_pft=pes%t_ref2m_u, set_nourb=spval) - - call hist_addfld1d (fname='TSA_R', units='K', & - avgflag='A', long_name='Rural 2m air temperature', & - ptr_pft=pes%t_ref2m_r, set_spec=spval) - - call hist_addfld1d(fname='TBUILD', units='K', & - avgflag='A', long_name='internal urban building temperature', & - ptr_lunit=lps%t_building, set_nourb=spval, l2g_scale_type='unity') - - call hist_addfld1d (fname='TREFMNAV', units='K', & - avgflag='A', long_name='daily minimum of average 2-m temperature', & - ptr_pft=pes%t_ref2m_min) - - call hist_addfld1d (fname='TREFMXAV', units='K', & - avgflag='A', long_name='daily maximum of average 2-m temperature', & - ptr_pft=pes%t_ref2m_max) - - call hist_addfld1d (fname='TREFMNAV_U', units='K', & - avgflag='A', long_name='Urban daily minimum of average 2-m temperature', & - ptr_pft=pes%t_ref2m_min_u, set_nourb=spval) - - call hist_addfld1d (fname='TREFMXAV_U', units='K', & - avgflag='A', long_name='Urban daily maximum of average 2-m temperature', & - ptr_pft=pes%t_ref2m_max_u, set_nourb=spval) - - call hist_addfld1d (fname='TREFMNAV_R', units='K', & - avgflag='A', long_name='Rural daily minimum of average 2-m temperature', & - ptr_pft=pes%t_ref2m_min_r, set_spec=spval) - - call hist_addfld1d (fname='TREFMXAV_R', units='K', & - avgflag='A', long_name='Rural daily maximum of average 2-m temperature', & - ptr_pft=pes%t_ref2m_max_r, set_spec=spval) - - call hist_addfld1d (fname='TV', units='K', & - avgflag='A', long_name='vegetation temperature', & - ptr_pft=pes%t_veg) - - call hist_addfld1d (fname='TV24', units='K', & - avgflag='A', long_name='vegetation temperature (last 24hrs)', & - ptr_pft=pvs%t_veg24, default='inactive') - - call hist_addfld1d (fname='TV240', units='K', & - avgflag='A', long_name='vegetation temperature (last 240hrs)', & - ptr_pft=pvs%t_veg240, default='inactive') - - call hist_addfld1d (fname='TG', units='K', & - avgflag='A', long_name='ground temperature', & - ptr_col=ces%t_grnd, c2l_scale_type='urbans') - - call hist_addfld1d (fname='TG_U', units='K', & - avgflag='A', long_name='Urban ground temperature', & - ptr_col=ces%t_grnd_u, set_nourb=spval, c2l_scale_type='urbans') - - call hist_addfld1d (fname='TG_R', units='K', & - avgflag='A', long_name='Rural ground temperature', & - ptr_col=ces%t_grnd_r, set_spec=spval) - - call hist_addfld1d (fname='HCSOI', units='MJ/m2', & - avgflag='A', long_name='soil heat content', & - ptr_col=ces%hc_soi, set_lake=spval, set_urb=spval, l2g_scale_type='veg') - - call hist_addfld1d (fname='HC', units='MJ/m2', & - avgflag='A', long_name='heat content of soil/snow/lake', & - ptr_col=ces%hc_soisno, set_urb=spval) - - call hist_addfld2d (fname='TSOI', units='K', type2d='levgrnd', & - avgflag='A', long_name='soil temperature (vegetated landunits only)', & - ptr_col=ces%t_soisno, l2g_scale_type='veg') - - call hist_addfld2d (fname='TSOI_ICE', units='K', type2d='levgrnd', & - avgflag='A', long_name='soil temperature (ice landunits only)', & - ptr_col=ces%t_soisno, l2g_scale_type='ice') - - call hist_addfld1d (fname='TSOI_10CM', units='K', & - avgflag='A', long_name='soil temperature in top 10cm of soil', & - ptr_col=ces%t_soi_10cm, set_urb=spval) - - call hist_addfld2d (fname='TLAKE', units='K', type2d='levlak', & - avgflag='A', long_name='lake temperature', & - ptr_col=ces%t_lake) - - ! Specific humidity - - call hist_addfld1d (fname='Q2M', units='kg/kg', & - avgflag='A', long_name='2m specific humidity', & - ptr_pft=pes%q_ref2m) - - ! Relative humidity - - call hist_addfld1d (fname='RH2M', units='%', & - avgflag='A', long_name='2m relative humidity', & - ptr_pft=pes%rh_ref2m) - - call hist_addfld1d (fname='RH2M_U', units='%', & - avgflag='A', long_name='Urban 2m relative humidity', & - ptr_pft=pes%rh_ref2m_u, set_nourb=spval) - - call hist_addfld1d (fname='RH2M_R', units='%', & - avgflag='A', long_name='Rural 2m specific humidity', & - ptr_pft=pes%rh_ref2m_r, set_spec=spval) - - ! Wind - - call hist_addfld1d (fname='U10', units='m/s', & - avgflag='A', long_name='10-m wind', & - ptr_pft=pps%u10_clm) - call hist_addfld1d (fname='VA', units='m/s', & - avgflag='A', long_name='atmospheric wind speed plus convective velocity', & - ptr_pft=pps%va, default='inactive') - - ! Surface radiation - - call hist_addfld1d (fname='SABV', units='W/m^2', & - avgflag='A', long_name='solar rad absorbed by veg', & - ptr_pft=pef%sabv, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='SABG', units='W/m^2', & - avgflag='A', long_name='solar rad absorbed by ground', & - ptr_pft=pef%sabg, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSDSVD', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation', & - ptr_pft=pef%fsds_vis_d) - - call hist_addfld1d (fname='FSDSND', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation', & - ptr_pft=pef%fsds_nir_d) - - call hist_addfld1d (fname='FSDSVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation', & - ptr_pft=pef%fsds_vis_i) - - call hist_addfld1d (fname='FSDSNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir incident solar radiation', & - ptr_pft=pef%fsds_nir_i) - - call hist_addfld1d (fname='FSRVD', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation', & - ptr_pft=pef%fsr_vis_d, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSRND', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation', & - ptr_pft=pef%fsr_nir_d, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSRVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis reflected solar radiation', & - ptr_pft=pef%fsr_vis_i, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSRNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir reflected solar radiation', & - ptr_pft=pef%fsr_nir_i, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSDSVDLN', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation at local noon', & - ptr_pft=pef%fsds_vis_d_ln) - - call hist_addfld1d (fname='FSDSNDLN', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation at local noon', & - ptr_pft=pef%fsds_nir_d_ln) - - call hist_addfld1d (fname='FSRVDLN', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation at local noon', & - ptr_pft=pef%fsr_vis_d_ln, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSRNDLN', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation at local noon', & - ptr_pft=pef%fsr_nir_d_ln, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSA', units='W/m^2', & - avgflag='A', long_name='absorbed solar radiation', & - ptr_pft=pef%fsa, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSA_U', units='W/m^2', & - avgflag='A', long_name='Urban absorbed solar radiation', & - ptr_pft=pef%fsa_u, c2l_scale_type='urbanf', set_nourb=spval) - - call hist_addfld1d (fname='FSA_R', units='W/m^2', & - avgflag='A', long_name='Rural absorbed solar radiation', & - ptr_pft=pef%fsa_r, set_spec=spval) - - call hist_addfld1d (fname='FSR', units='W/m^2', & - avgflag='A', long_name='reflected solar radiation', & - ptr_pft=pef%fsr, c2l_scale_type='urbanf') - - ! Rename of FSR for Urban intercomparision project - call hist_addfld1d (fname='SWup', units='W/m^2', & - avgflag='A', long_name='upwelling shortwave radiation', & - ptr_pft=pef%fsr, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='FIRA', units='W/m^2', & - avgflag='A', long_name='net infrared (longwave) radiation', & - ptr_pft=pef%eflx_lwrad_net, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FIRA_U', units='W/m^2', & - avgflag='A', long_name='Urban net infrared (longwave) radiation', & - ptr_pft=pef%eflx_lwrad_net_u, c2l_scale_type='urbanf', set_nourb=spval) - - call hist_addfld1d (fname='FIRA_R', units='W/m^2', & - avgflag='A', long_name='Rural net infrared (longwave) radiation', & - ptr_pft=pef%eflx_lwrad_net_r, set_spec=spval) - - call hist_addfld1d (fname='FIRE', units='W/m^2', & - avgflag='A', long_name='emitted infrared (longwave) radiation', & - ptr_pft=pef%eflx_lwrad_out, c2l_scale_type='urbanf') - - ! Rename of FIRE for Urban intercomparision project - call hist_addfld1d (fname='LWup', units='W/m^2', & - avgflag='A', long_name='upwelling longwave radiation', & - ptr_pft=pef%eflx_lwrad_out, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='BUILDHEAT', units='W/m^2', & - avgflag='A', long_name='heat flux from urban building interior to walls and roof', & - ptr_col=cef%eflx_building_heat, set_nourb=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='URBAN_AC', units='W/m^2', & - avgflag='A', long_name='urban air conditioning flux', & - ptr_col=cef%eflx_urban_ac, set_nourb=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='URBAN_HEAT', units='W/m^2', & - avgflag='A', long_name='urban heating flux', & - ptr_col=cef%eflx_urban_heat, set_nourb=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='TRAFFICFLUX', units='W/m^2', & - avgflag='A', long_name='sensible heat flux from urban traffic', & - ptr_pft=pef%eflx_traffic_pft, set_nourb=0._r8, c2l_scale_type='urbanf', & - default='inactive') - - call hist_addfld1d (fname='WASTEHEAT', units='W/m^2', & - avgflag='A', long_name='sensible heat flux from heating/cooling sources of urban waste heat', & - ptr_pft=pef%eflx_wasteheat_pft, set_nourb=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='HEAT_FROM_AC', units='W/m^2', & - avgflag='A', long_name='sensible heat flux put into canyon due to heat removed from air conditioning', & - ptr_pft=pef%eflx_heat_from_ac_pft, set_nourb=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='Qanth', units='W/m^2', & - avgflag='A', long_name='anthropogenic heat flux', & - ptr_pft=pef%eflx_anthro, set_nourb=0._r8, c2l_scale_type='urbanf', & - default='inactive') - - call hist_addfld1d (fname='Rnet', units='W/m^2', & - avgflag='A', long_name='net radiation', & - ptr_pft=pef%netrad, c2l_scale_type='urbanf', & - default='inactive') - - ! Solar zenith angle and solar declination angle - - call hist_addfld1d (fname='COSZEN', units='none', & - avgflag='A', long_name='cosine of solar zenith angle', & - ptr_col=cps%coszen, default='inactive') - - call hist_addfld1d (fname='DECL', units='radians', & - avgflag='A', long_name='solar declination angle', & - ptr_col=cps%decl, default='inactive') - - ! Surface energy fluxes - - call hist_addfld1d (fname='FCTR', units='W/m^2', & - avgflag='A', long_name='canopy transpiration', & - ptr_pft=pef%eflx_lh_vegt, set_lake=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FCEV', units='W/m^2', & - avgflag='A', long_name='canopy evaporation', & - ptr_pft=pef%eflx_lh_vege, set_lake=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FGEV', units='W/m^2', & - avgflag='A', long_name='ground evaporation', & - ptr_pft=pef%eflx_lh_grnd, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSH_NODYNLNDUSE', units='W/m^2', & - avgflag='A', long_name='sensible heat not including correction for land use change', & - ptr_pft=pef%eflx_sh_tot, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSH', units='W/m^2', & - avgflag='A', long_name='sensible heat', & - ptr_lnd=gef%eflx_sh_totg) - - call hist_addfld1d (fname='FSH_U', units='W/m^2', & - avgflag='A', long_name='Urban sensible heat', & - ptr_pft=pef%eflx_sh_tot_u, c2l_scale_type='urbanf', set_nourb=spval) - - call hist_addfld1d (fname='FSH_R', units='W/m^2', & - avgflag='A', long_name='Rural sensible heat', & - ptr_pft=pef%eflx_sh_tot_r, set_spec=spval) - - call hist_addfld1d (fname='GC_HEAT1', units='J/m^2', & - avgflag='A', long_name='initial gridcell total heat content', & - ptr_lnd=ges%gc_heat1) - - call hist_addfld1d (fname='GC_HEAT2', units='J/m^2', & - avgflag='A', long_name='post land cover change total heat content', & - ptr_lnd=ges%gc_heat2, default='inactive') - - call hist_addfld1d (fname='EFLX_DYNBAL', units='W/m^2', & - avgflag='A', long_name='dynamic land cover change conversion energy flux', & - ptr_lnd=gef%eflx_dynbal) - - call hist_addfld1d (fname='Qh', units='W/m^2', & - avgflag='A', long_name='sensible heat', & - ptr_pft=pef%eflx_sh_tot, c2l_scale_type='urbanf', & - default = 'inactive') - - call hist_addfld1d (fname='Qle', units='W/m^2', & - avgflag='A', long_name='total evaporation', & - ptr_pft=pef%eflx_lh_tot, c2l_scale_type='urbanf', & - default = 'inactive') - - call hist_addfld1d (fname='EFLX_LH_TOT_U', units='W/m^2', & - avgflag='A', long_name='Urban total evaporation', & - ptr_pft=pef%eflx_lh_tot_u, c2l_scale_type='urbanf', set_nourb=spval) - - call hist_addfld1d (fname='EFLX_LH_TOT_R', units='W/m^2', & - avgflag='A', long_name='Rural total evaporation', & - ptr_pft=pef%eflx_lh_tot_r, set_spec=spval) - - call hist_addfld1d (fname='Qstor', units='W/m^2', & - avgflag='A', long_name='storage heat flux (includes snowmelt)', & - ptr_pft=pef%eflx_soil_grnd, c2l_scale_type='urbanf', & - default = 'inactive') - - call hist_addfld1d (fname='FSH_V', units='W/m^2', & - avgflag='A', long_name='sensible heat from veg', & - ptr_pft=pef%eflx_sh_veg, set_lake=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSH_G', units='W/m^2', & - avgflag='A', long_name='sensible heat from ground', & - ptr_pft=pef%eflx_sh_grnd, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FGR', units='W/m^2', & - avgflag='A', long_name='heat flux into soil/snow including snow melt', & - ptr_pft=pef%eflx_soil_grnd, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FGR_U', units='W/m^2', & - avgflag='A', long_name='Urban heat flux into soil/snow including snow melt', & - ptr_pft=pef%eflx_soil_grnd_u, c2l_scale_type='urbanf', set_nourb=spval) - - call hist_addfld1d (fname='FGR_R', units='W/m^2', & - avgflag='A', long_name='Rural heat flux into soil/snow including snow melt', & - ptr_pft=pef%eflx_soil_grnd_r, set_spec=spval) - - call hist_addfld1d (fname='FSM', units='W/m^2', & - avgflag='A', long_name='snow melt heat flux', & - ptr_col=cef%eflx_snomelt, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='FSM_U', units='W/m^2', & - avgflag='A', long_name='Urban snow melt heat flux', & - ptr_col=cef%eflx_snomelt_u, c2l_scale_type='urbanf', set_nourb=spval) - - call hist_addfld1d (fname='FSM_R', units='W/m^2', & - avgflag='A', long_name='Rural snow melt heat flux', & - ptr_col=cef%eflx_snomelt_r, set_spec=spval) - - call hist_addfld1d (fname='FGR12', units='W/m^2', & - avgflag='A', long_name='heat flux between soil layers 1 and 2', & - ptr_col=cef%eflx_fgr12, set_lake=spval) - - call hist_addfld1d (fname='TAUX', units='kg/m/s^2', & - avgflag='A', long_name='zonal surface stress', & - ptr_pft=pmf%taux) - - ! Rename of TAUX for Urban intercomparision project (when U=V) - call hist_addfld1d (fname='Qtau', units='kg/m/s^2', & - avgflag='A', long_name='momentum flux', & - ptr_pft=pmf%taux, default='inactive') - - call hist_addfld1d (fname='TAUY', units='kg/m/s^2', & - avgflag='A', long_name='meridional surface stress', & - ptr_pft=pmf%tauy) - - ! Vegetation phenology - - call hist_addfld1d (fname='ELAI', units='m^2/m^2', & - avgflag='A', long_name='exposed one-sided leaf area index', & - ptr_pft=pps%elai) - - call hist_addfld1d (fname='ESAI', units='m^2/m^2', & - avgflag='A', long_name='exposed one-sided stem area index', & - ptr_pft=pps%esai) - - call hist_addfld1d (fname='LAISUN', units='none', & - avgflag='A', long_name='sunlit projected leaf area index', & - ptr_pft=pps%laisun, set_urb=0._r8) - - call hist_addfld1d (fname='LAISHA', units='none', & - avgflag='A', long_name='shaded projected leaf area index', & - ptr_pft=pps%laisha, set_urb=0._r8) - - call hist_addfld1d (fname='TLAI', units='none', & - avgflag='A', long_name='total projected leaf area index', & - ptr_pft=pps%tlai) - - call hist_addfld1d (fname='TSAI', units='none', & - avgflag='A', long_name='total projected stem area index', & - ptr_pft=pps%tsai) - - call hist_addfld1d (fname='SLASUN', units='m^2/gC', & - avgflag='A', long_name='specific leaf area for sunlit canopy, projected area basis', & - ptr_pft=pps%slasun, set_urb=0._r8, default='inactive') - - call hist_addfld1d (fname='SLASHA', units='m^2/gC', & - avgflag='A', long_name='specific leaf area for shaded canopy, projected area basis', & - ptr_pft=pps%slasha, set_urb=0._r8, default='inactive') - - ! Canopy physiology - - call hist_addfld1d (fname='RSSUN', units='s/m', & - avgflag='M', long_name='sunlit leaf stomatal resistance', & - ptr_pft=pps%rssun, set_lake=spval, set_urb=spval, & - default='inactive') - - call hist_addfld1d (fname='RSSHA', units='s/m', & - avgflag='M', long_name='shaded leaf stomatal resistance', & - ptr_pft=pps%rssha, set_lake=spval, set_urb=spval, & - default='inactive') - - call hist_addfld1d (fname='BTRAN', units='unitless', & - avgflag='A', long_name='transpiration beta factor', & - ptr_pft=pps%btran, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='FPSN', units='umol/m2s', & - avgflag='A', long_name='photosynthesis', & - ptr_pft=pcf%fpsn, set_lake=0._r8, set_urb=0._r8) - - call hist_addfld1d (fname='DSTFLXT', units='kg/m2/s', & - avgflag='A', long_name='total surface dust emission', & - ptr_pft=pdf%flx_mss_vrt_dst_tot, set_lake=0._r8, set_urb=0._r8) - call hist_addfld1d (fname='DPVLTRB1', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 1', & - ptr_pft=pdf%vlc_trb_1, default='inactive') - call hist_addfld1d (fname='DPVLTRB2', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 2', & - ptr_pft=pdf%vlc_trb_2, default='inactive') - call hist_addfld1d (fname='DPVLTRB3', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 3', & - ptr_pft=pdf%vlc_trb_3, default='inactive') - call hist_addfld1d (fname='DPVLTRB4', units='m/s', & - avgflag='A', long_name='turbulent deposition velocity 4', & - ptr_pft=pdf%vlc_trb_4, default='inactive') - - ! for MEGAN emissions diagnositics - if (shr_megan_megcomps_n>0) then - - ! loop over megan compounds - meg_cmp => shr_megan_linkedlist - do while(associated(meg_cmp)) - imeg = meg_cmp%index - - call hist_addfld1d ( fname='MEG_'//trim(meg_cmp%name), units='kg/m2/sec', & - avgflag='A', long_name='MEGAN flux', & - ptr_pft=pvf%meg(imeg)%flux_out, set_lake=0._r8, set_urb=0._r8 ) - - meg_cmp => meg_cmp%next_megcomp - enddo - - call hist_addfld1d (fname='VOCFLXT', units='moles/m2/sec', & - avgflag='A', long_name='total VOC flux into atmosphere', & - ptr_pft=pvf%vocflx_tot, set_lake=0._r8, set_urb=0._r8) - - call hist_addfld1d (fname='GAMMA', units='non', & - avgflag='A', long_name='total gamma for VOC calc', & - ptr_pft=pvf%gamma_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='GAMMAL', units='non', & - avgflag='A', long_name='gamma L for VOC calc', & - ptr_pft=pvf%gammaL_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='GAMMAT', units='non', & - avgflag='A', long_name='gamma T for VOC calc', & - ptr_pft=pvf%gammaT_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='GAMMAP', units='non', & - avgflag='A', long_name='gamma P for VOC calc', & - ptr_pft=pvf%gammaP_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='GAMMAA', units='non', & - avgflag='A', long_name='gamma A for VOC calc', & - ptr_pft=pvf%gammaA_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='GAMMAS', units='non', & - avgflag='A', long_name='gamma S for VOC calc', & - ptr_pft=pvf%gammaS_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='GAMMAC', units='non', & - avgflag='A', long_name='gamma C for VOC calc', & - ptr_pft=pvf%gammaC_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='EOPT', units='non', & - avgflag='A', long_name='Eopt coefficient for VOC calc', & - ptr_pft=pvf%Eopt_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='TOPT', units='non', & - avgflag='A', long_name='topt coefficient for VOC calc', & - ptr_pft=pvf%topt_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='ALPHA', units='non', & - avgflag='A', long_name='alpha coefficient for VOC calc', & - ptr_pft=pvf%alpha_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='CP', units='non', & - avgflag='A', long_name='cp coefficient for VOC calc', & - ptr_pft=pvf%cp_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='PAR_sun', units='umol/m2/s', & - avgflag='A', long_name='sunlit PAR', & - ptr_pft=pvf%paru_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='PAR24_sun', units='umol/m2/s', & - avgflag='A', long_name='sunlit PAR (24 hrs)', & - ptr_pft=pvf%par24u_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='PAR240_sun', units='umol/m2/s', & - avgflag='A', long_name='sunlit PAR (240 hrs)', & - ptr_pft=pvf%par240u_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='PAR_shade', units='umol/m2/s', & - avgflag='A', long_name='shade PAR', & - ptr_pft=pvf%para_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='PAR24_shade', units='umol/m2/s', & - avgflag='A', long_name='shade PAR (24 hrs)', & - ptr_pft=pvf%par24a_out, set_lake=0._r8, default='inactive') - - call hist_addfld1d (fname='PAR240_shade', units='umol/m2/s', & - avgflag='A', long_name='shade PAR (240 hrs)', & - ptr_pft=pvf%par240a_out, set_lake=0._r8, default='inactive') - - endif - - call hist_addfld1d (fname='FSUN24', units='K', & - avgflag='A', long_name='fraction sunlit (last 24hrs)', & - ptr_pft=pvs%fsun24, default='inactive') - - call hist_addfld1d (fname='FSUN240', units='K', & - avgflag='A', long_name='fraction sunlit (last 240hrs)', & - ptr_pft=pvs%fsun240, default='inactive') - - call hist_addfld1d (fname='FSI24', units='K', & - avgflag='A', long_name='indirect radiation (last 24hrs)', & - ptr_pft=pvs%fsi24, default='inactive') - - call hist_addfld1d (fname='FSI240', units='K', & - avgflag='A', long_name='indirect radiation (last 240hrs)', & - ptr_pft=pvs%fsi240, default='inactive') - - call hist_addfld1d (fname='FSD24', units='K', & - avgflag='A', long_name='direct radiation (last 24hrs)', & - ptr_pft=pvs%fsd24, default='inactive') - - call hist_addfld1d (fname='FSD240', units='K', & - avgflag='A', long_name='direct radiation (last 240hrs)', & - ptr_pft=pvs%fsd240, default='inactive') - - ! Hydrology - - call hist_addfld1d (fname='SoilAlpha', units='unitless', & - avgflag='A', long_name='factor limiting ground evap', & - ptr_col=cws%soilalpha, set_urb=spval) - - call hist_addfld1d (fname='SoilAlpha_U', units='unitless', & - avgflag='A', long_name='urban factor limiting ground evap', & - ptr_col=cws%soilalpha_u, set_nourb=spval) - - call hist_addfld1d (fname='FCOV', units='unitless', & - avgflag='A', long_name='fractional impermeable area', & - ptr_col=cws%fcov, l2g_scale_type='veg') - call hist_addfld1d (fname='FSAT', units='unitless', & - avgflag='A', long_name='fractional area with water table at surface', & - ptr_col=cws%fsat, l2g_scale_type='veg') - call hist_addfld1d (fname='ZWT', units='m', & - avgflag='A', long_name='water table depth (vegetated landunits only)', & - ptr_col=cws%zwt, l2g_scale_type='veg') - - call hist_addfld1d (fname='WA', units='mm', & - avgflag='A', long_name='water in the unconfined aquifer (vegetated landunits only)', & - ptr_col=cws%wa, l2g_scale_type='veg') - - call hist_addfld1d (fname='WT', units='mm', & - avgflag='A', long_name='total water storage (unsaturated soil water + groundwater, veg landunits)', & - ptr_col=cws%wt, l2g_scale_type='veg') - - call hist_addfld1d (fname='QCHARGE', units='mm/s', & - avgflag='A', long_name='aquifer recharge rate (vegetated landunits only)', & - ptr_col=cws%qcharge, l2g_scale_type='veg') - - call hist_addfld2d (fname='SMP', units='mm', type2d='levgrnd', & - avgflag='A', long_name='soil matric potential (vegetated landunits only)', & - ptr_col=cws%smp_l, set_spec=spval, l2g_scale_type='veg', default='inactive') - - call hist_addfld2d (fname='HK', units='mm/s', type2d='levgrnd', & - avgflag='A', long_name='hydraulic conductivity (vegetated landunits only)', & - ptr_col=cws%hk_l, set_spec=spval, l2g_scale_type='veg', default='inactive') - - call hist_addfld1d (fname='H2OSNO', units='mm', & - avgflag='A', long_name='snow depth (liquid water)', & - ptr_col=cws%h2osno, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='ERRH2OSNO', units='mm', & - avgflag='A', long_name='imbalance in snow depth (liquid water)', & - ptr_col=cws%errh2osno, c2l_scale_type='urbanf') - - ! As defined here, snow_sources - snow_sinks will equal the change in h2osno at - ! any given time step but only if there is at least one snow layer (for all landunits - ! except lakes). h2osno also includes snow that is part of the soil column (an - ! initial snow layer is only created if h2osno > 10mm). Also note that monthly average - ! files of snow_sources and snow sinks must be weighted by number of days in the month to - ! diagnose, for example, an annual value of the change in h2osno. - - call hist_addfld1d (fname='SNOW_SOURCES', units='mm/s', & - avgflag='A', long_name='snow sources (liquid water)', & - ptr_col=cws%snow_sources, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='SNOW_SINKS', units='mm/s', & - avgflag='A', long_name='snow sinks (liquid water)', & - ptr_col=cws%snow_sinks, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='H2OCAN', units='mm', & - avgflag='A', long_name='intercepted water', & - ptr_pft=pws%h2ocan, set_lake=0._r8) - - call hist_addfld2d (fname='H2OSOI', units='mm3/mm3', type2d='levgrnd', & - avgflag='A', long_name='volumetric soil water (vegetated landunits only)', & - ptr_col=cws%h2osoi_vol, l2g_scale_type='veg') - - call hist_addfld2d (fname='SOILLIQ', units='kg/m2', type2d='levgrnd', & - avgflag='A', long_name='soil liquid water (vegetated landunits only)', & - ptr_col=cws%h2osoi_liq, l2g_scale_type='veg') - - call hist_addfld2d (fname='SOILICE', units='kg/m2', type2d='levgrnd', & - avgflag='A', long_name='soil ice (vegetated landunits only)', & - ptr_col=cws%h2osoi_ice, l2g_scale_type='veg') - - call hist_addfld1d (fname='SOILWATER_10CM', units='kg/m2', & - avgflag='A', long_name='soil liquid water + ice in top 10cm of soil (veg landunits only)', & - ptr_col=cws%h2osoi_liqice_10cm, set_urb=spval, l2g_scale_type='veg') - - call hist_addfld1d (fname='SNOWLIQ', units='kg/m2', & - avgflag='A', long_name='snow liquid water', & - ptr_col=cws%snowliq) - - call hist_addfld1d (fname='SNOWICE', units='kg/m2', & - avgflag='A', long_name='snow ice', & - ptr_col=cws%snowice) - - call hist_addfld1d (fname='QTOPSOIL', units='mm/s', & - avgflag='A', long_name='water input to surface', & - ptr_col=cwf%qflx_top_soil, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QINFL', units='mm/s', & - avgflag='A', long_name='infiltration', & - ptr_col=cwf%qflx_infl, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QOVER', units='mm/s', & - avgflag='A', long_name='surface runoff', & - ptr_col=cwf%qflx_surf, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QRGWL', units='mm/s', & - avgflag='A', long_name='surface runoff at glaciers (liquid only), wetlands, lakes', & - ptr_col=cwf%qflx_qrgwl, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSNWCPLIQ', units='mm H2O/s', & - avgflag='A', long_name='excess rainfall due to snow capping', & - ptr_pft=pwf%qflx_snwcp_liq, c2l_scale_type='urbanf', default='inactive') - - call hist_addfld1d (fname='QSNWCPICE_NODYNLNDUSE', units='mm H2O/s', & - avgflag='A', & - long_name='excess snowfall due to snow capping not including correction for land use change', & - ptr_pft=pwf%qflx_snwcp_ice, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSNWCPICE', units='mm/s', & - avgflag='A', long_name='excess snowfall due to snow capping', & - ptr_lnd=gwf%qflx_snwcp_iceg) - - call hist_addfld1d (fname='QDRAI', units='mm/s', & - avgflag='A', long_name='sub-surface drainage', & - ptr_col=cwf%qflx_drain, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QRUNOFF_NODYNLNDUSE', units='mm/s', & - avgflag='A', & - long_name='total liquid runoff (does not include QSNWCPICE) not including correction for land use change', & - ptr_col=cwf%qflx_runoff, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QRUNOFF', units='mm/s', & - avgflag='A', long_name='total liquid runoff (does not include QSNWCPICE)', & - ptr_lnd=gwf%qflx_runoffg) - - call hist_addfld1d (fname='GC_LIQ1', units='mm', & - avgflag='A', long_name='initial gridcell total liq content', & - ptr_lnd=gws%gc_liq1) - - call hist_addfld1d (fname='GC_LIQ2', units='mm', & - avgflag='A', long_name='post landuse change gridcell total liq content', & - ptr_lnd=gws%gc_liq2, default='inactive') - - call hist_addfld1d (fname='QFLX_LIQ_DYNBAL', units='mm/s', & - avgflag='A', long_name='liq dynamic land cover change conversion runoff flux', & - ptr_lnd=gwf%qflx_liq_dynbal) - - call hist_addfld1d (fname='GC_ICE1', units='mm', & - avgflag='A', long_name='initial gridcell total ice content', & - ptr_lnd=gws%gc_ice1) - - call hist_addfld1d (fname='GC_ICE2', units='mm', & - avgflag='A', long_name='post land cover change total ice content', & - ptr_lnd=gws%gc_ice2, default='inactive') - - call hist_addfld1d (fname='QFLX_ICE_DYNBAL', units='mm/s', & - avgflag='A', long_name='ice dynamic land cover change conversion runoff flux', & - ptr_lnd=gwf%qflx_ice_dynbal) - - call hist_addfld1d (fname='QRUNOFF_U', units='mm/s', & - avgflag='A', long_name='Urban total runoff', & - ptr_col=cwf%qflx_runoff_u, set_nourb=spval, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QRUNOFF_R', units='mm/s', & - avgflag='A', long_name='Rural total runoff', & - ptr_col=cwf%qflx_runoff_r, set_spec=spval) - - call hist_addfld1d (fname='QINTR', units='mm/s', & - avgflag='A', long_name='interception', & - ptr_pft=pwf%qflx_prec_intr, set_lake=0._r8) - - call hist_addfld1d (fname='QDRIP', units='mm/s', & - avgflag='A', long_name='throughfall', & - ptr_pft=pwf%qflx_prec_grnd, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSNOMELT', units='mm/s', & - avgflag='A', long_name='snow melt', & - ptr_col=cwf%qflx_snomelt, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSNOFRZ', units='kg/m2/s', & - avgflag='A', long_name='column-integrated snow freezing rate', & - ptr_col=cwf%qflx_snofrz_col, default='inactive', & - set_lake=spval, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QSOIL', units='mm/s', & - avgflag='A', long_name= & - 'Ground evaporation (soil/snow evaporation + soil/snow sublimation - dew)', & - ptr_pft=pwf%qflx_evap_soi, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QVEGE', units='mm/s', & - avgflag='A', long_name='canopy evaporation', & - ptr_pft=pwf%qflx_evap_can, set_lake=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QVEGT', units='mm/s', & - avgflag='A', long_name='canopy transpiration', & - ptr_pft=pwf%qflx_tran_veg, set_lake=0._r8, c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QIRRIG', units='mm/s', & - avgflag='A', long_name='water added through irrigation', & - ptr_col=cwf%qflx_irrig, set_lake=0._r8) - - if (create_glacier_mec_landunit) then - - call hist_addfld1d (fname='QICE', units='mm/s', & - avgflag='A', long_name='ice growth/melt', & - ptr_col=cwf%qflx_glcice, set_noglcmec=spval) - - call hist_addfld1d (fname='QICE_FRZ', units='mm/s', & - avgflag='A', long_name='ice growth', & - ptr_col=cwf%qflx_glcice_frz, set_noglcmec=spval) - - call hist_addfld1d (fname='QICE_MELT', units='mm/s', & - avgflag='A', long_name='ice melt', & - ptr_col=cwf%qflx_glcice_melt, set_noglcmec=spval) - - call hist_addfld1d (fname='gris_mask', units='unitless', & - avgflag='A', long_name='Greenland mask', & - ptr_gcell=grc%gris_mask) - - call hist_addfld1d (fname='gris_area', units='km^2', & - avgflag='A', long_name='Greenland ice area', & - ptr_gcell=grc%gris_area) - - call hist_addfld1d (fname='aais_mask', units='unitless', & - avgflag='A', long_name='Antarctic mask', & - ptr_gcell=grc%aais_mask) - - call hist_addfld1d (fname='aais_area', units='km^2', & - avgflag='A', long_name='Antarctic ice area', & - ptr_gcell=grc%aais_area) - - endif - - ! Water and energy balance checks - - call hist_addfld1d (fname='ERRSOI', units='W/m^2', & - avgflag='A', long_name='soil/lake energy conservation error', & - ptr_col=cebal%errsoi) - - call hist_addfld1d (fname='ERRSEB', units='W/m^2', & - avgflag='A', long_name='surface energy conservation error', & - ptr_pft=pebal%errseb) - - call hist_addfld1d (fname='ERRSOL', units='W/m^2', & - avgflag='A', long_name='solar radiation conservation error', & - ptr_pft=pebal%errsol, set_urb=spval) - - call hist_addfld1d (fname='ERRH2O', units='mm', & - avgflag='A', long_name='total water conservation error', & - ptr_col=cwbal%errh2o) - - ! Atmospheric forcing - - call hist_addfld1d (fname='RAIN', units='mm/s', & - avgflag='A', long_name='atmospheric rain', & - ptr_lnd=clm_a2l%forc_rain) - - call hist_addfld1d (fname='SNOW', units='mm/s', & - avgflag='A', long_name='atmospheric snow', & - ptr_lnd=clm_a2l%forc_snow) - - call hist_addfld1d (fname='TBOT', units='K', & - avgflag='A', long_name='atmospheric air temperature', & - ptr_lnd=clm_a2l%forc_t) - - call hist_addfld1d (fname='THBOT', units='K', & - avgflag='A', long_name='atmospheric air potential temperature', & - ptr_lnd=clm_a2l%forc_th) - - call hist_addfld1d (fname='WIND', units='m/s', & - avgflag='A', long_name='atmospheric wind velocity magnitude', & - ptr_lnd=clm_a2l%forc_wind) - - ! Rename of WIND for Urban intercomparision project - call hist_addfld1d (fname='Wind', units='m/s', & - avgflag='A', long_name='atmospheric wind velocity magnitude', & - ptr_gcell=clm_a2l%forc_wind, default = 'inactive') - - call hist_addfld1d (fname='Tair', units='K', & - avgflag='A', long_name='atmospheric air temperature', & - ptr_gcell=clm_a2l%forc_t, default='inactive') - - call hist_addfld1d (fname='PSurf', units='Pa', & - avgflag='A', long_name='surface pressure', & - ptr_gcell=clm_a2l%forc_pbot, default='inactive') - - call hist_addfld1d (fname='Rainf', units='mm/s', & - avgflag='A', long_name='atmospheric rain', & - ptr_gcell=clm_a2l%forc_rain, default='inactive') - - call hist_addfld1d (fname='SWdown', units='W/m^2', & - avgflag='A', long_name='atmospheric incident solar radiation', & - ptr_gcell=clm_a2l%forc_solar, default='inactive') - - call hist_addfld1d (fname='LWdown', units='W/m^2', & - avgflag='A', long_name='atmospheric longwave radiation', & - ptr_gcell=clm_a2l%forc_lwrad, default='inactive') - - call hist_addfld1d (fname='RH', units='%', & - avgflag='A', long_name='atmospheric relative humidity', & - ptr_gcell=clm_a2l%forc_rh, default='inactive') - - call hist_addfld1d (fname='QBOT', units='kg/kg', & - avgflag='A', long_name='atmospheric specific humidity', & - ptr_lnd=clm_a2l%forc_q) - - ! Rename of QBOT for Urban intercomparision project - call hist_addfld1d (fname='Qair', units='kg/kg', & - avgflag='A', long_name='atmospheric specific humidity', & - ptr_lnd=clm_a2l%forc_q, default='inactive') - - call hist_addfld1d (fname='ZBOT', units='m', & - avgflag='A', long_name='atmospheric reference height', & - ptr_lnd=clm_a2l%forc_hgt) - - call hist_addfld1d (fname='FLDS', units='W/m^2', & - avgflag='A', long_name='atmospheric longwave radiation', & - ptr_lnd=clm_a2l%forc_lwrad) - - call hist_addfld1d (fname='FSDS', units='W/m^2', & - avgflag='A', long_name='atmospheric incident solar radiation', & - ptr_lnd=clm_a2l%forc_solar) - - call hist_addfld1d (fname='PCO2', units='Pa', & - avgflag='A', long_name='atmospheric partial pressure of CO2', & - ptr_lnd=clm_a2l%forc_pco2) - - call hist_addfld1d (fname='PBOT', units='Pa', & - avgflag='A', long_name='atmospheric pressure', & - ptr_lnd=clm_a2l%forc_pbot) - - if (use_cndv .or. use_crop) then - call hist_addfld1d (fname='T10', units='K', & - avgflag='A', long_name='10-day running mean of 2-m temperature', & - ptr_pft=pes%t10) - end if - - if (use_cndv) then - call hist_addfld1d (fname='TDA', units='K', & - avgflag='A', long_name='daily average 2-m temperature', & - ptr_pft=pdgvs%t_mo) - - call hist_addfld1d (fname='AGDD', units='K', & - avgflag='A', long_name='growing degree-days base 5C', & - ptr_pft=pdgvs%agdd) - end if - - if (use_cn) then - call hist_addfld2d (fname='SOILPSI', units='MPa', type2d='levgrnd', & - avgflag='A', long_name='soil water potential in each soil layer', & - ptr_col=cps%soilpsi) - end if - - if (use_cn) then - ! add history fields for all CN variables, always set as default='inactive' - if ( crop_prog )then - - call hist_addfld1d (fname='A5TMIN', units='K', & - avgflag='A', long_name='5-day running mean of min 2-m temperature', & - ptr_pft=pes%a5tmin, default='inactive') - - call hist_addfld1d (fname='A10TMIN', units='K', & - avgflag='A', long_name='10-day running mean of min 2-m temperature', & - ptr_pft=pes%a10tmin, default='inactive') - - end if - - !------------------------------- - ! C state variables - native to PFT - !------------------------------- - ! add history fields for all CLAMP CN variables - - call hist_addfld1d (fname='WOODC', units='gC/m^2', & - avgflag='A', long_name='wood C', & - ptr_pft=pcs%woodc) - - call hist_addfld1d (fname='LEAFC', units='gC/m^2', & - avgflag='A', long_name='leaf C', & - ptr_pft=pcs%leafc) - - call hist_addfld1d (fname='LEAFC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='leaf C storage', & - ptr_pft=pcs%leafc_storage, default='inactive') - - call hist_addfld1d (fname='LEAFC_XFER', units='gC/m^2', & - avgflag='A', long_name='leaf C transfer', & - ptr_pft=pcs%leafc_xfer, default='inactive') - - call hist_addfld1d (fname='FROOTC', units='gC/m^2', & - avgflag='A', long_name='fine root C', & - ptr_pft=pcs%frootc) - - call hist_addfld1d (fname='FROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='fine root C storage', & - ptr_pft=pcs%frootc_storage, default='inactive') - - call hist_addfld1d (fname='FROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='fine root C transfer', & - ptr_pft=pcs%frootc_xfer, default='inactive') - - call hist_addfld1d (fname='LIVESTEMC', units='gC/m^2', & - avgflag='A', long_name='live stem C', & - ptr_pft=pcs%livestemc) - - call hist_addfld1d (fname='LIVESTEMC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='live stem C storage', & - ptr_pft=pcs%livestemc_storage, default='inactive') - - call hist_addfld1d (fname='LIVESTEMC_XFER', units='gC/m^2', & - avgflag='A', long_name='live stem C transfer', & - ptr_pft=pcs%livestemc_xfer, default='inactive') - - call hist_addfld1d (fname='DEADSTEMC', units='gC/m^2', & - avgflag='A', long_name='dead stem C', & - ptr_pft=pcs%deadstemc) - - call hist_addfld1d (fname='DEADSTEMC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='dead stem C storage', & - ptr_pft=pcs%deadstemc_storage, default='inactive') - - call hist_addfld1d (fname='DEADSTEMC_XFER', units='gC/m^2', & - avgflag='A', long_name='dead stem C transfer', & - ptr_pft=pcs%deadstemc_xfer, default='inactive') - - call hist_addfld1d (fname='LIVECROOTC', units='gC/m^2', & - avgflag='A', long_name='live coarse root C', & - ptr_pft=pcs%livecrootc) - - call hist_addfld1d (fname='LIVECROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='live coarse root C storage', & - ptr_pft=pcs%livecrootc_storage, default='inactive') - - call hist_addfld1d (fname='LIVECROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='live coarse root C transfer', & - ptr_pft=pcs%livecrootc_xfer, default='inactive') - - call hist_addfld1d (fname='DEADCROOTC', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C', & - ptr_pft=pcs%deadcrootc) - - call hist_addfld1d (fname='DEADCROOTC_STORAGE', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C storage', & - ptr_pft=pcs%deadcrootc_storage, default='inactive') - - call hist_addfld1d (fname='DEADCROOTC_XFER', units='gC/m^2', & - avgflag='A', long_name='dead coarse root C transfer', & - ptr_pft=pcs%deadcrootc_xfer, default='inactive') - - call hist_addfld1d (fname='GRESP_STORAGE', units='gC/m^2', & - avgflag='A', long_name='growth respiration storage', & - ptr_pft=pcs%gresp_storage, default='inactive') - - call hist_addfld1d (fname='GRESP_XFER', units='gC/m^2', & - avgflag='A', long_name='growth respiration transfer', & - ptr_pft=pcs%gresp_xfer, default='inactive') - - call hist_addfld1d (fname='CPOOL', units='gC/m^2', & - avgflag='A', long_name='temporary photosynthate C pool', & - ptr_pft=pcs%cpool) - - call hist_addfld1d (fname='XSMRPOOL', units='gC/m^2', & - avgflag='A', long_name='temporary photosynthate C pool', & - ptr_pft=pcs%xsmrpool) - - call hist_addfld1d (fname='PFT_CTRUNC', units='gC/m^2', & - avgflag='A', long_name='pft-level sink for C truncation', & - ptr_pft=pcs%pft_ctrunc) - - call hist_addfld1d (fname='DISPVEGC', units='gC/m^2', & - avgflag='A', long_name='displayed veg carbon, excluding storage and cpool', & - ptr_pft=pcs%dispvegc) - - call hist_addfld1d (fname='STORVEGC', units='gC/m^2', & - avgflag='A', long_name='stored vegetation carbon, excluding cpool', & - ptr_pft=pcs%storvegc) - - call hist_addfld1d (fname='TOTVEGC', units='gC/m^2', & - avgflag='A', long_name='total vegetation carbon, excluding cpool', & - ptr_pft=pcs%totvegc) - - call hist_addfld1d (fname='TOTPFTC', units='gC/m^2', & - avgflag='A', long_name='total pft-level carbon, including cpool', & - ptr_pft=pcs%totpftc) - - if (use_c13) then - !------------------------------- - ! C13 state variables - native to PFT - !------------------------------- - - call hist_addfld1d (fname='C13_LEAFC', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C', & - ptr_pft=pc13s%leafc) - - call hist_addfld1d (fname='C13_LEAFC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C storage', & - ptr_pft=pc13s%leafc_storage, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 leaf C transfer', & - ptr_pft=pc13s%leafc_xfer, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C', & - ptr_pft=pc13s%frootc) - - call hist_addfld1d (fname='C13_FROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C storage', & - ptr_pft=pc13s%frootc_storage, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 fine root C transfer', & - ptr_pft=pc13s%frootc_xfer, default='inactive') - - call hist_addfld1d (fname='C13_LIVESTEMC', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C', & - ptr_pft=pc13s%livestemc) - - call hist_addfld1d (fname='C13_LIVESTEMC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C storage', & - ptr_pft=pc13s%livestemc_storage, default='inactive') - - call hist_addfld1d (fname='C13_LIVESTEMC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 live stem C transfer', & - ptr_pft=pc13s%livestemc_xfer, default='inactive') - - call hist_addfld1d (fname='C13_DEADSTEMC', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C', & - ptr_pft=pc13s%deadstemc) - - call hist_addfld1d (fname='C13_DEADSTEMC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C storage', & - ptr_pft=pc13s%deadstemc_storage, default='inactive') - - call hist_addfld1d (fname='C13_DEADSTEMC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 dead stem C transfer', & - ptr_pft=pc13s%deadstemc_xfer, default='inactive') - - call hist_addfld1d (fname='C13_LIVECROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C', & - ptr_pft=pc13s%livecrootc) - - call hist_addfld1d (fname='C13_LIVECROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C storage', & - ptr_pft=pc13s%livecrootc_storage, default='inactive') - - call hist_addfld1d (fname='C13_LIVECROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 live coarse root C transfer', & - ptr_pft=pc13s%livecrootc_xfer, default='inactive') - - call hist_addfld1d (fname='C13_DEADCROOTC', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C', & - ptr_pft=pc13s%deadcrootc) - - call hist_addfld1d (fname='C13_DEADCROOTC_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C storage', & - ptr_pft=pc13s%deadcrootc_storage, default='inactive') - - call hist_addfld1d (fname='C13_DEADCROOTC_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 dead coarse root C transfer', & - ptr_pft=pc13s%deadcrootc_xfer, default='inactive') - - call hist_addfld1d (fname='C13_GRESP_STORAGE', units='gC13/m^2', & - avgflag='A', long_name='C13 growth respiration storage', & - ptr_pft=pc13s%gresp_storage, default='inactive') - - call hist_addfld1d (fname='C13_GRESP_XFER', units='gC13/m^2', & - avgflag='A', long_name='C13 growth respiration transfer', & - ptr_pft=pc13s%gresp_xfer, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL', units='gC13/m^2', & - avgflag='A', long_name='C13 temporary photosynthate C pool', & - ptr_pft=pc13s%cpool) - - call hist_addfld1d (fname='C13_XSMRPOOL', units='gC13/m^2', & - avgflag='A', long_name='C13 temporary photosynthate C pool', & - ptr_pft=pc13s%xsmrpool) - - call hist_addfld1d (fname='C13_PFT_CTRUNC', units='gC13/m^2', & - avgflag='A', long_name='C13 pft-level sink for C truncation', & - ptr_pft=pc13s%pft_ctrunc) - - call hist_addfld1d (fname='C13_DISPVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 displayed veg carbon, excluding storage and cpool', & - ptr_pft=pc13s%dispvegc) - - call hist_addfld1d (fname='C13_STORVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 stored vegetation carbon, excluding cpool', & - ptr_pft=pc13s%storvegc) - - call hist_addfld1d (fname='C13_TOTVEGC', units='gC13/m^2', & - avgflag='A', long_name='C13 total vegetation carbon, excluding cpool', & - ptr_pft=pc13s%totvegc) - - call hist_addfld1d (fname='C13_TOTPFTC', units='gC13/m^2', & - avgflag='A', long_name='C13 total pft-level carbon, including cpool', & - ptr_pft=pc13s%totpftc) - endif - - !------------------------------- - ! C state variables - native to column - !------------------------------- - ! add history fields for all CLAMP CN variables - call hist_addfld1d (fname='SOILC', units='gC/m^2', & - avgflag='A', long_name='soil C', & - ptr_col=ccs%totsomc) - - call hist_addfld1d (fname='LITTERC', units='gC/m^2', & - avgflag='A', long_name='litter C', & - ptr_col=ccs%totlitc) - - call hist_addfld1d (fname='CWDC', units='gC/m^2', & - avgflag='A', long_name='coarse woody debris C', & - ptr_col=ccs%cwdc) - - call hist_addfld1d (fname='LITR1C', units='gC/m^2', & - avgflag='A', long_name='litter labile C', & - ptr_col=ccs%litr1c) - - call hist_addfld1d (fname='LITR2C', units='gC/m^2', & - avgflag='A', long_name='litter cellulose C', & - ptr_col=ccs%litr2c) - - call hist_addfld1d (fname='LITR3C', units='gC/m^2', & - avgflag='A', long_name='litter lignin C', & - ptr_col=ccs%litr3c) - - call hist_addfld1d (fname='SOIL1C', units='gC/m^2', & - avgflag='A', long_name='soil organic matter C (fast pool)', & - ptr_col=ccs%soil1c) - - call hist_addfld1d (fname='SOIL2C', units='gC/m^2', & - avgflag='A', long_name='soil organic matter C (medium pool)', & - ptr_col=ccs%soil2c) - - call hist_addfld1d (fname='SOIL3C', units='gC/m^2', & - avgflag='A', long_name='soil organic matter C (slow pool)', & - ptr_col=ccs%soil3c) - - call hist_addfld1d (fname='SOIL4C', units='gC/m^2', & - avgflag='A', long_name='soil organic matter C (slowest pool)', & - ptr_col=ccs%soil4c) - - call hist_addfld1d (fname='SEEDC', units='gC/m^2', & - avgflag='A', long_name='pool for seeding new PFTs', & - ptr_col=ccs%seedc) - - call hist_addfld1d (fname='COL_CTRUNC', units='gC/m^2', & - avgflag='A', long_name='column-level sink for C truncation', & - ptr_col=ccs%col_ctrunc) - - call hist_addfld1d (fname='TOTLITC', units='gC/m^2', & - avgflag='A', long_name='total litter carbon', & - ptr_col=ccs%totlitc) - - call hist_addfld1d (fname='TOTSOMC', units='gC/m^2', & - avgflag='A', long_name='total soil organic matter carbon', & - ptr_col=ccs%totsomc) - - call hist_addfld1d (fname='TOTECOSYSC', units='gC/m^2', & - avgflag='A', long_name='total ecosystem carbon, incl veg but excl cpool', & - ptr_col=ccs%totecosysc) - - call hist_addfld1d (fname='TOTCOLC', units='gC/m^2', & - avgflag='A', long_name='total column carbon, incl veg and cpool', & - ptr_col=ccs%totcolc) - - call hist_addfld1d (fname='PROD10C', units='gC/m^2', & - avgflag='A', long_name='10-yr wood product C', & - ptr_col=ccs%prod10c) - - call hist_addfld1d (fname='PROD100C', units='gC/m^2', & - avgflag='A', long_name='100-yr wood product C', & - ptr_col=ccs%prod100c) - - call hist_addfld1d (fname='TOTPRODC', units='gC/m^2', & - avgflag='A', long_name='total wood product C', & - ptr_col=ccs%totprodc) - - - if (use_c13) then - !------------------------------- - ! C13 state variables - native to column - !------------------------------- - - call hist_addfld1d (fname='C13_CWDC', units='gC13/m^2', & - avgflag='A', long_name='C13 coarse woody debris C', & - ptr_col=cc13s%cwdc) - - call hist_addfld1d (fname='C13_LITR1C', units='gC13/m^2', & - avgflag='A', long_name='C13 litter labile C', & - ptr_col=cc13s%litr1c) - - call hist_addfld1d (fname='C13_LITR2C', units='gC13/m^2', & - avgflag='A', long_name='C13 litter cellulose C', & - ptr_col=cc13s%litr2c) - - call hist_addfld1d (fname='C13_LITR3C', units='gC13/m^2', & - avgflag='A', long_name='C13 litter lignin C', & - ptr_col=cc13s%litr3c) - - call hist_addfld1d (fname='C13_SOIL1C', units='gC13/m^2', & - avgflag='A', long_name='C13 soil organic matter C (fast pool)', & - ptr_col=cc13s%soil1c) - - call hist_addfld1d (fname='C13_SOIL2C', units='gC13/m^2', & - avgflag='A', long_name='C13 soil organic matter C (medium pool)', & - ptr_col=cc13s%soil2c) - - call hist_addfld1d (fname='C13_SOIL3C', units='gC13/m^2', & - avgflag='A', long_name='C13 soil organic matter C (slow pool)', & - ptr_col=cc13s%soil3c) - - call hist_addfld1d (fname='C13_SOIL4C', units='gC13/m^2', & - avgflag='A', long_name='C13 soil organic matter C (slowest pool)', & - ptr_col=cc13s%soil4c) - - call hist_addfld1d (fname='C13_SEEDC', units='gC13/m^2', & - avgflag='A', long_name='C13 pool for seeding new PFTs', & - ptr_col=ccs%seedc) - - call hist_addfld1d (fname='C13_COL_CTRUNC', units='gC13/m^2', & - avgflag='A', long_name='C13 column-level sink for C truncation', & - ptr_col=cc13s%col_ctrunc) - - call hist_addfld1d (fname='C13_TOTLITC', units='gC13/m^2', & - avgflag='A', long_name='C13 total litter carbon', & - ptr_col=cc13s%totlitc) - - call hist_addfld1d (fname='C13_TOTSOMC', units='gC13/m^2', & - avgflag='A', long_name='C13 total soil organic matter carbon', & - ptr_col=cc13s%totsomc) - - call hist_addfld1d (fname='C13_TOTECOSYSC', units='gC13/m^2', & - avgflag='A', long_name='C13 total ecosystem carbon, incl veg but excl cpool', & - ptr_col=cc13s%totecosysc) - - call hist_addfld1d (fname='C13_TOTCOLC', units='gC13/m^2', & - avgflag='A', long_name='C13 total column carbon, incl veg and cpool', & - ptr_col=cc13s%totcolc) - - call hist_addfld1d (fname='C13_PROD10C', units='gC13/m^2', & - avgflag='A', long_name='C13 10-yr wood product C', & - ptr_col=cc13s%prod10c) - - call hist_addfld1d (fname='C13_PROD100C', units='gC13/m^2', & - avgflag='A', long_name='C13 100-yr wood product C', & - ptr_col=cc13s%prod100c) - - call hist_addfld1d (fname='C13_TOTPRODC', units='gC13/m^2', & - avgflag='A', long_name='C13 total wood product C', & - ptr_col=cc13s%totprodc) - endif - - !------------------------------- - ! N state variables - native to PFT - !------------------------------- - - call hist_addfld1d (fname='LEAFN', units='gN/m^2', & - avgflag='A', long_name='leaf N', & - ptr_pft=pns%leafn) - - call hist_addfld1d (fname='LEAFN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='leaf N storage', & - ptr_pft=pns%leafn_storage, default='inactive') - - call hist_addfld1d (fname='LEAFN_XFER', units='gN/m^2', & - avgflag='A', long_name='leaf N transfer', & - ptr_pft=pns%leafn_xfer, default='inactive') - - call hist_addfld1d (fname='FROOTN', units='gN/m^2', & - avgflag='A', long_name='fine root N', & - ptr_pft=pns%frootn) - - call hist_addfld1d (fname='FROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='fine root N storage', & - ptr_pft=pns%frootn_storage, default='inactive') - - call hist_addfld1d (fname='FROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='fine root N transfer', & - ptr_pft=pns%frootn_xfer, default='inactive') - - call hist_addfld1d (fname='LIVESTEMN', units='gN/m^2', & - avgflag='A', long_name='live stem N', & - ptr_pft=pns%livestemn) - - call hist_addfld1d (fname='LIVESTEMN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='live stem N storage', & - ptr_pft=pns%livestemn_storage, default='inactive') - - call hist_addfld1d (fname='LIVESTEMN_XFER', units='gN/m^2', & - avgflag='A', long_name='live stem N transfer', & - ptr_pft=pns%livestemn_xfer, default='inactive') - - call hist_addfld1d (fname='DEADSTEMN', units='gN/m^2', & - avgflag='A', long_name='dead stem N', & - ptr_pft=pns%deadstemn) - - call hist_addfld1d (fname='DEADSTEMN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='dead stem N storage', & - ptr_pft=pns%deadstemn_storage, default='inactive') - - call hist_addfld1d (fname='DEADSTEMN_XFER', units='gN/m^2', & - avgflag='A', long_name='dead stem N transfer', & - ptr_pft=pns%deadstemn_xfer, default='inactive') - - call hist_addfld1d (fname='LIVECROOTN', units='gN/m^2', & - avgflag='A', long_name='live coarse root N', & - ptr_pft=pns%livecrootn) - - call hist_addfld1d (fname='LIVECROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='live coarse root N storage', & - ptr_pft=pns%livecrootn_storage, default='inactive') - - call hist_addfld1d (fname='LIVECROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='live coarse root N transfer', & - ptr_pft=pns%livecrootn_xfer, default='inactive') - - call hist_addfld1d (fname='DEADCROOTN', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N', & - ptr_pft=pns%deadcrootn) - - call hist_addfld1d (fname='DEADCROOTN_STORAGE', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N storage', & - ptr_pft=pns%deadcrootn_storage, default='inactive') - - call hist_addfld1d (fname='DEADCROOTN_XFER', units='gN/m^2', & - avgflag='A', long_name='dead coarse root N transfer', & - ptr_pft=pns%deadcrootn_xfer, default='inactive') - - call hist_addfld1d (fname='RETRANSN', units='gN/m^2', & - avgflag='A', long_name='plant pool of retranslocated N', & - ptr_pft=pns%retransn) - - call hist_addfld1d (fname='NPOOL', units='gN/m^2', & - avgflag='A', long_name='temporary plant N pool', & - ptr_pft=pns%npool, default='inactive') - - call hist_addfld1d (fname='PFT_NTRUNC', units='gN/m^2', & - avgflag='A', long_name='pft-level sink for N truncation', & - ptr_pft=pns%pft_ntrunc) - - call hist_addfld1d (fname='DISPVEGN', units='gN/m^2', & - avgflag='A', long_name='displayed vegetation nitrogen', & - ptr_pft=pns%dispvegn) - - call hist_addfld1d (fname='STORVEGN', units='gN/m^2', & - avgflag='A', long_name='stored vegetation nitrogen', & - ptr_pft=pns%storvegn) - - call hist_addfld1d (fname='TOTVEGN', units='gN/m^2', & - avgflag='A', long_name='total vegetation nitrogen', & - ptr_pft=pns%totvegn) - - call hist_addfld1d (fname='TOTPFTN', units='gN/m^2', & - avgflag='A', long_name='total PFT-level nitrogen', & - ptr_pft=pns%totpftn) - - !------------------------------- - ! N state variables - native to column - !------------------------------- - - call hist_addfld1d (fname='CWDN', units='gN/m^2', & - avgflag='A', long_name='coarse woody debris N', & - ptr_col=cns%cwdn) - - call hist_addfld1d (fname='LITR1N', units='gN/m^2', & - avgflag='A', long_name='litter labile N', & - ptr_col=cns%litr1n) - - call hist_addfld1d (fname='LITR2N', units='gN/m^2', & - avgflag='A', long_name='litter cellulose N', & - ptr_col=cns%litr2n) - - call hist_addfld1d (fname='LITR3N', units='gN/m^2', & - avgflag='A', long_name='litter lignin N', & - ptr_col=cns%litr3n) - - call hist_addfld1d (fname='SOIL1N', units='gN/m^2', & - avgflag='A', long_name='soil organic matter N (fast pool)', & - ptr_col=cns%soil1n) - - call hist_addfld1d (fname='SOIL2N', units='gN/m^2', & - avgflag='A', long_name='soil organic matter N (medium pool)', & - ptr_col=cns%soil2n) - - call hist_addfld1d (fname='SOIL3N', units='gN/m^2', & - avgflag='A', long_name='soil orgainc matter N (slow pool)', & - ptr_col=cns%soil3n) - - call hist_addfld1d (fname='SOIL4N', units='gN/m^2', & - avgflag='A', long_name='soil orgainc matter N (slowest pool)', & - ptr_col=cns%soil4n) - - call hist_addfld1d (fname='SMINN', units='gN/m^2', & - avgflag='A', long_name='soil mineral N', & - ptr_col=cns%sminn) - - call hist_addfld1d (fname='COL_NTRUNC', units='gN/m^2', & - avgflag='A', long_name='column-level sink for N truncation', & - ptr_col=cns%col_ntrunc) - - call hist_addfld1d (fname='TOTLITN', units='gN/m^2', & - avgflag='A', long_name='total litter N', & - ptr_col=cns%totlitn) - - call hist_addfld1d (fname='TOTSOMN', units='gN/m^2', & - avgflag='A', long_name='total soil organic matter N', & - ptr_col=cns%totsomn) - - call hist_addfld1d (fname='TOTECOSYSN', units='gN/m^2', & - avgflag='A', long_name='total ecosystem N', & - ptr_col=cns%totecosysn) - - call hist_addfld1d (fname='TOTCOLN', units='gN/m^2', & - avgflag='A', long_name='total column-level N', & - ptr_col=cns%totcoln) - - call hist_addfld1d (fname='SEEDN', units='gN/m^2', & - avgflag='A', long_name='pool for seeding new PFTs ', & - ptr_col=cns%seedn) - - call hist_addfld1d (fname='PROD10N', units='gN/m^2', & - avgflag='A', long_name='10-yr wood product N', & - ptr_col=cns%prod10n) - - call hist_addfld1d (fname='PROD100N', units='gN/m^2', & - avgflag='A', long_name='100-yr wood product N', & - ptr_col=cns%prod100n) - - call hist_addfld1d (fname='TOTPRODN', units='gN/m^2', & - avgflag='A', long_name='total wood product N', & - ptr_col=cns%totprodn) - - !------------------------------- - ! C flux variables - native to PFT - !------------------------------- - - ! add history fields for all CLAMP CN variables - - call hist_addfld1d (fname='WOODC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='wood C allocation', & - ptr_pft=pcf%woodc_alloc) - - call hist_addfld1d (fname='WOODC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='wood C loss', & - ptr_pft=pcf%woodc_loss) - - call hist_addfld1d (fname='LEAFC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='leaf C loss', & - ptr_pft=pcf%leafc_loss) - - call hist_addfld1d (fname='LEAFC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='leaf C allocation', & - ptr_pft=pcf%leafc_alloc) - - call hist_addfld1d (fname='FROOTC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='fine root C loss', & - ptr_pft=pcf%frootc_loss) - - call hist_addfld1d (fname='FROOTC_ALLOC', units='gC/m^2/s', & - avgflag='A', long_name='fine root C allocation', & - ptr_pft=pcf%frootc_alloc) - - call hist_addfld1d (fname='PSNSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='sunlit leaf photosynthesis', & - ptr_pft=pcf%psnsun) - - call hist_addfld1d (fname='PSNSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='shaded leaf photosynthesis', & - ptr_pft=pcf%psnsha) - - call hist_addfld1d (fname='M_LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C mortality', & - ptr_pft=pcf%m_leafc_to_litter, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C mortality', & - ptr_pft=pcf%m_frootc_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage mortality', & - ptr_pft=pcf%m_leafc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage mortality', & - ptr_pft=pcf%m_frootc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage mortality', & - ptr_pft=pcf%m_livestemc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage mortality', & - ptr_pft=pcf%m_deadstemc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C storage mortality', & - ptr_pft=pcf%m_livecrootc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage mortality', & - ptr_pft=pcf%m_deadcrootc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer mortality', & - ptr_pft=pcf%m_leafc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer mortality', & - ptr_pft=pcf%m_frootc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer mortality', & - ptr_pft=pcf%m_livestemc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer mortality', & - ptr_pft=pcf%m_deadstemc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C transfer mortality', & - ptr_pft=pcf%m_livecrootc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C transfer mortality', & - ptr_pft=pcf%m_deadcrootc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C mortality', & - ptr_pft=pcf%m_livestemc_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C mortality', & - ptr_pft=pcf%m_deadstemc_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C mortality', & - ptr_pft=pcf%m_livecrootc_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C mortality', & - ptr_pft=pcf%m_deadcrootc_to_litter, default='inactive') - - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage mortality', & - ptr_pft=pcf%m_gresp_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_GRESP_XFER_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer mortality', & - ptr_pft=pcf%m_gresp_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C fire loss', & - ptr_pft=pcf%m_leafc_to_fire, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C fire loss', & - ptr_pft=pcf%m_frootc_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage fire loss', & - ptr_pft=pcf%m_leafc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage fire loss', & - ptr_pft=pcf%m_frootc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage fire loss', & - ptr_pft=pcf%m_livestemc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage fire loss', & - ptr_pft=pcf%m_deadstemc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C storage fire loss', & - ptr_pft=pcf%m_livecrootc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage fire loss', & - ptr_pft=pcf%m_deadcrootc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer fire loss', & - ptr_pft=pcf%m_leafc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer fire loss', & - ptr_pft=pcf%m_frootc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer fire loss', & - ptr_pft=pcf%m_livestemc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer fire loss', & - ptr_pft=pcf%m_deadstemc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C transfer fire loss', & - ptr_pft=pcf%m_livecrootc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C transfer fire loss', & - ptr_pft=pcf%m_deadcrootc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live stem C fire loss', & - ptr_pft=pcf%m_livestemc_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C fire loss', & - ptr_pft=pcf%m_deadstemc_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C fire mortality to litter', & - ptr_pft=pcf%m_deadstemc_to_litter_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C fire loss', & - ptr_pft=pcf%m_livecrootc_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C fire loss', & - ptr_pft=pcf%m_deadcrootc_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_TO_LITTER_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C fire mortality to litter', & - ptr_pft=pcf%m_deadcrootc_to_litter_fire, default='inactive') - - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage fire loss', & - ptr_pft=pcf%m_gresp_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_GRESP_XFER_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer fire loss', & - ptr_pft=pcf%m_gresp_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='LEAFC_XFER_TO_LEAFC', units='gC/m^2/s', & - avgflag='A', long_name='leaf C growth from storage', & - ptr_pft=pcf%leafc_xfer_to_leafc, default='inactive') - - call hist_addfld1d (fname='FROOTC_XFER_TO_FROOTC', units='gC/m^2/s', & - avgflag='A', long_name='fine root C growth from storage', & - ptr_pft=pcf%frootc_xfer_to_frootc, default='inactive') - - call hist_addfld1d (fname='LIVESTEMC_XFER_TO_LIVESTEMC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C growth from storage', & - ptr_pft=pcf%livestemc_xfer_to_livestemc, default='inactive') - - call hist_addfld1d (fname='DEADSTEMC_XFER_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C growth from storage', & - ptr_pft=pcf%deadstemc_xfer_to_deadstemc, default='inactive') - - call hist_addfld1d (fname='LIVECROOTC_XFER_TO_LIVECROOTC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C growth from storage', & - ptr_pft=pcf%livecrootc_xfer_to_livecrootc, default='inactive') - - call hist_addfld1d (fname='DEADCROOTC_XFER_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C growth from storage', & - ptr_pft=pcf%deadcrootc_xfer_to_deadcrootc, default='inactive') - - call hist_addfld1d (fname='LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall', & - ptr_pft=pcf%leafc_to_litter, default='inactive') - - call hist_addfld1d (fname='FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C litterfall', & - ptr_pft=pcf%frootc_to_litter, default='inactive') - - call hist_addfld1d (fname='LEAF_MR', units='gC/m^2/s', & - avgflag='A', long_name='leaf maintenance respiration', & - ptr_pft=pcf%leaf_mr, default='inactive') - - call hist_addfld1d (fname='FROOT_MR', units='gC/m^2/s', & - avgflag='A', long_name='fine root maintenance respiration', & - ptr_pft=pcf%froot_mr, default='inactive') - - call hist_addfld1d (fname='LIVESTEM_MR', units='gC/m^2/s', & - avgflag='A', long_name='live stem maintenance respiration', & - ptr_pft=pcf%livestem_mr, default='inactive') - - call hist_addfld1d (fname='LIVECROOT_MR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root maintenance respiration', & - ptr_pft=pcf%livecroot_mr, default='inactive') - - call hist_addfld1d (fname='PSNSUN_TO_CPOOL', units='gC/m^2/s', & - avgflag='A', long_name='C fixation from sunlit canopy', & - ptr_pft=pcf%psnsun_to_cpool) - - call hist_addfld1d (fname='PSNSHADE_TO_CPOOL', units='gC/m^2/s', & - avgflag='A', long_name='C fixation from shaded canopy', & - ptr_pft=pcf%psnshade_to_cpool) - - call hist_addfld1d (fname='CPOOL_TO_LEAFC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to leaf C', & - ptr_pft=pcf%cpool_to_leafc, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_LEAFC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to leaf C storage', & - ptr_pft=pcf%cpool_to_leafc_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_FROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to fine root C', & - ptr_pft=pcf%cpool_to_frootc, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_FROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to fine root C storage', & - ptr_pft=pcf%cpool_to_frootc_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live stem C', & - ptr_pft=pcf%cpool_to_livestemc, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_LIVESTEMC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live stem C storage', & - ptr_pft=pcf%cpool_to_livestemc_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead stem C', & - ptr_pft=pcf%cpool_to_deadstemc, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_DEADSTEMC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead stem C storage', & - ptr_pft=pcf%cpool_to_deadstemc_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live coarse root C', & - ptr_pft=pcf%cpool_to_livecrootc, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_LIVECROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to live coarse root C storage', & - ptr_pft=pcf%cpool_to_livecrootc_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root C', & - ptr_pft=pcf%cpool_to_deadcrootc, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_DEADCROOTC_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root C storage', & - ptr_pft=pcf%cpool_to_deadcrootc_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_TO_GRESP_STORAGE', units='gC/m^2/s', & - avgflag='A', long_name='allocation to growth respiration storage', & - ptr_pft=pcf%cpool_to_gresp_storage, default='inactive') - - call hist_addfld1d (fname='CPOOL_LEAF_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration', & - ptr_pft=pcf%cpool_leaf_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_LEAF_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration to storage', & - ptr_pft=pcf%cpool_leaf_storage_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_LEAF_GR', units='gC/m^2/s', & - avgflag='A', long_name='leaf growth respiration from storage', & - ptr_pft=pcf%transfer_leaf_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_FROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration', & - ptr_pft=pcf%cpool_froot_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_FROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration to storage', & - ptr_pft=pcf%cpool_froot_storage_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_FROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='fine root growth respiration from storage', & - ptr_pft=pcf%transfer_froot_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_LIVESTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration', & - ptr_pft=pcf%cpool_livestem_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_LIVESTEM_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration to storage', & - ptr_pft=pcf%cpool_livestem_storage_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_LIVESTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='live stem growth respiration from storage', & - ptr_pft=pcf%transfer_livestem_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_DEADSTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration', & - ptr_pft=pcf%cpool_deadstem_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_DEADSTEM_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration to storage', & - ptr_pft=pcf%cpool_deadstem_storage_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_DEADSTEM_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead stem growth respiration from storage', & - ptr_pft=pcf%transfer_deadstem_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_LIVECROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration', & - ptr_pft=pcf%cpool_livecroot_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_LIVECROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration to storage', & - ptr_pft=pcf%cpool_livecroot_storage_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_LIVECROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root growth respiration from storage', & - ptr_pft=pcf%transfer_livecroot_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_DEADCROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration', & - ptr_pft=pcf%cpool_deadcroot_gr, default='inactive') - - call hist_addfld1d (fname='CPOOL_DEADCROOT_STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration to storage', & - ptr_pft=pcf%cpool_deadcroot_storage_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_DEADCROOT_GR', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root growth respiration from storage', & - ptr_pft=pcf%transfer_deadcroot_gr, default='inactive') - - call hist_addfld1d (fname='LEAFC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='leaf C shift storage to transfer', & - ptr_pft=pcf%leafc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='FROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='fine root C shift storage to transfer', & - ptr_pft=pcf%frootc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='LIVESTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='live stem C shift storage to transfer', & - ptr_pft=pcf%livestemc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='DEADSTEMC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C shift storage to transfer', & - ptr_pft=pcf%deadstemc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='LIVECROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C shift storage to transfer', & - ptr_pft=pcf%livecrootc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='DEADCROOTC_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C shift storage to transfer', & - ptr_pft=pcf%deadcrootc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='GRESP_STORAGE_TO_XFER', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration shift storage to transfer', & - ptr_pft=pcf%gresp_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='LIVESTEMC_TO_DEADSTEMC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C turnover', & - ptr_pft=pcf%livestemc_to_deadstemc, default='inactive') - - call hist_addfld1d (fname='LIVECROOTC_TO_DEADCROOTC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C turnover', & - ptr_pft=pcf%livecrootc_to_deadcrootc, default='inactive') - - call hist_addfld1d (fname='GPP', units='gC/m^2/s', & - avgflag='A', long_name='gross primary production', & - ptr_pft=pcf%gpp) - - call hist_addfld1d (fname='MR', units='gC/m^2/s', & - avgflag='A', long_name='maintenance respiration', & - ptr_pft=pcf%mr) - - call hist_addfld1d (fname='CURRENT_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for new growth displayed in this timestep', & - ptr_pft=pcf%current_gr, default='inactive') - - call hist_addfld1d (fname='TRANSFER_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for transfer growth displayed in this timestep', & - ptr_pft=pcf%transfer_gr, default='inactive') - - call hist_addfld1d (fname='STORAGE_GR', units='gC/m^2/s', & - avgflag='A', long_name='growth resp for growth sent to storage for later display', & - ptr_pft=pcf%storage_gr, default='inactive') - - call hist_addfld1d (fname='GR', units='gC/m^2/s', & - avgflag='A', long_name='total growth respiration', & - ptr_pft=pcf%gr) - - call hist_addfld1d (fname='AR', units='gC/m^2/s', & - avgflag='A', long_name='autotrophic respiration (MR + GR)', & - ptr_pft=pcf%ar) - - call hist_addfld1d (fname='RR', units='gC/m^2/s', & - avgflag='A', long_name='root respiration (fine root MR + total root GR)', & - ptr_pft=pcf%rr) - - call hist_addfld1d (fname='NPP', units='gC/m^2/s', & - avgflag='A', long_name='net primary production', & - ptr_pft=pcf%npp) - - call hist_addfld1d (fname='AGNPP', units='gC/m^2/s', & - avgflag='A', long_name='aboveground NPP', & - ptr_pft=pcf%agnpp) - - call hist_addfld1d (fname='BGNPP', units='gC/m^2/s', & - avgflag='A', long_name='belowground NPP', & - ptr_pft=pcf%bgnpp) - - call hist_addfld1d (fname='LITFALL', units='gC/m^2/s', & - avgflag='A', long_name='litterfall (leaves and fine roots)', & - ptr_pft=pcf%litfall) - - call hist_addfld1d (fname='VEGFIRE', units='gC/m^2/s', & - avgflag='A', long_name='pft-level fire loss', & - ptr_pft=pcf%vegfire, default='inactive') - - call hist_addfld1d (fname='WOOD_HARVESTC', units='gC/m^2/s', & - avgflag='A', long_name='wood harvest carbon (to product pools)', & - ptr_pft=pcf%wood_harvestc) - - call hist_addfld1d (fname='PFT_FIRE_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total pft-level fire C loss', & - ptr_pft=pcf%pft_fire_closs) - - if (use_c13) then - !------------------------------- - ! C13 flux variables - native to PFT - !------------------------------- - - call hist_addfld1d (fname='C13_PSNSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='C13 sunlit leaf photosynthesis', & - ptr_pft=pc13f%psnsun) - - call hist_addfld1d (fname='C13_PSNSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='C13 shaded leaf photosynthesis', & - ptr_pft=pc13f%psnsha) - - call hist_addfld1d (fname='C13_M_LEAFC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C mortality', & - ptr_pft=pc13f%m_leafc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C mortality', & - ptr_pft=pc13f%m_frootc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage mortality', & - ptr_pft=pc13f%m_leafc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage mortality', & - ptr_pft=pc13f%m_frootc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage mortality', & - ptr_pft=pc13f%m_livestemc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage mortality', & - ptr_pft=pc13f%m_deadstemc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage mortality', & - ptr_pft=pc13f%m_livecrootc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage mortality', & - ptr_pft=pc13f%m_deadcrootc_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer mortality', & - ptr_pft=pc13f%m_leafc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer mortality', & - ptr_pft=pc13f%m_frootc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer mortality', & - ptr_pft=pc13f%m_livestemc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer mortality', & - ptr_pft=pc13f%m_deadstemc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer mortality', & - ptr_pft=pc13f%m_livecrootc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer mortality', & - ptr_pft=pc13f%m_deadcrootc_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C mortality', & - ptr_pft=pc13f%m_livestemc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C mortality', & - ptr_pft=pc13f%m_deadstemc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C mortality', & - ptr_pft=pc13f%m_livecrootc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C mortality', & - ptr_pft=pc13f%m_deadcrootc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage mortality', & - ptr_pft=pc13f%m_gresp_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer mortality', & - ptr_pft=pc13f%m_gresp_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C fire loss', & - ptr_pft=pc13f%m_leafc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C fire loss', & - ptr_pft=pc13f%m_frootc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage fire loss', & - ptr_pft=pc13f%m_leafc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage fire loss', & - ptr_pft=pc13f%m_frootc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage fire loss', & - ptr_pft=pc13f%m_livestemc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage fire loss', & - ptr_pft=pc13f%m_deadstemc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage fire loss', & - ptr_pft=pc13f%m_livecrootc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage fire loss', & - ptr_pft=pc13f%m_deadcrootc_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer fire loss', & - ptr_pft=pc13f%m_leafc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer fire loss', & - ptr_pft=pc13f%m_frootc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer fire loss', & - ptr_pft=pc13f%m_livestemc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer fire loss', & - ptr_pft=pc13f%m_deadstemc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer fire loss', & - ptr_pft=pc13f%m_livecrootc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer fire loss', & - ptr_pft=pc13f%m_deadcrootc_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C fire loss', & - ptr_pft=pc13f%m_livestemc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C fire loss', & - ptr_pft=pc13f%m_deadstemc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_LITTER_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C fire mortality to litter', & - ptr_pft=pc13f%m_deadstemc_to_litter_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C fire loss', & - ptr_pft=pc13f%m_livecrootc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C fire loss', & - ptr_pft=pc13f%m_deadcrootc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_LITTER_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C fire mortality to litter', & - ptr_pft=pc13f%m_deadcrootc_to_litter_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage fire loss', & - ptr_pft=pc13f%m_gresp_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer fire loss', & - ptr_pft=pc13f%m_gresp_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_XFER_TO_LEAFC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C growth from storage', & - ptr_pft=pc13f%leafc_xfer_to_leafc, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_XFER_TO_FROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C growth from storage', & - ptr_pft=pc13f%frootc_xfer_to_frootc, default='inactive') - - call hist_addfld1d (fname='C13_LIVESTEMC_XFER_TO_LIVESTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C growth from storage', & - ptr_pft=pc13f%livestemc_xfer_to_livestemc, default='inactive') - - call hist_addfld1d (fname='C13_DEADSTEMC_XFER_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C growth from storage', & - ptr_pft=pc13f%deadstemc_xfer_to_deadstemc, default='inactive') - - call hist_addfld1d (fname='C13_LIVECROOTC_XFER_TO_LIVECROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C growth from storage', & - ptr_pft=pc13f%livecrootc_xfer_to_livecrootc, default='inactive') - - call hist_addfld1d (fname='C13_DEADCROOTC_XFER_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C growth from storage', & - ptr_pft=pc13f%deadcrootc_xfer_to_deadcrootc, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C litterfall', & - ptr_pft=pc13f%leafc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_TO_LITTER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall', & - ptr_pft=pc13f%frootc_to_litter, default='inactive') - - call hist_addfld1d (fname='C13_LEAF_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf maintenance respiration', & - ptr_pft=pc13f%leaf_mr, default='inactive') - - call hist_addfld1d (fname='C13_FROOT_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root maintenance respiration', & - ptr_pft=pc13f%froot_mr, default='inactive') - - call hist_addfld1d (fname='C13_LIVESTEM_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem maintenance respiration', & - ptr_pft=pc13f%livestem_mr, default='inactive') - - call hist_addfld1d (fname='C13_LIVECROOT_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root maintenance respiration', & - ptr_pft=pc13f%livecroot_mr, default='inactive') - - call hist_addfld1d (fname='C13_PSNSUN_TO_CPOOL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 C fixation from sunlit canopy', & - ptr_pft=pc13f%psnsun_to_cpool) - - call hist_addfld1d (fname='C13_PSNSHADE_TO_CPOOL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 C fixation from shaded canopy', & - ptr_pft=pc13f%psnshade_to_cpool) - - call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to leaf C', & - ptr_pft=pc13f%cpool_to_leafc, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_LEAFC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to leaf C storage', & - ptr_pft=pc13f%cpool_to_leafc_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_FROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to fine root C', & - ptr_pft=pc13f%cpool_to_frootc, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_FROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to fine root C storage', & - ptr_pft=pc13f%cpool_to_frootc_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_LIVESTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live stem C', & - ptr_pft=pc13f%cpool_to_livestemc, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_LIVESTEMC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live stem C storage', & - ptr_pft=pc13f%cpool_to_livestemc_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead stem C', & - ptr_pft=pc13f%cpool_to_deadstemc, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_DEADSTEMC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead stem C storage', & - ptr_pft=pc13f%cpool_to_deadstemc_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_LIVECROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live coarse root C', & - ptr_pft=pc13f%cpool_to_livecrootc, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_LIVECROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to live coarse root C storage', & - ptr_pft=pc13f%cpool_to_livecrootc_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead coarse root C', & - ptr_pft=pc13f%cpool_to_deadcrootc, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_DEADCROOTC_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to dead coarse root C storage', & - ptr_pft=pc13f%cpool_to_deadcrootc_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_TO_GRESP_STORAGE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 allocation to growth respiration storage', & - ptr_pft=pc13f%cpool_to_gresp_storage, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_LEAF_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration', & - ptr_pft=pc13f%cpool_leaf_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_LEAF_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration to storage', & - ptr_pft=pc13f%cpool_leaf_storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_LEAF_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf growth respiration from storage', & - ptr_pft=pc13f%transfer_leaf_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_FROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration', & - ptr_pft=pc13f%cpool_froot_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_FROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration to storage', & - ptr_pft=pc13f%cpool_froot_storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_FROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root growth respiration from storage', & - ptr_pft=pc13f%transfer_froot_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_LIVESTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration', & - ptr_pft=pc13f%cpool_livestem_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_LIVESTEM_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration to storage', & - ptr_pft=pc13f%cpool_livestem_storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_LIVESTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem growth respiration from storage', & - ptr_pft=pc13f%transfer_livestem_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_DEADSTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration', & - ptr_pft=pc13f%cpool_deadstem_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_DEADSTEM_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration to storage', & - ptr_pft=pc13f%cpool_deadstem_storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_DEADSTEM_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem growth respiration from storage', & - ptr_pft=pc13f%transfer_deadstem_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_LIVECROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration', & - ptr_pft=pc13f%cpool_livecroot_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_LIVECROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration to storage', & - ptr_pft=pc13f%cpool_livecroot_storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_LIVECROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root growth respiration from storage', & - ptr_pft=pc13f%transfer_livecroot_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_DEADCROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration', & - ptr_pft=pc13f%cpool_deadcroot_gr, default='inactive') - - call hist_addfld1d (fname='C13_CPOOL_DEADCROOT_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration to storage', & - ptr_pft=pc13f%cpool_deadcroot_storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_DEADCROOT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root growth respiration from storage', & - ptr_pft=pc13f%transfer_deadcroot_gr, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C shift storage to transfer', & - ptr_pft=pc13f%leafc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C shift storage to transfer', & - ptr_pft=pc13f%frootc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_LIVESTEMC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C shift storage to transfer', & - ptr_pft=pc13f%livestemc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_DEADSTEMC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C shift storage to transfer', & - ptr_pft=pc13f%deadstemc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_LIVECROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C shift storage to transfer', & - ptr_pft=pc13f%livecrootc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_DEADCROOTC_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C shift storage to transfer', & - ptr_pft=pc13f%deadcrootc_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_GRESP_STORAGE_TO_XFER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration shift storage to transfer', & - ptr_pft=pc13f%gresp_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='C13_LIVESTEMC_TO_DEADSTEMC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C turnover', & - ptr_pft=pc13f%livestemc_to_deadstemc, default='inactive') - - call hist_addfld1d (fname='C13_LIVECROOTC_TO_DEADCROOTC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C turnover', & - ptr_pft=pc13f%livecrootc_to_deadcrootc, default='inactive') - - call hist_addfld1d (fname='C13_GPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 gross primary production', & - ptr_pft=pc13f%gpp) - - call hist_addfld1d (fname='C13_MR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 maintenance respiration', & - ptr_pft=pc13f%mr) - - call hist_addfld1d (fname='C13_CURRENT_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for new growth displayed in this timestep', & - ptr_pft=pc13f%current_gr, default='inactive') - - call hist_addfld1d (fname='C13_TRANSFER_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for transfer growth displayed in this timestep', & - ptr_pft=pc13f%transfer_gr, default='inactive') - - call hist_addfld1d (fname='C13_STORAGE_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth resp for growth sent to storage for later display', & - ptr_pft=pc13f%storage_gr, default='inactive') - - call hist_addfld1d (fname='C13_GR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total growth respiration', & - ptr_pft=pc13f%gr) - - call hist_addfld1d (fname='C13_AR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 autotrophic respiration (MR + GR)', & - ptr_pft=pc13f%ar) - - call hist_addfld1d (fname='C13_RR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 root respiration (fine root MR + total root GR)', & - ptr_pft=pc13f%rr) - - call hist_addfld1d (fname='C13_NPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net primary production', & - ptr_pft=pc13f%npp) - - call hist_addfld1d (fname='C13_AGNPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 aboveground NPP', & - ptr_pft=pc13f%agnpp) - - call hist_addfld1d (fname='C13_BGNPP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 belowground NPP', & - ptr_pft=pc13f%bgnpp) - - call hist_addfld1d (fname='C13_LITFALL', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litterfall (leaves and fine roots)', & - ptr_pft=pc13f%litfall, default='inactive') - - call hist_addfld1d (fname='C13_VEGFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 pft-level fire loss', & - ptr_pft=pc13f%vegfire, default='inactive') - - call hist_addfld1d (fname='C13_PFT_FIRE_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total pft-level fire C loss', & - ptr_pft=pc13f%pft_fire_closs) - endif - - !------------------------------- - ! C flux variables - native to column - !------------------------------- - ! add history fields for all CLAMP CN variables - - call hist_addfld1d (fname='CWDC_HR', units='gC/m^2/s', & - avgflag='A', long_name='coarse woody debris C heterotrophic respiration', & - ptr_col=ccf%cwdc_hr) - - call hist_addfld1d (fname='CWDC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='coarse woody debris C loss', & - ptr_col=ccf%cwdc_loss) - - call hist_addfld1d (fname='LITTERC_HR', units='gC/m^2/s', & - avgflag='A', long_name='litter C heterotrophic respiration', & - ptr_col=ccf%lithr) - - call hist_addfld1d (fname='LITTERC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='litter C loss', & - ptr_col=ccf%litterc_loss) - - call hist_addfld1d (fname='SOILC_HR', units='gC/m^2/s', & - avgflag='A', long_name='soil C heterotrophic respiration', & - ptr_col=ccf%somhr) - - call hist_addfld1d (fname='SOILC_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='soil C loss', & - ptr_col=ccf%somhr) - - call hist_addfld1d (fname='M_LEAFC_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C mortality to litter 1 C', & - ptr_col=ccf%m_leafc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_TO_LITR2C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C mortality to litter 2 C', & - ptr_col=ccf%m_leafc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_TO_LITR3C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C mortality to litter 3 C', & - ptr_col=ccf%m_leafc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C mortality to litter 1 C', & - ptr_col=ccf%m_frootc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_TO_LITR2C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C mortality to litter 2 C', & - ptr_col=ccf%m_frootc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_TO_LITR3C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C mortality to litter 3 C', & - ptr_col=ccf%m_frootc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C storage mortality to litter 1 C', & - ptr_col=ccf%m_leafc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C storage mortality to litter 1 C', & - ptr_col=ccf%m_frootc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='live stem C storage mortality to litter 1 C', & - ptr_col=ccf%m_livestemc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C storage mortality to litter 1 C', & - ptr_col=ccf%m_deadstemc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C storage mortality to litter 1 C', & - ptr_col=ccf%m_livecrootc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C storage mortality to litter 1 C', & - ptr_col=ccf%m_deadcrootc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LEAFC_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C transfer mortality to litter 1 C', & - ptr_col=ccf%m_leafc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_FROOTC_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C transfer mortality to litter 1 C', & - ptr_col=ccf%m_frootc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='live stem C transfer mortality to litter 1 C', & - ptr_col=ccf%m_livestemc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C transfer mortality to litter 1 C', & - ptr_col=ccf%m_deadstemc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C transfer mortality to litter 1 C', & - ptr_col=ccf%m_livecrootc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C transfer mortality to litter 1 C', & - ptr_col=ccf%m_deadcrootc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMC_TO_CWDC', units='gC/m^2/s', & - avgflag='A', long_name='live stem C mortality to coarse woody debris C', & - ptr_col=ccf%m_livestemc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_TO_CWDC', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C mortality to coarse woody debris C', & - ptr_col=ccf%m_deadstemc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTC_TO_CWDC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root C mortality to coarse woody debris C', & - ptr_col=ccf%m_livecrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_TO_CWDC', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C mortality to coarse woody debris C', & - ptr_col=ccf%m_deadcrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='M_GRESP_STORAGE_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration storage mortality to litter 1 C', & - ptr_col=ccf%m_gresp_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_GRESP_XFER_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='growth respiration transfer mortality to litter 1 C', & - ptr_col=ccf%m_gresp_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMC_TO_CWDC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead stem C to coarse woody debris C by fire', & - ptr_col=ccf%m_deadstemc_to_cwdc_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTC_TO_CWDC_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root C to to woody debris C by fire', & - ptr_col=ccf%m_deadcrootc_to_cwdc_fire, default='inactive') - - call hist_addfld1d (fname='M_LITR1C_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='litter 1 C fire loss', & - ptr_col=ccf%m_litr1c_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LITR2C_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='litter 2 C fire loss', & - ptr_col=ccf%m_litr2c_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LITR3C_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='litter 3 C fire loss', & - ptr_col=ccf%m_litr3c_to_fire, default='inactive') - - call hist_addfld1d (fname='M_CWDC_TO_FIRE', units='gC/m^2/s', & - avgflag='A', long_name='coarse woody debris C fire loss', & - ptr_col=ccf%m_cwdc_to_fire, default='inactive') - - call hist_addfld1d (fname='LEAFC_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall to litter 1 C', & - ptr_col=ccf%leafc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='LEAFC_TO_LITR2C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall to litter 2 C', & - ptr_col=ccf%leafc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='LEAFC_TO_LITR3C', units='gC/m^2/s', & - avgflag='A', long_name='leaf C litterfall to litter 3 C', & - ptr_col=ccf%leafc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='FROOTC_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C litterfall to litter 1 C', & - ptr_col=ccf%frootc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='FROOTC_TO_LITR2C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C litterfall to litter 2 C', & - ptr_col=ccf%frootc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='FROOTC_TO_LITR3C', units='gC/m^2/s', & - avgflag='A', long_name='fine root C litterfall to litter 3 C', & - ptr_col=ccf%frootc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='CWDC_TO_LITR2C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of coarse woody debris C to litter 2 C', & - ptr_col=ccf%cwdc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='CWDC_TO_LITR3C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of coarse woody debris C to litter 3 C', & - ptr_col=ccf%cwdc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='LITR1_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from litter 1 C', & - ptr_col=ccf%litr1_hr, default='inactive') - - call hist_addfld1d (fname='LITR1C_TO_SOIL1C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of litter 1 C to SOM 1 C', & - ptr_col=ccf%litr1c_to_soil1c) - - call hist_addfld1d (fname='LITR2_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from litter 2 C', & - ptr_col=ccf%litr2_hr, default='inactive') - - call hist_addfld1d (fname='LITR2C_TO_SOIL2C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of litter 2 C to SOM 2 C', & - ptr_col=ccf%litr2c_to_soil2c) - - call hist_addfld1d (fname='LITR3_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from litter 3 C', & - ptr_col=ccf%litr3_hr, default='inactive') - - call hist_addfld1d (fname='LITR3C_TO_SOIL3C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of litter 3 C to SOM 3 C', & - ptr_col=ccf%litr3c_to_soil3c) - - call hist_addfld1d (fname='SOIL1_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from SOM 1 C', & - ptr_col=ccf%soil1_hr, default='inactive') - - call hist_addfld1d (fname='SOIL1C_TO_SOIL2C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of SOM 1 C to SOM 2 C', & - ptr_col=ccf%soil1c_to_soil2c, default='inactive') - - call hist_addfld1d (fname='SOIL2_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from SOM 2 C', & - ptr_col=ccf%soil2_hr, default='inactive') - - call hist_addfld1d (fname='SOIL2C_TO_SOIL3C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of SOM 2 C to SOM 3 C', & - ptr_col=ccf%soil2c_to_soil3c, default='inactive') - - call hist_addfld1d (fname='SOIL3_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from SOM 3 C', & - ptr_col=ccf%soil3_hr, default='inactive') - - call hist_addfld1d (fname='SOIL3C_TO_SOIL4C', units='gC/m^2/s', & - avgflag='A', long_name='decomp. of SOM 3 C to SOM 4 C', & - ptr_col=ccf%soil3c_to_soil4c, default='inactive') - - call hist_addfld1d (fname='SOIL4_HR', units='gC/m^2/s', & - avgflag='A', long_name='het. resp. from SOM 4 C', & - ptr_col=ccf%soil4_hr, default='inactive') - - call hist_addfld1d (fname='LITHR', units='gC/m^2/s', & - avgflag='A', long_name='litter heterotrophic respiration', & - ptr_col=ccf%lithr) - - call hist_addfld1d (fname='SOMHR', units='gC/m^2/s', & - avgflag='A', long_name='soil organic matter heterotrophic respiration', & - ptr_col=ccf%somhr) - - call hist_addfld1d (fname='HR', units='gC/m^2/s', & - avgflag='A', long_name='total heterotrophic respiration', & - ptr_col=ccf%hr) - - call hist_addfld1d (fname='SR', units='gC/m^2/s', & - avgflag='A', long_name='total soil respiration (HR + root resp)', & - ptr_col=ccf%sr) - - call hist_addfld1d (fname='ER', units='gC/m^2/s', & - avgflag='A', long_name='total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=ccf%er) - - call hist_addfld1d (fname='LITFIRE', units='gC/m^2/s', & - avgflag='A', long_name='litter fire losses', & - ptr_col=ccf%litfire, default='inactive') - - call hist_addfld1d (fname='SOMFIRE', units='gC/m^2/s', & - avgflag='A', long_name='soil organic matter fire losses', & - ptr_col=ccf%somfire, default='inactive') - - call hist_addfld1d (fname='TOTFIRE', units='gC/m^2/s', & - avgflag='A', long_name='total ecosystem fire losses', & - ptr_col=ccf%totfire, default='inactive') - - call hist_addfld1d (fname='NEP', units='gC/m^2/s', & - avgflag='A', long_name='net ecosystem production, excludes fire, landuse, and harvest flux, positive for sink', & - ptr_col=ccf%nep) - - call hist_addfld1d (fname='NBP', units='gC/m^2/s', & - avgflag='A', long_name='net biome production, includes fire, landuse, and harvest flux, positive for sink', & - ptr_col=ccf%nbp) - - call hist_addfld1d (fname='NEE', units='gC/m^2/s', & - avgflag='A', long_name=& - 'net ecosystem exchange of carbon, includes fire, landuse, harvest, and hrv_xsmrpool flux, positive for source', & - ptr_col=ccf%nee) - - call hist_addfld1d (fname='COL_FIRE_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total column-level fire C loss', & - ptr_col=ccf%col_fire_closs) - - call hist_addfld1d (fname='DWT_SEEDC_TO_LEAF', units='gC/m^2/s', & - avgflag='A', long_name='seed source to PFT-level leaf', & - ptr_col=ccf%dwt_seedc_to_leaf) - - call hist_addfld1d (fname='DWT_SEEDC_TO_DEADSTEM', units='gC/m^2/s', & - avgflag='A', long_name='seed source to PFT-level deadstem', & - ptr_col=ccf%dwt_seedc_to_deadstem) - - call hist_addfld1d (fname='DWT_CONV_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='conversion C flux (immediate loss to atm)', & - ptr_col=ccf%dwt_conv_cflux) - - call hist_addfld1d (fname='DWT_PROD10C_GAIN', units='gC/m^2/s', & - avgflag='A', long_name='landcover change-driven addition to 10-yr wood product pool', & - ptr_col=ccf%dwt_prod10c_gain) - - call hist_addfld1d (fname='PROD10C_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='loss from 10-yr wood product pool', & - ptr_col=ccf%prod10c_loss) - - call hist_addfld1d (fname='DWT_PROD100C_GAIN', units='gC/m^2/s', & - avgflag='A', long_name='landcover change-driven addition to 100-yr wood product pool', & - ptr_col=ccf%dwt_prod100c_gain) - - call hist_addfld1d (fname='PROD100C_LOSS', units='gC/m^2/s', & - avgflag='A', long_name='loss from 100-yr wood product pool', & - ptr_col=ccf%prod100c_loss) - - call hist_addfld1d (fname='DWT_FROOTC_TO_LITR1C', units='gC/m^2/s', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=ccf%dwt_frootc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='DWT_FROOTC_TO_LITR2C', units='gC/m^2/s', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=ccf%dwt_frootc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='DWT_FROOTC_TO_LITR3C', units='gC/m^2/s', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=ccf%dwt_frootc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='DWT_LIVECROOTC_TO_CWDC', units='gC/m^2/s', & - avgflag='A', long_name='live coarse root to CWD due to landcover change', & - ptr_col=ccf%dwt_livecrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='DWT_DEADCROOTC_TO_CWDC', units='gC/m^2/s', & - avgflag='A', long_name='dead coarse root to CWD due to landcover change', & - ptr_col=ccf%dwt_deadcrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='DWT_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total carbon loss from land cover conversion', & - ptr_col=ccf%dwt_closs) - - call hist_addfld1d (fname='PRODUCT_CLOSS', units='gC/m^2/s', & - avgflag='A', long_name='total carbon loss from wood product pools', & - ptr_col=ccf%product_closs) - - call hist_addfld1d (fname='LAND_USE_FLUX', units='gC/m^2/s', & - avgflag='A', long_name='total C emitted from land cover conversion and wood product pools', & - ptr_col=ccf%landuseflux) - - call hist_addfld1d (fname='LAND_UPTAKE', units='gC/m^2/s', & - avgflag='A', long_name='NEE minus LAND_USE_FLUX, negative for update', & - ptr_col=ccf%landuptake) - - if (use_c13) then - !------------------------------- - ! C13 flux variables - native to column - !------------------------------- - - call hist_addfld1d (fname='C13_M_LEAFC_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C mortality to litter 1 C', & - ptr_col=cc13f%m_leafc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_TO_LITR2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C mortality to litter 2 C', & - ptr_col=cc13f%m_leafc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_TO_LITR3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C mortality to litter 3 C', & - ptr_col=cc13f%m_leafc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C mortality to litter 1 C', & - ptr_col=cc13f%m_frootc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_TO_LITR2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C mortality to litter 2 C', & - ptr_col=cc13f%m_frootc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_TO_LITR3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C mortality to litter 3 C', & - ptr_col=cc13f%m_frootc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C storage mortality to litter 1 C', & - ptr_col=cc13f%m_leafc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C storage mortality to litter 1 C', & - ptr_col=cc13f%m_frootc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C storage mortality to litter 1 C', & - ptr_col=cc13f%m_livestemc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C storage mortality to litter 1 C', & - ptr_col=cc13f%m_deadstemc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C storage mortality to litter 1 C', & - ptr_col=cc13f%m_livecrootc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C storage mortality to litter 1 C', & - ptr_col=cc13f%m_deadcrootc_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LEAFC_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C transfer mortality to litter 1 C', & - ptr_col=cc13f%m_leafc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_FROOTC_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C transfer mortality to litter 1 C', & - ptr_col=cc13f%m_frootc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C transfer mortality to litter 1 C', & - ptr_col=cc13f%m_livestemc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C transfer mortality to litter 1 C', & - ptr_col=cc13f%m_deadstemc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C transfer mortality to litter 1 C', & - ptr_col=cc13f%m_livecrootc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C transfer mortality to litter 1 C', & - ptr_col=cc13f%m_deadcrootc_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVESTEMC_TO_CWDC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live stem C mortality to coarse woody debris C', & - ptr_col=cc13f%m_livestemc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_CWDC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C mortality to coarse woody debris C', & - ptr_col=cc13f%m_deadstemc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='C13_M_LIVECROOTC_TO_CWDC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root C mortality to coarse woody debris C', & - ptr_col=cc13f%m_livecrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_CWDC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C mortality to coarse woody debris C', & - ptr_col=cc13f%m_deadcrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='C13_M_GRESP_STORAGE_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration storage mortality to litter 1 C', & - ptr_col=cc13f%m_gresp_storage_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_GRESP_XFER_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 growth respiration transfer mortality to litter 1 C', & - ptr_col=cc13f%m_gresp_xfer_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADSTEMC_TO_CWDC_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead stem C to coarse woody debris C by fire', & - ptr_col=cc13f%m_deadstemc_to_cwdc_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_DEADCROOTC_TO_CWDC_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root C to to woody debris C by fire', & - ptr_col=cc13f%m_deadcrootc_to_cwdc_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LITR1C_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter 1 C fire loss', & - ptr_col=cc13f%m_litr1c_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LITR2C_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter 2 C fire loss', & - ptr_col=cc13f%m_litr2c_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_LITR3C_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter 3 C fire loss', & - ptr_col=cc13f%m_litr3c_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_M_CWDC_TO_FIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 coarse woody debris C fire loss', & - ptr_col=cc13f%m_cwdc_to_fire, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C litterfall to litter 1 C', & - ptr_col=cc13f%leafc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_TO_LITR2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C litterfall to litter 2 C', & - ptr_col=cc13f%leafc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='C13_LEAFC_TO_LITR3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 leaf C litterfall to litter 3 C', & - ptr_col=cc13f%leafc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall to litter 1 C', & - ptr_col=cc13f%frootc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_TO_LITR2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall to litter 2 C', & - ptr_col=cc13f%frootc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='C13_FROOTC_TO_LITR3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root C litterfall to litter 3 C', & - ptr_col=cc13f%frootc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='C13_CWDC_TO_LITR2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of coarse woody debris C to litter 2 C', & - ptr_col=cc13f%cwdc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='C13_CWDC_TO_LITR3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of coarse woody debris C to litter 3 C', & - ptr_col=cc13f%cwdc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='C13_LITR1_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from litter 1 C', & - ptr_col=cc13f%litr1_hr, default='inactive') - - call hist_addfld1d (fname='C13_LITR1C_TO_SOIL1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of litter 1 C to SOM 1 C', & - ptr_col=cc13f%litr1c_to_soil1c, default='inactive') - - call hist_addfld1d (fname='C13_LITR2_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from litter 2 C', & - ptr_col=cc13f%litr2_hr, default='inactive') - - call hist_addfld1d (fname='C13_LITR2C_TO_SOIL2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of litter 2 C to SOM 2 C', & - ptr_col=cc13f%litr2c_to_soil2c, default='inactive') - - call hist_addfld1d (fname='C13_LITR3_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from litter 3 C', & - ptr_col=cc13f%litr3_hr, default='inactive') - - call hist_addfld1d (fname='C13_LITR3C_TO_SOIL3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of litter 3 C to SOM 3 C', & - ptr_col=cc13f%litr3c_to_soil3c, default='inactive') - - call hist_addfld1d (fname='C13_SOIL1_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from SOM 1 C', & - ptr_col=cc13f%soil1_hr, default='inactive') - - call hist_addfld1d (fname='C13_SOIL1C_TO_SOIL2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of SOM 1 C to SOM 2 C', & - ptr_col=cc13f%soil1c_to_soil2c, default='inactive') - - call hist_addfld1d (fname='C13_SOIL2_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from SOM 2 C', & - ptr_col=cc13f%soil2_hr, default='inactive') - - call hist_addfld1d (fname='C13_SOIL2C_TO_SOIL3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of SOM 2 C to SOM 3 C', & - ptr_col=cc13f%soil2c_to_soil3c, default='inactive') - - call hist_addfld1d (fname='C13_SOIL3_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from SOM 3 C', & - ptr_col=cc13f%soil3_hr, default='inactive') - - call hist_addfld1d (fname='C13_SOIL3C_TO_SOIL4C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 decomp. of SOM 3 C to SOM 4 C', & - ptr_col=cc13f%soil3c_to_soil4c, default='inactive') - - call hist_addfld1d (fname='C13_SOIL4_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 het. resp. from SOM 4 C', & - ptr_col=cc13f%soil4_hr, default='inactive') - - call hist_addfld1d (fname='C13_LITHR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter heterotrophic respiration', & - ptr_col=cc13f%lithr) - - call hist_addfld1d (fname='C13_SOMHR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 soil organic matter heterotrophic respiration', & - ptr_col=cc13f%somhr) - - call hist_addfld1d (fname='C13_HR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total heterotrophic respiration', & - ptr_col=cc13f%hr) - - call hist_addfld1d (fname='C13_SR', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total soil respiration (HR + root resp)', & - ptr_col=cc13f%sr) - - call hist_addfld1d (fname='C13_ER', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total ecosystem respiration, autotrophic + heterotrophic', & - ptr_col=cc13f%er) - - call hist_addfld1d (fname='C13_LITFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 litter fire losses', & - ptr_col=cc13f%litfire, default='inactive') - - call hist_addfld1d (fname='C13_SOMFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 soil organic matter fire losses', & - ptr_col=cc13f%somfire, default='inactive') - - call hist_addfld1d (fname='C13_TOTFIRE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total ecosystem fire losses', & - ptr_col=cc13f%totfire, default='inactive') - - call hist_addfld1d (fname='C13_NEP', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net ecosystem production, excludes fire flux, positive for sink', & - ptr_col=cc13f%nep) - - call hist_addfld1d (fname='C13_NEE', units='gC13/m^2/s', & - avgflag='A', long_name='C13 net ecosystem exchange of carbon, includes fire flux, positive for source', & - ptr_col=cc13f%nee) - - call hist_addfld1d (fname='C13_COL_FIRE_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total column-level fire C loss', & - ptr_col=cc13f%col_fire_closs) - - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_LEAF', units='gC13/m^2/s', & - avgflag='A', long_name='C13 seed source to PFT-level leaf', & - ptr_col=cc13f%dwt_seedc_to_leaf) - - call hist_addfld1d (fname='C13_DWT_SEEDC_TO_DEADSTEM', units='gC13/m^2/s', & - avgflag='A', long_name='C13 seed source to PFT-level deadstem', & - ptr_col=cc13f%dwt_seedc_to_deadstem) - - call hist_addfld1d (fname='C13_DWT_CONV_CFLUX', units='gC13/m^2/s', & - avgflag='A', long_name='C13 conversion C flux (immediate loss to atm)', & - ptr_col=cc13f%dwt_conv_cflux) - - call hist_addfld1d (fname='C13_DWT_PROD10C_GAIN', units='gC13/m^2/s', & - avgflag='A', long_name='C13 addition to 10-yr wood product pool', & - ptr_col=cc13f%dwt_prod10c_gain) - - call hist_addfld1d (fname='C13_PROD10C_LOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 loss from 10-yr wood product pool', & - ptr_col=cc13f%prod10c_loss) - - call hist_addfld1d (fname='C13_DWT_PROD100C_GAIN', units='gC13/m^2/s', & - avgflag='A', long_name='C13 addition to 100-yr wood product pool', & - ptr_col=cc13f%dwt_prod100c_gain) - - call hist_addfld1d (fname='C13_PROD100C_LOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 loss from 100-yr wood product pool', & - ptr_col=cc13f%prod100c_loss) - - call hist_addfld1d (fname='C13_DWT_FROOTC_TO_LITR1C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=cc13f%dwt_frootc_to_litr1c, default='inactive') - - call hist_addfld1d (fname='C13_DWT_FROOTC_TO_LITR2C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=cc13f%dwt_frootc_to_litr2c, default='inactive') - - call hist_addfld1d (fname='C13_DWT_FROOTC_TO_LITR3C', units='gC13/m^2/s', & - avgflag='A', long_name='C13 fine root to litter due to landcover change', & - ptr_col=cc13f%dwt_frootc_to_litr3c, default='inactive') - - call hist_addfld1d (fname='C13_DWT_LIVECROOTC_TO_CWDC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 live coarse root to CWD due to landcover change', & - ptr_col=cc13f%dwt_livecrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='C13_DWT_DEADCROOTC_TO_CWDC', units='gC13/m^2/s', & - avgflag='A', long_name='C13 dead coarse root to CWD due to landcover change', & - ptr_col=cc13f%dwt_deadcrootc_to_cwdc, default='inactive') - - call hist_addfld1d (fname='C13_DWT_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total carbon loss from land cover conversion', & - ptr_col=cc13f%dwt_closs) - - call hist_addfld1d (fname='C13_PRODUCT_CLOSS', units='gC13/m^2/s', & - avgflag='A', long_name='C13 total carbon loss from wood product pools', & - ptr_col=cc13f%product_closs) - endif - - !------------------------------- - ! N flux variables - native to PFT - !------------------------------- - - call hist_addfld1d (fname='M_LEAFN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N mortality', & - ptr_pft=pnf%m_leafn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N mortality', & - ptr_pft=pnf%m_frootn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage mortality', & - ptr_pft=pnf%m_leafn_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage mortality', & - ptr_pft=pnf%m_frootn_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage mortality', & - ptr_pft=pnf%m_livestemn_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage mortality', & - ptr_pft=pnf%m_deadstemn_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage mortality', & - ptr_pft=pnf%m_livecrootn_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage mortality', & - ptr_pft=pnf%m_deadcrootn_storage_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer mortality', & - ptr_pft=pnf%m_leafn_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer mortality', & - ptr_pft=pnf%m_frootn_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer mortality', & - ptr_pft=pnf%m_livestemn_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer mortality', & - ptr_pft=pnf%m_deadstemn_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer mortality', & - ptr_pft=pnf%m_livecrootn_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer mortality', & - ptr_pft=pnf%m_deadcrootn_xfer_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N mortality', & - ptr_pft=pnf%m_livestemn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N mortality', & - ptr_pft=pnf%m_deadstemn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N mortality', & - ptr_pft=pnf%m_livecrootn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N mortality', & - ptr_pft=pnf%m_deadcrootn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_RETRANSN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool mortality', & - ptr_pft=pnf%m_retransn_to_litter, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N fire loss', & - ptr_pft=pnf%m_leafn_to_fire, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N fire loss ', & - ptr_pft=pnf%m_frootn_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage fire loss', & - ptr_pft=pnf%m_leafn_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage fire loss', & - ptr_pft=pnf%m_frootn_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage fire loss', & - ptr_pft=pnf%m_livestemn_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage fire loss', & - ptr_pft=pnf%m_deadstemn_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage fire loss', & - ptr_pft=pnf%m_livecrootn_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage fire loss', & - ptr_pft=pnf%m_deadcrootn_storage_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer fire loss', & - ptr_pft=pnf%m_leafn_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer fire loss', & - ptr_pft=pnf%m_frootn_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer fire loss', & - ptr_pft=pnf%m_livestemn_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer fire loss', & - ptr_pft=pnf%m_deadstemn_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer fire loss', & - ptr_pft=pnf%m_livecrootn_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer fire loss', & - ptr_pft=pnf%m_deadcrootn_xfer_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live stem N fire loss', & - ptr_pft=pnf%m_livestemn_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N fire loss', & - ptr_pft=pnf%m_deadstemn_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N fire mortality to litter', & - ptr_pft=pnf%m_deadstemn_to_litter_fire, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N fire loss', & - ptr_pft=pnf%m_livecrootn_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N fire loss', & - ptr_pft=pnf%m_deadcrootn_to_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_TO_LITTER_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N fire mortality to litter', & - ptr_pft=pnf%m_deadcrootn_to_litter_fire, default='inactive') - - call hist_addfld1d (fname='M_RETRANSN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool fire loss', & - ptr_pft=pnf%m_retransn_to_fire, default='inactive') - - call hist_addfld1d (fname='LEAFN_XFER_TO_LEAFN', units='gN/m^2/s', & - avgflag='A', long_name='leaf N growth from storage', & - ptr_pft=pnf%leafn_xfer_to_leafn, default='inactive') - - call hist_addfld1d (fname='FROOTN_XFER_TO_FROOTN', units='gN/m^2/s', & - avgflag='A', long_name='fine root N growth from storage', & - ptr_pft=pnf%frootn_xfer_to_frootn, default='inactive') - - call hist_addfld1d (fname='LIVESTEMN_XFER_TO_LIVESTEMN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N growth from storage', & - ptr_pft=pnf%livestemn_xfer_to_livestemn, default='inactive') - - call hist_addfld1d (fname='DEADSTEMN_XFER_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N growth from storage', & - ptr_pft=pnf%deadstemn_xfer_to_deadstemn, default='inactive') - - call hist_addfld1d (fname='LIVECROOTN_XFER_TO_LIVECROOTN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N growth from storage', & - ptr_pft=pnf%livecrootn_xfer_to_livecrootn, default='inactive') - - call hist_addfld1d (fname='DEADCROOTN_XFER_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N growth from storage', & - ptr_pft=pnf%deadcrootn_xfer_to_deadcrootn, default='inactive') - - call hist_addfld1d (fname='LEAFN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N litterfall', & - ptr_pft=pnf%leafn_to_litter, default='inactive') - - call hist_addfld1d (fname='LEAFN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='leaf N to retranslocated N pool', & - ptr_pft=pnf%leafn_to_retransn, default='inactive') - - call hist_addfld1d (fname='FROOTN_TO_LITTER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N litterfall', & - ptr_pft=pnf%frootn_to_litter, default='inactive') - - call hist_addfld1d (fname='RETRANSN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of retranslocated N', & - ptr_pft=pnf%retransn_to_npool) - - call hist_addfld1d (fname='SMINN_TO_NPOOL', units='gN/m^2/s', & - avgflag='A', long_name='deployment of soil mineral N uptake', & - ptr_pft=pnf%sminn_to_npool) - - call hist_addfld1d (fname='NPOOL_TO_LEAFN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to leaf N', & - ptr_pft=pnf%npool_to_leafn, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_LEAFN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to leaf N storage', & - ptr_pft=pnf%npool_to_leafn_storage, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_FROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to fine root N', & - ptr_pft=pnf%npool_to_frootn, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_FROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to fine root N storage', & - ptr_pft=pnf%npool_to_frootn_storage, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live stem N', & - ptr_pft=pnf%npool_to_livestemn, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_LIVESTEMN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live stem N storage', & - ptr_pft=pnf%npool_to_livestemn_storage, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead stem N', & - ptr_pft=pnf%npool_to_deadstemn, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_DEADSTEMN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead stem N storage', & - ptr_pft=pnf%npool_to_deadstemn_storage, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live coarse root N', & - ptr_pft=pnf%npool_to_livecrootn, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_LIVECROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to live coarse root N storage', & - ptr_pft=pnf%npool_to_livecrootn_storage, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root N', & - ptr_pft=pnf%npool_to_deadcrootn, default='inactive') - - call hist_addfld1d (fname='NPOOL_TO_DEADCROOTN_STORAGE', units='gN/m^2/s', & - avgflag='A', long_name='allocation to dead coarse root N storage', & - ptr_pft=pnf%npool_to_deadcrootn_storage, default='inactive') - - call hist_addfld1d (fname='LEAFN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='leaf N shift storage to transfer', & - ptr_pft=pnf%leafn_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='FROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='fine root N shift storage to transfer', & - ptr_pft=pnf%frootn_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='LIVESTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='live stem N shift storage to transfer', & - ptr_pft=pnf%livestemn_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='DEADSTEMN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N shift storage to transfer', & - ptr_pft=pnf%deadstemn_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='LIVECROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N shift storage to transfer', & - ptr_pft=pnf%livecrootn_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='DEADCROOTN_STORAGE_TO_XFER', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N shift storage to transfer', & - ptr_pft=pnf%deadcrootn_storage_to_xfer, default='inactive') - - call hist_addfld1d (fname='LIVESTEMN_TO_DEADSTEMN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N turnover', & - ptr_pft=pnf%livestemn_to_deadstemn, default='inactive') - - call hist_addfld1d (fname='LIVESTEMN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N to retranslocated N pool', & - ptr_pft=pnf%livestemn_to_retransn, default='inactive') - - call hist_addfld1d (fname='LIVECROOTN_TO_DEADCROOTN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N turnover', & - ptr_pft=pnf%livecrootn_to_deadcrootn, default='inactive') - - call hist_addfld1d (fname='LIVECROOTN_TO_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N to retranslocated N pool', & - ptr_pft=pnf%livecrootn_to_retransn, default='inactive') - - call hist_addfld1d (fname='NDEPLOY', units='gN/m^2/s', & - avgflag='A', long_name='total N deployed in new growth', & - ptr_pft=pnf%ndeploy) - - call hist_addfld1d (fname='WOOD_HARVESTN', units='gN/m^2/s', & - avgflag='A', long_name='wood harvest N (to product pools)', & - ptr_pft=pnf%wood_harvestn) - - call hist_addfld1d (fname='PFT_FIRE_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total pft-level fire N loss', & - ptr_pft=pnf%pft_fire_nloss) - - !------------------------------- - ! N flux variables - native to column - !------------------------------- - - call hist_addfld1d (fname='NDEP_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='atmospheric N deposition to soil mineral N', & - ptr_col=cnf%ndep_to_sminn) - - call hist_addfld1d (fname='NFIX_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='symbiotic/asymbiotic N fixation to soil mineral N', & - ptr_col=cnf%nfix_to_sminn) - - call hist_addfld1d (fname='M_LEAFN_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N mortality to litter 1 N', & - ptr_col=cnf%m_leafn_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_TO_LITR2N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N mortality to litter 2 N', & - ptr_col=cnf%m_leafn_to_litr2n, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_TO_LITR3N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N mortality to litter 3 N', & - ptr_col=cnf%m_leafn_to_litr3n, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N mortality to litter 1 N', & - ptr_col=cnf%m_frootn_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_TO_LITR2N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N mortality to litter 2 N', & - ptr_col=cnf%m_frootn_to_litr2n, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_TO_LITR3N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N mortality to litter 3 N', & - ptr_col=cnf%m_frootn_to_litr3n, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_STORAGE_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N storage mortality to litter 1 N', & - ptr_col=cnf%m_leafn_storage_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_STORAGE_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N storage mortality to litter 1 N', & - ptr_col=cnf%m_frootn_storage_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_STORAGE_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='live stem N storage mortality to litter 1 N', & - ptr_col=cnf%m_livestemn_storage_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_STORAGE_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N storage mortality to litter 1 N', & - ptr_col=cnf%m_deadstemn_storage_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_STORAGE_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N storage mortality to litter 1 N', & - ptr_col=cnf%m_livecrootn_storage_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_STORAGE_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N storage mortality to litter 1 N', & - ptr_col=cnf%m_deadcrootn_storage_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LEAFN_XFER_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N transfer mortality to litter 1 N', & - ptr_col=cnf%m_leafn_xfer_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_FROOTN_XFER_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N transfer mortality to litter 1 N', & - ptr_col=cnf%m_frootn_xfer_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_XFER_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='live stem N transfer mortality to litter 1 N', & - ptr_col=cnf%m_livestemn_xfer_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_XFER_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N transfer mortality to litter 1 N', & - ptr_col=cnf%m_deadstemn_xfer_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_XFER_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N transfer mortality to litter 1 N', & - ptr_col=cnf%m_livecrootn_xfer_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_XFER_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N transfer mortality to litter 1 N', & - ptr_col=cnf%m_deadcrootn_xfer_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_LIVESTEMN_TO_CWDN', units='gN/m^2/s', & - avgflag='A', long_name='live stem N mortality to coarse woody debris N', & - ptr_col=cnf%m_livestemn_to_cwdn, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_TO_CWDN', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N mortality to coarse woody debris N', & - ptr_col=cnf%m_deadstemn_to_cwdn, default='inactive') - - call hist_addfld1d (fname='M_LIVECROOTN_TO_CWDN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root N mortality to coarse woody debris N', & - ptr_col=cnf%m_livecrootn_to_cwdn, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_TO_CWDN', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N mortality to coarse woody debris N', & - ptr_col=cnf%m_deadcrootn_to_cwdn, default='inactive') - - call hist_addfld1d (fname='M_RETRANSN_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='retranslocated N pool mortality to litter 1 N', & - ptr_col=cnf%m_retransn_to_litr1n, default='inactive') - - call hist_addfld1d (fname='M_DEADSTEMN_TO_CWDN_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead stem N to coarse woody debris N by fire', & - ptr_col=cnf%m_deadstemn_to_cwdn_fire, default='inactive') - - call hist_addfld1d (fname='M_DEADCROOTN_TO_CWDN_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root N to to woody debris N by fire', & - ptr_col=cnf%m_deadcrootn_to_cwdn_fire, default='inactive') - - call hist_addfld1d (fname='M_LITR1N_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='litter 1 N fire loss', & - ptr_col=cnf%m_litr1n_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LITR2N_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='litter 2 N fire loss', & - ptr_col=cnf%m_litr2n_to_fire, default='inactive') - - call hist_addfld1d (fname='M_LITR3N_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='litter 3 N fire loss', & - ptr_col=cnf%m_litr3n_to_fire, default='inactive') - - call hist_addfld1d (fname='M_CWDN_TO_FIRE', units='gN/m^2/s', & - avgflag='A', long_name='coarse woody debris N fire loss', & - ptr_col=cnf%m_cwdn_to_fire, default='inactive') - - call hist_addfld1d (fname='LEAFN_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N litterfall to litter 1 N', & - ptr_col=cnf%leafn_to_litr1n, default='inactive') - - call hist_addfld1d (fname='LEAFN_TO_LITR2N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N litterfall to litter 2 N', & - ptr_col=cnf%leafn_to_litr2n, default='inactive') - - call hist_addfld1d (fname='LEAFN_TO_LITR3N', units='gN/m^2/s', & - avgflag='A', long_name='leaf N litterfall to litter 3 N', & - ptr_col=cnf%leafn_to_litr3n, default='inactive') - - call hist_addfld1d (fname='FROOTN_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N litterfall to litter 1 N', & - ptr_col=cnf%frootn_to_litr1n, default='inactive') - - call hist_addfld1d (fname='FROOTN_TO_LITR2N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N litterfall to litter 2 N', & - ptr_col=cnf%frootn_to_litr2n, default='inactive') - - call hist_addfld1d (fname='FROOTN_TO_LITR3N', units='gN/m^2/s', & - avgflag='A', long_name='fine root N litterfall to litter 3 N ', & - ptr_col=cnf%frootn_to_litr3n, default='inactive') - - call hist_addfld1d (fname='CWDN_TO_LITR2N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of coarse woody debris N to litter 2 N', & - ptr_col=cnf%cwdn_to_litr2n, default='inactive') - - call hist_addfld1d (fname='CWDN_TO_LITR3N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of coarse woody debris N to litter 3 N', & - ptr_col=cnf%cwdn_to_litr3n, default='inactive') - - call hist_addfld1d (fname='LITR1N_TO_SOIL1N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of litter 1 N to SOM 1 N', & - ptr_col=cnf%litr1n_to_soil1n, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_SOIL1N_L1', units='gN/m^2/s', & - avgflag='A', long_name='mineral N flux for decomp. of litter 1 to SOM 1', & - ptr_col=cnf%sminn_to_soil1n_l1, default='inactive') - - call hist_addfld1d (fname='LITR2N_TO_SOIL2N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of litter 2 N to SOM 2 N', & - ptr_col=cnf%litr2n_to_soil2n, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_SOIL2N_L2', units='gN/m^2/s', & - avgflag='A', long_name='mineral N flux for decomp. of litter 2 to SOM 2', & - ptr_col=cnf%sminn_to_soil2n_l2, default='inactive') - - call hist_addfld1d (fname='LITR3N_TO_SOIL3N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of litter 3 N to SOM 3 N', & - ptr_col=cnf%litr3n_to_soil3n, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_SOIL3N_L3', units='gN/m^2/s', & - avgflag='A', long_name='mineral N flux for decomp. of litter 3 to SOM 3', & - ptr_col=cnf%sminn_to_soil3n_l3, default='inactive') - - call hist_addfld1d (fname='SOIL1N_TO_SOIL2n', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of SOM 1 N to SOM 2 N', & - ptr_col=cnf%soil1n_to_soil2n, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_SOIL2N_S1', units='gN/m^2/s', & - avgflag='A', long_name='mineral N flux for decomp. of SOM 1 to SOM 2', & - ptr_col=cnf%sminn_to_soil2n_s1, default='inactive') - - call hist_addfld1d (fname='SOIL2N_TO_SOIL3N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of SOM 2 N to SOM 3 N', & - ptr_col=cnf%soil2n_to_soil3n, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_SOIL3N_S2', units='gN/m^2/s', & - avgflag='A', long_name='mineral N flux for decomp. of SOM 2 to SOM 3', & - ptr_col=cnf%sminn_to_soil3n_s2, default='inactive') - - call hist_addfld1d (fname='SOIL3N_TO_SOIL4N', units='gN/m^2/s', & - avgflag='A', long_name='decomp. of SOM 3 N to SOM 4 N', & - ptr_col=cnf%soil3n_to_soil4n, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_SOIL4N_S3', units='gN/m^2/s', & - avgflag='A', long_name='mineral N flux for decomp. of SOM 3 to SOM 4', & - ptr_col=cnf%sminn_to_soil4n_s3, default='inactive') - - call hist_addfld1d (fname='SOIL4N_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='N mineralization for decomp. of SOM 4', & - ptr_col=cnf%soil4n_to_sminn, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_L1S1', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of litter 1 to SOM 1', & - ptr_col=cnf%sminn_to_denit_l1s1, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_L2S2', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of litter 2 to SOM 2', & - ptr_col=cnf%sminn_to_denit_l2s2, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_L3S3', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of litter 3 to SOM 3', & - ptr_col=cnf%sminn_to_denit_l3s3, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_S1S2', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of SOM 1 to SOM 2', & - ptr_col=cnf%sminn_to_denit_s1s2, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_S2S3', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of SOM 2 to SOM 3', & - ptr_col=cnf%sminn_to_denit_s2s3, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_S3S4', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of SOM 3 to SOM 4', & - ptr_col=cnf%sminn_to_denit_s3s4, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_S4', units='gN/m^2/s', & - avgflag='A', long_name='denitrification for decomp. of SOM 4', & - ptr_col=cnf%sminn_to_denit_s4, default='inactive') - - call hist_addfld1d (fname='SMINN_TO_DENIT_EXCESS', units='gN/m^2/s', & - avgflag='A', long_name='denitrification from excess mineral N pool', & - ptr_col=cnf%sminn_to_denit_excess, default='inactive') - - call hist_addfld1d (fname='SMINN_LEACHED', units='gN/m^2/s', & - avgflag='A', long_name='soil mineral N pool loss to leaching', & - ptr_col=cnf%sminn_leached) - - call hist_addfld1d (fname='POTENTIAL_IMMOB', units='gN/m^2/s', & - avgflag='A', long_name='potential N immobilization', & - ptr_col=cnf%potential_immob) - - call hist_addfld1d (fname='ACTUAL_IMMOB', units='gN/m^2/s', & - avgflag='A', long_name='actual N immobilization', & - ptr_col=cnf%actual_immob) - - call hist_addfld1d (fname='SMINN_TO_PLANT', units='gN/m^2/s', & - avgflag='A', long_name='plant uptake of soil mineral N', & - ptr_col=cnf%sminn_to_plant) - - call hist_addfld1d (fname='SUPPLEMENT_TO_SMINN', units='gN/m^2/s', & - avgflag='A', long_name='supplemental N supply', & - ptr_col=cnf%supplement_to_sminn) - - call hist_addfld1d (fname='GROSS_NMIN', units='gN/m^2/s', & - avgflag='A', long_name='gross rate of N mineralization', & - ptr_col=cnf%gross_nmin) - - call hist_addfld1d (fname='NET_NMIN', units='gN/m^2/s', & - avgflag='A', long_name='net rate of N mineralization', & - ptr_col=cnf%net_nmin) - - call hist_addfld1d (fname='DENIT', units='gN/m^2/s', & - avgflag='A', long_name='total rate of denitrification', & - ptr_col=cnf%denit) - - call hist_addfld1d (fname='COL_FIRE_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total column-level fire N loss', & - ptr_col=cnf%col_fire_nloss) - - call hist_addfld1d (fname='DWT_SEEDN_TO_LEAF', units='gN/m^2/s', & - avgflag='A', long_name='seed source to PFT-level leaf', & - ptr_col=cnf%dwt_seedn_to_leaf) - - call hist_addfld1d (fname='DWT_SEEDN_TO_DEADSTEM', units='gN/m^2/s', & - avgflag='A', long_name='seed source to PFT-level deadstem', & - ptr_col=cnf%dwt_seedn_to_deadstem) - - call hist_addfld1d (fname='DWT_CONV_NFLUX', units='gN/m^2/s', & - avgflag='A', long_name='conversion N flux (immediate loss to atm)', & - ptr_col=cnf%dwt_conv_nflux) - - call hist_addfld1d (fname='DWT_PROD10N_GAIN', units='gN/m^2/s', & - avgflag='A', long_name='addition to 10-yr wood product pool', & - ptr_col=cnf%dwt_prod10n_gain) - - call hist_addfld1d (fname='PROD10N_LOSS', units='gN/m^2/s', & - avgflag='A', long_name='loss from 10-yr wood product pool', & - ptr_col=cnf%prod10n_loss) - - call hist_addfld1d (fname='DWT_PROD100N_GAIN', units='gN/m^2/s', & - avgflag='A', long_name='addition to 100-yr wood product pool', & - ptr_col=cnf%dwt_prod100n_gain) - - call hist_addfld1d (fname='PROD100N_LOSS', units='gN/m^2/s', & - avgflag='A', long_name='loss from 100-yr wood product pool', & - ptr_col=cnf%prod100n_loss) - - call hist_addfld1d (fname='PRODUCT_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total N loss from wood product pools', & - ptr_col=cnf%product_nloss) - - call hist_addfld1d (fname='DWT_FROOTN_TO_LITR1N', units='gN/m^2/s', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=cnf%dwt_frootn_to_litr1n, default='inactive') - - call hist_addfld1d (fname='DWT_FROOTN_TO_LITR2N', units='gN/m^2/s', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=cnf%dwt_frootn_to_litr2n, default='inactive') - - call hist_addfld1d (fname='DWT_FROOTN_TO_LITR3N', units='gN/m^2/s', & - avgflag='A', long_name='fine root to litter due to landcover change', & - ptr_col=cnf%dwt_frootn_to_litr3n, default='inactive') - - call hist_addfld1d (fname='DWT_LIVECROOTN_TO_CWDN', units='gN/m^2/s', & - avgflag='A', long_name='live coarse root to CWD due to landcover change', & - ptr_col=cnf%dwt_livecrootn_to_cwdn, default='inactive') - - call hist_addfld1d (fname='DWT_DEADCROOTN_TO_CWDN', units='gN/m^2/s', & - avgflag='A', long_name='dead coarse root to CWD due to landcover change', & - ptr_col=cnf%dwt_deadcrootn_to_cwdn, default='inactive') - - call hist_addfld1d (fname='DWT_NLOSS', units='gN/m^2/s', & - avgflag='A', long_name='total nitrogen loss from landcover conversion', & - ptr_col=cnf%dwt_nloss) - - !------------------------------- - ! PFT ecophysiological variables (pepv) - !------------------------------- - - call hist_addfld1d (fname='DORMANT_FLAG', units='none', & - avgflag='A', long_name='dormancy flag', & - ptr_pft=pepv%dormant_flag, default='inactive') - - call hist_addfld1d (fname='DAYS_ACTIVE', units='days', & - avgflag='A', long_name='number of days since last dormancy', & - ptr_pft=pepv%days_active, default='inactive') - - call hist_addfld1d (fname='ONSET_FLAG', units='none', & - avgflag='A', long_name='onset flag', & - ptr_pft=pepv%onset_flag, default='inactive') - - call hist_addfld1d (fname='ONSET_COUNTER', units='days', & - avgflag='A', long_name='onset days counter', & - ptr_pft=pepv%onset_counter, default='inactive') - - call hist_addfld1d (fname='ONSET_GDDFLAG', units='none', & - avgflag='A', long_name='onset flag for growing degree day sum', & - ptr_pft=pepv%onset_gddflag, default='inactive') - - call hist_addfld1d (fname='ONSET_FDD', units='C degree-days', & - avgflag='A', long_name='onset freezing degree days counter', & - ptr_pft=pepv%onset_fdd, default='inactive') - - call hist_addfld1d (fname='ONSET_GDD', units='C degree-days', & - avgflag='A', long_name='onset growing degree days', & - ptr_pft=pepv%onset_gdd, default='inactive') - - call hist_addfld1d (fname='ONSET_SWI', units='none', & - avgflag='A', long_name='onset soil water index', & - ptr_pft=pepv%onset_swi, default='inactive') - - call hist_addfld1d (fname='OFFSET_FLAG', units='none', & - avgflag='A', long_name='offset flag', & - ptr_pft=pepv%offset_flag, default='inactive') - - call hist_addfld1d (fname='OFFSET_COUNTER', units='days', & - avgflag='A', long_name='offset days counter', & - ptr_pft=pepv%offset_counter, default='inactive') - - call hist_addfld1d (fname='OFFSET_FDD', units='C degree-days', & - avgflag='A', long_name='offset freezing degree days counter', & - ptr_pft=pepv%offset_fdd, default='inactive') - - call hist_addfld1d (fname='OFFSET_SWI', units='none', & - avgflag='A', long_name='offset soil water index', & - ptr_pft=pepv%offset_swi, default='inactive') - - call hist_addfld1d (fname='LGSF', units='proportion', & - avgflag='A', long_name='long growing season factor', & - ptr_pft=pepv%lgsf, default='inactive') - - call hist_addfld1d (fname='BGLFR', units='1/s', & - avgflag='A', long_name='background litterfall rate', & - ptr_pft=pepv%bglfr, default='inactive') - - call hist_addfld1d (fname='BGTR', units='1/s', & - avgflag='A', long_name='background transfer growth rate', & - ptr_pft=pepv%bgtr, default='inactive') - - call hist_addfld1d (fname='DAYL', units='s', & - avgflag='A', long_name='daylength', & - ptr_pft=pepv%dayl, default='inactive') - - call hist_addfld1d (fname='PREV_DAYL', units='s', & - avgflag='A', long_name='daylength from previous timestep', & - ptr_pft=pepv%prev_dayl, default='inactive') - - call hist_addfld1d (fname='ANNAVG_T2M', units='K', & - avgflag='A', long_name='annual average 2m air temperature', & - ptr_pft=pepv%annavg_t2m, default='inactive') - - call hist_addfld1d (fname='TEMPAVG_T2M', units='K', & - avgflag='A', long_name='temporary average 2m air temperature', & - ptr_pft=pepv%tempavg_t2m, default='inactive') - - call hist_addfld1d (fname='INIT_GPP', units='gC/m^2/s', & - avgflag='A', long_name='GPP flux before downregulation', & - ptr_pft=pepv%gpp, default='inactive') - - call hist_addfld1d (fname='AVAILC', units='gC/m^2/s', & - avgflag='A', long_name='C flux available for allocation', & - ptr_pft=pepv%availc, default='inactive') - - call hist_addfld1d (fname='XSMRPOOL_RECOVER', units='gC/m^2/s', & - avgflag='A', long_name='C flux assigned to recovery of negative xsmrpool', & - ptr_pft=pepv%xsmrpool_recover) - - if (use_c13) then - call hist_addfld1d (fname='XSMRPOOL_C13RATIO', units='proportion', & - avgflag='A', long_name='C13/C(12+13) ratio for xsmrpool', & - ptr_pft=pepv%xsmrpool_c13ratio, default='inactive') - endif - - call hist_addfld1d (fname='ALLOC_PNOW', units='proportion', & - avgflag='A', long_name='fraction of current allocation to display as new growth', & - ptr_pft=pepv%alloc_pnow, default='inactive') - - call hist_addfld1d (fname='C_ALLOMETRY', units='none', & - avgflag='A', long_name='C allocation index', & - ptr_pft=pepv%c_allometry, default='inactive') - - call hist_addfld1d (fname='N_ALLOMETRY', units='none', & - avgflag='A', long_name='N allocation index', & - ptr_pft=pepv%n_allometry, default='inactive') - - call hist_addfld1d (fname='PLANT_NDEMAND', units='gN/m^2/s', & - avgflag='A', long_name='N flux required to support initial GPP', & - ptr_pft=pepv%plant_ndemand) - - call hist_addfld1d (fname='TEMPSUM_POTENTIAL_GPP', units='gC/m^2/yr', & - avgflag='A', long_name='temporary annual sum of potential GPP', & - ptr_pft=pepv%tempsum_potential_gpp, default='inactive') - - call hist_addfld1d (fname='ANNSUM_POTENTIAL_GPP', units='gN/m^2/yr', & - avgflag='A', long_name='annual sum of potential GPP', & - ptr_pft=pepv%annsum_potential_gpp, default='inactive') - - call hist_addfld1d (fname='TEMPMAX_RETRANSN', units='gN/m^2', & - avgflag='A', long_name='temporary annual max of retranslocated N pool', & - ptr_pft=pepv%tempmax_retransn, default='inactive') - - call hist_addfld1d (fname='ANNMAX_RETRANSN', units='gN/m^2', & - avgflag='A', long_name='annual max of retranslocated N pool', & - ptr_pft=pepv%annmax_retransn, default='inactive') - - call hist_addfld1d (fname='AVAIL_RETRANSN', units='gN/m^2/s', & - avgflag='A', long_name='N flux available from retranslocation pool', & - ptr_pft=pepv%avail_retransn, default='inactive') - - call hist_addfld1d (fname='PLANT_NALLOC', units='gN/m^2/s', & - avgflag='A', long_name='total allocated N flux', & - ptr_pft=pepv%plant_nalloc, default='inactive') - - call hist_addfld1d (fname='PLANT_CALLOC', units='gC/m^2/s', & - avgflag='A', long_name='total allocated C flux', & - ptr_pft=pepv%plant_calloc, default='inactive') - - call hist_addfld1d (fname='EXCESS_CFLUX', units='gC/m^2/s', & - avgflag='A', long_name='C flux not allocated due to downregulation', & - ptr_pft=pepv%excess_cflux, default='inactive') - - call hist_addfld1d (fname='DOWNREG', units='proportion', & - avgflag='A', long_name='fractional reduction in GPP due to N limitation', & - ptr_pft=pepv%downreg, default='inactive') - - call hist_addfld1d (fname='PREV_LEAFC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='previous timestep leaf C litterfall flux', & - ptr_pft=pepv%prev_leafc_to_litter, default='inactive') - - call hist_addfld1d (fname='PREV_FROOTC_TO_LITTER', units='gC/m^2/s', & - avgflag='A', long_name='previous timestep froot C litterfall flux', & - ptr_pft=pepv%prev_frootc_to_litter, default='inactive') - - call hist_addfld1d (fname='ANNSUM_NPP', units='gC/m^2/yr', & - avgflag='A', long_name='annual sum of NPP', & - ptr_pft=pepv%annsum_npp, default='inactive') - - if (use_c13) then - call hist_addfld1d (fname='RC13_CANAIR', units='proportion', & - avgflag='A', long_name='C13/C(12+13) for canopy air', & - ptr_pft=pepv%rc13_canair, default='inactive') - - call hist_addfld1d (fname='RC13_PSNSUN', units='proportion', & - avgflag='A', long_name='C13/C(12+13) for sunlit photosynthesis', & - ptr_pft=pepv%rc13_psnsun, default='inactive') - - call hist_addfld1d (fname='RC13_PSNSHA', units='proportion', & - avgflag='A', long_name='C13/C(12+13) for shaded photosynthesis', & - ptr_pft=pepv%rc13_psnsha, default='inactive') - endif - - !------------------------------- - ! PFT physical state variables not already defined by default - !------------------------------- - - call hist_addfld1d (fname='EMV', units='proportion', & - avgflag='A', long_name='vegetation emissivity', & - ptr_pft=pps%emv, default='inactive') - - call hist_addfld1d (fname='Z0MV', units='m', & - avgflag='A', long_name='roughness length over vegetation, momentum', & - ptr_pft=pps%z0mv, default='inactive') - - call hist_addfld1d (fname='Z0HV', units='m', & - avgflag='A', long_name='roughness length over vegetation, sensible heat', & - ptr_pft=pps%z0hv, default='inactive') - - call hist_addfld1d (fname='Z0QV', units='m', & - avgflag='A', long_name='roughness length over vegetation, latent heat', & - ptr_pft=pps%z0qv, default='inactive') - - call hist_addfld1d (fname='DEWMX', units='mm', & - avgflag='A', long_name='Maximum allowed dew', & - ptr_pft=pps%dewmx, default='inactive') - - call hist_addfld1d (fname='LNCSUN', units='gN/m^2', & - avgflag='A', long_name='leaf N concentration per unit projected LAI', & - ptr_pft=pps%lncsun, default='inactive') - - call hist_addfld1d (fname='LNCSHA', units='gN/m^2', & - avgflag='A', long_name='leaf N concentration per unit projected LAI', & - ptr_pft=pps%lncsha, default='inactive') - - call hist_addfld1d (fname='VCMXSUN', units='umolCO2/m^2/s', & - avgflag='A', long_name='sunlit leaf Vcmax', & - ptr_pft=pps%vcmxsun, default='inactive') - - call hist_addfld1d (fname='VCMXSHA', units='umolCO2/m^2/s', & - avgflag='A', long_name='shaded leaf Vcmax', & - ptr_pft=pps%vcmxsha, default='inactive') - - call hist_addfld1d (fname='FSUN', units='proportion', & - avgflag='A', long_name='sunlit fraction of canopy', & - ptr_pft=pps%fsun, default='inactive') - - call hist_addfld1d (fname='GDIR', units='proportion', & - avgflag='A', long_name='leaf projection in solar direction', & - ptr_pft=pps%gdir, default='inactive') - - call hist_addfld1d (fname='CISUN', units='Pa', & - avgflag='A', long_name='sunlit intracellular CO2', & - ptr_pft=pps%cisun, default='inactive') - - call hist_addfld1d (fname='CISHA', units='Pa', & - avgflag='A', long_name='shaded intracellular CO2', & - ptr_pft=pps%cisha, default='inactive') - - if (use_c13) then - call hist_addfld1d (fname='ALPHAPSNSUN', units='proportion', & - avgflag='A', long_name='sunlit c13 fractionation', & - ptr_pft=pps%alphapsnsun, default='inactive') - - call hist_addfld1d (fname='ALPHAPSNSHA', units='proportion', & - avgflag='A', long_name='shaded c13 fractionation', & - ptr_pft=pps%alphapsnsha, default='inactive') - endif - - call hist_addfld1d (fname='FWET', units='proportion', & - avgflag='A', long_name='fraction of canopy that is wet', & - ptr_pft=pps%fwet, default='inactive') - - call hist_addfld1d (fname='FDRY', units='proportion', & - avgflag='A', long_name='fraction of foliage that is green and dry', & - ptr_pft=pps%fdry, default='inactive') - - call hist_addfld1d (fname='DT_VEG', units='K', & - avgflag='A', long_name='change in t_veg, last iteration', & - ptr_pft=pps%dt_veg, default='inactive') - - call hist_addfld1d (fname='HTOP', units='m', & - avgflag='A', long_name='canopy top', & - ptr_pft=pps%htop) - - call hist_addfld1d (fname='HBOT', units='m', & - avgflag='A', long_name='canopy bottom', & - ptr_pft=pps%hbot, default='inactive') - - call hist_addfld1d (fname='Z0M', units='m', & - avgflag='A', long_name='momentum roughness length', & - ptr_pft=pps%z0m, default='inactive') - - call hist_addfld1d (fname='DISPLA', units='m', & - avgflag='A', long_name='displacement height', & - ptr_pft=pps%displa, default='inactive') - - call hist_addfld1d (fname='U10_DUST', units='m/s', & - avgflag='A', long_name='10-m wind for dust model', & - ptr_pft=pps%u10, default='inactive') - - call hist_addfld1d (fname='RAM1', units='s/m', & - avgflag='A', long_name='aerodynamical resistance ', & - ptr_pft=pps%ram1, default='inactive') - - call hist_addfld1d (fname='FV', units='m/s', & - avgflag='A', long_name='friction velocity for dust model', & - ptr_pft=pps%fv, default='inactive') - - call hist_addfld2d (fname='ROOTFR', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='fraction of roots in each soil layer', & - ptr_pft=pps%rootfr, default='inactive') - - call hist_addfld2d (fname='ROOTR', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective fraction of roots in each soil layer', & - ptr_pft=pps%rootr, default='inactive') - - call hist_addfld2d (fname='RRESIS', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='root resistance in each soil layer', & - ptr_pft=pps%rresis, default='inactive') - - call hist_addfld2d (fname='ALBD', units='proportion', type2d='numrad', & - avgflag='A', long_name='surface albedo (direct)', & - ptr_pft=pps%albd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld2d (fname='ALBI', units='proportion', type2d='numrad', & - avgflag='A', long_name='surface albedo (indirect)', & - ptr_pft=pps%albi, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld2d (fname='FABD', units='proportion', type2d='numrad', & - avgflag='A', long_name='flux absorbed by veg per unit direct flux', & - ptr_pft=pps%fabd, default='inactive') - - call hist_addfld2d (fname='FABI', units='proportion', type2d='numrad', & - avgflag='A', long_name='flux absorbed by veg per unit indirect flux', & - ptr_pft=pps%fabi, default='inactive') - - call hist_addfld2d (fname='FTDD', units='proportion', type2d='numrad', & - avgflag='A', long_name='down direct flux below veg per unit dir flx', & - ptr_pft=pps%ftdd, default='inactive') - - call hist_addfld2d (fname='FTID', units='proportion', type2d='numrad', & - avgflag='A', long_name='down indirect flux below veg per unit dir flx', & - ptr_pft=pps%ftid, default='inactive') - - call hist_addfld2d (fname='FTII', units='proportion', type2d='numrad', & - avgflag='A', long_name='down indirect flux below veg per unit indirect flx', & - ptr_pft=pps%ftii, default='inactive') - - call hist_addfld2d (fname='OMEGA', units='proportion', type2d='numrad', & - avgflag='A', long_name='fraction of intercepted radiation that is scattered', & - ptr_pft=pps%omega, default='inactive') - - call hist_addfld2d (fname='EFF_KID', units='none', type2d='numrad', & - avgflag='A', long_name='effective extinction coefficient for indirect from direct', & - ptr_pft=pps%eff_kid, default='inactive') - - call hist_addfld2d (fname='EFF_KII', units='none', type2d='numrad', & - avgflag='A', long_name='effective extinction coefficient for indirect from indirect', & - ptr_pft=pps%eff_kii, default='inactive') - - call hist_addfld2d (fname='SUN_FAID', units='proportion', type2d='numrad', & - avgflag='A', long_name='fraction sun canopy absorbed indirect from direct', & - ptr_pft=pps%sun_faid, default='inactive') - - call hist_addfld2d (fname='SUN_FAII', units='proportion', type2d='numrad', & - avgflag='A', long_name='fraction sun canopy absorbed indirect from indirect', & - ptr_pft=pps%sun_faii, default='inactive') - - call hist_addfld2d (fname='SHA_FAID', units='proportion', type2d='numrad', & - avgflag='A', long_name='fraction shade canopy absorbed indirect from direct', & - ptr_pft=pps%sha_faid, default='inactive') - - call hist_addfld2d (fname='SHA_FAII', units='proportion', type2d='numrad', & - avgflag='A', long_name='fraction shade canopy absorbed indirect from indirect', & - ptr_pft=pps%sha_faii, default='inactive') - - if ( crop_prog )then - - call hist_addfld1d (fname='GDD0', units='ddays', & - avgflag='A', long_name='Growing degree days base 0C from planting', & - ptr_pft=pps%gdd0, default='inactive') - - call hist_addfld1d (fname='GDD8', units='ddays', & - avgflag='A', long_name='Growing degree days base 8C from planting', & - ptr_pft=pps%gdd8, default='inactive') - - call hist_addfld1d (fname='GDD10', units='ddays', & - avgflag='A', long_name='Growing degree days base 10C from planting', & - ptr_pft=pps%gdd10, default='inactive') - - call hist_addfld1d (fname='GDD020', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 0C from planting', & - ptr_pft=pps%gdd020, default='inactive') - - call hist_addfld1d (fname='GDD820', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 8C from planting', & - ptr_pft=pps%gdd820, default='inactive') - - call hist_addfld1d (fname='GDD1020', units='ddays', & - avgflag='A', long_name='Twenty year average of growing degree days base 10C from planting', & - ptr_pft=pps%gdd1020, default='inactive') - - call hist_addfld1d (fname='GDDPLANT', units='ddays', & - avgflag='A', long_name='Accumulated growing degree days past planting date for crop', & - ptr_pft=pps%gddplant, default='inactive') - - call hist_addfld1d (fname='GDDHARV', units='ddays', & - avgflag='A', long_name='Growing degree days (gdd) needed to harvest', & - ptr_pft=pps%gddmaturity, default='inactive') - - call hist_addfld1d (fname='GDDTSOI', units='ddays', & - avgflag='A', long_name='Growing degree-days from planting (top two soil layers)', & - ptr_pft=pps%gddtsoi, default='inactive') - - end if - - !------------------------------- - ! Column physical state variables not already defined by default - !------------------------------- - - call hist_addfld1d (fname='EMG', units='proportion', & - avgflag='A', long_name='ground emissivity', & - ptr_col=cps%emg, default='inactive') - - call hist_addfld1d (fname='Z0MG', units='m', & - avgflag='A', long_name='roughness length over ground, momentum', & - ptr_col=cps%z0mg, default='inactive') - - call hist_addfld1d (fname='Z0HG', units='m', & - avgflag='A', long_name='roughness length over ground, sensible heat', & - ptr_col=cps%z0hg, default='inactive') - - call hist_addfld1d (fname='Z0QG', units='m', & - avgflag='A', long_name='roughness length over ground, latent heat', & - ptr_col=cps%z0qg, default='inactive') - - call hist_addfld1d (fname='BETA', units='none', & - avgflag='A', long_name='coefficient of convective velocity', & - ptr_col=cps%beta, default='inactive') - - call hist_addfld1d (fname='ZII', units='m', & - avgflag='A', long_name='convective boundary height', & - ptr_col=cps%zii, default='inactive') - - call hist_addfld1d (fname='WF', units='proportion', & - avgflag='A', long_name='soil water as frac. of whc for top 0.5 m', & - ptr_col=cps%wf, default='inactive') - - call hist_addfld1d (fname='FPI', units='proportion', & - avgflag='A', long_name='fraction of potential immobilization', & - ptr_col=cps%fpi) - - call hist_addfld1d (fname='FPG', units='proportion', & - avgflag='A', long_name='fraction of potential gpp', & - ptr_col=cps%fpg) - - call hist_addfld1d (fname='ANNSUM_COUNTER', units='s', & - avgflag='A', long_name='seconds since last annual accumulator turnover', & - ptr_col=cps%annsum_counter, default='inactive') - - call hist_addfld1d (fname='CANNSUM_NPP', units='gC/m^2/s', & - avgflag='A', long_name='annual sum of column-level NPP', & - ptr_col=cps%cannsum_npp, default='inactive') - - call hist_addfld1d (fname='CANNAVG_T2M', units='K', & - avgflag='A', long_name='annual average of 2m air temperature', & - ptr_col=cps%cannavg_t2m, default='inactive') - - call hist_addfld2d (fname='FRAC_ICEOLD', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='fraction of ice relative to the tot water', & - ptr_col=cps%frac_iceold, default='inactive') - - call hist_addfld2d (fname='EFF_POROSITY', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective porosity = porosity - vol_ice', & - ptr_col=cps%eff_porosity, default='inactive') - - call hist_addfld2d (fname='ROOTR_COLUMN', units='proportion', type2d='levgrnd', & - avgflag='A', long_name='effective fraction of roots in each soil layer', & - ptr_col=cps%rootr_column, default='inactive') - - call hist_addfld2d (fname='ALBGRD', units='proportion', type2d='numrad', & - avgflag='A', long_name='ground albedo (direct)', & - ptr_col=cps%albgrd, default='inactive') - - call hist_addfld2d (fname='ALBGRI', units='proportion', type2d='numrad', & - avgflag='A', long_name='ground albedo (indirect)', & - ptr_col=cps%albgri, default='inactive') - - call hist_addfld1d (fname='ME', units='proportion', & - avgflag='A', long_name='moisture of extinction', & - ptr_col=cps%me, default='inactive') - - call hist_addfld1d (fname='FIRE_PROB', units='0-1', & - avgflag='A', long_name='daily fire probability', & - ptr_col=cps%fire_prob, default='inactive') - - call hist_addfld1d (fname='MEAN_FIRE_PROB', units='0-1', & - avgflag='A', long_name='e-folding mean of daily fire probability', & - ptr_col=cps%mean_fire_prob) - - call hist_addfld1d (fname='FIRESEASONL', units='days', & - avgflag='A', long_name='annual fire season length', & - ptr_col=cps%fireseasonl) - - call hist_addfld1d (fname='FAREA_BURNED', units='proportion', & - avgflag='A', long_name='timestep fractional area burned', & - ptr_col=cps%farea_burned, default='inactive') - - call hist_addfld1d (fname='ANN_FAREA_BURNED', units='proportion', & - avgflag='A', long_name='annual total fractional area burned', & - ptr_col=cps%ann_farea_burned) - - !------------------------------- - ! Energy flux variables not already defined by default - native PFT - !------------------------------- - - call hist_addfld1d (fname='PARSUN', units='W/m^2', & - avgflag='A', long_name='average absorbed PAR for sunlit leaves', & - ptr_pft=pef%parsun, default='inactive') - - call hist_addfld1d (fname='PARSHA', units='W/m^2', & - avgflag='A', long_name='average absorbed PAR for shaded leaves', & - ptr_pft=pef%parsha, default='inactive') - - call hist_addfld1d (fname='DLRAD', units='W/m^2', & - avgflag='A', long_name='downward longwave radiation below the canopy', & - ptr_pft=pef%dlrad, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='ULRAD', units='W/m^2', & - avgflag='A', long_name='upward longwave radiation above the canopy', & - ptr_pft=pef%ulrad, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='EFLX_LH_TOT', units='W/m^2', & - avgflag='A', long_name='total latent heat flux [+ to atm]', & - ptr_pft=pef%eflx_lh_tot, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='EFLX_SOIL_GRND', units='W/m^2', & - avgflag='A', long_name='soil heat flux [+ into soil]', & - ptr_pft=pef%eflx_soil_grnd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='CGRND', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil energy flux wrt to soil temp', & - ptr_pft=pef%cgrnd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='CGRNDL', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil latent heat flux wrt soil temp', & - ptr_pft=pef%cgrndl, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='CGRNDS', units='W/m^2/K', & - avgflag='A', long_name='deriv. of soil sensible heat flux wrt soil temp', & - ptr_pft=pef%cgrnds, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='EFLX_GNET', units='W/m^2', & - avgflag='A', long_name='net heat flux into ground', & - ptr_pft=pef%eflx_gnet, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='DGNETDT', units='W/m^2/K', & - avgflag='A', long_name='derivative of net ground heat flux wrt soil temp', & - ptr_pft=pef%dgnetdT, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld2d (fname='SUN_ADD', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='sun canopy absorbed direct from direct', & - ptr_pft=pef%sun_add, default='inactive') - - call hist_addfld2d (fname='TOT_AID', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='total canopy absorbed indirect from direct', & - ptr_pft=pef%tot_aid, default='inactive') - - call hist_addfld2d (fname='SUN_AID', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='sun canopy absorbed indirect from direct', & - ptr_pft=pef%sun_aid, default='inactive') - - call hist_addfld2d (fname='SUN_AII', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='sun canopy absorbed indirect from indirect', & - ptr_pft=pef%sun_aii, default='inactive') - - call hist_addfld2d (fname='SHA_AID', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='shade canopy absorbed indirect from direct', & - ptr_pft=pef%sha_aid, default='inactive') - - call hist_addfld2d (fname='SHA_AII', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='shade canopy absorbed indirect from indirect', & - ptr_pft=pef%sha_aii, default='inactive') - - call hist_addfld2d (fname='SUN_ATOT', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='sun canopy total absorbed', & - ptr_pft=pef%sun_atot, default='inactive') - - call hist_addfld2d (fname='SHA_ATOT', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='shade canopy total absorbed', & - ptr_pft=pef%sha_atot, default='inactive') - - call hist_addfld2d (fname='SUN_ALF', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='sun canopy total absorbed by leaves', & - ptr_pft=pef%sun_alf, default='inactive') - - call hist_addfld2d (fname='SHA_ALF', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='shade canopy total absored by leaves', & - ptr_pft=pef%sha_alf, default='inactive') - - call hist_addfld2d (fname='SUN_APERLAI', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='sun canopy total absorbed per unit LAI', & - ptr_pft=pef%sun_aperlai, default='inactive') - - call hist_addfld2d (fname='SHA_APERLAI', units='W/m^2', type2d='numrad', & - avgflag='A', long_name='shade canopy total absorbed per unit LAI', & - ptr_pft=pef%sha_aperlai, default='inactive') - - !------------------------------- - ! Water flux variables not already defined by default - native PFT - !------------------------------- - - call hist_addfld1d (fname='QFLX_RAIN_GRND', units='mm H2O/s', & - avgflag='A', long_name='rain on ground after interception', & - ptr_pft=pwf%qflx_rain_grnd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_SNOW_GRND', units='mm H2O/s', & - avgflag='A', long_name='snow on ground after interception', & - ptr_pft=pwf%qflx_snow_grnd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_EVAP_GRND', units='mm H2O/s', & - avgflag='A', long_name='ground surface evaporation', & - ptr_pft=pwf%qflx_evap_grnd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_EVAP_VEG', units='mm H2O/s', & - avgflag='A', long_name='vegetation evaporation', & - ptr_pft=pwf%qflx_evap_veg, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_EVAP_TOT', units='mm H2O/s', & - avgflag='A', long_name='qflx_evap_soi + qflx_evap_can + qflx_tran_veg', & - ptr_pft=pwf%qflx_evap_tot, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_DEW_GRND', units='mm H2O/s', & - avgflag='A', long_name='ground surface dew formation', & - ptr_pft=pwf%qflx_dew_grnd, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_SUB_SNOW', units='mm H2O/s', & - avgflag='A', long_name='sublimation rate from snow pack', & - ptr_pft=pwf%qflx_sub_snow, default='inactive', c2l_scale_type='urbanf') - - call hist_addfld1d (fname='QFLX_DEW_SNOW', units='mm H2O/s', & - avgflag='A', long_name='surface dew added to snow pacK', & - ptr_pft=pwf%qflx_dew_snow, default='inactive', c2l_scale_type='urbanf') - - end if - - call hist_addfld1d (fname='SNORDSL', units='m^-6', & - avgflag='A', long_name='top snow layer effective grain radius', & - ptr_col=cps%snw_rds_top, set_lake=spval, set_urb=spval, & - default='inactive') - - call hist_addfld1d (fname='SNOTTOPL', units='K/m', & - avgflag='A', long_name='snow temperature (top layer)', & - ptr_col=cps%snot_top, set_lake=spval, set_urb=spval, & - default='inactive') - - call hist_addfld1d (fname='SNOdTdzL', units='K/m', & - avgflag='A', long_name='top snow layer temperature gradient (land)', & - ptr_col=cps%dTdz_top, set_lake=spval, set_urb=spval, & - default='inactive') - - call hist_addfld1d (fname='SNOLIQFL', units='fraction', & - avgflag='A', long_name='top snow layer liquid water fraction (land)', & - ptr_col=cps%sno_liq_top, set_lake=spval, set_urb=spval, & - default='inactive') - - call hist_addfld1d (fname='SNOFSRVD', units='W/m^2', & - avgflag='A', long_name='direct vis reflected solar radiation from snow', & - ptr_pft=pef%fsr_sno_vd, & - default='inactive') - - call hist_addfld1d (fname='SNOFSRND', units='W/m^2', & - avgflag='A', long_name='direct nir reflected solar radiation from snow', & - ptr_pft=pef%fsr_sno_nd, & - default='inactive') - - call hist_addfld1d (fname='SNOFSRVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis reflected solar radiation from snow', & - ptr_pft=pef%fsr_sno_vi, & - default='inactive') - - call hist_addfld1d (fname='SNOFSRNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir reflected solar radiation from snow', & - ptr_pft=pef%fsr_sno_ni, & - default='inactive') - - call hist_addfld1d (fname='SNOFSDSVD', units='W/m^2', & - avgflag='A', long_name='direct vis incident solar radiation on snow', & - ptr_pft=pef%fsds_sno_vd, & - default='inactive') - - call hist_addfld1d (fname='SNOFSDSND', units='W/m^2', & - avgflag='A', long_name='direct nir incident solar radiation on snow', & - ptr_pft=pef%fsds_sno_nd, & - default='inactive') - - call hist_addfld1d (fname='SNOFSDSVI', units='W/m^2', & - avgflag='A', long_name='diffuse vis incident solar radiation on snow', & - ptr_pft=pef%fsds_sno_vi, & - default='inactive') - - call hist_addfld1d (fname='SNOFSDSNI', units='W/m^2', & - avgflag='A', long_name='diffuse nir incident solar radiation on snow', & - ptr_pft=pef%fsds_sno_ni, & - default='inactive') - - call hist_addfld1d (fname='H2OSNO_TOP', units='kg/m2', & - avgflag='A', long_name='mass of snow in top snow layer', & - ptr_col=cps%h2osno_top, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOBCMCL', units='kg/m2', & - avgflag='A', long_name='mass of BC in snow column', & - ptr_col=cps%mss_bc_col, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOBCMSL', units='kg/m2', & - avgflag='A', long_name='mass of BC in top snow layer', & - ptr_col=cps%mss_bc_top, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOOCMCL', units='kg/m2', & - avgflag='A', long_name='mass of OC in snow column', & - ptr_col=cps%mss_oc_col, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOOCMSL', units='kg/m2', & - avgflag='A', long_name='mass of OC in top snow layer', & - ptr_col=cps%mss_oc_top, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNODSTMCL', units='kg/m2', & - avgflag='A', long_name='mass of dust in snow column', & - ptr_col=cps%mss_dst_col, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNODSTMSL', units='kg/m2', & - avgflag='A', long_name='mass of dust in top snow layer', & - ptr_col=cps%mss_dst_top, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='DSTDEP', units='kg/m^2/s', & - avgflag='A', long_name='total dust deposition (dry+wet) from atmosphere', & - ptr_col=cwf%flx_dst_dep, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='BCDEP', units='kg/m^2/s', & - avgflag='A', long_name='total BC deposition (dry+wet) from atmosphere', & - ptr_col=cwf%flx_bc_dep, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='OCDEP', units='kg/m^2/s', & - avgflag='A', long_name='total OC deposition (dry+wet) from atmosphere', & - ptr_col=cwf%flx_oc_dep, set_lake=spval, set_urb=spval) - - if (use_snicar_frc) then - call hist_addfld1d (fname='SNOAERFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of all aerosols in snow (land) ', & - ptr_pft=pef%sfc_frc_aer, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOAERFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of all aerosols in snow, averaged only when snow is present (land)', & - ptr_pft=pef%sfc_frc_aer_sno, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOBCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of BC in snow (land) ', & - ptr_pft=pef%sfc_frc_bc, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOBCFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of BC in snow, averaged only when snow is present (land)', & - ptr_pft=pef%sfc_frc_bc_sno, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOOCFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow (land) ', & - ptr_pft=pef%sfc_frc_oc, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNOOCFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of OC in snow, averaged only when snow is present (land)', & - ptr_pft=pef%sfc_frc_oc_sno, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNODSTFRCL', units='W/m^2', & - avgflag='A', long_name='surface forcing of dust in snow (land) ', & - ptr_pft=pef%sfc_frc_dst, set_lake=spval, set_urb=spval) - - call hist_addfld1d (fname='SNODSTFRC2L', units='W/m^2', & - avgflag='A', long_name='surface forcing of dust in snow, averaged only when snow is present (land)', & - ptr_pft=pef%sfc_frc_dst_sno, set_lake=spval, set_urb=spval) - end if - - !------------------------------- - ! Forcings sent to GLC - !------------------------------- - - if (maxpatch_glcmec > 0) then - - call hist_addfld2d (fname='QICE_FORC', units='mm/s', type2d='glc_nec', & - avgflag='A', long_name='qice forcing sent to GLC', & - ptr_lnd=clm_s2x%qice, default='inactive') - - call hist_addfld2d (fname='TSRF_FORC', units='K', type2d='glc_nec', & - avgflag='A', long_name='surface temperature sent to GLC', & - ptr_lnd=clm_s2x%tsrf, default='inactive') - - call hist_addfld2d (fname='TOPO_FORC', units='m', type2d='glc_nec', & - avgflag='A', long_name='topographic height sent to GLC', & - ptr_lnd=clm_s2x%topo, default='inactive') - - end if - - ! Print masterlist of history fields - - call hist_printflds() - - end subroutine hist_initFlds - -end module histFldsMod diff --git a/src_clm40/main/iniTimeConst.F90 b/src_clm40/main/iniTimeConst.F90 deleted file mode 100644 index 73f2f170d5..0000000000 --- a/src_clm40/main/iniTimeConst.F90 +++ /dev/null @@ -1,828 +0,0 @@ -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: iniTimeConst -! -! !INTERFACE: -subroutine iniTimeConst -! -! !DESCRIPTION: -! Initialize time invariant clm variables -! 1) removed references to shallow lake - since it is not used -! 2) ***Make z, zi and dz allocatable depending on if you -! have lake or soil -! 3) rootfr only initialized for soil points -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use decompMod , only : get_proc_bounds, get_proc_global - use decompMod , only : gsMap_lnd_gdc2glo - use clm_atmlnd , only : clm_a2l - use clm_varpar , only : nlevsoi, nlevgrnd, nlevlak, numpft, numrad, nlevurb - use clm_varcon , only : istice, istdlak, istwet, isturb, istice_mec, & - icol_roof, icol_sunwall, icol_shadewall, icol_road_perv, icol_road_imperv, & - zlak, dzlak, zsoi, dzsoi, zisoi, spval, & - albsat, albdry, secspday - use clm_varctl , only : fsurdat,scmlon,scmlat,single_column, iulog, use_cn, use_cndv - use pftvarcon , only : noveg, ntree, roota_par, rootb_par, & - smpso, smpsc, fnitr, nbrdlf_dcd_brl_shrub, & - z0mr, displar, dleaf, rhol, rhos, taul, taus, xl, & - qe25, mp, c3psn, slatop, dsladlai, leafcn, flnr, woody, & - lflitcn, frootcn, livewdcn, deadwdcn, froot_leaf, stem_leaf, croot_stem, & - flivewd, fcur, lf_flab, lf_fcel, lf_flig, fr_flab, fr_fcel, fr_flig, & - leaf_long, evergreen, stress_decid, season_decid, & - resist, pftpar20, pftpar28, pftpar29, pftpar30, pftpar31, & - allom1s, allom2s, & - allom1 , allom2 , allom3 , reinickerp, dwood - use pftvarcon , only : graincn - use clm_time_manager, only : get_step_size - use abortutils , only : endrun - use fileutils , only : getfil - use organicFileMod , only : organicrd - use spmdMod , only : mpicom, MPI_INTEGER, masterproc - use clm_varctl , only : fsnowoptics, fsnowaging - use SNICARMod , only : SnowAge_init, SnowOptics_init - use shr_scam_mod , only : shr_scam_getCloseLatLon - use ncdio_pio , only : file_desc_t, ncd_io, ncd_pio_openfile, ncd_pio_closefile - -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine initialize in module initializeMod. -! -! !REVISION HISTORY: -! Created by Gordon Bonan. -! Updated to clm2.1 data structrues by Mariana Vertenstein -! 4/26/05, Peter Thornton: Eliminated exponential decrease in saturated hydraulic -! conductivity (hksat) with depth. -! Updated: Colette L. Heald (05/06) reading in VOC emission factors -! 27 February 2008: Keith Oleson; Qing Liu (2004) saturated hydraulic conductivity -! and matric potential -! 29 February 2008: David Lawrence; modified soil thermal and hydraulic properties to -! account for organic matter -! 18 March 2008: David Lawrence; nlevgrnd changes -! 03/28/08 Mark Flanner, read in netcdf files for SNICAR parameters -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: ivt(:) ! vegetation type index - integer , pointer :: pcolumn(:) ! column index of corresponding pft - integer , pointer :: pgridcell(:) ! gridcell index of corresponding pft - integer , pointer :: clandunit(:) ! landunit index of column - integer , pointer :: cgridcell(:) ! gridcell index of column - integer , pointer :: ctype(:) ! column type index - integer , pointer :: ltype(:) ! landunit type index - real(r8), pointer :: thick_wall(:) ! total thickness of urban wall - real(r8), pointer :: thick_roof(:) ! total thickness of urban roof - real(r8), pointer :: lat(:) ! gridcell latitude (radians) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: z(:,:) ! layer depth (m) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) - real(r8), pointer :: dz(:,:) ! layer thickness depth (m) - real(r8), pointer :: rootfr(:,:) ! fraction of roots in each soil layer - real(r8), pointer :: rootfr_road_perv(:,:) ! fraction of roots in each soil layer for urban pervious road - real(r8), pointer :: rresis(:,:) !root resistance by layer (0-1) (nlevgrnd) - real(r8), pointer :: dewmx(:) ! maximum allowed dew [mm] - real(r8), pointer :: bsw(:,:) ! Clapp and Hornberger "b" (nlevgrnd) - real(r8), pointer :: bsw2(:,:) ! Clapp and Hornberger "b" for CN code - real(r8), pointer :: psisat(:,:) ! soil water potential at saturation for CN code (MPa) - real(r8), pointer :: vwcsat(:,:) ! volumetric water content at saturation for CN code (m3/m3) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) (nlevgrnd) - real(r8), pointer :: watfc(:,:) ! volumetric soil water at field capacity (nlevsoi) - real(r8), pointer :: watdry(:,:) ! btran parameter for btran=0 - real(r8), pointer :: watopt(:,:) ! btran parameter for btran = 1 - real(r8), pointer :: hksat(:,:) ! hydraulic conductivity at saturation (mm H2O /s) (nlevgrnd) - real(r8), pointer :: sucsat(:,:) ! minimum soil suction (mm) (nlevgrnd) - real(r8), pointer :: csol(:,:) ! heat capacity, soil solids (J/m**3/Kelvin) (nlevgrnd) - real(r8), pointer :: tkmg(:,:) ! thermal conductivity, soil minerals [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: tkdry(:,:) ! thermal conductivity, dry soil (W/m/Kelvin) (nlevgrnd) - real(r8), pointer :: tksatu(:,:) ! thermal conductivity, saturated soil [W/m-K] (new) (nlevgrnd) - real(r8), pointer :: wtfact(:) ! maximum saturated fraction for a gridcell - real(r8), pointer :: smpmin(:) ! restriction for min of soil potential (mm) (new) - real(r8), pointer :: hkdepth(:) ! decay factor (m) - integer , pointer :: isoicol(:) ! soil color class - real(r8), pointer :: gwc_thr(:) ! threshold soil moisture based on clay content - real(r8), pointer :: mss_frc_cly_vld(:) ! [frc] Mass fraction clay limited to 0.20 - real(r8), pointer :: efisop(:,:) ! emission factors for isoprene (ug isoprene m-2 h-1) - real(r8), pointer :: max_dayl(:) ! maximum daylength (s) - real(r8), pointer :: sandfrac(:) - real(r8), pointer :: clayfrac(:) -! -! -! !OTHER LOCAL VARIABLES: -!EOP - type(file_desc_t) :: ncid ! netcdf id - integer :: n,j,ib,lev,bottom! indices - integer :: g,l,c,p ! indices - integer :: m ! vegetation type index - real(r8) :: bd ! bulk density of dry soil material [kg/m^3] - real(r8) :: tkm ! mineral conductivity - real(r8) :: xksat ! maximum hydraulic conductivity of soil [mm/s] - real(r8) :: scalez = 0.025_r8 ! Soil layer thickness discretization (m) - real(r8) :: clay,sand ! temporaries - real(r8) :: slope,intercept ! temporary, for rooting distribution - real(r8) :: temp, max_decl ! temporary, for calculation of max_dayl - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - - real(r8),pointer :: temp_ef(:) ! read in - temporary EFs - real(r8),pointer :: efisop2d(:,:) ! read in - isoprene emission factors - - real(r8),pointer :: arrayl(:) ! generic global array - integer ,pointer :: irrayg(:) ! generic global array - integer ,pointer :: soic2d(:) ! read in - soil color - real(r8),pointer :: sand3d(:,:) ! read in - soil texture: percent sand - real(r8),pointer :: clay3d(:,:) ! read in - soil texture: percent clay - real(r8),pointer :: organic3d(:,:) ! read in - organic matter: kg/m3 - real(r8),pointer :: gti(:) ! read in - fmax - real(r8) :: om_frac ! organic matter fraction - real(r8) :: om_watsat = 0.9_r8 ! porosity of organic soil - real(r8) :: om_hksat = 0.1_r8 ! saturated hydraulic conductivity of organic soil [mm/s] - real(r8) :: om_tkm = 0.25_r8 ! thermal conductivity of organic soil (Farouki, 1986) [W/m/K] - real(r8) :: om_sucsat = 10.3_r8 ! saturated suction for organic matter (Letts, 2000) - real(r8) :: om_csol = 2.5_r8 ! heat capacity of peat soil *10^6 (J/K m3) (Farouki, 1986) - real(r8) :: om_tkd = 0.05_r8 ! thermal conductivity of dry organic soil (Farouki, 1981) - real(r8) :: om_b = 2.7_r8 ! Clapp Hornberger paramater for oragnic soil (Letts, 2000) - real(r8) :: organic_max = 130._r8 ! organic matter (kg/m3) where soil is assumed to act like peat - real(r8) :: csol_bedrock = 2.0e6_r8 ! vol. heat capacity of granite/sandstone J/(m3 K)(Shabbir, 2000) - real(r8) :: pc = 0.5_r8 ! percolation threshold - real(r8) :: pcbeta = 0.139_r8 ! percolation exponent - real(r8) :: perc_frac ! "percolating" fraction of organic soil - real(r8) :: perc_norm ! normalize to 1 when 100% organic soil - real(r8) :: uncon_hksat ! series conductivity of mineral/organic soil - real(r8) :: uncon_frac ! fraction of "unconnected" soil - integer :: varid ! netCDF id's - integer :: ret - - integer :: ier ! error status - character(len=256) :: locfn ! local filename - character(len= 32) :: subname = 'iniTimeConst' ! subroutine name - integer :: mxsoil_color ! maximum number of soil color classes - real(r8), allocatable :: zurb_wall(:,:) ! wall (layer node depth) - real(r8), allocatable :: zurb_roof(:,:) ! roof (layer node depth) - real(r8), allocatable :: dzurb_wall(:,:) ! wall (layer thickness) - real(r8), allocatable :: dzurb_roof(:,:) ! roof (layer thickness) - real(r8), allocatable :: ziurb_wall(:,:) ! wall (layer interface) - real(r8), allocatable :: ziurb_roof(:,:) ! roof (layer interface) - logical :: readvar -!------------------------------------------------------------------------ - - integer :: closelatidx,closelonidx - real(r8):: closelat,closelon - integer :: iostat - -!------------------------------------------------------------------------ - - if (masterproc) write(iulog,*) 'Attempting to initialize time invariant variables' - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - call get_proc_global(numg, numl, numc, nump) - - allocate(soic2d(begg:endg), gti(begg:endg)) - allocate(sand3d(begg:endg,nlevsoi), clay3d(begg:endg,nlevsoi)) - allocate(organic3d(begg:endg,nlevsoi)) - - allocate(temp_ef(begg:endg),efisop2d(6,begg:endg)) - - efisop => gve%efisop - - ! Assign local pointers to derived subtypes components (gridcell-level) - lat => grc%lat - - ! Assign local pointers to derived subtypes components (landunit-level) - - ltype => lun%itype - thick_wall => lps%thick_wall - thick_roof => lps%thick_roof - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype - clandunit => col%landunit - cgridcell => col%gridcell - z => cps%z - dz => cps%dz - zi => cps%zi - bsw => cps%bsw - bsw2 => cps%bsw2 - psisat => cps%psisat - vwcsat => cps%vwcsat - watsat => cps%watsat - watfc => cps%watfc - watdry => cps%watdry - watopt => cps%watopt - rootfr_road_perv => cps%rootfr_road_perv - hksat => cps%hksat - sucsat => cps%sucsat - tkmg => cps%tkmg - tksatu => cps%tksatu - tkdry => cps%tkdry - csol => cps%csol - smpmin => cps%smpmin - hkdepth => cps%hkdepth - wtfact => cps%wtfact - isoicol => cps%isoicol - gwc_thr => cps%gwc_thr - mss_frc_cly_vld => cps%mss_frc_cly_vld - max_dayl => cps%max_dayl - - ! Assign local pointers to derived subtypes components (pft-level) - - ivt => pft%itype - pgridcell => pft%gridcell - pcolumn => pft%column - dewmx => pps%dewmx - rootfr => pps%rootfr - rresis => pps%rresis - sandfrac => pps%sandfrac - clayfrac => pps%clayfrac - - allocate(zurb_wall(begl:endl,nlevurb), & - zurb_roof(begl:endl,nlevurb), & - dzurb_wall(begl:endl,nlevurb), & - dzurb_roof(begl:endl,nlevurb), & - ziurb_wall(begl:endl,0:nlevurb), & - ziurb_roof(begl:endl,0:nlevurb), & - stat=ier) - if (ier /= 0) then - call endrun( 'iniTimeConst: allocation error for zurb_wall,zurb_roof,dzurb_wall,dzurb_roof,ziurb_wall,ziurb_roof' ) - end if - - ! -------------------------------------------------------------------- - ! Read soil color, sand and clay from surface dataset - ! -------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to read soil color, sand and clay boundary data .....' - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! Determine number of soil color classes - if number of soil color classes is not - ! on input dataset set it to 8 - - if (single_column) then - call shr_scam_getCloseLatLon(locfn,scmlat,scmlon,closelat,closelon,closelatidx,closelonidx) - end if - call ncd_io(ncid=ncid, varname='mxsoil_color', flag='read', data=mxsoil_color, & - readvar=readvar) - if ( .not. readvar ) mxsoil_color = 8 - - ! Read fmax - - call ncd_io(ncid=ncid, varname='FMAX', flag='read', data=gti, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: FMAX NOT on surfdata file') - - ! Read in soil color, sand and clay fraction - - call ncd_io(ncid=ncid, varname='SOIL_COLOR', flag='read', data=soic2d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: SOIL_COLOR NOT on surfdata file' ) - - ! Read in emission factors - - call ncd_io(ncid=ncid, varname='EF1_BTR', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('iniTimeConst: errror reading EF1_BTR') - efisop2d(1,:)=temp_ef(:) - - call ncd_io(ncid=ncid, varname='EF1_FET', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('iniTimeConst: errror reading EF1_FET') - efisop2d(2,:)=temp_ef(:) - - call ncd_io(ncid=ncid, varname='EF1_FDT', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('iniTimeConst: errror reading EF1_FDT') - efisop2d(3,:)=temp_ef(:) - - call ncd_io(ncid=ncid, varname='EF1_SHR', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('iniTimeConst: errror reading EF1_SHR') - efisop2d(4,:)=temp_ef(:) - - call ncd_io(ncid=ncid, varname='EF1_GRS', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('iniTimeConst: errror reading EF1_GRS') - efisop2d(5,:)=temp_ef(:) - - call ncd_io(ncid=ncid, varname='EF1_CRP', flag='read', data=temp_ef, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('iniTimeConst: errror reading EF1_CRP') - efisop2d(6,:)=temp_ef(:) - - call ncd_io(ncid=ncid, varname='PCT_SAND', flag='read', data=sand3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_SAND NOT on surfdata file' ) - - call ncd_io(ncid=ncid, varname='PCT_CLAY', flag='read', data=clay3d, dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_CLAY NOT on surfdata file' ) - - call ncd_pio_closefile(ncid) - - if (masterproc) then - write(iulog,*) 'Successfully read fmax, soil color, sand and clay boundary data' - write(iulog,*) - endif - - ! Determine saturated and dry soil albedos for n color classes and - ! numrad wavebands (1=vis, 2=nir) - - allocate(albsat(mxsoil_color,numrad), albdry(mxsoil_color,numrad), stat=ier) - if (ier /= 0) then - write(iulog,*)'iniTimeConst: allocation error for albsat, albdry' - call endrun() - end if - - if (mxsoil_color == 8) then - albsat(1:8,1) = (/0.12_r8,0.11_r8,0.10_r8,0.09_r8,0.08_r8,0.07_r8,0.06_r8,0.05_r8/) - albsat(1:8,2) = (/0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8/) - albdry(1:8,1) = (/0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8/) - albdry(1:8,2) = (/0.48_r8,0.44_r8,0.40_r8,0.36_r8,0.32_r8,0.28_r8,0.24_r8,0.20_r8/) - else if (mxsoil_color == 20) then - albsat(1:20,1) = (/0.25_r8,0.23_r8,0.21_r8,0.20_r8,0.19_r8,0.18_r8,0.17_r8,0.16_r8,& - 0.15_r8,0.14_r8,0.13_r8,0.12_r8,0.11_r8,0.10_r8,0.09_r8,0.08_r8,0.07_r8,0.06_r8,0.05_r8,0.04_r8/) - albsat(1:20,2) = (/0.50_r8,0.46_r8,0.42_r8,0.40_r8,0.38_r8,0.36_r8,0.34_r8,0.32_r8,& - 0.30_r8,0.28_r8,0.26_r8,0.24_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8,0.08_r8/) - albdry(1:20,1) = (/0.36_r8,0.34_r8,0.32_r8,0.31_r8,0.30_r8,0.29_r8,0.28_r8,0.27_r8,& - 0.26_r8,0.25_r8,0.24_r8,0.23_r8,0.22_r8,0.20_r8,0.18_r8,0.16_r8,0.14_r8,0.12_r8,0.10_r8,0.08_r8/) - albdry(1:20,2) = (/0.61_r8,0.57_r8,0.53_r8,0.51_r8,0.49_r8,0.48_r8,0.45_r8,0.43_r8,& - 0.41_r8,0.39_r8,0.37_r8,0.35_r8,0.33_r8,0.31_r8,0.29_r8,0.27_r8,0.25_r8,0.23_r8,0.21_r8,0.16_r8/) - else - write(iulog,*)'maximum color class = ',mxsoil_color,' is not supported' - call endrun - end if - - do p = begp,endp - g = pgridcell(p) - sandfrac(p) = sand3d(g,1)/100.0_r8 - clayfrac(p) = clay3d(g,1)/100.0_r8 - end do - - ! -------------------------------------------------------------------- - ! If a organic matter dataset has been specified, read it - ! -------------------------------------------------------------------- - - call organicrd(organic3d) - - ! -------------------------------------------------------------------- - ! Initialize time constant arrays of ecophysiological constants and - ! arrays of dgvm ecophysiological constants - ! -------------------------------------------------------------------- - - do m = 0,numpft - if (m <= ntree) then - pftcon%tree(m) = 1 - else - pftcon%tree(m) = 0 - end if - pftcon%z0mr(m) = z0mr(m) - pftcon%displar(m) = displar(m) - pftcon%dleaf(m) = dleaf(m) - pftcon%xl(m) = xl(m) - do ib = 1,numrad - pftcon%rhol(m,ib) = rhol(m,ib) - pftcon%rhos(m,ib) = rhos(m,ib) - pftcon%taul(m,ib) = taul(m,ib) - pftcon%taus(m,ib) = taus(m,ib) - end do - pftcon%qe25(m) = qe25(m) - pftcon%mp(m) = mp(m) - pftcon%c3psn(m) = c3psn(m) - pftcon%slatop(m) = slatop(m) - pftcon%dsladlai(m) = dsladlai(m) - pftcon%leafcn(m) = leafcn(m) - pftcon%flnr(m) = flnr(m) - pftcon%smpso(m) = smpso(m) - pftcon%smpsc(m) = smpsc(m) - pftcon%fnitr(m) = fnitr(m) - pftcon%woody(m) = woody(m) - pftcon%lflitcn(m) = lflitcn(m) - pftcon%frootcn(m) = frootcn(m) - pftcon%livewdcn(m) = livewdcn(m) - pftcon%deadwdcn(m) = deadwdcn(m) - pftcon%graincn(m) = graincn(m) - pftcon%froot_leaf(m) = froot_leaf(m) - pftcon%stem_leaf(m) = stem_leaf(m) - pftcon%croot_stem(m) = croot_stem(m) - pftcon%flivewd(m) = flivewd(m) - pftcon%fcur(m) = fcur(m) - pftcon%lf_flab(m) = lf_flab(m) - pftcon%lf_fcel(m) = lf_fcel(m) - pftcon%lf_flig(m) = lf_flig(m) - pftcon%fr_flab(m) = fr_flab(m) - pftcon%fr_fcel(m) = fr_fcel(m) - pftcon%fr_flig(m) = fr_flig(m) - pftcon%leaf_long(m) = leaf_long(m) - pftcon%evergreen(m) = evergreen(m) - pftcon%stress_decid(m) = stress_decid(m) - pftcon%season_decid(m) = season_decid(m) - pftcon%resist(m) = resist(m) - pftcon%dwood(m) = dwood - end do - - if (use_cndv) then - do m = 0,numpft - dgv_pftcon%crownarea_max(m) = pftpar20(m) - dgv_pftcon%tcmin(m) = pftpar28(m) - dgv_pftcon%tcmax(m) = pftpar29(m) - dgv_pftcon%gddmin(m) = pftpar30(m) - dgv_pftcon%twmax(m) = pftpar31(m) - dgv_pftcon%reinickerp(m) = reinickerp - dgv_pftcon%allom1(m) = allom1 - dgv_pftcon%allom2(m) = allom2 - dgv_pftcon%allom3(m) = allom3 - ! modification for shrubs by X.D.Z - if (m > ntree .and. m <= nbrdlf_dcd_brl_shrub ) then - dgv_pftcon%allom1(m) = allom1s - dgv_pftcon%allom2(m) = allom2s - end if - end do - end if - - ! -------------------------------------------------------------------- - ! Define layer structure for soil, lakes, urban walls and roof - ! Vertical profile of snow is not initialized here - ! -------------------------------------------------------------------- - - ! Lake layers (assumed same for all lake patches) - - dzlak(1) = 0.1_r8 - dzlak(2) = 1._r8 - dzlak(3) = 2._r8 - dzlak(4) = 3._r8 - dzlak(5) = 4._r8 - dzlak(6) = 5._r8 - dzlak(7) = 7._r8 - dzlak(8) = 7._r8 - dzlak(9) = 10.45_r8 - dzlak(10)= 10.45_r8 - - zlak(1) = 0.05_r8 - zlak(2) = 0.6_r8 - zlak(3) = 2.1_r8 - zlak(4) = 4.6_r8 - zlak(5) = 8.1_r8 - zlak(6) = 12.6_r8 - zlak(7) = 18.6_r8 - zlak(8) = 25.6_r8 - zlak(9) = 34.325_r8 - zlak(10)= 44.775_r8 - - ! Soil layers and interfaces (assumed same for all non-lake patches) - ! "0" refers to soil surface and "nlevsoi" refers to the bottom of model soil - - do j = 1, nlevgrnd - zsoi(j) = scalez*(exp(0.5_r8*(j-0.5_r8))-1._r8) !node depths - enddo - - dzsoi(1) = 0.5_r8*(zsoi(1)+zsoi(2)) !thickness b/n two interfaces - do j = 2,nlevgrnd-1 - dzsoi(j)= 0.5_r8*(zsoi(j+1)-zsoi(j-1)) - enddo - dzsoi(nlevgrnd) = zsoi(nlevgrnd)-zsoi(nlevgrnd-1) - - zisoi(0) = 0._r8 - do j = 1, nlevgrnd-1 - zisoi(j) = 0.5_r8*(zsoi(j)+zsoi(j+1)) !interface depths - enddo - zisoi(nlevgrnd) = zsoi(nlevgrnd) + 0.5_r8*dzsoi(nlevgrnd) - - ! Column level initialization for urban wall and roof layers and interfaces - do l = begl, endl - - ! "0" refers to urban wall/roof surface and "nlevsoi" refers to urban wall/roof bottom - if (ltype(l)==isturb) then - - do j = 1, nlevurb - zurb_wall(l,j) = (j-0.5)*(thick_wall(l)/float(nlevurb)) !node depths - end do - do j = 1, nlevurb - zurb_roof(l,j) = (j-0.5)*(thick_roof(l)/float(nlevurb)) !node depths - end do - - dzurb_wall(l,1) = 0.5*(zurb_wall(l,1)+zurb_wall(l,2)) !thickness b/n two interfaces - do j = 2,nlevurb-1 - dzurb_wall(l,j)= 0.5*(zurb_wall(l,j+1)-zurb_wall(l,j-1)) - enddo - dzurb_wall(l,nlevurb) = zurb_wall(l,nlevurb)-zurb_wall(l,nlevurb-1) - - dzurb_roof(l,1) = 0.5*(zurb_roof(l,1)+zurb_roof(l,2)) !thickness b/n two interfaces - do j = 2,nlevurb-1 - dzurb_roof(l,j)= 0.5*(zurb_roof(l,j+1)-zurb_roof(l,j-1)) - enddo - dzurb_roof(l,nlevurb) = zurb_roof(l,nlevurb)-zurb_roof(l,nlevurb-1) - - ziurb_wall(l,0) = 0. - do j = 1, nlevurb-1 - ziurb_wall(l,j) = 0.5*(zurb_wall(l,j)+zurb_wall(l,j+1)) !interface depths - enddo - ziurb_wall(l,nlevurb) = zurb_wall(l,nlevurb) + 0.5*dzurb_wall(l,nlevurb) - - ziurb_roof(l,0) = 0. - do j = 1, nlevurb-1 - ziurb_roof(l,j) = 0.5*(zurb_roof(l,j)+zurb_roof(l,j+1)) !interface depths - enddo - ziurb_roof(l,nlevurb) = zurb_roof(l,nlevurb) + 0.5*dzurb_roof(l,nlevurb) - end if - end do - - ! Grid level initialization - do g = begg, endg - - ! VOC emission factors - ! Set gridcell and landunit indices - efisop(:,g)=efisop2d(:,g) - - end do - - - ! -------------------------------------------------------------------- - ! Initialize soil and lake levels - ! Initialize soil color, thermal and hydraulic properties - ! -------------------------------------------------------------------- - - ! Column level initialization - do c = begc, endc - - ! Set gridcell and landunit indices - g = cgridcell(c) - l = clandunit(c) - - ! initialize maximum daylength, based on latitude and maximum declination - ! maximum declination hardwired for present-day orbital parameters, - ! +/- 23.4667 degrees = +/- 0.409571 radians, use negative value for S. Hem - max_decl = 0.409571 - if (lat(g) .lt. 0._r8) max_decl = -max_decl - temp = -(sin(lat(g))*sin(max_decl))/(cos(lat(g)) * cos(max_decl)) - temp = min(1._r8,max(-1._r8,temp)) - max_dayl(c) = 2.0_r8 * 13750.9871_r8 * acos(temp) - - ! Initialize restriction for min of soil potential (mm) - smpmin(c) = -1.e8_r8 - - ! Decay factor (m) - hkdepth(c) = 1._r8/2.5_r8 - - ! Maximum saturated fraction - wtfact(c) = gti(g) - - ! Soil color - isoicol(c) = soic2d(g) - - ! Soil hydraulic and thermal properties - ! Note that urban roof, sunwall and shadewall thermal properties used to - ! derive thermal conductivity and heat capacity are set to special - ! value because thermal conductivity and heat capacity for urban - ! roof, sunwall and shadewall are prescribed in SoilThermProp.F90 in - ! SoilTemperatureMod.F90 - if (ltype(l)==istdlak .or. ltype(l)==istwet .or. ltype(l)==istice .or. ltype(l)==istice_mec) then - do lev = 1,nlevgrnd - bsw(c,lev) = spval - bsw2(c,lev) = spval - psisat(c,lev) = spval - vwcsat(c,lev) = spval - watsat(c,lev) = spval - watfc(c,lev) = spval - hksat(c,lev) = spval - sucsat(c,lev) = spval - tkmg(c,lev) = spval - tksatu(c,lev) = spval - tkdry(c,lev) = spval - if (ltype(l)==istwet .and. lev > nlevsoi) then - csol(c,lev) = csol_bedrock - else - csol(c,lev)= spval - endif - watdry(c,lev) = spval - watopt(c,lev) = spval - end do - else if (ltype(l)==isturb .and. (ctype(c) /= icol_road_perv) .and. (ctype(c) /= icol_road_imperv) )then - ! Urban Roof, sunwall, shadewall properties set to special value - do lev = 1,nlevurb - watsat(c,lev) = spval - watfc(c,lev) = spval - bsw(c,lev) = spval - bsw2(c,lev) = spval - psisat(c,lev) = spval - vwcsat(c,lev) = spval - hksat(c,lev) = spval - sucsat(c,lev) = spval - tkmg(c,lev) = spval - tksatu(c,lev) = spval - tkdry(c,lev) = spval - csol(c,lev) = spval - watdry(c,lev) = spval - watopt(c,lev) = spval - end do - else ! soil columns of both urban and non-urban types - do lev = 1,nlevgrnd - ! duplicate clay and sand values from 10th soil layer - if (lev .le. nlevsoi) then - clay = clay3d(g,lev) - sand = sand3d(g,lev) - om_frac = (organic3d(g,lev)/organic_max)**2._r8 - else - clay = clay3d(g,nlevsoi) - sand = sand3d(g,nlevsoi) - om_frac = 0._r8 - endif - ! No organic matter for urban - if (ltype(l)==isturb) then - om_frac = 0._r8 - end if - ! Note that the following properties are overwritten for urban impervious road - ! layers that are not soil in SoilThermProp.F90 within SoilTemperatureMod.F90 - watsat(c,lev) = 0.489_r8 - 0.00126_r8*sand - bsw(c,lev) = 2.91 + 0.159*clay - sucsat(c,lev) = 10._r8 * ( 10._r8**(1.88_r8-0.0131_r8*sand) ) - bd = (1._r8-watsat(c,lev))*2.7e3_r8 - watsat(c,lev) = (1._r8 - om_frac)*watsat(c,lev) + om_watsat*om_frac - tkm = (1._r8-om_frac)*(8.80_r8*sand+2.92_r8*clay)/(sand+clay)+om_tkm*om_frac ! W/(m K) - bsw(c,lev) = (1._r8-om_frac)*(2.91_r8 + 0.159_r8*clay) + om_frac*om_b - bsw2(c,lev) = -(3.10_r8 + 0.157_r8*clay - 0.003_r8*sand) - psisat(c,lev) = -(exp((1.54_r8 - 0.0095_r8*sand + 0.0063_r8*(100.0_r8-sand-clay))*log(10.0_r8))*9.8e-5_r8) - vwcsat(c,lev) = (50.5_r8 - 0.142_r8*sand - 0.037_r8*clay)/100.0_r8 - sucsat(c,lev) = (1._r8-om_frac)*sucsat(c,lev) + om_sucsat*om_frac - xksat = 0.0070556 *( 10.**(-0.884+0.0153*sand) ) ! mm/s - - ! perc_frac is zero unless perf_frac greater than percolation threshold - if (om_frac > pc) then - perc_norm=(1._r8 - pc)**(-pcbeta) - perc_frac=perc_norm*(om_frac - pc)**pcbeta - else - perc_frac=0._r8 - endif - ! uncon_frac is fraction of mineral soil plus fraction of "nonpercolating" organic soil - uncon_frac=(1._r8-om_frac)+(1._r8-perc_frac)*om_frac - ! uncon_hksat is series addition of mineral/organic conductivites - if (om_frac .lt. 1._r8) then - uncon_hksat=uncon_frac/((1._r8-om_frac)/xksat & - +((1._r8-perc_frac)*om_frac)/om_hksat) - else - uncon_hksat = 0._r8 - end if - hksat(c,lev) = uncon_frac*uncon_hksat + (perc_frac*om_frac)*om_hksat - - tkmg(c,lev) = tkm ** (1._r8- watsat(c,lev)) - tksatu(c,lev) = tkmg(c,lev)*0.57_r8**watsat(c,lev) - tkdry(c,lev) = ((0.135_r8*bd + 64.7_r8) / (2.7e3_r8 - 0.947_r8*bd))*(1._r8-om_frac) + & - om_tkd*om_frac - csol(c,lev) = ((1._r8-om_frac)*(2.128_r8*sand+2.385_r8*clay) / (sand+clay) + & - om_csol*om_frac)*1.e6_r8 ! J/(m3 K) - if (lev .gt. nlevsoi) then - csol(c,lev) = csol_bedrock - endif - watdry(c,lev) = watsat(c,lev) * (316230._r8/sucsat(c,lev)) ** (-1._r8/bsw(c,lev)) - watopt(c,lev) = watsat(c,lev) * (158490._r8/sucsat(c,lev)) ** (-1._r8/bsw(c,lev)) - !! added by K.Sakaguchi for beta from Lee and Pielke, 1992 - ! water content at field capacity, defined as hk = 0.1 mm/day - ! used eqn (7.70) in CLM3 technote with k = 0.1 (mm/day) / secspday (day/sec) - watfc(c,lev) = watsat(c,lev) * (0.1_r8 / (hksat(c,lev)*secspday))**(1._r8/(2._r8*bsw(c,lev)+3._r8)) - end do - ! - ! Urban pervious and impervious road - ! - ! Impervious road layers -- same as above except set watdry and watopt as missing - if (ctype(c) == icol_road_imperv) then - do lev = 1,nlevgrnd - watdry(c,lev) = spval - watopt(c,lev) = spval - end do - ! pervious road layers -- same as above except also set rootfr_road_perv - ! Currently, pervious road has same properties as soil - else if (ctype(c) == icol_road_perv) then - do lev = 1, nlevgrnd - rootfr_road_perv(c,lev) = 0._r8 - enddo - do lev = 1,nlevsoi - rootfr_road_perv(c,lev) = 0.1_r8 ! uniform profile - end do - end if - endif - - ! Define lake or non-lake levels, layers and interfaces - if (ltype(l) == istdlak) then - z(c,1:nlevlak) = zlak(1:nlevlak) - dz(c,1:nlevlak) = dzlak(1:nlevlak) - else if (ltype(l) == isturb) then - if (ctype(c)==icol_sunwall .or. ctype(c)==icol_shadewall) then - z(c,1:nlevurb) = zurb_wall(l,1:nlevurb) - zi(c,0:nlevurb) = ziurb_wall(l,0:nlevurb) - dz(c,1:nlevurb) = dzurb_wall(l,1:nlevurb) - else if (ctype(c)==icol_roof) then - z(c,1:nlevurb) = zurb_roof(l,1:nlevurb) - zi(c,0:nlevurb) = ziurb_roof(l,0:nlevurb) - dz(c,1:nlevurb) = dzurb_roof(l,1:nlevurb) - else - z(c,1:nlevurb) = zsoi(1:nlevurb) - zi(c,0:nlevurb) = zisoi(0:nlevurb) - dz(c,1:nlevurb) = dzsoi(1:nlevurb) - end if - else - z(c,1:nlevgrnd) = zsoi(1:nlevgrnd) - zi(c,0:nlevgrnd) = zisoi(0:nlevgrnd) - dz(c,1:nlevgrnd) = dzsoi(1:nlevgrnd) - end if - - ! Initialize terms needed for dust model - clay = clay3d(g,1) - gwc_thr(c) = 0.17_r8 + 0.14_r8*clay*0.01_r8 - mss_frc_cly_vld(c) = min(clay*0.01_r8, 0.20_r8) - - end do - - ! pft level initialization - do p = begp, endp - - ! Initialize maximum allowed dew - - dewmx(p) = 0.1_r8 - - ! Initialize root fraction (computing from surface, d is depth in meter): - ! Y = 1 -1/2 (exp(-ad)+exp(-bd) under the constraint that - ! Y(d =0.1m) = 1-beta^(10 cm) and Y(d=d_obs)=0.99 with - ! beta & d_obs given in Zeng et al. (1998). - - c = pcolumn(p) - if (ivt(p) /= noveg) then - do lev = 1, nlevgrnd - rootfr(p,lev) = 0._r8 - enddo - do lev = 1, nlevsoi-1 - rootfr(p,lev) = .5_r8*( exp(-roota_par(ivt(p)) * zi(c,lev-1)) & - + exp(-rootb_par(ivt(p)) * zi(c,lev-1)) & - - exp(-roota_par(ivt(p)) * zi(c,lev )) & - - exp(-rootb_par(ivt(p)) * zi(c,lev )) ) - end do - rootfr(p,nlevsoi) = .5_r8*( exp(-roota_par(ivt(p)) * zi(c,nlevsoi-1)) & - + exp(-rootb_par(ivt(p)) * zi(c,nlevsoi-1)) ) - rootfr(p,nlevsoi+1:nlevgrnd) = 0.0_r8 - -!if (use_cn) then -! ! replacing the exponential rooting distribution -! ! with a linear decrease, going to zero at the bottom of the lowest -! ! soil layer for woody pfts, but going to zero at the bottom of -! ! layer 8 for non-woody pfts. This corresponds to 3.43 m for woody -! ! bottom, vs 1.38 m for non-woody bottom. -! if (woody(ivt(p)) == 1) then -! bottom = nlevsoi -! slope = -2._r8/(zi(c,bottom)*zi(c,bottom)) -! intercept = 2._r8/zi(c,bottom) -! do lev = 1, bottom -! rootfr(p,lev) = dz(c,lev) * 0.5_r8 * ((intercept+slope*zi(c,lev-1)) + (intercept+slope*zi(c,lev))) -! end do -! if (bottom < nlevsoi) then -! do lev=bottom+1,nlevgrnd -! rootfr(p,lev) = 0._r8 -! end do -! end if -! else -! bottom = 8 -! slope = -2._r8/(zi(c,bottom)*zi(c,bottom)) -! intercept = 2._r8/zi(c,bottom) -! do lev=1,bottom -! rootfr(p,lev) = dz(c,lev) * 0.5_r8 * ((intercept+slope*zi(c,lev-1)) + (intercept+slope*zi(c,lev))) -! end do -! if (bottom < nlevsoi) then -! do lev=bottom+1,nlevgrnd -! rootfr(p,lev) = 0._r8 -! end do -! end if -! end if -! endif - else - rootfr(p,1:nlevsoi) = 0._r8 - endif - - ! initialize rresis, for use in ecosystemdyn - do lev = 1,nlevgrnd - rresis(p,lev) = 0._r8 - end do - - end do ! end pft level initialization - - if (use_cn) then - ! initialize the CN variables for special landunits, including lake points - call CNiniSpecial() - end if - - deallocate(soic2d,sand3d,clay3d,gti,organic3d) - deallocate(temp_ef,efisop2d) - deallocate(zurb_wall, zurb_roof, dzurb_wall, dzurb_roof, ziurb_wall, ziurb_roof) - - - ! Initialize SNICAR optical and aging parameters: - call SnowOptics_init( ) - - call SnowAge_init( ) - - if (masterproc) write(iulog,*) 'Successfully initialized time invariant variables' - -end subroutine iniTimeConst diff --git a/src_clm40/main/initGridCellsMod.F90 b/src_clm40/main/initGridCellsMod.F90 deleted file mode 100644 index 02e048cf7b..0000000000 --- a/src_clm40/main/initGridCellsMod.F90 +++ /dev/null @@ -1,1187 +0,0 @@ -module initGridCellsMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: initGridCellsMod -! -! !DESCRIPTION: -! Initializes sub-grid mapping for each land grid cell -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc,iam,mpicom - use abortutils , only : endrun - use clm_varsur , only : wtxy, vegxy - use clm_varsur , only : topoxy - use clm_varctl , only : iulog - -! -! !PUBLIC TYPES: - implicit none - private - save -! -! !PUBLIC MEMBER FUNCTIONS: - public initGridcells ! initialize sub-grid gridcell mapping -! -! !PRIVATE MEMBER FUNCTIONS: - private clm_ptrs_compdown - private clm_ptrs_check - private set_landunit_veg_compete - private set_landunit_wet_ice_lake - private set_landunit_crop_noncompete -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !PRIVATE DATA MEMBERS: None -!EOP -!----------------------------------------------------------------------- - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: initGridcells -! -! !INTERFACE: - subroutine initGridcells () -! -! !DESCRIPTION: -! Initialize sub-grid mapping and allocates space for derived type hierarchy. -! For each land gridcell determine landunit, column and pft properties. -! -! !USES - use clmtype - use domainMod , only : ldomain - use decompMod , only : ldecomp, get_proc_global, get_proc_bounds - use clm_varcon , only : istsoil, istice, istwet, istdlak, isturb, istice_mec - use clm_varctl , only : create_glacier_mec_landunit - use clm_varcon , only : istcrop - use subgridMod , only : subgrid_get_gcellinfo - use shr_const_mod,only : SHR_CONST_PI - use surfrdMod , only : crop_prog -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Peter Thornton and Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: li,ci,pi,m,na,gdc,gsn,glo ! indices - integer :: nveg ! number of pfts in naturally vegetated landunit - integer :: ltype ! landunit type - real(r8):: wtveg ! weight (gridcell) of naturally veg landunit - integer :: ncrop ! number of crop pfts in crop landunit - real(r8):: wtcrop ! weight (gridcell) of crop landunit - integer :: nlake ! number of pfts (columns) in lake landunit - real(r8):: wtlake ! weight (gridcell) of lake landunit - integer :: nwetland ! number of pfts (columns) in wetland landunit - real(r8):: wtwetland ! weight (gridcell) of wetland landunit - integer :: nglacier ! number of pfts (columns) in glacier landunit - real(r8):: wtglacier ! weight (gridcell) of glacier landunit - integer :: nglacier_mec ! number of pfts (columns) in glacier landunit - real(r8):: wtglacier_mec ! weight (gridcell) of glacier_mec landunit - integer :: ier ! error status - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: begg,endg ! local beg/end gridcells gdc - integer :: begl,endl ! local beg/end landunits - integer :: begc,endc ! local beg/end columns - integer :: begp,endp ! local beg/end pfts - logical :: my_gcell ! is gdc gridcell on my pe - integer :: nwtxy ! wtxy cell index - - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - !------------------------------------------------------------------------ - - ! Set pointers into derived types for this module - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - ! Get total global number of grid cells, landunits, columns and pfts - - call get_proc_global(numg,numl,numc,nump) - call get_proc_bounds(begg,endg,begl,endl,begc,endc,begp,endp) - - ! For each land gridcell on global grid determine landunit, column and pft properties - - li = begl-1 - ci = begc-1 - pi = begp-1 - - if ( crop_prog )then - ltype = istcrop - else - ltype = istsoil - end if - - !----- Set clm3 variables ----- - do gdc = begg,endg - - glo = ldecomp%gdc2glo(gdc) - nwtxy = gdc - - my_gcell = .false. - if (gdc >= begg .and. gdc <= endg) then - my_gcell = .true. - endif - - ! Determine naturally vegetated landunit - - call set_landunit_veg_compete( & - ltype=istsoil, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell) - - ! Determine crop landunit - - call set_landunit_crop_noncompete( & - ltype=ltype, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell) - - ! Determine urban landunit - - call set_landunit_urban( & -! ltype=isturb, wtxy=wtxy, vegxy=vegxy, & - ltype=isturb, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell) - - ! Determine lake, wetland and glacier landunits - - call set_landunit_wet_ice_lake( & - ltype=istdlak, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell) - - call set_landunit_wet_ice_lake( & - ltype=istwet, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell) - - call set_landunit_wet_ice_lake( & - ltype=istice, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell) - - if (create_glacier_mec_landunit) then - call set_landunit_wet_ice_lake( & - ltype=istice_mec, & - nw=nwtxy, gi=gdc, li=li, ci=ci, pi=pi, setdata=my_gcell, & - glcmask = ldomain%glcmask(gdc)) - endif - - ! Make ice sheet masks - - gptr%gris_mask(gdc) = 0._r8 - gptr%gris_area(gdc) = 0._r8 - gptr%aais_mask(gdc) = 0._r8 - gptr%aais_area(gdc) = 0._r8 - - ! Greenland mask - if ( (ldomain%latc(gdc) > 58. .and. ldomain%latc(gdc) <= 67. .and. & - ldomain%lonc(gdc) > 302. .and. ldomain%lonc(gdc) < 330.) & - .or. & - (ldomain%latc(gdc) > 67. .and. ldomain%latc(gdc) <= 70. .and. & - ldomain%lonc(gdc) > 300. .and. ldomain%lonc(gdc) < 345.) & - .or. & - (ldomain%latc(gdc) > 70. .and. ldomain%latc(gdc) <= 75. .and. & - ldomain%lonc(gdc) > 295. .and. ldomain%lonc(gdc) < 350.) & - .or. & - (ldomain%latc(gdc) > 75. .and. ldomain%latc(gdc) <= 79. .and. & - ldomain%lonc(gdc) > 285. .and. ldomain%lonc(gdc) < 350.) & - .or. & - (ldomain%latc(gdc) > 79. .and. ldomain%latc(gdc) < 85. .and. & - ldomain%lonc(gdc) > 290. .and. ldomain%lonc(gdc) < 355.) ) then - - gptr%gris_mask(gdc) = 1.0_r8 - - elseif (ldomain%latc(gdc) < -60.) then - - gptr%aais_mask(gdc) = 1.0_r8 - - endif ! Greenland or Antarctic grid cell - - ! Set clm3 lats/lons - - if (my_gcell) then - gptr%gindex(gdc) = glo - gptr%latdeg(gdc) = ldomain%latc(gdc) - gptr%londeg(gdc) = ldomain%lonc(gdc) - gptr%lat(gdc) = gptr%latdeg(gdc) * SHR_CONST_PI/180._r8 - gptr%lon(gdc) = gptr%londeg(gdc) * SHR_CONST_PI/180._r8 - gptr%area(gdc) = ldomain%area(gdc) - endif - - enddo - - ! Fill in subgrid datatypes - - call clm_ptrs_compdown() - call clm_ptrs_check() - - end subroutine initGridcells - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: clm_ptrs_compdown -! -! !INTERFACE: - subroutine clm_ptrs_compdown() -! -! !DESCRIPTION: -! Assumes the part of the subgrid pointing up has been set. Fills -! in the data pointing down. Up is p_c, p_l, p_g, c_l, c_g, and l_g. -! -! This algorithm assumes all indices are monotonically increasing. -! -! Algorithm works as follows. The p, c, and l loops march through -! the full arrays (nump, numc, and numl) checking the "up" indexes. -! As soon as the "up" index of the current (p,c,l) cell changes relative -! to the previous (p,c,l) cell, the *i array will be set to point down -! to that cell. The *f array follows the same logic, so it's always the -! last "up" index from the previous cell when an "up" index changes. -! -! For example, a case where p_c(1:4) = 1 and p_c(5:12) = 2. This -! subroutine will set c_pi(1) = 1, c_pf(1) = 4, c_pi(2) = 5, c_pf(2) = 12. -! -! !USES - use clmtype - use decompMod , only : get_proc_bounds - -! !ARGUMENTS - implicit none -! -! !CALLED FROM: -! subroutines initGridCellsMod -! -! !REVISION HISTORY: -! 2005.11.15 T Craig Creation -! -! -! !LOCAL VARIABLES: - integer :: begg,endg,begl,endl,begc,endc,begp,endp ! beg/end glcp - integer :: g,l,c,p ! loop counters - integer :: curg,curl,curc,curp ! tracks g,l,c,p indexes in arrays - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype -!EOP -!------------------------------------------------------------------------------ - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - call get_proc_bounds(begg,endg,begl,endl,begc,endc,begp,endp) - - !--- Set the current c,l,g (curc, curl, curg) to zero for initialization, - !--- these indices track the current "up" index. - !--- Take advantage of locality of g/l/c/p cells - !--- Loop p through full local begp:endp length - !--- Separately check the p_c, p_l, and p_g indexes for a change in - !--- the "up" index. - !--- If there is a change, verify that the current c,l,g is within the - !--- valid range, and set c_pi, l_pi, or g_pi to that current c,l,g - !--- Constantly update the c_pf, l_pf, and g_pf array. When the - !--- g, l, c index changes, the *_pf array will be set correctly - !--- Do the same for cols setting c_li, c_gi, c_lf, c_gf and - !--- lunits setting l_gi, l_gf. - - curc = 0 - curl = 0 - curg = 0 - do p = begp,endp - if (pptr%column(p) /= curc) then - curc = pptr%column(p) - if (curc < begc .or. curc > endc) then - write(iulog,*) 'clm_ptrs_compdown ERROR: pcolumn ',p,curc,begc,endc - call endrun() - endif - cptr%pfti(curc) = p - endif - cptr%pftf(curc) = p - cptr%npfts(curc) = cptr%pftf(curc) - cptr%pfti(curc) + 1 - if (pptr%landunit(p) /= curl) then - curl = pptr%landunit(p) - if (curl < begl .or. curl > endl) then - write(iulog,*) 'clm_ptrs_compdown ERROR: plandunit ',p,curl,begl,endl - call endrun() - endif - lptr%pfti(curl) = p - endif - lptr%pftf(curl) = p - lptr%npfts(curl) = lptr%pftf(curl) - lptr%pfti(curl) + 1 - if (pptr%gridcell(p) /= curg) then - curg = pptr%gridcell(p) - if (curg < begg .or. curg > endg) then - write(iulog,*) 'clm_ptrs_compdown ERROR: pgridcell ',p,curg,begg,endg - call endrun() - endif - gptr%pfti(curg) = p - endif - gptr%pftf(curg) = p - gptr%npfts(curg) = gptr%pftf(curg) - gptr%pfti(curg) + 1 - enddo - - curg = 0 - curl = 0 - do c = begc,endc - if (cptr%landunit(c) /= curl) then - curl = cptr%landunit(c) - if (curl < begl .or. curl > endl) then - write(iulog,*) 'clm_ptrs_compdown ERROR: clandunit ',c,curl,begl,endl - call endrun() - endif - lptr%coli(curl) = c - endif - lptr%colf(curl) = c - lptr%ncolumns(curl) = lptr%colf(curl) - lptr%coli(curl) + 1 - if (cptr%gridcell(c) /= curg) then - curg = cptr%gridcell(c) - if (curg < begg .or. curg > endg) then - write(iulog,*) 'clm_ptrs_compdown ERROR: cgridcell ',c,curg,begg,endg - call endrun() - endif - gptr%coli(curg) = c - endif - gptr%colf(curg) = c - gptr%ncolumns(curg) = gptr%colf(curg) - gptr%coli(curg) + 1 - enddo - - curg = 0 - do l = begl,endl - if (lptr%gridcell(l) /= curg) then - curg = lptr%gridcell(l) - if (curg < begg .or. curg > endg) then - write(iulog,*) 'clm_ptrs_compdown ERROR: lgridcell ',l,curg,begg,endg - call endrun() - endif - gptr%luni(curg) = l - endif - gptr%lunf(curg) = l - gptr%nlandunits(curg) = gptr%lunf(curg) - gptr%luni(curg) + 1 - enddo - - end subroutine clm_ptrs_compdown -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: clm_ptrs_check -! -! !INTERFACE: - subroutine clm_ptrs_check() -! -! !DESCRIPTION: -! Checks and writes out a summary of subgrid data -! -! !USES - use clmtype - use decompMod , only : get_proc_bounds - -! !ARGUMENTS - implicit none -! -! !CALLED FROM: -! -! !REVISION HISTORY: -! 2005.11.15 T Craig Creation -! -! -! !LOCAL VARIABLES: - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - integer :: begg,endg,begl,endl,begc,endc,begp,endp ! beg/end indices - integer :: g,l,c,p ! loop counters - logical :: error ! error flag -!EOP -!------------------------------------------------------------------------------ - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - if (masterproc) write(iulog,*) ' ' - if (masterproc) write(iulog,*) '---clm_ptrs_check:' - call get_proc_bounds(begg,endg,begl,endl,begc,endc,begp,endp) - - !--- check index ranges --- - error = .false. - if (minval(gptr%luni) < begl .or. maxval(gptr%luni) > endl) error=.true. - if (minval(gptr%lunf) < begl .or. maxval(gptr%lunf) > endl) error=.true. - if (minval(gptr%coli) < begc .or. maxval(gptr%coli) > endc) error=.true. - if (minval(gptr%colf) < begc .or. maxval(gptr%colf) > endc) error=.true. - if (minval(gptr%pfti) < begp .or. maxval(gptr%pfti) > endp) error=.true. - if (minval(gptr%pftf) < begp .or. maxval(gptr%pftf) > endp) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: g index ranges - ERROR' - write(iulog,*)'minval,beg,maxval,end' - write(iulog,*) minval(gptr%luni),begl,maxval(gptr%luni),endl - write(iulog,*) minval(gptr%lunf),begl,maxval(gptr%lunf),endl - write(iulog,*) minval(gptr%coli),begc,maxval(gptr%coli),endc - write(iulog,*) minval(gptr%colf),begc,maxval(gptr%colf),endc - write(iulog,*) minval(gptr%pfti),begp,maxval(gptr%pfti),endp - write(iulog,*) minval(gptr%pftf),begp,maxval(gptr%pftf),endp - call endrun() - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: g index ranges - OK' - - error = .false. - if (minval(lptr%gridcell) < begg .or. maxval(lptr%gridcell) > endg) error=.true. - if (minval(lptr%coli) < begc .or. maxval(lptr%coli) > endc) error=.true. - if (minval(lptr%colf) < begc .or. maxval(lptr%colf) > endc) error=.true. - if (minval(lptr%pfti) < begp .or. maxval(lptr%pfti) > endp) error=.true. - if (minval(lptr%pftf) < begp .or. maxval(lptr%pftf) > endp) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: l index ranges - ERROR' - call endrun() - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: l index ranges - OK' - - error = .false. - if (minval(cptr%gridcell) < begg .or. maxval(cptr%gridcell) > endg) error=.true. - if (minval(cptr%landunit) < begl .or. maxval(cptr%landunit) > endl) error=.true. - if (minval(cptr%pfti) < begp .or. maxval(cptr%pfti) > endp) error=.true. - if (minval(cptr%pftf) < begp .or. maxval(cptr%pftf) > endp) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: c index ranges - ERROR' - call endrun() - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: c index ranges - OK' - - error = .false. - if (minval(pptr%gridcell) < begg .or. maxval(pptr%gridcell) > endg) error=.true. - if (minval(pptr%landunit) < begl .or. maxval(pptr%landunit) > endl) error=.true. - if (minval(pptr%column) < begc .or. maxval(pptr%column) > endc) error=.true. - if (error) then - write(iulog,*) ' clm_ptrs_check: p index ranges - ERROR' - call endrun() - endif - if (masterproc) write(iulog,*) ' clm_ptrs_check: p index ranges - OK' - - !--- check that indices in arrays are monotonically increasing --- - error = .false. - do g=begg+1,endg - if (gptr%luni(g) < gptr%luni(g-1)) error = .true. - if (gptr%lunf(g) < gptr%lunf(g-1)) error = .true. - if (gptr%coli(g) < gptr%coli(g-1)) error = .true. - if (gptr%colf(g) < gptr%colf(g-1)) error = .true. - if (gptr%pfti(g) < gptr%pfti(g-1)) error = .true. - if (gptr%pftf(g) < gptr%pftf(g-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: g mono increasing - ERROR' - call endrun() - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: g mono increasing - OK' - - error = .false. - do l=begl+1,endl - if (lptr%gridcell(l) < lptr%gridcell(l-1)) error = .true. - if (lptr%coli(l) < lptr%coli(l-1)) error = .true. - if (lptr%colf(l) < lptr%colf(l-1)) error = .true. - if (lptr%pfti(l) < lptr%pfti(l-1)) error = .true. - if (lptr%pftf(l) < lptr%pftf(l-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: l mono increasing - ERROR' - call endrun() - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: l mono increasing - OK' - - error = .false. - do c=begc+1,endc - if (cptr%gridcell(c) < cptr%gridcell(c-1)) error = .true. - if (cptr%landunit(c) < cptr%landunit(c-1)) error = .true. - if (cptr%pfti(c) < cptr%pfti(c-1)) error = .true. - if (cptr%pftf(c) < cptr%pftf(c-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: c mono increasing - ERROR' - call endrun() - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: c mono increasing - OK' - - error = .false. - do p=begp+1,endp - if (pptr%gridcell(p) < pptr%gridcell(p-1)) error = .true. - if (pptr%landunit(p) < pptr%landunit(p-1)) error = .true. - if (pptr%column (p) < pptr%column (p-1)) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: p mono increasing - ERROR' - call endrun() - endif - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: p mono increasing - OK' - - !--- check that the tree is internally consistent --- - error = .false. - do g = begg, endg - do l = gptr%luni(g),gptr%lunf(g) - if (lptr%gridcell(l) /= g) error = .true. - do c = lptr%coli(l),lptr%colf(l) - if (cptr%gridcell(c) /= g) error = .true. - if (cptr%landunit(c) /= l) error = .true. - do p = cptr%pfti(c),cptr%pftf(c) - if (pptr%gridcell(p) /= g) error = .true. - if (pptr%landunit(p) /= l) error = .true. - if (pptr%column(p) /= c) error = .true. - if (error) then - write(iulog,*) ' clm_ptrs_check: tree consistent - ERROR' - call endrun() - endif - enddo - enddo - enddo - enddo - if (masterproc) write(iulog,*) ' clm_ptrs_check: tree consistent - OK' - if (masterproc) write(iulog,*) ' ' - -end subroutine clm_ptrs_check -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: set_landunit_veg_compete -! -! !INTERFACE: -! subroutine set_landunit_veg_compete (ltype, wtxy, vegxy, & - subroutine set_landunit_veg_compete (ltype, & - nw, gi, li, ci, pi, setdata) -! -! !DESCRIPTION: -! Initialize vegetated landunit with competition -! -! !USES - use clmtype - use subgridMod, only : subgrid_get_gcellinfo - use clm_varpar, only : numpft, maxpatch_pft, numcft - use clm_varctl, only : allocate_all_vegpfts, create_crop_landunit -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: ltype ! landunit type -! real(r8), intent(in) :: wtxy(:,:) ! subgrid patch weights -! integer , intent(in) :: vegxy(:,:) ! PFT types - integer , intent(in) :: nw ! cell index - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! pft index - logical , intent(in) :: setdata ! set info or just compute -! -! !REVISION HISTORY: -! Created by ? -! 2005.11.25 Updated by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m ! m index in wtxy(nw,m) - integer :: n ! loop index - integer :: npfts ! number of pfts in landunit - integer :: ncols ! number of columns in landu - integer :: pitype ! pft itype - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - type(landunit_type), pointer :: lptr ! pointer to landunit - type(column_type) , pointer :: cptr ! pointer to column - type(pft_type) , pointer :: pptr ! pointer to pft - -!------------------------------------------------------------------------ - - ! Set decomposition properties - -! call subgrid_get_gcellinfo(nw, wtxy, nveg=npfts, wtveg=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, nveg=npfts, wtveg=wtlunit2gcell) - - if (npfts > 0) then - - ! Set pointers into derived types for this module - - lptr => lun - cptr => col - pptr => pft - - ncols = 1 - - li = li + 1 - ci = ci + 1 - - if (setdata) then - ! Set landunit properties - lptr%ifspecial(li) = .false. - lptr%lakpoi(li) = .false. - lptr%urbpoi(li) = .false. - lptr%itype(li) = ltype - - lptr%gridcell (li) = gi - lptr%wtgcell(li) = wtlunit2gcell - - ! Set column properties for this landunit (only one column on landunit) - cptr%itype(ci) = 1 - - cptr%gridcell (ci) = gi - cptr%wtgcell(ci) = wtlunit2gcell - cptr%landunit (ci) = li - cptr%wtlunit(ci) = 1.0_r8 - endif ! setdata - - ! Set pft properties for this landunit - - if (create_crop_landunit) then - do n = 1,numpft+1-numcft - pi = pi + 1 - pitype = n-1 - if (setdata) then - pptr%mxy(pi) = n - pptr%itype(pi) = pitype - pptr%gridcell(pi) = gi - pptr%landunit(pi) = li - pptr%column (pi) = ci - pptr%wtgcell(pi) = 0.0_r8 - pptr%wtlunit(pi) = 0.0_r8 - pptr%wtcol(pi) = 0.0_r8 - do m = 1,maxpatch_pft - if (vegxy(nw,m) == pitype .and. wtxy(nw,m) > 0._r8) then - pptr%wtgcell(pi) = pptr%wtgcell(pi) + wtxy(nw,m) - pptr%wtlunit(pi) = pptr%wtlunit(pi) + wtxy(nw,m) / wtlunit2gcell - pptr%wtcol(pi) = pptr%wtcol(pi) + wtxy(nw,m) / wtlunit2gcell - end if - end do - endif ! setdata - end do - else if (allocate_all_vegpfts) then - do n = 1,numpft+1 - pi = pi + 1 - pitype = n-1 - if (setdata) then - pptr%mxy(pi) = n - pptr%itype(pi) = pitype - pptr%gridcell(pi) = gi - pptr%landunit(pi) = li - pptr%column (pi) = ci - pptr%wtgcell(pi) = 0.0_r8 - pptr%wtlunit(pi) = 0.0_r8 - pptr%wtcol(pi) = 0.0_r8 - do m = 1,maxpatch_pft - if (vegxy(nw,m) == pitype .and. wtxy(nw,m) > 0._r8) then - pptr%wtgcell(pi) = pptr%wtgcell(pi) + wtxy(nw,m) - pptr%wtlunit(pi) = pptr%wtlunit(pi) + wtxy(nw,m) / wtlunit2gcell - pptr%wtcol(pi) = pptr%wtcol(pi) + wtxy(nw,m) / wtlunit2gcell - end if - end do - endif ! setdata - end do - else - do m = 1,maxpatch_pft - if (wtxy(nw,m) > 0._r8) then - pi = pi + 1 - if (setdata) then - pptr%mxy(pi) = m - pptr%itype(pi) = vegxy(nw,m) - pptr%gridcell(pi) = gi - pptr%wtgcell(pi) = wtxy(nw,m) - pptr%landunit(pi) = li - pptr%wtlunit(pi) = wtxy(nw,m) / wtlunit2gcell - pptr%column (pi) = ci - pptr%wtcol(pi) = wtxy(nw,m) / wtlunit2gcell - endif ! setdata - end if - end do - end if - - end if - - end subroutine set_landunit_veg_compete - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: set_landunit_wet_ice_lake -! -! !INTERFACE: -! subroutine set_landunit_wet_ice_lake (ltype, wtxy, vegxy, & - subroutine set_landunit_wet_ice_lake (ltype, & - nw, gi, li, ci, pi, setdata, glcmask) -! -! !DESCRIPTION: -! Initialize wet_ice_lake landunits that are non-urban (lake, wetland, glacier, glacier_mec) -! -! !USES - use clmtype - use subgridMod, only : subgrid_get_gcellinfo - use clm_varcon, only : istice, istwet, istdlak, istice_mec - use clm_varpar, only : npatch_lake, npatch_glacier, npatch_wet - use clm_varpar, only : npatch_glacier_mec - -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: ltype ! landunit type -! real(r8), intent(in) :: wtxy(:,:) ! subgrid patch weights -! integer , intent(in) :: vegxy(:,:) ! PFT types - integer , intent(in) :: nw ! cell index - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! pft index - logical , intent(in) :: setdata ! set info or just compute - integer , intent(in), optional :: glcmask ! = 1 where glc requires sfc mass balance - ! = 0 otherwise -! -! !REVISION HISTORY: -! Created by Sam Levis -! 2005.11.25 Updated by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m ! m index in wtxy(nw,m) - integer :: c ! column loop index - integer :: ctype ! column type - integer :: ier ! error status - integer :: npfts ! number of pfts in landunit - integer :: ncols ! number of columns in landu - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - real(r8) :: wtcol2lunit ! col weight in landunit - type(landunit_type), pointer :: lptr ! pointer to landunit - type(column_type) , pointer :: cptr ! pointer to column - type(pft_type) , pointer :: pptr ! pointer to pft - -!------------------------------------------------------------------------ - - ! Set decomposition properties - - if (ltype == istwet) then -! call subgrid_get_gcellinfo(nw, wtxy, nwetland=npfts, wtwetland=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, nwetland=npfts, wtwetland=wtlunit2gcell) - m = npatch_wet - else if (ltype == istdlak) then -! call subgrid_get_gcellinfo(nw, wtxy, nlake=npfts, wtlake=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, nlake=npfts, wtlake=wtlunit2gcell) - m = npatch_lake - else if (ltype == istice) then -! call subgrid_get_gcellinfo(nw, wtxy, nglacier=npfts, wtglacier=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, nglacier=npfts, wtglacier=wtlunit2gcell) - m = npatch_glacier - else if (ltype == istice_mec) then -! call subgrid_get_gcellinfo(nw, wtxy, nglacier_mec=npfts, wtglacier_mec=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, nglacier_mec=npfts, wtglacier_mec=wtlunit2gcell, & - glcmask = glcmask) - ! NOTE: multiple columns per landunit, so m is not set here - - else - write(iulog,*)' set_landunit_wet_ice_lake: ltype of ',ltype,' not valid' - write(iulog,*)' only istwet, istdlak, istice and istice_mec ltypes are valid' - call endrun() - end if - - if (npfts > 0) then - - ! Set pointers into derived types for this module - - lptr => lun - cptr => col - pptr => pft - - if (npfts /=1 .and. ltype /= istice_mec) then - write(iulog,*)' set_landunit_wet_ice_lake: compete landunit must'// & - ' have one column and one pft ' - write(iulog,*)' current values of ncols, pfts=',ncols,npfts - call endrun() - end if - - if (ltype==istice_mec) then ! multiple columns per landunit - - ! Assume that columns are of type 1 and that each column has its own pft - - ctype = 1 - li = li + 1 - - if (setdata) then - - ! Determine landunit properties - - lptr%itype (li) = ltype - lptr%ifspecial(li) = .true. - lptr%glcmecpoi(li) = .true. - lptr%lakpoi (li) = .false. - lptr%urbpoi (li) = .false. - lptr%gridcell (li) = gi - lptr%wtgcell (li) = wtlunit2gcell - - ! Determine column and properties - ! (Each column has its own pft) - ! - ! For grid cells with glcmask = 1, make sure all the elevations classes - ! are populated, even if some have zero fractional area. This ensures that the - ! ice sheet component, glc, will receive a surface mass balance in each elevation - ! class wherever the SMB is needed. - ! Columns with zero weight are referred to as "virtual" columns. - - do m = npatch_glacier+1, npatch_glacier_mec - - if (wtxy(nw,m) > 0._r8 .or. glcmask == 1) then - - ci = ci + 1 - pi = pi + 1 - if (wtlunit2gcell > 0._r8) then - wtcol2lunit = wtxy(nw,m)/wtlunit2gcell - else ! virtual landunit - wtcol2lunit = 0._r8 - endif - - cptr%itype (ci) = ctype - cptr%gridcell (ci) = gi - cptr%wtgcell (ci) = wtcol2lunit * wtlunit2gcell - cptr%landunit (ci) = li - cptr%wtlunit (ci) = wtcol2lunit - - ! Set sfc elevation too - - cps%glc_topo(ci) = topoxy(nw,m) - - ! Set pft properties - - pptr%mxy (pi) = m - pptr%itype (pi) = vegxy(nw,m) - pptr%gridcell (pi) = gi - pptr%wtgcell (pi) = wtcol2lunit * wtlunit2gcell - pptr%landunit (pi) = li - pptr%wtlunit (pi) = wtcol2lunit - pptr%column (pi) = ci - pptr%wtcol (pi) = 1.0_r8 - - endif ! wtxy > 0 or glcmask = 1 - enddo ! loop over columns - endif ! setdata - - else - - ncols = 1 - - ! Currently assume that each landunit only has only one column - ! (of type 1) and that each column has its own pft - - wtcol2lunit = 1.0_r8/ncols - ctype = 1 - - li = li + 1 - ci = ci + 1 - pi = pi + 1 - - if (setdata) then - - ! Determine landunit properties - - lptr%itype (li) = ltype - lptr%ifspecial(li) = .true. - lptr%urbpoi (li) = .false. - if (ltype == istdlak) then - lptr%lakpoi(li) = .true. - else - lptr%lakpoi(li) = .false. - end if - - lptr%gridcell (li) = gi - lptr%wtgcell(li) = wtlunit2gcell - - ! Determine column and properties - ! For the wet, ice or lake landunits it is assumed that each - ! column has its own pft - - cptr%itype(ci) = ctype - - cptr%gridcell (ci) = gi - cptr%wtgcell(ci) = wtcol2lunit * wtlunit2gcell - cptr%landunit (ci) = li - cptr%wtlunit(ci) = wtcol2lunit - - ! Set pft properties - - pptr%mxy(pi) = m - pptr%itype(pi) = vegxy(nw,m) - - pptr%gridcell (pi) = gi - pptr%wtgcell(pi) = wtcol2lunit * wtlunit2gcell - pptr%landunit (pi) = li - pptr%wtlunit(pi) = wtcol2lunit - pptr%column (pi) = ci - pptr%wtcol(pi) = 1.0_r8 - endif ! setdata - end if ! ltype = istice_mec - endif ! npfts > 0 - - end subroutine set_landunit_wet_ice_lake - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: set_landunit_crop_noncompete -! -! !INTERFACE: -! subroutine set_landunit_crop_noncompete (ltype, wtxy, vegxy, & - subroutine set_landunit_crop_noncompete (ltype, & - nw, gi, li, ci, pi, setdata) -! -! !DESCRIPTION: -! Initialize crop landunit without competition -! -! !USES - use clmtype - use subgridMod, only : subgrid_get_gcellinfo - use clm_varctl, only : create_crop_landunit - use clm_varpar, only : maxpatch_pft, numcft, npatch_glacier_mec -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: ltype ! landunit type -! real(r8), intent(in) :: wtxy(:,:) ! subgrid patch weights -! integer , intent(in) :: vegxy(:,:) ! PFT types - integer , intent(in) :: nw ! cell index - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! pft index - logical , intent(in) :: setdata ! set info or just compute -! -! !REVISION HISTORY: -! Created by Sam Levis -! 2005.11.25 Updated by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m ! m index in wtxy(nw,m) - integer :: npfts ! number of pfts in landunit - integer :: ncols ! number of columns in landu - real(r8) :: wtlunit2gcell ! landunit weight in gridcell - type(landunit_type), pointer :: lptr ! pointer to landunit - type(column_type) , pointer :: cptr ! pointer to column - type(pft_type) , pointer :: pptr ! pointer to pft -!------------------------------------------------------------------------ - - ! Set decomposition properties - -! call subgrid_get_gcellinfo(nw, wtxy, ncrop=npfts, wtcrop=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, ncrop=npfts, wtcrop=wtlunit2gcell) - - if (npfts > 0) then - - ! Set pointers into derived types for this module - - lptr => lun - cptr => col - pptr => pft - - ! Set landunit properties - each column has its own pft - - ncols = npfts - - li = li + 1 - - if (setdata) then - lptr%itype(li) = ltype - lptr%ifspecial(li) = .false. - lptr%lakpoi(li) = .false. - lptr%urbpoi(li) = .false. - lptr%gridcell (li) = gi - lptr%wtgcell(li) = wtlunit2gcell - endif ! setdata - - ! Set column and pft properties for this landunit - ! (each column has its own pft) - - if (create_crop_landunit) then - do m = maxpatch_pft-numcft+1, maxpatch_pft - ci = ci + 1 - pi = pi + 1 - - if (setdata) then - cptr%itype(ci) = 1 - pptr%itype(pi) = m - 1 - pptr%mxy(pi) = m - - cptr%gridcell (ci) = gi - cptr%wtgcell(ci) = wtxy(nw,m) - cptr%landunit (ci) = li - - pptr%gridcell (pi) = gi - pptr%wtgcell(pi) = wtxy(nw,m) - pptr%landunit (pi) = li - pptr%column (pi) = ci - if (wtxy(nw,m) > 0._r8) then - cptr%wtlunit(ci) = wtxy(nw,m) / wtlunit2gcell - pptr%wtlunit(pi) = wtxy(nw,m) / wtlunit2gcell - pptr%wtcol(pi) = 1._r8 - else - cptr%wtlunit(ci) = 0._r8 - pptr%wtlunit(pi) = 0._r8 - pptr%wtcol(pi) = 0._r8 - end if - endif ! setdata - end do - end if - - end if - - end subroutine set_landunit_crop_noncompete - -!------------------------------------------------------------------------------ - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: set_landunit_urban -! -! !INTERFACE: -! subroutine set_landunit_urban (ltype, wtxy, vegxy, & - subroutine set_landunit_urban (ltype, & - nw, gi, li, ci, pi, setdata) -! -! !DESCRIPTION: -! Initialize urban landunits -! -! !USES - use clm_varcon , only : isturb, icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv - use clm_varpar , only : npatch_urban, maxpatch_urb - use clmtype - use subgridMod , only : subgrid_get_gcellinfo - use UrbanInputMod, only : urbinp - use decompMod , only : ldecomp -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: ltype ! landunit type -! real(r8), intent(in) :: wtxy(:,:) ! subgrid patch weights -! integer , intent(in) :: vegxy(:,:) ! PFT types - integer , intent(in) :: nw ! cell index - integer , intent(in) :: gi ! gridcell index - integer , intent(inout) :: li ! landunit index - integer , intent(inout) :: ci ! column index - integer , intent(inout) :: pi ! pft index - logical , intent(in) :: setdata ! set info or just compute -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: c ! column loop index - integer :: m ! m index in wtxy(nw,m) - integer :: ctype ! column type - integer :: npfts ! number of pfts in landunit - integer :: ncols ! number of columns in landunit - real(r8) :: wtlunit2gcell ! weight relative to gridcell of landunit - real(r8) :: wtcol2lunit ! weight of column with respect to landunit - real(r8) :: wtlunit_roof ! weight of roof with respect to landunit - real(r8) :: wtroad_perv ! weight of pervious road column with respect to total road - integer :: ier ! error status - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype -!------------------------------------------------------------------------ - - ! Set decomposition properties - -! call subgrid_get_gcellinfo(nw, wtxy, nurban=npfts, wturban=wtlunit2gcell) - call subgrid_get_gcellinfo(nw, nurban=npfts, wturban=wtlunit2gcell) - - if (npfts > 0) then - - ! Set pointers into derived types for this module - - lptr => lun - cptr => col - pptr => pft - - ! Determine landunit properties - each columns has its own pft - - ncols = npfts - - li = li + 1 - if (setdata) then - lptr%itype (li) = ltype - lptr%ifspecial(li) = .true. - lptr%lakpoi (li) = .false. - lptr%urbpoi (li) = .true. - - lptr%gridcell (li) = gi - lptr%wtgcell (li) = wtlunit2gcell - endif - - ! Loop through columns for this landunit and set the column and pft properties - ! For the urban landunits it is assumed that each column has its own pft - - do m = npatch_urban, npatch_urban + maxpatch_urb - 1 - if (wtxy(nw,m) > 0._r8) then - - wtlunit_roof = urbinp%wtlunit_roof(nw) - wtroad_perv = urbinp%wtroad_perv(nw) - - if (m == npatch_urban ) then - ctype = icol_roof - wtcol2lunit = wtlunit_roof - else if (m == npatch_urban+1) then - ctype = icol_sunwall - wtcol2lunit = (1. - wtlunit_roof)/3 - else if (m == npatch_urban+2) then - ctype = icol_shadewall - wtcol2lunit = (1. - wtlunit_roof)/3 - else if (m == npatch_urban+3) then - ctype = icol_road_imperv - wtcol2lunit = ((1. - wtlunit_roof)/3) * (1.-wtroad_perv) - else if (m == npatch_urban+4) then - ctype = icol_road_perv - wtcol2lunit = ((1. - wtlunit_roof)/3) * (wtroad_perv) - end if - - ci = ci + 1 - pi = pi + 1 - - if (setdata) then - cptr%itype(ci) = ctype - - cptr%gridcell (ci) = gi - cptr%wtgcell (ci) = wtcol2lunit * wtlunit2gcell - cptr%landunit (ci) = li - cptr%wtlunit (ci) = wtcol2lunit - - pptr%mxy (pi) = m - pptr%itype (pi) = vegxy(nw,m) - - pptr%gridcell(pi) = gi - pptr%wtgcell (pi) = wtcol2lunit * wtlunit2gcell - pptr%landunit(pi) = li - pptr%wtlunit (pi) = wtcol2lunit - pptr%column (pi) = ci - pptr%wtcol (pi) = 1.0_r8 - end if - - end if - end do ! end of loop through urban columns-pfts - - end if - - end subroutine set_landunit_urban - -!------------------------------------------------------------------------------ - -end module initGridCellsMod diff --git a/src_clm40/main/initSurfAlbMod.F90 b/src_clm40/main/initSurfAlbMod.F90 deleted file mode 100644 index 8314905ba1..0000000000 --- a/src_clm40/main/initSurfAlbMod.F90 +++ /dev/null @@ -1,344 +0,0 @@ -module initSurfalbMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: initSurfalbMod -! -! !DESCRIPTION: -! Computes initial surface albedo calculation - -! Initialization of ecosystem dynamics is needed for this -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils, only : endrun - use clm_varctl, only : iulog, use_cn, use_cndv -! -! !PUBLIC TYPES: - implicit none - logical, public :: do_initsurfalb -! save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: InitSurfAlb -! -! !REVISION HISTORY: -! 2005-06-12: Created by Mariana Vertenstein -! 2008-02-29: Revised snow cover fraction from Niu and Yang, 2007 -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: initSurfalb -! -! !INTERFACE: - subroutine initSurfalb( calday, declin, declinm1 ) -! -! !DESCRIPTION: -! The variable, h2osoi_vol, is needed by the soil albedo routine - this is not needed -! on restart since it is computed before the soil albedo computation is called. -! The remaining variables are initialized by calls to ecosystem dynamics and -! albedo subroutines. -! -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_orb_mod , only : shr_orb_decl - use shr_const_mod , only : SHR_CONST_PI - use clmtype - use spmdMod , only : masterproc,iam - use decompMod , only : get_proc_clumps, get_clump_bounds - use filterMod , only : filter - use clm_varpar , only : nlevsoi, nlevsno, nlevlak, nlevgrnd - use clm_varcon , only : zlnd, istsoil, isturb, denice, denh2o, & - icol_roof, icol_road_imperv, & - icol_road_perv - use clm_varcon , only : istcrop - use clm_time_manager , only : get_step_size - use FracWetMod , only : FracWet - use SurfaceAlbedoMod , only : SurfaceAlbedo - use CNEcosystemDynMod , only : CNEcosystemDyn - use CNVegStructUpdateMod, only : CNVegStructUpdate - use STATICEcosysDynMod , only : EcosystemDyn, interpMonthlyVeg - use UrbanMod , only : UrbanAlbedo - use abortutils , only : endrun -! -! !ARGUMENTS: - implicit none - real(r8), intent(in) :: calday ! calendar day for declin - real(r8), intent(in) :: declin ! declination angle (radians) for calday - real(r8), intent(in), optional :: declinm1 ! declination angle (radians) for caldaym1 -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: plandunit(:) ! landunit index associated with each pft - integer , pointer :: ctype(:) ! column type - integer , pointer :: clandunit(:) ! landunit index associated with each column - integer, pointer :: pgridcell(:) ! gridcell associated with each pft - integer , pointer :: itypelun(:) ! landunit type - logical , pointer :: lakpoi(:) ! true => landunit is a lake point - real(r8), pointer :: dz(:,:) ! layer thickness depth (m) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - integer , pointer :: frac_veg_nosno_alb(:) ! fraction of vegetation not covered by snow (0 OR 1) [-] - real(r8), pointer :: dayl(:) ! daylength (seconds) - real(r8), pointer :: latdeg(:) ! latitude (degrees) - integer , pointer :: pcolumn(:) ! index into column level quantities - real(r8), pointer :: soilpsi(:,:) ! soil water potential in each soil layer (MPa) -! -! local pointers to implicit out arguments -! - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: frac_sno(:) ! fraction of ground covered by snow (0 to 1) - integer , pointer :: frac_veg_nosno(:) ! fraction of vegetation not covered by snow (0 OR 1) [-] - real(r8), pointer :: fwet(:) ! fraction of canopy that is wet (0 to 1) (pft-level) - real(r8), pointer :: decl(:) ! solar declination angle (radians) -! -! local pointers to implicit out arguments (lake points only) -! - real(r8), pointer :: fdry(:) ! fraction of foliage that is green and dry [-] (new) - real(r8), pointer :: tlai(:) ! one-sided leaf area index, no burying by snow - real(r8), pointer :: tsai(:) ! one-sided stem area index, no burying by snow - real(r8), pointer :: htop(:) ! canopy top (m) - real(r8), pointer :: hbot(:) ! canopy bottom (m) - real(r8), pointer :: elai(:) ! one-sided leaf area index with burying by snow - real(r8), pointer :: esai(:) ! one-sided stem area index with burying by snow -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: nc,j,l,c,p,fc ! indices - integer :: nclumps ! number of clumps on this processor - integer :: begp, endp ! per-clump beginning and ending pft indices - integer :: begc, endc ! per-clump beginning and ending column indices - integer :: begl, endl ! per-clump beginning and ending landunit indices - integer :: begg, endg ! per-clump gridcell ending gridcell indices - integer :: ier ! MPI return code - real(r8):: lat ! latitude (radians) for daylength calculation - real(r8):: temp ! temporary variable for daylength - real(r8):: snowbd ! temporary calculation of snow bulk density (kg/m3) - real(r8):: fmelt ! snowbd/100 -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (landunit-level) - - lakpoi => lun%lakpoi - itypelun => lun%itype - - ! Assign local pointers to derived subtypes components (column-level) - - dz => cps%dz - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - h2osoi_vol => cws%h2osoi_vol - snowdp => cps%snowdp - h2osno => cws%h2osno - frac_sno => cps%frac_sno - ctype => col%itype - clandunit => col%landunit - soilpsi => cps%soilpsi - - ! Assign local pointers to derived subtypes components (pft-level) - - plandunit => pft%landunit - frac_veg_nosno_alb => pps%frac_veg_nosno_alb - frac_veg_nosno => pps%frac_veg_nosno - fwet => pps%fwet - - ! Assign local pointers to derived subtypes components (pft-level) - ! The folowing pointers will only be used for lake points in this routine - - htop => pps%htop - hbot => pps%hbot - tlai => pps%tlai - tsai => pps%tsai - elai => pps%elai - esai => pps%esai - fdry => pps%fdry - - decl => cps%decl - dayl => pepv%dayl - pcolumn => pft%column - pgridcell => pft%gridcell - latdeg => grc%latdeg - - ! ======================================================================== - ! Determine surface albedo - initialized by calls to ecosystem dynamics and - ! albedo subroutines. Note: elai, esai, frac_veg_nosno_alb are computed in - ! Ecosysdyn and needed by routines FracWet and SurfaceAlbedo and - ! frac_veg_nosno is needed by FracWet - ! fwet is needed in routine TwoStream (called by SurfaceAlbedo) - ! frac_sno is needed by SoilAlbedo (called by SurfaceAlbedo) - ! ======================================================================== - - if (.not. use_cn) then - ! the default mode uses prescribed vegetation structure - ! Read monthly vegetation data for interpolation to daily values - - call interpMonthlyVeg() - end if - - ! Determine clump bounds for this processor - - nclumps = get_proc_clumps() - - ! Loop over clumps on this processor -!$OMP PARALLEL DO PRIVATE (nc,p,j,l,c,fc,begg,endg,begl,endl,begc,endc,begp,endp,lat,temp,snowbd,fmelt) - do nc = 1,nclumps - - ! Determine clump bounds - - call get_clump_bounds(nc, begg, endg, begl, endl, begc, endc, begp, endp) - - ! Determine variables needed by SurfaceAlbedo for lake points - - do p = begp,endp - l = plandunit(p) - if (lakpoi(l)) then - fwet(p) = 0._r8 - fdry(p) = 0._r8 - elai(p) = 0._r8 - esai(p) = 0._r8 - htop(p) = 0._r8 - hbot(p) = 0._r8 - tlai(p) = 0._r8 - tsai(p) = 0._r8 - frac_veg_nosno_alb(p) = 0._r8 - frac_veg_nosno(p) = 0._r8 - end if - end do - - ! ============================================================================ - ! Ecosystem dynamics: Uses CN, or static parameterizations - ! ============================================================================ - - if (use_cn) then - do j = 1, nlevgrnd - do fc = 1, filter(nc)%num_soilc - c = filter(nc)%soilc(fc) - soilpsi(c,j) = -15.0_r8 - end do - end do - end if - - ! Determine variables needed for SurfaceAlbedo for non-lake points - - if (use_cn) then - ! CN initialization is done only on the soil landunits. - - if (.not. present(declinm1)) then - write(iulog,*)'declination for the previous timestep (declinm1) must be ',& - ' present as argument in CN mode' - call endrun() - end if - - ! it is necessary to initialize the solar declination for the previous - ! timestep (caldaym1) so that the CNphenology routines know if this is - ! before or after the summer solstice. - - ! declination for previous timestep - do c = begc, endc - l = clandunit(c) - if (itypelun(l) == istsoil .or. itypelun(l) == istcrop) then - decl(c) = declinm1 - end if - end do - - ! daylength for previous timestep - do p = begp, endp - c = pcolumn(p) - l = plandunit(p) - if (itypelun(l) == istsoil .or. itypelun(l) == istcrop) then - lat = latdeg(pgridcell(p)) * SHR_CONST_PI / 180._r8 - temp = -(sin(lat)*sin(decl(c)))/(cos(lat) * cos(decl(c))) - temp = min(1._r8,max(-1._r8,temp)) - dayl(p) = 2.0_r8 * 13750.9871_r8 * acos(temp) - end if - end do - - ! declination for current timestep - do c = begc, endc - l = clandunit(c) - if (itypelun(l) == istsoil .or. itypelun(l) == istcrop) then - decl(c) = declin - end if - end do - - call CNEcosystemDyn(begc, endc, begp, endp, filter(nc)%num_soilc, filter(nc)%soilc, & - filter(nc)%num_soilp, filter(nc)%soilp, & - filter(nc)%num_pcropp, filter(nc)%pcropp, doalb=.true.) - - else - - ! this is the default call if CN not set - - call EcosystemDyn(begp, endp, filter(nc)%num_nolakep, filter(nc)%nolakep, & - doalb=.true.) - end if - - do p = begp, endp - l = plandunit(p) - if (.not. lakpoi(l)) then - frac_veg_nosno(p) = frac_veg_nosno_alb(p) - fwet(p) = 0._r8 - end if - end do - - call FracWet(filter(nc)%num_nolakep, filter(nc)%nolakep) - - ! Compute Surface Albedo - all land points (including lake) other than urban - ! Needs as input fracion of soil covered by snow (Z.-L. Yang U. Texas) - - do c = begc, endc - l = clandunit(c) - if (itypelun(l) == isturb) then - ! From Bonan 1996 (LSM technical note) - frac_sno(c) = min( snowdp(c)/0.05_r8, 1._r8) - else - frac_sno(c) = 0._r8 - ! snow cover fraction as in Niu and Yang 2007 - if(snowdp(c) .gt. 0.0) then - snowbd = min(800._r8,h2osno(c)/snowdp(c)) !bulk density of snow (kg/m3) - fmelt = (snowbd/100.)**1. - ! 100 is the assumed fresh snow density; 1 is a melting factor that could be - ! reconsidered, optimal value of 1.5 in Niu et al., 2007 - frac_sno(c) = tanh( snowdp(c) /(2.5 * zlnd * fmelt) ) - endif - end if - end do - call SurfaceAlbedo(begg, endg, begc, endc, begp, endp, & - filter(nc)%num_nourbanc, filter(nc)%nourbanc, & - filter(nc)%num_nourbanp, filter(nc)%nourbanp, & - calday, declin) - - - ! Determine albedos for urban landunits - - if (filter(nc)%num_urbanl > 0) then - call UrbanAlbedo(nc, begl, endl, begc, endc, begp, endp, & - filter(nc)%num_urbanl, filter(nc)%urbanl, & - filter(nc)%num_urbanc, filter(nc)%urbanc, & - filter(nc)%num_urbanp, filter(nc)%urbanp ) - - end if - - end do ! end of loop over clumps -!$OMP END PARALLEL DO - - end subroutine initSurfalb - -end module initSurfalbMod diff --git a/src_clm40/main/lnd_comp_mct.F90 b/src_clm40/main/lnd_comp_mct.F90 deleted file mode 100644 index 80a46ba1f4..0000000000 --- a/src_clm40/main/lnd_comp_mct.F90 +++ /dev/null @@ -1,649 +0,0 @@ -module lnd_comp_mct - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Interface of the active land model component of CESM the CLM (Community Land Model) - ! with the main CESM driver. This is a thin interface taking CESM driver information - ! in MCT (Model Coupling Toolkit) format and converting it to use by CLM. - ! - ! !uses: - use shr_kind_mod , only : r8 => shr_kind_r8 - use shr_sys_mod , only : shr_sys_flush - use mct_mod , only : mct_avect, mct_gsmap, mct_gGrid - use decompmod , only : bounds_type, ldecomp - use lnd_import_export - ! - ! !public member functions: - implicit none - save - private ! by default make data private - ! - ! !public member functions: - public :: lnd_init_mct ! clm initialization - public :: lnd_run_mct ! clm run phase - public :: lnd_final_mct ! clm finalization/cleanup - ! - ! !private member functions: - private :: lnd_setgsmap_mct ! set the land model mct gs map - private :: lnd_domain_mct ! set the land model domain information - !--------------------------------------------------------------------------- - -contains - - !==================================================================================== - - subroutine lnd_init_mct( EClock, cdata_l, x2l_l, l2x_l, NLFilename ) - ! - ! !DESCRIPTION: - ! Initialize land surface model and obtain relevant atmospheric model arrays - ! back from (i.e. albedos, surface temperature and snow cover over land). - ! - ! !USES: - use shr_kind_mod , only : shr_kind_cl - use abortutils , only : endrun - use clm_time_manager , only : get_nstep, get_step_size, set_timemgr_init, & - set_nextsw_cday - use clm_atmlnd , only : clm_l2a - use clm_glclnd , only : clm_s2x - use clm_initializeMod, only : initialize1, initialize2 - use clm_varctl , only : finidat,single_column, clm_varctl_set, iulog, noland, & - inst_index, inst_suffix, inst_name - use clm_varorb , only : eccen, obliqr, lambm0, mvelpp - use controlMod , only : control_setNL - use decompMod , only : get_proc_bounds - use domainMod , only : ldomain - use shr_file_mod , only : shr_file_setLogUnit, shr_file_setLogLevel, & - shr_file_getLogUnit, shr_file_getLogLevel, & - shr_file_getUnit, shr_file_setIO - use seq_cdata_mod , only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod , only : seq_timemgr_EClockGetData - use seq_infodata_mod , only : seq_infodata_type, seq_infodata_GetData, seq_infodata_PutData, & - seq_infodata_start_type_start, seq_infodata_start_type_cont, & - seq_infodata_start_type_brnch - use seq_comm_mct , only : seq_comm_suffix, seq_comm_inst, seq_comm_name - use seq_flds_mod , only : seq_flds_x2l_fields, seq_flds_l2x_fields - use spmdMod , only : masterproc, spmd_init - use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch - use clm_cpl_indices , only : clm_cpl_indices_set - use mct_mod , only : mct_aVect_init, mct_aVect_zero, mct_gsMap_lsize - use ESMF - ! - ! !ARGUMENTS: - type(ESMF_Clock), intent(inout) :: EClock ! Input synchronization clock - type(seq_cdata), intent(inout) :: cdata_l ! Input land-model driver data - type(mct_aVect), intent(inout) :: x2l_l, l2x_l ! land model import and export states - character(len=*), optional, intent(in) :: NLFilename ! Namelist filename to read - ! - ! !LOCAL VARIABLES: - integer :: LNDID ! Land identifyer - integer :: mpicom_lnd ! MPI communicator - type(mct_gsMap), pointer :: GSMap_lnd ! Land model MCT GS map - type(mct_gGrid), pointer :: dom_l ! Land model domain - type(seq_infodata_type), pointer :: infodata ! CESM driver level info data - integer :: lsize ! size of attribute vector - integer :: g,i,j ! indices - integer :: dtime_sync ! coupling time-step from the input synchronization clock - integer :: dtime_clm ! clm time-step - logical :: exists ! true if file exists - logical :: atm_aero ! Flag if aerosol data sent from atm model - real(r8) :: scmlat ! single-column latitude - real(r8) :: scmlon ! single-column longitude - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - character(len=SHR_KIND_CL) :: caseid ! case identifier name - character(len=SHR_KIND_CL) :: ctitle ! case description title - character(len=SHR_KIND_CL) :: starttype ! start-type (startup, continue, branch, hybrid) - character(len=SHR_KIND_CL) :: calendar ! calendar type name - character(len=SHR_KIND_CL) :: hostname ! hostname of machine running on - character(len=SHR_KIND_CL) :: version ! Model version - character(len=SHR_KIND_CL) :: username ! user running the model - integer :: nsrest ! clm restart type - integer :: ref_ymd ! reference date (YYYYMMDD) - integer :: ref_tod ! reference time of day (sec) - integer :: start_ymd ! start date (YYYYMMDD) - integer :: start_tod ! start time of day (sec) - integer :: stop_ymd ! stop date (YYYYMMDD) - integer :: stop_tod ! stop time of day (sec) - logical :: brnch_retain_casename ! flag if should retain the case name on a branch start type - integer :: lbnum ! input to memory diagnostic - integer :: shrlogunit,shrloglev ! old values for log unit and log level - type(bounds_type) :: bounds ! bounds - character(len=32), parameter :: sub = 'lnd_init_mct' - character(len=*), parameter :: format = "('("//trim(sub)//") :',A)" - !----------------------------------------------------------------------- - - ! Set cdata data - - call seq_cdata_setptrs(cdata_l, ID=LNDID, mpicom=mpicom_lnd, & - gsMap=GSMap_lnd, dom=dom_l, infodata=infodata) - - ! Determine attriute vector indices - - call clm_cpl_indices_set() - - ! Initialize clm MPI communicator - - call spmd_init( mpicom_lnd, LNDID ) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_init_mct:start::',lbnum) - endif -#endif - - inst_name = seq_comm_name(LNDID) - inst_index = seq_comm_inst(LNDID) - inst_suffix = seq_comm_suffix(LNDID) - - ! Initialize io log unit - - call shr_file_getLogUnit (shrlogunit) - if (masterproc) then - inquire(file='lnd_modelio.nml'//trim(inst_suffix),exist=exists) - if (exists) then - iulog = shr_file_getUnit() - call shr_file_setIO('lnd_modelio.nml'//trim(inst_suffix),iulog) - end if - write(iulog,format) "CLM land model initialization" - else - iulog = shrlogunit - end if - - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) - - ! Use infodata to set orbital values - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - - ! Consistency check on namelist filename - - call control_setNL("lnd_in"//trim(inst_suffix)) - - ! Initialize clm - ! initialize1 reads namelist, grid and surface data (need this to initialize gsmap) - ! initialize2 performs rest of initialization - - call seq_timemgr_EClockGetData(EClock, & - start_ymd=start_ymd, & - start_tod=start_tod, ref_ymd=ref_ymd, & - ref_tod=ref_tod, stop_ymd=stop_ymd, & - stop_tod=stop_tod, & - calendar=calendar ) - call seq_infodata_GetData(infodata, case_name=caseid, & - case_desc=ctitle, single_column=single_column, & - scmlat=scmlat, scmlon=scmlon, & - brnch_retain_casename=brnch_retain_casename, & - start_type=starttype, model_version=version, & - hostname=hostname, username=username ) - call set_timemgr_init( calendar_in=calendar, start_ymd_in=start_ymd, start_tod_in=start_tod, & - ref_ymd_in=ref_ymd, ref_tod_in=ref_tod, stop_ymd_in=stop_ymd, & - stop_tod_in=stop_tod) - if ( trim(starttype) == trim(seq_infodata_start_type_start)) then - nsrest = nsrStartup - else if (trim(starttype) == trim(seq_infodata_start_type_cont) ) then - nsrest = nsrContinue - else if (trim(starttype) == trim(seq_infodata_start_type_brnch)) then - nsrest = nsrBranch - else - call endrun( sub//' ERROR: unknown starttype' ) - end if - - call clm_varctl_set(caseid_in=caseid, ctitle_in=ctitle, & - brnch_retain_casename_in=brnch_retain_casename, & - single_column_in=single_column, scmlat_in=scmlat, & - scmlon_in=scmlon, nsrest_in=nsrest, version_in=version, & - hostname_in=hostname, username_in=username) - - ! Read namelist, grid and surface data - - call initialize1( ) - - ! If no land then exit out of initialization - - if ( noland ) then - call seq_infodata_PutData( infodata, lnd_present =.false.) - call seq_infodata_PutData( infodata, lnd_prognostic=.false.) - return - end if - - ! Determine if aerosol and dust deposition come from atmosphere component - - call seq_infodata_GetData(infodata, atm_aero=atm_aero ) - if ( .not. atm_aero )then - call endrun( sub//' ERROR: atmosphere model MUST send aerosols to CLM' ) - end if - - ! Initialize clm gsMap, clm domain and clm attribute vectors - - call get_proc_bounds( bounds ) - - call lnd_SetgsMap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - lsize = mct_gsMap_lsize(gsMap_lnd, mpicom_lnd) - - call lnd_domain_mct( bounds, lsize, gsMap_lnd, dom_l ) - - call mct_aVect_init(x2l_l, rList=seq_flds_x2l_fields, lsize=lsize) - call mct_aVect_zero(x2l_l) - - call mct_aVect_init(l2x_l, rList=seq_flds_l2x_fields, lsize=lsize) - call mct_aVect_zero(l2x_l) - - ! Finish initializing clm - - call initialize2() - - ! Check that clm internal dtime aligns with clm coupling interval - - call seq_timemgr_EClockGetData(EClock, dtime=dtime_sync ) - dtime_clm = get_step_size() - if (masterproc) then - write(iulog,*)'dtime_sync= ',dtime_sync,& - ' dtime_clm= ',dtime_clm,' mod = ',mod(dtime_sync,dtime_clm) - end if - if (mod(dtime_sync,dtime_clm) /= 0) then - write(iulog,*)'clm dtime ',dtime_clm,' and Eclock dtime ',& - dtime_sync,' never align' - call endrun( sub//' ERROR: time out of sync' ) - end if - - ! Create land export state - - call lnd_export(bounds, clm_l2a, clm_s2x, l2x_l%rattr) - - ! Fill in infodata settings - - call seq_infodata_PutData(infodata, lnd_prognostic=.true.) - call seq_infodata_PutData(infodata, lnd_nx=ldomain%ni, lnd_ny=ldomain%nj) - - ! Get infodata info - - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - call set_nextsw_cday(nextsw_cday) - - ! Reset shr logging to original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - -#if (defined _MEMTRACE) - if(masterproc) then - write(iulog,*) TRIM(Sub) // ':end::' - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_int_mct:end::',lbnum) - call memmon_reset_addr() - endif -#endif - - end subroutine lnd_init_mct - - !==================================================================================== - - subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) - ! - ! !DESCRIPTION: - ! Run clm model - ! - ! !USES: - use shr_kind_mod ,only : r8 => shr_kind_r8 - use clmtype - use clm_atmlnd ,only : clm_l2a, clm_a2l, a2l_not_downscaled_gcell - use clm_glclnd ,only : clm_s2x, clm_x2s - use clm_driver ,only : clm_drv - use clm_time_manager,only : get_curr_date, get_nstep, get_curr_calday, get_step_size, & - advance_timestep, set_nextsw_cday,update_rad_dtime - use decompMod ,only : get_proc_bounds - use abortutils ,only : endrun - use clm_varctl ,only : iulog - use clm_varorb ,only : eccen, obliqr, lambm0, mvelpp - use shr_file_mod ,only : shr_file_setLogUnit, shr_file_setLogLevel, & - shr_file_getLogUnit, shr_file_getLogLevel - use seq_cdata_mod ,only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod ,only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn, & - seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync - use seq_infodata_mod,only : seq_infodata_type, seq_infodata_GetData - use spmdMod ,only : masterproc, mpicom - use perf_mod ,only : t_startf, t_stopf, t_barrierf - use shr_orb_mod ,only : shr_orb_decl - use ESMF - ! - ! !ARGUMENTS: - type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver - type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model - type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model - type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model - ! - ! !LOCAL VARIABLES: - integer :: ymd_sync ! Sync date (YYYYMMDD) - integer :: yr_sync ! Sync current year - integer :: mon_sync ! Sync current month - integer :: day_sync ! Sync current day - integer :: tod_sync ! Sync current time of day (sec) - integer :: ymd ! CLM current date (YYYYMMDD) - integer :: yr ! CLM current year - integer :: mon ! CLM current month - integer :: day ! CLM current day - integer :: tod ! CLM current time of day (sec) - integer :: dtime ! time step increment (sec) - integer :: nstep ! time step index - logical :: rstwr_sync ! .true. ==> write restart file before returning - logical :: rstwr ! .true. ==> write restart file before returning - logical :: nlend_sync ! Flag signaling last time-step - logical :: nlend ! .true. ==> last time-step - logical :: dosend ! true => send data back to driver - logical :: doalb ! .true. ==> do albedo calculation on this time step - real(r8) :: nextsw_cday ! calday from clock of next radiation computation - real(r8) :: caldayp1 ! clm calday plus dtime offset - integer :: shrlogunit,shrloglev ! old values for share log unit and log level - integer :: lbnum ! input to memory diagnostic - integer :: g,i,lsize ! counters - real(r8) :: calday ! calendar day for nstep - real(r8) :: declin ! solar declination angle in radians for nstep - real(r8) :: declinp1 ! solar declination angle in radians for nstep+1 - real(r8) :: eccf ! earth orbit eccentricity factor - real(r8) :: recip ! reciprical - logical,save :: first_call = .true. ! first call work - type(seq_infodata_type),pointer :: infodata ! CESM information from the driver - type(mct_gGrid), pointer :: dom_l ! Land model domain data - type(bounds_type) :: bounds ! bounds - character(len=32) :: rdate ! date char string for restart file names - character(len=32), parameter :: sub = "lnd_run_mct" - !--------------------------------------------------------------------------- - - ! Determine processor bounds - - call get_proc_bounds(bounds) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_run_mct:start::',lbnum) - endif -#endif - - ! Reset shr logging to my log file - call shr_file_getLogUnit (shrlogunit) - call shr_file_getLogLevel(shrloglev) - call shr_file_setLogUnit (iulog) - - ! Determine time of next atmospheric shortwave calculation - call seq_cdata_setptrs(cdata_l, infodata=infodata, dom=dom_l) - call seq_timemgr_EClockGetData(EClock, & - curr_ymd=ymd, curr_tod=tod_sync, & - curr_yr=yr_sync, curr_mon=mon_sync, curr_day=day_sync) - call seq_infodata_GetData(infodata, nextsw_cday=nextsw_cday ) - - call set_nextsw_cday( nextsw_cday ) - dtime = get_step_size() - - write(rdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr_sync,mon_sync,day_sync,tod_sync - nlend_sync = seq_timemgr_StopAlarmIsOn( EClock ) - rstwr_sync = seq_timemgr_RestartAlarmIsOn( EClock ) - - ! Map MCT to land data type - ! Perform downscaling if appropriate - - - ! Map to clm (only when state and/or fluxes need to be updated) - - call t_startf ('lc_lnd_import') - call lnd_import( bounds, x2l_l%rattr, clm_a2l, a2l_not_downscaled_gcell, clm_x2s) - call t_stopf ('lc_lnd_import') - - ! Use infodata to set orbital values if updated mid-run - - call seq_infodata_GetData( infodata, orb_eccen=eccen, orb_mvelpp=mvelpp, & - orb_lambm0=lambm0, orb_obliqr=obliqr ) - - ! Loop over time steps in coupling interval - - dosend = .false. - do while(.not. dosend) - - ! Determine if dosend - ! When time is not updated at the beginning of the loop - then return only if - ! are in sync with clock before time is updated - - call get_curr_date( yr, mon, day, tod ) - ymd = yr*10000 + mon*100 + day - tod = tod - dosend = (seq_timemgr_EClockDateInSync( EClock, ymd, tod)) - - ! Determine doalb based on nextsw_cday sent from atm model - - nstep = get_nstep() - caldayp1 = get_curr_calday(offset=dtime) - if (nstep == 0) then - doalb = .false. - else if (nstep == 1) then - doalb = (abs(nextsw_cday- caldayp1) < 1.e-10_r8) - else - doalb = (nextsw_cday >= -0.5_r8) - end if - call update_rad_dtime(doalb) - - ! Determine if time to write cam restart and stop - - rstwr = .false. - if (rstwr_sync .and. dosend) rstwr = .true. - nlend = .false. - if (nlend_sync .and. dosend) nlend = .true. - - ! Run clm - - call t_barrierf('sync_clm_run1', mpicom) - call t_startf ('clm_run') - call t_startf ('shr_orb_decl') - calday = get_curr_calday() - call shr_orb_decl( calday , eccen, mvelpp, lambm0, obliqr, declin , eccf ) - call shr_orb_decl( nextsw_cday, eccen, mvelpp, lambm0, obliqr, declinp1, eccf ) - call t_stopf ('shr_orb_decl') - call clm_drv(doalb, nextsw_cday, declinp1, declin, rstwr, nlend, rdate) - call t_stopf ('clm_run') - - ! Create l2x_l export state - add river runoff input to l2x_l if appropriate - - call t_startf ('lc_lnd_export') - call lnd_export(bounds, clm_l2a, clm_s2x, l2x_l%rattr) - call t_stopf ('lc_lnd_export') - - ! Advance clm time step - - call t_startf ('lc_clm2_adv_timestep') - call advance_timestep() - call t_stopf ('lc_clm2_adv_timestep') - - end do - - ! Check that internal clock is in sync with master clock - - call get_curr_date( yr, mon, day, tod, offset=-dtime ) - ymd = yr*10000 + mon*100 + day - tod = tod - if ( .not. seq_timemgr_EClockDateInSync( EClock, ymd, tod ) )then - call seq_timemgr_EclockGetData( EClock, curr_ymd=ymd_sync, curr_tod=tod_sync ) - write(iulog,*)' clm ymd=',ymd ,' clm tod= ',tod - write(iulog,*)'sync ymd=',ymd_sync,' sync tod= ',tod_sync - call endrun( sub//":: CLM clock not in sync with Master Sync clock" ) - end if - - ! Reset shr logging to my original values - - call shr_file_setLogUnit (shrlogunit) - call shr_file_setLogLevel(shrloglev) - -#if (defined _MEMTRACE) - if(masterproc) then - lbnum=1 - call memmon_dump_fort('memmon.out','lnd_run_mct:end::',lbnum) - call memmon_reset_addr() - endif -#endif - - first_call = .false. - - end subroutine lnd_run_mct - - !==================================================================================== - - subroutine lnd_final_mct( EClock, cdata_l, x2l_l, l2x_l) - ! - ! !DESCRIPTION: - ! Finalize land surface model - - use seq_cdata_mod ,only : seq_cdata, seq_cdata_setptrs - use seq_timemgr_mod ,only : seq_timemgr_EClockGetData, seq_timemgr_StopAlarmIsOn, & - seq_timemgr_RestartAlarmIsOn, seq_timemgr_EClockDateInSync - use mct_mod - use esmf - ! - ! !ARGUMENTS: - type(ESMF_Clock) , intent(inout) :: EClock ! Input synchronization clock from driver - type(seq_cdata) , intent(inout) :: cdata_l ! Input driver data for land model - type(mct_aVect) , intent(inout) :: x2l_l ! Import state to land model - type(mct_aVect) , intent(inout) :: l2x_l ! Export state from land model - !--------------------------------------------------------------------------- - - ! fill this in - end subroutine lnd_final_mct - - !==================================================================================== - - subroutine lnd_setgsmap_mct( bounds, mpicom_lnd, LNDID, gsMap_lnd ) - ! - ! !DESCRIPTION: - ! Set the MCT GS map for the land model - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use domainMod , only : ldomain - use mct_mod , only : mct_gsMap, mct_gsMap_init - implicit none - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - integer , intent(in) :: mpicom_lnd ! MPI communicator for the clm land model - integer , intent(in) :: LNDID ! Land model identifyer number - type(mct_gsMap) , intent(out) :: gsMap_lnd ! Resulting MCT GS map for the land model - ! - ! !LOCAL VARIABLES: - integer,allocatable :: gindex(:) ! Number the local grid points - integer :: i, j, n, gi ! Indices - integer :: lsize,gsize ! GS Map size - integer :: ier ! Error code - !--------------------------------------------------------------------------- - - ! Build the land grid numbering for MCT - ! NOTE: Numbering scheme is: West to East and South to North - ! starting at south pole. Should be the same as what's used in SCRIP - - allocate(gindex(bounds%begg:bounds%endg),stat=ier) - - ! number the local grid - - do n = bounds%begg, bounds%endg - gindex(n) = ldecomp%gdc2glo(n) - end do - lsize = bounds%endg - bounds%begg + 1 - gsize = ldomain%ni * ldomain%nj - - call mct_gsMap_init( gsMap_lnd, gindex, mpicom_lnd, LNDID, lsize, gsize ) - - deallocate(gindex) - - end subroutine lnd_SetgsMap_mct - - !==================================================================================== - - subroutine lnd_domain_mct( bounds, lsize, gsMap_l, dom_l ) - ! - ! !DESCRIPTION: - ! Send the land model domain information to the coupler - ! - ! !USES: - use clm_varcon , only: re - use domainMod , only: ldomain - use spmdMod , only: iam - use mct_mod , only: mct_gGrid_importIAttr - use mct_mod , only: mct_gGrid_importRAttr, mct_gGrid_init, mct_gsMap_orderedPoints - use seq_flds_mod, only: seq_flds_dom_coord, seq_flds_dom_other - ! - ! !ARGUMENTS: - type(bounds_type), intent(in) :: bounds ! bounds - integer , intent(in) :: lsize ! land model domain data size - type(mct_gsMap), intent(inout) :: gsMap_l ! Output land model MCT GS map - type(mct_ggrid), intent(out) :: dom_l ! Output domain information for land model - ! - ! Local Variables - integer :: g,i,j ! index - real(r8), pointer :: data(:) ! temporary - integer , pointer :: idata(:) ! temporary - !--------------------------------------------------------------------------- - ! - ! Initialize mct domain type - ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) - ! Note that in addition land carries around landfrac for the purposes of domain checking - ! - call mct_gGrid_init( GGrid=dom_l, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) - ! - ! Allocate memory - ! - allocate(data(lsize)) - ! - ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT - ! - call mct_gsMap_orderedPoints(gsMap_l, iam, idata) - call mct_gGrid_importIAttr(dom_l,'GlobGridNum',idata,lsize) - ! - ! Determine domain (numbering scheme is: West to East and South to North to South pole) - ! Initialize attribute vector with special value - ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_l,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_l,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_l,"mask" ,data,lsize) - ! - ! Fill in correct values for domain components - ! Note aream will be filled in in the atm-lnd mapper - ! - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%lonc(g) - end do - call mct_gGrid_importRattr(dom_l,"lon",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%latc(g) - end do - call mct_gGrid_importRattr(dom_l,"lat",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = ldomain%area(g)/(re*re) - end do - call mct_gGrid_importRattr(dom_l,"area",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%mask(g), r8) - end do - call mct_gGrid_importRattr(dom_l,"mask",data,lsize) - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - data(i) = real(ldomain%frac(g), r8) - end do - call mct_gGrid_importRattr(dom_l,"frac",data,lsize) - - deallocate(data) - deallocate(idata) - - end subroutine lnd_domain_mct - -end module lnd_comp_mct diff --git a/src_clm40/main/lnd_import_export.F90 b/src_clm40/main/lnd_import_export.F90 deleted file mode 100644 index 569e2ac51b..0000000000 --- a/src_clm40/main/lnd_import_export.F90 +++ /dev/null @@ -1,334 +0,0 @@ -module lnd_import_export - - use shr_kind_mod , only: r8 => shr_kind_r8, cl=>shr_kind_cl - use abortutils , only: endrun - use clm_atmlnd , only: lnd2atm_type - use clm_glclnd , only: lnd2glc_type - use decompmod , only: bounds_type - use clm_cpl_indices - use clmtype - implicit none - -contains - - !=============================================================================== - - subroutine lnd_import( bounds, x2l, a2l, a2l_not_downscaled_gcell, x2s) - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Convert the input data from the coupler to the land model - ! - ! !USES: - use clm_atmlnd , only: atm2lnd_type, atm2lnd_downscaled_fields_type - use clm_glclnd , only: glc2lnd_type - use clm_varctl , only: co2_type, co2_ppmv, iulog, use_c13, create_glacier_mec_landunit - use clm_varcon , only: rair, o2_molar_const, c13ratio - use shr_const_mod , only: SHR_CONST_TKFRZ - use domainMod , only: ldomain - implicit none - ! - ! !ARGUMENTS: - type(bounds_type) , intent(in) :: bounds ! bounds - real(r8) , intent(in) :: x2l(:,:) ! driver import state to land model - type(atm2lnd_type) , intent(inout) :: a2l ! clm internal input data type - type(atm2lnd_downscaled_fields_type) , intent(inout) :: a2l_not_downscaled_gcell ! clm internal input data type - type(glc2lnd_type) , intent(inout) :: x2s ! clm internal input data type - ! - ! !LOCAL VARIABLES: - integer :: g,i,nstep,ier ! indices, number of steps, and error code - real(r8) :: forc_rainc ! rainxy Atm flux mm/s - real(r8) :: e ! vapor pressure (Pa) - real(r8) :: qsat ! saturation specific humidity (kg/kg) - real(r8) :: forc_t ! atmospheric temperature (Kelvin) - real(r8) :: forc_q ! atmospheric specific humidity (kg/kg) - real(r8) :: forc_pbot ! atmospheric pressure (Pa) - real(r8) :: forc_rainl ! rainxy Atm flux mm/s - real(r8) :: forc_snowc ! snowfxy Atm flux mm/s - real(r8) :: forc_snowl ! snowfxl Atm flux mm/s - real(r8) :: co2_ppmv_diag ! temporary - real(r8) :: co2_ppmv_prog ! temporary - real(r8) :: co2_ppmv_val ! temporary - integer :: co2_type_idx ! integer flag for co2_type options - real(r8) :: esatw ! saturation vapor pressure over water (Pa) - real(r8) :: esati ! saturation vapor pressure over ice (Pa) - real(r8) :: a0,a1,a2,a3,a4,a5,a6 ! coefficients for esat over water - real(r8) :: b0,b1,b2,b3,b4,b5,b6 ! coefficients for esat over ice - real(r8) :: tdc, t ! Kelvins to Celcius function and its input - integer :: num ! counter - character(len=32), parameter :: sub = 'lnd_import_mct' - - ! Constants to compute vapor pressure - parameter (a0=6.107799961_r8 , a1=4.436518521e-01_r8, & - a2=1.428945805e-02_r8, a3=2.650648471e-04_r8, & - a4=3.031240396e-06_r8, a5=2.034080948e-08_r8, & - a6=6.136820929e-11_r8) - - parameter (b0=6.109177956_r8 , b1=5.034698970e-01_r8, & - b2=1.886013408e-02_r8, b3=4.176223716e-04_r8, & - b4=5.824720280e-06_r8, b5=4.838803174e-08_r8, & - b6=1.838826904e-10_r8) - ! - ! function declarations - ! - tdc(t) = min( 50._r8, max(-50._r8,(t-SHR_CONST_TKFRZ)) ) - esatw(t) = 100._r8*(a0+t*(a1+t*(a2+t*(a3+t*(a4+t*(a5+t*a6)))))) - esati(t) = 100._r8*(b0+t*(b1+t*(b2+t*(b3+t*(b4+t*(b5+t*b6)))))) - !--------------------------------------------------------------------------- - - co2_type_idx = 0 - if (co2_type == 'prognostic') then - co2_type_idx = 1 - else if (co2_type == 'diagnostic') then - co2_type_idx = 2 - end if - if (co2_type == 'prognostic' .and. index_x2l_Sa_co2prog == 0) then - call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2prog for co2_type equal to prognostic' ) - else if (co2_type == 'diagnostic' .and. index_x2l_Sa_co2diag == 0) then - call endrun( sub//' ERROR: must have nonzero index_x2l_Sa_co2diag for co2_type equal to diagnostic' ) - end if - - ! Note that the precipitation fluxes received from the coupler - ! are in units of kg/s/m^2. To convert these precipitation rates - ! in units of mm/sec, one must divide by 1000 kg/m^3 and multiply - ! by 1000 mm/m resulting in an overall factor of unity. - ! Below the units are therefore given in mm/s. - - - do g = bounds%begg,bounds%endg - i = 1 + (g - bounds%begg) - - ! Determine flooding input, sign convention is positive downward and - ! hierarchy is atm/glc/lnd/rof/ice/ocn. so water sent from rof to land is negative, - ! change the sign to indicate addition of water to system. - - a2l%forc_flood(g) = -x2l(index_x2l_Flrr_flood,i) - - a2l%volr(g) = x2l(index_x2l_Flrr_volr,i) * (ldomain%area(g) * 1.e6_r8) - a2l%volrmch(g)= x2l(index_x2l_Flrr_volrmch,i) * (ldomain%area(g) * 1.e6_r8) - - ! Determine required receive fields - - a2l%forc_hgt(g) = x2l(index_x2l_Sa_z,i) ! zgcmxy Atm state m - a2l%forc_u(g) = x2l(index_x2l_Sa_u,i) ! forc_uxy Atm state m/s - a2l%forc_v(g) = x2l(index_x2l_Sa_v,i) ! forc_vxy Atm state m/s - a2l%forc_solad(g,2) = x2l(index_x2l_Faxa_swndr,i) ! forc_sollxy Atm flux W/m^2 - a2l%forc_solad(g,1) = x2l(index_x2l_Faxa_swvdr,i) ! forc_solsxy Atm flux W/m^2 - a2l%forc_solai(g,2) = x2l(index_x2l_Faxa_swndf,i) ! forc_solldxy Atm flux W/m^2 - a2l%forc_solai(g,1) = x2l(index_x2l_Faxa_swvdf,i) ! forc_solsdxy Atm flux W/m^2 - - a2l_not_downscaled_gcell%forc_th(g) = x2l(index_x2l_Sa_ptem,i) ! forc_thxy Atm state K - a2l_not_downscaled_gcell%forc_q(g) = x2l(index_x2l_Sa_shum,i) ! forc_qxy Atm state kg/kg - a2l_not_downscaled_gcell%forc_pbot(g) = x2l(index_x2l_Sa_pbot,i) ! ptcmxy Atm state Pa - a2l_not_downscaled_gcell%forc_t(g) = x2l(index_x2l_Sa_tbot,i) ! forc_txy Atm state K - a2l_not_downscaled_gcell%forc_lwrad(g) = x2l(index_x2l_Faxa_lwdn,i) ! flwdsxy Atm flux W/m^2 - - forc_rainc = x2l(index_x2l_Faxa_rainc,i) ! mm/s - forc_rainl = x2l(index_x2l_Faxa_rainl,i) ! mm/s - forc_snowc = x2l(index_x2l_Faxa_snowc,i) ! mm/s - forc_snowl = x2l(index_x2l_Faxa_snowl,i) ! mm/s - - ! atmosphere coupling, for prognostic/prescribed aerosols - a2l%forc_aer(g,1) = x2l(index_x2l_Faxa_bcphidry,i) - a2l%forc_aer(g,2) = x2l(index_x2l_Faxa_bcphodry,i) - a2l%forc_aer(g,3) = x2l(index_x2l_Faxa_bcphiwet,i) - a2l%forc_aer(g,4) = x2l(index_x2l_Faxa_ocphidry,i) - a2l%forc_aer(g,5) = x2l(index_x2l_Faxa_ocphodry,i) - a2l%forc_aer(g,6) = x2l(index_x2l_Faxa_ocphiwet,i) - a2l%forc_aer(g,7) = x2l(index_x2l_Faxa_dstwet1,i) - a2l%forc_aer(g,8) = x2l(index_x2l_Faxa_dstdry1,i) - a2l%forc_aer(g,9) = x2l(index_x2l_Faxa_dstwet2,i) - a2l%forc_aer(g,10) = x2l(index_x2l_Faxa_dstdry2,i) - a2l%forc_aer(g,11) = x2l(index_x2l_Faxa_dstwet3,i) - a2l%forc_aer(g,12) = x2l(index_x2l_Faxa_dstdry3,i) - a2l%forc_aer(g,13) = x2l(index_x2l_Faxa_dstwet4,i) - a2l%forc_aer(g,14) = x2l(index_x2l_Faxa_dstdry4,i) - - ! Determine optional receive fields - - if (index_x2l_Sa_co2prog /= 0) then - co2_ppmv_prog = x2l(index_x2l_Sa_co2prog,i) ! co2 atm state prognostic - else - co2_ppmv_prog = co2_ppmv - end if - - if (index_x2l_Sa_co2diag /= 0) then - co2_ppmv_diag = x2l(index_x2l_Sa_co2diag,i) ! co2 atm state diagnostic - else - co2_ppmv_diag = co2_ppmv - end if - - if (index_x2l_Sa_methane /= 0) then - a2l%forc_pch4(g) = x2l(index_x2l_Sa_methane,i) - endif - - ! Determine derived quantities for required fields - - forc_t = a2l_not_downscaled_gcell%forc_t(g) - forc_q = a2l_not_downscaled_gcell%forc_q(g) - forc_pbot = a2l_not_downscaled_gcell%forc_pbot(g) - - a2l%forc_hgt_u(g) = a2l%forc_hgt(g) !observational height of wind [m] - a2l%forc_hgt_t(g) = a2l%forc_hgt(g) !observational height of temperature [m] - a2l%forc_hgt_q(g) = a2l%forc_hgt(g) !observational height of humidity [m] - a2l%forc_vp(g) = forc_q * forc_pbot & - / (0.622_r8 + 0.378_r8 * forc_q) - a2l_not_downscaled_gcell%forc_rho(g) = (forc_pbot - 0.378_r8 * a2l%forc_vp(g)) & - / (rair * forc_t) - a2l%forc_po2(g) = o2_molar_const * forc_pbot - a2l%forc_wind(g) = sqrt(a2l%forc_u(g)**2 + a2l%forc_v(g)**2) - a2l%forc_solar(g) = a2l%forc_solad(g,1) + a2l%forc_solai(g,1) + & - a2l%forc_solad(g,2) + a2l%forc_solai(g,2) - - a2l_not_downscaled_gcell%forc_rain(g) = forc_rainc + forc_rainl - a2l_not_downscaled_gcell%forc_snow(g) = forc_snowc + forc_snowl - - if (forc_t > SHR_CONST_TKFRZ) then - e = esatw(tdc(forc_t)) - else - e = esati(tdc(forc_t)) - end if - qsat = 0.622_r8*e / (forc_pbot - 0.378_r8*e) - a2l%forc_rh(g) = 100.0_r8*(forc_q / qsat) - ! Make sure relative humidity is properly bounded - ! a2l%forc_rh(g) = min( 100.0_r8, a2l%forc_rh(g) ) - ! a2l%forc_rh(g) = max( 0.0_r8, a2l%forc_rh(g) ) - - ! Determine derived quantities for optional fields - ! Note that the following does unit conversions from ppmv to partial pressures (Pa) - ! Note that forc_pbot is in Pa - - if (co2_type_idx == 1) then - co2_ppmv_val = co2_ppmv_prog - else if (co2_type_idx == 2) then - co2_ppmv_val = co2_ppmv_diag - else - co2_ppmv_val = co2_ppmv - end if - a2l%forc_pco2(g) = co2_ppmv_val * 1.e-6_r8 * forc_pbot - if (use_c13) then - a2l%forc_pc13o2(g) = co2_ppmv_val * c13ratio * 1.e-6_r8 * forc_pbot - end if - - ! glc coupling - - if (create_glacier_mec_landunit) then - do num = 0,glc_nec - x2s%frac(g,num) = x2l(index_x2l_Sg_ice_covered(num),i) - x2s%topo(g,num) = x2l(index_x2l_Sg_topo(num),i) - x2s%hflx(g,num) = x2l(index_x2l_Flgg_hflx(num),i) - end do - x2s%icemask(g) = x2l(index_x2l_Sg_icemask,i) - end if - - end do - - end subroutine lnd_import - - !=============================================================================== - - subroutine lnd_export( bounds, clm_l2a, clm_s2x, l2x) - - !--------------------------------------------------------------------------- - ! !DESCRIPTION: - ! Convert the data to be sent from the clm model to the coupler - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : iulog, create_glacier_mec_landunit - use clm_time_manager , only : get_nstep, get_step_size - use seq_drydep_mod , only : n_drydep - use shr_megan_mod , only : shr_megan_mechcomps_n - ! - ! !ARGUMENTS: - implicit none - type(bounds_type) , intent(in) :: bounds ! bounds - type(lnd2atm_type), intent(inout) :: clm_l2a ! clm land to atmosphere exchange data type - type(lnd2glc_type), intent(inout) :: clm_s2x ! clm land to atmosphere exchange data type - real(r8) , intent(out) :: l2x(:,:)! land to coupler export state on land grid - ! - ! !LOCAL VARIABLES: - integer :: g,i ! indices - integer :: ier ! error status - integer :: nstep ! time step index - integer :: dtime ! time step - integer :: num ! counter - !--------------------------------------------------------------------------- - - ! cesm sign convention is that fluxes are positive downward - - l2x(:,:) = 0.0_r8 - - do g = bounds%begg,bounds%endg - i = 1 + (g-bounds%begg) - l2x(index_l2x_Sl_t,i) = clm_l2a%t_rad(g) - l2x(index_l2x_Sl_snowh,i) = clm_l2a%h2osno(g) - l2x(index_l2x_Sl_avsdr,i) = clm_l2a%albd(g,1) - l2x(index_l2x_Sl_anidr,i) = clm_l2a%albd(g,2) - l2x(index_l2x_Sl_avsdf,i) = clm_l2a%albi(g,1) - l2x(index_l2x_Sl_anidf,i) = clm_l2a%albi(g,2) - l2x(index_l2x_Sl_tref,i) = clm_l2a%t_ref2m(g) - l2x(index_l2x_Sl_qref,i) = clm_l2a%q_ref2m(g) - l2x(index_l2x_Sl_u10,i) = clm_l2a%u_ref10m(g) - l2x(index_l2x_Fall_taux,i) = -clm_l2a%taux(g) - l2x(index_l2x_Fall_tauy,i) = -clm_l2a%tauy(g) - l2x(index_l2x_Fall_lat,i) = -clm_l2a%eflx_lh_tot(g) - l2x(index_l2x_Fall_sen,i) = -clm_l2a%eflx_sh_tot(g) - l2x(index_l2x_Fall_lwup,i) = -clm_l2a%eflx_lwrad_out(g) - l2x(index_l2x_Fall_evap,i) = -clm_l2a%qflx_evap_tot(g) - l2x(index_l2x_Fall_swnet,i) = clm_l2a%fsa(g) - if (index_l2x_Fall_fco2_lnd /= 0) then - l2x(index_l2x_Fall_fco2_lnd,i) = -clm_l2a%nee(g) - end if - - ! Additional fields for DUST, PROGSSLT, dry-deposition and VOC - ! These are now standard fields, but the check on the index makes sure the driver handles them - if (index_l2x_Sl_ram1 /= 0 ) l2x(index_l2x_Sl_ram1,i) = clm_l2a%ram1(g) - if (index_l2x_Sl_fv /= 0 ) l2x(index_l2x_Sl_fv,i) = clm_l2a%fv(g) - if (index_l2x_Sl_soilw /= 0 ) l2x(index_l2x_Sl_soilw,i) = clm_l2a%h2osoi_vol(g,1) - if (index_l2x_Fall_flxdst1 /= 0 ) l2x(index_l2x_Fall_flxdst1,i)= -clm_l2a%flxdst(g,1) - if (index_l2x_Fall_flxdst2 /= 0 ) l2x(index_l2x_Fall_flxdst2,i)= -clm_l2a%flxdst(g,2) - if (index_l2x_Fall_flxdst3 /= 0 ) l2x(index_l2x_Fall_flxdst3,i)= -clm_l2a%flxdst(g,3) - if (index_l2x_Fall_flxdst4 /= 0 ) l2x(index_l2x_Fall_flxdst4,i)= -clm_l2a%flxdst(g,4) - - - ! for dry dep velocities - if (index_l2x_Sl_ddvel /= 0 ) then - l2x(index_l2x_Sl_ddvel:index_l2x_Sl_ddvel+n_drydep-1,i) = & - clm_l2a%ddvel(g,:n_drydep) - end if - - ! for MEGAN VOC emis fluxes - if (index_l2x_Fall_flxvoc /= 0 ) then - l2x(index_l2x_Fall_flxvoc:index_l2x_Fall_flxvoc+shr_megan_mechcomps_n-1,i) = & - -clm_l2a%flxvoc(g,:shr_megan_mechcomps_n) - end if - - if (index_l2x_Fall_methane /= 0) then - l2x(index_l2x_Fall_methane,i) = -clm_l2a%flux_ch4(g) - endif - - ! sign convention is positive downward with - ! hierarchy of atm/glc/lnd/rof/ice/ocn. so water sent from land to rof is positive - - l2x(index_l2x_Flrl_rofsur,i) = clm_l2a%rofliq(g) - l2x(index_l2x_Flrl_rofgwl,i) = 0.0_r8 - l2x(index_l2x_Flrl_rofsub,i) = 0.0_r8 - l2x(index_l2x_Flrl_rofdto,i) = 0.0_r8 - l2x(index_l2x_Flrl_rofi,i) = clm_l2a%rofice(g) - - ! glc coupling - - if (create_glacier_mec_landunit) then - do num = 0,glc_nec - l2x(index_l2x_Sl_tsrf(num),i) = clm_s2x%tsrf(g,num) - l2x(index_l2x_Sl_topo(num),i) = clm_s2x%topo(g,num) - l2x(index_l2x_Flgl_qice(num),i) = clm_s2x%qice(g,num) - end do - end if - - end do - - end subroutine lnd_export - -end module lnd_import_export diff --git a/src_clm40/main/mkarbinitMod.F90 b/src_clm40/main/mkarbinitMod.F90 deleted file mode 100644 index 6df966a2b9..0000000000 --- a/src_clm40/main/mkarbinitMod.F90 +++ /dev/null @@ -1,762 +0,0 @@ -module mkarbinitMod -!--------------------------------------------------------------------------- -!BOP -! -! !MODULE: mkarbinitMod -! -! !DESCRIPTION: -! -! -!--------------------------------------------------------------------------- - -! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8 - use clm_varctl , only : iulog, use_cn, use_cndv, & - use_vancouver, use_mexicocity - use shr_sys_mod , only : shr_sys_flush - use spmdMod , only : masterproc - - implicit none - - SAVE - private ! By default make data private - -! !PUBLIC MEMBER FUNCTIONS: - - public mkarbinit ! Make arbitrary initial conditions - -!EOP -!----------------------------------------------------------------------- -contains -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: mkarbinit -! -! !INTERFACE: - subroutine mkarbinit() -! -! !DESCRIPTION: -! Initializes the following time varying variables: -! water : h2osno, h2ocan, h2osoi_liq, h2osoi_ice, h2osoi_vol -! snow : snowdp, snl, dz, z, zi -! temperature: t_soisno, t_veg, t_grnd -! -! !USES: - use shr_const_mod, only : SHR_CONST_TKFRZ - use clmtype - use clm_varpar , only : nlevsoi, nlevgrnd, nlevsno, nlevlak, nlevurb - use clm_varcon , only : bdsno, istice, istwet, istsoil, isturb, & - denice, denh2o, spval, sb, icol_road_perv, & - icol_road_imperv, icol_roof, icol_sunwall, & - icol_shadewall - use clm_varcon , only : istcrop - use clm_varcon , only : istice_mec, h2osno_max - use clm_varctl , only : iulog - use spmdMod , only : masterproc - use decompMod , only : get_proc_bounds - use SNICARMod , only : snw_rds_min - -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! 3/07/08 Keith Oleson: initialize h2osoi_vol for all soil layers to 0.3 -! 3/18/08 David Lawrence, initialize deep layers -! 03/28/08 Mark Flanner, initialize snow aerosols and grain size -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: pcolumn(:) ! column index associated with each pft - integer , pointer :: ctype(:) ! column type - integer , pointer :: clandunit(:) ! landunit index associated with each column - integer , pointer :: ltype(:) ! landunit type - logical , pointer :: lakpoi(:) ! true => landunit is a lake point - integer , pointer :: plandunit(:) ! landunit index associated with each pft - logical , pointer :: urbpoi(:) ! true => landunit is an urban point - logical , pointer :: ifspecial(:) ! true => landunit is not vegetated - real(r8), pointer :: dz(:,:) ! layer thickness depth (m) - real(r8), pointer :: watsat(:,:) ! volumetric soil water at saturation (porosity) (nlevgrnd) - real(r8), pointer :: h2osoi_ice(:,:) ! ice lens (kg/m2) - real(r8), pointer :: h2osoi_liq(:,:) ! liquid water (kg/m2) - real(r8), pointer :: bsw2(:,:) ! Clapp and Hornberger "b" for CN code - real(r8), pointer :: psisat(:,:) ! soil water potential at saturation for CN code (MPa) - real(r8), pointer :: vwcsat(:,:) ! volumetric water content at saturation for CN code (m3/m3) - real(r8), pointer :: zi(:,:) ! interface level below a "z" level (m) - real(r8), pointer :: wa(:) ! water in the unconfined aquifer (mm) - real(r8), pointer :: wt(:) ! total water storage (unsaturated soil water + groundwater) (mm) - real(r8), pointer :: zwt(:) ! water table depth (m) - real(r8), pointer :: qflx_snow_melt(:) ! snow melt (net) -! -! local pointers to implicit out arguments -! - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: t_soisno(:,:) ! soil temperature (Kelvin) (-nlevsno+1:nlevgrnd) - real(r8), pointer :: t_lake(:,:) ! lake temperature (Kelvin) (1:nlevlak) - real(r8), pointer :: t_grnd(:) ! ground temperature (Kelvin) - real(r8), pointer :: t_veg(:) ! vegetation temperature (Kelvin) - real(r8), pointer :: t_ref2m(:) ! 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_u(:) ! Urban 2 m height surface air temperature (Kelvin) - real(r8), pointer :: t_ref2m_r(:) ! Rural 2 m height surface air temperature (Kelvin) - real(r8), pointer :: h2osoi_vol(:,:) ! volumetric soil water (0<=h2osoi_vol<=watsat) [m3/m3] - real(r8), pointer :: h2ocan_col(:) ! canopy water (mm H2O) (column-level) - real(r8), pointer :: h2ocan_pft(:) ! canopy water (mm H2O) (pft-level) - real(r8), pointer :: h2osno(:) ! snow water (mm H2O) - real(r8), pointer :: snowdp(:) ! snow height (m) - real(r8), pointer :: qflx_irrig(:) ! irrigation flux (mm H2O/s) - real(r8), pointer :: eflx_lwrad_out(:) ! emitted infrared (longwave) radiation (W/m**2) - real(r8), pointer :: soilpsi(:,:) ! soil water potential in each soil layer (MPa) - real(r8), pointer :: snw_rds(:,:) ! effective snow grain radius (col,lyr) [microns, m^-6] - real(r8), pointer :: snw_rds_top(:) ! snow grain size, top (col) [microns] - real(r8), pointer :: sno_liq_top(:) ! liquid water fraction (mass) in top snow layer (col) [frc] - real(r8), pointer :: mss_bcpho(:,:) ! mass of hydrophobic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bcphi(:,:) ! mass of hydrophillic BC in snow (col,lyr) [kg] - real(r8), pointer :: mss_bctot(:,:) ! total mass of BC (pho+phi) (col,lyr) [kg] - real(r8), pointer :: mss_bc_col(:) ! total mass of BC in snow column (col) [kg] - real(r8), pointer :: mss_bc_top(:) ! total mass of BC in top snow layer (col) [kg] - real(r8), pointer :: mss_cnc_bcphi(:,:) ! mass concentration of BC species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_bcpho(:,:) ! mass concentration of BC species 2 (col,lyr) [kg/kg] - real(r8), pointer :: mss_ocpho(:,:) ! mass of hydrophobic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_ocphi(:,:) ! mass of hydrophillic OC in snow (col,lyr) [kg] - real(r8), pointer :: mss_octot(:,:) ! total mass of OC (pho+phi) (col,lyr) [kg] - real(r8), pointer :: mss_oc_col(:) ! total mass of OC in snow column (col) [kg] - real(r8), pointer :: mss_oc_top(:) ! total mass of OC in top snow layer (col) [kg] - real(r8), pointer :: mss_cnc_ocphi(:,:) ! mass concentration of OC species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_ocpho(:,:) ! mass concentration of OC species 2 (col,lyr) [kg/kg] - real(r8), pointer :: mss_dst1(:,:) ! mass of dust species 1 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst2(:,:) ! mass of dust species 2 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst3(:,:) ! mass of dust species 3 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst4(:,:) ! mass of dust species 4 in snow (col,lyr) [kg] - real(r8), pointer :: mss_dsttot(:,:) ! total mass of dust in snow (col,lyr) [kg] - real(r8), pointer :: mss_dst_col(:) ! total mass of dust in snow column (col) [kg] - real(r8), pointer :: mss_dst_top(:) ! total mass of dust in top snow layer (col) [kg] - real(r8), pointer :: mss_cnc_dst1(:,:) ! mass concentration of dust species 1 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst2(:,:) ! mass concentration of dust species 2 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst3(:,:) ! mass concentration of dust species 3 (col,lyr) [kg/kg] - real(r8), pointer :: mss_cnc_dst4(:,:) ! mass concentration of dust species 4 (col,lyr) [kg/kg] - real(r8), pointer :: irrig_rate(:) ! current irrigation rate [mm/s] - integer, pointer :: n_irrig_steps_left(:) ! number of time steps for which we still need to irrigate today (if 0, ignore irrig_rate) - -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: j,l,c,p ! indices - integer :: nlevs ! number of levels - integer :: begp, endp ! per-proc beginning and ending pft indices - integer :: begc, endc ! per-proc beginning and ending column indices - integer :: begl, endl ! per-proc beginning and ending landunit indices - integer :: begg, endg ! per-proc gridcell ending gridcell indices - real(r8):: vwc,psi ! for calculating soilpsi -!----------------------------------------------------------------------- - - if ( masterproc )then - write(iulog,*) 'Setting initial data to non-spun up values' - end if - - ! Assign local pointers to derived subtypes components (landunit-level) - - ltype => lun%itype - lakpoi => lun%lakpoi - ifspecial => lun%ifspecial - urbpoi => lun%urbpoi - - ! Assign local pointers to derived subtypes components (column-level) - - ctype => col%itype - clandunit => col%landunit - snl => cps%snl - dz => cps%dz - watsat => cps%watsat - bsw2 => cps%bsw2 - vwcsat => cps%vwcsat - psisat => cps%psisat - soilpsi => cps%soilpsi - h2osoi_ice => cws%h2osoi_ice - h2osoi_liq => cws%h2osoi_liq - h2osoi_vol => cws%h2osoi_vol - h2ocan_col => pws_a%h2ocan - qflx_irrig => cwf%qflx_irrig - qflx_snow_melt => cwf%qflx_snow_melt - snowdp => cps%snowdp - h2osno => cws%h2osno - t_soisno => ces%t_soisno - t_lake => ces%t_lake - t_grnd => ces%t_grnd - zi => cps%zi - wa => cws%wa - wt => cws%wt - zwt => cws%zwt - snw_rds => cps%snw_rds - snw_rds_top => cps%snw_rds_top - sno_liq_top => cps%sno_liq_top - mss_bcpho => cps%mss_bcpho - mss_bcphi => cps%mss_bcphi - mss_bctot => cps%mss_bctot - mss_bc_col => cps%mss_bc_col - mss_bc_top => cps%mss_bc_top - mss_cnc_bcphi => cps%mss_cnc_bcphi - mss_cnc_bcpho => cps%mss_cnc_bcpho - mss_ocpho => cps%mss_ocpho - mss_ocphi => cps%mss_ocphi - mss_octot => cps%mss_octot - mss_oc_col => cps%mss_oc_col - mss_oc_top => cps%mss_oc_top - mss_cnc_ocphi => cps%mss_cnc_ocphi - mss_cnc_ocpho => cps%mss_cnc_ocpho - mss_dst1 => cps%mss_dst1 - mss_dst2 => cps%mss_dst2 - mss_dst3 => cps%mss_dst3 - mss_dst4 => cps%mss_dst4 - mss_dsttot => cps%mss_dsttot - mss_dst_col => cps%mss_dst_col - mss_dst_top => cps%mss_dst_top - mss_cnc_dst1 => cps%mss_cnc_dst1 - mss_cnc_dst2 => cps%mss_cnc_dst2 - mss_cnc_dst3 => cps%mss_cnc_dst3 - mss_cnc_dst4 => cps%mss_cnc_dst4 - n_irrig_steps_left => cps%n_irrig_steps_left - irrig_rate => cps%irrig_rate - - ! Assign local pointers to derived subtypes components (pft-level) - - pcolumn => pft%column - h2ocan_pft => pws%h2ocan - t_veg => pes%t_veg - t_ref2m => pes%t_ref2m - t_ref2m_u => pes%t_ref2m_u - t_ref2m_r => pes%t_ref2m_r - plandunit => pft%landunit - eflx_lwrad_out => pef%eflx_lwrad_out - - ! Determine subgrid bounds on this processor - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! NOTE: h2ocan, h2osno, and snowdp has valid values everywhere - ! canopy water (pft level) - - do p = begp, endp - h2ocan_pft(p) = 0._r8 - - ! added for canopy water mass balance under dynamic pft weights - !pps%tlai(p) = 0._r8 - !pps%tsai(p) = 0._r8 - !pps%elai(p) = 0._r8 - !pps%esai(p) = 0._r8 - !pps%htop(p) = 0._r8 - !pps%hbot(p) = 0._r8 - !pps%frac_veg_nosno_alb(p) = 0._r8 - end do - - do c = begc,endc - - ! canopy water (column level) - - h2ocan_col(c) = 0._r8 - qflx_snow_melt(c) = 0._r8 - - ! snow water - - l = clandunit(c) - - ! Note: Glacier_mec columns are initialized with half the maximum snow cover. - ! This gives more realistic values of qflx_glcice sooner in the simulation - ! for columns with net ablation, at the cost of delaying ice formation - ! in columns with net accumulation. - if (ltype(l)==istice) then - h2osno(c) = h2osno_max - elseif (ltype(l)==istice_mec) then - h2osno(c) = 0.5_r8 * h2osno_max ! 50 cm if h2osno_max = 1 m - else - h2osno(c) = 0._r8 - endif - - ! snow depth - - snowdp(c) = h2osno(c) / bdsno - - ! Initialize Irrigation to zero - if (ltype(l)==istsoil) then - n_irrig_steps_left(c) = 0 - irrig_rate(c) = 0.0_r8 - end if - - end do - - ! Set snow layer number, depth and thickiness - - call snowdp2lev(begc, endc) - - ! Set snow/soil temperature, note: - ! t_soisno only has valid values over non-lake - ! t_lake only has valid values over lake - ! t_grnd has valid values over all land - ! t_veg has valid values over all land - - ! NOTE: THESE MEMORY COPIES ARE INEFFICIENT -- SINCE nlev LOOP IS NESTED FIRST!!!! - do c = begc,endc - - t_soisno(c,-nlevsno+1:nlevgrnd) = spval - t_lake(c,1:nlevlak) = spval - - l = clandunit(c) - if (.not. lakpoi(l)) then !not lake - t_soisno(c,-nlevsno+1:0) = spval - if (snl(c) < 0) then !snow layer temperatures - do j = snl(c)+1, 0 - t_soisno(c,j) = 250._r8 - enddo - endif - if (ltype(l)==istice .or. ltype(l)==istice_mec) then - do j = 1, nlevgrnd - t_soisno(c,j) = 250._r8 - - end do - else if (ltype(l) == istwet) then - do j = 1, nlevgrnd - t_soisno(c,j) = 277._r8 - end do - else if (ltype(l) == isturb) then - if (use_vancouver) then - if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - ! Set road top layer to initial air temperature and interpolate other - ! layers down to 20C in bottom layer - do j = 1, nlevurb - t_soisno(c,j) = 297.56 - (j-1) * ((297.56-293.16)/(nlevurb-1)) - end do - ! Set wall and roof layers to initial air temperature - else if (ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall .or. ctype(c) == icol_roof) then - do j = 1, nlevurb - t_soisno(c,j) = 297.56 - end do - else - do j = 1, nlevurb - t_soisno(c,j) = 283._r8 - end do - end if - else if (use_mexicocity) then - if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - ! Set road top layer to initial air temperature and interpolate other - ! layers down to 22C in bottom layer - do j = 1, nlevurb - t_soisno(c,j) = 289.46 - (j-1) * ((289.46-295.16)/(nlevurb-1)) - end do - else if (ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall .or. ctype(c) == icol_roof) then - ! Set wall and roof layers to initial air temperature - do j = 1, nlevurb - t_soisno(c,j) = 289.46 - end do - else - do j = 1, nlevurb - t_soisno(c,j) = 283._r8 - end do - end if - else - if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - do j = 1, nlevurb - t_soisno(c,j) = 274._r8 - end do - else if (ctype(c) == icol_sunwall .or. ctype(c) == icol_shadewall .or. ctype(c) == icol_roof) then - ! Set sunwall, shadewall, roof to fairly high temperature to avoid initialization - ! shock from large heating/air conditioning flux - do j = 1, nlevurb - t_soisno(c,j) = 292._r8 - end do - end if - end if - else - do j = 1, nlevgrnd - t_soisno(c,j) = 274._r8 - end do - endif - t_grnd(c) = t_soisno(c,snl(c)+1) - else !lake - t_lake(c,1:nlevlak) = 277._r8 - t_grnd(c) = t_lake(c,1) - endif - - end do - - do p = begp, endp - c = pcolumn(p) - l = plandunit(p) - - ! Initialize Irrigation to zero - if (ltype(l)==istsoil) then - qflx_irrig(c) = 0.0_r8 - end if - - if (use_vancouver) then - t_veg(p) = 297.56 - t_ref2m(p) = 297.56 - if (urbpoi(l)) then - t_ref2m_u(p) = 297.56 - else - t_ref2m_u(p) = spval - end if - if (ifspecial(l)) then - t_ref2m_r(p) = spval - else - t_ref2m_r(p) = 297.56 - end if - else if (use_mexicocity) then - t_veg(p) = 289.46 - t_ref2m(p) = 289.46 - if (urbpoi(l)) then - t_ref2m_u(p) = 289.46 - else - t_ref2m_u(p) = spval - end if - if (ifspecial(l)) then - t_ref2m_r(p) = spval - else - t_ref2m_r(p) = 289.46 - end if - else - t_veg(p) = 283._r8 - t_ref2m(p) = 283._r8 - if (urbpoi(l)) then - t_ref2m_u(p) = 283._r8 - else - t_ref2m_u(p) = spval - end if - if (ifspecial(l)) then - t_ref2m_r(p) = spval - else - t_ref2m_r(p) = 283._r8 - end if - end if - eflx_lwrad_out(p) = sb * (t_grnd(c))**4 - end do - - ! Set snow/soil ice and liquid mass - - ! volumetric water is set first and liquid content and ice lens are obtained - ! NOTE: h2osoi_vol, h2osoi_liq and h2osoi_ice only have valid values over soil - ! and urban pervious road (other urban columns have zero soil water) - - h2osoi_vol(begc:endc, 1:) = spval - h2osoi_liq(begc:endc,-nlevsno+1:) = spval - h2osoi_ice(begc:endc,-nlevsno+1:) = spval - - wa(begc:endc) = 5000._r8 - wt(begc:endc) = 5000._r8 - zwt(begc:endc) = 0._r8 - - do c = begc,endc - l = clandunit(c) - if (.not. lakpoi(l)) then !not lake - if (ltype(l) == isturb) then - if (ctype(c) == icol_road_perv) then - wa(c) = 4800._r8 - wt(c) = wa(c) - zwt(c) = (25._r8 + zi(c,nlevsoi)) - wa(c)/0.2_r8 /1000._r8 ! One meter below soil column - else - wa(c) = spval - wt(c) = spval - zwt(c) = spval - end if - else - wa(c) = 4800._r8 - wt(c) = wa(c) - zwt(c) = (25._r8 + zi(c,nlevsoi)) - wa(c)/0.2_r8 /1000._r8 ! One meter below soil column - end if - end if - end do - - do c = begc,endc - l = clandunit(c) - if (.not. lakpoi(l)) then !not lake - - ! volumetric water - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - nlevs = nlevgrnd - do j = 1, nlevs - if (j > nlevsoi) then - h2osoi_vol(c,j) = 0.0_r8 - else - h2osoi_vol(c,j) = 0.3_r8 - endif - end do - else if (ltype(l) == isturb) then - nlevs = nlevurb - do j = 1, nlevs - if (ctype(c) == icol_road_perv .and. j <= nlevsoi) then - h2osoi_vol(c,j) = 0.3_r8 - else - h2osoi_vol(c,j) = 0.0_r8 - end if - end do - else if (ltype(l) == istwet) then - nlevs = nlevgrnd - do j = 1, nlevs - if (j > nlevsoi) then - h2osoi_vol(c,j) = 0.0_r8 - else - h2osoi_vol(c,j) = 1.0_r8 - endif - end do - else if (ltype(l) == istice .or. ltype(l) == istice_mec) then - nlevs = nlevgrnd - do j = 1, nlevs - h2osoi_vol(c,j) = 1.0_r8 - end do - endif - do j = 1, nlevs - h2osoi_vol(c,j) = min(h2osoi_vol(c,j),watsat(c,j)) - - ! soil layers - if (t_soisno(c,j) <= SHR_CONST_TKFRZ) then - h2osoi_ice(c,j) = dz(c,j)*denice*h2osoi_vol(c,j) - h2osoi_liq(c,j) = 0._r8 - else - h2osoi_ice(c,j) = 0._r8 - h2osoi_liq(c,j) = dz(c,j)*denh2o*h2osoi_vol(c,j) - endif - end do - - if (use_cn) then - ! soil water potential (added 10/21/03, PET) - ! required for CN code - if (ltype(l) == istsoil .or. ltype(l) == istcrop) then - nlevs = nlevgrnd - do j = 1, nlevs - if (h2osoi_liq(c,j) > 0._r8) then - vwc = h2osoi_liq(c,j)/(dz(c,j)*denh2o) - psi = psisat(c,j) * (vwc/vwcsat(c,j))**bsw2(c,j) - soilpsi(c,j) = max(psi, -15.0_r8) - soilpsi(c,j) = min(soilpsi(c,j),0.0_r8) - end if - end do - end if - end if - end if - end do - - ! Set snow - - do j = -nlevsno+1, 0 - do c = begc,endc - l = clandunit(c) - if (.not. lakpoi(l)) then !not lake - if (j > snl(c)) then - h2osoi_ice(c,j) = dz(c,j)*250._r8 - h2osoi_liq(c,j) = 0._r8 - end if - end if - end do - end do - - - ! initialize SNICAR fields: - do c = begc,endc - mss_bctot(c,:) = 0._r8 - mss_bcpho(c,:) = 0._r8 - mss_bcphi(c,:) = 0._r8 - mss_cnc_bcphi(c,:)=0._r8 - mss_cnc_bcpho(c,:)=0._r8 - - mss_octot(c,:) = 0._r8 - mss_ocpho(c,:) = 0._r8 - mss_ocphi(c,:) = 0._r8 - mss_cnc_ocphi(c,:)=0._r8 - mss_cnc_ocpho(c,:)=0._r8 - - mss_dst1(c,:) = 0._r8 - mss_dst2(c,:) = 0._r8 - mss_dst3(c,:) = 0._r8 - mss_dst4(c,:) = 0._r8 - mss_dsttot(c,:) = 0._r8 - mss_cnc_dst1(c,:)=0._r8 - mss_cnc_dst2(c,:)=0._r8 - mss_cnc_dst3(c,:)=0._r8 - mss_cnc_dst4(c,:)=0._r8 - - if (snl(c) < 0) then - snw_rds(c,snl(c)+1:0) = snw_rds_min - snw_rds(c,-nlevsno+1:snl(c)) = 0._r8 - snw_rds_top(c) = snw_rds_min - sno_liq_top(c) = h2osoi_liq(c,snl(c)+1) / (h2osoi_liq(c,snl(c)+1)+h2osoi_ice(c,snl(c)+1)) - elseif (h2osno(c) > 0._r8) then - snw_rds(c,0) = snw_rds_min - snw_rds(c,-nlevsno+1:-1) = 0._r8 - snw_rds_top(c) = spval - sno_liq_top(c) = spval - else - snw_rds(c,:) = 0._r8 - snw_rds_top(c) = spval - sno_liq_top(c) = spval - endif - enddo - - - end subroutine mkarbinit - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: snowdp2lev -! -! !INTERFACE: - subroutine snowdp2lev(lbc, ubc) -! -! !DESCRIPTION: -! Create snow layers and interfaces given snow depth. -! Note that cps%zi(0) is set in routine iniTimeConst. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clmtype - use clm_varpar , only : nlevsno -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arguments -! - integer , pointer :: clandunit(:) ! landunit index associated with each column - real(r8), pointer :: snowdp(:) ! snow height (m) - logical , pointer :: lakpoi(:) ! true => landunit is a lake point -! -! local pointers to implicit out arguments -! - integer , pointer :: snl(:) ! number of snow layers - real(r8), pointer :: z(:,:) ! layer depth (m) over snow only - real(r8), pointer :: dz(:,:) ! layer thickness depth (m) over snow only - real(r8), pointer :: zi(:,:) ! interface depth (m) over snow only -! -! -! !LOCAL VARIABLES: -!EOP - integer :: c,l,j !indices -!----------------------------------------------------------------------- - - ! Assign local pointers to derived subtypes components (landunit-level) - - lakpoi => lun%lakpoi - - ! Assign local pointers to derived type members (column-level) - - clandunit => col%landunit - snowdp => cps%snowdp - snl => cps%snl - zi => cps%zi - dz => cps%dz - z => cps%z - - ! Initialize snow levels and interfaces (lake and non-lake points) - - do c = lbc, ubc - dz(c,-nlevsno+1: 0) = 1.e36_r8 - z (c,-nlevsno+1: 0) = 1.e36_r8 - zi(c,-nlevsno :-1) = 1.e36_r8 - end do - - ! Determine snow levels and interfaces for non-lake points - - do c = lbc,ubc - l = clandunit(c) - if (.not. lakpoi(l)) then - if (snowdp(c) < 0.01_r8) then - snl(c) = 0 - dz(c,-nlevsno+1:0) = 0._r8 - z (c,-nlevsno+1:0) = 0._r8 - zi(c,-nlevsno+0:0) = 0._r8 - else - if ((snowdp(c) >= 0.01_r8) .and. (snowdp(c) <= 0.03_r8)) then - snl(c) = -1 - dz(c,0) = snowdp(c) - else if ((snowdp(c) > 0.03_r8) .and. (snowdp(c) <= 0.04_r8)) then - snl(c) = -2 - dz(c,-1) = snowdp(c)/2._r8 - dz(c, 0) = dz(c,-1) - else if ((snowdp(c) > 0.04_r8) .and. (snowdp(c) <= 0.07_r8)) then - snl(c) = -2 - dz(c,-1) = 0.02_r8 - dz(c, 0) = snowdp(c) - dz(c,-1) - else if ((snowdp(c) > 0.07_r8) .and. (snowdp(c) <= 0.12_r8)) then - snl(c) = -3 - dz(c,-2) = 0.02_r8 - dz(c,-1) = (snowdp(c) - 0.02_r8)/2._r8 - dz(c, 0) = dz(c,-1) - else if ((snowdp(c) > 0.12_r8) .and. (snowdp(c) <= 0.18_r8)) then - snl(c) = -3 - dz(c,-2) = 0.02_r8 - dz(c,-1) = 0.05_r8 - dz(c, 0) = snowdp(c) - dz(c,-2) - dz(c,-1) - else if ((snowdp(c) > 0.18_r8) .and. (snowdp(c) <= 0.29_r8)) then - snl(c) = -4 - dz(c,-3) = 0.02_r8 - dz(c,-2) = 0.05_r8 - dz(c,-1) = (snowdp(c) - dz(c,-3) - dz(c,-2))/2._r8 - dz(c, 0) = dz(c,-1) - else if ((snowdp(c) > 0.29_r8) .and. (snowdp(c) <= 0.41_r8)) then - snl(c) = -4 - dz(c,-3) = 0.02_r8 - dz(c,-2) = 0.05_r8 - dz(c,-1) = 0.11_r8 - dz(c, 0) = snowdp(c) - dz(c,-3) - dz(c,-2) - dz(c,-1) - else if ((snowdp(c) > 0.41_r8) .and. (snowdp(c) <= 0.64_r8)) then - snl(c) = -5 - dz(c,-4) = 0.02_r8 - dz(c,-3) = 0.05_r8 - dz(c,-2) = 0.11_r8 - dz(c,-1) = (snowdp(c) - dz(c,-4) - dz(c,-3) - dz(c,-2))/2._r8 - dz(c, 0) = dz(c,-1) - else if (snowdp(c) > 0.64_r8) then - snl(c) = -5 - dz(c,-4) = 0.02_r8 - dz(c,-3) = 0.05_r8 - dz(c,-2) = 0.11_r8 - dz(c,-1) = 0.23_r8 - dz(c, 0)=snowdp(c)-dz(c,-4)-dz(c,-3)-dz(c,-2)-dz(c,-1) - endif - end if - end if - end do - - ! The following loop is currently not vectorized - - do c = lbc,ubc - l = clandunit(c) - if (.not. lakpoi(l)) then - do j = 0, snl(c)+1, -1 - z(c,j) = zi(c,j) - 0.5_r8*dz(c,j) - zi(c,j-1) = zi(c,j) - dz(c,j) - end do - end if - end do - - ! Determine snow levels and interfaces for lake points - - do c = lbc,ubc - l = clandunit(c) - if (lakpoi(l)) then - snl(c) = 0 - dz(c,-nlevsno+1:0) = 0._r8 - z (c,-nlevsno+1:0) = 0._r8 - zi(c,-nlevsno+0:0) = 0._r8 - end if - end do - - end subroutine snowdp2lev - -!----------------------------------------------------------------------- - -end module mkarbinitMod diff --git a/src_clm40/main/ncdio_pio.F90.in b/src_clm40/main/ncdio_pio.F90.in deleted file mode 100644 index de38171f6c..0000000000 --- a/src_clm40/main/ncdio_pio.F90.in +++ /dev/null @@ -1,2285 +0,0 @@ -module ncdio_pio - - !----------------------------------------------------------------------- - !BOP - ! - ! !MODULE: ncdio_pioMod - ! - ! !DESCRIPTION: - ! Generic interfaces to write fields to netcdf files for CLM - ! - ! !USES: - use shr_kind_mod , only : r8 => shr_kind_r8, i4=>shr_kind_i4, shr_kind_cl - use shr_infnan_mod , only : nan => shr_infnan_nan, isnan => shr_infnan_isnan, assignment(=) - use shr_sys_mod , only : shr_sys_abort - use shr_file_mod , only : shr_file_getunit, shr_file_freeunit - use shr_string_mod , only : shr_string_toUpper - use shr_log_mod , only : errMsg => shr_log_errMsg - use spmdMod , only : masterproc, mpicom, iam, npes - use spmdMod , only : MPI_REAL8, MPI_INTEGER, MPI_LOGICAL - use clmtype , only : grlnd, nameg, namel, namec, namep - use clm_varcon , only : spval,ispval - use clm_varctl , only : single_column, iulog - use shr_sys_mod , only : shr_sys_flush - use decompMod , only : get_clmlevel_gsize,get_clmlevel_gsmap - use perf_mod , only : t_startf, t_stopf - use fileutils , only : getavu, relavu - use mct_mod , only : mct_gsMap, mct_gsMap_lsize, mct_gsMap_gsize, mct_gsMap_orderedPoints - use pio , only : file_desc_t, io_desc_t, iosystem_desc_t, pio_64bit_offset - use pio , only : pio_bcast_error, pio_char, pio_clobber, pio_closefile, pio_createfile, pio_def_dim - use pio , only : pio_def_var, pio_double, pio_enddef, pio_get_att, pio_get_var, pio_global, pio_initdecomp - use pio , only : pio_inq_att, pio_inq_dimid, pio_inq_dimlen, pio_inq_dimname, pio_inq_vardimid, pio_inq_varid - use pio , only : pio_inq_varname, pio_inq_varndims, pio_inquire, pio_int, pio_internal_error - use pio , only : pio_noclobber, pio_noerr, pio_nofill, pio_nowrite, pio_offset_kind, pio_openfile - use pio , only : pio_put_att, pio_put_var, pio_read_darray, pio_real, pio_seterrorhandling - use pio , only : pio_setframe, pio_unlimited, pio_write, pio_write_darray, var_desc_t - use pio , only : pio_iotask_rank, PIO_REARR_SUBSET, PIO_REARR_BOX - ! - ! !PUBLIC TYPES: - implicit none - private - save - ! - ! !PUBLIC MEMBER FUNCTIONS: - ! - public :: check_var ! determine if variable is on netcdf file - public :: check_att ! check if attribute is on file - public :: check_dim ! validity check on dimension - public :: ncd_pio_openfile ! open a file - public :: ncd_pio_createfile ! create a new file - public :: ncd_pio_closefile ! close a file - public :: ncd_pio_init ! called from clm_comp - public :: ncd_enddef ! end define mode - public :: ncd_putatt ! put attribute - public :: ncd_getatt ! get attribute - public :: ncd_defdim ! define dimension - public :: ncd_inqdid ! inquire dimension id - public :: ncd_inqdname ! inquire dimension name - public :: ncd_inqdlen ! inquire dimension length - public :: ncd_inqfdims ! inquire file dimnesions - public :: ncd_defvar ! define variables - public :: ncd_inqvid ! inquire variable id - public :: ncd_inqvname ! inquire variable name - public :: ncd_inqvdims ! inquire variable ndims - public :: ncd_inqvdids ! inquire variable dimids - public :: ncd_inqvdlen ! inquire variable dimension size - public :: ncd_io ! write local data - - integer,parameter,public :: ncd_int = pio_int - integer,parameter,public :: ncd_log =-pio_int - integer,parameter,public :: ncd_float = pio_real - integer,parameter,public :: ncd_double = pio_double - integer,parameter,public :: ncd_char = pio_char - integer,parameter,public :: ncd_global = pio_global - integer,parameter,public :: ncd_write = pio_write - integer,parameter,public :: ncd_nowrite = pio_nowrite - integer,parameter,public :: ncd_clobber = pio_clobber - integer,parameter,public :: ncd_noclobber = pio_noclobber - integer,parameter,public :: ncd_nofill = pio_nofill - integer,parameter,public :: ncd_unlimited = pio_unlimited - - ! PIO types needed for ncdio_pio interface calls - public file_desc_t - public var_desc_t - - ! - ! !PRIVATE MEMBER FUNCTIONS: - ! - interface ncd_defvar - module procedure ncd_defvar_bynf - module procedure ncd_defvar_bygrid - end interface - - interface ncd_putatt - module procedure ncd_putatt_int - module procedure ncd_putatt_real - module procedure ncd_putatt_char - end interface - - interface ncd_getatt - module procedure ncd_getatt_char - end interface ncd_getatt - - interface ncd_io - module procedure ncd_io_char_var0_start_glob - - !DIMS 0,1 - module procedure ncd_io_{DIMS}d_log_glob - - !DIMS 0,1,2,3 - !TYPE int,double - module procedure ncd_io_{DIMS}d_{TYPE}_glob - - !DIMS 0,1,2 - !TYPE text - module procedure ncd_io_{DIMS}d_{TYPE}_glob - - !TYPE int,double - !DIMS 1,2,3 - module procedure ncd_io_{DIMS}d_{TYPE} - - !TYPE logical - !DIMS 1 - module procedure ncd_io_{DIMS}d_{TYPE} - end interface - - interface ncd_inqvdlen - module procedure ncd_inqvdlen_byDesc - module procedure ncd_inqvdlen_byName - end interface - - private :: ncd_getiodesc ! obtain iodesc - private :: scam_field_offsets ! get offset to proper lat/lon gridcell for SCAM - - integer,parameter,private :: debug = 0 ! local debug level - - integer , parameter , public :: max_string_len = 256 ! length of strings - real(r8), parameter , public :: fillvalue = 1.e36_r8 ! fill value for netcdf fields - - integer, public :: io_type - - type(iosystem_desc_t), pointer, public :: pio_subsystem - - type iodesc_plus_type - character(len=64) :: name - type(IO_desc_t) :: iodesc - integer :: type - integer :: ndims - integer :: dims(4) - integer :: dimids(4) - end type iodesc_plus_type - integer,parameter ,private :: max_iodesc = 100 - integer ,private :: num_iodesc = 0 - type(iodesc_plus_type) ,private, target :: iodesc_list(max_iodesc) - !----------------------------------------------------------------------- - -contains - - !----------------------------------------------------------------------- - subroutine ncd_pio_init() - ! - ! !DESCRIPTION: - ! Initial PIO - ! - ! !USES: - use shr_pio_mod , only : shr_pio_getiosys, shr_pio_getiotype - use clm_varctl , only : inst_name - !----------------------------------------------------------------------- - - PIO_subsystem => shr_pio_getiosys(inst_name) - io_type = shr_pio_getiotype(inst_name) - - end subroutine ncd_pio_init - - !----------------------------------------------------------------------- - subroutine ncd_pio_openfile(file, fname, mode) - ! - ! !DESCRIPTION: - ! Open a NetCDF PIO file - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: file ! Output PIO file handle - character(len=*) , intent(in) :: fname ! Input filename to open - integer , intent(in) :: mode ! file mode - ! - ! !LOCAL VARIABLES: - integer :: ierr - !----------------------------------------------------------------------- - - ierr = pio_openfile(pio_subsystem, file, io_type, fname, mode) - - if(ierr/= PIO_NOERR) then - call shr_sys_abort('ncd_pio_openfile ERROR: Failed to open file') - else if(pio_iotask_rank(pio_subsystem)==0) then - write(iulog,*) 'Opened existing file ', trim(fname), file%fh - end if - - end subroutine ncd_pio_openfile - - !----------------------------------------------------------------------- - subroutine ncd_pio_closefile(file) - ! - ! !DESCRIPTION: - ! Close a NetCDF PIO file - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: file ! PIO file handle to close - !----------------------------------------------------------------------- - - call pio_closefile(file) - - end subroutine ncd_pio_closefile - - !----------------------------------------------------------------------- - subroutine ncd_pio_createfile(file, fname, avoid_pnetcdf) - ! - ! !DESCRIPTION: - ! Create a new NetCDF file with PIO - ! - ! !USES: - use pio, only : pio_iotype_pnetcdf, pio_iotype_netcdf - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: file ! PIO file descriptor - character(len=*) , intent(in) :: fname ! File name to create - - ! BUG(wjs, 2014-10-20, bugz 1730) Workaround for - ! http://bugs.cgd.ucar.edu/show_bug.cgi?id=1730 - logical, intent(in), optional :: avoid_pnetcdf - ! - ! !LOCAL VARIABLES: - logical :: l_avoid_pnetcdf ! local version of avoid_pnetcdf - integer :: my_io_type - integer :: ierr - !----------------------------------------------------------------------- - - l_avoid_pnetcdf = .false. - if (present(avoid_pnetcdf)) then - l_avoid_pnetcdf = avoid_pnetcdf - end if - - my_io_type = io_type - if (l_avoid_pnetcdf) then - if (my_io_type == pio_iotype_pnetcdf) then - my_io_type = pio_iotype_netcdf - if(pio_iotask_rank(pio_subsystem)==0) then - write(iulog,*) 'Workaround for bugz 1730: creating' - write(iulog,*) trim(fname) - write(iulog,*) 'with type netcdf instead of pnetcdf' - end if - end if - end if - - ierr = pio_createfile(pio_subsystem, file, my_io_type, fname, ior(PIO_CLOBBER,PIO_64BIT_OFFSET)) - - if(ierr/= PIO_NOERR) then - call shr_sys_abort( ' ncd_pio_createfile ERROR: Failed to open file to write: '//trim(fname)) - else if(pio_iotask_rank(pio_subsystem)==0) then - write(iulog,*) 'Opened file ', trim(fname), ' to write', file%fh - end if - - end subroutine ncd_pio_createfile - - !----------------------------------------------------------------------- - subroutine check_var(ncid, varname, vardesc, readvar, print_err ) - ! - ! !DESCRIPTION: - ! Check if variable is on netcdf file - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor - character(len=*) , intent(in) :: varname ! Varible name to check - type(Var_desc_t) , intent(out) :: vardesc ! Output variable descriptor - logical , intent(out) :: readvar ! If variable exists or not - logical, optional , intent(in) :: print_err ! If should print about error - ! - ! !LOCAL VARIABLES: - integer :: ret ! return value - logical :: log_err ! if should log error - character(len=*),parameter :: subname='check_var' ! subroutine name - !----------------------------------------------------------------------- - - - if ( present(print_err) )then - log_err = print_err - else - log_err = .true. - end if - readvar = .true. - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ret = PIO_inq_varid (ncid, varname, vardesc) - if (ret /= PIO_noerr) then - readvar = .false. - if (masterproc .and. log_err) & - write(iulog,*) subname//': variable ',trim(varname),' is not on dataset' - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - - end subroutine check_var - - !----------------------------------------------------------------------- - subroutine check_att(ncid, varid, attrib, att_found) - ! - ! !DESCRIPTION: - ! Check if attribute is on file - ! - ! !USES: - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - logical ,intent(out) :: att_found ! true if the attribute was found - ! - ! !LOCAL VARIABLES: - integer :: att_type ! attribute type - integer(pio_offset_kind) :: att_len ! attribute length - integer :: status - - character(len=*), parameter :: subname = 'check_att' - !----------------------------------------------------------------------- - - att_found = .true. - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - status = PIO_inq_att(ncid, varid, trim(attrib), att_type, att_len) - if (status /= PIO_noerr) then - att_found = .false. - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - - end subroutine check_att - - !----------------------------------------------------------------------- - subroutine check_dim(ncid, dimname, value) - ! - ! !DESCRIPTION: - ! Validity check on dimension - ! - ! !ARGUMENTS: - class(file_desc_t),intent(in) :: ncid ! PIO file handle - character(len=*) , intent(in) :: dimname ! Dimension name - integer, intent(in) :: value ! Expected dimension size - ! - ! !LOCAL VARIABLES: - integer :: dimid, dimlen ! temporaries - integer :: status ! error code - character(len=*),parameter :: subname='check_dim' ! subroutine name - !----------------------------------------------------------------------- - - status = pio_inq_dimid (ncid, trim(dimname), dimid) - status = pio_inq_dimlen (ncid, dimid, dimlen) - if (dimlen /= value) then - write(iulog,*) subname//' ERROR: mismatch of input dimension ',dimlen, & - ' with expected value ',value,' for variable ',trim(dimname) - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - - end subroutine check_dim - - !----------------------------------------------------------------------- - subroutine ncd_enddef(ncid) - ! - ! !DESCRIPTION: - ! enddef netcdf file - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - ! - ! !LOCAL VARIABLES: - integer :: status ! error status - !----------------------------------------------------------------------- - - status = PIO_enddef(ncid) - - end subroutine ncd_enddef - - !----------------------------------------------------------------------- - subroutine ncd_inqdid(ncid,name,dimid,dimexist) - ! - ! !DESCRIPTION: - ! inquire on a dimension id - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: name ! dimension name - integer , intent(out):: dimid ! dimension id - logical,optional , intent(out):: dimexist ! if this dimension exists or not - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - if ( present(dimexist) )then - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - end if - status = PIO_inq_dimid(ncid,name,dimid) - if ( present(dimexist) )then - if ( status == PIO_NOERR)then - dimexist = .true. - else - dimexist = .false. - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - end if - - end subroutine ncd_inqdid - - !----------------------------------------------------------------------- - subroutine ncd_inqdlen(ncid,dimid,len,name) - ! - ! !DESCRIPTION: - ! enddef netcdf file - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - integer , intent(inout) :: dimid ! dimension id - integer , intent(out) :: len ! dimension len - character(len=*), optional, intent(in) :: name ! dimension name - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - if ( present(name) )then - call ncd_inqdid(ncid,name,dimid) - end if - len = -1 - status = PIO_inq_dimlen(ncid,dimid,len) - - end subroutine ncd_inqdlen - - !----------------------------------------------------------------------- - subroutine ncd_inqdname(ncid,dimid,dname) - ! - ! !DESCRIPTION: - ! inquire dim name - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - integer , intent(in) :: dimid ! dimension id - character(len=*) , intent(out):: dname ! dimension name - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = PIO_inq_dimname(ncid,dimid,dname) - - end subroutine ncd_inqdname - - !----------------------------------------------------------------------- - subroutine ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout):: ncid - logical , intent(out) :: isgrid2d - integer , intent(out) :: ni - integer , intent(out) :: nj - integer , intent(out) :: ns - ! - ! !LOCAL VARIABLES: - integer :: dimid ! netCDF id - integer :: ier ! error status - character(len=32) :: subname = 'ncd_inqfdims' ! subroutine name - !----------------------------------------------------------------------- - - if (single_column) then - ni = 1 - nj = 1 - ns = 1 - isgrid2d = .true. - RETURN - end if - - ni = 0 - nj = 0 - - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ier = pio_inq_dimid (ncid, 'lon', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, ni) - ier = pio_inq_dimid (ncid, 'lat', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, nj) - - ier = pio_inq_dimid (ncid, 'lsmlon', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, ni) - ier = pio_inq_dimid (ncid, 'lsmlat', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, nj) - - ier = pio_inq_dimid (ncid, 'ni', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, ni) - ier = pio_inq_dimid (ncid, 'nj', dimid) - if (ier == PIO_NOERR) ier = pio_inq_dimlen(ncid, dimid, nj) - - ier = pio_inq_dimid (ncid, 'gridcell', dimid) - if (ier == PIO_NOERR) then - ier = pio_inq_dimlen(ncid, dimid, ni) - if (ier == PIO_NOERR) nj = 1 - end if - - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - - if (ni == 0 .or. nj == 0) then - write(iulog,*) trim(subname),' ERROR: ni,nj = ',ni,nj,' cannot be zero ' - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - - if (nj == 1) then - isgrid2d = .false. - else - isgrid2d = .true. - end if - - ns = ni*nj - - end subroutine ncd_inqfdims - - !----------------------------------------------------------------------- - subroutine ncd_inqvid(ncid,name,varid,vardesc,readvar) - ! - ! !DESCRIPTION: - ! Inquire on a variable ID - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: name ! variable name - integer , intent(out) :: varid ! variable id - type(Var_desc_t) , intent(out) :: vardesc ! variable descriptor - logical, optional , intent(out) :: readvar ! does variable exist - ! - ! !LOCAL VARIABLES: - integer :: ret ! return code - character(len=*),parameter :: subname='ncd_inqvid' ! subroutine name - !----------------------------------------------------------------------- - - if (present(readvar)) then - readvar = .false. - call pio_seterrorhandling(ncid, PIO_BCAST_ERROR) - ret = PIO_inq_varid(ncid,name,vardesc) - if (ret /= PIO_noerr) then - if (masterproc) write(iulog,*) subname//': variable ',trim(name),' is not on dataset' - readvar = .false. - else - readvar = .true. - end if - call pio_seterrorhandling(ncid, PIO_INTERNAL_ERROR) - else - ret = PIO_inq_varid(ncid,name,vardesc) - endif - varid = vardesc%varid - - end subroutine ncd_inqvid - - !----------------------------------------------------------------------- - subroutine ncd_inqvdims(ncid,ndims,vardesc) - ! - ! !DESCRIPTION: - ! inquire variable dimensions - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - integer , intent(out) :: ndims ! variable ndims - type(Var_desc_t) , intent(inout):: vardesc ! variable descriptor - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - ndims = -1 - status = PIO_inq_varndims(ncid,vardesc,ndims) - - end subroutine ncd_inqvdims - - !----------------------------------------------------------------------- - subroutine ncd_inqvname(ncid,varid,vname,vardesc) - ! - ! !DESCRIPTION: - ! inquire variable name - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - integer , intent(in) :: varid ! variable id - character(len=*) , intent(out) :: vname ! variable vname - type(Var_desc_t) , intent(inout):: vardesc ! variable descriptor - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - vname = '' - status = PIO_inq_varname(ncid,vardesc,vname) - - end subroutine ncd_inqvname - - !----------------------------------------------------------------------- - subroutine ncd_inqvdids(ncid,dids,vardesc) - ! - ! !DESCRIPTION: - ! inquire variable dimension ids - ! - ! !ARGUMENTS: - class(file_desc_t),intent(in) :: ncid ! netcdf file id - integer ,intent(out) :: dids(:) ! variable dids - type(Var_desc_t) ,intent(inout):: vardesc ! variable descriptor - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - dids = -1 - status = PIO_inq_vardimid(ncid,vardesc,dids) - - end subroutine ncd_inqvdids - - !----------------------------------------------------------------------- - subroutine ncd_inqvdlen_byDesc(ncid,vardesc,dimnum,dlen,err_code) - ! - ! !DESCRIPTION: - ! inquire size of one of a variable's dimensions, given a vardesc - ! - ! If the variable has n dimensions, then dimnum should be between 1 and n; this routine - ! returns the size of the dimnum'th dimension. - ! - ! If there is an error condition, dlen will be -1, and err_code will hold the error - ! code; possible error codes are: - ! 0: no error - ! 1: dimnum out of range - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - type(Var_desc_t) ,intent(inout) :: vardesc ! variable descriptor - integer ,intent(in) :: dimnum ! dimension number to query - integer ,intent(out) :: dlen ! length of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - ! - ! !LOCAL VARIABLES: - integer :: ndims ! number of dimensions - integer, allocatable :: dimids(:) ! dimension IDs - - integer, parameter :: dlen_invalid = -1 - integer, parameter :: error_none = 0 - integer, parameter :: error_dimnum_out_of_range = 1 - !----------------------------------------------------------------------- - - err_code = error_none - - call ncd_inqvdims(ncid, ndims, vardesc) - - if (dimnum > 0 .and. dimnum <= ndims) then - allocate(dimids(ndims)) - call ncd_inqvdids(ncid, dimids, vardesc) - call ncd_inqdlen(ncid, dimids(dimnum), dlen) - deallocate(dimids) - else - dlen = dlen_invalid - err_code = error_dimnum_out_of_range - end if - - end subroutine ncd_inqvdlen_byDesc - - - !----------------------------------------------------------------------- - subroutine ncd_inqvdlen_byName(ncid,varname,dimnum,dlen,err_code) - ! - ! !DESCRIPTION: - ! inquire size of one of a variable's dimensions, given a variable name - ! - ! If the variable has n dimensions, then dimnum should be between 1 and n; this routine - ! returns the size of the dimnum'th dimension. - ! - ! If there is an error condition, dlen will be -1, and err_code will hold the error - ! code; possible error codes are: - ! 0: no error - ! 1: dimnum out of range - ! 11: variable not found - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) ,intent(in) :: varname ! variable name - integer ,intent(in) :: dimnum ! dimension number to query - integer ,intent(out) :: dlen ! length of the dimension - integer ,intent(out) :: err_code ! error code (0 means no error) - ! - ! !LOCAL VARIABLES: - type(Var_desc_t) :: vardesc ! variable descriptor - logical :: readvar ! whether the variable was found - integer, parameter :: dlen_invalid = -1 - integer, parameter :: error_variable_not_found = 11 - !----------------------------------------------------------------------- - - call check_var(ncid, varname, vardesc, readvar) - if (readvar) then - call ncd_inqvdlen_byDesc(ncid, vardesc, dimnum, dlen, err_code) - else - dlen = dlen_invalid - err_code = error_variable_not_found - end if - - end subroutine ncd_inqvdlen_byName - - - !----------------------------------------------------------------------- - subroutine ncd_putatt_int(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! put integer attributes - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - integer ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = PIO_put_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_putatt_int - - !----------------------------------------------------------------------- - subroutine ncd_putatt_char(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! put character attributes - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - character(len=*) ,intent(in) :: value ! netcdf attrib value - integer,optional ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = PIO_put_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_putatt_char - - !----------------------------------------------------------------------- - subroutine ncd_putatt_real(ncid,varid,attrib,value,xtype) - ! - ! !DESCRIPTION: - ! put real attributes - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - real(r8) ,intent(in) :: value ! netcdf attrib value - integer ,intent(in) :: xtype ! netcdf data type - ! - ! !LOCAL VARIABLES: - integer :: status - real*4 :: value4 - !----------------------------------------------------------------------- - - value4 = value - - if (xtype == pio_double) then - status = PIO_put_att(ncid,varid,trim(attrib),value) - else - status = PIO_put_att(ncid,varid,trim(attrib),value4) - endif - - end subroutine ncd_putatt_real - - !----------------------------------------------------------------------- - subroutine ncd_getatt_char(ncid,varid,attrib,value) - ! - ! !DESCRIPTION: - ! get a character attribute - ! - ! !USES: - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - integer ,intent(in) :: varid ! netcdf var id - character(len=*) ,intent(in) :: attrib ! netcdf attrib - character(len=*) ,intent(out) :: value ! netcdf attrib value - ! - ! !LOCAL VARIABLES: - integer :: status - - character(len=*), parameter :: subname = 'ncd_getatt_char' - !----------------------------------------------------------------------- - - status = PIO_get_att(ncid,varid,trim(attrib),value) - - end subroutine ncd_getatt_char - - - !----------------------------------------------------------------------- - subroutine ncd_defdim(ncid,attrib,value,dimid) - ! - ! !DESCRIPTION: - ! define dimension - ! - ! !ARGUMENTS: - class(file_desc_t), intent(in) :: ncid ! netcdf file id - character(len=*) , intent(in) :: attrib ! netcdf attrib - integer , intent(in) :: value ! netcdf attrib value - integer , intent(out):: dimid ! netcdf dimension id - ! - ! !LOCAL VARIABLES: - integer :: status - !----------------------------------------------------------------------- - - status = pio_def_dim(ncid,attrib,value,dimid) - - end subroutine ncd_defdim - - !----------------------------------------------------------------------- - subroutine ncd_defvar_bynf(ncid, varname, xtype, ndims, dimid, varid, & - long_name, units, cell_method, missing_value, fill_value, & - imissing_value, ifill_value, comment, flag_meanings, & - flag_values, nvalid_range ) - ! - ! !DESCRIPTION: - ! Define a netcdf variable - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! external type - integer , intent(in) :: ndims ! number of dims - integer , intent(inout) :: varid ! returned var id - integer , intent(in), optional :: dimid(:) ! dimids - character(len=*) , intent(in), optional :: long_name ! attribute - character(len=*) , intent(in), optional :: units ! attribute - character(len=*) , intent(in), optional :: cell_method ! attribute - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! !LOCAL VARIABLES: - integer :: n ! indices - integer :: ldimid(4) ! local dimid - integer :: dimid0(1) ! local dimid - integer :: status ! error status - integer :: lxtype ! local external type (in case logical variable) - type(var_desc_t) :: vardesc ! local vardesc - character(len=128) :: dimname ! temporary - character(len=256) :: str ! temporary - character(len=*),parameter :: subname='ncd_defvar_bynf' ! subroutine name - !----------------------------------------------------------------------- - - varid = -1 - - dimid0 = 0 - ldimid = 0 - if (present(dimid)) then - ldimid(1:ndims) = dimid(1:ndims) - else ! ndims must be zero if dimid not present - if (ndims /= 0) then - write(iulog,*) subname//' ERROR: dimid not supplied and ndims ne 0 ',trim(varname),ndims - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - endif - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - if (masterproc .and. debug > 1) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - write(iulog,*) subname//' ',trim(varname),lxtype,ndims,ldimid(1:ndims) - endif - - if (ndims > 0) then - status = pio_inq_dimname(ncid,ldimid(ndims),dimname) - end if - - ! Define variable - if (present(dimid)) then - status = PIO_def_var(ncid,trim(varname),lxtype,dimid(1:ndims),vardesc) - else - status = PIO_def_var(ncid,trim(varname),lxtype,dimid0 ,vardesc) - endif - varid = vardesc%varid - - ! - ! Add attributes - ! - if (present(long_name)) then - call ncd_putatt(ncid, varid, 'long_name', trim(long_name)) - end if - if (present(flag_values)) then - status = PIO_put_att(ncid,varid,'flag_values',flag_values) - if ( .not. present(flag_meanings)) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_values set -- but not flag_meanings"//errMsg(__FILE__, __LINE__)) - end if - end if - if (present(flag_meanings)) then - if ( .not. present(flag_values)) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_meanings set -- but not flag_values"//errMsg(__FILE__, __LINE__) ) - end if - if ( size(flag_values) /= size(flag_meanings) ) then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_meanings and flag_values dimension different"//errMsg(__FILE__, __LINE__)) - end if - str = flag_meanings(1) - do n = 1, size(flag_meanings) - if ( index(flag_meanings(n), ' ') /= 0 )then - write(iulog,*) 'Error in defining variable = ', trim(varname) - call shr_sys_abort(" ERROR:: flag_meanings has an invalid space in it"//errMsg(__FILE__, __LINE__) ) - end if - if ( n > 1 ) str = trim(str)//" "//flag_meanings(n) - end do - status = PIO_put_att(ncid,varid,'flag_meanings', trim(str) ) - end if - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(cell_method)) then - str = 'time: ' // trim(cell_method) - call ncd_putatt(ncid, varid, 'cell_methods', trim(str)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - end subroutine ncd_defvar_bynf - - !----------------------------------------------------------------------- - subroutine ncd_defvar_bygrid(ncid, varname, xtype, & - dim1name, dim2name, dim3name, dim4name, dim5name, & - long_name, units, cell_method, missing_value, fill_value, & - imissing_value, ifill_value, switchdim, comment, & - flag_meanings, flag_values, nvalid_range ) - ! - ! !DESCRIPTION: - ! Define a netcdf variable - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! external type - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: dim3name ! dimension name - character(len=*) , intent(in), optional :: dim4name ! dimension name - character(len=*) , intent(in), optional :: dim5name ! dimension name - character(len=*) , intent(in), optional :: long_name ! attribute - character(len=*) , intent(in), optional :: units ! attribute - character(len=*) , intent(in), optional :: cell_method ! attribute - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - logical , intent(in), optional :: switchdim ! true=> permute dim1 and dim2 for output - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! !LOCAL VARIABLES: - integer :: n ! indices - integer :: ndims ! dimension counter - integer :: dimid(5) ! dimension ids - integer :: varid ! variable id - integer :: itmp ! temporary - character(len=256) :: str ! temporary - character(len=*),parameter :: subname='ncd_defvar_bygrid' ! subroutine name - !----------------------------------------------------------------------- - - dimid(:) = 0 - - ! Determine dimension ids for variable - - if (present(dim1name)) call ncd_inqdid(ncid, dim1name, dimid(1)) - if (present(dim2name)) call ncd_inqdid(ncid, dim2name, dimid(2)) - if (present(dim3name)) call ncd_inqdid(ncid, dim3name, dimid(3)) - if (present(dim4name)) call ncd_inqdid(ncid, dim4name, dimid(4)) - if (present(dim5name)) call ncd_inqdid(ncid, dim5name, dimid(5)) - - ! Permute dim1 and dim2 if necessary - - if (present(switchdim)) then - itmp = dimid(2) - dimid(2) = dimid(1) - dimid(1) = itmp - end if - - ! Define variable - - ndims = 0 - if (present(dim1name)) then - do n = 1, size(dimid) - if (dimid(n) /= 0) ndims = ndims + 1 - end do - end if - - call ncd_defvar_bynf(ncid,varname,xtype,ndims,dimid,varid, & - long_name=long_name, units=units, cell_method=cell_method, & - missing_value=missing_value, fill_value=fill_value, & - imissing_value=imissing_value, ifill_value=ifill_value, & - comment=comment, flag_meanings=flag_meanings, & - flag_values=flag_values, nvalid_range=nvalid_range ) - - end subroutine ncd_defvar_bygrid - - !------------------------------------------------------------------------ - subroutine ncd_io_char_var0_start_glob(vardesc, data, flag, ncid, start ) - ! - ! !DESCRIPTION: - ! netcdf I/O of global character array with start indices input - ! - ! !ARGUMENTS: - class(file_desc_t),intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - type(var_desc_t) , intent(in) :: vardesc ! local vardesc pointer - character(len=*) , intent(inout) :: data ! raw data for this index - integer , intent(in) :: start(:) ! output bounds - ! - ! !LOCAL VARIABLES: - integer :: status ! error code - character(len=*),parameter :: subname='ncd_io_char_var0_start_glob' - !----------------------------------------------------------------------- - - if (flag == 'read') then - - status = pio_get_var(ncid, vardesc, start, data ) - - elseif (flag == 'write') then - - status = pio_put_var(ncid, vardesc, start, data ) - - endif - - end subroutine ncd_io_char_var0_start_glob - - !------------------------------------------------------------------------ - !DIMS 0,1 - subroutine ncd_io_{DIMS}d_log_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! netcdf I/O of global integer variable - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - logical , intent(inout) :: data{DIMSTR} ! raw data - logical, optional , intent(out) :: readvar ! was var read? - integer, optional , intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: varid ! netCDF variable id - integer :: start(2), count(2) ! output bounds - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - integer :: idata - integer, pointer :: idata1d(:) ! Temporary integer data to send to file - character(len=32) :: vname ! variable error checking - type(var_desc_t) :: vardesc ! local vardesc pointer - character(len=*),parameter :: subname='ncd_io_{DIMS}d_log_glob' - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column .and. present(posNOTonfile) ) then - if ( .not. posNOTonfile )then - call shr_sys_abort(' ERROR: scalar var is NOT compatable with posNOTonfile = .false.'//& - errMsg(__FILE__, __LINE__)) - end if - endif -#if ({DIMS}==0) - status = pio_get_var(ncid, varid, idata) - if ( idata == 0 )then - data = .false. - else if ( idata == 1 )then - data = .true. - else - call shr_sys_abort(' ERROR: bad integer value for logical data'//errMsg(__FILE__, __LINE__)) - end if -#else - allocate(idata1d(size(data))) - data = (idata1d == 1) - if ( any(idata1d /= 0 .and. idata1d /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(__FILE__, __LINE__)) - end if - deallocate(idata1d) -#endif - endif - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - -#if ({DIMS}==0) - start(1) = 1 ; count(1) = 1 - if (present(nt)) start(1) = nt - call ncd_inqvid (ncid, varname, varid, vardesc) - allocate(idata1d(1)) - if ( data )then - idata1d(1) = 1 - else - idata1d(1) = 0 - end if - status = pio_put_var(ncid, varid, start, count, idata1d) - deallocate(idata1d) -#else - start(1) = 1 ; count(1) = size(data) - start(2) = 1 ; count(2) = 1 - if (present(nt)) start(2) = nt - allocate(idata1d(size(data))) - where( data ) - idata1d = 1 - elsewhere - idata1d = 0 - end where - call ncd_inqvid (ncid, varname, varid, vardesc) - status = pio_put_var(ncid, varid, start, count, idata1d) - deallocate( idata1d ) -#endif - - endif ! flag - - end subroutine ncd_io_{DIMS}d_log_glob - - !------------------------------------------------------------------------ - !DIMS 0,1,2,3 - !TYPE int,double - subroutine ncd_io_{DIMS}d_{TYPE}_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - {VTYPE} , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: m - integer :: varid ! netCDF variable id - integer :: start({DIMS}+1), count({DIMS}+1) ! output bounds - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - logical :: found ! if true, found lat/lon dims on file - character(len=32) :: vname ! variable error checking - character(len=1) :: tmpString(128) ! temp for manipulating output string - type(var_desc_t) :: vardesc ! local vardesc pointer - {VTYPE} :: temp(1) - character(len=*),parameter :: subname='ncd_io_{DIMS}d_{TYPE}_glob' - integer :: ndims - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - -#if ({DIMS}==0) - if (varpresent) then - status = pio_get_var(ncid, vardesc, data) - if (single_column .and. present(posNOTonfile) ) then - if ( .not. posNOTonfile )then - call shr_sys_abort(' ERROR: scalar var is NOT compatable with posNOTonfile = .false.'//& - errMsg(__FILE__, __LINE__)) - end if - endif - end if -#else - if (varpresent) then - if (single_column) then - call scam_field_offsets(ncid,'undefined', vardesc,& - start, count, found=found, posNOTonfile=posNOTonfile) - if ( found )then - status = pio_get_var(ncid, varid, start, count, data) - else - status = pio_get_var(ncid, varid, data) - end if - else - status = pio_get_var(ncid, varid, data) - endif - endif -#endif - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - ndims = {DIMS} - if(present(nt)) ndims=ndims+1 - call ncd_inqvid (ncid, varname, varid, vardesc) -#if ({DIMS}==0) - start(1) = 1 ; count(1) = 1 - if (present(nt)) start(1) = nt ; count(1) = 1 - temp(1) = data - status = pio_put_var(ncid, varid, start(1:1), count(1:1), temp) -#elif ({DIMS}==1) - start(1) = 1 ; count(1) = size(data) - start(2) = 1 ; count(2) = 1 - if (present(nt)) start(2) = nt - status = pio_put_var(ncid, varid, start(1:ndims), count(1:ndims), data) -#elif ({DIMS}==2) - start(1) = 1 ; count(1) = size(data, dim=1) - start(2) = 1 ; count(2) = size(data, dim=2) - start(3) = 1 ; count(3) = 1 - if (present(nt)) start(3) = nt - status = pio_put_var(ncid, varid, start(1:ndims), count(1:ndims), data) -#elif ({DIMS}==3) - if (present(nt)) then - start(1) = 1 ; count(1) = size(data,dim=1) - start(2) = 1 ; count(2) = size(data,dim=2) - start(3) = 1 ; count(3) = size(data,dim=3) - start(4) = nt ; count(4) = 1 - status = pio_put_var(ncid, varid, start(1:ndims), count(1:ndims), data) - else - status = pio_put_var(ncid, varid, data) - end if -#endif - - endif - - end subroutine ncd_io_{DIMS}d_{TYPE}_glob - - !------------------------------------------------------------------------ - !DIMS 0,1,2 - !TYPE text - subroutine ncd_io_{DIMS}d_{TYPE}_glob(varname, data, flag, ncid, readvar, nt, posNOTonfile) - ! - ! !DESCRIPTION: - ! netcdf I/O of global variable - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*), intent(in) :: flag ! 'read' or 'write' - character(len=*), intent(in) :: varname ! variable name - {VTYPE} , intent(inout) :: data{DIMSTR} ! raw data - logical , optional, intent(out) :: readvar ! was var read? - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(in) :: posNOTonfile ! position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: m - integer :: varid ! netCDF variable id - integer :: start(4), count(4) ! output bounds - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - character(len=1) :: tmpString(128) ! temp for manipulating output string - type(var_desc_t) :: vardesc ! local vardesc pointer - character(len=*),parameter :: subname='ncd_io_{DIMS}d_{TYPE}_glob' - integer :: ndims - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - - if (varpresent) then - data = ' ' - status = pio_get_var(ncid, varid, data) - end if - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - ndims = {DIMS} - if(present(nt)) ndims=ndims+1 - call ncd_inqvid (ncid, varname, varid, vardesc) - -#if ({DIMS}==0) - if (present(nt)) then - do m = 1,len(data) - tmpString(m:m) = data(m:m) - end do - start(1) = 1 ; count(1) = len(data) - start(2) = nt; count(2) = 1 - if ( count(1) > size(tmpString) )then - write(iulog,*) subname//' ERROR: input string size is too large:' - end if - status = pio_put_var(ncid, varid, start, count, ival=tmpString(1:count(1))) - else - status = pio_put_var(ncid, varid, data ) - end if -#elif ({DIMS}==1) - if (present(nt)) then - start(1) = 1 ; count(1) = len(data) - start(2) = 1 ; count(2) = size(data) - start(3) = nt; count(3) = 1 - status = pio_put_var(ncid, varid, start, count, data) - else - status = pio_put_var(ncid, varid, data) - end if -#elif ({DIMS}==2) - if (present(nt)) then - start(1) = 1 ; count(1) = len(data) - start(2) = 1 ; count(2) = size(data,dim=1) - start(3) = 1 ; count(3) = size(data,dim=2) - start(4) = nt ; count(4) = 1 - status = pio_put_var(ncid, varid, start, count, data) - else - status = pio_put_var(ncid, varid, data) - end if -#endif - - endif - - end subroutine ncd_io_{DIMS}d_{TYPE}_glob - - !----------------------------------------------------------------------- - - !TYPE int,double,logical - subroutine ncd_io_1d_{TYPE}(varname, data, dim1name, flag, ncid, nt, readvar, cnvrtnan2fill) - ! - ! !DESCRIPTION: - ! netcdf I/O for 1d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:) ! local decomposition data - character(len=*) , intent(in) :: dim1name ! dimension name - integer , optional, intent(in) :: nt ! time sample index - logical , optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - logical , optional, intent(in) :: cnvrtnan2fill ! true => convert any NaN's to _FillValue (spval) - ! - ! Local Variables - character(len=8) :: clmlevel ! clmlevel - character(len=32) :: dimname ! temporary - integer :: n ! index - integer :: iodnum ! iodesc num in list - integer :: varid ! varid - integer :: ndims ! ndims for var - integer :: ndims_iod ! ndims iodesc for var - integer :: dims(4) ! dim sizes - integer :: dids(4) ! dim ids - integer :: start(3) ! netcdf start index - integer :: count(3) ! netcdf count index - integer :: status ! error code - logical :: varpresent ! if true, variable is on tape - integer , pointer :: idata(:) ! Temporary integer data to send to file - integer , pointer :: compDOF(:) - type(iodesc_plus_type) , pointer :: iodesc_plus - type(var_desc_t) :: vardesc - character(len=*),parameter :: subname='ncd_io_1d_{TYPE}' ! subroutine name - !----------------------------------------------------------------------- - - start(:) = 0 - count(:) = 0 - - clmlevel = dim1name - - if (masterproc .and. debug > 1) then - write(iulog,*) subname//' ',trim(flag),' ',trim(varname),' ',trim(clmlevel) - end if - -#if ({ITYPE}==TYPEDOUBLE) - if ( present(cnvrtnan2fill) )then - if (.not. cnvrtnan2fill) then - call shr_sys_abort(' ERROR: cnvrtnan2fill present but NOT set to true -- MUST set it to TRUE if used'//& - errMsg(__FILE__, __LINE__)) - endif - end if -#endif - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column) then - start(:) = 1 ; count(:) = 1 - call scam_field_offsets(ncid,clmlevel,vardesc,start,count) - if (trim(clmlevel) == grlnd) then - n=2 - if (present(nt)) then - start(3) = nt ; count(3) = 1 - n=3 - end if - else - n=1 - if (present(nt)) then - n=2 - start(2) = nt ; count(2) = 1 - end if - end if -#if ({ITYPE}==TYPELOGICAL) - allocate(idata(size(data))) - status = pio_get_var(ncid, varid, start(1:n), count(1:n), idata) - data = (idata == 1) - if ( any(idata /= 0 .and. idata /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(__FILE__, __LINE__)) - end if - deallocate( idata ) -#else - status = pio_get_var(ncid, varid, start(1:n), count(1:n), data) -#endif - else - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo -#if ({ITYPE}==TYPELOGICAL) - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_INT, iodnum) -#else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) -#endif - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if -#if ({ITYPE}==TYPELOGICAL) - allocate(idata(size(data))) - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status) - data = (idata == 1) - if ( any(idata /= 0 .and. idata /= 1) )then - call shr_sys_abort(' ERROR: read in bad integer value(s) for logical data'//errMsg(__FILE__, __LINE__)) - end if - deallocate( idata ) -#else - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) -#endif - end if - end if - if (present(readvar)) readvar = varpresent - - elseif (flag == 'write') then - - call ncd_inqvid(ncid, varname ,varid, vardesc) - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo -#if ({ITYPE}==TYPELOGICAL) - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_INT, iodnum) -#else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) -#endif - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if -#if ({ITYPE}==TYPELOGICAL) - allocate( idata(size(data)) ) - where( data ) - idata = 1 - elsewhere - idata = 0 - end where - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, idata, status, fillval=0) - deallocate( idata ) -#elif ({ITYPE}==TYPEINT) - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=0) -#elif ({ITYPE}==TYPEDOUBLE) - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) -#endif - else - - if (masterproc) then - write(iulog,*) subname//' ERROR: unsupported flag ',trim(flag) - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - - endif - - end subroutine ncd_io_1d_{TYPE} - - !----------------------------------------------------------------------- - - !TYPE int,double - subroutine ncd_io_2d_{TYPE}(varname, data, dim1name, lowerb2, upperb2, & - flag, ncid, nt, readvar, switchdim, cnvrtnan2fill) - ! - ! !DESCRIPTION: - ! Netcdf i/o of 2d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:,:) ! local decomposition input data - character(len=*) , intent(in) :: dim1name ! dimension 1 name - integer, optional, intent(in) :: nt ! time sample index - integer, optional, intent(in) :: lowerb2,upperb2 ! lower and upper bounds of second dimension - logical, optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - logical, optional, intent(in) :: switchdim ! true=> permute dim1 and dim2 for output - logical, optional, intent(in) :: cnvrtnan2fill ! true => convert any NaN's to _FillValue (spval) - ! - ! !LOCAL VARIABLES: -#if ({ITYPE}==TYPEINT) - integer , pointer :: temp(:,:) -#else - real(r8), pointer :: temp(:,:) -#endif - integer :: ndim1,ndim2 - character(len=8) :: clmlevel ! clmlevel - character(len=32) :: dimname ! temporary - integer :: status ! error status - integer :: ndims ! ndims total for var - integer :: ndims_iod ! ndims iodesc for var - integer :: varid ! varid - integer :: n,i,j ! indices - integer :: dims(4) ! dim sizes - integer :: dids(4) ! dim ids - integer :: iodnum ! iodesc num in list - integer :: start(4) ! netcdf start index - integer :: count(4) ! netcdf count index - logical :: varpresent ! if true, variable is on tape - integer :: lb1,lb2 - integer :: ub1,ub2 - type(iodesc_plus_type) , pointer :: iodesc_plus - type(var_desc_t) :: vardesc - character(len=*),parameter :: subname='ncd_io_2d_{TYPE}' ! subroutine name - !----------------------------------------------------------------------- - - start(:)=0 - count(:)=0 - - clmlevel = dim1name - - if (masterproc .and. debug > 1) then - write(iulog,*) trim(subname),' ',trim(flag),' ',trim(varname),' ',trim(clmlevel) - end if - -#if ({ITYPE}==TYPEDOUBLE) - if ( present(cnvrtnan2fill) )then - if (.not. cnvrtnan2fill) then - call shr_sys_abort( ' ERROR: cnvrtnan2fill present but NOT set to true -- MUST set it to TRUE if used'//& - errMsg(__FILE__, __LINE__)) - endif - end if -#endif - - lb1 = lbound(data, dim=1) - ub1 = ubound(data, dim=1) - lb2 = lbound(data, dim=2) - ub2 = ubound(data, dim=2) - - if (present(switchdim)) then - if (present(lowerb2)) lb2 = lowerb2 - if (present(upperb2)) ub2 = upperb2 - allocate(temp(lb2:ub2,lb1:ub1)) - end if - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column) then - start(:) = 1 ; count(:) = 1 - call scam_field_offsets(ncid, clmlevel, vardesc, start, count) - if (trim(clmlevel) == grlnd) then - count(3) = size(data,dim=2) - n=3 - if (present(nt)) then - start(4) = nt; count(4) = 1 - n=4 - end if - else - count(2) = size(data,dim=2) - n=2 - if (present(nt)) then - start(3) = nt ; count(3) = 1 - n=3 - end if - end if - if (present(switchdim)) then - status = pio_get_var(ncid, vardesc, start(1:n), count(1:n), temp) - do j = lb2,ub2 - do i = lb1,ub1 - data(i,j) = temp(j,i) - end do - end do - else - status = pio_get_var(ncid, vardesc, start(1:n), count(1:n), data) - endif - else - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid,vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid, dids(ndims), dimname) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - if (present(switchdim)) then - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum, switchdim=.true.) - else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - end if - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - if (present(switchdim)) then - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status) - do j = lb2,ub2 - do i = lb1,ub1 - data(i,j) = temp(j,i) - end do - end do - else - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - end if - end if -#if ({ITYPE}!=TYPEINT) - if ( present(cnvrtnan2fill) )then - do j = lb2,ub2 - do i = lb1,ub1 - if ( data(i,j) == spval )then - data(i,j) = nan - end if - end do - end do - end if -#endif - end if - if (present(readvar)) readvar = varpresent - - else if (flag == 'write') then - - call ncd_inqvid(ncid, varname ,varid, vardesc) - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc , dids(1:ndims)) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - if (present(switchdim)) then - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum, switchdim=.true.) - else - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - end if - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - if (present(switchdim)) then - do j = lb2,ub2 - do i = lb1,ub1 - temp(j,i) = data(i,j) - end do - end do - end if -#if ({ITYPE}==TYPEINT) - if (present(switchdim)) then - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status, fillval=0) - else - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=0) - end if -#else - if (present(switchdim)) then - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, temp, status, fillval=spval) - else - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status, fillval=spval) - end if - if ( present(cnvrtnan2fill) )then - do j = lb2,ub2 - do i = lb1,ub1 - if ( isnan(data(i,j)) )then - data(i,j) = spval - end if - end do - end do - end if -#endif - - else - - if (masterproc) then - write(iulog,*) subname,' error: unsupported flag ',trim(flag) - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - - endif - - if (present(switchdim)) then - deallocate(temp) - end if - - end subroutine ncd_io_2d_{TYPE} - - !----------------------------------------------------------------------- - - !TYPE int,double - subroutine ncd_io_3d_{TYPE}(varname, data, dim1name, flag, ncid, nt, readvar) - ! - ! !DESCRIPTION: - ! Netcdf i/o of 3d - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - {VTYPE} , pointer :: data(:,:,:) ! local decomposition input data - character(len=*) , intent(in) :: dim1name ! dimension 1 name - integer, optional, intent(in) :: nt ! time sample index - logical, optional, intent(out) :: readvar ! true => variable is on initial dataset (read only) - ! - ! !LOCAL VARIABLES: - integer :: ndim1,ndim2 - character(len=8) :: clmlevel ! clmlevel - character(len=32) :: dimname ! temporary - integer :: status ! error status - integer :: ndims ! ndims total for var - integer :: ndims_iod ! ndims iodesc for var - integer :: varid ! varid - integer :: n ! index - integer :: dims(4) ! dim sizes - integer :: dids(4) ! dim ids - integer :: iodnum ! iodesc num in list - integer :: start(5) ! netcdf start index - integer :: count(5) ! netcdf count index - logical :: varpresent ! if true, variable is on tape - type(iodesc_plus_type) , pointer :: iodesc_plus - type(var_desc_t) :: vardesc - character(len=*),parameter :: subname='ncd_io_3d_{TYPE}' ! subroutine name - !----------------------------------------------------------------------- - - clmlevel = dim1name - - if (masterproc .and. debug > 1) then - write(iulog,*) trim(subname),' ',trim(flag),' ',trim(varname),' ',trim(clmlevel) - end if - - if (flag == 'read') then - - call ncd_inqvid(ncid, varname, varid, vardesc, readvar=varpresent) - if (varpresent) then - if (single_column) then - start(:) = 1 - count(:) = 1 - call scam_field_offsets(ncid, clmlevel, vardesc, start, count) - if (trim(clmlevel) == grlnd) then - count(3) = size(data,dim=2); - count(4) = size(data,dim=3) - n=4 - if (present(nt)) then - start(5) = nt - count(5) = 1 - n=5 - end if - else - count(2) = size(data,dim=2) - count(3) = size(data,dim=3) - n=3 - if (present(nt)) then - start(4) = nt - count(4) = 1 - n=4 - end if - end if - status = pio_get_var(ncid, vardesc, start(1:n), count(1:n), data) - else - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid,vardesc, dids(1:ndims)) - status = pio_inq_dimname(ncid, dids(ndims), dimname) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - call pio_read_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - end if - end if - if (present(readvar)) readvar = varpresent - - else if (flag == 'write') then - - call ncd_inqvid(ncid, varname ,varid, vardesc) - status = pio_inq_varndims(ncid, vardesc, ndims) - status = pio_inq_vardimid(ncid, vardesc , dids(1:ndims)) - if (ndims == 0) then - write(iulog,*) trim(subname),' ERROR: ndims must be greater than 0' - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - status = pio_inq_dimname(ncid,dids(ndims),dimname) - if ('time' == trim(dimname)) then - ndims_iod = ndims - 1 - else - ndims_iod = ndims - end if - do n = 1,ndims_iod - status = pio_inq_dimlen(ncid,dids(n),dims(n)) - enddo - call ncd_getiodesc(ncid, clmlevel, ndims_iod, dims(1:ndims_iod), dids(1:ndims_iod), & - PIO_{TYPE}, iodnum) - iodesc_plus => iodesc_list(iodnum) - if (present(nt)) then - call pio_setframe(ncid, vardesc, int(nt,kind=Pio_Offset_Kind)) - end if - call pio_write_darray(ncid, vardesc, iodesc_plus%iodesc, data, status) - - else - - if (masterproc) then - write(iulog,*) subname,' error: unsupported flag ',trim(flag) - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - - endif - - end subroutine ncd_io_3d_{TYPE} - - !------------------------------------------------------------------------ - - subroutine scam_field_offsets( ncid, dim1name, vardesc, start, count, & - found, posNOTonfile) - ! - ! !DESCRIPTION: - ! Read/Write initial data from/to netCDF instantaneous initial data file - ! - ! !USES: - use clm_varctl, only: scmlon,scmlat,single_column - use shr_scam_mod, only: shr_scam_getCloseLatLon - use shr_string_mod, only: shr_string_toLower - ! - ! !ARGUMENTS: - class(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: dim1name ! dimension 1 name - type(Var_desc_t) , intent(inout) :: vardesc ! variable descriptor - integer , intent(out) :: start(:) ! start index - integer , intent(out) :: count(:) ! count to retrieve - logical, optional , intent(out) :: found ! if present return true if found - ! dimensions on file else false if NOT present abort if can't find - logical, optional , intent(in) :: posNOTonfile ! Position is NOT on this file - ! - ! !LOCAL VARIABLES: - integer :: cc,i,ii ! index variable - integer :: data_offset ! offset into land array 1st column - integer :: ndata ! number of column (or pft points to read) - real(r8) , pointer :: cols1dlon(:) ! holds cols1d_ixy var - real(r8) , pointer :: cols1dlat(:) ! holds cols1d_jxy var - real(r8) , pointer :: pfts1dlon(:) ! holds pfts1d_ixy var - real(r8) , pointer :: pfts1dlat(:) ! holds pfts1d_jxy var - real(r8) , pointer :: land1dlon(:) ! holds land1d_ixy var - real(r8) , pointer :: land1dlat(:) ! holds land1d_jxy var - integer, allocatable :: cols(:) ! grid cell columns for scam - integer, allocatable :: pfts(:) ! grid cell pfts for scam - integer, allocatable :: landunits(:) ! grid cell landunits for scam - integer, allocatable :: dids(:) ! dim ids - integer :: varid ! netCDF variable id - integer :: status ! return code - integer :: latidx,lonidx ! latitude/longitude indices - real(r8) :: closelat,closelon ! closest latitude and longitude indices - integer :: ndims,dimlen ! number of dimensions in desired variable - character(len=32) :: dimname ! dimension name - character(len=32) :: subname = 'scam_field_offsets' - !------------------------------------------------------------------------ - - start(:)=1 - count(:)=1 - - if ( present(posNOTonfile) )then - if ( posNOTonfile )then - if ( .not. present(found) )then - call shr_sys_abort('ERROR: Bad subroutine calling structure posNOTonfile sent, but found was NOT!'//& - errMsg(__FILE__, __LINE__)) - end if - found = .false. - return - end if - end if - - ! find closest land grid cell for this point - - if ( present(found) )then - call shr_scam_getCloseLatLon(ncid,scmlat,scmlon,closelat,closelon,latidx,lonidx,found) - if ( .not. found ) return - else - call shr_scam_getCloseLatLon(ncid,scmlat,scmlon,closelat,closelon,latidx,lonidx) - end if - - call ncd_inqvdims(ncid,ndims,vardesc) - - allocate(dids(ndims)) - status = pio_inq_vardimid(ncid, vardesc, dids) - do i = 1,ndims - status = pio_inq_dimname(ncid,dids(i),dimname) - dimname=shr_string_toLower(dimname) - status = pio_inq_dimlen(ncid,dids(i),dimlen) - if ( trim(dimname)=='nj'.or. trim(dimname)=='lat'.or. trim(dimname)=='lsmlat') then - start(i)=latidx - count(i)=1 - else if ( trim(dimname)=='ni'.or. trim(dimname)=='lon'.or. trim(dimname)=='lsmlon') then - start(i)=lonidx - count(i)=1 - else if ( trim(dimname)=='column') then - - allocate (cols1dlon(dimlen)) - allocate (cols1dlat(dimlen)) - allocate (cols(dimlen)) - - status = pio_inq_varid(ncid, 'cols1d_lon', varid) - status = pio_get_var(ncid, varid, cols1dlon) - status = pio_inq_varid(ncid, 'cols1d_lat', varid) - status = pio_get_var(ncid, varid, cols1dlat) - - cols(:) = huge(1) - data_offset = huge(1) - ii = 1 - ndata = 0 - do cc = 1, dimlen - if (cols1dlon(cc) == closelon.and.cols1dlat(cc) == closelat) then - cols(ii)=cc - ndata =ii - ii=ii+1 - end if - end do - if (ndata == 0) then - write(iulog,*)'couldnt find any columns for this latitude ',latidx,' and longitude ',lonidx - call shr_sys_abort('ERROR:: no columns for this position'//errMsg(__FILE__, __LINE__)) - else - data_offset=cols(1) - end if - - deallocate (cols1dlon) - deallocate (cols1dlat) - deallocate (cols) - - start(i) = data_offset - count(i) = ndata - else if ( trim(dimname)=='pft') then - - allocate (pfts1dlon(dimlen)) - allocate (pfts1dlat(dimlen)) - allocate (pfts(dimlen)) - - status = pio_inq_varid(ncid, 'pfts1d_lon', varid) - status = pio_get_var(ncid, varid, pfts1dlon) - - status = pio_inq_varid(ncid, 'pfts1d_lat', varid) - status = pio_get_var(ncid, varid, pfts1dlat) - - pfts(:) = huge(1) - data_offset = huge(1) - ii = 1 - ndata = 0 - do cc = 1, dimlen - if (pfts1dlon(cc) == closelon.and.pfts1dlat(cc) == closelat) then - pfts(ii)=cc - ndata =ii - ii=ii+1 - end if - end do - if (ndata == 0) then - write(iulog,*)'couldnt find any pfts for this latitude ',closelat,' and longitude ',closelon - call shr_sys_abort('ERROR:: no PFTs for this position'//errMsg(__FILE__, __LINE__)) - else - data_offset=pfts(1) - end if - - deallocate (pfts1dlon) - deallocate (pfts1dlat) - deallocate (pfts) - - start(i) = data_offset - count(i) = ndata - else if ( trim(dimname)=='landunit') then - - allocate (land1dlon(dimlen)) - allocate (land1dlat(dimlen)) - allocate (landunits(dimlen)) - - status = pio_inq_varid(ncid, 'land1d_lon', varid) - status = pio_get_var(ncid, varid, land1dlon) - - status = pio_inq_varid(ncid, 'land1d_lat', varid) - status = pio_get_var(ncid, varid, land1dlat) - - landunits(:) = huge(1) - data_offset = huge(1) - ii = 1 - ndata = 0 - do cc = 1, dimlen - if (land1dlon(cc) == closelon.and.land1dlat(cc) == closelat) then - landunits(ii)=cc - ndata =ii - ii=ii+1 - end if - end do - if (ndata == 0) then - write(iulog,*)'couldnt find any landunits for this latitude ',closelat,' and longitude ',closelon - call shr_sys_abort('ERROR:: no landunits for this position'//errMsg(__FILE__, __LINE__)) - else - data_offset=landunits(1) - end if - - deallocate (land1dlon) - deallocate (land1dlat) - deallocate (landunits) - - start(i) = data_offset - count(i) = ndata - else - start(i)=1 - count(i)=dimlen - end if - enddo - deallocate(dids) - - end subroutine scam_field_offsets - - !------------------------------------------------------------------------ - - subroutine ncd_getiodesc(ncid, clmlevel, ndims, dims, dimids, & - xtype, iodnum, switchdim) - ! - ! !DESCRIPTION: - ! Returns an index to an io descriptor - ! - ! !ARGUMENTS: - class(file_desc_t) , intent(inout) :: ncid ! PIO file descriptor - character(len=8) , intent(in) :: clmlevel ! clmlevel - integer , intent(in) :: ndims ! ndims for var - integer , intent(in) :: dims(:) ! dim sizes - integer , intent(in) :: dimids(:) ! dim ids - integer , intent(in) :: xtype ! file external type - integer , intent(out) :: iodnum ! iodesc num in list - logical,optional , intent(in) :: switchdim ! switch level dimension and first dim - ! - ! !LOCAL VARIABLES: - integer :: k,m,n,cnt ! indices - integer :: basetype ! pio basetype - integer :: gsmap_lsize ! local size of gsmap - integer :: gsmap_gsize ! global size of gsmap - integer :: fullsize ! size of entire array on cdf - integer :: gsize ! global size of clmlevel - integer :: vsize ! other dimensions - integer :: vsize1, vsize2 ! other dimensions - integer :: status ! error status - logical :: found ! true => found created iodescriptor - integer :: ndims_file ! temporary - character(len=64) dimname_file ! dimension name on file - character(len=64) dimname_iodesc ! dimension name from io descriptor - type(mct_gsMap),pointer :: gsmap ! global seg map - integer, pointer,dimension(:) :: gsmOP ! gsmap ordered points - integer(pio_offset_kind), pointer :: compDOF(:) - character(len=32) :: subname = 'ncd_getiodesc' - !------------------------------------------------------------------------ - - ! Determining if need to create a new io descriptor - n = 1 - found = .false. - do while (n <= num_iodesc .and. .not.found) - if (ndims == iodesc_list(n)%ndims .and. xtype == iodesc_list(n)%type) then - found = .true. - ! First found implies that dimension sizes are the same - do m = 1,ndims - if (dims(m) /= iodesc_list(n)%dims(m)) then - found = .false. - endif - enddo - ! If found - then also check that dimension names are equal - - ! dimension ids in iodescriptor are only used to query dimension - ! names associated with that iodescriptor - if (found) then - status = PIO_inquire(ncid, ndimensions=ndims_file) - do m = 1,ndims - status = PIO_inq_dimname(ncid,dimids(m),dimname_file) - if (iodesc_list(n)%dimids(m) > ndims_file) then - found = .false. - exit - else - status = PIO_inq_dimname(ncid,iodesc_list(n)%dimids(m),dimname_iodesc) - if (trim(dimname_file) /= trim(dimname_iodesc)) then - found = .false. - exit - end if - end if - end do - end if - if (found) then - iodnum = n - if (iodnum > num_iodesc) then - write(iulog,*) trim(subname),' ERROR: iodnum out of range ',iodnum,num_iodesc - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - RETURN - endif - endif - n = n + 1 - enddo - - ! Creating a new io descriptor - - if (ndims > 0) then - num_iodesc = num_iodesc + 1 - if (num_iodesc > max_iodesc) then - write(iulog,*) trim(subname),' ERROR num_iodesc gt max_iodesc ',max_iodesc - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - iodnum = num_iodesc - if (masterproc .and. debug > 1) then - write(iulog,*) trim(subname),' creating iodesc at iodnum,ndims,dims(1:ndims),xtype',& - iodnum,ndims,dims(1:ndims),xtype - endif - end if - - if (xtype == pio_double ) then - basetype = PIO_DOUBLE - else if (xtype == pio_real) then - basetype = PIO_DOUBLE - else if (xtype == pio_int) then - basetype = PIO_INT - else - write(iulog,*) trim(subname),'ERROR: no match for xtype = ',xtype - call shr_sys_abort(errMsg(__FILE__,__LINE__)) - end if - - call get_clmlevel_gsmap(clmlevel,gsmap) - gsize = get_clmlevel_gsize(clmlevel) - gsmap_lsize = mct_gsmap_lsize(gsmap,mpicom) - gsmap_gsize = mct_gsmap_gsize(gsmap) - - call mct_gsmap_orderedPoints(gsmap,iam,gsmOP) - - fullsize = 1 - do n = 1,ndims - fullsize = fullsize*dims(n) - enddo - - vsize = fullsize / gsize - if (mod(fullsize,gsize) /= 0) then - write(iulog,*) subname,' ERROR in vsize ',fullsize,gsize,vsize - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - endif - - allocate(compDOF(gsmap_lsize*vsize)) - - if (present(switchdim)) then - if (switchdim) then - cnt = 0 - do m = 1,gsmap_lsize - do n = 1,vsize - cnt = cnt + 1 - compDOF(cnt) = (gsmOP(m)-1)*vsize + n - enddo - enddo - else - write(iulog,*) subname,' ERROR switch dims present must have switchdim true' - call shr_sys_abort(errMsg(__FILE__, __LINE__)) - end if - else ! currently allow for up to two vertical dimensions - if (vsize /= 1 .and. vsize /= dims(ndims)) then - vsize1 = vsize/dims(ndims) - vsize2 = dims(ndims) - if (vsize1*vsize2 /= vsize) then - write(iulog,*)'vsize1= ',vsize1,' vsize2= ',vsize2,' vsize= ',vsize - call shr_sys_abort('error in vsize1 and vsize2 computation'//errMsg(__FILE__, __LINE__)) - end if - cnt = 0 - do k = 1,vsize2 - do n = 1,vsize1 - do m = 1,gsmap_lsize - cnt = cnt + 1 - compDOF(cnt) = (k-1)*vsize1*gsmap_gsize + (n-1)*gsmap_gsize + gsmOP(m) - enddo - enddo - end do - else - cnt = 0 - do n = 1,vsize - do m = 1,gsmap_lsize - cnt = cnt + 1 - compDOF(cnt) = (n-1)*gsmap_gsize + gsmOP(m) - enddo - enddo - end if - end if - - if (debug > 1) then - do m = 0,npes-1 - if (iam == m) then - write(iulog,*) trim(subname),' sizes1 = ',iam,gsize,gsmap_gsize,gsmap_lsize - write(iulog,*) trim(subname),' sizes2 = ',iam,fullsize,npes,vsize - write(iulog,*) trim(subname),' compDOF = ',iam,size(compDOF),minval(compDOF),maxval(compDOF) - call shr_sys_flush(iulog) - endif - call mpi_barrier(mpicom,status) - enddo - endif - - deallocate(gsmOP) - - call pio_initdecomp(pio_subsystem, baseTYPE, dims(1:ndims), compDOF, iodesc_list(iodnum)%iodesc ) - - - deallocate(compDOF) - - iodesc_list(iodnum)%type = xtype - iodesc_list(iodnum)%ndims = ndims - iodesc_list(iodnum)%dims = 0 - iodesc_list(iodnum)%dims(1:ndims) = dims(1:ndims) - iodesc_list(iodnum)%dimids(1:ndims) = dimids(1:ndims) - - end subroutine ncd_getiodesc - -end module ncdio_pio diff --git a/src_clm40/main/ndepStreamMod.F90 b/src_clm40/main/ndepStreamMod.F90 deleted file mode 100644 index 1baebdbf37..0000000000 --- a/src_clm40/main/ndepStreamMod.F90 +++ /dev/null @@ -1,284 +0,0 @@ -module ndepStreamMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: ndepStreamMod -! -! !DESCRIPTION: -! Contains methods for reading in nitrogen deposition data file -! Also includes functions for dynamic ndep file handling and -! interpolation. -! -! !USES - use shr_kind_mod, only: r8 => shr_kind_r8, CL => shr_kind_cl - use shr_strdata_mod - use shr_stream_mod - use shr_string_mod - use shr_sys_mod - use shr_mct_mod - use mct_mod - - use spmdMod , only: mpicom, masterproc, comp_id, iam - use clm_varctl , only: iulog - use controlMod , only: NLFilename - use abortutils , only: endrun - use fileutils , only: getavu, relavu - use decompMod , only: get_proc_bounds, ldecomp, gsmap_lnd_gdc2glo - use domainMod , only: ldomain - -! !PUBLIC TYPES: - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: - public :: ndep_init ! position datasets for dynamic ndep - public :: ndep_interp ! interpolates between two years of ndep file data - public :: clm_domain_mct ! Sets up MCT domain for this resolution -! -!EOP - -! ! PRIVATE TYPES - - type(shr_strdata_type) :: sdat ! input data stream - integer :: stream_year_first_ndep ! first year in stream to use - integer :: stream_year_last_ndep ! last year in stream to use - integer :: model_year_align_ndep ! align stream_year_firstndep with - -!======================================================================= -contains -!======================================================================= - - subroutine ndep_init( ) - - !----------------------------------------------------------------------- - ! Initialize data stream information. - !----------------------------------------------------------------------- - ! Uses: - use clm_varctl , only : inst_name - use clm_time_manager , only : get_calendar - use ncdio_pio , only : pio_subsystem - use shr_pio_mod , only : shr_pio_getiotype - use shr_nl_mod , only : shr_nl_find_group_name - ! arguments - implicit none - - ! local variables - integer :: nu_nml ! unit for namelist file - integer :: nml_error ! namelist i/o error flag - type(mct_ggrid) :: dom_clm ! domain information - character(len=CL) :: stream_fldFileName_ndep - character(len=CL) :: ndepmapalgo = 'bilinear' - character(*), parameter :: shr_strdata_unset = 'NOT_SET' - character(*), parameter :: subName = "('ndepdyn_init')" - character(*), parameter :: F00 = "('(ndepdyn_init) ',4a)" - !----------------------------------------------------------------------- - - namelist /ndepdyn_nml/ & - stream_year_first_ndep, & - stream_year_last_ndep, & - model_year_align_ndep, & - ndepmapalgo, & - stream_fldFileName_ndep - - ! Default values for namelist - stream_year_first_ndep = 1 ! first year in stream to use - stream_year_last_ndep = 1 ! last year in stream to use - model_year_align_ndep = 1 ! align stream_year_first_ndep with this model year - stream_fldFileName_ndep = ' ' - - ! Read ndepdyn_nml namelist - if (masterproc) then - nu_nml = getavu() - open( nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) - call shr_nl_find_group_name(nu_nml, 'ndepdyn_nml', status=nml_error) - if (nml_error == 0) then - read(nu_nml, nml=ndepdyn_nml,iostat=nml_error) - if (nml_error /= 0) then - call endrun(subname // ':: ERROR reading ndepdyn_nml namelist') - end if - end if - close(nu_nml) - call relavu( nu_nml ) - endif - - call shr_mpi_bcast(stream_year_first_ndep, mpicom) - call shr_mpi_bcast(stream_year_last_ndep, mpicom) - call shr_mpi_bcast(model_year_align_ndep, mpicom) - call shr_mpi_bcast(stream_fldFileName_ndep, mpicom) - - if (masterproc) then - write(iulog,*) ' ' - write(iulog,*) 'ndepdyn stream settings:' - write(iulog,*) ' stream_year_first_ndep = ',stream_year_first_ndep - write(iulog,*) ' stream_year_last_ndep = ',stream_year_last_ndep - write(iulog,*) ' model_year_align_ndep = ',model_year_align_ndep - write(iulog,*) ' stream_fldFileName_ndep = ',stream_fldFileName_ndep - write(iulog,*) ' ' - endif - - call clm_domain_mct (dom_clm) - - call shr_strdata_create(sdat,name="clmndep", & - pio_subsystem=pio_subsystem, & - pio_iotype=shr_pio_getiotype(inst_name), & - mpicom=mpicom, compid=comp_id, & - gsmap=gsmap_lnd_gdc2glo, ggrid=dom_clm, & - nxg=ldomain%ni, nyg=ldomain%nj, & - yearFirst=stream_year_first_ndep, & - yearLast=stream_year_last_ndep, & - yearAlign=model_year_align_ndep, & - offset=0, & - domFilePath='', & - domFileName=trim(stream_fldFileName_ndep), & - domTvarName='time', & - domXvarName='lon' , & - domYvarName='lat' , & - domAreaName='area', & - domMaskName='mask', & - filePath='', & - filename=(/trim(stream_fldFileName_ndep)/),& - fldListFile='NDEP_year', & - fldListModel='NDEP_year', & - fillalgo='none', & - mapalgo=ndepmapalgo, & - calendar=get_calendar(), & - taxmode='extend' ) - - if (masterproc) then - call shr_strdata_print(sdat,'CLMNDEP data') - endif - - end subroutine ndep_init - -!================================================================ - - subroutine ndep_interp( ) - - !----------------------------------------------------------------------- - use decompMod , only : get_proc_bounds - use clm_time_manager, only : get_curr_date, get_days_per_year - use clm_varcon , only : secspday - use clm_atmlnd , only : clm_a2l - - ! Local variables - implicit none - integer :: g, ig, begg, endg - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: mcdate ! Current model date (yyyymmdd) - integer :: dayspyr ! days per year - !----------------------------------------------------------------------- - - call get_curr_date(year, mon, day, sec) - mcdate = year*10000 + mon*100 + day - - call shr_strdata_advance(sdat, mcdate, sec, mpicom, 'ndepdyn') - - call get_proc_bounds(begg, endg) - ig = 0 - dayspyr = get_days_per_year( ) - do g = begg,endg - ig = ig+1 - clm_a2l%forc_ndep(g) = sdat%avs(1)%rAttr(1,ig) / (secspday * dayspyr) - end do - - end subroutine ndep_interp - -!============================================================================== - - subroutine clm_domain_mct( dom_clm ) - - !------------------------------------------------------------------- - ! Set domain data type for internal clm grid - use clm_varcon , only : re - use domainMod , only : ldomain - use seq_flds_mod - implicit none - ! - ! arguments - type(mct_ggrid), intent(out) :: dom_clm ! Output domain information for land model - ! - ! local variables - integer :: g,i,j ! index - integer :: begg, endg ! beginning and ending gridcell indices - integer :: lsize ! land model domain data size - real(r8), pointer :: data(:) ! temporary - integer , pointer :: idata(:) ! temporary - !------------------------------------------------------------------- - ! - ! Initialize mct domain type - ! lat/lon in degrees, area in radians^2, mask is 1 (land), 0 (non-land) - ! Note that in addition land carries around landfrac for the purposes of domain checking - ! - lsize = mct_gsMap_lsize(gsmap_lnd_gdc2glo, mpicom) - call mct_gGrid_init( GGrid=dom_clm, CoordChars=trim(seq_flds_dom_coord), & - OtherChars=trim(seq_flds_dom_other), lsize=lsize ) - ! - ! Allocate memory - ! - allocate(data(lsize)) - ! - ! Determine global gridpoint number attribute, GlobGridNum, which is set automatically by MCT - ! - call mct_gsMap_orderedPoints(gsmap_lnd_gdc2glo, iam, idata) - call mct_gGrid_importIAttr(dom_clm,'GlobGridNum',idata,lsize) - ! - ! Determine domain (numbering scheme is: West to East and South to North to South pole) - ! Initialize attribute vector with special value - ! - data(:) = -9999.0_R8 - call mct_gGrid_importRAttr(dom_clm,"lat" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"lon" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"area" ,data,lsize) - call mct_gGrid_importRAttr(dom_clm,"aream",data,lsize) - data(:) = 0.0_R8 - call mct_gGrid_importRAttr(dom_clm,"mask" ,data,lsize) - ! - ! Determine bounds - ! - call get_proc_bounds(begg, endg) - ! - ! Fill in correct values for domain components - ! Note aream will be filled in in the atm-lnd mapper - ! - do g = begg,endg - i = 1 + (g - begg) - data(i) = ldomain%lonc(g) - end do - call mct_gGrid_importRattr(dom_clm,"lon",data,lsize) - - do g = begg,endg - i = 1 + (g - begg) - data(i) = ldomain%latc(g) - end do - call mct_gGrid_importRattr(dom_clm,"lat",data,lsize) - - do g = begg,endg - i = 1 + (g - begg) - data(i) = ldomain%area(g)/(re*re) - end do - call mct_gGrid_importRattr(dom_clm,"area",data,lsize) - - do g = begg,endg - i = 1 + (g - begg) - data(i) = real(ldomain%mask(g), r8) - end do - call mct_gGrid_importRattr(dom_clm,"mask",data,lsize) - - do g = begg,endg - i = 1 + (g - begg) - data(i) = real(ldomain%frac(g), r8) - end do - call mct_gGrid_importRattr(dom_clm,"frac",data,lsize) - - deallocate(data) - deallocate(idata) - - end subroutine clm_domain_mct - -end module ndepStreamMod - diff --git a/src_clm40/main/organicFileMod.F90 b/src_clm40/main/organicFileMod.F90 deleted file mode 100644 index 0e7ff0888f..0000000000 --- a/src_clm40/main/organicFileMod.F90 +++ /dev/null @@ -1,113 +0,0 @@ -module organicFileMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: organicFileMod -! -! !DESCRIPTION: -! Contains methods for reading in organic matter data file which has -! organic matter density for each grid point and soil level -! -! !USES - use abortutils , only : endrun - use clm_varctl , only : iulog - use shr_kind_mod , only : r8 => shr_kind_r8 -! -! !PUBLIC TYPES: - implicit none - private - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: organicrd ! Read organic matter dataset -! -! !REVISION HISTORY: -! Created by David Lawrence, 4 May 2006 -! Revised by David Lawrence, 21 September 2007 -! Revised by David Lawrence, 14 October 2008 -! -!EOP -! -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: organicrd -! -! !INTERFACE: - subroutine organicrd(organic) -! -! !DESCRIPTION: -! Read the organic matter dataset. -! -! !USES: - use clm_varctl , only : fsurdat, single_column - use fileutils , only : getfil - use spmdMod , only : masterproc - use clmtype , only : grlnd - use domainMod , only : ldomain - use ncdio_pio -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: organic(:,:) ! organic matter density (kg/m3) -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by David Lawrence, 4 May 2006 -! Revised by David Lawrence, 21 September 2007 -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: locfn ! local file name - type(file_desc_t) :: ncid ! netcdf id - integer :: ni,nj,ns ! dimension sizes - logical :: isgrid2d ! true => file is 2d - logical :: readvar ! true => variable is on dataset - character(len=32) :: subname = 'organicrd' ! subroutine name -!----------------------------------------------------------------------- - - ! Initialize data to zero - no organic matter dataset - - organic(:,:) = 0._r8 - - ! Read data if file was specified in namelist - - if (fsurdat /= ' ') then - if (masterproc) then - write(iulog,*) 'Attempting to read organic matter data .....' - write(iulog,*) subname,trim(fsurdat) - end if - - call getfil (fsurdat, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - call ncd_inqfdims (ncid, isgrid2d, ni, nj, ns) - if (ldomain%ns /= ns .or. ldomain%ni /= ni .or. ldomain%nj /= nj) then - write(iulog,*)trim(subname), 'ldomain and input file do not match dims ' - write(iulog,*)trim(subname), 'ldomain%ni,ni,= ',ldomain%ni,ni - write(iulog,*)trim(subname), 'ldomain%nj,nj,= ',ldomain%nj,nj - write(iulog,*)trim(subname), 'ldomain%ns,ns,= ',ldomain%ns,ns - call endrun() - end if - - call ncd_io(ncid=ncid, varname='ORGANIC', flag='read', data=organic, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun('organicrd: errror reading ORGANIC') - - if ( masterproc )then - write(iulog,*) 'Successfully read organic matter data' - write(iulog,*) - end if - endif - - end subroutine organicrd - -end module organicFileMod diff --git a/src_clm40/main/pft2colMod.F90 b/src_clm40/main/pft2colMod.F90 deleted file mode 100644 index 6927cffa9c..0000000000 --- a/src_clm40/main/pft2colMod.F90 +++ /dev/null @@ -1,143 +0,0 @@ - -module pft2colMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: pft2colMod -! -! !DESCRIPTION: -! Contains calls to methods to perfom averages over from pfts to columns -! for model variables. -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use subgridAveMod - use clmtype -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: p2c ! obtain column properties from average over column pfts -! -! !REVISION HISTORY: -! 03/09/08: Created by Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: pft2col -! -! !INTERFACE: - subroutine pft2col (lbc, ubc, num_nolakec, filter_nolakec) -! -! !DESCRIPTION: -! Averages over all pfts for variables defined over both soil and lake -! to provide the column-level averages of state and flux variables -! defined at the pft level. -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: lbc, ubc ! column bounds - integer, intent(in) :: num_nolakec ! number of column non-lake points in column filter - integer, intent(in) :: filter_nolakec(ubc-lbc+1) ! column filter for non-lake points -! -! !REVISION HISTORY: -! 03/09/08: Created by Mariana Vertenstein -! -! -! !OTHER LOCAL VARIABLES: -!EOP - integer :: c,fc ! indices - integer :: num_allc ! number of total column points - integer :: filter_allc(ubc-lbc+1) ! filter for all column points - real(r8), pointer :: ptrp(:) ! pointer to input pft array - real(r8), pointer :: ptrc(:) ! pointer to output column array -! ----------------------------------------------------------------- - - ! Set up a filter for all column points - - num_allc = ubc-lbc+1 - fc = 0 - do c = lbc,ubc - fc = fc + 1 - filter_allc(fc) = c - end do - - ! Note: lake points are excluded from many of the following averages. For some fields, - ! this is because the field doesn't apply over lakes. However, for many others, this - ! is because the field is computed in HydrologyLake, which is called after this - ! routine; thus, for lakes, the column-level values of these fields are explicitly set - ! in HydrologyLakeMod. (The fields that are included here for lakes are computed - ! elsewhere, e.g., in BiogeophysicsLake.) - - ! Averaging for pft water state variables - - ptrp => pws%h2ocan - ptrc => pws_a%h2ocan - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ! Averaging for pft water flux variables - - ptrp => pwf%qflx_evap_tot - ptrc => pwf_a%qflx_evap_tot - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_rain_grnd - ptrc => pwf_a%qflx_rain_grnd - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_snow_grnd - ptrc => pwf_a%qflx_snow_grnd - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_snwcp_liq - ptrc => pwf_a%qflx_snwcp_liq - call p2c (num_allc, filter_allc, ptrp, ptrc) - - ptrp => pwf%qflx_snwcp_ice - ptrc => pwf_a%qflx_snwcp_ice - ! For lakes, this field is initially set in BiogeophysicsLake (which is called before - ! this routine; hence it is appropriate to include lake columns in this p2c call). - ! However, it is later overwritten in HydrologyLake, both on the pft and the column - ! level. - call p2c (num_allc, filter_allc, ptrp, ptrc) - - ptrp => pwf%qflx_tran_veg - ptrc => pwf_a%qflx_tran_veg - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_evap_grnd - ptrc => pwf_a%qflx_evap_grnd - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_evap_soi - ptrc => pwf_a%qflx_evap_soi - call p2c (num_allc, filter_allc, ptrp, ptrc) - - ptrp => pwf%qflx_prec_grnd - ptrc => pwf_a%qflx_prec_grnd - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_dew_grnd - ptrc => pwf_a%qflx_dew_grnd - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_sub_snow - ptrc => pwf_a%qflx_sub_snow - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - ptrp => pwf%qflx_dew_snow - ptrc => pwf_a%qflx_dew_snow - call p2c (num_nolakec, filter_nolakec, ptrp, ptrc) - - end subroutine pft2col - -end module pft2colMod diff --git a/src_clm40/main/pftdynMod.F90 b/src_clm40/main/pftdynMod.F90 deleted file mode 100644 index 42784bd835..0000000000 --- a/src_clm40/main/pftdynMod.F90 +++ /dev/null @@ -1,3224 +0,0 @@ -module pftdynMod - -!--------------------------------------------------------------------------- -!BOP -! -! !MODULE: pftdynMod -! -! !USES: - use spmdMod - use clmtype - use decompMod , only : get_proc_bounds - use clm_varsur , only : pctspec - use clm_varpar , only : max_pft_per_col - use clm_varctl , only : iulog, use_c13, use_cn, use_cndv - use shr_sys_mod , only : shr_sys_flush - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use ncdio_pio , only : file_desc_t, ncd_pio_openfile, ncd_inqdid, ncd_inqdlen, ncd_io, check_dim -! -! !DESCRIPTION: -! Determine pft weights at current time using dynamic landuse datasets. -! ASSUMES that only have one dynamic landuse dataset. -! -! !PUBLIC TYPES: - implicit none - private - save - public :: pftdyn_init - public :: pftdyn_interp - public :: pftdyn_wbal_init - public :: pftdyn_wbal - public :: pftdyn_cnbal - public :: pftwt_init - public :: pftwt_interp - public :: CNHarvest - public :: CNHarvestPftToColumn -! -! !REVISION HISTORY: -! Created by Peter Thornton -! slevis modified to handle CNDV and crop model -! 19 May 2009: PET - modified to handle harvest fluxes -! -!EOP -! -! ! PRIVATE TYPES - integer , pointer :: yearspft(:) - real(r8), pointer :: wtpft1(:,:) - real(r8), pointer :: wtpft2(:,:) - real(r8), pointer :: harvest(:) - real(r8), pointer :: wtcol_old(:) - integer :: nt1 - integer :: nt2 - integer :: ntimes - logical :: do_harvest - type(file_desc_t) :: ncid ! netcdf id -!--------------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_init -! -! !INTERFACE: - subroutine pftdyn_init() -! -! !DESCRIPTION: -! Initialize dynamic landuse dataset (position it to the right time samples -! that bound the initial model date) -! -! !USES: - use clm_time_manager, only : get_curr_date - use clm_varctl , only : flanduse_timeseries - use clm_varpar , only : numpft, maxpatch_pft - use fileutils , only : getfil -! -! !ARGUMENTS: - implicit none -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i,j,m,n,g ! indices - real(r8) :: sumpct ! sum for error check - integer :: varid ! netcdf ids - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - integer :: ier, ret ! error status - logical :: found ! true => input dataset bounding dates found - logical :: readvar ! true => variable is on input dataset - integer :: begg,endg ! beg/end indices for land gridcells - integer :: begl,endl ! beg/end indices for land landunits - integer :: begc,endc ! beg/end indices for land columns - integer :: begp,endp ! beg/end indices for land pfts - real(r8), pointer :: pctgla(:) ! percent of gcell is glacier - real(r8), pointer :: pctlak(:) ! percent of gcell is lake - real(r8), pointer :: pctwet(:) ! percent of gcell is wetland - real(r8), pointer :: pcturb(:) ! percent of gcell is urbanized - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - character(len=256) :: locfn ! local file name - character(len= 32) :: subname='pftdyn_init' ! subroutine name - !----------------------------------------------------------------------- - - call get_proc_bounds(begg,endg,begl,endl,begc,endc,begp,endp) - - ! Error check - - if ( maxpatch_pft /= numpft+1 )then - call endrun( subname//' maxpatch_pft does NOT equal numpft+1 -- this is invalid for dynamic PFT case' ) - end if - - allocate(pctgla(begg:endg),pctlak(begg:endg)) - allocate(pctwet(begg:endg),pcturb(begg:endg)) - - ! Set pointers into derived type - - gptr => grc - - ! pctspec must be saved between time samples - ! position to first time sample - assume that first time sample must match starting date - ! check consistency - special landunits, grid, frac and mask - ! only do this once - - ! read data PCT_PFT corresponding to correct year - - allocate(wtpft1(begg:endg,0:numpft), wtpft2(begg:endg,0:numpft), stat=ier) - if (ier /= 0) then - call endrun( subname//' allocation error for wtpft1, wtpft2' ) - end if - - allocate(harvest(begg:endg),stat=ier) - if (ier /= 0) then - call endrun( subname//' allocation error for harvest') - end if - - allocate(wtcol_old(begp:endp),stat=ier) - if (ier /= 0) then - call endrun( subname//' allocation error for wtcol_old' ) - end if - - if (masterproc) then - write(iulog,*) 'Attempting to read pft dynamic landuse data .....' - end if - - ! Obtain file - call getfil (flanduse_timeseries, locfn, 0) - call ncd_pio_openfile (ncid, locfn, 0) - - ! Obtain pft years from dynamic landuse file - - call ncd_inqdid(ncid, 'time', varid) - call ncd_inqdlen(ncid, varid, ntimes) - - ! Consistency check - - call check_dim(ncid, 'lsmpft', numpft+1) - - allocate (yearspft(ntimes), stat=ier) - if (ier /= 0) then - write(iulog,*) subname//' allocation error for yearspft'; call endrun() - end if - - call ncd_io(ncid=ncid, varname='YEAR', flag='read', data=yearspft) - - call ncd_io(ncid=ncid, varname='PCT_WETLAND', flag='read', data=pctwet, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_WETLAND NOT on landuse_timeseries file' ) - - call ncd_io(ncid=ncid, varname= 'PCT_LAKE', flag='read', data=pctlak, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_LAKE NOT on landuse_timeseries file' ) - - call ncd_io(ncid=ncid, varname= 'PCT_GLACIER', flag='read', data=pctgla, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_GLACIER NOT on landuse_timeseries file' ) - - call ncd_io(ncid=ncid, varname= 'PCT_URBAN' , flag='read', data=pcturb, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_URBAN NOT on landuse_timeseries file' ) - - ! Consistency check - do g = begg,endg - ! this was causing a fail, even though values are the same to within 1e-15 - ! if (pctlak(g)+pctwet(g)+pcturb(g)+pctgla(g) /= pctspec(g)) then - if (abs((pctlak(g)+pctwet(g)+pcturb(g)+pctgla(g))-pctspec(g)) > 1e-13_r8) then - write(iulog,*) subname//'mismatch between input pctspec = ',& - pctlak(g)+pctwet(g)+pcturb(g)+pctgla(g),& - ' and that obtained from surface dataset ', pctspec(g),' at g= ',g - call endrun() - end if - end do - - ! Determine if current date spans the years - ! If current year is less than first dynamic PFT timeseries year, - ! then use the first year from dynamic pft file for both nt1 and nt2, - ! forcing constant weights until the model year enters the dynamic - ! pft dataset timeseries range. - ! If current year is equal to or greater than the last dynamic pft - ! timeseries year, then use the last year for both nt1 and nt2, - ! forcing constant weights for the remainder of the simulation. - ! This mechanism permits the introduction of a dynamic pft period in the middle - ! of a simulation, with constant weights before and after the dynamic period. - ! PET: harvest - since harvest is specified as a rate for each year, this - ! approach will not work. Instead, need to seta flag that indicates harvest is - ! zero for the period before the beginning and after the end of the dynpft timeseries. - - call get_curr_date(year, mon, day, sec) - - if (year < yearspft(1)) then - nt1 = 1 - nt2 = 1 - do_harvest = .false. - else if (year >= yearspft(ntimes)) then - nt1 = ntimes - nt2 = ntimes - do_harvest = .false. - else - found = .false. - do n = 1,ntimes-1 - if (year == yearspft(n)) then - nt1 = n - nt2 = nt1 + 1 - found = .true. - do_harvest = .true. - end if - end do - if (.not. found) then - write(iulog,*) subname//' error: model year not found in landuse_timeseries file' - write(iulog,*)'model year = ',year - call endrun() - end if - end if - - ! Get pctpft time samples bracketing the current time - - if (masterproc) then - write(iulog,*) 'Get PFTDYN data for year: ', yearspft(nt1) - end if - call pftdyn_getdata(nt1, wtpft1, begg,endg,0,numpft) - if (masterproc) then - write(iulog,*) 'Get PFTDYN data for year: ', yearspft(nt2) - end if - call pftdyn_getdata(nt2, wtpft2, begg,endg,0,numpft) - - if (use_cn) then - ! Get harvest rate at the nt1 time - call pftdyn_getharvest(nt1,begg,endg) - end if - - ! convert weights from percent to proportion - do m = 0,numpft - do g = begg,endg - wtpft1(g,m) = wtpft1(g,m)/100._r8 - wtpft2(g,m) = wtpft2(g,m)/100._r8 - end do - end do - - deallocate(pctgla,pctlak,pctwet,pcturb) - - end subroutine pftdyn_init - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_interp -! -! !INTERFACE: - subroutine pftdyn_interp() -! -! !DESCRIPTION: -! Time interpolate dynamic landuse data to get pft weights for model time -! Note that harvest data are stored as rates (not weights) and so time interpolation is -! not necessary - the harvest rate is held constant through the year. This is consistent with -! the treatment of changing PFT weights, where interpolation of the annual endpoint weights leads to -! a constant rate of change in PFT weight through the year, with abrupt changes in the rate at -! annual boundaries. This routine is still used to get the next harvest time slice, when needed. -! This routine is also used to turn off the harvest switch when the model year runs past the end of -! the dynpft time series. -! -! !USES: - use clm_time_manager, only : get_curr_date, get_curr_calday, & - get_days_per_year - use clm_varcon , only : istsoil - use clm_varcon , only : istcrop - use clm_varpar , only : numpft - implicit none -! -! -! !LOCAL VARIABLES: -!EOP -! -! !ARGUMENTS: - integer :: begg,endg ! beg/end indices for land gridcells - integer :: begl,endl ! beg/end indices for land landunits - integer :: begc,endc ! beg/end indices for land columns - integer :: begp,endp ! beg/end indices for land pfts - integer :: i,j,m,p,l,g,c ! indices - integer :: year ! year (0, ...) for nstep+1 - integer :: mon ! month (1, ..., 12) for nstep+1 - integer :: day ! day of month (1, ..., 31) for nstep+1 - integer :: sec ! seconds into current date for nstep+1 - real(r8) :: cday ! current calendar day (1.0 = 0Z on Jan 1) - real(r8) :: days_per_year ! days per year - integer :: ier ! error status - integer :: lbc,ubc - real(r8) :: wt1 ! time interpolation weights - real(r8), pointer :: wtpfttot1(:) ! summation of pft weights for renormalization - real(r8), pointer :: wtpfttot2(:) ! summation of pft weights for renormalization - real(r8), parameter :: wtpfttol = 1.e-10 ! tolerance for pft weight renormalization - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - character(len=32) :: subname='pftdyn_interp' ! subroutine name -!----------------------------------------------------------------------- - - call get_proc_bounds(begg,endg,begl,endl,begc,endc,begp,endp) - - ! Set pointers into derived type - - gptr => grc - lptr => lun - pptr => pft - - allocate(wtpfttot1(begc:endc),wtpfttot2(begc:endc)) - wtpfttot1(:) = 0._r8 - wtpfttot2(:) = 0._r8 - - ! Interpolat pctpft to current time step - output in pctpft_intp - ! Map interpolated pctpft to subgrid weights - ! assumes that maxpatch_pft = numpft + 1, that each landunit has only 1 column, - ! SCAM and CNDV have not been defined, and create_croplandunit = .false. - - ! If necessary, obtain new time sample - - ! Get current date - - call get_curr_date(year, mon, day, sec) - - ! Obtain new time sample if necessary. - ! The first condition is the regular crossing of a year boundary - ! when within the dynpft timeseries range. The second condition is - ! the case of the first entry into the dynpft timeseries range from - ! an earlier period of constant weights. - - if (year > yearspft(nt1) .or. (nt1 == 1 .and. nt2 == 1 .and. year == yearspft(1))) then - - if (year >= yearspft(ntimes)) then - nt1 = ntimes - nt2 = ntimes - else - nt1 = nt2 - nt2 = nt2 + 1 - do_harvest = .true. - end if - - if (year > yearspft(ntimes)) then - do_harvest = .false. - endif - - if (nt2 > ntimes .and. masterproc) then - write(iulog,*)subname,' error - current year is past input data boundary' - end if - - do m = 0,numpft - do g = begg,endg - wtpft1(g,m) = wtpft2(g,m) - end do - end do - - if (masterproc) then - write(iulog,*) 'Get PFTDYN data for year: ', yearspft(nt2) - end if - call pftdyn_getdata(nt2, wtpft2, begg,endg,0,numpft) - if (use_cn) then - call pftdyn_getharvest(nt1,begg,endg) - end if - - do m = 0,numpft - do g = begg,endg - wtpft2(g,m) = wtpft2(g,m)/100._r8 - end do - end do - - end if ! end of need new data if-block - - ! Interpolate pft weight to current time - - cday = get_curr_calday() - days_per_year = get_days_per_year() - - wt1 = ((days_per_year + 1._r8) - cday)/days_per_year - - do p = begp,endp - c = pptr%column(p) - g = pptr%gridcell(p) - l = pptr%landunit(p) - if (lptr%itype(l) == istsoil .or. lptr%itype(l) == istcrop) then - m = pptr%itype(p) - wtcol_old(p) = pptr%wtcol(p) -! --- recoded for roundoff performance, tcraig 3/07 from k.lindsay -! pptr%wtgcell(p) = wtpft1(g,m)*wt1 + wtpft2(g,m)*wt2 - wtpfttot1(c) = wtpfttot1(c)+pptr%wtgcell(p) - pptr%wtgcell(p) = wtpft2(g,m) + wt1*(wtpft1(g,m)-wtpft2(g,m)) - pptr%wtlunit(p) = pptr%wtgcell(p) / lptr%wtgcell(l) - pptr%wtcol(p) = pptr%wtgcell(p) / lptr%wtgcell(l) - wtpfttot2(c) = wtpfttot2(c)+pptr%wtgcell(p) - end if - - end do - -! Renormalize pft weights so that sum of pft weights relative to grid cell -! remain constant even as land cover changes. Doing this eliminates -! soil balance error warnings. (DML, 4/8/2009) - do p = begp,endp - c = pptr%column(p) - g = pptr%gridcell(p) - l = pptr%landunit(p) - if (lptr%itype(l) == istsoil .or. lptr%itype(l) == istcrop) then - if (wtpfttot2(c) /= 0 .and. & - abs(wtpfttot1(c)-wtpfttot2(c)) > wtpfttol) then - pptr%wtgcell(p) = (wtpfttot1(c)/wtpfttot2(c))*pptr%wtgcell(p) - pptr%wtlunit(p) = pptr%wtgcell(p) / lptr%wtgcell(l) - pptr%wtcol(p) = pptr%wtgcell(p) / lptr%wtgcell(l) - end if - end if - - end do - - deallocate(wtpfttot1,wtpfttot2) - - end subroutine pftdyn_interp - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_getdata -! -! !INTERFACE: - subroutine pftdyn_getdata(ntime, pctpft, begg, endg, pft0, maxpft) -! -! !DESCRIPTION: -! Obtain dynamic landuse data (pctpft) and make sure that -! percentage of PFTs sum to 100% cover for vegetated landunit -! -! !USES: - use clm_varpar , only : numpft -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: ntime - integer , intent(in) :: begg,endg,pft0,maxpft - real(r8), intent(out) :: pctpft(begg:endg,pft0:maxpft) -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i,j,m,n - integer :: err, ierr, ret - real(r8) :: sumpct,sumerr ! temporary - real(r8), pointer :: arrayl(:,:) ! temporary array - logical :: readvar - - character(len=32) :: subname='pftdyn_getdata' ! subroutine name -!----------------------------------------------------------------------- - - allocate(arrayl(begg:endg,pft0:maxpft)) - call ncd_io(ncid=ncid, varname= 'PCT_PFT', flag='read', data=arrayl, & - dim1name=grlnd, nt=ntime, readvar=readvar) - pctpft(begg:endg,pft0:maxpft) = arrayl(begg:endg,pft0:maxpft) - deallocate(arrayl) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_PFT NOT on pftdyn file' ) - - err = 0 - do n = begg,endg - if (pctspec(n) < 100._r8) then - sumpct = 0._r8 - do m = 0, numpft - sumpct = sumpct + pctpft(n,m) * 100._r8/(100._r8-pctspec(n)) - end do - if (abs(sumpct - 100._r8) > 0.1_r8) then - err = 1; ierr = n; sumerr = sumpct - end if - if (sumpct < -0.000001_r8) then - err = 2; ierr = n; sumerr = sumpct - end if - end if - end do - if (err == 1) then - write(iulog,*) subname,' error: sum(pct) over numpft+1 is not = 100.',sumerr,ierr,pctspec(ierr),pctpft(ierr,:) - call endrun() - else if (err == 2) then - write(iulog,*)subname,' error: sum(pct) over numpft+1 is < 0.',sumerr,ierr,pctspec(ierr),pctpft(ierr,:) - call endrun() - end if - - end subroutine pftdyn_getdata - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_getharvest -! -! !INTERFACE: - subroutine pftdyn_getharvest(ntime, begg, endg) -! -! !DESCRIPTION: -! Obtain harvest data -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: ntime - integer , intent(IN) :: begg ! beg indices for land gridcells - integer , intent(IN) :: endg ! end indices for land gridcells -! -! -! !LOCAL VARIABLES: -!EOP - real(r8), pointer :: arrayl(:) ! temporary array - logical :: readvar - character(len=32) :: subname='pftdyn_getharvest' ! subroutine name -!----------------------------------------------------------------------- - - allocate(arrayl(begg:endg)) - - call ncd_io(ncid=ncid, varname= 'HARVEST_VH1', flag='read', data=arrayl, dim1name=grlnd, & - nt=ntime, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: HARVEST_VH1 not on landuse_timeseries file' ) - harvest(begg:endg) = arrayl(begg:endg) - - call ncd_io(ncid=ncid, varname= 'HARVEST_VH2', flag='read', data=arrayl, dim1name=grlnd, & - nt=ntime, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: HARVEST_VH2 not on landuse_timeseries file' ) - harvest(begg:endg) = harvest(begg:endg) + arrayl(begg:endg) - - call ncd_io(ncid=ncid, varname= 'HARVEST_SH1', flag='read', data=arrayl, dim1name=grlnd, & - nt=ntime, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: HARVEST_SH1 not on landuse_timeseries file' ) - harvest(begg:endg) = harvest(begg:endg) + arrayl(begg:endg) - - call ncd_io(ncid=ncid, varname= 'HARVEST_SH2', flag='read', data=arrayl, dim1name=grlnd, & - nt=ntime, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: HARVEST_SH2 not on landuse_timeseries file' ) - harvest(begg:endg) = harvest(begg:endg) + arrayl(begg:endg) - - call ncd_io(ncid=ncid, varname= 'HARVEST_SH3', flag='read', data=arrayl, dim1name=grlnd, & - nt=ntime, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: HARVEST_SH3 not on landuse_timeseries file' ) - harvest(begg:endg) = harvest(begg:endg) + arrayl(begg:endg) - - deallocate(arrayl) - - end subroutine pftdyn_getharvest - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_wbal_init -! -! !INTERFACE: - subroutine pftdyn_wbal_init( begc, endc ) -! -! !DESCRIPTION: -! initialize the column-level mass-balance correction term. -! Called in every timestep. -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begc, endc ! proc beginning and ending column indices -! -! -! !LOCAL VARIABLES: -!EOP - integer :: c ! indices - type(column_type), pointer :: cptr ! pointer to column derived subtype -!----------------------------------------------------------------------- - - ! Set pointers into derived type - - cptr => col - - ! set column-level canopy water mass balance correction flux - ! term to 0 at the beginning of every timestep - - do c = begc,endc - cwf%h2ocan_loss(c) = 0._r8 - end do - - end subroutine pftdyn_wbal_init - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_wbal -! -! !INTERFACE: - subroutine pftdyn_wbal( begg, endg, begc, endc, begp, endp ) -! -! !DESCRIPTION: -! modify pft-level state and flux variables to maintain water balance with -! dynamic pft-weights. -! Canopy water balance does not need to consider harvest fluxes, since pft weights are -! not affected by harvest. -! -! !USES: - use clm_varcon , only : istsoil - use clm_varcon , only : istcrop - use clm_time_manager, only : get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begg ! beg indices for land gridcells - integer, intent(IN) :: endg ! end indices for land gridcells - integer, intent(IN) :: begc ! beg indices for land columns - integer, intent(IN) :: endc ! end indices for land columns - integer, intent(IN) :: begp ! beg indices for land plant function types - integer, intent(IN) :: endp ! end indices for land plant function types -! -! -! !LOCAL VARIABLES: -!EOP - integer :: pi,p,c,l,g ! indices - integer :: ier ! error code - real(r8) :: dtime ! land model time step (sec) - real(r8) :: dwt ! change in pft weight (relative to column) - real(r8) :: init_h2ocan ! initial canopy water mass - real(r8) :: new_h2ocan ! canopy water mass after weight shift - real(r8), allocatable :: loss_h2ocan(:) ! canopy water mass loss due to weight shift - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type), pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - character(len=32) :: subname='pftdyn_wbal' ! subroutine name -!----------------------------------------------------------------------- - - ! Set pointers into derived type - - lptr => lun - cptr => col - pptr => pft - - ! Allocate loss_h2ocan - allocate(loss_h2ocan(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for loss_h2ocan'; call endrun() - end if - - ! Get time step - - dtime = get_step_size() - - ! set column-level canopy water mass balance correction flux - ! term to 0 at the beginning of every weight-shifting timestep - - do c = begc,endc - cwf%h2ocan_loss(c) = 0._r8 ! is this OR pftdyn_wbal_init redundant? - end do - - do p = begp,endp - l = pptr%landunit(p) - loss_h2ocan(p) = 0._r8 - - if (lptr%itype(l) == istsoil .or. lptr%itype(l) == istcrop) then - - ! calculate the change in weight for the timestep - dwt = pptr%wtcol(p)-wtcol_old(p) - - if (dwt > 0._r8) then - - ! if the pft gained weight, then the - ! initial canopy water state is redistributed over the - ! new (larger) area, conserving mass. - - pws%h2ocan(p) = pws%h2ocan(p) * (wtcol_old(p)/pptr%wtcol(p)) - - else if (dwt < 0._r8) then - - ! if the pft lost weight on the timestep, then the canopy water - ! mass associated with the lost weight is directed to a - ! column-level flux term that gets added to the precip flux - ! for every pft calculation in Hydrology1() - - init_h2ocan = pws%h2ocan(p) * wtcol_old(p) - loss_h2ocan(p) = pws%h2ocan(p) * (-dwt) - new_h2ocan = init_h2ocan - loss_h2ocan(p) - if (abs(new_h2ocan) < 1e-8_r8) then - new_h2ocan = 0._r8 - loss_h2ocan(p) = init_h2ocan - end if - if (pptr%wtcol(p) /= 0._r8) then - pws%h2ocan(p) = new_h2ocan/pptr%wtcol(p) - else - pws%h2ocan(p) = 0._r8 - loss_h2ocan(p) = init_h2ocan - end if - - - end if - - end if - end do - - do pi = 1,max_pft_per_col - do c = begc,endc - if (pi <= cptr%npfts(c)) then - p = cptr%pfti(c) + pi - 1 - cwf%h2ocan_loss(c) = cwf%h2ocan_loss(c) + loss_h2ocan(p)/dtime - end if - end do - end do - - ! Deallocate loss_h2ocan - deallocate(loss_h2ocan) - - end subroutine pftdyn_wbal - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftdyn_cnbal -! -! !INTERFACE: - subroutine pftdyn_cnbal( begc, endc, begp, endp ) -! -! !DESCRIPTION: -! modify pft-level state and flux variables to maintain carbon and nitrogen balance with -! dynamic pft-weights. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use shr_const_mod,only : SHR_CONST_PDB - use decompMod , only : get_proc_bounds - use clm_varcon , only : istsoil - use clm_varcon , only : istcrop - use clm_varpar , only : numveg, numpft - use pftvarcon , only : pconv, pprod10, pprod100 - use clm_varcon , only : c13ratio - use clm_time_manager, only : get_step_size -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begp, endp ! proc beginning and ending pft indices - integer, intent(IN) :: begc, endc ! proc beginning and ending column indices -! -! -! !LOCAL VARIABLES: -!EOP - integer :: pi,p,c,l,g ! indices - integer :: ier ! error code - real(r8) :: dwt ! change in pft weight (relative to column) - real(r8) :: dt ! land model time step (sec) - real(r8) :: init_h2ocan ! initial canopy water mass - real(r8) :: new_h2ocan ! canopy water mass after weight shift - real(r8), allocatable :: dwt_leafc_seed(:) ! pft-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_leafn_seed(:) ! pft-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_leafc13_seed(:) ! pft-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemc_seed(:) ! pft-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemn_seed(:) ! pft-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_deadstemc13_seed(:) ! pft-level mass gain due to seeding of new area - real(r8), allocatable :: dwt_frootc_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable :: dwt_livecrootc_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable :: dwt_deadcrootc_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: dwt_frootc13_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: dwt_livecrootc13_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: dwt_deadcrootc13_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: dwt_frootn_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: dwt_livecrootn_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: dwt_deadcrootn_to_litter(:) ! pft-level mass loss due to weight shift - real(r8), allocatable :: conv_cflux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable :: prod10_cflux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable :: prod100_cflux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: conv_c13flux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: prod10_c13flux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: prod100_c13flux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: conv_nflux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: prod10_nflux(:) ! pft-level mass loss due to weight shift - real(r8), allocatable, target :: prod100_nflux(:) ! pft-level mass loss due to weight shift - real(r8) :: c3_del13c ! typical del13C for C3 photosynthesis (permil, relative to PDB) - real(r8) :: c4_del13c ! typical del13C for C4 photosynthesis (permil, relative to PDB) - real(r8) :: c3_r1 ! isotope ratio (13c/12c) for C3 photosynthesis - real(r8) :: c4_r1 ! isotope ratio (13c/12c) for C4 photosynthesis - real(r8) :: c3_r2 ! isotope ratio (13c/[12c+13c]) for C3 photosynthesis - real(r8) :: c4_r2 ! isotope ratio (13c/[12c+13c]) for C4 photosynthesis - real(r8) :: t1,t2,wt_new,wt_old - real(r8) :: init_state, change_state, new_state - real(r8) :: tot_leaf, pleaf, pstor, pxfer - real(r8) :: leafc_seed, leafn_seed - real(r8) :: deadstemc_seed, deadstemn_seed - real(r8) :: leafc13_seed, deadstemc13_seed - real(r8), pointer :: dwt_ptr0, dwt_ptr1, dwt_ptr2, dwt_ptr3, ptr - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type), pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - integer , pointer :: pcolumn(:) ! column of corresponding pft - character(len=32) :: subname='pftdyn_cbal' ! subroutine name -!----------------------------------------------------------------------- - - ! Set pointers into derived type - - lptr => lun - cptr => col - pptr => pft - pcolumn => pptr%column - - ! Allocate pft-level mass loss arrays - allocate(dwt_leafc_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafc_seed'; call endrun() - end if - allocate(dwt_leafn_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafn_seed'; call endrun() - end if - if (use_c13) then - allocate(dwt_leafc13_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_leafc13_seed'; call endrun() - end if - endif - allocate(dwt_deadstemc_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemc_seed'; call endrun() - end if - allocate(dwt_deadstemn_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemn_seed'; call endrun() - end if - if (use_c13) then - allocate(dwt_deadstemc13_seed(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadstemc13_seed'; call endrun() - end if - endif - allocate(dwt_frootc_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootc_to_litter'; call endrun() - end if - allocate(dwt_livecrootc_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootc_to_litter'; call endrun() - end if - allocate(dwt_deadcrootc_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootc_to_litter'; call endrun() - end if - if (use_c13) then - allocate(dwt_frootc13_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootc13_to_litter'; call endrun() - end if - allocate(dwt_livecrootc13_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootc13_to_litter'; call endrun() - end if - allocate(dwt_deadcrootc13_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootc13_to_litter'; call endrun() - end if - endif - allocate(dwt_frootn_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_frootn_to_litter'; call endrun() - end if - allocate(dwt_livecrootn_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_livecrootn_to_litter'; call endrun() - end if - allocate(dwt_deadcrootn_to_litter(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for dwt_deadcrootn_to_litter'; call endrun() - end if - allocate(conv_cflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_cflux'; call endrun() - end if - allocate(prod10_cflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for prod10_cflux'; call endrun() - end if - allocate(prod100_cflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for prod100_cflux'; call endrun() - end if - if (use_c13) then - allocate(conv_c13flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_c13flux'; call endrun() - end if - allocate(prod10_c13flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for prod10_c13flux'; call endrun() - end if - allocate(prod100_c13flux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for prod100_c13flux'; call endrun() - end if - endif - allocate(conv_nflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for conv_nflux'; call endrun() - end if - allocate(prod10_nflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for prod10_nflux'; call endrun() - end if - allocate(prod100_nflux(begp:endp), stat=ier) - if (ier /= 0) then - write(iulog,*)subname,' allocation error for prod100_nflux'; call endrun() - end if - - ! Get time step - dt = real( get_step_size(), r8 ) - - do p = begp,endp - c = pcolumn(p) - ! initialize all the pft-level local flux arrays - dwt_leafc_seed(p) = 0._r8 - dwt_leafn_seed(p) = 0._r8 - if (use_c13) then - dwt_leafc13_seed(p) = 0._r8 - endif - dwt_deadstemc_seed(p) = 0._r8 - dwt_deadstemn_seed(p) = 0._r8 - if (use_c13) then - dwt_deadstemc13_seed(p) = 0._r8 - endif - dwt_frootc_to_litter(p) = 0._r8 - dwt_livecrootc_to_litter(p) = 0._r8 - dwt_deadcrootc_to_litter(p) = 0._r8 - if (use_c13) then - dwt_frootc13_to_litter(p) = 0._r8 - dwt_livecrootc13_to_litter(p) = 0._r8 - dwt_deadcrootc13_to_litter(p) = 0._r8 - endif - dwt_frootn_to_litter(p) = 0._r8 - dwt_livecrootn_to_litter(p) = 0._r8 - dwt_deadcrootn_to_litter(p) = 0._r8 - conv_cflux(p) = 0._r8 - prod10_cflux(p) = 0._r8 - prod100_cflux(p) = 0._r8 - if (use_c13) then - conv_c13flux(p) = 0._r8 - prod10_c13flux(p) = 0._r8 - prod100_c13flux(p) = 0._r8 - endif - conv_nflux(p) = 0._r8 - prod10_nflux(p) = 0._r8 - prod100_nflux(p) = 0._r8 - - l = pptr%landunit(p) - if (lptr%itype(l) == istsoil .or. lptr%itype(l) == istcrop) then - - ! calculate the change in weight for the timestep - dwt = pptr%wtcol(p)-wtcol_old(p) - - ! PFTs for which weight increases on this timestep - if (dwt > 0._r8) then - - ! first identify PFTs that are initiating on this timestep - ! and set all the necessary state and flux variables - if (wtcol_old(p) == 0._r8) then - - ! set initial conditions for PFT that is being initiated - ! in this time step. Based on the settings in cnIniTimeVar. - - ! pft-level carbon state variables - pcs%leafc(p) = 0._r8 - pcs%leafc_storage(p) = 0._r8 - pcs%leafc_xfer(p) = 0._r8 - pcs%frootc(p) = 0._r8 - pcs%frootc_storage(p) = 0._r8 - pcs%frootc_xfer(p) = 0._r8 - pcs%livestemc(p) = 0._r8 - pcs%livestemc_storage(p) = 0._r8 - pcs%livestemc_xfer(p) = 0._r8 - pcs%deadstemc(p) = 0._r8 - pcs%deadstemc_storage(p) = 0._r8 - pcs%deadstemc_xfer(p) = 0._r8 - pcs%livecrootc(p) = 0._r8 - pcs%livecrootc_storage(p) = 0._r8 - pcs%livecrootc_xfer(p) = 0._r8 - pcs%deadcrootc(p) = 0._r8 - pcs%deadcrootc_storage(p) = 0._r8 - pcs%deadcrootc_xfer(p) = 0._r8 - pcs%gresp_storage(p) = 0._r8 - pcs%gresp_xfer(p) = 0._r8 - pcs%cpool(p) = 0._r8 - pcs%xsmrpool(p) = 0._r8 - pcs%pft_ctrunc(p) = 0._r8 - pcs%dispvegc(p) = 0._r8 - pcs%storvegc(p) = 0._r8 - pcs%totvegc(p) = 0._r8 - pcs%totpftc(p) = 0._r8 - - ! pft-level carbon-13 state variables - if (use_c13) then - pc13s%leafc(p) = 0._r8 - pc13s%leafc_storage(p) = 0._r8 - pc13s%leafc_xfer(p) = 0._r8 - pc13s%frootc(p) = 0._r8 - pc13s%frootc_storage(p) = 0._r8 - pc13s%frootc_xfer(p) = 0._r8 - pc13s%livestemc(p) = 0._r8 - pc13s%livestemc_storage(p) = 0._r8 - pc13s%livestemc_xfer(p) = 0._r8 - pc13s%deadstemc(p) = 0._r8 - pc13s%deadstemc_storage(p) = 0._r8 - pc13s%deadstemc_xfer(p) = 0._r8 - pc13s%livecrootc(p) = 0._r8 - pc13s%livecrootc_storage(p) = 0._r8 - pc13s%livecrootc_xfer(p) = 0._r8 - pc13s%deadcrootc(p) = 0._r8 - pc13s%deadcrootc_storage(p) = 0._r8 - pc13s%deadcrootc_xfer(p) = 0._r8 - pc13s%gresp_storage(p) = 0._r8 - pc13s%gresp_xfer(p) = 0._r8 - pc13s%cpool(p) = 0._r8 - pc13s%xsmrpool(p) = 0._r8 - pc13s%pft_ctrunc(p) = 0._r8 - pc13s%dispvegc(p) = 0._r8 - pc13s%storvegc(p) = 0._r8 - pc13s%totvegc(p) = 0._r8 - pc13s%totpftc(p) = 0._r8 - endif - - ! pft-level nitrogen state variables - pns%leafn(p) = 0._r8 - pns%leafn_storage(p) = 0._r8 - pns%leafn_xfer(p) = 0._r8 - pns%frootn(p) = 0._r8 - pns%frootn_storage(p) = 0._r8 - pns%frootn_xfer(p) = 0._r8 - pns%livestemn(p) = 0._r8 - pns%livestemn_storage(p) = 0._r8 - pns%livestemn_xfer(p) = 0._r8 - pns%deadstemn(p) = 0._r8 - pns%deadstemn_storage(p) = 0._r8 - pns%deadstemn_xfer(p) = 0._r8 - pns%livecrootn(p) = 0._r8 - pns%livecrootn_storage(p) = 0._r8 - pns%livecrootn_xfer(p) = 0._r8 - pns%deadcrootn(p) = 0._r8 - pns%deadcrootn_storage(p) = 0._r8 - pns%deadcrootn_xfer(p) = 0._r8 - pns%retransn(p) = 0._r8 - pns%npool(p) = 0._r8 - pns%pft_ntrunc(p) = 0._r8 - pns%dispvegn(p) = 0._r8 - pns%storvegn(p) = 0._r8 - pns%totvegn(p) = 0._r8 - pns%totpftn (p) = 0._r8 - - ! initialize same flux and epv variables that are set - ! in CNiniTimeVar - pcf%psnsun(p) = 0._r8 - pcf%psnsha(p) = 0._r8 - if (use_c13) then - pc13f%psnsun(p) = 0._r8 - pc13f%psnsha(p) = 0._r8 - endif - pps%laisun(p) = 0._r8 - pps%laisha(p) = 0._r8 - pps%lncsun(p) = 0._r8 - pps%lncsha(p) = 0._r8 - pps%vcmxsun(p) = 0._r8 - pps%vcmxsha(p) = 0._r8 - if (use_c13) then - pps%alphapsnsun(p) = 0._r8 - pps%alphapsnsha(p) = 0._r8 - endif - - pepv%dormant_flag(p) = 1._r8 - pepv%days_active(p) = 0._r8 - pepv%onset_flag(p) = 0._r8 - pepv%onset_counter(p) = 0._r8 - pepv%onset_gddflag(p) = 0._r8 - pepv%onset_fdd(p) = 0._r8 - pepv%onset_gdd(p) = 0._r8 - pepv%onset_swi(p) = 0.0_r8 - pepv%offset_flag(p) = 0._r8 - pepv%offset_counter(p) = 0._r8 - pepv%offset_fdd(p) = 0._r8 - pepv%offset_swi(p) = 0._r8 - pepv%lgsf(p) = 0._r8 - pepv%bglfr(p) = 0._r8 - pepv%bgtr(p) = 0._r8 - ! difference from CNiniTimeVar: using column-level - ! information to initialize annavg_t2m. - pepv%annavg_t2m(p) = cps%cannavg_t2m(c) - pepv%tempavg_t2m(p) = 0._r8 - pepv%gpp(p) = 0._r8 - pepv%availc(p) = 0._r8 - pepv%xsmrpool_recover(p) = 0._r8 - if (use_c13) then - pepv%xsmrpool_c13ratio(p) = c13ratio - endif - pepv%alloc_pnow(p) = 1._r8 - pepv%c_allometry(p) = 0._r8 - pepv%n_allometry(p) = 0._r8 - pepv%plant_ndemand(p) = 0._r8 - pepv%tempsum_potential_gpp(p) = 0._r8 - pepv%annsum_potential_gpp(p) = 0._r8 - pepv%tempmax_retransn(p) = 0._r8 - pepv%annmax_retransn(p) = 0._r8 - pepv%avail_retransn(p) = 0._r8 - pepv%plant_nalloc(p) = 0._r8 - pepv%plant_calloc(p) = 0._r8 - pepv%excess_cflux(p) = 0._r8 - pepv%downreg(p) = 0._r8 - pepv%prev_leafc_to_litter(p) = 0._r8 - pepv%prev_frootc_to_litter(p) = 0._r8 - pepv%tempsum_npp(p) = 0._r8 - pepv%annsum_npp(p) = 0._r8 - if (use_c13) then - pepv%rc13_canair(p) = 0._r8 - pepv%rc13_psnsun(p) = 0._r8 - pepv%rc13_psnsha(p) = 0._r8 - endif - - end if ! end initialization of new pft - - ! (still in dwt > 0 block) - - ! set the seed sources for leaf and deadstem - ! leaf source is split later between leaf, leaf_storage, leaf_xfer - leafc_seed = 0._r8 - leafn_seed = 0._r8 - if (use_c13) then - leafc13_seed = 0._r8 - endif - deadstemc_seed = 0._r8 - deadstemn_seed = 0._r8 - if (use_c13) then - deadstemc13_seed = 0._r8 - endif - if (pptr%itype(p) /= 0) then - leafc_seed = 1._r8 - leafn_seed = leafc_seed / pftcon%leafcn(pptr%itype(p)) - if (pftcon%woody(pptr%itype(p)) == 1._r8) then - deadstemc_seed = 0.1_r8 - deadstemn_seed = deadstemc_seed / pftcon%deadwdcn(pptr%itype(p)) - end if - - if (use_c13) then - ! 13c state is initialized assuming del13c = -28 permil for C3, and -13 permil for C4. - ! That translates to ratios of (13c/(12c+13c)) of 0.01080455 for C3, and 0.01096945 for C4 - ! based on the following formulae: - ! r1 (13/12) = PDB + (del13c * PDB)/1000.0 - ! r2 (13/(13+12)) = r1/(1+r1) - ! PDB = 0.0112372_R8 (ratio of 13C/12C in Pee Dee Belemnite, C isotope standard) - c3_del13c = -28._r8 - c4_del13c = -13._r8 - c3_r1 = SHR_CONST_PDB + ((c3_del13c*SHR_CONST_PDB)/1000._r8) - c3_r2 = c3_r1/(1._r8 + c3_r1) - c4_r1 = SHR_CONST_PDB + ((c4_del13c*SHR_CONST_PDB)/1000._r8) - c4_r2 = c4_r1/(1._r8 + c4_r1) - - if (pftcon%c3psn(pptr%itype(p)) == 1._r8) then - leafc13_seed = leafc_seed * c3_r2 - deadstemc13_seed = deadstemc_seed * c3_r2 - else - leafc13_seed = leafc_seed * c4_r2 - deadstemc13_seed = deadstemc_seed * c4_r2 - end if - endif - end if - - ! When PFT area expands (dwt > 0), the pft-level mass density - ! is modified to conserve the original pft mass distributed - ! over the new (larger) area, plus a term to account for the - ! introduction of new seed source for leaf and deadstem - t1 = wtcol_old(p)/pptr%wtcol(p) - t2 = dwt/pptr%wtcol(p) - - tot_leaf = pcs%leafc(p) + pcs%leafc_storage(p) + pcs%leafc_xfer(p) - pleaf = 0._r8 - pstor = 0._r8 - pxfer = 0._r8 - if (tot_leaf /= 0._r8) then - ! when adding seed source to non-zero leaf state, use current proportions - pleaf = pcs%leafc(p)/tot_leaf - pstor = pcs%leafc_storage(p)/tot_leaf - pxfer = pcs%leafc_xfer(p)/tot_leaf - else - ! when initiating from zero leaf state, use evergreen flag to set proportions - if (pftcon%evergreen(pptr%itype(p)) == 1._r8) then - pleaf = 1._r8 - else - pstor = 1._r8 - end if - end if - pcs%leafc(p) = pcs%leafc(p)*t1 + leafc_seed*pleaf*t2 - pcs%leafc_storage(p) = pcs%leafc_storage(p)*t1 + leafc_seed*pstor*t2 - pcs%leafc_xfer(p) = pcs%leafc_xfer(p)*t1 + leafc_seed*pxfer*t2 - pcs%frootc(p) = pcs%frootc(p) * t1 - pcs%frootc_storage(p) = pcs%frootc_storage(p) * t1 - pcs%frootc_xfer(p) = pcs%frootc_xfer(p) * t1 - pcs%livestemc(p) = pcs%livestemc(p) * t1 - pcs%livestemc_storage(p) = pcs%livestemc_storage(p) * t1 - pcs%livestemc_xfer(p) = pcs%livestemc_xfer(p) * t1 - pcs%deadstemc(p) = pcs%deadstemc(p)*t1 + deadstemc_seed*t2 - pcs%deadstemc_storage(p) = pcs%deadstemc_storage(p) * t1 - pcs%deadstemc_xfer(p) = pcs%deadstemc_xfer(p) * t1 - pcs%livecrootc(p) = pcs%livecrootc(p) * t1 - pcs%livecrootc_storage(p) = pcs%livecrootc_storage(p) * t1 - pcs%livecrootc_xfer(p) = pcs%livecrootc_xfer(p) * t1 - pcs%deadcrootc(p) = pcs%deadcrootc(p) * t1 - pcs%deadcrootc_storage(p) = pcs%deadcrootc_storage(p) * t1 - pcs%deadcrootc_xfer(p) = pcs%deadcrootc_xfer(p) * t1 - pcs%gresp_storage(p) = pcs%gresp_storage(p) * t1 - pcs%gresp_xfer(p) = pcs%gresp_xfer(p) * t1 - pcs%cpool(p) = pcs%cpool(p) * t1 - pcs%xsmrpool(p) = pcs%xsmrpool(p) * t1 - pcs%pft_ctrunc(p) = pcs%pft_ctrunc(p) * t1 - pcs%dispvegc(p) = pcs%dispvegc(p) * t1 - pcs%storvegc(p) = pcs%storvegc(p) * t1 - pcs%totvegc(p) = pcs%totvegc(p) * t1 - pcs%totpftc(p) = pcs%totpftc(p) * t1 - - ! pft-level carbon-13 state variables - if (use_c13) then - tot_leaf = pc13s%leafc(p) + pc13s%leafc_storage(p) + pc13s%leafc_xfer(p) - pleaf = 0._r8 - pstor = 0._r8 - pxfer = 0._r8 - if (tot_leaf /= 0._r8) then - pleaf = pc13s%leafc(p)/tot_leaf - pstor = pc13s%leafc_storage(p)/tot_leaf - pxfer = pc13s%leafc_xfer(p)/tot_leaf - else - ! when initiating from zero leaf state, use evergreen flag to set proportions - if (pftcon%evergreen(pptr%itype(p)) == 1._r8) then - pleaf = 1._r8 - else - pstor = 1._r8 - end if - end if - pc13s%leafc(p) = pc13s%leafc(p)*t1 + leafc13_seed*pleaf*t2 - pc13s%leafc_storage(p) = pc13s%leafc_storage(p)*t1 + leafc13_seed*pstor*t2 - pc13s%leafc_xfer(p) = pc13s%leafc_xfer(p)*t1 + leafc13_seed*pxfer*t2 - pc13s%frootc(p) = pc13s%frootc(p) * t1 - pc13s%frootc_storage(p) = pc13s%frootc_storage(p) * t1 - pc13s%frootc_xfer(p) = pc13s%frootc_xfer(p) * t1 - pc13s%livestemc(p) = pc13s%livestemc(p) * t1 - pc13s%livestemc_storage(p) = pc13s%livestemc_storage(p) * t1 - pc13s%livestemc_xfer(p) = pc13s%livestemc_xfer(p) * t1 - pc13s%deadstemc(p) = pc13s%deadstemc(p)*t1 + deadstemc13_seed*t2 - pc13s%deadstemc_storage(p) = pc13s%deadstemc_storage(p) * t1 - pc13s%deadstemc_xfer(p) = pc13s%deadstemc_xfer(p) * t1 - pc13s%livecrootc(p) = pc13s%livecrootc(p) * t1 - pc13s%livecrootc_storage(p) = pc13s%livecrootc_storage(p) * t1 - pc13s%livecrootc_xfer(p) = pc13s%livecrootc_xfer(p) * t1 - pc13s%deadcrootc(p) = pc13s%deadcrootc(p) * t1 - pc13s%deadcrootc_storage(p) = pc13s%deadcrootc_storage(p) * t1 - pc13s%deadcrootc_xfer(p) = pc13s%deadcrootc_xfer(p) * t1 - pc13s%gresp_storage(p) = pc13s%gresp_storage(p) * t1 - pc13s%gresp_xfer(p) = pc13s%gresp_xfer(p) * t1 - pc13s%cpool(p) = pc13s%cpool(p) * t1 - pc13s%xsmrpool(p) = pc13s%xsmrpool(p) * t1 - pc13s%pft_ctrunc(p) = pc13s%pft_ctrunc(p) * t1 - pc13s%dispvegc(p) = pc13s%dispvegc(p) * t1 - pc13s%storvegc(p) = pc13s%storvegc(p) * t1 - pc13s%totvegc(p) = pc13s%totvegc(p) * t1 - pc13s%totpftc(p) = pc13s%totpftc(p) * t1 - endif - - tot_leaf = pns%leafn(p) + pns%leafn_storage(p) + pns%leafn_xfer(p) - pleaf = 0._r8 - pstor = 0._r8 - pxfer = 0._r8 - if (tot_leaf /= 0._r8) then - pleaf = pns%leafn(p)/tot_leaf - pstor = pns%leafn_storage(p)/tot_leaf - pxfer = pns%leafn_xfer(p)/tot_leaf - else - ! when initiating from zero leaf state, use evergreen flag to set proportions - if (pftcon%evergreen(pptr%itype(p)) == 1._r8) then - pleaf = 1._r8 - else - pstor = 1._r8 - end if - end if - ! pft-level nitrogen state variables - pns%leafn(p) = pns%leafn(p)*t1 + leafn_seed*pleaf*t2 - pns%leafn_storage(p) = pns%leafn_storage(p)*t1 + leafn_seed*pstor*t2 - pns%leafn_xfer(p) = pns%leafn_xfer(p)*t1 + leafn_seed*pxfer*t2 - pns%frootn(p) = pns%frootn(p) * t1 - pns%frootn_storage(p) = pns%frootn_storage(p) * t1 - pns%frootn_xfer(p) = pns%frootn_xfer(p) * t1 - pns%livestemn(p) = pns%livestemn(p) * t1 - pns%livestemn_storage(p) = pns%livestemn_storage(p) * t1 - pns%livestemn_xfer(p) = pns%livestemn_xfer(p) * t1 - pns%deadstemn(p) = pns%deadstemn(p)*t1 + deadstemn_seed*t2 - pns%deadstemn_storage(p) = pns%deadstemn_storage(p) * t1 - pns%deadstemn_xfer(p) = pns%deadstemn_xfer(p) * t1 - pns%livecrootn(p) = pns%livecrootn(p) * t1 - pns%livecrootn_storage(p) = pns%livecrootn_storage(p) * t1 - pns%livecrootn_xfer(p) = pns%livecrootn_xfer(p) * t1 - pns%deadcrootn(p) = pns%deadcrootn(p) * t1 - pns%deadcrootn_storage(p) = pns%deadcrootn_storage(p) * t1 - pns%deadcrootn_xfer(p) = pns%deadcrootn_xfer(p) * t1 - pns%retransn(p) = pns%retransn(p) * t1 - pns%npool(p) = pns%npool(p) * t1 - pns%pft_ntrunc(p) = pns%pft_ntrunc(p) * t1 - pns%dispvegn(p) = pns%dispvegn(p) * t1 - pns%storvegn(p) = pns%storvegn(p) * t1 - pns%totvegn(p) = pns%totvegn(p) * t1 - pns%totpftn(p) = pns%totpftn(p) * t1 - - ! update temporary seed source arrays - ! These are calculated in terms of the required contributions from - ! column-level seed source - dwt_leafc_seed(p) = leafc_seed * dwt - if (use_c13) then - dwt_leafc13_seed(p) = leafc13_seed * dwt - endif - dwt_leafn_seed(p) = leafn_seed * dwt - dwt_deadstemc_seed(p) = deadstemc_seed * dwt - if (use_c13) then - dwt_deadstemc13_seed(p) = deadstemc13_seed * dwt - endif - dwt_deadstemn_seed(p) = deadstemn_seed * dwt - - else if (dwt < 0._r8) then - - ! if the pft lost weight on the timestep, then the carbon and nitrogen state - ! variables are directed to litter, CWD, and wood product pools. - - ! N.B. : the conv_cflux, prod10_cflux, and prod100_cflux fluxes are accumulated - ! as negative values, but the fluxes for pft-to-litter are accumulated as - ! positive values - - ! set local weight variables for this pft - wt_new = pptr%wtcol(p) - wt_old = wtcol_old(p) - - !--------------- - ! C state update - !--------------- - - ! leafc - ptr => pcs%leafc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! leafc_storage - ptr => pcs%leafc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! leafc_xfer - ptr => pcs%leafc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! frootc - ptr => pcs%frootc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_frootc_to_litter(p) = dwt_frootc_to_litter(p) - change_state - else - ptr = 0._r8 - dwt_frootc_to_litter(p) = dwt_frootc_to_litter(p) + init_state - end if - - ! frootc_storage - ptr => pcs%frootc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! frootc_xfer - ptr => pcs%frootc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! livestemc - ptr => pcs%livestemc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! livestemc_storage - ptr => pcs%livestemc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! livestemc_xfer - ptr => pcs%livestemc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! deadstemc - ptr => pcs%deadstemc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state*pconv(pptr%itype(p)) - prod10_cflux(p) = prod10_cflux(p) + change_state*pprod10(pptr%itype(p)) - prod100_cflux(p) = prod100_cflux(p) + change_state*pprod100(pptr%itype(p)) - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state*pconv(pptr%itype(p)) - prod10_cflux(p) = prod10_cflux(p) - init_state*pprod10(pptr%itype(p)) - prod100_cflux(p) = prod100_cflux(p) - init_state*pprod100(pptr%itype(p)) - end if - - ! deadstemc_storage - ptr => pcs%deadstemc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! deadstemc_xfer - ptr => pcs%deadstemc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! livecrootc - ptr => pcs%livecrootc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_livecrootc_to_litter(p) = dwt_livecrootc_to_litter(p) - change_state - else - ptr = 0._r8 - dwt_livecrootc_to_litter(p) = dwt_livecrootc_to_litter(p) + init_state - end if - - ! livecrootc_storage - ptr => pcs%livecrootc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! livecrootc_xfer - ptr => pcs%livecrootc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! deadcrootc - ptr => pcs%deadcrootc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_deadcrootc_to_litter(p) = dwt_deadcrootc_to_litter(p) - change_state - else - ptr = 0._r8 - dwt_deadcrootc_to_litter(p) = dwt_deadcrootc_to_litter(p) + init_state - end if - - ! deadcrootc_storage - ptr => pcs%deadcrootc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! deadcrootc_xfer - ptr => pcs%deadcrootc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! gresp_storage - ptr => pcs%gresp_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! gresp_xfer - ptr => pcs%gresp_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! cpool - ptr => pcs%cpool(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! xsmrpool - ptr => pcs%xsmrpool(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - ! pft_ctrunc - ptr => pcs%pft_ctrunc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - conv_cflux(p) = conv_cflux(p) + change_state - else - ptr = 0._r8 - conv_cflux(p) = conv_cflux(p) - init_state - end if - - if (use_c13) then - !----------------- - ! C13 state update - !----------------- - - ! set pointers to the conversion and product pool fluxes for this pft - ! dwt_ptr0 is reserved for local assignment to dwt_xxx_to_litter fluxes - dwt_ptr1 => conv_c13flux(p) - dwt_ptr2 => prod10_c13flux(p) - dwt_ptr3 => prod100_c13flux(p) - - ! leafc - ptr => pc13s%leafc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! leafc_storage - ptr => pc13s%leafc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! leafc_xfer - ptr => pc13s%leafc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! frootc - ptr => pc13s%frootc(p) - dwt_ptr0 => dwt_frootc13_to_litter(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr0 = dwt_ptr0 - change_state - else - ptr = 0._r8 - dwt_ptr0 = dwt_ptr0 + init_state - end if - - ! frootc_storage - ptr => pc13s%frootc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! frootc_xfer - ptr => pc13s%frootc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livestemc - ptr => pc13s%livestemc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livestemc_storage - ptr => pc13s%livestemc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livestemc_xfer - ptr => pc13s%livestemc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadstemc - ptr => pc13s%deadstemc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state*pconv(pptr%itype(p)) - dwt_ptr2 = dwt_ptr2 + change_state*pprod10(pptr%itype(p)) - dwt_ptr3 = dwt_ptr3 + change_state*pprod100(pptr%itype(p)) - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state*pconv(pptr%itype(p)) - dwt_ptr2 = dwt_ptr2 - init_state*pprod10(pptr%itype(p)) - dwt_ptr3 = dwt_ptr3 - init_state*pprod100(pptr%itype(p)) - end if - - ! deadstemc_storage - ptr => pc13s%deadstemc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadstemc_xfer - ptr => pc13s%deadstemc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livecrootc - ptr => pc13s%livecrootc(p) - dwt_ptr0 => dwt_livecrootc13_to_litter(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr0 = dwt_ptr0 - change_state - else - ptr = 0._r8 - dwt_ptr0 = dwt_ptr0 + init_state - end if - - ! livecrootc_storage - ptr => pc13s%livecrootc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livecrootc_xfer - ptr => pc13s%livecrootc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadcrootc - ptr => pc13s%deadcrootc(p) - dwt_ptr0 => dwt_deadcrootc13_to_litter(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr0 = dwt_ptr0 - change_state - else - ptr = 0._r8 - dwt_ptr0 = dwt_ptr0 + init_state - end if - - ! deadcrootc_storage - ptr => pc13s%deadcrootc_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadcrootc_xfer - ptr => pc13s%deadcrootc_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! gresp_storage - ptr => pc13s%gresp_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! gresp_xfer - ptr => pc13s%gresp_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! cpool - ptr => pc13s%cpool(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! pft_ctrunc - ptr => pc13s%pft_ctrunc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - endif - - !--------------- - ! N state update - !--------------- - - ! set pointers to the conversion and product pool fluxes for this pft - ! dwt_ptr0 is reserved for local assignment to dwt_xxx_to_litter fluxes - dwt_ptr1 => conv_nflux(p) - dwt_ptr2 => prod10_nflux(p) - dwt_ptr3 => prod100_nflux(p) - - ! leafn - ptr => pns%leafn(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! leafn_storage - ptr => pns%leafn_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! leafn_xfer - ptr => pns%leafn_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! frootn - ptr => pns%frootn(p) - dwt_ptr0 => dwt_frootn_to_litter(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr0 = dwt_ptr0 - change_state - else - ptr = 0._r8 - dwt_ptr0 = dwt_ptr0 + init_state - end if - - ! frootn_storage - ptr => pns%frootn_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! frootn_xfer - ptr => pns%frootn_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livestemn - ptr => pns%livestemn(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livestemn_storage - ptr => pns%livestemn_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livestemn_xfer - ptr => pns%livestemn_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadstemn - ptr => pns%deadstemn(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state*pconv(pptr%itype(p)) - dwt_ptr2 = dwt_ptr2 + change_state*pprod10(pptr%itype(p)) - dwt_ptr3 = dwt_ptr3 + change_state*pprod100(pptr%itype(p)) - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state*pconv(pptr%itype(p)) - dwt_ptr2 = dwt_ptr2 - init_state*pprod10(pptr%itype(p)) - dwt_ptr3 = dwt_ptr3 - init_state*pprod100(pptr%itype(p)) - end if - - ! deadstemn_storage - ptr => pns%deadstemn_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadstemn_xfer - ptr => pns%deadstemn_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livecrootn - ptr => pns%livecrootn(p) - dwt_ptr0 => dwt_livecrootn_to_litter(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr0 = dwt_ptr0 - change_state - else - ptr = 0._r8 - dwt_ptr0 = dwt_ptr0 + init_state - end if - - ! livecrootn_storage - ptr => pns%livecrootn_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! livecrootn_xfer - ptr => pns%livecrootn_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadcrootn - ptr => pns%deadcrootn(p) - dwt_ptr0 => dwt_deadcrootn_to_litter(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr0 = dwt_ptr0 - change_state - else - ptr = 0._r8 - dwt_ptr0 = dwt_ptr0 + init_state - end if - - ! deadcrootn_storage - ptr => pns%deadcrootn_storage(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! deadcrootn_xfer - ptr => pns%deadcrootn_xfer(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! retransn - ptr => pns%retransn(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! npool - ptr => pns%npool(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - ! pft_ntrunc - ptr => pns%pft_ntrunc(p) - init_state = ptr*wt_old - change_state = ptr*dwt - new_state = init_state+change_state - if (wt_new /= 0._r8) then - ptr = new_state/wt_new - dwt_ptr1 = dwt_ptr1 + change_state - else - ptr = 0._r8 - dwt_ptr1 = dwt_ptr1 - init_state - end if - - end if ! weight decreasing - end if ! is soil - end do ! pft loop - - ! calculate column-level seeding fluxes - do pi = 1,max_pft_per_col - do c = begc, endc - if ( pi <= cptr%npfts(c) ) then - p = cptr%pfti(c) + pi - 1 - - ! C fluxes - ccf%dwt_seedc_to_leaf(c) = ccf%dwt_seedc_to_leaf(c) + dwt_leafc_seed(p)/dt - ccf%dwt_seedc_to_deadstem(c) = ccf%dwt_seedc_to_deadstem(c) & - + dwt_deadstemc_seed(p)/dt - - ! C13 fluxes - if (use_c13) then - cc13f%dwt_seedc_to_leaf(c) = cc13f%dwt_seedc_to_leaf(c) + dwt_leafc13_seed(p)/dt - cc13f%dwt_seedc_to_deadstem(c) = cc13f%dwt_seedc_to_deadstem(c) & - + dwt_deadstemc13_seed(p)/dt - endif - - ! N fluxes - cnf%dwt_seedn_to_leaf(c) = cnf%dwt_seedn_to_leaf(c) + dwt_leafn_seed(p)/dt - cnf%dwt_seedn_to_deadstem(c) = cnf%dwt_seedn_to_deadstem(c) & - + dwt_deadstemn_seed(p)/dt - end if - end do - end do - - - ! calculate pft-to-column for fluxes into litter and CWD pools - do pi = 1,max_pft_per_col - do c = begc, endc - if ( pi <= cptr%npfts(c) ) then - p = cptr%pfti(c) + pi - 1 - - ! fine root litter carbon fluxes - ccf%dwt_frootc_to_litr1c(c) = ccf%dwt_frootc_to_litr1c(c) + & - (dwt_frootc_to_litter(p)*pftcon%fr_flab(pptr%itype(p)))/dt - ccf%dwt_frootc_to_litr2c(c) = ccf%dwt_frootc_to_litr2c(c) + & - (dwt_frootc_to_litter(p)*pftcon%fr_fcel(pptr%itype(p)))/dt - ccf%dwt_frootc_to_litr3c(c) = ccf%dwt_frootc_to_litr3c(c) + & - (dwt_frootc_to_litter(p)*pftcon%fr_flig(pptr%itype(p)))/dt - - ! fine root litter C13 fluxes - if (use_c13) then - cc13f%dwt_frootc_to_litr1c(c) = cc13f%dwt_frootc_to_litr1c(c) + & - (dwt_frootc13_to_litter(p)*pftcon%fr_flab(pptr%itype(p)))/dt - cc13f%dwt_frootc_to_litr2c(c) = cc13f%dwt_frootc_to_litr2c(c) + & - (dwt_frootc13_to_litter(p)*pftcon%fr_fcel(pptr%itype(p)))/dt - cc13f%dwt_frootc_to_litr3c(c) = cc13f%dwt_frootc_to_litr3c(c) + & - (dwt_frootc13_to_litter(p)*pftcon%fr_flig(pptr%itype(p)))/dt - endif - - ! fine root litter nitrogen fluxes - cnf%dwt_frootn_to_litr1n(c) = cnf%dwt_frootn_to_litr1n(c) + & - (dwt_frootn_to_litter(p)*pftcon%fr_flab(pptr%itype(p)))/dt - cnf%dwt_frootn_to_litr2n(c) = cnf%dwt_frootn_to_litr2n(c) + & - (dwt_frootn_to_litter(p)*pftcon%fr_fcel(pptr%itype(p)))/dt - cnf%dwt_frootn_to_litr3n(c) = cnf%dwt_frootn_to_litr3n(c) + & - (dwt_frootn_to_litter(p)*pftcon%fr_flig(pptr%itype(p)))/dt - - ! livecroot fluxes to cwd - ccf%dwt_livecrootc_to_cwdc(c) = ccf%dwt_livecrootc_to_cwdc(c) + & - (dwt_livecrootc_to_litter(p))/dt - if (use_c13) then - cc13f%dwt_livecrootc_to_cwdc(c) = cc13f%dwt_livecrootc_to_cwdc(c) + & - (dwt_livecrootc13_to_litter(p))/dt - endif - cnf%dwt_livecrootn_to_cwdn(c) = cnf%dwt_livecrootn_to_cwdn(c) + & - (dwt_livecrootn_to_litter(p))/dt - - ! deadcroot fluxes to cwd - ccf%dwt_deadcrootc_to_cwdc(c) = ccf%dwt_deadcrootc_to_cwdc(c) + & - (dwt_deadcrootc_to_litter(p))/dt - if (use_c13) then - cc13f%dwt_deadcrootc_to_cwdc(c) = cc13f%dwt_deadcrootc_to_cwdc(c) + & - (dwt_deadcrootc13_to_litter(p))/dt - endif - cnf%dwt_deadcrootn_to_cwdn(c) = cnf%dwt_deadcrootn_to_cwdn(c) + & - (dwt_deadcrootn_to_litter(p))/dt - end if - end do - end do - - ! calculate pft-to-column for fluxes into product pools and conversion flux - do pi = 1,max_pft_per_col - do c = begc,endc - if (pi <= cptr%npfts(c)) then - p = cptr%pfti(c) + pi - 1 - - ! column-level fluxes are accumulated as positive fluxes. - ! column-level C flux updates - ccf%dwt_conv_cflux(c) = ccf%dwt_conv_cflux(c) - conv_cflux(p)/dt - ccf%dwt_prod10c_gain(c) = ccf%dwt_prod10c_gain(c) - prod10_cflux(p)/dt - ccf%dwt_prod100c_gain(c) = ccf%dwt_prod100c_gain(c) - prod100_cflux(p)/dt - - ! column-level C13 flux updates - if (use_c13) then - cc13f%dwt_conv_cflux(c) = cc13f%dwt_conv_cflux(c) - conv_c13flux(p)/dt - cc13f%dwt_prod10c_gain(c) = cc13f%dwt_prod10c_gain(c) - prod10_c13flux(p)/dt - cc13f%dwt_prod100c_gain(c) = cc13f%dwt_prod100c_gain(c) - prod100_c13flux(p)/dt - endif - - ! column-level N flux updates - cnf%dwt_conv_nflux(c) = cnf%dwt_conv_nflux(c) - conv_nflux(p)/dt - cnf%dwt_prod10n_gain(c) = cnf%dwt_prod10n_gain(c) - prod10_nflux(p)/dt - cnf%dwt_prod100n_gain(c) = cnf%dwt_prod100n_gain(c) - prod100_nflux(p)/dt - - end if - end do - end do - - ! Deallocate pft-level flux arrays - deallocate(dwt_leafc_seed) - deallocate(dwt_leafn_seed) - if (use_c13) then - deallocate(dwt_leafc13_seed) - endif - deallocate(dwt_deadstemc_seed) - deallocate(dwt_deadstemn_seed) - if (use_c13) then - deallocate(dwt_deadstemc13_seed) - endif - deallocate(dwt_frootc_to_litter) - deallocate(dwt_livecrootc_to_litter) - deallocate(dwt_deadcrootc_to_litter) - if (use_c13) then - deallocate(dwt_frootc13_to_litter) - deallocate(dwt_livecrootc13_to_litter) - deallocate(dwt_deadcrootc13_to_litter) - endif - deallocate(dwt_frootn_to_litter) - deallocate(dwt_livecrootn_to_litter) - deallocate(dwt_deadcrootn_to_litter) - deallocate(conv_cflux) - deallocate(prod10_cflux) - deallocate(prod100_cflux) - if (use_c13) then - deallocate(conv_c13flux) - deallocate(prod10_c13flux) - deallocate(prod100_c13flux) - endif - deallocate(conv_nflux) - deallocate(prod10_nflux) - deallocate(prod100_nflux) - -end subroutine pftdyn_cnbal - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftwt_init -! -! !INTERFACE: - subroutine pftwt_init() -! -! !DESCRIPTION: -! Initialize time interpolation of cndv pft weights from annual to time step -! -! !USES: - use clm_varctl, only : nsrest, nsrStartup -! -! !ARGUMENTS: - implicit none -! -!EOP -! -! !LOCAL VARIABLES: - integer :: ier, p ! error status, do-loop index - integer :: begp,endp ! beg/end indices for land pfts - character(len=32) :: subname='pftwt_init' ! subroutine name - type(pft_type), pointer :: pptr ! ponter to pft derived subtype -!----------------------------------------------------------------------- - - pptr => pft - - call get_proc_bounds(begp=begp,endp=endp) - - allocate(wtcol_old(begp:endp),stat=ier) - if (ier /= 0) then - call endrun( subname//'::ERROR: pftwt_init allocation error for wtcol_old') - end if - - if (nsrest == nsrStartup) then - do p = begp,endp - pdgvs%fpcgrid(p) = pptr%wtcol(p) - pdgvs%fpcgridold(p) = pptr%wtcol(p) - wtcol_old(p) = pptr%wtcol(p) - end do - else - do p = begp,endp - wtcol_old(p) = pptr%wtcol(p) - end do - end if - - end subroutine pftwt_init - -!----------------------------------------------------------------------- -!BOP -! -! !ROUTINE: pftwt_interp -! -! !INTERFACE: - subroutine pftwt_interp( begp, endp ) -! -! !DESCRIPTION: -! Time interpolate cndv pft weights from annual to time step -! -! !USES: - use clm_time_manager, only : get_curr_calday, get_curr_date, & - get_days_per_year - use clm_time_manager, only : get_step_size, get_nstep - use clm_varcon , only : istsoil ! CNDV incompatible with dynLU - use clm_varctl , only : finidat -! -! !ARGUMENTS: - implicit none - integer, intent(IN) :: begp,endp ! beg/end indices for land pfts -! -!EOP -! -! !LOCAL VARIABLES: - integer :: c,g,l,p ! indices - real(r8) :: cday ! current calendar day (1.0 = 0Z on Jan 1) - real(r8) :: wt1 ! time interpolation weights - real(r8) :: dtime ! model time step - real(r8) :: days_per_year ! days per year - integer :: nstep ! time step number - integer :: year ! year (0, ...) at nstep + 1 - integer :: mon ! month (1, ..., 12) at nstep + 1 - integer :: day ! day of month (1, ..., 31) at nstep + 1 - integer :: sec ! seconds into current date at nstep + 1 - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(pft_type) , pointer :: pptr ! ... to pft derived subtype - character(len=32) :: subname='pftwt_interp' ! subroutine name - -! !CALLED FROM: -! subr. driver -!----------------------------------------------------------------------- - - ! Set pointers into derived type - - lptr => lun - pptr => pft - - ! Interpolate pft weight to current time step - ! Map interpolated pctpft to subgrid weights - ! assumes maxpatch_pft = numpft + 1, each landunit has 1 column, - ! SCAM not defined and create_croplandunit = .false. - - nstep = get_nstep() - dtime = get_step_size() - cday = get_curr_calday(offset=-int(dtime)) - days_per_year = get_days_per_year() - - wt1 = ((days_per_year + 1._r8) - cday)/days_per_year - - call get_curr_date(year, mon, day, sec, offset=int(dtime)) - - do p = begp,endp - g = pptr%gridcell(p) - l = pptr%landunit(p) - - if (lptr%itype(l) == istsoil .and. lptr%wtgcell(l) > 0._r8) then ! CNDV incompatible with dynLU - wtcol_old(p) = pptr%wtcol(p) - pptr%wtcol(p) = pdgvs%fpcgrid(p) + & - wt1 * (pdgvs%fpcgridold(p) - pdgvs%fpcgrid(p)) - pptr%wtlunit(p) = pptr%wtcol(p) - pptr%wtgcell(p) = pptr%wtcol(p) * lptr%wtgcell(l) - - if (mon==1 .and. day==1 .and. sec==dtime .and. nstep>0) then - pdgvs%fpcgridold(p) = pdgvs%fpcgrid(p) - end if - end if - end do - - end subroutine pftwt_interp - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNHarvest -! -! !INTERFACE: -subroutine CNHarvest (num_soilc, filter_soilc, num_soilp, filter_soilp) -! -! !DESCRIPTION: -! Harvest mortality routine for coupled carbon-nitrogen code (CN) -! -! !USES: - use clmtype - use pftvarcon , only : noveg, nbrdlf_evr_shrub, pprodharv10 - use clm_varcon , only : secspday - use clm_time_manager, only : get_days_per_year -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! column filter for soil points - integer, intent(in) :: num_soilp ! number of soil pfts in filter - integer, intent(in) :: filter_soilp(:) ! pft filter for soil points -! -! !CALLED FROM: -! subroutine CNEcosystemDyn -! -! !REVISION HISTORY: -! 3/29/04: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in arrays - integer , pointer :: pgridcell(:) ! pft-level index into gridcell-level quantities - integer , pointer :: ivt(:) ! pft vegetation type - - real(r8), pointer :: leafc(:) ! (gC/m2) leaf C - real(r8), pointer :: frootc(:) ! (gC/m2) fine root C - real(r8), pointer :: livestemc(:) ! (gC/m2) live stem C - real(r8), pointer :: deadstemc(:) ! (gC/m2) dead stem C - real(r8), pointer :: livecrootc(:) ! (gC/m2) live coarse root C - real(r8), pointer :: deadcrootc(:) ! (gC/m2) dead coarse root C - real(r8), pointer :: xsmrpool(:) ! (gC/m2) abstract C pool to meet excess MR demand - real(r8), pointer :: leafc_storage(:) ! (gC/m2) leaf C storage - real(r8), pointer :: frootc_storage(:) ! (gC/m2) fine root C storage - real(r8), pointer :: livestemc_storage(:) ! (gC/m2) live stem C storage - real(r8), pointer :: deadstemc_storage(:) ! (gC/m2) dead stem C storage - real(r8), pointer :: livecrootc_storage(:) ! (gC/m2) live coarse root C storage - real(r8), pointer :: deadcrootc_storage(:) ! (gC/m2) dead coarse root C storage - real(r8), pointer :: gresp_storage(:) ! (gC/m2) growth respiration storage - real(r8), pointer :: leafc_xfer(:) ! (gC/m2) leaf C transfer - real(r8), pointer :: frootc_xfer(:) ! (gC/m2) fine root C transfer - real(r8), pointer :: livestemc_xfer(:) ! (gC/m2) live stem C transfer - real(r8), pointer :: deadstemc_xfer(:) ! (gC/m2) dead stem C transfer - real(r8), pointer :: livecrootc_xfer(:) ! (gC/m2) live coarse root C transfer - real(r8), pointer :: deadcrootc_xfer(:) ! (gC/m2) dead coarse root C transfer - real(r8), pointer :: gresp_xfer(:) ! (gC/m2) growth respiration transfer - real(r8), pointer :: leafn(:) ! (gN/m2) leaf N - real(r8), pointer :: frootn(:) ! (gN/m2) fine root N - real(r8), pointer :: livestemn(:) ! (gN/m2) live stem N - real(r8), pointer :: deadstemn(:) ! (gN/m2) dead stem N - real(r8), pointer :: livecrootn(:) ! (gN/m2) live coarse root N - real(r8), pointer :: deadcrootn(:) ! (gN/m2) dead coarse root N - real(r8), pointer :: retransn(:) ! (gN/m2) plant pool of retranslocated N - real(r8), pointer :: leafn_storage(:) ! (gN/m2) leaf N storage - real(r8), pointer :: frootn_storage(:) ! (gN/m2) fine root N storage - real(r8), pointer :: livestemn_storage(:) ! (gN/m2) live stem N storage - real(r8), pointer :: deadstemn_storage(:) ! (gN/m2) dead stem N storage - real(r8), pointer :: livecrootn_storage(:) ! (gN/m2) live coarse root N storage - real(r8), pointer :: deadcrootn_storage(:) ! (gN/m2) dead coarse root N storage - real(r8), pointer :: leafn_xfer(:) ! (gN/m2) leaf N transfer - real(r8), pointer :: frootn_xfer(:) ! (gN/m2) fine root N transfer - real(r8), pointer :: livestemn_xfer(:) ! (gN/m2) live stem N transfer - real(r8), pointer :: deadstemn_xfer(:) ! (gN/m2) dead stem N transfer - real(r8), pointer :: livecrootn_xfer(:) ! (gN/m2) live coarse root N transfer - real(r8), pointer :: deadcrootn_xfer(:) ! (gN/m2) dead coarse root N transfer -! -! local pointers to implicit in/out arrays -! -! local pointers to implicit out arrays - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: hrv_deadstemc_to_prod10c(:) - real(r8), pointer :: hrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_xsmrpool_to_atm(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) - real(r8), pointer :: hrv_leafn_to_litter(:) - real(r8), pointer :: hrv_frootn_to_litter(:) - real(r8), pointer :: hrv_livestemn_to_litter(:) - real(r8), pointer :: hrv_deadstemn_to_prod10n(:) - real(r8), pointer :: hrv_deadstemn_to_prod100n(:) - real(r8), pointer :: hrv_livecrootn_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_to_litter(:) - real(r8), pointer :: hrv_retransn_to_litter(:) - real(r8), pointer :: hrv_leafn_storage_to_litter(:) - real(r8), pointer :: hrv_frootn_storage_to_litter(:) - real(r8), pointer :: hrv_livestemn_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemn_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootn_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_storage_to_litter(:) - real(r8), pointer :: hrv_leafn_xfer_to_litter(:) - real(r8), pointer :: hrv_frootn_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemn_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemn_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootn_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litter(:) -! -! !OTHER LOCAL VARIABLES: - integer :: p ! pft index - integer :: g ! gridcell index - integer :: fp ! pft filter index - real(r8):: am ! rate for fractional harvest mortality (1/yr) - real(r8):: m ! rate for fractional harvest mortality (1/s) - real(r8):: days_per_year ! days per year -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers to pft-level arrays - pgridcell => pft%gridcell - - ivt => pft%itype - leafc => pcs%leafc - frootc => pcs%frootc - livestemc => pcs%livestemc - deadstemc => pcs%deadstemc - livecrootc => pcs%livecrootc - deadcrootc => pcs%deadcrootc - xsmrpool => pcs%xsmrpool - leafc_storage => pcs%leafc_storage - frootc_storage => pcs%frootc_storage - livestemc_storage => pcs%livestemc_storage - deadstemc_storage => pcs%deadstemc_storage - livecrootc_storage => pcs%livecrootc_storage - deadcrootc_storage => pcs%deadcrootc_storage - gresp_storage => pcs%gresp_storage - leafc_xfer => pcs%leafc_xfer - frootc_xfer => pcs%frootc_xfer - livestemc_xfer => pcs%livestemc_xfer - deadstemc_xfer => pcs%deadstemc_xfer - livecrootc_xfer => pcs%livecrootc_xfer - deadcrootc_xfer => pcs%deadcrootc_xfer - gresp_xfer => pcs%gresp_xfer - leafn => pns%leafn - frootn => pns%frootn - livestemn => pns%livestemn - deadstemn => pns%deadstemn - livecrootn => pns%livecrootn - deadcrootn => pns%deadcrootn - retransn => pns%retransn - leafn_storage => pns%leafn_storage - frootn_storage => pns%frootn_storage - livestemn_storage => pns%livestemn_storage - deadstemn_storage => pns%deadstemn_storage - livecrootn_storage => pns%livecrootn_storage - deadcrootn_storage => pns%deadcrootn_storage - leafn_xfer => pns%leafn_xfer - frootn_xfer => pns%frootn_xfer - livestemn_xfer => pns%livestemn_xfer - deadstemn_xfer => pns%deadstemn_xfer - livecrootn_xfer => pns%livecrootn_xfer - deadcrootn_xfer => pns%deadcrootn_xfer - hrv_leafc_to_litter => pcf%hrv_leafc_to_litter - hrv_frootc_to_litter => pcf%hrv_frootc_to_litter - hrv_livestemc_to_litter => pcf%hrv_livestemc_to_litter - hrv_deadstemc_to_prod10c => pcf%hrv_deadstemc_to_prod10c - hrv_deadstemc_to_prod100c => pcf%hrv_deadstemc_to_prod100c - hrv_livecrootc_to_litter => pcf%hrv_livecrootc_to_litter - hrv_deadcrootc_to_litter => pcf%hrv_deadcrootc_to_litter - hrv_xsmrpool_to_atm => pcf%hrv_xsmrpool_to_atm - hrv_leafc_storage_to_litter => pcf%hrv_leafc_storage_to_litter - hrv_frootc_storage_to_litter => pcf%hrv_frootc_storage_to_litter - hrv_livestemc_storage_to_litter => pcf%hrv_livestemc_storage_to_litter - hrv_deadstemc_storage_to_litter => pcf%hrv_deadstemc_storage_to_litter - hrv_livecrootc_storage_to_litter => pcf%hrv_livecrootc_storage_to_litter - hrv_deadcrootc_storage_to_litter => pcf%hrv_deadcrootc_storage_to_litter - hrv_gresp_storage_to_litter => pcf%hrv_gresp_storage_to_litter - hrv_leafc_xfer_to_litter => pcf%hrv_leafc_xfer_to_litter - hrv_frootc_xfer_to_litter => pcf%hrv_frootc_xfer_to_litter - hrv_livestemc_xfer_to_litter => pcf%hrv_livestemc_xfer_to_litter - hrv_deadstemc_xfer_to_litter => pcf%hrv_deadstemc_xfer_to_litter - hrv_livecrootc_xfer_to_litter => pcf%hrv_livecrootc_xfer_to_litter - hrv_deadcrootc_xfer_to_litter => pcf%hrv_deadcrootc_xfer_to_litter - hrv_gresp_xfer_to_litter => pcf%hrv_gresp_xfer_to_litter - hrv_leafn_to_litter => pnf%hrv_leafn_to_litter - hrv_frootn_to_litter => pnf%hrv_frootn_to_litter - hrv_livestemn_to_litter => pnf%hrv_livestemn_to_litter - hrv_deadstemn_to_prod10n => pnf%hrv_deadstemn_to_prod10n - hrv_deadstemn_to_prod100n => pnf%hrv_deadstemn_to_prod100n - hrv_livecrootn_to_litter => pnf%hrv_livecrootn_to_litter - hrv_deadcrootn_to_litter => pnf%hrv_deadcrootn_to_litter - hrv_retransn_to_litter => pnf%hrv_retransn_to_litter - hrv_leafn_storage_to_litter => pnf%hrv_leafn_storage_to_litter - hrv_frootn_storage_to_litter => pnf%hrv_frootn_storage_to_litter - hrv_livestemn_storage_to_litter => pnf%hrv_livestemn_storage_to_litter - hrv_deadstemn_storage_to_litter => pnf%hrv_deadstemn_storage_to_litter - hrv_livecrootn_storage_to_litter => pnf%hrv_livecrootn_storage_to_litter - hrv_deadcrootn_storage_to_litter => pnf%hrv_deadcrootn_storage_to_litter - hrv_leafn_xfer_to_litter => pnf%hrv_leafn_xfer_to_litter - hrv_frootn_xfer_to_litter => pnf%hrv_frootn_xfer_to_litter - hrv_livestemn_xfer_to_litter => pnf%hrv_livestemn_xfer_to_litter - hrv_deadstemn_xfer_to_litter => pnf%hrv_deadstemn_xfer_to_litter - hrv_livecrootn_xfer_to_litter => pnf%hrv_livecrootn_xfer_to_litter - hrv_deadcrootn_xfer_to_litter => pnf%hrv_deadcrootn_xfer_to_litter - - - days_per_year = get_days_per_year() - - ! pft loop - do fp = 1,num_soilp - p = filter_soilp(fp) - g = pgridcell(p) - - ! If this is a tree pft, then - ! get the annual harvest "mortality" rate (am) from harvest array - ! and convert to rate per second - if (ivt(p) > noveg .and. ivt(p) < nbrdlf_evr_shrub) then - - if (do_harvest) then - am = harvest(g) - m = am/(days_per_year * secspday) - else - m = 0._r8 - end if - - ! pft-level harvest carbon fluxes - ! displayed pools - hrv_leafc_to_litter(p) = leafc(p) * m - hrv_frootc_to_litter(p) = frootc(p) * m - hrv_livestemc_to_litter(p) = livestemc(p) * m - hrv_deadstemc_to_prod10c(p) = deadstemc(p) * m * & - pprodharv10(ivt(p)) - hrv_deadstemc_to_prod100c(p) = deadstemc(p) * m * & - (1.0_r8 - pprodharv10(ivt(p))) - hrv_livecrootc_to_litter(p) = livecrootc(p) * m - hrv_deadcrootc_to_litter(p) = deadcrootc(p) * m - hrv_xsmrpool_to_atm(p) = xsmrpool(p) * m - - ! storage pools - hrv_leafc_storage_to_litter(p) = leafc_storage(p) * m - hrv_frootc_storage_to_litter(p) = frootc_storage(p) * m - hrv_livestemc_storage_to_litter(p) = livestemc_storage(p) * m - hrv_deadstemc_storage_to_litter(p) = deadstemc_storage(p) * m - hrv_livecrootc_storage_to_litter(p) = livecrootc_storage(p) * m - hrv_deadcrootc_storage_to_litter(p) = deadcrootc_storage(p) * m - hrv_gresp_storage_to_litter(p) = gresp_storage(p) * m - - ! transfer pools - hrv_leafc_xfer_to_litter(p) = leafc_xfer(p) * m - hrv_frootc_xfer_to_litter(p) = frootc_xfer(p) * m - hrv_livestemc_xfer_to_litter(p) = livestemc_xfer(p) * m - hrv_deadstemc_xfer_to_litter(p) = deadstemc_xfer(p) * m - hrv_livecrootc_xfer_to_litter(p) = livecrootc_xfer(p) * m - hrv_deadcrootc_xfer_to_litter(p) = deadcrootc_xfer(p) * m - hrv_gresp_xfer_to_litter(p) = gresp_xfer(p) * m - - ! pft-level harvest mortality nitrogen fluxes - ! displayed pools - hrv_leafn_to_litter(p) = leafn(p) * m - hrv_frootn_to_litter(p) = frootn(p) * m - hrv_livestemn_to_litter(p) = livestemn(p) * m - hrv_deadstemn_to_prod10n(p) = deadstemn(p) * m * & - pprodharv10(ivt(p)) - hrv_deadstemn_to_prod100n(p) = deadstemn(p) * m * & - (1.0_r8 - pprodharv10(ivt(p))) - hrv_livecrootn_to_litter(p) = livecrootn(p) * m - hrv_deadcrootn_to_litter(p) = deadcrootn(p) * m - hrv_retransn_to_litter(p) = retransn(p) * m - - ! storage pools - hrv_leafn_storage_to_litter(p) = leafn_storage(p) * m - hrv_frootn_storage_to_litter(p) = frootn_storage(p) * m - hrv_livestemn_storage_to_litter(p) = livestemn_storage(p) * m - hrv_deadstemn_storage_to_litter(p) = deadstemn_storage(p) * m - hrv_livecrootn_storage_to_litter(p) = livecrootn_storage(p) * m - hrv_deadcrootn_storage_to_litter(p) = deadcrootn_storage(p) * m - - ! transfer pools - hrv_leafn_xfer_to_litter(p) = leafn_xfer(p) * m - hrv_frootn_xfer_to_litter(p) = frootn_xfer(p) * m - hrv_livestemn_xfer_to_litter(p) = livestemn_xfer(p) * m - hrv_deadstemn_xfer_to_litter(p) = deadstemn_xfer(p) * m - hrv_livecrootn_xfer_to_litter(p) = livecrootn_xfer(p) * m - hrv_deadcrootn_xfer_to_litter(p) = deadcrootn_xfer(p) * m - - end if ! end tree block - - end do ! end of pft loop - - ! gather all pft-level litterfall fluxes from harvest to the column - ! for litter C and N inputs - - call CNHarvestPftToColumn(num_soilc, filter_soilc) - -end subroutine CNHarvest -!----------------------------------------------------------------------- - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: CNHarvestPftToColumn -! -! !INTERFACE: -subroutine CNHarvestPftToColumn (num_soilc, filter_soilc) -! -! !DESCRIPTION: -! called at the end of CNHarvest to gather all pft-level harvest litterfall fluxes -! to the column level and assign them to the three litter pools -! -! !USES: - use clmtype - use clm_varpar, only : max_pft_per_col, maxpatch_pft -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: num_soilc ! number of soil columns in filter - integer, intent(in) :: filter_soilc(:) ! soil column filter -! -! !CALLED FROM: -! subroutine CNphenology -! -! !REVISION HISTORY: -! 9/8/03: Created by Peter Thornton -! -! !LOCAL VARIABLES: -! -! local pointers to implicit in scalars - integer , pointer :: ivt(:) ! pft vegetation type - real(r8), pointer :: wtcol(:) ! pft weight relative to column (0-1) - real(r8), pointer :: pwtgcell(:) ! weight of pft relative to corresponding gridcell - real(r8), pointer :: lf_flab(:) ! leaf litter labile fraction - real(r8), pointer :: lf_fcel(:) ! leaf litter cellulose fraction - real(r8), pointer :: lf_flig(:) ! leaf litter lignin fraction - real(r8), pointer :: fr_flab(:) ! fine root litter labile fraction - real(r8), pointer :: fr_fcel(:) ! fine root litter cellulose fraction - real(r8), pointer :: fr_flig(:) ! fine root litter lignin fraction - integer , pointer :: npfts(:) ! number of pfts for each column - integer , pointer :: pfti(:) ! beginning pft index for each column - real(r8), pointer :: hrv_leafc_to_litter(:) - real(r8), pointer :: hrv_frootc_to_litter(:) - real(r8), pointer :: hrv_livestemc_to_litter(:) - real(r8), pointer :: phrv_deadstemc_to_prod10c(:) - real(r8), pointer :: phrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_livecrootc_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_to_litter(:) - real(r8), pointer :: hrv_leafc_storage_to_litter(:) - real(r8), pointer :: hrv_frootc_storage_to_litter(:) - real(r8), pointer :: hrv_livestemc_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litter(:) - real(r8), pointer :: hrv_gresp_storage_to_litter(:) - real(r8), pointer :: hrv_leafc_xfer_to_litter(:) - real(r8), pointer :: hrv_frootc_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litter(:) - real(r8), pointer :: hrv_gresp_xfer_to_litter(:) - real(r8), pointer :: hrv_leafn_to_litter(:) - real(r8), pointer :: hrv_frootn_to_litter(:) - real(r8), pointer :: hrv_livestemn_to_litter(:) - real(r8), pointer :: phrv_deadstemn_to_prod10n(:) - real(r8), pointer :: phrv_deadstemn_to_prod100n(:) - real(r8), pointer :: hrv_livecrootn_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_to_litter(:) - real(r8), pointer :: hrv_retransn_to_litter(:) - real(r8), pointer :: hrv_leafn_storage_to_litter(:) - real(r8), pointer :: hrv_frootn_storage_to_litter(:) - real(r8), pointer :: hrv_livestemn_storage_to_litter(:) - real(r8), pointer :: hrv_deadstemn_storage_to_litter(:) - real(r8), pointer :: hrv_livecrootn_storage_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_storage_to_litter(:) - real(r8), pointer :: hrv_leafn_xfer_to_litter(:) - real(r8), pointer :: hrv_frootn_xfer_to_litter(:) - real(r8), pointer :: hrv_livestemn_xfer_to_litter(:) - real(r8), pointer :: hrv_deadstemn_xfer_to_litter(:) - real(r8), pointer :: hrv_livecrootn_xfer_to_litter(:) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litter(:) -! -! local pointers to implicit in/out arrays - real(r8), pointer :: hrv_leafc_to_litr1c(:) - real(r8), pointer :: hrv_leafc_to_litr2c(:) - real(r8), pointer :: hrv_leafc_to_litr3c(:) - real(r8), pointer :: hrv_frootc_to_litr1c(:) - real(r8), pointer :: hrv_frootc_to_litr2c(:) - real(r8), pointer :: hrv_frootc_to_litr3c(:) - real(r8), pointer :: hrv_livestemc_to_cwdc(:) - real(r8), pointer :: chrv_deadstemc_to_prod10c(:) - real(r8), pointer :: chrv_deadstemc_to_prod100c(:) - real(r8), pointer :: hrv_livecrootc_to_cwdc(:) - real(r8), pointer :: hrv_deadcrootc_to_cwdc(:) - real(r8), pointer :: hrv_leafc_storage_to_litr1c(:) - real(r8), pointer :: hrv_frootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_storage_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_storage_to_litr1c(:) - real(r8), pointer :: hrv_gresp_storage_to_litr1c(:) - real(r8), pointer :: hrv_leafc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_frootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livestemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadstemc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_livecrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_deadcrootc_xfer_to_litr1c(:) - real(r8), pointer :: hrv_gresp_xfer_to_litr1c(:) - real(r8), pointer :: hrv_leafn_to_litr1n(:) - real(r8), pointer :: hrv_leafn_to_litr2n(:) - real(r8), pointer :: hrv_leafn_to_litr3n(:) - real(r8), pointer :: hrv_frootn_to_litr1n(:) - real(r8), pointer :: hrv_frootn_to_litr2n(:) - real(r8), pointer :: hrv_frootn_to_litr3n(:) - real(r8), pointer :: hrv_livestemn_to_cwdn(:) - real(r8), pointer :: chrv_deadstemn_to_prod10n(:) - real(r8), pointer :: chrv_deadstemn_to_prod100n(:) - real(r8), pointer :: hrv_livecrootn_to_cwdn(:) - real(r8), pointer :: hrv_deadcrootn_to_cwdn(:) - real(r8), pointer :: hrv_retransn_to_litr1n(:) - real(r8), pointer :: hrv_leafn_storage_to_litr1n(:) - real(r8), pointer :: hrv_frootn_storage_to_litr1n(:) - real(r8), pointer :: hrv_livestemn_storage_to_litr1n(:) - real(r8), pointer :: hrv_deadstemn_storage_to_litr1n(:) - real(r8), pointer :: hrv_livecrootn_storage_to_litr1n(:) - real(r8), pointer :: hrv_deadcrootn_storage_to_litr1n(:) - real(r8), pointer :: hrv_leafn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_frootn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_livestemn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_deadstemn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_livecrootn_xfer_to_litr1n(:) - real(r8), pointer :: hrv_deadcrootn_xfer_to_litr1n(:) -! -! local pointers to implicit out arrays -! -! -! !OTHER LOCAL VARIABLES: - integer :: fc,c,pi,p ! indices -!EOP -!----------------------------------------------------------------------- - - ! assign local pointers - lf_flab => pftcon%lf_flab - lf_fcel => pftcon%lf_fcel - lf_flig => pftcon%lf_flig - fr_flab => pftcon%fr_flab - fr_fcel => pftcon%fr_fcel - fr_flig => pftcon%fr_flig - - ! assign local pointers to column-level arrays - npfts => col%npfts - pfti => col%pfti - hrv_leafc_to_litr1c => ccf%hrv_leafc_to_litr1c - hrv_leafc_to_litr2c => ccf%hrv_leafc_to_litr2c - hrv_leafc_to_litr3c => ccf%hrv_leafc_to_litr3c - hrv_frootc_to_litr1c => ccf%hrv_frootc_to_litr1c - hrv_frootc_to_litr2c => ccf%hrv_frootc_to_litr2c - hrv_frootc_to_litr3c => ccf%hrv_frootc_to_litr3c - hrv_livestemc_to_cwdc => ccf%hrv_livestemc_to_cwdc - chrv_deadstemc_to_prod10c => ccf%hrv_deadstemc_to_prod10c - chrv_deadstemc_to_prod100c => ccf%hrv_deadstemc_to_prod100c - hrv_livecrootc_to_cwdc => ccf%hrv_livecrootc_to_cwdc - hrv_deadcrootc_to_cwdc => ccf%hrv_deadcrootc_to_cwdc - hrv_leafc_storage_to_litr1c => ccf%hrv_leafc_storage_to_litr1c - hrv_frootc_storage_to_litr1c => ccf%hrv_frootc_storage_to_litr1c - hrv_livestemc_storage_to_litr1c => ccf%hrv_livestemc_storage_to_litr1c - hrv_deadstemc_storage_to_litr1c => ccf%hrv_deadstemc_storage_to_litr1c - hrv_livecrootc_storage_to_litr1c => ccf%hrv_livecrootc_storage_to_litr1c - hrv_deadcrootc_storage_to_litr1c => ccf%hrv_deadcrootc_storage_to_litr1c - hrv_gresp_storage_to_litr1c => ccf%hrv_gresp_storage_to_litr1c - hrv_leafc_xfer_to_litr1c => ccf%hrv_leafc_xfer_to_litr1c - hrv_frootc_xfer_to_litr1c => ccf%hrv_frootc_xfer_to_litr1c - hrv_livestemc_xfer_to_litr1c => ccf%hrv_livestemc_xfer_to_litr1c - hrv_deadstemc_xfer_to_litr1c => ccf%hrv_deadstemc_xfer_to_litr1c - hrv_livecrootc_xfer_to_litr1c => ccf%hrv_livecrootc_xfer_to_litr1c - hrv_deadcrootc_xfer_to_litr1c => ccf%hrv_deadcrootc_xfer_to_litr1c - hrv_gresp_xfer_to_litr1c => ccf%hrv_gresp_xfer_to_litr1c - hrv_leafn_to_litr1n => cnf%hrv_leafn_to_litr1n - hrv_leafn_to_litr2n => cnf%hrv_leafn_to_litr2n - hrv_leafn_to_litr3n => cnf%hrv_leafn_to_litr3n - hrv_frootn_to_litr1n => cnf%hrv_frootn_to_litr1n - hrv_frootn_to_litr2n => cnf%hrv_frootn_to_litr2n - hrv_frootn_to_litr3n => cnf%hrv_frootn_to_litr3n - hrv_livestemn_to_cwdn => cnf%hrv_livestemn_to_cwdn - chrv_deadstemn_to_prod10n => cnf%hrv_deadstemn_to_prod10n - chrv_deadstemn_to_prod100n => cnf%hrv_deadstemn_to_prod100n - hrv_livecrootn_to_cwdn => cnf%hrv_livecrootn_to_cwdn - hrv_deadcrootn_to_cwdn => cnf%hrv_deadcrootn_to_cwdn - hrv_retransn_to_litr1n => cnf%hrv_retransn_to_litr1n - hrv_leafn_storage_to_litr1n => cnf%hrv_leafn_storage_to_litr1n - hrv_frootn_storage_to_litr1n => cnf%hrv_frootn_storage_to_litr1n - hrv_livestemn_storage_to_litr1n => cnf%hrv_livestemn_storage_to_litr1n - hrv_deadstemn_storage_to_litr1n => cnf%hrv_deadstemn_storage_to_litr1n - hrv_livecrootn_storage_to_litr1n => cnf%hrv_livecrootn_storage_to_litr1n - hrv_deadcrootn_storage_to_litr1n => cnf%hrv_deadcrootn_storage_to_litr1n - hrv_leafn_xfer_to_litr1n => cnf%hrv_leafn_xfer_to_litr1n - hrv_frootn_xfer_to_litr1n => cnf%hrv_frootn_xfer_to_litr1n - hrv_livestemn_xfer_to_litr1n => cnf%hrv_livestemn_xfer_to_litr1n - hrv_deadstemn_xfer_to_litr1n => cnf%hrv_deadstemn_xfer_to_litr1n - hrv_livecrootn_xfer_to_litr1n => cnf%hrv_livecrootn_xfer_to_litr1n - hrv_deadcrootn_xfer_to_litr1n => cnf%hrv_deadcrootn_xfer_to_litr1n - - ! assign local pointers to pft-level arrays - ivt => pft%itype - wtcol => pft%wtcol - pwtgcell => pft%wtgcell - hrv_leafc_to_litter => pcf%hrv_leafc_to_litter - hrv_frootc_to_litter => pcf%hrv_frootc_to_litter - hrv_livestemc_to_litter => pcf%hrv_livestemc_to_litter - phrv_deadstemc_to_prod10c => pcf%hrv_deadstemc_to_prod10c - phrv_deadstemc_to_prod100c => pcf%hrv_deadstemc_to_prod100c - hrv_livecrootc_to_litter => pcf%hrv_livecrootc_to_litter - hrv_deadcrootc_to_litter => pcf%hrv_deadcrootc_to_litter - hrv_leafc_storage_to_litter => pcf%hrv_leafc_storage_to_litter - hrv_frootc_storage_to_litter => pcf%hrv_frootc_storage_to_litter - hrv_livestemc_storage_to_litter => pcf%hrv_livestemc_storage_to_litter - hrv_deadstemc_storage_to_litter => pcf%hrv_deadstemc_storage_to_litter - hrv_livecrootc_storage_to_litter => pcf%hrv_livecrootc_storage_to_litter - hrv_deadcrootc_storage_to_litter => pcf%hrv_deadcrootc_storage_to_litter - hrv_gresp_storage_to_litter => pcf%hrv_gresp_storage_to_litter - hrv_leafc_xfer_to_litter => pcf%hrv_leafc_xfer_to_litter - hrv_frootc_xfer_to_litter => pcf%hrv_frootc_xfer_to_litter - hrv_livestemc_xfer_to_litter => pcf%hrv_livestemc_xfer_to_litter - hrv_deadstemc_xfer_to_litter => pcf%hrv_deadstemc_xfer_to_litter - hrv_livecrootc_xfer_to_litter => pcf%hrv_livecrootc_xfer_to_litter - hrv_deadcrootc_xfer_to_litter => pcf%hrv_deadcrootc_xfer_to_litter - hrv_gresp_xfer_to_litter => pcf%hrv_gresp_xfer_to_litter - hrv_leafn_to_litter => pnf%hrv_leafn_to_litter - hrv_frootn_to_litter => pnf%hrv_frootn_to_litter - hrv_livestemn_to_litter => pnf%hrv_livestemn_to_litter - phrv_deadstemn_to_prod10n => pnf%hrv_deadstemn_to_prod10n - phrv_deadstemn_to_prod100n => pnf%hrv_deadstemn_to_prod100n - hrv_livecrootn_to_litter => pnf%hrv_livecrootn_to_litter - hrv_deadcrootn_to_litter => pnf%hrv_deadcrootn_to_litter - hrv_retransn_to_litter => pnf%hrv_retransn_to_litter - hrv_leafn_storage_to_litter => pnf%hrv_leafn_storage_to_litter - hrv_frootn_storage_to_litter => pnf%hrv_frootn_storage_to_litter - hrv_livestemn_storage_to_litter => pnf%hrv_livestemn_storage_to_litter - hrv_deadstemn_storage_to_litter => pnf%hrv_deadstemn_storage_to_litter - hrv_livecrootn_storage_to_litter => pnf%hrv_livecrootn_storage_to_litter - hrv_deadcrootn_storage_to_litter => pnf%hrv_deadcrootn_storage_to_litter - hrv_leafn_xfer_to_litter => pnf%hrv_leafn_xfer_to_litter - hrv_frootn_xfer_to_litter => pnf%hrv_frootn_xfer_to_litter - hrv_livestemn_xfer_to_litter => pnf%hrv_livestemn_xfer_to_litter - hrv_deadstemn_xfer_to_litter => pnf%hrv_deadstemn_xfer_to_litter - hrv_livecrootn_xfer_to_litter => pnf%hrv_livecrootn_xfer_to_litter - hrv_deadcrootn_xfer_to_litter => pnf%hrv_deadcrootn_xfer_to_litter - - do pi = 1,maxpatch_pft - do fc = 1,num_soilc - c = filter_soilc(fc) - - if (pi <= npfts(c)) then - p = pfti(c) + pi - 1 - - if (pwtgcell(p)>0._r8) then - - ! leaf harvest mortality carbon fluxes - hrv_leafc_to_litr1c(c) = hrv_leafc_to_litr1c(c) + & - hrv_leafc_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - hrv_leafc_to_litr2c(c) = hrv_leafc_to_litr2c(c) + & - hrv_leafc_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - hrv_leafc_to_litr3c(c) = hrv_leafc_to_litr3c(c) + & - hrv_leafc_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root harvest mortality carbon fluxes - hrv_frootc_to_litr1c(c) = hrv_frootc_to_litr1c(c) + & - hrv_frootc_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - hrv_frootc_to_litr2c(c) = hrv_frootc_to_litr2c(c) + & - hrv_frootc_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - hrv_frootc_to_litr3c(c) = hrv_frootc_to_litr3c(c) + & - hrv_frootc_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! wood harvest mortality carbon fluxes - hrv_livestemc_to_cwdc(c) = hrv_livestemc_to_cwdc(c) + & - hrv_livestemc_to_litter(p) * wtcol(p) - chrv_deadstemc_to_prod10c(c) = chrv_deadstemc_to_prod10c(c) + & - phrv_deadstemc_to_prod10c(p) * wtcol(p) - chrv_deadstemc_to_prod100c(c) = chrv_deadstemc_to_prod100c(c) + & - phrv_deadstemc_to_prod100c(p) * wtcol(p) - hrv_livecrootc_to_cwdc(c) = hrv_livecrootc_to_cwdc(c) + & - hrv_livecrootc_to_litter(p) * wtcol(p) - hrv_deadcrootc_to_cwdc(c) = hrv_deadcrootc_to_cwdc(c) + & - hrv_deadcrootc_to_litter(p) * wtcol(p) - - ! storage harvest mortality carbon fluxes - hrv_leafc_storage_to_litr1c(c) = hrv_leafc_storage_to_litr1c(c) + & - hrv_leafc_storage_to_litter(p) * wtcol(p) - hrv_frootc_storage_to_litr1c(c) = hrv_frootc_storage_to_litr1c(c) + & - hrv_frootc_storage_to_litter(p) * wtcol(p) - hrv_livestemc_storage_to_litr1c(c) = hrv_livestemc_storage_to_litr1c(c) + & - hrv_livestemc_storage_to_litter(p) * wtcol(p) - hrv_deadstemc_storage_to_litr1c(c) = hrv_deadstemc_storage_to_litr1c(c) + & - hrv_deadstemc_storage_to_litter(p) * wtcol(p) - hrv_livecrootc_storage_to_litr1c(c) = hrv_livecrootc_storage_to_litr1c(c) + & - hrv_livecrootc_storage_to_litter(p) * wtcol(p) - hrv_deadcrootc_storage_to_litr1c(c) = hrv_deadcrootc_storage_to_litr1c(c) + & - hrv_deadcrootc_storage_to_litter(p) * wtcol(p) - hrv_gresp_storage_to_litr1c(c) = hrv_gresp_storage_to_litr1c(c) + & - hrv_gresp_storage_to_litter(p) * wtcol(p) - - ! transfer harvest mortality carbon fluxes - hrv_leafc_xfer_to_litr1c(c) = hrv_leafc_xfer_to_litr1c(c) + & - hrv_leafc_xfer_to_litter(p) * wtcol(p) - hrv_frootc_xfer_to_litr1c(c) = hrv_frootc_xfer_to_litr1c(c) + & - hrv_frootc_xfer_to_litter(p) * wtcol(p) - hrv_livestemc_xfer_to_litr1c(c) = hrv_livestemc_xfer_to_litr1c(c) + & - hrv_livestemc_xfer_to_litter(p) * wtcol(p) - hrv_deadstemc_xfer_to_litr1c(c) = hrv_deadstemc_xfer_to_litr1c(c) + & - hrv_deadstemc_xfer_to_litter(p) * wtcol(p) - hrv_livecrootc_xfer_to_litr1c(c) = hrv_livecrootc_xfer_to_litr1c(c) + & - hrv_livecrootc_xfer_to_litter(p) * wtcol(p) - hrv_deadcrootc_xfer_to_litr1c(c) = hrv_deadcrootc_xfer_to_litr1c(c) + & - hrv_deadcrootc_xfer_to_litter(p) * wtcol(p) - hrv_gresp_xfer_to_litr1c(c) = hrv_gresp_xfer_to_litr1c(c) + & - hrv_gresp_xfer_to_litter(p) * wtcol(p) - - ! leaf harvest mortality nitrogen fluxes - hrv_leafn_to_litr1n(c) = hrv_leafn_to_litr1n(c) + & - hrv_leafn_to_litter(p) * lf_flab(ivt(p)) * wtcol(p) - hrv_leafn_to_litr2n(c) = hrv_leafn_to_litr2n(c) + & - hrv_leafn_to_litter(p) * lf_fcel(ivt(p)) * wtcol(p) - hrv_leafn_to_litr3n(c) = hrv_leafn_to_litr3n(c) + & - hrv_leafn_to_litter(p) * lf_flig(ivt(p)) * wtcol(p) - - ! fine root litter nitrogen fluxes - hrv_frootn_to_litr1n(c) = hrv_frootn_to_litr1n(c) + & - hrv_frootn_to_litter(p) * fr_flab(ivt(p)) * wtcol(p) - hrv_frootn_to_litr2n(c) = hrv_frootn_to_litr2n(c) + & - hrv_frootn_to_litter(p) * fr_fcel(ivt(p)) * wtcol(p) - hrv_frootn_to_litr3n(c) = hrv_frootn_to_litr3n(c) + & - hrv_frootn_to_litter(p) * fr_flig(ivt(p)) * wtcol(p) - - ! wood harvest mortality nitrogen fluxes - hrv_livestemn_to_cwdn(c) = hrv_livestemn_to_cwdn(c) + & - hrv_livestemn_to_litter(p) * wtcol(p) - chrv_deadstemn_to_prod10n(c) = chrv_deadstemn_to_prod10n(c) + & - phrv_deadstemn_to_prod10n(p) * wtcol(p) - chrv_deadstemn_to_prod100n(c) = chrv_deadstemn_to_prod100n(c) + & - phrv_deadstemn_to_prod100n(p) * wtcol(p) - hrv_livecrootn_to_cwdn(c) = hrv_livecrootn_to_cwdn(c) + & - hrv_livecrootn_to_litter(p) * wtcol(p) - hrv_deadcrootn_to_cwdn(c) = hrv_deadcrootn_to_cwdn(c) + & - hrv_deadcrootn_to_litter(p) * wtcol(p) - - ! retranslocated N pool harvest mortality fluxes - hrv_retransn_to_litr1n(c) = hrv_retransn_to_litr1n(c) + & - hrv_retransn_to_litter(p) * wtcol(p) - - ! storage harvest mortality nitrogen fluxes - hrv_leafn_storage_to_litr1n(c) = hrv_leafn_storage_to_litr1n(c) + & - hrv_leafn_storage_to_litter(p) * wtcol(p) - hrv_frootn_storage_to_litr1n(c) = hrv_frootn_storage_to_litr1n(c) + & - hrv_frootn_storage_to_litter(p) * wtcol(p) - hrv_livestemn_storage_to_litr1n(c) = hrv_livestemn_storage_to_litr1n(c) + & - hrv_livestemn_storage_to_litter(p) * wtcol(p) - hrv_deadstemn_storage_to_litr1n(c) = hrv_deadstemn_storage_to_litr1n(c) + & - hrv_deadstemn_storage_to_litter(p) * wtcol(p) - hrv_livecrootn_storage_to_litr1n(c) = hrv_livecrootn_storage_to_litr1n(c) + & - hrv_livecrootn_storage_to_litter(p) * wtcol(p) - hrv_deadcrootn_storage_to_litr1n(c) = hrv_deadcrootn_storage_to_litr1n(c) + & - hrv_deadcrootn_storage_to_litter(p) * wtcol(p) - - ! transfer harvest mortality nitrogen fluxes - hrv_leafn_xfer_to_litr1n(c) = hrv_leafn_xfer_to_litr1n(c) + & - hrv_leafn_xfer_to_litter(p) * wtcol(p) - hrv_frootn_xfer_to_litr1n(c) = hrv_frootn_xfer_to_litr1n(c) + & - hrv_frootn_xfer_to_litter(p) * wtcol(p) - hrv_livestemn_xfer_to_litr1n(c) = hrv_livestemn_xfer_to_litr1n(c) + & - hrv_livestemn_xfer_to_litter(p) * wtcol(p) - hrv_deadstemn_xfer_to_litr1n(c) = hrv_deadstemn_xfer_to_litr1n(c) + & - hrv_deadstemn_xfer_to_litter(p) * wtcol(p) - hrv_livecrootn_xfer_to_litr1n(c) = hrv_livecrootn_xfer_to_litr1n(c) + & - hrv_livecrootn_xfer_to_litter(p) * wtcol(p) - hrv_deadcrootn_xfer_to_litr1n(c) = hrv_deadcrootn_xfer_to_litr1n(c) + & - hrv_deadcrootn_xfer_to_litter(p) * wtcol(p) - - end if - end if - - end do - - end do - -end subroutine CNHarvestPftToColumn -!----------------------------------------------------------------------- - -end module pftdynMod diff --git a/src_clm40/main/pftvarcon.F90 b/src_clm40/main/pftvarcon.F90 deleted file mode 100644 index 07882a1464..0000000000 --- a/src_clm40/main/pftvarcon.F90 +++ /dev/null @@ -1,489 +0,0 @@ -module pftvarcon - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: pftvarcon -! -! !DESCRIPTION: -! Module containing vegetation constants and method to -! read and initialize vegetation (PFT) constants. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_varpar , only : mxpft, numpft, numrad, ivis, inir - use clm_varctl , only : iulog, use_cn, use_cndv -! -! !PUBLIC TYPES: - implicit none - save -! -! Vegetation type constants -! - character(len=40) pftname(0:mxpft) !PFT description - - integer :: noveg !value for not vegetated - integer :: ndllf_evr_tmp_tree !value for Needleleaf evergreen temperate tree - integer :: ndllf_evr_brl_tree !value for Needleleaf evergreen boreal tree - integer :: ndllf_dcd_brl_tree !value for Needleleaf deciduous boreal tree - integer :: nbrdlf_evr_trp_tree !value for Broadleaf evergreen tropical tree - integer :: nbrdlf_evr_tmp_tree !value for Broadleaf evergreen temperate tree - integer :: nbrdlf_dcd_trp_tree !value for Broadleaf deciduous tropical tree - integer :: nbrdlf_dcd_tmp_tree !value for Broadleaf deciduous temperate tree - integer :: nbrdlf_dcd_brl_tree !value for Broadleaf deciduous boreal tree - integer :: ntree !value for last type of tree - integer :: nbrdlf_evr_shrub !value for Broadleaf evergreen shrub - integer :: nbrdlf_dcd_tmp_shrub !value for Broadleaf deciduous temperate shrub - integer :: nbrdlf_dcd_brl_shrub !value for Broadleaf deciduous boreal shrub - integer :: nc3_arctic_grass !value for C3 arctic grass - integer :: nc3_nonarctic_grass !value for C3 non-arctic grass - integer :: nc4_grass !value for C4 grass - integer :: npcropmin !value for first crop - integer :: ncorn !value for corn - integer :: nscereal !value for spring temperate cereal - integer :: nwcereal !value for winter temperate cereal - integer :: nsoybean !value for soybean - integer :: npcropmax !value for last prognostic crop in list - integer :: nc3crop !value for generic crop - integer :: nirrig !value for irrigated generic crop - - real(r8):: dleaf(0:mxpft) !characteristic leaf dimension (m) - real(r8):: c3psn(0:mxpft) !photosynthetic pathway: 0. = c4, 1. = c3 - real(r8):: mp(0:mxpft) !slope of conductance-to-photosynthesis relationship - real(r8):: qe25(0:mxpft) !quantum efficiency at 25C (umol CO2 / umol photon) - real(r8):: xl(0:mxpft) !leaf/stem orientation index - real(r8):: rhol(0:mxpft,numrad) !leaf reflectance: 1=vis, 2=nir - real(r8):: rhos(0:mxpft,numrad) !stem reflectance: 1=vis, 2=nir - real(r8):: taul(0:mxpft,numrad) !leaf transmittance: 1=vis, 2=nir - real(r8):: taus(0:mxpft,numrad) !stem transmittance: 1=vis, 2=nir - real(r8):: z0mr(0:mxpft) !ratio of momentum roughness length to canopy top height (-) - real(r8):: displar(0:mxpft) !ratio of displacement height to canopy top height (-) - real(r8):: roota_par(0:mxpft) !CLM rooting distribution parameter [1/m] - real(r8):: rootb_par(0:mxpft) !CLM rooting distribution parameter [1/m] - real(r8):: crop(0:mxpft) ! crop pft: 0. = not crop, 1. = crop pft - real(r8):: irrigated(0:mxpft) ! irrigated pft: 0. = not, 1. = irrigated - real(r8):: smpso(0:mxpft) !soil water potential at full stomatal opening (mm) - real(r8):: smpsc(0:mxpft) !soil water potential at full stomatal closure (mm) - real(r8):: fnitr(0:mxpft) !foliage nitrogen limitation factor (-) - ! begin new pft parameters for CN code - real(r8):: slatop(0:mxpft) !SLA at top of canopy [m^2/gC] - real(r8):: dsladlai(0:mxpft) !dSLA/dLAI [m^2/gC] - real(r8):: leafcn(0:mxpft) !leaf C:N [gC/gN] - real(r8):: flnr(0:mxpft) !fraction of leaf N in Rubisco [no units] - real(r8):: woody(0:mxpft) !woody lifeform flag (0 or 1) - real(r8):: lflitcn(0:mxpft) !leaf litter C:N (gC/gN) - real(r8):: frootcn(0:mxpft) !fine root C:N (gC/gN) - real(r8):: livewdcn(0:mxpft) !live wood (phloem and ray parenchyma) C:N (gC/gN) - real(r8):: deadwdcn(0:mxpft) !dead wood (xylem and heartwood) C:N (gC/gN) - real(r8):: grperc(0:mxpft) !growth respiration parameter - real(r8):: grpnow(0:mxpft) !growth respiration parameter - -! for crop - real(r8):: graincn(0:mxpft) !grain C:N (gC/gN) - real(r8):: mxtmp(0:mxpft) !parameter used in accFlds - real(r8):: baset(0:mxpft) !parameter used in accFlds - real(r8):: declfact(0:mxpft) !parameter used in CNAllocation - real(r8):: bfact(0:mxpft) !parameter used in CNAllocation - real(r8):: aleaff(0:mxpft) !parameter used in CNAllocation - real(r8):: arootf(0:mxpft) !parameter used in CNAllocation - real(r8):: astemf(0:mxpft) !parameter used in CNAllocation - real(r8):: arooti(0:mxpft) !parameter used in CNAllocation - real(r8):: fleafi(0:mxpft) !parameter used in CNAllocation - real(r8):: allconsl(0:mxpft) !parameter used in CNAllocation - real(r8):: allconss(0:mxpft) !parameter used in CNAllocation - real(r8):: ztopmx(0:mxpft) !parameter used in CNVegStructUpdate - real(r8):: laimx(0:mxpft) !parameter used in CNVegStructUpdate - real(r8):: gddmin(0:mxpft) !parameter used in CNPhenology - real(r8):: hybgdd(0:mxpft) !parameter used in CNPhenology - real(r8):: lfemerg(0:mxpft) !parameter used in CNPhenology - real(r8):: grnfill(0:mxpft) !parameter used in CNPhenology - integer :: mxmat(0:mxpft) !parameter used in CNPhenology - integer :: mnNHplantdate(0:mxpft)!minimum planting date for NorthHemisphere (YYYYMMDD) - integer :: mxNHplantdate(0:mxpft)!maximum planting date for NorthHemisphere (YYYYMMDD) - integer :: mnSHplantdate(0:mxpft)!minimum planting date for SouthHemisphere (YYYYMMDD) - integer :: mxSHplantdate(0:mxpft)!maximum planting date for SouthHemisphere (YYYYMMDD) - real(r8):: planttemp(0:mxpft) !planting temperature used in CNPhenology (K) - real(r8):: minplanttemp(0:mxpft) !mininum planting temperature used in CNPhenology (K) - real(r8):: froot_leaf(0:mxpft) !allocation parameter: new fine root C per new leaf C (gC/gC) - real(r8):: stem_leaf(0:mxpft) !allocation parameter: new stem c per new leaf C (gC/gC) - real(r8):: croot_stem(0:mxpft) !allocation parameter: new coarse root C per new stem C (gC/gC) - real(r8):: flivewd(0:mxpft) !allocation parameter: fraction of new wood that is live (phloem and ray parenchyma) (no units) - real(r8):: fcur(0:mxpft) !allocation parameter: fraction of allocation that goes to currently displayed growth, remainder to storage - real(r8):: fcurdv(0:mxpft) !alternate fcur for use with cndv - real(r8):: lf_flab(0:mxpft) !leaf litter labile fraction - real(r8):: lf_fcel(0:mxpft) !leaf litter cellulose fraction - real(r8):: lf_flig(0:mxpft) !leaf litter lignin fraction - real(r8):: fr_flab(0:mxpft) !fine root litter labile fraction - real(r8):: fr_fcel(0:mxpft) !fine root litter cellulose fraction - real(r8):: fr_flig(0:mxpft) !fine root litter lignin fraction - real(r8):: leaf_long(0:mxpft) !leaf longevity (yrs) - real(r8):: evergreen(0:mxpft) !binary flag for evergreen leaf habit (0 or 1) - real(r8):: stress_decid(0:mxpft) !binary flag for stress-deciduous leaf habit (0 or 1) - real(r8):: season_decid(0:mxpft) !binary flag for seasonal-deciduous leaf habit (0 or 1) - real(r8):: pconv(0:mxpft) !proportion of deadstem to conversion flux - real(r8):: pprod10(0:mxpft) !proportion of deadstem to 10-yr product pool - real(r8):: pprod100(0:mxpft) !proportion of deadstem to 100-yr product pool - real(r8):: pprodharv10(0:mxpft) !harvest mortality proportion of deadstem to 10-yr pool - - ! new pft parameters for CN-fire code - real(r8):: resist(0:mxpft) !resistance to fire (no units) - - ! pft parameters for CNDV code - ! from LPJ subroutine pftparameters - real(r8) pftpar20(0:mxpft) !tree maximum crown area (m2) - real(r8) pftpar28(0:mxpft) !min coldest monthly mean temperature - real(r8) pftpar29(0:mxpft) !max coldest monthly mean temperature - real(r8) pftpar30(0:mxpft) !min growing degree days (>= 5 deg C) - real(r8) pftpar31(0:mxpft) !upper limit of temperature of the warmest month (twmax) - real(r8), parameter :: reinickerp = 1.6_r8 !parameter in allometric equation - real(r8), parameter :: dwood = 2.5e5_r8 !cn wood density (gC/m3); lpj:2.0e5 - real(r8), parameter :: allom1 = 100.0_r8 !parameters in - real(r8), parameter :: allom2 = 40.0_r8 !...allometric - real(r8), parameter :: allom3 = 0.5_r8 !...equations - real(r8), parameter :: allom1s = 250.0_r8 !modified for shrubs by - real(r8), parameter :: allom2s = 8.0_r8 !X.D.Z -! -! !PUBLIC MEMBER FUNCTIONS: - public :: pftconrd ! Read and initialize vegetation (PFT) constants -! -! !REVISION HISTORY: -! Created by Sam Levis (put into module form by Mariana Vertenstein) -! 10/21/03, Peter Thornton: Added new variables for CN code -! 06/24/09, Erik Kluzek: Add indices for all pft types, and add expected_pftnames array and comparision -! 09/17/10, David Lawrence: Modified code to read in netCDF pft physiology file -! -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: pftconrd -! -! !INTERFACE: - subroutine pftconrd -! -! !DESCRIPTION: -! Read and initialize vegetation (PFT) constants -! -! !USES: - use fileutils , only : getfil - use ncdio_pio , only : ncd_io, ncd_pio_closefile, ncd_pio_openfile, file_desc_t, & - ncd_inqdid, ncd_inqdlen - use clm_varctl, only : fpftcon - use clm_varcon, only : tfrz - use spmdMod , only : masterproc -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! routine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - character(len=256) :: locfn ! local file name - integer :: i,n ! loop indices - integer :: ier ! error code - type(file_desc_t) :: ncid ! pio netCDF file id - integer :: dimid ! netCDF dimension id - integer :: npft ! number of pfts on pft-physiology file - logical :: readv ! read variable in or not - character(len=32) :: subname = 'pftconrd' ! subroutine name - ! - ! Expected PFT names: The names expected on the fpftcon file and the order they are expected to be in. - ! NOTE: similar types are assumed to be together, first trees (ending with broadleaf_deciduous_boreal_tree - ! then shrubs, ending with broadleaf_deciduous_boreal_shrub, then grasses starting with c3_arctic_grass - ! and finally crops, ending with soybean - ! DO NOT CHANGE THE ORDER -- WITHOUT MODIFYING OTHER PARTS OF THE CODE WHERE THE ORDER MATTERS! - ! - character(len=40), parameter :: expected_pftnames(0:mxpft) = (/ & - 'not_vegetated ' & - , 'needleleaf_evergreen_temperate_tree' & - , 'needleleaf_evergreen_boreal_tree ' & - , 'needleleaf_deciduous_boreal_tree ' & - , 'broadleaf_evergreen_tropical_tree ' & - , 'broadleaf_evergreen_temperate_tree ' & - , 'broadleaf_deciduous_tropical_tree ' & - , 'broadleaf_deciduous_temperate_tree ' & - , 'broadleaf_deciduous_boreal_tree ' & - , 'broadleaf_evergreen_shrub ' & - , 'broadleaf_deciduous_temperate_shrub' & - , 'broadleaf_deciduous_boreal_shrub ' & - , 'c3_arctic_grass ' & - , 'c3_non-arctic_grass ' & - , 'c4_grass ' & - , 'c3_crop ' & - , 'c3_irrigated ' & - , 'corn ' & - , 'spring_temperate_cereal ' & - , 'winter_temperate_cereal ' & - , 'soybean ' & - /) -!----------------------------------------------------------------------- - - ! Set specific vegetation type values - - if (masterproc) then - write(iulog,*) 'Attempting to read PFT physiological data .....' - end if - call getfil (fpftcon, locfn, 0) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqdid(ncid,'pft',dimid) - call ncd_inqdlen(ncid,dimid,npft) - - call ncd_io('pftname',pftname, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('z0mr',z0mr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('displar',displar, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('dleaf',dleaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('c3psn',c3psn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('mp',mp, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('qe25',qe25, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('rholvis',rhol(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('rholnir',rhol(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('rhosvis',rhos(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('rhosnir', rhos(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('taulvis',taul(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('taulnir',taul(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('tausvis',taus(:,ivis), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('tausnir',taus(:,inir), 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('xl',xl, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('roota_par',roota_par, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('rootb_par',rootb_par, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('slatop',slatop, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('dsladlai',dsladlai, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('leafcn',leafcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('flnr',flnr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('smpso',smpso, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('smpsc',smpsc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fnitr',fnitr, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('woody',woody, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('lflitcn',lflitcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('frootcn',frootcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('livewdcn',livewdcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('deadwdcn',deadwdcn, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('grperc',grperc, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('grpnow',grpnow, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('froot_leaf',froot_leaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('stem_leaf',stem_leaf, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('croot_stem',croot_stem, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('flivewd',flivewd, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fcur',fcur, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fcurdv',fcurdv, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('lf_flab',lf_flab, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('lf_fcel',lf_fcel, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('lf_flig',lf_flig, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fr_flab',fr_flab, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fr_fcel',fr_fcel, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fr_flig',fr_flig, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('leaf_long',leaf_long, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('evergreen',evergreen, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('stress_decid',stress_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('season_decid',season_decid, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('resist',resist, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pftpar20',pftpar20, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pftpar28',pftpar28, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pftpar29',pftpar29, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pftpar30',pftpar30, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pftpar31',pftpar31, 'read', ncid, readvar=readv, posNOTonfile=.true.) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pconv',pconv, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pprod10',pprod10, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pprodharv10',pprodharv10, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('pprod100',pprod100, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('graincn',graincn, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('mxtmp',mxtmp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('baset',baset, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('declfact',declfact, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('bfact',bfact, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('aleaff',aleaff, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('arootf',arootf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('astemf',astemf, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('arooti',arooti, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('fleafi',fleafi, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('allconsl',allconsl, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('allconss',allconss, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('crop',crop, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('irrigated',irrigated, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('ztopmx',ztopmx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('laimx',laimx, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('gddmin',gddmin, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('hybgdd',hybgdd, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('lfemerg',lfemerg, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('grnfill',grnfill, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('mxmat',mxmat, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('planting_temp',planttemp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('min_planting_temp',minplanttemp, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('min_NH_planting_date',mnNHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('min_SH_planting_date',mnSHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('max_NH_planting_date',mxNHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_io('max_SH_planting_date',mxSHplantdate, 'read', ncid, readvar=readv) - if ( .not. readv ) call endrun( trim(subname)//' ERROR: error in reading in pft data' ) - call ncd_pio_closefile(ncid) - - do i = 0, mxpft - if ( trim(adjustl(pftname(i))) /= trim(expected_pftnames(i)) )then - write(iulog,*)'pftconrd: pftname is NOT what is expected, name = ', & - trim(pftname(i)), ', expected name = ', trim(expected_pftnames(i)) - call endrun( 'pftconrd: bad name for pft on fpftcon dataset' ) - end if - if ( trim(pftname(i)) == 'not_vegetated' ) noveg = i - if ( trim(pftname(i)) == 'needleleaf_evergreen_temperate_tree' ) ndllf_evr_tmp_tree = i - if ( trim(pftname(i)) == 'needleleaf_evergreen_boreal_tree' ) ndllf_evr_brl_tree = i - if ( trim(pftname(i)) == 'needleleaf_deciduous_boreal_tree' ) ndllf_dcd_brl_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_tropical_tree' ) nbrdlf_evr_trp_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_temperate_tree' ) nbrdlf_evr_tmp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_tropical_tree' ) nbrdlf_dcd_trp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_temperate_tree' ) nbrdlf_dcd_tmp_tree = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_boreal_tree' ) nbrdlf_dcd_brl_tree = i - if ( trim(pftname(i)) == 'broadleaf_evergreen_shrub' ) nbrdlf_evr_shrub = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_temperate_shrub' ) nbrdlf_dcd_tmp_shrub = i - if ( trim(pftname(i)) == 'broadleaf_deciduous_boreal_shrub' ) nbrdlf_dcd_brl_shrub = i - if ( trim(pftname(i)) == 'c3_arctic_grass' ) nc3_arctic_grass = i - if ( trim(pftname(i)) == 'c3_non-arctic_grass' ) nc3_nonarctic_grass = i - if ( trim(pftname(i)) == 'c4_grass' ) nc4_grass = i - if ( trim(pftname(i)) == 'c3_crop' ) nc3crop = i - if ( trim(pftname(i)) == 'c3_irrigated' ) nirrig = i - if ( trim(pftname(i)) == 'corn' ) ncorn = i - if ( trim(pftname(i)) == 'spring_temperate_cereal' ) nscereal = i - if ( trim(pftname(i)) == 'winter_temperate_cereal' ) nwcereal = i - if ( trim(pftname(i)) == 'soybean' ) nsoybean = i - end do - - ntree = nbrdlf_dcd_brl_tree ! value for last type of tree - npcropmin = ncorn ! first prognostic crop - npcropmax = nsoybean ! last prognostic crop in list - - if (use_cndv) then - fcur(:) = fcurdv(:) - end if - - ! - ! Do some error checking - ! - if ( npcropmax /= mxpft )then - call endrun( trim(subname)//' ERROR: npcropmax is NOT the last value' ) - end if - do i = 0, mxpft - if ( (irrigated(i) == 1.0_r8) .and. i == nirrig )then - ! correct - else if ( irrigated(i) == 0.0_r8 )then - ! correct - else - call endrun( trim(subname)//' ERROR: irrigated has wrong values' ) - end if - if ( crop(i) == 1.0_r8 .and. (i >= nc3crop .and. i <= npcropmax) )then - ! correct - else if ( crop(i) == 0.0_r8 )then - ! correct - else - call endrun( trim(subname)//' ERROR: crop has wrong values' ) - end if - if ( (i /= noveg) .and. (i < npcropmin) .and. & - abs(pconv(i)+pprod10(i)+pprod100(i) - 1.0_r8) > 1.e-7_r8 )then - call endrun( trim(subname)//' ERROR: pconv+pprod10+pprod100 do NOT sum to one.' ) - end if - if ( pprodharv10(i) > 1.0_r8 .or. pprodharv10(i) < 0.0_r8 )then - call endrun( trim(subname)//' ERROR: pprodharv10 outside of range.' ) - end if - end do - - if (masterproc) then - write(iulog,*) 'Successfully read PFT physiological data' - write(iulog,*) - end if - - end subroutine pftconrd - -end module pftvarcon - diff --git a/src_clm40/main/quadraticMod.F90 b/src_clm40/main/quadraticMod.F90 deleted file mode 100644 index ef3e561bb7..0000000000 --- a/src_clm40/main/quadraticMod.F90 +++ /dev/null @@ -1,57 +0,0 @@ -module quadraticMod - - use abortutils , only: endrun - use shr_kind_mod, only: r8 => shr_kind_r8 - use shr_log_mod , only: errMsg => shr_log_errMsg - use clm_varctl , only: iulog - - implicit none - - public :: quadratic - -contains - - subroutine quadratic (a, b, c, r1, r2) - ! - ! !DESCRIPTION: - !==============================================================================! - !----------------- Solve quadratic equation for its two roots -----------------! - !==============================================================================! - ! Solution from Press et al (1986) Numerical Recipes: The Art of Scientific - ! Computing (Cambridge University Press, Cambridge), pp. 145. - ! - ! !REVISION HISTORY: - ! 4/5/10: Adapted from /home/bonan/ecm/psn/An_gs_iterative.f90 by Keith Oleson - ! - ! !USES: - implicit none - ! - ! !ARGUMENTS: - real(r8), intent(in) :: a,b,c ! Terms for quadratic equation - real(r8), intent(out) :: r1,r2 ! Roots of quadratic equation - ! - ! !LOCAL VARIABLES: - real(r8) :: q ! Temporary term for quadratic solution - !------------------------------------------------------------------------------ - - if (a == 0._r8) then - write (iulog,*) 'Quadratic solution error: a = ',a - call endrun(msg=errmsg(__FILE__, __LINE__)) - end if - - if (b >= 0._r8) then - q = -0.5_r8 * (b + sqrt(b*b - 4._r8*a*c)) - else - q = -0.5_r8 * (b - sqrt(b*b - 4._r8*a*c)) - end if - - r1 = q / a - if (q /= 0._r8) then - r2 = c / q - else - r2 = 1.e36_r8 - end if - - end subroutine quadratic - -end module quadraticMod diff --git a/src_clm40/main/restFileMod.F90 b/src_clm40/main/restFileMod.F90 deleted file mode 100644 index 82e47b7d7e..0000000000 --- a/src_clm40/main/restFileMod.F90 +++ /dev/null @@ -1,729 +0,0 @@ -module restFileMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: restFileMod -! -! !DESCRIPTION: -! Reads from or writes to/ the CLM restart file. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc - use abortutils , only : endrun - use clm_varctl , only : iulog, use_cn - use surfrdMod , only : crop_prog - use ncdio_pio , only : file_desc_t, ncd_pio_createfile, ncd_pio_openfile, ncd_global, & - ncd_pio_closefile, ncd_defdim, ncd_putatt, ncd_enddef, check_dim -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: restFile_read - public :: restFile_write - public :: restFile_open - public :: restFile_close - public :: restFile_getfile - public :: restFile_filename ! Sets restart filename -! -! !PRIVATE MEMBER FUNCTIONS: - private :: restFile_read_pfile - private :: restFile_write_pfile ! Writes restart pointer file - private :: restFile_closeRestart ! Close restart file and write restart pointer file - private :: restFile_dimset - private :: restFile_dimcheck - private :: restFile_enddef -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !PRIVATE TYPES: None - private -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_write -! -! !INTERFACE: - subroutine restFile_write( file, nlend, noptr, rdate ) -! -! !DESCRIPTION: -! Read/write CLM restart file. -! -! !USES: - use clm_time_manager , only : timemgr_restart_io, get_nstep - use subgridRestMod , only : SubgridRest - use BiogeophysRestMod, only : BiogeophysRest - use CNRestMod , only : CNRest - use CropRestMod , only : CropRest - use accumulMod , only : accumulRest - use histFileMod , only : hist_restart_ncd -! -! !ARGUMENTS: - implicit none - character(len=*) , intent(in) :: file ! output netcdf restart file - logical, intent(in) :: nlend ! if at the end of the simulation - character(len=*) , intent(in) :: rdate ! restart file time stamp for name - logical, intent(in), optional :: noptr ! if should NOT write to the restart pointer file -! -! !CALLED FROM: -! subroutine clm_driver2 -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - type(file_desc_t) :: ncid ! netcdf id - integer :: i ! index - logical :: ptrfile ! write out the restart pointer file -!----------------------------------------------------------------------- - - if ( present(noptr) )then - ptrfile = .not. noptr - else - ptrfile = .true. - end if - - ! -------------------------------------------- - ! Open restart file - ! -------------------------------------------- - - call restFile_open( flag='write', file=file, ncid=ncid ) - - ! -------------------------------------------- - ! Define dimensions and variables - ! -------------------------------------------- - - call restFile_dimset ( ncid ) - - ! Define restart file variables - - call timemgr_restart_io( ncid, flag='define' ) - - call SubgridRest( ncid, flag='define' ) - - call BiogeophysRest( ncid, flag='define' ) - - if (use_cn) then - call CNRest( ncid, flag='define' ) - if ( crop_prog ) call CropRest( ncid, flag='define' ) - end if - - call accumulRest( ncid, flag='define' ) - - call hist_restart_ncd ( ncid, flag='define', rdate=rdate ) - - call restFile_enddef( ncid ) - - ! -------------------------------------------- - ! Write restart file variables - ! -------------------------------------------- - - call timemgr_restart_io( ncid, flag='write' ) - - call SubgridRest( ncid, flag='write' ) - - call BiogeophysRest( ncid, flag='write' ) - - if (use_cn) then - call CNRest( ncid, flag='write' ) - if ( crop_prog ) call CropRest( ncid, flag='write' ) - end if - - call accumulRest( ncid, flag='write' ) - - call hist_restart_ncd (ncid, flag='write' ) - - ! -------------------------------------------- - ! Close restart file and write restart pointer file - ! -------------------------------------------- - - call restFile_close( ncid ) - call restFile_closeRestart( file, nlend ) - - ! Write restart pointer file - - if ( ptrfile ) call restFile_write_pfile( file ) - - ! Write out diagnostic info - - if (masterproc) then - write(iulog,*) 'Successfully wrote out restart data at nstep = ',get_nstep() - write(iulog,'(72a1)') ("-",i=1,60) - end if - - end subroutine restFile_write - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_read -! -! !INTERFACE: - subroutine restFile_read( file ) -! -! !DESCRIPTION: -! Read a CLM restart file. -! -! !USES: - use BiogeophysRestMod, only : BiogeophysRest - use CNRestMod , only : CNRest - use CropRestMod , only : CropRest - use accumulMod , only : accumulRest - use histFileMod , only : hist_restart_ncd -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: file ! output netcdf restart file -! -! !CALLED FROM: -! subroutine initialize2 -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - type(file_desc_t) :: ncid ! netcdf id - integer :: i ! index -!----------------------------------------------------------------------- - - ! Open file - - call restFile_open( flag='read', file=file, ncid=ncid ) - - ! Read file - - call restFile_dimcheck( ncid ) - - call BiogeophysRest( ncid, flag='read' ) - - if (use_cn) then - call CNRest( ncid, flag='read' ) - if ( crop_prog ) call CropRest( ncid, flag='read' ) - end if - - call accumulRest( ncid, flag='read' ) - - call hist_restart_ncd (ncid, flag='read') - - ! Close file - - call restFile_close( ncid ) - - ! Write out diagnostic info - - if (masterproc) then - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) 'Successfully read restart data for restart run' - write(iulog,*) - end if - - end subroutine restFile_read - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_getfile -! -! !INTERFACE: - subroutine restFile_getfile( file, path ) -! -! !DESCRIPTION: -! Determine and obtain netcdf restart file -! -! !USES: - use clm_varctl, only : caseid, finidat, nrevsn, nsrest, brnch_retain_casename, & - nsrContinue, nsrBranch, nsrStartup - use fileutils , only : getfil -! -! !ARGUMENTS: - implicit none - character(len=*), intent(out) :: file ! name of netcdf restart file - character(len=*), intent(out) :: path ! full pathname of netcdf restart file -! -! !CALLED FROM: -! subroutine initialize2 -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: status ! return status - integer :: length ! temporary - character(len=256) :: ftest,ctest ! temporaries -!----------------------------------------------------------------------- - - ! Continue run: - ! Restart file pathname is read restart pointer file - - if (nsrest==nsrContinue) then - call restFile_read_pfile( path ) - call getfil( path, file, 0 ) - end if - - ! Branch run: - ! Restart file pathname is obtained from namelist "nrevsn" - ! Check case name consistency (case name must be different for branch run, - ! unless namelist specification states otherwise) - - if (nsrest==nsrBranch) then - length = len_trim(nrevsn) - if (nrevsn(length-2:length) == '.nc') then - path = trim(nrevsn) - else - path = trim(nrevsn) // '.nc' - end if - call getfil( path, file, 0 ) - - ! tcraig, adding xx. and .clm2 makes this more robust - ctest = 'xx.'//trim(caseid)//'.clm2' - ftest = 'xx.'//trim(file) - status = index(trim(ftest),trim(ctest)) - if (status /= 0 .and. .not.(brnch_retain_casename)) then - write(iulog,*) 'Must change case name on branch run if ',& - 'brnch_retain_casename namelist is not set' - write(iulog,*) 'previous case filename= ',trim(file),& - ' current case = ',trim(caseid), ' ctest = ',trim(ctest), & - ' ftest = ',trim(ftest) - call endrun() - end if - end if - - ! Initial run: - ! Restart file pathname is obtained from namelist "finidat" - - if (nsrest==nsrStartup) then - call getfil( finidat, file, 0 ) - end if - - end subroutine restFile_getfile - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_read_pfile -! -! !INTERFACE: - subroutine restFile_read_pfile( pnamer ) -! -! !DESCRIPTION: -! Setup restart file and perform necessary consistency checks -! -! !USES: - use fileutils , only : opnfil, getavu, relavu - use clm_varctl, only : rpntfil, rpntdir, inst_suffix -! -! !ARGUMENTS: - implicit none - character(len=*), intent(out) :: pnamer ! full path of restart file -! -! !CALLED FROM: -! subroutine restart in this module -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i ! indices - integer :: nio ! restart unit - integer :: status ! substring check status - character(len=256) :: locfn ! Restart pointer file name -!----------------------------------------------------------------------- - - ! Obtain the restart file from the restart pointer file. - ! For restart runs, the restart pointer file contains the full pathname - ! of the restart file. For branch runs, the namelist variable - ! [nrevsn] contains the full pathname of the restart file. - ! New history files are always created for branch runs. - - if (masterproc) then - write(iulog,*) 'Reading restart pointer file....' - endif - - nio = getavu() - locfn = trim(rpntdir) //'/'// trim(rpntfil)//trim(inst_suffix) - call opnfil (locfn, nio, 'f') - read (nio,'(a256)') pnamer - call relavu (nio) - - if (masterproc) then - write(iulog,*) 'Reading restart data.....' - write(iulog,'(72a1)') ("-",i=1,60) - end if - - end subroutine restFile_read_pfile - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_closeRestart -! -! !INTERFACE: - subroutine restFile_closeRestart( file, nlend ) -! -! !DESCRIPTION: -! Close restart file and write restart pointer file if -! in write mode, otherwise just close restart file if in read mode -! -! !USES: - use clm_time_manager, only : is_last_step -! -! !ARGUMENTS: - implicit none - character(len=*) , intent(in) :: file ! local output filename - logical, intent(in) :: nlend -! -! !CALLED FROM: -! subroutine restart in this module -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i !index -!----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Successfully wrote local restart file ',trim(file) - write(iulog,'(72a1)') ("-",i=1,60) - write(iulog,*) - end if - - end subroutine restFile_closeRestart - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_write_pfile -! -! !INTERFACE: - subroutine restFile_write_pfile( fnamer ) -! -! !DESCRIPTION: -! Open restart pointer file. Write names of current netcdf restart file. -! -! !USES: - use clm_varctl, only : rpntdir, rpntfil, inst_suffix - use fileutils , only : relavu - use fileutils , only : getavu, opnfil -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fnamer -! -! !CALLED FROM: -! subroutine restart in this module -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m ! index - integer :: nio ! restart pointer file - character(len=256) :: filename ! local file name -!----------------------------------------------------------------------- - - if (masterproc) then - nio = getavu() - filename= trim(rpntdir) //'/'// trim(rpntfil)//trim(inst_suffix) - call opnfil( filename, nio, 'f' ) - - write(nio,'(a)') fnamer - call relavu( nio ) - write(iulog,*)'Successfully wrote local restart pointer file' - end if - - end subroutine restFile_write_pfile - -!----------------------------------------------------------------------- - subroutine restFile_open( flag, file, ncid ) - - use clm_time_manager, only : get_nstep - - implicit none - character(len=*), intent(in) :: flag ! flag to specify read or write - character(len=*), intent(in) :: file ! filename - type(file_desc_t), intent(out):: ncid ! netcdf id - - integer :: omode ! netCDF dummy variable - character(len= 32) :: subname='restFile_open' ! subroutine name - - if (flag == 'write') then - - ! Create new netCDF file (in define mode) and set fill mode - ! to "no fill" to optimize performance - - if (masterproc) then - write(iulog,*) - write(iulog,*)'restFile_open: writing restart dataset at ',& - trim(file), ' at nstep = ',get_nstep() - write(iulog,*) - end if - call ncd_pio_createfile(ncid, trim(file)) - - else if (flag == 'read') then - - ! Open netcdf restart file - - if (masterproc) then - write(iulog,*) 'Reading restart dataset' - end if - call ncd_pio_openfile (ncid, trim(file), 0) - - end if - - end subroutine restFile_open - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_filename -! -! !INTERFACE: - character(len=256) function restFile_filename( rdate ) -! -! !DESCRIPTION: -! -! !USES: - use clm_varctl, only : caseid, inst_suffix -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: rdate ! input date for restart file name -! -! !CALLED FROM: -! subroutine restart in this module -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - - restFile_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& - ".r."//trim(rdate)//".nc" - if (masterproc) then - write(iulog,*)'writing restart file ',trim(restFile_filename),' for model date = ',rdate - end if - - end function restFile_filename - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: restFile_dimset -! -! !INTERFACE: - subroutine restFile_dimset( ncid ) -! -! !DESCRIPTION: -! Read/Write initial data from/to netCDF instantaneous initial data file -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use clm_time_manager, only : get_nstep, get_curr_date - use spmdMod , only : mpicom, MPI_LOGICAL - use clm_varctl , only : caseid, ctitle, version, username, hostname, fsurdat, & - conventions, source - use clm_varpar , only : numrad, nlevlak, nlevsno, nlevgrnd - use decompMod , only : get_proc_bounds, get_proc_global -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid -! -! !REVISION HISTORY: -! -! -! !LOCAL VARIABLES: -!EOP - integer :: yr ! current year (0 -> ...) - integer :: mon ! current month (1 -> 12) - integer :: day ! current day (1 -> 31) - integer :: mcsec ! seconds of current date - integer :: mcdate ! current date - integer :: dimid ! netCDF dimension id - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - integer :: ier ! error status - integer :: strlen_dimid ! string dimension id - character(len= 8) :: curdate ! current date - character(len= 8) :: curtime ! current time - character(len=256) :: str - character(len= 32) :: subname='restFile_dimset' ! subroutine name -!------------------------------------------------------------------------ - - call get_proc_global(numg, numl, numc, nump) - - ! Define dimensions - - call ncd_defdim(ncid, 'gridcell', numg , dimid) - call ncd_defdim(ncid, 'landunit', numl , dimid) - call ncd_defdim(ncid, 'column' , numc , dimid) - call ncd_defdim(ncid, 'pft' , nump , dimid) - - call ncd_defdim(ncid, 'levgrnd' , nlevgrnd , dimid) - call ncd_defdim(ncid, 'levlak' , nlevlak , dimid) - call ncd_defdim(ncid, 'levsno' , nlevsno , dimid) - call ncd_defdim(ncid, 'levsno1' , nlevsno+1 , dimid) - call ncd_defdim(ncid, 'levtot' , nlevsno+nlevgrnd, dimid) - call ncd_defdim(ncid, 'numrad' , numrad , dimid) - call ncd_defdim(ncid, 'string_length', 64 , dimid) - - ! Define global attributes - - call ncd_putatt(ncid, NCD_GLOBAL, 'Conventions', trim(conventions)) - call getdatetime(curdate, curtime) - str = 'created on ' // curdate // ' ' // curtime - call ncd_putatt(ncid, NCD_GLOBAL, 'history' , trim(str)) - call ncd_putatt(ncid, NCD_GLOBAL, 'username', trim(username)) - call ncd_putatt(ncid, NCD_GLOBAL, 'host' , trim(hostname)) - call ncd_putatt(ncid, NCD_GLOBAL, 'version' , trim(version)) - call ncd_putatt(ncid, NCD_GLOBAL, 'source' , trim(source)) - str = '$Id$' - call ncd_putatt(ncid, NCD_GLOBAL, 'revision_id' , trim(str)) - call ncd_putatt(ncid, NCD_GLOBAL, 'case_title' , trim(ctitle)) - call ncd_putatt(ncid, NCD_GLOBAL, 'case_id' , trim(caseid)) - call ncd_putatt(ncid, NCD_GLOBAL, 'surface_dataset', trim(fsurdat)) - call ncd_putatt(ncid, NCD_GLOBAL, 'title', & - 'CLM Restart information, required to continue a simulation' ) - - - end subroutine restFile_dimset - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_dimcheck -! -! !INTERFACE: - subroutine restFile_dimcheck( ncid ) -! -! !DESCRIPTION: -! Check dimensions of restart file -! -! !USES: - use decompMod, only : get_proc_bounds, get_proc_global - use clm_varpar, only : nlevsno, nlevlak, nlevgrnd - use clm_varctl, only : single_column, nsrest, nsrStartup - implicit none -! -! !ARGUMENTS: - type(file_desc_t), intent(inout) :: ncid -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: numg ! total number of gridcells across all processors - integer :: numl ! total number of landunits across all processors - integer :: numc ! total number of columns across all processors - integer :: nump ! total number of pfts across all processors - character(len=32) :: subname='restFile_dimcheck' ! subroutine name -!----------------------------------------------------------------------- - - ! Get relevant sizes - - if ( .not. single_column .or. nsrest /= nsrStartup )then - call get_proc_global(numg, numl, numc, nump) - call check_dim(ncid, 'gridcell', numg) - call check_dim(ncid, 'landunit', numl) - call check_dim(ncid, 'column' , numc) - call check_dim(ncid, 'pft' , nump) - end if - call check_dim(ncid, 'levsno' , nlevsno) - call check_dim(ncid, 'levgrnd' , nlevgrnd) - call check_dim(ncid, 'levlak' , nlevlak) - - end subroutine restFile_dimcheck - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_enddef -! -! !INTERFACE: - subroutine restFile_enddef( ncid ) -! -! !DESCRIPTION: -! Read a CLM restart file. -! -! !USES: -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP -!----------------------------------------------------------------------- - - call ncd_enddef(ncid) - - end subroutine restFile_enddef - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: restFile_close -! -! !INTERFACE: - subroutine restFile_close( ncid ) -! -! !DESCRIPTION: -! Read a CLM restart file. -! -! !USES: -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - character(len=32) :: subname='restFile_close' ! subroutine name -!----------------------------------------------------------------------- - - call ncd_pio_closefile(ncid) - - end subroutine restFile_close - -end module restFileMod - - - diff --git a/src_clm40/main/restUtilMod.F90 b/src_clm40/main/restUtilMod.F90 deleted file mode 100644 index 2e2533e881..0000000000 --- a/src_clm40/main/restUtilMod.F90 +++ /dev/null @@ -1,1319 +0,0 @@ -#include "dtypes.h" -!=================================================== -! DO NOT EDIT THIS FILE, it was generated using ../../../../../tools/cprnc/genf90/genf90.pl -! Any changes you make to this file may be lost -!=================================================== -module restUtilMod - - !----------------------------------------------------------------------- - ! provies generic routines and types for use with restart files - ! - use shr_kind_mod, only: r8=>shr_kind_r8, r4 => shr_kind_r4, i4=>shr_kind_i4 - use shr_sys_mod, only: shr_sys_abort - use spmdMod, only: masterproc - use clm_varctl, only: iulog - use clm_varcon, only: spval, ispval - use ncdio_pio - use pio - ! - implicit none - save - private - ! save - ! - !----------------------------------------------------------------------- - -# 21 "restUtilMod.F90.in" - interface restartvar - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_0d_text - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_1d_text - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_2d_text - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_0d_int - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_1d_int - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_2d_int - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_0d_double - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_1d_double - !TYPE text,int,double - !DIMS 0,1,2 - module procedure restartvar_2d_double - module procedure restartvar_2d_double_bounds - end interface restartvar - - integer,parameter, public :: iflag_interp = 1 - integer,parameter, public :: iflag_copy = 2 - integer,parameter, public :: iflag_skip = 3 - integer,parameter, public :: iflag_noswitchdim = 0 - integer,parameter, public :: iflag_switchdim = 1 - - public :: restartvar - - private :: is_restart - -# 38 "restUtilMod.F90.in" -contains - - !----------------------------------------------------------------------- - !DIMS 0 - !TYPE text,int,double -# 43 "restUtilMod.F90.in" - subroutine restartvar_0d_text(& - ncid, flag, varname, xtype, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - character(len=*) , intent(inout) :: data - logical , intent(out) :: readvar ! was var read? - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (100!=TYPETEXT) - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 145 "restUtilMod.F90.in" - end subroutine restartvar_0d_text - !DIMS 0 - !TYPE text,int,double -# 43 "restUtilMod.F90.in" - subroutine restartvar_0d_int(& - ncid, flag, varname, xtype, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - integer(i4) , intent(inout) :: data - logical , intent(out) :: readvar ! was var read? - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (103!=TYPETEXT) - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 145 "restUtilMod.F90.in" - end subroutine restartvar_0d_int - !DIMS 0 - !TYPE text,int,double -# 43 "restUtilMod.F90.in" - subroutine restartvar_0d_double(& - ncid, flag, varname, xtype, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - real(r8) , intent(inout) :: data - logical , intent(out) :: readvar ! was var read? - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (102!=TYPETEXT) - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 145 "restUtilMod.F90.in" - end subroutine restartvar_0d_double - - !----------------------------------------------------------------------- - !DIMS 1,2 - !TYPE text,int,double -# 150 "restUtilMod.F90.in" - subroutine restartvar_1d_text(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - character(len=*) , pointer :: data(:) - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (100!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 273 "restUtilMod.F90.in" - end subroutine restartvar_1d_text - !DIMS 1,2 - !TYPE text,int,double -# 150 "restUtilMod.F90.in" - subroutine restartvar_2d_text(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - character(len=*) , pointer :: data(:,:) - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (100!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 273 "restUtilMod.F90.in" - end subroutine restartvar_2d_text - !DIMS 1,2 - !TYPE text,int,double -# 150 "restUtilMod.F90.in" - subroutine restartvar_1d_int(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - integer(i4) , pointer :: data(:) - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (103!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 273 "restUtilMod.F90.in" - end subroutine restartvar_1d_int - !DIMS 1,2 - !TYPE text,int,double -# 150 "restUtilMod.F90.in" - subroutine restartvar_2d_int(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - integer(i4) , pointer :: data(:,:) - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (103!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 273 "restUtilMod.F90.in" - end subroutine restartvar_2d_int - !DIMS 1,2 - !TYPE text,int,double -# 150 "restUtilMod.F90.in" - subroutine restartvar_1d_double(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - real(r8) , pointer :: data(:) - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (102!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 273 "restUtilMod.F90.in" - end subroutine restartvar_1d_double - !DIMS 1,2 - !TYPE text,int,double -# 150 "restUtilMod.F90.in" - subroutine restartvar_2d_double(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - real(r8) , pointer :: data(:,:) - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if (102!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 273 "restUtilMod.F90.in" - end subroutine restartvar_2d_double - - !----------------------------------------------------------------------- - -# 277 "restUtilMod.F90.in" - subroutine restartvar_2d_double_bounds(ncid, flag, varname, xtype, & - dim1name, dim2name, switchdim, lowerb2, upperb2, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: dim1name ! dimension name - character(len=*) , intent(in) :: dim2name ! dimension name - logical , intent(in) :: switchdim - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - real(r8) , pointer :: data(:,:) ! raw data - logical , intent(out) :: readvar ! was var read? - integer , intent(in), optional :: lowerb2 - integer , intent(in), optional :: upperb2 - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid ! returned var id - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (switchdim) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim2name), dim2name=trim(dim1name), & - long_name=trim(long_name), units=units) - else - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - status = PIO_inq_varid(ncid, trim(varname), vardesc) - - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=>nearest_neighbor 2=>copy 3=>skip") - - if (switchdim) then - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 1) - else - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 0) - end if - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_values', (/0,1/)) - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_0', & - "1st and 2nd dims are same as model representation") - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_1', & - "1st and 2nd dims are switched from model representation") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else - - if (present(lowerb2) .and. present(upperb2)) then - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), switchdim=switchdim, & - lowerb2=lowerb2, upperb2=upperb2, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), switchdim=switchdim, & - ncid=ncid, flag=flag, readvar=readvar) - end if - - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - -# 412 "restUtilMod.F90.in" - end subroutine restartvar_2d_double_bounds - - - !----------------------------------------------------------------------- -# 416 "restUtilMod.F90.in" - logical function is_restart( ) - ! Determine if restart run - use clm_varctl, only : nsrest, nsrContinue - if (nsrest == nsrContinue) then - is_restart = .true. - else - is_restart = .false. - end if -# 424 "restUtilMod.F90.in" - end function is_restart - -end module restUtilMod diff --git a/src_clm40/main/restUtilMod.F90.in b/src_clm40/main/restUtilMod.F90.in deleted file mode 100644 index 07a6c82cd6..0000000000 --- a/src_clm40/main/restUtilMod.F90.in +++ /dev/null @@ -1,426 +0,0 @@ -module restUtilMod - - !----------------------------------------------------------------------- - ! provies generic routines and types for use with restart files - ! - use shr_kind_mod, only: r8=>shr_kind_r8, r4 => shr_kind_r4, i4=>shr_kind_i4 - use shr_sys_mod, only: shr_sys_abort - use spmdMod, only: masterproc - use clm_varctl, only: iulog - use clm_varcon, only: spval, ispval - use ncdio_pio - use pio - ! - implicit none - save - private - ! save - ! - !----------------------------------------------------------------------- - - interface restartvar - !DIMS 0,1,2 - !TYPE text,int,double - module procedure restartvar_{DIMS}d_{TYPE} - module procedure restartvar_2d_double_bounds - end interface restartvar - - integer,parameter, public :: iflag_interp = 1 - integer,parameter, public :: iflag_copy = 2 - integer,parameter, public :: iflag_skip = 3 - integer,parameter, public :: iflag_noswitchdim = 0 - integer,parameter, public :: iflag_switchdim = 1 - - public :: restartvar - - private :: is_restart - -contains - - !----------------------------------------------------------------------- - !DIMS 0 - !TYPE text,int,double - subroutine restartvar_{DIMS}d_{TYPE}(& - ncid, flag, varname, xtype, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - {VTYPE} , intent(inout) :: data{DIMSTR} - logical , intent(out) :: readvar ! was var read? - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if ({ITYPE}!=TYPETEXT) - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - - end subroutine restartvar_{DIMS}d_{TYPE} - - !----------------------------------------------------------------------- - !DIMS 1,2 - !TYPE text,int,double - subroutine restartvar_{DIMS}d_{TYPE}(& - ncid, flag, varname, xtype, dim1name, dim2name, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t) , intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - {VTYPE} , pointer :: data{DIMSTR} - logical , intent(inout) :: readvar ! was var read? - character(len=*) , intent(in), optional :: dim1name ! dimension name - character(len=*) , intent(in), optional :: dim2name ! dimension name - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (.not. present(dim1name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - long_name=trim(long_name), units=units) - else if (.not. present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), & - long_name=trim(long_name), units=units) - else if (present(dim2name)) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - - status = PIO_inq_varid(ncid, trim(varname), vardesc) - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=nearest neighbor, 2=copy directly, 3=skip") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else if (flag == 'read' .or. flag == 'write') then - -#if ({ITYPE}!=TYPETEXT) - if (.not. present(dim1name)) then - call ncd_io(varname=trim(varname), data=data, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), ncid=ncid, flag=flag, readvar=readvar) - end if -#endif - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - - end subroutine restartvar_{DIMS}d_{TYPE} - - !----------------------------------------------------------------------- - - subroutine restartvar_2d_double_bounds(ncid, flag, varname, xtype, & - dim1name, dim2name, switchdim, lowerb2, upperb2, & - long_name, units, interpinic_flag, data, readvar, & - comment, flag_meanings, missing_value, fill_value, & - imissing_value, ifill_value, flag_values, nvalid_range ) - - !---------------------------------------------------- - ! Arguments - type(file_desc_t), intent(inout) :: ncid ! netcdf file id - character(len=*) , intent(in) :: flag ! 'read' or 'write' - character(len=*) , intent(in) :: varname ! variable name - integer , intent(in) :: xtype ! netcdf data type - character(len=*) , intent(in) :: dim1name ! dimension name - character(len=*) , intent(in) :: dim2name ! dimension name - logical , intent(in) :: switchdim - character(len=*) , intent(in) :: long_name ! long name for variable - character(len=*) , intent(in) :: interpinic_flag ! interpolate variable using interpinic - real(r8) , pointer :: data(:,:) ! raw data - logical , intent(out) :: readvar ! was var read? - integer , intent(in), optional :: lowerb2 - integer , intent(in), optional :: upperb2 - character(len=*) , intent(in), optional :: units ! long name for variable - character(len=*) , intent(in), optional :: comment ! attribute - character(len=*) , intent(in), optional :: flag_meanings(:) ! attribute - real(r8) , intent(in), optional :: missing_value ! attribute for real - real(r8) , intent(in), optional :: fill_value ! attribute for real - integer , intent(in), optional :: imissing_value ! attribute for int - integer , intent(in), optional :: ifill_value ! attribute for int - integer , intent(in), optional :: flag_values(:) ! attribute for int - integer , intent(in), optional :: nvalid_range(2) ! attribute for int - ! - ! Local variables - integer :: ivalue - type(var_desc_t) :: vardesc ! local vardesc - integer :: status ! return error code - integer :: varid ! returned var id - integer :: lxtype ! local external type (in case logical variable) - !---------------------------------------------------- - - if (flag == 'define') then - - if ( xtype == ncd_log )then - lxtype = ncd_int - else - lxtype = xtype - end if - - if (switchdim) then - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim2name), dim2name=trim(dim1name), & - long_name=trim(long_name), units=units) - else - call ncd_defvar(ncid=ncid, varname=trim(varname), xtype=lxtype, & - dim1name=trim(dim1name), dim2name=trim(dim2name), & - long_name=trim(long_name), units=units) - end if - status = PIO_inq_varid(ncid, trim(varname), vardesc) - - varid = vardesc%varid - - if (trim(interpinic_flag) == 'interp') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_interp) - else if (trim(interpinic_flag) == 'copy') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_copy) - else if (trim(interpinic_flag) == 'skip') then - status = PIO_put_att(ncid, varid, 'interpinic_flag', iflag_skip) - end if - status = PIO_put_att(ncid, varid, 'interpinic_flag_meanings', & - "1=>nearest_neighbor 2=>copy 3=>skip") - - if (switchdim) then - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 1) - else - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag', 0) - end if - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_values', (/0,1/)) - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_0', & - "1st and 2nd dims are same as model representation") - status = PIO_put_att(ncid, vardesc%varid, 'switchdim_flag_is_1', & - "1st and 2nd dims are switched from model representation") - - if (present(comment)) then - call ncd_putatt(ncid, varid, 'comment', trim(comment)) - end if - if (present(units)) then - call ncd_putatt(ncid, varid, 'units', trim(units)) - end if - if (present(fill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', fill_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, '_FillValue', spval, lxtype) - end if - if (present(missing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', missing_value, lxtype) - else if (lxtype == ncd_double) then - call ncd_putatt(ncid, varid, 'missing_value', spval, lxtype) - end if - if (present(ifill_value)) then - call ncd_putatt(ncid, varid, '_FillValue', ifill_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, '_FillValue', ispval, lxtype) - end if - if (present(imissing_value)) then - call ncd_putatt(ncid, varid, 'missing_value', imissing_value, lxtype) - else if (lxtype == ncd_int) then - call ncd_putatt(ncid, varid, 'missing_value', ispval, lxtype) - end if - if (present(nvalid_range)) then - status = PIO_put_att(ncid,varid,'valid_range', nvalid_range ) - end if - if ( xtype == ncd_log )then - status = PIO_put_att(ncid,varid,'flag_values', (/0, 1/) ) - status = PIO_put_att(ncid,varid,'flag_meanings', "FALSE TRUE" ) - status = PIO_put_att(ncid,varid,'valid_range', (/0, 1/) ) - end if - - else - - if (present(lowerb2) .and. present(upperb2)) then - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), switchdim=switchdim, & - lowerb2=lowerb2, upperb2=upperb2, & - ncid=ncid, flag=flag, readvar=readvar) - else - call ncd_io(varname=trim(varname), data=data, & - dim1name=trim(dim1name), switchdim=switchdim, & - ncid=ncid, flag=flag, readvar=readvar) - end if - - end if - - if (flag == 'read') then - if (.not. readvar .and. is_restart()) call shr_sys_abort() - end if - - end subroutine restartvar_2d_double_bounds - - - !----------------------------------------------------------------------- - logical function is_restart( ) - ! Determine if restart run - use clm_varctl, only : nsrest, nsrContinue - if (nsrest == nsrContinue) then - is_restart = .true. - else - is_restart = .false. - end if - end function is_restart - -end module restUtilMod diff --git a/src_clm40/main/spmdGathScatMod.F90 b/src_clm40/main/spmdGathScatMod.F90 deleted file mode 100644 index 3aab333d63..0000000000 --- a/src_clm40/main/spmdGathScatMod.F90 +++ /dev/null @@ -1,537 +0,0 @@ -module spmdGathScatMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: spmdGathScatMod -! -! !DESCRIPTION: -! Perform SPMD gather and scatter operations. -! -! !USES: - use clm_varcon, only: spval, ispval - use decompMod, only : get_clmlevel_gsmap - use shr_kind_mod, only: r8 => shr_kind_r8 - use spmdMod - use mct_mod - use abortutils, only : endrun - use clm_varctl, only : iulog - use perf_mod -! -! !PUBLIC TYPES: - implicit none - private -! -! !PUBLIC MEMBER FUNCTIONS: - public scatter_data_from_master, gather_data_to_master - - interface scatter_data_from_master - module procedure scatter_1darray_int - module procedure scatter_1darray_real - end interface - - interface gather_data_to_master - module procedure gather_1darray_int - module procedure gather_1darray_real - end interface -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -!EOP -! - integer,private,parameter :: debug = 0 - -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: scatter_1darray_int -! -! !INTERFACE: - subroutine scatter_1darray_int (alocal, aglobal, clmlevel) -! -! !DESCRIPTION: -! Wrapper routine to scatter int 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer , pointer :: alocal(:) ! local data (output) - integer , pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - integer ,pointer :: adata(:) ! local data array - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'scatter_1darray_int' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(istring) == 0) then - istring = trim(fname) - else - istring = trim(istring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - if (debug > 1) call t_startf(trim(subname)//'_pack') - - if (masterproc) then - lsize = size(aglobal,dim=1) - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - allocate(adata(lsize)) - do n2 = lb2,ub2 - adata(1:lsize) = aglobal(1:lsize) - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importIattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_scat') - - call mct_aVect_scatter(AVi, AVo, gsmap, 0, mpicom) - - if (debug > 1) call t_stopf(trim(subname)//'_scat') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - lsize = size(alocal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportIattr(AVo,trim(fname),adata,lsize) - do n1 = lb1,ub1 - alocal(n1) = adata(n1-lb1+1) - enddo - enddo - deallocate(adata) - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVi) - endif - call mct_aVect_clean(AVo) - - call t_stopf(trim(subname)//'_total') - - end subroutine scatter_1darray_int - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: gather_1darray_int -! -! !INTERFACE: - subroutine gather_1darray_int (alocal, aglobal, clmlevel, missing) -! -! !DESCRIPTION: -! Wrapper routine to gather int 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - integer , pointer :: alocal(:) ! local data (output) - integer , pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid - integer ,optional,intent(in) :: missing ! missing value -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - integer ,pointer :: adata(:) ! temporary data array - integer ,pointer :: mvect(:) ! local array for mask - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'gather_1darray_int' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lsize = size(alocal,dim=1) - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - if (present(missing)) then - istring = "mask" - endif - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(istring) == 0) then - istring = trim(fname) - else - istring = trim(istring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - - if (debug > 1) call t_startf(trim(subname)//'_pack') - allocate(adata(lsize)) - do n2 = lb2,ub2 - do n1 = lb1,ub1 - adata(n1-lb1+1) = alocal(n1) - enddo - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importIattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - - if (present(missing)) then - allocate(mvect(lsize)) - do n1 = lb1,ub1 - mvect(n1-lb1+1) = 1 - enddo - call mct_aVect_importIattr(AVi,"mask",mvect,lsize) - deallocate(mvect) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_gath') - - if (present(missing)) then -! tcx wait for update in mct, then get rid of "mask" -! call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom, missing = missing) - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - else - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_gath') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - if (masterproc) then - lsize = size(aglobal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportIattr(AVo,trim(fname),adata,lsize) - aglobal(1:lsize) = adata(1:lsize) - enddo - deallocate(adata) - if (present(missing)) then - allocate(mvect(lsize)) - call mct_aVect_exportIattr(AVo,"mask",mvect,lsize) - do n1 = 1,lsize - if (mvect(n1) == 0) then - do n2 = lb2,ub2 - aglobal(n1) = missing - enddo - endif - enddo - deallocate(mvect) - endif - endif - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVo) - endif - - call mct_aVect_clean(AVi) - - call t_stopf(trim(subname)//'_total') - - end subroutine gather_1darray_int - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: scatter_1darray_real -! -! !INTERFACE: - subroutine scatter_1darray_real (alocal, aglobal, clmlevel) -! -! !DESCRIPTION: -! Wrapper routine to scatter real 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: alocal(:) ! local data (output) - real(r8), pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - real(r8),pointer :: adata(:) ! local data array - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'scatter_1darray_real' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(rstring) == 0) then - rstring = trim(fname) - else - rstring = trim(rstring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - if (debug > 1) call t_startf(trim(subname)//'_pack') - - if (masterproc) then - lsize = size(aglobal,dim=1) - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - allocate(adata(lsize)) - do n2 = lb2,ub2 - adata(1:lsize) = aglobal(1:lsize) - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importRattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_scat') - - call mct_aVect_scatter(AVi, AVo, gsmap, 0, mpicom) - - if (debug > 1) call t_stopf(trim(subname)//'_scat') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - lsize = size(alocal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportRattr(AVo,trim(fname),adata,lsize) - do n1 = lb1,ub1 - alocal(n1) = adata(n1-lb1+1) - enddo - enddo - deallocate(adata) - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVi) - endif - call mct_aVect_clean(AVo) - - call t_stopf(trim(subname)//'_total') - - end subroutine scatter_1darray_real - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: gather_1darray_real -! -! !INTERFACE: - subroutine gather_1darray_real (alocal, aglobal, clmlevel, missing) -! -! !DESCRIPTION: -! Wrapper routine to gather real 1d array -! -! !USES: -! -! !ARGUMENTS: - implicit none - real(r8), pointer :: alocal(:) ! local data (output) - real(r8), pointer :: aglobal(:) ! global data (input) - character(len=*) ,intent(in) :: clmlevel ! type of input grid - real(r8),optional,intent(in) :: missing ! missing value -! -! !REVISION HISTORY: -! Author: T Craig -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n1,n2,lb1,ub1,lb2,ub2 ! indices - integer :: lsize ! size of local array - type(mct_aVect) :: AVi, AVo ! attribute vectors - real(r8),pointer :: adata(:) ! temporary data array - integer ,pointer :: mvect(:) ! local array for mask - character(len=256) :: rstring ! real field list string - character(len=256) :: istring ! int field list string - character(len=8) :: fname ! arbitrary field name - type(mct_gsMap),pointer :: gsmap ! global seg map - character(len=*),parameter :: subname = 'gather_1darray_real' - -!----------------------------------------------------------------------- - - call t_startf(trim(subname)//'_total') - call get_clmlevel_gsmap(clmlevel,gsmap) - - lsize = size(alocal,dim=1) - lb1 = lbound(alocal,dim=1) - ub1 = ubound(alocal,dim=1) - lb2 = 1 - ub2 = 1 - - rstring = "" - istring = "" - - if (present(missing)) then - istring = "mask" - endif - - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - if (len_trim(rstring) == 0) then - rstring = trim(fname) - else - rstring = trim(rstring)//":"//trim(fname) - endif - enddo - - if (masterproc .and. debug > 2) then - write(iulog,*) trim(subname),' strings:',trim(rstring),' ',trim(istring) - endif - - call mct_aVect_init(AVi,rList=trim(rstring),iList=trim(istring),lsize=lsize) - - if (debug > 1) call t_startf(trim(subname)//'_pack') - allocate(adata(lsize)) - do n2 = lb2,ub2 - do n1 = lb1,ub1 - adata(n1-lb1+1) = alocal(n1) - enddo - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_importRattr(AVi,trim(fname),adata,lsize) - enddo - deallocate(adata) - - if (present(missing)) then - allocate(mvect(lsize)) - do n1 = lb1,ub1 - mvect(n1-lb1+1) = 1 - enddo - call mct_aVect_importIattr(AVi,"mask",mvect,lsize) - deallocate(mvect) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_pack') - if (debug > 1) call t_startf(trim(subname)//'_gath') - - if (present(missing)) then -! tcx wait for update in mct, then get rid of "mask" -! call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom, missing = missing) - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - else - call mct_aVect_gather(AVi, AVo, gsmap, 0, mpicom) - endif - - if (debug > 1) call t_stopf(trim(subname)//'_gath') - if (debug > 1) call t_startf(trim(subname)//'_upck') - - if (masterproc) then - lsize = size(aglobal,dim=1) - allocate(adata(lsize)) - do n2 = lb2,ub2 - write(fname,'(a1,i3.3)') 'f',n2-lb2+1 - call mct_aVect_exportRattr(AVo,trim(fname),adata,lsize) - aglobal(1:lsize) = adata(1:lsize) - enddo - deallocate(adata) - if (present(missing)) then - allocate(mvect(lsize)) - call mct_aVect_exportIattr(AVo,"mask",mvect,lsize) - do n1 = 1,lsize - if (mvect(n1) == 0) then - do n2 = lb2,ub2 - aglobal(n1) = missing - enddo - endif - enddo - deallocate(mvect) - endif - endif - - if (debug > 1) call t_stopf(trim(subname)//'_upck') - - if (masterproc) then - call mct_aVect_clean(AVo) - endif - - call mct_aVect_clean(AVi) - - call t_stopf(trim(subname)//'_total') - - end subroutine gather_1darray_real - -end module spmdGathScatMod diff --git a/src_clm40/main/spmdMod.F90 b/src_clm40/main/spmdMod.F90 deleted file mode 100644 index 6983b96281..0000000000 --- a/src_clm40/main/spmdMod.F90 +++ /dev/null @@ -1,142 +0,0 @@ - -module spmdMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: spmdMod -! -! !DESCRIPTION: -! SPMD initialization -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -!EOP -!----------------------------------------------------------------------- - - use shr_kind_mod, only: r8 => shr_kind_r8 - use clm_varctl , only: iulog - implicit none - - private - -#include - - save - - ! Default settings valid even if there is no spmd - - logical, public :: masterproc ! proc 0 logical for printing msgs - integer, public :: iam ! processor number - integer, public :: npes ! number of processors for clm - integer, public :: mpicom ! communicator group for clm - integer, public :: comp_id ! component id - - ! - ! Public methods - ! - public :: spmd_init ! Initialization - - ! - ! Values from mpif.h that can be used - ! - public :: MPI_INTEGER - public :: MPI_REAL8 - public :: MPI_LOGICAL - public :: MPI_SUM - public :: MPI_MIN - public :: MPI_MAX - public :: MPI_LOR - public :: MPI_STATUS_SIZE - public :: MPI_ANY_SOURCE - public :: MPI_CHARACTER - public :: MPI_COMM_WORLD - public :: MPI_MAX_PROCESSOR_NAME - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: spmd_init( clm_mpicom ) -! -! !INTERFACE: - subroutine spmd_init( clm_mpicom, LNDID ) -! -! !DESCRIPTION: -! MPI initialization (number of cpus, processes, tids, etc) -! -! !USES -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: clm_mpicom - integer, intent(in) :: LNDID -! -! !REVISION HISTORY: -! Author: Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i,j ! indices - integer :: ier ! return error status - integer :: mylength ! my processor length - logical :: mpi_running ! temporary - integer, allocatable :: length(:) - integer, allocatable :: displ(:) - character*(MPI_MAX_PROCESSOR_NAME), allocatable :: procname(:) - character*(MPI_MAX_PROCESSOR_NAME) :: myprocname -!----------------------------------------------------------------------- - - ! Initialize mpi communicator group - - mpicom = clm_mpicom - - comp_id = LNDID - - ! Get my processor id - - call mpi_comm_rank(mpicom, iam, ier) - if (iam==0) then - masterproc = .true. - else - masterproc = .false. - end if - - ! Get number of processors - - call mpi_comm_size(mpicom, npes, ier) - - ! Get my processor names - - allocate (length(0:npes-1), displ(0:npes-1), procname(0:npes-1)) - - call mpi_get_processor_name (myprocname, mylength, ier) - call mpi_allgather(mylength,1,MPI_INTEGER,length,1,MPI_INTEGER,mpicom,ier) - - do i = 0,npes-1 - displ(i)=i*MPI_MAX_PROCESSOR_NAME - end do - call mpi_gatherv (myprocname,mylength,MPI_CHARACTER, & - procname,length,displ,MPI_CHARACTER,0,mpicom,ier) - if (masterproc) then - write(iulog,100)npes - write(iulog,200) - write(iulog,220) - do i=0,npes-1 - write(iulog,250)i,(procname((i))(j:j),j=1,length(i)) - end do - endif - - deallocate (length, displ, procname) - -100 format(//,i3," pes participating in computation for CLM") -200 format(/,35('-')) -220 format(/,"NODE#",2x,"NAME") -250 format("(",i5,")",2x,100a1,//) - - end subroutine spmd_init - -end module spmdMod diff --git a/src_clm40/main/subgridAveMod.F90 b/src_clm40/main/subgridAveMod.F90 deleted file mode 100644 index 426beb1a60..0000000000 --- a/src_clm40/main/subgridAveMod.F90 +++ /dev/null @@ -1,1695 +0,0 @@ -module subgridAveMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: subgridAveMod -! -! !DESCRIPTION: -! Utilities to perfrom subgrid averaging -! -! !USES: - use shr_kind_mod, only: r8 => shr_kind_r8 - use clmtype - use clm_varcon, only : spval, isturb, icol_roof, icol_sunwall, icol_shadewall, & - icol_road_perv, icol_road_imperv - use clm_varctl, only : iulog - use abortutils, only : endrun - -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: p2c ! Perfrom an average from pfts to columns - public :: p2l ! Perfrom an average from pfts to landunits - public :: p2g ! Perfrom an average from pfts to gridcells - public :: c2l ! Perfrom an average from columns to landunits - public :: c2g ! Perfrom an average from columns to gridcells - public :: l2g ! Perfrom an average from landunits to gridcells - - interface p2c - module procedure p2c_1d - module procedure p2c_2d - module procedure p2c_1d_filter - module procedure p2c_2d_filter - end interface - interface p2l - module procedure p2l_1d - module procedure p2l_2d - end interface - interface p2g - module procedure p2g_1d - module procedure p2g_2d - end interface - interface c2l - module procedure c2l_1d - module procedure c2l_2d - end interface - interface c2g - module procedure c2g_1d - module procedure c2g_2d - end interface - interface l2g - module procedure l2g_1d - module procedure l2g_2d - end interface -! -! !PRIVATE MEMBER FUNCTIONS: - private :: build_scale_l2g - private :: create_scale_l2g_lookup -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -!EOP - -! WJS (10-14-11): TODO: -! -! - I believe that scale_p2c, scale_c2l and scale_l2g should be included in the sumwt -! accumulations (e.g., sumwt = sumwt + wtgcell * scale_p2c * scale_c2l * scale_l2g), but -! that requires some more thought to (1) make sure that is correct, and (2) make sure it -! doesn't break the urban scaling. (See also my notes in create_scale_l2g_lookup.) -! - Once that is done, you could use a scale of 0, avoiding the need for the use of -! spval and the special checks that requires. -! -! - Currently, there is a lot of repeated code to calculate scale_c2l. This should be -! cleaned up. -! - At a minimum, should collect the repeated code into a subroutine to eliminate this -! repitition -! - The best thing might be to use a lookup array, as is done for scale_l2g -! ----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2c_1d -! -! !INTERFACE: - subroutine p2c_1d (lbp, ubp, lbc, ubc, parr, carr, p2c_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from pfts to columns. -! Averaging is only done for points that are not equal to "spval". -! -! !USES: - use clm_varpar, only : max_pft_per_col -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbp, ubp ! beginning and ending pft - integer , intent(in) :: lbc, ubc ! beginning and ending column - real(r8), intent(in) :: parr(lbp:ubp) ! pft array - real(r8), intent(out) :: carr(lbc:ubc) ! column array - character(len=*), intent(in) :: p2c_scale_type ! scale type -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: pi,p,c,index ! indices - real(r8) :: scale_p2c(lbp:ubp) ! scale factor for column->landunit mapping - logical :: found ! temporary for error check - real(r8) :: sumwt(lbc:ubc) ! sum of weights - real(r8), pointer :: wtcol(:) ! weight of pft relative to column - integer , pointer :: pcolumn(:) ! column index of corresponding pft - integer , pointer :: npfts(:) ! number of pfts in column - integer , pointer :: pfti(:) ! initial pft index in column -!------------------------------------------------------------------------ - - wtcol => pft%wtcol - pcolumn => pft%column - npfts => col%npfts - pfti => col%pfti - - if (p2c_scale_type == 'unity') then - do p = lbp,ubp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2c_1d error: scale type ',p2c_scale_type,' not supported' - call endrun() - end if - - carr(lbc:ubc) = spval - sumwt(lbc:ubc) = 0._r8 - do p = lbp,ubp - if (wtcol(p) /= 0._r8) then - if (parr(p) /= spval) then - c = pcolumn(p) - if (sumwt(c) == 0._r8) carr(c) = 0._r8 - carr(c) = carr(c) + parr(p) * scale_p2c(p) * wtcol(p) - sumwt(c) = sumwt(c) + wtcol(p) - end if - end if - end do - found = .false. - do c = lbc,ubc - if (sumwt(c) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = c - else if (sumwt(c) /= 0._r8) then - carr(c) = carr(c)/sumwt(c) - end if - end do - if (found) then - write(iulog,*)'p2c error: sumwt is greater than 1.0 at c= ',index - call endrun() - end if - - end subroutine p2c_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2c_2d -! -! !INTERFACE: - subroutine p2c_2d (lbp, ubp, lbc, ubc, num2d, parr, carr, p2c_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from landunits to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !USES: - use clm_varpar, only : max_pft_per_col -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbp, ubp ! beginning and ending pft - integer , intent(in) :: lbc, ubc ! beginning and ending column - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: parr(lbp:ubp,num2d) ! pft array - real(r8), intent(out) :: carr(lbc:ubc,num2d) ! column array - character(len=*), intent(in) :: p2c_scale_type ! scale type -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: j,pi,p,c,index ! indices - real(r8) :: scale_p2c(lbp:ubp) ! scale factor for column->landunit mapping - logical :: found ! temporary for error check - real(r8) :: sumwt(lbc:ubc) ! sum of weights - real(r8), pointer :: wtcol(:) ! weight of pft relative to column - integer , pointer :: pcolumn(:) ! column index of corresponding pft - integer , pointer :: npfts(:) ! number of pfts in column - integer , pointer :: pfti(:) ! initial pft index in column -!------------------------------------------------------------------------ - - wtcol => pft%wtcol - pcolumn => pft%column - npfts => col%npfts - pfti => col%pfti - - if (p2c_scale_type == 'unity') then - do p = lbp,ubp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2c_2d error: scale type ',p2c_scale_type,' not supported' - call endrun() - end if - - carr(:,:) = spval - do j = 1,num2d - sumwt(:) = 0._r8 - do p = lbp,ubp - if (wtcol(p) /= 0._r8) then - if (parr(p,j) /= spval) then - c = pcolumn(p) - if (sumwt(c) == 0._r8) carr(c,j) = 0._r8 - carr(c,j) = carr(c,j) + parr(p,j) * scale_p2c(p) * wtcol(p) - sumwt(c) = sumwt(c) + wtcol(p) - end if - end if - end do - found = .false. - do c = lbc,ubc - if (sumwt(c) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = c - else if (sumwt(c) /= 0._r8) then - carr(c,j) = carr(c,j)/sumwt(c) - end if - end do - if (found) then - write(iulog,*)'p2c_2d error: sumwt is greater than 1.0 at c= ',index,' lev= ',j - call endrun() - end if - end do - end subroutine p2c_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2c_1d_filter -! -! !INTERFACE: - subroutine p2c_1d_filter (numfc, filterc, pftarr, colarr) -! -! !DESCRIPTION: -! perform pft to column averaging for single level pft arrays -! -! !USES: - use clm_varpar, only : max_pft_per_col - use clm_varcon, only : istice_mec -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: numfc - integer , intent(in) :: filterc(numfc) - real(r8), pointer :: pftarr(:) - real(r8), pointer :: colarr(:) -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: fc,c,pi,p,l ! indices - integer , pointer :: npfts(:) - integer , pointer :: pfti(:) - integer , pointer :: pftf(:) - integer , pointer :: clandunit(:) - integer , pointer :: ltype(:) - real(r8), pointer :: wtcol(:) - real(r8), pointer :: wtgcell(:) -!----------------------------------------------------------------------- - - npfts => col%npfts - pfti => col%pfti - pftf => col%pftf - clandunit => col%landunit - ltype => lun%itype - wtcol => pft%wtcol - wtgcell => pft%wtgcell - - do fc = 1,numfc - c = filterc(fc) - l = clandunit(c) - colarr(c) = 0._r8 - do p = pfti(c), pftf(c) - ! Note: some glacier_mec pfts may have zero weight - if (wtgcell(p) > 0._r8 .or. ltype(l)==istice_mec) colarr(c) = colarr(c) + pftarr(p) * wtcol(p) - end do - end do - - end subroutine p2c_1d_filter - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2c_2d_filter -! -! !INTERFACE: - subroutine p2c_2d_filter (lev, numfc, filterc, pftarr, colarr) -! -! !DESCRIPTION: -! perform pft to column averaging for multi level pft arrays -! -! !USES: - use clm_varpar, only : max_pft_per_col - -! !ARGUMENTS: - implicit none - integer , intent(in) :: lev - integer , intent(in) :: numfc - integer , intent(in) :: filterc(numfc) - real(r8), pointer :: pftarr(:,:) - real(r8), pointer :: colarr(:,:) -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: fc,c,pi,p,j ! indices - integer , pointer :: npfts(:) - integer , pointer :: pfti(:) - integer , pointer :: pftf(:) - real(r8), pointer :: wtcol(:) -!----------------------------------------------------------------------- - - npfts => col%npfts - pfti => col%pfti - pftf => col%pftf - wtcol => pft%wtcol - - do j = 1,lev - do fc = 1,numfc - c = filterc(fc) - colarr(c,j) = 0._r8 - do p = pfti(c), pftf(c) - colarr(c,j) = colarr(c,j) + pftarr(p,j) * wtcol(p) - end do - end do - end do - - end subroutine p2c_2d_filter - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2l_1d -! -! !INTERFACE: - subroutine p2l_1d (lbp, ubp, lbc, ubc, lbl, ubl, parr, larr, & - p2c_scale_type, c2l_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from pfts to landunits -! Averaging is only done for points that are not equal to "spval". -! -! !USES: - use clm_varpar, only : max_pft_per_lu -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbp, ubp ! beginning and ending pft indices - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - real(r8), intent(in) :: parr(lbp:ubp) ! input column array - real(r8), intent(out) :: larr(lbl:ubl) ! output landunit array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: pi,p,c,l,index ! indices - logical :: found ! temporary for error check - real(r8) :: sumwt(lbl:ubl) ! sum of weights - real(r8) :: scale_p2c(lbc:ubc) ! scale factor for pft->column mapping - real(r8) :: scale_c2l(lbc:ubc) ! scale factor for column->landunit mapping - real(r8), pointer :: wtlunit(:) ! weight of pft relative to landunit - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: plandunit(:) ! landunit of corresponding pft - integer , pointer :: npfts(:) ! number of pfts in landunit - integer , pointer :: pfti(:) ! initial pft index in landunit - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - canyon_hwr => lun%canyon_hwr - ltype => lun%itype - ctype => col%itype - clandunit => col%landunit - wtlunit => pft%wtlunit - pcolumn => pft%column - plandunit => pft%landunit - npfts => lun%npfts - pfti => lun%pfti - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2l_1d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - if (p2c_scale_type == 'unity') then - do p = lbp,ubp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2l_1d error: scale type ',p2c_scale_type,' not supported' - call endrun() - end if - - larr(:) = spval - sumwt(:) = 0._r8 - do p = lbp,ubp - if (wtlunit(p) /= 0._r8) then - c = pcolumn(p) - if (parr(p) /= spval .and. scale_c2l(c) /= spval) then - l = plandunit(p) - if (sumwt(l) == 0._r8) larr(l) = 0._r8 - larr(l) = larr(l) + parr(p) * scale_p2c(p) * scale_c2l(c) * wtlunit(p) - sumwt(l) = sumwt(l) + wtlunit(p) - end if - end if - end do - found = .false. - do l = lbl,ubl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l) = larr(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'p2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun() - end if - - end subroutine p2l_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2l_2d -! -! !INTERFACE: - subroutine p2l_2d(lbp, ubp, lbc, ubc, lbl, ubl, num2d, parr, larr, & - p2c_scale_type, c2l_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from pfts to landunits -! Averaging is only done for points that are not equal to "spval". -! -! !USES: - use clm_varpar, only : max_pft_per_lu -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbp, ubp ! beginning and ending pft indices - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: parr(lbp:ubp,num2d) ! input pft array - real(r8), intent(out) :: larr(lbl:ubl,num2d) ! output gridcell array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: j,pi,p,c,l,index ! indices - logical :: found ! temporary for error check - real(r8) :: sumwt(lbl:ubl) ! sum of weights - real(r8) :: scale_p2c(lbc:ubc) ! scale factor for pft->column mapping - real(r8) :: scale_c2l(lbc:ubc) ! scale factor for column->landunit mapping - real(r8), pointer :: wtlunit(:) ! weight of pft relative to landunit - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: plandunit(:) ! landunit of corresponding pft - integer , pointer :: npfts(:) ! number of pfts in landunit - integer , pointer :: pfti(:) ! initial pft index in landunit - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - canyon_hwr => lun%canyon_hwr - ltype => lun%itype - clandunit => col%landunit - ctype => col%itype - wtlunit => pft%wtlunit - pcolumn => pft%column - plandunit => pft%landunit - npfts => lun%npfts - pfti => lun%pfti - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2l_2d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - if (p2c_scale_type == 'unity') then - do p = lbp,ubp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2l_2d error: scale type ',p2c_scale_type,' not supported' - call endrun() - end if - - larr(:,:) = spval - do j = 1,num2d - sumwt(:) = 0._r8 - do p = lbp,ubp - if (wtlunit(p) /= 0._r8) then - c = pcolumn(p) - if (parr(p,j) /= spval .and. scale_c2l(c) /= spval) then - l = plandunit(p) - if (sumwt(l) == 0._r8) larr(l,j) = 0._r8 - larr(l,j) = larr(l,j) + parr(p,j) * scale_p2c(p) * scale_c2l(c) * wtlunit(p) - sumwt(l) = sumwt(l) + wtlunit(p) - end if - end if - end do - found = .false. - do l = lbl,ubl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l,j) = larr(l,j)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'p2l_2d error: sumwt is greater than 1.0 at l= ',index,' j= ',j - call endrun() - end if - end do - - end subroutine p2l_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2g_1d -! -! !INTERFACE: - subroutine p2g_1d(lbp, ubp, lbc, ubc, lbl, ubl, lbg, ubg, parr, garr, & - p2c_scale_type, c2l_scale_type, l2g_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from pfts to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !USES: - use clm_varpar, only : max_pft_per_gcell -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbp, ubp ! beginning and ending pft indices - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - integer , intent(in) :: lbg, ubg ! beginning and ending gridcell indices - real(r8), intent(in) :: parr(lbp:ubp) ! input pft array - real(r8), intent(out) :: garr(lbg:ubg) ! output gridcell array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! !LOCAL VARIABLES: -!EOP - integer :: pi,p,c,l,g,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_p2c(lbp:ubp) ! scale factor - real(r8) :: scale_c2l(lbc:ubc) ! scale factor - real(r8) :: scale_l2g(lbl:ubl) ! scale factor - real(r8) :: sumwt(lbg:ubg) ! sum of weights - real(r8), pointer :: wtgcell(:) ! weight of pfts relative to gridcells - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: plandunit(:) ! landunit of corresponding pft - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: npfts(:) ! number of pfts in gridcell - integer , pointer :: pfti(:) ! initial pft index in gridcell - integer , pointer :: ctype(:) ! column type - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - canyon_hwr => lun%canyon_hwr - ltype => lun%itype - clandunit => col%landunit - ctype => col%itype - wtgcell => pft%wtgcell - pcolumn => pft%column - pgridcell => pft%gridcell - plandunit => pft%landunit - npfts => grc%npfts - pfti => grc%pfti - - call build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2g_1d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - if (p2c_scale_type == 'unity') then - do p = lbp,ubp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2g_1d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - garr(:) = spval - sumwt(:) = 0._r8 - do p = lbp,ubp - if (wtgcell(p) /= 0._r8) then - c = pcolumn(p) - l = plandunit(p) - if (parr(p) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = pgridcell(p) - if (sumwt(g) == 0._r8) garr(g) = 0._r8 - garr(g) = garr(g) + parr(p) * scale_p2c(p) * scale_c2l(c) * scale_l2g(l) * wtgcell(p) - sumwt(g) = sumwt(g) + wtgcell(p) - end if - end if - end do - found = .false. - do g = lbg, ubg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g) = garr(g)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'p2g_1d error: sumwt is greater than 1.0 at g= ',index - call endrun() - end if - - end subroutine p2g_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: p2g_2d -! -! !INTERFACE: - subroutine p2g_2d(lbp, ubp, lbc, ubc, lbl, ubl, lbg, ubg, num2d, & - parr, garr, p2c_scale_type, c2l_scale_type, l2g_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from pfts to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !USES: - use clm_varpar, only : max_pft_per_gcell -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbp, ubp ! beginning and ending pft indices - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - integer , intent(in) :: lbg, ubg ! beginning and ending gridcell indices - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: parr(lbp:ubp,num2d) ! input pft array - real(r8), intent(out) :: garr(lbg:ubg,num2d) ! output gridcell array - character(len=*), intent(in) :: p2c_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: j,pi,p,c,l,g,index ! indices - logical :: found ! temporary for error check - real(r8) :: scale_p2c(lbp:ubp) ! scale factor - real(r8) :: scale_c2l(lbc:ubc) ! scale factor - real(r8) :: scale_l2g(lbl:ubl) ! scale factor - real(r8) :: sumwt(lbg:ubg) ! sum of weights - real(r8), pointer :: wtgcell(:) ! weight of pfts relative to gridcells - integer , pointer :: pcolumn(:) ! column of corresponding pft - integer , pointer :: plandunit(:) ! landunit of corresponding pft - integer , pointer :: pgridcell(:) ! gridcell of corresponding pft - integer , pointer :: npfts(:) ! number of pfts in gridcell - integer , pointer :: pfti(:) ! initial pft index in gridcell - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - canyon_hwr => lun%canyon_hwr - ltype => lun%itype - clandunit => col%landunit - ctype => col%itype - wtgcell => pft%wtgcell - pcolumn => pft%column - pgridcell => pft%gridcell - plandunit => pft%landunit - npfts => grc%npfts - pfti => grc%pfti - - call build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'p2g_2d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - if (p2c_scale_type == 'unity') then - do p = lbp,ubp - scale_p2c(p) = 1.0_r8 - end do - else - write(iulog,*)'p2g_2d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - garr(:,:) = spval - do j = 1,num2d - sumwt(:) = 0._r8 - do p = lbp,ubp - if (wtgcell(p) /= 0._r8) then - c = pcolumn(p) - l = plandunit(p) - if (parr(p,j) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = pgridcell(p) - if (sumwt(g) == 0._r8) garr(g,j) = 0._r8 - garr(g,j) = garr(g,j) + parr(p,j) * scale_p2c(p) * scale_c2l(c) * scale_l2g(l) * wtgcell(p) - sumwt(g) = sumwt(g) + wtgcell(p) - end if - end if - end do - found = .false. - do g = lbg, ubg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g,j) = garr(g,j)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'p2g_2d error: sumwt gt 1.0 at g/sumwt = ',index,sumwt(index) - call endrun() - end if - end do - - end subroutine p2g_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: c2l_1d -! -! !INTERFACE: - subroutine c2l_1d (lbc, ubc, lbl, ubl, carr, larr, c2l_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from columns to landunits -! Averaging is only done for points that are not equal to "spval". -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - real(r8), intent(in) :: carr(lbc:ubc) ! input column array - real(r8), intent(out) :: larr(lbl:ubl) ! output landunit array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: ci,c,l,index ! indices - integer :: max_col_per_lu ! max columns per landunit; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_c2l(lbc:ubc) ! scale factor for column->landunit mapping - real(r8) :: sumwt(lbl:ubl) ! sum of weights - real(r8), pointer :: wtlunit(:) ! weight of landunits relative to gridcells - integer , pointer :: clandunit(:) ! gridcell of corresponding column - integer , pointer :: ncolumns(:) ! number of columns in landunit - integer , pointer :: coli(:) ! initial column index in landunit - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - ctype => col%itype - ltype => lun%itype - canyon_hwr => lun%canyon_hwr - wtlunit => col%wtlunit - clandunit => col%landunit - ncolumns => lun%ncolumns - coli => lun%coli - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2l_1d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - larr(:) = spval - sumwt(:) = 0._r8 - do c = lbc,ubc - if (wtlunit(c) /= 0._r8) then - if (carr(c) /= spval .and. scale_c2l(c) /= spval) then - l = clandunit(c) - if (sumwt(l) == 0._r8) larr(l) = 0._r8 - larr(l) = larr(l) + carr(c) * scale_c2l(c) * wtlunit(c) - sumwt(l) = sumwt(l) + wtlunit(c) - end if - end if - end do - found = .false. - do l = lbl,ubl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l) = larr(l)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'c2l_1d error: sumwt is greater than 1.0 at l= ',index - call endrun() - end if - - end subroutine c2l_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: c2l_2d -! -! !INTERFACE: - subroutine c2l_2d (lbc, ubc, lbl, ubl, num2d, carr, larr, c2l_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from columns to landunits -! Averaging is only done for points that are not equal to "spval". -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: carr(lbc:ubc,num2d) ! input column array - real(r8), intent(out) :: larr(lbl:ubl,num2d) ! output landunit array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: j,l,ci,c,index ! indices - integer :: max_col_per_lu ! max columns per landunit; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_c2l(lbc:ubc) ! scale factor for column->landunit mapping - real(r8) :: sumwt(lbl:ubl) ! sum of weights - real(r8), pointer :: wtlunit(:) ! weight of column relative to landunit - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: ncolumns(:) ! number of columns in landunit - integer , pointer :: coli(:) ! initial column index in landunit - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - ctype => col%itype - ltype => lun%itype - canyon_hwr => lun%canyon_hwr - wtlunit => col%wtlunit - clandunit => col%landunit - ncolumns => lun%ncolumns - coli => lun%coli - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2l_2d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - larr(:,:) = spval - do j = 1,num2d - sumwt(:) = 0._r8 - do c = lbc,ubc - if (wtlunit(c) /= 0._r8) then - if (carr(c,j) /= spval .and. scale_c2l(c) /= spval) then - l = clandunit(c) - if (sumwt(l) == 0._r8) larr(l,j) = 0._r8 - larr(l,j) = larr(l,j) + carr(c,j) * scale_c2l(c) * wtlunit(c) - sumwt(l) = sumwt(l) + wtlunit(c) - end if - end if - end do - found = .false. - do l = lbl,ubl - if (sumwt(l) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = l - else if (sumwt(l) /= 0._r8) then - larr(l,j) = larr(l,j)/sumwt(l) - end if - end do - if (found) then - write(iulog,*)'c2l_2d error: sumwt is greater than 1.0 at l= ',index,' lev= ',j - call endrun() - end if - end do - - end subroutine c2l_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: c2g_1d -! -! !INTERFACE: - subroutine c2g_1d(lbc, ubc, lbl, ubl, lbg, ubg, carr, garr, & - c2l_scale_type, l2g_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from columns to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - integer , intent(in) :: lbg, ubg ! beginning and ending landunit indices - real(r8), intent(in) :: carr(lbc:ubc) ! input column array - real(r8), intent(out) :: garr(lbg:ubg) ! output gridcell array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: ci,c,l,g,index ! indices - integer :: max_col_per_gcell ! max columns per gridcell; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_c2l(lbc:ubc) ! scale factor - real(r8) :: scale_l2g(lbl:ubl) ! scale factor - real(r8) :: sumwt(lbg:ubg) ! sum of weights - real(r8), pointer :: wtgcell(:) ! weight of columns relative to gridcells - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: cgridcell(:) ! gridcell of corresponding column - integer , pointer :: ncolumns(:) ! number of columns in gridcell - integer , pointer :: coli(:) ! initial column index in gridcell - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - ctype => col%itype - ltype => lun%itype - canyon_hwr => lun%canyon_hwr - wtgcell => col%wtgcell - clandunit => col%landunit - cgridcell => col%gridcell - ncolumns => grc%ncolumns - coli => grc%coli - - call build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2l_1d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - garr(:) = spval - sumwt(:) = 0._r8 - do c = lbc,ubc - if ( wtgcell(c) /= 0._r8) then - l = clandunit(c) - if (carr(c) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = cgridcell(c) - if (sumwt(g) == 0._r8) garr(g) = 0._r8 - garr(g) = garr(g) + carr(c) * scale_c2l(c) * scale_l2g(l) * wtgcell(c) - sumwt(g) = sumwt(g) + wtgcell(c) - end if - end if - end do - found = .false. - do g = lbg, ubg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g) = garr(g)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'c2g_1d error: sumwt is greater than 1.0 at g= ',index - call endrun() - end if - - end subroutine c2g_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: c2g_2d -! -! !INTERFACE: - subroutine c2g_2d(lbc, ubc, lbl, ubl, lbg, ubg, num2d, carr, garr, & - c2l_scale_type, l2g_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from columns to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbc, ubc ! beginning and ending column indices - integer , intent(in) :: lbl, ubl ! beginning and ending landunit indices - integer , intent(in) :: lbg, ubg ! beginning and ending gridcell indices - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: carr(lbc:ubc,num2d) ! input column array - real(r8), intent(out) :: garr(lbg:ubg,num2d) ! output gridcell array - character(len=*), intent(in) :: c2l_scale_type ! scale factor type for averaging - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: j,ci,c,g,l,index ! indices - integer :: max_col_per_gcell ! max columns per gridcell; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_c2l(lbc:ubc) ! scale factor - real(r8) :: scale_l2g(lbl:ubl) ! scale factor - real(r8) :: sumwt(lbg:ubg) ! sum of weights - real(r8), pointer :: wtgcell(:) ! weight of columns relative to gridcells - integer , pointer :: clandunit(:) ! landunit of corresponding column - integer , pointer :: cgridcell(:) ! gridcell of corresponding column - integer , pointer :: ncolumns(:) ! number of columns in gridcell - integer , pointer :: coli(:) ! initial column index in gridcell - integer , pointer :: ctype(:) ! column type - integer , pointer :: ltype(:) ! landunit type - real(r8), pointer :: canyon_hwr(:) ! urban canyon height to width ratio -!------------------------------------------------------------------------ - - ctype => col%itype - ltype => lun%itype - canyon_hwr => lun%canyon_hwr - wtgcell => col%wtgcell - clandunit => col%landunit - cgridcell => col%gridcell - ncolumns => grc%ncolumns - coli => grc%coli - - call build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) - - if (c2l_scale_type == 'unity') then - do c = lbc,ubc - scale_c2l(c) = 1.0_r8 - end do - else if (c2l_scale_type == 'urbanf') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = 3.0 * canyon_hwr(l) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0_r8 - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else if (c2l_scale_type == 'urbans') then - do c = lbc,ubc - l = clandunit(c) - if (ltype(l) == isturb) then - if (ctype(c) == icol_sunwall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_shadewall) then - scale_c2l(c) = (3.0 * canyon_hwr(l)) / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_road_perv .or. ctype(c) == icol_road_imperv) then - scale_c2l(c) = 3.0 / (2.*canyon_hwr(l) + 1.) - else if (ctype(c) == icol_roof) then - scale_c2l(c) = 1.0_r8 - end if - else - scale_c2l(c) = 1.0_r8 - end if - end do - else - write(iulog,*)'c2g_2d error: scale type ',c2l_scale_type,' not supported' - call endrun() - end if - - garr(:,:) = spval - do j = 1,num2d - sumwt(:) = 0._r8 - do c = lbc,ubc - if (wtgcell(c) /= 0._r8) then - l = clandunit(c) - if (carr(c,j) /= spval .and. scale_c2l(c) /= spval .and. scale_l2g(l) /= spval) then - g = cgridcell(c) - if (sumwt(g) == 0._r8) garr(g,j) = 0._r8 - garr(g,j) = garr(g,j) + carr(c,j) * scale_c2l(c) * scale_l2g(l) * wtgcell(c) - sumwt(g) = sumwt(g) + wtgcell(c) - end if - end if - end do - found = .false. - do g = lbg, ubg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g,j) = garr(g,j)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'c2g_2d error: sumwt is greater than 1.0 at g= ',index - call endrun() - end if - end do - - end subroutine c2g_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: l2g_1d -! -! !INTERFACE: - subroutine l2g_1d(lbl, ubl, lbg, ubg, larr, garr, l2g_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from landunits to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbl, ubl ! beginning and ending sub landunit indices - integer , intent(in) :: lbg, ubg ! beginning and ending gridcell indices - real(r8), intent(in) :: larr(lbl:ubl) ! input landunit array - real(r8), intent(out) :: garr(lbg:ubg) ! output gridcell array - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: li,l,g,index ! indices - integer :: max_lu_per_gcell ! max landunits per gridcell; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_l2g(lbl:ubl) ! scale factor - real(r8) :: sumwt(lbg:ubg) ! sum of weights - real(r8), pointer :: wtgcell(:) ! weight of landunits relative to gridcells - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: nlandunits(:) ! number of landunits in gridcell - integer , pointer :: luni(:) ! initial landunit index in gridcell -!------------------------------------------------------------------------ - - wtgcell => lun%wtgcell - lgridcell => lun%gridcell - nlandunits => grc%nlandunits - luni => grc%luni - - call build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) - - garr(:) = spval - sumwt(:) = 0._r8 - do l = lbl,ubl - if (wtgcell(l) /= 0._r8) then - if (larr(l) /= spval .and. scale_l2g(l) /= spval) then - g = lgridcell(l) - if (sumwt(g) == 0._r8) garr(g) = 0._r8 - garr(g) = garr(g) + larr(l) * scale_l2g(l) * wtgcell(l) - sumwt(g) = sumwt(g) + wtgcell(l) - end if - end if - end do - found = .false. - do g = lbg, ubg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index = g - else if (sumwt(g) /= 0._r8) then - garr(g) = garr(g)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'l2g_1d error: sumwt is greater than 1.0 at g= ',index - call endrun() - end if - - end subroutine l2g_1d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: l2g_2d -! -! !INTERFACE: - subroutine l2g_2d(lbl, ubl, lbg, ubg, num2d, larr, garr, l2g_scale_type) -! -! !DESCRIPTION: -! Perfrom subgrid-average from landunits to gridcells. -! Averaging is only done for points that are not equal to "spval". -! -! !ARGUMENTS: - implicit none - integer , intent(in) :: lbl, ubl ! beginning and ending column indices - integer , intent(in) :: lbg, ubg ! beginning and ending gridcell indices - integer , intent(in) :: num2d ! size of second dimension - real(r8), intent(in) :: larr(lbl:ubl,num2d) ! input landunit array - real(r8), intent(out) :: garr(lbg:ubg,num2d) ! output gridcell array - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/03 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: j,g,li,l,index ! indices - integer :: max_lu_per_gcell ! max landunits per gridcell; on the fly - logical :: found ! temporary for error check - real(r8) :: scale_l2g(lbl:ubl) ! scale factor - real(r8) :: sumwt(lbg:ubg) ! sum of weights - real(r8), pointer :: wtgcell(:) ! weight of landunits relative to gridcells - integer , pointer :: lgridcell(:) ! gridcell of corresponding landunit - integer , pointer :: nlandunits(:) ! number of landunits in gridcell - integer , pointer :: luni(:) ! initial landunit index in gridcell -!------------------------------------------------------------------------ - - wtgcell => lun%wtgcell - lgridcell => lun%gridcell - nlandunits => grc%nlandunits - luni => grc%luni - - call build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) - - garr(:,:) = spval - do j = 1,num2d - sumwt(:) = 0._r8 - do l = lbl,ubl - if (wtgcell(l) /= 0._r8) then - if (larr(l,j) /= spval .and. scale_l2g(l) /= spval) then - g = lgridcell(l) - if (sumwt(g) == 0._r8) garr(g,j) = 0._r8 - garr(g,j) = garr(g,j) + larr(l,j) * scale_l2g(l) * wtgcell(l) - sumwt(g) = sumwt(g) + wtgcell(l) - end if - end if - end do - found = .false. - do g = lbg,ubg - if (sumwt(g) > 1.0_r8 + 1.e-6_r8) then - found = .true. - index= g - else if (sumwt(g) /= 0._r8) then - garr(g,j) = garr(g,j)/sumwt(g) - end if - end do - if (found) then - write(iulog,*)'l2g_2d error: sumwt is greater than 1.0 at g= ',index,' lev= ',j - call endrun() - end if - end do - - end subroutine l2g_2d - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: build_scale_l2g -! -! !INTERFACE: - subroutine build_scale_l2g(l2g_scale_type, lbl, ubl, scale_l2g) -! -! !DESCRIPTION: -! Fill the scale_l2g(lbl:ubl) array with appropriate values for the given l2g_scale_type. -! This array can later be used to scale each landunit in forming grid cell averages. -! -! !USES: - use clm_varcon, only : max_lunit -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - integer , intent(in) :: lbl, ubl ! beginning and ending column indices - real(r8) , intent(out) :: scale_l2g(lbl:ubl) ! scale factor -! -! !REVISION HISTORY: -! Created by Bill Sacks 10/11 -! -! -! !LOCAL VARIABLES: -!EOP - real(r8) :: scale_lookup(max_lunit) ! scale factor for each landunit type - integer :: l ! index - integer , pointer :: ltype(:) ! landunit type -!----------------------------------------------------------------------- - - ltype => lun%itype - - call create_scale_l2g_lookup(l2g_scale_type, scale_lookup) - - do l = lbl,ubl - scale_l2g(l) = scale_lookup(ltype(l)) - end do - - end subroutine build_scale_l2g - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: create_scale_l2g_lookup -! -! !INTERFACE: - subroutine create_scale_l2g_lookup(l2g_scale_type, scale_lookup) -! -! DESCRIPTION: -! Create a lookup array, scale_lookup(1..max_lunit), which gives the scale factor for -! each landunit type depending on l2g_scale_type -! -! !USES: - use clm_varcon, only : istsoil, istice, istdlak, istslak, istwet, isturb, istice_mec,& - istcrop, max_lunit, spval -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: l2g_scale_type ! scale factor type for averaging - real(r8) , intent(out) :: scale_lookup(max_lunit) ! scale factor for each landunit type -! -! !REVISION HISTORY: -! Created by Bill Sacks 10/11 -! -!EOP -!----------------------------------------------------------------------- - - ! ------------ WJS (10-14-11): IMPORTANT GENERAL NOTES ------------ - ! - ! Since scale_l2g is not currently included in the sumwt accumulations, you need to - ! be careful about the scale values you use. Values of 1 and spval are safe - ! (including having multiple landunits with value 1), but only use other values if - ! you know what you are doing! For example, using a value of 0 is NOT the correct way - ! to exclude a landunit from the average, because the normalization will be done - ! incorrectly in this case: instead, use spval to exclude a landunit from the - ! average. Similarly, using a value of 2 is NOT the correct way to give a landunit - ! double relative weight in general, because the normalization won't be done - ! correctly in this case, either. - ! - ! In the longer-term, I believe that the correct solution to this problem is to - ! include scale_l2g (and the other scale factors) in the sumwt accumulations - ! (e.g., sumwt = sumwt + wtgcell * scale_p2c * scale_c2l * scale_l2g), but that - ! requires some more thought to (1) make sure that is correct, and (2) make sure it - ! doesn't break the urban scaling. - ! - ! ----------------------------------------------------------------- - - - ! Initialize scale_lookup to spval for all landunits. Thus, any landunit that keeps - ! the default value will be excluded from grid cell averages. - scale_lookup(:) = spval - - if (l2g_scale_type == 'unity') then - scale_lookup(:) = 1.0_r8 - else if (l2g_scale_type == 'veg') then - scale_lookup(istsoil) = 1.0_r8 - scale_lookup(istcrop) = 1.0_r8 - else if (l2g_scale_type == 'ice') then - scale_lookup(istice) = 1.0_r8 - scale_lookup(istice_mec) = 1.0_r8 - else if (l2g_scale_type == 'nonurb') then - scale_lookup(:) = 1.0_r8 - scale_lookup(isturb) = spval - else - write(iulog,*)'scale_l2g_lookup_array error: scale type ',l2g_scale_type,' not supported' - call endrun() - end if - - end subroutine create_scale_l2g_lookup - -end module subgridAveMod diff --git a/src_clm40/main/subgridMod.F90 b/src_clm40/main/subgridMod.F90 deleted file mode 100644 index 8fdb19a1ea..0000000000 --- a/src_clm40/main/subgridMod.F90 +++ /dev/null @@ -1,282 +0,0 @@ -module subgridMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: subgridMod -! -! !DESCRIPTION: -! sub-grid data and mapping types and modules -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use spmdMod , only : masterproc - use abortutils , only : endrun - - implicit none - private - save - -! !PUBLIC MEMBER FUNCTIONS: - public subgrid_get_gcellinfo ! Returns g,l,c,p properties from wtxy - - -! !REVISION HISTORY: -! 2006.07.04 T Craig, rename initSubgridMod -! -! -! !PRIVATE MEMBER FUNCTIONS: None -! -! !PRIVATE DATA MEMBERS: None -!EOP -!----------------------------------------------------------------------- - -contains - -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: subgrid_get_gcellinfo -! -! !INTERFACE: - subroutine subgrid_get_gcellinfo (nw, & - nlunits, ncols, npfts, & - nveg, wtveg, & - ncrop, wtcrop, & - nurban, wturban, & - nlake, wtlake, & - nwetland, wtwetland, & - nglacier, wtglacier, & - nglacier_mec, wtglacier_mec, & - glcmask) -! -! !DESCRIPTION: -! Obtain gridcell properties -! -! !USES - use clm_varpar , only : numpft, maxpatch_pft, numcft, & - npatch_lake, npatch_glacier, npatch_wet, npatch_urban - use clm_varpar , only : npatch_glacier_mec - use clm_varctl , only : allocate_all_vegpfts, create_crop_landunit - use clm_varctl , only : create_glacier_mec_landunit, glc_topomax - use clm_varsur , only : wtxy - use clm_varsur , only : topoxy - -! !ARGUMENTS - implicit none - integer , intent(in) :: nw ! wtxy cell index - integer , optional, intent(out) :: nlunits ! number of landunits - integer , optional, intent(out) :: ncols ! number of columns - integer , optional, intent(out) :: npfts ! number of pfts - integer , optional, intent(out) :: nveg ! number of vegetated pfts in naturally vegetated landunit - real(r8), optional, intent(out) :: wtveg ! weight (relative to gridcell) of naturally vegetated landunit - integer , optional, intent(out) :: ncrop ! number of crop pfts in crop landunit - real(r8), optional, intent(out) :: wtcrop ! weight (relative to gridcell) of crop landunit - integer , optional, intent(out) :: nurban ! number of urban pfts (columns) in urban landunit - real(r8), optional, intent(out) :: wturban ! weight (relative to gridcell) of urban pfts (columns) in urban la - integer , optional, intent(out) :: nlake ! number of lake pfts (columns) in lake landunit - real(r8), optional, intent(out) :: wtlake ! weight (relative to gridcell) of lake landunitof lake pfts (columns) in lake landunit - integer , optional, intent(out) :: nwetland ! number of wetland pfts (columns) in wetland landunit - real(r8), optional, intent(out) :: wtwetland ! weight (relative to gridcell) of wetland landunitof wetland pfts (columns) in wetland landunit - integer , optional, intent(out) :: nglacier ! number of glacier pfts (columns) in glacier landunit - real(r8), optional, intent(out) :: wtglacier ! weight (relative to gridcell) of glacier landunitof glacier pfts (columns) in glacier landunit - integer , optional, intent(out) :: nglacier_mec ! number of glacier_mec pfts (columns) in glacier_mec landunit - real(r8), optional, intent(out) :: wtglacier_mec ! weight (relative to gridcell) of glacier_mec landunitof glacier pfts (columns) in glacier_mec landunit - integer , optional, intent(in) :: glcmask ! = 1 if glc requires surface mass balance in this gridcell -! -! !CALLED FROM: -! subroutines decomp_init, initGridCells -! -! !REVISION HISTORY: -! 2002.09.11 Mariana Vertenstein Creation. -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m ! loop index - integer :: n ! elevation class index - integer :: ipfts ! number of pfts in gridcell - integer :: icols ! number of columns in gridcell - integer :: ilunits ! number of landunits in gridcell - integer :: npfts_per_lunit ! number of pfts in landunit - real(r8) :: wtlunit ! weight (relative to gridcell) of landunit -!------------------------------------------------------------------------------ - - ! Initialize pfts, columns and landunits counters for gridcell - - ipfts = 0 - icols = 0 - ilunits = 0 - - ! Set naturally vegetated landunit - - npfts_per_lunit = 0 - wtlunit = 0._r8 - ! If crop should be on separate land units - if (allocate_all_vegpfts .and. create_crop_landunit) then - do m = 1, maxpatch_pft-numcft - if (wtxy(nw,m) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 ! sum natural pfts - wtlunit = wtlunit + wtxy(nw,m) ! and their wts - end if - end do - do m = maxpatch_pft-numcft+1, maxpatch_pft - if (wtxy(nw,m) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 ! sum crops, too, but not - end if ! their wts for now - end do - ! Assume that the vegetated landunit has one column - else - do m = 1, maxpatch_pft - if (wtxy(nw,m) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 - wtlunit = wtlunit + wtxy(nw,m) - end if - end do - end if - if (npfts_per_lunit > 0) then ! true even when only crops are present - if (allocate_all_vegpfts) npfts_per_lunit = numpft+1 - if (allocate_all_vegpfts .and. create_crop_landunit) npfts_per_lunit = numpft+1-numcft - ilunits = ilunits + 1 - icols = icols + 1 - end if - ipfts = ipfts + npfts_per_lunit - if (present(nveg )) nveg = npfts_per_lunit - if (present(wtveg)) wtveg = wtlunit - - ! Set urban landunit - - npfts_per_lunit = 0 - wtlunit = 0._r8 - do m = npatch_urban, npatch_lake-1 - if (wtxy(nw,m) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 - wtlunit = wtlunit + wtxy(nw,m) - end if - end do - if (npfts_per_lunit > 0) then - ilunits = ilunits + 1 - icols = icols + npfts_per_lunit - end if - ipfts = ipfts + npfts_per_lunit - if (present(nurban )) nurban = npfts_per_lunit - if (present(wturban)) wturban = wtlunit - - ! Set lake landunit - - npfts_per_lunit = 0 - wtlunit = 0._r8 - if (wtxy(nw,npatch_lake) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 - wtlunit = wtlunit + wtxy(nw,npatch_lake) - end if - if (npfts_per_lunit > 0) then - ilunits = ilunits + 1 - icols = icols + npfts_per_lunit - end if - ipfts = ipfts + npfts_per_lunit - if (present(nlake )) nlake = npfts_per_lunit - if (present(wtlake)) wtlake = wtlunit - - ! Set wetland landunit - - npfts_per_lunit = 0 - wtlunit = 0._r8 - if (wtxy(nw,npatch_wet) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 - wtlunit = wtlunit + wtxy(nw,npatch_wet) - end if - if (npfts_per_lunit > 0) then - ilunits = ilunits + 1 - icols = icols + npfts_per_lunit - end if - ipfts = ipfts + npfts_per_lunit - if (present(nwetland )) nwetland = npfts_per_lunit - if (present(wtwetland)) wtwetland = wtlunit - - ! Set glacier landunit - - npfts_per_lunit = 0 - wtlunit = 0._r8 - if (wtxy(nw,npatch_glacier) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 - wtlunit = wtlunit + wtxy(nw,npatch_glacier) - end if - if (npfts_per_lunit > 0) then - ilunits = ilunits + 1 - icols = icols + npfts_per_lunit - end if - ipfts = ipfts + npfts_per_lunit - if (present(nglacier )) nglacier = npfts_per_lunit - if (present(wtglacier)) wtglacier = wtlunit - - ! Set glacier_mec landunit - ! If glcmask = 1, we create a column for each elevation class even if wtxy = 0. - - if (create_glacier_mec_landunit) then - npfts_per_lunit = 0 - wtlunit = 0._r8 - do m = npatch_glacier+1, npatch_glacier_mec - if (wtxy(nw,m) > 0._r8) then - npfts_per_lunit = npfts_per_lunit + 1 - wtlunit = wtlunit + wtxy(nw,m) - topoxy(nw,m) = max (topoxy(nw,m), 0._r8) - elseif (present(glcmask)) then - if (glcmask == 1) then ! create a virtual column - npfts_per_lunit = npfts_per_lunit + 1 - n = m - npatch_glacier ! elevation class index - if (m < npatch_glacier_mec) then ! classes 1 to maxpatch_glcmec-1 - topoxy(nw,m) = 0.5_r8 * (glc_topomax(n-1) + glc_topomax(n)) - else ! class maxpatch_glcmec - topoxy(nw,m) = 2.0_r8*glc_topomax(n-1) - glc_topomax(n-2) ! somewhat arbitrary - endif - endif ! glcmask = 1 - endif ! wtxy > 0 - enddo ! npatch_glacier_mec - if (npfts_per_lunit > 0) then - ilunits = ilunits + 1 - icols = icols + npfts_per_lunit - end if - ipfts = ipfts + npfts_per_lunit - if (present(nglacier_mec )) nglacier_mec = npfts_per_lunit - if (present(wtglacier_mec)) wtglacier_mec = wtlunit - - endif ! create_glacier_mec_landunit - - ! Set crop landunit if appropriate - - npfts_per_lunit = 0 - wtlunit = 0._r8 - if (allocate_all_vegpfts .and. create_crop_landunit) then - do m = 1, maxpatch_pft-numcft - if (wtxy(nw,m) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 ! sum natural pfts again - end if ! not their wts this time - end do - do m = maxpatch_pft-numcft+1, maxpatch_pft - if (wtxy(nw,m) > 0.0_r8) then - npfts_per_lunit = npfts_per_lunit + 1 ! sum crops - wtlunit = wtlunit + wtxy(nw,m) ! and their wts - end if - end do - end if - if (npfts_per_lunit > 0) then ! true even if only natural veg is present - if (allocate_all_vegpfts .and. create_crop_landunit) npfts_per_lunit = numcft - ilunits = ilunits + 1 - icols = icols + npfts_per_lunit - end if - ipfts = ipfts + npfts_per_lunit - if (present(ncrop )) ncrop = npfts_per_lunit - if (present(wtcrop)) wtcrop = wtlunit - - ! Determine return arguments - - if (present(nlunits)) nlunits = ilunits - if (present(ncols)) ncols = icols - if (present(npfts)) npfts = ipfts - - end subroutine subgrid_get_gcellinfo - -!----------------------------------------------------------------------- - -end module subgridMod diff --git a/src_clm40/main/subgridRestMod.F90 b/src_clm40/main/subgridRestMod.F90 deleted file mode 100644 index e2072e886d..0000000000 --- a/src_clm40/main/subgridRestMod.F90 +++ /dev/null @@ -1,286 +0,0 @@ -module subgridRestMod - -contains - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: subgridRest -! -! !INTERFACE: - subroutine subgridRest( ncid, flag ) - - use shr_kind_mod , only : r8 => shr_kind_r8 - use clmtype - use ncdio_pio , only : file_desc_t, ncd_io, ncd_defvar, ncd_int, ncd_double - use decompMod , only : get_proc_bounds, ldecomp - use domainMod , only : ldomain - use clm_time_manager , only : get_curr_date - use abortutils , only : endrun -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid ! netCDF dataset id - character(len=*) , intent(in) :: flag ! flag to determine if define, write or read data -! -! !REVISION HISTORY: -! -! -! !LOCAL VARIABLES: -!EOP - integer :: g,l,c,p,j,i ! indices - integer :: yr ! current year (0 -> ...) - integer :: mon ! current month (1 -> 12) - integer :: day ! current day (1 -> 31) - integer :: mcsec ! seconds of current date - integer :: mcdate ! current date - integer :: begp, endp ! per-proc beg/end pft indices - integer :: begc, endc ! per-proc beg/end column indices - integer :: begl, endl ! per-proc beg/end landunit indices - integer :: begg, endg ! per-proc beg/end gridcell indices - integer :: ier ! error status - real(r8),pointer :: rgarr(:) ! temporary - real(r8),pointer :: rlarr(:) ! temporary - real(r8),pointer :: rcarr(:) ! temporary - real(r8),pointer :: rparr(:) ! temporary - integer ,pointer :: igarr(:) ! temporary - integer ,pointer :: ilarr(:) ! temporary - integer ,pointer :: icarr(:) ! temporary - integer ,pointer :: iparr(:) ! temporary - type(gridcell_type), pointer :: gptr ! pointer to gridcell derived subtype - type(landunit_type), pointer :: lptr ! pointer to landunit derived subtype - type(column_type) , pointer :: cptr ! pointer to column derived subtype - type(pft_type) , pointer :: pptr ! pointer to pft derived subtype - character(len=32) :: subname='SubgridRest' ! subroutine name -!------------------------------------------------------------------------ - - ! Set pointers into derived type - - gptr => grc - lptr => lun - cptr => col - pptr => pft - - ! Get relevant sizes - - call get_proc_bounds(begg, endg, begl, endl, begc, endc, begp, endp) - - ! Allocate dynamic memory - - if (flag == 'write') then - allocate(rgarr(begg:endg),rlarr(begl:endl),rcarr(begc:endc),rparr(begp:endp),stat=ier) - if (ier /= 0) call endrun('allocation error from inicfile_fields rarrs') - allocate(igarr(begg:endg),ilarr(begl:endl),icarr(begc:endc),iparr(begp:endp),stat=ier) - if (ier /= 0) call endrun('allocation error from inicfile_fields iarrs') - end if - - ! Write output data (first write current date and seconds of current date) - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='mcdate', xtype=ncd_int, & - long_name='current date as 8 digit integer (YYYYMMDD)') - call ncd_defvar(ncid=ncid, varname='mcsec', xtype=ncd_int, & - long_name='current seconds of current date', units='s') - else if (flag == 'write') then - call get_curr_date (yr, mon, day, mcsec) - mcdate = yr*10000 + mon*100 + day - !TODO - add this to the file - get this to work -!DEBUG call ncd_io(varname='mcdate', data=mcdate, ncid=ncid, flag=flag) -!DEBUG call ncd_io(varname='mcsec' , data=mcsec , ncid=ncid, flag=flag) - end if - - ! Write gridcell info - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='grid1d_lon', xtype=ncd_double, & - dim1name='gridcell', long_name='gridcell longitude', units='degrees_east') - call ncd_defvar(ncid=ncid, varname='grid1d_lat', xtype=ncd_double, & - dim1name='gridcell', long_name='gridcell latitude', units='degrees_north') - call ncd_defvar(ncid=ncid, varname='grid1d_ixy', xtype=ncd_int, & - dim1name='gridcell', long_name='2d longitude index of corresponding gridcell') - call ncd_defvar(ncid=ncid, varname='grid1d_jxy', xtype=ncd_int, & - dim1name='gridcell', long_name='2d latitude index of corresponding gridcell') - else if (flag == 'write') then - do g=begg,endg - igarr(g)= mod(ldecomp%gdc2glo(g)-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='grid1d_ixy', data=igarr , dim1name=nameg, ncid=ncid, flag=flag) - do g=begg,endg - igarr(g)= (ldecomp%gdc2glo(g) - 1)/ldomain%ni + 1 - enddo - call ncd_io(varname='grid1d_jxy', data=igarr , dim1name=nameg, ncid=ncid, flag=flag) - call ncd_io(varname='grid1d_lon', data=gptr%londeg, dim1name=nameg, ncid=ncid, flag=flag) - call ncd_io(varname='grid1d_lat', data=gptr%latdeg, dim1name=nameg, ncid=ncid, flag=flag) - end if - - ! Write landunit info - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='land1d_lon', xtype=ncd_double, & - dim1name='landunit', long_name='landunit longitude', units='degrees_east') - call ncd_defvar(ncid=ncid, varname='land1d_lat', xtype=ncd_double, & - dim1name='landunit', long_name='landunit latitude', units='degrees_north') - call ncd_defvar(ncid=ncid, varname='land1d_ixy', xtype=ncd_int, & - dim1name='landunit', long_name='2d longitude index of corresponding landunit') - call ncd_defvar(ncid=ncid, varname='land1d_jxy', xtype=ncd_int, & - dim1name='landunit', long_name='2d latitude index of corresponding landunit') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(ncid=ncid, varname='land1d_gi', xtype=ncd_int, & - ! dim1name='landunit', long_name='1d grid index of corresponding landunit') - ! ---------------------------------------------------------------- - call ncd_defvar(ncid=ncid, varname='land1d_wtxy', xtype=ncd_double, & - dim1name='landunit', long_name='landunit weight relative to corresponding gridcell') - call ncd_defvar(ncid=ncid, varname='land1d_ityplun', xtype=ncd_int, & - dim1name='landunit', long_name='landunit type (vegetated,urban,lake,wetland or glacier)') - else if (flag == 'write') then - do l=begl,endl - rlarr(l) = gptr%londeg(lptr%gridcell(l)) - enddo - call ncd_io(varname='land1d_lon' , data=rlarr , dim1name=namel, ncid=ncid, flag=flag) - do l=begl,endl - rlarr(l) = gptr%latdeg(lptr%gridcell(l)) - enddo - call ncd_io(varname='land1d_lat' , data=rlarr , dim1name=namel, ncid=ncid, flag=flag) - do l=begl,endl - ilarr(l) = mod(ldecomp%gdc2glo(lptr%gridcell(l))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='land1d_ixy' , data=ilarr , dim1name=namel, ncid=ncid, flag=flag) - do l=begl,endl - ilarr(l) = (ldecomp%gdc2glo(lptr%gridcell(l))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='land1d_jxy' , data=ilarr , dim1name=namel, ncid=ncid, flag=flag) - call ncd_io(varname='land1d_wtxy' , data=lptr%wtgcell , dim1name=namel, ncid=ncid, flag=flag) - call ncd_io(varname='land1d_ityplun', data=lptr%itype , dim1name=namel, ncid=ncid, flag=flag) - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_io(varname='land1d_gi' , data=lptr%gridcell, dim1name=namel, ncid=ncid, flag=flag) - ! ---------------------------------------------------------------- - end if - - ! Write column info - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='cols1d_lon', xtype=ncd_double, & - dim1name='column', long_name='column longitude', units='degrees_east') - call ncd_defvar(ncid=ncid, varname='cols1d_lat', xtype=ncd_double, & - dim1name='column', long_name='column latitude', units='degrees_north') - call ncd_defvar(ncid=ncid, varname='cols1d_ixy', xtype=ncd_int, & - dim1name='column', long_name='2d longitude index of corresponding column') - call ncd_defvar(ncid=ncid, varname='cols1d_jxy', xtype=ncd_int, & - dim1name='column', long_name='2d latitude index of corresponding column') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(ncid=ncid, varname='cols1d_gi', xtype=ncd_int, & - ! dim1name='column', long_name='1d grid index of corresponding column') - !call ncd_defvar(ncid=ncid, varname='cols1d_li', xtype=ncd_int, & - ! dim1name='column', long_name='1d landunit index of corresponding column') - ! ---------------------------------------------------------------- - call ncd_defvar(ncid=ncid, varname='cols1d_wtxy', xtype=ncd_double, & - dim1name='column', long_name='column weight relative to corresponding gridcell') - call ncd_defvar(ncid=ncid, varname='cols1d_wtlnd', xtype=ncd_double, & - dim1name='column', long_name='column weight relative to corresponding landunit') - call ncd_defvar(ncid=ncid, varname='cols1d_ityplun', xtype=ncd_int, & - dim1name='column', long_name='column landunit type (vegetated,urban,lake,wetland or glacier)') - call ncd_defvar(ncid=ncid, varname='cols1d_ityp', xtype=ncd_int, & - dim1name='column', long_name=& - 'column type (61-roof,62-sunwall,63-shadewall,64-impervious road,65-pervious road,1-all other columns)') - else if (flag == 'write') then - do c=begc,endc - rcarr(c) = gptr%londeg(cptr%gridcell(c)) - enddo - call ncd_io(varname='cols1d_lon' , data=rcarr , dim1name=namec, ncid=ncid, flag=flag) - do c=begc,endc - rcarr(c) = gptr%latdeg(cptr%gridcell(c)) - enddo - call ncd_io(varname='cols1d_lat' , data=rcarr , dim1name=namec, ncid=ncid, flag=flag) - do c=begc,endc - icarr(c) = mod(ldecomp%gdc2glo(cptr%gridcell(c))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='cols1d_ixy' , data=icarr , dim1name=namec, ncid=ncid, flag=flag) - do c=begc,endc - icarr(c) = (ldecomp%gdc2glo(cptr%gridcell(c))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='cols1d_jxy' , data=icarr , dim1name=namec, ncid=ncid, flag=flag) - call ncd_io(varname='cols1d_wtxy' , data=cptr%wtgcell , dim1name=namec, ncid=ncid, flag=flag) - call ncd_io(varname='cols1d_wtlnd', data=cptr%wtlunit , dim1name=namec, ncid=ncid, flag=flag) - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_io(varname='cols1d_gi' , data=cptr%gridcell, dim1name=namec, ncid=ncid, flag=flag) - !call ncd_io(varname='cols1d_li' , data=cptr%landunit, dim1name=namec, ncid=ncid, flag=flag) - ! ---------------------------------------------------------------- - do c=begc,endc - icarr(c) = lptr%itype(cptr%landunit(c)) - enddo - call ncd_io(varname='cols1d_ityplun', data=icarr , dim1name=namec, ncid=ncid, flag=flag) - do c=begc,endc - icarr(c) = cptr%itype((c)) - enddo - call ncd_io(varname='cols1d_ityp', data=icarr , dim1name=namec, ncid=ncid, flag=flag) - end if - - ! Write pft info - - if (flag == 'define') then - call ncd_defvar(ncid=ncid, varname='pfts1d_lon', xtype=ncd_double, & - dim1name='pft', long_name='pft longitude', units='degrees_east') - call ncd_defvar(ncid=ncid, varname='pfts1d_lat', xtype=ncd_double, & - dim1name='pft', long_name='pft latitude', units='degrees_north') - call ncd_defvar(ncid=ncid, varname='pfts1d_ixy', xtype=ncd_int, & - dim1name='pft', long_name='2d longitude index of corresponding pft') - call ncd_defvar(ncid=ncid, varname='pfts1d_jxy', xtype=ncd_int, & - dim1name='pft', long_name='2d latitude index of corresponding pft') - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_defvar(ncid=ncid, varname='pfts1d_gi', xtype=ncd_int, & - ! dim1name='pft', long_name='1d grid index of corresponding pft') - !call ncd_defvar(ncid=ncid, varname='pfts1d_li', xtype=ncd_int, & - ! dim1name='pft', long_name='1d landunit index of corresponding pft') - ! ---------------------------------------------------------------- - call ncd_defvar(ncid=ncid, varname='pfts1d_ci', xtype=ncd_int, & - dim1name='pft', long_name='1d column index of corresponding pft') - call ncd_defvar(ncid=ncid, varname='pfts1d_wtxy', xtype=ncd_double, & - dim1name='pft', long_name='pft weight relative to corresponding gridcell') - call ncd_defvar(ncid=ncid, varname='pfts1d_wtlnd', xtype=ncd_double, & - dim1name='pft', long_name='pft weight relative to corresponding landunit') - call ncd_defvar(ncid=ncid, varname='pfts1d_wtcol', xtype=ncd_double, & - dim1name='pft', long_name='pft weight relative to corresponding column') - call ncd_defvar(ncid=ncid, varname='pfts1d_itypveg', xtype=ncd_int, & - dim1name='pft', long_name='pft vegetation type') - call ncd_defvar(ncid=ncid, varname='pfts1d_ityplun', xtype=ncd_int, & - dim1name='pft', long_name='pft landunit type (vegetated,urban,lake,wetland or glacier)') - else if (flag == 'write') then - do p=begp,endp - rparr(p) = gptr%londeg(pptr%gridcell(p)) - enddo - call ncd_io(varname='pfts1d_lon' , data=rparr , dim1name=namep, ncid=ncid, flag=flag) - do p=begp,endp - rparr(p) = gptr%latdeg(pptr%gridcell(p)) - enddo - call ncd_io(varname='pfts1d_lat' , data=rparr , dim1name=namep, ncid=ncid, flag=flag) - do p=begp,endp - iparr(p) = mod(ldecomp%gdc2glo(pptr%gridcell(p))-1,ldomain%ni) + 1 - enddo - call ncd_io(varname='pfts1d_ixy' , data=iparr , dim1name=namep, ncid=ncid, flag=flag) - do p=begp,endp - iparr(p) = (ldecomp%gdc2glo(pptr%gridcell(p))-1)/ldomain%ni + 1 - enddo - call ncd_io(varname='pfts1d_jxy' , data=iparr , dim1name=namep, ncid=ncid, flag=flag) - call ncd_io(varname='pfts1d_wtxy' , data=pptr%wtgcell , dim1name=namep, ncid=ncid, flag=flag) - call ncd_io(varname='pfts1d_wtlnd' , data=pptr%wtlunit , dim1name=namep, ncid=ncid, flag=flag) - call ncd_io(varname='pfts1d_wtcol' , data=pptr%wtcol , dim1name=namep, ncid=ncid, flag=flag) - call ncd_io(varname='pfts1d_itypveg', data=pptr%itype , dim1name=namep, ncid=ncid, flag=flag) - ! --- EBK Do NOT write out indices that are incorrect 4/1/2011 --- Bug 1310 - !call ncd_io(varname='pfts1d_gi' , data=pptr%gridcell, dim1name=namep, ncid=ncid, flag=flag) - !call ncd_io(varname='pfts1d_li' , data=pptr%landunit, dim1name=namep, ncid=ncid, flag=flag) - !call ncd_io(varname='pfts1d_ci' , data=pptr%column , dim1name=namep, ncid=ncid, flag=flag) - ! ---------------------------------------------------------------- - do p=begp,endp - iparr(p) = lptr%itype(pptr%landunit(p)) - enddo - call ncd_io(varname='pfts1d_ityplun', data=iparr , dim1name=namep, ncid=ncid, flag=flag) - end if - - if (flag == 'write') then - deallocate(rgarr,rlarr,rcarr,rparr) - deallocate(igarr,ilarr,icarr,iparr) - end if - - end subroutine subgridRest - -end module subgridRestMod diff --git a/src_clm40/main/surfrdMod.F90 b/src_clm40/main/surfrdMod.F90 deleted file mode 100644 index 914b21484d..0000000000 --- a/src_clm40/main/surfrdMod.F90 +++ /dev/null @@ -1,1121 +0,0 @@ -module surfrdMod - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: surfrdMod -! -! !DESCRIPTION: -! Contains methods for reading in surface data file and determining -! two-dimensional subgrid weights as well as writing out new surface -! dataset. When reading in the surface dataset, determines array -! which sets the PFT for each of the [maxpatch] patches and -! array which sets the relative abundance of the PFT. -! Also fills in the PFTs for vegetated portion of each grid cell. -! Fractional areas for these points pertain to "vegetated" -! area not to total grid area. Need to adjust them for fraction of grid -! that is vegetated. Also fills in urban, lake, wetland, and glacier patches. -! -! !USES: - use shr_kind_mod, only : r8 => shr_kind_r8 - use abortutils , only : endrun - use clm_varpar , only : nlevsoi, numpft, & - maxpatch_pft, numcft, maxpatch, & - npatch_urban, npatch_lake, npatch_wet, & - npatch_glacier,maxpatch_urb, npatch_glacier_mec, & - maxpatch_glcmec - use clm_varctl , only : glc_topomax, iulog, scmlat, scmlon, single_column, & - create_glacier_mec_landunit, use_cndv - use clm_varsur , only : wtxy, vegxy, topoxy, pctspec - use decompMod , only : get_proc_bounds - use clmtype - use spmdMod - use ncdio_pio , only : file_desc_t, var_desc_t, ncd_pio_openfile, ncd_pio_closefile, & - ncd_io, check_var, ncd_inqfdims, check_dim - use pio -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: surfrd_get_globmask ! Reads global land mask (needed for setting domain decomp) - public :: surfrd_get_grid ! Read grid/ladnfrac data into domain (after domain decomp) - public :: surfrd_get_topo ! Read grid topography into domain (after domain decomp) - public :: surfrd_get_data ! Read surface dataset and determine subgrid weights -! -! !PUBLIC DATA MEMBERS: - logical, public :: crop_prog = .false. ! If prognostic crops is turned on -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! Updated by T Craig -! Updated by Mariana Vertenstein Jan 2011 -! -! -! !PRIVATE MEMBER FUNCTIONS: - private :: surfrd_wtxy_special - private :: surfrd_wtxy_veg_all - private :: surfrd_wtxy_veg_dgvm -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_get_globmask -! -! !INTERFACE: - subroutine surfrd_get_globmask(filename, mask, ni, nj) -! -! !DESCRIPTION: -! Read the surface dataset grid related information: -! This is the first routine called by clm_initialize -! NO DOMAIN DECOMPOSITION HAS BEEN SET YET -! -! !USES: - use fileutils , only : getfil -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: filename ! grid filename - integer , pointer :: mask(:) ! grid mask - integer , intent(out) :: ni, nj ! global grid sizes -! -! !CALLED FROM: -! subroutine surfrd in this module -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - logical :: isgrid2d - integer :: dimid,varid ! netCDF id's - integer :: ns ! size of grid on file - integer :: n,i,j ! index - integer :: ier ! error status - type(file_desc_t) :: ncid ! netcdf id - type(var_desc_t) :: vardesc ! variable descriptor - character(len=256) :: varname ! variable name - character(len=256) :: locfn ! local file name - logical :: readvar ! read variable in or not - integer , allocatable :: idata2d(:,:) - character(len=32) :: subname = 'surfrd_get_globmask' ! subroutine name -!----------------------------------------------------------------------- - - if (filename == ' ') then - mask(:) = 1 - RETURN - end if - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun() - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions and if grid file is 2d or 1d - - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - if (masterproc) then - write(iulog,*)'lat/lon grid flag (isgrid2d) is ',isgrid2d - end if - - allocate(mask(ns)) - mask(:) = 1 - - if (isgrid2d) then - allocate(idata2d(ni,nj)) - idata2d(:,:) = 1 - call ncd_io(ncid=ncid, varname='LANDMASK', data=idata2d, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=idata2d, flag='read', readvar=readvar) - end if - if (readvar) then - do j = 1,nj - do i = 1,ni - n = (j-1)*ni + i - mask(n) = idata2d(i,j) - enddo - enddo - end if - deallocate(idata2d) - else - call ncd_io(ncid=ncid, varname='LANDMASK', data=mask, flag='read', readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', data=mask, flag='read', readvar=readvar) - end if - end if - if (.not. readvar) call endrun( trim(subname)//' ERROR: landmask not on fatmlndfrc file' ) - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_globmask - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_get_grid -! -! !INTERFACE: - subroutine surfrd_get_grid(ldomain, filename, glcfilename) -! -! !DESCRIPTION: -! THIS IS CALLED AFTER THE DOMAIN DECOMPOSITION HAS BEEN CREATED -! Read the surface dataset grid related information: -! o real latitude of grid cell (degrees) -! o real longitude of grid cell (degrees) -! -! !USES: - use clm_varcon, only : spval, re - use domainMod , only : domain_type, domain_init, domain_clean, lon1d, lat1d - use decompMod , only : get_proc_bounds - use fileutils , only : getfil -! -! !ARGUMENTS: - implicit none - type(domain_type),intent(inout) :: ldomain ! domain to init - character(len=*) ,intent(in) :: filename ! grid filename - character(len=*) ,optional, intent(in) :: glcfilename ! glc mask filename -! -! !CALLED FROM: -! subroutine surfrd in this module -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - type(file_desc_t) :: ncid ! netcdf id - type(file_desc_t) :: ncidg ! netCDF id for glcmask - type(var_desc_t) :: vardesc ! variable descriptor - integer :: beg ! local beg index - integer :: end ! local end index - integer :: ni,nj,ns ! size of grid on file - integer :: dimid,varid ! netCDF id's - integer :: start(1), count(1) ! 1d lat/lon array sections - integer :: ier,ret ! error status - logical :: readvar ! true => variable is on input file - logical :: isgrid2d ! true => file is 2d lat/lon - logical :: istype_domain ! true => input file is of type domain - real(r8), allocatable :: rdata2d(:,:) ! temporary - character(len=16) :: vname ! temporary - character(len=256):: locfn ! local file name - integer :: n ! indices - real(r8):: eps = 1.0e-12_r8 ! lat/lon error tolerance - character(len=32) :: subname = 'surfrd_get_grid' ! subroutine name -!----------------------------------------------------------------------- - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun() - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Determine dimensions - - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - - ! Determine isgrid2d flag for domain - - call get_proc_bounds(beg, end) - call domain_init(ldomain, isgrid2d=isgrid2d, ni=ni, nj=nj, nbeg=beg, nend=end) - ! Determine type of file - old style grid file or new style domain file - - call check_var(ncid=ncid, varname='LONGXY', vardesc=vardesc, readvar=readvar) - if (readvar) istype_domain = .false. - - call check_var(ncid=ncid, varname='xc', vardesc=vardesc, readvar=readvar) - if (readvar) istype_domain = .true. - - ! Read in area, lon, lat - - if (istype_domain) then - call ncd_io(ncid=ncid, varname= 'area', flag='read', data=ldomain%area, & - dim1name=grlnd, readvar=readvar) - ! convert from radians**2 to km**2 - ldomain%area = ldomain%area * (re**2) - if (.not. readvar) call endrun( trim(subname)//' ERROR: area NOT on file' ) - - call ncd_io(ncid=ncid, varname= 'xc', flag='read', data=ldomain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: xc NOT on file' ) - - call ncd_io(ncid=ncid, varname= 'yc', flag='read', data=ldomain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: yc NOT on file' ) - else - call ncd_io(ncid=ncid, varname= 'AREA', flag='read', data=ldomain%area, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: AREA NOT on file' ) - - call ncd_io(ncid=ncid, varname= 'LONGXY', flag='read', data=ldomain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: LONGXY NOT on file' ) - - call ncd_io(ncid=ncid, varname= 'LATIXY', flag='read', data=ldomain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: LATIXY NOT on file' ) - end if - - if (isgrid2d) then - allocate(rdata2d(ni,nj), lon1d(ni), lat1d(nj)) - if (istype_domain) then - vname = 'xc' - else - vname = 'LONGXY' - end if - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lon1d(:) = rdata2d(:,1) - if (istype_domain) then - vname = 'yc' - else - vname = 'LATIXY' - end if - call ncd_io(ncid=ncid, varname=trim(vname), data=rdata2d, flag='read', readvar=readvar) - lat1d(:) = rdata2d(1,:) - deallocate(rdata2d) - end if - - ! Check lat limited to -90,90 - - if (minval(ldomain%latc) < -90.0_r8 .or. & - maxval(ldomain%latc) > 90.0_r8) then - write(iulog,*) trim(subname),' WARNING: lat/lon min/max is ', & - minval(ldomain%latc),maxval(ldomain%latc) - ! call endrun( trim(subname)//' ERROR: lat is outside [-90,90]' ) - ! write(iulog,*) trim(subname),' Limiting lat/lon to [-90/90] from ', & - ! minval(domain%latc),maxval(domain%latc) - ! where (ldomain%latc < -90.0_r8) ldomain%latc = -90.0_r8 - ! where (ldomain%latc > 90.0_r8) ldomain%latc = 90.0_r8 - endif - - call ncd_io(ncid=ncid, varname='LANDMASK', flag='read', data=ldomain%mask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='mask', flag='read', data=ldomain%mask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( trim(subname)//' ERROR: LANDMASK NOT on fracdata file' ) - end if - end if - - call ncd_io(ncid=ncid, varname='LANDFRAC', flag='read', data=ldomain%frac, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call ncd_io(ncid=ncid, varname='frac', flag='read', data=ldomain%frac, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) then - call endrun( trim(subname)//' ERROR: LANDFRAC NOT on fracdata file' ) - end if - end if - - call ncd_pio_closefile(ncid) - - if (present(glcfilename)) then - if (masterproc) then - if (glcfilename == ' ') then - write(iulog,*) trim(subname),' ERROR: glc filename must be specified ' - call endrun() - endif - end if - call getfil( glcfilename, locfn, 0 ) - call ncd_pio_openfile (ncidg, trim(locfn), 0) - - ldomain%glcmask(:) = 0 - call ncd_io(ncid=ncidg, varname='GLCMASK', flag='read', data=ldomain%glcmask, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: GLCMASK NOT in file' ) - - ! Make sure the glc mask is a subset of the land mask - do n = beg,end - if (ldomain%glcmask(n)==1 .and. ldomain%mask(n)==0) then - write(iulog,*)trim(subname),& - 'initialize1: landmask/glcmask mismatch' - write(iulog,*)trim(subname),& - 'glc requires input where landmask = 0, gridcell index', n - call endrun() - endif - enddo - call ncd_pio_closefile(ncidg) - endif ! present(glcfilename) - - end subroutine surfrd_get_grid - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_get_topo -! -! !INTERFACE: - subroutine surfrd_get_topo(domain,filename) -! -! !DESCRIPTION: -! Read the topo dataset grid related information: -! Assume domain has already been initialized and read -! -! !USES: - use domainMod , only : domain_type - use fileutils , only : getfil -! -! !ARGUMENTS: - implicit none - type(domain_type),intent(inout) :: domain ! domain to init - character(len=*) ,intent(in) :: filename ! grid filename -! -! !CALLED FROM: -! subroutine initialize -! -! !REVISION HISTORY: -! Created by T Craig -! -! -! !LOCAL VARIABLES: -!EOP - type(file_desc_t) :: ncid ! netcdf file id - integer :: n ! indices - integer :: ni,nj,ns ! size of grid on file - integer :: dimid,varid ! netCDF id's - integer :: ier ! error status - real(r8):: eps = 1.0e-12_r8 ! lat/lon error tolerance - integer :: beg,end ! local beg,end indices - logical :: isgrid2d ! true => file is 2d lat/lon - real(r8),pointer :: lonc(:),latc(:) ! local lat/lon - character(len=256) :: locfn ! local file name - logical :: readvar ! is variable on file - character(len=32) :: subname = 'surfrd_get_topo' ! subroutine name -!----------------------------------------------------------------------- - - if (masterproc) then - if (filename == ' ') then - write(iulog,*) trim(subname),' ERROR: filename must be specified ' - call endrun() - else - write(iulog,*) 'Attempting to read lnd topo from flndtopo ',trim(filename) - endif - end if - - call getfil( filename, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - - if (domain%ns /= ns) then - write(iulog,*) trim(subname),' ERROR: topo file mismatch ns',& - domain%ns,ns - call endrun() - endif - - beg = domain%nbeg - end = domain%nend - - allocate(latc(beg:end),lonc(beg:end)) - - call ncd_io(ncid=ncid, varname='LONGXY', flag='read', data=lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: LONGXY NOT on topodata file' ) - - call ncd_io(ncid=ncid, varname='LATIXY', flag='read', data=latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: LATIXY NOT on topodata file' ) - - do n = beg,end - if (abs(latc(n)-domain%latc(n)) > eps .or. & - abs(lonc(n)-domain%lonc(n)) > eps) then - write(iulog,*) trim(subname),' ERROR: topo file mismatch lat,lon',latc(n),& - domain%latc(n),lonc(n),domain%lonc(n),eps - call endrun() - endif - enddo - - call ncd_io(ncid=ncid, varname='TOPO', flag='read', data=domain%topo, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: TOPO NOT on topodata file' ) - - deallocate(latc,lonc) - - call ncd_pio_closefile(ncid) - - end subroutine surfrd_get_topo - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_get_data -! -! !INTERFACE: - subroutine surfrd_get_data (ldomain, lfsurdat) -! -! !DESCRIPTION: -! Read the surface dataset and create subgrid weights. -! The model's surface dataset recognizes 6 basic land cover types within a grid -! cell: lake, wetland, urban, glacier, glacier_mec and vegetated. The vegetated -! portion of the grid cell is comprised of up to [maxpatch_pft] PFTs. These -! subgrid patches are read in explicitly for each grid cell. This is in -! contrast to LSMv1, where the PFTs were built implicitly from biome types. -! o real latitude of grid cell (degrees) -! o real longitude of grid cell (degrees) -! o integer surface type: 0 = ocean or 1 = land -! o integer soil color (1 to 20) for use with soil albedos -! o real soil texture, %sand, for thermal and hydraulic properties -! o real soil texture, %clay, for thermal and hydraulic properties -! o real % of cell covered by lake for use as subgrid patch -! o real % of cell covered by wetland for use as subgrid patch -! o real % of cell that is urban for use as subgrid patch -! o real % of cell that is glacier for use as subgrid patch -! o real % of cell that is glacier_mec for use as subgrid patch -! o integer PFTs -! o real % abundance PFTs (as a percent of vegetated area) -! -! !USES: - use clm_varctl , only : allocate_all_vegpfts, create_crop_landunit - use pftvarcon , only : noveg - use fileutils , only : getfil - use domainMod , only : domain_type, domain_init, domain_clean -! -! !ARGUMENTS: - implicit none - type(domain_type),intent(in) :: ldomain ! land domain associated with wtxy - character(len=*), intent(in) :: lfsurdat ! surface dataset filename -! -! !CALLED FROM: -! subroutine initialize in module initializeMod -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein, Sam Levis and Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - type(var_desc_t) :: vardesc ! pio variable descriptor - type(domain_type) :: surfdata_domain ! local domain associated with surface dataset - character(len=256):: locfn ! local file name - integer :: n ! loop indices - integer :: ni,nj,ns ! domain sizes - character(len=16) :: lon_var, lat_var ! names of lat/lon on dataset - logical :: readvar ! true => variable is on dataset - real(r8) :: rmaxlon,rmaxlat ! local min/max vars - type(file_desc_t) :: ncid ! netcdf id - integer :: begg,endg ! beg,end gridcell indices - logical :: istype_domain ! true => input file is of type domain - logical :: isgrid2d ! true => intut grid is 2d - character(len=32) :: subname = 'surfrd_get_data' ! subroutine name -!----------------------------------------------------------------------- - - if (masterproc) then - write(iulog,*) 'Attempting to read surface boundary data .....' - if (lfsurdat == ' ') then - write(iulog,*)'lfsurdat must be specified'; call endrun() - endif - endif - - call get_proc_bounds(begg,endg) - allocate(pctspec(begg:endg)) - - vegxy(:,:) = noveg - wtxy(:,:) = 0._r8 - pctspec(:) = 0._r8 - if (allocated(topoxy)) topoxy(:,:) = 0._r8 - - ! Read surface data - - call getfil( lfsurdat, locfn, 0 ) - call ncd_pio_openfile (ncid, trim(locfn), 0) - - ! Read in pft mask - this variable is only on the surface dataset - but not - ! on the domain dataset - - call ncd_io(ncid=ncid, varname= 'PFTDATA_MASK', flag='read', data=ldomain%pftm, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: pftm NOT on surface dataset' ) - - ! Check if fsurdat grid is "close" to fatmlndfrc grid, exit if lats/lon > 0.001 - - call check_var(ncid=ncid, varname='xc', vardesc=vardesc, readvar=readvar) - if (readvar) then - istype_domain = .true. - else - call check_var(ncid=ncid, varname='LONGXY', vardesc=vardesc, readvar=readvar) - if (readvar) then - istype_domain = .false. - else - call endrun( trim(subname)//' ERROR: unknown domain type') - end if - end if - if (istype_domain) then - lon_var = 'xc' - lat_var = 'yc' - else - lon_var = 'LONGXY' - lat_var = 'LATIXY' - end if - if ( masterproc )then - write(iulog,*) trim(subname),' lon_var = ',trim(lon_var),' lat_var =',trim(lat_var) - end if - - call ncd_inqfdims(ncid, isgrid2d, ni, nj, ns) - call domain_init(surfdata_domain, isgrid2d, ni, nj, begg, endg, clmlevel=grlnd) - - call ncd_io(ncid=ncid, varname=lon_var, flag='read', data=surfdata_domain%lonc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: lon var NOT on surface dataset' ) - - call ncd_io(ncid=ncid, varname=lat_var, flag='read', data=surfdata_domain%latc, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: lat var NOT on surface dataset' ) - - rmaxlon = 0.0_r8 - rmaxlat = 0.0_r8 - do n = begg,endg - if (ldomain%lonc(n)-surfdata_domain%lonc(n) > 300.) then - rmaxlon = max(rmaxlon,abs(ldomain%lonc(n)-surfdata_domain%lonc(n)-360._r8)) - elseif (ldomain%lonc(n)-surfdata_domain%lonc(n) < -300.) then - rmaxlon = max(rmaxlon,abs(ldomain%lonc(n)-surfdata_domain%lonc(n)+360._r8)) - else - rmaxlon = max(rmaxlon,abs(ldomain%lonc(n)-surfdata_domain%lonc(n))) - endif - rmaxlat = max(rmaxlat,abs(ldomain%latc(n)-surfdata_domain%latc(n))) - enddo - if (rmaxlon > 0.001_r8 .or. rmaxlat > 0.001_r8) then - write(iulog,*) trim(subname)//': surfdata/fatmgrid lon/lat mismatch error',& - rmaxlon,rmaxlat - call endrun(trim(subname)) - end if - call domain_clean(surfdata_domain) - - ! Obtain special landunit info - - call surfrd_wtxy_special(ncid, ldomain%ns) - - ! Obtain vegetated landunit info - - if (use_cndv) then - if (create_crop_landunit) then ! CNDV means allocate_all_vegpfts = .true. - call surfrd_wtxy_veg_all(ncid, ldomain%ns, ldomain%pftm) - end if - call surfrd_wtxy_veg_dgvm() - else - if (allocate_all_vegpfts) then - call surfrd_wtxy_veg_all(ncid, ldomain%ns, ldomain%pftm) - else - call endrun (trim(subname) // 'only allocate_all_vegpfts is supported') - end if - end if - - call ncd_pio_closefile(ncid) - - if ( masterproc )then - write(iulog,*) 'Successfully read surface boundary data' - write(iulog,*) - end if - - end subroutine surfrd_get_data - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_wtxy_special -! -! !INTERFACE: - subroutine surfrd_wtxy_special(ncid, ns) -! -! !DESCRIPTION: -! Determine weight with respect to gridcell of all special "pfts" as well -! as soil color and percent sand and clay -! -! !USES: - use pftvarcon , only : noveg - use UrbanInputMod , only : urbinp - use clm_varpar , only : maxpatch_glcmec -! -! !ARGUMENTS: - implicit none - type(file_desc_t), intent(inout) :: ncid ! netcdf id - integer , intent(in) :: ns ! domain size -! -! !CALLED FROM: -! subroutine surfrd in this module -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein, Sam Levis and Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - integer :: n,nl,nurb,g ! indices - integer :: begg,endg ! gcell beg/end - integer :: dimid,varid ! netCDF id's - real(r8) :: nlevsoidata(nlevsoi) - logical :: found ! temporary for error check - integer :: nindx ! temporary for error check - integer :: ier ! error status - integer :: nlev ! level - integer :: npatch - logical :: readvar - real(r8),pointer :: pctgla(:) ! percent of grid cell is glacier - real(r8),pointer :: pctlak(:) ! percent of grid cell is lake - real(r8),pointer :: pctwet(:) ! percent of grid cell is wetland - real(r8),pointer :: pcturb(:) ! percent of grid cell is urbanized - real(r8),pointer :: pctglc_mec(:,:) ! percent of grid cell is glacier_mec (in each elev class) - real(r8),pointer :: pctglc_mec_tot(:) ! percent of grid cell is glacier (sum over classes) - real(r8),pointer :: topoglc_mec(:,:) ! surface elevation in each elev class - character(len=32) :: subname = 'surfrd_wtxy_special' ! subroutine name - real(r8) closelat,closelon -!!----------------------------------------------------------------------- - - call get_proc_bounds(begg,endg) - - allocate(pctgla(begg:endg),pctlak(begg:endg)) - allocate(pctwet(begg:endg),pcturb(begg:endg)) - if (create_glacier_mec_landunit) then - allocate(pctglc_mec(begg:endg,maxpatch_glcmec)) - allocate(pctglc_mec_tot(begg:endg)) - allocate(topoglc_mec(begg:endg,maxpatch_glcmec)) - allocate(glc_topomax(0:maxpatch_glcmec)) - endif - - call check_dim(ncid, 'nlevsoi', nlevsoi) - - ! Obtain non-grid surface properties of surface dataset other than percent pft - - call ncd_io(ncid=ncid, varname='PCT_WETLAND', flag='read', data=pctwet, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_WETLAND NOT on surfdata file' ) - - call ncd_io(ncid=ncid, varname='PCT_LAKE' , flag='read', data=pctlak, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_LAKE NOT on surfdata file' ) - - call ncd_io(ncid=ncid, varname='PCT_GLACIER', flag='read', data=pctgla, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_GLACIER NOT on surfdata file' ) - - call ncd_io(ncid=ncid, varname='PCT_URBAN' , flag='read', data=pcturb, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_URBAN NOT on surfdata file' ) - - if (create_glacier_mec_landunit) then ! call ncd_io_gs_int2d - - call check_dim(ncid, 'nglcec', maxpatch_glcmec ) - call check_dim(ncid, 'nglcecp1', maxpatch_glcmec+1 ) - - call ncd_io(ncid=ncid, varname='GLC_MEC', flag='read', data=glc_topomax, & - readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//'ERROR: GLC_MEC was NOT on the input surfdata file' ) - - call ncd_io(ncid=ncid, varname='PCT_GLC_MEC', flag='read', data=pctglc_mec, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_GLC_MEC NOT on surfdata file' ) - - call ncd_io(ncid=ncid, varname='TOPO_GLC_MEC', flag='read', data=topoglc_mec, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: TOPO_GLC_MEC NOT on surfdata file' ) - - pctglc_mec_tot(:) = 0._r8 - do n = 1, maxpatch_glcmec - do nl = begg,endg - pctglc_mec_tot(nl) = pctglc_mec_tot(nl) + pctglc_mec(nl,n) - enddo - enddo - - ! Make sure sum of pctglc_mec = pctgla (approximately), then correct pctglc_mec so - ! that its sum more exactly equals pctgla, then zero out pctgla - ! - ! WJS (9-28-12): The reason for the correction piece of this is: in the surface - ! dataset, pctgla underwent various minor corrections that make it the trusted - ! value (as opposed to sum(pctglc_mec). sum(pctglc_mec) can differ from pctgla by - ! single precision roundoff. This difference can cause problems later (e.g., in the - ! consistency check in pftdynMod), so we do this correction here. It might be - ! better to do this correction in mksurfdata_map, but because of time constraints, - ! which make me unable to recreate surface datasets, I have to do it here instead - ! (and there are arguments for putting it here anyway). - - do nl = begg,endg - ! We need to use a fairly high threshold for equality (2.0e-5) because pctgla - ! and pctglc_mec are computed using single precision inputs. Note that this - ! threshold agrees with the threshold in the error checks in mkglcmecMod: - ! mkglcmec in mksurfdata_map. - if (abs(pctgla(nl) - pctglc_mec_tot(nl)) > 2.0e-5) then - write(iulog,*) ' ' - write(iulog,*) 'surfrd error: pctgla not equal to sum of pctglc_mec for nl=', nl - write(iulog,*) 'pctgla =', pctgla(nl) - write(iulog,*) 'pctglc_mec_tot =', pctglc_mec_tot(nl) - call endrun() - endif - - ! Correct the remaining minor differences in pctglc_mec so sum more exactly - ! equals pctglc (see notes above for justification) - if (pctglc_mec_tot(nl) > 0.0_r8) then - pctglc_mec(nl,:) = pctglc_mec(nl,:) * pctgla(nl)/pctglc_mec_tot(nl) - end if - - ! Now recompute pctglc_mec_tot, and confirm that we are now much closer to pctgla - pctglc_mec_tot(nl) = 0._r8 - do n = 1, maxpatch_glcmec - pctglc_mec_tot(nl) = pctglc_mec_tot(nl) + pctglc_mec(nl,n) - end do - - if (abs(pctgla(nl) - pctglc_mec_tot(nl)) > 1.0e-13) then - write(iulog,*) ' ' - write(iulog,*) 'surfrd error: after correction, pctgla not equal to sum of pctglc_mec for nl=', nl - write(iulog,*) 'pctgla =', pctgla(nl) - write(iulog,*) 'pctglc_mec_tot =', pctglc_mec_tot(nl) - call endrun() - endif - - ! Finally, zero out pctgla - pctgla(nl) = 0._r8 - enddo - - ! If pctglc_mec_tot is very close to 100%, round to 100% - - do nl = begg,endg - ! The inequality here ( <= 2.0e-5 ) is designed to be the complement of the - ! above check that makes sure pctglc_mec_tot is close to pctgla: so if pctglc= - ! 100 (exactly), then exactly one of these conditionals will be triggered. - ! Update 9-28-12: Now that there is a rescaling of pctglc_mec to bring it more - ! in line with pctgla, we could probably decrease this tolerance again (the - ! point about exactly one of these conditionals being triggered no longer holds) - ! - or perhaps even get rid of this whole block of code. But I'm keeping this as - ! is for now because that's how I tested it, and I don't think it will hurt - ! anything to use this larger tolerance. - if (abs(pctglc_mec_tot(nl) - 100._r8) <= 2.0e-5) then - pctglc_mec(nl,:) = pctglc_mec(nl,:) * 100._r8 / pctglc_mec_tot(nl) - pctglc_mec_tot(nl) = 100._r8 - endif - enddo - - pctspec = pctwet + pctlak + pcturb + pctglc_mec_tot - - if ( masterproc ) write(iulog,*) ' elevation limits = ', glc_topomax - - else - - pctspec = pctwet + pctlak + pcturb + pctgla - - endif - - ! Error check: glacier, lake, wetland, urban sum must be less than 100 - - found = .false. - do nl = begg,endg - if (pctspec(nl) > 100._r8+1.e-04_r8) then - found = .true. - nindx = nl - exit - end if - if (found) exit - end do - if ( found ) then - write(iulog,*)'surfrd error: PFT cover>100 for nl=',nindx - call endrun() - end if - - ! Determine veg and wtxy for special landunits - - do nl = begg,endg - - vegxy(nl,npatch_lake) = noveg - wtxy(nl,npatch_lake) = pctlak(nl)/100._r8 - - vegxy(nl,npatch_wet) = noveg - wtxy(nl,npatch_wet) = pctwet(nl)/100._r8 - - vegxy(nl,npatch_glacier)= noveg - wtxy(nl,npatch_glacier) = pctgla(nl)/100._r8 - - ! Initialize urban weights - - do nurb = npatch_urban, npatch_lake-1 - vegxy(nl,nurb) = noveg - wtxy(nl,nurb) = pcturb(nl) / 100._r8 - end do - if ( pcturb(nl) > 0.0_r8 )then - wtxy(nl,npatch_urban) = wtxy(nl,npatch_urban)*urbinp%wtlunit_roof(nl) - wtxy(nl,npatch_urban+1) = wtxy(nl,npatch_urban+1)*(1 - urbinp%wtlunit_roof(nl))/3 - wtxy(nl,npatch_urban+2) = wtxy(nl,npatch_urban+2)*(1 - urbinp%wtlunit_roof(nl))/3 - wtxy(nl,npatch_urban+3) = wtxy(nl,npatch_urban+3)*(1 - urbinp%wtlunit_roof(nl))/3 * (1.-urbinp%wtroad_perv(nl)) - wtxy(nl,npatch_urban+4) = wtxy(nl,npatch_urban+4)*(1 - urbinp%wtlunit_roof(nl))/3 * urbinp%wtroad_perv(nl) - end if - - end do - - ! Check to make sure we have valid urban data for each urban patch - - found = .false. - do nl = begg,endg - if ( pcturb(nl) > 0.0_r8 )then - if (urbinp%canyon_hwr(nl) .le. 0._r8 .or. & - urbinp%em_improad(nl) .le. 0._r8 .or. & - urbinp%em_perroad(nl) .le. 0._r8 .or. & - urbinp%em_roof(nl) .le. 0._r8 .or. & - urbinp%em_wall(nl) .le. 0._r8 .or. & - urbinp%ht_roof(nl) .le. 0._r8 .or. & - urbinp%thick_roof(nl) .le. 0._r8 .or. & - urbinp%thick_wall(nl) .le. 0._r8 .or. & - urbinp%t_building_max(nl) .le. 0._r8 .or. & - urbinp%t_building_min(nl) .le. 0._r8 .or. & - urbinp%wind_hgt_canyon(nl) .le. 0._r8 .or. & - urbinp%wtlunit_roof(nl) .le. 0._r8 .or. & - urbinp%wtroad_perv(nl) .le. 0._r8 .or. & - any(urbinp%alb_improad_dir(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_improad_dif(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_perroad_dir(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_perroad_dif(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_roof_dir(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_roof_dif(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_wall_dir(nl,:) .le. 0._r8) .or. & - any(urbinp%alb_wall_dif(nl,:) .le. 0._r8) .or. & - any(urbinp%tk_roof(nl,:) .le. 0._r8) .or. & - any(urbinp%tk_wall(nl,:) .le. 0._r8) .or. & - any(urbinp%cv_roof(nl,:) .le. 0._r8) .or. & - any(urbinp%cv_wall(nl,:) .le. 0._r8)) then - found = .true. - nindx = nl - exit - else - if (urbinp%nlev_improad(nl) .gt. 0) then - nlev = urbinp%nlev_improad(nl) - if (any(urbinp%tk_improad(nl,1:nlev) .le. 0._r8) .or. & - any(urbinp%cv_improad(nl,1:nlev) .le. 0._r8)) then - found = .true. - nindx = nl - exit - end if - end if - end if - if (found) exit - end if - end do - if ( found ) then - write(iulog,*)'surfrd error: no valid urban data for nl=',nindx - write(iulog,*)'canyon_hwr: ',urbinp%canyon_hwr(nindx) - write(iulog,*)'em_improad: ',urbinp%em_improad(nindx) - write(iulog,*)'em_perroad: ',urbinp%em_perroad(nindx) - write(iulog,*)'em_roof: ',urbinp%em_roof(nindx) - write(iulog,*)'em_wall: ',urbinp%em_wall(nindx) - write(iulog,*)'ht_roof: ',urbinp%ht_roof(nindx) - write(iulog,*)'thick_roof: ',urbinp%thick_roof(nindx) - write(iulog,*)'thick_wall: ',urbinp%thick_wall(nindx) - write(iulog,*)'t_building_max: ',urbinp%t_building_max(nindx) - write(iulog,*)'t_building_min: ',urbinp%t_building_min(nindx) - write(iulog,*)'wind_hgt_canyon: ',urbinp%wind_hgt_canyon(nindx) - write(iulog,*)'wtlunit_roof: ',urbinp%wtlunit_roof(nindx) - write(iulog,*)'wtroad_perv: ',urbinp%wtroad_perv(nindx) - write(iulog,*)'alb_improad_dir: ',urbinp%alb_improad_dir(nindx,:) - write(iulog,*)'alb_improad_dif: ',urbinp%alb_improad_dif(nindx,:) - write(iulog,*)'alb_perroad_dir: ',urbinp%alb_perroad_dir(nindx,:) - write(iulog,*)'alb_perroad_dif: ',urbinp%alb_perroad_dif(nindx,:) - write(iulog,*)'alb_roof_dir: ',urbinp%alb_roof_dir(nindx,:) - write(iulog,*)'alb_roof_dif: ',urbinp%alb_roof_dif(nindx,:) - write(iulog,*)'alb_wall_dir: ',urbinp%alb_wall_dir(nindx,:) - write(iulog,*)'alb_wall_dif: ',urbinp%alb_wall_dif(nindx,:) - write(iulog,*)'tk_roof: ',urbinp%tk_roof(nindx,:) - write(iulog,*)'tk_wall: ',urbinp%tk_wall(nindx,:) - write(iulog,*)'cv_roof: ',urbinp%cv_roof(nindx,:) - write(iulog,*)'cv_wall: ',urbinp%cv_wall(nindx,:) - if (urbinp%nlev_improad(nindx) .gt. 0) then - nlev = urbinp%nlev_improad(nindx) - write(iulog,*)'tk_improad: ',urbinp%tk_improad(nindx,1:nlev) - write(iulog,*)'cv_improad: ',urbinp%cv_improad(nindx,1:nlev) - end if - call endrun() - end if - - ! Initialize glacier_mec weights - - if (create_glacier_mec_landunit) then - do n = 1, maxpatch_glcmec - npatch = npatch_glacier_mec - maxpatch_glcmec + n - do nl = begg, endg - vegxy (nl,npatch) = noveg - wtxy (nl,npatch) = pctglc_mec(nl,n)/100._r8 - topoxy(nl,npatch) = topoglc_mec(nl,n) - enddo ! nl - enddo ! maxpatch_glcmec - deallocate(pctglc_mec, pctglc_mec_tot, topoglc_mec) - endif ! create_glacier_mec_landunit - - deallocate(pctgla,pctlak,pctwet,pcturb) - - end subroutine surfrd_wtxy_special - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_wtxy_veg_all -! -! !INTERFACE: - subroutine surfrd_wtxy_veg_all(ncid, ns, pftm) -! -! !DESCRIPTION: -! Determine wtxy and veg arrays for non-dynamic landuse mode -! -! !USES: - use clm_varctl , only : create_crop_landunit - use pftvarcon , only : nirrig, npcropmin - use spmdMod , only : mpicom, MPI_LOGICAL, MPI_LOR -! -! !ARGUMENTS: - implicit none - type(file_desc_t),intent(inout) :: ncid ! netcdf id - integer ,intent(in) :: ns ! domain size - integer ,pointer :: pftm(:) -! -! !CALLED FROM: -! subroutine surfrd in this module -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein, Sam Levis and Gordon Bonan -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m,mp7,mp8,mp11,n,nl ! indices - integer :: begg,endg ! beg/end gcell index - integer :: dimid,varid ! netCDF id's - integer :: ier ! error status - logical :: readvar ! is variable on dataset - real(r8) :: sumpct ! sum of %pft over maxpatch_pft - real(r8),allocatable :: pctpft(:,:) ! percent of vegetated gridcell area for PFTs - real(r8),pointer :: arrayl(:,:) ! local array - real(r8) :: numpftp1data(0:numpft) - logical :: crop = .false. ! if crop data on this section of file - character(len=32) :: subname = 'surfrd_wtxy_veg_all' ! subroutine name -!----------------------------------------------------------------------- - - call get_proc_bounds(begg,endg) - allocate(pctpft(begg:endg,0:numpft)) - - call check_dim(ncid, 'lsmpft', numpft+1) - - allocate(arrayl(begg:endg,0:numpft)) - call ncd_io(ncid=ncid, varname='PCT_PFT', flag='read', data=arrayl, & - dim1name=grlnd, readvar=readvar) - if (.not. readvar) call endrun( trim(subname)//' ERROR: PCT_PFT NOT on surfdata file' ) - pctpft(begg:endg,0:numpft) = arrayl(begg:endg,0:numpft) - deallocate(arrayl) - - do nl = begg,endg - if (pftm(nl) >= 0) then - - ! Error check: make sure PFTs sum to 100% cover for vegetated landunit - ! (convert pctpft from percent with respect to gridcel to percent with - ! respect to vegetated landunit) - - if (pctspec(nl) < 100._r8) then - sumpct = 0._r8 - do m = 0,numpft - sumpct = sumpct + pctpft(nl,m) * 100._r8/(100._r8-pctspec(nl)) - if (m == nirrig .and. .not. create_crop_landunit) then - if (pctpft(nl,m) > 0._r8) then - call endrun( trim(subname)//' ERROR surfrdMod: irrigated crop'// & - ' PFT requires create_crop_landunit=.true.' ) - end if - end if - end do - if (abs(sumpct - 100._r8) > 0.1e-4_r8) then - write(iulog,*) trim(subname)//' ERROR: sum(pct) over numpft+1 is not = 100.' - write(iulog,*) sumpct, sumpct-100._r8, nl - call endrun() - end if - if (sumpct < -0.000001_r8) then - write(iulog,*) trim(subname)//' ERROR: sum(pct) over numpft+1 is < 0.' - write(iulog,*) sumpct, nl - call endrun() - end if - do m = npcropmin, numpft - if ( pctpft(nl,m) > 0.0_r8 ) crop = .true. - end do - end if - - ! Set weight of each pft wrt gridcell (note that maxpatch_pft = numpft+1 here) - - do m = 1,numpft+1 - vegxy(nl,m) = m - 1 ! 0 (bare ground) to numpft - wtxy(nl,m) = pctpft(nl,m-1) / 100._r8 - end do - - end if - end do - call mpi_allreduce(crop,crop_prog,1,MPI_LOGICAL,MPI_LOR,mpicom,ier) - if (ier /= 0) then - write(iulog,*) trim(subname)//' mpi_allreduce error = ',ier - call endrun( trim(subname)//' ERROR: error in reduce of crop_prog' ) - endif - if (crop_prog .and. .not. create_crop_landunit) then - call endrun( trim(subname)//' ERROR: prognostic crop '// & - 'PFTs requires create_crop_landunit=.true.' ) - end if - - deallocate(pctpft) - - end subroutine surfrd_wtxy_veg_all - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: surfrd_wtxy_veg_dgvm -! -! !INTERFACE: - subroutine surfrd_wtxy_veg_dgvm() -! -! !DESCRIPTION: -! Determine wtxy and vegxy for CNDV mode. -! -! !USES: - use pftvarcon , only : noveg, crop - use clm_varctl, only : create_crop_landunit -! -! !ARGUMENTS: - implicit none -! -! !CALLED FROM: -! subroutine surfrd in this module -! -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein 12/04 -! -! -! !LOCAL VARIABLES: -!EOP - integer :: m,nl ! indices - integer :: begg,endg ! beg/end gcell index -!----------------------------------------------------------------------- - - call get_proc_bounds(begg,endg) - do nl = begg,endg - do m = 1, maxpatch_pft ! CNDV means allocate_all_vegpfts = .true. - if (create_crop_landunit) then ! been through surfrd_wtxy_veg_all - if (crop(m-1) == 0) then ! so update natural vegetation only - wtxy(nl,m) = 0._r8 ! crops should have values >= 0. - end if - else ! not been through surfrd_wtxy_veg_all - wtxy(nl,m) = 0._r8 ! so update all vegetation - vegxy(nl,m) = m - 1 ! 0 (bare ground) to maxpatch_pft-1 (= 16) - end if - end do - ! bare ground weights - wtxy(nl,noveg+1) = max(0._r8, 1._r8 - sum(wtxy(nl,:))) - if (abs(sum(wtxy(nl,:)) - 1._r8) > 1.e-5_r8) then - write(iulog,*) 'all wtxy =', wtxy(nl,:) - call endrun() - end if ! error check - end do - - end subroutine surfrd_wtxy_veg_dgvm - -end module surfrdMod diff --git a/manage_externals/test/.coveragerc b/test/.coveragerc similarity index 100% rename from manage_externals/test/.coveragerc rename to test/.coveragerc diff --git a/manage_externals/test/.gitignore b/test/.gitignore similarity index 100% rename from manage_externals/test/.gitignore rename to test/.gitignore diff --git a/manage_externals/test/.pylint.rc b/test/.pylint.rc similarity index 100% rename from manage_externals/test/.pylint.rc rename to test/.pylint.rc diff --git a/manage_externals/test/Makefile b/test/Makefile similarity index 100% rename from manage_externals/test/Makefile rename to test/Makefile diff --git a/manage_externals/test/README.md b/test/README.md similarity index 100% rename from manage_externals/test/README.md rename to test/README.md diff --git a/manage_externals/test/doc/.gitignore b/test/doc/.gitignore similarity index 100% rename from manage_externals/test/doc/.gitignore rename to test/doc/.gitignore diff --git a/manage_externals/test/doc/Makefile b/test/doc/Makefile similarity index 100% rename from manage_externals/test/doc/Makefile rename to test/doc/Makefile diff --git a/manage_externals/test/doc/conf.py b/test/doc/conf.py similarity index 100% rename from manage_externals/test/doc/conf.py rename to test/doc/conf.py diff --git a/manage_externals/test/doc/develop.rst b/test/doc/develop.rst similarity index 100% rename from manage_externals/test/doc/develop.rst rename to test/doc/develop.rst diff --git a/manage_externals/test/doc/index.rst b/test/doc/index.rst similarity index 100% rename from manage_externals/test/doc/index.rst rename to test/doc/index.rst diff --git a/manage_externals/test/doc/testing.rst b/test/doc/testing.rst similarity index 100% rename from manage_externals/test/doc/testing.rst rename to test/doc/testing.rst diff --git a/manage_externals/test/repos/container.git/HEAD b/test/repos/container.git/HEAD similarity index 100% rename from manage_externals/test/repos/container.git/HEAD rename to test/repos/container.git/HEAD diff --git a/manage_externals/test/repos/container.git/config b/test/repos/container.git/config similarity index 100% rename from manage_externals/test/repos/container.git/config rename to test/repos/container.git/config diff --git a/manage_externals/test/repos/container.git/description b/test/repos/container.git/description similarity index 100% rename from manage_externals/test/repos/container.git/description rename to test/repos/container.git/description diff --git a/manage_externals/test/repos/container.git/info/exclude b/test/repos/container.git/info/exclude similarity index 100% rename from manage_externals/test/repos/container.git/info/exclude rename to test/repos/container.git/info/exclude diff --git a/manage_externals/test/repos/container.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 b/test/repos/container.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 similarity index 100% rename from manage_externals/test/repos/container.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 rename to test/repos/container.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 diff --git a/manage_externals/test/repos/container.git/objects/71/5b8f3e4afe1802a178e1d603af404ba45d59de b/test/repos/container.git/objects/71/5b8f3e4afe1802a178e1d603af404ba45d59de similarity index 100% rename from manage_externals/test/repos/container.git/objects/71/5b8f3e4afe1802a178e1d603af404ba45d59de rename to test/repos/container.git/objects/71/5b8f3e4afe1802a178e1d603af404ba45d59de diff --git a/manage_externals/test/repos/container.git/objects/b0/f87705e2b9601cb831878f3d51efa78b910d7b b/test/repos/container.git/objects/b0/f87705e2b9601cb831878f3d51efa78b910d7b similarity index 100% rename from manage_externals/test/repos/container.git/objects/b0/f87705e2b9601cb831878f3d51efa78b910d7b rename to test/repos/container.git/objects/b0/f87705e2b9601cb831878f3d51efa78b910d7b diff --git a/manage_externals/test/repos/container.git/objects/f9/e08370a737e941de6f6492e3f427c2ef4c1a03 b/test/repos/container.git/objects/f9/e08370a737e941de6f6492e3f427c2ef4c1a03 similarity index 100% rename from manage_externals/test/repos/container.git/objects/f9/e08370a737e941de6f6492e3f427c2ef4c1a03 rename to test/repos/container.git/objects/f9/e08370a737e941de6f6492e3f427c2ef4c1a03 diff --git a/manage_externals/test/repos/container.git/refs/heads/master b/test/repos/container.git/refs/heads/master similarity index 100% rename from manage_externals/test/repos/container.git/refs/heads/master rename to test/repos/container.git/refs/heads/master diff --git a/manage_externals/test/repos/error/readme.txt b/test/repos/error/readme.txt similarity index 100% rename from manage_externals/test/repos/error/readme.txt rename to test/repos/error/readme.txt diff --git a/manage_externals/test/repos/mixed-cont-ext.git/HEAD b/test/repos/mixed-cont-ext.git/HEAD similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/HEAD rename to test/repos/mixed-cont-ext.git/HEAD diff --git a/manage_externals/test/repos/mixed-cont-ext.git/config b/test/repos/mixed-cont-ext.git/config similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/config rename to test/repos/mixed-cont-ext.git/config diff --git a/manage_externals/test/repos/mixed-cont-ext.git/description b/test/repos/mixed-cont-ext.git/description similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/description rename to test/repos/mixed-cont-ext.git/description diff --git a/manage_externals/test/repos/mixed-cont-ext.git/info/exclude b/test/repos/mixed-cont-ext.git/info/exclude similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/info/exclude rename to test/repos/mixed-cont-ext.git/info/exclude diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/00/437ac2000d5f06fb8a572a01a5bbdae98b17cb b/test/repos/mixed-cont-ext.git/objects/00/437ac2000d5f06fb8a572a01a5bbdae98b17cb similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/00/437ac2000d5f06fb8a572a01a5bbdae98b17cb rename to test/repos/mixed-cont-ext.git/objects/00/437ac2000d5f06fb8a572a01a5bbdae98b17cb diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/01/97458f2dbe5fcd6bc44fa46983be0a30282379 b/test/repos/mixed-cont-ext.git/objects/01/97458f2dbe5fcd6bc44fa46983be0a30282379 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/01/97458f2dbe5fcd6bc44fa46983be0a30282379 rename to test/repos/mixed-cont-ext.git/objects/01/97458f2dbe5fcd6bc44fa46983be0a30282379 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/06/ea30b03ffa2f8574705f8b9583f7ca7e2dccf7 b/test/repos/mixed-cont-ext.git/objects/06/ea30b03ffa2f8574705f8b9583f7ca7e2dccf7 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/06/ea30b03ffa2f8574705f8b9583f7ca7e2dccf7 rename to test/repos/mixed-cont-ext.git/objects/06/ea30b03ffa2f8574705f8b9583f7ca7e2dccf7 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/14/368b701616a8c53820b610414a4b9a07540cf6 b/test/repos/mixed-cont-ext.git/objects/14/368b701616a8c53820b610414a4b9a07540cf6 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/14/368b701616a8c53820b610414a4b9a07540cf6 rename to test/repos/mixed-cont-ext.git/objects/14/368b701616a8c53820b610414a4b9a07540cf6 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/15/2b57e1cf23721cd17ff681cb9276e3fb9fc091 b/test/repos/mixed-cont-ext.git/objects/15/2b57e1cf23721cd17ff681cb9276e3fb9fc091 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/15/2b57e1cf23721cd17ff681cb9276e3fb9fc091 rename to test/repos/mixed-cont-ext.git/objects/15/2b57e1cf23721cd17ff681cb9276e3fb9fc091 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/1f/01fa46c17b1f38b37e6259f6e9d041bda3144f b/test/repos/mixed-cont-ext.git/objects/1f/01fa46c17b1f38b37e6259f6e9d041bda3144f similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/1f/01fa46c17b1f38b37e6259f6e9d041bda3144f rename to test/repos/mixed-cont-ext.git/objects/1f/01fa46c17b1f38b37e6259f6e9d041bda3144f diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/37/f0e70b609adc90f4c09ee21d82ed1d79c81d69 b/test/repos/mixed-cont-ext.git/objects/37/f0e70b609adc90f4c09ee21d82ed1d79c81d69 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/37/f0e70b609adc90f4c09ee21d82ed1d79c81d69 rename to test/repos/mixed-cont-ext.git/objects/37/f0e70b609adc90f4c09ee21d82ed1d79c81d69 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/38/9a2b876b8965d3c91a3db8d28a483eaf019d5c b/test/repos/mixed-cont-ext.git/objects/38/9a2b876b8965d3c91a3db8d28a483eaf019d5c similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/38/9a2b876b8965d3c91a3db8d28a483eaf019d5c rename to test/repos/mixed-cont-ext.git/objects/38/9a2b876b8965d3c91a3db8d28a483eaf019d5c diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 b/test/repos/mixed-cont-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 rename to test/repos/mixed-cont-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/6e/9f4baa6e94a0af4e094836c2eb55ccedef5fc4 b/test/repos/mixed-cont-ext.git/objects/6e/9f4baa6e94a0af4e094836c2eb55ccedef5fc4 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/6e/9f4baa6e94a0af4e094836c2eb55ccedef5fc4 rename to test/repos/mixed-cont-ext.git/objects/6e/9f4baa6e94a0af4e094836c2eb55ccedef5fc4 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/6f/c379457ecb4e576a13c7610ae1fa73f845ee6a b/test/repos/mixed-cont-ext.git/objects/6f/c379457ecb4e576a13c7610ae1fa73f845ee6a similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/6f/c379457ecb4e576a13c7610ae1fa73f845ee6a rename to test/repos/mixed-cont-ext.git/objects/6f/c379457ecb4e576a13c7610ae1fa73f845ee6a diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/93/a159deb9175bfeb2820a0006ddd92d78131332 b/test/repos/mixed-cont-ext.git/objects/93/a159deb9175bfeb2820a0006ddd92d78131332 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/93/a159deb9175bfeb2820a0006ddd92d78131332 rename to test/repos/mixed-cont-ext.git/objects/93/a159deb9175bfeb2820a0006ddd92d78131332 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/95/80ecc12f16334ce44e42287d5d46f927bb7b75 b/test/repos/mixed-cont-ext.git/objects/95/80ecc12f16334ce44e42287d5d46f927bb7b75 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/95/80ecc12f16334ce44e42287d5d46f927bb7b75 rename to test/repos/mixed-cont-ext.git/objects/95/80ecc12f16334ce44e42287d5d46f927bb7b75 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/a9/288dcd8a719a1f4ed3cba43a2a387ae7cd60fd b/test/repos/mixed-cont-ext.git/objects/a9/288dcd8a719a1f4ed3cba43a2a387ae7cd60fd similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/a9/288dcd8a719a1f4ed3cba43a2a387ae7cd60fd rename to test/repos/mixed-cont-ext.git/objects/a9/288dcd8a719a1f4ed3cba43a2a387ae7cd60fd diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/e8/ea32a11d30ee703f6f661ae7c2376f4ab84d38 b/test/repos/mixed-cont-ext.git/objects/e8/ea32a11d30ee703f6f661ae7c2376f4ab84d38 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/e8/ea32a11d30ee703f6f661ae7c2376f4ab84d38 rename to test/repos/mixed-cont-ext.git/objects/e8/ea32a11d30ee703f6f661ae7c2376f4ab84d38 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/objects/fd/15a5ad5204356229c60a831d2a8120a43ac901 b/test/repos/mixed-cont-ext.git/objects/fd/15a5ad5204356229c60a831d2a8120a43ac901 similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/objects/fd/15a5ad5204356229c60a831d2a8120a43ac901 rename to test/repos/mixed-cont-ext.git/objects/fd/15a5ad5204356229c60a831d2a8120a43ac901 diff --git a/manage_externals/test/repos/mixed-cont-ext.git/refs/heads/master b/test/repos/mixed-cont-ext.git/refs/heads/master similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/refs/heads/master rename to test/repos/mixed-cont-ext.git/refs/heads/master diff --git a/manage_externals/test/repos/mixed-cont-ext.git/refs/heads/new-feature b/test/repos/mixed-cont-ext.git/refs/heads/new-feature similarity index 100% rename from manage_externals/test/repos/mixed-cont-ext.git/refs/heads/new-feature rename to test/repos/mixed-cont-ext.git/refs/heads/new-feature diff --git a/manage_externals/test/repos/simple-ext-fork.git/HEAD b/test/repos/simple-ext-fork.git/HEAD similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/HEAD rename to test/repos/simple-ext-fork.git/HEAD diff --git a/manage_externals/test/repos/simple-ext-fork.git/config b/test/repos/simple-ext-fork.git/config similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/config rename to test/repos/simple-ext-fork.git/config diff --git a/manage_externals/test/repos/simple-ext-fork.git/description b/test/repos/simple-ext-fork.git/description similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/description rename to test/repos/simple-ext-fork.git/description diff --git a/manage_externals/test/repos/simple-ext-fork.git/info/exclude b/test/repos/simple-ext-fork.git/info/exclude similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/info/exclude rename to test/repos/simple-ext-fork.git/info/exclude diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f b/test/repos/simple-ext-fork.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f rename to test/repos/simple-ext-fork.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 b/test/repos/simple-ext-fork.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 rename to test/repos/simple-ext-fork.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/0b/67df4e7e8e6e1c6e401542738b352d18744677 b/test/repos/simple-ext-fork.git/objects/0b/67df4e7e8e6e1c6e401542738b352d18744677 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/0b/67df4e7e8e6e1c6e401542738b352d18744677 rename to test/repos/simple-ext-fork.git/objects/0b/67df4e7e8e6e1c6e401542738b352d18744677 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c b/test/repos/simple-ext-fork.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c rename to test/repos/simple-ext-fork.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/16/5506a7408a482f50493434e13fffeb44af893f b/test/repos/simple-ext-fork.git/objects/16/5506a7408a482f50493434e13fffeb44af893f similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/16/5506a7408a482f50493434e13fffeb44af893f rename to test/repos/simple-ext-fork.git/objects/16/5506a7408a482f50493434e13fffeb44af893f diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/24/4386e788c9bc608613e127a329c742450a60e4 b/test/repos/simple-ext-fork.git/objects/24/4386e788c9bc608613e127a329c742450a60e4 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/24/4386e788c9bc608613e127a329c742450a60e4 rename to test/repos/simple-ext-fork.git/objects/24/4386e788c9bc608613e127a329c742450a60e4 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/32/7e97d86e941047d809dba58f2804740c6c30cf b/test/repos/simple-ext-fork.git/objects/32/7e97d86e941047d809dba58f2804740c6c30cf similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/32/7e97d86e941047d809dba58f2804740c6c30cf rename to test/repos/simple-ext-fork.git/objects/32/7e97d86e941047d809dba58f2804740c6c30cf diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 b/test/repos/simple-ext-fork.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 rename to test/repos/simple-ext-fork.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/3d/7099c35404ae6c8640ce263b38bef06e98cc26 b/test/repos/simple-ext-fork.git/objects/3d/7099c35404ae6c8640ce263b38bef06e98cc26 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/3d/7099c35404ae6c8640ce263b38bef06e98cc26 rename to test/repos/simple-ext-fork.git/objects/3d/7099c35404ae6c8640ce263b38bef06e98cc26 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/3d/ec1fdf8e2f5edba28148c5db2fe8d7a842360b b/test/repos/simple-ext-fork.git/objects/3d/ec1fdf8e2f5edba28148c5db2fe8d7a842360b similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/3d/ec1fdf8e2f5edba28148c5db2fe8d7a842360b rename to test/repos/simple-ext-fork.git/objects/3d/ec1fdf8e2f5edba28148c5db2fe8d7a842360b diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 b/test/repos/simple-ext-fork.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 rename to test/repos/simple-ext-fork.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/4d/837135915ed93eed6fff6b439f284ce317296f b/test/repos/simple-ext-fork.git/objects/4d/837135915ed93eed6fff6b439f284ce317296f similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/4d/837135915ed93eed6fff6b439f284ce317296f rename to test/repos/simple-ext-fork.git/objects/4d/837135915ed93eed6fff6b439f284ce317296f diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/56/175e017ad38bf3d33d74b6bd7c74624b28466a b/test/repos/simple-ext-fork.git/objects/56/175e017ad38bf3d33d74b6bd7c74624b28466a similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/56/175e017ad38bf3d33d74b6bd7c74624b28466a rename to test/repos/simple-ext-fork.git/objects/56/175e017ad38bf3d33d74b6bd7c74624b28466a diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/5f/1d4786d12e52d7ab28d2f2f1118c1059a9f1ae b/test/repos/simple-ext-fork.git/objects/5f/1d4786d12e52d7ab28d2f2f1118c1059a9f1ae similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/5f/1d4786d12e52d7ab28d2f2f1118c1059a9f1ae rename to test/repos/simple-ext-fork.git/objects/5f/1d4786d12e52d7ab28d2f2f1118c1059a9f1ae diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/67/136e5ab4d5c1c65d10c8048763b96b0e53c1d6 b/test/repos/simple-ext-fork.git/objects/67/136e5ab4d5c1c65d10c8048763b96b0e53c1d6 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/67/136e5ab4d5c1c65d10c8048763b96b0e53c1d6 rename to test/repos/simple-ext-fork.git/objects/67/136e5ab4d5c1c65d10c8048763b96b0e53c1d6 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/7b/0bd630ac13865735a1dff3437a137d8ab50663 b/test/repos/simple-ext-fork.git/objects/7b/0bd630ac13865735a1dff3437a137d8ab50663 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/7b/0bd630ac13865735a1dff3437a137d8ab50663 rename to test/repos/simple-ext-fork.git/objects/7b/0bd630ac13865735a1dff3437a137d8ab50663 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/88/cf20868e0cc445f5642a480ed034c71e0d7e9f b/test/repos/simple-ext-fork.git/objects/88/cf20868e0cc445f5642a480ed034c71e0d7e9f similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/88/cf20868e0cc445f5642a480ed034c71e0d7e9f rename to test/repos/simple-ext-fork.git/objects/88/cf20868e0cc445f5642a480ed034c71e0d7e9f diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/8d/2b3b35126224c975d23f109aa1e3cbac452989 b/test/repos/simple-ext-fork.git/objects/8d/2b3b35126224c975d23f109aa1e3cbac452989 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/8d/2b3b35126224c975d23f109aa1e3cbac452989 rename to test/repos/simple-ext-fork.git/objects/8d/2b3b35126224c975d23f109aa1e3cbac452989 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/9b/75494003deca69527bb64bcaa352e801611dd2 b/test/repos/simple-ext-fork.git/objects/9b/75494003deca69527bb64bcaa352e801611dd2 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/9b/75494003deca69527bb64bcaa352e801611dd2 rename to test/repos/simple-ext-fork.git/objects/9b/75494003deca69527bb64bcaa352e801611dd2 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/a2/2a5da9119328ea6d693f88861457c07e14ac04 b/test/repos/simple-ext-fork.git/objects/a2/2a5da9119328ea6d693f88861457c07e14ac04 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/a2/2a5da9119328ea6d693f88861457c07e14ac04 rename to test/repos/simple-ext-fork.git/objects/a2/2a5da9119328ea6d693f88861457c07e14ac04 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/a4/2fe9144f5707bc1e9515ce1b44681f7aba6f95 b/test/repos/simple-ext-fork.git/objects/a4/2fe9144f5707bc1e9515ce1b44681f7aba6f95 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/a4/2fe9144f5707bc1e9515ce1b44681f7aba6f95 rename to test/repos/simple-ext-fork.git/objects/a4/2fe9144f5707bc1e9515ce1b44681f7aba6f95 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/b9/3737be3ea6b19f6255983748a0a0f4d622f936 b/test/repos/simple-ext-fork.git/objects/b9/3737be3ea6b19f6255983748a0a0f4d622f936 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/b9/3737be3ea6b19f6255983748a0a0f4d622f936 rename to test/repos/simple-ext-fork.git/objects/b9/3737be3ea6b19f6255983748a0a0f4d622f936 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/c5/32bc8fde96fa63103a52057f0baffcc9f00c6b b/test/repos/simple-ext-fork.git/objects/c5/32bc8fde96fa63103a52057f0baffcc9f00c6b similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/c5/32bc8fde96fa63103a52057f0baffcc9f00c6b rename to test/repos/simple-ext-fork.git/objects/c5/32bc8fde96fa63103a52057f0baffcc9f00c6b diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/c5/b315915742133dbdfbeed0753e481b55c1d364 b/test/repos/simple-ext-fork.git/objects/c5/b315915742133dbdfbeed0753e481b55c1d364 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/c5/b315915742133dbdfbeed0753e481b55c1d364 rename to test/repos/simple-ext-fork.git/objects/c5/b315915742133dbdfbeed0753e481b55c1d364 diff --git a/manage_externals/test/repos/simple-ext-fork.git/objects/f2/68d4e56d067da9bd1d85e55bdc40a8bd2b0bca b/test/repos/simple-ext-fork.git/objects/f2/68d4e56d067da9bd1d85e55bdc40a8bd2b0bca similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/objects/f2/68d4e56d067da9bd1d85e55bdc40a8bd2b0bca rename to test/repos/simple-ext-fork.git/objects/f2/68d4e56d067da9bd1d85e55bdc40a8bd2b0bca diff --git a/manage_externals/test/repos/simple-ext-fork.git/packed-refs b/test/repos/simple-ext-fork.git/packed-refs similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/packed-refs rename to test/repos/simple-ext-fork.git/packed-refs diff --git a/manage_externals/test/repos/simple-ext-fork.git/refs/heads/feature2 b/test/repos/simple-ext-fork.git/refs/heads/feature2 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/refs/heads/feature2 rename to test/repos/simple-ext-fork.git/refs/heads/feature2 diff --git a/manage_externals/test/repos/simple-ext-fork.git/refs/tags/abandoned-feature b/test/repos/simple-ext-fork.git/refs/tags/abandoned-feature similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/refs/tags/abandoned-feature rename to test/repos/simple-ext-fork.git/refs/tags/abandoned-feature diff --git a/manage_externals/test/repos/simple-ext-fork.git/refs/tags/forked-feature-v1 b/test/repos/simple-ext-fork.git/refs/tags/forked-feature-v1 similarity index 100% rename from manage_externals/test/repos/simple-ext-fork.git/refs/tags/forked-feature-v1 rename to test/repos/simple-ext-fork.git/refs/tags/forked-feature-v1 diff --git a/manage_externals/test/repos/simple-ext.git/HEAD b/test/repos/simple-ext.git/HEAD similarity index 100% rename from manage_externals/test/repos/simple-ext.git/HEAD rename to test/repos/simple-ext.git/HEAD diff --git a/manage_externals/test/repos/simple-ext.git/config b/test/repos/simple-ext.git/config similarity index 100% rename from manage_externals/test/repos/simple-ext.git/config rename to test/repos/simple-ext.git/config diff --git a/manage_externals/test/repos/simple-ext.git/description b/test/repos/simple-ext.git/description similarity index 100% rename from manage_externals/test/repos/simple-ext.git/description rename to test/repos/simple-ext.git/description diff --git a/manage_externals/test/repos/simple-ext.git/info/exclude b/test/repos/simple-ext.git/info/exclude similarity index 100% rename from manage_externals/test/repos/simple-ext.git/info/exclude rename to test/repos/simple-ext.git/info/exclude diff --git a/manage_externals/test/repos/simple-ext.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f b/test/repos/simple-ext.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f rename to test/repos/simple-ext.git/objects/00/fd13e76189f9134b0506b4b8ed3172723b467f diff --git a/manage_externals/test/repos/simple-ext.git/objects/09/0e1034746b2c865f7b0280813dbf4061a700e8 b/test/repos/simple-ext.git/objects/09/0e1034746b2c865f7b0280813dbf4061a700e8 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/09/0e1034746b2c865f7b0280813dbf4061a700e8 rename to test/repos/simple-ext.git/objects/09/0e1034746b2c865f7b0280813dbf4061a700e8 diff --git a/manage_externals/test/repos/simple-ext.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 b/test/repos/simple-ext.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 rename to test/repos/simple-ext.git/objects/0b/15e8af3d4615b42314216efeae3fff184046a8 diff --git a/manage_externals/test/repos/simple-ext.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c b/test/repos/simple-ext.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c rename to test/repos/simple-ext.git/objects/11/a76e3d9a67313dec7ce1230852ab5c86352c5c diff --git a/test/repos/simple-ext.git/objects/14/2711fdbbcb8034d7cad6bae6801887b12fe61d b/test/repos/simple-ext.git/objects/14/2711fdbbcb8034d7cad6bae6801887b12fe61d new file mode 100644 index 0000000000000000000000000000000000000000..acaf7889b47c54ee0dea121c73d505ca14ad369b GIT binary patch literal 83 zcmV-Z0IdIb0ZYosPg1ZjWC+Q~ELKR%%t=)!&d4v#Nl{3x$Sf{V$jnnnRLILO%1z8s pNX|%2&dx6_QAh$}pz8eG%#xDS6o{JQg2bZYRJa;FE&z4gA7ySEC>H<# literal 0 HcmV?d00001 diff --git a/manage_externals/test/repos/simple-ext.git/objects/31/dbcd6de441e671a467ef317146539b7ffabb11 b/test/repos/simple-ext.git/objects/31/dbcd6de441e671a467ef317146539b7ffabb11 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/31/dbcd6de441e671a467ef317146539b7ffabb11 rename to test/repos/simple-ext.git/objects/31/dbcd6de441e671a467ef317146539b7ffabb11 diff --git a/manage_externals/test/repos/simple-ext.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 b/test/repos/simple-ext.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 rename to test/repos/simple-ext.git/objects/36/418b4e5665956a90725c9a1b5a8e551c5f3d48 diff --git a/manage_externals/test/repos/simple-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 b/test/repos/simple-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 rename to test/repos/simple-ext.git/objects/41/1de5d96ee418c1c55f3e96e6e6e7c06bb95801 diff --git a/test/repos/simple-ext.git/objects/60/7ec299c17dd285c029edc41a0109e49d441380 b/test/repos/simple-ext.git/objects/60/7ec299c17dd285c029edc41a0109e49d441380 new file mode 100644 index 0000000000000000000000000000000000000000..3f6959cc54afd45fa4f64be25ccb3bb8580183c9 GIT binary patch literal 168 zcmV;Z09XHb0hNwR4#F@D1zG15z5poBzY;=l6vuV}(Nff=3vN&02JB|>MsIi;$9n_k z!>-M$Ac)DAYy~^^qUu9WLY{J}xkT>CQ3)XSx>0V^p=O;s>7G-EI{FfcPQQP4}zEXhpI%P&f0aFl&|Gw+GS!K3kZ)1Ezh zejs~i1S3>cQEFmJZmM2MMG3KlvCEtNF?@%PbVOT{Nm)vLb%0Bl_``r7C@umAu6 literal 0 HcmV?d00001 diff --git a/test/repos/simple-ext.git/objects/d8/ed2f33179d751937f8fde2e33921e4827babf4 b/test/repos/simple-ext.git/objects/d8/ed2f33179d751937f8fde2e33921e4827babf4 new file mode 100644 index 0000000000000000000000000000000000000000..f08ae820c9c89927f9898c5646134f7c519a6b04 GIT binary patch literal 60 zcmV-C0K@-y0V^p=O;s>4W-v4`Ff%bxC@xJ($t;Rb%gjmDE2$`95K$NWyZdy5$@Np$ Sc0Fs5Xy2&+OcnsW_!K#a0~pW% literal 0 HcmV?d00001 diff --git a/manage_externals/test/repos/simple-ext.git/objects/df/312890f93ba4d2c694208599b665c4a08afeff b/test/repos/simple-ext.git/objects/df/312890f93ba4d2c694208599b665c4a08afeff similarity index 100% rename from manage_externals/test/repos/simple-ext.git/objects/df/312890f93ba4d2c694208599b665c4a08afeff rename to test/repos/simple-ext.git/objects/df/312890f93ba4d2c694208599b665c4a08afeff diff --git a/manage_externals/test/repos/simple-ext.git/refs/heads/feature2 b/test/repos/simple-ext.git/refs/heads/feature2 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/refs/heads/feature2 rename to test/repos/simple-ext.git/refs/heads/feature2 diff --git a/manage_externals/test/repos/simple-ext.git/refs/heads/feature3 b/test/repos/simple-ext.git/refs/heads/feature3 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/refs/heads/feature3 rename to test/repos/simple-ext.git/refs/heads/feature3 diff --git a/test/repos/simple-ext.git/refs/heads/master b/test/repos/simple-ext.git/refs/heads/master new file mode 100644 index 0000000000..adf1ccb002 --- /dev/null +++ b/test/repos/simple-ext.git/refs/heads/master @@ -0,0 +1 @@ +607ec299c17dd285c029edc41a0109e49d441380 diff --git a/manage_externals/test/repos/simple-ext.git/refs/tags/tag1 b/test/repos/simple-ext.git/refs/tags/tag1 similarity index 100% rename from manage_externals/test/repos/simple-ext.git/refs/tags/tag1 rename to test/repos/simple-ext.git/refs/tags/tag1 diff --git a/test/repos/simple-ext.git/refs/tags/tag2 b/test/repos/simple-ext.git/refs/tags/tag2 new file mode 100644 index 0000000000..4160b6c494 --- /dev/null +++ b/test/repos/simple-ext.git/refs/tags/tag2 @@ -0,0 +1 @@ +b7692b6d391899680da7b9b6fd8af4c413f06fe7 diff --git a/manage_externals/test/requirements.txt b/test/requirements.txt similarity index 100% rename from manage_externals/test/requirements.txt rename to test/requirements.txt diff --git a/manage_externals/test/test_sys_checkout.py b/test/test_sys_checkout.py similarity index 78% rename from manage_externals/test/test_sys_checkout.py rename to test/test_sys_checkout.py index 9ebfb0aeee..df726f2b70 100644 --- a/manage_externals/test/test_sys_checkout.py +++ b/test/test_sys_checkout.py @@ -42,6 +42,7 @@ from manic.externals_description import ExternalsDescription from manic.externals_description import DESCRIPTION_SECTION, VERSION_ITEM +from manic.externals_description import git_submodule_status from manic.externals_status import ExternalStatus from manic.repository_git import GitRepository from manic.utils import printlog, execute_subprocess @@ -87,6 +88,8 @@ SVN_TEST_REPO = 'https://github.com/escomp/cesm' +# Disable too-many-public-methods error +# pylint: disable=R0904 def setUpModule(): # pylint: disable=C0103 """Setup for all tests in this module. It is called once per module! @@ -139,7 +142,7 @@ def container_full(self, dest_dir): self.create_section(MIXED_REPO_NAME, 'mixed_req', branch='master', externals=CFG_SUB_NAME) - self._write_config(dest_dir) + self.write_config(dest_dir) def container_simple_required(self, dest_dir): """Create a container externals file with only simple externals. @@ -155,7 +158,7 @@ def container_simple_required(self, dest_dir): self.create_section(SIMPLE_REPO_NAME, 'simp_hash', ref_hash='60b1cc1a38d63') - self._write_config(dest_dir) + self.write_config(dest_dir) def container_simple_optional(self, dest_dir): """Create a container externals file with optional simple externals @@ -168,7 +171,7 @@ def container_simple_optional(self, dest_dir): self.create_section(SIMPLE_REPO_NAME, 'simp_opt', tag='tag1', required=False) - self._write_config(dest_dir) + self.write_config(dest_dir) def container_simple_svn(self, dest_dir): """Create a container externals file with only simple externals. @@ -180,7 +183,26 @@ def container_simple_svn(self, dest_dir): self.create_svn_external('svn_branch', branch='trunk') self.create_svn_external('svn_tag', tag='tags/cesm2.0.beta07') - self._write_config(dest_dir) + self.write_config(dest_dir) + + def container_sparse(self, dest_dir): + """Create a container with a full external and a sparse external + + """ + # Create a file for a sparse pattern match + sparse_filename = 'sparse_checkout' + with open(os.path.join(dest_dir, sparse_filename), 'w') as sfile: + sfile.write('readme.txt') + + self.create_config() + self.create_section(SIMPLE_REPO_NAME, 'simp_tag', + tag='tag2') + + sparse_relpath = '../../{}'.format(sparse_filename) + self.create_section(SIMPLE_REPO_NAME, 'simp_sparse', + tag='tag2', sparse=sparse_relpath) + + self.write_config(dest_dir) def mixed_simple_base(self, dest_dir): """Create a mixed-use base externals file with only simple externals. @@ -197,7 +219,7 @@ def mixed_simple_base(self, dest_dir): self.create_section(SIMPLE_REPO_NAME, 'simp_hash', ref_hash='60b1cc1a38d63') - self._write_config(dest_dir) + self.write_config(dest_dir) def mixed_simple_sub(self, dest_dir): """Create a mixed-use sub externals file with only simple externals. @@ -211,9 +233,9 @@ def mixed_simple_sub(self, dest_dir): branch=REMOTE_BRANCH_FEATURE2, path=SUB_EXTERNALS_PATH) - self._write_config(dest_dir, filename=CFG_SUB_NAME) + self.write_config(dest_dir, filename=CFG_SUB_NAME) - def _write_config(self, dest_dir, filename=CFG_NAME): + def write_config(self, dest_dir, filename=CFG_NAME): """Write the configuration file to disk """ @@ -237,22 +259,41 @@ def create_metadata(self): self._schema_version) def create_section(self, repo_type, name, tag='', branch='', - ref_hash='', - required=True, path=EXTERNALS_NAME, externals=''): + ref_hash='', required=True, path=EXTERNALS_NAME, + externals='', repo_path=None, from_submodule=False, + sparse=''): + # pylint: disable=too-many-branches """Create a config section with autofilling some items and handling optional items. """ # pylint: disable=R0913 self._config.add_section(name) - self._config.set(name, ExternalsDescription.PATH, - os.path.join(path, name)) + if not from_submodule: + self._config.set(name, ExternalsDescription.PATH, + os.path.join(path, name)) self._config.set(name, ExternalsDescription.PROTOCOL, ExternalsDescription.PROTOCOL_GIT) - repo_url = os.path.join('${MANIC_TEST_BARE_REPO_ROOT}', repo_type) - self._config.set(name, ExternalsDescription.REPO_URL, repo_url) + # from_submodules is incompatible with some other options, turn them off + if (from_submodule and + ((repo_path is not None) or tag or ref_hash or branch)): + printlog('create_section: "from_submodule" is incompatible with ' + '"repo_url", "tag", "hash", and "branch" options;\n' + 'Ignoring those options for {}'.format(name)) + repo_url = None + tag = '' + ref_hash = '' + branch = '' + + if repo_path is not None: + repo_url = repo_path + else: + repo_url = os.path.join('${MANIC_TEST_BARE_REPO_ROOT}', repo_type) + + if not from_submodule: + self._config.set(name, ExternalsDescription.REPO_URL, repo_url) self._config.set(name, ExternalsDescription.REQUIRED, str(required)) @@ -268,6 +309,12 @@ def create_section(self, repo_type, name, tag='', branch='', if externals: self._config.set(name, ExternalsDescription.EXTERNALS, externals) + if sparse: + self._config.set(name, ExternalsDescription.SPARSE, sparse) + + if from_submodule: + self._config.set(name, ExternalsDescription.SUBMODULE, "True") + def create_section_ext_only(self, name, required=True, externals=CFG_SUB_NAME): """Create a config section with autofilling some items and handling @@ -377,7 +424,7 @@ def update_branch(self, dest_dir, name, branch, repo_type=None, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_svn_branch(self, dest_dir, name, branch, filename=CFG_NAME): """Update a repository branch, and potentially the remote. @@ -391,7 +438,7 @@ def update_svn_branch(self, dest_dir, name, branch, filename=CFG_NAME): except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_tag(self, dest_dir, name, tag, repo_type=None, filename=CFG_NAME, remove_branch=True): @@ -416,7 +463,7 @@ def update_tag(self, dest_dir, name, tag, repo_type=None, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_underspecify_branch_tag(self, dest_dir, name, filename=CFG_NAME): @@ -435,7 +482,7 @@ def update_underspecify_branch_tag(self, dest_dir, name, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_underspecify_remove_url(self, dest_dir, name, filename=CFG_NAME): @@ -448,7 +495,7 @@ def update_underspecify_remove_url(self, dest_dir, name, except BaseException: pass - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) def update_protocol(self, dest_dir, name, protocol, repo_type=None, filename=CFG_NAME): @@ -461,7 +508,7 @@ def update_protocol(self, dest_dir, name, protocol, repo_type=None, repo_url = os.path.join('${MANIC_TEST_BARE_REPO_ROOT}', repo_type) self._config.set(name, ExternalsDescription.REPO_URL, repo_url) - self._write_config(dest_dir, filename) + self.write_config(dest_dir, filename) class BaseTestSysCheckout(unittest.TestCase): @@ -513,7 +560,7 @@ def tearDown(self): # return to our common starting point os.chdir(self._return_dir) - def setup_test_repo(self, parent_repo_name): + def setup_test_repo(self, parent_repo_name, dest_dir_in=None): """Setup the paths and clone the base test repo """ @@ -522,8 +569,12 @@ def setup_test_repo(self, parent_repo_name): print("Test repository name: {0}".format(test_dir_name)) parent_repo_dir = os.path.join(self._bare_root, parent_repo_name) - dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], - test_dir_name) + if dest_dir_in is None: + dest_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], + test_dir_name) + else: + dest_dir = dest_dir_in + # pylint: disable=W0212 GitRepository._git_clone(parent_repo_dir, dest_dir, VERBOSITY_DEFAULT) return dest_dir @@ -684,6 +735,14 @@ def _check_mixed_ext_branch_modified(self, tree, directory=EXTERNALS_NAME): name = './{0}/mixed_req'.format(directory) self._check_generic_modified_ok_required(tree, name) + def _check_simple_sparse_empty(self, tree, directory=EXTERNALS_NAME): + name = './{0}/simp_sparse'.format(directory) + self._check_generic_empty_default_required(tree, name) + + def _check_simple_sparse_ok(self, tree, directory=EXTERNALS_NAME): + name = './{0}/simp_sparse'.format(directory) + self._check_generic_ok_clean_required(tree, name) + # ---------------------------------------------------------------- # # Check results for groups of externals under specific conditions @@ -844,6 +903,23 @@ def _check_mixed_cont_simple_required_post_checkout(self, overall, tree): self._check_simple_branch_ok(tree, directory=EXTERNALS_NAME) self._check_simple_branch_ok(tree, directory=SUB_EXTERNALS_PATH) + def _check_container_sparse_pre_checkout(self, overall, tree): + self.assertEqual(overall, 0) + self._check_simple_tag_empty(tree) + self._check_simple_sparse_empty(tree) + + def _check_container_sparse_post_checkout(self, overall, tree): + self.assertEqual(overall, 0) + self._check_simple_tag_ok(tree) + self._check_simple_sparse_ok(tree) + + def _check_file_exists(self, repo_dir, pathname): + "Check that exists in " + self.assertTrue(os.path.exists(os.path.join(repo_dir, pathname))) + + def _check_file_absent(self, repo_dir, pathname): + "Check that does not exist in " + self.assertFalse(os.path.exists(os.path.join(repo_dir, pathname))) class TestSysCheckout(BaseTestSysCheckout): """Run systems level tests of checkout_externals @@ -1208,6 +1284,14 @@ def test_container_full(self): self.status_args) self._check_container_full_post_checkout(overall, tree) + # Check existance of some files + subrepo_path = os.path.join('externals', 'simp_tag') + self._check_file_exists(under_test_dir, + os.path.join(subrepo_path, 'readme.txt')) + self._check_file_absent(under_test_dir, os.path.join(subrepo_path, + 'simple_subdir', + 'subdir_file.txt')) + # update the mixed-use repo to point to different branch self._generator.update_branch(under_test_dir, 'mixed_req', 'new-feature', MIXED_REPO_NAME) @@ -1288,6 +1372,40 @@ def test_mixed_simple(self): self.status_args) self._check_mixed_cont_simple_required_post_checkout(overall, tree) + def test_container_sparse(self): + """Verify that 'full' container with simple subrepo + can run a sparse checkout and generate the correct initial status. + + """ + # create the test repository + under_test_dir = self.setup_test_repo(CONTAINER_REPO_NAME) + + # create the top level externals file + self._generator.container_sparse(under_test_dir) + + # inital checkout + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.checkout_args) + self._check_container_sparse_pre_checkout(overall, tree) + + overall, tree = self.execute_cmd_in_dir(under_test_dir, + self.status_args) + self._check_container_sparse_post_checkout(overall, tree) + + # Check existance of some files + subrepo_path = os.path.join('externals', 'simp_tag') + self._check_file_exists(under_test_dir, + os.path.join(subrepo_path, 'readme.txt')) + self._check_file_exists(under_test_dir, os.path.join(subrepo_path, + 'simple_subdir', + 'subdir_file.txt')) + subrepo_path = os.path.join('externals', 'simp_sparse') + self._check_file_exists(under_test_dir, + os.path.join(subrepo_path, 'readme.txt')) + self._check_file_absent(under_test_dir, os.path.join(subrepo_path, + 'simple_subdir', + 'subdir_file.txt')) + class TestSysCheckoutSVN(BaseTestSysCheckout): """Run systems level tests of checkout_externals accessing svn repositories @@ -1434,6 +1552,237 @@ def test_container_simple_svn(self): self.verbose_args) self._check_container_simple_svn_post_checkout(overall, tree) +class TestSubrepoCheckout(BaseTestSysCheckout): + # Need to store information at setUp time for checking + # pylint: disable=too-many-instance-attributes + """Run tests to ensure proper handling of repos with submodules. + + By default, submodules in git repositories are checked out. A git + repository checked out as a submodule is treated as if it was + listed in an external with the same properties as in the source + .gitmodules file. + """ + + def setUp(self): + """Setup for all submodule checkout tests + Create a repo with two submodule repositories. + """ + + # Run the basic setup + super(TestSubrepoCheckout, self).setUp() + # create test repo + # We need to do this here (rather than have a static repo) because + # git submodules do not allow for variables in .gitmodules files + self._test_repo_name = 'test_repo_with_submodules' + self._bare_branch_name = 'subrepo_branch' + self._config_branch_name = 'subrepo_config_branch' + self._container_extern_name = 'externals_container.cfg' + self._my_test_dir = os.path.join(os.environ[MANIC_TEST_TMP_REPO_ROOT], + self._test_id) + self._repo_dir = os.path.join(self._my_test_dir, self._test_repo_name) + self._checkout_dir = 'repo_with_submodules' + check_dir = self.setup_test_repo(CONTAINER_REPO_NAME, + dest_dir_in=self._repo_dir) + self.assertTrue(self._repo_dir == check_dir) + # Add the submodules + cwd = os.getcwd() + fork_repo_dir = os.path.join(self._bare_root, SIMPLE_FORK_NAME) + simple_repo_dir = os.path.join(self._bare_root, SIMPLE_REPO_NAME) + self._simple_ext_fork_name = SIMPLE_FORK_NAME.split('.')[0] + self._simple_ext_name = SIMPLE_REPO_NAME.split('.')[0] + os.chdir(self._repo_dir) + # Add a branch with a subrepo + cmd = ['git', 'branch', self._bare_branch_name, 'master'] + execute_subprocess(cmd) + cmd = ['git', 'checkout', self._bare_branch_name] + execute_subprocess(cmd) + cmd = ['git', 'submodule', 'add', fork_repo_dir] + execute_subprocess(cmd) + cmd = ['git', 'commit', '-am', "'Added simple-ext-fork as a submodule'"] + execute_subprocess(cmd) + # Save the fork repo hash for comparison + os.chdir(self._simple_ext_fork_name) + self._fork_hash_check = self.get_git_hash() + os.chdir(self._repo_dir) + # Now, create a branch to test from_sbmodule + cmd = ['git', 'branch', + self._config_branch_name, self._bare_branch_name] + execute_subprocess(cmd) + cmd = ['git', 'checkout', self._config_branch_name] + execute_subprocess(cmd) + cmd = ['git', 'submodule', 'add', simple_repo_dir] + execute_subprocess(cmd) + # Checkout feature2 + os.chdir(self._simple_ext_name) + cmd = ['git', 'branch', 'feature2', 'origin/feature2'] + execute_subprocess(cmd) + cmd = ['git', 'checkout', 'feature2'] + execute_subprocess(cmd) + # Save the fork repo hash for comparison + self._simple_hash_check = self.get_git_hash() + os.chdir(self._repo_dir) + self.create_externals_file(filename=self._container_extern_name, + dest_dir=self._repo_dir, from_submodule=True) + cmd = ['git', 'add', self._container_extern_name] + execute_subprocess(cmd) + cmd = ['git', 'commit', '-am', "'Added simple-ext as a submodule'"] + execute_subprocess(cmd) + # Reset to master + cmd = ['git', 'checkout', 'master'] + execute_subprocess(cmd) + os.chdir(cwd) + + @staticmethod + def get_git_hash(revision="HEAD"): + """Return the hash for """ + cmd = ['git', 'rev-parse', revision] + git_out = execute_subprocess(cmd, output_to_caller=True) + return git_out.strip() + + def create_externals_file(self, name='', filename=CFG_NAME, dest_dir=None, + branch_name=None, sub_externals=None, + from_submodule=False): + # pylint: disable=too-many-arguments + """Create a container externals file with only simple externals. + + """ + self._generator.create_config() + + if dest_dir is None: + dest_dir = self._my_test_dir + + if from_submodule: + self._generator.create_section(SIMPLE_FORK_NAME, + self._simple_ext_fork_name, + from_submodule=True) + self._generator.create_section(SIMPLE_REPO_NAME, + self._simple_ext_name, + branch='feature3', path='', + from_submodule=False) + else: + if branch_name is None: + branch_name = 'master' + + self._generator.create_section(self._test_repo_name, + self._checkout_dir, + branch=branch_name, + path=name, externals=sub_externals, + repo_path=self._repo_dir) + + self._generator.write_config(dest_dir, filename=filename) + + def idempotence_check(self, checkout_dir): + """Verify that calling checkout_externals and + checkout_externals --status does not cause errors""" + cwd = os.getcwd() + os.chdir(checkout_dir) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.status_args) + self.assertTrue(overall == 0) + os.chdir(cwd) + + def test_submodule_checkout_bare(self): + """Verify that a git repo with submodule is properly checked out + This test if for where there is no 'externals' keyword in the + parent repo. + Correct behavior is that the submodule is checked out using + normal git submodule behavior. + """ + simple_ext_fork_tag = "(tag1)" + simple_ext_fork_status = " " + self.create_externals_file(branch_name=self._bare_branch_name) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + cwd = os.getcwd() + checkout_dir = os.path.join(self._my_test_dir, self._checkout_dir) + fork_file = os.path.join(checkout_dir, + self._simple_ext_fork_name, "readme.txt") + self.assertTrue(os.path.exists(fork_file)) + os.chdir(checkout_dir) + submods = git_submodule_status(checkout_dir) + self.assertEqual(len(submods.keys()), 1) + self.assertTrue(self._simple_ext_fork_name in submods) + submod = submods[self._simple_ext_fork_name] + self.assertTrue('hash' in submod) + self.assertEqual(submod['hash'], self._fork_hash_check) + self.assertTrue('status' in submod) + self.assertEqual(submod['status'], simple_ext_fork_status) + self.assertTrue('tag' in submod) + self.assertEqual(submod['tag'], simple_ext_fork_tag) + os.chdir(cwd) + self.idempotence_check(checkout_dir) + + def test_submodule_checkout_none(self): + """Verify that a git repo with submodule is properly checked out + This test is for when 'externals=None' is in parent repo's + externals cfg file. + Correct behavior is the submodle is not checked out. + """ + self.create_externals_file(branch_name=self._bare_branch_name, + sub_externals="none") + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + cwd = os.getcwd() + checkout_dir = os.path.join(self._my_test_dir, self._checkout_dir) + fork_file = os.path.join(checkout_dir, + self._simple_ext_fork_name, "readme.txt") + self.assertFalse(os.path.exists(fork_file)) + os.chdir(cwd) + self.idempotence_check(checkout_dir) + + def test_submodule_checkout_config(self): # pylint: disable=too-many-locals + """Verify that a git repo with submodule is properly checked out + This test if for when the 'from_submodule' keyword is used in the + parent repo. + Correct behavior is that the submodule is checked out using + normal git submodule behavior. + """ + tag_check = None # Not checked out as submodule + status_check = "-" # Not checked out as submodule + self.create_externals_file(branch_name=self._config_branch_name, + sub_externals=self._container_extern_name) + overall, _ = self.execute_cmd_in_dir(self._my_test_dir, + self.checkout_args) + self.assertTrue(overall == 0) + cwd = os.getcwd() + checkout_dir = os.path.join(self._my_test_dir, self._checkout_dir) + fork_file = os.path.join(checkout_dir, + self._simple_ext_fork_name, "readme.txt") + self.assertTrue(os.path.exists(fork_file)) + os.chdir(checkout_dir) + # Check submodule status + submods = git_submodule_status(checkout_dir) + self.assertEqual(len(submods.keys()), 2) + self.assertTrue(self._simple_ext_fork_name in submods) + submod = submods[self._simple_ext_fork_name] + self.assertTrue('hash' in submod) + self.assertEqual(submod['hash'], self._fork_hash_check) + self.assertTrue('status' in submod) + self.assertEqual(submod['status'], status_check) + self.assertTrue('tag' in submod) + self.assertEqual(submod['tag'], tag_check) + self.assertTrue(self._simple_ext_name in submods) + submod = submods[self._simple_ext_name] + self.assertTrue('hash' in submod) + self.assertEqual(submod['hash'], self._simple_hash_check) + self.assertTrue('status' in submod) + self.assertEqual(submod['status'], status_check) + self.assertTrue('tag' in submod) + self.assertEqual(submod['tag'], tag_check) + # Check fork repo status + os.chdir(self._simple_ext_fork_name) + self.assertEqual(self.get_git_hash(), self._fork_hash_check) + os.chdir(checkout_dir) + os.chdir(self._simple_ext_name) + hash_check = self.get_git_hash('origin/feature3') + self.assertEqual(self.get_git_hash(), hash_check) + os.chdir(cwd) + self.idempotence_check(checkout_dir) class TestSysCheckoutErrors(BaseTestSysCheckout): """Run systems level tests of error conditions in checkout_externals diff --git a/manage_externals/test/test_sys_repository_git.py b/test/test_sys_repository_git.py similarity index 100% rename from manage_externals/test/test_sys_repository_git.py rename to test/test_sys_repository_git.py diff --git a/manage_externals/test/test_unit_externals_description.py b/test/test_unit_externals_description.py similarity index 96% rename from manage_externals/test/test_unit_externals_description.py rename to test/test_unit_externals_description.py index 5de60e4f35..637f760ee5 100644 --- a/manage_externals/test/test_unit_externals_description.py +++ b/test/test_unit_externals_description.py @@ -316,11 +316,13 @@ def setUp(self): """Create config object used as basis for all tests """ self._config = config_parser() + self._gmconfig = config_parser() self.setup_config() def setup_config(self): """Boiler plate construction of xml string for componet 1 """ + # Create a standard externals config with a single external name = 'test' self._config.add_section(name) self._config.set(name, ExternalsDescription.PATH, 'externals') @@ -332,6 +334,14 @@ def setup_config(self): self._config.add_section(DESCRIPTION_SECTION) self._config.set(DESCRIPTION_SECTION, VERSION_ITEM, '1.0.0') + # Create a .gitmodules test + name = 'submodule "gitmodules_test"' + self._gmconfig.add_section(name) + self._gmconfig.set(name, "path", 'externals/test') + self._gmconfig.set(name, "url", '/path/to/repo') + # NOTE(goldy, 2019-03) Should test other possible keywords such as + # fetchRecurseSubmodules, ignore, and shallow + def test_cfg_v1_ok(self): """Test that a correct cfg v1 object is created by create_externals_description @@ -356,7 +366,7 @@ def test_dict(self): rdata = {ExternalsDescription.PROTOCOL: 'git', ExternalsDescription.REPO_URL: '/path/to/repo', ExternalsDescription.TAG: 'tagv1', - } + } desc = { 'test': { diff --git a/manage_externals/test/test_unit_externals_status.py b/test/test_unit_externals_status.py similarity index 100% rename from manage_externals/test/test_unit_externals_status.py rename to test/test_unit_externals_status.py diff --git a/manage_externals/test/test_unit_repository.py b/test/test_unit_repository.py similarity index 87% rename from manage_externals/test/test_unit_repository.py rename to test/test_unit_repository.py index 2152503c2d..5b9c242fd3 100644 --- a/manage_externals/test/test_unit_repository.py +++ b/test/test_unit_repository.py @@ -36,7 +36,8 @@ def setUp(self): ExternalsDescription.REPO_URL: 'junk_root', ExternalsDescription.TAG: 'junk_tag', ExternalsDescription.BRANCH: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } def test_create_repo_git(self): """Verify that several possible names for the 'git' protocol @@ -95,7 +96,8 @@ def test_tag(self): ExternalsDescription.REPO_URL: url, ExternalsDescription.TAG: tag, ExternalsDescription.BRANCH: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.tag(), tag) @@ -112,7 +114,8 @@ def test_branch(self): ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.branch(), branch) @@ -125,11 +128,13 @@ def test_hash(self): protocol = 'test_protocol' url = 'test_url' ref = 'deadc0de' + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: EMPTY_STR, ExternalsDescription.TAG: EMPTY_STR, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } repo = Repository(name, repo_info) print(repo.__dict__) self.assertEqual(repo.hash(), ref) @@ -146,11 +151,13 @@ def test_tag_branch(self): branch = 'test_branch' tag = 'test_tag' ref = EMPTY_STR + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info) @@ -165,11 +172,13 @@ def test_tag_branch_hash(self): branch = 'test_branch' tag = 'test_tag' ref = 'deadc0de' + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info) @@ -184,11 +193,13 @@ def test_no_tag_no_branch(self): branch = EMPTY_STR tag = EMPTY_STR ref = EMPTY_STR + sparse = EMPTY_STR repo_info = {ExternalsDescription.PROTOCOL: protocol, ExternalsDescription.REPO_URL: url, ExternalsDescription.BRANCH: branch, ExternalsDescription.TAG: tag, - ExternalsDescription.HASH: ref, } + ExternalsDescription.HASH: ref, + ExternalsDescription.SPARSE: sparse, } with self.assertRaises(RuntimeError): Repository(name, repo_info) diff --git a/manage_externals/test/test_unit_repository_git.py b/test/test_unit_repository_git.py similarity index 99% rename from manage_externals/test/test_unit_repository_git.py rename to test/test_unit_repository_git.py index b025fbd429..4a0a334bb1 100644 --- a/manage_externals/test/test_unit_repository_git.py +++ b/test/test_unit_repository_git.py @@ -547,7 +547,8 @@ def setUp(self): ExternalsDescription.TAG: 'very_useful_tag', ExternalsDescription.BRANCH: EMPTY_STR, - ExternalsDescription.HASH: EMPTY_STR, } + ExternalsDescription.HASH: EMPTY_STR, + ExternalsDescription.SPARSE: EMPTY_STR, } self._repo = GitRepository('test', self._rdata) def test_remote_git_proto(self): diff --git a/manage_externals/test/test_unit_repository_svn.py b/test/test_unit_repository_svn.py similarity index 100% rename from manage_externals/test/test_unit_repository_svn.py rename to test/test_unit_repository_svn.py diff --git a/manage_externals/test/test_unit_utils.py b/test/test_unit_utils.py similarity index 100% rename from manage_externals/test/test_unit_utils.py rename to test/test_unit_utils.py diff --git a/test/tools/CLM_compare.sh b/test/tools/CLM_compare.sh deleted file mode 100755 index 38f547c3ab..0000000000 --- a/test/tools/CLM_compare.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 2 ]; then - echo "CLM_compare.sh: incorrect number of input arguments" - exit 1 -fi - -echo "CLM_compare.sh: comparing $1 " -echo " with $2" - -##note syntax here as stderr and stdout from cprnc command go -##to separate places! -${CPRNC_EXE} ${CPRNC_OPT} $1 $2 2>&1 > cprnc.out -rc=$? -if [ $rc -ne 0 ]; then - echo "CLM_compare.sh: error doing comparison, cprnc error= $rc" - exit 2 -fi - -result_old=`perl -e 'while (my $ll = <>) \ - { if ($ll =~ /(\d+)[^0-9]+compared[^0-9]+(\d+)/) \ - { print "PASS" if $1>0 && $2==0 }}' cprnc.out` -if grep -c "the two files seem to be IDENTICAL" cprnc.out > /dev/null; then - result=PASS -elif grep -c "the two files seem to be DIFFERENT" cprnc.out > /dev/null; then - result=FAIL -else - result=$result_old -fi - -if [ "$result" = "PASS" ]; then - echo "CLM_compare.sh: files are b4b" -else - echo "CLM_compare.sh: files are NOT b4b" - exit 3 -fi - -exit 0 diff --git a/test/tools/Makefile b/test/tools/Makefile deleted file mode 100644 index b5031abdba..0000000000 --- a/test/tools/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# -# Makefile to build clm testing documentation -# - -# Get list of tests_ files -SOURCES = $(wildcard tests_*) - -all: test_table.html - -test_table.html: $(SOURCES) - gen_test_table.sh - diff --git a/test/tools/README b/test/tools/README deleted file mode 100644 index 4929144b20..0000000000 --- a/test/tools/README +++ /dev/null @@ -1,55 +0,0 @@ -$CTSMROOT/clm/test/tools/README 06/08/2018 - -Scripts for testing the CLM support tools with many different -configurations and run-time options. - -I. MAIN SCRIPTS: - -test_driver.sh - Test the CLM offline tools - -To use... - -./test_driver.sh -i - -on cheyenne - -qcmd -l walltime=06:00:00 -- ./test_driver.sh -i >& run.out & - -Intended for use on NCAR machines cheyenne, geyser (DAV) and hobart. - -II. RUNNING test_driver.sh TOOLS TESTING: - -Basic use: - -./test_driver.sh -i -./test_driver.sh -h # to get help on options - -Important environment variables (just used by test_driver.sh) - -BL_ROOT ---------------- Root directory of CLM baseline code to compare to - (if not set BL test will not be performed) -BL_TESTDIR ------------- Root directory of where to put baseline tests -CLM_INPUT_TESTS -------- Filename of file with list of tests to perform -CLM_TESTDIR ------------ Root directory of where to put most tests -CLM_RETAIN_FILES ------- If set to TRUE -- don't cleanup files after testing -CLM_FC ----------------- Use given compiler -CLM_JOBID -------------- Job identification number to use (rather than process ID) -CLM_THREADS ------------ Number of open-MP threads to use - (by default this is set differently by machine) -CLM_SOFF --------------- If set to TRUE -- stop on first failed test (default FALSE) - -Important files for test_driver tools testing: - -test_driver.sh ------- Main test script for tools -nl_files ------------- Directory with various namelists to test -config_files --------- Directory with various configurations to test -input_tests_master --- Master list of tests -tests_pretag_* ------- Tests for specific machines to do by default before a tag is done -tests_posttag_* ------ Tests for specific machines to do for more extensive testing - after a tag is done -CLM_compare.sh ------- Compares output history files between two cases -T*.sh ---------------- Basic test script to do a specific type of test -gen_test_table.sh ---- Creates HTML table of tests -Makefile ------------- Will build the HTML table of tests - -../../tools/README.testing - Information on how the testing works for the CLM tools diff --git a/test/tools/README.testnames b/test/tools/README.testnames deleted file mode 100644 index b6c18d406b..0000000000 --- a/test/tools/README.testnames +++ /dev/null @@ -1,55 +0,0 @@ -Tests for test_driver are for the CLM tools only. - -Test naming conventions for the test_driver.sh script: - -Test names are: - -xxnmi - -Where: xx is the two-letter test type - sm=smoke, br=branch, er=exact restart, bl=base-line comparision, - cb=configure-build, rp=reproducibility, op=OpenMP threading for tools - -n is the configuration type: - -1 -- unused -2 -- unused -3 -- unused -4 -- unused -5 -- unused -6 -- unused -7 -- unused -8 -- unused -9 -- unused -0 -- unused -a -- unused -b -- unused -c -- mkprocdata_map clm4.5 -d -- mkmapgrids clm4.5 -e -- gen_domain clm4.5 -f -- PTCLM clm4.5 -g -- mksurfdata_map clm4.5 -h -- interpinic clm4.5 -i -- tools scripts clm4.5 - -m is the resolution - -1 -- 48x96 -5 -- 10x15 -7 -- 1x1 brazil -8 -- US-UMB -9 -- 4x5 -c -- US-UMB with cycling on forcing and transient use-case -g -- US-UMB with global forcing and grid PFT and soil -y -- 1.9x2.5 with transient 1850-2100 for rcp=2.6 and glacier-MEC on -Z -- 10x15 with crop on -@ -- ne120np4 -# -- ne30np4 - -i is the specific test (usually this implies...) - -3 -- OpenMP only -4 -- serial -7 -- OpenMP only second test (without DEBUG compiler mode on) - - diff --git a/test/tools/TBLCFGtools.sh b/test/tools/TBLCFGtools.sh deleted file mode 100755 index 6276c885e2..0000000000 --- a/test/tools/TBLCFGtools.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TBLCFGtools.sh: incorrect number of input arguments" - exit 1 -fi - -if [ -z "$BL_ROOT" ] && [ -z "$BL_TESTDIR" ]; then - echo "TBL.sh: no environment variables set for baseline test - will skip" - exit 255 -fi - -tool=$(basename $1) -test_name=TBLCFGtools.$tool.$2.$3 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TBLCFGtools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TBLCFGtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TBLCFGtools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TBLCFGtools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TBLCFGtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -echo "TBLCFGtools.sh: calling TSMCFGtools.sh to run $tool executable" -${CLM_SCRIPTDIR}/TSMCFGtools.sh $1 $2 $3 -rc=$? -if [ $rc -ne 0 ]; then - echo "TBLCFGtools.sh: error from TSMCFGtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -if [ -n "${BL_ROOT}" ]; then - if [ -z "$BL_TESTDIR" ]; then - BL_TESTDIR=${CLM_TESTDIR}.bl - fi - echo "TBLCFGtools.sh: generating baseline data from root $BL_ROOT - results in $BL_TESTDIR" - - echo "TBLCFGtools.sh: calling ****baseline**** TSMCFGtools.sh for smoke test" - bl_dir=`/bin/ls -1d ${BL_ROOT}/test/tools` - env CLM_TESTDIR=${BL_TESTDIR} \ - CLM_ROOT=${BL_ROOT} \ - CLM_SCRIPTDIR=$bl_dir \ - $bl_dir/TSMCFGtools.sh $1 $2 $3 - rc=$? - if [ $rc -ne 0 ]; then - echo "TBLCFGtools.sh: error from *baseline* TSMCFGtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 - fi -fi - -echo "TBLCFGtools.sh: starting b4b comparisons " -files_to_compare=`cd ${CLM_TESTDIR}/TSMCFGtools.$tool.$2.$3; ls *.nc` -if [ -z "${files_to_compare}" ] && [ "$debug" != "YES" ]; then - echo "TBLCFGtools.sh: error locating files to compare" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -all_comparisons_good="TRUE" -for compare_file in ${files_to_compare}; do - - env CPRNC_OPT="-m" \ - ${CLM_SCRIPTDIR}/CLM_compare.sh \ - ${BL_TESTDIR}/TSMCFGtools.$tool.$2.$3/${compare_file} \ - ${CLM_TESTDIR}/TSMCFGtools.$tool.$2.$3/${compare_file} - rc=$? - mv cprnc.out cprnc.${compare_file}.out - if [ $rc -eq 0 ]; then - echo "TBLCFGtools.sh: comparison successful; output in ${rundir}/cprnc.${compare_file}.out" - else - echo "TBLCFGtools.sh: error from CLM_compare.sh= $rc; see ${rundir}/cprnc.${compare_file}.out for details -" - all_comparisons_good="FALSE" - fi -done - -if [ ${all_comparisons_good} = "TRUE" ]; then - echo "TBLCFGtools.sh: baseline test passed" - echo "PASS" > TestStatus - if [ $CLM_RETAIN_FILES != "TRUE" ]; then - echo "TBLCFGtools.sh: removing some unneeded files to save disc space" - rm *.nc - rm *.r* - fi -else - echo "TBLCFGtools.sh: at least one file comparison did not pass" - echo "FAIL.job${JOBID}" > TestStatus - exit 7 -fi - -exit 0 diff --git a/test/tools/TBLscript_tools.sh b/test/tools/TBLscript_tools.sh deleted file mode 100755 index 284ac710d1..0000000000 --- a/test/tools/TBLscript_tools.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TBLscript_tools.sh: incorrect number of input arguments" - exit 1 -fi - -if [ -z "$BL_ROOT" ] && [ -z "$BL_TESTDIR" ]; then - echo "TBLscript_tools.sh: no environment variables set for baseline test - will skip" - exit 255 -fi - -test_name=TBLscript_tools.$1.$2.$3 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TBLscript_tools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TBLscript_tools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TBLscript_tools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TBLscript_tools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TBLscript_tools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -echo "TBLscript_tools.sh: calling TSMscript_tools.sh to run $1 executable" -${CLM_SCRIPTDIR}/TSMscript_tools.sh $1 $2 $3 -rc=$? -if [ $rc -ne 0 ]; then - echo "TBLscript_tools.sh: error from TSMtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -if [ -n "${BL_ROOT}" ]; then - if [ -z "$BL_TESTDIR" ]; then - BL_TESTDIR=${CLM_TESTDIR}.bl - fi - echo "TBLscript_tools.sh: generating baseline data from root $BL_ROOT - results in $BL_TESTDIR" - - echo "TBLscript_tools.sh: calling ****baseline**** TSMtools.sh for smoke test" - bl_dir=`/bin/ls -1d ${BL_ROOT}/test/tools` - env CLM_TESTDIR=${BL_TESTDIR} \ - CLM_SCRIPTDIR=$bl_dir \ - CLM_ROOT=$BL_ROOT \ - CTSM_ROOT=$BL_ROOT \ - CIME_ROOT=$BL_ROOT/cime \ - $bl_dir/TSMscript_tools.sh $1 $2 $3 - rc=$? - if [ $rc -ne 0 ]; then - echo "TBLscript_tools.sh: error from *baseline* TSMscript_tools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 - fi -fi - -echo "TBLscript_tools.sh: starting b4b comparisons " -files_to_compare=`cd ${CLM_TESTDIR}/TSMscript_tools.$1.$2.$3; ls *.nc` -if [ -z "${files_to_compare}" ] && [ "$debug" != "YES" ]; then - echo "TBLscript_tools.sh: error locating files to compare" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -all_comparisons_good="TRUE" -for compare_file in ${files_to_compare}; do - - # For PTCLM, skip comparisons of mapping files, since these aren't really - # necessary, take a lot of time, and cprnc.pl can crash if there are mapping - # files with 0 overlaps - if [[ "$2" == "PTCLM" ]]; then - if [[ "$compare_file" == map* ]]; then - echo "SKIPPING: $compare_file" - continue - fi - fi - - env CPRNC_OPT="-m" \ - ${CLM_SCRIPTDIR}/CLM_compare.sh \ - ${BL_TESTDIR}/TSMscript_tools.$1.$2.$3/${compare_file} \ - ${CLM_TESTDIR}/TSMscript_tools.$1.$2.$3/${compare_file} - rc=$? - mv cprnc.out cprnc.${compare_file}.out - if [ $rc -eq 0 ]; then - echo "TBLscript_tools.sh: comparison successful; output in ${rundir}/cprnc.${compare_file}.out" - else - echo "TBLscript_tools.sh: error from CLM_compare.sh= $rc; see ${rundir}/cprnc.${compare_file}.out for details" - all_comparisons_good="FALSE" - fi -done -# Compare text files for PTCLM if they exist -files_to_compare=`cd ${CLM_TESTDIR}/TSMscript_tools.$1.$2.$3; ls README*` -for compare_file in ${files_to_compare}; do - - diff \ - ${BL_TESTDIR}/TSMscript_tools.$1.$2.$3/${compare_file} \ - ${CLM_TESTDIR}/TSMscript_tools.$1.$2.$3/${compare_file} \ - > diff.${compare_file}.out - rc=$? - if [ $rc -eq 0 ]; then - echo "TBLscript_tools.sh: comparison successful; output in ${rundir}/diff.${compare_file}.out" - else - echo "TBLscript_tools.sh: error from CLM_compare.sh= $rc; see ${rundir}/diff.${compare_file}.out for details" - all_comparisons_good="FALSE" - fi -done - -if [ ${all_comparisons_good} = "TRUE" ]; then - echo "TBLscript_tools.sh: baseline test passed" - echo "PASS" > TestStatus - if [ $CLM_RETAIN_FILES != "TRUE" ]; then - echo "TBLscript_tools.sh: removing some unneeded files to save disc space" - rm *.nc - rm *.r* - fi -else - echo "TBLscript_tools.sh: at least one file comparison did not pass" - echo "FAIL.job${JOBID}" > TestStatus - exit 7 -fi - - - -exit 0 diff --git a/test/tools/TBLtools.sh b/test/tools/TBLtools.sh deleted file mode 100755 index 555ea7d1be..0000000000 --- a/test/tools/TBLtools.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TBLtools.sh: incorrect number of input arguments" - exit 1 -fi - -if [ -z "$BL_ROOT" ] && [ -z "$BL_TESTDIR" ]; then - echo "TBL.sh: no environment variables set for baseline test - will skip" - exit 255 -fi - -test_name=TBLtools.$1.$2.$3 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TBLtools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TBLtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TBLtools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TBLtools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TBLtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -echo "TBLtools.sh: calling TSMtools.sh to run $1 executable" -${CLM_SCRIPTDIR}/TSMtools.sh $1 $2 $3 -rc=$? -if [ $rc -ne 0 ]; then - echo "TBLtools.sh: error from TSMtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -if [ -n "${BL_ROOT}" ]; then - if [ -z "$BL_TESTDIR" ]; then - BL_TESTDIR=${CLM_TESTDIR}.bl - fi - echo "TBLtools.sh: generating baseline data from root $BL_ROOT - results in $BL_TESTDIR" - - echo "TBLtools.sh: calling ****baseline**** TSMtools.sh for smoke test" - bl_dir=`/bin/ls -1d ${BL_ROOT}/test/tools` - env CLM_TESTDIR=${BL_TESTDIR} \ - CLM_ROOT=${BL_ROOT} \ - CLM_SCRIPTDIR=$bl_dir \ - $bl_dir/TSMtools.sh $1 $2 $3 - rc=$? - if [ $rc -ne 0 ]; then - echo "TBLtools.sh: error from *baseline* TSMtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 - fi -fi - -echo "TBLtools.sh: starting b4b comparisons " -files_to_compare=`cd ${CLM_TESTDIR}/TSMtools.$1.$2.$3; ls *.nc` -if [ -z "${files_to_compare}" ] && [ "$debug" != "YES" ]; then - echo "TBLtools.sh: error locating files to compare" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -all_comparisons_good="TRUE" -for compare_file in ${files_to_compare}; do - - env CPRNC_OPT="-m" \ - ${CLM_SCRIPTDIR}/CLM_compare.sh \ - ${BL_TESTDIR}/TSMtools.$1.$2.$3/${compare_file} \ - ${CLM_TESTDIR}/TSMtools.$1.$2.$3/${compare_file} - rc=$? - mv cprnc.out cprnc.${compare_file}.out - if [ $rc -eq 0 ]; then - echo "TBLtools.sh: comparison successful; output in ${rundir}/cprnc.${compare_file}.out" - else - echo "TBLtools.sh: error from CLM_compare.sh= $rc; see ${rundir}/cprnc.${compare_file}.out for details -" - all_comparisons_good="FALSE" - fi -done - -if [ ${all_comparisons_good} = "TRUE" ]; then - echo "TBLtools.sh: baseline test passed" - echo "PASS" > TestStatus - if [ $CLM_RETAIN_FILES != "TRUE" ]; then - echo "TBLtools.sh: removing some unneeded files to save disc space" - rm *.nc - rm *.r* - fi -else - echo "TBLtools.sh: at least one file comparison did not pass" - echo "FAIL.job${JOBID}" > TestStatus - exit 7 -fi - -exit 0 diff --git a/test/tools/TCBCFGtools.sh b/test/tools/TCBCFGtools.sh deleted file mode 100755 index 5c0b015123..0000000000 --- a/test/tools/TCBCFGtools.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 2 ]; then - echo "TCBCFGtools.sh: incorrect number of input arguments" - exit 1 -fi - -tool=$(basename $1) -test_name=TCBCFGtools.$tool.$2 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TCBCFGtools.sh: build test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TCBCFGtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TCBCFGtools.sh: build test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TCBCFGtools.sh: this build test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/${1}` -if [ $? -ne 0 ];then - cfgdir=`ls -1d ${CIME_ROOT}/tools/mapping/${1}*` - echo "use: $cfgdir" -fi -blddir=${CLM_TESTDIR}/${test_name}/src -if [ -d ${blddir} ]; then - rm -r ${blddir} -fi -mkdir -p ${blddir} -if [ $? -ne 0 ]; then - echo "TCBCFGtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${blddir} - -echo "TCBCFGtools.sh: building $tool executable; output in ${blddir}/test.log" -# -# Copy build files over -# -cp $cfgdir/src/Makefile . -cp $cfgdir/src/Filepath . -# -# Add cfgdir path to beginning of each path in Filepath -# -touch Filepath -while read filepath_arg; do - echo "${cfgdir}/src/${filepath_arg}" >> Filepath -done < ${cfgdir}/src/Filepath - -# -# Figure out configuration -# -if [ ! -f ${CLM_SCRIPTDIR}/config_files/$tool ]; then - echo "TCB.sh: configure options file ${CLM_SCRIPTDIR}/config_files/$tool not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -##construct string of args to configure -config_string=" " -while read config_arg; do - config_string="${config_string}${config_arg} " -done < ${CLM_SCRIPTDIR}/config_files/$tool - -if [ "$TOOLSLIBS" != "" ]; then - export SLIBS=$TOOLSLIBS -fi -echo "env CIMEROOT=$CLM_ROOT/cime COMPILER=$CESM_COMP $config_string $CLM_ROOT/cime/tools/configure --macros-format Makefile --machine $CESM_MACH $TOOLS_CONF_STRING" -env CIMEROOT=$CLM_ROOT/cime COMPILER=$CESM_COMP $config_string $CLM_ROOT/cime/tools/configure --macros-format Makefile --machine $CESM_MACH $TOOLS_CONF_STRING >> test.log 2>&1 -rc=$? -if [ $rc -ne 0 ]; then - echo "TCBCFGtools.sh: configure failed, error from configure= $rc" - echo "TCBCFGtools.sh: see ${blddir}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 -fi - -. $INITMODULES -. ./.env_mach_specific.sh - -attempt=1 -still_compiling="TRUE" -while [ $still_compiling = "TRUE" ]; do - - echo "TCBCFGtools.sh: call to make:" - echo " ${MAKE_CMD} USER_CPPDEFS=-DLINUX" - if [ "$debug" != "YES" ]; then - ${MAKE_CMD} USER_CPPDEFS=-DLINUX >> test.log 2>&1 - status="PASS" - rc=$? - else - status="GEN" - rc=0 - fi - if [ $rc -eq 0 ]; then - echo "TCBCFGtools.sh: make was successful" - echo "TCBCFGtools.sh: configure and build test passed" - echo "$status" > TestStatus - if [ $CLM_RETAIN_FILES != "TRUE" ]; then - echo "TCBCFGtools.sh: removing some unneeded files to save disc space" - rm *.o - rm *.mod - fi - still_compiling="FALSE" - elif [ $attempt -lt 10 ] && \ - grep -c "LICENSE MANAGER PROBLEM" test.log > /dev/null; then - attempt=`expr $attempt + 1` - echo "TCBCFGtools.sh: encountered License Manager Problem; launching attempt #$attempt" - else - echo "TCBCFGtools.sh: clm build failed, error from make= $rc" - echo "TCBCFGtools.sh: see ${blddir}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 - fi -done -if [ "$TOOLSLIBS" != "" ]; then - export -n SLIBS -fi - -exit 0 diff --git a/test/tools/TCBscripttools.sh b/test/tools/TCBscripttools.sh deleted file mode 100755 index 2605f4b5c4..0000000000 --- a/test/tools/TCBscripttools.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 2 ]; then - echo "TCBscripttools.sh: incorrect number of input arguments" - exit 1 -fi - -test_name=TCBscripttools.$1.$2 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TCBscripttools.sh: build test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TCBscripttools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TCBscripttools.sh: build test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TCBscripttools.sh: this build test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/$1` -blddir=${CLM_TESTDIR}/${test_name} -if [ -d ${blddir} ]; then - rm -r ${blddir} -fi -mkdir -p ${blddir} -if [ $? -ne 0 ]; then - echo "TCBscripttools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${blddir} - -echo "TCBscripttools.sh: building $1 executables; output in ${blddir}/test.log" -# -# Build script to exercise -# -if [ ! -x ${cfgdir}/$2 ]; then - echo "TCB.sh: build run script file ${cfgdir}/$2 not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -echo "TCBscripttools.sh: run the build scriptmake:" -echo " ${cfgdir}/$2" - -if [ "$debug" != "YES" ]; then - export CTSM_ROOT=${CLM_ROOT} - export CIME_ROOT=${CLM_ROOT}/cime - ${cfgdir}/$2 >> test.log 2>&1 - rc=$(( $rc + $? )) - status="PASS" -else - status="GEN" - rc=0 -fi -if [ $rc -eq 0 ]; then - echo "TCBscripttools.sh: build script was successful" - echo "TCBscripttools.sh: build script test passed" - echo "$status" > TestStatus -else - echo "TCBscripttools.sh: clm build script failed, error from build script= $rc" - echo "TCBscripttools.sh: see ${CLM_TESTDIR}/${test_name}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -exit 0 diff --git a/test/tools/TCBtools.sh b/test/tools/TCBtools.sh deleted file mode 100755 index b0ea9e4a87..0000000000 --- a/test/tools/TCBtools.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 2 ]; then - echo "TCBtools.sh: incorrect number of input arguments" - exit 1 -fi - -test_name=TCBtools.$1.$2 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TCBtools.sh: build test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TCBtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TCBtools.sh: build test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TCBtools.sh: this build test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/$1` -blddir=${CLM_TESTDIR}/${test_name}/src -if [ -d ${blddir} ]; then - rm -r ${blddir} -fi -mkdir -p ${blddir} -if [ $? -ne 0 ]; then - echo "TCBtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${blddir} - -echo "TCBtools.sh: building $1 executable; output in ${blddir}/test.log" -# -# Copy build files over -# -cp $cfgdir/src/Makefile . -cp $cfgdir/src/Srcfiles . -cp $cfgdir/src/Mkdepends . -cp $cfgdir/src/Makefile.common . -# -# Add cfgdir path to beginning of each path in Filepath -# -touch Filepath -while read filepath_arg; do - echo "${cfgdir}/src/${filepath_arg}" >> Filepath -done < ${cfgdir}/src/Filepath - -# -# Figure out configuration -# -if [ ! -f ${CLM_SCRIPTDIR}/config_files/$2 ]; then - echo "TCB.sh: configure options file ${CLM_SCRIPTDIR}/config_files/$2 not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -##construct string of args to configure -config_string="$TOOLS_MAKE_STRING TOOLROOT=$cfgdir " -while read config_arg; do - config_string="${config_string}${config_arg} " -done < ${CLM_SCRIPTDIR}/config_files/$2 - -attempt=1 -still_compiling="TRUE" -if [ "$TOOLSLIBS" != "" ]; then - export SLIBS=$TOOLSLIBS -fi -while [ $still_compiling = "TRUE" ]; do - - if [ "$2" = "gen_domain" ]; then - HOSTNAME=`uname -n | cut -c 1-2` - if [ "$HOSTNAME" = "be" ]; then - echo "TCBtools.sh: run configure for gen_domain on bluefire" - env CIMEROOT=${CLM_ROOT}/cime ${CLM_ROOT}/cime/tools/configure -mach bluefire >> test.log 2>&1 - rc=$? - fi - fi - - ln -s Macros.make Macros - - echo "TCBtools.sh: call to make:" - echo " ${MAKE_CMD} ${config_string} " - if [ "$debug" != "YES" ]; then - ${MAKE_CMD} ${config_string} >> test.log 2>&1 - status="PASS" - rc=$(( $rc + $? )) - else - status="GEN" - rc=0 - fi - if [ $rc -eq 0 ]; then - echo "TCBtools.sh: make was successful" - echo "TCBtools.sh: configure and build test passed" - echo "$status" > TestStatus - if [ $CLM_RETAIN_FILES != "TRUE" ]; then - echo "TCBtools.sh: removing some unneeded files to save disc space" - rm *.o - rm *.mod - fi - still_compiling="FALSE" - elif [ $attempt -lt 10 ] && \ - grep -c "LICENSE MANAGER PROBLEM" test.log > /dev/null; then - attempt=`expr $attempt + 1` - echo "TCBtools.sh: encountered License Manager Problem; launching attempt #$attempt" - else - echo "TCBtools.sh: clm build failed, error from make= $rc" - echo "TCBtools.sh: see ${CLM_TESTDIR}/${test_name}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 - fi -done -if [ "$TOOLSLIBS" != "" ]; then - export -n SLIBS -fi - -exit 0 diff --git a/test/tools/TOPtools.sh b/test/tools/TOPtools.sh deleted file mode 100755 index c8efb440a2..0000000000 --- a/test/tools/TOPtools.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TOPtools.sh: incorrect number of input arguments" - exit 1 -fi - -test_name=TOPtools.$1.$2.$3 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TOPtools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TOPtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TOPtools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TOPtools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TOPtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -if [ ${CLM_THREADS} -lt 2 ]; then - echo "TOPtools.sh: error not enough threads are being used to do the comparision" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 -fi -if [ "$2" != "tools__o" ] && [ "$2" != "tools__do" ]; then - echo "TOPtools.sh: error build needs to be done Open-MP" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 -fi - -echo "TOPtools.sh: calling TSMtools.sh to run $1 executable" -${CLM_SCRIPTDIR}/TSMtools.sh $1 $2 $3 -rc=$? -if [ $rc -ne 0 ]; then - echo "TOPtools.sh: error from TSMtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi -mkdir $rundir/$CLM_THREADS -cp ${CLM_TESTDIR}/TSMtools.$1.$2.$3/*.nc $rundir/$CLM_THREADS - -# Get a list of different threads to run for, powers of 2 from 1 up to the thread count -threads=1 -list="1 " -until [ "$threads" -ge "$CLM_THREADS" ]; do - threads=`perl -e "$CLM_THREADS<$threads*2 ? print $CLM_THREADS : print $threads*2"` - if [ "$threads" -lt "$CLM_THREADS" ]; then list="$list $threads "; fi -done - -all_comparisons_good="TRUE" -for threads in $list -do - echo "TOPtools.sh: calling TSMtools.sh to run $1 executable for $threads threads" - env CLM_THREADS=$threads CLM_RERUN=yes ${CLM_SCRIPTDIR}/TSMtools.sh $1 $2 $3 - rc=$? - if [ $rc -ne 0 ]; then - echo "TOPtools.sh: error from TSMtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 - fi - mkdir $rundir/$threads - cp ${CLM_TESTDIR}/TSMtools.$1.$2.$3/*.nc $rundir/$threads - files_to_compare=`cd $rundir/$threads; ls *.nc` - for compare_file in ${files_to_compare}; do - - env CPRNC_OPT="-m" \ - ${CLM_SCRIPTDIR}/CLM_compare.sh \ - $rundir/$CLM_THREADS/${compare_file} \ - $rundir/$threads/${compare_file} - rc=$? - cprout="cprnc.${compare_file}.threads${threads}.out" - mv cprnc.out $cprout - if [ $rc -eq 0 ]; then - echo "TOPtools.sh: comparison successful; output in $cprout" - else - echo "TOPtools.sh: error from CLM_compare.sh= $rc; see $cprout for details" - all_comparisons_good="FALSE" - fi - done -done - -if [ ${all_comparisons_good} = "TRUE" ]; then - echo "TOPtools.sh: OpenMP comparison test passed" - echo "PASS" > TestStatus - if [ $CLM_RETAIN_FILES != "TRUE" ]; then - echo "TOPtools.sh: removing some unneeded files to save disc space" - rm */*.nc - fi -else - echo "TOPtools.sh: at least one file comparison did not pass" - echo "FAIL.job${JOBID}" > TestStatus - exit 7 -fi - -exit 0 diff --git a/test/tools/TSMCFGtools.sh b/test/tools/TSMCFGtools.sh deleted file mode 100755 index b667a4c6ec..0000000000 --- a/test/tools/TSMCFGtools.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TSMCFGtools.sh: incorrect number of input arguments" - exit 1 -fi - -tool=$(basename $1) -test_name=TSMCFGtools.$tool.$2.$3 - - -if [ -z "$CLM_RERUN" ]; then - CLM_RERUN="no" -fi - -if [ "$CLM_RERUN" != "yes" ] && [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMCFGtools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMCFGtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TSMCFGtools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TSMCFGtools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/${1}*` -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TSMCFGtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -echo "TSMCFGtools.sh: calling TCBCFGtools.sh to prepare $tool executable" -${CLM_SCRIPTDIR}/TCBCFGtools.sh $1 $2 -rc=$? -if [ $rc -ne 0 ]; then - echo "TSMCFGtools.sh: error from TCBtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -echo "TSMCFGtools.sh: running $tool output in ${rundir}/test.log" - -if [ "$2" = "CFGtools__o" ] || [ "$2" = "CFGtools__do" ]; then - toolrun="env OMP_NUM_THREADS=${CLM_THREADS} ${CLM_TESTDIR}/TCBCFGtools.$tool.$2/${tool}*" -else - toolrun="${CLM_TESTDIR}/TCBCFGtools.$tool.$2/${tool}*" -fi - -runfile="${CLM_SCRIPTDIR}/nl_files/$tool.$3" -if [ ! -f "${runfile}" ]; then - echo "TSMCFGtools.sh: error ${runfile} input run file not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 -fi - -echo "Run file type = ${3#*.}" -if [ ${3#*.} == "runoptions" ]; then - runopts=`cat ${runfile} | sed -e "s|CSMDATA|$CSMDATA|g"` - echo "$toolrun $runopts" - cp $cfgdir/*.nc . - if [ "$debug" != "YES" ] && [ "$compile_only" != "YES" ]; then - $toolrun $runopts >> test.log 2>&1 - rc=$? - status="PASS" - else - echo "Successfully created file" > test.log - status="GEN" - rc=0 - fi -else - echo "$toolrun < ${runfile}" - if [ "$debug" != "YES" ] && [ "$compile_only" != "YES" ]; then - $toolrun < ${runfile} >> test.log 2>&1 - rc=$? - status="PASS" - else - echo "Successfully created file" > test.log - status="GEN" - rc=0 - fi -fi - -if [ $rc -eq 0 ] && grep -ci "Successfully created " test.log > /dev/null; then - echo "TSMCFGtools.sh: smoke test passed" - echo "$status" > TestStatus -else - echo "TSMCFGtools.sh: error running $tool, error= $rc" - echo "TSMCFGtools.sh: see ${CLM_TESTDIR}/${test_name}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -exit 0 diff --git a/test/tools/TSMncl_tools.sh b/test/tools/TSMncl_tools.sh deleted file mode 100755 index eb82142e4d..0000000000 --- a/test/tools/TSMncl_tools.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 1 ]; then - echo "TSMncl_tools.sh: incorrect number of input arguments" - exit 1 -fi - -test_name=TSMncl_tools.$1 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMncl_tools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMncl_tools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TSMncl_tools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TSMncl_tools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/$1/ncl_scripts` -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TSMncl_tools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -echo "TSMncl_tools.sh: running $1 output in ${rundir}/test.log" - -if [ ! -f "${cfgdir}/$1.ncl" ]; then - echo "TSMncl_tools.sh: error ${cfgdir}/$1.ncl input script not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 -fi - -if [ "$debug" != "YES" ] && [ "$compile_only" != "YES" ]; then - ncl ${cfgdir}/$1.ncl >> test.log 2>&1 - status="PASS" - rc=$? -else - echo "success" > test.log - status="GEN" - rc=0 -fi - -if [ $rc -eq 0 ] && grep -ci "success" test.log > /dev/null; then - echo "TSMncl_tools.sh: smoke test passed" - echo "$status" > TestStatus -else - echo "TSMncl_tools.sh: error running $1, error= $rc" - echo "TSMncl_tools.sh: see ${CLM_TESTDIR}/${test_name}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -exit 0 diff --git a/test/tools/TSMscript_tools.sh b/test/tools/TSMscript_tools.sh deleted file mode 100755 index 360ecf86a4..0000000000 --- a/test/tools/TSMscript_tools.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TSMscript_tools.sh: incorrect number of input arguments" - exit 1 -fi - -test_name=TSMscript_tools.$1.$2.$3 - -if [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMscript_tools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMscript_tools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TSMscript_tools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TSMscript_tools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/$1` -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TSMscript_tools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -# Copy any sample files so can use them -cp $cfgdir/sample_* $rundir - -optfile=${3%^*} -cfgfile=${3#*^} - -if [[ "$1" == "PTCLM" ]]; then - echo "TSMscript_tools.sh: calling TCBscripttools.sh to prepare executables for $1" - ${CLM_SCRIPTDIR}/TCBscripttools.sh $1 $cfgfile - rc=$? - if [ $rc -ne 0 ]; then - echo "TSMscript_tools.sh: error from TCBscripttools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 - fi - # Copy map files so we can use them - subdir=1x1pt_US-UMB - mkdir $rundir/$subdir - cp $CSMDATA/lnd/clm2/PTCLMmydatafiles.c171024/$subdir/map_* $rundir/$subdir -elif [ "$optfile" != "$3" ]; then - echo "TSMscript_tools.sh: calling TCBtools.sh to prepare $1 executable" - ${CLM_SCRIPTDIR}/TCBtools.sh $1 $cfgfile - rc=$? - if [ $rc -ne 0 ]; then - echo "TSMscript_tools.sh: error from TCBtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 - fi - tcbtools=${CLM_TESTDIR}/TCBtools.$1.$cfgfile -else - tcbtools="." -fi - -scopts=`cat ${CLM_SCRIPTDIR}/nl_files/$optfile | sed -e "s|CSMDATA|$CSMDATA|g" | sed -e "s|EXEDIR|$tcbtools|" | sed -e "s|CFGDIR|$cfgdir|g"` -scopts=`echo $scopts | sed -e "s|CTSM_ROOT|$CTSM_ROOT|g" | sed -e "s|CIME_ROOT|$CIME_ROOT|g"` - -echo "TSMscript_tools.sh: running ${cfgdir}/$2 with $scopts; output in ${rundir}/test.log" - -if [ ! -f "${cfgdir}/$2" ]; then - echo "TSMscript_tools.sh: error ${cfgdir}/$2 input script not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 -fi - -if [ "$debug" != "YES" ] && [ "$compile_only" != "YES" ]; then - ${cfgdir}/$2 $scopts >> test.log 2>&1 - rc=$? - status="PASS" -else - echo "success" > test.log - status="GEN" - rc=0 -fi - -if [ $rc -eq 0 ] && grep -ci "Successfully " test.log > /dev/null; then - echo "TSMscript_tools.sh: smoke test passed" - echo "$status" > TestStatus - # Copy files from subdirectories up... - # (use hard links rather than symbolic links because 'ln -s' does funny - # things when there are no matching files) - ln */*.nc */*/*.nc . -else - echo "TSMscript_tools.sh: error running $2, error= $rc" - echo "TSMscript_tools.sh: see ${CLM_TESTDIR}/${test_name}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -exit 0 diff --git a/test/tools/TSMtools.sh b/test/tools/TSMtools.sh deleted file mode 100755 index 33a2316973..0000000000 --- a/test/tools/TSMtools.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -# - -if [ $# -ne 3 ]; then - echo "TSMtools.sh: incorrect number of input arguments" - exit 1 -fi - -test_name=TSMtools.$1.$2.$3 - -if [ -z "$CLM_RERUN" ]; then - CLM_RERUN="no" -fi - -if [ "$CLM_RERUN" != "yes" ] && [ -f ${CLM_TESTDIR}/${test_name}/TestStatus ]; then - if grep -c PASS ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMtools.sh: smoke test has already passed; results are in " - echo " ${CLM_TESTDIR}/${test_name}" - exit 0 - elif grep -c GEN ${CLM_TESTDIR}/${test_name}/TestStatus > /dev/null; then - echo "TSMtools.sh: test already generated" - else - read fail_msg < ${CLM_TESTDIR}/${test_name}/TestStatus - prev_jobid=${fail_msg#*job} - - if [ $JOBID = $prev_jobid ]; then - echo "TSMtools.sh: smoke test has already failed for this job - will not reattempt; " - echo " results are in: ${CLM_TESTDIR}/${test_name}" - exit 2 - else - echo "TSMtools.sh: this smoke test failed under job ${prev_jobid} - moving those results to " - echo " ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid and trying again" - cp -rp ${CLM_TESTDIR}/${test_name} ${CLM_TESTDIR}/${test_name}_FAIL.job$prev_jobid - fi - fi -fi - -cfgdir=`ls -1d ${CLM_ROOT}/tools/$1` -rundir=${CLM_TESTDIR}/${test_name} -if [ -d ${rundir} ]; then - rm -r ${rundir} -fi -mkdir -p ${rundir} -if [ $? -ne 0 ]; then - echo "TSMtools.sh: error, unable to create work subdirectory" - exit 3 -fi -cd ${rundir} - -echo "Copy any text files over" -cp $cfgdir/*.txt $rundir - -echo "TSMtools.sh: calling TCBtools.sh to prepare $1 executable" -${CLM_SCRIPTDIR}/TCBtools.sh $1 $2 -rc=$? -if [ $rc -ne 0 ]; then - echo "TSMtools.sh: error from TCBtools.sh= $rc" - echo "FAIL.job${JOBID}" > TestStatus - exit 4 -fi - -echo "TSMtools.sh: running $1; output in ${rundir}/test.log" - -if [ "$3" = "tools__o" ] || [ "$3" = "tools__do" ]; then - toolrun="env OMP_NUM_THREADS=${CLM_THREADS} ${CLM_TESTDIR}/TCBtools.$1.$2/$1" -else - toolrun="${CLM_TESTDIR}/TCBtools.$1.$2/$1" -fi - -runfile="${cfgdir}/$1.$3" - -if [ ! -f "${runfile}" ]; then - runfile="${CLM_SCRIPTDIR}/nl_files/$1.$3" - if [ ! -f "${runfile}" ]; then - echo "TSMtools.sh: error ${runfile} input run file not found" - echo "FAIL.job${JOBID}" > TestStatus - exit 5 - fi -fi - -echo "Run file type = ${3#*.}" -if [ ${3#*.} == "runoptions" ]; then - echo "$toolrun "`cat ${runfile}` - cp $cfgdir/*.nc . - if [ "$debug" != "YES" ] && [ "$compile_only" != "YES" ]; then - $toolrun `cat ${runfile}` >> test.log 2>&1 - rc=$? - status="PASS" - else - echo "Successfully created file" > test.log - status="GEN" - rc=0 - fi -else - echo "$toolrun < ${runfile}" - if [ "$debug" != "YES" ] && [ "$compile_only" != "YES" ]; then - $toolrun < ${runfile} >> test.log 2>&1 - rc=$? - status="PASS" - else - echo "Successfully created file" > test.log - status="GEN" - rc=0 - fi -fi - -if [ $rc -eq 0 ] && grep -ci "Successfully created " test.log > /dev/null; then - echo "TSMtools.sh: smoke test passed" - echo "$status" > TestStatus -else - echo "TSMtools.sh: error running $1, error= $rc" - echo "TSMtools.sh: see ${CLM_TESTDIR}/${test_name}/test.log for details" - echo "FAIL.job${JOBID}" > TestStatus - exit 6 -fi - -exit 0 diff --git a/test/tools/config_files/CFGtools__ds b/test/tools/config_files/CFGtools__ds deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/tools/config_files/PTCLM__s b/test/tools/config_files/PTCLM__s deleted file mode 100644 index 8a2155ac49..0000000000 --- a/test/tools/config_files/PTCLM__s +++ /dev/null @@ -1 +0,0 @@ -./buildtools diff --git a/test/tools/config_files/README b/test/tools/config_files/README deleted file mode 100644 index bdfe5e0dd0..0000000000 --- a/test/tools/config_files/README +++ /dev/null @@ -1,9 +0,0 @@ -_do => debug on, omp only on -_ds => debug on, serial mode (neither mpi nor omp) - -_o => debug off, omp only on -_s => debug off, serial mode (neither mpi nor omp) - -tools__ds => options for tools, debug on, serial mode -tools__do => options for tools, debug on, omp only on -tools__o => options for tools, debug off, omp only on diff --git a/test/tools/config_files/gen_domain b/test/tools/config_files/gen_domain deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/tools/config_files/tools__do b/test/tools/config_files/tools__do deleted file mode 100644 index 7f061ed65d..0000000000 --- a/test/tools/config_files/tools__do +++ /dev/null @@ -1 +0,0 @@ -SMP=TRUE OPT=FALSE diff --git a/test/tools/config_files/tools__ds b/test/tools/config_files/tools__ds deleted file mode 100644 index cf2d414b28..0000000000 --- a/test/tools/config_files/tools__ds +++ /dev/null @@ -1 +0,0 @@ -OPT=FALSE diff --git a/test/tools/config_files/tools__o b/test/tools/config_files/tools__o deleted file mode 100644 index 8821e0bc5a..0000000000 --- a/test/tools/config_files/tools__o +++ /dev/null @@ -1 +0,0 @@ -SMP=TRUE OPT=TRUE diff --git a/test/tools/config_files/tools__s b/test/tools/config_files/tools__s deleted file mode 100644 index 507973f8be..0000000000 --- a/test/tools/config_files/tools__s +++ /dev/null @@ -1 +0,0 @@ -OPT=TRUE diff --git a/test/tools/gen_test_table.sh b/test/tools/gen_test_table.sh deleted file mode 100755 index 0791ad0447..0000000000 --- a/test/tools/gen_test_table.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh -# - -# this script, when executed in the directory containing the test-driver -# scripts (~/test/system) will loop through the default test -# lists for pre and post tag testing of clm and create an html file -# (test_table.html) with the specifics of each test detailed - -outfile="./test_table.html" - -echo '' > $outfile -echo '' >> $outfile -echo '' >> $outfile -echo '' >> $outfile -echo 'CLM Testing Information Page' >> $outfile -echo '' >> $outfile -echo '' >> $outfile - -######################################################################################### -for input_file in `ls tests_*` ; do - echo '' >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - echo "" >> $outfile - - test_list="" - while read input_line; do - test_list="${test_list}${input_line} " - done < ./${input_file} - - count=0 - ##loop through the tests of input file - for test_id in ${test_list}; do - echo "" >> $outfile - count=`expr $count + 1` - while [ ${#count} -lt 3 ]; do - count="0${count}" - done - echo "" >> $outfile - - master_line=`grep $test_id ./input_tests_master` - dir="" - for arg in ${master_line}; do - arg1=${arg%^*} - arg2=${arg#*^} - if [ -d ../../tools/$arg ]; then - dir=$arg - elif [ -f ./nl_files/$arg ]; then - echo "" >> $outfile - elif [ -f ./config_files/$arg ]; then - echo "" >> $outfile - elif [ -f ./nl_files/$arg1 ] && [ -f ./nl_files/$arg2 ]; then - echo "" >> $outfile - elif [ -f ./nl_files/$arg1 ] && [ -f ./config_files/$arg2 ]; then - echo "" >> $outfile - elif [ -f ../../tools/$dir/$dir.$arg ]; then - echo "" >> $outfile - else - echo "" >> $outfile - fi - done - echo '' >> $outfile - done - echo '
$input_file
test# testid test script arg1 arg2 arg3
$count $arg $arg $arg1^" \ - "$arg2$arg1^" \ - "$arg2$arg $arg
' >> $outfile - echo '
' >> $outfile
-    echo ' ' >> $outfile
-    echo '
' >> $outfile -done -echo '' >> $outfile -echo '' >> $outfile - -exit 0 diff --git a/test/tools/get_cprnc_diffs.sh b/test/tools/get_cprnc_diffs.sh deleted file mode 100755 index 360220cb71..0000000000 --- a/test/tools/get_cprnc_diffs.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# This script extracts lines from the output of cprnc that tell us -# which variables differ between two files -# -# Usage: get_cprnc_diffs filename - -# ---------------------------------------------------------------------- -# SET PARAMETERS HERE -# ---------------------------------------------------------------------- - -# maximum number of differences to extract from the cprnc output -maxdiffs=200 - -# ---------------------------------------------------------------------- -# LOCAL FUNCTIONS DEFINED HERE -# ---------------------------------------------------------------------- - -# This function gets differences for one prefix (e.g., "RMS") -# Usage: get_diffs prefix -# (also uses $infile and $maxdiffs from the parent script) -function get_diffs { - prefix=$1 - outfile=${infile}.${prefix}.$$ - grep "$prefix" $infile > $outfile - numlines=`wc -l $outfile | awk '{print $1}'` - if [ $numlines -gt $maxdiffs ]; then - echo "WARNING: Too many instances of $prefix - only printing last $maxdiffs" - tail -$maxdiffs $outfile - else - cat $outfile - fi - rm $outfile -} - -# ---------------------------------------------------------------------- -# BEGIN MAIN SCRIPT -# ---------------------------------------------------------------------- - -# ---------------------------------------------------------------------- -# Handle command-line arguments -# ---------------------------------------------------------------------- - -if [[ $# -ne 1 ]]; then - echo "Usage: get_cprnc_diffs filename" - exit 1 -fi - -infile=$1 - -# ---------------------------------------------------------------------- -# Do the processing -# ---------------------------------------------------------------------- - -get_diffs RMS -get_diffs FILLDIFF diff --git a/test/tools/input_tests_master b/test/tools/input_tests_master deleted file mode 100644 index 84b98883eb..0000000000 --- a/test/tools/input_tests_master +++ /dev/null @@ -1,54 +0,0 @@ - - -smc#4 TSMscript_tools.sh mkprocdata_map mkprocdata_map_wrap mkprocdata_ne30_to_f19_I2000^tools__ds -blc#4 TBLscript_tools.sh mkprocdata_map mkprocdata_map_wrap mkprocdata_ne30_to_f19_I2000^tools__ds - -sme14 TSMCFGtools.sh gen_domain CFGtools__ds T31.runoptions -ble14 TBLCFGtools.sh gen_domain CFGtools__ds T31.runoptions -sme@4 TSMCFGtools.sh gen_domain CFGtools__ds ne30.runoptions -ble@4 TBLCFGtools.sh gen_domain CFGtools__ds ne30.runoptions - -smg54 TSMtools.sh mksurfdata_map tools__s namelist -blg54 TBLtools.sh mksurfdata_map tools__s namelist - -smi24 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds -bli24 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_T31_crpglc_2000^tools__ds - -smi53 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o -bli53 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__o -smi54 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ds -bli54 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__ds -smi57 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__do -bli57 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_1850^tools__do -smi58 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_crp_1850-2000^tools__do -bli58 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_10x15_crp_1850-2000^tools__do - -smi74 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds -bli74 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850-2000^tools__ds -smi78 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds -bli78 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_brazil_1850^tools__ds -smiT4 TSMscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools__ds -bliT4 TBLscript_tools.sh mksurfdata_map mksurfdata.pl mksrfdt_1x1_numaIA_mp24_2000^tools__ds - -smi#2 TSMscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_ne30np4 -bli#2 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_ne30np4 -smi59 TSMscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 -bli59 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_if10 -smi79 TSMscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_i1x1_brazil -bli79 TBLscript_tools.sh mkmapdata mkmapdata.sh mkmapdata_i1x1_brazil - -smf84 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools -blf84 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_clm4_5^buildtools -smfc4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools -blfc4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Cycle_clm4_5^buildtools -smfg4 TSMscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools -blfg4 TBLscript_tools.sh PTCLM PTCLMmkdata PTCLM_USUMB_Global_clm4_5^buildtools - -smiS4 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional -bliS4 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional -smiS8 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_ndep -bliS8 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_ndep -smiS9 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_T62 -bliS9 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_T62 -smiS0 TSMscript_tools.sh ncl_scripts getregional_datasets.pl getregional_0.5popd -bliS0 TBLscript_tools.sh ncl_scripts getregional_datasets.pl getregional_0.5popd diff --git a/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 b/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 deleted file mode 100644 index f27830a2c4..0000000000 --- a/test/tools/nl_files/PTCLM_USUMB_Cycle_clm4_5 +++ /dev/null @@ -1 +0,0 @@ --s US-UMB -d CSMDATA --mydatadir . --map_gdate 171024 --cycle_forcing --ctsm_root CTSM_ROOT --cime_root CIME_ROOT diff --git a/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 b/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 deleted file mode 100644 index dc4c617dc3..0000000000 --- a/test/tools/nl_files/PTCLM_USUMB_Global_clm4_5 +++ /dev/null @@ -1 +0,0 @@ --s US-UMB -d CSMDATA --mydatadir . --map_gdate 171024 --donot_use_tower_yrs --clmnmlusecase 20thC_transient --pftgrid --soilgrid --ctsm_root CTSM_ROOT --cime_root CIME_ROOT diff --git a/test/tools/nl_files/PTCLM_USUMB_clm4_5 b/test/tools/nl_files/PTCLM_USUMB_clm4_5 deleted file mode 100644 index 5ed93b26bd..0000000000 --- a/test/tools/nl_files/PTCLM_USUMB_clm4_5 +++ /dev/null @@ -1 +0,0 @@ --s US-UMB -d CSMDATA --mydatadir . --map_gdate 171024 --ctsm_root CTSM_ROOT --cime_root CIME_ROOT diff --git a/test/tools/nl_files/gen_domain.T31.runoptions b/test/tools/nl_files/gen_domain.T31.runoptions deleted file mode 100644 index c1fcc07df1..0000000000 --- a/test/tools/nl_files/gen_domain.T31.runoptions +++ /dev/null @@ -1 +0,0 @@ --m CSMDATA/cpl/cpl6/map_gx3v7_to_T31_aave_da_090903.nc -o domain.ocn.gx3v7_test.nc -l domain.lnd.10x15_gx3v7.test.nc diff --git a/test/tools/nl_files/gen_domain.ne30.runoptions b/test/tools/nl_files/gen_domain.ne30.runoptions deleted file mode 100644 index 790969101e..0000000000 --- a/test/tools/nl_files/gen_domain.ne30.runoptions +++ /dev/null @@ -1 +0,0 @@ --m CSMDATA/cpl/cpl6/map_gx1v6_to_ne30np4_aave_da_091227.nc -o domain.ocn.gx1v6_test.nc -l domain.lnd.ne30np4_gx1v6.test.nc diff --git a/test/tools/nl_files/getregional b/test/tools/nl_files/getregional deleted file mode 100644 index 5e5d348e39..0000000000 --- a/test/tools/nl_files/getregional +++ /dev/null @@ -1 +0,0 @@ --SW 52,190 -NE 73,220 -i sample_inlist -o sample_outlist diff --git a/test/tools/nl_files/getregional_05popd b/test/tools/nl_files/getregional_05popd deleted file mode 100644 index 79747ad9cd..0000000000 --- a/test/tools/nl_files/getregional_05popd +++ /dev/null @@ -1 +0,0 @@ --SW 52,190 -NE 73,220 -i sample_inlist_0.5popd -o sample_outlist_0.5popd diff --git a/test/tools/nl_files/getregional_T62 b/test/tools/nl_files/getregional_T62 deleted file mode 100644 index 8288847cf5..0000000000 --- a/test/tools/nl_files/getregional_T62 +++ /dev/null @@ -1 +0,0 @@ --SW 52,190 -NE 73,220 -i sample_inlist_T62 -o sample_outlist_T62 diff --git a/test/tools/nl_files/getregional_ndep b/test/tools/nl_files/getregional_ndep deleted file mode 100644 index 125285f690..0000000000 --- a/test/tools/nl_files/getregional_ndep +++ /dev/null @@ -1 +0,0 @@ --SW 52,190 -NE 73,220 -i sample_inlist_ndep -o sample_outlist_ndep diff --git a/test/tools/nl_files/mkmapdata_if10 b/test/tools/nl_files/mkmapdata_if10 deleted file mode 100644 index 1c30796e2e..0000000000 --- a/test/tools/nl_files/mkmapdata_if10 +++ /dev/null @@ -1 +0,0 @@ --t regional -r 10x15 diff --git a/test/tools/nl_files/mkmapdata_ne30np4 b/test/tools/nl_files/mkmapdata_ne30np4 deleted file mode 100644 index 11066c7b41..0000000000 --- a/test/tools/nl_files/mkmapdata_ne30np4 +++ /dev/null @@ -1 +0,0 @@ --r ne30np4 diff --git a/test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 b/test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 deleted file mode 100644 index af85dcf226..0000000000 --- a/test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 +++ /dev/null @@ -1 +0,0 @@ --i CSMDATA/lnd/clm2/test_mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c170430.nc -o ne30output_onf19grid.nc -m CSMDATA/lnd/clm2/test_mkprocdata_map/map_ne30np4_nomask_to_fv1.9x2.5_nomask_aave_da_c121107.nc -t CSMDATA/lnd/clm2/test_mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c170430.nc -e EXEDIR diff --git a/test/tools/nl_files/mksrfdt_10x15_1850 b/test/tools/nl_files/mksrfdt_10x15_1850 deleted file mode 100644 index daa822804c..0000000000 --- a/test/tools/nl_files/mksrfdt_10x15_1850 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 10x15 -no-crop -y 1850 -exedir EXEDIR diff --git a/test/tools/nl_files/mksrfdt_10x15_crp_1850-2000 b/test/tools/nl_files/mksrfdt_10x15_crp_1850-2000 deleted file mode 100644 index b42c1deb04..0000000000 --- a/test/tools/nl_files/mksrfdt_10x15_crp_1850-2000 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 10x15 -y 1850-2000 -exedir EXEDIR diff --git a/test/tools/nl_files/mksrfdt_1x1_brazil_1850 b/test/tools/nl_files/mksrfdt_1x1_brazil_1850 deleted file mode 100644 index 2330bd082e..0000000000 --- a/test/tools/nl_files/mksrfdt_1x1_brazil_1850 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 1x1_brazil -y 1850-2000 -exedir EXEDIR diff --git a/test/tools/nl_files/mksrfdt_1x1_brazil_1850-2000 b/test/tools/nl_files/mksrfdt_1x1_brazil_1850-2000 deleted file mode 100644 index 2330bd082e..0000000000 --- a/test/tools/nl_files/mksrfdt_1x1_brazil_1850-2000 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 1x1_brazil -y 1850-2000 -exedir EXEDIR diff --git a/test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 b/test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 deleted file mode 100644 index 03304f81eb..0000000000 --- a/test/tools/nl_files/mksrfdt_1x1_numaIA_mp24_2000 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 1x1_numaIA -y 2000 -exedir EXEDIR diff --git a/test/tools/nl_files/mksrfdt_1x1_vancouverCAN_2000 b/test/tools/nl_files/mksrfdt_1x1_vancouverCAN_2000 deleted file mode 100644 index a446e82fcd..0000000000 --- a/test/tools/nl_files/mksrfdt_1x1_vancouverCAN_2000 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 1x1_vancouverCAN -no-crop -y 2000 -exedir EXEDIR diff --git a/test/tools/nl_files/mksrfdt_T31_crpglc_2000 b/test/tools/nl_files/mksrfdt_T31_crpglc_2000 deleted file mode 100644 index ac8ceed1a8..0000000000 --- a/test/tools/nl_files/mksrfdt_T31_crpglc_2000 +++ /dev/null @@ -1 +0,0 @@ --l CSMDATA -r 48x96 -y 2000 -glc_nec 10 -exedir EXEDIR diff --git a/test/tools/show_var_diffs.sh b/test/tools/show_var_diffs.sh deleted file mode 100755 index f462d4ad0c..0000000000 --- a/test/tools/show_var_diffs.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash - -# This script processes a log file that was output by test_driver, -# giving lists of all variables with differences in values (those with -# RMS errors), and all variables with differences in fill patterns. -# -# This assumes that the log file contains output like: -# RMS foo -# RMS bar -# FILLDIFF foo -# FILLDIFF bar -# Some characteristics of these output lines are: -# - they begin with a leading space, followed by RMS or FILLDIFF -# - the variable name is in the second column of the line -# -# Note that (as of 4-5-12) the log file only contains output from the -# last file that didn't match, so this could potentially miss -# something -- especially if there are both h0 and h1 files in the -# comparison. - -# Usage: show_var_diffs logfile - -# ---------------------------------------------------------------------- -# LOCAL FUNCTIONS DEFINED HERE -# ---------------------------------------------------------------------- - -# This function shows the differences for one prefix (e.g., "RMS") -# Usage: show_diffs prefix -# (also uses $logfile from the parent script) -# -# Matches lines that start with the regular expression "^ ${prefix}" -# (note that one leading space is expected before the prefix) -# -# Assumes that the variable name is in the second column of matching lines -function show_diffs { - prefix=$1 - - # first determine if there were warnings relating to this prefix - grep "WARNING: Too many instances of ${prefix}" $logfile > /dev/null - if [ $? -eq 0 ]; then # found a warning - echo "WARNING: Some output was truncated; this may not be a complete list" - fi - - # now make a list of all variables matching this prefix - grep "^ ${prefix}" $logfile > $logfile.tmp.$$ - if [ $? -eq 0 ]; then - awk '{print $2}' $logfile.tmp.$$ | sort | uniq - else - echo "(no differences)" - fi - - rm $logfile.tmp.$$ -} - -# ---------------------------------------------------------------------- -# BEGIN MAIN SCRIPT -# ---------------------------------------------------------------------- - -# ---------------------------------------------------------------------- -# Handle command-line arguments -# ---------------------------------------------------------------------- - -if [[ $# -ne 1 ]]; then - echo "Usage: show_var_diffs logfile" - exit 1 -fi - -logfile=$1 - -# ---------------------------------------------------------------------- -# Do the processing -# ---------------------------------------------------------------------- - -echo "Variables with differences in values:" -show_diffs "RMS" - -echo "" -echo "Variables with differences in fill patterns:" -show_diffs "FILLDIFF" \ No newline at end of file diff --git a/test/tools/test_driver.sh b/test/tools/test_driver.sh deleted file mode 100755 index 935b7d2dd2..0000000000 --- a/test/tools/test_driver.sh +++ /dev/null @@ -1,572 +0,0 @@ -#!/bin/sh -# -# test_driver.sh: driver script for the offline testing of CLM of tools -# -# interactive usage on all machines: -# -# env ./test_driver.sh -i -# -# valid arguments: -# -i interactive usage -# -d debug usage -- display tests that will run -- but do NOT actually execute them -# -f force batch submission (avoids user prompt) -# -h displays this help message -# -# -# **pass environment variables by preceding above commands -# with 'env var1=setting var2=setting ' -# **more details in the CLM testing user's guide, accessible -# from the CLM developers web page - - -#will attach timestamp onto end of script name to prevent overwriting -cur_time=`date '+%H:%M:%S'` - -hostname=`hostname` -echo $hostname -case $hostname in - - ##cheyenne - cheyenne* | r*i*n*) - submit_script="test_driver_cheyenne${cur_time}.sh" - -##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv -cat > ./${submit_script} << EOF -#!/bin/sh -# - -interactive="YES" -input_file="tests_pretag_cheyenne_nompi" -c_threads=36 - - -export INITMODULES="/glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh" -. \$INITMODULES - -module purge -module load ncarenv/1.0 -module load intel/17.0.1 -module load mkl -module load ncarcompilers/0.3.5 -module load netcdf/4.4.1.1 - -module load nco -module load python -module load ncl - - -##omp threads -if [ -z "\$CLM_THREADS" ]; then #threads NOT set on command line - export CLM_THREADS=\$c_threads -fi - -# Stop on first failed test -if [ -z "\$CLM_SOFF" ]; then #CLM_SOFF NOT set - export CLM_SOFF=FALSE -fi - -export CESM_MACH="cheyenne" -export CESM_COMP="intel" - -export NETCDF_DIR=\$NETCDF -export INC_NETCDF=\$NETCDF/include -export LIB_NETCDF=\$NETCDF/lib -export MAKE_CMD="gmake -j " -export CFG_STRING="" -export TOOLS_MAKE_STRING="USER_FC=ifort USER_LINKER=ifort USER_CPPDEFS=-DLINUX" -export MACH_WORKSPACE="/glade/scratch" -export CPRNC_EXE="$CESMDATAROOT/tools/cime/tools/cprnc/cprnc.cheyenne" -dataroot="$CESMDATAROOT" -export TOOLSLIBS="" -export TOOLS_CONF_STRING="--mpilib mpi-serial" - - -echo_arg="" - -EOF -##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to batch script ^^^^^^^^^^^^^^^^^^^ - ;; - - ## DAV cluster - geyser* | caldera* | pronghorn*) - submit_script="test_driver_dav${cur_time}.sh" - -##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv -cat > ./${submit_script} << EOF -#!/bin/sh -# - -interactive="YES" -input_file="tests_posttag_dav_mpi" -c_threads=36 - - -export INITMODULES="/glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/sh" -. \$INITMODULES - -module purge -module load ncarenv/1.0 -module load intel/12.1.5 -module load mkl -module load ncarcompilers -module load netcdf/4.3.3.1 -module load mpich-slurm/3.2.1 - -module load nco -module load python -module load ncl - - -##omp threads -if [ -z "\$CLM_THREADS" ]; then #threads NOT set on command line - export CLM_THREADS=\$c_threads -fi - -# Stop on first failed test -if [ -z "\$CLM_SOFF" ]; then #CLM_SOFF NOT set - export CLM_SOFF=FALSE -fi - -export CESM_MACH="cheyenne" -export CESM_COMP="intel" - -export NETCDF_DIR=\$NETCDF -export INC_NETCDF=\$NETCDF/include -export LIB_NETCDF=\$NETCDF/lib -export MAKE_CMD="gmake -j " -export CFG_STRING="" -export TOOLS_MAKE_STRING="USER_FC=ifort USER_LINKER=ifort USER_CPPDEFS=-DLINUX" -export MACH_WORKSPACE="/glade/scratch" -export CPRNC_EXE="$CESMDATAROOT/tools/cime/tools/cprnc/cprnc.cheyenne" -dataroot="$CESMDATAROOT" -export TOOLSLIBS="" -export TOOLS_CONF_STRING="--mpilib mpich" - - -echo_arg="" - -EOF -##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to batch script ^^^^^^^^^^^^^^^^^^^ - ;; - - ## hobart - hobart* | h*.cgd.ucar.edu) - submit_script="test_driver_hobart_${cur_time}.sh" - export PATH=/cluster/torque/bin:${PATH} - -##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv -cat > ./${submit_script} << EOF -#!/bin/sh -# - -# Name of the queue (CHANGE THIS if needed) -#PBS -q long -# Number of nodes (CHANGE THIS if needed) -#PBS -l nodes=1:ppn=24 -# output file base name -#PBS -N test_dr -# Put standard error and standard out in same file -#PBS -j oe -# Export all Environment variables -#PBS -V -# End of options - -if [ -n "\$PBS_JOBID" ]; then #batch job - export JOBID=\`echo \${PBS_JOBID} | cut -f1 -d'.'\` - initdir=\${PBS_O_WORKDIR} -fi - -if [ "\$PBS_ENVIRONMENT" = "PBS_BATCH" ]; then - interactive="NO" - input_file="tests_posttag_hobart" -else - interactive="YES" - input_file="tests_posttag_hobart_nompi" -fi - -##omp threads -if [ -z "\$CLM_THREADS" ]; then #threads NOT set on command line - export CLM_THREADS=2 -fi -export CLM_RESTART_THREADS=1 - -##mpi tasks -export CLM_TASKS=24 -export CLM_RESTART_TASKS=20 - -export P4_GLOBMEMSIZE=500000000 - - -export CESM_MACH="hobart" - -ulimit -s unlimited -ulimit -c unlimited - -export CESM_COMP="intel" -export TOOLS_MAKE_STRING="USER_FC=ifort USER_CC=icc " -export TOOLS_CONF_STRING=" -mpilib mpi-serial" -export CFG_STRING="" -export INITMODULES="/usr/share/Modules/init/sh" - -. \$INITMODULES -module purge -module load compiler/intel/18.0.3 -module load tool/nco/4.7.5 -module load tool/netcdf/4.6.1/intel - -export NETCDF_DIR=\$NETCDF_PATH -export INC_NETCDF=\${NETCDF_PATH}/include -export LIB_NETCDF=\${NETCDF_PATH}/lib -export MAKE_CMD="gmake -j 5" ##using hyper-threading on hobart -export MACH_WORKSPACE="/scratch/cluster" -export CPRNC_EXE=/fs/cgd/csm/tools/cprnc_hobart/cprnc -export DATM_QIAN_DATA_DIR="/project/tss/atm_forcing.datm7.Qian.T62.c080727" -dataroot="/fs/cgd/csm" -export TOOLSSLIBS="" -echo_arg="-e" - -EOF -##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to batch script ^^^^^^^^^^^^^^^^^^^ - ;; - - * ) - echo "Only setup to work on: cheyenne and hobart" - exit - - -esac - -##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv writing to batch script vvvvvvvvvvvvvvvvvvv -cat >> ./${submit_script} << EOF - -export CPRNC_OPT="" -if [ -n "\${CLM_JOBID}" ]; then - export JOBID=\${CLM_JOBID} -fi -##check if interactive job - -if [ "\$interactive" = "YES" ]; then - - if [ -z "\${JOBID}" ]; then - export JOBID=\$\$ - fi - echo "test_driver.sh: interactive run - setting JOBID to \$JOBID" - if [ \$0 = "test_driver.sh" ]; then - initdir="." - else - initdir=\${0%/*} - fi -else - echo "ERROR: you *always* need to use the interactive option (-i)" - echo " currently doesn't work without it" - exit 3 -fi - -##establish script dir and clm_root -if [ -f \${initdir}/test_driver.sh ]; then - export CLM_SCRIPTDIR=\`cd \${initdir}; pwd \` - export CLM_ROOT=\`cd \${CLM_SCRIPTDIR}/../..; pwd \` - export CTSM_ROOT=\${CLM_ROOT} - if [ -d \${CLM_ROOT}/cime ]; then - export CIME_ROOT=\${CLM_ROOT}/cime - else - export CIME_ROOT=\${CLM_ROOT}/../../cime - fi - if [ ! -d \${CIME_ROOT} ]; then - echo "ERROR: trouble finding the CIME_ROOT directory: \$CIME_ROOT" - exit 3 - fi -else - if [ -n "\${CLM_ROOT}" ] && [ -f \${CLM_ROOT}/test/tools/test_driver.sh ]; then - export CLM_SCRIPTDIR=\`cd \${CLM_ROOT}/test/tools; pwd \` - else - echo "ERROR: unable to determine script directory " - echo " if initiating batch job from directory other than the one containing test_driver.sh, " - echo " you must set the environment variable CLM_ROOT to the full path of directory containing " - echo " . " - exit 3 - fi -fi - -##output files -clm_log=\${initdir}/td.\${JOBID}.log -if [ -f \$clm_log ]; then - rm \$clm_log -fi -clm_status=\${initdir}/td.\${JOBID}.status -if [ -f \$clm_status ]; then - rm \$clm_status -fi - -##setup test work directory -if [ -z "\$CLM_TESTDIR" ]; then - export CLM_TESTDIR=\${MACH_WORKSPACE}/\$LOGNAME/clmTests/test-driver.\${JOBID} - if [ -d \$CLM_TESTDIR ] && [ \$CLM_RETAIN_FILES != "TRUE" ]; then - rm -r \$CLM_TESTDIR - fi -fi -if [ ! -d \$CLM_TESTDIR ]; then - mkdir -p \$CLM_TESTDIR - if [ \$? -ne 0 ]; then - echo "ERROR: unable to create work directory \$CLM_TESTDIR" - exit 4 - fi -fi - -## MCT and PIO build directorys -export MCT_LIBDIR=\$CLM_TESTDIR/mct -export PIO_LIBDIR=\$CLM_TESTDIR/pio - -##set our own environment vars -export CSMDATA=\${dataroot}/inputdata -export DIN_LOC_ROOT=\${CSMDATA} -export MPI_TYPE_MAX=100000 - -##process other env vars possibly coming in -if [ -z "\$CLM_RETAIN_FILES" ]; then - export CLM_RETAIN_FILES=FALSE -fi -if [ -n "\${CLM_INPUT_TESTS}" ]; then - input_file=\$CLM_INPUT_TESTS -else - input_file=\${CLM_SCRIPTDIR}/\${input_file} -fi -if [ ! -f \${input_file} ]; then - echo "ERROR: unable to locate input file \${input_file}" - exit 5 -fi - -if [ \$interactive = "YES" ]; then - echo "reading tests from \${input_file}" -else - echo "reading tests from \${input_file}" >> \${clm_log} -fi - -num_tests=\`wc -w < \${input_file}\` -echo "STATUS OF CLM TESTING UNDER JOB \${JOBID}; scheduled to run \$num_tests tests from:" >> \${clm_status} -echo "\$input_file" >> \${clm_status} -echo "" >> \${clm_status} -echo " on machine: $hostname" >> \${clm_status} -if [ -n "${BL_ROOT}" ]; then - echo "tests of baseline will use source code from:" >> \${clm_status} - echo "\$BL_ROOT" >> \${clm_status} -fi -if [ \$interactive = "NO" ]; then - echo "see \${clm_log} for more detailed output" >> \${clm_status} -fi -echo "" >> \${clm_status} - -test_list="" -while read input_line; do - test_list="\${test_list}\${input_line} " -done < \${input_file} - - -##initialize flags, counter -skipped_tests="NO" -pending_tests="NO" -count=0 - -##loop through the tests of input file -for test_id in \${test_list}; do - count=\`expr \$count + 1\` - while [ \${#count} -lt 3 ]; do - count="0\${count}" - done - - master_line=\`grep \$test_id \${CLM_SCRIPTDIR}/input_tests_master\` - status_out="" - for arg in \${master_line}; do - status_out="\${status_out}\${arg} " - done - - if [ -z "\$status_out" ]; then - echo "No test matches \$test_id in \${CLM_SCRIPTDIR}/input_tests_master" - exit 3 - fi - - test_cmd=\${status_out#* } - - status_out="\${count} \${status_out}" - - if [ \$interactive = "YES" ]; then - echo "" - echo "***********************************************************************************" - echo "\${status_out}" - echo "***********************************************************************************" - else - echo "" >> \${clm_log} - echo "***********************************************************************************"\ - >> \${clm_log} - echo "\$status_out" >> \${clm_log} - echo "***********************************************************************************"\ - >> \${clm_log} - fi - - if [ \${#status_out} -gt 94 ]; then - status_out=\`echo "\${status_out}" | cut -c1-100\` - fi - while [ \${#status_out} -lt 97 ]; do - status_out="\${status_out}." - done - - echo \$echo_arg "\$status_out\c" >> \${clm_status} - - if [ \$interactive = "YES" ]; then - \${CLM_SCRIPTDIR}/\${test_cmd} - rc=\$? - else - \${CLM_SCRIPTDIR}/\${test_cmd} >> \${clm_log} 2>&1 - rc=\$? - fi - if [ \$rc -eq 0 ]; then - echo "PASS" >> \${clm_status} - elif [ \$rc -eq 255 ]; then - echo "SKIPPED*" >> \${clm_status} - skipped_tests="YES" - elif [ \$rc -eq 254 ]; then - echo "PENDING**" >> \${clm_status} - pending_tests="YES" - else - echo " rc=\$rc FAIL" >> \${clm_status} - if [ "\$CLM_SOFF" = "TRUE" ]; then - echo "stopping on first failure" >> \${clm_status} - echo "stopping on first failure" >> \${clm_log} - exit 6 - fi - fi -done - -echo "end of input" >> \${clm_status} -if [ \$interactive = "YES" ]; then - echo "end of input" -else - echo "end of input" >> \${clm_log} -fi - -if [ \$skipped_tests = "YES" ]; then - echo "* please verify that any skipped tests are not required of your clm commit" >> \${clm_status} -fi -if [ \$pending_tests = "YES" ]; then - echo "** tests that are pending must be checked manually for a successful completion" >> \${clm_status} - if [ \$interactive = "NO" ]; then - echo " see the test's output in \${clm_log} " >> \${clm_status} - echo " for the location of test results" >> \${clm_status} - fi -fi - -if [ "\$interactive" = "YES" ]; then - passInt="test_driver.sh-i" -else - passInt="test_driver.sh" -fi - -../../bld/unit_testers/xFail/wrapClmTests.pl -statusFile "\${clm_status}" -numberOfTests "\${num_tests}" -callingScript "\${passInt}" - -exit 0 - -EOF -##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ writing to batch script ^^^^^^^^^^^^^^^^^^^ - - -chmod a+x $submit_script -if [ ! -z "$CLM_RETAIN_FILES" ]; then - export CLM_RETAIN_FILES="FALSE" -fi -arg1=${1##*-} -case $arg1 in - [iI]* ) - debug="NO" - interactive="YES" - compile_only="NO" - export debug - export interactive - export compile_only - ./${submit_script} - exit 0 - ;; - - [cC]* ) - debug="NO" - interactive="YES" - compile_only="YES" - export debug - export CLM_RETAIN_FILES="TRUE" - export interactive - export compile_only - export CLM_RETAIN_FILES="TRUE" - ./${submit_script} - exit 0 - ;; - - [dD]* ) - debug="YES" - interactive="YES" - compile_only="NO" - export debug - export interactive - export compile_only - ./${submit_script} - exit 0 - ;; - - [fF]* ) - debug="NO" - interactive="NO" - compile_only="NO" - export debug - export interactive - export compile_only - ;; - - "" ) - echo "" - echo "**********************" - echo "$submit_script has been created and will be submitted to the batch queue..." - echo "(ret) to continue, (a) to abort" - read ans - case $ans in - [aA]* ) - echo "aborting...type ./test_driver.sh -h for help message" - exit 0 - ;; - esac - debug="NO" - interactive="NO" - compile_only="NO" - export debug - export interactive - export compile_only - ;; - - * ) - echo "" - echo "**********************" - echo "usage on cheyenne and hobart: " - echo "./test_driver.sh -i" - echo "" - echo "valid arguments: " - echo "-i interactive usage" - echo "-c compile-only usage (run configure and compile do not run clm)" - echo "-d debug-only usage (run configure and build-namelist do NOT compile or run clm)" - echo "-f force batch submission (avoids user prompt)" - echo "-h displays this help message" - echo "" - echo "**pass environment variables by preceding above commands " - echo " with 'env var1=setting var2=setting '" - echo "" - echo "**********************" - exit 0 - ;; -esac - -echo "submitting..." -case $hostname in - #default - * ) - echo "no submission capability on this machine use the interactive option: -i" - exit 0 - ;; - -esac -exit 0 diff --git a/test/tools/tests_posttag_dav_mpi b/test/tools/tests_posttag_dav_mpi deleted file mode 100644 index ef42215791..0000000000 --- a/test/tools/tests_posttag_dav_mpi +++ /dev/null @@ -1,2 +0,0 @@ -smi#2 bli#2 -smi59 bli59 diff --git a/test/tools/tests_posttag_hobart_nompi b/test/tools/tests_posttag_hobart_nompi deleted file mode 100644 index 4655f29853..0000000000 --- a/test/tools/tests_posttag_hobart_nompi +++ /dev/null @@ -1,6 +0,0 @@ -smc#4 blc#4 -smi54 bli54 -smi57 bli57 -smiT4 bliT4 -smf84 blf84 -smfc4 blfc4 diff --git a/test/tools/tests_posttag_nompi_regression b/test/tools/tests_posttag_nompi_regression deleted file mode 100644 index f1ebea192d..0000000000 --- a/test/tools/tests_posttag_nompi_regression +++ /dev/null @@ -1,20 +0,0 @@ -smc#4 blc#4 -sme14 ble14 -sm@14 bl@14 -smg54 blg54 -smi24 bli24 -smi53 bli53 -smi54 bli54 -smi57 bli57 -smi58 bli58 -smi74 bli74 -smi78 bli78 -smiT4 bliT4 -smf84 blf84 -smfc4 blfc4 -smfg4 blfg4 -smiS4 bliS4 -smiS8 bliS8 -smiS9 bliS9 -smiS0 bliS0 -smiS0 bliS0 diff --git a/test/tools/tests_pretag_cheyenne_nompi b/test/tools/tests_pretag_cheyenne_nompi deleted file mode 100644 index 1795119813..0000000000 --- a/test/tools/tests_pretag_cheyenne_nompi +++ /dev/null @@ -1,15 +0,0 @@ -smc#4 blc#4 -sme14 ble14 -sme@4 ble@4 -smg54 blg54 -smi24 bli24 -smi53 bli53 -smi54 bli54 -smi57 bli57 -smi58 bli58 -smiS4 bliS4 -smi74 bli74 -smiT4 bliT4 -smf84 blf84 -smfc4 blfc4 -smfg4 blfg4 diff --git a/tools/README b/tools/README deleted file mode 100644 index 006d3ac063..0000000000 --- a/tools/README +++ /dev/null @@ -1,280 +0,0 @@ -$CTSMROOT/tools/README Jun/08/2018 - -CLM tools for analysis of CLM history files -- or for creation or -modification of CLM input files. - -I. General directory structure: - - $CTSMROOT/tools - mksurfdata_map --- Create surface datasets. - (NOTE: interpinic now longer included as now an online capability in CLM) - - mkmapgrids ------- Create regular lat/lon SCRIP grid files needed by mkmapdata - mkmapdata -------- Create SCRIP mapping data from SCRIP grid files (uses ESMF) - mkprocdata_map --- Convert output unstructured grids into a 2D format that - can be plotted easily - ncl_scripts ------ NCL post or pre processing scripts. - - cime-tools ($CIMEROOT/tools/) (CIMEROOT is ../cime for a CTSM checkout and ../../../cime for a CESM checkout) - $CIMEROOT/mapping/gen_domain_files - gen_domain ------- Create data model domain datasets from SCRIP mapping datasets. - -II. Notes on building/running for each of the above tools: - - Each tool that has FORTRAN source code (mksurfdata_map and mkprocdata_map) has the following files: - - README ------- Specific help for using the specific tool and help on specific - files in that directory. - src/Filepath ----- List of directories needed to build the tool - (some files in ../src directories are required). - src/Makefile ----- GNU Makefile to build the tool - (these are identical between tools. - src/Macros.custom Customization of make macros for the particular tool in question - src/Srcfiles ----- List of source files that are needed. - src/Mkdepends ---- Dependency generator program - - mkmapdata, mkmapgrids and ncl_scripts only contain scripts so don't have the above build files. - - Most tools have copies of files from other directories -- see the README.filecopies - file for more information on this. - - Tools may also have files with the directory name followed by namelist to provide sample namelists. - - .namelist ------ Namelist to create a global file. - - These files are also used by the test scripts to test the tools (see the - README.testing) file. - - NOTE: Be sure to change the path of the datasets references by these namelists to - point to where you have exported your CESM inputdata datasets. - - To build: - - cd - setenv INC_NETCDF - setenv LIB_NETCDF - gmake - - The process will create a file called "Depends" which has the dependencies - for the build of each file on other files. - - By default some codes may be compiled non-optimized - so that you can use the debugger, and with bounds-checking, and float trapping on. - To speed up do the following... - - gmake OPT=TRUE (by default already on for interpinic and mksurfdata_map) - - Also some of the tools allow for OpenMP shared memory parallelism - (such as interpinic and mksurfdata) with - - gmake SMP=TRUE - - To run a program with a namelist: - - ./program < namelist - - To get help on running a program with command line options (e.g., interpinic): - - ./program - - To run a program built with SMP=TRUE: - - setenv OMP_NUM_THREADS= - - run normally as above - -III. Process sequence to create input datasets needed to run CLM - - 1.) Create SCRIP grid files (if needed) - - a.) For standard resolutions these files will already be created. (done) - - b.) To create regular lat-lon regional/single-point grids run mknoocnmap.pl - - This will create both SCRIP grid files and a mapping file that will - be valid if the region includes NO ocean whatsoever (so you can skip step 2). - You can also use this script to create SCRIP grid files for a region - (or even a global grid) that DOES include ocean if you use step 2 to - create mapping files for it (simply discard the non-ocean map created by - this script). - - Example, for single-point over Boulder Colorado. - - cd mkmapdata - ./mknoocnmap.pl -p 40,255 -n 1x1_boulderCO - - c.) General case - - You'll need to convert or create SCRIP grid files on your own (using scripts - or other tools) for the general case where you have an unstructured grid, or - a grid that is not regular in latitude and longitude. - - example format - ================== - netcdf fv1.9x2.5_090205 { - dimensions: - grid_size = 13824 ; - grid_corners = 4 ; - grid_rank = 2 ; - variables: - double grid_center_lat(grid_size) ; - grid_center_lat:units = "degrees" ; - double grid_center_lon(grid_size) ; - grid_center_lon:units = "degrees" ; - double grid_corner_lat(grid_size, grid_corners) ; - grid_corner_lat:units = "degrees" ; - double grid_corner_lon(grid_size, grid_corners) ; - grid_corner_lon:units = "degrees" ; - int grid_dims(grid_rank) ; - int grid_imask(grid_size) ; - grid_imask:units = "unitless" ; - - 2.) Create ocean to atmosphere mapping file (if needed) - - a.) Standard resolutions (done) - - If this is a standard resolution with a standard ocean resolution -- this - step is already done, the files already exist. - - b.) Region without Ocean (done in step 1.b) - - IF YOU RAN mknoocnmap.pl FOR A REGION WITHOUT OCEAN THIS STEP IS ALREADY DONE. - - c.) New atmosphere or ocean resolution - - If the region DOES include ocean, use $CIMEROOT/tools/mapping/gen_domain_files/gen_maps.sh to create a - mapping file for it. - - Example: - - cd $CIMEROOT/tools/mapping/gen_domain_files - ./gen_maps.sh -focn -fatm -nocn -natm - - - 3.) Add SCRIP grid file(s) created in (1) into XML database in CLM (optional) - - See the "Adding New Resolutions or New Files to the build-namelist Database" - Chapter in the CLM User's Guide - - http://www.cesm.ucar.edu/models/cesm1.0/clm/models/lnd/clm/doc/UsersGuide/book1.html - - If you don't do this step, you'll need to specify the file to mkmapdata - in step (3) using the "-f" option. - - 4.) Create mapping files for use by mksurfdata_map with mkmapdata - (See mkmapdata/README for more help on doing this) - - - this step uses the results of (1) that were entered into the XML database - by step (3). If you don't enter datasets in, you need to specify the - SCRIP grid file using the "-f" option to mkmapdata.sh. - - Example: to generate all necessary mapping files for the ne30np4 grid - - cd mkmapdata - ./mkmapdata.sh -r ne30np4 - - 5.) Add mapping file(s) created in step (4) into XML database in CLM (optional) - - See notes on doing this in step (3) above. - Edit ../bld/namelist_files/namelist_defaults_clm.xml to incorporate new - mapping files. - - If you don't do this step, you'll need to specify the grid resolution name - and file creation dates to mksurfdata_map in step (5) below. - - 6.) Convert map of ocean to atm for use by DATM and CLM with gen_domain - (See $CIMEROOT/tools/mapping/README for more help on doing this) - - - gen_domain uses the map from step (2) (or previously created CESM maps) - - Example: - - cd $CIMEROOT/tools/mapping/gen_domain_files/src - gmake - cd .. - setenv CDATE 090206 - setenv OCNGRIDNAME gx1v6 - setenv ATMGRIDNAME fv1.9x2.5 - setenv MAPFILE $CSMDATA/cpl/cpl6/map_${OCNGRIDNAME}_to_${ATMGRIDNAME}_aave_da_${CDATE}.nc - ./gen_domain -m $MAPFILE -o $OCNGRIDNAME -l $ATMGRIDNAME - - Normally for I compsets running CLM only you will discard the ocean domain - file, and only use the atmosphere domain file for datm and as the fatmlndfrc - file for CLM. Output domain files will be named according to the input OCN/LND - gridnames. - - 7.) Create surface datasets with mksurfdata_map - (See mksurfdata_map/README for more help on doing this) - - - Run mksurfdata_map/mksurfdata.pl - - This step uses the results of step (4) entered into the XML database - in step (5). - - If datasets were NOT entered into the XML database, set the resolution - to "usrspec" and use the "-usr_gname", and "-usr_gdate" options. - - Example: for 0.9x1.25 resolution - - cd mksurfdata_map/src - gmake - cd .. - ./mksurfdata.pl -r 0.9x1.25 - - NOTE that surface dataset will be used by default for fatmgrid - and it will - contain the lat,lon,edges and area values for the atm grid - ASSUMING that - the atm and land grid are the same - - 8.) Interpolate initial conditions using interpinic (optional) - (See interpinic/README for more help on doing this) - - 9.) Add new files to XML data or using user_nl_clm (optional) - - See notes on doing this in step (3) above. - -IV. Example of creating single-point datasets without entering into XML database. - - Here we apply the process described in III. for a single-point dataset - where we don't enter the datasets into the XML database (thus skipping - steps 3, 5 and 9), but use the needed command line options to specify where the - files are. This also skips step (2) since step 1 creates the needed mapping file. - We also skip step (8) and do NOT create a finidat file. - - 0.) Set name of grid to use and the creation date to be used later... - setenv GRIDNAME 1x1_boulderCO - setenv CDATE `date +%y%m%d` - 1.) SCRIP grid and atm to ocn mapping file - cd mkmapdata - ./mknoocnmap.pl -p 40,255 -n $GRIDNAME - # Set pointer to MAPFILE that will be used in step (6) - setenv MAPFILE `pwd`/map_${GRIDNAME}_noocean_to_${GRIDNAME}_nomask_aave_da_${CDATE}.nc - cd ../.. - 2.) skip - 3.) skip - 4.) Mapping files needed for mksurfdata_map - cd mkmapdata - setenv GRIDFILE ../mkmapgrids/SCRIPgrid_${GRIDNAME}_nomask_${CDATE}.nc - ./mkmapdata.sh -r $GRIDNAME -f $GRIDFILE -t regional - cd ../.. - 5.) skip - 6.) Generate domain file for datm and CLM - cd $CIMEROOT/tools/mapping/gen_domain_files/src - gmake - cd .. - setenv OCNDOM domain.ocn_noocean.nc - setenv ATMDOM domain.lnd.{$GRIDNAME}_noocean.nc - ./gen_domain -m $MAPFILE -o $OCNDOM -l $ATMDOM - 7.) Create surface dataset for CLM - cd mksurfdata_map/src - gmake - cd .. - ./mksurfdata.pl -r usrspec -usr_gname $GRIDNAME -usr_gdate $CDATE - 8.) skip - 9.) skip - -V. Notes on which input datasets are needed for CLM - - global or regional/single-point grids - - need fsurdata and fatmlndfrc - - fsurdata ---- from mksurfdata_map in step (III.7) - fatmlndfrc -- use the domain.lnd file from gen_domain in step (III.6) - diff --git a/tools/README.filecopies b/tools/README.filecopies deleted file mode 100644 index 5ab2bc96d1..0000000000 --- a/tools/README.filecopies +++ /dev/null @@ -1,38 +0,0 @@ -tools/README.filecopies May/26/2011 - -There are several files that are copies of the original files from -either CTSM src/main, cime/src/share/utils, -cime/src/share/unit_test_stubs, or copies from other tool -directories. By having copies the tools can all be made stand-alone, -but any changes to the originals will have to be put into the tool -directories as well. - -I. Files that are IDENTICAL: - - 1. csm_share files copied that should be identical to cime/share/utils: - - shr_kind_mod.F90 - shr_const_mod.F90 - shr_log_mod.F90 - shr_timer_mod.F90 - shr_string_mod.F90 - shr_file_mod.F90 - - 2. csm_share files copied that should be identical to cime/share/csm_share/unit_testers: - - test_mod.F90 - -II. Files with differences - - 1. csm_share files copied with differences: - - shr_sys_mod.F90 - Remove mpi abort and reference to shr_mpi_mod.F90. - - 2. CTSM src/utils files with differences: - - fileutils.F90 --- Remove use of masterproc and spmdMod and endrun in abortutils. - - 3. Files in mksurfdata_map - - mkvarpar.F90 - nanMod.F90 diff --git a/tools/README.testing b/tools/README.testing deleted file mode 100644 index 9c386a3b26..0000000000 --- a/tools/README.testing +++ /dev/null @@ -1,58 +0,0 @@ -tools/README.testing May/23/2011 - -There is automated testing for all of the tools and scripts under this tools directory. -The tests are in the test/tools directory and are any of the scripts -that have "tools" in the name. There are several assumptions made in order for the -testing to work. - - -1.) Executable name is the same as the directory name - -The name of the executable program is the same as the directory name of the tool. - -2.) Build works the same for any Fortran tools - -The build for any Fortran tools should work the same way, with the same options -and required files for it. The files: Makefile, Mkdepends, Filepath and Srcfile -are expected to exist in the tool "src" sub-directory. To make maintaining these files easier -in general the Makefile and Mkdepends files should be kept identical other than -default settings for OPT and SMP and the output executable name. - -Options to the Makefile: - - LIB_NETCDF --- Library directory location of NetCDF. (defaults to /usr/local/lib) - INC_NETCDF --- Include directory location of NetCDF. (defaults to /usr/local/include) - MOD_NETCDF --- Module directory location of NetCDF. (defaults to $LIB_NETCDF) - USER_FC ------ Allow user to override the default Fortran compiler specified in Makefile. - USER_FCTYP --- Allow user to override the default type of Fortran compiler - (Linux and USER_FC=ftn only). - USER_CC ------ Allow user to override the default C compiler specified in Makefile - (Linux only). - USER_LINKER -- Allow user to override the default linker specified in Makefile. - SMP ---------- Shared memory Multi-processing (TRUE or FALSE) [default is FALSE] - OPT ---------- Use optimized options. (TRUE or FALSE) - -3.) Successful completion of the tool ends with "Successfully ..." - -After the tool completes it should have an unique string telling of the -successful completion of the file that is searchable in the log file starting -with "Successfully ". If this string isn't found in the log file, it -will be assumed by the test setup that the test failed. - -4.) NetCDF files are created or modified - -It is assumed that NetCDF files are created and/or modified by the process. And if -NetCDF files are NOT created -- something went wrong. For some scripts that copy files -to other locations this means an "-nomv" option needs to be invoked (and one provided) -so that it leaves the files created in the current directory. - -5.) Namelist examples exist .* namelist files - -To specify options for the running of the tool, sample namelist files -are provided or a sample run options file. These files can EITHER be in the -tool directory OR the ../../test/tools/nl_files directory. - -6.) Specific tests for run scripts - -For tools that have scripts to create namelists and run the tool for you, there -are customized tests to run these tools. diff --git a/tools/mkmapdata/README b/tools/mkmapdata/README deleted file mode 100644 index b865e72f2d..0000000000 --- a/tools/mkmapdata/README +++ /dev/null @@ -1,87 +0,0 @@ -$CTSMROOT/tools/mkmapdata/README Jun/08/2018 - -The routines in this directory create a mapping dataset from -SCRIP grid files to map from one grid to another. These mapping files -are used by either CLM or mksurfdata_map to regrid from one resolution -to another. - -The script uses ESMF and requires that ESMF be built and the path -for ESMF binary files (using the program ESMF_RegridWeightGen) -be given as input to the script. You need to build at least -two versions, one with mpiuni and one with mpi. Both versions -also need to be built with NetCDF rather than the default -IO version. - -Currently uses: ESMF7.0.0 - -Do the following for help with the different options to the script... - - ./mkmapdata.sh -help - -The following steps provide a method to create the executable -and generate the grid map dataset: - -0) Background tasks you only have to do once - - a.) Export the input SCRIP grid files for the resolutions you'll need - - Most of these files are on the Subversion inputdata server at... - - https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/lnd/clm2/mappingdata/grids/ - - Supported machines also have a copy on the CESM DIN_LOC_ROOT location - for that machine. - - b.) Obtain and build the versions of ESMF required for this script - -The version needs to support ESMF_RegridWeightGen and support the -options passed to it in the mkmapdata.sh script. As such it needs -to be built with NetCDF. You also need to build at least one -version with mpiuni and one with an mpi library. You also need -a version that supports the options: --netcdf4, --64bit_offset -and --src_type UGRID. - - http://www.earthsystemmodeling.org/ - -You may need more than one version to do everything above. On cheyenne -we use ESMF7.0.0. - -The version of NetCDF used with ESMF needs to be version 4.1 or higher -and compiled with the NetCDF4 file format enabled (with HDF5 compression). -That will enable the --netcdf4 and --64bit_offset options to be used. - -1) cd to this directory - -2) Create map dataset(s) - Option A.) Use mkmapdata.sh directly - run script(e.g.): (see header of mkmapdata.sh for other environment that can be set) - - Example for standard resolutions - ./mkmapdata.sh -r 10x15 - Example for non-standard resolutions where you provide an input SCRIP grid file. - ./mkmapdata.sh -f - - Option B.) Alternatively, run regridbatch.sh to run mkmapdata.sh for a bunch of - different resolutions. - - Option C.) Alternatively, run mknoocnmap.pl to create a single-point/regional - map for an area without ocean. - - ./mknoocnmap.pl -help # for help on this script - -3) move (and rename if appropriate) generated map datasets - to $DIN_LOC_ROOT/lnd/clm/mappingdata/maps, etc. - - -Important files: - - regridbatch.sh ------- Script to run mkmapdata.sh for many resolutions on cheyenne - regridgeyser.sh ------ Script to run mkmapdata.sh for many resolutions on geyser - mvNimport.sh --------- Script to copy and import mapping files in for many resolutions - mkmapdata.sh --------- Script to create mapping datasets for a given resolution - - mknoocnmap.pl -------- Script to create unity mapping dataset for single-point - or regional studies over land-only (no ocean). - mkunitymap.ncl ------- NCL script to create a unity map -- ran by above script - rmdups.ncl ----------- NCL script to remove duplicate mapping points - diff --git a/tools/mkmapdata/createXMLEntries.pl b/tools/mkmapdata/createXMLEntries.pl deleted file mode 100755 index c65e6888f7..0000000000 --- a/tools/mkmapdata/createXMLEntries.pl +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env perl - -# Creates a file giving XML entries for all the mapping files in the -# current directory (mapping_entries.txt). Also creates another file -# giving commands to move these files to the inputdata space -# (mv_cmds.sh). -# -# Should be run with no arguments. -# -# See also bld/namelist_files/createMapEntry.pl, and mvNimport.sh in -# the current directory for scripts that share some of the -# functionality of this script. - -# Bill Sacks -# March, 2013 - -use strict; - -# ---------------------------------------------------------------------- -# FUNCTIONS -# ---------------------------------------------------------------------- - -# Given a map filename, returns a hash giving the resolutions and -# masks implicit in that filename. -# Inputs: -# - filename -# Output: -# - hash containing: -# - filename -# - from_res -# - from_mask -# - to_res -# - to_mask -# Or does a bare return if the filename doesn't match the expected pattern -sub get_resolutions_and_masks { - my $filename = shift; - - # The following match assumes that the destination mask is - # "nomask". This match will tolerate underscores in the - # destination grid (e.g., 5x5_amazon), but be careful about - # underscores in the source grid or source mask! - if ($filename =~ m/^map_(.*)_(.*)_to_(.*)_nomask/) { - my $from_res=$1; - my $from_mask=$2; - my $to_res=$3; - my $to_mask="nomask"; - - my %info = (filename => $filename, - from_res => $from_res, - from_mask => $from_mask, - to_res => $to_res, - to_mask => $to_mask); - - return %info; - } - else { - return; - } -} - - -# ---------------------------------------------------------------------- -# PARAMETERS DEFINED HERE -# ---------------------------------------------------------------------- - -my $CSMDATA = "/glade/p/cesm/cseg/inputdata"; -my $maps_dir = "lnd/clm2/mappingdata/maps"; # directory where mapping files are stored within the inputdata directory - -# ---------------------------------------------------------------------- -# BEGIN MAIN PROGRAM -# ---------------------------------------------------------------------- - -my @files = glob "map*.nc"; - -# Make a hash containing all of the files at each destination resolution. -# The keys of the hash are destination resolutions; the values are -# references to arrays of hash references, where these low-level -# hashes are the return values of get_resolutions_and_masks. -my %dest_resols; -foreach my $file (@files) { - my %info = get_resolutions_and_masks($file); - if (%info) { - my $to_res = $info{'to_res'}; - push @{$dest_resols{$to_res}}, \%info; - } - else { - warn "WARNING: $file doesn't match expected mapping filename pattern; skipping\n"; - } -} - -open MAP_ENTRIES, ">", "mapping_entries.txt"; -open MV_CMDS, ">", "mv_cmds.sh"; - -# Output xml entries (and mv commands) grouped by destination resolution -foreach my $to_res (sort keys %dest_resols) { - my $full_maps_dir = "$maps_dir/$to_res"; - - foreach my $info_ref (@{$dest_resols{$to_res}}) { - my $filename = ${$info_ref}{'filename'}; - my $from_res = ${$info_ref}{'from_res'}; - my $from_mask = ${$info_ref}{'from_mask'}; - my $to_res = ${$info_ref}{'to_res'}; - my $to_mask = ${$info_ref}{'to_mask'}; - - print MV_CMDS "mv $filename $CSMDATA/$full_maps_dir/$filename\n"; - print MAP_ENTRIES "$full_maps_dir/$filename\n"; - } - - # Print blank line between destination grids - print MAP_ENTRIES "\n"; -} - -system "chmod", "755", "mv_cmds.sh"; -close MAP_ENTRIES; -close MV_CMDS; diff --git a/tools/mkmapdata/mkmapdata.sh b/tools/mkmapdata/mkmapdata.sh deleted file mode 100755 index 995bde9e63..0000000000 --- a/tools/mkmapdata/mkmapdata.sh +++ /dev/null @@ -1,539 +0,0 @@ -#!/bin/bash -#---------------------------------------------------------------------- -# -# mkmapdata.sh -# -# Create needed mapping files for mksurfdata_map and CLM. -# -# Example to run for an output resolution of 4x5 -# -# mkmapdata.sh -r 4x5 -# -# valid arguments: -# -f Input grid filename -# -t Output type, supported values are [regional, global] -# -r Output resolution -# -b use batch mode (not default) -# -l list mapping files required (so can use check_input_data to get them) -# -d debug usage -- display mkmapdata that will be run but don't execute them -# -v verbose usage -- log more information on what is happening -# -h displays this help message -# -# You can also set the following env variables: -# -# ESMFBIN_PATH - Path to ESMF binaries -# CSMDATA ------ Path to CESM input data -# MPIEXEC ------ Name of mpirun executable -# REGRID_PROC -- Number of MPI processors to use -# -#---------------------------------------------------------------------- -echo $0 -dir=${0%/*} -if [ "$dir" = "$0" ];then - dir="." -fi -outfilelist="clm.input_data_list" -default_res="10x15" - -#---------------------------------------------------------------------- -# SET SOME DEFAULTS -- if not set via env variables outside - -if [ -z "$CSMDATA" ]; then - CSMDATA=/glade/p/cesm/cseg/inputdata -fi -#---------------------------------------------------------------------- -# Usage subroutine -usage() { - echo "" - echo "**********************" - echo "usage:" - echo "./mkmapdata.sh" - echo "" - echo "valid arguments: " - echo "[-f|--gridfile ] " - echo " Full pathname of model SCRIP grid file to use " - echo " This variable should be set if this is not a supported grid" - echo " This variable will override the automatic generation of the" - echo " filename generated from the -res argument " - echo " the filename is generated ASSUMING that this is a supported " - echo " grid that has entries in the file namelist_defaults_clm.xml" - echo " the -r|--res argument MUST be specied if this argument is specified" - echo "[-r|--res ]" - echo " Model output resolution (default is $default_res)" - echo "[-t|--gridtype ]" - echo " Model output grid type" - echo " supported values are [regional,global], (default is global)" - echo "[-b|--batch]" - echo " Toggles batch mode usage (and run with mpi). If you want to run in batch mode" - echo " you need to have a separate batch script for a supported machine" - echo " that calls this script interactively - you cannot submit this" - echo " script directly to the batch system" - echo "[-l|--list]" - echo " List mapping files required (use check_input_data to get them)" - echo " also writes data to $outfilelist" - echo "[-d|--debug]" - echo " Toggles debug-only (don't actually run mkmapdata just echo what would happen)" - echo "[-h|--help] " - echo " Displays this help message" - echo "[-v|--verbose]" - echo " Toggle verbose usage -- log more information on what is happening " - echo "" - echo " You can also set the following env variables:" - echo " ESMFBIN_PATH - Path to ESMF binaries " - echo " (default is determined by machine running on)" - echo " CSMDATA ------ Path to CESM input data" - echo " (default is $CSMDATA)" - echo " MPIEXEC ------ Name of mpirun executable" - echo " (default is determined by machine running on)" - echo " REGRID_PROC -- Number of MPI processors to use" - echo " (default is $REGRID_PROC)" - echo "" - echo "**defaults can be determined on the machines: cheyenne or geyser" - echo "" - echo "**pass environment variables by preceding above commands " - echo " with 'env var1=setting var2=setting '" - echo "**********************" -} -#---------------------------------------------------------------------- -# runcmd subroutine -#---------------------------------------------------------------------- - -runcmd() { - cmd=$@ - if [ -z "$cmd" ]; then - echo "No command given to the runcmd function" - exit 3 - fi - if [ "$verbose" = "YES" ]; then - echo "$cmd" - fi - if [ "$debug" != "YES" ]; then - ${cmd} - rc=$? - else - rc=0 - fi - if [ $rc != 0 ]; then - echo "Error status returned from mkmapdata script" - exit 4 -undo - fi - return 0 -} - -#---------------------------------------------------------------------- -# Process input arguments -#---------------------------------------------------------------------- - -interactive="YES" -debug="no" -res="default" -type="global" -phys="clm4_5" -verbose="no" -list="no" -outgrid="" -gridfile="default" - -while [ $# -gt 0 ]; do - case $1 in - -v|-V) - verbose="YES" - ;; - -b|--batch) - interactive="NO" - ;; - -d|--debug) - debug="YES" - ;; - -l|--list) - debug="YES" - list="YES" - ;; - -r|--res) - res=$2 - shift - ;; - -f|--gridfile) - gridfile=$2 - shift - ;; - -t|--gridtype) - type=$2 - shift - ;; - -h|--help ) - usage - exit 0 - ;; - * ) - echo "ERROR:: invalid argument sent in: $2" - usage - exit 1 - ;; - esac - shift -done - -echo "Script to create mapping files required by mksurfdata_map" - -#---------------------------------------------------------------------- -# Determine output scrip grid file -#---------------------------------------------------------------------- - -# Set general query command used below -QUERY="$dir/../../bld/queryDefaultNamelist.pl -silent -namelist clmexp " -QUERY="$QUERY -justvalue -options sim_year=2000 -csmdata $CSMDATA" -echo "query command is $QUERY" - -echo "" -DST_EXTRA_ARGS="" -if [ "$gridfile" != "default" ]; then - GRIDFILE=$gridfile - echo "Using user specified scrip grid file: $GRIDFILE" - if [ "$res" = "default" ]; then - echo "When user specified grid file is given you MUST set the resolution (as the name of your grid)\n"; - exit 1 - fi - - # For now, make some assumptions about user-specified grids -- - # that they are SCRIP format, and small enough to not require - # large file support for the output mapping file. In the future, - # we may want to provide command-line options to allow the user to - # override these defaults. - DST_LRGFIL="none" - DST_TYPE="SCRIP" -else - if [ "$res" = "default" ]; then - res=$default_res - fi - - QUERYARGS="-res $res -options lmask=nomask" - - # Find the output grid file for this resolution using the XML database - QUERYFIL="$QUERY -var scripgriddata $QUERYARGS -onlyfiles" - if [ "$verbose" = "YES" ]; then - echo $QUERYFIL - fi - GRIDFILE=`$QUERYFIL` - echo "Using default scrip grid file: $GRIDFILE" - - # Determine extra information about the destination grid file - DST_LRGFIL=`$QUERY -var scripgriddata_lrgfile_needed $QUERYARGS` - DST_TYPE=`$QUERY -var scripgriddata_type $QUERYARGS` - if [ "$DST_TYPE" = "UGRID" ]; then - # For UGRID, we need extra information: the meshname variable - dst_meshname=`$QUERY -var scripgriddata_meshname $QUERYARGS` - DST_EXTRA_ARGS="$DST_EXTRA_ARGS --dst_meshname $dst_meshname" - fi -fi - -if [ "$type" = "global" ] && [ `echo "$res" | grep -c "1x1_"` = 1 ]; then - echo "This is a regional resolution and yet it is being run as global, set type with '-t' option\n"; - exit 1 -fi -if [ "$type" = "global" ] && [ `echo "$res" | grep -c "5x5_"` = 1 ]; then - echo "This is a regional resolution and yet it is being run as global, set type with '-t' option\n"; - exit 1 -fi -echo "Output grid resolution is $res" -if [ -z "$GRIDFILE" ]; then - echo "Output grid file was NOT found for this resolution: $res\n"; - exit 1 -fi - -if [ "$list" = "YES" ]; then - echo "outgrid = $GRIDFILE" - echo "outgrid = $GRIDFILE" > $outfilelist -elif [ ! -f "$GRIDFILE" ]; then - echo "Input SCRIP grid file does NOT exist: $GRIDFILE\n"; - echo "Make sure CSMDATA environment variable is set correctly" - exit 1 -fi - -#---------------------------------------------------------------------- -# Determine all input grid files and output file names -#---------------------------------------------------------------------- - -if [ "$phys" = "clm4_5" ]; then - grids=( \ - "0.5x0.5_AVHRR" \ - "0.25x0.25_MODIS" \ - "0.5x0.5_MODIS" \ - "3x3min_LandScan2004" \ - "3x3min_MODIS-wCsp" \ - "3x3min_USGS" \ - "5x5min_nomask" \ - "5x5min_IGBP-GSDP" \ - "5x5min_ISRIC-WISE" \ - "5x5min_ORNL-Soil" \ - "10x10min_nomask" \ - "10x10min_IGBPmergeICESatGIS" \ - "3x3min_GLOBE-Gardner" \ - "3x3min_GLOBE-Gardner-mergeGIS" \ - "0.9x1.25_GRDC" \ - "360x720cru_cruncep" \ - "1km-merge-10min_HYDRO1K-merge-nomask" \ - ) - -else - echo "ERROR: Unknown value for phys: $phys" - exit 1 -fi - -# Set timestamp for names below -CDATE="c"`date +%y%m%d` - -# Set name of each output mapping file -# First determine the name of the input scrip grid file -# for each of the above grids -declare -i nfile=1 -for gridmask in ${grids[*]} -do - grid=${gridmask%_*} - lmask=${gridmask#*_} - - QUERYARGS="-res $grid -options lmask=$lmask,glc_nec=10 " - - QUERYFIL="$QUERY -var scripgriddata $QUERYARGS -onlyfiles" - if [ "$verbose" = "YES" ]; then - echo $QUERYFIL - fi - INGRID[nfile]=`$QUERYFIL` - if [ "$list" = "YES" ]; then - echo "ingrid = ${INGRID[nfile]}" - echo "ingrid = ${INGRID[nfile]}" >> $outfilelist - fi - - OUTFILE[nfile]=map_${grid}_${lmask}_to_${res}_nomask_aave_da_$CDATE.nc - - # Determine extra information about the source grid file - SRC_EXTRA_ARGS[nfile]="" - SRC_LRGFIL[nfile]=`$QUERY -var scripgriddata_lrgfile_needed $QUERYARGS` - SRC_TYPE[nfile]=`$QUERY -var scripgriddata_type $QUERYARGS` - if [ "${SRC_TYPE[nfile]}" = "UGRID" ]; then - # For UGRID, we need extra information: the meshname variable - src_meshname=`$QUERY -var scripgriddata_meshname $QUERYARGS` - SRC_EXTRA_ARGS[nfile]="${SRC_EXTRA_ARGS[nfile]} --src_meshname $src_meshname" - fi - - nfile=nfile+1 -done - -#---------------------------------------------------------------------- -# Determine supported machine specific stuff -#---------------------------------------------------------------------- - -hostname=`hostname` -if [ -n "$NERSC_HOST" ]; then - hostname=$NERSC_HOST -fi -echo "Hostname = $hostname" -case $hostname in - ##cheyenne - cheyenne* | r* ) - . /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/bash - if [ -z "$REGRID_PROC" ]; then - REGRID_PROC=36 - fi - esmfvers=7.0.0 - intelvers=17.0.1 - module load esmf_libs/$esmfvers - module load intel/$intelvers - module load ncl - module load nco - - if [ "$interactive" = "NO" ]; then - mpi=mpi - mpitype="mpich2" - else - mpi=uni - mpitype="mpiuni" - fi - module load esmf-${esmfvers}-ncdfio-${mpi}-O - if [ -z "$ESMFBIN_PATH" ]; then - ESMFBIN_PATH=`grep ESMF_APPSDIR $ESMFMKFILE | awk -F= '{print $2}'` - fi - if [ -z "$MPIEXEC" ]; then - MPIEXEC="mpiexec_mpt -np $REGRID_PROC" - fi - ;; - - ## DAV - pronghorn* | caldera* | geyser* ) - . /glade/u/apps/ch/opt/lmod/7.2.1/lmod/lmod/init/bash - if [ -z "$REGRID_PROC" ]; then - REGRID_PROC=8 - fi - esmfvers=7.0.0 - intelvers=15.0.0 - #intelvers=12.1.5 - module purge - module load intel/$intelvers - module load ncl - module load nco - #module load impi - module load mpich-slurm - module load netcdf/4.3.3.1 - #module load netcdf/4.3.0 - module load ncarcompilers - - module load esmf - - if [ "$interactive" = "NO" ]; then - mpi=mpi - mpitype="mpich2" - else - mpi=uni - mpitype="mpiuni" - fi - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib/gcc/x86_64-redhat-linux/4.4.7:/usr/lib64:/glade/apps/opt/usr/lib:/usr/lib:/glade/u/ssg/ys/opt/intel/12.1.0.233/composer_xe_2011_sp1.11.339/compiler/lib/intel64:/lib:/lib64" - module load esmf-${esmfvers}-ncdfio-${mpi}-O - if [ -z "$ESMFBIN_PATH" ]; then - ESMFBIN_PATH=`grep ESMF_APPSDIR $ESMFMKFILE | awk -F= '{print $2}'` - fi - echo "ESMFMKFILE: $ESMFMKFILE" - echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" - - if [ -z "$MPIEXEC" ]; then - MPIEXEC="mpiexec -n $REGRID_PROC" - fi - echo "ERROR: Currently can NOT run on the DAV cluster, because ESMF is not configured correctly" - exit 1 - ;; - - ##no other machine currently supported - *) - echo "Machine $hostname NOT recognized" - ;; - -esac - -# Error checks -if [ ! -d "$ESMFBIN_PATH" ]; then - echo "Path to ESMF binary directory does NOT exist: $ESMFBIN_PATH" - echo "Set the environment variable: ESMFBIN_PATH" - exit 1 -fi - -#---------------------------------------------------------------------- -# Generate the mapping files needed for surface dataset generation -#---------------------------------------------------------------------- - -# Resolve interactive or batch mode command -# NOTE - if you want to run in batch mode - you need to have a separate -# batch file that calls this script interactively - you cannot submit -# this script to the batch system - -if [ "$interactive" = "NO" ]; then - echo "Running in batch mode using MPI" - if [ -z "$MPIEXEC" ]; then - echo "Name of MPI exec to use was NOT set" - echo "Set the environment variable: MPIEXEC" - exit 1 - fi - if [ ! -x `which ${MPIEXEC%% *}` ]; then - echo "The MPIEXEC pathname given is NOT an executable: ${MPIEXEC%% *}" - echo "Set the environment variable: MPIEXEC or run in interactive mode without MPI" - exit 1 - fi - mpirun=$MPIEXEC - echo "Running in batch mode" -else - mpirun="" -fi - -ESMF_REGRID="$ESMFBIN_PATH/ESMF_RegridWeightGen" -if [ ! -x "$ESMF_REGRID" ]; then - echo "ESMF_RegridWeightGen does NOT exist in ESMF binary directory: $ESMFBIN_PATH\n" - echo "Upgrade to a newer version of ESMF with this utility included" - echo "Set the environment variable: ESMFBIN_PATH" - exit 1 -fi - -# Remove previous log files -rm PET*.Log - -# -# Now run the mapping for each file, checking that input files exist -# and then afterwards that the output mapping file exists -# -declare -i nfile=1 -until ((nfile>${#INGRID[*]})); do - echo "Creating mapping file: ${OUTFILE[nfile]}" - echo "From input grid: ${INGRID[nfile]}" - echo "For output grid: $GRIDFILE" - echo " " - if [ -z "${INGRID[nfile]}" ] || [ -z "$GRIDFILE" ] || [ -z "${OUTFILE[nfile]}" ]; then - echo "Either input or output grid or output mapping file is NOT set" - exit 3 - fi - if [ ! -f "${INGRID[nfile]}" ]; then - echo "Input grid file does NOT exist: ${INGRID[nfile]}" - if [ ! "$list" = "YES" ]; then - exit 2 - fi - fi - if [ ! -f "$GRIDFILE" ]; then - echo "Output grid file does NOT exist: $GRIDFILE" - exit 3 - fi - - # Determine what (if any) large file support is needed. Use the - # most extreme large file support needed by either the source file - # or the destination file. - if [ "$DST_LRGFIL" = "netcdf4" ] || [ "${SRC_LRGFIL[nfile]}" = "netcdf4" ]; then - lrgfil="--netcdf4" - elif [ "$DST_LRGFIL" = "64bit_offset" ] || [ "${SRC_LRGFIL[nfile]}" = "64bit_offset" ]; then - lrgfil="--64bit_offset" - elif [ "$DST_LRGFIL" = "none" ] && [ "${SRC_LRGFIL[nfile]}" = "none" ]; then - lrgfil="" - else - echo "Unknown LRGFIL type:" - echo "DST_LRGFIL = $DST_LRGFIL" - echo "SRC_LRGFIL = ${SRC_LRGFIL[nfile]}" - exit 4 - fi - - # Skip if file already exists - if [ -f "${OUTFILE[nfile]}" ]; then - echo "Skipping creation of ${OUTFILE[nfile]} as already exists" - else - - cmd="$mpirun $ESMF_REGRID --ignore_unmapped -s ${INGRID[nfile]} " - cmd="$cmd -d $GRIDFILE -m conserve -w ${OUTFILE[nfile]}" - if [ $type = "regional" ]; then - cmd="$cmd --dst_regional" - fi - - cmd="$cmd --src_type ${SRC_TYPE[nfile]} ${SRC_EXTRA_ARGS[nfile]} --dst_type $DST_TYPE $DST_EXTRA_ARGS" - cmd="$cmd $lrgfil" - - runcmd $cmd - - if [ "$debug" != "YES" ] && [ ! -f "${OUTFILE[nfile]}" ]; then - echo "Output mapping file was NOT created: ${OUTFILE[nfile]}" - exit 6 - fi - # add some metadata to the file - HOST=`hostname` - history="$ESMF_REGRID" - runcmd "ncatted -a history,global,a,c,"$history" ${OUTFILE[nfile]}" - runcmd "ncatted -a hostname,global,a,c,$HOST -h ${OUTFILE[nfile]}" - runcmd "ncatted -a logname,global,a,c,$LOGNAME -h ${OUTFILE[nfile]}" - - # check for duplicate mapping weights - newfile="rmdups_${OUTFILE[nfile]}" - runcmd "rm -f $newfile" - runcmd "env MAPFILE=${OUTFILE[nfile]} NEWMAPFILE=$newfile ncl $dir/rmdups.ncl" - if [ -f "$newfile" ]; then - runcmd "mv $newfile ${OUTFILE[nfile]}" - fi - fi - - nfile=nfile+1 -done - -echo "Successffully created needed mapping files for $res" - -exit 0 diff --git a/tools/mkmapdata/mknoocnmap.pl b/tools/mkmapdata/mknoocnmap.pl deleted file mode 100755 index 67e65e6a70..0000000000 --- a/tools/mkmapdata/mknoocnmap.pl +++ /dev/null @@ -1,297 +0,0 @@ -#!/usr/bin/env perl -# -# mknoocnmap.pl Erik Kluzek -# Dec/07/2011 -# -# Create SCRIP grid and mapping files for a single-point or region -# that is assumed to be a land land-only region. -# -use Cwd; -use strict; -use English; -use IO::File; -use Getopt::Long; - -# -# Global constants -# -my $degsiz = 0.1; - -#----------------------------------------------------------------------------------------------- -# Set the directory that contains this scripts. If the command was issued using a -# relative or absolute path, that path is in $ProgDir. Otherwise assume the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script - # is in - # the user's PATH -my $cmdline = "@ARGV"; # Command line arguments to script -my $cwd = getcwd(); # current working directory -my $scrdir; # absolute pathname of directory that contains this script -my $nm = "${ProgName}::"; # name to use if script dies -if ($ProgDir) { - $scrdir = absolute_path($ProgDir); -} else { - $scrdir = $cwd; -} - - -#----------------------------------------------------------------------------------------------- - -sub usage { - die < Center latitude,longitude of the grid to create. - -name [-or -n] Name to use to describe point - -OPTIONS - -dx Size of total grid in degrees in longitude direction - (default is $degsiz) - -dy Size of total grid in degrees in latitude direction - (default is $degsiz) - -silent [or -s] Make output silent - -help [or -h] Print usage to STDOUT. - -verbose [or -v] Make output more verbose. - -nx Number of longitudes (default is 1) - -ny Number of latitudes (default is 1) -EOF -} - -#----------------------------------------------------------------------------------------------- - -sub get_latlon { -# -# Return the latitude and longitude of the input string and validate it -# - my $string = shift; - my $desc = shift; - my $dx = shift; - my $dy = shift; - - my $lat = undef; - my $lon = undef; - my $valreal1 = "[+-]?[0-9]*\.?[0-9]*[EedDqQ]?[0-9+-]*"; - - if ( $string =~ /^($valreal1)\s*,\s*($valreal1)$/ ) { - $lat = $1; - $lon = $2; - } else { - die <<"EOF"; -** $ProgName - Error in entering latitude/longitude for $desc ** -EOF - } - if ( $dx <= 0.0 || $dx > 360. ) { - die <<"EOF"; -** $ProgName - Bad value for dx (=$dx) for $desc ** - } - if ( $dy <= 0.0 || $dy > 180. ) { - die <<"EOF"; -** $ProgName - Bad value for dy (=$dy) for $desc ** - } - if ( ($lat < -90.+$dy/2.0) || ($lat > 90.0-$dy/2.0) ) { - die <<"EOF"; -** $ProgName - Bad value for latitude (=$lat) for $desc ** -EOF - } - if ( ($lon < $dx/2.0) || ($lon > 360.0-$dx/2.0) ) { - die <<"EOF"; -** $ProgName - Bad value for longitude (=$lat) for $desc ** -EOF - } - return( $lat, $lon ); - -} - -#------------------------------------------------------------------------------- - -sub absolute_path { -# -# Convert a pathname into an absolute pathname, expanding any . or .. characters. -# Assumes pathnames refer to a local filesystem. -# Assumes the directory separator is "/". -# - my $path = shift; - my $cwd = getcwd(); # current working directory - my $abspath; # resulting absolute pathname - -# Strip off any leading or trailing whitespace. (This pattern won't match if -# there's embedded whitespace. - $path =~ s!^\s*(\S*)\s*$!$1!; - -# Convert relative to absolute path. - - if ($path =~ m!^\.$!) { # path is "." - return $cwd; - } elsif ($path =~ m!^\./!) { # path starts with "./" - $path =~ s!^\.!$cwd!; - } elsif ($path =~ m!^\.\.$!) { # path is ".." - $path = "$cwd/.."; - } elsif ($path =~ m!^\.\./!) { # path starts with "../" - $path = "$cwd/$path"; - } elsif ($path =~ m!^[^/]!) { # path starts with non-slash character - $path = "$cwd/$path"; - } - - my ($dir, @dirs2); - my @dirs = split "/", $path, -1; # The -1 prevents split from stripping trailing nulls - # This enables correct processing of the input "/". - - # Remove any "" that are not leading. - for (my $i=0; $i<=$#dirs; ++$i) { - if ($i == 0 or $dirs[$i] ne "") { - push @dirs2, $dirs[$i]; - } - } - @dirs = (); - - # Remove any "." - foreach $dir (@dirs2) { - unless ($dir eq ".") { - push @dirs, $dir; - } - } - @dirs2 = (); - - # Remove the "subdir/.." parts. - foreach $dir (@dirs) { - if ( $dir !~ /^\.\.$/ ) { - push @dirs2, $dir; - } else { - pop @dirs2; # remove previous dir when current dir is .. - } - } - if ($#dirs2 == 0 and $dirs2[0] eq "") { return "/"; } - $abspath = join '/', @dirs2; - return( $abspath ); -} - -#------------------------------------------------------------------------------- - -# Process command-line options - -my %opts = ( - ctr => undef, - help => undef, - name => undef, - nx => 1, - ny => 1, - dx => $degsiz, - dy => $degsiz, - silent => 0, - verbose => 0, - ); - -GetOptions( - "p|centerpoint=s" => \$opts{'ctr'}, - "n|name=s" => \$opts{'name'}, - "nx=i" => \$opts{'nx'}, - "ny=i" => \$opts{'ny'}, - "dx=f" => \$opts{'dx'}, - "dy=f" => \$opts{'dy'}, - "h|help" => \$opts{'help'}, - "s|silent" => \$opts{'silent'}, - "v|verbose" => \$opts{'verbose'}, -) or usage(); - -# Check for unparsed arguments -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} - -if ( $opts{'verbose'} && $opts{'silent'} ) { - print "ERROR: Can NOT set both silent and verbose at once!\n"; - usage(); -} -my $printlev; -if ( $opts{'verbose'} ) { - $printlev = 2; -} elsif ( $opts{'silent'} ) { - $printlev = 0; -} else { - $printlev = 1; -} - -if ( ! defined($opts{'ctr'}) ) { - print "ERROR: MUST set the center point\n"; - usage(); -} -if ( ! defined($opts{'name'}) ) { - print "ERROR: MUST set the name of the point\n"; - usage(); -} -my $name = $opts{'name'}; - -my ($lat,$lon) = get_latlon( $opts{'ctr'}, $name, $opts{'dx'}, $opts{'dy'} ); -my $S_lat = $lat - $opts{'dy'}/2.0; -my $N_lat = $lat + $opts{'dy'}/2.0; -my $W_lon = $lon - $opts{'dx'}/2.0; -my $E_lon = $lon + $opts{'dx'}/2.0; - -my $nx = $opts{'nx'}; -my $ny = $opts{'ny'}; -if ( $opts{'nx'} < 1 ) { - print "ERROR: nx MUST be greater than or equal to 1\n"; - usage(); -} -if ( $opts{'ny'} < 1 ) { - print "ERROR: ny MUST be greater than or equal to 1\n"; - usage(); -} - -#----------------------------------------------------------------------------------------------- -my $print; -if ( $printlev > 1 ) { - $print = "PRINT=TRUE"; -} - -# Creation date -my $cdate = `date +%y%m%d`; chomp( $cdate ); - -if ( $printlev > 0 ) { - print "\n\nCreate SCRIP grid and mapping files for a single-point\n"; -} -# land grid... -my $grddir = absolute_path( "$scrdir/../mkmapgrids" ); -my $grid1 = "$grddir/SCRIPgrid_${name}_nomask_c${cdate}.nc"; -my $cmdenv = "env S_LAT=$S_lat W_LON=$W_lon N_LAT=$N_lat E_LON=$E_lon " . - "NX=$nx NY=$ny PTNAME=$name $print "; - -chdir( "$grddir" ); -my $cmd = "$cmdenv GRIDFILE=$grid1 ncl mkscripgrid.ncl"; -if ( $printlev > 0 ) { - print "Create land SCRIP gridfile\n"; - print "Execute: $cmd\n"; -} -system( $cmd ); - -# ocean grid... -my $grid2 = "$grddir/SCRIPgrid_${name}_noocean_c${cdate}.nc"; -my $cmd = "$cmdenv GRIDFILE=$grid2 IMASK=0 ncl mkscripgrid.ncl"; -if ( $printlev > 0 ) { - print "Create ocean SCRIP gridfile\n"; - print "Execute: $cmd\n"; -} -system( $cmd ); - -# Now create a unity mapping between the two... -# Note reversal of grid1 & grid2, because we want an ocean -> land -# mapping file -chdir( "$scrdir" ); -my $mapfile = "map_${name}_noocean_to_${name}_nomask_aave_da_${cdate}.nc"; -my $cmd = "env GRIDFILE1=$grid2 GRIDFILE2=$grid1 MAPFILE=$mapfile " . - "$print ncl $scrdir/mkunitymap.ncl"; - -if ( $printlev > 0 ) { - print "Create unity mapping file between the two gridfile\n"; - print "Execute: $cmd\n"; -} -system( $cmd ); - -if ( $printlev > 0 ) { - print "\n\nSuccessfully created grid/mapping files for single-point\n"; -} diff --git a/tools/mkmapdata/mkunitymap.ncl b/tools/mkmapdata/mkunitymap.ncl deleted file mode 100644 index ce0c17f988..0000000000 --- a/tools/mkmapdata/mkunitymap.ncl +++ /dev/null @@ -1,160 +0,0 @@ -; -; mkunitymap.ncl -; -; Create a unity map file either between two identical grids or between two -; grids that do NOT intersect at all. -; -; Erik Kluzek -; Dec/07/2011 -; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -begin - ; Set a few constants needed later - cdate = systemfunc( "date +%y%m%d" ); - ldate = systemfunc( "date" ); - ; =========================================================================================================== - ; - ; IMPORTANT NOTE: EDIT THE FOLLOWING TO CUSTOMIZE or use ENV VARIABLE SETTINGS - ; Edit the following as needed to interpolate to a new resolution. - gridfile1 = getenv("GRIDFILE1"); ; Get name of the first SCRIP grid file - gridfile2 = getenv("GRIDFILE2"); ; Get name of the second SCRIP grid file - - outfilename = getenv("MAPFILE"); ; Get name of the output mapping file - - print_str = getenv("PRINT"); ; Do Extra printing for debugging - - if ( ismissing(gridfile1) )then - print( "ERROR: GRIDFILE1 is missing!" ); - exit - end if - if ( ismissing(gridfile2) )then - print( "ERROR: GRIDFILE2 is missing!" ); - exit - end if - if ( ismissing(outfilename) )then - print( "ERROR: MAPFILE is missing!" ); - exit - end if - if ( ismissing(print_str) )then - printn = False; - else - if ( print_str .eq. "TRUE" )then - printn = True; - else - printn = False; - end if - end if - - ; - ; Open up the input grid files - ; - nca = addfile( gridfile1, "r" ); - ncb = addfile( gridfile2, "r" ); - - system( "/bin/rm -f "+outfilename ); - if ( printn )then - print( "output mapping file to create: "+outfilename ); - end if - nc = addfile( outfilename, "c" ); - ; - ; Define dimensions - ; - n_a = dimsizes( nca->grid_center_lat ); - n_b = dimsizes( ncb->grid_center_lat ); - if ( n_a .ne. n_b )then - print( "ERROR: dimensions of input SCRIP grid files is NOT the same!" ); - exit - end if - if ( any(ncb->grid_imask .ne. 1.0d00) )then - print( "ERROR: the mask of the second file isn't identically 1!" ); - print( "(second file should be land grid file)"); - exit - end if - chkvars = (/ "grid_center_lat", "grid_center_lon", "grid_corner_lat", "grid_corner_lon" /); - do i = 1, dimsizes(chkvars)-1 - if ( any(nca->$chkvars(i)$ .ne. ncb->$chkvars(i)$) )then - print( "ERROR: the grid variables are different between the two files!: "+chkvars(i) ); - exit - end if - end do - n_s = n_a; - dimnames = (/ "n_a", "n_b", "n_s", "nv_a", "nv_b", "num_wgts", "src_grid_rank", "dst_grid_rank" /); - dsizes = (/ n_a, n_b, n_a, 4, 4, 1, 2, 2/); - is_unlim = (/ False, False, False, False, False, False, False, False /); - filedimdef( nc, dimnames, dsizes, is_unlim ); - - ; - ; Define grid dimensions - ; - filevardef( nc, "src_grid_dims", "integer", (/ "src_grid_rank" /)) - nc->src_grid_dims = (/nca->grid_dims/) - filevardef( nc, "dst_grid_dims", "integer", (/ "dst_grid_rank" /)) - nc->dst_grid_dims = (/ncb->grid_dims/) - - ; - ; Define variables - ; - cvars = (/ "yc", "xc", "yv", "xv", "mask" /); - gvars = (/ "grid_center_lat", "grid_center_lon", "grid_corner_lat", "grid_corner_lon", "grid_imask" /); - - do i = 0, dimsizes(cvars)-1 - var = cvars(i)+"_a"; - if ( cvars(i) .eq. "yv" .or. cvars(i) .eq. "xv" )then - dnamesa = (/ "n_a", "nv_a" /); - dnamesb = (/ "n_b", "nv_b" /); - else - dnamesa = (/ "n_a" /); - dnamesb = (/ "n_b" /); - end if - filevardef ( nc, var, typeof(nca->$gvars(i)$), dnamesa ); - filevarattdef ( nc, var, nca->$gvars(i)$ ); - nc->$var$ = (/ nca->$gvars(i)$ /); - var = cvars(i)+"_b"; - filevardef ( nc, var, typeof(nca->$gvars(i)$), dnamesb ); - filevarattdef ( nc, var, ncb->$gvars(i)$ ); - nc->$var$ = (/ ncb->$gvars(i)$ /); - delete( dnamesa ); - delete( dnamesb ); - end do - filevardef ( nc, "area_a", "double", (/ "n_a" /) ); - filevardef ( nc, "area_b", "double", (/ "n_b" /) ); - filevardef ( nc, "frac_a", "double", (/ "n_a" /) ); - filevardef ( nc, "frac_b", "double", (/ "n_b" /) ); - ; - ; Attributes - ; - nc->area_a@units = "square radians"; - nc->frac_a@units = "unitless"; - nc->area_b@units = nc->area_a@units; - nc->frac_b@units = nc->frac_a@units; - nc@conventions = "NCAR-CESM"; - nc@domain_a = gridfile1; - nc@domain_b = gridfile2; - nc@grid_file_src = gridfile1; - nc@grid_file_dst = gridfile2; - nc@title = "SCRIP mapping file between identical grids without ocean"; - nc@history = ldate+": create using mkunitymap.ncl"; - nc@Version = systemfunc( "git describe" ); - - ; - ; Fraction - ; - nc->frac_a = int2dble( (/nc->mask_a/) ); - nc->frac_b = int2dble( (/nc->mask_b/) ); - ; - ; Area - ; - nc->area_a = gc_qarea( nc->yv_a(:,:), nc->xv_a(:,:) ); - nc->area_b = gc_qarea( nc->yv_b(:,:), nc->xv_b(:,:) ); - ; - ; Weights - ; - filevardef ( nc, "col", "integer", (/ "n_s" /) ); - filevardef ( nc, "row", "integer", (/ "n_s" /) ); - filevardef ( nc, "S", "double", (/ "n_s" /) ); - - nc->col = ispan( 1, n_s, 1 ); - nc->row = nc->col; - nc->S = 1.0d00; - -end diff --git a/tools/mkmapdata/mvNimport.sh b/tools/mkmapdata/mvNimport.sh deleted file mode 100755 index 184a3fac25..0000000000 --- a/tools/mkmapdata/mvNimport.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -# -# -# Batch script to move and import mapping files to inputdata -# for several resolutions. -# - -#---------------------------------------------------------------------- - -if [ -z "$CSMDATA" ]; then - CSMDATA=/fis/cgd/cseg/csm/inputdata -fi - -if [ ! -d "$CSMDATA" ]; then - echo "Environment variable CSMDATA is not set to a valid directory!" - exit 1 -fi - -mapdir="lnd/clm2/mappingdata/maps" -if [ ! -d "$CSMDATA/$mapdir" ]; then - echo "Environment variable CSMDATA is not set to a valid inputdata directory!" - exit 1 -fi - -if [ -z "$SVN_INP_DIR" ]; then - SVN_INP_DIR=https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata -fi - -if [ $# -gt 0 ]; then - resols="" - for arg in $@; do - resols="$resols $arg" - done -else - echo "Run for all valid resolutions" - resols=`../bld/queryDefaultNamelist.pl -res list -silent` -fi -echo "Move and import mapping files for this list of resolutions: $resols" - -#---------------------------------------------------------------------- - -for res in $resols; do - echo "Move and import mapping files for: $res" - dir=$mapdir/$res - #---------------------------------------------------------------------- - files=(map_*${res}*_aave_da_c??????.nc) - if [ ${#files[*]} -lt 2 ]; then - echo "No mappingfiles found for $res" - exit 2 - else - if [ ! -d "$CSMDATA/$dir" ]; then - echo "Create mapping directory: $CSMDATA/$dir" - mkdir $CSMDATA/$dir - svn mkdir $SVN_INP_URL/$dir -m "Create mapping directory for $res" - fi - for file in ${files[*]}; do - echo "Copy and import file $file" - cp -p $file $CSMDATA/$dir - if [ $? -ne 0 ]; then - echo "Problem copying file: $file" - exit 3 - fi - chmod 0444 $CSMDATA/$dir/$file - if [ $? -ne 0 ]; then - echo "Problem chmod on file: $file" - exit 4 - fi - svn import $CSMDATA/$dir/$file $SVN_INP_DIR/$dir/$file -m "Mapping file for $res" - if [ $? -ne 0 ]; then - echo "Problem doing svn import on file: $file" - exit 4 - fi - done - fi -done diff --git a/tools/mkmapdata/regridbatch.sh b/tools/mkmapdata/regridbatch.sh deleted file mode 100755 index af31db30de..0000000000 --- a/tools/mkmapdata/regridbatch.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash -# -# -# Batch script to submit to create mapping files for all standard -# resolutions. If you provide a single resolution via "$RES", only -# that resolution will be used. In that case: If it is a regional or -# single point resolution, you should set '#PBS -n' to 1, and be sure -# that '-t regional' is specified in cmdargs. -# -# cheyenne specific batch commands: -#PBS -A P93300606 -#PBS -N regrid -#PBS -q regular -#PBS -l select=4:ncpus=2:mpiprocs=2:mem=109GB -#PBS -l walltime=2:00:00 -#PBS -j oe -#PBS -me -#PBS -V -#PBS -S /bin/bash - -#---------------------------------------------------------------------- -# Set parameters -#---------------------------------------------------------------------- - -#---------------------------------------------------------------------- -# Begin main script -#---------------------------------------------------------------------- - -if [ -z "$RES" ]; then - echo "Run for all valid resolutions" - resols=`../../bld/queryDefaultNamelist.pl -res list -silent` -else - resols="$RES" -fi -echo "Create mapping files for this list of resolutions: $resols" - -#---------------------------------------------------------------------- - -for res in $resols; do - echo "Create mapping files for: $res" -#---------------------------------------------------------------------- - cmdargs="-r $res" - - # For single-point and regional resolutions, tell mkmapdata that - # output type is regional - if [[ `echo "$res" | grep -c "1x1_"` -gt 0 || `echo "$res" | grep -c "5x5_"` -gt 0 ]]; then - res_type="regional" - else - res_type="global" - fi - - cmdargs="$cmdargs -t $res_type" - - echo "$res_type" - if [ "$res_type" = "regional" ]; then - echo "regional" - # For regional and (especially) single-point grids, we can get - # errors when trying to use multiple processors - so just use 1. - # We also do NOT set batch mode in this case, because some - # machines (e.g., yellowstone) do not listen to REGRID_PROC, so to - # get a single processor, we need to run mkmapdata.sh in - # interactive mode. - regrid_num_proc=1 - else - echo "global" - regrid_num_proc=8 - if [ ! -z "$LSFUSER" ]; then - echo "batch" - cmdargs="$cmdargs -b" - fi - if [ ! -z "$PBS_O_WORKDIR" ]; then - cd $PBS_O_WORKDIR - cmdargs="$cmdargs -b" - fi - fi - - echo "args: $cmdargs" - echo "time env REGRID_PROC=$regrid_num_proc ./mkmapdata.sh $cmdargs\n" - time env REGRID_PROC=$regrid_num_proc ./mkmapdata.sh $cmdargs -done diff --git a/tools/mkmapdata/regridgeyser.sh b/tools/mkmapdata/regridgeyser.sh deleted file mode 100755 index 82a4615dcd..0000000000 --- a/tools/mkmapdata/regridgeyser.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# -# Batch script to submit to create mapping files for all standard -# resolutions. If you provide a single resolution via "$RES", only -# that resolution will be used. In that case: If it is a regional or -# single point resolution, you should set '#SBATCH -n' to 1, and be sure -# that '-t regional' is specified in cmdargs. -# -# geyser specific batch commands: -#SBATCH -J regrid # job name -#SBATCH -n 8 -#SBATCH --ntasks-per-node=8 -#SBATCH --mem=450G -#SBATCH -t 03:00:00 -#SBATCH -A P93300606 -#SBATCH -p dav -#SBATCH -e regrid.%J.out # output filename -#SBATCH -o regrid.%J.err # error filename -# -# To submit this script: -# -# sbatch regridgeyser.sh -# -## IMPORTANT NOTE: -# -# environment variables can NOT be passed into DAV -# queues. Hence, this script MUST be edited to select -# what resolution to run for. - -#---------------------------------------------------------------------- -# Set parameters -#---------------------------------------------------------------------- -export RES=1x1_brazil - -#---------------------------------------------------------------------- -# Begin main script -#---------------------------------------------------------------------- - -if [ -z "$RES" ]; then - echo "Run for all valid resolutions" - resols=`../../bld/queryDefaultNamelist.pl -res list -silent` -else - resols="$RES" -fi -echo "Create mapping files for this list of resolutions: $resols" - -#---------------------------------------------------------------------- - -for res in $resols; do - echo "Create mapping files for: $res" -#---------------------------------------------------------------------- - cmdargs="-r $res" - - # For single-point and regional resolutions, tell mkmapdata that - # output type is regional - if [[ `echo "$res" | grep -c "1x1_"` -gt 0 || `echo "$res" | grep -c "5x5_"` -gt 0 ]]; then - res_type="regional" - else - res_type="global" - fi - - cmdargs="$cmdargs -t $res_type" - - echo "$res_type" - if [ "$res_type" = "regional" ]; then - echo "regional" - # For regional and (especially) single-point grids, we can get - # errors when trying to use multiple processors - so just use 1. - # We also do NOT set batch mode in this case, because some - # machines (e.g., yellowstone) do not listen to REGRID_PROC, so to - # get a single processor, we need to run mkmapdata.sh in - # interactive mode. - regrid_num_proc=1 - else - echo "global" - regrid_num_proc=$SLURM_NTASKS - if [ ! -z "$SLURM_JOB_ACCOUNT" ]; then - echo "batch" - cmdargs="$cmdargs -b" - fi - fi - - echo "args: $cmdargs" - echo "time env REGRID_PROC=$regrid_num_proc ./mkmapdata.sh $cmdargs\n" - time env REGRID_PROC=$regrid_num_proc ./mkmapdata.sh $cmdargs -done diff --git a/tools/mkmapdata/rmdups.ncl b/tools/mkmapdata/rmdups.ncl deleted file mode 100644 index d5fff40d53..0000000000 --- a/tools/mkmapdata/rmdups.ncl +++ /dev/null @@ -1,131 +0,0 @@ -; -; Remove duplicate weights from a mapping file. -; -; Mark Taylor (converted for use by CLM mkmapdata by Erik Kluzek) -; Sep/01/2011 -; -load "$NCARG_NCARG/nclscripts/csm/gsn_code.ncl" -load "$NCARG_NCARG/nclscripts/csm/gsn_csm.ncl" -load "$NCARG_NCARG/nclscripts/csm/contributed.ncl" -begin - ; =========================================================================================================== - ; - ; IMPORTANT NOTE: EDIT THE FOLLOWING TO CUSTOMIZE or use ENV VARIABLE SETTINGS - ; Edit the following as needed - ; - ; Input mapping file to remove duplicate weights from a mapping file - ; - mapfile = getenv("MAPFILE") ; Get the mapping file - newmapfile = getenv("NEWMAPFILE") ; The new mapping file to create - logname = getenv("LOGNAME") ; Logname of user running the script - - if ( ismissing(mapfile) )then - print( "You did NOT enter an input mapping file to convert" ) - status_exit( -1 ) - end if - if ( ismissing(newmapfile) )then - sdate = systemfunc( "date +%y%m%d" ); - newmapfile = mapfile+"_c"+sdate+".nc"; - end if - ; =========================================================================================================== - - if ( systemfunc("test -f "+mapfile+"; echo $?" ) .ne. 0 )then - print( "Input file does not exist or not found: "+mapfile ); - status_exit( -1 ) - end if - print("map file: "+mapfile) - f = addfile(mapfile,"r") ; Open netCDF files. - - - n_s = dimsizes(f->col) - if ( n_s .eq. 0 )then - print( "n_s is size zero, so no overlap points just return: " ); - exit - end if - - n_b = dimsizes(f->area_b) - n_a = dimsizes(f->area_a) - print("n_s = "+n_s+" max(row)="+max(f->row)+" max(col)="+max(f->col)) - - - - row = f->row - col = f->col - - - print("checking for dups, sorting...") - hash = new( n_s, double ) - hash = col - hash= hash + row*n_b - index1d=dim_pqsort(hash,1) - row2=row(index1d) - col2=col(index1d) - S=f->S - print("zeroing out any dups...") - ndups=0 - i0=0 - do i=1,n_s-1 - if ( (col2(i) .eq. col2(i0)) .and. (row2(i) .eq. row2(i0))) then - iorig1 = index1d(i0) - iorig2 = index1d(i) - ;print("dup row: "+row2(i)+" "+row2(i0)+" "+row(iorig1)+" "+row(iorig2)) - ;print("dup col: "+col2(i)+" "+col2(i0)+" "+col(iorig1)+" "+col(iorig2)) - ;print("removing "+iorig2+" keeping "+iorig1) - S(iorig1)=S(iorig1)+S(iorig2) - S(iorig2)=0 - ndups=ndups+1 - ; dont increment i0 - else - i0=i - end if - end do - delete(row2) - delete(col2) - if ( ndups .gt. 0) then - print("ndups = "+ndups) - print("compacting S...") - ns2 = n_s-ndups - S2 = new( ns2, double) - row2= new( ns2, integer) - col2 = new( ns2, integer) - ns2=0 - do i=0,n_s-1 - if (S(i) .ne. 0) then - S2(ns2)=S(i) - row2(ns2)=row(i) - col2(ns2)=col(i) - ns2=ns2+1 - end if - end do - print("removed "+ndups+" dups") - delete(S) - delete(row) - delete(col) - S=S2 - row=row2 - col=col2 - n_s = ns2 - print("writing new netcdf file") - cmdout = systemfunc("ncks -O -x -v S,row,col "+mapfile+" "+newmapfile) - nco = addfile(newmapfile,"rw") ; Open netCDF files. - nco->S = S - nco->row = row - nco->col = col - ldate = systemfunc( "date" ); - nco@history = nco@history + ":"+ldate + ": "; - nco@history = nco@history + " Removed duplicate weights from mapping file with: rmdups.ncl " - nco@rmdups_Logname = logname; - nco@rmdups_mod_date = ldate; - nco@rmdups_version = systemfunc( "git describe" ); - - print("Successfully removed duplicate weights from mapping file" ); - - else - - print("No duplicate weights to remove from mapping file" ); - - end if - - - -end diff --git a/tools/mkmapgrids/README b/tools/mkmapgrids/README deleted file mode 100644 index cc6d2cb644..0000000000 --- a/tools/mkmapgrids/README +++ /dev/null @@ -1,22 +0,0 @@ -$CTSMROOT/tools/mkmapgrids/README June08/2018 - -NCL script to create a SCRIP grid file for a regular lat/lon grid. - -To use the script, set the following environment variables - -Required (or defaults to a single point over Boulder Colorado) - -PTNAME ! name of your grid -S_LAT ! Southern latitude corner -N_LAT ! Northern latitude corner -E_LON ! Eastern longitude corner -W_LON ! Western longitude corner - -Optional: - -NX ! Number of grid points along longitude (default 1) -NY ! Number of grid points along latitude (default 1) -IMASK ! 0 or 1, mask to use if all points are active or not (default active) -PRINT ! TRUE/FALSE do extra verbose printing or not (default FALSE) -GRIDFILE ! Output filename - diff --git a/tools/mkmapgrids/mkscripgrid.ncl b/tools/mkmapgrids/mkscripgrid.ncl deleted file mode 100644 index 0bfb26671c..0000000000 --- a/tools/mkmapgrids/mkscripgrid.ncl +++ /dev/null @@ -1,167 +0,0 @@ -; -; mkscripgrid.ncl -; -; Create SCRIP grid and mapping file for a land-only point or region. -; Requires NCL 6.1.0 or later for the ESMF regridding functions -; -; Erik Kluzek -; Dec/07/2011 -; -load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" -load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" -begin - ; =========================================================================================================== - ; Set a few constants needed later - cdate = systemfunc( "date +%y%m%d" ); - ldate = systemfunc( "date" ); - ; - ; IMPORTANT NOTE: EDIT THE FOLLOWING TO CUSTOMIZE or use ENV VARIABLE SETTINGS - ; Edit the following as needed to interpolate to a new resolution. - ; - ; Input resolution and position - ; - name = getenv("PTNAME"); ; Get name of this point - - latS = stringtodouble( getenv("S_LAT") ); ; Get south latitude from env variable - latN = stringtodouble( getenv("N_LAT") ); ; Get north latitude from env variable - lonE = stringtodouble( getenv("E_LON") ); ; Get east longitude from env variable - lonW = stringtodouble( getenv("W_LON") ); ; Get west longitude from env variable - - nx = stringtointeger( getenv("NX" ) ); ; Get number of grids along longitude lines - ny = stringtointeger( getenv("NY" ) ); ; Get number of grids along latitude lines - - imask = stringtointeger( getenv("IMASK") ); ; Get imask to use from env variable - - print_str = getenv("PRINT"); ; Do Extra printing for debugging - - outfilename = getenv("GRIDFILE"); ; Get filename from env variable - - if ( ismissing(nx) )then - nx = 1; - end if - if ( ismissing(ny) )then - ny = 1; - end if - if ( ismissing(imask) )then - imask = 1; - end if - if ( ismissing(name) )then - name = nx+"x"+ny+"pt_US-UMB"; - end if - if ( ismissing(latS) )then - latS = 45.5098; - end if - if ( ismissing(latN) )then - latN = 45.6098; - end if - if ( ismissing(lonW) )then - lonW = 275.2362; - end if - if ( ismissing(lonE) )then - lonE = 275.3362; - end if - if ( ismissing(print_str) )then - printn = False; - else - if ( print_str .eq. "TRUE" )then - printn = True; - else - printn = False; - end if - end if - - if ( ismissing(outfilename) )then - if ( imask .eq. 1 )then - outfilename = "SCRIPgrid_"+name+"_nomask_c"+cdate+".nc"; - else - if ( imask .eq. 0 )then - outfilename = "SCRIPgrid_"+name+"_noocean_c"+cdate+".nc"; - else - outfilename = "SCRIPgrid_"+name+"_mask_c"+cdate+".nc"; - end if - end if - end if - - system( "/bin/rm -f "+outfilename ); - if ( printn )then - print( "output file: "+outfilename ); - end if - -function fspan1up( fbegin [*]:double, fend [*]:double, number:integer ) -; -; An "fspan" that can handle size of 1 and up. -; Do fspan for arrays of two or more, or average of end points for array of one. -; -local farray; -begin - if ( number .eq. 1) then - farray = (/ (fbegin + fend) / 2.0d00 /); - else - farray = fspan( fbegin, fend, number ); - end if - return( farray ); -end - - ; - ; Compute derived quantities - ; - - delX = (lonE - lonW) / int2dble(nx); - delY = (latN - latS) / int2dble(ny); - - lonCenters = fspan1up( (lonW + delX/2.d0), (lonE - delX/2.d0), nx) - latCenters = fspan1up( (latS + delY/2.d0), (latN - delY/2.d0), ny) - lon = new( (/ny, nx/), "double" ); - lat = new( (/ny, nx/), "double" ); - lonCorners = new( (/ny, nx, 4/), "double" ); - latCorners = new( (/ny, nx, 4/), "double" ); - do i = 0, nx-1 - lat(:,i) = latCenters; - latCorners(:,i,0) = latCenters - delY/2.d0; - latCorners(:,i,1) = latCenters + delY/2.d0; - latCorners(:,i,2) = latCenters + delY/2.d0; - latCorners(:,i,3) = latCenters - delY/2.d0; - end do - do j = 0, ny-1 - lon(j,:) = lonCenters; - lonCorners(j,:,0) = lonCenters - delX/2.d0; - lonCorners(j,:,1) = lonCenters - delX/2.d0; - lonCorners(j,:,2) = lonCenters + delX/2.d0; - lonCorners(j,:,3) = lonCenters + delX/2.d0; - end do - - ; for some reason, "No_FillValue" isn't working in the case where imask=1 - Mask2D = new( (/ny,nx/), "integer", "No_FillValue" ) - Mask2D(:,:) = imask - gridSize = delX+"x"+delY - - ; - ; Create SCRIP grid file - ; - - Opt = True - Opt@Mask2D = Mask2D - Opt@GridCornerLat = latCorners - Opt@GridCornerLon = lonCorners - Opt@Title = "SCRIP grid file for "+name - if (printn) then - Opt@Debug = True - end if - curvilinear_to_SCRIP(outfilename, lat, lon, Opt) - - ; - ; Add global attributes to file - ; - - nc = addfile( outfilename, "w" ); - nc@history = ldate+": create using mkscripgrid.ncl"; - nc@comment = "Ocean is assumed to non-existant at this point"; - nc@Version = systemfunc( "git describe" ); - if ( printn )then - print( "================================================================================================" ); - print( "Successfully created SCRIP grid file: "+outfilename); - end if - - ; =========================================================================================================== - -end diff --git a/tools/mkprocdata_map/README b/tools/mkprocdata_map/README deleted file mode 100644 index f5ac71b1ff..0000000000 --- a/tools/mkprocdata_map/README +++ /dev/null @@ -1,152 +0,0 @@ -$CTSMROOT/tools/mkprocdata_map/clm/README Oct 30, 2012 - -This directory contains scripts for regridding CLM output from an -unstructured grid (1-d output using the lndgrid dimension) to a 2-d -(lat/lon) grid. The regridding method is area-conservative. - -The following steps provide a method to create the necessary inputs to -this script, produce an executable, and regrid output: - -In the following instructions, the "original" resolution is the -resolution of the run on an unstructured grid, and the "target" -resolution is the regular lat/lon resolution to which you will regrid -the output. - -(0) Install prerequisites: - - (a) If you do not already have a mapping file from the original - resolution to the target resolution, you will need the - ESMF_RegridWeightGen tool installed on your system. - - (b) The wrapper scripts describe below require the netCDF operators - (NCO). These nco tools (ncks, ncap2, etc.) must be in your path. - -(1) Determine the target resolution. This resolution must be a regular - lat/lon resolution. Generally, this should be a resolution close - to the resolution of the CLM run. For example, when running CLM at - ne30_np4 resolution, a good target resolution is 0.9x1.25 (i.e., - finite volume 1 degree: f09); when running CLM at ne120_np4 - resolution, a good target resolution is 0.23x0.31 (i.e., finitev - volume 1/4 degree: f02). - -(2) Perform a short CLM run at the target resolution, producing at - least one history file. After this run completes, set the - environment variable $TEMPLATE_FILE to point to one of the history - files created by this run. - -(3) Create a conservative mapping file from the original resolution to - the target resolution using the ESMF regrid weight generator. The - basic method for doing this is: - - $ESMF_PATH/bin/ESMF_RegridWeightGen -s $INGRID -d $OUTGRID -m conserve -w $MAP_FILE -i - - where $INGRID gives the path to a SCRIP grid file at the original - resolution, $OUTGRID gives the path to a SCRIP grid file at the - template resolution, and $MAP_FILE gives the name of the mapping - file that will be generated. - - However, you may want to wrap this in a job script to run it on - multiple processors (using mpirun), and you may have to set other - machine-specific environment variables. You can follow the method - used in tools/mkmapdata/mkmapdata.sh. - -(4) Build the mkprocdata_map tool. From the current directory, do the - following: - - > cd src - > gmake - > cd .. - - By default code compiles optimized so it's reasonably fast. If you want - to use the debugger, with bounds-checking, and float trapping on do the - following: - gmake OPT=FALSE - See Also: See the components/clm/tools/README file for notes about setting - the path for NetCDF. - - This builds the mkprocdata_map executable. However, you generally - will not want to run this executable directly: instead, you should - use one of the wrapper scripts described below. - -(5) Do the regridding using one of the wrapper scripts in this - directory. To determine which script is most appropriate: Do you - need to regrid just one or a few output files, or most/all of the - output files in a directory? - - (a) If you are regridding just one or a few output files, you can - use mkprocdata_map_wrap. Its usage is: - - > mkprocdata_map_wrap -i input_file -o output_file -m $MAP_FILE -t $TEMPLATE_FILE - - where: - - input_file is the CLM history file you want to regrid - - output_file is the name of the regridded file that will be - created - - $MAP_FILE is the ESMF conservative mapping file created in - step (3) - - $TEMPLATE_FILE is a CLM history file at the target resolution, - created in step (2) - - You may also specify the '-l' option to this script. This option - determines whether to determine landfrac and related variables - by regridding the input file (when you don't give the '-l' - option), or by copying these variables from the template file - (when you give the '-l' option). These variables are important - for computing regional and global averages, e.g., as is done in - the land diagnostics package. Each method may be reasonable, - depending on the purposes of the regridding. For example, if you - want regional/global integrals to be as true as possible to the - original run, you should run withOUT the '-l' option; but if you - want to compare regional/global integrals between the original - run and a run at the target resolution, then you may want to run - WITH the '-l' option. - - Run 'mkprocdata_map_wrap -h' for full usage - - (b) If you need to regrid most or all of the output files in a - directory, you can use the convenience script - mkprocdata_map_all. This script runs mkprocdata_map_wrap on all - files matching a given pattern within a directory. Its basic - usage is the following, done from a directory containing many - CLM history files: - - > /path/to/mkprocdata_map_all -p $CASE -m $MAP_FILE -t $TEMPLATE_FILE - - where: - - $CASE is the case name of the original run (this -p argument - is actually more general: it provides the prefix of files on - which mkprocdata_map_wrap should be run; run - 'mkprocdata_map_all -h' for details) - - $MAP_FILE is the ESMF conservative mapping file created in - step (3) - - $TEMPLATE_FILE is a CLM history file at the target resolution, - created in step (2) - - There are a number of additional optional arguments to this - script, including the '-l' option described in (a), above. Run - 'mkprocdata_map_all -h' for full usage. - - ------------------------------------------------------------------------- -Some miscellaneous notes on the scripts contained here ------------------------------------------------------------------------- - -- area vs. area_regridded in the output of mkprocdata_map_wrap and - mkprocdata_map_all: The 'area' variable gives the actual grid cell - area on the destination grid. The 'area_regridded' variable is the - result of performing the regridding procedure on the 'area' variable - in the original source data. This seems to be the wrong way to - regrid areas (e.g., it leads to global totals that do not make - sense). However, area_regridded is left in the regridded files as a - diagnostic. BUT PLEASE USE CAUTION IF USING THIS AREA_REGRIDDED - VALUE, UNLESS YOU KNOW WHAT IT REALLY REPRESENTS! - -- At least as of this writing (Oct 29, 2012), there is insufficient - metadata on the CLM history files to regrid all variables - perfectly. In particular, note that many CLM history variables apply - only over a subset of the grid cell (e.g., over the non-lake portion - of the grid cell). Thus, to regrid these variables appropriately, we - would need to weight each grid cell's value by the portion of the - grid cell over which the field applies. However, doing this would - require metadata about each field that is not currently - available. diff --git a/tools/mkprocdata_map/README.filedescriptions b/tools/mkprocdata_map/README.filedescriptions deleted file mode 100644 index e657e7c7d9..0000000000 --- a/tools/mkprocdata_map/README.filedescriptions +++ /dev/null @@ -1,25 +0,0 @@ -$CTSMROOT/tools/mkprocdata_map/README.filedescriptions Erik Kluzek - 06/08/2018 - -mkprocdata_map_all ------------ Script to run over a list of files -mkprocdata_map_wrap ----------- Main script to actually use -mkprocdata_map_functions.bash - Bash shell functions to use in other scripts -README ------------------------ Description and how to run -src --------------------------- Directory with FORTRAN source code - -Also there are some sample files that can be used for testing under inputdata in - -$DIN_LOC_ROOT/lnd/clm2/test_mkprocdata_map - -See how this is done by looking at the file for testing mkprocdata_map: - -../../test/tools/nl_files/mkprocdata_ne30_to_f19_I2000 - -Which does something like the following: - -./mkprocdata_map_wrap \ --i $DIN_LOC_ROOT/lnd/clm2/test_mkprocdata_map/clm4054_ne30g16_I2000.clm2.h0.2000-01_c170430.nc \ --o ne30output_onf19grid.nc \ --m $DIN_LOC_ROOT/lnd/clm2/test_mkprocdata_map/map_ne30np4_nomask_to_fv1.9x2.5_nomask_aave_da_c121107.nc \ --t $DIN_LOC_ROOT/lnd/clm2/test_mkprocdata_map/clm4054_f19g16_I2000.clm2.h0.2000-01_c170430.nc - diff --git a/tools/mkprocdata_map/mkprocdata_map_all b/tools/mkprocdata_map/mkprocdata_map_all deleted file mode 100755 index 73e8abedf1..0000000000 --- a/tools/mkprocdata_map/mkprocdata_map_all +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/bash - -# This script runs mkprocdata_map_wrap on all files matching a given -# pattern within a directory. - -# Created by Bill Sacks, 5-26-11 - -# ---------------------------------------------------------------------- -# LOCAL FUNCTIONS DEFINED HERE -# ---------------------------------------------------------------------- - -function Usage { - script_name=`basename $0` - echo "Usage: $script_name -p prefix -m map_file -t template_file [-d] [-e executable-path] [-h] [-i] [-l] [-o output_suffix] [-r diRectory] [-s suffix]" - echo "" - echo "This script runs mkprocdata_map_wrap on all files matching a" - echo "given pattern within a directory." - echo "" - echo "'prefix' gives the prefix of the files on which" - echo "mkprocdata_map_wrap should be run; 'prefix' should NOT contain" - echo "wildcard characters. The prefix is also used to translate" - echo "from input to output file names (see examples below)" - echo "" - echo "'map_file' gives the name (and full path if not in the current" - echo "directory) of the mapping file" - echo "" - echo "'template_file' gives the name (and full path if not in the" - echo "current directory) of the template file, from which we read" - echo "lats, lons and some other variables" - echo "" - echo "The following are optional arguments:" - echo "" - echo "[-d]: Do a test (Dry run): do all error-checking on" - echo " arguments and print commands that would be run, but" - echo " don't actually run commands" - echo "" - echo "[-e executable-path]: Gives the path of the mkprocdata_map executable." - echo " If not specified, the path is determined by the" - echo " default value in mkprocdata_map_wrap." - echo "" - echo "[-h]: Print this help message and exit" - echo "" - echo "[-i]: Ignore (skip) existing output files; if this option is" - echo " not specified, then the script dies with an error if" - echo " any of the desired output files already exist" - echo "" - echo "[-l]: Option passed to mkprocdata_map_wrap: rather than computing" - echo " landfrac and related variables by regridding the input file," - echo " instead copy these variables directly from the template file." - echo "" - echo "[-o output_suffix]: suffix to append to the end of the prefix" - echo " on the output files" - echo " If not specified, '_2d' is used" - echo "" - echo "[-r diRectory]: Do the processing in the given directory." - echo " If not specified, processing is done in the" - echo " current working directory." - echo "" - echo "[-s suffix]: Run mkprocdata_map_wrap on all files matching the" - echo " pattern '\${prefix}\${suffix}'. The suffix can -" - echo " and often will - contain wildcards; but" - echo " remember to enclose 'suffix' in quotes to" - echo " prevent shell expansion." - echo " If not specified, run mkprocdata_map_wrap on all" - echo " files matching '\${prefix}*'" - echo "" - echo "" - echo "Example: $script_name -p Ib14_ne30np4_gx1v6 -m map_ne30np4_to_fv1.9x2.5_aave_da_091230.nc -t Ib19_1.9x2.5_gx1v6.clm2.h0.0001-01.nc" - echo "This will run mkprocdata_map_wrap on all files whose names begin" - echo "with 'Ib14_ne30np4_gx1v6' in the current directory, using the" - echo "mapping file named 'map_ne30np4_to_fv1.9x2.5_aave_da_091230.nc'" - echo "and the template file named 'Ib19_1.9x2.5_gx1v6.clm2.h0.0001-01.nc'" - echo "For an input file named:" - echo " Ib14_ne30np4_gx1v6.clm2.h0.0001-01-06-00000.nc" - echo "The output file will be named:" - echo " Ib14_ne30np4_gx1v6_2d.clm2.h0.0001-01-06-00000.nc" - echo "" - echo "Example: $script_name -o '_remap' -s '*.h0.0001*.nc' -p Ib14_ne30np4_gx1v6 -m map_ne30np4_to_fv1.9x2.5_aave_da_091230.nc -t Ib19_1.9x2.5_gx1v6.clm2.h0.0001-01.nc" - echo "This will run mkprocdata_map_wrap on all files whose names match" - echo "the pattern 'Ib14_ne30np4_gx1v6*.h0.0001*.nc', in the" - echo "current directory, using the mapping file named" - echo "'map_ne30np4_to_fv1.9x2.5_aave_da_091230.nc' and the" - echo "template file named Ib19_1.9x2.5_gx1v6.clm2.h0.0001-01.nc" - echo "For an input file named:" - echo " Ib14_ne30np4_gx1v6.clm2.h0.0001-01-06-00000.nc" - echo "The output file will be named:" - echo " Ib14_ne30np4_gx1v6_remap.clm2.h0.0001-01-06-00000.nc" - echo "" -} - -# ---------------------------------------------------------------------- -# BEGIN MAIN SCRIPT -# ---------------------------------------------------------------------- - -script_dir=`dirname $0` -source $script_dir/mkprocdata_map_functions.bash - -# ---------------------------------------------------------------------- -# Handle command-line arguments -# ---------------------------------------------------------------------- - -# define default values: -# required arguments: -prefix="" -map_file="" -template_file="" -# optional arguments: -directory="." -ignore_existing=0 -output_suffix="_2d" -suffix="*" -dryrun=0 -extra_args="" - -while getopts de:hilm:o:p:r:s:t: opt; do - case $opt in - d) dryrun=1;; - e) extra_args="$extra_args -e $OPTARG";; - h) Usage; exit;; - i) ignore_existing=1;; - l) extra_args="$extra_args -l";; - m) map_file=$OPTARG;; - o) output_suffix=$OPTARG;; - p) prefix=$OPTARG;; - r) directory=$OPTARG;; - s) suffix=$OPTARG;; - t) template_file=$OPTARG;; - \?) Usage; exit 1 - esac -done - -# ---------------------------------------------------------------------- -# Error checking on arguments -# ---------------------------------------------------------------------- - -if [ -z "$prefix" ]; then - echo "Must specify a prefix" - Usage - exit 1 -fi - -check_file_arg "$map_file" "map" -check_file_arg "$template_file" "template" - -# Make sure directory is really a directory -if [ ! -d $directory ]; then - echo "ERROR: $directory is not a directory" - echo "" - Usage - exit 1 -fi - - -# ---------------------------------------------------------------------- -# Change to desired directory -# ---------------------------------------------------------------------- - -olddir=`pwd` -cd $directory - -# ---------------------------------------------------------------------- -# Get list of files matching the given pattern; make sure there really -# are some matching files -# ---------------------------------------------------------------------- - -files=`ls ${prefix}${suffix}` -if [ $? -ne 0 ]; then - echo "ERROR trying to find files matching: ${prefix}${suffix}" - echo "" - Usage - exit 1 -fi - -# ---------------------------------------------------------------------- -# Loop through files matching the given pattern; run mkprocdata_map_wrap for each -# ---------------------------------------------------------------------- - -for infile in $files; do - outfile=${infile/$prefix/${prefix}${output_suffix}} - if [ -e $outfile ]; then - if [ $ignore_existing -eq 0 ]; then - echo "" - echo "ERROR: output file $outfile already exists" - exit 1 - else - echo "" - echo "WARNING: output file $outfile already exists: skipping" - echo "" - fi - - else # outfile does not exist - echo "" - do_cmd "${script_dir}/mkprocdata_map_wrap -i $infile -o $outfile -m $map_file -t $template_file $extra_args" $dryrun - fi -done - -# ---------------------------------------------------------------------- -# Clean up -# ---------------------------------------------------------------------- - -cd $olddir - diff --git a/tools/mkprocdata_map/mkprocdata_map_functions.bash b/tools/mkprocdata_map/mkprocdata_map_functions.bash deleted file mode 100644 index bbc359fb89..0000000000 --- a/tools/mkprocdata_map/mkprocdata_map_functions.bash +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# This file contains functions used by other bash scripts in this directory. - -# This function echoes the command given by $1 (cmd), then executes it. -# However, if $2 (dryrun) is non-zero, then it only does the echo, not the execution. -# Usage: do_cmd cmd dryrun -# Returns 0 on success, non-zero on failure; if there is an error, the error string is echoed. -function do_cmd { - if [[ $# -ne 2 ]]; then - echo "ERROR in do_cmd: wrong number of arguments: expected 2, received $#" - exit 1 - fi - - local cmd=$1 - local dryrun=$2 - - echo $cmd - if [ $dryrun -eq 0 ]; then - # We use 'eval $cmd' rather than just '$cmd', because the - # latter doesn't work right if the command contains any quoted - # strings (e.g., svn ci -m "this is my message") - eval $cmd - if [ $? -ne 0 ]; then - echo "ERROR in do_cmd: error executing command" - exit 2 - fi - fi - - return 0 -} - -# make sure that the given file name argument was provided, and that -# the file exists; exit the script with a usage message if either of -# these is not true -# -# Usage: check_file_arg filename_arg description -# (description is echoed if there is an error) -# Example: check_file_arg "$input_file" "input" -# (note that $input_file must be in quotes) -function check_file_arg { - local filename=$1 - local description=$2 - - if [ -z "$filename" ]; then - echo "ERROR: Must specify $description file" - Usage - exit 1 - fi - - if [ ! -f $filename ]; then - echo "ERROR: Can't find $description file: $filename" - Usage - exit 1 - fi -} - diff --git a/tools/mkprocdata_map/mkprocdata_map_wrap b/tools/mkprocdata_map/mkprocdata_map_wrap deleted file mode 100755 index 4744b0eacc..0000000000 --- a/tools/mkprocdata_map/mkprocdata_map_wrap +++ /dev/null @@ -1,250 +0,0 @@ -#!/bin/bash - -# This script is a wrapper around mkprocdata_map that runs that -# program and then copies some additional variables from the template -# file to the output file. It also does some additional pre and -# post-processing in order to create some additional variables. - -# Created by Bill Sacks, 5-25-11 - -# ---------------------------------------------------------------------- -# SET PARAMETERS HERE -# ---------------------------------------------------------------------- - -# comma-delimited list of extra variables to copy directly from -# template file; note that these variables should not be written out -# by mkprocdata_map (i.e., everything in this list should be listed in -# the 'ignore_var' function in mkprocdata_map.F90); however, there may -# be some variables in the 'ignore_var' function that are not listed -# here - e.g., variables that we treat specially. -copy_vars="lon,lat" - -# comma-delimited list of extra variables to copy from the template -# file if the -l option is specified -- this option says to copy -# landfrac and related variables. Note that some of these variables -# may be written out by mkprocdata_map, in which case they will be -# overwritten afterwards (slighly less efficient, but that keeps -# things simpler). -landfrac_copy_vars="landfrac,landmask,pftmask" - -# name of the executable; -# expected to be in the same directory as this script unless -e option is given -executable="mkprocdata_map" - -# minimum value for regridded pftmask variable for the output variable to be 1 -pftmask_min="1.e-6" - -# fill value for landmask -landmask_fill=-9999 - -# ---------------------------------------------------------------------- -# LOCAL FUNCTIONS DEFINED HERE -# ---------------------------------------------------------------------- - -function Usage { - script_name=`basename $0` - echo "Usage: $script_name -i input_file -o output_file -m map_file -t template_file [-e executable-path] [-h] [-l]" - echo "" - echo "This script runs mkprocdata_map with the given arguments (-i, -o, -m and -t)," - echo "then copies some additional variables from the template file" - echo "to the output file. It also does some additional pre and" - echo "post-processing in order to create some additional variables." - echo "" - echo "Additional optional arguments:" - echo "" - echo "[-e executable-path]: Gives the path of the mkprocdata_map executable." - echo " If not specified, the executable is assumed to be" - echo " in the same directory as this script." - echo "" - echo "[-h]: Print this help message and exit" - echo "" - echo "[-l]: Rather than computing landfrac and related variables" - echo "by regridding the input file, instead copy these variables" - echo "directly from the template file. The variables this pertains" - echo "to are:" - echo $landfrac_copy_vars -} - -# This function operates on a single variable in a file, changing all -# places where that variable is missing to some new (non-missing) -# value. The _FillValue attribute remains unchanged. -# Usage: change_missing_to_value varname newval infile outfile -# - varname: the name of the variable to change -# - newval: all instances of the missing value will be replaced with -# this new value -# - infile: input file name -# - outfile: output file name (can be the same as infile) -function change_missing_to_value { - if [[ $# -ne 4 ]]; then - echo "ERROR in change_missing_to_value: wrong number of arguments: expected 2, received $#" - exit 1 - fi - - varname=$1 - newval=$2 - infile=$3 - outfile=$4 - - varname_tmp=${varname}_tmp_$$ - - cat > cmds.nco.tmp.$$ <= $pftmask_min)' $output_file $output_file" 0 - do_cmd "ncks -O -x -v pftmask_float $output_file $output_file" 0 - - # --- Calculate landmask from landfrac --- - echo "" - - cat > cmds.nco.tmp.$$ < 0); -landmask_float.change_miss($landmask_fill); -landmask=int(landmask_float); -EOF - - do_cmd "ncap2 -O -S cmds.nco.tmp.$$ $output_file $output_file" 0 - rm cmds.nco.tmp.$$ - - change_missing_to_value landmask 0 $output_file $output_file - - # in the following, note that we need to manually set missing_value, because it doesn't get changed through the .set_miss call in nco: - do_cmd "ncatted -a long_name,landmask,o,c,'land/ocean mask (0.=ocean and 1.=land)' -a missing_value,landmask,o,i,$landmask_fill $output_file" 0 -fi - -echo "Successfully regridded data" diff --git a/tools/mkprocdata_map/src/Filepath b/tools/mkprocdata_map/src/Filepath deleted file mode 100644 index 9c558e357c..0000000000 --- a/tools/mkprocdata_map/src/Filepath +++ /dev/null @@ -1 +0,0 @@ -. diff --git a/tools/mkprocdata_map/src/Makefile b/tools/mkprocdata_map/src/Makefile deleted file mode 100644 index 6f07deb741..0000000000 --- a/tools/mkprocdata_map/src/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# Makefile for mksurfdata_map - -EXENAME = ../mkprocdata_map - -# Set optimization on by default -ifeq ($(OPT),$(null)) - OPT := TRUE -endif - -include Makefile.common \ No newline at end of file diff --git a/tools/mkprocdata_map/src/Makefile.common b/tools/mkprocdata_map/src/Makefile.common deleted file mode 100644 index ab79f94144..0000000000 --- a/tools/mkprocdata_map/src/Makefile.common +++ /dev/null @@ -1,360 +0,0 @@ -#----------------------------------------------------------------------- -# This Makefile is for building clm tools on AIX, Linux (with pgf90 or -# lf95 compiler), Darwin or IRIX platforms. -# -# These macros can be changed by setting environment variables: -# -# LIB_NETCDF --- Library directory location of netcdf. (defaults to /usr/local/lib) -# INC_NETCDF --- Include directory location of netcdf. (defaults to /usr/local/include) -# MOD_NETCDF --- Module directory location of netcdf. (defaults to $LIB_NETCDF) -# USER_FC ------ Allow user to override the default Fortran compiler specified in Makefile. -# USER_FCTYP --- Allow user to override the default type of Fortran compiler (linux and USER_FC=ftn only). -# USER_CC ------ Allow user to override the default C compiler specified in Makefile (linux only). -# USER_LINKER -- Allow user to override the default linker specified in Makefile. -# USER_CPPDEFS - Additional CPP defines. -# USER_CFLAGS -- Additional C compiler flags that the user wishes to set. -# USER_FFLAGS -- Additional Fortran compiler flags that the user wishes to set. -# USER_LDLAGS -- Additional load flags that the user wishes to set. -# SMP ---------- Shared memory Multi-processing (TRUE or FALSE) [default is FALSE] -# OPT ---------- Use optimized options. -# -#------------------------------------------------------------------------ - -# Set up special characters -null := - -# Newer makes set the CURDIR variable. -CURDIR := $(shell pwd) - -RM = rm - -# Check for the netcdf library and include directories -ifeq ($(LIB_NETCDF),$(null)) - LIB_NETCDF := /usr/local/lib -endif - -ifeq ($(INC_NETCDF),$(null)) - INC_NETCDF := /usr/local/include -endif - -ifeq ($(MOD_NETCDF),$(null)) - MOD_NETCDF := $(LIB_NETCDF) -endif - -# Set user specified Fortran compiler -ifneq ($(USER_FC),$(null)) - FC := $(USER_FC) -endif - -# Set user specified C compiler -ifneq ($(USER_CC),$(null)) - CC := $(USER_CC) -endif - -# Set if Shared memory multi-processing will be used -ifeq ($(SMP),$(null)) - SMP := FALSE -endif - -CPPDEF := $(USER_CPPDEFS) - -# Set optimization on by default -ifeq ($(OPT),$(null)) - OPT := TRUE -endif - -ifeq ($(OPT),TRUE) - CPPDEF := -DOPT -endif - -# Determine platform -UNAMES := $(shell uname -s) - -# Load dependency search path. -dirs := . $(shell cat Filepath) - -# Set cpp search path, include netcdf -cpp_dirs := $(dirs) $(INC_NETCDF) $(MOD_NETCDF) -cpp_path := $(foreach dir,$(cpp_dirs),-I$(dir)) # format for command line - -# Expand any tildes in directory names. Change spaces to colons. -# (the vpath itself is set elsewhere, based on this variable) -vpath_dirs := $(foreach dir,$(cpp_dirs),$(wildcard $(dir))) -vpath_dirs := $(subst $(space),:,$(vpath_dirs)) - -#Primary Target: build the tool -all: $(EXENAME) - -# Get list of files and build dependency file for all .o files -# using perl scripts mkSrcfiles and mkDepends - -SOURCES := $(shell cat Srcfiles) - -OBJS := $(addsuffix .o, $(basename $(SOURCES))) - -# Set path to Mkdepends script; assumes that any Makefile including -# this file is in a sibling of the src directory, in which Mkdepends -# resides -Mkdepends := ../src/Mkdepends - -$(CURDIR)/Depends: $(CURDIR)/Srcfiles $(CURDIR)/Filepath - $(Mkdepends) Filepath Srcfiles > $@ - - -# Architecture-specific flags and rules -#------------------------------------------------------------------------ -# AIX -#------------------------------------------------------------------------ - -ifeq ($(UNAMES),AIX) -CPPDEF += -DAIX -cpre = $(null)-WF,-D$(null) -FPPFLAGS := $(patsubst -D%,$(cpre)%,$(CPPDEF)) -FFLAGS = -c -I$(INC_NETCDF) -q64 -qsuffix=f=f90 -qsuffix=f=f90:cpp=F90 \ - $(FPPFLAGS) -g -qfullpath -qarch=auto -qtune=auto -qsigtrap=xl__trcedump -qsclk=micro - -LDFLAGS = -L$(LIB_NETCDF) -q64 -lnetcdff -lnetcdf -ifneq ($(OPT),TRUE) - FFLAGS += -qinitauto=7FF7FFFF -qflttrap=ov:zero:inv:en -qspillsize=4000 -C -else - FFLAGS += -O2 -qmaxmem=-1 -Q - LDFLAGS += -Q -endif -CFLAGS := -q64 -g $(CPPDEF) -O2 -FFLAGS += $(cpp_path) -CFLAGS += $(cpp_path) - -ifeq ($(SMP),TRUE) - FC = xlf90_r - FFLAGS += -qsmp=omp - LDFLAGS += -qsmp=omp -else - FC = xlf90 -endif - -endif - -#------------------------------------------------------------------------ -# Darwin -#------------------------------------------------------------------------ - -ifeq ($(UNAMES),Darwin) - -# Set the default Fortran compiler -ifeq ($(USER_FC),$(null)) - FC := g95 -endif -ifeq ($(USER_CC),$(null)) - CC := gcc -endif - -CFLAGS := -g -O2 -CPPDEF += -DSYSDARWIN -DDarwin -DLINUX -LDFLAGS := - -ifeq ($(FC),g95) - - CPPDEF += -DG95 - FFLAGS := -c -fno-second-underscore $(CPPDEF) $(cpp_path) -I$(MOD_NETCDF) - ifeq ($(OPT),TRUE) - FFLAGS += -O2 - else - FFLAGS += -g -fbounds-check - endif - -endif - -ifeq ($(FC),gfortran) - - CPPDEF += -DG95 - FFLAGS := -c -fno-second-underscore $(CPPDEF) $(cpp_path) -I$(MOD_NETCDF) \ - -fno-range-check - ifeq ($(OPT),TRUE) - FFLAGS += -O2 - else - FFLAGS += -g -fbounds-check - endif - -endif - -ifeq ($(FC),ifort) - - CPPDEF += -DFORTRANUNDERSCORE - FFLAGS += -c -ftz -g -fp-model precise $(CPPDEF) $(cpp_path) \ - -convert big_endian -assume byterecl -traceback -FR - LDFLAGS += -m64 - - ifneq ($(OPT),TRUE) - FFLAGS += -CB -O0 - else - FFLAGS += -O2 - endif - ifeq ($(SMP),TRUE) - FFLAGS += -qopenmp - LDFLAGS += -qopenmp - endif -endif - -ifeq ($(FC),pgf90) - - CPPDEF += -DFORTRANUNDERSCORE - FFLAGS += -c $(CPPDEF) $(cpp_path) - ifneq ($(OPT),TRUE) - FFLAGS += -g -Ktrap=fp -Mbounds -Kieee - else - FFLAGS += -fast -Kieee - endif - - ifeq ($(SMP),TRUE) - FFLAGS += -mp - LDFLAGS += -mp - endif - -endif - -ifeq ($(CC),icc) - CFLAGS += -m64 -g - ifeq ($(SMP),TRUE) - CFLAGS += -qopenmp - endif -endif -ifeq ($(CC),pgcc) - CFLAGS += -g -fast -endif - -CFLAGS += $(CPPDEF) $(cpp_path) -LDFLAGS += -L$(LIB_NETCDF) -lnetcdf -lnetcdff - -endif - -#------------------------------------------------------------------------ -# Linux -#------------------------------------------------------------------------ - -ifeq ($(UNAMES),Linux) - ifeq ($(USER_FC),$(null)) - FC := ifort - FCTYP := ifort - else - ifeq ($(USER_FC),ftn) - ifneq ($(USER_FCTYP),$(null)) - FCTYP := $(USER_FCTYP) - else - FCTYP := pgf90 - endif - else - FCTYP := $(USER_FC) - endif - endif - CPPDEF += -DLINUX -DFORTRANUNDERSCORE - CFLAGS := $(CPPDEF) - LDFLAGS := $(shell $(LIB_NETCDF)/../bin/nf-config --flibs) - FFLAGS = - - ifeq ($(FCTYP),pgf90) - CC := pgcc - ifneq ($(OPT),TRUE) - FFLAGS += -g -Ktrap=fp -Mbounds -Kieee - else - FFLAGS += -fast -Kieee - CFLAGS += -fast - endif - - ifeq ($(SMP),TRUE) - FFLAGS += -mp - LDFLAGS += -mp - endif - - endif - - ifeq ($(FCTYP),lf95) - ifneq ($(OPT),TRUE) - FFLAGS += -g --chk a,e,s,u -O0 - else - FFLAGS += -O - endif - # Threading only works by putting thread memory on the heap rather than the stack - # (--threadheap). - # As of lf95 version 6.2 the thread stacksize limits are (still) too small to run - # even small - # resolution problems (FV at 10x15 res fails). - ifeq ($(SMP),TRUE) - FFLAGS += --openmp --threadheap 4096 - LDFLAGS += --openmp --threadheap 4096 - endif - endif - ifeq ($(FCTYP),pathf90) - FFLAGS += -extend_source -ftpp -fno-second-underscore - ifneq ($(OPT),TRUE) - FFLAGS += -g -O0 - else - FFLAGS += -O - endif - ifeq ($(SMP),TRUE) - FFLAGS += -mp - LDFLAGS += -mp - endif - endif - ifeq ($(FCTYP),ifort) - - FFLAGS += -ftz -g -fp-model precise -convert big_endian -assume byterecl -traceback -FR - CFLAGS += -m64 -g - LDFLAGS += -m64 - - ifneq ($(OPT),TRUE) - FFLAGS += -CB -O0 - else - FFLAGS += -O2 - endif - ifeq ($(SMP),TRUE) - FFLAGS += -qopenmp - CFLAGS += -qopenmp - LDFLAGS += -qopenmp - endif - endif - FFLAGS += -c -I$(INC_NETCDF) $(CPPDEF) $(cpp_path) - CFLAGS += $(cpp_path) -endif - -#------------------------------------------------------------------------ -# Default rules and macros -#------------------------------------------------------------------------ - -.SUFFIXES: -.SUFFIXES: .F90 .c .o - -# Set the vpath for all file types EXCEPT .o -# We do this for individual file types rather than generally using -# VPATH, because for .o files, we don't want to use files from a -# different build (e.g., in building the unit tester, we don't want to -# use .o files from the main build) -vpath %.F90 $(vpath_dirs) -vpath %.c $(vpath_dirs) -vpath %.h $(vpath_dirs) - -# Append user defined compiler and load flags to Makefile defaults -CFLAGS += $(USER_CFLAGS) -FFLAGS += $(USER_FFLAGS) -LDFLAGS += $(USER_LDFLAGS) - -# Set user specified linker -ifneq ($(USER_LINKER),$(null)) - LINKER := $(USER_LINKER) -else - LINKER := $(FC) -endif - -.F90.o: - $(FC) $(FFLAGS) $< - -.c.o: - $(CC) -c $(CFLAGS) $< - - -$(EXENAME): $(OBJS) - $(LINKER) -o $@ $(OBJS) $(LDFLAGS) - -clean: - $(RM) -f $(OBJS) *.mod Depends - -include $(CURDIR)/Depends diff --git a/tools/mkprocdata_map/src/Mkdepends b/tools/mkprocdata_map/src/Mkdepends deleted file mode 100755 index a75e8fdde0..0000000000 --- a/tools/mkprocdata_map/src/Mkdepends +++ /dev/null @@ -1,327 +0,0 @@ -#!/usr/bin/env perl - -# Generate dependencies in a form suitable for inclusion into a Makefile. -# The source filenames are provided in a file, one per line. Directories -# to be searched for the source files and for their dependencies are provided -# in another file, one per line. Output is written to STDOUT. -# -# For CPP type dependencies (lines beginning with #include) the dependency -# search is recursive. Only dependencies that are found in the specified -# directories are included. So, for example, the standard include file -# stdio.h would not be included as a dependency unless /usr/include were -# one of the specified directories to be searched. -# -# For Fortran module USE dependencies (lines beginning with a case -# insensitive "USE", possibly preceded by whitespace) the Fortran compiler -# must be able to access the .mod file associated with the .o file that -# contains the module. In order to correctly generate these dependencies -# two restrictions must be observed. -# 1) All modules must be contained in files that have the same base name as -# the module, in a case insensitive sense. This restriction implies that -# there can only be one module per file. -# 2) All modules that are to be contained in the dependency list must be -# contained in one of the source files in the list provided on the command -# line. -# The reason for the second restriction is that since the makefile doesn't -# contain rules to build .mod files the dependency takes the form of the .o -# file that contains the module. If a module is being used for which the -# source code is not available (e.g., a module from a library), then adding -# a .o dependency for that module is a mistake because make will attempt to -# build that .o file, and will fail if the source code is not available. -# -# Author: B. Eaton -# Climate Modelling Section, NCAR -# Feb 2001 - -use Getopt::Std; -use File::Basename; - -# Check for usage request. -@ARGV >= 2 or usage(); - -# Process command line. -my %opt = (); -getopts( "t:w", \%opt ) or usage(); -my $filepath_arg = shift() or usage(); -my $srcfile_arg = shift() or usage(); -@ARGV == 0 or usage(); # Check that all args were processed. - -my $obj_dir; -if ( defined $opt{'t'} ) { $obj_dir = $opt{'t'}; } - -open(FILEPATH, $filepath_arg) or die "Can't open $filepath_arg: $!\n"; -open(SRCFILES, $srcfile_arg) or die "Can't open $srcfile_arg: $!\n"; - -# Make list of paths to use when looking for files. -# Prepend "." so search starts in current directory. This default is for -# consistency with the way GNU Make searches for dependencies. -my @file_paths = ; -close(FILEPATH); -chomp @file_paths; -unshift(@file_paths,'.'); -foreach $dir (@file_paths) { # (could check that directories exist here) - $dir =~ s!/?\s*$!!; # remove / and any whitespace at end of directory name - ($dir) = glob $dir; # Expand tildes in path names. -} - -# Make list of files containing source code. -my @src = ; -close(SRCFILES); -chomp @src; - -# For each file that may contain a Fortran module (*.[fF]90 *.[fF]) convert the -# file's basename to uppercase and use it as a hash key whose value is the file's -# basename. This allows fast identification of the files that contain modules. -# The only restriction is that the file's basename and the module name must match -# in a case insensitive way. -my %module_files = (); -my ($f, $name, $path, $suffix, $mod); -my @suffixes = ('\.[fF]90', '\.[fF]' ); -foreach $f (@src) { - ($name, $path, $suffix) = fileparse($f, @suffixes); - ($mod = $name) =~ tr/a-z/A-Z/; - $module_files{$mod} = $name; -} - -# Now make a list of .mod files in the file_paths. If a .o source dependency -# can't be found based on the module_files list above, then maybe a .mod -# module dependency can if the mod file is visible. -my %trumod_files = (); -my ($dir); -my ($f, $name, $path, $suffix, $mod); -my @suffixes = ('\.mod' ); -foreach $dir (@file_paths) { - @filenames = (glob("$dir/*.mod")); - foreach $f (@filenames) { - ($name, $path, $suffix) = fileparse($f, @suffixes); - ($mod = $name) =~ tr/a-z/A-Z/; - $trumod_files{$mod} = $name; - } -} - -#print STDERR "\%module_files\n"; -#while ( ($k,$v) = each %module_files ) { -# print STDERR "$k => $v\n"; -#} - -# Find module and include dependencies of the source files. -my ($file_path, $rmods, $rincs); -my %file_modules = (); -my %file_includes = (); -my @check_includes = (); -foreach $f ( @src ) { - - # Find the file in the seach path (@file_paths). - unless ($file_path = find_file($f)) { - if (defined $opt{'w'}) {print STDERR "$f not found\n";} - next; - } - - # Find the module and include dependencies. - ($rmods, $rincs) = find_dependencies( $file_path ); - - # Remove redundancies (a file can contain multiple procedures that have - # the same dependencies). - $file_modules{$f} = rm_duplicates($rmods); - $file_includes{$f} = rm_duplicates($rincs); - - # Make a list of all include files. - push @check_includes, @{$file_includes{$f}}; -} - -#print STDERR "\%file_modules\n"; -#while ( ($k,$v) = each %file_modules ) { -# print STDERR "$k => @$v\n"; -#} -#print STDERR "\%file_includes\n"; -#while ( ($k,$v) = each %file_includes ) { -# print STDERR "$k => @$v\n"; -#} -#print STDERR "\@check_includes\n"; -#print STDERR "@check_includes\n"; - -# Find include file dependencies. -my %include_depends = (); -while (@check_includes) { - $f = shift @check_includes; - if (defined($include_depends{$f})) { next; } - - # Mark files not in path so they can be removed from the dependency list. - unless ($file_path = find_file($f)) { - $include_depends{$f} = -1; - next; - } - - # Find include file dependencies. - ($rmods, $include_depends{$f}) = find_dependencies($file_path); - - # Add included include files to the back of the check_includes list so - # that their dependencies can be found. - push @check_includes, @{$include_depends{$f}}; - - # Add included modules to the include_depends list. - if ( @$rmods ) { push @{$include_depends{$f}}, @$rmods; } -} - -#print STDERR "\%include_depends\n"; -#while ( ($k,$v) = each %include_depends ) { -# print STDERR (ref $v ? "$k => @$v\n" : "$k => $v\n"); -#} - -# Remove include file dependencies that are not in the Filepath. -my $i, $ii; -foreach $f (keys %include_depends) { - - unless (ref $include_depends{$f}) { next; } - $rincs = $include_depends{$f}; - unless (@$rincs) { next; } - $ii = 0; - $num_incs = @$rincs; - for ($i = 0; $i < $num_incs; ++$i) { - if ($include_depends{$$rincs[$ii]} == -1) { - splice @$rincs, $ii, 1; - next; - } - ++$ii; - } -} - -# Substitute the include file dependencies into the %file_includes lists. -foreach $f (keys %file_includes) { - my @expand_incs = (); - - # Initialize the expanded %file_includes list. - my $i; - unless (@{$file_includes{$f}}) { next; } - foreach $i (@{$file_includes{$f}}) { - push @expand_incs, $i unless ($include_depends{$i} == -1); - } - unless (@expand_incs) { - $file_includes{$f} = []; - next; - } - - # Expand - for ($i = 0; $i <= $#expand_incs; ++$i) { - push @expand_incs, @{ $include_depends{$expand_incs[$i]} }; - } - - $file_includes{$f} = rm_duplicates(\@expand_incs); -} - -#print STDERR "expanded \%file_includes\n"; -#while ( ($k,$v) = each %file_includes ) { -# print STDERR "$k => @$v\n"; -#} - -# Print dependencies to STDOUT. -foreach $f (sort keys %file_modules) { - $f =~ /(.+)\./; - $target = "$1.o"; - if ( defined $opt{'t'} ) { $target = "$opt{'t'}/$1.o"; } - print "$target : $f @{$file_modules{$f}} @{$file_includes{$f}}\n"; -} - -#-------------------------------------------------------------------------------------- - -sub find_dependencies { - - # Find dependencies of input file. - # Use'd Fortran 90 modules are returned in \@mods. - # Files that are "#include"d by the cpp preprocessor are returned in \@incs. - - my( $file ) = @_; - my( @mods, @incs ); - - open(FH, $file) or die "Can't open $file: $!\n"; - - while ( ) { - # Search for "#include" and strip filename when found. - if ( /^#include\s+[<"](.*)[>"]/ ) { - push @incs, $1; - } - # Search for Fortran include dependencies. - elsif ( /^\s*include\s+['"](.*)['"]/ ) { #" for emacs fontlock - push @incs, $1; - } - # Search for module dependencies. - elsif ( /^\s*USE\s+(\w+)/i ) { - ($module = $1) =~ tr/a-z/A-Z/; - # Return dependency in the form of a .o version of the file that contains - # the module. this is from the source list. - if ( defined $module_files{$module} ) { - if ( defined $obj_dir ) { - push @mods, "$obj_dir/$module_files{$module}.o"; - } else { - push @mods, "$module_files{$module}.o"; - } - } - # Return dependency in the form of a .mod version of the file that contains - # the module. this is from the .mod list. only if .o version not found - elsif ( defined $trumod_files{$module} ) { - if ( defined $obj_dir ) { - push @mods, "$obj_dir/$trumod_files{$module}.mod"; - } else { - push @mods, "$trumod_files{$module}.mod"; - } - } - } - } - close( FH ); - return (\@mods, \@incs); -} - -#-------------------------------------------------------------------------------------- - -sub find_file { - -# Search for the specified file in the list of directories in the global -# array @file_paths. Return the first occurance found, or the null string if -# the file is not found. - - my($file) = @_; - my($dir, $fname); - - foreach $dir (@file_paths) { - $fname = "$dir/$file"; - if ( -f $fname ) { return $fname; } - } - return ''; # file not found -} - -#-------------------------------------------------------------------------------------- - -sub rm_duplicates { - -# Return a list with duplicates removed. - - my ($in) = @_; # input arrary reference - my @out = (); - my $i; - my %h = (); - foreach $i (@$in) { - $h{$i} = ''; - } - @out = keys %h; - return \@out; -} - -#-------------------------------------------------------------------------------------- - -sub usage { - ($ProgName = $0) =~ s!.*/!!; # name of program - die < shr_kind_r8 - implicit none - save - - real(R8),parameter :: SHR_CONST_REARTH = 6.37122e6_R8 ! radius of earth ~ m - real(r8),parameter :: re_km = SHR_CONST_REARTH*0.001 ! radius of earth (km) - -end module constMod diff --git a/tools/mkprocdata_map/src/fileutils.F90 b/tools/mkprocdata_map/src/fileutils.F90 deleted file mode 100644 index e1f8e633da..0000000000 --- a/tools/mkprocdata_map/src/fileutils.F90 +++ /dev/null @@ -1,282 +0,0 @@ -module fileutils - -!----------------------------------------------------------------------- -!BOP -! -! !MODULE: fileutils -! -! !DESCRIPTION: -! Module containing file I/O utilities -! -! !USES: -! -! !PUBLIC TYPES: - implicit none - save -! -! !PUBLIC MEMBER FUNCTIONS: - public :: get_filename !Returns filename given full pathname - public :: opnfil !Open local unformatted or formatted file - public :: getfil !Obtain local copy of file - public :: relavu !Close and release Fortran unit no longer in use - public :: getavu !Get next available Fortran unit number -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !PRIVATE MEMBER FUNCTIONS: None -!EOP -!----------------------------------------------------------------------- - -contains - -!----------------------------------------------------------------------- -!BOP -! -! !IROUTINE: get_filename -! -! !INTERFACE: - character(len=256) function get_filename (fulpath) -! -! !DESCRIPTION: -! Returns filename given full pathname -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fulpath !full pathname -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer i !loop index - integer klen !length of fulpath character string -!------------------------------------------------------------------------ - - klen = len_trim(fulpath) - do i = klen, 1, -1 - if (fulpath(i:i) == '/') go to 10 - end do - i = 0 -10 get_filename = fulpath(i+1:klen) - - end function get_filename - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: set_filename -! -! !INTERFACE: - character(len=256) function set_filename (rem_dir, loc_fn) -! -! !DESCRIPTION: -! -! !ARGUMENTS: -! - implicit none - character(len=*), intent(in) :: rem_dir !remote directory - character(len=*), intent(in) :: loc_fn !local full path filename -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer :: i !integer -!------------------------------------------------------------------------ - - set_filename = ' ' - do i = len_trim(loc_fn), 1, -1 - if (loc_fn(i:i)=='/') go to 10 - end do - i = 0 -10 set_filename = trim(rem_dir) // loc_fn(i+1:len_trim(loc_fn)) - - end function set_filename - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: getfil -! -! !INTERFACE: - subroutine getfil (fulpath, locfn, iflag) -! -! !DESCRIPTION: -! Obtain local copy of file -! First check current working directory -! Next check full pathname[fulpath] on disk -! Finally check full pathname[fulpath] on archival system -! -! !USES: -! -! !ARGUMENTS: - implicit none - character(len=*), intent(in) :: fulpath !Archival or permanent disk full pathname - character(len=*), intent(out) :: locfn !output local file name - integer, optional, intent(in) :: iflag !0=>abort if file not found 1=>do not abort -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer i !loop index - integer klen !length of fulpath character string - integer ierr !error status - logical lexist !true if local file exists - character(len=len(fulpath)+5) :: fulpath2 !Archival full pathname -!------------------------------------------------------------------------ - - ! get local file name from full name: start at end. look for first "/" - - klen = len_trim(fulpath) - do i = klen, 1, -1 - if (fulpath(i:i).eq.'/') go to 100 - end do - i = 0 -100 locfn = fulpath(i+1:klen) - if (len_trim(locfn) == 0) then - write(6,*)'(GETFIL): local filename has zero length' - stop 1 - else - write(6,*)'(GETFIL): attempting to find local file ',trim(locfn) - endif - - ! first check if file is in current working directory. - - inquire (file=locfn,exist=lexist) - if (lexist) then - write(6,*) '(GETFIL): using ',trim(locfn),' in current working directory' - RETURN - endif - - ! second check for full pathname on disk - - inquire(file=fulpath, exist=lexist) - if (lexist) then - locfn = trim(fulpath) - write(6,*) '(GETFIL): using ',trim(fulpath) - RETURN - else - write(6,*) 'GETFIL: FAILED to get '//trim(fulpath) - stop 1 - end if - - end subroutine getfil - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: opnfil -! -! !INTERFACE: - subroutine opnfil (locfn, iun, form) -! -! !DESCRIPTION: -! Open file locfn in unformatted or formatted form on unit iun -! -! !ARGUMENTS: -! - implicit none - character(len=*), intent(in):: locfn !file name - integer, intent(in):: iun !fortran unit number - character(len=1), intent(in):: form !file format: u = unformatted, - !f = formatted -! -! !REVISION HISTORY: -! Created by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP - integer ioe !error return from fortran open - character(len=11) ft !format type: formatted. unformatted -!------------------------------------------------------------------------ - - if (len_trim(locfn) == 0) then - write(6,*)'OPNFIL: local filename has zero length' - stop 1 - endif - if (form=='u' .or. form=='U') then - ft = 'unformatted' - else - ft = 'formatted ' - end if - open (unit=iun,file=locfn,status='unknown',form=ft,iostat=ioe) - if (ioe /= 0) then - write(6,*)'(OPNFIL): failed to open file ',trim(locfn), & - & ' on unit ',iun,' ierr=',ioe - stop 1 - else - write(6,*)'(OPNFIL): Successfully opened file ',trim(locfn),' on unit= ',iun - end if - - end subroutine opnfil - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: getavu -! -! !INTERFACE: - integer function getavu() -! -! !DESCRIPTION: -! Get next available Fortran unit number. -! -! !USES: - use shr_file_mod, only : shr_file_getUnit -! -! !ARGUMENTS: - implicit none -! -! !REVISION HISTORY: -! Created by Gordon Bonan -! Modified for clm2 by Mariana Vertenstein -! -! -! !LOCAL VARIABLES: -!EOP -!------------------------------------------------------------------------ - - getavu = shr_file_getunit() - - end function getavu - -!------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: relavu -! -! !INTERFACE: - subroutine relavu (iunit) -! -! !DESCRIPTION: -! Close and release Fortran unit no longer in use! -! -! !USES: - use shr_file_mod, only : shr_file_freeUnit -! -! !ARGUMENTS: - implicit none - integer, intent(in) :: iunit !Fortran unit number -! -! !REVISION HISTORY: -! Created by Gordon Bonan -! -!EOP -!------------------------------------------------------------------------ - - close(iunit) - call shr_file_freeUnit(iunit) - - end subroutine relavu - -end module fileutils diff --git a/tools/mkprocdata_map/src/fmain.F90 b/tools/mkprocdata_map/src/fmain.F90 deleted file mode 100644 index ba9e593c1d..0000000000 --- a/tools/mkprocdata_map/src/fmain.F90 +++ /dev/null @@ -1,78 +0,0 @@ -program fmain - - use mkprocdata_map, only : mkmap - implicit none - - character(len= 256) :: arg - integer :: n !index - integer :: nargs !number of arguments - integer, external :: iargc !number of arguments function - character(len=256) :: filei !input file - character(len=256) :: fileo !output mapped file - character(len=256) :: fmap !maping file - character(len=256) :: ftemplate !template file, containing lat & lon arrays desired in output file - character(len=256) :: cmdline !input command line - integer, parameter :: inival = -999 !initial value for command-line integers - !---------------------------------------------------- - - filei = ' ' - fileo = ' ' - fmap = ' ' - ftemplate = ' ' - - cmdline = 'mkprocdata_map' - nargs = iargc() - n = 1 - do while (n <= nargs) - arg = ' ' - call getarg (n, arg) - n = n + 1 - - select case (arg) - case ('-i') - call getarg (n, arg) - n = n + 1 - filei = trim(arg) - cmdline = trim(cmdline) // ' -i ' // trim(arg) - case ('-o') - call getarg (n, arg) - n = n + 1 - fileo = trim(arg) - cmdline = trim(cmdline) // ' -o ' // trim(arg) - case ('-m') - call getarg (n, arg) - n = n + 1 - fmap = trim(arg) - cmdline = trim(cmdline) // ' -m ' // trim(arg) - case ('-t') - call getarg (n, arg) - n = n + 1 - ftemplate = trim(arg) - cmdline = trim(cmdline) // ' -t ' // trim(arg) - case default - write (6,*) 'Argument ', arg,' is not known' - call usage_exit (' ') - cmdline = trim(cmdline) // ' ' // trim(arg) - end select - end do - - if (filei == ' ' .or. fileo == ' ' .or. fmap == ' ' & - .or. ftemplate == ' ') then - call usage_exit ('Must specify all the following arguments') - end if - - call mkmap (filei, fileo, fmap, ftemplate) - -end program fmain - - -subroutine usage_exit (arg) - implicit none - character(len=*) :: arg - if (arg /= ' ') write (6,*) arg - write (6,*) 'Usage: mkprocdata_map -i -o -m -t